From cff05e17e6b7a46724f5d3a01be2eaf629ffcab1 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 10 Aug 2022 11:57:32 +0530 Subject: [PATCH 001/103] sdk migration test latest --- .../IBM/vpc-go-sdk/.bumpversion.cfg | 13 + .../github.com/IBM/vpc-go-sdk/.gitattributes | 1 + common/github.com/IBM/vpc-go-sdk/.gitignore | 18 + common/github.com/IBM/vpc-go-sdk/.releaserc | 21 + common/github.com/IBM/vpc-go-sdk/.travis.yml | 39 + common/github.com/IBM/vpc-go-sdk/CHANGELOG.md | 96 + .../IBM/vpc-go-sdk/CODE_OF_CONDUCT.md | 76 + .../github.com/IBM/vpc-go-sdk/CONTRIBUTING.md | 14 + common/github.com/IBM/vpc-go-sdk/LICENSE | 201 + common/github.com/IBM/vpc-go-sdk/Makefile | 23 + common/github.com/IBM/vpc-go-sdk/README.md | 195 + .../IBM/vpc-go-sdk/common/headers.go | 53 + .../IBM/vpc-go-sdk/common/headers_test.go | 25 + .../IBM/vpc-go-sdk/common/version.go | 4 + common/github.com/IBM/vpc-go-sdk/go.mod | 17 + common/github.com/IBM/vpc-go-sdk/go.sum | 143 + .../IBM/vpc-go-sdk/package-lock.json | 828 + .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 82272 +++++++++++++++ .../IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go | 83898 ++++++++++++++++ go.mod | 1 + 20 files changed, 167938 insertions(+) create mode 100644 common/github.com/IBM/vpc-go-sdk/.bumpversion.cfg create mode 100644 common/github.com/IBM/vpc-go-sdk/.gitattributes create mode 100644 common/github.com/IBM/vpc-go-sdk/.gitignore create mode 100644 common/github.com/IBM/vpc-go-sdk/.releaserc create mode 100644 common/github.com/IBM/vpc-go-sdk/.travis.yml create mode 100644 common/github.com/IBM/vpc-go-sdk/CHANGELOG.md create mode 100644 common/github.com/IBM/vpc-go-sdk/CODE_OF_CONDUCT.md create mode 100644 common/github.com/IBM/vpc-go-sdk/CONTRIBUTING.md create mode 100644 common/github.com/IBM/vpc-go-sdk/LICENSE create mode 100644 common/github.com/IBM/vpc-go-sdk/Makefile create mode 100644 common/github.com/IBM/vpc-go-sdk/README.md create mode 100644 common/github.com/IBM/vpc-go-sdk/common/headers.go create mode 100644 common/github.com/IBM/vpc-go-sdk/common/headers_test.go create mode 100644 common/github.com/IBM/vpc-go-sdk/common/version.go create mode 100644 common/github.com/IBM/vpc-go-sdk/go.mod create mode 100644 common/github.com/IBM/vpc-go-sdk/go.sum create mode 100644 common/github.com/IBM/vpc-go-sdk/package-lock.json create mode 100644 common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go create mode 100644 common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go diff --git a/common/github.com/IBM/vpc-go-sdk/.bumpversion.cfg b/common/github.com/IBM/vpc-go-sdk/.bumpversion.cfg new file mode 100644 index 0000000000..75285ab0b2 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/.bumpversion.cfg @@ -0,0 +1,13 @@ +[bumpversion] +current_version = 0.6.0 +commit = True +message = Update version {current_version} -> {new_version} [skip ci] + +[bumpversion:file:common/version.go] +search = const Version = "{current_version}" +replace = const Version = "{new_version}" + +[bumpversion:file:README.md] +search = {current_version} +replace = {new_version} + diff --git a/common/github.com/IBM/vpc-go-sdk/.gitattributes b/common/github.com/IBM/vpc-go-sdk/.gitattributes new file mode 100644 index 0000000000..3bfcae65ad --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/.gitattributes @@ -0,0 +1 @@ +*.enc binary \ No newline at end of file diff --git a/common/github.com/IBM/vpc-go-sdk/.gitignore b/common/github.com/IBM/vpc-go-sdk/.gitignore new file mode 100644 index 0000000000..2be5a24d4d --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/.gitignore @@ -0,0 +1,18 @@ +# OS stuff +.DS_Store + +# generator files +.openapi-generator-ignore +.openapi-generator/VERSION + +# credentials +.env +*.env + +# ignore vendor/ +vendor/ + +/.project +/.openapi-generator/ + +main/ \ No newline at end of file diff --git a/common/github.com/IBM/vpc-go-sdk/.releaserc b/common/github.com/IBM/vpc-go-sdk/.releaserc new file mode 100644 index 0000000000..a746388363 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/.releaserc @@ -0,0 +1,21 @@ +{ + "debug": true, + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + [ + "@semantic-release/exec", + { + "prepareCmd": "bump2version --allow-dirty --current-version ${lastRelease.version} --new-version ${nextRelease.version} patch" + } + ], + [ + "@semantic-release/git", + { + "message": "chore(release): ${nextRelease.version} release notes [skip ci]\n\n${nextRelease.notes}" + } + ], + "@semantic-release/github" + ] +} diff --git a/common/github.com/IBM/vpc-go-sdk/.travis.yml b/common/github.com/IBM/vpc-go-sdk/.travis.yml new file mode 100644 index 0000000000..464cdde97c --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/.travis.yml @@ -0,0 +1,39 @@ +language: go + +dist: xenial + +notifications: + email: true + +go: +- 1.14.x + +env: + global: + - GO111MODULE=on + +before_install: +- sudo apt-get update +- sudo apt-get install python +- nvm install 12 +- npm install -g npm@6.x + +install: +- curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.37.1 + +script: +- make travis-ci + +# before_deploy: +# - pip install --user bump2version +# - npm install @semantic-release/changelog +# - npm install @semantic-release/exec +# - npm install @semantic-release/git +# - npm install @semantic-release/github + +# deploy: +# - provider: script +# script: npx semantic-release +# skip_cleanup: true +# on: +# branch: master diff --git a/common/github.com/IBM/vpc-go-sdk/CHANGELOG.md b/common/github.com/IBM/vpc-go-sdk/CHANGELOG.md new file mode 100644 index 0000000000..37bf62185e --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/CHANGELOG.md @@ -0,0 +1,96 @@ +## [1.0.1](https://github.com/IBM/vpc-go-sdk/compare/v1.0.0...v1.0.1) (2021-04-07) + + +### Bug Fixes + +* **release:** Update SDKs to use API version 2021-03-30 ([#27](https://github.com/IBM/vpc-go-sdk/issues/27)) ([ba27a36](https://github.com/IBM/vpc-go-sdk/commit/ba27a36f743d07a1cae4fb45f83478adf4d33d79)) + +# [1.0.0](https://github.com/IBM/vpc-go-sdk/compare/v0.4.2...v1.0.0) (2021-03-16) + + +### Performance Improvements + +* **Instance-groups:** Update VPC SDK with API version 2021-03-09 ([#23](https://github.com/IBM/vpc-go-sdk/issues/23)) ([d6dc319](https://github.com/IBM/vpc-go-sdk/commit/d6dc319bb5aa19aff4fd89872198b6e573545110)) + + +### BREAKING CHANGES + +* **Instance-groups:** - Methods for Instance group manager is now producing InstanceGroupManagerIntf instead of InstanceGroupManager + +## [0.4.2](https://github.com/IBM/vpc-go-sdk/compare/v0.4.1...v0.4.2) (2021-03-02) + + +### Bug Fixes + +* **release:** Update SDKs to use API version 2021-02-09 ([#20](https://github.com/IBM/vpc-go-sdk/issues/20)) ([ae348ee](https://github.com/IBM/vpc-go-sdk/commit/ae348ee347f7405fac4ab4574392673a9194f6bd)) + +## [0.4.1](https://github.com/IBM/vpc-go-sdk/compare/v0.4.0...v0.4.1) (2021-01-18) + + +### Bug Fixes + +* **release:** Update SDKs to use API version 2020-01-12 ([#18](https://github.com/IBM/vpc-go-sdk/issues/18)) ([d8c2134](https://github.com/IBM/vpc-go-sdk/commit/d8c21345b1ed032484fbaf57456d4f476423b5fc)) + +# [0.4.0](https://github.com/IBM/vpc-go-sdk/compare/v0.3.1...v0.4.0) (2020-12-17) + + +### Features + +* **enhancement:** Update VPC service with API version 2020-12-15 ([#17](https://github.com/IBM/vpc-go-sdk/issues/17)) ([affcaed](https://github.com/IBM/vpc-go-sdk/commit/affcaed4e8f7e515148cb9aac82755ad2a3ea8ca)) + +## [0.3.1](https://github.com/IBM/vpc-go-sdk/compare/v0.3.0...v0.3.1) (2020-11-20) + + +### Bug Fixes + +* **SecurityGroup:** Update both VPC services fixing security group issue. ([#16](https://github.com/IBM/vpc-go-sdk/issues/16)) ([270decd](https://github.com/IBM/vpc-go-sdk/commit/270decd989abd0ed5b9cd101d6c7a2fcb9deecc2)) + +# [0.3.0](https://github.com/IBM/vpc-go-sdk/compare/v0.2.0...v0.3.0) (2020-11-20) + + +### Features + +* **SDK:** Update VPC Gen2 and Gen1 services with API version 2020-11-17 ([#15](https://github.com/IBM/vpc-go-sdk/issues/15)) ([6f97a1a](https://github.com/IBM/vpc-go-sdk/commit/6f97a1a643dce6d76f8ada9caecc49d864b656fa)) + +# [0.2.0](https://github.com/IBM/vpc-go-sdk/compare/v0.1.1...v0.2.0) (2020-10-16) + + +### Features + +* **version update:** Update both services with API version 2020-10-06 ([#14](https://github.com/IBM/vpc-go-sdk/issues/14)) ([179880c](https://github.com/IBM/vpc-go-sdk/commit/179880c4775e0d6e6a9e683546348b34e9f9b785)) + +## [0.1.1](https://github.com/IBM/vpc-go-sdk/compare/v0.1.0...v0.1.1) (2020-09-09) + + +### Bug Fixes + +* **NLB:** update NLB feature ([#13](https://github.com/IBM/vpc-go-sdk/issues/13)) ([99d207d](https://github.com/IBM/vpc-go-sdk/commit/99d207dba81fef5214be63864aa7a4b91af82c89)) + +# [0.1.0](https://github.com/IBM/vpc-go-sdk/compare/v0.0.3...v0.1.0) (2020-09-03) + + +### Features + +* **autoscale:** Add autoscale feature and NLB feature ([#12](https://github.com/IBM/vpc-go-sdk/issues/12)) ([0ee5ea1](https://github.com/IBM/vpc-go-sdk/commit/0ee5ea16247a6f94794674d0499c01e78857d6a4)) + +## [0.0.3](https://github.com/IBM/vpc-go-sdk/compare/v0.0.2...v0.0.3) (2020-08-06) + + +### Bug Fixes + +* **version:** Release SDK for API version 2020-07-28 ([#10](https://github.com/IBM/vpc-go-sdk/issues/10)) ([4550ccc](https://github.com/IBM/vpc-go-sdk/commit/4550cccb167443bad8857dc88fc097ad18061734)) + +## [0.0.2](https://github.com/IBM/vpc-go-sdk/compare/v0.0.1...v0.0.2) (2020-07-06) + + +### Bug Fixes + +* **doc:** Minor update to example code in the README ([#9](https://github.com/IBM/vpc-go-sdk/issues/9)) ([f3841fc](https://github.com/IBM/vpc-go-sdk/commit/f3841fcfbffab66d970ec966b558a48180f0651c)) + +## [0.0.1](https://github.com/IBM/vpc-go-sdk/compare/v0.0.0...v0.0.1) (2020-06-19) + + +### Bug Fixes + +* **go-sdk:** adding semantic release versioning ([#4](https://github.com/IBM/vpc-go-sdk/issues/4)) ([1d92ee5](https://github.com/IBM/vpc-go-sdk/commit/1d92ee5d6481c923382628e8dfc9b9de51cc7ddd)) +* **version:** Update version to enable semantic release ([#6](https://github.com/IBM/vpc-go-sdk/issues/6)) ([2699a61](https://github.com/IBM/vpc-go-sdk/commit/2699a615cd9fad5de60ef442c7512a8744c676a1)) diff --git a/common/github.com/IBM/vpc-go-sdk/CODE_OF_CONDUCT.md b/common/github.com/IBM/vpc-go-sdk/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..7303c87870 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at phil_adams@us.ibm.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/common/github.com/IBM/vpc-go-sdk/CONTRIBUTING.md b/common/github.com/IBM/vpc-go-sdk/CONTRIBUTING.md new file mode 100644 index 0000000000..fee9f665c1 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/CONTRIBUTING.md @@ -0,0 +1,14 @@ +# Questions +If you are having problems using the APIs or have a question about IBM Cloud services, +please ask a question at +[Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-cloud). + +# Issues +If you encounter an issue with the project, you are welcome to submit a +[bug report](https://github.com/IBM/vpc-go-sdk/issues). +Before that, please search for similar issues. It's possible that someone has already reported the problem. + +# General Information +For general guidance on contributing to this project, please see +[this link](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/CONTRIBUTING_go.md) + diff --git a/common/github.com/IBM/vpc-go-sdk/LICENSE b/common/github.com/IBM/vpc-go-sdk/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/common/github.com/IBM/vpc-go-sdk/Makefile b/common/github.com/IBM/vpc-go-sdk/Makefile new file mode 100644 index 0000000000..81fb2e0b5a --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/Makefile @@ -0,0 +1,23 @@ +# Makefile + +all: build lint tidy + +travis-ci: build lint tidy test-unit + +build: + go build ./vpcv1 + +test-unit: + go test `go list ./... | grep vpcv1` -v -tags=unit + +test-integration: + go test `go list ./... | grep vpcv1` -v -tags=integration -skipForMockTesting -testCount + +test-examples: + go test `go list ./... | grep vpcv1` -v -tags=examples + +lint: + golangci-lint --timeout=2m run + +tidy: + go mod tidy diff --git a/common/github.com/IBM/vpc-go-sdk/README.md b/common/github.com/IBM/vpc-go-sdk/README.md new file mode 100644 index 0000000000..495cea1a68 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/README.md @@ -0,0 +1,195 @@ +[![Build Status](https://travis-ci.com/IBM/vpc-go-sdk.svg?branch=master)](https://travis-ci.com/IBM/vpc-go-sdk) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +![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.16.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.16.0 from now on. Refrain from using commands like `go get -u ..` and `go get ..@latest` 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 + + + + +- [Overview](#overview) +- [Prerequisites](#prerequisites) +- [Installation](#installation) + + [`go get` command](#go-get-command) + + [Go modules](#go-modules) + + [`dep` dependency manager](#dep-dependency-manager) +- [Using the SDK](#using-the-sdk) +- [Setting up VPC service](#setting-up-vpc-service) +- [Questions](#questions) +- [Issues](#issues) +- [Open source @ IBM](#open-source--ibm) +- [Contributing](#contributing) +- [License](#license) + + + +## Overview + +The IBM Cloud VPC Go SDK allows developers to programmatically interact with the following IBM Cloud services: + +Service Name | Package name +--- | --- +[VPC](https://cloud.ibm.com/apidocs/vpc) | vpcv1 + +## Prerequisites + +[ibm-cloud-onboarding]: https://cloud.ibm.com/registration + +* An [IBM Cloud][ibm-cloud-onboarding] account. +* An IAM API key to allow the SDK to access your account. Create an apikey [here](https://cloud.ibm.com/iam/apikeys). +* Go version 1.12 or above. + +## Installation +There are a few different ways to download and install the VPC Go SDK services for use by your +Go application: + +#### `go get` command +Use this command to download and install the VPC Go SDK service to allow your Go application to +use it: + +``` +go get github.com/IBM/vpc-go-sdk@v0.14.0 +``` + + +#### Go modules +If your application is using Go modules, you can add a suitable import to your +Go application, like this: + + +```go +import ( + "github.com/IBM/vpc-go-sdk/vpcv1" +) +``` + +Then run `go mod tidy` to download and install the new dependency and update your Go application's +`go.mod` file. + + +#### `dep` dependency manager +If your application is using the `dep` dependency management tool, you can add a dependency +to your `Gopkg.toml` file. Here is an example: + +``` +[[constraint]] + name = "github.com/IBM/vpc-go-sdk/" + version = "0.16.0" +``` + +Then run `dep ensure`. + +## Using the SDK +For general SDK usage information, see the [IBM Cloud SDK Common README](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/README.md) + +## Setting up VPC service + +A quick example to get you up and running with VPC Go SDK service in Dallas (us-south) region. + +For other regions, see [API Endpoints for VPC](https://cloud.ibm.com/apidocs/vpc#api-endpoint) and update the `URL` variable accordingly. + + +Refer to the [VPC Release Notes](https://cloud.ibm.com/docs/vpc?topic=vpc-release-notes) to find out latest version release. + +```go +package main + +import ( + "log" + "os" + + "github.com/IBM/go-sdk-core/v4/core" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func main() { + apiKey := os.Getenv("IBMCLOUD_API_KEY") + if apiKey == "" { + log.Fatal("No API key set") + } + + // Instantiate the service with an API key based IAM authenticator + vpcService, err := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + Authenticator: &core.IamAuthenticator{ + ApiKey: apiKey, + }, + }) + if err != nil { + log.Fatal("Error creating VPC Service.") + } + + // Retrieve the list of regions for your account. + regions, detailedResponse, err := vpcService.ListRegions(&vpcv1.ListRegionsOptions{}) + if err != nil { + log.Fatalf("Failed to list the regions: %v and the response is: %s", err, detailedResponse) + } + log.Printf("Regions: %#v", regions) + + // Retrieve the list of vpcs for your account. + vpcs, detailedResponse, err := vpcService.ListVpcs(&vpcv1.ListVpcsOptions{}) + if err != nil { + log.Fatalf("Failed to list vpcs: %v and the response is: %s", err, detailedResponse) + } + log.Printf("VPCs: %#v", vpcs) + + // Create an SSH key + sshKeyOptions := &vpcv1.CreateKeyOptions{ + Name: core.StringPtr("my-ssh-key"), + } + // Setters also exist to set fields are the struct has been created + sshKeyOptions.SetPublicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsnrSAe8eBi8mS576Z96UtYgUzDR9Sbw/s1ELxsa1KUK82JQ0Ejmz31N6sHyiT/l5533JgGL6rKamLFziMY2VX2bdyuF5YzyHhmapT+e21kuTatB50UsXzxlYEWpCmFdnd4LhwFn6AycJWOV0k3e0ePpVxgHc+pVfE89322cbmfuppeHxvxc+KSzQNYC59A+A2vhucbuWppyL3EIF4YgLwOr5iDISm1IR0+EEL3yJQIG4M2WKu526anI85QBcIWyFwQXOpdcX2eZRcd6WW2EgAM3fIOaezkm0CFrsz8rQ0MPYZI4BS2CWwg5d4Bj7SU2sjXz62gfQkQGTYWSqhizVb root@localhost") + key, detailedResponse, err := vpcService.CreateKey(sshKeyOptions) + if err != nil { + log.Fatalf("Failed to create the ssh key: %v and the response is: %s", err, detailedResponse) + } + log.Printf("SSH key: %s created with ID: %s", *key.Name, *key.ID) + + // Delete SSH key + detailedResponse, err = vpcService.DeleteKey(&vpcv1.DeleteKeyOptions{ + ID: key.ID, + }) + if err != nil { + log.Fatalf("Failed to delete the ssh key: %v and the response is: %s", err, detailedResponse) + } + + log.Printf("SSH key: %s deleted with ID: %s", *key.Name, *key.ID) +} +``` + +## Questions + +If you have difficulties using this SDK or you have a question about the IBM Cloud services, +ask a question at +[Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-cloud). + +## Issues +If you encounter an issue with the project, you are welcome to submit a +[bug report](/issues). +Before you create a new issue, search for similar issues. It's possible that someone has already reported the problem. + +## Open source @ IBM +Find more open source projects on the [IBM Github Page](http://ibm.github.io/). + +## Contributing +See [CONTRIBUTING](CONTRIBUTING.md). + +## License + +This SDK project is released under the Apache 2.0 license. +The license's full text can be found in [LICENSE](LICENSE). diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers.go b/common/github.com/IBM/vpc-go-sdk/common/headers.go new file mode 100644 index 0000000000..4f74ffc296 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/common/headers.go @@ -0,0 +1,53 @@ +package common + +import ( + "fmt" + "runtime" +) + +const ( + HEADER_NAME_USER_AGENT = "User-Agent" + + SDK_NAME = "vpc-go-sdk" +) + +// +// GetSdkHeaders - returns the set of SDK-specific headers to be included in an outgoing request. +// +// This function is invoked by generated service methods (i.e. methods which implement the REST API operations +// defined within the API definition). The purpose of this function is to give the SDK implementor the opportunity +// to provide SDK-specific HTTP headers that will be sent with an outgoing REST API request. +// This function is invoked for each invocation of a generated service method, +// so the set of HTTP headers could be request-specific. +// As an optimization, if your SDK will be returning the same set of HTTP headers for each invocation of this +// function, it is recommended that you initialize the returned map just once (perhaps by using +// lazy initialization) and simply return it each time the function is invoked, instead of building it each time +// as in the example below. +// +// Parameters: +// serviceName - the name of the service as defined in the API definition (e.g. "MyService1") +// serviceVersion - the version of the service as defined in the API definition (e.g. "V1") +// operationId - the operationId as defined in the API definition (e.g. getContext) +// +// Returns: +// a Map which contains the set of headers to be included in the REST API request +// +func GetSdkHeaders(serviceName string, serviceVersion string, operationId string) map[string]string { + sdkHeaders := make(map[string]string) + + sdkHeaders[HEADER_NAME_USER_AGENT] = GetUserAgentInfo() + + return sdkHeaders +} + +var userAgent string = fmt.Sprintf("%s-%s %s", SDK_NAME, Version, GetSystemInfo()) + +func GetUserAgentInfo() string { + return userAgent +} + +var systemInfo = fmt.Sprintf("(arch=%s; os=%s; go.version=%s)", runtime.GOARCH, runtime.GOOS, runtime.Version()) + +func GetSystemInfo() string { + return systemInfo +} diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers_test.go b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go new file mode 100644 index 0000000000..deca50645d --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go @@ -0,0 +1,25 @@ +package common + +import ( + "github.com/stretchr/testify/assert" + "strings" + "testing" +) + +func TestGetSystemInfo(t *testing.T) { + var sysinfo = GetSystemInfo() + assert.NotNil(t, sysinfo) + assert.True(t, strings.Contains(sysinfo, "arch=")) + assert.True(t, strings.Contains(sysinfo, "os=")) + assert.True(t, strings.Contains(sysinfo, "go.version=")) +} + +func TestGetSdkHeaders(t *testing.T) { + var headers = GetSdkHeaders("myService", "v123", "myOperation") + assert.NotNil(t, headers) + + var foundIt bool + + _, foundIt = headers[HEADER_NAME_USER_AGENT] + assert.True(t, foundIt) +} diff --git a/common/github.com/IBM/vpc-go-sdk/common/version.go b/common/github.com/IBM/vpc-go-sdk/common/version.go new file mode 100644 index 0000000000..623548bdac --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/common/version.go @@ -0,0 +1,4 @@ +package common + +// Version of the SDK +const Version = "0.6.0" diff --git a/common/github.com/IBM/vpc-go-sdk/go.mod b/common/github.com/IBM/vpc-go-sdk/go.mod new file mode 100644 index 0000000000..e5a8a79f8e --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/go.mod @@ -0,0 +1,17 @@ +module github.com/IBM/vpc-go-sdk + +go 1.16 + +require ( + github.com/IBM/go-sdk-core/v5 v5.9.5 + github.com/go-openapi/strfmt v0.21.1 + github.com/onsi/ginkgo v1.14.2 + github.com/onsi/gomega v1.10.5 + github.com/stretchr/testify v1.7.0 +) + +retract ( + v1.0.2 + v1.0.1 + v1.0.0 +) \ No newline at end of file diff --git a/common/github.com/IBM/vpc-go-sdk/go.sum b/common/github.com/IBM/vpc-go-sdk/go.sum new file mode 100644 index 0000000000..88c822dd8e --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/go.sum @@ -0,0 +1,143 @@ +github.com/IBM/go-sdk-core/v5 v5.9.1 h1:06pXbD9Rgmqqe2HA5YAeQbB4eYRRFgIoOT+Kh3cp1zo= +github.com/IBM/go-sdk-core/v5 v5.9.1/go.mod h1:axE2JrRq79gIJTjKPBwV6gWHswvVptBjbcvvCPIxARM= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +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/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/go-openapi/errors v0.19.8 h1:doM+tQdZbUm9gydV9yR+iQNmztbjj7I3sW4sIcAwIzc= +github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/strfmt v0.21.1 h1:G6s2t5V5kGCHLVbSdZ/6lI8Wm4OzoPFkc3/cjAsKQrM= +github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= +github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +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= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +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.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4= +github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +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.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +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 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M= +github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +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.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ= +github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +go.mongodb.org/mongo-driver v1.7.5 h1:ny3p0reEpgsR2cfA5cjgwFZg3Cv/ofFh/8jbhGtz9VI= +go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/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/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v9 v9.31.0 h1:bmXmP2RSNtFES+bn4uYuHT7iJFJv7Vj+an+ZQdDaD1M= +gopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= +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= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/common/github.com/IBM/vpc-go-sdk/package-lock.json b/common/github.com/IBM/vpc-go-sdk/package-lock.json new file mode 100644 index 0000000000..20f48c59f1 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/package-lock.json @@ -0,0 +1,828 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "@babel/code-frame": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", + "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", + "requires": { + "@babel/highlight": "^7.12.13" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==" + }, + "@babel/highlight": { + "version": "7.13.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz", + "integrity": "sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==", + "requires": { + "@babel/helper-validator-identifier": "^7.12.11", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", + "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", + "requires": { + "@nodelib/fs.stat": "2.0.4", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==" + }, + "@nodelib/fs.walk": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", + "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", + "requires": { + "@nodelib/fs.scandir": "2.1.4", + "fastq": "^1.6.0" + } + }, + "@octokit/auth-token": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz", + "integrity": "sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA==", + "requires": { + "@octokit/types": "^6.0.3" + } + }, + "@octokit/core": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.4.0.tgz", + "integrity": "sha512-6/vlKPP8NF17cgYXqucdshWqmMZGXkuvtcrWCgU5NOI0Pl2GjlmZyWgBMrU8zJ3v2MJlM6++CiB45VKYmhiWWg==", + "requires": { + "@octokit/auth-token": "^2.4.4", + "@octokit/graphql": "^4.5.8", + "@octokit/request": "^5.4.12", + "@octokit/request-error": "^2.0.5", + "@octokit/types": "^6.0.3", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/endpoint": { + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.11.tgz", + "integrity": "sha512-fUIPpx+pZyoLW4GCs3yMnlj2LfoXTWDUVPTC4V3MUEKZm48W+XYpeWSZCv+vYF1ZABUm2CqnDVf1sFtIYrj7KQ==", + "requires": { + "@octokit/types": "^6.0.3", + "is-plain-object": "^5.0.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/graphql": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.6.1.tgz", + "integrity": "sha512-2lYlvf4YTDgZCTXTW4+OX+9WTLFtEUc6hGm4qM1nlZjzxj+arizM4aHWzBVBCxY9glh7GIs0WEuiSgbVzv8cmA==", + "requires": { + "@octokit/request": "^5.3.0", + "@octokit/types": "^6.0.3", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/openapi-types": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-6.0.0.tgz", + "integrity": "sha512-CnDdK7ivHkBtJYzWzZm7gEkanA7gKH6a09Eguz7flHw//GacPJLmkHA3f3N++MJmlxD1Fl+mB7B32EEpSCwztQ==" + }, + "@octokit/plugin-paginate-rest": { + "version": "2.13.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.13.3.tgz", + "integrity": "sha512-46lptzM9lTeSmIBt/sVP/FLSTPGx6DCzAdSX3PfeJ3mTf4h9sGC26WpaQzMEq/Z44cOcmx8VsOhO+uEgE3cjYg==", + "requires": { + "@octokit/types": "^6.11.0" + } + }, + "@octokit/plugin-request-log": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.3.tgz", + "integrity": "sha512-4RFU4li238jMJAzLgAwkBAw+4Loile5haQMQr+uhFq27BmyJXcXSKvoQKqh0agsZEiUlW6iSv3FAgvmGkur7OQ==" + }, + "@octokit/plugin-rest-endpoint-methods": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.0.0.tgz", + "integrity": "sha512-Jc7CLNUueIshXT+HWt6T+M0sySPjF32mSFQAK7UfAg8qGeRI6OM1GSBxDLwbXjkqy2NVdnqCedJcP1nC785JYg==", + "requires": { + "@octokit/types": "^6.13.0", + "deprecation": "^2.3.1" + } + }, + "@octokit/request": { + "version": "5.4.14", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.14.tgz", + "integrity": "sha512-VkmtacOIQp9daSnBmDI92xNIeLuSRDOIuplp/CJomkvzt7M18NXgG044Cx/LFKLgjKt9T2tZR6AtJayba9GTSA==", + "requires": { + "@octokit/endpoint": "^6.0.1", + "@octokit/request-error": "^2.0.0", + "@octokit/types": "^6.7.1", + "deprecation": "^2.0.0", + "is-plain-object": "^5.0.0", + "node-fetch": "^2.6.1", + "once": "^1.4.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/request-error": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.5.tgz", + "integrity": "sha512-T/2wcCFyM7SkXzNoyVNWjyVlUwBvW3igM3Btr/eKYiPmucXTtkxt2RBsf6gn3LTzaLSLTQtNmvg+dGsOxQrjZg==", + "requires": { + "@octokit/types": "^6.0.3", + "deprecation": "^2.0.0", + "once": "^1.4.0" + } + }, + "@octokit/rest": { + "version": "18.5.2", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.5.2.tgz", + "integrity": "sha512-Kz03XYfKS0yYdi61BkL9/aJ0pP2A/WK5vF/syhu9/kY30J8He3P68hv9GRpn8bULFx2K0A9MEErn4v3QEdbZcw==", + "requires": { + "@octokit/core": "^3.2.3", + "@octokit/plugin-paginate-rest": "^2.6.2", + "@octokit/plugin-request-log": "^1.0.2", + "@octokit/plugin-rest-endpoint-methods": "5.0.0" + } + }, + "@octokit/types": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.13.0.tgz", + "integrity": "sha512-W2J9qlVIU11jMwKHUp5/rbVUeErqelCsO5vW5PKNb7wAXQVUz87Rc+imjlEvpvbH8yUb+KHmv8NEjVZdsdpyxA==", + "requires": { + "@octokit/openapi-types": "^6.0.0" + } + }, + "@semantic-release/changelog": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@semantic-release/changelog/-/changelog-5.0.1.tgz", + "integrity": "sha512-unvqHo5jk4dvAf2nZ3aw4imrlwQ2I50eVVvq9D47Qc3R+keNqepx1vDYwkjF8guFXnOYaYcR28yrZWno1hFbiw==", + "requires": { + "@semantic-release/error": "^2.1.0", + "aggregate-error": "^3.0.0", + "fs-extra": "^9.0.0", + "lodash": "^4.17.4" + } + }, + "@semantic-release/error": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-2.2.0.tgz", + "integrity": "sha512-9Tj/qn+y2j+sjCI3Jd+qseGtHjOAeg7dU2/lVcqIQ9TV3QDaDXDYXcoOHU+7o2Hwh8L8ymL4gfuO7KxDs3q2zg==" + }, + "@semantic-release/exec": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/exec/-/exec-5.0.0.tgz", + "integrity": "sha512-t7LWXIvDJQbuGCy2WmMG51WyaGSLTvZBv9INvcI4S0kn+QjnnVVUMhcioIqhb0r3yqqarMzHVcABFug0q0OXjw==", + "requires": { + "@semantic-release/error": "^2.1.0", + "aggregate-error": "^3.0.0", + "debug": "^4.0.0", + "execa": "^4.0.0", + "lodash": "^4.17.4", + "parse-json": "^5.0.0" + } + }, + "@semantic-release/git": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/git/-/git-9.0.0.tgz", + "integrity": "sha512-AZ4Zha5NAPAciIJH3ipzw/WU9qLAn8ENaoVAhD6srRPxTpTzuV3NhNh14rcAo8Paj9dO+5u4rTKcpetOBluYVw==", + "requires": { + "@semantic-release/error": "^2.1.0", + "aggregate-error": "^3.0.0", + "debug": "^4.0.0", + "dir-glob": "^3.0.0", + "execa": "^4.0.0", + "lodash": "^4.17.4", + "micromatch": "^4.0.0", + "p-reduce": "^2.0.0" + } + }, + "@semantic-release/github": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/@semantic-release/github/-/github-7.2.1.tgz", + "integrity": "sha512-+gOhbaG4T3xJb6aTZu1/7KvCmYKRChkasdIyFWdaGaTWVeGpdl4o0zMviV1z3kRcgPOSXeqjHSQ6SOQAfHQiDw==", + "requires": { + "@octokit/rest": "^18.0.0", + "@semantic-release/error": "^2.2.0", + "aggregate-error": "^3.0.0", + "bottleneck": "^2.18.1", + "debug": "^4.0.0", + "dir-glob": "^3.0.0", + "fs-extra": "^9.0.0", + "globby": "^11.0.0", + "http-proxy-agent": "^4.0.0", + "https-proxy-agent": "^5.0.0", + "issue-parser": "^6.0.0", + "lodash": "^4.17.4", + "mime": "^2.4.3", + "p-filter": "^2.0.0", + "p-retry": "^4.0.0", + "url-join": "^4.0.0" + } + }, + "@tootallnate/once": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", + "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==" + }, + "@types/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==" + }, + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "requires": { + "debug": "4" + } + }, + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==" + }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" + }, + "before-after-hook": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.1.tgz", + "integrity": "sha512-/6FKxSTWoJdbsLDF8tdIjaRiFXiE6UHsEHE3OPI/cwPURCVi1ukP0gmLn7XWEiFk5TcwQjjY5PWsU+j+tgXgmw==" + }, + "bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==" + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==" + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + } + }, + "deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "requires": { + "path-type": "^4.0.0" + } + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "execa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", + "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + } + }, + "fast-glob": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + } + }, + "fastq": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", + "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "requires": { + "reusify": "^1.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "requires": { + "is-glob": "^4.0.1" + } + }, + "globby": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.3.tgz", + "integrity": "sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg==", + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + }, + "graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "http-proxy-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", + "requires": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + } + }, + "https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "requires": { + "agent-base": "6", + "debug": "4" + } + }, + "human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==" + }, + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==" + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==" + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "issue-parser": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/issue-parser/-/issue-parser-6.0.0.tgz", + "integrity": "sha512-zKa/Dxq2lGsBIXQ7CUZWTHfvxPC2ej0KfO7fIPqLlHB9J2hJ7rGhZ5rilhuufylr4RXYPzJUeFjKxz305OsNlA==", + "requires": { + "lodash.capitalize": "^4.2.1", + "lodash.escaperegexp": "^4.1.2", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.uniqby": "^4.7.0" + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=" + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "lodash.capitalize": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz", + "integrity": "sha1-+CbJtOKoUR2E46yinbBeGk87cqk=" + }, + "lodash.escaperegexp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", + "integrity": "sha1-ZHYsSGGAglGKw99Mz11YhtriA0c=" + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" + }, + "lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" + }, + "lodash.uniqby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz", + "integrity": "sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI=" + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "mime": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", + "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==" + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "requires": { + "path-key": "^3.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "p-filter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-filter/-/p-filter-2.1.0.tgz", + "integrity": "sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==", + "requires": { + "p-map": "^2.0.0" + } + }, + "p-map": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", + "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==" + }, + "p-reduce": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-2.1.0.tgz", + "integrity": "sha512-2USApvnsutq8uoxZBGbbWM0JIYLiEMJ9RlaN7fAzVNb9OZN0SHjjTTfIcb667XynS5Y1VhwDJVDa72TnPzAYWw==" + }, + "p-retry": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.5.0.tgz", + "integrity": "sha512-5Hwh4aVQSu6BEP+w2zKlVXtFAaYQe1qWuVADSgoeVlLjwe/Q/AMSoRR4MDeaAfu8llT+YNbEijWu/YF3m6avkg==", + "requires": { + "@types/retry": "^0.12.0", + "retry": "^0.12.0" + } + }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" + }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=" + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "universal-user-agent": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", + "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + }, + "url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + } + } +} diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go new file mode 100644 index 0000000000..f5c751c992 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -0,0 +1,82272 @@ +/** + * (C) Copyright IBM Corp. 2020, 2021, 2022. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.48.1-52130155-20220425-145431 + */ + +// Package vpcv1 : Operations and models for the VpcV1 service +package vpcv1 + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/IBM/go-sdk-core/v5/core" + common "github.com/IBM/vpc-go-sdk/common" + "github.com/go-openapi/strfmt" +) + +// 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: 2022-03-29 +type VpcV1 struct { + Service *core.BaseService + + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-03-29` + // and today's date (UTC). + Version *string + + // The infrastructure generation. For the API behavior documented here, specify + // `2`. + generation *int64 +} + +// DefaultServiceURL is the default URL to make service requests to. +const DefaultServiceURL = "https://us-south.iaas.cloud.ibm.com/v1" + +// DefaultServiceName is the default key used to find external configuration information. +const DefaultServiceName = "vpc" + +// VpcV1Options : Service options +type VpcV1Options struct { + ServiceName string + URL string + Authenticator core.Authenticator + + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-03-29` + // and today's date (UTC). + Version *string +} + +// NewVpcV1UsingExternalConfig : constructs an instance of VpcV1 with passed in options and external configuration. +func NewVpcV1UsingExternalConfig(options *VpcV1Options) (vpc *VpcV1, err error) { + if options.ServiceName == "" { + options.ServiceName = DefaultServiceName + } + + if options.Authenticator == nil { + options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) + if err != nil { + return + } + } + + vpc, err = NewVpcV1(options) + if err != nil { + return + } + + err = vpc.Service.ConfigureService(options.ServiceName) + if err != nil { + return + } + + if options.URL != "" { + err = vpc.Service.SetServiceURL(options.URL) + } + return +} + +// NewVpcV1 : constructs an instance of VpcV1 with passed in options. +func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { + serviceOptions := &core.ServiceOptions{ + URL: DefaultServiceURL, + Authenticator: options.Authenticator, + } + + err = core.ValidateStruct(options, "options") + if err != nil { + return + } + + baseService, err := core.NewBaseService(serviceOptions) + if err != nil { + return + } + + if options.URL != "" { + err = baseService.SetServiceURL(options.URL) + if err != nil { + return + } + } + + if options.Version == nil { + options.Version = core.StringPtr("2022-03-29") + } + + service = &VpcV1{ + Service: baseService, + Version: options.Version, + generation: core.Int64Ptr(2), + } + + return +} + +// GetServiceURLForRegion returns the service URL to be used for the specified region +func GetServiceURLForRegion(region string) (string, error) { + return "", fmt.Errorf("service does not support regional URLs") +} + +// Clone makes a copy of "vpc" suitable for processing requests. +func (vpc *VpcV1) Clone() *VpcV1 { + if core.IsNil(vpc) { + return nil + } + clone := *vpc + clone.Service = vpc.Service.Clone() + return &clone +} + +// SetServiceURL sets the service URL +func (vpc *VpcV1) SetServiceURL(url string) error { + return vpc.Service.SetServiceURL(url) +} + +// GetServiceURL returns the service URL +func (vpc *VpcV1) GetServiceURL() string { + return vpc.Service.GetServiceURL() +} + +// SetDefaultHeaders sets HTTP headers to be sent in every request +func (vpc *VpcV1) SetDefaultHeaders(headers http.Header) { + vpc.Service.SetDefaultHeaders(headers) +} + +// SetEnableGzipCompression sets the service's EnableGzipCompression field +func (vpc *VpcV1) SetEnableGzipCompression(enableGzip bool) { + vpc.Service.SetEnableGzipCompression(enableGzip) +} + +// GetEnableGzipCompression returns the service's EnableGzipCompression field +func (vpc *VpcV1) GetEnableGzipCompression() bool { + return vpc.Service.GetEnableGzipCompression() +} + +// EnableRetries enables automatic retries for requests invoked for this service instance. +// If either parameter is specified as 0, then a default value is used instead. +func (vpc *VpcV1) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { + vpc.Service.EnableRetries(maxRetries, maxRetryInterval) +} + +// DisableRetries disables automatic retries for requests invoked for this service instance. +func (vpc *VpcV1) DisableRetries() { + vpc.Service.DisableRetries() +} + +// ListVpcs : List all VPCs +// This request lists all VPCs in the region. A VPC is a virtual network that belongs to an account and provides logical +// isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC +// can contain resources in multiple zones in a region. +func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { + return vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) +} + +// ListVpcsWithContext is an alternate form of the ListVpcs method which supports a Context parameter +func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVpcsOptions, "listVpcsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVpcsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") + 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 listVpcsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) + } + if listVpcsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVpcsOptions.Limit)) + } + if listVpcsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVpcsOptions.ResourceGroupID)) + } + if listVpcsOptions.ClassicAccess != nil { + builder.AddQuery("classic_access", fmt.Sprint(*listVpcsOptions.ClassicAccess)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPCCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPC : Create a VPC +// This request creates a new VPC from a VPC prototype object. The prototype object is structured in the same way as a +// retrieved VPC, and contains the information necessary to create the new VPC. +func (vpc *VpcV1) CreateVPC(createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + return vpc.CreateVPCWithContext(context.Background(), createVPCOptions) +} + +// CreateVPCWithContext is an alternate form of the CreateVPC method which supports a Context parameter +func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(createVPCOptions, "createVPCOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPC") + 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 createVPCOptions.AddressPrefixManagement != nil { + body["address_prefix_management"] = createVPCOptions.AddressPrefixManagement + } + if createVPCOptions.ClassicAccess != nil { + body["classic_access"] = createVPCOptions.ClassicAccess + } + if createVPCOptions.Name != nil { + body["name"] = createVPCOptions.Name + } + if createVPCOptions.ResourceGroup != nil { + body["resource_group"] = createVPCOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPC : Delete a VPC +// This request deletes a VPC. This operation cannot be reversed. For this request to succeed, the VPC must not contain +// any instances, subnets, or public gateways. All security groups and network ACLs associated with the VPC are +// automatically deleted. All flow log collectors with `auto_delete` set to `true` targeting the VPC or any resource in +// the VPC are automatically deleted. +func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) +} + +// DeleteVPCWithContext is an alternate form of the DeleteVPC method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCOptions, "deleteVPCOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVPCOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPC : Retrieve a VPC +// This request retrieves a single VPC specified by the identifier in the URL. +func (vpc *VpcV1) GetVPC(getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + return vpc.GetVPCWithContext(context.Background(), getVPCOptions) +} + +// GetVPCWithContext is an alternate form of the GetVPC method which supports a Context parameter +func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCOptions, "getVPCOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCOptions, "getVPCOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPC : Update a VPC +// This request updates a VPC's name. +func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) +} + +// UpdateVPCWithContext is an alternate form of the UpdateVPC method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCOptions, "updateVPCOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVPCOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPC") + 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(updateVPCOptions.VPCPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPCDefaultNetworkACL : Retrieve a VPC's default network ACL +// This request retrieves the default network ACL for the VPC specified by the identifier in the URL. The default +// network ACL is applied to any new subnets in the VPC which do not specify a network ACL. +func (vpc *VpcV1) GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) +} + +// GetVPCDefaultNetworkACLWithContext is an alternate form of the GetVPCDefaultNetworkACL method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCDefaultNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_network_acl`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDefaultNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultNetworkACL) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPCDefaultRoutingTable : Retrieve a VPC's default routing table +// This request retrieves the default routing table for the VPC specified by the identifier in the URL. The default +// routing table is associated with any subnets in the VPC which have not been explicitly associated with a user-defined +// routing table. +func (vpc *VpcV1) GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) +} + +// GetVPCDefaultRoutingTableWithContext is an alternate form of the GetVPCDefaultRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCDefaultRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_routing_table`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPCDefaultSecurityGroup : Retrieve a VPC's default security group +// This request retrieves the default security group for the VPC specified by the identifier in the URL. Resources that +// optionally allow a security group to be specified upon creation will be attached to this security group if a security +// group is not specified. +func (vpc *VpcV1) GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) +} + +// GetVPCDefaultSecurityGroupWithContext is an alternate form of the GetVPCDefaultSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCDefaultSecurityGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_security_group`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDefaultSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultSecurityGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPCAddressPrefixes : List all address prefixes for a VPC +// This request lists all address pool prefixes for a VPC. +func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) +} + +// ListVPCAddressPrefixesWithContext is an alternate form of the ListVPCAddressPrefixes method which supports a Context parameter +func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCAddressPrefixesOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCAddressPrefixesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") + 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 listVPCAddressPrefixesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) + } + if listVPCAddressPrefixesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCAddressPrefixesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefixCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPCAddressPrefix : Create an address prefix for a VPC +// This request creates a new prefix from a prefix prototype object. The prototype object is structured in the same way +// as a retrieved prefix, and contains the information necessary to create the new prefix. +func (vpc *VpcV1) CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) +} + +// CreateVPCAddressPrefixWithContext is an alternate form of the CreateVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCAddressPrefixOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") + 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 createVPCAddressPrefixOptions.CIDR != nil { + body["cidr"] = createVPCAddressPrefixOptions.CIDR + } + if createVPCAddressPrefixOptions.Zone != nil { + body["zone"] = createVPCAddressPrefixOptions.Zone + } + if createVPCAddressPrefixOptions.IsDefault != nil { + body["is_default"] = createVPCAddressPrefixOptions.IsDefault + } + if createVPCAddressPrefixOptions.Name != nil { + body["name"] = createVPCAddressPrefixOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPCAddressPrefix : Delete an address prefix +// This request deletes a prefix. This operation cannot be reversed. The request will fail if any subnets use addresses +// from this prefix. +func (vpc *VpcV1) DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) +} + +// DeleteVPCAddressPrefixWithContext is an alternate form of the DeleteVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCAddressPrefixOptions.VPCID, + "id": *deleteVPCAddressPrefixOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPCAddressPrefix : Retrieve an address prefix +// This request retrieves a single prefix specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) +} + +// GetVPCAddressPrefixWithContext is an alternate form of the GetVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCAddressPrefixOptions.VPCID, + "id": *getVPCAddressPrefixOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCAddressPrefix : Update an address prefix +// This request updates a prefix with the information in a provided prefix patch. The prefix patch object is structured +// in the same way as a retrieved prefix and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) +} + +// UpdateVPCAddressPrefixWithContext is an alternate form of the UpdateVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCAddressPrefixOptions.VPCID, + "id": *updateVPCAddressPrefixOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCAddressPrefix") + 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(updateVPCAddressPrefixOptions.AddressPrefixPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPCRoutes : List all routes in a VPC's default routing table +// This request lists all routes in the VPC's default routing table. Each route is zone-specific and directs any packets +// matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's +// destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. +func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) +} + +// ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCRoutesOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCRoutesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") + 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 listVPCRoutesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) + } + if listVPCRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutesOptions.Start)) + } + if listVPCRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPCRoute : Create a route in a VPC's default routing table +// This request creates a new route in the VPC's default routing table. The route prototype object is structured in the +// same way as a retrieved route, and contains the information necessary to create the new route. The request will fail +// if the new route will cause a loop. +func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) +} + +// CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCRouteOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoute") + 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 createVPCRouteOptions.Destination != nil { + body["destination"] = createVPCRouteOptions.Destination + } + if createVPCRouteOptions.Zone != nil { + body["zone"] = createVPCRouteOptions.Zone + } + if createVPCRouteOptions.Action != nil { + body["action"] = createVPCRouteOptions.Action + } + if createVPCRouteOptions.Name != nil { + body["name"] = createVPCRouteOptions.Name + } + if createVPCRouteOptions.NextHop != nil { + body["next_hop"] = createVPCRouteOptions.NextHop + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPCRoute : Delete a VPC route +// This request deletes a route. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) +} + +// DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRouteOptions.VPCID, + "id": *deleteVPCRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPCRoute : Retrieve a VPC route +// This request retrieves a single route specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) +} + +// GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter +func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCRouteOptions.VPCID, + "id": *getVPCRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCRoute : Update a VPC route +// This request updates a route with the information in a provided route patch. The route patch object is structured in +// the same way as a retrieved route and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) +} + +// UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCRouteOptions.VPCID, + "id": *updateVPCRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoute") + 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(updateVPCRouteOptions.RoutePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPCRoutingTables : List all routing tables for a VPC +// This request lists all user-defined routing tables for a VPC. Each subnet in a VPC is associated with a routing +// table, which controls delivery of packets sent on that subnet according to the action of the most specific matching +// route in the table. If multiple equally-specific routes exist, traffic will be distributed across them. If no routes +// match, delivery will be controlled by the system's built-in routes. +func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) +} + +// ListVPCRoutingTablesWithContext is an alternate form of the ListVPCRoutingTables method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCRoutingTablesOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCRoutingTablesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") + 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 listVPCRoutingTablesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) + } + if listVPCRoutingTablesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTablesOptions.Limit)) + } + if listVPCRoutingTablesOptions.IsDefault != nil { + builder.AddQuery("is_default", fmt.Sprint(*listVPCRoutingTablesOptions.IsDefault)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTableCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPCRoutingTable : Create a routing table for a VPC +// This request creates a user-defined routing table from a routing table prototype object. The prototype object is +// structured in the same way as a retrieved routing table, and contains the information necessary to create the new +// routing table. +func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) +} + +// CreateVPCRoutingTableWithContext is an alternate form of the CreateVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRoutingTableOptions, "createVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCRoutingTableOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTable") + 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 createVPCRoutingTableOptions.AcceptRoutesFrom != nil { + body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom + } + if createVPCRoutingTableOptions.Name != nil { + body["name"] = createVPCRoutingTableOptions.Name + } + if createVPCRoutingTableOptions.RouteDirectLinkIngress != nil { + body["route_direct_link_ingress"] = createVPCRoutingTableOptions.RouteDirectLinkIngress + } + if createVPCRoutingTableOptions.RouteTransitGatewayIngress != nil { + body["route_transit_gateway_ingress"] = createVPCRoutingTableOptions.RouteTransitGatewayIngress + } + if createVPCRoutingTableOptions.RouteVPCZoneIngress != nil { + body["route_vpc_zone_ingress"] = createVPCRoutingTableOptions.RouteVPCZoneIngress + } + if createVPCRoutingTableOptions.Routes != nil { + body["routes"] = createVPCRoutingTableOptions.Routes + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPCRoutingTable : Delete a VPC routing table +// This request deletes a routing table. A routing table cannot be deleted if it is associated with any subnets in the +// VPC. Additionally, a VPC's default routing table cannot be deleted. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) +} + +// DeleteVPCRoutingTableWithContext is an alternate form of the DeleteVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRoutingTableOptions.VPCID, + "id": *deleteVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteVPCRoutingTableOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCRoutingTableOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPCRoutingTable : Retrieve a VPC routing table +// This request retrieves a single routing table specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) +} + +// GetVPCRoutingTableWithContext is an alternate form of the GetVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRoutingTableOptions, "getVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCRoutingTableOptions.VPCID, + "id": *getVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCRoutingTable : Update a VPC routing table +// This request updates a routing table with the information in a provided routing table patch. The patch object is +// structured in the same way as a retrieved table and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) +} + +// UpdateVPCRoutingTableWithContext is an alternate form of the UpdateVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCRoutingTableOptions.VPCID, + "id": *updateVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVPCRoutingTableOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPCRoutingTableOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPCRoutingTableRoutes : List all routes in a VPC routing table +// This request lists all routes in a VPC routing table. If subnets are associated with this routing table, delivery of +// packets sent on a subnet is performed according to the action of the most specific matching route in the table +// (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, traffic will be +// distributed across them. If no routes match, delivery will be controlled by the system's built-in routes. +func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) +} + +// ListVPCRoutingTableRoutesWithContext is an alternate form of the ListVPCRoutingTableRoutes method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCRoutingTableRoutesOptions.VPCID, + "routing_table_id": *listVPCRoutingTableRoutesOptions.RoutingTableID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCRoutingTableRoutesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") + 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 listVPCRoutingTableRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) + } + if listVPCRoutingTableRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPCRoutingTableRoute : Create a route in a VPC routing table +// This request creates a new VPC route from a VPC route prototype object. The prototype object is structured in the +// same way as a retrieved VPC route and contains the information necessary to create the route. +func (vpc *VpcV1) CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) +} + +// CreateVPCRoutingTableRouteWithContext is an alternate form of the CreateVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *createVPCRoutingTableRouteOptions.RoutingTableID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTableRoute") + 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 createVPCRoutingTableRouteOptions.Destination != nil { + body["destination"] = createVPCRoutingTableRouteOptions.Destination + } + if createVPCRoutingTableRouteOptions.Zone != nil { + body["zone"] = createVPCRoutingTableRouteOptions.Zone + } + if createVPCRoutingTableRouteOptions.Action != nil { + body["action"] = createVPCRoutingTableRouteOptions.Action + } + if createVPCRoutingTableRouteOptions.Name != nil { + body["name"] = createVPCRoutingTableRouteOptions.Name + } + if createVPCRoutingTableRouteOptions.NextHop != nil { + body["next_hop"] = createVPCRoutingTableRouteOptions.NextHop + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPCRoutingTableRoute : Delete a VPC routing table route +// This request deletes a VPC route. This operation cannot be reversed. Only VPC routes with an `origin` of `user` are +// allowed to be deleted. +func (vpc *VpcV1) DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) +} + +// DeleteVPCRoutingTableRouteWithContext is an alternate form of the DeleteVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *deleteVPCRoutingTableRouteOptions.RoutingTableID, + "id": *deleteVPCRoutingTableRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPCRoutingTableRoute : Retrieve a VPC routing table route +// This request retrieves a single VPC route specified by the identifier in the URL path. +func (vpc *VpcV1) GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) +} + +// GetVPCRoutingTableRouteWithContext is an alternate form of the GetVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *getVPCRoutingTableRouteOptions.RoutingTableID, + "id": *getVPCRoutingTableRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCRoutingTableRoute : Update a VPC routing table route +// This request updates a VPC route with the information provided in a route patch object. The patch object is +// structured in the same way as a retrieved VPC route and needs to contain only the information to be updated. Only VPC +// routes with an `origin` of `user` are allowed to be updated. +func (vpc *VpcV1) UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCRoutingTableRouteWithContext(context.Background(), updateVPCRoutingTableRouteOptions) +} + +// UpdateVPCRoutingTableRouteWithContext is an alternate form of the UpdateVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *updateVPCRoutingTableRouteOptions.RoutingTableID, + "id": *updateVPCRoutingTableRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTableRoute") + 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(updateVPCRoutingTableRouteOptions.RoutePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSubnets : List all subnets +// This request lists all subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block +// notation. Each subnet is within a particular zone and cannot span multiple zones or regions. +func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { + return vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) +} + +// ListSubnetsWithContext is an alternate form of the ListSubnets method which supports a Context parameter +func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSubnetsOptions, "listSubnetsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSubnetsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") + 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 listSubnetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) + } + if listSubnetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSubnetsOptions.Limit)) + } + if listSubnetsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSubnetsOptions.ResourceGroupID)) + } + if listSubnetsOptions.RoutingTableID != nil { + builder.AddQuery("routing_table.id", fmt.Sprint(*listSubnetsOptions.RoutingTableID)) + } + if listSubnetsOptions.RoutingTableName != nil { + builder.AddQuery("routing_table.name", fmt.Sprint(*listSubnetsOptions.RoutingTableName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnetCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSubnet : Create a subnet +// This request creates a new subnet from a subnet prototype object. The prototype object is structured in the same way +// as a retrieved subnet, and contains the information necessary to create the new subnet. For this request to succeed, +// the prototype's CIDR block must not overlap with an existing subnet in the VPC. +func (vpc *VpcV1) CreateSubnet(createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) +} + +// CreateSubnetWithContext is an alternate form of the CreateSubnet method which supports a Context parameter +func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSubnetOptions, "createSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") + 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(createSubnetOptions.SubnetPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSubnet : Delete a subnet +// This request deletes a subnet. This operation cannot be reversed. For this request to succeed, the subnet must not be +// referenced by any network interfaces, VPN gateways, or load balancers. A delete operation automatically detaches the +// subnet from any network ACLs, public gateways, or endpoint gateways. All flow log collectors with `auto_delete` set +// to `true` targeting the subnet or any resource in the subnet are automatically deleted. +func (vpc *VpcV1) DeleteSubnet(deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSubnetWithContext(context.Background(), deleteSubnetOptions) +} + +// DeleteSubnetWithContext is an alternate form of the DeleteSubnet method which supports a Context parameter +func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSubnetOptions, "deleteSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSubnetOptions, "deleteSubnetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnet") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSubnet : Retrieve a subnet +// This request retrieves a single subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnet(getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) +} + +// GetSubnetWithContext is an alternate form of the GetSubnet method which supports a Context parameter +func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetOptions, "getSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateSubnet : Update a subnet +// This request updates a subnet with the information in a provided subnet patch. The subnet patch object is structured +// in the same way as a retrieved subnet and contains only the information to be updated. +func (vpc *VpcV1) UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) +} + +// UpdateSubnetWithContext is an alternate form of the UpdateSubnet method which supports a Context parameter +func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSubnetOptions, "updateSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") + 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(updateSubnetOptions.SubnetPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetSubnetNetworkACL : Retrieve a subnet's attached network ACL +// This request retrieves the network ACL attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetNetworkACL(getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.GetSubnetNetworkACLWithContext(context.Background(), getSubnetNetworkACLOptions) +} + +// GetSubnetNetworkACLWithContext is an alternate form of the GetSubnetNetworkACL method which supports a Context parameter +func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetNetworkACL") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ReplaceSubnetNetworkACL : Attach a network ACL to a subnet +// This request attaches the network ACL, specified in the request body, to the subnet specified by the subnet +// identifier in the URL. This replaces the existing network ACL on the subnet. +func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) +} + +// ReplaceSubnetNetworkACLWithContext is an alternate form of the ReplaceSubnetNetworkACL method which supports a Context parameter +func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *replaceSubnetNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range replaceSubnetNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") + 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(replaceSubnetNetworkACLOptions.NetworkACLIdentity) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UnsetSubnetPublicGateway : Detach a public gateway from a subnet +// This request detaches the public gateway from the subnet specified by the subnet identifier in the URL. +func (vpc *VpcV1) UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { + return vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) +} + +// UnsetSubnetPublicGatewayWithContext is an alternate form of the UnsetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *unsetSubnetPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSubnetPublicGateway : Retrieve a subnet's attached public gateway +// This request retrieves the public gateway attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) +} + +// GetSubnetPublicGatewayWithContext is an alternate form of the GetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// SetSubnetPublicGateway : Attach a public gateway to a subnet +// This request attaches the public gateway, specified in the request body, to the subnet specified by the subnet +// identifier in the URL. The public gateway must have the same VPC and zone as the subnet. +func (vpc *VpcV1) SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) +} + +// SetSubnetPublicGatewayWithContext is an alternate form of the SetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *setSubnetPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") + 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(setSubnetPublicGatewayOptions.PublicGatewayIdentity) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetSubnetRoutingTable : Retrieve a subnet's attached routing table +// This request retrieves the routing table attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) +} + +// GetSubnetRoutingTableWithContext is an alternate form of the GetSubnetRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ReplaceSubnetRoutingTable : Attach a routing table to a subnet +// This request attaches the routing table, specified in the request body, to the subnet specified by the subnet +// identifier in the URL. This replaces the existing routing table on the subnet. +// +// For this request to succeed, the routing table `route_direct_link_ingress`, +// `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. +func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) +} + +// ReplaceSubnetRoutingTableWithContext is an alternate form of the ReplaceSubnetRoutingTable method which supports a Context parameter +func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *replaceSubnetRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range replaceSubnetRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") + 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(replaceSubnetRoutingTableOptions.RoutingTableIdentity) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSubnetReservedIps : List all reserved IPs in a subnet +// This request lists all reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet +// which is not available for use. +func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { + return vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) +} + +// ListSubnetReservedIpsWithContext is an alternate form of the ListSubnetReservedIps method which supports a Context parameter +func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *listSubnetReservedIpsOptions.SubnetID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listSubnetReservedIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") + 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 listSubnetReservedIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) + } + if listSubnetReservedIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSubnetReservedIpsOptions.Limit)) + } + if listSubnetReservedIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSubnetReservedIpsOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSubnetReservedIP : Reserve an IP in a subnet +// This request reserves an IP address in a subnet. If the provided prototype object includes an `address`, the address +// must not already be reserved. +func (vpc *VpcV1) CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) +} + +// CreateSubnetReservedIPWithContext is an alternate form of the CreateSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSubnetReservedIPOptions, "createSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *createSubnetReservedIPOptions.SubnetID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") + 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 createSubnetReservedIPOptions.Address != nil { + body["address"] = createSubnetReservedIPOptions.Address + } + if createSubnetReservedIPOptions.AutoDelete != nil { + body["auto_delete"] = createSubnetReservedIPOptions.AutoDelete + } + if createSubnetReservedIPOptions.Name != nil { + body["name"] = createSubnetReservedIPOptions.Name + } + if createSubnetReservedIPOptions.Target != nil { + body["target"] = createSubnetReservedIPOptions.Target + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSubnetReservedIP : Delete a reserved IP +// This request releases a reserved IP. This operation cannot be reversed. +// +// For this request to succeed, the reserved IP must not be required by another resource, such as a network interface +// for which it is the primary IP. A provider-owned reserved IP is not allowed to be deleted. +func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) +} + +// DeleteSubnetReservedIPWithContext is an alternate form of the DeleteSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *deleteSubnetReservedIPOptions.SubnetID, + "id": *deleteSubnetReservedIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSubnetReservedIP : Retrieve a reserved IP +// This request retrieves a single reserved IP specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) +} + +// GetSubnetReservedIPWithContext is an alternate form of the GetSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetReservedIPOptions, "getSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *getSubnetReservedIPOptions.SubnetID, + "id": *getSubnetReservedIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateSubnetReservedIP : Update a reserved IP +// This request updates a reserved IP with the information in a provided reserved IP patch. The reserved IP patch object +// is structured in the same way as a retrieved reserved IP and contains only the information to be updated. +// +// A provider-owned reserved IP is not allowed to be updated. +func (vpc *VpcV1) UpdateSubnetReservedIP(updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.UpdateSubnetReservedIPWithContext(context.Background(), updateSubnetReservedIPOptions) +} + +// UpdateSubnetReservedIPWithContext is an alternate form of the UpdateSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *updateSubnetReservedIPOptions.SubnetID, + "id": *updateSubnetReservedIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnetReservedIP") + 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(updateSubnetReservedIPOptions.ReservedIPPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListImages : List all images +// This request lists all images available in the region. An image provides source data for a volume. Images are either +// system-provided, or created from another source, such as importing from object storage. +// +// The images will be sorted by their `created_at` property values, with the newest first. Images with identical +// `created_at` values will be secondarily sorted by ascending `id` property values. +func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { + return vpc.ListImagesWithContext(context.Background(), listImagesOptions) +} + +// ListImagesWithContext is an alternate form of the ListImages method which supports a Context parameter +func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listImagesOptions, "listImagesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listImagesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") + 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 listImagesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) + } + if listImagesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listImagesOptions.Limit)) + } + if listImagesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listImagesOptions.ResourceGroupID)) + } + if listImagesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) + } + if listImagesOptions.Visibility != nil { + builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateImage : Create an image +// This request creates a new image from an image prototype object. The prototype object is structured in the same way +// as a retrieved image, and contains the information necessary to create the new image. If an image is being imported, +// a URL to the image file on object storage must be specified. If an image is being created from an existing volume, +// that volume must be specified. +func (vpc *VpcV1) CreateImage(createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.CreateImageWithContext(context.Background(), createImageOptions) +} + +// CreateImageWithContext is an alternate form of the CreateImage method which supports a Context parameter +func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createImageOptions, "createImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createImageOptions, "createImageOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") + 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(createImageOptions.ImagePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteImage : Delete an image +// This request deletes an image. This operation cannot be reversed. A system-provided image is not allowed to be +// deleted. Additionally, an image cannot be deleted if it: +// - has a `status` of `tentative` or `deleting` +// - has a `status` of `pending` with a `status_reasons` code of `image_request_in_progress`. +func (vpc *VpcV1) DeleteImage(deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteImageWithContext(context.Background(), deleteImageOptions) +} + +// DeleteImageWithContext is an alternate form of the DeleteImage method which supports a Context parameter +func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteImageOptions, "deleteImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteImageOptions, "deleteImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImage") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetImage : Retrieve an image +// This request retrieves a single image specified by the identifier in the URL. +func (vpc *VpcV1) GetImage(getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.GetImageWithContext(context.Background(), getImageOptions) +} + +// GetImageWithContext is an alternate form of the GetImage method which supports a Context parameter +func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getImageOptions, "getImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getImageOptions, "getImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateImage : Update an image +// This request updates an image with the information in a provided image patch. The image patch object is structured in +// the same way as a retrieved image and contains only the information to be updated. A system-provided image is not +// allowed to be updated. An image with a `status` of `deleting` cannot be updated. +func (vpc *VpcV1) UpdateImage(updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.UpdateImageWithContext(context.Background(), updateImageOptions) +} + +// UpdateImageWithContext is an alternate form of the UpdateImage method which supports a Context parameter +func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateImageOptions, "updateImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateImageOptions, "updateImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImage") + 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(updateImageOptions.ImagePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListOperatingSystems : List all operating systems +// This request lists all operating systems in the region. +func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { + return vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) +} + +// ListOperatingSystemsWithContext is an alternate form of the ListOperatingSystems method which supports a Context parameter +func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listOperatingSystemsOptions, "listOperatingSystemsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listOperatingSystemsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") + 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 listOperatingSystemsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) + } + if listOperatingSystemsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listOperatingSystemsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystemCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetOperatingSystem : Retrieve an operating system +// This request retrieves a single operating system specified by the name in the URL. +func (vpc *VpcV1) GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { + return vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) +} + +// GetOperatingSystemWithContext is an alternate form of the GetOperatingSystem method which supports a Context parameter +func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOperatingSystemOptions, "getOperatingSystemOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getOperatingSystemOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getOperatingSystemOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetOperatingSystem") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystem) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListKeys : List all keys +// This request lists all keys in the region. A key contains a public SSH key which may be installed on instances when +// they are created. Private keys are not stored. +func (vpc *VpcV1) ListKeys(listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { + return vpc.ListKeysWithContext(context.Background(), listKeysOptions) +} + +// ListKeysWithContext is an alternate form of the ListKeys method which supports a Context parameter +func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listKeysOptions, "listKeysOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listKeysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListKeys") + 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 listKeysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listKeysOptions.Start)) + } + if listKeysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listKeysOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKeyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateKey : Create a key +// This request creates a new SSH key from an key prototype object. The prototype object is structured in the same way +// as a retrieved key, and contains the information necessary to create the new key. The public key value must be +// provided. +func (vpc *VpcV1) CreateKey(createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.CreateKeyWithContext(context.Background(), createKeyOptions) +} + +// CreateKeyWithContext is an alternate form of the CreateKey method which supports a Context parameter +func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createKeyOptions, "createKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createKeyOptions, "createKeyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateKey") + 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 createKeyOptions.PublicKey != nil { + body["public_key"] = createKeyOptions.PublicKey + } + if createKeyOptions.Name != nil { + body["name"] = createKeyOptions.Name + } + if createKeyOptions.ResourceGroup != nil { + body["resource_group"] = createKeyOptions.ResourceGroup + } + if createKeyOptions.Type != nil { + body["type"] = createKeyOptions.Type + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteKey : Delete a key +// This request deletes a key. This operation cannot be reversed. +func (vpc *VpcV1) DeleteKey(deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteKeyWithContext(context.Background(), deleteKeyOptions) +} + +// DeleteKeyWithContext is an alternate form of the DeleteKey method which supports a Context parameter +func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteKeyOptions, "deleteKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteKeyOptions, "deleteKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteKey") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetKey : Retrieve a key +// This request retrieves a single key specified by the identifier in the URL. +func (vpc *VpcV1) GetKey(getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.GetKeyWithContext(context.Background(), getKeyOptions) +} + +// GetKeyWithContext is an alternate form of the GetKey method which supports a Context parameter +func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getKeyOptions, "getKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getKeyOptions, "getKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetKey") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateKey : Update a key +// This request updates a key's name. +func (vpc *VpcV1) UpdateKey(updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.UpdateKeyWithContext(context.Background(), updateKeyOptions) +} + +// UpdateKeyWithContext is an alternate form of the UpdateKey method which supports a Context parameter +func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateKeyOptions, "updateKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateKeyOptions, "updateKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateKey") + 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(updateKeyOptions.KeyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceProfiles : List all instance profiles +// This request lists provisionable instance profiles in the region. An instance profile specifies the performance +// characteristics and pricing model for an instance. +func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) +} + +// ListInstanceProfilesWithContext is an alternate form of the ListInstanceProfiles method which supports a Context parameter +func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceProfilesOptions, "listInstanceProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceProfiles") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceProfile : Retrieve an instance profile +// This request retrieves a single instance profile specified by the name in the URL. +func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { + return vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) +} + +// GetInstanceProfileWithContext is an alternate form of the GetInstanceProfile method which supports a Context parameter +func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceProfileOptions, "getInstanceProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getInstanceProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceTemplates : List all instance templates +// This request lists all instance templates in the region. +func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) +} + +// ListInstanceTemplatesWithContext is an alternate form of the ListInstanceTemplates method which supports a Context parameter +func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceTemplatesOptions, "listInstanceTemplatesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceTemplatesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplateCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceTemplate : Create an instance template +// This request creates a new instance template. The prototype object is structured in the same way as a retrieved +// instance template, and contains the information necessary to provision a new instance from the template. +// +// If a `source_template` is specified in the prototype object, its contents are copied into the new template prior to +// copying any other properties provided in the prototype object. +func (vpc *VpcV1) CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceTemplateWithContext(context.Background(), createInstanceTemplateOptions) +} + +// CreateInstanceTemplateWithContext is an alternate form of the CreateInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceTemplateOptions, "createInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceTemplateOptions, "createInstanceTemplateOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceTemplate") + 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(createInstanceTemplateOptions.InstanceTemplatePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceTemplate : Delete an instance template +// This request deletes the instance template. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) +} + +// DeleteInstanceTemplateWithContext is an alternate form of the DeleteInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteInstanceTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceTemplate") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceTemplate : Retrieve an instance template +// This request retrieves a single instance template specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) +} + +// GetInstanceTemplateWithContext is an alternate form of the GetInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceTemplateOptions, "getInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceTemplate : Update an instance template +// This request updates an instance template with the information provided in the instance template patch. The instance +// template patch object is structured in the same way as a retrieved instance template and contains only the +// information to be updated. +func (vpc *VpcV1) UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) +} + +// UpdateInstanceTemplateWithContext is an alternate form of the UpdateInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceTemplateOptions, "updateInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateInstanceTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceTemplate") + 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(updateInstanceTemplateOptions.InstanceTemplatePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstances : List all instances +// This request lists all instances in the region. +func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) +} + +// ListInstancesWithContext is an alternate form of the ListInstances method which supports a Context parameter +func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstancesOptions, "listInstancesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstancesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") + 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 listInstancesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) + } + if listInstancesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstancesOptions.Limit)) + } + if listInstancesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listInstancesOptions.ResourceGroupID)) + } + if listInstancesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) + } + if listInstancesOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) + } + if listInstancesOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) + } + if listInstancesOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) + } + if listInstancesOptions.DedicatedHostID != nil { + builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) + } + if listInstancesOptions.DedicatedHostCRN != nil { + builder.AddQuery("dedicated_host.crn", fmt.Sprint(*listInstancesOptions.DedicatedHostCRN)) + } + if listInstancesOptions.DedicatedHostName != nil { + builder.AddQuery("dedicated_host.name", fmt.Sprint(*listInstancesOptions.DedicatedHostName)) + } + if listInstancesOptions.PlacementGroupID != nil { + builder.AddQuery("placement_group.id", fmt.Sprint(*listInstancesOptions.PlacementGroupID)) + } + if listInstancesOptions.PlacementGroupCRN != nil { + builder.AddQuery("placement_group.crn", fmt.Sprint(*listInstancesOptions.PlacementGroupCRN)) + } + if listInstancesOptions.PlacementGroupName != nil { + builder.AddQuery("placement_group.name", fmt.Sprint(*listInstancesOptions.PlacementGroupName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstance : Create an instance +// This request provisions a new instance from an instance prototype object. The prototype object is structured in the +// same way as a retrieved instance, and contains the information necessary to provision the new instance. The instance +// is automatically started. +func (vpc *VpcV1) CreateInstance(createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) +} + +// CreateInstanceWithContext is an alternate form of the CreateInstance method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceOptions, "createInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceOptions, "createInstanceOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstance") + 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(createInstanceOptions.InstancePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstance : Delete an instance +// This request deletes an instance. This operation cannot be reversed. Any floating IPs associated with the instance's +// network interfaces are implicitly disassociated. All flow log collectors with `auto_delete` set to `true` targeting +// the instance and/or the instance's network interfaces are automatically deleted. +func (vpc *VpcV1) DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) +} + +// DeleteInstanceWithContext is an alternate form of the DeleteInstance method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceOptions, "deleteInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceOptions, "deleteInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstance") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstance : Retrieve an instance +// This request retrieves a single instance specified by the identifier in the URL. +func (vpc *VpcV1) GetInstance(getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + return vpc.GetInstanceWithContext(context.Background(), getInstanceOptions) +} + +// GetInstanceWithContext is an alternate form of the GetInstance method which supports a Context parameter +func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceOptions, "getInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceOptions, "getInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstance") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstance : Update an instance +// This request updates an instance with the information in a provided instance patch. The instance patch object is +// structured in the same way as a retrieved instance and contains only the information to be updated. +func (vpc *VpcV1) UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) +} + +// UpdateInstanceWithContext is an alternate form of the UpdateInstance method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceOptions, "updateInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") + 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(updateInstanceOptions.InstancePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceInitialization : Retrieve initialization configuration for an instance +// This request retrieves configuration variables used to initialize the instance, such as SSH keys and the Windows +// administrator password. +func (vpc *VpcV1) GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { + return vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) +} + +// GetInstanceInitializationWithContext is an alternate form of the GetInstanceInitialization method which supports a Context parameter +func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceInitializationOptions, "getInstanceInitializationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceInitializationOptions, "getInstanceInitializationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceInitializationOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}/initialization`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceInitializationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceInitialization") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceInitialization) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceAction : Create an instance action +// This request creates a new action which will be queued up to run as soon as any pending or running actions have +// completed. +func (vpc *VpcV1) CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) +} + +// CreateInstanceActionWithContext is an alternate form of the CreateInstanceAction method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceActionOptions, "createInstanceActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceActionOptions, "createInstanceActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceActionOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/actions`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceAction") + 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 createInstanceActionOptions.Type != nil { + body["type"] = createInstanceActionOptions.Type + } + if createInstanceActionOptions.Force != nil { + body["force"] = createInstanceActionOptions.Force + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) + if err != nil { + 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 +// request. The access token is only valid for a short period of time, and a maximum of one token is valid for a given +// instance at a time. +func (vpc *VpcV1) CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) +} + +// CreateInstanceConsoleAccessTokenWithContext is an alternate form of the CreateInstanceConsoleAccessToken method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Context, createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceConsoleAccessTokenOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/console_access_token`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceConsoleAccessTokenOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceConsoleAccessToken") + 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 createInstanceConsoleAccessTokenOptions.ConsoleType != nil { + body["console_type"] = createInstanceConsoleAccessTokenOptions.ConsoleType + } + if createInstanceConsoleAccessTokenOptions.Force != nil { + body["force"] = createInstanceConsoleAccessTokenOptions.Force + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceDisks : List all disks on an instance +// This request lists all disks on an instance. A disk is a block device that is locally attached to the instance's +// physical host and is also referred to as instance storage. By default, the listed disks are sorted by their +// `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) +} + +// ListInstanceDisksWithContext is an alternate form of the ListInstanceDisks method which supports a Context parameter +func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceDisksOptions, "listInstanceDisksOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceDisksOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceDisksOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceDisks") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceDisk : Retrieve an instance disk +// This request retrieves a single instance disk specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + return vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) +} + +// GetInstanceDiskWithContext is an alternate form of the GetInstanceDisk method which supports a Context parameter +func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceDiskOptions, "getInstanceDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceDiskOptions.InstanceID, + "id": *getInstanceDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceDisk : Update an instance disk +// This request updates the instance disk with the information in a provided patch. +func (vpc *VpcV1) UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) +} + +// UpdateInstanceDiskWithContext is an alternate form of the UpdateInstanceDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceDiskOptions, "updateInstanceDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceDiskOptions.InstanceID, + "id": *updateInstanceDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceDisk") + 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(updateInstanceDiskOptions.InstanceDiskPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceNetworkInterfaces : List all network interfaces on an instance +// This request lists all network interfaces on an instance. A network interface is an abstract representation of a +// network interface card and connects an instance to a subnet. While each network interface can attach to only one +// subnet, multiple network interfaces can be created to attach to multiple subnets. Multiple interfaces may also attach +// to the same subnet. +func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) +} + +// ListInstanceNetworkInterfacesWithContext is an alternate form of the ListInstanceNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkInterfacesOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceUnpaginatedCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceNetworkInterface : Create a network interface on an instance +// This request creates a new network interface from a network interface prototype object. The prototype object is +// structured in the same way as a retrieved network interface, and contains the information necessary to create the new +// network interface. Any subnet in the instance's VPC may be specified, even if it is already attached to another +// network interface. Addresses on the network interface must be within the specified subnet's CIDR blocks. +func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) +} + +// CreateInstanceNetworkInterfaceWithContext is an alternate form of the CreateInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceNetworkInterfaceOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkInterface") + 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 createInstanceNetworkInterfaceOptions.Subnet != nil { + body["subnet"] = createInstanceNetworkInterfaceOptions.Subnet + } + if createInstanceNetworkInterfaceOptions.AllowIPSpoofing != nil { + body["allow_ip_spoofing"] = createInstanceNetworkInterfaceOptions.AllowIPSpoofing + } + if createInstanceNetworkInterfaceOptions.Name != nil { + body["name"] = createInstanceNetworkInterfaceOptions.Name + } + if createInstanceNetworkInterfaceOptions.PrimaryIP != nil { + body["primary_ip"] = createInstanceNetworkInterfaceOptions.PrimaryIP + } + if createInstanceNetworkInterfaceOptions.SecurityGroups != nil { + body["security_groups"] = createInstanceNetworkInterfaceOptions.SecurityGroups + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceNetworkInterface : Delete a network interface +// This request deletes a network interface. This operation cannot be reversed. Any floating IPs associated with the +// network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to `true` targeting +// the network interface are automatically deleted. The primary network interface is not allowed to be deleted. +func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) +} + +// DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *deleteInstanceNetworkInterfaceOptions.InstanceID, + "id": *deleteInstanceNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceNetworkInterface : Retrieve a network interface +// This request retrieves a single network interface specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) +} + +// GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkInterfaceOptions.InstanceID, + "id": *getInstanceNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceNetworkInterface : Update a network interface +// This request updates a network interface with the information provided in a network interface patch object. The +// network interface patch object is structured in the same way as a retrieved network interface and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) +} + +// UpdateInstanceNetworkInterfaceWithContext is an alternate form of the UpdateInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceNetworkInterfaceOptions.InstanceID, + "id": *updateInstanceNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkInterface") + 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(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with a network interface +// This request lists all floating IPs associated with a network interface. +func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) +} + +// ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkInterfaceFloatingIpsOptions.InstanceID, + "network_interface_id": *listInstanceNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkInterfaceFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from a network interface +// This request disassociates the specified floating IP from the specified network interface. +func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) +} + +// RemoveInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *removeInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *removeInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *removeInstanceNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeInstanceNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveInstanceNetworkInterfaceFloatingIP") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request a retrieves a specified floating IP address if it is associated with the network interface and instance +// specified in the URL. +func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) +} + +// GetInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the GetInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *getInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getInstanceNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with a network interface +// This request associates the specified floating IP with the specified network interface, replacing any existing +// association. For this request to succeed, the existing floating IP must not be required by another resource, such as +// a public gateway. A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) +} + +// AddInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the AddInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *addInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *addInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addInstanceNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addInstanceNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddInstanceNetworkInterfaceFloatingIP") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceNetworkInterfaceIps : List all reserved IPs bound to a network interface +// This request lists all reserved IPs bound to a network interface. +func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) +} + +// ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkInterfaceIpsOptions.InstanceID, + "network_interface_id": *listInstanceNetworkInterfaceIpsOptions.NetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkInterfaceIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceIps") + 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 listInstanceNetworkInterfaceIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Start)) + } + if listInstanceNetworkInterfaceIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionNetworkInterfaceContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceNetworkInterfaceIP : Retrieve bound reserved IP +// This request a retrieves the specified reserved IP address if it is bound to the network interface and instance +// specified in the URL. +func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) +} + +// GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkInterfaceIPOptions.InstanceID, + "network_interface_id": *getInstanceNetworkInterfaceIPOptions.NetworkInterfaceID, + "id": *getInstanceNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceIP") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceVolumeAttachments : List all volumes attachments on an instance +// This request lists all volume attachments on an instance. A volume attachment connects a volume to an instance. Each +// instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one +// volume. +func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) +} + +// ListInstanceVolumeAttachmentsWithContext is an alternate form of the ListInstanceVolumeAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceVolumeAttachmentsOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachmentCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceVolumeAttachment : Create a volume attachment on an instance +// This request creates a new volume attachment from a volume attachment prototype object, connecting a volume to an +// instance. For this request to succeed, the specified volume must not be busy. The prototype object is structured in +// the same way as a retrieved volume attachment, and contains the information necessary to create the new volume +// attachment. +func (vpc *VpcV1) CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) +} + +// CreateInstanceVolumeAttachmentWithContext is an alternate form of the CreateInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceVolumeAttachmentOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceVolumeAttachment") + 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 createInstanceVolumeAttachmentOptions.Volume != nil { + body["volume"] = createInstanceVolumeAttachmentOptions.Volume + } + if createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete != nil { + body["delete_volume_on_instance_delete"] = createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete + } + if createInstanceVolumeAttachmentOptions.Name != nil { + body["name"] = createInstanceVolumeAttachmentOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceVolumeAttachment : Delete a volume attachment +// This request deletes a volume attachment. This operation cannot be reversed, but a new volume attachment may +// subsequently be created for the volume. For this request to succeed, the volume must not be busy. +func (vpc *VpcV1) DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) +} + +// DeleteInstanceVolumeAttachmentWithContext is an alternate form of the DeleteInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *deleteInstanceVolumeAttachmentOptions.InstanceID, + "id": *deleteInstanceVolumeAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceVolumeAttachment : Retrieve a volume attachment +// This request retrieves a single volume attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) +} + +// GetInstanceVolumeAttachmentWithContext is an alternate form of the GetInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceVolumeAttachmentOptions.InstanceID, + "id": *getInstanceVolumeAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceVolumeAttachment : Update a volume attachment +// This request updates a volume attachment with the information provided in a volume attachment patch object. The +// volume attachment patch object is structured in the same way as a retrieved volume attachment and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) +} + +// UpdateInstanceVolumeAttachmentWithContext is an alternate form of the UpdateInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceVolumeAttachmentOptions.InstanceID, + "id": *updateInstanceVolumeAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceVolumeAttachment") + 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(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceGroups : List all instance groups +// This request lists all instance groups in the region. +func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) +} + +// ListInstanceGroupsWithContext is an alternate form of the ListInstanceGroups method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceGroupsOptions, "listInstanceGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") + 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 listInstanceGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) + } + if listInstanceGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceGroup : Create an instance group +// This request creates a new instance group. +func (vpc *VpcV1) CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupWithContext(context.Background(), createInstanceGroupOptions) +} + +// CreateInstanceGroupWithContext is an alternate form of the CreateInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupOptions, "createInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupOptions, "createInstanceGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroup") + 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 createInstanceGroupOptions.InstanceTemplate != nil { + body["instance_template"] = createInstanceGroupOptions.InstanceTemplate + } + if createInstanceGroupOptions.Subnets != nil { + body["subnets"] = createInstanceGroupOptions.Subnets + } + if createInstanceGroupOptions.ApplicationPort != nil { + body["application_port"] = createInstanceGroupOptions.ApplicationPort + } + if createInstanceGroupOptions.LoadBalancer != nil { + body["load_balancer"] = createInstanceGroupOptions.LoadBalancer + } + if createInstanceGroupOptions.LoadBalancerPool != nil { + body["load_balancer_pool"] = createInstanceGroupOptions.LoadBalancerPool + } + if createInstanceGroupOptions.MembershipCount != nil { + body["membership_count"] = createInstanceGroupOptions.MembershipCount + } + if createInstanceGroupOptions.Name != nil { + body["name"] = createInstanceGroupOptions.Name + } + if createInstanceGroupOptions.ResourceGroup != nil { + body["resource_group"] = createInstanceGroupOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroup : Delete an instance group +// This request deletes an instance group. This operation cannot be reversed. Any instances associated with the group +// will be deleted. +func (vpc *VpcV1) DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupWithContext(context.Background(), deleteInstanceGroupOptions) +} + +// DeleteInstanceGroupWithContext is an alternate form of the DeleteInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupOptions, "deleteInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupOptions, "deleteInstanceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteInstanceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroup") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroup : Retrieve an instance group +// This request retrieves a single instance group specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) +} + +// GetInstanceGroupWithContext is an alternate form of the GetInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupOptions, "getInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupOptions, "getInstanceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroup : Update an instance group +// This request updates an instance group with the information provided instance group patch. The instance group patch +// object is structured in the same way as a retrieved instance group and contains only the information to be updated. +func (vpc *VpcV1) UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) +} + +// UpdateInstanceGroupWithContext is an alternate form of the UpdateInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupOptions, "updateInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupOptions, "updateInstanceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateInstanceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") + 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(updateInstanceGroupOptions.InstanceGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroupLoadBalancer : Delete an instance group load balancer +// This request unbinds the instance group from the load balancer pool, and deletes the load balancer pool members. +func (vpc *VpcV1) DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) +} + +// DeleteInstanceGroupLoadBalancerWithContext is an alternate form of the DeleteInstanceGroupLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context, deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupLoadBalancerOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/load_balancer`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListInstanceGroupManagers : List all managers for an instance group +// This request lists all managers for an instance group. +func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) +} + +// ListInstanceGroupManagersWithContext is an alternate form of the ListInstanceGroupManagers method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupManagersOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupManagersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") + 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 listInstanceGroupManagersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) + } + if listInstanceGroupManagersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagersOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceGroupManager : Create a manager for an instance group +// This request creates a new instance group manager. +func (vpc *VpcV1) CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) +} + +// CreateInstanceGroupManagerWithContext is an alternate form of the CreateInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *createInstanceGroupManagerOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManager") + 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(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroupManager : Delete an instance group manager +// This request deletes an instance group manager. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) +} + +// DeleteInstanceGroupManagerWithContext is an alternate form of the DeleteInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupManagerOptions.InstanceGroupID, + "id": *deleteInstanceGroupManagerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroupManager : Retrieve an instance group manager +// This request retrieves a single instance group manager specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) +} + +// GetInstanceGroupManagerWithContext is an alternate form of the GetInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupManagerOptions.InstanceGroupID, + "id": *getInstanceGroupManagerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroupManager : Update an instance group manager +// This request updates an instance group manager with the information provided instance group manager patch. +func (vpc *VpcV1) UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) +} + +// UpdateInstanceGroupManagerWithContext is an alternate form of the UpdateInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupManagerOptions.InstanceGroupID, + "id": *updateInstanceGroupManagerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManager") + 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(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceGroupManagerActions : List all actions for an instance group manager +// This request lists all instance group actions for an instance group manager. +func (vpc *VpcV1) ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) +} + +// ListInstanceGroupManagerActionsWithContext is an alternate form of the ListInstanceGroupManagerActions method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context, listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupManagerActionsOptions.InstanceGroupID, + "instance_group_manager_id": *listInstanceGroupManagerActionsOptions.InstanceGroupManagerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupManagerActionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerActions") + 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 listInstanceGroupManagerActionsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) + } + if listInstanceGroupManagerActionsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerActionsCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceGroupManagerAction : Create an instance group manager action +// This request creates a new instance group manager action. +func (vpc *VpcV1) CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) +} + +// CreateInstanceGroupManagerActionWithContext is an alternate form of the CreateInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Context, createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *createInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *createInstanceGroupManagerActionOptions.InstanceGroupManagerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupManagerActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerAction") + 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(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroupManagerAction : Delete specified instance group manager action +// This request deletes an instance group manager action. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) +} + +// DeleteInstanceGroupManagerActionWithContext is an alternate form of the DeleteInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Context, deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *deleteInstanceGroupManagerActionOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupManagerActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerAction") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroupManagerAction : Retrieve specified instance group manager action +// This request retrieves a single instance group manager action specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupManagerActionWithContext(context.Background(), getInstanceGroupManagerActionOptions) +} + +// GetInstanceGroupManagerActionWithContext is an alternate form of the GetInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *getInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *getInstanceGroupManagerActionOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupManagerActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerAction") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroupManagerAction : Update specified instance group manager action +// This request updates an instance group manager action. +func (vpc *VpcV1) UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) +} + +// UpdateInstanceGroupManagerActionWithContext is an alternate form of the UpdateInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Context, updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *updateInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *updateInstanceGroupManagerActionOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupManagerActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerAction") + 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(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceGroupManagerPolicies : List all policies for an instance group manager +// This request lists all policies for an instance group manager. +func (vpc *VpcV1) ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) +} + +// ListInstanceGroupManagerPoliciesWithContext is an alternate form of the ListInstanceGroupManagerPolicies method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Context, listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupID, + "instance_group_manager_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupManagerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupManagerPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerPolicies") + 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 listInstanceGroupManagerPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Start)) + } + if listInstanceGroupManagerPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceGroupManagerPolicy : Create a policy for an instance group manager +// This request creates a new instance group manager policy. +func (vpc *VpcV1) CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) +} + +// CreateInstanceGroupManagerPolicyWithContext is an alternate form of the CreateInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Context, createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") + 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(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroupManagerPolicy : Delete an instance group manager policy +// This request deletes an instance group manager policy. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) +} + +// DeleteInstanceGroupManagerPolicyWithContext is an alternate form of the DeleteInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Context, deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *deleteInstanceGroupManagerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroupManagerPolicy : Retrieve an instance group manager policy +// This request retrieves a single instance group manager policy specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) +} + +// GetInstanceGroupManagerPolicyWithContext is an alternate form of the GetInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *getInstanceGroupManagerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroupManagerPolicy : Update an instance group manager policy +// This request updates an instance group manager policy. +func (vpc *VpcV1) UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) +} + +// UpdateInstanceGroupManagerPolicyWithContext is an alternate form of the UpdateInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Context, updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *updateInstanceGroupManagerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerPolicy") + 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(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroupMemberships : Delete all memberships from an instance group +// This request deletes all memberships of an instance group. This operation cannot be reversed. reversed. Any +// memberships that have `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. +func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) +} + +// DeleteInstanceGroupMembershipsWithContext is an alternate form of the DeleteInstanceGroupMemberships method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupMembershipsOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupMembershipsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListInstanceGroupMemberships : List all memberships for an instance group +// This request lists all instance group memberships for an instance group. +func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) +} + +// ListInstanceGroupMembershipsWithContext is an alternate form of the ListInstanceGroupMemberships method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupMembershipsOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupMembershipsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupMemberships") + 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 listInstanceGroupMembershipsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) + } + if listInstanceGroupMembershipsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupMembershipsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembershipCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroupMembership : Delete an instance group membership +// This request deletes a memberships of an instance group. This operation cannot be reversed. reversed. If the +// membership has `delete_instance_on_membership_delete` set to `true`, the instance will also be deleted. +func (vpc *VpcV1) DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) +} + +// DeleteInstanceGroupMembershipWithContext is an alternate form of the DeleteInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupMembershipOptions.InstanceGroupID, + "id": *deleteInstanceGroupMembershipOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupMembershipOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroupMembership : Retrieve an instance group membership +// This request retrieves a single instance group membership specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) +} + +// GetInstanceGroupMembershipWithContext is an alternate form of the GetInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupMembershipOptions.InstanceGroupID, + "id": *getInstanceGroupMembershipOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupMembershipOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroupMembership : Update an instance group membership +// This request updates an instance group membership with the information provided instance group membership patch. +func (vpc *VpcV1) UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupMembershipWithContext(context.Background(), updateInstanceGroupMembershipOptions) +} + +// UpdateInstanceGroupMembershipWithContext is an alternate form of the UpdateInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupMembershipOptions.InstanceGroupID, + "id": *updateInstanceGroupMembershipOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupMembershipOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupMembership") + 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(updateInstanceGroupMembershipOptions.InstanceGroupMembershipPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListDedicatedHostGroups : List all dedicated host groups +// This request lists all dedicated host groups in the region. Host groups are a collection of dedicated hosts for +// placement of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. +func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) +} + +// ListDedicatedHostGroupsWithContext is an alternate form of the ListDedicatedHostGroups method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostGroupsOptions, "listDedicatedHostGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") + 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 listDedicatedHostGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) + } + if listDedicatedHostGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostGroupsOptions.Limit)) + } + if listDedicatedHostGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostGroupsOptions.ResourceGroupID)) + } + if listDedicatedHostGroupsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostGroupsOptions.ZoneName)) + } + if listDedicatedHostGroupsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listDedicatedHostGroupsOptions.Name)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroupCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateDedicatedHostGroup : Create a dedicated host group +// This request creates a new dedicated host group. +func (vpc *VpcV1) CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + return vpc.CreateDedicatedHostGroupWithContext(context.Background(), createDedicatedHostGroupOptions) +} + +// CreateDedicatedHostGroupWithContext is an alternate form of the CreateDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHostGroup") + 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 createDedicatedHostGroupOptions.Class != nil { + body["class"] = createDedicatedHostGroupOptions.Class + } + if createDedicatedHostGroupOptions.Family != nil { + body["family"] = createDedicatedHostGroupOptions.Family + } + if createDedicatedHostGroupOptions.Name != nil { + body["name"] = createDedicatedHostGroupOptions.Name + } + if createDedicatedHostGroupOptions.ResourceGroup != nil { + body["resource_group"] = createDedicatedHostGroupOptions.ResourceGroup + } + if createDedicatedHostGroupOptions.Zone != nil { + body["zone"] = createDedicatedHostGroupOptions.Zone + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteDedicatedHostGroup : Delete a dedicated host group +// This request deletes a dedicated host group. +func (vpc *VpcV1) DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteDedicatedHostGroupWithContext(context.Background(), deleteDedicatedHostGroupOptions) +} + +// DeleteDedicatedHostGroupWithContext is an alternate form of the DeleteDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteDedicatedHostGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHostGroup") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetDedicatedHostGroup : Retrieve a dedicated host group +// This request retrieves a single dedicated host group specified by the identifier in the URL. +func (vpc *VpcV1) GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) +} + +// GetDedicatedHostGroupWithContext is an alternate form of the GetDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getDedicatedHostGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateDedicatedHostGroup : Update a dedicated host group +// This request updates a dedicated host group with the information in a provided dedicated host group patch. The +// dedicated host group patch object is structured in the same way as a retrieved dedicated host group and contains only +// the information to be updated. +func (vpc *VpcV1) UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) +} + +// UpdateDedicatedHostGroupWithContext is an alternate form of the UpdateDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateDedicatedHostGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") + 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(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListDedicatedHostProfiles : List all dedicated host profiles +// This request lists all provisionable dedicated host profiles in the region. A dedicated host profile specifies the +// hardware characteristics for a dedicated host. +func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) +} + +// ListDedicatedHostProfilesWithContext is an alternate form of the ListDedicatedHostProfiles method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostProfilesOptions, "listDedicatedHostProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") + 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 listDedicatedHostProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) + } + if listDedicatedHostProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostProfilesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetDedicatedHostProfile : Retrieve a dedicated host profile +// This request retrieves a single dedicated host profile specified by the name in the URL. +func (vpc *VpcV1) GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostProfileWithContext(context.Background(), getDedicatedHostProfileOptions) +} + +// GetDedicatedHostProfileWithContext is an alternate form of the GetDedicatedHostProfile method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getDedicatedHostProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostProfile") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListDedicatedHosts : List all dedicated hosts +// This request lists all dedicated hosts in the region. +func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) +} + +// ListDedicatedHostsWithContext is an alternate form of the ListDedicatedHosts method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostsOptions, "listDedicatedHostsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") + 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 listDedicatedHostsOptions.DedicatedHostGroupID != nil { + builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) + } + if listDedicatedHostsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostsOptions.Start)) + } + if listDedicatedHostsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostsOptions.Limit)) + } + if listDedicatedHostsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostsOptions.ResourceGroupID)) + } + if listDedicatedHostsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostsOptions.ZoneName)) + } + if listDedicatedHostsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listDedicatedHostsOptions.Name)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateDedicatedHost : Create a dedicated host +// This request creates a new dedicated host. +func (vpc *VpcV1) CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) +} + +// CreateDedicatedHostWithContext is an alternate form of the CreateDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createDedicatedHostOptions, "createDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") + 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(createDedicatedHostOptions.DedicatedHostPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListDedicatedHostDisks : List all disks on a dedicated host +// This request lists all disks on a dedicated host. A disk is a physical device that is locally attached to the +// compute node. By default, the listed disks are sorted by their +// `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) +} + +// ListDedicatedHostDisksWithContext is an alternate form of the ListDedicatedHostDisks method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "dedicated_host_id": *listDedicatedHostDisksOptions.DedicatedHostID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDiskCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetDedicatedHostDisk : Retrieve a dedicated host disk +// This request retrieves a single dedicated host disk specified by the identifier in the URL. +func (vpc *VpcV1) GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) +} + +// GetDedicatedHostDiskWithContext is an alternate form of the GetDedicatedHostDisk method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "dedicated_host_id": *getDedicatedHostDiskOptions.DedicatedHostID, + "id": *getDedicatedHostDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateDedicatedHostDisk : Update a dedicated host disk +// This request updates the dedicated host disk with the information in a provided patch. +func (vpc *VpcV1) UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) +} + +// UpdateDedicatedHostDiskWithContext is an alternate form of the UpdateDedicatedHostDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "dedicated_host_id": *updateDedicatedHostDiskOptions.DedicatedHostID, + "id": *updateDedicatedHostDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") + 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(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteDedicatedHost : Delete a dedicated host +// This request deletes a dedicated host. +func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) +} + +// DeleteDedicatedHostWithContext is an alternate form of the DeleteDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteDedicatedHostOptions, "deleteDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetDedicatedHost : Retrieve a dedicated host +// This request retrieves a single dedicated host specified by the identifiers in the URL. +func (vpc *VpcV1) GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) +} + +// GetDedicatedHostWithContext is an alternate form of the GetDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostOptions, "getDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateDedicatedHost : Update a dedicated host +// This request updates a dedicated host with the information in a provided dedicated host patch. The dedicated host +// patch object is structured in the same way as a retrieved dedicated host and contains only the information to be +// updated. +func (vpc *VpcV1) UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) +} + +// UpdateDedicatedHostWithContext is an alternate form of the UpdateDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostOptions, "updateDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") + 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(updateDedicatedHostOptions.DedicatedHostPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBackupPolicies : List all backup policies +// This request lists all backup policies in the region. Backup policies control which sources are selected for backup +// and include a set of backup policy plans that provide the backup schedules and deletion triggers. +func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) +} + +// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter +func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listBackupPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") + 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 listBackupPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) + } + if listBackupPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) + } + if listBackupPoliciesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) + } + if listBackupPoliciesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) + } + if listBackupPoliciesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBackupPolicy : Create a backup policy +// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in +// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. +func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + return vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) +} + +// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") + 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 createBackupPolicyOptions.MatchResourceTypes != nil { + body["match_resource_types"] = createBackupPolicyOptions.MatchResourceTypes + } + if createBackupPolicyOptions.MatchUserTags != nil { + body["match_user_tags"] = createBackupPolicyOptions.MatchUserTags + } + if createBackupPolicyOptions.Name != nil { + body["name"] = createBackupPolicyOptions.Name + } + if createBackupPolicyOptions.Plans != nil { + body["plans"] = createBackupPolicyOptions.Plans + } + if createBackupPolicyOptions.ResourceGroup != nil { + body["resource_group"] = createBackupPolicyOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBackupPolicyPlans : List all plans for a backup policy +// This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. +func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) +} + +// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") + 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 listBackupPolicyPlansOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBackupPolicyPlan : Create a plan for a backup policy +// This request creates a new backup policy plan from a backup policy plan prototype object. The prototype object is +// structured in the same way as a retrieved backup policy plan, and contains the information necessary to create the +// new backup policy plan. +// +// Backups created by this plan will use the resource group of the source being backed up. +// +// Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character +// suffix. +func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) +} + +// CreateBackupPolicyPlanWithContext is an alternate form of the CreateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") + 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 createBackupPolicyPlanOptions.CronSpec != nil { + body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec + } + if createBackupPolicyPlanOptions.Active != nil { + body["active"] = createBackupPolicyPlanOptions.Active + } + if createBackupPolicyPlanOptions.AttachUserTags != nil { + body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags + } + if createBackupPolicyPlanOptions.CopyUserTags != nil { + body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags + } + if createBackupPolicyPlanOptions.DeletionTrigger != nil { + body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger + } + if createBackupPolicyPlanOptions.Name != nil { + body["name"] = createBackupPolicyPlanOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteBackupPolicyPlan : Delete a backup policy plan +// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by +// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with +// the plan will run to completion before the plan is deleted. +// +// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing +// completes, the backup policy plan will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) +} + +// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, + "id": *deleteBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + if deleteBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBackupPolicyPlan : Retrieve a backup policy plan +// This request retrieves a single backup policy plan specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) +} + +// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, + "id": *getBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBackupPolicyPlan : Update a backup policy plan +// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is +// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) +} + +// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, + "id": *updateBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteBackupPolicy : Delete a backup policy +// This request deletes a backup policy. This operation cannot be reversed. +// +// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, +// the backup policy will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + return vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) +} + +// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteBackupPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + if deleteBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBackupPolicy : Retrieve a backup policy +// This request retrieves a single backup policy specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + return vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) +} + +// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getBackupPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBackupPolicy : Update a backup policy +// This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch +// object is structured in the same way as a retrieved backup policy and contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + return vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) +} + +// UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateBackupPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListPlacementGroups : List all placement groups +// This request lists all placement groups in the region. +func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) +} + +// ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter +func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listPlacementGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") + 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 listPlacementGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) + } + if listPlacementGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreatePlacementGroup : Create a placement group +// This request creates a new placement group. +func (vpc *VpcV1) CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + return vpc.CreatePlacementGroupWithContext(context.Background(), createPlacementGroupOptions) +} + +// CreatePlacementGroupWithContext is an alternate form of the CreatePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPlacementGroupOptions, "createPlacementGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createPlacementGroupOptions, "createPlacementGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createPlacementGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePlacementGroup") + 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 createPlacementGroupOptions.Strategy != nil { + body["strategy"] = createPlacementGroupOptions.Strategy + } + if createPlacementGroupOptions.Name != nil { + body["name"] = createPlacementGroupOptions.Name + } + if createPlacementGroupOptions.ResourceGroup != nil { + body["resource_group"] = createPlacementGroupOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeletePlacementGroup : Delete a placement group +// This request deletes a placement group. This operation cannot be reversed. For this request to succeed, the placement +// group must not be associated with an instance. +func (vpc *VpcV1) DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeletePlacementGroupWithContext(context.Background(), deletePlacementGroupOptions) +} + +// DeletePlacementGroupWithContext is an alternate form of the DeletePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePlacementGroupOptions, "deletePlacementGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deletePlacementGroupOptions, "deletePlacementGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deletePlacementGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deletePlacementGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePlacementGroup") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetPlacementGroup : Retrieve a placement group +// This request retrieves a single placement group specified by identifier in the URL. +func (vpc *VpcV1) GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + return vpc.GetPlacementGroupWithContext(context.Background(), getPlacementGroupOptions) +} + +// GetPlacementGroupWithContext is an alternate form of the GetPlacementGroup method which supports a Context parameter +func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPlacementGroupOptions, "getPlacementGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getPlacementGroupOptions, "getPlacementGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getPlacementGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getPlacementGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPlacementGroup") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdatePlacementGroup : Update a placement group +// This request updates a placement group with the information provided placement group patch. The placement group patch +// object is structured in the same way as a retrieved placement group and contains only the information to be updated. +func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + return vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) +} + +// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updatePlacementGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updatePlacementGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") + 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(updatePlacementGroupOptions.PlacementGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerProfiles : List all bare metal server profiles +// This request lists all bare metal server profiles available in the region. A bare metal server profile specifies the +// performance characteristics and pricing model for a bare metal server. +func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) +} + +// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") + 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 listBareMetalServerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) + } + if listBareMetalServerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerProfile : Retrieve a bare metal server profile +// This request retrieves a single bare metal server profile specified by the name in the URL. +func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) +} + +// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getBareMetalServerProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServers : List all bare metal servers +// This request lists all bare metal servers in the region. +func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) +} + +// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") + 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 listBareMetalServersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) + } + if listBareMetalServersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) + } + if listBareMetalServersOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) + } + if listBareMetalServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) + } + if listBareMetalServersOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) + } + if listBareMetalServersOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) + } + if listBareMetalServersOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) + } + if listBareMetalServersOptions.NetworkInterfacesSubnetID != nil { + builder.AddQuery("network_interfaces.subnet.id", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetID)) + } + if listBareMetalServersOptions.NetworkInterfacesSubnetCRN != nil { + builder.AddQuery("network_interfaces.subnet.crn", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetCRN)) + } + if listBareMetalServersOptions.NetworkInterfacesSubnetName != nil { + builder.AddQuery("network_interfaces.subnet.name", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBareMetalServer : Create a bare metal server +// This request provisions a new bare metal server from a prototype object. The prototype object is structured in the +// same way as a retrieved bare metal server, and contains the information necessary to provision the new bare metal +// server. The bare metal server is automatically started. +func (vpc *VpcV1) CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerWithContext(context.Background(), createBareMetalServerOptions) +} + +// CreateBareMetalServerWithContext is an alternate form of the CreateBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerOptions, "createBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBareMetalServerOptions, "createBareMetalServerOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServer") + 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 createBareMetalServerOptions.Initialization != nil { + body["initialization"] = createBareMetalServerOptions.Initialization + } + if createBareMetalServerOptions.PrimaryNetworkInterface != nil { + body["primary_network_interface"] = createBareMetalServerOptions.PrimaryNetworkInterface + } + if createBareMetalServerOptions.Profile != nil { + body["profile"] = createBareMetalServerOptions.Profile + } + if createBareMetalServerOptions.Zone != nil { + body["zone"] = createBareMetalServerOptions.Zone + } + if createBareMetalServerOptions.Name != nil { + body["name"] = createBareMetalServerOptions.Name + } + if createBareMetalServerOptions.NetworkInterfaces != nil { + body["network_interfaces"] = createBareMetalServerOptions.NetworkInterfaces + } + if createBareMetalServerOptions.ResourceGroup != nil { + body["resource_group"] = createBareMetalServerOptions.ResourceGroup + } + if createBareMetalServerOptions.VPC != nil { + body["vpc"] = createBareMetalServerOptions.VPC + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBareMetalServerConsoleAccessToken : Create a console access token for a bare metal server +// This request creates a new single-use console access token for a bare metal server. All console configuration is +// provided at token create time, and the token is subsequently used in the `access_token` query parameter for the +// WebSocket request. The access token is only valid for a short period of time, and a maximum of one token is valid +// for a given bare metal server at a time. +func (vpc *VpcV1) CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerConsoleAccessTokenWithContext(context.Background(), createBareMetalServerConsoleAccessTokenOptions) +} + +// CreateBareMetalServerConsoleAccessTokenWithContext is an alternate form of the CreateBareMetalServerConsoleAccessToken method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context.Context, createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *createBareMetalServerConsoleAccessTokenOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/console_access_token`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createBareMetalServerConsoleAccessTokenOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerConsoleAccessToken") + 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 createBareMetalServerConsoleAccessTokenOptions.ConsoleType != nil { + body["console_type"] = createBareMetalServerConsoleAccessTokenOptions.ConsoleType + } + if createBareMetalServerConsoleAccessTokenOptions.Force != nil { + body["force"] = createBareMetalServerConsoleAccessTokenOptions.Force + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerConsoleAccessToken) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerDisks : List all disks on a bare metal server +// This request lists all disks on a bare metal server. A disk is a block device that is locally attached to the +// physical server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk +// first. +func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) +} + +// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerDisk : Retrieve a bare metal server disk +// This request retrieves a single disk specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) +} + +// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, + "id": *getBareMetalServerDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBareMetalServerDisk : Update a bare metal server disk +// This request updates the bare metal server disk with the information in a provided patch. +func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) +} + +// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, + "id": *updateBareMetalServerDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") + 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(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server +// This request lists all network interfaces on a bare metal server. A network interface is an abstract representation +// of a network interface card and connects a bare metal server to a subnet. While each network interface can attach to +// only one subnet, multiple network interfaces can be created to attach to multiple subnets. Multiple interfaces may +// also attach to the same subnet. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) +} + +// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") + 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 listBareMetalServerNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) + } + if listBareMetalServerNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server +// This request creates a new network interface from a network interface prototype object. The prototype object is +// structured in the same way as a retrieved network interface, and contains the information necessary to create the new +// network interface. Any subnet in the bare metal server's VPC may be specified, even if it is already attached to +// another network interface. Addresses on the network interface must be within the specified subnet's CIDR blocks. +func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) +} + +// CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") + 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(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteBareMetalServerNetworkInterface : Delete a network interface +// This request deletes a network interface. This operation cannot be reversed. Any floating IPs associated with the +// network interface are implicitly disassociated. The primary network interface is not allowed to be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) +} + +// DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetBareMetalServerNetworkInterface : Retrieve a network interface +// This request retrieves a single network interface specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) +} + +// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBareMetalServerNetworkInterface : Update a network interface +// This request updates a network interface with the information provided in a network interface patch object. The +// network interface patch object is structured in the same way as a retrieved network interface and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) +} + +// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") + 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(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a network interface +// This request lists all floating IPs associated with a network interface. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) +} + +// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a network interface +// This request disassociates the specified floating IP from the specified network interface. +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) +} + +// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request a retrieves a specified floating IP address if it is associated with the network interface and bare +// metal server specified in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) +} + +// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a network interface +// This request associates the specified floating IP with the specified network interface. If +// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` +// is `true`, this replaces any existing association. For this request to succeed, the existing floating IP must not be +// required by another resource, such as a public gateway. A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) +} + +// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteBareMetalServer : Delete a bare metal server +// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the +// bare metal server's network interfaces are implicitly disassociated. +func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) +} + +// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetBareMetalServer : Retrieve a bare metal server +// This request retrieves a single bare metal server specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) +} + +// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBareMetalServer : Update a bare metal server +// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object +// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) +} + +// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") + 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(updateBareMetalServerOptions.BareMetalServerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server +// This request retrieves configuration variables used to initialize the bare metal server, such as the image used, SSH +// keys, and any configured usernames and passwords. These attributes can subsequently be changed manually by the user +// and so are not guaranteed to be current. +func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) +} + +// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getBareMetalServerInitializationOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RestartBareMetalServer : Restart a bare metal server +// This request restarts a bare metal server. It will run immediately regardless of the state of the server. +func (vpc *VpcV1) RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.RestartBareMetalServerWithContext(context.Background(), restartBareMetalServerOptions) +} + +// RestartBareMetalServerWithContext is an alternate form of the RestartBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(restartBareMetalServerOptions, "restartBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(restartBareMetalServerOptions, "restartBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *restartBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/restart`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range restartBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RestartBareMetalServer") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// StartBareMetalServer : Start a bare metal server +// This request starts a bare metal server. It will run immediately provided the server is stopped. +func (vpc *VpcV1) StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.StartBareMetalServerWithContext(context.Background(), startBareMetalServerOptions) +} + +// StartBareMetalServerWithContext is an alternate form of the StartBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(startBareMetalServerOptions, "startBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(startBareMetalServerOptions, "startBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *startBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/start`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range startBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StartBareMetalServer") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// StopBareMetalServer : Stop a bare metal server +// This request stops a bare metal server. It will run immediately provided the server is running. Note: A soft stop may +// not complete as it relies on the operating system to perform the operation. +func (vpc *VpcV1) StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.StopBareMetalServerWithContext(context.Background(), stopBareMetalServerOptions) +} + +// StopBareMetalServerWithContext is an alternate form of the StopBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(stopBareMetalServerOptions, "stopBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(stopBareMetalServerOptions, "stopBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *stopBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/stop`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range stopBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StopBareMetalServer") + 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 stopBareMetalServerOptions.Type != nil { + body["type"] = stopBareMetalServerOptions.Type + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListVolumeProfiles : List all volume profiles +// This request lists all volume profiles available in the region. A volume profile specifies the performance +// characteristics and pricing model for a volume. +func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) +} + +// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter +func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVolumeProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") + 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 listVolumeProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) + } + if listVolumeProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVolumeProfile : Retrieve a volume profile +// This request retrieves a single volume profile specified by the name in the URL. +func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + return vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) +} + +// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter +func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getVolumeProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVolumeProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVolumes : List all volumes +// This request lists all volumes in the region. Volumes are network-connected block storage devices that may be +// attached to one or more instances in the same region. +func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + return vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) +} + +// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter +func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVolumesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") + 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 listVolumesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) + } + if listVolumesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) + } + if listVolumesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) + } + if listVolumesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVolume : Create a volume +// This request creates a new volume from a volume prototype object. The prototype object is structured in the same way +// as a retrieved volume, and contains the information necessary to create the new volume. +func (vpc *VpcV1) CreateVolume(createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions) +} + +// CreateVolumeWithContext is an alternate form of the CreateVolume method which supports a Context parameter +func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVolumeOptions, "createVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") + 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(createVolumeOptions.VolumePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVolume : Delete a volume +// This request deletes a volume. This operation cannot be reversed. For this request to succeed, the volume must not be +// attached to any instances. +func (vpc *VpcV1) DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions) +} + +// DeleteVolumeWithContext is an alternate form of the DeleteVolume method which supports a Context parameter +func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVolumeOptions, "deleteVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVolumeOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteVolumeOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVolumeOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVolume : Retrieve a volume +// This request retrieves a single volume specified by the identifier in the URL. +func (vpc *VpcV1) GetVolume(getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.GetVolumeWithContext(context.Background(), getVolumeOptions) +} + +// GetVolumeWithContext is an alternate form of the GetVolume method which supports a Context parameter +func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeOptions, "getVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVolumeOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVolume : Update a volume +// This request updates a volume with the information in a provided volume patch. The volume patch object is structured +// in the same way as a retrieved volume and contains only the information to be updated. +func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) +} + +// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter +func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVolumeOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVolumeOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSnapshots : Delete a filtered collection of snapshots +// This request deletes all snapshots created from a specific source volume. +func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) +} + +// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + if err != nil { + return + } + + for headerName, headerValue := range deleteSnapshotsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListSnapshots : List all snapshots +// This request lists all snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is +// created. +func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + return vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) +} + +// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSnapshotsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") + 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 listSnapshotsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) + } + if listSnapshotsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) + } + if listSnapshotsOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag)) + } + if listSnapshotsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID)) + } + if listSnapshotsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name)) + } + if listSnapshotsOptions.SourceVolumeID != nil { + builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID)) + } + if listSnapshotsOptions.SourceVolumeCRN != nil { + builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN)) + } + if listSnapshotsOptions.SourceImageID != nil { + builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID)) + } + if listSnapshotsOptions.SourceImageCRN != nil { + builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN)) + } + if listSnapshotsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort)) + } + if listSnapshotsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSnapshot : Create a snapshot +// This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same +// way as a retrieved snapshot, and contains the information necessary to provision the new snapshot. +func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + return vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) +} + +// CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") + 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(createSnapshotOptions.SnapshotPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSnapshot : Delete a snapshot +// This request deletes a snapshot. This operation cannot be reversed. +func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) +} + +// DeleteSnapshotWithContext is an alternate form of the DeleteSnapshot method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotOptions, "deleteSnapshotOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSnapshot : Retrieve a snapshot +// This request retrieves a single snapshot specified by the identifier in the URL. +func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + return vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) +} + +// GetSnapshotWithContext is an alternate form of the GetSnapshot method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotOptions, "getSnapshotOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateSnapshot : Update a snapshot +// This request updates a snapshot's name. +func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + return vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) +} + +// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter +func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListRegions : List all regions +// This request lists all regions. Each region is a separate geographic area that contains multiple isolated zones. +// Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones +// in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation +// available. Resources deployed within a single region also benefit from the low latency afforded by geographic +// proximity. +func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + return vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) +} + +// ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter +func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listRegionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetRegion : Retrieve a region +// This request retrieves a single region specified by the name in the URL. +func (vpc *VpcV1) GetRegion(getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { + return vpc.GetRegionWithContext(context.Background(), getRegionOptions) +} + +// GetRegionWithContext is an alternate form of the GetRegion method which supports a Context parameter +func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getRegionOptions, "getRegionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getRegionOptions, "getRegionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getRegionOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getRegionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegion") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegion) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListRegionZones : List all zones in a region +// This request lists all zones in a region. Zones represent logically-isolated data centers with high-bandwidth and +// low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. +func (vpc *VpcV1) ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { + return vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) +} + +// ListRegionZonesWithContext is an alternate form of the ListRegionZones method which supports a Context parameter +func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listRegionZonesOptions, "listRegionZonesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listRegionZonesOptions, "listRegionZonesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "region_name": *listRegionZonesOptions.RegionName, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listRegionZonesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegionZones") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetRegionZone : Retrieve a zone +// This request retrieves a single zone specified by the region and zone names in the URL. +func (vpc *VpcV1) GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { + return vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) +} + +// GetRegionZoneWithContext is an alternate form of the GetRegionZone method which supports a Context parameter +func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getRegionZoneOptions, "getRegionZoneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "region_name": *getRegionZoneOptions.RegionName, + "name": *getRegionZoneOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getRegionZoneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListPublicGateways : List all public gateways +// This request lists all 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) { + return vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listPublicGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") + 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 listPublicGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) + } + if listPublicGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) + } + if listPublicGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreatePublicGatewayWithContext(context.Background(), createPublicGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") + 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 + } + if createPublicGatewayOptions.FloatingIP != nil { + body["floating_ip"] = createPublicGatewayOptions.FloatingIP + } + if createPublicGatewayOptions.Name != nil { + body["name"] = createPublicGatewayOptions.Name + } + if createPublicGatewayOptions.ResourceGroup != nil { + body["resource_group"] = createPublicGatewayOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeletePublicGatewayWithContext(context.Background(), deletePublicGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deletePublicGatewayOptions, "deletePublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deletePublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deletePublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicGateway") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetPublicGatewayWithContext(context.Background(), getPublicGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getPublicGatewayOptions, "getPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicGateway") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updatePublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updatePublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") + 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(updatePublicGatewayOptions.PublicGatewayPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListFloatingIps : List all floating IPs +// This request lists all 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) { + return vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") + 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 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)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateFloatingIPWithContext(context.Background(), createFloatingIPOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createFloatingIPOptions, "createFloatingIPOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFloatingIP") + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteFloatingIPWithContext(context.Background(), deleteFloatingIPOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteFloatingIPOptions, "deleteFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFloatingIP") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetFloatingIPWithContext(context.Background(), getFloatingIPOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getFloatingIPOptions, "getFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFloatingIP") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP") + 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(updateFloatingIPOptions.FloatingIPPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListNetworkAcls : List all network ACLs +// This request lists all 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) { + return vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listNetworkAclsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") + 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 listNetworkAclsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) + } + 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() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateNetworkACLWithContext(context.Background(), createNetworkACLOptions) +} + +// 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.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + + if createNetworkACLOptions.NetworkACLPrototype != nil { + _, err = builder.SetBodyContentJSON(createNetworkACLOptions.NetworkACLPrototype) + if err != nil { + return + } + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteNetworkACLWithContext(context.Background(), deleteNetworkACLOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteNetworkACLOptions, "deleteNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteNetworkACLOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range deleteNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACL") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetNetworkACLWithContext(context.Background(), getNetworkACLOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getNetworkACLOptions, "getNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getNetworkACLOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range getNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACL") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions") + if err != nil { + return + } + + 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, `/network_acls/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + + _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListNetworkACLRules : List all rules for a network ACL +// This request lists all 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) { + return vpc.ListNetworkACLRulesWithContext(context.Background(), listNetworkACLRulesOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listNetworkACLRulesOptions, "listNetworkACLRulesOptions") + if err != nil { + return + } + + 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, `/network_acls/{network_acl_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listNetworkACLRulesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkACLRules") + 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 listNetworkACLRulesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkACLRulesOptions.Start)) + } + if listNetworkACLRulesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkACLRulesOptions.Limit)) + } + if listNetworkACLRulesOptions.Direction != nil { + builder.AddQuery("direction", fmt.Sprint(*listNetworkACLRulesOptions.Direction)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRuleCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *deleteNetworkACLRuleOptions.NetworkACLID, + "id": *deleteNetworkACLRuleOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *getNetworkACLRuleOptions.NetworkACLID, + "id": *getNetworkACLRuleOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range getNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + return + } + response.Result = result + } + + 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 information is not applicable to the rule's protocol. +func (vpc *VpcV1) UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateNetworkACLRuleWithContext(context.Background(), updateNetworkACLRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *updateNetworkACLRuleOptions.NetworkACLID, + "id": *updateNetworkACLRuleOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range updateNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + + _, err = builder.SetBodyContentJSON(updateNetworkACLRuleOptions.NetworkACLRulePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSecurityGroups : List all security groups +// This request lists all 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) { + return vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSecurityGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") + 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 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 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() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) + if err != nil { + return + } + response.Result = result + } + + 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 network interfaces on instances in that VPC can be added to the +// security group. +func (vpc *VpcV1) CreateSecurityGroup(createSecurityGroupOptions *CreateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + return vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createSecurityGroupOptions, "createSecurityGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") + 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 createSecurityGroupOptions.VPC != nil { + body["vpc"] = createSecurityGroupOptions.VPC + } + if createSecurityGroupOptions.Name != nil { + body["name"] = createSecurityGroupOptions.Name + } + if createSecurityGroupOptions.ResourceGroup != nil { + body["resource_group"] = createSecurityGroupOptions.ResourceGroup + } + if createSecurityGroupOptions.Rules != nil { + body["rules"] = createSecurityGroupOptions.Rules + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSecurityGroupOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range deleteSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSecurityGroupOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range getSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateSecurityGroupOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range updateSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") + 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(updateSecurityGroupOptions.SecurityGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSecurityGroupRules : List all rules in a security group +// This request lists all 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) { + return vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") + if err != nil { + 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) + if err != nil { + return + } + + for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") + if err != nil { + 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) + if err != nil { + return + } + + for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") + 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(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetSecurityGroupRuleWithContext(context.Background(), getSecurityGroupRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + if err != nil { + return + } + response.Result = result + } + + 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 information is not applicable to the +// rule's protocol. +func (vpc *VpcV1) UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") + 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(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSecurityGroupTargets : List all targets associated with a security group +// This request lists all 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) { + return vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions") + if err != nil { + 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) + if err != nil { + return + } + + for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets") + 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 listSecurityGroupTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) + } + if listSecurityGroupTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupTargetsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) + if err != nil { + return + } + response.Result = result + } + + 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 network interface identifier +// - A VPN server identifier +// - An application load balancer identifier +// - An endpoint gateway 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) { + return vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *deleteSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *deleteSecurityGroupTargetBindingOptions.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}/targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *getSecurityGroupTargetOptions.SecurityGroupID, + "id": *getSecurityGroupTargetOptions.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}/targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + if err != nil { + 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 network interface identifier +// - A VPN server identifier +// - An application load balancer identifier +// - An endpoint gateway 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) { + return vpc.CreateSecurityGroupTargetBindingWithContext(context.Background(), createSecurityGroupTargetBindingOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *createSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *createSecurityGroupTargetBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListIkePolicies : List all IKE policies +// This request lists all IKE policies in the region. +func (vpc *VpcV1) ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listIkePoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") + 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 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() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteIkePolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getIkePolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + 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) { + return vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateIkePolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListIkePolicyConnections : List all VPN gateway connections that use a specified IKE policy +// This request lists all VPN gateway connections that use a policy. +func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) +} + +// ListIkePolicyConnectionsWithContext is an alternate form of the ListIkePolicyConnections method which supports a Context parameter +func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *listIkePolicyConnectionsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}/connections`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListIpsecPolicies : List all IPsec policies +// This request lists all IPsec policies in the region. +func (vpc *VpcV1) ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listIpsecPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteIpsecPolicyWithContext(context.Background(), deleteIpsecPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteIpsecPolicyOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range deleteIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getIpsecPolicyOptions, "getIpsecPolicyOptions") + if err != nil { + 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, `/ipsec_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") + if err != nil { + return + } + + 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, `/ipsec_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListIpsecPolicyConnections : List all VPN gateway connections that use a specified IPsec policy +// This request lists all VPN gateway connections that use a policy. +func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) +} + +// ListIpsecPolicyConnectionsWithContext is an alternate form of the ListIpsecPolicyConnections method which supports a Context parameter +func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") + if err != nil { + 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 { + 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)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPNGateways : List all VPN gateways +// This request lists all VPN gateways in the region. +func (vpc *VpcV1) ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewaysWithContext(context.Background(), listVPNGatewaysOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") + 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 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.Mode != nil { + builder.AddQuery("mode", fmt.Sprint(*listVPNGatewaysOptions.Mode)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVPNGatewayOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPNGatewayOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range getVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVPNGatewayOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range updateVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPNGatewayConnections : List all connections of a VPN gateway +// This request lists all connections of a VPN gateway. +func (vpc *VpcV1) ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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_gateways/{vpn_gateway_id}/connections`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") + 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 listVPNGatewayConnectionsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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_gateways/{vpn_gateway_id}/connections`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + 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) { + return vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *deleteVPNGatewayConnectionOptions.VPNGatewayID, + "id": *deleteVPNGatewayConnectionOptions.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}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetVPNGatewayConnectionWithContext(context.Background(), getVPNGatewayConnectionOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *getVPNGatewayConnectionOptions.VPNGatewayID, + "id": *getVPNGatewayConnectionOptions.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}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *updateVPNGatewayConnectionOptions.VPNGatewayID, + "id": *updateVPNGatewayConnectionOptions.ID, + } + + 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}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + + _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPNGatewayConnectionLocalCIDRs : List all local CIDRs for a VPN gateway connection +// This request lists all local CIDRs for a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionLocalCIDRsOptions) +} + +// ListVPNGatewayConnectionLocalCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionLocalCIDRs method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *listVPNGatewayConnectionLocalCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionLocalCIDRsOptions.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`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewayConnectionLocalCIDRsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionLocalCIDRs") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionLocalCIDRs) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveVPNGatewayConnectionLocalCIDR : 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) RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveVPNGatewayConnectionLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionLocalCIDROptions) +} + +// RemoveVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *removeVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, + "id": *removeVPNGatewayConnectionLocalCIDROptions.ID, + "cidr_prefix": *removeVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, + "prefix_length": *removeVPNGatewayConnectionLocalCIDROptions.PrefixLength, + } + + 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_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeVPNGatewayConnectionLocalCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionLocalCIDR") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// CheckVPNGatewayConnectionLocalCIDR : 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) CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.CheckVPNGatewayConnectionLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionLocalCIDROptions) +} + +// CheckVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *checkVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, + "id": *checkVPNGatewayConnectionLocalCIDROptions.ID, + "cidr_prefix": *checkVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, + "prefix_length": *checkVPNGatewayConnectionLocalCIDROptions.PrefixLength, + } + + 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_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range checkVPNGatewayConnectionLocalCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionLocalCIDR") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// AddVPNGatewayConnectionLocalCIDR : 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) AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.AddVPNGatewayConnectionLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionLocalCIDROptions) +} + +// AddVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the AddVPNGatewayConnectionLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *addVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionLocalCIDROptions.ID, + "cidr_prefix": *addVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, + "prefix_length": *addVPNGatewayConnectionLocalCIDROptions.PrefixLength, + } + + 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}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addVPNGatewayConnectionLocalCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionLocalCIDR") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListVPNGatewayConnectionPeerCIDRs : List all peer CIDRs for a VPN gateway connection +// This request lists all peer CIDRs for a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionPeerCIDRsOptions) +} + +// ListVPNGatewayConnectionPeerCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionPeerCIDRs method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *listVPNGatewayConnectionPeerCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionPeerCIDRsOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewayConnectionPeerCIDRsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionPeerCIDRs") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionPeerCIDRs) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveVPNGatewayConnectionPeerCIDR : 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) RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveVPNGatewayConnectionPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionPeerCIDROptions) +} + +// RemoveVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *removeVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *removeVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *removeVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *removeVPNGatewayConnectionPeerCIDROptions.PrefixLength, + } + + 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_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeVPNGatewayConnectionPeerCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionPeerCIDR") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// CheckVPNGatewayConnectionPeerCIDR : 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) CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.CheckVPNGatewayConnectionPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionPeerCIDROptions) +} + +// CheckVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *checkVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *checkVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *checkVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *checkVPNGatewayConnectionPeerCIDROptions.PrefixLength, + } + + 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_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range checkVPNGatewayConnectionPeerCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionPeerCIDR") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// AddVPNGatewayConnectionPeerCIDR : 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) AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.AddVPNGatewayConnectionPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionPeerCIDROptions) +} + +// AddVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the AddVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *addVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *addVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *addVPNGatewayConnectionPeerCIDROptions.PrefixLength, + } + + 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}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addVPNGatewayConnectionPeerCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionPeerCIDR") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListVPNServers : List all VPN servers +// This request lists all VPN servers. +func (vpc *VpcV1) ListVPNServers(listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVPNServersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") + 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 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateVPNServerWithContext(context.Background(), createVPNServerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") + 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 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) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteVPNServerWithContext(context.Background(), deleteVPNServerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVPNServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getVPNServerOptions, "getVPNServerOptions") + if err != nil { + 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) + if err != nil { + return + } + + for headerName, headerValue := range getVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPNServer : Update a VPN server +// This request updates the properties of an existing VPN server. Any property changes will cause all connected VPN +// clients are disconnected from this VPN server except for the name change. +func (vpc *VpcV1) UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + return vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVPNServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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(updateVPNServerOptions.VPNServerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPNServerClientConfigurationOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}/client_configuration`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") + 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)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, &result) + + return +} + +// ListVPNServerClients : List all VPN clients for a VPN server +// This request retrieves all 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) { + return vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *listVPNServerClientsOptions.VPNServerID, + } + + 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) + if err != nil { + return + } + + for headerName, headerValue := range listVPNServerClientsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") + 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 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNServerClientOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNServerClientOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *disconnectVPNClientOptions.VPNServerID, + "id": *disconnectVPNClientOptions.ID, + } + + 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) + if err != nil { + return + } + + for headerName, headerValue := range disconnectVPNClientOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListVPNServerRoutes : List all VPN routes for a VPN server +// This request lists all 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) { + return vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNServerRoutesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRouteCollection) + if err != nil { + 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. destination of the +// packet. +func (vpc *VpcV1) CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + return vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPNServerRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getVPNServerRouteOptions, "getVPNServerRouteOptions") + if err != nil { + 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) + if err != nil { + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateVPNServerRouteWithContext(context.Background(), updateVPNServerRouteOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPNServerRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerProfiles : List all load balancer profiles +// This request lists all 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) { + return vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) +} + +// 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 { + 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 { + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfileCollection) + if err != nil { + 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) { + return vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getLoadBalancerProfileOptions.Name, + } + + 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) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancers : List all load balancers +// This request lists all load balancers in the region. +func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) +} + +// 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 { + return + } + + 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 { + return + } + + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerCollection) + if err != nil { + 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) { + return vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") + 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.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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + if err != nil { + return + } + response.Result = result + } + + 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`. +func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + if err != nil { + 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) { + return vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetLoadBalancerStatistics : List all 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) { + return vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") + if err != nil { + 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) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerStatistics) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerListeners : List all listeners for a load balancer +// This request lists all listeners for a load balancer. +func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, + } + + 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 { + return + } + + for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") + if err != nil { + 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) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") + 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 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.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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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}/listeners/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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}/listeners/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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}/listeners/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") + 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(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerListenerPolicies : List all policies for a load balancer listener +// This request lists all policies for a load balancer listener. +func (vpc *VpcV1) ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") + if err != nil { + 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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateLoadBalancerListenerPolicy : Create a policy for a load balancer listener +// Creates a new policy for a load balancer listener. +func (vpc *VpcV1) CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") + if err != nil { + 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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") + 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 createLoadBalancerListenerPolicyOptions.Target != nil { + body["target"] = createLoadBalancerListenerPolicyOptions.Target + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *deleteLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *deleteLoadBalancerListenerPolicyOptions.ListenerID, + "id": *deleteLoadBalancerListenerPolicyOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, + "id": *getLoadBalancerListenerPolicyOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateLoadBalancerListenerPolicy : Update a load balancer listener policy +// Updates a policy from a policy patch. +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, + "id": *updateLoadBalancerListenerPolicyOptions.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/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy +// This request lists all rules of a load balancer listener policy. +func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, + "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, + } + + 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) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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 { + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + 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) { + return vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") + if err != nil { + 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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") + 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(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerPools : List all pools of a load balancer +// This request lists all pools of a load balancer. +func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") + if err != nil { + 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, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") + if err != nil { + 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, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") + 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 createLoadBalancerPoolOptions.Algorithm != nil { + body["algorithm"] = createLoadBalancerPoolOptions.Algorithm + } + if createLoadBalancerPoolOptions.HealthMonitor != nil { + body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor + } + if createLoadBalancerPoolOptions.Protocol != nil { + body["protocol"] = createLoadBalancerPoolOptions.Protocol + } + if createLoadBalancerPoolOptions.Members != nil { + body["members"] = createLoadBalancerPoolOptions.Members + } + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") + 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(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerPoolMembers : List all members of a load balancer pool +// This request lists all members of a load balancer pool. +func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") + if err != nil { + 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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") + if err != nil { + 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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + 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) { + return vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") + if err != nil { + 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 { + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") + 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(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListEndpointGateways : List all endpoint gateways +// This request lists all 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) { + return vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listEndpointGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") + 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 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)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") + 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 createEndpointGatewayOptions.Target != nil { + body["target"] = createEndpointGatewayOptions.Target + } + if createEndpointGatewayOptions.VPC != nil { + body["vpc"] = createEndpointGatewayOptions.VPC + } + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway +// This request lists all reserved IPs bound to an endpoint gateway. +func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { + return vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, + } + + 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`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionEndpointGatewayContext) + if err != nil { + 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) { + return vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *removeEndpointGatewayIPOptions.EndpointGatewayID, + "id": *removeEndpointGatewayIPOptions.ID, + } + + 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/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetEndpointGatewayIP : Retrieve a reserved IP bound to an endpoint gateway +// This request a 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) { + return vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *getEndpointGatewayIPOptions.EndpointGatewayID, + "id": *getEndpointGatewayIPOptions.ID, + } + + 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) + if err != nil { + return + } + + for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + 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 +// - 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) { + return vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, + "id": *addEndpointGatewayIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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 { + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") + if err != nil { + 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, `/endpoint_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateEndpointGatewayOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range updateEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") + 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(updateEndpointGatewayOptions.EndpointGatewayPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListFlowLogCollectors : List all flow log collectors +// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over one or more +// network interfaces within a VPC, depending on the chosen target. +func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { + return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) +} + +// 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 { + return + } + + 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 { + return + } + + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollectorCollection) + if err != nil { + 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) { + return vpc.CreateFlowLogCollectorWithContext(context.Background(), createFlowLogCollectorOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createFlowLogCollectorOptions, "createFlowLogCollectorOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteFlowLogCollectorOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getFlowLogCollectorOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range getFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateFlowLogCollectorOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range updateFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddBareMetalServerNetworkInterfaceFloatingIPOptions : The AddBareMetalServerNetworkInterfaceFloatingIP options. +type AddBareMetalServerNetworkInterfaceFloatingIPOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The 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 instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The 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 +} + +// AddVPNGatewayConnectionLocalCIDROptions : The AddVPNGatewayConnectionLocalCIDR options. +type AddVPNGatewayConnectionLocalCIDROptions 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 address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddVPNGatewayConnectionLocalCIDROptions : Instantiate AddVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewAddVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { + return &AddVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetID(id string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionLocalCIDROptions { + options.Headers = param + return options +} + +// AddVPNGatewayConnectionPeerCIDROptions : The AddVPNGatewayConnectionPeerCIDR options. +type AddVPNGatewayConnectionPeerCIDROptions 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 address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddVPNGatewayConnectionPeerCIDROptions : Instantiate AddVPNGatewayConnectionPeerCIDROptions +func (*VpcV1) NewAddVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { + return &AddVPNGatewayConnectionPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetID(id string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionPeerCIDROptions { + 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 updated with a user-specified name. + IsDefault *bool `json:"is_default" validate:"required"` + + // The user-defined name for this address prefix. Names must be unique within the VPC the address prefix resides in. + 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 { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "has_subnets", &obj.HasSubnets) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AddressPrefixCollection : AddressPrefixCollection struct +type AddressPrefixCollection struct { + // Collection of address prefixes. + AddressPrefixes []AddressPrefix `json:"address_prefixes" validate:"required"` + + // A link to the first page of resources. + First *AddressPrefixCollectionFirst `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 *AddressPrefixCollectionNext `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 { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalAddressPrefixCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalAddressPrefixCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + return start, nil +} + +// 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"` +} + +// 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) + if err != nil { + 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"` +} + +// 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) + if err != nil { + 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"` + + // The user-defined name for this address prefix. Names must be unique within the VPC the address prefix resides in. + 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 { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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) + } + return +} + +// BackupPolicy : BackupPolicy struct +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 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"` + + // A 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 will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + MatchResourceTypes []string `json:"match_resource_types" 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 unique user-defined name for this backup policy. + 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"` +} + +// 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.MatchResourceTypes property. +// The resource type. +const ( + BackupPolicyMatchResourceTypesVolumeConst = "volume" +) + +// Constants associated with the BackupPolicy.ResourceType property. +// The resource type. +const ( + BackupPolicyResourceTypeBackupPolicyConst = "backup_policy" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_job_completed_at", &obj.LastJobCompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_resource_types", &obj.MatchResourceTypes) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyCollection : BackupPolicyCollection struct +type BackupPolicyCollection struct { + // Collection of backup policies. + BackupPolicies []BackupPolicy `json:"backup_policies" validate:"required"` + + // A link to the first page of resources. + First *BackupPolicyCollectionFirst `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"` + + // 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 { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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"` +} + +// 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPatch : BackupPolicyPatch struct +type BackupPolicyPatch struct { + // The user tags this backup policy applies 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 user-defined name for this backup policy. Names must be unique within the region this backup policy resides in. + Name *string `json:"name,omitempty"` +} + +// 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, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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) { + var jsonData []byte + jsonData, err = json.Marshal(backupPolicyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + 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"` + + // 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"` + + // 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 *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 lifecycle state of this backup policy plan. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The unique user-defined name for this backup policy plan. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTrigger) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanCollection : BackupPolicyPlanCollection struct +type BackupPolicyPlanCollection struct { + // Collection of backup policy plans. + Plans []BackupPolicyPlan `json:"plans" 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, "plans", &obj.Plans, UnmarshalBackupPolicyPlan) + if err != nil { + 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 { + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + 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 { + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + return + } + 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 { + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + 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"` + + // 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 user-defined name for this backup policy plan. Names must be unique within the backup policy this plan resides + // in. + Name *string `json:"name,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 { + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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) + } + 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"` + + // 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 user-defined name for this backup policy plan. Names must be unique within the backup policy this plan resides + // in. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,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") + 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 { + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanReference : BackupPolicyPlanReference struct +type BackupPolicyPlanReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BackupPolicyPlanReferenceDeleted `json:"deleted,omitempty"` + + // 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 unique user-defined name for this backup policy plan. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// 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, UnmarshalBackupPolicyPlanReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BackupPolicyPlanReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBackupPolicyPlanReferenceDeleted unmarshals an instance of BackupPolicyPlanReferenceDeleted from the specified map of raw messages. +func UnmarshalBackupPolicyPlanReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + 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's network interfaces. + Bandwidth *int64 `json:"bandwidth" validate:"required"` + + // The possible resource types for this property are expected to expand 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 bare metal server. + CRN *string `json:"crn" 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"` + + // 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 bare metal server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server. + ID *string `json:"id" validate:"required"` + + // The amount of memory, truncated to whole gibibytes. + Memory *int64 `json:"memory" validate:"required"` + + // The user-defined name for this bare metal server (and default system hostname). + Name *string `json:"name" validate:"required"` + + // The network interfaces for this bare metal server, including the primary network interface. + NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces" validate:"required"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfaceBareMetalServerContextReference `json:"primary_network_interface" validate:"required"` + + // The profile this bare metal server uses. + Profile *BareMetalServerProfileReference `json:"profile" validate:"required"` + + // 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 status of the bare metal server. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + 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 BareMetalServer.ResourceType property. +// The resource type. +const ( + BareMetalServerResourceTypeBareMetalServerConst = "bare_metal_server" +) + +// Constants associated with the BareMetalServer.Status property. +// The status of the bare metal server. +const ( + BareMetalServerStatusFailedConst = "failed" + BareMetalServerStatusMaintenanceConst = "maintenance" + BareMetalServerStatusPendingConst = "pending" + BareMetalServerStatusRestartingConst = "restarting" + BareMetalServerStatusRunningConst = "running" + BareMetalServerStatusStartingConst = "starting" + BareMetalServerStatusStoppedConst = "stopped" + BareMetalServerStatusStoppingConst = "stopping" +) + +// 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 { + return + } + err = core.UnmarshalModel(m, "boot_target", &obj.BootTarget, UnmarshalBareMetalServerBootTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu", &obj.Cpu, UnmarshalBareMetalServerCpu) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceBareMetalServerContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBareMetalServerStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModule) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerBootTarget : The possible resource types for this property are expected to expand 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 *BareMetalServerDiskReferenceDeleted `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 user-defined name for this disk. + 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, UnmarshalBareMetalServerDiskReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + 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 { + return + } + err = core.UnmarshalPrimitive(m, "core_count", &obj.CoreCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "threads_per_core", &obj.ThreadsPerCore) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerCollection : BareMetalServerCollection struct +type BareMetalServerCollection struct { + // Collection of bare metal servers. + BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` + + // A link to the first page of resources. + First *BareMetalServerCollectionFirst `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"` + + // 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 { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *BareMetalServerCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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"` +} + +// 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) + if err != nil { + 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"` +} + +// 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) + if err != nil { + 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"` + + // The bare metal server console type for which this token may be used. + ConsoleType *string `json:"console_type" validate:"required"` + + // The date and time that the access token was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The date and time that the access token will expire. + ExpiresAt *strfmt.DateTime `json:"expires_at" 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"` + + // The URL to access this bare metal server console. + Href *string `json:"href" validate:"required"` +} + +// Constants associated with the BareMetalServerConsoleAccessToken.ConsoleType property. +// The bare metal server console type for which this token may be used. +const ( + BareMetalServerConsoleAccessTokenConsoleTypeSerialConst = "serial" + BareMetalServerConsoleAccessTokenConsoleTypeVncConst = "vnc" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "force", &obj.Force) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + 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"` + + // The URL for this bare metal server disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server disk. + ID *string `json:"id" validate:"required"` + + // The disk interface used for attaching the disk. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The user-defined name for this disk. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *int64 `json:"size" validate:"required"` +} + +// Constants associated with the BareMetalServerDisk.InterfaceType property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerDiskInterfaceTypeNvmeConst = "nvme" + BareMetalServerDiskInterfaceTypeSataConst = "sata" +) + +// Constants associated with the BareMetalServerDisk.ResourceType property. +// The resource type. +const ( + BareMetalServerDiskResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerDiskCollection : BareMetalServerDiskCollection struct +type BareMetalServerDiskCollection struct { + // Collection of the bare metal server's disks. + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerDiskPatch : BareMetalServerDiskPatch struct +type BareMetalServerDiskPatch struct { + // The user-defined name for this disk. + 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 { + 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) + } + return +} + +// BareMetalServerDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerDiskReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerDiskReferenceDeleted unmarshals an instance of BareMetalServerDiskReferenceDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDiskReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + 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"` + + // 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 { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "user_accounts", &obj.UserAccounts, UnmarshalBareMetalServerInitializationUserAccount) + if err != nil { + 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"` + + // 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 chosen 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. + UserData *string `json:"user_data,omitempty"` +} + +// 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") + return +} + +// 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 { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + 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"` + + // 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 BareMetalServerInitializationUserAccount.ResourceType property. +// The resource type. +const ( + BareMetalServerInitializationUserAccountResourceTypeHostUserAccountConst = "host_user_account" +) + +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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "username", &obj.Username) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct +// Models which "extend" this model: +// - BareMetalServerNetworkInterfaceByPci +// - BareMetalServerNetworkInterfaceByVlan +type BareMetalServerNetworkInterface 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" validate:"required"` + + // The date and time that the network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - A single floating IP can be assigned to the network interface. + // + // If `false`: + // - Packets are passed unmodified to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - Multiple floating IPs can be assigned to the network interface. + // - `allow_ip_spoofing` must be set to `false`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + + // The floating IPs associated with this network interface. + FloatingIps []FloatingIPReference `json:"floating_ips,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The network 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 interface + // - Cannot directly use an IEEE 802.1q VLAN 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. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The MAC address of the interface. If absent, the value is not known. + MacAddress *string `json:"mac_address" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The network interface port speed in Mbps. + 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 network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the network interface. + Status *string `json:"status" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The type of this bare metal server network interface. + Type *string `json:"type" validate:"required"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be + // in the `allowed_vlans` array for one PCI type adapter per bare metal server. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // Indicates if the interface can float to any other server within the same + // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal + // server in the resource group. Applies only to `vlan` type interfaces. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + + // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + Vlan *int64 `json:"vlan,omitempty"` +} + +// Constants associated with the BareMetalServerNetworkInterface.InterfaceType property. +// The network 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 interface +// - Cannot directly use an IEEE 802.1q VLAN 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. +const ( + 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 network interface. +const ( + BareMetalServerNetworkInterfaceStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterface.Type property. +// The type of this bare metal server network interface. +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 = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + return + } + if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByPci) + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByVlan) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + } + return +} + +// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct +type BareMetalServerNetworkInterfaceCollection struct { + // A link to the first page of resources. + First *BareMetalServerNetworkInterfaceCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of network interfaces. + 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"` + + // 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct +type BareMetalServerNetworkInterfacePatch 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"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be + // in the `allowed_vlans` array for one PCI type adapter per bare metal server. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - A single floating IP can be assigned to the network interface. + // + // If `false`: + // - Packets are passed unmodified to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - Multiple floating IPs can be assigned to the network interface. + // - `allow_ip_spoofing` must be set to `false`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The user-defined name for network interface. Names must be unique within the instance the network interface resides + // in. + Name *string `json:"name,omitempty"` +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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) + } + return +} + +// BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct +// Models which "extend" this model: +// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype +// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype +type BareMetalServerNetworkInterfacePrototype 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"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - A single floating IP can be assigned to the network interface. + // + // If `false`: + // - Packets are passed unmodified to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - Multiple floating IPs can be assigned to the network interface. + // - `allow_ip_spoofing` must be set to `false`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The network 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 interface + // - Cannot directly use an IEEE 802.1q VLAN 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. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The user-defined name for network interface. Names must be unique within the instance the network interface resides + // in. 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 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 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 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"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be + // in the `allowed_vlans` array for one PCI type adapter per bare metal server. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // Indicates if the interface can float to any other server within the same + // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal + // server in the resource group. Applies only to `vlan` type interfaces. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + + // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + Vlan *int64 `json:"vlan,omitempty"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototype.InterfaceType property. +// The network 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 interface +// - Cannot directly use an IEEE 802.1q VLAN 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. +const ( + 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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + return + } + if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + } + return +} + +// BareMetalServerPatch : BareMetalServerPatch struct +type BareMetalServerPatch struct { + // The user-defined name for this bare metal server (and default system hostname). + Name *string `json:"name,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, "name", &obj.Name) + if err != nil { + 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) + } + return +} + +// BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct +type BareMetalServerPrimaryNetworkInterfacePrototype 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"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be + // in the `allowed_vlans` array for one PCI type adapter per bare metal server. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - A single floating IP can be assigned to the network interface. + // + // If `false`: + // - Packets are passed unmodified to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - Multiple floating IPs can be assigned to the network interface. + // - `allow_ip_spoofing` must be set to `false`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The network 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 interface + // - Cannot directly use an IEEE 802.1q VLAN tag. + InterfaceType *string `json:"interface_type,omitempty"` + + // The user-defined name for network interface. Names must be unique within the instance the network interface resides + // in. 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 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 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 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 network 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 interface +// - Cannot directly use an IEEE 802.1q VLAN tag. +const ( + BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypePciConst = "pci" +) + +// 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") + return +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfile : BareMetalServerProfile struct +type BareMetalServerProfile struct { + Bandwidth BareMetalServerProfileBandwidthIntf `json:"bandwidth" 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"` + + // Collection of the bare metal server profile's disks. + Disks []BareMetalServerProfileDisk `json:"disks" validate:"required"` + + // The product family this bare metal server profile belongs to. + Family *string `json:"family" validate:"required"` + + // The URL for this bare metal server profile. + Href *string `json:"href" validate:"required"` + + Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` + + // The name for this bare metal server profile. + Name *string `json:"name" validate:"required"` + + OsArchitecture *BareMetalServerProfileOsArchitecture `json:"os_architecture" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The supported trusted platform module (TPM) modes for this bare metal server profile. + SupportedTrustedPlatformModuleModes *BareMetalServerProfileSupportedTrustedPlatformModuleModes `json:"supported_trusted_platform_module_modes" validate:"required"` +} + +// Constants associated with the BareMetalServerProfile.ResourceType property. +// The resource type. +const ( + BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +// 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 { + return + } + err = core.UnmarshalModel(m, "cpu_architecture", &obj.CpuArchitecture, UnmarshalBareMetalServerProfileCpuArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_core_count", &obj.CpuCoreCount, UnmarshalBareMetalServerProfileCpuCoreCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_socket_count", &obj.CpuSocketCount, UnmarshalBareMetalServerProfileCpuSocketCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerProfileDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_trusted_platform_module_modes", &obj.SupportedTrustedPlatformModuleModes, UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes) + if err != nil { + return + } + 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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + 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"` + + // 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 { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + 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 +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + 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"` + + // 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 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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct +type BareMetalServerProfileCollection struct { + // A link to the first page of resources. + First *BareMetalServerProfileCollectionFirst `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"` + + // Collection 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"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalBareMetalServerProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *BareMetalServerProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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"` +} + +// 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 { + 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"` + + Size BareMetalServerProfileDiskSizeIntf `json:"size" validate:"required"` + + SupportedInterfaceTypes *BareMetalServerProfileDiskSupportedInterfaces `json:"supported_interface_types" 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalBareMetalServerProfileDiskSize) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalBareMetalServerProfileDiskSupportedInterfaces) + if err != nil { + 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"` + + // 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 BareMetalServerProfileDiskQuantity.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" +) + +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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + 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"` + + // 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 BareMetalServerProfileDiskSize.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { + return true +} + +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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct +type BareMetalServerProfileDiskSupportedInterfaces struct { + // The disk interface used for attaching the disk. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + 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"` +} + +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + 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 interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + 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 { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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"` +} + +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 { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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"` + + // 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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileReference : BareMetalServerProfileReference struct +type BareMetalServerProfileReference struct { + // The URL for this bare metal server profile. + Href *string `json:"href" 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"` +} + +// Constants associated with the BareMetalServerProfileReference.ResourceType property. +// The resource type. +const ( + BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileSupportedTrustedPlatformModuleModes : The supported trusted platform module (TPM) modes for this bare metal server profile. +type BareMetalServerProfileSupportedTrustedPlatformModuleModes struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported trusted platform module (TPM) modes. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileSupportedTrustedPlatformModuleModesTypeEnumConst = "enum" +) + +// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Values property. +// The mode for the trusted platform module (TPM): +// - `tpm_2`: Standard TPM 2 capabilities +// - `tpm_2_with_txt`: Standard TPM 2 with Intel Trusted Execution Technology (TXT) +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2WithTxtConst = "tpm_2_with_txt" +) + +// 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, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + 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. + 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 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. +const ( + BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" + BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" + BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" + BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" + BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerTrustedPlatformModule : BareMetalServerTrustedPlatformModule struct +type BareMetalServerTrustedPlatformModule struct { + // Indicates whether the trusted platform module (TPM) is enabled. If enabled, `mode` will also be set. + Enabled *bool `json:"enabled" validate:"required"` + + // The mode for the trusted platform module (TPM): + // - `tpm_2`: Standard TPM 2 capabilities + // - `tpm_2_with_txt`: Standard TPM 2 with Intel Trusted Execution Technology (TXT) + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the BareMetalServerTrustedPlatformModule.Mode property. +// The mode for the trusted platform module (TPM): +// - `tpm_2`: Standard TPM 2 capabilities +// - `tpm_2_with_txt`: Standard TPM 2 with Intel Trusted Execution Technology (TXT) +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerTrustedPlatformModuleModeTpm2Const = "tpm_2" + BareMetalServerTrustedPlatformModuleModeTpm2WithTxtConst = "tpm_2_with_txt" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + 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) + if err != nil { + 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) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CheckVPNGatewayConnectionLocalCIDROptions : The CheckVPNGatewayConnectionLocalCIDR options. +type CheckVPNGatewayConnectionLocalCIDROptions 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 address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCheckVPNGatewayConnectionLocalCIDROptions : Instantiate CheckVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewCheckVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { + return &CheckVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionLocalCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetID(id string) *CheckVPNGatewayConnectionLocalCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *CheckVPNGatewayConnectionLocalCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CheckVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionLocalCIDROptions { + options.Headers = param + return options +} + +// CheckVPNGatewayConnectionPeerCIDROptions : The CheckVPNGatewayConnectionPeerCIDR options. +type CheckVPNGatewayConnectionPeerCIDROptions 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 address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCheckVPNGatewayConnectionPeerCIDROptions : Instantiate CheckVPNGatewayConnectionPeerCIDROptions +func (*VpcV1) NewCheckVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionPeerCIDROptions { + return &CheckVPNGatewayConnectionPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionPeerCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetID(id string) *CheckVPNGatewayConnectionPeerCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *CheckVPNGatewayConnectionPeerCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *CheckVPNGatewayConnectionPeerCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CheckVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionPeerCIDROptions { + options.Headers = param + return options +} + +// CreateBackupPolicyOptions : The CreateBackupPolicy options. +type CreateBackupPolicyOptions struct { + // A 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. + MatchResourceTypes []string `json:"match_resource_types,omitempty"` + + // 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,omitempty"` + + // The user-defined name for this backup policy. Names must be unique within the region this backup policy resides in. + // 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateBackupPolicyOptions.MatchResourceTypes property. +// The resource type. +const ( + CreateBackupPolicyOptionsMatchResourceTypesVolumeConst = "volume" +) + +// NewCreateBackupPolicyOptions : Instantiate CreateBackupPolicyOptions +func (*VpcV1) NewCreateBackupPolicyOptions() *CreateBackupPolicyOptions { + return &CreateBackupPolicyOptions{} +} + +// SetMatchResourceTypes : Allow user to set MatchResourceTypes +func (_options *CreateBackupPolicyOptions) SetMatchResourceTypes(matchResourceTypes []string) *CreateBackupPolicyOptions { + _options.MatchResourceTypes = matchResourceTypes + return _options +} + +// SetMatchUserTags : Allow user to set MatchUserTags +func (_options *CreateBackupPolicyOptions) SetMatchUserTags(matchUserTags []string) *CreateBackupPolicyOptions { + _options.MatchUserTags = matchUserTags + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateBackupPolicyOptions) SetName(name string) *CreateBackupPolicyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPlans : Allow user to set Plans +func (_options *CreateBackupPolicyOptions) SetPlans(plans []BackupPolicyPlanPrototype) *CreateBackupPolicyOptions { + _options.Plans = plans + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateBackupPolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateBackupPolicyOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBackupPolicyOptions) SetHeaders(param map[string]string) *CreateBackupPolicyOptions { + options.Headers = param + return options +} + +// CreateBackupPolicyPlanOptions : The CreateBackupPolicyPlan options. +type CreateBackupPolicyPlanOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // 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"` + + // 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"` + + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags,omitempty"` + + DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"` + + // The user-defined name for this backup policy plan. Names must be unique within the backup policy this plan resides + // in. 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 +} + +// NewCreateBackupPolicyPlanOptions : Instantiate CreateBackupPolicyPlanOptions +func (*VpcV1) NewCreateBackupPolicyPlanOptions(backupPolicyID string, cronSpec string) *CreateBackupPolicyPlanOptions { + return &CreateBackupPolicyPlanOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + CronSpec: core.StringPtr(cronSpec), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *CreateBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *CreateBackupPolicyPlanOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetCronSpec : Allow user to set CronSpec +func (_options *CreateBackupPolicyPlanOptions) SetCronSpec(cronSpec string) *CreateBackupPolicyPlanOptions { + _options.CronSpec = core.StringPtr(cronSpec) + return _options +} + +// SetActive : Allow user to set Active +func (_options *CreateBackupPolicyPlanOptions) SetActive(active bool) *CreateBackupPolicyPlanOptions { + _options.Active = core.BoolPtr(active) + return _options +} + +// SetAttachUserTags : Allow user to set AttachUserTags +func (_options *CreateBackupPolicyPlanOptions) SetAttachUserTags(attachUserTags []string) *CreateBackupPolicyPlanOptions { + _options.AttachUserTags = attachUserTags + return _options +} + +// SetCopyUserTags : Allow user to set CopyUserTags +func (_options *CreateBackupPolicyPlanOptions) SetCopyUserTags(copyUserTags bool) *CreateBackupPolicyPlanOptions { + _options.CopyUserTags = core.BoolPtr(copyUserTags) + return _options +} + +// SetDeletionTrigger : Allow user to set DeletionTrigger +func (_options *CreateBackupPolicyPlanOptions) SetDeletionTrigger(deletionTrigger *BackupPolicyPlanDeletionTriggerPrototype) *CreateBackupPolicyPlanOptions { + _options.DeletionTrigger = deletionTrigger + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateBackupPolicyPlanOptions) SetName(name string) *CreateBackupPolicyPlanOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *CreateBackupPolicyPlanOptions { + options.Headers = param + return options +} + +// CreateBareMetalServerConsoleAccessTokenOptions : The CreateBareMetalServerConsoleAccessToken options. +type CreateBareMetalServerConsoleAccessTokenOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server console type for which this token may be used. + ConsoleType *string `json:"console_type" 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,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateBareMetalServerConsoleAccessTokenOptions.ConsoleType property. +// The bare metal server console type for which this token may be used. +const ( + CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeSerialConst = "serial" + CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeVncConst = "vnc" +) + +// NewCreateBareMetalServerConsoleAccessTokenOptions : Instantiate CreateBareMetalServerConsoleAccessTokenOptions +func (*VpcV1) NewCreateBareMetalServerConsoleAccessTokenOptions(bareMetalServerID string, consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions { + return &CreateBareMetalServerConsoleAccessTokenOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ConsoleType: core.StringPtr(consoleType), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerConsoleAccessTokenOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetConsoleType : Allow user to set ConsoleType +func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetConsoleType(consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions { + _options.ConsoleType = core.StringPtr(consoleType) + return _options +} + +// SetForce : Allow user to set Force +func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetForce(force bool) *CreateBareMetalServerConsoleAccessTokenOptions { + _options.Force = core.BoolPtr(force) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerConsoleAccessTokenOptions) SetHeaders(param map[string]string) *CreateBareMetalServerConsoleAccessTokenOptions { + options.Headers = param + return options +} + +// CreateBareMetalServerNetworkInterfaceOptions : The CreateBareMetalServerNetworkInterface options. +type CreateBareMetalServerNetworkInterfaceOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The network interface prototype object. + BareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf `json:"BareMetalServerNetworkInterfacePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateBareMetalServerNetworkInterfaceOptions : Instantiate CreateBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewCreateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { + return &CreateBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + BareMetalServerNetworkInterfacePrototype: bareMetalServerNetworkInterfacePrototype, + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetBareMetalServerNetworkInterfacePrototype : Allow user to set BareMetalServerNetworkInterfacePrototype +func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePrototype(bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options +} + +// CreateBareMetalServerOptions : The CreateBareMetalServer options. +type CreateBareMetalServerOptions struct { + Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` + + // Primary network interface for the bare metal server. + PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The profile to use for this bare metal server. + Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` + + // The zone this bare metal server will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The unique user-defined name for this bare metal server (and default system hostname). If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The additional network interfaces to create for the bare metal server. + NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The VPC the bare metal server is to be a part of. If specified, it must match the + // VPC referenced by the subnets of the server's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateBareMetalServerOptions : Instantiate CreateBareMetalServerOptions +func (*VpcV1) NewCreateBareMetalServerOptions(initialization *BareMetalServerInitializationPrototype, primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf) *CreateBareMetalServerOptions { + return &CreateBareMetalServerOptions{ + Initialization: initialization, + PrimaryNetworkInterface: primaryNetworkInterface, + Profile: profile, + Zone: zone, + } +} + +// SetInitialization : Allow user to set Initialization +func (_options *CreateBareMetalServerOptions) SetInitialization(initialization *BareMetalServerInitializationPrototype) *CreateBareMetalServerOptions { + _options.Initialization = initialization + return _options +} + +// SetPrimaryNetworkInterface : Allow user to set PrimaryNetworkInterface +func (_options *CreateBareMetalServerOptions) SetPrimaryNetworkInterface(primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype) *CreateBareMetalServerOptions { + _options.PrimaryNetworkInterface = primaryNetworkInterface + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *CreateBareMetalServerOptions) SetProfile(profile BareMetalServerProfileIdentityIntf) *CreateBareMetalServerOptions { + _options.Profile = profile + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateBareMetalServerOptions) SetZone(zone ZoneIdentityIntf) *CreateBareMetalServerOptions { + _options.Zone = zone + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateBareMetalServerOptions) SetName(name string) *CreateBareMetalServerOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetNetworkInterfaces : Allow user to set NetworkInterfaces +func (_options *CreateBareMetalServerOptions) SetNetworkInterfaces(networkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerOptions { + _options.NetworkInterfaces = networkInterfaces + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateBareMetalServerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateBareMetalServerOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetVPC : Allow user to set VPC +func (_options *CreateBareMetalServerOptions) SetVPC(vpc VPCIdentityIntf) *CreateBareMetalServerOptions { + _options.VPC = vpc + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerOptions) SetHeaders(param map[string]string) *CreateBareMetalServerOptions { + options.Headers = param + return options +} + +// CreateDedicatedHostGroupOptions : The CreateDedicatedHostGroup options. +type CreateDedicatedHostGroupOptions struct { + // The dedicated host profile class for hosts in this group. + Class *string `json:"class,omitempty"` + + // The dedicated host profile family for hosts in this group. + Family *string `json:"family,omitempty"` + + // The unique user-defined name for this dedicated host group. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The zone this dedicated host group will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateDedicatedHostGroupOptions.Family property. +// The dedicated host profile family for hosts in this group. +const ( + CreateDedicatedHostGroupOptionsFamilyBalancedConst = "balanced" + CreateDedicatedHostGroupOptionsFamilyComputeConst = "compute" + CreateDedicatedHostGroupOptionsFamilyMemoryConst = "memory" +) + +// NewCreateDedicatedHostGroupOptions : Instantiate CreateDedicatedHostGroupOptions +func (*VpcV1) NewCreateDedicatedHostGroupOptions() *CreateDedicatedHostGroupOptions { + return &CreateDedicatedHostGroupOptions{} +} + +// SetClass : Allow user to set Class +func (_options *CreateDedicatedHostGroupOptions) SetClass(class string) *CreateDedicatedHostGroupOptions { + _options.Class = core.StringPtr(class) + return _options +} + +// SetFamily : Allow user to set Family +func (_options *CreateDedicatedHostGroupOptions) SetFamily(family string) *CreateDedicatedHostGroupOptions { + _options.Family = core.StringPtr(family) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateDedicatedHostGroupOptions) SetName(name string) *CreateDedicatedHostGroupOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateDedicatedHostGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateDedicatedHostGroupOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateDedicatedHostGroupOptions) SetZone(zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions { + _options.Zone = zone + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateDedicatedHostGroupOptions) SetHeaders(param map[string]string) *CreateDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// CreateDedicatedHostOptions : The CreateDedicatedHost options. +type CreateDedicatedHostOptions struct { + // The dedicated host prototype object. + DedicatedHostPrototype DedicatedHostPrototypeIntf `json:"DedicatedHostPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateDedicatedHostOptions : Instantiate CreateDedicatedHostOptions +func (*VpcV1) NewCreateDedicatedHostOptions(dedicatedHostPrototype DedicatedHostPrototypeIntf) *CreateDedicatedHostOptions { + return &CreateDedicatedHostOptions{ + DedicatedHostPrototype: dedicatedHostPrototype, + } +} + +// SetDedicatedHostPrototype : Allow user to set DedicatedHostPrototype +func (_options *CreateDedicatedHostOptions) SetDedicatedHostPrototype(dedicatedHostPrototype DedicatedHostPrototypeIntf) *CreateDedicatedHostOptions { + _options.DedicatedHostPrototype = dedicatedHostPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateDedicatedHostOptions) SetHeaders(param map[string]string) *CreateDedicatedHostOptions { + options.Headers = param + return options +} + +// CreateEndpointGatewayOptions : The CreateEndpointGateway options. +type CreateEndpointGatewayOptions struct { + // The target for this endpoint gateway. + Target EndpointGatewayTargetPrototypeIntf `json:"target" validate:"required"` + + // The VPC this endpoint gateway will serve. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The reserved IPs to bind to this endpoint gateway. At most one reserved IP per zone is allowed. + Ips []EndpointGatewayReservedIPIntf `json:"ips,omitempty"` + + // The user-defined name for this endpoint gateway. If unspecified, the name will be a hyphenated list of + // randomly-selected words. Names must be unique within the VPC this endpoint gateway is serving. + 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // 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 + Headers map[string]string +} + +// NewCreateEndpointGatewayOptions : Instantiate CreateEndpointGatewayOptions +func (*VpcV1) NewCreateEndpointGatewayOptions(target EndpointGatewayTargetPrototypeIntf, vpc VPCIdentityIntf) *CreateEndpointGatewayOptions { + return &CreateEndpointGatewayOptions{ + Target: target, + VPC: vpc, + } +} + +// SetTarget : Allow user to set Target +func (_options *CreateEndpointGatewayOptions) SetTarget(target EndpointGatewayTargetPrototypeIntf) *CreateEndpointGatewayOptions { + _options.Target = target + return _options +} + +// SetVPC : Allow user to set VPC +func (_options *CreateEndpointGatewayOptions) SetVPC(vpc VPCIdentityIntf) *CreateEndpointGatewayOptions { + _options.VPC = vpc + return _options +} + +// SetIps : Allow user to set Ips +func (_options *CreateEndpointGatewayOptions) SetIps(ips []EndpointGatewayReservedIPIntf) *CreateEndpointGatewayOptions { + _options.Ips = ips + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateEndpointGatewayOptions) SetName(name string) *CreateEndpointGatewayOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateEndpointGatewayOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateEndpointGatewayOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateEndpointGatewayOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateEndpointGatewayOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateEndpointGatewayOptions) SetHeaders(param map[string]string) *CreateEndpointGatewayOptions { + options.Headers = param + return options +} + +// CreateFloatingIPOptions : The CreateFloatingIP options. +type CreateFloatingIPOptions struct { + // The floating IP prototype object. + FloatingIPPrototype FloatingIPPrototypeIntf `json:"FloatingIPPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateFloatingIPOptions : Instantiate CreateFloatingIPOptions +func (*VpcV1) NewCreateFloatingIPOptions(floatingIPPrototype FloatingIPPrototypeIntf) *CreateFloatingIPOptions { + return &CreateFloatingIPOptions{ + FloatingIPPrototype: floatingIPPrototype, + } +} + +// SetFloatingIPPrototype : Allow user to set FloatingIPPrototype +func (_options *CreateFloatingIPOptions) SetFloatingIPPrototype(floatingIPPrototype FloatingIPPrototypeIntf) *CreateFloatingIPOptions { + _options.FloatingIPPrototype = floatingIPPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateFloatingIPOptions) SetHeaders(param map[string]string) *CreateFloatingIPOptions { + options.Headers = param + return options +} + +// CreateFlowLogCollectorOptions : The CreateFlowLogCollector options. +type CreateFlowLogCollectorOptions struct { + // The Cloud Object Storage bucket where the collected flows will be logged. + // The bucket must exist and an IAM service authorization must grant + // `IBM Cloud Flow Logs` resources of `VPC Infrastructure Services` writer + // access to the bucket. + StorageBucket LegacyCloudObjectStorageBucketIdentityIntf `json:"storage_bucket" validate:"required"` + + // The target this collector will collect flow logs for. If the target is an instance, + // subnet, or VPC, flow logs will not be collected for any network interfaces within the + // target that are themselves the target of a more specific flow log collector. + Target FlowLogCollectorTargetPrototypeIntf `json:"target" validate:"required"` + + // Indicates whether this collector will be active upon creation. + Active *bool `json:"active,omitempty"` + + // The unique user-defined name for this flow log collector. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateFlowLogCollectorOptions : Instantiate CreateFlowLogCollectorOptions +func (*VpcV1) NewCreateFlowLogCollectorOptions(storageBucket LegacyCloudObjectStorageBucketIdentityIntf, target FlowLogCollectorTargetPrototypeIntf) *CreateFlowLogCollectorOptions { + return &CreateFlowLogCollectorOptions{ + StorageBucket: storageBucket, + Target: target, + } +} + +// SetStorageBucket : Allow user to set StorageBucket +func (_options *CreateFlowLogCollectorOptions) SetStorageBucket(storageBucket LegacyCloudObjectStorageBucketIdentityIntf) *CreateFlowLogCollectorOptions { + _options.StorageBucket = storageBucket + return _options +} + +// SetTarget : Allow user to set Target +func (_options *CreateFlowLogCollectorOptions) SetTarget(target FlowLogCollectorTargetPrototypeIntf) *CreateFlowLogCollectorOptions { + _options.Target = target + return _options +} + +// SetActive : Allow user to set Active +func (_options *CreateFlowLogCollectorOptions) SetActive(active bool) *CreateFlowLogCollectorOptions { + _options.Active = core.BoolPtr(active) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateFlowLogCollectorOptions) SetName(name string) *CreateFlowLogCollectorOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateFlowLogCollectorOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateFlowLogCollectorOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateFlowLogCollectorOptions) SetHeaders(param map[string]string) *CreateFlowLogCollectorOptions { + options.Headers = param + return options +} + +// CreateIkePolicyOptions : The CreateIkePolicy options. +type CreateIkePolicyOptions struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` + + // The Diffie-Hellman group. + DhGroup *int64 `json:"dh_group" validate:"required"` + + // The encryption algorithm. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // The IKE protocol version. + IkeVersion *int64 `json:"ike_version" validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime,omitempty"` + + // The user-defined name for this IKE policy. + 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateIkePolicyOptions.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + CreateIkePolicyOptionsAuthenticationAlgorithmMd5Const = "md5" + CreateIkePolicyOptionsAuthenticationAlgorithmSha1Const = "sha1" + CreateIkePolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" + CreateIkePolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the CreateIkePolicyOptions.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + CreateIkePolicyOptionsEncryptionAlgorithmAes128Const = "aes128" + CreateIkePolicyOptionsEncryptionAlgorithmAes256Const = "aes256" + CreateIkePolicyOptionsEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// NewCreateIkePolicyOptions : Instantiate CreateIkePolicyOptions +func (*VpcV1) NewCreateIkePolicyOptions(authenticationAlgorithm string, dhGroup int64, encryptionAlgorithm string, ikeVersion int64) *CreateIkePolicyOptions { + return &CreateIkePolicyOptions{ + AuthenticationAlgorithm: core.StringPtr(authenticationAlgorithm), + DhGroup: core.Int64Ptr(dhGroup), + EncryptionAlgorithm: core.StringPtr(encryptionAlgorithm), + IkeVersion: core.Int64Ptr(ikeVersion), + } +} + +// SetAuthenticationAlgorithm : Allow user to set AuthenticationAlgorithm +func (_options *CreateIkePolicyOptions) SetAuthenticationAlgorithm(authenticationAlgorithm string) *CreateIkePolicyOptions { + _options.AuthenticationAlgorithm = core.StringPtr(authenticationAlgorithm) + return _options +} + +// SetDhGroup : Allow user to set DhGroup +func (_options *CreateIkePolicyOptions) SetDhGroup(dhGroup int64) *CreateIkePolicyOptions { + _options.DhGroup = core.Int64Ptr(dhGroup) + return _options +} + +// SetEncryptionAlgorithm : Allow user to set EncryptionAlgorithm +func (_options *CreateIkePolicyOptions) SetEncryptionAlgorithm(encryptionAlgorithm string) *CreateIkePolicyOptions { + _options.EncryptionAlgorithm = core.StringPtr(encryptionAlgorithm) + return _options +} + +// SetIkeVersion : Allow user to set IkeVersion +func (_options *CreateIkePolicyOptions) SetIkeVersion(ikeVersion int64) *CreateIkePolicyOptions { + _options.IkeVersion = core.Int64Ptr(ikeVersion) + return _options +} + +// SetKeyLifetime : Allow user to set KeyLifetime +func (_options *CreateIkePolicyOptions) SetKeyLifetime(keyLifetime int64) *CreateIkePolicyOptions { + _options.KeyLifetime = core.Int64Ptr(keyLifetime) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateIkePolicyOptions) SetName(name string) *CreateIkePolicyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateIkePolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateIkePolicyOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateIkePolicyOptions) SetHeaders(param map[string]string) *CreateIkePolicyOptions { + options.Headers = param + return options +} + +// CreateImageOptions : The CreateImage options. +type CreateImageOptions struct { + // The image prototype object. + ImagePrototype ImagePrototypeIntf `json:"ImagePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateImageOptions : Instantiate CreateImageOptions +func (*VpcV1) NewCreateImageOptions(imagePrototype ImagePrototypeIntf) *CreateImageOptions { + return &CreateImageOptions{ + ImagePrototype: imagePrototype, + } +} + +// SetImagePrototype : Allow user to set ImagePrototype +func (_options *CreateImageOptions) SetImagePrototype(imagePrototype ImagePrototypeIntf) *CreateImageOptions { + _options.ImagePrototype = imagePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateImageOptions) SetHeaders(param map[string]string) *CreateImageOptions { + options.Headers = param + return options +} + +// CreateInstanceActionOptions : The CreateInstanceAction options. +type CreateInstanceActionOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The type of action. + Type *string `json:"type" validate:"required"` + + // 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 + Headers map[string]string +} + +// Constants associated with the CreateInstanceActionOptions.Type property. +// The type of action. +const ( + CreateInstanceActionOptionsTypeRebootConst = "reboot" + CreateInstanceActionOptionsTypeStartConst = "start" + CreateInstanceActionOptionsTypeStopConst = "stop" +) + +// NewCreateInstanceActionOptions : Instantiate CreateInstanceActionOptions +func (*VpcV1) NewCreateInstanceActionOptions(instanceID string, typeVar string) *CreateInstanceActionOptions { + return &CreateInstanceActionOptions{ + InstanceID: core.StringPtr(instanceID), + Type: core.StringPtr(typeVar), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *CreateInstanceActionOptions) SetInstanceID(instanceID string) *CreateInstanceActionOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetType : Allow user to set Type +func (_options *CreateInstanceActionOptions) SetType(typeVar string) *CreateInstanceActionOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetForce : Allow user to set Force +func (_options *CreateInstanceActionOptions) SetForce(force bool) *CreateInstanceActionOptions { + _options.Force = core.BoolPtr(force) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceActionOptions) SetHeaders(param map[string]string) *CreateInstanceActionOptions { + options.Headers = param + return options +} + +// CreateInstanceConsoleAccessTokenOptions : The CreateInstanceConsoleAccessToken options. +type CreateInstanceConsoleAccessTokenOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance console type for which this token may be used. + ConsoleType *string `json:"console_type" 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,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateInstanceConsoleAccessTokenOptions.ConsoleType property. +// The instance console type for which this token may be used. +const ( + CreateInstanceConsoleAccessTokenOptionsConsoleTypeSerialConst = "serial" + CreateInstanceConsoleAccessTokenOptionsConsoleTypeVncConst = "vnc" +) + +// NewCreateInstanceConsoleAccessTokenOptions : Instantiate CreateInstanceConsoleAccessTokenOptions +func (*VpcV1) NewCreateInstanceConsoleAccessTokenOptions(instanceID string, consoleType string) *CreateInstanceConsoleAccessTokenOptions { + return &CreateInstanceConsoleAccessTokenOptions{ + InstanceID: core.StringPtr(instanceID), + ConsoleType: core.StringPtr(consoleType), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *CreateInstanceConsoleAccessTokenOptions) SetInstanceID(instanceID string) *CreateInstanceConsoleAccessTokenOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetConsoleType : Allow user to set ConsoleType +func (_options *CreateInstanceConsoleAccessTokenOptions) SetConsoleType(consoleType string) *CreateInstanceConsoleAccessTokenOptions { + _options.ConsoleType = core.StringPtr(consoleType) + return _options +} + +// SetForce : Allow user to set Force +func (_options *CreateInstanceConsoleAccessTokenOptions) SetForce(force bool) *CreateInstanceConsoleAccessTokenOptions { + _options.Force = core.BoolPtr(force) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceConsoleAccessTokenOptions) SetHeaders(param map[string]string) *CreateInstanceConsoleAccessTokenOptions { + options.Headers = param + return options +} + +// CreateInstanceGroupManagerActionOptions : The CreateInstanceGroupManagerAction options. +type CreateInstanceGroupManagerActionOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager action prototype object. + InstanceGroupManagerActionPrototype InstanceGroupManagerActionPrototypeIntf `json:"InstanceGroupManagerActionPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceGroupManagerActionOptions : Instantiate CreateInstanceGroupManagerActionOptions +func (*VpcV1) NewCreateInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, instanceGroupManagerActionPrototype InstanceGroupManagerActionPrototypeIntf) *CreateInstanceGroupManagerActionOptions { + return &CreateInstanceGroupManagerActionOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + InstanceGroupManagerActionPrototype: instanceGroupManagerActionPrototype, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *CreateInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *CreateInstanceGroupManagerActionOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *CreateInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *CreateInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetInstanceGroupManagerActionPrototype : Allow user to set InstanceGroupManagerActionPrototype +func (_options *CreateInstanceGroupManagerActionOptions) SetInstanceGroupManagerActionPrototype(instanceGroupManagerActionPrototype InstanceGroupManagerActionPrototypeIntf) *CreateInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *CreateInstanceGroupManagerActionOptions { + options.Headers = param + return options +} + +// CreateInstanceGroupManagerOptions : The CreateInstanceGroupManager options. +type CreateInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager prototype object. + InstanceGroupManagerPrototype InstanceGroupManagerPrototypeIntf `json:"InstanceGroupManagerPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceGroupManagerOptions : Instantiate CreateInstanceGroupManagerOptions +func (*VpcV1) NewCreateInstanceGroupManagerOptions(instanceGroupID string, instanceGroupManagerPrototype InstanceGroupManagerPrototypeIntf) *CreateInstanceGroupManagerOptions { + return &CreateInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerPrototype: instanceGroupManagerPrototype, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *CreateInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *CreateInstanceGroupManagerOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerPrototype : Allow user to set InstanceGroupManagerPrototype +func (_options *CreateInstanceGroupManagerOptions) SetInstanceGroupManagerPrototype(instanceGroupManagerPrototype InstanceGroupManagerPrototypeIntf) *CreateInstanceGroupManagerOptions { + _options.InstanceGroupManagerPrototype = instanceGroupManagerPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceGroupManagerOptions) SetHeaders(param map[string]string) *CreateInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// CreateInstanceGroupManagerPolicyOptions : The CreateInstanceGroupManagerPolicy options. +type CreateInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager policy prototype object. + InstanceGroupManagerPolicyPrototype InstanceGroupManagerPolicyPrototypeIntf `json:"InstanceGroupManagerPolicyPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceGroupManagerPolicyOptions : Instantiate CreateInstanceGroupManagerPolicyOptions +func (*VpcV1) NewCreateInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, instanceGroupManagerPolicyPrototype InstanceGroupManagerPolicyPrototypeIntf) *CreateInstanceGroupManagerPolicyOptions { + return &CreateInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + InstanceGroupManagerPolicyPrototype: instanceGroupManagerPolicyPrototype, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *CreateInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *CreateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *CreateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *CreateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetInstanceGroupManagerPolicyPrototype : Allow user to set InstanceGroupManagerPolicyPrototype +func (_options *CreateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerPolicyPrototype(instanceGroupManagerPolicyPrototype InstanceGroupManagerPolicyPrototypeIntf) *CreateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *CreateInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// CreateInstanceGroupOptions : The CreateInstanceGroup options. +type CreateInstanceGroupOptions struct { + // Instance template to use when creating new instances. + // + // Instance groups are not compatible with instance templates that specify `true` for + // `default_trusted_profile.auto_link`. + InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template" validate:"required"` + + // The subnets to use when creating new instances. + Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` + + // Required if specifying a load balancer pool only. Used by the instance group when scaling up instances to supply the + // port for the load balancer pool member. + ApplicationPort *int64 `json:"application_port,omitempty"` + + // The load balancer associated with the specified load balancer pool. + // Required if `load_balancer_pool` is specified. + // + // At present, only load balancers in the `application` family are supported. + LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` + + // If specified, the load balancer pool will be managed by this + // group. Instances created by this group will have a new load + // balancer pool member in that pool created. Must be used with + // `application_port`. + LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"` + + // The number of instances in the instance group. + MembershipCount *int64 `json:"membership_count,omitempty"` + + // The unique user-defined name for this instance group. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceGroupOptions : Instantiate CreateInstanceGroupOptions +func (*VpcV1) NewCreateInstanceGroupOptions(instanceTemplate InstanceTemplateIdentityIntf, subnets []SubnetIdentityIntf) *CreateInstanceGroupOptions { + return &CreateInstanceGroupOptions{ + InstanceTemplate: instanceTemplate, + Subnets: subnets, + } +} + +// SetInstanceTemplate : Allow user to set InstanceTemplate +func (_options *CreateInstanceGroupOptions) SetInstanceTemplate(instanceTemplate InstanceTemplateIdentityIntf) *CreateInstanceGroupOptions { + _options.InstanceTemplate = instanceTemplate + return _options +} + +// SetSubnets : Allow user to set Subnets +func (_options *CreateInstanceGroupOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateInstanceGroupOptions { + _options.Subnets = subnets + return _options +} + +// SetApplicationPort : Allow user to set ApplicationPort +func (_options *CreateInstanceGroupOptions) SetApplicationPort(applicationPort int64) *CreateInstanceGroupOptions { + _options.ApplicationPort = core.Int64Ptr(applicationPort) + return _options +} + +// SetLoadBalancer : Allow user to set LoadBalancer +func (_options *CreateInstanceGroupOptions) SetLoadBalancer(loadBalancer LoadBalancerIdentityIntf) *CreateInstanceGroupOptions { + _options.LoadBalancer = loadBalancer + return _options +} + +// SetLoadBalancerPool : Allow user to set LoadBalancerPool +func (_options *CreateInstanceGroupOptions) SetLoadBalancerPool(loadBalancerPool LoadBalancerPoolIdentityIntf) *CreateInstanceGroupOptions { + _options.LoadBalancerPool = loadBalancerPool + return _options +} + +// SetMembershipCount : Allow user to set MembershipCount +func (_options *CreateInstanceGroupOptions) SetMembershipCount(membershipCount int64) *CreateInstanceGroupOptions { + _options.MembershipCount = core.Int64Ptr(membershipCount) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateInstanceGroupOptions) SetName(name string) *CreateInstanceGroupOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateInstanceGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateInstanceGroupOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceGroupOptions) SetHeaders(param map[string]string) *CreateInstanceGroupOptions { + options.Headers = param + return options +} + +// CreateInstanceNetworkInterfaceOptions : The CreateInstanceNetworkInterface options. +type CreateInstanceNetworkInterfaceOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // 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"` + + // The user-defined name for network interface. Names must be unique within the instance the network interface resides + // in. 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 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 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 network interface. If unspecified, the VPC's default security group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceNetworkInterfaceOptions : Instantiate CreateInstanceNetworkInterfaceOptions +func (*VpcV1) NewCreateInstanceNetworkInterfaceOptions(instanceID string, subnet SubnetIdentityIntf) *CreateInstanceNetworkInterfaceOptions { + return &CreateInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + Subnet: subnet, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *CreateInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *CreateInstanceNetworkInterfaceOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetSubnet : Allow user to set Subnet +func (_options *CreateInstanceNetworkInterfaceOptions) SetSubnet(subnet SubnetIdentityIntf) *CreateInstanceNetworkInterfaceOptions { + _options.Subnet = subnet + return _options +} + +// SetAllowIPSpoofing : Allow user to set AllowIPSpoofing +func (_options *CreateInstanceNetworkInterfaceOptions) SetAllowIPSpoofing(allowIPSpoofing bool) *CreateInstanceNetworkInterfaceOptions { + _options.AllowIPSpoofing = core.BoolPtr(allowIPSpoofing) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateInstanceNetworkInterfaceOptions) SetName(name string) *CreateInstanceNetworkInterfaceOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPrimaryIP : Allow user to set PrimaryIP +func (_options *CreateInstanceNetworkInterfaceOptions) SetPrimaryIP(primaryIP NetworkInterfaceIPPrototypeIntf) *CreateInstanceNetworkInterfaceOptions { + _options.PrimaryIP = primaryIP + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateInstanceNetworkInterfaceOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateInstanceNetworkInterfaceOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// CreateInstanceOptions : The CreateInstance options. +type CreateInstanceOptions struct { + // The instance prototype object. + InstancePrototype InstancePrototypeIntf `json:"InstancePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceOptions : Instantiate CreateInstanceOptions +func (*VpcV1) NewCreateInstanceOptions(instancePrototype InstancePrototypeIntf) *CreateInstanceOptions { + return &CreateInstanceOptions{ + InstancePrototype: instancePrototype, + } +} + +// SetInstancePrototype : Allow user to set InstancePrototype +func (_options *CreateInstanceOptions) SetInstancePrototype(instancePrototype InstancePrototypeIntf) *CreateInstanceOptions { + _options.InstancePrototype = instancePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceOptions) SetHeaders(param map[string]string) *CreateInstanceOptions { + options.Headers = param + return options +} + +// CreateInstanceTemplateOptions : The CreateInstanceTemplate options. +type CreateInstanceTemplateOptions struct { + // The instance template prototype object. + InstanceTemplatePrototype InstanceTemplatePrototypeIntf `json:"InstanceTemplatePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceTemplateOptions : Instantiate CreateInstanceTemplateOptions +func (*VpcV1) NewCreateInstanceTemplateOptions(instanceTemplatePrototype InstanceTemplatePrototypeIntf) *CreateInstanceTemplateOptions { + return &CreateInstanceTemplateOptions{ + InstanceTemplatePrototype: instanceTemplatePrototype, + } +} + +// SetInstanceTemplatePrototype : Allow user to set InstanceTemplatePrototype +func (_options *CreateInstanceTemplateOptions) SetInstanceTemplatePrototype(instanceTemplatePrototype InstanceTemplatePrototypeIntf) *CreateInstanceTemplateOptions { + _options.InstanceTemplatePrototype = instanceTemplatePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceTemplateOptions) SetHeaders(param map[string]string) *CreateInstanceTemplateOptions { + options.Headers = param + return options +} + +// CreateInstanceVolumeAttachmentOptions : The CreateInstanceVolumeAttachment options. +type CreateInstanceVolumeAttachmentOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // An existing volume to attach to the instance, or a prototype object for a new volume. + Volume VolumeAttachmentPrototypeVolumeIntf `json:"volume" validate:"required"` + + // If set to true, when deleting the instance the volume will also be deleted. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The user-defined name for this volume attachment. Names must be unique within the instance the volume attachment + // resides in. 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 +} + +// NewCreateInstanceVolumeAttachmentOptions : Instantiate CreateInstanceVolumeAttachmentOptions +func (*VpcV1) NewCreateInstanceVolumeAttachmentOptions(instanceID string, volume VolumeAttachmentPrototypeVolumeIntf) *CreateInstanceVolumeAttachmentOptions { + return &CreateInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + Volume: volume, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *CreateInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *CreateInstanceVolumeAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetVolume : Allow user to set Volume +func (_options *CreateInstanceVolumeAttachmentOptions) SetVolume(volume VolumeAttachmentPrototypeVolumeIntf) *CreateInstanceVolumeAttachmentOptions { + _options.Volume = volume + return _options +} + +// SetDeleteVolumeOnInstanceDelete : Allow user to set DeleteVolumeOnInstanceDelete +func (_options *CreateInstanceVolumeAttachmentOptions) SetDeleteVolumeOnInstanceDelete(deleteVolumeOnInstanceDelete bool) *CreateInstanceVolumeAttachmentOptions { + _options.DeleteVolumeOnInstanceDelete = core.BoolPtr(deleteVolumeOnInstanceDelete) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateInstanceVolumeAttachmentOptions) SetName(name string) *CreateInstanceVolumeAttachmentOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *CreateInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// CreateIpsecPolicyOptions : The CreateIpsecPolicy options. +type CreateIpsecPolicyOptions struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` + + // The encryption algorithm. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // Perfect Forward Secrecy. + Pfs *string `json:"pfs" validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime,omitempty"` + + // The user-defined name for this IPsec policy. + 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateIpsecPolicyOptions.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + CreateIpsecPolicyOptionsAuthenticationAlgorithmMd5Const = "md5" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha1Const = "sha1" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the CreateIpsecPolicyOptions.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + CreateIpsecPolicyOptionsEncryptionAlgorithmAes128Const = "aes128" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes256Const = "aes256" + CreateIpsecPolicyOptionsEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// Constants associated with the CreateIpsecPolicyOptions.Pfs property. +// Perfect Forward Secrecy. +const ( + CreateIpsecPolicyOptionsPfsDisabledConst = "disabled" + CreateIpsecPolicyOptionsPfsGroup14Const = "group_14" + CreateIpsecPolicyOptionsPfsGroup19Const = "group_19" + CreateIpsecPolicyOptionsPfsGroup2Const = "group_2" + CreateIpsecPolicyOptionsPfsGroup5Const = "group_5" +) + +// NewCreateIpsecPolicyOptions : Instantiate CreateIpsecPolicyOptions +func (*VpcV1) NewCreateIpsecPolicyOptions(authenticationAlgorithm string, encryptionAlgorithm string, pfs string) *CreateIpsecPolicyOptions { + return &CreateIpsecPolicyOptions{ + AuthenticationAlgorithm: core.StringPtr(authenticationAlgorithm), + EncryptionAlgorithm: core.StringPtr(encryptionAlgorithm), + Pfs: core.StringPtr(pfs), + } +} + +// SetAuthenticationAlgorithm : Allow user to set AuthenticationAlgorithm +func (_options *CreateIpsecPolicyOptions) SetAuthenticationAlgorithm(authenticationAlgorithm string) *CreateIpsecPolicyOptions { + _options.AuthenticationAlgorithm = core.StringPtr(authenticationAlgorithm) + return _options +} + +// SetEncryptionAlgorithm : Allow user to set EncryptionAlgorithm +func (_options *CreateIpsecPolicyOptions) SetEncryptionAlgorithm(encryptionAlgorithm string) *CreateIpsecPolicyOptions { + _options.EncryptionAlgorithm = core.StringPtr(encryptionAlgorithm) + return _options +} + +// SetPfs : Allow user to set Pfs +func (_options *CreateIpsecPolicyOptions) SetPfs(pfs string) *CreateIpsecPolicyOptions { + _options.Pfs = core.StringPtr(pfs) + return _options +} + +// SetKeyLifetime : Allow user to set KeyLifetime +func (_options *CreateIpsecPolicyOptions) SetKeyLifetime(keyLifetime int64) *CreateIpsecPolicyOptions { + _options.KeyLifetime = core.Int64Ptr(keyLifetime) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateIpsecPolicyOptions) SetName(name string) *CreateIpsecPolicyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateIpsecPolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateIpsecPolicyOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateIpsecPolicyOptions) SetHeaders(param map[string]string) *CreateIpsecPolicyOptions { + options.Headers = param + return options +} + +// CreateKeyOptions : The CreateKey options. +type CreateKeyOptions struct { + // A unique public SSH key to import, in OpenSSH format (consisting of three space-separated fields: the algorithm + // name, base64-encoded key, and a comment). The algorithm and comment fields may be omitted, as only the key field is + // imported. + PublicKey *string `json:"public_key" validate:"required"` + + // The unique user-defined name for this key. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The crypto-system used by this key. + Type *string `json:"type,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateKeyOptions.Type property. +// The crypto-system used by this key. +const ( + CreateKeyOptionsTypeRsaConst = "rsa" +) + +// NewCreateKeyOptions : Instantiate CreateKeyOptions +func (*VpcV1) NewCreateKeyOptions(publicKey string) *CreateKeyOptions { + return &CreateKeyOptions{ + PublicKey: core.StringPtr(publicKey), + } +} + +// SetPublicKey : Allow user to set PublicKey +func (_options *CreateKeyOptions) SetPublicKey(publicKey string) *CreateKeyOptions { + _options.PublicKey = core.StringPtr(publicKey) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateKeyOptions) SetName(name string) *CreateKeyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateKeyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateKeyOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetType : Allow user to set Type +func (_options *CreateKeyOptions) SetType(typeVar string) *CreateKeyOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateKeyOptions) SetHeaders(param map[string]string) *CreateKeyOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerListenerOptions : The CreateLoadBalancerListener options. +type CreateLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. + // + // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http` and + // `https`. + // + // Additional restrictions: + // - If `default_pool` is set, the pool's protocol must match, or be compatible with + // the listener's protocol. At present, the compatible protocols are `http` and + // `https`. + // - If `https_redirect` is set, the protocol must be `http`. + Protocol *string `json:"protocol" validate:"required"` + + // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in + // the `application` family (otherwise always `false`). Additional restrictions: + // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must + // match the `accept_proxy_protocol` value of the `https_redirect` listener. + // - If this listener is the target of another listener's `https_redirect`, its + // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. + AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` + + // The certificate instance used for SSL termination. It is applicable only to `https` + // protocol. + CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` + + // The connection limit of the listener. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` + + // The default pool for this listener. The specified pool must: + // + // - Belong to this load balancer + // - Have the same `protocol` as this listener, or have a compatible protocol. + // At present, the compatible protocols are `http` and `https`. + // - Not already be the `default_pool` for another listener. + DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` + + // The target listener that requests will be redirected to. This listener must have a + // `protocol` of `http`, and the target listener must have a `protocol` of `https`. + HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPrototype `json:"https_redirect,omitempty"` + + // The policy prototype objects for this listener. + Policies []LoadBalancerListenerPolicyPrototype `json:"policies,omitempty"` + + // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must + // have a unique `port` and `protocol` combination. + // + // Not supported for load balancers operating with route mode enabled. + Port *int64 `json:"port,omitempty"` + + // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `65535` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `1` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMin *int64 `json:"port_min,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerListenerOptions.Protocol property. +// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. +// +// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http` and +// `https`. +// +// Additional restrictions: +// - If `default_pool` is set, the pool's protocol must match, or be compatible with +// the listener's protocol. At present, the compatible protocols are `http` and +// `https`. +// - If `https_redirect` is set, the protocol must be `http`. +const ( + CreateLoadBalancerListenerOptionsProtocolHTTPConst = "http" + CreateLoadBalancerListenerOptionsProtocolHTTPSConst = "https" + CreateLoadBalancerListenerOptionsProtocolTCPConst = "tcp" + CreateLoadBalancerListenerOptionsProtocolUDPConst = "udp" +) + +// NewCreateLoadBalancerListenerOptions : Instantiate CreateLoadBalancerListenerOptions +func (*VpcV1) NewCreateLoadBalancerListenerOptions(loadBalancerID string, protocol string) *CreateLoadBalancerListenerOptions { + return &CreateLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + Protocol: core.StringPtr(protocol), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetProtocol : Allow user to set Protocol +func (_options *CreateLoadBalancerListenerOptions) SetProtocol(protocol string) *CreateLoadBalancerListenerOptions { + _options.Protocol = core.StringPtr(protocol) + return _options +} + +// SetAcceptProxyProtocol : Allow user to set AcceptProxyProtocol +func (_options *CreateLoadBalancerListenerOptions) SetAcceptProxyProtocol(acceptProxyProtocol bool) *CreateLoadBalancerListenerOptions { + _options.AcceptProxyProtocol = core.BoolPtr(acceptProxyProtocol) + return _options +} + +// SetCertificateInstance : Allow user to set CertificateInstance +func (_options *CreateLoadBalancerListenerOptions) SetCertificateInstance(certificateInstance CertificateInstanceIdentityIntf) *CreateLoadBalancerListenerOptions { + _options.CertificateInstance = certificateInstance + return _options +} + +// SetConnectionLimit : Allow user to set ConnectionLimit +func (_options *CreateLoadBalancerListenerOptions) SetConnectionLimit(connectionLimit int64) *CreateLoadBalancerListenerOptions { + _options.ConnectionLimit = core.Int64Ptr(connectionLimit) + return _options +} + +// SetDefaultPool : Allow user to set DefaultPool +func (_options *CreateLoadBalancerListenerOptions) SetDefaultPool(defaultPool LoadBalancerPoolIdentityIntf) *CreateLoadBalancerListenerOptions { + _options.DefaultPool = defaultPool + return _options +} + +// SetHTTPSRedirect : Allow user to set HTTPSRedirect +func (_options *CreateLoadBalancerListenerOptions) SetHTTPSRedirect(httpsRedirect *LoadBalancerListenerHTTPSRedirectPrototype) *CreateLoadBalancerListenerOptions { + _options.HTTPSRedirect = httpsRedirect + return _options +} + +// SetPolicies : Allow user to set Policies +func (_options *CreateLoadBalancerListenerOptions) SetPolicies(policies []LoadBalancerListenerPolicyPrototype) *CreateLoadBalancerListenerOptions { + _options.Policies = policies + return _options +} + +// SetPort : Allow user to set Port +func (_options *CreateLoadBalancerListenerOptions) SetPort(port int64) *CreateLoadBalancerListenerOptions { + _options.Port = core.Int64Ptr(port) + return _options +} + +// SetPortMax : Allow user to set PortMax +func (_options *CreateLoadBalancerListenerOptions) SetPortMax(portMax int64) *CreateLoadBalancerListenerOptions { + _options.PortMax = core.Int64Ptr(portMax) + return _options +} + +// SetPortMin : Allow user to set PortMin +func (_options *CreateLoadBalancerListenerOptions) SetPortMin(portMin int64) *CreateLoadBalancerListenerOptions { + _options.PortMin = core.Int64Ptr(portMin) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerListenerOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerListenerPolicyOptions : The CreateLoadBalancerListenerPolicy options. +type CreateLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy action. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the + // unexpected property value was encountered. + Action *string `json:"action" validate:"required"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority" validate:"required"` + + // The user-defined name for this policy. Names must be unique within the load balancer listener the policy resides in. + Name *string `json:"name,omitempty"` + + // The rule prototype objects for this policy. + Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` + + // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. + // - If `action` is `https_redirect`, specify a + // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerListenerPolicyOptions.Action property. +// The policy action. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the +// unexpected property value was encountered. +const ( + CreateLoadBalancerListenerPolicyOptionsActionForwardConst = "forward" + CreateLoadBalancerListenerPolicyOptionsActionHTTPSRedirectConst = "https_redirect" + CreateLoadBalancerListenerPolicyOptionsActionRedirectConst = "redirect" + CreateLoadBalancerListenerPolicyOptionsActionRejectConst = "reject" +) + +// NewCreateLoadBalancerListenerPolicyOptions : Instantiate CreateLoadBalancerListenerPolicyOptions +func (*VpcV1) NewCreateLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, action string, priority int64) *CreateLoadBalancerListenerPolicyOptions { + return &CreateLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + Action: core.StringPtr(action), + Priority: core.Int64Ptr(priority), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerPolicyOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *CreateLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *CreateLoadBalancerListenerPolicyOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetAction : Allow user to set Action +func (_options *CreateLoadBalancerListenerPolicyOptions) SetAction(action string) *CreateLoadBalancerListenerPolicyOptions { + _options.Action = core.StringPtr(action) + return _options +} + +// SetPriority : Allow user to set Priority +func (_options *CreateLoadBalancerListenerPolicyOptions) SetPriority(priority int64) *CreateLoadBalancerListenerPolicyOptions { + _options.Priority = core.Int64Ptr(priority) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateLoadBalancerListenerPolicyOptions) SetName(name string) *CreateLoadBalancerListenerPolicyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetRules : Allow user to set Rules +func (_options *CreateLoadBalancerListenerPolicyOptions) SetRules(rules []LoadBalancerListenerPolicyRulePrototype) *CreateLoadBalancerListenerPolicyOptions { + _options.Rules = rules + return _options +} + +// SetTarget : Allow user to set Target +func (_options *CreateLoadBalancerListenerPolicyOptions) SetTarget(target LoadBalancerListenerPolicyTargetPrototypeIntf) *CreateLoadBalancerListenerPolicyOptions { + _options.Target = target + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerListenerPolicyRuleOptions : The CreateLoadBalancerListenerPolicyRule options. +type CreateLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // The condition of the rule. + Condition *string `json:"condition" validate:"required"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type" validate:"required"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value" validate:"required"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this property is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Condition property. +// The condition of the rule. +const ( + CreateLoadBalancerListenerPolicyRuleOptionsConditionContainsConst = "contains" + CreateLoadBalancerListenerPolicyRuleOptionsConditionEqualsConst = "equals" + CreateLoadBalancerListenerPolicyRuleOptionsConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + CreateLoadBalancerListenerPolicyRuleOptionsTypeBodyConst = "body" + CreateLoadBalancerListenerPolicyRuleOptionsTypeHeaderConst = "header" + CreateLoadBalancerListenerPolicyRuleOptionsTypeHostnameConst = "hostname" + CreateLoadBalancerListenerPolicyRuleOptionsTypePathConst = "path" + CreateLoadBalancerListenerPolicyRuleOptionsTypeQueryConst = "query" +) + +// NewCreateLoadBalancerListenerPolicyRuleOptions : Instantiate CreateLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewCreateLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, condition string, typeVar string, value string) *CreateLoadBalancerListenerPolicyRuleOptions { + return &CreateLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + Condition: core.StringPtr(condition), + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetCondition : Allow user to set Condition +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetCondition(condition string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.Condition = core.StringPtr(condition) + return _options +} + +// SetType : Allow user to set Type +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetType(typeVar string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetValue : Allow user to set Value +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetValue(value string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.Value = core.StringPtr(value) + return _options +} + +// SetField : Allow user to set Field +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetField(field string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.Field = core.StringPtr(field) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerOptions : The CreateLoadBalancer options. +type CreateLoadBalancerOptions struct { + // Indicates whether this load balancer is public. + // + // At present, if route mode is enabled, the load balancer must not be public. + IsPublic *bool `json:"is_public" validate:"required"` + + // The subnets to provision this load balancer in. The load balancer's availability will depend on the availability of + // the zones the specified subnets reside in. + // + // Load balancers in the `network` family allow only one subnet to be specified. + Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` + + // The listeners of this load balancer. + Listeners []LoadBalancerListenerPrototypeLoadBalancerContext `json:"listeners,omitempty"` + + // The logging configuration to use for this load balancer. See [VPC Datapath + // Logging](https://cloud.ibm.com/docs/vpc?topic=vpc-datapath-logging) on the logging + // format, fields and permitted values. + // + // To activate logging, the load balancer profile must support the specified logging type. + Logging *LoadBalancerLogging `json:"logging,omitempty"` + + // The user-defined name for this load balancer. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The pools of this load balancer. + Pools []LoadBalancerPoolPrototype `json:"pools,omitempty"` + + // The profile to use for this load balancer. + // + // If unspecified, `application` will be used. + Profile LoadBalancerProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Indicates whether route mode is enabled for this load balancer. + // + // At present, public load balancers are not supported with route mode enabled. + RouteMode *bool `json:"route_mode,omitempty"` + + // The security groups to use for this load balancer. If unspecified, the VPC's default security group is used. + // + // The load balancer profile must support security groups. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateLoadBalancerOptions : Instantiate CreateLoadBalancerOptions +func (*VpcV1) NewCreateLoadBalancerOptions(isPublic bool, subnets []SubnetIdentityIntf) *CreateLoadBalancerOptions { + return &CreateLoadBalancerOptions{ + IsPublic: core.BoolPtr(isPublic), + Subnets: subnets, + } +} + +// SetIsPublic : Allow user to set IsPublic +func (_options *CreateLoadBalancerOptions) SetIsPublic(isPublic bool) *CreateLoadBalancerOptions { + _options.IsPublic = core.BoolPtr(isPublic) + return _options +} + +// SetSubnets : Allow user to set Subnets +func (_options *CreateLoadBalancerOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateLoadBalancerOptions { + _options.Subnets = subnets + return _options +} + +// SetListeners : Allow user to set Listeners +func (_options *CreateLoadBalancerOptions) SetListeners(listeners []LoadBalancerListenerPrototypeLoadBalancerContext) *CreateLoadBalancerOptions { + _options.Listeners = listeners + return _options +} + +// SetLogging : Allow user to set Logging +func (_options *CreateLoadBalancerOptions) SetLogging(logging *LoadBalancerLogging) *CreateLoadBalancerOptions { + _options.Logging = logging + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateLoadBalancerOptions) SetName(name string) *CreateLoadBalancerOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPools : Allow user to set Pools +func (_options *CreateLoadBalancerOptions) SetPools(pools []LoadBalancerPoolPrototype) *CreateLoadBalancerOptions { + _options.Pools = pools + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *CreateLoadBalancerOptions) SetProfile(profile LoadBalancerProfileIdentityIntf) *CreateLoadBalancerOptions { + _options.Profile = profile + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateLoadBalancerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateLoadBalancerOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetRouteMode : Allow user to set RouteMode +func (_options *CreateLoadBalancerOptions) SetRouteMode(routeMode bool) *CreateLoadBalancerOptions { + _options.RouteMode = core.BoolPtr(routeMode) + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateLoadBalancerOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateLoadBalancerOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerOptions) SetHeaders(param map[string]string) *CreateLoadBalancerOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerPoolMemberOptions : The CreateLoadBalancerPoolMember options. +type CreateLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a + // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive + // the traffic on the same port the listener received it on.) + // + // This port will also be used for health checks unless the `port` property of + // `health_monitor` property is specified. + // + // The port must be unique across all members for all pools associated with this pool's listener. + Port *int64 `json:"port" validate:"required"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. + Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateLoadBalancerPoolMemberOptions : Instantiate CreateLoadBalancerPoolMemberOptions +func (*VpcV1) NewCreateLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, port int64, target LoadBalancerPoolMemberTargetPrototypeIntf) *CreateLoadBalancerPoolMemberOptions { + return &CreateLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + Port: core.Int64Ptr(port), + Target: target, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerPoolMemberOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *CreateLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *CreateLoadBalancerPoolMemberOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetPort : Allow user to set Port +func (_options *CreateLoadBalancerPoolMemberOptions) SetPort(port int64) *CreateLoadBalancerPoolMemberOptions { + _options.Port = core.Int64Ptr(port) + return _options +} + +// SetTarget : Allow user to set Target +func (_options *CreateLoadBalancerPoolMemberOptions) SetTarget(target LoadBalancerPoolMemberTargetPrototypeIntf) *CreateLoadBalancerPoolMemberOptions { + _options.Target = target + return _options +} + +// SetWeight : Allow user to set Weight +func (_options *CreateLoadBalancerPoolMemberOptions) SetWeight(weight int64) *CreateLoadBalancerPoolMemberOptions { + _options.Weight = core.Int64Ptr(weight) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *CreateLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerPoolOptions : The CreateLoadBalancerPool options. +type CreateLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The load balancing algorithm. + Algorithm *string `json:"algorithm" validate:"required"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitorPrototype `json:"health_monitor" validate:"required"` + + // The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if + // `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http`, and `https`. + Protocol *string `json:"protocol" validate:"required"` + + // The members for this load balancer pool. For load balancers in the `network` family, the same `port` and `target` + // tuple cannot be shared by a pool member of any other load balancer in the same VPC. + Members []LoadBalancerPoolMemberPrototype `json:"members,omitempty"` + + // The user-defined name for this load balancer pool. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol,omitempty"` + + // The session persistence of this pool. + SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerPoolOptions.Algorithm property. +// The load balancing algorithm. +const ( + CreateLoadBalancerPoolOptionsAlgorithmLeastConnectionsConst = "least_connections" + CreateLoadBalancerPoolOptionsAlgorithmRoundRobinConst = "round_robin" + CreateLoadBalancerPoolOptionsAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the CreateLoadBalancerPoolOptions.Protocol property. +// The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if +// `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http`, and `https`. +const ( + CreateLoadBalancerPoolOptionsProtocolHTTPConst = "http" + CreateLoadBalancerPoolOptionsProtocolHTTPSConst = "https" + CreateLoadBalancerPoolOptionsProtocolTCPConst = "tcp" + CreateLoadBalancerPoolOptionsProtocolUDPConst = "udp" +) + +// Constants associated with the CreateLoadBalancerPoolOptions.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + CreateLoadBalancerPoolOptionsProxyProtocolDisabledConst = "disabled" + CreateLoadBalancerPoolOptionsProxyProtocolV1Const = "v1" + CreateLoadBalancerPoolOptionsProxyProtocolV2Const = "v2" +) + +// NewCreateLoadBalancerPoolOptions : Instantiate CreateLoadBalancerPoolOptions +func (*VpcV1) NewCreateLoadBalancerPoolOptions(loadBalancerID string, algorithm string, healthMonitor *LoadBalancerPoolHealthMonitorPrototype, protocol string) *CreateLoadBalancerPoolOptions { + return &CreateLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + Algorithm: core.StringPtr(algorithm), + HealthMonitor: healthMonitor, + Protocol: core.StringPtr(protocol), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerPoolOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetAlgorithm : Allow user to set Algorithm +func (_options *CreateLoadBalancerPoolOptions) SetAlgorithm(algorithm string) *CreateLoadBalancerPoolOptions { + _options.Algorithm = core.StringPtr(algorithm) + return _options +} + +// SetHealthMonitor : Allow user to set HealthMonitor +func (_options *CreateLoadBalancerPoolOptions) SetHealthMonitor(healthMonitor *LoadBalancerPoolHealthMonitorPrototype) *CreateLoadBalancerPoolOptions { + _options.HealthMonitor = healthMonitor + return _options +} + +// SetProtocol : Allow user to set Protocol +func (_options *CreateLoadBalancerPoolOptions) SetProtocol(protocol string) *CreateLoadBalancerPoolOptions { + _options.Protocol = core.StringPtr(protocol) + return _options +} + +// SetMembers : Allow user to set Members +func (_options *CreateLoadBalancerPoolOptions) SetMembers(members []LoadBalancerPoolMemberPrototype) *CreateLoadBalancerPoolOptions { + _options.Members = members + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateLoadBalancerPoolOptions) SetName(name string) *CreateLoadBalancerPoolOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetProxyProtocol : Allow user to set ProxyProtocol +func (_options *CreateLoadBalancerPoolOptions) SetProxyProtocol(proxyProtocol string) *CreateLoadBalancerPoolOptions { + _options.ProxyProtocol = core.StringPtr(proxyProtocol) + return _options +} + +// SetSessionPersistence : Allow user to set SessionPersistence +func (_options *CreateLoadBalancerPoolOptions) SetSessionPersistence(sessionPersistence *LoadBalancerPoolSessionPersistencePrototype) *CreateLoadBalancerPoolOptions { + _options.SessionPersistence = sessionPersistence + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerPoolOptions) SetHeaders(param map[string]string) *CreateLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// CreateNetworkACLOptions : The CreateNetworkACL options. +type CreateNetworkACLOptions struct { + // The network ACL prototype object. + NetworkACLPrototype NetworkACLPrototypeIntf `json:"NetworkACLPrototype,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateNetworkACLOptions : Instantiate CreateNetworkACLOptions +func (*VpcV1) NewCreateNetworkACLOptions() *CreateNetworkACLOptions { + return &CreateNetworkACLOptions{} +} + +// SetNetworkACLPrototype : Allow user to set NetworkACLPrototype +func (_options *CreateNetworkACLOptions) SetNetworkACLPrototype(networkACLPrototype NetworkACLPrototypeIntf) *CreateNetworkACLOptions { + _options.NetworkACLPrototype = networkACLPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateNetworkACLOptions) SetHeaders(param map[string]string) *CreateNetworkACLOptions { + options.Headers = param + return options +} + +// CreateNetworkACLRuleOptions : The CreateNetworkACLRule options. +type CreateNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` + + // The network ACL rule prototype object. + NetworkACLRulePrototype NetworkACLRulePrototypeIntf `json:"NetworkACLRulePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateNetworkACLRuleOptions : Instantiate CreateNetworkACLRuleOptions +func (*VpcV1) NewCreateNetworkACLRuleOptions(networkACLID string, networkACLRulePrototype NetworkACLRulePrototypeIntf) *CreateNetworkACLRuleOptions { + return &CreateNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + NetworkACLRulePrototype: networkACLRulePrototype, + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *CreateNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *CreateNetworkACLRuleOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetNetworkACLRulePrototype : Allow user to set NetworkACLRulePrototype +func (_options *CreateNetworkACLRuleOptions) SetNetworkACLRulePrototype(networkACLRulePrototype NetworkACLRulePrototypeIntf) *CreateNetworkACLRuleOptions { + _options.NetworkACLRulePrototype = networkACLRulePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateNetworkACLRuleOptions) SetHeaders(param map[string]string) *CreateNetworkACLRuleOptions { + options.Headers = param + return options +} + +// CreatePlacementGroupOptions : The CreatePlacementGroup options. +type CreatePlacementGroupOptions struct { + // The strategy for this placement group + // - `host_spread`: place on different compute hosts + // - `power_spread`: place on compute hosts that use different power sources + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the + // unexpected strategy was encountered. + Strategy *string `json:"strategy" validate:"required"` + + // The unique user-defined name for this placement group. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreatePlacementGroupOptions.Strategy property. +// The strategy for this placement group +// - `host_spread`: place on different compute hosts +// - `power_spread`: place on compute hosts that use different power sources +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the +// unexpected strategy was encountered. +const ( + CreatePlacementGroupOptionsStrategyHostSpreadConst = "host_spread" + CreatePlacementGroupOptionsStrategyPowerSpreadConst = "power_spread" +) + +// NewCreatePlacementGroupOptions : Instantiate CreatePlacementGroupOptions +func (*VpcV1) NewCreatePlacementGroupOptions(strategy string) *CreatePlacementGroupOptions { + return &CreatePlacementGroupOptions{ + Strategy: core.StringPtr(strategy), + } +} + +// SetStrategy : Allow user to set Strategy +func (_options *CreatePlacementGroupOptions) SetStrategy(strategy string) *CreatePlacementGroupOptions { + _options.Strategy = core.StringPtr(strategy) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreatePlacementGroupOptions) SetName(name string) *CreatePlacementGroupOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreatePlacementGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePlacementGroupOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreatePlacementGroupOptions) SetHeaders(param map[string]string) *CreatePlacementGroupOptions { + options.Headers = param + return options +} + +// CreatePublicGatewayOptions : The CreatePublicGateway options. +type CreatePublicGatewayOptions struct { + // The VPC this public gateway will serve. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The zone this public gateway will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + FloatingIP PublicGatewayFloatingIPPrototypeIntf `json:"floating_ip,omitempty"` + + // The user-defined name for this public gateway. Names must be unique within the VPC the public gateway resides in. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreatePublicGatewayOptions : Instantiate CreatePublicGatewayOptions +func (*VpcV1) NewCreatePublicGatewayOptions(vpc VPCIdentityIntf, zone ZoneIdentityIntf) *CreatePublicGatewayOptions { + return &CreatePublicGatewayOptions{ + VPC: vpc, + Zone: zone, + } +} + +// SetVPC : Allow user to set VPC +func (_options *CreatePublicGatewayOptions) SetVPC(vpc VPCIdentityIntf) *CreatePublicGatewayOptions { + _options.VPC = vpc + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreatePublicGatewayOptions) SetZone(zone ZoneIdentityIntf) *CreatePublicGatewayOptions { + _options.Zone = zone + return _options +} + +// SetFloatingIP : Allow user to set FloatingIP +func (_options *CreatePublicGatewayOptions) SetFloatingIP(floatingIP PublicGatewayFloatingIPPrototypeIntf) *CreatePublicGatewayOptions { + _options.FloatingIP = floatingIP + return _options +} + +// SetName : Allow user to set Name +func (_options *CreatePublicGatewayOptions) SetName(name string) *CreatePublicGatewayOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreatePublicGatewayOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePublicGatewayOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreatePublicGatewayOptions) SetHeaders(param map[string]string) *CreatePublicGatewayOptions { + options.Headers = param + return options +} + +// CreateSecurityGroupOptions : The CreateSecurityGroup options. +type CreateSecurityGroupOptions struct { + // The VPC this security group is to be a part of. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The user-defined name for this security group. If unspecified, the name will be a hyphenated list of + // randomly-selected words. Names must be unique within the VPC the security group resides in. + 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The prototype objects for rules to be created for this security group. If unspecified, no rules will be created, + // resulting in all traffic being denied. + Rules []SecurityGroupRulePrototypeIntf `json:"rules,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSecurityGroupOptions : Instantiate CreateSecurityGroupOptions +func (*VpcV1) NewCreateSecurityGroupOptions(vpc VPCIdentityIntf) *CreateSecurityGroupOptions { + return &CreateSecurityGroupOptions{ + VPC: vpc, + } +} + +// SetVPC : Allow user to set VPC +func (_options *CreateSecurityGroupOptions) SetVPC(vpc VPCIdentityIntf) *CreateSecurityGroupOptions { + _options.VPC = vpc + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateSecurityGroupOptions) SetName(name string) *CreateSecurityGroupOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateSecurityGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateSecurityGroupOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetRules : Allow user to set Rules +func (_options *CreateSecurityGroupOptions) SetRules(rules []SecurityGroupRulePrototypeIntf) *CreateSecurityGroupOptions { + _options.Rules = rules + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSecurityGroupOptions) SetHeaders(param map[string]string) *CreateSecurityGroupOptions { + options.Headers = param + return options +} + +// CreateSecurityGroupRuleOptions : The CreateSecurityGroupRule options. +type CreateSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The properties of the security group rule to be created. + SecurityGroupRulePrototype SecurityGroupRulePrototypeIntf `json:"SecurityGroupRulePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSecurityGroupRuleOptions : Instantiate CreateSecurityGroupRuleOptions +func (*VpcV1) NewCreateSecurityGroupRuleOptions(securityGroupID string, securityGroupRulePrototype SecurityGroupRulePrototypeIntf) *CreateSecurityGroupRuleOptions { + return &CreateSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + SecurityGroupRulePrototype: securityGroupRulePrototype, + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *CreateSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *CreateSecurityGroupRuleOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetSecurityGroupRulePrototype : Allow user to set SecurityGroupRulePrototype +func (_options *CreateSecurityGroupRuleOptions) SetSecurityGroupRulePrototype(securityGroupRulePrototype SecurityGroupRulePrototypeIntf) *CreateSecurityGroupRuleOptions { + _options.SecurityGroupRulePrototype = securityGroupRulePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSecurityGroupRuleOptions) SetHeaders(param map[string]string) *CreateSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// CreateSecurityGroupTargetBindingOptions : The CreateSecurityGroupTargetBinding options. +type CreateSecurityGroupTargetBindingOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The security group target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSecurityGroupTargetBindingOptions : Instantiate CreateSecurityGroupTargetBindingOptions +func (*VpcV1) NewCreateSecurityGroupTargetBindingOptions(securityGroupID string, id string) *CreateSecurityGroupTargetBindingOptions { + return &CreateSecurityGroupTargetBindingOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *CreateSecurityGroupTargetBindingOptions) SetSecurityGroupID(securityGroupID string) *CreateSecurityGroupTargetBindingOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *CreateSecurityGroupTargetBindingOptions) SetID(id string) *CreateSecurityGroupTargetBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSecurityGroupTargetBindingOptions) SetHeaders(param map[string]string) *CreateSecurityGroupTargetBindingOptions { + options.Headers = param + return options +} + +// CreateSnapshotOptions : The CreateSnapshot options. +type CreateSnapshotOptions struct { + // The snapshot prototype object. + SnapshotPrototype SnapshotPrototypeIntf `json:"SnapshotPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSnapshotOptions : Instantiate CreateSnapshotOptions +func (*VpcV1) NewCreateSnapshotOptions(snapshotPrototype SnapshotPrototypeIntf) *CreateSnapshotOptions { + return &CreateSnapshotOptions{ + SnapshotPrototype: snapshotPrototype, + } +} + +// SetSnapshotPrototype : Allow user to set SnapshotPrototype +func (_options *CreateSnapshotOptions) SetSnapshotPrototype(snapshotPrototype SnapshotPrototypeIntf) *CreateSnapshotOptions { + _options.SnapshotPrototype = snapshotPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSnapshotOptions) SetHeaders(param map[string]string) *CreateSnapshotOptions { + options.Headers = param + return options +} + +// CreateSubnetOptions : The CreateSubnet options. +type CreateSubnetOptions struct { + // The subnet prototype object. + SubnetPrototype SubnetPrototypeIntf `json:"SubnetPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSubnetOptions : Instantiate CreateSubnetOptions +func (*VpcV1) NewCreateSubnetOptions(subnetPrototype SubnetPrototypeIntf) *CreateSubnetOptions { + return &CreateSubnetOptions{ + SubnetPrototype: subnetPrototype, + } +} + +// SetSubnetPrototype : Allow user to set SubnetPrototype +func (_options *CreateSubnetOptions) SetSubnetPrototype(subnetPrototype SubnetPrototypeIntf) *CreateSubnetOptions { + _options.SubnetPrototype = subnetPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSubnetOptions) SetHeaders(param map[string]string) *CreateSubnetOptions { + options.Headers = param + return options +} + +// CreateSubnetReservedIPOptions : The CreateSubnetReservedIP options. +type CreateSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `json:"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"` + + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The user-defined name for this reserved IP. If unspecified, the name will be a hyphenated list of randomly-selected + // words. Names must be unique within the subnet the reserved IP resides in. Names beginning with `ibm-` are reserved + // for provider-owned resources. + Name *string `json:"name,omitempty"` + + // The target this reserved IP is to be bound to. The target must be an endpoint gateway not + // already bound to a reserved IP in the subnet's zone. + Target ReservedIPTargetPrototypeIntf `json:"target,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSubnetReservedIPOptions : Instantiate CreateSubnetReservedIPOptions +func (*VpcV1) NewCreateSubnetReservedIPOptions(subnetID string) *CreateSubnetReservedIPOptions { + return &CreateSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + } +} + +// SetSubnetID : Allow user to set SubnetID +func (_options *CreateSubnetReservedIPOptions) SetSubnetID(subnetID string) *CreateSubnetReservedIPOptions { + _options.SubnetID = core.StringPtr(subnetID) + return _options +} + +// SetAddress : Allow user to set Address +func (_options *CreateSubnetReservedIPOptions) SetAddress(address string) *CreateSubnetReservedIPOptions { + _options.Address = core.StringPtr(address) + return _options +} + +// SetAutoDelete : Allow user to set AutoDelete +func (_options *CreateSubnetReservedIPOptions) SetAutoDelete(autoDelete bool) *CreateSubnetReservedIPOptions { + _options.AutoDelete = core.BoolPtr(autoDelete) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateSubnetReservedIPOptions) SetName(name string) *CreateSubnetReservedIPOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetTarget : Allow user to set Target +func (_options *CreateSubnetReservedIPOptions) SetTarget(target ReservedIPTargetPrototypeIntf) *CreateSubnetReservedIPOptions { + _options.Target = target + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSubnetReservedIPOptions) SetHeaders(param map[string]string) *CreateSubnetReservedIPOptions { + options.Headers = param + return options +} + +// CreateVolumeOptions : The CreateVolume options. +type CreateVolumeOptions struct { + // The volume prototype object. + VolumePrototype VolumePrototypeIntf `json:"VolumePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVolumeOptions : Instantiate CreateVolumeOptions +func (*VpcV1) NewCreateVolumeOptions(volumePrototype VolumePrototypeIntf) *CreateVolumeOptions { + return &CreateVolumeOptions{ + VolumePrototype: volumePrototype, + } +} + +// SetVolumePrototype : Allow user to set VolumePrototype +func (_options *CreateVolumeOptions) SetVolumePrototype(volumePrototype VolumePrototypeIntf) *CreateVolumeOptions { + _options.VolumePrototype = volumePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVolumeOptions) SetHeaders(param map[string]string) *CreateVolumeOptions { + options.Headers = param + return options +} + +// CreateVPCAddressPrefixOptions : The CreateVPCAddressPrefix options. +type CreateVPCAddressPrefixOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The IPv4 range of the address prefix, expressed in CIDR format. The request must not overlap with any existing + // address prefixes in the VPC or any of the following reserved address ranges: + // - `127.0.0.0/8` (IPv4 loopback addresses) + // - `161.26.0.0/16` (IBM services) + // - `166.8.0.0/14` (Cloud Service Endpoints) + // - `169.254.0.0/16` (IPv4 link-local addresses) + // - `224.0.0.0/4` (IPv4 multicast addresses) + // + // The prefix length of the address prefix's CIDR must be between `/9` (8,388,608 addresses) and `/29` (8 addresses). + CIDR *string `json:"cidr" validate:"required"` + + // The zone this address prefix will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // Indicates whether this will be the default address prefix for this zone in this VPC. If `true`, the VPC must not + // have a default address prefix for this zone. + IsDefault *bool `json:"is_default,omitempty"` + + // The user-defined name for this address prefix. Names must be unique within the VPC the address prefix resides in. 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 +} + +// NewCreateVPCAddressPrefixOptions : Instantiate CreateVPCAddressPrefixOptions +func (*VpcV1) NewCreateVPCAddressPrefixOptions(vpcID string, cidr string, zone ZoneIdentityIntf) *CreateVPCAddressPrefixOptions { + return &CreateVPCAddressPrefixOptions{ + VPCID: core.StringPtr(vpcID), + CIDR: core.StringPtr(cidr), + Zone: zone, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *CreateVPCAddressPrefixOptions) SetVPCID(vpcID string) *CreateVPCAddressPrefixOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetCIDR : Allow user to set CIDR +func (_options *CreateVPCAddressPrefixOptions) SetCIDR(cidr string) *CreateVPCAddressPrefixOptions { + _options.CIDR = core.StringPtr(cidr) + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateVPCAddressPrefixOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCAddressPrefixOptions { + _options.Zone = zone + return _options +} + +// SetIsDefault : Allow user to set IsDefault +func (_options *CreateVPCAddressPrefixOptions) SetIsDefault(isDefault bool) *CreateVPCAddressPrefixOptions { + _options.IsDefault = core.BoolPtr(isDefault) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCAddressPrefixOptions) SetName(name string) *CreateVPCAddressPrefixOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCAddressPrefixOptions) SetHeaders(param map[string]string) *CreateVPCAddressPrefixOptions { + options.Headers = param + return options +} + +// CreateVPCOptions : The CreateVPC options. +type CreateVPCOptions struct { + // Indicates whether a default address prefix will be automatically created for each zone in this VPC. If `manual`, + // this VPC will be created with no default address prefixes. + // + // Since address prefixes are managed identically regardless of whether they were automatically created, the value is + // not preserved as a VPC property. + AddressPrefixManagement *string `json:"address_prefix_management,omitempty"` + + // 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. + ClassicAccess *bool `json:"classic_access,omitempty"` + + // The unique user-defined name for this VPC. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPCOptions.AddressPrefixManagement property. +// Indicates whether a default address prefix will be automatically created for each zone in this VPC. If `manual`, this +// VPC will be created with no default address prefixes. +// +// Since address prefixes are managed identically regardless of whether they were automatically created, the value is +// not preserved as a VPC property. +const ( + CreateVPCOptionsAddressPrefixManagementAutoConst = "auto" + CreateVPCOptionsAddressPrefixManagementManualConst = "manual" +) + +// NewCreateVPCOptions : Instantiate CreateVPCOptions +func (*VpcV1) NewCreateVPCOptions() *CreateVPCOptions { + return &CreateVPCOptions{} +} + +// SetAddressPrefixManagement : Allow user to set AddressPrefixManagement +func (_options *CreateVPCOptions) SetAddressPrefixManagement(addressPrefixManagement string) *CreateVPCOptions { + _options.AddressPrefixManagement = core.StringPtr(addressPrefixManagement) + return _options +} + +// SetClassicAccess : Allow user to set ClassicAccess +func (_options *CreateVPCOptions) SetClassicAccess(classicAccess bool) *CreateVPCOptions { + _options.ClassicAccess = core.BoolPtr(classicAccess) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCOptions) SetName(name string) *CreateVPCOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateVPCOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVPCOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCOptions) SetHeaders(param map[string]string) *CreateVPCOptions { + options.Headers = param + return options +} + +// CreateVPCRouteOptions : The CreateVPCRoute options. +type CreateVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The destination of the route. At most two routes per `zone` in a table can have the same destination, and only if + // both routes have an `action` of `deliver` and the `next_hop` is an IP address. + Destination *string `json:"destination" validate:"required"` + + // The zone to apply the route to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // 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. + Action *string `json:"action,omitempty"` + + // The user-defined name for this route. If unspecified, the name will be a hyphenated list of randomly-selected words. + // Names must be unique within the VPC routing table the route resides in. + Name *string `json:"name,omitempty"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` + // values, it must be omitted or specified as `0.0.0.0`. + NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPCRouteOptions.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. +const ( + CreateVPCRouteOptionsActionDelegateConst = "delegate" + CreateVPCRouteOptionsActionDelegateVPCConst = "delegate_vpc" + CreateVPCRouteOptionsActionDeliverConst = "deliver" + CreateVPCRouteOptionsActionDropConst = "drop" +) + +// NewCreateVPCRouteOptions : Instantiate CreateVPCRouteOptions +func (*VpcV1) NewCreateVPCRouteOptions(vpcID string, destination string, zone ZoneIdentityIntf) *CreateVPCRouteOptions { + return &CreateVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + Destination: core.StringPtr(destination), + Zone: zone, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *CreateVPCRouteOptions) SetVPCID(vpcID string) *CreateVPCRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetDestination : Allow user to set Destination +func (_options *CreateVPCRouteOptions) SetDestination(destination string) *CreateVPCRouteOptions { + _options.Destination = core.StringPtr(destination) + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateVPCRouteOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCRouteOptions { + _options.Zone = zone + return _options +} + +// SetAction : Allow user to set Action +func (_options *CreateVPCRouteOptions) SetAction(action string) *CreateVPCRouteOptions { + _options.Action = core.StringPtr(action) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCRouteOptions) SetName(name string) *CreateVPCRouteOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetNextHop : Allow user to set NextHop +func (_options *CreateVPCRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopIntf) *CreateVPCRouteOptions { + _options.NextHop = nextHop + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCRouteOptions) SetHeaders(param map[string]string) *CreateVPCRouteOptions { + options.Headers = param + return options +} + +// CreateVPCRoutingTableOptions : The CreateVPCRoutingTable options. +type CreateVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // 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 `vpn_server` value is supported, but filter + // support is expected to expand in the future. + AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` + + // The user-defined name for this routing table. Names must be unique within the VPC the routing table resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // If set to `true`, this routing table will be used to route traffic that originates from [Direct + // Link](https://cloud.ibm.com/docs/dl/) to this VPC. For this to succeed, the VPC must not already have a routing + // table with this property set to `true`. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` + + // If set to `true`, this routing table will be used to route traffic that originates from [Transit + // Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. For this to succeed, the VPC must not already + // have a routing table with this property set to `true`. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + // + // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled + // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing + // table. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` + + // If set to `true`, this routing table will be used to route traffic that originates from subnets in other zones in + // this VPC. For this to succeed, the VPC must not already have a routing table with this property set to `true`. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. + // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` + + // The prototype objects for routes to create for this routing table. If unspecified, the routing table will be created + // with no routes. + Routes []RoutePrototype `json:"routes,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVPCRoutingTableOptions : Instantiate CreateVPCRoutingTableOptions +func (*VpcV1) NewCreateVPCRoutingTableOptions(vpcID string) *CreateVPCRoutingTableOptions { + return &CreateVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *CreateVPCRoutingTableOptions) SetVPCID(vpcID string) *CreateVPCRoutingTableOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetAcceptRoutesFrom : Allow user to set AcceptRoutesFrom +func (_options *CreateVPCRoutingTableOptions) SetAcceptRoutesFrom(acceptRoutesFrom []ResourceFilter) *CreateVPCRoutingTableOptions { + _options.AcceptRoutesFrom = acceptRoutesFrom + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCRoutingTableOptions) SetName(name string) *CreateVPCRoutingTableOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetRouteDirectLinkIngress : Allow user to set RouteDirectLinkIngress +func (_options *CreateVPCRoutingTableOptions) SetRouteDirectLinkIngress(routeDirectLinkIngress bool) *CreateVPCRoutingTableOptions { + _options.RouteDirectLinkIngress = core.BoolPtr(routeDirectLinkIngress) + return _options +} + +// SetRouteTransitGatewayIngress : Allow user to set RouteTransitGatewayIngress +func (_options *CreateVPCRoutingTableOptions) SetRouteTransitGatewayIngress(routeTransitGatewayIngress bool) *CreateVPCRoutingTableOptions { + _options.RouteTransitGatewayIngress = core.BoolPtr(routeTransitGatewayIngress) + return _options +} + +// SetRouteVPCZoneIngress : Allow user to set RouteVPCZoneIngress +func (_options *CreateVPCRoutingTableOptions) SetRouteVPCZoneIngress(routeVPCZoneIngress bool) *CreateVPCRoutingTableOptions { + _options.RouteVPCZoneIngress = core.BoolPtr(routeVPCZoneIngress) + return _options +} + +// SetRoutes : Allow user to set Routes +func (_options *CreateVPCRoutingTableOptions) SetRoutes(routes []RoutePrototype) *CreateVPCRoutingTableOptions { + _options.Routes = routes + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCRoutingTableOptions) SetHeaders(param map[string]string) *CreateVPCRoutingTableOptions { + options.Headers = param + return options +} + +// CreateVPCRoutingTableRouteOptions : The CreateVPCRoutingTableRoute options. +type CreateVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` + + // The destination of the route. At most two routes per `zone` in a table can have the same destination, and only if + // both routes have an `action` of `deliver` and the `next_hop` is an IP address. + Destination *string `json:"destination" validate:"required"` + + // The zone to apply the route to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // 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. + Action *string `json:"action,omitempty"` + + // The user-defined name for this route. If unspecified, the name will be a hyphenated list of randomly-selected words. + // Names must be unique within the VPC routing table the route resides in. + Name *string `json:"name,omitempty"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` + // values, it must be omitted or specified as `0.0.0.0`. + NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPCRoutingTableRouteOptions.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. +const ( + CreateVPCRoutingTableRouteOptionsActionDelegateConst = "delegate" + CreateVPCRoutingTableRouteOptionsActionDelegateVPCConst = "delegate_vpc" + CreateVPCRoutingTableRouteOptionsActionDeliverConst = "deliver" + CreateVPCRoutingTableRouteOptionsActionDropConst = "drop" +) + +// NewCreateVPCRoutingTableRouteOptions : Instantiate CreateVPCRoutingTableRouteOptions +func (*VpcV1) NewCreateVPCRoutingTableRouteOptions(vpcID string, routingTableID string, destination string, zone ZoneIdentityIntf) *CreateVPCRoutingTableRouteOptions { + return &CreateVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + Destination: core.StringPtr(destination), + Zone: zone, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *CreateVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *CreateVPCRoutingTableRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *CreateVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *CreateVPCRoutingTableRouteOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetDestination : Allow user to set Destination +func (_options *CreateVPCRoutingTableRouteOptions) SetDestination(destination string) *CreateVPCRoutingTableRouteOptions { + _options.Destination = core.StringPtr(destination) + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateVPCRoutingTableRouteOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCRoutingTableRouteOptions { + _options.Zone = zone + return _options +} + +// SetAction : Allow user to set Action +func (_options *CreateVPCRoutingTableRouteOptions) SetAction(action string) *CreateVPCRoutingTableRouteOptions { + _options.Action = core.StringPtr(action) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCRoutingTableRouteOptions) SetName(name string) *CreateVPCRoutingTableRouteOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetNextHop : Allow user to set NextHop +func (_options *CreateVPCRoutingTableRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopIntf) *CreateVPCRoutingTableRouteOptions { + _options.NextHop = nextHop + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *CreateVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// CreateVPNGatewayConnectionOptions : The CreateVPNGatewayConnection options. +type CreateVPNGatewayConnectionOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection prototype object. + VPNGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf `json:"VPNGatewayConnectionPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVPNGatewayConnectionOptions : Instantiate CreateVPNGatewayConnectionOptions +func (*VpcV1) NewCreateVPNGatewayConnectionOptions(vpnGatewayID string, vpnGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf) *CreateVPNGatewayConnectionOptions { + return &CreateVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + VPNGatewayConnectionPrototype: vpnGatewayConnectionPrototype, + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *CreateVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *CreateVPNGatewayConnectionOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetVPNGatewayConnectionPrototype : Allow user to set VPNGatewayConnectionPrototype +func (_options *CreateVPNGatewayConnectionOptions) SetVPNGatewayConnectionPrototype(vpnGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf) *CreateVPNGatewayConnectionOptions { + _options.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *CreateVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// CreateVPNGatewayOptions : The CreateVPNGateway options. +type CreateVPNGatewayOptions struct { + // The VPN gateway prototype object. + VPNGatewayPrototype VPNGatewayPrototypeIntf `json:"VPNGatewayPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVPNGatewayOptions : Instantiate CreateVPNGatewayOptions +func (*VpcV1) NewCreateVPNGatewayOptions(vpnGatewayPrototype VPNGatewayPrototypeIntf) *CreateVPNGatewayOptions { + return &CreateVPNGatewayOptions{ + VPNGatewayPrototype: vpnGatewayPrototype, + } +} + +// SetVPNGatewayPrototype : Allow user to set VPNGatewayPrototype +func (_options *CreateVPNGatewayOptions) SetVPNGatewayPrototype(vpnGatewayPrototype VPNGatewayPrototypeIntf) *CreateVPNGatewayOptions { + _options.VPNGatewayPrototype = vpnGatewayPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNGatewayOptions) SetHeaders(param map[string]string) *CreateVPNGatewayOptions { + options.Headers = param + return options +} + +// CreateVPNServerOptions : The CreateVPNServer options. +type CreateVPNServerOptions struct { + // The certificate instance for this VPN server. + Certificate CertificateInstanceIdentityIntf `json:"certificate" validate:"required"` + + // The methods used to authenticate VPN clients to this VPN server. VPN clients must authenticate against all specified + // methods. + ClientAuthentication []VPNServerAuthenticationPrototypeIntf `json:"client_authentication" validate:"required"` + + // The VPN client IPv4 address pool, expressed in CIDR format. The request must not overlap with any existing address + // prefixes in the VPC or any of the following reserved address ranges: + // - `127.0.0.0/8` (IPv4 loopback addresses) + // - `161.26.0.0/16` (IBM services) + // - `166.8.0.0/14` (Cloud Service Endpoints) + // - `169.254.0.0/16` (IPv4 link-local addresses) + // - `224.0.0.0/4` (IPv4 multicast addresses) + // + // The prefix length of the client IP address pool's CIDR must be between + // `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that contains twice the number of IP addresses + // that are required to enable the maximum number of concurrent connections is recommended. + ClientIPPool *string `json:"client_ip_pool" validate:"required"` + + // The subnets to provision this VPN server in. Use subnets in different zones for high availability. + Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` + + // The DNS server addresses that will be provided to VPN clients connected to this VPN server. + ClientDnsServerIps []IP `json:"client_dns_server_ips,omitempty"` + + // The seconds a VPN client can be idle before this VPN server will disconnect it. Specify `0` to prevent the server + // from disconnecting idle clients. + ClientIdleTimeout *int64 `json:"client_idle_timeout,omitempty"` + + // Indicates whether the split tunneling is enabled on this VPN server. + EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"` + + // The user-defined name for this VPN server. If unspecified, the name will be a hyphenated list of randomly-selected + // words. Names must be unique within the VPC this VPN server is serving. + Name *string `json:"name,omitempty"` + + // The port number to use for this VPN server. + Port *int64 `json:"port,omitempty"` + + // The transport protocol to use for this VPN server. + Protocol *string `json:"protocol,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // 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 + Headers map[string]string +} + +// Constants associated with the CreateVPNServerOptions.Protocol property. +// The transport protocol to use for this VPN server. +const ( + CreateVPNServerOptionsProtocolTCPConst = "tcp" + CreateVPNServerOptionsProtocolUDPConst = "udp" +) + +// NewCreateVPNServerOptions : Instantiate CreateVPNServerOptions +func (*VpcV1) NewCreateVPNServerOptions(certificate CertificateInstanceIdentityIntf, clientAuthentication []VPNServerAuthenticationPrototypeIntf, clientIPPool string, subnets []SubnetIdentityIntf) *CreateVPNServerOptions { + return &CreateVPNServerOptions{ + Certificate: certificate, + ClientAuthentication: clientAuthentication, + ClientIPPool: core.StringPtr(clientIPPool), + Subnets: subnets, + } +} + +// SetCertificate : Allow user to set Certificate +func (_options *CreateVPNServerOptions) SetCertificate(certificate CertificateInstanceIdentityIntf) *CreateVPNServerOptions { + _options.Certificate = certificate + return _options +} + +// SetClientAuthentication : Allow user to set ClientAuthentication +func (_options *CreateVPNServerOptions) SetClientAuthentication(clientAuthentication []VPNServerAuthenticationPrototypeIntf) *CreateVPNServerOptions { + _options.ClientAuthentication = clientAuthentication + return _options +} + +// SetClientIPPool : Allow user to set ClientIPPool +func (_options *CreateVPNServerOptions) SetClientIPPool(clientIPPool string) *CreateVPNServerOptions { + _options.ClientIPPool = core.StringPtr(clientIPPool) + return _options +} + +// SetSubnets : Allow user to set Subnets +func (_options *CreateVPNServerOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateVPNServerOptions { + _options.Subnets = subnets + return _options +} + +// SetClientDnsServerIps : Allow user to set ClientDnsServerIps +func (_options *CreateVPNServerOptions) SetClientDnsServerIps(clientDnsServerIps []IP) *CreateVPNServerOptions { + _options.ClientDnsServerIps = clientDnsServerIps + return _options +} + +// SetClientIdleTimeout : Allow user to set ClientIdleTimeout +func (_options *CreateVPNServerOptions) SetClientIdleTimeout(clientIdleTimeout int64) *CreateVPNServerOptions { + _options.ClientIdleTimeout = core.Int64Ptr(clientIdleTimeout) + return _options +} + +// SetEnableSplitTunneling : Allow user to set EnableSplitTunneling +func (_options *CreateVPNServerOptions) SetEnableSplitTunneling(enableSplitTunneling bool) *CreateVPNServerOptions { + _options.EnableSplitTunneling = core.BoolPtr(enableSplitTunneling) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPNServerOptions) SetName(name string) *CreateVPNServerOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPort : Allow user to set Port +func (_options *CreateVPNServerOptions) SetPort(port int64) *CreateVPNServerOptions { + _options.Port = core.Int64Ptr(port) + return _options +} + +// SetProtocol : Allow user to set Protocol +func (_options *CreateVPNServerOptions) SetProtocol(protocol string) *CreateVPNServerOptions { + _options.Protocol = core.StringPtr(protocol) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateVPNServerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVPNServerOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateVPNServerOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateVPNServerOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNServerOptions) SetHeaders(param map[string]string) *CreateVPNServerOptions { + options.Headers = param + return options +} + +// CreateVPNServerRouteOptions : The CreateVPNServerRoute options. +type CreateVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The destination to use for this VPN route in the VPN server. Must be unique within the VPN server. If an incoming + // packet does not match any destination, it will be dropped. + Destination *string `json:"destination" validate:"required"` + + // The action to perform with a packet matching the VPN route: + // - `translate`: translate the source IP address to one of the private IP addresses of the VPN server, then deliver + // the packet to target. + // - `deliver`: deliver the packet to the target. + // - `drop`: drop the packet + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the + // unexpected property value was encountered. + Action *string `json:"action,omitempty"` + + // The user-defined name for this VPN route. If unspecified, the name will be a hyphenated list of randomly-selected + // words. Names must be unique within the VPN server the VPN route resides in. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPNServerRouteOptions.Action property. +// The action to perform with a packet matching the VPN route: +// - `translate`: translate the source IP address to one of the private IP addresses of the VPN server, then deliver the +// packet to target. +// - `deliver`: deliver the packet to the target. +// - `drop`: drop the packet +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the +// unexpected property value was encountered. +const ( + CreateVPNServerRouteOptionsActionDeliverConst = "deliver" + CreateVPNServerRouteOptionsActionDropConst = "drop" + CreateVPNServerRouteOptionsActionTranslateConst = "translate" +) + +// NewCreateVPNServerRouteOptions : Instantiate CreateVPNServerRouteOptions +func (*VpcV1) NewCreateVPNServerRouteOptions(vpnServerID string, destination string) *CreateVPNServerRouteOptions { + return &CreateVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + Destination: core.StringPtr(destination), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *CreateVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *CreateVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetDestination : Allow user to set Destination +func (_options *CreateVPNServerRouteOptions) SetDestination(destination string) *CreateVPNServerRouteOptions { + _options.Destination = core.StringPtr(destination) + return _options +} + +// SetAction : Allow user to set Action +func (_options *CreateVPNServerRouteOptions) SetAction(action string) *CreateVPNServerRouteOptions { + _options.Action = core.StringPtr(action) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPNServerRouteOptions) SetName(name string) *CreateVPNServerRouteOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNServerRouteOptions) SetHeaders(param map[string]string) *CreateVPNServerRouteOptions { + options.Headers = param + return options +} + +// DedicatedHost : DedicatedHost struct +type DedicatedHost struct { + // The amount of memory in gibibytes that is currently available for instances. + AvailableMemory *int64 `json:"available_memory" validate:"required"` + + // The available VCPU for the dedicated host. + AvailableVcpu *Vcpu `json:"available_vcpu" validate:"required"` + + // The date and time that the dedicated host was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` + + // Collection of the dedicated host's disks. + Disks []DedicatedHostDisk `json:"disks" validate:"required"` + + // The dedicated host group this dedicated host is in. + Group *DedicatedHostGroupReference `json:"group" validate:"required"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` + + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled" validate:"required"` + + // The instances that are allocated to this dedicated host. + Instances []InstanceReference `json:"instances" validate:"required"` + + // The lifecycle state of the dedicated host. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The total amount of memory in gibibytes for this host. + Memory *int64 `json:"memory" validate:"required"` + + // The unique user-defined name for this dedicated host. + Name *string `json:"name" validate:"required"` + + // The profile this dedicated host uses. + Profile *DedicatedHostProfileReference `json:"profile" validate:"required"` + + // Indicates whether this dedicated host is available for instance creation. + Provisionable *bool `json:"provisionable" validate:"required"` + + // The resource group for this dedicated host. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The total number of sockets for this host. + SocketCount *int64 `json:"socket_count" validate:"required"` + + // The administrative state of the dedicated host. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the dedicated host on which + // the unexpected property value was encountered. + State *string `json:"state" validate:"required"` + + // The instance profiles usable by instances placed on this dedicated host. + SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` + + // The total VCPU of the dedicated host. + Vcpu *Vcpu `json:"vcpu" validate:"required"` + + // The zone this dedicated host resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the DedicatedHost.LifecycleState property. +// The lifecycle state of the dedicated host. +const ( + DedicatedHostLifecycleStateDeletingConst = "deleting" + DedicatedHostLifecycleStateFailedConst = "failed" + DedicatedHostLifecycleStatePendingConst = "pending" + DedicatedHostLifecycleStateStableConst = "stable" + DedicatedHostLifecycleStateSuspendedConst = "suspended" + DedicatedHostLifecycleStateUpdatingConst = "updating" + DedicatedHostLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the DedicatedHost.ResourceType property. +// The resource type. +const ( + DedicatedHostResourceTypeDedicatedHostConst = "dedicated_host" +) + +// Constants associated with the DedicatedHost.State property. +// The administrative state of the dedicated host. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the dedicated host on which +// the unexpected property value was encountered. +const ( + DedicatedHostStateAvailableConst = "available" + DedicatedHostStateDegradedConst = "degraded" + DedicatedHostStateMigratingConst = "migrating" + DedicatedHostStateUnavailableConst = "unavailable" +) + +// UnmarshalDedicatedHost unmarshals an instance of DedicatedHost from the specified map of raw messages. +func UnmarshalDedicatedHost(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHost) + err = core.UnmarshalPrimitive(m, "available_memory", &obj.AvailableMemory) + if err != nil { + return + } + err = core.UnmarshalModel(m, "available_vcpu", &obj.AvailableVcpu, UnmarshalVcpu) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalVcpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostCollection : DedicatedHostCollection struct +type DedicatedHostCollection struct { + // Collection of dedicated hosts. + DedicatedHosts []DedicatedHost `json:"dedicated_hosts" validate:"required"` + + // A link to the first page of resources. + First *DedicatedHostCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalDedicatedHostCollection unmarshals an instance of DedicatedHostCollection from the specified map of raw messages. +func UnmarshalDedicatedHostCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostCollection) + err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHost) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *DedicatedHostCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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). + Available *int64 `json:"available" validate:"required"` + + // The date and time that the disk was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this disk. + ID *string `json:"id" validate:"required"` + + // Instance disks that are on this dedicated host disk. + InstanceDisks []InstanceDiskReference `json:"instance_disks" validate:"required"` + + // The disk interface used for attaching the disk + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The lifecycle state of this dedicated host disk. + LifecycleState *string `json:"lifecycle_state,omitempty"` + + // The user-defined or system-provided name for this disk. + Name *string `json:"name" validate:"required"` + + // Indicates whether this dedicated host disk is available for instance disk creation. + Provisionable *bool `json:"provisionable" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *int64 `json:"size" validate:"required"` + + // The instance disk interfaces supported for this dedicated host disk. + SupportedInstanceInterfaceTypes []string `json:"supported_instance_interface_types" validate:"required"` +} + +// Constants associated with the DedicatedHostDisk.InterfaceType property. +// The disk interface used for attaching the disk +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostDiskInterfaceTypeNvmeConst = "nvme" +) + +// Constants associated with the DedicatedHostDisk.LifecycleState property. +// The lifecycle state of this dedicated host disk. +const ( + DedicatedHostDiskLifecycleStateDeletingConst = "deleting" + DedicatedHostDiskLifecycleStateFailedConst = "failed" + DedicatedHostDiskLifecycleStatePendingConst = "pending" + DedicatedHostDiskLifecycleStateStableConst = "stable" + DedicatedHostDiskLifecycleStateSuspendedConst = "suspended" + DedicatedHostDiskLifecycleStateUpdatingConst = "updating" + DedicatedHostDiskLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the DedicatedHostDisk.ResourceType property. +// The resource type. +const ( + DedicatedHostDiskResourceTypeDedicatedHostDiskConst = "dedicated_host_disk" +) + +// Constants associated with the DedicatedHostDisk.SupportedInstanceInterfaceTypes property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostDiskSupportedInstanceInterfaceTypesNvmeConst = "nvme" + DedicatedHostDiskSupportedInstanceInterfaceTypesVirtioBlkConst = "virtio_blk" +) + +// UnmarshalDedicatedHostDisk unmarshals an instance of DedicatedHostDisk from the specified map of raw messages. +func UnmarshalDedicatedHostDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostDisk) + err = core.UnmarshalPrimitive(m, "available", &obj.Available) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_disks", &obj.InstanceDisks, UnmarshalInstanceDiskReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostDiskCollection : DedicatedHostDiskCollection struct +type DedicatedHostDiskCollection struct { + // Collection of the dedicated host's disks. + Disks []DedicatedHostDisk `json:"disks" validate:"required"` +} + +// UnmarshalDedicatedHostDiskCollection unmarshals an instance of DedicatedHostDiskCollection from the specified map of raw messages. +func UnmarshalDedicatedHostDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostDiskCollection) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostDiskPatch : DedicatedHostDiskPatch struct +type DedicatedHostDiskPatch struct { + // The user-defined name for this disk. + Name *string `json:"name,omitempty"` +} + +// UnmarshalDedicatedHostDiskPatch unmarshals an instance of DedicatedHostDiskPatch from the specified map of raw messages. +func UnmarshalDedicatedHostDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostDiskPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// DedicatedHostGroup : DedicatedHostGroup struct +type DedicatedHostGroup struct { + // The dedicated host profile class for hosts in this group. + Class *string `json:"class" validate:"required"` + + // The date and time that the dedicated host group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` + + // The dedicated hosts that are in this dedicated host group. + DedicatedHosts []DedicatedHostReference `json:"dedicated_hosts" validate:"required"` + + // The dedicated host profile family for hosts in this group. + Family *string `json:"family" validate:"required"` + + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this dedicated host group. + Name *string `json:"name" validate:"required"` + + // The resource group for this dedicated host group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The instance profiles usable by instances placed on this dedicated host group. + SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` + + // The zone this dedicated host group resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the DedicatedHostGroup.Family property. +// The dedicated host profile family for hosts in this group. +const ( + DedicatedHostGroupFamilyBalancedConst = "balanced" + DedicatedHostGroupFamilyComputeConst = "compute" + DedicatedHostGroupFamilyMemoryConst = "memory" +) + +// Constants associated with the DedicatedHostGroup.ResourceType property. +// The resource type. +const ( + DedicatedHostGroupResourceTypeDedicatedHostGroupConst = "dedicated_host_group" +) + +// UnmarshalDedicatedHostGroup unmarshals an instance of DedicatedHostGroup from the specified map of raw messages. +func UnmarshalDedicatedHostGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroup) + err = core.UnmarshalPrimitive(m, "class", &obj.Class) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHostReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupCollection : DedicatedHostGroupCollection struct +type DedicatedHostGroupCollection struct { + // A link to the first page of resources. + First *DedicatedHostGroupCollectionFirst `json:"first" validate:"required"` + + // Collection of dedicated host groups. + Groups []DedicatedHostGroup `json:"groups" 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 *DedicatedHostGroupCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "groups", &obj.Groups, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *DedicatedHostGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 +// - DedicatedHostGroupIdentityByCRN +// - DedicatedHostGroupIdentityByHref +type DedicatedHostGroupIdentity struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host group. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href,omitempty"` +} + +func (*DedicatedHostGroupIdentity) isaDedicatedHostGroupIdentity() bool { + return true +} + +type DedicatedHostGroupIdentityIntf interface { + isaDedicatedHostGroupIdentity() bool +} + +// UnmarshalDedicatedHostGroupIdentity unmarshals an instance of DedicatedHostGroupIdentity from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupPatch : DedicatedHostGroupPatch struct +type DedicatedHostGroupPatch struct { + // The unique user-defined name for this dedicated host group. + Name *string `json:"name,omitempty"` +} + +// UnmarshalDedicatedHostGroupPatch unmarshals an instance of DedicatedHostGroupPatch from the specified map of raw messages. +func UnmarshalDedicatedHostGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// DedicatedHostGroupPrototypeDedicatedHostByZoneContext : DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct +type DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct { + // The unique user-defined name for this dedicated host group. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the host's resource group is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` +} + +// UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext unmarshals an instance of DedicatedHostGroupPrototypeDedicatedHostByZoneContext from the specified map of raw messages. +func UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupPrototypeDedicatedHostByZoneContext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupReference : DedicatedHostGroupReference struct +type DedicatedHostGroupReference struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this dedicated host group. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the DedicatedHostGroupReference.ResourceType property. +// The resource type. +const ( + DedicatedHostGroupReferenceResourceTypeDedicatedHostGroupConst = "dedicated_host_group" +) + +// UnmarshalDedicatedHostGroupReference unmarshals an instance of DedicatedHostGroupReference from the specified map of raw messages. +func UnmarshalDedicatedHostGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type DedicatedHostGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalDedicatedHostGroupReferenceDeleted unmarshals an instance of DedicatedHostGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalDedicatedHostGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPatch : DedicatedHostPatch struct +type DedicatedHostPatch struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The unique user-defined name for this dedicated host. + Name *string `json:"name,omitempty"` +} + +// UnmarshalDedicatedHostPatch unmarshals an instance of DedicatedHostPatch from the specified map of raw messages. +func UnmarshalDedicatedHostPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPatch) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// DedicatedHostProfile : DedicatedHostProfile struct +type DedicatedHostProfile struct { + // The product class this dedicated host profile belongs to. + Class *string `json:"class" validate:"required"` + + // Collection of the dedicated host profile's disks. + Disks []DedicatedHostProfileDisk `json:"disks" validate:"required"` + + // The product family this dedicated host profile belongs to + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Family *string `json:"family" validate:"required"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + Memory DedicatedHostProfileMemoryIntf `json:"memory" validate:"required"` + + // The globally unique name for this dedicated host profile. + Name *string `json:"name" validate:"required"` + + SocketCount DedicatedHostProfileSocketIntf `json:"socket_count" validate:"required"` + + // The instance profiles usable by instances placed on dedicated hosts with this profile. + SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` + + VcpuArchitecture *DedicatedHostProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` + + VcpuCount DedicatedHostProfileVcpuIntf `json:"vcpu_count" validate:"required"` +} + +// Constants associated with the DedicatedHostProfile.Family property. +// The product family this dedicated host profile belongs to +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostProfileFamilyBalancedConst = "balanced" + DedicatedHostProfileFamilyComputeConst = "compute" + DedicatedHostProfileFamilyMemoryConst = "memory" +) + +// UnmarshalDedicatedHostProfile unmarshals an instance of DedicatedHostProfile from the specified map of raw messages. +func UnmarshalDedicatedHostProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfile) + err = core.UnmarshalPrimitive(m, "class", &obj.Class) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostProfileDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalDedicatedHostProfileMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "socket_count", &obj.SocketCount, UnmarshalDedicatedHostProfileSocket) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalDedicatedHostProfileVcpuArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalDedicatedHostProfileVcpu) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileCollection : DedicatedHostProfileCollection struct +type DedicatedHostProfileCollection struct { + // A link to the first page of resources. + First *DedicatedHostProfileCollectionFirst `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"` + + // Collection of dedicated host profiles. + Profiles []DedicatedHostProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalDedicatedHostProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *DedicatedHostProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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"` + + // The number of disks of this type for a dedicated host with this profile. + Quantity *DedicatedHostProfileDiskQuantity `json:"quantity" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *DedicatedHostProfileDiskSize `json:"size" validate:"required"` + + SupportedInstanceInterfaceTypes *DedicatedHostProfileDiskSupportedInterfaces `json:"supported_instance_interface_types" validate:"required"` +} + +// UnmarshalDedicatedHostProfileDisk unmarshals an instance of DedicatedHostProfileDisk from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDisk) + err = core.UnmarshalModel(m, "interface_type", &obj.InterfaceType, UnmarshalDedicatedHostProfileDiskInterface) + if err != nil { + return + } + err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalDedicatedHostProfileDiskQuantity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalDedicatedHostProfileDiskSize) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes, UnmarshalDedicatedHostProfileDiskSupportedInterfaces) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskInterface : DedicatedHostProfileDiskInterface struct +type DedicatedHostProfileDiskInterface struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The interface of the disk for a dedicated host with this profile + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskInterface.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskInterfaceTypeFixedConst = "fixed" +) + +// Constants associated with the DedicatedHostProfileDiskInterface.Value property. +// The interface of the disk for a dedicated host with this profile +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostProfileDiskInterfaceValueNvmeConst = "nvme" +) + +// UnmarshalDedicatedHostProfileDiskInterface unmarshals an instance of DedicatedHostProfileDiskInterface from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskInterface) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskQuantity : The number of disks of this type for a dedicated host with this profile. +type DedicatedHostProfileDiskQuantity struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskQuantity.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskQuantityTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileDiskQuantity unmarshals an instance of DedicatedHostProfileDiskQuantity from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskQuantity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskSize : The size of the disk in GB (gigabytes). +type DedicatedHostProfileDiskSize struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskSize.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskSizeTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileDiskSize unmarshals an instance of DedicatedHostProfileDiskSize from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskSize) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskSupportedInterfaces : DedicatedHostProfileDiskSupportedInterfaces struct +type DedicatedHostProfileDiskSupportedInterfaces struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The instance disk interfaces supported for a dedicated host with this profile. + Value []string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskSupportedInterfaces.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskSupportedInterfacesTypeFixedConst = "fixed" +) + +// Constants associated with the DedicatedHostProfileDiskSupportedInterfaces.Value property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostProfileDiskSupportedInterfacesValueNvmeConst = "nvme" + DedicatedHostProfileDiskSupportedInterfacesValueVirtioBlkConst = "virtio_blk" +) + +// UnmarshalDedicatedHostProfileDiskSupportedInterfaces unmarshals an instance of DedicatedHostProfileDiskSupportedInterfaces from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileIdentity : Identifies a dedicated host profile by a unique property. +// Models which "extend" this model: +// - DedicatedHostProfileIdentityByName +// - DedicatedHostProfileIdentityByHref +type DedicatedHostProfileIdentity struct { + // The globally unique name for this dedicated host profile. + Name *string `json:"name,omitempty"` + + // The URL for this dedicated host profile. + Href *string `json:"href,omitempty"` +} + +func (*DedicatedHostProfileIdentity) isaDedicatedHostProfileIdentity() bool { + return true +} + +type DedicatedHostProfileIdentityIntf interface { + isaDedicatedHostProfileIdentity() bool +} + +// UnmarshalDedicatedHostProfileIdentity unmarshals an instance of DedicatedHostProfileIdentity from the specified map of raw messages. +func UnmarshalDedicatedHostProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemory : DedicatedHostProfileMemory struct +// Models which "extend" this model: +// - DedicatedHostProfileMemoryFixed +// - DedicatedHostProfileMemoryRange +// - DedicatedHostProfileMemoryEnum +// - DedicatedHostProfileMemoryDependent +type DedicatedHostProfileMemory 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 DedicatedHostProfileMemory.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileMemory) isaDedicatedHostProfileMemory() bool { + return true +} + +type DedicatedHostProfileMemoryIntf interface { + isaDedicatedHostProfileMemory() bool +} + +// UnmarshalDedicatedHostProfileMemory unmarshals an instance of DedicatedHostProfileMemory from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileReference : DedicatedHostProfileReference struct +type DedicatedHostProfileReference struct { + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this dedicated host profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalDedicatedHostProfileReference unmarshals an instance of DedicatedHostProfileReference from the specified map of raw messages. +func UnmarshalDedicatedHostProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocket : DedicatedHostProfileSocket struct +// Models which "extend" this model: +// - DedicatedHostProfileSocketFixed +// - DedicatedHostProfileSocketRange +// - DedicatedHostProfileSocketEnum +// - DedicatedHostProfileSocketDependent +type DedicatedHostProfileSocket 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 DedicatedHostProfileSocket.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileSocket) isaDedicatedHostProfileSocket() bool { + return true +} + +type DedicatedHostProfileSocketIntf interface { + isaDedicatedHostProfileSocket() bool +} + +// UnmarshalDedicatedHostProfileSocket unmarshals an instance of DedicatedHostProfileSocket from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocket(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocket) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpu : DedicatedHostProfileVcpu struct +// Models which "extend" this model: +// - DedicatedHostProfileVcpuFixed +// - DedicatedHostProfileVcpuRange +// - DedicatedHostProfileVcpuEnum +// - DedicatedHostProfileVcpuDependent +type DedicatedHostProfileVcpu 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 DedicatedHostProfileVcpu.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileVcpu) isaDedicatedHostProfileVcpu() bool { + return true +} + +type DedicatedHostProfileVcpuIntf interface { + isaDedicatedHostProfileVcpu() bool +} + +// UnmarshalDedicatedHostProfileVcpu unmarshals an instance of DedicatedHostProfileVcpu from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpu) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuArchitecture : DedicatedHostProfileVcpuArchitecture struct +type DedicatedHostProfileVcpuArchitecture struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The VCPU architecture for a dedicated host with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuArchitecture.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuArchitectureTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileVcpuArchitecture unmarshals an instance of DedicatedHostProfileVcpuArchitecture from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuArchitecture) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPrototype : DedicatedHostPrototype struct +// Models which "extend" this model: +// - DedicatedHostPrototypeDedicatedHostByGroup +// - DedicatedHostPrototypeDedicatedHostByZone +type DedicatedHostPrototype struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The unique user-defined name for this dedicated host. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The profile to use for this dedicated host. + Profile DedicatedHostProfileIdentityIntf `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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The dedicated host group for this dedicated host. + Group DedicatedHostGroupIdentityIntf `json:"group,omitempty"` + + // The zone this dedicated host will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +func (*DedicatedHostPrototype) isaDedicatedHostPrototype() bool { + return true +} + +type DedicatedHostPrototypeIntf interface { + isaDedicatedHostPrototype() bool +} + +// UnmarshalDedicatedHostPrototype unmarshals an instance of DedicatedHostPrototype from the specified map of raw messages. +func UnmarshalDedicatedHostPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPrototype) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostReference : DedicatedHostReference struct +type DedicatedHostReference struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this dedicated host. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the DedicatedHostReference.ResourceType property. +// The resource type. +const ( + DedicatedHostReferenceResourceTypeDedicatedHostConst = "dedicated_host" +) + +// UnmarshalDedicatedHostReference unmarshals an instance of DedicatedHostReference from the specified map of raw messages. +func UnmarshalDedicatedHostReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type DedicatedHostReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalDedicatedHostReferenceDeleted unmarshals an instance of DedicatedHostReferenceDeleted from the specified map of raw messages. +func UnmarshalDedicatedHostReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DefaultNetworkACL : DefaultNetworkACL struct +type DefaultNetworkACL struct { + // The date and time that the network ACL was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` + + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` + + // The name of the default network ACL created for a VPC. The name will be a hyphenated list of randomly-selected words + // at creation, but may be user-specified with a subsequent request. + Name *string `json:"name" validate:"required"` + + // The resource group for the default network ACL for a VPC. Set to the VPC's + // resource group at creation. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The ordered rules for the default network ACL for a VPC. Defaults to two rules which allow all inbound and outbound + // traffic, respectively. Rules for the default network ACL may be changed, added, or removed. + Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` + + // The subnets to which this network ACL is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The VPC this network ACL is a part of. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalDefaultNetworkACL unmarshals an instance of DefaultNetworkACL from the specified map of raw messages. +func UnmarshalDefaultNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DefaultNetworkACL) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DefaultRoutingTable : DefaultRoutingTable struct +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 `vpn_server` value is supported, but filter + // support is expected to expand in the future. + AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` + + // The date and time that this routing table was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this routing table. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` + + // Indicates whether this is the default routing table for this VPC. + IsDefault *bool `json:"is_default" validate:"required"` + + // The lifecycle state of the routing table. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name of the default routing table created for this VPC. The name will be a hyphenated list of randomly-selected + // words at creation, but may be user-specified with a subsequent request. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from from [Transit + // Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this + // VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` + + // The routes for the default routing table for this VPC. The table is created with no routes, but routes may be added, + // changed, or removed with a subsequent request. + Routes []RouteReference `json:"routes" validate:"required"` + + // The subnets to which this routing table is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` +} + +// Constants associated with the DefaultRoutingTable.LifecycleState property. +// The lifecycle state of the routing table. +const ( + DefaultRoutingTableLifecycleStateDeletingConst = "deleting" + DefaultRoutingTableLifecycleStateFailedConst = "failed" + DefaultRoutingTableLifecycleStatePendingConst = "pending" + DefaultRoutingTableLifecycleStateStableConst = "stable" + DefaultRoutingTableLifecycleStateSuspendedConst = "suspended" + DefaultRoutingTableLifecycleStateUpdatingConst = "updating" + DefaultRoutingTableLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the DefaultRoutingTable.ResourceType property. +// The resource type. +const ( + DefaultRoutingTableResourceTypeRoutingTableConst = "routing_table" +) + +// UnmarshalDefaultRoutingTable unmarshals an instance of DefaultRoutingTable from the specified map of raw messages. +func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DefaultRoutingTable) + err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DefaultSecurityGroup : DefaultSecurityGroup struct +type DefaultSecurityGroup struct { + // The date and time that this security group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The name of the default security group created for a VPC. The name will be a hyphenated list of randomly-selected + // words at creation, but may be user-specified with a subsequent request. + Name *string `json:"name" validate:"required"` + + // The resource group for this security group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The rules for the default security group for a VPC. Defaults to allowing all outbound traffic, and allowing all + // inbound traffic from other interfaces in the VPC's default security group. Rules for the default security group may + // be changed, added or removed. + Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` + + // The targets for this security group. + Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` + + // The VPC this security group is a part of. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalDefaultSecurityGroup unmarshals an instance of DefaultSecurityGroup from the specified map of raw messages. +func UnmarshalDefaultSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DefaultSecurityGroup) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) + if err != nil { + return + } + err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DeleteBackupPolicyOptions : The DeleteBackupPolicy options. +type DeleteBackupPolicyOptions struct { + // The backup policy 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 +} + +// NewDeleteBackupPolicyOptions : Instantiate DeleteBackupPolicyOptions +func (*VpcV1) NewDeleteBackupPolicyOptions(id string) *DeleteBackupPolicyOptions { + return &DeleteBackupPolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteBackupPolicyOptions) SetID(id string) *DeleteBackupPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteBackupPolicyOptions) SetIfMatch(ifMatch string) *DeleteBackupPolicyOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBackupPolicyOptions) SetHeaders(param map[string]string) *DeleteBackupPolicyOptions { + options.Headers = param + return options +} + +// DeleteBackupPolicyPlanOptions : The DeleteBackupPolicyPlan options. +type DeleteBackupPolicyPlanOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // The backup policy plan 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 +} + +// NewDeleteBackupPolicyPlanOptions : Instantiate DeleteBackupPolicyPlanOptions +func (*VpcV1) NewDeleteBackupPolicyPlanOptions(backupPolicyID string, id string) *DeleteBackupPolicyPlanOptions { + return &DeleteBackupPolicyPlanOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + ID: core.StringPtr(id), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *DeleteBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *DeleteBackupPolicyPlanOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteBackupPolicyPlanOptions) SetID(id string) *DeleteBackupPolicyPlanOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteBackupPolicyPlanOptions) SetIfMatch(ifMatch string) *DeleteBackupPolicyPlanOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBackupPolicyPlanOptions) SetHeaders(param map[string]string) *DeleteBackupPolicyPlanOptions { + options.Headers = param + return options +} + +// DeleteBareMetalServerNetworkInterfaceOptions : The DeleteBareMetalServerNetworkInterface options. +type DeleteBareMetalServerNetworkInterfaceOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteBareMetalServerNetworkInterfaceOptions : Instantiate DeleteBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewDeleteBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string) *DeleteBareMetalServerNetworkInterfaceOptions { + return &DeleteBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *DeleteBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *DeleteBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteBareMetalServerNetworkInterfaceOptions) SetID(id string) *DeleteBareMetalServerNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options +} + +// DeleteBareMetalServerOptions : The DeleteBareMetalServer options. +type DeleteBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteBareMetalServerOptions : Instantiate DeleteBareMetalServerOptions +func (*VpcV1) NewDeleteBareMetalServerOptions(id string) *DeleteBareMetalServerOptions { + return &DeleteBareMetalServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteBareMetalServerOptions) SetID(id string) *DeleteBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBareMetalServerOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerOptions { + 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 + Headers map[string]string +} + +// NewDeleteDedicatedHostGroupOptions : Instantiate DeleteDedicatedHostGroupOptions +func (*VpcV1) NewDeleteDedicatedHostGroupOptions(id string) *DeleteDedicatedHostGroupOptions { + return &DeleteDedicatedHostGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteDedicatedHostGroupOptions) SetID(id string) *DeleteDedicatedHostGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteDedicatedHostGroupOptions) SetHeaders(param map[string]string) *DeleteDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// DeleteDedicatedHostOptions : The DeleteDedicatedHost options. +type DeleteDedicatedHostOptions struct { + // The dedicated host identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteDedicatedHostOptions : Instantiate DeleteDedicatedHostOptions +func (*VpcV1) NewDeleteDedicatedHostOptions(id string) *DeleteDedicatedHostOptions { + return &DeleteDedicatedHostOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteDedicatedHostOptions) SetID(id string) *DeleteDedicatedHostOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteDedicatedHostOptions) SetHeaders(param map[string]string) *DeleteDedicatedHostOptions { + options.Headers = param + return options +} + +// DeleteEndpointGatewayOptions : The DeleteEndpointGateway options. +type DeleteEndpointGatewayOptions struct { + // The endpoint gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteEndpointGatewayOptions : Instantiate DeleteEndpointGatewayOptions +func (*VpcV1) NewDeleteEndpointGatewayOptions(id string) *DeleteEndpointGatewayOptions { + return &DeleteEndpointGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteEndpointGatewayOptions) SetID(id string) *DeleteEndpointGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteEndpointGatewayOptions) SetHeaders(param map[string]string) *DeleteEndpointGatewayOptions { + options.Headers = param + return options +} + +// DeleteFloatingIPOptions : The DeleteFloatingIP options. +type DeleteFloatingIPOptions struct { + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteFloatingIPOptions : Instantiate DeleteFloatingIPOptions +func (*VpcV1) NewDeleteFloatingIPOptions(id string) *DeleteFloatingIPOptions { + return &DeleteFloatingIPOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteFloatingIPOptions) SetID(id string) *DeleteFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteFloatingIPOptions) SetHeaders(param map[string]string) *DeleteFloatingIPOptions { + options.Headers = param + return options +} + +// DeleteFlowLogCollectorOptions : The DeleteFlowLogCollector options. +type DeleteFlowLogCollectorOptions struct { + // The flow log collector identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteFlowLogCollectorOptions : Instantiate DeleteFlowLogCollectorOptions +func (*VpcV1) NewDeleteFlowLogCollectorOptions(id string) *DeleteFlowLogCollectorOptions { + return &DeleteFlowLogCollectorOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteFlowLogCollectorOptions) SetID(id string) *DeleteFlowLogCollectorOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteFlowLogCollectorOptions) SetHeaders(param map[string]string) *DeleteFlowLogCollectorOptions { + options.Headers = param + return options +} + +// DeleteIkePolicyOptions : The DeleteIkePolicy options. +type DeleteIkePolicyOptions struct { + // The IKE policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteIkePolicyOptions : Instantiate DeleteIkePolicyOptions +func (*VpcV1) NewDeleteIkePolicyOptions(id string) *DeleteIkePolicyOptions { + return &DeleteIkePolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteIkePolicyOptions) SetID(id string) *DeleteIkePolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteIkePolicyOptions) SetHeaders(param map[string]string) *DeleteIkePolicyOptions { + options.Headers = param + return options +} + +// DeleteImageOptions : The DeleteImage options. +type DeleteImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteImageOptions : Instantiate DeleteImageOptions +func (*VpcV1) NewDeleteImageOptions(id string) *DeleteImageOptions { + return &DeleteImageOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteImageOptions) SetID(id string) *DeleteImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteImageOptions) SetHeaders(param map[string]string) *DeleteImageOptions { + 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 + Headers map[string]string +} + +// NewDeleteInstanceGroupLoadBalancerOptions : Instantiate DeleteInstanceGroupLoadBalancerOptions +func (*VpcV1) NewDeleteInstanceGroupLoadBalancerOptions(instanceGroupID string) *DeleteInstanceGroupLoadBalancerOptions { + return &DeleteInstanceGroupLoadBalancerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupLoadBalancerOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupLoadBalancerOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupLoadBalancerOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupLoadBalancerOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupManagerActionOptions : The DeleteInstanceGroupManagerAction options. +type DeleteInstanceGroupManagerActionOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager action identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupManagerActionOptions : Instantiate DeleteInstanceGroupManagerActionOptions +func (*VpcV1) NewDeleteInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string) *DeleteInstanceGroupManagerActionOptions { + return &DeleteInstanceGroupManagerActionOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerActionOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *DeleteInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *DeleteInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupManagerActionOptions) SetID(id string) *DeleteInstanceGroupManagerActionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerActionOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupManagerOptions : The DeleteInstanceGroupManager options. +type DeleteInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupManagerOptions : Instantiate DeleteInstanceGroupManagerOptions +func (*VpcV1) NewDeleteInstanceGroupManagerOptions(instanceGroupID string, id string) *DeleteInstanceGroupManagerOptions { + return &DeleteInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupManagerOptions) SetID(id string) *DeleteInstanceGroupManagerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupManagerOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupManagerPolicyOptions : The DeleteInstanceGroupManagerPolicy options. +type DeleteInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupManagerPolicyOptions : Instantiate DeleteInstanceGroupManagerPolicyOptions +func (*VpcV1) NewDeleteInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string) *DeleteInstanceGroupManagerPolicyOptions { + return &DeleteInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerPolicyOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *DeleteInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *DeleteInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupManagerPolicyOptions) SetID(id string) *DeleteInstanceGroupManagerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupMembershipOptions : The DeleteInstanceGroupMembership options. +type DeleteInstanceGroupMembershipOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group membership identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupMembershipOptions : Instantiate DeleteInstanceGroupMembershipOptions +func (*VpcV1) NewDeleteInstanceGroupMembershipOptions(instanceGroupID string, id string) *DeleteInstanceGroupMembershipOptions { + return &DeleteInstanceGroupMembershipOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupMembershipOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupMembershipOptions) SetID(id string) *DeleteInstanceGroupMembershipOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupMembershipOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupMembershipsOptions : The DeleteInstanceGroupMemberships options. +type DeleteInstanceGroupMembershipsOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupMembershipsOptions : Instantiate DeleteInstanceGroupMembershipsOptions +func (*VpcV1) NewDeleteInstanceGroupMembershipsOptions(instanceGroupID string) *DeleteInstanceGroupMembershipsOptions { + return &DeleteInstanceGroupMembershipsOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupMembershipsOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupMembershipsOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupMembershipsOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupMembershipsOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupOptions : The DeleteInstanceGroup options. +type DeleteInstanceGroupOptions struct { + // The instance group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupOptions : Instantiate DeleteInstanceGroupOptions +func (*VpcV1) NewDeleteInstanceGroupOptions(id string) *DeleteInstanceGroupOptions { + return &DeleteInstanceGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupOptions) SetID(id string) *DeleteInstanceGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupOptions { + options.Headers = param + return options +} + +// DeleteInstanceNetworkInterfaceOptions : The DeleteInstanceNetworkInterface options. +type DeleteInstanceNetworkInterfaceOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceNetworkInterfaceOptions : Instantiate DeleteInstanceNetworkInterfaceOptions +func (*VpcV1) NewDeleteInstanceNetworkInterfaceOptions(instanceID string, id string) *DeleteInstanceNetworkInterfaceOptions { + return &DeleteInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *DeleteInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *DeleteInstanceNetworkInterfaceOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceNetworkInterfaceOptions) SetID(id string) *DeleteInstanceNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *DeleteInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// DeleteInstanceOptions : The DeleteInstance options. +type DeleteInstanceOptions struct { + // The instance identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceOptions : Instantiate DeleteInstanceOptions +func (*VpcV1) NewDeleteInstanceOptions(id string) *DeleteInstanceOptions { + return &DeleteInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceOptions) SetID(id string) *DeleteInstanceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceOptions) SetHeaders(param map[string]string) *DeleteInstanceOptions { + options.Headers = param + return options +} + +// DeleteInstanceTemplateOptions : The DeleteInstanceTemplate options. +type DeleteInstanceTemplateOptions struct { + // The instance template identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceTemplateOptions : Instantiate DeleteInstanceTemplateOptions +func (*VpcV1) NewDeleteInstanceTemplateOptions(id string) *DeleteInstanceTemplateOptions { + return &DeleteInstanceTemplateOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceTemplateOptions) SetID(id string) *DeleteInstanceTemplateOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceTemplateOptions) SetHeaders(param map[string]string) *DeleteInstanceTemplateOptions { + options.Headers = param + return options +} + +// DeleteInstanceVolumeAttachmentOptions : The DeleteInstanceVolumeAttachment options. +type DeleteInstanceVolumeAttachmentOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The volume attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceVolumeAttachmentOptions : Instantiate DeleteInstanceVolumeAttachmentOptions +func (*VpcV1) NewDeleteInstanceVolumeAttachmentOptions(instanceID string, id string) *DeleteInstanceVolumeAttachmentOptions { + return &DeleteInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *DeleteInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceVolumeAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceVolumeAttachmentOptions) SetID(id string) *DeleteInstanceVolumeAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// DeleteIpsecPolicyOptions : The DeleteIpsecPolicy options. +type DeleteIpsecPolicyOptions struct { + // The IPsec policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteIpsecPolicyOptions : Instantiate DeleteIpsecPolicyOptions +func (*VpcV1) NewDeleteIpsecPolicyOptions(id string) *DeleteIpsecPolicyOptions { + return &DeleteIpsecPolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteIpsecPolicyOptions) SetID(id string) *DeleteIpsecPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteIpsecPolicyOptions) SetHeaders(param map[string]string) *DeleteIpsecPolicyOptions { + options.Headers = param + return options +} + +// DeleteKeyOptions : The DeleteKey options. +type DeleteKeyOptions struct { + // The key identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteKeyOptions : Instantiate DeleteKeyOptions +func (*VpcV1) NewDeleteKeyOptions(id string) *DeleteKeyOptions { + return &DeleteKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteKeyOptions) SetID(id string) *DeleteKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteKeyOptions) SetHeaders(param map[string]string) *DeleteKeyOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerListenerOptions : The DeleteLoadBalancerListener options. +type DeleteLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerListenerOptions : Instantiate DeleteLoadBalancerListenerOptions +func (*VpcV1) NewDeleteLoadBalancerListenerOptions(loadBalancerID string, id string) *DeleteLoadBalancerListenerOptions { + return &DeleteLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerListenerOptions) SetID(id string) *DeleteLoadBalancerListenerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerListenerOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerListenerPolicyOptions : The DeleteLoadBalancerListenerPolicy options. +type DeleteLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerListenerPolicyOptions : Instantiate DeleteLoadBalancerListenerPolicyOptions +func (*VpcV1) NewDeleteLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string) *DeleteLoadBalancerListenerPolicyOptions { + return &DeleteLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerPolicyOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *DeleteLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *DeleteLoadBalancerListenerPolicyOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerListenerPolicyOptions) SetID(id string) *DeleteLoadBalancerListenerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerListenerPolicyRuleOptions : The DeleteLoadBalancerListenerPolicyRule options. +type DeleteLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerListenerPolicyRuleOptions : Instantiate DeleteLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewDeleteLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string) *DeleteLoadBalancerListenerPolicyRuleOptions { + return &DeleteLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *DeleteLoadBalancerListenerPolicyRuleOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *DeleteLoadBalancerListenerPolicyRuleOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetID(id string) *DeleteLoadBalancerListenerPolicyRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerOptions : The DeleteLoadBalancer options. +type DeleteLoadBalancerOptions struct { + // The load balancer identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerOptions : Instantiate DeleteLoadBalancerOptions +func (*VpcV1) NewDeleteLoadBalancerOptions(id string) *DeleteLoadBalancerOptions { + return &DeleteLoadBalancerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerOptions) SetID(id string) *DeleteLoadBalancerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerPoolMemberOptions : The DeleteLoadBalancerPoolMember options. +type DeleteLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The member identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerPoolMemberOptions : Instantiate DeleteLoadBalancerPoolMemberOptions +func (*VpcV1) NewDeleteLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string) *DeleteLoadBalancerPoolMemberOptions { + return &DeleteLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerPoolMemberOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *DeleteLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *DeleteLoadBalancerPoolMemberOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerPoolMemberOptions) SetID(id string) *DeleteLoadBalancerPoolMemberOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerPoolOptions : The DeleteLoadBalancerPool options. +type DeleteLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerPoolOptions : Instantiate DeleteLoadBalancerPoolOptions +func (*VpcV1) NewDeleteLoadBalancerPoolOptions(loadBalancerID string, id string) *DeleteLoadBalancerPoolOptions { + return &DeleteLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerPoolOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerPoolOptions) SetID(id string) *DeleteLoadBalancerPoolOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerPoolOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// DeleteNetworkACLOptions : The DeleteNetworkACL options. +type DeleteNetworkACLOptions struct { + // The network ACL identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteNetworkACLOptions : Instantiate DeleteNetworkACLOptions +func (*VpcV1) NewDeleteNetworkACLOptions(id string) *DeleteNetworkACLOptions { + return &DeleteNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteNetworkACLOptions) SetID(id string) *DeleteNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteNetworkACLOptions) SetHeaders(param map[string]string) *DeleteNetworkACLOptions { + options.Headers = param + return options +} + +// DeleteNetworkACLRuleOptions : The DeleteNetworkACLRule options. +type DeleteNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteNetworkACLRuleOptions : Instantiate DeleteNetworkACLRuleOptions +func (*VpcV1) NewDeleteNetworkACLRuleOptions(networkACLID string, id string) *DeleteNetworkACLRuleOptions { + return &DeleteNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + ID: core.StringPtr(id), + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *DeleteNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *DeleteNetworkACLRuleOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteNetworkACLRuleOptions) SetID(id string) *DeleteNetworkACLRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteNetworkACLRuleOptions) SetHeaders(param map[string]string) *DeleteNetworkACLRuleOptions { + options.Headers = param + return options +} + +// DeletePlacementGroupOptions : The DeletePlacementGroup options. +type DeletePlacementGroupOptions struct { + // The placement group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeletePlacementGroupOptions : Instantiate DeletePlacementGroupOptions +func (*VpcV1) NewDeletePlacementGroupOptions(id string) *DeletePlacementGroupOptions { + return &DeletePlacementGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeletePlacementGroupOptions) SetID(id string) *DeletePlacementGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeletePlacementGroupOptions) SetHeaders(param map[string]string) *DeletePlacementGroupOptions { + options.Headers = param + return options +} + +// DeletePublicGatewayOptions : The DeletePublicGateway options. +type DeletePublicGatewayOptions struct { + // The public gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeletePublicGatewayOptions : Instantiate DeletePublicGatewayOptions +func (*VpcV1) NewDeletePublicGatewayOptions(id string) *DeletePublicGatewayOptions { + return &DeletePublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeletePublicGatewayOptions) SetID(id string) *DeletePublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeletePublicGatewayOptions) SetHeaders(param map[string]string) *DeletePublicGatewayOptions { + options.Headers = param + return options +} + +// DeleteSecurityGroupOptions : The DeleteSecurityGroup options. +type DeleteSecurityGroupOptions struct { + // The security group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSecurityGroupOptions : Instantiate DeleteSecurityGroupOptions +func (*VpcV1) NewDeleteSecurityGroupOptions(id string) *DeleteSecurityGroupOptions { + return &DeleteSecurityGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteSecurityGroupOptions) SetID(id string) *DeleteSecurityGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSecurityGroupOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupOptions { + options.Headers = param + return options +} + +// DeleteSecurityGroupRuleOptions : The DeleteSecurityGroupRule options. +type DeleteSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSecurityGroupRuleOptions : Instantiate DeleteSecurityGroupRuleOptions +func (*VpcV1) NewDeleteSecurityGroupRuleOptions(securityGroupID string, id string) *DeleteSecurityGroupRuleOptions { + return &DeleteSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *DeleteSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *DeleteSecurityGroupRuleOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteSecurityGroupRuleOptions) SetID(id string) *DeleteSecurityGroupRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSecurityGroupRuleOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// DeleteSecurityGroupTargetBindingOptions : The DeleteSecurityGroupTargetBinding options. +type DeleteSecurityGroupTargetBindingOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The security group target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSecurityGroupTargetBindingOptions : Instantiate DeleteSecurityGroupTargetBindingOptions +func (*VpcV1) NewDeleteSecurityGroupTargetBindingOptions(securityGroupID string, id string) *DeleteSecurityGroupTargetBindingOptions { + return &DeleteSecurityGroupTargetBindingOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *DeleteSecurityGroupTargetBindingOptions) SetSecurityGroupID(securityGroupID string) *DeleteSecurityGroupTargetBindingOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteSecurityGroupTargetBindingOptions) SetID(id string) *DeleteSecurityGroupTargetBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSecurityGroupTargetBindingOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupTargetBindingOptions { + options.Headers = param + return options +} + +// DeleteSnapshotOptions : The DeleteSnapshot options. +type DeleteSnapshotOptions struct { + // The snapshot 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 +} + +// NewDeleteSnapshotOptions : Instantiate DeleteSnapshotOptions +func (*VpcV1) NewDeleteSnapshotOptions(id string) *DeleteSnapshotOptions { + return &DeleteSnapshotOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteSnapshotOptions) SetID(id string) *DeleteSnapshotOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteSnapshotOptions) SetIfMatch(ifMatch string) *DeleteSnapshotOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSnapshotOptions) SetHeaders(param map[string]string) *DeleteSnapshotOptions { + options.Headers = param + return options +} + +// DeleteSnapshotsOptions : The DeleteSnapshots options. +type DeleteSnapshotsOptions struct { + // Filters the collection to resources with the source volume with the specified identifier. + SourceVolumeID *string `json:"source_volume.id" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSnapshotsOptions : Instantiate DeleteSnapshotsOptions +func (*VpcV1) NewDeleteSnapshotsOptions(sourceVolumeID string) *DeleteSnapshotsOptions { + return &DeleteSnapshotsOptions{ + SourceVolumeID: core.StringPtr(sourceVolumeID), + } +} + +// SetSourceVolumeID : Allow user to set SourceVolumeID +func (_options *DeleteSnapshotsOptions) SetSourceVolumeID(sourceVolumeID string) *DeleteSnapshotsOptions { + _options.SourceVolumeID = core.StringPtr(sourceVolumeID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSnapshotsOptions) SetHeaders(param map[string]string) *DeleteSnapshotsOptions { + options.Headers = param + return options +} + +// DeleteSubnetOptions : The DeleteSubnet options. +type DeleteSubnetOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSubnetOptions : Instantiate DeleteSubnetOptions +func (*VpcV1) NewDeleteSubnetOptions(id string) *DeleteSubnetOptions { + return &DeleteSubnetOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteSubnetOptions) SetID(id string) *DeleteSubnetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSubnetOptions) SetHeaders(param map[string]string) *DeleteSubnetOptions { + options.Headers = param + return options +} + +// DeleteSubnetReservedIPOptions : The DeleteSubnetReservedIP options. +type DeleteSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `json:"subnet_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 +} + +// NewDeleteSubnetReservedIPOptions : Instantiate DeleteSubnetReservedIPOptions +func (*VpcV1) NewDeleteSubnetReservedIPOptions(subnetID string, id string) *DeleteSubnetReservedIPOptions { + return &DeleteSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + ID: core.StringPtr(id), + } +} + +// SetSubnetID : Allow user to set SubnetID +func (_options *DeleteSubnetReservedIPOptions) SetSubnetID(subnetID string) *DeleteSubnetReservedIPOptions { + _options.SubnetID = core.StringPtr(subnetID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteSubnetReservedIPOptions) SetID(id string) *DeleteSubnetReservedIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSubnetReservedIPOptions) SetHeaders(param map[string]string) *DeleteSubnetReservedIPOptions { + options.Headers = param + return options +} + +// DeleteVolumeOptions : The DeleteVolume options. +type DeleteVolumeOptions struct { + // The volume 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 +} + +// NewDeleteVolumeOptions : Instantiate DeleteVolumeOptions +func (*VpcV1) NewDeleteVolumeOptions(id string) *DeleteVolumeOptions { + return &DeleteVolumeOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVolumeOptions) SetID(id string) *DeleteVolumeOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteVolumeOptions) SetIfMatch(ifMatch string) *DeleteVolumeOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVolumeOptions) SetHeaders(param map[string]string) *DeleteVolumeOptions { + options.Headers = param + return options +} + +// DeleteVPCAddressPrefixOptions : The DeleteVPCAddressPrefix options. +type DeleteVPCAddressPrefixOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The prefix identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCAddressPrefixOptions : Instantiate DeleteVPCAddressPrefixOptions +func (*VpcV1) NewDeleteVPCAddressPrefixOptions(vpcID string, id string) *DeleteVPCAddressPrefixOptions { + return &DeleteVPCAddressPrefixOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *DeleteVPCAddressPrefixOptions) SetVPCID(vpcID string) *DeleteVPCAddressPrefixOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCAddressPrefixOptions) SetID(id string) *DeleteVPCAddressPrefixOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCAddressPrefixOptions) SetHeaders(param map[string]string) *DeleteVPCAddressPrefixOptions { + options.Headers = param + return options +} + +// DeleteVPCOptions : The DeleteVPC options. +type DeleteVPCOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCOptions : Instantiate DeleteVPCOptions +func (*VpcV1) NewDeleteVPCOptions(id string) *DeleteVPCOptions { + return &DeleteVPCOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCOptions) SetID(id string) *DeleteVPCOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCOptions) SetHeaders(param map[string]string) *DeleteVPCOptions { + options.Headers = param + return options +} + +// DeleteVPCRouteOptions : The DeleteVPCRoute options. +type DeleteVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCRouteOptions : Instantiate DeleteVPCRouteOptions +func (*VpcV1) NewDeleteVPCRouteOptions(vpcID string, id string) *DeleteVPCRouteOptions { + return &DeleteVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *DeleteVPCRouteOptions) SetVPCID(vpcID string) *DeleteVPCRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCRouteOptions) SetID(id string) *DeleteVPCRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCRouteOptions) SetHeaders(param map[string]string) *DeleteVPCRouteOptions { + options.Headers = param + return options +} + +// DeleteVPCRoutingTableOptions : The DeleteVPCRoutingTable options. +type DeleteVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table 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 +} + +// NewDeleteVPCRoutingTableOptions : Instantiate DeleteVPCRoutingTableOptions +func (*VpcV1) NewDeleteVPCRoutingTableOptions(vpcID string, id string) *DeleteVPCRoutingTableOptions { + return &DeleteVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *DeleteVPCRoutingTableOptions) SetVPCID(vpcID string) *DeleteVPCRoutingTableOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCRoutingTableOptions) SetID(id string) *DeleteVPCRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteVPCRoutingTableOptions) SetIfMatch(ifMatch string) *DeleteVPCRoutingTableOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCRoutingTableOptions) SetHeaders(param map[string]string) *DeleteVPCRoutingTableOptions { + options.Headers = param + return options +} + +// DeleteVPCRoutingTableRouteOptions : The DeleteVPCRoutingTableRoute options. +type DeleteVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` + + // The VPC routing table route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCRoutingTableRouteOptions : Instantiate DeleteVPCRoutingTableRouteOptions +func (*VpcV1) NewDeleteVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string) *DeleteVPCRoutingTableRouteOptions { + return &DeleteVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *DeleteVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *DeleteVPCRoutingTableRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *DeleteVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *DeleteVPCRoutingTableRouteOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCRoutingTableRouteOptions) SetID(id string) *DeleteVPCRoutingTableRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *DeleteVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// DeleteVPNGatewayConnectionOptions : The DeleteVPNGatewayConnection options. +type DeleteVPNGatewayConnectionOptions 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="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNGatewayConnectionOptions : Instantiate DeleteVPNGatewayConnectionOptions +func (*VpcV1) NewDeleteVPNGatewayConnectionOptions(vpnGatewayID string, id string) *DeleteVPNGatewayConnectionOptions { + return &DeleteVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *DeleteVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *DeleteVPNGatewayConnectionOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNGatewayConnectionOptions) SetID(id string) *DeleteVPNGatewayConnectionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *DeleteVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// DeleteVPNGatewayOptions : The DeleteVPNGateway options. +type DeleteVPNGatewayOptions struct { + // The VPN gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNGatewayOptions : Instantiate DeleteVPNGatewayOptions +func (*VpcV1) NewDeleteVPNGatewayOptions(id string) *DeleteVPNGatewayOptions { + return &DeleteVPNGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNGatewayOptions) SetID(id string) *DeleteVPNGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNGatewayOptions) SetHeaders(param map[string]string) *DeleteVPNGatewayOptions { + options.Headers = param + return options +} + +// DeleteVPNServerClientOptions : The DeleteVPNServerClient options. +type DeleteVPNServerClientOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN client identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNServerClientOptions : Instantiate DeleteVPNServerClientOptions +func (*VpcV1) NewDeleteVPNServerClientOptions(vpnServerID string, id string) *DeleteVPNServerClientOptions { + return &DeleteVPNServerClientOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *DeleteVPNServerClientOptions) SetVPNServerID(vpnServerID string) *DeleteVPNServerClientOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNServerClientOptions) SetID(id string) *DeleteVPNServerClientOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNServerClientOptions) SetHeaders(param map[string]string) *DeleteVPNServerClientOptions { + options.Headers = param + return options +} + +// DeleteVPNServerOptions : The DeleteVPNServer options. +type DeleteVPNServerOptions struct { + // The VPN server 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 +} + +// NewDeleteVPNServerOptions : Instantiate DeleteVPNServerOptions +func (*VpcV1) NewDeleteVPNServerOptions(id string) *DeleteVPNServerOptions { + return &DeleteVPNServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNServerOptions) SetID(id string) *DeleteVPNServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteVPNServerOptions) SetIfMatch(ifMatch string) *DeleteVPNServerOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNServerOptions) SetHeaders(param map[string]string) *DeleteVPNServerOptions { + options.Headers = param + return options +} + +// DeleteVPNServerRouteOptions : The DeleteVPNServerRoute options. +type DeleteVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNServerRouteOptions : Instantiate DeleteVPNServerRouteOptions +func (*VpcV1) NewDeleteVPNServerRouteOptions(vpnServerID string, id string) *DeleteVPNServerRouteOptions { + return &DeleteVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *DeleteVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *DeleteVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNServerRouteOptions) SetID(id string) *DeleteVPNServerRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNServerRouteOptions) SetHeaders(param map[string]string) *DeleteVPNServerRouteOptions { + options.Headers = param + return options +} + +// DisconnectVPNClientOptions : The DisconnectVPNClient options. +type DisconnectVPNClientOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN client identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDisconnectVPNClientOptions : Instantiate DisconnectVPNClientOptions +func (*VpcV1) NewDisconnectVPNClientOptions(vpnServerID string, id string) *DisconnectVPNClientOptions { + return &DisconnectVPNClientOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *DisconnectVPNClientOptions) SetVPNServerID(vpnServerID string) *DisconnectVPNClientOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DisconnectVPNClientOptions) SetID(id string) *DisconnectVPNClientOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DisconnectVPNClientOptions) SetHeaders(param map[string]string) *DisconnectVPNClientOptions { + options.Headers = param + return options +} + +// EncryptionKeyIdentity : Identifies an encryption key by a unique property. +// Models which "extend" this model: +// - EncryptionKeyIdentityByCRN +type EncryptionKeyIdentity struct { + // The CRN of the [Key Protect Root + // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto + // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. + CRN *string `json:"crn,omitempty"` +} + +func (*EncryptionKeyIdentity) isaEncryptionKeyIdentity() bool { + return true +} + +type EncryptionKeyIdentityIntf interface { + isaEncryptionKeyIdentity() bool +} + +// UnmarshalEncryptionKeyIdentity unmarshals an instance of EncryptionKeyIdentity from the specified map of raw messages. +func UnmarshalEncryptionKeyIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EncryptionKeyIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EncryptionKeyReference : EncryptionKeyReference struct +type EncryptionKeyReference struct { + // The CRN of the [Key Protect Root + // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto + // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. + CRN *string `json:"crn" validate:"required"` +} + +// UnmarshalEncryptionKeyReference unmarshals an instance of EncryptionKeyReference from the specified map of raw messages. +func UnmarshalEncryptionKeyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EncryptionKeyReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGateway : EndpointGateway struct +type EndpointGateway struct { + // The date and time that the endpoint gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this endpoint gateway. + CRN *string `json:"crn" 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 endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // The reserved IPs bound to this endpoint gateway. + Ips []ReservedIPReference `json:"ips" validate:"required"` + + // The lifecycle state of the endpoint gateway. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The unique user-defined name for this endpoint gateway. + Name *string `json:"name" validate:"required"` + + // The resource group for this endpoint gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups targeting this endpoint gateway. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The fully qualified domain name for the target service. + ServiceEndpoint *string `json:"service_endpoint,omitempty"` + + // The fully qualified domain names for the target service. + ServiceEndpoints []string `json:"service_endpoints" validate:"required"` + + // The target for this endpoint gateway. + Target EndpointGatewayTargetIntf `json:"target" validate:"required"` + + // The VPC this endpoint gateway is serving. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the EndpointGateway.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 ( + EndpointGatewayHealthStateDegradedConst = "degraded" + EndpointGatewayHealthStateFaultedConst = "faulted" + EndpointGatewayHealthStateInapplicableConst = "inapplicable" + EndpointGatewayHealthStateOkConst = "ok" +) + +// Constants associated with the EndpointGateway.LifecycleState property. +// The lifecycle state of the endpoint gateway. +const ( + EndpointGatewayLifecycleStateDeletingConst = "deleting" + EndpointGatewayLifecycleStateFailedConst = "failed" + EndpointGatewayLifecycleStatePendingConst = "pending" + EndpointGatewayLifecycleStateStableConst = "stable" + EndpointGatewayLifecycleStateSuspendedConst = "suspended" + EndpointGatewayLifecycleStateUpdatingConst = "updating" + EndpointGatewayLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the EndpointGateway.ResourceType property. +// The resource type. +const ( + EndpointGatewayResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +// UnmarshalEndpointGateway unmarshals an instance of EndpointGateway from the specified map of raw messages. +func UnmarshalEndpointGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGateway) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_endpoint", &obj.ServiceEndpoint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_endpoints", &obj.ServiceEndpoints) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalEndpointGatewayTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayCollection : EndpointGatewayCollection struct +type EndpointGatewayCollection struct { + // Collection of endpoint gateways. + EndpointGateways []EndpointGateway `json:"endpoint_gateways" validate:"required"` + + // A link to the first page of resources. + First *EndpointGatewayCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalEndpointGatewayCollection unmarshals an instance of EndpointGatewayCollection from the specified map of raw messages. +func UnmarshalEndpointGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayCollection) + err = core.UnmarshalModel(m, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGateway) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalEndpointGatewayCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalEndpointGatewayCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *EndpointGatewayCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayPatch : EndpointGatewayPatch struct +type EndpointGatewayPatch struct { + // The user-defined name for this endpoint gateway. Names must be unique within the VPC this endpoint gateway is + // serving. + Name *string `json:"name,omitempty"` +} + +// UnmarshalEndpointGatewayPatch unmarshals an instance of EndpointGatewayPatch from the specified map of raw messages. +func UnmarshalEndpointGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// EndpointGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type EndpointGatewayReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalEndpointGatewayReferenceDeleted unmarshals an instance of EndpointGatewayReferenceDeleted from the specified map of raw messages. +func UnmarshalEndpointGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIP : A reserved IP to bind to the endpoint gateway. This can be specified using an existing reserved IP, or a prototype +// object for a new reserved IP. The reserved IP will be bound to the endpoint gateway to function as a virtual private +// endpoint for the service. +// Models which "extend" this model: +// - EndpointGatewayReservedIPReservedIPIdentity +// - EndpointGatewayReservedIPReservedIPPrototypeTargetContext +type EndpointGatewayReservedIP struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` + + // 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The user-defined name for this reserved IP. If unspecified, the name will be a hyphenated list of randomly-selected + // words. Names must be unique within the subnet the reserved IP resides in. Names beginning with `ibm-` are reserved + // for provider-owned resources. + Name *string `json:"name,omitempty"` + + // The subnet in which to create this reserved IP. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` +} + +func (*EndpointGatewayReservedIP) isaEndpointGatewayReservedIP() bool { + return true +} + +type EndpointGatewayReservedIPIntf interface { + isaEndpointGatewayReservedIP() bool +} + +// UnmarshalEndpointGatewayReservedIP unmarshals an instance of EndpointGatewayReservedIP from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIP) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTarget : The target for this endpoint gateway. +// Models which "extend" this model: +// - EndpointGatewayTargetProviderCloudServiceReference +// - EndpointGatewayTargetProviderInfrastructureServiceReference +type EndpointGatewayTarget struct { + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn,omitempty"` + + // The type of target. + ResourceType *string `json:"resource_type,omitempty"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the EndpointGatewayTarget.ResourceType property. +// The type of target. +const ( + EndpointGatewayTargetResourceTypeProviderCloudServiceConst = "provider_cloud_service" +) + +func (*EndpointGatewayTarget) isaEndpointGatewayTarget() bool { + return true +} + +type EndpointGatewayTargetIntf interface { + isaEndpointGatewayTarget() bool +} + +// 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, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototype : The target for this endpoint gateway. +// Models which "extend" this model: +// - EndpointGatewayTargetPrototypeProviderCloudServiceIdentity +// - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity +type EndpointGatewayTargetPrototype struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn,omitempty"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the EndpointGatewayTargetPrototype.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetPrototype) isaEndpointGatewayTargetPrototype() bool { + return true +} + +type EndpointGatewayTargetPrototypeIntf interface { + isaEndpointGatewayTargetPrototype() bool +} + +// UnmarshalEndpointGatewayTargetPrototype unmarshals an instance of EndpointGatewayTargetPrototype from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "resource_type", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'resource_type': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'resource_type' not found in JSON object") + return + } + if discValue == "provider_cloud_service" { + err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity) + } else if discValue == "provider_infrastructure_service" { + err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'resource_type': %s", discValue) + } + return +} + +// FloatingIP : FloatingIP struct +type FloatingIP struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` + + // The date and time that the floating IP was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` + + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this floating IP. + Name *string `json:"name" validate:"required"` + + // The resource group for this floating IP. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The status of the floating IP. + Status *string `json:"status" validate:"required"` + + // The target of this floating IP. + Target FloatingIPTargetIntf `json:"target,omitempty"` + + // The zone this floating IP resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the FloatingIP.Status property. +// The status of the floating IP. +const ( + FloatingIPStatusAvailableConst = "available" + FloatingIPStatusDeletingConst = "deleting" + FloatingIPStatusFailedConst = "failed" + FloatingIPStatusPendingConst = "pending" +) + +// UnmarshalFloatingIP unmarshals an instance of FloatingIP from the specified map of raw messages. +func UnmarshalFloatingIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPByTargetNetworkInterfaceIdentity : The network interface this floating IP is to be bound to. +// Models which "extend" this model: +// - FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID +// - FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref +type FloatingIPByTargetNetworkInterfaceIdentity struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` +} + +func (*FloatingIPByTargetNetworkInterfaceIdentity) isaFloatingIPByTargetNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPByTargetNetworkInterfaceIdentityIntf interface { + isaFloatingIPByTargetNetworkInterfaceIdentity() bool +} + +// UnmarshalFloatingIPByTargetNetworkInterfaceIdentity unmarshals an instance of FloatingIPByTargetNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPByTargetNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPByTargetNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPCollection : FloatingIPCollection struct +type FloatingIPCollection struct { + // A link to the first page of resources. + First *FloatingIPCollectionFirst `json:"first" validate:"required"` + + // Collection of floating IPs. + FloatingIps []FloatingIP `json:"floating_ips" 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 *FloatingIPCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFloatingIPCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *FloatingIPCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPPatch : FloatingIPPatch struct +type FloatingIPPatch struct { + // The unique user-defined name for this floating IP. + Name *string `json:"name,omitempty"` + + // The network interface to bind the floating IP to, replacing any existing binding. For + // this request to succeed, the floating IP must not be required by another resource, such + // as a public gateway. + Target FloatingIPTargetPatchIntf `json:"target,omitempty"` +} + +// UnmarshalFloatingIPPatch unmarshals an instance of FloatingIPPatch from the specified map of raw messages. +func UnmarshalFloatingIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// FloatingIPPrototype : FloatingIPPrototype struct +// Models which "extend" this model: +// - FloatingIPPrototypeFloatingIPByZone +// - FloatingIPPrototypeFloatingIPByTarget +type FloatingIPPrototype struct { + // The unique user-defined name for this floating IP. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The zone this floating IP will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // The network interface this floating IP is to be bound to. + Target FloatingIPByTargetNetworkInterfaceIdentityIntf `json:"target,omitempty"` +} + +func (*FloatingIPPrototype) isaFloatingIPPrototype() bool { + return true +} + +type FloatingIPPrototypeIntf interface { + isaFloatingIPPrototype() bool +} + +// UnmarshalFloatingIPPrototype unmarshals an instance of FloatingIPPrototype from the specified map of raw messages. +func UnmarshalFloatingIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPByTargetNetworkInterfaceIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPReference : FloatingIPReference struct +type FloatingIPReference struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` + + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this floating IP. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalFloatingIPReference unmarshals an instance of FloatingIPReference from the specified map of raw messages. +func UnmarshalFloatingIPReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPReference) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type FloatingIPReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalFloatingIPReferenceDeleted unmarshals an instance of FloatingIPReferenceDeleted from the specified map of raw messages. +func UnmarshalFloatingIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTarget : The target of this floating IP. +// Models which "extend" this model: +// - FloatingIPTargetNetworkInterfaceReference +// - FloatingIPTargetPublicGatewayReference +type FloatingIPTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` + + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The user-defined name for this network interface. + Name *string `json:"name,omitempty"` + + PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The CRN for this public gateway. + CRN *string `json:"crn,omitempty"` +} + +// Constants associated with the FloatingIPTarget.ResourceType property. +// The resource type. +const ( + FloatingIPTargetResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FloatingIPTarget) isaFloatingIPTarget() bool { + return true +} + +type FloatingIPTargetIntf interface { + isaFloatingIPTarget() bool +} + +// UnmarshalFloatingIPTarget unmarshals an instance of FloatingIPTarget from the specified map of raw messages. +func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatch : The network interface to bind the floating IP to, replacing any existing binding. For this request to succeed, the +// floating IP must not be required by another resource, such as a public gateway. +// Models which "extend" this model: +// - FloatingIPTargetPatchNetworkInterfaceIdentityByID +// - FloatingIPTargetPatchNetworkInterfaceIdentityByHref +type FloatingIPTargetPatch struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` +} + +func (*FloatingIPTargetPatch) isaFloatingIPTargetPatch() bool { + return true +} + +type FloatingIPTargetPatchIntf interface { + isaFloatingIPTargetPatch() bool +} + +// UnmarshalFloatingIPTargetPatch unmarshals an instance of FloatingIPTargetPatch from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPUnpaginatedCollection : FloatingIPUnpaginatedCollection struct +type FloatingIPUnpaginatedCollection struct { + // Collection of floating IPs. + FloatingIps []FloatingIP `json:"floating_ips" validate:"required"` +} + +// UnmarshalFloatingIPUnpaginatedCollection unmarshals an instance of FloatingIPUnpaginatedCollection from the specified map of raw messages. +func UnmarshalFloatingIPUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPUnpaginatedCollection) + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollector : FlowLogCollector struct +type FlowLogCollector struct { + // Indicates whether this collector is active. + Active *bool `json:"active" validate:"required"` + + // Indicates whether this flow log collector will be automatically deleted when `target` is deleted. At present, this + // is always `true`, but may be modifiable in the future. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // The date and time that the flow log collector was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this flow log collector. + CRN *string `json:"crn" validate:"required"` + + // The URL for this flow log collector. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this flow log collector. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the flow log collector. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The unique user-defined name for this flow log collector. + Name *string `json:"name" validate:"required"` + + // The resource group for this flow log collector. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The Cloud Object Storage bucket where the collected flows are logged. + StorageBucket *LegacyCloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` + + // The target this collector is collecting flow logs for. If the target is an instance, + // subnet, or VPC, flow logs will not be collected for any network interfaces within the + // target that are themselves the target of a more specific flow log collector. + Target FlowLogCollectorTargetIntf `json:"target" validate:"required"` + + // The VPC this flow log collector is associated with. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the FlowLogCollector.LifecycleState property. +// The lifecycle state of the flow log collector. +const ( + FlowLogCollectorLifecycleStateDeletingConst = "deleting" + FlowLogCollectorLifecycleStateFailedConst = "failed" + FlowLogCollectorLifecycleStatePendingConst = "pending" + FlowLogCollectorLifecycleStateStableConst = "stable" + FlowLogCollectorLifecycleStateSuspendedConst = "suspended" + FlowLogCollectorLifecycleStateUpdatingConst = "updating" + FlowLogCollectorLifecycleStateWaitingConst = "waiting" +) + +// UnmarshalFlowLogCollector unmarshals an instance of FlowLogCollector from the specified map of raw messages. +func UnmarshalFlowLogCollector(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollector) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalLegacyCloudObjectStorageBucketReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFlowLogCollectorTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorCollection : FlowLogCollectorCollection struct +type FlowLogCollectorCollection struct { + // A link to the first page of resources. + First *FlowLogCollectorCollectionFirst `json:"first" validate:"required"` + + // Collection of flow log collectors. + FlowLogCollectors []FlowLogCollector `json:"flow_log_collectors" 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 *FlowLogCollectorCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "flow_log_collectors", &obj.FlowLogCollectors, UnmarshalFlowLogCollector) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFlowLogCollectorCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *FlowLogCollectorCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 + // activates the collector. + Active *bool `json:"active,omitempty"` + + // The unique user-defined name for this flow log collector. + Name *string `json:"name,omitempty"` +} + +// UnmarshalFlowLogCollectorPatch unmarshals an instance of FlowLogCollectorPatch from the specified map of raw messages. +func UnmarshalFlowLogCollectorPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorPatch) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// FlowLogCollectorTarget : The target this collector is collecting flow logs for. If the target is an instance, subnet, or VPC, flow logs will +// not be collected for any network interfaces within the target that are themselves the target of a more specific flow +// log collector. +// Models which "extend" this model: +// - FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext +// - FlowLogCollectorTargetInstanceReference +// - FlowLogCollectorTargetSubnetReference +// - FlowLogCollectorTargetVPCReference +type FlowLogCollectorTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` + + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The user-defined name for this network interface. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` +} + +// Constants associated with the FlowLogCollectorTarget.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FlowLogCollectorTarget) isaFlowLogCollectorTarget() bool { + return true +} + +type FlowLogCollectorTargetIntf interface { + isaFlowLogCollectorTarget() bool +} + +// UnmarshalFlowLogCollectorTarget unmarshals an instance of FlowLogCollectorTarget from the specified map of raw messages. +func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototype : The target this collector will collect flow logs for. If the target is an instance, subnet, or VPC, flow logs will +// not be collected for any network interfaces within the target that are themselves the target of a more specific flow +// log collector. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity +// - FlowLogCollectorTargetPrototypeInstanceIdentity +// - FlowLogCollectorTargetPrototypeSubnetIdentity +// - FlowLogCollectorTargetPrototypeVPCIdentity +type FlowLogCollectorTargetPrototype struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` +} + +func (*FlowLogCollectorTargetPrototype) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +type FlowLogCollectorTargetPrototypeIntf interface { + isaFlowLogCollectorTargetPrototype() bool +} + +// UnmarshalFlowLogCollectorTargetPrototype unmarshals an instance of FlowLogCollectorTargetPrototype from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// GenericResourceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type GenericResourceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalGenericResourceReferenceDeleted unmarshals an instance of GenericResourceReferenceDeleted from the specified map of raw messages. +func UnmarshalGenericResourceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(GenericResourceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// GetBackupPolicyOptions : The GetBackupPolicy options. +type GetBackupPolicyOptions struct { + // The backup policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBackupPolicyOptions : Instantiate GetBackupPolicyOptions +func (*VpcV1) NewGetBackupPolicyOptions(id string) *GetBackupPolicyOptions { + return &GetBackupPolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetBackupPolicyOptions) SetID(id string) *GetBackupPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBackupPolicyOptions) SetHeaders(param map[string]string) *GetBackupPolicyOptions { + options.Headers = param + return options +} + +// GetBackupPolicyPlanOptions : The GetBackupPolicyPlan options. +type GetBackupPolicyPlanOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // The backup policy plan identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBackupPolicyPlanOptions : Instantiate GetBackupPolicyPlanOptions +func (*VpcV1) NewGetBackupPolicyPlanOptions(backupPolicyID string, id string) *GetBackupPolicyPlanOptions { + return &GetBackupPolicyPlanOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + ID: core.StringPtr(id), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *GetBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *GetBackupPolicyPlanOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBackupPolicyPlanOptions) SetID(id string) *GetBackupPolicyPlanOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBackupPolicyPlanOptions) SetHeaders(param map[string]string) *GetBackupPolicyPlanOptions { + options.Headers = param + return options +} + +// GetBareMetalServerDiskOptions : The GetBareMetalServerDisk options. +type GetBareMetalServerDiskOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerDiskOptions : Instantiate GetBareMetalServerDiskOptions +func (*VpcV1) NewGetBareMetalServerDiskOptions(bareMetalServerID string, id string) *GetBareMetalServerDiskOptions { + return &GetBareMetalServerDiskOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *GetBareMetalServerDiskOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerDiskOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerDiskOptions) SetID(id string) *GetBareMetalServerDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerDiskOptions) SetHeaders(param map[string]string) *GetBareMetalServerDiskOptions { + options.Headers = param + return options +} + +// GetBareMetalServerInitializationOptions : The GetBareMetalServerInitialization options. +type GetBareMetalServerInitializationOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerInitializationOptions : Instantiate GetBareMetalServerInitializationOptions +func (*VpcV1) NewGetBareMetalServerInitializationOptions(id string) *GetBareMetalServerInitializationOptions { + return &GetBareMetalServerInitializationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerInitializationOptions) SetID(id string) *GetBareMetalServerInitializationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerInitializationOptions) SetHeaders(param map[string]string) *GetBareMetalServerInitializationOptions { + options.Headers = param + return options +} + +// GetBareMetalServerNetworkInterfaceFloatingIPOptions : The GetBareMetalServerNetworkInterfaceFloatingIP options. +type GetBareMetalServerNetworkInterfaceFloatingIPOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The 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 +} + +// NewGetBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate GetBareMetalServerNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewGetBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { + return &GetBareMetalServerNetworkInterfaceFloatingIPOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// GetBareMetalServerNetworkInterfaceOptions : The GetBareMetalServerNetworkInterface options. +type GetBareMetalServerNetworkInterfaceOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerNetworkInterfaceOptions : Instantiate GetBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewGetBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string) *GetBareMetalServerNetworkInterfaceOptions { + return &GetBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *GetBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerNetworkInterfaceOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options +} + +// GetBareMetalServerOptions : The GetBareMetalServer options. +type GetBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerOptions : Instantiate GetBareMetalServerOptions +func (*VpcV1) NewGetBareMetalServerOptions(id string) *GetBareMetalServerOptions { + return &GetBareMetalServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerOptions) SetID(id string) *GetBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerOptions) SetHeaders(param map[string]string) *GetBareMetalServerOptions { + options.Headers = param + return options +} + +// GetBareMetalServerProfileOptions : The GetBareMetalServerProfile options. +type GetBareMetalServerProfileOptions struct { + // The bare metal server profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerProfileOptions : Instantiate GetBareMetalServerProfileOptions +func (*VpcV1) NewGetBareMetalServerProfileOptions(name string) *GetBareMetalServerProfileOptions { + return &GetBareMetalServerProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetBareMetalServerProfileOptions) SetName(name string) *GetBareMetalServerProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerProfileOptions) SetHeaders(param map[string]string) *GetBareMetalServerProfileOptions { + options.Headers = param + return options +} + +// GetDedicatedHostDiskOptions : The GetDedicatedHostDisk options. +type GetDedicatedHostDiskOptions struct { + // The dedicated host identifier. + DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="` + + // The dedicated host disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostDiskOptions : Instantiate GetDedicatedHostDiskOptions +func (*VpcV1) NewGetDedicatedHostDiskOptions(dedicatedHostID string, id string) *GetDedicatedHostDiskOptions { + return &GetDedicatedHostDiskOptions{ + DedicatedHostID: core.StringPtr(dedicatedHostID), + ID: core.StringPtr(id), + } +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (_options *GetDedicatedHostDiskOptions) SetDedicatedHostID(dedicatedHostID string) *GetDedicatedHostDiskOptions { + _options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetDedicatedHostDiskOptions) SetID(id string) *GetDedicatedHostDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostDiskOptions) SetHeaders(param map[string]string) *GetDedicatedHostDiskOptions { + options.Headers = param + return options +} + +// GetDedicatedHostGroupOptions : The GetDedicatedHostGroup options. +type GetDedicatedHostGroupOptions struct { + // The dedicated host group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostGroupOptions : Instantiate GetDedicatedHostGroupOptions +func (*VpcV1) NewGetDedicatedHostGroupOptions(id string) *GetDedicatedHostGroupOptions { + return &GetDedicatedHostGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetDedicatedHostGroupOptions) SetID(id string) *GetDedicatedHostGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostGroupOptions) SetHeaders(param map[string]string) *GetDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// GetDedicatedHostOptions : The GetDedicatedHost options. +type GetDedicatedHostOptions struct { + // The dedicated host identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostOptions : Instantiate GetDedicatedHostOptions +func (*VpcV1) NewGetDedicatedHostOptions(id string) *GetDedicatedHostOptions { + return &GetDedicatedHostOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetDedicatedHostOptions) SetID(id string) *GetDedicatedHostOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostOptions) SetHeaders(param map[string]string) *GetDedicatedHostOptions { + options.Headers = param + return options +} + +// GetDedicatedHostProfileOptions : The GetDedicatedHostProfile options. +type GetDedicatedHostProfileOptions struct { + // The dedicated host profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostProfileOptions : Instantiate GetDedicatedHostProfileOptions +func (*VpcV1) NewGetDedicatedHostProfileOptions(name string) *GetDedicatedHostProfileOptions { + return &GetDedicatedHostProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetDedicatedHostProfileOptions) SetName(name string) *GetDedicatedHostProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostProfileOptions) SetHeaders(param map[string]string) *GetDedicatedHostProfileOptions { + options.Headers = param + return options +} + +// GetEndpointGatewayIPOptions : The GetEndpointGatewayIP options. +type GetEndpointGatewayIPOptions 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 +} + +// NewGetEndpointGatewayIPOptions : Instantiate GetEndpointGatewayIPOptions +func (*VpcV1) NewGetEndpointGatewayIPOptions(endpointGatewayID string, id string) *GetEndpointGatewayIPOptions { + return &GetEndpointGatewayIPOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + ID: core.StringPtr(id), + } +} + +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (_options *GetEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *GetEndpointGatewayIPOptions { + _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetEndpointGatewayIPOptions) SetID(id string) *GetEndpointGatewayIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetEndpointGatewayIPOptions) SetHeaders(param map[string]string) *GetEndpointGatewayIPOptions { + options.Headers = param + return options +} + +// GetEndpointGatewayOptions : The GetEndpointGateway options. +type GetEndpointGatewayOptions struct { + // The endpoint gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetEndpointGatewayOptions : Instantiate GetEndpointGatewayOptions +func (*VpcV1) NewGetEndpointGatewayOptions(id string) *GetEndpointGatewayOptions { + return &GetEndpointGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetEndpointGatewayOptions) SetID(id string) *GetEndpointGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetEndpointGatewayOptions) SetHeaders(param map[string]string) *GetEndpointGatewayOptions { + options.Headers = param + return options +} + +// GetFloatingIPOptions : The GetFloatingIP options. +type GetFloatingIPOptions struct { + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetFloatingIPOptions : Instantiate GetFloatingIPOptions +func (*VpcV1) NewGetFloatingIPOptions(id string) *GetFloatingIPOptions { + return &GetFloatingIPOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetFloatingIPOptions) SetID(id string) *GetFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetFloatingIPOptions) SetHeaders(param map[string]string) *GetFloatingIPOptions { + options.Headers = param + return options +} + +// GetFlowLogCollectorOptions : The GetFlowLogCollector options. +type GetFlowLogCollectorOptions struct { + // The flow log collector identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetFlowLogCollectorOptions : Instantiate GetFlowLogCollectorOptions +func (*VpcV1) NewGetFlowLogCollectorOptions(id string) *GetFlowLogCollectorOptions { + return &GetFlowLogCollectorOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetFlowLogCollectorOptions) SetID(id string) *GetFlowLogCollectorOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetFlowLogCollectorOptions) SetHeaders(param map[string]string) *GetFlowLogCollectorOptions { + options.Headers = param + return options +} + +// GetIkePolicyOptions : The GetIkePolicy options. +type GetIkePolicyOptions struct { + // The IKE policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetIkePolicyOptions : Instantiate GetIkePolicyOptions +func (*VpcV1) NewGetIkePolicyOptions(id string) *GetIkePolicyOptions { + return &GetIkePolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetIkePolicyOptions) SetID(id string) *GetIkePolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetIkePolicyOptions) SetHeaders(param map[string]string) *GetIkePolicyOptions { + options.Headers = param + return options +} + +// GetImageOptions : The GetImage options. +type GetImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetImageOptions : Instantiate GetImageOptions +func (*VpcV1) NewGetImageOptions(id string) *GetImageOptions { + return &GetImageOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetImageOptions) SetID(id string) *GetImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetImageOptions) SetHeaders(param map[string]string) *GetImageOptions { + options.Headers = param + return options +} + +// GetInstanceDiskOptions : The GetInstanceDisk options. +type GetInstanceDiskOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceDiskOptions : Instantiate GetInstanceDiskOptions +func (*VpcV1) NewGetInstanceDiskOptions(instanceID string, id string) *GetInstanceDiskOptions { + return &GetInstanceDiskOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceDiskOptions) SetInstanceID(instanceID string) *GetInstanceDiskOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceDiskOptions) SetID(id string) *GetInstanceDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceDiskOptions) SetHeaders(param map[string]string) *GetInstanceDiskOptions { + options.Headers = param + return options +} + +// GetInstanceGroupManagerActionOptions : The GetInstanceGroupManagerAction options. +type GetInstanceGroupManagerActionOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager action identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupManagerActionOptions : Instantiate GetInstanceGroupManagerActionOptions +func (*VpcV1) NewGetInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string) *GetInstanceGroupManagerActionOptions { + return &GetInstanceGroupManagerActionOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *GetInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerActionOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *GetInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *GetInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupManagerActionOptions) SetID(id string) *GetInstanceGroupManagerActionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerActionOptions { + options.Headers = param + return options +} + +// GetInstanceGroupManagerOptions : The GetInstanceGroupManager options. +type GetInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupManagerOptions : Instantiate GetInstanceGroupManagerOptions +func (*VpcV1) NewGetInstanceGroupManagerOptions(instanceGroupID string, id string) *GetInstanceGroupManagerOptions { + return &GetInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *GetInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupManagerOptions) SetID(id string) *GetInstanceGroupManagerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupManagerOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// GetInstanceGroupManagerPolicyOptions : The GetInstanceGroupManagerPolicy options. +type GetInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupManagerPolicyOptions : Instantiate GetInstanceGroupManagerPolicyOptions +func (*VpcV1) NewGetInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string) *GetInstanceGroupManagerPolicyOptions { + return &GetInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *GetInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerPolicyOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *GetInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *GetInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupManagerPolicyOptions) SetID(id string) *GetInstanceGroupManagerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// GetInstanceGroupMembershipOptions : The GetInstanceGroupMembership options. +type GetInstanceGroupMembershipOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group membership identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupMembershipOptions : Instantiate GetInstanceGroupMembershipOptions +func (*VpcV1) NewGetInstanceGroupMembershipOptions(instanceGroupID string, id string) *GetInstanceGroupMembershipOptions { + return &GetInstanceGroupMembershipOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *GetInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupMembershipOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupMembershipOptions) SetID(id string) *GetInstanceGroupMembershipOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *GetInstanceGroupMembershipOptions { + options.Headers = param + return options +} + +// GetInstanceGroupOptions : The GetInstanceGroup options. +type GetInstanceGroupOptions struct { + // The instance group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupOptions : Instantiate GetInstanceGroupOptions +func (*VpcV1) NewGetInstanceGroupOptions(id string) *GetInstanceGroupOptions { + return &GetInstanceGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupOptions) SetID(id string) *GetInstanceGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupOptions) SetHeaders(param map[string]string) *GetInstanceGroupOptions { + options.Headers = param + return options +} + +// GetInstanceInitializationOptions : The GetInstanceInitialization options. +type GetInstanceInitializationOptions struct { + // The instance identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceInitializationOptions : Instantiate GetInstanceInitializationOptions +func (*VpcV1) NewGetInstanceInitializationOptions(id string) *GetInstanceInitializationOptions { + return &GetInstanceInitializationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetInstanceInitializationOptions) SetID(id string) *GetInstanceInitializationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceInitializationOptions) SetHeaders(param map[string]string) *GetInstanceInitializationOptions { + options.Headers = param + return options +} + +// GetInstanceNetworkInterfaceFloatingIPOptions : The GetInstanceNetworkInterfaceFloatingIP options. +type GetInstanceNetworkInterfaceFloatingIPOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The 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 +} + +// NewGetInstanceNetworkInterfaceFloatingIPOptions : Instantiate GetInstanceNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewGetInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *GetInstanceNetworkInterfaceFloatingIPOptions { + return &GetInstanceNetworkInterfaceFloatingIPOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceFloatingIPOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *GetInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetInstanceNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *GetInstanceNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// GetInstanceNetworkInterfaceIPOptions : The GetInstanceNetworkInterfaceIP options. +type GetInstanceNetworkInterfaceIPOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The network interface identifier. + NetworkInterfaceID *string `json:"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 +} + +// NewGetInstanceNetworkInterfaceIPOptions : Instantiate GetInstanceNetworkInterfaceIPOptions +func (*VpcV1) NewGetInstanceNetworkInterfaceIPOptions(instanceID string, networkInterfaceID string, id string) *GetInstanceNetworkInterfaceIPOptions { + return &GetInstanceNetworkInterfaceIPOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceNetworkInterfaceIPOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceIPOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *GetInstanceNetworkInterfaceIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetInstanceNetworkInterfaceIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceNetworkInterfaceIPOptions) SetID(id string) *GetInstanceNetworkInterfaceIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceIPOptions { + options.Headers = param + return options +} + +// GetInstanceNetworkInterfaceOptions : The GetInstanceNetworkInterface options. +type GetInstanceNetworkInterfaceOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceNetworkInterfaceOptions : Instantiate GetInstanceNetworkInterfaceOptions +func (*VpcV1) NewGetInstanceNetworkInterfaceOptions(instanceID string, id string) *GetInstanceNetworkInterfaceOptions { + return &GetInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceNetworkInterfaceOptions) SetID(id string) *GetInstanceNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// GetInstanceOptions : The GetInstance options. +type GetInstanceOptions struct { + // The instance identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceOptions : Instantiate GetInstanceOptions +func (*VpcV1) NewGetInstanceOptions(id string) *GetInstanceOptions { + return &GetInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetInstanceOptions) SetID(id string) *GetInstanceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceOptions) SetHeaders(param map[string]string) *GetInstanceOptions { + options.Headers = param + return options +} + +// GetInstanceProfileOptions : The GetInstanceProfile options. +type GetInstanceProfileOptions struct { + // The instance profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceProfileOptions : Instantiate GetInstanceProfileOptions +func (*VpcV1) NewGetInstanceProfileOptions(name string) *GetInstanceProfileOptions { + return &GetInstanceProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetInstanceProfileOptions) SetName(name string) *GetInstanceProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceProfileOptions) SetHeaders(param map[string]string) *GetInstanceProfileOptions { + options.Headers = param + return options +} + +// GetInstanceTemplateOptions : The GetInstanceTemplate options. +type GetInstanceTemplateOptions struct { + // The instance template identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceTemplateOptions : Instantiate GetInstanceTemplateOptions +func (*VpcV1) NewGetInstanceTemplateOptions(id string) *GetInstanceTemplateOptions { + return &GetInstanceTemplateOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetInstanceTemplateOptions) SetID(id string) *GetInstanceTemplateOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceTemplateOptions) SetHeaders(param map[string]string) *GetInstanceTemplateOptions { + options.Headers = param + return options +} + +// GetInstanceVolumeAttachmentOptions : The GetInstanceVolumeAttachment options. +type GetInstanceVolumeAttachmentOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The volume attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceVolumeAttachmentOptions : Instantiate GetInstanceVolumeAttachmentOptions +func (*VpcV1) NewGetInstanceVolumeAttachmentOptions(instanceID string, id string) *GetInstanceVolumeAttachmentOptions { + return &GetInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceVolumeAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceVolumeAttachmentOptions) SetID(id string) *GetInstanceVolumeAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// GetIpsecPolicyOptions : The GetIpsecPolicy options. +type GetIpsecPolicyOptions struct { + // The IPsec policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetIpsecPolicyOptions : Instantiate GetIpsecPolicyOptions +func (*VpcV1) NewGetIpsecPolicyOptions(id string) *GetIpsecPolicyOptions { + return &GetIpsecPolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetIpsecPolicyOptions) SetID(id string) *GetIpsecPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetIpsecPolicyOptions) SetHeaders(param map[string]string) *GetIpsecPolicyOptions { + options.Headers = param + return options +} + +// GetKeyOptions : The GetKey options. +type GetKeyOptions struct { + // The key identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetKeyOptions : Instantiate GetKeyOptions +func (*VpcV1) NewGetKeyOptions(id string) *GetKeyOptions { + return &GetKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetKeyOptions) SetID(id string) *GetKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetKeyOptions) SetHeaders(param map[string]string) *GetKeyOptions { + options.Headers = param + return options +} + +// GetLoadBalancerListenerOptions : The GetLoadBalancerListener options. +type GetLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerListenerOptions : Instantiate GetLoadBalancerListenerOptions +func (*VpcV1) NewGetLoadBalancerListenerOptions(loadBalancerID string, id string) *GetLoadBalancerListenerOptions { + return &GetLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerListenerOptions) SetID(id string) *GetLoadBalancerListenerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerListenerOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// GetLoadBalancerListenerPolicyOptions : The GetLoadBalancerListenerPolicy options. +type GetLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerListenerPolicyOptions : Instantiate GetLoadBalancerListenerPolicyOptions +func (*VpcV1) NewGetLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string) *GetLoadBalancerListenerPolicyOptions { + return &GetLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerPolicyOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *GetLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *GetLoadBalancerListenerPolicyOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerListenerPolicyOptions) SetID(id string) *GetLoadBalancerListenerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// GetLoadBalancerListenerPolicyRuleOptions : The GetLoadBalancerListenerPolicyRule options. +type GetLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerListenerPolicyRuleOptions : Instantiate GetLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewGetLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string) *GetLoadBalancerListenerPolicyRuleOptions { + return &GetLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *GetLoadBalancerListenerPolicyRuleOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *GetLoadBalancerListenerPolicyRuleOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetID(id string) *GetLoadBalancerListenerPolicyRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// GetLoadBalancerOptions : The GetLoadBalancer options. +type GetLoadBalancerOptions struct { + // The load balancer identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerOptions : Instantiate GetLoadBalancerOptions +func (*VpcV1) NewGetLoadBalancerOptions(id string) *GetLoadBalancerOptions { + return &GetLoadBalancerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerOptions) SetID(id string) *GetLoadBalancerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerOptions) SetHeaders(param map[string]string) *GetLoadBalancerOptions { + options.Headers = param + return options +} + +// GetLoadBalancerPoolMemberOptions : The GetLoadBalancerPoolMember options. +type GetLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The member identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerPoolMemberOptions : Instantiate GetLoadBalancerPoolMemberOptions +func (*VpcV1) NewGetLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string) *GetLoadBalancerPoolMemberOptions { + return &GetLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerPoolMemberOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *GetLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *GetLoadBalancerPoolMemberOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerPoolMemberOptions) SetID(id string) *GetLoadBalancerPoolMemberOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *GetLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// GetLoadBalancerPoolOptions : The GetLoadBalancerPool options. +type GetLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerPoolOptions : Instantiate GetLoadBalancerPoolOptions +func (*VpcV1) NewGetLoadBalancerPoolOptions(loadBalancerID string, id string) *GetLoadBalancerPoolOptions { + return &GetLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerPoolOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerPoolOptions) SetID(id string) *GetLoadBalancerPoolOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerPoolOptions) SetHeaders(param map[string]string) *GetLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// GetLoadBalancerProfileOptions : The GetLoadBalancerProfile options. +type GetLoadBalancerProfileOptions struct { + // The load balancer profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerProfileOptions : Instantiate GetLoadBalancerProfileOptions +func (*VpcV1) NewGetLoadBalancerProfileOptions(name string) *GetLoadBalancerProfileOptions { + return &GetLoadBalancerProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetLoadBalancerProfileOptions) SetName(name string) *GetLoadBalancerProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerProfileOptions) SetHeaders(param map[string]string) *GetLoadBalancerProfileOptions { + options.Headers = param + return options +} + +// GetLoadBalancerStatisticsOptions : The GetLoadBalancerStatistics options. +type GetLoadBalancerStatisticsOptions struct { + // The load balancer identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerStatisticsOptions : Instantiate GetLoadBalancerStatisticsOptions +func (*VpcV1) NewGetLoadBalancerStatisticsOptions(id string) *GetLoadBalancerStatisticsOptions { + return &GetLoadBalancerStatisticsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerStatisticsOptions) SetID(id string) *GetLoadBalancerStatisticsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerStatisticsOptions) SetHeaders(param map[string]string) *GetLoadBalancerStatisticsOptions { + options.Headers = param + return options +} + +// GetNetworkACLOptions : The GetNetworkACL options. +type GetNetworkACLOptions struct { + // The network ACL identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetNetworkACLOptions : Instantiate GetNetworkACLOptions +func (*VpcV1) NewGetNetworkACLOptions(id string) *GetNetworkACLOptions { + return &GetNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetNetworkACLOptions) SetID(id string) *GetNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetNetworkACLOptions) SetHeaders(param map[string]string) *GetNetworkACLOptions { + options.Headers = param + return options +} + +// GetNetworkACLRuleOptions : The GetNetworkACLRule options. +type GetNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetNetworkACLRuleOptions : Instantiate GetNetworkACLRuleOptions +func (*VpcV1) NewGetNetworkACLRuleOptions(networkACLID string, id string) *GetNetworkACLRuleOptions { + return &GetNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + ID: core.StringPtr(id), + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *GetNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *GetNetworkACLRuleOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetNetworkACLRuleOptions) SetID(id string) *GetNetworkACLRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetNetworkACLRuleOptions) SetHeaders(param map[string]string) *GetNetworkACLRuleOptions { + options.Headers = param + return options +} + +// GetOperatingSystemOptions : The GetOperatingSystem options. +type GetOperatingSystemOptions struct { + // The operating system name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetOperatingSystemOptions : Instantiate GetOperatingSystemOptions +func (*VpcV1) NewGetOperatingSystemOptions(name string) *GetOperatingSystemOptions { + return &GetOperatingSystemOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetOperatingSystemOptions) SetName(name string) *GetOperatingSystemOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetOperatingSystemOptions) SetHeaders(param map[string]string) *GetOperatingSystemOptions { + options.Headers = param + return options +} + +// GetPlacementGroupOptions : The GetPlacementGroup options. +type GetPlacementGroupOptions struct { + // The placement group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetPlacementGroupOptions : Instantiate GetPlacementGroupOptions +func (*VpcV1) NewGetPlacementGroupOptions(id string) *GetPlacementGroupOptions { + return &GetPlacementGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetPlacementGroupOptions) SetID(id string) *GetPlacementGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetPlacementGroupOptions) SetHeaders(param map[string]string) *GetPlacementGroupOptions { + options.Headers = param + return options +} + +// GetPublicGatewayOptions : The GetPublicGateway options. +type GetPublicGatewayOptions struct { + // The public gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetPublicGatewayOptions : Instantiate GetPublicGatewayOptions +func (*VpcV1) NewGetPublicGatewayOptions(id string) *GetPublicGatewayOptions { + return &GetPublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetPublicGatewayOptions) SetID(id string) *GetPublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetPublicGatewayOptions) SetHeaders(param map[string]string) *GetPublicGatewayOptions { + options.Headers = param + return options +} + +// GetRegionOptions : The GetRegion options. +type GetRegionOptions struct { + // The region name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetRegionOptions : Instantiate GetRegionOptions +func (*VpcV1) NewGetRegionOptions(name string) *GetRegionOptions { + return &GetRegionOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetRegionOptions) SetName(name string) *GetRegionOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetRegionOptions) SetHeaders(param map[string]string) *GetRegionOptions { + options.Headers = param + return options +} + +// GetRegionZoneOptions : The GetRegionZone options. +type GetRegionZoneOptions struct { + // The region name. + RegionName *string `json:"region_name" validate:"required,ne="` + + // The zone name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetRegionZoneOptions : Instantiate GetRegionZoneOptions +func (*VpcV1) NewGetRegionZoneOptions(regionName string, name string) *GetRegionZoneOptions { + return &GetRegionZoneOptions{ + RegionName: core.StringPtr(regionName), + Name: core.StringPtr(name), + } +} + +// SetRegionName : Allow user to set RegionName +func (_options *GetRegionZoneOptions) SetRegionName(regionName string) *GetRegionZoneOptions { + _options.RegionName = core.StringPtr(regionName) + return _options +} + +// SetName : Allow user to set Name +func (_options *GetRegionZoneOptions) SetName(name string) *GetRegionZoneOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetRegionZoneOptions) SetHeaders(param map[string]string) *GetRegionZoneOptions { + options.Headers = param + return options +} + +// GetSecurityGroupOptions : The GetSecurityGroup options. +type GetSecurityGroupOptions struct { + // The security group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSecurityGroupOptions : Instantiate GetSecurityGroupOptions +func (*VpcV1) NewGetSecurityGroupOptions(id string) *GetSecurityGroupOptions { + return &GetSecurityGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSecurityGroupOptions) SetID(id string) *GetSecurityGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSecurityGroupOptions) SetHeaders(param map[string]string) *GetSecurityGroupOptions { + options.Headers = param + return options +} + +// GetSecurityGroupRuleOptions : The GetSecurityGroupRule options. +type GetSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSecurityGroupRuleOptions : Instantiate GetSecurityGroupRuleOptions +func (*VpcV1) NewGetSecurityGroupRuleOptions(securityGroupID string, id string) *GetSecurityGroupRuleOptions { + return &GetSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *GetSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *GetSecurityGroupRuleOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetSecurityGroupRuleOptions) SetID(id string) *GetSecurityGroupRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSecurityGroupRuleOptions) SetHeaders(param map[string]string) *GetSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// GetSecurityGroupTargetOptions : The GetSecurityGroupTarget options. +type GetSecurityGroupTargetOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The security group target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSecurityGroupTargetOptions : Instantiate GetSecurityGroupTargetOptions +func (*VpcV1) NewGetSecurityGroupTargetOptions(securityGroupID string, id string) *GetSecurityGroupTargetOptions { + return &GetSecurityGroupTargetOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *GetSecurityGroupTargetOptions) SetSecurityGroupID(securityGroupID string) *GetSecurityGroupTargetOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetSecurityGroupTargetOptions) SetID(id string) *GetSecurityGroupTargetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSecurityGroupTargetOptions) SetHeaders(param map[string]string) *GetSecurityGroupTargetOptions { + options.Headers = param + return options +} + +// GetSnapshotOptions : The GetSnapshot options. +type GetSnapshotOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSnapshotOptions : Instantiate GetSnapshotOptions +func (*VpcV1) NewGetSnapshotOptions(id string) *GetSnapshotOptions { + return &GetSnapshotOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSnapshotOptions) SetID(id string) *GetSnapshotOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSnapshotOptions) SetHeaders(param map[string]string) *GetSnapshotOptions { + options.Headers = param + return options +} + +// GetSubnetNetworkACLOptions : The GetSubnetNetworkACL options. +type GetSubnetNetworkACLOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetNetworkACLOptions : Instantiate GetSubnetNetworkACLOptions +func (*VpcV1) NewGetSubnetNetworkACLOptions(id string) *GetSubnetNetworkACLOptions { + return &GetSubnetNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSubnetNetworkACLOptions) SetID(id string) *GetSubnetNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetNetworkACLOptions) SetHeaders(param map[string]string) *GetSubnetNetworkACLOptions { + options.Headers = param + return options +} + +// GetSubnetOptions : The GetSubnet options. +type GetSubnetOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetOptions : Instantiate GetSubnetOptions +func (*VpcV1) NewGetSubnetOptions(id string) *GetSubnetOptions { + return &GetSubnetOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSubnetOptions) SetID(id string) *GetSubnetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetOptions) SetHeaders(param map[string]string) *GetSubnetOptions { + options.Headers = param + return options +} + +// GetSubnetPublicGatewayOptions : The GetSubnetPublicGateway options. +type GetSubnetPublicGatewayOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetPublicGatewayOptions : Instantiate GetSubnetPublicGatewayOptions +func (*VpcV1) NewGetSubnetPublicGatewayOptions(id string) *GetSubnetPublicGatewayOptions { + return &GetSubnetPublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSubnetPublicGatewayOptions) SetID(id string) *GetSubnetPublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *GetSubnetPublicGatewayOptions { + options.Headers = param + return options +} + +// GetSubnetReservedIPOptions : The GetSubnetReservedIP options. +type GetSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `json:"subnet_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 +} + +// NewGetSubnetReservedIPOptions : Instantiate GetSubnetReservedIPOptions +func (*VpcV1) NewGetSubnetReservedIPOptions(subnetID string, id string) *GetSubnetReservedIPOptions { + return &GetSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + ID: core.StringPtr(id), + } +} + +// SetSubnetID : Allow user to set SubnetID +func (_options *GetSubnetReservedIPOptions) SetSubnetID(subnetID string) *GetSubnetReservedIPOptions { + _options.SubnetID = core.StringPtr(subnetID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetSubnetReservedIPOptions) SetID(id string) *GetSubnetReservedIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetReservedIPOptions) SetHeaders(param map[string]string) *GetSubnetReservedIPOptions { + options.Headers = param + return options +} + +// GetSubnetRoutingTableOptions : The GetSubnetRoutingTable options. +type GetSubnetRoutingTableOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetRoutingTableOptions : Instantiate GetSubnetRoutingTableOptions +func (*VpcV1) NewGetSubnetRoutingTableOptions(id string) *GetSubnetRoutingTableOptions { + return &GetSubnetRoutingTableOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSubnetRoutingTableOptions) SetID(id string) *GetSubnetRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetRoutingTableOptions) SetHeaders(param map[string]string) *GetSubnetRoutingTableOptions { + options.Headers = param + return options +} + +// GetVolumeOptions : The GetVolume options. +type GetVolumeOptions struct { + // The volume identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVolumeOptions : Instantiate GetVolumeOptions +func (*VpcV1) NewGetVolumeOptions(id string) *GetVolumeOptions { + return &GetVolumeOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVolumeOptions) SetID(id string) *GetVolumeOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVolumeOptions) SetHeaders(param map[string]string) *GetVolumeOptions { + options.Headers = param + return options +} + +// GetVolumeProfileOptions : The GetVolumeProfile options. +type GetVolumeProfileOptions struct { + // The volume profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVolumeProfileOptions : Instantiate GetVolumeProfileOptions +func (*VpcV1) NewGetVolumeProfileOptions(name string) *GetVolumeProfileOptions { + return &GetVolumeProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetVolumeProfileOptions) SetName(name string) *GetVolumeProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVolumeProfileOptions) SetHeaders(param map[string]string) *GetVolumeProfileOptions { + options.Headers = param + return options +} + +// GetVPCAddressPrefixOptions : The GetVPCAddressPrefix options. +type GetVPCAddressPrefixOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The prefix identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCAddressPrefixOptions : Instantiate GetVPCAddressPrefixOptions +func (*VpcV1) NewGetVPCAddressPrefixOptions(vpcID string, id string) *GetVPCAddressPrefixOptions { + return &GetVPCAddressPrefixOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCAddressPrefixOptions) SetVPCID(vpcID string) *GetVPCAddressPrefixOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCAddressPrefixOptions) SetID(id string) *GetVPCAddressPrefixOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCAddressPrefixOptions) SetHeaders(param map[string]string) *GetVPCAddressPrefixOptions { + options.Headers = param + return options +} + +// GetVPCDefaultNetworkACLOptions : The GetVPCDefaultNetworkACL options. +type GetVPCDefaultNetworkACLOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDefaultNetworkACLOptions : Instantiate GetVPCDefaultNetworkACLOptions +func (*VpcV1) NewGetVPCDefaultNetworkACLOptions(id string) *GetVPCDefaultNetworkACLOptions { + return &GetVPCDefaultNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPCDefaultNetworkACLOptions) SetID(id string) *GetVPCDefaultNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDefaultNetworkACLOptions) SetHeaders(param map[string]string) *GetVPCDefaultNetworkACLOptions { + options.Headers = param + return options +} + +// GetVPCDefaultRoutingTableOptions : The GetVPCDefaultRoutingTable options. +type GetVPCDefaultRoutingTableOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDefaultRoutingTableOptions : Instantiate GetVPCDefaultRoutingTableOptions +func (*VpcV1) NewGetVPCDefaultRoutingTableOptions(id string) *GetVPCDefaultRoutingTableOptions { + return &GetVPCDefaultRoutingTableOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPCDefaultRoutingTableOptions) SetID(id string) *GetVPCDefaultRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDefaultRoutingTableOptions) SetHeaders(param map[string]string) *GetVPCDefaultRoutingTableOptions { + options.Headers = param + return options +} + +// GetVPCDefaultSecurityGroupOptions : The GetVPCDefaultSecurityGroup options. +type GetVPCDefaultSecurityGroupOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDefaultSecurityGroupOptions : Instantiate GetVPCDefaultSecurityGroupOptions +func (*VpcV1) NewGetVPCDefaultSecurityGroupOptions(id string) *GetVPCDefaultSecurityGroupOptions { + return &GetVPCDefaultSecurityGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPCDefaultSecurityGroupOptions) SetID(id string) *GetVPCDefaultSecurityGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDefaultSecurityGroupOptions) SetHeaders(param map[string]string) *GetVPCDefaultSecurityGroupOptions { + options.Headers = param + return options +} + +// GetVPCOptions : The GetVPC options. +type GetVPCOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCOptions : Instantiate GetVPCOptions +func (*VpcV1) NewGetVPCOptions(id string) *GetVPCOptions { + return &GetVPCOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPCOptions) SetID(id string) *GetVPCOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCOptions) SetHeaders(param map[string]string) *GetVPCOptions { + options.Headers = param + return options +} + +// GetVPCRouteOptions : The GetVPCRoute options. +type GetVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCRouteOptions : Instantiate GetVPCRouteOptions +func (*VpcV1) NewGetVPCRouteOptions(vpcID string, id string) *GetVPCRouteOptions { + return &GetVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCRouteOptions) SetVPCID(vpcID string) *GetVPCRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCRouteOptions) SetID(id string) *GetVPCRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCRouteOptions) SetHeaders(param map[string]string) *GetVPCRouteOptions { + options.Headers = param + return options +} + +// GetVPCRoutingTableOptions : The GetVPCRoutingTable options. +type GetVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCRoutingTableOptions : Instantiate GetVPCRoutingTableOptions +func (*VpcV1) NewGetVPCRoutingTableOptions(vpcID string, id string) *GetVPCRoutingTableOptions { + return &GetVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCRoutingTableOptions) SetVPCID(vpcID string) *GetVPCRoutingTableOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCRoutingTableOptions) SetID(id string) *GetVPCRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCRoutingTableOptions) SetHeaders(param map[string]string) *GetVPCRoutingTableOptions { + options.Headers = param + return options +} + +// GetVPCRoutingTableRouteOptions : The GetVPCRoutingTableRoute options. +type GetVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` + + // The VPC routing table route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCRoutingTableRouteOptions : Instantiate GetVPCRoutingTableRouteOptions +func (*VpcV1) NewGetVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string) *GetVPCRoutingTableRouteOptions { + return &GetVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *GetVPCRoutingTableRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *GetVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *GetVPCRoutingTableRouteOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCRoutingTableRouteOptions) SetID(id string) *GetVPCRoutingTableRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *GetVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// GetVPNGatewayConnectionOptions : The GetVPNGatewayConnection options. +type GetVPNGatewayConnectionOptions 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="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNGatewayConnectionOptions : Instantiate GetVPNGatewayConnectionOptions +func (*VpcV1) NewGetVPNGatewayConnectionOptions(vpnGatewayID string, id string) *GetVPNGatewayConnectionOptions { + return &GetVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *GetVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *GetVPNGatewayConnectionOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPNGatewayConnectionOptions) SetID(id string) *GetVPNGatewayConnectionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *GetVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// GetVPNGatewayOptions : The GetVPNGateway options. +type GetVPNGatewayOptions struct { + // The VPN gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNGatewayOptions : Instantiate GetVPNGatewayOptions +func (*VpcV1) NewGetVPNGatewayOptions(id string) *GetVPNGatewayOptions { + return &GetVPNGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPNGatewayOptions) SetID(id string) *GetVPNGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNGatewayOptions) SetHeaders(param map[string]string) *GetVPNGatewayOptions { + options.Headers = param + return options +} + +// GetVPNServerClientConfigurationOptions : The GetVPNServerClientConfiguration options. +type GetVPNServerClientConfigurationOptions struct { + // The VPN server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerClientConfigurationOptions : Instantiate GetVPNServerClientConfigurationOptions +func (*VpcV1) NewGetVPNServerClientConfigurationOptions(id string) *GetVPNServerClientConfigurationOptions { + return &GetVPNServerClientConfigurationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerClientConfigurationOptions) SetID(id string) *GetVPNServerClientConfigurationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerClientConfigurationOptions) SetHeaders(param map[string]string) *GetVPNServerClientConfigurationOptions { + options.Headers = param + return options +} + +// GetVPNServerClientOptions : The GetVPNServerClient options. +type GetVPNServerClientOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN client identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerClientOptions : Instantiate GetVPNServerClientOptions +func (*VpcV1) NewGetVPNServerClientOptions(vpnServerID string, id string) *GetVPNServerClientOptions { + return &GetVPNServerClientOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *GetVPNServerClientOptions) SetVPNServerID(vpnServerID string) *GetVPNServerClientOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerClientOptions) SetID(id string) *GetVPNServerClientOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerClientOptions) SetHeaders(param map[string]string) *GetVPNServerClientOptions { + options.Headers = param + return options +} + +// GetVPNServerOptions : The GetVPNServer options. +type GetVPNServerOptions struct { + // The VPN server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerOptions : Instantiate GetVPNServerOptions +func (*VpcV1) NewGetVPNServerOptions(id string) *GetVPNServerOptions { + return &GetVPNServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerOptions) SetID(id string) *GetVPNServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerOptions) SetHeaders(param map[string]string) *GetVPNServerOptions { + options.Headers = param + return options +} + +// GetVPNServerRouteOptions : The GetVPNServerRoute options. +type GetVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerRouteOptions : Instantiate GetVPNServerRouteOptions +func (*VpcV1) NewGetVPNServerRouteOptions(vpnServerID string, id string) *GetVPNServerRouteOptions { + return &GetVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *GetVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *GetVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerRouteOptions) SetID(id string) *GetVPNServerRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerRouteOptions) SetHeaders(param map[string]string) *GetVPNServerRouteOptions { + options.Headers = param + return options +} + +// IkePolicy : IkePolicy struct +type IkePolicy struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` + + // The VPN gateway connections that use this IKE policy. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this IKE policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The Diffie-Hellman group. + DhGroup *int64 `json:"dh_group" validate:"required"` + + // The encryption algorithm. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` + + // The IKE protocol version. + IkeVersion *int64 `json:"ike_version" validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime" validate:"required"` + + // The user-defined name for this IKE policy. + Name *string `json:"name" validate:"required"` + + // The IKE negotiation mode. Only `main` is supported. + NegotiationMode *string `json:"negotiation_mode" validate:"required"` + + // The resource group for this IKE policy. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the IkePolicy.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + IkePolicyAuthenticationAlgorithmMd5Const = "md5" + IkePolicyAuthenticationAlgorithmSha1Const = "sha1" + IkePolicyAuthenticationAlgorithmSha256Const = "sha256" + IkePolicyAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IkePolicy.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + IkePolicyEncryptionAlgorithmAes128Const = "aes128" + IkePolicyEncryptionAlgorithmAes256Const = "aes256" + IkePolicyEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// Constants associated with the IkePolicy.NegotiationMode property. +// The IKE negotiation mode. Only `main` is supported. +const ( + IkePolicyNegotiationModeMainConst = "main" +) + +// Constants associated with the IkePolicy.ResourceType property. +// The resource type. +const ( + IkePolicyResourceTypeIkePolicyConst = "ike_policy" +) + +// UnmarshalIkePolicy unmarshals an instance of IkePolicy from the specified map of raw messages. +func UnmarshalIkePolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicy) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "negotiation_mode", &obj.NegotiationMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyCollection : IkePolicyCollection struct +type IkePolicyCollection struct { + // A link to the first page of resources. + First *IkePolicyCollectionFirst `json:"first" validate:"required"` + + // Collection of IKE policies. + IkePolicies []IkePolicy `json:"ike_policies" 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 *IkePolicyCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policies", &obj.IkePolicies, UnmarshalIkePolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIkePolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *IkePolicyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// IkePolicyPatch : IkePolicyPatch struct +type IkePolicyPatch struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` + + // The Diffie-Hellman group. + DhGroup *int64 `json:"dh_group,omitempty"` + + // The encryption algorithm. + EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` + + // The IKE protocol version. + IkeVersion *int64 `json:"ike_version,omitempty"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime,omitempty"` + + // The user-defined name for this IKE policy. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the IkePolicyPatch.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + IkePolicyPatchAuthenticationAlgorithmMd5Const = "md5" + IkePolicyPatchAuthenticationAlgorithmSha1Const = "sha1" + IkePolicyPatchAuthenticationAlgorithmSha256Const = "sha256" + IkePolicyPatchAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IkePolicyPatch.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + IkePolicyPatchEncryptionAlgorithmAes128Const = "aes128" + IkePolicyPatchEncryptionAlgorithmAes256Const = "aes256" + IkePolicyPatchEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// UnmarshalIkePolicyPatch unmarshals an instance of IkePolicyPatch from the specified map of raw messages. +func UnmarshalIkePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyPatch) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// IkePolicyReference : IkePolicyReference struct +type IkePolicyReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *IkePolicyReferenceDeleted `json:"deleted,omitempty"` + + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this IKE policy. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the IkePolicyReference.ResourceType property. +// The resource type. +const ( + IkePolicyReferenceResourceTypeIkePolicyConst = "ike_policy" +) + +// UnmarshalIkePolicyReference unmarshals an instance of IkePolicyReference from the specified map of raw messages. +func UnmarshalIkePolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIkePolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IP : IP struct +type IP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewIP : Instantiate IP (Generic Model Constructor) +func (*VpcV1) NewIP(address string) (_model *IP, err error) { + _model = &IP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalIP unmarshals an instance of IP from the specified map of raw messages. +func UnmarshalIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicy : IPsecPolicy struct +type IPsecPolicy struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` + + // The VPN gateway connections that use this IPsec policy. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this IPsec policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The encapsulation mode used. Only `tunnel` is supported. + EncapsulationMode *string `json:"encapsulation_mode" validate:"required"` + + // The encryption algorithm. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime" validate:"required"` + + // The user-defined name for this IPsec policy. + Name *string `json:"name" validate:"required"` + + // Perfect Forward Secrecy. + Pfs *string `json:"pfs" validate:"required"` + + // The resource group for this IPsec policy. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The transform protocol used. Only `esp` is supported. + TransformProtocol *string `json:"transform_protocol" validate:"required"` +} + +// Constants associated with the IPsecPolicy.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + IPsecPolicyAuthenticationAlgorithmMd5Const = "md5" + IPsecPolicyAuthenticationAlgorithmSha1Const = "sha1" + IPsecPolicyAuthenticationAlgorithmSha256Const = "sha256" + IPsecPolicyAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IPsecPolicy.EncapsulationMode property. +// The encapsulation mode used. Only `tunnel` is supported. +const ( + IPsecPolicyEncapsulationModeTunnelConst = "tunnel" +) + +// Constants associated with the IPsecPolicy.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + IPsecPolicyEncryptionAlgorithmAes128Const = "aes128" + IPsecPolicyEncryptionAlgorithmAes256Const = "aes256" + IPsecPolicyEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// Constants associated with the IPsecPolicy.Pfs property. +// Perfect Forward Secrecy. +const ( + IPsecPolicyPfsDisabledConst = "disabled" + IPsecPolicyPfsGroup14Const = "group_14" + IPsecPolicyPfsGroup19Const = "group_19" + IPsecPolicyPfsGroup2Const = "group_2" + IPsecPolicyPfsGroup5Const = "group_5" +) + +// Constants associated with the IPsecPolicy.ResourceType property. +// The resource type. +const ( + IPsecPolicyResourceTypeIpsecPolicyConst = "ipsec_policy" +) + +// Constants associated with the IPsecPolicy.TransformProtocol property. +// The transform protocol used. Only `esp` is supported. +const ( + IPsecPolicyTransformProtocolEspConst = "esp" +) + +// UnmarshalIPsecPolicy unmarshals an instance of IPsecPolicy from the specified map of raw messages. +func UnmarshalIPsecPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicy) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encapsulation_mode", &obj.EncapsulationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pfs", &obj.Pfs) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "transform_protocol", &obj.TransformProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyCollection : IPsecPolicyCollection struct +type IPsecPolicyCollection struct { + // A link to the first page of resources. + First *IPsecPolicyCollectionFirst `json:"first" validate:"required"` + + // Collection of IPsec policies. + IpsecPolicies []IPsecPolicy `json:"ipsec_policies" 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 *IPsecPolicyCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policies", &obj.IpsecPolicies, UnmarshalIPsecPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIPsecPolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *IPsecPolicyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyPatch : IPsecPolicyPatch struct +type IPsecPolicyPatch struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` + + // The encryption algorithm. + EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime,omitempty"` + + // The user-defined name for this IPsec policy. + Name *string `json:"name,omitempty"` + + // Perfect Forward Secrecy. + Pfs *string `json:"pfs,omitempty"` +} + +// Constants associated with the IPsecPolicyPatch.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + IPsecPolicyPatchAuthenticationAlgorithmMd5Const = "md5" + IPsecPolicyPatchAuthenticationAlgorithmSha1Const = "sha1" + IPsecPolicyPatchAuthenticationAlgorithmSha256Const = "sha256" + IPsecPolicyPatchAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IPsecPolicyPatch.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + IPsecPolicyPatchEncryptionAlgorithmAes128Const = "aes128" + IPsecPolicyPatchEncryptionAlgorithmAes256Const = "aes256" + IPsecPolicyPatchEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// Constants associated with the IPsecPolicyPatch.Pfs property. +// Perfect Forward Secrecy. +const ( + IPsecPolicyPatchPfsDisabledConst = "disabled" + IPsecPolicyPatchPfsGroup14Const = "group_14" + IPsecPolicyPatchPfsGroup19Const = "group_19" + IPsecPolicyPatchPfsGroup2Const = "group_2" + IPsecPolicyPatchPfsGroup5Const = "group_5" +) + +// UnmarshalIPsecPolicyPatch unmarshals an instance of IPsecPolicyPatch from the specified map of raw messages. +func UnmarshalIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyPatch) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pfs", &obj.Pfs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// IPsecPolicyReference : IPsecPolicyReference struct +type IPsecPolicyReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *IPsecPolicyReferenceDeleted `json:"deleted,omitempty"` + + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this IPsec policy. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the IPsecPolicyReference.ResourceType property. +// The resource type. +const ( + IPsecPolicyReferenceResourceTypeIpsecPolicyConst = "ipsec_policy" +) + +// UnmarshalIPsecPolicyReference unmarshals an instance of IPsecPolicyReference from the specified map of raw messages. +func UnmarshalIPsecPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIPsecPolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type IPsecPolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalIPsecPolicyReferenceDeleted unmarshals an instance of IPsecPolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalIPsecPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type IkePolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalIkePolicyReferenceDeleted unmarshals an instance of IkePolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalIkePolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Image : Image struct +type Image struct { + // The date and time that the image was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this image. + CRN *string `json:"crn" validate:"required"` + + // The type of encryption used on the image. + Encryption *string `json:"encryption" validate:"required"` + + // The key that will be used to encrypt volumes created from this image (unless an + // alternate `encryption_key` is specified at volume creation). + // + // This property will be present for images with an `encryption` type of `user_managed`. + EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` + + // Details for the stored image file. + File *ImageFile `json:"file" validate:"required"` + + // The URL for this image. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this image. + ID *string `json:"id" validate:"required"` + + // The minimum size (in gigabytes) of a volume onto which this image may be provisioned. + // + // This property may be absent if the image has a `status` of `pending`, `tentative`, or + // `failed`. + MinimumProvisionedSize *int64 `json:"minimum_provisioned_size,omitempty"` + + // The user-defined or system-provided name for this image. + Name *string `json:"name" validate:"required"` + + // The operating system included in this image. + OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` + + // The resource group for this image. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The volume used to create this image (this may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + // If absent, this image was not created from a volume. + SourceVolume *VolumeReference `json:"source_volume,omitempty"` + + // The status of this image + // - available: image can be used (provisionable) + // - deleting: image is being deleted, and can no longer be used to provision new + // resources + // - deprecated: image can be used, but is slated to become `obsolete` (provisionable) + // - failed: image is corrupt or did not pass validation + // - obsolete: image can no longer be used to provision new resources + // - pending: image is being imported and is not yet `available` + // - tentative: image import has timed out (contact support) + // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any): + // - `encrypted_data_key_invalid`: image cannot be decrypted with the specified + // `encryption_key` + // - `encryption_key_deleted`: image unusable because its `encryption_key` was deleted + // - `encryption_key_disabled`: image unusable until its `encryption_key` is re-enabled + // - `image_data_corrupted`: image data is corrupt, or is not in the specified format + // - `image_provisioned_size_unsupported`: image requires a boot volume size greater + // than the maximum supported value + // - `image_request_in_progress`: image operation is in progress (such as an import from + // Cloud Object Storage) + // - `image_request_queued`: image request has been accepted but the requested + // operation has not started + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []ImageStatusReason `json:"status_reasons" validate:"required"` + + // Whether the image is publicly visible or private to the account. + Visibility *string `json:"visibility" validate:"required"` +} + +// Constants associated with the Image.Encryption property. +// The type of encryption used on the image. +const ( + ImageEncryptionNoneConst = "none" + ImageEncryptionUserManagedConst = "user_managed" +) + +// Constants associated with the Image.Status property. +// The status of this image +// - available: image can be used (provisionable) +// - deleting: image is being deleted, and can no longer be used to provision new +// resources +// - deprecated: image can be used, but is slated to become `obsolete` (provisionable) +// - failed: image is corrupt or did not pass validation +// - obsolete: image can no longer be used to provision new resources +// - pending: image is being imported and is not yet `available` +// - tentative: image import has timed out (contact support) +// - unusable: image cannot be used (see `status_reasons[]` for possible remediation) +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the +// unexpected property value was encountered. +const ( + ImageStatusAvailableConst = "available" + ImageStatusDeletingConst = "deleting" + ImageStatusDeprecatedConst = "deprecated" + ImageStatusFailedConst = "failed" + ImageStatusPendingConst = "pending" + ImageStatusTentativeConst = "tentative" + ImageStatusUnusableConst = "unusable" +) + +// Constants associated with the Image.Visibility property. +// Whether the image is publicly visible or private to the account. +const ( + ImageVisibilityPrivateConst = "private" + ImageVisibilityPublicConst = "public" +) + +// UnmarshalImage unmarshals an instance of Image from the specified map of raw messages. +func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Image) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "minimum_provisioned_size", &obj.MinimumProvisionedSize) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalImageStatusReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "visibility", &obj.Visibility) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageCollection : ImageCollection struct +type ImageCollection struct { + // A link to the first page of resources. + First *ImageCollectionFirst `json:"first" validate:"required"` + + // Collection of images. + Images []Image `json:"images" 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 *ImageCollectionNext `json:"next,omitempty"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "images", &obj.Images, UnmarshalImage) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalImageCollectionNext) + if err != nil { + 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 *ImageCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageFile : ImageFile struct +type ImageFile struct { + // Checksums for this image file. + // + // This property may be absent if the associated image has a `status` of `pending` or + // `failed`. + Checksums *ImageFileChecksums `json:"checksums,omitempty"` + + // The size of the stored image file rounded up to the next gigabyte. + // + // This property may be absent if the associated image has a `status` of `pending` or + // `failed`. + Size *int64 `json:"size,omitempty"` +} + +// UnmarshalImageFile unmarshals an instance of ImageFile from the specified map of raw messages. +func UnmarshalImageFile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageFile) + err = core.UnmarshalModel(m, "checksums", &obj.Checksums, UnmarshalImageFileChecksums) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageFileChecksums : ImageFileChecksums struct +type ImageFileChecksums struct { + // The SHA256 fingerprint of the image file. + Sha256 *string `json:"sha256,omitempty"` +} + +// UnmarshalImageFileChecksums unmarshals an instance of ImageFileChecksums from the specified map of raw messages. +func UnmarshalImageFileChecksums(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageFileChecksums) + err = core.UnmarshalPrimitive(m, "sha256", &obj.Sha256) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageFilePrototype : ImageFilePrototype struct +type ImageFilePrototype struct { + // The Cloud Object Storage location of the image file. + // + // The image file format is specified by the file's extension, which must be either + // `qcow2` or `vhd`. + Href *string `json:"href" validate:"required"` +} + +// NewImageFilePrototype : Instantiate ImageFilePrototype (Generic Model Constructor) +func (*VpcV1) NewImageFilePrototype(href string) (_model *ImageFilePrototype, err error) { + _model = &ImageFilePrototype{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalImageFilePrototype unmarshals an instance of ImageFilePrototype from the specified map of raw messages. +func UnmarshalImageFilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageFilePrototype) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentity : Identifies an image by a unique property. +// Models which "extend" this model: +// - ImageIdentityByID +// - ImageIdentityByCRN +// - ImageIdentityByHref +type ImageIdentity struct { + // The unique identifier for this image. + ID *string `json:"id,omitempty"` + + // The CRN for this image. + CRN *string `json:"crn,omitempty"` + + // The URL for this image. + Href *string `json:"href,omitempty"` +} + +func (*ImageIdentity) isaImageIdentity() bool { + return true +} + +type ImageIdentityIntf interface { + isaImageIdentity() bool +} + +// UnmarshalImageIdentity unmarshals an instance of ImageIdentity from the specified map of raw messages. +func UnmarshalImageIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImagePatch : ImagePatch struct +type ImagePatch struct { + // The unique user-defined name for this image. Names starting with `ibm-` are not allowed. + Name *string `json:"name,omitempty"` +} + +// UnmarshalImagePatch unmarshals an instance of ImagePatch from the specified map of raw messages. +func UnmarshalImagePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// ImagePrototype : ImagePrototype struct +// Models which "extend" this model: +// - ImagePrototypeImageByFile +// - ImagePrototypeImageBySourceVolume +type ImagePrototype struct { + // The unique user-defined name for this image. Names starting with `ibm-` 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. + // + // That representation is created by wrapping the key's value with the `encryption_key` root key (which must also be + // specified), using either [Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the + // [Hyper Protect Crypto Services](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). + // + // If unspecified, the imported image is treated as unencrypted. + EncryptedDataKey *string `json:"encrypted_data_key,omitempty"` + + // The root key that was used to wrap the data key (which is ultimately represented as + // `encrypted_data_key`). Additionally, the root key will be used to encrypt volumes + // created from this image (unless an alternate `encryption_key` is specified at volume + // creation). + // + // If unspecified, the imported image is treated as unencrypted. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The file from which to create the image. + File *ImageFilePrototype `json:"file,omitempty"` + + // The [supported operating + // system](https://cloud.ibm.com/apidocs/vpc#list-operating-systems) included in this + // image. + OperatingSystem OperatingSystemIdentityIntf `json:"operating_system,omitempty"` + + // The volume from which to create the image. The specified volume must: + // - Originate from an image, which will be used to populate this image's + // operating system information. + // - Not be `active` or `busy`. + // + // During image creation, the specified volume may briefly become `busy`. + SourceVolume VolumeIdentityIntf `json:"source_volume,omitempty"` +} + +func (*ImagePrototype) isaImagePrototype() bool { + return true +} + +type ImagePrototypeIntf interface { + isaImagePrototype() bool +} + +// UnmarshalImagePrototype unmarshals an instance of ImagePrototype from the specified map of raw messages. +func UnmarshalImagePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageReference : ImageReference struct +type ImageReference struct { + // The CRN for this image. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ImageReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this image. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this image. + ID *string `json:"id" validate:"required"` + + // The user-defined or system-provided name for this image. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalImageReference unmarshals an instance of ImageReference from the specified map of raw messages. +func UnmarshalImageReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalImageReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type ImageReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalImageReferenceDeleted unmarshals an instance of ImageReferenceDeleted from the specified map of raw messages. +func UnmarshalImageReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageStatusReason : ImageStatusReason struct +type ImageStatusReason struct { + // A snake case string succinctly identifying the status reason. + 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 ImageStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + ImageStatusReasonCodeEncryptedDataKeyInvalidConst = "encrypted_data_key_invalid" + ImageStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" + ImageStatusReasonCodeEncryptionKeyDisabledConst = "encryption_key_disabled" + ImageStatusReasonCodeImageDataCorruptedConst = "image_data_corrupted" + ImageStatusReasonCodeImageProvisionedSizeUnsupportedConst = "image_provisioned_size_unsupported" + ImageStatusReasonCodeImageRequestInProgressConst = "image_request_in_progress" + ImageStatusReasonCodeImageRequestQueuedConst = "image_request_queued" +) + +// UnmarshalImageStatusReason unmarshals an instance of ImageStatusReason from the specified map of raw messages. +func UnmarshalImageStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Instance : Instance struct +type Instance struct { + // The availability policy for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicy `json:"availability_policy" validate:"required"` + + // The total bandwidth (in megabits per second) shared across the virtual server instance's network interfaces and + // storage volumes. + Bandwidth *int64 `json:"bandwidth" validate:"required"` + + // Boot volume attachment. + BootVolumeAttachment *VolumeAttachmentReferenceInstanceContext `json:"boot_volume_attachment" validate:"required"` + + // The date and time that the virtual server instance was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, the dedicated host this virtual server instance has been placed on. + DedicatedHost *DedicatedHostReference `json:"dedicated_host,omitempty"` + + // The instance disks for this virtual server instance. + Disks []InstanceDisk `json:"disks" validate:"required"` + + // The virtual server instance GPU configuration. + Gpu *InstanceGpu `json:"gpu,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The image the virtual server instance was provisioned from. + Image *ImageReference `json:"image,omitempty"` + + // The reasons for the current `lifecycle_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []LifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the virtual server instance. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The amount of memory, truncated to whole gibibytes. + Memory *int64 `json:"memory" validate:"required"` + + // The metadata service configuration. + MetadataService *InstanceMetadataService `json:"metadata_service" validate:"required"` + + // The user-defined name for this virtual server instance (and default system hostname). + Name *string `json:"name" validate:"required"` + + // The network interfaces for this virtual server instance, including the primary network interface. + NetworkInterfaces []NetworkInterfaceInstanceContextReference `json:"network_interfaces" validate:"required"` + + // The placement restrictions for the virtual server instance. + PlacementTarget InstancePlacementTargetIntf `json:"placement_target,omitempty"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfaceInstanceContextReference `json:"primary_network_interface" validate:"required"` + + // The profile for this virtual server instance. + Profile *InstanceProfileReference `json:"profile" validate:"required"` + + // The resource group for this instance. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether the state of the virtual server instance permits a start request. + Startable *bool `json:"startable" validate:"required"` + + // The status of the virtual server instance. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the instance on which the unexpected + // property value was encountered. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []InstanceStatusReason `json:"status_reasons" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance network interfaces. + TotalNetworkBandwidth *int64 `json:"total_network_bandwidth" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth" validate:"required"` + + // The virtual server instance VCPU configuration. + Vcpu *InstanceVcpu `json:"vcpu" validate:"required"` + + // The volume attachments for this virtual server instance, including the boot volume attachment. + VolumeAttachments []VolumeAttachmentReferenceInstanceContext `json:"volume_attachments" validate:"required"` + + // The VPC this virtual server instance resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this virtual server instance resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Instance.LifecycleState property. +// The lifecycle state of the virtual server instance. +const ( + InstanceLifecycleStateDeletingConst = "deleting" + InstanceLifecycleStateFailedConst = "failed" + InstanceLifecycleStatePendingConst = "pending" + InstanceLifecycleStateStableConst = "stable" + InstanceLifecycleStateSuspendedConst = "suspended" + InstanceLifecycleStateUpdatingConst = "updating" + InstanceLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Instance.ResourceType property. +// The resource type. +const ( + InstanceResourceTypeInstanceConst = "instance" +) + +// Constants associated with the Instance.Status property. +// The status of the virtual server instance. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the instance on which the unexpected +// property value was encountered. +const ( + InstanceStatusDeletingConst = "deleting" + InstanceStatusFailedConst = "failed" + InstanceStatusPendingConst = "pending" + InstanceStatusRestartingConst = "restarting" + InstanceStatusRunningConst = "running" + InstanceStatusStartingConst = "starting" + InstanceStatusStoppedConst = "stopped" + InstanceStatusStoppingConst = "stopping" +) + +// UnmarshalInstance unmarshals an instance of Instance from the specified map of raw messages. +func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Instance) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentReferenceInstanceContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dedicated_host", &obj.DedicatedHost, UnmarshalDedicatedHostReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu", &obj.Gpu, UnmarshalInstanceGpu) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataService) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceInstanceContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceInstanceContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "startable", &obj.Startable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalInstanceStatusReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_network_bandwidth", &obj.TotalNetworkBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalInstanceVcpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceAction : InstanceAction struct +type InstanceAction struct { + // The date and time that the action was completed. + CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` + + // The date and time that the action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // 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"` + + // The URL for this instance action. + Href *string `json:"href" validate:"required"` + + // The identifier for this instance action. + ID *string `json:"id" validate:"required"` + + // The date and time that the action was started. + StartedAt *strfmt.DateTime `json:"started_at,omitempty"` + + // The current status of this action. + Status *string `json:"status" validate:"required"` + + // The type of action. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceAction.Status property. +// The current status of this action. +const ( + InstanceActionStatusCompletedConst = "completed" + InstanceActionStatusFailedConst = "failed" + InstanceActionStatusPendingConst = "pending" + InstanceActionStatusRunningConst = "running" +) + +// Constants associated with the InstanceAction.Type property. +// The type of action. +const ( + InstanceActionTypeRebootConst = "reboot" + InstanceActionTypeStartConst = "start" + InstanceActionTypeStopConst = "stop" +) + +// UnmarshalInstanceAction unmarshals an instance of InstanceAction from the specified map of raw messages. +func UnmarshalInstanceAction(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceAction) + err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "force", &obj.Force) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceAvailabilityPolicy : InstanceAvailabilityPolicy struct +type InstanceAvailabilityPolicy struct { + // The action to perform if the compute host experiences a failure. + // - `restart`: Automatically restart the virtual server instance after host failure + // - `stop`: Leave the virtual server instance stopped after host failure + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the + // unexpected property value was encountered. + HostFailure *string `json:"host_failure" validate:"required"` +} + +// Constants associated with the InstanceAvailabilityPolicy.HostFailure property. +// The action to perform if the compute host experiences a failure. +// - `restart`: Automatically restart the virtual server instance after host failure +// - `stop`: Leave the virtual server instance stopped after host failure +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the +// unexpected property value was encountered. +const ( + InstanceAvailabilityPolicyHostFailureRestartConst = "restart" + InstanceAvailabilityPolicyHostFailureStopConst = "stop" +) + +// UnmarshalInstanceAvailabilityPolicy unmarshals an instance of InstanceAvailabilityPolicy from the specified map of raw messages. +func UnmarshalInstanceAvailabilityPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceAvailabilityPolicy) + err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceAvailabilityPolicyPatch : InstanceAvailabilityPolicyPatch struct +type InstanceAvailabilityPolicyPatch struct { + // The action to perform if the compute host experiences a failure. + // - `restart`: Automatically restart the virtual server instance after host failure + // - `stop`: Leave the virtual server instance stopped after host failure + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the + // unexpected property value was encountered. + HostFailure *string `json:"host_failure,omitempty"` +} + +// Constants associated with the InstanceAvailabilityPolicyPatch.HostFailure property. +// The action to perform if the compute host experiences a failure. +// - `restart`: Automatically restart the virtual server instance after host failure +// - `stop`: Leave the virtual server instance stopped after host failure +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the +// unexpected property value was encountered. +const ( + InstanceAvailabilityPolicyPatchHostFailureRestartConst = "restart" + InstanceAvailabilityPolicyPatchHostFailureStopConst = "stop" +) + +// UnmarshalInstanceAvailabilityPolicyPatch unmarshals an instance of InstanceAvailabilityPolicyPatch from the specified map of raw messages. +func UnmarshalInstanceAvailabilityPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceAvailabilityPolicyPatch) + err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceAvailabilityPrototype : InstanceAvailabilityPrototype struct +type InstanceAvailabilityPrototype struct { + // The action to perform if the compute host experiences a failure. + // - `restart`: Automatically restart the virtual server instance after host failure + // - `stop`: Leave the virtual server instance stopped after host failure + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the + // unexpected property value was encountered. + HostFailure *string `json:"host_failure,omitempty"` +} + +// Constants associated with the InstanceAvailabilityPrototype.HostFailure property. +// The action to perform if the compute host experiences a failure. +// - `restart`: Automatically restart the virtual server instance after host failure +// - `stop`: Leave the virtual server instance stopped after host failure +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the +// unexpected property value was encountered. +const ( + InstanceAvailabilityPrototypeHostFailureRestartConst = "restart" + InstanceAvailabilityPrototypeHostFailureStopConst = "stop" +) + +// UnmarshalInstanceAvailabilityPrototype unmarshals an instance of InstanceAvailabilityPrototype from the specified map of raw messages. +func UnmarshalInstanceAvailabilityPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceAvailabilityPrototype) + err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) + if err != nil { + 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 *InstanceCollectionFirst `json:"first" validate:"required"` + + // Collection 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 *InstanceCollectionNext `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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstance) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + 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"` +} + +// 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) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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. + Href *string `json:"href" 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) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceConsoleAccessToken : The instance console access token information. +type InstanceConsoleAccessToken struct { + // A URL safe single-use token used to access the console WebSocket. + AccessToken *string `json:"access_token" validate:"required"` + + // The instance console type for which this token may be used. + ConsoleType *string `json:"console_type" validate:"required"` + + // The date and time that the access token was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The date and time that the access token will expire. + ExpiresAt *strfmt.DateTime `json:"expires_at" 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"` + + // The URL to access this instance console. + Href *string `json:"href" validate:"required"` +} + +// Constants associated with the InstanceConsoleAccessToken.ConsoleType property. +// The instance console type for which this token may be used. +const ( + InstanceConsoleAccessTokenConsoleTypeSerialConst = "serial" + InstanceConsoleAccessTokenConsoleTypeVncConst = "vnc" +) + +// UnmarshalInstanceConsoleAccessToken unmarshals an instance of InstanceConsoleAccessToken from the specified map of raw messages. +func UnmarshalInstanceConsoleAccessToken(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceConsoleAccessToken) + err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "force", &obj.Force) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDefaultTrustedProfilePrototype : InstanceDefaultTrustedProfilePrototype struct +type InstanceDefaultTrustedProfilePrototype struct { + // If set to `true`, the system will create a link to the specified `target` trusted profile during instance creation. + // Regardless of whether a link is created by the system or manually using the IAM Identity service, it will be + // automatically deleted when the instance is deleted. + AutoLink *bool `json:"auto_link,omitempty"` + + // The default IAM trusted profile to use for this virtual server instance. + Target TrustedProfileIdentityIntf `json:"target" validate:"required"` +} + +// NewInstanceDefaultTrustedProfilePrototype : Instantiate InstanceDefaultTrustedProfilePrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceDefaultTrustedProfilePrototype(target TrustedProfileIdentityIntf) (_model *InstanceDefaultTrustedProfilePrototype, err error) { + _model = &InstanceDefaultTrustedProfilePrototype{ + Target: target, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalInstanceDefaultTrustedProfilePrototype unmarshals an instance of InstanceDefaultTrustedProfilePrototype from the specified map of raw messages. +func UnmarshalInstanceDefaultTrustedProfilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDefaultTrustedProfilePrototype) + err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDisk : InstanceDisk struct +type InstanceDisk struct { + // The date and time that the disk was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance disk. + ID *string `json:"id" validate:"required"` + + // The disk interface used for attaching the disk. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The user-defined name for this disk. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *int64 `json:"size" validate:"required"` +} + +// Constants associated with the InstanceDisk.InterfaceType property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + InstanceDiskInterfaceTypeNvmeConst = "nvme" + InstanceDiskInterfaceTypeVirtioBlkConst = "virtio_blk" +) + +// Constants associated with the InstanceDisk.ResourceType property. +// The resource type. +const ( + InstanceDiskResourceTypeInstanceDiskConst = "instance_disk" +) + +// UnmarshalInstanceDisk unmarshals an instance of InstanceDisk from the specified map of raw messages. +func UnmarshalInstanceDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDisk) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDiskCollection : InstanceDiskCollection struct +type InstanceDiskCollection struct { + // Collection of the instance's disks. + Disks []InstanceDisk `json:"disks" validate:"required"` +} + +// UnmarshalInstanceDiskCollection unmarshals an instance of InstanceDiskCollection from the specified map of raw messages. +func UnmarshalInstanceDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskCollection) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDiskPatch : InstanceDiskPatch struct +type InstanceDiskPatch struct { + // The user-defined name for this disk. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceDiskPatch unmarshals an instance of InstanceDiskPatch from the specified map of raw messages. +func UnmarshalInstanceDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceDiskReference : InstanceDiskReference struct +type InstanceDiskReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceDiskReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance disk. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this disk. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstanceDiskReference.ResourceType property. +// The resource type. +const ( + InstanceDiskReferenceResourceTypeInstanceDiskConst = "instance_disk" +) + +// UnmarshalInstanceDiskReference unmarshals an instance of InstanceDiskReference from the specified map of raw messages. +func UnmarshalInstanceDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceDiskReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceDiskReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceDiskReferenceDeleted unmarshals an instance of InstanceDiskReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGpu : The virtual server instance GPU configuration. +type InstanceGpu struct { + // The number of GPUs assigned to the instance. + Count *int64 `json:"count" validate:"required"` + + // The GPU manufacturer. + Manufacturer *string `json:"manufacturer" validate:"required"` + + // The overall amount of GPU memory in GiB (gibibytes). + Memory *int64 `json:"memory" validate:"required"` + + // The GPU model. + Model *string `json:"model" validate:"required"` +} + +// UnmarshalInstanceGpu unmarshals an instance of InstanceGpu from the specified map of raw messages. +func UnmarshalInstanceGpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGpu) + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "model", &obj.Model) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroup : InstanceGroup struct +type InstanceGroup struct { + // Required if specifying a load balancer pool only. Used by the instance group when scaling up instances to supply the + // port for the load balancer pool member. + ApplicationPort *int64 `json:"application_port,omitempty"` + + // The date and time that the instance group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance group. + CRN *string `json:"crn" validate:"required"` + + // The URL for this instance group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group. + ID *string `json:"id" validate:"required"` + + // The template used to create new instances for this group. + InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` + + // The load balancer pool managed by this group. Instances created + // by this group will have a new load balancer pool member in that + // pool created. + LoadBalancerPool *LoadBalancerPoolReference `json:"load_balancer_pool,omitempty"` + + // The managers for the instance group. + Managers []InstanceGroupManagerReference `json:"managers" validate:"required"` + + // The number of instances in the instance group. + MembershipCount *int64 `json:"membership_count" validate:"required"` + + // The user-defined name for this instance group. + Name *string `json:"name" validate:"required"` + + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The status of the instance group + // - `deleting`: Group is being deleted + // - `healthy`: Group has `membership_count` instances + // - `scaling`: Instances in the group are being created or deleted to reach + // `membership_count` + // - `unhealthy`: Group is unable to reach `membership_count` instances. + Status *string `json:"status" validate:"required"` + + // The subnets to use when creating new instances. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The date and time that the instance group was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The VPC the instance group resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the InstanceGroup.Status property. +// The status of the instance group +// - `deleting`: Group is being deleted +// - `healthy`: Group has `membership_count` instances +// - `scaling`: Instances in the group are being created or deleted to reach +// `membership_count` +// - `unhealthy`: Group is unable to reach `membership_count` instances. +const ( + InstanceGroupStatusDeletingConst = "deleting" + InstanceGroupStatusHealthyConst = "healthy" + InstanceGroupStatusScalingConst = "scaling" + InstanceGroupStatusUnhealthyConst = "unhealthy" +) + +// UnmarshalInstanceGroup unmarshals an instance of InstanceGroup from the specified map of raw messages. +func UnmarshalInstanceGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroup) + err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManagerReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupCollection : InstanceGroupCollection struct +type InstanceGroupCollection struct { + // A link to the first page of resources. + First *InstanceGroupCollectionFirst `json:"first" validate:"required"` + + // Collection of instance groups. + InstanceGroups []InstanceGroup `json:"instance_groups" 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 *InstanceGroupCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_groups", &obj.InstanceGroups, UnmarshalInstanceGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *InstanceGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManager : InstanceGroupManager struct +// Models which "extend" this model: +// - InstanceGroupManagerAutoScale +// - InstanceGroupManagerScheduled +type InstanceGroupManager struct { + // The date and time that the instance group manager was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled" validate:"required"` + + // The user-defined name for this instance group manager. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type,omitempty"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The policies of the instance group manager. + Policies []InstanceGroupManagerPolicyReference `json:"policies,omitempty"` + + // The actions of the instance group manager. + Actions []InstanceGroupManagerActionReference `json:"actions,omitempty"` +} + +// Constants associated with the InstanceGroupManager.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerManagerTypeAutoscaleConst = "autoscale" +) + +func (*InstanceGroupManager) isaInstanceGroupManager() bool { + return true +} + +type InstanceGroupManagerIntf interface { + isaInstanceGroupManager() bool +} + +// UnmarshalInstanceGroupManager unmarshals an instance of InstanceGroupManager from the specified map of raw messages. +func UnmarshalInstanceGroupManager(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManager) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerAction : InstanceGroupManagerAction struct +// Models which "extend" this model: +// - InstanceGroupManagerActionScheduledAction +type InstanceGroupManagerAction struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. 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`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the + // future. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` + + // The date and time that the instance group manager action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group manager action. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was modified. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroup `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager,omitempty"` +} + +// Constants associated with the InstanceGroupManagerAction.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerAction.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionStatusActiveConst = "active" + InstanceGroupManagerActionStatusCompletedConst = "completed" + InstanceGroupManagerActionStatusFailedConst = "failed" + InstanceGroupManagerActionStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerAction.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerAction) isaInstanceGroupManagerAction() bool { + return true +} + +type InstanceGroupManagerActionIntf interface { + isaInstanceGroupManagerAction() bool +} + +// UnmarshalInstanceGroupManagerAction unmarshals an instance of InstanceGroupManagerAction from the specified map of raw messages. +func UnmarshalInstanceGroupManagerAction(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerAction) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionGroupPatch : InstanceGroupManagerActionGroupPatch struct +type InstanceGroupManagerActionGroupPatch struct { + // The desired number of instance group members at the scheduled time. + MembershipCount *int64 `json:"membership_count,omitempty"` +} + +// UnmarshalInstanceGroupManagerActionGroupPatch unmarshals an instance of InstanceGroupManagerActionGroupPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionGroupPatch) + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionManagerPatch : InstanceGroupManagerActionManagerPatch struct +type InstanceGroupManagerActionManagerPatch struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +// UnmarshalInstanceGroupManagerActionManagerPatch unmarshals an instance of InstanceGroupManagerActionManagerPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionManagerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionManagerPatch) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPatch : InstanceGroupManagerActionPatch struct +type InstanceGroupManagerActionPatch struct { + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + Group *InstanceGroupManagerActionGroupPatch `json:"group,omitempty"` + + Manager *InstanceGroupManagerActionManagerPatch `json:"manager,omitempty"` + + // The user-defined name for this instance group manager action. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` +} + +// UnmarshalInstanceGroupManagerActionPatch unmarshals an instance of InstanceGroupManagerActionPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPatch) + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerActionGroupPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerActionManagerPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceGroupManagerActionPrototype : InstanceGroupManagerActionPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerActionPrototypeScheduledActionPrototype +type InstanceGroupManagerActionPrototype struct { + // The user-defined name for this instance group manager action. Names must be unique within the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` +} + +func (*InstanceGroupManagerActionPrototype) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +type InstanceGroupManagerActionPrototypeIntf interface { + isaInstanceGroupManagerActionPrototype() bool +} + +// UnmarshalInstanceGroupManagerActionPrototype unmarshals an instance of InstanceGroupManagerActionPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionReference : InstanceGroupManagerActionReference struct +type InstanceGroupManagerActionReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerActionReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group manager action. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerActionReference.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionReferenceResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// UnmarshalInstanceGroupManagerActionReference unmarshals an instance of InstanceGroupManagerActionReference from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerActionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceGroupManagerActionReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupManagerActionReferenceDeleted unmarshals an instance of InstanceGroupManagerActionReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionsCollection : InstanceGroupManagerActionsCollection struct +type InstanceGroupManagerActionsCollection struct { + // Collection of instance group manager actions. + Actions []InstanceGroupManagerActionIntf `json:"actions" validate:"required"` + + // A link to the first page of resources. + First *InstanceGroupManagerActionsCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceGroupManagerActionsCollection unmarshals an instance of InstanceGroupManagerActionsCollection from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionsCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionsCollection) + err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerAction) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerActionsCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerActionsCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *InstanceGroupManagerActionsCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of instance group managers. + Managers []InstanceGroupManagerIntf `json:"managers" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceGroupManagerCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManager) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *InstanceGroupManagerCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The user-defined name for this instance group manager. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceGroupManagerPatch unmarshals an instance of InstanceGroupManagerPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPatch) + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceGroupManagerPolicy : InstanceGroupManagerPolicy struct +// Models which "extend" this model: +// - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy +type InstanceGroupManagerPolicy struct { + // The date and time that the instance group manager policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager policy. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group manager policy. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager policy was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type,omitempty"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value,omitempty"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPolicy.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicy.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyPolicyTypeTargetConst = "target" +) + +func (*InstanceGroupManagerPolicy) isaInstanceGroupManagerPolicy() bool { + return true +} + +type InstanceGroupManagerPolicyIntf interface { + isaInstanceGroupManagerPolicy() bool +} + +// UnmarshalInstanceGroupManagerPolicy unmarshals an instance of InstanceGroupManagerPolicy from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicy) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyCollection : InstanceGroupManagerPolicyCollection struct +type InstanceGroupManagerPolicyCollection struct { + // A link to the first page of resources. + First *InstanceGroupManagerPolicyCollectionFirst `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"` + + // Collection of instance group manager policies. + Policies []InstanceGroupManagerPolicyIntf `json:"policies" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerPolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *InstanceGroupManagerPolicyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyPatch : InstanceGroupManagerPolicyPatch struct +type InstanceGroupManagerPolicyPatch struct { + // The type of metric to be evaluated. + MetricType *string `json:"metric_type,omitempty"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value,omitempty"` + + // The user-defined name for this instance group manager policy. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPolicyPatch.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyPatchMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyPatchMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyPatchMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyPatchMetricTypeNetworkOutConst = "network_out" +) + +// UnmarshalInstanceGroupManagerPolicyPatch unmarshals an instance of InstanceGroupManagerPolicyPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyPatch) + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceGroupManagerPolicyPrototype : InstanceGroupManagerPolicyPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype +type InstanceGroupManagerPolicyPrototype struct { + // The user-defined name for this instance group manager policy. Names must be unique within the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type,omitempty"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value,omitempty"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPolicyPrototype.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyPrototypeMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyPrototypeMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyPrototypeMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyPrototypeMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicyPrototype.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyPrototypePolicyTypeTargetConst = "target" +) + +func (*InstanceGroupManagerPolicyPrototype) isaInstanceGroupManagerPolicyPrototype() bool { + return true +} + +type InstanceGroupManagerPolicyPrototypeIntf interface { + isaInstanceGroupManagerPolicyPrototype() bool +} + +// UnmarshalInstanceGroupManagerPolicyPrototype unmarshals an instance of InstanceGroupManagerPolicyPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyReference : InstanceGroupManagerPolicyReference struct +type InstanceGroupManagerPolicyReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerPolicyReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager policy. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group manager policy. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceGroupManagerPolicyReference unmarshals an instance of InstanceGroupManagerPolicyReference from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerPolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceGroupManagerPolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupManagerPolicyReferenceDeleted unmarshals an instance of InstanceGroupManagerPolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPrototype : InstanceGroupManagerPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype +// - InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype +type InstanceGroupManagerPrototype struct { + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The user-defined name for this instance group manager. Names must be unique within the instance group. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type,omitempty"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPrototype.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerPrototypeManagerTypeAutoscaleConst = "autoscale" +) + +func (*InstanceGroupManagerPrototype) isaInstanceGroupManagerPrototype() bool { + return true +} + +type InstanceGroupManagerPrototypeIntf interface { + isaInstanceGroupManagerPrototype() bool +} + +// UnmarshalInstanceGroupManagerPrototype unmarshals an instance of InstanceGroupManagerPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPrototype) + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerReference : InstanceGroupManagerReference struct +type InstanceGroupManagerReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group manager. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceGroupManagerReference unmarshals an instance of InstanceGroupManagerReference from the specified map of raw messages. +func UnmarshalInstanceGroupManagerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceGroupManagerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupManagerReferenceDeleted unmarshals an instance of InstanceGroupManagerReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupManagerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionGroup : InstanceGroupManagerScheduledActionGroup struct +type InstanceGroupManagerScheduledActionGroup struct { + // The desired number of instance group members at the scheduled time. + MembershipCount *int64 `json:"membership_count" validate:"required"` +} + +// UnmarshalInstanceGroupManagerScheduledActionGroup unmarshals an instance of InstanceGroupManagerScheduledActionGroup from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionGroup) + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionGroupPrototype : InstanceGroupManagerScheduledActionGroupPrototype struct +type InstanceGroupManagerScheduledActionGroupPrototype struct { + // The desired number of instance group members at the scheduled time. + MembershipCount *int64 `json:"membership_count" validate:"required"` +} + +// NewInstanceGroupManagerScheduledActionGroupPrototype : Instantiate InstanceGroupManagerScheduledActionGroupPrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerScheduledActionGroupPrototype(membershipCount int64) (_model *InstanceGroupManagerScheduledActionGroupPrototype, err error) { + _model = &InstanceGroupManagerScheduledActionGroupPrototype{ + MembershipCount: core.Int64Ptr(membershipCount), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalInstanceGroupManagerScheduledActionGroupPrototype unmarshals an instance of InstanceGroupManagerScheduledActionGroupPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionGroupPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionGroupPrototype) + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManager : InstanceGroupManagerScheduledActionManager struct +// Models which "extend" this model: +// - InstanceGroupManagerScheduledActionManagerAutoScale +type InstanceGroupManagerScheduledActionManager struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href,omitempty"` + + // The unique identifier for this instance group manager. + ID *string `json:"id,omitempty"` + + // The user-defined name for this instance group manager. + Name *string `json:"name,omitempty"` + + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +func (*InstanceGroupManagerScheduledActionManager) isaInstanceGroupManagerScheduledActionManager() bool { + return true +} + +type InstanceGroupManagerScheduledActionManagerIntf interface { + isaInstanceGroupManagerScheduledActionManager() bool +} + +// UnmarshalInstanceGroupManagerScheduledActionManager unmarshals an instance of InstanceGroupManagerScheduledActionManager from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManager(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManager) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototype : InstanceGroupManagerScheduledActionManagerPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype +type InstanceGroupManagerScheduledActionManagerPrototype struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The unique identifier for this instance group manager. + ID *string `json:"id,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href,omitempty"` +} + +func (*InstanceGroupManagerScheduledActionManagerPrototype) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +type InstanceGroupManagerScheduledActionManagerPrototypeIntf interface { + isaInstanceGroupManagerScheduledActionManagerPrototype() bool +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototype unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototype) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembership : InstanceGroupMembership struct +type InstanceGroupMembership struct { + // The date and time that the instance group manager policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If set to true, when deleting the membership the instance will also be deleted. + DeleteInstanceOnMembershipDelete *bool `json:"delete_instance_on_membership_delete" validate:"required"` + + // The URL for this instance group membership. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group membership. + ID *string `json:"id" validate:"required"` + + Instance *InstanceReference `json:"instance" validate:"required"` + + InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` + + // The user-defined name for this instance group membership. Names must be unique within the instance group. + Name *string `json:"name" validate:"required"` + + PoolMember *LoadBalancerPoolMemberReference `json:"pool_member,omitempty"` + + // The status of the instance group membership + // - `deleting`: Membership is deleting dependent resources + // - `failed`: Membership was unable to maintain dependent resources + // - `healthy`: Membership is active and serving in the group + // - `pending`: Membership is waiting for dependent resources + // - `unhealthy`: Membership has unhealthy dependent resources. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group membership was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` +} + +// Constants associated with the InstanceGroupMembership.Status property. +// The status of the instance group membership +// - `deleting`: Membership is deleting dependent resources +// - `failed`: Membership was unable to maintain dependent resources +// - `healthy`: Membership is active and serving in the group +// - `pending`: Membership is waiting for dependent resources +// - `unhealthy`: Membership has unhealthy dependent resources. +const ( + InstanceGroupMembershipStatusDeletingConst = "deleting" + InstanceGroupMembershipStatusFailedConst = "failed" + InstanceGroupMembershipStatusHealthyConst = "healthy" + InstanceGroupMembershipStatusPendingConst = "pending" + InstanceGroupMembershipStatusUnhealthyConst = "unhealthy" +) + +// UnmarshalInstanceGroupMembership unmarshals an instance of InstanceGroupMembership from the specified map of raw messages. +func UnmarshalInstanceGroupMembership(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupMembership) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "delete_instance_on_membership_delete", &obj.DeleteInstanceOnMembershipDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalInstanceReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pool_member", &obj.PoolMember, UnmarshalLoadBalancerPoolMemberReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembershipCollection : InstanceGroupMembershipCollection struct +type InstanceGroupMembershipCollection struct { + // A link to the first page of resources. + First *InstanceGroupMembershipCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of instance group memberships. + Memberships []InstanceGroupMembership `json:"memberships" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceGroupMembershipCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memberships", &obj.Memberships, UnmarshalInstanceGroupMembership) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupMembershipCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *InstanceGroupMembershipCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembershipPatch : InstanceGroupMembershipPatch struct +type InstanceGroupMembershipPatch struct { + // The user-defined name for this instance group membership. Names must be unique within the instance group. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceGroupMembershipPatch unmarshals an instance of InstanceGroupMembershipPatch from the specified map of raw messages. +func UnmarshalInstanceGroupMembershipPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupMembershipPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceGroupPatch : To add or update load balancer specification for an instance group the `membership_count` must first be set to 0. +type InstanceGroupPatch struct { + // Required if specifying a load balancer pool only. Used by the instance group when scaling up instances to supply the + // port for the load balancer pool member. + ApplicationPort *int64 `json:"application_port,omitempty"` + + // Instance template to use when creating new instances. + // + // Instance groups are not compatible with instance templates that specify `true` for + // `default_trusted_profile.auto_link`. + InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template,omitempty"` + + // The load balancer associated with the specified load balancer pool. + // Required if `load_balancer_pool` is specified. + // + // At present, only load balancers in the `application` family are supported. + LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` + + // If specified, the load balancer pool will be managed by this + // group. Instances created by this group will have a new load + // balancer pool member in that pool created. Must be used with + // `application_port`. + LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"` + + // The number of instances in the instance group. + MembershipCount *int64 `json:"membership_count,omitempty"` + + // The user-defined name for this instance group. + Name *string `json:"name,omitempty"` + + // The subnets to use when creating new instances. + Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` +} + +// UnmarshalInstanceGroupPatch unmarshals an instance of InstanceGroupPatch from the specified map of raw messages. +func UnmarshalInstanceGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupPatch) + err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancer", &obj.LoadBalancer, UnmarshalLoadBalancerIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceGroupReference : InstanceGroupReference struct +type InstanceGroupReference struct { + // The CRN for this instance group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceGroupReference unmarshals an instance of InstanceGroupReference from the specified map of raw messages. +func UnmarshalInstanceGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupReferenceDeleted unmarshals an instance of InstanceGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceInitialization : InstanceInitialization struct +type InstanceInitialization struct { + // The default trusted profile configuration specified at virtual server instance + // creation. If absent, no default trusted profile was specified. + DefaultTrustedProfile *InstanceInitializationDefaultTrustedProfile `json:"default_trusted_profile,omitempty"` + + // The public SSH keys used at instance initialization. + Keys []KeyReference `json:"keys" validate:"required"` + + Password *InstanceInitializationPassword `json:"password,omitempty"` +} + +// UnmarshalInstanceInitialization unmarshals an instance of InstanceInitialization from the specified map of raw messages. +func UnmarshalInstanceInitialization(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceInitialization) + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceInitializationDefaultTrustedProfile) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "password", &obj.Password, UnmarshalInstanceInitializationPassword) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceInitializationDefaultTrustedProfile : InstanceInitializationDefaultTrustedProfile struct +type InstanceInitializationDefaultTrustedProfile struct { + // If set to `true`, the system created a link to the specified `target` trusted profile during instance creation. + // Regardless of whether a link was created by the system or manually using the IAM Identity service, it will be + // automatically deleted when the instance is deleted. + AutoLink *bool `json:"auto_link" validate:"required"` + + // The default IAM trusted profile to use for this virtual server instance. + Target *TrustedProfileReference `json:"target" validate:"required"` +} + +// UnmarshalInstanceInitializationDefaultTrustedProfile unmarshals an instance of InstanceInitializationDefaultTrustedProfile from the specified map of raw messages. +func UnmarshalInstanceInitializationDefaultTrustedProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceInitializationDefaultTrustedProfile) + err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceInitializationPassword : InstanceInitializationPassword struct +type InstanceInitializationPassword struct { + // The administrator password at initialization, encrypted using `encryption_key`, and returned base64-encoded. + EncryptedPassword *[]byte `json:"encrypted_password" validate:"required"` + + // The public SSH key used to encrypt the administrator password. + EncryptionKey *KeyIdentityByFingerprint `json:"encryption_key" validate:"required"` +} + +// UnmarshalInstanceInitializationPassword unmarshals an instance of InstanceInitializationPassword from the specified map of raw messages. +func UnmarshalInstanceInitializationPassword(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceInitializationPassword) + err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyIdentityByFingerprint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceMetadataService : The metadata service configuration. +type InstanceMetadataService struct { + // Indicates whether the metadata service endpoint is available to the virtual server instance. + Enabled *bool `json:"enabled" validate:"required"` +} + +// UnmarshalInstanceMetadataService unmarshals an instance of InstanceMetadataService from the specified map of raw messages. +func UnmarshalInstanceMetadataService(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceMetadataService) + err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceMetadataServicePatch : The metadata service configuration. +type InstanceMetadataServicePatch struct { + // Indicates whether the metadata service endpoint will be available to the virtual server instance. + Enabled *bool `json:"enabled,omitempty"` +} + +// UnmarshalInstanceMetadataServicePatch unmarshals an instance of InstanceMetadataServicePatch from the specified map of raw messages. +func UnmarshalInstanceMetadataServicePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceMetadataServicePatch) + err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceMetadataServicePrototype : The metadata service configuration. +type InstanceMetadataServicePrototype struct { + // Indicates whether the metadata service endpoint will be available to the virtual server instance. + Enabled *bool `json:"enabled,omitempty"` +} + +// UnmarshalInstanceMetadataServicePrototype unmarshals an instance of InstanceMetadataServicePrototype from the specified map of raw messages. +func UnmarshalInstanceMetadataServicePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceMetadataServicePrototype) + err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePatch : InstancePatch struct +type InstancePatch struct { + // The availability policy for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPatch `json:"availability_policy,omitempty"` + + // The metadata service configuration. + MetadataService *InstanceMetadataServicePatch `json:"metadata_service,omitempty"` + + // The user-defined name for this virtual server instance (and default system hostname). + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. For the placement + // restrictions to be changed, the instance `status` must be `stopping` or `stopped`. + 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. + // - 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`. + // - Have the same `vcpu.architecture`. + Profile InstancePatchProfileIntf `json:"profile,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` +} + +// UnmarshalInstancePatch unmarshals an instance of InstancePatch from the specified map of raw messages. +func UnmarshalInstancePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatch) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstancePatchProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + 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. +// - 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`. +// - Have the same `vcpu.architecture`. +// Models which "extend" this model: +// - InstancePatchProfileInstanceProfileIdentityByName +// - InstancePatchProfileInstanceProfileIdentityByHref +type InstancePatchProfile struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name,omitempty"` + + // The URL for this virtual server instance profile. + Href *string `json:"href,omitempty"` +} + +func (*InstancePatchProfile) isaInstancePatchProfile() bool { + return true +} + +type InstancePatchProfileIntf interface { + isaInstancePatchProfile() bool +} + +// UnmarshalInstancePatchProfile unmarshals an instance of InstancePatchProfile from the specified map of raw messages. +func UnmarshalInstancePatchProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatchProfile) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTarget : InstancePlacementTarget struct +// Models which "extend" this model: +// - InstancePlacementTargetDedicatedHostGroupReference +// - InstancePlacementTargetDedicatedHostReference +// - InstancePlacementTargetPlacementGroupReference +type InstancePlacementTarget struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href,omitempty"` + + // The unique identifier for this dedicated host group. + ID *string `json:"id,omitempty"` + + // The unique user-defined name for this dedicated host group. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the InstancePlacementTarget.ResourceType property. +// The resource type. +const ( + InstancePlacementTargetResourceTypeDedicatedHostGroupConst = "dedicated_host_group" +) + +func (*InstancePlacementTarget) isaInstancePlacementTarget() bool { + return true +} + +type InstancePlacementTargetIntf interface { + isaInstancePlacementTarget() bool +} + +// UnmarshalInstancePlacementTarget unmarshals an instance of InstancePlacementTarget from the specified map of raw messages. +func UnmarshalInstancePlacementTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTarget) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatch : InstancePlacementTargetPatch struct +// Models which "extend" this model: +// - InstancePlacementTargetPatchDedicatedHostIdentity +// - InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatch struct { + // The unique identifier for this dedicated host. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPatch) isaInstancePlacementTargetPatch() bool { + return true +} + +type InstancePlacementTargetPatchIntf interface { + isaInstancePlacementTargetPatch() bool +} + +// UnmarshalInstancePlacementTargetPatch unmarshals an instance of InstancePlacementTargetPatch from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototype : InstancePlacementTargetPrototype struct +// Models which "extend" this model: +// - InstancePlacementTargetPrototypeDedicatedHostIdentity +// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +// - InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototype struct { + // The unique identifier for this dedicated host. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPrototype) isaInstancePlacementTargetPrototype() bool { + return true +} + +type InstancePlacementTargetPrototypeIntf interface { + isaInstancePlacementTargetPrototype() bool +} + +// UnmarshalInstancePlacementTargetPrototype unmarshals an instance of InstancePlacementTargetPrototype from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfile : InstanceProfile struct +type InstanceProfile struct { + Bandwidth InstanceProfileBandwidthIntf `json:"bandwidth" validate:"required"` + + // Collection of the instance profile's disks. + Disks []InstanceProfileDisk `json:"disks" validate:"required"` + + // The product family this virtual server instance profile belongs to. + Family *string `json:"family,omitempty"` + + GpuCount InstanceProfileGpuIntf `json:"gpu_count,omitempty"` + + GpuManufacturer *InstanceProfileGpuManufacturer `json:"gpu_manufacturer,omitempty"` + + GpuMemory InstanceProfileGpuMemoryIntf `json:"gpu_memory,omitempty"` + + GpuModel *InstanceProfileGpuModel `json:"gpu_model,omitempty"` + + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` + + Memory InstanceProfileMemoryIntf `json:"memory" validate:"required"` + + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` + + OsArchitecture *InstanceProfileOsArchitecture `json:"os_architecture" validate:"required"` + + PortSpeed InstanceProfilePortSpeedIntf `json:"port_speed" validate:"required"` + + TotalVolumeBandwidth InstanceProfileVolumeBandwidthIntf `json:"total_volume_bandwidth" validate:"required"` + + VcpuArchitecture *InstanceProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` + + VcpuCount InstanceProfileVcpuIntf `json:"vcpu_count" validate:"required"` +} + +// UnmarshalInstanceProfile unmarshals an instance of InstanceProfile from the specified map of raw messages. +func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfile) + err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalInstanceProfileBandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceProfileDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu_count", &obj.GpuCount, UnmarshalInstanceProfileGpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu_manufacturer", &obj.GpuManufacturer, UnmarshalInstanceProfileGpuManufacturer) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu_memory", &obj.GpuMemory, UnmarshalInstanceProfileGpuMemory) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu_model", &obj.GpuModel, UnmarshalInstanceProfileGpuModel) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalInstanceProfileMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalInstanceProfileOsArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "port_speed", &obj.PortSpeed, UnmarshalInstanceProfilePortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth, UnmarshalInstanceProfileVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalInstanceProfileVcpuArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalInstanceProfileVcpu) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidth : InstanceProfileBandwidth struct +// Models which "extend" this model: +// - InstanceProfileBandwidthFixed +// - InstanceProfileBandwidthRange +// - InstanceProfileBandwidthEnum +// - InstanceProfileBandwidthDependent +type InstanceProfileBandwidth 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 InstanceProfileBandwidth.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthTypeFixedConst = "fixed" +) + +func (*InstanceProfileBandwidth) isaInstanceProfileBandwidth() bool { + return true +} + +type InstanceProfileBandwidthIntf interface { + isaInstanceProfileBandwidth() bool +} + +// UnmarshalInstanceProfileBandwidth unmarshals an instance of InstanceProfileBandwidth from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidth) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileCollection : InstanceProfileCollection struct +type InstanceProfileCollection struct { + // Collection of virtual server instance profiles. + Profiles []InstanceProfile `json:"profiles" validate:"required"` +} + +// UnmarshalInstanceProfileCollection unmarshals an instance of InstanceProfileCollection from the specified map of raw messages. +func UnmarshalInstanceProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileCollection) + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalInstanceProfile) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDisk : Disks provided by this profile. +type InstanceProfileDisk struct { + Quantity InstanceProfileDiskQuantityIntf `json:"quantity" validate:"required"` + + Size InstanceProfileDiskSizeIntf `json:"size" validate:"required"` + + SupportedInterfaceTypes *InstanceProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` +} + +// UnmarshalInstanceProfileDisk unmarshals an instance of InstanceProfileDisk from the specified map of raw messages. +func UnmarshalInstanceProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDisk) + err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalInstanceProfileDiskQuantity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalInstanceProfileDiskSize) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalInstanceProfileDiskSupportedInterfaces) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantity : InstanceProfileDiskQuantity struct +// Models which "extend" this model: +// - InstanceProfileDiskQuantityFixed +// - InstanceProfileDiskQuantityRange +// - InstanceProfileDiskQuantityEnum +// - InstanceProfileDiskQuantityDependent +type InstanceProfileDiskQuantity 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 InstanceProfileDiskQuantity.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskQuantity) isaInstanceProfileDiskQuantity() bool { + return true +} + +type InstanceProfileDiskQuantityIntf interface { + isaInstanceProfileDiskQuantity() bool +} + +// UnmarshalInstanceProfileDiskQuantity unmarshals an instance of InstanceProfileDiskQuantity from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSize : InstanceProfileDiskSize struct +// Models which "extend" this model: +// - InstanceProfileDiskSizeFixed +// - InstanceProfileDiskSizeRange +// - InstanceProfileDiskSizeEnum +// - InstanceProfileDiskSizeDependent +type InstanceProfileDiskSize 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 InstanceProfileDiskSize.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskSize) isaInstanceProfileDiskSize() bool { + return true +} + +type InstanceProfileDiskSizeIntf interface { + isaInstanceProfileDiskSize() bool +} + +// UnmarshalInstanceProfileDiskSize unmarshals an instance of InstanceProfileDiskSize from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSize) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSupportedInterfaces : InstanceProfileDiskSupportedInterfaces struct +type InstanceProfileDiskSupportedInterfaces struct { + // The disk interface used for attaching the disk. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + 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"` +} + +// Constants associated with the InstanceProfileDiskSupportedInterfaces.Default property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + InstanceProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" + InstanceProfileDiskSupportedInterfacesDefaultVirtioBlkConst = "virtio_blk" +) + +// Constants associated with the InstanceProfileDiskSupportedInterfaces.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSupportedInterfacesTypeEnumConst = "enum" +) + +// Constants associated with the InstanceProfileDiskSupportedInterfaces.Values property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + InstanceProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" + InstanceProfileDiskSupportedInterfacesValuesVirtioBlkConst = "virtio_blk" +) + +// UnmarshalInstanceProfileDiskSupportedInterfaces unmarshals an instance of InstanceProfileDiskSupportedInterfaces from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpu : InstanceProfileGpu struct +// Models which "extend" this model: +// - InstanceProfileGpuFixed +// - InstanceProfileGpuRange +// - InstanceProfileGpuEnum +// - InstanceProfileGpuDependent +type InstanceProfileGpu 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 InstanceProfileGpu.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuTypeFixedConst = "fixed" +) + +func (*InstanceProfileGpu) isaInstanceProfileGpu() bool { + return true +} + +type InstanceProfileGpuIntf interface { + isaInstanceProfileGpu() bool +} + +// UnmarshalInstanceProfileGpu unmarshals an instance of InstanceProfileGpu from the specified map of raw messages. +func UnmarshalInstanceProfileGpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpu) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuManufacturer : InstanceProfileGpuManufacturer struct +type InstanceProfileGpuManufacturer struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The possible GPU manufacturer(s) for an instance with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuManufacturer.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuManufacturerTypeEnumConst = "enum" +) + +// UnmarshalInstanceProfileGpuManufacturer unmarshals an instance of InstanceProfileGpuManufacturer from the specified map of raw messages. +func UnmarshalInstanceProfileGpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuManufacturer) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemory : InstanceProfileGpuMemory struct +// Models which "extend" this model: +// - InstanceProfileGpuMemoryFixed +// - InstanceProfileGpuMemoryRange +// - InstanceProfileGpuMemoryEnum +// - InstanceProfileGpuMemoryDependent +type InstanceProfileGpuMemory 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 InstanceProfileGpuMemory.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryTypeFixedConst = "fixed" +) + +func (*InstanceProfileGpuMemory) isaInstanceProfileGpuMemory() bool { + return true +} + +type InstanceProfileGpuMemoryIntf interface { + isaInstanceProfileGpuMemory() bool +} + +// UnmarshalInstanceProfileGpuMemory unmarshals an instance of InstanceProfileGpuMemory from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuModel : InstanceProfileGpuModel struct +type InstanceProfileGpuModel struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The possible GPU model(s) for an instance with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuModel.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuModelTypeEnumConst = "enum" +) + +// UnmarshalInstanceProfileGpuModel unmarshals an instance of InstanceProfileGpuModel from the specified map of raw messages. +func UnmarshalInstanceProfileGpuModel(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuModel) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileIdentity : Identifies an instance profile by a unique property. +// Models which "extend" this model: +// - InstanceProfileIdentityByName +// - InstanceProfileIdentityByHref +type InstanceProfileIdentity struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name,omitempty"` + + // The URL for this virtual server instance profile. + Href *string `json:"href,omitempty"` +} + +func (*InstanceProfileIdentity) isaInstanceProfileIdentity() bool { + return true +} + +type InstanceProfileIdentityIntf interface { + isaInstanceProfileIdentity() bool +} + +// UnmarshalInstanceProfileIdentity unmarshals an instance of InstanceProfileIdentity from the specified map of raw messages. +func UnmarshalInstanceProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemory : InstanceProfileMemory struct +// Models which "extend" this model: +// - InstanceProfileMemoryFixed +// - InstanceProfileMemoryRange +// - InstanceProfileMemoryEnum +// - InstanceProfileMemoryDependent +type InstanceProfileMemory 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 InstanceProfileMemory.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryTypeFixedConst = "fixed" +) + +func (*InstanceProfileMemory) isaInstanceProfileMemory() bool { + return true +} + +type InstanceProfileMemoryIntf interface { + isaInstanceProfileMemory() bool +} + +// UnmarshalInstanceProfileMemory unmarshals an instance of InstanceProfileMemory from the specified map of raw messages. +func UnmarshalInstanceProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileOsArchitecture : InstanceProfileOsArchitecture struct +type InstanceProfileOsArchitecture struct { + // The default OS architecture for an instance 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 an instance with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileOsArchitecture.Type property. +// The type for this profile field. +const ( + InstanceProfileOsArchitectureTypeEnumConst = "enum" +) + +// UnmarshalInstanceProfileOsArchitecture unmarshals an instance of InstanceProfileOsArchitecture from the specified map of raw messages. +func UnmarshalInstanceProfileOsArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileOsArchitecture) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfilePortSpeed : InstanceProfilePortSpeed struct +// Models which "extend" this model: +// - InstanceProfilePortSpeedFixed +// - InstanceProfilePortSpeedDependent +type InstanceProfilePortSpeed struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` +} + +// Constants associated with the InstanceProfilePortSpeed.Type property. +// The type for this profile field. +const ( + InstanceProfilePortSpeedTypeFixedConst = "fixed" +) + +func (*InstanceProfilePortSpeed) isaInstanceProfilePortSpeed() bool { + return true +} + +type InstanceProfilePortSpeedIntf interface { + isaInstanceProfilePortSpeed() bool +} + +// UnmarshalInstanceProfilePortSpeed unmarshals an instance of InstanceProfilePortSpeed from the specified map of raw messages. +func UnmarshalInstanceProfilePortSpeed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfilePortSpeed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileReference : InstanceProfileReference struct +type InstanceProfileReference struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceProfileReference unmarshals an instance of InstanceProfileReference from the specified map of raw messages. +func UnmarshalInstanceProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpu : InstanceProfileVcpu struct +// Models which "extend" this model: +// - InstanceProfileVcpuFixed +// - InstanceProfileVcpuRange +// - InstanceProfileVcpuEnum +// - InstanceProfileVcpuDependent +type InstanceProfileVcpu 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 InstanceProfileVcpu.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuTypeFixedConst = "fixed" +) + +func (*InstanceProfileVcpu) isaInstanceProfileVcpu() bool { + return true +} + +type InstanceProfileVcpuIntf interface { + isaInstanceProfileVcpu() bool +} + +// UnmarshalInstanceProfileVcpu unmarshals an instance of InstanceProfileVcpu from the specified map of raw messages. +func UnmarshalInstanceProfileVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpu) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuArchitecture : InstanceProfileVcpuArchitecture struct +type InstanceProfileVcpuArchitecture struct { + // The default VCPU architecture for an instance with this profile. + Default *string `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The VCPU architecture for an instance with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuArchitecture.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuArchitectureTypeFixedConst = "fixed" +) + +// UnmarshalInstanceProfileVcpuArchitecture unmarshals an instance of InstanceProfileVcpuArchitecture from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuArchitecture) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidth : InstanceProfileVolumeBandwidth struct +// Models which "extend" this model: +// - InstanceProfileVolumeBandwidthFixed +// - InstanceProfileVolumeBandwidthRange +// - InstanceProfileVolumeBandwidthEnum +// - InstanceProfileVolumeBandwidthDependent +type InstanceProfileVolumeBandwidth 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 InstanceProfileVolumeBandwidth.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthTypeFixedConst = "fixed" +) + +func (*InstanceProfileVolumeBandwidth) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +type InstanceProfileVolumeBandwidthIntf interface { + isaInstanceProfileVolumeBandwidth() bool +} + +// UnmarshalInstanceProfileVolumeBandwidth unmarshals an instance of InstanceProfileVolumeBandwidth from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidth) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototype : InstancePrototype struct +// Models which "extend" this model: +// - InstancePrototypeInstanceByImage +// - InstancePrototypeInstanceBySourceSnapshot +// - InstancePrototypeInstanceBySourceTemplate +type InstancePrototype struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not + // subsequently managed. Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + // property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The metadata service configuration. + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will + // be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If specified, it must match + // the VPC referenced by the subnets of the instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` +} + +func (*InstancePrototype) isaInstancePrototype() bool { + return true +} + +type InstancePrototypeIntf interface { + isaInstancePrototype() bool +} + +// UnmarshalInstancePrototype unmarshals an instance of InstancePrototype from the specified map of raw messages. +func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceReference : InstanceReference struct +type InstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this virtual server instance (and default system hostname). + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceReference unmarshals an instance of InstanceReference from the specified map of raw messages. +func UnmarshalInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceReferenceDeleted unmarshals an instance of InstanceReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceStatusReason : InstanceStatusReason struct +type InstanceStatusReason struct { + // A snake case string succinctly identifying the status reason. + 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 InstanceStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + InstanceStatusReasonCodeCannotStartConst = "cannot_start" + InstanceStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" + InstanceStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" + InstanceStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" + InstanceStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" + InstanceStatusReasonCodeCannotStartPlacementGroupConst = "cannot_start_placement_group" + InstanceStatusReasonCodeCannotStartStorageConst = "cannot_start_storage" + InstanceStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" + InstanceStatusReasonCodeStoppedByHostFailureConst = "stopped_by_host_failure" + InstanceStatusReasonCodeStoppedForImageCreationConst = "stopped_for_image_creation" +) + +// UnmarshalInstanceStatusReason unmarshals an instance of InstanceStatusReason from the specified map of raw messages. +func UnmarshalInstanceStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplate : InstanceTemplate struct +// Models which "extend" this model: +// - InstanceTemplateInstanceByImage +// - InstanceTemplateInstanceBySourceSnapshot +type InstanceTemplate struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not + // subsequently managed. Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + // property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The metadata service configuration. + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The unique user-defined name for this instance template. + Name *string `json:"name" validate:"required"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will + // be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If specified, it must match + // the VPC referenced by the subnets of the instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +func (*InstanceTemplate) isaInstanceTemplate() bool { + return true +} + +type InstanceTemplateIntf interface { + isaInstanceTemplate() bool +} + +// UnmarshalInstanceTemplate unmarshals an instance of InstanceTemplate from the specified map of raw messages. +func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplate) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateCollection : InstanceTemplateCollection struct +type InstanceTemplateCollection struct { + // A link to the first page of resources. + First *InstanceTemplateCollectionFirst `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"` + + // Collection of instance templates. + Templates []InstanceTemplateIntf `json:"templates" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceTemplateCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "templates", &obj.Templates, UnmarshalInstanceTemplate) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 { + 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 { + 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 +// - InstanceTemplateIdentityByHref +// - InstanceTemplateIdentityByCRN +type InstanceTemplateIdentity struct { + // The unique identifier for this instance template. + ID *string `json:"id,omitempty"` + + // The URL for this instance template. + Href *string `json:"href,omitempty"` + + // The CRN for this instance template. + CRN *string `json:"crn,omitempty"` +} + +func (*InstanceTemplateIdentity) isaInstanceTemplateIdentity() bool { + return true +} + +type InstanceTemplateIdentityIntf interface { + isaInstanceTemplateIdentity() bool +} + +// UnmarshalInstanceTemplateIdentity unmarshals an instance of InstanceTemplateIdentity from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePatch : InstanceTemplatePatch struct +type InstanceTemplatePatch struct { + // The unique user-defined name for this instance template. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceTemplatePatch unmarshals an instance of InstanceTemplatePatch from the specified map of raw messages. +func UnmarshalInstanceTemplatePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceTemplatePrototype : InstanceTemplatePrototype struct +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceByImage +// - InstanceTemplatePrototypeInstanceBySourceTemplate +type InstanceTemplatePrototype struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not + // subsequently managed. Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + // property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The metadata service configuration. + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will + // be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If specified, it must match + // the VPC referenced by the subnets of the instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` +} + +func (*InstanceTemplatePrototype) isaInstanceTemplatePrototype() bool { + return true +} + +type InstanceTemplatePrototypeIntf interface { + isaInstanceTemplatePrototype() bool +} + +// UnmarshalInstanceTemplatePrototype unmarshals an instance of InstanceTemplatePrototype from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateReference : InstanceTemplateReference struct +type InstanceTemplateReference struct { + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceTemplateReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this instance template. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceTemplateReference unmarshals an instance of InstanceTemplateReference from the specified map of raw messages. +func UnmarshalInstanceTemplateReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceTemplateReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceTemplateReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceTemplateReferenceDeleted unmarshals an instance of InstanceTemplateReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceTemplateReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceVcpu : The virtual server instance VCPU configuration. +type InstanceVcpu struct { + // The VCPU architecture. + Architecture *string `json:"architecture" validate:"required"` + + // The number of VCPUs assigned. + Count *int64 `json:"count" validate:"required"` +} + +// UnmarshalInstanceVcpu unmarshals an instance of InstanceVcpu from the specified map of raw messages. +func UnmarshalInstanceVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceVcpu) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Key : Key struct +type Key struct { + // The date and time that the key was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this key. + CRN *string `json:"crn" validate:"required"` + + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint" validate:"required"` + + // The URL for this key. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this key. + ID *string `json:"id" validate:"required"` + + // The length of this key (in bits). + Length *int64 `json:"length" validate:"required"` + + // The unique user-defined name for this key. If unspecified, the name will be a hyphenated list of randomly-selected + // words. + Name *string `json:"name" validate:"required"` + + // The public SSH key, consisting of two space-separated fields: the algorithm name, and the base64-encoded key. + PublicKey *string `json:"public_key" validate:"required"` + + // The resource group for this key. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The crypto-system used by this key. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the Key.Type property. +// The crypto-system used by this key. +const ( + KeyTypeRsaConst = "rsa" +) + +// UnmarshalKey unmarshals an instance of Key from the specified map of raw messages. +func UnmarshalKey(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Key) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "length", &obj.Length) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "public_key", &obj.PublicKey) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyCollection : KeyCollection struct +type KeyCollection struct { + // A link to the first page of resources. + First *KeyCollectionFirst `json:"first" validate:"required"` + + // Collection of keys. + Keys []Key `json:"keys" 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 *KeyCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKey) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalKeyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *KeyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentity : Identifies a key by a unique property. +// Models which "extend" this model: +// - KeyIdentityByID +// - KeyIdentityByCRN +// - KeyIdentityByHref +// - KeyIdentityByFingerprint +type KeyIdentity struct { + // The unique identifier for this key. + ID *string `json:"id,omitempty"` + + // The CRN for this key. + CRN *string `json:"crn,omitempty"` + + // The URL for this key. + Href *string `json:"href,omitempty"` + + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint,omitempty"` +} + +func (*KeyIdentity) isaKeyIdentity() bool { + return true +} + +type KeyIdentityIntf interface { + isaKeyIdentity() bool +} + +// UnmarshalKeyIdentity unmarshals an instance of KeyIdentity from the specified map of raw messages. +func UnmarshalKeyIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyPatch : KeyPatch struct +type KeyPatch struct { + // The user-defined name for this key. + Name *string `json:"name,omitempty"` +} + +// UnmarshalKeyPatch unmarshals an instance of KeyPatch from the specified map of raw messages. +func UnmarshalKeyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// KeyReference : KeyReference struct +type KeyReference struct { + // The CRN for this key. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *KeyReferenceDeleted `json:"deleted,omitempty"` + + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint" validate:"required"` + + // The URL for this key. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this key. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this key. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalKeyReference unmarshals an instance of KeyReference from the specified map of raw messages. +func UnmarshalKeyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalKeyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type KeyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalKeyReferenceDeleted unmarshals an instance of KeyReferenceDeleted from the specified map of raw messages. +func UnmarshalKeyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LegacyCloudObjectStorageBucketIdentity : Identifies a Cloud Object Storage bucket by a unique property. +// Models which "extend" this model: +// - LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName +type LegacyCloudObjectStorageBucketIdentity struct { + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name,omitempty"` +} + +func (*LegacyCloudObjectStorageBucketIdentity) isaLegacyCloudObjectStorageBucketIdentity() bool { + return true +} + +type LegacyCloudObjectStorageBucketIdentityIntf interface { + isaLegacyCloudObjectStorageBucketIdentity() bool +} + +// UnmarshalLegacyCloudObjectStorageBucketIdentity unmarshals an instance of LegacyCloudObjectStorageBucketIdentity from the specified map of raw messages. +func UnmarshalLegacyCloudObjectStorageBucketIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LegacyCloudObjectStorageBucketIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LegacyCloudObjectStorageBucketReference : LegacyCloudObjectStorageBucketReference struct +type LegacyCloudObjectStorageBucketReference struct { + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalLegacyCloudObjectStorageBucketReference unmarshals an instance of LegacyCloudObjectStorageBucketReference from the specified map of raw messages. +func UnmarshalLegacyCloudObjectStorageBucketReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LegacyCloudObjectStorageBucketReference) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LifecycleReason : LifecycleReason struct +type LifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 LifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + LifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalLifecycleReason unmarshals an instance of LifecycleReason from the specified map of raw messages. +func UnmarshalLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ListBackupPoliciesOptions : The ListBackupPolicies options. +type ListBackupPoliciesOptions 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to resources with the exact tag value. + Tag *string `json:"tag,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBackupPoliciesOptions : Instantiate ListBackupPoliciesOptions +func (*VpcV1) NewListBackupPoliciesOptions() *ListBackupPoliciesOptions { + return &ListBackupPoliciesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListBackupPoliciesOptions) SetStart(start string) *ListBackupPoliciesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBackupPoliciesOptions) SetLimit(limit int64) *ListBackupPoliciesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListBackupPoliciesOptions) SetResourceGroupID(resourceGroupID string) *ListBackupPoliciesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListBackupPoliciesOptions) SetName(name string) *ListBackupPoliciesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetTag : Allow user to set Tag +func (_options *ListBackupPoliciesOptions) SetTag(tag string) *ListBackupPoliciesOptions { + _options.Tag = core.StringPtr(tag) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBackupPoliciesOptions) SetHeaders(param map[string]string) *ListBackupPoliciesOptions { + options.Headers = param + return options +} + +// ListBackupPolicyPlansOptions : The ListBackupPolicyPlans options. +type ListBackupPolicyPlansOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // Filters the collection to resources with the exact specified name. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBackupPolicyPlansOptions : Instantiate ListBackupPolicyPlansOptions +func (*VpcV1) NewListBackupPolicyPlansOptions(backupPolicyID string) *ListBackupPolicyPlansOptions { + return &ListBackupPolicyPlansOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *ListBackupPolicyPlansOptions) SetBackupPolicyID(backupPolicyID string) *ListBackupPolicyPlansOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListBackupPolicyPlansOptions) SetName(name string) *ListBackupPolicyPlansOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBackupPolicyPlansOptions) SetHeaders(param map[string]string) *ListBackupPolicyPlansOptions { + options.Headers = param + return options +} + +// ListBareMetalServerDisksOptions : The ListBareMetalServerDisks options. +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 + Headers map[string]string +} + +// NewListBareMetalServerDisksOptions : Instantiate ListBareMetalServerDisksOptions +func (*VpcV1) NewListBareMetalServerDisksOptions(bareMetalServerID string) *ListBareMetalServerDisksOptions { + return &ListBareMetalServerDisksOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerDisksOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerDisksOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerDisksOptions) SetHeaders(param map[string]string) *ListBareMetalServerDisksOptions { + options.Headers = param + return options +} + +// ListBareMetalServerNetworkInterfaceFloatingIpsOptions : The ListBareMetalServerNetworkInterfaceFloatingIps options. +type ListBareMetalServerNetworkInterfaceFloatingIpsOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The network interface identifier. + NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBareMetalServerNetworkInterfaceFloatingIpsOptions : Instantiate ListBareMetalServerNetworkInterfaceFloatingIpsOptions +func (*VpcV1) NewListBareMetalServerNetworkInterfaceFloatingIpsOptions(bareMetalServerID string, networkInterfaceID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { + return &ListBareMetalServerNetworkInterfaceFloatingIpsOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { + options.Headers = param + return options +} + +// ListBareMetalServerNetworkInterfacesOptions : The ListBareMetalServerNetworkInterfaces options. +type ListBareMetalServerNetworkInterfacesOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_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 +} + +// NewListBareMetalServerNetworkInterfacesOptions : Instantiate ListBareMetalServerNetworkInterfacesOptions +func (*VpcV1) NewListBareMetalServerNetworkInterfacesOptions(bareMetalServerID string) *ListBareMetalServerNetworkInterfacesOptions { + return &ListBareMetalServerNetworkInterfacesOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerNetworkInterfacesOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfacesOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListBareMetalServerNetworkInterfacesOptions) SetStart(start string) *ListBareMetalServerNetworkInterfacesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBareMetalServerNetworkInterfacesOptions) SetLimit(limit int64) *ListBareMetalServerNetworkInterfacesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfacesOptions { + options.Headers = param + return options +} + +// ListBareMetalServerProfilesOptions : The ListBareMetalServerProfiles options. +type ListBareMetalServerProfilesOptions 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 +} + +// NewListBareMetalServerProfilesOptions : Instantiate ListBareMetalServerProfilesOptions +func (*VpcV1) NewListBareMetalServerProfilesOptions() *ListBareMetalServerProfilesOptions { + return &ListBareMetalServerProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListBareMetalServerProfilesOptions) SetStart(start string) *ListBareMetalServerProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBareMetalServerProfilesOptions) SetLimit(limit int64) *ListBareMetalServerProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerProfilesOptions) SetHeaders(param map[string]string) *ListBareMetalServerProfilesOptions { + options.Headers = param + return options +} + +// ListBareMetalServersOptions : The ListBareMetalServers options. +type ListBareMetalServersOptions 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to resources in the VPC with the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources in the VPC with the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources in the VPC with the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to bare metal servers on the subnet with the specified identifier. + NetworkInterfacesSubnetID *string `json:"network_interfaces.subnet.id,omitempty"` + + // Filters the collection to bare metal servers on the subnet with the specified CRN. + NetworkInterfacesSubnetCRN *string `json:"network_interfaces.subnet.crn,omitempty"` + + // Filters the collection to bare metal servers on the subnet with the specified name. + NetworkInterfacesSubnetName *string `json:"network_interfaces.subnet.name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBareMetalServersOptions : Instantiate ListBareMetalServersOptions +func (*VpcV1) NewListBareMetalServersOptions() *ListBareMetalServersOptions { + return &ListBareMetalServersOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListBareMetalServersOptions) SetStart(start string) *ListBareMetalServersOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBareMetalServersOptions) SetLimit(limit int64) *ListBareMetalServersOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListBareMetalServersOptions) SetResourceGroupID(resourceGroupID string) *ListBareMetalServersOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListBareMetalServersOptions) SetName(name string) *ListBareMetalServersOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListBareMetalServersOptions) SetVPCID(vpcID string) *ListBareMetalServersOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListBareMetalServersOptions) SetVPCCRN(vpcCRN string) *ListBareMetalServersOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListBareMetalServersOptions) SetVPCName(vpcName string) *ListBareMetalServersOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetNetworkInterfacesSubnetID : Allow user to set NetworkInterfacesSubnetID +func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetID(networkInterfacesSubnetID string) *ListBareMetalServersOptions { + _options.NetworkInterfacesSubnetID = core.StringPtr(networkInterfacesSubnetID) + return _options +} + +// SetNetworkInterfacesSubnetCRN : Allow user to set NetworkInterfacesSubnetCRN +func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetCRN(networkInterfacesSubnetCRN string) *ListBareMetalServersOptions { + _options.NetworkInterfacesSubnetCRN = core.StringPtr(networkInterfacesSubnetCRN) + return _options +} + +// SetNetworkInterfacesSubnetName : Allow user to set NetworkInterfacesSubnetName +func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetName(networkInterfacesSubnetName string) *ListBareMetalServersOptions { + _options.NetworkInterfacesSubnetName = core.StringPtr(networkInterfacesSubnetName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServersOptions) SetHeaders(param map[string]string) *ListBareMetalServersOptions { + 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 + Headers map[string]string +} + +// NewListDedicatedHostDisksOptions : Instantiate ListDedicatedHostDisksOptions +func (*VpcV1) NewListDedicatedHostDisksOptions(dedicatedHostID string) *ListDedicatedHostDisksOptions { + return &ListDedicatedHostDisksOptions{ + DedicatedHostID: core.StringPtr(dedicatedHostID), + } +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (_options *ListDedicatedHostDisksOptions) SetDedicatedHostID(dedicatedHostID string) *ListDedicatedHostDisksOptions { + _options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostDisksOptions) SetHeaders(param map[string]string) *ListDedicatedHostDisksOptions { + options.Headers = param + return options +} + +// ListDedicatedHostGroupsOptions : The ListDedicatedHostGroups options. +type ListDedicatedHostGroupsOptions 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources in the zone with the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // Filters the collection to resources with the exact specified name. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListDedicatedHostGroupsOptions : Instantiate ListDedicatedHostGroupsOptions +func (*VpcV1) NewListDedicatedHostGroupsOptions() *ListDedicatedHostGroupsOptions { + return &ListDedicatedHostGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListDedicatedHostGroupsOptions) SetStart(start string) *ListDedicatedHostGroupsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListDedicatedHostGroupsOptions) SetLimit(limit int64) *ListDedicatedHostGroupsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListDedicatedHostGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListDedicatedHostGroupsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *ListDedicatedHostGroupsOptions) SetZoneName(zoneName string) *ListDedicatedHostGroupsOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListDedicatedHostGroupsOptions) SetName(name string) *ListDedicatedHostGroupsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostGroupsOptions) SetHeaders(param map[string]string) *ListDedicatedHostGroupsOptions { + options.Headers = param + return options +} + +// ListDedicatedHostProfilesOptions : The ListDedicatedHostProfiles options. +type ListDedicatedHostProfilesOptions 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 +} + +// NewListDedicatedHostProfilesOptions : Instantiate ListDedicatedHostProfilesOptions +func (*VpcV1) NewListDedicatedHostProfilesOptions() *ListDedicatedHostProfilesOptions { + return &ListDedicatedHostProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListDedicatedHostProfilesOptions) SetStart(start string) *ListDedicatedHostProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListDedicatedHostProfilesOptions) SetLimit(limit int64) *ListDedicatedHostProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostProfilesOptions) SetHeaders(param map[string]string) *ListDedicatedHostProfilesOptions { + options.Headers = param + return options +} + +// ListDedicatedHostsOptions : The ListDedicatedHosts options. +type ListDedicatedHostsOptions struct { + // Filters the collection to dedicated host groups with the specified identifier. + DedicatedHostGroupID *string `json:"dedicated_host_group.id,omitempty"` + + // 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources in the zone with the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // Filters the collection to resources with the exact specified name. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListDedicatedHostsOptions : Instantiate ListDedicatedHostsOptions +func (*VpcV1) NewListDedicatedHostsOptions() *ListDedicatedHostsOptions { + return &ListDedicatedHostsOptions{} +} + +// SetDedicatedHostGroupID : Allow user to set DedicatedHostGroupID +func (_options *ListDedicatedHostsOptions) SetDedicatedHostGroupID(dedicatedHostGroupID string) *ListDedicatedHostsOptions { + _options.DedicatedHostGroupID = core.StringPtr(dedicatedHostGroupID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListDedicatedHostsOptions) SetStart(start string) *ListDedicatedHostsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListDedicatedHostsOptions) SetLimit(limit int64) *ListDedicatedHostsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListDedicatedHostsOptions) SetResourceGroupID(resourceGroupID string) *ListDedicatedHostsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *ListDedicatedHostsOptions) SetZoneName(zoneName string) *ListDedicatedHostsOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListDedicatedHostsOptions) SetName(name string) *ListDedicatedHostsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostsOptions) SetHeaders(param map[string]string) *ListDedicatedHostsOptions { + options.Headers = param + return options +} + +// ListEndpointGatewayIpsOptions : The ListEndpointGatewayIps options. +type ListEndpointGatewayIpsOptions struct { + // The endpoint gateway identifier. + EndpointGatewayID *string `json:"endpoint_gateway_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"` + + // 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 ListEndpointGatewayIpsOptions.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 ( + ListEndpointGatewayIpsOptionsSortAddressConst = "address" + ListEndpointGatewayIpsOptionsSortCreatedAtConst = "created_at" + ListEndpointGatewayIpsOptionsSortNameConst = "name" +) + +// NewListEndpointGatewayIpsOptions : Instantiate ListEndpointGatewayIpsOptions +func (*VpcV1) NewListEndpointGatewayIpsOptions(endpointGatewayID string) *ListEndpointGatewayIpsOptions { + return &ListEndpointGatewayIpsOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + } +} + +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (_options *ListEndpointGatewayIpsOptions) SetEndpointGatewayID(endpointGatewayID string) *ListEndpointGatewayIpsOptions { + _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListEndpointGatewayIpsOptions) SetStart(start string) *ListEndpointGatewayIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListEndpointGatewayIpsOptions) SetLimit(limit int64) *ListEndpointGatewayIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListEndpointGatewayIpsOptions) SetSort(sort string) *ListEndpointGatewayIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListEndpointGatewayIpsOptions) SetHeaders(param map[string]string) *ListEndpointGatewayIpsOptions { + options.Headers = param + return options +} + +// ListEndpointGatewaysOptions : The ListEndpointGateways options. +type ListEndpointGatewaysOptions struct { + // Filters the collection to resources with the exact specified name. + Name *string `json:"name,omitempty"` + + // 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListEndpointGatewaysOptions : Instantiate ListEndpointGatewaysOptions +func (*VpcV1) NewListEndpointGatewaysOptions() *ListEndpointGatewaysOptions { + return &ListEndpointGatewaysOptions{} +} + +// SetName : Allow user to set Name +func (_options *ListEndpointGatewaysOptions) SetName(name string) *ListEndpointGatewaysOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListEndpointGatewaysOptions) SetStart(start string) *ListEndpointGatewaysOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListEndpointGatewaysOptions) SetLimit(limit int64) *ListEndpointGatewaysOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListEndpointGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListEndpointGatewaysOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListEndpointGatewaysOptions) SetHeaders(param map[string]string) *ListEndpointGatewaysOptions { + options.Headers = param + return options +} + +// ListFloatingIpsOptions : The ListFloatingIps options. +type ListFloatingIpsOptions 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,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 ListFloatingIpsOptions.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 ( + ListFloatingIpsOptionsSortCreatedAtConst = "created_at" + ListFloatingIpsOptionsSortNameConst = "name" +) + +// NewListFloatingIpsOptions : Instantiate ListFloatingIpsOptions +func (*VpcV1) NewListFloatingIpsOptions() *ListFloatingIpsOptions { + return &ListFloatingIpsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListFloatingIpsOptions) SetStart(start string) *ListFloatingIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListFloatingIpsOptions) SetLimit(limit int64) *ListFloatingIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListFloatingIpsOptions) SetResourceGroupID(resourceGroupID string) *ListFloatingIpsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListFloatingIpsOptions) SetSort(sort string) *ListFloatingIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListFloatingIpsOptions) SetHeaders(param map[string]string) *ListFloatingIpsOptions { + options.Headers = param + return options +} + +// ListFlowLogCollectorsOptions : The ListFlowLogCollectors options. +type ListFlowLogCollectorsOptions 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to resources in the VPC with the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources in the VPC with the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources in the VPC with the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to flow log collectors that target the specified resource. + TargetID *string `json:"target.id,omitempty"` + + // Filters the collection to flow log collectors that target the specified resource type. + TargetResourceType *string `json:"target.resource_type,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListFlowLogCollectorsOptions.TargetResourceType property. +// Filters the collection to flow log collectors that target the specified resource type. +const ( + ListFlowLogCollectorsOptionsTargetResourceTypeInstanceConst = "instance" + ListFlowLogCollectorsOptionsTargetResourceTypeNetworkInterfaceConst = "network_interface" + ListFlowLogCollectorsOptionsTargetResourceTypeSubnetConst = "subnet" + ListFlowLogCollectorsOptionsTargetResourceTypeVPCConst = "vpc" +) + +// NewListFlowLogCollectorsOptions : Instantiate ListFlowLogCollectorsOptions +func (*VpcV1) NewListFlowLogCollectorsOptions() *ListFlowLogCollectorsOptions { + return &ListFlowLogCollectorsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListFlowLogCollectorsOptions) SetStart(start string) *ListFlowLogCollectorsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListFlowLogCollectorsOptions) SetLimit(limit int64) *ListFlowLogCollectorsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListFlowLogCollectorsOptions) SetResourceGroupID(resourceGroupID string) *ListFlowLogCollectorsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListFlowLogCollectorsOptions) SetName(name string) *ListFlowLogCollectorsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListFlowLogCollectorsOptions) SetVPCID(vpcID string) *ListFlowLogCollectorsOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListFlowLogCollectorsOptions) SetVPCCRN(vpcCRN string) *ListFlowLogCollectorsOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListFlowLogCollectorsOptions) SetVPCName(vpcName string) *ListFlowLogCollectorsOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetTargetID : Allow user to set TargetID +func (_options *ListFlowLogCollectorsOptions) SetTargetID(targetID string) *ListFlowLogCollectorsOptions { + _options.TargetID = core.StringPtr(targetID) + return _options +} + +// SetTargetResourceType : Allow user to set TargetResourceType +func (_options *ListFlowLogCollectorsOptions) SetTargetResourceType(targetResourceType string) *ListFlowLogCollectorsOptions { + _options.TargetResourceType = core.StringPtr(targetResourceType) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListFlowLogCollectorsOptions) SetHeaders(param map[string]string) *ListFlowLogCollectorsOptions { + options.Headers = param + return options +} + +// ListIkePoliciesOptions : The ListIkePolicies options. +type ListIkePoliciesOptions 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 +} + +// NewListIkePoliciesOptions : Instantiate ListIkePoliciesOptions +func (*VpcV1) NewListIkePoliciesOptions() *ListIkePoliciesOptions { + return &ListIkePoliciesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListIkePoliciesOptions) SetStart(start string) *ListIkePoliciesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListIkePoliciesOptions) SetLimit(limit int64) *ListIkePoliciesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIkePoliciesOptions) SetHeaders(param map[string]string) *ListIkePoliciesOptions { + options.Headers = param + return options +} + +// ListIkePolicyConnectionsOptions : The ListIkePolicyConnections options. +type ListIkePolicyConnectionsOptions struct { + // The IKE policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListIkePolicyConnectionsOptions : Instantiate ListIkePolicyConnectionsOptions +func (*VpcV1) NewListIkePolicyConnectionsOptions(id string) *ListIkePolicyConnectionsOptions { + return &ListIkePolicyConnectionsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListIkePolicyConnectionsOptions) SetID(id string) *ListIkePolicyConnectionsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIkePolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIkePolicyConnectionsOptions { + options.Headers = param + return options +} + +// ListImagesOptions : The ListImages options. +type ListImagesOptions 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to images with the specified `visibility`. + Visibility *string `json:"visibility,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListImagesOptions.Visibility property. +// Filters the collection to images with the specified `visibility`. +const ( + ListImagesOptionsVisibilityPrivateConst = "private" + ListImagesOptionsVisibilityPublicConst = "public" +) + +// NewListImagesOptions : Instantiate ListImagesOptions +func (*VpcV1) NewListImagesOptions() *ListImagesOptions { + return &ListImagesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListImagesOptions) SetStart(start string) *ListImagesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListImagesOptions) SetLimit(limit int64) *ListImagesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListImagesOptions) SetResourceGroupID(resourceGroupID string) *ListImagesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListImagesOptions) SetName(name string) *ListImagesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetVisibility : Allow user to set Visibility +func (_options *ListImagesOptions) SetVisibility(visibility string) *ListImagesOptions { + _options.Visibility = core.StringPtr(visibility) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListImagesOptions) SetHeaders(param map[string]string) *ListImagesOptions { + options.Headers = param + return options +} + +// ListInstanceDisksOptions : The ListInstanceDisks options. +type ListInstanceDisksOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceDisksOptions : Instantiate ListInstanceDisksOptions +func (*VpcV1) NewListInstanceDisksOptions(instanceID string) *ListInstanceDisksOptions { + return &ListInstanceDisksOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceDisksOptions) SetInstanceID(instanceID string) *ListInstanceDisksOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceDisksOptions) SetHeaders(param map[string]string) *ListInstanceDisksOptions { + options.Headers = param + return options +} + +// ListInstanceGroupManagerActionsOptions : The ListInstanceGroupManagerActions options. +type ListInstanceGroupManagerActionsOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_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 +} + +// NewListInstanceGroupManagerActionsOptions : Instantiate ListInstanceGroupManagerActionsOptions +func (*VpcV1) NewListInstanceGroupManagerActionsOptions(instanceGroupID string, instanceGroupManagerID string) *ListInstanceGroupManagerActionsOptions { + return &ListInstanceGroupManagerActionsOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *ListInstanceGroupManagerActionsOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagerActionsOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *ListInstanceGroupManagerActionsOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *ListInstanceGroupManagerActionsOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupManagerActionsOptions) SetStart(start string) *ListInstanceGroupManagerActionsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupManagerActionsOptions) SetLimit(limit int64) *ListInstanceGroupManagerActionsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupManagerActionsOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagerActionsOptions { + options.Headers = param + return options +} + +// ListInstanceGroupManagerPoliciesOptions : The ListInstanceGroupManagerPolicies options. +type ListInstanceGroupManagerPoliciesOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_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 +} + +// NewListInstanceGroupManagerPoliciesOptions : Instantiate ListInstanceGroupManagerPoliciesOptions +func (*VpcV1) NewListInstanceGroupManagerPoliciesOptions(instanceGroupID string, instanceGroupManagerID string) *ListInstanceGroupManagerPoliciesOptions { + return &ListInstanceGroupManagerPoliciesOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *ListInstanceGroupManagerPoliciesOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagerPoliciesOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *ListInstanceGroupManagerPoliciesOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *ListInstanceGroupManagerPoliciesOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupManagerPoliciesOptions) SetStart(start string) *ListInstanceGroupManagerPoliciesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupManagerPoliciesOptions) SetLimit(limit int64) *ListInstanceGroupManagerPoliciesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupManagerPoliciesOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagerPoliciesOptions { + options.Headers = param + return options +} + +// ListInstanceGroupManagersOptions : The ListInstanceGroupManagers options. +type ListInstanceGroupManagersOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_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 +} + +// NewListInstanceGroupManagersOptions : Instantiate ListInstanceGroupManagersOptions +func (*VpcV1) NewListInstanceGroupManagersOptions(instanceGroupID string) *ListInstanceGroupManagersOptions { + return &ListInstanceGroupManagersOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *ListInstanceGroupManagersOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagersOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupManagersOptions) SetStart(start string) *ListInstanceGroupManagersOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupManagersOptions) SetLimit(limit int64) *ListInstanceGroupManagersOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupManagersOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagersOptions { + options.Headers = param + return options +} + +// ListInstanceGroupMembershipsOptions : The ListInstanceGroupMemberships options. +type ListInstanceGroupMembershipsOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_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 +} + +// NewListInstanceGroupMembershipsOptions : Instantiate ListInstanceGroupMembershipsOptions +func (*VpcV1) NewListInstanceGroupMembershipsOptions(instanceGroupID string) *ListInstanceGroupMembershipsOptions { + return &ListInstanceGroupMembershipsOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *ListInstanceGroupMembershipsOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupMembershipsOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupMembershipsOptions) SetStart(start string) *ListInstanceGroupMembershipsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupMembershipsOptions) SetLimit(limit int64) *ListInstanceGroupMembershipsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupMembershipsOptions) SetHeaders(param map[string]string) *ListInstanceGroupMembershipsOptions { + options.Headers = param + return options +} + +// ListInstanceGroupsOptions : The ListInstanceGroups options. +type ListInstanceGroupsOptions 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 +} + +// NewListInstanceGroupsOptions : Instantiate ListInstanceGroupsOptions +func (*VpcV1) NewListInstanceGroupsOptions() *ListInstanceGroupsOptions { + return &ListInstanceGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupsOptions) SetStart(start string) *ListInstanceGroupsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupsOptions) SetLimit(limit int64) *ListInstanceGroupsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupsOptions) SetHeaders(param map[string]string) *ListInstanceGroupsOptions { + options.Headers = param + return options +} + +// ListInstanceNetworkInterfaceFloatingIpsOptions : The ListInstanceNetworkInterfaceFloatingIps options. +type ListInstanceNetworkInterfaceFloatingIpsOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The network interface identifier. + NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceNetworkInterfaceFloatingIpsOptions : Instantiate ListInstanceNetworkInterfaceFloatingIpsOptions +func (*VpcV1) NewListInstanceNetworkInterfaceFloatingIpsOptions(instanceID string, networkInterfaceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { + return &ListInstanceNetworkInterfaceFloatingIpsOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfaceFloatingIpsOptions { + options.Headers = param + return options +} + +// ListInstanceNetworkInterfaceIpsOptions : The ListInstanceNetworkInterfaceIps options. +type ListInstanceNetworkInterfaceIpsOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The network interface identifier. + NetworkInterfaceID *string `json:"network_interface_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 +} + +// NewListInstanceNetworkInterfaceIpsOptions : Instantiate ListInstanceNetworkInterfaceIpsOptions +func (*VpcV1) NewListInstanceNetworkInterfaceIpsOptions(instanceID string, networkInterfaceID string) *ListInstanceNetworkInterfaceIpsOptions { + return &ListInstanceNetworkInterfaceIpsOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceNetworkInterfaceIpsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfaceIpsOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *ListInstanceNetworkInterfaceIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListInstanceNetworkInterfaceIpsOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceNetworkInterfaceIpsOptions) SetStart(start string) *ListInstanceNetworkInterfaceIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceNetworkInterfaceIpsOptions) SetLimit(limit int64) *ListInstanceNetworkInterfaceIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfaceIpsOptions { + options.Headers = param + return options +} + +// ListInstanceNetworkInterfacesOptions : The ListInstanceNetworkInterfaces options. +type ListInstanceNetworkInterfacesOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceNetworkInterfacesOptions : Instantiate ListInstanceNetworkInterfacesOptions +func (*VpcV1) NewListInstanceNetworkInterfacesOptions(instanceID string) *ListInstanceNetworkInterfacesOptions { + return &ListInstanceNetworkInterfacesOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceNetworkInterfacesOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfacesOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfacesOptions { + options.Headers = param + return options +} + +// ListInstanceProfilesOptions : The ListInstanceProfiles options. +type ListInstanceProfilesOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceProfilesOptions : Instantiate ListInstanceProfilesOptions +func (*VpcV1) NewListInstanceProfilesOptions() *ListInstanceProfilesOptions { + return &ListInstanceProfilesOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceProfilesOptions) SetHeaders(param map[string]string) *ListInstanceProfilesOptions { + options.Headers = param + return options +} + +// ListInstanceTemplatesOptions : The ListInstanceTemplates options. +type ListInstanceTemplatesOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceTemplatesOptions : Instantiate ListInstanceTemplatesOptions +func (*VpcV1) NewListInstanceTemplatesOptions() *ListInstanceTemplatesOptions { + return &ListInstanceTemplatesOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceTemplatesOptions) SetHeaders(param map[string]string) *ListInstanceTemplatesOptions { + options.Headers = param + return options +} + +// ListInstanceVolumeAttachmentsOptions : The ListInstanceVolumeAttachments options. +type ListInstanceVolumeAttachmentsOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceVolumeAttachmentsOptions : Instantiate ListInstanceVolumeAttachmentsOptions +func (*VpcV1) NewListInstanceVolumeAttachmentsOptions(instanceID string) *ListInstanceVolumeAttachmentsOptions { + return &ListInstanceVolumeAttachmentsOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceVolumeAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceVolumeAttachmentsOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceVolumeAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceVolumeAttachmentsOptions { + options.Headers = param + return options +} + +// ListInstancesOptions : The ListInstances options. +type ListInstancesOptions 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to resources in the VPC with the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources in the VPC with the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources in the VPC with the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to instances on the dedicated host with the specified identifier. + DedicatedHostID *string `json:"dedicated_host.id,omitempty"` + + // Filters the collection to instances on the dedicated host with the specified CRN. + DedicatedHostCRN *string `json:"dedicated_host.crn,omitempty"` + + // Filters the collection to instances on the dedicated host with the specified name. + DedicatedHostName *string `json:"dedicated_host.name,omitempty"` + + // Filters the collection to instances in the placement group with the specified identifier. + PlacementGroupID *string `json:"placement_group.id,omitempty"` + + // Filters the collection to instances in the placement group with the specified CRN. + PlacementGroupCRN *string `json:"placement_group.crn,omitempty"` + + // Filters the collection to instances in the placement group with the specified name. + PlacementGroupName *string `json:"placement_group.name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstancesOptions : Instantiate ListInstancesOptions +func (*VpcV1) NewListInstancesOptions() *ListInstancesOptions { + return &ListInstancesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListInstancesOptions) SetStart(start string) *ListInstancesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstancesOptions) SetLimit(limit int64) *ListInstancesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListInstancesOptions) SetResourceGroupID(resourceGroupID string) *ListInstancesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListInstancesOptions) SetName(name string) *ListInstancesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListInstancesOptions) SetVPCID(vpcID string) *ListInstancesOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListInstancesOptions) SetVPCCRN(vpcCRN string) *ListInstancesOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListInstancesOptions) SetVPCName(vpcName string) *ListInstancesOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (_options *ListInstancesOptions) SetDedicatedHostID(dedicatedHostID string) *ListInstancesOptions { + _options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return _options +} + +// SetDedicatedHostCRN : Allow user to set DedicatedHostCRN +func (_options *ListInstancesOptions) SetDedicatedHostCRN(dedicatedHostCRN string) *ListInstancesOptions { + _options.DedicatedHostCRN = core.StringPtr(dedicatedHostCRN) + return _options +} + +// SetDedicatedHostName : Allow user to set DedicatedHostName +func (_options *ListInstancesOptions) SetDedicatedHostName(dedicatedHostName string) *ListInstancesOptions { + _options.DedicatedHostName = core.StringPtr(dedicatedHostName) + return _options +} + +// SetPlacementGroupID : Allow user to set PlacementGroupID +func (_options *ListInstancesOptions) SetPlacementGroupID(placementGroupID string) *ListInstancesOptions { + _options.PlacementGroupID = core.StringPtr(placementGroupID) + return _options +} + +// SetPlacementGroupCRN : Allow user to set PlacementGroupCRN +func (_options *ListInstancesOptions) SetPlacementGroupCRN(placementGroupCRN string) *ListInstancesOptions { + _options.PlacementGroupCRN = core.StringPtr(placementGroupCRN) + return _options +} + +// SetPlacementGroupName : Allow user to set PlacementGroupName +func (_options *ListInstancesOptions) SetPlacementGroupName(placementGroupName string) *ListInstancesOptions { + _options.PlacementGroupName = core.StringPtr(placementGroupName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstancesOptions) SetHeaders(param map[string]string) *ListInstancesOptions { + options.Headers = param + return options +} + +// ListIpsecPoliciesOptions : The ListIpsecPolicies options. +type ListIpsecPoliciesOptions 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 +} + +// NewListIpsecPoliciesOptions : Instantiate ListIpsecPoliciesOptions +func (*VpcV1) NewListIpsecPoliciesOptions() *ListIpsecPoliciesOptions { + return &ListIpsecPoliciesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListIpsecPoliciesOptions) SetStart(start string) *ListIpsecPoliciesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListIpsecPoliciesOptions) SetLimit(limit int64) *ListIpsecPoliciesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIpsecPoliciesOptions) SetHeaders(param map[string]string) *ListIpsecPoliciesOptions { + options.Headers = param + return options +} + +// ListIpsecPolicyConnectionsOptions : The ListIpsecPolicyConnections options. +type ListIpsecPolicyConnectionsOptions struct { + // The IPsec policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListIpsecPolicyConnectionsOptions : Instantiate ListIpsecPolicyConnectionsOptions +func (*VpcV1) NewListIpsecPolicyConnectionsOptions(id string) *ListIpsecPolicyConnectionsOptions { + return &ListIpsecPolicyConnectionsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListIpsecPolicyConnectionsOptions) SetID(id string) *ListIpsecPolicyConnectionsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIpsecPolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIpsecPolicyConnectionsOptions { + options.Headers = param + return options +} + +// ListKeysOptions : The ListKeys options. +type ListKeysOptions 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 +} + +// NewListKeysOptions : Instantiate ListKeysOptions +func (*VpcV1) NewListKeysOptions() *ListKeysOptions { + return &ListKeysOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListKeysOptions) SetStart(start string) *ListKeysOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListKeysOptions) SetLimit(limit int64) *ListKeysOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListKeysOptions) SetHeaders(param map[string]string) *ListKeysOptions { + options.Headers = param + return options +} + +// ListLoadBalancerListenerPoliciesOptions : The ListLoadBalancerListenerPolicies options. +type ListLoadBalancerListenerPoliciesOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerListenerPoliciesOptions : Instantiate ListLoadBalancerListenerPoliciesOptions +func (*VpcV1) NewListLoadBalancerListenerPoliciesOptions(loadBalancerID string, listenerID string) *ListLoadBalancerListenerPoliciesOptions { + return &ListLoadBalancerListenerPoliciesOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerListenerPoliciesOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenerPoliciesOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *ListLoadBalancerListenerPoliciesOptions) SetListenerID(listenerID string) *ListLoadBalancerListenerPoliciesOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerListenerPoliciesOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenerPoliciesOptions { + options.Headers = param + return options +} + +// ListLoadBalancerListenerPolicyRulesOptions : The ListLoadBalancerListenerPolicyRules options. +type ListLoadBalancerListenerPolicyRulesOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerListenerPolicyRulesOptions : Instantiate ListLoadBalancerListenerPolicyRulesOptions +func (*VpcV1) NewListLoadBalancerListenerPolicyRulesOptions(loadBalancerID string, listenerID string, policyID string) *ListLoadBalancerListenerPolicyRulesOptions { + return &ListLoadBalancerListenerPolicyRulesOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenerPolicyRulesOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetListenerID(listenerID string) *ListLoadBalancerListenerPolicyRulesOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetPolicyID(policyID string) *ListLoadBalancerListenerPolicyRulesOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerListenerPolicyRulesOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenerPolicyRulesOptions { + options.Headers = param + return options +} + +// ListLoadBalancerListenersOptions : The ListLoadBalancerListeners options. +type ListLoadBalancerListenersOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerListenersOptions : Instantiate ListLoadBalancerListenersOptions +func (*VpcV1) NewListLoadBalancerListenersOptions(loadBalancerID string) *ListLoadBalancerListenersOptions { + return &ListLoadBalancerListenersOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerListenersOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenersOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerListenersOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenersOptions { + options.Headers = param + return options +} + +// ListLoadBalancerPoolMembersOptions : The ListLoadBalancerPoolMembers options. +type ListLoadBalancerPoolMembersOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerPoolMembersOptions : Instantiate ListLoadBalancerPoolMembersOptions +func (*VpcV1) NewListLoadBalancerPoolMembersOptions(loadBalancerID string, poolID string) *ListLoadBalancerPoolMembersOptions { + return &ListLoadBalancerPoolMembersOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerPoolMembersOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerPoolMembersOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *ListLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *ListLoadBalancerPoolMembersOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ListLoadBalancerPoolMembersOptions { + options.Headers = param + return options +} + +// ListLoadBalancerPoolsOptions : The ListLoadBalancerPools options. +type ListLoadBalancerPoolsOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerPoolsOptions : Instantiate ListLoadBalancerPoolsOptions +func (*VpcV1) NewListLoadBalancerPoolsOptions(loadBalancerID string) *ListLoadBalancerPoolsOptions { + return &ListLoadBalancerPoolsOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerPoolsOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerPoolsOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerPoolsOptions) SetHeaders(param map[string]string) *ListLoadBalancerPoolsOptions { + options.Headers = param + return options +} + +// ListLoadBalancerProfilesOptions : The ListLoadBalancerProfiles options. +type ListLoadBalancerProfilesOptions 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 +} + +// NewListLoadBalancerProfilesOptions : Instantiate ListLoadBalancerProfilesOptions +func (*VpcV1) NewListLoadBalancerProfilesOptions() *ListLoadBalancerProfilesOptions { + return &ListLoadBalancerProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListLoadBalancerProfilesOptions) SetStart(start string) *ListLoadBalancerProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListLoadBalancerProfilesOptions) SetLimit(limit int64) *ListLoadBalancerProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerProfilesOptions) SetHeaders(param map[string]string) *ListLoadBalancerProfilesOptions { + options.Headers = param + return options +} + +// ListLoadBalancersOptions : The ListLoadBalancers options. +type ListLoadBalancersOptions 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 +} + +// NewListLoadBalancersOptions : Instantiate ListLoadBalancersOptions +func (*VpcV1) NewListLoadBalancersOptions() *ListLoadBalancersOptions { + return &ListLoadBalancersOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListLoadBalancersOptions) SetStart(start string) *ListLoadBalancersOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListLoadBalancersOptions) SetLimit(limit int64) *ListLoadBalancersOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancersOptions) SetHeaders(param map[string]string) *ListLoadBalancersOptions { + options.Headers = param + return options +} + +// ListNetworkACLRulesOptions : The ListNetworkACLRules options. +type ListNetworkACLRulesOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_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 rules with the specified direction. + Direction *string `json:"direction,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListNetworkACLRulesOptions.Direction property. +// Filters the collection to rules with the specified direction. +const ( + ListNetworkACLRulesOptionsDirectionInboundConst = "inbound" + ListNetworkACLRulesOptionsDirectionOutboundConst = "outbound" +) + +// NewListNetworkACLRulesOptions : Instantiate ListNetworkACLRulesOptions +func (*VpcV1) NewListNetworkACLRulesOptions(networkACLID string) *ListNetworkACLRulesOptions { + return &ListNetworkACLRulesOptions{ + NetworkACLID: core.StringPtr(networkACLID), + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *ListNetworkACLRulesOptions) SetNetworkACLID(networkACLID string) *ListNetworkACLRulesOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListNetworkACLRulesOptions) SetStart(start string) *ListNetworkACLRulesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListNetworkACLRulesOptions) SetLimit(limit int64) *ListNetworkACLRulesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetDirection : Allow user to set Direction +func (_options *ListNetworkACLRulesOptions) SetDirection(direction string) *ListNetworkACLRulesOptions { + _options.Direction = core.StringPtr(direction) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListNetworkACLRulesOptions) SetHeaders(param map[string]string) *ListNetworkACLRulesOptions { + options.Headers = param + return options +} + +// ListNetworkAclsOptions : The ListNetworkAcls options. +type ListNetworkAclsOptions 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListNetworkAclsOptions : Instantiate ListNetworkAclsOptions +func (*VpcV1) NewListNetworkAclsOptions() *ListNetworkAclsOptions { + return &ListNetworkAclsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListNetworkAclsOptions) SetStart(start string) *ListNetworkAclsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListNetworkAclsOptions) SetLimit(limit int64) *ListNetworkAclsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListNetworkAclsOptions) SetResourceGroupID(resourceGroupID string) *ListNetworkAclsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListNetworkAclsOptions) SetHeaders(param map[string]string) *ListNetworkAclsOptions { + options.Headers = param + return options +} + +// ListOperatingSystemsOptions : The ListOperatingSystems options. +type ListOperatingSystemsOptions 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 +} + +// NewListOperatingSystemsOptions : Instantiate ListOperatingSystemsOptions +func (*VpcV1) NewListOperatingSystemsOptions() *ListOperatingSystemsOptions { + return &ListOperatingSystemsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListOperatingSystemsOptions) SetStart(start string) *ListOperatingSystemsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListOperatingSystemsOptions) SetLimit(limit int64) *ListOperatingSystemsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListOperatingSystemsOptions) SetHeaders(param map[string]string) *ListOperatingSystemsOptions { + options.Headers = param + return options +} + +// ListPlacementGroupsOptions : The ListPlacementGroups options. +type ListPlacementGroupsOptions 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 +} + +// NewListPlacementGroupsOptions : Instantiate ListPlacementGroupsOptions +func (*VpcV1) NewListPlacementGroupsOptions() *ListPlacementGroupsOptions { + return &ListPlacementGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListPlacementGroupsOptions) SetStart(start string) *ListPlacementGroupsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListPlacementGroupsOptions) SetLimit(limit int64) *ListPlacementGroupsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListPlacementGroupsOptions) SetHeaders(param map[string]string) *ListPlacementGroupsOptions { + options.Headers = param + return options +} + +// ListPublicGatewaysOptions : The ListPublicGateways options. +type ListPublicGatewaysOptions 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListPublicGatewaysOptions : Instantiate ListPublicGatewaysOptions +func (*VpcV1) NewListPublicGatewaysOptions() *ListPublicGatewaysOptions { + return &ListPublicGatewaysOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListPublicGatewaysOptions) SetStart(start string) *ListPublicGatewaysOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListPublicGatewaysOptions) SetLimit(limit int64) *ListPublicGatewaysOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListPublicGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListPublicGatewaysOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListPublicGatewaysOptions) SetHeaders(param map[string]string) *ListPublicGatewaysOptions { + options.Headers = param + return options +} + +// ListRegionZonesOptions : The ListRegionZones options. +type ListRegionZonesOptions struct { + // The region name. + RegionName *string `json:"region_name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListRegionZonesOptions : Instantiate ListRegionZonesOptions +func (*VpcV1) NewListRegionZonesOptions(regionName string) *ListRegionZonesOptions { + return &ListRegionZonesOptions{ + RegionName: core.StringPtr(regionName), + } +} + +// SetRegionName : Allow user to set RegionName +func (_options *ListRegionZonesOptions) SetRegionName(regionName string) *ListRegionZonesOptions { + _options.RegionName = core.StringPtr(regionName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListRegionZonesOptions) SetHeaders(param map[string]string) *ListRegionZonesOptions { + options.Headers = param + return options +} + +// ListRegionsOptions : The ListRegions options. +type ListRegionsOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListRegionsOptions : Instantiate ListRegionsOptions +func (*VpcV1) NewListRegionsOptions() *ListRegionsOptions { + return &ListRegionsOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListRegionsOptions) SetHeaders(param map[string]string) *ListRegionsOptions { + options.Headers = param + return options +} + +// ListSecurityGroupRulesOptions : The ListSecurityGroupRules options. +type ListSecurityGroupRulesOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSecurityGroupRulesOptions : Instantiate ListSecurityGroupRulesOptions +func (*VpcV1) NewListSecurityGroupRulesOptions(securityGroupID string) *ListSecurityGroupRulesOptions { + return &ListSecurityGroupRulesOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *ListSecurityGroupRulesOptions) SetSecurityGroupID(securityGroupID string) *ListSecurityGroupRulesOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSecurityGroupRulesOptions) SetHeaders(param map[string]string) *ListSecurityGroupRulesOptions { + options.Headers = param + return options +} + +// ListSecurityGroupTargetsOptions : The ListSecurityGroupTargets options. +type ListSecurityGroupTargetsOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_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 +} + +// NewListSecurityGroupTargetsOptions : Instantiate ListSecurityGroupTargetsOptions +func (*VpcV1) NewListSecurityGroupTargetsOptions(securityGroupID string) *ListSecurityGroupTargetsOptions { + return &ListSecurityGroupTargetsOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *ListSecurityGroupTargetsOptions) SetSecurityGroupID(securityGroupID string) *ListSecurityGroupTargetsOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListSecurityGroupTargetsOptions) SetStart(start string) *ListSecurityGroupTargetsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSecurityGroupTargetsOptions) SetLimit(limit int64) *ListSecurityGroupTargetsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSecurityGroupTargetsOptions) SetHeaders(param map[string]string) *ListSecurityGroupTargetsOptions { + options.Headers = param + return options +} + +// ListSecurityGroupsOptions : The ListSecurityGroups options. +type ListSecurityGroupsOptions 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources in the VPC with the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources in the VPC with the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources in the VPC with the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSecurityGroupsOptions : Instantiate ListSecurityGroupsOptions +func (*VpcV1) NewListSecurityGroupsOptions() *ListSecurityGroupsOptions { + return &ListSecurityGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListSecurityGroupsOptions) SetStart(start string) *ListSecurityGroupsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSecurityGroupsOptions) SetLimit(limit int64) *ListSecurityGroupsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListSecurityGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListSecurityGroupsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListSecurityGroupsOptions) SetVPCID(vpcID string) *ListSecurityGroupsOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListSecurityGroupsOptions) SetVPCCRN(vpcCRN string) *ListSecurityGroupsOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListSecurityGroupsOptions) SetVPCName(vpcName string) *ListSecurityGroupsOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSecurityGroupsOptions) SetHeaders(param map[string]string) *ListSecurityGroupsOptions { + options.Headers = param + return options +} + +// ListSnapshotsOptions : The ListSnapshots options. +type ListSnapshotsOptions 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 the exact tag value. + Tag *string `json:"tag,omitempty"` + + // Filters the collection to resources in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to resources with the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to resources with the source volume with the specified identifier. + SourceVolumeID *string `json:"source_volume.id,omitempty"` + + // Filters the collection to resources with the source volume with the specified CRN. + SourceVolumeCRN *string `json:"source_volume.crn,omitempty"` + + // Filters the collection to resources with the source image with the specified identifier. + // + // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no + // source image or any existent source image, respectively. + SourceImageID *string `json:"source_image.id,omitempty"` + + // Filters the collection to resources with the source volume with the specified CRN. + // + // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no + // source image or any existent source image, respectively. + SourceImageCRN *string `json:"source_image.crn,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 backup policy jobs with the backup plan with the specified identifier. + BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListSnapshotsOptions.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 ( + ListSnapshotsOptionsSortCreatedAtConst = "created_at" + ListSnapshotsOptionsSortNameConst = "name" +) + +// NewListSnapshotsOptions : Instantiate ListSnapshotsOptions +func (*VpcV1) NewListSnapshotsOptions() *ListSnapshotsOptions { + return &ListSnapshotsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListSnapshotsOptions) SetStart(start string) *ListSnapshotsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSnapshotsOptions) SetLimit(limit int64) *ListSnapshotsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetTag : Allow user to set Tag +func (_options *ListSnapshotsOptions) SetTag(tag string) *ListSnapshotsOptions { + _options.Tag = core.StringPtr(tag) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListSnapshotsOptions) SetResourceGroupID(resourceGroupID string) *ListSnapshotsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListSnapshotsOptions) SetName(name string) *ListSnapshotsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetSourceVolumeID : Allow user to set SourceVolumeID +func (_options *ListSnapshotsOptions) SetSourceVolumeID(sourceVolumeID string) *ListSnapshotsOptions { + _options.SourceVolumeID = core.StringPtr(sourceVolumeID) + return _options +} + +// SetSourceVolumeCRN : Allow user to set SourceVolumeCRN +func (_options *ListSnapshotsOptions) SetSourceVolumeCRN(sourceVolumeCRN string) *ListSnapshotsOptions { + _options.SourceVolumeCRN = core.StringPtr(sourceVolumeCRN) + return _options +} + +// SetSourceImageID : Allow user to set SourceImageID +func (_options *ListSnapshotsOptions) SetSourceImageID(sourceImageID string) *ListSnapshotsOptions { + _options.SourceImageID = core.StringPtr(sourceImageID) + return _options +} + +// SetSourceImageCRN : Allow user to set SourceImageCRN +func (_options *ListSnapshotsOptions) SetSourceImageCRN(sourceImageCRN string) *ListSnapshotsOptions { + _options.SourceImageCRN = core.StringPtr(sourceImageCRN) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListSnapshotsOptions) SetSort(sort string) *ListSnapshotsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID +func (_options *ListSnapshotsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListSnapshotsOptions { + _options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSnapshotsOptions) SetHeaders(param map[string]string) *ListSnapshotsOptions { + options.Headers = param + return options +} + +// ListSubnetReservedIpsOptions : The ListSubnetReservedIps options. +type ListSubnetReservedIpsOptions struct { + // The subnet identifier. + SubnetID *string `json:"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"` + + // 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 ListSubnetReservedIpsOptions.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 ( + ListSubnetReservedIpsOptionsSortAddressConst = "address" + ListSubnetReservedIpsOptionsSortCreatedAtConst = "created_at" + ListSubnetReservedIpsOptionsSortNameConst = "name" +) + +// NewListSubnetReservedIpsOptions : Instantiate ListSubnetReservedIpsOptions +func (*VpcV1) NewListSubnetReservedIpsOptions(subnetID string) *ListSubnetReservedIpsOptions { + return &ListSubnetReservedIpsOptions{ + SubnetID: core.StringPtr(subnetID), + } +} + +// SetSubnetID : Allow user to set SubnetID +func (_options *ListSubnetReservedIpsOptions) SetSubnetID(subnetID string) *ListSubnetReservedIpsOptions { + _options.SubnetID = core.StringPtr(subnetID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListSubnetReservedIpsOptions) SetStart(start string) *ListSubnetReservedIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSubnetReservedIpsOptions) SetLimit(limit int64) *ListSubnetReservedIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListSubnetReservedIpsOptions) SetSort(sort string) *ListSubnetReservedIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSubnetReservedIpsOptions) SetHeaders(param map[string]string) *ListSubnetReservedIpsOptions { + options.Headers = param + return options +} + +// ListSubnetsOptions : The ListSubnets options. +type ListSubnetsOptions 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to subnets attached to the routing table with the specified identifier. + RoutingTableID *string `json:"routing_table.id,omitempty"` + + // Filters the collection to subnets attached to the routing table with the specified name. + RoutingTableName *string `json:"routing_table.name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSubnetsOptions : Instantiate ListSubnetsOptions +func (*VpcV1) NewListSubnetsOptions() *ListSubnetsOptions { + return &ListSubnetsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListSubnetsOptions) SetStart(start string) *ListSubnetsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSubnetsOptions) SetLimit(limit int64) *ListSubnetsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListSubnetsOptions) SetResourceGroupID(resourceGroupID string) *ListSubnetsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *ListSubnetsOptions) SetRoutingTableID(routingTableID string) *ListSubnetsOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetRoutingTableName : Allow user to set RoutingTableName +func (_options *ListSubnetsOptions) SetRoutingTableName(routingTableName string) *ListSubnetsOptions { + _options.RoutingTableName = core.StringPtr(routingTableName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSubnetsOptions) SetHeaders(param map[string]string) *ListSubnetsOptions { + options.Headers = param + return options +} + +// ListVolumeProfilesOptions : The ListVolumeProfiles options. +type ListVolumeProfilesOptions 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 +} + +// NewListVolumeProfilesOptions : Instantiate ListVolumeProfilesOptions +func (*VpcV1) NewListVolumeProfilesOptions() *ListVolumeProfilesOptions { + return &ListVolumeProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListVolumeProfilesOptions) SetStart(start string) *ListVolumeProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVolumeProfilesOptions) SetLimit(limit int64) *ListVolumeProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVolumeProfilesOptions) SetHeaders(param map[string]string) *ListVolumeProfilesOptions { + options.Headers = param + return options +} + +// ListVolumesOptions : The ListVolumes options. +type ListVolumesOptions 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 the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to resources in the zone with the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVolumesOptions : Instantiate ListVolumesOptions +func (*VpcV1) NewListVolumesOptions() *ListVolumesOptions { + return &ListVolumesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListVolumesOptions) SetStart(start string) *ListVolumesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVolumesOptions) SetLimit(limit int64) *ListVolumesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListVolumesOptions) SetName(name string) *ListVolumesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *ListVolumesOptions) SetZoneName(zoneName string) *ListVolumesOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVolumesOptions) SetHeaders(param map[string]string) *ListVolumesOptions { + options.Headers = param + return options +} + +// ListVPCAddressPrefixesOptions : The ListVPCAddressPrefixes options. +type ListVPCAddressPrefixesOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_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 +} + +// NewListVPCAddressPrefixesOptions : Instantiate ListVPCAddressPrefixesOptions +func (*VpcV1) NewListVPCAddressPrefixesOptions(vpcID string) *ListVPCAddressPrefixesOptions { + return &ListVPCAddressPrefixesOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListVPCAddressPrefixesOptions) SetVPCID(vpcID string) *ListVPCAddressPrefixesOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPCAddressPrefixesOptions) SetStart(start string) *ListVPCAddressPrefixesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPCAddressPrefixesOptions) SetLimit(limit int64) *ListVPCAddressPrefixesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCAddressPrefixesOptions) SetHeaders(param map[string]string) *ListVPCAddressPrefixesOptions { + options.Headers = param + return options +} + +// ListVPCRoutesOptions : The ListVPCRoutes options. +type ListVPCRoutesOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // Filters the collection to resources in the zone with the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // 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 +} + +// NewListVPCRoutesOptions : Instantiate ListVPCRoutesOptions +func (*VpcV1) NewListVPCRoutesOptions(vpcID string) *ListVPCRoutesOptions { + return &ListVPCRoutesOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListVPCRoutesOptions) SetVPCID(vpcID string) *ListVPCRoutesOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *ListVPCRoutesOptions) SetZoneName(zoneName string) *ListVPCRoutesOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPCRoutesOptions) SetStart(start string) *ListVPCRoutesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPCRoutesOptions) SetLimit(limit int64) *ListVPCRoutesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCRoutesOptions) SetHeaders(param map[string]string) *ListVPCRoutesOptions { + options.Headers = param + return options +} + +// ListVPCRoutingTableRoutesOptions : The ListVPCRoutingTableRoutes options. +type ListVPCRoutingTableRoutesOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `json:"routing_table_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 +} + +// NewListVPCRoutingTableRoutesOptions : Instantiate ListVPCRoutingTableRoutesOptions +func (*VpcV1) NewListVPCRoutingTableRoutesOptions(vpcID string, routingTableID string) *ListVPCRoutingTableRoutesOptions { + return &ListVPCRoutingTableRoutesOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListVPCRoutingTableRoutesOptions) SetVPCID(vpcID string) *ListVPCRoutingTableRoutesOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *ListVPCRoutingTableRoutesOptions) SetRoutingTableID(routingTableID string) *ListVPCRoutingTableRoutesOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPCRoutingTableRoutesOptions) SetStart(start string) *ListVPCRoutingTableRoutesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPCRoutingTableRoutesOptions) SetLimit(limit int64) *ListVPCRoutingTableRoutesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCRoutingTableRoutesOptions) SetHeaders(param map[string]string) *ListVPCRoutingTableRoutesOptions { + options.Headers = param + return options +} + +// ListVPCRoutingTablesOptions : The ListVPCRoutingTables options. +type ListVPCRoutingTablesOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_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 routing tables with the specified `is_default` value. + IsDefault *bool `json:"is_default,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPCRoutingTablesOptions : Instantiate ListVPCRoutingTablesOptions +func (*VpcV1) NewListVPCRoutingTablesOptions(vpcID string) *ListVPCRoutingTablesOptions { + return &ListVPCRoutingTablesOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListVPCRoutingTablesOptions) SetVPCID(vpcID string) *ListVPCRoutingTablesOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPCRoutingTablesOptions) SetStart(start string) *ListVPCRoutingTablesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPCRoutingTablesOptions) SetLimit(limit int64) *ListVPCRoutingTablesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetIsDefault : Allow user to set IsDefault +func (_options *ListVPCRoutingTablesOptions) SetIsDefault(isDefault bool) *ListVPCRoutingTablesOptions { + _options.IsDefault = core.BoolPtr(isDefault) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCRoutingTablesOptions) SetHeaders(param map[string]string) *ListVPCRoutingTablesOptions { + options.Headers = param + return options +} + +// ListVpcsOptions : The ListVpcs options. +type ListVpcsOptions 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to VPCs with the specified `classic_access` value. + ClassicAccess *bool `json:"classic_access,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVpcsOptions : Instantiate ListVpcsOptions +func (*VpcV1) NewListVpcsOptions() *ListVpcsOptions { + return &ListVpcsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListVpcsOptions) SetStart(start string) *ListVpcsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVpcsOptions) SetLimit(limit int64) *ListVpcsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListVpcsOptions) SetResourceGroupID(resourceGroupID string) *ListVpcsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetClassicAccess : Allow user to set ClassicAccess +func (_options *ListVpcsOptions) SetClassicAccess(classicAccess bool) *ListVpcsOptions { + _options.ClassicAccess = core.BoolPtr(classicAccess) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVpcsOptions) SetHeaders(param map[string]string) *ListVpcsOptions { + options.Headers = param + return options +} + +// ListVPNGatewayConnectionLocalCIDRsOptions : The ListVPNGatewayConnectionLocalCIDRs options. +type ListVPNGatewayConnectionLocalCIDRsOptions 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="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPNGatewayConnectionLocalCIDRsOptions : Instantiate ListVPNGatewayConnectionLocalCIDRsOptions +func (*VpcV1) NewListVPNGatewayConnectionLocalCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionLocalCIDRsOptions { + return &ListVPNGatewayConnectionLocalCIDRsOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *ListVPNGatewayConnectionLocalCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionLocalCIDRsOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *ListVPNGatewayConnectionLocalCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionLocalCIDRsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewayConnectionLocalCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionLocalCIDRsOptions { + options.Headers = param + return options +} + +// ListVPNGatewayConnectionPeerCIDRsOptions : The ListVPNGatewayConnectionPeerCIDRs options. +type ListVPNGatewayConnectionPeerCIDRsOptions 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="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPNGatewayConnectionPeerCIDRsOptions : Instantiate ListVPNGatewayConnectionPeerCIDRsOptions +func (*VpcV1) NewListVPNGatewayConnectionPeerCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionPeerCIDRsOptions { + return &ListVPNGatewayConnectionPeerCIDRsOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *ListVPNGatewayConnectionPeerCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionPeerCIDRsOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *ListVPNGatewayConnectionPeerCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionPeerCIDRsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewayConnectionPeerCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionPeerCIDRsOptions { + options.Headers = param + return options +} + +// ListVPNGatewayConnectionsOptions : The ListVPNGatewayConnections options. +type ListVPNGatewayConnectionsOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // Filters the collection to VPN gateway connections with the specified status. + Status *string `json:"status,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPNGatewayConnectionsOptions : Instantiate ListVPNGatewayConnectionsOptions +func (*VpcV1) NewListVPNGatewayConnectionsOptions(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { + return &ListVPNGatewayConnectionsOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *ListVPNGatewayConnectionsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetStatus : Allow user to set Status +func (_options *ListVPNGatewayConnectionsOptions) SetStatus(status string) *ListVPNGatewayConnectionsOptions { + _options.Status = core.StringPtr(status) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewayConnectionsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsOptions { + options.Headers = param + return options +} + +// ListVPNGatewaysOptions : The ListVPNGateways options. +type ListVPNGatewaysOptions 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Filters the collection to VPN gateways with the specified mode. + Mode *string `json:"mode,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPNGatewaysOptions.Mode property. +// Filters the collection to VPN gateways with the specified mode. +const ( + ListVPNGatewaysOptionsModePolicyConst = "policy" + ListVPNGatewaysOptionsModeRouteConst = "route" +) + +// NewListVPNGatewaysOptions : Instantiate ListVPNGatewaysOptions +func (*VpcV1) NewListVPNGatewaysOptions() *ListVPNGatewaysOptions { + return &ListVPNGatewaysOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListVPNGatewaysOptions) SetStart(start string) *ListVPNGatewaysOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNGatewaysOptions) SetLimit(limit int64) *ListVPNGatewaysOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListVPNGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListVPNGatewaysOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetMode : Allow user to set Mode +func (_options *ListVPNGatewaysOptions) SetMode(mode string) *ListVPNGatewaysOptions { + _options.Mode = core.StringPtr(mode) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewaysOptions) SetHeaders(param map[string]string) *ListVPNGatewaysOptions { + options.Headers = param + return options +} + +// ListVPNServerClientsOptions : The ListVPNServerClients options. +type ListVPNServerClientsOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_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"` + + // 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. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPNServerClientsOptions.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. +const ( + ListVPNServerClientsOptionsSortCreatedAtConst = "created_at" +) + +// NewListVPNServerClientsOptions : Instantiate ListVPNServerClientsOptions +func (*VpcV1) NewListVPNServerClientsOptions(vpnServerID string) *ListVPNServerClientsOptions { + return &ListVPNServerClientsOptions{ + VPNServerID: core.StringPtr(vpnServerID), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *ListVPNServerClientsOptions) SetVPNServerID(vpnServerID string) *ListVPNServerClientsOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPNServerClientsOptions) SetStart(start string) *ListVPNServerClientsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNServerClientsOptions) SetLimit(limit int64) *ListVPNServerClientsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPNServerClientsOptions) SetSort(sort string) *ListVPNServerClientsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNServerClientsOptions) SetHeaders(param map[string]string) *ListVPNServerClientsOptions { + options.Headers = param + return options +} + +// ListVPNServerRoutesOptions : The ListVPNServerRoutes options. +type ListVPNServerRoutesOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_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"` + + // 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 ListVPNServerRoutesOptions.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 ( + ListVPNServerRoutesOptionsSortCreatedAtConst = "created_at" + ListVPNServerRoutesOptionsSortNameConst = "name" +) + +// NewListVPNServerRoutesOptions : Instantiate ListVPNServerRoutesOptions +func (*VpcV1) NewListVPNServerRoutesOptions(vpnServerID string) *ListVPNServerRoutesOptions { + return &ListVPNServerRoutesOptions{ + VPNServerID: core.StringPtr(vpnServerID), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *ListVPNServerRoutesOptions) SetVPNServerID(vpnServerID string) *ListVPNServerRoutesOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPNServerRoutesOptions) SetStart(start string) *ListVPNServerRoutesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNServerRoutesOptions) SetLimit(limit int64) *ListVPNServerRoutesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPNServerRoutesOptions) SetSort(sort string) *ListVPNServerRoutesOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNServerRoutesOptions) SetHeaders(param map[string]string) *ListVPNServerRoutesOptions { + options.Headers = param + return options +} + +// ListVPNServersOptions : The ListVPNServers options. +type ListVPNServersOptions struct { + // Filters the collection to resources with the exact specified name. + Name *string `json:"name,omitempty"` + + // 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 in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,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 ListVPNServersOptions.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 ( + ListVPNServersOptionsSortCreatedAtConst = "created_at" + ListVPNServersOptionsSortNameConst = "name" +) + +// NewListVPNServersOptions : Instantiate ListVPNServersOptions +func (*VpcV1) NewListVPNServersOptions() *ListVPNServersOptions { + return &ListVPNServersOptions{} +} + +// SetName : Allow user to set Name +func (_options *ListVPNServersOptions) SetName(name string) *ListVPNServersOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPNServersOptions) SetStart(start string) *ListVPNServersOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNServersOptions) SetLimit(limit int64) *ListVPNServersOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListVPNServersOptions) SetResourceGroupID(resourceGroupID string) *ListVPNServersOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPNServersOptions) SetSort(sort string) *ListVPNServersOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNServersOptions) SetHeaders(param map[string]string) *ListVPNServersOptions { + options.Headers = param + return options +} + +// LoadBalancer : LoadBalancer struct +type LoadBalancer struct { + // The date and time that this load balancer was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` + + // Fully qualified domain name assigned to this load balancer. + Hostname *string `json:"hostname" validate:"required"` + + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` + + // The type of this load balancer, public or private. + IsPublic *bool `json:"is_public" validate:"required"` + + // The listeners of this load balancer. + Listeners []LoadBalancerListenerReference `json:"listeners" validate:"required"` + + // The logging configuration for this load balancer. + Logging *LoadBalancerLogging `json:"logging" validate:"required"` + + // The unique user-defined name for this load balancer. + Name *string `json:"name" validate:"required"` + + // The operating status of this load balancer. + OperatingStatus *string `json:"operating_status" validate:"required"` + + // The pools of this load balancer. + Pools []LoadBalancerPoolReference `json:"pools" validate:"required"` + + // The private IP addresses assigned to this load balancer. + PrivateIps []LoadBalancerPrivateIpsItem `json:"private_ips" validate:"required"` + + // The profile for this load balancer. + Profile *LoadBalancerProfileReference `json:"profile" validate:"required"` + + // The provisioning status of this load balancer: + // + // - `active`: The load balancer is running. + // - `create_pending`: The load balancer is being created. + // - `delete_pending`: The load balancer is being deleted. + // - `maintenance_pending`: The load balancer is unavailable due to an internal + // error (contact IBM support). + // - `update_pending`: The load balancer is being updated + // to the requested configuration. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The public IP addresses assigned to this load balancer. + // + // Applicable only for public load balancers. + PublicIps []IP `json:"public_ips" validate:"required"` + + // The resource group for this load balancer. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether route mode is enabled for this load balancer. + // + // At present, public load balancers are not supported with route mode enabled. + RouteMode *bool `json:"route_mode" validate:"required"` + + // The security groups targeting this load balancer. + // + // Applicable only for load balancers that support security groups. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // Indicates whether this load balancer supports security groups. + SecurityGroupsSupported *bool `json:"security_groups_supported" validate:"required"` + + // The subnets this load balancer is part of. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // Indicates whether this load balancer supports UDP. + UDPSupported *bool `json:"udp_supported" validate:"required"` +} + +// Constants associated with the LoadBalancer.OperatingStatus property. +// The operating status of this load balancer. +const ( + LoadBalancerOperatingStatusOfflineConst = "offline" + LoadBalancerOperatingStatusOnlineConst = "online" +) + +// Constants associated with the LoadBalancer.ProvisioningStatus property. +// The provisioning status of this load balancer: +// +// - `active`: The load balancer is running. +// - `create_pending`: The load balancer is being created. +// - `delete_pending`: The load balancer is being deleted. +// - `maintenance_pending`: The load balancer is unavailable due to an internal +// error (contact IBM support). +// - `update_pending`: The load balancer is being updated +// to the requested configuration. +const ( + LoadBalancerProvisioningStatusActiveConst = "active" + LoadBalancerProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerProvisioningStatusFailedConst = "failed" + LoadBalancerProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerProvisioningStatusUpdatePendingConst = "update_pending" +) + +// Constants associated with the LoadBalancer.ResourceType property. +// The resource type. +const ( + LoadBalancerResourceTypeLoadBalancerConst = "load_balancer" +) + +// UnmarshalLoadBalancer unmarshals an instance of LoadBalancer from the specified map of raw messages. +func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancer) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_public", &obj.IsPublic) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListenerReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLogging) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "operating_status", &obj.OperatingStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPoolReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalLoadBalancerPrivateIpsItem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalLoadBalancerProfileReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_ips", &obj.PublicIps, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_mode", &obj.RouteMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "security_groups_supported", &obj.SecurityGroupsSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "udp_supported", &obj.UDPSupported) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerCollection : LoadBalancerCollection struct +type LoadBalancerCollection struct { + // A link to the first page of resources. + First *LoadBalancerCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of load balancers. + LoadBalancers []LoadBalancer `json:"load_balancers" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *LoadBalancerCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancers", &obj.LoadBalancers, UnmarshalLoadBalancer) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *LoadBalancerCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentity : Identifies a load balancer by a unique property. +// Models which "extend" this model: +// - LoadBalancerIdentityByID +// - LoadBalancerIdentityByCRN +// - LoadBalancerIdentityByHref +type LoadBalancerIdentity struct { + // The unique identifier for this load balancer. + ID *string `json:"id,omitempty"` + + // The load balancer's CRN. + CRN *string `json:"crn,omitempty"` + + // The load balancer's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerIdentity) isaLoadBalancerIdentity() bool { + return true +} + +type LoadBalancerIdentityIntf interface { + isaLoadBalancerIdentity() bool +} + +// UnmarshalLoadBalancerIdentity unmarshals an instance of LoadBalancerIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 + // the `application` family (otherwise always `false`). Additional restrictions: + // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must + // match the `accept_proxy_protocol` value of the `https_redirect` listener. + // - If this listener is the target of another listener's `https_redirect`, its + // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. + AcceptProxyProtocol *bool `json:"accept_proxy_protocol" validate:"required"` + + // The certificate instance used for SSL termination. It is applicable only to `https` + // protocol. + CertificateInstance *CertificateInstanceReference `json:"certificate_instance,omitempty"` + + // The connection limit of the listener. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` + + // The date and time that this listener was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The default pool for this listener. If absent, this listener has no default pool. + DefaultPool *LoadBalancerPoolReference `json:"default_pool,omitempty"` + + // The listener's canonical URL. + Href *string `json:"href" validate:"required"` + + // If specified, the target listener that requests are redirected to. + HTTPSRedirect *LoadBalancerListenerHTTPSRedirect `json:"https_redirect,omitempty"` + + // The unique identifier for this load balancer listener. + ID *string `json:"id" validate:"required"` + + // The policies for this listener. + Policies []LoadBalancerListenerPolicyReference `json:"policies,omitempty"` + + // The listener port number, or the inclusive lower bound of the port range. + Port *int64 `json:"port" validate:"required"` + + // The inclusive upper bound of the range of ports used by this listener. + // + // At present, only load balancers in the `network` family support more than one port per listener. + PortMax *int64 `json:"port_max" validate:"required"` + + // The inclusive lower bound of the range of ports used by this listener. + // + // At present, only load balancers in the `network` family support more than one port per listener. + PortMin *int64 `json:"port_min" validate:"required"` + + // The listener protocol. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the + // unexpected property value was encountered. + Protocol *string `json:"protocol" validate:"required"` + + // The provisioning status of this listener. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` +} + +// Constants associated with the LoadBalancerListener.Protocol property. +// The listener protocol. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerProtocolHTTPConst = "http" + LoadBalancerListenerProtocolHTTPSConst = "https" + LoadBalancerListenerProtocolTCPConst = "tcp" + LoadBalancerListenerProtocolUDPConst = "udp" +) + +// Constants associated with the LoadBalancerListener.ProvisioningStatus property. +// The provisioning status of this listener. +const ( + LoadBalancerListenerProvisioningStatusActiveConst = "active" + LoadBalancerListenerProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerProvisioningStatusFailedConst = "failed" + LoadBalancerListenerProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerListenerProvisioningStatusUpdatePendingConst = "update_pending" +) + +// UnmarshalLoadBalancerListener unmarshals an instance of LoadBalancerListener from the specified map of raw messages. +func UnmarshalLoadBalancerListener(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListener) + err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirect) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerCollection : LoadBalancerListenerCollection struct +type LoadBalancerListenerCollection struct { + // Collection of listeners. + Listeners []LoadBalancerListener `json:"listeners" validate:"required"` +} + +// UnmarshalLoadBalancerListenerCollection unmarshals an instance of LoadBalancerListenerCollection from the specified map of raw messages. +func UnmarshalLoadBalancerListenerCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerCollection) + err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListener) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerHTTPSRedirect : LoadBalancerListenerHTTPSRedirect struct +type LoadBalancerListenerHTTPSRedirect struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + Listener *LoadBalancerListenerReference `json:"listener" validate:"required"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +// UnmarshalLoadBalancerListenerHTTPSRedirect unmarshals an instance of LoadBalancerListenerHTTPSRedirect from the specified map of raw messages. +func UnmarshalLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerHTTPSRedirect) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerHTTPSRedirectPatch : LoadBalancerListenerHTTPSRedirectPatch struct +type LoadBalancerListenerHTTPSRedirectPatch struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +// UnmarshalLoadBalancerListenerHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerHTTPSRedirectPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerHTTPSRedirectPatch) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerHTTPSRedirectPrototype struct +type LoadBalancerListenerHTTPSRedirectPrototype struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener" validate:"required"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +// NewLoadBalancerListenerHTTPSRedirectPrototype : Instantiate LoadBalancerListenerHTTPSRedirectPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerHTTPSRedirectPrototype, err error) { + _model = &LoadBalancerListenerHTTPSRedirectPrototype{ + HTTPStatusCode: core.Int64Ptr(httpStatusCode), + Listener: listener, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerHTTPSRedirectPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerHTTPSRedirectPrototype) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerIdentity : Identifies a load balancer listener by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerIdentityByID +// - LoadBalancerListenerIdentityByHref +type LoadBalancerListenerIdentity struct { + // The unique identifier for this load balancer listener. + ID *string `json:"id,omitempty"` + + // The listener's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerIdentity) isaLoadBalancerListenerIdentity() bool { + return true +} + +type LoadBalancerListenerIdentityIntf interface { + isaLoadBalancerListenerIdentity() bool +} + +// UnmarshalLoadBalancerListenerIdentity unmarshals an instance of LoadBalancerListenerIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 + // the `application` family (otherwise always `false`). Additional restrictions: + // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must + // match the `accept_proxy_protocol` value of the `https_redirect` listener. + // - If this listener is the target of another listener's `https_redirect`, its + // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. + AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` + + // The certificate instance used for SSL termination. It is applicable only to `https` + // protocol. + CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` + + // The connection limit of the listener. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` + + // The default pool for this listener. The specified pool must: + // + // - Belong to this load balancer + // - Have the same `protocol` as this listener, or have a compatible protocol. + // At present, the compatible protocols are `http` and `https`. + // - Not already be the `default_pool` for another listener + // + // Specify `null` to remove an existing default pool. + DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` + + // The target listener that requests will be redirected to. This listener must have a + // `protocol` of `http`, and the target listener must have a `protocol` of `https`. + // + // Specify `null` to remove any existing https redirect. + HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPatch `json:"https_redirect,omitempty"` + + // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must + // have a unique `port` and `protocol` combination. + // + // Not supported for load balancers operating with route mode enabled. + Port *int64 `json:"port,omitempty"` + + // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `65535` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `1` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMin *int64 `json:"port_min,omitempty"` + + // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. + // + // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http` and + // `https`. + // + // Additional restrictions: + // - If `default_pool` is set, the protocol cannot be changed. + // - If `https_redirect` is set, the protocol must be `http`. + // - If another listener's `https_redirect` targets this listener, the protocol must be + // `https`. + Protocol *string `json:"protocol,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPatch.Protocol property. +// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. +// +// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http` and +// `https`. +// +// Additional restrictions: +// - If `default_pool` is set, the protocol cannot be changed. +// - If `https_redirect` is set, the protocol must be `http`. +// - If another listener's `https_redirect` targets this listener, the protocol must be +// `https`. +const ( + LoadBalancerListenerPatchProtocolHTTPConst = "http" + LoadBalancerListenerPatchProtocolHTTPSConst = "https" + LoadBalancerListenerPatchProtocolTCPConst = "tcp" + LoadBalancerListenerPatchProtocolUDPConst = "udp" +) + +// UnmarshalLoadBalancerListenerPatch unmarshals an instance of LoadBalancerListenerPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPatch) + err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// LoadBalancerListenerPolicy : LoadBalancerListenerPolicy struct +type LoadBalancerListenerPolicy struct { + // The policy action. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the + // unexpected property value was encountered. + Action *string `json:"action" validate:"required"` + + // The date and time that this policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The listener policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The policy's unique identifier. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this policy. + Name *string `json:"name" validate:"required"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority" validate:"required"` + + // The provisioning status of this policy. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The rules for this policy. + Rules []LoadBalancerListenerPolicyRuleReference `json:"rules" validate:"required"` + + // - If `action` is `forward`, the response is a `LoadBalancerPoolReference` + // - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL` + // - If `action` is `https_redirect`, the response is a `LoadBalancerListenerHTTPSRedirect`. + Target LoadBalancerListenerPolicyTargetIntf `json:"target,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPolicy.Action property. +// The policy action. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerPolicyActionForwardConst = "forward" + LoadBalancerListenerPolicyActionHTTPSRedirectConst = "https_redirect" + LoadBalancerListenerPolicyActionRedirectConst = "redirect" + LoadBalancerListenerPolicyActionRejectConst = "reject" +) + +// Constants associated with the LoadBalancerListenerPolicy.ProvisioningStatus property. +// The provisioning status of this policy. +const ( + LoadBalancerListenerPolicyProvisioningStatusActiveConst = "active" + LoadBalancerListenerPolicyProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerPolicyProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerPolicyProvisioningStatusFailedConst = "failed" + LoadBalancerListenerPolicyProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerListenerPolicyProvisioningStatusUpdatePendingConst = "update_pending" +) + +// UnmarshalLoadBalancerListenerPolicy unmarshals an instance of LoadBalancerListenerPolicy from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicy) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRuleReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTarget) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyCollection : LoadBalancerListenerPolicyCollection struct +type LoadBalancerListenerPolicyCollection struct { + // Collection of policies. + Policies []LoadBalancerListenerPolicy `json:"policies" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyCollection unmarshals an instance of LoadBalancerListenerPolicyCollection from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyCollection) + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyPatch : LoadBalancerListenerPolicyPatch struct +type LoadBalancerListenerPolicyPatch struct { + // The user-defined name for this policy. Names must be unique within the load balancer listener the policy resides in. + Name *string `json:"name,omitempty"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority,omitempty"` + + // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. + // - If `action` is `https_redirect`, specify a + // `LoadBalancerListenerPolicyHTTPSRedirectPatch`. + Target LoadBalancerListenerPolicyTargetPatchIntf `json:"target,omitempty"` +} + +// UnmarshalLoadBalancerListenerPolicyPatch unmarshals an instance of LoadBalancerListenerPolicyPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// LoadBalancerListenerPolicyPrototype : LoadBalancerListenerPolicyPrototype struct +type LoadBalancerListenerPolicyPrototype struct { + // The policy action. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the + // unexpected property value was encountered. + Action *string `json:"action" validate:"required"` + + // The user-defined name for this policy. Names must be unique within the load balancer listener the policy resides in. + Name *string `json:"name,omitempty"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority" validate:"required"` + + // The rule prototype objects for this policy. + Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` + + // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. + // - If `action` is `https_redirect`, specify a + // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPolicyPrototype.Action property. +// The policy action. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerPolicyPrototypeActionForwardConst = "forward" + LoadBalancerListenerPolicyPrototypeActionHTTPSRedirectConst = "https_redirect" + LoadBalancerListenerPolicyPrototypeActionRedirectConst = "redirect" + LoadBalancerListenerPolicyPrototypeActionRejectConst = "reject" +) + +// NewLoadBalancerListenerPolicyPrototype : Instantiate LoadBalancerListenerPolicyPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyPrototype(action string, priority int64) (_model *LoadBalancerListenerPolicyPrototype, err error) { + _model = &LoadBalancerListenerPolicyPrototype{ + Action: core.StringPtr(action), + Priority: core.Int64Ptr(priority), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerPolicyPrototype unmarshals an instance of LoadBalancerListenerPolicyPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyReference : LoadBalancerListenerPolicyReference struct +type LoadBalancerListenerPolicyReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerListenerPolicyReferenceDeleted `json:"deleted,omitempty"` + + // The listener policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The policy's unique identifier. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyReference unmarshals an instance of LoadBalancerListenerPolicyReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerListenerPolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyReferenceDeleted unmarshals an instance of LoadBalancerListenerPolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRule : LoadBalancerListenerPolicyRule struct +type LoadBalancerListenerPolicyRule struct { + // The condition of the rule. + Condition *string `json:"condition" validate:"required"` + + // The date and time that this rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this property is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // The rule's canonical URL. + Href *string `json:"href" validate:"required"` + + // The rule's unique identifier. + ID *string `json:"id" validate:"required"` + + // The provisioning status of this rule. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type" validate:"required"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerListenerPolicyRule.Condition property. +// The condition of the rule. +const ( + LoadBalancerListenerPolicyRuleConditionContainsConst = "contains" + LoadBalancerListenerPolicyRuleConditionEqualsConst = "equals" + LoadBalancerListenerPolicyRuleConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the LoadBalancerListenerPolicyRule.ProvisioningStatus property. +// The provisioning status of this rule. +const ( + LoadBalancerListenerPolicyRuleProvisioningStatusActiveConst = "active" + LoadBalancerListenerPolicyRuleProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerPolicyRuleProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerPolicyRuleProvisioningStatusFailedConst = "failed" + LoadBalancerListenerPolicyRuleProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerListenerPolicyRuleProvisioningStatusUpdatePendingConst = "update_pending" +) + +// Constants associated with the LoadBalancerListenerPolicyRule.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + LoadBalancerListenerPolicyRuleTypeBodyConst = "body" + LoadBalancerListenerPolicyRuleTypeHeaderConst = "header" + LoadBalancerListenerPolicyRuleTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRuleTypePathConst = "path" + LoadBalancerListenerPolicyRuleTypeQueryConst = "query" +) + +// UnmarshalLoadBalancerListenerPolicyRule unmarshals an instance of LoadBalancerListenerPolicyRule from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRule(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRule) + err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "field", &obj.Field) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRuleCollection : LoadBalancerListenerPolicyRuleCollection struct +type LoadBalancerListenerPolicyRuleCollection struct { + // Collection of rules. + Rules []LoadBalancerListenerPolicyRule `json:"rules" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyRuleCollection unmarshals an instance of LoadBalancerListenerPolicyRuleCollection from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRuleCollection) + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRulePatch : LoadBalancerListenerPolicyRulePatch struct +type LoadBalancerListenerPolicyRulePatch struct { + // The condition of the rule. + Condition *string `json:"condition,omitempty"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this property is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type,omitempty"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPolicyRulePatch.Condition property. +// The condition of the rule. +const ( + LoadBalancerListenerPolicyRulePatchConditionContainsConst = "contains" + LoadBalancerListenerPolicyRulePatchConditionEqualsConst = "equals" + LoadBalancerListenerPolicyRulePatchConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the LoadBalancerListenerPolicyRulePatch.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + LoadBalancerListenerPolicyRulePatchTypeBodyConst = "body" + LoadBalancerListenerPolicyRulePatchTypeHeaderConst = "header" + LoadBalancerListenerPolicyRulePatchTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRulePatchTypePathConst = "path" + LoadBalancerListenerPolicyRulePatchTypeQueryConst = "query" +) + +// UnmarshalLoadBalancerListenerPolicyRulePatch unmarshals an instance of LoadBalancerListenerPolicyRulePatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRulePatch) + err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "field", &obj.Field) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// LoadBalancerListenerPolicyRulePrototype : LoadBalancerListenerPolicyRulePrototype struct +type LoadBalancerListenerPolicyRulePrototype struct { + // The condition of the rule. + Condition *string `json:"condition" validate:"required"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this property is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type" validate:"required"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Condition property. +// The condition of the rule. +const ( + LoadBalancerListenerPolicyRulePrototypeConditionContainsConst = "contains" + LoadBalancerListenerPolicyRulePrototypeConditionEqualsConst = "equals" + LoadBalancerListenerPolicyRulePrototypeConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + LoadBalancerListenerPolicyRulePrototypeTypeBodyConst = "body" + LoadBalancerListenerPolicyRulePrototypeTypeHeaderConst = "header" + LoadBalancerListenerPolicyRulePrototypeTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRulePrototypeTypePathConst = "path" + LoadBalancerListenerPolicyRulePrototypeTypeQueryConst = "query" +) + +// NewLoadBalancerListenerPolicyRulePrototype : Instantiate LoadBalancerListenerPolicyRulePrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyRulePrototype(condition string, typeVar string, value string) (_model *LoadBalancerListenerPolicyRulePrototype, err error) { + _model = &LoadBalancerListenerPolicyRulePrototype{ + Condition: core.StringPtr(condition), + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerPolicyRulePrototype unmarshals an instance of LoadBalancerListenerPolicyRulePrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRulePrototype) + err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "field", &obj.Field) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRuleReference : LoadBalancerListenerPolicyRuleReference struct +type LoadBalancerListenerPolicyRuleReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerListenerPolicyRuleReferenceDeleted `json:"deleted,omitempty"` + + // The rule's canonical URL. + Href *string `json:"href" validate:"required"` + + // The rule's unique identifier. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyRuleReference unmarshals an instance of LoadBalancerListenerPolicyRuleReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRuleReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerListenerPolicyRuleReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted unmarshals an instance of LoadBalancerListenerPolicyRuleReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRuleReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTarget : - If `action` is `forward`, the response is a `LoadBalancerPoolReference` +// - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL` +// - If `action` is `https_redirect`, the response is a `LoadBalancerListenerHTTPSRedirect`. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetLoadBalancerPoolReference +// - LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL +// - LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect +type LoadBalancerListenerPolicyTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The user-defined name for this load balancer pool. + Name *string `json:"name,omitempty"` + + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` + + Listener *LoadBalancerListenerReference `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTarget) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +type LoadBalancerListenerPolicyTargetIntf interface { + isaLoadBalancerListenerPolicyTarget() bool +} + +// UnmarshalLoadBalancerListenerPolicyTarget unmarshals an instance of LoadBalancerListenerPolicyTarget from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatch : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. +// - If `action` is `https_redirect`, specify a +// `LoadBalancerListenerPolicyHTTPSRedirectPatch`. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch +type LoadBalancerListenerPolicyTargetPatch struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` + + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPatchIntf interface { + isaLoadBalancerListenerPolicyTargetPatch() bool +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototype : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. +// - If `action` is `https_redirect`, specify a +// `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype +type LoadBalancerListenerPolicyTargetPrototype struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` + + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPrototypeIntf interface { + isaLoadBalancerListenerPolicyTargetPrototype() bool +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPrototypeLoadBalancerContext : LoadBalancerListenerPrototypeLoadBalancerContext struct +type LoadBalancerListenerPrototypeLoadBalancerContext struct { + // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in + // the `application` family (otherwise always `false`). Additional restrictions: + // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must + // match the `accept_proxy_protocol` value of the `https_redirect` listener. + // - If this listener is the target of another listener's `https_redirect`, its + // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. + AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` + + // The connection limit of the listener. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` + + // The default pool for this listener. If specified, the pool's protocol must match the + // listener's protocol, or the protocols must be compatible. At present, the compatible + // protocols are `http` and `https`. + // + // If unspecified, this listener will be created with no default pool, but one may be + // subsequently set. + DefaultPool *LoadBalancerPoolIdentityByName `json:"default_pool,omitempty"` + + // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must + // have a unique `port` and `protocol` combination. + // + // Not supported for load balancers operating with route mode enabled. + Port *int64 `json:"port,omitempty"` + + // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `65535` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `1` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMin *int64 `json:"port_min,omitempty"` + + // The listener protocol. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the + // unexpected property value was encountered. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the LoadBalancerListenerPrototypeLoadBalancerContext.Protocol property. +// The listener protocol. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPConst = "http" + LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPSConst = "https" + LoadBalancerListenerPrototypeLoadBalancerContextProtocolTCPConst = "tcp" + LoadBalancerListenerPrototypeLoadBalancerContextProtocolUDPConst = "udp" +) + +// NewLoadBalancerListenerPrototypeLoadBalancerContext : Instantiate LoadBalancerListenerPrototypeLoadBalancerContext (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPrototypeLoadBalancerContext(protocol string) (_model *LoadBalancerListenerPrototypeLoadBalancerContext, err error) { + _model = &LoadBalancerListenerPrototypeLoadBalancerContext{ + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext unmarshals an instance of LoadBalancerListenerPrototypeLoadBalancerContext from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPrototypeLoadBalancerContext) + err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentityByName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerReference : LoadBalancerListenerReference struct +type LoadBalancerListenerReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerListenerReferenceDeleted `json:"deleted,omitempty"` + + // The listener's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer listener. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalLoadBalancerListenerReference unmarshals an instance of LoadBalancerListenerReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerListenerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerListenerReferenceDeleted unmarshals an instance of LoadBalancerListenerReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerListenerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLogging : LoadBalancerLogging struct +type LoadBalancerLogging struct { + // The datapath logging configuration for this load balancer. + Datapath *LoadBalancerLoggingDatapath `json:"datapath,omitempty"` +} + +// UnmarshalLoadBalancerLogging unmarshals an instance of LoadBalancerLogging from the specified map of raw messages. +func UnmarshalLoadBalancerLogging(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLogging) + err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLoggingDatapath : The datapath logging configuration for this load balancer. +type LoadBalancerLoggingDatapath struct { + // Indicates whether datapath logging is active for this load balancer. + Active *bool `json:"active" validate:"required"` +} + +// NewLoadBalancerLoggingDatapath : Instantiate LoadBalancerLoggingDatapath (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerLoggingDatapath(active bool) (_model *LoadBalancerLoggingDatapath, err error) { + _model = &LoadBalancerLoggingDatapath{ + Active: core.BoolPtr(active), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerLoggingDatapath unmarshals an instance of LoadBalancerLoggingDatapath from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingDatapath(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingDatapath) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPatch : LoadBalancerPatch struct +type LoadBalancerPatch struct { + // The logging configuration to use for this load balancer. + // + // To activate logging, the load balancer profile must support the specified logging type. + Logging *LoadBalancerLogging `json:"logging,omitempty"` + + // The unique user-defined name for this load balancer. + Name *string `json:"name,omitempty"` +} + +// UnmarshalLoadBalancerPatch unmarshals an instance of LoadBalancerPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPatch) + err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLogging) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// LoadBalancerPool : LoadBalancerPool struct +type LoadBalancerPool struct { + // The load balancing algorithm. + Algorithm *string `json:"algorithm" validate:"required"` + + // The date and time that this pool was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitor `json:"health_monitor" validate:"required"` + + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` + + // The instance group that is managing this pool. + InstanceGroup *InstanceGroupReference `json:"instance_group,omitempty"` + + // The backend server members of the pool. + Members []LoadBalancerPoolMemberReference `json:"members,omitempty"` + + // The user-defined name for this load balancer pool. + Name *string `json:"name" validate:"required"` + + // The protocol for this load balancer pool. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the + // unexpected property value was encountered. + Protocol *string `json:"protocol" validate:"required"` + + // The provisioning status of this pool. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol" validate:"required"` + + // The session persistence of this pool. + // + // The enumerated values for this property are expected to expand in the future. When + // processing this property, check for and log unknown values. Optionally halt + // processing and surface the error, or bypass the pool on which the unexpected + // property value was encountered. + SessionPersistence *LoadBalancerPoolSessionPersistence `json:"session_persistence,omitempty"` +} + +// Constants associated with the LoadBalancerPool.Algorithm property. +// The load balancing algorithm. +const ( + LoadBalancerPoolAlgorithmLeastConnectionsConst = "least_connections" + LoadBalancerPoolAlgorithmRoundRobinConst = "round_robin" + LoadBalancerPoolAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the LoadBalancerPool.Protocol property. +// The protocol for this load balancer pool. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the +// unexpected property value was encountered. +const ( + LoadBalancerPoolProtocolHTTPConst = "http" + LoadBalancerPoolProtocolHTTPSConst = "https" + LoadBalancerPoolProtocolTCPConst = "tcp" + LoadBalancerPoolProtocolUDPConst = "udp" +) + +// Constants associated with the LoadBalancerPool.ProvisioningStatus property. +// The provisioning status of this pool. +const ( + LoadBalancerPoolProvisioningStatusActiveConst = "active" + LoadBalancerPoolProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerPoolProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerPoolProvisioningStatusFailedConst = "failed" + LoadBalancerPoolProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerPoolProvisioningStatusUpdatePendingConst = "update_pending" +) + +// Constants associated with the LoadBalancerPool.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + LoadBalancerPoolProxyProtocolDisabledConst = "disabled" + LoadBalancerPoolProxyProtocolV1Const = "v1" + LoadBalancerPoolProxyProtocolV2Const = "v2" +) + +// UnmarshalLoadBalancerPool unmarshals an instance of LoadBalancerPool from the specified map of raw messages. +func UnmarshalLoadBalancerPool(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPool) + err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitor) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_group", &obj.InstanceGroup, UnmarshalInstanceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistence) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolCollection : LoadBalancerPoolCollection struct +type LoadBalancerPoolCollection struct { + // Collection of pools. + Pools []LoadBalancerPool `json:"pools" validate:"required"` +} + +// UnmarshalLoadBalancerPoolCollection unmarshals an instance of LoadBalancerPoolCollection from the specified map of raw messages. +func UnmarshalLoadBalancerPoolCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolCollection) + err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPool) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolHealthMonitor : LoadBalancerPoolHealthMonitor struct +type LoadBalancerPoolHealthMonitor struct { + // The health check interval in seconds. Interval must be greater than timeout value. + Delay *int64 `json:"delay" validate:"required"` + + // The health check max retries. + MaxRetries *int64 `json:"max_retries" validate:"required"` + + // The health check port number. If specified, this overrides the ports specified in the server member resources. + Port *int64 `json:"port,omitempty"` + + // The health check timeout in seconds. + Timeout *int64 `json:"timeout" validate:"required"` + + // The protocol type of this load balancer pool health monitor. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which + // the unexpected property value was encountered. + Type *string `json:"type" validate:"required"` + + // The health check URL path. Applicable only if the health monitor `type` is `http` or + // `https`. This value 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"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitor.Type property. +// The protocol type of this load balancer pool health monitor. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which +// the unexpected property value was encountered. +const ( + LoadBalancerPoolHealthMonitorTypeHTTPConst = "http" + LoadBalancerPoolHealthMonitorTypeHTTPSConst = "https" + LoadBalancerPoolHealthMonitorTypeTCPConst = "tcp" +) + +// UnmarshalLoadBalancerPoolHealthMonitor unmarshals an instance of LoadBalancerPoolHealthMonitor from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitor(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitor) + err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolHealthMonitorPatch : LoadBalancerPoolHealthMonitorPatch struct +type LoadBalancerPoolHealthMonitorPatch struct { + // The health check interval in seconds. Interval must be greater than timeout value. + Delay *int64 `json:"delay" validate:"required"` + + // The health check max retries. + MaxRetries *int64 `json:"max_retries" validate:"required"` + + // The health check port number. If specified, this overrides the ports specified in the server member resources. + // Specify `null` to remove an existing port value. + Port *int64 `json:"port,omitempty"` + + // The health check timeout in seconds. + Timeout *int64 `json:"timeout" validate:"required"` + + // The protocol type of this load balancer pool health monitor. + Type *string `json:"type" validate:"required"` + + // The health check URL path. Applicable only if the health monitor `type` is `http` or + // `https`. This value 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"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitorPatch.Type property. +// The protocol type of this load balancer pool health monitor. +const ( + LoadBalancerPoolHealthMonitorPatchTypeHTTPConst = "http" + LoadBalancerPoolHealthMonitorPatchTypeHTTPSConst = "https" + LoadBalancerPoolHealthMonitorPatchTypeTCPConst = "tcp" +) + +// NewLoadBalancerPoolHealthMonitorPatch : Instantiate LoadBalancerPoolHealthMonitorPatch (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolHealthMonitorPatch(delay int64, maxRetries int64, timeout int64, typeVar string) (_model *LoadBalancerPoolHealthMonitorPatch, err error) { + _model = &LoadBalancerPoolHealthMonitorPatch{ + Delay: core.Int64Ptr(delay), + MaxRetries: core.Int64Ptr(maxRetries), + Timeout: core.Int64Ptr(timeout), + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolHealthMonitorPatch unmarshals an instance of LoadBalancerPoolHealthMonitorPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitorPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitorPatch) + err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolHealthMonitorPrototype : LoadBalancerPoolHealthMonitorPrototype struct +type LoadBalancerPoolHealthMonitorPrototype struct { + // The health check interval in seconds. Interval must be greater than timeout value. + Delay *int64 `json:"delay" validate:"required"` + + // The health check max retries. + MaxRetries *int64 `json:"max_retries" validate:"required"` + + // The health check port number. If specified, this overrides the ports specified in the server member resources. + Port *int64 `json:"port,omitempty"` + + // The health check timeout in seconds. + Timeout *int64 `json:"timeout" validate:"required"` + + // The protocol type of this load balancer pool health monitor. + Type *string `json:"type" validate:"required"` + + // The health check URL path. Applicable only if the health monitor `type` is `http` or + // `https`. This value 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"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitorPrototype.Type property. +// The protocol type of this load balancer pool health monitor. +const ( + LoadBalancerPoolHealthMonitorPrototypeTypeHTTPConst = "http" + LoadBalancerPoolHealthMonitorPrototypeTypeHTTPSConst = "https" + LoadBalancerPoolHealthMonitorPrototypeTypeTCPConst = "tcp" +) + +// NewLoadBalancerPoolHealthMonitorPrototype : Instantiate LoadBalancerPoolHealthMonitorPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolHealthMonitorPrototype(delay int64, maxRetries int64, timeout int64, typeVar string) (_model *LoadBalancerPoolHealthMonitorPrototype, err error) { + _model = &LoadBalancerPoolHealthMonitorPrototype{ + Delay: core.Int64Ptr(delay), + MaxRetries: core.Int64Ptr(maxRetries), + Timeout: core.Int64Ptr(timeout), + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolHealthMonitorPrototype unmarshals an instance of LoadBalancerPoolHealthMonitorPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitorPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitorPrototype) + err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. +// Models which "extend" this model: +// - LoadBalancerPoolIdentityByID +// - LoadBalancerPoolIdentityByHref +type LoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerPoolIdentity) isaLoadBalancerPoolIdentity() bool { + return true +} + +type LoadBalancerPoolIdentityIntf interface { + isaLoadBalancerPoolIdentity() bool +} + +// UnmarshalLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerPoolIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentityByName : LoadBalancerPoolIdentityByName struct +type LoadBalancerPoolIdentityByName struct { + // The user-defined name for this load balancer pool. + Name *string `json:"name" validate:"required"` +} + +// NewLoadBalancerPoolIdentityByName : Instantiate LoadBalancerPoolIdentityByName (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityByName(name string) (_model *LoadBalancerPoolIdentityByName, err error) { + _model = &LoadBalancerPoolIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolIdentityByName unmarshals an instance of LoadBalancerPoolIdentityByName from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMember : LoadBalancerPoolMember struct +type LoadBalancerPoolMember struct { + // The date and time that this member was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // Health of the server member in the pool. + Health *string `json:"health" validate:"required"` + + // The member's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool member. + ID *string `json:"id" validate:"required"` + + // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a + // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive + // the traffic on the same port the listener received it on.) + // + // This port will also be used for health checks unless the `port` property of + // `health_monitor` property is specified. + Port *int64 `json:"port" validate:"required"` + + // The provisioning status of this member. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. + Target LoadBalancerPoolMemberTargetIntf `json:"target" validate:"required"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` +} + +// Constants associated with the LoadBalancerPoolMember.Health property. +// Health of the server member in the pool. +const ( + LoadBalancerPoolMemberHealthFaultedConst = "faulted" + LoadBalancerPoolMemberHealthOkConst = "ok" + LoadBalancerPoolMemberHealthUnknownConst = "unknown" +) + +// Constants associated with the LoadBalancerPoolMember.ProvisioningStatus property. +// The provisioning status of this member. +const ( + LoadBalancerPoolMemberProvisioningStatusActiveConst = "active" + LoadBalancerPoolMemberProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerPoolMemberProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerPoolMemberProvisioningStatusFailedConst = "failed" + LoadBalancerPoolMemberProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerPoolMemberProvisioningStatusUpdatePendingConst = "update_pending" +) + +// UnmarshalLoadBalancerPoolMember unmarshals an instance of LoadBalancerPoolMember from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMember(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMember) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health", &obj.Health) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTarget) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberCollection : LoadBalancerPoolMemberCollection struct +type LoadBalancerPoolMemberCollection struct { + // Collection of members. + Members []LoadBalancerPoolMember `json:"members" validate:"required"` +} + +// UnmarshalLoadBalancerPoolMemberCollection unmarshals an instance of LoadBalancerPoolMemberCollection from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberCollection) + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberPatch : LoadBalancerPoolMemberPatch struct +type LoadBalancerPoolMemberPatch struct { + // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a + // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive + // the traffic on the same port the listener received it on.) + // + // This port will also be used for health checks unless the `port` property of + // `health_monitor` property is specified. + // + // The port must be unique across all members for all pools associated with this pool's listener. + Port *int64 `json:"port,omitempty"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. + Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target,omitempty"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` +} + +// UnmarshalLoadBalancerPoolMemberPatch unmarshals an instance of LoadBalancerPoolMemberPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberPatch) + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// LoadBalancerPoolMemberPrototype : LoadBalancerPoolMemberPrototype struct +type LoadBalancerPoolMemberPrototype struct { + // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a + // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive + // the traffic on the same port the listener received it on.) + // + // This port will also be used for health checks unless the `port` property of + // `health_monitor` property is specified. + // + // The port must be unique across all members for all pools associated with this pool's listener. + Port *int64 `json:"port" validate:"required"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. + Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` +} + +// NewLoadBalancerPoolMemberPrototype : Instantiate LoadBalancerPoolMemberPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberPrototype(port int64, target LoadBalancerPoolMemberTargetPrototypeIntf) (_model *LoadBalancerPoolMemberPrototype, err error) { + _model = &LoadBalancerPoolMemberPrototype{ + Port: core.Int64Ptr(port), + Target: target, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolMemberPrototype unmarshals an instance of LoadBalancerPoolMemberPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberPrototype) + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberReference : LoadBalancerPoolMemberReference struct +type LoadBalancerPoolMemberReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerPoolMemberReferenceDeleted `json:"deleted,omitempty"` + + // The member's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool member. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalLoadBalancerPoolMemberReference unmarshals an instance of LoadBalancerPoolMemberReference from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolMemberReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerPoolMemberReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerPoolMemberReferenceDeleted unmarshals an instance of LoadBalancerPoolMemberReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTarget : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in +// the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a +// zone the load balancer has a subnet in. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetInstanceReference +// - LoadBalancerPoolMemberTargetIP +type LoadBalancerPoolMemberTarget struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The user-defined name for this virtual server instance (and default system hostname). + Name *string `json:"name,omitempty"` + + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` +} + +func (*LoadBalancerPoolMemberTarget) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +type LoadBalancerPoolMemberTargetIntf interface { + isaLoadBalancerPoolMemberTarget() bool +} + +// UnmarshalLoadBalancerPoolMemberTarget unmarshals an instance of LoadBalancerPoolMemberTarget from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTarget) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototype : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in +// the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a +// zone the load balancer has a subnet in. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +// - LoadBalancerPoolMemberTargetPrototypeIP +type LoadBalancerPoolMemberTargetPrototype struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` + + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` +} + +func (*LoadBalancerPoolMemberTargetPrototype) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +type LoadBalancerPoolMemberTargetPrototypeIntf interface { + isaLoadBalancerPoolMemberTargetPrototype() bool +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototype unmarshals an instance of LoadBalancerPoolMemberTargetPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolPatch : LoadBalancerPoolPatch struct +type LoadBalancerPoolPatch struct { + // The load balancing algorithm. + Algorithm *string `json:"algorithm,omitempty"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitorPatch `json:"health_monitor,omitempty"` + + // The user-defined name for this load balancer pool. + Name *string `json:"name,omitempty"` + + // The protocol for this load balancer pool. + // + // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http` and + // `https`. + // + // If this pool is associated with a load balancer listener, the specified protocol must match, or be compatible with + // the listener's protocol. At present, the compatible protocols are `http` and `https`. + Protocol *string `json:"protocol,omitempty"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol,omitempty"` + + // The session persistence of this pool. + SessionPersistence *LoadBalancerPoolSessionPersistencePatch `json:"session_persistence,omitempty"` +} + +// Constants associated with the LoadBalancerPoolPatch.Algorithm property. +// The load balancing algorithm. +const ( + LoadBalancerPoolPatchAlgorithmLeastConnectionsConst = "least_connections" + LoadBalancerPoolPatchAlgorithmRoundRobinConst = "round_robin" + LoadBalancerPoolPatchAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the LoadBalancerPoolPatch.Protocol property. +// The protocol for this load balancer pool. +// +// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http` and +// `https`. +// +// If this pool is associated with a load balancer listener, the specified protocol must match, or be compatible with +// the listener's protocol. At present, the compatible protocols are `http` and `https`. +const ( + LoadBalancerPoolPatchProtocolHTTPConst = "http" + LoadBalancerPoolPatchProtocolHTTPSConst = "https" + LoadBalancerPoolPatchProtocolTCPConst = "tcp" + LoadBalancerPoolPatchProtocolUDPConst = "udp" +) + +// Constants associated with the LoadBalancerPoolPatch.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + LoadBalancerPoolPatchProxyProtocolDisabledConst = "disabled" + LoadBalancerPoolPatchProxyProtocolV1Const = "v1" + LoadBalancerPoolPatchProxyProtocolV2Const = "v2" +) + +// UnmarshalLoadBalancerPoolPatch unmarshals an instance of LoadBalancerPoolPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolPatch) + err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// LoadBalancerPoolPrototype : LoadBalancerPoolPrototype struct +type LoadBalancerPoolPrototype struct { + // The load balancing algorithm. + Algorithm *string `json:"algorithm" validate:"required"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitorPrototype `json:"health_monitor" validate:"required"` + + // The members for this load balancer pool. For load balancers in the `network` family, the same `port` and `target` + // tuple cannot be shared by a pool member of any other load balancer in the same VPC. + Members []LoadBalancerPoolMemberPrototype `json:"members,omitempty"` + + // The user-defined name for this load balancer pool. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if + // `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http`, and `https`. + Protocol *string `json:"protocol" validate:"required"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol,omitempty"` + + // The session persistence of this pool. + SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` +} + +// Constants associated with the LoadBalancerPoolPrototype.Algorithm property. +// The load balancing algorithm. +const ( + LoadBalancerPoolPrototypeAlgorithmLeastConnectionsConst = "least_connections" + LoadBalancerPoolPrototypeAlgorithmRoundRobinConst = "round_robin" + LoadBalancerPoolPrototypeAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the LoadBalancerPoolPrototype.Protocol property. +// The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if +// `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http`, and `https`. +const ( + LoadBalancerPoolPrototypeProtocolHTTPConst = "http" + LoadBalancerPoolPrototypeProtocolHTTPSConst = "https" + LoadBalancerPoolPrototypeProtocolTCPConst = "tcp" + LoadBalancerPoolPrototypeProtocolUDPConst = "udp" +) + +// Constants associated with the LoadBalancerPoolPrototype.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + LoadBalancerPoolPrototypeProxyProtocolDisabledConst = "disabled" + LoadBalancerPoolPrototypeProxyProtocolV1Const = "v1" + LoadBalancerPoolPrototypeProxyProtocolV2Const = "v2" +) + +// NewLoadBalancerPoolPrototype : Instantiate LoadBalancerPoolPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolPrototype(algorithm string, healthMonitor *LoadBalancerPoolHealthMonitorPrototype, protocol string) (_model *LoadBalancerPoolPrototype, err error) { + _model = &LoadBalancerPoolPrototype{ + Algorithm: core.StringPtr(algorithm), + HealthMonitor: healthMonitor, + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolPrototype unmarshals an instance of LoadBalancerPoolPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolPrototype) + err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolReference : LoadBalancerPoolReference struct +type LoadBalancerPoolReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this load balancer pool. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalLoadBalancerPoolReference unmarshals an instance of LoadBalancerPoolReference from the specified map of raw messages. +func UnmarshalLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerPoolReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerPoolReferenceDeleted unmarshals an instance of LoadBalancerPoolReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerPoolReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolSessionPersistence : LoadBalancerPoolSessionPersistence struct +type LoadBalancerPoolSessionPersistence struct { + // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not + // allowed. + CookieName *string `json:"cookie_name,omitempty"` + + // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` + // protocols. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerPoolSessionPersistence.Type property. +// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` +// protocols. +const ( + LoadBalancerPoolSessionPersistenceTypeAppCookieConst = "app_cookie" + LoadBalancerPoolSessionPersistenceTypeHTTPCookieConst = "http_cookie" + LoadBalancerPoolSessionPersistenceTypeSourceIPConst = "source_ip" +) + +// UnmarshalLoadBalancerPoolSessionPersistence unmarshals an instance of LoadBalancerPoolSessionPersistence from the specified map of raw messages. +func UnmarshalLoadBalancerPoolSessionPersistence(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolSessionPersistence) + err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolSessionPersistencePatch : The session persistence configuration. Specify `null` to remove any existing session persistence configuration. +type LoadBalancerPoolSessionPersistencePatch struct { + // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not + // allowed. + CookieName *string `json:"cookie_name,omitempty"` + + // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` + // protocols. + Type *string `json:"type,omitempty"` +} + +// Constants associated with the LoadBalancerPoolSessionPersistencePatch.Type property. +// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` +// protocols. +const ( + LoadBalancerPoolSessionPersistencePatchTypeAppCookieConst = "app_cookie" + LoadBalancerPoolSessionPersistencePatchTypeHTTPCookieConst = "http_cookie" + LoadBalancerPoolSessionPersistencePatchTypeSourceIPConst = "source_ip" +) + +// UnmarshalLoadBalancerPoolSessionPersistencePatch unmarshals an instance of LoadBalancerPoolSessionPersistencePatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolSessionPersistencePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolSessionPersistencePatch) + err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolSessionPersistencePrototype : LoadBalancerPoolSessionPersistencePrototype struct +type LoadBalancerPoolSessionPersistencePrototype struct { + // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not + // allowed. + CookieName *string `json:"cookie_name,omitempty"` + + // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` + // protocols. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerPoolSessionPersistencePrototype.Type property. +// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` +// protocols. +const ( + LoadBalancerPoolSessionPersistencePrototypeTypeAppCookieConst = "app_cookie" + LoadBalancerPoolSessionPersistencePrototypeTypeHTTPCookieConst = "http_cookie" + LoadBalancerPoolSessionPersistencePrototypeTypeSourceIPConst = "source_ip" +) + +// NewLoadBalancerPoolSessionPersistencePrototype : Instantiate LoadBalancerPoolSessionPersistencePrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolSessionPersistencePrototype(typeVar string) (_model *LoadBalancerPoolSessionPersistencePrototype, err error) { + _model = &LoadBalancerPoolSessionPersistencePrototype{ + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolSessionPersistencePrototype unmarshals an instance of LoadBalancerPoolSessionPersistencePrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolSessionPersistencePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolSessionPersistencePrototype) + err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPrivateIpsItem : LoadBalancerPrivateIpsItem struct +type LoadBalancerPrivateIpsItem struct { + // The IP address. + // + // If the address has not yet been selected, the value will be `0.0.0.0`. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` + + // The user-defined or system-provided name for this reserved IP. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the LoadBalancerPrivateIpsItem.ResourceType property. +// The resource type. +const ( + LoadBalancerPrivateIpsItemResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" +) + +// UnmarshalLoadBalancerPrivateIpsItem unmarshals an instance of LoadBalancerPrivateIpsItem from the specified map of raw messages. +func UnmarshalLoadBalancerPrivateIpsItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPrivateIpsItem) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfile : LoadBalancerProfile struct +type LoadBalancerProfile struct { + // The product family this load balancer profile belongs to. + Family *string `json:"family" validate:"required"` + + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` + + // Indicates which logging type(s) are supported for a load balancer with this profile. + LoggingSupported *LoadBalancerProfileLoggingSupported `json:"logging_supported" validate:"required"` + + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` + + RouteModeSupported LoadBalancerProfileRouteModeSupportedIntf `json:"route_mode_supported" validate:"required"` + + SecurityGroupsSupported LoadBalancerProfileSecurityGroupsSupportedIntf `json:"security_groups_supported" validate:"required"` + + UDPSupported LoadBalancerProfileUDPSupportedIntf `json:"udp_supported" validate:"required"` +} + +// UnmarshalLoadBalancerProfile unmarshals an instance of LoadBalancerProfile from the specified map of raw messages. +func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfile) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "logging_supported", &obj.LoggingSupported, UnmarshalLoadBalancerProfileLoggingSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "route_mode_supported", &obj.RouteModeSupported, UnmarshalLoadBalancerProfileRouteModeSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups_supported", &obj.SecurityGroupsSupported, UnmarshalLoadBalancerProfileSecurityGroupsSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "udp_supported", &obj.UDPSupported, UnmarshalLoadBalancerProfileUDPSupported) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileCollection : LoadBalancerProfileCollection struct +type LoadBalancerProfileCollection struct { + // A link to the first page of resources. + First *LoadBalancerProfileCollectionFirst `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"` + + // Collection of load balancer profiles. + Profiles []LoadBalancerProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalLoadBalancerProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *LoadBalancerProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 +// - LoadBalancerProfileIdentityByHref +type LoadBalancerProfileIdentity struct { + // The globally unique name for this load balancer profile. + Name *string `json:"name,omitempty"` + + // The URL for this load balancer profile. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerProfileIdentity) isaLoadBalancerProfileIdentity() bool { + return true +} + +type LoadBalancerProfileIdentityIntf interface { + isaLoadBalancerProfileIdentity() bool +} + +// UnmarshalLoadBalancerProfileIdentity unmarshals an instance of LoadBalancerProfileIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileLoggingSupported : Indicates which logging type(s) are supported for a load balancer with this profile. +type LoadBalancerProfileLoggingSupported struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported logging type(s) for a load balancer with this profile. + Value []string `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileLoggingSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileLoggingSupportedTypeFixedConst = "fixed" +) + +// UnmarshalLoadBalancerProfileLoggingSupported unmarshals an instance of LoadBalancerProfileLoggingSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileLoggingSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileLoggingSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileReference : LoadBalancerProfileReference struct +type LoadBalancerProfileReference struct { + // The product family this load balancer profile belongs to. + Family *string `json:"family" validate:"required"` + + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalLoadBalancerProfileReference unmarshals an instance of LoadBalancerProfileReference from the specified map of raw messages. +func UnmarshalLoadBalancerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileReference) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileRouteModeSupported : LoadBalancerProfileRouteModeSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileRouteModeSupportedFixed +// - LoadBalancerProfileRouteModeSupportedDependent +type LoadBalancerProfileRouteModeSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileRouteModeSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileRouteModeSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileRouteModeSupported) isaLoadBalancerProfileRouteModeSupported() bool { + return true +} + +type LoadBalancerProfileRouteModeSupportedIntf interface { + isaLoadBalancerProfileRouteModeSupported() bool +} + +// UnmarshalLoadBalancerProfileRouteModeSupported unmarshals an instance of LoadBalancerProfileRouteModeSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileRouteModeSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileRouteModeSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileSecurityGroupsSupported : LoadBalancerProfileSecurityGroupsSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileSecurityGroupsSupportedFixed +// - LoadBalancerProfileSecurityGroupsSupportedDependent +type LoadBalancerProfileSecurityGroupsSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileSecurityGroupsSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileSecurityGroupsSupported) isaLoadBalancerProfileSecurityGroupsSupported() bool { + return true +} + +type LoadBalancerProfileSecurityGroupsSupportedIntf interface { + isaLoadBalancerProfileSecurityGroupsSupported() bool +} + +// UnmarshalLoadBalancerProfileSecurityGroupsSupported unmarshals an instance of LoadBalancerProfileSecurityGroupsSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileUDPSupported : LoadBalancerProfileUDPSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileUDPSupportedFixed +// - LoadBalancerProfileUDPSupportedDependent +type LoadBalancerProfileUDPSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileUDPSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileUDPSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileUDPSupported) isaLoadBalancerProfileUDPSupported() bool { + return true +} + +type LoadBalancerProfileUDPSupportedIntf interface { + isaLoadBalancerProfileUDPSupported() bool +} + +// UnmarshalLoadBalancerProfileUDPSupported unmarshals an instance of LoadBalancerProfileUDPSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileUDPSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileUDPSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerReferenceDeleted unmarshals an instance of LoadBalancerReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerStatistics : LoadBalancerStatistics struct +type LoadBalancerStatistics struct { + // Number of active connections of this load balancer. + ActiveConnections *int64 `json:"active_connections" validate:"required"` + + // Current connection rate (connections per second) of this load balancer. + ConnectionRate *float32 `json:"connection_rate" validate:"required"` + + // Total number of data processed (bytes) of this load balancer within current calendar month. + DataProcessedThisMonth *int64 `json:"data_processed_this_month" validate:"required"` + + // Current throughput (Mbps) of this load balancer. + Throughput *float32 `json:"throughput" validate:"required"` +} + +// UnmarshalLoadBalancerStatistics unmarshals an instance of LoadBalancerStatistics from the specified map of raw messages. +func UnmarshalLoadBalancerStatistics(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerStatistics) + err = core.UnmarshalPrimitive(m, "active_connections", &obj.ActiveConnections) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_rate", &obj.ConnectionRate) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "data_processed_this_month", &obj.DataProcessedThisMonth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "throughput", &obj.Throughput) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACL : NetworkACL struct +type NetworkACL struct { + // The date and time that the network ACL was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` + + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network ACL. + Name *string `json:"name" validate:"required"` + + // The resource group for this network ACL. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The ordered rules for this network ACL. If no rules exist, all traffic will be denied. + Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` + + // The subnets to which this network ACL is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The VPC this network ACL is a part of. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalNetworkACL unmarshals an instance of NetworkACL from the specified map of raw messages. +func UnmarshalNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACL) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLCollection : NetworkACLCollection struct +type NetworkACLCollection struct { + // A link to the first page of resources. + First *NetworkACLCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of network ACLs. + NetworkAcls []NetworkACL `json:"network_acls" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *NetworkACLCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acls", &obj.NetworkAcls, UnmarshalNetworkACL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *NetworkACLCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 +// - NetworkACLIdentityByCRN +// - NetworkACLIdentityByHref +type NetworkACLIdentity struct { + // The unique identifier for this network ACL. + ID *string `json:"id,omitempty"` + + // The CRN for this network ACL. + CRN *string `json:"crn,omitempty"` + + // The URL for this network ACL. + Href *string `json:"href,omitempty"` +} + +func (*NetworkACLIdentity) isaNetworkACLIdentity() bool { + return true +} + +type NetworkACLIdentityIntf interface { + isaNetworkACLIdentity() bool +} + +// UnmarshalNetworkACLIdentity unmarshals an instance of NetworkACLIdentity from the specified map of raw messages. +func UnmarshalNetworkACLIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLPatch : NetworkACLPatch struct +type NetworkACLPatch struct { + // The user-defined name for this network ACL. Names must be unique within the VPC the network ACL resides in. + Name *string `json:"name,omitempty"` +} + +// UnmarshalNetworkACLPatch unmarshals an instance of NetworkACLPatch from the specified map of raw messages. +func UnmarshalNetworkACLPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// NetworkACLPrototype : NetworkACLPrototype struct +// Models which "extend" this model: +// - NetworkACLPrototypeNetworkACLByRules +// - NetworkACLPrototypeNetworkACLBySourceNetworkACL +type NetworkACLPrototype struct { + // The user-defined name for this network ACL. Names must be unique within the VPC the network ACL resides in. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The VPC this network ACL is to be a part of. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, + // resulting in all traffic being denied. + Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` + + // Network ACL to copy rules from. + SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl,omitempty"` +} + +func (*NetworkACLPrototype) isaNetworkACLPrototype() bool { + return true +} + +type NetworkACLPrototypeIntf interface { + isaNetworkACLPrototype() bool +} + +// UnmarshalNetworkACLPrototype unmarshals an instance of NetworkACLPrototype from the specified map of raw messages. +func UnmarshalNetworkACLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLReference : NetworkACLReference struct +type NetworkACLReference struct { + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkACLReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network ACL. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalNetworkACLReference unmarshals an instance of NetworkACLReference from the specified map of raw messages. +func UnmarshalNetworkACLReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkACLReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkACLReferenceDeleted unmarshals an instance of NetworkACLReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkACLReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRule : NetworkACLRule struct +// Models which "extend" this model: +// - NetworkACLRuleNetworkACLRuleProtocolTcpudp +// - NetworkACLRuleNetworkACLRuleProtocolIcmp +// - NetworkACLRuleNetworkACLRuleProtocolAll +type NetworkACLRule struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this network ACL rule. + Name *string `json:"name" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRule.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleActionAllowConst = "allow" + NetworkACLRuleActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRule.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleDirectionInboundConst = "inbound" + NetworkACLRuleDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRule.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRule.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleProtocolAllConst = "all" + NetworkACLRuleProtocolIcmpConst = "icmp" + NetworkACLRuleProtocolTCPConst = "tcp" + NetworkACLRuleProtocolUDPConst = "udp" +) + +func (*NetworkACLRule) isaNetworkACLRule() bool { + return true +} + +type NetworkACLRuleIntf interface { + isaNetworkACLRule() bool +} + +// UnmarshalNetworkACLRule unmarshals an instance of NetworkACLRule from the specified map of raw messages. +func UnmarshalNetworkACLRule(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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRuleBeforePatch : The rule to move this rule immediately before. +// +// Specify `null` to move this rule after all existing rules. +// Models which "extend" this model: +// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID +// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref +type NetworkACLRuleBeforePatch struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id,omitempty"` + + // The URL for this network ACL rule. + Href *string `json:"href,omitempty"` +} + +func (*NetworkACLRuleBeforePatch) isaNetworkACLRuleBeforePatch() bool { + return true +} + +type NetworkACLRuleBeforePatchIntf interface { + isaNetworkACLRuleBeforePatch() bool +} + +// UnmarshalNetworkACLRuleBeforePatch unmarshals an instance of NetworkACLRuleBeforePatch from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePrototype : The rule to insert this rule immediately before. +// +// If unspecified, this rule will be inserted after all existing rules. +// Models which "extend" this model: +// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID +// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref +type NetworkACLRuleBeforePrototype struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id,omitempty"` + + // The URL for this network ACL rule. + Href *string `json:"href,omitempty"` +} + +func (*NetworkACLRuleBeforePrototype) isaNetworkACLRuleBeforePrototype() bool { + return true +} + +type NetworkACLRuleBeforePrototypeIntf interface { + isaNetworkACLRuleBeforePrototype() bool +} + +// UnmarshalNetworkACLRuleBeforePrototype unmarshals an instance of NetworkACLRuleBeforePrototype from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleCollection : NetworkACLRuleCollection struct +type NetworkACLRuleCollection struct { + // A link to the first page of resources. + First *NetworkACLRuleCollectionFirst `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"` + + // Ordered collection of network ACL rules. + Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLRuleCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *NetworkACLRuleCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItem : NetworkACLRuleItem struct +// Models which "extend" this model: +// - NetworkACLRuleItemNetworkACLRuleProtocolTcpudp +// - NetworkACLRuleItemNetworkACLRuleProtocolIcmp +// - NetworkACLRuleItemNetworkACLRuleProtocolAll +type NetworkACLRuleItem struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always + // refers to the next item in the collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this network ACL rule. + Name *string `json:"name" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRuleItem.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemActionAllowConst = "allow" + NetworkACLRuleItemActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItem.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemDirectionInboundConst = "inbound" + NetworkACLRuleItemDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItem.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItem.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemProtocolAllConst = "all" + NetworkACLRuleItemProtocolIcmpConst = "icmp" + NetworkACLRuleItemProtocolTCPConst = "tcp" + NetworkACLRuleItemProtocolUDPConst = "udp" +) + +func (*NetworkACLRuleItem) isaNetworkACLRuleItem() bool { + return true +} + +type NetworkACLRuleItemIntf interface { + isaNetworkACLRuleItem() bool +} + +// UnmarshalNetworkACLRuleItem unmarshals an instance of NetworkACLRuleItem from the specified map of raw messages. +func UnmarshalNetworkACLRuleItem(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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRulePatch : NetworkACLRulePatch struct +type NetworkACLRulePatch struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action,omitempty"` + + // The rule to move this rule immediately before. + // + // Specify `null` to move this rule after all existing rules. + Before NetworkACLRuleBeforePatchIntf `json:"before,omitempty"` + + // The ICMP traffic code to match. + Code *int64 `json:"code,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination,omitempty"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The direction of traffic to match. + Direction *string `json:"direction,omitempty"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. + Name *string `json:"name,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic type to match. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePatch.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePatchActionAllowConst = "allow" + NetworkACLRulePatchActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePatch.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePatchDirectionInboundConst = "inbound" + NetworkACLRulePatchDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePatch.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePatchProtocolAllConst = "all" + NetworkACLRulePatchProtocolIcmpConst = "icmp" + NetworkACLRulePatchProtocolTCPConst = "tcp" + NetworkACLRulePatchProtocolUDPConst = "udp" +) + +// UnmarshalNetworkACLRulePatch unmarshals an instance of NetworkACLRulePatch from the specified map of raw messages. +func UnmarshalNetworkACLRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePatch) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// NetworkACLRulePrototype : NetworkACLRulePrototype struct +// Models which "extend" this model: +// - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype +// - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype +// - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype +type NetworkACLRulePrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule to insert this rule immediately before. + // + // If unspecified, this rule will be inserted after all existing rules. + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeProtocolAllConst = "all" + NetworkACLRulePrototypeProtocolIcmpConst = "icmp" + NetworkACLRulePrototypeProtocolTCPConst = "tcp" + NetworkACLRulePrototypeProtocolUDPConst = "udp" +) + +func (*NetworkACLRulePrototype) isaNetworkACLRulePrototype() bool { + return true +} + +type NetworkACLRulePrototypeIntf interface { + isaNetworkACLRulePrototype() bool +} + +// UnmarshalNetworkACLRulePrototype unmarshals an instance of NetworkACLRulePrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototype(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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRulePrototypeNetworkACLContext : NetworkACLRulePrototypeNetworkACLContext struct +// Models which "extend" this model: +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype +type NetworkACLRulePrototypeNetworkACLContext struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextProtocolAllConst = "all" + NetworkACLRulePrototypeNetworkACLContextProtocolIcmpConst = "icmp" + NetworkACLRulePrototypeNetworkACLContextProtocolTCPConst = "tcp" + NetworkACLRulePrototypeNetworkACLContextProtocolUDPConst = "udp" +) + +func (*NetworkACLRulePrototypeNetworkACLContext) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +type NetworkACLRulePrototypeNetworkACLContextIntf interface { + isaNetworkACLRulePrototypeNetworkACLContext() bool +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContext unmarshals an instance of NetworkACLRulePrototypeNetworkACLContext from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContext(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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRuleReference : NetworkACLRuleReference struct +type NetworkACLRuleReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkACLRuleReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network ACL rule. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalNetworkACLRuleReference unmarshals an instance of NetworkACLRuleReference from the specified map of raw messages. +func UnmarshalNetworkACLRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLRuleReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkACLRuleReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkACLRuleReferenceDeleted unmarshals an instance of NetworkACLRuleReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterface : NetworkInterface struct +type NetworkInterface 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" validate:"required"` + + // The date and time that the network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The floating IPs associated with this network interface. + FloatingIps []FloatingIPReference `json:"floating_ips,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The network interface port speed in Mbps. + 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 network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the network interface. + Status *string `json:"status" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The type of this network interface as it relates to an instance. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the NetworkInterface.ResourceType property. +// The resource type. +const ( + NetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the NetworkInterface.Status property. +// The status of the network interface. +const ( + NetworkInterfaceStatusAvailableConst = "available" + NetworkInterfaceStatusDeletingConst = "deleting" + NetworkInterfaceStatusFailedConst = "failed" + NetworkInterfaceStatusPendingConst = "pending" +) + +// Constants associated with the NetworkInterface.Type property. +// The type of this network interface as it relates to an instance. +const ( + NetworkInterfaceTypePrimaryConst = "primary" + NetworkInterfaceTypeSecondaryConst = "secondary" +) + +// UnmarshalNetworkInterface unmarshals an instance of NetworkInterface from the specified map of raw messages. +func UnmarshalNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceBareMetalServerContextReference : NetworkInterfaceBareMetalServerContextReference struct +type NetworkInterfaceBareMetalServerContextReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceBareMetalServerContextReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the NetworkInterfaceBareMetalServerContextReference.ResourceType property. +// The resource type. +const ( + NetworkInterfaceBareMetalServerContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// UnmarshalNetworkInterfaceBareMetalServerContextReference unmarshals an instance of NetworkInterfaceBareMetalServerContextReference from the specified map of raw messages. +func UnmarshalNetworkInterfaceBareMetalServerContextReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceBareMetalServerContextReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceBareMetalServerContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceBareMetalServerContextReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted unmarshals an instance of NetworkInterfaceBareMetalServerContextReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceBareMetalServerContextReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototype : NetworkInterfaceIPPrototype struct +// Models which "extend" this model: +// - NetworkInterfaceIPPrototypeReservedIPIdentity +// - NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext +type NetworkInterfaceIPPrototype struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` + + // 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The user-defined name for this reserved IP. If unspecified, the name will be a hyphenated list of randomly-selected + // words. Names must be unique within the subnet the reserved IP resides in. Names beginning with `ibm-` are reserved + // for provider-owned resources. + Name *string `json:"name,omitempty"` +} + +func (*NetworkInterfaceIPPrototype) isaNetworkInterfaceIPPrototype() bool { + return true +} + +type NetworkInterfaceIPPrototypeIntf interface { + isaNetworkInterfaceIPPrototype() bool +} + +// UnmarshalNetworkInterfaceIPPrototype unmarshals an instance of NetworkInterfaceIPPrototype from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceInstanceContextReference : NetworkInterfaceInstanceContextReference struct +type NetworkInterfaceInstanceContextReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceInstanceContextReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the NetworkInterfaceInstanceContextReference.ResourceType property. +// The resource type. +const ( + NetworkInterfaceInstanceContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// UnmarshalNetworkInterfaceInstanceContextReference unmarshals an instance of NetworkInterfaceInstanceContextReference from the specified map of raw messages. +func UnmarshalNetworkInterfaceInstanceContextReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceInstanceContextReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceInstanceContextReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceInstanceContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceInstanceContextReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceInstanceContextReferenceDeleted unmarshals an instance of NetworkInterfaceInstanceContextReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceInstanceContextReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfacePatch : NetworkInterfacePatch struct +type NetworkInterfacePatch 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"` + + // The user-defined name for network interface. Names must be unique within the instance the network interface resides + // in. + Name *string `json:"name,omitempty"` +} + +// UnmarshalNetworkInterfacePatch unmarshals an instance of NetworkInterfacePatch from the specified map of raw messages. +func UnmarshalNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// NetworkInterfacePrototype : NetworkInterfacePrototype struct +type NetworkInterfacePrototype 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"` + + // The user-defined name for network interface. Names must be unique within the instance the network interface resides + // in. 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 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 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 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"` +} + +// NewNetworkInterfacePrototype : Instantiate NetworkInterfacePrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *NetworkInterfacePrototype, err error) { + _model = &NetworkInterfacePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalNetworkInterfacePrototype unmarshals an instance of NetworkInterfacePrototype from the specified map of raw messages. +func UnmarshalNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceReferenceDeleted unmarshals an instance of NetworkInterfaceReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceReferenceTargetContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of NetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceUnpaginatedCollection : NetworkInterfaceUnpaginatedCollection struct +type NetworkInterfaceUnpaginatedCollection struct { + // Collection of network interfaces. + NetworkInterfaces []NetworkInterface `json:"network_interfaces" validate:"required"` +} + +// UnmarshalNetworkInterfaceUnpaginatedCollection unmarshals an instance of NetworkInterfaceUnpaginatedCollection from the specified map of raw messages. +func UnmarshalNetworkInterfaceUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceUnpaginatedCollection) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterface) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystem : OperatingSystem struct +type OperatingSystem struct { + // The operating system architecture. + Architecture *string `json:"architecture" validate:"required"` + + // Images with this operating system can only be used on dedicated hosts or dedicated host groups. + DedicatedHostOnly *bool `json:"dedicated_host_only" validate:"required"` + + // A unique, display-friendly name for the operating system. + DisplayName *string `json:"display_name" validate:"required"` + + // The software family for this operating system. + Family *string `json:"family" validate:"required"` + + // The URL for this operating system. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this operating system. + Name *string `json:"name" validate:"required"` + + // The vendor of the operating system. + Vendor *string `json:"vendor" validate:"required"` + + // The major release version of this operating system. + Version *string `json:"version" validate:"required"` +} + +// UnmarshalOperatingSystem unmarshals an instance of OperatingSystem from the specified map of raw messages. +func UnmarshalOperatingSystem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystem) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dedicated_host_only", &obj.DedicatedHostOnly) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vendor", &obj.Vendor) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemCollection : OperatingSystemCollection struct +type OperatingSystemCollection struct { + // A link to the first page of resources. + First *OperatingSystemCollectionFirst `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"` + + // Collection of operating systems. + OperatingSystems []OperatingSystem `json:"operating_systems" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalOperatingSystemCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_systems", &obj.OperatingSystems, UnmarshalOperatingSystem) + if err != nil { + 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 *OperatingSystemCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 +// - OperatingSystemIdentityByHref +type OperatingSystemIdentity struct { + // The globally unique name for this operating system. + Name *string `json:"name,omitempty"` + + // The URL for this operating system. + Href *string `json:"href,omitempty"` +} + +func (*OperatingSystemIdentity) isaOperatingSystemIdentity() bool { + return true +} + +type OperatingSystemIdentityIntf interface { + isaOperatingSystemIdentity() bool +} + +// UnmarshalOperatingSystemIdentity unmarshals an instance of OperatingSystemIdentity from the specified map of raw messages. +func UnmarshalOperatingSystemIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemReference : OperatingSystemReference struct +type OperatingSystemReference struct { + // The URL for this operating system. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this operating system. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalOperatingSystemReference unmarshals an instance of OperatingSystemReference from the specified map of raw messages. +func UnmarshalOperatingSystemReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PlacementGroup : PlacementGroup struct +type PlacementGroup struct { + // The date and time that the placement group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this placement group. + CRN *string `json:"crn" validate:"required"` + + // The URL for this placement group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this placement group. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the placement group. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The user-defined name for this placement group. + Name *string `json:"name" validate:"required"` + + // The resource group for this placement group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The strategy for this placement group + // - `host_spread`: place on different compute hosts + // - `power_spread`: place on compute hosts that use different power sources + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the + // unexpected strategy was encountered. + Strategy *string `json:"strategy" validate:"required"` +} + +// Constants associated with the PlacementGroup.LifecycleState property. +// The lifecycle state of the placement group. +const ( + PlacementGroupLifecycleStateDeletingConst = "deleting" + PlacementGroupLifecycleStateFailedConst = "failed" + PlacementGroupLifecycleStatePendingConst = "pending" + PlacementGroupLifecycleStateStableConst = "stable" + PlacementGroupLifecycleStateSuspendedConst = "suspended" + PlacementGroupLifecycleStateUpdatingConst = "updating" + PlacementGroupLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the PlacementGroup.ResourceType property. +// The resource type. +const ( + PlacementGroupResourceTypePlacementGroupConst = "placement_group" +) + +// Constants associated with the PlacementGroup.Strategy property. +// The strategy for this placement group +// - `host_spread`: place on different compute hosts +// - `power_spread`: place on compute hosts that use different power sources +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the +// unexpected strategy was encountered. +const ( + PlacementGroupStrategyHostSpreadConst = "host_spread" + PlacementGroupStrategyPowerSpreadConst = "power_spread" +) + +// UnmarshalPlacementGroup unmarshals an instance of PlacementGroup from the specified map of raw messages. +func UnmarshalPlacementGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroup) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "strategy", &obj.Strategy) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PlacementGroupCollection : PlacementGroupCollection struct +type PlacementGroupCollection struct { + // A link to the first page of resources. + First *PlacementGroupCollectionFirst `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"` + + // Collection of placement groups. + PlacementGroups []PlacementGroup `json:"placement_groups" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPlacementGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_groups", &obj.PlacementGroups, UnmarshalPlacementGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *PlacementGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PlacementGroupPatch : PlacementGroupPatch struct +type PlacementGroupPatch struct { + // The user-defined name for this placement group. + Name *string `json:"name,omitempty"` +} + +// UnmarshalPlacementGroupPatch unmarshals an instance of PlacementGroupPatch from the specified map of raw messages. +func UnmarshalPlacementGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroupPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// PlacementGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type PlacementGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalPlacementGroupReferenceDeleted unmarshals an instance of PlacementGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalPlacementGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGateway : PublicGateway struct +type PublicGateway struct { + // The date and time that the public gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` + + // The floating IP bound to this public gateway. + FloatingIP *PublicGatewayFloatingIP `json:"floating_ip" validate:"required"` + + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this public gateway. + Name *string `json:"name" validate:"required"` + + // The resource group for this public gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the volume. + Status *string `json:"status" validate:"required"` + + // The VPC this public gateway serves. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this public gateway resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the PublicGateway.ResourceType property. +// The resource type. +const ( + PublicGatewayResourceTypePublicGatewayConst = "public_gateway" +) + +// Constants associated with the PublicGateway.Status property. +// The status of the volume. +const ( + PublicGatewayStatusAvailableConst = "available" + PublicGatewayStatusDeletingConst = "deleting" + PublicGatewayStatusFailedConst = "failed" + PublicGatewayStatusPendingConst = "pending" +) + +// UnmarshalPublicGateway unmarshals an instance of PublicGateway from the specified map of raw messages. +func UnmarshalPublicGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGateway) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ip", &obj.FloatingIP, UnmarshalPublicGatewayFloatingIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayCollection : PublicGatewayCollection struct +type PublicGatewayCollection struct { + // A link to the first page of resources. + First *PublicGatewayCollectionFirst `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"` + + // Collection of public gateways. + PublicGateways []PublicGateway `json:"public_gateways" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPublicGatewayCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateways", &obj.PublicGateways, UnmarshalPublicGateway) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *PublicGatewayCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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. + Address *string `json:"address" validate:"required"` + + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this floating IP. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalPublicGatewayFloatingIP unmarshals an instance of PublicGatewayFloatingIP from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototype : PublicGatewayFloatingIPPrototype struct +// Models which "extend" this model: +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentity +// - PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext +type PublicGatewayFloatingIPPrototype struct { + // The unique identifier for this floating IP. + ID *string `json:"id,omitempty"` + + // The CRN for this floating IP. + CRN *string `json:"crn,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href,omitempty"` + + // The globally unique IP address. + Address *string `json:"address,omitempty"` + + // The unique user-defined name for this floating IP. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` +} + +func (*PublicGatewayFloatingIPPrototype) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +type PublicGatewayFloatingIPPrototypeIntf interface { + isaPublicGatewayFloatingIPPrototype() bool +} + +// UnmarshalPublicGatewayFloatingIPPrototype unmarshals an instance of PublicGatewayFloatingIPPrototype from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentity : Identifies a public gateway by a unique property. +// Models which "extend" this model: +// - PublicGatewayIdentityPublicGatewayIdentityByID +// - PublicGatewayIdentityPublicGatewayIdentityByCRN +// - PublicGatewayIdentityPublicGatewayIdentityByHref +type PublicGatewayIdentity struct { + // The unique identifier for this public gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this public gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href,omitempty"` +} + +func (*PublicGatewayIdentity) isaPublicGatewayIdentity() bool { + return true +} + +type PublicGatewayIdentityIntf interface { + isaPublicGatewayIdentity() bool +} + +// UnmarshalPublicGatewayIdentity unmarshals an instance of PublicGatewayIdentity from the specified map of raw messages. +func UnmarshalPublicGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayPatch : PublicGatewayPatch struct +type PublicGatewayPatch struct { + // The user-defined name for this public gateway. Names must be unique within the VPC the public gateway resides in. + Name *string `json:"name,omitempty"` +} + +// UnmarshalPublicGatewayPatch unmarshals an instance of PublicGatewayPatch from the specified map of raw messages. +func UnmarshalPublicGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// PublicGatewayReference : PublicGatewayReference struct +type PublicGatewayReference struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this public gateway. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the PublicGatewayReference.ResourceType property. +// The resource type. +const ( + PublicGatewayReferenceResourceTypePublicGatewayConst = "public_gateway" +) + +// UnmarshalPublicGatewayReference unmarshals an instance of PublicGatewayReference from the specified map of raw messages. +func UnmarshalPublicGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPublicGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type PublicGatewayReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalPublicGatewayReferenceDeleted unmarshals an instance of PublicGatewayReferenceDeleted from the specified map of raw messages. +func UnmarshalPublicGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Region : Region struct +type Region struct { + // The API endpoint for this region. + Endpoint *string `json:"endpoint" validate:"required"` + + // The URL for this region. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this region. + Name *string `json:"name" validate:"required"` + + // The availability status of this region. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the Region.Status property. +// The availability status of this region. +const ( + RegionStatusAvailableConst = "available" + RegionStatusUnavailableConst = "unavailable" +) + +// UnmarshalRegion unmarshals an instance of Region from the specified map of raw messages. +func UnmarshalRegion(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Region) + err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionCollection : RegionCollection struct +type RegionCollection struct { + // Collection of regions. + Regions []Region `json:"regions" validate:"required"` +} + +// UnmarshalRegionCollection unmarshals an instance of RegionCollection from the specified map of raw messages. +func UnmarshalRegionCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionCollection) + err = core.UnmarshalModel(m, "regions", &obj.Regions, UnmarshalRegion) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionReference : RegionReference struct +type RegionReference struct { + // The URL for this region. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalRegionReference unmarshals an instance of RegionReference from the specified map of raw messages. +func UnmarshalRegionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RemoveBareMetalServerNetworkInterfaceFloatingIPOptions : The RemoveBareMetalServerNetworkInterfaceFloatingIP options. +type RemoveBareMetalServerNetworkInterfaceFloatingIPOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The 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 +} + +// NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate RemoveBareMetalServerNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + return &RemoveBareMetalServerNetworkInterfaceFloatingIPOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// RemoveEndpointGatewayIPOptions : The RemoveEndpointGatewayIP options. +type RemoveEndpointGatewayIPOptions 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 +} + +// NewRemoveEndpointGatewayIPOptions : Instantiate RemoveEndpointGatewayIPOptions +func (*VpcV1) NewRemoveEndpointGatewayIPOptions(endpointGatewayID string, id string) *RemoveEndpointGatewayIPOptions { + return &RemoveEndpointGatewayIPOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + ID: core.StringPtr(id), + } +} + +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (_options *RemoveEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *RemoveEndpointGatewayIPOptions { + _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveEndpointGatewayIPOptions) SetID(id string) *RemoveEndpointGatewayIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveEndpointGatewayIPOptions) SetHeaders(param map[string]string) *RemoveEndpointGatewayIPOptions { + options.Headers = param + return options +} + +// RemoveInstanceNetworkInterfaceFloatingIPOptions : The RemoveInstanceNetworkInterfaceFloatingIP options. +type RemoveInstanceNetworkInterfaceFloatingIPOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The 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 +} + +// NewRemoveInstanceNetworkInterfaceFloatingIPOptions : Instantiate RemoveInstanceNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewRemoveInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + return &RemoveInstanceNetworkInterfaceFloatingIPOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// RemoveVPNGatewayConnectionLocalCIDROptions : The RemoveVPNGatewayConnectionLocalCIDR options. +type RemoveVPNGatewayConnectionLocalCIDROptions 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 address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRemoveVPNGatewayConnectionLocalCIDROptions : Instantiate RemoveVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewRemoveVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *RemoveVPNGatewayConnectionLocalCIDROptions { + return &RemoveVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionLocalCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionLocalCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *RemoveVPNGatewayConnectionLocalCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *RemoveVPNGatewayConnectionLocalCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionLocalCIDROptions { + options.Headers = param + return options +} + +// RemoveVPNGatewayConnectionPeerCIDROptions : The RemoveVPNGatewayConnectionPeerCIDR options. +type RemoveVPNGatewayConnectionPeerCIDROptions 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 address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRemoveVPNGatewayConnectionPeerCIDROptions : Instantiate RemoveVPNGatewayConnectionPeerCIDROptions +func (*VpcV1) NewRemoveVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *RemoveVPNGatewayConnectionPeerCIDROptions { + return &RemoveVPNGatewayConnectionPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionPeerCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionPeerCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *RemoveVPNGatewayConnectionPeerCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *RemoveVPNGatewayConnectionPeerCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionPeerCIDROptions { + options.Headers = param + return options +} + +// ReplaceLoadBalancerPoolMembersOptions : The ReplaceLoadBalancerPoolMembers options. +type ReplaceLoadBalancerPoolMembersOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The member prototype objects for this pool. + Members []LoadBalancerPoolMemberPrototype `json:"members" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceLoadBalancerPoolMembersOptions : Instantiate ReplaceLoadBalancerPoolMembersOptions +func (*VpcV1) NewReplaceLoadBalancerPoolMembersOptions(loadBalancerID string, poolID string, members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { + return &ReplaceLoadBalancerPoolMembersOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + Members: members, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ReplaceLoadBalancerPoolMembersOptions) SetLoadBalancerID(loadBalancerID string) *ReplaceLoadBalancerPoolMembersOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *ReplaceLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *ReplaceLoadBalancerPoolMembersOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetMembers : Allow user to set Members +func (_options *ReplaceLoadBalancerPoolMembersOptions) SetMembers(members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { + _options.Members = members + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ReplaceLoadBalancerPoolMembersOptions { + options.Headers = param + return options +} + +// ReplaceSubnetNetworkACLOptions : The ReplaceSubnetNetworkACL options. +type ReplaceSubnetNetworkACLOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The network ACL identity. + NetworkACLIdentity NetworkACLIdentityIntf `json:"NetworkACLIdentity" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceSubnetNetworkACLOptions : Instantiate ReplaceSubnetNetworkACLOptions +func (*VpcV1) NewReplaceSubnetNetworkACLOptions(id string, networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { + return &ReplaceSubnetNetworkACLOptions{ + ID: core.StringPtr(id), + NetworkACLIdentity: networkACLIdentity, + } +} + +// SetID : Allow user to set ID +func (_options *ReplaceSubnetNetworkACLOptions) SetID(id string) *ReplaceSubnetNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetNetworkACLIdentity : Allow user to set NetworkACLIdentity +func (_options *ReplaceSubnetNetworkACLOptions) SetNetworkACLIdentity(networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { + _options.NetworkACLIdentity = networkACLIdentity + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceSubnetNetworkACLOptions) SetHeaders(param map[string]string) *ReplaceSubnetNetworkACLOptions { + options.Headers = param + return options +} + +// ReplaceSubnetRoutingTableOptions : The ReplaceSubnetRoutingTable options. +type ReplaceSubnetRoutingTableOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The routing table identity. + RoutingTableIdentity RoutingTableIdentityIntf `json:"RoutingTableIdentity" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceSubnetRoutingTableOptions : Instantiate ReplaceSubnetRoutingTableOptions +func (*VpcV1) NewReplaceSubnetRoutingTableOptions(id string, routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { + return &ReplaceSubnetRoutingTableOptions{ + ID: core.StringPtr(id), + RoutingTableIdentity: routingTableIdentity, + } +} + +// SetID : Allow user to set ID +func (_options *ReplaceSubnetRoutingTableOptions) SetID(id string) *ReplaceSubnetRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRoutingTableIdentity : Allow user to set RoutingTableIdentity +func (_options *ReplaceSubnetRoutingTableOptions) SetRoutingTableIdentity(routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { + _options.RoutingTableIdentity = routingTableIdentity + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceSubnetRoutingTableOptions) SetHeaders(param map[string]string) *ReplaceSubnetRoutingTableOptions { + options.Headers = param + return options +} + +// ReservedIP : ReservedIP struct +type ReservedIP struct { + // The IP address. + // + // If the address has not yet been selected, the value will be `0.0.0.0`. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // The date and time that the reserved IP was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the reserved IP. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The user-defined or system-provided name for this reserved IP. + Name *string `json:"name" validate:"required"` + + // The owner of the reserved IP. + Owner *string `json:"owner" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The target of this reserved IP. + // + // If absent, this reserved IP is provider-owned or unbound. + Target ReservedIPTargetIntf `json:"target,omitempty"` +} + +// Constants associated with the ReservedIP.LifecycleState property. +// The lifecycle state of the reserved IP. +const ( + ReservedIPLifecycleStateDeletingConst = "deleting" + ReservedIPLifecycleStateFailedConst = "failed" + ReservedIPLifecycleStatePendingConst = "pending" + ReservedIPLifecycleStateStableConst = "stable" + ReservedIPLifecycleStateSuspendedConst = "suspended" + ReservedIPLifecycleStateUpdatingConst = "updating" + ReservedIPLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the ReservedIP.Owner property. +// The owner of the reserved IP. +const ( + ReservedIPOwnerProviderConst = "provider" + ReservedIPOwnerUserConst = "user" +) + +// Constants associated with the ReservedIP.ResourceType property. +// The resource type. +const ( + ReservedIPResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" +) + +// UnmarshalReservedIP unmarshals an instance of ReservedIP from the specified map of raw messages. +func UnmarshalReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "owner", &obj.Owner) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalReservedIPTarget) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollection : ReservedIPCollection struct +type ReservedIPCollection struct { + // A link to the first page of resources. + First *ReservedIPCollectionFirst `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"` + + // Collection of reserved IPs in this subnet. + ReservedIps []ReservedIP `json:"reserved_ips" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reserved_ips", &obj.ReservedIps, UnmarshalReservedIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ReservedIPCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// ReservedIPCollectionEndpointGatewayContext : ReservedIPCollectionEndpointGatewayContext struct +type ReservedIPCollectionEndpointGatewayContext struct { + // A link to the first page of resources. + First *ReservedIPCollectionEndpointGatewayContextFirst `json:"first" validate:"required"` + + // Collection of reserved IPs bound to an endpoint gateway. + Ips []ReservedIP `json:"ips" 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 *ReservedIPCollectionEndpointGatewayContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionEndpointGatewayContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ReservedIPCollectionEndpointGatewayContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionNetworkInterfaceContext : ReservedIPCollectionNetworkInterfaceContext struct +type ReservedIPCollectionNetworkInterfaceContext struct { + // A link to the first page of resources. + First *ReservedIPCollectionNetworkInterfaceContextFirst `json:"first" validate:"required"` + + // Collection of reserved IPs bound to a network interface. + Ips []ReservedIP `json:"ips" 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 *ReservedIPCollectionNetworkInterfaceContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalReservedIPCollectionNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalReservedIPCollectionNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionNetworkInterfaceContext) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionNetworkInterfaceContextFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionNetworkInterfaceContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ReservedIPCollectionNetworkInterfaceContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// ReservedIPCollectionNetworkInterfaceContextFirst : A link to the first page of resources. +type ReservedIPCollectionNetworkInterfaceContextFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionNetworkInterfaceContextFirst unmarshals an instance of ReservedIPCollectionNetworkInterfaceContextFirst from the specified map of raw messages. +func UnmarshalReservedIPCollectionNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionNetworkInterfaceContextFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. +type ReservedIPCollectionNetworkInterfaceContextNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionNetworkInterfaceContextNext unmarshals an instance of ReservedIPCollectionNetworkInterfaceContextNext from the specified map of raw messages. +func UnmarshalReservedIPCollectionNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionNetworkInterfaceContextNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + 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 { + 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 + // `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The user-defined name for this reserved IP. Names must be unique within the subnet the reserved IP resides in. Names + // beginning with `ibm-` are reserved for provider-owned resources. + Name *string `json:"name,omitempty"` +} + +// UnmarshalReservedIPPatch unmarshals an instance of ReservedIPPatch from the specified map of raw messages. +func UnmarshalReservedIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPPatch) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// ReservedIPReference : ReservedIPReference struct +type ReservedIPReference struct { + // The IP address. + // + // If the address has not yet been selected, the value will be `0.0.0.0`. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` + + // The user-defined or system-provided name for this reserved IP. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPReference.ResourceType property. +// The resource type. +const ( + ReservedIPReferenceResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" +) + +// UnmarshalReservedIPReference unmarshals an instance of ReservedIPReference from the specified map of raw messages. +func UnmarshalReservedIPReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPReference) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type ReservedIPReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalReservedIPReferenceDeleted unmarshals an instance of ReservedIPReferenceDeleted from the specified map of raw messages. +func UnmarshalReservedIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTarget : The target of this reserved IP. +// +// If absent, this reserved IP is provider-owned or unbound. +// Models which "extend" this model: +// - ReservedIPTargetEndpointGatewayReference +// - ReservedIPTargetNetworkInterfaceReferenceTargetContext +// - ReservedIPTargetLoadBalancerReference +// - ReservedIPTargetVPNGatewayReference +// - ReservedIPTargetVPNServerReference +// - ReservedIPTargetGenericResourceReference +type ReservedIPTarget struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The unique user-defined name for this endpoint gateway. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the ReservedIPTarget.ResourceType property. +// The resource type. +const ( + ReservedIPTargetResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +func (*ReservedIPTarget) isaReservedIPTarget() bool { + return true +} + +type ReservedIPTargetIntf interface { + isaReservedIPTarget() bool +} + +// UnmarshalReservedIPTarget unmarshals an instance of ReservedIPTarget from the specified map of raw messages. +func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTarget) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototype : The target this reserved IP is to be bound to. The target must be an endpoint gateway not already bound to a reserved +// IP in the subnet's zone. +// Models which "extend" this model: +// - ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototype struct { + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` +} + +func (*ReservedIPTargetPrototype) isaReservedIPTargetPrototype() bool { + return true +} + +type ReservedIPTargetPrototypeIntf interface { + isaReservedIPTargetPrototype() bool +} + +// UnmarshalReservedIPTargetPrototype unmarshals an instance of ReservedIPTargetPrototype from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceFilter : Identifies one or more resources according to the specified filter property. +type ResourceFilter struct { + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// UnmarshalResourceFilter unmarshals an instance of ResourceFilter from the specified map of raw messages. +func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceFilter) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceGroupIdentity : The resource group to use. If unspecified, the account's [default resource +// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. +// Models which "extend" this model: +// - ResourceGroupIdentityByID +type ResourceGroupIdentity struct { + // The unique identifier for this resource group. + ID *string `json:"id,omitempty"` +} + +func (*ResourceGroupIdentity) isaResourceGroupIdentity() bool { + return true +} + +type ResourceGroupIdentityIntf interface { + isaResourceGroupIdentity() bool +} + +// UnmarshalResourceGroupIdentity unmarshals an instance of ResourceGroupIdentity from the specified map of raw messages. +func UnmarshalResourceGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceGroupReference : ResourceGroupReference struct +type ResourceGroupReference struct { + // The URL for this resource group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this resource group. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this resource group. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalResourceGroupReference unmarshals an instance of ResourceGroupReference from the specified map of raw messages. +func UnmarshalResourceGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RestartBareMetalServerOptions : The RestartBareMetalServer options. +type RestartBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRestartBareMetalServerOptions : Instantiate RestartBareMetalServerOptions +func (*VpcV1) NewRestartBareMetalServerOptions(id string) *RestartBareMetalServerOptions { + return &RestartBareMetalServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *RestartBareMetalServerOptions) SetID(id string) *RestartBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RestartBareMetalServerOptions) SetHeaders(param map[string]string) *RestartBareMetalServerOptions { + options.Headers = param + return options +} + +// Route : Route struct +type Route 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. + Action *string `json:"action" 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 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 user-defined name for this route. + 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 are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + Origin *string `json:"origin,omitempty"` + + // The zone the route applies to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Route.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. +const ( + RouteActionDelegateConst = "delegate" + RouteActionDelegateVPCConst = "delegate_vpc" + RouteActionDeliverConst = "deliver" + RouteActionDropConst = "drop" +) + +// Constants associated with the Route.LifecycleState property. +// The lifecycle state of the route. +const ( + RouteLifecycleStateDeletingConst = "deleting" + RouteLifecycleStateFailedConst = "failed" + RouteLifecycleStatePendingConst = "pending" + RouteLifecycleStateStableConst = "stable" + RouteLifecycleStateSuspendedConst = "suspended" + RouteLifecycleStateUpdatingConst = "updating" + RouteLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Route.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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +const ( + RouteOriginServiceConst = "service" + RouteOriginUserConst = "user" +) + +// UnmarshalRoute unmarshals an instance of Route from the specified map of raw messages. +func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Route) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + 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 *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"` + + // Collection of routes. + 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 { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRoute) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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. +// Models which "extend" this model: +// - RouteCreatorVPNGatewayReference +// - RouteCreatorVPNServerReference +type RouteCreator struct { + // The VPN gateway's CRN. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The VPN gateway's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id,omitempty"` + + // The user-defined name for this VPN gateway. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the RouteCreator.ResourceType property. +// The resource type. +const ( + RouteCreatorResourceTypeVPNGatewayConst = "vpn_gateway" +) + +func (*RouteCreator) isaRouteCreator() bool { + return true +} + +type RouteCreatorIntf interface { + isaRouteCreator() bool +} + +// UnmarshalRouteCreator unmarshals an instance of RouteCreator from the specified map of raw messages. +func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreator) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHop : RouteNextHop struct +// Models which "extend" this model: +// - RouteNextHopIP +// - RouteNextHopVPNGatewayConnectionReference +type RouteNextHop struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The user-defined name for this VPN connection. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the RouteNextHop.ResourceType property. +// The resource type. +const ( + RouteNextHopResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +func (*RouteNextHop) isaRouteNextHop() bool { + return true +} + +type RouteNextHopIntf interface { + isaRouteNextHop() bool +} + +// UnmarshalRouteNextHop unmarshals an instance of RouteNextHop from the specified map of raw messages. +func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHop) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePatch : RoutePatch struct +type RoutePatch struct { + // The user-defined name for this route. Names must be unique within the VPC routing table the route resides in. + Name *string `json:"name,omitempty"` +} + +// UnmarshalRoutePatch unmarshals an instance of RoutePatch from the specified map of raw messages. +func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// RoutePrototype : RoutePrototype struct +type RoutePrototype 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. + Action *string `json:"action,omitempty"` + + // The destination of the route. At most two routes per `zone` in a table can have the same destination, and only if + // both routes have an `action` of `deliver` and the `next_hop` is an IP address. + Destination *string `json:"destination" validate:"required"` + + // The user-defined name for this route. If unspecified, the name will be a hyphenated list of randomly-selected words. + // Names must be unique within the VPC routing table the route resides in. + Name *string `json:"name,omitempty"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` + // values, it must be omitted or specified as `0.0.0.0`. + NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + + // The zone to apply the route to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// Constants associated with the RoutePrototype.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. +const ( + RoutePrototypeActionDelegateConst = "delegate" + RoutePrototypeActionDelegateVPCConst = "delegate_vpc" + RoutePrototypeActionDeliverConst = "deliver" + RoutePrototypeActionDropConst = "drop" +) + +// NewRoutePrototype : Instantiate RoutePrototype (Generic Model Constructor) +func (*VpcV1) NewRoutePrototype(destination string, zone ZoneIdentityIntf) (_model *RoutePrototype, err error) { + _model = &RoutePrototype{ + Destination: core.StringPtr(destination), + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalRoutePrototype unmarshals an instance of RoutePrototype from the specified map of raw messages. +func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRoutePrototypeNextHop) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHop : If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` values, it must be +// omitted or specified as `0.0.0.0`. +// Models which "extend" this model: +// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity +type RoutePrototypeNextHop struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RoutePrototypeNextHop) isaRoutePrototypeNextHop() bool { + return true +} + +type RoutePrototypeNextHopIntf interface { + isaRoutePrototypeNextHop() bool +} + +// UnmarshalRoutePrototypeNextHop unmarshals an instance of RoutePrototypeNextHop from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHop(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHop) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteReference : RouteReference struct +type RouteReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *RouteReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this route. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this route. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this route. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalRouteReference unmarshals an instance of RouteReference from the specified map of raw messages. +func UnmarshalRouteReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRouteReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type RouteReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalRouteReferenceDeleted unmarshals an instance of RouteReferenceDeleted from the specified map of raw messages. +func UnmarshalRouteReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTable : RoutingTable struct +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 `vpn_server` value is supported, but filter + // support is expected to expand in the future. + AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` + + // The date and time that this routing table was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this routing table. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` + + // Indicates whether this is the default routing table for this VPC. + IsDefault *bool `json:"is_default" validate:"required"` + + // The lifecycle state of the routing table. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The user-defined name for this routing table. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from from [Transit + // Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this + // VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` + + // The routes for this routing table. + Routes []RouteReference `json:"routes" validate:"required"` + + // The subnets to which this routing table is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` +} + +// Constants associated with the RoutingTable.LifecycleState property. +// The lifecycle state of the routing table. +const ( + RoutingTableLifecycleStateDeletingConst = "deleting" + RoutingTableLifecycleStateFailedConst = "failed" + RoutingTableLifecycleStatePendingConst = "pending" + RoutingTableLifecycleStateStableConst = "stable" + RoutingTableLifecycleStateSuspendedConst = "suspended" + RoutingTableLifecycleStateUpdatingConst = "updating" + RoutingTableLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the RoutingTable.ResourceType property. +// The resource type. +const ( + RoutingTableResourceTypeRoutingTableConst = "routing_table" +) + +// UnmarshalRoutingTable unmarshals an instance of RoutingTable from the specified map of raw messages. +func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTable) + err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableCollection : RoutingTableCollection struct +type RoutingTableCollection struct { + // A link to the first page of resources. + First *RoutingTableCollectionFirst `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"` + + // Collection of routing tables. + RoutingTables []RoutingTable `json:"routing_tables" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRoutingTableCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_tables", &obj.RoutingTables, UnmarshalRoutingTable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *RoutingTableCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableIdentity : Identifies a routing table by a unique property. +// Models which "extend" this model: +// - RoutingTableIdentityByID +// - RoutingTableIdentityByHref +type RoutingTableIdentity struct { + // The unique identifier for this routing table. + ID *string `json:"id,omitempty"` + + // The URL for this routing table. + Href *string `json:"href,omitempty"` +} + +func (*RoutingTableIdentity) isaRoutingTableIdentity() bool { + return true +} + +type RoutingTableIdentityIntf interface { + isaRoutingTableIdentity() bool +} + +// UnmarshalRoutingTableIdentity unmarshals an instance of RoutingTableIdentity from the specified map of raw messages. +func UnmarshalRoutingTableIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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. + // + // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter + // support is expected to expand in the future. + AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` + + // The user-defined name for this routing table. Names must be unique within the VPC the routing table resides in. + Name *string `json:"name,omitempty"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to `true` selects this routing table, provided + // no other routing table in the VPC already has this property set to `true`, and no subnets are attached to this + // routing table. Updating to `false` deselects this routing table. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Transit Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. Updating to + // `true` selects this routing table, provided no other routing table in the VPC already has this property set to + // `true`, and no subnets are attached to this routing table. Updating to `false` deselects this routing table. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + // + // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled + // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing + // table. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` + + // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this + // VPC. Updating to `true` selects this routing table, provided no other routing table in the VPC already has this + // property set to `true`, and no subnets are attached to this routing table. Updating to `false` deselects this + // routing table. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in + // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` +} + +// UnmarshalRoutingTablePatch unmarshals an instance of RoutingTablePatch from the specified map of raw messages. +func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTablePatch) + err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// RoutingTableReference : RoutingTableReference struct +type RoutingTableReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *RoutingTableReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this routing table. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this routing table. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RoutingTableReference.ResourceType property. +// The resource type. +const ( + RoutingTableReferenceResourceTypeRoutingTableConst = "routing_table" +) + +// UnmarshalRoutingTableReference unmarshals an instance of RoutingTableReference from the specified map of raw messages. +func UnmarshalRoutingTableReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRoutingTableReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type RoutingTableReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalRoutingTableReferenceDeleted unmarshals an instance of RoutingTableReferenceDeleted from the specified map of raw messages. +func UnmarshalRoutingTableReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroup : SecurityGroup struct +type SecurityGroup struct { + // The date and time that this security group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + Name *string `json:"name" validate:"required"` + + // The resource group for this security group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The rules for this security group. If no rules exist, all traffic will be denied. + Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` + + // The targets for this security group. + Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` + + // The VPC this security group is a part of. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalSecurityGroup unmarshals an instance of SecurityGroup from the specified map of raw messages. +func UnmarshalSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroup) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) + if err != nil { + return + } + err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupCollection : SecurityGroupCollection struct +type SecurityGroupCollection struct { + // A link to the first page of resources. + First *SecurityGroupCollectionFirst `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"` + + // Collection of security groups. + SecurityGroups []SecurityGroup `json:"security_groups" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *SecurityGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 +// - SecurityGroupIdentityByCRN +// - SecurityGroupIdentityByHref +type SecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupIdentity) isaSecurityGroupIdentity() bool { + return true +} + +type SecurityGroupIdentityIntf interface { + isaSecurityGroupIdentity() bool +} + +// UnmarshalSecurityGroupIdentity unmarshals an instance of SecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupPatch : SecurityGroupPatch struct +type SecurityGroupPatch struct { + // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + Name *string `json:"name,omitempty"` +} + +// UnmarshalSecurityGroupPatch unmarshals an instance of SecurityGroupPatch from the specified map of raw messages. +func UnmarshalSecurityGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// SecurityGroupReference : SecurityGroupReference struct +type SecurityGroupReference struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalSecurityGroupReference unmarshals an instance of SecurityGroupReference from the specified map of raw messages. +func UnmarshalSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type SecurityGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalSecurityGroupReferenceDeleted unmarshals an instance of SecurityGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalSecurityGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRule : SecurityGroupRule struct +// Models which "extend" this model: +// - SecurityGroupRuleSecurityGroupRuleProtocolAll +// - SecurityGroupRuleSecurityGroupRuleProtocolIcmp +// - SecurityGroupRuleSecurityGroupRuleProtocolTcpudp +type SecurityGroupRule struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The IP addresses or security groups from which this rule allows traffic (or to which, for + // outbound rules). Can be specified as an IP address, a CIDR block, or a security group. A + // CIDR block of `0.0.0.0/0` allows traffic from any source (or to any destination, for + // outbound rules). + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The ICMP traffic code to allow. If absent, all codes are allowed. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to allow. If absent, all types are allowed. + Type *int64 `json:"type,omitempty"` + + // The inclusive upper bound of TCP/UDP port range. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP port range. + PortMin *int64 `json:"port_min,omitempty"` +} + +// Constants associated with the SecurityGroupRule.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleDirectionInboundConst = "inbound" + SecurityGroupRuleDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRule.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRule.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleProtocolAllConst = "all" + SecurityGroupRuleProtocolIcmpConst = "icmp" + SecurityGroupRuleProtocolTCPConst = "tcp" + SecurityGroupRuleProtocolUDPConst = "udp" +) + +func (*SecurityGroupRule) isaSecurityGroupRule() bool { + return true +} + +type SecurityGroupRuleIntf interface { + isaSecurityGroupRule() bool +} + +// UnmarshalSecurityGroupRule unmarshals an instance of SecurityGroupRule from the specified map of raw messages. +func UnmarshalSecurityGroupRule(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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// SecurityGroupRuleCollection : Collection of rules in a security group. +type SecurityGroupRuleCollection struct { + // Array of rules. + Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` +} + +// UnmarshalSecurityGroupRuleCollection unmarshals an instance of SecurityGroupRuleCollection from the specified map of raw messages. +func UnmarshalSecurityGroupRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleCollection) + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePatch : SecurityGroupRulePatch struct +type SecurityGroupRulePatch struct { + // The ICMP traffic code to allow. If set, `type` must also be set. + // + // Specify `null` to remove an existing ICMP traffic code. + Code *int64 `json:"code,omitempty"` + + // The direction of traffic to enforce. + Direction *string `json:"direction,omitempty"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The inclusive upper bound of the protocol port range. If set, `port_min` must also be set, and must not be larger. + // + // Specify `null` to remove an existing upper bound. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of the protocol port range. If set, `port_max` must also be set, and must not be smaller. + // + // Specify `null` to remove an existing lower bound. + PortMin *int64 `json:"port_min,omitempty"` + + // The 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. A CIDR block of `0.0.0.0/0` will allow traffic from any source (or to + // any destination, for outbound rules). + Remote SecurityGroupRuleRemotePatchIntf `json:"remote,omitempty"` + + // The ICMP traffic type to allow. + // + // Specify `null` to remove an existing ICMP traffic type value. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the SecurityGroupRulePatch.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePatchDirectionInboundConst = "inbound" + SecurityGroupRulePatchDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePatch.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePatchIPVersionIpv4Const = "ipv4" +) + +// UnmarshalSecurityGroupRulePatch unmarshals an instance of SecurityGroupRulePatch from the specified map of raw messages. +func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePatch) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// SecurityGroupRulePrototype : SecurityGroupRulePrototype struct +// Models which "extend" this model: +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp +type SecurityGroupRulePrototype struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The 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. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The ICMP traffic code to allow. + // + // If specified, `type` must also be specified. If unspecified, all codes are allowed. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to allow. + // + // If unspecified, all types are allowed. + Type *int64 `json:"type,omitempty"` + + // The inclusive upper bound of TCP/UDP port range. + // + // If specified, `port_min` must also be specified, and must not be larger. If unspecified, `port_min` must also be + // unspecified, allowing traffic on all ports. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP port range + // + // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be + // unspecified, allowing traffic on all ports. + PortMin *int64 `json:"port_min,omitempty"` +} + +// Constants associated with the SecurityGroupRulePrototype.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePrototypeDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototype.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototype.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeProtocolAllConst = "all" + SecurityGroupRulePrototypeProtocolIcmpConst = "icmp" + SecurityGroupRulePrototypeProtocolTCPConst = "tcp" + SecurityGroupRulePrototypeProtocolUDPConst = "udp" +) + +func (*SecurityGroupRulePrototype) isaSecurityGroupRulePrototype() bool { + return true +} + +type SecurityGroupRulePrototypeIntf interface { + isaSecurityGroupRulePrototype() bool +} + +// 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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// SecurityGroupRuleRemote : The IP addresses or security groups from which this rule allows traffic (or to which, for outbound rules). Can be +// specified as an IP address, a CIDR block, or a security group. A CIDR block of `0.0.0.0/0` allows traffic from any +// source (or to any destination, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleRemoteIP +// - SecurityGroupRuleRemoteCIDR +// - SecurityGroupRuleRemoteSecurityGroupReference +type SecurityGroupRuleRemote struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + Name *string `json:"name,omitempty"` +} + +func (*SecurityGroupRuleRemote) isaSecurityGroupRuleRemote() bool { + return true +} + +type SecurityGroupRuleRemoteIntf interface { + isaSecurityGroupRuleRemote() bool +} + +// UnmarshalSecurityGroupRuleRemote unmarshals an instance of SecurityGroupRuleRemote from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemote) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatch : The 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. A CIDR block of `0.0.0.0/0` will allow traffic from +// any source (or to any destination, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleRemotePatchIP +// - SecurityGroupRuleRemotePatchCIDR +// - SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatch struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` + + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePatch) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +type SecurityGroupRuleRemotePatchIntf interface { + isaSecurityGroupRuleRemotePatch() bool +} + +// UnmarshalSecurityGroupRuleRemotePatch unmarshals an instance of SecurityGroupRuleRemotePatch from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototype : The 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. +// +// If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source +// (or to any destination, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleRemotePrototypeIP +// - SecurityGroupRuleRemotePrototypeCIDR +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototype struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` + + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePrototype) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +type SecurityGroupRuleRemotePrototypeIntf interface { + isaSecurityGroupRuleRemotePrototype() bool +} + +// UnmarshalSecurityGroupRuleRemotePrototype unmarshals an instance of SecurityGroupRuleRemotePrototype from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototype) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetCollection : SecurityGroupTargetCollection struct +type SecurityGroupTargetCollection struct { + // A link to the first page of resources. + First *SecurityGroupTargetCollectionFirst `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"` + + // Collection of targets for this security group. + Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupTargetCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *SecurityGroupTargetCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReference : The resource types that can be security group targets are expected to expand in the future. When iterating over +// security group targets, do not assume that every target resource will be from a known set of resource types. +// Optionally halt processing and surface an error, or bypass resources of unrecognized types. +// Models which "extend" this model: +// - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext +// - SecurityGroupTargetReferenceLoadBalancerReference +// - SecurityGroupTargetReferenceEndpointGatewayReference +// - SecurityGroupTargetReferenceVPNServerReference +type SecurityGroupTargetReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` + + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The user-defined name for this network interface. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The load balancer's CRN. + CRN *string `json:"crn,omitempty"` +} + +// Constants associated with the SecurityGroupTargetReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*SecurityGroupTargetReference) isaSecurityGroupTargetReference() bool { + return true +} + +type SecurityGroupTargetReferenceIntf interface { + isaSecurityGroupTargetReference() bool +} + +// UnmarshalSecurityGroupTargetReference unmarshals an instance of SecurityGroupTargetReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SetSubnetPublicGatewayOptions : The SetSubnetPublicGateway options. +type SetSubnetPublicGatewayOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The public gateway identity. + PublicGatewayIdentity PublicGatewayIdentityIntf `json:"PublicGatewayIdentity" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewSetSubnetPublicGatewayOptions : Instantiate SetSubnetPublicGatewayOptions +func (*VpcV1) NewSetSubnetPublicGatewayOptions(id string, publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { + return &SetSubnetPublicGatewayOptions{ + ID: core.StringPtr(id), + PublicGatewayIdentity: publicGatewayIdentity, + } +} + +// SetID : Allow user to set ID +func (_options *SetSubnetPublicGatewayOptions) SetID(id string) *SetSubnetPublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetPublicGatewayIdentity : Allow user to set PublicGatewayIdentity +func (_options *SetSubnetPublicGatewayOptions) SetPublicGatewayIdentity(publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { + _options.PublicGatewayIdentity = publicGatewayIdentity + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *SetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *SetSubnetPublicGatewayOptions { + options.Headers = param + return options +} + +// Snapshot : Snapshot struct +type Snapshot struct { + // If present, the backup policy plan which created this snapshot. + BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan,omitempty"` + + // Indicates if a boot volume attachment can be created with a volume created from this snapshot. + Bootable *bool `json:"bootable" validate:"required"` + + // The date and time the data capture for this snapshot was completed. + // + // If absent, this snapshot's data has not yet been captured. Additionally, this property may be absent for snapshots + // created before 1 January 2022. + CapturedAt *strfmt.DateTime `json:"captured_at,omitempty"` + + // The date and time that this snapshot was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN of this snapshot. + CRN *string `json:"crn" validate:"required"` + + // Indicates whether this snapshot can be deleted. This value will always be `true`. + Deletable *bool `json:"deletable" validate:"required"` + + // The type of encryption used on the source volume. + Encryption *string `json:"encryption" validate:"required"` + + // The root key used to wrap the data encryption key for the source volume. + // + // This property will be present for volumes with an `encryption` type of + // `user_managed`. + EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` + + // The URL for this snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this snapshot. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of this snapshot. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The minimum capacity of a volume created from this snapshot. When a snapshot is created, this will be set to the + // capacity of the `source_volume`. + MinimumCapacity *int64 `json:"minimum_capacity" validate:"required"` + + // The user-defined name for this snapshot. + Name *string `json:"name" validate:"required"` + + // The operating system included in this image. + OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` + + // The resource group for this snapshot. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) prefixed with `is.snapshot:` associated with + // this snapshot. + ServiceTags []string `json:"service_tags" validate:"required"` + + // The size of this snapshot rounded up to the next gigabyte. + Size *int64 `json:"size" validate:"required"` + + // If present, the image from which the data on this snapshot was most directly + // provisioned. + SourceImage *ImageReference `json:"source_image,omitempty"` + + // The source volume this snapshot was created from (may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + SourceVolume *VolumeReference `json:"source_volume" validate:"required"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags" validate:"required"` +} + +// Constants associated with the Snapshot.Encryption property. +// The type of encryption used on the source volume. +const ( + SnapshotEncryptionProviderManagedConst = "provider_managed" + SnapshotEncryptionUserManagedConst = "user_managed" +) + +// Constants associated with the Snapshot.LifecycleState property. +// The lifecycle state of this snapshot. +const ( + SnapshotLifecycleStateDeletingConst = "deleting" + SnapshotLifecycleStateFailedConst = "failed" + SnapshotLifecycleStatePendingConst = "pending" + SnapshotLifecycleStateStableConst = "stable" + SnapshotLifecycleStateSuspendedConst = "suspended" + SnapshotLifecycleStateUpdatingConst = "updating" + SnapshotLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Snapshot.ResourceType property. +// The resource type. +const ( + SnapshotResourceTypeSnapshotConst = "snapshot" +) + +// UnmarshalSnapshot unmarshals an instance of Snapshot from the specified map of raw messages. +func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Snapshot) + err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "bootable", &obj.Bootable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "captured_at", &obj.CapturedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deletable", &obj.Deletable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "minimum_capacity", &obj.MinimumCapacity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_tags", &obj.ServiceTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_image", &obj.SourceImage, UnmarshalImageReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotCollection : SnapshotCollection struct +type SnapshotCollection struct { + // A link to the first page of resources. + First *SnapshotCollectionFirst `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"` + + // Collection of snapshots. + Snapshots []Snapshot `json:"snapshots" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSnapshotCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshot) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *SnapshotCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotIdentity : Identifies a snapshot by a unique property. +// Models which "extend" this model: +// - SnapshotIdentityByID +// - SnapshotIdentityByCRN +// - SnapshotIdentityByHref +type SnapshotIdentity struct { + // The unique identifier for this snapshot. + ID *string `json:"id,omitempty"` + + // The CRN of this snapshot. + CRN *string `json:"crn,omitempty"` + + // The URL for this snapshot. + Href *string `json:"href,omitempty"` +} + +func (*SnapshotIdentity) isaSnapshotIdentity() bool { + return true +} + +type SnapshotIdentityIntf interface { + isaSnapshotIdentity() bool +} + +// UnmarshalSnapshotIdentity unmarshals an instance of SnapshotIdentity from the specified map of raw messages. +func UnmarshalSnapshotIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotPatch : SnapshotPatch struct +type SnapshotPatch struct { + // The user-defined name for this snapshot. + Name *string `json:"name,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` +} + +// UnmarshalSnapshotPatch unmarshals an instance of SnapshotPatch from the specified map of raw messages. +func UnmarshalSnapshotPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// SnapshotPrototype : SnapshotPrototype struct +// Models which "extend" this model: +// - SnapshotPrototypeSnapshotBySourceVolume +type SnapshotPrototype struct { + // The unique user-defined name for this snapshot. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` + + // The volume to create this snapshot from. + SourceVolume VolumeIdentityIntf `json:"source_volume,omitempty"` +} + +func (*SnapshotPrototype) isaSnapshotPrototype() bool { + return true +} + +type SnapshotPrototypeIntf interface { + isaSnapshotPrototype() bool +} + +// UnmarshalSnapshotPrototype unmarshals an instance of SnapshotPrototype from the specified map of raw messages. +func UnmarshalSnapshotPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotReference : SnapshotReference struct +type SnapshotReference struct { + // The CRN of this snapshot. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this snapshot. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this snapshot. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SnapshotReference.ResourceType property. +// The resource type. +const ( + SnapshotReferenceResourceTypeSnapshotConst = "snapshot" +) + +// UnmarshalSnapshotReference unmarshals an instance of SnapshotReference from the specified map of raw messages. +func UnmarshalSnapshotReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type SnapshotReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalSnapshotReferenceDeleted unmarshals an instance of SnapshotReferenceDeleted from the specified map of raw messages. +func UnmarshalSnapshotReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// StartBareMetalServerOptions : The StartBareMetalServer options. +type StartBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewStartBareMetalServerOptions : Instantiate StartBareMetalServerOptions +func (*VpcV1) NewStartBareMetalServerOptions(id string) *StartBareMetalServerOptions { + return &StartBareMetalServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *StartBareMetalServerOptions) SetID(id string) *StartBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *StartBareMetalServerOptions) SetHeaders(param map[string]string) *StartBareMetalServerOptions { + options.Headers = param + return options +} + +// StopBareMetalServerOptions : The StopBareMetalServer options. +type StopBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // The type of stop operation: + // - `soft`: signal running operating system to quiesce and shutdown cleanly + // - `hard`: immediately stop the server. + Type *string `json:"type" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the StopBareMetalServerOptions.Type property. +// The type of stop operation: +// - `soft`: signal running operating system to quiesce and shutdown cleanly +// - `hard`: immediately stop the server. +const ( + StopBareMetalServerOptionsTypeHardConst = "hard" + StopBareMetalServerOptionsTypeSoftConst = "soft" +) + +// NewStopBareMetalServerOptions : Instantiate StopBareMetalServerOptions +func (*VpcV1) NewStopBareMetalServerOptions(id string, typeVar string) *StopBareMetalServerOptions { + return &StopBareMetalServerOptions{ + ID: core.StringPtr(id), + Type: core.StringPtr(typeVar), + } +} + +// SetID : Allow user to set ID +func (_options *StopBareMetalServerOptions) SetID(id string) *StopBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetType : Allow user to set Type +func (_options *StopBareMetalServerOptions) SetType(typeVar string) *StopBareMetalServerOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *StopBareMetalServerOptions) SetHeaders(param map[string]string) *StopBareMetalServerOptions { + options.Headers = param + return options +} + +// Subnet : Subnet struct +type Subnet struct { + // The number of IPv4 addresses in this 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 date and time that the subnet was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` + + // The URL for this subnet. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` + + // The IP version(s) supported by this subnet. + IPVersion *string `json:"ip_version" validate:"required"` + + // The IPv4 range of the subnet, expressed in CIDR format. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` + + // The user-defined name for this subnet. + Name *string `json:"name" validate:"required"` + + // The network ACL for this subnet. + NetworkACL *NetworkACLReference `json:"network_acl" validate:"required"` + + // The public gateway to use for internet-bound traffic for this subnet. + PublicGateway *PublicGatewayReference `json:"public_gateway,omitempty"` + + // The resource group for this subnet. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The routing table for this subnet. + RoutingTable *RoutingTableReference `json:"routing_table" validate:"required"` + + // The status of the subnet. + Status *string `json:"status" validate:"required"` + + // The total number of IPv4 addresses in this 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"` + + // The VPC this subnet is a part of. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this subnet resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Subnet.IPVersion property. +// The IP version(s) supported by this subnet. +const ( + SubnetIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the Subnet.ResourceType property. +// The resource type. +const ( + SubnetResourceTypeSubnetConst = "subnet" +) + +// Constants associated with the Subnet.Status property. +// The status of the subnet. +const ( + SubnetStatusAvailableConst = "available" + SubnetStatusDeletingConst = "deleting" + SubnetStatusFailedConst = "failed" + SubnetStatusPendingConst = "pending" +) + +// UnmarshalSubnet unmarshals an instance of Subnet from the specified map of raw messages. +func UnmarshalSubnet(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Subnet) + err = core.UnmarshalPrimitive(m, "available_ipv4_address_count", &obj.AvailableIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetCollection : SubnetCollection struct +type SubnetCollection struct { + // A link to the first page of resources. + First *SubnetCollectionFirst `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"` + + // Collection of subnets. + Subnets []Subnet `json:"subnets" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSubnetCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnet) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *SubnetCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentity : Identifies a subnet by a unique property. +// Models which "extend" this model: +// - SubnetIdentityByID +// - SubnetIdentityByCRN +// - SubnetIdentityByHref +type SubnetIdentity struct { + // The unique identifier for this subnet. + ID *string `json:"id,omitempty"` + + // The CRN for this subnet. + CRN *string `json:"crn,omitempty"` + + // The URL for this subnet. + Href *string `json:"href,omitempty"` +} + +func (*SubnetIdentity) isaSubnetIdentity() bool { + return true +} + +type SubnetIdentityIntf interface { + isaSubnetIdentity() bool +} + +// UnmarshalSubnetIdentity unmarshals an instance of SubnetIdentity from the specified map of raw messages. +func UnmarshalSubnetIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPatch : SubnetPatch struct +type SubnetPatch struct { + // The user-defined name for this subnet. Names must be unique within the VPC the subnet resides in. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to use for internet-bound traffic for this subnet. + PublicGateway SubnetPublicGatewayPatchIntf `json:"public_gateway,omitempty"` + + // The routing table to use for this subnet. The routing table properties + // `route_direct_link_ingress`, `route_transit_gateway_ingress`, and + // `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` +} + +// UnmarshalSubnetPatch unmarshals an instance of SubnetPatch from the specified map of raw messages. +func UnmarshalSubnetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalSubnetPublicGatewayPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// SubnetPrototype : SubnetPrototype struct +// Models which "extend" this model: +// - SubnetPrototypeSubnetByTotalCount +// - SubnetPrototypeSubnetByCIDR +type SubnetPrototype struct { + // The IP version(s) to support for this subnet. + IPVersion *string `json:"ip_version,omitempty"` + + // The user-defined name for this subnet. Names must be unique within the VPC the subnet resides in. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to use for internet-bound traffic for this subnet. If + // unspecified, the subnet will not be attached to a public gateway. + PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The routing table to use for this subnet. If unspecified, the default routing table + // for the VPC is used. The routing table properties `route_direct_link_ingress`, + // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` + + // The VPC the subnet is to be a part of. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The total number of IPv4 addresses required. Must be a power of 2. The VPC must have a default address prefix in the + // specified zone, and that prefix must have a free CIDR range with at least this number of addresses. + TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count,omitempty"` + + // The zone this subnet will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // The IPv4 range of the subnet, expressed in CIDR format. The prefix length of the subnet's CIDR must be between `/9` + // (8,388,608 addresses) and `/29` (8 addresses). The IPv4 range of the subnet's CIDR must fall within an existing + // address prefix in the VPC and must not overlap with any existing subnet. The subnet will be created in the zone of + // the address prefix that contains the IPv4 CIDR. If zone is specified, it must match the zone of the address prefix + // that contains the subnet's IPv4 CIDR. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block,omitempty"` +} + +// Constants associated with the SubnetPrototype.IPVersion property. +// The IP version(s) to support for this subnet. +const ( + SubnetPrototypeIPVersionIpv4Const = "ipv4" +) + +func (*SubnetPrototype) isaSubnetPrototype() bool { + return true +} + +type SubnetPrototypeIntf interface { + isaSubnetPrototype() bool +} + +// UnmarshalSubnetPrototype unmarshals an instance of SubnetPrototype from the specified map of raw messages. +func UnmarshalSubnetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPrototype) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPublicGatewayPatch : The public gateway to use for internet-bound traffic for this subnet. +// Models which "extend" this model: +// - SubnetPublicGatewayPatchPublicGatewayIdentityByID +// - SubnetPublicGatewayPatchPublicGatewayIdentityByCRN +// - SubnetPublicGatewayPatchPublicGatewayIdentityByHref +type SubnetPublicGatewayPatch struct { + // The unique identifier for this public gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this public gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href,omitempty"` +} + +func (*SubnetPublicGatewayPatch) isaSubnetPublicGatewayPatch() bool { + return true +} + +type SubnetPublicGatewayPatchIntf interface { + isaSubnetPublicGatewayPatch() bool +} + +// UnmarshalSubnetPublicGatewayPatch unmarshals an instance of SubnetPublicGatewayPatch from the specified map of raw messages. +func UnmarshalSubnetPublicGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPublicGatewayPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetReference : SubnetReference struct +type SubnetReference struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SubnetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this subnet. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this subnet. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SubnetReference.ResourceType property. +// The resource type. +const ( + SubnetReferenceResourceTypeSubnetConst = "subnet" +) + +// UnmarshalSubnetReference unmarshals an instance of SubnetReference from the specified map of raw messages. +func UnmarshalSubnetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSubnetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type SubnetReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalSubnetReferenceDeleted unmarshals an instance of SubnetReferenceDeleted from the specified map of raw messages. +func UnmarshalSubnetReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfileIdentity : Identifies a trusted profile by a unique property. +// Models which "extend" this model: +// - TrustedProfileIdentityTrustedProfileByID +// - TrustedProfileIdentityTrustedProfileByCRN +type TrustedProfileIdentity struct { + // The unique identifier for this trusted profile. + ID *string `json:"id,omitempty"` + + // The CRN for this trusted profile. + CRN *string `json:"crn,omitempty"` +} + +func (*TrustedProfileIdentity) isaTrustedProfileIdentity() bool { + return true +} + +type TrustedProfileIdentityIntf interface { + isaTrustedProfileIdentity() bool +} + +// UnmarshalTrustedProfileIdentity unmarshals an instance of TrustedProfileIdentity from the specified map of raw messages. +func UnmarshalTrustedProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TrustedProfileIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfileReference : TrustedProfileReference struct +type TrustedProfileReference struct { + // The CRN for this trusted profile. + CRN *string `json:"crn" validate:"required"` + + // The unique identifier for this trusted profile. + ID *string `json:"id" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the TrustedProfileReference.ResourceType property. +// The resource type. +const ( + TrustedProfileReferenceResourceTypeTrustedProfileConst = "trusted_profile" +) + +// UnmarshalTrustedProfileReference unmarshals an instance of TrustedProfileReference from the specified map of raw messages. +func UnmarshalTrustedProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TrustedProfileReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UnsetSubnetPublicGatewayOptions : The UnsetSubnetPublicGateway options. +type UnsetSubnetPublicGatewayOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUnsetSubnetPublicGatewayOptions : Instantiate UnsetSubnetPublicGatewayOptions +func (*VpcV1) NewUnsetSubnetPublicGatewayOptions(id string) *UnsetSubnetPublicGatewayOptions { + return &UnsetSubnetPublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *UnsetSubnetPublicGatewayOptions) SetID(id string) *UnsetSubnetPublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UnsetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *UnsetSubnetPublicGatewayOptions { + options.Headers = param + return options +} + +// UpdateBackupPolicyOptions : The UpdateBackupPolicy options. +type UpdateBackupPolicyOptions struct { + // The backup policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The backup policy patch. + BackupPolicyPatch map[string]interface{} `json:"BackupPolicy_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 +} + +// NewUpdateBackupPolicyOptions : Instantiate UpdateBackupPolicyOptions +func (*VpcV1) NewUpdateBackupPolicyOptions(id string, backupPolicyPatch map[string]interface{}) *UpdateBackupPolicyOptions { + return &UpdateBackupPolicyOptions{ + ID: core.StringPtr(id), + BackupPolicyPatch: backupPolicyPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateBackupPolicyOptions) SetID(id string) *UpdateBackupPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBackupPolicyPatch : Allow user to set BackupPolicyPatch +func (_options *UpdateBackupPolicyOptions) SetBackupPolicyPatch(backupPolicyPatch map[string]interface{}) *UpdateBackupPolicyOptions { + _options.BackupPolicyPatch = backupPolicyPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateBackupPolicyOptions) SetIfMatch(ifMatch string) *UpdateBackupPolicyOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBackupPolicyOptions) SetHeaders(param map[string]string) *UpdateBackupPolicyOptions { + options.Headers = param + return options +} + +// UpdateBackupPolicyPlanOptions : The UpdateBackupPolicyPlan options. +type UpdateBackupPolicyPlanOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // The backup policy plan identifier. + ID *string `json:"id" validate:"required,ne="` + + // The backup policy plan patch. + BackupPolicyPlanPatch map[string]interface{} `json:"BackupPolicyPlan_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 +} + +// NewUpdateBackupPolicyPlanOptions : Instantiate UpdateBackupPolicyPlanOptions +func (*VpcV1) NewUpdateBackupPolicyPlanOptions(backupPolicyID string, id string, backupPolicyPlanPatch map[string]interface{}) *UpdateBackupPolicyPlanOptions { + return &UpdateBackupPolicyPlanOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + ID: core.StringPtr(id), + BackupPolicyPlanPatch: backupPolicyPlanPatch, + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *UpdateBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *UpdateBackupPolicyPlanOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateBackupPolicyPlanOptions) SetID(id string) *UpdateBackupPolicyPlanOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBackupPolicyPlanPatch : Allow user to set BackupPolicyPlanPatch +func (_options *UpdateBackupPolicyPlanOptions) SetBackupPolicyPlanPatch(backupPolicyPlanPatch map[string]interface{}) *UpdateBackupPolicyPlanOptions { + _options.BackupPolicyPlanPatch = backupPolicyPlanPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateBackupPolicyPlanOptions) SetIfMatch(ifMatch string) *UpdateBackupPolicyPlanOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *UpdateBackupPolicyPlanOptions { + options.Headers = param + return options +} + +// UpdateBareMetalServerDiskOptions : The UpdateBareMetalServerDisk options. +type UpdateBareMetalServerDiskOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // The bare metal server disk patch. + BareMetalServerDiskPatch map[string]interface{} `json:"BareMetalServerDisk_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateBareMetalServerDiskOptions : Instantiate UpdateBareMetalServerDiskOptions +func (*VpcV1) NewUpdateBareMetalServerDiskOptions(bareMetalServerID string, id string, bareMetalServerDiskPatch map[string]interface{}) *UpdateBareMetalServerDiskOptions { + return &UpdateBareMetalServerDiskOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + BareMetalServerDiskPatch: bareMetalServerDiskPatch, + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *UpdateBareMetalServerDiskOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerDiskOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateBareMetalServerDiskOptions) SetID(id string) *UpdateBareMetalServerDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBareMetalServerDiskPatch : Allow user to set BareMetalServerDiskPatch +func (_options *UpdateBareMetalServerDiskOptions) SetBareMetalServerDiskPatch(bareMetalServerDiskPatch map[string]interface{}) *UpdateBareMetalServerDiskOptions { + _options.BareMetalServerDiskPatch = bareMetalServerDiskPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBareMetalServerDiskOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerDiskOptions { + options.Headers = param + return options +} + +// UpdateBareMetalServerNetworkInterfaceOptions : The UpdateBareMetalServerNetworkInterface options. +type UpdateBareMetalServerNetworkInterfaceOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // The network interface patch. + BareMetalServerNetworkInterfacePatch map[string]interface{} `json:"BareMetalServerNetworkInterface_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateBareMetalServerNetworkInterfaceOptions : Instantiate UpdateBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewUpdateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string, bareMetalServerNetworkInterfacePatch map[string]interface{}) *UpdateBareMetalServerNetworkInterfaceOptions { + return &UpdateBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + BareMetalServerNetworkInterfacePatch: bareMetalServerNetworkInterfacePatch, + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetID(id string) *UpdateBareMetalServerNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBareMetalServerNetworkInterfacePatch : Allow user to set BareMetalServerNetworkInterfacePatch +func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePatch(bareMetalServerNetworkInterfacePatch map[string]interface{}) *UpdateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options +} + +// UpdateBareMetalServerOptions : The UpdateBareMetalServer options. +type UpdateBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // The bare metal server patch. + BareMetalServerPatch map[string]interface{} `json:"BareMetalServer_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateBareMetalServerOptions : Instantiate UpdateBareMetalServerOptions +func (*VpcV1) NewUpdateBareMetalServerOptions(id string, bareMetalServerPatch map[string]interface{}) *UpdateBareMetalServerOptions { + return &UpdateBareMetalServerOptions{ + ID: core.StringPtr(id), + BareMetalServerPatch: bareMetalServerPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateBareMetalServerOptions) SetID(id string) *UpdateBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBareMetalServerPatch : Allow user to set BareMetalServerPatch +func (_options *UpdateBareMetalServerOptions) SetBareMetalServerPatch(bareMetalServerPatch map[string]interface{}) *UpdateBareMetalServerOptions { + _options.BareMetalServerPatch = bareMetalServerPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBareMetalServerOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerOptions { + options.Headers = param + return options +} + +// UpdateDedicatedHostDiskOptions : The UpdateDedicatedHostDisk options. +type UpdateDedicatedHostDiskOptions struct { + // The dedicated host identifier. + DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="` + + // The dedicated host disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // The dedicated host disk patch. + DedicatedHostDiskPatch map[string]interface{} `json:"DedicatedHostDisk_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateDedicatedHostDiskOptions : Instantiate UpdateDedicatedHostDiskOptions +func (*VpcV1) NewUpdateDedicatedHostDiskOptions(dedicatedHostID string, id string, dedicatedHostDiskPatch map[string]interface{}) *UpdateDedicatedHostDiskOptions { + return &UpdateDedicatedHostDiskOptions{ + DedicatedHostID: core.StringPtr(dedicatedHostID), + ID: core.StringPtr(id), + DedicatedHostDiskPatch: dedicatedHostDiskPatch, + } +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (_options *UpdateDedicatedHostDiskOptions) SetDedicatedHostID(dedicatedHostID string) *UpdateDedicatedHostDiskOptions { + _options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateDedicatedHostDiskOptions) SetID(id string) *UpdateDedicatedHostDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetDedicatedHostDiskPatch : Allow user to set DedicatedHostDiskPatch +func (_options *UpdateDedicatedHostDiskOptions) SetDedicatedHostDiskPatch(dedicatedHostDiskPatch map[string]interface{}) *UpdateDedicatedHostDiskOptions { + _options.DedicatedHostDiskPatch = dedicatedHostDiskPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateDedicatedHostDiskOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostDiskOptions { + options.Headers = param + return options +} + +// UpdateDedicatedHostGroupOptions : The UpdateDedicatedHostGroup options. +type UpdateDedicatedHostGroupOptions struct { + // The dedicated host group identifier. + ID *string `json:"id" validate:"required,ne="` + + // The dedicated host group patch. + DedicatedHostGroupPatch map[string]interface{} `json:"DedicatedHostGroup_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateDedicatedHostGroupOptions : Instantiate UpdateDedicatedHostGroupOptions +func (*VpcV1) NewUpdateDedicatedHostGroupOptions(id string, dedicatedHostGroupPatch map[string]interface{}) *UpdateDedicatedHostGroupOptions { + return &UpdateDedicatedHostGroupOptions{ + ID: core.StringPtr(id), + DedicatedHostGroupPatch: dedicatedHostGroupPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateDedicatedHostGroupOptions) SetID(id string) *UpdateDedicatedHostGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetDedicatedHostGroupPatch : Allow user to set DedicatedHostGroupPatch +func (_options *UpdateDedicatedHostGroupOptions) SetDedicatedHostGroupPatch(dedicatedHostGroupPatch map[string]interface{}) *UpdateDedicatedHostGroupOptions { + _options.DedicatedHostGroupPatch = dedicatedHostGroupPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateDedicatedHostGroupOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// UpdateDedicatedHostOptions : The UpdateDedicatedHost options. +type UpdateDedicatedHostOptions struct { + // The dedicated host identifier. + ID *string `json:"id" validate:"required,ne="` + + // The dedicated host patch. + DedicatedHostPatch map[string]interface{} `json:"DedicatedHost_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateDedicatedHostOptions : Instantiate UpdateDedicatedHostOptions +func (*VpcV1) NewUpdateDedicatedHostOptions(id string, dedicatedHostPatch map[string]interface{}) *UpdateDedicatedHostOptions { + return &UpdateDedicatedHostOptions{ + ID: core.StringPtr(id), + DedicatedHostPatch: dedicatedHostPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateDedicatedHostOptions) SetID(id string) *UpdateDedicatedHostOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetDedicatedHostPatch : Allow user to set DedicatedHostPatch +func (_options *UpdateDedicatedHostOptions) SetDedicatedHostPatch(dedicatedHostPatch map[string]interface{}) *UpdateDedicatedHostOptions { + _options.DedicatedHostPatch = dedicatedHostPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateDedicatedHostOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostOptions { + options.Headers = param + return options +} + +// UpdateEndpointGatewayOptions : The UpdateEndpointGateway options. +type UpdateEndpointGatewayOptions struct { + // The endpoint gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // The endpoint gateway patch. + EndpointGatewayPatch map[string]interface{} `json:"EndpointGateway_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateEndpointGatewayOptions : Instantiate UpdateEndpointGatewayOptions +func (*VpcV1) NewUpdateEndpointGatewayOptions(id string, endpointGatewayPatch map[string]interface{}) *UpdateEndpointGatewayOptions { + return &UpdateEndpointGatewayOptions{ + ID: core.StringPtr(id), + EndpointGatewayPatch: endpointGatewayPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateEndpointGatewayOptions) SetID(id string) *UpdateEndpointGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetEndpointGatewayPatch : Allow user to set EndpointGatewayPatch +func (_options *UpdateEndpointGatewayOptions) SetEndpointGatewayPatch(endpointGatewayPatch map[string]interface{}) *UpdateEndpointGatewayOptions { + _options.EndpointGatewayPatch = endpointGatewayPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateEndpointGatewayOptions) SetHeaders(param map[string]string) *UpdateEndpointGatewayOptions { + options.Headers = param + return options +} + +// UpdateFloatingIPOptions : The UpdateFloatingIP options. +type UpdateFloatingIPOptions struct { + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // The floating IP patch. + FloatingIPPatch map[string]interface{} `json:"FloatingIP_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateFloatingIPOptions : Instantiate UpdateFloatingIPOptions +func (*VpcV1) NewUpdateFloatingIPOptions(id string, floatingIPPatch map[string]interface{}) *UpdateFloatingIPOptions { + return &UpdateFloatingIPOptions{ + ID: core.StringPtr(id), + FloatingIPPatch: floatingIPPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateFloatingIPOptions) SetID(id string) *UpdateFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetFloatingIPPatch : Allow user to set FloatingIPPatch +func (_options *UpdateFloatingIPOptions) SetFloatingIPPatch(floatingIPPatch map[string]interface{}) *UpdateFloatingIPOptions { + _options.FloatingIPPatch = floatingIPPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateFloatingIPOptions) SetHeaders(param map[string]string) *UpdateFloatingIPOptions { + options.Headers = param + return options +} + +// UpdateFlowLogCollectorOptions : The UpdateFlowLogCollector options. +type UpdateFlowLogCollectorOptions struct { + // The flow log collector identifier. + ID *string `json:"id" validate:"required,ne="` + + // The flow log collector patch. + FlowLogCollectorPatch map[string]interface{} `json:"FlowLogCollector_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateFlowLogCollectorOptions : Instantiate UpdateFlowLogCollectorOptions +func (*VpcV1) NewUpdateFlowLogCollectorOptions(id string, flowLogCollectorPatch map[string]interface{}) *UpdateFlowLogCollectorOptions { + return &UpdateFlowLogCollectorOptions{ + ID: core.StringPtr(id), + FlowLogCollectorPatch: flowLogCollectorPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateFlowLogCollectorOptions) SetID(id string) *UpdateFlowLogCollectorOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetFlowLogCollectorPatch : Allow user to set FlowLogCollectorPatch +func (_options *UpdateFlowLogCollectorOptions) SetFlowLogCollectorPatch(flowLogCollectorPatch map[string]interface{}) *UpdateFlowLogCollectorOptions { + _options.FlowLogCollectorPatch = flowLogCollectorPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateFlowLogCollectorOptions) SetHeaders(param map[string]string) *UpdateFlowLogCollectorOptions { + options.Headers = param + return options +} + +// UpdateIkePolicyOptions : The UpdateIkePolicy options. +type UpdateIkePolicyOptions struct { + // The IKE policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The IKE policy patch. + IkePolicyPatch map[string]interface{} `json:"IKEPolicy_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateIkePolicyOptions : Instantiate UpdateIkePolicyOptions +func (*VpcV1) NewUpdateIkePolicyOptions(id string, ikePolicyPatch map[string]interface{}) *UpdateIkePolicyOptions { + return &UpdateIkePolicyOptions{ + ID: core.StringPtr(id), + IkePolicyPatch: ikePolicyPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateIkePolicyOptions) SetID(id string) *UpdateIkePolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIkePolicyPatch : Allow user to set IkePolicyPatch +func (_options *UpdateIkePolicyOptions) SetIkePolicyPatch(ikePolicyPatch map[string]interface{}) *UpdateIkePolicyOptions { + _options.IkePolicyPatch = ikePolicyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateIkePolicyOptions) SetHeaders(param map[string]string) *UpdateIkePolicyOptions { + options.Headers = param + return options +} + +// UpdateImageOptions : The UpdateImage options. +type UpdateImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // The image patch. + ImagePatch map[string]interface{} `json:"Image_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateImageOptions : Instantiate UpdateImageOptions +func (*VpcV1) NewUpdateImageOptions(id string, imagePatch map[string]interface{}) *UpdateImageOptions { + return &UpdateImageOptions{ + ID: core.StringPtr(id), + ImagePatch: imagePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateImageOptions) SetID(id string) *UpdateImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetImagePatch : Allow user to set ImagePatch +func (_options *UpdateImageOptions) SetImagePatch(imagePatch map[string]interface{}) *UpdateImageOptions { + _options.ImagePatch = imagePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateImageOptions) SetHeaders(param map[string]string) *UpdateImageOptions { + options.Headers = param + return options +} + +// UpdateInstanceDiskOptions : The UpdateInstanceDisk options. +type UpdateInstanceDiskOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance disk patch. + InstanceDiskPatch map[string]interface{} `json:"InstanceDisk_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceDiskOptions : Instantiate UpdateInstanceDiskOptions +func (*VpcV1) NewUpdateInstanceDiskOptions(instanceID string, id string, instanceDiskPatch map[string]interface{}) *UpdateInstanceDiskOptions { + return &UpdateInstanceDiskOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + InstanceDiskPatch: instanceDiskPatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *UpdateInstanceDiskOptions) SetInstanceID(instanceID string) *UpdateInstanceDiskOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceDiskOptions) SetID(id string) *UpdateInstanceDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceDiskPatch : Allow user to set InstanceDiskPatch +func (_options *UpdateInstanceDiskOptions) SetInstanceDiskPatch(instanceDiskPatch map[string]interface{}) *UpdateInstanceDiskOptions { + _options.InstanceDiskPatch = instanceDiskPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceDiskOptions) SetHeaders(param map[string]string) *UpdateInstanceDiskOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupManagerActionOptions : The UpdateInstanceGroupManagerAction options. +type UpdateInstanceGroupManagerActionOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager action identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group manager action patch. + InstanceGroupManagerActionPatch map[string]interface{} `json:"InstanceGroupManagerAction_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupManagerActionOptions : Instantiate UpdateInstanceGroupManagerActionOptions +func (*VpcV1) NewUpdateInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string, instanceGroupManagerActionPatch map[string]interface{}) *UpdateInstanceGroupManagerActionOptions { + return &UpdateInstanceGroupManagerActionOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + InstanceGroupManagerActionPatch: instanceGroupManagerActionPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerActionOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *UpdateInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupManagerActionOptions) SetID(id string) *UpdateInstanceGroupManagerActionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupManagerActionPatch : Allow user to set InstanceGroupManagerActionPatch +func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupManagerActionPatch(instanceGroupManagerActionPatch map[string]interface{}) *UpdateInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerActionOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupManagerOptions : The UpdateInstanceGroupManager options. +type UpdateInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group manager patch. + InstanceGroupManagerPatch map[string]interface{} `json:"InstanceGroupManager_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupManagerOptions : Instantiate UpdateInstanceGroupManagerOptions +func (*VpcV1) NewUpdateInstanceGroupManagerOptions(instanceGroupID string, id string, instanceGroupManagerPatch map[string]interface{}) *UpdateInstanceGroupManagerOptions { + return &UpdateInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + InstanceGroupManagerPatch: instanceGroupManagerPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *UpdateInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupManagerOptions) SetID(id string) *UpdateInstanceGroupManagerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupManagerPatch : Allow user to set InstanceGroupManagerPatch +func (_options *UpdateInstanceGroupManagerOptions) SetInstanceGroupManagerPatch(instanceGroupManagerPatch map[string]interface{}) *UpdateInstanceGroupManagerOptions { + _options.InstanceGroupManagerPatch = instanceGroupManagerPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupManagerOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupManagerPolicyOptions : The UpdateInstanceGroupManagerPolicy options. +type UpdateInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group manager policy patch. + InstanceGroupManagerPolicyPatch map[string]interface{} `json:"InstanceGroupManagerPolicy_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupManagerPolicyOptions : Instantiate UpdateInstanceGroupManagerPolicyOptions +func (*VpcV1) NewUpdateInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string, instanceGroupManagerPolicyPatch map[string]interface{}) *UpdateInstanceGroupManagerPolicyOptions { + return &UpdateInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + InstanceGroupManagerPolicyPatch: instanceGroupManagerPolicyPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *UpdateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupManagerPolicyOptions) SetID(id string) *UpdateInstanceGroupManagerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupManagerPolicyPatch : Allow user to set InstanceGroupManagerPolicyPatch +func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerPolicyPatch(instanceGroupManagerPolicyPatch map[string]interface{}) *UpdateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupMembershipOptions : The UpdateInstanceGroupMembership options. +type UpdateInstanceGroupMembershipOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group membership identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group membership patch. + InstanceGroupMembershipPatch map[string]interface{} `json:"InstanceGroupMembership_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupMembershipOptions : Instantiate UpdateInstanceGroupMembershipOptions +func (*VpcV1) NewUpdateInstanceGroupMembershipOptions(instanceGroupID string, id string, instanceGroupMembershipPatch map[string]interface{}) *UpdateInstanceGroupMembershipOptions { + return &UpdateInstanceGroupMembershipOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + InstanceGroupMembershipPatch: instanceGroupMembershipPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *UpdateInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupMembershipOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupMembershipOptions) SetID(id string) *UpdateInstanceGroupMembershipOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupMembershipPatch : Allow user to set InstanceGroupMembershipPatch +func (_options *UpdateInstanceGroupMembershipOptions) SetInstanceGroupMembershipPatch(instanceGroupMembershipPatch map[string]interface{}) *UpdateInstanceGroupMembershipOptions { + _options.InstanceGroupMembershipPatch = instanceGroupMembershipPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupMembershipOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupOptions : The UpdateInstanceGroup options. +type UpdateInstanceGroupOptions struct { + // The instance group identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group patch. + InstanceGroupPatch map[string]interface{} `json:"InstanceGroup_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupOptions : Instantiate UpdateInstanceGroupOptions +func (*VpcV1) NewUpdateInstanceGroupOptions(id string, instanceGroupPatch map[string]interface{}) *UpdateInstanceGroupOptions { + return &UpdateInstanceGroupOptions{ + ID: core.StringPtr(id), + InstanceGroupPatch: instanceGroupPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupOptions) SetID(id string) *UpdateInstanceGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupPatch : Allow user to set InstanceGroupPatch +func (_options *UpdateInstanceGroupOptions) SetInstanceGroupPatch(instanceGroupPatch map[string]interface{}) *UpdateInstanceGroupOptions { + _options.InstanceGroupPatch = instanceGroupPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupOptions { + options.Headers = param + return options +} + +// UpdateInstanceNetworkInterfaceOptions : The UpdateInstanceNetworkInterface options. +type UpdateInstanceNetworkInterfaceOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // The network interface patch. + NetworkInterfacePatch map[string]interface{} `json:"NetworkInterface_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceNetworkInterfaceOptions : Instantiate UpdateInstanceNetworkInterfaceOptions +func (*VpcV1) NewUpdateInstanceNetworkInterfaceOptions(instanceID string, id string, networkInterfacePatch map[string]interface{}) *UpdateInstanceNetworkInterfaceOptions { + return &UpdateInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + NetworkInterfacePatch: networkInterfacePatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *UpdateInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *UpdateInstanceNetworkInterfaceOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceNetworkInterfaceOptions) SetID(id string) *UpdateInstanceNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetNetworkInterfacePatch : Allow user to set NetworkInterfacePatch +func (_options *UpdateInstanceNetworkInterfaceOptions) SetNetworkInterfacePatch(networkInterfacePatch map[string]interface{}) *UpdateInstanceNetworkInterfaceOptions { + _options.NetworkInterfacePatch = networkInterfacePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// UpdateInstanceOptions : The UpdateInstance options. +type UpdateInstanceOptions struct { + // The instance identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance patch. + InstancePatch map[string]interface{} `json:"Instance_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceOptions : Instantiate UpdateInstanceOptions +func (*VpcV1) NewUpdateInstanceOptions(id string, instancePatch map[string]interface{}) *UpdateInstanceOptions { + return &UpdateInstanceOptions{ + ID: core.StringPtr(id), + InstancePatch: instancePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceOptions) SetID(id string) *UpdateInstanceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstancePatch : Allow user to set InstancePatch +func (_options *UpdateInstanceOptions) SetInstancePatch(instancePatch map[string]interface{}) *UpdateInstanceOptions { + _options.InstancePatch = instancePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceOptions) SetHeaders(param map[string]string) *UpdateInstanceOptions { + options.Headers = param + return options +} + +// UpdateInstanceTemplateOptions : The UpdateInstanceTemplate options. +type UpdateInstanceTemplateOptions struct { + // The instance template identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance template patch. + InstanceTemplatePatch map[string]interface{} `json:"InstanceTemplate_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceTemplateOptions : Instantiate UpdateInstanceTemplateOptions +func (*VpcV1) NewUpdateInstanceTemplateOptions(id string, instanceTemplatePatch map[string]interface{}) *UpdateInstanceTemplateOptions { + return &UpdateInstanceTemplateOptions{ + ID: core.StringPtr(id), + InstanceTemplatePatch: instanceTemplatePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceTemplateOptions) SetID(id string) *UpdateInstanceTemplateOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceTemplatePatch : Allow user to set InstanceTemplatePatch +func (_options *UpdateInstanceTemplateOptions) SetInstanceTemplatePatch(instanceTemplatePatch map[string]interface{}) *UpdateInstanceTemplateOptions { + _options.InstanceTemplatePatch = instanceTemplatePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceTemplateOptions) SetHeaders(param map[string]string) *UpdateInstanceTemplateOptions { + options.Headers = param + return options +} + +// UpdateInstanceVolumeAttachmentOptions : The UpdateInstanceVolumeAttachment options. +type UpdateInstanceVolumeAttachmentOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The volume attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // The volume attachment patch. + VolumeAttachmentPatch map[string]interface{} `json:"VolumeAttachment_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceVolumeAttachmentOptions : Instantiate UpdateInstanceVolumeAttachmentOptions +func (*VpcV1) NewUpdateInstanceVolumeAttachmentOptions(instanceID string, id string, volumeAttachmentPatch map[string]interface{}) *UpdateInstanceVolumeAttachmentOptions { + return &UpdateInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + VolumeAttachmentPatch: volumeAttachmentPatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *UpdateInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceVolumeAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceVolumeAttachmentOptions) SetID(id string) *UpdateInstanceVolumeAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVolumeAttachmentPatch : Allow user to set VolumeAttachmentPatch +func (_options *UpdateInstanceVolumeAttachmentOptions) SetVolumeAttachmentPatch(volumeAttachmentPatch map[string]interface{}) *UpdateInstanceVolumeAttachmentOptions { + _options.VolumeAttachmentPatch = volumeAttachmentPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// UpdateIpsecPolicyOptions : The UpdateIpsecPolicy options. +type UpdateIpsecPolicyOptions struct { + // The IPsec policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The IPsec policy patch. + IPsecPolicyPatch map[string]interface{} `json:"IPsecPolicy_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateIpsecPolicyOptions : Instantiate UpdateIpsecPolicyOptions +func (*VpcV1) NewUpdateIpsecPolicyOptions(id string, iPsecPolicyPatch map[string]interface{}) *UpdateIpsecPolicyOptions { + return &UpdateIpsecPolicyOptions{ + ID: core.StringPtr(id), + IPsecPolicyPatch: iPsecPolicyPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateIpsecPolicyOptions) SetID(id string) *UpdateIpsecPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIPsecPolicyPatch : Allow user to set IPsecPolicyPatch +func (_options *UpdateIpsecPolicyOptions) SetIPsecPolicyPatch(iPsecPolicyPatch map[string]interface{}) *UpdateIpsecPolicyOptions { + _options.IPsecPolicyPatch = iPsecPolicyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateIpsecPolicyOptions) SetHeaders(param map[string]string) *UpdateIpsecPolicyOptions { + options.Headers = param + return options +} + +// UpdateKeyOptions : The UpdateKey options. +type UpdateKeyOptions struct { + // The key identifier. + ID *string `json:"id" validate:"required,ne="` + + // The key patch. + KeyPatch map[string]interface{} `json:"Key_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateKeyOptions : Instantiate UpdateKeyOptions +func (*VpcV1) NewUpdateKeyOptions(id string, keyPatch map[string]interface{}) *UpdateKeyOptions { + return &UpdateKeyOptions{ + ID: core.StringPtr(id), + KeyPatch: keyPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateKeyOptions) SetID(id string) *UpdateKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetKeyPatch : Allow user to set KeyPatch +func (_options *UpdateKeyOptions) SetKeyPatch(keyPatch map[string]interface{}) *UpdateKeyOptions { + _options.KeyPatch = keyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateKeyOptions) SetHeaders(param map[string]string) *UpdateKeyOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerListenerOptions : The UpdateLoadBalancerListener options. +type UpdateLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ID *string `json:"id" validate:"required,ne="` + + // The load balancer listener patch. + LoadBalancerListenerPatch map[string]interface{} `json:"LoadBalancerListener_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerListenerOptions : Instantiate UpdateLoadBalancerListenerOptions +func (*VpcV1) NewUpdateLoadBalancerListenerOptions(loadBalancerID string, id string, loadBalancerListenerPatch map[string]interface{}) *UpdateLoadBalancerListenerOptions { + return &UpdateLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + LoadBalancerListenerPatch: loadBalancerListenerPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerListenerOptions) SetID(id string) *UpdateLoadBalancerListenerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerListenerPatch : Allow user to set LoadBalancerListenerPatch +func (_options *UpdateLoadBalancerListenerOptions) SetLoadBalancerListenerPatch(loadBalancerListenerPatch map[string]interface{}) *UpdateLoadBalancerListenerOptions { + _options.LoadBalancerListenerPatch = loadBalancerListenerPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerListenerOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerListenerPolicyOptions : The UpdateLoadBalancerListenerPolicy options. +type UpdateLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The listener policy patch. + LoadBalancerListenerPolicyPatch map[string]interface{} `json:"LoadBalancerListenerPolicy_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerListenerPolicyOptions : Instantiate UpdateLoadBalancerListenerPolicyOptions +func (*VpcV1) NewUpdateLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string, loadBalancerListenerPolicyPatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyOptions { + return &UpdateLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + ID: core.StringPtr(id), + LoadBalancerListenerPolicyPatch: loadBalancerListenerPolicyPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerPolicyOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *UpdateLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *UpdateLoadBalancerListenerPolicyOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerListenerPolicyOptions) SetID(id string) *UpdateLoadBalancerListenerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerListenerPolicyPatch : Allow user to set LoadBalancerListenerPolicyPatch +func (_options *UpdateLoadBalancerListenerPolicyOptions) SetLoadBalancerListenerPolicyPatch(loadBalancerListenerPolicyPatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyOptions { + _options.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerListenerPolicyRuleOptions : The UpdateLoadBalancerListenerPolicyRule options. +type UpdateLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // The listener policy rule patch. + LoadBalancerListenerPolicyRulePatch map[string]interface{} `json:"LoadBalancerListenerPolicyRule_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerListenerPolicyRuleOptions : Instantiate UpdateLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewUpdateLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string, loadBalancerListenerPolicyRulePatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyRuleOptions { + return &UpdateLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + ID: core.StringPtr(id), + LoadBalancerListenerPolicyRulePatch: loadBalancerListenerPolicyRulePatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetID(id string) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerListenerPolicyRulePatch : Allow user to set LoadBalancerListenerPolicyRulePatch +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerListenerPolicyRulePatch(loadBalancerListenerPolicyRulePatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerOptions : The UpdateLoadBalancer options. +type UpdateLoadBalancerOptions struct { + // The load balancer identifier. + ID *string `json:"id" validate:"required,ne="` + + // The load balancer patch. + LoadBalancerPatch map[string]interface{} `json:"LoadBalancer_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerOptions : Instantiate UpdateLoadBalancerOptions +func (*VpcV1) NewUpdateLoadBalancerOptions(id string, loadBalancerPatch map[string]interface{}) *UpdateLoadBalancerOptions { + return &UpdateLoadBalancerOptions{ + ID: core.StringPtr(id), + LoadBalancerPatch: loadBalancerPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerOptions) SetID(id string) *UpdateLoadBalancerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerPatch : Allow user to set LoadBalancerPatch +func (_options *UpdateLoadBalancerOptions) SetLoadBalancerPatch(loadBalancerPatch map[string]interface{}) *UpdateLoadBalancerOptions { + _options.LoadBalancerPatch = loadBalancerPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerPoolMemberOptions : The UpdateLoadBalancerPoolMember options. +type UpdateLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The member identifier. + ID *string `json:"id" validate:"required,ne="` + + // The load balancer pool member patch. + LoadBalancerPoolMemberPatch map[string]interface{} `json:"LoadBalancerPoolMember_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerPoolMemberOptions : Instantiate UpdateLoadBalancerPoolMemberOptions +func (*VpcV1) NewUpdateLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string, loadBalancerPoolMemberPatch map[string]interface{}) *UpdateLoadBalancerPoolMemberOptions { + return &UpdateLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + ID: core.StringPtr(id), + LoadBalancerPoolMemberPatch: loadBalancerPoolMemberPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerPoolMemberOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *UpdateLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *UpdateLoadBalancerPoolMemberOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerPoolMemberOptions) SetID(id string) *UpdateLoadBalancerPoolMemberOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerPoolMemberPatch : Allow user to set LoadBalancerPoolMemberPatch +func (_options *UpdateLoadBalancerPoolMemberOptions) SetLoadBalancerPoolMemberPatch(loadBalancerPoolMemberPatch map[string]interface{}) *UpdateLoadBalancerPoolMemberOptions { + _options.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerPoolOptions : The UpdateLoadBalancerPool options. +type UpdateLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + ID *string `json:"id" validate:"required,ne="` + + // The load balancer pool patch. + LoadBalancerPoolPatch map[string]interface{} `json:"LoadBalancerPool_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerPoolOptions : Instantiate UpdateLoadBalancerPoolOptions +func (*VpcV1) NewUpdateLoadBalancerPoolOptions(loadBalancerID string, id string, loadBalancerPoolPatch map[string]interface{}) *UpdateLoadBalancerPoolOptions { + return &UpdateLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + LoadBalancerPoolPatch: loadBalancerPoolPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerPoolOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerPoolOptions) SetID(id string) *UpdateLoadBalancerPoolOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerPoolPatch : Allow user to set LoadBalancerPoolPatch +func (_options *UpdateLoadBalancerPoolOptions) SetLoadBalancerPoolPatch(loadBalancerPoolPatch map[string]interface{}) *UpdateLoadBalancerPoolOptions { + _options.LoadBalancerPoolPatch = loadBalancerPoolPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerPoolOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// UpdateNetworkACLOptions : The UpdateNetworkACL options. +type UpdateNetworkACLOptions struct { + // The network ACL identifier. + ID *string `json:"id" validate:"required,ne="` + + // The network ACL patch. + NetworkACLPatch map[string]interface{} `json:"NetworkACL_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateNetworkACLOptions : Instantiate UpdateNetworkACLOptions +func (*VpcV1) NewUpdateNetworkACLOptions(id string, networkACLPatch map[string]interface{}) *UpdateNetworkACLOptions { + return &UpdateNetworkACLOptions{ + ID: core.StringPtr(id), + NetworkACLPatch: networkACLPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateNetworkACLOptions) SetID(id string) *UpdateNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetNetworkACLPatch : Allow user to set NetworkACLPatch +func (_options *UpdateNetworkACLOptions) SetNetworkACLPatch(networkACLPatch map[string]interface{}) *UpdateNetworkACLOptions { + _options.NetworkACLPatch = networkACLPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateNetworkACLOptions) SetHeaders(param map[string]string) *UpdateNetworkACLOptions { + options.Headers = param + return options +} + +// UpdateNetworkACLRuleOptions : The UpdateNetworkACLRule options. +type UpdateNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // The network ACL rule patch. + NetworkACLRulePatch map[string]interface{} `json:"NetworkACLRule_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateNetworkACLRuleOptions : Instantiate UpdateNetworkACLRuleOptions +func (*VpcV1) NewUpdateNetworkACLRuleOptions(networkACLID string, id string, networkACLRulePatch map[string]interface{}) *UpdateNetworkACLRuleOptions { + return &UpdateNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + ID: core.StringPtr(id), + NetworkACLRulePatch: networkACLRulePatch, + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *UpdateNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *UpdateNetworkACLRuleOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateNetworkACLRuleOptions) SetID(id string) *UpdateNetworkACLRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetNetworkACLRulePatch : Allow user to set NetworkACLRulePatch +func (_options *UpdateNetworkACLRuleOptions) SetNetworkACLRulePatch(networkACLRulePatch map[string]interface{}) *UpdateNetworkACLRuleOptions { + _options.NetworkACLRulePatch = networkACLRulePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateNetworkACLRuleOptions) SetHeaders(param map[string]string) *UpdateNetworkACLRuleOptions { + options.Headers = param + return options +} + +// UpdatePlacementGroupOptions : The UpdatePlacementGroup options. +type UpdatePlacementGroupOptions struct { + // The placement group identifier. + ID *string `json:"id" validate:"required,ne="` + + // The placement group patch. + PlacementGroupPatch map[string]interface{} `json:"PlacementGroup_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdatePlacementGroupOptions : Instantiate UpdatePlacementGroupOptions +func (*VpcV1) NewUpdatePlacementGroupOptions(id string, placementGroupPatch map[string]interface{}) *UpdatePlacementGroupOptions { + return &UpdatePlacementGroupOptions{ + ID: core.StringPtr(id), + PlacementGroupPatch: placementGroupPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdatePlacementGroupOptions) SetID(id string) *UpdatePlacementGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetPlacementGroupPatch : Allow user to set PlacementGroupPatch +func (_options *UpdatePlacementGroupOptions) SetPlacementGroupPatch(placementGroupPatch map[string]interface{}) *UpdatePlacementGroupOptions { + _options.PlacementGroupPatch = placementGroupPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdatePlacementGroupOptions) SetHeaders(param map[string]string) *UpdatePlacementGroupOptions { + options.Headers = param + return options +} + +// UpdatePublicGatewayOptions : The UpdatePublicGateway options. +type UpdatePublicGatewayOptions struct { + // The public gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // The public gateway patch. + PublicGatewayPatch map[string]interface{} `json:"PublicGateway_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdatePublicGatewayOptions : Instantiate UpdatePublicGatewayOptions +func (*VpcV1) NewUpdatePublicGatewayOptions(id string, publicGatewayPatch map[string]interface{}) *UpdatePublicGatewayOptions { + return &UpdatePublicGatewayOptions{ + ID: core.StringPtr(id), + PublicGatewayPatch: publicGatewayPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdatePublicGatewayOptions) SetID(id string) *UpdatePublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetPublicGatewayPatch : Allow user to set PublicGatewayPatch +func (_options *UpdatePublicGatewayOptions) SetPublicGatewayPatch(publicGatewayPatch map[string]interface{}) *UpdatePublicGatewayOptions { + _options.PublicGatewayPatch = publicGatewayPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdatePublicGatewayOptions) SetHeaders(param map[string]string) *UpdatePublicGatewayOptions { + options.Headers = param + return options +} + +// UpdateSecurityGroupOptions : The UpdateSecurityGroup options. +type UpdateSecurityGroupOptions struct { + // The security group identifier. + ID *string `json:"id" validate:"required,ne="` + + // The security group patch. + SecurityGroupPatch map[string]interface{} `json:"SecurityGroup_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSecurityGroupOptions : Instantiate UpdateSecurityGroupOptions +func (*VpcV1) NewUpdateSecurityGroupOptions(id string, securityGroupPatch map[string]interface{}) *UpdateSecurityGroupOptions { + return &UpdateSecurityGroupOptions{ + ID: core.StringPtr(id), + SecurityGroupPatch: securityGroupPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateSecurityGroupOptions) SetID(id string) *UpdateSecurityGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSecurityGroupPatch : Allow user to set SecurityGroupPatch +func (_options *UpdateSecurityGroupOptions) SetSecurityGroupPatch(securityGroupPatch map[string]interface{}) *UpdateSecurityGroupOptions { + _options.SecurityGroupPatch = securityGroupPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSecurityGroupOptions) SetHeaders(param map[string]string) *UpdateSecurityGroupOptions { + options.Headers = param + return options +} + +// UpdateSecurityGroupRuleOptions : The UpdateSecurityGroupRule options. +type UpdateSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // The security group rule patch. + SecurityGroupRulePatch map[string]interface{} `json:"SecurityGroupRule_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSecurityGroupRuleOptions : Instantiate UpdateSecurityGroupRuleOptions +func (*VpcV1) NewUpdateSecurityGroupRuleOptions(securityGroupID string, id string, securityGroupRulePatch map[string]interface{}) *UpdateSecurityGroupRuleOptions { + return &UpdateSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + SecurityGroupRulePatch: securityGroupRulePatch, + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *UpdateSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *UpdateSecurityGroupRuleOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateSecurityGroupRuleOptions) SetID(id string) *UpdateSecurityGroupRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSecurityGroupRulePatch : Allow user to set SecurityGroupRulePatch +func (_options *UpdateSecurityGroupRuleOptions) SetSecurityGroupRulePatch(securityGroupRulePatch map[string]interface{}) *UpdateSecurityGroupRuleOptions { + _options.SecurityGroupRulePatch = securityGroupRulePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSecurityGroupRuleOptions) SetHeaders(param map[string]string) *UpdateSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// UpdateSnapshotOptions : The UpdateSnapshot options. +type UpdateSnapshotOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // The snapshot patch. + SnapshotPatch map[string]interface{} `json:"Snapshot_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 +} + +// NewUpdateSnapshotOptions : Instantiate UpdateSnapshotOptions +func (*VpcV1) NewUpdateSnapshotOptions(id string, snapshotPatch map[string]interface{}) *UpdateSnapshotOptions { + return &UpdateSnapshotOptions{ + ID: core.StringPtr(id), + SnapshotPatch: snapshotPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateSnapshotOptions) SetID(id string) *UpdateSnapshotOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSnapshotPatch : Allow user to set SnapshotPatch +func (_options *UpdateSnapshotOptions) SetSnapshotPatch(snapshotPatch map[string]interface{}) *UpdateSnapshotOptions { + _options.SnapshotPatch = snapshotPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateSnapshotOptions) SetIfMatch(ifMatch string) *UpdateSnapshotOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSnapshotOptions) SetHeaders(param map[string]string) *UpdateSnapshotOptions { + options.Headers = param + return options +} + +// UpdateSubnetOptions : The UpdateSubnet options. +type UpdateSubnetOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The subnet patch. + SubnetPatch map[string]interface{} `json:"Subnet_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSubnetOptions : Instantiate UpdateSubnetOptions +func (*VpcV1) NewUpdateSubnetOptions(id string, subnetPatch map[string]interface{}) *UpdateSubnetOptions { + return &UpdateSubnetOptions{ + ID: core.StringPtr(id), + SubnetPatch: subnetPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateSubnetOptions) SetID(id string) *UpdateSubnetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSubnetPatch : Allow user to set SubnetPatch +func (_options *UpdateSubnetOptions) SetSubnetPatch(subnetPatch map[string]interface{}) *UpdateSubnetOptions { + _options.SubnetPatch = subnetPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSubnetOptions) SetHeaders(param map[string]string) *UpdateSubnetOptions { + options.Headers = param + return options +} + +// UpdateSubnetReservedIPOptions : The UpdateSubnetReservedIP options. +type UpdateSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `json:"subnet_id" validate:"required,ne="` + + // The reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // The reserved IP patch. + ReservedIPPatch map[string]interface{} `json:"ReservedIP_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSubnetReservedIPOptions : Instantiate UpdateSubnetReservedIPOptions +func (*VpcV1) NewUpdateSubnetReservedIPOptions(subnetID string, id string, reservedIPPatch map[string]interface{}) *UpdateSubnetReservedIPOptions { + return &UpdateSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + ID: core.StringPtr(id), + ReservedIPPatch: reservedIPPatch, + } +} + +// SetSubnetID : Allow user to set SubnetID +func (_options *UpdateSubnetReservedIPOptions) SetSubnetID(subnetID string) *UpdateSubnetReservedIPOptions { + _options.SubnetID = core.StringPtr(subnetID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateSubnetReservedIPOptions) SetID(id string) *UpdateSubnetReservedIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetReservedIPPatch : Allow user to set ReservedIPPatch +func (_options *UpdateSubnetReservedIPOptions) SetReservedIPPatch(reservedIPPatch map[string]interface{}) *UpdateSubnetReservedIPOptions { + _options.ReservedIPPatch = reservedIPPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSubnetReservedIPOptions) SetHeaders(param map[string]string) *UpdateSubnetReservedIPOptions { + options.Headers = param + return options +} + +// UpdateVolumeOptions : The UpdateVolume options. +type UpdateVolumeOptions struct { + // The volume identifier. + ID *string `json:"id" validate:"required,ne="` + + // The volume patch. + VolumePatch map[string]interface{} `json:"Volume_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 +} + +// NewUpdateVolumeOptions : Instantiate UpdateVolumeOptions +func (*VpcV1) NewUpdateVolumeOptions(id string, volumePatch map[string]interface{}) *UpdateVolumeOptions { + return &UpdateVolumeOptions{ + ID: core.StringPtr(id), + VolumePatch: volumePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVolumeOptions) SetID(id string) *UpdateVolumeOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVolumePatch : Allow user to set VolumePatch +func (_options *UpdateVolumeOptions) SetVolumePatch(volumePatch map[string]interface{}) *UpdateVolumeOptions { + _options.VolumePatch = volumePatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVolumeOptions) SetIfMatch(ifMatch string) *UpdateVolumeOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVolumeOptions) SetHeaders(param map[string]string) *UpdateVolumeOptions { + options.Headers = param + return options +} + +// UpdateVPCAddressPrefixOptions : The UpdateVPCAddressPrefix options. +type UpdateVPCAddressPrefixOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The prefix identifier. + ID *string `json:"id" validate:"required,ne="` + + // The prefix patch. + AddressPrefixPatch map[string]interface{} `json:"AddressPrefix_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCAddressPrefixOptions : Instantiate UpdateVPCAddressPrefixOptions +func (*VpcV1) NewUpdateVPCAddressPrefixOptions(vpcID string, id string, addressPrefixPatch map[string]interface{}) *UpdateVPCAddressPrefixOptions { + return &UpdateVPCAddressPrefixOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + AddressPrefixPatch: addressPrefixPatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCAddressPrefixOptions) SetVPCID(vpcID string) *UpdateVPCAddressPrefixOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCAddressPrefixOptions) SetID(id string) *UpdateVPCAddressPrefixOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetAddressPrefixPatch : Allow user to set AddressPrefixPatch +func (_options *UpdateVPCAddressPrefixOptions) SetAddressPrefixPatch(addressPrefixPatch map[string]interface{}) *UpdateVPCAddressPrefixOptions { + _options.AddressPrefixPatch = addressPrefixPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCAddressPrefixOptions) SetHeaders(param map[string]string) *UpdateVPCAddressPrefixOptions { + options.Headers = param + return options +} + +// UpdateVPCOptions : The UpdateVPC options. +type UpdateVPCOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPC patch. + VPCPatch map[string]interface{} `json:"VPC_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCOptions : Instantiate UpdateVPCOptions +func (*VpcV1) NewUpdateVPCOptions(id string, vpcPatch map[string]interface{}) *UpdateVPCOptions { + return &UpdateVPCOptions{ + ID: core.StringPtr(id), + VPCPatch: vpcPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCOptions) SetID(id string) *UpdateVPCOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPCPatch : Allow user to set VPCPatch +func (_options *UpdateVPCOptions) SetVPCPatch(vpcPatch map[string]interface{}) *UpdateVPCOptions { + _options.VPCPatch = vpcPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCOptions) SetHeaders(param map[string]string) *UpdateVPCOptions { + options.Headers = param + return options +} + +// UpdateVPCRouteOptions : The UpdateVPCRoute options. +type UpdateVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The route identifier. + ID *string `json:"id" validate:"required,ne="` + + // The route patch. + RoutePatch map[string]interface{} `json:"Route_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCRouteOptions : Instantiate UpdateVPCRouteOptions +func (*VpcV1) NewUpdateVPCRouteOptions(vpcID string, id string, routePatch map[string]interface{}) *UpdateVPCRouteOptions { + return &UpdateVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + RoutePatch: routePatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCRouteOptions) SetVPCID(vpcID string) *UpdateVPCRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCRouteOptions) SetID(id string) *UpdateVPCRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRoutePatch : Allow user to set RoutePatch +func (_options *UpdateVPCRouteOptions) SetRoutePatch(routePatch map[string]interface{}) *UpdateVPCRouteOptions { + _options.RoutePatch = routePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCRouteOptions) SetHeaders(param map[string]string) *UpdateVPCRouteOptions { + options.Headers = param + return options +} + +// UpdateVPCRoutingTableOptions : The UpdateVPCRoutingTable options. +type UpdateVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + ID *string `json:"id" validate:"required,ne="` + + // The routing table patch. + RoutingTablePatch map[string]interface{} `json:"RoutingTable_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 +} + +// NewUpdateVPCRoutingTableOptions : Instantiate UpdateVPCRoutingTableOptions +func (*VpcV1) NewUpdateVPCRoutingTableOptions(vpcID string, id string, routingTablePatch map[string]interface{}) *UpdateVPCRoutingTableOptions { + return &UpdateVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + RoutingTablePatch: routingTablePatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCRoutingTableOptions) SetVPCID(vpcID string) *UpdateVPCRoutingTableOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCRoutingTableOptions) SetID(id string) *UpdateVPCRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRoutingTablePatch : Allow user to set RoutingTablePatch +func (_options *UpdateVPCRoutingTableOptions) SetRoutingTablePatch(routingTablePatch map[string]interface{}) *UpdateVPCRoutingTableOptions { + _options.RoutingTablePatch = routingTablePatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVPCRoutingTableOptions) SetIfMatch(ifMatch string) *UpdateVPCRoutingTableOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCRoutingTableOptions) SetHeaders(param map[string]string) *UpdateVPCRoutingTableOptions { + options.Headers = param + return options +} + +// UpdateVPCRoutingTableRouteOptions : The UpdateVPCRoutingTableRoute options. +type UpdateVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` + + // The VPC routing table route identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPC route patch. + RoutePatch map[string]interface{} `json:"Route_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCRoutingTableRouteOptions : Instantiate UpdateVPCRoutingTableRouteOptions +func (*VpcV1) NewUpdateVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string, routePatch map[string]interface{}) *UpdateVPCRoutingTableRouteOptions { + return &UpdateVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + ID: core.StringPtr(id), + RoutePatch: routePatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *UpdateVPCRoutingTableRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *UpdateVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *UpdateVPCRoutingTableRouteOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCRoutingTableRouteOptions) SetID(id string) *UpdateVPCRoutingTableRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRoutePatch : Allow user to set RoutePatch +func (_options *UpdateVPCRoutingTableRouteOptions) SetRoutePatch(routePatch map[string]interface{}) *UpdateVPCRoutingTableRouteOptions { + _options.RoutePatch = routePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *UpdateVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// UpdateVPNGatewayConnectionOptions : The UpdateVPNGatewayConnection options. +type UpdateVPNGatewayConnectionOptions 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 VPN gateway connection patch. + VPNGatewayConnectionPatch map[string]interface{} `json:"VPNGatewayConnection_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPNGatewayConnectionOptions : Instantiate UpdateVPNGatewayConnectionOptions +func (*VpcV1) NewUpdateVPNGatewayConnectionOptions(vpnGatewayID string, id string, vpnGatewayConnectionPatch map[string]interface{}) *UpdateVPNGatewayConnectionOptions { + return &UpdateVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + VPNGatewayConnectionPatch: vpnGatewayConnectionPatch, + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *UpdateVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *UpdateVPNGatewayConnectionOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPNGatewayConnectionOptions) SetID(id string) *UpdateVPNGatewayConnectionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPNGatewayConnectionPatch : Allow user to set VPNGatewayConnectionPatch +func (_options *UpdateVPNGatewayConnectionOptions) SetVPNGatewayConnectionPatch(vpnGatewayConnectionPatch map[string]interface{}) *UpdateVPNGatewayConnectionOptions { + _options.VPNGatewayConnectionPatch = vpnGatewayConnectionPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *UpdateVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// UpdateVPNGatewayOptions : The UpdateVPNGateway options. +type UpdateVPNGatewayOptions struct { + // The VPN gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPN gateway patch. + VPNGatewayPatch map[string]interface{} `json:"VPNGateway_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPNGatewayOptions : Instantiate UpdateVPNGatewayOptions +func (*VpcV1) NewUpdateVPNGatewayOptions(id string, vpnGatewayPatch map[string]interface{}) *UpdateVPNGatewayOptions { + return &UpdateVPNGatewayOptions{ + ID: core.StringPtr(id), + VPNGatewayPatch: vpnGatewayPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVPNGatewayOptions) SetID(id string) *UpdateVPNGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPNGatewayPatch : Allow user to set VPNGatewayPatch +func (_options *UpdateVPNGatewayOptions) SetVPNGatewayPatch(vpnGatewayPatch map[string]interface{}) *UpdateVPNGatewayOptions { + _options.VPNGatewayPatch = vpnGatewayPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNGatewayOptions) SetHeaders(param map[string]string) *UpdateVPNGatewayOptions { + options.Headers = param + return options +} + +// UpdateVPNServerOptions : The UpdateVPNServer options. +type UpdateVPNServerOptions struct { + // The VPN server identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPN server patch. + VPNServerPatch map[string]interface{} `json:"VPNServer_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 +} + +// NewUpdateVPNServerOptions : Instantiate UpdateVPNServerOptions +func (*VpcV1) NewUpdateVPNServerOptions(id string, vpnServerPatch map[string]interface{}) *UpdateVPNServerOptions { + return &UpdateVPNServerOptions{ + ID: core.StringPtr(id), + VPNServerPatch: vpnServerPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVPNServerOptions) SetID(id string) *UpdateVPNServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPNServerPatch : Allow user to set VPNServerPatch +func (_options *UpdateVPNServerOptions) SetVPNServerPatch(vpnServerPatch map[string]interface{}) *UpdateVPNServerOptions { + _options.VPNServerPatch = vpnServerPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVPNServerOptions) SetIfMatch(ifMatch string) *UpdateVPNServerOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNServerOptions) SetHeaders(param map[string]string) *UpdateVPNServerOptions { + options.Headers = param + return options +} + +// UpdateVPNServerRouteOptions : The UpdateVPNServerRoute options. +type UpdateVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN route identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPN route patch. + VPNServerRoutePatch map[string]interface{} `json:"VPNServerRoute_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPNServerRouteOptions : Instantiate UpdateVPNServerRouteOptions +func (*VpcV1) NewUpdateVPNServerRouteOptions(vpnServerID string, id string, vpnServerRoutePatch map[string]interface{}) *UpdateVPNServerRouteOptions { + return &UpdateVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + VPNServerRoutePatch: vpnServerRoutePatch, + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *UpdateVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *UpdateVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPNServerRouteOptions) SetID(id string) *UpdateVPNServerRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPNServerRoutePatch : Allow user to set VPNServerRoutePatch +func (_options *UpdateVPNServerRouteOptions) SetVPNServerRoutePatch(vpnServerRoutePatch map[string]interface{}) *UpdateVPNServerRouteOptions { + _options.VPNServerRoutePatch = vpnServerRoutePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNServerRouteOptions) SetHeaders(param map[string]string) *UpdateVPNServerRouteOptions { + options.Headers = param + return options +} + +// Vcpu : The VCPU configuration. +type Vcpu struct { + // The VCPU architecture. + Architecture *string `json:"architecture" validate:"required"` + + // The number of VCPUs assigned. + Count *int64 `json:"count" validate:"required"` +} + +// UnmarshalVcpu unmarshals an instance of Vcpu from the specified map of raw messages. +func UnmarshalVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Vcpu) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPC : VPC struct +type VPC struct { + // Indicates whether this VPC is connected to Classic Infrastructure. If true, this VPC's resources 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. + ClassicAccess *bool `json:"classic_access" validate:"required"` + + // The date and time that the VPC was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // The CSE ([Cloud Service Endpoint](https://cloud.ibm.com/docs/resources?topic=resources-service-endpoints)) source IP + // addresses for the VPC. The VPC will have one CSE source IP address per zone. + CseSourceIps []VpccseSourceIP `json:"cse_source_ips,omitempty"` + + // The default network ACL to use for subnets created in this VPC. + DefaultNetworkACL *NetworkACLReference `json:"default_network_acl" validate:"required"` + + // The default routing table to use for subnets created in this VPC. + DefaultRoutingTable *RoutingTableReference `json:"default_routing_table" validate:"required"` + + // The default security group to use for network interfaces created in this VPC. + DefaultSecurityGroup *SecurityGroupReference `json:"default_security_group" validate:"required"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPC. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of this VPC. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the VPC.ResourceType property. +// The resource type. +const ( + VPCResourceTypeVPCConst = "vpc" +) + +// Constants associated with the VPC.Status property. +// The status of this VPC. +const ( + VPCStatusAvailableConst = "available" + VPCStatusDeletingConst = "deleting" + VPCStatusFailedConst = "failed" + VPCStatusPendingConst = "pending" +) + +// UnmarshalVPC unmarshals an instance of VPC from the specified map of raw messages. +func UnmarshalVPC(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPC) + err = core.UnmarshalPrimitive(m, "classic_access", &obj.ClassicAccess) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cse_source_ips", &obj.CseSourceIps, UnmarshalVpccseSourceIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_network_acl", &obj.DefaultNetworkACL, UnmarshalNetworkACLReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_routing_table", &obj.DefaultRoutingTable, UnmarshalRoutingTableReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_security_group", &obj.DefaultSecurityGroup, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpccseSourceIP : VpccseSourceIP struct +type VpccseSourceIP struct { + // The cloud service endpoint source IP address for this zone. + IP *IP `json:"ip" validate:"required"` + + // The zone this cloud service endpoint source IP resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalVpccseSourceIP unmarshals an instance of VpccseSourceIP from the specified map of raw messages. +func UnmarshalVpccseSourceIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpccseSourceIP) + err = core.UnmarshalModel(m, "ip", &obj.IP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCCollection : VPCCollection struct +type VPCCollection struct { + // A link to the first page of resources. + First *VPCCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of VPCs. + Vpcs []VPC `json:"vpcs" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPCCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpcs", &obj.Vpcs, UnmarshalVPC) + if err != nil { + 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 *VPCCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentity : Identifies a VPC by a unique property. +// Models which "extend" this model: +// - VPCIdentityByID +// - VPCIdentityByCRN +// - VPCIdentityByHref +type VPCIdentity struct { + // The unique identifier for this VPC. + ID *string `json:"id,omitempty"` + + // The CRN for this VPC. + CRN *string `json:"crn,omitempty"` + + // The URL for this VPC. + Href *string `json:"href,omitempty"` +} + +func (*VPCIdentity) isaVPCIdentity() bool { + return true +} + +type VPCIdentityIntf interface { + isaVPCIdentity() bool +} + +// UnmarshalVPCIdentity unmarshals an instance of VPCIdentity from the specified map of raw messages. +func UnmarshalVPCIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCPatch : VPCPatch struct +type VPCPatch struct { + // The unique user-defined name for this VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVPCPatch unmarshals an instance of VPCPatch from the specified map of raw messages. +func UnmarshalVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VPCReference : VPCReference struct +type VPCReference struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPCReference.ResourceType property. +// The resource type. +const ( + VPCReferenceResourceTypeVPCConst = "vpc" +) + +// UnmarshalVPCReference unmarshals an instance of VPCReference from the specified map of raw messages. +func UnmarshalVPCReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPCReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPCReferenceDeleted unmarshals an instance of VPCReferenceDeleted from the specified map of raw messages. +func UnmarshalVPCReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGateway : VPNGateway struct +// Models which "extend" this model: +// - VPNGatewayRouteMode +// - VPNGatewayPolicyMode +type VPNGateway struct { + // Connections for this VPN gateway. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The user-defined name for this VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPN gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the VPN gateway. + Status *string `json:"status" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGateway.ResourceType property. +// The resource type. +const ( + VPNGatewayResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGateway.Status property. +// The status of the VPN gateway. +const ( + VPNGatewayStatusAvailableConst = "available" + VPNGatewayStatusDeletingConst = "deleting" + VPNGatewayStatusFailedConst = "failed" + VPNGatewayStatusPendingConst = "pending" +) + +// Constants associated with the VPNGateway.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayModeRouteConst = "route" +) + +func (*VPNGateway) isaVPNGateway() bool { + return true +} + +type VPNGatewayIntf interface { + isaVPNGateway() bool +} + +// UnmarshalVPNGateway unmarshals an instance of VPNGateway from the specified map of raw messages. +func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGateway) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayCollection : VPNGatewayCollection struct +type VPNGatewayCollection struct { + // A link to the first page of resources. + First *VPNGatewayCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of VPN gateways. + VPNGateways []VPNGatewayIntf `json:"vpn_gateways" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNGatewayCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpn_gateways", &obj.VPNGateways, UnmarshalVPNGateway) + if err != nil { + 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 *VPNGatewayCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnection : VPNGatewayConnection struct +// Models which "extend" this model: +// - VPNGatewayConnectionStaticRouteMode +// - VPNGatewayConnectionPolicyMode +type VPNGatewayConnection struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The IKE policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // The IPsec policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name" validate:"required"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` + + // The VPN tunnel configuration for this VPN gateway connection (in static route mode). + Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels,omitempty"` + + // The local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs,omitempty"` + + // The peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs,omitempty"` +} + +// Constants associated with the VPNGatewayConnection.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnection.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionModePolicyConst = "policy" + VPNGatewayConnectionModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnection.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnection.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionStatusDownConst = "down" + VPNGatewayConnectionStatusUpConst = "up" +) + +// Constants associated with the VPNGatewayConnection.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnection) isaVPNGatewayConnection() bool { + return true +} + +type VPNGatewayConnectionIntf interface { + isaVPNGatewayConnection() bool +} + +// UnmarshalVPNGatewayConnection unmarshals an instance of VPNGatewayConnection from the specified map of raw messages. +func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnection) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionCollection : Collection of VPN gateway connections in a VPN gateway. +type VPNGatewayConnectionCollection struct { + // Array of VPN gateway connections. + Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionCollection unmarshals an instance of VPNGatewayConnectionCollection from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionCollection) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDpd : The Dead Peer Detection settings. +type VPNGatewayConnectionDpd struct { + // Dead Peer Detection actions. + Action *string `json:"action" validate:"required"` + + // Dead Peer Detection interval in seconds. + Interval *int64 `json:"interval" validate:"required"` + + // Dead Peer Detection timeout in seconds. Must be at least the interval. + Timeout *int64 `json:"timeout" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionDpd.Action property. +// Dead Peer Detection actions. +const ( + VPNGatewayConnectionDpdActionClearConst = "clear" + VPNGatewayConnectionDpdActionHoldConst = "hold" + VPNGatewayConnectionDpdActionNoneConst = "none" + VPNGatewayConnectionDpdActionRestartConst = "restart" +) + +// UnmarshalVPNGatewayConnectionDpd unmarshals an instance of VPNGatewayConnectionDpd from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDpd(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDpd) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDpdPatch : The Dead Peer Detection settings. +type VPNGatewayConnectionDpdPatch struct { + // Dead Peer Detection actions. + Action *string `json:"action,omitempty"` + + // Dead Peer Detection interval in seconds. + Interval *int64 `json:"interval,omitempty"` + + // Dead Peer Detection timeout in seconds. Must be at least the interval. + Timeout *int64 `json:"timeout,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionDpdPatch.Action property. +// Dead Peer Detection actions. +const ( + VPNGatewayConnectionDpdPatchActionClearConst = "clear" + VPNGatewayConnectionDpdPatchActionHoldConst = "hold" + VPNGatewayConnectionDpdPatchActionNoneConst = "none" + VPNGatewayConnectionDpdPatchActionRestartConst = "restart" +) + +// UnmarshalVPNGatewayConnectionDpdPatch unmarshals an instance of VPNGatewayConnectionDpdPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDpdPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDpdPatch) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDpdPrototype : The Dead Peer Detection settings. +type VPNGatewayConnectionDpdPrototype struct { + // Dead Peer Detection actions. + Action *string `json:"action,omitempty"` + + // Dead Peer Detection interval in seconds. + Interval *int64 `json:"interval,omitempty"` + + // Dead Peer Detection timeout in seconds. Must be at least the interval. + Timeout *int64 `json:"timeout,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionDpdPrototype.Action property. +// Dead Peer Detection actions. +const ( + VPNGatewayConnectionDpdPrototypeActionClearConst = "clear" + VPNGatewayConnectionDpdPrototypeActionHoldConst = "hold" + VPNGatewayConnectionDpdPrototypeActionNoneConst = "none" + VPNGatewayConnectionDpdPrototypeActionRestartConst = "restart" +) + +// UnmarshalVPNGatewayConnectionDpdPrototype unmarshals an instance of VPNGatewayConnectionDpdPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDpdPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPatch : The IKE policy to use. Specify `null` to remove any existing policy, [resulting in +// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). +// Models which "extend" this model: +// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID +// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref +type VPNGatewayConnectionIkePolicyPatch struct { + // The unique identifier for this IKE policy. + ID *string `json:"id,omitempty"` + + // The IKE policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIkePolicyPatch) isaVPNGatewayConnectionIkePolicyPatch() bool { + return true +} + +type VPNGatewayConnectionIkePolicyPatchIntf interface { + isaVPNGatewayConnectionIkePolicyPatch() bool +} + +// UnmarshalVPNGatewayConnectionIkePolicyPatch unmarshals an instance of VPNGatewayConnectionIkePolicyPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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: +// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID +// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref +type VPNGatewayConnectionIkePolicyPrototype struct { + // The unique identifier for this IKE policy. + ID *string `json:"id,omitempty"` + + // The IKE policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIkePolicyPrototype) isaVPNGatewayConnectionIkePolicyPrototype() bool { + return true +} + +type VPNGatewayConnectionIkePolicyPrototypeIntf interface { + isaVPNGatewayConnectionIkePolicyPrototype() bool +} + +// UnmarshalVPNGatewayConnectionIkePolicyPrototype unmarshals an instance of VPNGatewayConnectionIkePolicyPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPatch : The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in +// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). +// Models which "extend" this model: +// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID +// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref +type VPNGatewayConnectionIPsecPolicyPatch struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id,omitempty"` + + // The IPsec policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIPsecPolicyPatch) isaVPNGatewayConnectionIPsecPolicyPatch() bool { + return true +} + +type VPNGatewayConnectionIPsecPolicyPatchIntf interface { + isaVPNGatewayConnectionIPsecPolicyPatch() bool +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPatch unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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: +// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID +// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref +type VPNGatewayConnectionIPsecPolicyPrototype struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id,omitempty"` + + // The IPsec policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIPsecPolicyPrototype) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { + return true +} + +type VPNGatewayConnectionIPsecPolicyPrototypeIntf interface { + isaVPNGatewayConnectionIPsecPolicyPrototype() bool +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPrototype unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionLocalCIDRs : VPNGatewayConnectionLocalCIDRs struct +type VPNGatewayConnectionLocalCIDRs struct { + // The local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs,omitempty"` +} + +// UnmarshalVPNGatewayConnectionLocalCIDRs unmarshals an instance of VPNGatewayConnectionLocalCIDRs from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionLocalCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionLocalCIDRs) + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPatch : VPNGatewayConnectionPatch struct +// Models which "extend" this model: +// - VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch +type VPNGatewayConnectionPatch struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpdPatch `json:"dead_peer_detection,omitempty"` + + // The IKE policy to use. Specify `null` to remove any existing policy, [resulting in + // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy VPNGatewayConnectionIkePolicyPatchIntf `json:"ike_policy,omitempty"` + + // The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in + // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy VPNGatewayConnectionIPsecPolicyPatchIntf `json:"ipsec_policy,omitempty"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address,omitempty"` + + // The preshared key. + Psk *string `json:"psk,omitempty"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPatch.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPatchRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionPatch) isaVPNGatewayConnectionPatch() bool { + return true +} + +type VPNGatewayConnectionPatchIntf interface { + isaVPNGatewayConnectionPatch() bool +} + +// UnmarshalVPNGatewayConnectionPatch unmarshals an instance of VPNGatewayConnectionPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPatch) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VPNGatewayConnectionPeerCIDRs : VPNGatewayConnectionPeerCIDRs struct +type VPNGatewayConnectionPeerCIDRs struct { + // The peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs,omitempty"` +} + +// UnmarshalVPNGatewayConnectionPeerCIDRs unmarshals an instance of VPNGatewayConnectionPeerCIDRs from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerCIDRs) + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPrototype : VPNGatewayConnectionPrototype struct +// Models which "extend" this model: +// - VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype +// - VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype +type VPNGatewayConnectionPrototype struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + // 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). + IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` + + // 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). + IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` + + // The local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs,omitempty"` + + // The peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPrototype.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPrototypeRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionPrototype) isaVPNGatewayConnectionPrototype() bool { + return true +} + +type VPNGatewayConnectionPrototypeIntf interface { + isaVPNGatewayConnectionPrototype() bool +} + +// UnmarshalVPNGatewayConnectionPrototype unmarshals an instance of VPNGatewayConnectionPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPrototype) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionReference : VPNGatewayConnectionReference struct +type VPNGatewayConnectionReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this VPN connection. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionReference.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// UnmarshalVPNGatewayConnectionReference unmarshals an instance of VPNGatewayConnectionReference from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPNGatewayConnectionReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionReferenceDeleted unmarshals an instance of VPNGatewayConnectionReferenceDeleted from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModeTunnel : VPNGatewayConnectionStaticRouteModeTunnel struct +type VPNGatewayConnectionStaticRouteModeTunnel struct { + // The IP address of the VPN gateway member in which the tunnel resides. + PublicIP *IP `json:"public_ip" validate:"required"` + + // The status of the VPN Tunnel. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionStaticRouteModeTunnel.Status property. +// The status of the VPN Tunnel. +const ( + VPNGatewayConnectionStaticRouteModeTunnelStatusDownConst = "down" + VPNGatewayConnectionStaticRouteModeTunnelStatusUpConst = "up" +) + +// UnmarshalVPNGatewayConnectionStaticRouteModeTunnel unmarshals an instance of VPNGatewayConnectionStaticRouteModeTunnel from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModeTunnel) + err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayMember : VPNGatewayMember struct +type VPNGatewayMember struct { + // The private IP address assigned to the VPN gateway member. + // + // This property will be present only when the VPN gateway status is `available`. + PrivateIP *IP `json:"private_ip,omitempty"` + + // The public IP address assigned to the VPN gateway member. + PublicIP *IP `json:"public_ip" validate:"required"` + + // The high availability role assigned to the VPN gateway member. + Role *string `json:"role" validate:"required"` + + // The status of the VPN gateway member. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the VPNGatewayMember.Role property. +// The high availability role assigned to the VPN gateway member. +const ( + VPNGatewayMemberRoleActiveConst = "active" + VPNGatewayMemberRoleStandbyConst = "standby" +) + +// Constants associated with the VPNGatewayMember.Status property. +// The status of the VPN gateway member. +const ( + VPNGatewayMemberStatusAvailableConst = "available" + VPNGatewayMemberStatusDeletingConst = "deleting" + VPNGatewayMemberStatusFailedConst = "failed" + VPNGatewayMemberStatusPendingConst = "pending" +) + +// UnmarshalVPNGatewayMember unmarshals an instance of VPNGatewayMember from the specified map of raw messages. +func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayMember) + err = core.UnmarshalModel(m, "private_ip", &obj.PrivateIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "role", &obj.Role) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPatch : VPNGatewayPatch struct +type VPNGatewayPatch struct { + // The user-defined name for this VPN gateway. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVPNGatewayPatch unmarshals an instance of VPNGatewayPatch from the specified map of raw messages. +func UnmarshalVPNGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VPNGatewayPrototype : VPNGatewayPrototype struct +// Models which "extend" this model: +// - VPNGatewayPrototypeVPNGatewayRouteModePrototype +// - VPNGatewayPrototypeVPNGatewayPolicyModePrototype +type VPNGatewayPrototype struct { + // The user-defined name for this VPN gateway. + 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Identifies a subnet by a unique property. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototype.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayPrototypeModeRouteConst = "route" +) + +func (*VPNGatewayPrototype) isaVPNGatewayPrototype() bool { + return true +} + +type VPNGatewayPrototypeIntf interface { + isaVPNGatewayPrototype() bool +} + +// UnmarshalVPNGatewayPrototype unmarshals an instance of VPNGatewayPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPNGatewayReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPNGatewayReferenceDeleted unmarshals an instance of VPNGatewayReferenceDeleted from the specified map of raw messages. +func UnmarshalVPNGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServer : VPNServer struct +type VPNServer struct { + // The certificate instance for this VPN server. + Certificate *CertificateInstanceReference `json:"certificate" validate:"required"` + + // The methods used to authenticate VPN clients to this VPN server. VPN clients must authenticate against all specified + // methods. + ClientAuthentication []VPNServerAuthenticationIntf `json:"client_authentication" validate:"required"` + + // Indicates whether disconnected VPN clients will be automatically deleted after + // `client_auto_delete_timeout` hours have passed. At present, this is always `true`, but may be modifiable in the + // future. + ClientAutoDelete *bool `json:"client_auto_delete" validate:"required"` + + // If `client_auto_delete` is `true`, the hours after which disconnected VPN clients will be automatically deleted. If + // the value is `0`, disconnected VPN clients will be deleted immediately. This value may be modifiable in the future. + ClientAutoDeleteTimeout *int64 `json:"client_auto_delete_timeout" validate:"required"` + + // The DNS server addresses that will be provided to VPN clients that are connected to this VPN server. + ClientDnsServerIps []IP `json:"client_dns_server_ips" validate:"required"` + + // The seconds a VPN client can be idle before this VPN server will disconnect it. If `0`, the server will not + // disconnect idle clients. + ClientIdleTimeout *int64 `json:"client_idle_timeout" validate:"required"` + + // The VPN client IPv4 address pool, expressed in CIDR format. + ClientIPPool *string `json:"client_ip_pool" validate:"required"` + + // The date and time that the VPN server was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + + // Indicates whether the split tunneling is enabled on this VPN server. + EnableSplitTunneling *bool `json:"enable_split_tunneling" 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"` + + // Fully qualified domain name assigned to this VPN server. + Hostname *string `json:"hostname" validate:"required"` + + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the VPN server. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The unique user-defined name for this VPN server. + Name *string `json:"name" validate:"required"` + + // The port number used by this VPN server. + Port *int64 `json:"port" validate:"required"` + + // The reserved IPs bound to this VPN server. + PrivateIps []ReservedIPReference `json:"private_ips" validate:"required"` + + // The transport protocol used by this VPN server. + Protocol *string `json:"protocol" validate:"required"` + + // The resource group for this VPN server. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups targeting this VPN server. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The subnets this VPN server is provisioned in. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The VPC this VPN server resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the VPNServer.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 ( + VPNServerHealthStateDegradedConst = "degraded" + VPNServerHealthStateFaultedConst = "faulted" + VPNServerHealthStateInapplicableConst = "inapplicable" + VPNServerHealthStateOkConst = "ok" +) + +// Constants associated with the VPNServer.LifecycleState property. +// The lifecycle state of the VPN server. +const ( + VPNServerLifecycleStateDeletingConst = "deleting" + VPNServerLifecycleStateFailedConst = "failed" + VPNServerLifecycleStatePendingConst = "pending" + VPNServerLifecycleStateStableConst = "stable" + VPNServerLifecycleStateSuspendedConst = "suspended" + VPNServerLifecycleStateUpdatingConst = "updating" + VPNServerLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNServer.Protocol property. +// The transport protocol used by this VPN server. +const ( + VPNServerProtocolTCPConst = "tcp" + VPNServerProtocolUDPConst = "udp" +) + +// Constants associated with the VPNServer.ResourceType property. +// The resource type. +const ( + VPNServerResourceTypeVPNServerConst = "vpn_server" +) + +// UnmarshalVPNServer unmarshals an instance of VPNServer from the specified map of raw messages. +func UnmarshalVPNServer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServer) + err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthentication) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_auto_delete", &obj.ClientAutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_auto_delete_timeout", &obj.ClientAutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthentication : An authentication method for this VPN server. +// Models which "extend" this model: +// - VPNServerAuthenticationByUsername +// - VPNServerAuthenticationByCertificate +type VPNServerAuthentication struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider,omitempty"` + + // The certificate instance used for the VPN client certificate authority (CA). + ClientCa *CertificateInstanceReference `json:"client_ca,omitempty"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` +} + +// Constants associated with the VPNServerAuthentication.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationMethodCertificateConst = "certificate" + VPNServerAuthenticationMethodUsernameConst = "username" +) + +func (*VPNServerAuthentication) isaVPNServerAuthentication() bool { + return true +} + +type VPNServerAuthenticationIntf interface { + isaVPNServerAuthentication() bool +} + +// UnmarshalVPNServerAuthentication unmarshals an instance of VPNServerAuthentication from the specified map of raw messages. +func UnmarshalVPNServerAuthentication(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthentication) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationByUsernameIDProvider : The type of identity provider to be used by VPN client. +// Models which "extend" this model: +// - VPNServerAuthenticationByUsernameIDProviderByIam +type VPNServerAuthenticationByUsernameIDProvider struct { + // The type of identity provider to be used by the VPN client. + // - `iam`: IBM identity and access management + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + ProviderType *string `json:"provider_type,omitempty"` +} + +// Constants associated with the VPNServerAuthenticationByUsernameIDProvider.ProviderType property. +// The type of identity provider to be used by the VPN client. +// - `iam`: IBM identity and access management +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +const ( + VPNServerAuthenticationByUsernameIDProviderProviderTypeIamConst = "iam" +) + +func (*VPNServerAuthenticationByUsernameIDProvider) isaVPNServerAuthenticationByUsernameIDProvider() bool { + return true +} + +type VPNServerAuthenticationByUsernameIDProviderIntf interface { + isaVPNServerAuthenticationByUsernameIDProvider() bool +} + +// UnmarshalVPNServerAuthenticationByUsernameIDProvider unmarshals an instance of VPNServerAuthenticationByUsernameIDProvider from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByUsernameIDProvider(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByUsernameIDProvider) + err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationPrototype : An authentication method for this VPN server. +// Models which "extend" this model: +// - VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype +// - VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype +type VPNServerAuthenticationPrototype struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider,omitempty"` + + // The certificate instance to use for the VPN client certificate authority (CA). + ClientCa CertificateInstanceIdentityIntf `json:"client_ca,omitempty"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` +} + +// Constants associated with the VPNServerAuthenticationPrototype.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationPrototypeMethodCertificateConst = "certificate" + VPNServerAuthenticationPrototypeMethodUsernameConst = "username" +) + +func (*VPNServerAuthenticationPrototype) isaVPNServerAuthenticationPrototype() bool { + return true +} + +type VPNServerAuthenticationPrototypeIntf interface { + isaVPNServerAuthenticationPrototype() bool +} + +// UnmarshalVPNServerAuthenticationPrototype unmarshals an instance of VPNServerAuthenticationPrototype from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "method", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'method': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'method' not found in JSON object") + return + } + if discValue == "certificate" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) + } else if discValue == "username" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'method': %s", discValue) + } + return +} + +// VPNServerClient : VPNServerClient struct +type VPNServerClient struct { + // The IP address assigned to this VPN client from `client_ip_pool`. + ClientIP *IP `json:"client_ip" validate:"required"` + + // The common name of client certificate that the VPN client provided when connecting to the server. + // + // This property will be present only when the `certificate` client authentication method is enabled on the VPN server. + CommonName *string `json:"common_name,omitempty"` + + // The date and time that the VPN client was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The date and time that the VPN client was disconnected. + // + // This property will be present only when the client `status` is `disconnected`. + DisconnectedAt *strfmt.DateTime `json:"disconnected_at,omitempty"` + + // The URL for this VPN client. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN client. + ID *string `json:"id" validate:"required"` + + // The remote IP address of this VPN client. + RemoteIP *IP `json:"remote_ip" validate:"required"` + + // The remote port of this VPN client. + RemotePort *int64 `json:"remote_port" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the VPN client: + // - `connected`: the VPN client is `connected` to this VPN server. + // - `disconnected`: the VPN client is `disconnected` from this VPN server. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN client on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + + // The username that this VPN client provided when connecting to the VPN server. + // + // This property will be present only when the `username` client authentication method is enabled on the VPN server. + Username *string `json:"username,omitempty"` +} + +// Constants associated with the VPNServerClient.ResourceType property. +// The resource type. +const ( + VPNServerClientResourceTypeVPNServerClientConst = "vpn_server_client" +) + +// Constants associated with the VPNServerClient.Status property. +// The status of the VPN client: +// - `connected`: the VPN client is `connected` to this VPN server. +// - `disconnected`: the VPN client is `disconnected` from this VPN server. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN client on which the +// unexpected property value was encountered. +const ( + VPNServerClientStatusConnectedConst = "connected" + VPNServerClientStatusDisconnectedConst = "disconnected" +) + +// UnmarshalVPNServerClient unmarshals an instance of VPNServerClient from the specified map of raw messages. +func UnmarshalVPNServerClient(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerClient) + err = core.UnmarshalModel(m, "client_ip", &obj.ClientIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "common_name", &obj.CommonName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "disconnected_at", &obj.DisconnectedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote_ip", &obj.RemoteIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "remote_port", &obj.RemotePort) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "username", &obj.Username) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerClientCollection : VPNServerClientCollection struct +type VPNServerClientCollection struct { + // Collection of VPN clients. + Clients []VPNServerClient `json:"clients" validate:"required"` + + // A link to the first page of resources. + First *VPNServerClientCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalVPNServerClientCollection unmarshals an instance of VPNServerClientCollection from the specified map of raw messages. +func UnmarshalVPNServerClientCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerClientCollection) + err = core.UnmarshalModel(m, "clients", &obj.Clients, UnmarshalVPNServerClient) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerClientCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerClientCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *VPNServerClientCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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"` + + // 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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of VPN servers. + VPNServers []VPNServer `json:"vpn_servers" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpn_servers", &obj.VPNServers, UnmarshalVPNServer) + if err != nil { + 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 *VPNServerCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerPatch : VPNServerPatch struct +type VPNServerPatch struct { + // The certificate instance for this VPN server. + Certificate CertificateInstanceIdentityIntf `json:"certificate,omitempty"` + + // The authentication methods to use to authenticate VPN client on this VPN server + // (replacing any existing methods). + ClientAuthentication []VPNServerAuthenticationPrototypeIntf `json:"client_authentication,omitempty"` + + // The DNS server addresses that will be provided to VPN clients connected to this VPN server (replacing any existing + // addresses). + ClientDnsServerIps []IP `json:"client_dns_server_ips,omitempty"` + + // The seconds a VPN client can be idle before this VPN server will disconnect it. If `0`, the server will not + // disconnect idle clients. + ClientIdleTimeout *int64 `json:"client_idle_timeout,omitempty"` + + // The VPN client IPv4 address pool, expressed in CIDR format. The request must not overlap with any existing address + // prefixes in the VPC or any of the following reserved address ranges: + // - `127.0.0.0/8` (IPv4 loopback addresses) + // - `161.26.0.0/16` (IBM services) + // - `166.8.0.0/14` (Cloud Service Endpoints) + // - `169.254.0.0/16` (IPv4 link-local addresses) + // - `224.0.0.0/4` (IPv4 multicast addresses) + // + // The prefix length of the client IP address pool's CIDR must be between + // `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that contains twice the number of IP addresses + // that are required to enable the maximum number of concurrent connections is recommended. + ClientIPPool *string `json:"client_ip_pool,omitempty"` + + // Indicates whether the split tunneling is enabled on this VPN server. + EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"` + + // The user-defined name for this VPN server. Names must be unique within the VPC this VPN server is serving. + Name *string `json:"name,omitempty"` + + // The port number used by this VPN server. + Port *int64 `json:"port,omitempty"` + + // The transport protocol used by this VPN server. + Protocol *string `json:"protocol,omitempty"` + + // The subnets to provision this VPN server in (replacing the existing subnets). + Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` +} + +// Constants associated with the VPNServerPatch.Protocol property. +// The transport protocol used by this VPN server. +const ( + VPNServerPatchProtocolTCPConst = "tcp" + VPNServerPatchProtocolUDPConst = "udp" +) + +// UnmarshalVPNServerPatch unmarshals an instance of VPNServerPatch from the specified map of raw messages. +func UnmarshalVPNServerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerPatch) + err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthenticationPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VPNServerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPNServerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPNServerReferenceDeleted unmarshals an instance of VPNServerReferenceDeleted from the specified map of raw messages. +func UnmarshalVPNServerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerRoute : VPNServerRoute struct +type VPNServerRoute struct { + // The action to perform with a packet matching the VPN route: + // - `translate`: translate the source IP address to one of the private IP addresses of the VPN server. + // - `deliver`: deliver the packet into the VPC. + // - `drop`: drop the packet + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the + // unexpected property value was encountered. + Action *string `json:"action" validate:"required"` + + // The date and time that the VPN route was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination for this VPN route in the VPN server. If an incoming packet does not match any destination, it will + // be dropped. + Destination *string `json:"destination" validate:"required"` + + // The URL for this VPN route. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN route. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the VPN route. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The user-defined name for this VPN route. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPNServerRoute.Action property. +// The action to perform with a packet matching the VPN route: +// - `translate`: translate the source IP address to one of the private IP addresses of the VPN server. +// - `deliver`: deliver the packet into the VPC. +// - `drop`: drop the packet +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the +// unexpected property value was encountered. +const ( + VPNServerRouteActionDeliverConst = "deliver" + VPNServerRouteActionDropConst = "drop" + VPNServerRouteActionTranslateConst = "translate" +) + +// Constants associated with the VPNServerRoute.LifecycleState property. +// The lifecycle state of the VPN route. +const ( + VPNServerRouteLifecycleStateDeletingConst = "deleting" + VPNServerRouteLifecycleStateFailedConst = "failed" + VPNServerRouteLifecycleStatePendingConst = "pending" + VPNServerRouteLifecycleStateStableConst = "stable" + VPNServerRouteLifecycleStateSuspendedConst = "suspended" + VPNServerRouteLifecycleStateUpdatingConst = "updating" + VPNServerRouteLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNServerRoute.ResourceType property. +// The resource type. +const ( + VPNServerRouteResourceTypeVPNServerRouteConst = "vpn_server_route" +) + +// UnmarshalVPNServerRoute unmarshals an instance of VPNServerRoute from the specified map of raw messages. +func UnmarshalVPNServerRoute(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRoute) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerRouteCollection : VPNServerRouteCollection struct +type VPNServerRouteCollection struct { + // A link to the first page of resources. + First *VPNServerRouteCollectionFirst `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"` + + // Collection of VPN routes. + Routes []VPNServerRoute `json:"routes" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerRouteCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalVPNServerRoute) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *VPNServerRouteCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerRoutePatch : VPNServerRoutePatch struct +type VPNServerRoutePatch struct { + // The user-defined name for this VPN route. Names must be unique within the VPN server the VPN route resides in. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVPNServerRoutePatch unmarshals an instance of VPNServerRoutePatch from the specified map of raw messages. +func UnmarshalVPNServerRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRoutePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// Volume : Volume struct +type Volume struct { + // Indicates whether a running virtual server instance has an attachment to this volume. + Active *bool `json:"active" validate:"required"` + + // The maximum bandwidth (in megabits per second) for the volume. + Bandwidth *int64 `json:"bandwidth" validate:"required"` + + // Indicates whether this volume is performing an operation that must be serialized. This must be `false` to perform an + // operation that is specified to require serialization. + Busy *bool `json:"busy" validate:"required"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity" validate:"required"` + + // The date and time that the volume was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` + + // The type of encryption used on the volume. + Encryption *string `json:"encryption" validate:"required"` + + // The root key used to wrap the data encryption key for the volume. + // + // This property will be present for volumes with an `encryption` type of + // `user_managed`. + EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` + + // The URL for this volume. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` + + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops" validate:"required"` + + // The unique user-defined name for this volume. + Name *string `json:"name" validate:"required"` + + // The operating system associated with this volume. If absent, this volume was not + // created from an image, or the image did not include an operating system. + OperatingSystem *OperatingSystemReference `json:"operating_system,omitempty"` + + // The profile this volume uses. + Profile *VolumeProfileReference `json:"profile" validate:"required"` + + // The resource group for this volume. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The image from which this volume was created (this may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + // If absent, this volume was not created from an image. + SourceImage *ImageReference `json:"source_image,omitempty"` + + // The snapshot from which this volume was cloned. + SourceSnapshot *SnapshotReference `json:"source_snapshot,omitempty"` + + // The status of the volume. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the volume on which the unexpected + // property value was encountered. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []VolumeStatusReason `json:"status_reasons" validate:"required"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags" validate:"required"` + + // The volume attachments for this volume. + VolumeAttachments []VolumeAttachmentReferenceVolumeContext `json:"volume_attachments" validate:"required"` + + // The zone this volume resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Volume.Encryption property. +// The type of encryption used on the volume. +const ( + VolumeEncryptionProviderManagedConst = "provider_managed" + VolumeEncryptionUserManagedConst = "user_managed" +) + +// Constants associated with the Volume.Status property. +// The status of the volume. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the volume on which the unexpected +// property value was encountered. +const ( + VolumeStatusAvailableConst = "available" + VolumeStatusFailedConst = "failed" + VolumeStatusPendingConst = "pending" + VolumeStatusPendingDeletionConst = "pending_deletion" + VolumeStatusUnusableConst = "unusable" + VolumeStatusUpdatingConst = "updating" +) + +// UnmarshalVolume unmarshals an instance of Volume from the specified map of raw messages. +func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Volume) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "busy", &obj.Busy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_image", &obj.SourceImage, UnmarshalImageReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVolumeStatusReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachment : VolumeAttachment struct +type VolumeAttachment struct { + // The maximum bandwidth (in megabits per second) for the volume when attached to this instance. This may be lower than + // the volume bandwidth depending on the configuration of the instance. + Bandwidth *int64 `json:"bandwidth" validate:"required"` + + // The date and time that the volume was attached. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If set to true, when deleting the instance the volume will also be deleted. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete" validate:"required"` + + // Information about how the volume is exposed to the instance operating system. + // + // This property may be absent if the volume attachment's `status` is not `attached`. + Device *VolumeAttachmentDevice `json:"device,omitempty"` + + // The URL for this volume attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume attachment. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this volume attachment. + Name *string `json:"name" validate:"required"` + + // The status of this volume attachment. + Status *string `json:"status" validate:"required"` + + // The type of volume attachment. + Type *string `json:"type" validate:"required"` + + // The attached volume. + // + // This property will be absent if the volume has not yet been provisioned. + Volume *VolumeReference `json:"volume,omitempty"` +} + +// Constants associated with the VolumeAttachment.Status property. +// The status of this volume attachment. +const ( + VolumeAttachmentStatusAttachedConst = "attached" + VolumeAttachmentStatusAttachingConst = "attaching" + VolumeAttachmentStatusDeletingConst = "deleting" + VolumeAttachmentStatusDetachingConst = "detaching" +) + +// Constants associated with the VolumeAttachment.Type property. +// The type of volume attachment. +const ( + VolumeAttachmentTypeBootConst = "boot" + VolumeAttachmentTypeDataConst = "data" +) + +// UnmarshalVolumeAttachment unmarshals an instance of VolumeAttachment from the specified map of raw messages. +func UnmarshalVolumeAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachment) + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentCollection : VolumeAttachmentCollection struct +type VolumeAttachmentCollection struct { + // Collection of volume attachments. + VolumeAttachments []VolumeAttachment `json:"volume_attachments" validate:"required"` +} + +// UnmarshalVolumeAttachmentCollection unmarshals an instance of VolumeAttachmentCollection from the specified map of raw messages. +func UnmarshalVolumeAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentCollection) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachment) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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"` +} + +// UnmarshalVolumeAttachmentDevice unmarshals an instance of VolumeAttachmentDevice from the specified map of raw messages. +func UnmarshalVolumeAttachmentDevice(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentDevice) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPatch : VolumeAttachmentPatch struct +type VolumeAttachmentPatch struct { + // If set to true, when deleting the instance the volume will also be deleted. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The user-defined name for this volume attachment. Names must be unique within the instance the volume attachment + // resides in. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVolumeAttachmentPatch unmarshals an instance of VolumeAttachmentPatch from the specified map of raw messages. +func UnmarshalVolumeAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPatch) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VolumeAttachmentPrototypeInstanceByImageContext : VolumeAttachmentPrototypeInstanceByImageContext struct +type VolumeAttachmentPrototypeInstanceByImageContext struct { + // If set to true, when deleting the instance the volume will also be deleted. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The user-defined name for this volume attachment. Names must be unique within the instance the volume attachment + // resides in. + Name *string `json:"name,omitempty"` + + // A prototype object for a new volume. + Volume *VolumePrototypeInstanceByImageContext `json:"volume" validate:"required"` +} + +// NewVolumeAttachmentPrototypeInstanceByImageContext : Instantiate VolumeAttachmentPrototypeInstanceByImageContext (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByImageContext(volume *VolumePrototypeInstanceByImageContext) (_model *VolumeAttachmentPrototypeInstanceByImageContext, err error) { + _model = &VolumeAttachmentPrototypeInstanceByImageContext{ + Volume: volume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumeAttachmentPrototypeInstanceByImageContext unmarshals an instance of VolumeAttachmentPrototypeInstanceByImageContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeInstanceByImageContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeInstanceByImageContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceByImageContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeInstanceBySourceSnapshotContext : VolumeAttachmentPrototypeInstanceBySourceSnapshotContext struct +type VolumeAttachmentPrototypeInstanceBySourceSnapshotContext struct { + // If set to true, when deleting the instance the volume will also be deleted. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The user-defined name for this volume attachment. Names must be unique within the instance the volume attachment + // resides in. + Name *string `json:"name,omitempty"` + + // A prototype object for a new volume from a snapshot. + Volume *VolumePrototypeInstanceBySourceSnapshotContext `json:"volume" validate:"required"` +} + +// NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext : Instantiate VolumeAttachmentPrototypeInstanceBySourceSnapshotContext (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(volume *VolumePrototypeInstanceBySourceSnapshotContext) (_model *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, err error) { + _model = &VolumeAttachmentPrototypeInstanceBySourceSnapshotContext{ + Volume: volume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext unmarshals an instance of VolumeAttachmentPrototypeInstanceBySourceSnapshotContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeInstanceContext : VolumeAttachmentPrototypeInstanceContext struct +type VolumeAttachmentPrototypeInstanceContext struct { + // If set to true, when deleting the instance the volume will also be deleted. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The user-defined name for this volume attachment. Names must be unique within the instance the volume attachment + // resides in. + Name *string `json:"name,omitempty"` + + // An existing volume to attach to the instance, or a prototype object for a new volume. + Volume VolumeAttachmentVolumePrototypeInstanceContextIntf `json:"volume" validate:"required"` +} + +// NewVolumeAttachmentPrototypeInstanceContext : Instantiate VolumeAttachmentPrototypeInstanceContext (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeInstanceContext(volume VolumeAttachmentVolumePrototypeInstanceContextIntf) (_model *VolumeAttachmentPrototypeInstanceContext, err error) { + _model = &VolumeAttachmentPrototypeInstanceContext{ + Volume: volume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumeAttachmentPrototypeInstanceContext unmarshals an instance of VolumeAttachmentPrototypeInstanceContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeAttachmentVolumePrototypeInstanceContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolume : An existing volume to attach to the instance, or a prototype object for a new volume. +// Models which "extend" this model: +// - VolumeAttachmentPrototypeVolumeVolumeIdentity +// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext +type VolumeAttachmentPrototypeVolume struct { + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` +} + +func (*VolumeAttachmentPrototypeVolume) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +type VolumeAttachmentPrototypeVolumeIntf interface { + isaVolumeAttachmentPrototypeVolume() bool +} + +// UnmarshalVolumeAttachmentPrototypeVolume unmarshals an instance of VolumeAttachmentPrototypeVolume from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolume) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceInstanceContext : VolumeAttachmentReferenceInstanceContext struct +type VolumeAttachmentReferenceInstanceContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeAttachmentReferenceInstanceContextDeleted `json:"deleted,omitempty"` + + // Information about how the volume is exposed to the instance operating system. + // + // This property may be absent if the volume attachment's `status` is not `attached`. + Device *VolumeAttachmentDevice `json:"device,omitempty"` + + // The URL for this volume attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume attachment. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this volume attachment. + Name *string `json:"name" validate:"required"` + + // The attached volume. + // + // This property will be absent if the volume has not yet been provisioned. + Volume *VolumeReference `json:"volume,omitempty"` +} + +// UnmarshalVolumeAttachmentReferenceInstanceContext unmarshals an instance of VolumeAttachmentReferenceInstanceContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceInstanceContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceInstanceContextDeleted) + if err != nil { + return + } + err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceInstanceContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VolumeAttachmentReferenceInstanceContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeAttachmentReferenceInstanceContextDeleted unmarshals an instance of VolumeAttachmentReferenceInstanceContextDeleted from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceInstanceContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceInstanceContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceVolumeContext : VolumeAttachmentReferenceVolumeContext struct +type VolumeAttachmentReferenceVolumeContext struct { + // If set to true, when deleting the instance the volume will also be deleted. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeAttachmentReferenceVolumeContextDeleted `json:"deleted,omitempty"` + + // Information about how the volume is exposed to the instance operating system. + // + // This property may be absent if the volume attachment's `status` is not `attached`. + Device *VolumeAttachmentDevice `json:"device,omitempty"` + + // The URL for this volume attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume attachment. + ID *string `json:"id" validate:"required"` + + // The attached instance. + Instance *InstanceReference `json:"instance" validate:"required"` + + // The user-defined name for this volume attachment. + Name *string `json:"name" validate:"required"` + + // The type of volume attachment. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VolumeAttachmentReferenceVolumeContext.Type property. +// The type of volume attachment. +const ( + VolumeAttachmentReferenceVolumeContextTypeBootConst = "boot" + VolumeAttachmentReferenceVolumeContextTypeDataConst = "data" +) + +// UnmarshalVolumeAttachmentReferenceVolumeContext unmarshals an instance of VolumeAttachmentReferenceVolumeContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceVolumeContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceVolumeContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceVolumeContextDeleted) + if err != nil { + return + } + err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceVolumeContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VolumeAttachmentReferenceVolumeContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeAttachmentReferenceVolumeContextDeleted unmarshals an instance of VolumeAttachmentReferenceVolumeContextDeleted from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceVolumeContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceVolumeContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContext : An existing volume to attach to the instance, or a prototype object for a new volume. +// Models which "extend" this model: +// - VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity +// - VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext +type VolumeAttachmentVolumePrototypeInstanceContext struct { + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` +} + +func (*VolumeAttachmentVolumePrototypeInstanceContext) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +type VolumeAttachmentVolumePrototypeInstanceContextIntf interface { + isaVolumeAttachmentVolumePrototypeInstanceContext() bool +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContext unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContext) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeCollection : VolumeCollection struct +type VolumeCollection struct { + // A link to the first page of resources. + First *VolumeCollectionFirst `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"` + + // Collection of volumes. + Volumes []Volume `json:"volumes" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVolumeCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volumes", &obj.Volumes, UnmarshalVolume) + if err != nil { + 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 *VolumeCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentity : Identifies a volume by a unique property. +// Models which "extend" this model: +// - VolumeIdentityByID +// - VolumeIdentityByCRN +// - VolumeIdentityByHref +type VolumeIdentity struct { + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` +} + +func (*VolumeIdentity) isaVolumeIdentity() bool { + return true +} + +type VolumeIdentityIntf interface { + isaVolumeIdentity() bool +} + +// UnmarshalVolumeIdentity unmarshals an instance of VolumeIdentity from the specified map of raw messages. +func UnmarshalVolumeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePatch : VolumePatch struct +type VolumePatch struct { + // The capacity to use for the volume (in gigabytes). The volume must be attached to a running virtual server instance, + // and the specified value must not be less than the current capacity. Additionally, if the volume is attached as a + // boot volume, the maximum value is 250 gigabytes. + // + // The minimum and maximum capacity limits for creating or updating volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. The volume must be attached as a data volume to a running virtual server instance. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. The requested profile must be in the same + // `family` as the current profile. The volume must be attached as a data volume to a + // running virtual server instance, and must have a `capacity` within the range + // supported by the specified profile. + Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` +} + +// UnmarshalVolumePatch unmarshals an instance of VolumePatch from the specified map of raw messages. +func UnmarshalVolumePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePatch) + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VolumeProfile : VolumeProfile struct +type VolumeProfile struct { + // The product family this volume profile belongs to. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the volume profile on which the + // unexpected property value was encountered. + Family *string `json:"family" validate:"required"` + + // The URL for this volume profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this volume profile. + Name *string `json:"name" validate:"required"` +} + +// Constants associated with the VolumeProfile.Family property. +// The product family this volume profile belongs to. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the volume profile on which the +// unexpected property value was encountered. +const ( + VolumeProfileFamilyCustomConst = "custom" + VolumeProfileFamilyTieredConst = "tiered" +) + +// UnmarshalVolumeProfile unmarshals an instance of VolumeProfile from the specified map of raw messages. +func UnmarshalVolumeProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfile) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileCollection : VolumeProfileCollection struct +type VolumeProfileCollection struct { + // A link to the first page of resources. + First *VolumeProfileCollectionFirst `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"` + + // Collection of volume profiles. + Profiles []VolumeProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVolumeProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalVolumeProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *VolumeProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileIdentity : Identifies a volume profile by a unique property. +// Models which "extend" this model: +// - VolumeProfileIdentityByName +// - VolumeProfileIdentityByHref +type VolumeProfileIdentity struct { + // The globally unique name for this volume profile. + Name *string `json:"name,omitempty"` + + // The URL for this volume profile. + Href *string `json:"href,omitempty"` +} + +func (*VolumeProfileIdentity) isaVolumeProfileIdentity() bool { + return true +} + +type VolumeProfileIdentityIntf interface { + isaVolumeProfileIdentity() bool +} + +// UnmarshalVolumeProfileIdentity unmarshals an instance of VolumeProfileIdentity from the specified map of raw messages. +func UnmarshalVolumeProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileReference : VolumeProfileReference struct +type VolumeProfileReference struct { + // The URL for this volume profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this volume profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalVolumeProfileReference unmarshals an instance of VolumeProfileReference from the specified map of raw messages. +func UnmarshalVolumeProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototype : VolumePrototype struct +// Models which "extend" this model: +// - VolumePrototypeVolumeByCapacity +// - VolumePrototypeVolumeBySourceSnapshot +type VolumePrototype struct { + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this volume will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` +} + +func (*VolumePrototype) isaVolumePrototype() bool { + return true +} + +type VolumePrototypeIntf interface { + isaVolumePrototype() bool +} + +// UnmarshalVolumePrototype unmarshals an instance of VolumePrototype from the specified map of raw messages. +func UnmarshalVolumePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototype) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototypeInstanceByImageContext : VolumePrototypeInstanceByImageContext struct +type VolumePrototypeInstanceByImageContext struct { + // The capacity to use for the volume (in gigabytes). Must be at least the image's + // `minimum_provisioned_size`. The maximum value may increase in the future. + // + // If unspecified, the capacity will be the image's `minimum_provisioned_size`. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` +} + +// NewVolumePrototypeInstanceByImageContext : Instantiate VolumePrototypeInstanceByImageContext (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeInstanceByImageContext(profile VolumeProfileIdentityIntf) (_model *VolumePrototypeInstanceByImageContext, err error) { + _model = &VolumePrototypeInstanceByImageContext{ + Profile: profile, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumePrototypeInstanceByImageContext unmarshals an instance of VolumePrototypeInstanceByImageContext from the specified map of raw messages. +func UnmarshalVolumePrototypeInstanceByImageContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeInstanceByImageContext) + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototypeInstanceBySourceSnapshotContext : VolumePrototypeInstanceBySourceSnapshotContext struct +type VolumePrototypeInstanceBySourceSnapshotContext struct { + // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's + // `minimum_capacity`. The maximum value may increase in the future. + // + // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` +} + +// NewVolumePrototypeInstanceBySourceSnapshotContext : Instantiate VolumePrototypeInstanceBySourceSnapshotContext (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeInstanceBySourceSnapshotContext(profile VolumeProfileIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumePrototypeInstanceBySourceSnapshotContext, err error) { + _model = &VolumePrototypeInstanceBySourceSnapshotContext{ + Profile: profile, + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumePrototypeInstanceBySourceSnapshotContext unmarshals an instance of VolumePrototypeInstanceBySourceSnapshotContext from the specified map of raw messages. +func UnmarshalVolumePrototypeInstanceBySourceSnapshotContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeInstanceBySourceSnapshotContext) + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeReference : VolumeReference struct +type VolumeReference struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this volume. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this volume. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalVolumeReference unmarshals an instance of VolumeReference from the specified map of raw messages. +func UnmarshalVolumeReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VolumeReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeReferenceDeleted unmarshals an instance of VolumeReferenceDeleted from the specified map of raw messages. +func UnmarshalVolumeReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeStatusReason : VolumeStatusReason struct +type VolumeStatusReason struct { + // A snake case string succinctly identifying the status reason. + 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 VolumeStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + VolumeStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" +) + +// UnmarshalVolumeStatusReason unmarshals an instance of VolumeStatusReason from the specified map of raw messages. +func UnmarshalVolumeStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Zone : Zone struct +type Zone struct { + // The URL for this zone. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this zone. + Name *string `json:"name" validate:"required"` + + // The region this zone resides in. + Region *RegionReference `json:"region" validate:"required"` + + // The availability status of this zone. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the Zone.Status property. +// The availability status of this zone. +const ( + ZoneStatusAvailableConst = "available" + ZoneStatusImpairedConst = "impaired" + ZoneStatusUnavailableConst = "unavailable" +) + +// UnmarshalZone unmarshals an instance of Zone from the specified map of raw messages. +func UnmarshalZone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Zone) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneCollection : ZoneCollection struct +type ZoneCollection struct { + // Collection of zones. + Zones []Zone `json:"zones" validate:"required"` +} + +// UnmarshalZoneCollection unmarshals an instance of ZoneCollection from the specified map of raw messages. +func UnmarshalZoneCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneCollection) + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZone) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneIdentity : Identifies a zone by a unique property. +// Models which "extend" this model: +// - ZoneIdentityByName +// - ZoneIdentityByHref +type ZoneIdentity struct { + // The globally unique name for this zone. + Name *string `json:"name,omitempty"` + + // The URL for this zone. + Href *string `json:"href,omitempty"` +} + +func (*ZoneIdentity) isaZoneIdentity() bool { + return true +} + +type ZoneIdentityIntf interface { + isaZoneIdentity() bool +} + +// UnmarshalZoneIdentity unmarshals an instance of ZoneIdentity from the specified map of raw messages. +func UnmarshalZoneIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneReference : ZoneReference struct +type ZoneReference struct { + // The URL for this zone. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this zone. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalZoneReference unmarshals an instance of ZoneReference from the specified map of raw messages. +func UnmarshalZoneReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerBootTargetBareMetalServerDiskReference : BareMetalServerBootTargetBareMetalServerDiskReference struct +// This model "extends" BareMetalServerBootTarget +type BareMetalServerBootTargetBareMetalServerDiskReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerDiskReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this bare metal server disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server disk. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this disk. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BareMetalServerBootTargetBareMetalServerDiskReference.ResourceType property. +// The resource type. +const ( + BareMetalServerBootTargetBareMetalServerDiskReferenceResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" +) + +func (*BareMetalServerBootTargetBareMetalServerDiskReference) isaBareMetalServerBootTarget() bool { + return true +} + +// UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference unmarshals an instance of BareMetalServerBootTargetBareMetalServerDiskReference from the specified map of raw messages. +func UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerBootTargetBareMetalServerDiskReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount : BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct +// This model "extends" BareMetalServerInitializationUserAccount +type BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct { + // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. + EncryptedPassword *[]byte `json:"encrypted_password" validate:"required"` + + // The public SSH key used to encrypt the password. + EncryptionKey *KeyReference `json:"encryption_key" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The username for the account created at initialization. + Username *string `json:"username" validate:"required"` +} + +// Constants associated with the BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount.ResourceType property. +// The resource type. +const ( + BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccountResourceTypeHostUserAccountConst = "host_user_account" +) + +func (*BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) isaBareMetalServerInitializationUserAccount() bool { + return true +} + +// UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount unmarshals an instance of BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount from the specified map of raw messages. +func UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) + err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "username", &obj.Username) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfaceByPci : BareMetalServerNetworkInterfaceByPci struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByPci 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" validate:"required"` + + // The date and time that the network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - A single floating IP can be assigned to the network interface. + // + // If `false`: + // - Packets are passed unmodified to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - Multiple floating IPs can be assigned to the network interface. + // - `allow_ip_spoofing` must be set to `false`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + + // The floating IPs associated with this network interface. + FloatingIps []FloatingIPReference `json:"floating_ips,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The MAC address of the interface. If absent, the value is not known. + MacAddress *string `json:"mac_address" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The network interface port speed in Mbps. + 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 network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the network interface. + Status *string `json:"status" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The type of this bare metal server network interface. + Type *string `json:"type" validate:"required"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be + // in the `allowed_vlans` array for one PCI type adapter per bare metal server. + AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` + + // - `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 VLAN tag. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceByPciResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.Status property. +// The status of the network interface. +const ( + BareMetalServerNetworkInterfaceByPciStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByPciStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByPciStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByPciStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.Type property. +// The type of this bare metal server network interface. +const ( + BareMetalServerNetworkInterfaceByPciTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByPciTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.InterfaceType property. +// - `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 VLAN tag. +const ( + BareMetalServerNetworkInterfaceByPciInterfaceTypePciConst = "pci" +) + +func (*BareMetalServerNetworkInterfaceByPci) isaBareMetalServerNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfaceByPci unmarshals an instance of BareMetalServerNetworkInterfaceByPci from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByPci) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfaceByVlan : BareMetalServerNetworkInterfaceByVlan struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByVlan 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" validate:"required"` + + // The date and time that the network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - A single floating IP can be assigned to the network interface. + // + // If `false`: + // - Packets are passed unmodified to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - Multiple floating IPs can be assigned to the network interface. + // - `allow_ip_spoofing` must be set to `false`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + + // The floating IPs associated with this network interface. + FloatingIps []FloatingIPReference `json:"floating_ips,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The MAC address of the interface. If absent, the value is not known. + MacAddress *string `json:"mac_address" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The network interface port speed in Mbps. + 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 network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the network interface. + Status *string `json:"status" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The type of this bare metal server network interface. + Type *string `json:"type" validate:"required"` + + // Indicates if the interface can float to any other server within the same + // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal + // server in the resource group. Applies only to `vlan` type interfaces. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float" validate:"required"` + + // - `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. + InterfaceType *string `json:"interface_type" validate:"required"` + + // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + Vlan *int64 `json:"vlan" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceByVlanResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Status property. +// The status of the network interface. +const ( + BareMetalServerNetworkInterfaceByVlanStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByVlanStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByVlanStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByVlanStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Type property. +// The type of this bare metal server network interface. +const ( + BareMetalServerNetworkInterfaceByVlanTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByVlanTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.InterfaceType property. +// - `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. +const ( + BareMetalServerNetworkInterfaceByVlanInterfaceTypeVlanConst = "vlan" +) + +func (*BareMetalServerNetworkInterfaceByVlan) isaBareMetalServerNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfaceByVlan unmarshals an instance of BareMetalServerNetworkInterfaceByVlan from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByVlan) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype 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"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - A single floating IP can be assigned to the network interface. + // + // If `false`: + // - Packets are passed unmodified to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - Multiple floating IPs can be assigned to the network interface. + // - `allow_ip_spoofing` must be set to `false`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The user-defined name for network interface. Names must be unique within the instance the network interface resides + // in. 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 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 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 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"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be + // in the `allowed_vlans` array for one PCI type adapter per bare metal server. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // - `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 VLAN tag. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype.InterfaceType property. +// - `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 VLAN tag. +const ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototypeInterfaceTypePciConst = "pci" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype 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"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - A single floating IP can be assigned to the network interface. + // + // If `false`: + // - Packets are passed unmodified to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - Multiple floating IPs can be assigned to the network interface. + // - `allow_ip_spoofing` must be set to `false`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The user-defined name for network interface. Names must be unique within the instance the network interface resides + // in. 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 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 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 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"` + + // Indicates if the interface can float to any other server within the same + // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal + // server in the resource group. Applies only to `vlan` type interfaces. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + + // - `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. + InterfaceType *string `json:"interface_type" validate:"required"` + + // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + Vlan *int64 `json:"vlan" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype.InterfaceType property. +// - `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. +const ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototypeInterfaceTypeVlanConst = "vlan" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(subnet SubnetIdentityIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + Vlan: core.Int64Ptr(vlan), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidthDependent : The total bandwidth shared across the network interfaces of a bare metal server with this profile depends on its +// configuration. +// This model "extends" BareMetalServerProfileBandwidth +type BareMetalServerProfileBandwidthDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileBandwidthDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileBandwidthDependent) isaBareMetalServerProfileBandwidth() bool { + return true +} + +// UnmarshalBareMetalServerProfileBandwidthDependent unmarshals an instance of BareMetalServerProfileBandwidthDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidthDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network interfaces of a bare metal +// server with this profile. +// This model "extends" BareMetalServerProfileBandwidth +type BareMetalServerProfileBandwidthEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 BareMetalServerProfileBandwidthEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileBandwidthEnum) isaBareMetalServerProfileBandwidth() bool { + return true +} + +// UnmarshalBareMetalServerProfileBandwidthEnum unmarshals an instance of BareMetalServerProfileBandwidthEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidthEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network interfaces of a bare metal server with this +// profile. +// This model "extends" BareMetalServerProfileBandwidth +type BareMetalServerProfileBandwidthFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileBandwidthFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileBandwidthFixed) isaBareMetalServerProfileBandwidth() bool { + return true +} + +// UnmarshalBareMetalServerProfileBandwidthFixed unmarshals an instance of BareMetalServerProfileBandwidthFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidthFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network interfaces of a bare metal +// server with this profile. +// This model "extends" BareMetalServerProfileBandwidth +type BareMetalServerProfileBandwidthRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileBandwidthRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileBandwidthRange) isaBareMetalServerProfileBandwidth() bool { + return true +} + +// UnmarshalBareMetalServerProfileBandwidthRange unmarshals an instance of BareMetalServerProfileBandwidthRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidthRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCountDependent : The CPU core count for a bare metal server with this profile depends on its configuration. +// This model "extends" BareMetalServerProfileCpuCoreCount +type BareMetalServerProfileCpuCoreCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuCoreCountDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuCoreCountDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileCpuCoreCountDependent) isaBareMetalServerProfileCpuCoreCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuCoreCountDependent unmarshals an instance of BareMetalServerProfileCpuCoreCountDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCountEnum : The permitted values for CPU cores for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuCoreCount +type BareMetalServerProfileCpuCoreCountEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 BareMetalServerProfileCpuCoreCountEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuCoreCountEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileCpuCoreCountEnum) isaBareMetalServerProfileCpuCoreCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuCoreCountEnum unmarshals an instance of BareMetalServerProfileCpuCoreCountEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCountEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCountEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCountFixed : The CPU core count for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuCoreCount +type BareMetalServerProfileCpuCoreCountFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuCoreCountFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuCoreCountFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileCpuCoreCountFixed) isaBareMetalServerProfileCpuCoreCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuCoreCountFixed unmarshals an instance of BareMetalServerProfileCpuCoreCountFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCountFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCountFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCountRange : The permitted range for the number of CPU cores for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuCoreCount +type BareMetalServerProfileCpuCoreCountRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuCoreCountRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuCoreCountRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileCpuCoreCountRange) isaBareMetalServerProfileCpuCoreCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuCoreCountRange unmarshals an instance of BareMetalServerProfileCpuCoreCountRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCountRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuSocketCountDependent : The CPU socket count for a bare metal server with this profile depends on its configuration. +// This model "extends" BareMetalServerProfileCpuSocketCount +type BareMetalServerProfileCpuSocketCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuSocketCountDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileCpuSocketCountDependent) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuSocketCountDependent unmarshals an instance of BareMetalServerProfileCpuSocketCountDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuSocketCountEnum : The permitted values for CPU sockets for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuSocketCount +type BareMetalServerProfileCpuSocketCountEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 BareMetalServerProfileCpuSocketCountEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileCpuSocketCountEnum) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuSocketCountEnum unmarshals an instance of BareMetalServerProfileCpuSocketCountEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCountEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCountEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuSocketCountFixed : The number of CPU sockets for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuSocketCount +type BareMetalServerProfileCpuSocketCountFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuSocketCountFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileCpuSocketCountFixed) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuSocketCountFixed unmarshals an instance of BareMetalServerProfileCpuSocketCountFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCountFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCountFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuSocketCountRange : The permitted range for the number of CPU sockets for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuSocketCount +type BareMetalServerProfileCpuSocketCountRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuSocketCountRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileCpuSocketCountRange) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuSocketCountRange unmarshals an instance of BareMetalServerProfileCpuSocketCountRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCountRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskQuantityDependent : The number of disks of this configuration for a bare metal server with this profile depends on its bare metal server +// configuration. +// This model "extends" BareMetalServerProfileDiskQuantity +type BareMetalServerProfileDiskQuantityDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskQuantityDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileDiskQuantityDependent) isaBareMetalServerProfileDiskQuantity() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskQuantityDependent unmarshals an instance of BareMetalServerProfileDiskQuantityDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantityDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantityDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskQuantityEnum : The permitted the number of disks of this configuration for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileDiskQuantity +type BareMetalServerProfileDiskQuantityEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 BareMetalServerProfileDiskQuantityEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileDiskQuantityEnum) isaBareMetalServerProfileDiskQuantity() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskQuantityEnum unmarshals an instance of BareMetalServerProfileDiskQuantityEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantityEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantityEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskQuantityFixed : The number of disks of this configuration for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileDiskQuantity +type BareMetalServerProfileDiskQuantityFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskQuantityFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileDiskQuantityFixed) isaBareMetalServerProfileDiskQuantity() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskQuantityFixed unmarshals an instance of BareMetalServerProfileDiskQuantityFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantityFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantityFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskQuantityRange : The permitted range for the number of disks of this configuration for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileDiskQuantity +type BareMetalServerProfileDiskQuantityRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskQuantityRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileDiskQuantityRange) isaBareMetalServerProfileDiskQuantity() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskQuantityRange unmarshals an instance of BareMetalServerProfileDiskQuantityRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantityRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantityRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSizeDependent : The disk size in GB (gigabytes) of this configuration for a bare metal server with this profile depends on its bare +// metal server configuration. +// This model "extends" BareMetalServerProfileDiskSize +type BareMetalServerProfileDiskSizeDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskSizeDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileDiskSizeDependent) isaBareMetalServerProfileDiskSize() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskSizeDependent unmarshals an instance of BareMetalServerProfileDiskSizeDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSizeDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSizeDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSizeEnum : The permitted disk size in GB (gigabytes) of this configuration for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileDiskSize +type BareMetalServerProfileDiskSizeEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 BareMetalServerProfileDiskSizeEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileDiskSizeEnum) isaBareMetalServerProfileDiskSize() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskSizeEnum unmarshals an instance of BareMetalServerProfileDiskSizeEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSizeEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSizeEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSizeFixed : The size of the disk in GB (gigabytes). +// This model "extends" BareMetalServerProfileDiskSize +type BareMetalServerProfileDiskSizeFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskSizeFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileDiskSizeFixed) isaBareMetalServerProfileDiskSize() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskSizeFixed unmarshals an instance of BareMetalServerProfileDiskSizeFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSizeFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSizeFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSizeRange : The permitted range for the disk size of this configuration in GB (gigabytes) for a bare metal server with this +// profile. +// This model "extends" BareMetalServerProfileDiskSize +type BareMetalServerProfileDiskSizeRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskSizeRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileDiskSizeRange) isaBareMetalServerProfileDiskSize() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskSizeRange unmarshals an instance of BareMetalServerProfileDiskSizeRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSizeRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSizeRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileIdentityByHref : BareMetalServerProfileIdentityByHref struct +// This model "extends" BareMetalServerProfileIdentity +type BareMetalServerProfileIdentityByHref struct { + // The URL for this bare metal server profile. + Href *string `json:"href" validate:"required"` +} + +// NewBareMetalServerProfileIdentityByHref : Instantiate BareMetalServerProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerProfileIdentityByHref(href string) (_model *BareMetalServerProfileIdentityByHref, err error) { + _model = &BareMetalServerProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerProfileIdentityByHref) isaBareMetalServerProfileIdentity() bool { + return true +} + +// UnmarshalBareMetalServerProfileIdentityByHref unmarshals an instance of BareMetalServerProfileIdentityByHref from the specified map of raw messages. +func UnmarshalBareMetalServerProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileIdentityByName : BareMetalServerProfileIdentityByName struct +// This model "extends" BareMetalServerProfileIdentity +type BareMetalServerProfileIdentityByName struct { + // The name for this bare metal server profile. + Name *string `json:"name" validate:"required"` +} + +// NewBareMetalServerProfileIdentityByName : Instantiate BareMetalServerProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerProfileIdentityByName(name string) (_model *BareMetalServerProfileIdentityByName, err error) { + _model = &BareMetalServerProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerProfileIdentityByName) isaBareMetalServerProfileIdentity() bool { + return true +} + +// UnmarshalBareMetalServerProfileIdentityByName unmarshals an instance of BareMetalServerProfileIdentityByName from the specified map of raw messages. +func UnmarshalBareMetalServerProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileMemoryDependent : The memory value for a bare metal server with this profile depends on its configuration. +// This model "extends" BareMetalServerProfileMemory +type BareMetalServerProfileMemoryDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileMemoryDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileMemoryDependent) isaBareMetalServerProfileMemory() bool { + return true +} + +// UnmarshalBareMetalServerProfileMemoryDependent unmarshals an instance of BareMetalServerProfileMemoryDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemoryDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileMemoryEnum : The permitted memory values (in gibibytes) for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileMemory +type BareMetalServerProfileMemoryEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 BareMetalServerProfileMemoryEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileMemoryEnum) isaBareMetalServerProfileMemory() bool { + return true +} + +// UnmarshalBareMetalServerProfileMemoryEnum unmarshals an instance of BareMetalServerProfileMemoryEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemoryEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileMemoryFixed : The memory (in gibibytes) for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileMemory +type BareMetalServerProfileMemoryFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileMemoryFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileMemoryFixed) isaBareMetalServerProfileMemory() bool { + return true +} + +// UnmarshalBareMetalServerProfileMemoryFixed unmarshals an instance of BareMetalServerProfileMemoryFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemoryFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileMemoryRange : The permitted memory range (in gibibytes) for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileMemory +type BareMetalServerProfileMemoryRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileMemoryRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileMemoryRange) isaBareMetalServerProfileMemory() bool { + return true +} + +// UnmarshalBareMetalServerProfileMemoryRange unmarshals an instance of BareMetalServerProfileMemoryRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemoryRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CertificateInstanceIdentityByCRN : CertificateInstanceIdentityByCRN struct +// This model "extends" CertificateInstanceIdentity +type CertificateInstanceIdentityByCRN struct { + // The CRN for this certificate instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewCertificateInstanceIdentityByCRN : Instantiate CertificateInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewCertificateInstanceIdentityByCRN(crn string) (_model *CertificateInstanceIdentityByCRN, err error) { + _model = &CertificateInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CertificateInstanceIdentityByCRN) isaCertificateInstanceIdentity() bool { + return true +} + +// UnmarshalCertificateInstanceIdentityByCRN unmarshals an instance of CertificateInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalCertificateInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CertificateInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupIdentityByCRN : DedicatedHostGroupIdentityByCRN struct +// This model "extends" DedicatedHostGroupIdentity +type DedicatedHostGroupIdentityByCRN struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` +} + +// NewDedicatedHostGroupIdentityByCRN : Instantiate DedicatedHostGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostGroupIdentityByCRN(crn string) (_model *DedicatedHostGroupIdentityByCRN, err error) { + _model = &DedicatedHostGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostGroupIdentityByCRN) isaDedicatedHostGroupIdentity() bool { + return true +} + +// UnmarshalDedicatedHostGroupIdentityByCRN unmarshals an instance of DedicatedHostGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupIdentityByHref : DedicatedHostGroupIdentityByHref struct +// This model "extends" DedicatedHostGroupIdentity +type DedicatedHostGroupIdentityByHref struct { + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` +} + +// NewDedicatedHostGroupIdentityByHref : Instantiate DedicatedHostGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostGroupIdentityByHref(href string) (_model *DedicatedHostGroupIdentityByHref, err error) { + _model = &DedicatedHostGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostGroupIdentityByHref) isaDedicatedHostGroupIdentity() bool { + return true +} + +// UnmarshalDedicatedHostGroupIdentityByHref unmarshals an instance of DedicatedHostGroupIdentityByHref from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupIdentityByID : DedicatedHostGroupIdentityByID struct +// This model "extends" DedicatedHostGroupIdentity +type DedicatedHostGroupIdentityByID struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` +} + +// NewDedicatedHostGroupIdentityByID : Instantiate DedicatedHostGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostGroupIdentityByID(id string) (_model *DedicatedHostGroupIdentityByID, err error) { + _model = &DedicatedHostGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostGroupIdentityByID) isaDedicatedHostGroupIdentity() bool { + return true +} + +// UnmarshalDedicatedHostGroupIdentityByID unmarshals an instance of DedicatedHostGroupIdentityByID from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileIdentityByHref : DedicatedHostProfileIdentityByHref struct +// This model "extends" DedicatedHostProfileIdentity +type DedicatedHostProfileIdentityByHref struct { + // The URL for this dedicated host profile. + Href *string `json:"href" validate:"required"` +} + +// NewDedicatedHostProfileIdentityByHref : Instantiate DedicatedHostProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostProfileIdentityByHref(href string) (_model *DedicatedHostProfileIdentityByHref, err error) { + _model = &DedicatedHostProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostProfileIdentityByHref) isaDedicatedHostProfileIdentity() bool { + return true +} + +// UnmarshalDedicatedHostProfileIdentityByHref unmarshals an instance of DedicatedHostProfileIdentityByHref from the specified map of raw messages. +func UnmarshalDedicatedHostProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileIdentityByName : DedicatedHostProfileIdentityByName struct +// This model "extends" DedicatedHostProfileIdentity +type DedicatedHostProfileIdentityByName struct { + // The globally unique name for this dedicated host profile. + Name *string `json:"name" validate:"required"` +} + +// NewDedicatedHostProfileIdentityByName : Instantiate DedicatedHostProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostProfileIdentityByName(name string) (_model *DedicatedHostProfileIdentityByName, err error) { + _model = &DedicatedHostProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostProfileIdentityByName) isaDedicatedHostProfileIdentity() bool { + return true +} + +// UnmarshalDedicatedHostProfileIdentityByName unmarshals an instance of DedicatedHostProfileIdentityByName from the specified map of raw messages. +func UnmarshalDedicatedHostProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryDependent : The memory value for a dedicated host with this profile depends on its configuration. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileMemoryDependent.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryDependentTypeDependentConst = "dependent" +) + +func (*DedicatedHostProfileMemoryDependent) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryDependent unmarshals an instance of DedicatedHostProfileMemoryDependent from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryEnum : The permitted memory values (in gibibytes) for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 DedicatedHostProfileMemoryEnum.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryEnumTypeEnumConst = "enum" +) + +func (*DedicatedHostProfileMemoryEnum) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryEnum unmarshals an instance of DedicatedHostProfileMemoryEnum from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryFixed : The memory (in gibibytes) for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileMemoryFixed.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryFixedTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileMemoryFixed) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryFixed unmarshals an instance of DedicatedHostProfileMemoryFixed from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryRange : The permitted memory range (in gibibytes) for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileMemoryRange.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryRangeTypeRangeConst = "range" +) + +func (*DedicatedHostProfileMemoryRange) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryRange unmarshals an instance of DedicatedHostProfileMemoryRange from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketDependent : The CPU socket count for a dedicated host with this profile depends on its configuration. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileSocketDependent.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketDependentTypeDependentConst = "dependent" +) + +func (*DedicatedHostProfileSocketDependent) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketDependent unmarshals an instance of DedicatedHostProfileSocketDependent from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketEnum : The permitted values for CPU socket count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 DedicatedHostProfileSocketEnum.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketEnumTypeEnumConst = "enum" +) + +func (*DedicatedHostProfileSocketEnum) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketEnum unmarshals an instance of DedicatedHostProfileSocketEnum from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketFixed : The CPU socket count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileSocketFixed.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketFixedTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileSocketFixed) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketFixed unmarshals an instance of DedicatedHostProfileSocketFixed from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketRange : The permitted range for CPU socket count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileSocketRange.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketRangeTypeRangeConst = "range" +) + +func (*DedicatedHostProfileSocketRange) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketRange unmarshals an instance of DedicatedHostProfileSocketRange from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuDependent : The VCPU count for a dedicated host with this profile depends on its configuration. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuDependent.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuDependentTypeDependentConst = "dependent" +) + +func (*DedicatedHostProfileVcpuDependent) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuDependent unmarshals an instance of DedicatedHostProfileVcpuDependent from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuEnum : The permitted values for VCPU count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 DedicatedHostProfileVcpuEnum.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuEnumTypeEnumConst = "enum" +) + +func (*DedicatedHostProfileVcpuEnum) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuEnum unmarshals an instance of DedicatedHostProfileVcpuEnum from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuFixed : The VCPU count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuFixed.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuFixedTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileVcpuFixed) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuFixed unmarshals an instance of DedicatedHostProfileVcpuFixed from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuRange : The permitted range for VCPU count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuRange.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuRangeTypeRangeConst = "range" +) + +func (*DedicatedHostProfileVcpuRange) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuRange unmarshals an instance of DedicatedHostProfileVcpuRange from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPrototypeDedicatedHostByGroup : DedicatedHostPrototypeDedicatedHostByGroup struct +// This model "extends" DedicatedHostPrototype +type DedicatedHostPrototypeDedicatedHostByGroup struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The unique user-defined name for this dedicated host. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The profile to use for this dedicated host. + Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The dedicated host group for this dedicated host. + Group DedicatedHostGroupIdentityIntf `json:"group" validate:"required"` +} + +// NewDedicatedHostPrototypeDedicatedHostByGroup : Instantiate DedicatedHostPrototypeDedicatedHostByGroup (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByGroup(profile DedicatedHostProfileIdentityIntf, group DedicatedHostGroupIdentityIntf) (_model *DedicatedHostPrototypeDedicatedHostByGroup, err error) { + _model = &DedicatedHostPrototypeDedicatedHostByGroup{ + Profile: profile, + Group: group, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostPrototypeDedicatedHostByGroup) isaDedicatedHostPrototype() bool { + return true +} + +// UnmarshalDedicatedHostPrototypeDedicatedHostByGroup unmarshals an instance of DedicatedHostPrototypeDedicatedHostByGroup from the specified map of raw messages. +func UnmarshalDedicatedHostPrototypeDedicatedHostByGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPrototypeDedicatedHostByGroup) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPrototypeDedicatedHostByZone : DedicatedHostPrototypeDedicatedHostByZone struct +// This model "extends" DedicatedHostPrototype +type DedicatedHostPrototypeDedicatedHostByZone struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The unique user-defined name for this dedicated host. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The profile to use for this dedicated host. + Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Group *DedicatedHostGroupPrototypeDedicatedHostByZoneContext `json:"group,omitempty"` + + // The zone this dedicated host will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewDedicatedHostPrototypeDedicatedHostByZone : Instantiate DedicatedHostPrototypeDedicatedHostByZone (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByZone(profile DedicatedHostProfileIdentityIntf, zone ZoneIdentityIntf) (_model *DedicatedHostPrototypeDedicatedHostByZone, err error) { + _model = &DedicatedHostPrototypeDedicatedHostByZone{ + Profile: profile, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostPrototypeDedicatedHostByZone) isaDedicatedHostPrototype() bool { + return true +} + +// UnmarshalDedicatedHostPrototypeDedicatedHostByZone unmarshals an instance of DedicatedHostPrototypeDedicatedHostByZone from the specified map of raw messages. +func UnmarshalDedicatedHostPrototypeDedicatedHostByZone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPrototypeDedicatedHostByZone) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EncryptionKeyIdentityByCRN : EncryptionKeyIdentityByCRN struct +// This model "extends" EncryptionKeyIdentity +type EncryptionKeyIdentityByCRN struct { + // The CRN of the [Key Protect Root + // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto + // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. + CRN *string `json:"crn" validate:"required"` +} + +// NewEncryptionKeyIdentityByCRN : Instantiate EncryptionKeyIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewEncryptionKeyIdentityByCRN(crn string) (_model *EncryptionKeyIdentityByCRN, err error) { + _model = &EncryptionKeyIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EncryptionKeyIdentityByCRN) isaEncryptionKeyIdentity() bool { + return true +} + +// UnmarshalEncryptionKeyIdentityByCRN unmarshals an instance of EncryptionKeyIdentityByCRN from the specified map of raw messages. +func UnmarshalEncryptionKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EncryptionKeyIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPIdentity : Identifies a reserved IP by a unique property. +// Models which "extend" this model: +// - EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID +// - EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref +// This model "extends" EndpointGatewayReservedIP +type EndpointGatewayReservedIPReservedIPIdentity struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` +} + +func (*EndpointGatewayReservedIPReservedIPIdentity) isaEndpointGatewayReservedIPReservedIPIdentity() bool { + return true +} + +type EndpointGatewayReservedIPReservedIPIdentityIntf interface { + EndpointGatewayReservedIPIntf + isaEndpointGatewayReservedIPReservedIPIdentity() bool +} + +func (*EndpointGatewayReservedIPReservedIPIdentity) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPIdentity unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentity from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPPrototypeTargetContext : EndpointGatewayReservedIPReservedIPPrototypeTargetContext struct +// This model "extends" EndpointGatewayReservedIP +type EndpointGatewayReservedIPReservedIPPrototypeTargetContext 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The user-defined name for this reserved IP. If unspecified, the name will be a hyphenated list of randomly-selected + // words. Names must be unique within the subnet the reserved IP resides in. Names beginning with `ibm-` are reserved + // for provider-owned resources. + Name *string `json:"name,omitempty"` + + // The subnet in which to create this reserved IP. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` +} + +// NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext : Instantiate EndpointGatewayReservedIPReservedIPPrototypeTargetContext (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext(subnet SubnetIdentityIntf) (_model *EndpointGatewayReservedIPReservedIPPrototypeTargetContext, err error) { + _model = &EndpointGatewayReservedIPReservedIPPrototypeTargetContext{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayReservedIPReservedIPPrototypeTargetContext) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext unmarshals an instance of EndpointGatewayReservedIPReservedIPPrototypeTargetContext from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPPrototypeTargetContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderCloudServiceIdentity : EndpointGatewayTargetPrototypeProviderCloudServiceIdentity struct +// Models which "extend" this model: +// - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN +// This model "extends" EndpointGatewayTargetPrototype +type EndpointGatewayTargetPrototypeProviderCloudServiceIdentity struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn,omitempty"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderCloudServiceIdentity.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool { + return true +} + +type EndpointGatewayTargetPrototypeProviderCloudServiceIdentityIntf interface { + EndpointGatewayTargetPrototypeIntf + isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool +} + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity unmarshals an instance of EndpointGatewayTargetPrototypeProviderCloudServiceIdentity from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity : EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity struct +// Models which "extend" this model: +// - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName +// This model "extends" EndpointGatewayTargetPrototype +type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool { + return true +} + +type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityIntf interface { + EndpointGatewayTargetPrototypeIntf + isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool +} + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity unmarshals an instance of EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetProviderCloudServiceReference : EndpointGatewayTargetProviderCloudServiceReference struct +// This model "extends" EndpointGatewayTarget +type EndpointGatewayTargetProviderCloudServiceReference struct { + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn" validate:"required"` + + // The type of target. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetProviderCloudServiceReference.ResourceType property. +// The type of target. +const ( + EndpointGatewayTargetProviderCloudServiceReferenceResourceTypeProviderCloudServiceConst = "provider_cloud_service" +) + +func (*EndpointGatewayTargetProviderCloudServiceReference) isaEndpointGatewayTarget() bool { + return true +} + +// UnmarshalEndpointGatewayTargetProviderCloudServiceReference unmarshals an instance of EndpointGatewayTargetProviderCloudServiceReference from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetProviderCloudServiceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetProviderCloudServiceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetProviderInfrastructureServiceReference : The name of this provider infrastructure service. +// This model "extends" EndpointGatewayTarget +type EndpointGatewayTargetProviderInfrastructureServiceReference struct { + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name" validate:"required"` + + // The type of target. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetProviderInfrastructureServiceReference.ResourceType property. +// The type of target. +const ( + EndpointGatewayTargetProviderInfrastructureServiceReferenceResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetProviderInfrastructureServiceReference) isaEndpointGatewayTarget() bool { + return true +} + +// UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference unmarshals an instance of EndpointGatewayTargetProviderInfrastructureServiceReference from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetProviderInfrastructureServiceReference) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPByTargetNetworkInterfaceIdentity +type FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { + // The URL for this network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPByTargetNetworkInterfaceIdentity() bool { + return true +} + +// UnmarshalFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPByTargetNetworkInterfaceIdentity +type FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPByTargetNetworkInterfaceIdentity() bool { + return true +} + +// UnmarshalFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPPrototypeFloatingIPByTarget : FloatingIPPrototypeFloatingIPByTarget struct +// This model "extends" FloatingIPPrototype +type FloatingIPPrototypeFloatingIPByTarget struct { + // The unique user-defined name for this floating IP. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The network interface this floating IP is to be bound to. + Target FloatingIPByTargetNetworkInterfaceIdentityIntf `json:"target" validate:"required"` +} + +// NewFloatingIPPrototypeFloatingIPByTarget : Instantiate FloatingIPPrototypeFloatingIPByTarget (Generic Model Constructor) +func (*VpcV1) NewFloatingIPPrototypeFloatingIPByTarget(target FloatingIPByTargetNetworkInterfaceIdentityIntf) (_model *FloatingIPPrototypeFloatingIPByTarget, err error) { + _model = &FloatingIPPrototypeFloatingIPByTarget{ + Target: target, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPPrototypeFloatingIPByTarget) isaFloatingIPPrototype() bool { + return true +} + +// UnmarshalFloatingIPPrototypeFloatingIPByTarget unmarshals an instance of FloatingIPPrototypeFloatingIPByTarget from the specified map of raw messages. +func UnmarshalFloatingIPPrototypeFloatingIPByTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPrototypeFloatingIPByTarget) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPByTargetNetworkInterfaceIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPPrototypeFloatingIPByZone : FloatingIPPrototypeFloatingIPByZone struct +// This model "extends" FloatingIPPrototype +type FloatingIPPrototypeFloatingIPByZone struct { + // The unique user-defined name for this floating IP. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The zone this floating IP will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewFloatingIPPrototypeFloatingIPByZone : Instantiate FloatingIPPrototypeFloatingIPByZone (Generic Model Constructor) +func (*VpcV1) NewFloatingIPPrototypeFloatingIPByZone(zone ZoneIdentityIntf) (_model *FloatingIPPrototypeFloatingIPByZone, err error) { + _model = &FloatingIPPrototypeFloatingIPByZone{ + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPPrototypeFloatingIPByZone) isaFloatingIPPrototype() bool { + return true +} + +// UnmarshalFloatingIPPrototypeFloatingIPByZone unmarshals an instance of FloatingIPPrototypeFloatingIPByZone from the specified map of raw messages. +func UnmarshalFloatingIPPrototypeFloatingIPByZone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPrototypeFloatingIPByZone) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchNetworkInterfaceIdentityByHref : FloatingIPTargetPatchNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPatch +type FloatingIPTargetPatchNetworkInterfaceIdentityByHref struct { + // The URL for this network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPatchNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPatchNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchNetworkInterfaceIdentityByID : FloatingIPTargetPatchNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPatch +type FloatingIPTargetPatchNetworkInterfaceIdentityByID struct { + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPatchNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPatchNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetNetworkInterfaceReference : FloatingIPTargetNetworkInterfaceReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetNetworkInterfaceReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FloatingIPTargetNetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetNetworkInterfaceReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FloatingIPTargetNetworkInterfaceReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetNetworkInterfaceReference unmarshals an instance of FloatingIPTargetNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetNetworkInterfaceReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPublicGatewayReference : FloatingIPTargetPublicGatewayReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetPublicGatewayReference struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this public gateway. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FloatingIPTargetPublicGatewayReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetPublicGatewayReferenceResourceTypePublicGatewayConst = "public_gateway" +) + +func (*FloatingIPTargetPublicGatewayReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetPublicGatewayReference unmarshals an instance of FloatingIPTargetPublicGatewayReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetPublicGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPublicGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPublicGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID +// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN +// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeInstanceIdentity struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentity) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeInstanceIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity : Identifies a network interface by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID +// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentity : Identifies a subnet by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID +// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN +// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeSubnetIdentity struct { + // The unique identifier for this subnet. + ID *string `json:"id,omitempty"` + + // The CRN for this subnet. + CRN *string `json:"crn,omitempty"` + + // The URL for this subnet. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentity) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeSubnetIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentity : Identifies a VPC by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID +// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN +// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeVPCIdentity struct { + // The unique identifier for this VPC. + ID *string `json:"id,omitempty"` + + // The CRN for this VPC. + CRN *string `json:"crn,omitempty"` + + // The URL for this VPC. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentity) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeVPCIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeVPCIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetInstanceReference : FlowLogCollectorTargetInstanceReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetInstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this virtual server instance (and default system hostname). + Name *string `json:"name" validate:"required"` +} + +func (*FlowLogCollectorTargetInstanceReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetInstanceReference unmarshals an instance of FlowLogCollectorTargetInstanceReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext : FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetSubnetReference : FlowLogCollectorTargetSubnetReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetSubnetReference struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SubnetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this subnet. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this subnet. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetSubnetReference.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetSubnetReferenceResourceTypeSubnetConst = "subnet" +) + +func (*FlowLogCollectorTargetSubnetReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetSubnetReference unmarshals an instance of FlowLogCollectorTargetSubnetReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetSubnetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetSubnetReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSubnetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetVPCReference : FlowLogCollectorTargetVPCReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetVPCReference struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetVPCReference.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetVPCReferenceResourceTypeVPCConst = "vpc" +) + +func (*FlowLogCollectorTargetVPCReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetVPCReference unmarshals an instance of FlowLogCollectorTargetVPCReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetVPCReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetVPCReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentityByCRN : ImageIdentityByCRN struct +// This model "extends" ImageIdentity +type ImageIdentityByCRN struct { + // The CRN for this image. + CRN *string `json:"crn" validate:"required"` +} + +// NewImageIdentityByCRN : Instantiate ImageIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewImageIdentityByCRN(crn string) (_model *ImageIdentityByCRN, err error) { + _model = &ImageIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImageIdentityByCRN) isaImageIdentity() bool { + return true +} + +// UnmarshalImageIdentityByCRN unmarshals an instance of ImageIdentityByCRN from the specified map of raw messages. +func UnmarshalImageIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentityByHref : ImageIdentityByHref struct +// This model "extends" ImageIdentity +type ImageIdentityByHref struct { + // The URL for this image. + Href *string `json:"href" validate:"required"` +} + +// NewImageIdentityByHref : Instantiate ImageIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewImageIdentityByHref(href string) (_model *ImageIdentityByHref, err error) { + _model = &ImageIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImageIdentityByHref) isaImageIdentity() bool { + return true +} + +// UnmarshalImageIdentityByHref unmarshals an instance of ImageIdentityByHref from the specified map of raw messages. +func UnmarshalImageIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentityByID : ImageIdentityByID struct +// This model "extends" ImageIdentity +type ImageIdentityByID struct { + // The unique identifier for this image. + ID *string `json:"id" validate:"required"` +} + +// NewImageIdentityByID : Instantiate ImageIdentityByID (Generic Model Constructor) +func (*VpcV1) NewImageIdentityByID(id string) (_model *ImageIdentityByID, err error) { + _model = &ImageIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImageIdentityByID) isaImageIdentity() bool { + return true +} + +// UnmarshalImageIdentityByID unmarshals an instance of ImageIdentityByID from the specified map of raw messages. +func UnmarshalImageIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImagePrototypeImageByFile : ImagePrototypeImageByFile struct +// This model "extends" ImagePrototype +type ImagePrototypeImageByFile struct { + // The unique user-defined name for this image. Names starting with `ibm-` are not allowed. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. + // + // That representation is created by wrapping the key's value with the `encryption_key` root key (which must also be + // specified), using either [Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the + // [Hyper Protect Crypto Services](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). + // + // If unspecified, the imported image is treated as unencrypted. + EncryptedDataKey *string `json:"encrypted_data_key,omitempty"` + + // The root key that was used to wrap the data key (which is ultimately represented as + // `encrypted_data_key`). Additionally, the root key will be used to encrypt volumes + // created from this image (unless an alternate `encryption_key` is specified at volume + // creation). + // + // If unspecified, the imported image is treated as unencrypted. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The file from which to create the image. + File *ImageFilePrototype `json:"file" validate:"required"` + + // The [supported operating + // system](https://cloud.ibm.com/apidocs/vpc#list-operating-systems) included in this + // image. + OperatingSystem OperatingSystemIdentityIntf `json:"operating_system" validate:"required"` +} + +// NewImagePrototypeImageByFile : Instantiate ImagePrototypeImageByFile (Generic Model Constructor) +func (*VpcV1) NewImagePrototypeImageByFile(file *ImageFilePrototype, operatingSystem OperatingSystemIdentityIntf) (_model *ImagePrototypeImageByFile, err error) { + _model = &ImagePrototypeImageByFile{ + File: file, + OperatingSystem: operatingSystem, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImagePrototypeImageByFile) isaImagePrototype() bool { + return true +} + +// UnmarshalImagePrototypeImageByFile unmarshals an instance of ImagePrototypeImageByFile from the specified map of raw messages. +func UnmarshalImagePrototypeImageByFile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePrototypeImageByFile) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImagePrototypeImageBySourceVolume : ImagePrototypeImageBySourceVolume struct +// This model "extends" ImagePrototype +type ImagePrototypeImageBySourceVolume struct { + // The unique user-defined name for this image. Names starting with `ibm-` are not allowed. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The root key used to wrap the system-generated data encryption key for the image. + // + // If unspecified, the root key from `source_volume` will be used. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The volume from which to create the image. The specified volume must: + // - Originate from an image, which will be used to populate this image's + // operating system information. + // - Not be `active` or `busy`. + // + // During image creation, the specified volume may briefly become `busy`. + SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` +} + +// NewImagePrototypeImageBySourceVolume : Instantiate ImagePrototypeImageBySourceVolume (Generic Model Constructor) +func (*VpcV1) NewImagePrototypeImageBySourceVolume(sourceVolume VolumeIdentityIntf) (_model *ImagePrototypeImageBySourceVolume, err error) { + _model = &ImagePrototypeImageBySourceVolume{ + SourceVolume: sourceVolume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImagePrototypeImageBySourceVolume) isaImagePrototype() bool { + return true +} + +// UnmarshalImagePrototypeImageBySourceVolume unmarshals an instance of ImagePrototypeImageBySourceVolume from the specified map of raw messages. +func UnmarshalImagePrototypeImageBySourceVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePrototypeImageBySourceVolume) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototype : InstanceGroupManagerActionPrototypeScheduledActionPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec +// This model "extends" InstanceGroupManagerActionPrototype +type InstanceGroupManagerActionPrototypeScheduledActionPrototype struct { + // The user-defined name for this instance group manager action. Names must be unique within the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototype) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf interface { + InstanceGroupManagerActionPrototypeIntf + isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototype) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototype unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionScheduledAction : InstanceGroupManagerActionScheduledAction struct +// Models which "extend" this model: +// - InstanceGroupManagerActionScheduledActionGroupTarget +// - InstanceGroupManagerActionScheduledActionManagerTarget +// This model "extends" InstanceGroupManagerAction +type InstanceGroupManagerActionScheduledAction struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. 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`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the + // future. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` + + // The date and time that the instance group manager action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group manager action. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was modified. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type" validate:"required"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroup `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager,omitempty"` +} + +// Constants associated with the InstanceGroupManagerActionScheduledAction.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionScheduledActionResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerActionScheduledAction.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionScheduledActionStatusActiveConst = "active" + InstanceGroupManagerActionScheduledActionStatusCompletedConst = "completed" + InstanceGroupManagerActionScheduledActionStatusFailedConst = "failed" + InstanceGroupManagerActionScheduledActionStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionScheduledActionStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerActionScheduledAction.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionScheduledActionActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerActionScheduledAction) isaInstanceGroupManagerActionScheduledAction() bool { + return true +} + +type InstanceGroupManagerActionScheduledActionIntf interface { + InstanceGroupManagerActionIntf + isaInstanceGroupManagerActionScheduledAction() bool +} + +func (*InstanceGroupManagerActionScheduledAction) isaInstanceGroupManagerAction() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionScheduledAction unmarshals an instance of InstanceGroupManagerActionScheduledAction from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionScheduledAction(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionScheduledAction) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerAutoScale : InstanceGroupManagerAutoScale struct +// This model "extends" InstanceGroupManager +type InstanceGroupManagerAutoScale struct { + // The date and time that the instance group manager was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled" validate:"required"` + + // The user-defined name for this instance group manager. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window" validate:"required"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown" validate:"required"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type" validate:"required"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count" validate:"required"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count" validate:"required"` + + // The policies of the instance group manager. + Policies []InstanceGroupManagerPolicyReference `json:"policies" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerAutoScale.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerAutoScaleManagerTypeAutoscaleConst = "autoscale" +) + +func (*InstanceGroupManagerAutoScale) isaInstanceGroupManager() bool { + return true +} + +// UnmarshalInstanceGroupManagerAutoScale unmarshals an instance of InstanceGroupManagerAutoScale from the specified map of raw messages. +func UnmarshalInstanceGroupManagerAutoScale(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerAutoScale) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype : InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype struct +// This model "extends" InstanceGroupManagerPolicyPrototype +type InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype struct { + // The user-defined name for this instance group manager policy. Names must be unique within the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type" validate:"required"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value" validate:"required"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypePolicyTypeTargetConst = "target" +) + +// NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype : Instantiate InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype(metricType string, metricValue int64, policyType string) (_model *InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype, err error) { + _model = &InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype{ + MetricType: core.StringPtr(metricType), + MetricValue: core.Int64Ptr(metricValue), + PolicyType: core.StringPtr(policyType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) isaInstanceGroupManagerPolicyPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype unmarshals an instance of InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy : InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy struct +// This model "extends" InstanceGroupManagerPolicy +type InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy struct { + // The date and time that the instance group manager policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager policy. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group manager policy. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager policy was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type" validate:"required"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value" validate:"required"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyPolicyTypeTargetConst = "target" +) + +func (*InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy) isaInstanceGroupManagerPolicy() bool { + return true +} + +// UnmarshalInstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy unmarshals an instance of InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype : InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype struct +// This model "extends" InstanceGroupManagerPrototype +type InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype struct { + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The user-defined name for this instance group manager. Names must be unique within the instance group. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type" validate:"required"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count" validate:"required"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototypeManagerTypeAutoscaleConst = "autoscale" +) + +// NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype : Instantiate InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype(managerType string, maxMembershipCount int64) (_model *InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype, err error) { + _model = &InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype{ + ManagerType: core.StringPtr(managerType), + MaxMembershipCount: core.Int64Ptr(maxMembershipCount), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) isaInstanceGroupManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype unmarshals an instance of InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype : InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype struct +// This model "extends" InstanceGroupManagerPrototype +type InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype struct { + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The user-defined name for this instance group manager. Names must be unique within the instance group. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototypeManagerTypeScheduledConst = "scheduled" +) + +// NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype : Instantiate InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype(managerType string) (_model *InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype, err error) { + _model = &InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype{ + ManagerType: core.StringPtr(managerType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype) isaInstanceGroupManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype unmarshals an instance of InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype) + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduled : InstanceGroupManagerScheduled struct +// This model "extends" InstanceGroupManager +type InstanceGroupManagerScheduled struct { + // The date and time that the instance group manager was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled" validate:"required"` + + // The user-defined name for this instance group manager. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The actions of the instance group manager. + Actions []InstanceGroupManagerActionReference `json:"actions" validate:"required"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerScheduled.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerScheduledManagerTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerScheduled) isaInstanceGroupManager() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduled unmarshals an instance of InstanceGroupManagerScheduled from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduled(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduled) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerAutoScale : InstanceGroupManagerScheduledActionManagerAutoScale struct +// This model "extends" InstanceGroupManagerScheduledActionManager +type InstanceGroupManagerScheduledActionManagerAutoScale struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group manager. + Name *string `json:"name" validate:"required"` + + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +func (*InstanceGroupManagerScheduledActionManagerAutoScale) isaInstanceGroupManagerScheduledActionManager() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerAutoScale unmarshals an instance of InstanceGroupManagerScheduledActionManagerAutoScale from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerAutoScale(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerAutoScale) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype : The auto scale manager to update, and one or more properties to be updated. Either `id` or `href` must be specified, +// in addition to at least one of `min_membership_count` and +// `max_membership_count`. +// Models which "extend" this model: +// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID +// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref +// This model "extends" InstanceGroupManagerScheduledActionManagerPrototype +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The unique identifier for this instance group manager. + ID *string `json:"id,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href,omitempty"` +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { + return true +} + +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeIntf interface { + InstanceGroupManagerScheduledActionManagerPrototypeIntf + isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePatchProfileInstanceProfileIdentityByHref : InstancePatchProfileInstanceProfileIdentityByHref struct +// This model "extends" InstancePatchProfile +type InstancePatchProfileInstanceProfileIdentityByHref struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePatchProfileInstanceProfileIdentityByHref : Instantiate InstancePatchProfileInstanceProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByHref(href string) (_model *InstancePatchProfileInstanceProfileIdentityByHref, err error) { + _model = &InstancePatchProfileInstanceProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePatchProfileInstanceProfileIdentityByHref) isaInstancePatchProfile() bool { + return true +} + +// UnmarshalInstancePatchProfileInstanceProfileIdentityByHref unmarshals an instance of InstancePatchProfileInstanceProfileIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePatchProfileInstanceProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatchProfileInstanceProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePatchProfileInstanceProfileIdentityByName : InstancePatchProfileInstanceProfileIdentityByName struct +// This model "extends" InstancePatchProfile +type InstancePatchProfileInstanceProfileIdentityByName struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` +} + +// NewInstancePatchProfileInstanceProfileIdentityByName : Instantiate InstancePatchProfileInstanceProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByName(name string) (_model *InstancePatchProfileInstanceProfileIdentityByName, err error) { + _model = &InstancePatchProfileInstanceProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePatchProfileInstanceProfileIdentityByName) isaInstancePatchProfile() bool { + return true +} + +// UnmarshalInstancePatchProfileInstanceProfileIdentityByName unmarshals an instance of InstancePatchProfileInstanceProfileIdentityByName from the specified map of raw messages. +func UnmarshalInstancePatchProfileInstanceProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatchProfileInstanceProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID +// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN +// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref +// This model "extends" InstancePlacementTargetPatch +type InstancePlacementTargetPatchDedicatedHostGroupIdentity struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host group. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentity) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +type InstancePlacementTargetPatchDedicatedHostGroupIdentityIntf interface { + InstancePlacementTargetPatchIntf + isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentity) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentity unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentity : Identifies a dedicated host by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID +// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN +// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref +// This model "extends" InstancePlacementTargetPatch +type InstancePlacementTargetPatchDedicatedHostIdentity struct { + // The unique identifier for this dedicated host. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentity) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +type InstancePlacementTargetPatchDedicatedHostIdentityIntf interface { + InstancePlacementTargetPatchIntf + isaInstancePlacementTargetPatchDedicatedHostIdentity() bool +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentity) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentity unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID +// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN +// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref +// This model "extends" InstancePlacementTargetPrototype +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentity struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host group. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityIntf interface { + InstancePlacementTargetPrototypeIntf + isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentity unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentity : Identifies a dedicated host by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID +// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN +// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref +// This model "extends" InstancePlacementTargetPrototype +type InstancePlacementTargetPrototypeDedicatedHostIdentity struct { + // The unique identifier for this dedicated host. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentity) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +type InstancePlacementTargetPrototypeDedicatedHostIdentityIntf interface { + InstancePlacementTargetPrototypeIntf + isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentity) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentity unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentity : Identifies a placement group by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID +// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN +// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref +// This model "extends" InstancePlacementTargetPrototype +type InstancePlacementTargetPrototypePlacementGroupIdentity struct { + // The unique identifier for this placement group. + ID *string `json:"id,omitempty"` + + // The CRN for this placement group. + CRN *string `json:"crn,omitempty"` + + // The URL for this placement group. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentity) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +type InstancePlacementTargetPrototypePlacementGroupIdentityIntf interface { + InstancePlacementTargetPrototypeIntf + isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentity) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentity unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetDedicatedHostGroupReference : InstancePlacementTargetDedicatedHostGroupReference struct +// This model "extends" InstancePlacementTarget +type InstancePlacementTargetDedicatedHostGroupReference struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this dedicated host group. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstancePlacementTargetDedicatedHostGroupReference.ResourceType property. +// The resource type. +const ( + InstancePlacementTargetDedicatedHostGroupReferenceResourceTypeDedicatedHostGroupConst = "dedicated_host_group" +) + +func (*InstancePlacementTargetDedicatedHostGroupReference) isaInstancePlacementTarget() bool { + return true +} + +// UnmarshalInstancePlacementTargetDedicatedHostGroupReference unmarshals an instance of InstancePlacementTargetDedicatedHostGroupReference from the specified map of raw messages. +func UnmarshalInstancePlacementTargetDedicatedHostGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetDedicatedHostGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetDedicatedHostReference : InstancePlacementTargetDedicatedHostReference struct +// This model "extends" InstancePlacementTarget +type InstancePlacementTargetDedicatedHostReference struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this dedicated host. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstancePlacementTargetDedicatedHostReference.ResourceType property. +// The resource type. +const ( + InstancePlacementTargetDedicatedHostReferenceResourceTypeDedicatedHostConst = "dedicated_host" +) + +func (*InstancePlacementTargetDedicatedHostReference) isaInstancePlacementTarget() bool { + return true +} + +// UnmarshalInstancePlacementTargetDedicatedHostReference unmarshals an instance of InstancePlacementTargetDedicatedHostReference from the specified map of raw messages. +func UnmarshalInstancePlacementTargetDedicatedHostReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetDedicatedHostReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPlacementGroupReference : InstancePlacementTargetPlacementGroupReference struct +// This model "extends" InstancePlacementTarget +type InstancePlacementTargetPlacementGroupReference struct { + // The CRN for this placement group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *PlacementGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this placement group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this placement group. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this placement group. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstancePlacementTargetPlacementGroupReference.ResourceType property. +// The resource type. +const ( + InstancePlacementTargetPlacementGroupReferenceResourceTypePlacementGroupConst = "placement_group" +) + +func (*InstancePlacementTargetPlacementGroupReference) isaInstancePlacementTarget() bool { + return true +} + +// UnmarshalInstancePlacementTargetPlacementGroupReference unmarshals an instance of InstancePlacementTargetPlacementGroupReference from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPlacementGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPlacementGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPlacementGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthDependent : The total bandwidth shared across the network interfaces and storage volumes of an instance with this profile depends +// on its configuration. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileBandwidthDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileBandwidthDependent) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthDependent unmarshals an instance of InstanceProfileBandwidthDependent from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network interfaces and storage +// volumes of an instance with this profile. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileBandwidthEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileBandwidthEnum) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthEnum unmarshals an instance of InstanceProfileBandwidthEnum from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network interfaces and storage volumes of an instance +// with this profile. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileBandwidthFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileBandwidthFixed) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthFixed unmarshals an instance of InstanceProfileBandwidthFixed from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network interfaces and storage volumes +// of an instance with this profile. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileBandwidthRange.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthRangeTypeRangeConst = "range" +) + +func (*InstanceProfileBandwidthRange) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthRange unmarshals an instance of InstanceProfileBandwidthRange from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + 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 { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskQuantityDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileDiskQuantityDependent) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityDependent unmarshals an instance of InstanceProfileDiskQuantityDependent from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantityEnum : The permitted the number of disks of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskQuantity +type InstanceProfileDiskQuantityEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileDiskQuantityEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileDiskQuantityEnum) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityEnum unmarshals an instance of InstanceProfileDiskQuantityEnum from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantityFixed : The number of disks of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskQuantity +type InstanceProfileDiskQuantityFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskQuantityFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskQuantityFixed) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityFixed unmarshals an instance of InstanceProfileDiskQuantityFixed from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantityRange : The permitted range for the number of disks of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskQuantity +type InstanceProfileDiskQuantityRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskQuantityRange.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityRangeTypeRangeConst = "range" +) + +func (*InstanceProfileDiskQuantityRange) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityRange unmarshals an instance of InstanceProfileDiskQuantityRange from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeDependent : The disk size in GB (gigabytes) of this configuration for an instance with this profile depends on its instance +// configuration. +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSizeDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileDiskSizeDependent) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeDependent unmarshals an instance of InstanceProfileDiskSizeDependent from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeEnum : The permitted disk size in GB (gigabytes) of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileDiskSizeEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileDiskSizeEnum) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeEnum unmarshals an instance of InstanceProfileDiskSizeEnum from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeFixed : The size of the disk in GB (gigabytes). +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSizeFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskSizeFixed) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeFixed unmarshals an instance of InstanceProfileDiskSizeFixed from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeRange : The permitted range for the disk size of this configuration in GB (gigabytes) for an instance with this profile. +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSizeRange.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeRangeTypeRangeConst = "range" +) + +func (*InstanceProfileDiskSizeRange) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeRange unmarshals an instance of InstanceProfileDiskSizeRange from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuDependent : The GPU count for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileGpu +type InstanceProfileGpuDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileGpuDependent) isaInstanceProfileGpu() bool { + return true +} + +// UnmarshalInstanceProfileGpuDependent unmarshals an instance of InstanceProfileGpuDependent from the specified map of raw messages. +func UnmarshalInstanceProfileGpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuEnum : The permitted GPU count values for an instance with this profile. +// This model "extends" InstanceProfileGpu +type InstanceProfileGpuEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileGpuEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileGpuEnum) isaInstanceProfileGpu() bool { + return true +} + +// UnmarshalInstanceProfileGpuEnum unmarshals an instance of InstanceProfileGpuEnum from the specified map of raw messages. +func UnmarshalInstanceProfileGpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuFixed : The GPU count for an instance with this profile. +// This model "extends" InstanceProfileGpu +type InstanceProfileGpuFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileGpuFixed) isaInstanceProfileGpu() bool { + return true +} + +// UnmarshalInstanceProfileGpuFixed unmarshals an instance of InstanceProfileGpuFixed from the specified map of raw messages. +func UnmarshalInstanceProfileGpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemoryDependent : The overall GPU memory value for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileGpuMemory +type InstanceProfileGpuMemoryDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuMemoryDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileGpuMemoryDependent) isaInstanceProfileGpuMemory() bool { + return true +} + +// UnmarshalInstanceProfileGpuMemoryDependent unmarshals an instance of InstanceProfileGpuMemoryDependent from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemoryDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemoryEnum : The permitted overall GPU memory values in GiB (gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileGpuMemory +type InstanceProfileGpuMemoryEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileGpuMemoryEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileGpuMemoryEnum) isaInstanceProfileGpuMemory() bool { + return true +} + +// UnmarshalInstanceProfileGpuMemoryEnum unmarshals an instance of InstanceProfileGpuMemoryEnum from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemoryEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemoryFixed : The overall GPU memory in GiB (gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileGpuMemory +type InstanceProfileGpuMemoryFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuMemoryFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileGpuMemoryFixed) isaInstanceProfileGpuMemory() bool { + return true +} + +// UnmarshalInstanceProfileGpuMemoryFixed unmarshals an instance of InstanceProfileGpuMemoryFixed from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemoryFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemoryRange : The permitted overall GPU memory range in GiB (gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileGpuMemory +type InstanceProfileGpuMemoryRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuMemoryRange.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryRangeTypeRangeConst = "range" +) + +func (*InstanceProfileGpuMemoryRange) isaInstanceProfileGpuMemory() bool { + return true +} + +// UnmarshalInstanceProfileGpuMemoryRange unmarshals an instance of InstanceProfileGpuMemoryRange from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemoryRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuRange : The permitted GPU count range for an instance with this profile. +// This model "extends" InstanceProfileGpu +type InstanceProfileGpuRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuRange.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuRangeTypeRangeConst = "range" +) + +func (*InstanceProfileGpuRange) isaInstanceProfileGpu() bool { + return true +} + +// UnmarshalInstanceProfileGpuRange unmarshals an instance of InstanceProfileGpuRange from the specified map of raw messages. +func UnmarshalInstanceProfileGpuRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileIdentityByHref : InstanceProfileIdentityByHref struct +// This model "extends" InstanceProfileIdentity +type InstanceProfileIdentityByHref struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceProfileIdentityByHref : Instantiate InstanceProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceProfileIdentityByHref(href string) (_model *InstanceProfileIdentityByHref, err error) { + _model = &InstanceProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceProfileIdentityByHref) isaInstanceProfileIdentity() bool { + return true +} + +// UnmarshalInstanceProfileIdentityByHref unmarshals an instance of InstanceProfileIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileIdentityByName : InstanceProfileIdentityByName struct +// This model "extends" InstanceProfileIdentity +type InstanceProfileIdentityByName struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` +} + +// NewInstanceProfileIdentityByName : Instantiate InstanceProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewInstanceProfileIdentityByName(name string) (_model *InstanceProfileIdentityByName, err error) { + _model = &InstanceProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceProfileIdentityByName) isaInstanceProfileIdentity() bool { + return true +} + +// UnmarshalInstanceProfileIdentityByName unmarshals an instance of InstanceProfileIdentityByName from the specified map of raw messages. +func UnmarshalInstanceProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryDependent : The memory value for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileMemoryDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileMemoryDependent) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryDependent unmarshals an instance of InstanceProfileMemoryDependent from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryEnum : The permitted memory values (in gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileMemoryEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileMemoryEnum) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryEnum unmarshals an instance of InstanceProfileMemoryEnum from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryFixed : The memory (in gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileMemoryFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileMemoryFixed) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryFixed unmarshals an instance of InstanceProfileMemoryFixed from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryRange : The permitted memory range (in gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileMemoryRange.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryRangeTypeRangeConst = "range" +) + +func (*InstanceProfileMemoryRange) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryRange unmarshals an instance of InstanceProfileMemoryRange from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfilePortSpeedDependent : The port speed of each network interface of an instance with this profile depends on its configuration. +// This model "extends" InstanceProfilePortSpeed +type InstanceProfilePortSpeedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfilePortSpeedDependent.Type property. +// The type for this profile field. +const ( + InstanceProfilePortSpeedDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfilePortSpeedDependent) isaInstanceProfilePortSpeed() bool { + return true +} + +// UnmarshalInstanceProfilePortSpeedDependent unmarshals an instance of InstanceProfilePortSpeedDependent from the specified map of raw messages. +func UnmarshalInstanceProfilePortSpeedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfilePortSpeedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfilePortSpeedFixed : The maximum speed (in megabits per second) of each network interface of an instance with this profile. +// This model "extends" InstanceProfilePortSpeed +type InstanceProfilePortSpeedFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfilePortSpeedFixed.Type property. +// The type for this profile field. +const ( + InstanceProfilePortSpeedFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfilePortSpeedFixed) isaInstanceProfilePortSpeed() bool { + return true +} + +// UnmarshalInstanceProfilePortSpeedFixed unmarshals an instance of InstanceProfilePortSpeedFixed from the specified map of raw messages. +func UnmarshalInstanceProfilePortSpeedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfilePortSpeedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuDependent : The VCPU count for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileVcpuDependent) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuDependent unmarshals an instance of InstanceProfileVcpuDependent from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuEnum : The permitted values for VCPU count for an instance with this profile. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileVcpuEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileVcpuEnum) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuEnum unmarshals an instance of InstanceProfileVcpuEnum from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuFixed : The VCPU count for an instance with this profile. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileVcpuFixed) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuFixed unmarshals an instance of InstanceProfileVcpuFixed from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuRange : The permitted range for VCPU count for an instance with this profile. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuRange.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuRangeTypeRangeConst = "range" +) + +func (*InstanceProfileVcpuRange) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuRange unmarshals an instance of InstanceProfileVcpuRange from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidthDependent : The storage bandwidth shared across the storage volumes of an instance with this profile depends on its +// configuration. +// This model "extends" InstanceProfileVolumeBandwidth +type InstanceProfileVolumeBandwidthDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVolumeBandwidthDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileVolumeBandwidthDependent) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileVolumeBandwidthDependent unmarshals an instance of InstanceProfileVolumeBandwidthDependent from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidthDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidthEnum : The permitted storage bandwidth values (in megabits per second) shared across the storage volumes of an instance with +// this profile. +// This model "extends" InstanceProfileVolumeBandwidth +type InstanceProfileVolumeBandwidthEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileVolumeBandwidthEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileVolumeBandwidthEnum) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileVolumeBandwidthEnum unmarshals an instance of InstanceProfileVolumeBandwidthEnum from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidthEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidthFixed : The storage bandwidth (in megabits per second) shared across the storage volumes of an instance with this profile. +// This model "extends" InstanceProfileVolumeBandwidth +type InstanceProfileVolumeBandwidthFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileVolumeBandwidthFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileVolumeBandwidthFixed) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileVolumeBandwidthFixed unmarshals an instance of InstanceProfileVolumeBandwidthFixed from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidthFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidthRange : The permitted storage bandwidth range (in megabits per second) shared across the storage volumes of an instance with +// this profile. +// This model "extends" InstanceProfileVolumeBandwidth +type InstanceProfileVolumeBandwidthRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVolumeBandwidthRange.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthRangeTypeRangeConst = "range" +) + +func (*InstanceProfileVolumeBandwidthRange) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileVolumeBandwidthRange unmarshals an instance of InstanceProfileVolumeBandwidthRange from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidthRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByImage : InstancePrototypeInstanceByImage struct +// This model "extends" InstancePrototype +type InstancePrototypeInstanceByImage struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will be used, but this default value + // is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the + // subnets of the instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewInstancePrototypeInstanceByImage : Instantiate InstancePrototypeInstanceByImage (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByImage, err error) { + _model = &InstancePrototypeInstanceByImage{ + Image: image, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByImage) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByImage unmarshals an instance of InstancePrototypeInstanceByImage from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByImage) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceSnapshot : InstancePrototypeInstanceBySourceSnapshot struct +// This model "extends" InstancePrototype +type InstancePrototypeInstanceBySourceSnapshot struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will be used, but this default value + // is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the + // subnets of the instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewInstancePrototypeInstanceBySourceSnapshot : Instantiate InstancePrototypeInstanceBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceBySourceSnapshot, err error) { + _model = &InstancePrototypeInstanceBySourceSnapshot{ + BootVolumeAttachment: bootVolumeAttachment, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceSnapshot unmarshals an instance of InstancePrototypeInstanceBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceSnapshot) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceTemplate : InstancePrototypeInstanceBySourceTemplate struct +// This model "extends" InstancePrototype +type InstancePrototypeInstanceBySourceTemplate struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will be used, but this default value + // is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the + // subnets of the instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// NewInstancePrototypeInstanceBySourceTemplate : Instantiate InstancePrototypeInstanceBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstancePrototypeInstanceBySourceTemplate, err error) { + _model = &InstancePrototypeInstanceBySourceTemplate{ + SourceTemplate: sourceTemplate, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceTemplate) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceTemplate unmarshals an instance of InstancePrototypeInstanceBySourceTemplate from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceTemplate) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByCRN : InstanceTemplateIdentityByCRN struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByCRN struct { + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstanceTemplateIdentityByCRN : Instantiate InstanceTemplateIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByCRN(crn string) (_model *InstanceTemplateIdentityByCRN, err error) { + _model = &InstanceTemplateIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByCRN) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByCRN unmarshals an instance of InstanceTemplateIdentityByCRN from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByHref : InstanceTemplateIdentityByHref struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByHref struct { + // The URL for this instance template. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceTemplateIdentityByHref : Instantiate InstanceTemplateIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByHref(href string) (_model *InstanceTemplateIdentityByHref, err error) { + _model = &InstanceTemplateIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByHref) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByHref unmarshals an instance of InstanceTemplateIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByID : InstanceTemplateIdentityByID struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByID struct { + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceTemplateIdentityByID : Instantiate InstanceTemplateIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByID(id string) (_model *InstanceTemplateIdentityByID, err error) { + _model = &InstanceTemplateIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByID) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByID unmarshals an instance of InstanceTemplateIdentityByID from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceByImage : InstanceTemplatePrototypeInstanceByImage struct +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceByImage struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will be used, but this default value + // is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the + // subnets of the instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceByImage : Instantiate InstanceTemplatePrototypeInstanceByImage (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceByImage, err error) { + _model = &InstanceTemplatePrototypeInstanceByImage{ + Image: image, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceByImage) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceByImage unmarshals an instance of InstanceTemplatePrototypeInstanceByImage from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceByImage) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceBySourceTemplate : InstanceTemplatePrototypeInstanceBySourceTemplate struct +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceBySourceTemplate struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will be used, but this default value + // is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the + // subnets of the instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// NewInstanceTemplatePrototypeInstanceBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceBySourceTemplate, err error) { + _model = &InstanceTemplatePrototypeInstanceBySourceTemplate{ + SourceTemplate: sourceTemplate, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceBySourceTemplate) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceBySourceTemplate from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceBySourceTemplate) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByImage : InstanceTemplateInstanceByImage struct +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByImage struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The unique user-defined name for this instance template. + Name *string `json:"name" validate:"required"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will be used, but this default value + // is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the + // subnets of the instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +func (*InstanceTemplateInstanceByImage) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByImage unmarshals an instance of InstanceTemplateInstanceByImage from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImage) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceBySourceSnapshot : InstanceTemplateInstanceBySourceSnapshot struct +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceBySourceSnapshot struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The unique user-defined name for this instance template. + Name *string `json:"name" validate:"required"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will be used, but this default value + // is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the + // subnets of the instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +func (*InstanceTemplateInstanceBySourceSnapshot) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceBySourceSnapshot unmarshals an instance of InstanceTemplateInstanceBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshot) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByCRN : KeyIdentityByCRN struct +// This model "extends" KeyIdentity +type KeyIdentityByCRN struct { + // The CRN for this key. + CRN *string `json:"crn" validate:"required"` +} + +// NewKeyIdentityByCRN : Instantiate KeyIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByCRN(crn string) (_model *KeyIdentityByCRN, err error) { + _model = &KeyIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*KeyIdentityByCRN) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByCRN unmarshals an instance of KeyIdentityByCRN from the specified map of raw messages. +func UnmarshalKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByFingerprint : KeyIdentityByFingerprint struct +// This model "extends" KeyIdentity +type KeyIdentityByFingerprint struct { + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint" validate:"required"` +} + +// NewKeyIdentityByFingerprint : Instantiate KeyIdentityByFingerprint (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByFingerprint(fingerprint string) (_model *KeyIdentityByFingerprint, err error) { + _model = &KeyIdentityByFingerprint{ + Fingerprint: core.StringPtr(fingerprint), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*KeyIdentityByFingerprint) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByFingerprint unmarshals an instance of KeyIdentityByFingerprint from the specified map of raw messages. +func UnmarshalKeyIdentityByFingerprint(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByFingerprint) + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByHref : KeyIdentityByHref struct +// This model "extends" KeyIdentity +type KeyIdentityByHref struct { + // The URL for this key. + Href *string `json:"href" validate:"required"` +} + +// NewKeyIdentityByHref : Instantiate KeyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByHref(href string) (_model *KeyIdentityByHref, err error) { + _model = &KeyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*KeyIdentityByHref) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByHref unmarshals an instance of KeyIdentityByHref from the specified map of raw messages. +func UnmarshalKeyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByID : KeyIdentityByID struct +// This model "extends" KeyIdentity +type KeyIdentityByID struct { + // The unique identifier for this key. + ID *string `json:"id" validate:"required"` +} + +// NewKeyIdentityByID : Instantiate KeyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByID(id string) (_model *KeyIdentityByID, err error) { + _model = &KeyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*KeyIdentityByID) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByID unmarshals an instance of KeyIdentityByID from the specified map of raw messages. +func UnmarshalKeyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct +// This model "extends" LegacyCloudObjectStorageBucketIdentity +type LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct { + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name" validate:"required"` +} + +// NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : Instantiate LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName (Generic Model Constructor) +func (*VpcV1) NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(name string) (_model *LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName, err error) { + _model = &LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) isaLegacyCloudObjectStorageBucketIdentity() bool { + return true +} + +// UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName unmarshals an instance of LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName from the specified map of raw messages. +func UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentityByCRN : LoadBalancerIdentityByCRN struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByCRN struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewLoadBalancerIdentityByCRN : Instantiate LoadBalancerIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByCRN(crn string) (_model *LoadBalancerIdentityByCRN, err error) { + _model = &LoadBalancerIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerIdentityByCRN) isaLoadBalancerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerIdentityByCRN unmarshals an instance of LoadBalancerIdentityByCRN from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentityByHref : LoadBalancerIdentityByHref struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByHref struct { + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerIdentityByHref : Instantiate LoadBalancerIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByHref(href string) (_model *LoadBalancerIdentityByHref, err error) { + _model = &LoadBalancerIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerIdentityByHref) isaLoadBalancerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerIdentityByHref unmarshals an instance of LoadBalancerIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentityByID : LoadBalancerIdentityByID struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByID struct { + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerIdentityByID : Instantiate LoadBalancerIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByID(id string) (_model *LoadBalancerIdentityByID, err error) { + _model = &LoadBalancerIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerIdentityByID) isaLoadBalancerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerIdentityByID unmarshals an instance of LoadBalancerIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerIdentityByHref : LoadBalancerListenerIdentityByHref struct +// This model "extends" LoadBalancerListenerIdentity +type LoadBalancerListenerIdentityByHref struct { + // The listener's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerIdentityByHref : Instantiate LoadBalancerListenerIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerIdentityByHref(href string) (_model *LoadBalancerListenerIdentityByHref, err error) { + _model = &LoadBalancerListenerIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerIdentityByHref) isaLoadBalancerListenerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerListenerIdentityByHref unmarshals an instance of LoadBalancerListenerIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerIdentityByID : LoadBalancerListenerIdentityByID struct +// This model "extends" LoadBalancerListenerIdentity +type LoadBalancerListenerIdentityByID struct { + // The unique identifier for this load balancer listener. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerIdentityByID : Instantiate LoadBalancerListenerIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerIdentityByID(id string) (_model *LoadBalancerListenerIdentityByID, err error) { + _model = &LoadBalancerListenerIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerIdentityByID) isaLoadBalancerListenerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerListenerIdentityByID unmarshals an instance of LoadBalancerListenerIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityIntf interface { + LoadBalancerListenerPolicyTargetPatchIntf + isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener" validate:"required"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype{ + HTTPStatusCode: core.Int64Ptr(httpStatusCode), + Listener: listener, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // The redirect target URL. + URL *string `json:"url" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(httpStatusCode int64, url string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype{ + HTTPStatusCode: core.Int64Ptr(httpStatusCode), + URL: core.StringPtr(url), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityIntf interface { + LoadBalancerListenerPolicyTargetPrototypeIntf + isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect : LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + Listener *LoadBalancerListenerReference `json:"listener" validate:"required"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL : LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // The redirect target URL. + URL *string `json:"url" validate:"required"` +} + +func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetLoadBalancerPoolReference : LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this load balancer pool. + Name *string `json:"name" validate:"required"` +} + +func (*LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerPoolReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerPoolIdentity +type LoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolIdentityByHref) isaLoadBalancerPoolIdentity() bool { + return true +} + +// UnmarshalLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentityByID : LoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerPoolIdentity +type LoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerPoolIdentityByID : Instantiate LoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolIdentityByID) isaLoadBalancerPoolIdentity() bool { + return true +} + +// UnmarshalLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeIP : LoadBalancerPoolMemberTargetPrototypeIP struct +// This model "extends" LoadBalancerPoolMemberTargetPrototype +type LoadBalancerPoolMemberTargetPrototypeIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeIP : Instantiate LoadBalancerPoolMemberTargetPrototypeIP (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeIP(address string) (_model *LoadBalancerPoolMemberTargetPrototypeIP, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeIP) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeIP unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeIP from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref +// This model "extends" LoadBalancerPoolMemberTargetPrototype +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentity struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityIntf interface { + LoadBalancerPoolMemberTargetPrototypeIntf + isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetIP : LoadBalancerPoolMemberTargetIP struct +// This model "extends" LoadBalancerPoolMemberTarget +type LoadBalancerPoolMemberTargetIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*LoadBalancerPoolMemberTargetIP) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetIP unmarshals an instance of LoadBalancerPoolMemberTargetIP from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetInstanceReference : LoadBalancerPoolMemberTargetInstanceReference struct +// This model "extends" LoadBalancerPoolMemberTarget +type LoadBalancerPoolMemberTargetInstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this virtual server instance (and default system hostname). + Name *string `json:"name" validate:"required"` +} + +func (*LoadBalancerPoolMemberTargetInstanceReference) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetInstanceReference unmarshals an instance of LoadBalancerPoolMemberTargetInstanceReference from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileIdentityByHref : LoadBalancerProfileIdentityByHref struct +// This model "extends" LoadBalancerProfileIdentity +type LoadBalancerProfileIdentityByHref struct { + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerProfileIdentityByHref : Instantiate LoadBalancerProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerProfileIdentityByHref(href string) (_model *LoadBalancerProfileIdentityByHref, err error) { + _model = &LoadBalancerProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerProfileIdentityByHref) isaLoadBalancerProfileIdentity() bool { + return true +} + +// UnmarshalLoadBalancerProfileIdentityByHref unmarshals an instance of LoadBalancerProfileIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileIdentityByName : LoadBalancerProfileIdentityByName struct +// This model "extends" LoadBalancerProfileIdentity +type LoadBalancerProfileIdentityByName struct { + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` +} + +// NewLoadBalancerProfileIdentityByName : Instantiate LoadBalancerProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerProfileIdentityByName(name string) (_model *LoadBalancerProfileIdentityByName, err error) { + _model = &LoadBalancerProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerProfileIdentityByName) isaLoadBalancerProfileIdentity() bool { + return true +} + +// UnmarshalLoadBalancerProfileIdentityByName unmarshals an instance of LoadBalancerProfileIdentityByName from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileRouteModeSupportedDependent : The route mode support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileRouteModeSupported +type LoadBalancerProfileRouteModeSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileRouteModeSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileRouteModeSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileRouteModeSupportedDependent) isaLoadBalancerProfileRouteModeSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileRouteModeSupportedDependent unmarshals an instance of LoadBalancerProfileRouteModeSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileRouteModeSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileRouteModeSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileRouteModeSupportedFixed : The route mode support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileRouteModeSupported +type LoadBalancerProfileRouteModeSupportedFixed 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 LoadBalancerProfileRouteModeSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileRouteModeSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileRouteModeSupportedFixed) isaLoadBalancerProfileRouteModeSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileRouteModeSupportedFixed unmarshals an instance of LoadBalancerProfileRouteModeSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileRouteModeSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileRouteModeSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileSecurityGroupsSupportedDependent : The security group support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileSecurityGroupsSupported +type LoadBalancerProfileSecurityGroupsSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileSecurityGroupsSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileSecurityGroupsSupportedDependent) isaLoadBalancerProfileSecurityGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileSecurityGroupsSupportedFixed : The security group support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileSecurityGroupsSupported +type LoadBalancerProfileSecurityGroupsSupportedFixed 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 LoadBalancerProfileSecurityGroupsSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileSecurityGroupsSupportedFixed) isaLoadBalancerProfileSecurityGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileUDPSupportedDependent : The UDP support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileUDPSupported +type LoadBalancerProfileUDPSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileUDPSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileUDPSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileUDPSupportedDependent) isaLoadBalancerProfileUDPSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileUDPSupportedDependent unmarshals an instance of LoadBalancerProfileUDPSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileUDPSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileUDPSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileUDPSupportedFixed : The UDP support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileUDPSupported +type LoadBalancerProfileUDPSupportedFixed 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 LoadBalancerProfileUDPSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileUDPSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileUDPSupportedFixed) isaLoadBalancerProfileUDPSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileUDPSupportedFixed unmarshals an instance of LoadBalancerProfileUDPSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileUDPSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileUDPSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLIdentityByCRN : NetworkACLIdentityByCRN struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByCRN struct { + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` +} + +// NewNetworkACLIdentityByCRN : Instantiate NetworkACLIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByCRN(crn string) (_model *NetworkACLIdentityByCRN, err error) { + _model = &NetworkACLIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLIdentityByCRN) isaNetworkACLIdentity() bool { + return true +} + +// UnmarshalNetworkACLIdentityByCRN unmarshals an instance of NetworkACLIdentityByCRN from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLIdentityByHref : NetworkACLIdentityByHref struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByHref struct { + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkACLIdentityByHref : Instantiate NetworkACLIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByHref(href string) (_model *NetworkACLIdentityByHref, err error) { + _model = &NetworkACLIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLIdentityByHref) isaNetworkACLIdentity() bool { + return true +} + +// UnmarshalNetworkACLIdentityByHref unmarshals an instance of NetworkACLIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLIdentityByID : NetworkACLIdentityByID struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByID struct { + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkACLIdentityByID : Instantiate NetworkACLIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByID(id string) (_model *NetworkACLIdentityByID, err error) { + _model = &NetworkACLIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLIdentityByID) isaNetworkACLIdentity() bool { + return true +} + +// UnmarshalNetworkACLIdentityByID unmarshals an instance of NetworkACLIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLPrototypeNetworkACLByRules : NetworkACLPrototypeNetworkACLByRules struct +// This model "extends" NetworkACLPrototype +type NetworkACLPrototypeNetworkACLByRules struct { + // The user-defined name for this network ACL. Names must be unique within the VPC the network ACL resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The VPC this network ACL is to be a part of. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, + // resulting in all traffic being denied. + Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` +} + +// NewNetworkACLPrototypeNetworkACLByRules : Instantiate NetworkACLPrototypeNetworkACLByRules (Generic Model Constructor) +func (*VpcV1) NewNetworkACLPrototypeNetworkACLByRules(vpc VPCIdentityIntf) (_model *NetworkACLPrototypeNetworkACLByRules, err error) { + _model = &NetworkACLPrototypeNetworkACLByRules{ + VPC: vpc, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLPrototypeNetworkACLByRules) isaNetworkACLPrototype() bool { + return true +} + +// UnmarshalNetworkACLPrototypeNetworkACLByRules unmarshals an instance of NetworkACLPrototypeNetworkACLByRules from the specified map of raw messages. +func UnmarshalNetworkACLPrototypeNetworkACLByRules(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototypeNetworkACLByRules) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLPrototypeNetworkACLBySourceNetworkACL : NetworkACLPrototypeNetworkACLBySourceNetworkACL struct +// This model "extends" NetworkACLPrototype +type NetworkACLPrototypeNetworkACLBySourceNetworkACL struct { + // The user-defined name for this network ACL. Names must be unique within the VPC the network ACL resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The VPC this network ACL is to be a part of. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // Network ACL to copy rules from. + SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl" validate:"required"` +} + +// NewNetworkACLPrototypeNetworkACLBySourceNetworkACL : Instantiate NetworkACLPrototypeNetworkACLBySourceNetworkACL (Generic Model Constructor) +func (*VpcV1) NewNetworkACLPrototypeNetworkACLBySourceNetworkACL(vpc VPCIdentityIntf, sourceNetworkACL NetworkACLIdentityIntf) (_model *NetworkACLPrototypeNetworkACLBySourceNetworkACL, err error) { + _model = &NetworkACLPrototypeNetworkACLBySourceNetworkACL{ + VPC: vpc, + SourceNetworkACL: sourceNetworkACL, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLPrototypeNetworkACLBySourceNetworkACL) isaNetworkACLPrototype() bool { + return true +} + +// UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL unmarshals an instance of NetworkACLPrototypeNetworkACLBySourceNetworkACL from the specified map of raw messages. +func UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototypeNetworkACLBySourceNetworkACL) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct +// This model "extends" NetworkACLRuleBeforePatch +type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct { + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(href string) (_model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref, err error) { + _model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePatch() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct +// This model "extends" NetworkACLRuleBeforePatch +type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(id string) (_model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID, err error) { + _model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePatch() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct +// This model "extends" NetworkACLRuleBeforePrototype +type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct { + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(href string) (_model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref, err error) { + _model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePrototype() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct +// This model "extends" NetworkACLRuleBeforePrototype +type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(id string) (_model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID, err error) { + _model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePrototype() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItemNetworkACLRuleProtocolAll : NetworkACLRuleItemNetworkACLRuleProtocolAll struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolAll struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this network ACL rule. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolAllActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllProtocolAllConst = "all" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolAll) isaNetworkACLRuleItem() bool { + return true +} + +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolAll from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItemNetworkACLRuleProtocolIcmp : NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this network ACL rule. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolIcmp) isaNetworkACLRuleItem() bool { + return true +} + +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItemNetworkACLRuleProtocolTcpudp : NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this network ACL rule. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max" validate:"required"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min" validate:"required"` +} + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) isaNetworkACLRuleItem() bool { + return true +} + +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" +) + +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" +) + +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" +) + +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) isaNetworkACLRulePrototype() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) isaNetworkACLRulePrototype() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) isaNetworkACLRulePrototype() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleNetworkACLRuleProtocolAll : NetworkACLRuleNetworkACLRuleProtocolAll struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolAll struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this network ACL rule. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolAllActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllProtocolAllConst = "all" +) + +func (*NetworkACLRuleNetworkACLRuleProtocolAll) isaNetworkACLRule() bool { + return true +} + +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolAll from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleNetworkACLRuleProtocolIcmp : NetworkACLRuleNetworkACLRuleProtocolIcmp struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolIcmp struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this network ACL rule. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolIcmpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +func (*NetworkACLRuleNetworkACLRuleProtocolIcmp) isaNetworkACLRule() bool { + return true +} + +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleNetworkACLRuleProtocolTcpudp : NetworkACLRuleNetworkACLRuleProtocolTcpudp struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolTcpudp struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this network ACL rule. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max" validate:"required"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min" validate:"required"` +} + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" + NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +func (*NetworkACLRuleNetworkACLRuleProtocolTcpudp) isaNetworkACLRule() bool { + return true +} + +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototypeReservedIPIdentity : Identifies a reserved IP by a unique property. +// Models which "extend" this model: +// - NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID +// - NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref +// This model "extends" NetworkInterfaceIPPrototype +type NetworkInterfaceIPPrototypeReservedIPIdentity struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentity) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { + return true +} + +type NetworkInterfaceIPPrototypeReservedIPIdentityIntf interface { + NetworkInterfaceIPPrototypeIntf + isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentity) isaNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentity from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext : NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext struct +// This model "extends" NetworkInterfaceIPPrototype +type NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The user-defined name for this reserved IP. If unspecified, the name will be a hyphenated list of randomly-selected + // words. Names must be unique within the subnet the reserved IP resides in. Names beginning with `ibm-` are reserved + // for provider-owned resources. + Name *string `json:"name,omitempty"` +} + +func (*NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) isaNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemIdentityByHref : OperatingSystemIdentityByHref struct +// This model "extends" OperatingSystemIdentity +type OperatingSystemIdentityByHref struct { + // The URL for this operating system. + Href *string `json:"href" validate:"required"` +} + +// NewOperatingSystemIdentityByHref : Instantiate OperatingSystemIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewOperatingSystemIdentityByHref(href string) (_model *OperatingSystemIdentityByHref, err error) { + _model = &OperatingSystemIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*OperatingSystemIdentityByHref) isaOperatingSystemIdentity() bool { + return true +} + +// UnmarshalOperatingSystemIdentityByHref unmarshals an instance of OperatingSystemIdentityByHref from the specified map of raw messages. +func UnmarshalOperatingSystemIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemIdentityByName : OperatingSystemIdentityByName struct +// This model "extends" OperatingSystemIdentity +type OperatingSystemIdentityByName struct { + // The globally unique name for this operating system. + Name *string `json:"name" validate:"required"` +} + +// NewOperatingSystemIdentityByName : Instantiate OperatingSystemIdentityByName (Generic Model Constructor) +func (*VpcV1) NewOperatingSystemIdentityByName(name string) (_model *OperatingSystemIdentityByName, err error) { + _model = &OperatingSystemIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*OperatingSystemIdentityByName) isaOperatingSystemIdentity() bool { + return true +} + +// UnmarshalOperatingSystemIdentityByName unmarshals an instance of OperatingSystemIdentityByName from the specified map of raw messages. +func UnmarshalOperatingSystemIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentity : Identifies a floating IP by a unique property. +// Models which "extend" this model: +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress +// This model "extends" PublicGatewayFloatingIPPrototype +type PublicGatewayFloatingIPPrototypeFloatingIPIdentity struct { + // The unique identifier for this floating IP. + ID *string `json:"id,omitempty"` + + // The CRN for this floating IP. + CRN *string `json:"crn,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href,omitempty"` + + // The globally unique IP address. + Address *string `json:"address,omitempty"` +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityIntf interface { + PublicGatewayFloatingIPPrototypeIntf + isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentity from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext : PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct +// This model "extends" PublicGatewayFloatingIPPrototype +type PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct { + // The unique user-defined name for this floating IP. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentityPublicGatewayIdentityByCRN : PublicGatewayIdentityPublicGatewayIdentityByCRN struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityPublicGatewayIdentityByCRN struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` +} + +// NewPublicGatewayIdentityPublicGatewayIdentityByCRN : Instantiate PublicGatewayIdentityPublicGatewayIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByCRN(crn string) (_model *PublicGatewayIdentityPublicGatewayIdentityByCRN, err error) { + _model = &PublicGatewayIdentityPublicGatewayIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayIdentityPublicGatewayIdentityByCRN) isaPublicGatewayIdentity() bool { + return true +} + +// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByCRN from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityPublicGatewayIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentityPublicGatewayIdentityByHref : PublicGatewayIdentityPublicGatewayIdentityByHref struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityPublicGatewayIdentityByHref struct { + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` +} + +// NewPublicGatewayIdentityPublicGatewayIdentityByHref : Instantiate PublicGatewayIdentityPublicGatewayIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByHref(href string) (_model *PublicGatewayIdentityPublicGatewayIdentityByHref, err error) { + _model = &PublicGatewayIdentityPublicGatewayIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayIdentityPublicGatewayIdentityByHref) isaPublicGatewayIdentity() bool { + return true +} + +// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByHref from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityPublicGatewayIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentityPublicGatewayIdentityByID : PublicGatewayIdentityPublicGatewayIdentityByID struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityPublicGatewayIdentityByID struct { + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` +} + +// NewPublicGatewayIdentityPublicGatewayIdentityByID : Instantiate PublicGatewayIdentityPublicGatewayIdentityByID (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByID(id string) (_model *PublicGatewayIdentityPublicGatewayIdentityByID, err error) { + _model = &PublicGatewayIdentityPublicGatewayIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayIdentityPublicGatewayIdentityByID) isaPublicGatewayIdentity() bool { + return true +} + +// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByID from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityPublicGatewayIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentity : ReservedIPTargetPrototypeEndpointGatewayIdentity struct +// Models which "extend" this model: +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref +// This model "extends" ReservedIPTargetPrototype +type ReservedIPTargetPrototypeEndpointGatewayIdentity struct { + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +type ReservedIPTargetPrototypeEndpointGatewayIdentityIntf interface { + ReservedIPTargetPrototypeIntf + isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentity from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetEndpointGatewayReference : ReservedIPTargetEndpointGatewayReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetEndpointGatewayReference struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this endpoint gateway. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetEndpointGatewayReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +func (*ReservedIPTargetEndpointGatewayReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetEndpointGatewayReference unmarshals an instance of ReservedIPTargetEndpointGatewayReference from the specified map of raw messages. +func UnmarshalReservedIPTargetEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetEndpointGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetGenericResourceReference : Identifying information for a resource that is not native to the VPC API. +// This model "extends" ReservedIPTarget +type ReservedIPTargetGenericResourceReference struct { + // The CRN for the resource. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *GenericResourceReferenceDeleted `json:"deleted,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetGenericResourceReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetGenericResourceReferenceResourceTypeCloudResourceConst = "cloud_resource" +) + +func (*ReservedIPTargetGenericResourceReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetGenericResourceReference unmarshals an instance of ReservedIPTargetGenericResourceReference from the specified map of raw messages. +func UnmarshalReservedIPTargetGenericResourceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetGenericResourceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalGenericResourceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetLoadBalancerReference : ReservedIPTargetLoadBalancerReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetLoadBalancerReference struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` + + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this load balancer. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetLoadBalancerReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" +) + +func (*ReservedIPTargetLoadBalancerReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetLoadBalancerReference unmarshals an instance of ReservedIPTargetLoadBalancerReference from the specified map of raw messages. +func UnmarshalReservedIPTargetLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetLoadBalancerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetNetworkInterfaceReferenceTargetContext : ReservedIPTargetNetworkInterfaceReferenceTargetContext struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + ReservedIPTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*ReservedIPTargetNetworkInterfaceReferenceTargetContext) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetVPNGatewayReference : ReservedIPTargetVPNGatewayReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetVPNGatewayReference struct { + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetVPNGatewayReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" +) + +func (*ReservedIPTargetVPNGatewayReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetVPNGatewayReference unmarshals an instance of ReservedIPTargetVPNGatewayReference from the specified map of raw messages. +func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetVPNGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetVPNServerReference : ReservedIPTargetVPNServerReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this VPN server. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetVPNServerReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" +) + +func (*ReservedIPTargetVPNServerReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetVPNServerReference unmarshals an instance of ReservedIPTargetVPNServerReference from the specified map of raw messages. +func UnmarshalReservedIPTargetVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceGroupIdentityByID : ResourceGroupIdentityByID struct +// This model "extends" ResourceGroupIdentity +type ResourceGroupIdentityByID struct { + // The unique identifier for this resource group. + ID *string `json:"id" validate:"required"` +} + +// NewResourceGroupIdentityByID : Instantiate ResourceGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewResourceGroupIdentityByID(id string) (_model *ResourceGroupIdentityByID, err error) { + _model = &ResourceGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ResourceGroupIdentityByID) isaResourceGroupIdentity() bool { + return true +} + +// UnmarshalResourceGroupIdentityByID unmarshals an instance of ResourceGroupIdentityByID from the specified map of raw messages. +func UnmarshalResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCreatorVPNGatewayReference : RouteCreatorVPNGatewayReference struct +// This model "extends" RouteCreator +type RouteCreatorVPNGatewayReference struct { + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RouteCreatorVPNGatewayReference.ResourceType property. +// The resource type. +const ( + RouteCreatorVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" +) + +func (*RouteCreatorVPNGatewayReference) isaRouteCreator() bool { + return true +} + +// UnmarshalRouteCreatorVPNGatewayReference unmarshals an instance of RouteCreatorVPNGatewayReference from the specified map of raw messages. +func UnmarshalRouteCreatorVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreatorVPNGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCreatorVPNServerReference : RouteCreatorVPNServerReference struct +// This model "extends" RouteCreator +type RouteCreatorVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this VPN server. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RouteCreatorVPNServerReference.ResourceType property. +// The resource type. +const ( + RouteCreatorVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" +) + +func (*RouteCreatorVPNServerReference) isaRouteCreator() bool { + return true +} + +// UnmarshalRouteCreatorVPNServerReference unmarshals an instance of RouteCreatorVPNServerReference from the specified map of raw messages. +func UnmarshalRouteCreatorVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreatorVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopIP : RouteNextHopIP struct +// This model "extends" RouteNextHop +type RouteNextHopIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*RouteNextHopIP) isaRouteNextHop() bool { + return true +} + +// UnmarshalRouteNextHopIP unmarshals an instance of RouteNextHopIP from the specified map of raw messages. +func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopVPNGatewayConnectionReference : RouteNextHopVPNGatewayConnectionReference struct +// This model "extends" RouteNextHop +type RouteNextHopVPNGatewayConnectionReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this VPN connection. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RouteNextHopVPNGatewayConnectionReference.ResourceType property. +// The resource type. +const ( + RouteNextHopVPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +func (*RouteNextHopVPNGatewayConnectionReference) isaRouteNextHop() bool { + return true +} + +// UnmarshalRouteNextHopVPNGatewayConnectionReference unmarshals an instance of RouteNextHopVPNGatewayConnectionReference from the specified map of raw messages. +func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopVPNGatewayConnectionReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP : The IP address of the next hop to which to route packets. +// This model "extends" RoutePrototypeNextHop +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. +// Models which "extend" this model: +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref +// This model "extends" RoutePrototypeNextHop +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityIntf interface { + RoutePrototypeNextHopIntf + isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableIdentityByHref : RoutingTableIdentityByHref struct +// This model "extends" RoutingTableIdentity +type RoutingTableIdentityByHref struct { + // The URL for this routing table. + Href *string `json:"href" validate:"required"` +} + +// NewRoutingTableIdentityByHref : Instantiate RoutingTableIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRoutingTableIdentityByHref(href string) (_model *RoutingTableIdentityByHref, err error) { + _model = &RoutingTableIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutingTableIdentityByHref) isaRoutingTableIdentity() bool { + return true +} + +// UnmarshalRoutingTableIdentityByHref unmarshals an instance of RoutingTableIdentityByHref from the specified map of raw messages. +func UnmarshalRoutingTableIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableIdentityByID : RoutingTableIdentityByID struct +// This model "extends" RoutingTableIdentity +type RoutingTableIdentityByID struct { + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` +} + +// NewRoutingTableIdentityByID : Instantiate RoutingTableIdentityByID (Generic Model Constructor) +func (*VpcV1) NewRoutingTableIdentityByID(id string) (_model *RoutingTableIdentityByID, err error) { + _model = &RoutingTableIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutingTableIdentityByID) isaRoutingTableIdentity() bool { + return true +} + +// UnmarshalRoutingTableIdentityByID unmarshals an instance of RoutingTableIdentityByID from the specified map of raw messages. +func UnmarshalRoutingTableIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupIdentityByCRN : SecurityGroupIdentityByCRN struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByCRN struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewSecurityGroupIdentityByCRN : Instantiate SecurityGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupIdentityByCRN, err error) { + _model = &SecurityGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupIdentityByCRN) isaSecurityGroupIdentity() bool { + return true +} + +// UnmarshalSecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupIdentityByHref : SecurityGroupIdentityByHref struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByHref struct { + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewSecurityGroupIdentityByHref : Instantiate SecurityGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByHref(href string) (_model *SecurityGroupIdentityByHref, err error) { + _model = &SecurityGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupIdentityByHref) isaSecurityGroupIdentity() bool { + return true +} + +// UnmarshalSecurityGroupIdentityByHref unmarshals an instance of SecurityGroupIdentityByHref from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupIdentityByID : SecurityGroupIdentityByID struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByID struct { + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` +} + +// NewSecurityGroupIdentityByID : Instantiate SecurityGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByID(id string) (_model *SecurityGroupIdentityByID, err error) { + _model = &SecurityGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupIdentityByID) isaSecurityGroupIdentity() bool { + return true +} + +// UnmarshalSecurityGroupIdentityByID unmarshals an instance of SecurityGroupIdentityByID from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllProtocolAllConst = "all" +) + +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll, err error) { + _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) isaSecurityGroupRulePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The ICMP traffic code to allow. + // + // If specified, `type` must also be specified. If unspecified, all codes are allowed. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to allow. + // + // If unspecified, all types are allowed. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp, err error) { + _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) isaSecurityGroupRulePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. +// +// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all ports are allowed for +// the protocol. When both have the same value, that single port is allowed. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The inclusive upper bound of TCP/UDP port range. + // + // If specified, `port_min` must also be specified, and must not be larger. If unspecified, `port_min` must also be + // unspecified, allowing traffic on all ports. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP port range + // + // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be + // unspecified, allowing traffic on all ports. + PortMin *int64 `json:"port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp, err error) { + _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRulePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchCIDR : SecurityGroupRuleRemotePatchCIDR struct +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchCIDR : Instantiate SecurityGroupRuleRemotePatchCIDR (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchCIDR(cidrBlock string) (_model *SecurityGroupRuleRemotePatchCIDR, err error) { + _model = &SecurityGroupRuleRemotePatchCIDR{ + CIDRBlock: core.StringPtr(cidrBlock), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchCIDR) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchCIDR unmarshals an instance of SecurityGroupRuleRemotePatchCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchIP : SecurityGroupRuleRemotePatchIP struct +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchIP : Instantiate SecurityGroupRuleRemotePatchIP (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchIP(address string) (_model *SecurityGroupRuleRemotePatchIP, err error) { + _model = &SecurityGroupRuleRemotePatchIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchIP) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchIP unmarshals an instance of SecurityGroupRuleRemotePatchIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentity : Identifies a security group by a unique property. +// Models which "extend" this model: +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchSecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +type SecurityGroupRuleRemotePatchSecurityGroupIdentityIntf interface { + SecurityGroupRuleRemotePatchIntf + isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeCIDR : SecurityGroupRuleRemotePrototypeCIDR struct +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeCIDR : Instantiate SecurityGroupRuleRemotePrototypeCIDR (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeCIDR(cidrBlock string) (_model *SecurityGroupRuleRemotePrototypeCIDR, err error) { + _model = &SecurityGroupRuleRemotePrototypeCIDR{ + CIDRBlock: core.StringPtr(cidrBlock), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeCIDR) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeCIDR unmarshals an instance of SecurityGroupRuleRemotePrototypeCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeIP : SecurityGroupRuleRemotePrototypeIP struct +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeIP : Instantiate SecurityGroupRuleRemotePrototypeIP (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeIP(address string) (_model *SecurityGroupRuleRemotePrototypeIP, err error) { + _model = &SecurityGroupRuleRemotePrototypeIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeIP) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeIP unmarshals an instance of SecurityGroupRuleRemotePrototypeIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentity : Identifies a security group by a unique property. +// Models which "extend" this model: +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentityIntf interface { + SecurityGroupRuleRemotePrototypeIntf + isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemoteCIDR : SecurityGroupRuleRemoteCIDR struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +func (*SecurityGroupRuleRemoteCIDR) isaSecurityGroupRuleRemote() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemoteCIDR unmarshals an instance of SecurityGroupRuleRemoteCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemoteIP : SecurityGroupRuleRemoteIP struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*SecurityGroupRuleRemoteIP) isaSecurityGroupRuleRemote() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemoteIP unmarshals an instance of SecurityGroupRuleRemoteIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemoteSecurityGroupReference : SecurityGroupRuleRemoteSecurityGroupReference struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteSecurityGroupReference struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + Name *string `json:"name" validate:"required"` +} + +func (*SecurityGroupRuleRemoteSecurityGroupReference) isaSecurityGroupRuleRemote() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemoteSecurityGroupReference unmarshals an instance of SecurityGroupRuleRemoteSecurityGroupReference from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteSecurityGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` + + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllProtocolAllConst = "all" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolAll) isaSecurityGroupRule() bool { + return true +} + +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolAll from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` + + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The ICMP traffic code to allow. If absent, all codes are allowed. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to allow. If absent, all types are allowed. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolIcmp) isaSecurityGroupRule() bool { + return true +} + +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. +// +// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all ports are allowed for +// the protocol. When both have the same value, that single port is allowed. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` + + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The inclusive upper bound of TCP/UDP port range. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP port range. + PortMin *int64 `json:"port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRule() bool { + return true +} + +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceEndpointGatewayReference : SecurityGroupTargetReferenceEndpointGatewayReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceEndpointGatewayReference struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this endpoint gateway. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceEndpointGatewayReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +func (*SecurityGroupTargetReferenceEndpointGatewayReference) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference unmarshals an instance of SecurityGroupTargetReferenceEndpointGatewayReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceEndpointGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceLoadBalancerReference : SecurityGroupTargetReferenceLoadBalancerReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceLoadBalancerReference struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` + + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this load balancer. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceLoadBalancerReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" +) + +func (*SecurityGroupTargetReferenceLoadBalancerReference) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceLoadBalancerReference unmarshals an instance of SecurityGroupTargetReferenceLoadBalancerReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceLoadBalancerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceVPNServerReference : SecurityGroupTargetReferenceVPNServerReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this VPN server. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceVPNServerReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" +) + +func (*SecurityGroupTargetReferenceVPNServerReference) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceVPNServerReference unmarshals an instance of SecurityGroupTargetReferenceVPNServerReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotIdentityByCRN : SnapshotIdentityByCRN struct +// This model "extends" SnapshotIdentity +type SnapshotIdentityByCRN struct { + // The CRN of this snapshot. + CRN *string `json:"crn" validate:"required"` +} + +// NewSnapshotIdentityByCRN : Instantiate SnapshotIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSnapshotIdentityByCRN(crn string) (_model *SnapshotIdentityByCRN, err error) { + _model = &SnapshotIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotIdentityByCRN) isaSnapshotIdentity() bool { + return true +} + +// UnmarshalSnapshotIdentityByCRN unmarshals an instance of SnapshotIdentityByCRN from the specified map of raw messages. +func UnmarshalSnapshotIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotIdentityByHref : SnapshotIdentityByHref struct +// This model "extends" SnapshotIdentity +type SnapshotIdentityByHref struct { + // The URL for this snapshot. + Href *string `json:"href" validate:"required"` +} + +// NewSnapshotIdentityByHref : Instantiate SnapshotIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSnapshotIdentityByHref(href string) (_model *SnapshotIdentityByHref, err error) { + _model = &SnapshotIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotIdentityByHref) isaSnapshotIdentity() bool { + return true +} + +// UnmarshalSnapshotIdentityByHref unmarshals an instance of SnapshotIdentityByHref from the specified map of raw messages. +func UnmarshalSnapshotIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotIdentityByID : SnapshotIdentityByID struct +// This model "extends" SnapshotIdentity +type SnapshotIdentityByID struct { + // The unique identifier for this snapshot. + ID *string `json:"id" validate:"required"` +} + +// NewSnapshotIdentityByID : Instantiate SnapshotIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSnapshotIdentityByID(id string) (_model *SnapshotIdentityByID, err error) { + _model = &SnapshotIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotIdentityByID) isaSnapshotIdentity() bool { + return true +} + +// UnmarshalSnapshotIdentityByID unmarshals an instance of SnapshotIdentityByID from the specified map of raw messages. +func UnmarshalSnapshotIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotPrototypeSnapshotBySourceVolume : SnapshotPrototypeSnapshotBySourceVolume struct +// This model "extends" SnapshotPrototype +type SnapshotPrototypeSnapshotBySourceVolume struct { + // The unique user-defined name for this snapshot. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` + + // The volume to create this snapshot from. + SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` +} + +// NewSnapshotPrototypeSnapshotBySourceVolume : Instantiate SnapshotPrototypeSnapshotBySourceVolume (Generic Model Constructor) +func (*VpcV1) NewSnapshotPrototypeSnapshotBySourceVolume(sourceVolume VolumeIdentityIntf) (_model *SnapshotPrototypeSnapshotBySourceVolume, err error) { + _model = &SnapshotPrototypeSnapshotBySourceVolume{ + SourceVolume: sourceVolume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotPrototypeSnapshotBySourceVolume) isaSnapshotPrototype() bool { + return true +} + +// UnmarshalSnapshotPrototypeSnapshotBySourceVolume unmarshals an instance of SnapshotPrototypeSnapshotBySourceVolume from the specified map of raw messages. +func UnmarshalSnapshotPrototypeSnapshotBySourceVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPrototypeSnapshotBySourceVolume) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentityByCRN : SubnetIdentityByCRN struct +// This model "extends" SubnetIdentity +type SubnetIdentityByCRN struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` +} + +// NewSubnetIdentityByCRN : Instantiate SubnetIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSubnetIdentityByCRN(crn string) (_model *SubnetIdentityByCRN, err error) { + _model = &SubnetIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetIdentityByCRN) isaSubnetIdentity() bool { + return true +} + +// UnmarshalSubnetIdentityByCRN unmarshals an instance of SubnetIdentityByCRN from the specified map of raw messages. +func UnmarshalSubnetIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentityByHref : SubnetIdentityByHref struct +// This model "extends" SubnetIdentity +type SubnetIdentityByHref struct { + // The URL for this subnet. + Href *string `json:"href" validate:"required"` +} + +// NewSubnetIdentityByHref : Instantiate SubnetIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSubnetIdentityByHref(href string) (_model *SubnetIdentityByHref, err error) { + _model = &SubnetIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetIdentityByHref) isaSubnetIdentity() bool { + return true +} + +// UnmarshalSubnetIdentityByHref unmarshals an instance of SubnetIdentityByHref from the specified map of raw messages. +func UnmarshalSubnetIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentityByID : SubnetIdentityByID struct +// This model "extends" SubnetIdentity +type SubnetIdentityByID struct { + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` +} + +// NewSubnetIdentityByID : Instantiate SubnetIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSubnetIdentityByID(id string) (_model *SubnetIdentityByID, err error) { + _model = &SubnetIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetIdentityByID) isaSubnetIdentity() bool { + return true +} + +// UnmarshalSubnetIdentityByID unmarshals an instance of SubnetIdentityByID from the specified map of raw messages. +func UnmarshalSubnetIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPrototypeSubnetByCIDR : SubnetPrototypeSubnetByCIDR struct +// This model "extends" SubnetPrototype +type SubnetPrototypeSubnetByCIDR struct { + // The IP version(s) to support for this subnet. + IPVersion *string `json:"ip_version,omitempty"` + + // The user-defined name for this subnet. Names must be unique within the VPC the subnet resides in. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. If unspecified, the default network ACL for the VPC is used. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to use for internet-bound traffic for this subnet. If unspecified, the subnet will not be + // attached to a public gateway. + PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The routing table to use for this subnet. If unspecified, the default routing table for the VPC is used. The routing + // table properties `route_direct_link_ingress`, + // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` + + // The VPC the subnet is to be a part of. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The IPv4 range of the subnet, expressed in CIDR format. The prefix length of the subnet's CIDR must be between `/9` + // (8,388,608 addresses) and `/29` (8 addresses). The IPv4 range of the subnet's CIDR must fall within an existing + // address prefix in the VPC and must not overlap with any existing subnet. The subnet will be created in the zone of + // the address prefix that contains the IPv4 CIDR. If zone is specified, it must match the zone of the address prefix + // that contains the subnet's IPv4 CIDR. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` + + // The zone this subnet will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// Constants associated with the SubnetPrototypeSubnetByCIDR.IPVersion property. +// The IP version(s) to support for this subnet. +const ( + SubnetPrototypeSubnetByCIDRIPVersionIpv4Const = "ipv4" +) + +// NewSubnetPrototypeSubnetByCIDR : Instantiate SubnetPrototypeSubnetByCIDR (Generic Model Constructor) +func (*VpcV1) NewSubnetPrototypeSubnetByCIDR(vpc VPCIdentityIntf, ipv4CIDRBlock string) (_model *SubnetPrototypeSubnetByCIDR, err error) { + _model = &SubnetPrototypeSubnetByCIDR{ + VPC: vpc, + Ipv4CIDRBlock: core.StringPtr(ipv4CIDRBlock), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPrototypeSubnetByCIDR) isaSubnetPrototype() bool { + return true +} + +// UnmarshalSubnetPrototypeSubnetByCIDR unmarshals an instance of SubnetPrototypeSubnetByCIDR from the specified map of raw messages. +func UnmarshalSubnetPrototypeSubnetByCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPrototypeSubnetByCIDR) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPrototypeSubnetByTotalCount : SubnetPrototypeSubnetByTotalCount struct +// This model "extends" SubnetPrototype +type SubnetPrototypeSubnetByTotalCount struct { + // The IP version(s) to support for this subnet. + IPVersion *string `json:"ip_version,omitempty"` + + // The user-defined name for this subnet. Names must be unique within the VPC the subnet resides in. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. If unspecified, the default network ACL for the VPC is used. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to use for internet-bound traffic for this subnet. If unspecified, the subnet will not be + // attached to a public gateway. + PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The routing table to use for this subnet. If unspecified, the default routing table for the VPC is used. The routing + // table properties `route_direct_link_ingress`, + // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` + + // The VPC the subnet is to be a part of. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The total number of IPv4 addresses required. Must be a power of 2. The VPC must have a default address prefix in the + // specified zone, and that prefix must have a free CIDR range with at least this number of addresses. + TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count" validate:"required"` + + // The zone this subnet will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// Constants associated with the SubnetPrototypeSubnetByTotalCount.IPVersion property. +// The IP version(s) to support for this subnet. +const ( + SubnetPrototypeSubnetByTotalCountIPVersionIpv4Const = "ipv4" +) + +// NewSubnetPrototypeSubnetByTotalCount : Instantiate SubnetPrototypeSubnetByTotalCount (Generic Model Constructor) +func (*VpcV1) NewSubnetPrototypeSubnetByTotalCount(vpc VPCIdentityIntf, totalIpv4AddressCount int64, zone ZoneIdentityIntf) (_model *SubnetPrototypeSubnetByTotalCount, err error) { + _model = &SubnetPrototypeSubnetByTotalCount{ + VPC: vpc, + TotalIpv4AddressCount: core.Int64Ptr(totalIpv4AddressCount), + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPrototypeSubnetByTotalCount) isaSubnetPrototype() bool { + return true +} + +// UnmarshalSubnetPrototypeSubnetByTotalCount unmarshals an instance of SubnetPrototypeSubnetByTotalCount from the specified map of raw messages. +func UnmarshalSubnetPrototypeSubnetByTotalCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPrototypeSubnetByTotalCount) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPublicGatewayPatchPublicGatewayIdentityByCRN : SubnetPublicGatewayPatchPublicGatewayIdentityByCRN struct +// This model "extends" SubnetPublicGatewayPatch +type SubnetPublicGatewayPatchPublicGatewayIdentityByCRN struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` +} + +// NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(crn string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByCRN, err error) { + _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPublicGatewayPatchPublicGatewayIdentityByCRN) isaSubnetPublicGatewayPatch() bool { + return true +} + +// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByCRN unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByCRN from the specified map of raw messages. +func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPublicGatewayPatchPublicGatewayIdentityByHref : SubnetPublicGatewayPatchPublicGatewayIdentityByHref struct +// This model "extends" SubnetPublicGatewayPatch +type SubnetPublicGatewayPatchPublicGatewayIdentityByHref struct { + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` +} + +// NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref(href string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByHref, err error) { + _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPublicGatewayPatchPublicGatewayIdentityByHref) isaSubnetPublicGatewayPatch() bool { + return true +} + +// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByHref unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByHref from the specified map of raw messages. +func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPublicGatewayPatchPublicGatewayIdentityByID : SubnetPublicGatewayPatchPublicGatewayIdentityByID struct +// This model "extends" SubnetPublicGatewayPatch +type SubnetPublicGatewayPatchPublicGatewayIdentityByID struct { + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` +} + +// NewSubnetPublicGatewayPatchPublicGatewayIdentityByID : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByID(id string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByID, err error) { + _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPublicGatewayPatchPublicGatewayIdentityByID) isaSubnetPublicGatewayPatch() bool { + return true +} + +// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByID unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByID from the specified map of raw messages. +func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfileIdentityTrustedProfileByCRN : TrustedProfileIdentityTrustedProfileByCRN struct +// This model "extends" TrustedProfileIdentity +type TrustedProfileIdentityTrustedProfileByCRN 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{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*TrustedProfileIdentityTrustedProfileByCRN) 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) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfileIdentityTrustedProfileByID : TrustedProfileIdentityTrustedProfileByID struct +// This model "extends" TrustedProfileIdentity +type TrustedProfileIdentityTrustedProfileByID 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{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*TrustedProfileIdentityTrustedProfileByID) 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) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentityByCRN : VPCIdentityByCRN struct +// This model "extends" VPCIdentity +type VPCIdentityByCRN struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` +} + +// NewVPCIdentityByCRN : Instantiate VPCIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVPCIdentityByCRN(crn string) (_model *VPCIdentityByCRN, err error) { + _model = &VPCIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPCIdentityByCRN) isaVPCIdentity() bool { + return true +} + +// UnmarshalVPCIdentityByCRN unmarshals an instance of VPCIdentityByCRN from the specified map of raw messages. +func UnmarshalVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentityByHref : VPCIdentityByHref struct +// This model "extends" VPCIdentity +type VPCIdentityByHref struct { + // The URL for this VPC. + Href *string `json:"href" validate:"required"` +} + +// NewVPCIdentityByHref : Instantiate VPCIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPCIdentityByHref(href string) (_model *VPCIdentityByHref, err error) { + _model = &VPCIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPCIdentityByHref) isaVPCIdentity() bool { + return true +} + +// UnmarshalVPCIdentityByHref unmarshals an instance of VPCIdentityByHref from the specified map of raw messages. +func UnmarshalVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentityByID : VPCIdentityByID struct +// This model "extends" VPCIdentity +type VPCIdentityByID struct { + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` +} + +// NewVPCIdentityByID : Instantiate VPCIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPCIdentityByID(id string) (_model *VPCIdentityByID, err error) { + _model = &VPCIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPCIdentityByID) isaVPCIdentity() bool { + return true +} + +// UnmarshalVPCIdentityByID unmarshals an instance of VPCIdentityByID from the specified map of raw messages. +func UnmarshalVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref : VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref struct +// This model "extends" VPNGatewayConnectionIkePolicyPatch +type VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref struct { + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref : Instantiate VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref, err error) { + _model = &VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref) isaVPNGatewayConnectionIkePolicyPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID : VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID struct +// This model "extends" VPNGatewayConnectionIkePolicyPatch +type VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID struct { + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` +} + +// NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID : Instantiate VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(id string) (_model *VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID, err error) { + _model = &VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) isaVPNGatewayConnectionIkePolicyPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref : VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref struct +// This model "extends" VPNGatewayConnectionIkePolicyPrototype +type VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref struct { + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref : Instantiate VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref, err error) { + _model = &VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref) isaVPNGatewayConnectionIkePolicyPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID : VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID struct +// This model "extends" VPNGatewayConnectionIkePolicyPrototype +type VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID struct { + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` +} + +// NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID : Instantiate VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(id string) (_model *VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID, err error) { + _model = &VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) isaVPNGatewayConnectionIkePolicyPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref : VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref struct +// This model "extends" VPNGatewayConnectionIPsecPolicyPatch +type VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref struct { + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref : Instantiate VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref, err error) { + _model = &VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref) isaVPNGatewayConnectionIPsecPolicyPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID : VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID struct +// This model "extends" VPNGatewayConnectionIPsecPolicyPatch +type VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` +} + +// NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID : Instantiate VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(id string) (_model *VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID, err error) { + _model = &VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) isaVPNGatewayConnectionIPsecPolicyPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref : VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref struct +// This model "extends" VPNGatewayConnectionIPsecPolicyPrototype +type VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref struct { + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref : Instantiate VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref, err error) { + _model = &VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID : VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID struct +// This model "extends" VPNGatewayConnectionIPsecPolicyPrototype +type VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` +} + +// NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID : Instantiate VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(id string) (_model *VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID, err error) { + _model = &VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch : VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch struct +// This model "extends" VPNGatewayConnectionPatch +type VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + DeadPeerDetection *VPNGatewayConnectionDpdPatch `json:"dead_peer_detection,omitempty"` + + IkePolicy VPNGatewayConnectionIkePolicyPatchIntf `json:"ike_policy,omitempty"` + + IpsecPolicy VPNGatewayConnectionIPsecPolicyPatchIntf `json:"ipsec_policy,omitempty"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address,omitempty"` + + // The preshared key. + Psk *string `json:"psk,omitempty"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatchRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) isaVPNGatewayConnectionPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch unmarshals an instance of VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch +func (vpnGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch *VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpnGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// VPNGatewayConnectionPolicyMode : VPNGatewayConnectionPolicyMode struct +// This model "extends" VPNGatewayConnection +type VPNGatewayConnectionPolicyMode struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The IKE policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // The IPsec policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name" validate:"required"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // The local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs" validate:"required"` + + // The peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionPolicyMode.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionPolicyModeAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnectionPolicyMode.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionPolicyModeModePolicyConst = "policy" + VPNGatewayConnectionPolicyModeModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnectionPolicyMode.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionPolicyModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnectionPolicyMode.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionPolicyModeStatusDownConst = "down" + VPNGatewayConnectionPolicyModeStatusUpConst = "up" +) + +func (*VPNGatewayConnectionPolicyMode) isaVPNGatewayConnection() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPolicyMode unmarshals an instance of VPNGatewayConnectionPolicyMode from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyMode) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct +// This model "extends" VPNGatewayConnectionPrototype +type VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` + + IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // The local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs" validate:"required"` + + // The peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs" validate:"required"` +} + +// NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(peerAddress string, psk string, localCIDRs []string, peerCIDRs []string) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype, err error) { + _model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype{ + PeerAddress: core.StringPtr(peerAddress), + Psk: core.StringPtr(psk), + LocalCIDRs: localCIDRs, + PeerCIDRs: peerCIDRs, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype) isaVPNGatewayConnectionPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype unmarshals an instance of VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype struct +// This model "extends" VPNGatewayConnectionPrototype +type VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` + + IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototypeRoutingProtocolNoneConst = "none" +) + +// NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(peerAddress string, psk string) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype, err error) { + _model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype{ + PeerAddress: core.StringPtr(peerAddress), + Psk: core.StringPtr(psk), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) isaVPNGatewayConnectionPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype unmarshals an instance of VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionStaticRouteMode struct +// This model "extends" VPNGatewayConnection +type VPNGatewayConnectionStaticRouteMode struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The IKE policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // The IPsec policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name" validate:"required"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol" validate:"required"` + + // The VPN tunnel configuration for this VPN gateway connection (in static route mode). + Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionStaticRouteModeAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionStaticRouteModeModePolicyConst = "policy" + VPNGatewayConnectionStaticRouteModeModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionStaticRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionStaticRouteModeStatusDownConst = "down" + VPNGatewayConnectionStaticRouteModeStatusUpConst = "up" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionStaticRouteModeRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnection() bool { + return true +} + +// UnmarshalVPNGatewayConnectionStaticRouteMode unmarshals an instance of VPNGatewayConnectionStaticRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteMode) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPolicyMode : VPNGatewayPolicyMode struct +// This model "extends" VPNGateway +type VPNGatewayPolicyMode struct { + // Connections for this VPN gateway. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The user-defined name for this VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPN gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the VPN gateway. + Status *string `json:"status" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // Policy mode VPN gateway. + Mode *string `json:"mode" validate:"required"` +} + +// Constants associated with the VPNGatewayPolicyMode.ResourceType property. +// The resource type. +const ( + VPNGatewayPolicyModeResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGatewayPolicyMode.Status property. +// The status of the VPN gateway. +const ( + VPNGatewayPolicyModeStatusAvailableConst = "available" + VPNGatewayPolicyModeStatusDeletingConst = "deleting" + VPNGatewayPolicyModeStatusFailedConst = "failed" + VPNGatewayPolicyModeStatusPendingConst = "pending" +) + +// Constants associated with the VPNGatewayPolicyMode.Mode property. +// Policy mode VPN gateway. +const ( + VPNGatewayPolicyModeModePolicyConst = "policy" +) + +func (*VPNGatewayPolicyMode) isaVPNGateway() bool { + return true +} + +// UnmarshalVPNGatewayPolicyMode unmarshals an instance of VPNGatewayPolicyMode from the specified map of raw messages. +func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPolicyMode) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPrototypeVPNGatewayPolicyModePrototype : VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct +// This model "extends" VPNGatewayPrototype +type VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct { + // The user-defined name for this VPN gateway. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Policy mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototypeVPNGatewayPolicyModePrototype.Mode property. +// Policy mode VPN gateway. +const ( + VPNGatewayPrototypeVPNGatewayPolicyModePrototypeModePolicyConst = "policy" +) + +// NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayPolicyModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayPolicyModePrototype, err error) { + _model = &VPNGatewayPrototypeVPNGatewayPolicyModePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayPrototypeVPNGatewayPolicyModePrototype) isaVPNGatewayPrototype() bool { + return true +} + +// UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayPolicyModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototypeVPNGatewayPolicyModePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPrototypeVPNGatewayRouteModePrototype : VPNGatewayPrototypeVPNGatewayRouteModePrototype struct +// This model "extends" VPNGatewayPrototype +type VPNGatewayPrototypeVPNGatewayRouteModePrototype struct { + // The user-defined name for this VPN gateway. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototypeVPNGatewayRouteModePrototype.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayPrototypeVPNGatewayRouteModePrototypeModeRouteConst = "route" +) + +// NewVPNGatewayPrototypeVPNGatewayRouteModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayRouteModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayRouteModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayRouteModePrototype, err error) { + _model = &VPNGatewayPrototypeVPNGatewayRouteModePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayPrototypeVPNGatewayRouteModePrototype) isaVPNGatewayPrototype() bool { + return true +} + +// UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayRouteModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototypeVPNGatewayRouteModePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayRouteMode : VPNGatewayRouteMode struct +// This model "extends" VPNGateway +type VPNGatewayRouteMode struct { + // Connections for this VPN gateway. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The user-defined name for this VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPN gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the VPN gateway. + Status *string `json:"status" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode" validate:"required"` +} + +// Constants associated with the VPNGatewayRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayRouteModeResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGatewayRouteMode.Status property. +// The status of the VPN gateway. +const ( + VPNGatewayRouteModeStatusAvailableConst = "available" + VPNGatewayRouteModeStatusDeletingConst = "deleting" + VPNGatewayRouteModeStatusFailedConst = "failed" + VPNGatewayRouteModeStatusPendingConst = "pending" +) + +// Constants associated with the VPNGatewayRouteMode.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayRouteModeModeRouteConst = "route" +) + +func (*VPNGatewayRouteMode) isaVPNGateway() bool { + return true +} + +// UnmarshalVPNGatewayRouteMode unmarshals an instance of VPNGatewayRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayRouteMode) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationByCertificate : VPNServerAuthenticationByCertificate struct +// This model "extends" VPNServerAuthentication +type VPNServerAuthenticationByCertificate struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The certificate instance used for the VPN client certificate authority (CA). + ClientCa *CertificateInstanceReference `json:"client_ca" validate:"required"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` +} + +// Constants associated with the VPNServerAuthenticationByCertificate.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationByCertificateMethodCertificateConst = "certificate" + VPNServerAuthenticationByCertificateMethodUsernameConst = "username" +) + +func (*VPNServerAuthenticationByCertificate) isaVPNServerAuthentication() bool { + return true +} + +// UnmarshalVPNServerAuthenticationByCertificate unmarshals an instance of VPNServerAuthenticationByCertificate from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByCertificate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByCertificate) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationByUsername : VPNServerAuthenticationByUsername struct +// This model "extends" VPNServerAuthentication +type VPNServerAuthenticationByUsername struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider" validate:"required"` +} + +// Constants associated with the VPNServerAuthenticationByUsername.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationByUsernameMethodCertificateConst = "certificate" + VPNServerAuthenticationByUsernameMethodUsernameConst = "username" +) + +func (*VPNServerAuthenticationByUsername) isaVPNServerAuthentication() bool { + return true +} + +// UnmarshalVPNServerAuthenticationByUsername unmarshals an instance of VPNServerAuthenticationByUsername from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByUsername(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByUsername) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationByUsernameIDProviderByIam : VPNServerAuthenticationByUsernameIDProviderByIam struct +// This model "extends" VPNServerAuthenticationByUsernameIDProvider +type VPNServerAuthenticationByUsernameIDProviderByIam struct { + // The type of identity provider to be used by the VPN client. + // - `iam`: IBM identity and access management + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + ProviderType *string `json:"provider_type" validate:"required"` +} + +// Constants associated with the VPNServerAuthenticationByUsernameIDProviderByIam.ProviderType property. +// The type of identity provider to be used by the VPN client. +// - `iam`: IBM identity and access management +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +const ( + VPNServerAuthenticationByUsernameIDProviderByIamProviderTypeIamConst = "iam" +) + +// NewVPNServerAuthenticationByUsernameIDProviderByIam : Instantiate VPNServerAuthenticationByUsernameIDProviderByIam (Generic Model Constructor) +func (*VpcV1) NewVPNServerAuthenticationByUsernameIDProviderByIam(providerType string) (_model *VPNServerAuthenticationByUsernameIDProviderByIam, err error) { + _model = &VPNServerAuthenticationByUsernameIDProviderByIam{ + ProviderType: core.StringPtr(providerType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNServerAuthenticationByUsernameIDProviderByIam) isaVPNServerAuthenticationByUsernameIDProvider() bool { + return true +} + +// UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam unmarshals an instance of VPNServerAuthenticationByUsernameIDProviderByIam from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByUsernameIDProviderByIam) + err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype : VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype struct +// This model "extends" VPNServerAuthenticationPrototype +type VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The certificate instance to use for the VPN client certificate authority (CA). + ClientCa CertificateInstanceIdentityIntf `json:"client_ca" validate:"required"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` +} + +// Constants associated with the VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototypeMethodCertificateConst = "certificate" + VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototypeMethodUsernameConst = "username" +) + +// NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype : Instantiate VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(method string, clientCa CertificateInstanceIdentityIntf) (_model *VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype, err error) { + _model = &VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype{ + Method: core.StringPtr(method), + ClientCa: clientCa, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) isaVPNServerAuthenticationPrototype() bool { + return true +} + +// UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype unmarshals an instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype : VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype struct +// This model "extends" VPNServerAuthenticationPrototype +type VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider" validate:"required"` +} + +// Constants associated with the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototypeMethodCertificateConst = "certificate" + VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototypeMethodUsernameConst = "username" +) + +// NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype : Instantiate VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(method string, identityProvider VPNServerAuthenticationByUsernameIDProviderIntf) (_model *VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype, err error) { + _model = &VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype{ + Method: core.StringPtr(method), + IdentityProvider: identityProvider, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) isaVPNServerAuthenticationPrototype() bool { + return true +} + +// UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype unmarshals an instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumeIdentity : Identifies a volume by a unique property. +// Models which "extend" this model: +// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID +// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN +// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref +// This model "extends" VolumeAttachmentPrototypeVolume +type VolumeAttachmentPrototypeVolumeVolumeIdentity struct { + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentity) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { + return true +} + +type VolumeAttachmentPrototypeVolumeVolumeIdentityIntf interface { + VolumeAttachmentPrototypeVolumeIntf + isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentity) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentity unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentity from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct +// Models which "extend" this model: +// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity +// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot +// This model "extends" VolumeAttachmentPrototypeVolume +type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { + return true +} + +type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextIntf interface { + VolumeAttachmentPrototypeVolumeIntf + isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity : Identifies a volume by a unique property. +// Models which "extend" this model: +// - VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID +// - VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN +// - VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref +// This model "extends" VolumeAttachmentVolumePrototypeInstanceContext +type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity struct { + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity) isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool { + return true +} + +type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityIntf interface { + VolumeAttachmentVolumePrototypeInstanceContextIntf + isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext : VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext struct +// Models which "extend" this model: +// - VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity +// - VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot +// This model "extends" VolumeAttachmentVolumePrototypeInstanceContext +type VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext struct { + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext) isaVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext() bool { + return true +} + +type VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextIntf interface { + VolumeAttachmentVolumePrototypeInstanceContextIntf + isaVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext() bool +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentityByCRN : VolumeIdentityByCRN struct +// This model "extends" VolumeIdentity +type VolumeIdentityByCRN struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` +} + +// NewVolumeIdentityByCRN : Instantiate VolumeIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVolumeIdentityByCRN(crn string) (_model *VolumeIdentityByCRN, err error) { + _model = &VolumeIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeIdentityByCRN) isaVolumeIdentity() bool { + return true +} + +// UnmarshalVolumeIdentityByCRN unmarshals an instance of VolumeIdentityByCRN from the specified map of raw messages. +func UnmarshalVolumeIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentityByHref : VolumeIdentityByHref struct +// This model "extends" VolumeIdentity +type VolumeIdentityByHref struct { + // The URL for this volume. + Href *string `json:"href" validate:"required"` +} + +// NewVolumeIdentityByHref : Instantiate VolumeIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVolumeIdentityByHref(href string) (_model *VolumeIdentityByHref, err error) { + _model = &VolumeIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeIdentityByHref) isaVolumeIdentity() bool { + return true +} + +// UnmarshalVolumeIdentityByHref unmarshals an instance of VolumeIdentityByHref from the specified map of raw messages. +func UnmarshalVolumeIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentityByID : VolumeIdentityByID struct +// This model "extends" VolumeIdentity +type VolumeIdentityByID struct { + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` +} + +// NewVolumeIdentityByID : Instantiate VolumeIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVolumeIdentityByID(id string) (_model *VolumeIdentityByID, err error) { + _model = &VolumeIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeIdentityByID) isaVolumeIdentity() bool { + return true +} + +// UnmarshalVolumeIdentityByID unmarshals an instance of VolumeIdentityByID from the specified map of raw messages. +func UnmarshalVolumeIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileIdentityByHref : VolumeProfileIdentityByHref struct +// This model "extends" VolumeProfileIdentity +type VolumeProfileIdentityByHref struct { + // The URL for this volume profile. + Href *string `json:"href" validate:"required"` +} + +// NewVolumeProfileIdentityByHref : Instantiate VolumeProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVolumeProfileIdentityByHref(href string) (_model *VolumeProfileIdentityByHref, err error) { + _model = &VolumeProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeProfileIdentityByHref) isaVolumeProfileIdentity() bool { + return true +} + +// UnmarshalVolumeProfileIdentityByHref unmarshals an instance of VolumeProfileIdentityByHref from the specified map of raw messages. +func UnmarshalVolumeProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileIdentityByName : VolumeProfileIdentityByName struct +// This model "extends" VolumeProfileIdentity +type VolumeProfileIdentityByName struct { + // The globally unique name for this volume profile. + Name *string `json:"name" validate:"required"` +} + +// NewVolumeProfileIdentityByName : Instantiate VolumeProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewVolumeProfileIdentityByName(name string) (_model *VolumeProfileIdentityByName, err error) { + _model = &VolumeProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeProfileIdentityByName) isaVolumeProfileIdentity() bool { + return true +} + +// UnmarshalVolumeProfileIdentityByName unmarshals an instance of VolumeProfileIdentityByName from the specified map of raw messages. +func UnmarshalVolumeProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototypeVolumeByCapacity : VolumePrototypeVolumeByCapacity struct +// This model "extends" VolumePrototype +type VolumePrototypeVolumeByCapacity struct { + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this volume will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity" validate:"required"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` +} + +// NewVolumePrototypeVolumeByCapacity : Instantiate VolumePrototypeVolumeByCapacity (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeVolumeByCapacity(profile VolumeProfileIdentityIntf, zone ZoneIdentityIntf, capacity int64) (_model *VolumePrototypeVolumeByCapacity, err error) { + _model = &VolumePrototypeVolumeByCapacity{ + Profile: profile, + Zone: zone, + Capacity: core.Int64Ptr(capacity), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumePrototypeVolumeByCapacity) isaVolumePrototype() bool { + return true +} + +// UnmarshalVolumePrototypeVolumeByCapacity unmarshals an instance of VolumePrototypeVolumeByCapacity from the specified map of raw messages. +func UnmarshalVolumePrototypeVolumeByCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeVolumeByCapacity) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototypeVolumeBySourceSnapshot : VolumePrototypeVolumeBySourceSnapshot struct +// This model "extends" VolumePrototype +type VolumePrototypeVolumeBySourceSnapshot struct { + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this volume will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's + // `minimum_capacity`. The maximum value may increase in the future. + // + // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` +} + +// NewVolumePrototypeVolumeBySourceSnapshot : Instantiate VolumePrototypeVolumeBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeVolumeBySourceSnapshot(profile VolumeProfileIdentityIntf, zone ZoneIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumePrototypeVolumeBySourceSnapshot, err error) { + _model = &VolumePrototypeVolumeBySourceSnapshot{ + Profile: profile, + Zone: zone, + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumePrototypeVolumeBySourceSnapshot) isaVolumePrototype() bool { + return true +} + +// UnmarshalVolumePrototypeVolumeBySourceSnapshot unmarshals an instance of VolumePrototypeVolumeBySourceSnapshot from the specified map of raw messages. +func UnmarshalVolumePrototypeVolumeBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeVolumeBySourceSnapshot) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneIdentityByHref : ZoneIdentityByHref struct +// This model "extends" ZoneIdentity +type ZoneIdentityByHref struct { + // The URL for this zone. + Href *string `json:"href" validate:"required"` +} + +// NewZoneIdentityByHref : Instantiate ZoneIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewZoneIdentityByHref(href string) (_model *ZoneIdentityByHref, err error) { + _model = &ZoneIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ZoneIdentityByHref) isaZoneIdentity() bool { + return true +} + +// UnmarshalZoneIdentityByHref unmarshals an instance of ZoneIdentityByHref from the specified map of raw messages. +func UnmarshalZoneIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneIdentityByName : ZoneIdentityByName struct +// This model "extends" ZoneIdentity +type ZoneIdentityByName struct { + // The globally unique name for this zone. + Name *string `json:"name" validate:"required"` +} + +// NewZoneIdentityByName : Instantiate ZoneIdentityByName (Generic Model Constructor) +func (*VpcV1) NewZoneIdentityByName(name string) (_model *ZoneIdentityByName, err error) { + _model = &ZoneIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ZoneIdentityByName) isaZoneIdentity() bool { + return true +} + +// UnmarshalZoneIdentityByName unmarshals an instance of ZoneIdentityByName from the specified map of raw messages. +func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref struct +// This model "extends" EndpointGatewayReservedIPReservedIPIdentity +type EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref : Instantiate EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref(href string) (_model *EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref, err error) { + _model = &EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref) isaEndpointGatewayReservedIPReservedIPIdentity() bool { + return true +} + +func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID : EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID struct +// This model "extends" EndpointGatewayReservedIPReservedIPIdentity +type EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID : Instantiate EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID(id string) (_model *EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID, err error) { + _model = &EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) isaEndpointGatewayReservedIPReservedIPIdentity() bool { + return true +} + +func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN : EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN struct +// This model "extends" EndpointGatewayTargetPrototypeProviderCloudServiceIdentity +type EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRNResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRNResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +// NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN : Instantiate EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(resourceType string, crn string) (_model *EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN, err error) { + _model = &EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN{ + ResourceType: core.StringPtr(resourceType), + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool { + return true +} + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN unmarshals an instance of EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName : The name of this provider infrastructure service. +// This model "extends" EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity +type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByNameResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByNameResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +// NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName : Instantiate EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(resourceType string, name string) (_model *EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName, err error) { + _model = &EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName{ + ResourceType: core.StringPtr(resourceType), + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool { + return true +} + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName unmarshals an instance of EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity +type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity +type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref struct { + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity +type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { + // The URL for this network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity +type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN, err error) { + _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity +type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref struct { + // The URL for this subnet. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity +type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID struct { + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity +type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN, err error) { + _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity +type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref struct { + // The URL for this VPC. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity +type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID struct { + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec struct +// Models which "extend" this model: +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototype +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec struct { + // The user-defined name for this instance group manager action. Names must be unique within the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { + return true +} + +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecIntf interface { + InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf + isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt struct +// Models which "extend" this model: +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototype +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt struct { + // The user-defined name for this instance group manager action. Names must be unique within the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { + return true +} + +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtIntf interface { + InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf + isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionScheduledActionGroupTarget : InstanceGroupManagerActionScheduledActionGroupTarget struct +// This model "extends" InstanceGroupManagerActionScheduledAction +type InstanceGroupManagerActionScheduledActionGroupTarget struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. 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`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the + // future. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` + + // The date and time that the instance group manager action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group manager action. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was modified. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type" validate:"required"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroup `json:"group" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetStatusActiveConst = "active" + InstanceGroupManagerActionScheduledActionGroupTargetStatusCompletedConst = "completed" + InstanceGroupManagerActionScheduledActionGroupTargetStatusFailedConst = "failed" + InstanceGroupManagerActionScheduledActionGroupTargetStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionScheduledActionGroupTargetStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerActionScheduledAction() bool { + return true +} + +func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerAction() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionGroupTarget from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionScheduledActionGroupTarget) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionScheduledActionManagerTarget : InstanceGroupManagerActionScheduledActionManagerTarget struct +// This model "extends" InstanceGroupManagerActionScheduledAction +type InstanceGroupManagerActionScheduledActionManagerTarget struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. 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`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the + // future. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` + + // The date and time that the instance group manager action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group manager action. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was modified. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type" validate:"required"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetStatusActiveConst = "active" + InstanceGroupManagerActionScheduledActionManagerTargetStatusCompletedConst = "completed" + InstanceGroupManagerActionScheduledActionManagerTargetStatusFailedConst = "failed" + InstanceGroupManagerActionScheduledActionManagerTargetStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionScheduledActionManagerTargetStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerActionScheduledAction() bool { + return true +} + +func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerAction() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionManagerTarget from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionScheduledActionManagerTarget) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct +// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(href string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref, err error) { + _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { + return true +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct +// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(id string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID, err error) { + _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { + return true +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct { + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct { + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct { + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct { + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct { + // The CRN for this placement group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct { + // The URL for this placement group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct { + // The unique identifier for this placement group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref struct { + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(href string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(id string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref : NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref struct +// This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity +type NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref(href string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref, err error) { + _model = &NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { + return true +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref) isaNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID : NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID struct +// This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity +type NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID(id string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID, err error) { + _model = &NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { + return true +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID) isaNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress(address string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress, err error) { + _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN struct { + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN(crn string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN, err error) { + _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref struct { + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(href string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref, err error) { + _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID struct { + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(id string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID, err error) { + _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN struct +// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` +} + +// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN(crn string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN, err error) { + _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref struct +// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref struct { + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` +} + +// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref(href string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref, err error) { + _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID struct +// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID struct { + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` +} + +// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID(id string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID, err error) { + _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct +// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct +// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` +} + +// NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct +// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN, err error) { + _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct +// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct { + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref(href string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref, err error) { + _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID struct +// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID struct { + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID(id string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID, err error) { + _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct +// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN, err error) { + _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref struct +// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref struct { + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref(href string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref, err error) { + _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID struct +// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID struct { + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID(id string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID, err error) { + _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity +type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN(crn string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity +type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref struct { + // The URL for this volume. + Href *string `json:"href" validate:"required"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref(href string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity +type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID struct { + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(id string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext +type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct { + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity" validate:"required"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : Instantiate VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(profile VolumeProfileIdentityIntf, capacity int64) (_model *VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity{ + Profile: profile, + Capacity: core.Int64Ptr(capacity), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext +type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct { + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's + // `minimum_capacity`. The maximum value may increase in the future. + // + // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : Instantiate VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(profile VolumeProfileIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot{ + Profile: profile, + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN : VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN struct +// This model "extends" VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity +type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` +} + +// NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN : Instantiate VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN(crn string) (_model *VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN, err error) { + _model = &VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref : VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref struct +// This model "extends" VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity +type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref struct { + // The URL for this volume. + Href *string `json:"href" validate:"required"` +} + +// NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref : Instantiate VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref(href string) (_model *VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref, err error) { + _model = &VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID : VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID struct +// This model "extends" VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity +type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID struct { + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` +} + +// NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID : Instantiate VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID(id string) (_model *VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID, err error) { + _model = &VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct +// This model "extends" VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext +type VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct { + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity" validate:"required"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` +} + +// NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : Instantiate VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(profile VolumeProfileIdentityIntf, capacity int64) (_model *VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity, err error) { + _model = &VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity{ + Profile: profile, + Capacity: core.Int64Ptr(capacity), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext() bool { + return true +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct +// This model "extends" VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext +type VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct { + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's + // `minimum_capacity`. The maximum value may increase in the future. + // + // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` +} + +// NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : Instantiate VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(profile VolumeProfileIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot, err error) { + _model = &VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot{ + Profile: profile, + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) isaVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext() bool { + return true +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup struct +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup struct { + // The user-defined name for this instance group manager action. Names must be unique within the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group" validate:"required"` +} + +// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup(group *InstanceGroupManagerScheduledActionGroupPrototype) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup, err error) { + _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup{ + Group: group, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager struct +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager struct { + // The user-defined name for this instance group manager action. Names must be unique within the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager" validate:"required"` +} + +// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager(manager InstanceGroupManagerScheduledActionManagerPrototypeIntf) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager, err error) { + _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager{ + Manager: manager, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup struct +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup struct { + // The user-defined name for this instance group manager action. Names must be unique within the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group" validate:"required"` +} + +// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup(group *InstanceGroupManagerScheduledActionGroupPrototype) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup, err error) { + _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup{ + Group: group, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager struct +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager struct { + // The user-defined name for this instance group manager action. Names must be unique within the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager" validate:"required"` +} + +// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager(manager InstanceGroupManagerScheduledActionManagerPrototypeIntf) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager, err error) { + _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager{ + Manager: manager, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go new file mode 100644 index 0000000000..5183208531 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go @@ -0,0 +1,83898 @@ +/** + * (C) Copyright IBM Corp. 2022. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package vpcv1_test + +import ( + "bytes" + "context" + "fmt" + "io" + "io/ioutil" + "net/http" + "net/http/httptest" + "os" + "time" + + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/vpc-go-sdk/vpcv1" + "github.com/go-openapi/strfmt" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe(`VpcV1`, func() { + var testServer *httptest.Server + Describe(`Service constructor tests`, func() { + version := "testString" + It(`Instantiate service client`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(vpcService).ToNot(BeNil()) + Expect(serviceErr).To(BeNil()) + }) + It(`Instantiate service client with error: Invalid URL`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: "{BAD_URL_STRING", + Version: core.StringPtr(version), + }) + Expect(vpcService).To(BeNil()) + Expect(serviceErr).ToNot(BeNil()) + }) + It(`Instantiate service client with error: Invalid Auth`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: "https://vpcv1/api", + Version: core.StringPtr(version), + Authenticator: &core.BasicAuthenticator{ + Username: "", + Password: "", + }, + }) + Expect(vpcService).To(BeNil()) + Expect(serviceErr).ToNot(BeNil()) + }) + It(`Instantiate service client with error: Validation Error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{}) + Expect(vpcService).To(BeNil()) + Expect(serviceErr).ToNot(BeNil()) + }) + }) + Describe(`Service constructor tests using external config`, func() { + version := "testString" + Context(`Using external config, construct service client instances`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "VPC_URL": "https://vpcv1/api", + "VPC_AUTH_TYPE": "noauth", + } + + It(`Create service client using external config successfully`, func() { + SetTestEnvironment(testEnvironment) + vpcService, serviceErr := vpcv1.NewVpcV1UsingExternalConfig(&vpcv1.VpcV1Options{ + Version: core.StringPtr(version), + }) + Expect(vpcService).ToNot(BeNil()) + Expect(serviceErr).To(BeNil()) + ClearTestEnvironment(testEnvironment) + + clone := vpcService.Clone() + Expect(clone).ToNot(BeNil()) + Expect(clone.Service != vpcService.Service).To(BeTrue()) + Expect(clone.GetServiceURL()).To(Equal(vpcService.GetServiceURL())) + Expect(clone.Service.Options.Authenticator).To(Equal(vpcService.Service.Options.Authenticator)) + }) + It(`Create service client using external config and set url from constructor successfully`, func() { + SetTestEnvironment(testEnvironment) + vpcService, serviceErr := vpcv1.NewVpcV1UsingExternalConfig(&vpcv1.VpcV1Options{ + URL: "https://testService/api", + Version: core.StringPtr(version), + }) + Expect(vpcService).ToNot(BeNil()) + Expect(serviceErr).To(BeNil()) + Expect(vpcService.Service.GetServiceURL()).To(Equal("https://testService/api")) + ClearTestEnvironment(testEnvironment) + + clone := vpcService.Clone() + Expect(clone).ToNot(BeNil()) + Expect(clone.Service != vpcService.Service).To(BeTrue()) + Expect(clone.GetServiceURL()).To(Equal(vpcService.GetServiceURL())) + Expect(clone.Service.Options.Authenticator).To(Equal(vpcService.Service.Options.Authenticator)) + }) + It(`Create service client using external config and set url programatically successfully`, func() { + SetTestEnvironment(testEnvironment) + vpcService, serviceErr := vpcv1.NewVpcV1UsingExternalConfig(&vpcv1.VpcV1Options{ + Version: core.StringPtr(version), + }) + err := vpcService.SetServiceURL("https://testService/api") + Expect(err).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + Expect(serviceErr).To(BeNil()) + Expect(vpcService.Service.GetServiceURL()).To(Equal("https://testService/api")) + ClearTestEnvironment(testEnvironment) + + clone := vpcService.Clone() + Expect(clone).ToNot(BeNil()) + Expect(clone.Service != vpcService.Service).To(BeTrue()) + Expect(clone.GetServiceURL()).To(Equal(vpcService.GetServiceURL())) + Expect(clone.Service.Options.Authenticator).To(Equal(vpcService.Service.Options.Authenticator)) + }) + }) + Context(`Using external config, construct service client instances with error: Invalid Auth`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "VPC_URL": "https://vpcv1/api", + "VPC_AUTH_TYPE": "someOtherAuth", + } + + SetTestEnvironment(testEnvironment) + vpcService, serviceErr := vpcv1.NewVpcV1UsingExternalConfig(&vpcv1.VpcV1Options{ + Version: core.StringPtr(version), + }) + + It(`Instantiate service client with error`, func() { + Expect(vpcService).To(BeNil()) + Expect(serviceErr).ToNot(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + }) + Context(`Using external config, construct service client instances with error: Invalid URL`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "VPC_AUTH_TYPE": "NOAuth", + } + + SetTestEnvironment(testEnvironment) + vpcService, serviceErr := vpcv1.NewVpcV1UsingExternalConfig(&vpcv1.VpcV1Options{ + URL: "{BAD_URL_STRING", + Version: core.StringPtr(version), + }) + + It(`Instantiate service client with error`, func() { + Expect(vpcService).To(BeNil()) + Expect(serviceErr).ToNot(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + }) + }) + Describe(`Regional endpoint tests`, func() { + It(`GetServiceURLForRegion(region string)`, func() { + var url string + var err error + url, err = vpcv1.GetServiceURLForRegion("INVALID_REGION") + Expect(url).To(BeEmpty()) + Expect(err).ToNot(BeNil()) + fmt.Fprintf(GinkgoWriter, "Expected error: %s\n", err.Error()) + }) + }) + Describe(`ListVpcs(listVpcsOptions *ListVpcsOptions) - Operation response error`, func() { + version := "testString" + listVpcsPath := "/vpcs" + 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(listVpcsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + // TODO: Add check for classic_access query parameter + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListVpcs 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 ListVpcsOptions model + listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) + listVpcsOptionsModel.Start = core.StringPtr("testString") + listVpcsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) + listVpcsOptionsModel.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.ListVpcs(listVpcsOptionsModel) + 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.ListVpcs(listVpcsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVpcs(listVpcsOptions *ListVpcsOptions)`, func() { + version := "testString" + listVpcsPath := "/vpcs" + 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(listVpcsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + // TODO: Add check for classic_access query parameter + // 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/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/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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 ListVpcsOptions model + listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) + listVpcsOptionsModel.Start = core.StringPtr("testString") + listVpcsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) + listVpcsOptionsModel.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.ListVpcsWithContext(ctx, listVpcsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVpcs(listVpcsOptionsModel) + 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.ListVpcsWithContext(ctx, listVpcsOptionsModel) + 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(listVpcsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + // TODO: Add check for classic_access query parameter + // 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/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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.ListVpcs(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVpcsOptions model + listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) + listVpcsOptionsModel.Start = core.StringPtr("testString") + listVpcsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) + listVpcsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVpcs(listVpcsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVpcs 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 ListVpcsOptions model + listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) + listVpcsOptionsModel.Start = core.StringPtr("testString") + listVpcsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) + listVpcsOptionsModel.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.ListVpcs(listVpcsOptionsModel) + 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 ListVpcs 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 ListVpcsOptions model + listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) + listVpcsOptionsModel.Start = core.StringPtr("testString") + listVpcsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) + listVpcsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVpcs(listVpcsOptionsModel) + 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.VPCCollection) + nextObject := new(vpcv1.VPCCollectionNext) + 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.VPCCollection) + + 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.VPCCollection) + nextObject := new(vpcv1.VPCCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateVPC(createVPCOptions *CreateVPCOptions) - Operation response error`, func() { + version := "testString" + createVPCPath := "/vpcs" + 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(createVPCPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateVPC 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateVPCOptions model + createVPCOptionsModel := new(vpcv1.CreateVPCOptions) + createVPCOptionsModel.AddressPrefixManagement = core.StringPtr("manual") + createVPCOptionsModel.ClassicAccess = core.BoolPtr(false) + createVPCOptionsModel.Name = core.StringPtr("my-vpc") + createVPCOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPCOptionsModel.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.CreateVPC(createVPCOptionsModel) + 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.CreateVPC(createVPCOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateVPC(createVPCOptions *CreateVPCOptions)`, func() { + version := "testString" + createVPCPath := "/vpcs" + 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(createVPCPath)) + 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{"testString"})) + 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", `{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 CreateVPC 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateVPCOptions model + createVPCOptionsModel := new(vpcv1.CreateVPCOptions) + createVPCOptionsModel.AddressPrefixManagement = core.StringPtr("manual") + createVPCOptionsModel.ClassicAccess = core.BoolPtr(false) + createVPCOptionsModel.Name = core.StringPtr("my-vpc") + createVPCOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPCOptionsModel.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.CreateVPCWithContext(ctx, createVPCOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateVPC(createVPCOptionsModel) + 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.CreateVPCWithContext(ctx, createVPCOptionsModel) + 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(createVPCPath)) + 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{"testString"})) + 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", `{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 CreateVPC 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.CreateVPC(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 CreateVPCOptions model + createVPCOptionsModel := new(vpcv1.CreateVPCOptions) + createVPCOptionsModel.AddressPrefixManagement = core.StringPtr("manual") + createVPCOptionsModel.ClassicAccess = core.BoolPtr(false) + createVPCOptionsModel.Name = core.StringPtr("my-vpc") + createVPCOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPCOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateVPC(createVPCOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateVPC 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateVPCOptions model + createVPCOptionsModel := new(vpcv1.CreateVPCOptions) + createVPCOptionsModel.AddressPrefixManagement = core.StringPtr("manual") + createVPCOptionsModel.ClassicAccess = core.BoolPtr(false) + createVPCOptionsModel.Name = core.StringPtr("my-vpc") + createVPCOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPCOptionsModel.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.CreateVPC(createVPCOptionsModel) + 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(201) + })) + }) + It(`Invoke CreateVPC 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") + + // Construct an instance of the CreateVPCOptions model + createVPCOptionsModel := new(vpcv1.CreateVPCOptions) + createVPCOptionsModel.AddressPrefixManagement = core.StringPtr("manual") + createVPCOptionsModel.ClassicAccess = core.BoolPtr(false) + createVPCOptionsModel.Name = core.StringPtr("my-vpc") + createVPCOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPCOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateVPC(createVPCOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteVPC(deleteVPCOptions *DeleteVPCOptions)`, func() { + version := "testString" + deleteVPCPath := "/vpcs/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(deleteVPCPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteVPC 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.DeleteVPC(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteVPCOptions model + deleteVPCOptionsModel := new(vpcv1.DeleteVPCOptions) + deleteVPCOptionsModel.ID = core.StringPtr("testString") + deleteVPCOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteVPC(deleteVPCOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteVPC 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 DeleteVPCOptions model + deleteVPCOptionsModel := new(vpcv1.DeleteVPCOptions) + deleteVPCOptionsModel.ID = core.StringPtr("testString") + deleteVPCOptionsModel.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.DeleteVPC(deleteVPCOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteVPCOptions model with no property values + deleteVPCOptionsModelNew := new(vpcv1.DeleteVPCOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteVPC(deleteVPCOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPC(getVPCOptions *GetVPCOptions) - Operation response error`, func() { + version := "testString" + getVPCPath := "/vpcs/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(getVPCPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVPC 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 GetVPCOptions model + getVPCOptionsModel := new(vpcv1.GetVPCOptions) + getVPCOptionsModel.ID = core.StringPtr("testString") + getVPCOptionsModel.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.GetVPC(getVPCOptionsModel) + 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.GetVPC(getVPCOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPC(getVPCOptions *GetVPCOptions)`, func() { + version := "testString" + getVPCPath := "/vpcs/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(getVPCPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 GetVPC 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 GetVPCOptions model + getVPCOptionsModel := new(vpcv1.GetVPCOptions) + getVPCOptionsModel.ID = core.StringPtr("testString") + getVPCOptionsModel.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.GetVPCWithContext(ctx, getVPCOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPC(getVPCOptionsModel) + 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.GetVPCWithContext(ctx, getVPCOptionsModel) + 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(getVPCPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 GetVPC 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.GetVPC(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPCOptions model + getVPCOptionsModel := new(vpcv1.GetVPCOptions) + getVPCOptionsModel.ID = core.StringPtr("testString") + getVPCOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPC(getVPCOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPC 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 GetVPCOptions model + getVPCOptionsModel := new(vpcv1.GetVPCOptions) + getVPCOptionsModel.ID = core.StringPtr("testString") + getVPCOptionsModel.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.GetVPC(getVPCOptionsModel) + 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 GetVPCOptions model with no property values + getVPCOptionsModelNew := new(vpcv1.GetVPCOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPC(getVPCOptionsModelNew) + 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 GetVPC 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 GetVPCOptions model + getVPCOptionsModel := new(vpcv1.GetVPCOptions) + getVPCOptionsModel.ID = core.StringPtr("testString") + getVPCOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPC(getVPCOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPC(updateVPCOptions *UpdateVPCOptions) - Operation response error`, func() { + version := "testString" + updateVPCPath := "/vpcs/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(updateVPCPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateVPC 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 VPCPatch model + vpcPatchModel := new(vpcv1.VPCPatch) + vpcPatchModel.Name = core.StringPtr("my-vpc") + vpcPatchModelAsPatch, asPatchErr := vpcPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCOptions model + updateVPCOptionsModel := new(vpcv1.UpdateVPCOptions) + updateVPCOptionsModel.ID = core.StringPtr("testString") + updateVPCOptionsModel.VPCPatch = vpcPatchModelAsPatch + updateVPCOptionsModel.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.UpdateVPC(updateVPCOptionsModel) + 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.UpdateVPC(updateVPCOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPC(updateVPCOptions *UpdateVPCOptions)`, func() { + version := "testString" + updateVPCPath := "/vpcs/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(updateVPCPath)) + 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{"testString"})) + 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", `{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 UpdateVPC 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 VPCPatch model + vpcPatchModel := new(vpcv1.VPCPatch) + vpcPatchModel.Name = core.StringPtr("my-vpc") + vpcPatchModelAsPatch, asPatchErr := vpcPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCOptions model + updateVPCOptionsModel := new(vpcv1.UpdateVPCOptions) + updateVPCOptionsModel.ID = core.StringPtr("testString") + updateVPCOptionsModel.VPCPatch = vpcPatchModelAsPatch + updateVPCOptionsModel.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.UpdateVPCWithContext(ctx, updateVPCOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateVPC(updateVPCOptionsModel) + 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.UpdateVPCWithContext(ctx, updateVPCOptionsModel) + 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(updateVPCPath)) + 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{"testString"})) + 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", `{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 UpdateVPC 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.UpdateVPC(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the VPCPatch model + vpcPatchModel := new(vpcv1.VPCPatch) + vpcPatchModel.Name = core.StringPtr("my-vpc") + vpcPatchModelAsPatch, asPatchErr := vpcPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCOptions model + updateVPCOptionsModel := new(vpcv1.UpdateVPCOptions) + updateVPCOptionsModel.ID = core.StringPtr("testString") + updateVPCOptionsModel.VPCPatch = vpcPatchModelAsPatch + updateVPCOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateVPC(updateVPCOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateVPC 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 VPCPatch model + vpcPatchModel := new(vpcv1.VPCPatch) + vpcPatchModel.Name = core.StringPtr("my-vpc") + vpcPatchModelAsPatch, asPatchErr := vpcPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCOptions model + updateVPCOptionsModel := new(vpcv1.UpdateVPCOptions) + updateVPCOptionsModel.ID = core.StringPtr("testString") + updateVPCOptionsModel.VPCPatch = vpcPatchModelAsPatch + updateVPCOptionsModel.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.UpdateVPC(updateVPCOptionsModel) + 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 UpdateVPCOptions model with no property values + updateVPCOptionsModelNew := new(vpcv1.UpdateVPCOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateVPC(updateVPCOptionsModelNew) + 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 UpdateVPC 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 VPCPatch model + vpcPatchModel := new(vpcv1.VPCPatch) + vpcPatchModel.Name = core.StringPtr("my-vpc") + vpcPatchModelAsPatch, asPatchErr := vpcPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCOptions model + updateVPCOptionsModel := new(vpcv1.UpdateVPCOptions) + updateVPCOptionsModel.ID = core.StringPtr("testString") + updateVPCOptionsModel.VPCPatch = vpcPatchModelAsPatch + updateVPCOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateVPC(updateVPCOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) - Operation response error`, func() { + version := "testString" + getVPCDefaultNetworkACLPath := "/vpcs/testString/default_network_acl" + 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(getVPCDefaultNetworkACLPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVPCDefaultNetworkACL 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 GetVPCDefaultNetworkACLOptions model + getVPCDefaultNetworkACLOptionsModel := new(vpcv1.GetVPCDefaultNetworkACLOptions) + getVPCDefaultNetworkACLOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultNetworkACLOptionsModel.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.GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptionsModel) + 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.GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions)`, func() { + version := "testString" + getVPCDefaultNetworkACLPath := "/vpcs/testString/default_network_acl" + 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(getVPCDefaultNetworkACLPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "mnemonic-ersatz-eatery-mythology", "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetVPCDefaultNetworkACL 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 GetVPCDefaultNetworkACLOptions model + getVPCDefaultNetworkACLOptionsModel := new(vpcv1.GetVPCDefaultNetworkACLOptions) + getVPCDefaultNetworkACLOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultNetworkACLOptionsModel.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.GetVPCDefaultNetworkACLWithContext(ctx, getVPCDefaultNetworkACLOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptionsModel) + 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.GetVPCDefaultNetworkACLWithContext(ctx, getVPCDefaultNetworkACLOptionsModel) + 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(getVPCDefaultNetworkACLPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "mnemonic-ersatz-eatery-mythology", "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetVPCDefaultNetworkACL 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.GetVPCDefaultNetworkACL(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPCDefaultNetworkACLOptions model + getVPCDefaultNetworkACLOptionsModel := new(vpcv1.GetVPCDefaultNetworkACLOptions) + getVPCDefaultNetworkACLOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPCDefaultNetworkACL 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 GetVPCDefaultNetworkACLOptions model + getVPCDefaultNetworkACLOptionsModel := new(vpcv1.GetVPCDefaultNetworkACLOptions) + getVPCDefaultNetworkACLOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultNetworkACLOptionsModel.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.GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptionsModel) + 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 GetVPCDefaultNetworkACLOptions model with no property values + getVPCDefaultNetworkACLOptionsModelNew := new(vpcv1.GetVPCDefaultNetworkACLOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptionsModelNew) + 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 GetVPCDefaultNetworkACL 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 GetVPCDefaultNetworkACLOptions model + getVPCDefaultNetworkACLOptionsModel := new(vpcv1.GetVPCDefaultNetworkACLOptions) + getVPCDefaultNetworkACLOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) - Operation response error`, func() { + version := "testString" + getVPCDefaultRoutingTablePath := "/vpcs/testString/default_routing_table" + 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(getVPCDefaultRoutingTablePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVPCDefaultRoutingTable 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 GetVPCDefaultRoutingTableOptions model + getVPCDefaultRoutingTableOptionsModel := new(vpcv1.GetVPCDefaultRoutingTableOptions) + getVPCDefaultRoutingTableOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultRoutingTableOptionsModel.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.GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptionsModel) + 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.GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions)`, func() { + version := "testString" + getVPCDefaultRoutingTablePath := "/vpcs/testString/default_routing_table" + 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(getVPCDefaultRoutingTablePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + })) + }) + It(`Invoke GetVPCDefaultRoutingTable 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 GetVPCDefaultRoutingTableOptions model + getVPCDefaultRoutingTableOptionsModel := new(vpcv1.GetVPCDefaultRoutingTableOptions) + getVPCDefaultRoutingTableOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultRoutingTableOptionsModel.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.GetVPCDefaultRoutingTableWithContext(ctx, getVPCDefaultRoutingTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptionsModel) + 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.GetVPCDefaultRoutingTableWithContext(ctx, getVPCDefaultRoutingTableOptionsModel) + 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(getVPCDefaultRoutingTablePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + })) + }) + It(`Invoke GetVPCDefaultRoutingTable 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.GetVPCDefaultRoutingTable(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPCDefaultRoutingTableOptions model + getVPCDefaultRoutingTableOptionsModel := new(vpcv1.GetVPCDefaultRoutingTableOptions) + getVPCDefaultRoutingTableOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPCDefaultRoutingTable 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 GetVPCDefaultRoutingTableOptions model + getVPCDefaultRoutingTableOptionsModel := new(vpcv1.GetVPCDefaultRoutingTableOptions) + getVPCDefaultRoutingTableOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultRoutingTableOptionsModel.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.GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptionsModel) + 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 GetVPCDefaultRoutingTableOptions model with no property values + getVPCDefaultRoutingTableOptionsModelNew := new(vpcv1.GetVPCDefaultRoutingTableOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptionsModelNew) + 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 GetVPCDefaultRoutingTable 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 GetVPCDefaultRoutingTableOptions model + getVPCDefaultRoutingTableOptionsModel := new(vpcv1.GetVPCDefaultRoutingTableOptions) + getVPCDefaultRoutingTableOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) - Operation response error`, func() { + version := "testString" + getVPCDefaultSecurityGroupPath := "/vpcs/testString/default_security_group" + 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(getVPCDefaultSecurityGroupPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVPCDefaultSecurityGroup 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 GetVPCDefaultSecurityGroupOptions model + getVPCDefaultSecurityGroupOptionsModel := new(vpcv1.GetVPCDefaultSecurityGroupOptions) + getVPCDefaultSecurityGroupOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultSecurityGroupOptionsModel.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.GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptionsModel) + 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.GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions)`, func() { + version := "testString" + getVPCDefaultSecurityGroupPath := "/vpcs/testString/default_security_group" + 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(getVPCDefaultSecurityGroupPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetVPCDefaultSecurityGroup 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 GetVPCDefaultSecurityGroupOptions model + getVPCDefaultSecurityGroupOptionsModel := new(vpcv1.GetVPCDefaultSecurityGroupOptions) + getVPCDefaultSecurityGroupOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultSecurityGroupOptionsModel.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.GetVPCDefaultSecurityGroupWithContext(ctx, getVPCDefaultSecurityGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptionsModel) + 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.GetVPCDefaultSecurityGroupWithContext(ctx, getVPCDefaultSecurityGroupOptionsModel) + 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(getVPCDefaultSecurityGroupPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetVPCDefaultSecurityGroup 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.GetVPCDefaultSecurityGroup(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPCDefaultSecurityGroupOptions model + getVPCDefaultSecurityGroupOptionsModel := new(vpcv1.GetVPCDefaultSecurityGroupOptions) + getVPCDefaultSecurityGroupOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPCDefaultSecurityGroup 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 GetVPCDefaultSecurityGroupOptions model + getVPCDefaultSecurityGroupOptionsModel := new(vpcv1.GetVPCDefaultSecurityGroupOptions) + getVPCDefaultSecurityGroupOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultSecurityGroupOptionsModel.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.GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptionsModel) + 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 GetVPCDefaultSecurityGroupOptions model with no property values + getVPCDefaultSecurityGroupOptionsModelNew := new(vpcv1.GetVPCDefaultSecurityGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptionsModelNew) + 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 GetVPCDefaultSecurityGroup 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 GetVPCDefaultSecurityGroupOptions model + getVPCDefaultSecurityGroupOptionsModel := new(vpcv1.GetVPCDefaultSecurityGroupOptions) + getVPCDefaultSecurityGroupOptionsModel.ID = core.StringPtr("testString") + getVPCDefaultSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) - Operation response error`, func() { + version := "testString" + listVPCAddressPrefixesPath := "/vpcs/testString/address_prefixes" + 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(listVPCAddressPrefixesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListVPCAddressPrefixes 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 ListVPCAddressPrefixesOptions model + listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) + listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") + listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") + listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCAddressPrefixesOptionsModel.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.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModel) + 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.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions)`, func() { + version := "testString" + listVPCAddressPrefixesPath := "/vpcs/testString/address_prefixes" + 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(listVPCAddressPrefixesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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", `{"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-2", "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}`) + })) + }) + It(`Invoke ListVPCAddressPrefixes 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 ListVPCAddressPrefixesOptions model + listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) + listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") + listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") + listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCAddressPrefixesOptionsModel.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.ListVPCAddressPrefixesWithContext(ctx, listVPCAddressPrefixesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModel) + 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.ListVPCAddressPrefixesWithContext(ctx, listVPCAddressPrefixesOptionsModel) + 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(listVPCAddressPrefixesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + // 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-2", "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}`) + })) + }) + It(`Invoke ListVPCAddressPrefixes 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.ListVPCAddressPrefixes(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVPCAddressPrefixesOptions model + listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) + listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") + listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") + listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCAddressPrefixesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVPCAddressPrefixes 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 ListVPCAddressPrefixesOptions model + listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) + listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") + listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") + listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCAddressPrefixesOptionsModel.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.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModel) + 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 ListVPCAddressPrefixesOptions model with no property values + listVPCAddressPrefixesOptionsModelNew := new(vpcv1.ListVPCAddressPrefixesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModelNew) + 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 ListVPCAddressPrefixes 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 ListVPCAddressPrefixesOptions model + listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) + listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") + listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") + listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCAddressPrefixesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModel) + 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.AddressPrefixCollection) + nextObject := new(vpcv1.AddressPrefixCollectionNext) + 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.AddressPrefixCollection) + + 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.AddressPrefixCollection) + nextObject := new(vpcv1.AddressPrefixCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) - Operation response error`, func() { + version := "testString" + createVPCAddressPrefixPath := "/vpcs/testString/address_prefixes" + 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(createVPCAddressPrefixPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateVPCAddressPrefix 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 ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the CreateVPCAddressPrefixOptions model + createVPCAddressPrefixOptionsModel := new(vpcv1.CreateVPCAddressPrefixOptions) + createVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") + createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel + createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) + createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-2") + createVPCAddressPrefixOptionsModel.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.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModel) + 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.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions)`, func() { + version := "testString" + createVPCAddressPrefixPath := "/vpcs/testString/address_prefixes" + 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(createVPCAddressPrefixPath)) + 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{"testString"})) + 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", `{"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-2", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateVPCAddressPrefix 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 ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the CreateVPCAddressPrefixOptions model + createVPCAddressPrefixOptionsModel := new(vpcv1.CreateVPCAddressPrefixOptions) + createVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") + createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel + createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) + createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-2") + createVPCAddressPrefixOptionsModel.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.CreateVPCAddressPrefixWithContext(ctx, createVPCAddressPrefixOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModel) + 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.CreateVPCAddressPrefixWithContext(ctx, createVPCAddressPrefixOptionsModel) + 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(createVPCAddressPrefixPath)) + 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{"testString"})) + 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", `{"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-2", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateVPCAddressPrefix 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.CreateVPCAddressPrefix(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 CreateVPCAddressPrefixOptions model + createVPCAddressPrefixOptionsModel := new(vpcv1.CreateVPCAddressPrefixOptions) + createVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") + createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel + createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) + createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-2") + createVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateVPCAddressPrefix 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 CreateVPCAddressPrefixOptions model + createVPCAddressPrefixOptionsModel := new(vpcv1.CreateVPCAddressPrefixOptions) + createVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") + createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel + createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) + createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-2") + createVPCAddressPrefixOptionsModel.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.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModel) + 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 CreateVPCAddressPrefixOptions model with no property values + createVPCAddressPrefixOptionsModelNew := new(vpcv1.CreateVPCAddressPrefixOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModelNew) + 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 CreateVPCAddressPrefix 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 CreateVPCAddressPrefixOptions model + createVPCAddressPrefixOptionsModel := new(vpcv1.CreateVPCAddressPrefixOptions) + createVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") + createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel + createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) + createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-2") + createVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions)`, func() { + version := "testString" + deleteVPCAddressPrefixPath := "/vpcs/testString/address_prefixes/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(deleteVPCAddressPrefixPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteVPCAddressPrefix 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.DeleteVPCAddressPrefix(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteVPCAddressPrefixOptions model + deleteVPCAddressPrefixOptionsModel := new(vpcv1.DeleteVPCAddressPrefixOptions) + deleteVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + deleteVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") + deleteVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteVPCAddressPrefix 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 DeleteVPCAddressPrefixOptions model + deleteVPCAddressPrefixOptionsModel := new(vpcv1.DeleteVPCAddressPrefixOptions) + deleteVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + deleteVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") + deleteVPCAddressPrefixOptionsModel.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.DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteVPCAddressPrefixOptions model with no property values + deleteVPCAddressPrefixOptionsModelNew := new(vpcv1.DeleteVPCAddressPrefixOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) - Operation response error`, func() { + version := "testString" + getVPCAddressPrefixPath := "/vpcs/testString/address_prefixes/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(getVPCAddressPrefixPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVPCAddressPrefix 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 GetVPCAddressPrefixOptions model + getVPCAddressPrefixOptionsModel := new(vpcv1.GetVPCAddressPrefixOptions) + getVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + getVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") + getVPCAddressPrefixOptionsModel.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.GetVPCAddressPrefix(getVPCAddressPrefixOptionsModel) + 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.GetVPCAddressPrefix(getVPCAddressPrefixOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions)`, func() { + version := "testString" + getVPCAddressPrefixPath := "/vpcs/testString/address_prefixes/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(getVPCAddressPrefixPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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-2", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetVPCAddressPrefix 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 GetVPCAddressPrefixOptions model + getVPCAddressPrefixOptionsModel := new(vpcv1.GetVPCAddressPrefixOptions) + getVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + getVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") + getVPCAddressPrefixOptionsModel.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.GetVPCAddressPrefixWithContext(ctx, getVPCAddressPrefixOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPCAddressPrefix(getVPCAddressPrefixOptionsModel) + 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.GetVPCAddressPrefixWithContext(ctx, getVPCAddressPrefixOptionsModel) + 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(getVPCAddressPrefixPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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-2", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetVPCAddressPrefix 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.GetVPCAddressPrefix(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPCAddressPrefixOptions model + getVPCAddressPrefixOptionsModel := new(vpcv1.GetVPCAddressPrefixOptions) + getVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + getVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") + getVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPCAddressPrefix(getVPCAddressPrefixOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPCAddressPrefix 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 GetVPCAddressPrefixOptions model + getVPCAddressPrefixOptionsModel := new(vpcv1.GetVPCAddressPrefixOptions) + getVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + getVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") + getVPCAddressPrefixOptionsModel.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.GetVPCAddressPrefix(getVPCAddressPrefixOptionsModel) + 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 GetVPCAddressPrefixOptions model with no property values + getVPCAddressPrefixOptionsModelNew := new(vpcv1.GetVPCAddressPrefixOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPCAddressPrefix(getVPCAddressPrefixOptionsModelNew) + 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 GetVPCAddressPrefix 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 GetVPCAddressPrefixOptions model + getVPCAddressPrefixOptionsModel := new(vpcv1.GetVPCAddressPrefixOptions) + getVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + getVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") + getVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPCAddressPrefix(getVPCAddressPrefixOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) - Operation response error`, func() { + version := "testString" + updateVPCAddressPrefixPath := "/vpcs/testString/address_prefixes/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(updateVPCAddressPrefixPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateVPCAddressPrefix 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 AddressPrefixPatch model + addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) + addressPrefixPatchModel.IsDefault = core.BoolPtr(false) + addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-2") + addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCAddressPrefixOptions model + updateVPCAddressPrefixOptionsModel := new(vpcv1.UpdateVPCAddressPrefixOptions) + updateVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + updateVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") + updateVPCAddressPrefixOptionsModel.AddressPrefixPatch = addressPrefixPatchModelAsPatch + updateVPCAddressPrefixOptionsModel.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.UpdateVPCAddressPrefix(updateVPCAddressPrefixOptionsModel) + 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.UpdateVPCAddressPrefix(updateVPCAddressPrefixOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions)`, func() { + version := "testString" + updateVPCAddressPrefixPath := "/vpcs/testString/address_prefixes/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(updateVPCAddressPrefixPath)) + 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{"testString"})) + 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", `{"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-2", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateVPCAddressPrefix 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 AddressPrefixPatch model + addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) + addressPrefixPatchModel.IsDefault = core.BoolPtr(false) + addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-2") + addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCAddressPrefixOptions model + updateVPCAddressPrefixOptionsModel := new(vpcv1.UpdateVPCAddressPrefixOptions) + updateVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + updateVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") + updateVPCAddressPrefixOptionsModel.AddressPrefixPatch = addressPrefixPatchModelAsPatch + updateVPCAddressPrefixOptionsModel.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.UpdateVPCAddressPrefixWithContext(ctx, updateVPCAddressPrefixOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateVPCAddressPrefix(updateVPCAddressPrefixOptionsModel) + 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.UpdateVPCAddressPrefixWithContext(ctx, updateVPCAddressPrefixOptionsModel) + 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(updateVPCAddressPrefixPath)) + 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{"testString"})) + 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", `{"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-2", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateVPCAddressPrefix 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.UpdateVPCAddressPrefix(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the AddressPrefixPatch model + addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) + addressPrefixPatchModel.IsDefault = core.BoolPtr(false) + addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-2") + addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCAddressPrefixOptions model + updateVPCAddressPrefixOptionsModel := new(vpcv1.UpdateVPCAddressPrefixOptions) + updateVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + updateVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") + updateVPCAddressPrefixOptionsModel.AddressPrefixPatch = addressPrefixPatchModelAsPatch + updateVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateVPCAddressPrefix(updateVPCAddressPrefixOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateVPCAddressPrefix 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 AddressPrefixPatch model + addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) + addressPrefixPatchModel.IsDefault = core.BoolPtr(false) + addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-2") + addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCAddressPrefixOptions model + updateVPCAddressPrefixOptionsModel := new(vpcv1.UpdateVPCAddressPrefixOptions) + updateVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + updateVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") + updateVPCAddressPrefixOptionsModel.AddressPrefixPatch = addressPrefixPatchModelAsPatch + updateVPCAddressPrefixOptionsModel.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.UpdateVPCAddressPrefix(updateVPCAddressPrefixOptionsModel) + 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 UpdateVPCAddressPrefixOptions model with no property values + updateVPCAddressPrefixOptionsModelNew := new(vpcv1.UpdateVPCAddressPrefixOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateVPCAddressPrefix(updateVPCAddressPrefixOptionsModelNew) + 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 UpdateVPCAddressPrefix 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 AddressPrefixPatch model + addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) + addressPrefixPatchModel.IsDefault = core.BoolPtr(false) + addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-2") + addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCAddressPrefixOptions model + updateVPCAddressPrefixOptionsModel := new(vpcv1.UpdateVPCAddressPrefixOptions) + updateVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") + updateVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") + updateVPCAddressPrefixOptionsModel.AddressPrefixPatch = addressPrefixPatchModelAsPatch + updateVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateVPCAddressPrefix(updateVPCAddressPrefixOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) - Operation response error`, func() { + version := "testString" + listVPCRoutesPath := "/vpcs/testString/routes" + 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(listVPCRoutesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListVPCRoutes 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 ListVPCRoutesOptions model + listVPCRoutesOptionsModel := new(vpcv1.ListVPCRoutesOptions) + listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") + listVPCRoutesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutesOptionsModel.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.ListVPCRoutes(listVPCRoutesOptionsModel) + 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.ListVPCRoutes(listVPCRoutesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions)`, func() { + version := "testString" + listVPCRoutesPath := "/vpcs/testString/routes" + 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(listVPCRoutesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(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/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", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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() { + 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 ListVPCRoutesOptions model + listVPCRoutesOptionsModel := new(vpcv1.ListVPCRoutesOptions) + listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") + listVPCRoutesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutesOptionsModel.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.ListVPCRoutesWithContext(ctx, listVPCRoutesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVPCRoutes(listVPCRoutesOptionsModel) + 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.ListVPCRoutesWithContext(ctx, listVPCRoutesOptionsModel) + 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(listVPCRoutesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(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/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", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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() { + 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.ListVPCRoutes(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVPCRoutesOptions model + listVPCRoutesOptionsModel := new(vpcv1.ListVPCRoutesOptions) + listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") + listVPCRoutesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVPCRoutes(listVPCRoutesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVPCRoutes 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 ListVPCRoutesOptions model + listVPCRoutesOptionsModel := new(vpcv1.ListVPCRoutesOptions) + listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") + listVPCRoutesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutesOptionsModel.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.ListVPCRoutes(listVPCRoutesOptionsModel) + 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 ListVPCRoutesOptions model with no property values + listVPCRoutesOptionsModelNew := new(vpcv1.ListVPCRoutesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListVPCRoutes(listVPCRoutesOptionsModelNew) + 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 ListVPCRoutes 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 ListVPCRoutesOptions model + listVPCRoutesOptionsModel := new(vpcv1.ListVPCRoutesOptions) + listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") + listVPCRoutesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVPCRoutes(listVPCRoutesOptionsModel) + 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.RouteCollection) + nextObject := new(vpcv1.RouteCollectionNext) + 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.RouteCollection) + + 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.RouteCollection) + nextObject := new(vpcv1.RouteCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) - Operation response error`, func() { + version := "testString" + createVPCRoutePath := "/vpcs/testString/routes" + 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(createVPCRoutePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateVPCRoute 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 ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the CreateVPCRouteOptions model + createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) + createVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") + createVPCRouteOptionsModel.Zone = zoneIdentityModel + createVPCRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel + createVPCRouteOptionsModel.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.CreateVPCRoute(createVPCRouteOptionsModel) + 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.CreateVPCRoute(createVPCRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions)`, func() { + version := "testString" + createVPCRoutePath := "/vpcs/testString/routes" + 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(createVPCRoutePath)) + 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{"testString"})) + 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateVPCRoute 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 ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the CreateVPCRouteOptions model + createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) + createVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") + createVPCRouteOptionsModel.Zone = zoneIdentityModel + createVPCRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel + createVPCRouteOptionsModel.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.CreateVPCRouteWithContext(ctx, createVPCRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateVPCRoute(createVPCRouteOptionsModel) + 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.CreateVPCRouteWithContext(ctx, createVPCRouteOptionsModel) + 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(createVPCRoutePath)) + 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{"testString"})) + 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateVPCRoute 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.CreateVPCRoute(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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the CreateVPCRouteOptions model + createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) + createVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") + createVPCRouteOptionsModel.Zone = zoneIdentityModel + createVPCRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel + createVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateVPCRoute(createVPCRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateVPCRoute 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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the CreateVPCRouteOptions model + createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) + createVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") + createVPCRouteOptionsModel.Zone = zoneIdentityModel + createVPCRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel + createVPCRouteOptionsModel.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.CreateVPCRoute(createVPCRouteOptionsModel) + 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 CreateVPCRouteOptions model with no property values + createVPCRouteOptionsModelNew := new(vpcv1.CreateVPCRouteOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateVPCRoute(createVPCRouteOptionsModelNew) + 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 CreateVPCRoute 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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the CreateVPCRouteOptions model + createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) + createVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") + createVPCRouteOptionsModel.Zone = zoneIdentityModel + createVPCRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel + createVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateVPCRoute(createVPCRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions)`, func() { + version := "testString" + deleteVPCRoutePath := "/vpcs/testString/routes/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(deleteVPCRoutePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteVPCRoute 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.DeleteVPCRoute(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteVPCRouteOptions model + deleteVPCRouteOptionsModel := new(vpcv1.DeleteVPCRouteOptions) + deleteVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + deleteVPCRouteOptionsModel.ID = core.StringPtr("testString") + deleteVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteVPCRoute(deleteVPCRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteVPCRoute 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 DeleteVPCRouteOptions model + deleteVPCRouteOptionsModel := new(vpcv1.DeleteVPCRouteOptions) + deleteVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + deleteVPCRouteOptionsModel.ID = core.StringPtr("testString") + deleteVPCRouteOptionsModel.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.DeleteVPCRoute(deleteVPCRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteVPCRouteOptions model with no property values + deleteVPCRouteOptionsModelNew := new(vpcv1.DeleteVPCRouteOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteVPCRoute(deleteVPCRouteOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) - Operation response error`, func() { + version := "testString" + getVPCRoutePath := "/vpcs/testString/routes/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(getVPCRoutePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVPCRoute 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 GetVPCRouteOptions model + getVPCRouteOptionsModel := new(vpcv1.GetVPCRouteOptions) + getVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + getVPCRouteOptionsModel.ID = core.StringPtr("testString") + getVPCRouteOptionsModel.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.GetVPCRoute(getVPCRouteOptionsModel) + 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.GetVPCRoute(getVPCRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions)`, func() { + version := "testString" + getVPCRoutePath := "/vpcs/testString/routes/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(getVPCRoutePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetVPCRoute 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 GetVPCRouteOptions model + getVPCRouteOptionsModel := new(vpcv1.GetVPCRouteOptions) + getVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + getVPCRouteOptionsModel.ID = core.StringPtr("testString") + getVPCRouteOptionsModel.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.GetVPCRouteWithContext(ctx, getVPCRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPCRoute(getVPCRouteOptionsModel) + 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.GetVPCRouteWithContext(ctx, getVPCRouteOptionsModel) + 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(getVPCRoutePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetVPCRoute 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.GetVPCRoute(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPCRouteOptions model + getVPCRouteOptionsModel := new(vpcv1.GetVPCRouteOptions) + getVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + getVPCRouteOptionsModel.ID = core.StringPtr("testString") + getVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPCRoute(getVPCRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPCRoute 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 GetVPCRouteOptions model + getVPCRouteOptionsModel := new(vpcv1.GetVPCRouteOptions) + getVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + getVPCRouteOptionsModel.ID = core.StringPtr("testString") + getVPCRouteOptionsModel.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.GetVPCRoute(getVPCRouteOptionsModel) + 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 GetVPCRouteOptions model with no property values + getVPCRouteOptionsModelNew := new(vpcv1.GetVPCRouteOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPCRoute(getVPCRouteOptionsModelNew) + 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 GetVPCRoute 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 GetVPCRouteOptions model + getVPCRouteOptionsModel := new(vpcv1.GetVPCRouteOptions) + getVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + getVPCRouteOptionsModel.ID = core.StringPtr("testString") + getVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPCRoute(getVPCRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) - Operation response error`, func() { + version := "testString" + updateVPCRoutePath := "/vpcs/testString/routes/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(updateVPCRoutePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateVPCRoute 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 RoutePatch model + routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Name = core.StringPtr("my-route-2") + routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRouteOptions model + updateVPCRouteOptionsModel := new(vpcv1.UpdateVPCRouteOptions) + updateVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRouteOptionsModel.ID = core.StringPtr("testString") + updateVPCRouteOptionsModel.RoutePatch = routePatchModelAsPatch + updateVPCRouteOptionsModel.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.UpdateVPCRoute(updateVPCRouteOptionsModel) + 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.UpdateVPCRoute(updateVPCRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions)`, func() { + version := "testString" + updateVPCRoutePath := "/vpcs/testString/routes/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(updateVPCRoutePath)) + 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{"testString"})) + 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateVPCRoute 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 RoutePatch model + routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Name = core.StringPtr("my-route-2") + routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRouteOptions model + updateVPCRouteOptionsModel := new(vpcv1.UpdateVPCRouteOptions) + updateVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRouteOptionsModel.ID = core.StringPtr("testString") + updateVPCRouteOptionsModel.RoutePatch = routePatchModelAsPatch + updateVPCRouteOptionsModel.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.UpdateVPCRouteWithContext(ctx, updateVPCRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateVPCRoute(updateVPCRouteOptionsModel) + 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.UpdateVPCRouteWithContext(ctx, updateVPCRouteOptionsModel) + 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(updateVPCRoutePath)) + 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{"testString"})) + 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateVPCRoute 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.UpdateVPCRoute(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the RoutePatch model + routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Name = core.StringPtr("my-route-2") + routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRouteOptions model + updateVPCRouteOptionsModel := new(vpcv1.UpdateVPCRouteOptions) + updateVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRouteOptionsModel.ID = core.StringPtr("testString") + updateVPCRouteOptionsModel.RoutePatch = routePatchModelAsPatch + updateVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateVPCRoute(updateVPCRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateVPCRoute 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 RoutePatch model + routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Name = core.StringPtr("my-route-2") + routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRouteOptions model + updateVPCRouteOptionsModel := new(vpcv1.UpdateVPCRouteOptions) + updateVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRouteOptionsModel.ID = core.StringPtr("testString") + updateVPCRouteOptionsModel.RoutePatch = routePatchModelAsPatch + updateVPCRouteOptionsModel.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.UpdateVPCRoute(updateVPCRouteOptionsModel) + 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 UpdateVPCRouteOptions model with no property values + updateVPCRouteOptionsModelNew := new(vpcv1.UpdateVPCRouteOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateVPCRoute(updateVPCRouteOptionsModelNew) + 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 UpdateVPCRoute 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 RoutePatch model + routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Name = core.StringPtr("my-route-2") + routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRouteOptions model + updateVPCRouteOptionsModel := new(vpcv1.UpdateVPCRouteOptions) + updateVPCRouteOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRouteOptionsModel.ID = core.StringPtr("testString") + updateVPCRouteOptionsModel.RoutePatch = routePatchModelAsPatch + updateVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateVPCRoute(updateVPCRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) - Operation response error`, func() { + version := "testString" + listVPCRoutingTablesPath := "/vpcs/testString/routing_tables" + 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(listVPCRoutingTablesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + // TODO: Add check for is_default query parameter + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListVPCRoutingTables 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 ListVPCRoutingTablesOptions model + listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) + listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) + listVPCRoutingTablesOptionsModel.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.ListVPCRoutingTables(listVPCRoutingTablesOptionsModel) + 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.ListVPCRoutingTables(listVPCRoutingTablesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions)`, func() { + version := "testString" + listVPCRoutingTablesPath := "/vpcs/testString/routing_tables" + 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(listVPCRoutingTablesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + // TODO: Add check for is_default query parameter + // 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/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) + })) + }) + It(`Invoke ListVPCRoutingTables 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 ListVPCRoutingTablesOptions model + listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) + listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) + listVPCRoutingTablesOptionsModel.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.ListVPCRoutingTablesWithContext(ctx, listVPCRoutingTablesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVPCRoutingTables(listVPCRoutingTablesOptionsModel) + 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.ListVPCRoutingTablesWithContext(ctx, listVPCRoutingTablesOptionsModel) + 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(listVPCRoutingTablesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + // TODO: Add check for is_default query parameter + // 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?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) + })) + }) + It(`Invoke ListVPCRoutingTables 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.ListVPCRoutingTables(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVPCRoutingTablesOptions model + listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) + listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) + listVPCRoutingTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVPCRoutingTables(listVPCRoutingTablesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVPCRoutingTables 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 ListVPCRoutingTablesOptions model + listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) + listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) + listVPCRoutingTablesOptionsModel.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.ListVPCRoutingTables(listVPCRoutingTablesOptionsModel) + 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 ListVPCRoutingTablesOptions model with no property values + listVPCRoutingTablesOptionsModelNew := new(vpcv1.ListVPCRoutingTablesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListVPCRoutingTables(listVPCRoutingTablesOptionsModelNew) + 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 ListVPCRoutingTables 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 ListVPCRoutingTablesOptions model + listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) + listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) + listVPCRoutingTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVPCRoutingTables(listVPCRoutingTablesOptionsModel) + 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.RoutingTableCollection) + nextObject := new(vpcv1.RoutingTableCollectionNext) + 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.RoutingTableCollection) + + 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.RoutingTableCollection) + nextObject := new(vpcv1.RoutingTableCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) - Operation response error`, func() { + version := "testString" + createVPCRoutingTablePath := "/vpcs/testString/routing_tables" + 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(createVPCRoutingTablePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateVPCRoutingTable 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 ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the RoutePrototype model + routePrototypeModel := new(vpcv1.RoutePrototype) + routePrototypeModel.Action = core.StringPtr("deliver") + routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") + routePrototypeModel.Name = core.StringPtr("my-route-1") + routePrototypeModel.NextHop = routePrototypeNextHopModel + routePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateVPCRoutingTableOptions model + createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) + createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") + createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} + createVPCRoutingTableOptionsModel.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.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) + 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.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions)`, func() { + version := "testString" + createVPCRoutingTablePath := "/vpcs/testString/routing_tables" + 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(createVPCRoutingTablePath)) + 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{"testString"})) + 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + })) + }) + It(`Invoke CreateVPCRoutingTable 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 ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the RoutePrototype model + routePrototypeModel := new(vpcv1.RoutePrototype) + routePrototypeModel.Action = core.StringPtr("deliver") + routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") + routePrototypeModel.Name = core.StringPtr("my-route-1") + routePrototypeModel.NextHop = routePrototypeNextHopModel + routePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateVPCRoutingTableOptions model + createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) + createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") + createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} + createVPCRoutingTableOptionsModel.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.CreateVPCRoutingTableWithContext(ctx, createVPCRoutingTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) + 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.CreateVPCRoutingTableWithContext(ctx, createVPCRoutingTableOptionsModel) + 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(createVPCRoutingTablePath)) + 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{"testString"})) + 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + })) + }) + It(`Invoke CreateVPCRoutingTable 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.CreateVPCRoutingTable(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the RoutePrototype model + routePrototypeModel := new(vpcv1.RoutePrototype) + routePrototypeModel.Action = core.StringPtr("deliver") + routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") + routePrototypeModel.Name = core.StringPtr("my-route-1") + routePrototypeModel.NextHop = routePrototypeNextHopModel + routePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateVPCRoutingTableOptions model + createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) + createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") + createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} + createVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateVPCRoutingTable 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 ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the RoutePrototype model + routePrototypeModel := new(vpcv1.RoutePrototype) + routePrototypeModel.Action = core.StringPtr("deliver") + routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") + routePrototypeModel.Name = core.StringPtr("my-route-1") + routePrototypeModel.NextHop = routePrototypeNextHopModel + routePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateVPCRoutingTableOptions model + createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) + createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") + createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} + createVPCRoutingTableOptionsModel.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.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) + 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 CreateVPCRoutingTableOptions model with no property values + createVPCRoutingTableOptionsModelNew := new(vpcv1.CreateVPCRoutingTableOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateVPCRoutingTable(createVPCRoutingTableOptionsModelNew) + 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 CreateVPCRoutingTable 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 ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the RoutePrototype model + routePrototypeModel := new(vpcv1.RoutePrototype) + routePrototypeModel.Action = core.StringPtr("deliver") + routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") + routePrototypeModel.Name = core.StringPtr("my-route-1") + routePrototypeModel.NextHop = routePrototypeNextHopModel + routePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateVPCRoutingTableOptions model + createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) + createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") + createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} + createVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions)`, func() { + version := "testString" + deleteVPCRoutingTablePath := "/vpcs/testString/routing_tables/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(deleteVPCRoutingTablePath)) + 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{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteVPCRoutingTable 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.DeleteVPCRoutingTable(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteVPCRoutingTableOptions model + deleteVPCRoutingTableOptionsModel := new(vpcv1.DeleteVPCRoutingTableOptions) + deleteVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + deleteVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") + deleteVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteVPCRoutingTable(deleteVPCRoutingTableOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteVPCRoutingTable 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 DeleteVPCRoutingTableOptions model + deleteVPCRoutingTableOptionsModel := new(vpcv1.DeleteVPCRoutingTableOptions) + deleteVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + deleteVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") + deleteVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteVPCRoutingTableOptionsModel.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.DeleteVPCRoutingTable(deleteVPCRoutingTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteVPCRoutingTableOptions model with no property values + deleteVPCRoutingTableOptionsModelNew := new(vpcv1.DeleteVPCRoutingTableOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteVPCRoutingTable(deleteVPCRoutingTableOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) - Operation response error`, func() { + version := "testString" + getVPCRoutingTablePath := "/vpcs/testString/routing_tables/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(getVPCRoutingTablePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVPCRoutingTable 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 GetVPCRoutingTableOptions model + getVPCRoutingTableOptionsModel := new(vpcv1.GetVPCRoutingTableOptions) + getVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + getVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") + getVPCRoutingTableOptionsModel.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.GetVPCRoutingTable(getVPCRoutingTableOptionsModel) + 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.GetVPCRoutingTable(getVPCRoutingTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions)`, func() { + version := "testString" + getVPCRoutingTablePath := "/vpcs/testString/routing_tables/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(getVPCRoutingTablePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + })) + }) + It(`Invoke GetVPCRoutingTable 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 GetVPCRoutingTableOptions model + getVPCRoutingTableOptionsModel := new(vpcv1.GetVPCRoutingTableOptions) + getVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + getVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") + getVPCRoutingTableOptionsModel.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.GetVPCRoutingTableWithContext(ctx, getVPCRoutingTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPCRoutingTable(getVPCRoutingTableOptionsModel) + 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.GetVPCRoutingTableWithContext(ctx, getVPCRoutingTableOptionsModel) + 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(getVPCRoutingTablePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + })) + }) + It(`Invoke GetVPCRoutingTable 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.GetVPCRoutingTable(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPCRoutingTableOptions model + getVPCRoutingTableOptionsModel := new(vpcv1.GetVPCRoutingTableOptions) + getVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + getVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") + getVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPCRoutingTable(getVPCRoutingTableOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPCRoutingTable 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 GetVPCRoutingTableOptions model + getVPCRoutingTableOptionsModel := new(vpcv1.GetVPCRoutingTableOptions) + getVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + getVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") + getVPCRoutingTableOptionsModel.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.GetVPCRoutingTable(getVPCRoutingTableOptionsModel) + 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 GetVPCRoutingTableOptions model with no property values + getVPCRoutingTableOptionsModelNew := new(vpcv1.GetVPCRoutingTableOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPCRoutingTable(getVPCRoutingTableOptionsModelNew) + 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 GetVPCRoutingTable 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 GetVPCRoutingTableOptions model + getVPCRoutingTableOptionsModel := new(vpcv1.GetVPCRoutingTableOptions) + getVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + getVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") + getVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPCRoutingTable(getVPCRoutingTableOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) - Operation response error`, func() { + version := "testString" + updateVPCRoutingTablePath := "/vpcs/testString/routing_tables/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(updateVPCRoutingTablePath)) + 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{"testString"})) + 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 UpdateVPCRoutingTable 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 ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutingTablePatch model + routingTablePatchModel := new(vpcv1.RoutingTablePatch) + routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") + routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) + routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) + routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) + routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRoutingTableOptions model + updateVPCRoutingTableOptionsModel := new(vpcv1.UpdateVPCRoutingTableOptions) + updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") + updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch + updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPCRoutingTableOptionsModel.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.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModel) + 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.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions)`, func() { + version := "testString" + updateVPCRoutingTablePath := "/vpcs/testString/routing_tables/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(updateVPCRoutingTablePath)) + 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{"testString"})) + 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + })) + }) + It(`Invoke UpdateVPCRoutingTable 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 ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutingTablePatch model + routingTablePatchModel := new(vpcv1.RoutingTablePatch) + routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") + routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) + routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) + routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) + routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRoutingTableOptions model + updateVPCRoutingTableOptionsModel := new(vpcv1.UpdateVPCRoutingTableOptions) + updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") + updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch + updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPCRoutingTableOptionsModel.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.UpdateVPCRoutingTableWithContext(ctx, updateVPCRoutingTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModel) + 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.UpdateVPCRoutingTableWithContext(ctx, updateVPCRoutingTableOptionsModel) + 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(updateVPCRoutingTablePath)) + 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{"testString"})) + 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + })) + }) + It(`Invoke UpdateVPCRoutingTable 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.UpdateVPCRoutingTable(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutingTablePatch model + routingTablePatchModel := new(vpcv1.RoutingTablePatch) + routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") + routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) + routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) + routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) + routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRoutingTableOptions model + updateVPCRoutingTableOptionsModel := new(vpcv1.UpdateVPCRoutingTableOptions) + updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") + updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch + updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateVPCRoutingTable 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 ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutingTablePatch model + routingTablePatchModel := new(vpcv1.RoutingTablePatch) + routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") + routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) + routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) + routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) + routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRoutingTableOptions model + updateVPCRoutingTableOptionsModel := new(vpcv1.UpdateVPCRoutingTableOptions) + updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") + updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch + updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPCRoutingTableOptionsModel.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.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModel) + 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 UpdateVPCRoutingTableOptions model with no property values + updateVPCRoutingTableOptionsModelNew := new(vpcv1.UpdateVPCRoutingTableOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModelNew) + 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 UpdateVPCRoutingTable 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 ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutingTablePatch model + routingTablePatchModel := new(vpcv1.RoutingTablePatch) + routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") + routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) + routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) + routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) + routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRoutingTableOptions model + updateVPCRoutingTableOptionsModel := new(vpcv1.UpdateVPCRoutingTableOptions) + updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") + updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch + updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) - Operation response error`, func() { + version := "testString" + listVPCRoutingTableRoutesPath := "/vpcs/testString/routing_tables/testString/routes" + 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(listVPCRoutingTableRoutesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListVPCRoutingTableRoutes 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 ListVPCRoutingTableRoutesOptions model + listVPCRoutingTableRoutesOptionsModel := new(vpcv1.ListVPCRoutingTableRoutesOptions) + listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTableRoutesOptionsModel.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.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModel) + 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.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions)`, func() { + version := "testString" + listVPCRoutingTableRoutesPath := "/vpcs/testString/routing_tables/testString/routes" + 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(listVPCRoutingTableRoutesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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() { + 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 ListVPCRoutingTableRoutesOptions model + listVPCRoutingTableRoutesOptionsModel := new(vpcv1.ListVPCRoutingTableRoutesOptions) + listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTableRoutesOptionsModel.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.ListVPCRoutingTableRoutesWithContext(ctx, listVPCRoutingTableRoutesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModel) + 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.ListVPCRoutingTableRoutesWithContext(ctx, listVPCRoutingTableRoutesOptionsModel) + 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(listVPCRoutingTableRoutesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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() { + 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.ListVPCRoutingTableRoutes(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVPCRoutingTableRoutesOptions model + listVPCRoutingTableRoutesOptionsModel := new(vpcv1.ListVPCRoutingTableRoutesOptions) + listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTableRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVPCRoutingTableRoutes 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 ListVPCRoutingTableRoutesOptions model + listVPCRoutingTableRoutesOptionsModel := new(vpcv1.ListVPCRoutingTableRoutesOptions) + listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTableRoutesOptionsModel.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.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModel) + 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 ListVPCRoutingTableRoutesOptions model with no property values + listVPCRoutingTableRoutesOptionsModelNew := new(vpcv1.ListVPCRoutingTableRoutesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModelNew) + 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 ListVPCRoutingTableRoutes 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 ListVPCRoutingTableRoutesOptions model + listVPCRoutingTableRoutesOptionsModel := new(vpcv1.ListVPCRoutingTableRoutesOptions) + listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") + listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTableRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModel) + 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.RouteCollection) + nextObject := new(vpcv1.RouteCollectionNext) + 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.RouteCollection) + + 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.RouteCollection) + nextObject := new(vpcv1.RouteCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) - Operation response error`, func() { + version := "testString" + createVPCRoutingTableRoutePath := "/vpcs/testString/routing_tables/testString/routes" + 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(createVPCRoutingTableRoutePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateVPCRoutingTableRoute 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 ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the CreateVPCRoutingTableRouteOptions model + createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) + createVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") + createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel + createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel + createVPCRoutingTableRouteOptionsModel.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.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModel) + 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.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions)`, func() { + version := "testString" + createVPCRoutingTableRoutePath := "/vpcs/testString/routing_tables/testString/routes" + 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(createVPCRoutingTableRoutePath)) + 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{"testString"})) + 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateVPCRoutingTableRoute 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 ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the CreateVPCRoutingTableRouteOptions model + createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) + createVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") + createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel + createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel + createVPCRoutingTableRouteOptionsModel.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.CreateVPCRoutingTableRouteWithContext(ctx, createVPCRoutingTableRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModel) + 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.CreateVPCRoutingTableRouteWithContext(ctx, createVPCRoutingTableRouteOptionsModel) + 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(createVPCRoutingTableRoutePath)) + 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{"testString"})) + 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateVPCRoutingTableRoute 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.CreateVPCRoutingTableRoute(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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the CreateVPCRoutingTableRouteOptions model + createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) + createVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") + createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel + createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel + createVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateVPCRoutingTableRoute 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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the CreateVPCRoutingTableRouteOptions model + createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) + createVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") + createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel + createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel + createVPCRoutingTableRouteOptionsModel.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.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModel) + 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 CreateVPCRoutingTableRouteOptions model with no property values + createVPCRoutingTableRouteOptionsModelNew := new(vpcv1.CreateVPCRoutingTableRouteOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModelNew) + 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 CreateVPCRoutingTableRoute 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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the CreateVPCRoutingTableRouteOptions model + createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) + createVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") + createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel + createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") + createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel + createVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions)`, func() { + version := "testString" + deleteVPCRoutingTableRoutePath := "/vpcs/testString/routing_tables/testString/routes/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(deleteVPCRoutingTableRoutePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteVPCRoutingTableRoute 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.DeleteVPCRoutingTableRoute(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteVPCRoutingTableRouteOptions model + deleteVPCRoutingTableRouteOptionsModel := new(vpcv1.DeleteVPCRoutingTableRouteOptions) + deleteVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + deleteVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + deleteVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") + deleteVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteVPCRoutingTableRoute 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 DeleteVPCRoutingTableRouteOptions model + deleteVPCRoutingTableRouteOptionsModel := new(vpcv1.DeleteVPCRoutingTableRouteOptions) + deleteVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + deleteVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + deleteVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") + deleteVPCRoutingTableRouteOptionsModel.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.DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteVPCRoutingTableRouteOptions model with no property values + deleteVPCRoutingTableRouteOptionsModelNew := new(vpcv1.DeleteVPCRoutingTableRouteOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) - Operation response error`, func() { + version := "testString" + getVPCRoutingTableRoutePath := "/vpcs/testString/routing_tables/testString/routes/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(getVPCRoutingTableRoutePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVPCRoutingTableRoute 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 GetVPCRoutingTableRouteOptions model + getVPCRoutingTableRouteOptionsModel := new(vpcv1.GetVPCRoutingTableRouteOptions) + getVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.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.GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptionsModel) + 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.GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions)`, func() { + version := "testString" + getVPCRoutingTableRoutePath := "/vpcs/testString/routing_tables/testString/routes/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(getVPCRoutingTableRoutePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetVPCRoutingTableRoute 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 GetVPCRoutingTableRouteOptions model + getVPCRoutingTableRouteOptionsModel := new(vpcv1.GetVPCRoutingTableRouteOptions) + getVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.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.GetVPCRoutingTableRouteWithContext(ctx, getVPCRoutingTableRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptionsModel) + 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.GetVPCRoutingTableRouteWithContext(ctx, getVPCRoutingTableRouteOptionsModel) + 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(getVPCRoutingTableRoutePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetVPCRoutingTableRoute 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.GetVPCRoutingTableRoute(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPCRoutingTableRouteOptions model + getVPCRoutingTableRouteOptionsModel := new(vpcv1.GetVPCRoutingTableRouteOptions) + getVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPCRoutingTableRoute 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 GetVPCRoutingTableRouteOptions model + getVPCRoutingTableRouteOptionsModel := new(vpcv1.GetVPCRoutingTableRouteOptions) + getVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.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.GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptionsModel) + 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 GetVPCRoutingTableRouteOptions model with no property values + getVPCRoutingTableRouteOptionsModelNew := new(vpcv1.GetVPCRoutingTableRouteOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptionsModelNew) + 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 GetVPCRoutingTableRoute 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 GetVPCRoutingTableRouteOptions model + getVPCRoutingTableRouteOptionsModel := new(vpcv1.GetVPCRoutingTableRouteOptions) + getVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") + getVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) - Operation response error`, func() { + version := "testString" + updateVPCRoutingTableRoutePath := "/vpcs/testString/routing_tables/testString/routes/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(updateVPCRoutingTableRoutePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateVPCRoutingTableRoute 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 RoutePatch model + routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Name = core.StringPtr("my-route-2") + routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRoutingTableRouteOptions model + updateVPCRoutingTableRouteOptionsModel := new(vpcv1.UpdateVPCRoutingTableRouteOptions) + updateVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.RoutePatch = routePatchModelAsPatch + updateVPCRoutingTableRouteOptionsModel.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.UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptionsModel) + 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.UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions)`, func() { + version := "testString" + updateVPCRoutingTableRoutePath := "/vpcs/testString/routing_tables/testString/routes/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(updateVPCRoutingTableRoutePath)) + 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{"testString"})) + 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateVPCRoutingTableRoute 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 RoutePatch model + routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Name = core.StringPtr("my-route-2") + routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRoutingTableRouteOptions model + updateVPCRoutingTableRouteOptionsModel := new(vpcv1.UpdateVPCRoutingTableRouteOptions) + updateVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.RoutePatch = routePatchModelAsPatch + updateVPCRoutingTableRouteOptionsModel.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.UpdateVPCRoutingTableRouteWithContext(ctx, updateVPCRoutingTableRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptionsModel) + 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.UpdateVPCRoutingTableRouteWithContext(ctx, updateVPCRoutingTableRouteOptionsModel) + 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(updateVPCRoutingTableRoutePath)) + 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{"testString"})) + 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateVPCRoutingTableRoute 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.UpdateVPCRoutingTableRoute(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the RoutePatch model + routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Name = core.StringPtr("my-route-2") + routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRoutingTableRouteOptions model + updateVPCRoutingTableRouteOptionsModel := new(vpcv1.UpdateVPCRoutingTableRouteOptions) + updateVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.RoutePatch = routePatchModelAsPatch + updateVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateVPCRoutingTableRoute 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 RoutePatch model + routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Name = core.StringPtr("my-route-2") + routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRoutingTableRouteOptions model + updateVPCRoutingTableRouteOptionsModel := new(vpcv1.UpdateVPCRoutingTableRouteOptions) + updateVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.RoutePatch = routePatchModelAsPatch + updateVPCRoutingTableRouteOptionsModel.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.UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptionsModel) + 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 UpdateVPCRoutingTableRouteOptions model with no property values + updateVPCRoutingTableRouteOptionsModelNew := new(vpcv1.UpdateVPCRoutingTableRouteOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptionsModelNew) + 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 UpdateVPCRoutingTableRoute 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 RoutePatch model + routePatchModel := new(vpcv1.RoutePatch) + routePatchModel.Name = core.StringPtr("my-route-2") + routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPCRoutingTableRouteOptions model + updateVPCRoutingTableRouteOptionsModel := new(vpcv1.UpdateVPCRoutingTableRouteOptions) + updateVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") + updateVPCRoutingTableRouteOptionsModel.RoutePatch = routePatchModelAsPatch + updateVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSubnets(listSubnetsOptions *ListSubnetsOptions) - Operation response error`, func() { + version := "testString" + listSubnetsPath := "/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(listSubnetsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["routing_table.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["routing_table.name"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListSubnets 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 ListSubnetsOptions model + listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) + listSubnetsOptionsModel.Start = core.StringPtr("testString") + listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") + listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") + listSubnetsOptionsModel.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.ListSubnets(listSubnetsOptionsModel) + 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.ListSubnets(listSubnetsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSubnets(listSubnetsOptions *ListSubnetsOptions)`, func() { + version := "testString" + listSubnetsPath := "/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(listSubnetsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["routing_table.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["routing_table.name"]).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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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 ListSubnetsOptions model + listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) + listSubnetsOptionsModel.Start = core.StringPtr("testString") + listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") + listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") + listSubnetsOptionsModel.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.ListSubnetsWithContext(ctx, listSubnetsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListSubnets(listSubnetsOptionsModel) + 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.ListSubnetsWithContext(ctx, listSubnetsOptionsModel) + 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(listSubnetsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["routing_table.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["routing_table.name"]).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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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.ListSubnets(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListSubnetsOptions model + listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) + listSubnetsOptionsModel.Start = core.StringPtr("testString") + listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") + listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") + listSubnetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListSubnets(listSubnetsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListSubnets 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 ListSubnetsOptions model + listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) + listSubnetsOptionsModel.Start = core.StringPtr("testString") + listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") + listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") + listSubnetsOptionsModel.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.ListSubnets(listSubnetsOptionsModel) + 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 ListSubnets 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 ListSubnetsOptions model + listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) + listSubnetsOptionsModel.Start = core.StringPtr("testString") + listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") + listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") + listSubnetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListSubnets(listSubnetsOptionsModel) + 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.SubnetCollection) + nextObject := new(vpcv1.SubnetCollectionNext) + 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.SubnetCollection) + + 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.SubnetCollection) + nextObject := new(vpcv1.SubnetCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateSubnet(createSubnetOptions *CreateSubnetOptions) - Operation response error`, func() { + version := "testString" + createSubnetPath := "/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(createSubnetPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateSubnet 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 NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model + publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) + publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("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 SubnetPrototypeSubnetByTotalCount model + subnetPrototypeModel := new(vpcv1.SubnetPrototypeSubnetByTotalCount) + subnetPrototypeModel.IPVersion = core.StringPtr("ipv4") + subnetPrototypeModel.Name = core.StringPtr("my-subnet") + subnetPrototypeModel.NetworkACL = networkACLIdentityModel + subnetPrototypeModel.PublicGateway = publicGatewayIdentityModel + subnetPrototypeModel.ResourceGroup = resourceGroupIdentityModel + subnetPrototypeModel.RoutingTable = routingTableIdentityModel + subnetPrototypeModel.VPC = vpcIdentityModel + subnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) + subnetPrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateSubnetOptions model + createSubnetOptionsModel := new(vpcv1.CreateSubnetOptions) + createSubnetOptionsModel.SubnetPrototype = subnetPrototypeModel + createSubnetOptionsModel.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.CreateSubnet(createSubnetOptionsModel) + 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.CreateSubnet(createSubnetOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateSubnet(createSubnetOptions *CreateSubnetOptions)`, func() { + version := "testString" + createSubnetPath := "/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(createSubnetPath)) + 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{"testString"})) + 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", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 CreateSubnet 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 NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model + publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) + publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("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 SubnetPrototypeSubnetByTotalCount model + subnetPrototypeModel := new(vpcv1.SubnetPrototypeSubnetByTotalCount) + subnetPrototypeModel.IPVersion = core.StringPtr("ipv4") + subnetPrototypeModel.Name = core.StringPtr("my-subnet") + subnetPrototypeModel.NetworkACL = networkACLIdentityModel + subnetPrototypeModel.PublicGateway = publicGatewayIdentityModel + subnetPrototypeModel.ResourceGroup = resourceGroupIdentityModel + subnetPrototypeModel.RoutingTable = routingTableIdentityModel + subnetPrototypeModel.VPC = vpcIdentityModel + subnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) + subnetPrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateSubnetOptions model + createSubnetOptionsModel := new(vpcv1.CreateSubnetOptions) + createSubnetOptionsModel.SubnetPrototype = subnetPrototypeModel + createSubnetOptionsModel.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.CreateSubnetWithContext(ctx, createSubnetOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateSubnet(createSubnetOptionsModel) + 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.CreateSubnetWithContext(ctx, createSubnetOptionsModel) + 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(createSubnetPath)) + 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{"testString"})) + 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", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 CreateSubnet 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.CreateSubnet(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model + publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) + publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("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 SubnetPrototypeSubnetByTotalCount model + subnetPrototypeModel := new(vpcv1.SubnetPrototypeSubnetByTotalCount) + subnetPrototypeModel.IPVersion = core.StringPtr("ipv4") + subnetPrototypeModel.Name = core.StringPtr("my-subnet") + subnetPrototypeModel.NetworkACL = networkACLIdentityModel + subnetPrototypeModel.PublicGateway = publicGatewayIdentityModel + subnetPrototypeModel.ResourceGroup = resourceGroupIdentityModel + subnetPrototypeModel.RoutingTable = routingTableIdentityModel + subnetPrototypeModel.VPC = vpcIdentityModel + subnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) + subnetPrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateSubnetOptions model + createSubnetOptionsModel := new(vpcv1.CreateSubnetOptions) + createSubnetOptionsModel.SubnetPrototype = subnetPrototypeModel + createSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateSubnet(createSubnetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateSubnet 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 NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model + publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) + publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("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 SubnetPrototypeSubnetByTotalCount model + subnetPrototypeModel := new(vpcv1.SubnetPrototypeSubnetByTotalCount) + subnetPrototypeModel.IPVersion = core.StringPtr("ipv4") + subnetPrototypeModel.Name = core.StringPtr("my-subnet") + subnetPrototypeModel.NetworkACL = networkACLIdentityModel + subnetPrototypeModel.PublicGateway = publicGatewayIdentityModel + subnetPrototypeModel.ResourceGroup = resourceGroupIdentityModel + subnetPrototypeModel.RoutingTable = routingTableIdentityModel + subnetPrototypeModel.VPC = vpcIdentityModel + subnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) + subnetPrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateSubnetOptions model + createSubnetOptionsModel := new(vpcv1.CreateSubnetOptions) + createSubnetOptionsModel.SubnetPrototype = subnetPrototypeModel + createSubnetOptionsModel.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.CreateSubnet(createSubnetOptionsModel) + 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 CreateSubnetOptions model with no property values + createSubnetOptionsModelNew := new(vpcv1.CreateSubnetOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateSubnet(createSubnetOptionsModelNew) + 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 CreateSubnet 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 NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model + publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) + publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("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 SubnetPrototypeSubnetByTotalCount model + subnetPrototypeModel := new(vpcv1.SubnetPrototypeSubnetByTotalCount) + subnetPrototypeModel.IPVersion = core.StringPtr("ipv4") + subnetPrototypeModel.Name = core.StringPtr("my-subnet") + subnetPrototypeModel.NetworkACL = networkACLIdentityModel + subnetPrototypeModel.PublicGateway = publicGatewayIdentityModel + subnetPrototypeModel.ResourceGroup = resourceGroupIdentityModel + subnetPrototypeModel.RoutingTable = routingTableIdentityModel + subnetPrototypeModel.VPC = vpcIdentityModel + subnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) + subnetPrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateSubnetOptions model + createSubnetOptionsModel := new(vpcv1.CreateSubnetOptions) + createSubnetOptionsModel.SubnetPrototype = subnetPrototypeModel + createSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateSubnet(createSubnetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteSubnet(deleteSubnetOptions *DeleteSubnetOptions)`, func() { + version := "testString" + deleteSubnetPath := "/subnets/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(deleteSubnetPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteSubnet 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.DeleteSubnet(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteSubnetOptions model + deleteSubnetOptionsModel := new(vpcv1.DeleteSubnetOptions) + deleteSubnetOptionsModel.ID = core.StringPtr("testString") + deleteSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteSubnet(deleteSubnetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteSubnet 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 DeleteSubnetOptions model + deleteSubnetOptionsModel := new(vpcv1.DeleteSubnetOptions) + deleteSubnetOptionsModel.ID = core.StringPtr("testString") + deleteSubnetOptionsModel.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.DeleteSubnet(deleteSubnetOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSubnetOptions model with no property values + deleteSubnetOptionsModelNew := new(vpcv1.DeleteSubnetOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteSubnet(deleteSubnetOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSubnet(getSubnetOptions *GetSubnetOptions) - Operation response error`, func() { + version := "testString" + getSubnetPath := "/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(getSubnetPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetSubnet 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 GetSubnetOptions model + getSubnetOptionsModel := new(vpcv1.GetSubnetOptions) + getSubnetOptionsModel.ID = core.StringPtr("testString") + getSubnetOptionsModel.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.GetSubnet(getSubnetOptionsModel) + 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.GetSubnet(getSubnetOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSubnet(getSubnetOptions *GetSubnetOptions)`, func() { + version := "testString" + getSubnetPath := "/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(getSubnetPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 GetSubnet 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 GetSubnetOptions model + getSubnetOptionsModel := new(vpcv1.GetSubnetOptions) + getSubnetOptionsModel.ID = core.StringPtr("testString") + getSubnetOptionsModel.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.GetSubnetWithContext(ctx, getSubnetOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetSubnet(getSubnetOptionsModel) + 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.GetSubnetWithContext(ctx, getSubnetOptionsModel) + 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(getSubnetPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 GetSubnet 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.GetSubnet(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetSubnetOptions model + getSubnetOptionsModel := new(vpcv1.GetSubnetOptions) + getSubnetOptionsModel.ID = core.StringPtr("testString") + getSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetSubnet(getSubnetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetSubnet 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 GetSubnetOptions model + getSubnetOptionsModel := new(vpcv1.GetSubnetOptions) + getSubnetOptionsModel.ID = core.StringPtr("testString") + getSubnetOptionsModel.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.GetSubnet(getSubnetOptionsModel) + 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 GetSubnetOptions model with no property values + getSubnetOptionsModelNew := new(vpcv1.GetSubnetOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetSubnet(getSubnetOptionsModelNew) + 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 GetSubnet 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 GetSubnetOptions model + getSubnetOptionsModel := new(vpcv1.GetSubnetOptions) + getSubnetOptionsModel.ID = core.StringPtr("testString") + getSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetSubnet(getSubnetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) - Operation response error`, func() { + version := "testString" + updateSubnetPath := "/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(updateSubnetPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateSubnet 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 NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the SubnetPublicGatewayPatchPublicGatewayIdentityByID model + subnetPublicGatewayPatchModel := new(vpcv1.SubnetPublicGatewayPatchPublicGatewayIdentityByID) + subnetPublicGatewayPatchModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") + + // Construct an instance of the SubnetPatch model + subnetPatchModel := new(vpcv1.SubnetPatch) + subnetPatchModel.Name = core.StringPtr("my-subnet") + subnetPatchModel.NetworkACL = networkACLIdentityModel + subnetPatchModel.PublicGateway = subnetPublicGatewayPatchModel + subnetPatchModel.RoutingTable = routingTableIdentityModel + subnetPatchModelAsPatch, asPatchErr := subnetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSubnetOptions model + updateSubnetOptionsModel := new(vpcv1.UpdateSubnetOptions) + updateSubnetOptionsModel.ID = core.StringPtr("testString") + updateSubnetOptionsModel.SubnetPatch = subnetPatchModelAsPatch + updateSubnetOptionsModel.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.UpdateSubnet(updateSubnetOptionsModel) + 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.UpdateSubnet(updateSubnetOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions)`, func() { + version := "testString" + updateSubnetPath := "/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(updateSubnetPath)) + 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{"testString"})) + 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", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 UpdateSubnet 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 NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the SubnetPublicGatewayPatchPublicGatewayIdentityByID model + subnetPublicGatewayPatchModel := new(vpcv1.SubnetPublicGatewayPatchPublicGatewayIdentityByID) + subnetPublicGatewayPatchModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") + + // Construct an instance of the SubnetPatch model + subnetPatchModel := new(vpcv1.SubnetPatch) + subnetPatchModel.Name = core.StringPtr("my-subnet") + subnetPatchModel.NetworkACL = networkACLIdentityModel + subnetPatchModel.PublicGateway = subnetPublicGatewayPatchModel + subnetPatchModel.RoutingTable = routingTableIdentityModel + subnetPatchModelAsPatch, asPatchErr := subnetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSubnetOptions model + updateSubnetOptionsModel := new(vpcv1.UpdateSubnetOptions) + updateSubnetOptionsModel.ID = core.StringPtr("testString") + updateSubnetOptionsModel.SubnetPatch = subnetPatchModelAsPatch + updateSubnetOptionsModel.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.UpdateSubnetWithContext(ctx, updateSubnetOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateSubnet(updateSubnetOptionsModel) + 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.UpdateSubnetWithContext(ctx, updateSubnetOptionsModel) + 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(updateSubnetPath)) + 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{"testString"})) + 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_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 UpdateSubnet 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.UpdateSubnet(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the SubnetPublicGatewayPatchPublicGatewayIdentityByID model + subnetPublicGatewayPatchModel := new(vpcv1.SubnetPublicGatewayPatchPublicGatewayIdentityByID) + subnetPublicGatewayPatchModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") + + // Construct an instance of the SubnetPatch model + subnetPatchModel := new(vpcv1.SubnetPatch) + subnetPatchModel.Name = core.StringPtr("my-subnet") + subnetPatchModel.NetworkACL = networkACLIdentityModel + subnetPatchModel.PublicGateway = subnetPublicGatewayPatchModel + subnetPatchModel.RoutingTable = routingTableIdentityModel + subnetPatchModelAsPatch, asPatchErr := subnetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSubnetOptions model + updateSubnetOptionsModel := new(vpcv1.UpdateSubnetOptions) + updateSubnetOptionsModel.ID = core.StringPtr("testString") + updateSubnetOptionsModel.SubnetPatch = subnetPatchModelAsPatch + updateSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateSubnet(updateSubnetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateSubnet 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 NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the SubnetPublicGatewayPatchPublicGatewayIdentityByID model + subnetPublicGatewayPatchModel := new(vpcv1.SubnetPublicGatewayPatchPublicGatewayIdentityByID) + subnetPublicGatewayPatchModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") + + // Construct an instance of the SubnetPatch model + subnetPatchModel := new(vpcv1.SubnetPatch) + subnetPatchModel.Name = core.StringPtr("my-subnet") + subnetPatchModel.NetworkACL = networkACLIdentityModel + subnetPatchModel.PublicGateway = subnetPublicGatewayPatchModel + subnetPatchModel.RoutingTable = routingTableIdentityModel + subnetPatchModelAsPatch, asPatchErr := subnetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSubnetOptions model + updateSubnetOptionsModel := new(vpcv1.UpdateSubnetOptions) + updateSubnetOptionsModel.ID = core.StringPtr("testString") + updateSubnetOptionsModel.SubnetPatch = subnetPatchModelAsPatch + updateSubnetOptionsModel.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.UpdateSubnet(updateSubnetOptionsModel) + 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 UpdateSubnetOptions model with no property values + updateSubnetOptionsModelNew := new(vpcv1.UpdateSubnetOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateSubnet(updateSubnetOptionsModelNew) + 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 UpdateSubnet 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 NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the SubnetPublicGatewayPatchPublicGatewayIdentityByID model + subnetPublicGatewayPatchModel := new(vpcv1.SubnetPublicGatewayPatchPublicGatewayIdentityByID) + subnetPublicGatewayPatchModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") + + // Construct an instance of the SubnetPatch model + subnetPatchModel := new(vpcv1.SubnetPatch) + subnetPatchModel.Name = core.StringPtr("my-subnet") + subnetPatchModel.NetworkACL = networkACLIdentityModel + subnetPatchModel.PublicGateway = subnetPublicGatewayPatchModel + subnetPatchModel.RoutingTable = routingTableIdentityModel + subnetPatchModelAsPatch, asPatchErr := subnetPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSubnetOptions model + updateSubnetOptionsModel := new(vpcv1.UpdateSubnetOptions) + updateSubnetOptionsModel.ID = core.StringPtr("testString") + updateSubnetOptionsModel.SubnetPatch = subnetPatchModelAsPatch + updateSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateSubnet(updateSubnetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSubnetNetworkACL(getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) - Operation response error`, func() { + version := "testString" + getSubnetNetworkACLPath := "/subnets/testString/network_acl" + 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(getSubnetNetworkACLPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetSubnetNetworkACL 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 GetSubnetNetworkACLOptions model + getSubnetNetworkACLOptionsModel := new(vpcv1.GetSubnetNetworkACLOptions) + getSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") + getSubnetNetworkACLOptionsModel.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.GetSubnetNetworkACL(getSubnetNetworkACLOptionsModel) + 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.GetSubnetNetworkACL(getSubnetNetworkACLOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSubnetNetworkACL(getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions)`, func() { + version := "testString" + getSubnetNetworkACLPath := "/subnets/testString/network_acl" + 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(getSubnetNetworkACLPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetSubnetNetworkACL 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 GetSubnetNetworkACLOptions model + getSubnetNetworkACLOptionsModel := new(vpcv1.GetSubnetNetworkACLOptions) + getSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") + getSubnetNetworkACLOptionsModel.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.GetSubnetNetworkACLWithContext(ctx, getSubnetNetworkACLOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetSubnetNetworkACL(getSubnetNetworkACLOptionsModel) + 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.GetSubnetNetworkACLWithContext(ctx, getSubnetNetworkACLOptionsModel) + 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(getSubnetNetworkACLPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetSubnetNetworkACL 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.GetSubnetNetworkACL(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetSubnetNetworkACLOptions model + getSubnetNetworkACLOptionsModel := new(vpcv1.GetSubnetNetworkACLOptions) + getSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") + getSubnetNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetSubnetNetworkACL(getSubnetNetworkACLOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetSubnetNetworkACL 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 GetSubnetNetworkACLOptions model + getSubnetNetworkACLOptionsModel := new(vpcv1.GetSubnetNetworkACLOptions) + getSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") + getSubnetNetworkACLOptionsModel.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.GetSubnetNetworkACL(getSubnetNetworkACLOptionsModel) + 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 GetSubnetNetworkACLOptions model with no property values + getSubnetNetworkACLOptionsModelNew := new(vpcv1.GetSubnetNetworkACLOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetSubnetNetworkACL(getSubnetNetworkACLOptionsModelNew) + 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 GetSubnetNetworkACL 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 GetSubnetNetworkACLOptions model + getSubnetNetworkACLOptionsModel := new(vpcv1.GetSubnetNetworkACLOptions) + getSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") + getSubnetNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetSubnetNetworkACL(getSubnetNetworkACLOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) - Operation response error`, func() { + version := "testString" + replaceSubnetNetworkACLPath := "/subnets/testString/network_acl" + 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(replaceSubnetNetworkACLPath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ReplaceSubnetNetworkACL 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 NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the ReplaceSubnetNetworkACLOptions model + replaceSubnetNetworkACLOptionsModel := new(vpcv1.ReplaceSubnetNetworkACLOptions) + replaceSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") + replaceSubnetNetworkACLOptionsModel.NetworkACLIdentity = networkACLIdentityModel + replaceSubnetNetworkACLOptionsModel.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.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModel) + 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.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions)`, func() { + version := "testString" + replaceSubnetNetworkACLPath := "/subnets/testString/network_acl" + 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(replaceSubnetNetworkACLPath)) + 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{"testString"})) + 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke ReplaceSubnetNetworkACL 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 NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the ReplaceSubnetNetworkACLOptions model + replaceSubnetNetworkACLOptionsModel := new(vpcv1.ReplaceSubnetNetworkACLOptions) + replaceSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") + replaceSubnetNetworkACLOptionsModel.NetworkACLIdentity = networkACLIdentityModel + replaceSubnetNetworkACLOptionsModel.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.ReplaceSubnetNetworkACLWithContext(ctx, replaceSubnetNetworkACLOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModel) + 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.ReplaceSubnetNetworkACLWithContext(ctx, replaceSubnetNetworkACLOptionsModel) + 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(replaceSubnetNetworkACLPath)) + 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{"testString"})) + 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke ReplaceSubnetNetworkACL 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.ReplaceSubnetNetworkACL(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the ReplaceSubnetNetworkACLOptions model + replaceSubnetNetworkACLOptionsModel := new(vpcv1.ReplaceSubnetNetworkACLOptions) + replaceSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") + replaceSubnetNetworkACLOptionsModel.NetworkACLIdentity = networkACLIdentityModel + replaceSubnetNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ReplaceSubnetNetworkACL 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 NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the ReplaceSubnetNetworkACLOptions model + replaceSubnetNetworkACLOptionsModel := new(vpcv1.ReplaceSubnetNetworkACLOptions) + replaceSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") + replaceSubnetNetworkACLOptionsModel.NetworkACLIdentity = networkACLIdentityModel + replaceSubnetNetworkACLOptionsModel.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.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModel) + 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 ReplaceSubnetNetworkACLOptions model with no property values + replaceSubnetNetworkACLOptionsModelNew := new(vpcv1.ReplaceSubnetNetworkACLOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModelNew) + 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 ReplaceSubnetNetworkACL 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 NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + + // Construct an instance of the ReplaceSubnetNetworkACLOptions model + replaceSubnetNetworkACLOptionsModel := new(vpcv1.ReplaceSubnetNetworkACLOptions) + replaceSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") + replaceSubnetNetworkACLOptionsModel.NetworkACLIdentity = networkACLIdentityModel + replaceSubnetNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions)`, func() { + version := "testString" + unsetSubnetPublicGatewayPath := "/subnets/testString/public_gateway" + 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(unsetSubnetPublicGatewayPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke UnsetSubnetPublicGateway 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.UnsetSubnetPublicGateway(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the UnsetSubnetPublicGatewayOptions model + unsetSubnetPublicGatewayOptionsModel := new(vpcv1.UnsetSubnetPublicGatewayOptions) + unsetSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") + unsetSubnetPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke UnsetSubnetPublicGateway 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 UnsetSubnetPublicGatewayOptions model + unsetSubnetPublicGatewayOptionsModel := new(vpcv1.UnsetSubnetPublicGatewayOptions) + unsetSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") + unsetSubnetPublicGatewayOptionsModel.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.UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the UnsetSubnetPublicGatewayOptions model with no property values + unsetSubnetPublicGatewayOptionsModelNew := new(vpcv1.UnsetSubnetPublicGatewayOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) - Operation response error`, func() { + version := "testString" + getSubnetPublicGatewayPath := "/subnets/testString/public_gateway" + 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(getSubnetPublicGatewayPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetSubnetPublicGateway 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 GetSubnetPublicGatewayOptions model + getSubnetPublicGatewayOptionsModel := new(vpcv1.GetSubnetPublicGatewayOptions) + getSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") + getSubnetPublicGatewayOptionsModel.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.GetSubnetPublicGateway(getSubnetPublicGatewayOptionsModel) + 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.GetSubnetPublicGateway(getSubnetPublicGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions)`, func() { + version := "testString" + getSubnetPublicGatewayPath := "/subnets/testString/public_gateway" + 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(getSubnetPublicGatewayPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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 GetSubnetPublicGatewayOptions model + getSubnetPublicGatewayOptionsModel := new(vpcv1.GetSubnetPublicGatewayOptions) + getSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") + getSubnetPublicGatewayOptionsModel.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.GetSubnetPublicGatewayWithContext(ctx, getSubnetPublicGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetSubnetPublicGateway(getSubnetPublicGatewayOptionsModel) + 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.GetSubnetPublicGatewayWithContext(ctx, getSubnetPublicGatewayOptionsModel) + 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(getSubnetPublicGatewayPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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.GetSubnetPublicGateway(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetSubnetPublicGatewayOptions model + getSubnetPublicGatewayOptionsModel := new(vpcv1.GetSubnetPublicGatewayOptions) + getSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") + getSubnetPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetSubnetPublicGateway(getSubnetPublicGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetSubnetPublicGateway 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 GetSubnetPublicGatewayOptions model + getSubnetPublicGatewayOptionsModel := new(vpcv1.GetSubnetPublicGatewayOptions) + getSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") + getSubnetPublicGatewayOptionsModel.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.GetSubnetPublicGateway(getSubnetPublicGatewayOptionsModel) + 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 GetSubnetPublicGatewayOptions model with no property values + getSubnetPublicGatewayOptionsModelNew := new(vpcv1.GetSubnetPublicGatewayOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetSubnetPublicGateway(getSubnetPublicGatewayOptionsModelNew) + 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 GetSubnetPublicGateway 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 GetSubnetPublicGatewayOptions model + getSubnetPublicGatewayOptionsModel := new(vpcv1.GetSubnetPublicGatewayOptions) + getSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") + getSubnetPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetSubnetPublicGateway(getSubnetPublicGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) - Operation response error`, func() { + version := "testString" + setSubnetPublicGatewayPath := "/subnets/testString/public_gateway" + 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(setSubnetPublicGatewayPath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 SetSubnetPublicGateway 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 PublicGatewayIdentityPublicGatewayIdentityByID model + publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) + publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the SetSubnetPublicGatewayOptions model + setSubnetPublicGatewayOptionsModel := new(vpcv1.SetSubnetPublicGatewayOptions) + setSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") + setSubnetPublicGatewayOptionsModel.PublicGatewayIdentity = publicGatewayIdentityModel + setSubnetPublicGatewayOptionsModel.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.SetSubnetPublicGateway(setSubnetPublicGatewayOptionsModel) + 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.SetSubnetPublicGateway(setSubnetPublicGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions)`, func() { + version := "testString" + setSubnetPublicGatewayPath := "/subnets/testString/public_gateway" + 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(setSubnetPublicGatewayPath)) + 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{"testString"})) + 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", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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 PublicGatewayIdentityPublicGatewayIdentityByID model + publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) + publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the SetSubnetPublicGatewayOptions model + setSubnetPublicGatewayOptionsModel := new(vpcv1.SetSubnetPublicGatewayOptions) + setSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") + setSubnetPublicGatewayOptionsModel.PublicGatewayIdentity = publicGatewayIdentityModel + setSubnetPublicGatewayOptionsModel.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.SetSubnetPublicGatewayWithContext(ctx, setSubnetPublicGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.SetSubnetPublicGateway(setSubnetPublicGatewayOptionsModel) + 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.SetSubnetPublicGatewayWithContext(ctx, setSubnetPublicGatewayOptionsModel) + 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(setSubnetPublicGatewayPath)) + 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{"testString"})) + 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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.SetSubnetPublicGateway(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model + publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) + publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the SetSubnetPublicGatewayOptions model + setSubnetPublicGatewayOptionsModel := new(vpcv1.SetSubnetPublicGatewayOptions) + setSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") + setSubnetPublicGatewayOptionsModel.PublicGatewayIdentity = publicGatewayIdentityModel + setSubnetPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.SetSubnetPublicGateway(setSubnetPublicGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke SetSubnetPublicGateway 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 PublicGatewayIdentityPublicGatewayIdentityByID model + publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) + publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the SetSubnetPublicGatewayOptions model + setSubnetPublicGatewayOptionsModel := new(vpcv1.SetSubnetPublicGatewayOptions) + setSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") + setSubnetPublicGatewayOptionsModel.PublicGatewayIdentity = publicGatewayIdentityModel + setSubnetPublicGatewayOptionsModel.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.SetSubnetPublicGateway(setSubnetPublicGatewayOptionsModel) + 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 SetSubnetPublicGatewayOptions model with no property values + setSubnetPublicGatewayOptionsModelNew := new(vpcv1.SetSubnetPublicGatewayOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.SetSubnetPublicGateway(setSubnetPublicGatewayOptionsModelNew) + 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 SetSubnetPublicGateway 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 PublicGatewayIdentityPublicGatewayIdentityByID model + publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) + publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + + // Construct an instance of the SetSubnetPublicGatewayOptions model + setSubnetPublicGatewayOptionsModel := new(vpcv1.SetSubnetPublicGatewayOptions) + setSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") + setSubnetPublicGatewayOptionsModel.PublicGatewayIdentity = publicGatewayIdentityModel + setSubnetPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.SetSubnetPublicGateway(setSubnetPublicGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) - Operation response error`, func() { + version := "testString" + getSubnetRoutingTablePath := "/subnets/testString/routing_table" + 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(getSubnetRoutingTablePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetSubnetRoutingTable 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 GetSubnetRoutingTableOptions model + getSubnetRoutingTableOptionsModel := new(vpcv1.GetSubnetRoutingTableOptions) + getSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") + getSubnetRoutingTableOptionsModel.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.GetSubnetRoutingTable(getSubnetRoutingTableOptionsModel) + 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.GetSubnetRoutingTable(getSubnetRoutingTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions)`, func() { + version := "testString" + getSubnetRoutingTablePath := "/subnets/testString/routing_table" + 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(getSubnetRoutingTablePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + })) + }) + It(`Invoke GetSubnetRoutingTable 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 GetSubnetRoutingTableOptions model + getSubnetRoutingTableOptionsModel := new(vpcv1.GetSubnetRoutingTableOptions) + getSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") + getSubnetRoutingTableOptionsModel.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.GetSubnetRoutingTableWithContext(ctx, getSubnetRoutingTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetSubnetRoutingTable(getSubnetRoutingTableOptionsModel) + 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.GetSubnetRoutingTableWithContext(ctx, getSubnetRoutingTableOptionsModel) + 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(getSubnetRoutingTablePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + })) + }) + It(`Invoke GetSubnetRoutingTable 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.GetSubnetRoutingTable(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetSubnetRoutingTableOptions model + getSubnetRoutingTableOptionsModel := new(vpcv1.GetSubnetRoutingTableOptions) + getSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") + getSubnetRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetSubnetRoutingTable(getSubnetRoutingTableOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetSubnetRoutingTable 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 GetSubnetRoutingTableOptions model + getSubnetRoutingTableOptionsModel := new(vpcv1.GetSubnetRoutingTableOptions) + getSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") + getSubnetRoutingTableOptionsModel.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.GetSubnetRoutingTable(getSubnetRoutingTableOptionsModel) + 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 GetSubnetRoutingTableOptions model with no property values + getSubnetRoutingTableOptionsModelNew := new(vpcv1.GetSubnetRoutingTableOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetSubnetRoutingTable(getSubnetRoutingTableOptionsModelNew) + 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 GetSubnetRoutingTable 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 GetSubnetRoutingTableOptions model + getSubnetRoutingTableOptionsModel := new(vpcv1.GetSubnetRoutingTableOptions) + getSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") + getSubnetRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetSubnetRoutingTable(getSubnetRoutingTableOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) - Operation response error`, func() { + version := "testString" + replaceSubnetRoutingTablePath := "/subnets/testString/routing_table" + 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(replaceSubnetRoutingTablePath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ReplaceSubnetRoutingTable 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 RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("1a15dca5-7e33-45e1-b7c5-bc690e569531") + + // Construct an instance of the ReplaceSubnetRoutingTableOptions model + replaceSubnetRoutingTableOptionsModel := new(vpcv1.ReplaceSubnetRoutingTableOptions) + replaceSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") + replaceSubnetRoutingTableOptionsModel.RoutingTableIdentity = routingTableIdentityModel + replaceSubnetRoutingTableOptionsModel.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.ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptionsModel) + 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.ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions)`, func() { + version := "testString" + replaceSubnetRoutingTablePath := "/subnets/testString/routing_table" + 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(replaceSubnetRoutingTablePath)) + 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{"testString"})) + 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + })) + }) + It(`Invoke ReplaceSubnetRoutingTable 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 RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("1a15dca5-7e33-45e1-b7c5-bc690e569531") + + // Construct an instance of the ReplaceSubnetRoutingTableOptions model + replaceSubnetRoutingTableOptionsModel := new(vpcv1.ReplaceSubnetRoutingTableOptions) + replaceSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") + replaceSubnetRoutingTableOptionsModel.RoutingTableIdentity = routingTableIdentityModel + replaceSubnetRoutingTableOptionsModel.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.ReplaceSubnetRoutingTableWithContext(ctx, replaceSubnetRoutingTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptionsModel) + 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.ReplaceSubnetRoutingTableWithContext(ctx, replaceSubnetRoutingTableOptionsModel) + 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(replaceSubnetRoutingTablePath)) + 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{"testString"})) + 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + })) + }) + It(`Invoke ReplaceSubnetRoutingTable 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.ReplaceSubnetRoutingTable(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("1a15dca5-7e33-45e1-b7c5-bc690e569531") + + // Construct an instance of the ReplaceSubnetRoutingTableOptions model + replaceSubnetRoutingTableOptionsModel := new(vpcv1.ReplaceSubnetRoutingTableOptions) + replaceSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") + replaceSubnetRoutingTableOptionsModel.RoutingTableIdentity = routingTableIdentityModel + replaceSubnetRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ReplaceSubnetRoutingTable 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 RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("1a15dca5-7e33-45e1-b7c5-bc690e569531") + + // Construct an instance of the ReplaceSubnetRoutingTableOptions model + replaceSubnetRoutingTableOptionsModel := new(vpcv1.ReplaceSubnetRoutingTableOptions) + replaceSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") + replaceSubnetRoutingTableOptionsModel.RoutingTableIdentity = routingTableIdentityModel + replaceSubnetRoutingTableOptionsModel.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.ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptionsModel) + 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 ReplaceSubnetRoutingTableOptions model with no property values + replaceSubnetRoutingTableOptionsModelNew := new(vpcv1.ReplaceSubnetRoutingTableOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptionsModelNew) + 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 ReplaceSubnetRoutingTable 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 RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + routingTableIdentityModel.ID = core.StringPtr("1a15dca5-7e33-45e1-b7c5-bc690e569531") + + // Construct an instance of the ReplaceSubnetRoutingTableOptions model + replaceSubnetRoutingTableOptionsModel := new(vpcv1.ReplaceSubnetRoutingTableOptions) + replaceSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") + replaceSubnetRoutingTableOptionsModel.RoutingTableIdentity = routingTableIdentityModel + replaceSubnetRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) - Operation response error`, func() { + version := "testString" + listSubnetReservedIpsPath := "/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(listSubnetReservedIpsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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 ListSubnetReservedIps 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 ListSubnetReservedIpsOptions model + listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) + listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listSubnetReservedIpsOptionsModel.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.ListSubnetReservedIps(listSubnetReservedIpsOptionsModel) + 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.ListSubnetReservedIps(listSubnetReservedIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions)`, func() { + version := "testString" + listSubnetReservedIpsPath := "/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(listSubnetReservedIpsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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/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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "total_count": 132}`) + })) + }) + It(`Invoke ListSubnetReservedIps 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 ListSubnetReservedIpsOptions model + listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) + listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listSubnetReservedIpsOptionsModel.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.ListSubnetReservedIpsWithContext(ctx, listSubnetReservedIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListSubnetReservedIps(listSubnetReservedIpsOptionsModel) + 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.ListSubnetReservedIpsWithContext(ctx, listSubnetReservedIpsOptionsModel) + 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(listSubnetReservedIpsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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/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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "total_count": 132}`) + })) + }) + It(`Invoke ListSubnetReservedIps 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.ListSubnetReservedIps(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListSubnetReservedIpsOptions model + listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) + listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListSubnetReservedIps(listSubnetReservedIpsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListSubnetReservedIps 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 ListSubnetReservedIpsOptions model + listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) + listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listSubnetReservedIpsOptionsModel.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.ListSubnetReservedIps(listSubnetReservedIpsOptionsModel) + 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 ListSubnetReservedIpsOptions model with no property values + listSubnetReservedIpsOptionsModelNew := new(vpcv1.ListSubnetReservedIpsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListSubnetReservedIps(listSubnetReservedIpsOptionsModelNew) + 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 ListSubnetReservedIps 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 ListSubnetReservedIpsOptions model + listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) + listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") + listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") + listSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListSubnetReservedIps(listSubnetReservedIpsOptionsModel) + 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.ReservedIPCollection) + nextObject := new(vpcv1.ReservedIPCollectionNext) + 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.ReservedIPCollection) + + 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.ReservedIPCollection) + nextObject := new(vpcv1.ReservedIPCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) - Operation response error`, func() { + version := "testString" + createSubnetReservedIPPath := "/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(createSubnetReservedIPPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateSubnetReservedIP 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 ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID model + reservedIPTargetPrototypeModel := new(vpcv1.ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) + reservedIPTargetPrototypeModel.ID = core.StringPtr("d7cc5196-9864-48c4-82d8-3f30da41fcc5") + + // Construct an instance of the CreateSubnetReservedIPOptions model + createSubnetReservedIPOptionsModel := new(vpcv1.CreateSubnetReservedIPOptions) + createSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + createSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") + createSubnetReservedIPOptionsModel.AutoDelete = core.BoolPtr(false) + createSubnetReservedIPOptionsModel.Name = core.StringPtr("my-reserved-ip") + createSubnetReservedIPOptionsModel.Target = reservedIPTargetPrototypeModel + createSubnetReservedIPOptionsModel.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.CreateSubnetReservedIP(createSubnetReservedIPOptionsModel) + 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.CreateSubnetReservedIP(createSubnetReservedIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions)`, func() { + version := "testString" + createSubnetReservedIPPath := "/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(createSubnetReservedIPPath)) + 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{"testString"})) + 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": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + })) + }) + It(`Invoke CreateSubnetReservedIP 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 ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID model + reservedIPTargetPrototypeModel := new(vpcv1.ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) + reservedIPTargetPrototypeModel.ID = core.StringPtr("d7cc5196-9864-48c4-82d8-3f30da41fcc5") + + // Construct an instance of the CreateSubnetReservedIPOptions model + createSubnetReservedIPOptionsModel := new(vpcv1.CreateSubnetReservedIPOptions) + createSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + createSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") + createSubnetReservedIPOptionsModel.AutoDelete = core.BoolPtr(false) + createSubnetReservedIPOptionsModel.Name = core.StringPtr("my-reserved-ip") + createSubnetReservedIPOptionsModel.Target = reservedIPTargetPrototypeModel + createSubnetReservedIPOptionsModel.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.CreateSubnetReservedIPWithContext(ctx, createSubnetReservedIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateSubnetReservedIP(createSubnetReservedIPOptionsModel) + 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.CreateSubnetReservedIPWithContext(ctx, createSubnetReservedIPOptionsModel) + 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(createSubnetReservedIPPath)) + 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{"testString"})) + 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": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + })) + }) + It(`Invoke CreateSubnetReservedIP 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.CreateSubnetReservedIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID model + reservedIPTargetPrototypeModel := new(vpcv1.ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) + reservedIPTargetPrototypeModel.ID = core.StringPtr("d7cc5196-9864-48c4-82d8-3f30da41fcc5") + + // Construct an instance of the CreateSubnetReservedIPOptions model + createSubnetReservedIPOptionsModel := new(vpcv1.CreateSubnetReservedIPOptions) + createSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + createSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") + createSubnetReservedIPOptionsModel.AutoDelete = core.BoolPtr(false) + createSubnetReservedIPOptionsModel.Name = core.StringPtr("my-reserved-ip") + createSubnetReservedIPOptionsModel.Target = reservedIPTargetPrototypeModel + createSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateSubnetReservedIP(createSubnetReservedIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateSubnetReservedIP 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 ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID model + reservedIPTargetPrototypeModel := new(vpcv1.ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) + reservedIPTargetPrototypeModel.ID = core.StringPtr("d7cc5196-9864-48c4-82d8-3f30da41fcc5") + + // Construct an instance of the CreateSubnetReservedIPOptions model + createSubnetReservedIPOptionsModel := new(vpcv1.CreateSubnetReservedIPOptions) + createSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + createSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") + createSubnetReservedIPOptionsModel.AutoDelete = core.BoolPtr(false) + createSubnetReservedIPOptionsModel.Name = core.StringPtr("my-reserved-ip") + createSubnetReservedIPOptionsModel.Target = reservedIPTargetPrototypeModel + createSubnetReservedIPOptionsModel.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.CreateSubnetReservedIP(createSubnetReservedIPOptionsModel) + 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 CreateSubnetReservedIPOptions model with no property values + createSubnetReservedIPOptionsModelNew := new(vpcv1.CreateSubnetReservedIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateSubnetReservedIP(createSubnetReservedIPOptionsModelNew) + 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 CreateSubnetReservedIP 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 ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID model + reservedIPTargetPrototypeModel := new(vpcv1.ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) + reservedIPTargetPrototypeModel.ID = core.StringPtr("d7cc5196-9864-48c4-82d8-3f30da41fcc5") + + // Construct an instance of the CreateSubnetReservedIPOptions model + createSubnetReservedIPOptionsModel := new(vpcv1.CreateSubnetReservedIPOptions) + createSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + createSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") + createSubnetReservedIPOptionsModel.AutoDelete = core.BoolPtr(false) + createSubnetReservedIPOptionsModel.Name = core.StringPtr("my-reserved-ip") + createSubnetReservedIPOptionsModel.Target = reservedIPTargetPrototypeModel + createSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateSubnetReservedIP(createSubnetReservedIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions)`, func() { + version := "testString" + deleteSubnetReservedIPPath := "/subnets/testString/reserved_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(deleteSubnetReservedIPPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteSubnetReservedIP 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.DeleteSubnetReservedIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteSubnetReservedIPOptions model + deleteSubnetReservedIPOptionsModel := new(vpcv1.DeleteSubnetReservedIPOptions) + deleteSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + deleteSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + deleteSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteSubnetReservedIP(deleteSubnetReservedIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteSubnetReservedIP 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 DeleteSubnetReservedIPOptions model + deleteSubnetReservedIPOptionsModel := new(vpcv1.DeleteSubnetReservedIPOptions) + deleteSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + deleteSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + deleteSubnetReservedIPOptionsModel.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.DeleteSubnetReservedIP(deleteSubnetReservedIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSubnetReservedIPOptions model with no property values + deleteSubnetReservedIPOptionsModelNew := new(vpcv1.DeleteSubnetReservedIPOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteSubnetReservedIP(deleteSubnetReservedIPOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) - Operation response error`, func() { + version := "testString" + getSubnetReservedIPPath := "/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(getSubnetReservedIPPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetSubnetReservedIP 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 GetSubnetReservedIPOptions model + getSubnetReservedIPOptionsModel := new(vpcv1.GetSubnetReservedIPOptions) + getSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + getSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + getSubnetReservedIPOptionsModel.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.GetSubnetReservedIP(getSubnetReservedIPOptionsModel) + 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.GetSubnetReservedIP(getSubnetReservedIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions)`, func() { + version := "testString" + getSubnetReservedIPPath := "/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(getSubnetReservedIPPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + })) + }) + It(`Invoke GetSubnetReservedIP 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 GetSubnetReservedIPOptions model + getSubnetReservedIPOptionsModel := new(vpcv1.GetSubnetReservedIPOptions) + getSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + getSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + getSubnetReservedIPOptionsModel.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.GetSubnetReservedIPWithContext(ctx, getSubnetReservedIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetSubnetReservedIP(getSubnetReservedIPOptionsModel) + 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.GetSubnetReservedIPWithContext(ctx, getSubnetReservedIPOptionsModel) + 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(getSubnetReservedIPPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + })) + }) + It(`Invoke GetSubnetReservedIP 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.GetSubnetReservedIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetSubnetReservedIPOptions model + getSubnetReservedIPOptionsModel := new(vpcv1.GetSubnetReservedIPOptions) + getSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + getSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + getSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetSubnetReservedIP(getSubnetReservedIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetSubnetReservedIP 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 GetSubnetReservedIPOptions model + getSubnetReservedIPOptionsModel := new(vpcv1.GetSubnetReservedIPOptions) + getSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + getSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + getSubnetReservedIPOptionsModel.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.GetSubnetReservedIP(getSubnetReservedIPOptionsModel) + 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 GetSubnetReservedIPOptions model with no property values + getSubnetReservedIPOptionsModelNew := new(vpcv1.GetSubnetReservedIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetSubnetReservedIP(getSubnetReservedIPOptionsModelNew) + 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 GetSubnetReservedIP 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 GetSubnetReservedIPOptions model + getSubnetReservedIPOptionsModel := new(vpcv1.GetSubnetReservedIPOptions) + getSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + getSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + getSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetSubnetReservedIP(getSubnetReservedIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateSubnetReservedIP(updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) - Operation response error`, func() { + version := "testString" + updateSubnetReservedIPPath := "/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(updateSubnetReservedIPPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateSubnetReservedIP 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 ReservedIPPatch model + reservedIPPatchModel := new(vpcv1.ReservedIPPatch) + reservedIPPatchModel.AutoDelete = core.BoolPtr(false) + reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") + reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSubnetReservedIPOptions model + updateSubnetReservedIPOptionsModel := new(vpcv1.UpdateSubnetReservedIPOptions) + updateSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + updateSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + updateSubnetReservedIPOptionsModel.ReservedIPPatch = reservedIPPatchModelAsPatch + updateSubnetReservedIPOptionsModel.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.UpdateSubnetReservedIP(updateSubnetReservedIPOptionsModel) + 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.UpdateSubnetReservedIP(updateSubnetReservedIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateSubnetReservedIP(updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions)`, func() { + version := "testString" + updateSubnetReservedIPPath := "/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(updateSubnetReservedIPPath)) + 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{"testString"})) + 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + })) + }) + It(`Invoke UpdateSubnetReservedIP 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 ReservedIPPatch model + reservedIPPatchModel := new(vpcv1.ReservedIPPatch) + reservedIPPatchModel.AutoDelete = core.BoolPtr(false) + reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") + reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSubnetReservedIPOptions model + updateSubnetReservedIPOptionsModel := new(vpcv1.UpdateSubnetReservedIPOptions) + updateSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + updateSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + updateSubnetReservedIPOptionsModel.ReservedIPPatch = reservedIPPatchModelAsPatch + updateSubnetReservedIPOptionsModel.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.UpdateSubnetReservedIPWithContext(ctx, updateSubnetReservedIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateSubnetReservedIP(updateSubnetReservedIPOptionsModel) + 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.UpdateSubnetReservedIPWithContext(ctx, updateSubnetReservedIPOptionsModel) + 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(updateSubnetReservedIPPath)) + 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{"testString"})) + 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + })) + }) + It(`Invoke UpdateSubnetReservedIP 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.UpdateSubnetReservedIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ReservedIPPatch model + reservedIPPatchModel := new(vpcv1.ReservedIPPatch) + reservedIPPatchModel.AutoDelete = core.BoolPtr(false) + reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") + reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSubnetReservedIPOptions model + updateSubnetReservedIPOptionsModel := new(vpcv1.UpdateSubnetReservedIPOptions) + updateSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + updateSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + updateSubnetReservedIPOptionsModel.ReservedIPPatch = reservedIPPatchModelAsPatch + updateSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateSubnetReservedIP(updateSubnetReservedIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateSubnetReservedIP 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 ReservedIPPatch model + reservedIPPatchModel := new(vpcv1.ReservedIPPatch) + reservedIPPatchModel.AutoDelete = core.BoolPtr(false) + reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") + reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSubnetReservedIPOptions model + updateSubnetReservedIPOptionsModel := new(vpcv1.UpdateSubnetReservedIPOptions) + updateSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + updateSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + updateSubnetReservedIPOptionsModel.ReservedIPPatch = reservedIPPatchModelAsPatch + updateSubnetReservedIPOptionsModel.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.UpdateSubnetReservedIP(updateSubnetReservedIPOptionsModel) + 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 UpdateSubnetReservedIPOptions model with no property values + updateSubnetReservedIPOptionsModelNew := new(vpcv1.UpdateSubnetReservedIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateSubnetReservedIP(updateSubnetReservedIPOptionsModelNew) + 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 UpdateSubnetReservedIP 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 ReservedIPPatch model + reservedIPPatchModel := new(vpcv1.ReservedIPPatch) + reservedIPPatchModel.AutoDelete = core.BoolPtr(false) + reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") + reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSubnetReservedIPOptions model + updateSubnetReservedIPOptionsModel := new(vpcv1.UpdateSubnetReservedIPOptions) + updateSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") + updateSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") + updateSubnetReservedIPOptionsModel.ReservedIPPatch = reservedIPPatchModelAsPatch + updateSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateSubnetReservedIP(updateSubnetReservedIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListImages(listImagesOptions *ListImagesOptions) - Operation response error`, func() { + version := "testString" + listImagesPath := "/images" + 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(listImagesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["visibility"]).To(Equal([]string{"private"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListImages 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 ListImagesOptions model + listImagesOptionsModel := new(vpcv1.ListImagesOptions) + listImagesOptionsModel.Start = core.StringPtr("testString") + listImagesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listImagesOptionsModel.Name = core.StringPtr("testString") + listImagesOptionsModel.Visibility = core.StringPtr("private") + listImagesOptionsModel.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.ListImages(listImagesOptionsModel) + 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.ListImages(listImagesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListImages(listImagesOptions *ListImagesOptions)`, func() { + version := "testString" + listImagesPath := "/images" + 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(listImagesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["visibility"]).To(Equal([]string{"private"})) + // 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/images?limit=20"}, "images": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/images?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}}`) + })) + }) + It(`Invoke ListImages 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 ListImagesOptions model + listImagesOptionsModel := new(vpcv1.ListImagesOptions) + listImagesOptionsModel.Start = core.StringPtr("testString") + listImagesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listImagesOptionsModel.Name = core.StringPtr("testString") + listImagesOptionsModel.Visibility = core.StringPtr("private") + listImagesOptionsModel.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.ListImagesWithContext(ctx, listImagesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListImages(listImagesOptionsModel) + 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.ListImagesWithContext(ctx, listImagesOptionsModel) + 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(listImagesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["visibility"]).To(Equal([]string{"private"})) + // 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": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/images?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}}`) + })) + }) + It(`Invoke ListImages 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.ListImages(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListImagesOptions model + listImagesOptionsModel := new(vpcv1.ListImagesOptions) + listImagesOptionsModel.Start = core.StringPtr("testString") + listImagesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listImagesOptionsModel.Name = core.StringPtr("testString") + listImagesOptionsModel.Visibility = core.StringPtr("private") + listImagesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListImages(listImagesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListImages 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 ListImagesOptions model + listImagesOptionsModel := new(vpcv1.ListImagesOptions) + listImagesOptionsModel.Start = core.StringPtr("testString") + listImagesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listImagesOptionsModel.Name = core.StringPtr("testString") + listImagesOptionsModel.Visibility = core.StringPtr("private") + listImagesOptionsModel.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.ListImages(listImagesOptionsModel) + 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 ListImages 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 ListImagesOptions model + listImagesOptionsModel := new(vpcv1.ListImagesOptions) + listImagesOptionsModel.Start = core.StringPtr("testString") + listImagesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listImagesOptionsModel.Name = core.StringPtr("testString") + listImagesOptionsModel.Visibility = core.StringPtr("private") + listImagesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListImages(listImagesOptionsModel) + 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.ImageCollection) + nextObject := new(vpcv1.ImageCollectionNext) + 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.ImageCollection) + + 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.ImageCollection) + nextObject := new(vpcv1.ImageCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateImage(createImageOptions *CreateImageOptions) - Operation response error`, func() { + version := "testString" + createImagePath := "/images" + 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(createImagePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateImage 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the ImageFilePrototype model + imageFilePrototypeModel := new(vpcv1.ImageFilePrototype) + imageFilePrototypeModel.Href = core.StringPtr("cos://us-south/my-bucket/my-image.qcow2") + + // Construct an instance of the OperatingSystemIdentityByName model + operatingSystemIdentityModel := new(vpcv1.OperatingSystemIdentityByName) + operatingSystemIdentityModel.Name = core.StringPtr("debian-9-amd64") + + // Construct an instance of the ImagePrototypeImageByFile model + imagePrototypeModel := new(vpcv1.ImagePrototypeImageByFile) + imagePrototypeModel.Name = core.StringPtr("my-image") + imagePrototypeModel.ResourceGroup = resourceGroupIdentityModel + imagePrototypeModel.EncryptedDataKey = core.StringPtr("testString") + imagePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + imagePrototypeModel.File = imageFilePrototypeModel + imagePrototypeModel.OperatingSystem = operatingSystemIdentityModel + + // Construct an instance of the CreateImageOptions model + createImageOptionsModel := new(vpcv1.CreateImageOptions) + createImageOptionsModel.ImagePrototype = imagePrototypeModel + createImageOptionsModel.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.CreateImage(createImageOptionsModel) + 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.CreateImage(createImageOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateImage(createImageOptions *CreateImageOptions)`, func() { + version := "testString" + createImagePath := "/images" + 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(createImagePath)) + 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{"testString"})) + 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) + })) + }) + It(`Invoke CreateImage 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the ImageFilePrototype model + imageFilePrototypeModel := new(vpcv1.ImageFilePrototype) + imageFilePrototypeModel.Href = core.StringPtr("cos://us-south/my-bucket/my-image.qcow2") + + // Construct an instance of the OperatingSystemIdentityByName model + operatingSystemIdentityModel := new(vpcv1.OperatingSystemIdentityByName) + operatingSystemIdentityModel.Name = core.StringPtr("debian-9-amd64") + + // Construct an instance of the ImagePrototypeImageByFile model + imagePrototypeModel := new(vpcv1.ImagePrototypeImageByFile) + imagePrototypeModel.Name = core.StringPtr("my-image") + imagePrototypeModel.ResourceGroup = resourceGroupIdentityModel + imagePrototypeModel.EncryptedDataKey = core.StringPtr("testString") + imagePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + imagePrototypeModel.File = imageFilePrototypeModel + imagePrototypeModel.OperatingSystem = operatingSystemIdentityModel + + // Construct an instance of the CreateImageOptions model + createImageOptionsModel := new(vpcv1.CreateImageOptions) + createImageOptionsModel.ImagePrototype = imagePrototypeModel + createImageOptionsModel.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.CreateImageWithContext(ctx, createImageOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateImage(createImageOptionsModel) + 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.CreateImageWithContext(ctx, createImageOptionsModel) + 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(createImagePath)) + 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{"testString"})) + 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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) + })) + }) + It(`Invoke CreateImage 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.CreateImage(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 EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the ImageFilePrototype model + imageFilePrototypeModel := new(vpcv1.ImageFilePrototype) + imageFilePrototypeModel.Href = core.StringPtr("cos://us-south/my-bucket/my-image.qcow2") + + // Construct an instance of the OperatingSystemIdentityByName model + operatingSystemIdentityModel := new(vpcv1.OperatingSystemIdentityByName) + operatingSystemIdentityModel.Name = core.StringPtr("debian-9-amd64") + + // Construct an instance of the ImagePrototypeImageByFile model + imagePrototypeModel := new(vpcv1.ImagePrototypeImageByFile) + imagePrototypeModel.Name = core.StringPtr("my-image") + imagePrototypeModel.ResourceGroup = resourceGroupIdentityModel + imagePrototypeModel.EncryptedDataKey = core.StringPtr("testString") + imagePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + imagePrototypeModel.File = imageFilePrototypeModel + imagePrototypeModel.OperatingSystem = operatingSystemIdentityModel + + // Construct an instance of the CreateImageOptions model + createImageOptionsModel := new(vpcv1.CreateImageOptions) + createImageOptionsModel.ImagePrototype = imagePrototypeModel + createImageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateImage(createImageOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateImage 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 EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the ImageFilePrototype model + imageFilePrototypeModel := new(vpcv1.ImageFilePrototype) + imageFilePrototypeModel.Href = core.StringPtr("cos://us-south/my-bucket/my-image.qcow2") + + // Construct an instance of the OperatingSystemIdentityByName model + operatingSystemIdentityModel := new(vpcv1.OperatingSystemIdentityByName) + operatingSystemIdentityModel.Name = core.StringPtr("debian-9-amd64") + + // Construct an instance of the ImagePrototypeImageByFile model + imagePrototypeModel := new(vpcv1.ImagePrototypeImageByFile) + imagePrototypeModel.Name = core.StringPtr("my-image") + imagePrototypeModel.ResourceGroup = resourceGroupIdentityModel + imagePrototypeModel.EncryptedDataKey = core.StringPtr("testString") + imagePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + imagePrototypeModel.File = imageFilePrototypeModel + imagePrototypeModel.OperatingSystem = operatingSystemIdentityModel + + // Construct an instance of the CreateImageOptions model + createImageOptionsModel := new(vpcv1.CreateImageOptions) + createImageOptionsModel.ImagePrototype = imagePrototypeModel + createImageOptionsModel.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.CreateImage(createImageOptionsModel) + 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 CreateImageOptions model with no property values + createImageOptionsModelNew := new(vpcv1.CreateImageOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateImage(createImageOptionsModelNew) + 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 CreateImage 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") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the ImageFilePrototype model + imageFilePrototypeModel := new(vpcv1.ImageFilePrototype) + imageFilePrototypeModel.Href = core.StringPtr("cos://us-south/my-bucket/my-image.qcow2") + + // Construct an instance of the OperatingSystemIdentityByName model + operatingSystemIdentityModel := new(vpcv1.OperatingSystemIdentityByName) + operatingSystemIdentityModel.Name = core.StringPtr("debian-9-amd64") + + // Construct an instance of the ImagePrototypeImageByFile model + imagePrototypeModel := new(vpcv1.ImagePrototypeImageByFile) + imagePrototypeModel.Name = core.StringPtr("my-image") + imagePrototypeModel.ResourceGroup = resourceGroupIdentityModel + imagePrototypeModel.EncryptedDataKey = core.StringPtr("testString") + imagePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + imagePrototypeModel.File = imageFilePrototypeModel + imagePrototypeModel.OperatingSystem = operatingSystemIdentityModel + + // Construct an instance of the CreateImageOptions model + createImageOptionsModel := new(vpcv1.CreateImageOptions) + createImageOptionsModel.ImagePrototype = imagePrototypeModel + createImageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateImage(createImageOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteImage(deleteImageOptions *DeleteImageOptions)`, func() { + version := "testString" + deleteImagePath := "/images/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(deleteImagePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteImage 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.DeleteImage(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteImageOptions model + deleteImageOptionsModel := new(vpcv1.DeleteImageOptions) + deleteImageOptionsModel.ID = core.StringPtr("testString") + deleteImageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteImage(deleteImageOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteImage 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 DeleteImageOptions model + deleteImageOptionsModel := new(vpcv1.DeleteImageOptions) + deleteImageOptionsModel.ID = core.StringPtr("testString") + deleteImageOptionsModel.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.DeleteImage(deleteImageOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteImageOptions model with no property values + deleteImageOptionsModelNew := new(vpcv1.DeleteImageOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteImage(deleteImageOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetImage(getImageOptions *GetImageOptions) - Operation response error`, func() { + version := "testString" + getImagePath := "/images/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(getImagePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetImage 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 GetImageOptions model + getImageOptionsModel := new(vpcv1.GetImageOptions) + getImageOptionsModel.ID = core.StringPtr("testString") + getImageOptionsModel.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.GetImage(getImageOptionsModel) + 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.GetImage(getImageOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetImage(getImageOptions *GetImageOptions)`, func() { + version := "testString" + getImagePath := "/images/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(getImagePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) + })) + }) + It(`Invoke GetImage 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 GetImageOptions model + getImageOptionsModel := new(vpcv1.GetImageOptions) + getImageOptionsModel.ID = core.StringPtr("testString") + getImageOptionsModel.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.GetImageWithContext(ctx, getImageOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetImage(getImageOptionsModel) + 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.GetImageWithContext(ctx, getImageOptionsModel) + 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(getImagePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) + })) + }) + It(`Invoke GetImage 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.GetImage(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetImageOptions model + getImageOptionsModel := new(vpcv1.GetImageOptions) + getImageOptionsModel.ID = core.StringPtr("testString") + getImageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetImage(getImageOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetImage 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 GetImageOptions model + getImageOptionsModel := new(vpcv1.GetImageOptions) + getImageOptionsModel.ID = core.StringPtr("testString") + getImageOptionsModel.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.GetImage(getImageOptionsModel) + 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 GetImageOptions model with no property values + getImageOptionsModelNew := new(vpcv1.GetImageOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetImage(getImageOptionsModelNew) + 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 GetImage 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 GetImageOptions model + getImageOptionsModel := new(vpcv1.GetImageOptions) + getImageOptionsModel.ID = core.StringPtr("testString") + getImageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetImage(getImageOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateImage(updateImageOptions *UpdateImageOptions) - Operation response error`, func() { + version := "testString" + updateImagePath := "/images/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(updateImagePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateImage 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 ImagePatch model + imagePatchModel := new(vpcv1.ImagePatch) + imagePatchModel.Name = core.StringPtr("my-image") + imagePatchModelAsPatch, asPatchErr := imagePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateImageOptions model + updateImageOptionsModel := new(vpcv1.UpdateImageOptions) + updateImageOptionsModel.ID = core.StringPtr("testString") + updateImageOptionsModel.ImagePatch = imagePatchModelAsPatch + updateImageOptionsModel.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.UpdateImage(updateImageOptionsModel) + 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.UpdateImage(updateImageOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateImage(updateImageOptions *UpdateImageOptions)`, func() { + version := "testString" + updateImagePath := "/images/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(updateImagePath)) + 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{"testString"})) + 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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) + })) + }) + It(`Invoke UpdateImage 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 ImagePatch model + imagePatchModel := new(vpcv1.ImagePatch) + imagePatchModel.Name = core.StringPtr("my-image") + imagePatchModelAsPatch, asPatchErr := imagePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateImageOptions model + updateImageOptionsModel := new(vpcv1.UpdateImageOptions) + updateImageOptionsModel.ID = core.StringPtr("testString") + updateImageOptionsModel.ImagePatch = imagePatchModelAsPatch + updateImageOptionsModel.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.UpdateImageWithContext(ctx, updateImageOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateImage(updateImageOptionsModel) + 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.UpdateImageWithContext(ctx, updateImageOptionsModel) + 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(updateImagePath)) + 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{"testString"})) + 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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) + })) + }) + It(`Invoke UpdateImage 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.UpdateImage(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ImagePatch model + imagePatchModel := new(vpcv1.ImagePatch) + imagePatchModel.Name = core.StringPtr("my-image") + imagePatchModelAsPatch, asPatchErr := imagePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateImageOptions model + updateImageOptionsModel := new(vpcv1.UpdateImageOptions) + updateImageOptionsModel.ID = core.StringPtr("testString") + updateImageOptionsModel.ImagePatch = imagePatchModelAsPatch + updateImageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateImage(updateImageOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateImage 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 ImagePatch model + imagePatchModel := new(vpcv1.ImagePatch) + imagePatchModel.Name = core.StringPtr("my-image") + imagePatchModelAsPatch, asPatchErr := imagePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateImageOptions model + updateImageOptionsModel := new(vpcv1.UpdateImageOptions) + updateImageOptionsModel.ID = core.StringPtr("testString") + updateImageOptionsModel.ImagePatch = imagePatchModelAsPatch + updateImageOptionsModel.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.UpdateImage(updateImageOptionsModel) + 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 UpdateImageOptions model with no property values + updateImageOptionsModelNew := new(vpcv1.UpdateImageOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateImage(updateImageOptionsModelNew) + 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 UpdateImage 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 ImagePatch model + imagePatchModel := new(vpcv1.ImagePatch) + imagePatchModel.Name = core.StringPtr("my-image") + imagePatchModelAsPatch, asPatchErr := imagePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateImageOptions model + updateImageOptionsModel := new(vpcv1.UpdateImageOptions) + updateImageOptionsModel.ID = core.StringPtr("testString") + updateImageOptionsModel.ImagePatch = imagePatchModelAsPatch + updateImageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateImage(updateImageOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) - Operation response error`, func() { + version := "testString" + listOperatingSystemsPath := "/operating_systems" + 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(listOperatingSystemsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListOperatingSystems 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 ListOperatingSystemsOptions model + listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) + listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") + listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listOperatingSystemsOptionsModel.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.ListOperatingSystems(listOperatingSystemsOptionsModel) + 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.ListOperatingSystems(listOperatingSystemsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions)`, func() { + version := "testString" + listOperatingSystemsPath := "/operating_systems" + 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(listOperatingSystemsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/operating_systems?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "operating_systems": [{"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-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}]}`) + })) + }) + It(`Invoke ListOperatingSystems 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 ListOperatingSystemsOptions model + listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) + listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") + listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listOperatingSystemsOptionsModel.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.ListOperatingSystemsWithContext(ctx, listOperatingSystemsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListOperatingSystems(listOperatingSystemsOptionsModel) + 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.ListOperatingSystemsWithContext(ctx, listOperatingSystemsOptionsModel) + 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(listOperatingSystemsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/operating_systems?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "operating_systems": [{"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-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}]}`) + })) + }) + It(`Invoke ListOperatingSystems 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.ListOperatingSystems(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListOperatingSystemsOptions model + listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) + listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") + listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listOperatingSystemsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListOperatingSystems(listOperatingSystemsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListOperatingSystems 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 ListOperatingSystemsOptions model + listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) + listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") + listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listOperatingSystemsOptionsModel.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.ListOperatingSystems(listOperatingSystemsOptionsModel) + 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 ListOperatingSystems 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 ListOperatingSystemsOptions model + listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) + listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") + listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listOperatingSystemsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListOperatingSystems(listOperatingSystemsOptionsModel) + 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.OperatingSystemCollection) + nextObject := new(vpcv1.OperatingSystemCollectionNext) + 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.OperatingSystemCollection) + + 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.OperatingSystemCollection) + nextObject := new(vpcv1.OperatingSystemCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) - Operation response error`, func() { + version := "testString" + getOperatingSystemPath := "/operating_systems/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(getOperatingSystemPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetOperatingSystem 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 GetOperatingSystemOptions model + getOperatingSystemOptionsModel := new(vpcv1.GetOperatingSystemOptions) + getOperatingSystemOptionsModel.Name = core.StringPtr("testString") + getOperatingSystemOptionsModel.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.GetOperatingSystem(getOperatingSystemOptionsModel) + 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.GetOperatingSystem(getOperatingSystemOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions)`, func() { + version := "testString" + getOperatingSystemPath := "/operating_systems/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(getOperatingSystemPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}`) + })) + }) + It(`Invoke GetOperatingSystem 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 GetOperatingSystemOptions model + getOperatingSystemOptionsModel := new(vpcv1.GetOperatingSystemOptions) + getOperatingSystemOptionsModel.Name = core.StringPtr("testString") + getOperatingSystemOptionsModel.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.GetOperatingSystemWithContext(ctx, getOperatingSystemOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetOperatingSystem(getOperatingSystemOptionsModel) + 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.GetOperatingSystemWithContext(ctx, getOperatingSystemOptionsModel) + 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(getOperatingSystemPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}`) + })) + }) + It(`Invoke GetOperatingSystem 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.GetOperatingSystem(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetOperatingSystemOptions model + getOperatingSystemOptionsModel := new(vpcv1.GetOperatingSystemOptions) + getOperatingSystemOptionsModel.Name = core.StringPtr("testString") + getOperatingSystemOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetOperatingSystem(getOperatingSystemOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetOperatingSystem 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 GetOperatingSystemOptions model + getOperatingSystemOptionsModel := new(vpcv1.GetOperatingSystemOptions) + getOperatingSystemOptionsModel.Name = core.StringPtr("testString") + getOperatingSystemOptionsModel.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.GetOperatingSystem(getOperatingSystemOptionsModel) + 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 GetOperatingSystemOptions model with no property values + getOperatingSystemOptionsModelNew := new(vpcv1.GetOperatingSystemOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetOperatingSystem(getOperatingSystemOptionsModelNew) + 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 GetOperatingSystem 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 GetOperatingSystemOptions model + getOperatingSystemOptionsModel := new(vpcv1.GetOperatingSystemOptions) + getOperatingSystemOptionsModel.Name = core.StringPtr("testString") + getOperatingSystemOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetOperatingSystem(getOperatingSystemOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListKeys(listKeysOptions *ListKeysOptions) - Operation response error`, func() { + version := "testString" + listKeysPath := "/keys" + 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(listKeysPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListKeys 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 ListKeysOptions model + listKeysOptionsModel := new(vpcv1.ListKeysOptions) + listKeysOptionsModel.Start = core.StringPtr("testString") + listKeysOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) + 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.ListKeys(listKeysOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListKeys(listKeysOptions *ListKeysOptions)`, func() { + version := "testString" + listKeysPath := "/keys" + 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(listKeysPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/keys?limit=20"}, "keys": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/keys?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + })) + }) + It(`Invoke ListKeys 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 ListKeysOptions model + listKeysOptionsModel := new(vpcv1.ListKeysOptions) + listKeysOptionsModel.Start = core.StringPtr("testString") + listKeysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listKeysOptionsModel.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.ListKeysWithContext(ctx, listKeysOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListKeys(listKeysOptionsModel) + 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.ListKeysWithContext(ctx, listKeysOptionsModel) + 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(listKeysPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/keys?limit=20"}, "keys": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/keys?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) + })) + }) + It(`Invoke ListKeys 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.ListKeys(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListKeysOptions model + listKeysOptionsModel := new(vpcv1.ListKeysOptions) + listKeysOptionsModel.Start = core.StringPtr("testString") + listKeysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listKeysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListKeys(listKeysOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListKeys 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 ListKeysOptions model + listKeysOptionsModel := new(vpcv1.ListKeysOptions) + listKeysOptionsModel.Start = core.StringPtr("testString") + listKeysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listKeysOptionsModel.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.ListKeys(listKeysOptionsModel) + 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 ListKeys 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 ListKeysOptions model + listKeysOptionsModel := new(vpcv1.ListKeysOptions) + listKeysOptionsModel.Start = core.StringPtr("testString") + listKeysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listKeysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListKeys(listKeysOptionsModel) + 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.KeyCollection) + nextObject := new(vpcv1.KeyCollectionNext) + 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.KeyCollection) + + 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.KeyCollection) + nextObject := new(vpcv1.KeyCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateKey(createKeyOptions *CreateKeyOptions) - Operation response error`, func() { + version := "testString" + createKeyPath := "/keys" + 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(createKeyPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateKey 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateKeyOptions model + createKeyOptionsModel := new(vpcv1.CreateKeyOptions) + createKeyOptionsModel.PublicKey = core.StringPtr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En") + createKeyOptionsModel.Name = core.StringPtr("my-key") + createKeyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createKeyOptionsModel.Type = core.StringPtr("rsa") + createKeyOptionsModel.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.CreateKey(createKeyOptionsModel) + 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.CreateKey(createKeyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateKey(createKeyOptions *CreateKeyOptions)`, func() { + version := "testString" + createKeyPath := "/keys" + 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(createKeyPath)) + 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{"testString"})) + 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}`) + })) + }) + It(`Invoke CreateKey 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateKeyOptions model + createKeyOptionsModel := new(vpcv1.CreateKeyOptions) + createKeyOptionsModel.PublicKey = core.StringPtr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En") + createKeyOptionsModel.Name = core.StringPtr("my-key") + createKeyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createKeyOptionsModel.Type = core.StringPtr("rsa") + createKeyOptionsModel.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.CreateKeyWithContext(ctx, createKeyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateKey(createKeyOptionsModel) + 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.CreateKeyWithContext(ctx, createKeyOptionsModel) + 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(createKeyPath)) + 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{"testString"})) + 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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}`) + })) + }) + It(`Invoke CreateKey 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.CreateKey(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 CreateKeyOptions model + createKeyOptionsModel := new(vpcv1.CreateKeyOptions) + createKeyOptionsModel.PublicKey = core.StringPtr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En") + createKeyOptionsModel.Name = core.StringPtr("my-key") + createKeyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createKeyOptionsModel.Type = core.StringPtr("rsa") + createKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateKey(createKeyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateKey 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 CreateKeyOptions model + createKeyOptionsModel := new(vpcv1.CreateKeyOptions) + createKeyOptionsModel.PublicKey = core.StringPtr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En") + createKeyOptionsModel.Name = core.StringPtr("my-key") + createKeyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createKeyOptionsModel.Type = core.StringPtr("rsa") + createKeyOptionsModel.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.CreateKey(createKeyOptionsModel) + 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 CreateKeyOptions model with no property values + createKeyOptionsModelNew := new(vpcv1.CreateKeyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateKey(createKeyOptionsModelNew) + 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 CreateKey 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") + + // Construct an instance of the CreateKeyOptions model + createKeyOptionsModel := new(vpcv1.CreateKeyOptions) + createKeyOptionsModel.PublicKey = core.StringPtr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En") + createKeyOptionsModel.Name = core.StringPtr("my-key") + createKeyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createKeyOptionsModel.Type = core.StringPtr("rsa") + createKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateKey(createKeyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteKey(deleteKeyOptions *DeleteKeyOptions)`, func() { + version := "testString" + deleteKeyPath := "/keys/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(deleteKeyPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteKey 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.DeleteKey(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteKeyOptions model + deleteKeyOptionsModel := new(vpcv1.DeleteKeyOptions) + deleteKeyOptionsModel.ID = core.StringPtr("testString") + deleteKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteKey(deleteKeyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteKey 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 DeleteKeyOptions model + deleteKeyOptionsModel := new(vpcv1.DeleteKeyOptions) + deleteKeyOptionsModel.ID = core.StringPtr("testString") + deleteKeyOptionsModel.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.DeleteKey(deleteKeyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteKeyOptions model with no property values + deleteKeyOptionsModelNew := new(vpcv1.DeleteKeyOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteKey(deleteKeyOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetKey(getKeyOptions *GetKeyOptions) - Operation response error`, func() { + version := "testString" + getKeyPath := "/keys/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(getKeyPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetKey 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 GetKeyOptions model + getKeyOptionsModel := new(vpcv1.GetKeyOptions) + getKeyOptionsModel.ID = core.StringPtr("testString") + getKeyOptionsModel.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.GetKey(getKeyOptionsModel) + 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.GetKey(getKeyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetKey(getKeyOptions *GetKeyOptions)`, func() { + version := "testString" + getKeyPath := "/keys/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(getKeyPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}`) + })) + }) + It(`Invoke GetKey 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 GetKeyOptions model + getKeyOptionsModel := new(vpcv1.GetKeyOptions) + getKeyOptionsModel.ID = core.StringPtr("testString") + getKeyOptionsModel.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.GetKeyWithContext(ctx, getKeyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetKey(getKeyOptionsModel) + 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.GetKeyWithContext(ctx, getKeyOptionsModel) + 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(getKeyPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}`) + })) + }) + It(`Invoke GetKey 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.GetKey(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetKeyOptions model + getKeyOptionsModel := new(vpcv1.GetKeyOptions) + getKeyOptionsModel.ID = core.StringPtr("testString") + getKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetKey(getKeyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetKey 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 GetKeyOptions model + getKeyOptionsModel := new(vpcv1.GetKeyOptions) + getKeyOptionsModel.ID = core.StringPtr("testString") + getKeyOptionsModel.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.GetKey(getKeyOptionsModel) + 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 GetKeyOptions model with no property values + getKeyOptionsModelNew := new(vpcv1.GetKeyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetKey(getKeyOptionsModelNew) + 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 GetKey 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 GetKeyOptions model + getKeyOptionsModel := new(vpcv1.GetKeyOptions) + getKeyOptionsModel.ID = core.StringPtr("testString") + getKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetKey(getKeyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateKey(updateKeyOptions *UpdateKeyOptions) - Operation response error`, func() { + version := "testString" + updateKeyPath := "/keys/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(updateKeyPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateKey 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 KeyPatch model + keyPatchModel := new(vpcv1.KeyPatch) + keyPatchModel.Name = core.StringPtr("my-key") + keyPatchModelAsPatch, asPatchErr := keyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateKeyOptions model + updateKeyOptionsModel := new(vpcv1.UpdateKeyOptions) + updateKeyOptionsModel.ID = core.StringPtr("testString") + updateKeyOptionsModel.KeyPatch = keyPatchModelAsPatch + updateKeyOptionsModel.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.UpdateKey(updateKeyOptionsModel) + 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.UpdateKey(updateKeyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateKey(updateKeyOptions *UpdateKeyOptions)`, func() { + version := "testString" + updateKeyPath := "/keys/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(updateKeyPath)) + 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{"testString"})) + 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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}`) + })) + }) + It(`Invoke UpdateKey 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 KeyPatch model + keyPatchModel := new(vpcv1.KeyPatch) + keyPatchModel.Name = core.StringPtr("my-key") + keyPatchModelAsPatch, asPatchErr := keyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateKeyOptions model + updateKeyOptionsModel := new(vpcv1.UpdateKeyOptions) + updateKeyOptionsModel.ID = core.StringPtr("testString") + updateKeyOptionsModel.KeyPatch = keyPatchModelAsPatch + updateKeyOptionsModel.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.UpdateKeyWithContext(ctx, updateKeyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateKey(updateKeyOptionsModel) + 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.UpdateKeyWithContext(ctx, updateKeyOptionsModel) + 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(updateKeyPath)) + 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{"testString"})) + 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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}`) + })) + }) + It(`Invoke UpdateKey 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.UpdateKey(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the KeyPatch model + keyPatchModel := new(vpcv1.KeyPatch) + keyPatchModel.Name = core.StringPtr("my-key") + keyPatchModelAsPatch, asPatchErr := keyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateKeyOptions model + updateKeyOptionsModel := new(vpcv1.UpdateKeyOptions) + updateKeyOptionsModel.ID = core.StringPtr("testString") + updateKeyOptionsModel.KeyPatch = keyPatchModelAsPatch + updateKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateKey(updateKeyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateKey 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 KeyPatch model + keyPatchModel := new(vpcv1.KeyPatch) + keyPatchModel.Name = core.StringPtr("my-key") + keyPatchModelAsPatch, asPatchErr := keyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateKeyOptions model + updateKeyOptionsModel := new(vpcv1.UpdateKeyOptions) + updateKeyOptionsModel.ID = core.StringPtr("testString") + updateKeyOptionsModel.KeyPatch = keyPatchModelAsPatch + updateKeyOptionsModel.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.UpdateKey(updateKeyOptionsModel) + 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 UpdateKeyOptions model with no property values + updateKeyOptionsModelNew := new(vpcv1.UpdateKeyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateKey(updateKeyOptionsModelNew) + 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 UpdateKey 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 KeyPatch model + keyPatchModel := new(vpcv1.KeyPatch) + keyPatchModel.Name = core.StringPtr("my-key") + keyPatchModelAsPatch, asPatchErr := keyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateKeyOptions model + updateKeyOptionsModel := new(vpcv1.UpdateKeyOptions) + updateKeyOptionsModel.ID = core.StringPtr("testString") + updateKeyOptionsModel.KeyPatch = keyPatchModelAsPatch + updateKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateKey(updateKeyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) - Operation response error`, func() { + version := "testString" + listInstanceProfilesPath := "/instance/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(listInstanceProfilesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListInstanceProfiles 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 ListInstanceProfilesOptions model + listInstanceProfilesOptionsModel := new(vpcv1.ListInstanceProfilesOptions) + listInstanceProfilesOptionsModel.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.ListInstanceProfiles(listInstanceProfilesOptionsModel) + 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.ListInstanceProfiles(listInstanceProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions)`, func() { + version := "testString" + listInstanceProfilesPath := "/instance/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(listInstanceProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "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", "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}]}`) + })) + }) + It(`Invoke ListInstanceProfiles 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 ListInstanceProfilesOptions model + listInstanceProfilesOptionsModel := new(vpcv1.ListInstanceProfilesOptions) + listInstanceProfilesOptionsModel.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.ListInstanceProfilesWithContext(ctx, listInstanceProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListInstanceProfiles(listInstanceProfilesOptionsModel) + 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.ListInstanceProfilesWithContext(ctx, listInstanceProfilesOptionsModel) + 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(listInstanceProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "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", "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}]}`) + })) + }) + It(`Invoke ListInstanceProfiles 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.ListInstanceProfiles(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListInstanceProfilesOptions model + listInstanceProfilesOptionsModel := new(vpcv1.ListInstanceProfilesOptions) + listInstanceProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListInstanceProfiles(listInstanceProfilesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListInstanceProfiles 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 ListInstanceProfilesOptions model + listInstanceProfilesOptionsModel := new(vpcv1.ListInstanceProfilesOptions) + listInstanceProfilesOptionsModel.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.ListInstanceProfiles(listInstanceProfilesOptionsModel) + 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 ListInstanceProfiles 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 ListInstanceProfilesOptions model + listInstanceProfilesOptionsModel := new(vpcv1.ListInstanceProfilesOptions) + listInstanceProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListInstanceProfiles(listInstanceProfilesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) - Operation response error`, func() { + version := "testString" + getInstanceProfilePath := "/instance/profiles/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(getInstanceProfilePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetInstanceProfile 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 GetInstanceProfileOptions model + getInstanceProfileOptionsModel := new(vpcv1.GetInstanceProfileOptions) + getInstanceProfileOptionsModel.Name = core.StringPtr("testString") + getInstanceProfileOptionsModel.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.GetInstanceProfile(getInstanceProfileOptionsModel) + 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.GetInstanceProfile(getInstanceProfileOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions)`, func() { + version := "testString" + getInstanceProfilePath := "/instance/profiles/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(getInstanceProfilePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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}, "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", "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}`) + })) + }) + It(`Invoke GetInstanceProfile 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 GetInstanceProfileOptions model + getInstanceProfileOptionsModel := new(vpcv1.GetInstanceProfileOptions) + getInstanceProfileOptionsModel.Name = core.StringPtr("testString") + getInstanceProfileOptionsModel.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.GetInstanceProfileWithContext(ctx, getInstanceProfileOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetInstanceProfile(getInstanceProfileOptionsModel) + 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.GetInstanceProfileWithContext(ctx, getInstanceProfileOptionsModel) + 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(getInstanceProfilePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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}, "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", "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}`) + })) + }) + It(`Invoke GetInstanceProfile 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.GetInstanceProfile(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetInstanceProfileOptions model + getInstanceProfileOptionsModel := new(vpcv1.GetInstanceProfileOptions) + getInstanceProfileOptionsModel.Name = core.StringPtr("testString") + getInstanceProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetInstanceProfile(getInstanceProfileOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetInstanceProfile 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 GetInstanceProfileOptions model + getInstanceProfileOptionsModel := new(vpcv1.GetInstanceProfileOptions) + getInstanceProfileOptionsModel.Name = core.StringPtr("testString") + getInstanceProfileOptionsModel.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.GetInstanceProfile(getInstanceProfileOptionsModel) + 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 GetInstanceProfileOptions model with no property values + getInstanceProfileOptionsModelNew := new(vpcv1.GetInstanceProfileOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetInstanceProfile(getInstanceProfileOptionsModelNew) + 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 GetInstanceProfile 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 GetInstanceProfileOptions model + getInstanceProfileOptionsModel := new(vpcv1.GetInstanceProfileOptions) + getInstanceProfileOptionsModel.Name = core.StringPtr("testString") + getInstanceProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetInstanceProfile(getInstanceProfileOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) - Operation response error`, func() { + version := "testString" + listInstanceTemplatesPath := "/instance/templates" + 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(listInstanceTemplatesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListInstanceTemplates 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 ListInstanceTemplatesOptions model + listInstanceTemplatesOptionsModel := new(vpcv1.ListInstanceTemplatesOptions) + listInstanceTemplatesOptionsModel.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.ListInstanceTemplates(listInstanceTemplatesOptionsModel) + 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.ListInstanceTemplates(listInstanceTemplatesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions)`, func() { + version := "testString" + listInstanceTemplatesPath := "/instance/templates" + 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(listInstanceTemplatesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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": "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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}], "total_count": 132}`) + })) + }) + It(`Invoke ListInstanceTemplates 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 ListInstanceTemplatesOptions model + listInstanceTemplatesOptionsModel := new(vpcv1.ListInstanceTemplatesOptions) + listInstanceTemplatesOptionsModel.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.ListInstanceTemplatesWithContext(ctx, listInstanceTemplatesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListInstanceTemplates(listInstanceTemplatesOptionsModel) + 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.ListInstanceTemplatesWithContext(ctx, listInstanceTemplatesOptionsModel) + 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(listInstanceTemplatesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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": "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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}], "total_count": 132}`) + })) + }) + It(`Invoke ListInstanceTemplates 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.ListInstanceTemplates(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListInstanceTemplatesOptions model + listInstanceTemplatesOptionsModel := new(vpcv1.ListInstanceTemplatesOptions) + listInstanceTemplatesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListInstanceTemplates(listInstanceTemplatesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListInstanceTemplates 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 ListInstanceTemplatesOptions model + listInstanceTemplatesOptionsModel := new(vpcv1.ListInstanceTemplatesOptions) + listInstanceTemplatesOptionsModel.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.ListInstanceTemplates(listInstanceTemplatesOptionsModel) + 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 ListInstanceTemplates 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 ListInstanceTemplatesOptions model + listInstanceTemplatesOptionsModel := new(vpcv1.ListInstanceTemplatesOptions) + listInstanceTemplatesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListInstanceTemplates(listInstanceTemplatesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions) - Operation response error`, func() { + version := "testString" + createInstanceTemplatePath := "/instance/templates" + 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(createInstanceTemplatePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateInstanceTemplate 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 InstanceAvailabilityPrototype model + instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) + instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") + + // Construct an instance of the InstanceDefaultTrustedProfilePrototype model + instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) + instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) + instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") + + // Construct an instance of the InstanceMetadataServicePrototype model + instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) + instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) + + // 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 NetworkInterfacePrototype model + networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) + networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + networkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the InstanceProfileIdentityByName model + instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) + instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID model + volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) + volumeAttachmentVolumePrototypeInstanceContextModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model + volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) + volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("dc201ab2-8536-4904-86a8-084d84582133") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + + // Construct an instance of the VolumePrototypeInstanceByImageContext model + volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) + volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) + volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel + volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") + volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model + volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) + volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("3f9a2d96-830e-4100-9b4c-663225a3f872") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the InstanceTemplatePrototypeInstanceByImage model + instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceByImage) + instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel + instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel + instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + instanceTemplatePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel + instanceTemplatePrototypeModel.Name = core.StringPtr("my-instance-template") + instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} + instanceTemplatePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel + instanceTemplatePrototypeModel.Profile = instanceProfileIdentityModel + instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel + instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") + instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instanceTemplatePrototypeModel.VPC = vpcIdentityModel + instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel + instanceTemplatePrototypeModel.Image = imageIdentityModel + instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel + instanceTemplatePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateInstanceTemplateOptions model + createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) + createInstanceTemplateOptionsModel.InstanceTemplatePrototype = instanceTemplatePrototypeModel + createInstanceTemplateOptionsModel.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.CreateInstanceTemplate(createInstanceTemplateOptionsModel) + 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.CreateInstanceTemplate(createInstanceTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions)`, func() { + version := "testString" + createInstanceTemplatePath := "/instance/templates" + 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(createInstanceTemplatePath)) + 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{"testString"})) + 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", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateInstanceTemplate 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 InstanceAvailabilityPrototype model + instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) + instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") + + // Construct an instance of the InstanceDefaultTrustedProfilePrototype model + instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) + instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) + instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") + + // Construct an instance of the InstanceMetadataServicePrototype model + instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) + instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) + + // 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 NetworkInterfacePrototype model + networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) + networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + networkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the InstanceProfileIdentityByName model + instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) + instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID model + volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) + volumeAttachmentVolumePrototypeInstanceContextModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model + volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) + volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("dc201ab2-8536-4904-86a8-084d84582133") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + + // Construct an instance of the VolumePrototypeInstanceByImageContext model + volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) + volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) + volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel + volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") + volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model + volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) + volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("3f9a2d96-830e-4100-9b4c-663225a3f872") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the InstanceTemplatePrototypeInstanceByImage model + instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceByImage) + instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel + instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel + instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + instanceTemplatePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel + instanceTemplatePrototypeModel.Name = core.StringPtr("my-instance-template") + instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} + instanceTemplatePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel + instanceTemplatePrototypeModel.Profile = instanceProfileIdentityModel + instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel + instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") + instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instanceTemplatePrototypeModel.VPC = vpcIdentityModel + instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel + instanceTemplatePrototypeModel.Image = imageIdentityModel + instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel + instanceTemplatePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateInstanceTemplateOptions model + createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) + createInstanceTemplateOptionsModel.InstanceTemplatePrototype = instanceTemplatePrototypeModel + createInstanceTemplateOptionsModel.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.CreateInstanceTemplateWithContext(ctx, createInstanceTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateInstanceTemplate(createInstanceTemplateOptionsModel) + 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.CreateInstanceTemplateWithContext(ctx, createInstanceTemplateOptionsModel) + 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(createInstanceTemplatePath)) + 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{"testString"})) + 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", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateInstanceTemplate 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.CreateInstanceTemplate(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the InstanceAvailabilityPrototype model + instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) + instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") + + // Construct an instance of the InstanceDefaultTrustedProfilePrototype model + instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) + instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) + instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") + + // Construct an instance of the InstanceMetadataServicePrototype model + instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) + instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) + + // 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 NetworkInterfacePrototype model + networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) + networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + networkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the InstanceProfileIdentityByName model + instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) + instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID model + volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) + volumeAttachmentVolumePrototypeInstanceContextModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model + volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) + volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("dc201ab2-8536-4904-86a8-084d84582133") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + + // Construct an instance of the VolumePrototypeInstanceByImageContext model + volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) + volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) + volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel + volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") + volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model + volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) + volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("3f9a2d96-830e-4100-9b4c-663225a3f872") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the InstanceTemplatePrototypeInstanceByImage model + instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceByImage) + instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel + instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel + instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + instanceTemplatePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel + instanceTemplatePrototypeModel.Name = core.StringPtr("my-instance-template") + instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} + instanceTemplatePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel + instanceTemplatePrototypeModel.Profile = instanceProfileIdentityModel + instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel + instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") + instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instanceTemplatePrototypeModel.VPC = vpcIdentityModel + instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel + instanceTemplatePrototypeModel.Image = imageIdentityModel + instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel + instanceTemplatePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateInstanceTemplateOptions model + createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) + createInstanceTemplateOptionsModel.InstanceTemplatePrototype = instanceTemplatePrototypeModel + createInstanceTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateInstanceTemplate(createInstanceTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateInstanceTemplate 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 InstanceAvailabilityPrototype model + instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) + instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") + + // Construct an instance of the InstanceDefaultTrustedProfilePrototype model + instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) + instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) + instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") + + // Construct an instance of the InstanceMetadataServicePrototype model + instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) + instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) + + // 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 NetworkInterfacePrototype model + networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) + networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + networkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the InstanceProfileIdentityByName model + instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) + instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID model + volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) + volumeAttachmentVolumePrototypeInstanceContextModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model + volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) + volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("dc201ab2-8536-4904-86a8-084d84582133") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + + // Construct an instance of the VolumePrototypeInstanceByImageContext model + volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) + volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) + volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel + volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") + volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model + volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) + volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("3f9a2d96-830e-4100-9b4c-663225a3f872") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the InstanceTemplatePrototypeInstanceByImage model + instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceByImage) + instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel + instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel + instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + instanceTemplatePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel + instanceTemplatePrototypeModel.Name = core.StringPtr("my-instance-template") + instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} + instanceTemplatePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel + instanceTemplatePrototypeModel.Profile = instanceProfileIdentityModel + instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel + instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") + instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instanceTemplatePrototypeModel.VPC = vpcIdentityModel + instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel + instanceTemplatePrototypeModel.Image = imageIdentityModel + instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel + instanceTemplatePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateInstanceTemplateOptions model + createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) + createInstanceTemplateOptionsModel.InstanceTemplatePrototype = instanceTemplatePrototypeModel + createInstanceTemplateOptionsModel.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.CreateInstanceTemplate(createInstanceTemplateOptionsModel) + 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 CreateInstanceTemplateOptions model with no property values + createInstanceTemplateOptionsModelNew := new(vpcv1.CreateInstanceTemplateOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateInstanceTemplate(createInstanceTemplateOptionsModelNew) + 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 CreateInstanceTemplate 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 InstanceAvailabilityPrototype model + instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) + instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") + + // Construct an instance of the InstanceDefaultTrustedProfilePrototype model + instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) + instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) + instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") + + // Construct an instance of the InstanceMetadataServicePrototype model + instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) + instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) + + // 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 NetworkInterfacePrototype model + networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) + networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + networkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the InstanceProfileIdentityByName model + instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) + instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID model + volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) + volumeAttachmentVolumePrototypeInstanceContextModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model + volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) + volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("dc201ab2-8536-4904-86a8-084d84582133") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + + // Construct an instance of the VolumePrototypeInstanceByImageContext model + volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) + volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) + volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel + volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") + volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model + volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) + volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("3f9a2d96-830e-4100-9b4c-663225a3f872") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the InstanceTemplatePrototypeInstanceByImage model + instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceByImage) + instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel + instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel + instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + instanceTemplatePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel + instanceTemplatePrototypeModel.Name = core.StringPtr("my-instance-template") + instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} + instanceTemplatePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel + instanceTemplatePrototypeModel.Profile = instanceProfileIdentityModel + instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel + instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") + instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instanceTemplatePrototypeModel.VPC = vpcIdentityModel + instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel + instanceTemplatePrototypeModel.Image = imageIdentityModel + instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel + instanceTemplatePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateInstanceTemplateOptions model + createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) + createInstanceTemplateOptionsModel.InstanceTemplatePrototype = instanceTemplatePrototypeModel + createInstanceTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateInstanceTemplate(createInstanceTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions)`, func() { + version := "testString" + deleteInstanceTemplatePath := "/instance/templates/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(deleteInstanceTemplatePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteInstanceTemplate 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.DeleteInstanceTemplate(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteInstanceTemplateOptions model + deleteInstanceTemplateOptionsModel := new(vpcv1.DeleteInstanceTemplateOptions) + deleteInstanceTemplateOptionsModel.ID = core.StringPtr("testString") + deleteInstanceTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteInstanceTemplate(deleteInstanceTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteInstanceTemplate 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 DeleteInstanceTemplateOptions model + deleteInstanceTemplateOptionsModel := new(vpcv1.DeleteInstanceTemplateOptions) + deleteInstanceTemplateOptionsModel.ID = core.StringPtr("testString") + deleteInstanceTemplateOptionsModel.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.DeleteInstanceTemplate(deleteInstanceTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteInstanceTemplateOptions model with no property values + deleteInstanceTemplateOptionsModelNew := new(vpcv1.DeleteInstanceTemplateOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteInstanceTemplate(deleteInstanceTemplateOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) - Operation response error`, func() { + version := "testString" + getInstanceTemplatePath := "/instance/templates/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(getInstanceTemplatePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetInstanceTemplate 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 GetInstanceTemplateOptions model + getInstanceTemplateOptionsModel := new(vpcv1.GetInstanceTemplateOptions) + getInstanceTemplateOptionsModel.ID = core.StringPtr("testString") + getInstanceTemplateOptionsModel.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.GetInstanceTemplate(getInstanceTemplateOptionsModel) + 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.GetInstanceTemplate(getInstanceTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions)`, func() { + version := "testString" + getInstanceTemplatePath := "/instance/templates/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(getInstanceTemplatePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + })) + }) + It(`Invoke GetInstanceTemplate 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 GetInstanceTemplateOptions model + getInstanceTemplateOptionsModel := new(vpcv1.GetInstanceTemplateOptions) + getInstanceTemplateOptionsModel.ID = core.StringPtr("testString") + getInstanceTemplateOptionsModel.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.GetInstanceTemplateWithContext(ctx, getInstanceTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetInstanceTemplate(getInstanceTemplateOptionsModel) + 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.GetInstanceTemplateWithContext(ctx, getInstanceTemplateOptionsModel) + 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(getInstanceTemplatePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + })) + }) + It(`Invoke GetInstanceTemplate 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.GetInstanceTemplate(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetInstanceTemplateOptions model + getInstanceTemplateOptionsModel := new(vpcv1.GetInstanceTemplateOptions) + getInstanceTemplateOptionsModel.ID = core.StringPtr("testString") + getInstanceTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetInstanceTemplate(getInstanceTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetInstanceTemplate 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 GetInstanceTemplateOptions model + getInstanceTemplateOptionsModel := new(vpcv1.GetInstanceTemplateOptions) + getInstanceTemplateOptionsModel.ID = core.StringPtr("testString") + getInstanceTemplateOptionsModel.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.GetInstanceTemplate(getInstanceTemplateOptionsModel) + 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 GetInstanceTemplateOptions model with no property values + getInstanceTemplateOptionsModelNew := new(vpcv1.GetInstanceTemplateOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetInstanceTemplate(getInstanceTemplateOptionsModelNew) + 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 GetInstanceTemplate 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 GetInstanceTemplateOptions model + getInstanceTemplateOptionsModel := new(vpcv1.GetInstanceTemplateOptions) + getInstanceTemplateOptionsModel.ID = core.StringPtr("testString") + getInstanceTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetInstanceTemplate(getInstanceTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) - Operation response error`, func() { + version := "testString" + updateInstanceTemplatePath := "/instance/templates/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(updateInstanceTemplatePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateInstanceTemplate 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 InstanceTemplatePatch model + instanceTemplatePatchModel := new(vpcv1.InstanceTemplatePatch) + instanceTemplatePatchModel.Name = core.StringPtr("my-instance-template") + instanceTemplatePatchModelAsPatch, asPatchErr := instanceTemplatePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceTemplateOptions model + updateInstanceTemplateOptionsModel := new(vpcv1.UpdateInstanceTemplateOptions) + updateInstanceTemplateOptionsModel.ID = core.StringPtr("testString") + updateInstanceTemplateOptionsModel.InstanceTemplatePatch = instanceTemplatePatchModelAsPatch + updateInstanceTemplateOptionsModel.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.UpdateInstanceTemplate(updateInstanceTemplateOptionsModel) + 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.UpdateInstanceTemplate(updateInstanceTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions)`, func() { + version := "testString" + updateInstanceTemplatePath := "/instance/templates/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(updateInstanceTemplatePath)) + 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{"testString"})) + 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", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateInstanceTemplate 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 InstanceTemplatePatch model + instanceTemplatePatchModel := new(vpcv1.InstanceTemplatePatch) + instanceTemplatePatchModel.Name = core.StringPtr("my-instance-template") + instanceTemplatePatchModelAsPatch, asPatchErr := instanceTemplatePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceTemplateOptions model + updateInstanceTemplateOptionsModel := new(vpcv1.UpdateInstanceTemplateOptions) + updateInstanceTemplateOptionsModel.ID = core.StringPtr("testString") + updateInstanceTemplateOptionsModel.InstanceTemplatePatch = instanceTemplatePatchModelAsPatch + updateInstanceTemplateOptionsModel.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.UpdateInstanceTemplateWithContext(ctx, updateInstanceTemplateOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateInstanceTemplate(updateInstanceTemplateOptionsModel) + 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.UpdateInstanceTemplateWithContext(ctx, updateInstanceTemplateOptionsModel) + 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(updateInstanceTemplatePath)) + 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{"testString"})) + 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", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateInstanceTemplate 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.UpdateInstanceTemplate(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the InstanceTemplatePatch model + instanceTemplatePatchModel := new(vpcv1.InstanceTemplatePatch) + instanceTemplatePatchModel.Name = core.StringPtr("my-instance-template") + instanceTemplatePatchModelAsPatch, asPatchErr := instanceTemplatePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceTemplateOptions model + updateInstanceTemplateOptionsModel := new(vpcv1.UpdateInstanceTemplateOptions) + updateInstanceTemplateOptionsModel.ID = core.StringPtr("testString") + updateInstanceTemplateOptionsModel.InstanceTemplatePatch = instanceTemplatePatchModelAsPatch + updateInstanceTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateInstanceTemplate(updateInstanceTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateInstanceTemplate 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 InstanceTemplatePatch model + instanceTemplatePatchModel := new(vpcv1.InstanceTemplatePatch) + instanceTemplatePatchModel.Name = core.StringPtr("my-instance-template") + instanceTemplatePatchModelAsPatch, asPatchErr := instanceTemplatePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceTemplateOptions model + updateInstanceTemplateOptionsModel := new(vpcv1.UpdateInstanceTemplateOptions) + updateInstanceTemplateOptionsModel.ID = core.StringPtr("testString") + updateInstanceTemplateOptionsModel.InstanceTemplatePatch = instanceTemplatePatchModelAsPatch + updateInstanceTemplateOptionsModel.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.UpdateInstanceTemplate(updateInstanceTemplateOptionsModel) + 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 UpdateInstanceTemplateOptions model with no property values + updateInstanceTemplateOptionsModelNew := new(vpcv1.UpdateInstanceTemplateOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateInstanceTemplate(updateInstanceTemplateOptionsModelNew) + 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 UpdateInstanceTemplate 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 InstanceTemplatePatch model + instanceTemplatePatchModel := new(vpcv1.InstanceTemplatePatch) + instanceTemplatePatchModel.Name = core.StringPtr("my-instance-template") + instanceTemplatePatchModelAsPatch, asPatchErr := instanceTemplatePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceTemplateOptions model + updateInstanceTemplateOptionsModel := new(vpcv1.UpdateInstanceTemplateOptions) + updateInstanceTemplateOptionsModel.ID = core.StringPtr("testString") + updateInstanceTemplateOptionsModel.InstanceTemplatePatch = instanceTemplatePatchModelAsPatch + updateInstanceTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateInstanceTemplate(updateInstanceTemplateOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstances(listInstancesOptions *ListInstancesOptions) - Operation response error`, func() { + version := "testString" + listInstancesPath := "/instances" + 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(listInstancesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["dedicated_host.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["dedicated_host.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["dedicated_host.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["placement_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["placement_group.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["placement_group.name"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListInstances 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 ListInstancesOptions model + listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) + listInstancesOptionsModel.Start = core.StringPtr("testString") + listInstancesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listInstancesOptionsModel.Name = core.StringPtr("testString") + listInstancesOptionsModel.VPCID = core.StringPtr("testString") + listInstancesOptionsModel.VPCCRN = core.StringPtr("testString") + listInstancesOptionsModel.VPCName = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostName = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupID = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupCRN = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupName = core.StringPtr("testString") + listInstancesOptionsModel.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.ListInstances(listInstancesOptionsModel) + 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.ListInstances(listInstancesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstances(listInstancesOptions *ListInstancesOptions)`, func() { + version := "testString" + listInstancesPath := "/instances" + 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(listInstancesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["dedicated_host.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["dedicated_host.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["dedicated_host.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["placement_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["placement_group.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["placement_group.name"]).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/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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) + })) + }) + It(`Invoke ListInstances 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 ListInstancesOptions model + listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) + listInstancesOptionsModel.Start = core.StringPtr("testString") + listInstancesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listInstancesOptionsModel.Name = core.StringPtr("testString") + listInstancesOptionsModel.VPCID = core.StringPtr("testString") + listInstancesOptionsModel.VPCCRN = core.StringPtr("testString") + listInstancesOptionsModel.VPCName = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostName = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupID = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupCRN = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupName = core.StringPtr("testString") + listInstancesOptionsModel.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.ListInstancesWithContext(ctx, listInstancesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListInstances(listInstancesOptionsModel) + 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.ListInstancesWithContext(ctx, listInstancesOptionsModel) + 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(listInstancesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["dedicated_host.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["dedicated_host.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["dedicated_host.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["placement_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["placement_group.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["placement_group.name"]).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/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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) + })) + }) + It(`Invoke ListInstances 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.ListInstances(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListInstancesOptions model + listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) + listInstancesOptionsModel.Start = core.StringPtr("testString") + listInstancesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listInstancesOptionsModel.Name = core.StringPtr("testString") + listInstancesOptionsModel.VPCID = core.StringPtr("testString") + listInstancesOptionsModel.VPCCRN = core.StringPtr("testString") + listInstancesOptionsModel.VPCName = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostName = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupID = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupCRN = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupName = core.StringPtr("testString") + listInstancesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListInstances(listInstancesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListInstances 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 ListInstancesOptions model + listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) + listInstancesOptionsModel.Start = core.StringPtr("testString") + listInstancesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listInstancesOptionsModel.Name = core.StringPtr("testString") + listInstancesOptionsModel.VPCID = core.StringPtr("testString") + listInstancesOptionsModel.VPCCRN = core.StringPtr("testString") + listInstancesOptionsModel.VPCName = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostName = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupID = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupCRN = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupName = core.StringPtr("testString") + listInstancesOptionsModel.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.ListInstances(listInstancesOptionsModel) + 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 ListInstances 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 ListInstancesOptions model + listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) + listInstancesOptionsModel.Start = core.StringPtr("testString") + listInstancesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listInstancesOptionsModel.Name = core.StringPtr("testString") + listInstancesOptionsModel.VPCID = core.StringPtr("testString") + listInstancesOptionsModel.VPCCRN = core.StringPtr("testString") + listInstancesOptionsModel.VPCName = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("testString") + listInstancesOptionsModel.DedicatedHostName = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupID = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupCRN = core.StringPtr("testString") + listInstancesOptionsModel.PlacementGroupName = core.StringPtr("testString") + listInstancesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListInstances(listInstancesOptionsModel) + 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.InstanceCollection) + nextObject := new(vpcv1.InstanceCollectionNext) + 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.InstanceCollection) + + 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.InstanceCollection) + nextObject := new(vpcv1.InstanceCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateInstance(createInstanceOptions *CreateInstanceOptions) - Operation response error`, func() { + version := "testString" + createInstancePath := "/instances" + 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(createInstancePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateInstance 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 InstanceAvailabilityPrototype model + instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) + instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") + + // Construct an instance of the InstanceDefaultTrustedProfilePrototype model + instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) + instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) + instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") + + // Construct an instance of the InstanceMetadataServicePrototype model + instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) + instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) + + // 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 NetworkInterfacePrototype model + networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) + networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + networkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPrototypeModel.ID = core.StringPtr("0787-8c2a09be-ee18-4af2-8ef4-6a6060732221") + + // Construct an instance of the InstanceProfileIdentityByName model + instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) + instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") + + // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model + volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) + volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") + volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel + volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) + volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model + volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) + volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") + + // Construct an instance of the VolumePrototypeInstanceByImageContext model + volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) + volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) + volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel + volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") + volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model + volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) + volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("9aaf3bcb-dcd7-4de7-bb60-24e39ff9d366") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the InstancePrototypeInstanceByImage model + instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) + instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel + instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel + instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + instancePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel + instancePrototypeModel.Name = core.StringPtr("my-instance") + instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} + instancePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel + instancePrototypeModel.Profile = instanceProfileIdentityModel + instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel + instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instancePrototypeModel.UserData = core.StringPtr("testString") + instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instancePrototypeModel.VPC = vpcIdentityModel + instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel + instancePrototypeModel.Image = imageIdentityModel + instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel + instancePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateInstanceOptions model + createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) + createInstanceOptionsModel.InstancePrototype = instancePrototypeModel + createInstanceOptionsModel.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.CreateInstance(createInstanceOptionsModel) + 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.CreateInstance(createInstanceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstance(createInstanceOptions *CreateInstanceOptions)`, func() { + version := "testString" + createInstancePath := "/instances" + 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(createInstancePath)) + 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{"testString"})) + 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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 InstanceAvailabilityPrototype model + instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) + instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") + + // Construct an instance of the InstanceDefaultTrustedProfilePrototype model + instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) + instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) + instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") + + // Construct an instance of the InstanceMetadataServicePrototype model + instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) + instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) + + // 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 NetworkInterfacePrototype model + networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) + networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + networkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPrototypeModel.ID = core.StringPtr("0787-8c2a09be-ee18-4af2-8ef4-6a6060732221") + + // Construct an instance of the InstanceProfileIdentityByName model + instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) + instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") + + // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model + volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) + volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") + volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel + volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) + volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model + volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) + volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") + + // Construct an instance of the VolumePrototypeInstanceByImageContext model + volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) + volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) + volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel + volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") + volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model + volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) + volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("9aaf3bcb-dcd7-4de7-bb60-24e39ff9d366") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the InstancePrototypeInstanceByImage model + instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) + instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel + instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel + instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + instancePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel + instancePrototypeModel.Name = core.StringPtr("my-instance") + instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} + instancePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel + instancePrototypeModel.Profile = instanceProfileIdentityModel + instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel + instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instancePrototypeModel.UserData = core.StringPtr("testString") + instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instancePrototypeModel.VPC = vpcIdentityModel + instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel + instancePrototypeModel.Image = imageIdentityModel + instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel + instancePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateInstanceOptions model + createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) + createInstanceOptionsModel.InstancePrototype = instancePrototypeModel + createInstanceOptionsModel.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.CreateInstanceWithContext(ctx, createInstanceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateInstance(createInstanceOptionsModel) + 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.CreateInstanceWithContext(ctx, createInstanceOptionsModel) + 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(createInstancePath)) + 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{"testString"})) + 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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.CreateInstance(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the InstanceAvailabilityPrototype model + instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) + instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") + + // Construct an instance of the InstanceDefaultTrustedProfilePrototype model + instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) + instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) + instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") + + // Construct an instance of the InstanceMetadataServicePrototype model + instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) + instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) + + // 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 NetworkInterfacePrototype model + networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) + networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + networkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPrototypeModel.ID = core.StringPtr("0787-8c2a09be-ee18-4af2-8ef4-6a6060732221") + + // Construct an instance of the InstanceProfileIdentityByName model + instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) + instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") + + // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model + volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) + volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") + volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel + volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) + volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model + volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) + volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") + + // Construct an instance of the VolumePrototypeInstanceByImageContext model + volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) + volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) + volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel + volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") + volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model + volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) + volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("9aaf3bcb-dcd7-4de7-bb60-24e39ff9d366") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the InstancePrototypeInstanceByImage model + instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) + instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel + instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel + instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + instancePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel + instancePrototypeModel.Name = core.StringPtr("my-instance") + instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} + instancePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel + instancePrototypeModel.Profile = instanceProfileIdentityModel + instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel + instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instancePrototypeModel.UserData = core.StringPtr("testString") + instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instancePrototypeModel.VPC = vpcIdentityModel + instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel + instancePrototypeModel.Image = imageIdentityModel + instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel + instancePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateInstanceOptions model + createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) + createInstanceOptionsModel.InstancePrototype = instancePrototypeModel + createInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateInstance(createInstanceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateInstance 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 InstanceAvailabilityPrototype model + instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) + instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") + + // Construct an instance of the InstanceDefaultTrustedProfilePrototype model + instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) + instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) + instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") + + // Construct an instance of the InstanceMetadataServicePrototype model + instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) + instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) + + // 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 NetworkInterfacePrototype model + networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) + networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + networkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPrototypeModel.ID = core.StringPtr("0787-8c2a09be-ee18-4af2-8ef4-6a6060732221") + + // Construct an instance of the InstanceProfileIdentityByName model + instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) + instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") + + // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model + volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) + volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") + volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel + volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) + volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model + volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) + volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") + + // Construct an instance of the VolumePrototypeInstanceByImageContext model + volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) + volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) + volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel + volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") + volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model + volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) + volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("9aaf3bcb-dcd7-4de7-bb60-24e39ff9d366") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the InstancePrototypeInstanceByImage model + instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) + instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel + instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel + instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + instancePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel + instancePrototypeModel.Name = core.StringPtr("my-instance") + instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} + instancePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel + instancePrototypeModel.Profile = instanceProfileIdentityModel + instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel + instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instancePrototypeModel.UserData = core.StringPtr("testString") + instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instancePrototypeModel.VPC = vpcIdentityModel + instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel + instancePrototypeModel.Image = imageIdentityModel + instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel + instancePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateInstanceOptions model + createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) + createInstanceOptionsModel.InstancePrototype = instancePrototypeModel + createInstanceOptionsModel.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.CreateInstance(createInstanceOptionsModel) + 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 CreateInstanceOptions model with no property values + createInstanceOptionsModelNew := new(vpcv1.CreateInstanceOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateInstance(createInstanceOptionsModelNew) + 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 CreateInstance 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 InstanceAvailabilityPrototype model + instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) + instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") + + // Construct an instance of the InstanceDefaultTrustedProfilePrototype model + instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) + instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) + instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") + + // Construct an instance of the InstanceMetadataServicePrototype model + instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) + instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) + + // 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 NetworkInterfacePrototype model + networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) + networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + networkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPrototypeModel.ID = core.StringPtr("0787-8c2a09be-ee18-4af2-8ef4-6a6060732221") + + // Construct an instance of the InstanceProfileIdentityByName model + instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) + instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") + + // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model + volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) + volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") + volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel + volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) + volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model + volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) + volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") + + // Construct an instance of the VolumePrototypeInstanceByImageContext model + volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) + volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) + volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel + volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") + volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + + // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model + volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) + volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + imageIdentityModel.ID = core.StringPtr("9aaf3bcb-dcd7-4de7-bb60-24e39ff9d366") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the InstancePrototypeInstanceByImage model + instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) + instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel + instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel + instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + instancePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel + instancePrototypeModel.Name = core.StringPtr("my-instance") + instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} + instancePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel + instancePrototypeModel.Profile = instanceProfileIdentityModel + instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel + instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instancePrototypeModel.UserData = core.StringPtr("testString") + instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instancePrototypeModel.VPC = vpcIdentityModel + instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel + instancePrototypeModel.Image = imageIdentityModel + instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel + instancePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateInstanceOptions model + createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) + createInstanceOptionsModel.InstancePrototype = instancePrototypeModel + createInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateInstance(createInstanceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions)`, func() { + version := "testString" + deleteInstancePath := "/instances/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(deleteInstancePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteInstance 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.DeleteInstance(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteInstanceOptions model + deleteInstanceOptionsModel := new(vpcv1.DeleteInstanceOptions) + deleteInstanceOptionsModel.ID = core.StringPtr("testString") + deleteInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteInstance(deleteInstanceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteInstance 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 DeleteInstanceOptions model + deleteInstanceOptionsModel := new(vpcv1.DeleteInstanceOptions) + deleteInstanceOptionsModel.ID = core.StringPtr("testString") + deleteInstanceOptionsModel.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.DeleteInstance(deleteInstanceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteInstanceOptions model with no property values + deleteInstanceOptionsModelNew := new(vpcv1.DeleteInstanceOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteInstance(deleteInstanceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstance(getInstanceOptions *GetInstanceOptions) - Operation response error`, func() { + version := "testString" + getInstancePath := "/instances/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(getInstancePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetInstance 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 GetInstanceOptions model + getInstanceOptionsModel := new(vpcv1.GetInstanceOptions) + getInstanceOptionsModel.ID = core.StringPtr("testString") + getInstanceOptionsModel.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.GetInstance(getInstanceOptionsModel) + 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.GetInstance(getInstanceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstance(getInstanceOptions *GetInstanceOptions)`, func() { + version := "testString" + getInstancePath := "/instances/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(getInstancePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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 GetInstanceOptions model + getInstanceOptionsModel := new(vpcv1.GetInstanceOptions) + getInstanceOptionsModel.ID = core.StringPtr("testString") + getInstanceOptionsModel.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.GetInstanceWithContext(ctx, getInstanceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetInstance(getInstanceOptionsModel) + 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.GetInstanceWithContext(ctx, getInstanceOptionsModel) + 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(getInstancePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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.GetInstance(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetInstanceOptions model + getInstanceOptionsModel := new(vpcv1.GetInstanceOptions) + getInstanceOptionsModel.ID = core.StringPtr("testString") + getInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetInstance(getInstanceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetInstance 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 GetInstanceOptions model + getInstanceOptionsModel := new(vpcv1.GetInstanceOptions) + getInstanceOptionsModel.ID = core.StringPtr("testString") + getInstanceOptionsModel.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.GetInstance(getInstanceOptionsModel) + 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 GetInstanceOptions model with no property values + getInstanceOptionsModelNew := new(vpcv1.GetInstanceOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetInstance(getInstanceOptionsModelNew) + 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 GetInstance 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 GetInstanceOptions model + getInstanceOptionsModel := new(vpcv1.GetInstanceOptions) + getInstanceOptionsModel.ID = core.StringPtr("testString") + getInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetInstance(getInstanceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) - Operation response error`, func() { + version := "testString" + updateInstancePath := "/instances/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(updateInstancePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateInstance 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 InstanceAvailabilityPolicyPatch model + instanceAvailabilityPolicyPatchModel := new(vpcv1.InstanceAvailabilityPolicyPatch) + instanceAvailabilityPolicyPatchModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the InstanceMetadataServicePatch model + instanceMetadataServicePatchModel := new(vpcv1.InstanceMetadataServicePatch) + instanceMetadataServicePatchModel.Enabled = core.BoolPtr(true) + + // Construct an instance of the InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPatchModel := new(vpcv1.InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPatchModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the InstancePatchProfileInstanceProfileIdentityByName model + instancePatchProfileModel := new(vpcv1.InstancePatchProfileInstanceProfileIdentityByName) + instancePatchProfileModel.Name = core.StringPtr("bx2-4x16") + + // Construct an instance of the InstancePatch model + instancePatchModel := new(vpcv1.InstancePatch) + instancePatchModel.AvailabilityPolicy = instanceAvailabilityPolicyPatchModel + instancePatchModel.MetadataService = instanceMetadataServicePatchModel + instancePatchModel.Name = core.StringPtr("my-instance") + instancePatchModel.PlacementTarget = instancePlacementTargetPatchModel + instancePatchModel.Profile = instancePatchProfileModel + instancePatchModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instancePatchModelAsPatch, asPatchErr := instancePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceOptions model + updateInstanceOptionsModel := new(vpcv1.UpdateInstanceOptions) + updateInstanceOptionsModel.ID = core.StringPtr("testString") + updateInstanceOptionsModel.InstancePatch = instancePatchModelAsPatch + updateInstanceOptionsModel.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.UpdateInstance(updateInstanceOptionsModel) + 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.UpdateInstance(updateInstanceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstance(updateInstanceOptions *UpdateInstanceOptions)`, func() { + version := "testString" + updateInstancePath := "/instances/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(updateInstancePath)) + 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{"testString"})) + 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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 InstanceAvailabilityPolicyPatch model + instanceAvailabilityPolicyPatchModel := new(vpcv1.InstanceAvailabilityPolicyPatch) + instanceAvailabilityPolicyPatchModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the InstanceMetadataServicePatch model + instanceMetadataServicePatchModel := new(vpcv1.InstanceMetadataServicePatch) + instanceMetadataServicePatchModel.Enabled = core.BoolPtr(true) + + // Construct an instance of the InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPatchModel := new(vpcv1.InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPatchModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the InstancePatchProfileInstanceProfileIdentityByName model + instancePatchProfileModel := new(vpcv1.InstancePatchProfileInstanceProfileIdentityByName) + instancePatchProfileModel.Name = core.StringPtr("bx2-4x16") + + // Construct an instance of the InstancePatch model + instancePatchModel := new(vpcv1.InstancePatch) + instancePatchModel.AvailabilityPolicy = instanceAvailabilityPolicyPatchModel + instancePatchModel.MetadataService = instanceMetadataServicePatchModel + instancePatchModel.Name = core.StringPtr("my-instance") + instancePatchModel.PlacementTarget = instancePlacementTargetPatchModel + instancePatchModel.Profile = instancePatchProfileModel + instancePatchModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instancePatchModelAsPatch, asPatchErr := instancePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceOptions model + updateInstanceOptionsModel := new(vpcv1.UpdateInstanceOptions) + updateInstanceOptionsModel.ID = core.StringPtr("testString") + updateInstanceOptionsModel.InstancePatch = instancePatchModelAsPatch + updateInstanceOptionsModel.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.UpdateInstanceWithContext(ctx, updateInstanceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateInstance(updateInstanceOptionsModel) + 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.UpdateInstanceWithContext(ctx, updateInstanceOptionsModel) + 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(updateInstancePath)) + 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{"testString"})) + 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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.UpdateInstance(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the InstanceAvailabilityPolicyPatch model + instanceAvailabilityPolicyPatchModel := new(vpcv1.InstanceAvailabilityPolicyPatch) + instanceAvailabilityPolicyPatchModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the InstanceMetadataServicePatch model + instanceMetadataServicePatchModel := new(vpcv1.InstanceMetadataServicePatch) + instanceMetadataServicePatchModel.Enabled = core.BoolPtr(true) + + // Construct an instance of the InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPatchModel := new(vpcv1.InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPatchModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the InstancePatchProfileInstanceProfileIdentityByName model + instancePatchProfileModel := new(vpcv1.InstancePatchProfileInstanceProfileIdentityByName) + instancePatchProfileModel.Name = core.StringPtr("bx2-4x16") + + // Construct an instance of the InstancePatch model + instancePatchModel := new(vpcv1.InstancePatch) + instancePatchModel.AvailabilityPolicy = instanceAvailabilityPolicyPatchModel + instancePatchModel.MetadataService = instanceMetadataServicePatchModel + instancePatchModel.Name = core.StringPtr("my-instance") + instancePatchModel.PlacementTarget = instancePlacementTargetPatchModel + instancePatchModel.Profile = instancePatchProfileModel + instancePatchModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instancePatchModelAsPatch, asPatchErr := instancePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceOptions model + updateInstanceOptionsModel := new(vpcv1.UpdateInstanceOptions) + updateInstanceOptionsModel.ID = core.StringPtr("testString") + updateInstanceOptionsModel.InstancePatch = instancePatchModelAsPatch + updateInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateInstance(updateInstanceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateInstance 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 InstanceAvailabilityPolicyPatch model + instanceAvailabilityPolicyPatchModel := new(vpcv1.InstanceAvailabilityPolicyPatch) + instanceAvailabilityPolicyPatchModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the InstanceMetadataServicePatch model + instanceMetadataServicePatchModel := new(vpcv1.InstanceMetadataServicePatch) + instanceMetadataServicePatchModel.Enabled = core.BoolPtr(true) + + // Construct an instance of the InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPatchModel := new(vpcv1.InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPatchModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the InstancePatchProfileInstanceProfileIdentityByName model + instancePatchProfileModel := new(vpcv1.InstancePatchProfileInstanceProfileIdentityByName) + instancePatchProfileModel.Name = core.StringPtr("bx2-4x16") + + // Construct an instance of the InstancePatch model + instancePatchModel := new(vpcv1.InstancePatch) + instancePatchModel.AvailabilityPolicy = instanceAvailabilityPolicyPatchModel + instancePatchModel.MetadataService = instanceMetadataServicePatchModel + instancePatchModel.Name = core.StringPtr("my-instance") + instancePatchModel.PlacementTarget = instancePlacementTargetPatchModel + instancePatchModel.Profile = instancePatchProfileModel + instancePatchModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instancePatchModelAsPatch, asPatchErr := instancePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceOptions model + updateInstanceOptionsModel := new(vpcv1.UpdateInstanceOptions) + updateInstanceOptionsModel.ID = core.StringPtr("testString") + updateInstanceOptionsModel.InstancePatch = instancePatchModelAsPatch + updateInstanceOptionsModel.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.UpdateInstance(updateInstanceOptionsModel) + 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 UpdateInstanceOptions model with no property values + updateInstanceOptionsModelNew := new(vpcv1.UpdateInstanceOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateInstance(updateInstanceOptionsModelNew) + 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 UpdateInstance 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 InstanceAvailabilityPolicyPatch model + instanceAvailabilityPolicyPatchModel := new(vpcv1.InstanceAvailabilityPolicyPatch) + instanceAvailabilityPolicyPatchModel.HostFailure = core.StringPtr("restart") + + // Construct an instance of the InstanceMetadataServicePatch model + instanceMetadataServicePatchModel := new(vpcv1.InstanceMetadataServicePatch) + instanceMetadataServicePatchModel.Enabled = core.BoolPtr(true) + + // Construct an instance of the InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPatchModel := new(vpcv1.InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) + instancePlacementTargetPatchModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the InstancePatchProfileInstanceProfileIdentityByName model + instancePatchProfileModel := new(vpcv1.InstancePatchProfileInstanceProfileIdentityByName) + instancePatchProfileModel.Name = core.StringPtr("bx2-4x16") + + // Construct an instance of the InstancePatch model + instancePatchModel := new(vpcv1.InstancePatch) + instancePatchModel.AvailabilityPolicy = instanceAvailabilityPolicyPatchModel + instancePatchModel.MetadataService = instanceMetadataServicePatchModel + instancePatchModel.Name = core.StringPtr("my-instance") + instancePatchModel.PlacementTarget = instancePlacementTargetPatchModel + instancePatchModel.Profile = instancePatchProfileModel + instancePatchModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instancePatchModelAsPatch, asPatchErr := instancePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateInstanceOptions model + updateInstanceOptionsModel := new(vpcv1.UpdateInstanceOptions) + updateInstanceOptionsModel.ID = core.StringPtr("testString") + updateInstanceOptionsModel.InstancePatch = instancePatchModelAsPatch + updateInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateInstance(updateInstanceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) - Operation response error`, func() { + version := "testString" + getInstanceInitializationPath := "/instances/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(getInstanceInitializationPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetInstanceInitialization 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 GetInstanceInitializationOptions model + getInstanceInitializationOptionsModel := new(vpcv1.GetInstanceInitializationOptions) + getInstanceInitializationOptionsModel.ID = core.StringPtr("testString") + getInstanceInitializationOptionsModel.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.GetInstanceInitialization(getInstanceInitializationOptionsModel) + 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.GetInstanceInitialization(getInstanceInitializationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions)`, func() { + version := "testString" + getInstanceInitializationPath := "/instances/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(getInstanceInitializationPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/123456::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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "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/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "password": {"encrypted_password": "VGhpcyBpcyBhbiBlbmNvZGVkIGJ5dGUgYXJyYXku", "encryption_key": {"fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY"}}}`) + })) + }) + It(`Invoke GetInstanceInitialization 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 GetInstanceInitializationOptions model + getInstanceInitializationOptionsModel := new(vpcv1.GetInstanceInitializationOptions) + getInstanceInitializationOptionsModel.ID = core.StringPtr("testString") + getInstanceInitializationOptionsModel.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.GetInstanceInitializationWithContext(ctx, getInstanceInitializationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetInstanceInitialization(getInstanceInitializationOptionsModel) + 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.GetInstanceInitializationWithContext(ctx, getInstanceInitializationOptionsModel) + 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(getInstanceInitializationPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/123456::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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "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/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "password": {"encrypted_password": "VGhpcyBpcyBhbiBlbmNvZGVkIGJ5dGUgYXJyYXku", "encryption_key": {"fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY"}}}`) + })) + }) + It(`Invoke GetInstanceInitialization 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.GetInstanceInitialization(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetInstanceInitializationOptions model + getInstanceInitializationOptionsModel := new(vpcv1.GetInstanceInitializationOptions) + getInstanceInitializationOptionsModel.ID = core.StringPtr("testString") + getInstanceInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetInstanceInitialization(getInstanceInitializationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetInstanceInitialization 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 GetInstanceInitializationOptions model + getInstanceInitializationOptionsModel := new(vpcv1.GetInstanceInitializationOptions) + getInstanceInitializationOptionsModel.ID = core.StringPtr("testString") + getInstanceInitializationOptionsModel.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.GetInstanceInitialization(getInstanceInitializationOptionsModel) + 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 GetInstanceInitializationOptions model with no property values + getInstanceInitializationOptionsModelNew := new(vpcv1.GetInstanceInitializationOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetInstanceInitialization(getInstanceInitializationOptionsModelNew) + 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 GetInstanceInitialization 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 GetInstanceInitializationOptions model + getInstanceInitializationOptionsModel := new(vpcv1.GetInstanceInitializationOptions) + getInstanceInitializationOptionsModel.ID = core.StringPtr("testString") + getInstanceInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetInstanceInitialization(getInstanceInitializationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) - Operation response error`, func() { + version := "testString" + createInstanceActionPath := "/instances/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(createInstanceActionPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateInstanceAction 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 CreateInstanceActionOptions model + createInstanceActionOptionsModel := new(vpcv1.CreateInstanceActionOptions) + createInstanceActionOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceActionOptionsModel.Type = core.StringPtr("reboot") + createInstanceActionOptionsModel.Force = core.BoolPtr(true) + createInstanceActionOptionsModel.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.CreateInstanceAction(createInstanceActionOptionsModel) + 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.CreateInstanceAction(createInstanceActionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions)`, func() { + version := "testString" + createInstanceActionPath := "/instances/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(createInstanceActionPath)) + 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{"testString"})) + 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", `{"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"}`) + })) + }) + It(`Invoke CreateInstanceAction 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 CreateInstanceActionOptions model + createInstanceActionOptionsModel := new(vpcv1.CreateInstanceActionOptions) + createInstanceActionOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceActionOptionsModel.Type = core.StringPtr("reboot") + createInstanceActionOptionsModel.Force = core.BoolPtr(true) + createInstanceActionOptionsModel.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.CreateInstanceActionWithContext(ctx, createInstanceActionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateInstanceAction(createInstanceActionOptionsModel) + 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.CreateInstanceActionWithContext(ctx, createInstanceActionOptionsModel) + 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(createInstanceActionPath)) + 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{"testString"})) + 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", `{"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"}`) + })) + }) + It(`Invoke CreateInstanceAction 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.CreateInstanceAction(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the CreateInstanceActionOptions model + createInstanceActionOptionsModel := new(vpcv1.CreateInstanceActionOptions) + createInstanceActionOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceActionOptionsModel.Type = core.StringPtr("reboot") + createInstanceActionOptionsModel.Force = core.BoolPtr(true) + createInstanceActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateInstanceAction(createInstanceActionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateInstanceAction 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 CreateInstanceActionOptions model + createInstanceActionOptionsModel := new(vpcv1.CreateInstanceActionOptions) + createInstanceActionOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceActionOptionsModel.Type = core.StringPtr("reboot") + createInstanceActionOptionsModel.Force = core.BoolPtr(true) + createInstanceActionOptionsModel.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.CreateInstanceAction(createInstanceActionOptionsModel) + 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 CreateInstanceActionOptions model with no property values + createInstanceActionOptionsModelNew := new(vpcv1.CreateInstanceActionOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateInstanceAction(createInstanceActionOptionsModelNew) + 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 CreateInstanceAction 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 CreateInstanceActionOptions model + createInstanceActionOptionsModel := new(vpcv1.CreateInstanceActionOptions) + createInstanceActionOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceActionOptionsModel.Type = core.StringPtr("reboot") + createInstanceActionOptionsModel.Force = core.BoolPtr(true) + createInstanceActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateInstanceAction(createInstanceActionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) - Operation response error`, func() { + version := "testString" + 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(createInstanceConsoleAccessTokenPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateInstanceConsoleAccessToken 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 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.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.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions)`, func() { + version := "testString" + 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(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{"testString"})) + 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": "VGhpcyBJcyBhIHRva2Vu", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/console?access_token=VGhpcyBJcyBhIHRva2Vu"}`) + })) + }) + It(`Invoke CreateInstanceConsoleAccessToken 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 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.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.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) + 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.CreateInstanceConsoleAccessTokenWithContext(ctx, createInstanceConsoleAccessTokenOptionsModel) + 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(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{"testString"})) + 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": "VGhpcyBJcyBhIHRva2Vu", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/console?access_token=VGhpcyBJcyBhIHRva2Vu"}`) + })) + }) + It(`Invoke CreateInstanceConsoleAccessToken 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.CreateInstanceConsoleAccessToken(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateInstanceConsoleAccessToken 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 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.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 CreateInstanceConsoleAccessTokenOptions model with no property values + createInstanceConsoleAccessTokenOptionsModelNew := new(vpcv1.CreateInstanceConsoleAccessTokenOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModelNew) + 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 CreateInstanceConsoleAccessToken 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 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.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) - Operation response error`, func() { + version := "testString" + 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(listInstanceDisksPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListInstanceDisks 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 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.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.ListInstanceDisks(listInstanceDisksOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions)`, func() { + version := "testString" + 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(listInstanceDisksPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/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}]}`) + })) + }) + It(`Invoke ListInstanceDisks 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 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 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")) + + // 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.ListInstanceDisksWithContext(ctx, listInstanceDisksOptionsModel) + 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(listInstanceDisksPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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}]}`) + })) + }) + It(`Invoke ListInstanceDisks 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.ListInstanceDisks(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListInstanceDisks(listInstanceDisksOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListInstanceDisks 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 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.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 ListInstanceDisksOptions model with no property values + listInstanceDisksOptionsModelNew := new(vpcv1.ListInstanceDisksOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListInstanceDisks(listInstanceDisksOptionsModelNew) + 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 ListInstanceDisks 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 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.ListInstanceDisks(listInstanceDisksOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) - Operation response error`, func() { + version := "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(getInstanceDiskPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetInstanceDisk 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 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.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.GetInstanceDisk(getInstanceDiskOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions)`, func() { + version := "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(getInstanceDiskPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/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}`) + })) + }) + It(`Invoke GetInstanceDisk 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 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.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.GetInstanceDisk(getInstanceDiskOptionsModel) + 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.GetInstanceDiskWithContext(ctx, getInstanceDiskOptionsModel) + 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(getInstanceDiskPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/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}`) + })) + }) + It(`Invoke GetInstanceDisk 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.GetInstanceDisk(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetInstanceDisk(getInstanceDiskOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetInstanceDisk 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 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.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 GetInstanceDiskOptions model with no property values + getInstanceDiskOptionsModelNew := new(vpcv1.GetInstanceDiskOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetInstanceDisk(getInstanceDiskOptionsModelNew) + 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 GetInstanceDisk 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 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.GetInstanceDisk(getInstanceDiskOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) - Operation response error`, func() { + version := "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(updateInstanceDiskPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateInstanceDisk 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 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 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.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.UpdateInstanceDisk(updateInstanceDiskOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions)`, func() { + version := "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(updateInstanceDiskPath)) + 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{"testString"})) + 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/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}`) + })) + }) + It(`Invoke UpdateInstanceDisk 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 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 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.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.UpdateInstanceDisk(updateInstanceDiskOptionsModel) + 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.UpdateInstanceDiskWithContext(ctx, updateInstanceDiskOptionsModel) + 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(updateInstanceDiskPath)) + 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{"testString"})) + 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/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}`) + })) + }) + It(`Invoke UpdateInstanceDisk 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.UpdateInstanceDisk(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() + 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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateInstanceDisk 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 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 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.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 UpdateInstanceDiskOptions model with no property values + updateInstanceDiskOptionsModelNew := new(vpcv1.UpdateInstanceDiskOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModelNew) + 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 UpdateInstanceDisk 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 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 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.UpdateInstanceDisk(updateInstanceDiskOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) - Operation response error`, func() { + version := "testString" + 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(listInstanceNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListInstanceNetworkInterfaces 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 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.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.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions)`, func() { + version := "testString" + 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(listInstanceNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}]}`) + })) + }) + It(`Invoke ListInstanceNetworkInterfaces 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 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.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.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + 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.ListInstanceNetworkInterfacesWithContext(ctx, listInstanceNetworkInterfacesOptionsModel) + 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(listInstanceNetworkInterfacesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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_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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}]}`) + })) + }) + It(`Invoke ListInstanceNetworkInterfaces 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.ListInstanceNetworkInterfaces(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListInstanceNetworkInterfaces 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 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.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 ListInstanceNetworkInterfacesOptions model with no property values + listInstanceNetworkInterfacesOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfacesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModelNew) + 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 ListInstanceNetworkInterfaces 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 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.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) - Operation response error`, func() { + version := "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(createInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateInstanceNetworkInterface 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 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("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-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.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.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions)`, func() { + version := "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(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{"testString"})) + 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", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) + })) + }) + It(`Invoke CreateInstanceNetworkInterface 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 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("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-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.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.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + 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.CreateInstanceNetworkInterfaceWithContext(ctx, createInstanceNetworkInterfaceOptionsModel) + 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(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{"testString"})) + 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", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) + })) + }) + It(`Invoke CreateInstanceNetworkInterface 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.CreateInstanceNetworkInterface(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 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 CreateInstanceNetworkInterfaceOptions model + createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-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.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateInstanceNetworkInterface 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 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("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-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.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 CreateInstanceNetworkInterfaceOptions model with no property values + createInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModelNew) + 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 CreateInstanceNetworkInterface 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") + + // 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 CreateInstanceNetworkInterfaceOptions model + createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) + createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") + createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel + createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) + createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-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.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions)`, func() { + version := "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{"testString"})) + 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 := "testString" + 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(getInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetInstanceNetworkInterface 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 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.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.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions)`, func() { + version := "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(getInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) + })) + }) + It(`Invoke GetInstanceNetworkInterface 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 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.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.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + 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.GetInstanceNetworkInterfaceWithContext(ctx, getInstanceNetworkInterfaceOptionsModel) + 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(getInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) + })) + }) + It(`Invoke GetInstanceNetworkInterface 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.GetInstanceNetworkInterface(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetInstanceNetworkInterface 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 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.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 GetInstanceNetworkInterfaceOptions model with no property values + getInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModelNew) + 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 GetInstanceNetworkInterface 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 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.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) - Operation response error`, func() { + version := "testString" + 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(updateInstanceNetworkInterfacePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateInstanceNetworkInterface 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 NetworkInterfacePatch model + networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) + networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") + 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.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.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions)`, func() { + version := "testString" + 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(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{"testString"})) + 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", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) + })) + }) + It(`Invoke UpdateInstanceNetworkInterface 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 NetworkInterfacePatch model + networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) + networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") + 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.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.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + 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.UpdateInstanceNetworkInterfaceWithContext(ctx, updateInstanceNetworkInterfaceOptionsModel) + 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(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{"testString"})) + 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", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) + })) + }) + It(`Invoke UpdateInstanceNetworkInterface 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.UpdateInstanceNetworkInterface(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() + 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.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateInstanceNetworkInterface 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 NetworkInterfacePatch model + networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) + networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") + 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.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 UpdateInstanceNetworkInterfaceOptions model with no property values + updateInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModelNew) + 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 UpdateInstanceNetworkInterface 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 NetworkInterfacePatch model + networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) + networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") + 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.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) - Operation response error`, func() { + version := "testString" + 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(listInstanceNetworkInterfaceFloatingIpsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListInstanceNetworkInterfaceFloatingIps 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 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.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.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions)`, func() { + version := "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(listInstanceNetworkInterfaceFloatingIpsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 ListInstanceNetworkInterfaceFloatingIps 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 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.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.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + 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.ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx, listInstanceNetworkInterfaceFloatingIpsOptionsModel) + 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(listInstanceNetworkInterfaceFloatingIpsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 ListInstanceNetworkInterfaceFloatingIps 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.ListInstanceNetworkInterfaceFloatingIps(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListInstanceNetworkInterfaceFloatingIps 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 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.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 ListInstanceNetworkInterfaceFloatingIpsOptions model with no property values + listInstanceNetworkInterfaceFloatingIpsOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModelNew) + 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 ListInstanceNetworkInterfaceFloatingIps 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 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.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions)`, func() { + version := "testString" + 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{"testString"})) + 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 := "testString" + 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(getInstanceNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetInstanceNetworkInterfaceFloatingIP 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 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.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.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions)`, func() { + version := "testString" + 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(getInstanceNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 GetInstanceNetworkInterfaceFloatingIP 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 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.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.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) + 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.GetInstanceNetworkInterfaceFloatingIPWithContext(ctx, getInstanceNetworkInterfaceFloatingIPOptionsModel) + 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(getInstanceNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 GetInstanceNetworkInterfaceFloatingIP 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.GetInstanceNetworkInterfaceFloatingIP(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetInstanceNetworkInterfaceFloatingIP 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 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.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 GetInstanceNetworkInterfaceFloatingIPOptions model with no property values + getInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModelNew) + 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 GetInstanceNetworkInterfaceFloatingIP 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 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.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { + version := "testString" + 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(addInstanceNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 AddInstanceNetworkInterfaceFloatingIP 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 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.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.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions)`, func() { + version := "testString" + 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(addInstanceNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 AddInstanceNetworkInterfaceFloatingIP 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 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.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.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + 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.AddInstanceNetworkInterfaceFloatingIPWithContext(ctx, addInstanceNetworkInterfaceFloatingIPOptionsModel) + 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(addInstanceNetworkInterfaceFloatingIPPath)) + Expect(req.Method).To(Equal("PUT")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 AddInstanceNetworkInterfaceFloatingIP 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.AddInstanceNetworkInterfaceFloatingIP(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke AddInstanceNetworkInterfaceFloatingIP 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 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 AddInstanceNetworkInterfaceFloatingIPOptions model with no property values + addInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModelNew) + 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 AddInstanceNetworkInterfaceFloatingIP 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 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.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) - Operation response error`, func() { + version := "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(listInstanceNetworkInterfaceIpsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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() { + 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 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(1)) + 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.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.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions)`, func() { + version := "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(listInstanceNetworkInterfaceIpsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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}`) + })) + }) + It(`Invoke ListInstanceNetworkInterfaceIps 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 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(1)) + 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.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.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + 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.ListInstanceNetworkInterfaceIpsWithContext(ctx, listInstanceNetworkInterfaceIpsOptionsModel) + 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(listInstanceNetworkInterfaceIpsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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}`) + })) + }) + It(`Invoke ListInstanceNetworkInterfaceIps 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.ListInstanceNetworkInterfaceIps(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(1)) + listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListInstanceNetworkInterfaceIps 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 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(1)) + 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.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 ListInstanceNetworkInterfaceIpsOptions model with no property values + listInstanceNetworkInterfaceIpsOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModelNew) + 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 ListInstanceNetworkInterfaceIps 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 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(1)) + listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) + 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.ReservedIPCollectionNetworkInterfaceContext) + nextObject := new(vpcv1.ReservedIPCollectionNetworkInterfaceContextNext) + 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.ReservedIPCollectionNetworkInterfaceContext) + + 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.ReservedIPCollectionNetworkInterfaceContext) + nextObject := new(vpcv1.ReservedIPCollectionNetworkInterfaceContextNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) - Operation response error`, func() { + version := "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(getInstanceNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetInstanceNetworkInterfaceIP 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 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.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.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions)`, func() { + version := "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(getInstanceNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + })) + }) + It(`Invoke GetInstanceNetworkInterfaceIP 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 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.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.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + 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.GetInstanceNetworkInterfaceIPWithContext(ctx, getInstanceNetworkInterfaceIPOptionsModel) + 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(getInstanceNetworkInterfaceIPPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + })) + }) + It(`Invoke GetInstanceNetworkInterfaceIP 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.GetInstanceNetworkInterfaceIP(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetInstanceNetworkInterfaceIP 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 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.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 GetInstanceNetworkInterfaceIPOptions model with no property values + getInstanceNetworkInterfaceIPOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModelNew) + 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 GetInstanceNetworkInterfaceIP 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 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.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) - Operation response error`, func() { + version := "testString" + 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(listInstanceVolumeAttachmentsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListInstanceVolumeAttachments 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 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.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.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions)`, func() { + version := "testString" + 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(listInstanceVolumeAttachmentsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}]}`) + })) + }) + It(`Invoke ListInstanceVolumeAttachments 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 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.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.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + 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.ListInstanceVolumeAttachmentsWithContext(ctx, listInstanceVolumeAttachmentsOptionsModel) + 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(listInstanceVolumeAttachmentsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}]}`) + })) + }) + It(`Invoke ListInstanceVolumeAttachments 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.ListInstanceVolumeAttachments(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListInstanceVolumeAttachments 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 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.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() + }) + }) + 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 ListInstanceVolumeAttachments 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 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.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) - Operation response error`, func() { + version := "testString" + 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(createInstanceVolumeAttachmentPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateInstanceVolumeAttachment 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 VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("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"} + // Expect response parsing to fail since we are receiving a text/plain response + 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.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions)`, func() { + version := "testString" + 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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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": 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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}`) + })) + }) + It(`Invoke CreateInstanceVolumeAttachment 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 VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("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 a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, 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.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + 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.CreateInstanceVolumeAttachmentWithContext(ctx, createInstanceVolumeAttachmentOptionsModel) + 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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}`) + })) + }) + It(`Invoke CreateInstanceVolumeAttachment 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.CreateInstanceVolumeAttachment(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("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 valid options model (positive test) + result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateInstanceVolumeAttachment 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 VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("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) + 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) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModelNew) + 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 CreateInstanceVolumeAttachment 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 VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("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 + result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions)`, func() { + version := "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(deleteInstanceVolumeAttachmentPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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() { + version := "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(getInstanceVolumeAttachmentPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetInstanceVolumeAttachment 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 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.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.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions)`, func() { + version := "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(getInstanceVolumeAttachmentPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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": 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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}`) + })) + }) + It(`Invoke GetInstanceVolumeAttachment 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 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.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.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + 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.GetInstanceVolumeAttachmentWithContext(ctx, getInstanceVolumeAttachmentOptionsModel) + 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(getInstanceVolumeAttachmentPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}`) + })) + }) + It(`Invoke GetInstanceVolumeAttachment 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.GetInstanceVolumeAttachment(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetInstanceVolumeAttachment 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 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.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 GetInstanceVolumeAttachmentOptions model with no property values + getInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.GetInstanceVolumeAttachmentOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModelNew) + 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 GetInstanceVolumeAttachment 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 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.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) - Operation response error`, func() { + version := "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(updateInstanceVolumeAttachmentPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateInstanceVolumeAttachment 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 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"} + // Expect response parsing to fail since we are receiving a text/plain response + 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.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions)`, func() { + version := "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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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": 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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}`) + })) + }) + It(`Invoke UpdateInstanceVolumeAttachment 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 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"} + + // 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) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + 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.UpdateInstanceVolumeAttachmentWithContext(ctx, updateInstanceVolumeAttachmentOptionsModel) + 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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}`) + })) + }) + It(`Invoke UpdateInstanceVolumeAttachment 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.UpdateInstanceVolumeAttachment(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateInstanceVolumeAttachment 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 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"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + 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 UpdateInstanceVolumeAttachmentOptions model with no property values + updateInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModelNew) + 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 UpdateInstanceVolumeAttachment 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 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"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) - Operation response error`, func() { + version := "testString" + 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(listInstanceGroupsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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() { + 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 ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) + listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.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.ListInstanceGroups(listInstanceGroupsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions)`, func() { + version := "testString" + 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(listInstanceGroupsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) + })) + }) + It(`Invoke ListInstanceGroups 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 ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) + listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.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.ListInstanceGroups(listInstanceGroupsOptionsModel) + 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.ListInstanceGroupsWithContext(ctx, listInstanceGroupsOptionsModel) + 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(listInstanceGroupsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) + })) + }) + It(`Invoke ListInstanceGroups 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.ListInstanceGroups(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(1)) + listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListInstanceGroups 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 ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) + listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.ListInstanceGroups(listInstanceGroupsOptionsModel) + 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 ListInstanceGroups 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 ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) + listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) + 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.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()) + }) + }) + }) + Describe(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) - Operation response error`, func() { + version := "testString" + 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(createInstanceGroupPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateInstanceGroup 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 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("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 LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + 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.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.CreateInstanceGroup(createInstanceGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions)`, func() { + version := "testString" + 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(createInstanceGroupPath)) + 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{"testString"})) + 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", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateInstanceGroup 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 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("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 LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + 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.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.CreateInstanceGroup(createInstanceGroupOptionsModel) + 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.CreateInstanceGroupWithContext(ctx, createInstanceGroupOptionsModel) + 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(createInstanceGroupPath)) + 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{"testString"})) + 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", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateInstanceGroup 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.CreateInstanceGroup(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("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 LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + 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.CreateInstanceGroup(createInstanceGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateInstanceGroup 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 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("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 LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + 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.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 CreateInstanceGroupOptions model with no property values + createInstanceGroupOptionsModelNew := new(vpcv1.CreateInstanceGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateInstanceGroup(createInstanceGroupOptionsModelNew) + 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 CreateInstanceGroup 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 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("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 LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + 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.CreateInstanceGroup(createInstanceGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions)`, func() { + version := "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(deleteInstanceGroupPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteInstanceGroup 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.DeleteInstanceGroup(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"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteInstanceGroup 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 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.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 DeleteInstanceGroupOptions model with no property values + deleteInstanceGroupOptionsModelNew := new(vpcv1.DeleteInstanceGroupOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) - Operation response error`, func() { + version := "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(getInstanceGroupPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetInstanceGroup 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 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.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.GetInstanceGroup(getInstanceGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions)`, func() { + version := "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(getInstanceGroupPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetInstanceGroup 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 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.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.GetInstanceGroup(getInstanceGroupOptionsModel) + 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.GetInstanceGroupWithContext(ctx, getInstanceGroupOptionsModel) + 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(getInstanceGroupPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetInstanceGroup 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.GetInstanceGroup(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetInstanceGroup 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 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.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 GetInstanceGroupOptions model with no property values + getInstanceGroupOptionsModelNew := new(vpcv1.GetInstanceGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModelNew) + 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 GetInstanceGroup 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 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.GetInstanceGroup(getInstanceGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) - Operation response error`, func() { + version := "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(updateInstanceGroupPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateInstanceGroup 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 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 LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // 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 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 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.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.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions)`, func() { + version := "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(updateInstanceGroupPath)) + 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{"testString"})) + 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", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke UpdateInstanceGroup 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 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 LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // 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 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 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.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.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + 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.UpdateInstanceGroupWithContext(ctx, updateInstanceGroupOptionsModel) + 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(updateInstanceGroupPath)) + 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{"testString"})) + 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", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke UpdateInstanceGroup 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.UpdateInstanceGroup(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 LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // 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 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 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.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateInstanceGroup 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 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 LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // 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 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 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.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 UpdateInstanceGroupOptions model with no property values + updateInstanceGroupOptionsModelNew := new(vpcv1.UpdateInstanceGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModelNew) + 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 UpdateInstanceGroup 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 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 LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // 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 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 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.UpdateInstanceGroup(updateInstanceGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions)`, func() { + version := "testString" + 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{"testString"})) + 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 := "testString" + 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(listInstanceGroupManagersPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListInstanceGroupManagers 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 ListInstanceGroupManagersOptions model + listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) + listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.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.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions)`, func() { + version := "testString" + 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(listInstanceGroupManagersPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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}`) + })) + }) + It(`Invoke ListInstanceGroupManagers 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 ListInstanceGroupManagersOptions model + listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) + listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.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.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + 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.ListInstanceGroupManagersWithContext(ctx, listInstanceGroupManagersOptionsModel) + 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(listInstanceGroupManagersPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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}`) + })) + }) + It(`Invoke ListInstanceGroupManagers 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.ListInstanceGroupManagers(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(1)) + listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListInstanceGroupManagers 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 ListInstanceGroupManagersOptions model + listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) + listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.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 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() + }) + }) + 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 ListInstanceGroupManagers 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 ListInstanceGroupManagersOptions model + listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) + listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) + 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.InstanceGroupManagerCollection) + nextObject := new(vpcv1.InstanceGroupManagerCollectionNext) + 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.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.InstanceGroupManagerCollection) + nextObject := new(vpcv1.InstanceGroupManagerCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) - Operation response error`, func() { + version := "testString" + 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(createInstanceGroupManagerPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateInstanceGroupManager 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 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 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.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.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions)`, func() { + version := "testString" + 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(createInstanceGroupManagerPath)) + 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{"testString"})) + 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/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 CreateInstanceGroupManager 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 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 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.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.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + 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.CreateInstanceGroupManagerWithContext(ctx, createInstanceGroupManagerOptionsModel) + 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(createInstanceGroupManagerPath)) + 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{"testString"})) + 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/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 CreateInstanceGroupManager 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.CreateInstanceGroupManager(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 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.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateInstanceGroupManager 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 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 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.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 CreateInstanceGroupManagerOptions model with no property values + createInstanceGroupManagerOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModelNew) + 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 CreateInstanceGroupManager 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 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 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.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions)`, func() { + version := "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(deleteInstanceGroupManagerPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteInstanceGroupManager 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.DeleteInstanceGroupManager(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"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteInstanceGroupManager 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 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.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 DeleteInstanceGroupManagerOptions model with no property values + deleteInstanceGroupManagerOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) - Operation response error`, func() { + version := "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(getInstanceGroupManagerPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetInstanceGroupManager 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 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.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.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions)`, func() { + version := "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(getInstanceGroupManagerPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/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 GetInstanceGroupManager 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 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.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.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + 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.GetInstanceGroupManagerWithContext(ctx, getInstanceGroupManagerOptionsModel) + 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(getInstanceGroupManagerPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/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 GetInstanceGroupManager 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.GetInstanceGroupManager(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetInstanceGroupManager 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 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.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 GetInstanceGroupManagerOptions model with no property values + getInstanceGroupManagerOptionsModelNew := new(vpcv1.GetInstanceGroupManagerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModelNew) + 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 GetInstanceGroupManager 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 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.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) - Operation response error`, func() { + version := "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(updateInstanceGroupManagerPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateInstanceGroupManager 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 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 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.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.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions)`, func() { + version := "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(updateInstanceGroupManagerPath)) + 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{"testString"})) + 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/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 UpdateInstanceGroupManager 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 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 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.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.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + 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.UpdateInstanceGroupManagerWithContext(ctx, updateInstanceGroupManagerOptionsModel) + 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(updateInstanceGroupManagerPath)) + 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{"testString"})) + 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/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 UpdateInstanceGroupManager 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.UpdateInstanceGroupManager(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() + 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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateInstanceGroupManager 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 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 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.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 UpdateInstanceGroupManagerOptions model with no property values + updateInstanceGroupManagerOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModelNew) + 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 UpdateInstanceGroupManager 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 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 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.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) - Operation response error`, func() { + version := "testString" + 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(listInstanceGroupManagerActionsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListInstanceGroupManagerActions 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 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(1)) + 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.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.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions)`, func() { + version := "testString" + 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(listInstanceGroupManagerActionsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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", `{"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": "*/5 1,2,3 * * *", "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}`) + })) + }) + It(`Invoke ListInstanceGroupManagerActions 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 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(1)) + 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.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.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + 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.ListInstanceGroupManagerActionsWithContext(ctx, listInstanceGroupManagerActionsOptionsModel) + 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(listInstanceGroupManagerActionsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + // 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": "*/5 1,2,3 * * *", "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}`) + })) + }) + It(`Invoke ListInstanceGroupManagerActions 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.ListInstanceGroupManagerActions(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(1)) + listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListInstanceGroupManagerActions 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 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(1)) + 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.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 ListInstanceGroupManagerActionsOptions model with no property values + listInstanceGroupManagerActionsOptionsModelNew := new(vpcv1.ListInstanceGroupManagerActionsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModelNew) + 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 ListInstanceGroupManagerActions 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 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(1)) + listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) + 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.InstanceGroupManagerActionsCollection) + nextObject := new(vpcv1.InstanceGroupManagerActionsCollectionNext) + 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.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.InstanceGroupManagerActionsCollection) + nextObject := new(vpcv1.InstanceGroupManagerActionsCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) - Operation response error`, func() { + version := "testString" + 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(createInstanceGroupManagerActionPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateInstanceGroupManagerAction 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 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 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.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.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions)`, func() { + version := "testString" + 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(createInstanceGroupManagerActionPath)) + 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{"testString"})) + 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", `{"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": "*/5 1,2,3 * * *", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + })) + }) + It(`Invoke CreateInstanceGroupManagerAction 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 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 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.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.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + 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.CreateInstanceGroupManagerActionWithContext(ctx, createInstanceGroupManagerActionOptionsModel) + 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(createInstanceGroupManagerActionPath)) + 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{"testString"})) + 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", `{"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": "*/5 1,2,3 * * *", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + })) + }) + It(`Invoke CreateInstanceGroupManagerAction 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.CreateInstanceGroupManagerAction(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 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.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateInstanceGroupManagerAction 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 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 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.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 CreateInstanceGroupManagerActionOptions model with no property values + createInstanceGroupManagerActionOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerActionOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModelNew) + 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 CreateInstanceGroupManagerAction 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 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 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.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions)`, func() { + version := "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(deleteInstanceGroupManagerActionPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteInstanceGroupManagerAction 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.DeleteInstanceGroupManagerAction(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"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteInstanceGroupManagerAction 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 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.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 DeleteInstanceGroupManagerActionOptions model with no property values + deleteInstanceGroupManagerActionOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerActionOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) - Operation response error`, func() { + version := "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(getInstanceGroupManagerActionPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetInstanceGroupManagerAction 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 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.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.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions)`, func() { + version := "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(getInstanceGroupManagerActionPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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": "*/5 1,2,3 * * *", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + })) + }) + It(`Invoke GetInstanceGroupManagerAction 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 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.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.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + 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.GetInstanceGroupManagerActionWithContext(ctx, getInstanceGroupManagerActionOptionsModel) + 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(getInstanceGroupManagerActionPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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": "*/5 1,2,3 * * *", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + })) + }) + It(`Invoke GetInstanceGroupManagerAction 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.GetInstanceGroupManagerAction(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetInstanceGroupManagerAction 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 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.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 GetInstanceGroupManagerActionOptions model with no property values + getInstanceGroupManagerActionOptionsModelNew := new(vpcv1.GetInstanceGroupManagerActionOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModelNew) + 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 GetInstanceGroupManagerAction 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 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.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) - Operation response error`, func() { + version := "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(updateInstanceGroupManagerActionPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateInstanceGroupManagerAction 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 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.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + 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 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.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.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions)`, func() { + version := "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(updateInstanceGroupManagerActionPath)) + 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{"testString"})) + 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", `{"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": "*/5 1,2,3 * * *", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + })) + }) + It(`Invoke UpdateInstanceGroupManagerAction 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 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.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + 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 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.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.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + 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.UpdateInstanceGroupManagerActionWithContext(ctx, updateInstanceGroupManagerActionOptionsModel) + 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(updateInstanceGroupManagerActionPath)) + 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{"testString"})) + 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", `{"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": "*/5 1,2,3 * * *", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + })) + }) + It(`Invoke UpdateInstanceGroupManagerAction 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.UpdateInstanceGroupManagerAction(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.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + 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 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.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateInstanceGroupManagerAction 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 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.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + 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 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.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 UpdateInstanceGroupManagerActionOptions model with no property values + updateInstanceGroupManagerActionOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerActionOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModelNew) + 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 UpdateInstanceGroupManagerAction 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 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.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + 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 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.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) - Operation response error`, func() { + version := "testString" + 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(listInstanceGroupManagerPoliciesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListInstanceGroupManagerPolicies 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 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(1)) + 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.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.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions)`, func() { + version := "testString" + 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(listInstanceGroupManagerPoliciesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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}`) + })) + }) + It(`Invoke ListInstanceGroupManagerPolicies 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 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(1)) + 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.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.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + 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.ListInstanceGroupManagerPoliciesWithContext(ctx, listInstanceGroupManagerPoliciesOptionsModel) + 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(listInstanceGroupManagerPoliciesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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}`) + })) + }) + It(`Invoke ListInstanceGroupManagerPolicies 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.ListInstanceGroupManagerPolicies(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(1)) + listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListInstanceGroupManagerPolicies 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 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(1)) + 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.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 ListInstanceGroupManagerPoliciesOptions model with no property values + listInstanceGroupManagerPoliciesOptionsModelNew := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModelNew) + 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 ListInstanceGroupManagerPolicies 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 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(1)) + listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) + 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.InstanceGroupManagerPolicyCollection) + nextObject := new(vpcv1.InstanceGroupManagerPolicyCollectionNext) + 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.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.InstanceGroupManagerPolicyCollection) + nextObject := new(vpcv1.InstanceGroupManagerPolicyCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) - Operation response error`, func() { + version := "testString" + 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(createInstanceGroupManagerPolicyPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateInstanceGroupManagerPolicy 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 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"} + // 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()) + + // 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()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions)`, func() { + version := "testString" + 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{"testString"})) + 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 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{"testString"})) + 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()) + result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) + 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) + // Invoke operation with invalid model (negative test) + 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(`DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions)`, func() { + version := "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{"testString"})) + 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 := "testString" + 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(getInstanceGroupManagerPolicyPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetInstanceGroupManagerPolicy 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 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.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.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions)`, func() { + version := "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(getInstanceGroupManagerPolicyPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/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 GetInstanceGroupManagerPolicy 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 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.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.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + 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.GetInstanceGroupManagerPolicyWithContext(ctx, getInstanceGroupManagerPolicyOptionsModel) + 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(getInstanceGroupManagerPolicyPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/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 GetInstanceGroupManagerPolicy 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.GetInstanceGroupManagerPolicy(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetInstanceGroupManagerPolicy 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 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.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 GetInstanceGroupManagerPolicyOptions model with no property values + getInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.GetInstanceGroupManagerPolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModelNew) + 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 GetInstanceGroupManagerPolicy 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 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.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) - Operation response error`, func() { + version := "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(updateInstanceGroupManagerPolicyPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateInstanceGroupManagerPolicy 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 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"} + // Expect response parsing to fail since we are receiving a text/plain response + 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.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions)`, func() { + version := "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(updateInstanceGroupManagerPolicyPath)) + 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{"testString"})) + 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/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 UpdateInstanceGroupManagerPolicy 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 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 a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, 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.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + 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.UpdateInstanceGroupManagerPolicyWithContext(ctx, updateInstanceGroupManagerPolicyOptionsModel) + 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(updateInstanceGroupManagerPolicyPath)) + 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{"testString"})) + 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/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 UpdateInstanceGroupManagerPolicy 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.UpdateInstanceGroupManagerPolicy(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() + 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.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateInstanceGroupManagerPolicy 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 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 empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + 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 UpdateInstanceGroupManagerPolicyOptions model with no property values + updateInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModelNew) + 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 UpdateInstanceGroupManagerPolicy 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 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 + result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions)`, func() { + version := "testString" + 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{"testString"})) + 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 := "testString" + 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(listInstanceGroupMembershipsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListInstanceGroupMemberships 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 ListInstanceGroupMembershipsOptions model + listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) + listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.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.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions)`, func() { + version := "testString" + 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(listInstanceGroupMembershipsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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}`) + })) + }) + It(`Invoke ListInstanceGroupMemberships 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 ListInstanceGroupMembershipsOptions model + listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) + listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.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.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + 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.ListInstanceGroupMembershipsWithContext(ctx, listInstanceGroupMembershipsOptionsModel) + 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(listInstanceGroupMembershipsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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}`) + })) + }) + It(`Invoke ListInstanceGroupMemberships 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.ListInstanceGroupMemberships(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(1)) + listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListInstanceGroupMemberships 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 ListInstanceGroupMembershipsOptions model + listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) + listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.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() + }) + }) + 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 ListInstanceGroupMemberships 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 ListInstanceGroupMembershipsOptions model + listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) + listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) + 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.InstanceGroupMembershipCollection) + nextObject := new(vpcv1.InstanceGroupMembershipCollectionNext) + 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.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.InstanceGroupMembershipCollection) + nextObject := new(vpcv1.InstanceGroupMembershipCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions)`, func() { + version := "testString" + 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(deleteInstanceGroupMembershipPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteInstanceGroupMembership 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.DeleteInstanceGroupMembership(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // 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 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 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 := "testString" + 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() + + // 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{"testString"})) + 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 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.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.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions)`, func() { + version := "testString" + 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(getInstanceGroupMembershipPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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 GetInstanceGroupMembership 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 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.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.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + 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.GetInstanceGroupMembershipWithContext(ctx, getInstanceGroupMembershipOptionsModel) + 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(getInstanceGroupMembershipPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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 GetInstanceGroupMembership 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.GetInstanceGroupMembership(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetInstanceGroupMembership 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 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.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 GetInstanceGroupMembershipOptions model with no property values + getInstanceGroupMembershipOptionsModelNew := new(vpcv1.GetInstanceGroupMembershipOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModelNew) + 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 GetInstanceGroupMembership 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 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.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) - Operation response error`, func() { + version := "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(updateInstanceGroupMembershipPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateInstanceGroupMembership 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 InstanceGroupMembershipPatch model + instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) + 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.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.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions)`, func() { + version := "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(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{"testString"})) + 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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 UpdateInstanceGroupMembership 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 InstanceGroupMembershipPatch model + instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) + 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.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.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + 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.UpdateInstanceGroupMembershipWithContext(ctx, updateInstanceGroupMembershipOptionsModel) + 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(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{"testString"})) + 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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 UpdateInstanceGroupMembership 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.UpdateInstanceGroupMembership(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.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.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateInstanceGroupMembership 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 InstanceGroupMembershipPatch model + instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) + 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.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 UpdateInstanceGroupMembershipOptions model with no property values + updateInstanceGroupMembershipOptionsModelNew := new(vpcv1.UpdateInstanceGroupMembershipOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModelNew) + 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 UpdateInstanceGroupMembership 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 InstanceGroupMembershipPatch model + instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) + 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.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) - Operation response error`, func() { + version := "testString" + 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(listDedicatedHostGroupsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListDedicatedHostGroups 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 ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) + listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") + 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.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.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions)`, func() { + version := "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(listDedicatedHostGroupsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).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/dedicated_host/groups?limit=20"}, "groups": [{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "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}`) + })) + }) + It(`Invoke ListDedicatedHostGroups 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 ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) + listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") + 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.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.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + 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.ListDedicatedHostGroupsWithContext(ctx, listDedicatedHostGroupsOptionsModel) + 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(listDedicatedHostGroupsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).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/dedicated_host/groups?limit=20"}, "groups": [{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "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}`) + })) + }) + It(`Invoke ListDedicatedHostGroups 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.ListDedicatedHostGroups(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(1)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListDedicatedHostGroups 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 ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) + listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") + 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.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + 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 ListDedicatedHostGroups 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 ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) + listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") + listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) + 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.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()) + }) + }) + }) + Describe(`CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) - Operation response error`, func() { + version := "testString" + 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{"testString"})) + 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 CreateDedicatedHostGroup 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 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 CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + 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.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.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions)`, func() { + version := "testString" + 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(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{"testString"})) + 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", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "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() { + 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 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 CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + 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.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.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + 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.CreateDedicatedHostGroupWithContext(ctx, createDedicatedHostGroupOptionsModel) + 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(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{"testString"})) + 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": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "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() { + 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.CreateDedicatedHostGroup(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 ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateDedicatedHostGroup 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 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 CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + 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.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + 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(201) + })) + }) + It(`Invoke CreateDedicatedHostGroup 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") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) + createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") + createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") + createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") + createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel + createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions)`, func() { + version := "testString" + deleteDedicatedHostGroupPath := "/dedicated_host/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(deleteDedicatedHostGroupPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteDedicatedHostGroup 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.DeleteDedicatedHostGroup(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(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"} + + // 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 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) + 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(`GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) - Operation response error`, func() { + version := "testString" + 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(getDedicatedHostGroupPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetDedicatedHostGroup 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 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 := "testString" + 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")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "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 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.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.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + 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.GetDedicatedHostGroupWithContext(ctx, getDedicatedHostGroupOptionsModel) + 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(getDedicatedHostGroupPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "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() { + 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.GetDedicatedHostGroup(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetDedicatedHostGroup 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 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.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 GetDedicatedHostGroupOptions model with no property values + getDedicatedHostGroupOptionsModelNew := new(vpcv1.GetDedicatedHostGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModelNew) + 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 GetDedicatedHostGroup 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 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.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) - Operation response error`, func() { + version := "testString" + 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(updateDedicatedHostGroupPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateDedicatedHostGroup 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 DedicatedHostGroupPatch model + dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-modified") + 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()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions)`, func() { + version := "testString" + 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(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{"testString"})) + 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", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateDedicatedHostGroup 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 DedicatedHostGroupPatch model + dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-modified") + 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.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.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + 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.UpdateDedicatedHostGroupWithContext(ctx, updateDedicatedHostGroupOptionsModel) + 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(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{"testString"})) + 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": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateDedicatedHostGroup 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.UpdateDedicatedHostGroup(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-modified") + 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.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateDedicatedHostGroup 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 DedicatedHostGroupPatch model + dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-modified") + 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.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() + }) + }) + 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 UpdateDedicatedHostGroup 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 DedicatedHostGroupPatch model + dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-modified") + 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.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) - Operation response error`, func() { + version := "testString" + 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(listDedicatedHostProfilesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListDedicatedHostProfiles 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 ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) + listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.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.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions)`, func() { + version := "testString" + 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(listDedicatedHostProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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": "mx2", "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/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}], "total_count": 132}`) + })) + }) + It(`Invoke ListDedicatedHostProfiles 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 ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) + listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.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.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + 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.ListDedicatedHostProfilesWithContext(ctx, listDedicatedHostProfilesOptionsModel) + 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(listDedicatedHostProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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": "mx2", "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/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}], "total_count": 132}`) + })) + }) + It(`Invoke ListDedicatedHostProfiles 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.ListDedicatedHostProfiles(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(1)) + listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListDedicatedHostProfiles 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 ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) + listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + 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 ListDedicatedHostProfiles 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 ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) + listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) + 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.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()) + }) + }) + }) + Describe(`GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) - Operation response error`, func() { + version := "testString" + getDedicatedHostProfilePath := "/dedicated_host/profiles/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.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetDedicatedHostProfile 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 GetDedicatedHostProfileOptions model + getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) + getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") + 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.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.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions)`, func() { + version := "testString" + getDedicatedHostProfilePath := "/dedicated_host/profiles/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.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"class": "mx2", "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/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}`) + })) + }) + It(`Invoke GetDedicatedHostProfile 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 GetDedicatedHostProfileOptions model + getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) + getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") + 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.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.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + 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.GetDedicatedHostProfileWithContext(ctx, getDedicatedHostProfileOptionsModel) + 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(getDedicatedHostProfilePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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": "mx2", "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/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}`) + })) + }) + It(`Invoke GetDedicatedHostProfile 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.GetDedicatedHostProfile(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("testString") + getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetDedicatedHostProfile 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 GetDedicatedHostProfileOptions model + getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) + getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") + 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.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 GetDedicatedHostProfileOptions model with no property values + getDedicatedHostProfileOptionsModelNew := new(vpcv1.GetDedicatedHostProfileOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModelNew) + 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 GetDedicatedHostProfile 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 GetDedicatedHostProfileOptions model + getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) + getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") + getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) - Operation response error`, func() { + version := "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(listDedicatedHostsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + 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() { + 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 ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) + listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") + 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) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions)`, func() { + version := "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(listDedicatedHostsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).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", `{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "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}`) + })) + }) + It(`Invoke ListDedicatedHosts 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 ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) + listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") + 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.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.ListDedicatedHosts(listDedicatedHostsOptionsModel) + 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.ListDedicatedHostsWithContext(ctx, listDedicatedHostsOptionsModel) + 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(listDedicatedHostsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + // 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}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "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}`) + })) + }) + It(`Invoke ListDedicatedHosts 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.ListDedicatedHosts(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(1)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListDedicatedHosts 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 ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) + listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") + 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.ListDedicatedHosts(listDedicatedHostsOptionsModel) + 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 ListDedicatedHosts 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 ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) + listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") + listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) + 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.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()) + }) + }) + }) + Describe(`CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) - Operation response error`, func() { + version := "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(createDedicatedHostPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateDedicatedHost 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 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"} + // Expect response parsing to fail since we are receiving a text/plain response + 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.CreateDedicatedHost(createDedicatedHostOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions)`, func() { + version := "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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateDedicatedHost 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 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"} + + // 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) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) + 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.CreateDedicatedHostWithContext(ctx, createDedicatedHostOptionsModel) + 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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke CreateDedicatedHost 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.CreateDedicatedHost(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateDedicatedHost 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 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"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + 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 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() + }) + }) + 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 CreateDedicatedHost 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 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"} + + // Invoke operation + result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) - Operation response error`, func() { + version := "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(listDedicatedHostDisksPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListDedicatedHostDisks 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 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.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.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions)`, func() { + version := "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(listDedicatedHostDisksPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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": [{"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"]}]}`) + })) + }) + It(`Invoke ListDedicatedHostDisks 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 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.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.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + 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.ListDedicatedHostDisksWithContext(ctx, listDedicatedHostDisksOptionsModel) + 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(listDedicatedHostDisksPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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": [{"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"]}]}`) + })) + }) + It(`Invoke ListDedicatedHostDisks 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.ListDedicatedHostDisks(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListDedicatedHostDisks 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 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.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 ListDedicatedHostDisksOptions model with no property values + listDedicatedHostDisksOptionsModelNew := new(vpcv1.ListDedicatedHostDisksOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModelNew) + 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 ListDedicatedHostDisks 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 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.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) - Operation response error`, func() { + version := "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(getDedicatedHostDiskPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetDedicatedHostDisk 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 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.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.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions)`, func() { + version := "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(getDedicatedHostDiskPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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"]}`) + })) + }) + It(`Invoke GetDedicatedHostDisk 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 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.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.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + 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.GetDedicatedHostDiskWithContext(ctx, getDedicatedHostDiskOptionsModel) + 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(getDedicatedHostDiskPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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"]}`) + })) + }) + It(`Invoke GetDedicatedHostDisk 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.GetDedicatedHostDisk(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetDedicatedHostDisk 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 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.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 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() + }) + }) + 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 GetDedicatedHostDisk 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 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.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) - Operation response error`, func() { + version := "testString" + 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(updateDedicatedHostDiskPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateDedicatedHostDisk 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 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"} + // 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.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions)`, func() { + version := "testString" + 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(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{"testString"})) + 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", `{"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"]}`) + })) + }) + It(`Invoke UpdateDedicatedHostDisk 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 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 with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, 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.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + 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.UpdateDedicatedHostDiskWithContext(ctx, updateDedicatedHostDiskOptionsModel) + 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(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{"testString"})) + 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"]}`) + })) + }) + It(`Invoke UpdateDedicatedHostDisk 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.UpdateDedicatedHostDisk(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 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.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateDedicatedHostDisk 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 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 with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + 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() + }) + }) + 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 UpdateDedicatedHostDisk 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 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 := "testString" + 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() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteDedicatedHostPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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()) + + // 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 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 valid options model (positive test) + response, operationErr = vpcService.DeleteDedicatedHost(deleteDedicatedHostOptionsModel) + 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()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) - Operation response error`, func() { + version := "testString" + 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(getDedicatedHostPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetDedicatedHost 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 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.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.GetDedicatedHost(getDedicatedHostOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions)`, func() { + version := "testString" + 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(getDedicatedHostPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetDedicatedHost 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 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.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.GetDedicatedHost(getDedicatedHostOptionsModel) + 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.GetDedicatedHostWithContext(ctx, getDedicatedHostOptionsModel) + 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(getDedicatedHostPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke GetDedicatedHost 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.GetDedicatedHost(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetDedicatedHost 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 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.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 GetDedicatedHostOptions model with no property values + getDedicatedHostOptionsModelNew := new(vpcv1.GetDedicatedHostOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModelNew) + 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 GetDedicatedHost 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 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.GetDedicatedHost(getDedicatedHostOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) - Operation response error`, func() { + version := "testString" + 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(updateDedicatedHostPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateDedicatedHost 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 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"} + // 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()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions)`, func() { + version := "testString" + 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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateDedicatedHost 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 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"} + + // 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) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + 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.UpdateDedicatedHostWithContext(ctx, updateDedicatedHostOptionsModel) + 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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + })) + }) + It(`Invoke UpdateDedicatedHost 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.UpdateDedicatedHost(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateDedicatedHost 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 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"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + 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 UpdateDedicatedHostOptions model with no property values + updateDedicatedHostOptionsModelNew := new(vpcv1.UpdateDedicatedHostOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModelNew) + 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 UpdateDedicatedHost 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 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"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) - Operation response error`, func() { + version := "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(listBackupPoliciesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + 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 ListBackupPolicies 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 ListBackupPoliciesOptions model + listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) + listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") + 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.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.ListBackupPolicies(listBackupPoliciesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions)`, func() { + version := "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(listBackupPoliciesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + 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_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}], "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}`) + })) + }) + It(`Invoke ListBackupPolicies 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 ListBackupPoliciesOptions model + listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) + listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") + 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.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.ListBackupPolicies(listBackupPoliciesOptionsModel) + 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.ListBackupPoliciesWithContext(ctx, listBackupPoliciesOptionsModel) + 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(listBackupPoliciesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + 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_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}], "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}`) + })) + }) + 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()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListBackupPolicies(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(1)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") + 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.ListBackupPolicies(listBackupPoliciesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListBackupPolicies 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 ListBackupPoliciesOptions model + listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) + listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") + 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.ListBackupPolicies(listBackupPoliciesOptionsModel) + 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 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(1)) + listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") + 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.BackupPolicyCollectionNext) + 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.BackupPolicyCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) - Operation response error`, func() { + version := "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(createBackupPolicyPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateBackupPolicy 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 BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.MatchResourceTypes = []string{"volume"} + createBackupPolicyOptionsModel.MatchUserTags = []string{"my-daily-backup-policy"} + createBackupPolicyOptionsModel.Name = core.StringPtr("my-backup-policy") + createBackupPolicyOptionsModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + createBackupPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + 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.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.CreateBackupPolicy(createBackupPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions)`, func() { + version := "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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) + })) + }) + It(`Invoke CreateBackupPolicy 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 BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.MatchResourceTypes = []string{"volume"} + createBackupPolicyOptionsModel.MatchUserTags = []string{"my-daily-backup-policy"} + createBackupPolicyOptionsModel.Name = core.StringPtr("my-backup-policy") + createBackupPolicyOptionsModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + createBackupPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + 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.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.CreateBackupPolicy(createBackupPolicyOptionsModel) + 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.CreateBackupPolicyWithContext(ctx, createBackupPolicyOptionsModel) + 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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) + })) + }) + 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()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.CreateBackupPolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // 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 BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.MatchResourceTypes = []string{"volume"} + createBackupPolicyOptionsModel.MatchUserTags = []string{"my-daily-backup-policy"} + createBackupPolicyOptionsModel.Name = core.StringPtr("my-backup-policy") + createBackupPolicyOptionsModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + createBackupPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateBackupPolicy 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 BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.MatchResourceTypes = []string{"volume"} + createBackupPolicyOptionsModel.MatchUserTags = []string{"my-daily-backup-policy"} + createBackupPolicyOptionsModel.Name = core.StringPtr("my-backup-policy") + createBackupPolicyOptionsModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + createBackupPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + 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.CreateBackupPolicy(createBackupPolicyOptionsModel) + 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(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 BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) + createBackupPolicyOptionsModel.MatchResourceTypes = []string{"volume"} + createBackupPolicyOptionsModel.MatchUserTags = []string{"my-daily-backup-policy"} + createBackupPolicyOptionsModel.Name = core.StringPtr("my-backup-policy") + createBackupPolicyOptionsModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} + createBackupPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) - Operation response error`, func() { + version := "testString" + 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(listBackupPolicyPlansPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + 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("testString") + 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()) + + // 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()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions)`, func() { + version := "testString" + 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(listBackupPolicyPlansPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).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", `{"plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}]}`) + })) + }) + It(`Invoke ListBackupPolicyPlans 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 ListBackupPolicyPlansOptions model + listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) + listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.Name = core.StringPtr("testString") + 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")) + + // 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()) + + // 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")) + }) + 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(listBackupPolicyPlansPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}]}`) + })) + }) + 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()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListBackupPolicyPlans(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("testString") + listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListBackupPolicyPlans 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 ListBackupPolicyPlansOptions model + listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) + listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyPlansOptionsModel.Name = core.StringPtr("testString") + 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.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 ListBackupPolicyPlansOptions model with no property values + listBackupPolicyPlansOptionsModelNew := new(vpcv1.ListBackupPolicyPlansOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModelNew) + 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("testString") + 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() { + version := "testString" + 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(createBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + 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.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.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions)`, func() { + version := "testString" + 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(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{"testString"})) + 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", `{"active": true, "attach_user_tags": ["AttachUserTags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + })) + }) + It(`Invoke CreateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + 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.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.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + 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.CreateBackupPolicyPlanWithContext(ctx, createBackupPolicyPlanOptionsModel) + 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(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{"testString"})) + 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"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + })) + }) + It(`Invoke CreateBackupPolicyPlan 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.CreateBackupPolicyPlan(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // 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 CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + 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.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() + }) + }) + 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 CreateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + + // Construct an instance of the CreateBackupPolicyPlanOptions model + createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) + createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} + createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) + createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") + createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) - Operation response error`, func() { + version := "testString" + 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(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{"testString"})) + 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 DeleteBackupPolicyPlan 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 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.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.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions)`, func() { + version := "testString" + 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(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{"testString"})) + 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", `{"active": true, "attach_user_tags": ["AttachUserTags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + })) + }) + It(`Invoke DeleteBackupPolicyPlan 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 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.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.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + 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.DeleteBackupPolicyPlanWithContext(ctx, deleteBackupPolicyPlanOptionsModel) + 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(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{"testString"})) + 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"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + })) + }) + It(`Invoke DeleteBackupPolicyPlan 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.DeleteBackupPolicyPlan(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke DeleteBackupPolicyPlan 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 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.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 DeleteBackupPolicyPlanOptions model with no property values + deleteBackupPolicyPlanOptionsModelNew := new(vpcv1.DeleteBackupPolicyPlanOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModelNew) + 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 DeleteBackupPolicyPlan 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 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.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) - Operation response error`, func() { + version := "testString" + 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(getBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetBackupPolicyPlan 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 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.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.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions)`, func() { + version := "testString" + 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(getBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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, "attach_user_tags": ["AttachUserTags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + })) + }) + It(`Invoke GetBackupPolicyPlan 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 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.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.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) + 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.GetBackupPolicyPlanWithContext(ctx, getBackupPolicyPlanOptionsModel) + 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(getBackupPolicyPlanPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + })) + }) + It(`Invoke GetBackupPolicyPlan 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.GetBackupPolicyPlan(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetBackupPolicyPlan 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 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.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() + }) + }) + 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 GetBackupPolicyPlan 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 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.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) - Operation response error`, func() { + version := "testString" + 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(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{"testString"})) + 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 UpdateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + 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.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.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions)`, func() { + version := "testString" + 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(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.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{"testString"})) + 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, "attach_user_tags": ["AttachUserTags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + })) + }) + It(`Invoke UpdateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + 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.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.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + 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.UpdateBackupPolicyPlanWithContext(ctx, updateBackupPolicyPlanOptionsModel) + 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(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.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{"testString"})) + 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"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + })) + }) + It(`Invoke UpdateBackupPolicyPlan 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.UpdateBackupPolicyPlan(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + 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.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + 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.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 UpdateBackupPolicyPlanOptions model with no property values + updateBackupPolicyPlanOptionsModelNew := new(vpcv1.UpdateBackupPolicyPlanOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModelNew) + 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 UpdateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPatch model + backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) + backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the BackupPolicyPlanPatch model + backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) + backupPolicyPlanPatchModel.Active = core.BoolPtr(true) + backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel + backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") + 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.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) - Operation response error`, func() { + version := "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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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 DeleteBackupPolicy 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 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.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.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions)`, func() { + version := "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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) + })) + }) + It(`Invoke DeleteBackupPolicy 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 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.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.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + 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.DeleteBackupPolicyWithContext(ctx, deleteBackupPolicyOptionsModel) + 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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) + })) + }) + It(`Invoke DeleteBackupPolicy 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.DeleteBackupPolicy(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke DeleteBackupPolicy 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 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.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 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() + }) + }) + 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 DeleteBackupPolicy 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 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.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) - Operation response error`, func() { + version := "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(getBackupPolicyPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetBackupPolicy 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 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.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.GetBackupPolicy(getBackupPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions)`, func() { + version := "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(getBackupPolicyPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) + })) + }) + It(`Invoke GetBackupPolicy 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 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.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.GetBackupPolicy(getBackupPolicyOptionsModel) + 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.GetBackupPolicyWithContext(ctx, getBackupPolicyOptionsModel) + 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(getBackupPolicyPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) + })) + }) + It(`Invoke GetBackupPolicy 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.GetBackupPolicy(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetBackupPolicy 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 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.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 GetBackupPolicyOptions model with no property values + getBackupPolicyOptionsModelNew := new(vpcv1.GetBackupPolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModelNew) + 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 GetBackupPolicy 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 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.GetBackupPolicy(getBackupPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) - Operation response error`, func() { + version := "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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateBackupPolicy 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 BackupPolicyPatch model + backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) + 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"} + // Expect response parsing to fail since we are receiving a text/plain response + 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.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions)`, func() { + version := "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(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.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{"testString"})) + 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/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) + })) + }) + It(`Invoke UpdateBackupPolicy 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 BackupPolicyPatch model + backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) + 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"} + + // 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) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + 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.UpdateBackupPolicyWithContext(ctx, updateBackupPolicyOptionsModel) + 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(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.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{"testString"})) + 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/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) + })) + }) + It(`Invoke UpdateBackupPolicy 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.UpdateBackupPolicy(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.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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateBackupPolicy 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 BackupPolicyPatch model + backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) + 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"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + 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 UpdateBackupPolicyOptions model with no property values + updateBackupPolicyOptionsModelNew := new(vpcv1.UpdateBackupPolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModelNew) + 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 UpdateBackupPolicy 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 BackupPolicyPatch model + backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) + 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"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) - Operation response error`, func() { + version := "testString" + 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(listPlacementGroupsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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() { + 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 ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) + listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) + 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) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions)`, func() { + version := "testString" + 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(listPlacementGroupsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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/123456::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}`) + })) + }) + It(`Invoke ListPlacementGroups 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 ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) + listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.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.ListPlacementGroups(listPlacementGroupsOptionsModel) + 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.ListPlacementGroupsWithContext(ctx, listPlacementGroupsOptionsModel) + 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(listPlacementGroupsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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/123456::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}`) + })) + }) + It(`Invoke ListPlacementGroups 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.ListPlacementGroups(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(1)) + listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListPlacementGroups 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 ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) + listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.ListPlacementGroups(listPlacementGroupsOptionsModel) + 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 ListPlacementGroups 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 ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) + listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) + 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.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()) + }) + }) + }) + Describe(`CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) - Operation response error`, func() { + version := "testString" + 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(createPlacementGroupPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreatePlacementGroup 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 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.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.CreatePlacementGroup(createPlacementGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions)`, func() { + version := "testString" + 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(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{"testString"})) + 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::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 CreatePlacementGroup 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 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.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.CreatePlacementGroup(createPlacementGroupOptionsModel) + 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.CreatePlacementGroupWithContext(ctx, createPlacementGroupOptionsModel) + 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(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{"testString"})) + 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/123456::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 CreatePlacementGroup 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.CreatePlacementGroup(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreatePlacementGroup 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 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.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 CreatePlacementGroupOptions model with no property values + createPlacementGroupOptionsModelNew := new(vpcv1.CreatePlacementGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModelNew) + 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 CreatePlacementGroup 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") + + // 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.CreatePlacementGroup(createPlacementGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions)`, func() { + version := "testString" + 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{"testString"})) + 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 := "testString" + 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(getPlacementGroupPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 := "testString" + 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{"testString"})) + 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/123456::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{"testString"})) + 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/123456::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 := "testString" + 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{"testString"})) + 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 := "testString" + 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.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{"testString"})) + 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/123456::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 UpdatePlacementGroup 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 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"} + + // 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) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + 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.UpdatePlacementGroupWithContext(ctx, updatePlacementGroupOptionsModel) + 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(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()) + + // 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{"testString"})) + 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/123456::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 UpdatePlacementGroup 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.UpdatePlacementGroup(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() + 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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdatePlacementGroup 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 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"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + 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 UpdatePlacementGroupOptions model with no property values + updatePlacementGroupOptionsModelNew := new(vpcv1.UpdatePlacementGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModelNew) + 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 UpdatePlacementGroup 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 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"} + + // Invoke operation + result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) - Operation response error`, func() { + version := "testString" + 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{"testString"})) + 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(1))})) + 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(1)) + 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 := "testString" + 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{"testString"})) + 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(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/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}, "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": "nvme", "type": "enum", "values": ["nvme"]}}], "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}], "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(1)) + 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{"testString"})) + 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(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/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}, "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": "nvme", "type": "enum", "values": ["nvme"]}}], "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}], "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(1)) + 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(1)) + 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(1)) + 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.BareMetalServerProfileCollectionNext) + 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.BareMetalServerProfileCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) - Operation response error`, func() { + version := "testString" + getBareMetalServerProfilePath := "/bare_metal_server/profiles/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(getBareMetalServerProfilePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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("testString") + 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 := "testString" + getBareMetalServerProfilePath := "/bare_metal_server/profiles/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(getBareMetalServerProfilePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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}, "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": "nvme", "type": "enum", "values": ["nvme"]}}], "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}`) + })) + }) + 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("testString") + 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{"testString"})) + 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}, "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": "nvme", "type": "enum", "values": ["nvme"]}}], "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}`) + })) + }) + 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("testString") + 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("testString") + 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("testString") + 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 := "testString" + 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{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["network_interfaces.subnet.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["network_interfaces.subnet.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["network_interfaces.subnet.name"]).To(Equal([]string{"testString"})) + 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(1)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetID = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetCRN = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetName = core.StringPtr("testString") + 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 := "testString" + 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{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["network_interfaces.subnet.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["network_interfaces.subnet.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["network_interfaces.subnet.name"]).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", `{"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-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) + })) + }) + 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(1)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetID = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetCRN = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetName = core.StringPtr("testString") + 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{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["network_interfaces.subnet.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["network_interfaces.subnet.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["network_interfaces.subnet.name"]).To(Equal([]string{"testString"})) + // 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-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) + })) + }) + 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(1)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetID = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetCRN = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetName = core.StringPtr("testString") + 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(1)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetID = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetCRN = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetName = core.StringPtr("testString") + 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(1)) + listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listBareMetalServersOptionsModel.Name = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("testString") + listBareMetalServersOptionsModel.VPCName = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetID = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetCRN = core.StringPtr("testString") + listBareMetalServersOptionsModel.NetworkInterfacesSubnetName = core.StringPtr("testString") + 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.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()) + }) + }) + }) + Describe(`CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) - Operation response error`, func() { + version := "testString" + 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{"testString"})) + 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("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 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 BareMetalServerPrimaryNetworkInterfacePrototype model + bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel + createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel + createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel + createBareMetalServerOptionsModel.Zone = zoneIdentityModel + createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") + createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} + createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createBareMetalServerOptionsModel.VPC = vpcIdentityModel + 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 := "testString" + 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{"testString"})) + 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/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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("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 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 BareMetalServerPrimaryNetworkInterfacePrototype model + bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel + createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel + createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel + createBareMetalServerOptionsModel.Zone = zoneIdentityModel + createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") + createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} + createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createBareMetalServerOptionsModel.VPC = vpcIdentityModel + 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{"testString"})) + 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-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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("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 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 BareMetalServerPrimaryNetworkInterfacePrototype model + bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel + createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel + createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel + createBareMetalServerOptionsModel.Zone = zoneIdentityModel + createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") + createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} + createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createBareMetalServerOptionsModel.VPC = vpcIdentityModel + 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("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 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 BareMetalServerPrimaryNetworkInterfacePrototype model + bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel + createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel + createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel + createBareMetalServerOptionsModel.Zone = zoneIdentityModel + createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") + createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} + createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createBareMetalServerOptionsModel.VPC = vpcIdentityModel + 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("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 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 BareMetalServerPrimaryNetworkInterfacePrototype model + bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the CreateBareMetalServerOptions model + createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) + createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel + createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel + createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel + createBareMetalServerOptionsModel.Zone = zoneIdentityModel + createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") + createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} + createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createBareMetalServerOptionsModel.VPC = vpcIdentityModel + 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 := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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": "VGhpcyBJcyBhIHRva2Vu", "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=VGhpcyBJcyBhIHRva2Vu"}`) + })) + }) + 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{"testString"})) + 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": "VGhpcyBJcyBhIHRva2Vu", "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=VGhpcyBJcyBhIHRva2Vu"}`) + })) + }) + 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 := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-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{"testString"})) + 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/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-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 := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-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{"testString"})) + 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": "nvme", "name": "my-bare-metal-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 := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-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{"testString"})) + 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": "nvme", "name": "my-bare-metal-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(`ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) - Operation response error`, func() { + version := "testString" + 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{"testString"})) + 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(1))})) + 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(1)) + 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 := "testString" + 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{"testString"})) + 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(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/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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}], "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}`) + })) + }) + 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(1)) + 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{"testString"})) + 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(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/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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}], "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}`) + })) + }) + 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(1)) + 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(1)) + 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(1)) + 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.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()) + }) + }) + }) + Describe(`CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) - Operation response error`, func() { + version := "testString" + 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{"testString"})) + 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("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 BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + + // 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 := "testString" + 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{"testString"})) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}`) + })) + }) + 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("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 BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + + // 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{"testString"})) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}`) + })) + }) + 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("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 BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + + // 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("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 BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + + // 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("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 BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + + // 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 := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}`) + })) + }) + 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{"testString"})) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}`) + })) + }) + 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 := "testString" + 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{"testString"})) + 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-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 := "testString" + 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{"testString"})) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}`) + })) + }) + 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-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{"testString"})) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}`) + })) + }) + 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-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-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-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 := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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(`DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions)`, func() { + version := "testString" + 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{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + 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 := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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{"testString"})) + 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-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 := "testString" + 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{"testString"})) + 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 BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + 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 := "testString" + 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{"testString"})) + 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/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-bare-metal-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + 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{"testString"})) + 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-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + 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 BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + 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 BareMetalServerPatch model + bareMetalServerPatchModel := new(vpcv1.BareMetalServerPatch) + bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + 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(`GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) - Operation response error`, func() { + version := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "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/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "user_accounts": [{"encrypted_password": "VGhpcyBpcyBhbiBlbmNvZGVkIGJ5dGUgYXJyYXku", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "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/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}, "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{"testString"})) + 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/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "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/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "user_accounts": [{"encrypted_password": "VGhpcyBpcyBhbiBlbmNvZGVkIGJ5dGUgYXJyYXku", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "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/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}, "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(`RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions)`, func() { + version := "testString" + 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{"testString"})) + 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()) + + // 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 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 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 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 := "testString" + 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() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(startBareMetalServerPath)) + Expect(req.Method).To(Equal("POST")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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()) + + // 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 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 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 := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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(1))})) + 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(1)) + 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 := "testString" + 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{"testString"})) + 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(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/volume/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "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(1)) + 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{"testString"})) + 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(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/volume/profiles?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "profiles": [{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "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(1)) + 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(1)) + 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(1)) + 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()) + }) + }) + }) + Describe(`GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) - Operation response error`, func() { + version := "testString" + getVolumeProfilePath := "/volume/profiles/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.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVolumeProfile 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 GetVolumeProfileOptions model + getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) + getVolumeProfileOptionsModel.Name = core.StringPtr("testString") + 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.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.GetVolumeProfile(getVolumeProfileOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions)`, func() { + version := "testString" + getVolumeProfilePath := "/volume/profiles/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.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}`) + })) + }) + It(`Invoke GetVolumeProfile 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 GetVolumeProfileOptions model + getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) + getVolumeProfileOptionsModel.Name = core.StringPtr("testString") + 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.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.GetVolumeProfile(getVolumeProfileOptionsModel) + 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.GetVolumeProfileWithContext(ctx, getVolumeProfileOptionsModel) + 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(getVolumeProfilePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}`) + })) + }) + It(`Invoke GetVolumeProfile 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.GetVolumeProfile(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("testString") + getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVolumeProfile 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 GetVolumeProfileOptions model + getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) + getVolumeProfileOptionsModel.Name = core.StringPtr("testString") + 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.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 GetVolumeProfileOptions model with no property values + getVolumeProfileOptionsModelNew := new(vpcv1.GetVolumeProfileOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModelNew) + 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 GetVolumeProfile 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 GetVolumeProfileOptions model + getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) + getVolumeProfileOptionsModel.Name = core.StringPtr("testString") + getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVolumes(listVolumesOptions *ListVolumesOptions) - Operation response error`, func() { + version := "testString" + 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(listVolumesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).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() { + 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(1)) + listVolumesOptionsModel.Name = core.StringPtr("testString") + listVolumesOptionsModel.ZoneName = 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.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.ListVolumes(listVolumesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVolumes(listVolumesOptions *ListVolumesOptions)`, func() { + version := "testString" + 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(listVolumesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).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"}, "volumes": [{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 ListVolumes 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 ListVolumesOptions model + listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) + listVolumesOptionsModel.Start = core.StringPtr("testString") + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVolumesOptionsModel.Name = core.StringPtr("testString") + listVolumesOptionsModel.ZoneName = 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.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.ListVolumes(listVolumesOptionsModel) + 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.ListVolumesWithContext(ctx, listVolumesOptionsModel) + 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(listVolumesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zone.name"]).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"}, "volumes": [{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 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()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListVolumes(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(1)) + listVolumesOptionsModel.Name = core.StringPtr("testString") + listVolumesOptionsModel.ZoneName = 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.ListVolumes(listVolumesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVolumes 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 ListVolumesOptions model + listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) + listVolumesOptionsModel.Start = core.StringPtr("testString") + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVolumesOptionsModel.Name = core.StringPtr("testString") + listVolumesOptionsModel.ZoneName = 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.ListVolumes(listVolumesOptionsModel) + 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(1)) + listVolumesOptionsModel.Name = core.StringPtr("testString") + listVolumesOptionsModel.ZoneName = 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 + 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()) + }) + }) + }) + Describe(`CreateVolume(createVolumeOptions *CreateVolumeOptions) - Operation response error`, func() { + version := "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(createVolumePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateVolume 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("5iops-tier") + + // 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/dffc98a0f1f0f95f6613b3b752286b87: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{"testString"} + 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.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.CreateVolume(createVolumeOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateVolume(createVolumeOptions *CreateVolumeOptions)`, func() { + version := "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(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{"testString"})) + 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", `{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 CreateVolume 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("5iops-tier") + + // 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/dffc98a0f1f0f95f6613b3b752286b87: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{"testString"} + 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.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.CreateVolume(createVolumeOptionsModel) + 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.CreateVolumeWithContext(ctx, createVolumeOptionsModel) + 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(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{"testString"})) + 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, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 CreateVolume 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.CreateVolume(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("5iops-tier") + + // 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/dffc98a0f1f0f95f6613b3b752286b87: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{"testString"} + 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.CreateVolume(createVolumeOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateVolume 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 VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") + + // 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/dffc98a0f1f0f95f6613b3b752286b87: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{"testString"} + 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.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 CreateVolumeOptions model with no property values + createVolumeOptionsModelNew := new(vpcv1.CreateVolumeOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateVolume(createVolumeOptionsModelNew) + 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 CreateVolume 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("5iops-tier") + + // 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/dffc98a0f1f0f95f6613b3b752286b87: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{"testString"} + 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.CreateVolume(createVolumeOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions)`, func() { + version := "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{"testString"})) + 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 := "testString" + 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(getVolumePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVolume 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 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.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.GetVolume(getVolumeOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVolume(getVolumeOptions *GetVolumeOptions)`, func() { + version := "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(getVolumePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 GetVolume 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 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.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.GetVolume(getVolumeOptionsModel) + 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.GetVolumeWithContext(ctx, getVolumeOptionsModel) + 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(getVolumePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 GetVolume 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.GetVolume(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVolume 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 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.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 GetVolumeOptions model with no property values + getVolumeOptionsModelNew := new(vpcv1.GetVolumeOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModelNew) + 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 GetVolume 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 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.GetVolume(getVolumeOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) - Operation response error`, func() { + version := "testString" + 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{"testString"})) + 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() { + version := "testString" + 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{"testString"})) + 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, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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() + }) + }) + 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")) + + // 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{"testString"})) + 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, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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`, func() { + 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.UpdateVolume(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateVolume 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 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.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 UpdateVolumeOptions model with no property values + updateVolumeOptionsModelNew := new(vpcv1.UpdateVolumeOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModelNew) + 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(`DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions)`, func() { + version := "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(deleteSnapshotsPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(204) + })) + }) + It(`Invoke DeleteSnapshots 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.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 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()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) - Operation response error`, func() { + version := "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(listSnapshotsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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{"testString"})) + Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"testString"})) + 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 ListSnapshots 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 ListSnapshotsOptions model + listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) + listSnapshotsOptionsModel.Start = core.StringPtr("testString") + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + 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.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.ListSnapshots(listSnapshotsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions)`, func() { + version := "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(listSnapshotsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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{"testString"})) + Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"testString"})) + 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/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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}], "total_count": 132}`) + })) + }) + It(`Invoke ListSnapshots 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 ListSnapshotsOptions model + listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) + listSnapshotsOptionsModel.Start = core.StringPtr("testString") + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + 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.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.ListSnapshots(listSnapshotsOptionsModel) + 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.ListSnapshotsWithContext(ctx, listSnapshotsOptionsModel) + 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(listSnapshotsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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{"testString"})) + Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"testString"})) + 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/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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}], "total_count": 132}`) + })) + }) + 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()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListSnapshots(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(1)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListSnapshots(listSnapshotsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListSnapshots 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 ListSnapshotsOptions model + listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) + listSnapshotsOptionsModel.Start = core.StringPtr("testString") + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + 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.ListSnapshots(listSnapshotsOptionsModel) + 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 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(1)) + listSnapshotsOptionsModel.Tag = core.StringPtr("testString") + listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSnapshotsOptionsModel.Name = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") + listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("testString") + listSnapshotsOptionsModel.Sort = core.StringPtr("name") + listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") + 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(`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()) + }) + }) + }) + Describe(`CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) - Operation response error`, func() { + version := "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(createSnapshotPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateSnapshot 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 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("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{"testString"} + 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.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.CreateSnapshot(createSnapshotOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions)`, func() { + version := "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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}`) + })) + }) + It(`Invoke CreateSnapshot 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 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("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{"testString"} + 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.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.CreateSnapshot(createSnapshotOptionsModel) + 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.CreateSnapshotWithContext(ctx, createSnapshotOptionsModel) + 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(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.Query()["version"]).To(Equal([]string{"testString"})) + 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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}`) + })) + }) + It(`Invoke CreateSnapshot 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.CreateSnapshot(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("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{"testString"} + 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.CreateSnapshot(createSnapshotOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateSnapshot 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("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{"testString"} + 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.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 CreateSnapshotOptions model with no property values + createSnapshotOptionsModelNew := new(vpcv1.CreateSnapshotOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateSnapshot(createSnapshotOptionsModelNew) + 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 CreateSnapshot 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") + + // Construct an instance of the VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{"testString"} + 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.CreateSnapshot(createSnapshotOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions)`, func() { + version := "testString" + 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{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + 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 := "testString" + 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(getSnapshotPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetSnapshot 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 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.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.GetSnapshot(getSnapshotOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSnapshot(getSnapshotOptions *GetSnapshotOptions)`, func() { + version := "testString" + 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(getSnapshotPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}`) + })) + }) + It(`Invoke GetSnapshot 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 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.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.GetSnapshot(getSnapshotOptionsModel) + 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.GetSnapshotWithContext(ctx, getSnapshotOptionsModel) + 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(getSnapshotPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}`) + })) + }) + It(`Invoke GetSnapshot 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.GetSnapshot(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetSnapshot(getSnapshotOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetSnapshot 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 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.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 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() + }) + }) + 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 GetSnapshot 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 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.GetSnapshot(getSnapshotOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) - Operation response error`, func() { + version := "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(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{"testString"})) + 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 UpdateSnapshot 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 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.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.UpdateSnapshot(updateSnapshotOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions)`, func() { + version := "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(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{"testString"})) + 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", `{"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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}`) + })) + }) + It(`Invoke UpdateSnapshot 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 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.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.UpdateSnapshot(updateSnapshotOptionsModel) + 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.UpdateSnapshotWithContext(ctx, updateSnapshotOptionsModel) + 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(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{"testString"})) + 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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}`) + })) + }) + It(`Invoke UpdateSnapshot 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.UpdateSnapshot(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 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.UpdateSnapshot(updateSnapshotOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateSnapshot 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 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.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 UpdateSnapshotOptions model with no property values + updateSnapshotOptionsModelNew := new(vpcv1.UpdateSnapshotOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateSnapshot(updateSnapshotOptionsModelNew) + 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 UpdateSnapshot 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 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.UpdateSnapshot(updateSnapshotOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListRegions(listRegionsOptions *ListRegionsOptions) - Operation response error`, func() { + version := "testString" + 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(listRegionsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListRegions 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 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.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.ListRegions(listRegionsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListRegions(listRegionsOptions *ListRegionsOptions)`, func() { + version := "testString" + 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(listRegionsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"regions": [{"endpoint": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}`) + })) + }) + It(`Invoke ListRegions 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 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.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.ListRegions(listRegionsOptionsModel) + 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.ListRegionsWithContext(ctx, listRegionsOptionsModel) + 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(listRegionsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}`) + })) + }) + It(`Invoke ListRegions 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.ListRegions(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListRegions(listRegionsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListRegions 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 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.ListRegions(listRegionsOptionsModel) + 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 ListRegions 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 ListRegionsOptions model + listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) + listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetRegion(getRegionOptions *GetRegionOptions) - Operation response error`, func() { + version := "testString" + getRegionPath := "/regions/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.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetRegion 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 GetRegionOptions model + getRegionOptionsModel := new(vpcv1.GetRegionOptions) + getRegionOptionsModel.Name = core.StringPtr("testString") + 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.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.GetRegion(getRegionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetRegion(getRegionOptions *GetRegionOptions)`, func() { + version := "testString" + getRegionPath := "/regions/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.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"endpoint": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}`) + })) + }) + It(`Invoke GetRegion 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 GetRegionOptions model + getRegionOptionsModel := new(vpcv1.GetRegionOptions) + getRegionOptionsModel.Name = core.StringPtr("testString") + 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.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.GetRegion(getRegionOptionsModel) + 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.GetRegionWithContext(ctx, getRegionOptionsModel) + 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(getRegionPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}`) + })) + }) + It(`Invoke GetRegion 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.GetRegion(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("testString") + getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetRegion(getRegionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetRegion 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 GetRegionOptions model + getRegionOptionsModel := new(vpcv1.GetRegionOptions) + getRegionOptionsModel.Name = core.StringPtr("testString") + 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.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 GetRegionOptions model with no property values + getRegionOptionsModelNew := new(vpcv1.GetRegionOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetRegion(getRegionOptionsModelNew) + 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 GetRegion 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 GetRegionOptions model + getRegionOptionsModel := new(vpcv1.GetRegionOptions) + getRegionOptionsModel.Name = core.StringPtr("testString") + getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) - Operation response error`, func() { + version := "testString" + listRegionZonesPath := "/regions/testString/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(listRegionZonesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListRegionZones 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 ListRegionZonesOptions model + listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) + listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") + 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.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.ListRegionZones(listRegionZonesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions)`, func() { + version := "testString" + listRegionZonesPath := "/regions/testString/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(listRegionZonesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"zones": [{"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"}]}`) + })) + }) + It(`Invoke ListRegionZones 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 ListRegionZonesOptions model + listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) + listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") + 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.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.ListRegionZones(listRegionZonesOptionsModel) + 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.ListRegionZonesWithContext(ctx, listRegionZonesOptionsModel) + 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(listRegionZonesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"zones": [{"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"}]}`) + })) + }) + It(`Invoke ListRegionZones 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.ListRegionZones(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("testString") + listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListRegionZones 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 ListRegionZonesOptions model + listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) + listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") + 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.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 ListRegionZonesOptions model with no property values + listRegionZonesOptionsModelNew := new(vpcv1.ListRegionZonesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModelNew) + 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 ListRegionZones 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 ListRegionZonesOptions model + listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) + listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") + listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) - Operation response error`, func() { + version := "testString" + getRegionZonePath := "/regions/testString/zones/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.Query()["version"]).To(Equal([]string{"testString"})) + 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 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()) + + // Construct an instance of the GetRegionZoneOptions model + getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) + getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") + getRegionZoneOptionsModel.Name = core.StringPtr("testString") + 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()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions)`, func() { + version := "testString" + getRegionZonePath := "/regions/testString/zones/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.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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"}`) + })) + }) + 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("testString") + getRegionZoneOptionsModel.Name = core.StringPtr("testString") + 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`, func() { + BeforeEach(func() { + testServer = httptest.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.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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"}`) + })) + }) + 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("testString") + getRegionZoneOptionsModel.Name = core.StringPtr("testString") + 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()) + + }) + It(`Invoke GetRegionZone 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 GetRegionZoneOptions model + getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) + getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") + getRegionZoneOptionsModel.Name = core.StringPtr("testString") + 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()) + 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() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + 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()) + + // Construct an instance of the GetRegionZoneOptions model + getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) + getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") + getRegionZoneOptionsModel.Name = core.StringPtr("testString") + getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListPublicGateways(listPublicGatewaysOptions *ListPublicGatewaysOptions) - Operation response error`, func() { + version := "testString" + listPublicGatewaysPath := "/public_gateways" + 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(listPublicGatewaysPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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 {`) + })) + }) + It(`Invoke ListPublicGateways 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 ListPublicGatewaysOptions model + listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) + listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") + listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listPublicGatewaysOptionsModel.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.ListPublicGateways(listPublicGatewaysOptionsModel) + 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.ListPublicGateways(listPublicGatewaysOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListPublicGateways(listPublicGatewaysOptions *ListPublicGatewaysOptions)`, func() { + version := "testString" + listPublicGatewaysPath := "/public_gateways" + 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(listPublicGatewaysPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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/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/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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 ListPublicGatewaysOptions model + listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) + listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") + listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listPublicGatewaysOptionsModel.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.ListPublicGatewaysWithContext(ctx, listPublicGatewaysOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListPublicGateways(listPublicGatewaysOptionsModel) + 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.ListPublicGatewaysWithContext(ctx, listPublicGatewaysOptionsModel) + 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(listPublicGatewaysPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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/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/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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.ListPublicGateways(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListPublicGatewaysOptions model + listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) + listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") + listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listPublicGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListPublicGateways(listPublicGatewaysOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListPublicGateways 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 ListPublicGatewaysOptions model + listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) + listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") + listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listPublicGatewaysOptionsModel.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.ListPublicGateways(listPublicGatewaysOptionsModel) + 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 ListPublicGateways 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 ListPublicGatewaysOptions model + listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) + listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") + listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listPublicGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListPublicGateways(listPublicGatewaysOptionsModel) + 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.PublicGatewayCollection) + nextObject := new(vpcv1.PublicGatewayCollectionNext) + 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.PublicGatewayCollection) + + 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.PublicGatewayCollection) + nextObject := new(vpcv1.PublicGatewayCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreatePublicGateway(createPublicGatewayOptions *CreatePublicGatewayOptions) - Operation response error`, func() { + version := "testString" + createPublicGatewayPath := "/public_gateways" + 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(createPublicGatewayPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreatePublicGateway 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 VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("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 PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model + publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) + publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePublicGatewayOptions model + createPublicGatewayOptionsModel := new(vpcv1.CreatePublicGatewayOptions) + createPublicGatewayOptionsModel.VPC = vpcIdentityModel + createPublicGatewayOptionsModel.Zone = zoneIdentityModel + createPublicGatewayOptionsModel.FloatingIP = publicGatewayFloatingIPPrototypeModel + createPublicGatewayOptionsModel.Name = core.StringPtr("my-public-gateway") + createPublicGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPublicGatewayOptionsModel.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.CreatePublicGateway(createPublicGatewayOptionsModel) + 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.CreatePublicGateway(createPublicGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreatePublicGateway(createPublicGatewayOptions *CreatePublicGatewayOptions)`, func() { + version := "testString" + createPublicGatewayPath := "/public_gateways" + 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(createPublicGatewayPath)) + 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{"testString"})) + 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", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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 VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("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 PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model + publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) + publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePublicGatewayOptions model + createPublicGatewayOptionsModel := new(vpcv1.CreatePublicGatewayOptions) + createPublicGatewayOptionsModel.VPC = vpcIdentityModel + createPublicGatewayOptionsModel.Zone = zoneIdentityModel + createPublicGatewayOptionsModel.FloatingIP = publicGatewayFloatingIPPrototypeModel + createPublicGatewayOptionsModel.Name = core.StringPtr("my-public-gateway") + createPublicGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPublicGatewayOptionsModel.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.CreatePublicGatewayWithContext(ctx, createPublicGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreatePublicGateway(createPublicGatewayOptionsModel) + 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.CreatePublicGatewayWithContext(ctx, createPublicGatewayOptionsModel) + 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(createPublicGatewayPath)) + 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{"testString"})) + 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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.CreatePublicGateway(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("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 PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model + publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) + publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePublicGatewayOptions model + createPublicGatewayOptionsModel := new(vpcv1.CreatePublicGatewayOptions) + createPublicGatewayOptionsModel.VPC = vpcIdentityModel + createPublicGatewayOptionsModel.Zone = zoneIdentityModel + createPublicGatewayOptionsModel.FloatingIP = publicGatewayFloatingIPPrototypeModel + createPublicGatewayOptionsModel.Name = core.StringPtr("my-public-gateway") + createPublicGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreatePublicGateway(createPublicGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreatePublicGateway 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 VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("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 PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model + publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) + publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePublicGatewayOptions model + createPublicGatewayOptionsModel := new(vpcv1.CreatePublicGatewayOptions) + createPublicGatewayOptionsModel.VPC = vpcIdentityModel + createPublicGatewayOptionsModel.Zone = zoneIdentityModel + createPublicGatewayOptionsModel.FloatingIP = publicGatewayFloatingIPPrototypeModel + createPublicGatewayOptionsModel.Name = core.StringPtr("my-public-gateway") + createPublicGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPublicGatewayOptionsModel.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.CreatePublicGateway(createPublicGatewayOptionsModel) + 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 CreatePublicGatewayOptions model with no property values + createPublicGatewayOptionsModelNew := new(vpcv1.CreatePublicGatewayOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreatePublicGateway(createPublicGatewayOptionsModelNew) + 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 CreatePublicGateway 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 VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("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 PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model + publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) + publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreatePublicGatewayOptions model + createPublicGatewayOptionsModel := new(vpcv1.CreatePublicGatewayOptions) + createPublicGatewayOptionsModel.VPC = vpcIdentityModel + createPublicGatewayOptionsModel.Zone = zoneIdentityModel + createPublicGatewayOptionsModel.FloatingIP = publicGatewayFloatingIPPrototypeModel + createPublicGatewayOptionsModel.Name = core.StringPtr("my-public-gateway") + createPublicGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel + createPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreatePublicGateway(createPublicGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeletePublicGateway(deletePublicGatewayOptions *DeletePublicGatewayOptions)`, func() { + version := "testString" + deletePublicGatewayPath := "/public_gateways/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(deletePublicGatewayPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeletePublicGateway 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.DeletePublicGateway(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeletePublicGatewayOptions model + deletePublicGatewayOptionsModel := new(vpcv1.DeletePublicGatewayOptions) + deletePublicGatewayOptionsModel.ID = core.StringPtr("testString") + deletePublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeletePublicGateway(deletePublicGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeletePublicGateway 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 DeletePublicGatewayOptions model + deletePublicGatewayOptionsModel := new(vpcv1.DeletePublicGatewayOptions) + deletePublicGatewayOptionsModel.ID = core.StringPtr("testString") + deletePublicGatewayOptionsModel.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.DeletePublicGateway(deletePublicGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeletePublicGatewayOptions model with no property values + deletePublicGatewayOptionsModelNew := new(vpcv1.DeletePublicGatewayOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeletePublicGateway(deletePublicGatewayOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetPublicGateway(getPublicGatewayOptions *GetPublicGatewayOptions) - Operation response error`, func() { + version := "testString" + getPublicGatewayPath := "/public_gateways/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(getPublicGatewayPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetPublicGateway 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 GetPublicGatewayOptions model + getPublicGatewayOptionsModel := new(vpcv1.GetPublicGatewayOptions) + getPublicGatewayOptionsModel.ID = core.StringPtr("testString") + getPublicGatewayOptionsModel.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.GetPublicGateway(getPublicGatewayOptionsModel) + 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.GetPublicGateway(getPublicGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetPublicGateway(getPublicGatewayOptions *GetPublicGatewayOptions)`, func() { + version := "testString" + getPublicGatewayPath := "/public_gateways/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(getPublicGatewayPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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 GetPublicGatewayOptions model + getPublicGatewayOptionsModel := new(vpcv1.GetPublicGatewayOptions) + getPublicGatewayOptionsModel.ID = core.StringPtr("testString") + getPublicGatewayOptionsModel.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.GetPublicGatewayWithContext(ctx, getPublicGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetPublicGateway(getPublicGatewayOptionsModel) + 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.GetPublicGatewayWithContext(ctx, getPublicGatewayOptionsModel) + 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(getPublicGatewayPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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.GetPublicGateway(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetPublicGatewayOptions model + getPublicGatewayOptionsModel := new(vpcv1.GetPublicGatewayOptions) + getPublicGatewayOptionsModel.ID = core.StringPtr("testString") + getPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetPublicGateway(getPublicGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetPublicGateway 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 GetPublicGatewayOptions model + getPublicGatewayOptionsModel := new(vpcv1.GetPublicGatewayOptions) + getPublicGatewayOptionsModel.ID = core.StringPtr("testString") + getPublicGatewayOptionsModel.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.GetPublicGateway(getPublicGatewayOptionsModel) + 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 GetPublicGatewayOptions model with no property values + getPublicGatewayOptionsModelNew := new(vpcv1.GetPublicGatewayOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetPublicGateway(getPublicGatewayOptionsModelNew) + 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 GetPublicGateway 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 GetPublicGatewayOptions model + getPublicGatewayOptionsModel := new(vpcv1.GetPublicGatewayOptions) + getPublicGatewayOptionsModel.ID = core.StringPtr("testString") + getPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetPublicGateway(getPublicGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdatePublicGateway(updatePublicGatewayOptions *UpdatePublicGatewayOptions) - Operation response error`, func() { + version := "testString" + updatePublicGatewayPath := "/public_gateways/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(updatePublicGatewayPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdatePublicGateway 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 PublicGatewayPatch model + publicGatewayPatchModel := new(vpcv1.PublicGatewayPatch) + publicGatewayPatchModel.Name = core.StringPtr("my-public-gateway") + publicGatewayPatchModelAsPatch, asPatchErr := publicGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdatePublicGatewayOptions model + updatePublicGatewayOptionsModel := new(vpcv1.UpdatePublicGatewayOptions) + updatePublicGatewayOptionsModel.ID = core.StringPtr("testString") + updatePublicGatewayOptionsModel.PublicGatewayPatch = publicGatewayPatchModelAsPatch + updatePublicGatewayOptionsModel.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.UpdatePublicGateway(updatePublicGatewayOptionsModel) + 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.UpdatePublicGateway(updatePublicGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdatePublicGateway(updatePublicGatewayOptions *UpdatePublicGatewayOptions)`, func() { + version := "testString" + updatePublicGatewayPath := "/public_gateways/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(updatePublicGatewayPath)) + 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{"testString"})) + 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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 PublicGatewayPatch model + publicGatewayPatchModel := new(vpcv1.PublicGatewayPatch) + publicGatewayPatchModel.Name = core.StringPtr("my-public-gateway") + publicGatewayPatchModelAsPatch, asPatchErr := publicGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdatePublicGatewayOptions model + updatePublicGatewayOptionsModel := new(vpcv1.UpdatePublicGatewayOptions) + updatePublicGatewayOptionsModel.ID = core.StringPtr("testString") + updatePublicGatewayOptionsModel.PublicGatewayPatch = publicGatewayPatchModelAsPatch + updatePublicGatewayOptionsModel.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.UpdatePublicGatewayWithContext(ctx, updatePublicGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdatePublicGateway(updatePublicGatewayOptionsModel) + 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.UpdatePublicGatewayWithContext(ctx, updatePublicGatewayOptionsModel) + 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(updatePublicGatewayPath)) + 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{"testString"})) + 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { + 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.UpdatePublicGateway(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the PublicGatewayPatch model + publicGatewayPatchModel := new(vpcv1.PublicGatewayPatch) + publicGatewayPatchModel.Name = core.StringPtr("my-public-gateway") + publicGatewayPatchModelAsPatch, asPatchErr := publicGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdatePublicGatewayOptions model + updatePublicGatewayOptionsModel := new(vpcv1.UpdatePublicGatewayOptions) + updatePublicGatewayOptionsModel.ID = core.StringPtr("testString") + updatePublicGatewayOptionsModel.PublicGatewayPatch = publicGatewayPatchModelAsPatch + updatePublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdatePublicGateway(updatePublicGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdatePublicGateway 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 PublicGatewayPatch model + publicGatewayPatchModel := new(vpcv1.PublicGatewayPatch) + publicGatewayPatchModel.Name = core.StringPtr("my-public-gateway") + publicGatewayPatchModelAsPatch, asPatchErr := publicGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdatePublicGatewayOptions model + updatePublicGatewayOptionsModel := new(vpcv1.UpdatePublicGatewayOptions) + updatePublicGatewayOptionsModel.ID = core.StringPtr("testString") + updatePublicGatewayOptionsModel.PublicGatewayPatch = publicGatewayPatchModelAsPatch + updatePublicGatewayOptionsModel.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.UpdatePublicGateway(updatePublicGatewayOptionsModel) + 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 UpdatePublicGatewayOptions model with no property values + updatePublicGatewayOptionsModelNew := new(vpcv1.UpdatePublicGatewayOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdatePublicGateway(updatePublicGatewayOptionsModelNew) + 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 UpdatePublicGateway 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 PublicGatewayPatch model + publicGatewayPatchModel := new(vpcv1.PublicGatewayPatch) + publicGatewayPatchModel.Name = core.StringPtr("my-public-gateway") + publicGatewayPatchModelAsPatch, asPatchErr := publicGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdatePublicGatewayOptions model + updatePublicGatewayOptionsModel := new(vpcv1.UpdatePublicGatewayOptions) + updatePublicGatewayOptionsModel.ID = core.StringPtr("testString") + updatePublicGatewayOptionsModel.PublicGatewayPatch = publicGatewayPatchModelAsPatch + updatePublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdatePublicGateway(updatePublicGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListFloatingIps(listFloatingIpsOptions *ListFloatingIpsOptions) - Operation response error`, func() { + version := "testString" + listFloatingIpsPath := "/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(listFloatingIpsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).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 ListFloatingIps 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 ListFloatingIpsOptions model + listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) + listFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listFloatingIpsOptionsModel.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.ListFloatingIps(listFloatingIpsOptionsModel) + 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.ListFloatingIps(listFloatingIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListFloatingIps(listFloatingIpsOptions *ListFloatingIpsOptions)`, func() { + version := "testString" + listFloatingIpsPath := "/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(listFloatingIpsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).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", `{"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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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}`) + })) + }) + It(`Invoke ListFloatingIps 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 ListFloatingIpsOptions model + listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) + listFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listFloatingIpsOptionsModel.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.ListFloatingIpsWithContext(ctx, listFloatingIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListFloatingIps(listFloatingIpsOptionsModel) + 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.ListFloatingIpsWithContext(ctx, listFloatingIpsOptionsModel) + 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(listFloatingIpsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).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", `{"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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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}`) + })) + }) + It(`Invoke ListFloatingIps 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.ListFloatingIps(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListFloatingIpsOptions model + listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) + listFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListFloatingIps(listFloatingIpsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListFloatingIps 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 ListFloatingIpsOptions model + listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) + listFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listFloatingIpsOptionsModel.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.ListFloatingIps(listFloatingIpsOptionsModel) + 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 ListFloatingIps 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 ListFloatingIpsOptions model + listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) + listFloatingIpsOptionsModel.Start = core.StringPtr("testString") + listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listFloatingIpsOptionsModel.Sort = core.StringPtr("name") + listFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListFloatingIps(listFloatingIpsOptionsModel) + 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.FloatingIPCollection) + nextObject := new(vpcv1.FloatingIPCollectionNext) + 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.FloatingIPCollection) + + 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.FloatingIPCollection) + nextObject := new(vpcv1.FloatingIPCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateFloatingIP(createFloatingIPOptions *CreateFloatingIPOptions) - Operation response error`, func() { + version := "testString" + createFloatingIPPath := "/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(createFloatingIPPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateFloatingIP 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 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 FloatingIPPrototypeFloatingIPByZone model + floatingIPPrototypeModel := new(vpcv1.FloatingIPPrototypeFloatingIPByZone) + floatingIPPrototypeModel.Name = core.StringPtr("my-floating-ip") + floatingIPPrototypeModel.ResourceGroup = resourceGroupIdentityModel + floatingIPPrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateFloatingIPOptions model + createFloatingIPOptionsModel := new(vpcv1.CreateFloatingIPOptions) + createFloatingIPOptionsModel.FloatingIPPrototype = floatingIPPrototypeModel + createFloatingIPOptionsModel.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.CreateFloatingIP(createFloatingIPOptionsModel) + 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.CreateFloatingIP(createFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateFloatingIP(createFloatingIPOptions *CreateFloatingIPOptions)`, func() { + version := "testString" + createFloatingIPPath := "/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(createFloatingIPPath)) + 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{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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() { + 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 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 FloatingIPPrototypeFloatingIPByZone model + floatingIPPrototypeModel := new(vpcv1.FloatingIPPrototypeFloatingIPByZone) + floatingIPPrototypeModel.Name = core.StringPtr("my-floating-ip") + floatingIPPrototypeModel.ResourceGroup = resourceGroupIdentityModel + floatingIPPrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateFloatingIPOptions model + createFloatingIPOptionsModel := new(vpcv1.CreateFloatingIPOptions) + createFloatingIPOptionsModel.FloatingIPPrototype = floatingIPPrototypeModel + createFloatingIPOptionsModel.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.CreateFloatingIPWithContext(ctx, createFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateFloatingIP(createFloatingIPOptionsModel) + 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.CreateFloatingIPWithContext(ctx, createFloatingIPOptionsModel) + 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(createFloatingIPPath)) + 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{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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() { + 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.CreateFloatingIP(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 ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the FloatingIPPrototypeFloatingIPByZone model + floatingIPPrototypeModel := new(vpcv1.FloatingIPPrototypeFloatingIPByZone) + floatingIPPrototypeModel.Name = core.StringPtr("my-floating-ip") + floatingIPPrototypeModel.ResourceGroup = resourceGroupIdentityModel + floatingIPPrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateFloatingIPOptions model + createFloatingIPOptionsModel := new(vpcv1.CreateFloatingIPOptions) + createFloatingIPOptionsModel.FloatingIPPrototype = floatingIPPrototypeModel + createFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateFloatingIP(createFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateFloatingIP 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 ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the FloatingIPPrototypeFloatingIPByZone model + floatingIPPrototypeModel := new(vpcv1.FloatingIPPrototypeFloatingIPByZone) + floatingIPPrototypeModel.Name = core.StringPtr("my-floating-ip") + floatingIPPrototypeModel.ResourceGroup = resourceGroupIdentityModel + floatingIPPrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateFloatingIPOptions model + createFloatingIPOptionsModel := new(vpcv1.CreateFloatingIPOptions) + createFloatingIPOptionsModel.FloatingIPPrototype = floatingIPPrototypeModel + createFloatingIPOptionsModel.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.CreateFloatingIP(createFloatingIPOptionsModel) + 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 CreateFloatingIPOptions model with no property values + createFloatingIPOptionsModelNew := new(vpcv1.CreateFloatingIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateFloatingIP(createFloatingIPOptionsModelNew) + 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 CreateFloatingIP 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") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the FloatingIPPrototypeFloatingIPByZone model + floatingIPPrototypeModel := new(vpcv1.FloatingIPPrototypeFloatingIPByZone) + floatingIPPrototypeModel.Name = core.StringPtr("my-floating-ip") + floatingIPPrototypeModel.ResourceGroup = resourceGroupIdentityModel + floatingIPPrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateFloatingIPOptions model + createFloatingIPOptionsModel := new(vpcv1.CreateFloatingIPOptions) + createFloatingIPOptionsModel.FloatingIPPrototype = floatingIPPrototypeModel + createFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateFloatingIP(createFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteFloatingIP(deleteFloatingIPOptions *DeleteFloatingIPOptions)`, func() { + version := "testString" + deleteFloatingIPPath := "/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(deleteFloatingIPPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteFloatingIP 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.DeleteFloatingIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteFloatingIPOptions model + deleteFloatingIPOptionsModel := new(vpcv1.DeleteFloatingIPOptions) + deleteFloatingIPOptionsModel.ID = core.StringPtr("testString") + deleteFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteFloatingIP(deleteFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteFloatingIP 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 DeleteFloatingIPOptions model + deleteFloatingIPOptionsModel := new(vpcv1.DeleteFloatingIPOptions) + deleteFloatingIPOptionsModel.ID = core.StringPtr("testString") + deleteFloatingIPOptionsModel.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.DeleteFloatingIP(deleteFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteFloatingIPOptions model with no property values + deleteFloatingIPOptionsModelNew := new(vpcv1.DeleteFloatingIPOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteFloatingIP(deleteFloatingIPOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetFloatingIP(getFloatingIPOptions *GetFloatingIPOptions) - Operation response error`, func() { + version := "testString" + getFloatingIPPath := "/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(getFloatingIPPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetFloatingIP 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 GetFloatingIPOptions model + getFloatingIPOptionsModel := new(vpcv1.GetFloatingIPOptions) + getFloatingIPOptionsModel.ID = core.StringPtr("testString") + getFloatingIPOptionsModel.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.GetFloatingIP(getFloatingIPOptionsModel) + 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.GetFloatingIP(getFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetFloatingIP(getFloatingIPOptions *GetFloatingIPOptions)`, func() { + version := "testString" + getFloatingIPPath := "/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(getFloatingIPPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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() { + 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 GetFloatingIPOptions model + getFloatingIPOptionsModel := new(vpcv1.GetFloatingIPOptions) + getFloatingIPOptionsModel.ID = core.StringPtr("testString") + getFloatingIPOptionsModel.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.GetFloatingIPWithContext(ctx, getFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetFloatingIP(getFloatingIPOptionsModel) + 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.GetFloatingIPWithContext(ctx, getFloatingIPOptionsModel) + 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(getFloatingIPPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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() { + 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.GetFloatingIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetFloatingIPOptions model + getFloatingIPOptionsModel := new(vpcv1.GetFloatingIPOptions) + getFloatingIPOptionsModel.ID = core.StringPtr("testString") + getFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetFloatingIP(getFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetFloatingIP 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 GetFloatingIPOptions model + getFloatingIPOptionsModel := new(vpcv1.GetFloatingIPOptions) + getFloatingIPOptionsModel.ID = core.StringPtr("testString") + getFloatingIPOptionsModel.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.GetFloatingIP(getFloatingIPOptionsModel) + 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 GetFloatingIPOptions model with no property values + getFloatingIPOptionsModelNew := new(vpcv1.GetFloatingIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetFloatingIP(getFloatingIPOptionsModelNew) + 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 GetFloatingIP 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 GetFloatingIPOptions model + getFloatingIPOptionsModel := new(vpcv1.GetFloatingIPOptions) + getFloatingIPOptionsModel.ID = core.StringPtr("testString") + getFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetFloatingIP(getFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateFloatingIP(updateFloatingIPOptions *UpdateFloatingIPOptions) - Operation response error`, func() { + version := "testString" + updateFloatingIPPath := "/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(updateFloatingIPPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateFloatingIP 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 FloatingIPTargetPatchNetworkInterfaceIdentityByID model + floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchNetworkInterfaceIdentityByID) + floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + + // Construct an instance of the FloatingIPPatch model + floatingIPPatchModel := new(vpcv1.FloatingIPPatch) + floatingIPPatchModel.Name = core.StringPtr("my-floating-ip") + floatingIPPatchModel.Target = floatingIPTargetPatchModel + floatingIPPatchModelAsPatch, asPatchErr := floatingIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateFloatingIPOptions model + updateFloatingIPOptionsModel := new(vpcv1.UpdateFloatingIPOptions) + updateFloatingIPOptionsModel.ID = core.StringPtr("testString") + updateFloatingIPOptionsModel.FloatingIPPatch = floatingIPPatchModelAsPatch + updateFloatingIPOptionsModel.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.UpdateFloatingIP(updateFloatingIPOptionsModel) + 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.UpdateFloatingIP(updateFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateFloatingIP(updateFloatingIPOptions *UpdateFloatingIPOptions)`, func() { + version := "testString" + updateFloatingIPPath := "/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(updateFloatingIPPath)) + 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{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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() { + 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 FloatingIPTargetPatchNetworkInterfaceIdentityByID model + floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchNetworkInterfaceIdentityByID) + floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + + // Construct an instance of the FloatingIPPatch model + floatingIPPatchModel := new(vpcv1.FloatingIPPatch) + floatingIPPatchModel.Name = core.StringPtr("my-floating-ip") + floatingIPPatchModel.Target = floatingIPTargetPatchModel + floatingIPPatchModelAsPatch, asPatchErr := floatingIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateFloatingIPOptions model + updateFloatingIPOptionsModel := new(vpcv1.UpdateFloatingIPOptions) + updateFloatingIPOptionsModel.ID = core.StringPtr("testString") + updateFloatingIPOptionsModel.FloatingIPPatch = floatingIPPatchModelAsPatch + updateFloatingIPOptionsModel.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.UpdateFloatingIPWithContext(ctx, updateFloatingIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateFloatingIP(updateFloatingIPOptionsModel) + 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.UpdateFloatingIPWithContext(ctx, updateFloatingIPOptionsModel) + 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(updateFloatingIPPath)) + 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{"testString"})) + 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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() { + 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.UpdateFloatingIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the FloatingIPTargetPatchNetworkInterfaceIdentityByID model + floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchNetworkInterfaceIdentityByID) + floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + + // Construct an instance of the FloatingIPPatch model + floatingIPPatchModel := new(vpcv1.FloatingIPPatch) + floatingIPPatchModel.Name = core.StringPtr("my-floating-ip") + floatingIPPatchModel.Target = floatingIPTargetPatchModel + floatingIPPatchModelAsPatch, asPatchErr := floatingIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateFloatingIPOptions model + updateFloatingIPOptionsModel := new(vpcv1.UpdateFloatingIPOptions) + updateFloatingIPOptionsModel.ID = core.StringPtr("testString") + updateFloatingIPOptionsModel.FloatingIPPatch = floatingIPPatchModelAsPatch + updateFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateFloatingIP(updateFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateFloatingIP 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 FloatingIPTargetPatchNetworkInterfaceIdentityByID model + floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchNetworkInterfaceIdentityByID) + floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + + // Construct an instance of the FloatingIPPatch model + floatingIPPatchModel := new(vpcv1.FloatingIPPatch) + floatingIPPatchModel.Name = core.StringPtr("my-floating-ip") + floatingIPPatchModel.Target = floatingIPTargetPatchModel + floatingIPPatchModelAsPatch, asPatchErr := floatingIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateFloatingIPOptions model + updateFloatingIPOptionsModel := new(vpcv1.UpdateFloatingIPOptions) + updateFloatingIPOptionsModel.ID = core.StringPtr("testString") + updateFloatingIPOptionsModel.FloatingIPPatch = floatingIPPatchModelAsPatch + updateFloatingIPOptionsModel.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.UpdateFloatingIP(updateFloatingIPOptionsModel) + 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 UpdateFloatingIPOptions model with no property values + updateFloatingIPOptionsModelNew := new(vpcv1.UpdateFloatingIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateFloatingIP(updateFloatingIPOptionsModelNew) + 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 UpdateFloatingIP 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 FloatingIPTargetPatchNetworkInterfaceIdentityByID model + floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchNetworkInterfaceIdentityByID) + floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + + // Construct an instance of the FloatingIPPatch model + floatingIPPatchModel := new(vpcv1.FloatingIPPatch) + floatingIPPatchModel.Name = core.StringPtr("my-floating-ip") + floatingIPPatchModel.Target = floatingIPTargetPatchModel + floatingIPPatchModelAsPatch, asPatchErr := floatingIPPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateFloatingIPOptions model + updateFloatingIPOptionsModel := new(vpcv1.UpdateFloatingIPOptions) + updateFloatingIPOptionsModel.ID = core.StringPtr("testString") + updateFloatingIPOptionsModel.FloatingIPPatch = floatingIPPatchModelAsPatch + updateFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateFloatingIP(updateFloatingIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListNetworkAcls(listNetworkAclsOptions *ListNetworkAclsOptions) - Operation response error`, func() { + version := "testString" + listNetworkAclsPath := "/network_acls" + 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(listNetworkAclsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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 {`) + })) + }) + It(`Invoke ListNetworkAcls 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 ListNetworkAclsOptions model + listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) + listNetworkAclsOptionsModel.Start = core.StringPtr("testString") + listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listNetworkAclsOptionsModel.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.ListNetworkAcls(listNetworkAclsOptionsModel) + 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.ListNetworkAcls(listNetworkAclsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListNetworkAcls(listNetworkAclsOptions *ListNetworkAclsOptions)`, func() { + version := "testString" + listNetworkAclsPath := "/network_acls" + 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(listNetworkAclsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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/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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) + })) + }) + It(`Invoke ListNetworkAcls 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 ListNetworkAclsOptions model + listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) + listNetworkAclsOptionsModel.Start = core.StringPtr("testString") + listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listNetworkAclsOptionsModel.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.ListNetworkAclsWithContext(ctx, listNetworkAclsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListNetworkAcls(listNetworkAclsOptionsModel) + 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.ListNetworkAclsWithContext(ctx, listNetworkAclsOptionsModel) + 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(listNetworkAclsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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/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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) + })) + }) + It(`Invoke ListNetworkAcls 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.ListNetworkAcls(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListNetworkAclsOptions model + listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) + listNetworkAclsOptionsModel.Start = core.StringPtr("testString") + listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listNetworkAclsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListNetworkAcls(listNetworkAclsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListNetworkAcls 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 ListNetworkAclsOptions model + listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) + listNetworkAclsOptionsModel.Start = core.StringPtr("testString") + listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listNetworkAclsOptionsModel.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.ListNetworkAcls(listNetworkAclsOptionsModel) + 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 ListNetworkAcls 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 ListNetworkAclsOptions model + listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) + listNetworkAclsOptionsModel.Start = core.StringPtr("testString") + listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listNetworkAclsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListNetworkAcls(listNetworkAclsOptionsModel) + 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.NetworkACLCollection) + nextObject := new(vpcv1.NetworkACLCollectionNext) + 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.NetworkACLCollection) + + 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.NetworkACLCollection) + nextObject := new(vpcv1.NetworkACLCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateNetworkACL(createNetworkACLOptions *CreateNetworkACLOptions) - Operation response error`, func() { + version := "testString" + createNetworkACLPath := "/network_acls" + 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(createNetworkACLPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateNetworkACL 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") + + // Construct an instance of the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype model + networkACLRulePrototypeNetworkACLContextModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") + networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") + networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePrototypeNetworkACLContextModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePrototypeNetworkACLContextModel.Protocol = core.StringPtr("udp") + networkACLRulePrototypeNetworkACLContextModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePrototypeNetworkACLContextModel.SourcePortMin = core.Int64Ptr(int64(49152)) + + // Construct an instance of the NetworkACLPrototypeNetworkACLByRules model + networkACLPrototypeModel := new(vpcv1.NetworkACLPrototypeNetworkACLByRules) + networkACLPrototypeModel.Name = core.StringPtr("my-network-acl") + networkACLPrototypeModel.ResourceGroup = resourceGroupIdentityModel + networkACLPrototypeModel.VPC = vpcIdentityModel + networkACLPrototypeModel.Rules = []vpcv1.NetworkACLRulePrototypeNetworkACLContextIntf{networkACLRulePrototypeNetworkACLContextModel} + + // Construct an instance of the CreateNetworkACLOptions model + createNetworkACLOptionsModel := new(vpcv1.CreateNetworkACLOptions) + createNetworkACLOptionsModel.NetworkACLPrototype = networkACLPrototypeModel + createNetworkACLOptionsModel.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.CreateNetworkACL(createNetworkACLOptionsModel) + 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.CreateNetworkACL(createNetworkACLOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateNetworkACL(createNetworkACLOptions *CreateNetworkACLOptions)`, func() { + version := "testString" + createNetworkACLPath := "/network_acls" + 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(createNetworkACLPath)) + 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{"testString"})) + 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateNetworkACL 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") + + // Construct an instance of the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype model + networkACLRulePrototypeNetworkACLContextModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") + networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") + networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePrototypeNetworkACLContextModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePrototypeNetworkACLContextModel.Protocol = core.StringPtr("udp") + networkACLRulePrototypeNetworkACLContextModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePrototypeNetworkACLContextModel.SourcePortMin = core.Int64Ptr(int64(49152)) + + // Construct an instance of the NetworkACLPrototypeNetworkACLByRules model + networkACLPrototypeModel := new(vpcv1.NetworkACLPrototypeNetworkACLByRules) + networkACLPrototypeModel.Name = core.StringPtr("my-network-acl") + networkACLPrototypeModel.ResourceGroup = resourceGroupIdentityModel + networkACLPrototypeModel.VPC = vpcIdentityModel + networkACLPrototypeModel.Rules = []vpcv1.NetworkACLRulePrototypeNetworkACLContextIntf{networkACLRulePrototypeNetworkACLContextModel} + + // Construct an instance of the CreateNetworkACLOptions model + createNetworkACLOptionsModel := new(vpcv1.CreateNetworkACLOptions) + createNetworkACLOptionsModel.NetworkACLPrototype = networkACLPrototypeModel + createNetworkACLOptionsModel.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.CreateNetworkACLWithContext(ctx, createNetworkACLOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateNetworkACL(createNetworkACLOptionsModel) + 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.CreateNetworkACLWithContext(ctx, createNetworkACLOptionsModel) + 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(createNetworkACLPath)) + 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{"testString"})) + 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateNetworkACL 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.CreateNetworkACL(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 VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") + + // Construct an instance of the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype model + networkACLRulePrototypeNetworkACLContextModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") + networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") + networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePrototypeNetworkACLContextModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePrototypeNetworkACLContextModel.Protocol = core.StringPtr("udp") + networkACLRulePrototypeNetworkACLContextModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePrototypeNetworkACLContextModel.SourcePortMin = core.Int64Ptr(int64(49152)) + + // Construct an instance of the NetworkACLPrototypeNetworkACLByRules model + networkACLPrototypeModel := new(vpcv1.NetworkACLPrototypeNetworkACLByRules) + networkACLPrototypeModel.Name = core.StringPtr("my-network-acl") + networkACLPrototypeModel.ResourceGroup = resourceGroupIdentityModel + networkACLPrototypeModel.VPC = vpcIdentityModel + networkACLPrototypeModel.Rules = []vpcv1.NetworkACLRulePrototypeNetworkACLContextIntf{networkACLRulePrototypeNetworkACLContextModel} + + // Construct an instance of the CreateNetworkACLOptions model + createNetworkACLOptionsModel := new(vpcv1.CreateNetworkACLOptions) + createNetworkACLOptionsModel.NetworkACLPrototype = networkACLPrototypeModel + createNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateNetworkACL(createNetworkACLOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateNetworkACL 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") + + // Construct an instance of the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype model + networkACLRulePrototypeNetworkACLContextModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") + networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") + networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePrototypeNetworkACLContextModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePrototypeNetworkACLContextModel.Protocol = core.StringPtr("udp") + networkACLRulePrototypeNetworkACLContextModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePrototypeNetworkACLContextModel.SourcePortMin = core.Int64Ptr(int64(49152)) + + // Construct an instance of the NetworkACLPrototypeNetworkACLByRules model + networkACLPrototypeModel := new(vpcv1.NetworkACLPrototypeNetworkACLByRules) + networkACLPrototypeModel.Name = core.StringPtr("my-network-acl") + networkACLPrototypeModel.ResourceGroup = resourceGroupIdentityModel + networkACLPrototypeModel.VPC = vpcIdentityModel + networkACLPrototypeModel.Rules = []vpcv1.NetworkACLRulePrototypeNetworkACLContextIntf{networkACLRulePrototypeNetworkACLContextModel} + + // Construct an instance of the CreateNetworkACLOptions model + createNetworkACLOptionsModel := new(vpcv1.CreateNetworkACLOptions) + createNetworkACLOptionsModel.NetworkACLPrototype = networkACLPrototypeModel + createNetworkACLOptionsModel.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.CreateNetworkACL(createNetworkACLOptionsModel) + 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(201) + })) + }) + It(`Invoke CreateNetworkACL 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") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") + + // Construct an instance of the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype model + networkACLRulePrototypeNetworkACLContextModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") + networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") + networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePrototypeNetworkACLContextModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePrototypeNetworkACLContextModel.Protocol = core.StringPtr("udp") + networkACLRulePrototypeNetworkACLContextModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePrototypeNetworkACLContextModel.SourcePortMin = core.Int64Ptr(int64(49152)) + + // Construct an instance of the NetworkACLPrototypeNetworkACLByRules model + networkACLPrototypeModel := new(vpcv1.NetworkACLPrototypeNetworkACLByRules) + networkACLPrototypeModel.Name = core.StringPtr("my-network-acl") + networkACLPrototypeModel.ResourceGroup = resourceGroupIdentityModel + networkACLPrototypeModel.VPC = vpcIdentityModel + networkACLPrototypeModel.Rules = []vpcv1.NetworkACLRulePrototypeNetworkACLContextIntf{networkACLRulePrototypeNetworkACLContextModel} + + // Construct an instance of the CreateNetworkACLOptions model + createNetworkACLOptionsModel := new(vpcv1.CreateNetworkACLOptions) + createNetworkACLOptionsModel.NetworkACLPrototype = networkACLPrototypeModel + createNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateNetworkACL(createNetworkACLOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteNetworkACL(deleteNetworkACLOptions *DeleteNetworkACLOptions)`, func() { + version := "testString" + deleteNetworkACLPath := "/network_acls/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(deleteNetworkACLPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteNetworkACL 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.DeleteNetworkACL(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteNetworkACLOptions model + deleteNetworkACLOptionsModel := new(vpcv1.DeleteNetworkACLOptions) + deleteNetworkACLOptionsModel.ID = core.StringPtr("testString") + deleteNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteNetworkACL(deleteNetworkACLOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteNetworkACL 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 DeleteNetworkACLOptions model + deleteNetworkACLOptionsModel := new(vpcv1.DeleteNetworkACLOptions) + deleteNetworkACLOptionsModel.ID = core.StringPtr("testString") + deleteNetworkACLOptionsModel.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.DeleteNetworkACL(deleteNetworkACLOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteNetworkACLOptions model with no property values + deleteNetworkACLOptionsModelNew := new(vpcv1.DeleteNetworkACLOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteNetworkACL(deleteNetworkACLOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetNetworkACL(getNetworkACLOptions *GetNetworkACLOptions) - Operation response error`, func() { + version := "testString" + getNetworkACLPath := "/network_acls/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(getNetworkACLPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetNetworkACL 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 GetNetworkACLOptions model + getNetworkACLOptionsModel := new(vpcv1.GetNetworkACLOptions) + getNetworkACLOptionsModel.ID = core.StringPtr("testString") + getNetworkACLOptionsModel.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.GetNetworkACL(getNetworkACLOptionsModel) + 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.GetNetworkACL(getNetworkACLOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetNetworkACL(getNetworkACLOptions *GetNetworkACLOptions)`, func() { + version := "testString" + getNetworkACLPath := "/network_acls/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(getNetworkACLPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetNetworkACL 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 GetNetworkACLOptions model + getNetworkACLOptionsModel := new(vpcv1.GetNetworkACLOptions) + getNetworkACLOptionsModel.ID = core.StringPtr("testString") + getNetworkACLOptionsModel.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.GetNetworkACLWithContext(ctx, getNetworkACLOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetNetworkACL(getNetworkACLOptionsModel) + 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.GetNetworkACLWithContext(ctx, getNetworkACLOptionsModel) + 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(getNetworkACLPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetNetworkACL 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.GetNetworkACL(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetNetworkACLOptions model + getNetworkACLOptionsModel := new(vpcv1.GetNetworkACLOptions) + getNetworkACLOptionsModel.ID = core.StringPtr("testString") + getNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetNetworkACL(getNetworkACLOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetNetworkACL 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 GetNetworkACLOptions model + getNetworkACLOptionsModel := new(vpcv1.GetNetworkACLOptions) + getNetworkACLOptionsModel.ID = core.StringPtr("testString") + getNetworkACLOptionsModel.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.GetNetworkACL(getNetworkACLOptionsModel) + 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 GetNetworkACLOptions model with no property values + getNetworkACLOptionsModelNew := new(vpcv1.GetNetworkACLOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetNetworkACL(getNetworkACLOptionsModelNew) + 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 GetNetworkACL 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 GetNetworkACLOptions model + getNetworkACLOptionsModel := new(vpcv1.GetNetworkACLOptions) + getNetworkACLOptionsModel.ID = core.StringPtr("testString") + getNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetNetworkACL(getNetworkACLOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateNetworkACL(updateNetworkACLOptions *UpdateNetworkACLOptions) - Operation response error`, func() { + version := "testString" + updateNetworkACLPath := "/network_acls/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(updateNetworkACLPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateNetworkACL 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 NetworkACLPatch model + networkACLPatchModel := new(vpcv1.NetworkACLPatch) + networkACLPatchModel.Name = core.StringPtr("my-network-acl") + networkACLPatchModelAsPatch, asPatchErr := networkACLPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetworkACLOptions model + updateNetworkACLOptionsModel := new(vpcv1.UpdateNetworkACLOptions) + updateNetworkACLOptionsModel.ID = core.StringPtr("testString") + updateNetworkACLOptionsModel.NetworkACLPatch = networkACLPatchModelAsPatch + updateNetworkACLOptionsModel.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.UpdateNetworkACL(updateNetworkACLOptionsModel) + 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.UpdateNetworkACL(updateNetworkACLOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateNetworkACL(updateNetworkACLOptions *UpdateNetworkACLOptions)`, func() { + version := "testString" + updateNetworkACLPath := "/network_acls/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(updateNetworkACLPath)) + 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{"testString"})) + 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke UpdateNetworkACL 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 NetworkACLPatch model + networkACLPatchModel := new(vpcv1.NetworkACLPatch) + networkACLPatchModel.Name = core.StringPtr("my-network-acl") + networkACLPatchModelAsPatch, asPatchErr := networkACLPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetworkACLOptions model + updateNetworkACLOptionsModel := new(vpcv1.UpdateNetworkACLOptions) + updateNetworkACLOptionsModel.ID = core.StringPtr("testString") + updateNetworkACLOptionsModel.NetworkACLPatch = networkACLPatchModelAsPatch + updateNetworkACLOptionsModel.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.UpdateNetworkACLWithContext(ctx, updateNetworkACLOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateNetworkACL(updateNetworkACLOptionsModel) + 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.UpdateNetworkACLWithContext(ctx, updateNetworkACLOptionsModel) + 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(updateNetworkACLPath)) + 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{"testString"})) + 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke UpdateNetworkACL 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.UpdateNetworkACL(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the NetworkACLPatch model + networkACLPatchModel := new(vpcv1.NetworkACLPatch) + networkACLPatchModel.Name = core.StringPtr("my-network-acl") + networkACLPatchModelAsPatch, asPatchErr := networkACLPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetworkACLOptions model + updateNetworkACLOptionsModel := new(vpcv1.UpdateNetworkACLOptions) + updateNetworkACLOptionsModel.ID = core.StringPtr("testString") + updateNetworkACLOptionsModel.NetworkACLPatch = networkACLPatchModelAsPatch + updateNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateNetworkACL(updateNetworkACLOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateNetworkACL 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 NetworkACLPatch model + networkACLPatchModel := new(vpcv1.NetworkACLPatch) + networkACLPatchModel.Name = core.StringPtr("my-network-acl") + networkACLPatchModelAsPatch, asPatchErr := networkACLPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetworkACLOptions model + updateNetworkACLOptionsModel := new(vpcv1.UpdateNetworkACLOptions) + updateNetworkACLOptionsModel.ID = core.StringPtr("testString") + updateNetworkACLOptionsModel.NetworkACLPatch = networkACLPatchModelAsPatch + updateNetworkACLOptionsModel.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.UpdateNetworkACL(updateNetworkACLOptionsModel) + 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 UpdateNetworkACLOptions model with no property values + updateNetworkACLOptionsModelNew := new(vpcv1.UpdateNetworkACLOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateNetworkACL(updateNetworkACLOptionsModelNew) + 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 UpdateNetworkACL 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 NetworkACLPatch model + networkACLPatchModel := new(vpcv1.NetworkACLPatch) + networkACLPatchModel.Name = core.StringPtr("my-network-acl") + networkACLPatchModelAsPatch, asPatchErr := networkACLPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetworkACLOptions model + updateNetworkACLOptionsModel := new(vpcv1.UpdateNetworkACLOptions) + updateNetworkACLOptionsModel.ID = core.StringPtr("testString") + updateNetworkACLOptionsModel.NetworkACLPatch = networkACLPatchModelAsPatch + updateNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateNetworkACL(updateNetworkACLOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListNetworkACLRules(listNetworkACLRulesOptions *ListNetworkACLRulesOptions) - Operation response error`, func() { + version := "testString" + listNetworkACLRulesPath := "/network_acls/testString/rules" + 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(listNetworkACLRulesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["direction"]).To(Equal([]string{"inbound"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListNetworkACLRules 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 ListNetworkACLRulesOptions model + listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) + listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") + listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") + listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") + listNetworkACLRulesOptionsModel.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.ListNetworkACLRules(listNetworkACLRulesOptionsModel) + 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.ListNetworkACLRules(listNetworkACLRulesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListNetworkACLRules(listNetworkACLRulesOptions *ListNetworkACLRulesOptions)`, func() { + version := "testString" + listNetworkACLRulesPath := "/network_acls/testString/rules" + 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(listNetworkACLRulesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["direction"]).To(Equal([]string{"inbound"})) + // 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/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}`) + })) + }) + It(`Invoke ListNetworkACLRules 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 ListNetworkACLRulesOptions model + listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) + listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") + listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") + listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") + listNetworkACLRulesOptionsModel.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.ListNetworkACLRulesWithContext(ctx, listNetworkACLRulesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListNetworkACLRules(listNetworkACLRulesOptionsModel) + 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.ListNetworkACLRulesWithContext(ctx, listNetworkACLRulesOptionsModel) + 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(listNetworkACLRulesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["direction"]).To(Equal([]string{"inbound"})) + // 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}`) + })) + }) + It(`Invoke ListNetworkACLRules 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.ListNetworkACLRules(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListNetworkACLRulesOptions model + listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) + listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") + listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") + listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") + listNetworkACLRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListNetworkACLRules(listNetworkACLRulesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListNetworkACLRules 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 ListNetworkACLRulesOptions model + listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) + listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") + listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") + listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") + listNetworkACLRulesOptionsModel.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.ListNetworkACLRules(listNetworkACLRulesOptionsModel) + 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 ListNetworkACLRulesOptions model with no property values + listNetworkACLRulesOptionsModelNew := new(vpcv1.ListNetworkACLRulesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListNetworkACLRules(listNetworkACLRulesOptionsModelNew) + 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 ListNetworkACLRules 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 ListNetworkACLRulesOptions model + listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) + listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") + listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") + listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") + listNetworkACLRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListNetworkACLRules(listNetworkACLRulesOptionsModel) + 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.NetworkACLRuleCollection) + nextObject := new(vpcv1.NetworkACLRuleCollectionNext) + 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.NetworkACLRuleCollection) + + 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.NetworkACLRuleCollection) + nextObject := new(vpcv1.NetworkACLRuleCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateNetworkACLRule(createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) - Operation response error`, func() { + version := "testString" + createNetworkACLRulePath := "/network_acls/testString/rules" + 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(createNetworkACLRulePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateNetworkACLRule 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 NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID model + networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) + networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") + + // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype model + networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + networkACLRulePrototypeModel.Action = core.StringPtr("allow") + networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel + networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") + networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeModel.Protocol = core.StringPtr("all") + + // Construct an instance of the CreateNetworkACLRuleOptions model + createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) + createNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + createNetworkACLRuleOptionsModel.NetworkACLRulePrototype = networkACLRulePrototypeModel + createNetworkACLRuleOptionsModel.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.CreateNetworkACLRule(createNetworkACLRuleOptionsModel) + 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.CreateNetworkACLRule(createNetworkACLRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateNetworkACLRule(createNetworkACLRuleOptions *CreateNetworkACLRuleOptions)`, func() { + version := "testString" + createNetworkACLRulePath := "/network_acls/testString/rules" + 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(createNetworkACLRulePath)) + 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{"testString"})) + 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", `{"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}`) + })) + }) + It(`Invoke CreateNetworkACLRule 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 NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID model + networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) + networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") + + // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype model + networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + networkACLRulePrototypeModel.Action = core.StringPtr("allow") + networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel + networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") + networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeModel.Protocol = core.StringPtr("all") + + // Construct an instance of the CreateNetworkACLRuleOptions model + createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) + createNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + createNetworkACLRuleOptionsModel.NetworkACLRulePrototype = networkACLRulePrototypeModel + createNetworkACLRuleOptionsModel.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.CreateNetworkACLRuleWithContext(ctx, createNetworkACLRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateNetworkACLRule(createNetworkACLRuleOptionsModel) + 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.CreateNetworkACLRuleWithContext(ctx, createNetworkACLRuleOptionsModel) + 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(createNetworkACLRulePath)) + 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{"testString"})) + 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", `{"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}`) + })) + }) + It(`Invoke CreateNetworkACLRule 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.CreateNetworkACLRule(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID model + networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) + networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") + + // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype model + networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + networkACLRulePrototypeModel.Action = core.StringPtr("allow") + networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel + networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") + networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeModel.Protocol = core.StringPtr("all") + + // Construct an instance of the CreateNetworkACLRuleOptions model + createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) + createNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + createNetworkACLRuleOptionsModel.NetworkACLRulePrototype = networkACLRulePrototypeModel + createNetworkACLRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateNetworkACLRule(createNetworkACLRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateNetworkACLRule 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 NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID model + networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) + networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") + + // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype model + networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + networkACLRulePrototypeModel.Action = core.StringPtr("allow") + networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel + networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") + networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeModel.Protocol = core.StringPtr("all") + + // Construct an instance of the CreateNetworkACLRuleOptions model + createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) + createNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + createNetworkACLRuleOptionsModel.NetworkACLRulePrototype = networkACLRulePrototypeModel + createNetworkACLRuleOptionsModel.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.CreateNetworkACLRule(createNetworkACLRuleOptionsModel) + 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 CreateNetworkACLRuleOptions model with no property values + createNetworkACLRuleOptionsModelNew := new(vpcv1.CreateNetworkACLRuleOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateNetworkACLRule(createNetworkACLRuleOptionsModelNew) + 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 CreateNetworkACLRule 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 NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID model + networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) + networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") + + // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype model + networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + networkACLRulePrototypeModel.Action = core.StringPtr("allow") + networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel + networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") + networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeModel.Protocol = core.StringPtr("all") + + // Construct an instance of the CreateNetworkACLRuleOptions model + createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) + createNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + createNetworkACLRuleOptionsModel.NetworkACLRulePrototype = networkACLRulePrototypeModel + createNetworkACLRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateNetworkACLRule(createNetworkACLRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteNetworkACLRule(deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions)`, func() { + version := "testString" + deleteNetworkACLRulePath := "/network_acls/testString/rules/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(deleteNetworkACLRulePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteNetworkACLRule 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.DeleteNetworkACLRule(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteNetworkACLRuleOptions model + deleteNetworkACLRuleOptionsModel := new(vpcv1.DeleteNetworkACLRuleOptions) + deleteNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + deleteNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") + deleteNetworkACLRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteNetworkACLRule(deleteNetworkACLRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteNetworkACLRule 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 DeleteNetworkACLRuleOptions model + deleteNetworkACLRuleOptionsModel := new(vpcv1.DeleteNetworkACLRuleOptions) + deleteNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + deleteNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") + deleteNetworkACLRuleOptionsModel.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.DeleteNetworkACLRule(deleteNetworkACLRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteNetworkACLRuleOptions model with no property values + deleteNetworkACLRuleOptionsModelNew := new(vpcv1.DeleteNetworkACLRuleOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteNetworkACLRule(deleteNetworkACLRuleOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetNetworkACLRule(getNetworkACLRuleOptions *GetNetworkACLRuleOptions) - Operation response error`, func() { + version := "testString" + getNetworkACLRulePath := "/network_acls/testString/rules/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(getNetworkACLRulePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetNetworkACLRule 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 GetNetworkACLRuleOptions model + getNetworkACLRuleOptionsModel := new(vpcv1.GetNetworkACLRuleOptions) + getNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + getNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") + getNetworkACLRuleOptionsModel.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.GetNetworkACLRule(getNetworkACLRuleOptionsModel) + 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.GetNetworkACLRule(getNetworkACLRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetNetworkACLRule(getNetworkACLRuleOptions *GetNetworkACLRuleOptions)`, func() { + version := "testString" + getNetworkACLRulePath := "/network_acls/testString/rules/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(getNetworkACLRulePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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}`) + })) + }) + It(`Invoke GetNetworkACLRule 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 GetNetworkACLRuleOptions model + getNetworkACLRuleOptionsModel := new(vpcv1.GetNetworkACLRuleOptions) + getNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + getNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") + getNetworkACLRuleOptionsModel.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.GetNetworkACLRuleWithContext(ctx, getNetworkACLRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetNetworkACLRule(getNetworkACLRuleOptionsModel) + 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.GetNetworkACLRuleWithContext(ctx, getNetworkACLRuleOptionsModel) + 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(getNetworkACLRulePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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}`) + })) + }) + It(`Invoke GetNetworkACLRule 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.GetNetworkACLRule(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetNetworkACLRuleOptions model + getNetworkACLRuleOptionsModel := new(vpcv1.GetNetworkACLRuleOptions) + getNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + getNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") + getNetworkACLRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetNetworkACLRule(getNetworkACLRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetNetworkACLRule 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 GetNetworkACLRuleOptions model + getNetworkACLRuleOptionsModel := new(vpcv1.GetNetworkACLRuleOptions) + getNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + getNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") + getNetworkACLRuleOptionsModel.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.GetNetworkACLRule(getNetworkACLRuleOptionsModel) + 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 GetNetworkACLRuleOptions model with no property values + getNetworkACLRuleOptionsModelNew := new(vpcv1.GetNetworkACLRuleOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetNetworkACLRule(getNetworkACLRuleOptionsModelNew) + 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 GetNetworkACLRule 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 GetNetworkACLRuleOptions model + getNetworkACLRuleOptionsModel := new(vpcv1.GetNetworkACLRuleOptions) + getNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + getNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") + getNetworkACLRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetNetworkACLRule(getNetworkACLRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) - Operation response error`, func() { + version := "testString" + updateNetworkACLRulePath := "/network_acls/testString/rules/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(updateNetworkACLRulePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateNetworkACLRule 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 NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID model + networkACLRuleBeforePatchModel := new(vpcv1.NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) + networkACLRuleBeforePatchModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") + + // Construct an instance of the NetworkACLRulePatch model + networkACLRulePatchModel := new(vpcv1.NetworkACLRulePatch) + networkACLRulePatchModel.Action = core.StringPtr("allow") + networkACLRulePatchModel.Before = networkACLRuleBeforePatchModel + networkACLRulePatchModel.Code = core.Int64Ptr(int64(0)) + networkACLRulePatchModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePatchModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePatchModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePatchModel.Direction = core.StringPtr("inbound") + networkACLRulePatchModel.Name = core.StringPtr("my-rule-1") + networkACLRulePatchModel.Protocol = core.StringPtr("tcp") + networkACLRulePatchModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePatchModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePatchModel.SourcePortMin = core.Int64Ptr(int64(49152)) + networkACLRulePatchModel.Type = core.Int64Ptr(int64(8)) + networkACLRulePatchModelAsPatch, asPatchErr := networkACLRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetworkACLRuleOptions model + updateNetworkACLRuleOptionsModel := new(vpcv1.UpdateNetworkACLRuleOptions) + updateNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + updateNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") + updateNetworkACLRuleOptionsModel.NetworkACLRulePatch = networkACLRulePatchModelAsPatch + updateNetworkACLRuleOptionsModel.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.UpdateNetworkACLRule(updateNetworkACLRuleOptionsModel) + 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.UpdateNetworkACLRule(updateNetworkACLRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions)`, func() { + version := "testString" + updateNetworkACLRulePath := "/network_acls/testString/rules/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(updateNetworkACLRulePath)) + 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{"testString"})) + 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", `{"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}`) + })) + }) + It(`Invoke UpdateNetworkACLRule 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 NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID model + networkACLRuleBeforePatchModel := new(vpcv1.NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) + networkACLRuleBeforePatchModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") + + // Construct an instance of the NetworkACLRulePatch model + networkACLRulePatchModel := new(vpcv1.NetworkACLRulePatch) + networkACLRulePatchModel.Action = core.StringPtr("allow") + networkACLRulePatchModel.Before = networkACLRuleBeforePatchModel + networkACLRulePatchModel.Code = core.Int64Ptr(int64(0)) + networkACLRulePatchModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePatchModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePatchModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePatchModel.Direction = core.StringPtr("inbound") + networkACLRulePatchModel.Name = core.StringPtr("my-rule-1") + networkACLRulePatchModel.Protocol = core.StringPtr("tcp") + networkACLRulePatchModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePatchModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePatchModel.SourcePortMin = core.Int64Ptr(int64(49152)) + networkACLRulePatchModel.Type = core.Int64Ptr(int64(8)) + networkACLRulePatchModelAsPatch, asPatchErr := networkACLRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetworkACLRuleOptions model + updateNetworkACLRuleOptionsModel := new(vpcv1.UpdateNetworkACLRuleOptions) + updateNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + updateNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") + updateNetworkACLRuleOptionsModel.NetworkACLRulePatch = networkACLRulePatchModelAsPatch + updateNetworkACLRuleOptionsModel.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.UpdateNetworkACLRuleWithContext(ctx, updateNetworkACLRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateNetworkACLRule(updateNetworkACLRuleOptionsModel) + 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.UpdateNetworkACLRuleWithContext(ctx, updateNetworkACLRuleOptionsModel) + 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(updateNetworkACLRulePath)) + 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{"testString"})) + 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", `{"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}`) + })) + }) + It(`Invoke UpdateNetworkACLRule 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.UpdateNetworkACLRule(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID model + networkACLRuleBeforePatchModel := new(vpcv1.NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) + networkACLRuleBeforePatchModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") + + // Construct an instance of the NetworkACLRulePatch model + networkACLRulePatchModel := new(vpcv1.NetworkACLRulePatch) + networkACLRulePatchModel.Action = core.StringPtr("allow") + networkACLRulePatchModel.Before = networkACLRuleBeforePatchModel + networkACLRulePatchModel.Code = core.Int64Ptr(int64(0)) + networkACLRulePatchModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePatchModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePatchModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePatchModel.Direction = core.StringPtr("inbound") + networkACLRulePatchModel.Name = core.StringPtr("my-rule-1") + networkACLRulePatchModel.Protocol = core.StringPtr("tcp") + networkACLRulePatchModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePatchModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePatchModel.SourcePortMin = core.Int64Ptr(int64(49152)) + networkACLRulePatchModel.Type = core.Int64Ptr(int64(8)) + networkACLRulePatchModelAsPatch, asPatchErr := networkACLRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetworkACLRuleOptions model + updateNetworkACLRuleOptionsModel := new(vpcv1.UpdateNetworkACLRuleOptions) + updateNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + updateNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") + updateNetworkACLRuleOptionsModel.NetworkACLRulePatch = networkACLRulePatchModelAsPatch + updateNetworkACLRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateNetworkACLRule(updateNetworkACLRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateNetworkACLRule 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 NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID model + networkACLRuleBeforePatchModel := new(vpcv1.NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) + networkACLRuleBeforePatchModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") + + // Construct an instance of the NetworkACLRulePatch model + networkACLRulePatchModel := new(vpcv1.NetworkACLRulePatch) + networkACLRulePatchModel.Action = core.StringPtr("allow") + networkACLRulePatchModel.Before = networkACLRuleBeforePatchModel + networkACLRulePatchModel.Code = core.Int64Ptr(int64(0)) + networkACLRulePatchModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePatchModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePatchModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePatchModel.Direction = core.StringPtr("inbound") + networkACLRulePatchModel.Name = core.StringPtr("my-rule-1") + networkACLRulePatchModel.Protocol = core.StringPtr("tcp") + networkACLRulePatchModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePatchModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePatchModel.SourcePortMin = core.Int64Ptr(int64(49152)) + networkACLRulePatchModel.Type = core.Int64Ptr(int64(8)) + networkACLRulePatchModelAsPatch, asPatchErr := networkACLRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetworkACLRuleOptions model + updateNetworkACLRuleOptionsModel := new(vpcv1.UpdateNetworkACLRuleOptions) + updateNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + updateNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") + updateNetworkACLRuleOptionsModel.NetworkACLRulePatch = networkACLRulePatchModelAsPatch + updateNetworkACLRuleOptionsModel.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.UpdateNetworkACLRule(updateNetworkACLRuleOptionsModel) + 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 UpdateNetworkACLRuleOptions model with no property values + updateNetworkACLRuleOptionsModelNew := new(vpcv1.UpdateNetworkACLRuleOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateNetworkACLRule(updateNetworkACLRuleOptionsModelNew) + 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 UpdateNetworkACLRule 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 NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID model + networkACLRuleBeforePatchModel := new(vpcv1.NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) + networkACLRuleBeforePatchModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") + + // Construct an instance of the NetworkACLRulePatch model + networkACLRulePatchModel := new(vpcv1.NetworkACLRulePatch) + networkACLRulePatchModel.Action = core.StringPtr("allow") + networkACLRulePatchModel.Before = networkACLRuleBeforePatchModel + networkACLRulePatchModel.Code = core.Int64Ptr(int64(0)) + networkACLRulePatchModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePatchModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePatchModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePatchModel.Direction = core.StringPtr("inbound") + networkACLRulePatchModel.Name = core.StringPtr("my-rule-1") + networkACLRulePatchModel.Protocol = core.StringPtr("tcp") + networkACLRulePatchModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePatchModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePatchModel.SourcePortMin = core.Int64Ptr(int64(49152)) + networkACLRulePatchModel.Type = core.Int64Ptr(int64(8)) + networkACLRulePatchModelAsPatch, asPatchErr := networkACLRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetworkACLRuleOptions model + updateNetworkACLRuleOptionsModel := new(vpcv1.UpdateNetworkACLRuleOptions) + updateNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") + updateNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") + updateNetworkACLRuleOptionsModel.NetworkACLRulePatch = networkACLRulePatchModelAsPatch + updateNetworkACLRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateNetworkACLRule(updateNetworkACLRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSecurityGroups(listSecurityGroupsOptions *ListSecurityGroupsOptions) - Operation response error`, func() { + version := "testString" + listSecurityGroupsPath := "/security_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(listSecurityGroupsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListSecurityGroups 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 ListSecurityGroupsOptions model + listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) + listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") + listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCName = core.StringPtr("testString") + listSecurityGroupsOptionsModel.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.ListSecurityGroups(listSecurityGroupsOptionsModel) + 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.ListSecurityGroups(listSecurityGroupsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSecurityGroups(listSecurityGroupsOptions *ListSecurityGroupsOptions)`, func() { + version := "testString" + listSecurityGroupsPath := "/security_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(listSecurityGroupsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.name"]).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/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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}`) + })) + }) + It(`Invoke ListSecurityGroups 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 ListSecurityGroupsOptions model + listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) + listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") + listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCName = core.StringPtr("testString") + listSecurityGroupsOptionsModel.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.ListSecurityGroupsWithContext(ctx, listSecurityGroupsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListSecurityGroups(listSecurityGroupsOptionsModel) + 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.ListSecurityGroupsWithContext(ctx, listSecurityGroupsOptionsModel) + 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(listSecurityGroupsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.name"]).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/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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}`) + })) + }) + It(`Invoke ListSecurityGroups 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.ListSecurityGroups(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListSecurityGroupsOptions model + listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) + listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") + listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCName = core.StringPtr("testString") + listSecurityGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListSecurityGroups(listSecurityGroupsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListSecurityGroups 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 ListSecurityGroupsOptions model + listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) + listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") + listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCName = core.StringPtr("testString") + listSecurityGroupsOptionsModel.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.ListSecurityGroups(listSecurityGroupsOptionsModel) + 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 ListSecurityGroups 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 ListSecurityGroupsOptions model + listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) + listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") + listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") + listSecurityGroupsOptionsModel.VPCName = core.StringPtr("testString") + listSecurityGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListSecurityGroups(listSecurityGroupsOptionsModel) + 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.SecurityGroupCollection) + nextObject := new(vpcv1.SecurityGroupCollectionNext) + 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.SecurityGroupCollection) + + 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.SecurityGroupCollection) + nextObject := new(vpcv1.SecurityGroupCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateSecurityGroup(createSecurityGroupOptions *CreateSecurityGroupOptions) - Operation response error`, func() { + version := "testString" + createSecurityGroupPath := "/security_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(createSecurityGroupPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateSecurityGroup 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 VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupRuleRemotePrototypeIP model + securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) + securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") + securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel + securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + + // Construct an instance of the CreateSecurityGroupOptions model + createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) + createSecurityGroupOptionsModel.VPC = vpcIdentityModel + createSecurityGroupOptionsModel.Name = core.StringPtr("my-security-group") + createSecurityGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createSecurityGroupOptionsModel.Rules = []vpcv1.SecurityGroupRulePrototypeIntf{securityGroupRulePrototypeModel} + createSecurityGroupOptionsModel.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.CreateSecurityGroup(createSecurityGroupOptionsModel) + 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.CreateSecurityGroup(createSecurityGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateSecurityGroup(createSecurityGroupOptions *CreateSecurityGroupOptions)`, func() { + version := "testString" + createSecurityGroupPath := "/security_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(createSecurityGroupPath)) + 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{"testString"})) + 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateSecurityGroup 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 VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupRuleRemotePrototypeIP model + securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) + securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") + securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel + securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + + // Construct an instance of the CreateSecurityGroupOptions model + createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) + createSecurityGroupOptionsModel.VPC = vpcIdentityModel + createSecurityGroupOptionsModel.Name = core.StringPtr("my-security-group") + createSecurityGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createSecurityGroupOptionsModel.Rules = []vpcv1.SecurityGroupRulePrototypeIntf{securityGroupRulePrototypeModel} + createSecurityGroupOptionsModel.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.CreateSecurityGroupWithContext(ctx, createSecurityGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateSecurityGroup(createSecurityGroupOptionsModel) + 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.CreateSecurityGroupWithContext(ctx, createSecurityGroupOptionsModel) + 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(createSecurityGroupPath)) + 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{"testString"})) + 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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateSecurityGroup 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.CreateSecurityGroup(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupRuleRemotePrototypeIP model + securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) + securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") + securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel + securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + + // Construct an instance of the CreateSecurityGroupOptions model + createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) + createSecurityGroupOptionsModel.VPC = vpcIdentityModel + createSecurityGroupOptionsModel.Name = core.StringPtr("my-security-group") + createSecurityGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createSecurityGroupOptionsModel.Rules = []vpcv1.SecurityGroupRulePrototypeIntf{securityGroupRulePrototypeModel} + createSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateSecurityGroup(createSecurityGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateSecurityGroup 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 VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupRuleRemotePrototypeIP model + securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) + securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") + securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel + securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + + // Construct an instance of the CreateSecurityGroupOptions model + createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) + createSecurityGroupOptionsModel.VPC = vpcIdentityModel + createSecurityGroupOptionsModel.Name = core.StringPtr("my-security-group") + createSecurityGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createSecurityGroupOptionsModel.Rules = []vpcv1.SecurityGroupRulePrototypeIntf{securityGroupRulePrototypeModel} + createSecurityGroupOptionsModel.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.CreateSecurityGroup(createSecurityGroupOptionsModel) + 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 CreateSecurityGroupOptions model with no property values + createSecurityGroupOptionsModelNew := new(vpcv1.CreateSecurityGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateSecurityGroup(createSecurityGroupOptionsModelNew) + 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 CreateSecurityGroup 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 VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupRuleRemotePrototypeIP model + securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) + securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") + securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel + securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + + // Construct an instance of the CreateSecurityGroupOptions model + createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) + createSecurityGroupOptionsModel.VPC = vpcIdentityModel + createSecurityGroupOptionsModel.Name = core.StringPtr("my-security-group") + createSecurityGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel + createSecurityGroupOptionsModel.Rules = []vpcv1.SecurityGroupRulePrototypeIntf{securityGroupRulePrototypeModel} + createSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateSecurityGroup(createSecurityGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteSecurityGroup(deleteSecurityGroupOptions *DeleteSecurityGroupOptions)`, func() { + version := "testString" + deleteSecurityGroupPath := "/security_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(deleteSecurityGroupPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteSecurityGroup 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.DeleteSecurityGroup(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteSecurityGroupOptions model + deleteSecurityGroupOptionsModel := new(vpcv1.DeleteSecurityGroupOptions) + deleteSecurityGroupOptionsModel.ID = core.StringPtr("testString") + deleteSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteSecurityGroup(deleteSecurityGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteSecurityGroup 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 DeleteSecurityGroupOptions model + deleteSecurityGroupOptionsModel := new(vpcv1.DeleteSecurityGroupOptions) + deleteSecurityGroupOptionsModel.ID = core.StringPtr("testString") + deleteSecurityGroupOptionsModel.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.DeleteSecurityGroup(deleteSecurityGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSecurityGroupOptions model with no property values + deleteSecurityGroupOptionsModelNew := new(vpcv1.DeleteSecurityGroupOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteSecurityGroup(deleteSecurityGroupOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSecurityGroup(getSecurityGroupOptions *GetSecurityGroupOptions) - Operation response error`, func() { + version := "testString" + getSecurityGroupPath := "/security_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(getSecurityGroupPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetSecurityGroup 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 GetSecurityGroupOptions model + getSecurityGroupOptionsModel := new(vpcv1.GetSecurityGroupOptions) + getSecurityGroupOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupOptionsModel.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.GetSecurityGroup(getSecurityGroupOptionsModel) + 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.GetSecurityGroup(getSecurityGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSecurityGroup(getSecurityGroupOptions *GetSecurityGroupOptions)`, func() { + version := "testString" + getSecurityGroupPath := "/security_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(getSecurityGroupPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetSecurityGroup 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 GetSecurityGroupOptions model + getSecurityGroupOptionsModel := new(vpcv1.GetSecurityGroupOptions) + getSecurityGroupOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupOptionsModel.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.GetSecurityGroupWithContext(ctx, getSecurityGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetSecurityGroup(getSecurityGroupOptionsModel) + 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.GetSecurityGroupWithContext(ctx, getSecurityGroupOptionsModel) + 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(getSecurityGroupPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetSecurityGroup 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.GetSecurityGroup(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetSecurityGroupOptions model + getSecurityGroupOptionsModel := new(vpcv1.GetSecurityGroupOptions) + getSecurityGroupOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetSecurityGroup(getSecurityGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetSecurityGroup 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 GetSecurityGroupOptions model + getSecurityGroupOptionsModel := new(vpcv1.GetSecurityGroupOptions) + getSecurityGroupOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupOptionsModel.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.GetSecurityGroup(getSecurityGroupOptionsModel) + 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 GetSecurityGroupOptions model with no property values + getSecurityGroupOptionsModelNew := new(vpcv1.GetSecurityGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetSecurityGroup(getSecurityGroupOptionsModelNew) + 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 GetSecurityGroup 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 GetSecurityGroupOptions model + getSecurityGroupOptionsModel := new(vpcv1.GetSecurityGroupOptions) + getSecurityGroupOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetSecurityGroup(getSecurityGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateSecurityGroup(updateSecurityGroupOptions *UpdateSecurityGroupOptions) - Operation response error`, func() { + version := "testString" + updateSecurityGroupPath := "/security_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(updateSecurityGroupPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateSecurityGroup 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 SecurityGroupPatch model + securityGroupPatchModel := new(vpcv1.SecurityGroupPatch) + securityGroupPatchModel.Name = core.StringPtr("my-security-group") + securityGroupPatchModelAsPatch, asPatchErr := securityGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSecurityGroupOptions model + updateSecurityGroupOptionsModel := new(vpcv1.UpdateSecurityGroupOptions) + updateSecurityGroupOptionsModel.ID = core.StringPtr("testString") + updateSecurityGroupOptionsModel.SecurityGroupPatch = securityGroupPatchModelAsPatch + updateSecurityGroupOptionsModel.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.UpdateSecurityGroup(updateSecurityGroupOptionsModel) + 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.UpdateSecurityGroup(updateSecurityGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateSecurityGroup(updateSecurityGroupOptions *UpdateSecurityGroupOptions)`, func() { + version := "testString" + updateSecurityGroupPath := "/security_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(updateSecurityGroupPath)) + 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{"testString"})) + 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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke UpdateSecurityGroup 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 SecurityGroupPatch model + securityGroupPatchModel := new(vpcv1.SecurityGroupPatch) + securityGroupPatchModel.Name = core.StringPtr("my-security-group") + securityGroupPatchModelAsPatch, asPatchErr := securityGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSecurityGroupOptions model + updateSecurityGroupOptionsModel := new(vpcv1.UpdateSecurityGroupOptions) + updateSecurityGroupOptionsModel.ID = core.StringPtr("testString") + updateSecurityGroupOptionsModel.SecurityGroupPatch = securityGroupPatchModelAsPatch + updateSecurityGroupOptionsModel.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.UpdateSecurityGroupWithContext(ctx, updateSecurityGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateSecurityGroup(updateSecurityGroupOptionsModel) + 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.UpdateSecurityGroupWithContext(ctx, updateSecurityGroupOptionsModel) + 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(updateSecurityGroupPath)) + 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{"testString"})) + 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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke UpdateSecurityGroup 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.UpdateSecurityGroup(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the SecurityGroupPatch model + securityGroupPatchModel := new(vpcv1.SecurityGroupPatch) + securityGroupPatchModel.Name = core.StringPtr("my-security-group") + securityGroupPatchModelAsPatch, asPatchErr := securityGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSecurityGroupOptions model + updateSecurityGroupOptionsModel := new(vpcv1.UpdateSecurityGroupOptions) + updateSecurityGroupOptionsModel.ID = core.StringPtr("testString") + updateSecurityGroupOptionsModel.SecurityGroupPatch = securityGroupPatchModelAsPatch + updateSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateSecurityGroup(updateSecurityGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateSecurityGroup 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 SecurityGroupPatch model + securityGroupPatchModel := new(vpcv1.SecurityGroupPatch) + securityGroupPatchModel.Name = core.StringPtr("my-security-group") + securityGroupPatchModelAsPatch, asPatchErr := securityGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSecurityGroupOptions model + updateSecurityGroupOptionsModel := new(vpcv1.UpdateSecurityGroupOptions) + updateSecurityGroupOptionsModel.ID = core.StringPtr("testString") + updateSecurityGroupOptionsModel.SecurityGroupPatch = securityGroupPatchModelAsPatch + updateSecurityGroupOptionsModel.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.UpdateSecurityGroup(updateSecurityGroupOptionsModel) + 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 UpdateSecurityGroupOptions model with no property values + updateSecurityGroupOptionsModelNew := new(vpcv1.UpdateSecurityGroupOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateSecurityGroup(updateSecurityGroupOptionsModelNew) + 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 UpdateSecurityGroup 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 SecurityGroupPatch model + securityGroupPatchModel := new(vpcv1.SecurityGroupPatch) + securityGroupPatchModel.Name = core.StringPtr("my-security-group") + securityGroupPatchModelAsPatch, asPatchErr := securityGroupPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSecurityGroupOptions model + updateSecurityGroupOptionsModel := new(vpcv1.UpdateSecurityGroupOptions) + updateSecurityGroupOptionsModel.ID = core.StringPtr("testString") + updateSecurityGroupOptionsModel.SecurityGroupPatch = securityGroupPatchModelAsPatch + updateSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateSecurityGroup(updateSecurityGroupOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSecurityGroupRules(listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) - Operation response error`, func() { + version := "testString" + listSecurityGroupRulesPath := "/security_groups/testString/rules" + 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(listSecurityGroupRulesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListSecurityGroupRules 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 ListSecurityGroupRulesOptions model + listSecurityGroupRulesOptionsModel := new(vpcv1.ListSecurityGroupRulesOptions) + listSecurityGroupRulesOptionsModel.SecurityGroupID = core.StringPtr("testString") + listSecurityGroupRulesOptionsModel.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.ListSecurityGroupRules(listSecurityGroupRulesOptionsModel) + 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.ListSecurityGroupRules(listSecurityGroupRulesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSecurityGroupRules(listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions)`, func() { + version := "testString" + listSecurityGroupRulesPath := "/security_groups/testString/rules" + 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(listSecurityGroupRulesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}`) + })) + }) + It(`Invoke ListSecurityGroupRules 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 ListSecurityGroupRulesOptions model + listSecurityGroupRulesOptionsModel := new(vpcv1.ListSecurityGroupRulesOptions) + listSecurityGroupRulesOptionsModel.SecurityGroupID = core.StringPtr("testString") + listSecurityGroupRulesOptionsModel.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.ListSecurityGroupRulesWithContext(ctx, listSecurityGroupRulesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListSecurityGroupRules(listSecurityGroupRulesOptionsModel) + 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.ListSecurityGroupRulesWithContext(ctx, listSecurityGroupRulesOptionsModel) + 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(listSecurityGroupRulesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}`) + })) + }) + It(`Invoke ListSecurityGroupRules 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.ListSecurityGroupRules(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListSecurityGroupRulesOptions model + listSecurityGroupRulesOptionsModel := new(vpcv1.ListSecurityGroupRulesOptions) + listSecurityGroupRulesOptionsModel.SecurityGroupID = core.StringPtr("testString") + listSecurityGroupRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListSecurityGroupRules(listSecurityGroupRulesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListSecurityGroupRules 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 ListSecurityGroupRulesOptions model + listSecurityGroupRulesOptionsModel := new(vpcv1.ListSecurityGroupRulesOptions) + listSecurityGroupRulesOptionsModel.SecurityGroupID = core.StringPtr("testString") + listSecurityGroupRulesOptionsModel.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.ListSecurityGroupRules(listSecurityGroupRulesOptionsModel) + 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 ListSecurityGroupRulesOptions model with no property values + listSecurityGroupRulesOptionsModelNew := new(vpcv1.ListSecurityGroupRulesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListSecurityGroupRules(listSecurityGroupRulesOptionsModelNew) + 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 ListSecurityGroupRules 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 ListSecurityGroupRulesOptions model + listSecurityGroupRulesOptionsModel := new(vpcv1.ListSecurityGroupRulesOptions) + listSecurityGroupRulesOptionsModel.SecurityGroupID = core.StringPtr("testString") + listSecurityGroupRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListSecurityGroupRules(listSecurityGroupRulesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateSecurityGroupRule(createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) - Operation response error`, func() { + version := "testString" + createSecurityGroupRulePath := "/security_groups/testString/rules" + 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(createSecurityGroupRulePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateSecurityGroupRule 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 SecurityGroupRuleRemotePrototypeIP model + securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) + securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") + securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel + securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + + // Construct an instance of the CreateSecurityGroupRuleOptions model + createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) + createSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + createSecurityGroupRuleOptionsModel.SecurityGroupRulePrototype = securityGroupRulePrototypeModel + createSecurityGroupRuleOptionsModel.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.CreateSecurityGroupRule(createSecurityGroupRuleOptionsModel) + 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.CreateSecurityGroupRule(createSecurityGroupRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateSecurityGroupRule(createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions)`, func() { + version := "testString" + createSecurityGroupRulePath := "/security_groups/testString/rules" + 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(createSecurityGroupRulePath)) + 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{"testString"})) + 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) + })) + }) + It(`Invoke CreateSecurityGroupRule 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 SecurityGroupRuleRemotePrototypeIP model + securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) + securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") + securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel + securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + + // Construct an instance of the CreateSecurityGroupRuleOptions model + createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) + createSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + createSecurityGroupRuleOptionsModel.SecurityGroupRulePrototype = securityGroupRulePrototypeModel + createSecurityGroupRuleOptionsModel.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.CreateSecurityGroupRuleWithContext(ctx, createSecurityGroupRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateSecurityGroupRule(createSecurityGroupRuleOptionsModel) + 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.CreateSecurityGroupRuleWithContext(ctx, createSecurityGroupRuleOptionsModel) + 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(createSecurityGroupRulePath)) + 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{"testString"})) + 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) + })) + }) + It(`Invoke CreateSecurityGroupRule 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.CreateSecurityGroupRule(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the SecurityGroupRuleRemotePrototypeIP model + securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) + securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") + securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel + securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + + // Construct an instance of the CreateSecurityGroupRuleOptions model + createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) + createSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + createSecurityGroupRuleOptionsModel.SecurityGroupRulePrototype = securityGroupRulePrototypeModel + createSecurityGroupRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateSecurityGroupRule(createSecurityGroupRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateSecurityGroupRule 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 SecurityGroupRuleRemotePrototypeIP model + securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) + securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") + securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel + securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + + // Construct an instance of the CreateSecurityGroupRuleOptions model + createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) + createSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + createSecurityGroupRuleOptionsModel.SecurityGroupRulePrototype = securityGroupRulePrototypeModel + createSecurityGroupRuleOptionsModel.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.CreateSecurityGroupRule(createSecurityGroupRuleOptionsModel) + 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 CreateSecurityGroupRuleOptions model with no property values + createSecurityGroupRuleOptionsModelNew := new(vpcv1.CreateSecurityGroupRuleOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateSecurityGroupRule(createSecurityGroupRuleOptionsModelNew) + 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 CreateSecurityGroupRule 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 SecurityGroupRuleRemotePrototypeIP model + securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) + securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") + securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel + securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + + // Construct an instance of the CreateSecurityGroupRuleOptions model + createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) + createSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + createSecurityGroupRuleOptionsModel.SecurityGroupRulePrototype = securityGroupRulePrototypeModel + createSecurityGroupRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateSecurityGroupRule(createSecurityGroupRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteSecurityGroupRule(deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions)`, func() { + version := "testString" + deleteSecurityGroupRulePath := "/security_groups/testString/rules/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(deleteSecurityGroupRulePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteSecurityGroupRule 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.DeleteSecurityGroupRule(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteSecurityGroupRuleOptions model + deleteSecurityGroupRuleOptionsModel := new(vpcv1.DeleteSecurityGroupRuleOptions) + deleteSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + deleteSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") + deleteSecurityGroupRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteSecurityGroupRule(deleteSecurityGroupRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteSecurityGroupRule 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 DeleteSecurityGroupRuleOptions model + deleteSecurityGroupRuleOptionsModel := new(vpcv1.DeleteSecurityGroupRuleOptions) + deleteSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + deleteSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") + deleteSecurityGroupRuleOptionsModel.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.DeleteSecurityGroupRule(deleteSecurityGroupRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSecurityGroupRuleOptions model with no property values + deleteSecurityGroupRuleOptionsModelNew := new(vpcv1.DeleteSecurityGroupRuleOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteSecurityGroupRule(deleteSecurityGroupRuleOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSecurityGroupRule(getSecurityGroupRuleOptions *GetSecurityGroupRuleOptions) - Operation response error`, func() { + version := "testString" + getSecurityGroupRulePath := "/security_groups/testString/rules/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(getSecurityGroupRulePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetSecurityGroupRule 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 GetSecurityGroupRuleOptions model + getSecurityGroupRuleOptionsModel := new(vpcv1.GetSecurityGroupRuleOptions) + getSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + getSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupRuleOptionsModel.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.GetSecurityGroupRule(getSecurityGroupRuleOptionsModel) + 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.GetSecurityGroupRule(getSecurityGroupRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSecurityGroupRule(getSecurityGroupRuleOptions *GetSecurityGroupRuleOptions)`, func() { + version := "testString" + getSecurityGroupRulePath := "/security_groups/testString/rules/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(getSecurityGroupRulePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) + })) + }) + It(`Invoke GetSecurityGroupRule 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 GetSecurityGroupRuleOptions model + getSecurityGroupRuleOptionsModel := new(vpcv1.GetSecurityGroupRuleOptions) + getSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + getSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupRuleOptionsModel.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.GetSecurityGroupRuleWithContext(ctx, getSecurityGroupRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetSecurityGroupRule(getSecurityGroupRuleOptionsModel) + 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.GetSecurityGroupRuleWithContext(ctx, getSecurityGroupRuleOptionsModel) + 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(getSecurityGroupRulePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) + })) + }) + It(`Invoke GetSecurityGroupRule 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.GetSecurityGroupRule(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetSecurityGroupRuleOptions model + getSecurityGroupRuleOptionsModel := new(vpcv1.GetSecurityGroupRuleOptions) + getSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + getSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetSecurityGroupRule(getSecurityGroupRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetSecurityGroupRule 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 GetSecurityGroupRuleOptions model + getSecurityGroupRuleOptionsModel := new(vpcv1.GetSecurityGroupRuleOptions) + getSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + getSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupRuleOptionsModel.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.GetSecurityGroupRule(getSecurityGroupRuleOptionsModel) + 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 GetSecurityGroupRuleOptions model with no property values + getSecurityGroupRuleOptionsModelNew := new(vpcv1.GetSecurityGroupRuleOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetSecurityGroupRule(getSecurityGroupRuleOptionsModelNew) + 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 GetSecurityGroupRule 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 GetSecurityGroupRuleOptions model + getSecurityGroupRuleOptionsModel := new(vpcv1.GetSecurityGroupRuleOptions) + getSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + getSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetSecurityGroupRule(getSecurityGroupRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) - Operation response error`, func() { + version := "testString" + updateSecurityGroupRulePath := "/security_groups/testString/rules/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(updateSecurityGroupRulePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateSecurityGroupRule 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 SecurityGroupRuleRemotePatchIP model + securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) + securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePatch model + securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) + securityGroupRulePatchModel.Code = core.Int64Ptr(int64(0)) + securityGroupRulePatchModel.Direction = core.StringPtr("inbound") + securityGroupRulePatchModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePatchModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePatchModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePatchModel.Remote = securityGroupRuleRemotePatchModel + securityGroupRulePatchModel.Type = core.Int64Ptr(int64(8)) + securityGroupRulePatchModelAsPatch, asPatchErr := securityGroupRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSecurityGroupRuleOptions model + updateSecurityGroupRuleOptionsModel := new(vpcv1.UpdateSecurityGroupRuleOptions) + updateSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + updateSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") + updateSecurityGroupRuleOptionsModel.SecurityGroupRulePatch = securityGroupRulePatchModelAsPatch + updateSecurityGroupRuleOptionsModel.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.UpdateSecurityGroupRule(updateSecurityGroupRuleOptionsModel) + 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.UpdateSecurityGroupRule(updateSecurityGroupRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions)`, func() { + version := "testString" + updateSecurityGroupRulePath := "/security_groups/testString/rules/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(updateSecurityGroupRulePath)) + 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{"testString"})) + 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) + })) + }) + It(`Invoke UpdateSecurityGroupRule 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 SecurityGroupRuleRemotePatchIP model + securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) + securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePatch model + securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) + securityGroupRulePatchModel.Code = core.Int64Ptr(int64(0)) + securityGroupRulePatchModel.Direction = core.StringPtr("inbound") + securityGroupRulePatchModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePatchModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePatchModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePatchModel.Remote = securityGroupRuleRemotePatchModel + securityGroupRulePatchModel.Type = core.Int64Ptr(int64(8)) + securityGroupRulePatchModelAsPatch, asPatchErr := securityGroupRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSecurityGroupRuleOptions model + updateSecurityGroupRuleOptionsModel := new(vpcv1.UpdateSecurityGroupRuleOptions) + updateSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + updateSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") + updateSecurityGroupRuleOptionsModel.SecurityGroupRulePatch = securityGroupRulePatchModelAsPatch + updateSecurityGroupRuleOptionsModel.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.UpdateSecurityGroupRuleWithContext(ctx, updateSecurityGroupRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateSecurityGroupRule(updateSecurityGroupRuleOptionsModel) + 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.UpdateSecurityGroupRuleWithContext(ctx, updateSecurityGroupRuleOptionsModel) + 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(updateSecurityGroupRulePath)) + 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{"testString"})) + 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) + })) + }) + It(`Invoke UpdateSecurityGroupRule 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.UpdateSecurityGroupRule(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the SecurityGroupRuleRemotePatchIP model + securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) + securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePatch model + securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) + securityGroupRulePatchModel.Code = core.Int64Ptr(int64(0)) + securityGroupRulePatchModel.Direction = core.StringPtr("inbound") + securityGroupRulePatchModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePatchModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePatchModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePatchModel.Remote = securityGroupRuleRemotePatchModel + securityGroupRulePatchModel.Type = core.Int64Ptr(int64(8)) + securityGroupRulePatchModelAsPatch, asPatchErr := securityGroupRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSecurityGroupRuleOptions model + updateSecurityGroupRuleOptionsModel := new(vpcv1.UpdateSecurityGroupRuleOptions) + updateSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + updateSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") + updateSecurityGroupRuleOptionsModel.SecurityGroupRulePatch = securityGroupRulePatchModelAsPatch + updateSecurityGroupRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateSecurityGroupRule(updateSecurityGroupRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateSecurityGroupRule 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 SecurityGroupRuleRemotePatchIP model + securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) + securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePatch model + securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) + securityGroupRulePatchModel.Code = core.Int64Ptr(int64(0)) + securityGroupRulePatchModel.Direction = core.StringPtr("inbound") + securityGroupRulePatchModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePatchModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePatchModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePatchModel.Remote = securityGroupRuleRemotePatchModel + securityGroupRulePatchModel.Type = core.Int64Ptr(int64(8)) + securityGroupRulePatchModelAsPatch, asPatchErr := securityGroupRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSecurityGroupRuleOptions model + updateSecurityGroupRuleOptionsModel := new(vpcv1.UpdateSecurityGroupRuleOptions) + updateSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + updateSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") + updateSecurityGroupRuleOptionsModel.SecurityGroupRulePatch = securityGroupRulePatchModelAsPatch + updateSecurityGroupRuleOptionsModel.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.UpdateSecurityGroupRule(updateSecurityGroupRuleOptionsModel) + 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 UpdateSecurityGroupRuleOptions model with no property values + updateSecurityGroupRuleOptionsModelNew := new(vpcv1.UpdateSecurityGroupRuleOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateSecurityGroupRule(updateSecurityGroupRuleOptionsModelNew) + 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 UpdateSecurityGroupRule 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 SecurityGroupRuleRemotePatchIP model + securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) + securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SecurityGroupRulePatch model + securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) + securityGroupRulePatchModel.Code = core.Int64Ptr(int64(0)) + securityGroupRulePatchModel.Direction = core.StringPtr("inbound") + securityGroupRulePatchModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePatchModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePatchModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePatchModel.Remote = securityGroupRuleRemotePatchModel + securityGroupRulePatchModel.Type = core.Int64Ptr(int64(8)) + securityGroupRulePatchModelAsPatch, asPatchErr := securityGroupRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSecurityGroupRuleOptions model + updateSecurityGroupRuleOptionsModel := new(vpcv1.UpdateSecurityGroupRuleOptions) + updateSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") + updateSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") + updateSecurityGroupRuleOptionsModel.SecurityGroupRulePatch = securityGroupRulePatchModelAsPatch + updateSecurityGroupRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateSecurityGroupRule(updateSecurityGroupRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSecurityGroupTargets(listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) - Operation response error`, func() { + version := "testString" + listSecurityGroupTargetsPath := "/security_groups/testString/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(listSecurityGroupTargetsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListSecurityGroupTargets 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 ListSecurityGroupTargetsOptions model + listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) + listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") + listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") + listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupTargetsOptionsModel.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.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModel) + 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.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSecurityGroupTargets(listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions)`, func() { + version := "testString" + listSecurityGroupTargetsPath := "/security_groups/testString/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(listSecurityGroupTargetsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "total_count": 132}`) + })) + }) + It(`Invoke ListSecurityGroupTargets 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 ListSecurityGroupTargetsOptions model + listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) + listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") + listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") + listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupTargetsOptionsModel.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.ListSecurityGroupTargetsWithContext(ctx, listSecurityGroupTargetsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModel) + 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.ListSecurityGroupTargetsWithContext(ctx, listSecurityGroupTargetsOptionsModel) + 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(listSecurityGroupTargetsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "total_count": 132}`) + })) + }) + It(`Invoke ListSecurityGroupTargets 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.ListSecurityGroupTargets(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListSecurityGroupTargetsOptions model + listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) + listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") + listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") + listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListSecurityGroupTargets 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 ListSecurityGroupTargetsOptions model + listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) + listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") + listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") + listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupTargetsOptionsModel.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.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModel) + 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 ListSecurityGroupTargetsOptions model with no property values + listSecurityGroupTargetsOptionsModelNew := new(vpcv1.ListSecurityGroupTargetsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModelNew) + 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 ListSecurityGroupTargets 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 ListSecurityGroupTargetsOptions model + listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) + listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") + listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") + listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModel) + 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.SecurityGroupTargetCollection) + nextObject := new(vpcv1.SecurityGroupTargetCollectionNext) + 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.SecurityGroupTargetCollection) + + 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.SecurityGroupTargetCollection) + nextObject := new(vpcv1.SecurityGroupTargetCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions)`, func() { + version := "testString" + deleteSecurityGroupTargetBindingPath := "/security_groups/testString/targets/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(deleteSecurityGroupTargetBindingPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteSecurityGroupTargetBinding 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.DeleteSecurityGroupTargetBinding(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteSecurityGroupTargetBindingOptions model + deleteSecurityGroupTargetBindingOptionsModel := new(vpcv1.DeleteSecurityGroupTargetBindingOptions) + deleteSecurityGroupTargetBindingOptionsModel.SecurityGroupID = core.StringPtr("testString") + deleteSecurityGroupTargetBindingOptionsModel.ID = core.StringPtr("testString") + deleteSecurityGroupTargetBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteSecurityGroupTargetBinding 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 DeleteSecurityGroupTargetBindingOptions model + deleteSecurityGroupTargetBindingOptionsModel := new(vpcv1.DeleteSecurityGroupTargetBindingOptions) + deleteSecurityGroupTargetBindingOptionsModel.SecurityGroupID = core.StringPtr("testString") + deleteSecurityGroupTargetBindingOptionsModel.ID = core.StringPtr("testString") + deleteSecurityGroupTargetBindingOptionsModel.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.DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSecurityGroupTargetBindingOptions model with no property values + deleteSecurityGroupTargetBindingOptionsModelNew := new(vpcv1.DeleteSecurityGroupTargetBindingOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSecurityGroupTarget(getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) - Operation response error`, func() { + version := "testString" + getSecurityGroupTargetPath := "/security_groups/testString/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(getSecurityGroupTargetPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetSecurityGroupTarget 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 GetSecurityGroupTargetOptions model + getSecurityGroupTargetOptionsModel := new(vpcv1.GetSecurityGroupTargetOptions) + getSecurityGroupTargetOptionsModel.SecurityGroupID = core.StringPtr("testString") + getSecurityGroupTargetOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupTargetOptionsModel.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.GetSecurityGroupTarget(getSecurityGroupTargetOptionsModel) + 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.GetSecurityGroupTarget(getSecurityGroupTargetOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSecurityGroupTarget(getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions)`, func() { + version := "testString" + getSecurityGroupTargetPath := "/security_groups/testString/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(getSecurityGroupTargetPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}`) + })) + }) + It(`Invoke GetSecurityGroupTarget 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 GetSecurityGroupTargetOptions model + getSecurityGroupTargetOptionsModel := new(vpcv1.GetSecurityGroupTargetOptions) + getSecurityGroupTargetOptionsModel.SecurityGroupID = core.StringPtr("testString") + getSecurityGroupTargetOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupTargetOptionsModel.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.GetSecurityGroupTargetWithContext(ctx, getSecurityGroupTargetOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetSecurityGroupTarget(getSecurityGroupTargetOptionsModel) + 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.GetSecurityGroupTargetWithContext(ctx, getSecurityGroupTargetOptionsModel) + 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(getSecurityGroupTargetPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}`) + })) + }) + It(`Invoke GetSecurityGroupTarget 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.GetSecurityGroupTarget(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetSecurityGroupTargetOptions model + getSecurityGroupTargetOptionsModel := new(vpcv1.GetSecurityGroupTargetOptions) + getSecurityGroupTargetOptionsModel.SecurityGroupID = core.StringPtr("testString") + getSecurityGroupTargetOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetSecurityGroupTarget(getSecurityGroupTargetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetSecurityGroupTarget 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 GetSecurityGroupTargetOptions model + getSecurityGroupTargetOptionsModel := new(vpcv1.GetSecurityGroupTargetOptions) + getSecurityGroupTargetOptionsModel.SecurityGroupID = core.StringPtr("testString") + getSecurityGroupTargetOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupTargetOptionsModel.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.GetSecurityGroupTarget(getSecurityGroupTargetOptionsModel) + 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 GetSecurityGroupTargetOptions model with no property values + getSecurityGroupTargetOptionsModelNew := new(vpcv1.GetSecurityGroupTargetOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetSecurityGroupTarget(getSecurityGroupTargetOptionsModelNew) + 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 GetSecurityGroupTarget 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 GetSecurityGroupTargetOptions model + getSecurityGroupTargetOptionsModel := new(vpcv1.GetSecurityGroupTargetOptions) + getSecurityGroupTargetOptionsModel.SecurityGroupID = core.StringPtr("testString") + getSecurityGroupTargetOptionsModel.ID = core.StringPtr("testString") + getSecurityGroupTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetSecurityGroupTarget(getSecurityGroupTargetOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) - Operation response error`, func() { + version := "testString" + createSecurityGroupTargetBindingPath := "/security_groups/testString/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(createSecurityGroupTargetBindingPath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateSecurityGroupTargetBinding 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 CreateSecurityGroupTargetBindingOptions model + createSecurityGroupTargetBindingOptionsModel := new(vpcv1.CreateSecurityGroupTargetBindingOptions) + createSecurityGroupTargetBindingOptionsModel.SecurityGroupID = core.StringPtr("testString") + createSecurityGroupTargetBindingOptionsModel.ID = core.StringPtr("testString") + createSecurityGroupTargetBindingOptionsModel.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.CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptionsModel) + 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.CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions)`, func() { + version := "testString" + createSecurityGroupTargetBindingPath := "/security_groups/testString/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(createSecurityGroupTargetBindingPath)) + Expect(req.Method).To(Equal("PUT")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}`) + })) + }) + It(`Invoke CreateSecurityGroupTargetBinding 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 CreateSecurityGroupTargetBindingOptions model + createSecurityGroupTargetBindingOptionsModel := new(vpcv1.CreateSecurityGroupTargetBindingOptions) + createSecurityGroupTargetBindingOptionsModel.SecurityGroupID = core.StringPtr("testString") + createSecurityGroupTargetBindingOptionsModel.ID = core.StringPtr("testString") + createSecurityGroupTargetBindingOptionsModel.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.CreateSecurityGroupTargetBindingWithContext(ctx, createSecurityGroupTargetBindingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptionsModel) + 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.CreateSecurityGroupTargetBindingWithContext(ctx, createSecurityGroupTargetBindingOptionsModel) + 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(createSecurityGroupTargetBindingPath)) + Expect(req.Method).To(Equal("PUT")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}`) + })) + }) + It(`Invoke CreateSecurityGroupTargetBinding 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.CreateSecurityGroupTargetBinding(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the CreateSecurityGroupTargetBindingOptions model + createSecurityGroupTargetBindingOptionsModel := new(vpcv1.CreateSecurityGroupTargetBindingOptions) + createSecurityGroupTargetBindingOptionsModel.SecurityGroupID = core.StringPtr("testString") + createSecurityGroupTargetBindingOptionsModel.ID = core.StringPtr("testString") + createSecurityGroupTargetBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateSecurityGroupTargetBinding 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 CreateSecurityGroupTargetBindingOptions model + createSecurityGroupTargetBindingOptionsModel := new(vpcv1.CreateSecurityGroupTargetBindingOptions) + createSecurityGroupTargetBindingOptionsModel.SecurityGroupID = core.StringPtr("testString") + createSecurityGroupTargetBindingOptionsModel.ID = core.StringPtr("testString") + createSecurityGroupTargetBindingOptionsModel.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.CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptionsModel) + 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 CreateSecurityGroupTargetBindingOptions model with no property values + createSecurityGroupTargetBindingOptionsModelNew := new(vpcv1.CreateSecurityGroupTargetBindingOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptionsModelNew) + 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 CreateSecurityGroupTargetBinding 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 CreateSecurityGroupTargetBindingOptions model + createSecurityGroupTargetBindingOptionsModel := new(vpcv1.CreateSecurityGroupTargetBindingOptions) + createSecurityGroupTargetBindingOptionsModel.SecurityGroupID = core.StringPtr("testString") + createSecurityGroupTargetBindingOptionsModel.ID = core.StringPtr("testString") + createSecurityGroupTargetBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) - Operation response error`, func() { + version := "testString" + listIkePoliciesPath := "/ike_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(listIkePoliciesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListIkePolicies 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 ListIkePoliciesOptions model + listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) + listIkePoliciesOptionsModel.Start = core.StringPtr("testString") + listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIkePoliciesOptionsModel.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.ListIkePolicies(listIkePoliciesOptionsModel) + 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.ListIkePolicies(listIkePoliciesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions)`, func() { + version := "testString" + listIkePoliciesPath := "/ike_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(listIkePoliciesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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}`) + })) + }) + It(`Invoke ListIkePolicies 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 ListIkePoliciesOptions model + listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) + listIkePoliciesOptionsModel.Start = core.StringPtr("testString") + listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIkePoliciesOptionsModel.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.ListIkePoliciesWithContext(ctx, listIkePoliciesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListIkePolicies(listIkePoliciesOptionsModel) + 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.ListIkePoliciesWithContext(ctx, listIkePoliciesOptionsModel) + 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(listIkePoliciesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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}`) + })) + }) + It(`Invoke ListIkePolicies 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.ListIkePolicies(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListIkePoliciesOptions model + listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) + listIkePoliciesOptionsModel.Start = core.StringPtr("testString") + listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIkePoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListIkePolicies(listIkePoliciesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListIkePolicies 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 ListIkePoliciesOptions model + listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) + listIkePoliciesOptionsModel.Start = core.StringPtr("testString") + listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIkePoliciesOptionsModel.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.ListIkePolicies(listIkePoliciesOptionsModel) + 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 ListIkePolicies 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 ListIkePoliciesOptions model + listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) + listIkePoliciesOptionsModel.Start = core.StringPtr("testString") + listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIkePoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListIkePolicies(listIkePoliciesOptionsModel) + 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.IkePolicyCollection) + nextObject := new(vpcv1.IkePolicyCollectionNext) + 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.IkePolicyCollection) + + 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.IkePolicyCollection) + nextObject := new(vpcv1.IkePolicyCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateIkePolicy(createIkePolicyOptions *CreateIkePolicyOptions) - Operation response error`, func() { + version := "testString" + createIkePolicyPath := "/ike_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(createIkePolicyPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateIkePolicy 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateIkePolicyOptions model + createIkePolicyOptionsModel := new(vpcv1.CreateIkePolicyOptions) + createIkePolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIkePolicyOptionsModel.DhGroup = core.Int64Ptr(int64(14)) + createIkePolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") + createIkePolicyOptionsModel.IkeVersion = core.Int64Ptr(int64(1)) + createIkePolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(28800)) + createIkePolicyOptionsModel.Name = core.StringPtr("my-ike-policy") + createIkePolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createIkePolicyOptionsModel.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.CreateIkePolicy(createIkePolicyOptionsModel) + 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.CreateIkePolicy(createIkePolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateIkePolicy(createIkePolicyOptions *CreateIkePolicyOptions)`, func() { + version := "testString" + createIkePolicyPath := "/ike_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(createIkePolicyPath)) + 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{"testString"})) + 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", `{"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"}`) + })) + }) + It(`Invoke CreateIkePolicy 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateIkePolicyOptions model + createIkePolicyOptionsModel := new(vpcv1.CreateIkePolicyOptions) + createIkePolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIkePolicyOptionsModel.DhGroup = core.Int64Ptr(int64(14)) + createIkePolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") + createIkePolicyOptionsModel.IkeVersion = core.Int64Ptr(int64(1)) + createIkePolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(28800)) + createIkePolicyOptionsModel.Name = core.StringPtr("my-ike-policy") + createIkePolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createIkePolicyOptionsModel.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.CreateIkePolicyWithContext(ctx, createIkePolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateIkePolicy(createIkePolicyOptionsModel) + 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.CreateIkePolicyWithContext(ctx, createIkePolicyOptionsModel) + 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(createIkePolicyPath)) + 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{"testString"})) + 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", `{"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"}`) + })) + }) + It(`Invoke CreateIkePolicy 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.CreateIkePolicy(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 CreateIkePolicyOptions model + createIkePolicyOptionsModel := new(vpcv1.CreateIkePolicyOptions) + createIkePolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIkePolicyOptionsModel.DhGroup = core.Int64Ptr(int64(14)) + createIkePolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") + createIkePolicyOptionsModel.IkeVersion = core.Int64Ptr(int64(1)) + createIkePolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(28800)) + createIkePolicyOptionsModel.Name = core.StringPtr("my-ike-policy") + createIkePolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateIkePolicy(createIkePolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateIkePolicy 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 CreateIkePolicyOptions model + createIkePolicyOptionsModel := new(vpcv1.CreateIkePolicyOptions) + createIkePolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIkePolicyOptionsModel.DhGroup = core.Int64Ptr(int64(14)) + createIkePolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") + createIkePolicyOptionsModel.IkeVersion = core.Int64Ptr(int64(1)) + createIkePolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(28800)) + createIkePolicyOptionsModel.Name = core.StringPtr("my-ike-policy") + createIkePolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createIkePolicyOptionsModel.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.CreateIkePolicy(createIkePolicyOptionsModel) + 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 CreateIkePolicyOptions model with no property values + createIkePolicyOptionsModelNew := new(vpcv1.CreateIkePolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateIkePolicy(createIkePolicyOptionsModelNew) + 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 CreateIkePolicy 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") + + // Construct an instance of the CreateIkePolicyOptions model + createIkePolicyOptionsModel := new(vpcv1.CreateIkePolicyOptions) + createIkePolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIkePolicyOptionsModel.DhGroup = core.Int64Ptr(int64(14)) + createIkePolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") + createIkePolicyOptionsModel.IkeVersion = core.Int64Ptr(int64(1)) + createIkePolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(28800)) + createIkePolicyOptionsModel.Name = core.StringPtr("my-ike-policy") + createIkePolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateIkePolicy(createIkePolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteIkePolicy(deleteIkePolicyOptions *DeleteIkePolicyOptions)`, func() { + version := "testString" + deleteIkePolicyPath := "/ike_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(deleteIkePolicyPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteIkePolicy 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.DeleteIkePolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteIkePolicyOptions model + deleteIkePolicyOptionsModel := new(vpcv1.DeleteIkePolicyOptions) + deleteIkePolicyOptionsModel.ID = core.StringPtr("testString") + deleteIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteIkePolicy(deleteIkePolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteIkePolicy 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 DeleteIkePolicyOptions model + deleteIkePolicyOptionsModel := new(vpcv1.DeleteIkePolicyOptions) + deleteIkePolicyOptionsModel.ID = core.StringPtr("testString") + deleteIkePolicyOptionsModel.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.DeleteIkePolicy(deleteIkePolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteIkePolicyOptions model with no property values + deleteIkePolicyOptionsModelNew := new(vpcv1.DeleteIkePolicyOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteIkePolicy(deleteIkePolicyOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetIkePolicy(getIkePolicyOptions *GetIkePolicyOptions) - Operation response error`, func() { + version := "testString" + getIkePolicyPath := "/ike_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(getIkePolicyPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetIkePolicy 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 GetIkePolicyOptions model + getIkePolicyOptionsModel := new(vpcv1.GetIkePolicyOptions) + getIkePolicyOptionsModel.ID = core.StringPtr("testString") + getIkePolicyOptionsModel.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.GetIkePolicy(getIkePolicyOptionsModel) + 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.GetIkePolicy(getIkePolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetIkePolicy(getIkePolicyOptions *GetIkePolicyOptions)`, func() { + version := "testString" + getIkePolicyPath := "/ike_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(getIkePolicyPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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"}`) + })) + }) + It(`Invoke GetIkePolicy 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 GetIkePolicyOptions model + getIkePolicyOptionsModel := new(vpcv1.GetIkePolicyOptions) + getIkePolicyOptionsModel.ID = core.StringPtr("testString") + getIkePolicyOptionsModel.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.GetIkePolicyWithContext(ctx, getIkePolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetIkePolicy(getIkePolicyOptionsModel) + 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.GetIkePolicyWithContext(ctx, getIkePolicyOptionsModel) + 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(getIkePolicyPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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"}`) + })) + }) + It(`Invoke GetIkePolicy 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.GetIkePolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetIkePolicyOptions model + getIkePolicyOptionsModel := new(vpcv1.GetIkePolicyOptions) + getIkePolicyOptionsModel.ID = core.StringPtr("testString") + getIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetIkePolicy(getIkePolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetIkePolicy 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 GetIkePolicyOptions model + getIkePolicyOptionsModel := new(vpcv1.GetIkePolicyOptions) + getIkePolicyOptionsModel.ID = core.StringPtr("testString") + getIkePolicyOptionsModel.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.GetIkePolicy(getIkePolicyOptionsModel) + 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 GetIkePolicyOptions model with no property values + getIkePolicyOptionsModelNew := new(vpcv1.GetIkePolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetIkePolicy(getIkePolicyOptionsModelNew) + 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 GetIkePolicy 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 GetIkePolicyOptions model + getIkePolicyOptionsModel := new(vpcv1.GetIkePolicyOptions) + getIkePolicyOptionsModel.ID = core.StringPtr("testString") + getIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetIkePolicy(getIkePolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateIkePolicy(updateIkePolicyOptions *UpdateIkePolicyOptions) - Operation response error`, func() { + version := "testString" + updateIkePolicyPath := "/ike_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(updateIkePolicyPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateIkePolicy 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 UpdateIkePolicyOptions model + updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) + updateIkePolicyOptionsModel.ID = core.StringPtr("testString") + updateIkePolicyOptionsModel.IkePolicyPatch = make(map[string]interface{}) + updateIkePolicyOptionsModel.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.UpdateIkePolicy(updateIkePolicyOptionsModel) + 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.UpdateIkePolicy(updateIkePolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateIkePolicy(updateIkePolicyOptions *UpdateIkePolicyOptions)`, func() { + version := "testString" + updateIkePolicyPath := "/ike_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(updateIkePolicyPath)) + 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{"testString"})) + 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", `{"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"}`) + })) + }) + It(`Invoke UpdateIkePolicy 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 UpdateIkePolicyOptions model + updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) + updateIkePolicyOptionsModel.ID = core.StringPtr("testString") + updateIkePolicyOptionsModel.IkePolicyPatch = make(map[string]interface{}) + updateIkePolicyOptionsModel.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.UpdateIkePolicyWithContext(ctx, updateIkePolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateIkePolicy(updateIkePolicyOptionsModel) + 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.UpdateIkePolicyWithContext(ctx, updateIkePolicyOptionsModel) + 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(updateIkePolicyPath)) + 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{"testString"})) + 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", `{"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"}`) + })) + }) + It(`Invoke UpdateIkePolicy 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.UpdateIkePolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the UpdateIkePolicyOptions model + updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) + updateIkePolicyOptionsModel.ID = core.StringPtr("testString") + updateIkePolicyOptionsModel.IkePolicyPatch = make(map[string]interface{}) + updateIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateIkePolicy(updateIkePolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateIkePolicy 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 UpdateIkePolicyOptions model + updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) + updateIkePolicyOptionsModel.ID = core.StringPtr("testString") + updateIkePolicyOptionsModel.IkePolicyPatch = make(map[string]interface{}) + updateIkePolicyOptionsModel.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.UpdateIkePolicy(updateIkePolicyOptionsModel) + 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 UpdateIkePolicyOptions model with no property values + updateIkePolicyOptionsModelNew := new(vpcv1.UpdateIkePolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateIkePolicy(updateIkePolicyOptionsModelNew) + 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 UpdateIkePolicy 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 UpdateIkePolicyOptions model + updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) + updateIkePolicyOptionsModel.ID = core.StringPtr("testString") + updateIkePolicyOptionsModel.IkePolicyPatch = make(map[string]interface{}) + updateIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateIkePolicy(updateIkePolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) - Operation response error`, func() { + version := "testString" + listIkePolicyConnectionsPath := "/ike_policies/testString/connections" + 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(listIkePolicyConnectionsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListIkePolicyConnections 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 ListIkePolicyConnectionsOptions model + listIkePolicyConnectionsOptionsModel := new(vpcv1.ListIkePolicyConnectionsOptions) + listIkePolicyConnectionsOptionsModel.ID = core.StringPtr("testString") + listIkePolicyConnectionsOptionsModel.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.ListIkePolicyConnections(listIkePolicyConnectionsOptionsModel) + 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.ListIkePolicyConnections(listIkePolicyConnectionsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions)`, func() { + version := "testString" + listIkePolicyConnectionsPath := "/ike_policies/testString/connections" + 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(listIkePolicyConnectionsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}`) + })) + }) + It(`Invoke ListIkePolicyConnections 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 ListIkePolicyConnectionsOptions model + listIkePolicyConnectionsOptionsModel := new(vpcv1.ListIkePolicyConnectionsOptions) + listIkePolicyConnectionsOptionsModel.ID = core.StringPtr("testString") + listIkePolicyConnectionsOptionsModel.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.ListIkePolicyConnectionsWithContext(ctx, listIkePolicyConnectionsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListIkePolicyConnections(listIkePolicyConnectionsOptionsModel) + 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.ListIkePolicyConnectionsWithContext(ctx, listIkePolicyConnectionsOptionsModel) + 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(listIkePolicyConnectionsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}`) + })) + }) + It(`Invoke ListIkePolicyConnections 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.ListIkePolicyConnections(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListIkePolicyConnectionsOptions model + listIkePolicyConnectionsOptionsModel := new(vpcv1.ListIkePolicyConnectionsOptions) + listIkePolicyConnectionsOptionsModel.ID = core.StringPtr("testString") + listIkePolicyConnectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListIkePolicyConnections(listIkePolicyConnectionsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListIkePolicyConnections 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 ListIkePolicyConnectionsOptions model + listIkePolicyConnectionsOptionsModel := new(vpcv1.ListIkePolicyConnectionsOptions) + listIkePolicyConnectionsOptionsModel.ID = core.StringPtr("testString") + listIkePolicyConnectionsOptionsModel.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.ListIkePolicyConnections(listIkePolicyConnectionsOptionsModel) + 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 ListIkePolicyConnectionsOptions model with no property values + listIkePolicyConnectionsOptionsModelNew := new(vpcv1.ListIkePolicyConnectionsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListIkePolicyConnections(listIkePolicyConnectionsOptionsModelNew) + 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 ListIkePolicyConnections 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 ListIkePolicyConnectionsOptions model + listIkePolicyConnectionsOptionsModel := new(vpcv1.ListIkePolicyConnectionsOptions) + listIkePolicyConnectionsOptionsModel.ID = core.StringPtr("testString") + listIkePolicyConnectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListIkePolicyConnections(listIkePolicyConnectionsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) - Operation response error`, func() { + version := "testString" + listIpsecPoliciesPath := "/ipsec_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(listIpsecPoliciesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListIpsecPolicies 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 ListIpsecPoliciesOptions model + listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) + listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") + listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIpsecPoliciesOptionsModel.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.ListIpsecPolicies(listIpsecPoliciesOptionsModel) + 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.ListIpsecPolicies(listIpsecPoliciesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions)`, func() { + version := "testString" + listIpsecPoliciesPath := "/ipsec_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(listIpsecPoliciesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/ipsec_policies?limit=20"}, "ipsec_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", "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}`) + })) + }) + It(`Invoke ListIpsecPolicies 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 ListIpsecPoliciesOptions model + listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) + listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") + listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIpsecPoliciesOptionsModel.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.ListIpsecPoliciesWithContext(ctx, listIpsecPoliciesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListIpsecPolicies(listIpsecPoliciesOptionsModel) + 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.ListIpsecPoliciesWithContext(ctx, listIpsecPoliciesOptionsModel) + 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(listIpsecPoliciesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/ipsec_policies?limit=20"}, "ipsec_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", "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}`) + })) + }) + It(`Invoke ListIpsecPolicies 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.ListIpsecPolicies(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListIpsecPoliciesOptions model + listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) + listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") + listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIpsecPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListIpsecPolicies(listIpsecPoliciesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListIpsecPolicies 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 ListIpsecPoliciesOptions model + listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) + listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") + listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIpsecPoliciesOptionsModel.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.ListIpsecPolicies(listIpsecPoliciesOptionsModel) + 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 ListIpsecPolicies 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 ListIpsecPoliciesOptions model + listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) + listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") + listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIpsecPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListIpsecPolicies(listIpsecPoliciesOptionsModel) + 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.IPsecPolicyCollection) + nextObject := new(vpcv1.IPsecPolicyCollectionNext) + 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.IPsecPolicyCollection) + + 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.IPsecPolicyCollection) + nextObject := new(vpcv1.IPsecPolicyCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateIpsecPolicy(createIpsecPolicyOptions *CreateIpsecPolicyOptions) - Operation response error`, func() { + version := "testString" + createIpsecPolicyPath := "/ipsec_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(createIpsecPolicyPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateIpsecPolicy 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateIpsecPolicyOptions model + createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) + createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") + createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") + createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) + createIpsecPolicyOptionsModel.Name = core.StringPtr("my-ipsec-policy") + createIpsecPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createIpsecPolicyOptionsModel.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.CreateIpsecPolicy(createIpsecPolicyOptionsModel) + 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.CreateIpsecPolicy(createIpsecPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateIpsecPolicy(createIpsecPolicyOptions *CreateIpsecPolicyOptions)`, func() { + version := "testString" + createIpsecPolicyPath := "/ipsec_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(createIpsecPolicyPath)) + 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{"testString"})) + 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", `{"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", "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"}`) + })) + }) + It(`Invoke CreateIpsecPolicy 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateIpsecPolicyOptions model + createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) + createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") + createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") + createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) + createIpsecPolicyOptionsModel.Name = core.StringPtr("my-ipsec-policy") + createIpsecPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createIpsecPolicyOptionsModel.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.CreateIpsecPolicyWithContext(ctx, createIpsecPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateIpsecPolicy(createIpsecPolicyOptionsModel) + 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.CreateIpsecPolicyWithContext(ctx, createIpsecPolicyOptionsModel) + 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(createIpsecPolicyPath)) + 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{"testString"})) + 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", `{"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", "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"}`) + })) + }) + It(`Invoke CreateIpsecPolicy 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.CreateIpsecPolicy(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 CreateIpsecPolicyOptions model + createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) + createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") + createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") + createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) + createIpsecPolicyOptionsModel.Name = core.StringPtr("my-ipsec-policy") + createIpsecPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createIpsecPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateIpsecPolicy(createIpsecPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateIpsecPolicy 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 CreateIpsecPolicyOptions model + createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) + createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") + createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") + createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) + createIpsecPolicyOptionsModel.Name = core.StringPtr("my-ipsec-policy") + createIpsecPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createIpsecPolicyOptionsModel.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.CreateIpsecPolicy(createIpsecPolicyOptionsModel) + 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 CreateIpsecPolicyOptions model with no property values + createIpsecPolicyOptionsModelNew := new(vpcv1.CreateIpsecPolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateIpsecPolicy(createIpsecPolicyOptionsModelNew) + 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 CreateIpsecPolicy 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") + + // Construct an instance of the CreateIpsecPolicyOptions model + createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) + createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") + createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") + createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) + createIpsecPolicyOptionsModel.Name = core.StringPtr("my-ipsec-policy") + createIpsecPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel + createIpsecPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateIpsecPolicy(createIpsecPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteIpsecPolicy(deleteIpsecPolicyOptions *DeleteIpsecPolicyOptions)`, func() { + version := "testString" + deleteIpsecPolicyPath := "/ipsec_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(deleteIpsecPolicyPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteIpsecPolicy 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.DeleteIpsecPolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteIpsecPolicyOptions model + deleteIpsecPolicyOptionsModel := new(vpcv1.DeleteIpsecPolicyOptions) + deleteIpsecPolicyOptionsModel.ID = core.StringPtr("testString") + deleteIpsecPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteIpsecPolicy(deleteIpsecPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteIpsecPolicy 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 DeleteIpsecPolicyOptions model + deleteIpsecPolicyOptionsModel := new(vpcv1.DeleteIpsecPolicyOptions) + deleteIpsecPolicyOptionsModel.ID = core.StringPtr("testString") + deleteIpsecPolicyOptionsModel.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.DeleteIpsecPolicy(deleteIpsecPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteIpsecPolicyOptions model with no property values + deleteIpsecPolicyOptionsModelNew := new(vpcv1.DeleteIpsecPolicyOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteIpsecPolicy(deleteIpsecPolicyOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetIpsecPolicy(getIpsecPolicyOptions *GetIpsecPolicyOptions) - Operation response error`, func() { + version := "testString" + getIpsecPolicyPath := "/ipsec_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(getIpsecPolicyPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetIpsecPolicy 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 GetIpsecPolicyOptions model + getIpsecPolicyOptionsModel := new(vpcv1.GetIpsecPolicyOptions) + getIpsecPolicyOptionsModel.ID = core.StringPtr("testString") + getIpsecPolicyOptionsModel.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.GetIpsecPolicy(getIpsecPolicyOptionsModel) + 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.GetIpsecPolicy(getIpsecPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetIpsecPolicy(getIpsecPolicyOptions *GetIpsecPolicyOptions)`, func() { + version := "testString" + getIpsecPolicyPath := "/ipsec_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(getIpsecPolicyPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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", "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"}`) + })) + }) + It(`Invoke GetIpsecPolicy 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 GetIpsecPolicyOptions model + getIpsecPolicyOptionsModel := new(vpcv1.GetIpsecPolicyOptions) + getIpsecPolicyOptionsModel.ID = core.StringPtr("testString") + getIpsecPolicyOptionsModel.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.GetIpsecPolicyWithContext(ctx, getIpsecPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetIpsecPolicy(getIpsecPolicyOptionsModel) + 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.GetIpsecPolicyWithContext(ctx, getIpsecPolicyOptionsModel) + 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(getIpsecPolicyPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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", "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"}`) + })) + }) + It(`Invoke GetIpsecPolicy 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.GetIpsecPolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetIpsecPolicyOptions model + getIpsecPolicyOptionsModel := new(vpcv1.GetIpsecPolicyOptions) + getIpsecPolicyOptionsModel.ID = core.StringPtr("testString") + getIpsecPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetIpsecPolicy(getIpsecPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetIpsecPolicy 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 GetIpsecPolicyOptions model + getIpsecPolicyOptionsModel := new(vpcv1.GetIpsecPolicyOptions) + getIpsecPolicyOptionsModel.ID = core.StringPtr("testString") + getIpsecPolicyOptionsModel.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.GetIpsecPolicy(getIpsecPolicyOptionsModel) + 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 GetIpsecPolicyOptions model with no property values + getIpsecPolicyOptionsModelNew := new(vpcv1.GetIpsecPolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetIpsecPolicy(getIpsecPolicyOptionsModelNew) + 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 GetIpsecPolicy 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 GetIpsecPolicyOptions model + getIpsecPolicyOptionsModel := new(vpcv1.GetIpsecPolicyOptions) + getIpsecPolicyOptionsModel.ID = core.StringPtr("testString") + getIpsecPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetIpsecPolicy(getIpsecPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateIpsecPolicy(updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) - Operation response error`, func() { + version := "testString" + updateIpsecPolicyPath := "/ipsec_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(updateIpsecPolicyPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateIpsecPolicy 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 IPsecPolicyPatch model + iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) + iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("md5") + iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") + iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) + iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") + iPsecPolicyPatchModel.Pfs = core.StringPtr("disabled") + iPsecPolicyPatchModelAsPatch, asPatchErr := iPsecPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateIpsecPolicyOptions model + updateIpsecPolicyOptionsModel := new(vpcv1.UpdateIpsecPolicyOptions) + updateIpsecPolicyOptionsModel.ID = core.StringPtr("testString") + updateIpsecPolicyOptionsModel.IPsecPolicyPatch = iPsecPolicyPatchModelAsPatch + updateIpsecPolicyOptionsModel.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.UpdateIpsecPolicy(updateIpsecPolicyOptionsModel) + 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.UpdateIpsecPolicy(updateIpsecPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateIpsecPolicy(updateIpsecPolicyOptions *UpdateIpsecPolicyOptions)`, func() { + version := "testString" + updateIpsecPolicyPath := "/ipsec_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(updateIpsecPolicyPath)) + 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{"testString"})) + 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", `{"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", "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"}`) + })) + }) + It(`Invoke UpdateIpsecPolicy 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 IPsecPolicyPatch model + iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) + iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("md5") + iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") + iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) + iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") + iPsecPolicyPatchModel.Pfs = core.StringPtr("disabled") + iPsecPolicyPatchModelAsPatch, asPatchErr := iPsecPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateIpsecPolicyOptions model + updateIpsecPolicyOptionsModel := new(vpcv1.UpdateIpsecPolicyOptions) + updateIpsecPolicyOptionsModel.ID = core.StringPtr("testString") + updateIpsecPolicyOptionsModel.IPsecPolicyPatch = iPsecPolicyPatchModelAsPatch + updateIpsecPolicyOptionsModel.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.UpdateIpsecPolicyWithContext(ctx, updateIpsecPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateIpsecPolicy(updateIpsecPolicyOptionsModel) + 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.UpdateIpsecPolicyWithContext(ctx, updateIpsecPolicyOptionsModel) + 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(updateIpsecPolicyPath)) + 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{"testString"})) + 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", `{"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", "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"}`) + })) + }) + It(`Invoke UpdateIpsecPolicy 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.UpdateIpsecPolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the IPsecPolicyPatch model + iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) + iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("md5") + iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") + iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) + iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") + iPsecPolicyPatchModel.Pfs = core.StringPtr("disabled") + iPsecPolicyPatchModelAsPatch, asPatchErr := iPsecPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateIpsecPolicyOptions model + updateIpsecPolicyOptionsModel := new(vpcv1.UpdateIpsecPolicyOptions) + updateIpsecPolicyOptionsModel.ID = core.StringPtr("testString") + updateIpsecPolicyOptionsModel.IPsecPolicyPatch = iPsecPolicyPatchModelAsPatch + updateIpsecPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateIpsecPolicy(updateIpsecPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateIpsecPolicy 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 IPsecPolicyPatch model + iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) + iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("md5") + iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") + iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) + iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") + iPsecPolicyPatchModel.Pfs = core.StringPtr("disabled") + iPsecPolicyPatchModelAsPatch, asPatchErr := iPsecPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateIpsecPolicyOptions model + updateIpsecPolicyOptionsModel := new(vpcv1.UpdateIpsecPolicyOptions) + updateIpsecPolicyOptionsModel.ID = core.StringPtr("testString") + updateIpsecPolicyOptionsModel.IPsecPolicyPatch = iPsecPolicyPatchModelAsPatch + updateIpsecPolicyOptionsModel.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.UpdateIpsecPolicy(updateIpsecPolicyOptionsModel) + 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 UpdateIpsecPolicyOptions model with no property values + updateIpsecPolicyOptionsModelNew := new(vpcv1.UpdateIpsecPolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateIpsecPolicy(updateIpsecPolicyOptionsModelNew) + 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 UpdateIpsecPolicy 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 IPsecPolicyPatch model + iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) + iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("md5") + iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") + iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) + iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") + iPsecPolicyPatchModel.Pfs = core.StringPtr("disabled") + iPsecPolicyPatchModelAsPatch, asPatchErr := iPsecPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateIpsecPolicyOptions model + updateIpsecPolicyOptionsModel := new(vpcv1.UpdateIpsecPolicyOptions) + updateIpsecPolicyOptionsModel.ID = core.StringPtr("testString") + updateIpsecPolicyOptionsModel.IPsecPolicyPatch = iPsecPolicyPatchModelAsPatch + updateIpsecPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateIpsecPolicy(updateIpsecPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) - Operation response error`, func() { + version := "testString" + listIpsecPolicyConnectionsPath := "/ipsec_policies/testString/connections" + 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(listIpsecPolicyConnectionsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListIpsecPolicyConnections 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 ListIpsecPolicyConnectionsOptions model + listIpsecPolicyConnectionsOptionsModel := new(vpcv1.ListIpsecPolicyConnectionsOptions) + listIpsecPolicyConnectionsOptionsModel.ID = core.StringPtr("testString") + listIpsecPolicyConnectionsOptionsModel.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.ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptionsModel) + 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.ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions)`, func() { + version := "testString" + listIpsecPolicyConnectionsPath := "/ipsec_policies/testString/connections" + 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(listIpsecPolicyConnectionsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}`) + })) + }) + It(`Invoke ListIpsecPolicyConnections 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 ListIpsecPolicyConnectionsOptions model + listIpsecPolicyConnectionsOptionsModel := new(vpcv1.ListIpsecPolicyConnectionsOptions) + listIpsecPolicyConnectionsOptionsModel.ID = core.StringPtr("testString") + listIpsecPolicyConnectionsOptionsModel.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.ListIpsecPolicyConnectionsWithContext(ctx, listIpsecPolicyConnectionsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptionsModel) + 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.ListIpsecPolicyConnectionsWithContext(ctx, listIpsecPolicyConnectionsOptionsModel) + 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(listIpsecPolicyConnectionsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}`) + })) + }) + It(`Invoke ListIpsecPolicyConnections 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.ListIpsecPolicyConnections(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListIpsecPolicyConnectionsOptions model + listIpsecPolicyConnectionsOptionsModel := new(vpcv1.ListIpsecPolicyConnectionsOptions) + listIpsecPolicyConnectionsOptionsModel.ID = core.StringPtr("testString") + listIpsecPolicyConnectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListIpsecPolicyConnections 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 ListIpsecPolicyConnectionsOptions model + listIpsecPolicyConnectionsOptionsModel := new(vpcv1.ListIpsecPolicyConnectionsOptions) + listIpsecPolicyConnectionsOptionsModel.ID = core.StringPtr("testString") + listIpsecPolicyConnectionsOptionsModel.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.ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptionsModel) + 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 ListIpsecPolicyConnectionsOptions model with no property values + listIpsecPolicyConnectionsOptionsModelNew := new(vpcv1.ListIpsecPolicyConnectionsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptionsModelNew) + 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 ListIpsecPolicyConnections 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 ListIpsecPolicyConnectionsOptions model + listIpsecPolicyConnectionsOptionsModel := new(vpcv1.ListIpsecPolicyConnectionsOptions) + listIpsecPolicyConnectionsOptionsModel.ID = core.StringPtr("testString") + listIpsecPolicyConnectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) - Operation response error`, func() { + version := "testString" + listVPNGatewaysPath := "/vpn_gateways" + 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(listVPNGatewaysPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["mode"]).To(Equal([]string{"route"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListVPNGateways 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 ListVPNGatewaysOptions model + listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) + listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") + listVPNGatewaysOptionsModel.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.ListVPNGateways(listVPNGatewaysOptionsModel) + 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.ListVPNGateways(listVPNGatewaysOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions)`, func() { + version := "testString" + listVPNGatewaysPath := "/vpn_gateways" + 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(listVPNGatewaysPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["mode"]).To(Equal([]string{"route"})) + // 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/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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}]}`) + })) + }) + It(`Invoke ListVPNGateways 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 ListVPNGatewaysOptions model + listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) + listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") + listVPNGatewaysOptionsModel.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.ListVPNGatewaysWithContext(ctx, listVPNGatewaysOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVPNGateways(listVPNGatewaysOptionsModel) + 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.ListVPNGatewaysWithContext(ctx, listVPNGatewaysOptionsModel) + 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(listVPNGatewaysPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["mode"]).To(Equal([]string{"route"})) + // 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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}]}`) + })) + }) + It(`Invoke ListVPNGateways 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.ListVPNGateways(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVPNGatewaysOptions model + listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) + listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") + listVPNGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVPNGateways(listVPNGatewaysOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVPNGateways 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 ListVPNGatewaysOptions model + listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) + listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") + listVPNGatewaysOptionsModel.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.ListVPNGateways(listVPNGatewaysOptionsModel) + 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 ListVPNGateways 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 ListVPNGatewaysOptions model + listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) + listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") + listVPNGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVPNGateways(listVPNGatewaysOptionsModel) + 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.VPNGatewayCollection) + nextObject := new(vpcv1.VPNGatewayCollectionNext) + 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.VPNGatewayCollection) + + 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.VPNGatewayCollection) + nextObject := new(vpcv1.VPNGatewayCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateVPNGateway(createVPNGatewayOptions *CreateVPNGatewayOptions) - Operation response error`, func() { + version := "testString" + createVPNGatewayPath := "/vpn_gateways" + 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(createVPNGatewayPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateVPNGateway 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // 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 VPNGatewayPrototypeVPNGatewayRouteModePrototype model + vpnGatewayPrototypeModel := new(vpcv1.VPNGatewayPrototypeVPNGatewayRouteModePrototype) + vpnGatewayPrototypeModel.Name = core.StringPtr("my-vpn-gateway") + vpnGatewayPrototypeModel.ResourceGroup = resourceGroupIdentityModel + vpnGatewayPrototypeModel.Subnet = subnetIdentityModel + vpnGatewayPrototypeModel.Mode = core.StringPtr("route") + + // Construct an instance of the CreateVPNGatewayOptions model + createVPNGatewayOptionsModel := new(vpcv1.CreateVPNGatewayOptions) + createVPNGatewayOptionsModel.VPNGatewayPrototype = vpnGatewayPrototypeModel + createVPNGatewayOptionsModel.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.CreateVPNGateway(createVPNGatewayOptionsModel) + 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.CreateVPNGateway(createVPNGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateVPNGateway(createVPNGatewayOptions *CreateVPNGatewayOptions)`, func() { + version := "testString" + createVPNGatewayPath := "/vpn_gateways" + 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(createVPNGatewayPath)) + 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{"testString"})) + 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", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}`) + })) + }) + It(`Invoke CreateVPNGateway 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 ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // 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 VPNGatewayPrototypeVPNGatewayRouteModePrototype model + vpnGatewayPrototypeModel := new(vpcv1.VPNGatewayPrototypeVPNGatewayRouteModePrototype) + vpnGatewayPrototypeModel.Name = core.StringPtr("my-vpn-gateway") + vpnGatewayPrototypeModel.ResourceGroup = resourceGroupIdentityModel + vpnGatewayPrototypeModel.Subnet = subnetIdentityModel + vpnGatewayPrototypeModel.Mode = core.StringPtr("route") + + // Construct an instance of the CreateVPNGatewayOptions model + createVPNGatewayOptionsModel := new(vpcv1.CreateVPNGatewayOptions) + createVPNGatewayOptionsModel.VPNGatewayPrototype = vpnGatewayPrototypeModel + createVPNGatewayOptionsModel.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.CreateVPNGatewayWithContext(ctx, createVPNGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateVPNGateway(createVPNGatewayOptionsModel) + 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.CreateVPNGatewayWithContext(ctx, createVPNGatewayOptionsModel) + 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(createVPNGatewayPath)) + 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{"testString"})) + 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", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}`) + })) + }) + It(`Invoke CreateVPNGateway 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.CreateVPNGateway(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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the VPNGatewayPrototypeVPNGatewayRouteModePrototype model + vpnGatewayPrototypeModel := new(vpcv1.VPNGatewayPrototypeVPNGatewayRouteModePrototype) + vpnGatewayPrototypeModel.Name = core.StringPtr("my-vpn-gateway") + vpnGatewayPrototypeModel.ResourceGroup = resourceGroupIdentityModel + vpnGatewayPrototypeModel.Subnet = subnetIdentityModel + vpnGatewayPrototypeModel.Mode = core.StringPtr("route") + + // Construct an instance of the CreateVPNGatewayOptions model + createVPNGatewayOptionsModel := new(vpcv1.CreateVPNGatewayOptions) + createVPNGatewayOptionsModel.VPNGatewayPrototype = vpnGatewayPrototypeModel + createVPNGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateVPNGateway(createVPNGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateVPNGateway 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the VPNGatewayPrototypeVPNGatewayRouteModePrototype model + vpnGatewayPrototypeModel := new(vpcv1.VPNGatewayPrototypeVPNGatewayRouteModePrototype) + vpnGatewayPrototypeModel.Name = core.StringPtr("my-vpn-gateway") + vpnGatewayPrototypeModel.ResourceGroup = resourceGroupIdentityModel + vpnGatewayPrototypeModel.Subnet = subnetIdentityModel + vpnGatewayPrototypeModel.Mode = core.StringPtr("route") + + // Construct an instance of the CreateVPNGatewayOptions model + createVPNGatewayOptionsModel := new(vpcv1.CreateVPNGatewayOptions) + createVPNGatewayOptionsModel.VPNGatewayPrototype = vpnGatewayPrototypeModel + createVPNGatewayOptionsModel.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.CreateVPNGateway(createVPNGatewayOptionsModel) + 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 CreateVPNGatewayOptions model with no property values + createVPNGatewayOptionsModelNew := new(vpcv1.CreateVPNGatewayOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateVPNGateway(createVPNGatewayOptionsModelNew) + 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 CreateVPNGateway 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") + + // 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 VPNGatewayPrototypeVPNGatewayRouteModePrototype model + vpnGatewayPrototypeModel := new(vpcv1.VPNGatewayPrototypeVPNGatewayRouteModePrototype) + vpnGatewayPrototypeModel.Name = core.StringPtr("my-vpn-gateway") + vpnGatewayPrototypeModel.ResourceGroup = resourceGroupIdentityModel + vpnGatewayPrototypeModel.Subnet = subnetIdentityModel + vpnGatewayPrototypeModel.Mode = core.StringPtr("route") + + // Construct an instance of the CreateVPNGatewayOptions model + createVPNGatewayOptionsModel := new(vpcv1.CreateVPNGatewayOptions) + createVPNGatewayOptionsModel.VPNGatewayPrototype = vpnGatewayPrototypeModel + createVPNGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateVPNGateway(createVPNGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteVPNGateway(deleteVPNGatewayOptions *DeleteVPNGatewayOptions)`, func() { + version := "testString" + deleteVPNGatewayPath := "/vpn_gateways/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(deleteVPNGatewayPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteVPNGateway 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.DeleteVPNGateway(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteVPNGatewayOptions model + deleteVPNGatewayOptionsModel := new(vpcv1.DeleteVPNGatewayOptions) + deleteVPNGatewayOptionsModel.ID = core.StringPtr("testString") + deleteVPNGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteVPNGateway(deleteVPNGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteVPNGateway 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 DeleteVPNGatewayOptions model + deleteVPNGatewayOptionsModel := new(vpcv1.DeleteVPNGatewayOptions) + deleteVPNGatewayOptionsModel.ID = core.StringPtr("testString") + deleteVPNGatewayOptionsModel.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.DeleteVPNGateway(deleteVPNGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteVPNGatewayOptions model with no property values + deleteVPNGatewayOptionsModelNew := new(vpcv1.DeleteVPNGatewayOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteVPNGateway(deleteVPNGatewayOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNGateway(getVPNGatewayOptions *GetVPNGatewayOptions) - Operation response error`, func() { + version := "testString" + getVPNGatewayPath := "/vpn_gateways/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(getVPNGatewayPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVPNGateway 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 GetVPNGatewayOptions model + getVPNGatewayOptionsModel := new(vpcv1.GetVPNGatewayOptions) + getVPNGatewayOptionsModel.ID = core.StringPtr("testString") + getVPNGatewayOptionsModel.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.GetVPNGateway(getVPNGatewayOptionsModel) + 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.GetVPNGateway(getVPNGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNGateway(getVPNGatewayOptions *GetVPNGatewayOptions)`, func() { + version := "testString" + getVPNGatewayPath := "/vpn_gateways/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(getVPNGatewayPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}`) + })) + }) + It(`Invoke GetVPNGateway 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 GetVPNGatewayOptions model + getVPNGatewayOptionsModel := new(vpcv1.GetVPNGatewayOptions) + getVPNGatewayOptionsModel.ID = core.StringPtr("testString") + getVPNGatewayOptionsModel.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.GetVPNGatewayWithContext(ctx, getVPNGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPNGateway(getVPNGatewayOptionsModel) + 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.GetVPNGatewayWithContext(ctx, getVPNGatewayOptionsModel) + 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(getVPNGatewayPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}`) + })) + }) + It(`Invoke GetVPNGateway 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.GetVPNGateway(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPNGatewayOptions model + getVPNGatewayOptionsModel := new(vpcv1.GetVPNGatewayOptions) + getVPNGatewayOptionsModel.ID = core.StringPtr("testString") + getVPNGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPNGateway(getVPNGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPNGateway 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 GetVPNGatewayOptions model + getVPNGatewayOptionsModel := new(vpcv1.GetVPNGatewayOptions) + getVPNGatewayOptionsModel.ID = core.StringPtr("testString") + getVPNGatewayOptionsModel.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.GetVPNGateway(getVPNGatewayOptionsModel) + 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 GetVPNGatewayOptions model with no property values + getVPNGatewayOptionsModelNew := new(vpcv1.GetVPNGatewayOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPNGateway(getVPNGatewayOptionsModelNew) + 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 GetVPNGateway 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 GetVPNGatewayOptions model + getVPNGatewayOptionsModel := new(vpcv1.GetVPNGatewayOptions) + getVPNGatewayOptionsModel.ID = core.StringPtr("testString") + getVPNGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPNGateway(getVPNGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPNGateway(updateVPNGatewayOptions *UpdateVPNGatewayOptions) - Operation response error`, func() { + version := "testString" + updateVPNGatewayPath := "/vpn_gateways/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(updateVPNGatewayPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateVPNGateway 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 VPNGatewayPatch model + vpnGatewayPatchModel := new(vpcv1.VPNGatewayPatch) + vpnGatewayPatchModel.Name = core.StringPtr("my-vpn-gateway") + vpnGatewayPatchModelAsPatch, asPatchErr := vpnGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNGatewayOptions model + updateVPNGatewayOptionsModel := new(vpcv1.UpdateVPNGatewayOptions) + updateVPNGatewayOptionsModel.ID = core.StringPtr("testString") + updateVPNGatewayOptionsModel.VPNGatewayPatch = vpnGatewayPatchModelAsPatch + updateVPNGatewayOptionsModel.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.UpdateVPNGateway(updateVPNGatewayOptionsModel) + 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.UpdateVPNGateway(updateVPNGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPNGateway(updateVPNGatewayOptions *UpdateVPNGatewayOptions)`, func() { + version := "testString" + updateVPNGatewayPath := "/vpn_gateways/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(updateVPNGatewayPath)) + 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{"testString"})) + 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", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}`) + })) + }) + It(`Invoke UpdateVPNGateway 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 VPNGatewayPatch model + vpnGatewayPatchModel := new(vpcv1.VPNGatewayPatch) + vpnGatewayPatchModel.Name = core.StringPtr("my-vpn-gateway") + vpnGatewayPatchModelAsPatch, asPatchErr := vpnGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNGatewayOptions model + updateVPNGatewayOptionsModel := new(vpcv1.UpdateVPNGatewayOptions) + updateVPNGatewayOptionsModel.ID = core.StringPtr("testString") + updateVPNGatewayOptionsModel.VPNGatewayPatch = vpnGatewayPatchModelAsPatch + updateVPNGatewayOptionsModel.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.UpdateVPNGatewayWithContext(ctx, updateVPNGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateVPNGateway(updateVPNGatewayOptionsModel) + 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.UpdateVPNGatewayWithContext(ctx, updateVPNGatewayOptionsModel) + 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(updateVPNGatewayPath)) + 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{"testString"})) + 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", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}`) + })) + }) + It(`Invoke UpdateVPNGateway 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.UpdateVPNGateway(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the VPNGatewayPatch model + vpnGatewayPatchModel := new(vpcv1.VPNGatewayPatch) + vpnGatewayPatchModel.Name = core.StringPtr("my-vpn-gateway") + vpnGatewayPatchModelAsPatch, asPatchErr := vpnGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNGatewayOptions model + updateVPNGatewayOptionsModel := new(vpcv1.UpdateVPNGatewayOptions) + updateVPNGatewayOptionsModel.ID = core.StringPtr("testString") + updateVPNGatewayOptionsModel.VPNGatewayPatch = vpnGatewayPatchModelAsPatch + updateVPNGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateVPNGateway(updateVPNGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateVPNGateway 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 VPNGatewayPatch model + vpnGatewayPatchModel := new(vpcv1.VPNGatewayPatch) + vpnGatewayPatchModel.Name = core.StringPtr("my-vpn-gateway") + vpnGatewayPatchModelAsPatch, asPatchErr := vpnGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNGatewayOptions model + updateVPNGatewayOptionsModel := new(vpcv1.UpdateVPNGatewayOptions) + updateVPNGatewayOptionsModel.ID = core.StringPtr("testString") + updateVPNGatewayOptionsModel.VPNGatewayPatch = vpnGatewayPatchModelAsPatch + updateVPNGatewayOptionsModel.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.UpdateVPNGateway(updateVPNGatewayOptionsModel) + 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 UpdateVPNGatewayOptions model with no property values + updateVPNGatewayOptionsModelNew := new(vpcv1.UpdateVPNGatewayOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateVPNGateway(updateVPNGatewayOptionsModelNew) + 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 UpdateVPNGateway 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 VPNGatewayPatch model + vpnGatewayPatchModel := new(vpcv1.VPNGatewayPatch) + vpnGatewayPatchModel.Name = core.StringPtr("my-vpn-gateway") + vpnGatewayPatchModelAsPatch, asPatchErr := vpnGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNGatewayOptions model + updateVPNGatewayOptionsModel := new(vpcv1.UpdateVPNGatewayOptions) + updateVPNGatewayOptionsModel.ID = core.StringPtr("testString") + updateVPNGatewayOptionsModel.VPNGatewayPatch = vpnGatewayPatchModelAsPatch + updateVPNGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateVPNGateway(updateVPNGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) - Operation response error`, func() { + version := "testString" + listVPNGatewayConnectionsPath := "/vpn_gateways/testString/connections" + 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(listVPNGatewayConnectionsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["status"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListVPNGatewayConnections 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 ListVPNGatewayConnectionsOptions model + listVPNGatewayConnectionsOptionsModel := new(vpcv1.ListVPNGatewayConnectionsOptions) + listVPNGatewayConnectionsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionsOptionsModel.Status = core.StringPtr("testString") + listVPNGatewayConnectionsOptionsModel.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.ListVPNGatewayConnections(listVPNGatewayConnectionsOptionsModel) + 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.ListVPNGatewayConnections(listVPNGatewayConnectionsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions)`, func() { + version := "testString" + listVPNGatewayConnectionsPath := "/vpn_gateways/testString/connections" + 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(listVPNGatewayConnectionsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["status"]).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", `{"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}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}`) + })) + }) + It(`Invoke ListVPNGatewayConnections 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 ListVPNGatewayConnectionsOptions model + listVPNGatewayConnectionsOptionsModel := new(vpcv1.ListVPNGatewayConnectionsOptions) + listVPNGatewayConnectionsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionsOptionsModel.Status = core.StringPtr("testString") + listVPNGatewayConnectionsOptionsModel.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.ListVPNGatewayConnectionsWithContext(ctx, listVPNGatewayConnectionsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVPNGatewayConnections(listVPNGatewayConnectionsOptionsModel) + 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.ListVPNGatewayConnectionsWithContext(ctx, listVPNGatewayConnectionsOptionsModel) + 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(listVPNGatewayConnectionsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["status"]).To(Equal([]string{"testString"})) + // 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}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}`) + })) + }) + It(`Invoke ListVPNGatewayConnections 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.ListVPNGatewayConnections(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVPNGatewayConnectionsOptions model + listVPNGatewayConnectionsOptionsModel := new(vpcv1.ListVPNGatewayConnectionsOptions) + listVPNGatewayConnectionsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionsOptionsModel.Status = core.StringPtr("testString") + listVPNGatewayConnectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVPNGatewayConnections(listVPNGatewayConnectionsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVPNGatewayConnections 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 ListVPNGatewayConnectionsOptions model + listVPNGatewayConnectionsOptionsModel := new(vpcv1.ListVPNGatewayConnectionsOptions) + listVPNGatewayConnectionsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionsOptionsModel.Status = core.StringPtr("testString") + listVPNGatewayConnectionsOptionsModel.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.ListVPNGatewayConnections(listVPNGatewayConnectionsOptionsModel) + 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 ListVPNGatewayConnectionsOptions model with no property values + listVPNGatewayConnectionsOptionsModelNew := new(vpcv1.ListVPNGatewayConnectionsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListVPNGatewayConnections(listVPNGatewayConnectionsOptionsModelNew) + 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 ListVPNGatewayConnections 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 ListVPNGatewayConnectionsOptions model + listVPNGatewayConnectionsOptionsModel := new(vpcv1.ListVPNGatewayConnectionsOptions) + listVPNGatewayConnectionsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionsOptionsModel.Status = core.StringPtr("testString") + listVPNGatewayConnectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVPNGatewayConnections(listVPNGatewayConnectionsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateVPNGatewayConnection(createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) - Operation response error`, func() { + version := "testString" + createVPNGatewayConnectionPath := "/vpn_gateways/testString/connections" + 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(createVPNGatewayConnectionPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateVPNGatewayConnection 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 VPNGatewayConnectionDpdPrototype model + vpnGatewayConnectionDpdPrototypeModel := new(vpcv1.VPNGatewayConnectionDpdPrototype) + vpnGatewayConnectionDpdPrototypeModel.Action = core.StringPtr("restart") + vpnGatewayConnectionDpdPrototypeModel.Interval = core.Int64Ptr(int64(30)) + vpnGatewayConnectionDpdPrototypeModel.Timeout = core.Int64Ptr(int64(120)) + + // Construct an instance of the VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID model + vpnGatewayConnectionIkePolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) + vpnGatewayConnectionIkePolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID model + vpnGatewayConnectionIPsecPolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) + vpnGatewayConnectionIPsecPolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model + vpnGatewayConnectionPrototypeModel := new(vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) + vpnGatewayConnectionPrototypeModel.AdminStateUp = core.BoolPtr(true) + vpnGatewayConnectionPrototypeModel.DeadPeerDetection = vpnGatewayConnectionDpdPrototypeModel + vpnGatewayConnectionPrototypeModel.IkePolicy = vpnGatewayConnectionIkePolicyPrototypeModel + vpnGatewayConnectionPrototypeModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPrototypeModel + vpnGatewayConnectionPrototypeModel.Name = core.StringPtr("my-vpn-connection") + vpnGatewayConnectionPrototypeModel.PeerAddress = core.StringPtr("169.21.50.5") + vpnGatewayConnectionPrototypeModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") + vpnGatewayConnectionPrototypeModel.RoutingProtocol = core.StringPtr("none") + + // Construct an instance of the CreateVPNGatewayConnectionOptions model + createVPNGatewayConnectionOptionsModel := new(vpcv1.CreateVPNGatewayConnectionOptions) + createVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + createVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototypeModel + createVPNGatewayConnectionOptionsModel.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.CreateVPNGatewayConnection(createVPNGatewayConnectionOptionsModel) + 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.CreateVPNGatewayConnection(createVPNGatewayConnectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateVPNGatewayConnection(createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions)`, func() { + version := "testString" + createVPNGatewayConnectionPath := "/vpn_gateways/testString/connections" + 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(createVPNGatewayConnectionPath)) + 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{"testString"})) + 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", `{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}`) + })) + }) + It(`Invoke CreateVPNGatewayConnection 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 VPNGatewayConnectionDpdPrototype model + vpnGatewayConnectionDpdPrototypeModel := new(vpcv1.VPNGatewayConnectionDpdPrototype) + vpnGatewayConnectionDpdPrototypeModel.Action = core.StringPtr("restart") + vpnGatewayConnectionDpdPrototypeModel.Interval = core.Int64Ptr(int64(30)) + vpnGatewayConnectionDpdPrototypeModel.Timeout = core.Int64Ptr(int64(120)) + + // Construct an instance of the VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID model + vpnGatewayConnectionIkePolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) + vpnGatewayConnectionIkePolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID model + vpnGatewayConnectionIPsecPolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) + vpnGatewayConnectionIPsecPolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model + vpnGatewayConnectionPrototypeModel := new(vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) + vpnGatewayConnectionPrototypeModel.AdminStateUp = core.BoolPtr(true) + vpnGatewayConnectionPrototypeModel.DeadPeerDetection = vpnGatewayConnectionDpdPrototypeModel + vpnGatewayConnectionPrototypeModel.IkePolicy = vpnGatewayConnectionIkePolicyPrototypeModel + vpnGatewayConnectionPrototypeModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPrototypeModel + vpnGatewayConnectionPrototypeModel.Name = core.StringPtr("my-vpn-connection") + vpnGatewayConnectionPrototypeModel.PeerAddress = core.StringPtr("169.21.50.5") + vpnGatewayConnectionPrototypeModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") + vpnGatewayConnectionPrototypeModel.RoutingProtocol = core.StringPtr("none") + + // Construct an instance of the CreateVPNGatewayConnectionOptions model + createVPNGatewayConnectionOptionsModel := new(vpcv1.CreateVPNGatewayConnectionOptions) + createVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + createVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototypeModel + createVPNGatewayConnectionOptionsModel.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.CreateVPNGatewayConnectionWithContext(ctx, createVPNGatewayConnectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateVPNGatewayConnection(createVPNGatewayConnectionOptionsModel) + 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.CreateVPNGatewayConnectionWithContext(ctx, createVPNGatewayConnectionOptionsModel) + 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(createVPNGatewayConnectionPath)) + 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{"testString"})) + 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", `{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}`) + })) + }) + It(`Invoke CreateVPNGatewayConnection 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.CreateVPNGatewayConnection(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the VPNGatewayConnectionDpdPrototype model + vpnGatewayConnectionDpdPrototypeModel := new(vpcv1.VPNGatewayConnectionDpdPrototype) + vpnGatewayConnectionDpdPrototypeModel.Action = core.StringPtr("restart") + vpnGatewayConnectionDpdPrototypeModel.Interval = core.Int64Ptr(int64(30)) + vpnGatewayConnectionDpdPrototypeModel.Timeout = core.Int64Ptr(int64(120)) + + // Construct an instance of the VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID model + vpnGatewayConnectionIkePolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) + vpnGatewayConnectionIkePolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID model + vpnGatewayConnectionIPsecPolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) + vpnGatewayConnectionIPsecPolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model + vpnGatewayConnectionPrototypeModel := new(vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) + vpnGatewayConnectionPrototypeModel.AdminStateUp = core.BoolPtr(true) + vpnGatewayConnectionPrototypeModel.DeadPeerDetection = vpnGatewayConnectionDpdPrototypeModel + vpnGatewayConnectionPrototypeModel.IkePolicy = vpnGatewayConnectionIkePolicyPrototypeModel + vpnGatewayConnectionPrototypeModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPrototypeModel + vpnGatewayConnectionPrototypeModel.Name = core.StringPtr("my-vpn-connection") + vpnGatewayConnectionPrototypeModel.PeerAddress = core.StringPtr("169.21.50.5") + vpnGatewayConnectionPrototypeModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") + vpnGatewayConnectionPrototypeModel.RoutingProtocol = core.StringPtr("none") + + // Construct an instance of the CreateVPNGatewayConnectionOptions model + createVPNGatewayConnectionOptionsModel := new(vpcv1.CreateVPNGatewayConnectionOptions) + createVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + createVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototypeModel + createVPNGatewayConnectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateVPNGatewayConnection(createVPNGatewayConnectionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateVPNGatewayConnection 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 VPNGatewayConnectionDpdPrototype model + vpnGatewayConnectionDpdPrototypeModel := new(vpcv1.VPNGatewayConnectionDpdPrototype) + vpnGatewayConnectionDpdPrototypeModel.Action = core.StringPtr("restart") + vpnGatewayConnectionDpdPrototypeModel.Interval = core.Int64Ptr(int64(30)) + vpnGatewayConnectionDpdPrototypeModel.Timeout = core.Int64Ptr(int64(120)) + + // Construct an instance of the VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID model + vpnGatewayConnectionIkePolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) + vpnGatewayConnectionIkePolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID model + vpnGatewayConnectionIPsecPolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) + vpnGatewayConnectionIPsecPolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model + vpnGatewayConnectionPrototypeModel := new(vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) + vpnGatewayConnectionPrototypeModel.AdminStateUp = core.BoolPtr(true) + vpnGatewayConnectionPrototypeModel.DeadPeerDetection = vpnGatewayConnectionDpdPrototypeModel + vpnGatewayConnectionPrototypeModel.IkePolicy = vpnGatewayConnectionIkePolicyPrototypeModel + vpnGatewayConnectionPrototypeModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPrototypeModel + vpnGatewayConnectionPrototypeModel.Name = core.StringPtr("my-vpn-connection") + vpnGatewayConnectionPrototypeModel.PeerAddress = core.StringPtr("169.21.50.5") + vpnGatewayConnectionPrototypeModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") + vpnGatewayConnectionPrototypeModel.RoutingProtocol = core.StringPtr("none") + + // Construct an instance of the CreateVPNGatewayConnectionOptions model + createVPNGatewayConnectionOptionsModel := new(vpcv1.CreateVPNGatewayConnectionOptions) + createVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + createVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototypeModel + createVPNGatewayConnectionOptionsModel.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.CreateVPNGatewayConnection(createVPNGatewayConnectionOptionsModel) + 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 CreateVPNGatewayConnectionOptions model with no property values + createVPNGatewayConnectionOptionsModelNew := new(vpcv1.CreateVPNGatewayConnectionOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateVPNGatewayConnection(createVPNGatewayConnectionOptionsModelNew) + 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 CreateVPNGatewayConnection 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 VPNGatewayConnectionDpdPrototype model + vpnGatewayConnectionDpdPrototypeModel := new(vpcv1.VPNGatewayConnectionDpdPrototype) + vpnGatewayConnectionDpdPrototypeModel.Action = core.StringPtr("restart") + vpnGatewayConnectionDpdPrototypeModel.Interval = core.Int64Ptr(int64(30)) + vpnGatewayConnectionDpdPrototypeModel.Timeout = core.Int64Ptr(int64(120)) + + // Construct an instance of the VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID model + vpnGatewayConnectionIkePolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) + vpnGatewayConnectionIkePolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID model + vpnGatewayConnectionIPsecPolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) + vpnGatewayConnectionIPsecPolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model + vpnGatewayConnectionPrototypeModel := new(vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) + vpnGatewayConnectionPrototypeModel.AdminStateUp = core.BoolPtr(true) + vpnGatewayConnectionPrototypeModel.DeadPeerDetection = vpnGatewayConnectionDpdPrototypeModel + vpnGatewayConnectionPrototypeModel.IkePolicy = vpnGatewayConnectionIkePolicyPrototypeModel + vpnGatewayConnectionPrototypeModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPrototypeModel + vpnGatewayConnectionPrototypeModel.Name = core.StringPtr("my-vpn-connection") + vpnGatewayConnectionPrototypeModel.PeerAddress = core.StringPtr("169.21.50.5") + vpnGatewayConnectionPrototypeModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") + vpnGatewayConnectionPrototypeModel.RoutingProtocol = core.StringPtr("none") + + // Construct an instance of the CreateVPNGatewayConnectionOptions model + createVPNGatewayConnectionOptionsModel := new(vpcv1.CreateVPNGatewayConnectionOptions) + createVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + createVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototypeModel + createVPNGatewayConnectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateVPNGatewayConnection(createVPNGatewayConnectionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions)`, func() { + version := "testString" + deleteVPNGatewayConnectionPath := "/vpn_gateways/testString/connections/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(deleteVPNGatewayConnectionPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteVPNGatewayConnection 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.DeleteVPNGatewayConnection(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteVPNGatewayConnectionOptions model + deleteVPNGatewayConnectionOptionsModel := new(vpcv1.DeleteVPNGatewayConnectionOptions) + deleteVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + deleteVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") + deleteVPNGatewayConnectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteVPNGatewayConnection 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 DeleteVPNGatewayConnectionOptions model + deleteVPNGatewayConnectionOptionsModel := new(vpcv1.DeleteVPNGatewayConnectionOptions) + deleteVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + deleteVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") + deleteVPNGatewayConnectionOptionsModel.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.DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteVPNGatewayConnectionOptions model with no property values + deleteVPNGatewayConnectionOptionsModelNew := new(vpcv1.DeleteVPNGatewayConnectionOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNGatewayConnection(getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) - Operation response error`, func() { + version := "testString" + getVPNGatewayConnectionPath := "/vpn_gateways/testString/connections/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(getVPNGatewayConnectionPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVPNGatewayConnection 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 GetVPNGatewayConnectionOptions model + getVPNGatewayConnectionOptionsModel := new(vpcv1.GetVPNGatewayConnectionOptions) + getVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + getVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") + getVPNGatewayConnectionOptionsModel.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.GetVPNGatewayConnection(getVPNGatewayConnectionOptionsModel) + 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.GetVPNGatewayConnection(getVPNGatewayConnectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNGatewayConnection(getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions)`, func() { + version := "testString" + getVPNGatewayConnectionPath := "/vpn_gateways/testString/connections/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(getVPNGatewayConnectionPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}`) + })) + }) + It(`Invoke GetVPNGatewayConnection 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 GetVPNGatewayConnectionOptions model + getVPNGatewayConnectionOptionsModel := new(vpcv1.GetVPNGatewayConnectionOptions) + getVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + getVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") + getVPNGatewayConnectionOptionsModel.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.GetVPNGatewayConnectionWithContext(ctx, getVPNGatewayConnectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPNGatewayConnection(getVPNGatewayConnectionOptionsModel) + 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.GetVPNGatewayConnectionWithContext(ctx, getVPNGatewayConnectionOptionsModel) + 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(getVPNGatewayConnectionPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}`) + })) + }) + It(`Invoke GetVPNGatewayConnection 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.GetVPNGatewayConnection(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPNGatewayConnectionOptions model + getVPNGatewayConnectionOptionsModel := new(vpcv1.GetVPNGatewayConnectionOptions) + getVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + getVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") + getVPNGatewayConnectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPNGatewayConnection(getVPNGatewayConnectionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPNGatewayConnection 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 GetVPNGatewayConnectionOptions model + getVPNGatewayConnectionOptionsModel := new(vpcv1.GetVPNGatewayConnectionOptions) + getVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + getVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") + getVPNGatewayConnectionOptionsModel.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.GetVPNGatewayConnection(getVPNGatewayConnectionOptionsModel) + 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 GetVPNGatewayConnectionOptions model with no property values + getVPNGatewayConnectionOptionsModelNew := new(vpcv1.GetVPNGatewayConnectionOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPNGatewayConnection(getVPNGatewayConnectionOptionsModelNew) + 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 GetVPNGatewayConnection 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 GetVPNGatewayConnectionOptions model + getVPNGatewayConnectionOptionsModel := new(vpcv1.GetVPNGatewayConnectionOptions) + getVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + getVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") + getVPNGatewayConnectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPNGatewayConnection(getVPNGatewayConnectionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) - Operation response error`, func() { + version := "testString" + updateVPNGatewayConnectionPath := "/vpn_gateways/testString/connections/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(updateVPNGatewayConnectionPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateVPNGatewayConnection 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 VPNGatewayConnectionDpdPatch model + vpnGatewayConnectionDpdPatchModel := new(vpcv1.VPNGatewayConnectionDpdPatch) + vpnGatewayConnectionDpdPatchModel.Action = core.StringPtr("restart") + vpnGatewayConnectionDpdPatchModel.Interval = core.Int64Ptr(int64(30)) + vpnGatewayConnectionDpdPatchModel.Timeout = core.Int64Ptr(int64(120)) + + // Construct an instance of the VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID model + vpnGatewayConnectionIkePolicyPatchModel := new(vpcv1.VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) + vpnGatewayConnectionIkePolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID model + vpnGatewayConnectionIPsecPolicyPatchModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) + vpnGatewayConnectionIPsecPolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch model + vpnGatewayConnectionPatchModel := new(vpcv1.VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) + vpnGatewayConnectionPatchModel.AdminStateUp = core.BoolPtr(true) + vpnGatewayConnectionPatchModel.DeadPeerDetection = vpnGatewayConnectionDpdPatchModel + vpnGatewayConnectionPatchModel.IkePolicy = vpnGatewayConnectionIkePolicyPatchModel + vpnGatewayConnectionPatchModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPatchModel + vpnGatewayConnectionPatchModel.Name = core.StringPtr("my-vpn-connection") + vpnGatewayConnectionPatchModel.PeerAddress = core.StringPtr("169.21.50.5") + vpnGatewayConnectionPatchModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") + vpnGatewayConnectionPatchModel.RoutingProtocol = core.StringPtr("none") + vpnGatewayConnectionPatchModelAsPatch, asPatchErr := vpnGatewayConnectionPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNGatewayConnectionOptions model + updateVPNGatewayConnectionOptionsModel := new(vpcv1.UpdateVPNGatewayConnectionOptions) + updateVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + updateVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") + updateVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPatch = vpnGatewayConnectionPatchModelAsPatch + updateVPNGatewayConnectionOptionsModel.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.UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptionsModel) + 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.UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions)`, func() { + version := "testString" + updateVPNGatewayConnectionPath := "/vpn_gateways/testString/connections/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(updateVPNGatewayConnectionPath)) + 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{"testString"})) + 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", `{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}`) + })) + }) + It(`Invoke UpdateVPNGatewayConnection 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 VPNGatewayConnectionDpdPatch model + vpnGatewayConnectionDpdPatchModel := new(vpcv1.VPNGatewayConnectionDpdPatch) + vpnGatewayConnectionDpdPatchModel.Action = core.StringPtr("restart") + vpnGatewayConnectionDpdPatchModel.Interval = core.Int64Ptr(int64(30)) + vpnGatewayConnectionDpdPatchModel.Timeout = core.Int64Ptr(int64(120)) + + // Construct an instance of the VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID model + vpnGatewayConnectionIkePolicyPatchModel := new(vpcv1.VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) + vpnGatewayConnectionIkePolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID model + vpnGatewayConnectionIPsecPolicyPatchModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) + vpnGatewayConnectionIPsecPolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch model + vpnGatewayConnectionPatchModel := new(vpcv1.VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) + vpnGatewayConnectionPatchModel.AdminStateUp = core.BoolPtr(true) + vpnGatewayConnectionPatchModel.DeadPeerDetection = vpnGatewayConnectionDpdPatchModel + vpnGatewayConnectionPatchModel.IkePolicy = vpnGatewayConnectionIkePolicyPatchModel + vpnGatewayConnectionPatchModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPatchModel + vpnGatewayConnectionPatchModel.Name = core.StringPtr("my-vpn-connection") + vpnGatewayConnectionPatchModel.PeerAddress = core.StringPtr("169.21.50.5") + vpnGatewayConnectionPatchModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") + vpnGatewayConnectionPatchModel.RoutingProtocol = core.StringPtr("none") + vpnGatewayConnectionPatchModelAsPatch, asPatchErr := vpnGatewayConnectionPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNGatewayConnectionOptions model + updateVPNGatewayConnectionOptionsModel := new(vpcv1.UpdateVPNGatewayConnectionOptions) + updateVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + updateVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") + updateVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPatch = vpnGatewayConnectionPatchModelAsPatch + updateVPNGatewayConnectionOptionsModel.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.UpdateVPNGatewayConnectionWithContext(ctx, updateVPNGatewayConnectionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptionsModel) + 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.UpdateVPNGatewayConnectionWithContext(ctx, updateVPNGatewayConnectionOptionsModel) + 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(updateVPNGatewayConnectionPath)) + 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{"testString"})) + 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", `{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}`) + })) + }) + It(`Invoke UpdateVPNGatewayConnection 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.UpdateVPNGatewayConnection(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the VPNGatewayConnectionDpdPatch model + vpnGatewayConnectionDpdPatchModel := new(vpcv1.VPNGatewayConnectionDpdPatch) + vpnGatewayConnectionDpdPatchModel.Action = core.StringPtr("restart") + vpnGatewayConnectionDpdPatchModel.Interval = core.Int64Ptr(int64(30)) + vpnGatewayConnectionDpdPatchModel.Timeout = core.Int64Ptr(int64(120)) + + // Construct an instance of the VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID model + vpnGatewayConnectionIkePolicyPatchModel := new(vpcv1.VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) + vpnGatewayConnectionIkePolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID model + vpnGatewayConnectionIPsecPolicyPatchModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) + vpnGatewayConnectionIPsecPolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch model + vpnGatewayConnectionPatchModel := new(vpcv1.VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) + vpnGatewayConnectionPatchModel.AdminStateUp = core.BoolPtr(true) + vpnGatewayConnectionPatchModel.DeadPeerDetection = vpnGatewayConnectionDpdPatchModel + vpnGatewayConnectionPatchModel.IkePolicy = vpnGatewayConnectionIkePolicyPatchModel + vpnGatewayConnectionPatchModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPatchModel + vpnGatewayConnectionPatchModel.Name = core.StringPtr("my-vpn-connection") + vpnGatewayConnectionPatchModel.PeerAddress = core.StringPtr("169.21.50.5") + vpnGatewayConnectionPatchModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") + vpnGatewayConnectionPatchModel.RoutingProtocol = core.StringPtr("none") + vpnGatewayConnectionPatchModelAsPatch, asPatchErr := vpnGatewayConnectionPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNGatewayConnectionOptions model + updateVPNGatewayConnectionOptionsModel := new(vpcv1.UpdateVPNGatewayConnectionOptions) + updateVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + updateVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") + updateVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPatch = vpnGatewayConnectionPatchModelAsPatch + updateVPNGatewayConnectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateVPNGatewayConnection 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 VPNGatewayConnectionDpdPatch model + vpnGatewayConnectionDpdPatchModel := new(vpcv1.VPNGatewayConnectionDpdPatch) + vpnGatewayConnectionDpdPatchModel.Action = core.StringPtr("restart") + vpnGatewayConnectionDpdPatchModel.Interval = core.Int64Ptr(int64(30)) + vpnGatewayConnectionDpdPatchModel.Timeout = core.Int64Ptr(int64(120)) + + // Construct an instance of the VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID model + vpnGatewayConnectionIkePolicyPatchModel := new(vpcv1.VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) + vpnGatewayConnectionIkePolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID model + vpnGatewayConnectionIPsecPolicyPatchModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) + vpnGatewayConnectionIPsecPolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch model + vpnGatewayConnectionPatchModel := new(vpcv1.VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) + vpnGatewayConnectionPatchModel.AdminStateUp = core.BoolPtr(true) + vpnGatewayConnectionPatchModel.DeadPeerDetection = vpnGatewayConnectionDpdPatchModel + vpnGatewayConnectionPatchModel.IkePolicy = vpnGatewayConnectionIkePolicyPatchModel + vpnGatewayConnectionPatchModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPatchModel + vpnGatewayConnectionPatchModel.Name = core.StringPtr("my-vpn-connection") + vpnGatewayConnectionPatchModel.PeerAddress = core.StringPtr("169.21.50.5") + vpnGatewayConnectionPatchModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") + vpnGatewayConnectionPatchModel.RoutingProtocol = core.StringPtr("none") + vpnGatewayConnectionPatchModelAsPatch, asPatchErr := vpnGatewayConnectionPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNGatewayConnectionOptions model + updateVPNGatewayConnectionOptionsModel := new(vpcv1.UpdateVPNGatewayConnectionOptions) + updateVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + updateVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") + updateVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPatch = vpnGatewayConnectionPatchModelAsPatch + updateVPNGatewayConnectionOptionsModel.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.UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptionsModel) + 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 UpdateVPNGatewayConnectionOptions model with no property values + updateVPNGatewayConnectionOptionsModelNew := new(vpcv1.UpdateVPNGatewayConnectionOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptionsModelNew) + 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 UpdateVPNGatewayConnection 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 VPNGatewayConnectionDpdPatch model + vpnGatewayConnectionDpdPatchModel := new(vpcv1.VPNGatewayConnectionDpdPatch) + vpnGatewayConnectionDpdPatchModel.Action = core.StringPtr("restart") + vpnGatewayConnectionDpdPatchModel.Interval = core.Int64Ptr(int64(30)) + vpnGatewayConnectionDpdPatchModel.Timeout = core.Int64Ptr(int64(120)) + + // Construct an instance of the VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID model + vpnGatewayConnectionIkePolicyPatchModel := new(vpcv1.VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) + vpnGatewayConnectionIkePolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID model + vpnGatewayConnectionIPsecPolicyPatchModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) + vpnGatewayConnectionIPsecPolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + + // Construct an instance of the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch model + vpnGatewayConnectionPatchModel := new(vpcv1.VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) + vpnGatewayConnectionPatchModel.AdminStateUp = core.BoolPtr(true) + vpnGatewayConnectionPatchModel.DeadPeerDetection = vpnGatewayConnectionDpdPatchModel + vpnGatewayConnectionPatchModel.IkePolicy = vpnGatewayConnectionIkePolicyPatchModel + vpnGatewayConnectionPatchModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPatchModel + vpnGatewayConnectionPatchModel.Name = core.StringPtr("my-vpn-connection") + vpnGatewayConnectionPatchModel.PeerAddress = core.StringPtr("169.21.50.5") + vpnGatewayConnectionPatchModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") + vpnGatewayConnectionPatchModel.RoutingProtocol = core.StringPtr("none") + vpnGatewayConnectionPatchModelAsPatch, asPatchErr := vpnGatewayConnectionPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNGatewayConnectionOptions model + updateVPNGatewayConnectionOptionsModel := new(vpcv1.UpdateVPNGatewayConnectionOptions) + updateVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") + updateVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") + updateVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPatch = vpnGatewayConnectionPatchModelAsPatch + updateVPNGatewayConnectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) - Operation response error`, func() { + version := "testString" + listVPNGatewayConnectionLocalCIDRsPath := "/vpn_gateways/testString/connections/testString/local_cidrs" + 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(listVPNGatewayConnectionLocalCIDRsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListVPNGatewayConnectionLocalCIDRs 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 ListVPNGatewayConnectionLocalCIDRsOptions model + listVPNGatewayConnectionLocalCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionLocalCIDRsOptions) + listVPNGatewayConnectionLocalCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionLocalCIDRsOptionsModel.ID = core.StringPtr("testString") + listVPNGatewayConnectionLocalCIDRsOptionsModel.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.ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptionsModel) + 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.ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions)`, func() { + version := "testString" + listVPNGatewayConnectionLocalCIDRsPath := "/vpn_gateways/testString/connections/testString/local_cidrs" + 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(listVPNGatewayConnectionLocalCIDRsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"local_cidrs": ["192.168.1.0/24"]}`) + })) + }) + It(`Invoke ListVPNGatewayConnectionLocalCIDRs 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 ListVPNGatewayConnectionLocalCIDRsOptions model + listVPNGatewayConnectionLocalCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionLocalCIDRsOptions) + listVPNGatewayConnectionLocalCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionLocalCIDRsOptionsModel.ID = core.StringPtr("testString") + listVPNGatewayConnectionLocalCIDRsOptionsModel.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.ListVPNGatewayConnectionLocalCIDRsWithContext(ctx, listVPNGatewayConnectionLocalCIDRsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptionsModel) + 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.ListVPNGatewayConnectionLocalCIDRsWithContext(ctx, listVPNGatewayConnectionLocalCIDRsOptionsModel) + 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(listVPNGatewayConnectionLocalCIDRsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"local_cidrs": ["192.168.1.0/24"]}`) + })) + }) + It(`Invoke ListVPNGatewayConnectionLocalCIDRs 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.ListVPNGatewayConnectionLocalCIDRs(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVPNGatewayConnectionLocalCIDRsOptions model + listVPNGatewayConnectionLocalCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionLocalCIDRsOptions) + listVPNGatewayConnectionLocalCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionLocalCIDRsOptionsModel.ID = core.StringPtr("testString") + listVPNGatewayConnectionLocalCIDRsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVPNGatewayConnectionLocalCIDRs 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 ListVPNGatewayConnectionLocalCIDRsOptions model + listVPNGatewayConnectionLocalCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionLocalCIDRsOptions) + listVPNGatewayConnectionLocalCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionLocalCIDRsOptionsModel.ID = core.StringPtr("testString") + listVPNGatewayConnectionLocalCIDRsOptionsModel.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.ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptionsModel) + 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 ListVPNGatewayConnectionLocalCIDRsOptions model with no property values + listVPNGatewayConnectionLocalCIDRsOptionsModelNew := new(vpcv1.ListVPNGatewayConnectionLocalCIDRsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptionsModelNew) + 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 ListVPNGatewayConnectionLocalCIDRs 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 ListVPNGatewayConnectionLocalCIDRsOptions model + listVPNGatewayConnectionLocalCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionLocalCIDRsOptions) + listVPNGatewayConnectionLocalCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionLocalCIDRsOptionsModel.ID = core.StringPtr("testString") + listVPNGatewayConnectionLocalCIDRsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions)`, func() { + version := "testString" + removeVPNGatewayConnectionLocalCIDRPath := "/vpn_gateways/testString/connections/testString/local_cidrs/testString/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(removeVPNGatewayConnectionLocalCIDRPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke RemoveVPNGatewayConnectionLocalCIDR 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.RemoveVPNGatewayConnectionLocalCIDR(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the RemoveVPNGatewayConnectionLocalCIDROptions model + removeVPNGatewayConnectionLocalCIDROptionsModel := new(vpcv1.RemoveVPNGatewayConnectionLocalCIDROptions) + removeVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") + removeVPNGatewayConnectionLocalCIDROptionsModel.ID = core.StringPtr("testString") + removeVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") + removeVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength = core.StringPtr("testString") + removeVPNGatewayConnectionLocalCIDROptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke RemoveVPNGatewayConnectionLocalCIDR 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 RemoveVPNGatewayConnectionLocalCIDROptions model + removeVPNGatewayConnectionLocalCIDROptionsModel := new(vpcv1.RemoveVPNGatewayConnectionLocalCIDROptions) + removeVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") + removeVPNGatewayConnectionLocalCIDROptionsModel.ID = core.StringPtr("testString") + removeVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") + removeVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength = core.StringPtr("testString") + removeVPNGatewayConnectionLocalCIDROptionsModel.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.RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the RemoveVPNGatewayConnectionLocalCIDROptions model with no property values + removeVPNGatewayConnectionLocalCIDROptionsModelNew := new(vpcv1.RemoveVPNGatewayConnectionLocalCIDROptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions)`, func() { + version := "testString" + checkVPNGatewayConnectionLocalCIDRPath := "/vpn_gateways/testString/connections/testString/local_cidrs/testString/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(checkVPNGatewayConnectionLocalCIDRPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke CheckVPNGatewayConnectionLocalCIDR 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.CheckVPNGatewayConnectionLocalCIDR(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the CheckVPNGatewayConnectionLocalCIDROptions model + checkVPNGatewayConnectionLocalCIDROptionsModel := new(vpcv1.CheckVPNGatewayConnectionLocalCIDROptions) + checkVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") + checkVPNGatewayConnectionLocalCIDROptionsModel.ID = core.StringPtr("testString") + checkVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") + checkVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength = core.StringPtr("testString") + checkVPNGatewayConnectionLocalCIDROptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke CheckVPNGatewayConnectionLocalCIDR 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 CheckVPNGatewayConnectionLocalCIDROptions model + checkVPNGatewayConnectionLocalCIDROptionsModel := new(vpcv1.CheckVPNGatewayConnectionLocalCIDROptions) + checkVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") + checkVPNGatewayConnectionLocalCIDROptionsModel.ID = core.StringPtr("testString") + checkVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") + checkVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength = core.StringPtr("testString") + checkVPNGatewayConnectionLocalCIDROptionsModel.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.CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the CheckVPNGatewayConnectionLocalCIDROptions model with no property values + checkVPNGatewayConnectionLocalCIDROptionsModelNew := new(vpcv1.CheckVPNGatewayConnectionLocalCIDROptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions)`, func() { + version := "testString" + addVPNGatewayConnectionLocalCIDRPath := "/vpn_gateways/testString/connections/testString/local_cidrs/testString/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(addVPNGatewayConnectionLocalCIDRPath)) + Expect(req.Method).To(Equal("PUT")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke AddVPNGatewayConnectionLocalCIDR 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.AddVPNGatewayConnectionLocalCIDR(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the AddVPNGatewayConnectionLocalCIDROptions model + addVPNGatewayConnectionLocalCIDROptionsModel := new(vpcv1.AddVPNGatewayConnectionLocalCIDROptions) + addVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") + addVPNGatewayConnectionLocalCIDROptionsModel.ID = core.StringPtr("testString") + addVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") + addVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength = core.StringPtr("testString") + addVPNGatewayConnectionLocalCIDROptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke AddVPNGatewayConnectionLocalCIDR 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 AddVPNGatewayConnectionLocalCIDROptions model + addVPNGatewayConnectionLocalCIDROptionsModel := new(vpcv1.AddVPNGatewayConnectionLocalCIDROptions) + addVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") + addVPNGatewayConnectionLocalCIDROptionsModel.ID = core.StringPtr("testString") + addVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") + addVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength = core.StringPtr("testString") + addVPNGatewayConnectionLocalCIDROptionsModel.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.AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the AddVPNGatewayConnectionLocalCIDROptions model with no property values + addVPNGatewayConnectionLocalCIDROptionsModelNew := new(vpcv1.AddVPNGatewayConnectionLocalCIDROptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) - Operation response error`, func() { + version := "testString" + listVPNGatewayConnectionPeerCIDRsPath := "/vpn_gateways/testString/connections/testString/peer_cidrs" + 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(listVPNGatewayConnectionPeerCIDRsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListVPNGatewayConnectionPeerCIDRs 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 ListVPNGatewayConnectionPeerCIDRsOptions model + listVPNGatewayConnectionPeerCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionPeerCIDRsOptions) + listVPNGatewayConnectionPeerCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionPeerCIDRsOptionsModel.ID = core.StringPtr("testString") + listVPNGatewayConnectionPeerCIDRsOptionsModel.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.ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptionsModel) + 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.ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions)`, func() { + version := "testString" + listVPNGatewayConnectionPeerCIDRsPath := "/vpn_gateways/testString/connections/testString/peer_cidrs" + 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(listVPNGatewayConnectionPeerCIDRsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"peer_cidrs": ["10.45.1.0/24"]}`) + })) + }) + It(`Invoke ListVPNGatewayConnectionPeerCIDRs 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 ListVPNGatewayConnectionPeerCIDRsOptions model + listVPNGatewayConnectionPeerCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionPeerCIDRsOptions) + listVPNGatewayConnectionPeerCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionPeerCIDRsOptionsModel.ID = core.StringPtr("testString") + listVPNGatewayConnectionPeerCIDRsOptionsModel.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.ListVPNGatewayConnectionPeerCIDRsWithContext(ctx, listVPNGatewayConnectionPeerCIDRsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptionsModel) + 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.ListVPNGatewayConnectionPeerCIDRsWithContext(ctx, listVPNGatewayConnectionPeerCIDRsOptionsModel) + 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(listVPNGatewayConnectionPeerCIDRsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"peer_cidrs": ["10.45.1.0/24"]}`) + })) + }) + It(`Invoke ListVPNGatewayConnectionPeerCIDRs 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.ListVPNGatewayConnectionPeerCIDRs(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVPNGatewayConnectionPeerCIDRsOptions model + listVPNGatewayConnectionPeerCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionPeerCIDRsOptions) + listVPNGatewayConnectionPeerCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionPeerCIDRsOptionsModel.ID = core.StringPtr("testString") + listVPNGatewayConnectionPeerCIDRsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVPNGatewayConnectionPeerCIDRs 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 ListVPNGatewayConnectionPeerCIDRsOptions model + listVPNGatewayConnectionPeerCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionPeerCIDRsOptions) + listVPNGatewayConnectionPeerCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionPeerCIDRsOptionsModel.ID = core.StringPtr("testString") + listVPNGatewayConnectionPeerCIDRsOptionsModel.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.ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptionsModel) + 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 ListVPNGatewayConnectionPeerCIDRsOptions model with no property values + listVPNGatewayConnectionPeerCIDRsOptionsModelNew := new(vpcv1.ListVPNGatewayConnectionPeerCIDRsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptionsModelNew) + 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 ListVPNGatewayConnectionPeerCIDRs 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 ListVPNGatewayConnectionPeerCIDRsOptions model + listVPNGatewayConnectionPeerCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionPeerCIDRsOptions) + listVPNGatewayConnectionPeerCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") + listVPNGatewayConnectionPeerCIDRsOptionsModel.ID = core.StringPtr("testString") + listVPNGatewayConnectionPeerCIDRsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions)`, func() { + version := "testString" + removeVPNGatewayConnectionPeerCIDRPath := "/vpn_gateways/testString/connections/testString/peer_cidrs/testString/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(removeVPNGatewayConnectionPeerCIDRPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke RemoveVPNGatewayConnectionPeerCIDR 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.RemoveVPNGatewayConnectionPeerCIDR(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the RemoveVPNGatewayConnectionPeerCIDROptions model + removeVPNGatewayConnectionPeerCIDROptionsModel := new(vpcv1.RemoveVPNGatewayConnectionPeerCIDROptions) + removeVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") + removeVPNGatewayConnectionPeerCIDROptionsModel.ID = core.StringPtr("testString") + removeVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") + removeVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength = core.StringPtr("testString") + removeVPNGatewayConnectionPeerCIDROptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke RemoveVPNGatewayConnectionPeerCIDR 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 RemoveVPNGatewayConnectionPeerCIDROptions model + removeVPNGatewayConnectionPeerCIDROptionsModel := new(vpcv1.RemoveVPNGatewayConnectionPeerCIDROptions) + removeVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") + removeVPNGatewayConnectionPeerCIDROptionsModel.ID = core.StringPtr("testString") + removeVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") + removeVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength = core.StringPtr("testString") + removeVPNGatewayConnectionPeerCIDROptionsModel.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.RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the RemoveVPNGatewayConnectionPeerCIDROptions model with no property values + removeVPNGatewayConnectionPeerCIDROptionsModelNew := new(vpcv1.RemoveVPNGatewayConnectionPeerCIDROptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions)`, func() { + version := "testString" + checkVPNGatewayConnectionPeerCIDRPath := "/vpn_gateways/testString/connections/testString/peer_cidrs/testString/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(checkVPNGatewayConnectionPeerCIDRPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke CheckVPNGatewayConnectionPeerCIDR 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.CheckVPNGatewayConnectionPeerCIDR(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the CheckVPNGatewayConnectionPeerCIDROptions model + checkVPNGatewayConnectionPeerCIDROptionsModel := new(vpcv1.CheckVPNGatewayConnectionPeerCIDROptions) + checkVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") + checkVPNGatewayConnectionPeerCIDROptionsModel.ID = core.StringPtr("testString") + checkVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") + checkVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength = core.StringPtr("testString") + checkVPNGatewayConnectionPeerCIDROptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke CheckVPNGatewayConnectionPeerCIDR 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 CheckVPNGatewayConnectionPeerCIDROptions model + checkVPNGatewayConnectionPeerCIDROptionsModel := new(vpcv1.CheckVPNGatewayConnectionPeerCIDROptions) + checkVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") + checkVPNGatewayConnectionPeerCIDROptionsModel.ID = core.StringPtr("testString") + checkVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") + checkVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength = core.StringPtr("testString") + checkVPNGatewayConnectionPeerCIDROptionsModel.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.CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the CheckVPNGatewayConnectionPeerCIDROptions model with no property values + checkVPNGatewayConnectionPeerCIDROptionsModelNew := new(vpcv1.CheckVPNGatewayConnectionPeerCIDROptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions)`, func() { + version := "testString" + addVPNGatewayConnectionPeerCIDRPath := "/vpn_gateways/testString/connections/testString/peer_cidrs/testString/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(addVPNGatewayConnectionPeerCIDRPath)) + Expect(req.Method).To(Equal("PUT")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke AddVPNGatewayConnectionPeerCIDR 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.AddVPNGatewayConnectionPeerCIDR(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the AddVPNGatewayConnectionPeerCIDROptions model + addVPNGatewayConnectionPeerCIDROptionsModel := new(vpcv1.AddVPNGatewayConnectionPeerCIDROptions) + addVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") + addVPNGatewayConnectionPeerCIDROptionsModel.ID = core.StringPtr("testString") + addVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") + addVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength = core.StringPtr("testString") + addVPNGatewayConnectionPeerCIDROptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke AddVPNGatewayConnectionPeerCIDR 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 AddVPNGatewayConnectionPeerCIDROptions model + addVPNGatewayConnectionPeerCIDROptionsModel := new(vpcv1.AddVPNGatewayConnectionPeerCIDROptions) + addVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") + addVPNGatewayConnectionPeerCIDROptionsModel.ID = core.StringPtr("testString") + addVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") + addVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength = core.StringPtr("testString") + addVPNGatewayConnectionPeerCIDROptionsModel.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.AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the AddVPNGatewayConnectionPeerCIDROptions model with no property values + addVPNGatewayConnectionPeerCIDROptionsModelNew := new(vpcv1.AddVPNGatewayConnectionPeerCIDROptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNServers(listVPNServersOptions *ListVPNServersOptions) - Operation response error`, func() { + version := "testString" + listVPNServersPath := "/vpn_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(listVPNServersPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["resource_group.id"]).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 ListVPNServers 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 ListVPNServersOptions model + listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) + listVPNServersOptionsModel.Name = core.StringPtr("testString") + listVPNServersOptionsModel.Start = core.StringPtr("testString") + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNServersOptionsModel.Sort = core.StringPtr("name") + listVPNServersOptionsModel.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.ListVPNServers(listVPNServersOptionsModel) + 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.ListVPNServers(listVPNServersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNServers(listVPNServersOptions *ListVPNServersOptions)`, func() { + version := "testString" + listVPNServersPath := "/vpn_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(listVPNServersPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["resource_group.id"]).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", `{"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/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}`) + })) + }) + It(`Invoke ListVPNServers 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 ListVPNServersOptions model + listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) + listVPNServersOptionsModel.Name = core.StringPtr("testString") + listVPNServersOptionsModel.Start = core.StringPtr("testString") + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNServersOptionsModel.Sort = core.StringPtr("name") + listVPNServersOptionsModel.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.ListVPNServersWithContext(ctx, listVPNServersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVPNServers(listVPNServersOptionsModel) + 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.ListVPNServersWithContext(ctx, listVPNServersOptionsModel) + 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(listVPNServersPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["resource_group.id"]).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", `{"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/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}`) + })) + }) + It(`Invoke ListVPNServers 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.ListVPNServers(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVPNServersOptions model + listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) + listVPNServersOptionsModel.Name = core.StringPtr("testString") + listVPNServersOptionsModel.Start = core.StringPtr("testString") + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNServersOptionsModel.Sort = core.StringPtr("name") + listVPNServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVPNServers(listVPNServersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVPNServers 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 ListVPNServersOptions model + listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) + listVPNServersOptionsModel.Name = core.StringPtr("testString") + listVPNServersOptionsModel.Start = core.StringPtr("testString") + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNServersOptionsModel.Sort = core.StringPtr("name") + listVPNServersOptionsModel.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.ListVPNServers(listVPNServersOptionsModel) + 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 ListVPNServers 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 ListVPNServersOptions model + listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) + listVPNServersOptionsModel.Name = core.StringPtr("testString") + listVPNServersOptionsModel.Start = core.StringPtr("testString") + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNServersOptionsModel.Sort = core.StringPtr("name") + listVPNServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVPNServers(listVPNServersOptionsModel) + 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.VPNServerCollection) + nextObject := new(vpcv1.VPNServerCollectionNext) + 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.VPNServerCollection) + + 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.VPNServerCollection) + nextObject := new(vpcv1.VPNServerCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateVPNServer(createVPNServerOptions *CreateVPNServerOptions) - Operation response error`, func() { + version := "testString" + createVPNServerPath := "/vpn_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(createVPNServerPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateVPNServer 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // 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 IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // 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 CreateVPNServerOptions model + createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) + createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel + createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) + createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") + createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) + createVPNServerOptionsModel.Protocol = core.StringPtr("udp") + createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVPNServerOptionsModel.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.CreateVPNServer(createVPNServerOptionsModel) + 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.CreateVPNServer(createVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateVPNServer(createVPNServerOptions *CreateVPNServerOptions)`, func() { + version := "testString" + createVPNServerPath := "/vpn_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(createVPNServerPath)) + 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{"testString"})) + 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", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateVPNServer 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // 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 IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // 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 CreateVPNServerOptions model + createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) + createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel + createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) + createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") + createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) + createVPNServerOptionsModel.Protocol = core.StringPtr("udp") + createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVPNServerOptionsModel.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.CreateVPNServerWithContext(ctx, createVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateVPNServer(createVPNServerOptionsModel) + 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.CreateVPNServerWithContext(ctx, createVPNServerOptionsModel) + 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(createVPNServerPath)) + 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{"testString"})) + 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", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateVPNServer 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.CreateVPNServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // 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 IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // 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 CreateVPNServerOptions model + createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) + createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel + createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) + createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") + createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) + createVPNServerOptionsModel.Protocol = core.StringPtr("udp") + createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateVPNServer(createVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateVPNServer 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // 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 IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // 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 CreateVPNServerOptions model + createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) + createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel + createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) + createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") + createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) + createVPNServerOptionsModel.Protocol = core.StringPtr("udp") + createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVPNServerOptionsModel.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.CreateVPNServer(createVPNServerOptionsModel) + 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 CreateVPNServerOptions model with no property values + createVPNServerOptionsModelNew := new(vpcv1.CreateVPNServerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateVPNServer(createVPNServerOptionsModelNew) + 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 CreateVPNServer 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // 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 IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // 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 CreateVPNServerOptions model + createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) + createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel + createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) + createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") + createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) + createVPNServerOptionsModel.Protocol = core.StringPtr("udp") + createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateVPNServer(createVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteVPNServer(deleteVPNServerOptions *DeleteVPNServerOptions)`, func() { + version := "testString" + deleteVPNServerPath := "/vpn_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(deleteVPNServerPath)) + 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{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteVPNServer 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.DeleteVPNServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteVPNServerOptions model + deleteVPNServerOptionsModel := new(vpcv1.DeleteVPNServerOptions) + deleteVPNServerOptionsModel.ID = core.StringPtr("testString") + deleteVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteVPNServer(deleteVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteVPNServer 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 DeleteVPNServerOptions model + deleteVPNServerOptionsModel := new(vpcv1.DeleteVPNServerOptions) + deleteVPNServerOptionsModel.ID = core.StringPtr("testString") + deleteVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteVPNServerOptionsModel.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.DeleteVPNServer(deleteVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteVPNServerOptions model with no property values + deleteVPNServerOptionsModelNew := new(vpcv1.DeleteVPNServerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteVPNServer(deleteVPNServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNServer(getVPNServerOptions *GetVPNServerOptions) - Operation response error`, func() { + version := "testString" + getVPNServerPath := "/vpn_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(getVPNServerPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVPNServer 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 GetVPNServerOptions model + getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) + getVPNServerOptionsModel.ID = core.StringPtr("testString") + getVPNServerOptionsModel.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.GetVPNServer(getVPNServerOptionsModel) + 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.GetVPNServer(getVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNServer(getVPNServerOptions *GetVPNServerOptions)`, func() { + version := "testString" + getVPNServerPath := "/vpn_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(getVPNServerPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetVPNServer 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 GetVPNServerOptions model + getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) + getVPNServerOptionsModel.ID = core.StringPtr("testString") + getVPNServerOptionsModel.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.GetVPNServerWithContext(ctx, getVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPNServer(getVPNServerOptionsModel) + 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.GetVPNServerWithContext(ctx, getVPNServerOptionsModel) + 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(getVPNServerPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetVPNServer 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.GetVPNServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPNServerOptions model + getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) + getVPNServerOptionsModel.ID = core.StringPtr("testString") + getVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPNServer(getVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPNServer 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 GetVPNServerOptions model + getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) + getVPNServerOptionsModel.ID = core.StringPtr("testString") + getVPNServerOptionsModel.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.GetVPNServer(getVPNServerOptionsModel) + 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 GetVPNServerOptions model with no property values + getVPNServerOptionsModelNew := new(vpcv1.GetVPNServerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPNServer(getVPNServerOptionsModelNew) + 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 GetVPNServer 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 GetVPNServerOptions model + getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) + getVPNServerOptionsModel.ID = core.StringPtr("testString") + getVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPNServer(getVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) - Operation response error`, func() { + version := "testString" + updateVPNServerPath := "/vpn_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(updateVPNServerPath)) + 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{"testString"})) + 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 UpdateVPNServer 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // 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 VPNServerPatch model + vpnServerPatchModel := new(vpcv1.VPNServerPatch) + vpnServerPatchModel.Certificate = certificateInstanceIdentityModel + vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) + vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") + vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) + vpnServerPatchModel.Protocol = core.StringPtr("udp") + vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerOptions model + updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) + updateVPNServerOptionsModel.ID = core.StringPtr("testString") + updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch + updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPNServerOptionsModel.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.UpdateVPNServer(updateVPNServerOptionsModel) + 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.UpdateVPNServer(updateVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions)`, func() { + version := "testString" + updateVPNServerPath := "/vpn_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(updateVPNServerPath)) + 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{"testString"})) + 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", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke UpdateVPNServer 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // 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 VPNServerPatch model + vpnServerPatchModel := new(vpcv1.VPNServerPatch) + vpnServerPatchModel.Certificate = certificateInstanceIdentityModel + vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) + vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") + vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) + vpnServerPatchModel.Protocol = core.StringPtr("udp") + vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerOptions model + updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) + updateVPNServerOptionsModel.ID = core.StringPtr("testString") + updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch + updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPNServerOptionsModel.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.UpdateVPNServerWithContext(ctx, updateVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateVPNServer(updateVPNServerOptionsModel) + 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.UpdateVPNServerWithContext(ctx, updateVPNServerOptionsModel) + 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(updateVPNServerPath)) + 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{"testString"})) + 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", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke UpdateVPNServer 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.UpdateVPNServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // 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 VPNServerPatch model + vpnServerPatchModel := new(vpcv1.VPNServerPatch) + vpnServerPatchModel.Certificate = certificateInstanceIdentityModel + vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) + vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") + vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) + vpnServerPatchModel.Protocol = core.StringPtr("udp") + vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerOptions model + updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) + updateVPNServerOptionsModel.ID = core.StringPtr("testString") + updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch + updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateVPNServer(updateVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateVPNServer 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // 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 VPNServerPatch model + vpnServerPatchModel := new(vpcv1.VPNServerPatch) + vpnServerPatchModel.Certificate = certificateInstanceIdentityModel + vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) + vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") + vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) + vpnServerPatchModel.Protocol = core.StringPtr("udp") + vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerOptions model + updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) + updateVPNServerOptionsModel.ID = core.StringPtr("testString") + updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch + updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPNServerOptionsModel.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.UpdateVPNServer(updateVPNServerOptionsModel) + 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 UpdateVPNServerOptions model with no property values + updateVPNServerOptionsModelNew := new(vpcv1.UpdateVPNServerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateVPNServer(updateVPNServerOptionsModelNew) + 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 UpdateVPNServer 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // 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 VPNServerPatch model + vpnServerPatchModel := new(vpcv1.VPNServerPatch) + vpnServerPatchModel.Certificate = certificateInstanceIdentityModel + vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) + vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") + vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) + vpnServerPatchModel.Protocol = core.StringPtr("udp") + vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerOptions model + updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) + updateVPNServerOptionsModel.ID = core.StringPtr("testString") + updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch + updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateVPNServer(updateVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions)`, func() { + version := "testString" + getVPNServerClientConfigurationPath := "/vpn_servers/testString/client_configuration" + 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(getVPNServerClientConfigurationPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", "text/plain") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `"client\nproto udp\nremote a8506291.us-south.vpn-server.appdomain.cloud\nport 443\n\ndev tun\nnobind\n\n-----BEGIN CERTIFICATE-----\nxxxxxx\n-----END CERTIFICATE-----\n"`) + })) + }) + It(`Invoke GetVPNServerClientConfiguration 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 GetVPNServerClientConfigurationOptions model + getVPNServerClientConfigurationOptionsModel := new(vpcv1.GetVPNServerClientConfigurationOptions) + getVPNServerClientConfigurationOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientConfigurationOptionsModel.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.GetVPNServerClientConfigurationWithContext(ctx, getVPNServerClientConfigurationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModel) + 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.GetVPNServerClientConfigurationWithContext(ctx, getVPNServerClientConfigurationOptionsModel) + 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(getVPNServerClientConfigurationPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "text/plain") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `"client\nproto udp\nremote a8506291.us-south.vpn-server.appdomain.cloud\nport 443\n\ndev tun\nnobind\n\n-----BEGIN CERTIFICATE-----\nxxxxxx\n-----END CERTIFICATE-----\n"`) + })) + }) + It(`Invoke GetVPNServerClientConfiguration 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.GetVPNServerClientConfiguration(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPNServerClientConfigurationOptions model + getVPNServerClientConfigurationOptionsModel := new(vpcv1.GetVPNServerClientConfigurationOptions) + getVPNServerClientConfigurationOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientConfigurationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPNServerClientConfiguration 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 GetVPNServerClientConfigurationOptions model + getVPNServerClientConfigurationOptionsModel := new(vpcv1.GetVPNServerClientConfigurationOptions) + getVPNServerClientConfigurationOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientConfigurationOptionsModel.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.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModel) + 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 GetVPNServerClientConfigurationOptions model with no property values + getVPNServerClientConfigurationOptionsModelNew := new(vpcv1.GetVPNServerClientConfigurationOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModelNew) + 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 GetVPNServerClientConfiguration 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 GetVPNServerClientConfigurationOptions model + getVPNServerClientConfigurationOptionsModel := new(vpcv1.GetVPNServerClientConfigurationOptions) + getVPNServerClientConfigurationOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientConfigurationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNServerClients(listVPNServerClientsOptions *ListVPNServerClientsOptions) - Operation response error`, func() { + version := "testString" + listVPNServerClientsPath := "/vpn_servers/testString/clients" + 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(listVPNServerClientsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"created_at"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListVPNServerClients 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 ListVPNServerClientsOptions model + listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) + listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") + listVPNServerClientsOptionsModel.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.ListVPNServerClients(listVPNServerClientsOptionsModel) + 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.ListVPNServerClients(listVPNServerClientsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNServerClients(listVPNServerClientsOptions *ListVPNServerClientsOptions)`, func() { + version := "testString" + listVPNServerClientsPath := "/vpn_servers/testString/clients" + 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(listVPNServerClientsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"created_at"})) + // 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", `{"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}`) + })) + }) + It(`Invoke ListVPNServerClients 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 ListVPNServerClientsOptions model + listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) + listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") + listVPNServerClientsOptionsModel.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.ListVPNServerClientsWithContext(ctx, listVPNServerClientsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVPNServerClients(listVPNServerClientsOptionsModel) + 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.ListVPNServerClientsWithContext(ctx, listVPNServerClientsOptionsModel) + 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(listVPNServerClientsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"created_at"})) + // 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}`) + })) + }) + It(`Invoke ListVPNServerClients 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.ListVPNServerClients(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVPNServerClientsOptions model + listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) + listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") + listVPNServerClientsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVPNServerClients(listVPNServerClientsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVPNServerClients 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 ListVPNServerClientsOptions model + listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) + listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") + listVPNServerClientsOptionsModel.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.ListVPNServerClients(listVPNServerClientsOptionsModel) + 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 ListVPNServerClientsOptions model with no property values + listVPNServerClientsOptionsModelNew := new(vpcv1.ListVPNServerClientsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListVPNServerClients(listVPNServerClientsOptionsModelNew) + 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 ListVPNServerClients 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 ListVPNServerClientsOptions model + listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) + listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") + listVPNServerClientsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVPNServerClients(listVPNServerClientsOptionsModel) + 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.VPNServerClientCollection) + nextObject := new(vpcv1.VPNServerClientCollectionNext) + 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.VPNServerClientCollection) + + 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.VPNServerClientCollection) + nextObject := new(vpcv1.VPNServerClientCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`DeleteVPNServerClient(deleteVPNServerClientOptions *DeleteVPNServerClientOptions)`, func() { + version := "testString" + deleteVPNServerClientPath := "/vpn_servers/testString/clients/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(deleteVPNServerClientPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteVPNServerClient 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.DeleteVPNServerClient(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteVPNServerClientOptions model + deleteVPNServerClientOptionsModel := new(vpcv1.DeleteVPNServerClientOptions) + deleteVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") + deleteVPNServerClientOptionsModel.ID = core.StringPtr("testString") + deleteVPNServerClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteVPNServerClient(deleteVPNServerClientOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteVPNServerClient 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 DeleteVPNServerClientOptions model + deleteVPNServerClientOptionsModel := new(vpcv1.DeleteVPNServerClientOptions) + deleteVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") + deleteVPNServerClientOptionsModel.ID = core.StringPtr("testString") + deleteVPNServerClientOptionsModel.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.DeleteVPNServerClient(deleteVPNServerClientOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteVPNServerClientOptions model with no property values + deleteVPNServerClientOptionsModelNew := new(vpcv1.DeleteVPNServerClientOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteVPNServerClient(deleteVPNServerClientOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNServerClient(getVPNServerClientOptions *GetVPNServerClientOptions) - Operation response error`, func() { + version := "testString" + getVPNServerClientPath := "/vpn_servers/testString/clients/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(getVPNServerClientPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVPNServerClient 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 GetVPNServerClientOptions model + getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) + getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerClientOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientOptionsModel.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.GetVPNServerClient(getVPNServerClientOptionsModel) + 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.GetVPNServerClient(getVPNServerClientOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNServerClient(getVPNServerClientOptions *GetVPNServerClientOptions)`, func() { + version := "testString" + getVPNServerClientPath := "/vpn_servers/testString/clients/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(getVPNServerClientPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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"}`) + })) + }) + It(`Invoke GetVPNServerClient 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 GetVPNServerClientOptions model + getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) + getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerClientOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientOptionsModel.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.GetVPNServerClientWithContext(ctx, getVPNServerClientOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPNServerClient(getVPNServerClientOptionsModel) + 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.GetVPNServerClientWithContext(ctx, getVPNServerClientOptionsModel) + 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(getVPNServerClientPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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"}`) + })) + }) + It(`Invoke GetVPNServerClient 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.GetVPNServerClient(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPNServerClientOptions model + getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) + getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerClientOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPNServerClient(getVPNServerClientOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPNServerClient 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 GetVPNServerClientOptions model + getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) + getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerClientOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientOptionsModel.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.GetVPNServerClient(getVPNServerClientOptionsModel) + 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 GetVPNServerClientOptions model with no property values + getVPNServerClientOptionsModelNew := new(vpcv1.GetVPNServerClientOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPNServerClient(getVPNServerClientOptionsModelNew) + 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 GetVPNServerClient 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 GetVPNServerClientOptions model + getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) + getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerClientOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPNServerClient(getVPNServerClientOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DisconnectVPNClient(disconnectVPNClientOptions *DisconnectVPNClientOptions)`, func() { + version := "testString" + disconnectVPNClientPath := "/vpn_servers/testString/clients/testString/disconnect" + 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(disconnectVPNClientPath)) + Expect(req.Method).To(Equal("POST")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DisconnectVPNClient 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.DisconnectVPNClient(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DisconnectVPNClientOptions model + disconnectVPNClientOptionsModel := new(vpcv1.DisconnectVPNClientOptions) + disconnectVPNClientOptionsModel.VPNServerID = core.StringPtr("testString") + disconnectVPNClientOptionsModel.ID = core.StringPtr("testString") + disconnectVPNClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DisconnectVPNClient(disconnectVPNClientOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DisconnectVPNClient 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 DisconnectVPNClientOptions model + disconnectVPNClientOptionsModel := new(vpcv1.DisconnectVPNClientOptions) + disconnectVPNClientOptionsModel.VPNServerID = core.StringPtr("testString") + disconnectVPNClientOptionsModel.ID = core.StringPtr("testString") + disconnectVPNClientOptionsModel.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.DisconnectVPNClient(disconnectVPNClientOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DisconnectVPNClientOptions model with no property values + disconnectVPNClientOptionsModelNew := new(vpcv1.DisconnectVPNClientOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DisconnectVPNClient(disconnectVPNClientOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNServerRoutes(listVPNServerRoutesOptions *ListVPNServerRoutesOptions) - Operation response error`, func() { + version := "testString" + listVPNServerRoutesPath := "/vpn_servers/testString/routes" + 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(listVPNServerRoutesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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 ListVPNServerRoutes 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 ListVPNServerRoutesOptions model + listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) + listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") + listVPNServerRoutesOptionsModel.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.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) + 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.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNServerRoutes(listVPNServerRoutesOptions *ListVPNServerRoutesOptions)`, func() { + version := "testString" + listVPNServerRoutesPath := "/vpn_servers/testString/routes" + 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(listVPNServerRoutesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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/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", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}`) + })) + }) + It(`Invoke ListVPNServerRoutes 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 ListVPNServerRoutesOptions model + listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) + listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") + listVPNServerRoutesOptionsModel.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.ListVPNServerRoutesWithContext(ctx, listVPNServerRoutesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) + 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.ListVPNServerRoutesWithContext(ctx, listVPNServerRoutesOptionsModel) + 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(listVPNServerRoutesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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/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", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}`) + })) + }) + It(`Invoke ListVPNServerRoutes 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.ListVPNServerRoutes(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVPNServerRoutesOptions model + listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) + listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") + listVPNServerRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVPNServerRoutes 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 ListVPNServerRoutesOptions model + listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) + listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") + listVPNServerRoutesOptionsModel.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.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) + 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 ListVPNServerRoutesOptions model with no property values + listVPNServerRoutesOptionsModelNew := new(vpcv1.ListVPNServerRoutesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModelNew) + 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 ListVPNServerRoutes 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 ListVPNServerRoutesOptions model + listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) + listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") + listVPNServerRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) + 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.VPNServerRouteCollection) + nextObject := new(vpcv1.VPNServerRouteCollectionNext) + 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.VPNServerRouteCollection) + + 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.VPNServerRouteCollection) + nextObject := new(vpcv1.VPNServerRouteCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) - Operation response error`, func() { + version := "testString" + createVPNServerRoutePath := "/vpn_servers/testString/routes" + 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(createVPNServerRoutePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateVPNServerRoute 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 CreateVPNServerRouteOptions model + createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) + createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") + createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") + createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") + createVPNServerRouteOptionsModel.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.CreateVPNServerRoute(createVPNServerRouteOptionsModel) + 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.CreateVPNServerRoute(createVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions)`, func() { + version := "testString" + createVPNServerRoutePath := "/vpn_servers/testString/routes" + 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(createVPNServerRoutePath)) + 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{"testString"})) + 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", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) + })) + }) + It(`Invoke CreateVPNServerRoute 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 CreateVPNServerRouteOptions model + createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) + createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") + createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") + createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") + createVPNServerRouteOptionsModel.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.CreateVPNServerRouteWithContext(ctx, createVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModel) + 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.CreateVPNServerRouteWithContext(ctx, createVPNServerRouteOptionsModel) + 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(createVPNServerRoutePath)) + 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{"testString"})) + 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", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) + })) + }) + It(`Invoke CreateVPNServerRoute 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.CreateVPNServerRoute(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the CreateVPNServerRouteOptions model + createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) + createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") + createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") + createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") + createVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateVPNServerRoute 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 CreateVPNServerRouteOptions model + createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) + createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") + createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") + createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") + createVPNServerRouteOptionsModel.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.CreateVPNServerRoute(createVPNServerRouteOptionsModel) + 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 CreateVPNServerRouteOptions model with no property values + createVPNServerRouteOptionsModelNew := new(vpcv1.CreateVPNServerRouteOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModelNew) + 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 CreateVPNServerRoute 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 CreateVPNServerRouteOptions model + createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) + createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") + createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") + createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") + createVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteVPNServerRoute(deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions)`, func() { + version := "testString" + deleteVPNServerRoutePath := "/vpn_servers/testString/routes/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(deleteVPNServerRoutePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteVPNServerRoute 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.DeleteVPNServerRoute(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteVPNServerRouteOptions model + deleteVPNServerRouteOptionsModel := new(vpcv1.DeleteVPNServerRouteOptions) + deleteVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + deleteVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + deleteVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteVPNServerRoute(deleteVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteVPNServerRoute 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 DeleteVPNServerRouteOptions model + deleteVPNServerRouteOptionsModel := new(vpcv1.DeleteVPNServerRouteOptions) + deleteVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + deleteVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + deleteVPNServerRouteOptionsModel.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.DeleteVPNServerRoute(deleteVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteVPNServerRouteOptions model with no property values + deleteVPNServerRouteOptionsModelNew := new(vpcv1.DeleteVPNServerRouteOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteVPNServerRoute(deleteVPNServerRouteOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNServerRoute(getVPNServerRouteOptions *GetVPNServerRouteOptions) - Operation response error`, func() { + version := "testString" + getVPNServerRoutePath := "/vpn_servers/testString/routes/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(getVPNServerRoutePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetVPNServerRoute 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 GetVPNServerRouteOptions model + getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) + getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.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.GetVPNServerRoute(getVPNServerRouteOptionsModel) + 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.GetVPNServerRoute(getVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNServerRoute(getVPNServerRouteOptions *GetVPNServerRouteOptions)`, func() { + version := "testString" + getVPNServerRoutePath := "/vpn_servers/testString/routes/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(getVPNServerRoutePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) + })) + }) + It(`Invoke GetVPNServerRoute 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 GetVPNServerRouteOptions model + getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) + getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.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.GetVPNServerRouteWithContext(ctx, getVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModel) + 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.GetVPNServerRouteWithContext(ctx, getVPNServerRouteOptionsModel) + 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(getVPNServerRoutePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) + })) + }) + It(`Invoke GetVPNServerRoute 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.GetVPNServerRoute(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPNServerRouteOptions model + getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) + getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPNServerRoute 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 GetVPNServerRouteOptions model + getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) + getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.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.GetVPNServerRoute(getVPNServerRouteOptionsModel) + 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 GetVPNServerRouteOptions model with no property values + getVPNServerRouteOptionsModelNew := new(vpcv1.GetVPNServerRouteOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModelNew) + 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 GetVPNServerRoute 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 GetVPNServerRouteOptions model + getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) + getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPNServerRoute(updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) - Operation response error`, func() { + version := "testString" + updateVPNServerRoutePath := "/vpn_servers/testString/routes/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(updateVPNServerRoutePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateVPNServerRoute 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 VPNServerRoutePatch model + vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) + vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") + vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerRouteOptions model + updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) + updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch + updateVPNServerRouteOptionsModel.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.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) + 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.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPNServerRoute(updateVPNServerRouteOptions *UpdateVPNServerRouteOptions)`, func() { + version := "testString" + updateVPNServerRoutePath := "/vpn_servers/testString/routes/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(updateVPNServerRoutePath)) + 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{"testString"})) + 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", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) + })) + }) + It(`Invoke UpdateVPNServerRoute 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 VPNServerRoutePatch model + vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) + vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") + vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerRouteOptions model + updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) + updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch + updateVPNServerRouteOptionsModel.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.UpdateVPNServerRouteWithContext(ctx, updateVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) + 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.UpdateVPNServerRouteWithContext(ctx, updateVPNServerRouteOptionsModel) + 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(updateVPNServerRoutePath)) + 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{"testString"})) + 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", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) + })) + }) + It(`Invoke UpdateVPNServerRoute 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.UpdateVPNServerRoute(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the VPNServerRoutePatch model + vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) + vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") + vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerRouteOptions model + updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) + updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch + updateVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateVPNServerRoute 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 VPNServerRoutePatch model + vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) + vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") + vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerRouteOptions model + updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) + updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch + updateVPNServerRouteOptionsModel.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.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) + 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 UpdateVPNServerRouteOptions model with no property values + updateVPNServerRouteOptionsModelNew := new(vpcv1.UpdateVPNServerRouteOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModelNew) + 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 UpdateVPNServerRoute 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 VPNServerRoutePatch model + vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) + vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") + vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerRouteOptions model + updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) + updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch + updateVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListLoadBalancerProfiles(listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) - Operation response error`, func() { + version := "testString" + listLoadBalancerProfilesPath := "/load_balancer/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(listLoadBalancerProfilesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListLoadBalancerProfiles 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 ListLoadBalancerProfilesOptions model + listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) + listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") + listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancerProfilesOptionsModel.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.ListLoadBalancerProfiles(listLoadBalancerProfilesOptionsModel) + 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.ListLoadBalancerProfiles(listLoadBalancerProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListLoadBalancerProfiles(listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions)`, func() { + version := "testString" + listLoadBalancerProfilesPath := "/load_balancer/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(listLoadBalancerProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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": [{"family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "udp_supported": {"type": "fixed", "value": true}}], "total_count": 132}`) + })) + }) + It(`Invoke ListLoadBalancerProfiles 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 ListLoadBalancerProfilesOptions model + listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) + listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") + listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancerProfilesOptionsModel.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.ListLoadBalancerProfilesWithContext(ctx, listLoadBalancerProfilesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListLoadBalancerProfiles(listLoadBalancerProfilesOptionsModel) + 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.ListLoadBalancerProfilesWithContext(ctx, listLoadBalancerProfilesOptionsModel) + 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(listLoadBalancerProfilesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/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": [{"family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "udp_supported": {"type": "fixed", "value": true}}], "total_count": 132}`) + })) + }) + It(`Invoke ListLoadBalancerProfiles 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.ListLoadBalancerProfiles(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListLoadBalancerProfilesOptions model + listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) + listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") + listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListLoadBalancerProfiles(listLoadBalancerProfilesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListLoadBalancerProfiles 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 ListLoadBalancerProfilesOptions model + listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) + listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") + listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancerProfilesOptionsModel.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.ListLoadBalancerProfiles(listLoadBalancerProfilesOptionsModel) + 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 ListLoadBalancerProfiles 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 ListLoadBalancerProfilesOptions model + listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) + listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") + listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListLoadBalancerProfiles(listLoadBalancerProfilesOptionsModel) + 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.LoadBalancerProfileCollection) + nextObject := new(vpcv1.LoadBalancerProfileCollectionNext) + 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.LoadBalancerProfileCollection) + + 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.LoadBalancerProfileCollection) + nextObject := new(vpcv1.LoadBalancerProfileCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`GetLoadBalancerProfile(getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) - Operation response error`, func() { + version := "testString" + getLoadBalancerProfilePath := "/load_balancer/profiles/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(getLoadBalancerProfilePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetLoadBalancerProfile 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 GetLoadBalancerProfileOptions model + getLoadBalancerProfileOptionsModel := new(vpcv1.GetLoadBalancerProfileOptions) + getLoadBalancerProfileOptionsModel.Name = core.StringPtr("testString") + getLoadBalancerProfileOptionsModel.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.GetLoadBalancerProfile(getLoadBalancerProfileOptionsModel) + 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.GetLoadBalancerProfile(getLoadBalancerProfileOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancerProfile(getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions)`, func() { + version := "testString" + getLoadBalancerProfilePath := "/load_balancer/profiles/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(getLoadBalancerProfilePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "udp_supported": {"type": "fixed", "value": true}}`) + })) + }) + It(`Invoke GetLoadBalancerProfile 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 GetLoadBalancerProfileOptions model + getLoadBalancerProfileOptionsModel := new(vpcv1.GetLoadBalancerProfileOptions) + getLoadBalancerProfileOptionsModel.Name = core.StringPtr("testString") + getLoadBalancerProfileOptionsModel.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.GetLoadBalancerProfileWithContext(ctx, getLoadBalancerProfileOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetLoadBalancerProfile(getLoadBalancerProfileOptionsModel) + 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.GetLoadBalancerProfileWithContext(ctx, getLoadBalancerProfileOptionsModel) + 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(getLoadBalancerProfilePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "udp_supported": {"type": "fixed", "value": true}}`) + })) + }) + It(`Invoke GetLoadBalancerProfile 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.GetLoadBalancerProfile(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetLoadBalancerProfileOptions model + getLoadBalancerProfileOptionsModel := new(vpcv1.GetLoadBalancerProfileOptions) + getLoadBalancerProfileOptionsModel.Name = core.StringPtr("testString") + getLoadBalancerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetLoadBalancerProfile(getLoadBalancerProfileOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetLoadBalancerProfile 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 GetLoadBalancerProfileOptions model + getLoadBalancerProfileOptionsModel := new(vpcv1.GetLoadBalancerProfileOptions) + getLoadBalancerProfileOptionsModel.Name = core.StringPtr("testString") + getLoadBalancerProfileOptionsModel.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.GetLoadBalancerProfile(getLoadBalancerProfileOptionsModel) + 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 GetLoadBalancerProfileOptions model with no property values + getLoadBalancerProfileOptionsModelNew := new(vpcv1.GetLoadBalancerProfileOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetLoadBalancerProfile(getLoadBalancerProfileOptionsModelNew) + 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 GetLoadBalancerProfile 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 GetLoadBalancerProfileOptions model + getLoadBalancerProfileOptionsModel := new(vpcv1.GetLoadBalancerProfileOptions) + getLoadBalancerProfileOptionsModel.Name = core.StringPtr("testString") + getLoadBalancerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetLoadBalancerProfile(getLoadBalancerProfileOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) - Operation response error`, func() { + version := "testString" + listLoadBalancersPath := "/load_balancers" + 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(listLoadBalancersPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListLoadBalancers 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 ListLoadBalancersOptions model + listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) + listLoadBalancersOptionsModel.Start = core.StringPtr("testString") + listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancersOptionsModel.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.ListLoadBalancers(listLoadBalancersOptionsModel) + 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.ListLoadBalancers(listLoadBalancersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions)`, func() { + version := "testString" + listLoadBalancersPath := "/load_balancers" + 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(listLoadBalancersPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/load_balancers?limit=20"}, "limit": 20, "load_balancers": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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}`) + })) + }) + It(`Invoke ListLoadBalancers 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 ListLoadBalancersOptions model + listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) + listLoadBalancersOptionsModel.Start = core.StringPtr("testString") + listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancersOptionsModel.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.ListLoadBalancersWithContext(ctx, listLoadBalancersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListLoadBalancers(listLoadBalancersOptionsModel) + 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.ListLoadBalancersWithContext(ctx, listLoadBalancersOptionsModel) + 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(listLoadBalancersPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(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/load_balancers?limit=20"}, "limit": 20, "load_balancers": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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}`) + })) + }) + It(`Invoke ListLoadBalancers 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.ListLoadBalancers(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListLoadBalancersOptions model + listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) + listLoadBalancersOptionsModel.Start = core.StringPtr("testString") + listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListLoadBalancers(listLoadBalancersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListLoadBalancers 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 ListLoadBalancersOptions model + listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) + listLoadBalancersOptionsModel.Start = core.StringPtr("testString") + listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancersOptionsModel.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.ListLoadBalancers(listLoadBalancersOptionsModel) + 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 ListLoadBalancers 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 ListLoadBalancersOptions model + listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) + listLoadBalancersOptionsModel.Start = core.StringPtr("testString") + listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListLoadBalancers(listLoadBalancersOptionsModel) + 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.LoadBalancerCollection) + nextObject := new(vpcv1.LoadBalancerCollectionNext) + 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.LoadBalancerCollection) + + 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.LoadBalancerCollection) + nextObject := new(vpcv1.LoadBalancerCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateLoadBalancer(createLoadBalancerOptions *CreateLoadBalancerOptions) - Operation response error`, func() { + version := "testString" + createLoadBalancerPath := "/load_balancers" + 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(createLoadBalancerPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateLoadBalancer 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the LoadBalancerPoolIdentityByName model + loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) + loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") + + // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model + loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) + loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel + loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) + loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) + loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) + loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") + + // Construct an instance of the LoadBalancerLoggingDatapath model + loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) + loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + + // Construct an instance of the LoadBalancerLogging model + loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) + loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + + // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model + loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) + loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model + loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) + loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the LoadBalancerPoolPrototype model + loadBalancerPoolPrototypeModel := new(vpcv1.LoadBalancerPoolPrototype) + loadBalancerPoolPrototypeModel.Algorithm = core.StringPtr("least_connections") + loadBalancerPoolPrototypeModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel + loadBalancerPoolPrototypeModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + loadBalancerPoolPrototypeModel.Name = core.StringPtr("my-load-balancer-pool") + loadBalancerPoolPrototypeModel.Protocol = core.StringPtr("http") + loadBalancerPoolPrototypeModel.ProxyProtocol = core.StringPtr("disabled") + loadBalancerPoolPrototypeModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel + + // Construct an instance of the LoadBalancerProfileIdentityByName model + loadBalancerProfileIdentityModel := new(vpcv1.LoadBalancerProfileIdentityByName) + loadBalancerProfileIdentityModel.Name = core.StringPtr("network-fixed") + + // 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 CreateLoadBalancerOptions model + createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) + createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) + createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} + createLoadBalancerOptionsModel.Logging = loadBalancerLoggingModel + createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") + createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} + createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel + createLoadBalancerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createLoadBalancerOptionsModel.RouteMode = core.BoolPtr(true) + createLoadBalancerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createLoadBalancerOptionsModel.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.CreateLoadBalancer(createLoadBalancerOptionsModel) + 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.CreateLoadBalancer(createLoadBalancerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateLoadBalancer(createLoadBalancerOptions *CreateLoadBalancerOptions)`, func() { + version := "testString" + createLoadBalancerPath := "/load_balancers" + 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(createLoadBalancerPath)) + 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{"testString"})) + 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) + })) + }) + It(`Invoke CreateLoadBalancer 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the LoadBalancerPoolIdentityByName model + loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) + loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") + + // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model + loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) + loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel + loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) + loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) + loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) + loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") + + // Construct an instance of the LoadBalancerLoggingDatapath model + loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) + loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + + // Construct an instance of the LoadBalancerLogging model + loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) + loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + + // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model + loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) + loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model + loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) + loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the LoadBalancerPoolPrototype model + loadBalancerPoolPrototypeModel := new(vpcv1.LoadBalancerPoolPrototype) + loadBalancerPoolPrototypeModel.Algorithm = core.StringPtr("least_connections") + loadBalancerPoolPrototypeModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel + loadBalancerPoolPrototypeModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + loadBalancerPoolPrototypeModel.Name = core.StringPtr("my-load-balancer-pool") + loadBalancerPoolPrototypeModel.Protocol = core.StringPtr("http") + loadBalancerPoolPrototypeModel.ProxyProtocol = core.StringPtr("disabled") + loadBalancerPoolPrototypeModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel + + // Construct an instance of the LoadBalancerProfileIdentityByName model + loadBalancerProfileIdentityModel := new(vpcv1.LoadBalancerProfileIdentityByName) + loadBalancerProfileIdentityModel.Name = core.StringPtr("network-fixed") + + // 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 CreateLoadBalancerOptions model + createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) + createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) + createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} + createLoadBalancerOptionsModel.Logging = loadBalancerLoggingModel + createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") + createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} + createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel + createLoadBalancerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createLoadBalancerOptionsModel.RouteMode = core.BoolPtr(true) + createLoadBalancerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createLoadBalancerOptionsModel.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.CreateLoadBalancerWithContext(ctx, createLoadBalancerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateLoadBalancer(createLoadBalancerOptionsModel) + 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.CreateLoadBalancerWithContext(ctx, createLoadBalancerOptionsModel) + 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(createLoadBalancerPath)) + 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{"testString"})) + 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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) + })) + }) + It(`Invoke CreateLoadBalancer 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.CreateLoadBalancer(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 LoadBalancerPoolIdentityByName model + loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) + loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") + + // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model + loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) + loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel + loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) + loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) + loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) + loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") + + // Construct an instance of the LoadBalancerLoggingDatapath model + loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) + loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + + // Construct an instance of the LoadBalancerLogging model + loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) + loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + + // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model + loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) + loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model + loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) + loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the LoadBalancerPoolPrototype model + loadBalancerPoolPrototypeModel := new(vpcv1.LoadBalancerPoolPrototype) + loadBalancerPoolPrototypeModel.Algorithm = core.StringPtr("least_connections") + loadBalancerPoolPrototypeModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel + loadBalancerPoolPrototypeModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + loadBalancerPoolPrototypeModel.Name = core.StringPtr("my-load-balancer-pool") + loadBalancerPoolPrototypeModel.Protocol = core.StringPtr("http") + loadBalancerPoolPrototypeModel.ProxyProtocol = core.StringPtr("disabled") + loadBalancerPoolPrototypeModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel + + // Construct an instance of the LoadBalancerProfileIdentityByName model + loadBalancerProfileIdentityModel := new(vpcv1.LoadBalancerProfileIdentityByName) + loadBalancerProfileIdentityModel.Name = core.StringPtr("network-fixed") + + // 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 CreateLoadBalancerOptions model + createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) + createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) + createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} + createLoadBalancerOptionsModel.Logging = loadBalancerLoggingModel + createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") + createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} + createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel + createLoadBalancerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createLoadBalancerOptionsModel.RouteMode = core.BoolPtr(true) + createLoadBalancerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateLoadBalancer(createLoadBalancerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateLoadBalancer 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the LoadBalancerPoolIdentityByName model + loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) + loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") + + // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model + loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) + loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel + loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) + loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) + loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) + loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") + + // Construct an instance of the LoadBalancerLoggingDatapath model + loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) + loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + + // Construct an instance of the LoadBalancerLogging model + loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) + loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + + // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model + loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) + loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model + loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) + loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the LoadBalancerPoolPrototype model + loadBalancerPoolPrototypeModel := new(vpcv1.LoadBalancerPoolPrototype) + loadBalancerPoolPrototypeModel.Algorithm = core.StringPtr("least_connections") + loadBalancerPoolPrototypeModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel + loadBalancerPoolPrototypeModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + loadBalancerPoolPrototypeModel.Name = core.StringPtr("my-load-balancer-pool") + loadBalancerPoolPrototypeModel.Protocol = core.StringPtr("http") + loadBalancerPoolPrototypeModel.ProxyProtocol = core.StringPtr("disabled") + loadBalancerPoolPrototypeModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel + + // Construct an instance of the LoadBalancerProfileIdentityByName model + loadBalancerProfileIdentityModel := new(vpcv1.LoadBalancerProfileIdentityByName) + loadBalancerProfileIdentityModel.Name = core.StringPtr("network-fixed") + + // 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 CreateLoadBalancerOptions model + createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) + createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) + createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} + createLoadBalancerOptionsModel.Logging = loadBalancerLoggingModel + createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") + createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} + createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel + createLoadBalancerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createLoadBalancerOptionsModel.RouteMode = core.BoolPtr(true) + createLoadBalancerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createLoadBalancerOptionsModel.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.CreateLoadBalancer(createLoadBalancerOptionsModel) + 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 CreateLoadBalancerOptions model with no property values + createLoadBalancerOptionsModelNew := new(vpcv1.CreateLoadBalancerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateLoadBalancer(createLoadBalancerOptionsModelNew) + 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 CreateLoadBalancer 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") + + // Construct an instance of the LoadBalancerPoolIdentityByName model + loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) + loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") + + // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model + loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) + loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel + loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) + loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) + loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) + loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") + + // Construct an instance of the LoadBalancerLoggingDatapath model + loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) + loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + + // Construct an instance of the LoadBalancerLogging model + loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) + loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + + // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model + loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) + loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model + loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) + loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the LoadBalancerPoolPrototype model + loadBalancerPoolPrototypeModel := new(vpcv1.LoadBalancerPoolPrototype) + loadBalancerPoolPrototypeModel.Algorithm = core.StringPtr("least_connections") + loadBalancerPoolPrototypeModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel + loadBalancerPoolPrototypeModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + loadBalancerPoolPrototypeModel.Name = core.StringPtr("my-load-balancer-pool") + loadBalancerPoolPrototypeModel.Protocol = core.StringPtr("http") + loadBalancerPoolPrototypeModel.ProxyProtocol = core.StringPtr("disabled") + loadBalancerPoolPrototypeModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel + + // Construct an instance of the LoadBalancerProfileIdentityByName model + loadBalancerProfileIdentityModel := new(vpcv1.LoadBalancerProfileIdentityByName) + loadBalancerProfileIdentityModel.Name = core.StringPtr("network-fixed") + + // 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 CreateLoadBalancerOptions model + createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) + createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) + createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} + createLoadBalancerOptionsModel.Logging = loadBalancerLoggingModel + createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") + createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} + createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel + createLoadBalancerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createLoadBalancerOptionsModel.RouteMode = core.BoolPtr(true) + createLoadBalancerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateLoadBalancer(createLoadBalancerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions)`, func() { + version := "testString" + deleteLoadBalancerPath := "/load_balancers/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(deleteLoadBalancerPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteLoadBalancer 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.DeleteLoadBalancer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteLoadBalancerOptions model + deleteLoadBalancerOptionsModel := new(vpcv1.DeleteLoadBalancerOptions) + deleteLoadBalancerOptionsModel.ID = core.StringPtr("testString") + deleteLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteLoadBalancer(deleteLoadBalancerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteLoadBalancer 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 DeleteLoadBalancerOptions model + deleteLoadBalancerOptionsModel := new(vpcv1.DeleteLoadBalancerOptions) + deleteLoadBalancerOptionsModel.ID = core.StringPtr("testString") + deleteLoadBalancerOptionsModel.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.DeleteLoadBalancer(deleteLoadBalancerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteLoadBalancerOptions model with no property values + deleteLoadBalancerOptionsModelNew := new(vpcv1.DeleteLoadBalancerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteLoadBalancer(deleteLoadBalancerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancer(getLoadBalancerOptions *GetLoadBalancerOptions) - Operation response error`, func() { + version := "testString" + getLoadBalancerPath := "/load_balancers/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(getLoadBalancerPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetLoadBalancer 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 GetLoadBalancerOptions model + getLoadBalancerOptionsModel := new(vpcv1.GetLoadBalancerOptions) + getLoadBalancerOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerOptionsModel.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.GetLoadBalancer(getLoadBalancerOptionsModel) + 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.GetLoadBalancer(getLoadBalancerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancer(getLoadBalancerOptions *GetLoadBalancerOptions)`, func() { + version := "testString" + getLoadBalancerPath := "/load_balancers/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(getLoadBalancerPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) + })) + }) + It(`Invoke GetLoadBalancer 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 GetLoadBalancerOptions model + getLoadBalancerOptionsModel := new(vpcv1.GetLoadBalancerOptions) + getLoadBalancerOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerOptionsModel.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.GetLoadBalancerWithContext(ctx, getLoadBalancerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetLoadBalancer(getLoadBalancerOptionsModel) + 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.GetLoadBalancerWithContext(ctx, getLoadBalancerOptionsModel) + 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(getLoadBalancerPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) + })) + }) + It(`Invoke GetLoadBalancer 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.GetLoadBalancer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetLoadBalancerOptions model + getLoadBalancerOptionsModel := new(vpcv1.GetLoadBalancerOptions) + getLoadBalancerOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetLoadBalancer(getLoadBalancerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetLoadBalancer 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 GetLoadBalancerOptions model + getLoadBalancerOptionsModel := new(vpcv1.GetLoadBalancerOptions) + getLoadBalancerOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerOptionsModel.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.GetLoadBalancer(getLoadBalancerOptionsModel) + 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 GetLoadBalancerOptions model with no property values + getLoadBalancerOptionsModelNew := new(vpcv1.GetLoadBalancerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetLoadBalancer(getLoadBalancerOptionsModelNew) + 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 GetLoadBalancer 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 GetLoadBalancerOptions model + getLoadBalancerOptionsModel := new(vpcv1.GetLoadBalancerOptions) + getLoadBalancerOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetLoadBalancer(getLoadBalancerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateLoadBalancer(updateLoadBalancerOptions *UpdateLoadBalancerOptions) - Operation response error`, func() { + version := "testString" + updateLoadBalancerPath := "/load_balancers/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(updateLoadBalancerPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateLoadBalancer 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 LoadBalancerLoggingDatapath model + loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) + loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + + // Construct an instance of the LoadBalancerLogging model + loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) + loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + + // Construct an instance of the LoadBalancerPatch model + loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) + loadBalancerPatchModel.Logging = loadBalancerLoggingModel + loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") + loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerOptions model + updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) + updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch + updateLoadBalancerOptionsModel.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.UpdateLoadBalancer(updateLoadBalancerOptionsModel) + 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.UpdateLoadBalancer(updateLoadBalancerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateLoadBalancer(updateLoadBalancerOptions *UpdateLoadBalancerOptions)`, func() { + version := "testString" + updateLoadBalancerPath := "/load_balancers/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(updateLoadBalancerPath)) + 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{"testString"})) + 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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) + })) + }) + It(`Invoke UpdateLoadBalancer 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 LoadBalancerLoggingDatapath model + loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) + loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + + // Construct an instance of the LoadBalancerLogging model + loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) + loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + + // Construct an instance of the LoadBalancerPatch model + loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) + loadBalancerPatchModel.Logging = loadBalancerLoggingModel + loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") + loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerOptions model + updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) + updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch + updateLoadBalancerOptionsModel.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.UpdateLoadBalancerWithContext(ctx, updateLoadBalancerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateLoadBalancer(updateLoadBalancerOptionsModel) + 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.UpdateLoadBalancerWithContext(ctx, updateLoadBalancerOptionsModel) + 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(updateLoadBalancerPath)) + 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{"testString"})) + 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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) + })) + }) + It(`Invoke UpdateLoadBalancer 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.UpdateLoadBalancer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the LoadBalancerLoggingDatapath model + loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) + loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + + // Construct an instance of the LoadBalancerLogging model + loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) + loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + + // Construct an instance of the LoadBalancerPatch model + loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) + loadBalancerPatchModel.Logging = loadBalancerLoggingModel + loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") + loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerOptions model + updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) + updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch + updateLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateLoadBalancer(updateLoadBalancerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateLoadBalancer 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 LoadBalancerLoggingDatapath model + loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) + loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + + // Construct an instance of the LoadBalancerLogging model + loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) + loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + + // Construct an instance of the LoadBalancerPatch model + loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) + loadBalancerPatchModel.Logging = loadBalancerLoggingModel + loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") + loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerOptions model + updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) + updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch + updateLoadBalancerOptionsModel.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.UpdateLoadBalancer(updateLoadBalancerOptionsModel) + 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 UpdateLoadBalancerOptions model with no property values + updateLoadBalancerOptionsModelNew := new(vpcv1.UpdateLoadBalancerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateLoadBalancer(updateLoadBalancerOptionsModelNew) + 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 UpdateLoadBalancer 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 LoadBalancerLoggingDatapath model + loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) + loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + + // Construct an instance of the LoadBalancerLogging model + loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) + loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + + // Construct an instance of the LoadBalancerPatch model + loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) + loadBalancerPatchModel.Logging = loadBalancerLoggingModel + loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") + loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerOptions model + updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) + updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch + updateLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateLoadBalancer(updateLoadBalancerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancerStatistics(getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) - Operation response error`, func() { + version := "testString" + getLoadBalancerStatisticsPath := "/load_balancers/testString/statistics" + 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(getLoadBalancerStatisticsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetLoadBalancerStatistics 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 GetLoadBalancerStatisticsOptions model + getLoadBalancerStatisticsOptionsModel := new(vpcv1.GetLoadBalancerStatisticsOptions) + getLoadBalancerStatisticsOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerStatisticsOptionsModel.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.GetLoadBalancerStatistics(getLoadBalancerStatisticsOptionsModel) + 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.GetLoadBalancerStatistics(getLoadBalancerStatisticsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancerStatistics(getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions)`, func() { + version := "testString" + getLoadBalancerStatisticsPath := "/load_balancers/testString/statistics" + 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(getLoadBalancerStatisticsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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_connections": 797, "connection_rate": 91.121, "data_processed_this_month": 10093173145, "throughput": 167.278}`) + })) + }) + It(`Invoke GetLoadBalancerStatistics 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 GetLoadBalancerStatisticsOptions model + getLoadBalancerStatisticsOptionsModel := new(vpcv1.GetLoadBalancerStatisticsOptions) + getLoadBalancerStatisticsOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerStatisticsOptionsModel.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.GetLoadBalancerStatisticsWithContext(ctx, getLoadBalancerStatisticsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetLoadBalancerStatistics(getLoadBalancerStatisticsOptionsModel) + 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.GetLoadBalancerStatisticsWithContext(ctx, getLoadBalancerStatisticsOptionsModel) + 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(getLoadBalancerStatisticsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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_connections": 797, "connection_rate": 91.121, "data_processed_this_month": 10093173145, "throughput": 167.278}`) + })) + }) + It(`Invoke GetLoadBalancerStatistics 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.GetLoadBalancerStatistics(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetLoadBalancerStatisticsOptions model + getLoadBalancerStatisticsOptionsModel := new(vpcv1.GetLoadBalancerStatisticsOptions) + getLoadBalancerStatisticsOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerStatisticsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetLoadBalancerStatistics(getLoadBalancerStatisticsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetLoadBalancerStatistics 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 GetLoadBalancerStatisticsOptions model + getLoadBalancerStatisticsOptionsModel := new(vpcv1.GetLoadBalancerStatisticsOptions) + getLoadBalancerStatisticsOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerStatisticsOptionsModel.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.GetLoadBalancerStatistics(getLoadBalancerStatisticsOptionsModel) + 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 GetLoadBalancerStatisticsOptions model with no property values + getLoadBalancerStatisticsOptionsModelNew := new(vpcv1.GetLoadBalancerStatisticsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetLoadBalancerStatistics(getLoadBalancerStatisticsOptionsModelNew) + 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 GetLoadBalancerStatistics 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 GetLoadBalancerStatisticsOptions model + getLoadBalancerStatisticsOptionsModel := new(vpcv1.GetLoadBalancerStatisticsOptions) + getLoadBalancerStatisticsOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerStatisticsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetLoadBalancerStatistics(getLoadBalancerStatisticsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) - Operation response error`, func() { + version := "testString" + listLoadBalancerListenersPath := "/load_balancers/testString/listeners" + 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(listLoadBalancerListenersPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListLoadBalancerListeners 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 ListLoadBalancerListenersOptions model + listLoadBalancerListenersOptionsModel := new(vpcv1.ListLoadBalancerListenersOptions) + listLoadBalancerListenersOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenersOptionsModel.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.ListLoadBalancerListeners(listLoadBalancerListenersOptionsModel) + 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.ListLoadBalancerListeners(listLoadBalancerListenersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions)`, func() { + version := "testString" + listLoadBalancerListenersPath := "/load_balancers/testString/listeners" + 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(listLoadBalancerListenersPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}`) + })) + }) + It(`Invoke ListLoadBalancerListeners 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 ListLoadBalancerListenersOptions model + listLoadBalancerListenersOptionsModel := new(vpcv1.ListLoadBalancerListenersOptions) + listLoadBalancerListenersOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenersOptionsModel.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.ListLoadBalancerListenersWithContext(ctx, listLoadBalancerListenersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListLoadBalancerListeners(listLoadBalancerListenersOptionsModel) + 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.ListLoadBalancerListenersWithContext(ctx, listLoadBalancerListenersOptionsModel) + 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(listLoadBalancerListenersPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}`) + })) + }) + It(`Invoke ListLoadBalancerListeners 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.ListLoadBalancerListeners(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListLoadBalancerListenersOptions model + listLoadBalancerListenersOptionsModel := new(vpcv1.ListLoadBalancerListenersOptions) + listLoadBalancerListenersOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListLoadBalancerListeners(listLoadBalancerListenersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListLoadBalancerListeners 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 ListLoadBalancerListenersOptions model + listLoadBalancerListenersOptionsModel := new(vpcv1.ListLoadBalancerListenersOptions) + listLoadBalancerListenersOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenersOptionsModel.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.ListLoadBalancerListeners(listLoadBalancerListenersOptionsModel) + 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 ListLoadBalancerListenersOptions model with no property values + listLoadBalancerListenersOptionsModelNew := new(vpcv1.ListLoadBalancerListenersOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListLoadBalancerListeners(listLoadBalancerListenersOptionsModelNew) + 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 ListLoadBalancerListeners 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 ListLoadBalancerListenersOptions model + listLoadBalancerListenersOptionsModel := new(vpcv1.ListLoadBalancerListenersOptions) + listLoadBalancerListenersOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListLoadBalancerListeners(listLoadBalancerListenersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateLoadBalancerListener(createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) - Operation response error`, func() { + version := "testString" + createLoadBalancerListenerPath := "/load_balancers/testString/listeners" + 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(createLoadBalancerListenerPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model + loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) + loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") + + // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model + loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) + loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") + + // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerPolicyPrototype model + loadBalancerListenerPolicyPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyPrototype) + loadBalancerListenerPolicyPrototypeModel.Action = core.StringPtr("forward") + loadBalancerListenerPolicyPrototypeModel.Name = core.StringPtr("my-policy") + loadBalancerListenerPolicyPrototypeModel.Priority = core.Int64Ptr(int64(5)) + loadBalancerListenerPolicyPrototypeModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} + loadBalancerListenerPolicyPrototypeModel.Target = loadBalancerListenerPolicyTargetPrototypeModel + + // Construct an instance of the CreateLoadBalancerListenerOptions model + createLoadBalancerListenerOptionsModel := new(vpcv1.CreateLoadBalancerListenerOptions) + createLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerOptionsModel.Protocol = core.StringPtr("http") + createLoadBalancerListenerOptionsModel.AcceptProxyProtocol = core.BoolPtr(true) + createLoadBalancerListenerOptionsModel.CertificateInstance = certificateInstanceIdentityModel + createLoadBalancerListenerOptionsModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + createLoadBalancerListenerOptionsModel.DefaultPool = loadBalancerPoolIdentityModel + createLoadBalancerListenerOptionsModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel + createLoadBalancerListenerOptionsModel.Policies = []vpcv1.LoadBalancerListenerPolicyPrototype{*loadBalancerListenerPolicyPrototypeModel} + createLoadBalancerListenerOptionsModel.Port = core.Int64Ptr(int64(443)) + createLoadBalancerListenerOptionsModel.PortMax = core.Int64Ptr(int64(499)) + createLoadBalancerListenerOptionsModel.PortMin = core.Int64Ptr(int64(443)) + createLoadBalancerListenerOptionsModel.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.CreateLoadBalancerListener(createLoadBalancerListenerOptionsModel) + 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.CreateLoadBalancerListener(createLoadBalancerListenerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateLoadBalancerListener(createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions)`, func() { + version := "testString" + createLoadBalancerListenerPath := "/load_balancers/testString/listeners" + 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(createLoadBalancerListenerPath)) + 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{"testString"})) + 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", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + })) + }) + It(`Invoke CreateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model + loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) + loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") + + // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model + loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) + loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") + + // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerPolicyPrototype model + loadBalancerListenerPolicyPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyPrototype) + loadBalancerListenerPolicyPrototypeModel.Action = core.StringPtr("forward") + loadBalancerListenerPolicyPrototypeModel.Name = core.StringPtr("my-policy") + loadBalancerListenerPolicyPrototypeModel.Priority = core.Int64Ptr(int64(5)) + loadBalancerListenerPolicyPrototypeModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} + loadBalancerListenerPolicyPrototypeModel.Target = loadBalancerListenerPolicyTargetPrototypeModel + + // Construct an instance of the CreateLoadBalancerListenerOptions model + createLoadBalancerListenerOptionsModel := new(vpcv1.CreateLoadBalancerListenerOptions) + createLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerOptionsModel.Protocol = core.StringPtr("http") + createLoadBalancerListenerOptionsModel.AcceptProxyProtocol = core.BoolPtr(true) + createLoadBalancerListenerOptionsModel.CertificateInstance = certificateInstanceIdentityModel + createLoadBalancerListenerOptionsModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + createLoadBalancerListenerOptionsModel.DefaultPool = loadBalancerPoolIdentityModel + createLoadBalancerListenerOptionsModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel + createLoadBalancerListenerOptionsModel.Policies = []vpcv1.LoadBalancerListenerPolicyPrototype{*loadBalancerListenerPolicyPrototypeModel} + createLoadBalancerListenerOptionsModel.Port = core.Int64Ptr(int64(443)) + createLoadBalancerListenerOptionsModel.PortMax = core.Int64Ptr(int64(499)) + createLoadBalancerListenerOptionsModel.PortMin = core.Int64Ptr(int64(443)) + createLoadBalancerListenerOptionsModel.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.CreateLoadBalancerListenerWithContext(ctx, createLoadBalancerListenerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateLoadBalancerListener(createLoadBalancerListenerOptionsModel) + 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.CreateLoadBalancerListenerWithContext(ctx, createLoadBalancerListenerOptionsModel) + 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(createLoadBalancerListenerPath)) + 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{"testString"})) + 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", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + })) + }) + It(`Invoke CreateLoadBalancerListener 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.CreateLoadBalancerListener(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model + loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) + loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") + + // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model + loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) + loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") + + // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerPolicyPrototype model + loadBalancerListenerPolicyPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyPrototype) + loadBalancerListenerPolicyPrototypeModel.Action = core.StringPtr("forward") + loadBalancerListenerPolicyPrototypeModel.Name = core.StringPtr("my-policy") + loadBalancerListenerPolicyPrototypeModel.Priority = core.Int64Ptr(int64(5)) + loadBalancerListenerPolicyPrototypeModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} + loadBalancerListenerPolicyPrototypeModel.Target = loadBalancerListenerPolicyTargetPrototypeModel + + // Construct an instance of the CreateLoadBalancerListenerOptions model + createLoadBalancerListenerOptionsModel := new(vpcv1.CreateLoadBalancerListenerOptions) + createLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerOptionsModel.Protocol = core.StringPtr("http") + createLoadBalancerListenerOptionsModel.AcceptProxyProtocol = core.BoolPtr(true) + createLoadBalancerListenerOptionsModel.CertificateInstance = certificateInstanceIdentityModel + createLoadBalancerListenerOptionsModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + createLoadBalancerListenerOptionsModel.DefaultPool = loadBalancerPoolIdentityModel + createLoadBalancerListenerOptionsModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel + createLoadBalancerListenerOptionsModel.Policies = []vpcv1.LoadBalancerListenerPolicyPrototype{*loadBalancerListenerPolicyPrototypeModel} + createLoadBalancerListenerOptionsModel.Port = core.Int64Ptr(int64(443)) + createLoadBalancerListenerOptionsModel.PortMax = core.Int64Ptr(int64(499)) + createLoadBalancerListenerOptionsModel.PortMin = core.Int64Ptr(int64(443)) + createLoadBalancerListenerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateLoadBalancerListener(createLoadBalancerListenerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model + loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) + loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") + + // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model + loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) + loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") + + // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerPolicyPrototype model + loadBalancerListenerPolicyPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyPrototype) + loadBalancerListenerPolicyPrototypeModel.Action = core.StringPtr("forward") + loadBalancerListenerPolicyPrototypeModel.Name = core.StringPtr("my-policy") + loadBalancerListenerPolicyPrototypeModel.Priority = core.Int64Ptr(int64(5)) + loadBalancerListenerPolicyPrototypeModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} + loadBalancerListenerPolicyPrototypeModel.Target = loadBalancerListenerPolicyTargetPrototypeModel + + // Construct an instance of the CreateLoadBalancerListenerOptions model + createLoadBalancerListenerOptionsModel := new(vpcv1.CreateLoadBalancerListenerOptions) + createLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerOptionsModel.Protocol = core.StringPtr("http") + createLoadBalancerListenerOptionsModel.AcceptProxyProtocol = core.BoolPtr(true) + createLoadBalancerListenerOptionsModel.CertificateInstance = certificateInstanceIdentityModel + createLoadBalancerListenerOptionsModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + createLoadBalancerListenerOptionsModel.DefaultPool = loadBalancerPoolIdentityModel + createLoadBalancerListenerOptionsModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel + createLoadBalancerListenerOptionsModel.Policies = []vpcv1.LoadBalancerListenerPolicyPrototype{*loadBalancerListenerPolicyPrototypeModel} + createLoadBalancerListenerOptionsModel.Port = core.Int64Ptr(int64(443)) + createLoadBalancerListenerOptionsModel.PortMax = core.Int64Ptr(int64(499)) + createLoadBalancerListenerOptionsModel.PortMin = core.Int64Ptr(int64(443)) + createLoadBalancerListenerOptionsModel.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.CreateLoadBalancerListener(createLoadBalancerListenerOptionsModel) + 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 CreateLoadBalancerListenerOptions model with no property values + createLoadBalancerListenerOptionsModelNew := new(vpcv1.CreateLoadBalancerListenerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateLoadBalancerListener(createLoadBalancerListenerOptionsModelNew) + 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 CreateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model + loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) + loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") + + // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model + loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) + loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") + + // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerPolicyPrototype model + loadBalancerListenerPolicyPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyPrototype) + loadBalancerListenerPolicyPrototypeModel.Action = core.StringPtr("forward") + loadBalancerListenerPolicyPrototypeModel.Name = core.StringPtr("my-policy") + loadBalancerListenerPolicyPrototypeModel.Priority = core.Int64Ptr(int64(5)) + loadBalancerListenerPolicyPrototypeModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} + loadBalancerListenerPolicyPrototypeModel.Target = loadBalancerListenerPolicyTargetPrototypeModel + + // Construct an instance of the CreateLoadBalancerListenerOptions model + createLoadBalancerListenerOptionsModel := new(vpcv1.CreateLoadBalancerListenerOptions) + createLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerOptionsModel.Protocol = core.StringPtr("http") + createLoadBalancerListenerOptionsModel.AcceptProxyProtocol = core.BoolPtr(true) + createLoadBalancerListenerOptionsModel.CertificateInstance = certificateInstanceIdentityModel + createLoadBalancerListenerOptionsModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + createLoadBalancerListenerOptionsModel.DefaultPool = loadBalancerPoolIdentityModel + createLoadBalancerListenerOptionsModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel + createLoadBalancerListenerOptionsModel.Policies = []vpcv1.LoadBalancerListenerPolicyPrototype{*loadBalancerListenerPolicyPrototypeModel} + createLoadBalancerListenerOptionsModel.Port = core.Int64Ptr(int64(443)) + createLoadBalancerListenerOptionsModel.PortMax = core.Int64Ptr(int64(499)) + createLoadBalancerListenerOptionsModel.PortMin = core.Int64Ptr(int64(443)) + createLoadBalancerListenerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateLoadBalancerListener(createLoadBalancerListenerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteLoadBalancerListener(deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions)`, func() { + version := "testString" + deleteLoadBalancerListenerPath := "/load_balancers/testString/listeners/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(deleteLoadBalancerListenerPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteLoadBalancerListener 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.DeleteLoadBalancerListener(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteLoadBalancerListenerOptions model + deleteLoadBalancerListenerOptionsModel := new(vpcv1.DeleteLoadBalancerListenerOptions) + deleteLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + deleteLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") + deleteLoadBalancerListenerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteLoadBalancerListener(deleteLoadBalancerListenerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteLoadBalancerListener 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 DeleteLoadBalancerListenerOptions model + deleteLoadBalancerListenerOptionsModel := new(vpcv1.DeleteLoadBalancerListenerOptions) + deleteLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + deleteLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") + deleteLoadBalancerListenerOptionsModel.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.DeleteLoadBalancerListener(deleteLoadBalancerListenerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteLoadBalancerListenerOptions model with no property values + deleteLoadBalancerListenerOptionsModelNew := new(vpcv1.DeleteLoadBalancerListenerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteLoadBalancerListener(deleteLoadBalancerListenerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancerListener(getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) - Operation response error`, func() { + version := "testString" + getLoadBalancerListenerPath := "/load_balancers/testString/listeners/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(getLoadBalancerListenerPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetLoadBalancerListener 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 GetLoadBalancerListenerOptions model + getLoadBalancerListenerOptionsModel := new(vpcv1.GetLoadBalancerListenerOptions) + getLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerOptionsModel.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.GetLoadBalancerListener(getLoadBalancerListenerOptionsModel) + 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.GetLoadBalancerListener(getLoadBalancerListenerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancerListener(getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions)`, func() { + version := "testString" + getLoadBalancerListenerPath := "/load_balancers/testString/listeners/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(getLoadBalancerListenerPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + })) + }) + It(`Invoke GetLoadBalancerListener 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 GetLoadBalancerListenerOptions model + getLoadBalancerListenerOptionsModel := new(vpcv1.GetLoadBalancerListenerOptions) + getLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerOptionsModel.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.GetLoadBalancerListenerWithContext(ctx, getLoadBalancerListenerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetLoadBalancerListener(getLoadBalancerListenerOptionsModel) + 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.GetLoadBalancerListenerWithContext(ctx, getLoadBalancerListenerOptionsModel) + 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(getLoadBalancerListenerPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + })) + }) + It(`Invoke GetLoadBalancerListener 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.GetLoadBalancerListener(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetLoadBalancerListenerOptions model + getLoadBalancerListenerOptionsModel := new(vpcv1.GetLoadBalancerListenerOptions) + getLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetLoadBalancerListener(getLoadBalancerListenerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetLoadBalancerListener 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 GetLoadBalancerListenerOptions model + getLoadBalancerListenerOptionsModel := new(vpcv1.GetLoadBalancerListenerOptions) + getLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerOptionsModel.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.GetLoadBalancerListener(getLoadBalancerListenerOptionsModel) + 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 GetLoadBalancerListenerOptions model with no property values + getLoadBalancerListenerOptionsModelNew := new(vpcv1.GetLoadBalancerListenerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetLoadBalancerListener(getLoadBalancerListenerOptionsModelNew) + 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 GetLoadBalancerListener 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 GetLoadBalancerListenerOptions model + getLoadBalancerListenerOptionsModel := new(vpcv1.GetLoadBalancerListenerOptions) + getLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetLoadBalancerListener(getLoadBalancerListenerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateLoadBalancerListener(updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) - Operation response error`, func() { + version := "testString" + updateLoadBalancerListenerPath := "/load_balancers/testString/listeners/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(updateLoadBalancerListenerPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPatch model + loadBalancerListenerHTTPSRedirectPatchModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPatch) + loadBalancerListenerHTTPSRedirectPatchModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPatchModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPatchModel.URI = core.StringPtr("/example?doc=get") + + // Construct an instance of the LoadBalancerListenerPatch model + loadBalancerListenerPatchModel := new(vpcv1.LoadBalancerListenerPatch) + loadBalancerListenerPatchModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPatchModel.CertificateInstance = certificateInstanceIdentityModel + loadBalancerListenerPatchModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + loadBalancerListenerPatchModel.DefaultPool = loadBalancerPoolIdentityModel + loadBalancerListenerPatchModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPatchModel + loadBalancerListenerPatchModel.Port = core.Int64Ptr(int64(443)) + loadBalancerListenerPatchModel.PortMax = core.Int64Ptr(int64(499)) + loadBalancerListenerPatchModel.PortMin = core.Int64Ptr(int64(443)) + loadBalancerListenerPatchModel.Protocol = core.StringPtr("http") + loadBalancerListenerPatchModelAsPatch, asPatchErr := loadBalancerListenerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerOptions model + updateLoadBalancerListenerOptionsModel := new(vpcv1.UpdateLoadBalancerListenerOptions) + updateLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerOptionsModel.LoadBalancerListenerPatch = loadBalancerListenerPatchModelAsPatch + updateLoadBalancerListenerOptionsModel.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.UpdateLoadBalancerListener(updateLoadBalancerListenerOptionsModel) + 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.UpdateLoadBalancerListener(updateLoadBalancerListenerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateLoadBalancerListener(updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions)`, func() { + version := "testString" + updateLoadBalancerListenerPath := "/load_balancers/testString/listeners/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(updateLoadBalancerListenerPath)) + 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{"testString"})) + 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", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + })) + }) + It(`Invoke UpdateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPatch model + loadBalancerListenerHTTPSRedirectPatchModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPatch) + loadBalancerListenerHTTPSRedirectPatchModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPatchModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPatchModel.URI = core.StringPtr("/example?doc=get") + + // Construct an instance of the LoadBalancerListenerPatch model + loadBalancerListenerPatchModel := new(vpcv1.LoadBalancerListenerPatch) + loadBalancerListenerPatchModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPatchModel.CertificateInstance = certificateInstanceIdentityModel + loadBalancerListenerPatchModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + loadBalancerListenerPatchModel.DefaultPool = loadBalancerPoolIdentityModel + loadBalancerListenerPatchModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPatchModel + loadBalancerListenerPatchModel.Port = core.Int64Ptr(int64(443)) + loadBalancerListenerPatchModel.PortMax = core.Int64Ptr(int64(499)) + loadBalancerListenerPatchModel.PortMin = core.Int64Ptr(int64(443)) + loadBalancerListenerPatchModel.Protocol = core.StringPtr("http") + loadBalancerListenerPatchModelAsPatch, asPatchErr := loadBalancerListenerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerOptions model + updateLoadBalancerListenerOptionsModel := new(vpcv1.UpdateLoadBalancerListenerOptions) + updateLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerOptionsModel.LoadBalancerListenerPatch = loadBalancerListenerPatchModelAsPatch + updateLoadBalancerListenerOptionsModel.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.UpdateLoadBalancerListenerWithContext(ctx, updateLoadBalancerListenerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateLoadBalancerListener(updateLoadBalancerListenerOptionsModel) + 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.UpdateLoadBalancerListenerWithContext(ctx, updateLoadBalancerListenerOptionsModel) + 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(updateLoadBalancerListenerPath)) + 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{"testString"})) + 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", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + })) + }) + It(`Invoke UpdateLoadBalancerListener 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.UpdateLoadBalancerListener(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPatch model + loadBalancerListenerHTTPSRedirectPatchModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPatch) + loadBalancerListenerHTTPSRedirectPatchModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPatchModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPatchModel.URI = core.StringPtr("/example?doc=get") + + // Construct an instance of the LoadBalancerListenerPatch model + loadBalancerListenerPatchModel := new(vpcv1.LoadBalancerListenerPatch) + loadBalancerListenerPatchModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPatchModel.CertificateInstance = certificateInstanceIdentityModel + loadBalancerListenerPatchModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + loadBalancerListenerPatchModel.DefaultPool = loadBalancerPoolIdentityModel + loadBalancerListenerPatchModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPatchModel + loadBalancerListenerPatchModel.Port = core.Int64Ptr(int64(443)) + loadBalancerListenerPatchModel.PortMax = core.Int64Ptr(int64(499)) + loadBalancerListenerPatchModel.PortMin = core.Int64Ptr(int64(443)) + loadBalancerListenerPatchModel.Protocol = core.StringPtr("http") + loadBalancerListenerPatchModelAsPatch, asPatchErr := loadBalancerListenerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerOptions model + updateLoadBalancerListenerOptionsModel := new(vpcv1.UpdateLoadBalancerListenerOptions) + updateLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerOptionsModel.LoadBalancerListenerPatch = loadBalancerListenerPatchModelAsPatch + updateLoadBalancerListenerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateLoadBalancerListener(updateLoadBalancerListenerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPatch model + loadBalancerListenerHTTPSRedirectPatchModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPatch) + loadBalancerListenerHTTPSRedirectPatchModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPatchModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPatchModel.URI = core.StringPtr("/example?doc=get") + + // Construct an instance of the LoadBalancerListenerPatch model + loadBalancerListenerPatchModel := new(vpcv1.LoadBalancerListenerPatch) + loadBalancerListenerPatchModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPatchModel.CertificateInstance = certificateInstanceIdentityModel + loadBalancerListenerPatchModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + loadBalancerListenerPatchModel.DefaultPool = loadBalancerPoolIdentityModel + loadBalancerListenerPatchModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPatchModel + loadBalancerListenerPatchModel.Port = core.Int64Ptr(int64(443)) + loadBalancerListenerPatchModel.PortMax = core.Int64Ptr(int64(499)) + loadBalancerListenerPatchModel.PortMin = core.Int64Ptr(int64(443)) + loadBalancerListenerPatchModel.Protocol = core.StringPtr("http") + loadBalancerListenerPatchModelAsPatch, asPatchErr := loadBalancerListenerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerOptions model + updateLoadBalancerListenerOptionsModel := new(vpcv1.UpdateLoadBalancerListenerOptions) + updateLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerOptionsModel.LoadBalancerListenerPatch = loadBalancerListenerPatchModelAsPatch + updateLoadBalancerListenerOptionsModel.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.UpdateLoadBalancerListener(updateLoadBalancerListenerOptionsModel) + 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 UpdateLoadBalancerListenerOptions model with no property values + updateLoadBalancerListenerOptionsModelNew := new(vpcv1.UpdateLoadBalancerListenerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateLoadBalancerListener(updateLoadBalancerListenerOptionsModelNew) + 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 UpdateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPatch model + loadBalancerListenerHTTPSRedirectPatchModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPatch) + loadBalancerListenerHTTPSRedirectPatchModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPatchModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPatchModel.URI = core.StringPtr("/example?doc=get") + + // Construct an instance of the LoadBalancerListenerPatch model + loadBalancerListenerPatchModel := new(vpcv1.LoadBalancerListenerPatch) + loadBalancerListenerPatchModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPatchModel.CertificateInstance = certificateInstanceIdentityModel + loadBalancerListenerPatchModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + loadBalancerListenerPatchModel.DefaultPool = loadBalancerPoolIdentityModel + loadBalancerListenerPatchModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPatchModel + loadBalancerListenerPatchModel.Port = core.Int64Ptr(int64(443)) + loadBalancerListenerPatchModel.PortMax = core.Int64Ptr(int64(499)) + loadBalancerListenerPatchModel.PortMin = core.Int64Ptr(int64(443)) + loadBalancerListenerPatchModel.Protocol = core.StringPtr("http") + loadBalancerListenerPatchModelAsPatch, asPatchErr := loadBalancerListenerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerOptions model + updateLoadBalancerListenerOptionsModel := new(vpcv1.UpdateLoadBalancerListenerOptions) + updateLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerOptionsModel.LoadBalancerListenerPatch = loadBalancerListenerPatchModelAsPatch + updateLoadBalancerListenerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateLoadBalancerListener(updateLoadBalancerListenerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) - Operation response error`, func() { + version := "testString" + listLoadBalancerListenerPoliciesPath := "/load_balancers/testString/listeners/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(listLoadBalancerListenerPoliciesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListLoadBalancerListenerPolicies 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 ListLoadBalancerListenerPoliciesOptions model + listLoadBalancerListenerPoliciesOptionsModel := new(vpcv1.ListLoadBalancerListenerPoliciesOptions) + listLoadBalancerListenerPoliciesOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenerPoliciesOptionsModel.ListenerID = core.StringPtr("testString") + listLoadBalancerListenerPoliciesOptionsModel.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.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptionsModel) + 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.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions)`, func() { + version := "testString" + listLoadBalancerListenerPoliciesPath := "/load_balancers/testString/listeners/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(listLoadBalancerListenerPoliciesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"policies": [{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}]}`) + })) + }) + It(`Invoke ListLoadBalancerListenerPolicies 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 ListLoadBalancerListenerPoliciesOptions model + listLoadBalancerListenerPoliciesOptionsModel := new(vpcv1.ListLoadBalancerListenerPoliciesOptions) + listLoadBalancerListenerPoliciesOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenerPoliciesOptionsModel.ListenerID = core.StringPtr("testString") + listLoadBalancerListenerPoliciesOptionsModel.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.ListLoadBalancerListenerPoliciesWithContext(ctx, listLoadBalancerListenerPoliciesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptionsModel) + 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.ListLoadBalancerListenerPoliciesWithContext(ctx, listLoadBalancerListenerPoliciesOptionsModel) + 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(listLoadBalancerListenerPoliciesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"policies": [{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}]}`) + })) + }) + It(`Invoke ListLoadBalancerListenerPolicies 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.ListLoadBalancerListenerPolicies(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListLoadBalancerListenerPoliciesOptions model + listLoadBalancerListenerPoliciesOptionsModel := new(vpcv1.ListLoadBalancerListenerPoliciesOptions) + listLoadBalancerListenerPoliciesOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenerPoliciesOptionsModel.ListenerID = core.StringPtr("testString") + listLoadBalancerListenerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListLoadBalancerListenerPolicies 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 ListLoadBalancerListenerPoliciesOptions model + listLoadBalancerListenerPoliciesOptionsModel := new(vpcv1.ListLoadBalancerListenerPoliciesOptions) + listLoadBalancerListenerPoliciesOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenerPoliciesOptionsModel.ListenerID = core.StringPtr("testString") + listLoadBalancerListenerPoliciesOptionsModel.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.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptionsModel) + 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 ListLoadBalancerListenerPoliciesOptions model with no property values + listLoadBalancerListenerPoliciesOptionsModelNew := new(vpcv1.ListLoadBalancerListenerPoliciesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptionsModelNew) + 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 ListLoadBalancerListenerPolicies 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 ListLoadBalancerListenerPoliciesOptions model + listLoadBalancerListenerPoliciesOptionsModel := new(vpcv1.ListLoadBalancerListenerPoliciesOptions) + listLoadBalancerListenerPoliciesOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenerPoliciesOptionsModel.ListenerID = core.StringPtr("testString") + listLoadBalancerListenerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) - Operation response error`, func() { + version := "testString" + createLoadBalancerListenerPolicyPath := "/load_balancers/testString/listeners/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(createLoadBalancerListenerPolicyPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyRulePrototype model + loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) + loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") + + // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the CreateLoadBalancerListenerPolicyOptions model + createLoadBalancerListenerPolicyOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyOptions) + createLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyOptionsModel.Action = core.StringPtr("forward") + createLoadBalancerListenerPolicyOptionsModel.Priority = core.Int64Ptr(int64(5)) + createLoadBalancerListenerPolicyOptionsModel.Name = core.StringPtr("my-policy") + createLoadBalancerListenerPolicyOptionsModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} + createLoadBalancerListenerPolicyOptionsModel.Target = loadBalancerListenerPolicyTargetPrototypeModel + createLoadBalancerListenerPolicyOptionsModel.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.CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptionsModel) + 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.CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions)`, func() { + version := "testString" + createLoadBalancerListenerPolicyPath := "/load_balancers/testString/listeners/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(createLoadBalancerListenerPolicyPath)) + 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{"testString"})) + 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", `{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}`) + })) + }) + It(`Invoke CreateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyRulePrototype model + loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) + loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") + + // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the CreateLoadBalancerListenerPolicyOptions model + createLoadBalancerListenerPolicyOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyOptions) + createLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyOptionsModel.Action = core.StringPtr("forward") + createLoadBalancerListenerPolicyOptionsModel.Priority = core.Int64Ptr(int64(5)) + createLoadBalancerListenerPolicyOptionsModel.Name = core.StringPtr("my-policy") + createLoadBalancerListenerPolicyOptionsModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} + createLoadBalancerListenerPolicyOptionsModel.Target = loadBalancerListenerPolicyTargetPrototypeModel + createLoadBalancerListenerPolicyOptionsModel.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.CreateLoadBalancerListenerPolicyWithContext(ctx, createLoadBalancerListenerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptionsModel) + 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.CreateLoadBalancerListenerPolicyWithContext(ctx, createLoadBalancerListenerPolicyOptionsModel) + 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(createLoadBalancerListenerPolicyPath)) + 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{"testString"})) + 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", `{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}`) + })) + }) + It(`Invoke CreateLoadBalancerListenerPolicy 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.CreateLoadBalancerListenerPolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model + loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) + loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") + + // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the CreateLoadBalancerListenerPolicyOptions model + createLoadBalancerListenerPolicyOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyOptions) + createLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyOptionsModel.Action = core.StringPtr("forward") + createLoadBalancerListenerPolicyOptionsModel.Priority = core.Int64Ptr(int64(5)) + createLoadBalancerListenerPolicyOptionsModel.Name = core.StringPtr("my-policy") + createLoadBalancerListenerPolicyOptionsModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} + createLoadBalancerListenerPolicyOptionsModel.Target = loadBalancerListenerPolicyTargetPrototypeModel + createLoadBalancerListenerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyRulePrototype model + loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) + loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") + + // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the CreateLoadBalancerListenerPolicyOptions model + createLoadBalancerListenerPolicyOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyOptions) + createLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyOptionsModel.Action = core.StringPtr("forward") + createLoadBalancerListenerPolicyOptionsModel.Priority = core.Int64Ptr(int64(5)) + createLoadBalancerListenerPolicyOptionsModel.Name = core.StringPtr("my-policy") + createLoadBalancerListenerPolicyOptionsModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} + createLoadBalancerListenerPolicyOptionsModel.Target = loadBalancerListenerPolicyTargetPrototypeModel + createLoadBalancerListenerPolicyOptionsModel.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.CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptionsModel) + 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 CreateLoadBalancerListenerPolicyOptions model with no property values + createLoadBalancerListenerPolicyOptionsModelNew := new(vpcv1.CreateLoadBalancerListenerPolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptionsModelNew) + 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 CreateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyRulePrototype model + loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) + loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") + + // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the CreateLoadBalancerListenerPolicyOptions model + createLoadBalancerListenerPolicyOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyOptions) + createLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyOptionsModel.Action = core.StringPtr("forward") + createLoadBalancerListenerPolicyOptionsModel.Priority = core.Int64Ptr(int64(5)) + createLoadBalancerListenerPolicyOptionsModel.Name = core.StringPtr("my-policy") + createLoadBalancerListenerPolicyOptionsModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} + createLoadBalancerListenerPolicyOptionsModel.Target = loadBalancerListenerPolicyTargetPrototypeModel + createLoadBalancerListenerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions)`, func() { + version := "testString" + deleteLoadBalancerListenerPolicyPath := "/load_balancers/testString/listeners/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(deleteLoadBalancerListenerPolicyPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteLoadBalancerListenerPolicy 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.DeleteLoadBalancerListenerPolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteLoadBalancerListenerPolicyOptions model + deleteLoadBalancerListenerPolicyOptionsModel := new(vpcv1.DeleteLoadBalancerListenerPolicyOptions) + deleteLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + deleteLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + deleteLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") + deleteLoadBalancerListenerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteLoadBalancerListenerPolicy 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 DeleteLoadBalancerListenerPolicyOptions model + deleteLoadBalancerListenerPolicyOptionsModel := new(vpcv1.DeleteLoadBalancerListenerPolicyOptions) + deleteLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + deleteLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + deleteLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") + deleteLoadBalancerListenerPolicyOptionsModel.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.DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteLoadBalancerListenerPolicyOptions model with no property values + deleteLoadBalancerListenerPolicyOptionsModelNew := new(vpcv1.DeleteLoadBalancerListenerPolicyOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) - Operation response error`, func() { + version := "testString" + getLoadBalancerListenerPolicyPath := "/load_balancers/testString/listeners/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(getLoadBalancerListenerPolicyPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetLoadBalancerListenerPolicy 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 GetLoadBalancerListenerPolicyOptions model + getLoadBalancerListenerPolicyOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyOptions) + getLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.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.GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptionsModel) + 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.GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions)`, func() { + version := "testString" + getLoadBalancerListenerPolicyPath := "/load_balancers/testString/listeners/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(getLoadBalancerListenerPolicyPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}`) + })) + }) + It(`Invoke GetLoadBalancerListenerPolicy 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 GetLoadBalancerListenerPolicyOptions model + getLoadBalancerListenerPolicyOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyOptions) + getLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.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.GetLoadBalancerListenerPolicyWithContext(ctx, getLoadBalancerListenerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptionsModel) + 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.GetLoadBalancerListenerPolicyWithContext(ctx, getLoadBalancerListenerPolicyOptionsModel) + 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(getLoadBalancerListenerPolicyPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}`) + })) + }) + It(`Invoke GetLoadBalancerListenerPolicy 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.GetLoadBalancerListenerPolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetLoadBalancerListenerPolicyOptions model + getLoadBalancerListenerPolicyOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyOptions) + getLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetLoadBalancerListenerPolicy 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 GetLoadBalancerListenerPolicyOptions model + getLoadBalancerListenerPolicyOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyOptions) + getLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.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.GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptionsModel) + 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 GetLoadBalancerListenerPolicyOptions model with no property values + getLoadBalancerListenerPolicyOptionsModelNew := new(vpcv1.GetLoadBalancerListenerPolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptionsModelNew) + 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 GetLoadBalancerListenerPolicy 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 GetLoadBalancerListenerPolicyOptions model + getLoadBalancerListenerPolicyOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyOptions) + getLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) - Operation response error`, func() { + version := "testString" + updateLoadBalancerListenerPolicyPath := "/load_balancers/testString/listeners/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(updateLoadBalancerListenerPolicyPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPatchModel := new(vpcv1.LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPatchModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerPolicyPatch model + loadBalancerListenerPolicyPatchModel := new(vpcv1.LoadBalancerListenerPolicyPatch) + loadBalancerListenerPolicyPatchModel.Name = core.StringPtr("my-policy") + loadBalancerListenerPolicyPatchModel.Priority = core.Int64Ptr(int64(5)) + loadBalancerListenerPolicyPatchModel.Target = loadBalancerListenerPolicyTargetPatchModel + loadBalancerListenerPolicyPatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerPolicyOptions model + updateLoadBalancerListenerPolicyOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyOptions) + updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatchModelAsPatch + updateLoadBalancerListenerPolicyOptionsModel.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.UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptionsModel) + 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.UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions)`, func() { + version := "testString" + updateLoadBalancerListenerPolicyPath := "/load_balancers/testString/listeners/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(updateLoadBalancerListenerPolicyPath)) + 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{"testString"})) + 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", `{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}`) + })) + }) + It(`Invoke UpdateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPatchModel := new(vpcv1.LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPatchModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerPolicyPatch model + loadBalancerListenerPolicyPatchModel := new(vpcv1.LoadBalancerListenerPolicyPatch) + loadBalancerListenerPolicyPatchModel.Name = core.StringPtr("my-policy") + loadBalancerListenerPolicyPatchModel.Priority = core.Int64Ptr(int64(5)) + loadBalancerListenerPolicyPatchModel.Target = loadBalancerListenerPolicyTargetPatchModel + loadBalancerListenerPolicyPatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerPolicyOptions model + updateLoadBalancerListenerPolicyOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyOptions) + updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatchModelAsPatch + updateLoadBalancerListenerPolicyOptionsModel.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.UpdateLoadBalancerListenerPolicyWithContext(ctx, updateLoadBalancerListenerPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptionsModel) + 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.UpdateLoadBalancerListenerPolicyWithContext(ctx, updateLoadBalancerListenerPolicyOptionsModel) + 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(updateLoadBalancerListenerPolicyPath)) + 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{"testString"})) + 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", `{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}`) + })) + }) + It(`Invoke UpdateLoadBalancerListenerPolicy 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.UpdateLoadBalancerListenerPolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPatchModel := new(vpcv1.LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPatchModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerPolicyPatch model + loadBalancerListenerPolicyPatchModel := new(vpcv1.LoadBalancerListenerPolicyPatch) + loadBalancerListenerPolicyPatchModel.Name = core.StringPtr("my-policy") + loadBalancerListenerPolicyPatchModel.Priority = core.Int64Ptr(int64(5)) + loadBalancerListenerPolicyPatchModel.Target = loadBalancerListenerPolicyTargetPatchModel + loadBalancerListenerPolicyPatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerPolicyOptions model + updateLoadBalancerListenerPolicyOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyOptions) + updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatchModelAsPatch + updateLoadBalancerListenerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPatchModel := new(vpcv1.LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPatchModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerPolicyPatch model + loadBalancerListenerPolicyPatchModel := new(vpcv1.LoadBalancerListenerPolicyPatch) + loadBalancerListenerPolicyPatchModel.Name = core.StringPtr("my-policy") + loadBalancerListenerPolicyPatchModel.Priority = core.Int64Ptr(int64(5)) + loadBalancerListenerPolicyPatchModel.Target = loadBalancerListenerPolicyTargetPatchModel + loadBalancerListenerPolicyPatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerPolicyOptions model + updateLoadBalancerListenerPolicyOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyOptions) + updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatchModelAsPatch + updateLoadBalancerListenerPolicyOptionsModel.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.UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptionsModel) + 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 UpdateLoadBalancerListenerPolicyOptions model with no property values + updateLoadBalancerListenerPolicyOptionsModelNew := new(vpcv1.UpdateLoadBalancerListenerPolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptionsModelNew) + 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 UpdateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPatchModel := new(vpcv1.LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + loadBalancerListenerPolicyTargetPatchModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerPolicyPatch model + loadBalancerListenerPolicyPatchModel := new(vpcv1.LoadBalancerListenerPolicyPatch) + loadBalancerListenerPolicyPatchModel.Name = core.StringPtr("my-policy") + loadBalancerListenerPolicyPatchModel.Priority = core.Int64Ptr(int64(5)) + loadBalancerListenerPolicyPatchModel.Target = loadBalancerListenerPolicyTargetPatchModel + loadBalancerListenerPolicyPatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerPolicyOptions model + updateLoadBalancerListenerPolicyOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyOptions) + updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatchModelAsPatch + updateLoadBalancerListenerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) - Operation response error`, func() { + version := "testString" + listLoadBalancerListenerPolicyRulesPath := "/load_balancers/testString/listeners/testString/policies/testString/rules" + 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(listLoadBalancerListenerPolicyRulesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListLoadBalancerListenerPolicyRules 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 ListLoadBalancerListenerPolicyRulesOptions model + listLoadBalancerListenerPolicyRulesOptionsModel := new(vpcv1.ListLoadBalancerListenerPolicyRulesOptions) + listLoadBalancerListenerPolicyRulesOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.ListenerID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.PolicyID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.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.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptionsModel) + 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.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions)`, func() { + version := "testString" + listLoadBalancerListenerPolicyRulesPath := "/load_balancers/testString/listeners/testString/policies/testString/rules" + 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(listLoadBalancerListenerPolicyRulesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"rules": [{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}]}`) + })) + }) + It(`Invoke ListLoadBalancerListenerPolicyRules 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 ListLoadBalancerListenerPolicyRulesOptions model + listLoadBalancerListenerPolicyRulesOptionsModel := new(vpcv1.ListLoadBalancerListenerPolicyRulesOptions) + listLoadBalancerListenerPolicyRulesOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.ListenerID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.PolicyID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.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.ListLoadBalancerListenerPolicyRulesWithContext(ctx, listLoadBalancerListenerPolicyRulesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptionsModel) + 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.ListLoadBalancerListenerPolicyRulesWithContext(ctx, listLoadBalancerListenerPolicyRulesOptionsModel) + 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(listLoadBalancerListenerPolicyRulesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"rules": [{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}]}`) + })) + }) + It(`Invoke ListLoadBalancerListenerPolicyRules 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.ListLoadBalancerListenerPolicyRules(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListLoadBalancerListenerPolicyRulesOptions model + listLoadBalancerListenerPolicyRulesOptionsModel := new(vpcv1.ListLoadBalancerListenerPolicyRulesOptions) + listLoadBalancerListenerPolicyRulesOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.ListenerID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.PolicyID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListLoadBalancerListenerPolicyRules 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 ListLoadBalancerListenerPolicyRulesOptions model + listLoadBalancerListenerPolicyRulesOptionsModel := new(vpcv1.ListLoadBalancerListenerPolicyRulesOptions) + listLoadBalancerListenerPolicyRulesOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.ListenerID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.PolicyID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.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.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptionsModel) + 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 ListLoadBalancerListenerPolicyRulesOptions model with no property values + listLoadBalancerListenerPolicyRulesOptionsModelNew := new(vpcv1.ListLoadBalancerListenerPolicyRulesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptionsModelNew) + 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 ListLoadBalancerListenerPolicyRules 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 ListLoadBalancerListenerPolicyRulesOptions model + listLoadBalancerListenerPolicyRulesOptionsModel := new(vpcv1.ListLoadBalancerListenerPolicyRulesOptions) + listLoadBalancerListenerPolicyRulesOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.ListenerID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.PolicyID = core.StringPtr("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) - Operation response error`, func() { + version := "testString" + createLoadBalancerListenerPolicyRulePath := "/load_balancers/testString/listeners/testString/policies/testString/rules" + 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(createLoadBalancerListenerPolicyRulePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateLoadBalancerListenerPolicyRule 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 CreateLoadBalancerListenerPolicyRuleOptions model + createLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyRuleOptions) + createLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.Condition = core.StringPtr("contains") + createLoadBalancerListenerPolicyRuleOptionsModel.Type = core.StringPtr("body") + createLoadBalancerListenerPolicyRuleOptionsModel.Value = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.Field = core.StringPtr("MY-APP-HEADER") + createLoadBalancerListenerPolicyRuleOptionsModel.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.CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptionsModel) + 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.CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions)`, func() { + version := "testString" + createLoadBalancerListenerPolicyRulePath := "/load_balancers/testString/listeners/testString/policies/testString/rules" + 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(createLoadBalancerListenerPolicyRulePath)) + 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{"testString"})) + 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", `{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}`) + })) + }) + It(`Invoke CreateLoadBalancerListenerPolicyRule 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 CreateLoadBalancerListenerPolicyRuleOptions model + createLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyRuleOptions) + createLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.Condition = core.StringPtr("contains") + createLoadBalancerListenerPolicyRuleOptionsModel.Type = core.StringPtr("body") + createLoadBalancerListenerPolicyRuleOptionsModel.Value = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.Field = core.StringPtr("MY-APP-HEADER") + createLoadBalancerListenerPolicyRuleOptionsModel.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.CreateLoadBalancerListenerPolicyRuleWithContext(ctx, createLoadBalancerListenerPolicyRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptionsModel) + 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.CreateLoadBalancerListenerPolicyRuleWithContext(ctx, createLoadBalancerListenerPolicyRuleOptionsModel) + 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(createLoadBalancerListenerPolicyRulePath)) + 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{"testString"})) + 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", `{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}`) + })) + }) + It(`Invoke CreateLoadBalancerListenerPolicyRule 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.CreateLoadBalancerListenerPolicyRule(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the CreateLoadBalancerListenerPolicyRuleOptions model + createLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyRuleOptions) + createLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.Condition = core.StringPtr("contains") + createLoadBalancerListenerPolicyRuleOptionsModel.Type = core.StringPtr("body") + createLoadBalancerListenerPolicyRuleOptionsModel.Value = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.Field = core.StringPtr("MY-APP-HEADER") + createLoadBalancerListenerPolicyRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateLoadBalancerListenerPolicyRule 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 CreateLoadBalancerListenerPolicyRuleOptions model + createLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyRuleOptions) + createLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.Condition = core.StringPtr("contains") + createLoadBalancerListenerPolicyRuleOptionsModel.Type = core.StringPtr("body") + createLoadBalancerListenerPolicyRuleOptionsModel.Value = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.Field = core.StringPtr("MY-APP-HEADER") + createLoadBalancerListenerPolicyRuleOptionsModel.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.CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptionsModel) + 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 CreateLoadBalancerListenerPolicyRuleOptions model with no property values + createLoadBalancerListenerPolicyRuleOptionsModelNew := new(vpcv1.CreateLoadBalancerListenerPolicyRuleOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptionsModelNew) + 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 CreateLoadBalancerListenerPolicyRule 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 CreateLoadBalancerListenerPolicyRuleOptions model + createLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyRuleOptions) + createLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.Condition = core.StringPtr("contains") + createLoadBalancerListenerPolicyRuleOptionsModel.Type = core.StringPtr("body") + createLoadBalancerListenerPolicyRuleOptionsModel.Value = core.StringPtr("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.Field = core.StringPtr("MY-APP-HEADER") + createLoadBalancerListenerPolicyRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions)`, func() { + version := "testString" + deleteLoadBalancerListenerPolicyRulePath := "/load_balancers/testString/listeners/testString/policies/testString/rules/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(deleteLoadBalancerListenerPolicyRulePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteLoadBalancerListenerPolicyRule 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.DeleteLoadBalancerListenerPolicyRule(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteLoadBalancerListenerPolicyRuleOptions model + deleteLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.DeleteLoadBalancerListenerPolicyRuleOptions) + deleteLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + deleteLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + deleteLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + deleteLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") + deleteLoadBalancerListenerPolicyRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteLoadBalancerListenerPolicyRule 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 DeleteLoadBalancerListenerPolicyRuleOptions model + deleteLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.DeleteLoadBalancerListenerPolicyRuleOptions) + deleteLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + deleteLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + deleteLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + deleteLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") + deleteLoadBalancerListenerPolicyRuleOptionsModel.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.DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteLoadBalancerListenerPolicyRuleOptions model with no property values + deleteLoadBalancerListenerPolicyRuleOptionsModelNew := new(vpcv1.DeleteLoadBalancerListenerPolicyRuleOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) - Operation response error`, func() { + version := "testString" + getLoadBalancerListenerPolicyRulePath := "/load_balancers/testString/listeners/testString/policies/testString/rules/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(getLoadBalancerListenerPolicyRulePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetLoadBalancerListenerPolicyRule 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 GetLoadBalancerListenerPolicyRuleOptions model + getLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyRuleOptions) + getLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.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.GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptionsModel) + 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.GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions)`, func() { + version := "testString" + getLoadBalancerListenerPolicyRulePath := "/load_balancers/testString/listeners/testString/policies/testString/rules/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(getLoadBalancerListenerPolicyRulePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}`) + })) + }) + It(`Invoke GetLoadBalancerListenerPolicyRule 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 GetLoadBalancerListenerPolicyRuleOptions model + getLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyRuleOptions) + getLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.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.GetLoadBalancerListenerPolicyRuleWithContext(ctx, getLoadBalancerListenerPolicyRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptionsModel) + 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.GetLoadBalancerListenerPolicyRuleWithContext(ctx, getLoadBalancerListenerPolicyRuleOptionsModel) + 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(getLoadBalancerListenerPolicyRulePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}`) + })) + }) + It(`Invoke GetLoadBalancerListenerPolicyRule 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.GetLoadBalancerListenerPolicyRule(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetLoadBalancerListenerPolicyRuleOptions model + getLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyRuleOptions) + getLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetLoadBalancerListenerPolicyRule 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 GetLoadBalancerListenerPolicyRuleOptions model + getLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyRuleOptions) + getLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.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.GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptionsModel) + 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 GetLoadBalancerListenerPolicyRuleOptions model with no property values + getLoadBalancerListenerPolicyRuleOptionsModelNew := new(vpcv1.GetLoadBalancerListenerPolicyRuleOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptionsModelNew) + 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 GetLoadBalancerListenerPolicyRule 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 GetLoadBalancerListenerPolicyRuleOptions model + getLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyRuleOptions) + getLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) - Operation response error`, func() { + version := "testString" + updateLoadBalancerListenerPolicyRulePath := "/load_balancers/testString/listeners/testString/policies/testString/rules/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(updateLoadBalancerListenerPolicyRulePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateLoadBalancerListenerPolicyRule 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 LoadBalancerListenerPolicyRulePatch model + loadBalancerListenerPolicyRulePatchModel := new(vpcv1.LoadBalancerListenerPolicyRulePatch) + loadBalancerListenerPolicyRulePatchModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePatchModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePatchModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePatchModel.Value = core.StringPtr("testString") + loadBalancerListenerPolicyRulePatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerPolicyRuleOptions model + updateLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyRuleOptions) + updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatchModelAsPatch + updateLoadBalancerListenerPolicyRuleOptionsModel.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.UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptionsModel) + 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.UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions)`, func() { + version := "testString" + updateLoadBalancerListenerPolicyRulePath := "/load_balancers/testString/listeners/testString/policies/testString/rules/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(updateLoadBalancerListenerPolicyRulePath)) + 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{"testString"})) + 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", `{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}`) + })) + }) + It(`Invoke UpdateLoadBalancerListenerPolicyRule 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 LoadBalancerListenerPolicyRulePatch model + loadBalancerListenerPolicyRulePatchModel := new(vpcv1.LoadBalancerListenerPolicyRulePatch) + loadBalancerListenerPolicyRulePatchModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePatchModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePatchModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePatchModel.Value = core.StringPtr("testString") + loadBalancerListenerPolicyRulePatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerPolicyRuleOptions model + updateLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyRuleOptions) + updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatchModelAsPatch + updateLoadBalancerListenerPolicyRuleOptionsModel.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.UpdateLoadBalancerListenerPolicyRuleWithContext(ctx, updateLoadBalancerListenerPolicyRuleOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptionsModel) + 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.UpdateLoadBalancerListenerPolicyRuleWithContext(ctx, updateLoadBalancerListenerPolicyRuleOptionsModel) + 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(updateLoadBalancerListenerPolicyRulePath)) + 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{"testString"})) + 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", `{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}`) + })) + }) + It(`Invoke UpdateLoadBalancerListenerPolicyRule 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.UpdateLoadBalancerListenerPolicyRule(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the LoadBalancerListenerPolicyRulePatch model + loadBalancerListenerPolicyRulePatchModel := new(vpcv1.LoadBalancerListenerPolicyRulePatch) + loadBalancerListenerPolicyRulePatchModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePatchModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePatchModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePatchModel.Value = core.StringPtr("testString") + loadBalancerListenerPolicyRulePatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerPolicyRuleOptions model + updateLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyRuleOptions) + updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatchModelAsPatch + updateLoadBalancerListenerPolicyRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateLoadBalancerListenerPolicyRule 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 LoadBalancerListenerPolicyRulePatch model + loadBalancerListenerPolicyRulePatchModel := new(vpcv1.LoadBalancerListenerPolicyRulePatch) + loadBalancerListenerPolicyRulePatchModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePatchModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePatchModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePatchModel.Value = core.StringPtr("testString") + loadBalancerListenerPolicyRulePatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerPolicyRuleOptions model + updateLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyRuleOptions) + updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatchModelAsPatch + updateLoadBalancerListenerPolicyRuleOptionsModel.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.UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptionsModel) + 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 UpdateLoadBalancerListenerPolicyRuleOptions model with no property values + updateLoadBalancerListenerPolicyRuleOptionsModelNew := new(vpcv1.UpdateLoadBalancerListenerPolicyRuleOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptionsModelNew) + 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 UpdateLoadBalancerListenerPolicyRule 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 LoadBalancerListenerPolicyRulePatch model + loadBalancerListenerPolicyRulePatchModel := new(vpcv1.LoadBalancerListenerPolicyRulePatch) + loadBalancerListenerPolicyRulePatchModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePatchModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePatchModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePatchModel.Value = core.StringPtr("testString") + loadBalancerListenerPolicyRulePatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyRulePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerListenerPolicyRuleOptions model + updateLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyRuleOptions) + updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatchModelAsPatch + updateLoadBalancerListenerPolicyRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) - Operation response error`, func() { + version := "testString" + listLoadBalancerPoolsPath := "/load_balancers/testString/pools" + 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(listLoadBalancerPoolsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListLoadBalancerPools 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 ListLoadBalancerPoolsOptions model + listLoadBalancerPoolsOptionsModel := new(vpcv1.ListLoadBalancerPoolsOptions) + listLoadBalancerPoolsOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerPoolsOptionsModel.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.ListLoadBalancerPools(listLoadBalancerPoolsOptionsModel) + 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.ListLoadBalancerPools(listLoadBalancerPoolsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions)`, func() { + version := "testString" + listLoadBalancerPoolsPath := "/load_balancers/testString/pools" + 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(listLoadBalancerPoolsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/123456::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() { + 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 ListLoadBalancerPoolsOptions model + listLoadBalancerPoolsOptionsModel := new(vpcv1.ListLoadBalancerPoolsOptions) + listLoadBalancerPoolsOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerPoolsOptionsModel.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.ListLoadBalancerPoolsWithContext(ctx, listLoadBalancerPoolsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListLoadBalancerPools(listLoadBalancerPoolsOptionsModel) + 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.ListLoadBalancerPoolsWithContext(ctx, listLoadBalancerPoolsOptionsModel) + 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(listLoadBalancerPoolsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/123456::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() { + 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.ListLoadBalancerPools(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListLoadBalancerPoolsOptions model + listLoadBalancerPoolsOptionsModel := new(vpcv1.ListLoadBalancerPoolsOptions) + listLoadBalancerPoolsOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerPoolsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListLoadBalancerPools(listLoadBalancerPoolsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListLoadBalancerPools 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 ListLoadBalancerPoolsOptions model + listLoadBalancerPoolsOptionsModel := new(vpcv1.ListLoadBalancerPoolsOptions) + listLoadBalancerPoolsOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerPoolsOptionsModel.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.ListLoadBalancerPools(listLoadBalancerPoolsOptionsModel) + 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 ListLoadBalancerPoolsOptions model with no property values + listLoadBalancerPoolsOptionsModelNew := new(vpcv1.ListLoadBalancerPoolsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListLoadBalancerPools(listLoadBalancerPoolsOptionsModelNew) + 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 ListLoadBalancerPools 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 ListLoadBalancerPoolsOptions model + listLoadBalancerPoolsOptionsModel := new(vpcv1.ListLoadBalancerPoolsOptions) + listLoadBalancerPoolsOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerPoolsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListLoadBalancerPools(listLoadBalancerPoolsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateLoadBalancerPool(createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) - Operation response error`, func() { + version := "testString" + createLoadBalancerPoolPath := "/load_balancers/testString/pools" + 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(createLoadBalancerPoolPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateLoadBalancerPool 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 LoadBalancerPoolHealthMonitorPrototype model + loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) + loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model + loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) + loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the CreateLoadBalancerPoolOptions model + createLoadBalancerPoolOptionsModel := new(vpcv1.CreateLoadBalancerPoolOptions) + createLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerPoolOptionsModel.Algorithm = core.StringPtr("least_connections") + createLoadBalancerPoolOptionsModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel + createLoadBalancerPoolOptionsModel.Protocol = core.StringPtr("http") + createLoadBalancerPoolOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + createLoadBalancerPoolOptionsModel.Name = core.StringPtr("my-load-balancer-pool") + createLoadBalancerPoolOptionsModel.ProxyProtocol = core.StringPtr("disabled") + createLoadBalancerPoolOptionsModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel + createLoadBalancerPoolOptionsModel.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.CreateLoadBalancerPool(createLoadBalancerPoolOptionsModel) + 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.CreateLoadBalancerPool(createLoadBalancerPoolOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateLoadBalancerPool(createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions)`, func() { + version := "testString" + createLoadBalancerPoolPath := "/load_balancers/testString/pools" + 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(createLoadBalancerPoolPath)) + 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{"testString"})) + 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", `{"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/123456::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() { + 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 LoadBalancerPoolHealthMonitorPrototype model + loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) + loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model + loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) + loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the CreateLoadBalancerPoolOptions model + createLoadBalancerPoolOptionsModel := new(vpcv1.CreateLoadBalancerPoolOptions) + createLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerPoolOptionsModel.Algorithm = core.StringPtr("least_connections") + createLoadBalancerPoolOptionsModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel + createLoadBalancerPoolOptionsModel.Protocol = core.StringPtr("http") + createLoadBalancerPoolOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + createLoadBalancerPoolOptionsModel.Name = core.StringPtr("my-load-balancer-pool") + createLoadBalancerPoolOptionsModel.ProxyProtocol = core.StringPtr("disabled") + createLoadBalancerPoolOptionsModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel + createLoadBalancerPoolOptionsModel.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.CreateLoadBalancerPoolWithContext(ctx, createLoadBalancerPoolOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateLoadBalancerPool(createLoadBalancerPoolOptionsModel) + 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.CreateLoadBalancerPoolWithContext(ctx, createLoadBalancerPoolOptionsModel) + 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(createLoadBalancerPoolPath)) + 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{"testString"})) + 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", `{"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/123456::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() { + 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.CreateLoadBalancerPool(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model + loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) + loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model + loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) + loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the CreateLoadBalancerPoolOptions model + createLoadBalancerPoolOptionsModel := new(vpcv1.CreateLoadBalancerPoolOptions) + createLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerPoolOptionsModel.Algorithm = core.StringPtr("least_connections") + createLoadBalancerPoolOptionsModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel + createLoadBalancerPoolOptionsModel.Protocol = core.StringPtr("http") + createLoadBalancerPoolOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + createLoadBalancerPoolOptionsModel.Name = core.StringPtr("my-load-balancer-pool") + createLoadBalancerPoolOptionsModel.ProxyProtocol = core.StringPtr("disabled") + createLoadBalancerPoolOptionsModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel + createLoadBalancerPoolOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateLoadBalancerPool(createLoadBalancerPoolOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateLoadBalancerPool 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 LoadBalancerPoolHealthMonitorPrototype model + loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) + loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model + loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) + loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the CreateLoadBalancerPoolOptions model + createLoadBalancerPoolOptionsModel := new(vpcv1.CreateLoadBalancerPoolOptions) + createLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerPoolOptionsModel.Algorithm = core.StringPtr("least_connections") + createLoadBalancerPoolOptionsModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel + createLoadBalancerPoolOptionsModel.Protocol = core.StringPtr("http") + createLoadBalancerPoolOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + createLoadBalancerPoolOptionsModel.Name = core.StringPtr("my-load-balancer-pool") + createLoadBalancerPoolOptionsModel.ProxyProtocol = core.StringPtr("disabled") + createLoadBalancerPoolOptionsModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel + createLoadBalancerPoolOptionsModel.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.CreateLoadBalancerPool(createLoadBalancerPoolOptionsModel) + 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 CreateLoadBalancerPoolOptions model with no property values + createLoadBalancerPoolOptionsModelNew := new(vpcv1.CreateLoadBalancerPoolOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateLoadBalancerPool(createLoadBalancerPoolOptionsModelNew) + 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 CreateLoadBalancerPool 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 LoadBalancerPoolHealthMonitorPrototype model + loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) + loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model + loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) + loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the CreateLoadBalancerPoolOptions model + createLoadBalancerPoolOptionsModel := new(vpcv1.CreateLoadBalancerPoolOptions) + createLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerPoolOptionsModel.Algorithm = core.StringPtr("least_connections") + createLoadBalancerPoolOptionsModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel + createLoadBalancerPoolOptionsModel.Protocol = core.StringPtr("http") + createLoadBalancerPoolOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + createLoadBalancerPoolOptionsModel.Name = core.StringPtr("my-load-balancer-pool") + createLoadBalancerPoolOptionsModel.ProxyProtocol = core.StringPtr("disabled") + createLoadBalancerPoolOptionsModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel + createLoadBalancerPoolOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateLoadBalancerPool(createLoadBalancerPoolOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteLoadBalancerPool(deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions)`, func() { + version := "testString" + deleteLoadBalancerPoolPath := "/load_balancers/testString/pools/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(deleteLoadBalancerPoolPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteLoadBalancerPool 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.DeleteLoadBalancerPool(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteLoadBalancerPoolOptions model + deleteLoadBalancerPoolOptionsModel := new(vpcv1.DeleteLoadBalancerPoolOptions) + deleteLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + deleteLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") + deleteLoadBalancerPoolOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteLoadBalancerPool(deleteLoadBalancerPoolOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteLoadBalancerPool 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 DeleteLoadBalancerPoolOptions model + deleteLoadBalancerPoolOptionsModel := new(vpcv1.DeleteLoadBalancerPoolOptions) + deleteLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + deleteLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") + deleteLoadBalancerPoolOptionsModel.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.DeleteLoadBalancerPool(deleteLoadBalancerPoolOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteLoadBalancerPoolOptions model with no property values + deleteLoadBalancerPoolOptionsModelNew := new(vpcv1.DeleteLoadBalancerPoolOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteLoadBalancerPool(deleteLoadBalancerPoolOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancerPool(getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) - Operation response error`, func() { + version := "testString" + getLoadBalancerPoolPath := "/load_balancers/testString/pools/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(getLoadBalancerPoolPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetLoadBalancerPool 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 GetLoadBalancerPoolOptions model + getLoadBalancerPoolOptionsModel := new(vpcv1.GetLoadBalancerPoolOptions) + getLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerPoolOptionsModel.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.GetLoadBalancerPool(getLoadBalancerPoolOptionsModel) + 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.GetLoadBalancerPool(getLoadBalancerPoolOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancerPool(getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions)`, func() { + version := "testString" + getLoadBalancerPoolPath := "/load_balancers/testString/pools/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(getLoadBalancerPoolPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/123456::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() { + 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 GetLoadBalancerPoolOptions model + getLoadBalancerPoolOptionsModel := new(vpcv1.GetLoadBalancerPoolOptions) + getLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerPoolOptionsModel.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.GetLoadBalancerPoolWithContext(ctx, getLoadBalancerPoolOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetLoadBalancerPool(getLoadBalancerPoolOptionsModel) + 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.GetLoadBalancerPoolWithContext(ctx, getLoadBalancerPoolOptionsModel) + 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(getLoadBalancerPoolPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/123456::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() { + 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.GetLoadBalancerPool(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetLoadBalancerPoolOptions model + getLoadBalancerPoolOptionsModel := new(vpcv1.GetLoadBalancerPoolOptions) + getLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerPoolOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetLoadBalancerPool(getLoadBalancerPoolOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetLoadBalancerPool 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 GetLoadBalancerPoolOptions model + getLoadBalancerPoolOptionsModel := new(vpcv1.GetLoadBalancerPoolOptions) + getLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerPoolOptionsModel.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.GetLoadBalancerPool(getLoadBalancerPoolOptionsModel) + 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 GetLoadBalancerPoolOptions model with no property values + getLoadBalancerPoolOptionsModelNew := new(vpcv1.GetLoadBalancerPoolOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetLoadBalancerPool(getLoadBalancerPoolOptionsModelNew) + 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 GetLoadBalancerPool 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 GetLoadBalancerPoolOptions model + getLoadBalancerPoolOptionsModel := new(vpcv1.GetLoadBalancerPoolOptions) + getLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerPoolOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetLoadBalancerPool(getLoadBalancerPoolOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateLoadBalancerPool(updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) - Operation response error`, func() { + version := "testString" + updateLoadBalancerPoolPath := "/load_balancers/testString/pools/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(updateLoadBalancerPoolPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateLoadBalancerPool 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 LoadBalancerPoolHealthMonitorPatch model + loadBalancerPoolHealthMonitorPatchModel := new(vpcv1.LoadBalancerPoolHealthMonitorPatch) + loadBalancerPoolHealthMonitorPatchModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPatchModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPatchModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPatchModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPatchModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPatchModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolSessionPersistencePatch model + loadBalancerPoolSessionPersistencePatchModel := new(vpcv1.LoadBalancerPoolSessionPersistencePatch) + loadBalancerPoolSessionPersistencePatchModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePatchModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the LoadBalancerPoolPatch model + loadBalancerPoolPatchModel := new(vpcv1.LoadBalancerPoolPatch) + loadBalancerPoolPatchModel.Algorithm = core.StringPtr("least_connections") + loadBalancerPoolPatchModel.HealthMonitor = loadBalancerPoolHealthMonitorPatchModel + loadBalancerPoolPatchModel.Name = core.StringPtr("my-load-balancer-pool") + loadBalancerPoolPatchModel.Protocol = core.StringPtr("http") + loadBalancerPoolPatchModel.ProxyProtocol = core.StringPtr("disabled") + loadBalancerPoolPatchModel.SessionPersistence = loadBalancerPoolSessionPersistencePatchModel + loadBalancerPoolPatchModelAsPatch, asPatchErr := loadBalancerPoolPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerPoolOptions model + updateLoadBalancerPoolOptionsModel := new(vpcv1.UpdateLoadBalancerPoolOptions) + updateLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerPoolOptionsModel.LoadBalancerPoolPatch = loadBalancerPoolPatchModelAsPatch + updateLoadBalancerPoolOptionsModel.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.UpdateLoadBalancerPool(updateLoadBalancerPoolOptionsModel) + 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.UpdateLoadBalancerPool(updateLoadBalancerPoolOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateLoadBalancerPool(updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions)`, func() { + version := "testString" + updateLoadBalancerPoolPath := "/load_balancers/testString/pools/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(updateLoadBalancerPoolPath)) + 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{"testString"})) + 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", `{"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/123456::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() { + 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 LoadBalancerPoolHealthMonitorPatch model + loadBalancerPoolHealthMonitorPatchModel := new(vpcv1.LoadBalancerPoolHealthMonitorPatch) + loadBalancerPoolHealthMonitorPatchModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPatchModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPatchModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPatchModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPatchModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPatchModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolSessionPersistencePatch model + loadBalancerPoolSessionPersistencePatchModel := new(vpcv1.LoadBalancerPoolSessionPersistencePatch) + loadBalancerPoolSessionPersistencePatchModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePatchModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the LoadBalancerPoolPatch model + loadBalancerPoolPatchModel := new(vpcv1.LoadBalancerPoolPatch) + loadBalancerPoolPatchModel.Algorithm = core.StringPtr("least_connections") + loadBalancerPoolPatchModel.HealthMonitor = loadBalancerPoolHealthMonitorPatchModel + loadBalancerPoolPatchModel.Name = core.StringPtr("my-load-balancer-pool") + loadBalancerPoolPatchModel.Protocol = core.StringPtr("http") + loadBalancerPoolPatchModel.ProxyProtocol = core.StringPtr("disabled") + loadBalancerPoolPatchModel.SessionPersistence = loadBalancerPoolSessionPersistencePatchModel + loadBalancerPoolPatchModelAsPatch, asPatchErr := loadBalancerPoolPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerPoolOptions model + updateLoadBalancerPoolOptionsModel := new(vpcv1.UpdateLoadBalancerPoolOptions) + updateLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerPoolOptionsModel.LoadBalancerPoolPatch = loadBalancerPoolPatchModelAsPatch + updateLoadBalancerPoolOptionsModel.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.UpdateLoadBalancerPoolWithContext(ctx, updateLoadBalancerPoolOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateLoadBalancerPool(updateLoadBalancerPoolOptionsModel) + 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.UpdateLoadBalancerPoolWithContext(ctx, updateLoadBalancerPoolOptionsModel) + 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(updateLoadBalancerPoolPath)) + 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{"testString"})) + 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", `{"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/123456::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() { + 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.UpdateLoadBalancerPool(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the LoadBalancerPoolHealthMonitorPatch model + loadBalancerPoolHealthMonitorPatchModel := new(vpcv1.LoadBalancerPoolHealthMonitorPatch) + loadBalancerPoolHealthMonitorPatchModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPatchModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPatchModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPatchModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPatchModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPatchModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolSessionPersistencePatch model + loadBalancerPoolSessionPersistencePatchModel := new(vpcv1.LoadBalancerPoolSessionPersistencePatch) + loadBalancerPoolSessionPersistencePatchModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePatchModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the LoadBalancerPoolPatch model + loadBalancerPoolPatchModel := new(vpcv1.LoadBalancerPoolPatch) + loadBalancerPoolPatchModel.Algorithm = core.StringPtr("least_connections") + loadBalancerPoolPatchModel.HealthMonitor = loadBalancerPoolHealthMonitorPatchModel + loadBalancerPoolPatchModel.Name = core.StringPtr("my-load-balancer-pool") + loadBalancerPoolPatchModel.Protocol = core.StringPtr("http") + loadBalancerPoolPatchModel.ProxyProtocol = core.StringPtr("disabled") + loadBalancerPoolPatchModel.SessionPersistence = loadBalancerPoolSessionPersistencePatchModel + loadBalancerPoolPatchModelAsPatch, asPatchErr := loadBalancerPoolPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerPoolOptions model + updateLoadBalancerPoolOptionsModel := new(vpcv1.UpdateLoadBalancerPoolOptions) + updateLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerPoolOptionsModel.LoadBalancerPoolPatch = loadBalancerPoolPatchModelAsPatch + updateLoadBalancerPoolOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateLoadBalancerPool(updateLoadBalancerPoolOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateLoadBalancerPool 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 LoadBalancerPoolHealthMonitorPatch model + loadBalancerPoolHealthMonitorPatchModel := new(vpcv1.LoadBalancerPoolHealthMonitorPatch) + loadBalancerPoolHealthMonitorPatchModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPatchModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPatchModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPatchModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPatchModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPatchModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolSessionPersistencePatch model + loadBalancerPoolSessionPersistencePatchModel := new(vpcv1.LoadBalancerPoolSessionPersistencePatch) + loadBalancerPoolSessionPersistencePatchModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePatchModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the LoadBalancerPoolPatch model + loadBalancerPoolPatchModel := new(vpcv1.LoadBalancerPoolPatch) + loadBalancerPoolPatchModel.Algorithm = core.StringPtr("least_connections") + loadBalancerPoolPatchModel.HealthMonitor = loadBalancerPoolHealthMonitorPatchModel + loadBalancerPoolPatchModel.Name = core.StringPtr("my-load-balancer-pool") + loadBalancerPoolPatchModel.Protocol = core.StringPtr("http") + loadBalancerPoolPatchModel.ProxyProtocol = core.StringPtr("disabled") + loadBalancerPoolPatchModel.SessionPersistence = loadBalancerPoolSessionPersistencePatchModel + loadBalancerPoolPatchModelAsPatch, asPatchErr := loadBalancerPoolPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerPoolOptions model + updateLoadBalancerPoolOptionsModel := new(vpcv1.UpdateLoadBalancerPoolOptions) + updateLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerPoolOptionsModel.LoadBalancerPoolPatch = loadBalancerPoolPatchModelAsPatch + updateLoadBalancerPoolOptionsModel.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.UpdateLoadBalancerPool(updateLoadBalancerPoolOptionsModel) + 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 UpdateLoadBalancerPoolOptions model with no property values + updateLoadBalancerPoolOptionsModelNew := new(vpcv1.UpdateLoadBalancerPoolOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateLoadBalancerPool(updateLoadBalancerPoolOptionsModelNew) + 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 UpdateLoadBalancerPool 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 LoadBalancerPoolHealthMonitorPatch model + loadBalancerPoolHealthMonitorPatchModel := new(vpcv1.LoadBalancerPoolHealthMonitorPatch) + loadBalancerPoolHealthMonitorPatchModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPatchModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPatchModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPatchModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPatchModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPatchModel.URLPath = core.StringPtr("/") + + // Construct an instance of the LoadBalancerPoolSessionPersistencePatch model + loadBalancerPoolSessionPersistencePatchModel := new(vpcv1.LoadBalancerPoolSessionPersistencePatch) + loadBalancerPoolSessionPersistencePatchModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePatchModel.Type = core.StringPtr("app_cookie") + + // Construct an instance of the LoadBalancerPoolPatch model + loadBalancerPoolPatchModel := new(vpcv1.LoadBalancerPoolPatch) + loadBalancerPoolPatchModel.Algorithm = core.StringPtr("least_connections") + loadBalancerPoolPatchModel.HealthMonitor = loadBalancerPoolHealthMonitorPatchModel + loadBalancerPoolPatchModel.Name = core.StringPtr("my-load-balancer-pool") + loadBalancerPoolPatchModel.Protocol = core.StringPtr("http") + loadBalancerPoolPatchModel.ProxyProtocol = core.StringPtr("disabled") + loadBalancerPoolPatchModel.SessionPersistence = loadBalancerPoolSessionPersistencePatchModel + loadBalancerPoolPatchModelAsPatch, asPatchErr := loadBalancerPoolPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerPoolOptions model + updateLoadBalancerPoolOptionsModel := new(vpcv1.UpdateLoadBalancerPoolOptions) + updateLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerPoolOptionsModel.LoadBalancerPoolPatch = loadBalancerPoolPatchModelAsPatch + updateLoadBalancerPoolOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateLoadBalancerPool(updateLoadBalancerPoolOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) - Operation response error`, func() { + version := "testString" + listLoadBalancerPoolMembersPath := "/load_balancers/testString/pools/testString/members" + 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(listLoadBalancerPoolMembersPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ListLoadBalancerPoolMembers 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 ListLoadBalancerPoolMembersOptions model + listLoadBalancerPoolMembersOptionsModel := new(vpcv1.ListLoadBalancerPoolMembersOptions) + listLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") + listLoadBalancerPoolMembersOptionsModel.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.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptionsModel) + 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.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions)`, func() { + version := "testString" + listLoadBalancerPoolMembersPath := "/load_balancers/testString/pools/testString/members" + 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(listLoadBalancerPoolMembersPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}]}`) + })) + }) + It(`Invoke ListLoadBalancerPoolMembers 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 ListLoadBalancerPoolMembersOptions model + listLoadBalancerPoolMembersOptionsModel := new(vpcv1.ListLoadBalancerPoolMembersOptions) + listLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") + listLoadBalancerPoolMembersOptionsModel.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.ListLoadBalancerPoolMembersWithContext(ctx, listLoadBalancerPoolMembersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptionsModel) + 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.ListLoadBalancerPoolMembersWithContext(ctx, listLoadBalancerPoolMembersOptionsModel) + 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(listLoadBalancerPoolMembersPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}]}`) + })) + }) + It(`Invoke ListLoadBalancerPoolMembers 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.ListLoadBalancerPoolMembers(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListLoadBalancerPoolMembersOptions model + listLoadBalancerPoolMembersOptionsModel := new(vpcv1.ListLoadBalancerPoolMembersOptions) + listLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") + listLoadBalancerPoolMembersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListLoadBalancerPoolMembers 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 ListLoadBalancerPoolMembersOptions model + listLoadBalancerPoolMembersOptionsModel := new(vpcv1.ListLoadBalancerPoolMembersOptions) + listLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") + listLoadBalancerPoolMembersOptionsModel.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.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptionsModel) + 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 ListLoadBalancerPoolMembersOptions model with no property values + listLoadBalancerPoolMembersOptionsModelNew := new(vpcv1.ListLoadBalancerPoolMembersOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptionsModelNew) + 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 ListLoadBalancerPoolMembers 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 ListLoadBalancerPoolMembersOptions model + listLoadBalancerPoolMembersOptionsModel := new(vpcv1.ListLoadBalancerPoolMembersOptions) + listLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") + listLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") + listLoadBalancerPoolMembersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) - Operation response error`, func() { + version := "testString" + createLoadBalancerPoolMemberPath := "/load_balancers/testString/pools/testString/members" + 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(createLoadBalancerPoolMemberPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the CreateLoadBalancerPoolMemberOptions model + createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) + createLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + createLoadBalancerPoolMemberOptionsModel.Port = core.Int64Ptr(int64(80)) + createLoadBalancerPoolMemberOptionsModel.Target = loadBalancerPoolMemberTargetPrototypeModel + createLoadBalancerPoolMemberOptionsModel.Weight = core.Int64Ptr(int64(50)) + createLoadBalancerPoolMemberOptionsModel.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.CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptionsModel) + 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.CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions)`, func() { + version := "testString" + createLoadBalancerPoolMemberPath := "/load_balancers/testString/pools/testString/members" + 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(createLoadBalancerPoolMemberPath)) + 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{"testString"})) + 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) + })) + }) + It(`Invoke CreateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the CreateLoadBalancerPoolMemberOptions model + createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) + createLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + createLoadBalancerPoolMemberOptionsModel.Port = core.Int64Ptr(int64(80)) + createLoadBalancerPoolMemberOptionsModel.Target = loadBalancerPoolMemberTargetPrototypeModel + createLoadBalancerPoolMemberOptionsModel.Weight = core.Int64Ptr(int64(50)) + createLoadBalancerPoolMemberOptionsModel.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.CreateLoadBalancerPoolMemberWithContext(ctx, createLoadBalancerPoolMemberOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptionsModel) + 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.CreateLoadBalancerPoolMemberWithContext(ctx, createLoadBalancerPoolMemberOptionsModel) + 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(createLoadBalancerPoolMemberPath)) + 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{"testString"})) + 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) + })) + }) + It(`Invoke CreateLoadBalancerPoolMember 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.CreateLoadBalancerPoolMember(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the CreateLoadBalancerPoolMemberOptions model + createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) + createLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + createLoadBalancerPoolMemberOptionsModel.Port = core.Int64Ptr(int64(80)) + createLoadBalancerPoolMemberOptionsModel.Target = loadBalancerPoolMemberTargetPrototypeModel + createLoadBalancerPoolMemberOptionsModel.Weight = core.Int64Ptr(int64(50)) + createLoadBalancerPoolMemberOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the CreateLoadBalancerPoolMemberOptions model + createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) + createLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + createLoadBalancerPoolMemberOptionsModel.Port = core.Int64Ptr(int64(80)) + createLoadBalancerPoolMemberOptionsModel.Target = loadBalancerPoolMemberTargetPrototypeModel + createLoadBalancerPoolMemberOptionsModel.Weight = core.Int64Ptr(int64(50)) + createLoadBalancerPoolMemberOptionsModel.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.CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptionsModel) + 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 CreateLoadBalancerPoolMemberOptions model with no property values + createLoadBalancerPoolMemberOptionsModelNew := new(vpcv1.CreateLoadBalancerPoolMemberOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptionsModelNew) + 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 CreateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the CreateLoadBalancerPoolMemberOptions model + createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) + createLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + createLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + createLoadBalancerPoolMemberOptionsModel.Port = core.Int64Ptr(int64(80)) + createLoadBalancerPoolMemberOptionsModel.Target = loadBalancerPoolMemberTargetPrototypeModel + createLoadBalancerPoolMemberOptionsModel.Weight = core.Int64Ptr(int64(50)) + createLoadBalancerPoolMemberOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) - Operation response error`, func() { + version := "testString" + replaceLoadBalancerPoolMembersPath := "/load_balancers/testString/pools/testString/members" + 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(replaceLoadBalancerPoolMembersPath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 ReplaceLoadBalancerPoolMembers 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the ReplaceLoadBalancerPoolMembersOptions model + replaceLoadBalancerPoolMembersOptionsModel := new(vpcv1.ReplaceLoadBalancerPoolMembersOptions) + replaceLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") + replaceLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") + replaceLoadBalancerPoolMembersOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + replaceLoadBalancerPoolMembersOptionsModel.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.ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptionsModel) + 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.ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions)`, func() { + version := "testString" + replaceLoadBalancerPoolMembersPath := "/load_balancers/testString/pools/testString/members" + 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(replaceLoadBalancerPoolMembersPath)) + 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{"testString"})) + 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", `{"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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}]}`) + })) + }) + It(`Invoke ReplaceLoadBalancerPoolMembers 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the ReplaceLoadBalancerPoolMembersOptions model + replaceLoadBalancerPoolMembersOptionsModel := new(vpcv1.ReplaceLoadBalancerPoolMembersOptions) + replaceLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") + replaceLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") + replaceLoadBalancerPoolMembersOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + replaceLoadBalancerPoolMembersOptionsModel.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.ReplaceLoadBalancerPoolMembersWithContext(ctx, replaceLoadBalancerPoolMembersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptionsModel) + 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.ReplaceLoadBalancerPoolMembersWithContext(ctx, replaceLoadBalancerPoolMembersOptionsModel) + 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(replaceLoadBalancerPoolMembersPath)) + 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{"testString"})) + 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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}]}`) + })) + }) + It(`Invoke ReplaceLoadBalancerPoolMembers 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.ReplaceLoadBalancerPoolMembers(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the ReplaceLoadBalancerPoolMembersOptions model + replaceLoadBalancerPoolMembersOptionsModel := new(vpcv1.ReplaceLoadBalancerPoolMembersOptions) + replaceLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") + replaceLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") + replaceLoadBalancerPoolMembersOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + replaceLoadBalancerPoolMembersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ReplaceLoadBalancerPoolMembers 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the ReplaceLoadBalancerPoolMembersOptions model + replaceLoadBalancerPoolMembersOptionsModel := new(vpcv1.ReplaceLoadBalancerPoolMembersOptions) + replaceLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") + replaceLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") + replaceLoadBalancerPoolMembersOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + replaceLoadBalancerPoolMembersOptionsModel.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.ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptionsModel) + 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 ReplaceLoadBalancerPoolMembersOptions model with no property values + replaceLoadBalancerPoolMembersOptionsModelNew := new(vpcv1.ReplaceLoadBalancerPoolMembersOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptionsModelNew) + 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 ReplaceLoadBalancerPoolMembers 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + + // Construct an instance of the ReplaceLoadBalancerPoolMembersOptions model + replaceLoadBalancerPoolMembersOptionsModel := new(vpcv1.ReplaceLoadBalancerPoolMembersOptions) + replaceLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") + replaceLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") + replaceLoadBalancerPoolMembersOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + replaceLoadBalancerPoolMembersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions)`, func() { + version := "testString" + deleteLoadBalancerPoolMemberPath := "/load_balancers/testString/pools/testString/members/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(deleteLoadBalancerPoolMemberPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteLoadBalancerPoolMember 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.DeleteLoadBalancerPoolMember(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteLoadBalancerPoolMemberOptions model + deleteLoadBalancerPoolMemberOptionsModel := new(vpcv1.DeleteLoadBalancerPoolMemberOptions) + deleteLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + deleteLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + deleteLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") + deleteLoadBalancerPoolMemberOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteLoadBalancerPoolMember 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 DeleteLoadBalancerPoolMemberOptions model + deleteLoadBalancerPoolMemberOptionsModel := new(vpcv1.DeleteLoadBalancerPoolMemberOptions) + deleteLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + deleteLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + deleteLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") + deleteLoadBalancerPoolMemberOptionsModel.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.DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteLoadBalancerPoolMemberOptions model with no property values + deleteLoadBalancerPoolMemberOptionsModelNew := new(vpcv1.DeleteLoadBalancerPoolMemberOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) - Operation response error`, func() { + version := "testString" + getLoadBalancerPoolMemberPath := "/load_balancers/testString/pools/testString/members/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(getLoadBalancerPoolMemberPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetLoadBalancerPoolMember 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 GetLoadBalancerPoolMemberOptions model + getLoadBalancerPoolMemberOptionsModel := new(vpcv1.GetLoadBalancerPoolMemberOptions) + getLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.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.GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptionsModel) + 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.GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions)`, func() { + version := "testString" + getLoadBalancerPoolMemberPath := "/load_balancers/testString/pools/testString/members/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(getLoadBalancerPoolMemberPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) + })) + }) + It(`Invoke GetLoadBalancerPoolMember 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 GetLoadBalancerPoolMemberOptions model + getLoadBalancerPoolMemberOptionsModel := new(vpcv1.GetLoadBalancerPoolMemberOptions) + getLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.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.GetLoadBalancerPoolMemberWithContext(ctx, getLoadBalancerPoolMemberOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptionsModel) + 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.GetLoadBalancerPoolMemberWithContext(ctx, getLoadBalancerPoolMemberOptionsModel) + 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(getLoadBalancerPoolMemberPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) + })) + }) + It(`Invoke GetLoadBalancerPoolMember 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.GetLoadBalancerPoolMember(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetLoadBalancerPoolMemberOptions model + getLoadBalancerPoolMemberOptionsModel := new(vpcv1.GetLoadBalancerPoolMemberOptions) + getLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetLoadBalancerPoolMember 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 GetLoadBalancerPoolMemberOptions model + getLoadBalancerPoolMemberOptionsModel := new(vpcv1.GetLoadBalancerPoolMemberOptions) + getLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.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.GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptionsModel) + 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 GetLoadBalancerPoolMemberOptions model with no property values + getLoadBalancerPoolMemberOptionsModelNew := new(vpcv1.GetLoadBalancerPoolMemberOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptionsModelNew) + 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 GetLoadBalancerPoolMember 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 GetLoadBalancerPoolMemberOptions model + getLoadBalancerPoolMemberOptionsModel := new(vpcv1.GetLoadBalancerPoolMemberOptions) + getLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") + getLoadBalancerPoolMemberOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) - Operation response error`, func() { + version := "testString" + updateLoadBalancerPoolMemberPath := "/load_balancers/testString/pools/testString/members/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(updateLoadBalancerPoolMemberPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPatch model + loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) + loadBalancerPoolMemberPatchModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPatchModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPatchModel.Weight = core.Int64Ptr(int64(50)) + loadBalancerPoolMemberPatchModelAsPatch, asPatchErr := loadBalancerPoolMemberPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerPoolMemberOptions model + updateLoadBalancerPoolMemberOptionsModel := new(vpcv1.UpdateLoadBalancerPoolMemberOptions) + updateLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatchModelAsPatch + updateLoadBalancerPoolMemberOptionsModel.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.UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptionsModel) + 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.UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions)`, func() { + version := "testString" + updateLoadBalancerPoolMemberPath := "/load_balancers/testString/pools/testString/members/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(updateLoadBalancerPoolMemberPath)) + 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{"testString"})) + 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) + })) + }) + It(`Invoke UpdateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPatch model + loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) + loadBalancerPoolMemberPatchModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPatchModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPatchModel.Weight = core.Int64Ptr(int64(50)) + loadBalancerPoolMemberPatchModelAsPatch, asPatchErr := loadBalancerPoolMemberPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerPoolMemberOptions model + updateLoadBalancerPoolMemberOptionsModel := new(vpcv1.UpdateLoadBalancerPoolMemberOptions) + updateLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatchModelAsPatch + updateLoadBalancerPoolMemberOptionsModel.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.UpdateLoadBalancerPoolMemberWithContext(ctx, updateLoadBalancerPoolMemberOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptionsModel) + 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.UpdateLoadBalancerPoolMemberWithContext(ctx, updateLoadBalancerPoolMemberOptionsModel) + 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(updateLoadBalancerPoolMemberPath)) + 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{"testString"})) + 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) + })) + }) + It(`Invoke UpdateLoadBalancerPoolMember 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.UpdateLoadBalancerPoolMember(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPatch model + loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) + loadBalancerPoolMemberPatchModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPatchModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPatchModel.Weight = core.Int64Ptr(int64(50)) + loadBalancerPoolMemberPatchModelAsPatch, asPatchErr := loadBalancerPoolMemberPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerPoolMemberOptions model + updateLoadBalancerPoolMemberOptionsModel := new(vpcv1.UpdateLoadBalancerPoolMemberOptions) + updateLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatchModelAsPatch + updateLoadBalancerPoolMemberOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPatch model + loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) + loadBalancerPoolMemberPatchModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPatchModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPatchModel.Weight = core.Int64Ptr(int64(50)) + loadBalancerPoolMemberPatchModelAsPatch, asPatchErr := loadBalancerPoolMemberPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerPoolMemberOptions model + updateLoadBalancerPoolMemberOptionsModel := new(vpcv1.UpdateLoadBalancerPoolMemberOptions) + updateLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatchModelAsPatch + updateLoadBalancerPoolMemberOptionsModel.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.UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptionsModel) + 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 UpdateLoadBalancerPoolMemberOptions model with no property values + updateLoadBalancerPoolMemberOptionsModelNew := new(vpcv1.UpdateLoadBalancerPoolMemberOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptionsModelNew) + 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 UpdateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + + // Construct an instance of the LoadBalancerPoolMemberPatch model + loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) + loadBalancerPoolMemberPatchModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPatchModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPatchModel.Weight = core.Int64Ptr(int64(50)) + loadBalancerPoolMemberPatchModelAsPatch, asPatchErr := loadBalancerPoolMemberPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateLoadBalancerPoolMemberOptions model + updateLoadBalancerPoolMemberOptionsModel := new(vpcv1.UpdateLoadBalancerPoolMemberOptions) + updateLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") + updateLoadBalancerPoolMemberOptionsModel.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatchModelAsPatch + updateLoadBalancerPoolMemberOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListEndpointGateways(listEndpointGatewaysOptions *ListEndpointGatewaysOptions) - Operation response error`, func() { + version := "testString" + listEndpointGatewaysPath := "/endpoint_gateways" + 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(listEndpointGatewaysPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + 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 {`) + })) + }) + It(`Invoke ListEndpointGateways 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 ListEndpointGatewaysOptions model + listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) + listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.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.ListEndpointGateways(listEndpointGatewaysOptionsModel) + 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.ListEndpointGateways(listEndpointGatewaysOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListEndpointGateways(listEndpointGatewaysOptions *ListEndpointGatewaysOptions)`, func() { + version := "testString" + listEndpointGatewaysPath := "/endpoint_gateways" + 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(listEndpointGatewaysPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + 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", `{"endpoint_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) + })) + }) + It(`Invoke ListEndpointGateways 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 ListEndpointGatewaysOptions model + listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) + listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.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.ListEndpointGatewaysWithContext(ctx, listEndpointGatewaysOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListEndpointGateways(listEndpointGatewaysOptionsModel) + 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.ListEndpointGatewaysWithContext(ctx, listEndpointGatewaysOptionsModel) + 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(listEndpointGatewaysPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + 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", `{"endpoint_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) + })) + }) + It(`Invoke ListEndpointGateways 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.ListEndpointGateways(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListEndpointGatewaysOptions model + listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) + listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListEndpointGateways(listEndpointGatewaysOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListEndpointGateways 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 ListEndpointGatewaysOptions model + listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) + listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.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.ListEndpointGateways(listEndpointGatewaysOptionsModel) + 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 ListEndpointGateways 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 ListEndpointGatewaysOptions model + listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) + listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listEndpointGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListEndpointGateways(listEndpointGatewaysOptionsModel) + 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.EndpointGatewayCollection) + nextObject := new(vpcv1.EndpointGatewayCollectionNext) + 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.EndpointGatewayCollection) + + 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.EndpointGatewayCollection) + nextObject := new(vpcv1.EndpointGatewayCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateEndpointGateway(createEndpointGatewayOptions *CreateEndpointGatewayOptions) - Operation response error`, func() { + version := "testString" + createEndpointGatewayPath := "/endpoint_gateways" + 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(createEndpointGatewayPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateEndpointGateway 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 EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN model + endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") + endpointGatewayTargetPrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f025b503-ae66-46de-a011-3bd08fd5f7bf") + + // Construct an instance of the EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID model + endpointGatewayReservedIPModel := new(vpcv1.EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) + endpointGatewayReservedIPModel.ID = core.StringPtr("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("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateEndpointGatewayOptions model + createEndpointGatewayOptionsModel := new(vpcv1.CreateEndpointGatewayOptions) + createEndpointGatewayOptionsModel.Target = endpointGatewayTargetPrototypeModel + createEndpointGatewayOptionsModel.VPC = vpcIdentityModel + createEndpointGatewayOptionsModel.Ips = []vpcv1.EndpointGatewayReservedIPIntf{endpointGatewayReservedIPModel} + createEndpointGatewayOptionsModel.Name = core.StringPtr("testString") + createEndpointGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel + createEndpointGatewayOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createEndpointGatewayOptionsModel.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.CreateEndpointGateway(createEndpointGatewayOptionsModel) + 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.CreateEndpointGateway(createEndpointGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateEndpointGateway(createEndpointGatewayOptions *CreateEndpointGatewayOptions)`, func() { + version := "testString" + createEndpointGatewayPath := "/endpoint_gateways" + 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(createEndpointGatewayPath)) + 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{"testString"})) + 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateEndpointGateway 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 EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN model + endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") + endpointGatewayTargetPrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f025b503-ae66-46de-a011-3bd08fd5f7bf") + + // Construct an instance of the EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID model + endpointGatewayReservedIPModel := new(vpcv1.EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) + endpointGatewayReservedIPModel.ID = core.StringPtr("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("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateEndpointGatewayOptions model + createEndpointGatewayOptionsModel := new(vpcv1.CreateEndpointGatewayOptions) + createEndpointGatewayOptionsModel.Target = endpointGatewayTargetPrototypeModel + createEndpointGatewayOptionsModel.VPC = vpcIdentityModel + createEndpointGatewayOptionsModel.Ips = []vpcv1.EndpointGatewayReservedIPIntf{endpointGatewayReservedIPModel} + createEndpointGatewayOptionsModel.Name = core.StringPtr("testString") + createEndpointGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel + createEndpointGatewayOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createEndpointGatewayOptionsModel.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.CreateEndpointGatewayWithContext(ctx, createEndpointGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateEndpointGateway(createEndpointGatewayOptionsModel) + 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.CreateEndpointGatewayWithContext(ctx, createEndpointGatewayOptionsModel) + 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(createEndpointGatewayPath)) + 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{"testString"})) + 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/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateEndpointGateway 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.CreateEndpointGateway(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN model + endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") + endpointGatewayTargetPrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f025b503-ae66-46de-a011-3bd08fd5f7bf") + + // Construct an instance of the EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID model + endpointGatewayReservedIPModel := new(vpcv1.EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) + endpointGatewayReservedIPModel.ID = core.StringPtr("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("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateEndpointGatewayOptions model + createEndpointGatewayOptionsModel := new(vpcv1.CreateEndpointGatewayOptions) + createEndpointGatewayOptionsModel.Target = endpointGatewayTargetPrototypeModel + createEndpointGatewayOptionsModel.VPC = vpcIdentityModel + createEndpointGatewayOptionsModel.Ips = []vpcv1.EndpointGatewayReservedIPIntf{endpointGatewayReservedIPModel} + createEndpointGatewayOptionsModel.Name = core.StringPtr("testString") + createEndpointGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel + createEndpointGatewayOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createEndpointGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateEndpointGateway(createEndpointGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateEndpointGateway 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 EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN model + endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") + endpointGatewayTargetPrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f025b503-ae66-46de-a011-3bd08fd5f7bf") + + // Construct an instance of the EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID model + endpointGatewayReservedIPModel := new(vpcv1.EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) + endpointGatewayReservedIPModel.ID = core.StringPtr("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("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateEndpointGatewayOptions model + createEndpointGatewayOptionsModel := new(vpcv1.CreateEndpointGatewayOptions) + createEndpointGatewayOptionsModel.Target = endpointGatewayTargetPrototypeModel + createEndpointGatewayOptionsModel.VPC = vpcIdentityModel + createEndpointGatewayOptionsModel.Ips = []vpcv1.EndpointGatewayReservedIPIntf{endpointGatewayReservedIPModel} + createEndpointGatewayOptionsModel.Name = core.StringPtr("testString") + createEndpointGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel + createEndpointGatewayOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createEndpointGatewayOptionsModel.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.CreateEndpointGateway(createEndpointGatewayOptionsModel) + 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 CreateEndpointGatewayOptions model with no property values + createEndpointGatewayOptionsModelNew := new(vpcv1.CreateEndpointGatewayOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateEndpointGateway(createEndpointGatewayOptionsModelNew) + 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 CreateEndpointGateway 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 EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN model + endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") + endpointGatewayTargetPrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::") + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + vpcIdentityModel.ID = core.StringPtr("f025b503-ae66-46de-a011-3bd08fd5f7bf") + + // Construct an instance of the EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID model + endpointGatewayReservedIPModel := new(vpcv1.EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) + endpointGatewayReservedIPModel.ID = core.StringPtr("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("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateEndpointGatewayOptions model + createEndpointGatewayOptionsModel := new(vpcv1.CreateEndpointGatewayOptions) + createEndpointGatewayOptionsModel.Target = endpointGatewayTargetPrototypeModel + createEndpointGatewayOptionsModel.VPC = vpcIdentityModel + createEndpointGatewayOptionsModel.Ips = []vpcv1.EndpointGatewayReservedIPIntf{endpointGatewayReservedIPModel} + createEndpointGatewayOptionsModel.Name = core.StringPtr("testString") + createEndpointGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel + createEndpointGatewayOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createEndpointGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateEndpointGateway(createEndpointGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) - Operation response error`, func() { + version := "testString" + listEndpointGatewayIpsPath := "/endpoint_gateways/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(listEndpointGatewayIpsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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 ListEndpointGatewayIps 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 ListEndpointGatewayIpsOptions model + listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) + listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") + listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") + listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") + listEndpointGatewayIpsOptionsModel.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.ListEndpointGatewayIps(listEndpointGatewayIpsOptionsModel) + 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.ListEndpointGatewayIps(listEndpointGatewayIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions)`, func() { + version := "testString" + listEndpointGatewayIpsPath := "/endpoint_gateways/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(listEndpointGatewayIpsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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/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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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}`) + })) + }) + It(`Invoke ListEndpointGatewayIps 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 ListEndpointGatewayIpsOptions model + listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) + listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") + listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") + listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") + listEndpointGatewayIpsOptionsModel.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.ListEndpointGatewayIpsWithContext(ctx, listEndpointGatewayIpsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListEndpointGatewayIps(listEndpointGatewayIpsOptionsModel) + 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.ListEndpointGatewayIpsWithContext(ctx, listEndpointGatewayIpsOptionsModel) + 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(listEndpointGatewayIpsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + 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/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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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}`) + })) + }) + It(`Invoke ListEndpointGatewayIps 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.ListEndpointGatewayIps(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListEndpointGatewayIpsOptions model + listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) + listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") + listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") + listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") + listEndpointGatewayIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListEndpointGatewayIps(listEndpointGatewayIpsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListEndpointGatewayIps 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 ListEndpointGatewayIpsOptions model + listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) + listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") + listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") + listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") + listEndpointGatewayIpsOptionsModel.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.ListEndpointGatewayIps(listEndpointGatewayIpsOptionsModel) + 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 ListEndpointGatewayIpsOptions model with no property values + listEndpointGatewayIpsOptionsModelNew := new(vpcv1.ListEndpointGatewayIpsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListEndpointGatewayIps(listEndpointGatewayIpsOptionsModelNew) + 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 ListEndpointGatewayIps 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 ListEndpointGatewayIpsOptions model + listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) + listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") + listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") + listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") + listEndpointGatewayIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListEndpointGatewayIps(listEndpointGatewayIpsOptionsModel) + 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.ReservedIPCollectionEndpointGatewayContext) + nextObject := new(vpcv1.ReservedIPCollectionEndpointGatewayContextNext) + 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.ReservedIPCollectionEndpointGatewayContext) + + 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.ReservedIPCollectionEndpointGatewayContext) + nextObject := new(vpcv1.ReservedIPCollectionEndpointGatewayContextNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`RemoveEndpointGatewayIP(removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions)`, func() { + version := "testString" + removeEndpointGatewayIPPath := "/endpoint_gateways/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(removeEndpointGatewayIPPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke RemoveEndpointGatewayIP 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.RemoveEndpointGatewayIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the RemoveEndpointGatewayIPOptions model + removeEndpointGatewayIPOptionsModel := new(vpcv1.RemoveEndpointGatewayIPOptions) + removeEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") + removeEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") + removeEndpointGatewayIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.RemoveEndpointGatewayIP(removeEndpointGatewayIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke RemoveEndpointGatewayIP 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 RemoveEndpointGatewayIPOptions model + removeEndpointGatewayIPOptionsModel := new(vpcv1.RemoveEndpointGatewayIPOptions) + removeEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") + removeEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") + removeEndpointGatewayIPOptionsModel.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.RemoveEndpointGatewayIP(removeEndpointGatewayIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the RemoveEndpointGatewayIPOptions model with no property values + removeEndpointGatewayIPOptionsModelNew := new(vpcv1.RemoveEndpointGatewayIPOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.RemoveEndpointGatewayIP(removeEndpointGatewayIPOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetEndpointGatewayIP(getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) - Operation response error`, func() { + version := "testString" + getEndpointGatewayIPPath := "/endpoint_gateways/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(getEndpointGatewayIPPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetEndpointGatewayIP 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 GetEndpointGatewayIPOptions model + getEndpointGatewayIPOptionsModel := new(vpcv1.GetEndpointGatewayIPOptions) + getEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") + getEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") + getEndpointGatewayIPOptionsModel.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.GetEndpointGatewayIP(getEndpointGatewayIPOptionsModel) + 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.GetEndpointGatewayIP(getEndpointGatewayIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetEndpointGatewayIP(getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions)`, func() { + version := "testString" + getEndpointGatewayIPPath := "/endpoint_gateways/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(getEndpointGatewayIPPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + })) + }) + It(`Invoke GetEndpointGatewayIP 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 GetEndpointGatewayIPOptions model + getEndpointGatewayIPOptionsModel := new(vpcv1.GetEndpointGatewayIPOptions) + getEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") + getEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") + getEndpointGatewayIPOptionsModel.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.GetEndpointGatewayIPWithContext(ctx, getEndpointGatewayIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetEndpointGatewayIP(getEndpointGatewayIPOptionsModel) + 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.GetEndpointGatewayIPWithContext(ctx, getEndpointGatewayIPOptionsModel) + 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(getEndpointGatewayIPPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + })) + }) + It(`Invoke GetEndpointGatewayIP 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.GetEndpointGatewayIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetEndpointGatewayIPOptions model + getEndpointGatewayIPOptionsModel := new(vpcv1.GetEndpointGatewayIPOptions) + getEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") + getEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") + getEndpointGatewayIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetEndpointGatewayIP(getEndpointGatewayIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetEndpointGatewayIP 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 GetEndpointGatewayIPOptions model + getEndpointGatewayIPOptionsModel := new(vpcv1.GetEndpointGatewayIPOptions) + getEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") + getEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") + getEndpointGatewayIPOptionsModel.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.GetEndpointGatewayIP(getEndpointGatewayIPOptionsModel) + 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 GetEndpointGatewayIPOptions model with no property values + getEndpointGatewayIPOptionsModelNew := new(vpcv1.GetEndpointGatewayIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetEndpointGatewayIP(getEndpointGatewayIPOptionsModelNew) + 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 GetEndpointGatewayIP 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 GetEndpointGatewayIPOptions model + getEndpointGatewayIPOptionsModel := new(vpcv1.GetEndpointGatewayIPOptions) + getEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") + getEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") + getEndpointGatewayIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetEndpointGatewayIP(getEndpointGatewayIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`AddEndpointGatewayIP(addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) - Operation response error`, func() { + version := "testString" + addEndpointGatewayIPPath := "/endpoint_gateways/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(addEndpointGatewayIPPath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 AddEndpointGatewayIP 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 AddEndpointGatewayIPOptions model + addEndpointGatewayIPOptionsModel := new(vpcv1.AddEndpointGatewayIPOptions) + addEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") + addEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") + addEndpointGatewayIPOptionsModel.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.AddEndpointGatewayIP(addEndpointGatewayIPOptionsModel) + 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.AddEndpointGatewayIP(addEndpointGatewayIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`AddEndpointGatewayIP(addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions)`, func() { + version := "testString" + addEndpointGatewayIPPath := "/endpoint_gateways/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(addEndpointGatewayIPPath)) + Expect(req.Method).To(Equal("PUT")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + })) + }) + It(`Invoke AddEndpointGatewayIP 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 AddEndpointGatewayIPOptions model + addEndpointGatewayIPOptionsModel := new(vpcv1.AddEndpointGatewayIPOptions) + addEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") + addEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") + addEndpointGatewayIPOptionsModel.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.AddEndpointGatewayIPWithContext(ctx, addEndpointGatewayIPOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.AddEndpointGatewayIP(addEndpointGatewayIPOptionsModel) + 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.AddEndpointGatewayIPWithContext(ctx, addEndpointGatewayIPOptionsModel) + 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(addEndpointGatewayIPPath)) + Expect(req.Method).To(Equal("PUT")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) + })) + }) + It(`Invoke AddEndpointGatewayIP 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.AddEndpointGatewayIP(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the AddEndpointGatewayIPOptions model + addEndpointGatewayIPOptionsModel := new(vpcv1.AddEndpointGatewayIPOptions) + addEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") + addEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") + addEndpointGatewayIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.AddEndpointGatewayIP(addEndpointGatewayIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke AddEndpointGatewayIP 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 AddEndpointGatewayIPOptions model + addEndpointGatewayIPOptionsModel := new(vpcv1.AddEndpointGatewayIPOptions) + addEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") + addEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") + addEndpointGatewayIPOptionsModel.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.AddEndpointGatewayIP(addEndpointGatewayIPOptionsModel) + 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 AddEndpointGatewayIPOptions model with no property values + addEndpointGatewayIPOptionsModelNew := new(vpcv1.AddEndpointGatewayIPOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.AddEndpointGatewayIP(addEndpointGatewayIPOptionsModelNew) + 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 AddEndpointGatewayIP 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 AddEndpointGatewayIPOptions model + addEndpointGatewayIPOptionsModel := new(vpcv1.AddEndpointGatewayIPOptions) + addEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") + addEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") + addEndpointGatewayIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.AddEndpointGatewayIP(addEndpointGatewayIPOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteEndpointGateway(deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions)`, func() { + version := "testString" + deleteEndpointGatewayPath := "/endpoint_gateways/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(deleteEndpointGatewayPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteEndpointGateway 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.DeleteEndpointGateway(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteEndpointGatewayOptions model + deleteEndpointGatewayOptionsModel := new(vpcv1.DeleteEndpointGatewayOptions) + deleteEndpointGatewayOptionsModel.ID = core.StringPtr("testString") + deleteEndpointGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteEndpointGateway(deleteEndpointGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteEndpointGateway 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 DeleteEndpointGatewayOptions model + deleteEndpointGatewayOptionsModel := new(vpcv1.DeleteEndpointGatewayOptions) + deleteEndpointGatewayOptionsModel.ID = core.StringPtr("testString") + deleteEndpointGatewayOptionsModel.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.DeleteEndpointGateway(deleteEndpointGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteEndpointGatewayOptions model with no property values + deleteEndpointGatewayOptionsModelNew := new(vpcv1.DeleteEndpointGatewayOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteEndpointGateway(deleteEndpointGatewayOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetEndpointGateway(getEndpointGatewayOptions *GetEndpointGatewayOptions) - Operation response error`, func() { + version := "testString" + getEndpointGatewayPath := "/endpoint_gateways/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(getEndpointGatewayPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetEndpointGateway 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 GetEndpointGatewayOptions model + getEndpointGatewayOptionsModel := new(vpcv1.GetEndpointGatewayOptions) + getEndpointGatewayOptionsModel.ID = core.StringPtr("testString") + getEndpointGatewayOptionsModel.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.GetEndpointGateway(getEndpointGatewayOptionsModel) + 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.GetEndpointGateway(getEndpointGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetEndpointGateway(getEndpointGatewayOptions *GetEndpointGatewayOptions)`, func() { + version := "testString" + getEndpointGatewayPath := "/endpoint_gateways/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(getEndpointGatewayPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetEndpointGateway 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 GetEndpointGatewayOptions model + getEndpointGatewayOptionsModel := new(vpcv1.GetEndpointGatewayOptions) + getEndpointGatewayOptionsModel.ID = core.StringPtr("testString") + getEndpointGatewayOptionsModel.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.GetEndpointGatewayWithContext(ctx, getEndpointGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetEndpointGateway(getEndpointGatewayOptionsModel) + 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.GetEndpointGatewayWithContext(ctx, getEndpointGatewayOptionsModel) + 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(getEndpointGatewayPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetEndpointGateway 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.GetEndpointGateway(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetEndpointGatewayOptions model + getEndpointGatewayOptionsModel := new(vpcv1.GetEndpointGatewayOptions) + getEndpointGatewayOptionsModel.ID = core.StringPtr("testString") + getEndpointGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetEndpointGateway(getEndpointGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetEndpointGateway 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 GetEndpointGatewayOptions model + getEndpointGatewayOptionsModel := new(vpcv1.GetEndpointGatewayOptions) + getEndpointGatewayOptionsModel.ID = core.StringPtr("testString") + getEndpointGatewayOptionsModel.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.GetEndpointGateway(getEndpointGatewayOptionsModel) + 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 GetEndpointGatewayOptions model with no property values + getEndpointGatewayOptionsModelNew := new(vpcv1.GetEndpointGatewayOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetEndpointGateway(getEndpointGatewayOptionsModelNew) + 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 GetEndpointGateway 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 GetEndpointGatewayOptions model + getEndpointGatewayOptionsModel := new(vpcv1.GetEndpointGatewayOptions) + getEndpointGatewayOptionsModel.ID = core.StringPtr("testString") + getEndpointGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetEndpointGateway(getEndpointGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateEndpointGateway(updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) - Operation response error`, func() { + version := "testString" + updateEndpointGatewayPath := "/endpoint_gateways/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(updateEndpointGatewayPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateEndpointGateway 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 EndpointGatewayPatch model + endpointGatewayPatchModel := new(vpcv1.EndpointGatewayPatch) + endpointGatewayPatchModel.Name = core.StringPtr("my-endpoint-gateway") + endpointGatewayPatchModelAsPatch, asPatchErr := endpointGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateEndpointGatewayOptions model + updateEndpointGatewayOptionsModel := new(vpcv1.UpdateEndpointGatewayOptions) + updateEndpointGatewayOptionsModel.ID = core.StringPtr("testString") + updateEndpointGatewayOptionsModel.EndpointGatewayPatch = endpointGatewayPatchModelAsPatch + updateEndpointGatewayOptionsModel.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.UpdateEndpointGateway(updateEndpointGatewayOptionsModel) + 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.UpdateEndpointGateway(updateEndpointGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateEndpointGateway(updateEndpointGatewayOptions *UpdateEndpointGatewayOptions)`, func() { + version := "testString" + updateEndpointGatewayPath := "/endpoint_gateways/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(updateEndpointGatewayPath)) + 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{"testString"})) + 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/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke UpdateEndpointGateway 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 EndpointGatewayPatch model + endpointGatewayPatchModel := new(vpcv1.EndpointGatewayPatch) + endpointGatewayPatchModel.Name = core.StringPtr("my-endpoint-gateway") + endpointGatewayPatchModelAsPatch, asPatchErr := endpointGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateEndpointGatewayOptions model + updateEndpointGatewayOptionsModel := new(vpcv1.UpdateEndpointGatewayOptions) + updateEndpointGatewayOptionsModel.ID = core.StringPtr("testString") + updateEndpointGatewayOptionsModel.EndpointGatewayPatch = endpointGatewayPatchModelAsPatch + updateEndpointGatewayOptionsModel.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.UpdateEndpointGatewayWithContext(ctx, updateEndpointGatewayOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateEndpointGateway(updateEndpointGatewayOptionsModel) + 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.UpdateEndpointGatewayWithContext(ctx, updateEndpointGatewayOptionsModel) + 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(updateEndpointGatewayPath)) + 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{"testString"})) + 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/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke UpdateEndpointGateway 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.UpdateEndpointGateway(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the EndpointGatewayPatch model + endpointGatewayPatchModel := new(vpcv1.EndpointGatewayPatch) + endpointGatewayPatchModel.Name = core.StringPtr("my-endpoint-gateway") + endpointGatewayPatchModelAsPatch, asPatchErr := endpointGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateEndpointGatewayOptions model + updateEndpointGatewayOptionsModel := new(vpcv1.UpdateEndpointGatewayOptions) + updateEndpointGatewayOptionsModel.ID = core.StringPtr("testString") + updateEndpointGatewayOptionsModel.EndpointGatewayPatch = endpointGatewayPatchModelAsPatch + updateEndpointGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateEndpointGateway(updateEndpointGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateEndpointGateway 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 EndpointGatewayPatch model + endpointGatewayPatchModel := new(vpcv1.EndpointGatewayPatch) + endpointGatewayPatchModel.Name = core.StringPtr("my-endpoint-gateway") + endpointGatewayPatchModelAsPatch, asPatchErr := endpointGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateEndpointGatewayOptions model + updateEndpointGatewayOptionsModel := new(vpcv1.UpdateEndpointGatewayOptions) + updateEndpointGatewayOptionsModel.ID = core.StringPtr("testString") + updateEndpointGatewayOptionsModel.EndpointGatewayPatch = endpointGatewayPatchModelAsPatch + updateEndpointGatewayOptionsModel.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.UpdateEndpointGateway(updateEndpointGatewayOptionsModel) + 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 UpdateEndpointGatewayOptions model with no property values + updateEndpointGatewayOptionsModelNew := new(vpcv1.UpdateEndpointGatewayOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateEndpointGateway(updateEndpointGatewayOptionsModelNew) + 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 UpdateEndpointGateway 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 EndpointGatewayPatch model + endpointGatewayPatchModel := new(vpcv1.EndpointGatewayPatch) + endpointGatewayPatchModel.Name = core.StringPtr("my-endpoint-gateway") + endpointGatewayPatchModelAsPatch, asPatchErr := endpointGatewayPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateEndpointGatewayOptions model + updateEndpointGatewayOptionsModel := new(vpcv1.UpdateEndpointGatewayOptions) + updateEndpointGatewayOptionsModel.ID = core.StringPtr("testString") + updateEndpointGatewayOptionsModel.EndpointGatewayPatch = endpointGatewayPatchModelAsPatch + updateEndpointGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateEndpointGateway(updateEndpointGatewayOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) - Operation response error`, func() { + version := "testString" + listFlowLogCollectorsPath := "/flow_log_collectors" + 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(listFlowLogCollectorsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target.resource_type"]).To(Equal([]string{"instance"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListFlowLogCollectors 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 ListFlowLogCollectorsOptions model + listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) + listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCCRN = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCName = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.TargetID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.TargetResourceType = core.StringPtr("instance") + listFlowLogCollectorsOptionsModel.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.ListFlowLogCollectors(listFlowLogCollectorsOptionsModel) + 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.ListFlowLogCollectors(listFlowLogCollectorsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions)`, func() { + version := "testString" + listFlowLogCollectorsPath := "/flow_log_collectors" + 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(listFlowLogCollectorsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target.resource_type"]).To(Equal([]string{"instance"})) + // 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/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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) + })) + }) + It(`Invoke ListFlowLogCollectors 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 ListFlowLogCollectorsOptions model + listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) + listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCCRN = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCName = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.TargetID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.TargetResourceType = core.StringPtr("instance") + listFlowLogCollectorsOptionsModel.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.ListFlowLogCollectorsWithContext(ctx, listFlowLogCollectorsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListFlowLogCollectors(listFlowLogCollectorsOptionsModel) + 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.ListFlowLogCollectorsWithContext(ctx, listFlowLogCollectorsOptionsModel) + 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(listFlowLogCollectorsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target.resource_type"]).To(Equal([]string{"instance"})) + // 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) + })) + }) + It(`Invoke ListFlowLogCollectors 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.ListFlowLogCollectors(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListFlowLogCollectorsOptions model + listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) + listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCCRN = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCName = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.TargetID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.TargetResourceType = core.StringPtr("instance") + listFlowLogCollectorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListFlowLogCollectors(listFlowLogCollectorsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListFlowLogCollectors 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 ListFlowLogCollectorsOptions model + listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) + listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCCRN = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCName = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.TargetID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.TargetResourceType = core.StringPtr("instance") + listFlowLogCollectorsOptionsModel.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.ListFlowLogCollectors(listFlowLogCollectorsOptionsModel) + 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 ListFlowLogCollectors 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 ListFlowLogCollectorsOptions model + listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) + listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCCRN = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.VPCName = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.TargetID = core.StringPtr("testString") + listFlowLogCollectorsOptionsModel.TargetResourceType = core.StringPtr("instance") + listFlowLogCollectorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListFlowLogCollectors(listFlowLogCollectorsOptionsModel) + 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.FlowLogCollectorCollection) + nextObject := new(vpcv1.FlowLogCollectorCollectionNext) + 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.FlowLogCollectorCollection) + + 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.FlowLogCollectorCollection) + nextObject := new(vpcv1.FlowLogCollectorCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateFlowLogCollector(createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) - Operation response error`, func() { + version := "testString" + createFlowLogCollectorPath := "/flow_log_collectors" + 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(createFlowLogCollectorPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 CreateFlowLogCollector 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 LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model + legacyCloudObjectStorageBucketIdentityModel := new(vpcv1.LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) + legacyCloudObjectStorageBucketIdentityModel.Name = core.StringPtr("bucket-27200-lwx4cfvcue") + + // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID model + flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateFlowLogCollectorOptions model + createFlowLogCollectorOptionsModel := new(vpcv1.CreateFlowLogCollectorOptions) + createFlowLogCollectorOptionsModel.StorageBucket = legacyCloudObjectStorageBucketIdentityModel + createFlowLogCollectorOptionsModel.Target = flowLogCollectorTargetPrototypeModel + createFlowLogCollectorOptionsModel.Active = core.BoolPtr(false) + createFlowLogCollectorOptionsModel.Name = core.StringPtr("my-flow-log-collector") + createFlowLogCollectorOptionsModel.ResourceGroup = resourceGroupIdentityModel + createFlowLogCollectorOptionsModel.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.CreateFlowLogCollector(createFlowLogCollectorOptionsModel) + 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.CreateFlowLogCollector(createFlowLogCollectorOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateFlowLogCollector(createFlowLogCollectorOptions *CreateFlowLogCollectorOptions)`, func() { + version := "testString" + createFlowLogCollectorPath := "/flow_log_collectors" + 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(createFlowLogCollectorPath)) + 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{"testString"})) + 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", `{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateFlowLogCollector 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 LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model + legacyCloudObjectStorageBucketIdentityModel := new(vpcv1.LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) + legacyCloudObjectStorageBucketIdentityModel.Name = core.StringPtr("bucket-27200-lwx4cfvcue") + + // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID model + flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateFlowLogCollectorOptions model + createFlowLogCollectorOptionsModel := new(vpcv1.CreateFlowLogCollectorOptions) + createFlowLogCollectorOptionsModel.StorageBucket = legacyCloudObjectStorageBucketIdentityModel + createFlowLogCollectorOptionsModel.Target = flowLogCollectorTargetPrototypeModel + createFlowLogCollectorOptionsModel.Active = core.BoolPtr(false) + createFlowLogCollectorOptionsModel.Name = core.StringPtr("my-flow-log-collector") + createFlowLogCollectorOptionsModel.ResourceGroup = resourceGroupIdentityModel + createFlowLogCollectorOptionsModel.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.CreateFlowLogCollectorWithContext(ctx, createFlowLogCollectorOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateFlowLogCollector(createFlowLogCollectorOptionsModel) + 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.CreateFlowLogCollectorWithContext(ctx, createFlowLogCollectorOptionsModel) + 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(createFlowLogCollectorPath)) + 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{"testString"})) + 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, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateFlowLogCollector 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.CreateFlowLogCollector(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model + legacyCloudObjectStorageBucketIdentityModel := new(vpcv1.LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) + legacyCloudObjectStorageBucketIdentityModel.Name = core.StringPtr("bucket-27200-lwx4cfvcue") + + // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID model + flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateFlowLogCollectorOptions model + createFlowLogCollectorOptionsModel := new(vpcv1.CreateFlowLogCollectorOptions) + createFlowLogCollectorOptionsModel.StorageBucket = legacyCloudObjectStorageBucketIdentityModel + createFlowLogCollectorOptionsModel.Target = flowLogCollectorTargetPrototypeModel + createFlowLogCollectorOptionsModel.Active = core.BoolPtr(false) + createFlowLogCollectorOptionsModel.Name = core.StringPtr("my-flow-log-collector") + createFlowLogCollectorOptionsModel.ResourceGroup = resourceGroupIdentityModel + createFlowLogCollectorOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateFlowLogCollector(createFlowLogCollectorOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateFlowLogCollector 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 LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model + legacyCloudObjectStorageBucketIdentityModel := new(vpcv1.LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) + legacyCloudObjectStorageBucketIdentityModel.Name = core.StringPtr("bucket-27200-lwx4cfvcue") + + // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID model + flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateFlowLogCollectorOptions model + createFlowLogCollectorOptionsModel := new(vpcv1.CreateFlowLogCollectorOptions) + createFlowLogCollectorOptionsModel.StorageBucket = legacyCloudObjectStorageBucketIdentityModel + createFlowLogCollectorOptionsModel.Target = flowLogCollectorTargetPrototypeModel + createFlowLogCollectorOptionsModel.Active = core.BoolPtr(false) + createFlowLogCollectorOptionsModel.Name = core.StringPtr("my-flow-log-collector") + createFlowLogCollectorOptionsModel.ResourceGroup = resourceGroupIdentityModel + createFlowLogCollectorOptionsModel.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.CreateFlowLogCollector(createFlowLogCollectorOptionsModel) + 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 CreateFlowLogCollectorOptions model with no property values + createFlowLogCollectorOptionsModelNew := new(vpcv1.CreateFlowLogCollectorOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateFlowLogCollector(createFlowLogCollectorOptionsModelNew) + 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 CreateFlowLogCollector 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 LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model + legacyCloudObjectStorageBucketIdentityModel := new(vpcv1.LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) + legacyCloudObjectStorageBucketIdentityModel.Name = core.StringPtr("bucket-27200-lwx4cfvcue") + + // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID model + flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the CreateFlowLogCollectorOptions model + createFlowLogCollectorOptionsModel := new(vpcv1.CreateFlowLogCollectorOptions) + createFlowLogCollectorOptionsModel.StorageBucket = legacyCloudObjectStorageBucketIdentityModel + createFlowLogCollectorOptionsModel.Target = flowLogCollectorTargetPrototypeModel + createFlowLogCollectorOptionsModel.Active = core.BoolPtr(false) + createFlowLogCollectorOptionsModel.Name = core.StringPtr("my-flow-log-collector") + createFlowLogCollectorOptionsModel.ResourceGroup = resourceGroupIdentityModel + createFlowLogCollectorOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateFlowLogCollector(createFlowLogCollectorOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteFlowLogCollector(deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions)`, func() { + version := "testString" + deleteFlowLogCollectorPath := "/flow_log_collectors/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(deleteFlowLogCollectorPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteFlowLogCollector 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.DeleteFlowLogCollector(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteFlowLogCollectorOptions model + deleteFlowLogCollectorOptionsModel := new(vpcv1.DeleteFlowLogCollectorOptions) + deleteFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") + deleteFlowLogCollectorOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteFlowLogCollector(deleteFlowLogCollectorOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteFlowLogCollector 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 DeleteFlowLogCollectorOptions model + deleteFlowLogCollectorOptionsModel := new(vpcv1.DeleteFlowLogCollectorOptions) + deleteFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") + deleteFlowLogCollectorOptionsModel.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.DeleteFlowLogCollector(deleteFlowLogCollectorOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteFlowLogCollectorOptions model with no property values + deleteFlowLogCollectorOptionsModelNew := new(vpcv1.DeleteFlowLogCollectorOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteFlowLogCollector(deleteFlowLogCollectorOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetFlowLogCollector(getFlowLogCollectorOptions *GetFlowLogCollectorOptions) - Operation response error`, func() { + version := "testString" + getFlowLogCollectorPath := "/flow_log_collectors/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(getFlowLogCollectorPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetFlowLogCollector 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 GetFlowLogCollectorOptions model + getFlowLogCollectorOptionsModel := new(vpcv1.GetFlowLogCollectorOptions) + getFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") + getFlowLogCollectorOptionsModel.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.GetFlowLogCollector(getFlowLogCollectorOptionsModel) + 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.GetFlowLogCollector(getFlowLogCollectorOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetFlowLogCollector(getFlowLogCollectorOptions *GetFlowLogCollectorOptions)`, func() { + version := "testString" + getFlowLogCollectorPath := "/flow_log_collectors/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(getFlowLogCollectorPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetFlowLogCollector 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 GetFlowLogCollectorOptions model + getFlowLogCollectorOptionsModel := new(vpcv1.GetFlowLogCollectorOptions) + getFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") + getFlowLogCollectorOptionsModel.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.GetFlowLogCollectorWithContext(ctx, getFlowLogCollectorOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetFlowLogCollector(getFlowLogCollectorOptionsModel) + 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.GetFlowLogCollectorWithContext(ctx, getFlowLogCollectorOptionsModel) + 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(getFlowLogCollectorPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetFlowLogCollector 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.GetFlowLogCollector(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetFlowLogCollectorOptions model + getFlowLogCollectorOptionsModel := new(vpcv1.GetFlowLogCollectorOptions) + getFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") + getFlowLogCollectorOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetFlowLogCollector(getFlowLogCollectorOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetFlowLogCollector 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 GetFlowLogCollectorOptions model + getFlowLogCollectorOptionsModel := new(vpcv1.GetFlowLogCollectorOptions) + getFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") + getFlowLogCollectorOptionsModel.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.GetFlowLogCollector(getFlowLogCollectorOptionsModel) + 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 GetFlowLogCollectorOptions model with no property values + getFlowLogCollectorOptionsModelNew := new(vpcv1.GetFlowLogCollectorOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetFlowLogCollector(getFlowLogCollectorOptionsModelNew) + 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 GetFlowLogCollector 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 GetFlowLogCollectorOptions model + getFlowLogCollectorOptionsModel := new(vpcv1.GetFlowLogCollectorOptions) + getFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") + getFlowLogCollectorOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetFlowLogCollector(getFlowLogCollectorOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateFlowLogCollector(updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) - Operation response error`, func() { + version := "testString" + updateFlowLogCollectorPath := "/flow_log_collectors/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(updateFlowLogCollectorPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 UpdateFlowLogCollector 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 FlowLogCollectorPatch model + flowLogCollectorPatchModel := new(vpcv1.FlowLogCollectorPatch) + flowLogCollectorPatchModel.Active = core.BoolPtr(true) + flowLogCollectorPatchModel.Name = core.StringPtr("my-flow-log-collector") + flowLogCollectorPatchModelAsPatch, asPatchErr := flowLogCollectorPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateFlowLogCollectorOptions model + updateFlowLogCollectorOptionsModel := new(vpcv1.UpdateFlowLogCollectorOptions) + updateFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") + updateFlowLogCollectorOptionsModel.FlowLogCollectorPatch = flowLogCollectorPatchModelAsPatch + updateFlowLogCollectorOptionsModel.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.UpdateFlowLogCollector(updateFlowLogCollectorOptionsModel) + 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.UpdateFlowLogCollector(updateFlowLogCollectorOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateFlowLogCollector(updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions)`, func() { + version := "testString" + updateFlowLogCollectorPath := "/flow_log_collectors/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(updateFlowLogCollectorPath)) + 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{"testString"})) + 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, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke UpdateFlowLogCollector 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 FlowLogCollectorPatch model + flowLogCollectorPatchModel := new(vpcv1.FlowLogCollectorPatch) + flowLogCollectorPatchModel.Active = core.BoolPtr(true) + flowLogCollectorPatchModel.Name = core.StringPtr("my-flow-log-collector") + flowLogCollectorPatchModelAsPatch, asPatchErr := flowLogCollectorPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateFlowLogCollectorOptions model + updateFlowLogCollectorOptionsModel := new(vpcv1.UpdateFlowLogCollectorOptions) + updateFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") + updateFlowLogCollectorOptionsModel.FlowLogCollectorPatch = flowLogCollectorPatchModelAsPatch + updateFlowLogCollectorOptionsModel.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.UpdateFlowLogCollectorWithContext(ctx, updateFlowLogCollectorOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateFlowLogCollector(updateFlowLogCollectorOptionsModel) + 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.UpdateFlowLogCollectorWithContext(ctx, updateFlowLogCollectorOptionsModel) + 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(updateFlowLogCollectorPath)) + 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{"testString"})) + 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, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke UpdateFlowLogCollector 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.UpdateFlowLogCollector(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the FlowLogCollectorPatch model + flowLogCollectorPatchModel := new(vpcv1.FlowLogCollectorPatch) + flowLogCollectorPatchModel.Active = core.BoolPtr(true) + flowLogCollectorPatchModel.Name = core.StringPtr("my-flow-log-collector") + flowLogCollectorPatchModelAsPatch, asPatchErr := flowLogCollectorPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateFlowLogCollectorOptions model + updateFlowLogCollectorOptionsModel := new(vpcv1.UpdateFlowLogCollectorOptions) + updateFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") + updateFlowLogCollectorOptionsModel.FlowLogCollectorPatch = flowLogCollectorPatchModelAsPatch + updateFlowLogCollectorOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateFlowLogCollector(updateFlowLogCollectorOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateFlowLogCollector 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 FlowLogCollectorPatch model + flowLogCollectorPatchModel := new(vpcv1.FlowLogCollectorPatch) + flowLogCollectorPatchModel.Active = core.BoolPtr(true) + flowLogCollectorPatchModel.Name = core.StringPtr("my-flow-log-collector") + flowLogCollectorPatchModelAsPatch, asPatchErr := flowLogCollectorPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateFlowLogCollectorOptions model + updateFlowLogCollectorOptionsModel := new(vpcv1.UpdateFlowLogCollectorOptions) + updateFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") + updateFlowLogCollectorOptionsModel.FlowLogCollectorPatch = flowLogCollectorPatchModelAsPatch + updateFlowLogCollectorOptionsModel.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.UpdateFlowLogCollector(updateFlowLogCollectorOptionsModel) + 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 UpdateFlowLogCollectorOptions model with no property values + updateFlowLogCollectorOptionsModelNew := new(vpcv1.UpdateFlowLogCollectorOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateFlowLogCollector(updateFlowLogCollectorOptionsModelNew) + 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 UpdateFlowLogCollector 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 FlowLogCollectorPatch model + flowLogCollectorPatchModel := new(vpcv1.FlowLogCollectorPatch) + flowLogCollectorPatchModel.Active = core.BoolPtr(true) + flowLogCollectorPatchModel.Name = core.StringPtr("my-flow-log-collector") + flowLogCollectorPatchModelAsPatch, asPatchErr := flowLogCollectorPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateFlowLogCollectorOptions model + updateFlowLogCollectorOptionsModel := new(vpcv1.UpdateFlowLogCollectorOptions) + updateFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") + updateFlowLogCollectorOptionsModel.FlowLogCollectorPatch = flowLogCollectorPatchModelAsPatch + updateFlowLogCollectorOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateFlowLogCollector(updateFlowLogCollectorOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`Model constructor tests`, func() { + Context(`Using a service client instance`, func() { + version := "testString" + vpcService, _ := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: "http://vpcv1modelgenerator.com", + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + It(`Invoke NewAddBareMetalServerNetworkInterfaceFloatingIPOptions successfully`, func() { + // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model + bareMetalServerID := "testString" + networkInterfaceID := "testString" + id := "testString" + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := vpcService.NewAddBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID, networkInterfaceID, id) + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetBareMetalServerID("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetNetworkInterfaceID("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetID("testString") + addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) + Expect(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewAddEndpointGatewayIPOptions successfully`, func() { + // Construct an instance of the AddEndpointGatewayIPOptions model + endpointGatewayID := "testString" + id := "testString" + addEndpointGatewayIPOptionsModel := vpcService.NewAddEndpointGatewayIPOptions(endpointGatewayID, id) + addEndpointGatewayIPOptionsModel.SetEndpointGatewayID("testString") + addEndpointGatewayIPOptionsModel.SetID("testString") + addEndpointGatewayIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(addEndpointGatewayIPOptionsModel).ToNot(BeNil()) + Expect(addEndpointGatewayIPOptionsModel.EndpointGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(addEndpointGatewayIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(addEndpointGatewayIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewAddInstanceNetworkInterfaceFloatingIPOptions successfully`, func() { + // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model + instanceID := "testString" + networkInterfaceID := "testString" + id := "testString" + addInstanceNetworkInterfaceFloatingIPOptionsModel := vpcService.NewAddInstanceNetworkInterfaceFloatingIPOptions(instanceID, networkInterfaceID, id) + addInstanceNetworkInterfaceFloatingIPOptionsModel.SetInstanceID("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.SetNetworkInterfaceID("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.SetID("testString") + addInstanceNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(addInstanceNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) + Expect(addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(addInstanceNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewAddVPNGatewayConnectionLocalCIDROptions successfully`, func() { + // Construct an instance of the AddVPNGatewayConnectionLocalCIDROptions model + vpnGatewayID := "testString" + id := "testString" + cidrPrefix := "testString" + prefixLength := "testString" + addVPNGatewayConnectionLocalCIDROptionsModel := vpcService.NewAddVPNGatewayConnectionLocalCIDROptions(vpnGatewayID, id, cidrPrefix, prefixLength) + addVPNGatewayConnectionLocalCIDROptionsModel.SetVPNGatewayID("testString") + addVPNGatewayConnectionLocalCIDROptionsModel.SetID("testString") + addVPNGatewayConnectionLocalCIDROptionsModel.SetCIDRPrefix("testString") + addVPNGatewayConnectionLocalCIDROptionsModel.SetPrefixLength("testString") + addVPNGatewayConnectionLocalCIDROptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(addVPNGatewayConnectionLocalCIDROptionsModel).ToNot(BeNil()) + Expect(addVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(addVPNGatewayConnectionLocalCIDROptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(addVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix).To(Equal(core.StringPtr("testString"))) + Expect(addVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength).To(Equal(core.StringPtr("testString"))) + Expect(addVPNGatewayConnectionLocalCIDROptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewAddVPNGatewayConnectionPeerCIDROptions successfully`, func() { + // Construct an instance of the AddVPNGatewayConnectionPeerCIDROptions model + vpnGatewayID := "testString" + id := "testString" + cidrPrefix := "testString" + prefixLength := "testString" + addVPNGatewayConnectionPeerCIDROptionsModel := vpcService.NewAddVPNGatewayConnectionPeerCIDROptions(vpnGatewayID, id, cidrPrefix, prefixLength) + addVPNGatewayConnectionPeerCIDROptionsModel.SetVPNGatewayID("testString") + addVPNGatewayConnectionPeerCIDROptionsModel.SetID("testString") + addVPNGatewayConnectionPeerCIDROptionsModel.SetCIDRPrefix("testString") + addVPNGatewayConnectionPeerCIDROptionsModel.SetPrefixLength("testString") + addVPNGatewayConnectionPeerCIDROptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(addVPNGatewayConnectionPeerCIDROptionsModel).ToNot(BeNil()) + Expect(addVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(addVPNGatewayConnectionPeerCIDROptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(addVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix).To(Equal(core.StringPtr("testString"))) + Expect(addVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength).To(Equal(core.StringPtr("testString"))) + Expect(addVPNGatewayConnectionPeerCIDROptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewBackupPolicyPlanPrototype successfully`, func() { + cronSpec := "*/5 1,2,3 * * *" + _model, err := vpcService.NewBackupPolicyPlanPrototype(cronSpec) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewBareMetalServerInitializationPrototype successfully`, func() { + var image vpcv1.ImageIdentityIntf = nil + keys := []vpcv1.KeyIdentityIntf{} + _, err := vpcService.NewBareMetalServerInitializationPrototype(image, keys) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewBareMetalServerPrimaryNetworkInterfacePrototype successfully`, func() { + var subnet vpcv1.SubnetIdentityIntf = nil + _, err := vpcService.NewBareMetalServerPrimaryNetworkInterfacePrototype(subnet) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewCheckVPNGatewayConnectionLocalCIDROptions successfully`, func() { + // Construct an instance of the CheckVPNGatewayConnectionLocalCIDROptions model + vpnGatewayID := "testString" + id := "testString" + cidrPrefix := "testString" + prefixLength := "testString" + checkVPNGatewayConnectionLocalCIDROptionsModel := vpcService.NewCheckVPNGatewayConnectionLocalCIDROptions(vpnGatewayID, id, cidrPrefix, prefixLength) + checkVPNGatewayConnectionLocalCIDROptionsModel.SetVPNGatewayID("testString") + checkVPNGatewayConnectionLocalCIDROptionsModel.SetID("testString") + checkVPNGatewayConnectionLocalCIDROptionsModel.SetCIDRPrefix("testString") + checkVPNGatewayConnectionLocalCIDROptionsModel.SetPrefixLength("testString") + checkVPNGatewayConnectionLocalCIDROptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(checkVPNGatewayConnectionLocalCIDROptionsModel).ToNot(BeNil()) + Expect(checkVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(checkVPNGatewayConnectionLocalCIDROptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(checkVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix).To(Equal(core.StringPtr("testString"))) + Expect(checkVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength).To(Equal(core.StringPtr("testString"))) + Expect(checkVPNGatewayConnectionLocalCIDROptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCheckVPNGatewayConnectionPeerCIDROptions successfully`, func() { + // Construct an instance of the CheckVPNGatewayConnectionPeerCIDROptions model + vpnGatewayID := "testString" + id := "testString" + cidrPrefix := "testString" + prefixLength := "testString" + checkVPNGatewayConnectionPeerCIDROptionsModel := vpcService.NewCheckVPNGatewayConnectionPeerCIDROptions(vpnGatewayID, id, cidrPrefix, prefixLength) + checkVPNGatewayConnectionPeerCIDROptionsModel.SetVPNGatewayID("testString") + checkVPNGatewayConnectionPeerCIDROptionsModel.SetID("testString") + checkVPNGatewayConnectionPeerCIDROptionsModel.SetCIDRPrefix("testString") + checkVPNGatewayConnectionPeerCIDROptionsModel.SetPrefixLength("testString") + checkVPNGatewayConnectionPeerCIDROptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(checkVPNGatewayConnectionPeerCIDROptionsModel).ToNot(BeNil()) + Expect(checkVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(checkVPNGatewayConnectionPeerCIDROptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(checkVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix).To(Equal(core.StringPtr("testString"))) + Expect(checkVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength).To(Equal(core.StringPtr("testString"))) + Expect(checkVPNGatewayConnectionPeerCIDROptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateBackupPolicyOptions successfully`, func() { + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + Expect(backupPolicyPlanDeletionTriggerPrototypeModel).ToNot(BeNil()) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + Expect(backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter).To(Equal(core.Int64Ptr(int64(20)))) + Expect(backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount).To(Equal(core.Int64Ptr(int64(20)))) + + // Construct an instance of the BackupPolicyPlanPrototype model + backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) + Expect(backupPolicyPlanPrototypeModel).ToNot(BeNil()) + backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} + backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel + backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") + Expect(backupPolicyPlanPrototypeModel.Active).To(Equal(core.BoolPtr(true))) + Expect(backupPolicyPlanPrototypeModel.AttachUserTags).To(Equal([]string{"my-daily-backup-plan"})) + Expect(backupPolicyPlanPrototypeModel.CopyUserTags).To(Equal(core.BoolPtr(true))) + Expect(backupPolicyPlanPrototypeModel.CronSpec).To(Equal(core.StringPtr("*/5 1,2,3 * * *"))) + Expect(backupPolicyPlanPrototypeModel.DeletionTrigger).To(Equal(backupPolicyPlanDeletionTriggerPrototypeModel)) + Expect(backupPolicyPlanPrototypeModel.Name).To(Equal(core.StringPtr("my-policy-plan"))) + + // 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 CreateBackupPolicyOptions model + createBackupPolicyOptionsModel := vpcService.NewCreateBackupPolicyOptions() + createBackupPolicyOptionsModel.SetMatchResourceTypes([]string{"volume"}) + createBackupPolicyOptionsModel.SetMatchUserTags([]string{"my-daily-backup-policy"}) + createBackupPolicyOptionsModel.SetName("my-backup-policy") + createBackupPolicyOptionsModel.SetPlans([]vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel}) + createBackupPolicyOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createBackupPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createBackupPolicyOptionsModel).ToNot(BeNil()) + Expect(createBackupPolicyOptionsModel.MatchResourceTypes).To(Equal([]string{"volume"})) + Expect(createBackupPolicyOptionsModel.MatchUserTags).To(Equal([]string{"my-daily-backup-policy"})) + Expect(createBackupPolicyOptionsModel.Name).To(Equal(core.StringPtr("my-backup-policy"))) + Expect(createBackupPolicyOptionsModel.Plans).To(Equal([]vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel})) + Expect(createBackupPolicyOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createBackupPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateBackupPolicyPlanOptions successfully`, func() { + // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model + backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) + Expect(backupPolicyPlanDeletionTriggerPrototypeModel).ToNot(BeNil()) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) + backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) + Expect(backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter).To(Equal(core.Int64Ptr(int64(20)))) + Expect(backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount).To(Equal(core.Int64Ptr(int64(20)))) + + // Construct an instance of the CreateBackupPolicyPlanOptions model + backupPolicyID := "testString" + createBackupPolicyPlanOptionsCronSpec := "*/5 1,2,3 * * *" + createBackupPolicyPlanOptionsModel := vpcService.NewCreateBackupPolicyPlanOptions(backupPolicyID, createBackupPolicyPlanOptionsCronSpec) + createBackupPolicyPlanOptionsModel.SetBackupPolicyID("testString") + createBackupPolicyPlanOptionsModel.SetCronSpec("*/5 1,2,3 * * *") + createBackupPolicyPlanOptionsModel.SetActive(true) + createBackupPolicyPlanOptionsModel.SetAttachUserTags([]string{"my-daily-backup-plan"}) + createBackupPolicyPlanOptionsModel.SetCopyUserTags(true) + createBackupPolicyPlanOptionsModel.SetDeletionTrigger(backupPolicyPlanDeletionTriggerPrototypeModel) + createBackupPolicyPlanOptionsModel.SetName("my-policy-plan") + createBackupPolicyPlanOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createBackupPolicyPlanOptionsModel).ToNot(BeNil()) + Expect(createBackupPolicyPlanOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) + Expect(createBackupPolicyPlanOptionsModel.CronSpec).To(Equal(core.StringPtr("*/5 1,2,3 * * *"))) + Expect(createBackupPolicyPlanOptionsModel.Active).To(Equal(core.BoolPtr(true))) + Expect(createBackupPolicyPlanOptionsModel.AttachUserTags).To(Equal([]string{"my-daily-backup-plan"})) + Expect(createBackupPolicyPlanOptionsModel.CopyUserTags).To(Equal(core.BoolPtr(true))) + Expect(createBackupPolicyPlanOptionsModel.DeletionTrigger).To(Equal(backupPolicyPlanDeletionTriggerPrototypeModel)) + Expect(createBackupPolicyPlanOptionsModel.Name).To(Equal(core.StringPtr("my-policy-plan"))) + Expect(createBackupPolicyPlanOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateBareMetalServerConsoleAccessTokenOptions successfully`, func() { + // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model + bareMetalServerID := "testString" + createBareMetalServerConsoleAccessTokenOptionsConsoleType := "serial" + createBareMetalServerConsoleAccessTokenOptionsModel := vpcService.NewCreateBareMetalServerConsoleAccessTokenOptions(bareMetalServerID, createBareMetalServerConsoleAccessTokenOptionsConsoleType) + createBareMetalServerConsoleAccessTokenOptionsModel.SetBareMetalServerID("testString") + createBareMetalServerConsoleAccessTokenOptionsModel.SetConsoleType("serial") + createBareMetalServerConsoleAccessTokenOptionsModel.SetForce(false) + createBareMetalServerConsoleAccessTokenOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createBareMetalServerConsoleAccessTokenOptionsModel).ToNot(BeNil()) + Expect(createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType).To(Equal(core.StringPtr("serial"))) + Expect(createBareMetalServerConsoleAccessTokenOptionsModel.Force).To(Equal(core.BoolPtr(false))) + Expect(createBareMetalServerConsoleAccessTokenOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateBareMetalServerNetworkInterfaceOptions successfully`, func() { + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + Expect(networkInterfaceIPPrototypeModel).ToNot(BeNil()) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(networkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(networkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(networkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // 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"))) + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + Expect(subnetIdentityModel).ToNot(BeNil()) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) + + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + Expect(bareMetalServerNetworkInterfacePrototypeModel).ToNot(BeNil()) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + Expect(bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) + Expect(bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) + Expect(bareMetalServerNetworkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-network-interface"))) + Expect(bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) + Expect(bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(bareMetalServerNetworkInterfacePrototypeModel.Subnet).To(Equal(subnetIdentityModel)) + Expect(bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans).To(Equal([]int64{int64(4)})) + Expect(bareMetalServerNetworkInterfacePrototypeModel.InterfaceType).To(Equal(core.StringPtr("pci"))) + + // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model + bareMetalServerID := "testString" + var bareMetalServerNetworkInterfacePrototype vpcv1.BareMetalServerNetworkInterfacePrototypeIntf = nil + createBareMetalServerNetworkInterfaceOptionsModel := vpcService.NewCreateBareMetalServerNetworkInterfaceOptions(bareMetalServerID, bareMetalServerNetworkInterfacePrototype) + createBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerID("testString") + createBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerNetworkInterfacePrototype(bareMetalServerNetworkInterfacePrototypeModel) + createBareMetalServerNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createBareMetalServerNetworkInterfaceOptionsModel).ToNot(BeNil()) + Expect(createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype).To(Equal(bareMetalServerNetworkInterfacePrototypeModel)) + Expect(createBareMetalServerNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateBareMetalServerOptions successfully`, func() { + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + Expect(imageIdentityModel).ToNot(BeNil()) + imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + Expect(imageIdentityModel.ID).To(Equal(core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"))) + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + Expect(keyIdentityModel).ToNot(BeNil()) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + Expect(keyIdentityModel.ID).To(Equal(core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803"))) + + // Construct an instance of the BareMetalServerInitializationPrototype model + bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) + Expect(bareMetalServerInitializationPrototypeModel).ToNot(BeNil()) + bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel + bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") + Expect(bareMetalServerInitializationPrototypeModel.Image).To(Equal(imageIdentityModel)) + Expect(bareMetalServerInitializationPrototypeModel.Keys).To(Equal([]vpcv1.KeyIdentityIntf{keyIdentityModel})) + Expect(bareMetalServerInitializationPrototypeModel.UserData).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + Expect(networkInterfaceIPPrototypeModel).ToNot(BeNil()) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(networkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(networkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(networkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // 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"))) + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + Expect(subnetIdentityModel).ToNot(BeNil()) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) + + // Construct an instance of the BareMetalServerPrimaryNetworkInterfacePrototype model + bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) + Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel).ToNot(BeNil()) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) + Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans).To(Equal([]int64{int64(4)})) + Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) + Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType).To(Equal(core.StringPtr("pci"))) + Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-network-interface"))) + Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) + Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet).To(Equal(subnetIdentityModel)) + + // Construct an instance of the BareMetalServerProfileIdentityByName model + bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) + Expect(bareMetalServerProfileIdentityModel).ToNot(BeNil()) + bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") + Expect(bareMetalServerProfileIdentityModel.Name).To(Equal(core.StringPtr("bx2-metal-192x768"))) + + // 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 BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + Expect(bareMetalServerNetworkInterfacePrototypeModel).ToNot(BeNil()) + bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) + bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel + bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + Expect(bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) + Expect(bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) + Expect(bareMetalServerNetworkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-network-interface"))) + Expect(bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) + Expect(bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(bareMetalServerNetworkInterfacePrototypeModel.Subnet).To(Equal(subnetIdentityModel)) + Expect(bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans).To(Equal([]int64{int64(4)})) + Expect(bareMetalServerNetworkInterfacePrototypeModel.InterfaceType).To(Equal(core.StringPtr("pci"))) + + // 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 VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + Expect(vpcIdentityModel).ToNot(BeNil()) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b"))) + + // Construct an instance of the CreateBareMetalServerOptions model + var createBareMetalServerOptionsInitialization *vpcv1.BareMetalServerInitializationPrototype = nil + var createBareMetalServerOptionsPrimaryNetworkInterface *vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype = nil + var createBareMetalServerOptionsProfile vpcv1.BareMetalServerProfileIdentityIntf = nil + var createBareMetalServerOptionsZone vpcv1.ZoneIdentityIntf = nil + createBareMetalServerOptionsModel := vpcService.NewCreateBareMetalServerOptions(createBareMetalServerOptionsInitialization, createBareMetalServerOptionsPrimaryNetworkInterface, createBareMetalServerOptionsProfile, createBareMetalServerOptionsZone) + createBareMetalServerOptionsModel.SetInitialization(bareMetalServerInitializationPrototypeModel) + createBareMetalServerOptionsModel.SetPrimaryNetworkInterface(bareMetalServerPrimaryNetworkInterfacePrototypeModel) + createBareMetalServerOptionsModel.SetProfile(bareMetalServerProfileIdentityModel) + createBareMetalServerOptionsModel.SetZone(zoneIdentityModel) + createBareMetalServerOptionsModel.SetName("my-bare-metal-server") + createBareMetalServerOptionsModel.SetNetworkInterfaces([]vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel}) + createBareMetalServerOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createBareMetalServerOptionsModel.SetVPC(vpcIdentityModel) + createBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createBareMetalServerOptionsModel).ToNot(BeNil()) + Expect(createBareMetalServerOptionsModel.Initialization).To(Equal(bareMetalServerInitializationPrototypeModel)) + Expect(createBareMetalServerOptionsModel.PrimaryNetworkInterface).To(Equal(bareMetalServerPrimaryNetworkInterfacePrototypeModel)) + Expect(createBareMetalServerOptionsModel.Profile).To(Equal(bareMetalServerProfileIdentityModel)) + Expect(createBareMetalServerOptionsModel.Zone).To(Equal(zoneIdentityModel)) + Expect(createBareMetalServerOptionsModel.Name).To(Equal(core.StringPtr("my-bare-metal-server"))) + Expect(createBareMetalServerOptionsModel.NetworkInterfaces).To(Equal([]vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel})) + Expect(createBareMetalServerOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createBareMetalServerOptionsModel.VPC).To(Equal(vpcIdentityModel)) + Expect(createBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateDedicatedHostGroupOptions successfully`, func() { + // 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 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 CreateDedicatedHostGroupOptions model + createDedicatedHostGroupOptionsModel := vpcService.NewCreateDedicatedHostGroupOptions() + createDedicatedHostGroupOptionsModel.SetClass("mx2") + createDedicatedHostGroupOptionsModel.SetFamily("balanced") + createDedicatedHostGroupOptionsModel.SetName("testString") + createDedicatedHostGroupOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createDedicatedHostGroupOptionsModel.SetZone(zoneIdentityModel) + createDedicatedHostGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createDedicatedHostGroupOptionsModel).ToNot(BeNil()) + Expect(createDedicatedHostGroupOptionsModel.Class).To(Equal(core.StringPtr("mx2"))) + Expect(createDedicatedHostGroupOptionsModel.Family).To(Equal(core.StringPtr("balanced"))) + Expect(createDedicatedHostGroupOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(createDedicatedHostGroupOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createDedicatedHostGroupOptionsModel.Zone).To(Equal(zoneIdentityModel)) + Expect(createDedicatedHostGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateDedicatedHostOptions successfully`, func() { + // Construct an instance of the DedicatedHostProfileIdentityByName model + dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) + Expect(dedicatedHostProfileIdentityModel).ToNot(BeNil()) + dedicatedHostProfileIdentityModel.Name = core.StringPtr("mx2-host-152x1216") + Expect(dedicatedHostProfileIdentityModel.Name).To(Equal(core.StringPtr("mx2-host-152x1216"))) + + // 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 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"))) + + // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model + dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) + Expect(dedicatedHostPrototypeModel).ToNot(BeNil()) + dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) + dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") + dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel + dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel + dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel + Expect(dedicatedHostPrototypeModel.InstancePlacementEnabled).To(Equal(core.BoolPtr(true))) + Expect(dedicatedHostPrototypeModel.Name).To(Equal(core.StringPtr("my-host"))) + Expect(dedicatedHostPrototypeModel.Profile).To(Equal(dedicatedHostProfileIdentityModel)) + Expect(dedicatedHostPrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(dedicatedHostPrototypeModel.Group).To(Equal(dedicatedHostGroupIdentityModel)) + + // Construct an instance of the CreateDedicatedHostOptions model + var dedicatedHostPrototype vpcv1.DedicatedHostPrototypeIntf = nil + createDedicatedHostOptionsModel := vpcService.NewCreateDedicatedHostOptions(dedicatedHostPrototype) + createDedicatedHostOptionsModel.SetDedicatedHostPrototype(dedicatedHostPrototypeModel) + createDedicatedHostOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createDedicatedHostOptionsModel).ToNot(BeNil()) + Expect(createDedicatedHostOptionsModel.DedicatedHostPrototype).To(Equal(dedicatedHostPrototypeModel)) + Expect(createDedicatedHostOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateEndpointGatewayOptions successfully`, func() { + // Construct an instance of the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN model + endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + Expect(endpointGatewayTargetPrototypeModel).ToNot(BeNil()) + endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") + endpointGatewayTargetPrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::") + Expect(endpointGatewayTargetPrototypeModel.ResourceType).To(Equal(core.StringPtr("provider_infrastructure_service"))) + Expect(endpointGatewayTargetPrototypeModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::"))) + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + Expect(vpcIdentityModel).ToNot(BeNil()) + vpcIdentityModel.ID = core.StringPtr("f025b503-ae66-46de-a011-3bd08fd5f7bf") + Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("f025b503-ae66-46de-a011-3bd08fd5f7bf"))) + + // Construct an instance of the EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID model + endpointGatewayReservedIPModel := new(vpcv1.EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) + Expect(endpointGatewayReservedIPModel).ToNot(BeNil()) + endpointGatewayReservedIPModel.ID = core.StringPtr("6d353a0f-aeb1-4ae1-832e-1110d10981bb") + Expect(endpointGatewayReservedIPModel.ID).To(Equal(core.StringPtr("6d353a0f-aeb1-4ae1-832e-1110d10981bb"))) + + // 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 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"))) + + // Construct an instance of the CreateEndpointGatewayOptions model + var createEndpointGatewayOptionsTarget vpcv1.EndpointGatewayTargetPrototypeIntf = nil + var createEndpointGatewayOptionsVPC vpcv1.VPCIdentityIntf = nil + createEndpointGatewayOptionsModel := vpcService.NewCreateEndpointGatewayOptions(createEndpointGatewayOptionsTarget, createEndpointGatewayOptionsVPC) + createEndpointGatewayOptionsModel.SetTarget(endpointGatewayTargetPrototypeModel) + createEndpointGatewayOptionsModel.SetVPC(vpcIdentityModel) + createEndpointGatewayOptionsModel.SetIps([]vpcv1.EndpointGatewayReservedIPIntf{endpointGatewayReservedIPModel}) + createEndpointGatewayOptionsModel.SetName("testString") + createEndpointGatewayOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createEndpointGatewayOptionsModel.SetSecurityGroups([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel}) + createEndpointGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createEndpointGatewayOptionsModel).ToNot(BeNil()) + Expect(createEndpointGatewayOptionsModel.Target).To(Equal(endpointGatewayTargetPrototypeModel)) + Expect(createEndpointGatewayOptionsModel.VPC).To(Equal(vpcIdentityModel)) + Expect(createEndpointGatewayOptionsModel.Ips).To(Equal([]vpcv1.EndpointGatewayReservedIPIntf{endpointGatewayReservedIPModel})) + Expect(createEndpointGatewayOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(createEndpointGatewayOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createEndpointGatewayOptionsModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(createEndpointGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateFloatingIPOptions successfully`, func() { + // 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 FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID model + floatingIPByTargetNetworkInterfaceIdentityModel := new(vpcv1.FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + Expect(floatingIPByTargetNetworkInterfaceIdentityModel).ToNot(BeNil()) + floatingIPByTargetNetworkInterfaceIdentityModel.ID = core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793") + Expect(floatingIPByTargetNetworkInterfaceIdentityModel.ID).To(Equal(core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793"))) + + // Construct an instance of the FloatingIPPrototypeFloatingIPByTarget model + floatingIPPrototypeModel := new(vpcv1.FloatingIPPrototypeFloatingIPByTarget) + Expect(floatingIPPrototypeModel).ToNot(BeNil()) + floatingIPPrototypeModel.Name = core.StringPtr("my-new-floating-ip") + floatingIPPrototypeModel.ResourceGroup = resourceGroupIdentityModel + floatingIPPrototypeModel.Target = floatingIPByTargetNetworkInterfaceIdentityModel + Expect(floatingIPPrototypeModel.Name).To(Equal(core.StringPtr("my-new-floating-ip"))) + Expect(floatingIPPrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(floatingIPPrototypeModel.Target).To(Equal(floatingIPByTargetNetworkInterfaceIdentityModel)) + + // Construct an instance of the CreateFloatingIPOptions model + var floatingIPPrototype vpcv1.FloatingIPPrototypeIntf = nil + createFloatingIPOptionsModel := vpcService.NewCreateFloatingIPOptions(floatingIPPrototype) + createFloatingIPOptionsModel.SetFloatingIPPrototype(floatingIPPrototypeModel) + createFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createFloatingIPOptionsModel).ToNot(BeNil()) + Expect(createFloatingIPOptionsModel.FloatingIPPrototype).To(Equal(floatingIPPrototypeModel)) + Expect(createFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateFlowLogCollectorOptions successfully`, func() { + // Construct an instance of the LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model + legacyCloudObjectStorageBucketIdentityModel := new(vpcv1.LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) + Expect(legacyCloudObjectStorageBucketIdentityModel).ToNot(BeNil()) + legacyCloudObjectStorageBucketIdentityModel.Name = core.StringPtr("bucket-27200-lwx4cfvcue") + Expect(legacyCloudObjectStorageBucketIdentityModel.Name).To(Equal(core.StringPtr("bucket-27200-lwx4cfvcue"))) + + // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID model + flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + Expect(flowLogCollectorTargetPrototypeModel).ToNot(BeNil()) + flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") + Expect(flowLogCollectorTargetPrototypeModel.ID).To(Equal(core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e"))) + + // 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 CreateFlowLogCollectorOptions model + var createFlowLogCollectorOptionsStorageBucket vpcv1.LegacyCloudObjectStorageBucketIdentityIntf = nil + var createFlowLogCollectorOptionsTarget vpcv1.FlowLogCollectorTargetPrototypeIntf = nil + createFlowLogCollectorOptionsModel := vpcService.NewCreateFlowLogCollectorOptions(createFlowLogCollectorOptionsStorageBucket, createFlowLogCollectorOptionsTarget) + createFlowLogCollectorOptionsModel.SetStorageBucket(legacyCloudObjectStorageBucketIdentityModel) + createFlowLogCollectorOptionsModel.SetTarget(flowLogCollectorTargetPrototypeModel) + createFlowLogCollectorOptionsModel.SetActive(false) + createFlowLogCollectorOptionsModel.SetName("my-flow-log-collector") + createFlowLogCollectorOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createFlowLogCollectorOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createFlowLogCollectorOptionsModel).ToNot(BeNil()) + Expect(createFlowLogCollectorOptionsModel.StorageBucket).To(Equal(legacyCloudObjectStorageBucketIdentityModel)) + Expect(createFlowLogCollectorOptionsModel.Target).To(Equal(flowLogCollectorTargetPrototypeModel)) + Expect(createFlowLogCollectorOptionsModel.Active).To(Equal(core.BoolPtr(false))) + Expect(createFlowLogCollectorOptionsModel.Name).To(Equal(core.StringPtr("my-flow-log-collector"))) + Expect(createFlowLogCollectorOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createFlowLogCollectorOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateIkePolicyOptions successfully`, func() { + // 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 CreateIkePolicyOptions model + createIkePolicyOptionsAuthenticationAlgorithm := "md5" + createIkePolicyOptionsDhGroup := int64(14) + createIkePolicyOptionsEncryptionAlgorithm := "aes128" + createIkePolicyOptionsIkeVersion := int64(1) + createIkePolicyOptionsModel := vpcService.NewCreateIkePolicyOptions(createIkePolicyOptionsAuthenticationAlgorithm, createIkePolicyOptionsDhGroup, createIkePolicyOptionsEncryptionAlgorithm, createIkePolicyOptionsIkeVersion) + createIkePolicyOptionsModel.SetAuthenticationAlgorithm("md5") + createIkePolicyOptionsModel.SetDhGroup(int64(14)) + createIkePolicyOptionsModel.SetEncryptionAlgorithm("aes128") + createIkePolicyOptionsModel.SetIkeVersion(int64(1)) + createIkePolicyOptionsModel.SetKeyLifetime(int64(28800)) + createIkePolicyOptionsModel.SetName("my-ike-policy") + createIkePolicyOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createIkePolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createIkePolicyOptionsModel).ToNot(BeNil()) + Expect(createIkePolicyOptionsModel.AuthenticationAlgorithm).To(Equal(core.StringPtr("md5"))) + Expect(createIkePolicyOptionsModel.DhGroup).To(Equal(core.Int64Ptr(int64(14)))) + Expect(createIkePolicyOptionsModel.EncryptionAlgorithm).To(Equal(core.StringPtr("aes128"))) + Expect(createIkePolicyOptionsModel.IkeVersion).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createIkePolicyOptionsModel.KeyLifetime).To(Equal(core.Int64Ptr(int64(28800)))) + Expect(createIkePolicyOptionsModel.Name).To(Equal(core.StringPtr("my-ike-policy"))) + Expect(createIkePolicyOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createIkePolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateImageOptions successfully`, func() { + // 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 EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + Expect(encryptionKeyIdentityModel).ToNot(BeNil()) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + Expect(encryptionKeyIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"))) + + // Construct an instance of the ImageFilePrototype model + imageFilePrototypeModel := new(vpcv1.ImageFilePrototype) + Expect(imageFilePrototypeModel).ToNot(BeNil()) + imageFilePrototypeModel.Href = core.StringPtr("cos://us-south/custom-image-vpc-bucket/customImage-0.vhd") + Expect(imageFilePrototypeModel.Href).To(Equal(core.StringPtr("cos://us-south/custom-image-vpc-bucket/customImage-0.vhd"))) + + // Construct an instance of the OperatingSystemIdentityByName model + operatingSystemIdentityModel := new(vpcv1.OperatingSystemIdentityByName) + Expect(operatingSystemIdentityModel).ToNot(BeNil()) + operatingSystemIdentityModel.Name = core.StringPtr("ubuntu-16-amd64") + Expect(operatingSystemIdentityModel.Name).To(Equal(core.StringPtr("ubuntu-16-amd64"))) + + // Construct an instance of the ImagePrototypeImageByFile model + imagePrototypeModel := new(vpcv1.ImagePrototypeImageByFile) + Expect(imagePrototypeModel).ToNot(BeNil()) + imagePrototypeModel.Name = core.StringPtr("my-image") + imagePrototypeModel.ResourceGroup = resourceGroupIdentityModel + imagePrototypeModel.EncryptedDataKey = core.StringPtr("testString") + imagePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + imagePrototypeModel.File = imageFilePrototypeModel + imagePrototypeModel.OperatingSystem = operatingSystemIdentityModel + Expect(imagePrototypeModel.Name).To(Equal(core.StringPtr("my-image"))) + Expect(imagePrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(imagePrototypeModel.EncryptedDataKey).To(Equal(core.StringPtr("testString"))) + Expect(imagePrototypeModel.EncryptionKey).To(Equal(encryptionKeyIdentityModel)) + Expect(imagePrototypeModel.File).To(Equal(imageFilePrototypeModel)) + Expect(imagePrototypeModel.OperatingSystem).To(Equal(operatingSystemIdentityModel)) + + // Construct an instance of the CreateImageOptions model + var imagePrototype vpcv1.ImagePrototypeIntf = nil + createImageOptionsModel := vpcService.NewCreateImageOptions(imagePrototype) + createImageOptionsModel.SetImagePrototype(imagePrototypeModel) + createImageOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createImageOptionsModel).ToNot(BeNil()) + Expect(createImageOptionsModel.ImagePrototype).To(Equal(imagePrototypeModel)) + Expect(createImageOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateInstanceActionOptions successfully`, func() { + // Construct an instance of the CreateInstanceActionOptions model + instanceID := "testString" + createInstanceActionOptionsType := "reboot" + createInstanceActionOptionsModel := vpcService.NewCreateInstanceActionOptions(instanceID, createInstanceActionOptionsType) + createInstanceActionOptionsModel.SetInstanceID("testString") + createInstanceActionOptionsModel.SetType("reboot") + createInstanceActionOptionsModel.SetForce(true) + createInstanceActionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createInstanceActionOptionsModel).ToNot(BeNil()) + Expect(createInstanceActionOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(createInstanceActionOptionsModel.Type).To(Equal(core.StringPtr("reboot"))) + Expect(createInstanceActionOptionsModel.Force).To(Equal(core.BoolPtr(true))) + Expect(createInstanceActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateInstanceConsoleAccessTokenOptions successfully`, func() { + // Construct an instance of the CreateInstanceConsoleAccessTokenOptions model + instanceID := "testString" + createInstanceConsoleAccessTokenOptionsConsoleType := "serial" + createInstanceConsoleAccessTokenOptionsModel := vpcService.NewCreateInstanceConsoleAccessTokenOptions(instanceID, createInstanceConsoleAccessTokenOptionsConsoleType) + createInstanceConsoleAccessTokenOptionsModel.SetInstanceID("testString") + createInstanceConsoleAccessTokenOptionsModel.SetConsoleType("serial") + createInstanceConsoleAccessTokenOptionsModel.SetForce(false) + createInstanceConsoleAccessTokenOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createInstanceConsoleAccessTokenOptionsModel).ToNot(BeNil()) + Expect(createInstanceConsoleAccessTokenOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(createInstanceConsoleAccessTokenOptionsModel.ConsoleType).To(Equal(core.StringPtr("serial"))) + Expect(createInstanceConsoleAccessTokenOptionsModel.Force).To(Equal(core.BoolPtr(false))) + Expect(createInstanceConsoleAccessTokenOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateInstanceGroupManagerActionOptions successfully`, func() { + // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model + instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) + Expect(instanceGroupManagerScheduledActionGroupPrototypeModel).ToNot(BeNil()) + instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) + Expect(instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount).To(Equal(core.Int64Ptr(int64(10)))) + + // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model + instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) + Expect(instanceGroupManagerActionPrototypeModel).ToNot(BeNil()) + instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") + instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") + instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel + Expect(instanceGroupManagerActionPrototypeModel.Name).To(Equal(core.StringPtr("my-instance-group-manager-action"))) + Expect(instanceGroupManagerActionPrototypeModel.RunAt).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + Expect(instanceGroupManagerActionPrototypeModel.Group).To(Equal(instanceGroupManagerScheduledActionGroupPrototypeModel)) + + // Construct an instance of the CreateInstanceGroupManagerActionOptions model + instanceGroupID := "testString" + instanceGroupManagerID := "testString" + var instanceGroupManagerActionPrototype vpcv1.InstanceGroupManagerActionPrototypeIntf = nil + createInstanceGroupManagerActionOptionsModel := vpcService.NewCreateInstanceGroupManagerActionOptions(instanceGroupID, instanceGroupManagerID, instanceGroupManagerActionPrototype) + createInstanceGroupManagerActionOptionsModel.SetInstanceGroupID("testString") + createInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerID("testString") + createInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerActionPrototype(instanceGroupManagerActionPrototypeModel) + createInstanceGroupManagerActionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createInstanceGroupManagerActionOptionsModel).ToNot(BeNil()) + Expect(createInstanceGroupManagerActionOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) + Expect(createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype).To(Equal(instanceGroupManagerActionPrototypeModel)) + Expect(createInstanceGroupManagerActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateInstanceGroupManagerOptions successfully`, func() { + // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model + instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + Expect(instanceGroupManagerPrototypeModel).ToNot(BeNil()) + 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)) + Expect(instanceGroupManagerPrototypeModel.ManagementEnabled).To(Equal(core.BoolPtr(true))) + Expect(instanceGroupManagerPrototypeModel.Name).To(Equal(core.StringPtr("my-instance-group-manager"))) + Expect(instanceGroupManagerPrototypeModel.AggregationWindow).To(Equal(core.Int64Ptr(int64(120)))) + Expect(instanceGroupManagerPrototypeModel.Cooldown).To(Equal(core.Int64Ptr(int64(210)))) + Expect(instanceGroupManagerPrototypeModel.ManagerType).To(Equal(core.StringPtr("autoscale"))) + Expect(instanceGroupManagerPrototypeModel.MaxMembershipCount).To(Equal(core.Int64Ptr(int64(10)))) + Expect(instanceGroupManagerPrototypeModel.MinMembershipCount).To(Equal(core.Int64Ptr(int64(10)))) + + // Construct an instance of the CreateInstanceGroupManagerOptions model + instanceGroupID := "testString" + var instanceGroupManagerPrototype vpcv1.InstanceGroupManagerPrototypeIntf = nil + createInstanceGroupManagerOptionsModel := vpcService.NewCreateInstanceGroupManagerOptions(instanceGroupID, instanceGroupManagerPrototype) + createInstanceGroupManagerOptionsModel.SetInstanceGroupID("testString") + createInstanceGroupManagerOptionsModel.SetInstanceGroupManagerPrototype(instanceGroupManagerPrototypeModel) + createInstanceGroupManagerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createInstanceGroupManagerOptionsModel).ToNot(BeNil()) + Expect(createInstanceGroupManagerOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype).To(Equal(instanceGroupManagerPrototypeModel)) + Expect(createInstanceGroupManagerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateInstanceGroupManagerPolicyOptions successfully`, func() { + // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model + instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + Expect(instanceGroupManagerPolicyPrototypeModel).ToNot(BeNil()) + 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") + Expect(instanceGroupManagerPolicyPrototypeModel.Name).To(Equal(core.StringPtr("my-instance-group-manager-policy"))) + Expect(instanceGroupManagerPolicyPrototypeModel.MetricType).To(Equal(core.StringPtr("cpu"))) + Expect(instanceGroupManagerPolicyPrototypeModel.MetricValue).To(Equal(core.Int64Ptr(int64(38)))) + Expect(instanceGroupManagerPolicyPrototypeModel.PolicyType).To(Equal(core.StringPtr("target"))) + + // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model + instanceGroupID := "testString" + instanceGroupManagerID := "testString" + var instanceGroupManagerPolicyPrototype vpcv1.InstanceGroupManagerPolicyPrototypeIntf = nil + createInstanceGroupManagerPolicyOptionsModel := vpcService.NewCreateInstanceGroupManagerPolicyOptions(instanceGroupID, instanceGroupManagerID, instanceGroupManagerPolicyPrototype) + createInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupID("testString") + createInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerID("testString") + createInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerPolicyPrototype(instanceGroupManagerPolicyPrototypeModel) + createInstanceGroupManagerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createInstanceGroupManagerPolicyOptionsModel).ToNot(BeNil()) + Expect(createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) + Expect(createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype).To(Equal(instanceGroupManagerPolicyPrototypeModel)) + Expect(createInstanceGroupManagerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateInstanceGroupOptions successfully`, func() { + // Construct an instance of the InstanceTemplateIdentityByID model + instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) + Expect(instanceTemplateIdentityModel).ToNot(BeNil()) + instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + Expect(instanceTemplateIdentityModel.ID).To(Equal(core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803"))) + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + Expect(subnetIdentityModel).ToNot(BeNil()) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) + + // Construct an instance of the LoadBalancerIdentityByID model + loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) + Expect(loadBalancerIdentityModel).ToNot(BeNil()) + loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + Expect(loadBalancerIdentityModel.ID).To(Equal(core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727"))) + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + Expect(loadBalancerPoolIdentityModel).ToNot(BeNil()) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + Expect(loadBalancerPoolIdentityModel.ID).To(Equal(core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004"))) + + // 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 CreateInstanceGroupOptions model + var createInstanceGroupOptionsInstanceTemplate vpcv1.InstanceTemplateIdentityIntf = nil + createInstanceGroupOptionsSubnets := []vpcv1.SubnetIdentityIntf{} + createInstanceGroupOptionsModel := vpcService.NewCreateInstanceGroupOptions(createInstanceGroupOptionsInstanceTemplate, createInstanceGroupOptionsSubnets) + createInstanceGroupOptionsModel.SetInstanceTemplate(instanceTemplateIdentityModel) + createInstanceGroupOptionsModel.SetSubnets([]vpcv1.SubnetIdentityIntf{subnetIdentityModel}) + createInstanceGroupOptionsModel.SetApplicationPort(int64(22)) + createInstanceGroupOptionsModel.SetLoadBalancer(loadBalancerIdentityModel) + createInstanceGroupOptionsModel.SetLoadBalancerPool(loadBalancerPoolIdentityModel) + createInstanceGroupOptionsModel.SetMembershipCount(int64(10)) + createInstanceGroupOptionsModel.SetName("my-instance-group") + createInstanceGroupOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createInstanceGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createInstanceGroupOptionsModel).ToNot(BeNil()) + Expect(createInstanceGroupOptionsModel.InstanceTemplate).To(Equal(instanceTemplateIdentityModel)) + Expect(createInstanceGroupOptionsModel.Subnets).To(Equal([]vpcv1.SubnetIdentityIntf{subnetIdentityModel})) + Expect(createInstanceGroupOptionsModel.ApplicationPort).To(Equal(core.Int64Ptr(int64(22)))) + Expect(createInstanceGroupOptionsModel.LoadBalancer).To(Equal(loadBalancerIdentityModel)) + Expect(createInstanceGroupOptionsModel.LoadBalancerPool).To(Equal(loadBalancerPoolIdentityModel)) + Expect(createInstanceGroupOptionsModel.MembershipCount).To(Equal(core.Int64Ptr(int64(10)))) + Expect(createInstanceGroupOptionsModel.Name).To(Equal(core.StringPtr("my-instance-group"))) + Expect(createInstanceGroupOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createInstanceGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateInstanceNetworkInterfaceOptions successfully`, func() { + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + Expect(subnetIdentityModel).ToNot(BeNil()) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + Expect(networkInterfaceIPPrototypeModel).ToNot(BeNil()) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(networkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(networkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(networkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // 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"))) + + // Construct an instance of the CreateInstanceNetworkInterfaceOptions model + instanceID := "testString" + var createInstanceNetworkInterfaceOptionsSubnet vpcv1.SubnetIdentityIntf = nil + createInstanceNetworkInterfaceOptionsModel := vpcService.NewCreateInstanceNetworkInterfaceOptions(instanceID, createInstanceNetworkInterfaceOptionsSubnet) + createInstanceNetworkInterfaceOptionsModel.SetInstanceID("testString") + createInstanceNetworkInterfaceOptionsModel.SetSubnet(subnetIdentityModel) + createInstanceNetworkInterfaceOptionsModel.SetAllowIPSpoofing(true) + createInstanceNetworkInterfaceOptionsModel.SetName("my-network-interface") + createInstanceNetworkInterfaceOptionsModel.SetPrimaryIP(networkInterfaceIPPrototypeModel) + createInstanceNetworkInterfaceOptionsModel.SetSecurityGroups([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel}) + createInstanceNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createInstanceNetworkInterfaceOptionsModel).ToNot(BeNil()) + Expect(createInstanceNetworkInterfaceOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(createInstanceNetworkInterfaceOptionsModel.Subnet).To(Equal(subnetIdentityModel)) + Expect(createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) + Expect(createInstanceNetworkInterfaceOptionsModel.Name).To(Equal(core.StringPtr("my-network-interface"))) + Expect(createInstanceNetworkInterfaceOptionsModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) + Expect(createInstanceNetworkInterfaceOptionsModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(createInstanceNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateInstanceOptions successfully`, func() { + // Construct an instance of the InstanceAvailabilityPrototype model + instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) + Expect(instanceAvailabilityPrototypeModel).ToNot(BeNil()) + instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") + Expect(instanceAvailabilityPrototypeModel.HostFailure).To(Equal(core.StringPtr("restart"))) + + // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + 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"))) + + // Construct an instance of the InstanceDefaultTrustedProfilePrototype model + instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) + Expect(instanceDefaultTrustedProfilePrototypeModel).ToNot(BeNil()) + instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) + instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel + Expect(instanceDefaultTrustedProfilePrototypeModel.AutoLink).To(Equal(core.BoolPtr(false))) + Expect(instanceDefaultTrustedProfilePrototypeModel.Target).To(Equal(trustedProfileIdentityModel)) + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + Expect(keyIdentityModel).ToNot(BeNil()) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + Expect(keyIdentityModel.ID).To(Equal(core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803"))) + + // Construct an instance of the InstanceMetadataServicePrototype model + instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) + Expect(instanceMetadataServicePrototypeModel).ToNot(BeNil()) + instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) + Expect(instanceMetadataServicePrototypeModel.Enabled).To(Equal(core.BoolPtr(false))) + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + Expect(networkInterfaceIPPrototypeModel).ToNot(BeNil()) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(networkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(networkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(networkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // 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"))) + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + Expect(subnetIdentityModel).ToNot(BeNil()) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) + + // Construct an instance of the NetworkInterfacePrototype model + networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) + Expect(networkInterfacePrototypeModel).ToNot(BeNil()) + networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + networkInterfacePrototypeModel.Subnet = subnetIdentityModel + Expect(networkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) + Expect(networkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-network-interface"))) + Expect(networkInterfacePrototypeModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) + Expect(networkInterfacePrototypeModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(networkInterfacePrototypeModel.Subnet).To(Equal(subnetIdentityModel)) + + // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + Expect(instancePlacementTargetPrototypeModel).ToNot(BeNil()) + instancePlacementTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + Expect(instancePlacementTargetPrototypeModel.ID).To(Equal(core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a"))) + + // Construct an instance of the InstanceProfileIdentityByName model + instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) + Expect(instanceProfileIdentityModel).ToNot(BeNil()) + instanceProfileIdentityModel.Name = core.StringPtr("cx2-16x32") + Expect(instanceProfileIdentityModel.Name).To(Equal(core.StringPtr("cx2-16x32"))) + + // 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 VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID model + volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) + Expect(volumeAttachmentVolumePrototypeInstanceContextModel).ToNot(BeNil()) + volumeAttachmentVolumePrototypeInstanceContextModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + Expect(volumeAttachmentVolumePrototypeInstanceContextModel.ID).To(Equal(core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5"))) + + // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model + volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) + Expect(volumeAttachmentPrototypeInstanceContextModel).ToNot(BeNil()) + volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + Expect(volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete).To(Equal(core.BoolPtr(true))) + Expect(volumeAttachmentPrototypeInstanceContextModel.Name).To(Equal(core.StringPtr("my-volume-attachment"))) + Expect(volumeAttachmentPrototypeInstanceContextModel.Volume).To(Equal(volumeAttachmentVolumePrototypeInstanceContextModel)) + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + Expect(vpcIdentityModel).ToNot(BeNil()) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b"))) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + Expect(encryptionKeyIdentityModel).ToNot(BeNil()) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + Expect(encryptionKeyIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"))) + + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + Expect(volumeProfileIdentityModel).ToNot(BeNil()) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + Expect(volumeProfileIdentityModel.Name).To(Equal(core.StringPtr("general-purpose"))) + + // Construct an instance of the VolumePrototypeInstanceByImageContext model + volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) + Expect(volumePrototypeInstanceByImageContextModel).ToNot(BeNil()) + volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) + volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel + volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") + volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + Expect(volumePrototypeInstanceByImageContextModel.Capacity).To(Equal(core.Int64Ptr(int64(250)))) + Expect(volumePrototypeInstanceByImageContextModel.EncryptionKey).To(Equal(encryptionKeyIdentityModel)) + Expect(volumePrototypeInstanceByImageContextModel.Iops).To(Equal(core.Int64Ptr(int64(10000)))) + Expect(volumePrototypeInstanceByImageContextModel.Name).To(Equal(core.StringPtr("my-volume"))) + Expect(volumePrototypeInstanceByImageContextModel.Profile).To(Equal(volumeProfileIdentityModel)) + + // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model + volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) + Expect(volumeAttachmentPrototypeInstanceByImageContextModel).ToNot(BeNil()) + volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel + Expect(volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete).To(Equal(core.BoolPtr(true))) + Expect(volumeAttachmentPrototypeInstanceByImageContextModel.Name).To(Equal(core.StringPtr("my-volume-attachment"))) + Expect(volumeAttachmentPrototypeInstanceByImageContextModel.Volume).To(Equal(volumePrototypeInstanceByImageContextModel)) + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + Expect(imageIdentityModel).ToNot(BeNil()) + imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + Expect(imageIdentityModel.ID).To(Equal(core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"))) + + // 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 InstancePrototypeInstanceByImage model + instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) + Expect(instancePrototypeModel).ToNot(BeNil()) + instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel + instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel + instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + instancePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel + instancePrototypeModel.Name = core.StringPtr("my-instance") + instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} + instancePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel + instancePrototypeModel.Profile = instanceProfileIdentityModel + instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel + instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instancePrototypeModel.UserData = core.StringPtr("testString") + instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instancePrototypeModel.VPC = vpcIdentityModel + instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel + instancePrototypeModel.Image = imageIdentityModel + instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel + instancePrototypeModel.Zone = zoneIdentityModel + Expect(instancePrototypeModel.AvailabilityPolicy).To(Equal(instanceAvailabilityPrototypeModel)) + Expect(instancePrototypeModel.DefaultTrustedProfile).To(Equal(instanceDefaultTrustedProfilePrototypeModel)) + Expect(instancePrototypeModel.Keys).To(Equal([]vpcv1.KeyIdentityIntf{keyIdentityModel})) + Expect(instancePrototypeModel.MetadataService).To(Equal(instanceMetadataServicePrototypeModel)) + Expect(instancePrototypeModel.Name).To(Equal(core.StringPtr("my-instance"))) + Expect(instancePrototypeModel.NetworkInterfaces).To(Equal([]vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel})) + Expect(instancePrototypeModel.PlacementTarget).To(Equal(instancePlacementTargetPrototypeModel)) + Expect(instancePrototypeModel.Profile).To(Equal(instanceProfileIdentityModel)) + Expect(instancePrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(instancePrototypeModel.TotalVolumeBandwidth).To(Equal(core.Int64Ptr(int64(500)))) + Expect(instancePrototypeModel.UserData).To(Equal(core.StringPtr("testString"))) + Expect(instancePrototypeModel.VolumeAttachments).To(Equal([]vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel})) + Expect(instancePrototypeModel.VPC).To(Equal(vpcIdentityModel)) + Expect(instancePrototypeModel.BootVolumeAttachment).To(Equal(volumeAttachmentPrototypeInstanceByImageContextModel)) + Expect(instancePrototypeModel.Image).To(Equal(imageIdentityModel)) + Expect(instancePrototypeModel.PrimaryNetworkInterface).To(Equal(networkInterfacePrototypeModel)) + Expect(instancePrototypeModel.Zone).To(Equal(zoneIdentityModel)) + + // Construct an instance of the CreateInstanceOptions model + var instancePrototype vpcv1.InstancePrototypeIntf = nil + createInstanceOptionsModel := vpcService.NewCreateInstanceOptions(instancePrototype) + createInstanceOptionsModel.SetInstancePrototype(instancePrototypeModel) + createInstanceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createInstanceOptionsModel).ToNot(BeNil()) + Expect(createInstanceOptionsModel.InstancePrototype).To(Equal(instancePrototypeModel)) + Expect(createInstanceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateInstanceTemplateOptions successfully`, func() { + // Construct an instance of the InstanceAvailabilityPrototype model + instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) + Expect(instanceAvailabilityPrototypeModel).ToNot(BeNil()) + instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") + Expect(instanceAvailabilityPrototypeModel.HostFailure).To(Equal(core.StringPtr("restart"))) + + // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model + trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) + 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"))) + + // Construct an instance of the InstanceDefaultTrustedProfilePrototype model + instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) + Expect(instanceDefaultTrustedProfilePrototypeModel).ToNot(BeNil()) + instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) + instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel + Expect(instanceDefaultTrustedProfilePrototypeModel.AutoLink).To(Equal(core.BoolPtr(false))) + Expect(instanceDefaultTrustedProfilePrototypeModel.Target).To(Equal(trustedProfileIdentityModel)) + + // Construct an instance of the KeyIdentityByID model + keyIdentityModel := new(vpcv1.KeyIdentityByID) + Expect(keyIdentityModel).ToNot(BeNil()) + keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") + Expect(keyIdentityModel.ID).To(Equal(core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803"))) + + // Construct an instance of the InstanceMetadataServicePrototype model + instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) + Expect(instanceMetadataServicePrototypeModel).ToNot(BeNil()) + instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) + Expect(instanceMetadataServicePrototypeModel.Enabled).To(Equal(core.BoolPtr(false))) + + // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model + networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + Expect(networkInterfaceIPPrototypeModel).ToNot(BeNil()) + networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") + networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) + networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") + Expect(networkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) + Expect(networkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(networkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + + // 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"))) + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + Expect(subnetIdentityModel).ToNot(BeNil()) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) + + // Construct an instance of the NetworkInterfacePrototype model + networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) + Expect(networkInterfacePrototypeModel).ToNot(BeNil()) + networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) + networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") + networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel + networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + networkInterfacePrototypeModel.Subnet = subnetIdentityModel + Expect(networkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) + Expect(networkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-network-interface"))) + Expect(networkInterfacePrototypeModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) + Expect(networkInterfacePrototypeModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(networkInterfacePrototypeModel.Subnet).To(Equal(subnetIdentityModel)) + + // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model + instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + Expect(instancePlacementTargetPrototypeModel).ToNot(BeNil()) + instancePlacementTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + Expect(instancePlacementTargetPrototypeModel.ID).To(Equal(core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a"))) + + // Construct an instance of the InstanceProfileIdentityByName model + instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) + Expect(instanceProfileIdentityModel).ToNot(BeNil()) + instanceProfileIdentityModel.Name = core.StringPtr("cx2-16x32") + Expect(instanceProfileIdentityModel.Name).To(Equal(core.StringPtr("cx2-16x32"))) + + // 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 VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID model + volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) + Expect(volumeAttachmentVolumePrototypeInstanceContextModel).ToNot(BeNil()) + volumeAttachmentVolumePrototypeInstanceContextModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + Expect(volumeAttachmentVolumePrototypeInstanceContextModel.ID).To(Equal(core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5"))) + + // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model + volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) + Expect(volumeAttachmentPrototypeInstanceContextModel).ToNot(BeNil()) + volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + Expect(volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete).To(Equal(core.BoolPtr(true))) + Expect(volumeAttachmentPrototypeInstanceContextModel.Name).To(Equal(core.StringPtr("my-volume-attachment"))) + Expect(volumeAttachmentPrototypeInstanceContextModel.Volume).To(Equal(volumeAttachmentVolumePrototypeInstanceContextModel)) + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + Expect(vpcIdentityModel).ToNot(BeNil()) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b"))) + + // Construct an instance of the EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + Expect(encryptionKeyIdentityModel).ToNot(BeNil()) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + Expect(encryptionKeyIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"))) + + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + Expect(volumeProfileIdentityModel).ToNot(BeNil()) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + Expect(volumeProfileIdentityModel.Name).To(Equal(core.StringPtr("general-purpose"))) + + // Construct an instance of the VolumePrototypeInstanceByImageContext model + volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) + Expect(volumePrototypeInstanceByImageContextModel).ToNot(BeNil()) + volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) + volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel + volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") + volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + Expect(volumePrototypeInstanceByImageContextModel.Capacity).To(Equal(core.Int64Ptr(int64(250)))) + Expect(volumePrototypeInstanceByImageContextModel.EncryptionKey).To(Equal(encryptionKeyIdentityModel)) + Expect(volumePrototypeInstanceByImageContextModel.Iops).To(Equal(core.Int64Ptr(int64(10000)))) + Expect(volumePrototypeInstanceByImageContextModel.Name).To(Equal(core.StringPtr("my-volume"))) + Expect(volumePrototypeInstanceByImageContextModel.Profile).To(Equal(volumeProfileIdentityModel)) + + // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model + volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) + Expect(volumeAttachmentPrototypeInstanceByImageContextModel).ToNot(BeNil()) + volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) + volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel + Expect(volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete).To(Equal(core.BoolPtr(true))) + Expect(volumeAttachmentPrototypeInstanceByImageContextModel.Name).To(Equal(core.StringPtr("my-volume-attachment"))) + Expect(volumeAttachmentPrototypeInstanceByImageContextModel.Volume).To(Equal(volumePrototypeInstanceByImageContextModel)) + + // Construct an instance of the ImageIdentityByID model + imageIdentityModel := new(vpcv1.ImageIdentityByID) + Expect(imageIdentityModel).ToNot(BeNil()) + imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") + Expect(imageIdentityModel.ID).To(Equal(core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"))) + + // 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 InstanceTemplatePrototypeInstanceByImage model + instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceByImage) + Expect(instanceTemplatePrototypeModel).ToNot(BeNil()) + instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel + instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel + instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} + instanceTemplatePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel + instanceTemplatePrototypeModel.Name = core.StringPtr("my-instance") + instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} + instanceTemplatePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel + instanceTemplatePrototypeModel.Profile = instanceProfileIdentityModel + instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel + instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) + instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") + instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instanceTemplatePrototypeModel.VPC = vpcIdentityModel + instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel + instanceTemplatePrototypeModel.Image = imageIdentityModel + instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel + instanceTemplatePrototypeModel.Zone = zoneIdentityModel + Expect(instanceTemplatePrototypeModel.AvailabilityPolicy).To(Equal(instanceAvailabilityPrototypeModel)) + Expect(instanceTemplatePrototypeModel.DefaultTrustedProfile).To(Equal(instanceDefaultTrustedProfilePrototypeModel)) + Expect(instanceTemplatePrototypeModel.Keys).To(Equal([]vpcv1.KeyIdentityIntf{keyIdentityModel})) + Expect(instanceTemplatePrototypeModel.MetadataService).To(Equal(instanceMetadataServicePrototypeModel)) + Expect(instanceTemplatePrototypeModel.Name).To(Equal(core.StringPtr("my-instance"))) + Expect(instanceTemplatePrototypeModel.NetworkInterfaces).To(Equal([]vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel})) + Expect(instanceTemplatePrototypeModel.PlacementTarget).To(Equal(instancePlacementTargetPrototypeModel)) + Expect(instanceTemplatePrototypeModel.Profile).To(Equal(instanceProfileIdentityModel)) + Expect(instanceTemplatePrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(instanceTemplatePrototypeModel.TotalVolumeBandwidth).To(Equal(core.Int64Ptr(int64(500)))) + Expect(instanceTemplatePrototypeModel.UserData).To(Equal(core.StringPtr("testString"))) + Expect(instanceTemplatePrototypeModel.VolumeAttachments).To(Equal([]vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel})) + Expect(instanceTemplatePrototypeModel.VPC).To(Equal(vpcIdentityModel)) + Expect(instanceTemplatePrototypeModel.BootVolumeAttachment).To(Equal(volumeAttachmentPrototypeInstanceByImageContextModel)) + Expect(instanceTemplatePrototypeModel.Image).To(Equal(imageIdentityModel)) + Expect(instanceTemplatePrototypeModel.PrimaryNetworkInterface).To(Equal(networkInterfacePrototypeModel)) + Expect(instanceTemplatePrototypeModel.Zone).To(Equal(zoneIdentityModel)) + + // Construct an instance of the CreateInstanceTemplateOptions model + var instanceTemplatePrototype vpcv1.InstanceTemplatePrototypeIntf = nil + createInstanceTemplateOptionsModel := vpcService.NewCreateInstanceTemplateOptions(instanceTemplatePrototype) + createInstanceTemplateOptionsModel.SetInstanceTemplatePrototype(instanceTemplatePrototypeModel) + createInstanceTemplateOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createInstanceTemplateOptionsModel).ToNot(BeNil()) + Expect(createInstanceTemplateOptionsModel.InstanceTemplatePrototype).To(Equal(instanceTemplatePrototypeModel)) + Expect(createInstanceTemplateOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateInstanceVolumeAttachmentOptions successfully`, func() { + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + Expect(volumeAttachmentPrototypeVolumeModel).ToNot(BeNil()) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + Expect(volumeAttachmentPrototypeVolumeModel.ID).To(Equal(core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5"))) + + // Construct an instance of the CreateInstanceVolumeAttachmentOptions model + instanceID := "testString" + var createInstanceVolumeAttachmentOptionsVolume vpcv1.VolumeAttachmentPrototypeVolumeIntf = nil + createInstanceVolumeAttachmentOptionsModel := vpcService.NewCreateInstanceVolumeAttachmentOptions(instanceID, createInstanceVolumeAttachmentOptionsVolume) + createInstanceVolumeAttachmentOptionsModel.SetInstanceID("testString") + createInstanceVolumeAttachmentOptionsModel.SetVolume(volumeAttachmentPrototypeVolumeModel) + createInstanceVolumeAttachmentOptionsModel.SetDeleteVolumeOnInstanceDelete(false) + createInstanceVolumeAttachmentOptionsModel.SetName("my-volume-attachment") + createInstanceVolumeAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createInstanceVolumeAttachmentOptionsModel).ToNot(BeNil()) + Expect(createInstanceVolumeAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(createInstanceVolumeAttachmentOptionsModel.Volume).To(Equal(volumeAttachmentPrototypeVolumeModel)) + Expect(createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete).To(Equal(core.BoolPtr(false))) + Expect(createInstanceVolumeAttachmentOptionsModel.Name).To(Equal(core.StringPtr("my-volume-attachment"))) + Expect(createInstanceVolumeAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateIpsecPolicyOptions successfully`, func() { + // 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 CreateIpsecPolicyOptions model + createIpsecPolicyOptionsAuthenticationAlgorithm := "md5" + createIpsecPolicyOptionsEncryptionAlgorithm := "aes128" + createIpsecPolicyOptionsPfs := "disabled" + createIpsecPolicyOptionsModel := vpcService.NewCreateIpsecPolicyOptions(createIpsecPolicyOptionsAuthenticationAlgorithm, createIpsecPolicyOptionsEncryptionAlgorithm, createIpsecPolicyOptionsPfs) + createIpsecPolicyOptionsModel.SetAuthenticationAlgorithm("md5") + createIpsecPolicyOptionsModel.SetEncryptionAlgorithm("aes128") + createIpsecPolicyOptionsModel.SetPfs("disabled") + createIpsecPolicyOptionsModel.SetKeyLifetime(int64(3600)) + createIpsecPolicyOptionsModel.SetName("my-ipsec-policy") + createIpsecPolicyOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createIpsecPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createIpsecPolicyOptionsModel).ToNot(BeNil()) + Expect(createIpsecPolicyOptionsModel.AuthenticationAlgorithm).To(Equal(core.StringPtr("md5"))) + Expect(createIpsecPolicyOptionsModel.EncryptionAlgorithm).To(Equal(core.StringPtr("aes128"))) + Expect(createIpsecPolicyOptionsModel.Pfs).To(Equal(core.StringPtr("disabled"))) + Expect(createIpsecPolicyOptionsModel.KeyLifetime).To(Equal(core.Int64Ptr(int64(3600)))) + Expect(createIpsecPolicyOptionsModel.Name).To(Equal(core.StringPtr("my-ipsec-policy"))) + Expect(createIpsecPolicyOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createIpsecPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateKeyOptions successfully`, func() { + // 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 CreateKeyOptions model + createKeyOptionsPublicKey := "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En" + createKeyOptionsModel := vpcService.NewCreateKeyOptions(createKeyOptionsPublicKey) + createKeyOptionsModel.SetPublicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En") + createKeyOptionsModel.SetName("my-key") + createKeyOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createKeyOptionsModel.SetType("rsa") + createKeyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createKeyOptionsModel).ToNot(BeNil()) + Expect(createKeyOptionsModel.PublicKey).To(Equal(core.StringPtr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En"))) + Expect(createKeyOptionsModel.Name).To(Equal(core.StringPtr("my-key"))) + Expect(createKeyOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createKeyOptionsModel.Type).To(Equal(core.StringPtr("rsa"))) + Expect(createKeyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateLoadBalancerListenerOptions successfully`, func() { + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + Expect(certificateInstanceIdentityModel).ToNot(BeNil()) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + Expect(certificateInstanceIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"))) + + // Construct an instance of the LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + Expect(loadBalancerPoolIdentityModel).ToNot(BeNil()) + loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + Expect(loadBalancerPoolIdentityModel.ID).To(Equal(core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004"))) + + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + Expect(loadBalancerListenerIdentityModel).ToNot(BeNil()) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + Expect(loadBalancerListenerIdentityModel.ID).To(Equal(core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004"))) + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model + loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) + Expect(loadBalancerListenerHTTPSRedirectPrototypeModel).ToNot(BeNil()) + loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") + Expect(loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode).To(Equal(core.Int64Ptr(int64(301)))) + Expect(loadBalancerListenerHTTPSRedirectPrototypeModel.Listener).To(Equal(loadBalancerListenerIdentityModel)) + Expect(loadBalancerListenerHTTPSRedirectPrototypeModel.URI).To(Equal(core.StringPtr("/example?doc=get"))) + + // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model + loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) + Expect(loadBalancerListenerPolicyRulePrototypeModel).ToNot(BeNil()) + loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") + Expect(loadBalancerListenerPolicyRulePrototypeModel.Condition).To(Equal(core.StringPtr("contains"))) + Expect(loadBalancerListenerPolicyRulePrototypeModel.Field).To(Equal(core.StringPtr("MY-APP-HEADER"))) + Expect(loadBalancerListenerPolicyRulePrototypeModel.Type).To(Equal(core.StringPtr("body"))) + Expect(loadBalancerListenerPolicyRulePrototypeModel.Value).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + Expect(loadBalancerListenerPolicyTargetPrototypeModel).ToNot(BeNil()) + loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + Expect(loadBalancerListenerPolicyTargetPrototypeModel.ID).To(Equal(core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004"))) + + // Construct an instance of the LoadBalancerListenerPolicyPrototype model + loadBalancerListenerPolicyPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyPrototype) + Expect(loadBalancerListenerPolicyPrototypeModel).ToNot(BeNil()) + loadBalancerListenerPolicyPrototypeModel.Action = core.StringPtr("forward") + loadBalancerListenerPolicyPrototypeModel.Name = core.StringPtr("my-policy") + loadBalancerListenerPolicyPrototypeModel.Priority = core.Int64Ptr(int64(5)) + loadBalancerListenerPolicyPrototypeModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} + loadBalancerListenerPolicyPrototypeModel.Target = loadBalancerListenerPolicyTargetPrototypeModel + Expect(loadBalancerListenerPolicyPrototypeModel.Action).To(Equal(core.StringPtr("forward"))) + Expect(loadBalancerListenerPolicyPrototypeModel.Name).To(Equal(core.StringPtr("my-policy"))) + Expect(loadBalancerListenerPolicyPrototypeModel.Priority).To(Equal(core.Int64Ptr(int64(5)))) + Expect(loadBalancerListenerPolicyPrototypeModel.Rules).To(Equal([]vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel})) + Expect(loadBalancerListenerPolicyPrototypeModel.Target).To(Equal(loadBalancerListenerPolicyTargetPrototypeModel)) + + // Construct an instance of the CreateLoadBalancerListenerOptions model + loadBalancerID := "testString" + createLoadBalancerListenerOptionsProtocol := "http" + createLoadBalancerListenerOptionsModel := vpcService.NewCreateLoadBalancerListenerOptions(loadBalancerID, createLoadBalancerListenerOptionsProtocol) + createLoadBalancerListenerOptionsModel.SetLoadBalancerID("testString") + createLoadBalancerListenerOptionsModel.SetProtocol("http") + createLoadBalancerListenerOptionsModel.SetAcceptProxyProtocol(true) + createLoadBalancerListenerOptionsModel.SetCertificateInstance(certificateInstanceIdentityModel) + createLoadBalancerListenerOptionsModel.SetConnectionLimit(int64(2000)) + createLoadBalancerListenerOptionsModel.SetDefaultPool(loadBalancerPoolIdentityModel) + createLoadBalancerListenerOptionsModel.SetHTTPSRedirect(loadBalancerListenerHTTPSRedirectPrototypeModel) + createLoadBalancerListenerOptionsModel.SetPolicies([]vpcv1.LoadBalancerListenerPolicyPrototype{*loadBalancerListenerPolicyPrototypeModel}) + createLoadBalancerListenerOptionsModel.SetPort(int64(443)) + createLoadBalancerListenerOptionsModel.SetPortMax(int64(499)) + createLoadBalancerListenerOptionsModel.SetPortMin(int64(443)) + createLoadBalancerListenerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createLoadBalancerListenerOptionsModel).ToNot(BeNil()) + Expect(createLoadBalancerListenerOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(createLoadBalancerListenerOptionsModel.Protocol).To(Equal(core.StringPtr("http"))) + Expect(createLoadBalancerListenerOptionsModel.AcceptProxyProtocol).To(Equal(core.BoolPtr(true))) + Expect(createLoadBalancerListenerOptionsModel.CertificateInstance).To(Equal(certificateInstanceIdentityModel)) + Expect(createLoadBalancerListenerOptionsModel.ConnectionLimit).To(Equal(core.Int64Ptr(int64(2000)))) + Expect(createLoadBalancerListenerOptionsModel.DefaultPool).To(Equal(loadBalancerPoolIdentityModel)) + Expect(createLoadBalancerListenerOptionsModel.HTTPSRedirect).To(Equal(loadBalancerListenerHTTPSRedirectPrototypeModel)) + Expect(createLoadBalancerListenerOptionsModel.Policies).To(Equal([]vpcv1.LoadBalancerListenerPolicyPrototype{*loadBalancerListenerPolicyPrototypeModel})) + Expect(createLoadBalancerListenerOptionsModel.Port).To(Equal(core.Int64Ptr(int64(443)))) + Expect(createLoadBalancerListenerOptionsModel.PortMax).To(Equal(core.Int64Ptr(int64(499)))) + Expect(createLoadBalancerListenerOptionsModel.PortMin).To(Equal(core.Int64Ptr(int64(443)))) + Expect(createLoadBalancerListenerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateLoadBalancerListenerPolicyOptions successfully`, func() { + // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model + loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) + Expect(loadBalancerListenerPolicyRulePrototypeModel).ToNot(BeNil()) + loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") + loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") + loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") + loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") + Expect(loadBalancerListenerPolicyRulePrototypeModel.Condition).To(Equal(core.StringPtr("contains"))) + Expect(loadBalancerListenerPolicyRulePrototypeModel.Field).To(Equal(core.StringPtr("MY-APP-HEADER"))) + Expect(loadBalancerListenerPolicyRulePrototypeModel.Type).To(Equal(core.StringPtr("body"))) + Expect(loadBalancerListenerPolicyRulePrototypeModel.Value).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model + loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + Expect(loadBalancerListenerPolicyTargetPrototypeModel).ToNot(BeNil()) + loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + Expect(loadBalancerListenerPolicyTargetPrototypeModel.ID).To(Equal(core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004"))) + + // Construct an instance of the CreateLoadBalancerListenerPolicyOptions model + loadBalancerID := "testString" + listenerID := "testString" + createLoadBalancerListenerPolicyOptionsAction := "forward" + createLoadBalancerListenerPolicyOptionsPriority := int64(5) + createLoadBalancerListenerPolicyOptionsModel := vpcService.NewCreateLoadBalancerListenerPolicyOptions(loadBalancerID, listenerID, createLoadBalancerListenerPolicyOptionsAction, createLoadBalancerListenerPolicyOptionsPriority) + createLoadBalancerListenerPolicyOptionsModel.SetLoadBalancerID("testString") + createLoadBalancerListenerPolicyOptionsModel.SetListenerID("testString") + createLoadBalancerListenerPolicyOptionsModel.SetAction("forward") + createLoadBalancerListenerPolicyOptionsModel.SetPriority(int64(5)) + createLoadBalancerListenerPolicyOptionsModel.SetName("my-policy") + createLoadBalancerListenerPolicyOptionsModel.SetRules([]vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel}) + createLoadBalancerListenerPolicyOptionsModel.SetTarget(loadBalancerListenerPolicyTargetPrototypeModel) + createLoadBalancerListenerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createLoadBalancerListenerPolicyOptionsModel).ToNot(BeNil()) + Expect(createLoadBalancerListenerPolicyOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(createLoadBalancerListenerPolicyOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) + Expect(createLoadBalancerListenerPolicyOptionsModel.Action).To(Equal(core.StringPtr("forward"))) + Expect(createLoadBalancerListenerPolicyOptionsModel.Priority).To(Equal(core.Int64Ptr(int64(5)))) + Expect(createLoadBalancerListenerPolicyOptionsModel.Name).To(Equal(core.StringPtr("my-policy"))) + Expect(createLoadBalancerListenerPolicyOptionsModel.Rules).To(Equal([]vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel})) + Expect(createLoadBalancerListenerPolicyOptionsModel.Target).To(Equal(loadBalancerListenerPolicyTargetPrototypeModel)) + Expect(createLoadBalancerListenerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateLoadBalancerListenerPolicyRuleOptions successfully`, func() { + // Construct an instance of the CreateLoadBalancerListenerPolicyRuleOptions model + loadBalancerID := "testString" + listenerID := "testString" + policyID := "testString" + createLoadBalancerListenerPolicyRuleOptionsCondition := "contains" + createLoadBalancerListenerPolicyRuleOptionsType := "body" + createLoadBalancerListenerPolicyRuleOptionsValue := "testString" + createLoadBalancerListenerPolicyRuleOptionsModel := vpcService.NewCreateLoadBalancerListenerPolicyRuleOptions(loadBalancerID, listenerID, policyID, createLoadBalancerListenerPolicyRuleOptionsCondition, createLoadBalancerListenerPolicyRuleOptionsType, createLoadBalancerListenerPolicyRuleOptionsValue) + createLoadBalancerListenerPolicyRuleOptionsModel.SetLoadBalancerID("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.SetListenerID("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.SetPolicyID("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.SetCondition("contains") + createLoadBalancerListenerPolicyRuleOptionsModel.SetType("body") + createLoadBalancerListenerPolicyRuleOptionsModel.SetValue("testString") + createLoadBalancerListenerPolicyRuleOptionsModel.SetField("MY-APP-HEADER") + createLoadBalancerListenerPolicyRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createLoadBalancerListenerPolicyRuleOptionsModel).ToNot(BeNil()) + Expect(createLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(createLoadBalancerListenerPolicyRuleOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) + Expect(createLoadBalancerListenerPolicyRuleOptionsModel.PolicyID).To(Equal(core.StringPtr("testString"))) + Expect(createLoadBalancerListenerPolicyRuleOptionsModel.Condition).To(Equal(core.StringPtr("contains"))) + Expect(createLoadBalancerListenerPolicyRuleOptionsModel.Type).To(Equal(core.StringPtr("body"))) + Expect(createLoadBalancerListenerPolicyRuleOptionsModel.Value).To(Equal(core.StringPtr("testString"))) + Expect(createLoadBalancerListenerPolicyRuleOptionsModel.Field).To(Equal(core.StringPtr("MY-APP-HEADER"))) + Expect(createLoadBalancerListenerPolicyRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateLoadBalancerOptions successfully`, func() { + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + Expect(subnetIdentityModel).ToNot(BeNil()) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) + + // Construct an instance of the LoadBalancerPoolIdentityByName model + loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) + Expect(loadBalancerPoolIdentityByNameModel).ToNot(BeNil()) + loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") + Expect(loadBalancerPoolIdentityByNameModel.Name).To(Equal(core.StringPtr("my-load-balancer-pool"))) + + // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model + loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) + Expect(loadBalancerListenerPrototypeLoadBalancerContextModel).ToNot(BeNil()) + loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) + loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel + loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) + loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) + loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) + loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") + Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol).To(Equal(core.BoolPtr(true))) + Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit).To(Equal(core.Int64Ptr(int64(2000)))) + Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool).To(Equal(loadBalancerPoolIdentityByNameModel)) + Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.Port).To(Equal(core.Int64Ptr(int64(443)))) + Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax).To(Equal(core.Int64Ptr(int64(499)))) + Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin).To(Equal(core.Int64Ptr(int64(443)))) + Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol).To(Equal(core.StringPtr("http"))) + + // Construct an instance of the LoadBalancerLoggingDatapath model + loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) + Expect(loadBalancerLoggingDatapathModel).ToNot(BeNil()) + loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + Expect(loadBalancerLoggingDatapathModel.Active).To(Equal(core.BoolPtr(true))) + + // Construct an instance of the LoadBalancerLogging model + loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) + Expect(loadBalancerLoggingModel).ToNot(BeNil()) + loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + Expect(loadBalancerLoggingModel.Datapath).To(Equal(loadBalancerLoggingDatapathModel)) + + // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model + loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) + Expect(loadBalancerPoolHealthMonitorPrototypeModel).ToNot(BeNil()) + loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") + Expect(loadBalancerPoolHealthMonitorPrototypeModel.Delay).To(Equal(core.Int64Ptr(int64(5)))) + Expect(loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries).To(Equal(core.Int64Ptr(int64(2)))) + Expect(loadBalancerPoolHealthMonitorPrototypeModel.Port).To(Equal(core.Int64Ptr(int64(22)))) + Expect(loadBalancerPoolHealthMonitorPrototypeModel.Timeout).To(Equal(core.Int64Ptr(int64(2)))) + Expect(loadBalancerPoolHealthMonitorPrototypeModel.Type).To(Equal(core.StringPtr("http"))) + Expect(loadBalancerPoolHealthMonitorPrototypeModel.URLPath).To(Equal(core.StringPtr("/"))) + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + Expect(loadBalancerPoolMemberTargetPrototypeModel).ToNot(BeNil()) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a"))) + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + Expect(loadBalancerPoolMemberPrototypeModel).ToNot(BeNil()) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + Expect(loadBalancerPoolMemberPrototypeModel.Port).To(Equal(core.Int64Ptr(int64(80)))) + Expect(loadBalancerPoolMemberPrototypeModel.Target).To(Equal(loadBalancerPoolMemberTargetPrototypeModel)) + Expect(loadBalancerPoolMemberPrototypeModel.Weight).To(Equal(core.Int64Ptr(int64(50)))) + + // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model + loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) + Expect(loadBalancerPoolSessionPersistencePrototypeModel).ToNot(BeNil()) + loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") + Expect(loadBalancerPoolSessionPersistencePrototypeModel.CookieName).To(Equal(core.StringPtr("my-cookie-name"))) + Expect(loadBalancerPoolSessionPersistencePrototypeModel.Type).To(Equal(core.StringPtr("app_cookie"))) + + // Construct an instance of the LoadBalancerPoolPrototype model + loadBalancerPoolPrototypeModel := new(vpcv1.LoadBalancerPoolPrototype) + Expect(loadBalancerPoolPrototypeModel).ToNot(BeNil()) + loadBalancerPoolPrototypeModel.Algorithm = core.StringPtr("least_connections") + loadBalancerPoolPrototypeModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel + loadBalancerPoolPrototypeModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} + loadBalancerPoolPrototypeModel.Name = core.StringPtr("my-load-balancer-pool") + loadBalancerPoolPrototypeModel.Protocol = core.StringPtr("http") + loadBalancerPoolPrototypeModel.ProxyProtocol = core.StringPtr("disabled") + loadBalancerPoolPrototypeModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel + Expect(loadBalancerPoolPrototypeModel.Algorithm).To(Equal(core.StringPtr("least_connections"))) + Expect(loadBalancerPoolPrototypeModel.HealthMonitor).To(Equal(loadBalancerPoolHealthMonitorPrototypeModel)) + Expect(loadBalancerPoolPrototypeModel.Members).To(Equal([]vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel})) + Expect(loadBalancerPoolPrototypeModel.Name).To(Equal(core.StringPtr("my-load-balancer-pool"))) + Expect(loadBalancerPoolPrototypeModel.Protocol).To(Equal(core.StringPtr("http"))) + Expect(loadBalancerPoolPrototypeModel.ProxyProtocol).To(Equal(core.StringPtr("disabled"))) + Expect(loadBalancerPoolPrototypeModel.SessionPersistence).To(Equal(loadBalancerPoolSessionPersistencePrototypeModel)) + + // Construct an instance of the LoadBalancerProfileIdentityByName model + loadBalancerProfileIdentityModel := new(vpcv1.LoadBalancerProfileIdentityByName) + Expect(loadBalancerProfileIdentityModel).ToNot(BeNil()) + loadBalancerProfileIdentityModel.Name = core.StringPtr("network-fixed") + Expect(loadBalancerProfileIdentityModel.Name).To(Equal(core.StringPtr("network-fixed"))) + + // 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 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"))) + + // Construct an instance of the CreateLoadBalancerOptions model + createLoadBalancerOptionsIsPublic := true + createLoadBalancerOptionsSubnets := []vpcv1.SubnetIdentityIntf{} + createLoadBalancerOptionsModel := vpcService.NewCreateLoadBalancerOptions(createLoadBalancerOptionsIsPublic, createLoadBalancerOptionsSubnets) + createLoadBalancerOptionsModel.SetIsPublic(true) + createLoadBalancerOptionsModel.SetSubnets([]vpcv1.SubnetIdentityIntf{subnetIdentityModel}) + createLoadBalancerOptionsModel.SetListeners([]vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel}) + createLoadBalancerOptionsModel.SetLogging(loadBalancerLoggingModel) + createLoadBalancerOptionsModel.SetName("my-load-balancer") + createLoadBalancerOptionsModel.SetPools([]vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel}) + createLoadBalancerOptionsModel.SetProfile(loadBalancerProfileIdentityModel) + createLoadBalancerOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createLoadBalancerOptionsModel.SetRouteMode(true) + createLoadBalancerOptionsModel.SetSecurityGroups([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel}) + createLoadBalancerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createLoadBalancerOptionsModel).ToNot(BeNil()) + Expect(createLoadBalancerOptionsModel.IsPublic).To(Equal(core.BoolPtr(true))) + Expect(createLoadBalancerOptionsModel.Subnets).To(Equal([]vpcv1.SubnetIdentityIntf{subnetIdentityModel})) + Expect(createLoadBalancerOptionsModel.Listeners).To(Equal([]vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel})) + Expect(createLoadBalancerOptionsModel.Logging).To(Equal(loadBalancerLoggingModel)) + Expect(createLoadBalancerOptionsModel.Name).To(Equal(core.StringPtr("my-load-balancer"))) + Expect(createLoadBalancerOptionsModel.Pools).To(Equal([]vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel})) + Expect(createLoadBalancerOptionsModel.Profile).To(Equal(loadBalancerProfileIdentityModel)) + Expect(createLoadBalancerOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createLoadBalancerOptionsModel.RouteMode).To(Equal(core.BoolPtr(true))) + Expect(createLoadBalancerOptionsModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(createLoadBalancerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateLoadBalancerPoolMemberOptions successfully`, func() { + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + Expect(loadBalancerPoolMemberTargetPrototypeModel).ToNot(BeNil()) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a"))) + + // Construct an instance of the CreateLoadBalancerPoolMemberOptions model + loadBalancerID := "testString" + poolID := "testString" + createLoadBalancerPoolMemberOptionsPort := int64(80) + var createLoadBalancerPoolMemberOptionsTarget vpcv1.LoadBalancerPoolMemberTargetPrototypeIntf = nil + createLoadBalancerPoolMemberOptionsModel := vpcService.NewCreateLoadBalancerPoolMemberOptions(loadBalancerID, poolID, createLoadBalancerPoolMemberOptionsPort, createLoadBalancerPoolMemberOptionsTarget) + createLoadBalancerPoolMemberOptionsModel.SetLoadBalancerID("testString") + createLoadBalancerPoolMemberOptionsModel.SetPoolID("testString") + createLoadBalancerPoolMemberOptionsModel.SetPort(int64(80)) + createLoadBalancerPoolMemberOptionsModel.SetTarget(loadBalancerPoolMemberTargetPrototypeModel) + createLoadBalancerPoolMemberOptionsModel.SetWeight(int64(50)) + createLoadBalancerPoolMemberOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createLoadBalancerPoolMemberOptionsModel).ToNot(BeNil()) + Expect(createLoadBalancerPoolMemberOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(createLoadBalancerPoolMemberOptionsModel.PoolID).To(Equal(core.StringPtr("testString"))) + Expect(createLoadBalancerPoolMemberOptionsModel.Port).To(Equal(core.Int64Ptr(int64(80)))) + Expect(createLoadBalancerPoolMemberOptionsModel.Target).To(Equal(loadBalancerPoolMemberTargetPrototypeModel)) + Expect(createLoadBalancerPoolMemberOptionsModel.Weight).To(Equal(core.Int64Ptr(int64(50)))) + Expect(createLoadBalancerPoolMemberOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateLoadBalancerPoolOptions successfully`, func() { + // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model + loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) + Expect(loadBalancerPoolHealthMonitorPrototypeModel).ToNot(BeNil()) + loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) + loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) + loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) + loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") + loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") + Expect(loadBalancerPoolHealthMonitorPrototypeModel.Delay).To(Equal(core.Int64Ptr(int64(5)))) + Expect(loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries).To(Equal(core.Int64Ptr(int64(2)))) + Expect(loadBalancerPoolHealthMonitorPrototypeModel.Port).To(Equal(core.Int64Ptr(int64(22)))) + Expect(loadBalancerPoolHealthMonitorPrototypeModel.Timeout).To(Equal(core.Int64Ptr(int64(2)))) + Expect(loadBalancerPoolHealthMonitorPrototypeModel.Type).To(Equal(core.StringPtr("http"))) + Expect(loadBalancerPoolHealthMonitorPrototypeModel.URLPath).To(Equal(core.StringPtr("/"))) + + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + Expect(loadBalancerPoolMemberTargetPrototypeModel).ToNot(BeNil()) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a"))) + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + Expect(loadBalancerPoolMemberPrototypeModel).ToNot(BeNil()) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + Expect(loadBalancerPoolMemberPrototypeModel.Port).To(Equal(core.Int64Ptr(int64(80)))) + Expect(loadBalancerPoolMemberPrototypeModel.Target).To(Equal(loadBalancerPoolMemberTargetPrototypeModel)) + Expect(loadBalancerPoolMemberPrototypeModel.Weight).To(Equal(core.Int64Ptr(int64(50)))) + + // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model + loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) + Expect(loadBalancerPoolSessionPersistencePrototypeModel).ToNot(BeNil()) + loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") + loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") + Expect(loadBalancerPoolSessionPersistencePrototypeModel.CookieName).To(Equal(core.StringPtr("my-cookie-name"))) + Expect(loadBalancerPoolSessionPersistencePrototypeModel.Type).To(Equal(core.StringPtr("app_cookie"))) + + // Construct an instance of the CreateLoadBalancerPoolOptions model + loadBalancerID := "testString" + createLoadBalancerPoolOptionsAlgorithm := "least_connections" + var createLoadBalancerPoolOptionsHealthMonitor *vpcv1.LoadBalancerPoolHealthMonitorPrototype = nil + createLoadBalancerPoolOptionsProtocol := "http" + createLoadBalancerPoolOptionsModel := vpcService.NewCreateLoadBalancerPoolOptions(loadBalancerID, createLoadBalancerPoolOptionsAlgorithm, createLoadBalancerPoolOptionsHealthMonitor, createLoadBalancerPoolOptionsProtocol) + createLoadBalancerPoolOptionsModel.SetLoadBalancerID("testString") + createLoadBalancerPoolOptionsModel.SetAlgorithm("least_connections") + createLoadBalancerPoolOptionsModel.SetHealthMonitor(loadBalancerPoolHealthMonitorPrototypeModel) + createLoadBalancerPoolOptionsModel.SetProtocol("http") + createLoadBalancerPoolOptionsModel.SetMembers([]vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel}) + createLoadBalancerPoolOptionsModel.SetName("my-load-balancer-pool") + createLoadBalancerPoolOptionsModel.SetProxyProtocol("disabled") + createLoadBalancerPoolOptionsModel.SetSessionPersistence(loadBalancerPoolSessionPersistencePrototypeModel) + createLoadBalancerPoolOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createLoadBalancerPoolOptionsModel).ToNot(BeNil()) + Expect(createLoadBalancerPoolOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(createLoadBalancerPoolOptionsModel.Algorithm).To(Equal(core.StringPtr("least_connections"))) + Expect(createLoadBalancerPoolOptionsModel.HealthMonitor).To(Equal(loadBalancerPoolHealthMonitorPrototypeModel)) + Expect(createLoadBalancerPoolOptionsModel.Protocol).To(Equal(core.StringPtr("http"))) + Expect(createLoadBalancerPoolOptionsModel.Members).To(Equal([]vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel})) + Expect(createLoadBalancerPoolOptionsModel.Name).To(Equal(core.StringPtr("my-load-balancer-pool"))) + Expect(createLoadBalancerPoolOptionsModel.ProxyProtocol).To(Equal(core.StringPtr("disabled"))) + Expect(createLoadBalancerPoolOptionsModel.SessionPersistence).To(Equal(loadBalancerPoolSessionPersistencePrototypeModel)) + Expect(createLoadBalancerPoolOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateNetworkACLOptions successfully`, func() { + // 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 VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + Expect(vpcIdentityModel).ToNot(BeNil()) + vpcIdentityModel.ID = core.StringPtr("cf7cd5a-2f30-4336-a495-6addc820cd61") + Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("cf7cd5a-2f30-4336-a495-6addc820cd61"))) + + // Construct an instance of the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype model + networkACLRulePrototypeNetworkACLContextModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + Expect(networkACLRulePrototypeNetworkACLContextModel).ToNot(BeNil()) + networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") + networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") + networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePrototypeNetworkACLContextModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePrototypeNetworkACLContextModel.Protocol = core.StringPtr("udp") + networkACLRulePrototypeNetworkACLContextModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePrototypeNetworkACLContextModel.SourcePortMin = core.Int64Ptr(int64(49152)) + Expect(networkACLRulePrototypeNetworkACLContextModel.Action).To(Equal(core.StringPtr("allow"))) + Expect(networkACLRulePrototypeNetworkACLContextModel.Destination).To(Equal(core.StringPtr("192.168.3.2/32"))) + Expect(networkACLRulePrototypeNetworkACLContextModel.Direction).To(Equal(core.StringPtr("inbound"))) + Expect(networkACLRulePrototypeNetworkACLContextModel.Name).To(Equal(core.StringPtr("my-rule-2"))) + Expect(networkACLRulePrototypeNetworkACLContextModel.Source).To(Equal(core.StringPtr("192.168.3.2/32"))) + Expect(networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax).To(Equal(core.Int64Ptr(int64(22)))) + Expect(networkACLRulePrototypeNetworkACLContextModel.DestinationPortMin).To(Equal(core.Int64Ptr(int64(22)))) + Expect(networkACLRulePrototypeNetworkACLContextModel.Protocol).To(Equal(core.StringPtr("udp"))) + Expect(networkACLRulePrototypeNetworkACLContextModel.SourcePortMax).To(Equal(core.Int64Ptr(int64(65535)))) + Expect(networkACLRulePrototypeNetworkACLContextModel.SourcePortMin).To(Equal(core.Int64Ptr(int64(49152)))) + + // Construct an instance of the NetworkACLPrototypeNetworkACLByRules model + networkACLPrototypeModel := new(vpcv1.NetworkACLPrototypeNetworkACLByRules) + Expect(networkACLPrototypeModel).ToNot(BeNil()) + networkACLPrototypeModel.Name = core.StringPtr("my-network-acl") + networkACLPrototypeModel.ResourceGroup = resourceGroupIdentityModel + networkACLPrototypeModel.VPC = vpcIdentityModel + networkACLPrototypeModel.Rules = []vpcv1.NetworkACLRulePrototypeNetworkACLContextIntf{networkACLRulePrototypeNetworkACLContextModel} + Expect(networkACLPrototypeModel.Name).To(Equal(core.StringPtr("my-network-acl"))) + Expect(networkACLPrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(networkACLPrototypeModel.VPC).To(Equal(vpcIdentityModel)) + Expect(networkACLPrototypeModel.Rules).To(Equal([]vpcv1.NetworkACLRulePrototypeNetworkACLContextIntf{networkACLRulePrototypeNetworkACLContextModel})) + + // Construct an instance of the CreateNetworkACLOptions model + createNetworkACLOptionsModel := vpcService.NewCreateNetworkACLOptions() + createNetworkACLOptionsModel.SetNetworkACLPrototype(networkACLPrototypeModel) + createNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createNetworkACLOptionsModel).ToNot(BeNil()) + Expect(createNetworkACLOptionsModel.NetworkACLPrototype).To(Equal(networkACLPrototypeModel)) + Expect(createNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateNetworkACLRuleOptions successfully`, func() { + // Construct an instance of the NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID model + networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) + Expect(networkACLRuleBeforePrototypeModel).ToNot(BeNil()) + networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") + Expect(networkACLRuleBeforePrototypeModel.ID).To(Equal(core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9"))) + + // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype model + networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + Expect(networkACLRulePrototypeModel).ToNot(BeNil()) + networkACLRulePrototypeModel.Action = core.StringPtr("allow") + networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel + networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") + networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") + networkACLRulePrototypeModel.Protocol = core.StringPtr("all") + Expect(networkACLRulePrototypeModel.Action).To(Equal(core.StringPtr("allow"))) + Expect(networkACLRulePrototypeModel.Before).To(Equal(networkACLRuleBeforePrototypeModel)) + Expect(networkACLRulePrototypeModel.Destination).To(Equal(core.StringPtr("192.168.3.2/32"))) + Expect(networkACLRulePrototypeModel.Direction).To(Equal(core.StringPtr("inbound"))) + Expect(networkACLRulePrototypeModel.Name).To(Equal(core.StringPtr("my-rule-2"))) + Expect(networkACLRulePrototypeModel.Source).To(Equal(core.StringPtr("192.168.3.2/32"))) + Expect(networkACLRulePrototypeModel.Protocol).To(Equal(core.StringPtr("all"))) + + // Construct an instance of the CreateNetworkACLRuleOptions model + networkACLID := "testString" + var networkACLRulePrototype vpcv1.NetworkACLRulePrototypeIntf = nil + createNetworkACLRuleOptionsModel := vpcService.NewCreateNetworkACLRuleOptions(networkACLID, networkACLRulePrototype) + createNetworkACLRuleOptionsModel.SetNetworkACLID("testString") + createNetworkACLRuleOptionsModel.SetNetworkACLRulePrototype(networkACLRulePrototypeModel) + createNetworkACLRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createNetworkACLRuleOptionsModel).ToNot(BeNil()) + Expect(createNetworkACLRuleOptionsModel.NetworkACLID).To(Equal(core.StringPtr("testString"))) + Expect(createNetworkACLRuleOptionsModel.NetworkACLRulePrototype).To(Equal(networkACLRulePrototypeModel)) + Expect(createNetworkACLRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreatePlacementGroupOptions successfully`, func() { + // 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 CreatePlacementGroupOptions model + createPlacementGroupOptionsStrategy := "host_spread" + createPlacementGroupOptionsModel := vpcService.NewCreatePlacementGroupOptions(createPlacementGroupOptionsStrategy) + createPlacementGroupOptionsModel.SetStrategy("host_spread") + createPlacementGroupOptionsModel.SetName("my-placement-group") + createPlacementGroupOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createPlacementGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createPlacementGroupOptionsModel).ToNot(BeNil()) + Expect(createPlacementGroupOptionsModel.Strategy).To(Equal(core.StringPtr("host_spread"))) + Expect(createPlacementGroupOptionsModel.Name).To(Equal(core.StringPtr("my-placement-group"))) + Expect(createPlacementGroupOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createPlacementGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreatePublicGatewayOptions successfully`, func() { + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + Expect(vpcIdentityModel).ToNot(BeNil()) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("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 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"))) + + // 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 CreatePublicGatewayOptions model + var createPublicGatewayOptionsVPC vpcv1.VPCIdentityIntf = nil + var createPublicGatewayOptionsZone vpcv1.ZoneIdentityIntf = nil + createPublicGatewayOptionsModel := vpcService.NewCreatePublicGatewayOptions(createPublicGatewayOptionsVPC, createPublicGatewayOptionsZone) + createPublicGatewayOptionsModel.SetVPC(vpcIdentityModel) + createPublicGatewayOptionsModel.SetZone(zoneIdentityModel) + createPublicGatewayOptionsModel.SetFloatingIP(publicGatewayFloatingIPPrototypeModel) + createPublicGatewayOptionsModel.SetName("my-public-gateway") + createPublicGatewayOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createPublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createPublicGatewayOptionsModel).ToNot(BeNil()) + Expect(createPublicGatewayOptionsModel.VPC).To(Equal(vpcIdentityModel)) + Expect(createPublicGatewayOptionsModel.Zone).To(Equal(zoneIdentityModel)) + Expect(createPublicGatewayOptionsModel.FloatingIP).To(Equal(publicGatewayFloatingIPPrototypeModel)) + Expect(createPublicGatewayOptionsModel.Name).To(Equal(core.StringPtr("my-public-gateway"))) + Expect(createPublicGatewayOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createPublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateSecurityGroupOptions successfully`, func() { + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + Expect(vpcIdentityModel).ToNot(BeNil()) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b"))) + + // 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 SecurityGroupRuleRemotePrototypeIP model + securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) + Expect(securityGroupRuleRemotePrototypeModel).ToNot(BeNil()) + securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") + Expect(securityGroupRuleRemotePrototypeModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) + + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + Expect(securityGroupRulePrototypeModel).ToNot(BeNil()) + securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") + securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel + securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + Expect(securityGroupRulePrototypeModel.Direction).To(Equal(core.StringPtr("inbound"))) + Expect(securityGroupRulePrototypeModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) + Expect(securityGroupRulePrototypeModel.Remote).To(Equal(securityGroupRuleRemotePrototypeModel)) + Expect(securityGroupRulePrototypeModel.PortMax).To(Equal(core.Int64Ptr(int64(22)))) + Expect(securityGroupRulePrototypeModel.PortMin).To(Equal(core.Int64Ptr(int64(22)))) + Expect(securityGroupRulePrototypeModel.Protocol).To(Equal(core.StringPtr("udp"))) + + // Construct an instance of the CreateSecurityGroupOptions model + var createSecurityGroupOptionsVPC vpcv1.VPCIdentityIntf = nil + createSecurityGroupOptionsModel := vpcService.NewCreateSecurityGroupOptions(createSecurityGroupOptionsVPC) + createSecurityGroupOptionsModel.SetVPC(vpcIdentityModel) + createSecurityGroupOptionsModel.SetName("my-security-group") + createSecurityGroupOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createSecurityGroupOptionsModel.SetRules([]vpcv1.SecurityGroupRulePrototypeIntf{securityGroupRulePrototypeModel}) + createSecurityGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createSecurityGroupOptionsModel).ToNot(BeNil()) + Expect(createSecurityGroupOptionsModel.VPC).To(Equal(vpcIdentityModel)) + Expect(createSecurityGroupOptionsModel.Name).To(Equal(core.StringPtr("my-security-group"))) + Expect(createSecurityGroupOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createSecurityGroupOptionsModel.Rules).To(Equal([]vpcv1.SecurityGroupRulePrototypeIntf{securityGroupRulePrototypeModel})) + Expect(createSecurityGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateSecurityGroupRuleOptions successfully`, func() { + // Construct an instance of the SecurityGroupRuleRemotePrototypeIP model + securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) + Expect(securityGroupRuleRemotePrototypeModel).ToNot(BeNil()) + securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") + Expect(securityGroupRuleRemotePrototypeModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) + + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + Expect(securityGroupRulePrototypeModel).ToNot(BeNil()) + securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") + securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel + securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) + securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + Expect(securityGroupRulePrototypeModel.Direction).To(Equal(core.StringPtr("inbound"))) + Expect(securityGroupRulePrototypeModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) + Expect(securityGroupRulePrototypeModel.Remote).To(Equal(securityGroupRuleRemotePrototypeModel)) + Expect(securityGroupRulePrototypeModel.PortMax).To(Equal(core.Int64Ptr(int64(22)))) + Expect(securityGroupRulePrototypeModel.PortMin).To(Equal(core.Int64Ptr(int64(22)))) + Expect(securityGroupRulePrototypeModel.Protocol).To(Equal(core.StringPtr("udp"))) + + // Construct an instance of the CreateSecurityGroupRuleOptions model + securityGroupID := "testString" + var securityGroupRulePrototype vpcv1.SecurityGroupRulePrototypeIntf = nil + createSecurityGroupRuleOptionsModel := vpcService.NewCreateSecurityGroupRuleOptions(securityGroupID, securityGroupRulePrototype) + createSecurityGroupRuleOptionsModel.SetSecurityGroupID("testString") + createSecurityGroupRuleOptionsModel.SetSecurityGroupRulePrototype(securityGroupRulePrototypeModel) + createSecurityGroupRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createSecurityGroupRuleOptionsModel).ToNot(BeNil()) + Expect(createSecurityGroupRuleOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) + Expect(createSecurityGroupRuleOptionsModel.SecurityGroupRulePrototype).To(Equal(securityGroupRulePrototypeModel)) + Expect(createSecurityGroupRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateSecurityGroupTargetBindingOptions successfully`, func() { + // Construct an instance of the CreateSecurityGroupTargetBindingOptions model + securityGroupID := "testString" + id := "testString" + createSecurityGroupTargetBindingOptionsModel := vpcService.NewCreateSecurityGroupTargetBindingOptions(securityGroupID, id) + createSecurityGroupTargetBindingOptionsModel.SetSecurityGroupID("testString") + createSecurityGroupTargetBindingOptionsModel.SetID("testString") + createSecurityGroupTargetBindingOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createSecurityGroupTargetBindingOptionsModel).ToNot(BeNil()) + Expect(createSecurityGroupTargetBindingOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) + Expect(createSecurityGroupTargetBindingOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(createSecurityGroupTargetBindingOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateSnapshotOptions successfully`, func() { + // 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 VolumeIdentityByID model + volumeIdentityModel := new(vpcv1.VolumeIdentityByID) + Expect(volumeIdentityModel).ToNot(BeNil()) + volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + Expect(volumeIdentityModel.ID).To(Equal(core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5"))) + + // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model + snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) + Expect(snapshotPrototypeModel).ToNot(BeNil()) + snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") + snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel + snapshotPrototypeModel.UserTags = []string{"testString"} + snapshotPrototypeModel.SourceVolume = volumeIdentityModel + Expect(snapshotPrototypeModel.Name).To(Equal(core.StringPtr("my-snapshot"))) + Expect(snapshotPrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(snapshotPrototypeModel.UserTags).To(Equal([]string{"testString"})) + Expect(snapshotPrototypeModel.SourceVolume).To(Equal(volumeIdentityModel)) + + // Construct an instance of the CreateSnapshotOptions model + var snapshotPrototype vpcv1.SnapshotPrototypeIntf = nil + createSnapshotOptionsModel := vpcService.NewCreateSnapshotOptions(snapshotPrototype) + createSnapshotOptionsModel.SetSnapshotPrototype(snapshotPrototypeModel) + createSnapshotOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createSnapshotOptionsModel).ToNot(BeNil()) + Expect(createSnapshotOptionsModel.SnapshotPrototype).To(Equal(snapshotPrototypeModel)) + Expect(createSnapshotOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateSubnetOptions successfully`, func() { + // Construct an instance of the NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + Expect(networkACLIdentityModel).ToNot(BeNil()) + networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + Expect(networkACLIdentityModel.ID).To(Equal(core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf"))) + + // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model + publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) + Expect(publicGatewayIdentityModel).ToNot(BeNil()) + publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") + Expect(publicGatewayIdentityModel.ID).To(Equal(core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241"))) + + // 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 RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + Expect(routingTableIdentityModel).ToNot(BeNil()) + routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") + Expect(routingTableIdentityModel.ID).To(Equal(core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840"))) + + // Construct an instance of the VPCIdentityByID model + vpcIdentityModel := new(vpcv1.VPCIdentityByID) + Expect(vpcIdentityModel).ToNot(BeNil()) + vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") + Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("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 SubnetPrototypeSubnetByTotalCount model + subnetPrototypeModel := new(vpcv1.SubnetPrototypeSubnetByTotalCount) + Expect(subnetPrototypeModel).ToNot(BeNil()) + subnetPrototypeModel.IPVersion = core.StringPtr("ipv4") + subnetPrototypeModel.Name = core.StringPtr("my-subnet") + subnetPrototypeModel.NetworkACL = networkACLIdentityModel + subnetPrototypeModel.PublicGateway = publicGatewayIdentityModel + subnetPrototypeModel.ResourceGroup = resourceGroupIdentityModel + subnetPrototypeModel.RoutingTable = routingTableIdentityModel + subnetPrototypeModel.VPC = vpcIdentityModel + subnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) + subnetPrototypeModel.Zone = zoneIdentityModel + Expect(subnetPrototypeModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) + Expect(subnetPrototypeModel.Name).To(Equal(core.StringPtr("my-subnet"))) + Expect(subnetPrototypeModel.NetworkACL).To(Equal(networkACLIdentityModel)) + Expect(subnetPrototypeModel.PublicGateway).To(Equal(publicGatewayIdentityModel)) + Expect(subnetPrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(subnetPrototypeModel.RoutingTable).To(Equal(routingTableIdentityModel)) + Expect(subnetPrototypeModel.VPC).To(Equal(vpcIdentityModel)) + Expect(subnetPrototypeModel.TotalIpv4AddressCount).To(Equal(core.Int64Ptr(int64(256)))) + Expect(subnetPrototypeModel.Zone).To(Equal(zoneIdentityModel)) + + // Construct an instance of the CreateSubnetOptions model + var subnetPrototype vpcv1.SubnetPrototypeIntf = nil + createSubnetOptionsModel := vpcService.NewCreateSubnetOptions(subnetPrototype) + createSubnetOptionsModel.SetSubnetPrototype(subnetPrototypeModel) + createSubnetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createSubnetOptionsModel).ToNot(BeNil()) + Expect(createSubnetOptionsModel.SubnetPrototype).To(Equal(subnetPrototypeModel)) + Expect(createSubnetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateSubnetReservedIPOptions successfully`, func() { + // Construct an instance of the ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID model + reservedIPTargetPrototypeModel := new(vpcv1.ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) + Expect(reservedIPTargetPrototypeModel).ToNot(BeNil()) + reservedIPTargetPrototypeModel.ID = core.StringPtr("d7cc5196-9864-48c4-82d8-3f30da41fcc5") + Expect(reservedIPTargetPrototypeModel.ID).To(Equal(core.StringPtr("d7cc5196-9864-48c4-82d8-3f30da41fcc5"))) + + // Construct an instance of the CreateSubnetReservedIPOptions model + subnetID := "testString" + createSubnetReservedIPOptionsModel := vpcService.NewCreateSubnetReservedIPOptions(subnetID) + createSubnetReservedIPOptionsModel.SetSubnetID("testString") + createSubnetReservedIPOptionsModel.SetAddress("192.168.3.4") + createSubnetReservedIPOptionsModel.SetAutoDelete(false) + createSubnetReservedIPOptionsModel.SetName("my-reserved-ip") + createSubnetReservedIPOptionsModel.SetTarget(reservedIPTargetPrototypeModel) + createSubnetReservedIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createSubnetReservedIPOptionsModel).ToNot(BeNil()) + Expect(createSubnetReservedIPOptionsModel.SubnetID).To(Equal(core.StringPtr("testString"))) + Expect(createSubnetReservedIPOptionsModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) + Expect(createSubnetReservedIPOptionsModel.AutoDelete).To(Equal(core.BoolPtr(false))) + Expect(createSubnetReservedIPOptionsModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) + Expect(createSubnetReservedIPOptionsModel.Target).To(Equal(reservedIPTargetPrototypeModel)) + Expect(createSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateVolumeOptions successfully`, func() { + // Construct an instance of the VolumeProfileIdentityByName model + volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) + Expect(volumeProfileIdentityModel).ToNot(BeNil()) + volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") + Expect(volumeProfileIdentityModel.Name).To(Equal(core.StringPtr("general-purpose"))) + + // 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 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 EncryptionKeyIdentityByCRN model + encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) + Expect(encryptionKeyIdentityModel).ToNot(BeNil()) + encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") + Expect(encryptionKeyIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"))) + + // Construct an instance of the VolumePrototypeVolumeByCapacity model + volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) + Expect(volumePrototypeModel).ToNot(BeNil()) + volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) + volumePrototypeModel.Name = core.StringPtr("my-volume") + volumePrototypeModel.Profile = volumeProfileIdentityModel + volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel + volumePrototypeModel.UserTags = []string{"testString"} + volumePrototypeModel.Zone = zoneIdentityModel + volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) + volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel + Expect(volumePrototypeModel.Iops).To(Equal(core.Int64Ptr(int64(10000)))) + Expect(volumePrototypeModel.Name).To(Equal(core.StringPtr("my-volume"))) + Expect(volumePrototypeModel.Profile).To(Equal(volumeProfileIdentityModel)) + Expect(volumePrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(volumePrototypeModel.UserTags).To(Equal([]string{"testString"})) + Expect(volumePrototypeModel.Zone).To(Equal(zoneIdentityModel)) + Expect(volumePrototypeModel.Capacity).To(Equal(core.Int64Ptr(int64(100)))) + Expect(volumePrototypeModel.EncryptionKey).To(Equal(encryptionKeyIdentityModel)) + + // Construct an instance of the CreateVolumeOptions model + var volumePrototype vpcv1.VolumePrototypeIntf = nil + createVolumeOptionsModel := vpcService.NewCreateVolumeOptions(volumePrototype) + createVolumeOptionsModel.SetVolumePrototype(volumePrototypeModel) + createVolumeOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createVolumeOptionsModel).ToNot(BeNil()) + Expect(createVolumeOptionsModel.VolumePrototype).To(Equal(volumePrototypeModel)) + Expect(createVolumeOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateVPCAddressPrefixOptions successfully`, func() { + // 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 CreateVPCAddressPrefixOptions model + vpcID := "testString" + createVPCAddressPrefixOptionsCIDR := "10.0.0.0/24" + var createVPCAddressPrefixOptionsZone vpcv1.ZoneIdentityIntf = nil + createVPCAddressPrefixOptionsModel := vpcService.NewCreateVPCAddressPrefixOptions(vpcID, createVPCAddressPrefixOptionsCIDR, createVPCAddressPrefixOptionsZone) + createVPCAddressPrefixOptionsModel.SetVPCID("testString") + createVPCAddressPrefixOptionsModel.SetCIDR("10.0.0.0/24") + createVPCAddressPrefixOptionsModel.SetZone(zoneIdentityModel) + createVPCAddressPrefixOptionsModel.SetIsDefault(true) + createVPCAddressPrefixOptionsModel.SetName("my-address-prefix-2") + createVPCAddressPrefixOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createVPCAddressPrefixOptionsModel).ToNot(BeNil()) + Expect(createVPCAddressPrefixOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(createVPCAddressPrefixOptionsModel.CIDR).To(Equal(core.StringPtr("10.0.0.0/24"))) + Expect(createVPCAddressPrefixOptionsModel.Zone).To(Equal(zoneIdentityModel)) + Expect(createVPCAddressPrefixOptionsModel.IsDefault).To(Equal(core.BoolPtr(true))) + Expect(createVPCAddressPrefixOptionsModel.Name).To(Equal(core.StringPtr("my-address-prefix-2"))) + Expect(createVPCAddressPrefixOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateVPCOptions successfully`, func() { + // 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 CreateVPCOptions model + createVPCOptionsModel := vpcService.NewCreateVPCOptions() + createVPCOptionsModel.SetAddressPrefixManagement("manual") + createVPCOptionsModel.SetClassicAccess(false) + createVPCOptionsModel.SetName("my-vpc") + createVPCOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createVPCOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createVPCOptionsModel).ToNot(BeNil()) + Expect(createVPCOptionsModel.AddressPrefixManagement).To(Equal(core.StringPtr("manual"))) + Expect(createVPCOptionsModel.ClassicAccess).To(Equal(core.BoolPtr(false))) + Expect(createVPCOptionsModel.Name).To(Equal(core.StringPtr("my-vpc"))) + Expect(createVPCOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createVPCOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateVPCRouteOptions successfully`, func() { + // 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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + Expect(routePrototypeNextHopModel).ToNot(BeNil()) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + Expect(routePrototypeNextHopModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) + + // Construct an instance of the CreateVPCRouteOptions model + vpcID := "testString" + createVPCRouteOptionsDestination := "192.168.3.0/24" + var createVPCRouteOptionsZone vpcv1.ZoneIdentityIntf = nil + createVPCRouteOptionsModel := vpcService.NewCreateVPCRouteOptions(vpcID, createVPCRouteOptionsDestination, createVPCRouteOptionsZone) + createVPCRouteOptionsModel.SetVPCID("testString") + createVPCRouteOptionsModel.SetDestination("192.168.3.0/24") + createVPCRouteOptionsModel.SetZone(zoneIdentityModel) + createVPCRouteOptionsModel.SetAction("deliver") + createVPCRouteOptionsModel.SetName("my-route-1") + createVPCRouteOptionsModel.SetNextHop(routePrototypeNextHopModel) + createVPCRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createVPCRouteOptionsModel).ToNot(BeNil()) + Expect(createVPCRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(createVPCRouteOptionsModel.Destination).To(Equal(core.StringPtr("192.168.3.0/24"))) + Expect(createVPCRouteOptionsModel.Zone).To(Equal(zoneIdentityModel)) + Expect(createVPCRouteOptionsModel.Action).To(Equal(core.StringPtr("deliver"))) + Expect(createVPCRouteOptionsModel.Name).To(Equal(core.StringPtr("my-route-1"))) + Expect(createVPCRouteOptionsModel.NextHop).To(Equal(routePrototypeNextHopModel)) + Expect(createVPCRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateVPCRoutingTableOptions successfully`, func() { + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + Expect(resourceFilterModel).ToNot(BeNil()) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + Expect(resourceFilterModel.ResourceType).To(Equal(core.StringPtr("vpn_server"))) + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + Expect(routePrototypeNextHopModel).ToNot(BeNil()) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + Expect(routePrototypeNextHopModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) + + // 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 RoutePrototype model + routePrototypeModel := new(vpcv1.RoutePrototype) + Expect(routePrototypeModel).ToNot(BeNil()) + routePrototypeModel.Action = core.StringPtr("deliver") + routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") + routePrototypeModel.Name = core.StringPtr("my-route-1") + routePrototypeModel.NextHop = routePrototypeNextHopModel + routePrototypeModel.Zone = zoneIdentityModel + Expect(routePrototypeModel.Action).To(Equal(core.StringPtr("deliver"))) + Expect(routePrototypeModel.Destination).To(Equal(core.StringPtr("192.168.3.0/24"))) + Expect(routePrototypeModel.Name).To(Equal(core.StringPtr("my-route-1"))) + Expect(routePrototypeModel.NextHop).To(Equal(routePrototypeNextHopModel)) + Expect(routePrototypeModel.Zone).To(Equal(zoneIdentityModel)) + + // Construct an instance of the CreateVPCRoutingTableOptions model + vpcID := "testString" + createVPCRoutingTableOptionsModel := vpcService.NewCreateVPCRoutingTableOptions(vpcID) + createVPCRoutingTableOptionsModel.SetVPCID("testString") + createVPCRoutingTableOptionsModel.SetAcceptRoutesFrom([]vpcv1.ResourceFilter{*resourceFilterModel}) + createVPCRoutingTableOptionsModel.SetName("my-routing-table-2") + createVPCRoutingTableOptionsModel.SetRouteDirectLinkIngress(false) + createVPCRoutingTableOptionsModel.SetRouteTransitGatewayIngress(false) + createVPCRoutingTableOptionsModel.SetRouteVPCZoneIngress(false) + createVPCRoutingTableOptionsModel.SetRoutes([]vpcv1.RoutePrototype{*routePrototypeModel}) + createVPCRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createVPCRoutingTableOptionsModel).ToNot(BeNil()) + Expect(createVPCRoutingTableOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(createVPCRoutingTableOptionsModel.AcceptRoutesFrom).To(Equal([]vpcv1.ResourceFilter{*resourceFilterModel})) + Expect(createVPCRoutingTableOptionsModel.Name).To(Equal(core.StringPtr("my-routing-table-2"))) + Expect(createVPCRoutingTableOptionsModel.RouteDirectLinkIngress).To(Equal(core.BoolPtr(false))) + Expect(createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress).To(Equal(core.BoolPtr(false))) + Expect(createVPCRoutingTableOptionsModel.RouteVPCZoneIngress).To(Equal(core.BoolPtr(false))) + Expect(createVPCRoutingTableOptionsModel.Routes).To(Equal([]vpcv1.RoutePrototype{*routePrototypeModel})) + Expect(createVPCRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateVPCRoutingTableRouteOptions successfully`, func() { + // 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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + Expect(routePrototypeNextHopModel).ToNot(BeNil()) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + Expect(routePrototypeNextHopModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) + + // Construct an instance of the CreateVPCRoutingTableRouteOptions model + vpcID := "testString" + routingTableID := "testString" + createVPCRoutingTableRouteOptionsDestination := "192.168.3.0/24" + var createVPCRoutingTableRouteOptionsZone vpcv1.ZoneIdentityIntf = nil + createVPCRoutingTableRouteOptionsModel := vpcService.NewCreateVPCRoutingTableRouteOptions(vpcID, routingTableID, createVPCRoutingTableRouteOptionsDestination, createVPCRoutingTableRouteOptionsZone) + createVPCRoutingTableRouteOptionsModel.SetVPCID("testString") + createVPCRoutingTableRouteOptionsModel.SetRoutingTableID("testString") + createVPCRoutingTableRouteOptionsModel.SetDestination("192.168.3.0/24") + createVPCRoutingTableRouteOptionsModel.SetZone(zoneIdentityModel) + createVPCRoutingTableRouteOptionsModel.SetAction("deliver") + createVPCRoutingTableRouteOptionsModel.SetName("my-route-1") + createVPCRoutingTableRouteOptionsModel.SetNextHop(routePrototypeNextHopModel) + createVPCRoutingTableRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createVPCRoutingTableRouteOptionsModel).ToNot(BeNil()) + Expect(createVPCRoutingTableRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(createVPCRoutingTableRouteOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) + Expect(createVPCRoutingTableRouteOptionsModel.Destination).To(Equal(core.StringPtr("192.168.3.0/24"))) + Expect(createVPCRoutingTableRouteOptionsModel.Zone).To(Equal(zoneIdentityModel)) + Expect(createVPCRoutingTableRouteOptionsModel.Action).To(Equal(core.StringPtr("deliver"))) + Expect(createVPCRoutingTableRouteOptionsModel.Name).To(Equal(core.StringPtr("my-route-1"))) + Expect(createVPCRoutingTableRouteOptionsModel.NextHop).To(Equal(routePrototypeNextHopModel)) + Expect(createVPCRoutingTableRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateVPNGatewayConnectionOptions successfully`, func() { + // Construct an instance of the VPNGatewayConnectionDpdPrototype model + vpnGatewayConnectionDpdPrototypeModel := new(vpcv1.VPNGatewayConnectionDpdPrototype) + Expect(vpnGatewayConnectionDpdPrototypeModel).ToNot(BeNil()) + vpnGatewayConnectionDpdPrototypeModel.Action = core.StringPtr("restart") + vpnGatewayConnectionDpdPrototypeModel.Interval = core.Int64Ptr(int64(30)) + vpnGatewayConnectionDpdPrototypeModel.Timeout = core.Int64Ptr(int64(120)) + Expect(vpnGatewayConnectionDpdPrototypeModel.Action).To(Equal(core.StringPtr("restart"))) + Expect(vpnGatewayConnectionDpdPrototypeModel.Interval).To(Equal(core.Int64Ptr(int64(30)))) + Expect(vpnGatewayConnectionDpdPrototypeModel.Timeout).To(Equal(core.Int64Ptr(int64(120)))) + + // Construct an instance of the VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID model + vpnGatewayConnectionIkePolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) + Expect(vpnGatewayConnectionIkePolicyPrototypeModel).ToNot(BeNil()) + vpnGatewayConnectionIkePolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + Expect(vpnGatewayConnectionIkePolicyPrototypeModel.ID).To(Equal(core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b"))) + + // Construct an instance of the VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID model + vpnGatewayConnectionIPsecPolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) + Expect(vpnGatewayConnectionIPsecPolicyPrototypeModel).ToNot(BeNil()) + vpnGatewayConnectionIPsecPolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") + Expect(vpnGatewayConnectionIPsecPolicyPrototypeModel.ID).To(Equal(core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b"))) + + // Construct an instance of the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model + vpnGatewayConnectionPrototypeModel := new(vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) + Expect(vpnGatewayConnectionPrototypeModel).ToNot(BeNil()) + vpnGatewayConnectionPrototypeModel.AdminStateUp = core.BoolPtr(true) + vpnGatewayConnectionPrototypeModel.DeadPeerDetection = vpnGatewayConnectionDpdPrototypeModel + vpnGatewayConnectionPrototypeModel.IkePolicy = vpnGatewayConnectionIkePolicyPrototypeModel + vpnGatewayConnectionPrototypeModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPrototypeModel + vpnGatewayConnectionPrototypeModel.Name = core.StringPtr("my-vpn-connection") + vpnGatewayConnectionPrototypeModel.PeerAddress = core.StringPtr("169.21.50.5") + vpnGatewayConnectionPrototypeModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") + vpnGatewayConnectionPrototypeModel.RoutingProtocol = core.StringPtr("none") + Expect(vpnGatewayConnectionPrototypeModel.AdminStateUp).To(Equal(core.BoolPtr(true))) + Expect(vpnGatewayConnectionPrototypeModel.DeadPeerDetection).To(Equal(vpnGatewayConnectionDpdPrototypeModel)) + Expect(vpnGatewayConnectionPrototypeModel.IkePolicy).To(Equal(vpnGatewayConnectionIkePolicyPrototypeModel)) + Expect(vpnGatewayConnectionPrototypeModel.IpsecPolicy).To(Equal(vpnGatewayConnectionIPsecPolicyPrototypeModel)) + Expect(vpnGatewayConnectionPrototypeModel.Name).To(Equal(core.StringPtr("my-vpn-connection"))) + Expect(vpnGatewayConnectionPrototypeModel.PeerAddress).To(Equal(core.StringPtr("169.21.50.5"))) + Expect(vpnGatewayConnectionPrototypeModel.Psk).To(Equal(core.StringPtr("lkj14b1oi0alcniejkso"))) + Expect(vpnGatewayConnectionPrototypeModel.RoutingProtocol).To(Equal(core.StringPtr("none"))) + + // Construct an instance of the CreateVPNGatewayConnectionOptions model + vpnGatewayID := "testString" + var vpnGatewayConnectionPrototype vpcv1.VPNGatewayConnectionPrototypeIntf = nil + createVPNGatewayConnectionOptionsModel := vpcService.NewCreateVPNGatewayConnectionOptions(vpnGatewayID, vpnGatewayConnectionPrototype) + createVPNGatewayConnectionOptionsModel.SetVPNGatewayID("testString") + createVPNGatewayConnectionOptionsModel.SetVPNGatewayConnectionPrototype(vpnGatewayConnectionPrototypeModel) + createVPNGatewayConnectionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createVPNGatewayConnectionOptionsModel).ToNot(BeNil()) + Expect(createVPNGatewayConnectionOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(createVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPrototype).To(Equal(vpnGatewayConnectionPrototypeModel)) + Expect(createVPNGatewayConnectionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateVPNGatewayOptions successfully`, func() { + // 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 SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + Expect(subnetIdentityModel).ToNot(BeNil()) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) + + // Construct an instance of the VPNGatewayPrototypeVPNGatewayRouteModePrototype model + vpnGatewayPrototypeModel := new(vpcv1.VPNGatewayPrototypeVPNGatewayRouteModePrototype) + Expect(vpnGatewayPrototypeModel).ToNot(BeNil()) + vpnGatewayPrototypeModel.Name = core.StringPtr("my-vpn-gateway") + vpnGatewayPrototypeModel.ResourceGroup = resourceGroupIdentityModel + vpnGatewayPrototypeModel.Subnet = subnetIdentityModel + vpnGatewayPrototypeModel.Mode = core.StringPtr("route") + Expect(vpnGatewayPrototypeModel.Name).To(Equal(core.StringPtr("my-vpn-gateway"))) + Expect(vpnGatewayPrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(vpnGatewayPrototypeModel.Subnet).To(Equal(subnetIdentityModel)) + Expect(vpnGatewayPrototypeModel.Mode).To(Equal(core.StringPtr("route"))) + + // Construct an instance of the CreateVPNGatewayOptions model + var vpnGatewayPrototype vpcv1.VPNGatewayPrototypeIntf = nil + createVPNGatewayOptionsModel := vpcService.NewCreateVPNGatewayOptions(vpnGatewayPrototype) + createVPNGatewayOptionsModel.SetVPNGatewayPrototype(vpnGatewayPrototypeModel) + createVPNGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createVPNGatewayOptionsModel).ToNot(BeNil()) + Expect(createVPNGatewayOptionsModel.VPNGatewayPrototype).To(Equal(vpnGatewayPrototypeModel)) + Expect(createVPNGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateVPNServerOptions successfully`, func() { + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + Expect(certificateInstanceIdentityModel).ToNot(BeNil()) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + Expect(certificateInstanceIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"))) + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + Expect(vpnServerAuthenticationByUsernameIDProviderModel).ToNot(BeNil()) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + Expect(vpnServerAuthenticationByUsernameIDProviderModel.ProviderType).To(Equal(core.StringPtr("iam"))) + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + Expect(vpnServerAuthenticationPrototypeModel).ToNot(BeNil()) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + Expect(vpnServerAuthenticationPrototypeModel.Method).To(Equal(core.StringPtr("username"))) + Expect(vpnServerAuthenticationPrototypeModel.IdentityProvider).To(Equal(vpnServerAuthenticationByUsernameIDProviderModel)) + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + Expect(subnetIdentityModel).ToNot(BeNil()) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + Expect(ipModel).ToNot(BeNil()) + ipModel.Address = core.StringPtr("192.168.3.4") + Expect(ipModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) + + // 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 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"))) + + // Construct an instance of the CreateVPNServerOptions model + var createVPNServerOptionsCertificate vpcv1.CertificateInstanceIdentityIntf = nil + createVPNServerOptionsClientAuthentication := []vpcv1.VPNServerAuthenticationPrototypeIntf{} + createVPNServerOptionsClientIPPool := "172.16.0.0/16" + createVPNServerOptionsSubnets := []vpcv1.SubnetIdentityIntf{} + createVPNServerOptionsModel := vpcService.NewCreateVPNServerOptions(createVPNServerOptionsCertificate, createVPNServerOptionsClientAuthentication, createVPNServerOptionsClientIPPool, createVPNServerOptionsSubnets) + createVPNServerOptionsModel.SetCertificate(certificateInstanceIdentityModel) + createVPNServerOptionsModel.SetClientAuthentication([]vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel}) + createVPNServerOptionsModel.SetClientIPPool("172.16.0.0/16") + createVPNServerOptionsModel.SetSubnets([]vpcv1.SubnetIdentityIntf{subnetIdentityModel}) + createVPNServerOptionsModel.SetClientDnsServerIps([]vpcv1.IP{*ipModel}) + createVPNServerOptionsModel.SetClientIdleTimeout(int64(600)) + createVPNServerOptionsModel.SetEnableSplitTunneling(false) + createVPNServerOptionsModel.SetName("my-vpn-server") + createVPNServerOptionsModel.SetPort(int64(443)) + createVPNServerOptionsModel.SetProtocol("udp") + createVPNServerOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createVPNServerOptionsModel.SetSecurityGroups([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel}) + createVPNServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createVPNServerOptionsModel).ToNot(BeNil()) + Expect(createVPNServerOptionsModel.Certificate).To(Equal(certificateInstanceIdentityModel)) + Expect(createVPNServerOptionsModel.ClientAuthentication).To(Equal([]vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel})) + Expect(createVPNServerOptionsModel.ClientIPPool).To(Equal(core.StringPtr("172.16.0.0/16"))) + Expect(createVPNServerOptionsModel.Subnets).To(Equal([]vpcv1.SubnetIdentityIntf{subnetIdentityModel})) + Expect(createVPNServerOptionsModel.ClientDnsServerIps).To(Equal([]vpcv1.IP{*ipModel})) + Expect(createVPNServerOptionsModel.ClientIdleTimeout).To(Equal(core.Int64Ptr(int64(600)))) + Expect(createVPNServerOptionsModel.EnableSplitTunneling).To(Equal(core.BoolPtr(false))) + Expect(createVPNServerOptionsModel.Name).To(Equal(core.StringPtr("my-vpn-server"))) + Expect(createVPNServerOptionsModel.Port).To(Equal(core.Int64Ptr(int64(443)))) + Expect(createVPNServerOptionsModel.Protocol).To(Equal(core.StringPtr("udp"))) + Expect(createVPNServerOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createVPNServerOptionsModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(createVPNServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateVPNServerRouteOptions successfully`, func() { + // Construct an instance of the CreateVPNServerRouteOptions model + vpnServerID := "testString" + createVPNServerRouteOptionsDestination := "172.16.0.0/16" + createVPNServerRouteOptionsModel := vpcService.NewCreateVPNServerRouteOptions(vpnServerID, createVPNServerRouteOptionsDestination) + createVPNServerRouteOptionsModel.SetVPNServerID("testString") + createVPNServerRouteOptionsModel.SetDestination("172.16.0.0/16") + createVPNServerRouteOptionsModel.SetAction("deliver") + createVPNServerRouteOptionsModel.SetName("my-vpn-route-2") + createVPNServerRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createVPNServerRouteOptionsModel).ToNot(BeNil()) + Expect(createVPNServerRouteOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(createVPNServerRouteOptionsModel.Destination).To(Equal(core.StringPtr("172.16.0.0/16"))) + Expect(createVPNServerRouteOptionsModel.Action).To(Equal(core.StringPtr("deliver"))) + Expect(createVPNServerRouteOptionsModel.Name).To(Equal(core.StringPtr("my-vpn-route-2"))) + Expect(createVPNServerRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteBackupPolicyOptions successfully`, func() { + // Construct an instance of the DeleteBackupPolicyOptions model + id := "testString" + deleteBackupPolicyOptionsModel := vpcService.NewDeleteBackupPolicyOptions(id) + deleteBackupPolicyOptionsModel.SetID("testString") + deleteBackupPolicyOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteBackupPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteBackupPolicyOptionsModel).ToNot(BeNil()) + Expect(deleteBackupPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteBackupPolicyOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(deleteBackupPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteBackupPolicyPlanOptions successfully`, func() { + // Construct an instance of the DeleteBackupPolicyPlanOptions model + backupPolicyID := "testString" + id := "testString" + deleteBackupPolicyPlanOptionsModel := vpcService.NewDeleteBackupPolicyPlanOptions(backupPolicyID, id) + deleteBackupPolicyPlanOptionsModel.SetBackupPolicyID("testString") + deleteBackupPolicyPlanOptionsModel.SetID("testString") + deleteBackupPolicyPlanOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteBackupPolicyPlanOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteBackupPolicyPlanOptionsModel).ToNot(BeNil()) + Expect(deleteBackupPolicyPlanOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) + Expect(deleteBackupPolicyPlanOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteBackupPolicyPlanOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(deleteBackupPolicyPlanOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteBareMetalServerNetworkInterfaceOptions successfully`, func() { + // Construct an instance of the DeleteBareMetalServerNetworkInterfaceOptions model + bareMetalServerID := "testString" + id := "testString" + deleteBareMetalServerNetworkInterfaceOptionsModel := vpcService.NewDeleteBareMetalServerNetworkInterfaceOptions(bareMetalServerID, id) + deleteBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerID("testString") + deleteBareMetalServerNetworkInterfaceOptionsModel.SetID("testString") + deleteBareMetalServerNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteBareMetalServerNetworkInterfaceOptionsModel).ToNot(BeNil()) + Expect(deleteBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteBareMetalServerNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteBareMetalServerNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteBareMetalServerOptions successfully`, func() { + // Construct an instance of the DeleteBareMetalServerOptions model + id := "testString" + deleteBareMetalServerOptionsModel := vpcService.NewDeleteBareMetalServerOptions(id) + deleteBareMetalServerOptionsModel.SetID("testString") + deleteBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteBareMetalServerOptionsModel).ToNot(BeNil()) + Expect(deleteBareMetalServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteDedicatedHostGroupOptions successfully`, func() { + // Construct an instance of the DeleteDedicatedHostGroupOptions model + id := "testString" + deleteDedicatedHostGroupOptionsModel := vpcService.NewDeleteDedicatedHostGroupOptions(id) + deleteDedicatedHostGroupOptionsModel.SetID("testString") + deleteDedicatedHostGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteDedicatedHostGroupOptionsModel).ToNot(BeNil()) + Expect(deleteDedicatedHostGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteDedicatedHostGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteDedicatedHostOptions successfully`, func() { + // Construct an instance of the DeleteDedicatedHostOptions model + id := "testString" + deleteDedicatedHostOptionsModel := vpcService.NewDeleteDedicatedHostOptions(id) + deleteDedicatedHostOptionsModel.SetID("testString") + deleteDedicatedHostOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteDedicatedHostOptionsModel).ToNot(BeNil()) + Expect(deleteDedicatedHostOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteDedicatedHostOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteEndpointGatewayOptions successfully`, func() { + // Construct an instance of the DeleteEndpointGatewayOptions model + id := "testString" + deleteEndpointGatewayOptionsModel := vpcService.NewDeleteEndpointGatewayOptions(id) + deleteEndpointGatewayOptionsModel.SetID("testString") + deleteEndpointGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteEndpointGatewayOptionsModel).ToNot(BeNil()) + Expect(deleteEndpointGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteEndpointGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteFloatingIPOptions successfully`, func() { + // Construct an instance of the DeleteFloatingIPOptions model + id := "testString" + deleteFloatingIPOptionsModel := vpcService.NewDeleteFloatingIPOptions(id) + deleteFloatingIPOptionsModel.SetID("testString") + deleteFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteFloatingIPOptionsModel).ToNot(BeNil()) + Expect(deleteFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteFlowLogCollectorOptions successfully`, func() { + // Construct an instance of the DeleteFlowLogCollectorOptions model + id := "testString" + deleteFlowLogCollectorOptionsModel := vpcService.NewDeleteFlowLogCollectorOptions(id) + deleteFlowLogCollectorOptionsModel.SetID("testString") + deleteFlowLogCollectorOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteFlowLogCollectorOptionsModel).ToNot(BeNil()) + Expect(deleteFlowLogCollectorOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteFlowLogCollectorOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteIkePolicyOptions successfully`, func() { + // Construct an instance of the DeleteIkePolicyOptions model + id := "testString" + deleteIkePolicyOptionsModel := vpcService.NewDeleteIkePolicyOptions(id) + deleteIkePolicyOptionsModel.SetID("testString") + deleteIkePolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteIkePolicyOptionsModel).ToNot(BeNil()) + Expect(deleteIkePolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteIkePolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteImageOptions successfully`, func() { + // Construct an instance of the DeleteImageOptions model + id := "testString" + deleteImageOptionsModel := vpcService.NewDeleteImageOptions(id) + deleteImageOptionsModel.SetID("testString") + deleteImageOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteImageOptionsModel).ToNot(BeNil()) + Expect(deleteImageOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteImageOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteInstanceGroupLoadBalancerOptions successfully`, func() { + // Construct an instance of the DeleteInstanceGroupLoadBalancerOptions model + instanceGroupID := "testString" + deleteInstanceGroupLoadBalancerOptionsModel := vpcService.NewDeleteInstanceGroupLoadBalancerOptions(instanceGroupID) + deleteInstanceGroupLoadBalancerOptionsModel.SetInstanceGroupID("testString") + deleteInstanceGroupLoadBalancerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteInstanceGroupLoadBalancerOptionsModel).ToNot(BeNil()) + Expect(deleteInstanceGroupLoadBalancerOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceGroupLoadBalancerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteInstanceGroupManagerActionOptions successfully`, func() { + // Construct an instance of the DeleteInstanceGroupManagerActionOptions model + instanceGroupID := "testString" + instanceGroupManagerID := "testString" + id := "testString" + deleteInstanceGroupManagerActionOptionsModel := vpcService.NewDeleteInstanceGroupManagerActionOptions(instanceGroupID, instanceGroupManagerID, id) + deleteInstanceGroupManagerActionOptionsModel.SetInstanceGroupID("testString") + deleteInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerID("testString") + deleteInstanceGroupManagerActionOptionsModel.SetID("testString") + deleteInstanceGroupManagerActionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteInstanceGroupManagerActionOptionsModel).ToNot(BeNil()) + Expect(deleteInstanceGroupManagerActionOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceGroupManagerActionOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceGroupManagerActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteInstanceGroupManagerOptions successfully`, func() { + // Construct an instance of the DeleteInstanceGroupManagerOptions model + instanceGroupID := "testString" + id := "testString" + deleteInstanceGroupManagerOptionsModel := vpcService.NewDeleteInstanceGroupManagerOptions(instanceGroupID, id) + deleteInstanceGroupManagerOptionsModel.SetInstanceGroupID("testString") + deleteInstanceGroupManagerOptionsModel.SetID("testString") + deleteInstanceGroupManagerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteInstanceGroupManagerOptionsModel).ToNot(BeNil()) + Expect(deleteInstanceGroupManagerOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceGroupManagerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceGroupManagerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteInstanceGroupManagerPolicyOptions successfully`, func() { + // Construct an instance of the DeleteInstanceGroupManagerPolicyOptions model + instanceGroupID := "testString" + instanceGroupManagerID := "testString" + id := "testString" + deleteInstanceGroupManagerPolicyOptionsModel := vpcService.NewDeleteInstanceGroupManagerPolicyOptions(instanceGroupID, instanceGroupManagerID, id) + deleteInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupID("testString") + deleteInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerID("testString") + deleteInstanceGroupManagerPolicyOptionsModel.SetID("testString") + deleteInstanceGroupManagerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteInstanceGroupManagerPolicyOptionsModel).ToNot(BeNil()) + Expect(deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceGroupManagerPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceGroupManagerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteInstanceGroupMembershipOptions successfully`, func() { + // Construct an instance of the DeleteInstanceGroupMembershipOptions model + instanceGroupID := "testString" + id := "testString" + deleteInstanceGroupMembershipOptionsModel := vpcService.NewDeleteInstanceGroupMembershipOptions(instanceGroupID, id) + deleteInstanceGroupMembershipOptionsModel.SetInstanceGroupID("testString") + deleteInstanceGroupMembershipOptionsModel.SetID("testString") + deleteInstanceGroupMembershipOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteInstanceGroupMembershipOptionsModel).ToNot(BeNil()) + Expect(deleteInstanceGroupMembershipOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceGroupMembershipOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceGroupMembershipOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteInstanceGroupMembershipsOptions successfully`, func() { + // Construct an instance of the DeleteInstanceGroupMembershipsOptions model + instanceGroupID := "testString" + deleteInstanceGroupMembershipsOptionsModel := vpcService.NewDeleteInstanceGroupMembershipsOptions(instanceGroupID) + deleteInstanceGroupMembershipsOptionsModel.SetInstanceGroupID("testString") + deleteInstanceGroupMembershipsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteInstanceGroupMembershipsOptionsModel).ToNot(BeNil()) + Expect(deleteInstanceGroupMembershipsOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceGroupMembershipsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteInstanceGroupOptions successfully`, func() { + // Construct an instance of the DeleteInstanceGroupOptions model + id := "testString" + deleteInstanceGroupOptionsModel := vpcService.NewDeleteInstanceGroupOptions(id) + deleteInstanceGroupOptionsModel.SetID("testString") + deleteInstanceGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteInstanceGroupOptionsModel).ToNot(BeNil()) + Expect(deleteInstanceGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteInstanceNetworkInterfaceOptions successfully`, func() { + // Construct an instance of the DeleteInstanceNetworkInterfaceOptions model + instanceID := "testString" + id := "testString" + deleteInstanceNetworkInterfaceOptionsModel := vpcService.NewDeleteInstanceNetworkInterfaceOptions(instanceID, id) + deleteInstanceNetworkInterfaceOptionsModel.SetInstanceID("testString") + deleteInstanceNetworkInterfaceOptionsModel.SetID("testString") + deleteInstanceNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteInstanceNetworkInterfaceOptionsModel).ToNot(BeNil()) + Expect(deleteInstanceNetworkInterfaceOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteInstanceOptions successfully`, func() { + // Construct an instance of the DeleteInstanceOptions model + id := "testString" + deleteInstanceOptionsModel := vpcService.NewDeleteInstanceOptions(id) + deleteInstanceOptionsModel.SetID("testString") + deleteInstanceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteInstanceOptionsModel).ToNot(BeNil()) + Expect(deleteInstanceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteInstanceTemplateOptions successfully`, func() { + // Construct an instance of the DeleteInstanceTemplateOptions model + id := "testString" + deleteInstanceTemplateOptionsModel := vpcService.NewDeleteInstanceTemplateOptions(id) + deleteInstanceTemplateOptionsModel.SetID("testString") + deleteInstanceTemplateOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteInstanceTemplateOptionsModel).ToNot(BeNil()) + Expect(deleteInstanceTemplateOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceTemplateOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteInstanceVolumeAttachmentOptions successfully`, func() { + // Construct an instance of the DeleteInstanceVolumeAttachmentOptions model + instanceID := "testString" + id := "testString" + deleteInstanceVolumeAttachmentOptionsModel := vpcService.NewDeleteInstanceVolumeAttachmentOptions(instanceID, id) + deleteInstanceVolumeAttachmentOptionsModel.SetInstanceID("testString") + deleteInstanceVolumeAttachmentOptionsModel.SetID("testString") + deleteInstanceVolumeAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteInstanceVolumeAttachmentOptionsModel).ToNot(BeNil()) + Expect(deleteInstanceVolumeAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceVolumeAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteInstanceVolumeAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteIpsecPolicyOptions successfully`, func() { + // Construct an instance of the DeleteIpsecPolicyOptions model + id := "testString" + deleteIpsecPolicyOptionsModel := vpcService.NewDeleteIpsecPolicyOptions(id) + deleteIpsecPolicyOptionsModel.SetID("testString") + deleteIpsecPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteIpsecPolicyOptionsModel).ToNot(BeNil()) + Expect(deleteIpsecPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteIpsecPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteKeyOptions successfully`, func() { + // Construct an instance of the DeleteKeyOptions model + id := "testString" + deleteKeyOptionsModel := vpcService.NewDeleteKeyOptions(id) + deleteKeyOptionsModel.SetID("testString") + deleteKeyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteKeyOptionsModel).ToNot(BeNil()) + Expect(deleteKeyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteKeyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteLoadBalancerListenerOptions successfully`, func() { + // Construct an instance of the DeleteLoadBalancerListenerOptions model + loadBalancerID := "testString" + id := "testString" + deleteLoadBalancerListenerOptionsModel := vpcService.NewDeleteLoadBalancerListenerOptions(loadBalancerID, id) + deleteLoadBalancerListenerOptionsModel.SetLoadBalancerID("testString") + deleteLoadBalancerListenerOptionsModel.SetID("testString") + deleteLoadBalancerListenerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteLoadBalancerListenerOptionsModel).ToNot(BeNil()) + Expect(deleteLoadBalancerListenerOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerListenerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerListenerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteLoadBalancerListenerPolicyOptions successfully`, func() { + // Construct an instance of the DeleteLoadBalancerListenerPolicyOptions model + loadBalancerID := "testString" + listenerID := "testString" + id := "testString" + deleteLoadBalancerListenerPolicyOptionsModel := vpcService.NewDeleteLoadBalancerListenerPolicyOptions(loadBalancerID, listenerID, id) + deleteLoadBalancerListenerPolicyOptionsModel.SetLoadBalancerID("testString") + deleteLoadBalancerListenerPolicyOptionsModel.SetListenerID("testString") + deleteLoadBalancerListenerPolicyOptionsModel.SetID("testString") + deleteLoadBalancerListenerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteLoadBalancerListenerPolicyOptionsModel).ToNot(BeNil()) + Expect(deleteLoadBalancerListenerPolicyOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerListenerPolicyOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerListenerPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerListenerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteLoadBalancerListenerPolicyRuleOptions successfully`, func() { + // Construct an instance of the DeleteLoadBalancerListenerPolicyRuleOptions model + loadBalancerID := "testString" + listenerID := "testString" + policyID := "testString" + id := "testString" + deleteLoadBalancerListenerPolicyRuleOptionsModel := vpcService.NewDeleteLoadBalancerListenerPolicyRuleOptions(loadBalancerID, listenerID, policyID, id) + deleteLoadBalancerListenerPolicyRuleOptionsModel.SetLoadBalancerID("testString") + deleteLoadBalancerListenerPolicyRuleOptionsModel.SetListenerID("testString") + deleteLoadBalancerListenerPolicyRuleOptionsModel.SetPolicyID("testString") + deleteLoadBalancerListenerPolicyRuleOptionsModel.SetID("testString") + deleteLoadBalancerListenerPolicyRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteLoadBalancerListenerPolicyRuleOptionsModel).ToNot(BeNil()) + Expect(deleteLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerListenerPolicyRuleOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerListenerPolicyRuleOptionsModel.PolicyID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerListenerPolicyRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerListenerPolicyRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteLoadBalancerOptions successfully`, func() { + // Construct an instance of the DeleteLoadBalancerOptions model + id := "testString" + deleteLoadBalancerOptionsModel := vpcService.NewDeleteLoadBalancerOptions(id) + deleteLoadBalancerOptionsModel.SetID("testString") + deleteLoadBalancerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteLoadBalancerOptionsModel).ToNot(BeNil()) + Expect(deleteLoadBalancerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteLoadBalancerPoolMemberOptions successfully`, func() { + // Construct an instance of the DeleteLoadBalancerPoolMemberOptions model + loadBalancerID := "testString" + poolID := "testString" + id := "testString" + deleteLoadBalancerPoolMemberOptionsModel := vpcService.NewDeleteLoadBalancerPoolMemberOptions(loadBalancerID, poolID, id) + deleteLoadBalancerPoolMemberOptionsModel.SetLoadBalancerID("testString") + deleteLoadBalancerPoolMemberOptionsModel.SetPoolID("testString") + deleteLoadBalancerPoolMemberOptionsModel.SetID("testString") + deleteLoadBalancerPoolMemberOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteLoadBalancerPoolMemberOptionsModel).ToNot(BeNil()) + Expect(deleteLoadBalancerPoolMemberOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerPoolMemberOptionsModel.PoolID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerPoolMemberOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerPoolMemberOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteLoadBalancerPoolOptions successfully`, func() { + // Construct an instance of the DeleteLoadBalancerPoolOptions model + loadBalancerID := "testString" + id := "testString" + deleteLoadBalancerPoolOptionsModel := vpcService.NewDeleteLoadBalancerPoolOptions(loadBalancerID, id) + deleteLoadBalancerPoolOptionsModel.SetLoadBalancerID("testString") + deleteLoadBalancerPoolOptionsModel.SetID("testString") + deleteLoadBalancerPoolOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteLoadBalancerPoolOptionsModel).ToNot(BeNil()) + Expect(deleteLoadBalancerPoolOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerPoolOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerPoolOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteNetworkACLOptions successfully`, func() { + // Construct an instance of the DeleteNetworkACLOptions model + id := "testString" + deleteNetworkACLOptionsModel := vpcService.NewDeleteNetworkACLOptions(id) + deleteNetworkACLOptionsModel.SetID("testString") + deleteNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteNetworkACLOptionsModel).ToNot(BeNil()) + Expect(deleteNetworkACLOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteNetworkACLRuleOptions successfully`, func() { + // Construct an instance of the DeleteNetworkACLRuleOptions model + networkACLID := "testString" + id := "testString" + deleteNetworkACLRuleOptionsModel := vpcService.NewDeleteNetworkACLRuleOptions(networkACLID, id) + deleteNetworkACLRuleOptionsModel.SetNetworkACLID("testString") + deleteNetworkACLRuleOptionsModel.SetID("testString") + deleteNetworkACLRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteNetworkACLRuleOptionsModel).ToNot(BeNil()) + Expect(deleteNetworkACLRuleOptionsModel.NetworkACLID).To(Equal(core.StringPtr("testString"))) + Expect(deleteNetworkACLRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteNetworkACLRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeletePlacementGroupOptions successfully`, func() { + // Construct an instance of the DeletePlacementGroupOptions model + id := "testString" + deletePlacementGroupOptionsModel := vpcService.NewDeletePlacementGroupOptions(id) + deletePlacementGroupOptionsModel.SetID("testString") + deletePlacementGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deletePlacementGroupOptionsModel).ToNot(BeNil()) + Expect(deletePlacementGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deletePlacementGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeletePublicGatewayOptions successfully`, func() { + // Construct an instance of the DeletePublicGatewayOptions model + id := "testString" + deletePublicGatewayOptionsModel := vpcService.NewDeletePublicGatewayOptions(id) + deletePublicGatewayOptionsModel.SetID("testString") + deletePublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deletePublicGatewayOptionsModel).ToNot(BeNil()) + Expect(deletePublicGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deletePublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteSecurityGroupOptions successfully`, func() { + // Construct an instance of the DeleteSecurityGroupOptions model + id := "testString" + deleteSecurityGroupOptionsModel := vpcService.NewDeleteSecurityGroupOptions(id) + deleteSecurityGroupOptionsModel.SetID("testString") + deleteSecurityGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteSecurityGroupOptionsModel).ToNot(BeNil()) + Expect(deleteSecurityGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSecurityGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteSecurityGroupRuleOptions successfully`, func() { + // Construct an instance of the DeleteSecurityGroupRuleOptions model + securityGroupID := "testString" + id := "testString" + deleteSecurityGroupRuleOptionsModel := vpcService.NewDeleteSecurityGroupRuleOptions(securityGroupID, id) + deleteSecurityGroupRuleOptionsModel.SetSecurityGroupID("testString") + deleteSecurityGroupRuleOptionsModel.SetID("testString") + deleteSecurityGroupRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteSecurityGroupRuleOptionsModel).ToNot(BeNil()) + Expect(deleteSecurityGroupRuleOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSecurityGroupRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSecurityGroupRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteSecurityGroupTargetBindingOptions successfully`, func() { + // Construct an instance of the DeleteSecurityGroupTargetBindingOptions model + securityGroupID := "testString" + id := "testString" + deleteSecurityGroupTargetBindingOptionsModel := vpcService.NewDeleteSecurityGroupTargetBindingOptions(securityGroupID, id) + deleteSecurityGroupTargetBindingOptionsModel.SetSecurityGroupID("testString") + deleteSecurityGroupTargetBindingOptionsModel.SetID("testString") + deleteSecurityGroupTargetBindingOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteSecurityGroupTargetBindingOptionsModel).ToNot(BeNil()) + Expect(deleteSecurityGroupTargetBindingOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSecurityGroupTargetBindingOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSecurityGroupTargetBindingOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteSnapshotOptions successfully`, func() { + // Construct an instance of the DeleteSnapshotOptions model + id := "testString" + deleteSnapshotOptionsModel := vpcService.NewDeleteSnapshotOptions(id) + deleteSnapshotOptionsModel.SetID("testString") + deleteSnapshotOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteSnapshotOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteSnapshotOptionsModel).ToNot(BeNil()) + Expect(deleteSnapshotOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSnapshotOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(deleteSnapshotOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteSnapshotsOptions successfully`, func() { + // Construct an instance of the DeleteSnapshotsOptions model + sourceVolumeID := "testString" + deleteSnapshotsOptionsModel := vpcService.NewDeleteSnapshotsOptions(sourceVolumeID) + deleteSnapshotsOptionsModel.SetSourceVolumeID("testString") + deleteSnapshotsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteSnapshotsOptionsModel).ToNot(BeNil()) + Expect(deleteSnapshotsOptionsModel.SourceVolumeID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSnapshotsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteSubnetOptions successfully`, func() { + // Construct an instance of the DeleteSubnetOptions model + id := "testString" + deleteSubnetOptionsModel := vpcService.NewDeleteSubnetOptions(id) + deleteSubnetOptionsModel.SetID("testString") + deleteSubnetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteSubnetOptionsModel).ToNot(BeNil()) + Expect(deleteSubnetOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSubnetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteSubnetReservedIPOptions successfully`, func() { + // Construct an instance of the DeleteSubnetReservedIPOptions model + subnetID := "testString" + id := "testString" + deleteSubnetReservedIPOptionsModel := vpcService.NewDeleteSubnetReservedIPOptions(subnetID, id) + deleteSubnetReservedIPOptionsModel.SetSubnetID("testString") + deleteSubnetReservedIPOptionsModel.SetID("testString") + deleteSubnetReservedIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteSubnetReservedIPOptionsModel).ToNot(BeNil()) + Expect(deleteSubnetReservedIPOptionsModel.SubnetID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSubnetReservedIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteVolumeOptions successfully`, func() { + // Construct an instance of the DeleteVolumeOptions model + id := "testString" + deleteVolumeOptionsModel := vpcService.NewDeleteVolumeOptions(id) + deleteVolumeOptionsModel.SetID("testString") + deleteVolumeOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteVolumeOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVolumeOptionsModel).ToNot(BeNil()) + Expect(deleteVolumeOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVolumeOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(deleteVolumeOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteVPCAddressPrefixOptions successfully`, func() { + // Construct an instance of the DeleteVPCAddressPrefixOptions model + vpcID := "testString" + id := "testString" + deleteVPCAddressPrefixOptionsModel := vpcService.NewDeleteVPCAddressPrefixOptions(vpcID, id) + deleteVPCAddressPrefixOptionsModel.SetVPCID("testString") + deleteVPCAddressPrefixOptionsModel.SetID("testString") + deleteVPCAddressPrefixOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVPCAddressPrefixOptionsModel).ToNot(BeNil()) + Expect(deleteVPCAddressPrefixOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPCAddressPrefixOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPCAddressPrefixOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteVPCOptions successfully`, func() { + // Construct an instance of the DeleteVPCOptions model + id := "testString" + deleteVPCOptionsModel := vpcService.NewDeleteVPCOptions(id) + deleteVPCOptionsModel.SetID("testString") + deleteVPCOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVPCOptionsModel).ToNot(BeNil()) + Expect(deleteVPCOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPCOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteVPCRouteOptions successfully`, func() { + // Construct an instance of the DeleteVPCRouteOptions model + vpcID := "testString" + id := "testString" + deleteVPCRouteOptionsModel := vpcService.NewDeleteVPCRouteOptions(vpcID, id) + deleteVPCRouteOptionsModel.SetVPCID("testString") + deleteVPCRouteOptionsModel.SetID("testString") + deleteVPCRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVPCRouteOptionsModel).ToNot(BeNil()) + Expect(deleteVPCRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPCRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPCRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteVPCRoutingTableOptions successfully`, func() { + // Construct an instance of the DeleteVPCRoutingTableOptions model + vpcID := "testString" + id := "testString" + deleteVPCRoutingTableOptionsModel := vpcService.NewDeleteVPCRoutingTableOptions(vpcID, id) + deleteVPCRoutingTableOptionsModel.SetVPCID("testString") + deleteVPCRoutingTableOptionsModel.SetID("testString") + deleteVPCRoutingTableOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteVPCRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVPCRoutingTableOptionsModel).ToNot(BeNil()) + Expect(deleteVPCRoutingTableOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPCRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPCRoutingTableOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(deleteVPCRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteVPCRoutingTableRouteOptions successfully`, func() { + // Construct an instance of the DeleteVPCRoutingTableRouteOptions model + vpcID := "testString" + routingTableID := "testString" + id := "testString" + deleteVPCRoutingTableRouteOptionsModel := vpcService.NewDeleteVPCRoutingTableRouteOptions(vpcID, routingTableID, id) + deleteVPCRoutingTableRouteOptionsModel.SetVPCID("testString") + deleteVPCRoutingTableRouteOptionsModel.SetRoutingTableID("testString") + deleteVPCRoutingTableRouteOptionsModel.SetID("testString") + deleteVPCRoutingTableRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVPCRoutingTableRouteOptionsModel).ToNot(BeNil()) + Expect(deleteVPCRoutingTableRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPCRoutingTableRouteOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPCRoutingTableRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPCRoutingTableRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteVPNGatewayConnectionOptions successfully`, func() { + // Construct an instance of the DeleteVPNGatewayConnectionOptions model + vpnGatewayID := "testString" + id := "testString" + deleteVPNGatewayConnectionOptionsModel := vpcService.NewDeleteVPNGatewayConnectionOptions(vpnGatewayID, id) + deleteVPNGatewayConnectionOptionsModel.SetVPNGatewayID("testString") + deleteVPNGatewayConnectionOptionsModel.SetID("testString") + deleteVPNGatewayConnectionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVPNGatewayConnectionOptionsModel).ToNot(BeNil()) + Expect(deleteVPNGatewayConnectionOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPNGatewayConnectionOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPNGatewayConnectionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteVPNGatewayOptions successfully`, func() { + // Construct an instance of the DeleteVPNGatewayOptions model + id := "testString" + deleteVPNGatewayOptionsModel := vpcService.NewDeleteVPNGatewayOptions(id) + deleteVPNGatewayOptionsModel.SetID("testString") + deleteVPNGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVPNGatewayOptionsModel).ToNot(BeNil()) + Expect(deleteVPNGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPNGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteVPNServerClientOptions successfully`, func() { + // Construct an instance of the DeleteVPNServerClientOptions model + vpnServerID := "testString" + id := "testString" + deleteVPNServerClientOptionsModel := vpcService.NewDeleteVPNServerClientOptions(vpnServerID, id) + deleteVPNServerClientOptionsModel.SetVPNServerID("testString") + deleteVPNServerClientOptionsModel.SetID("testString") + deleteVPNServerClientOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVPNServerClientOptionsModel).ToNot(BeNil()) + Expect(deleteVPNServerClientOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPNServerClientOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPNServerClientOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteVPNServerOptions successfully`, func() { + // Construct an instance of the DeleteVPNServerOptions model + id := "testString" + deleteVPNServerOptionsModel := vpcService.NewDeleteVPNServerOptions(id) + deleteVPNServerOptionsModel.SetID("testString") + deleteVPNServerOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteVPNServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVPNServerOptionsModel).ToNot(BeNil()) + Expect(deleteVPNServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPNServerOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(deleteVPNServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteVPNServerRouteOptions successfully`, func() { + // Construct an instance of the DeleteVPNServerRouteOptions model + vpnServerID := "testString" + id := "testString" + deleteVPNServerRouteOptionsModel := vpcService.NewDeleteVPNServerRouteOptions(vpnServerID, id) + deleteVPNServerRouteOptionsModel.SetVPNServerID("testString") + deleteVPNServerRouteOptionsModel.SetID("testString") + deleteVPNServerRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVPNServerRouteOptionsModel).ToNot(BeNil()) + Expect(deleteVPNServerRouteOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPNServerRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPNServerRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDisconnectVPNClientOptions successfully`, func() { + // Construct an instance of the DisconnectVPNClientOptions model + vpnServerID := "testString" + id := "testString" + disconnectVPNClientOptionsModel := vpcService.NewDisconnectVPNClientOptions(vpnServerID, id) + disconnectVPNClientOptionsModel.SetVPNServerID("testString") + disconnectVPNClientOptionsModel.SetID("testString") + disconnectVPNClientOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(disconnectVPNClientOptionsModel).ToNot(BeNil()) + Expect(disconnectVPNClientOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(disconnectVPNClientOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(disconnectVPNClientOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetBackupPolicyOptions successfully`, func() { + // Construct an instance of the GetBackupPolicyOptions model + id := "testString" + getBackupPolicyOptionsModel := vpcService.NewGetBackupPolicyOptions(id) + getBackupPolicyOptionsModel.SetID("testString") + getBackupPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getBackupPolicyOptionsModel).ToNot(BeNil()) + Expect(getBackupPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getBackupPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetBackupPolicyPlanOptions successfully`, func() { + // Construct an instance of the GetBackupPolicyPlanOptions model + backupPolicyID := "testString" + id := "testString" + getBackupPolicyPlanOptionsModel := vpcService.NewGetBackupPolicyPlanOptions(backupPolicyID, id) + getBackupPolicyPlanOptionsModel.SetBackupPolicyID("testString") + getBackupPolicyPlanOptionsModel.SetID("testString") + getBackupPolicyPlanOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getBackupPolicyPlanOptionsModel).ToNot(BeNil()) + Expect(getBackupPolicyPlanOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) + Expect(getBackupPolicyPlanOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getBackupPolicyPlanOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetBareMetalServerDiskOptions successfully`, func() { + // Construct an instance of the GetBareMetalServerDiskOptions model + bareMetalServerID := "testString" + id := "testString" + getBareMetalServerDiskOptionsModel := vpcService.NewGetBareMetalServerDiskOptions(bareMetalServerID, id) + getBareMetalServerDiskOptionsModel.SetBareMetalServerID("testString") + getBareMetalServerDiskOptionsModel.SetID("testString") + getBareMetalServerDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getBareMetalServerDiskOptionsModel).ToNot(BeNil()) + Expect(getBareMetalServerDiskOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetBareMetalServerInitializationOptions successfully`, func() { + // Construct an instance of the GetBareMetalServerInitializationOptions model + id := "testString" + getBareMetalServerInitializationOptionsModel := vpcService.NewGetBareMetalServerInitializationOptions(id) + getBareMetalServerInitializationOptionsModel.SetID("testString") + getBareMetalServerInitializationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getBareMetalServerInitializationOptionsModel).ToNot(BeNil()) + Expect(getBareMetalServerInitializationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerInitializationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetBareMetalServerNetworkInterfaceFloatingIPOptions successfully`, func() { + // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model + bareMetalServerID := "testString" + networkInterfaceID := "testString" + id := "testString" + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := vpcService.NewGetBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID, networkInterfaceID, id) + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetBareMetalServerID("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetNetworkInterfaceID("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetID("testString") + getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) + Expect(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetBareMetalServerNetworkInterfaceOptions successfully`, func() { + // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model + bareMetalServerID := "testString" + id := "testString" + getBareMetalServerNetworkInterfaceOptionsModel := vpcService.NewGetBareMetalServerNetworkInterfaceOptions(bareMetalServerID, id) + getBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerID("testString") + getBareMetalServerNetworkInterfaceOptionsModel.SetID("testString") + getBareMetalServerNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getBareMetalServerNetworkInterfaceOptionsModel).ToNot(BeNil()) + Expect(getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetBareMetalServerOptions successfully`, func() { + // Construct an instance of the GetBareMetalServerOptions model + id := "testString" + getBareMetalServerOptionsModel := vpcService.NewGetBareMetalServerOptions(id) + getBareMetalServerOptionsModel.SetID("testString") + getBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getBareMetalServerOptionsModel).ToNot(BeNil()) + Expect(getBareMetalServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetBareMetalServerProfileOptions successfully`, func() { + // Construct an instance of the GetBareMetalServerProfileOptions model + name := "testString" + getBareMetalServerProfileOptionsModel := vpcService.NewGetBareMetalServerProfileOptions(name) + getBareMetalServerProfileOptionsModel.SetName("testString") + getBareMetalServerProfileOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getBareMetalServerProfileOptionsModel).ToNot(BeNil()) + Expect(getBareMetalServerProfileOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerProfileOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetDedicatedHostDiskOptions successfully`, func() { + // Construct an instance of the GetDedicatedHostDiskOptions model + dedicatedHostID := "testString" + id := "testString" + getDedicatedHostDiskOptionsModel := vpcService.NewGetDedicatedHostDiskOptions(dedicatedHostID, id) + getDedicatedHostDiskOptionsModel.SetDedicatedHostID("testString") + getDedicatedHostDiskOptionsModel.SetID("testString") + getDedicatedHostDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getDedicatedHostDiskOptionsModel).ToNot(BeNil()) + Expect(getDedicatedHostDiskOptionsModel.DedicatedHostID).To(Equal(core.StringPtr("testString"))) + Expect(getDedicatedHostDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getDedicatedHostDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetDedicatedHostGroupOptions successfully`, func() { + // Construct an instance of the GetDedicatedHostGroupOptions model + id := "testString" + getDedicatedHostGroupOptionsModel := vpcService.NewGetDedicatedHostGroupOptions(id) + getDedicatedHostGroupOptionsModel.SetID("testString") + getDedicatedHostGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getDedicatedHostGroupOptionsModel).ToNot(BeNil()) + Expect(getDedicatedHostGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getDedicatedHostGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetDedicatedHostOptions successfully`, func() { + // Construct an instance of the GetDedicatedHostOptions model + id := "testString" + getDedicatedHostOptionsModel := vpcService.NewGetDedicatedHostOptions(id) + getDedicatedHostOptionsModel.SetID("testString") + getDedicatedHostOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getDedicatedHostOptionsModel).ToNot(BeNil()) + Expect(getDedicatedHostOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getDedicatedHostOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetDedicatedHostProfileOptions successfully`, func() { + // Construct an instance of the GetDedicatedHostProfileOptions model + name := "testString" + getDedicatedHostProfileOptionsModel := vpcService.NewGetDedicatedHostProfileOptions(name) + getDedicatedHostProfileOptionsModel.SetName("testString") + getDedicatedHostProfileOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getDedicatedHostProfileOptionsModel).ToNot(BeNil()) + Expect(getDedicatedHostProfileOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(getDedicatedHostProfileOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetEndpointGatewayIPOptions successfully`, func() { + // Construct an instance of the GetEndpointGatewayIPOptions model + endpointGatewayID := "testString" + id := "testString" + getEndpointGatewayIPOptionsModel := vpcService.NewGetEndpointGatewayIPOptions(endpointGatewayID, id) + getEndpointGatewayIPOptionsModel.SetEndpointGatewayID("testString") + getEndpointGatewayIPOptionsModel.SetID("testString") + getEndpointGatewayIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getEndpointGatewayIPOptionsModel).ToNot(BeNil()) + Expect(getEndpointGatewayIPOptionsModel.EndpointGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(getEndpointGatewayIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getEndpointGatewayIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetEndpointGatewayOptions successfully`, func() { + // Construct an instance of the GetEndpointGatewayOptions model + id := "testString" + getEndpointGatewayOptionsModel := vpcService.NewGetEndpointGatewayOptions(id) + getEndpointGatewayOptionsModel.SetID("testString") + getEndpointGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getEndpointGatewayOptionsModel).ToNot(BeNil()) + Expect(getEndpointGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getEndpointGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetFloatingIPOptions successfully`, func() { + // Construct an instance of the GetFloatingIPOptions model + id := "testString" + getFloatingIPOptionsModel := vpcService.NewGetFloatingIPOptions(id) + getFloatingIPOptionsModel.SetID("testString") + getFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getFloatingIPOptionsModel).ToNot(BeNil()) + Expect(getFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetFlowLogCollectorOptions successfully`, func() { + // Construct an instance of the GetFlowLogCollectorOptions model + id := "testString" + getFlowLogCollectorOptionsModel := vpcService.NewGetFlowLogCollectorOptions(id) + getFlowLogCollectorOptionsModel.SetID("testString") + getFlowLogCollectorOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getFlowLogCollectorOptionsModel).ToNot(BeNil()) + Expect(getFlowLogCollectorOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getFlowLogCollectorOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetIkePolicyOptions successfully`, func() { + // Construct an instance of the GetIkePolicyOptions model + id := "testString" + getIkePolicyOptionsModel := vpcService.NewGetIkePolicyOptions(id) + getIkePolicyOptionsModel.SetID("testString") + getIkePolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getIkePolicyOptionsModel).ToNot(BeNil()) + Expect(getIkePolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getIkePolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetImageOptions successfully`, func() { + // Construct an instance of the GetImageOptions model + id := "testString" + getImageOptionsModel := vpcService.NewGetImageOptions(id) + getImageOptionsModel.SetID("testString") + getImageOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getImageOptionsModel).ToNot(BeNil()) + Expect(getImageOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getImageOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetInstanceDiskOptions successfully`, func() { + // Construct an instance of the GetInstanceDiskOptions model + instanceID := "testString" + id := "testString" + getInstanceDiskOptionsModel := vpcService.NewGetInstanceDiskOptions(instanceID, id) + getInstanceDiskOptionsModel.SetInstanceID("testString") + getInstanceDiskOptionsModel.SetID("testString") + getInstanceDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceDiskOptionsModel).ToNot(BeNil()) + Expect(getInstanceDiskOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetInstanceGroupManagerActionOptions successfully`, func() { + // Construct an instance of the GetInstanceGroupManagerActionOptions model + instanceGroupID := "testString" + instanceGroupManagerID := "testString" + id := "testString" + getInstanceGroupManagerActionOptionsModel := vpcService.NewGetInstanceGroupManagerActionOptions(instanceGroupID, instanceGroupManagerID, id) + getInstanceGroupManagerActionOptionsModel.SetInstanceGroupID("testString") + getInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerID("testString") + getInstanceGroupManagerActionOptionsModel.SetID("testString") + getInstanceGroupManagerActionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceGroupManagerActionOptionsModel).ToNot(BeNil()) + Expect(getInstanceGroupManagerActionOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceGroupManagerActionOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceGroupManagerActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetInstanceGroupManagerOptions successfully`, func() { + // Construct an instance of the GetInstanceGroupManagerOptions model + instanceGroupID := "testString" + id := "testString" + getInstanceGroupManagerOptionsModel := vpcService.NewGetInstanceGroupManagerOptions(instanceGroupID, id) + getInstanceGroupManagerOptionsModel.SetInstanceGroupID("testString") + getInstanceGroupManagerOptionsModel.SetID("testString") + getInstanceGroupManagerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceGroupManagerOptionsModel).ToNot(BeNil()) + Expect(getInstanceGroupManagerOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceGroupManagerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceGroupManagerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetInstanceGroupManagerPolicyOptions successfully`, func() { + // Construct an instance of the GetInstanceGroupManagerPolicyOptions model + instanceGroupID := "testString" + instanceGroupManagerID := "testString" + id := "testString" + getInstanceGroupManagerPolicyOptionsModel := vpcService.NewGetInstanceGroupManagerPolicyOptions(instanceGroupID, instanceGroupManagerID, id) + getInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupID("testString") + getInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerID("testString") + getInstanceGroupManagerPolicyOptionsModel.SetID("testString") + getInstanceGroupManagerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceGroupManagerPolicyOptionsModel).ToNot(BeNil()) + Expect(getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceGroupManagerPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceGroupManagerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetInstanceGroupMembershipOptions successfully`, func() { + // Construct an instance of the GetInstanceGroupMembershipOptions model + instanceGroupID := "testString" + id := "testString" + getInstanceGroupMembershipOptionsModel := vpcService.NewGetInstanceGroupMembershipOptions(instanceGroupID, id) + getInstanceGroupMembershipOptionsModel.SetInstanceGroupID("testString") + getInstanceGroupMembershipOptionsModel.SetID("testString") + getInstanceGroupMembershipOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceGroupMembershipOptionsModel).ToNot(BeNil()) + Expect(getInstanceGroupMembershipOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceGroupMembershipOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceGroupMembershipOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetInstanceGroupOptions successfully`, func() { + // Construct an instance of the GetInstanceGroupOptions model + id := "testString" + getInstanceGroupOptionsModel := vpcService.NewGetInstanceGroupOptions(id) + getInstanceGroupOptionsModel.SetID("testString") + getInstanceGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceGroupOptionsModel).ToNot(BeNil()) + Expect(getInstanceGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetInstanceInitializationOptions successfully`, func() { + // Construct an instance of the GetInstanceInitializationOptions model + id := "testString" + getInstanceInitializationOptionsModel := vpcService.NewGetInstanceInitializationOptions(id) + getInstanceInitializationOptionsModel.SetID("testString") + getInstanceInitializationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceInitializationOptionsModel).ToNot(BeNil()) + Expect(getInstanceInitializationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceInitializationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetInstanceNetworkInterfaceFloatingIPOptions successfully`, func() { + // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model + instanceID := "testString" + networkInterfaceID := "testString" + id := "testString" + getInstanceNetworkInterfaceFloatingIPOptionsModel := vpcService.NewGetInstanceNetworkInterfaceFloatingIPOptions(instanceID, networkInterfaceID, id) + getInstanceNetworkInterfaceFloatingIPOptionsModel.SetInstanceID("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.SetNetworkInterfaceID("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.SetID("testString") + getInstanceNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) + Expect(getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetInstanceNetworkInterfaceIPOptions successfully`, func() { + // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model + instanceID := "testString" + networkInterfaceID := "testString" + id := "testString" + getInstanceNetworkInterfaceIPOptionsModel := vpcService.NewGetInstanceNetworkInterfaceIPOptions(instanceID, networkInterfaceID, id) + getInstanceNetworkInterfaceIPOptionsModel.SetInstanceID("testString") + getInstanceNetworkInterfaceIPOptionsModel.SetNetworkInterfaceID("testString") + getInstanceNetworkInterfaceIPOptionsModel.SetID("testString") + getInstanceNetworkInterfaceIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceNetworkInterfaceIPOptionsModel).ToNot(BeNil()) + Expect(getInstanceNetworkInterfaceIPOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceNetworkInterfaceIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceNetworkInterfaceIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetInstanceNetworkInterfaceOptions successfully`, func() { + // Construct an instance of the GetInstanceNetworkInterfaceOptions model + instanceID := "testString" + id := "testString" + getInstanceNetworkInterfaceOptionsModel := vpcService.NewGetInstanceNetworkInterfaceOptions(instanceID, id) + getInstanceNetworkInterfaceOptionsModel.SetInstanceID("testString") + getInstanceNetworkInterfaceOptionsModel.SetID("testString") + getInstanceNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceNetworkInterfaceOptionsModel).ToNot(BeNil()) + Expect(getInstanceNetworkInterfaceOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetInstanceOptions successfully`, func() { + // Construct an instance of the GetInstanceOptions model + id := "testString" + getInstanceOptionsModel := vpcService.NewGetInstanceOptions(id) + getInstanceOptionsModel.SetID("testString") + getInstanceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceOptionsModel).ToNot(BeNil()) + Expect(getInstanceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetInstanceProfileOptions successfully`, func() { + // Construct an instance of the GetInstanceProfileOptions model + name := "testString" + getInstanceProfileOptionsModel := vpcService.NewGetInstanceProfileOptions(name) + getInstanceProfileOptionsModel.SetName("testString") + getInstanceProfileOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceProfileOptionsModel).ToNot(BeNil()) + Expect(getInstanceProfileOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceProfileOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetInstanceTemplateOptions successfully`, func() { + // Construct an instance of the GetInstanceTemplateOptions model + id := "testString" + getInstanceTemplateOptionsModel := vpcService.NewGetInstanceTemplateOptions(id) + getInstanceTemplateOptionsModel.SetID("testString") + getInstanceTemplateOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceTemplateOptionsModel).ToNot(BeNil()) + Expect(getInstanceTemplateOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceTemplateOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetInstanceVolumeAttachmentOptions successfully`, func() { + // Construct an instance of the GetInstanceVolumeAttachmentOptions model + instanceID := "testString" + id := "testString" + getInstanceVolumeAttachmentOptionsModel := vpcService.NewGetInstanceVolumeAttachmentOptions(instanceID, id) + getInstanceVolumeAttachmentOptionsModel.SetInstanceID("testString") + getInstanceVolumeAttachmentOptionsModel.SetID("testString") + getInstanceVolumeAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getInstanceVolumeAttachmentOptionsModel).ToNot(BeNil()) + Expect(getInstanceVolumeAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceVolumeAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getInstanceVolumeAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetIpsecPolicyOptions successfully`, func() { + // Construct an instance of the GetIpsecPolicyOptions model + id := "testString" + getIpsecPolicyOptionsModel := vpcService.NewGetIpsecPolicyOptions(id) + getIpsecPolicyOptionsModel.SetID("testString") + getIpsecPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getIpsecPolicyOptionsModel).ToNot(BeNil()) + Expect(getIpsecPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getIpsecPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetKeyOptions successfully`, func() { + // Construct an instance of the GetKeyOptions model + id := "testString" + getKeyOptionsModel := vpcService.NewGetKeyOptions(id) + getKeyOptionsModel.SetID("testString") + getKeyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getKeyOptionsModel).ToNot(BeNil()) + Expect(getKeyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getKeyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetLoadBalancerListenerOptions successfully`, func() { + // Construct an instance of the GetLoadBalancerListenerOptions model + loadBalancerID := "testString" + id := "testString" + getLoadBalancerListenerOptionsModel := vpcService.NewGetLoadBalancerListenerOptions(loadBalancerID, id) + getLoadBalancerListenerOptionsModel.SetLoadBalancerID("testString") + getLoadBalancerListenerOptionsModel.SetID("testString") + getLoadBalancerListenerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getLoadBalancerListenerOptionsModel).ToNot(BeNil()) + Expect(getLoadBalancerListenerOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerListenerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerListenerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetLoadBalancerListenerPolicyOptions successfully`, func() { + // Construct an instance of the GetLoadBalancerListenerPolicyOptions model + loadBalancerID := "testString" + listenerID := "testString" + id := "testString" + getLoadBalancerListenerPolicyOptionsModel := vpcService.NewGetLoadBalancerListenerPolicyOptions(loadBalancerID, listenerID, id) + getLoadBalancerListenerPolicyOptionsModel.SetLoadBalancerID("testString") + getLoadBalancerListenerPolicyOptionsModel.SetListenerID("testString") + getLoadBalancerListenerPolicyOptionsModel.SetID("testString") + getLoadBalancerListenerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getLoadBalancerListenerPolicyOptionsModel).ToNot(BeNil()) + Expect(getLoadBalancerListenerPolicyOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerListenerPolicyOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerListenerPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerListenerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetLoadBalancerListenerPolicyRuleOptions successfully`, func() { + // Construct an instance of the GetLoadBalancerListenerPolicyRuleOptions model + loadBalancerID := "testString" + listenerID := "testString" + policyID := "testString" + id := "testString" + getLoadBalancerListenerPolicyRuleOptionsModel := vpcService.NewGetLoadBalancerListenerPolicyRuleOptions(loadBalancerID, listenerID, policyID, id) + getLoadBalancerListenerPolicyRuleOptionsModel.SetLoadBalancerID("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.SetListenerID("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.SetPolicyID("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.SetID("testString") + getLoadBalancerListenerPolicyRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getLoadBalancerListenerPolicyRuleOptionsModel).ToNot(BeNil()) + Expect(getLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerListenerPolicyRuleOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerListenerPolicyRuleOptionsModel.PolicyID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerListenerPolicyRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerListenerPolicyRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetLoadBalancerOptions successfully`, func() { + // Construct an instance of the GetLoadBalancerOptions model + id := "testString" + getLoadBalancerOptionsModel := vpcService.NewGetLoadBalancerOptions(id) + getLoadBalancerOptionsModel.SetID("testString") + getLoadBalancerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getLoadBalancerOptionsModel).ToNot(BeNil()) + Expect(getLoadBalancerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetLoadBalancerPoolMemberOptions successfully`, func() { + // Construct an instance of the GetLoadBalancerPoolMemberOptions model + loadBalancerID := "testString" + poolID := "testString" + id := "testString" + getLoadBalancerPoolMemberOptionsModel := vpcService.NewGetLoadBalancerPoolMemberOptions(loadBalancerID, poolID, id) + getLoadBalancerPoolMemberOptionsModel.SetLoadBalancerID("testString") + getLoadBalancerPoolMemberOptionsModel.SetPoolID("testString") + getLoadBalancerPoolMemberOptionsModel.SetID("testString") + getLoadBalancerPoolMemberOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getLoadBalancerPoolMemberOptionsModel).ToNot(BeNil()) + Expect(getLoadBalancerPoolMemberOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerPoolMemberOptionsModel.PoolID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerPoolMemberOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerPoolMemberOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetLoadBalancerPoolOptions successfully`, func() { + // Construct an instance of the GetLoadBalancerPoolOptions model + loadBalancerID := "testString" + id := "testString" + getLoadBalancerPoolOptionsModel := vpcService.NewGetLoadBalancerPoolOptions(loadBalancerID, id) + getLoadBalancerPoolOptionsModel.SetLoadBalancerID("testString") + getLoadBalancerPoolOptionsModel.SetID("testString") + getLoadBalancerPoolOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getLoadBalancerPoolOptionsModel).ToNot(BeNil()) + Expect(getLoadBalancerPoolOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerPoolOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerPoolOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetLoadBalancerProfileOptions successfully`, func() { + // Construct an instance of the GetLoadBalancerProfileOptions model + name := "testString" + getLoadBalancerProfileOptionsModel := vpcService.NewGetLoadBalancerProfileOptions(name) + getLoadBalancerProfileOptionsModel.SetName("testString") + getLoadBalancerProfileOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getLoadBalancerProfileOptionsModel).ToNot(BeNil()) + Expect(getLoadBalancerProfileOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerProfileOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetLoadBalancerStatisticsOptions successfully`, func() { + // Construct an instance of the GetLoadBalancerStatisticsOptions model + id := "testString" + getLoadBalancerStatisticsOptionsModel := vpcService.NewGetLoadBalancerStatisticsOptions(id) + getLoadBalancerStatisticsOptionsModel.SetID("testString") + getLoadBalancerStatisticsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getLoadBalancerStatisticsOptionsModel).ToNot(BeNil()) + Expect(getLoadBalancerStatisticsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getLoadBalancerStatisticsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetNetworkACLOptions successfully`, func() { + // Construct an instance of the GetNetworkACLOptions model + id := "testString" + getNetworkACLOptionsModel := vpcService.NewGetNetworkACLOptions(id) + getNetworkACLOptionsModel.SetID("testString") + getNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getNetworkACLOptionsModel).ToNot(BeNil()) + Expect(getNetworkACLOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetNetworkACLRuleOptions successfully`, func() { + // Construct an instance of the GetNetworkACLRuleOptions model + networkACLID := "testString" + id := "testString" + getNetworkACLRuleOptionsModel := vpcService.NewGetNetworkACLRuleOptions(networkACLID, id) + getNetworkACLRuleOptionsModel.SetNetworkACLID("testString") + getNetworkACLRuleOptionsModel.SetID("testString") + getNetworkACLRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getNetworkACLRuleOptionsModel).ToNot(BeNil()) + Expect(getNetworkACLRuleOptionsModel.NetworkACLID).To(Equal(core.StringPtr("testString"))) + Expect(getNetworkACLRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getNetworkACLRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetOperatingSystemOptions successfully`, func() { + // Construct an instance of the GetOperatingSystemOptions model + name := "testString" + getOperatingSystemOptionsModel := vpcService.NewGetOperatingSystemOptions(name) + getOperatingSystemOptionsModel.SetName("testString") + getOperatingSystemOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getOperatingSystemOptionsModel).ToNot(BeNil()) + Expect(getOperatingSystemOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(getOperatingSystemOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetPlacementGroupOptions successfully`, func() { + // Construct an instance of the GetPlacementGroupOptions model + id := "testString" + getPlacementGroupOptionsModel := vpcService.NewGetPlacementGroupOptions(id) + getPlacementGroupOptionsModel.SetID("testString") + getPlacementGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getPlacementGroupOptionsModel).ToNot(BeNil()) + Expect(getPlacementGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getPlacementGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetPublicGatewayOptions successfully`, func() { + // Construct an instance of the GetPublicGatewayOptions model + id := "testString" + getPublicGatewayOptionsModel := vpcService.NewGetPublicGatewayOptions(id) + getPublicGatewayOptionsModel.SetID("testString") + getPublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getPublicGatewayOptionsModel).ToNot(BeNil()) + Expect(getPublicGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getPublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetRegionOptions successfully`, func() { + // Construct an instance of the GetRegionOptions model + name := "testString" + getRegionOptionsModel := vpcService.NewGetRegionOptions(name) + getRegionOptionsModel.SetName("testString") + getRegionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getRegionOptionsModel).ToNot(BeNil()) + Expect(getRegionOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(getRegionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetRegionZoneOptions successfully`, func() { + // Construct an instance of the GetRegionZoneOptions model + regionName := "testString" + name := "testString" + getRegionZoneOptionsModel := vpcService.NewGetRegionZoneOptions(regionName, name) + getRegionZoneOptionsModel.SetRegionName("testString") + getRegionZoneOptionsModel.SetName("testString") + getRegionZoneOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getRegionZoneOptionsModel).ToNot(BeNil()) + Expect(getRegionZoneOptionsModel.RegionName).To(Equal(core.StringPtr("testString"))) + Expect(getRegionZoneOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(getRegionZoneOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetSecurityGroupOptions successfully`, func() { + // Construct an instance of the GetSecurityGroupOptions model + id := "testString" + getSecurityGroupOptionsModel := vpcService.NewGetSecurityGroupOptions(id) + getSecurityGroupOptionsModel.SetID("testString") + getSecurityGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getSecurityGroupOptionsModel).ToNot(BeNil()) + Expect(getSecurityGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getSecurityGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetSecurityGroupRuleOptions successfully`, func() { + // Construct an instance of the GetSecurityGroupRuleOptions model + securityGroupID := "testString" + id := "testString" + getSecurityGroupRuleOptionsModel := vpcService.NewGetSecurityGroupRuleOptions(securityGroupID, id) + getSecurityGroupRuleOptionsModel.SetSecurityGroupID("testString") + getSecurityGroupRuleOptionsModel.SetID("testString") + getSecurityGroupRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getSecurityGroupRuleOptionsModel).ToNot(BeNil()) + Expect(getSecurityGroupRuleOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) + Expect(getSecurityGroupRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getSecurityGroupRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetSecurityGroupTargetOptions successfully`, func() { + // Construct an instance of the GetSecurityGroupTargetOptions model + securityGroupID := "testString" + id := "testString" + getSecurityGroupTargetOptionsModel := vpcService.NewGetSecurityGroupTargetOptions(securityGroupID, id) + getSecurityGroupTargetOptionsModel.SetSecurityGroupID("testString") + getSecurityGroupTargetOptionsModel.SetID("testString") + getSecurityGroupTargetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getSecurityGroupTargetOptionsModel).ToNot(BeNil()) + Expect(getSecurityGroupTargetOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) + Expect(getSecurityGroupTargetOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getSecurityGroupTargetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetSnapshotOptions successfully`, func() { + // Construct an instance of the GetSnapshotOptions model + id := "testString" + getSnapshotOptionsModel := vpcService.NewGetSnapshotOptions(id) + getSnapshotOptionsModel.SetID("testString") + getSnapshotOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getSnapshotOptionsModel).ToNot(BeNil()) + Expect(getSnapshotOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getSnapshotOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetSubnetNetworkACLOptions successfully`, func() { + // Construct an instance of the GetSubnetNetworkACLOptions model + id := "testString" + getSubnetNetworkACLOptionsModel := vpcService.NewGetSubnetNetworkACLOptions(id) + getSubnetNetworkACLOptionsModel.SetID("testString") + getSubnetNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getSubnetNetworkACLOptionsModel).ToNot(BeNil()) + Expect(getSubnetNetworkACLOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getSubnetNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetSubnetOptions successfully`, func() { + // Construct an instance of the GetSubnetOptions model + id := "testString" + getSubnetOptionsModel := vpcService.NewGetSubnetOptions(id) + getSubnetOptionsModel.SetID("testString") + getSubnetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getSubnetOptionsModel).ToNot(BeNil()) + Expect(getSubnetOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getSubnetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetSubnetPublicGatewayOptions successfully`, func() { + // Construct an instance of the GetSubnetPublicGatewayOptions model + id := "testString" + getSubnetPublicGatewayOptionsModel := vpcService.NewGetSubnetPublicGatewayOptions(id) + getSubnetPublicGatewayOptionsModel.SetID("testString") + getSubnetPublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getSubnetPublicGatewayOptionsModel).ToNot(BeNil()) + Expect(getSubnetPublicGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getSubnetPublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetSubnetReservedIPOptions successfully`, func() { + // Construct an instance of the GetSubnetReservedIPOptions model + subnetID := "testString" + id := "testString" + getSubnetReservedIPOptionsModel := vpcService.NewGetSubnetReservedIPOptions(subnetID, id) + getSubnetReservedIPOptionsModel.SetSubnetID("testString") + getSubnetReservedIPOptionsModel.SetID("testString") + getSubnetReservedIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getSubnetReservedIPOptionsModel).ToNot(BeNil()) + Expect(getSubnetReservedIPOptionsModel.SubnetID).To(Equal(core.StringPtr("testString"))) + Expect(getSubnetReservedIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetSubnetRoutingTableOptions successfully`, func() { + // Construct an instance of the GetSubnetRoutingTableOptions model + id := "testString" + getSubnetRoutingTableOptionsModel := vpcService.NewGetSubnetRoutingTableOptions(id) + getSubnetRoutingTableOptionsModel.SetID("testString") + getSubnetRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getSubnetRoutingTableOptionsModel).ToNot(BeNil()) + Expect(getSubnetRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getSubnetRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVolumeOptions successfully`, func() { + // Construct an instance of the GetVolumeOptions model + id := "testString" + getVolumeOptionsModel := vpcService.NewGetVolumeOptions(id) + getVolumeOptionsModel.SetID("testString") + getVolumeOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVolumeOptionsModel).ToNot(BeNil()) + Expect(getVolumeOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVolumeOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVolumeProfileOptions successfully`, func() { + // Construct an instance of the GetVolumeProfileOptions model + name := "testString" + getVolumeProfileOptionsModel := vpcService.NewGetVolumeProfileOptions(name) + getVolumeProfileOptionsModel.SetName("testString") + getVolumeProfileOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVolumeProfileOptionsModel).ToNot(BeNil()) + Expect(getVolumeProfileOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(getVolumeProfileOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPCAddressPrefixOptions successfully`, func() { + // Construct an instance of the GetVPCAddressPrefixOptions model + vpcID := "testString" + id := "testString" + getVPCAddressPrefixOptionsModel := vpcService.NewGetVPCAddressPrefixOptions(vpcID, id) + getVPCAddressPrefixOptionsModel.SetVPCID("testString") + getVPCAddressPrefixOptionsModel.SetID("testString") + getVPCAddressPrefixOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPCAddressPrefixOptionsModel).ToNot(BeNil()) + Expect(getVPCAddressPrefixOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(getVPCAddressPrefixOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPCAddressPrefixOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPCDefaultNetworkACLOptions successfully`, func() { + // Construct an instance of the GetVPCDefaultNetworkACLOptions model + id := "testString" + getVPCDefaultNetworkACLOptionsModel := vpcService.NewGetVPCDefaultNetworkACLOptions(id) + getVPCDefaultNetworkACLOptionsModel.SetID("testString") + getVPCDefaultNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPCDefaultNetworkACLOptionsModel).ToNot(BeNil()) + Expect(getVPCDefaultNetworkACLOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPCDefaultNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPCDefaultRoutingTableOptions successfully`, func() { + // Construct an instance of the GetVPCDefaultRoutingTableOptions model + id := "testString" + getVPCDefaultRoutingTableOptionsModel := vpcService.NewGetVPCDefaultRoutingTableOptions(id) + getVPCDefaultRoutingTableOptionsModel.SetID("testString") + getVPCDefaultRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPCDefaultRoutingTableOptionsModel).ToNot(BeNil()) + Expect(getVPCDefaultRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPCDefaultRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPCDefaultSecurityGroupOptions successfully`, func() { + // Construct an instance of the GetVPCDefaultSecurityGroupOptions model + id := "testString" + getVPCDefaultSecurityGroupOptionsModel := vpcService.NewGetVPCDefaultSecurityGroupOptions(id) + getVPCDefaultSecurityGroupOptionsModel.SetID("testString") + getVPCDefaultSecurityGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPCDefaultSecurityGroupOptionsModel).ToNot(BeNil()) + Expect(getVPCDefaultSecurityGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPCDefaultSecurityGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPCOptions successfully`, func() { + // Construct an instance of the GetVPCOptions model + id := "testString" + getVPCOptionsModel := vpcService.NewGetVPCOptions(id) + getVPCOptionsModel.SetID("testString") + getVPCOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPCOptionsModel).ToNot(BeNil()) + Expect(getVPCOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPCOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPCRouteOptions successfully`, func() { + // Construct an instance of the GetVPCRouteOptions model + vpcID := "testString" + id := "testString" + getVPCRouteOptionsModel := vpcService.NewGetVPCRouteOptions(vpcID, id) + getVPCRouteOptionsModel.SetVPCID("testString") + getVPCRouteOptionsModel.SetID("testString") + getVPCRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPCRouteOptionsModel).ToNot(BeNil()) + Expect(getVPCRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(getVPCRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPCRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPCRoutingTableOptions successfully`, func() { + // Construct an instance of the GetVPCRoutingTableOptions model + vpcID := "testString" + id := "testString" + getVPCRoutingTableOptionsModel := vpcService.NewGetVPCRoutingTableOptions(vpcID, id) + getVPCRoutingTableOptionsModel.SetVPCID("testString") + getVPCRoutingTableOptionsModel.SetID("testString") + getVPCRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPCRoutingTableOptionsModel).ToNot(BeNil()) + Expect(getVPCRoutingTableOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(getVPCRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPCRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPCRoutingTableRouteOptions successfully`, func() { + // Construct an instance of the GetVPCRoutingTableRouteOptions model + vpcID := "testString" + routingTableID := "testString" + id := "testString" + getVPCRoutingTableRouteOptionsModel := vpcService.NewGetVPCRoutingTableRouteOptions(vpcID, routingTableID, id) + getVPCRoutingTableRouteOptionsModel.SetVPCID("testString") + getVPCRoutingTableRouteOptionsModel.SetRoutingTableID("testString") + getVPCRoutingTableRouteOptionsModel.SetID("testString") + getVPCRoutingTableRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPCRoutingTableRouteOptionsModel).ToNot(BeNil()) + Expect(getVPCRoutingTableRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(getVPCRoutingTableRouteOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) + Expect(getVPCRoutingTableRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPCRoutingTableRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPNGatewayConnectionOptions successfully`, func() { + // Construct an instance of the GetVPNGatewayConnectionOptions model + vpnGatewayID := "testString" + id := "testString" + getVPNGatewayConnectionOptionsModel := vpcService.NewGetVPNGatewayConnectionOptions(vpnGatewayID, id) + getVPNGatewayConnectionOptionsModel.SetVPNGatewayID("testString") + getVPNGatewayConnectionOptionsModel.SetID("testString") + getVPNGatewayConnectionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPNGatewayConnectionOptionsModel).ToNot(BeNil()) + Expect(getVPNGatewayConnectionOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNGatewayConnectionOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNGatewayConnectionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPNGatewayOptions successfully`, func() { + // Construct an instance of the GetVPNGatewayOptions model + id := "testString" + getVPNGatewayOptionsModel := vpcService.NewGetVPNGatewayOptions(id) + getVPNGatewayOptionsModel.SetID("testString") + getVPNGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPNGatewayOptionsModel).ToNot(BeNil()) + Expect(getVPNGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPNServerClientConfigurationOptions successfully`, func() { + // Construct an instance of the GetVPNServerClientConfigurationOptions model + id := "testString" + getVPNServerClientConfigurationOptionsModel := vpcService.NewGetVPNServerClientConfigurationOptions(id) + getVPNServerClientConfigurationOptionsModel.SetID("testString") + getVPNServerClientConfigurationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPNServerClientConfigurationOptionsModel).ToNot(BeNil()) + Expect(getVPNServerClientConfigurationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNServerClientConfigurationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPNServerClientOptions successfully`, func() { + // Construct an instance of the GetVPNServerClientOptions model + vpnServerID := "testString" + id := "testString" + getVPNServerClientOptionsModel := vpcService.NewGetVPNServerClientOptions(vpnServerID, id) + getVPNServerClientOptionsModel.SetVPNServerID("testString") + getVPNServerClientOptionsModel.SetID("testString") + getVPNServerClientOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPNServerClientOptionsModel).ToNot(BeNil()) + Expect(getVPNServerClientOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNServerClientOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNServerClientOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPNServerOptions successfully`, func() { + // Construct an instance of the GetVPNServerOptions model + id := "testString" + getVPNServerOptionsModel := vpcService.NewGetVPNServerOptions(id) + getVPNServerOptionsModel.SetID("testString") + getVPNServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPNServerOptionsModel).ToNot(BeNil()) + Expect(getVPNServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPNServerRouteOptions successfully`, func() { + // Construct an instance of the GetVPNServerRouteOptions model + vpnServerID := "testString" + id := "testString" + getVPNServerRouteOptionsModel := vpcService.NewGetVPNServerRouteOptions(vpnServerID, id) + getVPNServerRouteOptionsModel.SetVPNServerID("testString") + getVPNServerRouteOptionsModel.SetID("testString") + getVPNServerRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPNServerRouteOptionsModel).ToNot(BeNil()) + Expect(getVPNServerRouteOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNServerRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNServerRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewIP successfully`, func() { + address := "192.168.3.4" + _model, err := vpcService.NewIP(address) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewImageFilePrototype successfully`, func() { + href := "cos://us-south/custom-image-vpc-bucket/customImage-0.vhd" + _model, err := vpcService.NewImageFilePrototype(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstanceDefaultTrustedProfilePrototype successfully`, func() { + var target vpcv1.TrustedProfileIdentityIntf = nil + _, err := vpcService.NewInstanceDefaultTrustedProfilePrototype(target) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceGroupManagerScheduledActionGroupPrototype successfully`, func() { + membershipCount := int64(10) + _model, err := vpcService.NewInstanceGroupManagerScheduledActionGroupPrototype(membershipCount) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewListBackupPoliciesOptions successfully`, func() { + // Construct an instance of the ListBackupPoliciesOptions model + listBackupPoliciesOptionsModel := vpcService.NewListBackupPoliciesOptions() + listBackupPoliciesOptionsModel.SetStart("testString") + listBackupPoliciesOptionsModel.SetLimit(int64(1)) + listBackupPoliciesOptionsModel.SetResourceGroupID("testString") + listBackupPoliciesOptionsModel.SetName("testString") + listBackupPoliciesOptionsModel.SetTag("testString") + listBackupPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listBackupPoliciesOptionsModel).ToNot(BeNil()) + Expect(listBackupPoliciesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listBackupPoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listBackupPoliciesOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listBackupPoliciesOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(listBackupPoliciesOptionsModel.Tag).To(Equal(core.StringPtr("testString"))) + Expect(listBackupPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListBackupPolicyPlansOptions successfully`, func() { + // Construct an instance of the ListBackupPolicyPlansOptions model + backupPolicyID := "testString" + listBackupPolicyPlansOptionsModel := vpcService.NewListBackupPolicyPlansOptions(backupPolicyID) + listBackupPolicyPlansOptionsModel.SetBackupPolicyID("testString") + listBackupPolicyPlansOptionsModel.SetName("testString") + listBackupPolicyPlansOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listBackupPolicyPlansOptionsModel).ToNot(BeNil()) + Expect(listBackupPolicyPlansOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) + Expect(listBackupPolicyPlansOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(listBackupPolicyPlansOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListBareMetalServerDisksOptions successfully`, func() { + // Construct an instance of the ListBareMetalServerDisksOptions model + bareMetalServerID := "testString" + listBareMetalServerDisksOptionsModel := vpcService.NewListBareMetalServerDisksOptions(bareMetalServerID) + listBareMetalServerDisksOptionsModel.SetBareMetalServerID("testString") + listBareMetalServerDisksOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listBareMetalServerDisksOptionsModel).ToNot(BeNil()) + Expect(listBareMetalServerDisksOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServerDisksOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListBareMetalServerNetworkInterfaceFloatingIpsOptions successfully`, func() { + // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model + bareMetalServerID := "testString" + networkInterfaceID := "testString" + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := vpcService.NewListBareMetalServerNetworkInterfaceFloatingIpsOptions(bareMetalServerID, networkInterfaceID) + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.SetBareMetalServerID("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.SetNetworkInterfaceID("testString") + listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel).ToNot(BeNil()) + Expect(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListBareMetalServerNetworkInterfacesOptions successfully`, func() { + // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model + bareMetalServerID := "testString" + listBareMetalServerNetworkInterfacesOptionsModel := vpcService.NewListBareMetalServerNetworkInterfacesOptions(bareMetalServerID) + listBareMetalServerNetworkInterfacesOptionsModel.SetBareMetalServerID("testString") + listBareMetalServerNetworkInterfacesOptionsModel.SetStart("testString") + listBareMetalServerNetworkInterfacesOptionsModel.SetLimit(int64(1)) + listBareMetalServerNetworkInterfacesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listBareMetalServerNetworkInterfacesOptionsModel).ToNot(BeNil()) + Expect(listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServerNetworkInterfacesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServerNetworkInterfacesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listBareMetalServerNetworkInterfacesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListBareMetalServerProfilesOptions successfully`, func() { + // Construct an instance of the ListBareMetalServerProfilesOptions model + listBareMetalServerProfilesOptionsModel := vpcService.NewListBareMetalServerProfilesOptions() + listBareMetalServerProfilesOptionsModel.SetStart("testString") + listBareMetalServerProfilesOptionsModel.SetLimit(int64(1)) + listBareMetalServerProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listBareMetalServerProfilesOptionsModel).ToNot(BeNil()) + Expect(listBareMetalServerProfilesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServerProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listBareMetalServerProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListBareMetalServersOptions successfully`, func() { + // Construct an instance of the ListBareMetalServersOptions model + listBareMetalServersOptionsModel := vpcService.NewListBareMetalServersOptions() + listBareMetalServersOptionsModel.SetStart("testString") + listBareMetalServersOptionsModel.SetLimit(int64(1)) + listBareMetalServersOptionsModel.SetResourceGroupID("testString") + listBareMetalServersOptionsModel.SetName("testString") + listBareMetalServersOptionsModel.SetVPCID("testString") + listBareMetalServersOptionsModel.SetVPCCRN("testString") + listBareMetalServersOptionsModel.SetVPCName("testString") + listBareMetalServersOptionsModel.SetNetworkInterfacesSubnetID("testString") + listBareMetalServersOptionsModel.SetNetworkInterfacesSubnetCRN("testString") + listBareMetalServersOptionsModel.SetNetworkInterfacesSubnetName("testString") + listBareMetalServersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listBareMetalServersOptionsModel).ToNot(BeNil()) + Expect(listBareMetalServersOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listBareMetalServersOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServersOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServersOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServersOptionsModel.VPCCRN).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServersOptionsModel.VPCName).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServersOptionsModel.NetworkInterfacesSubnetID).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServersOptionsModel.NetworkInterfacesSubnetCRN).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServersOptionsModel.NetworkInterfacesSubnetName).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListDedicatedHostDisksOptions successfully`, func() { + // Construct an instance of the ListDedicatedHostDisksOptions model + dedicatedHostID := "testString" + listDedicatedHostDisksOptionsModel := vpcService.NewListDedicatedHostDisksOptions(dedicatedHostID) + listDedicatedHostDisksOptionsModel.SetDedicatedHostID("testString") + listDedicatedHostDisksOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listDedicatedHostDisksOptionsModel).ToNot(BeNil()) + Expect(listDedicatedHostDisksOptionsModel.DedicatedHostID).To(Equal(core.StringPtr("testString"))) + Expect(listDedicatedHostDisksOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListDedicatedHostGroupsOptions successfully`, func() { + // Construct an instance of the ListDedicatedHostGroupsOptions model + listDedicatedHostGroupsOptionsModel := vpcService.NewListDedicatedHostGroupsOptions() + listDedicatedHostGroupsOptionsModel.SetStart("testString") + listDedicatedHostGroupsOptionsModel.SetLimit(int64(1)) + listDedicatedHostGroupsOptionsModel.SetResourceGroupID("testString") + listDedicatedHostGroupsOptionsModel.SetZoneName("testString") + listDedicatedHostGroupsOptionsModel.SetName("testString") + listDedicatedHostGroupsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listDedicatedHostGroupsOptionsModel).ToNot(BeNil()) + Expect(listDedicatedHostGroupsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listDedicatedHostGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listDedicatedHostGroupsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listDedicatedHostGroupsOptionsModel.ZoneName).To(Equal(core.StringPtr("testString"))) + Expect(listDedicatedHostGroupsOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(listDedicatedHostGroupsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListDedicatedHostProfilesOptions successfully`, func() { + // Construct an instance of the ListDedicatedHostProfilesOptions model + listDedicatedHostProfilesOptionsModel := vpcService.NewListDedicatedHostProfilesOptions() + listDedicatedHostProfilesOptionsModel.SetStart("testString") + listDedicatedHostProfilesOptionsModel.SetLimit(int64(1)) + listDedicatedHostProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listDedicatedHostProfilesOptionsModel).ToNot(BeNil()) + Expect(listDedicatedHostProfilesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listDedicatedHostProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listDedicatedHostProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListDedicatedHostsOptions successfully`, func() { + // Construct an instance of the ListDedicatedHostsOptions model + listDedicatedHostsOptionsModel := vpcService.NewListDedicatedHostsOptions() + listDedicatedHostsOptionsModel.SetDedicatedHostGroupID("testString") + listDedicatedHostsOptionsModel.SetStart("testString") + listDedicatedHostsOptionsModel.SetLimit(int64(1)) + listDedicatedHostsOptionsModel.SetResourceGroupID("testString") + listDedicatedHostsOptionsModel.SetZoneName("testString") + listDedicatedHostsOptionsModel.SetName("testString") + listDedicatedHostsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listDedicatedHostsOptionsModel).ToNot(BeNil()) + Expect(listDedicatedHostsOptionsModel.DedicatedHostGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listDedicatedHostsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listDedicatedHostsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listDedicatedHostsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listDedicatedHostsOptionsModel.ZoneName).To(Equal(core.StringPtr("testString"))) + Expect(listDedicatedHostsOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(listDedicatedHostsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListEndpointGatewayIpsOptions successfully`, func() { + // Construct an instance of the ListEndpointGatewayIpsOptions model + endpointGatewayID := "testString" + listEndpointGatewayIpsOptionsModel := vpcService.NewListEndpointGatewayIpsOptions(endpointGatewayID) + listEndpointGatewayIpsOptionsModel.SetEndpointGatewayID("testString") + listEndpointGatewayIpsOptionsModel.SetStart("testString") + listEndpointGatewayIpsOptionsModel.SetLimit(int64(1)) + listEndpointGatewayIpsOptionsModel.SetSort("name") + listEndpointGatewayIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listEndpointGatewayIpsOptionsModel).ToNot(BeNil()) + Expect(listEndpointGatewayIpsOptionsModel.EndpointGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(listEndpointGatewayIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listEndpointGatewayIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listEndpointGatewayIpsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listEndpointGatewayIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListEndpointGatewaysOptions successfully`, func() { + // Construct an instance of the ListEndpointGatewaysOptions model + listEndpointGatewaysOptionsModel := vpcService.NewListEndpointGatewaysOptions() + listEndpointGatewaysOptionsModel.SetName("testString") + listEndpointGatewaysOptionsModel.SetStart("testString") + listEndpointGatewaysOptionsModel.SetLimit(int64(1)) + listEndpointGatewaysOptionsModel.SetResourceGroupID("testString") + listEndpointGatewaysOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listEndpointGatewaysOptionsModel).ToNot(BeNil()) + Expect(listEndpointGatewaysOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(listEndpointGatewaysOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listEndpointGatewaysOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listEndpointGatewaysOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listEndpointGatewaysOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListFloatingIpsOptions successfully`, func() { + // Construct an instance of the ListFloatingIpsOptions model + listFloatingIpsOptionsModel := vpcService.NewListFloatingIpsOptions() + listFloatingIpsOptionsModel.SetStart("testString") + listFloatingIpsOptionsModel.SetLimit(int64(1)) + listFloatingIpsOptionsModel.SetResourceGroupID("testString") + listFloatingIpsOptionsModel.SetSort("name") + listFloatingIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listFloatingIpsOptionsModel).ToNot(BeNil()) + Expect(listFloatingIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listFloatingIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listFloatingIpsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listFloatingIpsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listFloatingIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListFlowLogCollectorsOptions successfully`, func() { + // Construct an instance of the ListFlowLogCollectorsOptions model + listFlowLogCollectorsOptionsModel := vpcService.NewListFlowLogCollectorsOptions() + listFlowLogCollectorsOptionsModel.SetStart("testString") + listFlowLogCollectorsOptionsModel.SetLimit(int64(1)) + listFlowLogCollectorsOptionsModel.SetResourceGroupID("testString") + listFlowLogCollectorsOptionsModel.SetName("testString") + listFlowLogCollectorsOptionsModel.SetVPCID("testString") + listFlowLogCollectorsOptionsModel.SetVPCCRN("testString") + listFlowLogCollectorsOptionsModel.SetVPCName("testString") + listFlowLogCollectorsOptionsModel.SetTargetID("testString") + listFlowLogCollectorsOptionsModel.SetTargetResourceType("instance") + listFlowLogCollectorsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listFlowLogCollectorsOptionsModel).ToNot(BeNil()) + Expect(listFlowLogCollectorsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listFlowLogCollectorsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listFlowLogCollectorsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listFlowLogCollectorsOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(listFlowLogCollectorsOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(listFlowLogCollectorsOptionsModel.VPCCRN).To(Equal(core.StringPtr("testString"))) + Expect(listFlowLogCollectorsOptionsModel.VPCName).To(Equal(core.StringPtr("testString"))) + Expect(listFlowLogCollectorsOptionsModel.TargetID).To(Equal(core.StringPtr("testString"))) + Expect(listFlowLogCollectorsOptionsModel.TargetResourceType).To(Equal(core.StringPtr("instance"))) + Expect(listFlowLogCollectorsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListIkePoliciesOptions successfully`, func() { + // Construct an instance of the ListIkePoliciesOptions model + listIkePoliciesOptionsModel := vpcService.NewListIkePoliciesOptions() + listIkePoliciesOptionsModel.SetStart("testString") + listIkePoliciesOptionsModel.SetLimit(int64(1)) + listIkePoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listIkePoliciesOptionsModel).ToNot(BeNil()) + Expect(listIkePoliciesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listIkePoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listIkePoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListIkePolicyConnectionsOptions successfully`, func() { + // Construct an instance of the ListIkePolicyConnectionsOptions model + id := "testString" + listIkePolicyConnectionsOptionsModel := vpcService.NewListIkePolicyConnectionsOptions(id) + listIkePolicyConnectionsOptionsModel.SetID("testString") + listIkePolicyConnectionsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listIkePolicyConnectionsOptionsModel).ToNot(BeNil()) + Expect(listIkePolicyConnectionsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(listIkePolicyConnectionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListImagesOptions successfully`, func() { + // Construct an instance of the ListImagesOptions model + listImagesOptionsModel := vpcService.NewListImagesOptions() + listImagesOptionsModel.SetStart("testString") + listImagesOptionsModel.SetLimit(int64(1)) + listImagesOptionsModel.SetResourceGroupID("testString") + listImagesOptionsModel.SetName("testString") + listImagesOptionsModel.SetVisibility("private") + listImagesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listImagesOptionsModel).ToNot(BeNil()) + Expect(listImagesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listImagesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listImagesOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listImagesOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(listImagesOptionsModel.Visibility).To(Equal(core.StringPtr("private"))) + Expect(listImagesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListInstanceDisksOptions successfully`, func() { + // Construct an instance of the ListInstanceDisksOptions model + instanceID := "testString" + listInstanceDisksOptionsModel := vpcService.NewListInstanceDisksOptions(instanceID) + listInstanceDisksOptionsModel.SetInstanceID("testString") + listInstanceDisksOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstanceDisksOptionsModel).ToNot(BeNil()) + Expect(listInstanceDisksOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceDisksOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListInstanceGroupManagerActionsOptions successfully`, func() { + // Construct an instance of the ListInstanceGroupManagerActionsOptions model + instanceGroupID := "testString" + instanceGroupManagerID := "testString" + listInstanceGroupManagerActionsOptionsModel := vpcService.NewListInstanceGroupManagerActionsOptions(instanceGroupID, instanceGroupManagerID) + listInstanceGroupManagerActionsOptionsModel.SetInstanceGroupID("testString") + listInstanceGroupManagerActionsOptionsModel.SetInstanceGroupManagerID("testString") + listInstanceGroupManagerActionsOptionsModel.SetStart("testString") + listInstanceGroupManagerActionsOptionsModel.SetLimit(int64(1)) + listInstanceGroupManagerActionsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstanceGroupManagerActionsOptionsModel).ToNot(BeNil()) + Expect(listInstanceGroupManagerActionsOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceGroupManagerActionsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceGroupManagerActionsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listInstanceGroupManagerActionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListInstanceGroupManagerPoliciesOptions successfully`, func() { + // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model + instanceGroupID := "testString" + instanceGroupManagerID := "testString" + listInstanceGroupManagerPoliciesOptionsModel := vpcService.NewListInstanceGroupManagerPoliciesOptions(instanceGroupID, instanceGroupManagerID) + listInstanceGroupManagerPoliciesOptionsModel.SetInstanceGroupID("testString") + listInstanceGroupManagerPoliciesOptionsModel.SetInstanceGroupManagerID("testString") + listInstanceGroupManagerPoliciesOptionsModel.SetStart("testString") + listInstanceGroupManagerPoliciesOptionsModel.SetLimit(int64(1)) + listInstanceGroupManagerPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstanceGroupManagerPoliciesOptionsModel).ToNot(BeNil()) + Expect(listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceGroupManagerPoliciesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceGroupManagerPoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listInstanceGroupManagerPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListInstanceGroupManagersOptions successfully`, func() { + // Construct an instance of the ListInstanceGroupManagersOptions model + instanceGroupID := "testString" + listInstanceGroupManagersOptionsModel := vpcService.NewListInstanceGroupManagersOptions(instanceGroupID) + listInstanceGroupManagersOptionsModel.SetInstanceGroupID("testString") + listInstanceGroupManagersOptionsModel.SetStart("testString") + listInstanceGroupManagersOptionsModel.SetLimit(int64(1)) + listInstanceGroupManagersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstanceGroupManagersOptionsModel).ToNot(BeNil()) + Expect(listInstanceGroupManagersOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceGroupManagersOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceGroupManagersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listInstanceGroupManagersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListInstanceGroupMembershipsOptions successfully`, func() { + // Construct an instance of the ListInstanceGroupMembershipsOptions model + instanceGroupID := "testString" + listInstanceGroupMembershipsOptionsModel := vpcService.NewListInstanceGroupMembershipsOptions(instanceGroupID) + listInstanceGroupMembershipsOptionsModel.SetInstanceGroupID("testString") + listInstanceGroupMembershipsOptionsModel.SetStart("testString") + listInstanceGroupMembershipsOptionsModel.SetLimit(int64(1)) + listInstanceGroupMembershipsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstanceGroupMembershipsOptionsModel).ToNot(BeNil()) + Expect(listInstanceGroupMembershipsOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceGroupMembershipsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceGroupMembershipsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listInstanceGroupMembershipsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListInstanceGroupsOptions successfully`, func() { + // Construct an instance of the ListInstanceGroupsOptions model + listInstanceGroupsOptionsModel := vpcService.NewListInstanceGroupsOptions() + listInstanceGroupsOptionsModel.SetStart("testString") + listInstanceGroupsOptionsModel.SetLimit(int64(1)) + listInstanceGroupsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstanceGroupsOptionsModel).ToNot(BeNil()) + Expect(listInstanceGroupsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listInstanceGroupsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListInstanceNetworkInterfaceFloatingIpsOptions successfully`, func() { + // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model + instanceID := "testString" + networkInterfaceID := "testString" + listInstanceNetworkInterfaceFloatingIpsOptionsModel := vpcService.NewListInstanceNetworkInterfaceFloatingIpsOptions(instanceID, networkInterfaceID) + listInstanceNetworkInterfaceFloatingIpsOptionsModel.SetInstanceID("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.SetNetworkInterfaceID("testString") + listInstanceNetworkInterfaceFloatingIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstanceNetworkInterfaceFloatingIpsOptionsModel).ToNot(BeNil()) + Expect(listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListInstanceNetworkInterfaceIpsOptions successfully`, func() { + // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model + instanceID := "testString" + networkInterfaceID := "testString" + listInstanceNetworkInterfaceIpsOptionsModel := vpcService.NewListInstanceNetworkInterfaceIpsOptions(instanceID, networkInterfaceID) + listInstanceNetworkInterfaceIpsOptionsModel.SetInstanceID("testString") + listInstanceNetworkInterfaceIpsOptionsModel.SetNetworkInterfaceID("testString") + listInstanceNetworkInterfaceIpsOptionsModel.SetStart("testString") + listInstanceNetworkInterfaceIpsOptionsModel.SetLimit(int64(1)) + listInstanceNetworkInterfaceIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstanceNetworkInterfaceIpsOptionsModel).ToNot(BeNil()) + Expect(listInstanceNetworkInterfaceIpsOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceNetworkInterfaceIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceNetworkInterfaceIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listInstanceNetworkInterfaceIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListInstanceNetworkInterfacesOptions successfully`, func() { + // Construct an instance of the ListInstanceNetworkInterfacesOptions model + instanceID := "testString" + listInstanceNetworkInterfacesOptionsModel := vpcService.NewListInstanceNetworkInterfacesOptions(instanceID) + listInstanceNetworkInterfacesOptionsModel.SetInstanceID("testString") + listInstanceNetworkInterfacesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstanceNetworkInterfacesOptionsModel).ToNot(BeNil()) + Expect(listInstanceNetworkInterfacesOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceNetworkInterfacesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListInstanceProfilesOptions successfully`, func() { + // Construct an instance of the ListInstanceProfilesOptions model + listInstanceProfilesOptionsModel := vpcService.NewListInstanceProfilesOptions() + listInstanceProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstanceProfilesOptionsModel).ToNot(BeNil()) + Expect(listInstanceProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListInstanceTemplatesOptions successfully`, func() { + // Construct an instance of the ListInstanceTemplatesOptions model + listInstanceTemplatesOptionsModel := vpcService.NewListInstanceTemplatesOptions() + listInstanceTemplatesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstanceTemplatesOptionsModel).ToNot(BeNil()) + Expect(listInstanceTemplatesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListInstanceVolumeAttachmentsOptions successfully`, func() { + // Construct an instance of the ListInstanceVolumeAttachmentsOptions model + instanceID := "testString" + listInstanceVolumeAttachmentsOptionsModel := vpcService.NewListInstanceVolumeAttachmentsOptions(instanceID) + listInstanceVolumeAttachmentsOptionsModel.SetInstanceID("testString") + listInstanceVolumeAttachmentsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstanceVolumeAttachmentsOptionsModel).ToNot(BeNil()) + Expect(listInstanceVolumeAttachmentsOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listInstanceVolumeAttachmentsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListInstancesOptions successfully`, func() { + // Construct an instance of the ListInstancesOptions model + listInstancesOptionsModel := vpcService.NewListInstancesOptions() + listInstancesOptionsModel.SetStart("testString") + listInstancesOptionsModel.SetLimit(int64(1)) + listInstancesOptionsModel.SetResourceGroupID("testString") + listInstancesOptionsModel.SetName("testString") + listInstancesOptionsModel.SetVPCID("testString") + listInstancesOptionsModel.SetVPCCRN("testString") + listInstancesOptionsModel.SetVPCName("testString") + listInstancesOptionsModel.SetDedicatedHostID("testString") + listInstancesOptionsModel.SetDedicatedHostCRN("testString") + listInstancesOptionsModel.SetDedicatedHostName("testString") + listInstancesOptionsModel.SetPlacementGroupID("testString") + listInstancesOptionsModel.SetPlacementGroupCRN("testString") + listInstancesOptionsModel.SetPlacementGroupName("testString") + listInstancesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listInstancesOptionsModel).ToNot(BeNil()) + Expect(listInstancesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listInstancesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listInstancesOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listInstancesOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(listInstancesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(listInstancesOptionsModel.VPCCRN).To(Equal(core.StringPtr("testString"))) + Expect(listInstancesOptionsModel.VPCName).To(Equal(core.StringPtr("testString"))) + Expect(listInstancesOptionsModel.DedicatedHostID).To(Equal(core.StringPtr("testString"))) + Expect(listInstancesOptionsModel.DedicatedHostCRN).To(Equal(core.StringPtr("testString"))) + Expect(listInstancesOptionsModel.DedicatedHostName).To(Equal(core.StringPtr("testString"))) + Expect(listInstancesOptionsModel.PlacementGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listInstancesOptionsModel.PlacementGroupCRN).To(Equal(core.StringPtr("testString"))) + Expect(listInstancesOptionsModel.PlacementGroupName).To(Equal(core.StringPtr("testString"))) + Expect(listInstancesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListIpsecPoliciesOptions successfully`, func() { + // Construct an instance of the ListIpsecPoliciesOptions model + listIpsecPoliciesOptionsModel := vpcService.NewListIpsecPoliciesOptions() + listIpsecPoliciesOptionsModel.SetStart("testString") + listIpsecPoliciesOptionsModel.SetLimit(int64(1)) + listIpsecPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listIpsecPoliciesOptionsModel).ToNot(BeNil()) + Expect(listIpsecPoliciesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listIpsecPoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listIpsecPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListIpsecPolicyConnectionsOptions successfully`, func() { + // Construct an instance of the ListIpsecPolicyConnectionsOptions model + id := "testString" + listIpsecPolicyConnectionsOptionsModel := vpcService.NewListIpsecPolicyConnectionsOptions(id) + listIpsecPolicyConnectionsOptionsModel.SetID("testString") + listIpsecPolicyConnectionsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listIpsecPolicyConnectionsOptionsModel).ToNot(BeNil()) + Expect(listIpsecPolicyConnectionsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(listIpsecPolicyConnectionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListKeysOptions successfully`, func() { + // Construct an instance of the ListKeysOptions model + listKeysOptionsModel := vpcService.NewListKeysOptions() + listKeysOptionsModel.SetStart("testString") + listKeysOptionsModel.SetLimit(int64(1)) + 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(1)))) + Expect(listKeysOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListLoadBalancerListenerPoliciesOptions successfully`, func() { + // Construct an instance of the ListLoadBalancerListenerPoliciesOptions model + loadBalancerID := "testString" + listenerID := "testString" + listLoadBalancerListenerPoliciesOptionsModel := vpcService.NewListLoadBalancerListenerPoliciesOptions(loadBalancerID, listenerID) + listLoadBalancerListenerPoliciesOptionsModel.SetLoadBalancerID("testString") + listLoadBalancerListenerPoliciesOptionsModel.SetListenerID("testString") + listLoadBalancerListenerPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listLoadBalancerListenerPoliciesOptionsModel).ToNot(BeNil()) + Expect(listLoadBalancerListenerPoliciesOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(listLoadBalancerListenerPoliciesOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) + Expect(listLoadBalancerListenerPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListLoadBalancerListenerPolicyRulesOptions successfully`, func() { + // Construct an instance of the ListLoadBalancerListenerPolicyRulesOptions model + loadBalancerID := "testString" + listenerID := "testString" + policyID := "testString" + listLoadBalancerListenerPolicyRulesOptionsModel := vpcService.NewListLoadBalancerListenerPolicyRulesOptions(loadBalancerID, listenerID, policyID) + listLoadBalancerListenerPolicyRulesOptionsModel.SetLoadBalancerID("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.SetListenerID("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.SetPolicyID("testString") + listLoadBalancerListenerPolicyRulesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listLoadBalancerListenerPolicyRulesOptionsModel).ToNot(BeNil()) + Expect(listLoadBalancerListenerPolicyRulesOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(listLoadBalancerListenerPolicyRulesOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) + Expect(listLoadBalancerListenerPolicyRulesOptionsModel.PolicyID).To(Equal(core.StringPtr("testString"))) + Expect(listLoadBalancerListenerPolicyRulesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListLoadBalancerListenersOptions successfully`, func() { + // Construct an instance of the ListLoadBalancerListenersOptions model + loadBalancerID := "testString" + listLoadBalancerListenersOptionsModel := vpcService.NewListLoadBalancerListenersOptions(loadBalancerID) + listLoadBalancerListenersOptionsModel.SetLoadBalancerID("testString") + listLoadBalancerListenersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listLoadBalancerListenersOptionsModel).ToNot(BeNil()) + Expect(listLoadBalancerListenersOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(listLoadBalancerListenersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListLoadBalancerPoolMembersOptions successfully`, func() { + // Construct an instance of the ListLoadBalancerPoolMembersOptions model + loadBalancerID := "testString" + poolID := "testString" + listLoadBalancerPoolMembersOptionsModel := vpcService.NewListLoadBalancerPoolMembersOptions(loadBalancerID, poolID) + listLoadBalancerPoolMembersOptionsModel.SetLoadBalancerID("testString") + listLoadBalancerPoolMembersOptionsModel.SetPoolID("testString") + listLoadBalancerPoolMembersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listLoadBalancerPoolMembersOptionsModel).ToNot(BeNil()) + Expect(listLoadBalancerPoolMembersOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(listLoadBalancerPoolMembersOptionsModel.PoolID).To(Equal(core.StringPtr("testString"))) + Expect(listLoadBalancerPoolMembersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListLoadBalancerPoolsOptions successfully`, func() { + // Construct an instance of the ListLoadBalancerPoolsOptions model + loadBalancerID := "testString" + listLoadBalancerPoolsOptionsModel := vpcService.NewListLoadBalancerPoolsOptions(loadBalancerID) + listLoadBalancerPoolsOptionsModel.SetLoadBalancerID("testString") + listLoadBalancerPoolsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listLoadBalancerPoolsOptionsModel).ToNot(BeNil()) + Expect(listLoadBalancerPoolsOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(listLoadBalancerPoolsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListLoadBalancerProfilesOptions successfully`, func() { + // Construct an instance of the ListLoadBalancerProfilesOptions model + listLoadBalancerProfilesOptionsModel := vpcService.NewListLoadBalancerProfilesOptions() + listLoadBalancerProfilesOptionsModel.SetStart("testString") + listLoadBalancerProfilesOptionsModel.SetLimit(int64(1)) + listLoadBalancerProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listLoadBalancerProfilesOptionsModel).ToNot(BeNil()) + Expect(listLoadBalancerProfilesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listLoadBalancerProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listLoadBalancerProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListLoadBalancersOptions successfully`, func() { + // Construct an instance of the ListLoadBalancersOptions model + listLoadBalancersOptionsModel := vpcService.NewListLoadBalancersOptions() + listLoadBalancersOptionsModel.SetStart("testString") + listLoadBalancersOptionsModel.SetLimit(int64(1)) + listLoadBalancersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listLoadBalancersOptionsModel).ToNot(BeNil()) + Expect(listLoadBalancersOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listLoadBalancersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listLoadBalancersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListNetworkACLRulesOptions successfully`, func() { + // Construct an instance of the ListNetworkACLRulesOptions model + networkACLID := "testString" + listNetworkACLRulesOptionsModel := vpcService.NewListNetworkACLRulesOptions(networkACLID) + listNetworkACLRulesOptionsModel.SetNetworkACLID("testString") + listNetworkACLRulesOptionsModel.SetStart("testString") + listNetworkACLRulesOptionsModel.SetLimit(int64(1)) + listNetworkACLRulesOptionsModel.SetDirection("inbound") + listNetworkACLRulesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listNetworkACLRulesOptionsModel).ToNot(BeNil()) + Expect(listNetworkACLRulesOptionsModel.NetworkACLID).To(Equal(core.StringPtr("testString"))) + Expect(listNetworkACLRulesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listNetworkACLRulesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listNetworkACLRulesOptionsModel.Direction).To(Equal(core.StringPtr("inbound"))) + Expect(listNetworkACLRulesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListNetworkAclsOptions successfully`, func() { + // Construct an instance of the ListNetworkAclsOptions model + listNetworkAclsOptionsModel := vpcService.NewListNetworkAclsOptions() + listNetworkAclsOptionsModel.SetStart("testString") + listNetworkAclsOptionsModel.SetLimit(int64(1)) + listNetworkAclsOptionsModel.SetResourceGroupID("testString") + listNetworkAclsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listNetworkAclsOptionsModel).ToNot(BeNil()) + Expect(listNetworkAclsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listNetworkAclsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listNetworkAclsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listNetworkAclsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListOperatingSystemsOptions successfully`, func() { + // Construct an instance of the ListOperatingSystemsOptions model + listOperatingSystemsOptionsModel := vpcService.NewListOperatingSystemsOptions() + listOperatingSystemsOptionsModel.SetStart("testString") + listOperatingSystemsOptionsModel.SetLimit(int64(1)) + listOperatingSystemsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listOperatingSystemsOptionsModel).ToNot(BeNil()) + Expect(listOperatingSystemsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listOperatingSystemsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listOperatingSystemsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListPlacementGroupsOptions successfully`, func() { + // Construct an instance of the ListPlacementGroupsOptions model + listPlacementGroupsOptionsModel := vpcService.NewListPlacementGroupsOptions() + listPlacementGroupsOptionsModel.SetStart("testString") + listPlacementGroupsOptionsModel.SetLimit(int64(1)) + listPlacementGroupsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listPlacementGroupsOptionsModel).ToNot(BeNil()) + Expect(listPlacementGroupsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listPlacementGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listPlacementGroupsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListPublicGatewaysOptions successfully`, func() { + // Construct an instance of the ListPublicGatewaysOptions model + listPublicGatewaysOptionsModel := vpcService.NewListPublicGatewaysOptions() + listPublicGatewaysOptionsModel.SetStart("testString") + listPublicGatewaysOptionsModel.SetLimit(int64(1)) + listPublicGatewaysOptionsModel.SetResourceGroupID("testString") + listPublicGatewaysOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listPublicGatewaysOptionsModel).ToNot(BeNil()) + Expect(listPublicGatewaysOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listPublicGatewaysOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listPublicGatewaysOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listPublicGatewaysOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListRegionZonesOptions successfully`, func() { + // Construct an instance of the ListRegionZonesOptions model + regionName := "testString" + listRegionZonesOptionsModel := vpcService.NewListRegionZonesOptions(regionName) + listRegionZonesOptionsModel.SetRegionName("testString") + listRegionZonesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listRegionZonesOptionsModel).ToNot(BeNil()) + Expect(listRegionZonesOptionsModel.RegionName).To(Equal(core.StringPtr("testString"))) + Expect(listRegionZonesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListRegionsOptions successfully`, func() { + // Construct an instance of the ListRegionsOptions model + listRegionsOptionsModel := vpcService.NewListRegionsOptions() + listRegionsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listRegionsOptionsModel).ToNot(BeNil()) + Expect(listRegionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListSecurityGroupRulesOptions successfully`, func() { + // Construct an instance of the ListSecurityGroupRulesOptions model + securityGroupID := "testString" + listSecurityGroupRulesOptionsModel := vpcService.NewListSecurityGroupRulesOptions(securityGroupID) + listSecurityGroupRulesOptionsModel.SetSecurityGroupID("testString") + listSecurityGroupRulesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listSecurityGroupRulesOptionsModel).ToNot(BeNil()) + Expect(listSecurityGroupRulesOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listSecurityGroupRulesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListSecurityGroupTargetsOptions successfully`, func() { + // Construct an instance of the ListSecurityGroupTargetsOptions model + securityGroupID := "testString" + listSecurityGroupTargetsOptionsModel := vpcService.NewListSecurityGroupTargetsOptions(securityGroupID) + listSecurityGroupTargetsOptionsModel.SetSecurityGroupID("testString") + listSecurityGroupTargetsOptionsModel.SetStart("testString") + listSecurityGroupTargetsOptionsModel.SetLimit(int64(1)) + listSecurityGroupTargetsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listSecurityGroupTargetsOptionsModel).ToNot(BeNil()) + Expect(listSecurityGroupTargetsOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listSecurityGroupTargetsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listSecurityGroupTargetsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listSecurityGroupTargetsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListSecurityGroupsOptions successfully`, func() { + // Construct an instance of the ListSecurityGroupsOptions model + listSecurityGroupsOptionsModel := vpcService.NewListSecurityGroupsOptions() + listSecurityGroupsOptionsModel.SetStart("testString") + listSecurityGroupsOptionsModel.SetLimit(int64(1)) + listSecurityGroupsOptionsModel.SetResourceGroupID("testString") + listSecurityGroupsOptionsModel.SetVPCID("testString") + listSecurityGroupsOptionsModel.SetVPCCRN("testString") + listSecurityGroupsOptionsModel.SetVPCName("testString") + listSecurityGroupsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listSecurityGroupsOptionsModel).ToNot(BeNil()) + Expect(listSecurityGroupsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listSecurityGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listSecurityGroupsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listSecurityGroupsOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(listSecurityGroupsOptionsModel.VPCCRN).To(Equal(core.StringPtr("testString"))) + Expect(listSecurityGroupsOptionsModel.VPCName).To(Equal(core.StringPtr("testString"))) + Expect(listSecurityGroupsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListSnapshotsOptions successfully`, func() { + // Construct an instance of the ListSnapshotsOptions model + listSnapshotsOptionsModel := vpcService.NewListSnapshotsOptions() + listSnapshotsOptionsModel.SetStart("testString") + listSnapshotsOptionsModel.SetLimit(int64(1)) + listSnapshotsOptionsModel.SetTag("testString") + listSnapshotsOptionsModel.SetResourceGroupID("testString") + listSnapshotsOptionsModel.SetName("testString") + listSnapshotsOptionsModel.SetSourceVolumeID("testString") + listSnapshotsOptionsModel.SetSourceVolumeCRN("testString") + listSnapshotsOptionsModel.SetSourceImageID("testString") + listSnapshotsOptionsModel.SetSourceImageCRN("testString") + listSnapshotsOptionsModel.SetSort("name") + listSnapshotsOptionsModel.SetBackupPolicyPlanID("testString") + listSnapshotsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listSnapshotsOptionsModel).ToNot(BeNil()) + Expect(listSnapshotsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listSnapshotsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listSnapshotsOptionsModel.Tag).To(Equal(core.StringPtr("testString"))) + Expect(listSnapshotsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listSnapshotsOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(listSnapshotsOptionsModel.SourceVolumeID).To(Equal(core.StringPtr("testString"))) + Expect(listSnapshotsOptionsModel.SourceVolumeCRN).To(Equal(core.StringPtr("testString"))) + Expect(listSnapshotsOptionsModel.SourceImageID).To(Equal(core.StringPtr("testString"))) + Expect(listSnapshotsOptionsModel.SourceImageCRN).To(Equal(core.StringPtr("testString"))) + Expect(listSnapshotsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listSnapshotsOptionsModel.BackupPolicyPlanID).To(Equal(core.StringPtr("testString"))) + Expect(listSnapshotsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListSubnetReservedIpsOptions successfully`, func() { + // Construct an instance of the ListSubnetReservedIpsOptions model + subnetID := "testString" + listSubnetReservedIpsOptionsModel := vpcService.NewListSubnetReservedIpsOptions(subnetID) + listSubnetReservedIpsOptionsModel.SetSubnetID("testString") + listSubnetReservedIpsOptionsModel.SetStart("testString") + listSubnetReservedIpsOptionsModel.SetLimit(int64(1)) + listSubnetReservedIpsOptionsModel.SetSort("name") + listSubnetReservedIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listSubnetReservedIpsOptionsModel).ToNot(BeNil()) + Expect(listSubnetReservedIpsOptionsModel.SubnetID).To(Equal(core.StringPtr("testString"))) + Expect(listSubnetReservedIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listSubnetReservedIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listSubnetReservedIpsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listSubnetReservedIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListSubnetsOptions successfully`, func() { + // Construct an instance of the ListSubnetsOptions model + listSubnetsOptionsModel := vpcService.NewListSubnetsOptions() + listSubnetsOptionsModel.SetStart("testString") + listSubnetsOptionsModel.SetLimit(int64(1)) + listSubnetsOptionsModel.SetResourceGroupID("testString") + listSubnetsOptionsModel.SetRoutingTableID("testString") + listSubnetsOptionsModel.SetRoutingTableName("testString") + listSubnetsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listSubnetsOptionsModel).ToNot(BeNil()) + Expect(listSubnetsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listSubnetsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listSubnetsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listSubnetsOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) + Expect(listSubnetsOptionsModel.RoutingTableName).To(Equal(core.StringPtr("testString"))) + Expect(listSubnetsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVolumeProfilesOptions successfully`, func() { + // Construct an instance of the ListVolumeProfilesOptions model + listVolumeProfilesOptionsModel := vpcService.NewListVolumeProfilesOptions() + listVolumeProfilesOptionsModel.SetStart("testString") + listVolumeProfilesOptionsModel.SetLimit(int64(1)) + listVolumeProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVolumeProfilesOptionsModel).ToNot(BeNil()) + Expect(listVolumeProfilesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVolumeProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVolumeProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVolumesOptions successfully`, func() { + // Construct an instance of the ListVolumesOptions model + listVolumesOptionsModel := vpcService.NewListVolumesOptions() + listVolumesOptionsModel.SetStart("testString") + listVolumesOptionsModel.SetLimit(int64(1)) + listVolumesOptionsModel.SetName("testString") + listVolumesOptionsModel.SetZoneName("testString") + listVolumesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVolumesOptionsModel).ToNot(BeNil()) + Expect(listVolumesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVolumesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVolumesOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(listVolumesOptionsModel.ZoneName).To(Equal(core.StringPtr("testString"))) + Expect(listVolumesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVPCAddressPrefixesOptions successfully`, func() { + // Construct an instance of the ListVPCAddressPrefixesOptions model + vpcID := "testString" + listVPCAddressPrefixesOptionsModel := vpcService.NewListVPCAddressPrefixesOptions(vpcID) + listVPCAddressPrefixesOptionsModel.SetVPCID("testString") + listVPCAddressPrefixesOptionsModel.SetStart("testString") + listVPCAddressPrefixesOptionsModel.SetLimit(int64(1)) + listVPCAddressPrefixesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVPCAddressPrefixesOptionsModel).ToNot(BeNil()) + Expect(listVPCAddressPrefixesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(listVPCAddressPrefixesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVPCAddressPrefixesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPCAddressPrefixesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVPCRoutesOptions successfully`, func() { + // Construct an instance of the ListVPCRoutesOptions model + vpcID := "testString" + listVPCRoutesOptionsModel := vpcService.NewListVPCRoutesOptions(vpcID) + listVPCRoutesOptionsModel.SetVPCID("testString") + listVPCRoutesOptionsModel.SetZoneName("testString") + listVPCRoutesOptionsModel.SetStart("testString") + listVPCRoutesOptionsModel.SetLimit(int64(1)) + listVPCRoutesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVPCRoutesOptionsModel).ToNot(BeNil()) + Expect(listVPCRoutesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(listVPCRoutesOptionsModel.ZoneName).To(Equal(core.StringPtr("testString"))) + Expect(listVPCRoutesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVPCRoutesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPCRoutesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVPCRoutingTableRoutesOptions successfully`, func() { + // Construct an instance of the ListVPCRoutingTableRoutesOptions model + vpcID := "testString" + routingTableID := "testString" + listVPCRoutingTableRoutesOptionsModel := vpcService.NewListVPCRoutingTableRoutesOptions(vpcID, routingTableID) + listVPCRoutingTableRoutesOptionsModel.SetVPCID("testString") + listVPCRoutingTableRoutesOptionsModel.SetRoutingTableID("testString") + listVPCRoutingTableRoutesOptionsModel.SetStart("testString") + listVPCRoutingTableRoutesOptionsModel.SetLimit(int64(1)) + listVPCRoutingTableRoutesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVPCRoutingTableRoutesOptionsModel).ToNot(BeNil()) + Expect(listVPCRoutingTableRoutesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(listVPCRoutingTableRoutesOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) + Expect(listVPCRoutingTableRoutesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVPCRoutingTableRoutesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPCRoutingTableRoutesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVPCRoutingTablesOptions successfully`, func() { + // Construct an instance of the ListVPCRoutingTablesOptions model + vpcID := "testString" + listVPCRoutingTablesOptionsModel := vpcService.NewListVPCRoutingTablesOptions(vpcID) + listVPCRoutingTablesOptionsModel.SetVPCID("testString") + listVPCRoutingTablesOptionsModel.SetStart("testString") + listVPCRoutingTablesOptionsModel.SetLimit(int64(1)) + listVPCRoutingTablesOptionsModel.SetIsDefault(true) + listVPCRoutingTablesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVPCRoutingTablesOptionsModel).ToNot(BeNil()) + Expect(listVPCRoutingTablesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(listVPCRoutingTablesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVPCRoutingTablesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPCRoutingTablesOptionsModel.IsDefault).To(Equal(core.BoolPtr(true))) + Expect(listVPCRoutingTablesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVpcsOptions successfully`, func() { + // Construct an instance of the ListVpcsOptions model + listVpcsOptionsModel := vpcService.NewListVpcsOptions() + listVpcsOptionsModel.SetStart("testString") + listVpcsOptionsModel.SetLimit(int64(1)) + listVpcsOptionsModel.SetResourceGroupID("testString") + listVpcsOptionsModel.SetClassicAccess(true) + listVpcsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVpcsOptionsModel).ToNot(BeNil()) + Expect(listVpcsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVpcsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVpcsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listVpcsOptionsModel.ClassicAccess).To(Equal(core.BoolPtr(true))) + Expect(listVpcsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVPNGatewayConnectionLocalCIDRsOptions successfully`, func() { + // Construct an instance of the ListVPNGatewayConnectionLocalCIDRsOptions model + vpnGatewayID := "testString" + id := "testString" + listVPNGatewayConnectionLocalCIDRsOptionsModel := vpcService.NewListVPNGatewayConnectionLocalCIDRsOptions(vpnGatewayID, id) + listVPNGatewayConnectionLocalCIDRsOptionsModel.SetVPNGatewayID("testString") + listVPNGatewayConnectionLocalCIDRsOptionsModel.SetID("testString") + listVPNGatewayConnectionLocalCIDRsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVPNGatewayConnectionLocalCIDRsOptionsModel).ToNot(BeNil()) + Expect(listVPNGatewayConnectionLocalCIDRsOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(listVPNGatewayConnectionLocalCIDRsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(listVPNGatewayConnectionLocalCIDRsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVPNGatewayConnectionPeerCIDRsOptions successfully`, func() { + // Construct an instance of the ListVPNGatewayConnectionPeerCIDRsOptions model + vpnGatewayID := "testString" + id := "testString" + listVPNGatewayConnectionPeerCIDRsOptionsModel := vpcService.NewListVPNGatewayConnectionPeerCIDRsOptions(vpnGatewayID, id) + listVPNGatewayConnectionPeerCIDRsOptionsModel.SetVPNGatewayID("testString") + listVPNGatewayConnectionPeerCIDRsOptionsModel.SetID("testString") + listVPNGatewayConnectionPeerCIDRsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVPNGatewayConnectionPeerCIDRsOptionsModel).ToNot(BeNil()) + Expect(listVPNGatewayConnectionPeerCIDRsOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(listVPNGatewayConnectionPeerCIDRsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(listVPNGatewayConnectionPeerCIDRsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVPNGatewayConnectionsOptions successfully`, func() { + // Construct an instance of the ListVPNGatewayConnectionsOptions model + vpnGatewayID := "testString" + listVPNGatewayConnectionsOptionsModel := vpcService.NewListVPNGatewayConnectionsOptions(vpnGatewayID) + listVPNGatewayConnectionsOptionsModel.SetVPNGatewayID("testString") + listVPNGatewayConnectionsOptionsModel.SetStatus("testString") + listVPNGatewayConnectionsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVPNGatewayConnectionsOptionsModel).ToNot(BeNil()) + Expect(listVPNGatewayConnectionsOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(listVPNGatewayConnectionsOptionsModel.Status).To(Equal(core.StringPtr("testString"))) + Expect(listVPNGatewayConnectionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVPNGatewaysOptions successfully`, func() { + // Construct an instance of the ListVPNGatewaysOptions model + listVPNGatewaysOptionsModel := vpcService.NewListVPNGatewaysOptions() + listVPNGatewaysOptionsModel.SetStart("testString") + listVPNGatewaysOptionsModel.SetLimit(int64(1)) + listVPNGatewaysOptionsModel.SetResourceGroupID("testString") + listVPNGatewaysOptionsModel.SetMode("route") + listVPNGatewaysOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVPNGatewaysOptionsModel).ToNot(BeNil()) + Expect(listVPNGatewaysOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVPNGatewaysOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPNGatewaysOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listVPNGatewaysOptionsModel.Mode).To(Equal(core.StringPtr("route"))) + Expect(listVPNGatewaysOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVPNServerClientsOptions successfully`, func() { + // Construct an instance of the ListVPNServerClientsOptions model + vpnServerID := "testString" + listVPNServerClientsOptionsModel := vpcService.NewListVPNServerClientsOptions(vpnServerID) + listVPNServerClientsOptionsModel.SetVPNServerID("testString") + listVPNServerClientsOptionsModel.SetStart("testString") + listVPNServerClientsOptionsModel.SetLimit(int64(1)) + listVPNServerClientsOptionsModel.SetSort("created_at") + listVPNServerClientsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVPNServerClientsOptionsModel).ToNot(BeNil()) + Expect(listVPNServerClientsOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(listVPNServerClientsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVPNServerClientsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPNServerClientsOptionsModel.Sort).To(Equal(core.StringPtr("created_at"))) + Expect(listVPNServerClientsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVPNServerRoutesOptions successfully`, func() { + // Construct an instance of the ListVPNServerRoutesOptions model + vpnServerID := "testString" + listVPNServerRoutesOptionsModel := vpcService.NewListVPNServerRoutesOptions(vpnServerID) + listVPNServerRoutesOptionsModel.SetVPNServerID("testString") + listVPNServerRoutesOptionsModel.SetStart("testString") + listVPNServerRoutesOptionsModel.SetLimit(int64(1)) + listVPNServerRoutesOptionsModel.SetSort("name") + listVPNServerRoutesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVPNServerRoutesOptionsModel).ToNot(BeNil()) + Expect(listVPNServerRoutesOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(listVPNServerRoutesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVPNServerRoutesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPNServerRoutesOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listVPNServerRoutesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVPNServersOptions successfully`, func() { + // Construct an instance of the ListVPNServersOptions model + listVPNServersOptionsModel := vpcService.NewListVPNServersOptions() + listVPNServersOptionsModel.SetName("testString") + listVPNServersOptionsModel.SetStart("testString") + listVPNServersOptionsModel.SetLimit(int64(1)) + listVPNServersOptionsModel.SetResourceGroupID("testString") + listVPNServersOptionsModel.SetSort("name") + listVPNServersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVPNServersOptionsModel).ToNot(BeNil()) + Expect(listVPNServersOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(listVPNServersOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVPNServersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPNServersOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listVPNServersOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listVPNServersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewLoadBalancerListenerHTTPSRedirectPrototype successfully`, func() { + httpStatusCode := int64(301) + var listener vpcv1.LoadBalancerListenerIdentityIntf = nil + _, err := vpcService.NewLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode, listener) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewLoadBalancerListenerPolicyPrototype successfully`, func() { + action := "forward" + priority := int64(5) + _model, err := vpcService.NewLoadBalancerListenerPolicyPrototype(action, priority) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerListenerPolicyRulePrototype successfully`, func() { + condition := "contains" + typeVar := "body" + value := "testString" + _model, err := vpcService.NewLoadBalancerListenerPolicyRulePrototype(condition, typeVar, value) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerListenerPrototypeLoadBalancerContext successfully`, func() { + protocol := "http" + _model, err := vpcService.NewLoadBalancerListenerPrototypeLoadBalancerContext(protocol) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerLoggingDatapath successfully`, func() { + active := true + _model, err := vpcService.NewLoadBalancerLoggingDatapath(active) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerPoolHealthMonitorPatch successfully`, func() { + delay := int64(5) + maxRetries := int64(2) + timeout := int64(2) + typeVar := "http" + _model, err := vpcService.NewLoadBalancerPoolHealthMonitorPatch(delay, maxRetries, timeout, typeVar) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerPoolHealthMonitorPrototype successfully`, func() { + delay := int64(5) + maxRetries := int64(2) + timeout := int64(2) + typeVar := "http" + _model, err := vpcService.NewLoadBalancerPoolHealthMonitorPrototype(delay, maxRetries, timeout, typeVar) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerPoolIdentityByName successfully`, func() { + name := "my-load-balancer-pool" + _model, err := vpcService.NewLoadBalancerPoolIdentityByName(name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerPoolMemberPrototype successfully`, func() { + port := int64(80) + var target vpcv1.LoadBalancerPoolMemberTargetPrototypeIntf = nil + _, err := vpcService.NewLoadBalancerPoolMemberPrototype(port, target) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewLoadBalancerPoolPrototype successfully`, func() { + algorithm := "least_connections" + var healthMonitor *vpcv1.LoadBalancerPoolHealthMonitorPrototype = nil + protocol := "http" + _, err := vpcService.NewLoadBalancerPoolPrototype(algorithm, healthMonitor, protocol) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewLoadBalancerPoolSessionPersistencePrototype successfully`, func() { + typeVar := "app_cookie" + _model, err := vpcService.NewLoadBalancerPoolSessionPersistencePrototype(typeVar) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkInterfacePrototype successfully`, func() { + var subnet vpcv1.SubnetIdentityIntf = nil + _, err := vpcService.NewNetworkInterfacePrototype(subnet) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions successfully`, func() { + // Construct an instance of the RemoveBareMetalServerNetworkInterfaceFloatingIPOptions model + bareMetalServerID := "testString" + networkInterfaceID := "testString" + id := "testString" + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel := vpcService.NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID, networkInterfaceID, id) + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetBareMetalServerID("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetNetworkInterfaceID("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetID("testString") + removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) + Expect(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewRemoveEndpointGatewayIPOptions successfully`, func() { + // Construct an instance of the RemoveEndpointGatewayIPOptions model + endpointGatewayID := "testString" + id := "testString" + removeEndpointGatewayIPOptionsModel := vpcService.NewRemoveEndpointGatewayIPOptions(endpointGatewayID, id) + removeEndpointGatewayIPOptionsModel.SetEndpointGatewayID("testString") + removeEndpointGatewayIPOptionsModel.SetID("testString") + removeEndpointGatewayIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(removeEndpointGatewayIPOptionsModel).ToNot(BeNil()) + Expect(removeEndpointGatewayIPOptionsModel.EndpointGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(removeEndpointGatewayIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(removeEndpointGatewayIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewRemoveInstanceNetworkInterfaceFloatingIPOptions successfully`, func() { + // Construct an instance of the RemoveInstanceNetworkInterfaceFloatingIPOptions model + instanceID := "testString" + networkInterfaceID := "testString" + id := "testString" + removeInstanceNetworkInterfaceFloatingIPOptionsModel := vpcService.NewRemoveInstanceNetworkInterfaceFloatingIPOptions(instanceID, networkInterfaceID, id) + removeInstanceNetworkInterfaceFloatingIPOptionsModel.SetInstanceID("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.SetNetworkInterfaceID("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.SetID("testString") + removeInstanceNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(removeInstanceNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) + Expect(removeInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(removeInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(removeInstanceNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(removeInstanceNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewRemoveVPNGatewayConnectionLocalCIDROptions successfully`, func() { + // Construct an instance of the RemoveVPNGatewayConnectionLocalCIDROptions model + vpnGatewayID := "testString" + id := "testString" + cidrPrefix := "testString" + prefixLength := "testString" + removeVPNGatewayConnectionLocalCIDROptionsModel := vpcService.NewRemoveVPNGatewayConnectionLocalCIDROptions(vpnGatewayID, id, cidrPrefix, prefixLength) + removeVPNGatewayConnectionLocalCIDROptionsModel.SetVPNGatewayID("testString") + removeVPNGatewayConnectionLocalCIDROptionsModel.SetID("testString") + removeVPNGatewayConnectionLocalCIDROptionsModel.SetCIDRPrefix("testString") + removeVPNGatewayConnectionLocalCIDROptionsModel.SetPrefixLength("testString") + removeVPNGatewayConnectionLocalCIDROptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(removeVPNGatewayConnectionLocalCIDROptionsModel).ToNot(BeNil()) + Expect(removeVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(removeVPNGatewayConnectionLocalCIDROptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(removeVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix).To(Equal(core.StringPtr("testString"))) + Expect(removeVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength).To(Equal(core.StringPtr("testString"))) + Expect(removeVPNGatewayConnectionLocalCIDROptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewRemoveVPNGatewayConnectionPeerCIDROptions successfully`, func() { + // Construct an instance of the RemoveVPNGatewayConnectionPeerCIDROptions model + vpnGatewayID := "testString" + id := "testString" + cidrPrefix := "testString" + prefixLength := "testString" + removeVPNGatewayConnectionPeerCIDROptionsModel := vpcService.NewRemoveVPNGatewayConnectionPeerCIDROptions(vpnGatewayID, id, cidrPrefix, prefixLength) + removeVPNGatewayConnectionPeerCIDROptionsModel.SetVPNGatewayID("testString") + removeVPNGatewayConnectionPeerCIDROptionsModel.SetID("testString") + removeVPNGatewayConnectionPeerCIDROptionsModel.SetCIDRPrefix("testString") + removeVPNGatewayConnectionPeerCIDROptionsModel.SetPrefixLength("testString") + removeVPNGatewayConnectionPeerCIDROptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(removeVPNGatewayConnectionPeerCIDROptionsModel).ToNot(BeNil()) + Expect(removeVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(removeVPNGatewayConnectionPeerCIDROptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(removeVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix).To(Equal(core.StringPtr("testString"))) + Expect(removeVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength).To(Equal(core.StringPtr("testString"))) + Expect(removeVPNGatewayConnectionPeerCIDROptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewReplaceLoadBalancerPoolMembersOptions successfully`, func() { + // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model + loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + Expect(loadBalancerPoolMemberTargetPrototypeModel).ToNot(BeNil()) + loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") + Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a"))) + + // Construct an instance of the LoadBalancerPoolMemberPrototype model + loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) + Expect(loadBalancerPoolMemberPrototypeModel).ToNot(BeNil()) + loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) + loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel + loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) + Expect(loadBalancerPoolMemberPrototypeModel.Port).To(Equal(core.Int64Ptr(int64(80)))) + Expect(loadBalancerPoolMemberPrototypeModel.Target).To(Equal(loadBalancerPoolMemberTargetPrototypeModel)) + Expect(loadBalancerPoolMemberPrototypeModel.Weight).To(Equal(core.Int64Ptr(int64(50)))) + + // Construct an instance of the ReplaceLoadBalancerPoolMembersOptions model + loadBalancerID := "testString" + poolID := "testString" + replaceLoadBalancerPoolMembersOptionsMembers := []vpcv1.LoadBalancerPoolMemberPrototype{} + replaceLoadBalancerPoolMembersOptionsModel := vpcService.NewReplaceLoadBalancerPoolMembersOptions(loadBalancerID, poolID, replaceLoadBalancerPoolMembersOptionsMembers) + replaceLoadBalancerPoolMembersOptionsModel.SetLoadBalancerID("testString") + replaceLoadBalancerPoolMembersOptionsModel.SetPoolID("testString") + replaceLoadBalancerPoolMembersOptionsModel.SetMembers([]vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel}) + replaceLoadBalancerPoolMembersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(replaceLoadBalancerPoolMembersOptionsModel).ToNot(BeNil()) + Expect(replaceLoadBalancerPoolMembersOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(replaceLoadBalancerPoolMembersOptionsModel.PoolID).To(Equal(core.StringPtr("testString"))) + Expect(replaceLoadBalancerPoolMembersOptionsModel.Members).To(Equal([]vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel})) + Expect(replaceLoadBalancerPoolMembersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewReplaceSubnetNetworkACLOptions successfully`, func() { + // Construct an instance of the NetworkACLIdentityByID model + networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) + Expect(networkACLIdentityModel).ToNot(BeNil()) + networkACLIdentityModel.ID = core.StringPtr("8ec3e730-f2b0-4855-a1a5-88be30024658") + Expect(networkACLIdentityModel.ID).To(Equal(core.StringPtr("8ec3e730-f2b0-4855-a1a5-88be30024658"))) + + // Construct an instance of the ReplaceSubnetNetworkACLOptions model + id := "testString" + var networkACLIdentity vpcv1.NetworkACLIdentityIntf = nil + replaceSubnetNetworkACLOptionsModel := vpcService.NewReplaceSubnetNetworkACLOptions(id, networkACLIdentity) + replaceSubnetNetworkACLOptionsModel.SetID("testString") + replaceSubnetNetworkACLOptionsModel.SetNetworkACLIdentity(networkACLIdentityModel) + replaceSubnetNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(replaceSubnetNetworkACLOptionsModel).ToNot(BeNil()) + Expect(replaceSubnetNetworkACLOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(replaceSubnetNetworkACLOptionsModel.NetworkACLIdentity).To(Equal(networkACLIdentityModel)) + Expect(replaceSubnetNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewReplaceSubnetRoutingTableOptions successfully`, func() { + // Construct an instance of the RoutingTableIdentityByID model + routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) + Expect(routingTableIdentityModel).ToNot(BeNil()) + routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") + Expect(routingTableIdentityModel.ID).To(Equal(core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840"))) + + // Construct an instance of the ReplaceSubnetRoutingTableOptions model + id := "testString" + var routingTableIdentity vpcv1.RoutingTableIdentityIntf = nil + replaceSubnetRoutingTableOptionsModel := vpcService.NewReplaceSubnetRoutingTableOptions(id, routingTableIdentity) + replaceSubnetRoutingTableOptionsModel.SetID("testString") + replaceSubnetRoutingTableOptionsModel.SetRoutingTableIdentity(routingTableIdentityModel) + replaceSubnetRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(replaceSubnetRoutingTableOptionsModel).ToNot(BeNil()) + Expect(replaceSubnetRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(replaceSubnetRoutingTableOptionsModel.RoutingTableIdentity).To(Equal(routingTableIdentityModel)) + Expect(replaceSubnetRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewRestartBareMetalServerOptions successfully`, func() { + // Construct an instance of the RestartBareMetalServerOptions model + id := "testString" + restartBareMetalServerOptionsModel := vpcService.NewRestartBareMetalServerOptions(id) + restartBareMetalServerOptionsModel.SetID("testString") + restartBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(restartBareMetalServerOptionsModel).ToNot(BeNil()) + Expect(restartBareMetalServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(restartBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewRoutePrototype successfully`, func() { + destination := "192.168.3.0/24" + var zone vpcv1.ZoneIdentityIntf = nil + _, err := vpcService.NewRoutePrototype(destination, zone) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewSetSubnetPublicGatewayOptions successfully`, func() { + // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model + publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) + Expect(publicGatewayIdentityModel).ToNot(BeNil()) + publicGatewayIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") + Expect(publicGatewayIdentityModel.ID).To(Equal(core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf"))) + + // Construct an instance of the SetSubnetPublicGatewayOptions model + id := "testString" + var publicGatewayIdentity vpcv1.PublicGatewayIdentityIntf = nil + setSubnetPublicGatewayOptionsModel := vpcService.NewSetSubnetPublicGatewayOptions(id, publicGatewayIdentity) + setSubnetPublicGatewayOptionsModel.SetID("testString") + setSubnetPublicGatewayOptionsModel.SetPublicGatewayIdentity(publicGatewayIdentityModel) + setSubnetPublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(setSubnetPublicGatewayOptionsModel).ToNot(BeNil()) + Expect(setSubnetPublicGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(setSubnetPublicGatewayOptionsModel.PublicGatewayIdentity).To(Equal(publicGatewayIdentityModel)) + Expect(setSubnetPublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewStartBareMetalServerOptions successfully`, func() { + // Construct an instance of the StartBareMetalServerOptions model + id := "testString" + startBareMetalServerOptionsModel := vpcService.NewStartBareMetalServerOptions(id) + startBareMetalServerOptionsModel.SetID("testString") + startBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(startBareMetalServerOptionsModel).ToNot(BeNil()) + Expect(startBareMetalServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(startBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewStopBareMetalServerOptions successfully`, func() { + // Construct an instance of the StopBareMetalServerOptions model + id := "testString" + stopBareMetalServerOptionsType := "hard" + stopBareMetalServerOptionsModel := vpcService.NewStopBareMetalServerOptions(id, stopBareMetalServerOptionsType) + stopBareMetalServerOptionsModel.SetID("testString") + stopBareMetalServerOptionsModel.SetType("hard") + stopBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(stopBareMetalServerOptionsModel).ToNot(BeNil()) + Expect(stopBareMetalServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(stopBareMetalServerOptionsModel.Type).To(Equal(core.StringPtr("hard"))) + Expect(stopBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUnsetSubnetPublicGatewayOptions successfully`, func() { + // Construct an instance of the UnsetSubnetPublicGatewayOptions model + id := "testString" + unsetSubnetPublicGatewayOptionsModel := vpcService.NewUnsetSubnetPublicGatewayOptions(id) + unsetSubnetPublicGatewayOptionsModel.SetID("testString") + unsetSubnetPublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(unsetSubnetPublicGatewayOptionsModel).ToNot(BeNil()) + Expect(unsetSubnetPublicGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(unsetSubnetPublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateBackupPolicyOptions successfully`, func() { + // Construct an instance of the UpdateBackupPolicyOptions model + id := "testString" + backupPolicyPatch := make(map[string]interface{}) + updateBackupPolicyOptionsModel := vpcService.NewUpdateBackupPolicyOptions(id, backupPolicyPatch) + updateBackupPolicyOptionsModel.SetID("testString") + updateBackupPolicyOptionsModel.SetBackupPolicyPatch(make(map[string]interface{})) + updateBackupPolicyOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateBackupPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateBackupPolicyOptionsModel).ToNot(BeNil()) + Expect(updateBackupPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateBackupPolicyOptionsModel.BackupPolicyPatch).To(Equal(make(map[string]interface{}))) + Expect(updateBackupPolicyOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(updateBackupPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateBackupPolicyPlanOptions successfully`, func() { + // Construct an instance of the UpdateBackupPolicyPlanOptions model + backupPolicyID := "testString" + id := "testString" + backupPolicyPlanPatch := make(map[string]interface{}) + updateBackupPolicyPlanOptionsModel := vpcService.NewUpdateBackupPolicyPlanOptions(backupPolicyID, id, backupPolicyPlanPatch) + updateBackupPolicyPlanOptionsModel.SetBackupPolicyID("testString") + updateBackupPolicyPlanOptionsModel.SetID("testString") + updateBackupPolicyPlanOptionsModel.SetBackupPolicyPlanPatch(make(map[string]interface{})) + updateBackupPolicyPlanOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateBackupPolicyPlanOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateBackupPolicyPlanOptionsModel).ToNot(BeNil()) + Expect(updateBackupPolicyPlanOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) + Expect(updateBackupPolicyPlanOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch).To(Equal(make(map[string]interface{}))) + Expect(updateBackupPolicyPlanOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(updateBackupPolicyPlanOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateBareMetalServerDiskOptions successfully`, func() { + // Construct an instance of the UpdateBareMetalServerDiskOptions model + bareMetalServerID := "testString" + id := "testString" + bareMetalServerDiskPatch := make(map[string]interface{}) + updateBareMetalServerDiskOptionsModel := vpcService.NewUpdateBareMetalServerDiskOptions(bareMetalServerID, id, bareMetalServerDiskPatch) + updateBareMetalServerDiskOptionsModel.SetBareMetalServerID("testString") + updateBareMetalServerDiskOptionsModel.SetID("testString") + updateBareMetalServerDiskOptionsModel.SetBareMetalServerDiskPatch(make(map[string]interface{})) + updateBareMetalServerDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateBareMetalServerDiskOptionsModel).ToNot(BeNil()) + Expect(updateBareMetalServerDiskOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(updateBareMetalServerDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch).To(Equal(make(map[string]interface{}))) + Expect(updateBareMetalServerDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateBareMetalServerNetworkInterfaceOptions successfully`, func() { + // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model + bareMetalServerID := "testString" + id := "testString" + bareMetalServerNetworkInterfacePatch := make(map[string]interface{}) + updateBareMetalServerNetworkInterfaceOptionsModel := vpcService.NewUpdateBareMetalServerNetworkInterfaceOptions(bareMetalServerID, id, bareMetalServerNetworkInterfacePatch) + updateBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerID("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.SetID("testString") + updateBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerNetworkInterfacePatch(make(map[string]interface{})) + updateBareMetalServerNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateBareMetalServerNetworkInterfaceOptionsModel).ToNot(BeNil()) + Expect(updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(updateBareMetalServerNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch).To(Equal(make(map[string]interface{}))) + Expect(updateBareMetalServerNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateBareMetalServerOptions successfully`, func() { + // Construct an instance of the UpdateBareMetalServerOptions model + id := "testString" + bareMetalServerPatch := make(map[string]interface{}) + updateBareMetalServerOptionsModel := vpcService.NewUpdateBareMetalServerOptions(id, bareMetalServerPatch) + updateBareMetalServerOptionsModel.SetID("testString") + updateBareMetalServerOptionsModel.SetBareMetalServerPatch(make(map[string]interface{})) + updateBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateBareMetalServerOptionsModel).ToNot(BeNil()) + Expect(updateBareMetalServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateBareMetalServerOptionsModel.BareMetalServerPatch).To(Equal(make(map[string]interface{}))) + Expect(updateBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateDedicatedHostDiskOptions successfully`, func() { + // Construct an instance of the UpdateDedicatedHostDiskOptions model + dedicatedHostID := "testString" + id := "testString" + dedicatedHostDiskPatch := make(map[string]interface{}) + updateDedicatedHostDiskOptionsModel := vpcService.NewUpdateDedicatedHostDiskOptions(dedicatedHostID, id, dedicatedHostDiskPatch) + updateDedicatedHostDiskOptionsModel.SetDedicatedHostID("testString") + updateDedicatedHostDiskOptionsModel.SetID("testString") + updateDedicatedHostDiskOptionsModel.SetDedicatedHostDiskPatch(make(map[string]interface{})) + updateDedicatedHostDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateDedicatedHostDiskOptionsModel).ToNot(BeNil()) + Expect(updateDedicatedHostDiskOptionsModel.DedicatedHostID).To(Equal(core.StringPtr("testString"))) + Expect(updateDedicatedHostDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch).To(Equal(make(map[string]interface{}))) + Expect(updateDedicatedHostDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateDedicatedHostGroupOptions successfully`, func() { + // Construct an instance of the UpdateDedicatedHostGroupOptions model + id := "testString" + dedicatedHostGroupPatch := make(map[string]interface{}) + updateDedicatedHostGroupOptionsModel := vpcService.NewUpdateDedicatedHostGroupOptions(id, dedicatedHostGroupPatch) + updateDedicatedHostGroupOptionsModel.SetID("testString") + updateDedicatedHostGroupOptionsModel.SetDedicatedHostGroupPatch(make(map[string]interface{})) + updateDedicatedHostGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateDedicatedHostGroupOptionsModel).ToNot(BeNil()) + Expect(updateDedicatedHostGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch).To(Equal(make(map[string]interface{}))) + Expect(updateDedicatedHostGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateDedicatedHostOptions successfully`, func() { + // Construct an instance of the UpdateDedicatedHostOptions model + id := "testString" + dedicatedHostPatch := make(map[string]interface{}) + updateDedicatedHostOptionsModel := vpcService.NewUpdateDedicatedHostOptions(id, dedicatedHostPatch) + updateDedicatedHostOptionsModel.SetID("testString") + updateDedicatedHostOptionsModel.SetDedicatedHostPatch(make(map[string]interface{})) + updateDedicatedHostOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateDedicatedHostOptionsModel).ToNot(BeNil()) + Expect(updateDedicatedHostOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateDedicatedHostOptionsModel.DedicatedHostPatch).To(Equal(make(map[string]interface{}))) + Expect(updateDedicatedHostOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateEndpointGatewayOptions successfully`, func() { + // Construct an instance of the UpdateEndpointGatewayOptions model + id := "testString" + endpointGatewayPatch := make(map[string]interface{}) + updateEndpointGatewayOptionsModel := vpcService.NewUpdateEndpointGatewayOptions(id, endpointGatewayPatch) + updateEndpointGatewayOptionsModel.SetID("testString") + updateEndpointGatewayOptionsModel.SetEndpointGatewayPatch(make(map[string]interface{})) + updateEndpointGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateEndpointGatewayOptionsModel).ToNot(BeNil()) + Expect(updateEndpointGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateEndpointGatewayOptionsModel.EndpointGatewayPatch).To(Equal(make(map[string]interface{}))) + Expect(updateEndpointGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateFloatingIPOptions successfully`, func() { + // Construct an instance of the UpdateFloatingIPOptions model + id := "testString" + floatingIPPatch := make(map[string]interface{}) + updateFloatingIPOptionsModel := vpcService.NewUpdateFloatingIPOptions(id, floatingIPPatch) + updateFloatingIPOptionsModel.SetID("testString") + updateFloatingIPOptionsModel.SetFloatingIPPatch(make(map[string]interface{})) + updateFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateFloatingIPOptionsModel).ToNot(BeNil()) + Expect(updateFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateFloatingIPOptionsModel.FloatingIPPatch).To(Equal(make(map[string]interface{}))) + Expect(updateFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateFlowLogCollectorOptions successfully`, func() { + // Construct an instance of the UpdateFlowLogCollectorOptions model + id := "testString" + flowLogCollectorPatch := make(map[string]interface{}) + updateFlowLogCollectorOptionsModel := vpcService.NewUpdateFlowLogCollectorOptions(id, flowLogCollectorPatch) + updateFlowLogCollectorOptionsModel.SetID("testString") + updateFlowLogCollectorOptionsModel.SetFlowLogCollectorPatch(make(map[string]interface{})) + updateFlowLogCollectorOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateFlowLogCollectorOptionsModel).ToNot(BeNil()) + Expect(updateFlowLogCollectorOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateFlowLogCollectorOptionsModel.FlowLogCollectorPatch).To(Equal(make(map[string]interface{}))) + Expect(updateFlowLogCollectorOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateIkePolicyOptions successfully`, func() { + // Construct an instance of the UpdateIkePolicyOptions model + id := "testString" + ikePolicyPatch := make(map[string]interface{}) + updateIkePolicyOptionsModel := vpcService.NewUpdateIkePolicyOptions(id, ikePolicyPatch) + updateIkePolicyOptionsModel.SetID("testString") + updateIkePolicyOptionsModel.SetIkePolicyPatch(make(map[string]interface{})) + updateIkePolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateIkePolicyOptionsModel).ToNot(BeNil()) + Expect(updateIkePolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateIkePolicyOptionsModel.IkePolicyPatch).To(Equal(make(map[string]interface{}))) + Expect(updateIkePolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateImageOptions successfully`, func() { + // Construct an instance of the UpdateImageOptions model + id := "testString" + imagePatch := make(map[string]interface{}) + updateImageOptionsModel := vpcService.NewUpdateImageOptions(id, imagePatch) + updateImageOptionsModel.SetID("testString") + updateImageOptionsModel.SetImagePatch(make(map[string]interface{})) + updateImageOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateImageOptionsModel).ToNot(BeNil()) + Expect(updateImageOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateImageOptionsModel.ImagePatch).To(Equal(make(map[string]interface{}))) + Expect(updateImageOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateInstanceDiskOptions successfully`, func() { + // Construct an instance of the UpdateInstanceDiskOptions model + instanceID := "testString" + id := "testString" + instanceDiskPatch := make(map[string]interface{}) + updateInstanceDiskOptionsModel := vpcService.NewUpdateInstanceDiskOptions(instanceID, id, instanceDiskPatch) + updateInstanceDiskOptionsModel.SetInstanceID("testString") + updateInstanceDiskOptionsModel.SetID("testString") + updateInstanceDiskOptionsModel.SetInstanceDiskPatch(make(map[string]interface{})) + updateInstanceDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateInstanceDiskOptionsModel).ToNot(BeNil()) + Expect(updateInstanceDiskOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceDiskOptionsModel.InstanceDiskPatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateInstanceGroupManagerActionOptions successfully`, func() { + // Construct an instance of the UpdateInstanceGroupManagerActionOptions model + instanceGroupID := "testString" + instanceGroupManagerID := "testString" + id := "testString" + instanceGroupManagerActionPatch := make(map[string]interface{}) + updateInstanceGroupManagerActionOptionsModel := vpcService.NewUpdateInstanceGroupManagerActionOptions(instanceGroupID, instanceGroupManagerID, id, instanceGroupManagerActionPatch) + updateInstanceGroupManagerActionOptionsModel.SetInstanceGroupID("testString") + updateInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerID("testString") + updateInstanceGroupManagerActionOptionsModel.SetID("testString") + updateInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerActionPatch(make(map[string]interface{})) + updateInstanceGroupManagerActionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateInstanceGroupManagerActionOptionsModel).ToNot(BeNil()) + Expect(updateInstanceGroupManagerActionOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceGroupManagerActionOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceGroupManagerActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateInstanceGroupManagerOptions successfully`, func() { + // Construct an instance of the UpdateInstanceGroupManagerOptions model + instanceGroupID := "testString" + id := "testString" + instanceGroupManagerPatch := make(map[string]interface{}) + updateInstanceGroupManagerOptionsModel := vpcService.NewUpdateInstanceGroupManagerOptions(instanceGroupID, id, instanceGroupManagerPatch) + updateInstanceGroupManagerOptionsModel.SetInstanceGroupID("testString") + updateInstanceGroupManagerOptionsModel.SetID("testString") + updateInstanceGroupManagerOptionsModel.SetInstanceGroupManagerPatch(make(map[string]interface{})) + updateInstanceGroupManagerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateInstanceGroupManagerOptionsModel).ToNot(BeNil()) + Expect(updateInstanceGroupManagerOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceGroupManagerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceGroupManagerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateInstanceGroupManagerPolicyOptions successfully`, func() { + // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model + instanceGroupID := "testString" + instanceGroupManagerID := "testString" + id := "testString" + instanceGroupManagerPolicyPatch := make(map[string]interface{}) + updateInstanceGroupManagerPolicyOptionsModel := vpcService.NewUpdateInstanceGroupManagerPolicyOptions(instanceGroupID, instanceGroupManagerID, id, instanceGroupManagerPolicyPatch) + updateInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupID("testString") + updateInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerID("testString") + updateInstanceGroupManagerPolicyOptionsModel.SetID("testString") + updateInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerPolicyPatch(make(map[string]interface{})) + updateInstanceGroupManagerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateInstanceGroupManagerPolicyOptionsModel).ToNot(BeNil()) + Expect(updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceGroupManagerPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceGroupManagerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateInstanceGroupMembershipOptions successfully`, func() { + // Construct an instance of the UpdateInstanceGroupMembershipOptions model + instanceGroupID := "testString" + id := "testString" + instanceGroupMembershipPatch := make(map[string]interface{}) + updateInstanceGroupMembershipOptionsModel := vpcService.NewUpdateInstanceGroupMembershipOptions(instanceGroupID, id, instanceGroupMembershipPatch) + updateInstanceGroupMembershipOptionsModel.SetInstanceGroupID("testString") + updateInstanceGroupMembershipOptionsModel.SetID("testString") + updateInstanceGroupMembershipOptionsModel.SetInstanceGroupMembershipPatch(make(map[string]interface{})) + updateInstanceGroupMembershipOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateInstanceGroupMembershipOptionsModel).ToNot(BeNil()) + Expect(updateInstanceGroupMembershipOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceGroupMembershipOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceGroupMembershipOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateInstanceGroupOptions successfully`, func() { + // Construct an instance of the UpdateInstanceGroupOptions model + id := "testString" + instanceGroupPatch := make(map[string]interface{}) + updateInstanceGroupOptionsModel := vpcService.NewUpdateInstanceGroupOptions(id, instanceGroupPatch) + updateInstanceGroupOptionsModel.SetID("testString") + updateInstanceGroupOptionsModel.SetInstanceGroupPatch(make(map[string]interface{})) + updateInstanceGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateInstanceGroupOptionsModel).ToNot(BeNil()) + Expect(updateInstanceGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceGroupOptionsModel.InstanceGroupPatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateInstanceNetworkInterfaceOptions successfully`, func() { + // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model + instanceID := "testString" + id := "testString" + networkInterfacePatch := make(map[string]interface{}) + updateInstanceNetworkInterfaceOptionsModel := vpcService.NewUpdateInstanceNetworkInterfaceOptions(instanceID, id, networkInterfacePatch) + updateInstanceNetworkInterfaceOptionsModel.SetInstanceID("testString") + updateInstanceNetworkInterfaceOptionsModel.SetID("testString") + updateInstanceNetworkInterfaceOptionsModel.SetNetworkInterfacePatch(make(map[string]interface{})) + updateInstanceNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateInstanceNetworkInterfaceOptionsModel).ToNot(BeNil()) + Expect(updateInstanceNetworkInterfaceOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateInstanceOptions successfully`, func() { + // Construct an instance of the UpdateInstanceOptions model + id := "testString" + instancePatch := make(map[string]interface{}) + updateInstanceOptionsModel := vpcService.NewUpdateInstanceOptions(id, instancePatch) + updateInstanceOptionsModel.SetID("testString") + updateInstanceOptionsModel.SetInstancePatch(make(map[string]interface{})) + updateInstanceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateInstanceOptionsModel).ToNot(BeNil()) + Expect(updateInstanceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceOptionsModel.InstancePatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateInstanceTemplateOptions successfully`, func() { + // Construct an instance of the UpdateInstanceTemplateOptions model + id := "testString" + instanceTemplatePatch := make(map[string]interface{}) + updateInstanceTemplateOptionsModel := vpcService.NewUpdateInstanceTemplateOptions(id, instanceTemplatePatch) + updateInstanceTemplateOptionsModel.SetID("testString") + updateInstanceTemplateOptionsModel.SetInstanceTemplatePatch(make(map[string]interface{})) + updateInstanceTemplateOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateInstanceTemplateOptionsModel).ToNot(BeNil()) + Expect(updateInstanceTemplateOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceTemplateOptionsModel.InstanceTemplatePatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceTemplateOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateInstanceVolumeAttachmentOptions successfully`, func() { + // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model + instanceID := "testString" + id := "testString" + volumeAttachmentPatch := make(map[string]interface{}) + updateInstanceVolumeAttachmentOptionsModel := vpcService.NewUpdateInstanceVolumeAttachmentOptions(instanceID, id, volumeAttachmentPatch) + updateInstanceVolumeAttachmentOptionsModel.SetInstanceID("testString") + updateInstanceVolumeAttachmentOptionsModel.SetID("testString") + updateInstanceVolumeAttachmentOptionsModel.SetVolumeAttachmentPatch(make(map[string]interface{})) + updateInstanceVolumeAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateInstanceVolumeAttachmentOptionsModel).ToNot(BeNil()) + Expect(updateInstanceVolumeAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceVolumeAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceVolumeAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateIpsecPolicyOptions successfully`, func() { + // Construct an instance of the UpdateIpsecPolicyOptions model + id := "testString" + iPsecPolicyPatch := make(map[string]interface{}) + updateIpsecPolicyOptionsModel := vpcService.NewUpdateIpsecPolicyOptions(id, iPsecPolicyPatch) + updateIpsecPolicyOptionsModel.SetID("testString") + updateIpsecPolicyOptionsModel.SetIPsecPolicyPatch(make(map[string]interface{})) + updateIpsecPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateIpsecPolicyOptionsModel).ToNot(BeNil()) + Expect(updateIpsecPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateIpsecPolicyOptionsModel.IPsecPolicyPatch).To(Equal(make(map[string]interface{}))) + Expect(updateIpsecPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateKeyOptions successfully`, func() { + // Construct an instance of the UpdateKeyOptions model + id := "testString" + keyPatch := make(map[string]interface{}) + updateKeyOptionsModel := vpcService.NewUpdateKeyOptions(id, keyPatch) + updateKeyOptionsModel.SetID("testString") + updateKeyOptionsModel.SetKeyPatch(make(map[string]interface{})) + updateKeyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateKeyOptionsModel).ToNot(BeNil()) + Expect(updateKeyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateKeyOptionsModel.KeyPatch).To(Equal(make(map[string]interface{}))) + Expect(updateKeyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateLoadBalancerListenerOptions successfully`, func() { + // Construct an instance of the UpdateLoadBalancerListenerOptions model + loadBalancerID := "testString" + id := "testString" + loadBalancerListenerPatch := make(map[string]interface{}) + updateLoadBalancerListenerOptionsModel := vpcService.NewUpdateLoadBalancerListenerOptions(loadBalancerID, id, loadBalancerListenerPatch) + updateLoadBalancerListenerOptionsModel.SetLoadBalancerID("testString") + updateLoadBalancerListenerOptionsModel.SetID("testString") + updateLoadBalancerListenerOptionsModel.SetLoadBalancerListenerPatch(make(map[string]interface{})) + updateLoadBalancerListenerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateLoadBalancerListenerOptionsModel).ToNot(BeNil()) + Expect(updateLoadBalancerListenerOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerListenerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerListenerOptionsModel.LoadBalancerListenerPatch).To(Equal(make(map[string]interface{}))) + Expect(updateLoadBalancerListenerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateLoadBalancerListenerPolicyOptions successfully`, func() { + // Construct an instance of the UpdateLoadBalancerListenerPolicyOptions model + loadBalancerID := "testString" + listenerID := "testString" + id := "testString" + loadBalancerListenerPolicyPatch := make(map[string]interface{}) + updateLoadBalancerListenerPolicyOptionsModel := vpcService.NewUpdateLoadBalancerListenerPolicyOptions(loadBalancerID, listenerID, id, loadBalancerListenerPolicyPatch) + updateLoadBalancerListenerPolicyOptionsModel.SetLoadBalancerID("testString") + updateLoadBalancerListenerPolicyOptionsModel.SetListenerID("testString") + updateLoadBalancerListenerPolicyOptionsModel.SetID("testString") + updateLoadBalancerListenerPolicyOptionsModel.SetLoadBalancerListenerPolicyPatch(make(map[string]interface{})) + updateLoadBalancerListenerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateLoadBalancerListenerPolicyOptionsModel).ToNot(BeNil()) + Expect(updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerListenerPolicyOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerListenerPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerListenerPolicyPatch).To(Equal(make(map[string]interface{}))) + Expect(updateLoadBalancerListenerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateLoadBalancerListenerPolicyRuleOptions successfully`, func() { + // Construct an instance of the UpdateLoadBalancerListenerPolicyRuleOptions model + loadBalancerID := "testString" + listenerID := "testString" + policyID := "testString" + id := "testString" + loadBalancerListenerPolicyRulePatch := make(map[string]interface{}) + updateLoadBalancerListenerPolicyRuleOptionsModel := vpcService.NewUpdateLoadBalancerListenerPolicyRuleOptions(loadBalancerID, listenerID, policyID, id, loadBalancerListenerPolicyRulePatch) + updateLoadBalancerListenerPolicyRuleOptionsModel.SetLoadBalancerID("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.SetListenerID("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.SetPolicyID("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.SetID("testString") + updateLoadBalancerListenerPolicyRuleOptionsModel.SetLoadBalancerListenerPolicyRulePatch(make(map[string]interface{})) + updateLoadBalancerListenerPolicyRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateLoadBalancerListenerPolicyRuleOptionsModel).ToNot(BeNil()) + Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.PolicyID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerListenerPolicyRulePatch).To(Equal(make(map[string]interface{}))) + Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateLoadBalancerOptions successfully`, func() { + // Construct an instance of the UpdateLoadBalancerOptions model + id := "testString" + loadBalancerPatch := make(map[string]interface{}) + updateLoadBalancerOptionsModel := vpcService.NewUpdateLoadBalancerOptions(id, loadBalancerPatch) + updateLoadBalancerOptionsModel.SetID("testString") + updateLoadBalancerOptionsModel.SetLoadBalancerPatch(make(map[string]interface{})) + updateLoadBalancerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateLoadBalancerOptionsModel).ToNot(BeNil()) + Expect(updateLoadBalancerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerOptionsModel.LoadBalancerPatch).To(Equal(make(map[string]interface{}))) + Expect(updateLoadBalancerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateLoadBalancerPoolMemberOptions successfully`, func() { + // Construct an instance of the UpdateLoadBalancerPoolMemberOptions model + loadBalancerID := "testString" + poolID := "testString" + id := "testString" + loadBalancerPoolMemberPatch := make(map[string]interface{}) + updateLoadBalancerPoolMemberOptionsModel := vpcService.NewUpdateLoadBalancerPoolMemberOptions(loadBalancerID, poolID, id, loadBalancerPoolMemberPatch) + updateLoadBalancerPoolMemberOptionsModel.SetLoadBalancerID("testString") + updateLoadBalancerPoolMemberOptionsModel.SetPoolID("testString") + updateLoadBalancerPoolMemberOptionsModel.SetID("testString") + updateLoadBalancerPoolMemberOptionsModel.SetLoadBalancerPoolMemberPatch(make(map[string]interface{})) + updateLoadBalancerPoolMemberOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateLoadBalancerPoolMemberOptionsModel).ToNot(BeNil()) + Expect(updateLoadBalancerPoolMemberOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerPoolMemberOptionsModel.PoolID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerPoolMemberOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerPoolMemberOptionsModel.LoadBalancerPoolMemberPatch).To(Equal(make(map[string]interface{}))) + Expect(updateLoadBalancerPoolMemberOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateLoadBalancerPoolOptions successfully`, func() { + // Construct an instance of the UpdateLoadBalancerPoolOptions model + loadBalancerID := "testString" + id := "testString" + loadBalancerPoolPatch := make(map[string]interface{}) + updateLoadBalancerPoolOptionsModel := vpcService.NewUpdateLoadBalancerPoolOptions(loadBalancerID, id, loadBalancerPoolPatch) + updateLoadBalancerPoolOptionsModel.SetLoadBalancerID("testString") + updateLoadBalancerPoolOptionsModel.SetID("testString") + updateLoadBalancerPoolOptionsModel.SetLoadBalancerPoolPatch(make(map[string]interface{})) + updateLoadBalancerPoolOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateLoadBalancerPoolOptionsModel).ToNot(BeNil()) + Expect(updateLoadBalancerPoolOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerPoolOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateLoadBalancerPoolOptionsModel.LoadBalancerPoolPatch).To(Equal(make(map[string]interface{}))) + Expect(updateLoadBalancerPoolOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateNetworkACLOptions successfully`, func() { + // Construct an instance of the UpdateNetworkACLOptions model + id := "testString" + networkACLPatch := make(map[string]interface{}) + updateNetworkACLOptionsModel := vpcService.NewUpdateNetworkACLOptions(id, networkACLPatch) + updateNetworkACLOptionsModel.SetID("testString") + updateNetworkACLOptionsModel.SetNetworkACLPatch(make(map[string]interface{})) + updateNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateNetworkACLOptionsModel).ToNot(BeNil()) + Expect(updateNetworkACLOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateNetworkACLOptionsModel.NetworkACLPatch).To(Equal(make(map[string]interface{}))) + Expect(updateNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateNetworkACLRuleOptions successfully`, func() { + // Construct an instance of the UpdateNetworkACLRuleOptions model + networkACLID := "testString" + id := "testString" + networkACLRulePatch := make(map[string]interface{}) + updateNetworkACLRuleOptionsModel := vpcService.NewUpdateNetworkACLRuleOptions(networkACLID, id, networkACLRulePatch) + updateNetworkACLRuleOptionsModel.SetNetworkACLID("testString") + updateNetworkACLRuleOptionsModel.SetID("testString") + updateNetworkACLRuleOptionsModel.SetNetworkACLRulePatch(make(map[string]interface{})) + updateNetworkACLRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateNetworkACLRuleOptionsModel).ToNot(BeNil()) + Expect(updateNetworkACLRuleOptionsModel.NetworkACLID).To(Equal(core.StringPtr("testString"))) + Expect(updateNetworkACLRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateNetworkACLRuleOptionsModel.NetworkACLRulePatch).To(Equal(make(map[string]interface{}))) + Expect(updateNetworkACLRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdatePlacementGroupOptions successfully`, func() { + // Construct an instance of the UpdatePlacementGroupOptions model + id := "testString" + placementGroupPatch := make(map[string]interface{}) + updatePlacementGroupOptionsModel := vpcService.NewUpdatePlacementGroupOptions(id, placementGroupPatch) + updatePlacementGroupOptionsModel.SetID("testString") + updatePlacementGroupOptionsModel.SetPlacementGroupPatch(make(map[string]interface{})) + updatePlacementGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updatePlacementGroupOptionsModel).ToNot(BeNil()) + Expect(updatePlacementGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updatePlacementGroupOptionsModel.PlacementGroupPatch).To(Equal(make(map[string]interface{}))) + Expect(updatePlacementGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdatePublicGatewayOptions successfully`, func() { + // Construct an instance of the UpdatePublicGatewayOptions model + id := "testString" + publicGatewayPatch := make(map[string]interface{}) + updatePublicGatewayOptionsModel := vpcService.NewUpdatePublicGatewayOptions(id, publicGatewayPatch) + updatePublicGatewayOptionsModel.SetID("testString") + updatePublicGatewayOptionsModel.SetPublicGatewayPatch(make(map[string]interface{})) + updatePublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updatePublicGatewayOptionsModel).ToNot(BeNil()) + Expect(updatePublicGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updatePublicGatewayOptionsModel.PublicGatewayPatch).To(Equal(make(map[string]interface{}))) + Expect(updatePublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateSecurityGroupOptions successfully`, func() { + // Construct an instance of the UpdateSecurityGroupOptions model + id := "testString" + securityGroupPatch := make(map[string]interface{}) + updateSecurityGroupOptionsModel := vpcService.NewUpdateSecurityGroupOptions(id, securityGroupPatch) + updateSecurityGroupOptionsModel.SetID("testString") + updateSecurityGroupOptionsModel.SetSecurityGroupPatch(make(map[string]interface{})) + updateSecurityGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateSecurityGroupOptionsModel).ToNot(BeNil()) + Expect(updateSecurityGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateSecurityGroupOptionsModel.SecurityGroupPatch).To(Equal(make(map[string]interface{}))) + Expect(updateSecurityGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateSecurityGroupRuleOptions successfully`, func() { + // Construct an instance of the UpdateSecurityGroupRuleOptions model + securityGroupID := "testString" + id := "testString" + securityGroupRulePatch := make(map[string]interface{}) + updateSecurityGroupRuleOptionsModel := vpcService.NewUpdateSecurityGroupRuleOptions(securityGroupID, id, securityGroupRulePatch) + updateSecurityGroupRuleOptionsModel.SetSecurityGroupID("testString") + updateSecurityGroupRuleOptionsModel.SetID("testString") + updateSecurityGroupRuleOptionsModel.SetSecurityGroupRulePatch(make(map[string]interface{})) + updateSecurityGroupRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateSecurityGroupRuleOptionsModel).ToNot(BeNil()) + Expect(updateSecurityGroupRuleOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) + Expect(updateSecurityGroupRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateSecurityGroupRuleOptionsModel.SecurityGroupRulePatch).To(Equal(make(map[string]interface{}))) + Expect(updateSecurityGroupRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateSnapshotOptions successfully`, func() { + // Construct an instance of the UpdateSnapshotOptions model + id := "testString" + snapshotPatch := make(map[string]interface{}) + updateSnapshotOptionsModel := vpcService.NewUpdateSnapshotOptions(id, snapshotPatch) + updateSnapshotOptionsModel.SetID("testString") + updateSnapshotOptionsModel.SetSnapshotPatch(make(map[string]interface{})) + updateSnapshotOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateSnapshotOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateSnapshotOptionsModel).ToNot(BeNil()) + Expect(updateSnapshotOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateSnapshotOptionsModel.SnapshotPatch).To(Equal(make(map[string]interface{}))) + Expect(updateSnapshotOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(updateSnapshotOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateSubnetOptions successfully`, func() { + // Construct an instance of the UpdateSubnetOptions model + id := "testString" + subnetPatch := make(map[string]interface{}) + updateSubnetOptionsModel := vpcService.NewUpdateSubnetOptions(id, subnetPatch) + updateSubnetOptionsModel.SetID("testString") + updateSubnetOptionsModel.SetSubnetPatch(make(map[string]interface{})) + updateSubnetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateSubnetOptionsModel).ToNot(BeNil()) + Expect(updateSubnetOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateSubnetOptionsModel.SubnetPatch).To(Equal(make(map[string]interface{}))) + Expect(updateSubnetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateSubnetReservedIPOptions successfully`, func() { + // Construct an instance of the UpdateSubnetReservedIPOptions model + subnetID := "testString" + id := "testString" + reservedIPPatch := make(map[string]interface{}) + updateSubnetReservedIPOptionsModel := vpcService.NewUpdateSubnetReservedIPOptions(subnetID, id, reservedIPPatch) + updateSubnetReservedIPOptionsModel.SetSubnetID("testString") + updateSubnetReservedIPOptionsModel.SetID("testString") + updateSubnetReservedIPOptionsModel.SetReservedIPPatch(make(map[string]interface{})) + updateSubnetReservedIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateSubnetReservedIPOptionsModel).ToNot(BeNil()) + Expect(updateSubnetReservedIPOptionsModel.SubnetID).To(Equal(core.StringPtr("testString"))) + Expect(updateSubnetReservedIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateSubnetReservedIPOptionsModel.ReservedIPPatch).To(Equal(make(map[string]interface{}))) + Expect(updateSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateVolumeOptions successfully`, func() { + // Construct an instance of the UpdateVolumeOptions model + id := "testString" + volumePatch := make(map[string]interface{}) + updateVolumeOptionsModel := vpcService.NewUpdateVolumeOptions(id, volumePatch) + updateVolumeOptionsModel.SetID("testString") + updateVolumeOptionsModel.SetVolumePatch(make(map[string]interface{})) + updateVolumeOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVolumeOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateVolumeOptionsModel).ToNot(BeNil()) + Expect(updateVolumeOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateVolumeOptionsModel.VolumePatch).To(Equal(make(map[string]interface{}))) + Expect(updateVolumeOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(updateVolumeOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateVPCAddressPrefixOptions successfully`, func() { + // Construct an instance of the UpdateVPCAddressPrefixOptions model + vpcID := "testString" + id := "testString" + addressPrefixPatch := make(map[string]interface{}) + updateVPCAddressPrefixOptionsModel := vpcService.NewUpdateVPCAddressPrefixOptions(vpcID, id, addressPrefixPatch) + updateVPCAddressPrefixOptionsModel.SetVPCID("testString") + updateVPCAddressPrefixOptionsModel.SetID("testString") + updateVPCAddressPrefixOptionsModel.SetAddressPrefixPatch(make(map[string]interface{})) + updateVPCAddressPrefixOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateVPCAddressPrefixOptionsModel).ToNot(BeNil()) + Expect(updateVPCAddressPrefixOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPCAddressPrefixOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPCAddressPrefixOptionsModel.AddressPrefixPatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPCAddressPrefixOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateVPCOptions successfully`, func() { + // Construct an instance of the UpdateVPCOptions model + id := "testString" + vpcPatch := make(map[string]interface{}) + updateVPCOptionsModel := vpcService.NewUpdateVPCOptions(id, vpcPatch) + updateVPCOptionsModel.SetID("testString") + updateVPCOptionsModel.SetVPCPatch(make(map[string]interface{})) + updateVPCOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateVPCOptionsModel).ToNot(BeNil()) + Expect(updateVPCOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPCOptionsModel.VPCPatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPCOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateVPCRouteOptions successfully`, func() { + // Construct an instance of the UpdateVPCRouteOptions model + vpcID := "testString" + id := "testString" + routePatch := make(map[string]interface{}) + updateVPCRouteOptionsModel := vpcService.NewUpdateVPCRouteOptions(vpcID, id, routePatch) + updateVPCRouteOptionsModel.SetVPCID("testString") + updateVPCRouteOptionsModel.SetID("testString") + updateVPCRouteOptionsModel.SetRoutePatch(make(map[string]interface{})) + updateVPCRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateVPCRouteOptionsModel).ToNot(BeNil()) + Expect(updateVPCRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPCRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPCRouteOptionsModel.RoutePatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPCRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateVPCRoutingTableOptions successfully`, func() { + // Construct an instance of the UpdateVPCRoutingTableOptions model + vpcID := "testString" + id := "testString" + routingTablePatch := make(map[string]interface{}) + updateVPCRoutingTableOptionsModel := vpcService.NewUpdateVPCRoutingTableOptions(vpcID, id, routingTablePatch) + updateVPCRoutingTableOptionsModel.SetVPCID("testString") + updateVPCRoutingTableOptionsModel.SetID("testString") + updateVPCRoutingTableOptionsModel.SetRoutingTablePatch(make(map[string]interface{})) + updateVPCRoutingTableOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPCRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateVPCRoutingTableOptionsModel).ToNot(BeNil()) + Expect(updateVPCRoutingTableOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPCRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPCRoutingTableOptionsModel.RoutingTablePatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPCRoutingTableOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(updateVPCRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateVPCRoutingTableRouteOptions successfully`, func() { + // Construct an instance of the UpdateVPCRoutingTableRouteOptions model + vpcID := "testString" + routingTableID := "testString" + id := "testString" + routePatch := make(map[string]interface{}) + updateVPCRoutingTableRouteOptionsModel := vpcService.NewUpdateVPCRoutingTableRouteOptions(vpcID, routingTableID, id, routePatch) + updateVPCRoutingTableRouteOptionsModel.SetVPCID("testString") + updateVPCRoutingTableRouteOptionsModel.SetRoutingTableID("testString") + updateVPCRoutingTableRouteOptionsModel.SetID("testString") + updateVPCRoutingTableRouteOptionsModel.SetRoutePatch(make(map[string]interface{})) + updateVPCRoutingTableRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateVPCRoutingTableRouteOptionsModel).ToNot(BeNil()) + Expect(updateVPCRoutingTableRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPCRoutingTableRouteOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPCRoutingTableRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPCRoutingTableRouteOptionsModel.RoutePatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPCRoutingTableRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateVPNGatewayConnectionOptions successfully`, func() { + // Construct an instance of the UpdateVPNGatewayConnectionOptions model + vpnGatewayID := "testString" + id := "testString" + vpnGatewayConnectionPatch := make(map[string]interface{}) + updateVPNGatewayConnectionOptionsModel := vpcService.NewUpdateVPNGatewayConnectionOptions(vpnGatewayID, id, vpnGatewayConnectionPatch) + updateVPNGatewayConnectionOptionsModel.SetVPNGatewayID("testString") + updateVPNGatewayConnectionOptionsModel.SetID("testString") + updateVPNGatewayConnectionOptionsModel.SetVPNGatewayConnectionPatch(make(map[string]interface{})) + updateVPNGatewayConnectionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateVPNGatewayConnectionOptionsModel).ToNot(BeNil()) + Expect(updateVPNGatewayConnectionOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPNGatewayConnectionOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPNGatewayConnectionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateVPNGatewayOptions successfully`, func() { + // Construct an instance of the UpdateVPNGatewayOptions model + id := "testString" + vpnGatewayPatch := make(map[string]interface{}) + updateVPNGatewayOptionsModel := vpcService.NewUpdateVPNGatewayOptions(id, vpnGatewayPatch) + updateVPNGatewayOptionsModel.SetID("testString") + updateVPNGatewayOptionsModel.SetVPNGatewayPatch(make(map[string]interface{})) + updateVPNGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateVPNGatewayOptionsModel).ToNot(BeNil()) + Expect(updateVPNGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPNGatewayOptionsModel.VPNGatewayPatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPNGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateVPNServerOptions successfully`, func() { + // Construct an instance of the UpdateVPNServerOptions model + id := "testString" + vpnServerPatch := make(map[string]interface{}) + updateVPNServerOptionsModel := vpcService.NewUpdateVPNServerOptions(id, vpnServerPatch) + updateVPNServerOptionsModel.SetID("testString") + updateVPNServerOptionsModel.SetVPNServerPatch(make(map[string]interface{})) + updateVPNServerOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPNServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateVPNServerOptionsModel).ToNot(BeNil()) + Expect(updateVPNServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPNServerOptionsModel.VPNServerPatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPNServerOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(updateVPNServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateVPNServerRouteOptions successfully`, func() { + // Construct an instance of the UpdateVPNServerRouteOptions model + vpnServerID := "testString" + id := "testString" + vpnServerRoutePatch := make(map[string]interface{}) + updateVPNServerRouteOptionsModel := vpcService.NewUpdateVPNServerRouteOptions(vpnServerID, id, vpnServerRoutePatch) + updateVPNServerRouteOptionsModel.SetVPNServerID("testString") + updateVPNServerRouteOptionsModel.SetID("testString") + updateVPNServerRouteOptionsModel.SetVPNServerRoutePatch(make(map[string]interface{})) + updateVPNServerRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateVPNServerRouteOptionsModel).ToNot(BeNil()) + Expect(updateVPNServerRouteOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPNServerRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPNServerRouteOptionsModel.VPNServerRoutePatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPNServerRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewVolumeAttachmentPrototypeInstanceByImageContext successfully`, func() { + var volume *vpcv1.VolumePrototypeInstanceByImageContext = nil + _, err := vpcService.NewVolumeAttachmentPrototypeInstanceByImageContext(volume) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext successfully`, func() { + var volume *vpcv1.VolumePrototypeInstanceBySourceSnapshotContext = nil + _, err := vpcService.NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(volume) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewVolumeAttachmentPrototypeInstanceContext successfully`, func() { + var volume vpcv1.VolumeAttachmentVolumePrototypeInstanceContextIntf = nil + _, err := vpcService.NewVolumeAttachmentPrototypeInstanceContext(volume) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewVolumePrototypeInstanceByImageContext successfully`, func() { + var profile vpcv1.VolumeProfileIdentityIntf = nil + _, err := vpcService.NewVolumePrototypeInstanceByImageContext(profile) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewVolumePrototypeInstanceBySourceSnapshotContext successfully`, func() { + var profile vpcv1.VolumeProfileIdentityIntf = nil + var sourceSnapshot vpcv1.SnapshotIdentityIntf = nil + _, err := vpcService.NewVolumePrototypeInstanceBySourceSnapshotContext(profile, sourceSnapshot) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype successfully`, func() { + var subnet vpcv1.SubnetIdentityIntf = nil + interfaceType := "pci" + _, err := vpcService.NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(subnet, interfaceType) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype successfully`, func() { + var subnet vpcv1.SubnetIdentityIntf = nil + interfaceType := "vlan" + vlan := int64(4) + _, err := vpcService.NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(subnet, interfaceType, vlan) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewBareMetalServerProfileIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768" + _model, err := vpcService.NewBareMetalServerProfileIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewBareMetalServerProfileIdentityByName successfully`, func() { + name := "bx2-metal-192x768" + _model, err := vpcService.NewBareMetalServerProfileIdentityByName(name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewCertificateInstanceIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5" + _model, err := vpcService.NewCertificateInstanceIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewDedicatedHostGroupIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group: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" + _model, err := vpcService.NewDedicatedHostGroupIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewDedicatedHostGroupIdentityByID successfully`, func() { + id := "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" + _model, err := vpcService.NewDedicatedHostGroupIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewDedicatedHostProfileIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/profiles/mx2-host-152x1216" + _model, err := vpcService.NewDedicatedHostProfileIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewDedicatedHostProfileIdentityByName successfully`, func() { + name := "mx2-host-152x1216" + _model, err := vpcService.NewDedicatedHostProfileIdentityByName(name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewDedicatedHostPrototypeDedicatedHostByGroup successfully`, func() { + var profile vpcv1.DedicatedHostProfileIdentityIntf = nil + var group vpcv1.DedicatedHostGroupIdentityIntf = nil + _, err := vpcService.NewDedicatedHostPrototypeDedicatedHostByGroup(profile, group) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewDedicatedHostPrototypeDedicatedHostByZone successfully`, func() { + var profile vpcv1.DedicatedHostProfileIdentityIntf = nil + var zone vpcv1.ZoneIdentityIntf = nil + _, err := vpcService.NewDedicatedHostPrototypeDedicatedHostByZone(profile, zone) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewEncryptionKeyIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179" + _model, err := vpcService.NewEncryptionKeyIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext successfully`, func() { + var subnet vpcv1.SubnetIdentityIntf = nil + _, err := vpcService.NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext(subnet) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e" + _model, err := vpcService.NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID successfully`, func() { + id := "10c02d81-0ecb-4dc5-897d-28392913b81e" + _model, err := vpcService.NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFloatingIPPrototypeFloatingIPByTarget successfully`, func() { + var target vpcv1.FloatingIPByTargetNetworkInterfaceIdentityIntf = nil + _, err := vpcService.NewFloatingIPPrototypeFloatingIPByTarget(target) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewFloatingIPPrototypeFloatingIPByZone successfully`, func() { + var zone vpcv1.ZoneIdentityIntf = nil + _, err := vpcService.NewFloatingIPPrototypeFloatingIPByZone(zone) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewFloatingIPTargetPatchNetworkInterfaceIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e" + _model, err := vpcService.NewFloatingIPTargetPatchNetworkInterfaceIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFloatingIPTargetPatchNetworkInterfaceIdentityByID successfully`, func() { + id := "10c02d81-0ecb-4dc5-897d-28392913b81e" + _model, err := vpcService.NewFloatingIPTargetPatchNetworkInterfaceIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewImageIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8" + _model, err := vpcService.NewImageIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewImageIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8" + _model, err := vpcService.NewImageIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewImageIdentityByID successfully`, func() { + id := "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8" + _model, err := vpcService.NewImageIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewImagePrototypeImageByFile successfully`, func() { + var file *vpcv1.ImageFilePrototype = nil + var operatingSystem vpcv1.OperatingSystemIdentityIntf = nil + _, err := vpcService.NewImagePrototypeImageByFile(file, operatingSystem) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewImagePrototypeImageBySourceVolume successfully`, func() { + var sourceVolume vpcv1.VolumeIdentityIntf = nil + _, err := vpcService.NewImagePrototypeImageBySourceVolume(sourceVolume) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype successfully`, func() { + metricType := "cpu" + metricValue := int64(38) + policyType := "target" + _model, err := vpcService.NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype(metricType, metricValue, policyType) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype successfully`, func() { + managerType := "autoscale" + maxMembershipCount := int64(10) + _model, err := vpcService.NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype(managerType, maxMembershipCount) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype successfully`, func() { + managerType := "scheduled" + _model, err := vpcService.NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype(managerType) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstancePatchProfileInstanceProfileIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16" + _model, err := vpcService.NewInstancePatchProfileInstanceProfileIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstancePatchProfileInstanceProfileIdentityByName successfully`, func() { + name := "bx2-4x16" + _model, err := vpcService.NewInstancePatchProfileInstanceProfileIdentityByName(name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstanceProfileIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16" + _model, err := vpcService.NewInstanceProfileIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstanceProfileIdentityByName successfully`, func() { + name := "bx2-4x16" + _model, err := vpcService.NewInstanceProfileIdentityByName(name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstancePrototypeInstanceByImage successfully`, func() { + var image vpcv1.ImageIdentityIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + var zone vpcv1.ZoneIdentityIntf = nil + _, err := vpcService.NewInstancePrototypeInstanceByImage(image, primaryNetworkInterface, zone) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstancePrototypeInstanceBySourceSnapshot successfully`, func() { + var bootVolumeAttachment *vpcv1.VolumeAttachmentPrototypeInstanceBySourceSnapshotContext = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + var zone vpcv1.ZoneIdentityIntf = nil + _, err := vpcService.NewInstancePrototypeInstanceBySourceSnapshot(bootVolumeAttachment, primaryNetworkInterface, zone) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstancePrototypeInstanceBySourceTemplate successfully`, func() { + var sourceTemplate vpcv1.InstanceTemplateIdentityIntf = nil + _, err := vpcService.NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceTemplateIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a" + _model, err := vpcService.NewInstanceTemplateIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstanceTemplateIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a" + _model, err := vpcService.NewInstanceTemplateIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstanceTemplateIdentityByID successfully`, func() { + id := "a6b1a881-2ce8-41a3-80fc-36316a73f803" + _model, err := vpcService.NewInstanceTemplateIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstanceTemplatePrototypeInstanceByImage successfully`, func() { + var image vpcv1.ImageIdentityIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + var zone vpcv1.ZoneIdentityIntf = nil + _, err := vpcService.NewInstanceTemplatePrototypeInstanceByImage(image, primaryNetworkInterface, zone) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceTemplatePrototypeInstanceBySourceTemplate successfully`, func() { + var sourceTemplate vpcv1.InstanceTemplateIdentityIntf = nil + _, err := vpcService.NewInstanceTemplatePrototypeInstanceBySourceTemplate(sourceTemplate) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewKeyIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803" + _model, err := vpcService.NewKeyIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewKeyIdentityByFingerprint successfully`, func() { + fingerprint := "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY" + _model, err := vpcService.NewKeyIdentityByFingerprint(fingerprint) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewKeyIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803" + _model, err := vpcService.NewKeyIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewKeyIdentityByID successfully`, func() { + id := "a6b1a881-2ce8-41a3-80fc-36316a73f803" + _model, err := vpcService.NewKeyIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName successfully`, func() { + name := "bucket-27200-lwx4cfvcue" + _model, err := vpcService.NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727" + _model, err := vpcService.NewLoadBalancerIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727" + _model, err := vpcService.NewLoadBalancerIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerIdentityByID successfully`, func() { + id := "dd754295-e9e0-4c9d-bf6c-58fbc59e5727" + _model, err := vpcService.NewLoadBalancerIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerListenerIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004" + _model, err := vpcService.NewLoadBalancerListenerIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerListenerIdentityByID successfully`, func() { + id := "70294e14-4e61-11e8-bcf4-0242ac110004" + _model, err := vpcService.NewLoadBalancerListenerIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype successfully`, func() { + httpStatusCode := int64(301) + var listener vpcv1.LoadBalancerListenerIdentityIntf = nil + _, err := vpcService.NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode, listener) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype successfully`, func() { + httpStatusCode := int64(301) + url := "https://www.redirect.com" + _model, err := vpcService.NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(httpStatusCode, url) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerPoolIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004" + _model, err := vpcService.NewLoadBalancerPoolIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerPoolIdentityByID successfully`, func() { + id := "70294e14-4e61-11e8-bcf4-0242ac110004" + _model, err := vpcService.NewLoadBalancerPoolIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerPoolMemberTargetPrototypeIP successfully`, func() { + address := "192.168.3.4" + _model, err := vpcService.NewLoadBalancerPoolMemberTargetPrototypeIP(address) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerProfileIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed" + _model, err := vpcService.NewLoadBalancerProfileIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerProfileIdentityByName successfully`, func() { + name := "network-fixed" + _model, err := vpcService.NewLoadBalancerProfileIdentityByName(name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkACLIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf" + _model, err := vpcService.NewNetworkACLIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkACLIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf" + _model, err := vpcService.NewNetworkACLIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkACLIdentityByID successfully`, func() { + id := "a4e28308-8ee7-46ab-8108-9f881f22bdbf" + _model, err := vpcService.NewNetworkACLIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkACLPrototypeNetworkACLByRules successfully`, func() { + var vpc vpcv1.VPCIdentityIntf = nil + _, err := vpcService.NewNetworkACLPrototypeNetworkACLByRules(vpc) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewNetworkACLPrototypeNetworkACLBySourceNetworkACL successfully`, func() { + var vpc vpcv1.VPCIdentityIntf = nil + var sourceNetworkACL vpcv1.NetworkACLIdentityIntf = nil + _, err := vpcService.NewNetworkACLPrototypeNetworkACLBySourceNetworkACL(vpc, sourceNetworkACL) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9" + _model, err := vpcService.NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID successfully`, func() { + id := "8daca77a-4980-4d33-8f3e-7038797be8f9" + _model, err := vpcService.NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9" + _model, err := vpcService.NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID successfully`, func() { + id := "8daca77a-4980-4d33-8f3e-7038797be8f9" + _model, err := vpcService.NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype successfully`, func() { + action := "allow" + destination := "192.168.3.2/32" + direction := "inbound" + source := "192.168.3.2/32" + protocol := "all" + _model, err := vpcService.NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(action, destination, direction, source, protocol) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype successfully`, func() { + action := "allow" + destination := "192.168.3.2/32" + direction := "inbound" + source := "192.168.3.2/32" + protocol := "icmp" + _model, err := vpcService.NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(action, destination, direction, source, protocol) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype successfully`, func() { + action := "allow" + destination := "192.168.3.2/32" + direction := "inbound" + source := "192.168.3.2/32" + protocol := "udp" + _model, err := vpcService.NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(action, destination, direction, source, protocol) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype successfully`, func() { + action := "allow" + destination := "192.168.3.2/32" + direction := "inbound" + source := "192.168.3.2/32" + protocol := "all" + _model, err := vpcService.NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(action, destination, direction, source, protocol) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype successfully`, func() { + action := "allow" + destination := "192.168.3.2/32" + direction := "inbound" + source := "192.168.3.2/32" + protocol := "icmp" + _model, err := vpcService.NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(action, destination, direction, source, protocol) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype successfully`, func() { + action := "allow" + destination := "192.168.3.2/32" + direction := "inbound" + source := "192.168.3.2/32" + protocol := "udp" + _model, err := vpcService.NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(action, destination, direction, source, protocol) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewOperatingSystemIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64" + _model, err := vpcService.NewOperatingSystemIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewOperatingSystemIdentityByName successfully`, func() { + name := "ubuntu-16-amd64" + _model, err := vpcService.NewOperatingSystemIdentityByName(name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewPublicGatewayIdentityPublicGatewayIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241" + _model, err := vpcService.NewPublicGatewayIdentityPublicGatewayIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewPublicGatewayIdentityPublicGatewayIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241" + _model, err := vpcService.NewPublicGatewayIdentityPublicGatewayIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewPublicGatewayIdentityPublicGatewayIdentityByID successfully`, func() { + id := "dc5431ef-1fc6-4861-adc9-a59d077d1241" + _model, err := vpcService.NewPublicGatewayIdentityPublicGatewayIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewResourceGroupIdentityByID successfully`, func() { + id := "fee82deba12e4c0fb69c3b09d1f12345" + _model, err := vpcService.NewResourceGroupIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP successfully`, func() { + address := "192.168.3.4" + _model, err := vpcService.NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(address) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRoutingTableIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840" + _model, err := vpcService.NewRoutingTableIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRoutingTableIdentityByID successfully`, func() { + id := "1a15dca5-7e33-45e1-b7c5-bc690e569531" + _model, err := vpcService.NewRoutingTableIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" + _model, err := vpcService.NewSecurityGroupIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" + _model, err := vpcService.NewSecurityGroupIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupIdentityByID successfully`, func() { + id := "be5df5ca-12a0-494b-907e-aa6ec2bfa271" + _model, err := vpcService.NewSecurityGroupIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll successfully`, func() { + direction := "inbound" + protocol := "all" + _model, err := vpcService.NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(direction, protocol) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp successfully`, func() { + direction := "inbound" + protocol := "icmp" + _model, err := vpcService.NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(direction, protocol) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp successfully`, func() { + direction := "inbound" + protocol := "udp" + _model, err := vpcService.NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(direction, protocol) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupRuleRemotePatchCIDR successfully`, func() { + cidrBlock := "192.168.3.0/24" + _model, err := vpcService.NewSecurityGroupRuleRemotePatchCIDR(cidrBlock) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupRuleRemotePatchIP successfully`, func() { + address := "192.168.3.4" + _model, err := vpcService.NewSecurityGroupRuleRemotePatchIP(address) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupRuleRemotePrototypeCIDR successfully`, func() { + cidrBlock := "192.168.3.0/24" + _model, err := vpcService.NewSecurityGroupRuleRemotePrototypeCIDR(cidrBlock) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupRuleRemotePrototypeIP successfully`, func() { + address := "192.168.3.4" + _model, err := vpcService.NewSecurityGroupRuleRemotePrototypeIP(address) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSnapshotIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263" + _model, err := vpcService.NewSnapshotIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSnapshotIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263" + _model, err := vpcService.NewSnapshotIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSnapshotIdentityByID successfully`, func() { + id := "r134-f6bfa329-0e36-433f-a3bb-0df632e79263" + _model, err := vpcService.NewSnapshotIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSnapshotPrototypeSnapshotBySourceVolume successfully`, func() { + var sourceVolume vpcv1.VolumeIdentityIntf = nil + _, err := vpcService.NewSnapshotPrototypeSnapshotBySourceVolume(sourceVolume) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewSubnetIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + _model, err := vpcService.NewSubnetIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSubnetIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + _model, err := vpcService.NewSubnetIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSubnetIdentityByID successfully`, func() { + id := "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + _model, err := vpcService.NewSubnetIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSubnetPrototypeSubnetByCIDR successfully`, func() { + var vpc vpcv1.VPCIdentityIntf = nil + ipv4CIDRBlock := "10.0.0.0/24" + _, err := vpcService.NewSubnetPrototypeSubnetByCIDR(vpc, ipv4CIDRBlock) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewSubnetPrototypeSubnetByTotalCount successfully`, func() { + var vpc vpcv1.VPCIdentityIntf = nil + totalIpv4AddressCount := int64(256) + var zone vpcv1.ZoneIdentityIntf = nil + _, err := vpcService.NewSubnetPrototypeSubnetByTotalCount(vpc, totalIpv4AddressCount, zone) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241" + _model, err := vpcService.NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241" + _model, err := vpcService.NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSubnetPublicGatewayPatchPublicGatewayIdentityByID successfully`, func() { + id := "dc5431ef-1fc6-4861-adc9-a59d077d1241" + _model, err := vpcService.NewSubnetPublicGatewayPatchPublicGatewayIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewTrustedProfileIdentityTrustedProfileByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:iam-identity::a/123456::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5" + _model, err := vpcService.NewTrustedProfileIdentityTrustedProfileByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewTrustedProfileIdentityTrustedProfileByID successfully`, func() { + id := "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5" + _model, err := vpcService.NewTrustedProfileIdentityTrustedProfileByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPCIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b" + _model, err := vpcService.NewVPCIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPCIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b" + _model, err := vpcService.NewVPCIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPCIdentityByID successfully`, func() { + id := "4727d842-f94f-4a2d-824a-9bc9b02c523b" + _model, err := vpcService.NewVPCIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b" + _model, err := vpcService.NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID successfully`, func() { + id := "ddf51bec-3424-11e8-b467-0ed5f89f718b" + _model, err := vpcService.NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b" + _model, err := vpcService.NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID successfully`, func() { + id := "ddf51bec-3424-11e8-b467-0ed5f89f718b" + _model, err := vpcService.NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b" + _model, err := vpcService.NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID successfully`, func() { + id := "ddf51bec-3424-11e8-b467-0ed5f89f718b" + _model, err := vpcService.NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b" + _model, err := vpcService.NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID successfully`, func() { + id := "ddf51bec-3424-11e8-b467-0ed5f89f718b" + _model, err := vpcService.NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype successfully`, func() { + peerAddress := "169.21.50.5" + psk := "lkj14b1oi0alcniejkso" + localCIDRs := []string{"192.168.1.0/24"} + peerCIDRs := []string{"10.45.1.0/24"} + _model, err := vpcService.NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(peerAddress, psk, localCIDRs, peerCIDRs) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype successfully`, func() { + peerAddress := "169.21.50.5" + psk := "lkj14b1oi0alcniejkso" + _model, err := vpcService.NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(peerAddress, psk) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype successfully`, func() { + var subnet vpcv1.SubnetIdentityIntf = nil + _, err := vpcService.NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewVPNGatewayPrototypeVPNGatewayRouteModePrototype successfully`, func() { + var subnet vpcv1.SubnetIdentityIntf = nil + _, err := vpcService.NewVPNGatewayPrototypeVPNGatewayRouteModePrototype(subnet) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewVPNServerAuthenticationByUsernameIDProviderByIam successfully`, func() { + providerType := "iam" + _model, err := vpcService.NewVPNServerAuthenticationByUsernameIDProviderByIam(providerType) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype successfully`, func() { + method := "certificate" + var clientCa vpcv1.CertificateInstanceIdentityIntf = nil + _, err := vpcService.NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(method, clientCa) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype successfully`, func() { + method := "username" + var identityProvider vpcv1.VPNServerAuthenticationByUsernameIDProviderIntf = nil + _, err := vpcService.NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(method, identityProvider) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewVolumeIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5" + _model, err := vpcService.NewVolumeIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVolumeIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5" + _model, err := vpcService.NewVolumeIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVolumeIdentityByID successfully`, func() { + id := "1a6b7274-678d-4dfb-8981-c71dd9d4daa5" + _model, err := vpcService.NewVolumeIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVolumeProfileIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose" + _model, err := vpcService.NewVolumeProfileIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVolumeProfileIdentityByName successfully`, func() { + name := "general-purpose" + _model, err := vpcService.NewVolumeProfileIdentityByName(name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVolumePrototypeVolumeByCapacity successfully`, func() { + var profile vpcv1.VolumeProfileIdentityIntf = nil + var zone vpcv1.ZoneIdentityIntf = nil + capacity := int64(100) + _, err := vpcService.NewVolumePrototypeVolumeByCapacity(profile, zone, capacity) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewVolumePrototypeVolumeBySourceSnapshot successfully`, func() { + var profile vpcv1.VolumeProfileIdentityIntf = nil + var zone vpcv1.ZoneIdentityIntf = nil + var sourceSnapshot vpcv1.SnapshotIdentityIntf = nil + _, err := vpcService.NewVolumePrototypeVolumeBySourceSnapshot(profile, zone, sourceSnapshot) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewZoneIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1" + _model, err := vpcService.NewZoneIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewZoneIdentityByName successfully`, func() { + name := "us-south-1" + _model, err := vpcService.NewZoneIdentityByName(name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + _model, err := vpcService.NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID successfully`, func() { + id := "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + _model, err := vpcService.NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN successfully`, func() { + resourceType := "provider_cloud_service" + crn := "crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::" + _model, err := vpcService.NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(resourceType, crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName successfully`, func() { + resourceType := "provider_cloud_service" + name := "ibm-ntp-server" + _model, err := vpcService.NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(resourceType, name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a" + _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/1e09281b-f177-46fb-baf1-bc152b2e391a" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID successfully`, func() { + id := "1e09281b-f177-46fb-baf1-bc152b2e391a" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID successfully`, func() { + id := "10c02d81-0ecb-4dc5-897d-28392913b81e" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID successfully`, func() { + id := "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID successfully`, func() { + id := "4727d842-f94f-4a2d-824a-9bc9b02c523b" + _model, err := vpcService.NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(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) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID successfully`, func() { + id := "1e09281b-f177-46fb-baf1-bc152b2e391a" + _model, err := vpcService.NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group: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" + _model, err := vpcService.NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID successfully`, func() { + id := "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" + _model, err := vpcService.NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a" + _model, err := vpcService.NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a" + _model, err := vpcService.NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID successfully`, func() { + id := "1e09281b-f177-46fb-baf1-bc152b2e391a" + _model, err := vpcService.NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group: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" + _model, err := vpcService.NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID successfully`, func() { + id := "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" + _model, err := vpcService.NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a" + _model, err := vpcService.NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a" + _model, err := vpcService.NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID successfully`, func() { + id := "1e09281b-f177-46fb-baf1-bc152b2e391a" + _model, err := vpcService.NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-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" + _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" + _model, err := vpcService.NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004" + _model, err := vpcService.NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID successfully`, func() { + id := "70294e14-4e61-11e8-bcf4-0242ac110004" + _model, err := vpcService.NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004" + _model, err := vpcService.NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID successfully`, func() { + id := "70294e14-4e61-11e8-bcf4-0242ac110004" + _model, err := vpcService.NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a" + _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/1e09281b-f177-46fb-baf1-bc152b2e391a" + _model, err := vpcService.NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID successfully`, func() { + id := "1e09281b-f177-46fb-baf1-bc152b2e391a" + _model, err := vpcService.NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" + _model, err := vpcService.NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID successfully`, func() { + id := "6d353a0f-aeb1-4ae1-832e-1110d10981bb" + _model, err := vpcService.NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress successfully`, func() { + address := "203.0.113.1" + _model, err := vpcService.NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress(address) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689" + _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" + _model, err := vpcService.NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID successfully`, func() { + id := "39300233-9995-4806-89a5-3c1b6eb88689" + _model, err := vpcService.NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5" + _model, err := vpcService.NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5" + _model, err := vpcService.NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID successfully`, func() { + id := "d7cc5196-9864-48c4-82d8-3f30da41fcc5" + _model, err := vpcService.NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b" + _model, err := vpcService.NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID successfully`, func() { + id := "a10a5771-dc23-442c-8460-c3601d8542f7" + _model, err := vpcService.NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" + _model, err := vpcService.NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" + _model, err := vpcService.NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID successfully`, func() { + id := "be5df5ca-12a0-494b-907e-aa6ec2bfa271" + _model, err := vpcService.NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" + _model, err := vpcService.NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" + _model, err := vpcService.NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID successfully`, func() { + id := "be5df5ca-12a0-494b-907e-aa6ec2bfa271" + _model, err := vpcService.NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5" + _model, err := vpcService.NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5" + _model, err := vpcService.NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID successfully`, func() { + id := "1a6b7274-678d-4dfb-8981-c71dd9d4daa5" + _model, err := vpcService.NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity successfully`, func() { + var profile vpcv1.VolumeProfileIdentityIntf = nil + capacity := int64(100) + _, err := vpcService.NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(profile, capacity) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot successfully`, func() { + var profile vpcv1.VolumeProfileIdentityIntf = nil + var sourceSnapshot vpcv1.SnapshotIdentityIntf = nil + _, err := vpcService.NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(profile, sourceSnapshot) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5" + _model, err := vpcService.NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref successfully`, func() { + href := "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5" + _model, err := vpcService.NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref(href) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID successfully`, func() { + id := "1a6b7274-678d-4dfb-8981-c71dd9d4daa5" + _model, err := vpcService.NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID(id) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity successfully`, func() { + var profile vpcv1.VolumeProfileIdentityIntf = nil + capacity := int64(100) + _, err := vpcService.NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(profile, capacity) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot successfully`, func() { + var profile vpcv1.VolumeProfileIdentityIntf = nil + var sourceSnapshot vpcv1.SnapshotIdentityIntf = nil + _, err := vpcService.NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(profile, sourceSnapshot) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup successfully`, func() { + var group *vpcv1.InstanceGroupManagerScheduledActionGroupPrototype = nil + _, err := vpcService.NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup(group) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager successfully`, func() { + var manager vpcv1.InstanceGroupManagerScheduledActionManagerPrototypeIntf = nil + _, err := vpcService.NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager(manager) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup successfully`, func() { + var group *vpcv1.InstanceGroupManagerScheduledActionGroupPrototype = nil + _, err := vpcService.NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup(group) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager successfully`, func() { + var manager vpcv1.InstanceGroupManagerScheduledActionManagerPrototypeIntf = nil + _, err := vpcService.NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager(manager) + Expect(err).ToNot(BeNil()) + }) + }) + }) + Describe(`Utility function tests`, func() { + It(`Invoke CreateMockByteArray() successfully`, func() { + mockByteArray := CreateMockByteArray("This is a test") + Expect(mockByteArray).ToNot(BeNil()) + }) + It(`Invoke CreateMockUUID() successfully`, func() { + mockUUID := CreateMockUUID("9fab83da-98cb-4f18-a7ba-b6f0435c9673") + Expect(mockUUID).ToNot(BeNil()) + }) + It(`Invoke CreateMockReader() successfully`, func() { + mockReader := CreateMockReader("This is a test.") + Expect(mockReader).ToNot(BeNil()) + }) + It(`Invoke CreateMockDate() successfully`, func() { + mockDate := CreateMockDate("2019-01-01") + Expect(mockDate).ToNot(BeNil()) + }) + It(`Invoke CreateMockDateTime() successfully`, func() { + mockDateTime := CreateMockDateTime("2019-01-01T12:00:00.000Z") + Expect(mockDateTime).ToNot(BeNil()) + }) + }) +}) + +// +// Utility functions used by the generated test code +// + +func CreateMockByteArray(mockData string) *[]byte { + ba := make([]byte, 0) + ba = append(ba, mockData...) + return &ba +} + +func CreateMockUUID(mockData string) *strfmt.UUID { + uuid := strfmt.UUID(mockData) + return &uuid +} + +func CreateMockReader(mockData string) io.ReadCloser { + return ioutil.NopCloser(bytes.NewReader([]byte(mockData))) +} + +func CreateMockDate(mockData string) *strfmt.Date { + d, err := core.ParseDate(mockData) + if err != nil { + return nil + } + return &d +} + +func CreateMockDateTime(mockData string) *strfmt.DateTime { + d, err := core.ParseDateTime(mockData) + if err != nil { + return nil + } + return &d +} + +func SetTestEnvironment(testEnvironment map[string]string) { + for key, value := range testEnvironment { + os.Setenv(key, value) + } +} + +func ClearTestEnvironment(testEnvironment map[string]string) { + for key := range testEnvironment { + os.Unsetenv(key) + } +} diff --git a/go.mod b/go.mod index 8ce6d70775..f1e9911b83 100644 --- a/go.mod +++ b/go.mod @@ -58,3 +58,4 @@ require ( replace github.com/softlayer/softlayer-go v1.0.3 => github.com/IBM-Cloud/softlayer-go v1.0.5-tf replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt/jwt v3.2.1+incompatible +replace github.com/IBM/vpc-go-sdk v0.22.0 => ./common/github.com/IBM/vpc-go-sdk From 69681d4fbef88cacaef007264a088fbf023dfeee Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 25 Aug 2022 04:53:02 +0530 Subject: [PATCH 002/103] migration to test 24-08-2022 sdk version --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 308 ++++++++++++------ .../IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go | 153 ++++++++- 2 files changed, 353 insertions(+), 108 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index f5c751c992..a951fc2a51 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -4013,8 +4013,8 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up } // ListInstanceProfiles : List all instance profiles -// This request lists provisionable instance profiles in the region. An instance profile specifies the performance -// characteristics and pricing model for an instance. +// This request lists provisionable [instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the +// region. An instance profile specifies the performance characteristics and pricing model for an instance. func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { return vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) } @@ -8283,8 +8283,8 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat } // ListDedicatedHostProfiles : List all dedicated host profiles -// This request lists all provisionable dedicated host profiles in the region. A dedicated host profile specifies the -// hardware characteristics for a dedicated host. +// This request lists provisionable [dedicated host profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in +// the region. A dedicated host profile specifies the hardware characteristics for a dedicated host. func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { return vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) } @@ -9976,8 +9976,9 @@ func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePla } // ListBareMetalServerProfiles : List all bare metal server profiles -// This request lists all bare metal server profiles available in the region. A bare metal server profile specifies the -// performance characteristics and pricing model for a bare metal server. +// This request lists all [bare metal server +// profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) available in the region. A bare metal +// server profile specifies the performance characteristics and pricing model for a bare metal server. func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) } @@ -11554,8 +11555,8 @@ func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMe } // ListVolumeProfiles : List all volume profiles -// This request lists all volume profiles available in the region. A volume profile specifies the performance -// characteristics and pricing model for a volume. +// This request lists all [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available +// in the region. A volume profile specifies the performance characteristics and pricing model for a volume. func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { return vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) } @@ -22183,7 +22184,8 @@ type BareMetalServer struct { // Primary network interface. PrimaryNetworkInterface *NetworkInterfaceBareMetalServerContextReference `json:"primary_network_interface" validate:"required"` - // The profile this bare metal server uses. + // 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 bare metal server. @@ -22865,7 +22867,7 @@ type BareMetalServerNetworkInterface struct { // - A single floating IP can be assigned to the network interface. // // If `false`: - // - Packets are passed unmodified to/from the network interface, + // - Packets are passed unchanged to/from the network interface, // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. @@ -22919,8 +22921,7 @@ type BareMetalServerNetworkInterface struct { // The type of this bare metal server network interface. Type *string `json:"type" validate:"required"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be - // in the `allowed_vlans` array for one PCI type adapter per bare metal server. + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` // Indicates if the interface can float to any other server within the same @@ -23100,8 +23101,7 @@ type BareMetalServerNetworkInterfacePatch struct { // interface. If true, source IP spoofing is allowed on this interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be - // in the `allowed_vlans` array for one PCI type adapter per bare metal server. + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` // If `true`: @@ -23109,7 +23109,7 @@ type BareMetalServerNetworkInterfacePatch struct { // - A single floating IP can be assigned to the network interface. // // If `false`: - // - Packets are passed unmodified to/from the network interface, + // - Packets are passed unchanged to/from the network interface, // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. @@ -23167,7 +23167,7 @@ type BareMetalServerNetworkInterfacePrototype struct { // - A single floating IP can be assigned to the network interface. // // If `false`: - // - Packets are passed unmodified to/from the network interface, + // - Packets are passed unchanged to/from the network interface, // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. @@ -23204,8 +23204,7 @@ type BareMetalServerNetworkInterfacePrototype struct { // The associated subnet. Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be - // in the `allowed_vlans` array for one PCI type adapter per bare metal server. + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` // Indicates if the interface can float to any other server within the same @@ -23298,8 +23297,7 @@ type BareMetalServerPrimaryNetworkInterfacePrototype struct { // interface. If true, source IP spoofing is allowed on this interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be - // in the `allowed_vlans` array for one PCI type adapter per bare metal server. + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` // If `true`: @@ -23307,7 +23305,7 @@ type BareMetalServerPrimaryNetworkInterfacePrototype struct { // - A single floating IP can be assigned to the network interface. // // If `false`: - // - Packets are passed unmodified to/from the network interface, + // - Packets are passed unchanged to/from the network interface, // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. @@ -24846,7 +24844,8 @@ type CreateBareMetalServerOptions struct { // Primary network interface for the bare metal server. PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The profile to use for this bare metal server. + // 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 zone this bare metal server will reside in. @@ -26078,19 +26077,21 @@ type CreateLoadBalancerListenerOptions struct { // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` - // The certificate instance used for SSL termination. It is applicable only to `https` - // protocol. + // The certificate instance to use for SSL termination. The listener must have a + // `protocol` of `https`. CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` // The connection limit of the listener. ConnectionLimit *int64 `json:"connection_limit,omitempty"` - // The default pool for this listener. The specified pool must: - // - // - Belong to this load balancer + // The default pool for this listener. If specified, the pool must: + // - Belong to this load balancer. // - Have the same `protocol` as this listener, or have a compatible protocol. // At present, the compatible protocols are `http` and `https`. // - Not already be the `default_pool` for another listener. + // + // If unspecified, this listener will be created with no default pool, but one may be + // subsequently set. DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` // The target listener that requests will be redirected to. This listener must have a @@ -28078,7 +28079,8 @@ type DedicatedHost struct { // The unique user-defined name for this dedicated host. Name *string `json:"name" validate:"required"` - // The profile this dedicated host uses. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) for this + // dedicated host. Profile *DedicatedHostProfileReference `json:"profile" validate:"required"` // Indicates whether this dedicated host is available for instance creation. @@ -29614,7 +29616,8 @@ type DedicatedHostPrototype struct { // randomly-selected words. Name *string `json:"name,omitempty"` - // The profile to use for this dedicated host. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this + // dedicated host. Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` // The resource group to use. If unspecified, the account's [default resource @@ -37251,7 +37254,8 @@ type Instance struct { // Primary network interface. PrimaryNetworkInterface *NetworkInterfaceInstanceContextReference `json:"primary_network_interface" validate:"required"` - // The profile for this virtual server instance. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this virtual + // server instance. Profile *InstanceProfileReference `json:"profile" validate:"required"` // The resource group for this instance. @@ -38457,7 +38461,7 @@ type InstanceGroupManagerAction struct { // - `omitted`: Action was not applied because this action's manager was disabled. Status *string `json:"status" validate:"required"` - // The date and time that the instance group manager action was modified. + // The date and time that the instance group manager action was updated. UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` // The type of action for the instance group. @@ -41567,8 +41571,11 @@ type InstancePrototype struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will - // be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this + // virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change + // in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group to use. If unspecified, the account's [default resource @@ -41858,8 +41865,11 @@ type InstanceTemplate struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will - // be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this + // virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change + // in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group for this instance template. @@ -42186,8 +42196,11 @@ type InstanceTemplatePrototype struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will - // be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this + // virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change + // in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group to use. If unspecified, the account's [default resource @@ -46478,8 +46491,9 @@ type LoadBalancerListener struct { // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. AcceptProxyProtocol *bool `json:"accept_proxy_protocol" validate:"required"` - // The certificate instance used for SSL termination. It is applicable only to `https` - // protocol. + // The certificate instance used for SSL termination. + // + // If absent, this listener is not using a certificate instance. CertificateInstance *CertificateInstanceReference `json:"certificate_instance,omitempty"` // The connection limit of the listener. @@ -46494,7 +46508,7 @@ type LoadBalancerListener struct { // The listener's canonical URL. Href *string `json:"href" validate:"required"` - // If specified, the target listener that requests are redirected to. + // If present, the target listener that requests are redirected to. HTTPSRedirect *LoadBalancerListenerHTTPSRedirect `json:"https_redirect,omitempty"` // The unique identifier for this load balancer listener. @@ -46778,8 +46792,8 @@ type LoadBalancerListenerPatch struct { // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` - // The certificate instance used for SSL termination. It is applicable only to `https` - // protocol. + // The certificate instance to use for SSL termination. The listener must have a + // `protocol` of `https`. CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` // The connection limit of the listener. @@ -47760,17 +47774,27 @@ type LoadBalancerListenerPrototypeLoadBalancerContext struct { // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` + // The certificate instance to use for SSL termination. The listener must have a + // `protocol` of `https`. + CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` + // The connection limit of the listener. ConnectionLimit *int64 `json:"connection_limit,omitempty"` - // The default pool for this listener. If specified, the pool's protocol must match the - // listener's protocol, or the protocols must be compatible. At present, the compatible - // protocols are `http` and `https`. + // The default pool for this listener. If specified, the pool must: + // - Belong to this load balancer. + // - Have the same `protocol` as this listener, or have a compatible protocol. + // At present, the compatible protocols are `http` and `https`. + // - Not already be the `default_pool` for another listener. // // If unspecified, this listener will be created with no default pool, but one may be // subsequently set. DefaultPool *LoadBalancerPoolIdentityByName `json:"default_pool,omitempty"` + // The target listener that requests will be redirected to. This listener must have a + // `protocol` of `http`, and the target listener must have a `protocol` of `https`. + HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPrototype `json:"https_redirect,omitempty"` + // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must // have a unique `port` and `protocol` combination. // @@ -47797,20 +47821,32 @@ type LoadBalancerListenerPrototypeLoadBalancerContext struct { // same protocol. PortMin *int64 `json:"port_min,omitempty"` - // The listener protocol. + // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the - // unexpected property value was encountered. + // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http` and + // `https`. + // + // Additional restrictions: + // - If `default_pool` is set, the pool's protocol must match, or be compatible with + // the listener's protocol. At present, the compatible protocols are `http` and + // `https`. + // - If `https_redirect` is set, the protocol must be `http`. Protocol *string `json:"protocol" validate:"required"` } // Constants associated with the LoadBalancerListenerPrototypeLoadBalancerContext.Protocol property. -// The listener protocol. +// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the -// unexpected property value was encountered. +// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http` and +// `https`. +// +// Additional restrictions: +// - If `default_pool` is set, the pool's protocol must match, or be compatible with +// the listener's protocol. At present, the compatible protocols are `http` and +// `https`. +// - If `https_redirect` is set, the protocol must be `http`. const ( LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPConst = "http" LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPSConst = "https" @@ -47834,6 +47870,10 @@ func UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext(m map[string]json if err != nil { return } + err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) if err != nil { return @@ -47842,6 +47882,10 @@ func UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext(m map[string]json if err != nil { return } + err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPrototype) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { return @@ -61722,7 +61766,8 @@ type Volume struct { // created from an image, or the image did not include an operating system. OperatingSystem *OperatingSystemReference `json:"operating_system,omitempty"` - // The profile this volume uses. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) for + // this volume. Profile *VolumeProfileReference `json:"profile" validate:"required"` // The resource group for this volume. @@ -62191,9 +62236,13 @@ type VolumeAttachmentPrototypeVolume struct { // The unique user-defined name for this volume. Name *string `json:"name,omitempty"` - // The profile to use for this volume. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or // updating volumes may expand in the future. Capacity *int64 `json:"capacity,omitempty"` @@ -62242,6 +62291,10 @@ func UnmarshalVolumeAttachmentPrototypeVolume(m map[string]json.RawMessage, resu if err != nil { return } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { return @@ -62448,9 +62501,13 @@ type VolumeAttachmentVolumePrototypeInstanceContext struct { // The unique user-defined name for this volume. Name *string `json:"name,omitempty"` - // The profile to use for this volume. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or // updating volumes may expand in the future. Capacity *int64 `json:"capacity,omitempty"` @@ -62499,6 +62556,10 @@ func UnmarshalVolumeAttachmentVolumePrototypeInstanceContext(m map[string]json.R if err != nil { return } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { return @@ -62915,7 +62976,8 @@ type VolumePrototype struct { // The unique user-defined name for this volume. Name *string `json:"name,omitempty"` - // The profile to use for this volume. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` // The resource group to use. If unspecified, the account's [default resource @@ -63012,8 +63074,12 @@ type VolumePrototypeInstanceByImageContext struct { // The unique user-defined name for this volume. Name *string `json:"name,omitempty"` - // The profile to use for this volume. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` } // NewVolumePrototypeInstanceByImageContext : Instantiate VolumePrototypeInstanceByImageContext (Generic Model Constructor) @@ -63048,6 +63114,10 @@ func UnmarshalVolumePrototypeInstanceByImageContext(m map[string]json.RawMessage if err != nil { return } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -63072,11 +63142,15 @@ type VolumePrototypeInstanceBySourceSnapshotContext struct { // The unique user-defined name for this volume. Name *string `json:"name,omitempty"` - // The profile to use for this volume. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` // The snapshot from which to clone the volume. SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` } // NewVolumePrototypeInstanceBySourceSnapshotContext : Instantiate VolumePrototypeInstanceBySourceSnapshotContext (Generic Model Constructor) @@ -63116,6 +63190,10 @@ func UnmarshalVolumePrototypeInstanceBySourceSnapshotContext(m map[string]json.R if err != nil { return } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -63464,7 +63542,7 @@ type BareMetalServerNetworkInterfaceByPci struct { // - A single floating IP can be assigned to the network interface. // // If `false`: - // - Packets are passed unmodified to/from the network interface, + // - Packets are passed unchanged to/from the network interface, // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. @@ -63505,8 +63583,7 @@ type BareMetalServerNetworkInterfaceByPci struct { // The type of this bare metal server network interface. Type *string `json:"type" validate:"required"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be - // in the `allowed_vlans` array for one PCI type adapter per bare metal server. + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` // - `pci`: a physical PCI device which can only be created or deleted when the bare metal @@ -63643,7 +63720,7 @@ type BareMetalServerNetworkInterfaceByVlan struct { // - A single floating IP can be assigned to the network interface. // // If `false`: - // - Packets are passed unmodified to/from the network interface, + // - Packets are passed unchanged to/from the network interface, // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. @@ -63827,7 +63904,7 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc // - A single floating IP can be assigned to the network interface. // // If `false`: - // - Packets are passed unmodified to/from the network interface, + // - Packets are passed unchanged to/from the network interface, // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. @@ -63850,8 +63927,7 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc // The associated subnet. Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be - // in the `allowed_vlans` array for one PCI type adapter per bare metal server. + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` // - `pci`: a physical PCI device which can only be created or deleted when the bare metal @@ -63937,7 +64013,7 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // - A single floating IP can be assigned to the network interface. // // If `false`: - // - Packets are passed unmodified to/from the network interface, + // - Packets are passed unchanged to/from the network interface, // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. @@ -65758,7 +65834,7 @@ type DedicatedHostPrototypeDedicatedHostByGroup struct { // randomly-selected words. Name *string `json:"name,omitempty"` - // The profile to use for this dedicated host. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this dedicated host. Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -65818,7 +65894,7 @@ type DedicatedHostPrototypeDedicatedHostByZone struct { // randomly-selected words. Name *string `json:"name,omitempty"` - // The profile to use for this dedicated host. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this dedicated host. Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -67269,7 +67345,7 @@ type InstanceGroupManagerActionScheduledAction struct { // - `omitted`: Action was not applied because this action's manager was disabled. Status *string `json:"status" validate:"required"` - // The date and time that the instance group manager action was modified. + // The date and time that the instance group manager action was updated. UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` // The type of action for the instance group. @@ -69941,8 +70017,8 @@ type InstancePrototypeInstanceByImage struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will be used, but this default value - // is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -70103,8 +70179,8 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will be used, but this default value - // is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -70258,8 +70334,8 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will be used, but this default value - // is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -70518,8 +70594,8 @@ type InstanceTemplatePrototypeInstanceByImage struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will be used, but this default value - // is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -70680,8 +70756,8 @@ type InstanceTemplatePrototypeInstanceBySourceTemplate struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will be used, but this default value - // is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -70858,8 +70934,8 @@ type InstanceTemplateInstanceByImage struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will be used, but this default value - // is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group for this instance template. @@ -71037,8 +71113,8 @@ type InstanceTemplateInstanceBySourceSnapshot struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The profile to use for this virtual server instance. If unspecified, `bx2-2x8` will be used, but this default value - // is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group for this instance template. @@ -78535,9 +78611,13 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { // The unique user-defined name for this volume. Name *string `json:"name,omitempty"` - // The profile to use for this volume. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or // updating volumes may expand in the future. Capacity *int64 `json:"capacity,omitempty"` @@ -78579,6 +78659,10 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext(m ma if err != nil { return } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { return @@ -78657,9 +78741,13 @@ type VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContex // The unique user-defined name for this volume. Name *string `json:"name,omitempty"` - // The profile to use for this volume. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or // updating volumes may expand in the future. Capacity *int64 `json:"capacity,omitempty"` @@ -78701,6 +78789,10 @@ func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInsta if err != nil { return } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { return @@ -78882,7 +78974,7 @@ type VolumePrototypeVolumeByCapacity struct { // The unique user-defined name for this volume. Name *string `json:"name,omitempty"` - // The profile to use for this volume. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -78967,7 +79059,7 @@ type VolumePrototypeVolumeBySourceSnapshot struct { // The unique user-defined name for this volume. Name *string `json:"name,omitempty"` - // The profile to use for this volume. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -79822,7 +79914,7 @@ type InstanceGroupManagerActionScheduledActionGroupTarget struct { // - `omitted`: Action was not applied because this action's manager was disabled. Status *string `json:"status" validate:"required"` - // The date and time that the instance group manager action was modified. + // The date and time that the instance group manager action was updated. UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` // The type of action for the instance group. @@ -79976,7 +80068,7 @@ type InstanceGroupManagerActionScheduledActionManagerTarget struct { // - `omitted`: Action was not applied because this action's manager was disabled. Status *string `json:"status" validate:"required"` - // The date and time that the instance group manager action was modified. + // The date and time that the instance group manager action was updated. UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` // The type of action for the instance group. @@ -81672,9 +81764,12 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototyp // The unique user-defined name for this volume. Name *string `json:"name,omitempty"` - // The profile to use for this volume. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or // updating volumes may expand in the future. Capacity *int64 `json:"capacity" validate:"required"` @@ -81718,6 +81813,10 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolum if err != nil { return } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { return @@ -81740,9 +81839,12 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototyp // The unique user-defined name for this volume. Name *string `json:"name,omitempty"` - // The profile to use for this volume. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's // `minimum_capacity`. The maximum value may increase in the future. // @@ -81791,6 +81893,10 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolum if err != nil { return } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { return @@ -81922,9 +82028,12 @@ type VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContex // The unique user-defined name for this volume. Name *string `json:"name,omitempty"` - // The profile to use for this volume. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or // updating volumes may expand in the future. Capacity *int64 `json:"capacity" validate:"required"` @@ -81968,6 +82077,10 @@ func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInsta if err != nil { return } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { return @@ -81990,9 +82103,12 @@ type VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContex // The unique user-defined name for this volume. Name *string `json:"name,omitempty"` - // The profile to use for this volume. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's // `minimum_capacity`. The maximum value may increase in the future. // @@ -82041,6 +82157,10 @@ func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInsta if err != nil { return } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { return diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go index 5183208531..485a990d72 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2022. + * (C) Copyright IBM Corp. 2020, 2021, 2022. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14460,7 +14460,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}], "total_count": 132}`) + 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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListInstanceTemplates successfully with retries`, func() { @@ -14516,7 +14516,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}], "total_count": 132}`) + 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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListInstanceTemplates successfully`, func() { @@ -14716,6 +14716,7 @@ var _ = Describe(`VpcV1`, func() { volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) @@ -14809,7 +14810,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) })) }) It(`Invoke CreateInstanceTemplate successfully with retries`, func() { @@ -14906,6 +14907,7 @@ var _ = Describe(`VpcV1`, func() { volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) @@ -15001,7 +15003,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) })) }) It(`Invoke CreateInstanceTemplate successfully`, func() { @@ -15103,6 +15105,7 @@ var _ = Describe(`VpcV1`, func() { volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) @@ -15243,6 +15246,7 @@ var _ = Describe(`VpcV1`, func() { volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) @@ -15404,6 +15408,7 @@ var _ = Describe(`VpcV1`, func() { volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) @@ -15599,7 +15604,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) })) }) It(`Invoke GetInstanceTemplate successfully with retries`, func() { @@ -15656,7 +15661,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) })) }) It(`Invoke GetInstanceTemplate successfully`, func() { @@ -15847,7 +15852,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) })) }) It(`Invoke UpdateInstanceTemplate successfully with retries`, func() { @@ -15927,7 +15932,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) })) }) It(`Invoke UpdateInstanceTemplate successfully`, func() { @@ -16488,6 +16493,7 @@ var _ = Describe(`VpcV1`, func() { volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel + volumeAttachmentVolumePrototypeInstanceContextModel.UserTags = []string{"testString"} volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel @@ -16508,6 +16514,7 @@ var _ = Describe(`VpcV1`, func() { volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) @@ -16682,6 +16689,7 @@ var _ = Describe(`VpcV1`, func() { volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel + volumeAttachmentVolumePrototypeInstanceContextModel.UserTags = []string{"testString"} volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel @@ -16702,6 +16710,7 @@ var _ = Describe(`VpcV1`, func() { volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) @@ -16883,6 +16892,7 @@ var _ = Describe(`VpcV1`, func() { volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel + volumeAttachmentVolumePrototypeInstanceContextModel.UserTags = []string{"testString"} volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel @@ -16903,6 +16913,7 @@ var _ = Describe(`VpcV1`, func() { volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) @@ -17027,6 +17038,7 @@ var _ = Describe(`VpcV1`, func() { volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel + volumeAttachmentVolumePrototypeInstanceContextModel.UserTags = []string{"testString"} volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel @@ -17047,6 +17059,7 @@ var _ = Describe(`VpcV1`, func() { volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) @@ -17192,6 +17205,7 @@ var _ = Describe(`VpcV1`, func() { volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel + volumeAttachmentVolumePrototypeInstanceContextModel.UserTags = []string{"testString"} volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel @@ -17212,6 +17226,7 @@ var _ = Describe(`VpcV1`, func() { volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) @@ -30034,7 +30049,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the DedicatedHostGroupPatch model dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-modified") + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -30112,7 +30127,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the DedicatedHostGroupPatch model dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-modified") + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -30197,7 +30212,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the DedicatedHostGroupPatch model dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-modified") + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -30225,7 +30240,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the DedicatedHostGroupPatch model dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-modified") + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -30274,7 +30289,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the DedicatedHostGroupPatch model dedicatedHostGroupPatchModel := new(vpcv1.DedicatedHostGroupPatch) - dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-modified") + dedicatedHostGroupPatchModel.Name = core.StringPtr("my-host-group-updated") dedicatedHostGroupPatchModelAsPatch, asPatchErr := dedicatedHostGroupPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -64963,15 +64978,31 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + // Construct an instance of the LoadBalancerPoolIdentityByName model loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model + loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) + loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") + // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance = certificateInstanceIdentityModel loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel + loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) @@ -65115,15 +65146,31 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + // Construct an instance of the LoadBalancerPoolIdentityByName model loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model + loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) + loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") + // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance = certificateInstanceIdentityModel loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel + loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) @@ -65274,15 +65321,31 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + // Construct an instance of the LoadBalancerPoolIdentityByName model loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model + loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) + loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") + // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance = certificateInstanceIdentityModel loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel + loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) @@ -65376,15 +65439,31 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + // Construct an instance of the LoadBalancerPoolIdentityByName model loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model + loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) + loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") + // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance = certificateInstanceIdentityModel loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel + loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) @@ -65499,15 +65578,31 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + // Construct an instance of the LoadBalancerPoolIdentityByName model loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model + loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) + loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") + // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance = certificateInstanceIdentityModel loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel + loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) @@ -77465,11 +77560,13 @@ var _ = Describe(`VpcV1`, func() { volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} Expect(volumePrototypeInstanceByImageContextModel.Capacity).To(Equal(core.Int64Ptr(int64(250)))) Expect(volumePrototypeInstanceByImageContextModel.EncryptionKey).To(Equal(encryptionKeyIdentityModel)) Expect(volumePrototypeInstanceByImageContextModel.Iops).To(Equal(core.Int64Ptr(int64(10000)))) Expect(volumePrototypeInstanceByImageContextModel.Name).To(Equal(core.StringPtr("my-volume"))) Expect(volumePrototypeInstanceByImageContextModel.Profile).To(Equal(volumeProfileIdentityModel)) + Expect(volumePrototypeInstanceByImageContextModel.UserTags).To(Equal([]string{"testString"})) // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) @@ -77669,11 +77766,13 @@ var _ = Describe(`VpcV1`, func() { volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel + volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} Expect(volumePrototypeInstanceByImageContextModel.Capacity).To(Equal(core.Int64Ptr(int64(250)))) Expect(volumePrototypeInstanceByImageContextModel.EncryptionKey).To(Equal(encryptionKeyIdentityModel)) Expect(volumePrototypeInstanceByImageContextModel.Iops).To(Equal(core.Int64Ptr(int64(10000)))) Expect(volumePrototypeInstanceByImageContextModel.Name).To(Equal(core.StringPtr("my-volume"))) Expect(volumePrototypeInstanceByImageContextModel.Profile).To(Equal(volumeProfileIdentityModel)) + Expect(volumePrototypeInstanceByImageContextModel.UserTags).To(Equal([]string{"testString"})) // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) @@ -77985,25 +78084,51 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + Expect(certificateInstanceIdentityModel).ToNot(BeNil()) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + Expect(certificateInstanceIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"))) + // Construct an instance of the LoadBalancerPoolIdentityByName model loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) Expect(loadBalancerPoolIdentityByNameModel).ToNot(BeNil()) loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") Expect(loadBalancerPoolIdentityByNameModel.Name).To(Equal(core.StringPtr("my-load-balancer-pool"))) + // Construct an instance of the LoadBalancerListenerIdentityByID model + loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) + Expect(loadBalancerListenerIdentityModel).ToNot(BeNil()) + loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + Expect(loadBalancerListenerIdentityModel.ID).To(Equal(core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004"))) + + // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model + loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) + Expect(loadBalancerListenerHTTPSRedirectPrototypeModel).ToNot(BeNil()) + loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) + loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel + loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") + Expect(loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode).To(Equal(core.Int64Ptr(int64(301)))) + Expect(loadBalancerListenerHTTPSRedirectPrototypeModel.Listener).To(Equal(loadBalancerListenerIdentityModel)) + Expect(loadBalancerListenerHTTPSRedirectPrototypeModel.URI).To(Equal(core.StringPtr("/example?doc=get"))) + // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) Expect(loadBalancerListenerPrototypeLoadBalancerContextModel).ToNot(BeNil()) loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) + loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance = certificateInstanceIdentityModel loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel + loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol).To(Equal(core.BoolPtr(true))) + Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance).To(Equal(certificateInstanceIdentityModel)) Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit).To(Equal(core.Int64Ptr(int64(2000)))) Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool).To(Equal(loadBalancerPoolIdentityByNameModel)) + Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect).To(Equal(loadBalancerListenerHTTPSRedirectPrototypeModel)) Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.Port).To(Equal(core.Int64Ptr(int64(443)))) Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax).To(Equal(core.Int64Ptr(int64(499)))) Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin).To(Equal(core.Int64Ptr(int64(443)))) From 03396f8a0ea60feabd4d3ef7757d87b4863a8354 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 14 Sep 2022 09:49:51 +0530 Subject: [PATCH 003/103] sdk update --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 793 ++++++++++++++---- .../IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go | 561 ++++++++++++- 2 files changed, 1206 insertions(+), 148 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index a951fc2a51..19820ea62b 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -11140,6 +11140,136 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } +// ListBareMetalServerNetworkInterfaceIps : List all reserved IPs bound to a network interface +// This request lists all reserved IPs bound to a network interface. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) +} + +// ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceIpsOptions.NetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerNetworkInterfaceIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceIps") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionNetworkInterfaceContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerNetworkInterfaceIP : Retrieve bound reserved IP +// This request a retrieves the specified reserved IP address if it is bound to the network interface and bare metal +// server specified in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) +} + +// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + // DeleteBareMetalServer : Delete a bare metal server // This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the // bare metal server's network interfaces are implicitly disassociated. @@ -18104,6 +18234,9 @@ func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadB 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)) @@ -18222,6 +18355,9 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB } 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)) @@ -24862,8 +24998,10 @@ type CreateBareMetalServerOptions struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The VPC the bare metal server is to be a part of. If specified, it must match the - // VPC referenced by the subnets of the server's network interfaces. + // The VPC this bare metal server will reside in. + // + // If specified, it must match the VPC for the subnets of the server's network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // Allows users to set headers on API requests @@ -25039,7 +25177,7 @@ type CreateEndpointGatewayOptions struct { // The target for this endpoint gateway. Target EndpointGatewayTargetPrototypeIntf `json:"target" validate:"required"` - // The VPC this endpoint gateway will serve. + // The VPC this endpoint gateway will reside in. VPC VPCIdentityIntf `json:"vpc" validate:"required"` // The reserved IPs to bind to this endpoint gateway. At most one reserved IP per zone is allowed. @@ -25596,20 +25734,23 @@ type CreateInstanceGroupOptions struct { // The subnets to use when creating new instances. Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` - // Required if specifying a load balancer pool only. Used by the instance group when scaling up instances to supply the - // port for the load balancer pool member. + // The port to use for new load balancer pool members created by this instance group. + // + // This property must be specified if and only if `load_balancer_pool` has been specified. ApplicationPort *int64 `json:"application_port,omitempty"` - // The load balancer associated with the specified load balancer pool. - // Required if `load_balancer_pool` is specified. + // The load balancer associated with `load_balancer_pool`. + // + // This property must be specified if and only if `load_balancer_pool` has been + // specified. // // At present, only load balancers in the `application` family are supported. LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` - // If specified, the load balancer pool will be managed by this - // group. Instances created by this group will have a new load - // balancer pool member in that pool created. Must be used with - // `application_port`. + // If specified, the load balancer pool this instance group will manage. A pool member + // will be created for each instance created by this group. + // + // If specified, `load_balancer` and `application_port` must also be specified. LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"` // The number of instances in the instance group. @@ -26460,8 +26601,8 @@ type CreateLoadBalancerOptions struct { // At present, if route mode is enabled, the load balancer must not be public. IsPublic *bool `json:"is_public" validate:"required"` - // The subnets to provision this load balancer in. The load balancer's availability will depend on the availability of - // the zones the specified subnets reside in. + // The subnets to provision this load balancer in. The subnets must be in the same VPC. The load balancer's + // availability will depend on the availability of the zones that the subnets reside in. // // Load balancers in the `network` family allow only one subnet to be specified. Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` @@ -26926,7 +27067,7 @@ func (options *CreatePlacementGroupOptions) SetHeaders(param map[string]string) // CreatePublicGatewayOptions : The CreatePublicGateway options. type CreatePublicGatewayOptions struct { - // The VPC this public gateway will serve. + // The VPC this public gateway will reside in. VPC VPCIdentityIntf `json:"vpc" validate:"required"` // The zone this public gateway will reside in. @@ -26992,7 +27133,7 @@ func (options *CreatePublicGatewayOptions) SetHeaders(param map[string]string) * // CreateSecurityGroupOptions : The CreateSecurityGroup options. type CreateSecurityGroupOptions struct { - // The VPC this security group is to be a part of. + // The VPC this security group will reside in. VPC VPCIdentityIntf `json:"vpc" validate:"required"` // The user-defined name for this security group. If unspecified, the name will be a hyphenated list of @@ -27199,8 +27340,12 @@ type CreateSubnetReservedIPOptions struct { // for provider-owned resources. Name *string `json:"name,omitempty"` - // The target this reserved IP is to be bound to. The target must be an endpoint gateway not - // already bound to a reserved IP in the subnet's zone. + // The target to bind this reserved IP to. The target must be in the same VPC. + // + // At present, only endpoint gateway targets are supported. The endpoint gateway must + // not be already bound to a reserved IP in the subnet's zone. + // + // If unspecified, the reserved IP will be created unbound. Target ReservedIPTargetPrototypeIntf `json:"target,omitempty"` // Allows users to set headers on API requests @@ -29776,7 +29921,7 @@ type DefaultNetworkACL struct { // The subnets to which this network ACL is attached. Subnets []SubnetReference `json:"subnets" validate:"required"` - // The VPC this network ACL is a part of. + // The VPC this network ACL resides in. VPC *VPCReference `json:"vpc" validate:"required"` } @@ -29994,7 +30139,7 @@ type DefaultSecurityGroup struct { // The targets for this security group. Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` - // The VPC this security group is a part of. + // The VPC this security group resides in. VPC *VPCReference `json:"vpc" validate:"required"` } @@ -30980,6 +31125,9 @@ type DeleteLoadBalancerOptions struct { // The load balancer 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 } @@ -30997,6 +31145,12 @@ func (_options *DeleteLoadBalancerOptions) SetID(id string) *DeleteLoadBalancerO return _options } +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteLoadBalancerOptions) SetIfMatch(ifMatch string) *DeleteLoadBalancerOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + // SetHeaders : Allow user to set Headers func (options *DeleteLoadBalancerOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerOptions { options.Headers = param @@ -31997,7 +32151,7 @@ type EndpointGateway struct { // The target for this endpoint gateway. Target EndpointGatewayTargetIntf `json:"target" validate:"required"` - // The VPC this endpoint gateway is serving. + // The VPC this endpoint gateway resides in. VPC *VPCReference `json:"vpc" validate:"required"` } @@ -32953,7 +33107,7 @@ type FlowLogCollector struct { // target that are themselves the target of a more specific flow log collector. Target FlowLogCollectorTargetIntf `json:"target" validate:"required"` - // The VPC this flow log collector is associated with. + // The VPC this flow log collector resides in. VPC *VPCReference `json:"vpc" validate:"required"` } @@ -33469,6 +33623,54 @@ func (options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(p return options } +// GetBareMetalServerNetworkInterfaceIPOptions : The GetBareMetalServerNetworkInterfaceIP options. +type GetBareMetalServerNetworkInterfaceIPOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The network interface identifier. + NetworkInterfaceID *string `json:"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 +} + +// NewGetBareMetalServerNetworkInterfaceIPOptions : Instantiate GetBareMetalServerNetworkInterfaceIPOptions +func (*VpcV1) NewGetBareMetalServerNetworkInterfaceIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *GetBareMetalServerNetworkInterfaceIPOptions { + return &GetBareMetalServerNetworkInterfaceIPOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceIPOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetBareMetalServerNetworkInterfaceIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceIPOptions { + options.Headers = param + return options +} + // GetBareMetalServerNetworkInterfaceOptions : The GetBareMetalServerNetworkInterface options. type GetBareMetalServerNetworkInterfaceOptions struct { // The bare metal server identifier. @@ -38080,8 +38282,9 @@ func UnmarshalInstanceGpu(m map[string]json.RawMessage, result interface{}) (err // InstanceGroup : InstanceGroup struct type InstanceGroup struct { - // Required if specifying a load balancer pool only. Used by the instance group when scaling up instances to supply the - // port for the load balancer pool member. + // The port used for new load balancer pool members created by this instance group. + // + // This property will be present if and only if `load_balancer_pool` is present. ApplicationPort *int64 `json:"application_port,omitempty"` // The date and time that the instance group was created. @@ -38099,9 +38302,8 @@ type InstanceGroup struct { // The template used to create new instances for this group. InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` - // The load balancer pool managed by this group. Instances created - // by this group will have a new load balancer pool member in that - // pool created. + // If present, the load balancer pool this instance group manages. A pool member will + // be created for each instance created by this group. LoadBalancerPool *LoadBalancerPoolReference `json:"load_balancer_pool,omitempty"` // The managers for the instance group. @@ -39911,8 +40113,9 @@ func (instanceGroupMembershipPatch *InstanceGroupMembershipPatch) AsPatch() (_pa // InstanceGroupPatch : To add or update load balancer specification for an instance group the `membership_count` must first be set to 0. type InstanceGroupPatch struct { - // Required if specifying a load balancer pool only. Used by the instance group when scaling up instances to supply the - // port for the load balancer pool member. + // The port to use for new load balancer pool members created by this instance group. + // + // This property must be set if and only if `load_balancer_pool` has been set. ApplicationPort *int64 `json:"application_port,omitempty"` // Instance template to use when creating new instances. @@ -39921,16 +40124,18 @@ type InstanceGroupPatch struct { // `default_trusted_profile.auto_link`. InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template,omitempty"` - // The load balancer associated with the specified load balancer pool. - // Required if `load_balancer_pool` is specified. + // The load balancer associated with `load_balancer_pool`. + // + // This property must be specified if and only if `load_balancer_pool` has been + // specified. // // At present, only load balancers in the `application` family are supported. LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` - // If specified, the load balancer pool will be managed by this - // group. Instances created by this group will have a new load - // balancer pool member in that pool created. Must be used with - // `application_port`. + // If specified, the load balancer pool this instance group will manage. A pool member + // will be created for each instance created by this group. + // + // If specified, `load_balancer` and `application_port` must also be specified. LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"` // The number of instances in the instance group. @@ -41594,8 +41799,10 @@ type InstancePrototype struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` - // The VPC the virtual server instance is to be a part of. If specified, it must match - // the VPC referenced by the subnets of the instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance's network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -41887,8 +42094,10 @@ type InstanceTemplate struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` - // The VPC the virtual server instance is to be a part of. If specified, it must match - // the VPC referenced by the subnets of the instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance's network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -42157,6 +42366,7 @@ func (instanceTemplatePatch *InstanceTemplatePatch) AsPatch() (_patch map[string // Models which "extend" this model: // - InstanceTemplatePrototypeInstanceByImage // - InstanceTemplatePrototypeInstanceBySourceTemplate +// - InstanceTemplatePrototypeInstanceBySourceSnapshot type InstanceTemplatePrototype struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` @@ -42219,8 +42429,10 @@ type InstanceTemplatePrototype struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` - // The VPC the virtual server instance is to be a part of. If specified, it must match - // the VPC referenced by the subnets of the instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance's network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -42991,6 +43203,44 @@ func (options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetHeaders return options } +// ListBareMetalServerNetworkInterfaceIpsOptions : The ListBareMetalServerNetworkInterfaceIps options. +type ListBareMetalServerNetworkInterfaceIpsOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The network interface identifier. + NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBareMetalServerNetworkInterfaceIpsOptions : Instantiate ListBareMetalServerNetworkInterfaceIpsOptions +func (*VpcV1) NewListBareMetalServerNetworkInterfaceIpsOptions(bareMetalServerID string, networkInterfaceID string) *ListBareMetalServerNetworkInterfaceIpsOptions { + return &ListBareMetalServerNetworkInterfaceIpsOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerNetworkInterfaceIpsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfaceIpsOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *ListBareMetalServerNetworkInterfaceIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListBareMetalServerNetworkInterfaceIpsOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfaceIpsOptions { + options.Headers = param + return options +} + // ListBareMetalServerNetworkInterfacesOptions : The ListBareMetalServerNetworkInterfaces options. type ListBareMetalServerNetworkInterfacesOptions struct { // The bare metal server identifier. @@ -46183,9 +46433,16 @@ type LoadBalancer struct { // - `create_pending`: The load balancer is being created. // - `delete_pending`: The load balancer is being deleted. // - `maintenance_pending`: The load balancer is unavailable due to an internal - // error (contact IBM support). + // error (contact IBM support). + // - `migrate_pending`: The load balancer is migrating to the requested configuration. + // Performance may be degraded. // - `update_pending`: The load balancer is being updated - // to the requested configuration. + // to the requested configuration. + // + // The enumerated values for this property are expected to expand in the future. When + // processing this property, check for and log unknown values. Optionally halt + // processing and surface the error, or bypass the load balancer on which the + // unexpected property value was encountered. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The public IP addresses assigned to this load balancer. @@ -46212,7 +46469,10 @@ type LoadBalancer struct { // Indicates whether this load balancer supports security groups. SecurityGroupsSupported *bool `json:"security_groups_supported" validate:"required"` - // The subnets this load balancer is part of. + // The subnets this load balancer is provisioned in. The load balancer's availability depends on the availability of + // the zones that the subnets reside in. + // + // All subnets will be in the same VPC. Subnets []SubnetReference `json:"subnets" validate:"required"` // Indicates whether this load balancer supports UDP. @@ -46233,15 +46493,23 @@ const ( // - `create_pending`: The load balancer is being created. // - `delete_pending`: The load balancer is being deleted. // - `maintenance_pending`: The load balancer is unavailable due to an internal -// error (contact IBM support). +// error (contact IBM support). +// - `migrate_pending`: The load balancer is migrating to the requested configuration. +// Performance may be degraded. // - `update_pending`: The load balancer is being updated -// to the requested configuration. +// to the requested configuration. +// +// The enumerated values for this property are expected to expand in the future. When +// processing this property, check for and log unknown values. Optionally halt +// processing and surface the error, or bypass the load balancer on which the +// unexpected property value was encountered. const ( LoadBalancerProvisioningStatusActiveConst = "active" LoadBalancerProvisioningStatusCreatePendingConst = "create_pending" LoadBalancerProvisioningStatusDeletePendingConst = "delete_pending" LoadBalancerProvisioningStatusFailedConst = "failed" LoadBalancerProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerProvisioningStatusMigratePendingConst = "migrate_pending" LoadBalancerProvisioningStatusUpdatePendingConst = "update_pending" ) @@ -46537,7 +46805,11 @@ type LoadBalancerListener struct { // unexpected property value was encountered. Protocol *string `json:"protocol" validate:"required"` - // The provisioning status of this listener. + // The provisioning status of this listener + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the + // unexpected property value was encountered. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` } @@ -46555,14 +46827,17 @@ const ( ) // Constants associated with the LoadBalancerListener.ProvisioningStatus property. -// The provisioning status of this listener. +// The provisioning status of this listener +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the +// unexpected property value was encountered. const ( - LoadBalancerListenerProvisioningStatusActiveConst = "active" - LoadBalancerListenerProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerListenerProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerListenerProvisioningStatusFailedConst = "failed" - LoadBalancerListenerProvisioningStatusMaintenancePendingConst = "maintenance_pending" - LoadBalancerListenerProvisioningStatusUpdatePendingConst = "update_pending" + LoadBalancerListenerProvisioningStatusActiveConst = "active" + LoadBalancerListenerProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerProvisioningStatusFailedConst = "failed" + LoadBalancerListenerProvisioningStatusUpdatePendingConst = "update_pending" ) // UnmarshalLoadBalancerListener unmarshals an instance of LoadBalancerListener from the specified map of raw messages. @@ -46951,7 +47226,11 @@ type LoadBalancerListenerPolicy struct { // Priority of the policy. Lower value indicates higher priority. Priority *int64 `json:"priority" validate:"required"` - // The provisioning status of this policy. + // The provisioning status of this policy + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the + // unexpected property value was encountered. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The rules for this policy. @@ -46977,14 +47256,17 @@ const ( ) // Constants associated with the LoadBalancerListenerPolicy.ProvisioningStatus property. -// The provisioning status of this policy. +// The provisioning status of this policy +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the +// unexpected property value was encountered. const ( - LoadBalancerListenerPolicyProvisioningStatusActiveConst = "active" - LoadBalancerListenerPolicyProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerListenerPolicyProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerListenerPolicyProvisioningStatusFailedConst = "failed" - LoadBalancerListenerPolicyProvisioningStatusMaintenancePendingConst = "maintenance_pending" - LoadBalancerListenerPolicyProvisioningStatusUpdatePendingConst = "update_pending" + LoadBalancerListenerPolicyProvisioningStatusActiveConst = "active" + LoadBalancerListenerPolicyProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerPolicyProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerPolicyProvisioningStatusFailedConst = "failed" + LoadBalancerListenerPolicyProvisioningStatusUpdatePendingConst = "update_pending" ) // UnmarshalLoadBalancerListenerPolicy unmarshals an instance of LoadBalancerListenerPolicy from the specified map of raw messages. @@ -47240,7 +47522,11 @@ type LoadBalancerListenerPolicyRule struct { // The rule's unique identifier. ID *string `json:"id" validate:"required"` - // The provisioning status of this rule. + // The provisioning status of this rule + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the rule on which the + // unexpected property value was encountered. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The type of the rule. @@ -47263,14 +47549,17 @@ const ( ) // Constants associated with the LoadBalancerListenerPolicyRule.ProvisioningStatus property. -// The provisioning status of this rule. +// The provisioning status of this rule +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the rule on which the +// unexpected property value was encountered. const ( - LoadBalancerListenerPolicyRuleProvisioningStatusActiveConst = "active" - LoadBalancerListenerPolicyRuleProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerListenerPolicyRuleProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerListenerPolicyRuleProvisioningStatusFailedConst = "failed" - LoadBalancerListenerPolicyRuleProvisioningStatusMaintenancePendingConst = "maintenance_pending" - LoadBalancerListenerPolicyRuleProvisioningStatusUpdatePendingConst = "update_pending" + LoadBalancerListenerPolicyRuleProvisioningStatusActiveConst = "active" + LoadBalancerListenerPolicyRuleProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerPolicyRuleProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerPolicyRuleProvisioningStatusFailedConst = "failed" + LoadBalancerListenerPolicyRuleProvisioningStatusUpdatePendingConst = "update_pending" ) // Constants associated with the LoadBalancerListenerPolicyRule.Type property. @@ -48008,6 +48297,15 @@ type LoadBalancerPatch struct { // The unique user-defined name for this load balancer. Name *string `json:"name,omitempty"` + + // The subnets to provision this load balancer in. The load balancer's availability will depend on the availability of + // the zones that the subnets reside in. + // + // The specified subnets must be in the same VPC as the existing subnets, and will completely replace the existing + // subnets. + // + // The load balancer must be in the `application` family. + Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` } // UnmarshalLoadBalancerPatch unmarshals an instance of LoadBalancerPatch from the specified map of raw messages. @@ -48021,6 +48319,10 @@ func UnmarshalLoadBalancerPatch(m map[string]json.RawMessage, result interface{} if err != nil { return } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -48068,7 +48370,11 @@ type LoadBalancerPool struct { // unexpected property value was encountered. Protocol *string `json:"protocol" validate:"required"` - // The provisioning status of this pool. + // The provisioning status of this pool + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the + // unexpected property value was encountered. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The PROXY protocol setting for this pool: @@ -48110,14 +48416,17 @@ const ( ) // Constants associated with the LoadBalancerPool.ProvisioningStatus property. -// The provisioning status of this pool. +// The provisioning status of this pool +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the +// unexpected property value was encountered. const ( - LoadBalancerPoolProvisioningStatusActiveConst = "active" - LoadBalancerPoolProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerPoolProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerPoolProvisioningStatusFailedConst = "failed" - LoadBalancerPoolProvisioningStatusMaintenancePendingConst = "maintenance_pending" - LoadBalancerPoolProvisioningStatusUpdatePendingConst = "update_pending" + LoadBalancerPoolProvisioningStatusActiveConst = "active" + LoadBalancerPoolProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerPoolProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerPoolProvisioningStatusFailedConst = "failed" + LoadBalancerPoolProvisioningStatusUpdatePendingConst = "update_pending" ) // Constants associated with the LoadBalancerPool.ProxyProtocol property. @@ -48207,33 +48516,35 @@ func UnmarshalLoadBalancerPoolCollection(m map[string]json.RawMessage, result in // LoadBalancerPoolHealthMonitor : LoadBalancerPoolHealthMonitor struct type LoadBalancerPoolHealthMonitor struct { - // The health check interval in seconds. Interval must be greater than timeout value. + // The seconds to wait between health checks. Delay *int64 `json:"delay" validate:"required"` // The health check max retries. MaxRetries *int64 `json:"max_retries" validate:"required"` - // The health check port number. If specified, this overrides the ports specified in the server member resources. + // The health check port. + // + // If present, this overrides the pool member port values. Port *int64 `json:"port,omitempty"` - // The health check timeout in seconds. + // The seconds to wait for a response to a health check. Timeout *int64 `json:"timeout" validate:"required"` - // The protocol type of this load balancer pool health monitor. + // The protocol type to use for health checks. // // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which // the unexpected property value was encountered. Type *string `json:"type" validate:"required"` - // The health check URL path. Applicable only if the health monitor `type` is `http` or - // `https`. This value must be in the format of an [origin-form request - // target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + // The health check URL path. Applicable when `type` is `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"` } // Constants associated with the LoadBalancerPoolHealthMonitor.Type property. -// The protocol type of this load balancer pool health monitor. +// The protocol type to use for health checks. // // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which @@ -48277,30 +48588,33 @@ func UnmarshalLoadBalancerPoolHealthMonitor(m map[string]json.RawMessage, result // LoadBalancerPoolHealthMonitorPatch : LoadBalancerPoolHealthMonitorPatch struct type LoadBalancerPoolHealthMonitorPatch struct { - // The health check interval in seconds. Interval must be greater than timeout value. + // The seconds to wait between health checks. Must be greater than `timeout`. Delay *int64 `json:"delay" validate:"required"` // The health check max retries. MaxRetries *int64 `json:"max_retries" validate:"required"` - // The health check port number. If specified, this overrides the ports specified in the server member resources. - // Specify `null` to remove an existing port value. + // The health check port. + // + // If set, this overrides the pool member port values. + // + // Specify `null` to remove an existing health check port. Port *int64 `json:"port,omitempty"` - // The health check timeout in seconds. + // The seconds to wait for a response to a health check. Must be less than `delay`. Timeout *int64 `json:"timeout" validate:"required"` - // The protocol type of this load balancer pool health monitor. + // The protocol type to use for health checks. Type *string `json:"type" validate:"required"` - // The health check URL path. Applicable only if the health monitor `type` is `http` or - // `https`. This value must be in the format of an [origin-form request - // target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + // The health check URL path. Applicable when `type` is `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"` } // Constants associated with the LoadBalancerPoolHealthMonitorPatch.Type property. -// The protocol type of this load balancer pool health monitor. +// The protocol type to use for health checks. const ( LoadBalancerPoolHealthMonitorPatchTypeHTTPConst = "http" LoadBalancerPoolHealthMonitorPatchTypeHTTPSConst = "https" @@ -48352,29 +48666,31 @@ func UnmarshalLoadBalancerPoolHealthMonitorPatch(m map[string]json.RawMessage, r // LoadBalancerPoolHealthMonitorPrototype : LoadBalancerPoolHealthMonitorPrototype struct type LoadBalancerPoolHealthMonitorPrototype struct { - // The health check interval in seconds. Interval must be greater than timeout value. + // The seconds to wait between health checks. Must be greater than `timeout`. Delay *int64 `json:"delay" validate:"required"` // The health check max retries. MaxRetries *int64 `json:"max_retries" validate:"required"` - // The health check port number. If specified, this overrides the ports specified in the server member resources. + // The health check port. + // + // If specified, this overrides the pool member port values. Port *int64 `json:"port,omitempty"` - // The health check timeout in seconds. + // The seconds to wait for a response to a health check. Must be less than `delay`. Timeout *int64 `json:"timeout" validate:"required"` - // The protocol type of this load balancer pool health monitor. + // The protocol type to use for health checks. Type *string `json:"type" validate:"required"` - // The health check URL path. Applicable only if the health monitor `type` is `http` or - // `https`. This value must be in the format of an [origin-form request - // target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + // The health check URL path. Applicable when `type` is `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"` } // Constants associated with the LoadBalancerPoolHealthMonitorPrototype.Type property. -// The protocol type of this load balancer pool health monitor. +// The protocol type to use for health checks. const ( LoadBalancerPoolHealthMonitorPrototypeTypeHTTPConst = "http" LoadBalancerPoolHealthMonitorPrototypeTypeHTTPSConst = "https" @@ -48507,7 +48823,11 @@ type LoadBalancerPoolMember struct { // `health_monitor` property is specified. Port *int64 `json:"port" validate:"required"` - // The provisioning status of this member. + // The provisioning status of this member + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool member on which the + // unexpected property value was encountered. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The pool member target. Load balancers in the `network` family support virtual server @@ -48530,14 +48850,17 @@ const ( ) // Constants associated with the LoadBalancerPoolMember.ProvisioningStatus property. -// The provisioning status of this member. +// The provisioning status of this member +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool member on which the +// unexpected property value was encountered. const ( - LoadBalancerPoolMemberProvisioningStatusActiveConst = "active" - LoadBalancerPoolMemberProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerPoolMemberProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerPoolMemberProvisioningStatusFailedConst = "failed" - LoadBalancerPoolMemberProvisioningStatusMaintenancePendingConst = "maintenance_pending" - LoadBalancerPoolMemberProvisioningStatusUpdatePendingConst = "update_pending" + LoadBalancerPoolMemberProvisioningStatusActiveConst = "active" + LoadBalancerPoolMemberProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerPoolMemberProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerPoolMemberProvisioningStatusFailedConst = "failed" + LoadBalancerPoolMemberProvisioningStatusUpdatePendingConst = "update_pending" ) // UnmarshalLoadBalancerPoolMember unmarshals an instance of LoadBalancerPoolMember from the specified map of raw messages. @@ -49782,7 +50105,7 @@ type NetworkACL struct { // The subnets to which this network ACL is attached. Subnets []SubnetReference `json:"subnets" validate:"required"` - // The VPC this network ACL is a part of. + // The VPC this network ACL resides in. VPC *VPCReference `json:"vpc" validate:"required"` } @@ -50004,7 +50327,7 @@ type NetworkACLPrototype struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The VPC this network ACL is to be a part of. + // The VPC this network ACL will reside in. VPC VPCIdentityIntf `json:"vpc" validate:"required"` // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, @@ -51926,10 +52249,10 @@ type PublicGateway struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The status of the volume. + // The status of this public gateway. Status *string `json:"status" validate:"required"` - // The VPC this public gateway serves. + // The VPC this public gateway resides in. VPC *VPCReference `json:"vpc" validate:"required"` // The zone this public gateway resides in. @@ -51943,7 +52266,7 @@ const ( ) // Constants associated with the PublicGateway.Status property. -// The status of the volume. +// The status of this public gateway. const ( PublicGatewayStatusAvailableConst = "available" PublicGatewayStatusDeletingConst = "deleting" @@ -52855,7 +53178,7 @@ type ReservedIP struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The target of this reserved IP. + // The target this reserved IP is bound to. // // If absent, this reserved IP is provider-owned or unbound. Target ReservedIPTargetIntf `json:"target,omitempty"` @@ -53328,7 +53651,7 @@ func UnmarshalReservedIPReferenceDeleted(m map[string]json.RawMessage, result in return } -// ReservedIPTarget : The target of this reserved IP. +// ReservedIPTarget : The target this reserved IP is bound to. // // If absent, this reserved IP is provider-owned or unbound. // Models which "extend" this model: @@ -53404,8 +53727,12 @@ func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) return } -// ReservedIPTargetPrototype : The target this reserved IP is to be bound to. The target must be an endpoint gateway not already bound to a reserved -// IP in the subnet's zone. +// ReservedIPTargetPrototype : The target to bind this reserved IP to. The target must be in the same VPC. +// +// At present, only endpoint gateway targets are supported. The endpoint gateway must not be already bound to a +// reserved IP in the subnet's zone. +// +// If unspecified, the reserved IP will be created unbound. // Models which "extend" this model: // - ReservedIPTargetPrototypeEndpointGatewayIdentity type ReservedIPTargetPrototype struct { @@ -54586,7 +54913,7 @@ type SecurityGroup struct { // The targets for this security group. Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` - // The VPC this security group is a part of. + // The VPC this security group resides in. VPC *VPCReference `json:"vpc" validate:"required"` } @@ -56213,7 +56540,7 @@ type Subnet struct { // 2(32 - 24) = 28 = 256 addresses. TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count" validate:"required"` - // The VPC this subnet is a part of. + // The VPC this subnet resides in. VPC *VPCReference `json:"vpc" validate:"required"` // The zone this subnet resides in. @@ -56529,7 +56856,7 @@ type SubnetPrototype struct { // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` - // The VPC the subnet is to be a part of. + // The VPC the subnet will reside in. VPC VPCIdentityIntf `json:"vpc" validate:"required"` // The total number of IPv4 addresses required. Must be a power of 2. The VPC must have a default address prefix in the @@ -58110,6 +58437,10 @@ type UpdateLoadBalancerOptions struct { // The load balancer patch. LoadBalancerPatch map[string]interface{} `json:"LoadBalancer_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 } @@ -58134,6 +58465,12 @@ func (_options *UpdateLoadBalancerOptions) SetLoadBalancerPatch(loadBalancerPatc return _options } +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateLoadBalancerOptions) SetIfMatch(ifMatch string) *UpdateLoadBalancerOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + // SetHeaders : Allow user to set Headers func (options *UpdateLoadBalancerOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerOptions { options.Headers = param @@ -59551,6 +59888,9 @@ type VPNGateway struct { Subnet *SubnetReference `json:"subnet" validate:"required"` + // The VPC this VPN gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + // Route mode VPN gateway. Mode *string `json:"mode,omitempty"` } @@ -59631,6 +59971,10 @@ func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err if err != nil { return } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { return @@ -70035,8 +70379,8 @@ type InstancePrototypeInstanceByImage struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` - // The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the - // subnets of the instance's network interfaces. + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -70197,8 +70541,8 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` - // The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the - // subnets of the instance's network interfaces. + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -70352,8 +70696,8 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` - // The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the - // subnets of the instance's network interfaces. + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -70612,8 +70956,8 @@ type InstanceTemplatePrototypeInstanceByImage struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` - // The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the - // subnets of the instance's network interfaces. + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -70719,6 +71063,161 @@ func UnmarshalInstanceTemplatePrototypeInstanceByImage(m map[string]json.RawMess return } +// InstanceTemplatePrototypeInstanceBySourceSnapshot : InstanceTemplatePrototypeInstanceBySourceSnapshot struct +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceBySourceSnapshot struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceBySourceSnapshot : Instantiate InstanceTemplatePrototypeInstanceBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceBySourceSnapshot, err error) { + _model = &InstanceTemplatePrototypeInstanceBySourceSnapshot{ + BootVolumeAttachment: bootVolumeAttachment, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceBySourceSnapshot) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceBySourceSnapshot) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceTemplatePrototypeInstanceBySourceTemplate : InstanceTemplatePrototypeInstanceBySourceTemplate struct // This model "extends" InstanceTemplatePrototype type InstanceTemplatePrototypeInstanceBySourceTemplate struct { @@ -70774,8 +71273,8 @@ type InstanceTemplatePrototypeInstanceBySourceTemplate struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` - // The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the - // subnets of the instance's network interfaces. + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -70953,8 +71452,8 @@ type InstanceTemplateInstanceByImage struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` - // The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the - // subnets of the instance's network interfaces. + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -71132,8 +71631,8 @@ type InstanceTemplateInstanceBySourceSnapshot struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` - // The VPC the virtual server instance is to be a part of. If specified, it must match the VPC referenced by the - // subnets of the instance's network interfaces. + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -72464,7 +72963,7 @@ type NetworkACLPrototypeNetworkACLByRules struct { ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The VPC this network ACL is to be a part of. + // The VPC this network ACL will reside in. VPC VPCIdentityIntf `json:"vpc" validate:"required"` // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, @@ -72517,7 +73016,7 @@ type NetworkACLPrototypeNetworkACLBySourceNetworkACL struct { ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The VPC this network ACL is to be a part of. + // The VPC this network ACL will reside in. VPC VPCIdentityIntf `json:"vpc" validate:"required"` // Network ACL to copy rules from. @@ -76733,7 +77232,7 @@ type SubnetPrototypeSubnetByCIDR struct { // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` - // The VPC the subnet is to be a part of. + // The VPC the subnet will reside in. VPC VPCIdentityIntf `json:"vpc" validate:"required"` // The IPv4 range of the subnet, expressed in CIDR format. The prefix length of the subnet's CIDR must be between `/9` @@ -76834,7 +77333,7 @@ type SubnetPrototypeSubnetByTotalCount struct { // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` - // The VPC the subnet is to be a part of. + // The VPC the subnet will reside in. VPC VPCIdentityIntf `json:"vpc" validate:"required"` // The total number of IPv4 addresses required. Must be a power of 2. The VPC must have a default address prefix in the @@ -78009,6 +78508,9 @@ type VPNGatewayPolicyMode struct { Subnet *SubnetReference `json:"subnet" validate:"required"` + // The VPC this VPN gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + // Policy mode VPN gateway. Mode *string `json:"mode" validate:"required"` } @@ -78085,6 +78587,10 @@ func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interfac if err != nil { return } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { return @@ -78240,6 +78746,9 @@ type VPNGatewayRouteMode struct { Subnet *SubnetReference `json:"subnet" validate:"required"` + // The VPC this VPN gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + // Route mode VPN gateway. Mode *string `json:"mode" validate:"required"` } @@ -78316,6 +78825,10 @@ func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface if err != nil { return } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { return diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go index 485a990d72..0eca12b220 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go @@ -41206,6 +41206,471 @@ var _ = Describe(`VpcV1`, func() { }) }) }) + Describe(`ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) - Operation response error`, func() { + version := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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}`) + })) + }) + 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{"testString"})) + 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": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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}`) + })) + }) + 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 := "testString" + 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{"testString"})) + 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 := "testString" + 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{"testString"})) + 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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{"testString"})) + 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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 := "testString" deleteBareMetalServerPath := "/bare_metal_servers/testString" @@ -57349,7 +57814,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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}]}`) + 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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}]}`) })) }) It(`Invoke ListVPNGateways successfully with retries`, func() { @@ -57413,7 +57878,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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}]}`) + 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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}]}`) })) }) It(`Invoke ListVPNGateways successfully`, func() { @@ -57643,7 +58108,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}`) + fmt.Fprintf(res, "%s", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}`) })) }) It(`Invoke CreateVPNGateway successfully with retries`, func() { @@ -57731,7 +58196,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}`) + fmt.Fprintf(res, "%s", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}`) })) }) It(`Invoke CreateVPNGateway successfully`, func() { @@ -58017,7 +58482,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}`) + fmt.Fprintf(res, "%s", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}`) })) }) It(`Invoke GetVPNGateway successfully with retries`, func() { @@ -58074,7 +58539,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}`) + fmt.Fprintf(res, "%s", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}`) })) }) It(`Invoke GetVPNGateway successfully`, func() { @@ -58265,7 +58730,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}`) + fmt.Fprintf(res, "%s", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}`) })) }) It(`Invoke UpdateVPNGateway successfully with retries`, func() { @@ -58345,7 +58810,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "mode": "route"}`) + fmt.Fprintf(res, "%s", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}`) })) }) It(`Invoke UpdateVPNGateway successfully`, func() { @@ -65701,6 +66166,8 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.EscapedPath()).To(Equal(deleteLoadBalancerPath)) 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{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.WriteHeader(204) @@ -65723,6 +66190,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the DeleteLoadBalancerOptions model deleteLoadBalancerOptionsModel := new(vpcv1.DeleteLoadBalancerOptions) deleteLoadBalancerOptionsModel.ID = core.StringPtr("testString") + deleteLoadBalancerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) deleteLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -65742,6 +66210,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the DeleteLoadBalancerOptions model deleteLoadBalancerOptionsModel := new(vpcv1.DeleteLoadBalancerOptions) deleteLoadBalancerOptionsModel.ID = core.StringPtr("testString") + deleteLoadBalancerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) deleteLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -65998,6 +66467,8 @@ var _ = Describe(`VpcV1`, func() { // Verify the contents of the request Expect(req.URL.EscapedPath()).To(Equal(updateLoadBalancerPath)) 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{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -66022,10 +66493,15 @@ var _ = Describe(`VpcV1`, func() { loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // 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 LoadBalancerPatch model loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) loadBalancerPatchModel.Logging = loadBalancerLoggingModel loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") + loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -66033,6 +66509,7 @@ var _ = Describe(`VpcV1`, func() { updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch + updateLoadBalancerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateLoadBalancerOptionsModel.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.UpdateLoadBalancer(updateLoadBalancerOptionsModel) @@ -66080,6 +66557,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{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -66109,10 +66588,15 @@ var _ = Describe(`VpcV1`, func() { loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // 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 LoadBalancerPatch model loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) loadBalancerPatchModel.Logging = loadBalancerLoggingModel loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") + loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -66120,6 +66604,7 @@ var _ = Describe(`VpcV1`, func() { updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch + updateLoadBalancerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -66172,6 +66657,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{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response @@ -66203,10 +66690,15 @@ var _ = Describe(`VpcV1`, func() { loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // 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 LoadBalancerPatch model loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) loadBalancerPatchModel.Logging = loadBalancerLoggingModel loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") + loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -66214,6 +66706,7 @@ var _ = Describe(`VpcV1`, func() { updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch + updateLoadBalancerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -66240,10 +66733,15 @@ var _ = Describe(`VpcV1`, func() { loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // 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 LoadBalancerPatch model loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) loadBalancerPatchModel.Logging = loadBalancerLoggingModel loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") + loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -66251,6 +66749,7 @@ var _ = Describe(`VpcV1`, func() { updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch + updateLoadBalancerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -66298,10 +66797,15 @@ var _ = Describe(`VpcV1`, func() { loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // 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 LoadBalancerPatch model loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) loadBalancerPatchModel.Logging = loadBalancerLoggingModel loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") + loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -66309,6 +66813,7 @@ var _ = Describe(`VpcV1`, func() { updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch + updateLoadBalancerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -79463,9 +79968,11 @@ var _ = Describe(`VpcV1`, func() { id := "testString" deleteLoadBalancerOptionsModel := vpcService.NewDeleteLoadBalancerOptions(id) deleteLoadBalancerOptionsModel.SetID("testString") + deleteLoadBalancerOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) deleteLoadBalancerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteLoadBalancerOptionsModel).ToNot(BeNil()) Expect(deleteLoadBalancerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteLoadBalancerOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(deleteLoadBalancerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeleteLoadBalancerPoolMemberOptions successfully`, func() { @@ -79836,6 +80343,22 @@ var _ = Describe(`VpcV1`, func() { Expect(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetBareMetalServerNetworkInterfaceIPOptions successfully`, func() { + // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model + bareMetalServerID := "testString" + networkInterfaceID := "testString" + id := "testString" + getBareMetalServerNetworkInterfaceIPOptionsModel := vpcService.NewGetBareMetalServerNetworkInterfaceIPOptions(bareMetalServerID, networkInterfaceID, id) + getBareMetalServerNetworkInterfaceIPOptionsModel.SetBareMetalServerID("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.SetNetworkInterfaceID("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.SetID("testString") + getBareMetalServerNetworkInterfaceIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getBareMetalServerNetworkInterfaceIPOptionsModel).ToNot(BeNil()) + Expect(getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerNetworkInterfaceIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getBareMetalServerNetworkInterfaceIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetBareMetalServerNetworkInterfaceOptions successfully`, func() { // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model bareMetalServerID := "testString" @@ -80715,6 +81238,19 @@ var _ = Describe(`VpcV1`, func() { Expect(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) Expect(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListBareMetalServerNetworkInterfaceIpsOptions successfully`, func() { + // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model + bareMetalServerID := "testString" + networkInterfaceID := "testString" + listBareMetalServerNetworkInterfaceIpsOptionsModel := vpcService.NewListBareMetalServerNetworkInterfaceIpsOptions(bareMetalServerID, networkInterfaceID) + listBareMetalServerNetworkInterfaceIpsOptionsModel.SetBareMetalServerID("testString") + listBareMetalServerNetworkInterfaceIpsOptionsModel.SetNetworkInterfaceID("testString") + listBareMetalServerNetworkInterfaceIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listBareMetalServerNetworkInterfaceIpsOptionsModel).ToNot(BeNil()) + Expect(listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) + Expect(listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListBareMetalServerNetworkInterfacesOptions successfully`, func() { // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model bareMetalServerID := "testString" @@ -82355,10 +82891,12 @@ var _ = Describe(`VpcV1`, func() { updateLoadBalancerOptionsModel := vpcService.NewUpdateLoadBalancerOptions(id, loadBalancerPatch) updateLoadBalancerOptionsModel.SetID("testString") updateLoadBalancerOptionsModel.SetLoadBalancerPatch(make(map[string]interface{})) + updateLoadBalancerOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateLoadBalancerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateLoadBalancerOptionsModel).ToNot(BeNil()) Expect(updateLoadBalancerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(updateLoadBalancerOptionsModel.LoadBalancerPatch).To(Equal(make(map[string]interface{}))) + Expect(updateLoadBalancerOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(updateLoadBalancerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateLoadBalancerPoolMemberOptions successfully`, func() { @@ -82943,6 +83481,13 @@ var _ = Describe(`VpcV1`, func() { _, err := vpcService.NewInstanceTemplatePrototypeInstanceByImage(image, primaryNetworkInterface, zone) Expect(err).ToNot(BeNil()) }) + It(`Invoke NewInstanceTemplatePrototypeInstanceBySourceSnapshot successfully`, func() { + var bootVolumeAttachment *vpcv1.VolumeAttachmentPrototypeInstanceBySourceSnapshotContext = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + var zone vpcv1.ZoneIdentityIntf = nil + _, err := vpcService.NewInstanceTemplatePrototypeInstanceBySourceSnapshot(bootVolumeAttachment, primaryNetworkInterface, zone) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewInstanceTemplatePrototypeInstanceBySourceTemplate successfully`, func() { var sourceTemplate vpcv1.InstanceTemplateIdentityIntf = nil _, err := vpcService.NewInstanceTemplatePrototypeInstanceBySourceTemplate(sourceTemplate) From 83c17170b3576ce5d7422eff43465e50a91915e0 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Mon, 26 Sep 2022 15:49:04 +0530 Subject: [PATCH 004/103] sdk upgrade --- .../IBM/vpc-go-sdk/common/headers.go | 4 +- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 4233 +++++++++++++- .../IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go | 5161 ++++++++++++++--- 3 files changed, 8471 insertions(+), 927 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers.go b/common/github.com/IBM/vpc-go-sdk/common/headers.go index 4f74ffc296..1516ebf4cb 100644 --- a/common/github.com/IBM/vpc-go-sdk/common/headers.go +++ b/common/github.com/IBM/vpc-go-sdk/common/headers.go @@ -40,10 +40,10 @@ func GetSdkHeaders(serviceName string, serviceVersion string, operationId string return sdkHeaders } -var userAgent string = fmt.Sprintf("%s-%s %s", SDK_NAME, Version, GetSystemInfo()) +var UserAgent string = fmt.Sprintf("%s-%s %s", SDK_NAME, Version, GetSystemInfo()) func GetUserAgentInfo() string { - return userAgent + return UserAgent } var systemInfo = fmt.Sprintf("(arch=%s; os=%s; go.version=%s)", runtime.GOARCH, runtime.GOOS, runtime.Version()) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 19820ea62b..de53c12c7b 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.48.1-52130155-20220425-145431 + * IBM OpenAPI SDK Code Generator Version: 3.55.1-b24c7487-20220831-201343 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -37,11 +37,11 @@ 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: 2022-03-29 +// API Version: 2022-09-13 type VpcV1 struct { Service *core.BaseService - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-03-29` + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` // and today's date (UTC). Version *string @@ -62,7 +62,7 @@ type VpcV1Options struct { URL string Authenticator core.Authenticator - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-03-29` + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` // and today's date (UTC). Version *string } @@ -121,7 +121,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2022-03-29") + options.Version = core.StringPtr("2022-09-13") } service = &VpcV1{ @@ -2495,9 +2495,8 @@ func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetN return } -// ReplaceSubnetNetworkACL : Attach a network ACL to a subnet -// This request attaches the network ACL, specified in the request body, to the subnet specified by the subnet -// identifier in the URL. This replaces the existing network ACL on the subnet. +// ReplaceSubnetNetworkACL : Replace the network ACL for a subnet +// This request replaces the existing network ACL for a subnet with the network ACL specified in the request body. func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { return vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) } @@ -2812,9 +2811,8 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne return } -// ReplaceSubnetRoutingTable : Attach a routing table to a subnet -// This request attaches the routing table, specified in the request body, to the subnet specified by the subnet -// identifier in the URL. This replaces the existing routing table on the subnet. +// ReplaceSubnetRoutingTable : Replace the routing table for a subnet +// This request replaces the existing routing table for a subnet with the routing table specified in the request body. // // For this request to succeed, the routing table `route_direct_link_ingress`, // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. @@ -15844,6 +15842,9 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway 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)) } @@ -25174,7 +25175,8 @@ func (options *CreateDedicatedHostOptions) SetHeaders(param map[string]string) * // CreateEndpointGatewayOptions : The CreateEndpointGateway options. type CreateEndpointGatewayOptions struct { - // The target for this endpoint gateway. + // The target to use for this endpoint gateway. Must not already be the target of another + // endpoint gateway in the VPC. Target EndpointGatewayTargetPrototypeIntf `json:"target" validate:"required"` // The VPC this endpoint gateway will reside in. @@ -25350,13 +25352,19 @@ func (options *CreateFlowLogCollectorOptions) SetHeaders(param map[string]string // CreateIkePolicyOptions : The CreateIkePolicy options. type CreateIkePolicyOptions struct { - // The authentication algorithm. + // The authentication algorithm + // + // The `md5` and `sha1` algorithms have been deprecated. AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` - // The Diffie-Hellman group. + // The Diffie-Hellman group + // + // Groups `2` and `5` have been deprecated. DhGroup *int64 `json:"dh_group" validate:"required"` - // The encryption algorithm. + // The encryption algorithm + // + // The `triple_des` algorithm has been deprecated. EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` // The IKE protocol version. @@ -25377,18 +25385,24 @@ type CreateIkePolicyOptions struct { } // Constants associated with the CreateIkePolicyOptions.AuthenticationAlgorithm property. -// The authentication algorithm. +// The authentication algorithm +// +// The `md5` and `sha1` algorithms have been deprecated. const ( CreateIkePolicyOptionsAuthenticationAlgorithmMd5Const = "md5" CreateIkePolicyOptionsAuthenticationAlgorithmSha1Const = "sha1" CreateIkePolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" + CreateIkePolicyOptionsAuthenticationAlgorithmSha384Const = "sha384" CreateIkePolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" ) // Constants associated with the CreateIkePolicyOptions.EncryptionAlgorithm property. -// The encryption algorithm. +// The encryption algorithm +// +// The `triple_des` algorithm has been deprecated. const ( CreateIkePolicyOptionsEncryptionAlgorithmAes128Const = "aes128" + CreateIkePolicyOptionsEncryptionAlgorithmAes192Const = "aes192" CreateIkePolicyOptionsEncryptionAlgorithmAes256Const = "aes256" CreateIkePolicyOptionsEncryptionAlgorithmTripleDesConst = "triple_des" ) @@ -26026,13 +26040,26 @@ func (options *CreateInstanceVolumeAttachmentOptions) SetHeaders(param map[strin // CreateIpsecPolicyOptions : The CreateIpsecPolicy options. type CreateIpsecPolicyOptions struct { - // The authentication algorithm. + // The authentication algorithm + // + // The `md5` and `sha1` algorithms have been deprecated + // + // Must be `disabled` if and only if the `encryption_algorithm` is + // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` - // The encryption algorithm. + // The encryption algorithm + // + // The `triple_des` algorithm has been deprecated + // + // The `authentication_algorithm` must be `disabled` if and only if + // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or + // `aes256gcm16`. EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` - // Perfect Forward Secrecy. + // Perfect Forward Secrecy + // + // Groups `group_2` and `group_5` have been deprecated. Pfs *string `json:"pfs" validate:"required"` // The key lifetime in seconds. @@ -26050,29 +26077,58 @@ type CreateIpsecPolicyOptions struct { } // Constants associated with the CreateIpsecPolicyOptions.AuthenticationAlgorithm property. -// The authentication algorithm. +// The authentication algorithm +// +// The `md5` and `sha1` algorithms have been deprecated +// +// Must be `disabled` if and only if the `encryption_algorithm` is +// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. const ( - CreateIpsecPolicyOptionsAuthenticationAlgorithmMd5Const = "md5" - CreateIpsecPolicyOptionsAuthenticationAlgorithmSha1Const = "sha1" - CreateIpsecPolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" - CreateIpsecPolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" + CreateIpsecPolicyOptionsAuthenticationAlgorithmDisabledConst = "disabled" + CreateIpsecPolicyOptionsAuthenticationAlgorithmMd5Const = "md5" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha1Const = "sha1" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha384Const = "sha384" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" ) // Constants associated with the CreateIpsecPolicyOptions.EncryptionAlgorithm property. -// The encryption algorithm. +// The encryption algorithm +// +// The `triple_des` algorithm has been deprecated +// +// The `authentication_algorithm` must be `disabled` if and only if +// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or +// `aes256gcm16`. const ( - CreateIpsecPolicyOptionsEncryptionAlgorithmAes128Const = "aes128" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes256Const = "aes256" - CreateIpsecPolicyOptionsEncryptionAlgorithmTripleDesConst = "triple_des" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes128Const = "aes128" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes192Const = "aes192" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes256Const = "aes256" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" + CreateIpsecPolicyOptionsEncryptionAlgorithmTripleDesConst = "triple_des" ) // Constants associated with the CreateIpsecPolicyOptions.Pfs property. -// Perfect Forward Secrecy. +// Perfect Forward Secrecy +// +// Groups `group_2` and `group_5` have been deprecated. const ( CreateIpsecPolicyOptionsPfsDisabledConst = "disabled" CreateIpsecPolicyOptionsPfsGroup14Const = "group_14" + CreateIpsecPolicyOptionsPfsGroup15Const = "group_15" + CreateIpsecPolicyOptionsPfsGroup16Const = "group_16" + CreateIpsecPolicyOptionsPfsGroup17Const = "group_17" + CreateIpsecPolicyOptionsPfsGroup18Const = "group_18" CreateIpsecPolicyOptionsPfsGroup19Const = "group_19" CreateIpsecPolicyOptionsPfsGroup2Const = "group_2" + CreateIpsecPolicyOptionsPfsGroup20Const = "group_20" + CreateIpsecPolicyOptionsPfsGroup21Const = "group_21" + CreateIpsecPolicyOptionsPfsGroup22Const = "group_22" + CreateIpsecPolicyOptionsPfsGroup23Const = "group_23" + CreateIpsecPolicyOptionsPfsGroup24Const = "group_24" + CreateIpsecPolicyOptionsPfsGroup31Const = "group_31" CreateIpsecPolicyOptionsPfsGroup5Const = "group_5" ) @@ -32512,7 +32568,7 @@ func UnmarshalEndpointGatewayTarget(m map[string]json.RawMessage, result interfa return } -// EndpointGatewayTargetPrototype : The target for this endpoint gateway. +// EndpointGatewayTargetPrototype : The target to use for this endpoint gateway. Must not already be the target of another endpoint gateway in the VPC. // Models which "extend" this model: // - EndpointGatewayTargetPrototypeProviderCloudServiceIdentity // - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity @@ -35985,7 +36041,9 @@ func (options *GetVPNServerRouteOptions) SetHeaders(param map[string]string) *Ge // IkePolicy : IkePolicy struct type IkePolicy struct { - // The authentication algorithm. + // The authentication algorithm + // + // The `md5` and `sha1` algorithms have been deprecated. AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` // The VPN gateway connections that use this IKE policy. @@ -35994,10 +36052,14 @@ type IkePolicy struct { // The date and time that this IKE policy was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The Diffie-Hellman group. + // The Diffie-Hellman group + // + // Groups `2` and `5` have been deprecated. DhGroup *int64 `json:"dh_group" validate:"required"` - // The encryption algorithm. + // The encryption algorithm + // + // The `triple_des` algorithm has been deprecated. EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` // The IKE policy's canonical URL. @@ -36026,18 +36088,24 @@ type IkePolicy struct { } // Constants associated with the IkePolicy.AuthenticationAlgorithm property. -// The authentication algorithm. +// The authentication algorithm +// +// The `md5` and `sha1` algorithms have been deprecated. const ( IkePolicyAuthenticationAlgorithmMd5Const = "md5" IkePolicyAuthenticationAlgorithmSha1Const = "sha1" IkePolicyAuthenticationAlgorithmSha256Const = "sha256" + IkePolicyAuthenticationAlgorithmSha384Const = "sha384" IkePolicyAuthenticationAlgorithmSha512Const = "sha512" ) // Constants associated with the IkePolicy.EncryptionAlgorithm property. -// The encryption algorithm. +// The encryption algorithm +// +// The `triple_des` algorithm has been deprecated. const ( IkePolicyEncryptionAlgorithmAes128Const = "aes128" + IkePolicyEncryptionAlgorithmAes192Const = "aes192" IkePolicyEncryptionAlgorithmAes256Const = "aes256" IkePolicyEncryptionAlgorithmTripleDesConst = "triple_des" ) @@ -36173,13 +36241,19 @@ func (resp *IkePolicyCollection) GetNextStart() (*string, error) { // IkePolicyPatch : IkePolicyPatch struct type IkePolicyPatch struct { - // The authentication algorithm. + // The authentication algorithm + // + // The `md5` and `sha1` algorithms have been deprecated. AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` - // The Diffie-Hellman group. + // The Diffie-Hellman group + // + // Groups `2` and `5` have been deprecated. DhGroup *int64 `json:"dh_group,omitempty"` - // The encryption algorithm. + // The encryption algorithm + // + // The `triple_des` algorithm has been deprecated. EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` // The IKE protocol version. @@ -36193,18 +36267,24 @@ type IkePolicyPatch struct { } // Constants associated with the IkePolicyPatch.AuthenticationAlgorithm property. -// The authentication algorithm. +// The authentication algorithm +// +// The `md5` and `sha1` algorithms have been deprecated. const ( IkePolicyPatchAuthenticationAlgorithmMd5Const = "md5" IkePolicyPatchAuthenticationAlgorithmSha1Const = "sha1" IkePolicyPatchAuthenticationAlgorithmSha256Const = "sha256" + IkePolicyPatchAuthenticationAlgorithmSha384Const = "sha384" IkePolicyPatchAuthenticationAlgorithmSha512Const = "sha512" ) // Constants associated with the IkePolicyPatch.EncryptionAlgorithm property. -// The encryption algorithm. +// The encryption algorithm +// +// The `triple_des` algorithm has been deprecated. const ( IkePolicyPatchEncryptionAlgorithmAes128Const = "aes128" + IkePolicyPatchEncryptionAlgorithmAes192Const = "aes192" IkePolicyPatchEncryptionAlgorithmAes256Const = "aes256" IkePolicyPatchEncryptionAlgorithmTripleDesConst = "triple_des" ) @@ -36334,7 +36414,12 @@ func UnmarshalIP(m map[string]json.RawMessage, result interface{}) (err error) { // IPsecPolicy : IPsecPolicy struct type IPsecPolicy struct { - // The authentication algorithm. + // The authentication algorithm + // + // The `md5` and `sha1` algorithms have been deprecated + // + // Must be `disabled` if and only if the `encryption_algorithm` is + // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` // The VPN gateway connections that use this IPsec policy. @@ -36346,7 +36431,13 @@ type IPsecPolicy struct { // The encapsulation mode used. Only `tunnel` is supported. EncapsulationMode *string `json:"encapsulation_mode" validate:"required"` - // The encryption algorithm. + // The encryption algorithm + // + // The `triple_des` algorithm has been deprecated + // + // The `authentication_algorithm` must be `disabled` if and only if + // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or + // `aes256gcm16`. EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` // The IPsec policy's canonical URL. @@ -36361,7 +36452,9 @@ type IPsecPolicy struct { // The user-defined name for this IPsec policy. Name *string `json:"name" validate:"required"` - // Perfect Forward Secrecy. + // Perfect Forward Secrecy + // + // Groups `group_2` and `group_5` have been deprecated. Pfs *string `json:"pfs" validate:"required"` // The resource group for this IPsec policy. @@ -36375,12 +36468,19 @@ type IPsecPolicy struct { } // Constants associated with the IPsecPolicy.AuthenticationAlgorithm property. -// The authentication algorithm. +// The authentication algorithm +// +// The `md5` and `sha1` algorithms have been deprecated +// +// Must be `disabled` if and only if the `encryption_algorithm` is +// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. const ( - IPsecPolicyAuthenticationAlgorithmMd5Const = "md5" - IPsecPolicyAuthenticationAlgorithmSha1Const = "sha1" - IPsecPolicyAuthenticationAlgorithmSha256Const = "sha256" - IPsecPolicyAuthenticationAlgorithmSha512Const = "sha512" + IPsecPolicyAuthenticationAlgorithmDisabledConst = "disabled" + IPsecPolicyAuthenticationAlgorithmMd5Const = "md5" + IPsecPolicyAuthenticationAlgorithmSha1Const = "sha1" + IPsecPolicyAuthenticationAlgorithmSha256Const = "sha256" + IPsecPolicyAuthenticationAlgorithmSha384Const = "sha384" + IPsecPolicyAuthenticationAlgorithmSha512Const = "sha512" ) // Constants associated with the IPsecPolicy.EncapsulationMode property. @@ -36390,20 +36490,42 @@ const ( ) // Constants associated with the IPsecPolicy.EncryptionAlgorithm property. -// The encryption algorithm. +// The encryption algorithm +// +// The `triple_des` algorithm has been deprecated +// +// The `authentication_algorithm` must be `disabled` if and only if +// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or +// `aes256gcm16`. const ( - IPsecPolicyEncryptionAlgorithmAes128Const = "aes128" - IPsecPolicyEncryptionAlgorithmAes256Const = "aes256" - IPsecPolicyEncryptionAlgorithmTripleDesConst = "triple_des" + IPsecPolicyEncryptionAlgorithmAes128Const = "aes128" + IPsecPolicyEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" + IPsecPolicyEncryptionAlgorithmAes192Const = "aes192" + IPsecPolicyEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" + IPsecPolicyEncryptionAlgorithmAes256Const = "aes256" + IPsecPolicyEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" + IPsecPolicyEncryptionAlgorithmTripleDesConst = "triple_des" ) // Constants associated with the IPsecPolicy.Pfs property. -// Perfect Forward Secrecy. +// Perfect Forward Secrecy +// +// Groups `group_2` and `group_5` have been deprecated. const ( IPsecPolicyPfsDisabledConst = "disabled" IPsecPolicyPfsGroup14Const = "group_14" + IPsecPolicyPfsGroup15Const = "group_15" + IPsecPolicyPfsGroup16Const = "group_16" + IPsecPolicyPfsGroup17Const = "group_17" + IPsecPolicyPfsGroup18Const = "group_18" IPsecPolicyPfsGroup19Const = "group_19" IPsecPolicyPfsGroup2Const = "group_2" + IPsecPolicyPfsGroup20Const = "group_20" + IPsecPolicyPfsGroup21Const = "group_21" + IPsecPolicyPfsGroup22Const = "group_22" + IPsecPolicyPfsGroup23Const = "group_23" + IPsecPolicyPfsGroup24Const = "group_24" + IPsecPolicyPfsGroup31Const = "group_31" IPsecPolicyPfsGroup5Const = "group_5" ) @@ -36572,10 +36694,21 @@ func UnmarshalIPsecPolicyCollectionNext(m map[string]json.RawMessage, result int // IPsecPolicyPatch : IPsecPolicyPatch struct type IPsecPolicyPatch struct { - // The authentication algorithm. + // The authentication algorithm + // + // The `md5` and `sha1` algorithms have been deprecated + // + // Must be `disabled` if and only if the `encryption_algorithm` is + // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` - // The encryption algorithm. + // The encryption algorithm + // + // The `triple_des` algorithm has been deprecated + // + // The `authentication_algorithm` must be `disabled` if and only if + // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or + // `aes256gcm16`. EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` // The key lifetime in seconds. @@ -36584,34 +36717,65 @@ type IPsecPolicyPatch struct { // The user-defined name for this IPsec policy. Name *string `json:"name,omitempty"` - // Perfect Forward Secrecy. + // Perfect Forward Secrecy + // + // Groups `group_2` and `group_5` have been deprecated. Pfs *string `json:"pfs,omitempty"` } // Constants associated with the IPsecPolicyPatch.AuthenticationAlgorithm property. -// The authentication algorithm. +// The authentication algorithm +// +// The `md5` and `sha1` algorithms have been deprecated +// +// Must be `disabled` if and only if the `encryption_algorithm` is +// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. const ( - IPsecPolicyPatchAuthenticationAlgorithmMd5Const = "md5" - IPsecPolicyPatchAuthenticationAlgorithmSha1Const = "sha1" - IPsecPolicyPatchAuthenticationAlgorithmSha256Const = "sha256" - IPsecPolicyPatchAuthenticationAlgorithmSha512Const = "sha512" + IPsecPolicyPatchAuthenticationAlgorithmDisabledConst = "disabled" + IPsecPolicyPatchAuthenticationAlgorithmMd5Const = "md5" + IPsecPolicyPatchAuthenticationAlgorithmSha1Const = "sha1" + IPsecPolicyPatchAuthenticationAlgorithmSha256Const = "sha256" + IPsecPolicyPatchAuthenticationAlgorithmSha384Const = "sha384" + IPsecPolicyPatchAuthenticationAlgorithmSha512Const = "sha512" ) // Constants associated with the IPsecPolicyPatch.EncryptionAlgorithm property. -// The encryption algorithm. +// The encryption algorithm +// +// The `triple_des` algorithm has been deprecated +// +// The `authentication_algorithm` must be `disabled` if and only if +// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or +// `aes256gcm16`. const ( - IPsecPolicyPatchEncryptionAlgorithmAes128Const = "aes128" - IPsecPolicyPatchEncryptionAlgorithmAes256Const = "aes256" - IPsecPolicyPatchEncryptionAlgorithmTripleDesConst = "triple_des" + IPsecPolicyPatchEncryptionAlgorithmAes128Const = "aes128" + IPsecPolicyPatchEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" + IPsecPolicyPatchEncryptionAlgorithmAes192Const = "aes192" + IPsecPolicyPatchEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" + IPsecPolicyPatchEncryptionAlgorithmAes256Const = "aes256" + IPsecPolicyPatchEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" + IPsecPolicyPatchEncryptionAlgorithmTripleDesConst = "triple_des" ) // Constants associated with the IPsecPolicyPatch.Pfs property. -// Perfect Forward Secrecy. +// Perfect Forward Secrecy +// +// Groups `group_2` and `group_5` have been deprecated. const ( IPsecPolicyPatchPfsDisabledConst = "disabled" IPsecPolicyPatchPfsGroup14Const = "group_14" + IPsecPolicyPatchPfsGroup15Const = "group_15" + IPsecPolicyPatchPfsGroup16Const = "group_16" + IPsecPolicyPatchPfsGroup17Const = "group_17" + IPsecPolicyPatchPfsGroup18Const = "group_18" IPsecPolicyPatchPfsGroup19Const = "group_19" IPsecPolicyPatchPfsGroup2Const = "group_2" + IPsecPolicyPatchPfsGroup20Const = "group_20" + IPsecPolicyPatchPfsGroup21Const = "group_21" + IPsecPolicyPatchPfsGroup22Const = "group_22" + IPsecPolicyPatchPfsGroup23Const = "group_23" + IPsecPolicyPatchPfsGroup24Const = "group_24" + IPsecPolicyPatchPfsGroup31Const = "group_31" IPsecPolicyPatchPfsGroup5Const = "group_5" ) @@ -46133,6 +46297,11 @@ type ListVPNGatewaysOptions struct { // Filters the collection to resources in the resource group with the specified identifier. ResourceGroupID *string `json:"resource_group.id,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 VPN gateways with the specified mode. Mode *string `json:"mode,omitempty"` @@ -46140,6 +46309,15 @@ type ListVPNGatewaysOptions struct { Headers map[string]string } +// Constants associated with the ListVPNGatewaysOptions.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 ( + ListVPNGatewaysOptionsSortCreatedAtConst = "created_at" + ListVPNGatewaysOptionsSortNameConst = "name" +) + // Constants associated with the ListVPNGatewaysOptions.Mode property. // Filters the collection to VPN gateways with the specified mode. const ( @@ -46170,6 +46348,12 @@ func (_options *ListVPNGatewaysOptions) SetResourceGroupID(resourceGroupID strin return _options } +// SetSort : Allow user to set Sort +func (_options *ListVPNGatewaysOptions) SetSort(sort string) *ListVPNGatewaysOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + // SetMode : Allow user to set Mode func (_options *ListVPNGatewaysOptions) SetMode(mode string) *ListVPNGatewaysOptions { _options.Mode = core.StringPtr(mode) @@ -82903,3 +83087,3918 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } + +// +// VpcsPager can be used to simplify the use of the "ListVpcs" method. +// +type VpcsPager struct { + hasNext bool + options *ListVpcsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVpcsPager returns a new VpcsPager instance. +func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVpcsOptions = *options + pager = &VpcsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VpcsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVpcsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Vpcs + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, err error) { + for pager.HasNext() { + var nextPage []VPC + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VpcsPager) GetNext() (page []VPC, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VpcsPager) GetAll() (allItems []VPC, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// VPCAddressPrefixesPager can be used to simplify the use of the "ListVPCAddressPrefixes" method. +// +type VPCAddressPrefixesPager struct { + hasNext bool + options *ListVPCAddressPrefixesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCAddressPrefixesPager returns a new VPCAddressPrefixesPager instance. +func (vpc *VpcV1) NewVPCAddressPrefixesPager(options *ListVPCAddressPrefixesOptions) (pager *VPCAddressPrefixesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCAddressPrefixesOptions = *options + pager = &VPCAddressPrefixesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCAddressPrefixesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (page []AddressPrefix, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCAddressPrefixesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.AddressPrefixes + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (allItems []AddressPrefix, err error) { + for pager.HasNext() { + var nextPage []AddressPrefix + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCAddressPrefixesPager) GetNext() (page []AddressPrefix, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. +// +type VPCRoutesPager struct { + hasNext bool + options *ListVPCRoutesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCRoutesPager returns a new VPCRoutesPager instance. +func (vpc *VpcV1) NewVPCRoutesPager(options *ListVPCRoutesOptions) (pager *VPCRoutesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCRoutesOptions = *options + pager = &VPCRoutesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCRoutesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []Route, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCRoutesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Routes + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems []Route, err error) { + for pager.HasNext() { + var nextPage []Route + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutesPager) GetNext() (page []Route, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutesPager) GetAll() (allItems []Route, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// VPCRoutingTablesPager can be used to simplify the use of the "ListVPCRoutingTables" method. +// +type VPCRoutingTablesPager struct { + hasNext bool + options *ListVPCRoutingTablesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCRoutingTablesPager returns a new VPCRoutingTablesPager instance. +func (vpc *VpcV1) NewVPCRoutingTablesPager(options *ListVPCRoutingTablesOptions) (pager *VPCRoutingTablesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCRoutingTablesOptions = *options + pager = &VPCRoutingTablesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCRoutingTablesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCRoutingTablesPager) GetNextWithContext(ctx context.Context) (page []RoutingTable, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCRoutingTablesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.RoutingTables + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPCRoutingTablesPager) GetAllWithContext(ctx context.Context) (allItems []RoutingTable, err error) { + for pager.HasNext() { + var nextPage []RoutingTable + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutingTablesPager) GetNext() (page []RoutingTable, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutingTablesPager) GetAll() (allItems []RoutingTable, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. +// +type VPCRoutingTableRoutesPager struct { + hasNext bool + options *ListVPCRoutingTableRoutesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCRoutingTableRoutesPager returns a new VPCRoutingTableRoutesPager instance. +func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRoutesOptions) (pager *VPCRoutingTableRoutesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCRoutingTableRoutesOptions = *options + pager = &VPCRoutingTableRoutesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCRoutingTableRoutesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) (page []Route, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCRoutingTableRoutesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Routes + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) (allItems []Route, err error) { + for pager.HasNext() { + var nextPage []Route + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutingTableRoutesPager) GetNext() (page []Route, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// SubnetsPager can be used to simplify the use of the "ListSubnets" method. +// +type SubnetsPager struct { + hasNext bool + options *ListSubnetsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSubnetsPager returns a new SubnetsPager instance. +func (vpc *VpcV1) NewSubnetsPager(options *ListSubnetsOptions) (pager *SubnetsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSubnetsOptions = *options + pager = &SubnetsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SubnetsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subnet, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSubnetsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Subnet, err error) { + for pager.HasNext() { + var nextPage []Subnet + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SubnetsPager) GetNext() (page []Subnet, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SubnetsPager) GetAll() (allItems []Subnet, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. +// +type SubnetReservedIpsPager struct { + hasNext bool + options *ListSubnetReservedIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSubnetReservedIpsPager returns a new SubnetReservedIpsPager instance. +func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOptions) (pager *SubnetReservedIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSubnetReservedIpsOptions = *options + pager = &SubnetReservedIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SubnetReservedIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSubnetReservedIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { + for pager.HasNext() { + var nextPage []ReservedIP + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SubnetReservedIpsPager) GetNext() (page []ReservedIP, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// ImagesPager can be used to simplify the use of the "ListImages" method. +// +type ImagesPager struct { + hasNext bool + options *ListImagesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewImagesPager returns a new ImagesPager instance. +func (vpc *VpcV1) NewImagesPager(options *ListImagesOptions) (pager *ImagesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListImagesOptions = *options + pager = &ImagesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ImagesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ImagesPager) GetNextWithContext(ctx context.Context) (page []Image, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListImagesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Images + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ImagesPager) GetAllWithContext(ctx context.Context) (allItems []Image, err error) { + for pager.HasNext() { + var nextPage []Image + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ImagesPager) GetNext() (page []Image, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ImagesPager) GetAll() (allItems []Image, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// OperatingSystemsPager can be used to simplify the use of the "ListOperatingSystems" method. +// +type OperatingSystemsPager struct { + hasNext bool + options *ListOperatingSystemsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewOperatingSystemsPager returns a new OperatingSystemsPager instance. +func (vpc *VpcV1) NewOperatingSystemsPager(options *ListOperatingSystemsOptions) (pager *OperatingSystemsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListOperatingSystemsOptions = *options + pager = &OperatingSystemsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *OperatingSystemsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *OperatingSystemsPager) GetNextWithContext(ctx context.Context) (page []OperatingSystem, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListOperatingSystemsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.OperatingSystems + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *OperatingSystemsPager) GetAllWithContext(ctx context.Context) (allItems []OperatingSystem, err error) { + for pager.HasNext() { + var nextPage []OperatingSystem + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *OperatingSystemsPager) GetNext() (page []OperatingSystem, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *OperatingSystemsPager) GetAll() (allItems []OperatingSystem, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// KeysPager can be used to simplify the use of the "ListKeys" method. +// +type KeysPager struct { + hasNext bool + options *ListKeysOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewKeysPager returns a new KeysPager instance. +func (vpc *VpcV1) NewKeysPager(options *ListKeysOptions) (pager *KeysPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListKeysOptions = *options + pager = &KeysPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *KeysPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *KeysPager) GetNextWithContext(ctx context.Context) (page []Key, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListKeysWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Keys + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *KeysPager) GetAllWithContext(ctx context.Context) (allItems []Key, err error) { + for pager.HasNext() { + var nextPage []Key + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *KeysPager) GetNext() (page []Key, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *KeysPager) GetAll() (allItems []Key, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// InstancesPager can be used to simplify the use of the "ListInstances" method. +// +type InstancesPager struct { + hasNext bool + options *ListInstancesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstancesPager returns a new InstancesPager instance. +func (vpc *VpcV1) NewInstancesPager(options *ListInstancesOptions) (pager *InstancesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstancesOptions = *options + pager = &InstancesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstancesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstancesPager) GetNextWithContext(ctx context.Context) (page []Instance, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstancesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Instances + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstancesPager) GetAllWithContext(ctx context.Context) (allItems []Instance, err error) { + for pager.HasNext() { + var nextPage []Instance + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstancesPager) GetNext() (page []Instance, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstancesPager) GetAll() (allItems []Instance, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "ListInstanceNetworkInterfaceIps" method. +// +type InstanceNetworkInterfaceIpsPager struct { + hasNext bool + options *ListInstanceNetworkInterfaceIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceNetworkInterfaceIpsPager returns a new InstanceNetworkInterfaceIpsPager instance. +func (vpc *VpcV1) NewInstanceNetworkInterfaceIpsPager(options *ListInstanceNetworkInterfaceIpsOptions) (pager *InstanceNetworkInterfaceIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceNetworkInterfaceIpsOptions = *options + pager = &InstanceNetworkInterfaceIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceNetworkInterfaceIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceNetworkInterfaceIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Ips + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { + for pager.HasNext() { + var nextPage []ReservedIP + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceNetworkInterfaceIpsPager) GetNext() (page []ReservedIP, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. +// +type InstanceGroupsPager struct { + hasNext bool + options *ListInstanceGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupsPager returns a new InstanceGroupsPager instance. +func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pager *InstanceGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupsOptions = *options + pager = &InstanceGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.InstanceGroups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroup, err error) { + for pager.HasNext() { + var nextPage []InstanceGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupsPager) GetNext() (page []InstanceGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// InstanceGroupManagersPager can be used to simplify the use of the "ListInstanceGroupManagers" method. +// +type InstanceGroupManagersPager struct { + hasNext bool + options *ListInstanceGroupManagersOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupManagersPager returns a new InstanceGroupManagersPager instance. +func (vpc *VpcV1) NewInstanceGroupManagersPager(options *ListInstanceGroupManagersOptions) (pager *InstanceGroupManagersPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupManagersOptions = *options + pager = &InstanceGroupManagersPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupManagersPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupManagersPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupManagersWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Managers + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupManagersPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerIntf, err error) { + for pager.HasNext() { + var nextPage []InstanceGroupManagerIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagersPager) GetNext() (page []InstanceGroupManagerIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManagerIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// InstanceGroupManagerActionsPager can be used to simplify the use of the "ListInstanceGroupManagerActions" method. +// +type InstanceGroupManagerActionsPager struct { + hasNext bool + options *ListInstanceGroupManagerActionsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupManagerActionsPager returns a new InstanceGroupManagerActionsPager instance. +func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroupManagerActionsOptions) (pager *InstanceGroupManagerActionsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupManagerActionsOptions = *options + pager = &InstanceGroupManagerActionsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupManagerActionsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerActionIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupManagerActionsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Actions + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerActionIntf, err error) { + for pager.HasNext() { + var nextPage []InstanceGroupManagerActionIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagerActionsPager) GetNext() (page []InstanceGroupManagerActionIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagerActionsPager) GetAll() (allItems []InstanceGroupManagerActionIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// InstanceGroupManagerPoliciesPager can be used to simplify the use of the "ListInstanceGroupManagerPolicies" method. +// +type InstanceGroupManagerPoliciesPager struct { + hasNext bool + options *ListInstanceGroupManagerPoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupManagerPoliciesPager returns a new InstanceGroupManagerPoliciesPager instance. +func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGroupManagerPoliciesOptions) (pager *InstanceGroupManagerPoliciesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupManagerPoliciesOptions = *options + pager = &InstanceGroupManagerPoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupManagerPoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerPolicyIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupManagerPoliciesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Policies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerPolicyIntf, err error) { + for pager.HasNext() { + var nextPage []InstanceGroupManagerPolicyIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagerPoliciesPager) GetNext() (page []InstanceGroupManagerPolicyIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGroupManagerPolicyIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// InstanceGroupMembershipsPager can be used to simplify the use of the "ListInstanceGroupMemberships" method. +// +type InstanceGroupMembershipsPager struct { + hasNext bool + options *ListInstanceGroupMembershipsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupMembershipsPager returns a new InstanceGroupMembershipsPager instance. +func (vpc *VpcV1) NewInstanceGroupMembershipsPager(options *ListInstanceGroupMembershipsOptions) (pager *InstanceGroupMembershipsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupMembershipsOptions = *options + pager = &InstanceGroupMembershipsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupMembershipsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupMembership, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupMembershipsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Memberships + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupMembership, err error) { + for pager.HasNext() { + var nextPage []InstanceGroupMembership + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupMembershipsPager) GetNext() (page []InstanceGroupMembership, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMembership, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// DedicatedHostGroupsPager can be used to simplify the use of the "ListDedicatedHostGroups" method. +// +type DedicatedHostGroupsPager struct { + hasNext bool + options *ListDedicatedHostGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewDedicatedHostGroupsPager returns a new DedicatedHostGroupsPager instance. +func (vpc *VpcV1) NewDedicatedHostGroupsPager(options *ListDedicatedHostGroupsOptions) (pager *DedicatedHostGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListDedicatedHostGroupsOptions = *options + pager = &DedicatedHostGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *DedicatedHostGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *DedicatedHostGroupsPager) GetNextWithContext(ctx context.Context) (page []DedicatedHostGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListDedicatedHostGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Groups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *DedicatedHostGroupsPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHostGroup, err error) { + for pager.HasNext() { + var nextPage []DedicatedHostGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostGroupsPager) GetNext() (page []DedicatedHostGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostGroupsPager) GetAll() (allItems []DedicatedHostGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// DedicatedHostProfilesPager can be used to simplify the use of the "ListDedicatedHostProfiles" method. +// +type DedicatedHostProfilesPager struct { + hasNext bool + options *ListDedicatedHostProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewDedicatedHostProfilesPager returns a new DedicatedHostProfilesPager instance. +func (vpc *VpcV1) NewDedicatedHostProfilesPager(options *ListDedicatedHostProfilesOptions) (pager *DedicatedHostProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListDedicatedHostProfilesOptions = *options + pager = &DedicatedHostProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *DedicatedHostProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *DedicatedHostProfilesPager) GetNextWithContext(ctx context.Context) (page []DedicatedHostProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListDedicatedHostProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 *DedicatedHostProfilesPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHostProfile, err error) { + for pager.HasNext() { + var nextPage []DedicatedHostProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostProfilesPager) GetNext() (page []DedicatedHostProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostProfilesPager) GetAll() (allItems []DedicatedHostProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// DedicatedHostsPager can be used to simplify the use of the "ListDedicatedHosts" method. +// +type DedicatedHostsPager struct { + hasNext bool + options *ListDedicatedHostsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewDedicatedHostsPager returns a new DedicatedHostsPager instance. +func (vpc *VpcV1) NewDedicatedHostsPager(options *ListDedicatedHostsOptions) (pager *DedicatedHostsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListDedicatedHostsOptions = *options + pager = &DedicatedHostsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *DedicatedHostsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *DedicatedHostsPager) GetNextWithContext(ctx context.Context) (page []DedicatedHost, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListDedicatedHostsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.DedicatedHosts + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *DedicatedHostsPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHost, err error) { + for pager.HasNext() { + var nextPage []DedicatedHost + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostsPager) GetNext() (page []DedicatedHost, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostsPager) GetAll() (allItems []DedicatedHost, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. +// +type BackupPoliciesPager struct { + hasNext bool + options *ListBackupPoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBackupPoliciesPager returns a new BackupPoliciesPager instance. +func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pager *BackupPoliciesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBackupPoliciesOptions = *options + pager = &BackupPoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BackupPoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicy, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBackupPoliciesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.BackupPolicies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicy, err error) { + for pager.HasNext() { + var nextPage []BackupPolicy + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BackupPoliciesPager) GetNext() (page []BackupPolicy, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BackupPoliciesPager) GetAll() (allItems []BackupPolicy, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// PlacementGroupsPager can be used to simplify the use of the "ListPlacementGroups" method. +// +type PlacementGroupsPager struct { + hasNext bool + options *ListPlacementGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewPlacementGroupsPager returns a new PlacementGroupsPager instance. +func (vpc *VpcV1) NewPlacementGroupsPager(options *ListPlacementGroupsOptions) (pager *PlacementGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListPlacementGroupsOptions = *options + pager = &PlacementGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *PlacementGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *PlacementGroupsPager) GetNextWithContext(ctx context.Context) (page []PlacementGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListPlacementGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.PlacementGroups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *PlacementGroupsPager) GetAllWithContext(ctx context.Context) (allItems []PlacementGroup, err error) { + for pager.HasNext() { + var nextPage []PlacementGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *PlacementGroupsPager) GetNext() (page []PlacementGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *PlacementGroupsPager) GetAll() (allItems []PlacementGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. +// +type BareMetalServerProfilesPager struct { + hasNext bool + options *ListBareMetalServerProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. +func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBareMetalServerProfilesOptions = *options + pager = &BareMetalServerProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BareMetalServerProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBareMetalServerProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfile, err error) { + for pager.HasNext() { + var nextPage []BareMetalServerProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. +// +type BareMetalServersPager struct { + hasNext bool + options *ListBareMetalServersOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBareMetalServersPager returns a new BareMetalServersPager instance. +func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBareMetalServersOptions = *options + pager = &BareMetalServersPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BareMetalServersPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (page []BareMetalServer, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBareMetalServersWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.BareMetalServers + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServer, err error) { + for pager.HasNext() { + var nextPage []BareMetalServer + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServersPager) GetNext() (page []BareMetalServer, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. +// +type BareMetalServerNetworkInterfacesPager struct { + hasNext bool + options *ListBareMetalServerNetworkInterfacesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBareMetalServerNetworkInterfacesOptions = *options + pager = &BareMetalServerNetworkInterfacesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BareMetalServerNetworkInterfacesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkInterfaceIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.NetworkInterfaces + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkInterfaceIntf, err error) { + for pager.HasNext() { + var nextPage []BareMetalServerNetworkInterfaceIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerNetworkInterfacesPager) GetNext() (page []BareMetalServerNetworkInterfaceIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// VolumeProfilesPager can be used to simplify the use of the "ListVolumeProfiles" method. +// +type VolumeProfilesPager struct { + hasNext bool + options *ListVolumeProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVolumeProfilesPager returns a new VolumeProfilesPager instance. +func (vpc *VpcV1) NewVolumeProfilesPager(options *ListVolumeProfilesOptions) (pager *VolumeProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVolumeProfilesOptions = *options + pager = &VolumeProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VolumeProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VolumeProfilesPager) GetNextWithContext(ctx context.Context) (page []VolumeProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVolumeProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 *VolumeProfilesPager) GetAllWithContext(ctx context.Context) (allItems []VolumeProfile, err error) { + for pager.HasNext() { + var nextPage []VolumeProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VolumeProfilesPager) GetNext() (page []VolumeProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VolumeProfilesPager) GetAll() (allItems []VolumeProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// VolumesPager can be used to simplify the use of the "ListVolumes" method. +// +type VolumesPager struct { + hasNext bool + options *ListVolumesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVolumesPager returns a new VolumesPager instance. +func (vpc *VpcV1) NewVolumesPager(options *ListVolumesOptions) (pager *VolumesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVolumesOptions = *options + pager = &VolumesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VolumesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VolumesPager) GetNextWithContext(ctx context.Context) (page []Volume, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVolumesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Volumes + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VolumesPager) GetAllWithContext(ctx context.Context) (allItems []Volume, err error) { + for pager.HasNext() { + var nextPage []Volume + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VolumesPager) GetNext() (page []Volume, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VolumesPager) GetAll() (allItems []Volume, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// SnapshotsPager can be used to simplify the use of the "ListSnapshots" method. +// +type SnapshotsPager struct { + hasNext bool + options *ListSnapshotsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSnapshotsPager returns a new SnapshotsPager instance. +func (vpc *VpcV1) NewSnapshotsPager(options *ListSnapshotsOptions) (pager *SnapshotsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSnapshotsOptions = *options + pager = &SnapshotsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SnapshotsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SnapshotsPager) GetNextWithContext(ctx context.Context) (page []Snapshot, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSnapshotsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Snapshots + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SnapshotsPager) GetAllWithContext(ctx context.Context) (allItems []Snapshot, err error) { + for pager.HasNext() { + var nextPage []Snapshot + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SnapshotsPager) GetNext() (page []Snapshot, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SnapshotsPager) GetAll() (allItems []Snapshot, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. +// +type PublicGatewaysPager struct { + hasNext bool + options *ListPublicGatewaysOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewPublicGatewaysPager returns a new PublicGatewaysPager instance. +func (vpc *VpcV1) NewPublicGatewaysPager(options *ListPublicGatewaysOptions) (pager *PublicGatewaysPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListPublicGatewaysOptions = *options + pager = &PublicGatewaysPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *PublicGatewaysPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page []PublicGateway, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListPublicGatewaysWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.PublicGateways + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []PublicGateway, err error) { + for pager.HasNext() { + var nextPage []PublicGateway + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *PublicGatewaysPager) GetNext() (page []PublicGateway, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *PublicGatewaysPager) GetAll() (allItems []PublicGateway, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. +// +type FloatingIpsPager struct { + hasNext bool + options *ListFloatingIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewFloatingIpsPager returns a new FloatingIpsPager instance. +func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *FloatingIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListFloatingIpsOptions = *options + pager = &FloatingIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *FloatingIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListFloatingIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.FloatingIps + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIP, err error) { + for pager.HasNext() { + var nextPage []FloatingIP + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *FloatingIpsPager) GetNext() (page []FloatingIP, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. +// +type NetworkAclsPager struct { + hasNext bool + options *ListNetworkAclsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewNetworkAclsPager returns a new NetworkAclsPager instance. +func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *NetworkAclsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListNetworkAclsOptions = *options + pager = &NetworkAclsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *NetworkAclsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []NetworkACL, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListNetworkAclsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.NetworkAcls + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACL, err error) { + for pager.HasNext() { + var nextPage []NetworkACL + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *NetworkAclsPager) GetNext() (page []NetworkACL, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// NetworkACLRulesPager can be used to simplify the use of the "ListNetworkACLRules" method. +// +type NetworkACLRulesPager struct { + hasNext bool + options *ListNetworkACLRulesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewNetworkACLRulesPager returns a new NetworkACLRulesPager instance. +func (vpc *VpcV1) NewNetworkACLRulesPager(options *ListNetworkACLRulesOptions) (pager *NetworkACLRulesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListNetworkACLRulesOptions = *options + pager = &NetworkACLRulesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *NetworkACLRulesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *NetworkACLRulesPager) GetNextWithContext(ctx context.Context) (page []NetworkACLRuleItemIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListNetworkACLRulesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Rules + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACLRuleItemIntf, err error) { + for pager.HasNext() { + var nextPage []NetworkACLRuleItemIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *NetworkACLRulesPager) GetNext() (page []NetworkACLRuleItemIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. +// +type SecurityGroupsPager struct { + hasNext bool + options *ListSecurityGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSecurityGroupsPager returns a new SecurityGroupsPager instance. +func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pager *SecurityGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSecurityGroupsOptions = *options + pager = &SecurityGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SecurityGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSecurityGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.SecurityGroups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroup, err error) { + for pager.HasNext() { + var nextPage []SecurityGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SecurityGroupsPager) GetNext() (page []SecurityGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// SecurityGroupTargetsPager can be used to simplify the use of the "ListSecurityGroupTargets" method. +// +type SecurityGroupTargetsPager struct { + hasNext bool + options *ListSecurityGroupTargetsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSecurityGroupTargetsPager returns a new SecurityGroupTargetsPager instance. +func (vpc *VpcV1) NewSecurityGroupTargetsPager(options *ListSecurityGroupTargetsOptions) (pager *SecurityGroupTargetsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSecurityGroupTargetsOptions = *options + pager = &SecurityGroupTargetsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SecurityGroupTargetsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroupTargetReferenceIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSecurityGroupTargetsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Targets + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroupTargetReferenceIntf, err error) { + for pager.HasNext() { + var nextPage []SecurityGroupTargetReferenceIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SecurityGroupTargetsPager) GetNext() (page []SecurityGroupTargetReferenceIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTargetReferenceIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// IkePoliciesPager can be used to simplify the use of the "ListIkePolicies" method. +// +type IkePoliciesPager struct { + hasNext bool + options *ListIkePoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewIkePoliciesPager returns a new IkePoliciesPager instance. +func (vpc *VpcV1) NewIkePoliciesPager(options *ListIkePoliciesOptions) (pager *IkePoliciesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListIkePoliciesOptions = *options + pager = &IkePoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *IkePoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *IkePoliciesPager) GetNextWithContext(ctx context.Context) (page []IkePolicy, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListIkePoliciesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.IkePolicies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *IkePoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IkePolicy, err error) { + for pager.HasNext() { + var nextPage []IkePolicy + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *IkePoliciesPager) GetNext() (page []IkePolicy, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *IkePoliciesPager) GetAll() (allItems []IkePolicy, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// IpsecPoliciesPager can be used to simplify the use of the "ListIpsecPolicies" method. +// +type IpsecPoliciesPager struct { + hasNext bool + options *ListIpsecPoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewIpsecPoliciesPager returns a new IpsecPoliciesPager instance. +func (vpc *VpcV1) NewIpsecPoliciesPager(options *ListIpsecPoliciesOptions) (pager *IpsecPoliciesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListIpsecPoliciesOptions = *options + pager = &IpsecPoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *IpsecPoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *IpsecPoliciesPager) GetNextWithContext(ctx context.Context) (page []IPsecPolicy, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListIpsecPoliciesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.IpsecPolicies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *IpsecPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IPsecPolicy, err error) { + for pager.HasNext() { + var nextPage []IPsecPolicy + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *IpsecPoliciesPager) GetNext() (page []IPsecPolicy, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *IpsecPoliciesPager) GetAll() (allItems []IPsecPolicy, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. +// +type VPNGatewaysPager struct { + hasNext bool + options *ListVPNGatewaysOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPNGatewaysPager returns a new VPNGatewaysPager instance. +func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *VPNGatewaysPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPNGatewaysOptions = *options + pager = &VPNGatewaysPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPNGatewaysPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPNGatewaysWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.VPNGateways + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayIntf, err error) { + for pager.HasNext() { + var nextPage []VPNGatewayIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPNGatewaysPager) GetNext() (page []VPNGatewayIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// VPNServersPager can be used to simplify the use of the "ListVPNServers" method. +// +type VPNServersPager struct { + hasNext bool + options *ListVPNServersOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPNServersPager returns a new VPNServersPager instance. +func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPNServersPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPNServersOptions = *options + pager = &VPNServersPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPNServersPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VPNServer, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPNServersWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.VPNServers + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems []VPNServer, err error) { + for pager.HasNext() { + var nextPage []VPNServer + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPNServersPager) GetNext() (page []VPNServer, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPNServersPager) GetAll() (allItems []VPNServer, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. +// +type VPNServerClientsPager struct { + hasNext bool + options *ListVPNServerClientsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPNServerClientsPager returns a new VPNServerClientsPager instance. +func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) (pager *VPNServerClientsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPNServerClientsOptions = *options + pager = &VPNServerClientsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPNServerClientsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (page []VPNServerClient, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPNServerClientsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Clients + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerClient, err error) { + for pager.HasNext() { + var nextPage []VPNServerClient + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPNServerClientsPager) GetNext() (page []VPNServerClient, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. +// +type VPNServerRoutesPager struct { + hasNext bool + options *ListVPNServerRoutesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPNServerRoutesPager returns a new VPNServerRoutesPager instance. +func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) (pager *VPNServerRoutesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPNServerRoutesOptions = *options + pager = &VPNServerRoutesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPNServerRoutesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page []VPNServerRoute, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPNServerRoutesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Routes + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerRoute, err error) { + for pager.HasNext() { + var nextPage []VPNServerRoute + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPNServerRoutesPager) GetNext() (page []VPNServerRoute, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// LoadBalancerProfilesPager can be used to simplify the use of the "ListLoadBalancerProfiles" method. +// +type LoadBalancerProfilesPager struct { + hasNext bool + options *ListLoadBalancerProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewLoadBalancerProfilesPager returns a new LoadBalancerProfilesPager instance. +func (vpc *VpcV1) NewLoadBalancerProfilesPager(options *ListLoadBalancerProfilesOptions) (pager *LoadBalancerProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListLoadBalancerProfilesOptions = *options + pager = &LoadBalancerProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *LoadBalancerProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *LoadBalancerProfilesPager) GetNextWithContext(ctx context.Context) (page []LoadBalancerProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListLoadBalancerProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 *LoadBalancerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []LoadBalancerProfile, err error) { + for pager.HasNext() { + var nextPage []LoadBalancerProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *LoadBalancerProfilesPager) GetNext() (page []LoadBalancerProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *LoadBalancerProfilesPager) GetAll() (allItems []LoadBalancerProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// LoadBalancersPager can be used to simplify the use of the "ListLoadBalancers" method. +// +type LoadBalancersPager struct { + hasNext bool + options *ListLoadBalancersOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewLoadBalancersPager returns a new LoadBalancersPager instance. +func (vpc *VpcV1) NewLoadBalancersPager(options *ListLoadBalancersOptions) (pager *LoadBalancersPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListLoadBalancersOptions = *options + pager = &LoadBalancersPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *LoadBalancersPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *LoadBalancersPager) GetNextWithContext(ctx context.Context) (page []LoadBalancer, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListLoadBalancersWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.LoadBalancers + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *LoadBalancersPager) GetAllWithContext(ctx context.Context) (allItems []LoadBalancer, err error) { + for pager.HasNext() { + var nextPage []LoadBalancer + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *LoadBalancersPager) GetNext() (page []LoadBalancer, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *LoadBalancersPager) GetAll() (allItems []LoadBalancer, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// EndpointGatewaysPager can be used to simplify the use of the "ListEndpointGateways" method. +// +type EndpointGatewaysPager struct { + hasNext bool + options *ListEndpointGatewaysOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewEndpointGatewaysPager returns a new EndpointGatewaysPager instance. +func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) (pager *EndpointGatewaysPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListEndpointGatewaysOptions = *options + pager = &EndpointGatewaysPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *EndpointGatewaysPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (page []EndpointGateway, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListEndpointGatewaysWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.EndpointGateways + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []EndpointGateway, err error) { + for pager.HasNext() { + var nextPage []EndpointGateway + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *EndpointGatewaysPager) GetNext() (page []EndpointGateway, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// EndpointGatewayIpsPager can be used to simplify the use of the "ListEndpointGatewayIps" method. +// +type EndpointGatewayIpsPager struct { + hasNext bool + options *ListEndpointGatewayIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewEndpointGatewayIpsPager returns a new EndpointGatewayIpsPager instance. +func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOptions) (pager *EndpointGatewayIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListEndpointGatewayIpsOptions = *options + pager = &EndpointGatewayIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *EndpointGatewayIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListEndpointGatewayIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Ips + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { + for pager.HasNext() { + var nextPage []ReservedIP + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *EndpointGatewayIpsPager) GetNext() (page []ReservedIP, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// FlowLogCollectorsPager can be used to simplify the use of the "ListFlowLogCollectors" method. +// +type FlowLogCollectorsPager struct { + hasNext bool + options *ListFlowLogCollectorsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewFlowLogCollectorsPager returns a new FlowLogCollectorsPager instance. +func (vpc *VpcV1) NewFlowLogCollectorsPager(options *ListFlowLogCollectorsOptions) (pager *FlowLogCollectorsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListFlowLogCollectorsOptions = *options + pager = &FlowLogCollectorsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *FlowLogCollectorsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *FlowLogCollectorsPager) GetNextWithContext(ctx context.Context) (page []FlowLogCollector, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListFlowLogCollectorsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.FlowLogCollectors + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *FlowLogCollectorsPager) GetAllWithContext(ctx context.Context) (allItems []FlowLogCollector, err error) { + for pager.HasNext() { + var nextPage []FlowLogCollector + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *FlowLogCollectorsPager) GetNext() (page []FlowLogCollector, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *FlowLogCollectorsPager) GetAll() (allItems []FlowLogCollector, err error) { + return pager.GetAllWithContext(context.Background()) +} diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go index 0eca12b220..133a3374a3 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go @@ -21,17 +21,16 @@ import ( "context" "fmt" "io" - "io/ioutil" "net/http" "net/http/httptest" "os" "time" "github.com/IBM/go-sdk-core/v5/core" - "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/go-openapi/strfmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + "github.com/IBM/vpc-go-sdk/vpcv1" ) var _ = Describe(`VpcV1`, func() { @@ -193,7 +192,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) // TODO: Add check for classic_access query parameter res.Header().Set("Content-type", "application/json") @@ -213,7 +212,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVpcsOptions model listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) listVpcsOptionsModel.Start = core.StringPtr("testString") - listVpcsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVpcsOptionsModel.Limit = core.Int64Ptr(int64(10)) listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) listVpcsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -250,7 +249,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) // TODO: Add check for classic_access query parameter // Sleep a short time to support a timeout test @@ -275,7 +274,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVpcsOptions model listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) listVpcsOptionsModel.Start = core.StringPtr("testString") - listVpcsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVpcsOptionsModel.Limit = core.Int64Ptr(int64(10)) listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) listVpcsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -317,7 +316,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) // TODO: Add check for classic_access query parameter // Set mock response @@ -344,7 +343,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVpcsOptions model listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) listVpcsOptionsModel.Start = core.StringPtr("testString") - listVpcsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVpcsOptionsModel.Limit = core.Int64Ptr(int64(10)) listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) listVpcsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -368,7 +367,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVpcsOptions model listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) listVpcsOptionsModel.Start = core.StringPtr("testString") - listVpcsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVpcsOptionsModel.Limit = core.Int64Ptr(int64(10)) listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) listVpcsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -406,7 +405,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVpcsOptions model listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) listVpcsOptionsModel.Start = core.StringPtr("testString") - listVpcsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVpcsOptionsModel.Limit = core.Int64Ptr(int64(10)) listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) listVpcsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -452,6 +451,82 @@ var _ = Describe(`VpcV1`, func() { 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(listVpcsPath)) + 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,"vpcs":[{"classic_access":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"default_routing_table":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","name":"my-routing-table-1","resource_type":"routing_table"},"default_security_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"vpcs":[{"classic_access":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"default_routing_table":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","name":"my-routing-table-1","resource_type":"routing_table"},"default_security_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use VpcsPager.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()) + + listVpcsOptionsModel := &vpcv1.ListVpcsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + ClassicAccess: core.BoolPtr(true), + } + + pager, err := vpcService.NewVpcsPager(listVpcsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.VPC + 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 VpcsPager.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()) + + listVpcsOptionsModel := &vpcv1.ListVpcsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + ClassicAccess: core.BoolPtr(true), + } + + pager, err := vpcService.NewVpcsPager(listVpcsOptionsModel) + 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(`CreateVPC(createVPCOptions *CreateVPCOptions) - Operation response error`, func() { version := "testString" @@ -2017,7 +2092,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -2036,7 +2111,7 @@ var _ = Describe(`VpcV1`, func() { listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCAddressPrefixesOptionsModel.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.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModel) @@ -2071,7 +2146,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -2095,7 +2170,7 @@ var _ = Describe(`VpcV1`, func() { listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCAddressPrefixesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -2135,7 +2210,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -2161,7 +2236,7 @@ var _ = Describe(`VpcV1`, func() { listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCAddressPrefixesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -2184,7 +2259,7 @@ var _ = Describe(`VpcV1`, func() { listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCAddressPrefixesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -2228,7 +2303,7 @@ var _ = Describe(`VpcV1`, func() { listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCAddressPrefixesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -2272,6 +2347,80 @@ var _ = Describe(`VpcV1`, func() { 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(listVPCAddressPrefixesPath)) + 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"},"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-2","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", `{"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-2","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 VPCAddressPrefixesPager.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()) + + listVPCAddressPrefixesOptionsModel := &vpcv1.ListVPCAddressPrefixesOptions{ + VPCID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewVPCAddressPrefixesPager(listVPCAddressPrefixesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.AddressPrefix + 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 VPCAddressPrefixesPager.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()) + + listVPCAddressPrefixesOptionsModel := &vpcv1.ListVPCAddressPrefixesOptions{ + VPCID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewVPCAddressPrefixesPager(listVPCAddressPrefixesOptionsModel) + 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(`CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) - Operation response error`, func() { version := "testString" @@ -3192,7 +3341,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + 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 {`) @@ -3212,7 +3361,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") listVPCRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutesOptionsModel.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.ListVPCRoutes(listVPCRoutesOptionsModel) @@ -3248,7 +3397,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + 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) @@ -3273,7 +3422,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") listVPCRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -3314,7 +3463,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + 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) @@ -3341,7 +3490,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") listVPCRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -3365,7 +3514,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") listVPCRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -3410,7 +3559,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") listVPCRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -3454,6 +3603,82 @@ var _ = Describe(`VpcV1`, func() { 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(listVPCRoutesPath)) + 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"},"routes":[{"action":"delegate","created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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","created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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 VPCRoutesPager.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()) + + listVPCRoutesOptionsModel := &vpcv1.ListVPCRoutesOptions{ + VPCID: core.StringPtr("testString"), + ZoneName: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewVPCRoutesPager(listVPCRoutesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.Route + 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 VPCRoutesPager.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()) + + listVPCRoutesOptionsModel := &vpcv1.ListVPCRoutesOptions{ + VPCID: core.StringPtr("testString"), + ZoneName: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewVPCRoutesPager(listVPCRoutesOptionsModel) + 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(`CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) - Operation response error`, func() { version := "testString" @@ -4393,7 +4618,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // TODO: Add check for is_default query parameter res.Header().Set("Content-type", "application/json") res.WriteHeader(200) @@ -4413,7 +4638,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) listVPCRoutingTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -4449,7 +4674,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // TODO: Add check for is_default query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) @@ -4474,7 +4699,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) listVPCRoutingTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -4515,7 +4740,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // TODO: Add check for is_default query parameter // Set mock response res.Header().Set("Content-type", "application/json") @@ -4542,7 +4767,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) listVPCRoutingTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -4566,7 +4791,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) listVPCRoutingTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -4611,7 +4836,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) listVPCRoutingTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -4656,26 +4881,30 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(BeNil()) }) }) - }) - Describe(`CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) - Operation response error`, func() { - version := "testString" - createVPCRoutingTablePath := "/vpcs/testString/routing_tables" - Context(`Using mock server endpoint with invalid JSON response`, 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(createVPCRoutingTablePath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.EscapedPath()).To(Equal(listVPCRoutingTablesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprint(res, `} this is not valid json {`) + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_gateway"}],"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","is_default":false,"lifecycle_state":"stable","name":"my-routing-table-1","resource_type":"routing_table","route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_gateway"}],"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","is_default":false,"lifecycle_state":"stable","name":"my-routing-table-1","resource_type":"routing_table","route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke CreateVPCRoutingTable with error: Operation response processing error`, func() { + It(`Use VPCRoutingTablesPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -4684,58 +4913,55 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the ResourceFilter model - resourceFilterModel := new(vpcv1.ResourceFilter) - resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + listVPCRoutingTablesOptionsModel := &vpcv1.ListVPCRoutingTablesOptions{ + VPCID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + IsDefault: core.BoolPtr(true), + } - // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + pager, err := vpcService.NewVPCRoutingTablesPager(listVPCRoutingTablesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") + var allResults []vpcv1.RoutingTable + 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 VPCRoutingTablesPager.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 RoutePrototype model - routePrototypeModel := new(vpcv1.RoutePrototype) - routePrototypeModel.Action = core.StringPtr("deliver") - routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") - routePrototypeModel.Name = core.StringPtr("my-route-1") - routePrototypeModel.NextHop = routePrototypeNextHopModel - routePrototypeModel.Zone = zoneIdentityModel + listVPCRoutingTablesOptionsModel := &vpcv1.ListVPCRoutingTablesOptions{ + VPCID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + IsDefault: core.BoolPtr(true), + } - // Construct an instance of the CreateVPCRoutingTableOptions model - createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) - createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") - createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} - createVPCRoutingTableOptionsModel.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.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + pager, err := vpcService.NewVPCRoutingTablesPager(listVPCRoutingTablesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - 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(`CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions)`, func() { + Describe(`CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) - Operation response error`, func() { version := "testString" createVPCRoutingTablePath := "/vpcs/testString/routing_tables" - Context(`Using mock server endpoint with timeout`, func() { + 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() @@ -4743,35 +4969,14 @@ var _ = Describe(`VpcV1`, func() { // Verify the contents of the request Expect(req.URL.EscapedPath()).To(Equal(createVPCRoutingTablePath)) 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{"testString"})) 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateVPCRoutingTable successfully with retries`, func() { + It(`Invoke CreateVPCRoutingTable with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -4779,7 +4984,6 @@ var _ = Describe(`VpcV1`, func() { }) Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - vpcService.EnableRetries(0, 0) // Construct an instance of the ResourceFilter model resourceFilterModel := new(vpcv1.ResourceFilter) @@ -4811,33 +5015,28 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} createVPCRoutingTableOptionsModel.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.CreateVPCRoutingTableWithContext(ctx, createVPCRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() + // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := vpcService.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) - Expect(operationErr).To(BeNil()) + Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = vpcService.CreateVPCRoutingTableWithContext(ctx, createVPCRoutingTableOptionsModel) + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - Context(`Using mock server endpoint`, func() { + }) + Describe(`CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions)`, func() { + version := "testString" + createVPCRoutingTablePath := "/vpcs/testString/routing_tables" + Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() @@ -4864,13 +5063,16 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) - It(`Invoke CreateVPCRoutingTable successfully`, func() { + It(`Invoke CreateVPCRoutingTable successfully with retries`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -4878,12 +5080,111 @@ var _ = Describe(`VpcV1`, func() { }) Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateVPCRoutingTable(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the ZoneIdentityByName model + zoneIdentityModel := new(vpcv1.ZoneIdentityByName) + zoneIdentityModel.Name = core.StringPtr("us-south-1") + + // Construct an instance of the RoutePrototype model + routePrototypeModel := new(vpcv1.RoutePrototype) + routePrototypeModel.Action = core.StringPtr("deliver") + routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") + routePrototypeModel.Name = core.StringPtr("my-route-1") + routePrototypeModel.NextHop = routePrototypeNextHopModel + routePrototypeModel.Zone = zoneIdentityModel + + // Construct an instance of the CreateVPCRoutingTableOptions model + createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) + createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} + createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") + createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} + createVPCRoutingTableOptionsModel.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.CreateVPCRoutingTableWithContext(ctx, createVPCRoutingTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) + 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.CreateVPCRoutingTableWithContext(ctx, createVPCRoutingTableOptionsModel) + 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(createVPCRoutingTablePath)) + 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{"testString"})) + 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + })) + }) + It(`Invoke CreateVPCRoutingTable 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.CreateVPCRoutingTable(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) // Construct an instance of the ResourceFilter model resourceFilterModel := new(vpcv1.ResourceFilter) @@ -5715,7 +6016,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -5735,7 +6036,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutingTableRoutesOptionsModel.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.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModel) @@ -5770,7 +6071,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -5795,7 +6096,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutingTableRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -5835,7 +6136,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -5862,7 +6163,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutingTableRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -5886,7 +6187,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutingTableRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -5931,7 +6232,7 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPCRoutingTableRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -5975,6 +6276,82 @@ var _ = Describe(`VpcV1`, func() { 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(listVPCRoutingTableRoutesPath)) + 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"},"routes":[{"action":"delegate","created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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","created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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 VPCRoutingTableRoutesPager.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()) + + listVPCRoutingTableRoutesOptionsModel := &vpcv1.ListVPCRoutingTableRoutesOptions{ + VPCID: core.StringPtr("testString"), + RoutingTableID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewVPCRoutingTableRoutesPager(listVPCRoutingTableRoutesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.Route + 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 VPCRoutingTableRoutesPager.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()) + + listVPCRoutingTableRoutesOptionsModel := &vpcv1.ListVPCRoutingTableRoutesOptions{ + VPCID: core.StringPtr("testString"), + RoutingTableID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewVPCRoutingTableRoutesPager(listVPCRoutingTableRoutesOptionsModel) + 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(`CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) - Operation response error`, func() { version := "testString" @@ -6931,7 +7308,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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()["routing_table.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["routing_table.name"]).To(Equal([]string{"testString"})) @@ -6952,7 +7329,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSubnetsOptions model listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) listSubnetsOptionsModel.Start = core.StringPtr("testString") - listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") @@ -6990,7 +7367,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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()["routing_table.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["routing_table.name"]).To(Equal([]string{"testString"})) @@ -7016,7 +7393,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSubnetsOptions model listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) listSubnetsOptionsModel.Start = core.StringPtr("testString") - listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") @@ -7059,7 +7436,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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()["routing_table.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["routing_table.name"]).To(Equal([]string{"testString"})) @@ -7087,7 +7464,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSubnetsOptions model listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) listSubnetsOptionsModel.Start = core.StringPtr("testString") - listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") @@ -7112,7 +7489,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSubnetsOptions model listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) listSubnetsOptionsModel.Start = core.StringPtr("testString") - listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") @@ -7151,7 +7528,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSubnetsOptions model listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) listSubnetsOptionsModel.Start = core.StringPtr("testString") - listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") @@ -7198,6 +7575,84 @@ var _ = Describe(`VpcV1`, func() { 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(listSubnetsPath)) + 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,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"public_gateway":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"public_gateway":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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 SubnetsPager.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()) + + listSubnetsOptionsModel := &vpcv1.ListSubnetsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + RoutingTableID: core.StringPtr("testString"), + RoutingTableName: core.StringPtr("testString"), + } + + pager, err := vpcService.NewSubnetsPager(listSubnetsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.Subnet + 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 SubnetsPager.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()) + + listSubnetsOptionsModel := &vpcv1.ListSubnetsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + RoutingTableID: core.StringPtr("testString"), + RoutingTableName: core.StringPtr("testString"), + } + + pager, err := vpcService.NewSubnetsPager(listSubnetsOptionsModel) + 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(`CreateSubnet(createSubnetOptions *CreateSubnetOptions) - Operation response error`, func() { version := "testString" @@ -9909,7 +10364,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -9929,7 +10384,7 @@ var _ = Describe(`VpcV1`, func() { listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") listSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -9965,7 +10420,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -9990,7 +10445,7 @@ var _ = Describe(`VpcV1`, func() { listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") listSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -10031,7 +10486,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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") @@ -10058,7 +10513,7 @@ var _ = Describe(`VpcV1`, func() { listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") listSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -10082,7 +10537,7 @@ var _ = Describe(`VpcV1`, func() { listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") listSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -10127,7 +10582,7 @@ var _ = Describe(`VpcV1`, func() { listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") listSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -10172,6 +10627,82 @@ var _ = Describe(`VpcV1`, func() { 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(listSubnetReservedIpsPath)) + 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":"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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"user","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"d7cc5196-9864-48c4-82d8-3f30da41fcc5","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"user","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"d7cc5196-9864-48c4-82d8-3f30da41fcc5","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use SubnetReservedIpsPager.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()) + + listSubnetReservedIpsOptionsModel := &vpcv1.ListSubnetReservedIpsOptions{ + SubnetID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewSubnetReservedIpsPager(listSubnetReservedIpsOptionsModel) + 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 SubnetReservedIpsPager.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()) + + listSubnetReservedIpsOptionsModel := &vpcv1.ListSubnetReservedIpsOptions{ + SubnetID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewSubnetReservedIpsPager(listSubnetReservedIpsOptionsModel) + 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(`CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) - Operation response error`, func() { version := "testString" @@ -11091,7 +11622,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["visibility"]).To(Equal([]string{"private"})) @@ -11112,7 +11643,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListImagesOptions model listImagesOptionsModel := new(vpcv1.ListImagesOptions) listImagesOptionsModel.Start = core.StringPtr("testString") - listImagesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listImagesOptionsModel.Limit = core.Int64Ptr(int64(10)) listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") listImagesOptionsModel.Name = core.StringPtr("testString") listImagesOptionsModel.Visibility = core.StringPtr("private") @@ -11150,7 +11681,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["visibility"]).To(Equal([]string{"private"})) @@ -11176,7 +11707,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListImagesOptions model listImagesOptionsModel := new(vpcv1.ListImagesOptions) listImagesOptionsModel.Start = core.StringPtr("testString") - listImagesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listImagesOptionsModel.Limit = core.Int64Ptr(int64(10)) listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") listImagesOptionsModel.Name = core.StringPtr("testString") listImagesOptionsModel.Visibility = core.StringPtr("private") @@ -11219,7 +11750,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["visibility"]).To(Equal([]string{"private"})) @@ -11247,7 +11778,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListImagesOptions model listImagesOptionsModel := new(vpcv1.ListImagesOptions) listImagesOptionsModel.Start = core.StringPtr("testString") - listImagesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listImagesOptionsModel.Limit = core.Int64Ptr(int64(10)) listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") listImagesOptionsModel.Name = core.StringPtr("testString") listImagesOptionsModel.Visibility = core.StringPtr("private") @@ -11272,7 +11803,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListImagesOptions model listImagesOptionsModel := new(vpcv1.ListImagesOptions) listImagesOptionsModel.Start = core.StringPtr("testString") - listImagesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listImagesOptionsModel.Limit = core.Int64Ptr(int64(10)) listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") listImagesOptionsModel.Name = core.StringPtr("testString") listImagesOptionsModel.Visibility = core.StringPtr("private") @@ -11311,7 +11842,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListImagesOptions model listImagesOptionsModel := new(vpcv1.ListImagesOptions) listImagesOptionsModel.Start = core.StringPtr("testString") - listImagesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listImagesOptionsModel.Limit = core.Int64Ptr(int64(10)) listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") listImagesOptionsModel.Name = core.StringPtr("testString") listImagesOptionsModel.Visibility = core.StringPtr("private") @@ -11358,6 +11889,84 @@ var _ = Describe(`VpcV1`, func() { 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(listImagesPath)) + 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"},"images":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":22,"name":"my-image","operating_system":{"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-16-amd64","name":"ubuntu-16-amd64","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"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-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"}],"visibility":"private"}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"images":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":22,"name":"my-image","operating_system":{"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-16-amd64","name":"ubuntu-16-amd64","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"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-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"}],"visibility":"private"}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use ImagesPager.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()) + + listImagesOptionsModel := &vpcv1.ListImagesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Visibility: core.StringPtr("private"), + } + + pager, err := vpcService.NewImagesPager(listImagesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.Image + 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 ImagesPager.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()) + + listImagesOptionsModel := &vpcv1.ListImagesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Visibility: core.StringPtr("private"), + } + + pager, err := vpcService.NewImagesPager(listImagesOptionsModel) + 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(`CreateImage(createImageOptions *CreateImageOptions) - Operation response error`, func() { version := "testString" @@ -12345,7 +12954,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -12363,7 +12972,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListOperatingSystemsOptions model listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") - listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(10)) listOperatingSystemsOptionsModel.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.ListOperatingSystems(listOperatingSystemsOptionsModel) @@ -12398,7 +13007,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -12421,7 +13030,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListOperatingSystemsOptions model listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") - listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(10)) listOperatingSystemsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -12461,7 +13070,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -12486,7 +13095,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListOperatingSystemsOptions model listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") - listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(10)) listOperatingSystemsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -12508,7 +13117,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListOperatingSystemsOptions model listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") - listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(10)) listOperatingSystemsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -12544,7 +13153,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListOperatingSystemsOptions model listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") - listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(10)) listOperatingSystemsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -12588,6 +13197,78 @@ var _ = Describe(`VpcV1`, func() { 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(listOperatingSystemsPath)) + 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"},"operating_systems":[{"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-16-amd64","name":"ubuntu-16-amd64","vendor":"Canonical","version":"16.04 LTS"}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"operating_systems":[{"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-16-amd64","name":"ubuntu-16-amd64","vendor":"Canonical","version":"16.04 LTS"}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use OperatingSystemsPager.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()) + + listOperatingSystemsOptionsModel := &vpcv1.ListOperatingSystemsOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewOperatingSystemsPager(listOperatingSystemsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.OperatingSystem + 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 OperatingSystemsPager.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()) + + listOperatingSystemsOptionsModel := &vpcv1.ListOperatingSystemsOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewOperatingSystemsPager(listOperatingSystemsOptionsModel) + 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(`GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) - Operation response error`, func() { version := "testString" @@ -12828,7 +13509,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -12846,7 +13527,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListKeysOptions model listKeysOptionsModel := new(vpcv1.ListKeysOptions) listKeysOptionsModel.Start = core.StringPtr("testString") - listKeysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) 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) @@ -12881,7 +13562,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -12904,7 +13585,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListKeysOptions model listKeysOptionsModel := new(vpcv1.ListKeysOptions) listKeysOptionsModel.Start = core.StringPtr("testString") - listKeysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) listKeysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -12944,7 +13625,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -12969,7 +13650,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListKeysOptions model listKeysOptionsModel := new(vpcv1.ListKeysOptions) listKeysOptionsModel.Start = core.StringPtr("testString") - listKeysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) listKeysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -12991,7 +13672,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListKeysOptions model listKeysOptionsModel := new(vpcv1.ListKeysOptions) listKeysOptionsModel.Start = core.StringPtr("testString") - listKeysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) listKeysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -13027,7 +13708,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListKeysOptions model listKeysOptionsModel := new(vpcv1.ListKeysOptions) listKeysOptionsModel.Start = core.StringPtr("testString") - listKeysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) listKeysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -13071,6 +13752,78 @@ var _ = Describe(`VpcV1`, func() { 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(listKeysPath)) + 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,"keys":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","length":2048,"name":"my-key","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":"rsa"}],"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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","length":2048,"name":"my-key","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":"rsa"}],"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use KeysPager.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()) + + listKeysOptionsModel := &vpcv1.ListKeysOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewKeysPager(listKeysOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.Key + 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 KeysPager.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()) + + listKeysOptionsModel := &vpcv1.ListKeysOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewKeysPager(listKeysOptionsModel) + 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(`CreateKey(createKeyOptions *CreateKeyOptions) - Operation response error`, func() { version := "testString" @@ -16066,7 +16819,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) @@ -16095,7 +16848,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListInstancesOptions model listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) listInstancesOptionsModel.Start = core.StringPtr("testString") - listInstancesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") listInstancesOptionsModel.Name = core.StringPtr("testString") listInstancesOptionsModel.VPCID = core.StringPtr("testString") @@ -16141,7 +16894,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) @@ -16175,7 +16928,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListInstancesOptions model listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) listInstancesOptionsModel.Start = core.StringPtr("testString") - listInstancesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") listInstancesOptionsModel.Name = core.StringPtr("testString") listInstancesOptionsModel.VPCID = core.StringPtr("testString") @@ -16226,7 +16979,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) @@ -16262,7 +17015,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListInstancesOptions model listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) listInstancesOptionsModel.Start = core.StringPtr("testString") - listInstancesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") listInstancesOptionsModel.Name = core.StringPtr("testString") listInstancesOptionsModel.VPCID = core.StringPtr("testString") @@ -16295,7 +17048,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListInstancesOptions model listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) listInstancesOptionsModel.Start = core.StringPtr("testString") - listInstancesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") listInstancesOptionsModel.Name = core.StringPtr("testString") listInstancesOptionsModel.VPCID = core.StringPtr("testString") @@ -16342,7 +17095,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListInstancesOptions model listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) listInstancesOptionsModel.Start = core.StringPtr("testString") - listInstancesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") listInstancesOptionsModel.Name = core.StringPtr("testString") listInstancesOptionsModel.VPCID = core.StringPtr("testString") @@ -16397,6 +17150,100 @@ var _ = Describe(`VpcV1`, func() { 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(listInstancesPath)) + 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"},"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"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}],"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-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":8,"metadata_service":{"enabled":false},"name":"my-instance","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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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_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},"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"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}],"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-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":8,"metadata_service":{"enabled":false},"name":"my-instance","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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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_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},"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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 InstancesPager.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()) + + listInstancesOptionsModel := &vpcv1.ListInstancesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + VPCID: core.StringPtr("testString"), + VPCCRN: core.StringPtr("testString"), + VPCName: core.StringPtr("testString"), + DedicatedHostID: core.StringPtr("testString"), + DedicatedHostCRN: core.StringPtr("testString"), + DedicatedHostName: core.StringPtr("testString"), + PlacementGroupID: core.StringPtr("testString"), + PlacementGroupCRN: core.StringPtr("testString"), + PlacementGroupName: core.StringPtr("testString"), + } + + pager, err := vpcService.NewInstancesPager(listInstancesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.Instance + 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 InstancesPager.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()) + + listInstancesOptionsModel := &vpcv1.ListInstancesOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + VPCID: core.StringPtr("testString"), + VPCCRN: core.StringPtr("testString"), + VPCName: core.StringPtr("testString"), + DedicatedHostID: core.StringPtr("testString"), + DedicatedHostCRN: core.StringPtr("testString"), + DedicatedHostName: core.StringPtr("testString"), + PlacementGroupID: core.StringPtr("testString"), + PlacementGroupCRN: core.StringPtr("testString"), + PlacementGroupName: core.StringPtr("testString"), + } + + pager, err := vpcService.NewInstancesPager(listInstancesOptionsModel) + 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(`CreateInstance(createInstanceOptions *CreateInstanceOptions) - Operation response error`, func() { version := "testString" @@ -21461,7 +22308,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -21481,7 +22328,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) @@ -21516,7 +22363,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -21541,7 +22388,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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 @@ -21581,7 +22428,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -21608,7 +22455,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -21632,7 +22479,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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("") @@ -21677,7 +22524,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceNetworkInterfaceIpsOptionsModel.InstanceID = core.StringPtr("testString") listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") listInstanceNetworkInterfaceIpsOptionsModel.Start = core.StringPtr("testString") - listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstanceNetworkInterfaceIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstanceNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -21721,6 +22568,82 @@ var _ = Describe(`VpcV1`, func() { 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"user","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"user","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"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 := "testString" @@ -23095,7 +24018,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -23113,7 +24036,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListInstanceGroupsOptions model listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.ListInstanceGroups(listInstanceGroupsOptionsModel) @@ -23148,7 +24071,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -23171,7 +24094,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListInstanceGroupsOptions model listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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 @@ -23211,7 +24134,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -23236,7 +24159,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListInstanceGroupsOptions model listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -23258,7 +24181,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListInstanceGroupsOptions model listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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("") @@ -23294,7 +24217,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListInstanceGroupsOptions model listInstanceGroupsOptionsModel := new(vpcv1.ListInstanceGroupsOptions) listInstanceGroupsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstanceGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstanceGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -23338,26 +24261,30 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(BeNil()) }) }) - }) - Describe(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) - Operation response error`, func() { - version := "testString" - createInstanceGroupPath := "/instance_groups" - Context(`Using mock server endpoint with invalid JSON response`, 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(createInstanceGroupPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + 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(201) - fmt.Fprint(res, `} this is not valid 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/123456::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/123456::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"},"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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/123456::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/123456::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"},"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke CreateInstanceGroup with error: Operation response processing error`, func() { + It(`Use InstanceGroupsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23366,59 +24293,51 @@ 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("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + listInstanceGroupsOptionsModel := &vpcv1.ListInstanceGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), + } - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") + pager, err := vpcService.NewInstanceGroupsPager(listInstanceGroupsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") + 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()) - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + listInstanceGroupsOptionsModel := &vpcv1.ListInstanceGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), + } - // 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.CreateInstanceGroup(createInstanceGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + pager, err := vpcService.NewInstanceGroupsPager(listInstanceGroupsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateInstanceGroup(createInstanceGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - 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(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions)`, func() { + Describe(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) - Operation response error`, func() { version := "testString" createInstanceGroupPath := "/instance_groups" - Context(`Using mock server endpoint with timeout`, func() { + 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() @@ -23426,35 +24345,14 @@ var _ = Describe(`VpcV1`, func() { // Verify the contents of the request Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupPath)) 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{"testString"})) 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", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceGroup successfully with retries`, func() { + It(`Invoke CreateInstanceGroup with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -23462,7 +24360,104 @@ var _ = Describe(`VpcV1`, func() { }) Expect(serviceErr).To(BeNil()) 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("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 LoadBalancerPoolIdentityByID model + loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) + 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.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.CreateInstanceGroup(createInstanceGroupOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions)`, func() { + version := "testString" + 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(createInstanceGroupPath)) + 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{"testString"})) + 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", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateInstanceGroup 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 InstanceTemplateIdentityByID model instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) @@ -24518,7 +25513,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -24537,7 +25532,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) @@ -24572,7 +25567,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -24596,7 +25591,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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 @@ -24636,7 +25631,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -24662,7 +25657,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -24685,7 +25680,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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("") @@ -24729,7 +25724,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagersOptionsModel := new(vpcv1.ListInstanceGroupManagersOptions) listInstanceGroupManagersOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagersOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstanceGroupManagersOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstanceGroupManagersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -24773,6 +25768,80 @@ var _ = Describe(`VpcV1`, func() { 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(listInstanceGroupManagersPath)) + 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,"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,"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 InstanceGroupManagersPager.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()) + + listInstanceGroupManagersOptionsModel := &vpcv1.ListInstanceGroupManagersOptions{ + InstanceGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceGroupManagersPager(listInstanceGroupManagersOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.InstanceGroupManagerIntf + 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 InstanceGroupManagersPager.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()) + + listInstanceGroupManagersOptionsModel := &vpcv1.ListInstanceGroupManagersOptions{ + InstanceGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceGroupManagersPager(listInstanceGroupManagersOptionsModel) + 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(`CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) - Operation response error`, func() { version := "testString" @@ -25727,7 +26796,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -25747,7 +26816,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) @@ -25782,7 +26851,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -25807,7 +26876,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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 @@ -25847,7 +26916,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -25874,7 +26943,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -25898,7 +26967,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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("") @@ -25943,7 +27012,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagerActionsOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") listInstanceGroupManagerActionsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstanceGroupManagerActionsOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstanceGroupManagerActionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -25987,26 +27056,30 @@ var _ = Describe(`VpcV1`, func() { Expect(value).To(BeNil()) }) }) - }) - Describe(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) - Operation response error`, func() { - version := "testString" - createInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions" - Context(`Using mock server endpoint with invalid JSON response`, 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(createInstanceGroupManagerActionPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.EscapedPath()).To(Equal(listInstanceGroupManagerActionsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprint(res, `} this is not valid 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,"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":"*/5 1,2,3 * * *","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,"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":"*/5 1,2,3 * * *","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(`Invoke CreateInstanceGroupManagerAction with error: Operation response processing error`, func() { + It(`Use InstanceGroupManagerActionsPager.GetNext successfully`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26015,44 +27088,55 @@ 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)) + listInstanceGroupManagerActionsOptionsModel := &vpcv1.ListInstanceGroupManagerActionsOptions{ + InstanceGroupID: core.StringPtr("testString"), + InstanceGroupManagerID: core.StringPtr("testString"), + Limit: 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 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.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + pager, err := vpcService.NewInstanceGroupManagerActionsPager(listInstanceGroupManagerActionsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + var allResults []vpcv1.InstanceGroupManagerActionIntf + 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 InstanceGroupManagerActionsPager.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()) + + listInstanceGroupManagerActionsOptionsModel := &vpcv1.ListInstanceGroupManagerActionsOptions{ + InstanceGroupID: core.StringPtr("testString"), + InstanceGroupManagerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceGroupManagerActionsPager(listInstanceGroupManagerActionsOptionsModel) + 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(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions)`, func() { + Describe(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) - Operation response error`, func() { version := "testString" createInstanceGroupManagerActionPath := "/instance_groups/testString/managers/testString/actions" - Context(`Using mock server endpoint with timeout`, func() { + 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() @@ -26060,35 +27144,14 @@ var _ = Describe(`VpcV1`, func() { // Verify the contents of the request Expect(req.URL.EscapedPath()).To(Equal(createInstanceGroupManagerActionPath)) 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{"testString"})) 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", `{"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": "*/5 1,2,3 * * *", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateInstanceGroupManagerAction successfully with retries`, func() { + It(`Invoke CreateInstanceGroupManagerAction with error: Operation response processing error`, func() { vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -26096,7 +27159,6 @@ var _ = Describe(`VpcV1`, func() { }) Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - vpcService.EnableRetries(0, 0) // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) @@ -26114,33 +27176,116 @@ var _ = Describe(`VpcV1`, func() { 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.CreateInstanceGroupManagerActionWithContext(ctx, createInstanceGroupManagerActionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() + // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) - Expect(operationErr).To(BeNil()) + Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = vpcService.CreateInstanceGroupManagerActionWithContext(ctx, createInstanceGroupManagerActionOptionsModel) + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - Context(`Using mock server endpoint`, func() { + }) + Describe(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions)`, func() { + version := "testString" + 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(createInstanceGroupManagerActionPath)) + 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{"testString"})) + 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", `{"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": "*/5 1,2,3 * * *", "last_applied_at": "2019-01-01T12:00:00.000Z", "next_run_at": "2019-01-01T12:00:00.000Z", "group": {"membership_count": 10}}`) + })) + }) + It(`Invoke CreateInstanceGroupManagerAction 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 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 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.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.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) + 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.CreateInstanceGroupManagerActionWithContext(ctx, createInstanceGroupManagerActionOptionsModel) + 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() @@ -26998,7 +28143,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -27018,7 +28163,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) @@ -27053,7 +28198,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -27078,7 +28223,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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 @@ -27118,7 +28263,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -27145,7 +28290,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -27169,7 +28314,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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("") @@ -27214,7 +28359,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID = core.StringPtr("testString") listInstanceGroupManagerPoliciesOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstanceGroupManagerPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstanceGroupManagerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -27258,6 +28403,82 @@ var _ = Describe(`VpcV1`, func() { 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(listInstanceGroupManagerPoliciesPath)) + 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,"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,"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 InstanceGroupManagerPoliciesPager.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()) + + listInstanceGroupManagerPoliciesOptionsModel := &vpcv1.ListInstanceGroupManagerPoliciesOptions{ + InstanceGroupID: core.StringPtr("testString"), + InstanceGroupManagerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceGroupManagerPoliciesPager(listInstanceGroupManagerPoliciesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.InstanceGroupManagerPolicyIntf + 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 InstanceGroupManagerPoliciesPager.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()) + + listInstanceGroupManagerPoliciesOptionsModel := &vpcv1.ListInstanceGroupManagerPoliciesOptions{ + InstanceGroupID: core.StringPtr("testString"), + InstanceGroupManagerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceGroupManagerPoliciesPager(listInstanceGroupManagerPoliciesOptionsModel) + 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(`CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) - Operation response error`, func() { version := "testString" @@ -28272,7 +29493,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -28291,7 +29512,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) @@ -28326,7 +29547,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -28350,7 +29571,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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 @@ -28390,7 +29611,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -28416,7 +29637,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -28439,7 +29660,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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("") @@ -28483,7 +29704,7 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupMembershipsOptionsModel := new(vpcv1.ListInstanceGroupMembershipsOptions) listInstanceGroupMembershipsOptionsModel.InstanceGroupID = core.StringPtr("testString") listInstanceGroupMembershipsOptionsModel.Start = core.StringPtr("testString") - listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listInstanceGroupMembershipsOptionsModel.Limit = core.Int64Ptr(int64(10)) listInstanceGroupMembershipsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -28527,6 +29748,80 @@ var _ = Describe(`VpcV1`, func() { 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(listInstanceGroupMembershipsPath)) + 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,"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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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", `{"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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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 InstanceGroupMembershipsPager.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()) + + listInstanceGroupMembershipsOptionsModel := &vpcv1.ListInstanceGroupMembershipsOptions{ + InstanceGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceGroupMembershipsPager(listInstanceGroupMembershipsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.InstanceGroupMembership + 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 InstanceGroupMembershipsPager.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()) + + listInstanceGroupMembershipsOptionsModel := &vpcv1.ListInstanceGroupMembershipsOptions{ + InstanceGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewInstanceGroupMembershipsPager(listInstanceGroupMembershipsOptionsModel) + 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(`DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions)`, func() { version := "testString" @@ -29144,7 +30439,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) @@ -29165,7 +30460,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListDedicatedHostGroupsOptions model listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("testString") listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") @@ -29203,7 +30498,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) @@ -29229,7 +30524,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListDedicatedHostGroupsOptions model listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("testString") listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") @@ -29272,7 +30567,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) @@ -29300,7 +30595,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListDedicatedHostGroupsOptions model listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("testString") listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") @@ -29325,7 +30620,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListDedicatedHostGroupsOptions model listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("testString") listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") @@ -29364,7 +30659,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListDedicatedHostGroupsOptions model listDedicatedHostGroupsOptionsModel := new(vpcv1.ListDedicatedHostGroupsOptions) listDedicatedHostGroupsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) listDedicatedHostGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") listDedicatedHostGroupsOptionsModel.ZoneName = core.StringPtr("testString") listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") @@ -29411,6 +30706,84 @@ var _ = Describe(`VpcV1`, func() { 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":"mx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"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"}],"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":"mx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"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"}],"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("testString"), + Name: core.StringPtr("testString"), + } + + 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("testString"), + Name: core.StringPtr("testString"), + } + + 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 := "testString" @@ -30326,7 +31699,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -30344,7 +31717,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListDedicatedHostProfilesOptions model listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) @@ -30379,7 +31752,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -30402,7 +31775,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListDedicatedHostProfilesOptions model listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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 @@ -30442,7 +31815,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -30467,7 +31840,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListDedicatedHostProfilesOptions model listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -30489,7 +31862,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListDedicatedHostProfilesOptions model listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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("") @@ -30525,7 +31898,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListDedicatedHostProfilesOptions model listDedicatedHostProfilesOptionsModel := new(vpcv1.ListDedicatedHostProfilesOptions) listDedicatedHostProfilesOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) listDedicatedHostProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -30569,6 +31942,78 @@ var _ = Describe(`VpcV1`, func() { 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":"mx2","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/1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16}}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"class":"mx2","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/1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16}}]}`) + } 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(`GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) - Operation response error`, func() { version := "testString" @@ -30810,7 +32255,7 @@ var _ = Describe(`VpcV1`, func() { 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) @@ -30832,7 +32277,7 @@ var _ = Describe(`VpcV1`, func() { listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("testString") listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") @@ -30871,7 +32316,7 @@ var _ = Describe(`VpcV1`, func() { 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) @@ -30898,7 +32343,7 @@ var _ = Describe(`VpcV1`, func() { listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("testString") listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") @@ -30942,7 +32387,7 @@ var _ = Describe(`VpcV1`, func() { 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) @@ -30971,7 +32416,7 @@ var _ = Describe(`VpcV1`, func() { listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("testString") listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") @@ -30997,7 +32442,7 @@ var _ = Describe(`VpcV1`, func() { listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("testString") listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") @@ -31037,7 +32482,7 @@ var _ = Describe(`VpcV1`, func() { listDedicatedHostsOptionsModel := new(vpcv1.ListDedicatedHostsOptions) listDedicatedHostsOptionsModel.DedicatedHostGroupID = core.StringPtr("testString") listDedicatedHostsOptionsModel.Start = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listDedicatedHostsOptionsModel.Limit = core.Int64Ptr(int64(10)) listDedicatedHostsOptionsModel.ResourceGroupID = core.StringPtr("testString") listDedicatedHostsOptionsModel.ZoneName = core.StringPtr("testString") listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") @@ -31084,6 +32529,86 @@ var _ = Describe(`VpcV1`, func() { 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},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}],"vcpu":{"architecture":"amd64","count":4},"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},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}],"vcpu":{"architecture":"amd64","count":4},"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("testString"), + Name: core.StringPtr("testString"), + } + + 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("testString"), + Name: core.StringPtr("testString"), + } + + 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() { version := "testString" @@ -32803,7 +34328,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) @@ -32824,7 +34349,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBackupPoliciesOptions model listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") @@ -32862,7 +34387,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) @@ -32888,7 +34413,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBackupPoliciesOptions model listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") @@ -32931,7 +34456,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["tag"]).To(Equal([]string{"testString"})) @@ -32959,7 +34484,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBackupPoliciesOptions model listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") @@ -32984,7 +34509,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBackupPoliciesOptions model listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") @@ -33023,7 +34548,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBackupPoliciesOptions model listBackupPoliciesOptionsModel := new(vpcv1.ListBackupPoliciesOptions) listBackupPoliciesOptionsModel.Start = core.StringPtr("testString") - listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBackupPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listBackupPoliciesOptionsModel.ResourceGroupID = core.StringPtr("testString") listBackupPoliciesOptionsModel.Name = core.StringPtr("testString") listBackupPoliciesOptionsModel.Tag = core.StringPtr("testString") @@ -33070,6 +34595,84 @@ var _ = Describe(`VpcV1`, func() { 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/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6","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_resource_types":["volume"],"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","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"}],"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/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6","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_resource_types":["volume"],"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","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"}],"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{}, + 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("testString"), + Tag: core.StringPtr("testString"), + } + + pager, err := vpcService.NewBackupPoliciesPager(listBackupPoliciesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.BackupPolicy + 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 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("testString"), + 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(`CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) - Operation response error`, func() { version := "testString" @@ -35588,7 +37191,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -35606,7 +37209,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListPlacementGroupsOptions model listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -35641,7 +37244,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -35664,7 +37267,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListPlacementGroupsOptions model listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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 @@ -35704,7 +37307,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -35729,7 +37332,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListPlacementGroupsOptions model listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -35751,7 +37354,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListPlacementGroupsOptions model listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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("") @@ -35787,7 +37390,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListPlacementGroupsOptions model listPlacementGroupsOptionsModel := new(vpcv1.ListPlacementGroupsOptions) listPlacementGroupsOptionsModel.Start = core.StringPtr("testString") - listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPlacementGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) listPlacementGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -35831,6 +37434,78 @@ var _ = Describe(`VpcV1`, func() { 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(listPlacementGroupsPath)) + 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,"placement_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::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/123456::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) + } + })) + }) + It(`Use PlacementGroupsPager.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()) + + listPlacementGroupsOptionsModel := &vpcv1.ListPlacementGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewPlacementGroupsPager(listPlacementGroupsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + 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)) + }) + It(`Use PlacementGroupsPager.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()) + + 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() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) Describe(`CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) - Operation response error`, func() { version := "testString" @@ -36723,7 +38398,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -36741,7 +38416,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBareMetalServerProfilesOptions model listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -36776,7 +38451,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -36799,7 +38474,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBareMetalServerProfilesOptions model listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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 @@ -36839,7 +38514,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -36864,7 +38539,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBareMetalServerProfilesOptions model listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -36886,7 +38561,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBareMetalServerProfilesOptions model listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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("") @@ -36922,7 +38597,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBareMetalServerProfilesOptions model listBareMetalServerProfilesOptionsModel := new(vpcv1.ListBareMetalServerProfilesOptions) listBareMetalServerProfilesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBareMetalServerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) listBareMetalServerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -36966,6 +38641,78 @@ var _ = Describe(`VpcV1`, func() { 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},"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":"nvme","type":"enum","values":["nvme"]}}],"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","os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["tpm_2"]}}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"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":"nvme","type":"enum","values":["nvme"]}}],"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","os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["tpm_2"]}}]}`) + } 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 := "testString" @@ -37206,7 +38953,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) @@ -37232,7 +38979,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBareMetalServersOptions model listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") listBareMetalServersOptionsModel.Name = core.StringPtr("testString") listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") @@ -37275,7 +39022,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) @@ -37306,7 +39053,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBareMetalServersOptions model listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") listBareMetalServersOptionsModel.Name = core.StringPtr("testString") listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") @@ -37354,7 +39101,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) @@ -37387,7 +39134,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBareMetalServersOptions model listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") listBareMetalServersOptionsModel.Name = core.StringPtr("testString") listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") @@ -37417,7 +39164,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBareMetalServersOptions model listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") listBareMetalServersOptionsModel.Name = core.StringPtr("testString") listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") @@ -37461,7 +39208,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBareMetalServersOptions model listBareMetalServersOptionsModel := new(vpcv1.ListBareMetalServersOptions) listBareMetalServersOptionsModel.Start = core.StringPtr("testString") - listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBareMetalServersOptionsModel.Limit = core.Int64Ptr(int64(10)) listBareMetalServersOptionsModel.ResourceGroupID = core.StringPtr("testString") listBareMetalServersOptionsModel.Name = core.StringPtr("testString") listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") @@ -37513,6 +39260,94 @@ var _ = Describe(`VpcV1`, func() { 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/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-bare-metal-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/123456::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":"nvme","name":"my-bare-metal-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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":"failed","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":"tpm_2"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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-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/123456::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":"nvme","name":"my-bare-metal-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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":"failed","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":"tpm_2"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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("testString"), + VPCID: core.StringPtr("testString"), + VPCCRN: core.StringPtr("testString"), + VPCName: core.StringPtr("testString"), + NetworkInterfacesSubnetID: core.StringPtr("testString"), + NetworkInterfacesSubnetCRN: core.StringPtr("testString"), + NetworkInterfacesSubnetName: core.StringPtr("testString"), + } + + 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("testString"), + VPCID: core.StringPtr("testString"), + VPCCRN: core.StringPtr("testString"), + VPCName: core.StringPtr("testString"), + NetworkInterfacesSubnetID: core.StringPtr("testString"), + NetworkInterfacesSubnetCRN: core.StringPtr("testString"), + NetworkInterfacesSubnetName: core.StringPtr("testString"), + } + + 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 := "testString" @@ -39169,7 +41004,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -39188,7 +41023,7 @@ var _ = Describe(`VpcV1`, func() { listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -39223,14 +41058,14 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}], "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", `{"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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "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_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}`) })) }) It(`Invoke ListBareMetalServerNetworkInterfaces successfully with retries`, func() { @@ -39247,7 +41082,7 @@ var _ = Describe(`VpcV1`, func() { listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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 @@ -39287,11 +41122,11 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}], "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", `{"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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "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_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}`) })) }) It(`Invoke ListBareMetalServerNetworkInterfaces successfully`, func() { @@ -39313,7 +41148,7 @@ var _ = Describe(`VpcV1`, func() { listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -39336,7 +41171,7 @@ var _ = Describe(`VpcV1`, func() { listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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("") @@ -39380,7 +41215,7 @@ var _ = Describe(`VpcV1`, func() { listBareMetalServerNetworkInterfacesOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfacesOptions) listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID = core.StringPtr("testString") listBareMetalServerNetworkInterfacesOptionsModel.Start = core.StringPtr("testString") - listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listBareMetalServerNetworkInterfacesOptionsModel.Limit = core.Int64Ptr(int64(10)) listBareMetalServerNetworkInterfacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -39424,6 +41259,80 @@ var _ = Describe(`VpcV1`, func() { 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/123456::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:0a:00:23:94","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","allowed_vlans":[4],"interface_type":"pci"}]}`) + } 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/123456::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:0a:00:23:94","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","allowed_vlans":[4],"interface_type":"pci"}]}`) + } 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 := "testString" @@ -39536,7 +41445,7 @@ 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}`) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}`) })) }) It(`Invoke CreateBareMetalServerNetworkInterface successfully with retries`, func() { @@ -39635,7 +41544,7 @@ 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}`) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}`) })) }) It(`Invoke CreateBareMetalServerNetworkInterface successfully`, func() { @@ -39957,7 +41866,7 @@ 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}`) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}`) })) }) It(`Invoke GetBareMetalServerNetworkInterface successfully with retries`, func() { @@ -40015,7 +41924,7 @@ 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}`) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}`) })) }) It(`Invoke GetBareMetalServerNetworkInterface successfully`, func() { @@ -40213,7 +42122,7 @@ 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}`) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}`) })) }) It(`Invoke UpdateBareMetalServerNetworkInterface successfully with retries`, func() { @@ -40297,7 +42206,7 @@ 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allow_interface_to_float": false, "interface_type": "vlan", "vlan": 4}`) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}`) })) }) It(`Invoke UpdateBareMetalServerNetworkInterface successfully`, func() { @@ -42737,7 +44646,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -42755,7 +44664,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVolumeProfilesOptions model listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -42790,7 +44699,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -42813,7 +44722,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVolumeProfilesOptions model listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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 @@ -42853,7 +44762,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -42878,7 +44787,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVolumeProfilesOptions model listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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) @@ -42900,7 +44809,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVolumeProfilesOptions model listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + 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("") @@ -42936,7 +44845,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVolumeProfilesOptions model listVolumeProfilesOptionsModel := new(vpcv1.ListVolumeProfilesOptions) listVolumeProfilesOptionsModel.Start = core.StringPtr("testString") - listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVolumeProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVolumeProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -42980,6 +44889,78 @@ var _ = Describe(`VpcV1`, func() { 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":[{"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","name":"general-purpose"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","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()) + + listVolumeProfilesOptionsModel := &vpcv1.ListVolumeProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewVolumeProfilesPager(listVolumeProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + 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()) + + listVolumeProfilesOptionsModel := &vpcv1.ListVolumeProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewVolumeProfilesPager(listVolumeProfilesOptionsModel) + 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(`GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) - Operation response error`, func() { version := "testString" @@ -43220,7 +45201,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") @@ -43240,7 +45221,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVolumesOptions model listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVolumesOptionsModel.Name = core.StringPtr("testString") listVolumesOptionsModel.ZoneName = core.StringPtr("testString") listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -43277,7 +45258,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test @@ -43302,7 +45283,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVolumesOptions model listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVolumesOptionsModel.Name = core.StringPtr("testString") listVolumesOptionsModel.ZoneName = core.StringPtr("testString") listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -43344,7 +45325,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["zone.name"]).To(Equal([]string{"testString"})) // Set mock response @@ -43371,7 +45352,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVolumesOptions model listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVolumesOptionsModel.Name = core.StringPtr("testString") listVolumesOptionsModel.ZoneName = core.StringPtr("testString") listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -43395,7 +45376,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVolumesOptions model listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVolumesOptionsModel.Name = core.StringPtr("testString") listVolumesOptionsModel.ZoneName = core.StringPtr("testString") listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -43433,7 +45414,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVolumesOptions model listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVolumesOptionsModel.Name = core.StringPtr("testString") listVolumesOptionsModel.ZoneName = core.StringPtr("testString") listVolumesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -43479,6 +45460,82 @@ var _ = Describe(`VpcV1`, func() { 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,"bandwidth":1000,"busy":true,"capacity":1000,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64"},"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"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-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,"bandwidth":1000,"busy":true,"capacity":1000,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64"},"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"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-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() { + 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("testString"), + ZoneName: 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("testString"), + ZoneName: 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(`CreateVolume(createVolumeOptions *CreateVolumeOptions) - Operation response error`, func() { version := "testString" @@ -44605,7 +46662,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) @@ -44632,7 +46689,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSnapshotsOptions model listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSnapshotsOptionsModel.Tag = core.StringPtr("testString") listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSnapshotsOptionsModel.Name = core.StringPtr("testString") @@ -44676,7 +46733,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) @@ -44708,7 +46765,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSnapshotsOptions model listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSnapshotsOptionsModel.Tag = core.StringPtr("testString") listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSnapshotsOptionsModel.Name = core.StringPtr("testString") @@ -44757,7 +46814,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) @@ -44791,7 +46848,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSnapshotsOptions model listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSnapshotsOptionsModel.Tag = core.StringPtr("testString") listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSnapshotsOptionsModel.Name = core.StringPtr("testString") @@ -44822,7 +46879,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSnapshotsOptions model listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSnapshotsOptionsModel.Tag = core.StringPtr("testString") listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSnapshotsOptionsModel.Name = core.StringPtr("testString") @@ -44867,7 +46924,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSnapshotsOptions model listSnapshotsOptionsModel := new(vpcv1.ListSnapshotsOptions) listSnapshotsOptionsModel.Start = core.StringPtr("testString") - listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSnapshotsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSnapshotsOptionsModel.Tag = core.StringPtr("testString") listSnapshotsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSnapshotsOptionsModel.Name = core.StringPtr("testString") @@ -44920,6 +46977,96 @@ var _ = Describe(`VpcV1`, func() { 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(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","resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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":{"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-16-amd64","name":"ubuntu-16-amd64","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,"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-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","resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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":{"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-16-amd64","name":"ubuntu-16-amd64","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,"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"},"user_tags":["UserTags"]}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use SnapshotsPager.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()) + + listSnapshotsOptionsModel := &vpcv1.ListSnapshotsOptions{ + Limit: core.Int64Ptr(int64(10)), + Tag: core.StringPtr("testString"), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + SourceVolumeID: core.StringPtr("testString"), + SourceVolumeCRN: core.StringPtr("testString"), + SourceImageID: core.StringPtr("testString"), + SourceImageCRN: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + BackupPolicyPlanID: core.StringPtr("testString"), + } + + pager, err := vpcService.NewSnapshotsPager(listSnapshotsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(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)) + }) + 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("testString"), + SourceVolumeID: core.StringPtr("testString"), + SourceVolumeCRN: core.StringPtr("testString"), + SourceImageID: core.StringPtr("testString"), + SourceImageCRN: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + BackupPolicyPlanID: core.StringPtr("testString"), + } + + 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(`CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) - Operation response error`, func() { version := "testString" @@ -46770,7 +48917,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -46789,7 +48936,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListPublicGatewaysOptions model listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") - listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") listPublicGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -46825,7 +48972,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -46849,7 +48996,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListPublicGatewaysOptions model listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") - listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") listPublicGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -46890,7 +49037,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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") @@ -46916,7 +49063,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListPublicGatewaysOptions model listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") - listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") listPublicGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -46939,7 +49086,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListPublicGatewaysOptions model listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") - listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") listPublicGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -46976,7 +49123,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListPublicGatewaysOptions model listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") - listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") listPublicGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -47021,6 +49168,80 @@ var _ = Describe(`VpcV1`, func() { 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(listPublicGatewaysPath)) + 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,"public_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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 PublicGatewaysPager.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()) + + listPublicGatewaysOptionsModel := &vpcv1.ListPublicGatewaysOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + } + + pager, err := vpcService.NewPublicGatewaysPager(listPublicGatewaysOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.PublicGateway + 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 PublicGatewaysPager.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()) + + listPublicGatewaysOptionsModel := &vpcv1.ListPublicGatewaysOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + } + + pager, err := vpcService.NewPublicGatewaysPager(listPublicGatewaysOptionsModel) + 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(`CreatePublicGateway(createPublicGatewayOptions *CreatePublicGatewayOptions) - Operation response error`, func() { version := "testString" @@ -47983,7 +50204,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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()["sort"]).To(Equal([]string{"name"})) res.Header().Set("Content-type", "application/json") @@ -48003,7 +50224,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListFloatingIpsOptions model listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) listFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFloatingIpsOptionsModel.Sort = core.StringPtr("name") listFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -48040,7 +50261,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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()["sort"]).To(Equal([]string{"name"})) // Sleep a short time to support a timeout test @@ -48065,7 +50286,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListFloatingIpsOptions model listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) listFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFloatingIpsOptionsModel.Sort = core.StringPtr("name") listFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -48107,7 +50328,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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()["sort"]).To(Equal([]string{"name"})) // Set mock response @@ -48134,7 +50355,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListFloatingIpsOptions model listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) listFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFloatingIpsOptionsModel.Sort = core.StringPtr("name") listFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -48158,7 +50379,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListFloatingIpsOptions model listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) listFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFloatingIpsOptionsModel.Sort = core.StringPtr("name") listFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -48196,7 +50417,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListFloatingIpsOptions model listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) listFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFloatingIpsOptionsModel.Sort = core.StringPtr("name") listFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -48242,6 +50463,82 @@ var _ = Describe(`VpcV1`, func() { 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(listFloatingIpsPath)) + 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,"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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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) + } + })) + }) + It(`Use FloatingIpsPager.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()) + + listFloatingIpsOptionsModel := &vpcv1.ListFloatingIpsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewFloatingIpsPager(listFloatingIpsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.FloatingIP + 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 FloatingIpsPager.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()) + + listFloatingIpsOptionsModel := &vpcv1.ListFloatingIpsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewFloatingIpsPager(listFloatingIpsOptionsModel) + 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(`CreateFloatingIP(createFloatingIPOptions *CreateFloatingIPOptions) - Operation response error`, func() { version := "testString" @@ -49199,7 +51496,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -49218,7 +51515,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListNetworkAclsOptions model listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) listNetworkAclsOptionsModel.Start = core.StringPtr("testString") - listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(10)) listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") listNetworkAclsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -49254,7 +51551,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -49278,7 +51575,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListNetworkAclsOptions model listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) listNetworkAclsOptionsModel.Start = core.StringPtr("testString") - listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(10)) listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") listNetworkAclsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -49319,7 +51616,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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") @@ -49345,7 +51642,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListNetworkAclsOptions model listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) listNetworkAclsOptionsModel.Start = core.StringPtr("testString") - listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(10)) listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") listNetworkAclsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -49368,7 +51665,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListNetworkAclsOptions model listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) listNetworkAclsOptionsModel.Start = core.StringPtr("testString") - listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(10)) listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") listNetworkAclsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -49405,7 +51702,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListNetworkAclsOptions model listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) listNetworkAclsOptionsModel.Start = core.StringPtr("testString") - listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(10)) listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") listNetworkAclsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -49450,6 +51747,80 @@ var _ = Describe(`VpcV1`, func() { 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(listNetworkAclsPath)) + 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"},"network_acls":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf","href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"network_acls":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf","href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use NetworkAclsPager.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()) + + listNetworkAclsOptionsModel := &vpcv1.ListNetworkAclsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + } + + pager, err := vpcService.NewNetworkAclsPager(listNetworkAclsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.NetworkACL + 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 NetworkAclsPager.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()) + + listNetworkAclsOptionsModel := &vpcv1.ListNetworkAclsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + } + + pager, err := vpcService.NewNetworkAclsPager(listNetworkAclsOptionsModel) + 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(`CreateNetworkACL(createNetworkACLOptions *CreateNetworkACLOptions) - Operation response error`, func() { version := "testString" @@ -50445,7 +52816,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["direction"]).To(Equal([]string{"inbound"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) @@ -50465,7 +52836,7 @@ var _ = Describe(`VpcV1`, func() { listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(10)) listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") listNetworkACLRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -50501,7 +52872,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["direction"]).To(Equal([]string{"inbound"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) @@ -50526,7 +52897,7 @@ var _ = Describe(`VpcV1`, func() { listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(10)) listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") listNetworkACLRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -50567,7 +52938,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["direction"]).To(Equal([]string{"inbound"})) // Set mock response res.Header().Set("Content-type", "application/json") @@ -50594,7 +52965,7 @@ var _ = Describe(`VpcV1`, func() { listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(10)) listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") listNetworkACLRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -50618,7 +52989,7 @@ var _ = Describe(`VpcV1`, func() { listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(10)) listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") listNetworkACLRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -50663,7 +53034,7 @@ var _ = Describe(`VpcV1`, func() { listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(10)) listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") listNetworkACLRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -50708,6 +53079,82 @@ var _ = Describe(`VpcV1`, func() { 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(listNetworkACLRulesPath)) + 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,"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}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"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}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use NetworkACLRulesPager.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()) + + listNetworkACLRulesOptionsModel := &vpcv1.ListNetworkACLRulesOptions{ + NetworkACLID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Direction: core.StringPtr("inbound"), + } + + pager, err := vpcService.NewNetworkACLRulesPager(listNetworkACLRulesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.NetworkACLRuleItemIntf + 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 NetworkACLRulesPager.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()) + + listNetworkACLRulesOptionsModel := &vpcv1.ListNetworkACLRulesOptions{ + NetworkACLID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Direction: core.StringPtr("inbound"), + } + + pager, err := vpcService.NewNetworkACLRulesPager(listNetworkACLRulesOptionsModel) + 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(`CreateNetworkACLRule(createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) - Operation response error`, func() { version := "testString" @@ -50740,15 +53187,19 @@ var _ = Describe(`VpcV1`, func() { networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype model - networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype model + networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) networkACLRulePrototypeModel.Action = core.StringPtr("allow") networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.Protocol = core.StringPtr("all") + networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePrototypeModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePrototypeModel.Protocol = core.StringPtr("udp") + networkACLRulePrototypeModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePrototypeModel.SourcePortMin = core.Int64Ptr(int64(49152)) // Construct an instance of the CreateNetworkACLRuleOptions model createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) @@ -50826,15 +53277,19 @@ var _ = Describe(`VpcV1`, func() { networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype model - networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype model + networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) networkACLRulePrototypeModel.Action = core.StringPtr("allow") networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.Protocol = core.StringPtr("all") + networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePrototypeModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePrototypeModel.Protocol = core.StringPtr("udp") + networkACLRulePrototypeModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePrototypeModel.SourcePortMin = core.Int64Ptr(int64(49152)) // Construct an instance of the CreateNetworkACLRuleOptions model createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) @@ -50919,15 +53374,19 @@ var _ = Describe(`VpcV1`, func() { networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype model - networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype model + networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) networkACLRulePrototypeModel.Action = core.StringPtr("allow") networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.Protocol = core.StringPtr("all") + networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePrototypeModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePrototypeModel.Protocol = core.StringPtr("udp") + networkACLRulePrototypeModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePrototypeModel.SourcePortMin = core.Int64Ptr(int64(49152)) // Construct an instance of the CreateNetworkACLRuleOptions model createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) @@ -50955,15 +53414,19 @@ var _ = Describe(`VpcV1`, func() { networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype model - networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype model + networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) networkACLRulePrototypeModel.Action = core.StringPtr("allow") networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.Protocol = core.StringPtr("all") + networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePrototypeModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePrototypeModel.Protocol = core.StringPtr("udp") + networkACLRulePrototypeModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePrototypeModel.SourcePortMin = core.Int64Ptr(int64(49152)) // Construct an instance of the CreateNetworkACLRuleOptions model createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) @@ -51012,15 +53475,19 @@ var _ = Describe(`VpcV1`, func() { networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype model - networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype model + networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) networkACLRulePrototypeModel.Action = core.StringPtr("allow") networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.Protocol = core.StringPtr("all") + networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePrototypeModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePrototypeModel.Protocol = core.StringPtr("udp") + networkACLRulePrototypeModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePrototypeModel.SourcePortMin = core.Int64Ptr(int64(49152)) // Construct an instance of the CreateNetworkACLRuleOptions model createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) @@ -51737,7 +54204,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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()["vpc.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) @@ -51759,7 +54226,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSecurityGroupsOptions model listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") @@ -51798,7 +54265,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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()["vpc.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) @@ -51825,7 +54292,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSecurityGroupsOptions model listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") @@ -51869,7 +54336,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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()["vpc.id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) @@ -51898,7 +54365,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSecurityGroupsOptions model listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") @@ -51924,7 +54391,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSecurityGroupsOptions model listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") @@ -51964,7 +54431,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSecurityGroupsOptions model listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") @@ -52012,6 +54479,86 @@ var _ = Describe(`VpcV1`, func() { 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(listSecurityGroupsPath)) + 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"},"security_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"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","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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"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","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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use SecurityGroupsPager.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()) + + listSecurityGroupsOptionsModel := &vpcv1.ListSecurityGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + VPCID: core.StringPtr("testString"), + VPCCRN: core.StringPtr("testString"), + VPCName: core.StringPtr("testString"), + } + + pager, err := vpcService.NewSecurityGroupsPager(listSecurityGroupsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.SecurityGroup + 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 SecurityGroupsPager.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()) + + listSecurityGroupsOptionsModel := &vpcv1.ListSecurityGroupsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + VPCID: core.StringPtr("testString"), + VPCCRN: core.StringPtr("testString"), + VPCName: core.StringPtr("testString"), + } + + pager, err := vpcService.NewSecurityGroupsPager(listSecurityGroupsOptionsModel) + 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(`CreateSecurityGroup(createSecurityGroupOptions *CreateSecurityGroupOptions) - Operation response error`, func() { version := "testString" @@ -52052,14 +54599,12 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") // Construct an instance of the CreateSecurityGroupOptions model createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) @@ -52147,14 +54692,12 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") // Construct an instance of the CreateSecurityGroupOptions model createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) @@ -52249,14 +54792,12 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") // Construct an instance of the CreateSecurityGroupOptions model createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) @@ -52294,14 +54835,12 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") // Construct an instance of the CreateSecurityGroupOptions model createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) @@ -52360,14 +54899,12 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") // Construct an instance of the CreateSecurityGroupOptions model createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) @@ -53236,14 +55773,12 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") // Construct an instance of the CreateSecurityGroupRuleOptions model createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) @@ -53321,14 +55856,12 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") // Construct an instance of the CreateSecurityGroupRuleOptions model createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) @@ -53413,14 +55946,12 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") // Construct an instance of the CreateSecurityGroupRuleOptions model createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) @@ -53448,14 +55979,12 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") // Construct an instance of the CreateSecurityGroupRuleOptions model createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) @@ -53504,14 +56033,12 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") // Construct an instance of the CreateSecurityGroupRuleOptions model createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) @@ -54198,7 +56725,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -54217,7 +56744,7 @@ var _ = Describe(`VpcV1`, func() { listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSecurityGroupTargetsOptionsModel.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.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModel) @@ -54252,7 +56779,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -54276,7 +56803,7 @@ var _ = Describe(`VpcV1`, func() { listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSecurityGroupTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -54316,7 +56843,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -54342,7 +56869,7 @@ var _ = Describe(`VpcV1`, func() { listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSecurityGroupTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -54365,7 +56892,7 @@ var _ = Describe(`VpcV1`, func() { listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSecurityGroupTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -54409,7 +56936,7 @@ var _ = Describe(`VpcV1`, func() { listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) listSecurityGroupTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -54453,6 +56980,80 @@ var _ = Describe(`VpcV1`, func() { 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(listSecurityGroupTargetsPath)) + 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,"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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-network-interface","resource_type":"network_interface"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use SecurityGroupTargetsPager.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()) + + listSecurityGroupTargetsOptionsModel := &vpcv1.ListSecurityGroupTargetsOptions{ + SecurityGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewSecurityGroupTargetsPager(listSecurityGroupTargetsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.SecurityGroupTargetReferenceIntf + 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 SecurityGroupTargetsPager.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()) + + listSecurityGroupTargetsOptionsModel := &vpcv1.ListSecurityGroupTargetsOptions{ + SecurityGroupID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewSecurityGroupTargetsPager(listSecurityGroupTargetsOptionsModel) + 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(`DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions)`, func() { version := "testString" @@ -55003,7 +57604,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -55021,7 +57622,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListIkePoliciesOptions model listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) listIkePoliciesOptionsModel.Start = core.StringPtr("testString") - listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listIkePoliciesOptionsModel.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.ListIkePolicies(listIkePoliciesOptionsModel) @@ -55056,7 +57657,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -55079,7 +57680,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListIkePoliciesOptions model listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) listIkePoliciesOptionsModel.Start = core.StringPtr("testString") - listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listIkePoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -55119,7 +57720,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -55144,7 +57745,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListIkePoliciesOptions model listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) listIkePoliciesOptionsModel.Start = core.StringPtr("testString") - listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listIkePoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -55166,7 +57767,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListIkePoliciesOptions model listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) listIkePoliciesOptionsModel.Start = core.StringPtr("testString") - listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listIkePoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -55202,7 +57803,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListIkePoliciesOptions model listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) listIkePoliciesOptionsModel.Start = core.StringPtr("testString") - listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listIkePoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -55246,6 +57847,78 @@ var _ = Describe(`VpcV1`, func() { 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(listIkePoliciesPath)) + 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,"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":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"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":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use IkePoliciesPager.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()) + + listIkePoliciesOptionsModel := &vpcv1.ListIkePoliciesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewIkePoliciesPager(listIkePoliciesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.IkePolicy + 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 IkePoliciesPager.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()) + + listIkePoliciesOptionsModel := &vpcv1.ListIkePoliciesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewIkePoliciesPager(listIkePoliciesOptionsModel) + 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(`CreateIkePolicy(createIkePolicyOptions *CreateIkePolicyOptions) - Operation response error`, func() { version := "testString" @@ -56353,7 +59026,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -56371,7 +59044,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListIpsecPoliciesOptions model listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") - listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listIpsecPoliciesOptionsModel.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.ListIpsecPolicies(listIpsecPoliciesOptionsModel) @@ -56406,14 +59079,14 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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/ipsec_policies?limit=20"}, "ipsec_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", "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": "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}`) })) }) It(`Invoke ListIpsecPolicies successfully with retries`, func() { @@ -56429,7 +59102,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListIpsecPoliciesOptions model listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") - listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listIpsecPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -56469,11 +59142,11 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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/ipsec_policies?limit=20"}, "ipsec_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", "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": "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}`) })) }) It(`Invoke ListIpsecPolicies successfully`, func() { @@ -56494,7 +59167,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListIpsecPoliciesOptions model listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") - listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listIpsecPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -56516,7 +59189,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListIpsecPoliciesOptions model listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") - listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listIpsecPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -56552,7 +59225,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListIpsecPoliciesOptions model listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") - listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) listIpsecPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -56596,6 +59269,78 @@ var _ = Describe(`VpcV1`, func() { 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(listIpsecPoliciesPath)) + 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"},"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"}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"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"}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use IpsecPoliciesPager.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()) + + listIpsecPoliciesOptionsModel := &vpcv1.ListIpsecPoliciesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewIpsecPoliciesPager(listIpsecPoliciesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.IPsecPolicy + 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 IpsecPoliciesPager.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()) + + listIpsecPoliciesOptionsModel := &vpcv1.ListIpsecPoliciesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewIpsecPoliciesPager(listIpsecPoliciesOptionsModel) + 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(`CreateIpsecPolicy(createIpsecPolicyOptions *CreateIpsecPolicyOptions) - Operation response error`, func() { version := "testString" @@ -56630,7 +59375,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the CreateIpsecPolicyOptions model createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) - createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("disabled") createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) @@ -56691,7 +59436,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"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", "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"}`) + fmt.Fprintf(res, "%s", `{"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"}`) })) }) It(`Invoke CreateIpsecPolicy successfully with retries`, func() { @@ -56710,7 +59455,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the CreateIpsecPolicyOptions model createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) - createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("disabled") createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) @@ -56773,7 +59518,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"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", "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"}`) + fmt.Fprintf(res, "%s", `{"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"}`) })) }) It(`Invoke CreateIpsecPolicy successfully`, func() { @@ -56797,7 +59542,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the CreateIpsecPolicyOptions model createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) - createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("disabled") createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) @@ -56827,7 +59572,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the CreateIpsecPolicyOptions model createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) - createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("disabled") createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) @@ -56878,7 +59623,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the CreateIpsecPolicyOptions model createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) - createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") + createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("disabled") createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) @@ -57041,7 +59786,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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", "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"}`) + fmt.Fprintf(res, "%s", `{"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"}`) })) }) It(`Invoke GetIpsecPolicy successfully with retries`, func() { @@ -57098,7 +59843,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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", "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"}`) + fmt.Fprintf(res, "%s", `{"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"}`) })) }) It(`Invoke GetIpsecPolicy successfully`, func() { @@ -57226,7 +59971,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the IPsecPolicyPatch model iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) - iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("md5") + iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("disabled") iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") @@ -57293,7 +60038,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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", "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"}`) + fmt.Fprintf(res, "%s", `{"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"}`) })) }) It(`Invoke UpdateIpsecPolicy successfully with retries`, func() { @@ -57308,7 +60053,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the IPsecPolicyPatch model iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) - iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("md5") + iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("disabled") iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") @@ -57377,7 +60122,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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", "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"}`) + fmt.Fprintf(res, "%s", `{"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"}`) })) }) It(`Invoke UpdateIpsecPolicy successfully`, func() { @@ -57397,7 +60142,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the IPsecPolicyPatch model iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) - iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("md5") + iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("disabled") iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") @@ -57429,7 +60174,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the IPsecPolicyPatch model iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) - iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("md5") + iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("disabled") iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") @@ -57482,7 +60227,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the IPsecPolicyPatch model iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) - iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("md5") + iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("disabled") iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") @@ -57748,8 +60493,9 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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()["sort"]).To(Equal([]string{"name"})) Expect(req.URL.Query()["mode"]).To(Equal([]string{"route"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) @@ -57768,8 +60514,9 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVPNGatewaysOptions model listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Sort = core.StringPtr("name") listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") listVPNGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -57805,8 +60552,9 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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()["sort"]).To(Equal([]string{"name"})) Expect(req.URL.Query()["mode"]).To(Equal([]string{"route"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) @@ -57830,8 +60578,9 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVPNGatewaysOptions model listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Sort = core.StringPtr("name") listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") listVPNGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -57872,8 +60621,9 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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()["sort"]).To(Equal([]string{"name"})) Expect(req.URL.Query()["mode"]).To(Equal([]string{"route"})) // Set mock response res.Header().Set("Content-type", "application/json") @@ -57899,8 +60649,9 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVPNGatewaysOptions model listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Sort = core.StringPtr("name") listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") listVPNGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -57923,8 +60674,9 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVPNGatewaysOptions model listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Sort = core.StringPtr("name") listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") listVPNGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -57961,8 +60713,9 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVPNGatewaysOptions model listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNGatewaysOptionsModel.Sort = core.StringPtr("name") listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") listVPNGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -58007,6 +60760,84 @@ var _ = Describe(`VpcV1`, func() { 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(listVPNGatewaysPath)) + 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,"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"ddf51bec-3424-11e8-b467-0ed5f89f718b","members":[{"private_ip":{"address":"192.168.3.4"},"public_ip":{"address":"192.168.3.4"},"role":"active","status":"available"}],"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","status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"mode":"route"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"ddf51bec-3424-11e8-b467-0ed5f89f718b","members":[{"private_ip":{"address":"192.168.3.4"},"public_ip":{"address":"192.168.3.4"},"role":"active","status":"available"}],"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","status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"mode":"route"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use VPNGatewaysPager.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()) + + listVPNGatewaysOptionsModel := &vpcv1.ListVPNGatewaysOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + Mode: core.StringPtr("route"), + } + + pager, err := vpcService.NewVPNGatewaysPager(listVPNGatewaysOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.VPNGatewayIntf + 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 VPNGatewaysPager.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()) + + listVPNGatewaysOptionsModel := &vpcv1.ListVPNGatewaysOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + Mode: core.StringPtr("route"), + } + + pager, err := vpcService.NewVPNGatewaysPager(listVPNGatewaysOptionsModel) + 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(`CreateVPNGateway(createVPNGatewayOptions *CreateVPNGatewayOptions) - Operation response error`, func() { version := "testString" @@ -61206,7 +64037,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + 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()["sort"]).To(Equal([]string{"name"})) res.Header().Set("Content-type", "application/json") @@ -61227,7 +64058,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) listVPNServersOptionsModel.Name = core.StringPtr("testString") listVPNServersOptionsModel.Start = core.StringPtr("testString") - listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") listVPNServersOptionsModel.Sort = core.StringPtr("name") listVPNServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -61265,7 +64096,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + 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()["sort"]).To(Equal([]string{"name"})) // Sleep a short time to support a timeout test @@ -61291,7 +64122,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) listVPNServersOptionsModel.Name = core.StringPtr("testString") listVPNServersOptionsModel.Start = core.StringPtr("testString") - listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") listVPNServersOptionsModel.Sort = core.StringPtr("name") listVPNServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -61334,7 +64165,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + 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()["sort"]).To(Equal([]string{"name"})) // Set mock response @@ -61362,7 +64193,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) listVPNServersOptionsModel.Name = core.StringPtr("testString") listVPNServersOptionsModel.Start = core.StringPtr("testString") - listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") listVPNServersOptionsModel.Sort = core.StringPtr("name") listVPNServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -61387,7 +64218,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) listVPNServersOptionsModel.Name = core.StringPtr("testString") listVPNServersOptionsModel.Start = core.StringPtr("testString") - listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") listVPNServersOptionsModel.Sort = core.StringPtr("name") listVPNServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -61426,7 +64257,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) listVPNServersOptionsModel.Name = core.StringPtr("testString") listVPNServersOptionsModel.Start = core.StringPtr("testString") - listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") listVPNServersOptionsModel.Sort = core.StringPtr("name") listVPNServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -61472,6 +64303,84 @@ var _ = Describe(`VpcV1`, func() { 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(listVPNServersPath)) + 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"},"vpn_servers":[{"certificate":{"crn":"crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5","enable_split_tunneling":true,"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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"protocol":"udp","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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"vpn_servers":[{"certificate":{"crn":"crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5","enable_split_tunneling":true,"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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"protocol":"udp","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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use VPNServersPager.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()) + + listVPNServersOptionsModel := &vpcv1.ListVPNServersOptions{ + Name: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewVPNServersPager(listVPNServersOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.VPNServer + 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 VPNServersPager.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()) + + listVPNServersOptionsModel := &vpcv1.ListVPNServersOptions{ + Name: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewVPNServersPager(listVPNServersOptionsModel) + 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(`CreateVPNServer(createVPNServerOptions *CreateVPNServerOptions) - Operation response error`, func() { version := "testString" @@ -62875,7 +65784,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"created_at"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) @@ -62895,7 +65804,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") listVPNServerClientsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -62931,7 +65840,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"created_at"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) @@ -62956,7 +65865,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") listVPNServerClientsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -62997,7 +65906,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) Expect(req.URL.Query()["sort"]).To(Equal([]string{"created_at"})) // Set mock response res.Header().Set("Content-type", "application/json") @@ -63024,7 +65933,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") listVPNServerClientsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -63048,7 +65957,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") listVPNServerClientsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -63093,7 +66002,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") listVPNServerClientsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -63138,6 +66047,82 @@ var _ = Describe(`VpcV1`, func() { 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(listVPNServerClientsPath)) + 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"},"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"}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + 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"}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use VPNServerClientsPager.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()) + + listVPNServerClientsOptionsModel := &vpcv1.ListVPNServerClientsOptions{ + VPNServerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("created_at"), + } + + pager, err := vpcService.NewVPNServerClientsPager(listVPNServerClientsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.VPNServerClient + 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 VPNServerClientsPager.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()) + + listVPNServerClientsOptionsModel := &vpcv1.ListVPNServerClientsOptions{ + VPNServerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("created_at"), + } + + pager, err := vpcService.NewVPNServerClientsPager(listVPNServerClientsOptionsModel) + 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(`DeleteVPNServerClient(deleteVPNServerClientOptions *DeleteVPNServerClientOptions)`, func() { version := "testString" @@ -63533,7 +66518,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -63553,7 +66538,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") listVPNServerRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -63589,7 +66574,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -63614,7 +66599,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") listVPNServerRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -63655,7 +66640,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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") @@ -63682,7 +66667,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") listVPNServerRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -63706,7 +66691,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") listVPNServerRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -63751,7 +66736,7 @@ var _ = Describe(`VpcV1`, func() { listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") listVPNServerRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -63796,6 +66781,82 @@ var _ = Describe(`VpcV1`, func() { 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(listVPNServerRoutesPath)) + 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"},"routes":[{"action":"deliver","created_at":"2019-01-01T12:00:00.000Z","destination":"192.168.3.0/24","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_state":"stable","name":"my-vpn-route-1","resource_type":"vpn_server_route"}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"routes":[{"action":"deliver","created_at":"2019-01-01T12:00:00.000Z","destination":"192.168.3.0/24","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_state":"stable","name":"my-vpn-route-1","resource_type":"vpn_server_route"}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use VPNServerRoutesPager.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()) + + listVPNServerRoutesOptionsModel := &vpcv1.ListVPNServerRoutesOptions{ + VPNServerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewVPNServerRoutesPager(listVPNServerRoutesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.VPNServerRoute + 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 VPNServerRoutesPager.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()) + + listVPNServerRoutesOptionsModel := &vpcv1.ListVPNServerRoutesOptions{ + VPNServerID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewVPNServerRoutesPager(listVPNServerRoutesOptionsModel) + 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(`CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) - Operation response error`, func() { version := "testString" @@ -64685,7 +67746,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -64703,7 +67764,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListLoadBalancerProfilesOptions model listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") - listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) listLoadBalancerProfilesOptionsModel.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.ListLoadBalancerProfiles(listLoadBalancerProfilesOptionsModel) @@ -64738,7 +67799,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -64761,7 +67822,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListLoadBalancerProfilesOptions model listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") - listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) listLoadBalancerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -64801,7 +67862,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -64826,7 +67887,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListLoadBalancerProfilesOptions model listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") - listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) listLoadBalancerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -64848,7 +67909,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListLoadBalancerProfilesOptions model listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") - listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) listLoadBalancerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -64884,7 +67945,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListLoadBalancerProfilesOptions model listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") - listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) listLoadBalancerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -64928,6 +67989,78 @@ var _ = Describe(`VpcV1`, func() { 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(listLoadBalancerProfilesPath)) + 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":[{"family":"network","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","logging_supported":{"type":"fixed","value":["datapath"]},"name":"network-fixed","route_mode_supported":{"type":"fixed","value":true},"security_groups_supported":{"type":"fixed","value":true},"udp_supported":{"type":"fixed","value":true}}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"family":"network","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","logging_supported":{"type":"fixed","value":["datapath"]},"name":"network-fixed","route_mode_supported":{"type":"fixed","value":true},"security_groups_supported":{"type":"fixed","value":true},"udp_supported":{"type":"fixed","value":true}}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use LoadBalancerProfilesPager.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()) + + listLoadBalancerProfilesOptionsModel := &vpcv1.ListLoadBalancerProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewLoadBalancerProfilesPager(listLoadBalancerProfilesOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.LoadBalancerProfile + 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 LoadBalancerProfilesPager.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()) + + listLoadBalancerProfilesOptionsModel := &vpcv1.ListLoadBalancerProfilesOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewLoadBalancerProfilesPager(listLoadBalancerProfilesOptionsModel) + 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(`GetLoadBalancerProfile(getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) - Operation response error`, func() { version := "testString" @@ -65168,7 +68301,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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 {`) @@ -65186,7 +68319,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListLoadBalancersOptions model listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) listLoadBalancersOptionsModel.Start = core.StringPtr("testString") - listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(10)) listLoadBalancersOptionsModel.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.ListLoadBalancers(listLoadBalancersOptionsModel) @@ -65221,7 +68354,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -65244,7 +68377,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListLoadBalancersOptions model listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) listLoadBalancersOptionsModel.Start = core.StringPtr("testString") - listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(10)) listLoadBalancersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -65284,7 +68417,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -65309,7 +68442,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListLoadBalancersOptions model listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) listLoadBalancersOptionsModel.Start = core.StringPtr("testString") - listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(10)) listLoadBalancersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -65331,7 +68464,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListLoadBalancersOptions model listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) listLoadBalancersOptionsModel.Start = core.StringPtr("testString") - listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(10)) listLoadBalancersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -65367,7 +68500,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListLoadBalancersOptions model listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) listLoadBalancersOptionsModel.Start = core.StringPtr("testString") - listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(10)) listLoadBalancersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -65411,6 +68544,78 @@ var _ = Describe(`VpcV1`, func() { 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(listLoadBalancersPath)) + 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,"load_balancers":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727","hostname":"my-load-balancer-123456-us-south-1.lb.bluemix.net","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"dd754295-e9e0-4c9d-bf6c-58fbc59e5727","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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"load_balancers":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727","hostname":"my-load-balancer-123456-us-south-1.lb.bluemix.net","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"dd754295-e9e0-4c9d-bf6c-58fbc59e5727","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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use LoadBalancersPager.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()) + + listLoadBalancersOptionsModel := &vpcv1.ListLoadBalancersOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewLoadBalancersPager(listLoadBalancersOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.LoadBalancer + 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 LoadBalancersPager.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()) + + listLoadBalancersOptionsModel := &vpcv1.ListLoadBalancersOptions{ + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := vpcService.NewLoadBalancersPager(listLoadBalancersOptionsModel) + 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(`CreateLoadBalancer(createLoadBalancerOptions *CreateLoadBalancerOptions) - Operation response error`, func() { version := "testString" @@ -66170,7 +69375,7 @@ var _ = Describe(`VpcV1`, func() { 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{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + res.WriteHeader(202) })) }) It(`Invoke DeleteLoadBalancer successfully`, func() { @@ -67785,7 +70990,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + res.WriteHeader(202) })) }) It(`Invoke DeleteLoadBalancerListener successfully`, func() { @@ -69089,7 +72294,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + res.WriteHeader(202) })) }) It(`Invoke DeleteLoadBalancerListenerPolicy successfully`, func() { @@ -70255,7 +73460,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + res.WriteHeader(202) })) }) It(`Invoke DeleteLoadBalancerListenerPolicyRule successfully`, func() { @@ -71533,7 +74738,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + res.WriteHeader(202) })) }) It(`Invoke DeleteLoadBalancerPool successfully`, func() { @@ -73074,7 +76279,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + res.WriteHeader(202) })) }) It(`Invoke DeleteLoadBalancerPoolMember successfully`, func() { @@ -73719,7 +76924,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + 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) @@ -73739,7 +76944,7 @@ var _ = Describe(`VpcV1`, func() { listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") listEndpointGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -73776,7 +76981,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + 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) @@ -73801,7 +77006,7 @@ var _ = Describe(`VpcV1`, func() { listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") listEndpointGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -73843,7 +77048,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + 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") @@ -73870,7 +77075,7 @@ var _ = Describe(`VpcV1`, func() { listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") listEndpointGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -73894,7 +77099,7 @@ var _ = Describe(`VpcV1`, func() { listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") listEndpointGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -73932,7 +77137,7 @@ var _ = Describe(`VpcV1`, func() { listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") listEndpointGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -73977,6 +77182,82 @@ var _ = Describe(`VpcV1`, func() { 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(listEndpointGatewaysPath)) + 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"},"endpoint_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5","health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::","resource_type":"provider_cloud_service"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"endpoint_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5","health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::","resource_type":"provider_cloud_service"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use EndpointGatewaysPager.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()) + + listEndpointGatewaysOptionsModel := &vpcv1.ListEndpointGatewaysOptions{ + Name: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + } + + pager, err := vpcService.NewEndpointGatewaysPager(listEndpointGatewaysOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.EndpointGateway + 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 EndpointGatewaysPager.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()) + + listEndpointGatewaysOptionsModel := &vpcv1.ListEndpointGatewaysOptions{ + Name: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + } + + pager, err := vpcService.NewEndpointGatewaysPager(listEndpointGatewaysOptionsModel) + 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(`CreateEndpointGateway(createEndpointGatewayOptions *CreateEndpointGatewayOptions) - Operation response error`, func() { version := "testString" @@ -74005,10 +77286,10 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN model - endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + // Construct an instance of the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName model + endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") - endpointGatewayTargetPrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::") + endpointGatewayTargetPrototypeModel.Name = core.StringPtr("ibm-ntp-server") // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -74102,10 +77383,10 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN model - endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + // Construct an instance of the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName model + endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") - endpointGatewayTargetPrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::") + endpointGatewayTargetPrototypeModel.Name = core.StringPtr("ibm-ntp-server") // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -74206,10 +77487,10 @@ var _ = Describe(`VpcV1`, func() { Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN model - endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + // Construct an instance of the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName model + endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") - endpointGatewayTargetPrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::") + endpointGatewayTargetPrototypeModel.Name = core.StringPtr("ibm-ntp-server") // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -74253,10 +77534,10 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN model - endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + // Construct an instance of the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName model + endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") - endpointGatewayTargetPrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::") + endpointGatewayTargetPrototypeModel.Name = core.StringPtr("ibm-ntp-server") // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -74321,10 +77602,10 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN model - endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + // Construct an instance of the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName model + endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") - endpointGatewayTargetPrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::") + endpointGatewayTargetPrototypeModel.Name = core.StringPtr("ibm-ntp-server") // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -74379,7 +77660,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -74399,7 +77680,7 @@ var _ = Describe(`VpcV1`, func() { listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") listEndpointGatewayIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -74435,7 +77716,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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) @@ -74460,7 +77741,7 @@ var _ = Describe(`VpcV1`, func() { listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") listEndpointGatewayIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -74501,7 +77782,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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") @@ -74528,7 +77809,7 @@ var _ = Describe(`VpcV1`, func() { listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") listEndpointGatewayIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -74552,7 +77833,7 @@ var _ = Describe(`VpcV1`, func() { listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") listEndpointGatewayIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -74597,7 +77878,7 @@ var _ = Describe(`VpcV1`, func() { listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") listEndpointGatewayIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -74642,6 +77923,82 @@ var _ = Describe(`VpcV1`, func() { 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(listEndpointGatewayIpsPath)) + 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"user","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"user","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"d7cc5196-9864-48c4-82d8-3f30da41fcc5","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use EndpointGatewayIpsPager.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()) + + listEndpointGatewayIpsOptionsModel := &vpcv1.ListEndpointGatewayIpsOptions{ + EndpointGatewayID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewEndpointGatewayIpsPager(listEndpointGatewayIpsOptionsModel) + 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 EndpointGatewayIpsPager.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()) + + listEndpointGatewayIpsOptionsModel := &vpcv1.ListEndpointGatewayIpsOptions{ + EndpointGatewayID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + } + + pager, err := vpcService.NewEndpointGatewayIpsPager(listEndpointGatewayIpsOptionsModel) + 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(`RemoveEndpointGatewayIP(removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions)`, func() { version := "testString" @@ -75782,7 +79139,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) @@ -75807,7 +79164,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListFlowLogCollectorsOptions model listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") @@ -75849,7 +79206,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) @@ -75879,7 +79236,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListFlowLogCollectorsOptions model listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") @@ -75926,7 +79283,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) 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(1))})) + 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{"testString"})) Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) @@ -75958,7 +79315,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListFlowLogCollectorsOptions model listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") @@ -75987,7 +79344,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListFlowLogCollectorsOptions model listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") @@ -76030,7 +79387,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListFlowLogCollectorsOptions model listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(10)) listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") @@ -76081,6 +79438,92 @@ var _ = Describe(`VpcV1`, func() { 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(listFlowLogCollectorsPath)) + 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,"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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use FlowLogCollectorsPager.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()) + + listFlowLogCollectorsOptionsModel := &vpcv1.ListFlowLogCollectorsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + VPCID: core.StringPtr("testString"), + VPCCRN: core.StringPtr("testString"), + VPCName: core.StringPtr("testString"), + TargetID: core.StringPtr("testString"), + TargetResourceType: core.StringPtr("instance"), + } + + pager, err := vpcService.NewFlowLogCollectorsPager(listFlowLogCollectorsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []vpcv1.FlowLogCollector + 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 FlowLogCollectorsPager.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()) + + listFlowLogCollectorsOptionsModel := &vpcv1.ListFlowLogCollectorsOptions{ + Limit: core.Int64Ptr(int64(10)), + ResourceGroupID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + VPCID: core.StringPtr("testString"), + VPCCRN: core.StringPtr("testString"), + VPCName: core.StringPtr("testString"), + TargetID: core.StringPtr("testString"), + TargetResourceType: core.StringPtr("instance"), + } + + pager, err := vpcService.NewFlowLogCollectorsPager(listFlowLogCollectorsOptionsModel) + 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(`CreateFlowLogCollector(createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) - Operation response error`, func() { version := "testString" @@ -77515,13 +80958,13 @@ var _ = Describe(`VpcV1`, func() { Expect(createDedicatedHostOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateEndpointGatewayOptions successfully`, func() { - // Construct an instance of the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN model - endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + // Construct an instance of the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName model + endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) Expect(endpointGatewayTargetPrototypeModel).ToNot(BeNil()) endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") - endpointGatewayTargetPrototypeModel.CRN = core.StringPtr("crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::") + endpointGatewayTargetPrototypeModel.Name = core.StringPtr("ibm-ntp-server") Expect(endpointGatewayTargetPrototypeModel.ResourceType).To(Equal(core.StringPtr("provider_infrastructure_service"))) - Expect(endpointGatewayTargetPrototypeModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::"))) + Expect(endpointGatewayTargetPrototypeModel.Name).To(Equal(core.StringPtr("ibm-ntp-server"))) // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -78379,11 +81822,11 @@ var _ = Describe(`VpcV1`, func() { Expect(resourceGroupIdentityModel.ID).To(Equal(core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345"))) // Construct an instance of the CreateIpsecPolicyOptions model - createIpsecPolicyOptionsAuthenticationAlgorithm := "md5" + createIpsecPolicyOptionsAuthenticationAlgorithm := "disabled" createIpsecPolicyOptionsEncryptionAlgorithm := "aes128" createIpsecPolicyOptionsPfs := "disabled" createIpsecPolicyOptionsModel := vpcService.NewCreateIpsecPolicyOptions(createIpsecPolicyOptionsAuthenticationAlgorithm, createIpsecPolicyOptionsEncryptionAlgorithm, createIpsecPolicyOptionsPfs) - createIpsecPolicyOptionsModel.SetAuthenticationAlgorithm("md5") + createIpsecPolicyOptionsModel.SetAuthenticationAlgorithm("disabled") createIpsecPolicyOptionsModel.SetEncryptionAlgorithm("aes128") createIpsecPolicyOptionsModel.SetPfs("disabled") createIpsecPolicyOptionsModel.SetKeyLifetime(int64(3600)) @@ -78391,7 +81834,7 @@ var _ = Describe(`VpcV1`, func() { createIpsecPolicyOptionsModel.SetResourceGroup(resourceGroupIdentityModel) createIpsecPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createIpsecPolicyOptionsModel).ToNot(BeNil()) - Expect(createIpsecPolicyOptionsModel.AuthenticationAlgorithm).To(Equal(core.StringPtr("md5"))) + Expect(createIpsecPolicyOptionsModel.AuthenticationAlgorithm).To(Equal(core.StringPtr("disabled"))) Expect(createIpsecPolicyOptionsModel.EncryptionAlgorithm).To(Equal(core.StringPtr("aes128"))) Expect(createIpsecPolicyOptionsModel.Pfs).To(Equal(core.StringPtr("disabled"))) Expect(createIpsecPolicyOptionsModel.KeyLifetime).To(Equal(core.Int64Ptr(int64(3600)))) @@ -78913,8 +82356,8 @@ var _ = Describe(`VpcV1`, func() { networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") Expect(networkACLRuleBeforePrototypeModel.ID).To(Equal(core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9"))) - // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype model - networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype model + networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) Expect(networkACLRulePrototypeModel).ToNot(BeNil()) networkACLRulePrototypeModel.Action = core.StringPtr("allow") networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel @@ -78922,14 +82365,22 @@ var _ = Describe(`VpcV1`, func() { networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.Protocol = core.StringPtr("all") + networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) + networkACLRulePrototypeModel.DestinationPortMin = core.Int64Ptr(int64(22)) + networkACLRulePrototypeModel.Protocol = core.StringPtr("udp") + networkACLRulePrototypeModel.SourcePortMax = core.Int64Ptr(int64(65535)) + networkACLRulePrototypeModel.SourcePortMin = core.Int64Ptr(int64(49152)) Expect(networkACLRulePrototypeModel.Action).To(Equal(core.StringPtr("allow"))) Expect(networkACLRulePrototypeModel.Before).To(Equal(networkACLRuleBeforePrototypeModel)) Expect(networkACLRulePrototypeModel.Destination).To(Equal(core.StringPtr("192.168.3.2/32"))) Expect(networkACLRulePrototypeModel.Direction).To(Equal(core.StringPtr("inbound"))) Expect(networkACLRulePrototypeModel.Name).To(Equal(core.StringPtr("my-rule-2"))) Expect(networkACLRulePrototypeModel.Source).To(Equal(core.StringPtr("192.168.3.2/32"))) - Expect(networkACLRulePrototypeModel.Protocol).To(Equal(core.StringPtr("all"))) + Expect(networkACLRulePrototypeModel.DestinationPortMax).To(Equal(core.Int64Ptr(int64(22)))) + Expect(networkACLRulePrototypeModel.DestinationPortMin).To(Equal(core.Int64Ptr(int64(22)))) + Expect(networkACLRulePrototypeModel.Protocol).To(Equal(core.StringPtr("udp"))) + Expect(networkACLRulePrototypeModel.SourcePortMax).To(Equal(core.Int64Ptr(int64(65535)))) + Expect(networkACLRulePrototypeModel.SourcePortMin).To(Equal(core.Int64Ptr(int64(49152)))) // Construct an instance of the CreateNetworkACLRuleOptions model networkACLID := "testString" @@ -79025,21 +82476,17 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") Expect(securityGroupRuleRemotePrototypeModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) Expect(securityGroupRulePrototypeModel).ToNot(BeNil()) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") Expect(securityGroupRulePrototypeModel.Direction).To(Equal(core.StringPtr("inbound"))) Expect(securityGroupRulePrototypeModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) Expect(securityGroupRulePrototypeModel.Remote).To(Equal(securityGroupRuleRemotePrototypeModel)) - Expect(securityGroupRulePrototypeModel.PortMax).To(Equal(core.Int64Ptr(int64(22)))) - Expect(securityGroupRulePrototypeModel.PortMin).To(Equal(core.Int64Ptr(int64(22)))) - Expect(securityGroupRulePrototypeModel.Protocol).To(Equal(core.StringPtr("udp"))) + Expect(securityGroupRulePrototypeModel.Protocol).To(Equal(core.StringPtr("all"))) // Construct an instance of the CreateSecurityGroupOptions model var createSecurityGroupOptionsVPC vpcv1.VPCIdentityIntf = nil @@ -79063,21 +82510,17 @@ var _ = Describe(`VpcV1`, func() { securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") Expect(securityGroupRuleRemotePrototypeModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model + securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) Expect(securityGroupRulePrototypeModel).ToNot(BeNil()) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - securityGroupRulePrototypeModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePrototypeModel.Protocol = core.StringPtr("udp") + securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") Expect(securityGroupRulePrototypeModel.Direction).To(Equal(core.StringPtr("inbound"))) Expect(securityGroupRulePrototypeModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) Expect(securityGroupRulePrototypeModel.Remote).To(Equal(securityGroupRuleRemotePrototypeModel)) - Expect(securityGroupRulePrototypeModel.PortMax).To(Equal(core.Int64Ptr(int64(22)))) - Expect(securityGroupRulePrototypeModel.PortMin).To(Equal(core.Int64Ptr(int64(22)))) - Expect(securityGroupRulePrototypeModel.Protocol).To(Equal(core.StringPtr("udp"))) + Expect(securityGroupRulePrototypeModel.Protocol).To(Equal(core.StringPtr("all"))) // Construct an instance of the CreateSecurityGroupRuleOptions model securityGroupID := "testString" @@ -81190,14 +84633,14 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListBackupPoliciesOptions model listBackupPoliciesOptionsModel := vpcService.NewListBackupPoliciesOptions() listBackupPoliciesOptionsModel.SetStart("testString") - listBackupPoliciesOptionsModel.SetLimit(int64(1)) + listBackupPoliciesOptionsModel.SetLimit(int64(10)) listBackupPoliciesOptionsModel.SetResourceGroupID("testString") listBackupPoliciesOptionsModel.SetName("testString") listBackupPoliciesOptionsModel.SetTag("testString") listBackupPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listBackupPoliciesOptionsModel).ToNot(BeNil()) Expect(listBackupPoliciesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listBackupPoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listBackupPoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listBackupPoliciesOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listBackupPoliciesOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(listBackupPoliciesOptionsModel.Tag).To(Equal(core.StringPtr("testString"))) @@ -81257,30 +84700,30 @@ var _ = Describe(`VpcV1`, func() { listBareMetalServerNetworkInterfacesOptionsModel := vpcService.NewListBareMetalServerNetworkInterfacesOptions(bareMetalServerID) listBareMetalServerNetworkInterfacesOptionsModel.SetBareMetalServerID("testString") listBareMetalServerNetworkInterfacesOptionsModel.SetStart("testString") - listBareMetalServerNetworkInterfacesOptionsModel.SetLimit(int64(1)) + listBareMetalServerNetworkInterfacesOptionsModel.SetLimit(int64(10)) listBareMetalServerNetworkInterfacesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listBareMetalServerNetworkInterfacesOptionsModel).ToNot(BeNil()) Expect(listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) Expect(listBareMetalServerNetworkInterfacesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServerNetworkInterfacesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listBareMetalServerNetworkInterfacesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listBareMetalServerNetworkInterfacesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListBareMetalServerProfilesOptions successfully`, func() { // Construct an instance of the ListBareMetalServerProfilesOptions model listBareMetalServerProfilesOptionsModel := vpcService.NewListBareMetalServerProfilesOptions() listBareMetalServerProfilesOptionsModel.SetStart("testString") - listBareMetalServerProfilesOptionsModel.SetLimit(int64(1)) + listBareMetalServerProfilesOptionsModel.SetLimit(int64(10)) listBareMetalServerProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listBareMetalServerProfilesOptionsModel).ToNot(BeNil()) Expect(listBareMetalServerProfilesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServerProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listBareMetalServerProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listBareMetalServerProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListBareMetalServersOptions successfully`, func() { // Construct an instance of the ListBareMetalServersOptions model listBareMetalServersOptionsModel := vpcService.NewListBareMetalServersOptions() listBareMetalServersOptionsModel.SetStart("testString") - listBareMetalServersOptionsModel.SetLimit(int64(1)) + listBareMetalServersOptionsModel.SetLimit(int64(10)) listBareMetalServersOptionsModel.SetResourceGroupID("testString") listBareMetalServersOptionsModel.SetName("testString") listBareMetalServersOptionsModel.SetVPCID("testString") @@ -81292,7 +84735,7 @@ var _ = Describe(`VpcV1`, func() { listBareMetalServersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listBareMetalServersOptionsModel).ToNot(BeNil()) Expect(listBareMetalServersOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listBareMetalServersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listBareMetalServersOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listBareMetalServersOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(listBareMetalServersOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) @@ -81317,14 +84760,14 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListDedicatedHostGroupsOptions model listDedicatedHostGroupsOptionsModel := vpcService.NewListDedicatedHostGroupsOptions() listDedicatedHostGroupsOptionsModel.SetStart("testString") - listDedicatedHostGroupsOptionsModel.SetLimit(int64(1)) + listDedicatedHostGroupsOptionsModel.SetLimit(int64(10)) listDedicatedHostGroupsOptionsModel.SetResourceGroupID("testString") listDedicatedHostGroupsOptionsModel.SetZoneName("testString") listDedicatedHostGroupsOptionsModel.SetName("testString") listDedicatedHostGroupsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listDedicatedHostGroupsOptionsModel).ToNot(BeNil()) Expect(listDedicatedHostGroupsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listDedicatedHostGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listDedicatedHostGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listDedicatedHostGroupsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listDedicatedHostGroupsOptionsModel.ZoneName).To(Equal(core.StringPtr("testString"))) Expect(listDedicatedHostGroupsOptionsModel.Name).To(Equal(core.StringPtr("testString"))) @@ -81334,11 +84777,11 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListDedicatedHostProfilesOptions model listDedicatedHostProfilesOptionsModel := vpcService.NewListDedicatedHostProfilesOptions() listDedicatedHostProfilesOptionsModel.SetStart("testString") - listDedicatedHostProfilesOptionsModel.SetLimit(int64(1)) + listDedicatedHostProfilesOptionsModel.SetLimit(int64(10)) listDedicatedHostProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listDedicatedHostProfilesOptionsModel).ToNot(BeNil()) Expect(listDedicatedHostProfilesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listDedicatedHostProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listDedicatedHostProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listDedicatedHostProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListDedicatedHostsOptions successfully`, func() { @@ -81346,7 +84789,7 @@ var _ = Describe(`VpcV1`, func() { listDedicatedHostsOptionsModel := vpcService.NewListDedicatedHostsOptions() listDedicatedHostsOptionsModel.SetDedicatedHostGroupID("testString") listDedicatedHostsOptionsModel.SetStart("testString") - listDedicatedHostsOptionsModel.SetLimit(int64(1)) + listDedicatedHostsOptionsModel.SetLimit(int64(10)) listDedicatedHostsOptionsModel.SetResourceGroupID("testString") listDedicatedHostsOptionsModel.SetZoneName("testString") listDedicatedHostsOptionsModel.SetName("testString") @@ -81354,7 +84797,7 @@ var _ = Describe(`VpcV1`, func() { Expect(listDedicatedHostsOptionsModel).ToNot(BeNil()) Expect(listDedicatedHostsOptionsModel.DedicatedHostGroupID).To(Equal(core.StringPtr("testString"))) Expect(listDedicatedHostsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listDedicatedHostsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listDedicatedHostsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listDedicatedHostsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listDedicatedHostsOptionsModel.ZoneName).To(Equal(core.StringPtr("testString"))) Expect(listDedicatedHostsOptionsModel.Name).To(Equal(core.StringPtr("testString"))) @@ -81366,13 +84809,13 @@ var _ = Describe(`VpcV1`, func() { listEndpointGatewayIpsOptionsModel := vpcService.NewListEndpointGatewayIpsOptions(endpointGatewayID) listEndpointGatewayIpsOptionsModel.SetEndpointGatewayID("testString") listEndpointGatewayIpsOptionsModel.SetStart("testString") - listEndpointGatewayIpsOptionsModel.SetLimit(int64(1)) + listEndpointGatewayIpsOptionsModel.SetLimit(int64(10)) listEndpointGatewayIpsOptionsModel.SetSort("name") listEndpointGatewayIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listEndpointGatewayIpsOptionsModel).ToNot(BeNil()) Expect(listEndpointGatewayIpsOptionsModel.EndpointGatewayID).To(Equal(core.StringPtr("testString"))) Expect(listEndpointGatewayIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listEndpointGatewayIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listEndpointGatewayIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listEndpointGatewayIpsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) Expect(listEndpointGatewayIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -81381,13 +84824,13 @@ var _ = Describe(`VpcV1`, func() { listEndpointGatewaysOptionsModel := vpcService.NewListEndpointGatewaysOptions() listEndpointGatewaysOptionsModel.SetName("testString") listEndpointGatewaysOptionsModel.SetStart("testString") - listEndpointGatewaysOptionsModel.SetLimit(int64(1)) + listEndpointGatewaysOptionsModel.SetLimit(int64(10)) listEndpointGatewaysOptionsModel.SetResourceGroupID("testString") listEndpointGatewaysOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listEndpointGatewaysOptionsModel).ToNot(BeNil()) Expect(listEndpointGatewaysOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(listEndpointGatewaysOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listEndpointGatewaysOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listEndpointGatewaysOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listEndpointGatewaysOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listEndpointGatewaysOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -81395,13 +84838,13 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListFloatingIpsOptions model listFloatingIpsOptionsModel := vpcService.NewListFloatingIpsOptions() listFloatingIpsOptionsModel.SetStart("testString") - listFloatingIpsOptionsModel.SetLimit(int64(1)) + listFloatingIpsOptionsModel.SetLimit(int64(10)) listFloatingIpsOptionsModel.SetResourceGroupID("testString") listFloatingIpsOptionsModel.SetSort("name") listFloatingIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listFloatingIpsOptionsModel).ToNot(BeNil()) Expect(listFloatingIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listFloatingIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listFloatingIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listFloatingIpsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listFloatingIpsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) Expect(listFloatingIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) @@ -81410,7 +84853,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListFlowLogCollectorsOptions model listFlowLogCollectorsOptionsModel := vpcService.NewListFlowLogCollectorsOptions() listFlowLogCollectorsOptionsModel.SetStart("testString") - listFlowLogCollectorsOptionsModel.SetLimit(int64(1)) + listFlowLogCollectorsOptionsModel.SetLimit(int64(10)) listFlowLogCollectorsOptionsModel.SetResourceGroupID("testString") listFlowLogCollectorsOptionsModel.SetName("testString") listFlowLogCollectorsOptionsModel.SetVPCID("testString") @@ -81421,7 +84864,7 @@ var _ = Describe(`VpcV1`, func() { listFlowLogCollectorsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listFlowLogCollectorsOptionsModel).ToNot(BeNil()) Expect(listFlowLogCollectorsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listFlowLogCollectorsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listFlowLogCollectorsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listFlowLogCollectorsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listFlowLogCollectorsOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(listFlowLogCollectorsOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) @@ -81435,11 +84878,11 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListIkePoliciesOptions model listIkePoliciesOptionsModel := vpcService.NewListIkePoliciesOptions() listIkePoliciesOptionsModel.SetStart("testString") - listIkePoliciesOptionsModel.SetLimit(int64(1)) + listIkePoliciesOptionsModel.SetLimit(int64(10)) listIkePoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listIkePoliciesOptionsModel).ToNot(BeNil()) Expect(listIkePoliciesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listIkePoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listIkePoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listIkePoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListIkePolicyConnectionsOptions successfully`, func() { @@ -81456,14 +84899,14 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListImagesOptions model listImagesOptionsModel := vpcService.NewListImagesOptions() listImagesOptionsModel.SetStart("testString") - listImagesOptionsModel.SetLimit(int64(1)) + listImagesOptionsModel.SetLimit(int64(10)) listImagesOptionsModel.SetResourceGroupID("testString") listImagesOptionsModel.SetName("testString") listImagesOptionsModel.SetVisibility("private") listImagesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listImagesOptionsModel).ToNot(BeNil()) Expect(listImagesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listImagesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listImagesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listImagesOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listImagesOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(listImagesOptionsModel.Visibility).To(Equal(core.StringPtr("private"))) @@ -81487,13 +84930,13 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagerActionsOptionsModel.SetInstanceGroupID("testString") listInstanceGroupManagerActionsOptionsModel.SetInstanceGroupManagerID("testString") listInstanceGroupManagerActionsOptionsModel.SetStart("testString") - listInstanceGroupManagerActionsOptionsModel.SetLimit(int64(1)) + listInstanceGroupManagerActionsOptionsModel.SetLimit(int64(10)) listInstanceGroupManagerActionsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listInstanceGroupManagerActionsOptionsModel).ToNot(BeNil()) Expect(listInstanceGroupManagerActionsOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) Expect(listInstanceGroupManagerActionsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupManagerActionsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listInstanceGroupManagerActionsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listInstanceGroupManagerActionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListInstanceGroupManagerPoliciesOptions successfully`, func() { @@ -81504,13 +84947,13 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagerPoliciesOptionsModel.SetInstanceGroupID("testString") listInstanceGroupManagerPoliciesOptionsModel.SetInstanceGroupManagerID("testString") listInstanceGroupManagerPoliciesOptionsModel.SetStart("testString") - listInstanceGroupManagerPoliciesOptionsModel.SetLimit(int64(1)) + listInstanceGroupManagerPoliciesOptionsModel.SetLimit(int64(10)) listInstanceGroupManagerPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listInstanceGroupManagerPoliciesOptionsModel).ToNot(BeNil()) Expect(listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) Expect(listInstanceGroupManagerPoliciesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupManagerPoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listInstanceGroupManagerPoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listInstanceGroupManagerPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListInstanceGroupManagersOptions successfully`, func() { @@ -81519,12 +84962,12 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupManagersOptionsModel := vpcService.NewListInstanceGroupManagersOptions(instanceGroupID) listInstanceGroupManagersOptionsModel.SetInstanceGroupID("testString") listInstanceGroupManagersOptionsModel.SetStart("testString") - listInstanceGroupManagersOptionsModel.SetLimit(int64(1)) + listInstanceGroupManagersOptionsModel.SetLimit(int64(10)) listInstanceGroupManagersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listInstanceGroupManagersOptionsModel).ToNot(BeNil()) Expect(listInstanceGroupManagersOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listInstanceGroupManagersOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupManagersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listInstanceGroupManagersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listInstanceGroupManagersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListInstanceGroupMembershipsOptions successfully`, func() { @@ -81533,23 +84976,23 @@ var _ = Describe(`VpcV1`, func() { listInstanceGroupMembershipsOptionsModel := vpcService.NewListInstanceGroupMembershipsOptions(instanceGroupID) listInstanceGroupMembershipsOptionsModel.SetInstanceGroupID("testString") listInstanceGroupMembershipsOptionsModel.SetStart("testString") - listInstanceGroupMembershipsOptionsModel.SetLimit(int64(1)) + listInstanceGroupMembershipsOptionsModel.SetLimit(int64(10)) listInstanceGroupMembershipsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listInstanceGroupMembershipsOptionsModel).ToNot(BeNil()) Expect(listInstanceGroupMembershipsOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listInstanceGroupMembershipsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupMembershipsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listInstanceGroupMembershipsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listInstanceGroupMembershipsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListInstanceGroupsOptions successfully`, func() { // Construct an instance of the ListInstanceGroupsOptions model listInstanceGroupsOptionsModel := vpcService.NewListInstanceGroupsOptions() listInstanceGroupsOptionsModel.SetStart("testString") - listInstanceGroupsOptionsModel.SetLimit(int64(1)) + listInstanceGroupsOptionsModel.SetLimit(int64(10)) listInstanceGroupsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listInstanceGroupsOptionsModel).ToNot(BeNil()) Expect(listInstanceGroupsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listInstanceGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listInstanceGroupsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListInstanceNetworkInterfaceFloatingIpsOptions successfully`, func() { @@ -81573,13 +85016,13 @@ var _ = Describe(`VpcV1`, func() { listInstanceNetworkInterfaceIpsOptionsModel.SetInstanceID("testString") listInstanceNetworkInterfaceIpsOptionsModel.SetNetworkInterfaceID("testString") listInstanceNetworkInterfaceIpsOptionsModel.SetStart("testString") - listInstanceNetworkInterfaceIpsOptionsModel.SetLimit(int64(1)) + listInstanceNetworkInterfaceIpsOptionsModel.SetLimit(int64(10)) listInstanceNetworkInterfaceIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listInstanceNetworkInterfaceIpsOptionsModel).ToNot(BeNil()) Expect(listInstanceNetworkInterfaceIpsOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) Expect(listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) Expect(listInstanceNetworkInterfaceIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceNetworkInterfaceIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listInstanceNetworkInterfaceIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listInstanceNetworkInterfaceIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListInstanceNetworkInterfacesOptions successfully`, func() { @@ -81620,7 +85063,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListInstancesOptions model listInstancesOptionsModel := vpcService.NewListInstancesOptions() listInstancesOptionsModel.SetStart("testString") - listInstancesOptionsModel.SetLimit(int64(1)) + listInstancesOptionsModel.SetLimit(int64(10)) listInstancesOptionsModel.SetResourceGroupID("testString") listInstancesOptionsModel.SetName("testString") listInstancesOptionsModel.SetVPCID("testString") @@ -81635,7 +85078,7 @@ var _ = Describe(`VpcV1`, func() { listInstancesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listInstancesOptionsModel).ToNot(BeNil()) Expect(listInstancesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listInstancesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listInstancesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listInstancesOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listInstancesOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(listInstancesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) @@ -81653,11 +85096,11 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListIpsecPoliciesOptions model listIpsecPoliciesOptionsModel := vpcService.NewListIpsecPoliciesOptions() listIpsecPoliciesOptionsModel.SetStart("testString") - listIpsecPoliciesOptionsModel.SetLimit(int64(1)) + listIpsecPoliciesOptionsModel.SetLimit(int64(10)) listIpsecPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listIpsecPoliciesOptionsModel).ToNot(BeNil()) Expect(listIpsecPoliciesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listIpsecPoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listIpsecPoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listIpsecPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListIpsecPolicyConnectionsOptions successfully`, func() { @@ -81674,11 +85117,11 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListKeysOptions model listKeysOptionsModel := vpcService.NewListKeysOptions() listKeysOptionsModel.SetStart("testString") - listKeysOptionsModel.SetLimit(int64(1)) + listKeysOptionsModel.SetLimit(int64(10)) 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(1)))) + Expect(listKeysOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listKeysOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListLoadBalancerListenerPoliciesOptions successfully`, func() { @@ -81747,22 +85190,22 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListLoadBalancerProfilesOptions model listLoadBalancerProfilesOptionsModel := vpcService.NewListLoadBalancerProfilesOptions() listLoadBalancerProfilesOptionsModel.SetStart("testString") - listLoadBalancerProfilesOptionsModel.SetLimit(int64(1)) + listLoadBalancerProfilesOptionsModel.SetLimit(int64(10)) listLoadBalancerProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listLoadBalancerProfilesOptionsModel).ToNot(BeNil()) Expect(listLoadBalancerProfilesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listLoadBalancerProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listLoadBalancerProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listLoadBalancerProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListLoadBalancersOptions successfully`, func() { // Construct an instance of the ListLoadBalancersOptions model listLoadBalancersOptionsModel := vpcService.NewListLoadBalancersOptions() listLoadBalancersOptionsModel.SetStart("testString") - listLoadBalancersOptionsModel.SetLimit(int64(1)) + listLoadBalancersOptionsModel.SetLimit(int64(10)) listLoadBalancersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listLoadBalancersOptionsModel).ToNot(BeNil()) Expect(listLoadBalancersOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listLoadBalancersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listLoadBalancersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listLoadBalancersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListNetworkACLRulesOptions successfully`, func() { @@ -81771,13 +85214,13 @@ var _ = Describe(`VpcV1`, func() { listNetworkACLRulesOptionsModel := vpcService.NewListNetworkACLRulesOptions(networkACLID) listNetworkACLRulesOptionsModel.SetNetworkACLID("testString") listNetworkACLRulesOptionsModel.SetStart("testString") - listNetworkACLRulesOptionsModel.SetLimit(int64(1)) + listNetworkACLRulesOptionsModel.SetLimit(int64(10)) listNetworkACLRulesOptionsModel.SetDirection("inbound") listNetworkACLRulesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listNetworkACLRulesOptionsModel).ToNot(BeNil()) Expect(listNetworkACLRulesOptionsModel.NetworkACLID).To(Equal(core.StringPtr("testString"))) Expect(listNetworkACLRulesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listNetworkACLRulesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listNetworkACLRulesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listNetworkACLRulesOptionsModel.Direction).To(Equal(core.StringPtr("inbound"))) Expect(listNetworkACLRulesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -81785,12 +85228,12 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListNetworkAclsOptions model listNetworkAclsOptionsModel := vpcService.NewListNetworkAclsOptions() listNetworkAclsOptionsModel.SetStart("testString") - listNetworkAclsOptionsModel.SetLimit(int64(1)) + listNetworkAclsOptionsModel.SetLimit(int64(10)) listNetworkAclsOptionsModel.SetResourceGroupID("testString") listNetworkAclsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listNetworkAclsOptionsModel).ToNot(BeNil()) Expect(listNetworkAclsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listNetworkAclsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listNetworkAclsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listNetworkAclsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listNetworkAclsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -81798,34 +85241,34 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListOperatingSystemsOptions model listOperatingSystemsOptionsModel := vpcService.NewListOperatingSystemsOptions() listOperatingSystemsOptionsModel.SetStart("testString") - listOperatingSystemsOptionsModel.SetLimit(int64(1)) + listOperatingSystemsOptionsModel.SetLimit(int64(10)) listOperatingSystemsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listOperatingSystemsOptionsModel).ToNot(BeNil()) Expect(listOperatingSystemsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listOperatingSystemsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listOperatingSystemsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listOperatingSystemsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListPlacementGroupsOptions successfully`, func() { // Construct an instance of the ListPlacementGroupsOptions model listPlacementGroupsOptionsModel := vpcService.NewListPlacementGroupsOptions() listPlacementGroupsOptionsModel.SetStart("testString") - listPlacementGroupsOptionsModel.SetLimit(int64(1)) + listPlacementGroupsOptionsModel.SetLimit(int64(10)) listPlacementGroupsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listPlacementGroupsOptionsModel).ToNot(BeNil()) Expect(listPlacementGroupsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listPlacementGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listPlacementGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listPlacementGroupsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListPublicGatewaysOptions successfully`, func() { // Construct an instance of the ListPublicGatewaysOptions model listPublicGatewaysOptionsModel := vpcService.NewListPublicGatewaysOptions() listPublicGatewaysOptionsModel.SetStart("testString") - listPublicGatewaysOptionsModel.SetLimit(int64(1)) + listPublicGatewaysOptionsModel.SetLimit(int64(10)) listPublicGatewaysOptionsModel.SetResourceGroupID("testString") listPublicGatewaysOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listPublicGatewaysOptionsModel).ToNot(BeNil()) Expect(listPublicGatewaysOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listPublicGatewaysOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listPublicGatewaysOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listPublicGatewaysOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listPublicGatewaysOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -81862,19 +85305,19 @@ var _ = Describe(`VpcV1`, func() { listSecurityGroupTargetsOptionsModel := vpcService.NewListSecurityGroupTargetsOptions(securityGroupID) listSecurityGroupTargetsOptionsModel.SetSecurityGroupID("testString") listSecurityGroupTargetsOptionsModel.SetStart("testString") - listSecurityGroupTargetsOptionsModel.SetLimit(int64(1)) + listSecurityGroupTargetsOptionsModel.SetLimit(int64(10)) listSecurityGroupTargetsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listSecurityGroupTargetsOptionsModel).ToNot(BeNil()) Expect(listSecurityGroupTargetsOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) Expect(listSecurityGroupTargetsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listSecurityGroupTargetsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listSecurityGroupTargetsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listSecurityGroupTargetsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListSecurityGroupsOptions successfully`, func() { // Construct an instance of the ListSecurityGroupsOptions model listSecurityGroupsOptionsModel := vpcService.NewListSecurityGroupsOptions() listSecurityGroupsOptionsModel.SetStart("testString") - listSecurityGroupsOptionsModel.SetLimit(int64(1)) + listSecurityGroupsOptionsModel.SetLimit(int64(10)) listSecurityGroupsOptionsModel.SetResourceGroupID("testString") listSecurityGroupsOptionsModel.SetVPCID("testString") listSecurityGroupsOptionsModel.SetVPCCRN("testString") @@ -81882,7 +85325,7 @@ var _ = Describe(`VpcV1`, func() { listSecurityGroupsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listSecurityGroupsOptionsModel).ToNot(BeNil()) Expect(listSecurityGroupsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listSecurityGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listSecurityGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listSecurityGroupsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listSecurityGroupsOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(listSecurityGroupsOptionsModel.VPCCRN).To(Equal(core.StringPtr("testString"))) @@ -81893,7 +85336,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSnapshotsOptions model listSnapshotsOptionsModel := vpcService.NewListSnapshotsOptions() listSnapshotsOptionsModel.SetStart("testString") - listSnapshotsOptionsModel.SetLimit(int64(1)) + listSnapshotsOptionsModel.SetLimit(int64(10)) listSnapshotsOptionsModel.SetTag("testString") listSnapshotsOptionsModel.SetResourceGroupID("testString") listSnapshotsOptionsModel.SetName("testString") @@ -81906,7 +85349,7 @@ var _ = Describe(`VpcV1`, func() { listSnapshotsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listSnapshotsOptionsModel).ToNot(BeNil()) Expect(listSnapshotsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listSnapshotsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listSnapshotsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listSnapshotsOptionsModel.Tag).To(Equal(core.StringPtr("testString"))) Expect(listSnapshotsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listSnapshotsOptionsModel.Name).To(Equal(core.StringPtr("testString"))) @@ -81924,13 +85367,13 @@ var _ = Describe(`VpcV1`, func() { listSubnetReservedIpsOptionsModel := vpcService.NewListSubnetReservedIpsOptions(subnetID) listSubnetReservedIpsOptionsModel.SetSubnetID("testString") listSubnetReservedIpsOptionsModel.SetStart("testString") - listSubnetReservedIpsOptionsModel.SetLimit(int64(1)) + listSubnetReservedIpsOptionsModel.SetLimit(int64(10)) listSubnetReservedIpsOptionsModel.SetSort("name") listSubnetReservedIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listSubnetReservedIpsOptionsModel).ToNot(BeNil()) Expect(listSubnetReservedIpsOptionsModel.SubnetID).To(Equal(core.StringPtr("testString"))) Expect(listSubnetReservedIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listSubnetReservedIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listSubnetReservedIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listSubnetReservedIpsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) Expect(listSubnetReservedIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -81938,14 +85381,14 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListSubnetsOptions model listSubnetsOptionsModel := vpcService.NewListSubnetsOptions() listSubnetsOptionsModel.SetStart("testString") - listSubnetsOptionsModel.SetLimit(int64(1)) + listSubnetsOptionsModel.SetLimit(int64(10)) listSubnetsOptionsModel.SetResourceGroupID("testString") listSubnetsOptionsModel.SetRoutingTableID("testString") listSubnetsOptionsModel.SetRoutingTableName("testString") listSubnetsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listSubnetsOptionsModel).ToNot(BeNil()) Expect(listSubnetsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listSubnetsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listSubnetsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listSubnetsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listSubnetsOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) Expect(listSubnetsOptionsModel.RoutingTableName).To(Equal(core.StringPtr("testString"))) @@ -81955,24 +85398,24 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVolumeProfilesOptions model listVolumeProfilesOptionsModel := vpcService.NewListVolumeProfilesOptions() listVolumeProfilesOptionsModel.SetStart("testString") - listVolumeProfilesOptionsModel.SetLimit(int64(1)) + listVolumeProfilesOptionsModel.SetLimit(int64(10)) listVolumeProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listVolumeProfilesOptionsModel).ToNot(BeNil()) Expect(listVolumeProfilesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVolumeProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVolumeProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listVolumeProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListVolumesOptions successfully`, func() { // Construct an instance of the ListVolumesOptions model listVolumesOptionsModel := vpcService.NewListVolumesOptions() listVolumesOptionsModel.SetStart("testString") - listVolumesOptionsModel.SetLimit(int64(1)) + listVolumesOptionsModel.SetLimit(int64(10)) listVolumesOptionsModel.SetName("testString") listVolumesOptionsModel.SetZoneName("testString") listVolumesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listVolumesOptionsModel).ToNot(BeNil()) Expect(listVolumesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVolumesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVolumesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listVolumesOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(listVolumesOptionsModel.ZoneName).To(Equal(core.StringPtr("testString"))) Expect(listVolumesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) @@ -81983,12 +85426,12 @@ var _ = Describe(`VpcV1`, func() { listVPCAddressPrefixesOptionsModel := vpcService.NewListVPCAddressPrefixesOptions(vpcID) listVPCAddressPrefixesOptionsModel.SetVPCID("testString") listVPCAddressPrefixesOptionsModel.SetStart("testString") - listVPCAddressPrefixesOptionsModel.SetLimit(int64(1)) + listVPCAddressPrefixesOptionsModel.SetLimit(int64(10)) listVPCAddressPrefixesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listVPCAddressPrefixesOptionsModel).ToNot(BeNil()) Expect(listVPCAddressPrefixesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(listVPCAddressPrefixesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPCAddressPrefixesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPCAddressPrefixesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listVPCAddressPrefixesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListVPCRoutesOptions successfully`, func() { @@ -81998,13 +85441,13 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutesOptionsModel.SetVPCID("testString") listVPCRoutesOptionsModel.SetZoneName("testString") listVPCRoutesOptionsModel.SetStart("testString") - listVPCRoutesOptionsModel.SetLimit(int64(1)) + listVPCRoutesOptionsModel.SetLimit(int64(10)) listVPCRoutesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listVPCRoutesOptionsModel).ToNot(BeNil()) Expect(listVPCRoutesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(listVPCRoutesOptionsModel.ZoneName).To(Equal(core.StringPtr("testString"))) Expect(listVPCRoutesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPCRoutesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPCRoutesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listVPCRoutesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListVPCRoutingTableRoutesOptions successfully`, func() { @@ -82015,13 +85458,13 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutingTableRoutesOptionsModel.SetVPCID("testString") listVPCRoutingTableRoutesOptionsModel.SetRoutingTableID("testString") listVPCRoutingTableRoutesOptionsModel.SetStart("testString") - listVPCRoutingTableRoutesOptionsModel.SetLimit(int64(1)) + listVPCRoutingTableRoutesOptionsModel.SetLimit(int64(10)) listVPCRoutingTableRoutesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listVPCRoutingTableRoutesOptionsModel).ToNot(BeNil()) Expect(listVPCRoutingTableRoutesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(listVPCRoutingTableRoutesOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) Expect(listVPCRoutingTableRoutesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPCRoutingTableRoutesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPCRoutingTableRoutesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listVPCRoutingTableRoutesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListVPCRoutingTablesOptions successfully`, func() { @@ -82030,13 +85473,13 @@ var _ = Describe(`VpcV1`, func() { listVPCRoutingTablesOptionsModel := vpcService.NewListVPCRoutingTablesOptions(vpcID) listVPCRoutingTablesOptionsModel.SetVPCID("testString") listVPCRoutingTablesOptionsModel.SetStart("testString") - listVPCRoutingTablesOptionsModel.SetLimit(int64(1)) + listVPCRoutingTablesOptionsModel.SetLimit(int64(10)) listVPCRoutingTablesOptionsModel.SetIsDefault(true) listVPCRoutingTablesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listVPCRoutingTablesOptionsModel).ToNot(BeNil()) Expect(listVPCRoutingTablesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(listVPCRoutingTablesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPCRoutingTablesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPCRoutingTablesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listVPCRoutingTablesOptionsModel.IsDefault).To(Equal(core.BoolPtr(true))) Expect(listVPCRoutingTablesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -82044,13 +85487,13 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVpcsOptions model listVpcsOptionsModel := vpcService.NewListVpcsOptions() listVpcsOptionsModel.SetStart("testString") - listVpcsOptionsModel.SetLimit(int64(1)) + listVpcsOptionsModel.SetLimit(int64(10)) listVpcsOptionsModel.SetResourceGroupID("testString") listVpcsOptionsModel.SetClassicAccess(true) listVpcsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listVpcsOptionsModel).ToNot(BeNil()) Expect(listVpcsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVpcsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVpcsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listVpcsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listVpcsOptionsModel.ClassicAccess).To(Equal(core.BoolPtr(true))) Expect(listVpcsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) @@ -82097,14 +85540,16 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the ListVPNGatewaysOptions model listVPNGatewaysOptionsModel := vpcService.NewListVPNGatewaysOptions() listVPNGatewaysOptionsModel.SetStart("testString") - listVPNGatewaysOptionsModel.SetLimit(int64(1)) + listVPNGatewaysOptionsModel.SetLimit(int64(10)) listVPNGatewaysOptionsModel.SetResourceGroupID("testString") + listVPNGatewaysOptionsModel.SetSort("name") listVPNGatewaysOptionsModel.SetMode("route") listVPNGatewaysOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listVPNGatewaysOptionsModel).ToNot(BeNil()) Expect(listVPNGatewaysOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPNGatewaysOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPNGatewaysOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listVPNGatewaysOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listVPNGatewaysOptionsModel.Sort).To(Equal(core.StringPtr("name"))) Expect(listVPNGatewaysOptionsModel.Mode).To(Equal(core.StringPtr("route"))) Expect(listVPNGatewaysOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -82114,13 +85559,13 @@ var _ = Describe(`VpcV1`, func() { listVPNServerClientsOptionsModel := vpcService.NewListVPNServerClientsOptions(vpnServerID) listVPNServerClientsOptionsModel.SetVPNServerID("testString") listVPNServerClientsOptionsModel.SetStart("testString") - listVPNServerClientsOptionsModel.SetLimit(int64(1)) + listVPNServerClientsOptionsModel.SetLimit(int64(10)) listVPNServerClientsOptionsModel.SetSort("created_at") listVPNServerClientsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listVPNServerClientsOptionsModel).ToNot(BeNil()) Expect(listVPNServerClientsOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) Expect(listVPNServerClientsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPNServerClientsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPNServerClientsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listVPNServerClientsOptionsModel.Sort).To(Equal(core.StringPtr("created_at"))) Expect(listVPNServerClientsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -82130,13 +85575,13 @@ var _ = Describe(`VpcV1`, func() { listVPNServerRoutesOptionsModel := vpcService.NewListVPNServerRoutesOptions(vpnServerID) listVPNServerRoutesOptionsModel.SetVPNServerID("testString") listVPNServerRoutesOptionsModel.SetStart("testString") - listVPNServerRoutesOptionsModel.SetLimit(int64(1)) + listVPNServerRoutesOptionsModel.SetLimit(int64(10)) listVPNServerRoutesOptionsModel.SetSort("name") listVPNServerRoutesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listVPNServerRoutesOptionsModel).ToNot(BeNil()) Expect(listVPNServerRoutesOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) Expect(listVPNServerRoutesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPNServerRoutesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPNServerRoutesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listVPNServerRoutesOptionsModel.Sort).To(Equal(core.StringPtr("name"))) Expect(listVPNServerRoutesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -82145,14 +85590,14 @@ var _ = Describe(`VpcV1`, func() { listVPNServersOptionsModel := vpcService.NewListVPNServersOptions() listVPNServersOptionsModel.SetName("testString") listVPNServersOptionsModel.SetStart("testString") - listVPNServersOptionsModel.SetLimit(int64(1)) + listVPNServersOptionsModel.SetLimit(int64(10)) listVPNServersOptionsModel.SetResourceGroupID("testString") listVPNServersOptionsModel.SetSort("name") listVPNServersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listVPNServersOptionsModel).ToNot(BeNil()) Expect(listVPNServersOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(listVPNServersOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPNServersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPNServersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listVPNServersOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(listVPNServersOptionsModel.Sort).To(Equal(core.StringPtr("name"))) Expect(listVPNServersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) @@ -84536,7 +87981,7 @@ func CreateMockUUID(mockData string) *strfmt.UUID { } func CreateMockReader(mockData string) io.ReadCloser { - return ioutil.NopCloser(bytes.NewReader([]byte(mockData))) + return io.NopCloser(bytes.NewReader([]byte(mockData))) } func CreateMockDate(mockData string) *strfmt.Date { From b58a318a59544a85601929c7d1d557986f995332 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Mon, 26 Sep 2022 15:51:13 +0530 Subject: [PATCH 005/103] Update vpc_v1_test.go --- common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go index 133a3374a3..c242f622d4 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go @@ -27,10 +27,10 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/go-openapi/strfmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/IBM/vpc-go-sdk/vpcv1" ) var _ = Describe(`VpcV1`, func() { From cefb51c10c8b92edeca2ab20d65598647ea75bf7 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Mon, 26 Sep 2022 15:58:29 +0530 Subject: [PATCH 006/103] Update config.go --- ibm/conns/config.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ibm/conns/config.go b/ibm/conns/config.go index 3edf7b3d5b..b4d38aee93 100644 --- a/ibm/conns/config.go +++ b/ibm/conns/config.go @@ -79,6 +79,7 @@ import ( "github.com/IBM/scc-go-sdk/v4/posturemanagementv2" schematicsv1 "github.com/IBM/schematics-go-sdk/schematicsv1" "github.com/IBM/secrets-manager-go-sdk/secretsmanagerv1" + "github.com/IBM/vpc-go-sdk/common" vpc "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/apache/openwhisk-client-go/whisk" jwt "github.com/golang-jwt/jwt" @@ -3162,6 +3163,8 @@ func (c *Config) ClientSession() (interface{}, error) { goLogger := log.New(logDestination, "", log.LstdFlags) core.SetLogger(core.NewLogger(core.LevelDebug, goLogger, goLogger)) } + + common.UserAgent = "terraform-provider-ujjwal" return session, nil } From 00fe1b446b5a29758ff0f1fb0b07caa7121c9c20 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 27 Sep 2022 14:19:56 +0530 Subject: [PATCH 007/103] Update config.go --- ibm/conns/config.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ibm/conns/config.go b/ibm/conns/config.go index b4d38aee93..dce146f798 100644 --- a/ibm/conns/config.go +++ b/ibm/conns/config.go @@ -3164,7 +3164,8 @@ func (c *Config) ClientSession() (interface{}, error) { core.SetLogger(core.NewLogger(core.LevelDebug, goLogger, goLogger)) } - common.UserAgent = "terraform-provider-ujjwal" + // setting UserAgent for vpc-go-sdk common + common.UserAgent = fmt.Sprintf("terraform-provider-ibm/%s", version.Version) return session, nil } From 26bcf3c2243844199ffe5a35fc5d94dfdf32f4db Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 20 Oct 2022 09:51:40 +0530 Subject: [PATCH 008/103] updated sdk --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 2281 +++++++++++++---- .../IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go | 308 ++- 2 files changed, 1959 insertions(+), 630 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index de53c12c7b..064b7ee576 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -1526,6 +1526,9 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP if createVPCRoutingTableOptions.RouteDirectLinkIngress != nil { body["route_direct_link_ingress"] = createVPCRoutingTableOptions.RouteDirectLinkIngress } + if createVPCRoutingTableOptions.RouteInternetIngress != nil { + body["route_internet_ingress"] = createVPCRoutingTableOptions.RouteInternetIngress + } if createVPCRoutingTableOptions.RouteTransitGatewayIngress != nil { body["route_transit_gateway_ingress"] = createVPCRoutingTableOptions.RouteTransitGatewayIngress } @@ -3233,7 +3236,7 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS // ListImages : List all images // This request lists all images available in the region. An image provides source data for a volume. Images are either -// system-provided, or created from another source, such as importing from object storage. +// system-provided, or created from another source, such as importing from Cloud Object Storage. // // The images will be sorted by their `created_at` property values, with the newest first. Images with identical // `created_at` values will be secondarily sorted by ascending `id` property values. @@ -3376,8 +3379,9 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions // DeleteImage : Delete an image // This request deletes an image. This operation cannot be reversed. A system-provided image is not allowed to be // deleted. Additionally, an image cannot be deleted if it: -// - has a `status` of `tentative` or `deleting` -// - has a `status` of `pending` with a `status_reasons` code of `image_request_in_progress`. +// - has a `status` of `deleting` +// - has a `status` of `pending` with a `status_reasons` code of `image_request_in_progress` +// - has `catalog_offering.managed` set to `true`. func (vpc *VpcV1) DeleteImage(deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteImageWithContext(context.Background(), deleteImageOptions) } @@ -22725,6 +22729,10 @@ type BareMetalServerDisk struct { // The disk interface used for attaching the disk. // + // - `fcp`: Attached using Fiber Channel Protocol + // - `sata`: Attached using Serial Advanced Technology Attachment + // - `nvme`: Attached using Non-Volatile Memory Express + // // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. @@ -22743,10 +22751,15 @@ type BareMetalServerDisk struct { // Constants associated with the BareMetalServerDisk.InterfaceType property. // The disk interface used for attaching the disk. // +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. const ( + BareMetalServerDiskInterfaceTypeFcpConst = "fcp" BareMetalServerDiskInterfaceTypeNvmeConst = "nvme" BareMetalServerDiskInterfaceTypeSataConst = "sata" ) @@ -22989,6 +23002,7 @@ func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMess // BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct // Models which "extend" this model: +// - BareMetalServerNetworkInterfaceByHiperSocket // - BareMetalServerNetworkInterfaceByPci // - BareMetalServerNetworkInterfaceByVlan type BareMetalServerNetworkInterface struct { @@ -23008,6 +23022,8 @@ type BareMetalServerNetworkInterface struct { // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. + // + // This must be `true` when `interface_type` is `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` // The floating IPs associated with this network interface. @@ -23020,6 +23036,8 @@ type BareMetalServerNetworkInterface struct { ID *string `json:"id" validate:"required"` // The network interface type: + // - `hipersocket`: a virtual network 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 @@ -23030,6 +23048,10 @@ type BareMetalServerNetworkInterface struct { // - 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. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. InterfaceType *string `json:"interface_type" validate:"required"` // The MAC address of the interface. If absent, the value is not known. @@ -23072,19 +23094,26 @@ type BareMetalServerNetworkInterface struct { // Constants associated with the BareMetalServerNetworkInterface.InterfaceType property. // The network interface type: -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped +// - `hipersocket`: a virtual network 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 VLAN tag. -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its -// array of `allowed_vlans`. +// - `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. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. const ( - BareMetalServerNetworkInterfaceInterfaceTypePciConst = "pci" - BareMetalServerNetworkInterfaceInterfaceTypeVlanConst = "vlan" + BareMetalServerNetworkInterfaceInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkInterfaceInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfaceInterfaceTypeVlanConst = "vlan" ) // Constants associated with the BareMetalServerNetworkInterface.ResourceType property. @@ -23130,7 +23159,9 @@ func UnmarshalBareMetalServerNetworkInterface(m map[string]json.RawMessage, resu err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") return } - if discValue == "pci" { + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByHiperSocket) + } else if discValue == "pci" { err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByPci) } else if discValue == "vlan" { err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByVlan) @@ -23250,6 +23281,8 @@ type BareMetalServerNetworkInterfacePatch struct { // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. + // + // This must be `true` when `interface_type` is `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` // The user-defined name for network interface. Names must be unique within the instance the network interface resides @@ -23292,6 +23325,7 @@ func (bareMetalServerNetworkInterfacePatch *BareMetalServerNetworkInterfacePatch // BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct // Models which "extend" this model: +// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype // - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype // - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype type BareMetalServerNetworkInterfacePrototype struct { @@ -23308,19 +23342,26 @@ type BareMetalServerNetworkInterfacePrototype struct { // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. + // + // This must be `true` when `interface_type` is `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` // The network interface type: + // - `hipersocket`: a virtual network 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 VLAN 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 user-defined name for network interface. Names must be unique within the instance the network interface resides @@ -23355,19 +23396,25 @@ type BareMetalServerNetworkInterfacePrototype struct { // Constants associated with the BareMetalServerNetworkInterfacePrototype.InterfaceType property. // The network interface type: -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped +// - `hipersocket`: a virtual network 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 VLAN tag. -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its -// array of `allowed_vlans`. +// - 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 ( - BareMetalServerNetworkInterfacePrototypeInterfaceTypePciConst = "pci" - BareMetalServerNetworkInterfacePrototypeInterfaceTypeVlanConst = "vlan" + BareMetalServerNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkInterfacePrototypeInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfacePrototypeInterfaceTypeVlanConst = "vlan" ) func (*BareMetalServerNetworkInterfacePrototype) isaBareMetalServerNetworkInterfacePrototype() bool { @@ -23391,7 +23438,9 @@ func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMess err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") return } - if discValue == "pci" { + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + } else if discValue == "pci" { err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) } else if discValue == "vlan" { err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) @@ -23446,14 +23495,20 @@ type BareMetalServerPrimaryNetworkInterfacePrototype struct { // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. + // + // This must be `true` when `interface_type` is `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` // The network interface type: + // - `hipersocket`: a virtual network 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 VLAN tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. InterfaceType *string `json:"interface_type,omitempty"` // The user-defined name for network interface. Names must be unique within the instance the network interface resides @@ -23477,13 +23532,18 @@ type BareMetalServerPrimaryNetworkInterfacePrototype struct { // Constants associated with the BareMetalServerPrimaryNetworkInterfacePrototype.InterfaceType property. // The network interface type: -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped +// - `hipersocket`: a virtual network 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 VLAN tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( - BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypePciConst = "pci" + BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypePciConst = "pci" ) // NewBareMetalServerPrimaryNetworkInterfacePrototype : Instantiate BareMetalServerPrimaryNetworkInterfacePrototype (Generic Model Constructor) @@ -24179,6 +24239,10 @@ func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, resul type BareMetalServerProfileDiskSupportedInterfaces struct { // The disk interface used for attaching the disk. // + // - `fcp`: Attached using Fiber Channel Protocol + // - `sata`: Attached using Serial Advanced Technology Attachment + // - `nvme`: Attached using Non-Volatile Memory Express + // // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. @@ -24194,10 +24258,15 @@ type BareMetalServerProfileDiskSupportedInterfaces struct { // Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. // The disk interface used for attaching the disk. // +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. const ( + BareMetalServerProfileDiskSupportedInterfacesDefaultFcpConst = "fcp" BareMetalServerProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" BareMetalServerProfileDiskSupportedInterfacesDefaultSataConst = "sata" ) @@ -24211,10 +24280,15 @@ const ( // Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Values property. // The disk interface used for attaching the disk. // +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. const ( + BareMetalServerProfileDiskSupportedInterfacesValuesFcpConst = "fcp" BareMetalServerProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" BareMetalServerProfileDiskSupportedInterfacesValuesSataConst = "sata" ) @@ -24562,6 +24636,82 @@ func UnmarshalBareMetalServerTrustedPlatformModule(m map[string]json.RawMessage, 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 { + 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"` +} + +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 { + 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) + if err != nil { + 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 @@ -24886,7 +25036,9 @@ type CreateBareMetalServerConsoleAccessTokenOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The bare metal server console type for which this token may be used. + // The bare metal server console type for which this token may be used + // + // Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`. ConsoleType *string `json:"console_type" validate:"required"` // Indicates whether to disconnect an existing serial console session as the serial console cannot be shared. This has @@ -24898,7 +25050,9 @@ type CreateBareMetalServerConsoleAccessTokenOptions struct { } // Constants associated with the CreateBareMetalServerConsoleAccessTokenOptions.ConsoleType property. -// The bare metal server console type for which this token may be used. +// The bare metal server console type for which this token may be used +// +// Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`. const ( CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeSerialConst = "serial" CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeVncConst = "vnc" @@ -26079,7 +26233,7 @@ type CreateIpsecPolicyOptions struct { // Constants associated with the CreateIpsecPolicyOptions.AuthenticationAlgorithm property. // The authentication algorithm // -// The `md5` and `sha1` algorithms have been deprecated +// # The `md5` and `sha1` algorithms have been deprecated // // Must be `disabled` if and only if the `encryption_algorithm` is // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. @@ -26336,10 +26490,10 @@ type CreateLoadBalancerListenerOptions struct { // `https`. // // Additional restrictions: -// - If `default_pool` is set, the pool's protocol must match, or be compatible with -// the listener's protocol. At present, the compatible protocols are `http` and -// `https`. -// - If `https_redirect` is set, the protocol must be `http`. +// - If `default_pool` is set, the pool's protocol must match, or be compatible with +// the listener's protocol. At present, the compatible protocols are `http` and +// `https`. +// - If `https_redirect` is set, the protocol must be `http`. const ( CreateLoadBalancerListenerOptionsProtocolHTTPConst = "http" CreateLoadBalancerListenerOptionsProtocolHTTPSConst = "https" @@ -27484,8 +27638,9 @@ type CreateVPCAddressPrefixOptions struct { // The VPC identifier. VPCID *string `json:"vpc_id" validate:"required,ne="` - // The IPv4 range of the address prefix, expressed in CIDR format. The request must not overlap with any existing - // address prefixes in the VPC or any of the following reserved address ranges: + // The IPv4 range of the address prefix, expressed in CIDR format. The range must not overlap with any existing address + // prefixes in the VPC or any of the following reserved address ranges: + // // - `127.0.0.0/8` (IPv4 loopback addresses) // - `161.26.0.0/16` (IBM services) // - `166.8.0.0/14` (Cloud Service Endpoints) @@ -27739,31 +27894,43 @@ type CreateVPCRoutingTableOptions struct { Name *string `json:"name,omitempty"` // If set to `true`, this routing table will be used to route traffic that originates from [Direct - // Link](https://cloud.ibm.com/docs/dl/) to this VPC. For this to succeed, the VPC must not already have a routing - // table with this property set to `true`. + // Link](https://cloud.ibm.com/docs/dl) to this VPC. The VPC must not already have a routing table with this property + // set to `true`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP // address or a VPN gateway connection, the packet will be dropped. + // + // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled + // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing + // table. RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` + // If set to `true`, this routing table will be used to route traffic that originates from the internet. For this to + // succeed, the VPC must not already have a routing table with this property set to `true`. + // + // Incoming traffic will be routed according to the routing table with two exceptions: + // - Traffic destined for IP addresses associated with public gateways will not be + // subject to routes in this routing table. + // - Routes with an action of deliver are treated as drop unless the `next_hop` is an + // IP address bound to a network interface on a subnet in the route's `zone`. + // Therefore, if an incoming packet matches a route with a `next_hop` of an + // internet-bound IP address or a VPN gateway connection, the packet will be dropped. + RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"` + // If set to `true`, this routing table will be used to route traffic that originates from [Transit - // Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. For this to succeed, the VPC must not already - // have a routing table with this property set to `true`. + // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. The VPC must not already have a routing table with + // this property set to `true`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP // address or a VPN gateway connection, the packet will be dropped. - // - // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled - // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing - // table. RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` // If set to `true`, this routing table will be used to route traffic that originates from subnets in other zones in - // this VPC. For this to succeed, the VPC must not already have a routing table with this property set to `true`. + // this VPC. The VPC must not already have a routing table with this property set to `true`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. @@ -27810,6 +27977,12 @@ func (_options *CreateVPCRoutingTableOptions) SetRouteDirectLinkIngress(routeDir return _options } +// SetRouteInternetIngress : Allow user to set RouteInternetIngress +func (_options *CreateVPCRoutingTableOptions) SetRouteInternetIngress(routeInternetIngress bool) *CreateVPCRoutingTableOptions { + _options.RouteInternetIngress = core.BoolPtr(routeInternetIngress) + return _options +} + // SetRouteTransitGatewayIngress : Allow user to set RouteTransitGatewayIngress func (_options *CreateVPCRoutingTableOptions) SetRouteTransitGatewayIngress(routeTransitGatewayIngress bool) *CreateVPCRoutingTableOptions { _options.RouteTransitGatewayIngress = core.BoolPtr(routeTransitGatewayIngress) @@ -30055,7 +30228,7 @@ type DefaultRoutingTable struct { ResourceType *string `json:"resource_type" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from - // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. + // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in @@ -30063,8 +30236,19 @@ type DefaultRoutingTable struct { // address or a VPN gateway connection, the packet will be dropped. RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` + // Indicates whether this routing table is used to route traffic that originates from the internet. + // + // Incoming traffic will be routed according to the routing table with two exceptions: + // - Traffic destined for IP addresses associated with public gateways will not be + // subject to routes in this routing table. + // - Routes with an action of deliver are treated as drop unless the `next_hop` is an + // IP address bound to a network interface on a subnet in the route's `zone`. + // Therefore, if an incoming packet matches a route with a `next_hop` of an + // internet-bound IP address or a VPN gateway connection, the packet will be dropped. + RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` + // Indicates whether this routing table is used to route traffic that originates from from [Transit - // Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. + // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in @@ -30146,6 +30330,10 @@ func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface if err != nil { return } + err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) if err != nil { return @@ -32843,9 +33031,8 @@ type FloatingIPPatch struct { // The unique user-defined name for this floating IP. Name *string `json:"name,omitempty"` - // The network interface to bind the floating IP to, replacing any existing binding. For - // this request to succeed, the floating IP must not be required by another resource, such - // as a public gateway. + // The network interface to bind the floating IP to, replacing any existing binding. + // The floating IP must not be required by another resource, such as a public gateway. Target FloatingIPTargetPatchIntf `json:"target,omitempty"` } @@ -33072,8 +33259,8 @@ func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) return } -// FloatingIPTargetPatch : The network interface to bind the floating IP to, replacing any existing binding. For this request to succeed, the -// floating IP must not be required by another resource, such as a public gateway. +// FloatingIPTargetPatch : The network interface to bind the floating IP to, replacing any existing binding. The floating IP must not be +// required by another resource, such as a public gateway. // Models which "extend" this model: // - FloatingIPTargetPatchNetworkInterfaceIdentityByID // - FloatingIPTargetPatchNetworkInterfaceIdentityByHref @@ -33158,9 +33345,18 @@ type FlowLogCollector struct { // The Cloud Object Storage bucket where the collected flows are logged. StorageBucket *LegacyCloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` - // The target this collector is collecting flow logs for. If the target is an instance, - // subnet, or VPC, flow logs will not be collected for any network interfaces within the - // target that are themselves the target of a more specific flow log collector. + // The target this collector is collecting flow logs for. + // - If the target is a network interface, flow logs will be collected + // for that network interface. + // - If the target is a virtual server instance, flow logs will be collected + // for all network interfaces attached to that instance. + // - If the target is a subnet, flow logs will be collected + // for all network interfaces attached to that subnet. + // - If the target is a VPC, flow logs will be collected for network interfaces + // attached to all subnets within that VPC. + // If the target is an instance, subnet, or VPC, flow logs will not be collected + // for any network interfaces within the target that are themselves the target of + // a more specific flow log collector. Target FlowLogCollectorTargetIntf `json:"target" validate:"required"` // The VPC this flow log collector resides in. @@ -33361,9 +33557,18 @@ func (flowLogCollectorPatch *FlowLogCollectorPatch) AsPatch() (_patch map[string return } -// FlowLogCollectorTarget : The target this collector is collecting flow logs for. If the target is an instance, subnet, or VPC, flow logs will -// not be collected for any network interfaces within the target that are themselves the target of a more specific flow -// log collector. +// FlowLogCollectorTarget : The target this collector is collecting flow logs for. +// - If the target is a network interface, flow logs will be collected +// for that network interface. +// - If the target is a virtual server instance, flow logs will be collected +// for all network interfaces attached to that instance. +// - If the target is a subnet, flow logs will be collected +// for all network interfaces attached to that subnet. +// - If the target is a VPC, flow logs will be collected for network interfaces +// attached to all subnets within that VPC. If the target is an instance, subnet, or VPC, flow logs will not be +// +// collected for any network interfaces within the target that are themselves the target of a more specific flow log +// collector. // Models which "extend" this model: // - FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext // - FlowLogCollectorTargetInstanceReference @@ -36470,7 +36675,7 @@ type IPsecPolicy struct { // Constants associated with the IPsecPolicy.AuthenticationAlgorithm property. // The authentication algorithm // -// The `md5` and `sha1` algorithms have been deprecated +// # The `md5` and `sha1` algorithms have been deprecated // // Must be `disabled` if and only if the `encryption_algorithm` is // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. @@ -36726,7 +36931,7 @@ type IPsecPolicyPatch struct { // Constants associated with the IPsecPolicyPatch.AuthenticationAlgorithm property. // The authentication algorithm // -// The `md5` and `sha1` algorithms have been deprecated +// # The `md5` and `sha1` algorithms have been deprecated // // Must be `disabled` if and only if the `encryption_algorithm` is // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. @@ -36940,6 +37145,8 @@ func UnmarshalIkePolicyReferenceDeleted(m map[string]json.RawMessage, result int // Image : Image struct type Image struct { + CatalogOffering *ImageCatalogOffering `json:"catalog_offering" validate:"required"` + // The date and time that the image was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -36966,8 +37173,7 @@ type Image struct { // The minimum size (in gigabytes) of a volume onto which this image may be provisioned. // - // This property may be absent if the image has a `status` of `pending`, `tentative`, or - // `failed`. + // This property may be absent if the image has a `status` of `pending` or `failed`. MinimumProvisionedSize *int64 `json:"minimum_provisioned_size,omitempty"` // The user-defined or system-provided name for this image. @@ -36988,11 +37194,9 @@ type Image struct { // - available: image can be used (provisionable) // - deleting: image is being deleted, and can no longer be used to provision new // resources - // - deprecated: image can be used, but is slated to become `obsolete` (provisionable) + // - deprecated: image is administratively slated to be deleted // - failed: image is corrupt or did not pass validation - // - obsolete: image can no longer be used to provision new resources // - pending: image is being imported and is not yet `available` - // - tentative: image import has timed out (contact support) // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) // // The enumerated values for this property are expected to expand in the future. When processing this property, check @@ -37031,15 +37235,13 @@ const ( // Constants associated with the Image.Status property. // The status of this image -// - available: image can be used (provisionable) -// - deleting: image is being deleted, and can no longer be used to provision new -// resources -// - deprecated: image can be used, but is slated to become `obsolete` (provisionable) -// - failed: image is corrupt or did not pass validation -// - obsolete: image can no longer be used to provision new resources -// - pending: image is being imported and is not yet `available` -// - tentative: image import has timed out (contact support) -// - unusable: image cannot be used (see `status_reasons[]` for possible remediation) +// - available: image can be used (provisionable) +// - deleting: image is being deleted, and can no longer be used to provision new +// resources +// - deprecated: image is administratively slated to be deleted +// - failed: image is corrupt or did not pass validation +// - pending: image is being imported and is not yet `available` +// - unusable: image cannot be used (see `status_reasons[]` for possible remediation) // // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the @@ -37050,7 +37252,6 @@ const ( ImageStatusDeprecatedConst = "deprecated" ImageStatusFailedConst = "failed" ImageStatusPendingConst = "pending" - ImageStatusTentativeConst = "tentative" ImageStatusUnusableConst = "unusable" ) @@ -37064,6 +37265,10 @@ const ( // UnmarshalImage unmarshals an instance of Image from the specified map of raw messages. func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(Image) + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalImageCatalogOffering) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -37128,6 +37333,37 @@ func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error return } +// ImageCatalogOffering : ImageCatalogOffering struct +type ImageCatalogOffering struct { + // Indicates whether this image is managed as part of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. If an image is managed, + // accounts in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise) with access to that catalog can + // specify the image's catalog offering version CRN to provision virtual server instances using the image. + Managed *bool `json:"managed" validate:"required"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering version associated with this image. + // + // If absent, this image is not associated with a cloud catalog offering. + Version *CatalogOfferingVersionReference `json:"version,omitempty"` +} + +// UnmarshalImageCatalogOffering unmarshals an instance of ImageCatalogOffering from the specified map of raw messages. +func UnmarshalImageCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageCatalogOffering) + err = core.UnmarshalPrimitive(m, "managed", &obj.Managed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ImageCollection : ImageCollection struct type ImageCollection struct { // A link to the first page of resources. @@ -37398,7 +37634,7 @@ type ImagePrototype struct { OperatingSystem OperatingSystemIdentityIntf `json:"operating_system,omitempty"` // The volume from which to create the image. The specified volume must: - // - Originate from an image, which will be used to populate this image's + // - Have an `operating_system`, which will be used to populate this image's // operating system information. // - Not be `active` or `busy`. // @@ -37568,6 +37804,10 @@ type Instance struct { // Boot volume attachment. BootVolumeAttachment *VolumeAttachmentReferenceInstanceContext `json:"boot_volume_attachment" validate:"required"` + // If present, this virtual server instance was provisioned from a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user). + CatalogOffering *InstanceCatalogOffering `json:"catalog_offering,omitempty"` + // The date and time that the virtual server instance was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -37718,6 +37958,10 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er if err != nil { return } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOffering) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -38025,6 +38269,72 @@ func UnmarshalInstanceAvailabilityPrototype(m map[string]json.RawMessage, result return } +// InstanceCatalogOffering : InstanceCatalogOffering struct +type InstanceCatalogOffering struct { + // The catalog offering version this virtual server instance was provisioned from. + // + // The catalog offering version is not managed by the IBM VPC service, and may no longer + // exist, or may refer to a different image CRN than the `image.crn` for this virtual + // server instance. However, all images associated with a catalog offering version will + // have the same checksum, and therefore will have the same data. + Version *CatalogOfferingVersionReference `json:"version" validate:"required"` +} + +// UnmarshalInstanceCatalogOffering unmarshals an instance of InstanceCatalogOffering from the specified map of raw messages. +func UnmarshalInstanceCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCatalogOffering) + err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCatalogOfferingPrototype : The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering or offering version to use +// when provisioning this virtual server instance. +// +// If an offering is specified, the latest version of that offering will be used. +// +// The specified offering or offering version may be in a different account in the same +// [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject to IAM policies. +// Models which "extend" this model: +// - InstanceCatalogOfferingPrototypeCatalogOfferingByOffering +// - InstanceCatalogOfferingPrototypeCatalogOfferingByVersion +type InstanceCatalogOfferingPrototype struct { + // Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering by a unique property. + Offering CatalogOfferingIdentityIntf `json:"offering,omitempty"` + + // Identifies a version of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a + // unique property. + Version CatalogOfferingVersionIdentityIntf `json:"version,omitempty"` +} + +func (*InstanceCatalogOfferingPrototype) isaInstanceCatalogOfferingPrototype() bool { + return true +} + +type InstanceCatalogOfferingPrototypeIntf interface { + isaInstanceCatalogOfferingPrototype() bool +} + +// UnmarshalInstanceCatalogOfferingPrototype unmarshals an instance of InstanceCatalogOfferingPrototype from the specified map of raw messages. +func UnmarshalInstanceCatalogOfferingPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCatalogOfferingPrototype) + err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceCollection : InstanceCollection struct type InstanceCollection struct { // A link to the first page of resources. @@ -38501,11 +38811,11 @@ type InstanceGroup struct { // Constants associated with the InstanceGroup.Status property. // The status of the instance group -// - `deleting`: Group is being deleted -// - `healthy`: Group has `membership_count` instances -// - `scaling`: Instances in the group are being created or deleted to reach -// `membership_count` -// - `unhealthy`: Group is unable to reach `membership_count` instances. +// - `deleting`: Group is being deleted +// - `healthy`: Group has `membership_count` instances +// - `scaling`: Instances in the group are being created or deleted to reach +// `membership_count` +// - `unhealthy`: Group is unable to reach `membership_count` instances. const ( InstanceGroupStatusDeletingConst = "deleting" InstanceGroupStatusHealthyConst = "healthy" @@ -40629,13 +40939,14 @@ func (instancePatch *InstancePatch) AsPatch() (_patch map[string]interface{}, er // 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. -// - 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`. -// - Have the same `vcpu.architecture`. +// - 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. +// - 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`. +// - Have the same `vcpu.architecture`. +// // Models which "extend" this model: // - InstancePatchProfileInstanceProfileIdentityByName // - InstancePatchProfileInstanceProfileIdentityByHref @@ -41899,6 +42210,7 @@ func UnmarshalInstanceProfileVolumeBandwidth(m map[string]json.RawMessage, resul // InstancePrototype : InstancePrototype struct // Models which "extend" this model: // - InstancePrototypeInstanceByImage +// - InstancePrototypeInstanceByCatalogOffering // - InstancePrototypeInstanceBySourceSnapshot // - InstancePrototypeInstanceBySourceTemplate type InstancePrototype struct { @@ -41981,6 +42293,16 @@ type InstancePrototype struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` + // The template to create this virtual server instance from. SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` } @@ -42064,6 +42386,10 @@ func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{} if err != nil { return } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) if err != nil { return @@ -42186,6 +42512,7 @@ func UnmarshalInstanceStatusReason(m map[string]json.RawMessage, result interfac // Models which "extend" this model: // - InstanceTemplateInstanceByImage // - InstanceTemplateInstanceBySourceSnapshot +// - InstanceTemplateInstanceByCatalogOffering type InstanceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` @@ -42275,6 +42602,16 @@ type InstanceTemplate struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` } func (*InstanceTemplate) isaInstanceTemplate() bool { @@ -42372,6 +42709,10 @@ func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -42531,6 +42872,7 @@ func (instanceTemplatePatch *InstanceTemplatePatch) AsPatch() (_patch map[string // - InstanceTemplatePrototypeInstanceByImage // - InstanceTemplatePrototypeInstanceBySourceTemplate // - InstanceTemplatePrototypeInstanceBySourceSnapshot +// - InstanceTemplatePrototypeInstanceByCatalogOffering type InstanceTemplatePrototype struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` @@ -42611,6 +42953,17 @@ type InstanceTemplatePrototype struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering version to use when provisioning this virtual server instance. + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account, subject to + // IAM policies. + // + // If specified, `image` must not be specified, and `source_template` must not have + // `image` specified. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` + // The template to create this virtual server instance from. SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` } @@ -42694,6 +43047,10 @@ func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result int if err != nil { return } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) if err != nil { return @@ -46673,20 +47030,25 @@ const ( // Constants associated with the LoadBalancer.ProvisioningStatus property. // The provisioning status of this load balancer: // -// - `active`: The load balancer is running. -// - `create_pending`: The load balancer is being created. -// - `delete_pending`: The load balancer is being deleted. -// - `maintenance_pending`: The load balancer is unavailable due to an internal -// error (contact IBM support). -// - `migrate_pending`: The load balancer is migrating to the requested configuration. -// Performance may be degraded. -// - `update_pending`: The load balancer is being updated +// - `active`: The load balancer is running. +// +// - `create_pending`: The load balancer is being created. +// +// - `delete_pending`: The load balancer is being deleted. +// +// - `maintenance_pending`: The load balancer is unavailable due to an internal +// error (contact IBM support). +// +// - `migrate_pending`: The load balancer is migrating to the requested configuration. +// Performance may be degraded. +// +// - `update_pending`: The load balancer is being updated // to the requested configuration. // -// The enumerated values for this property are expected to expand in the future. When -// processing this property, check for and log unknown values. Optionally halt -// processing and surface the error, or bypass the load balancer on which the -// unexpected property value was encountered. +// The enumerated values for this property are expected to expand in the future. When +// processing this property, check for and log unknown values. Optionally halt +// processing and surface the error, or bypass the load balancer on which the +// unexpected property value was encountered. const ( LoadBalancerProvisioningStatusActiveConst = "active" LoadBalancerProvisioningStatusCreatePendingConst = "create_pending" @@ -47310,7 +47672,7 @@ type LoadBalancerListenerPatch struct { // - If `default_pool` is set, the protocol cannot be changed. // - If `https_redirect` is set, the protocol must be `http`. // - If another listener's `https_redirect` targets this listener, the protocol must be - // `https`. + // `https`. Protocol *string `json:"protocol,omitempty"` } @@ -47325,7 +47687,7 @@ type LoadBalancerListenerPatch struct { // - If `default_pool` is set, the protocol cannot be changed. // - If `https_redirect` is set, the protocol must be `http`. // - If another listener's `https_redirect` targets this listener, the protocol must be -// `https`. +// `https`. const ( LoadBalancerListenerPatchProtocolHTTPConst = "http" LoadBalancerListenerPatchProtocolHTTPSConst = "https" @@ -48104,9 +48466,10 @@ func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, res } // LoadBalancerListenerPolicyTargetPatch : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. -// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. -// - If `action` is `https_redirect`, specify a -// `LoadBalancerListenerPolicyHTTPSRedirectPatch`. +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. +// - If `action` is `https_redirect`, specify a +// `LoadBalancerListenerPolicyHTTPSRedirectPatch`. +// // Models which "extend" this model: // - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity // - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch @@ -48171,9 +48534,10 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage } // LoadBalancerListenerPolicyTargetPrototype : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. -// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. -// - If `action` is `https_redirect`, specify a -// `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. +// - If `action` is `https_redirect`, specify a +// `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. +// // Models which "extend" this model: // - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity // - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype @@ -48316,10 +48680,10 @@ type LoadBalancerListenerPrototypeLoadBalancerContext struct { // `https`. // // Additional restrictions: -// - If `default_pool` is set, the pool's protocol must match, or be compatible with -// the listener's protocol. At present, the compatible protocols are `http` and -// `https`. -// - If `https_redirect` is set, the protocol must be `http`. +// - If `default_pool` is set, the pool's protocol must match, or be compatible with +// the listener's protocol. At present, the compatible protocols are `http` and +// `https`. +// - If `https_redirect` is set, the protocol must be `http`. const ( LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPConst = "http" LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPSConst = "https" @@ -54675,7 +55039,7 @@ type RoutingTable struct { ResourceType *string `json:"resource_type" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from - // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. + // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in @@ -54683,8 +55047,19 @@ type RoutingTable struct { // address or a VPN gateway connection, the packet will be dropped. RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` + // Indicates whether this routing table is used to route traffic that originates from the internet. + // + // Incoming traffic will be routed according to the routing table with two exceptions: + // - Traffic destined for IP addresses associated with public gateways will not be + // subject to routes in this routing table. + // - Routes with an action of deliver are treated as drop unless the `next_hop` is an + // IP address bound to a network interface on a subnet in the route's `zone`. + // Therefore, if an incoming packet matches a route with a `next_hop` of an + // internet-bound IP address or a VPN gateway connection, the packet will be dropped. + RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` + // Indicates whether this routing table is used to route traffic that originates from from [Transit - // Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. + // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in @@ -54765,6 +55140,10 @@ func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) if err != nil { return @@ -54937,8 +55316,21 @@ type RoutingTablePatch struct { // address or a VPN gateway connection, the packet will be dropped. RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` + // Indicates whether this routing table is used to route traffic that originates from the internet. Updating to `true` + // selects this routing table, provided no other routing table in the VPC already has this property set to `true`. + // Updating to `false` deselects this routing table. + // + // Incoming traffic will be routed according to the routing table with two exceptions: + // - Traffic destined for IP addresses associated with public gateways will not be subject + // to routes in this routing table. + // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is an + // IP address bound to a network interface on a subnet in the route's `zone`. Therefore, + // if an incoming packet matches a route with a `next_hop` of an internet-bound IP + // address or a VPN gateway connection, the packet will be dropped. + RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"` + // Indicates whether this routing table is used to route traffic that originates from - // [Transit Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. Updating to + // [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. Updating to // `true` selects this routing table, provided no other routing table in the VPC already has this property set to // `true`, and no subnets are attached to this routing table. Updating to `false` deselects this routing table. // @@ -54979,6 +55371,10 @@ func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{} if err != nil { return } + err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) if err != nil { return @@ -56974,8 +57370,8 @@ type SubnetPatch struct { PublicGateway SubnetPublicGatewayPatchIntf `json:"public_gateway,omitempty"` // The routing table to use for this subnet. The routing table properties - // `route_direct_link_ingress`, `route_transit_gateway_ingress`, and - // `route_vpc_zone_ingress` must be `false`. + // `route_direct_link_ingress`, `route_internet_ingress`, + // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` } @@ -57037,7 +57433,8 @@ type SubnetPrototype struct { // The routing table to use for this subnet. If unspecified, the default routing table // for the VPC is used. The routing table properties `route_direct_link_ingress`, - // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. + // `route_internet_ingress`, `route_transit_gateway_ingress`, and + // `route_vpc_zone_ingress` must be `false`. RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` // The VPC the subnet will reside in. @@ -64055,9 +64452,9 @@ func UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializat return } -// BareMetalServerNetworkInterfaceByPci : BareMetalServerNetworkInterfaceByPci struct +// BareMetalServerNetworkInterfaceByHiperSocket : BareMetalServerNetworkInterfaceByHiperSocket struct // This model "extends" BareMetalServerNetworkInterface -type BareMetalServerNetworkInterfaceByPci struct { +type BareMetalServerNetworkInterfaceByHiperSocket 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" validate:"required"` @@ -64074,6 +64471,8 @@ type BareMetalServerNetworkInterfaceByPci struct { // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. + // + // This must be `true` when `interface_type` is `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` // The floating IPs associated with this network interface. @@ -64111,56 +64510,47 @@ type BareMetalServerNetworkInterfaceByPci struct { // The type of this bare metal server network interface. Type *string `json:"type" validate:"required"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. - AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` - - // - `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 VLAN tag. + // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity + // within a `s390x` based system. InterfaceType *string `json:"interface_type" validate:"required"` } -// Constants associated with the BareMetalServerNetworkInterfaceByPci.ResourceType property. +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.ResourceType property. // The resource type. const ( - BareMetalServerNetworkInterfaceByPciResourceTypeNetworkInterfaceConst = "network_interface" + BareMetalServerNetworkInterfaceByHiperSocketResourceTypeNetworkInterfaceConst = "network_interface" ) -// Constants associated with the BareMetalServerNetworkInterfaceByPci.Status property. +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.Status property. // The status of the network interface. const ( - BareMetalServerNetworkInterfaceByPciStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceByPciStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceByPciStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceByPciStatusPendingConst = "pending" + BareMetalServerNetworkInterfaceByHiperSocketStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByHiperSocketStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByHiperSocketStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByHiperSocketStatusPendingConst = "pending" ) -// Constants associated with the BareMetalServerNetworkInterfaceByPci.Type property. +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.Type property. // The type of this bare metal server network interface. const ( - BareMetalServerNetworkInterfaceByPciTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceByPciTypeSecondaryConst = "secondary" + BareMetalServerNetworkInterfaceByHiperSocketTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByHiperSocketTypeSecondaryConst = "secondary" ) -// Constants associated with the BareMetalServerNetworkInterfaceByPci.InterfaceType property. -// - `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 VLAN tag. +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.InterfaceType property. +// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// within a `s390x` based system. const ( - BareMetalServerNetworkInterfaceByPciInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfaceByHiperSocketInterfaceTypeHipersocketConst = "hipersocket" ) -func (*BareMetalServerNetworkInterfaceByPci) isaBareMetalServerNetworkInterface() bool { +func (*BareMetalServerNetworkInterfaceByHiperSocket) isaBareMetalServerNetworkInterface() bool { return true } -// UnmarshalBareMetalServerNetworkInterfaceByPci unmarshals an instance of BareMetalServerNetworkInterfaceByPci from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceByPci) +// UnmarshalBareMetalServerNetworkInterfaceByHiperSocket unmarshals an instance of BareMetalServerNetworkInterfaceByHiperSocket from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByHiperSocket) err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { return @@ -64221,10 +64611,6 @@ func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, if err != nil { return } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { return @@ -64233,9 +64619,9 @@ func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, return } -// BareMetalServerNetworkInterfaceByVlan : BareMetalServerNetworkInterfaceByVlan struct +// BareMetalServerNetworkInterfaceByPci : BareMetalServerNetworkInterfaceByPci struct // This model "extends" BareMetalServerNetworkInterface -type BareMetalServerNetworkInterfaceByVlan struct { +type BareMetalServerNetworkInterfaceByPci 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" validate:"required"` @@ -64252,6 +64638,8 @@ type BareMetalServerNetworkInterfaceByVlan struct { // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. + // + // This must be `true` when `interface_type` is `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` // The floating IPs associated with this network interface. @@ -64289,61 +64677,241 @@ type BareMetalServerNetworkInterfaceByVlan struct { // The type of this bare metal server network interface. Type *string `json:"type" validate:"required"` - // Indicates if the interface can float to any other server within the same - // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal - // server in the resource group. Applies only to `vlan` type interfaces. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float" validate:"required"` + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` - // - `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. + // - `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 VLAN tag. InterfaceType *string `json:"interface_type" validate:"required"` - - // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. - Vlan *int64 `json:"vlan" validate:"required"` } -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.ResourceType property. +// Constants associated with the BareMetalServerNetworkInterfaceByPci.ResourceType property. // The resource type. const ( - BareMetalServerNetworkInterfaceByVlanResourceTypeNetworkInterfaceConst = "network_interface" + BareMetalServerNetworkInterfaceByPciResourceTypeNetworkInterfaceConst = "network_interface" ) -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Status property. +// Constants associated with the BareMetalServerNetworkInterfaceByPci.Status property. // The status of the network interface. const ( - BareMetalServerNetworkInterfaceByVlanStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceByVlanStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceByVlanStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceByVlanStatusPendingConst = "pending" + BareMetalServerNetworkInterfaceByPciStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByPciStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByPciStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByPciStatusPendingConst = "pending" ) -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Type property. +// Constants associated with the BareMetalServerNetworkInterfaceByPci.Type property. // The type of this bare metal server network interface. const ( - BareMetalServerNetworkInterfaceByVlanTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceByVlanTypeSecondaryConst = "secondary" + BareMetalServerNetworkInterfaceByPciTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByPciTypeSecondaryConst = "secondary" ) -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.InterfaceType property. -// - `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. +// Constants associated with the BareMetalServerNetworkInterfaceByPci.InterfaceType property. +// - `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 VLAN tag. const ( - BareMetalServerNetworkInterfaceByVlanInterfaceTypeVlanConst = "vlan" + BareMetalServerNetworkInterfaceByPciInterfaceTypePciConst = "pci" ) -func (*BareMetalServerNetworkInterfaceByVlan) isaBareMetalServerNetworkInterface() bool { +func (*BareMetalServerNetworkInterfaceByPci) isaBareMetalServerNetworkInterface() bool { return true } -// UnmarshalBareMetalServerNetworkInterfaceByVlan unmarshals an instance of BareMetalServerNetworkInterfaceByVlan from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceByVlan) +// UnmarshalBareMetalServerNetworkInterfaceByPci unmarshals an instance of BareMetalServerNetworkInterfaceByPci from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByPci) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfaceByVlan : BareMetalServerNetworkInterfaceByVlan struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByVlan 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" validate:"required"` + + // The date and time that the network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - A single floating IP can be assigned to the network interface. + // + // If `false`: + // - Packets are passed unchanged to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - Multiple floating IPs can be assigned to the network interface. + // - `allow_ip_spoofing` must be set to `false`. + // + // This must be `true` when `interface_type` is `hipersocket`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + + // The floating IPs associated with this network interface. + FloatingIps []FloatingIPReference `json:"floating_ips,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The MAC address of the interface. If absent, the value is not known. + MacAddress *string `json:"mac_address" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The network interface port speed in Mbps. + 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 network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the network interface. + Status *string `json:"status" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The type of this bare metal server network interface. + Type *string `json:"type" validate:"required"` + + // Indicates if the interface can float to any other server within the same + // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal + // server in the resource group. Applies only to `vlan` type interfaces. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float" validate:"required"` + + // - `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. + InterfaceType *string `json:"interface_type" validate:"required"` + + // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + Vlan *int64 `json:"vlan" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceByVlanResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Status property. +// The status of the network interface. +const ( + BareMetalServerNetworkInterfaceByVlanStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByVlanStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByVlanStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByVlanStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Type property. +// The type of this bare metal server network interface. +const ( + BareMetalServerNetworkInterfaceByVlanTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByVlanTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.InterfaceType property. +// - `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. +const ( + BareMetalServerNetworkInterfaceByVlanInterfaceTypeVlanConst = "vlan" +) + +func (*BareMetalServerNetworkInterfaceByVlan) isaBareMetalServerNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfaceByVlan unmarshals an instance of BareMetalServerNetworkInterfaceByVlan from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByVlan) err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { return @@ -64420,6 +64988,106 @@ func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage return } +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype 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"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - A single floating IP can be assigned to the network interface. + // + // If `false`: + // - Packets are passed unchanged to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - Multiple floating IPs can be assigned to the network interface. + // - `allow_ip_spoofing` must be set to `false`. + // + // This must be `true` when `interface_type` is `hipersocket`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The user-defined name for network interface. Names must be unique within the instance the network interface resides + // in. 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 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 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 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"` + + // - `hipersocket`: a virtual network 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`. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype.InterfaceType property. +// - `hipersocket`: a virtual network 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`. +const ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototypeInterfaceTypeHipersocketConst = "hipersocket" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct // This model "extends" BareMetalServerNetworkInterfacePrototype type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct { @@ -64436,6 +65104,8 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. + // + // This must be `true` when `interface_type` is `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` // The user-defined name for network interface. Names must be unique within the instance the network interface resides @@ -64463,15 +65133,17 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc // - 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 VLAN tag. + // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. InterfaceType *string `json:"interface_type" validate:"required"` } // Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype.InterfaceType property. -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped +// - `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 VLAN tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototypeInterfaceTypePciConst = "pci" ) @@ -64545,6 +65217,8 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. + // + // This must be `true` when `interface_type` is `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` // The user-defined name for network interface. Names must be unique within the instance the network interface resides @@ -64574,6 +65248,7 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // - 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"` // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. @@ -64581,11 +65256,12 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl } // Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype.InterfaceType property. -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array -// of `allowed_vlans`. +// - `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 ( BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototypeInterfaceTypeVlanConst = "vlan" ) @@ -65683,6 +66359,70 @@ func UnmarshalBareMetalServerProfileMemoryRange(m map[string]json.RawMessage, re return } +// CatalogOfferingIdentityCatalogOfferingByCRN : CatalogOfferingIdentityCatalogOfferingByCRN struct +// This model "extends" CatalogOfferingIdentity +type CatalogOfferingIdentityCatalogOfferingByCRN struct { + // The CRN for this + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. + CRN *string `json:"crn" validate:"required"` +} + +// NewCatalogOfferingIdentityCatalogOfferingByCRN : Instantiate CatalogOfferingIdentityCatalogOfferingByCRN (Generic Model Constructor) +func (*VpcV1) NewCatalogOfferingIdentityCatalogOfferingByCRN(crn string) (_model *CatalogOfferingIdentityCatalogOfferingByCRN, err error) { + _model = &CatalogOfferingIdentityCatalogOfferingByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CatalogOfferingIdentityCatalogOfferingByCRN) isaCatalogOfferingIdentity() bool { + return true +} + +// UnmarshalCatalogOfferingIdentityCatalogOfferingByCRN unmarshals an instance of CatalogOfferingIdentityCatalogOfferingByCRN from the specified map of raw messages. +func UnmarshalCatalogOfferingIdentityCatalogOfferingByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingIdentityCatalogOfferingByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN : CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN struct +// This model "extends" CatalogOfferingVersionIdentity +type CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN 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"` +} + +// NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN : Instantiate CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN (Generic Model Constructor) +func (*VpcV1) NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(crn string) (_model *CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN, err error) { + _model = &CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN) isaCatalogOfferingVersionIdentity() bool { + return true +} + +// UnmarshalCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN unmarshals an instance of CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN from the specified map of raw messages. +func UnmarshalCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // CertificateInstanceIdentityByCRN : CertificateInstanceIdentityByCRN struct // This model "extends" CertificateInstanceIdentity type CertificateInstanceIdentityByCRN struct { @@ -67728,7 +68468,7 @@ type ImagePrototypeImageBySourceVolume struct { EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` // The volume from which to create the image. The specified volume must: - // - Originate from an image, which will be used to populate this image's + // - Have an `operating_system`, which will be used to populate this image's // operating system information. // - Not be `active` or `busy`. // @@ -67772,6 +68512,71 @@ func UnmarshalImagePrototypeImageBySourceVolume(m map[string]json.RawMessage, re return } +// InstanceCatalogOfferingPrototypeCatalogOfferingByOffering : InstanceCatalogOfferingPrototypeCatalogOfferingByOffering struct +// This model "extends" InstanceCatalogOfferingPrototype +type InstanceCatalogOfferingPrototypeCatalogOfferingByOffering struct { + // Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering by a unique property. + Offering CatalogOfferingIdentityIntf `json:"offering" validate:"required"` +} + +// NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering : Instantiate InstanceCatalogOfferingPrototypeCatalogOfferingByOffering (Generic Model Constructor) +func (*VpcV1) NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(offering CatalogOfferingIdentityIntf) (_model *InstanceCatalogOfferingPrototypeCatalogOfferingByOffering, err error) { + _model = &InstanceCatalogOfferingPrototypeCatalogOfferingByOffering{ + Offering: offering, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceCatalogOfferingPrototypeCatalogOfferingByOffering) isaInstanceCatalogOfferingPrototype() bool { + return true +} + +// UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering unmarshals an instance of InstanceCatalogOfferingPrototypeCatalogOfferingByOffering from the specified map of raw messages. +func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByOffering) + err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCatalogOfferingPrototypeCatalogOfferingByVersion : InstanceCatalogOfferingPrototypeCatalogOfferingByVersion struct +// This model "extends" InstanceCatalogOfferingPrototype +type InstanceCatalogOfferingPrototypeCatalogOfferingByVersion struct { + // Identifies a version of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a + // unique property. + Version CatalogOfferingVersionIdentityIntf `json:"version" validate:"required"` +} + +// NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion : Instantiate InstanceCatalogOfferingPrototypeCatalogOfferingByVersion (Generic Model Constructor) +func (*VpcV1) NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(version CatalogOfferingVersionIdentityIntf) (_model *InstanceCatalogOfferingPrototypeCatalogOfferingByVersion, err error) { + _model = &InstanceCatalogOfferingPrototypeCatalogOfferingByVersion{ + Version: version, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceCatalogOfferingPrototypeCatalogOfferingByVersion) isaInstanceCatalogOfferingPrototype() bool { + return true +} + +// UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion unmarshals an instance of InstanceCatalogOfferingPrototypeCatalogOfferingByVersion from the specified map of raw messages. +func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByVersion) + err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceGroupManagerActionPrototypeScheduledActionPrototype : InstanceGroupManagerActionPrototypeScheduledActionPrototype struct // Models which "extend" this model: // - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt @@ -70508,9 +71313,9 @@ func UnmarshalInstanceProfileVolumeBandwidthRange(m map[string]json.RawMessage, return } -// InstancePrototypeInstanceByImage : InstancePrototypeInstanceByImage struct +// InstancePrototypeInstanceByCatalogOffering : InstancePrototypeInstanceByCatalogOffering struct // This model "extends" InstancePrototype -type InstancePrototypeInstanceByImage struct { +type InstancePrototypeInstanceByCatalogOffering struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` @@ -70570,8 +71375,15 @@ type InstancePrototypeInstanceByImage struct { // The boot volume attachment for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` // Primary network interface. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` @@ -70580,10 +71392,10 @@ type InstancePrototypeInstanceByImage struct { Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// NewInstancePrototypeInstanceByImage : Instantiate InstancePrototypeInstanceByImage (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByImage, err error) { - _model = &InstancePrototypeInstanceByImage{ - Image: image, +// NewInstancePrototypeInstanceByCatalogOffering : Instantiate InstancePrototypeInstanceByCatalogOffering (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByCatalogOffering(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByCatalogOffering, err error) { + _model = &InstancePrototypeInstanceByCatalogOffering{ + CatalogOffering: catalogOffering, PrimaryNetworkInterface: primaryNetworkInterface, Zone: zone, } @@ -70591,13 +71403,13 @@ func (*VpcV1) NewInstancePrototypeInstanceByImage(image ImageIdentityIntf, prima return } -func (*InstancePrototypeInstanceByImage) isaInstancePrototype() bool { +func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototype() bool { return true } -// UnmarshalInstancePrototypeInstanceByImage unmarshals an instance of InstancePrototypeInstanceByImage from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByImage) +// UnmarshalInstancePrototypeInstanceByCatalogOffering unmarshals an instance of InstancePrototypeInstanceByCatalogOffering from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByCatalogOffering) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) if err != nil { return @@ -70654,7 +71466,7 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res if err != nil { return } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { return } @@ -70670,9 +71482,9 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res return } -// InstancePrototypeInstanceBySourceSnapshot : InstancePrototypeInstanceBySourceSnapshot struct +// InstancePrototypeInstanceByImage : InstancePrototypeInstanceByImage struct // This model "extends" InstancePrototype -type InstancePrototypeInstanceBySourceSnapshot struct { +type InstancePrototypeInstanceByImage struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` @@ -70730,7 +71542,10 @@ type InstancePrototypeInstanceBySourceSnapshot struct { VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` // Primary network interface. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` @@ -70739,10 +71554,10 @@ type InstancePrototypeInstanceBySourceSnapshot struct { Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// NewInstancePrototypeInstanceBySourceSnapshot : Instantiate InstancePrototypeInstanceBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceBySourceSnapshot, err error) { - _model = &InstancePrototypeInstanceBySourceSnapshot{ - BootVolumeAttachment: bootVolumeAttachment, +// NewInstancePrototypeInstanceByImage : Instantiate InstancePrototypeInstanceByImage (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByImage, err error) { + _model = &InstancePrototypeInstanceByImage{ + Image: image, PrimaryNetworkInterface: primaryNetworkInterface, Zone: zone, } @@ -70750,13 +71565,13 @@ func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshot(bootVolumeAttachment return } -func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototype() bool { +func (*InstancePrototypeInstanceByImage) isaInstancePrototype() bool { return true } -// UnmarshalInstancePrototypeInstanceBySourceSnapshot unmarshals an instance of InstancePrototypeInstanceBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceBySourceSnapshot) +// UnmarshalInstancePrototypeInstanceByImage unmarshals an instance of InstancePrototypeInstanceByImage from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByImage) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) if err != nil { return @@ -70809,7 +71624,11 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { return } @@ -70825,9 +71644,9 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes return } -// InstancePrototypeInstanceBySourceTemplate : InstancePrototypeInstanceBySourceTemplate struct +// InstancePrototypeInstanceBySourceSnapshot : InstancePrototypeInstanceBySourceSnapshot struct // This model "extends" InstancePrototype -type InstancePrototypeInstanceBySourceTemplate struct { +type InstancePrototypeInstanceBySourceSnapshot struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` @@ -70885,37 +71704,33 @@ type InstancePrototypeInstanceBySourceTemplate struct { VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image,omitempty"` + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` // Primary network interface. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The template to create this virtual server instance from. - SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` + Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// NewInstancePrototypeInstanceBySourceTemplate : Instantiate InstancePrototypeInstanceBySourceTemplate (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstancePrototypeInstanceBySourceTemplate, err error) { - _model = &InstancePrototypeInstanceBySourceTemplate{ - SourceTemplate: sourceTemplate, +// NewInstancePrototypeInstanceBySourceSnapshot : Instantiate InstancePrototypeInstanceBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceBySourceSnapshot, err error) { + _model = &InstancePrototypeInstanceBySourceSnapshot{ + BootVolumeAttachment: bootVolumeAttachment, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, } err = core.ValidateStruct(_model, "required parameters") return } -func (*InstancePrototypeInstanceBySourceTemplate) isaInstancePrototype() bool { +func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototype() bool { return true } -// UnmarshalInstancePrototypeInstanceBySourceTemplate unmarshals an instance of InstancePrototypeInstanceBySourceTemplate from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceBySourceTemplate) +// UnmarshalInstancePrototypeInstanceBySourceSnapshot unmarshals an instance of InstancePrototypeInstanceBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceSnapshot) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) if err != nil { return @@ -70968,11 +71783,7 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { return } @@ -70980,10 +71791,6 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - return - } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -70992,102 +71799,453 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes return } -// InstanceTemplateIdentityByCRN : InstanceTemplateIdentityByCRN struct -// This model "extends" InstanceTemplateIdentity -type InstanceTemplateIdentityByCRN struct { - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstanceTemplateIdentityByCRN : Instantiate InstanceTemplateIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplateIdentityByCRN(crn string) (_model *InstanceTemplateIdentityByCRN, err error) { - _model = &InstanceTemplateIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplateIdentityByCRN) isaInstanceTemplateIdentity() bool { - return true -} - -// UnmarshalInstanceTemplateIdentityByCRN unmarshals an instance of InstanceTemplateIdentityByCRN from the specified map of raw messages. -func UnmarshalInstanceTemplateIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateIdentityByHref : InstanceTemplateIdentityByHref struct -// This model "extends" InstanceTemplateIdentity -type InstanceTemplateIdentityByHref struct { - // The URL for this instance template. - Href *string `json:"href" validate:"required"` -} - -// NewInstanceTemplateIdentityByHref : Instantiate InstanceTemplateIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplateIdentityByHref(href string) (_model *InstanceTemplateIdentityByHref, err error) { - _model = &InstanceTemplateIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplateIdentityByHref) isaInstanceTemplateIdentity() bool { - return true -} - -// UnmarshalInstanceTemplateIdentityByHref unmarshals an instance of InstanceTemplateIdentityByHref from the specified map of raw messages. -func UnmarshalInstanceTemplateIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateIdentityByID : InstanceTemplateIdentityByID struct -// This model "extends" InstanceTemplateIdentity -type InstanceTemplateIdentityByID struct { - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` -} - -// NewInstanceTemplateIdentityByID : Instantiate InstanceTemplateIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplateIdentityByID(id string) (_model *InstanceTemplateIdentityByID, err error) { - _model = &InstanceTemplateIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplateIdentityByID) isaInstanceTemplateIdentity() bool { - return true -} - -// UnmarshalInstanceTemplateIdentityByID unmarshals an instance of InstanceTemplateIdentityByID from the specified map of raw messages. -func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceByImage : InstanceTemplatePrototypeInstanceByImage struct -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceByImage struct { +// InstancePrototypeInstanceBySourceTemplate : InstancePrototypeInstanceBySourceTemplate struct +// This model "extends" InstancePrototype +type InstancePrototypeInstanceBySourceTemplate struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering version to use when provisioning this virtual server instance. + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account, subject to + // IAM policies. + // + // If specified, `image` must not be specified, and `source_template` must not have + // `image` specified. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// NewInstancePrototypeInstanceBySourceTemplate : Instantiate InstancePrototypeInstanceBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstancePrototypeInstanceBySourceTemplate, err error) { + _model = &InstancePrototypeInstanceBySourceTemplate{ + SourceTemplate: sourceTemplate, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceTemplate) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceTemplate unmarshals an instance of InstancePrototypeInstanceBySourceTemplate from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceTemplate) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByCRN : InstanceTemplateIdentityByCRN struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByCRN struct { + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstanceTemplateIdentityByCRN : Instantiate InstanceTemplateIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByCRN(crn string) (_model *InstanceTemplateIdentityByCRN, err error) { + _model = &InstanceTemplateIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByCRN) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByCRN unmarshals an instance of InstanceTemplateIdentityByCRN from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByHref : InstanceTemplateIdentityByHref struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByHref struct { + // The URL for this instance template. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceTemplateIdentityByHref : Instantiate InstanceTemplateIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByHref(href string) (_model *InstanceTemplateIdentityByHref, err error) { + _model = &InstanceTemplateIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByHref) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByHref unmarshals an instance of InstanceTemplateIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByID : InstanceTemplateIdentityByID struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByID struct { + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceTemplateIdentityByID : Instantiate InstanceTemplateIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByID(id string) (_model *InstanceTemplateIdentityByID, err error) { + _model = &InstanceTemplateIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByID) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByID unmarshals an instance of InstanceTemplateIdentityByID from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceByCatalogOffering : InstanceTemplatePrototypeInstanceByCatalogOffering struct +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceByCatalogOffering struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceByCatalogOffering : Instantiate InstanceTemplatePrototypeInstanceByCatalogOffering (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceByCatalogOffering(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceByCatalogOffering, err error) { + _model = &InstanceTemplatePrototypeInstanceByCatalogOffering{ + CatalogOffering: catalogOffering, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceByCatalogOffering) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceByCatalogOffering unmarshals an instance of InstanceTemplatePrototypeInstanceByCatalogOffering from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceByCatalogOffering) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceByImage : InstanceTemplatePrototypeInstanceByImage struct +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceByImage struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` @@ -71307,33 +72465,203 @@ type InstanceTemplatePrototypeInstanceBySourceSnapshot struct { VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceBySourceSnapshot : Instantiate InstanceTemplatePrototypeInstanceBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceBySourceSnapshot, err error) { + _model = &InstanceTemplatePrototypeInstanceBySourceSnapshot{ + BootVolumeAttachment: bootVolumeAttachment, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceBySourceSnapshot) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceBySourceSnapshot) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceBySourceTemplate : InstanceTemplatePrototypeInstanceBySourceTemplate struct +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceBySourceTemplate struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering version to use when provisioning this virtual server instance. + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account, subject to + // IAM policies. + // + // If specified, `image` must not be specified, and `source_template` must not have + // `image` specified. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` // Primary network interface. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` + Zone ZoneIdentityIntf `json:"zone,omitempty"` } -// NewInstanceTemplatePrototypeInstanceBySourceSnapshot : Instantiate InstanceTemplatePrototypeInstanceBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceBySourceSnapshot, err error) { - _model = &InstanceTemplatePrototypeInstanceBySourceSnapshot{ - BootVolumeAttachment: bootVolumeAttachment, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, +// NewInstanceTemplatePrototypeInstanceBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceBySourceTemplate, err error) { + _model = &InstanceTemplatePrototypeInstanceBySourceTemplate{ + SourceTemplate: sourceTemplate, } err = core.ValidateStruct(_model, "required parameters") return } -func (*InstanceTemplatePrototypeInstanceBySourceSnapshot) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplatePrototypeInstanceBySourceTemplate) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceBySourceSnapshot) +// UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceBySourceTemplate from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceBySourceTemplate) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) if err != nil { return @@ -71386,7 +72714,15 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot(m map[string]jso if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { return } @@ -71394,6 +72730,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot(m map[string]jso if err != nil { return } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -71402,17 +72742,29 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot(m map[string]jso return } -// InstanceTemplatePrototypeInstanceBySourceTemplate : InstanceTemplatePrototypeInstanceBySourceTemplate struct -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceBySourceTemplate struct { +// InstanceTemplateInstanceByCatalogOffering : InstanceTemplateInstanceByCatalogOffering struct +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByCatalogOffering struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + // The default trusted profile configuration to use for this virtual server instance This property's value is used // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -71429,9 +72781,8 @@ type InstanceTemplatePrototypeInstanceBySourceTemplate struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The unique user-defined name for this instance template. + Name *string `json:"name" validate:"required"` // The additional network interfaces to create for the virtual server instance. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` @@ -71443,7 +72794,8 @@ type InstanceTemplatePrototypeInstanceBySourceTemplate struct { // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -71464,43 +72816,54 @@ type InstanceTemplatePrototypeInstanceBySourceTemplate struct { // The boot volume attachment for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` // Primary network interface. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The template to create this virtual server instance from. - SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` -} - -// NewInstanceTemplatePrototypeInstanceBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceBySourceTemplate (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceBySourceTemplate, err error) { - _model = &InstanceTemplatePrototypeInstanceBySourceTemplate{ - SourceTemplate: sourceTemplate, - } - err = core.ValidateStruct(_model, "required parameters") - return + Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -func (*InstanceTemplatePrototypeInstanceBySourceTemplate) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByCatalogOffering) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceBySourceTemplate from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceBySourceTemplate) +// UnmarshalInstanceTemplateInstanceByCatalogOffering unmarshals an instance of InstanceTemplateInstanceByCatalogOffering from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOffering) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -71525,7 +72888,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]jso if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -71549,7 +72912,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]jso if err != nil { return } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { return } @@ -71557,10 +72920,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]jso if err != nil { return } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - return - } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -76045,10 +77404,16 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` - // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` + + // The 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. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` } // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Direction property. @@ -76097,11 +77462,11 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[strin if err != nil { return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) if err != nil { return } @@ -76112,6 +77477,11 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[strin // SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. // This model "extends" SecurityGroupRulePrototype type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { + // The ICMP traffic code to allow. + // + // If specified, `type` must also be specified. If unspecified, all codes are allowed. + Code *int64 `json:"code,omitempty"` + // The direction of traffic to enforce. Direction *string `json:"direction" validate:"required"` @@ -76120,16 +77490,17 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` - - // The ICMP traffic code to allow. - // - // If specified, `type` must also be specified. If unspecified, all codes are allowed. - Code *int64 `json:"code,omitempty"` - // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` + // The 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. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + // The ICMP traffic type to allow. // // If unspecified, all types are allowed. @@ -76174,23 +77545,23 @@ func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) isaSecurityGroup // UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp from the specified map of raw messages. func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { return } - err = core.UnmarshalPrimitive(m, "code", &obj.Code) + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) if err != nil { return } @@ -76216,8 +77587,6 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` - // The inclusive upper bound of TCP/UDP port range. // // If specified, `port_min` must also be specified, and must not be larger. If unspecified, `port_min` must also be @@ -76232,6 +77601,14 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` + + // The 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. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` } // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Direction property. @@ -76281,10 +77658,6 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) if err != nil { return @@ -76297,6 +77670,10 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[st if err != nil { return } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -77413,7 +78790,8 @@ type SubnetPrototypeSubnetByCIDR struct { // The routing table to use for this subnet. If unspecified, the default routing table for the VPC is used. The routing // table properties `route_direct_link_ingress`, - // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. + // `route_internet_ingress`, `route_transit_gateway_ingress`, and + // `route_vpc_zone_ingress` must be `false`. RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` // The VPC the subnet will reside in. @@ -77514,7 +78892,8 @@ type SubnetPrototypeSubnetByTotalCount struct { // The routing table to use for this subnet. If unspecified, the default routing table for the VPC is used. The routing // table properties `route_direct_link_ingress`, - // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. + // `route_internet_ingress`, `route_transit_gateway_ingress`, and + // `route_vpc_zone_ingress` must be `false`. RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` // The VPC the subnet will reside in. @@ -83088,9 +84467,7 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt return } -// // VpcsPager can be used to simplify the use of the "ListVpcs" method. -// type VpcsPager struct { hasNext bool options *ListVpcsOptions @@ -83175,9 +84552,7 @@ func (pager *VpcsPager) GetAll() (allItems []VPC, err error) { return pager.GetAllWithContext(context.Background()) } -// // VPCAddressPrefixesPager can be used to simplify the use of the "ListVPCAddressPrefixes" method. -// type VPCAddressPrefixesPager struct { hasNext bool options *ListVPCAddressPrefixesOptions @@ -83262,9 +84637,7 @@ func (pager *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err er return pager.GetAllWithContext(context.Background()) } -// // VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. -// type VPCRoutesPager struct { hasNext bool options *ListVPCRoutesOptions @@ -83349,9 +84722,7 @@ func (pager *VPCRoutesPager) GetAll() (allItems []Route, err error) { return pager.GetAllWithContext(context.Background()) } -// // VPCRoutingTablesPager can be used to simplify the use of the "ListVPCRoutingTables" method. -// type VPCRoutingTablesPager struct { hasNext bool options *ListVPCRoutingTablesOptions @@ -83436,9 +84807,7 @@ func (pager *VPCRoutingTablesPager) GetAll() (allItems []RoutingTable, err error return pager.GetAllWithContext(context.Background()) } -// // VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. -// type VPCRoutingTableRoutesPager struct { hasNext bool options *ListVPCRoutingTableRoutesOptions @@ -83523,9 +84892,7 @@ func (pager *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) return pager.GetAllWithContext(context.Background()) } -// // SubnetsPager can be used to simplify the use of the "ListSubnets" method. -// type SubnetsPager struct { hasNext bool options *ListSubnetsOptions @@ -83610,9 +84977,7 @@ func (pager *SubnetsPager) GetAll() (allItems []Subnet, err error) { return pager.GetAllWithContext(context.Background()) } -// // SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. -// type SubnetReservedIpsPager struct { hasNext bool options *ListSubnetReservedIpsOptions @@ -83697,9 +85062,7 @@ func (pager *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) return pager.GetAllWithContext(context.Background()) } -// // ImagesPager can be used to simplify the use of the "ListImages" method. -// type ImagesPager struct { hasNext bool options *ListImagesOptions @@ -83784,9 +85147,7 @@ func (pager *ImagesPager) GetAll() (allItems []Image, err error) { return pager.GetAllWithContext(context.Background()) } -// // OperatingSystemsPager can be used to simplify the use of the "ListOperatingSystems" method. -// type OperatingSystemsPager struct { hasNext bool options *ListOperatingSystemsOptions @@ -83871,9 +85232,7 @@ func (pager *OperatingSystemsPager) GetAll() (allItems []OperatingSystem, err er return pager.GetAllWithContext(context.Background()) } -// // KeysPager can be used to simplify the use of the "ListKeys" method. -// type KeysPager struct { hasNext bool options *ListKeysOptions @@ -83958,9 +85317,7 @@ func (pager *KeysPager) GetAll() (allItems []Key, err error) { return pager.GetAllWithContext(context.Background()) } -// // InstancesPager can be used to simplify the use of the "ListInstances" method. -// type InstancesPager struct { hasNext bool options *ListInstancesOptions @@ -84045,9 +85402,7 @@ func (pager *InstancesPager) GetAll() (allItems []Instance, err error) { return pager.GetAllWithContext(context.Background()) } -// // InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "ListInstanceNetworkInterfaceIps" method. -// type InstanceNetworkInterfaceIpsPager struct { hasNext bool options *ListInstanceNetworkInterfaceIpsOptions @@ -84132,9 +85487,7 @@ func (pager *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, return pager.GetAllWithContext(context.Background()) } -// // InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. -// type InstanceGroupsPager struct { hasNext bool options *ListInstanceGroupsOptions @@ -84219,9 +85572,7 @@ func (pager *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) return pager.GetAllWithContext(context.Background()) } -// // InstanceGroupManagersPager can be used to simplify the use of the "ListInstanceGroupManagers" method. -// type InstanceGroupManagersPager struct { hasNext bool options *ListInstanceGroupManagersOptions @@ -84306,9 +85657,7 @@ func (pager *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManag return pager.GetAllWithContext(context.Background()) } -// // InstanceGroupManagerActionsPager can be used to simplify the use of the "ListInstanceGroupManagerActions" method. -// type InstanceGroupManagerActionsPager struct { hasNext bool options *ListInstanceGroupManagerActionsOptions @@ -84393,9 +85742,7 @@ func (pager *InstanceGroupManagerActionsPager) GetAll() (allItems []InstanceGrou return pager.GetAllWithContext(context.Background()) } -// // InstanceGroupManagerPoliciesPager can be used to simplify the use of the "ListInstanceGroupManagerPolicies" method. -// type InstanceGroupManagerPoliciesPager struct { hasNext bool options *ListInstanceGroupManagerPoliciesOptions @@ -84480,9 +85827,7 @@ func (pager *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGro return pager.GetAllWithContext(context.Background()) } -// // InstanceGroupMembershipsPager can be used to simplify the use of the "ListInstanceGroupMemberships" method. -// type InstanceGroupMembershipsPager struct { hasNext bool options *ListInstanceGroupMembershipsOptions @@ -84567,9 +85912,7 @@ func (pager *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMe return pager.GetAllWithContext(context.Background()) } -// // DedicatedHostGroupsPager can be used to simplify the use of the "ListDedicatedHostGroups" method. -// type DedicatedHostGroupsPager struct { hasNext bool options *ListDedicatedHostGroupsOptions @@ -84654,9 +85997,7 @@ func (pager *DedicatedHostGroupsPager) GetAll() (allItems []DedicatedHostGroup, return pager.GetAllWithContext(context.Background()) } -// // DedicatedHostProfilesPager can be used to simplify the use of the "ListDedicatedHostProfiles" method. -// type DedicatedHostProfilesPager struct { hasNext bool options *ListDedicatedHostProfilesOptions @@ -84741,9 +86082,7 @@ func (pager *DedicatedHostProfilesPager) GetAll() (allItems []DedicatedHostProfi return pager.GetAllWithContext(context.Background()) } -// // DedicatedHostsPager can be used to simplify the use of the "ListDedicatedHosts" method. -// type DedicatedHostsPager struct { hasNext bool options *ListDedicatedHostsOptions @@ -84828,9 +86167,7 @@ func (pager *DedicatedHostsPager) GetAll() (allItems []DedicatedHost, err error) return pager.GetAllWithContext(context.Background()) } -// // BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. -// type BackupPoliciesPager struct { hasNext bool options *ListBackupPoliciesOptions @@ -84915,9 +86252,7 @@ func (pager *BackupPoliciesPager) GetAll() (allItems []BackupPolicy, err error) return pager.GetAllWithContext(context.Background()) } -// // PlacementGroupsPager can be used to simplify the use of the "ListPlacementGroups" method. -// type PlacementGroupsPager struct { hasNext bool options *ListPlacementGroupsOptions @@ -85002,9 +86337,7 @@ func (pager *PlacementGroupsPager) GetAll() (allItems []PlacementGroup, err erro return pager.GetAllWithContext(context.Background()) } -// // BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. -// type BareMetalServerProfilesPager struct { hasNext bool options *ListBareMetalServerProfilesOptions @@ -85089,9 +86422,7 @@ func (pager *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerP return pager.GetAllWithContext(context.Background()) } -// // BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. -// type BareMetalServersPager struct { hasNext bool options *ListBareMetalServersOptions @@ -85176,9 +86507,7 @@ func (pager *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err er return pager.GetAllWithContext(context.Background()) } -// // BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. -// type BareMetalServerNetworkInterfacesPager struct { hasNext bool options *ListBareMetalServerNetworkInterfacesOptions @@ -85263,9 +86592,7 @@ func (pager *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMet return pager.GetAllWithContext(context.Background()) } -// // VolumeProfilesPager can be used to simplify the use of the "ListVolumeProfiles" method. -// type VolumeProfilesPager struct { hasNext bool options *ListVolumeProfilesOptions @@ -85350,9 +86677,7 @@ func (pager *VolumeProfilesPager) GetAll() (allItems []VolumeProfile, err error) return pager.GetAllWithContext(context.Background()) } -// // VolumesPager can be used to simplify the use of the "ListVolumes" method. -// type VolumesPager struct { hasNext bool options *ListVolumesOptions @@ -85437,9 +86762,7 @@ func (pager *VolumesPager) GetAll() (allItems []Volume, err error) { return pager.GetAllWithContext(context.Background()) } -// // SnapshotsPager can be used to simplify the use of the "ListSnapshots" method. -// type SnapshotsPager struct { hasNext bool options *ListSnapshotsOptions @@ -85524,9 +86847,7 @@ func (pager *SnapshotsPager) GetAll() (allItems []Snapshot, err error) { return pager.GetAllWithContext(context.Background()) } -// // PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. -// type PublicGatewaysPager struct { hasNext bool options *ListPublicGatewaysOptions @@ -85611,9 +86932,7 @@ func (pager *PublicGatewaysPager) GetAll() (allItems []PublicGateway, err error) return pager.GetAllWithContext(context.Background()) } -// // FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. -// type FloatingIpsPager struct { hasNext bool options *ListFloatingIpsOptions @@ -85698,9 +87017,7 @@ func (pager *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { return pager.GetAllWithContext(context.Background()) } -// // NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. -// type NetworkAclsPager struct { hasNext bool options *ListNetworkAclsOptions @@ -85785,9 +87102,7 @@ func (pager *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { return pager.GetAllWithContext(context.Background()) } -// // NetworkACLRulesPager can be used to simplify the use of the "ListNetworkACLRules" method. -// type NetworkACLRulesPager struct { hasNext bool options *ListNetworkACLRulesOptions @@ -85872,9 +87187,7 @@ func (pager *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, return pager.GetAllWithContext(context.Background()) } -// // SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. -// type SecurityGroupsPager struct { hasNext bool options *ListSecurityGroupsOptions @@ -85959,9 +87272,7 @@ func (pager *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) return pager.GetAllWithContext(context.Background()) } -// // SecurityGroupTargetsPager can be used to simplify the use of the "ListSecurityGroupTargets" method. -// type SecurityGroupTargetsPager struct { hasNext bool options *ListSecurityGroupTargetsOptions @@ -86046,9 +87357,7 @@ func (pager *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTarget return pager.GetAllWithContext(context.Background()) } -// // IkePoliciesPager can be used to simplify the use of the "ListIkePolicies" method. -// type IkePoliciesPager struct { hasNext bool options *ListIkePoliciesOptions @@ -86133,9 +87442,7 @@ func (pager *IkePoliciesPager) GetAll() (allItems []IkePolicy, err error) { return pager.GetAllWithContext(context.Background()) } -// // IpsecPoliciesPager can be used to simplify the use of the "ListIpsecPolicies" method. -// type IpsecPoliciesPager struct { hasNext bool options *ListIpsecPoliciesOptions @@ -86220,9 +87527,7 @@ func (pager *IpsecPoliciesPager) GetAll() (allItems []IPsecPolicy, err error) { return pager.GetAllWithContext(context.Background()) } -// // VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. -// type VPNGatewaysPager struct { hasNext bool options *ListVPNGatewaysOptions @@ -86307,9 +87612,7 @@ func (pager *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { return pager.GetAllWithContext(context.Background()) } -// // VPNServersPager can be used to simplify the use of the "ListVPNServers" method. -// type VPNServersPager struct { hasNext bool options *ListVPNServersOptions @@ -86394,9 +87697,7 @@ func (pager *VPNServersPager) GetAll() (allItems []VPNServer, err error) { return pager.GetAllWithContext(context.Background()) } -// // VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. -// type VPNServerClientsPager struct { hasNext bool options *ListVPNServerClientsOptions @@ -86481,9 +87782,7 @@ func (pager *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err er return pager.GetAllWithContext(context.Background()) } -// // VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. -// type VPNServerRoutesPager struct { hasNext bool options *ListVPNServerRoutesOptions @@ -86568,9 +87867,7 @@ func (pager *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err erro return pager.GetAllWithContext(context.Background()) } -// // LoadBalancerProfilesPager can be used to simplify the use of the "ListLoadBalancerProfiles" method. -// type LoadBalancerProfilesPager struct { hasNext bool options *ListLoadBalancerProfilesOptions @@ -86655,9 +87952,7 @@ func (pager *LoadBalancerProfilesPager) GetAll() (allItems []LoadBalancerProfile return pager.GetAllWithContext(context.Background()) } -// // LoadBalancersPager can be used to simplify the use of the "ListLoadBalancers" method. -// type LoadBalancersPager struct { hasNext bool options *ListLoadBalancersOptions @@ -86742,9 +88037,7 @@ func (pager *LoadBalancersPager) GetAll() (allItems []LoadBalancer, err error) { return pager.GetAllWithContext(context.Background()) } -// // EndpointGatewaysPager can be used to simplify the use of the "ListEndpointGateways" method. -// type EndpointGatewaysPager struct { hasNext bool options *ListEndpointGatewaysOptions @@ -86829,9 +88122,7 @@ func (pager *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err er return pager.GetAllWithContext(context.Background()) } -// // EndpointGatewayIpsPager can be used to simplify the use of the "ListEndpointGatewayIps" method. -// type EndpointGatewayIpsPager struct { hasNext bool options *ListEndpointGatewayIpsOptions @@ -86916,9 +88207,7 @@ func (pager *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error return pager.GetAllWithContext(context.Background()) } -// // FlowLogCollectorsPager can be used to simplify the use of the "ListFlowLogCollectors" method. -// type FlowLogCollectorsPager struct { hasNext bool options *ListFlowLogCollectorsOptions diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go index c242f622d4..32735910aa 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go @@ -1697,7 +1697,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke GetVPCDefaultRoutingTable successfully with retries`, func() { @@ -1754,7 +1754,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke GetVPCDefaultRoutingTable successfully`, func() { @@ -4682,7 +4682,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?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) })) }) It(`Invoke ListVPCRoutingTables successfully with retries`, func() { @@ -4745,7 +4745,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?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) })) }) It(`Invoke ListVPCRoutingTables successfully`, func() { @@ -4896,9 +4896,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_gateway"}],"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","is_default":false,"lifecycle_state":"stable","name":"my-routing-table-1","resource_type":"routing_table","route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_gateway"}],"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","is_default":false,"lifecycle_state":"stable","name":"my-routing-table-1","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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_gateway"}],"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","is_default":false,"lifecycle_state":"stable","name":"my-routing-table-1","resource_type":"routing_table","route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_gateway"}],"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","is_default":false,"lifecycle_state":"stable","name":"my-routing-table-1","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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}`) } else { res.WriteHeader(400) } @@ -5011,6 +5011,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} @@ -5069,7 +5070,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke CreateVPCRoutingTable successfully with retries`, func() { @@ -5108,6 +5109,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} @@ -5168,7 +5170,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke CreateVPCRoutingTable successfully`, func() { @@ -5212,6 +5214,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} @@ -5259,6 +5262,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} @@ -5327,6 +5331,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) + createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} @@ -5494,7 +5499,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke GetVPCRoutingTable successfully with retries`, func() { @@ -5552,7 +5557,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke GetVPCRoutingTable successfully`, func() { @@ -5692,6 +5697,7 @@ var _ = Describe(`VpcV1`, func() { routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) + routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() @@ -5760,7 +5766,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke UpdateVPCRoutingTable successfully with retries`, func() { @@ -5782,6 +5788,7 @@ var _ = Describe(`VpcV1`, func() { routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) + routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() @@ -5852,7 +5859,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke UpdateVPCRoutingTable successfully`, func() { @@ -5879,6 +5886,7 @@ var _ = Describe(`VpcV1`, func() { routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) + routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() @@ -5917,6 +5925,7 @@ var _ = Describe(`VpcV1`, func() { routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) + routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() @@ -5976,6 +5985,7 @@ var _ = Describe(`VpcV1`, func() { routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) + routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() @@ -9912,7 +9922,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke GetSubnetRoutingTable successfully with retries`, func() { @@ -9969,7 +9979,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke GetSubnetRoutingTable successfully`, func() { @@ -10158,7 +10168,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke ReplaceSubnetRoutingTable successfully with retries`, func() { @@ -10236,7 +10246,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke ReplaceSubnetRoutingTable successfully`, func() { @@ -11691,7 +11701,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": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/images?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}}`) + 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/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/images?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}}`) })) }) It(`Invoke ListImages successfully with retries`, func() { @@ -11757,7 +11767,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": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/images?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}}`) + 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/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/images?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}}`) })) }) It(`Invoke ListImages successfully`, func() { @@ -11904,9 +11914,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"images":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":22,"name":"my-image","operating_system":{"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-16-amd64","name":"ubuntu-16-amd64","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"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-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"}],"visibility":"private"}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"images":[{"catalog_offering":{"managed":false,"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":22,"name":"my-image","operating_system":{"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-16-amd64","name":"ubuntu-16-amd64","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"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-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"}],"visibility":"private"}],"total_count":2,"limit":1}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"images":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":22,"name":"my-image","operating_system":{"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-16-amd64","name":"ubuntu-16-amd64","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"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-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"}],"visibility":"private"}],"total_count":2,"limit":1}`) + fmt.Fprintf(res, "%s", `{"images":[{"catalog_offering":{"managed":false,"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":22,"name":"my-image","operating_system":{"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-16-amd64","name":"ubuntu-16-amd64","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"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-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"}],"visibility":"private"}],"total_count":2,"limit":1}`) } else { res.WriteHeader(400) } @@ -12078,7 +12088,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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) + fmt.Fprintf(res, "%s", `{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) })) }) It(`Invoke CreateImage successfully with retries`, func() { @@ -12176,7 +12186,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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) + fmt.Fprintf(res, "%s", `{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) })) }) It(`Invoke CreateImage successfully`, func() { @@ -12492,7 +12502,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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) + fmt.Fprintf(res, "%s", `{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) })) }) It(`Invoke GetImage successfully with retries`, func() { @@ -12549,7 +12559,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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) + fmt.Fprintf(res, "%s", `{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) })) }) It(`Invoke GetImage successfully`, func() { @@ -12740,7 +12750,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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) + fmt.Fprintf(res, "%s", `{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) })) }) It(`Invoke UpdateImage successfully with retries`, func() { @@ -12820,7 +12830,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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) + fmt.Fprintf(res, "%s", `{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) })) }) It(`Invoke UpdateImage successfully`, func() { @@ -16912,7 +16922,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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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": "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) })) }) It(`Invoke ListInstances successfully with retries`, func() { @@ -16994,7 +17004,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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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": "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) })) }) It(`Invoke ListInstances successfully`, func() { @@ -17165,9 +17175,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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"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}],"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-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":8,"metadata_service":{"enabled":false},"name":"my-instance","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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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_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},"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}},"catalog_offering":{"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"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}],"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-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":8,"metadata_service":{"enabled":false},"name":"my-instance","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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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_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},"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"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}],"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-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":8,"metadata_service":{"enabled":false},"name":"my-instance","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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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_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},"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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":"80b3e36e-41f4-40e9-bd56-beae81792a68"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}},"catalog_offering":{"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"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}],"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-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":8,"metadata_service":{"enabled":false},"name":"my-instance","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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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_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},"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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) } @@ -17455,7 +17465,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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -17653,7 +17663,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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -18269,7 +18279,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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -18326,7 +18336,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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -18538,7 +18548,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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -18639,7 +18649,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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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": "80b3e36e-41f4-40e9-bd56-beae81792a68"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -38458,7 +38468,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/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}, "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": "nvme", "type": "enum", "values": ["nvme"]}}], "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}], "total_count": 132}`) + 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}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}], "total_count": 132}`) })) }) It(`Invoke ListBareMetalServerProfiles successfully with retries`, func() { @@ -38518,7 +38528,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/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}, "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": "nvme", "type": "enum", "values": ["nvme"]}}], "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}], "total_count": 132}`) + 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}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}], "total_count": 132}`) })) }) It(`Invoke ListBareMetalServerProfiles successfully`, func() { @@ -38656,9 +38666,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,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"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":"nvme","type":"enum","values":["nvme"]}}],"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","os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["tpm_2"]}}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"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","os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["tpm_2"]}}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"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":"nvme","type":"enum","values":["nvme"]}}],"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","os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["tpm_2"]}}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"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","os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["tpm_2"]}}]}`) } else { res.WriteHeader(400) } @@ -38783,7 +38793,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}, "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": "nvme", "type": "enum", "values": ["nvme"]}}], "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}`) + fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}`) })) }) It(`Invoke GetBareMetalServerProfile successfully with retries`, func() { @@ -38840,7 +38850,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}, "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": "nvme", "type": "enum", "values": ["nvme"]}}], "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}`) + fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}`) })) }) It(`Invoke GetBareMetalServerProfile successfully`, func() { @@ -39037,7 +39047,7 @@ var _ = Describe(`VpcV1`, func() { // 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-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) })) }) It(`Invoke ListBareMetalServers successfully with retries`, func() { @@ -39113,7 +39123,7 @@ var _ = Describe(`VpcV1`, func() { // 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-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) })) }) It(`Invoke ListBareMetalServers successfully`, func() { @@ -39275,9 +39285,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,"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-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/123456::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":"nvme","name":"my-bare-metal-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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":"failed","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":"tpm_2"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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,"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-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/123456::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-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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":"failed","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":"tpm_2"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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-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/123456::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":"nvme","name":"my-bare-metal-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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":"failed","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":"tpm_2"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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,"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-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/123456::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-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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":"failed","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":"tpm_2"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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) } @@ -39423,16 +39433,15 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + // 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-network-interface") bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -39507,7 +39516,7 @@ 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-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -39567,16 +39576,15 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + // 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-network-interface") bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -39653,7 +39661,7 @@ 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-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -39718,16 +39726,15 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + // 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-network-interface") bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -39812,16 +39819,15 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + // 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-network-interface") bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -39927,16 +39933,15 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + // 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-network-interface") bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -40307,7 +40312,7 @@ 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/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}`) + 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-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}`) })) }) It(`Invoke ListBareMetalServerDisks successfully with retries`, func() { @@ -40364,7 +40369,7 @@ 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/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a/disks/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "interface_type": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}`) + 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-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}`) })) }) It(`Invoke ListBareMetalServerDisks successfully`, func() { @@ -40533,7 +40538,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", "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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + 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-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) })) }) It(`Invoke GetBareMetalServerDisk successfully with retries`, func() { @@ -40591,7 +40596,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", "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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + 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-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) })) }) It(`Invoke GetBareMetalServerDisk successfully`, func() { @@ -40786,7 +40791,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", "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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + 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-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) })) }) It(`Invoke UpdateBareMetalServerDisk successfully with retries`, func() { @@ -40867,7 +40872,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", "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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + 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-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) })) }) It(`Invoke UpdateBareMetalServerDisk successfully`, func() { @@ -41065,7 +41070,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/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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "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_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}`) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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}`) })) }) It(`Invoke ListBareMetalServerNetworkInterfaces successfully with retries`, func() { @@ -41126,7 +41131,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/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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "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_interfaces?start=d3e721fd-c988-4670-9927-dbd5e7b07fc6&limit=20"}, "total_count": 132}`) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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}`) })) }) It(`Invoke ListBareMetalServerNetworkInterfaces successfully`, func() { @@ -41274,9 +41279,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,"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/123456::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:0a:00:23:94","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","allowed_vlans":[4],"interface_type":"pci"}]}`) + 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/123456::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:0a:00:23:94","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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/123456::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:0a:00:23:94","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","allowed_vlans":[4],"interface_type":"pci"}]}`) + 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/123456::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:0a:00:23:94","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"type":"primary","interface_type":"hipersocket"}]}`) } else { res.WriteHeader(400) } @@ -41375,16 +41380,15 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + // 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-network-interface") bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) @@ -41445,7 +41449,7 @@ 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}`) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) })) }) It(`Invoke CreateBareMetalServerNetworkInterface successfully with retries`, func() { @@ -41472,16 +41476,15 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + // 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-network-interface") bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) @@ -41544,7 +41547,7 @@ 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}`) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) })) }) It(`Invoke CreateBareMetalServerNetworkInterface successfully`, func() { @@ -41576,16 +41579,15 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + // 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-network-interface") bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) @@ -41623,16 +41625,15 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + // 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-network-interface") bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) @@ -41691,16 +41692,15 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + // 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-network-interface") bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model createBareMetalServerNetworkInterfaceOptionsModel := new(vpcv1.CreateBareMetalServerNetworkInterfaceOptions) @@ -41866,7 +41866,7 @@ 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}`) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) })) }) It(`Invoke GetBareMetalServerNetworkInterface successfully with retries`, func() { @@ -41924,7 +41924,7 @@ 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}`) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) })) }) It(`Invoke GetBareMetalServerNetworkInterface successfully`, func() { @@ -42122,7 +42122,7 @@ 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}`) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) })) }) It(`Invoke UpdateBareMetalServerNetworkInterface successfully with retries`, func() { @@ -42206,7 +42206,7 @@ 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "allowed_vlans": [4], "interface_type": "pci"}`) + 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary", "interface_type": "hipersocket"}`) })) }) It(`Invoke UpdateBareMetalServerNetworkInterface successfully`, func() { @@ -43722,7 +43722,7 @@ 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-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -43779,7 +43779,7 @@ 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-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -43970,7 +43970,7 @@ 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-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -44050,7 +44050,7 @@ 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-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/123456::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": "nvme", "name": "my-bare-metal-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -54603,8 +54603,8 @@ var _ = Describe(`VpcV1`, func() { securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel // Construct an instance of the CreateSecurityGroupOptions model createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) @@ -54696,8 +54696,8 @@ var _ = Describe(`VpcV1`, func() { securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel // Construct an instance of the CreateSecurityGroupOptions model createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) @@ -54796,8 +54796,8 @@ var _ = Describe(`VpcV1`, func() { securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel // Construct an instance of the CreateSecurityGroupOptions model createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) @@ -54839,8 +54839,8 @@ var _ = Describe(`VpcV1`, func() { securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel // Construct an instance of the CreateSecurityGroupOptions model createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) @@ -54903,8 +54903,8 @@ var _ = Describe(`VpcV1`, func() { securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel // Construct an instance of the CreateSecurityGroupOptions model createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) @@ -55777,8 +55777,8 @@ var _ = Describe(`VpcV1`, func() { securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel // Construct an instance of the CreateSecurityGroupRuleOptions model createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) @@ -55860,8 +55860,8 @@ var _ = Describe(`VpcV1`, func() { securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel // Construct an instance of the CreateSecurityGroupRuleOptions model createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) @@ -55950,8 +55950,8 @@ var _ = Describe(`VpcV1`, func() { securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel // Construct an instance of the CreateSecurityGroupRuleOptions model createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) @@ -55983,8 +55983,8 @@ var _ = Describe(`VpcV1`, func() { securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel // Construct an instance of the CreateSecurityGroupRuleOptions model createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) @@ -56037,8 +56037,8 @@ var _ = Describe(`VpcV1`, func() { securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel // Construct an instance of the CreateSecurityGroupRuleOptions model createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) @@ -80719,8 +80719,8 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) Expect(bareMetalServerNetworkInterfacePrototypeModel).ToNot(BeNil()) bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) @@ -80728,16 +80728,14 @@ var _ = Describe(`VpcV1`, func() { bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") Expect(bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) Expect(bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) Expect(bareMetalServerNetworkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-network-interface"))) Expect(bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) Expect(bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) Expect(bareMetalServerNetworkInterfacePrototypeModel.Subnet).To(Equal(subnetIdentityModel)) - Expect(bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans).To(Equal([]int64{int64(4)})) - Expect(bareMetalServerNetworkInterfacePrototypeModel.InterfaceType).To(Equal(core.StringPtr("pci"))) + Expect(bareMetalServerNetworkInterfacePrototypeModel.InterfaceType).To(Equal(core.StringPtr("hipersocket"))) // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model bareMetalServerID := "testString" @@ -80828,8 +80826,8 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel.Name = core.StringPtr("us-south-1") Expect(zoneIdentityModel.Name).To(Equal(core.StringPtr("us-south-1"))) - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model + bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) Expect(bareMetalServerNetworkInterfacePrototypeModel).ToNot(BeNil()) bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) @@ -80837,16 +80835,14 @@ var _ = Describe(`VpcV1`, func() { bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") + bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") Expect(bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) Expect(bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) Expect(bareMetalServerNetworkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-network-interface"))) Expect(bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) Expect(bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) Expect(bareMetalServerNetworkInterfacePrototypeModel.Subnet).To(Equal(subnetIdentityModel)) - Expect(bareMetalServerNetworkInterfacePrototypeModel.AllowedVlans).To(Equal([]int64{int64(4)})) - Expect(bareMetalServerNetworkInterfacePrototypeModel.InterfaceType).To(Equal(core.StringPtr("pci"))) + Expect(bareMetalServerNetworkInterfacePrototypeModel.InterfaceType).To(Equal(core.StringPtr("hipersocket"))) // Construct an instance of the ResourceGroupIdentityByID model resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) @@ -82481,12 +82477,12 @@ var _ = Describe(`VpcV1`, func() { Expect(securityGroupRulePrototypeModel).ToNot(BeNil()) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel Expect(securityGroupRulePrototypeModel.Direction).To(Equal(core.StringPtr("inbound"))) Expect(securityGroupRulePrototypeModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) - Expect(securityGroupRulePrototypeModel.Remote).To(Equal(securityGroupRuleRemotePrototypeModel)) Expect(securityGroupRulePrototypeModel.Protocol).To(Equal(core.StringPtr("all"))) + Expect(securityGroupRulePrototypeModel.Remote).To(Equal(securityGroupRuleRemotePrototypeModel)) // Construct an instance of the CreateSecurityGroupOptions model var createSecurityGroupOptionsVPC vpcv1.VPCIdentityIntf = nil @@ -82515,12 +82511,12 @@ var _ = Describe(`VpcV1`, func() { Expect(securityGroupRulePrototypeModel).ToNot(BeNil()) securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") + securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel Expect(securityGroupRulePrototypeModel.Direction).To(Equal(core.StringPtr("inbound"))) Expect(securityGroupRulePrototypeModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) - Expect(securityGroupRulePrototypeModel.Remote).To(Equal(securityGroupRuleRemotePrototypeModel)) Expect(securityGroupRulePrototypeModel.Protocol).To(Equal(core.StringPtr("all"))) + Expect(securityGroupRulePrototypeModel.Remote).To(Equal(securityGroupRuleRemotePrototypeModel)) // Construct an instance of the CreateSecurityGroupRuleOptions model securityGroupID := "testString" @@ -82848,6 +82844,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel.SetAcceptRoutesFrom([]vpcv1.ResourceFilter{*resourceFilterModel}) createVPCRoutingTableOptionsModel.SetName("my-routing-table-2") createVPCRoutingTableOptionsModel.SetRouteDirectLinkIngress(false) + createVPCRoutingTableOptionsModel.SetRouteInternetIngress(false) createVPCRoutingTableOptionsModel.SetRouteTransitGatewayIngress(false) createVPCRoutingTableOptionsModel.SetRouteVPCZoneIngress(false) createVPCRoutingTableOptionsModel.SetRoutes([]vpcv1.RoutePrototype{*routePrototypeModel}) @@ -82857,6 +82854,7 @@ var _ = Describe(`VpcV1`, func() { Expect(createVPCRoutingTableOptionsModel.AcceptRoutesFrom).To(Equal([]vpcv1.ResourceFilter{*resourceFilterModel})) Expect(createVPCRoutingTableOptionsModel.Name).To(Equal(core.StringPtr("my-routing-table-2"))) Expect(createVPCRoutingTableOptionsModel.RouteDirectLinkIngress).To(Equal(core.BoolPtr(false))) + Expect(createVPCRoutingTableOptionsModel.RouteInternetIngress).To(Equal(core.BoolPtr(false))) Expect(createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress).To(Equal(core.BoolPtr(false))) Expect(createVPCRoutingTableOptionsModel.RouteVPCZoneIngress).To(Equal(core.BoolPtr(false))) Expect(createVPCRoutingTableOptionsModel.Routes).To(Equal([]vpcv1.RoutePrototype{*routePrototypeModel})) @@ -86690,6 +86688,12 @@ var _ = Describe(`VpcV1`, func() { _, err := vpcService.NewVolumePrototypeInstanceBySourceSnapshotContext(profile, sourceSnapshot) Expect(err).ToNot(BeNil()) }) + It(`Invoke NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype successfully`, func() { + var subnet vpcv1.SubnetIdentityIntf = nil + interfaceType := "hipersocket" + _, err := vpcService.NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(subnet, interfaceType) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype successfully`, func() { var subnet vpcv1.SubnetIdentityIntf = nil interfaceType := "pci" @@ -86715,6 +86719,18 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewCatalogOfferingIdentityCatalogOfferingByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:offering:00111601-0ec5-41ac-b142-96d1e64e6442" + _model, err := vpcService.NewCatalogOfferingIdentityCatalogOfferingByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN successfully`, func() { + crn := "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d" + _model, err := vpcService.NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(crn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewCertificateInstanceIdentityByCRN successfully`, func() { crn := "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5" _model, err := vpcService.NewCertificateInstanceIdentityByCRN(crn) @@ -86837,6 +86853,16 @@ var _ = Describe(`VpcV1`, func() { _, err := vpcService.NewImagePrototypeImageBySourceVolume(sourceVolume) Expect(err).ToNot(BeNil()) }) + It(`Invoke NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering successfully`, func() { + var offering vpcv1.CatalogOfferingIdentityIntf = nil + _, err := vpcService.NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(offering) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion successfully`, func() { + var version vpcv1.CatalogOfferingVersionIdentityIntf = nil + _, err := vpcService.NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(version) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype successfully`, func() { metricType := "cpu" metricValue := int64(38) @@ -86882,6 +86908,13 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewInstancePrototypeInstanceByCatalogOffering successfully`, func() { + var catalogOffering vpcv1.InstanceCatalogOfferingPrototypeIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + var zone vpcv1.ZoneIdentityIntf = nil + _, err := vpcService.NewInstancePrototypeInstanceByCatalogOffering(catalogOffering, primaryNetworkInterface, zone) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewInstancePrototypeInstanceByImage successfully`, func() { var image vpcv1.ImageIdentityIntf = nil var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil @@ -86919,6 +86952,13 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewInstanceTemplatePrototypeInstanceByCatalogOffering successfully`, func() { + var catalogOffering vpcv1.InstanceCatalogOfferingPrototypeIntf = nil + var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil + var zone vpcv1.ZoneIdentityIntf = nil + _, err := vpcService.NewInstanceTemplatePrototypeInstanceByCatalogOffering(catalogOffering, primaryNetworkInterface, zone) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewInstanceTemplatePrototypeInstanceByImage successfully`, func() { var image vpcv1.ImageIdentityIntf = nil var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil From edee46ba8a5224785368856a5ff3a69b46a644df Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 20 Oct 2022 09:53:56 +0530 Subject: [PATCH 009/103] sds --- common/github.com/IBM/vpc-go-sdk/common/headers.go | 10 +++++----- go.mod | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers.go b/common/github.com/IBM/vpc-go-sdk/common/headers.go index 1516ebf4cb..00d92fdb3c 100644 --- a/common/github.com/IBM/vpc-go-sdk/common/headers.go +++ b/common/github.com/IBM/vpc-go-sdk/common/headers.go @@ -11,7 +11,6 @@ const ( SDK_NAME = "vpc-go-sdk" ) -// // GetSdkHeaders - returns the set of SDK-specific headers to be included in an outgoing request. // // This function is invoked by generated service methods (i.e. methods which implement the REST API operations @@ -25,13 +24,14 @@ const ( // as in the example below. // // Parameters: -// serviceName - the name of the service as defined in the API definition (e.g. "MyService1") -// serviceVersion - the version of the service as defined in the API definition (e.g. "V1") -// operationId - the operationId as defined in the API definition (e.g. getContext) +// +// serviceName - the name of the service as defined in the API definition (e.g. "MyService1") +// serviceVersion - the version of the service as defined in the API definition (e.g. "V1") +// operationId - the operationId as defined in the API definition (e.g. getContext) // // Returns: -// a Map which contains the set of headers to be included in the REST API request // +// a Map which contains the set of headers to be included in the REST API request func GetSdkHeaders(serviceName string, serviceVersion string, operationId string) map[string]string { sdkHeaders := make(map[string]string) diff --git a/go.mod b/go.mod index 78b1b513fa..5d48c7cf4e 100644 --- a/go.mod +++ b/go.mod @@ -172,4 +172,4 @@ replace github.com/softlayer/softlayer-go v1.0.3 => github.com/IBM-Cloud/softlay replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt/jwt v3.2.1+incompatible -replace github.com/IBM/vpc-go-sdk v0.24.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.27.0 => ./common/github.com/IBM/vpc-go-sdk From db6fff70ba77523a69a41856157635d249bb813e Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 20 Oct 2022 13:08:31 +0530 Subject: [PATCH 010/103] t2 --- ..._is_bare_metal_server_network_interface.go | 20 +++++++++++++++---- ...al_server_network_interface_allow_float.go | 5 +++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_interface.go b/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_interface.go index d9c0fc0d53..d70980991b 100644 --- a/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_interface.go +++ b/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_interface.go @@ -403,7 +403,7 @@ func resourceIBMISBareMetalServerNetworkInterfaceCreate(context context.Context, } log.Printf("[INFO] Bare Metal Server Network Interface : %s", d.Id()) - _, err = isWaitForBareMetalServerNetworkInterfaceAvailable(sess, bareMetalServerId, nicId, d.Timeout(schema.TimeoutCreate), d) + _, err = isWaitForBareMetalServerNetworkInterfaceAvailable(sess, context, bareMetalServerId, nicId, d.Timeout(schema.TimeoutCreate), d) if err != nil { return diag.FromErr(err) } @@ -552,7 +552,7 @@ func createVlanTypeNetworkInterface(context context.Context, d *schema.ResourceD return err } log.Printf("[INFO] Bare Metal Server Network Interface : %s", d.Id()) - _, err = isWaitForBareMetalServerNetworkInterfaceAvailable(sess, bareMetalServerId, nicId, d.Timeout(schema.TimeoutCreate), d) + _, err = isWaitForBareMetalServerNetworkInterfaceAvailable(sess, context, bareMetalServerId, nicId, d.Timeout(schema.TimeoutCreate), d) if err != nil { return err } @@ -998,8 +998,12 @@ func isBareMetalServerNetworkInterfaceDeleteRefreshFunc(bmsC *vpcv1.VpcV1, bareM } } -func isWaitForBareMetalServerNetworkInterfaceAvailable(client *vpcv1.VpcV1, bareMetalServerId, nicId string, timeout time.Duration, d *schema.ResourceData) (interface{}, error) { +func isWaitForBareMetalServerNetworkInterfaceAvailable(client *vpcv1.VpcV1, ctx context.Context, bareMetalServerId, nicId string, timeout time.Duration, d *schema.ResourceData) (interface{}, error) { log.Printf("Waiting for Bare Metal Server (%s) Network Interface (%s) to be available.", bareMetalServerId, nicId) + // isBMSNicAllowFloatKey := "bare_metal_server_key_" + bareMetalServerId + "_vlan" + // conns.IbmMutexKV.Lock(isBMSNicAllowFloatKey) + // defer conns.IbmMutexKV.Unlock(isBMSNicAllowFloatKey) + stateConf := &resource.StateChangeConf{ Pending: []string{isBareMetalServerNetworkInterfacePending}, Target: []string{isBareMetalServerNetworkInterfaceAvailable, isBareMetalServerNetworkInterfacePCIPending, isBareMetalServerNetworkInterfaceFailed}, @@ -1008,7 +1012,7 @@ func isWaitForBareMetalServerNetworkInterfaceAvailable(client *vpcv1.VpcV1, bare Delay: 10 * time.Second, MinTimeout: 10 * time.Second, } - return stateConf.WaitForState() + return stateConf.WaitForStateContext(ctx) } func isBareMetalServerNetworkInterfaceRefreshFunc(client *vpcv1.VpcV1, bareMetalServerId, nicId string, d *schema.ResourceData) resource.StateRefreshFunc { @@ -1017,12 +1021,15 @@ func isBareMetalServerNetworkInterfaceRefreshFunc(client *vpcv1.VpcV1, bareMetal BareMetalServerID: &bareMetalServerId, ID: &nicId, } + bmsNic, response, err := client.GetBareMetalServerNetworkInterface(getBmsNicOptions) if err != nil { return nil, "", fmt.Errorf("[ERROR] Error getting Bare Metal Server (%s) Network Interface (%s) : %s\n%s", bareMetalServerId, nicId, err, response) } status := "" pcipending := false + log.Printf("[INFO] UJJK enteref refresh func make build %s", reflect.TypeOf(bmsNic).String()) + switch reflect.TypeOf(bmsNic).String() { case "*vpcv1.BareMetalServerNetworkInterfaceByPci": { @@ -1044,8 +1051,13 @@ func isBareMetalServerNetworkInterfaceRefreshFunc(client *vpcv1.VpcV1, bareMetal case "*vpcv1.BareMetalServerNetworkInterfaceByVlan": { nic := bmsNic.(*vpcv1.BareMetalServerNetworkInterfaceByVlan) + log.Printf("[INFO] UJJK seeting vlan type status is %s/%s", *nic.Status, *nic.PrimaryIP.Address) status = *nic.Status d.Set(isBareMetalServerNicStatus, *nic.Status) + if *nic.PrimaryIP.Address == "0.0.0.0" { + log.Printf("[INFO] ujjk status is pending and we are returning oending for %s/%s", bareMetalServerId, nicId) + return bmsNic, "pending", nil + } } } diff --git a/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_interface_allow_float.go b/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_interface_allow_float.go index a90b0a2f80..faefdd690f 100644 --- a/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_interface_allow_float.go +++ b/ibm/service/vpc/resource_ibm_is_bare_metal_server_network_interface_allow_float.go @@ -300,6 +300,7 @@ func createVlanTypeNetworkInterfaceAllowFloat(context context.Context, d *schema nicOptions.SecurityGroups = sGroupList options.BareMetalServerID = &bareMetalServerId options.BareMetalServerNetworkInterfacePrototype = nicOptions + nic, response, err := sess.CreateBareMetalServerNetworkInterfaceWithContext(context, options) if err != nil || nic == nil { return fmt.Errorf("[DEBUG] Create bare metal server (%s) network interface err %s\n%s", bareMetalServerId, err, response) @@ -324,12 +325,12 @@ func createVlanTypeNetworkInterfaceAllowFloat(context context.Context, d *schema } log.Printf("[INFO] Bare Metal Server Network Interface : %s", d.Id()) - _, err = isWaitForBareMetalServerNetworkInterfaceAvailable(sess, bareMetalServerId, nicId, d.Timeout(schema.TimeoutCreate), d) + nicss, err := isWaitForBareMetalServerNetworkInterfaceAvailable(sess, context, bareMetalServerId, nicId, d.Timeout(schema.TimeoutCreate), d) if err != nil { return err } - err = bareMetalServerNICAllowFloatGet(d, meta, sess, nic, bareMetalServerId) + err = bareMetalServerNICAllowFloatGet(d, meta, sess, nicss, bareMetalServerId) if err != nil { return err } From c57815e951683f2e33bfb8bdd80f4d0ca6a5feec Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 24 Nov 2022 09:46:07 +0530 Subject: [PATCH 011/103] updated sdk --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 1560 ++++++----------- .../IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go | 880 +++++----- 2 files changed, 996 insertions(+), 1444 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 064b7ee576..5f6fef170d 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.55.1-b24c7487-20220831-201343 + * IBM OpenAPI SDK Code Generator Version: 3.60.2-95dc7721-20221102-203229 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -37,7 +37,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: 2022-09-13 +// API Version: 2022-11-22 type VpcV1 struct { Service *core.BaseService @@ -580,7 +580,7 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC // GetVPCDefaultRoutingTable : Retrieve a VPC's default routing table // This request retrieves the default routing table for the VPC specified by the identifier in the URL. The default -// routing table is associated with any subnets in the VPC which have not been explicitly associated with a user-defined +// routing table is associated with any subnets in the VPC which have not been explicitly associated with another // routing table. func (vpc *VpcV1) GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { return vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) @@ -1052,12 +1052,15 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV // This request lists all routes in the VPC's default routing table. Each route is zone-specific and directs any packets // matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's // destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { return vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) } // ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListVPCRoutes") err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") if err != nil { return @@ -1126,12 +1129,15 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt // This request creates a new route in the VPC's default routing table. The route prototype object is structured in the // same way as a retrieved route, and contains the information necessary to create the new route. The request will fail // if the new route will cause a loop. +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { return vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) } // CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: CreateVPCRoute") err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") if err != nil { return @@ -1211,12 +1217,15 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO // DeleteVPCRoute : Delete a VPC route // This request deletes a route. This operation cannot be reversed. +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) } // DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: DeleteVPCRoute") err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") if err != nil { return @@ -1263,12 +1272,15 @@ func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteO // GetVPCRoute : Retrieve a VPC route // This request retrieves a single route specified by the identifier in the URL. +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { return vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) } // GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetVPCRoute") err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") if err != nil { return @@ -1328,12 +1340,15 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions // UpdateVPCRoute : Update a VPC route // This request updates a route with the information in a provided route patch. The route patch object is structured in // the same way as a retrieved route and contains only the information to be updated. +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { return vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) } // UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: UpdateVPCRoute") err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") if err != nil { return @@ -1397,10 +1412,10 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO } // ListVPCRoutingTables : List all routing tables for a VPC -// This request lists all user-defined routing tables for a VPC. Each subnet in a VPC is associated with a routing -// table, which controls delivery of packets sent on that subnet according to the action of the most specific matching -// route in the table. If multiple equally-specific routes exist, traffic will be distributed across them. If no routes -// match, delivery will be controlled by the system's built-in routes. +// This request lists all routing tables for a VPC. Each subnet in a VPC is associated with a routing table, which +// controls delivery of packets sent on that subnet according to the action of the most specific matching route in the +// table. If multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, +// delivery will be controlled by the system's built-in routes. func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { return vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) } @@ -1472,9 +1487,8 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo } // CreateVPCRoutingTable : Create a routing table for a VPC -// This request creates a user-defined routing table from a routing table prototype object. The prototype object is -// structured in the same way as a retrieved routing table, and contains the information necessary to create the new -// routing table. +// This request creates a routing table from a routing table prototype object. The prototype object is structured in the +// same way as a retrieved routing table, and contains the information necessary to create the new routing table. func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { return vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) } @@ -21453,10 +21467,10 @@ type AddressPrefix struct { // 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 updated with a user-specified name. + // words, but may be changed. IsDefault *bool `json:"is_default" validate:"required"` - // The user-defined name for this address prefix. Names must be unique within the VPC the address prefix resides in. + // 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. @@ -21601,7 +21615,7 @@ type AddressPrefixPatch struct { // Updating to false removes the default prefix for this zone in this VPC. IsDefault *bool `json:"is_default,omitempty"` - // The user-defined name for this address prefix. Names must be unique within the VPC the address prefix resides in. + // The name for this address prefix. The name must not be used by another address prefix for the VPC. Name *string `json:"name,omitempty"` } @@ -21664,7 +21678,7 @@ type BackupPolicy struct { // be subject to the backup policy. MatchUserTags []string `json:"match_user_tags" validate:"required"` - // The unique user-defined name for this backup policy. + // 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. @@ -21854,7 +21868,7 @@ type BackupPolicyPatch struct { // tag and a matching type will be subject to the backup policy. MatchUserTags []string `json:"match_user_tags,omitempty"` - // The user-defined name for this backup policy. Names must be unique within the region this backup policy resides in. + // The name for this backup policy. The name must not be used by another backup policy in the region. Name *string `json:"name,omitempty"` } @@ -21915,7 +21929,7 @@ type BackupPolicyPlan struct { // The lifecycle state of this backup policy plan. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The unique user-defined name for this backup policy plan. + // 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 resource type. @@ -22101,8 +22115,7 @@ type BackupPolicyPlanPatch struct { DeletionTrigger *BackupPolicyPlanDeletionTriggerPatch `json:"deletion_trigger,omitempty"` - // The user-defined name for this backup policy plan. Names must be unique within the backup policy this plan resides - // in. + // 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"` } @@ -22167,8 +22180,8 @@ type BackupPolicyPlanPrototype struct { DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"` - // The user-defined name for this backup policy plan. Names must be unique within the backup policy this plan resides - // in. If unspecified, the name will be a hyphenated list of randomly-selected words. + // 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"` } @@ -22224,7 +22237,7 @@ type BackupPolicyPlanReference struct { // The unique identifier for this backup policy plan. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this backup policy plan. + // 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 resource type. @@ -22316,7 +22329,7 @@ type BareMetalServer struct { // The amount of memory, truncated to whole gibibytes. Memory *int64 `json:"memory" validate:"required"` - // The user-defined name for this bare metal server (and default system hostname). + // 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 interfaces for this bare metal server, including the primary network interface. @@ -22478,7 +22491,7 @@ type BareMetalServerBootTarget struct { // The unique identifier for this bare metal server disk. ID *string `json:"id,omitempty"` - // The user-defined name for this disk. + // 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. @@ -22738,7 +22751,7 @@ type BareMetalServerDisk struct { // unexpected property value was encountered. InterfaceType *string `json:"interface_type" validate:"required"` - // The user-defined name for this disk. + // 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. @@ -22824,7 +22837,7 @@ func UnmarshalBareMetalServerDiskCollection(m map[string]json.RawMessage, result // BareMetalServerDiskPatch : BareMetalServerDiskPatch struct type BareMetalServerDiskPatch struct { - // The user-defined name for this disk. + // 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"` } @@ -23057,7 +23070,7 @@ type BareMetalServerNetworkInterface struct { // The MAC address of the interface. If absent, the value is not known. MacAddress *string `json:"mac_address" validate:"required"` - // The user-defined name for this network interface. + // The name for this network interface. Name *string `json:"name" validate:"required"` // The network interface port speed in Mbps. @@ -23285,8 +23298,8 @@ type BareMetalServerNetworkInterfacePatch struct { // This must be `true` when `interface_type` is `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The user-defined name for network interface. Names must be unique within the instance the network interface resides - // in. + // The name for this network interface. The name must not be used by another network interface on the bare metal + // server. Name *string `json:"name,omitempty"` } @@ -23364,8 +23377,8 @@ type BareMetalServerNetworkInterfacePrototype struct { // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. InterfaceType *string `json:"interface_type" validate:"required"` - // The user-defined name for network interface. Names must be unique within the instance the network interface resides - // in. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this 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 network interface. This can be specified using @@ -23452,7 +23465,8 @@ func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMess // BareMetalServerPatch : BareMetalServerPatch struct type BareMetalServerPatch struct { - // The user-defined name for this bare metal server (and default system hostname). + // 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"` } @@ -23511,8 +23525,8 @@ type BareMetalServerPrimaryNetworkInterfacePrototype struct { // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. InterfaceType *string `json:"interface_type,omitempty"` - // The user-defined name for network interface. Names must be unique within the instance the network interface resides - // in. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this 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 network interface. This can be specified using @@ -23623,7 +23637,7 @@ type BareMetalServerProfile struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The supported trusted platform module (TPM) modes for this bare metal server profile. + // The supported trusted platform module modes for this bare metal server profile. SupportedTrustedPlatformModuleModes *BareMetalServerProfileSupportedTrustedPlatformModuleModes `json:"supported_trusted_platform_module_modes" validate:"required"` } @@ -24499,12 +24513,12 @@ func UnmarshalBareMetalServerProfileReference(m map[string]json.RawMessage, resu return } -// BareMetalServerProfileSupportedTrustedPlatformModuleModes : The supported trusted platform module (TPM) modes for this bare metal server profile. +// BareMetalServerProfileSupportedTrustedPlatformModuleModes : The supported trusted platform module modes for this bare metal server profile. type BareMetalServerProfileSupportedTrustedPlatformModuleModes struct { // The type for this profile field. Type *string `json:"type" validate:"required"` - // The supported trusted platform module (TPM) modes. + // The supported trusted platform module modes. Values []string `json:"values" validate:"required"` } @@ -24515,16 +24529,14 @@ const ( ) // Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Values property. -// The mode for the trusted platform module (TPM): -// - `tpm_2`: Standard TPM 2 capabilities -// - `tpm_2_with_txt`: Standard TPM 2 with Intel Trusted Execution Technology (TXT) +// The trusted platform module (TPM) mode: +// - `tpm_2`: TPM 2.0 // // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. const ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2WithTxtConst = "tpm_2_with_txt" + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" ) // UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes unmarshals an instance of BareMetalServerProfileSupportedTrustedPlatformModuleModes from the specified map of raw messages. @@ -24595,12 +24607,11 @@ func UnmarshalBareMetalServerStatusReason(m map[string]json.RawMessage, result i // BareMetalServerTrustedPlatformModule : BareMetalServerTrustedPlatformModule struct type BareMetalServerTrustedPlatformModule struct { - // Indicates whether the trusted platform module (TPM) is enabled. If enabled, `mode` will also be set. + // Indicates whether the trusted platform module is enabled. Enabled *bool `json:"enabled" validate:"required"` - // The mode for the trusted platform module (TPM): - // - `tpm_2`: Standard TPM 2 capabilities - // - `tpm_2_with_txt`: Standard TPM 2 with Intel Trusted Execution Technology (TXT) + // The trusted platform module (TPM) mode: + // - `tpm_2`: TPM 2.0 // // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the @@ -24609,16 +24620,14 @@ type BareMetalServerTrustedPlatformModule struct { } // Constants associated with the BareMetalServerTrustedPlatformModule.Mode property. -// The mode for the trusted platform module (TPM): -// - `tpm_2`: Standard TPM 2 capabilities -// - `tpm_2_with_txt`: Standard TPM 2 with Intel Trusted Execution Technology (TXT) +// The trusted platform module (TPM) mode: +// - `tpm_2`: TPM 2.0 // // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. const ( - BareMetalServerTrustedPlatformModuleModeTpm2Const = "tpm_2" - BareMetalServerTrustedPlatformModuleModeTpm2WithTxtConst = "tpm_2_with_txt" + BareMetalServerTrustedPlatformModuleModeTpm2Const = "tpm_2" ) // UnmarshalBareMetalServerTrustedPlatformModule unmarshals an instance of BareMetalServerTrustedPlatformModule from the specified map of raw messages. @@ -24882,8 +24891,8 @@ type CreateBackupPolicyOptions struct { // be subject to the backup policy. MatchUserTags []string `json:"match_user_tags,omitempty"` - // The user-defined name for this backup policy. Names must be unique within the region this backup policy resides in. - // If unspecified, the name will be a hyphenated list of randomly-selected words. + // 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. @@ -24967,8 +24976,8 @@ type CreateBackupPolicyPlanOptions struct { DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"` - // The user-defined name for this backup policy plan. Names must be unique within the backup policy this plan resides - // in. If unspecified, the name will be a hyphenated list of randomly-selected words. + // 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"` // Allows users to set headers on API requests @@ -25142,8 +25151,10 @@ type CreateBareMetalServerOptions struct { // The zone this bare metal server will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The unique user-defined name for this bare metal server (and default system hostname). If unspecified, the name will - // be a hyphenated list of randomly-selected words. + // 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 additional network interfaces to create for the bare metal server. @@ -25235,8 +25246,8 @@ type CreateDedicatedHostGroupOptions struct { // The dedicated host profile family for hosts in this group. Family *string `json:"family,omitempty"` - // The unique user-defined name for this dedicated host group. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. 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 @@ -25339,8 +25350,8 @@ type CreateEndpointGatewayOptions struct { // The reserved IPs to bind to this endpoint gateway. At most one reserved IP per zone is allowed. Ips []EndpointGatewayReservedIPIntf `json:"ips,omitempty"` - // The user-defined name for this endpoint gateway. If unspecified, the name will be a hyphenated list of - // randomly-selected words. Names must be unique within the VPC this endpoint gateway is serving. + // The name for this endpoint gateway. The name must not be used by another endpoint gateway in the VPC. 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 @@ -25448,8 +25459,8 @@ type CreateFlowLogCollectorOptions struct { // Indicates whether this collector will be active upon creation. Active *bool `json:"active,omitempty"` - // The unique user-defined name for this flow log collector. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this flow log collector. The name must not be used by another flow log collector in the region. 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 @@ -25527,7 +25538,8 @@ type CreateIkePolicyOptions struct { // The key lifetime in seconds. KeyLifetime *int64 `json:"key_lifetime,omitempty"` - // The user-defined name for this IKE policy. + // The name for this IKE policy. The name must not be used by another IKE policies in the region. 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 @@ -25907,10 +25919,8 @@ type CreateInstanceGroupOptions struct { // This property must be specified if and only if `load_balancer_pool` has been specified. ApplicationPort *int64 `json:"application_port,omitempty"` - // The load balancer associated with `load_balancer_pool`. - // - // This property must be specified if and only if `load_balancer_pool` has been - // specified. + // The load balancer associated with the specified load balancer pool. + // Required if `load_balancer_pool` is specified. // // At present, only load balancers in the `application` family are supported. LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` @@ -25924,8 +25934,8 @@ type CreateInstanceGroupOptions struct { // The number of instances in the instance group. MembershipCount *int64 `json:"membership_count,omitempty"` - // The unique user-defined name for this instance group. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this instance group. The name must not be used by another instance group in the region. 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 @@ -26010,8 +26020,8 @@ type CreateInstanceNetworkInterfaceOptions struct { // interface. If true, source IP spoofing is allowed on this interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // The user-defined name for network interface. Names must be unique within the instance the network interface resides - // in. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for network interface. The name must not be used by another network interface on the virtual server + // instance. 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 network interface. This can be specified using @@ -26143,11 +26153,11 @@ type CreateInstanceVolumeAttachmentOptions struct { // An existing volume to attach to the instance, or a prototype object for a new volume. Volume VolumeAttachmentPrototypeVolumeIntf `json:"volume" validate:"required"` - // If set to true, when deleting the instance the volume will also be deleted. + // Indicates whether deleting the instance will also delete the attached volume. DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - // The user-defined name for this volume attachment. Names must be unique within the instance the volume attachment - // resides in. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. 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 @@ -26219,7 +26229,8 @@ type CreateIpsecPolicyOptions struct { // The key lifetime in seconds. KeyLifetime *int64 `json:"key_lifetime,omitempty"` - // The user-defined name for this IPsec policy. + // The name for this IPsec policy. The name must not be used by another IPsec policies in the region. 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 @@ -26344,8 +26355,8 @@ type CreateKeyOptions struct { // imported. PublicKey *string `json:"public_key" validate:"required"` - // The unique user-defined name for this key. If unspecified, the name will be a hyphenated list of randomly-selected - // words. + // The name for this key. The name must not be used by another key in the region. 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 @@ -26449,7 +26460,8 @@ type CreateLoadBalancerListenerOptions struct { // `protocol` of `http`, and the target listener must have a `protocol` of `https`. HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPrototype `json:"https_redirect,omitempty"` - // The policy prototype objects for this listener. + // The policy prototype objects for this listener. The load balancer must be in the + // `application` family. Policies []LoadBalancerListenerPolicyPrototype `json:"policies,omitempty"` // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must @@ -26599,7 +26611,8 @@ type CreateLoadBalancerListenerPolicyOptions struct { // Priority of the policy. Lower value indicates higher priority. Priority *int64 `json:"priority" validate:"required"` - // The user-defined name for this policy. Names must be unique within the load balancer listener the policy resides in. + // The name for this policy. The name must not be used by another policy for the load balancer listener. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The rule prototype objects for this policy. @@ -26827,8 +26840,8 @@ type CreateLoadBalancerOptions struct { // To activate logging, the load balancer profile must support the specified logging type. Logging *LoadBalancerLogging `json:"logging,omitempty"` - // The user-defined name for this load balancer. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this load balancer. The name must not be used by another load balancer in the VPC. If unspecified, the + // name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The pools of this load balancer. @@ -27029,8 +27042,8 @@ type CreateLoadBalancerPoolOptions struct { // tuple cannot be shared by a pool member of any other load balancer in the same VPC. Members []LoadBalancerPoolMemberPrototype `json:"members,omitempty"` - // The user-defined name for this load balancer pool. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this load balancer pool. The name must not be used by another pool for the load balancer. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The PROXY protocol setting for this pool: @@ -27219,8 +27232,8 @@ type CreatePlacementGroupOptions struct { // unexpected strategy was encountered. Strategy *string `json:"strategy" validate:"required"` - // The unique user-defined name for this placement group. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this placement group. The name must not be used by another placement group in the region. 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 @@ -27285,8 +27298,8 @@ type CreatePublicGatewayOptions struct { FloatingIP PublicGatewayFloatingIPPrototypeIntf `json:"floating_ip,omitempty"` - // The user-defined name for this public gateway. Names must be unique within the VPC the public gateway resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this public gateway. The name must not be used by another public gateway in the VPC. 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 @@ -27346,8 +27359,8 @@ type CreateSecurityGroupOptions struct { // The VPC this security group will reside in. VPC VPCIdentityIntf `json:"vpc" validate:"required"` - // The user-defined name for this security group. If unspecified, the name will be a hyphenated list of - // randomly-selected words. Names must be unique within the VPC the security group resides in. + // The name for this security group. The name must not be used by another security group for the VPC. 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 @@ -27545,9 +27558,9 @@ type CreateSubnetReservedIPOptions struct { // `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound. AutoDelete *bool `json:"auto_delete,omitempty"` - // The user-defined name for this reserved IP. If unspecified, the name will be a hyphenated list of randomly-selected - // words. Names must be unique within the subnet the reserved IP resides in. Names beginning with `ibm-` are reserved - // for provider-owned resources. + // The name for this reserved IP. The name must not be used by another reserved IP in the 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"` // The target to bind this reserved IP to. The target must be in the same VPC. @@ -27657,8 +27670,8 @@ type CreateVPCAddressPrefixOptions struct { // have a default address prefix for this zone. IsDefault *bool `json:"is_default,omitempty"` - // The user-defined name for this address prefix. Names must be unique within the VPC the address prefix resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this address prefix. The name must not be used by another address prefix for the VPC. 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 @@ -27712,8 +27725,9 @@ func (options *CreateVPCAddressPrefixOptions) SetHeaders(param map[string]string // CreateVPCOptions : The CreateVPC options. type CreateVPCOptions struct { - // Indicates whether a default address prefix will be automatically created for each zone in this VPC. If `manual`, - // this VPC will be created with no default address prefixes. + // Indicates whether a [default address prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes) + // will be automatically created for each zone in this VPC. If `manual`, this VPC will be created with no default + // address prefixes. // // Since address prefixes are managed identically regardless of whether they were automatically created, the value is // not preserved as a VPC property. @@ -27724,8 +27738,8 @@ type CreateVPCOptions struct { // connected in this way. This value is set at creation and subsequently immutable. ClassicAccess *bool `json:"classic_access,omitempty"` - // The unique user-defined name for this VPC. If unspecified, the name will be a hyphenated list of randomly-selected - // words. + // The name for this VPC. The name must not be used by another VPC in the region. 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 @@ -27737,8 +27751,9 @@ type CreateVPCOptions struct { } // Constants associated with the CreateVPCOptions.AddressPrefixManagement property. -// Indicates whether a default address prefix will be automatically created for each zone in this VPC. If `manual`, this -// VPC will be created with no default address prefixes. +// Indicates whether a [default address prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes) +// will be automatically created for each zone in this VPC. If `manual`, this VPC will be created with no default +// address prefixes. // // Since address prefixes are managed identically regardless of whether they were automatically created, the value is // not preserved as a VPC property. @@ -27802,8 +27817,9 @@ type CreateVPCRouteOptions struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` - // The user-defined name for this route. If unspecified, the name will be a hyphenated list of randomly-selected words. - // Names must be unique within the VPC routing table the route resides in. + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` + // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. Name *string `json:"name,omitempty"` // If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` @@ -27889,8 +27905,8 @@ type CreateVPCRoutingTableOptions struct { // support is expected to expand in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` - // The user-defined name for this routing table. Names must be unique within the VPC the routing table resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this routing table. The name must not be used by another routing table in the VPC. If unspecified, the + // name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // If set to `true`, this routing table will be used to route traffic that originates from [Direct @@ -28030,8 +28046,9 @@ type CreateVPCRoutingTableRouteOptions struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` - // The user-defined name for this route. If unspecified, the name will be a hyphenated list of randomly-selected words. - // Names must be unique within the VPC routing table the route resides in. + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` + // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. Name *string `json:"name,omitempty"` // If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` @@ -28214,8 +28231,8 @@ type CreateVPNServerOptions struct { // Indicates whether the split tunneling is enabled on this VPN server. EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"` - // The user-defined name for this VPN server. If unspecified, the name will be a hyphenated list of randomly-selected - // words. Names must be unique within the VPC this VPN server is serving. + // The name for this VPN server. The name must not be used by another VPN server in the VPC. If unspecified, the name + // will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The port number to use for this VPN server. @@ -28350,8 +28367,8 @@ type CreateVPNServerRouteOptions struct { // unexpected property value was encountered. Action *string `json:"action,omitempty"` - // The user-defined name for this VPN route. If unspecified, the name will be a hyphenated list of randomly-selected - // words. Names must be unique within the VPN server the VPN route resides in. + // The name for this VPN server route. The name must not be used by another route for the VPN server. 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 @@ -28450,7 +28467,7 @@ type DedicatedHost struct { // The total amount of memory in gibibytes for this host. Memory *int64 `json:"memory" validate:"required"` - // The unique user-defined name for this dedicated host. + // The name for this dedicated host. The name is unique across all dedicated hosts in the region. Name *string `json:"name" validate:"required"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) for this @@ -28731,7 +28748,7 @@ type DedicatedHostDisk struct { // The lifecycle state of this dedicated host disk. LifecycleState *string `json:"lifecycle_state,omitempty"` - // The user-defined or system-provided name for this disk. + // The name for this dedicated host disk. The name is unique across all disks on the dedicated host. Name *string `json:"name" validate:"required"` // Indicates whether this dedicated host disk is available for instance disk creation. @@ -28860,7 +28877,7 @@ func UnmarshalDedicatedHostDiskCollection(m map[string]json.RawMessage, result i // DedicatedHostDiskPatch : DedicatedHostDiskPatch struct type DedicatedHostDiskPatch struct { - // The user-defined name for this disk. + // The name for this dedicated host disk. The name must not be used by another disk on the dedicated host. Name *string `json:"name,omitempty"` } @@ -28908,7 +28925,7 @@ type DedicatedHostGroup struct { // The unique identifier for this dedicated host group. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this dedicated host group. + // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. Name *string `json:"name" validate:"required"` // The resource group for this dedicated host group. @@ -29130,7 +29147,7 @@ func UnmarshalDedicatedHostGroupIdentity(m map[string]json.RawMessage, result in // DedicatedHostGroupPatch : DedicatedHostGroupPatch struct type DedicatedHostGroupPatch struct { - // The unique user-defined name for this dedicated host group. + // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. Name *string `json:"name,omitempty"` } @@ -29157,7 +29174,8 @@ func (dedicatedHostGroupPatch *DedicatedHostGroupPatch) AsPatch() (_patch map[st // DedicatedHostGroupPrototypeDedicatedHostByZoneContext : DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct type DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct { - // The unique user-defined name for this dedicated host group. + // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. 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 host's resource group is used. @@ -29194,7 +29212,7 @@ type DedicatedHostGroupReference struct { // The unique identifier for this dedicated host group. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this dedicated host group. + // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. Name *string `json:"name" validate:"required"` // The resource type. @@ -29261,7 +29279,7 @@ type DedicatedHostPatch struct { // If set to true, instances can be placed on this dedicated host. InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` - // The unique user-defined name for this dedicated host. + // The name for this dedicated host. The name must not be used by another dedicated host in the region. Name *string `json:"name,omitempty"` } @@ -29986,8 +30004,8 @@ type DedicatedHostPrototype struct { // If set to true, instances can be placed on this dedicated host. InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` - // The unique user-defined name for this dedicated host. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, + // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this @@ -30059,7 +30077,7 @@ type DedicatedHostReference struct { // The unique identifier for this dedicated host. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this dedicated host. + // The name for this dedicated host. The name is unique across all dedicated hosts in the region. Name *string `json:"name" validate:"required"` // The resource type. @@ -30136,7 +30154,7 @@ type DefaultNetworkACL struct { ID *string `json:"id" validate:"required"` // The name of the default network ACL created for a VPC. The name will be a hyphenated list of randomly-selected words - // at creation, but may be user-specified with a subsequent request. + // at creation, but may be changed. Name *string `json:"name" validate:"required"` // The resource group for the default network ACL for a VPC. Set to the VPC's @@ -30221,7 +30239,7 @@ type DefaultRoutingTable struct { LifecycleState *string `json:"lifecycle_state" validate:"required"` // The name of the default routing table created for this VPC. The name will be a hyphenated list of randomly-selected - // words at creation, but may be user-specified with a subsequent request. + // words at creation, but may be changed. Name *string `json:"name" validate:"required"` // The resource type. @@ -30368,8 +30386,8 @@ type DefaultSecurityGroup struct { // The unique identifier for this security group. ID *string `json:"id" validate:"required"` - // The name of the default security group created for a VPC. The name will be a hyphenated list of randomly-selected - // words at creation, but may be user-specified with a subsequent request. + // The name for the default security group for a VPC. The name will be a hyphenated list of randomly-selected words at + // creation, but may changed. Name *string `json:"name" validate:"required"` // The resource group for this security group. @@ -32374,7 +32392,7 @@ type EndpointGateway struct { // The lifecycle state of the endpoint gateway. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The unique user-defined name for this endpoint gateway. + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. Name *string `json:"name" validate:"required"` // The resource group for this endpoint gateway. @@ -32387,6 +32405,7 @@ type EndpointGateway struct { SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` // The fully qualified domain name for the target service. + // Deprecated: this field is deprecated and may be removed in a future release. ServiceEndpoint *string `json:"service_endpoint,omitempty"` // The fully qualified domain names for the target service. @@ -32593,8 +32612,7 @@ func UnmarshalEndpointGatewayCollectionNext(m map[string]json.RawMessage, result // EndpointGatewayPatch : EndpointGatewayPatch struct type EndpointGatewayPatch struct { - // The user-defined name for this endpoint gateway. Names must be unique within the VPC this endpoint gateway is - // serving. + // The name for this endpoint gateway. The name must not be used by another endpoint gateway in the VPC. Name *string `json:"name,omitempty"` } @@ -32659,9 +32677,9 @@ type EndpointGatewayReservedIP struct { // `target` is deleted, or the reserved IP is unbound. AutoDelete *bool `json:"auto_delete,omitempty"` - // The user-defined name for this reserved IP. If unspecified, the name will be a hyphenated list of randomly-selected - // words. Names must be unique within the subnet the reserved IP resides in. Names beginning with `ibm-` are reserved - // for provider-owned resources. + // The name for this reserved IP. The name must not be used by another reserved IP in the 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"` // The subnet in which to create this reserved IP. @@ -32827,7 +32845,7 @@ type FloatingIP struct { // The unique identifier for this floating IP. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this floating IP. + // The name for this floating IP. The name is unique across all floating IPs in the region. Name *string `json:"name" validate:"required"` // The resource group for this floating IP. @@ -33028,7 +33046,7 @@ func UnmarshalFloatingIPCollectionNext(m map[string]json.RawMessage, result inte // FloatingIPPatch : FloatingIPPatch struct type FloatingIPPatch struct { - // The unique user-defined name for this floating IP. + // The name for this floating IP. The name must not be used by another floating IP in the region. Name *string `json:"name,omitempty"` // The network interface to bind the floating IP to, replacing any existing binding. @@ -33066,8 +33084,8 @@ func (floatingIPPatch *FloatingIPPatch) AsPatch() (_patch map[string]interface{} // - FloatingIPPrototypeFloatingIPByZone // - FloatingIPPrototypeFloatingIPByTarget type FloatingIPPrototype struct { - // The unique user-defined name for this floating IP. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this floating IP. The name must not be used by another floating IP in the region. 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 @@ -33130,7 +33148,7 @@ type FloatingIPReference struct { // The unique identifier for this floating IP. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this floating IP. + // The name for this floating IP. The name is unique across all floating IPs in the region. Name *string `json:"name" validate:"required"` } @@ -33198,7 +33216,7 @@ type FloatingIPTarget struct { // The unique identifier for this network interface. ID *string `json:"id,omitempty"` - // The user-defined name for this network interface. + // The name for this network interface. Name *string `json:"name,omitempty"` PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` @@ -33336,7 +33354,7 @@ type FlowLogCollector struct { // The lifecycle state of the flow log collector. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The unique user-defined name for this flow log collector. + // The name for this flow log collector. The name is unique across all flow log collectors in the region. Name *string `json:"name" validate:"required"` // The resource group for this flow log collector. @@ -33528,7 +33546,7 @@ type FlowLogCollectorPatch struct { // activates the collector. Active *bool `json:"active,omitempty"` - // The unique user-defined name for this flow log collector. + // The name for this flow log collector. The name must not be used by another flow log collector in the region. Name *string `json:"name,omitempty"` } @@ -33585,7 +33603,7 @@ type FlowLogCollectorTarget struct { // The unique identifier for this network interface. ID *string `json:"id,omitempty"` - // The user-defined name for this network interface. + // The name for this network interface. Name *string `json:"name,omitempty"` // The resource type. @@ -36279,7 +36297,7 @@ type IkePolicy struct { // The key lifetime in seconds. KeyLifetime *int64 `json:"key_lifetime" validate:"required"` - // The user-defined name for this IKE policy. + // The name for this IKE policy. The name is unique across all IKE policies in the region. Name *string `json:"name" validate:"required"` // The IKE negotiation mode. Only `main` is supported. @@ -36467,7 +36485,7 @@ type IkePolicyPatch struct { // The key lifetime in seconds. KeyLifetime *int64 `json:"key_lifetime,omitempty"` - // The user-defined name for this IKE policy. + // The name for this IKE policy. The name must not be used by another IKE policy in the region. Name *string `json:"name,omitempty"` } @@ -36547,7 +36565,7 @@ type IkePolicyReference struct { // The unique identifier for this IKE policy. ID *string `json:"id" validate:"required"` - // The user-defined name for this IKE policy. + // The name for this IKE policy. The name is unique across all IKE policies in the region. Name *string `json:"name" validate:"required"` // The resource type. @@ -36654,7 +36672,7 @@ type IPsecPolicy struct { // The key lifetime in seconds. KeyLifetime *int64 `json:"key_lifetime" validate:"required"` - // The user-defined name for this IPsec policy. + // The name for this IPsec policy. The name is unique across all IPsec policies in the region. Name *string `json:"name" validate:"required"` // Perfect Forward Secrecy @@ -36919,7 +36937,7 @@ type IPsecPolicyPatch struct { // The key lifetime in seconds. KeyLifetime *int64 `json:"key_lifetime,omitempty"` - // The user-defined name for this IPsec policy. + // The name for this IPsec policy. The name must not be used by another IPsec policy in the region. Name *string `json:"name,omitempty"` // Perfect Forward Secrecy @@ -37033,7 +37051,7 @@ type IPsecPolicyReference struct { // The unique identifier for this IPsec policy. ID *string `json:"id" validate:"required"` - // The user-defined name for this IPsec policy. + // The name for this IPsec policy. The name is unique across all IPsec policies in the region. Name *string `json:"name" validate:"required"` // The resource type. @@ -37176,7 +37194,7 @@ type Image struct { // This property may be absent if the image has a `status` of `pending` or `failed`. MinimumProvisionedSize *int64 `json:"minimum_provisioned_size,omitempty"` - // The user-defined or system-provided name for this image. + // The name for this image. The name is unique across all images in the region. Name *string `json:"name" validate:"required"` // The operating system included in this image. @@ -37570,7 +37588,8 @@ func UnmarshalImageIdentity(m map[string]json.RawMessage, result interface{}) (e // ImagePatch : ImagePatch struct type ImagePatch struct { - // The unique user-defined name for this image. Names starting with `ibm-` are not allowed. + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are + // reserved for system-provided images, and are not allowed. Name *string `json:"name,omitempty"` } @@ -37600,8 +37619,9 @@ func (imagePatch *ImagePatch) AsPatch() (_patch map[string]interface{}, err erro // - ImagePrototypeImageByFile // - ImagePrototypeImageBySourceVolume type ImagePrototype struct { - // The unique user-defined name for this image. Names starting with `ibm-` are not allowed. If unspecified, the name - // will be a hyphenated list of randomly-selected words. + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are + // reserved for system-provided images, 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 @@ -37700,7 +37720,7 @@ type ImageReference struct { // The unique identifier for this image. ID *string `json:"id" validate:"required"` - // The user-defined or system-provided name for this image. + // The name for this image. The name is unique across all images in the region. Name *string `json:"name" validate:"required"` } @@ -37848,7 +37868,7 @@ type Instance struct { // The metadata service configuration. MetadataService *InstanceMetadataService `json:"metadata_service" validate:"required"` - // The user-defined name for this virtual server instance (and default system hostname). + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. Name *string `json:"name" validate:"required"` // The network interfaces for this virtual server instance, including the primary network interface. @@ -38081,6 +38101,7 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er // InstanceAction : InstanceAction struct type InstanceAction struct { // The date and time that the action was completed. + // Deprecated: this field is deprecated and may be removed in a future release. CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` // The date and time that the action was created. @@ -38090,15 +38111,19 @@ type InstanceAction struct { Force *bool `json:"force,omitempty"` // The URL for this instance action. + // Deprecated: this field is deprecated and may be removed in a future release. Href *string `json:"href" validate:"required"` // The identifier for this instance action. + // Deprecated: this field is deprecated and may be removed in a future release. ID *string `json:"id" validate:"required"` // The date and time that the action was started. + // Deprecated: this field is deprecated and may be removed in a future release. StartedAt *strfmt.DateTime `json:"started_at,omitempty"` // The current status of this action. + // Deprecated: this field is deprecated and may be removed in a future release. Status *string `json:"status" validate:"required"` // The type of action. @@ -38540,7 +38565,7 @@ type InstanceDisk struct { // unexpected property value was encountered. InterfaceType *string `json:"interface_type" validate:"required"` - // The user-defined name for this disk. + // The name for this instance disk. The name is unique across all disks on the instance. Name *string `json:"name" validate:"required"` // The resource type. @@ -38621,7 +38646,7 @@ func UnmarshalInstanceDiskCollection(m map[string]json.RawMessage, result interf // InstanceDiskPatch : InstanceDiskPatch struct type InstanceDiskPatch struct { - // The user-defined name for this disk. + // The name for this instance disk. The name must not be used by another disk on the instance. Name *string `json:"name,omitempty"` } @@ -38658,7 +38683,7 @@ type InstanceDiskReference struct { // The unique identifier for this instance disk. ID *string `json:"id" validate:"required"` - // The user-defined name for this disk. + // The name for this instance disk. The name is unique across all disks on the instance. Name *string `json:"name" validate:"required"` // The resource type. @@ -38786,7 +38811,7 @@ type InstanceGroup struct { // The number of instances in the instance group. MembershipCount *int64 `json:"membership_count" validate:"required"` - // The user-defined name for this instance group. + // The name for this instance group. The name is unique across all instance groups in the region. Name *string `json:"name" validate:"required"` ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -38999,7 +39024,7 @@ type InstanceGroupManager struct { // Indicates whether this manager will control the instance group. ManagementEnabled *bool `json:"management_enabled" validate:"required"` - // The user-defined name for this instance group manager. + // The name for this instance group manager. The name is unique across all managers for the instance group. Name *string `json:"name" validate:"required"` // The date and time that the instance group manager was updated. @@ -39123,7 +39148,8 @@ type InstanceGroupManagerAction struct { // The unique identifier for this instance group manager action. ID *string `json:"id" validate:"required"` - // The user-defined name for this instance group manager action. + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. Name *string `json:"name" validate:"required"` // The resource type. @@ -39312,7 +39338,8 @@ type InstanceGroupManagerActionPatch struct { Manager *InstanceGroupManagerActionManagerPatch `json:"manager,omitempty"` - // The user-defined name for this instance group manager action. + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. Name *string `json:"name,omitempty"` // The date and time the scheduled action will run. @@ -39360,7 +39387,7 @@ func (instanceGroupManagerActionPatch *InstanceGroupManagerActionPatch) AsPatch( // Models which "extend" this model: // - InstanceGroupManagerActionPrototypeScheduledActionPrototype type InstanceGroupManagerActionPrototype struct { - // The user-defined name for this instance group manager action. Names must be unique within the instance group + // The name for this instance group manager action. The name must not be used by another action for the instance group // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -39423,7 +39450,8 @@ type InstanceGroupManagerActionReference struct { // The unique identifier for this instance group manager action. ID *string `json:"id" validate:"required"` - // The user-defined name for this instance group manager action. + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. Name *string `json:"name" validate:"required"` // The resource type. @@ -39682,7 +39710,7 @@ type InstanceGroupManagerPatch struct { // The minimum number of members in a managed instance group. MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - // The user-defined name for this instance group manager. + // The name for this instance group manager. The name must not be used by another manager for the instance group. Name *string `json:"name,omitempty"` } @@ -39740,7 +39768,8 @@ type InstanceGroupManagerPolicy struct { // The unique identifier for this instance group manager policy. ID *string `json:"id" validate:"required"` - // The user-defined name for this instance group manager policy. + // The name for this instance group manager policy. The name is unique across all policies for the instance group + // manager. Name *string `json:"name" validate:"required"` // The date and time that the instance group manager policy was updated. @@ -39918,7 +39947,8 @@ type InstanceGroupManagerPolicyPatch struct { // The metric value to be evaluated. MetricValue *int64 `json:"metric_value,omitempty"` - // The user-defined name for this instance group manager policy. + // The name for this instance group manager policy. The name must not be used by another policy for the instance group + // manager. Name *string `json:"name,omitempty"` } @@ -39964,7 +39994,7 @@ func (instanceGroupManagerPolicyPatch *InstanceGroupManagerPolicyPatch) AsPatch( // Models which "extend" this model: // - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype type InstanceGroupManagerPolicyPrototype struct { - // The user-defined name for this instance group manager policy. Names must be unique within the instance group + // The name for this instance group manager policy. The name must not be used by another policy for the instance group // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -40036,7 +40066,8 @@ type InstanceGroupManagerPolicyReference struct { // The unique identifier for this instance group manager policy. ID *string `json:"id" validate:"required"` - // The user-defined name for this instance group manager policy. + // The name for this instance group manager policy. The name is unique across all policies for the instance group + // manager. Name *string `json:"name" validate:"required"` } @@ -40089,7 +40120,7 @@ type InstanceGroupManagerPrototype struct { // Indicates whether this manager will control the instance group. ManagementEnabled *bool `json:"management_enabled,omitempty"` - // The user-defined name for this instance group manager. Names must be unique within the instance group. If + // The name for this instance group manager. The name must not be used by another manager for the instance group. If // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -40170,7 +40201,7 @@ type InstanceGroupManagerReference struct { // The unique identifier for this instance group manager. ID *string `json:"id" validate:"required"` - // The user-defined name for this instance group manager. + // The name for this instance group manager. The name is unique across all managers for the instance group. Name *string `json:"name" validate:"required"` } @@ -40272,7 +40303,7 @@ type InstanceGroupManagerScheduledActionManager struct { // The unique identifier for this instance group manager. ID *string `json:"id,omitempty"` - // The user-defined name for this instance group manager. + // The name for this instance group manager. The name is unique across all managers for the instance group. Name *string `json:"name,omitempty"` // The desired maximum number of instance group members at the scheduled time. @@ -40387,7 +40418,7 @@ type InstanceGroupMembership struct { InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` - // The user-defined name for this instance group membership. Names must be unique within the instance group. + // The name for this instance group membership. The name is unique across all memberships for the instance group. Name *string `json:"name" validate:"required"` PoolMember *LoadBalancerPoolMemberReference `json:"pool_member,omitempty"` @@ -40560,7 +40591,8 @@ func UnmarshalInstanceGroupMembershipCollectionNext(m map[string]json.RawMessage // InstanceGroupMembershipPatch : InstanceGroupMembershipPatch struct type InstanceGroupMembershipPatch struct { - // The user-defined name for this instance group membership. Names must be unique within the instance group. + // The name for this instance group membership. The name must not be used by another membership for the instance group + // manager. Name *string `json:"name,omitempty"` } @@ -40598,10 +40630,8 @@ type InstanceGroupPatch struct { // `default_trusted_profile.auto_link`. InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template,omitempty"` - // The load balancer associated with `load_balancer_pool`. - // - // This property must be specified if and only if `load_balancer_pool` has been - // specified. + // The load balancer associated with the specified load balancer pool. + // Required if `load_balancer_pool` is specified. // // At present, only load balancers in the `application` family are supported. LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` @@ -40615,7 +40645,7 @@ type InstanceGroupPatch struct { // The number of instances in the instance group. MembershipCount *int64 `json:"membership_count,omitempty"` - // The user-defined name for this instance group. + // The name for this instance group. The name must not be used by another instance group in the region. Name *string `json:"name,omitempty"` // The subnets to use when creating new instances. @@ -40682,7 +40712,7 @@ type InstanceGroupReference struct { // The unique identifier for this instance group. ID *string `json:"id" validate:"required"` - // The user-defined name for this instance group. + // The name for this instance group. The name is unique across all instance groups in the region. Name *string `json:"name" validate:"required"` } @@ -40871,7 +40901,8 @@ type InstancePatch struct { // The metadata service configuration. MetadataService *InstanceMetadataServicePatch `json:"metadata_service,omitempty"` - // The user-defined name for this virtual server instance (and default system hostname). + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. Changing the name will not affect the system hostname. Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. For the placement @@ -41000,7 +41031,7 @@ type InstancePlacementTarget struct { // The unique identifier for this dedicated host group. ID *string `json:"id,omitempty"` - // The unique user-defined name for this dedicated host group. + // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. Name *string `json:"name,omitempty"` // The resource type. @@ -41145,7 +41176,7 @@ type InstanceProfile struct { Disks []InstanceProfileDisk `json:"disks" validate:"required"` // The product family this virtual server instance profile belongs to. - Family *string `json:"family,omitempty"` + Family *string `json:"family" validate:"required"` GpuCount InstanceProfileGpuIntf `json:"gpu_count,omitempty"` @@ -42242,8 +42273,10 @@ type InstancePrototype struct { // The metadata service configuration. MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the - // name will be a hyphenated list of randomly-selected words. + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 additional network interfaces to create for the virtual server instance. @@ -42273,7 +42306,7 @@ type InstancePrototype struct { UserData *string `json:"user_data,omitempty"` // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` // The VPC this virtual server instance will reside in. // @@ -42362,7 +42395,7 @@ func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{} if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } @@ -42413,7 +42446,7 @@ type InstanceReference struct { // The unique identifier for this virtual server instance. ID *string `json:"id" validate:"required"` - // The user-defined name for this virtual server instance (and default system hostname). + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. Name *string `json:"name" validate:"required"` } @@ -42554,7 +42587,7 @@ type InstanceTemplate struct { // The metadata service configuration. MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this instance template. + // The name for this instance template. The name is unique across all instance templates in the region. Name *string `json:"name" validate:"required"` // The additional network interfaces to create for the virtual server instance. @@ -42583,7 +42616,7 @@ type InstanceTemplate struct { UserData *string `json:"user_data,omitempty"` // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` // The VPC this virtual server instance will reside in. // @@ -42685,7 +42718,7 @@ func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } @@ -42842,7 +42875,7 @@ func UnmarshalInstanceTemplateIdentity(m map[string]json.RawMessage, result inte // InstanceTemplatePatch : InstanceTemplatePatch struct type InstanceTemplatePatch struct { - // The unique user-defined name for this instance template. + // The name for this instance template. The name must not be used by another instance template in the region. Name *string `json:"name,omitempty"` } @@ -42902,8 +42935,8 @@ type InstanceTemplatePrototype struct { // The metadata service configuration. MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the - // name will be a hyphenated list of randomly-selected words. + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The additional network interfaces to create for the virtual server instance. @@ -42933,7 +42966,7 @@ type InstanceTemplatePrototype struct { UserData *string `json:"user_data,omitempty"` // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` // The VPC this virtual server instance will reside in. // @@ -43023,7 +43056,7 @@ func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result int if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } @@ -43074,7 +43107,7 @@ type InstanceTemplateReference struct { // The unique identifier for this instance template. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this instance template. + // The name for this instance template. The name is unique across all instance templates in the region. Name *string `json:"name" validate:"required"` } @@ -43168,8 +43201,8 @@ type Key struct { // The length of this key (in bits). Length *int64 `json:"length" validate:"required"` - // The unique user-defined name for this key. If unspecified, the name will be a hyphenated list of randomly-selected - // words. + // The name for this key. The name must not be used by another key in the region. If unspecified, the name will be a + // hyphenated list of randomly-selected words. Name *string `json:"name" validate:"required"` // The public SSH key, consisting of two space-separated fields: the algorithm name, and the base64-encoded key. @@ -43381,7 +43414,7 @@ func UnmarshalKeyIdentity(m map[string]json.RawMessage, result interface{}) (err // KeyPatch : KeyPatch struct type KeyPatch struct { - // The user-defined name for this key. + // The name for this key. The name must not be used by another key in the region. Name *string `json:"name,omitempty"` } @@ -43425,7 +43458,7 @@ type KeyReference struct { // The unique identifier for this key. ID *string `json:"id" validate:"required"` - // The user-defined name for this key. + // The name for this key. The name is unique across all keys in the region. Name *string `json:"name" validate:"required"` } @@ -46953,7 +46986,7 @@ type LoadBalancer struct { // The logging configuration for this load balancer. Logging *LoadBalancerLogging `json:"logging" validate:"required"` - // The unique user-defined name for this load balancer. + // The name for this load balancer. The name is unique across all load balancers in the VPC. Name *string `json:"name" validate:"required"` // The operating status of this load balancer. @@ -47766,7 +47799,8 @@ type LoadBalancerListenerPolicy struct { // The policy's unique identifier. ID *string `json:"id" validate:"required"` - // The user-defined name for this policy. + // The name for this load balancer listener policy. The name is unique across all policies for the load balancer + // listener. Name *string `json:"name" validate:"required"` // Priority of the policy. Lower value indicates higher priority. @@ -47877,7 +47911,7 @@ func UnmarshalLoadBalancerListenerPolicyCollection(m map[string]json.RawMessage, // LoadBalancerListenerPolicyPatch : LoadBalancerListenerPolicyPatch struct type LoadBalancerListenerPolicyPatch struct { - // The user-defined name for this policy. Names must be unique within the load balancer listener the policy resides in. + // The name for this policy. The name must not be used by another policy for the load balancer listener. Name *string `json:"name,omitempty"` // Priority of the policy. Lower value indicates higher priority. @@ -47928,7 +47962,8 @@ type LoadBalancerListenerPolicyPrototype struct { // unexpected property value was encountered. Action *string `json:"action" validate:"required"` - // The user-defined name for this policy. Names must be unique within the load balancer listener the policy resides in. + // The name for this policy. The name must not be used by another policy for the load balancer listener. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // Priority of the policy. Lower value indicates higher priority. @@ -48005,6 +48040,8 @@ type LoadBalancerListenerPolicyReference struct { // The policy's unique identifier. ID *string `json:"id" validate:"required"` + + Name interface{} `json:"name" validate:"required"` } // UnmarshalLoadBalancerListenerPolicyReference unmarshals an instance of LoadBalancerListenerPolicyReference from the specified map of raw messages. @@ -48022,6 +48059,10 @@ func UnmarshalLoadBalancerListenerPolicyReference(m map[string]json.RawMessage, if err != nil { return } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -48403,7 +48444,7 @@ type LoadBalancerListenerPolicyTarget struct { // The unique identifier for this load balancer pool. ID *string `json:"id,omitempty"` - // The user-defined name for this load balancer pool. + // The name for this load balancer pool. The name is unique across all pools for the load balancer. Name *string `json:"name,omitempty"` // The HTTP status code for this redirect. @@ -48843,7 +48884,7 @@ type LoadBalancerPatch struct { // To activate logging, the load balancer profile must support the specified logging type. Logging *LoadBalancerLogging `json:"logging,omitempty"` - // The unique user-defined name for this load balancer. + // The name for this load balancer. The name must not be used by another load balancer in the VPC. Name *string `json:"name,omitempty"` // The subnets to provision this load balancer in. The load balancer's availability will depend on the availability of @@ -48908,7 +48949,7 @@ type LoadBalancerPool struct { // The backend server members of the pool. Members []LoadBalancerPoolMemberReference `json:"members,omitempty"` - // The user-defined name for this load balancer pool. + // The name for this load balancer pool. The name is unique across all pools for the load balancer. Name *string `json:"name" validate:"required"` // The protocol for this load balancer pool. @@ -49325,7 +49366,7 @@ func UnmarshalLoadBalancerPoolIdentity(m map[string]json.RawMessage, result inte // LoadBalancerPoolIdentityByName : LoadBalancerPoolIdentityByName struct type LoadBalancerPoolIdentityByName struct { - // The user-defined name for this load balancer pool. + // The name for this load balancer pool. The name is unique across all pools for the load balancer. Name *string `json:"name" validate:"required"` } @@ -49641,7 +49682,7 @@ type LoadBalancerPoolMemberTarget struct { // The unique identifier for this virtual server instance. ID *string `json:"id,omitempty"` - // The user-defined name for this virtual server instance (and default system hostname). + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. Name *string `json:"name,omitempty"` // The IP address. @@ -49754,7 +49795,7 @@ type LoadBalancerPoolPatch struct { // The health monitor of this pool. HealthMonitor *LoadBalancerPoolHealthMonitorPatch `json:"health_monitor,omitempty"` - // The user-defined name for this load balancer pool. + // The name for this load balancer pool. The name must not be used by another pool for the load balancer. Name *string `json:"name,omitempty"` // The protocol for this load balancer pool. @@ -49869,8 +49910,8 @@ type LoadBalancerPoolPrototype struct { // tuple cannot be shared by a pool member of any other load balancer in the same VPC. Members []LoadBalancerPoolMemberPrototype `json:"members,omitempty"` - // The user-defined name for this load balancer pool. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this load balancer pool. The name must not be used by another pool for the load balancer. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if @@ -49980,7 +50021,7 @@ type LoadBalancerPoolReference struct { // The unique identifier for this load balancer pool. ID *string `json:"id" validate:"required"` - // The user-defined name for this load balancer pool. + // The name for this load balancer pool. The name is unique across all pools for the load balancer. Name *string `json:"name" validate:"required"` } @@ -50160,7 +50201,7 @@ type LoadBalancerPrivateIpsItem struct { // The unique identifier for this reserved IP. ID *string `json:"id" validate:"required"` - // The user-defined or system-provided name for this reserved IP. + // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. Name *string `json:"name" validate:"required"` // The resource type. @@ -50641,7 +50682,7 @@ type NetworkACL struct { // The unique identifier for this network ACL. ID *string `json:"id" validate:"required"` - // The user-defined name for this network ACL. + // The name for this network ACL. The name is unique across all network ACLs for the VPC. Name *string `json:"name" validate:"required"` // The resource group for this network ACL. @@ -50837,7 +50878,7 @@ func UnmarshalNetworkACLIdentity(m map[string]json.RawMessage, result interface{ // NetworkACLPatch : NetworkACLPatch struct type NetworkACLPatch struct { - // The user-defined name for this network ACL. Names must be unique within the VPC the network ACL resides in. + // The name for this network ACL. The name must not be used by another network ACL for the VPC. Name *string `json:"name,omitempty"` } @@ -50867,8 +50908,8 @@ func (networkACLPatch *NetworkACLPatch) AsPatch() (_patch map[string]interface{} // - NetworkACLPrototypeNetworkACLByRules // - NetworkACLPrototypeNetworkACLBySourceNetworkACL type NetworkACLPrototype struct { - // The user-defined name for this network ACL. Names must be unique within the VPC the network ACL resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this network ACL. The name must not be used by another network ACL for the VPC. 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 @@ -50936,7 +50977,7 @@ type NetworkACLReference struct { // The unique identifier for this network ACL. ID *string `json:"id" validate:"required"` - // The user-defined name for this network ACL. + // The name for this network ACL. The name is unique across all network ACLs for the VPC. Name *string `json:"name" validate:"required"` } @@ -51015,7 +51056,7 @@ type NetworkACLRule struct { // The IP version for this rule. IPVersion *string `json:"ip_version" validate:"required"` - // The user-defined name for this network ACL rule. + // The name for this network ACL rule. The name is unique across all rules for the network ACL. Name *string `json:"name" validate:"required"` // The protocol to enforce. @@ -51308,7 +51349,7 @@ type NetworkACLRuleItem struct { // The IP version for this rule. IPVersion *string `json:"ip_version" validate:"required"` - // The user-defined name for this network ACL rule. + // The name for this network ACL rule. The name is unique across all rules for the network ACL. Name *string `json:"name" validate:"required"` // The protocol to enforce. @@ -51429,7 +51470,7 @@ type NetworkACLRulePatch struct { // The direction of traffic to match. Direction *string `json:"direction,omitempty"` - // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. Name *string `json:"name,omitempty"` // The protocol to enforce. @@ -51560,8 +51601,8 @@ type NetworkACLRulePrototype struct { // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` - // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The protocol to enforce. @@ -51666,8 +51707,8 @@ type NetworkACLRulePrototypeNetworkACLContext struct { // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` - // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The protocol to enforce. @@ -51769,7 +51810,7 @@ type NetworkACLRuleReference struct { // The unique identifier for this network ACL rule. ID *string `json:"id" validate:"required"` - // The user-defined name for this network ACL rule. + // The name for this network ACL rule. The name is unique across all rules for the network ACL. Name *string `json:"name" validate:"required"` } @@ -51832,7 +51873,7 @@ type NetworkInterface struct { // The unique identifier for this network interface. ID *string `json:"id" validate:"required"` - // The user-defined name for this network interface. + // The name for this network interface. Name *string `json:"name" validate:"required"` // The network interface port speed in Mbps. @@ -51949,7 +51990,7 @@ type NetworkInterfaceBareMetalServerContextReference struct { // The unique identifier for this network interface. ID *string `json:"id" validate:"required"` - // The user-defined name for this network interface. + // The name for this network interface. Name *string `json:"name" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -52040,9 +52081,9 @@ type NetworkInterfaceIPPrototype struct { // `target` is deleted, or the reserved IP is unbound. AutoDelete *bool `json:"auto_delete,omitempty"` - // The user-defined name for this reserved IP. If unspecified, the name will be a hyphenated list of randomly-selected - // words. Names must be unique within the subnet the reserved IP resides in. Names beginning with `ibm-` are reserved - // for provider-owned resources. + // The name for this reserved IP. The name must not be used by another reserved IP in the 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"` } @@ -52093,7 +52134,7 @@ type NetworkInterfaceInstanceContextReference struct { // The unique identifier for this network interface. ID *string `json:"id" validate:"required"` - // The user-defined name for this network interface. + // The name for this network interface. Name *string `json:"name" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -52170,8 +52211,8 @@ type NetworkInterfacePatch struct { // interface. If true, source IP spoofing is allowed on this interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // The user-defined name for network interface. Names must be unique within the instance the network interface resides - // in. + // The name for network interface. The name must not be used by another network interface on the virtual server + // instance. Name *string `json:"name,omitempty"` } @@ -52206,8 +52247,8 @@ type NetworkInterfacePrototype struct { // interface. If true, source IP spoofing is allowed on this interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // The user-defined name for network interface. Names must be unique within the instance the network interface resides - // in. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for network interface. The name must not be used by another network interface on the virtual server + // instance. 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 network interface. This can be specified using @@ -52541,7 +52582,7 @@ type PlacementGroup struct { // The lifecycle state of the placement group. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The user-defined name for this placement group. + // The name for this placement group. The name is unique across all placement groups in the region. Name *string `json:"name" validate:"required"` // The resource group for this placement group. @@ -52728,7 +52769,7 @@ func UnmarshalPlacementGroupCollectionNext(m map[string]json.RawMessage, result // PlacementGroupPatch : PlacementGroupPatch struct type PlacementGroupPatch struct { - // The user-defined name for this placement group. + // The name for this placement group. The name must not be used by another placement group in the region. Name *string `json:"name,omitempty"` } @@ -52788,7 +52829,7 @@ type PublicGateway struct { // The unique identifier for this public gateway. ID *string `json:"id" validate:"required"` - // The user-defined name for this public gateway. + // The name for this public gateway. The name is unique across all public gateways in the VPC. Name *string `json:"name" validate:"required"` // The resource group for this public gateway. @@ -52983,7 +53024,7 @@ type PublicGatewayFloatingIP struct { // The unique identifier for this floating IP. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this floating IP. + // The name for this floating IP. The name is unique across all floating IPs in the region. Name *string `json:"name" validate:"required"` } @@ -53035,8 +53076,8 @@ type PublicGatewayFloatingIPPrototype struct { // The globally unique IP address. Address *string `json:"address,omitempty"` - // The unique user-defined name for this floating IP. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this floating IP. The name must not be used by another floating IP in the region. 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 @@ -53128,7 +53169,7 @@ func UnmarshalPublicGatewayIdentity(m map[string]json.RawMessage, result interfa // PublicGatewayPatch : PublicGatewayPatch struct type PublicGatewayPatch struct { - // The user-defined name for this public gateway. Names must be unique within the VPC the public gateway resides in. + // The name for this public gateway. The name must not be used by another public gateway in the VPC. Name *string `json:"name,omitempty"` } @@ -53168,7 +53209,7 @@ type PublicGatewayReference struct { // The unique identifier for this public gateway. ID *string `json:"id" validate:"required"` - // The user-defined name for this public gateway. + // The name for this public gateway. The name is unique across all public gateways in the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -53717,7 +53758,7 @@ type ReservedIP struct { // The lifecycle state of the reserved IP. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The user-defined or system-provided name for this reserved IP. + // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. Name *string `json:"name" validate:"required"` // The owner of the reserved IP. @@ -54086,8 +54127,8 @@ type ReservedIPPatch struct { // `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound. AutoDelete *bool `json:"auto_delete,omitempty"` - // The user-defined name for this reserved IP. Names must be unique within the subnet the reserved IP resides in. Names - // beginning with `ibm-` are reserved for provider-owned resources. + // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with + // `ibm-` are reserved for provider-owned resources, and are not allowed. Name *string `json:"name,omitempty"` } @@ -54137,7 +54178,7 @@ type ReservedIPReference struct { // The unique identifier for this reserved IP. ID *string `json:"id" validate:"required"` - // The user-defined or system-provided name for this reserved IP. + // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. Name *string `json:"name" validate:"required"` // The resource type. @@ -54223,7 +54264,7 @@ type ReservedIPTarget struct { // The unique identifier for this endpoint gateway. ID *string `json:"id,omitempty"` - // The unique user-defined name for this endpoint gateway. + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. Name *string `json:"name,omitempty"` // The resource type. @@ -54374,7 +54415,7 @@ type ResourceGroupReference struct { // The unique identifier for this resource group. ID *string `json:"id" validate:"required"` - // The user-defined name for this resource group. + // The name for this resource group. Name *string `json:"name" validate:"required"` } @@ -54454,7 +54495,7 @@ type Route struct { // The lifecycle state of the route. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The user-defined name for this route. + // 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 @@ -54676,7 +54717,7 @@ type RouteCreator struct { // The unique identifier for this VPN gateway. ID *string `json:"id,omitempty"` - // The user-defined name for this VPN gateway. + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. Name *string `json:"name,omitempty"` // The resource type. @@ -54750,7 +54791,7 @@ type RouteNextHop struct { // The unique identifier for this VPN gateway connection. ID *string `json:"id,omitempty"` - // The user-defined name for this VPN connection. + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. Name *string `json:"name,omitempty"` // The resource type. @@ -54804,7 +54845,8 @@ func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (er // RoutePatch : RoutePatch struct type RoutePatch struct { - // The user-defined name for this route. Names must be unique within the VPC routing table the route resides in. + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` + // are reserved for system-provided routes, and are not allowed. Name *string `json:"name,omitempty"` } @@ -54842,8 +54884,9 @@ type RoutePrototype struct { // both routes have an `action` of `deliver` and the `next_hop` is an IP address. Destination *string `json:"destination" validate:"required"` - // The user-defined name for this route. If unspecified, the name will be a hyphenated list of randomly-selected words. - // Names must be unique within the VPC routing table the route resides in. + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` + // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. Name *string `json:"name,omitempty"` // If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` @@ -54964,7 +55007,7 @@ type RouteReference struct { // The unique identifier for this route. ID *string `json:"id" validate:"required"` - // The user-defined name for this route. + // The name for this route. The name is unique across all routes in the routing table. Name *string `json:"name" validate:"required"` } @@ -55032,7 +55075,7 @@ type RoutingTable struct { // The lifecycle state of the routing table. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The user-defined name for this routing table. + // The name for this routing table. The name is unique across all routing tables for the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -55302,7 +55345,7 @@ type RoutingTablePatch struct { // support is expected to expand in the future. AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` - // The user-defined name for this routing table. Names must be unique within the VPC the routing table resides in. + // The name for this routing table. The name must not be used by another routing table in the VPC. Name *string `json:"name,omitempty"` // Indicates whether this routing table is used to route traffic that originates from @@ -55409,7 +55452,7 @@ type RoutingTableReference struct { // The unique identifier for this routing table. ID *string `json:"id" validate:"required"` - // The user-defined name for this routing table. + // The name for this routing table. The name is unique across all routing tables for the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -55481,7 +55524,7 @@ type SecurityGroup struct { // The unique identifier for this security group. ID *string `json:"id" validate:"required"` - // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + // The name for this security group. The name is unique across all security groups for the VPC. Name *string `json:"name" validate:"required"` // The resource group for this security group. @@ -55677,7 +55720,7 @@ func UnmarshalSecurityGroupIdentity(m map[string]json.RawMessage, result interfa // SecurityGroupPatch : SecurityGroupPatch struct type SecurityGroupPatch struct { - // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + // The name for this security group. The name must not be used by another security group for the VPC. Name *string `json:"name,omitempty"` } @@ -55717,7 +55760,7 @@ type SecurityGroupReference struct { // The unique identifier for this security group. ID *string `json:"id" validate:"required"` - // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + // The name for this security group. The name is unique across all security groups for the VPC. Name *string `json:"name" validate:"required"` } @@ -56121,7 +56164,7 @@ type SecurityGroupRuleRemote struct { // The unique identifier for this security group. ID *string `json:"id,omitempty"` - // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + // The name for this security group. The name is unique across all security groups for the VPC. Name *string `json:"name,omitempty"` } @@ -56411,7 +56454,7 @@ type SecurityGroupTargetReference struct { // The unique identifier for this network interface. ID *string `json:"id,omitempty"` - // The user-defined name for this network interface. + // The name for this network interface. Name *string `json:"name,omitempty"` // The resource type. @@ -56525,6 +56568,7 @@ type Snapshot struct { CRN *string `json:"crn" validate:"required"` // Indicates whether this snapshot can be deleted. This value will always be `true`. + // Deprecated: this field is deprecated and may be removed in a future release. Deletable *bool `json:"deletable" validate:"required"` // The type of encryption used on the source volume. @@ -56549,7 +56593,7 @@ type Snapshot struct { // capacity of the `source_volume`. MinimumCapacity *int64 `json:"minimum_capacity" validate:"required"` - // The user-defined name for this snapshot. + // The name for this snapshot. The name is unique across all snapshots in the region. Name *string `json:"name" validate:"required"` // The operating system included in this image. @@ -56833,7 +56877,7 @@ func UnmarshalSnapshotIdentity(m map[string]json.RawMessage, result interface{}) // SnapshotPatch : SnapshotPatch struct type SnapshotPatch struct { - // The user-defined name for this snapshot. + // The name for this snapshot. The name must not be used by another snapshot in the region. Name *string `json:"name,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. @@ -56869,8 +56913,8 @@ func (snapshotPatch *SnapshotPatch) AsPatch() (_patch map[string]interface{}, er // Models which "extend" this model: // - SnapshotPrototypeSnapshotBySourceVolume type SnapshotPrototype struct { - // The unique user-defined name for this snapshot. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this snapshot. The name must not be used by another snapshot in the region. 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 @@ -56930,7 +56974,7 @@ type SnapshotReference struct { // The unique identifier for this snapshot. ID *string `json:"id" validate:"required"` - // The user-defined name for this snapshot. + // The name for this snapshot. The name is unique across all snapshots in the region. Name *string `json:"name" validate:"required"` // The resource type. @@ -57093,7 +57137,7 @@ type Subnet struct { // The IPv4 range of the subnet, expressed in CIDR format. Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` - // The user-defined name for this subnet. + // The name for this subnet. The name is unique across all subnets in the VPC. Name *string `json:"name" validate:"required"` // The network ACL for this subnet. @@ -57360,7 +57404,7 @@ func UnmarshalSubnetIdentity(m map[string]json.RawMessage, result interface{}) ( // SubnetPatch : SubnetPatch struct type SubnetPatch struct { - // The user-defined name for this subnet. Names must be unique within the VPC the subnet resides in. + // The name for this subnet. The name must not be used by another subnet in the VPC. Name *string `json:"name,omitempty"` // The network ACL to use for this subnet. @@ -57416,8 +57460,8 @@ type SubnetPrototype struct { // The IP version(s) to support for this subnet. IPVersion *string `json:"ip_version,omitempty"` - // The user-defined name for this subnet. Names must be unique within the VPC the subnet resides in. If unspecified, - // the name will be a hyphenated list of randomly-selected words. + // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a + // hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The network ACL to use for this subnet. @@ -57574,7 +57618,7 @@ type SubnetReference struct { // The unique identifier for this subnet. ID *string `json:"id" validate:"required"` - // The user-defined name for this subnet. + // The name for this subnet. The name is unique across all subnets in the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -60082,7 +60126,7 @@ type VPC struct { // The unique identifier for this VPC. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this VPC. + // The name for this VPC. The name is unique across all VPCs in the region. Name *string `json:"name" validate:"required"` // The resource group for this VPC. @@ -60330,7 +60374,7 @@ func UnmarshalVPCIdentity(m map[string]json.RawMessage, result interface{}) (err // VPCPatch : VPCPatch struct type VPCPatch struct { - // The unique user-defined name for this VPC. + // The name for this VPC. The name must not be used by another VPC in the region. Name *string `json:"name,omitempty"` } @@ -60370,7 +60414,7 @@ type VPCReference struct { // The unique identifier for this VPC. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this VPC. + // The name for this VPC. The name is unique across all VPCs in the region. Name *string `json:"name" validate:"required"` // The resource type. @@ -60455,7 +60499,7 @@ type VPNGateway struct { // Collection of VPN gateway members. Members []VPNGatewayMember `json:"members" validate:"required"` - // The user-defined name for this VPN gateway. + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. Name *string `json:"name" validate:"required"` // The resource group for this VPN gateway. @@ -60690,7 +60734,7 @@ type VPNGatewayConnection struct { // The mode of the VPN gateway. Mode *string `json:"mode" validate:"required"` - // The user-defined name for this VPN gateway connection. + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. Name *string `json:"name" validate:"required"` // The IP address of the peer VPN gateway. @@ -61153,7 +61197,7 @@ type VPNGatewayConnectionPatch struct { // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). IpsecPolicy VPNGatewayConnectionIPsecPolicyPatchIntf `json:"ipsec_policy,omitempty"` - // The user-defined name for this VPN gateway connection. + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. Name *string `json:"name,omitempty"` // The IP address of the peer VPN gateway. @@ -61265,7 +61309,8 @@ type VPNGatewayConnectionPrototype struct { // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` - // The user-defined name for this VPN gateway connection. + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The IP address of the peer VPN gateway. @@ -61357,7 +61402,7 @@ type VPNGatewayConnectionReference struct { // The unique identifier for this VPN gateway connection. ID *string `json:"id" validate:"required"` - // The user-defined name for this VPN connection. + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. Name *string `json:"name" validate:"required"` // The resource type. @@ -61504,7 +61549,7 @@ func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) // VPNGatewayPatch : VPNGatewayPatch struct type VPNGatewayPatch struct { - // The user-defined name for this VPN gateway. + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. Name *string `json:"name,omitempty"` } @@ -61534,7 +61579,8 @@ func (vpnGatewayPatch *VPNGatewayPatch) AsPatch() (_patch map[string]interface{} // - VPNGatewayPrototypeVPNGatewayRouteModePrototype // - VPNGatewayPrototypeVPNGatewayPolicyModePrototype type VPNGatewayPrototype struct { - // The user-defined name for this VPN gateway. + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. 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 @@ -61661,7 +61707,7 @@ type VPNServer struct { // The lifecycle state of the VPN server. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The unique user-defined name for this VPN server. + // The name for this VPN server. The name is unique across all VPN servers in the VPC. Name *string `json:"name" validate:"required"` // The port number used by this VPN server. @@ -62322,7 +62368,7 @@ type VPNServerPatch struct { // Indicates whether the split tunneling is enabled on this VPN server. EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"` - // The user-defined name for this VPN server. Names must be unique within the VPC this VPN server is serving. + // The name for this VPN server. The name must not be used by another VPN server in the VPC. Name *string `json:"name,omitempty"` // The port number used by this VPN server. @@ -62445,7 +62491,7 @@ type VPNServerRoute struct { // The lifecycle state of the VPN route. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The user-defined name for this VPN route. + // The name for this VPN route. The name is unique across all routes for a VPN server. Name *string `json:"name" validate:"required"` // The resource type. @@ -62618,7 +62664,7 @@ func UnmarshalVPNServerRouteCollectionNext(m map[string]json.RawMessage, result // VPNServerRoutePatch : VPNServerRoutePatch struct type VPNServerRoutePatch struct { - // The user-defined name for this VPN route. Names must be unique within the VPN server the VPN route resides in. + // The name for this VPN server route. The name must not be used by another route for the VPN server. Name *string `json:"name,omitempty"` } @@ -62684,7 +62730,7 @@ type Volume struct { // `family` of `custom`. Iops *int64 `json:"iops" validate:"required"` - // The unique user-defined name for this volume. + // The name for this volume. The name is unique across all volumes in the region. Name *string `json:"name" validate:"required"` // The operating system associated with this volume. If absent, this volume was not @@ -62856,7 +62902,7 @@ type VolumeAttachment struct { // The date and time that the volume was attached. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // If set to true, when deleting the instance the volume will also be deleted. + // Indicates whether deleting the instance will also delete the attached volume. DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete" validate:"required"` // Information about how the volume is exposed to the instance operating system. @@ -62870,7 +62916,7 @@ type VolumeAttachment struct { // The unique identifier for this volume attachment. ID *string `json:"id" validate:"required"` - // The user-defined name for this volume attachment. + // The name for this volume attachment. The name is unique across all volume attachments on the instance. Name *string `json:"name" validate:"required"` // The status of this volume attachment. @@ -62984,11 +63030,10 @@ func UnmarshalVolumeAttachmentDevice(m map[string]json.RawMessage, result interf // VolumeAttachmentPatch : VolumeAttachmentPatch struct type VolumeAttachmentPatch struct { - // If set to true, when deleting the instance the volume will also be deleted. + // Indicates whether deleting the instance will also delete the attached volume. DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - // The user-defined name for this volume attachment. Names must be unique within the instance the volume attachment - // resides in. + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. Name *string `json:"name,omitempty"` } @@ -63017,31 +63062,31 @@ func (volumeAttachmentPatch *VolumeAttachmentPatch) AsPatch() (_patch map[string return } -// VolumeAttachmentPrototypeInstanceByImageContext : VolumeAttachmentPrototypeInstanceByImageContext struct -type VolumeAttachmentPrototypeInstanceByImageContext struct { - // If set to true, when deleting the instance the volume will also be deleted. +// VolumeAttachmentPrototype : VolumeAttachmentPrototype struct +type VolumeAttachmentPrototype struct { + // Indicates whether deleting the instance will also delete the attached volume. DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - // The user-defined name for this volume attachment. Names must be unique within the instance the volume attachment - // resides in. + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // A prototype object for a new volume. - Volume *VolumePrototypeInstanceByImageContext `json:"volume" validate:"required"` + // An existing volume to attach to the instance, or a prototype object for a new volume. + Volume VolumeAttachmentPrototypeVolumeIntf `json:"volume" validate:"required"` } -// NewVolumeAttachmentPrototypeInstanceByImageContext : Instantiate VolumeAttachmentPrototypeInstanceByImageContext (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByImageContext(volume *VolumePrototypeInstanceByImageContext) (_model *VolumeAttachmentPrototypeInstanceByImageContext, err error) { - _model = &VolumeAttachmentPrototypeInstanceByImageContext{ +// NewVolumeAttachmentPrototype : Instantiate VolumeAttachmentPrototype (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototype(volume VolumeAttachmentPrototypeVolumeIntf) (_model *VolumeAttachmentPrototype, err error) { + _model = &VolumeAttachmentPrototype{ Volume: volume, } err = core.ValidateStruct(_model, "required parameters") return } -// UnmarshalVolumeAttachmentPrototypeInstanceByImageContext unmarshals an instance of VolumeAttachmentPrototypeInstanceByImageContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeInstanceByImageContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeInstanceByImageContext) +// UnmarshalVolumeAttachmentPrototype unmarshals an instance of VolumeAttachmentPrototype from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototype) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { return @@ -63050,7 +63095,7 @@ func UnmarshalVolumeAttachmentPrototypeInstanceByImageContext(m map[string]json. if err != nil { return } - err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceByImageContext) + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeAttachmentPrototypeVolume) if err != nil { return } @@ -63058,31 +63103,31 @@ func UnmarshalVolumeAttachmentPrototypeInstanceByImageContext(m map[string]json. return } -// VolumeAttachmentPrototypeInstanceBySourceSnapshotContext : VolumeAttachmentPrototypeInstanceBySourceSnapshotContext struct -type VolumeAttachmentPrototypeInstanceBySourceSnapshotContext struct { - // If set to true, when deleting the instance the volume will also be deleted. +// VolumeAttachmentPrototypeInstanceByImageContext : VolumeAttachmentPrototypeInstanceByImageContext struct +type VolumeAttachmentPrototypeInstanceByImageContext struct { + // Indicates whether deleting the instance will also delete the attached volume. DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - // The user-defined name for this volume attachment. Names must be unique within the instance the volume attachment - // resides in. + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // A prototype object for a new volume from a snapshot. - Volume *VolumePrototypeInstanceBySourceSnapshotContext `json:"volume" validate:"required"` + // A prototype object for a new volume. + Volume *VolumePrototypeInstanceByImageContext `json:"volume" validate:"required"` } -// NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext : Instantiate VolumeAttachmentPrototypeInstanceBySourceSnapshotContext (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(volume *VolumePrototypeInstanceBySourceSnapshotContext) (_model *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, err error) { - _model = &VolumeAttachmentPrototypeInstanceBySourceSnapshotContext{ +// NewVolumeAttachmentPrototypeInstanceByImageContext : Instantiate VolumeAttachmentPrototypeInstanceByImageContext (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByImageContext(volume *VolumePrototypeInstanceByImageContext) (_model *VolumeAttachmentPrototypeInstanceByImageContext, err error) { + _model = &VolumeAttachmentPrototypeInstanceByImageContext{ Volume: volume, } err = core.ValidateStruct(_model, "required parameters") return } -// UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext unmarshals an instance of VolumeAttachmentPrototypeInstanceBySourceSnapshotContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeInstanceBySourceSnapshotContext) +// UnmarshalVolumeAttachmentPrototypeInstanceByImageContext unmarshals an instance of VolumeAttachmentPrototypeInstanceByImageContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeInstanceByImageContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeInstanceByImageContext) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { return @@ -63091,7 +63136,7 @@ func UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(m map[str if err != nil { return } - err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceBySourceSnapshotContext) + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceByImageContext) if err != nil { return } @@ -63099,31 +63144,31 @@ func UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(m map[str return } -// VolumeAttachmentPrototypeInstanceContext : VolumeAttachmentPrototypeInstanceContext struct -type VolumeAttachmentPrototypeInstanceContext struct { - // If set to true, when deleting the instance the volume will also be deleted. +// VolumeAttachmentPrototypeInstanceBySourceSnapshotContext : VolumeAttachmentPrototypeInstanceBySourceSnapshotContext struct +type VolumeAttachmentPrototypeInstanceBySourceSnapshotContext struct { + // Indicates whether deleting the instance will also delete the attached volume. DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - // The user-defined name for this volume attachment. Names must be unique within the instance the volume attachment - // resides in. + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // An existing volume to attach to the instance, or a prototype object for a new volume. - Volume VolumeAttachmentVolumePrototypeInstanceContextIntf `json:"volume" validate:"required"` + // A prototype object for a new volume from a snapshot. + Volume *VolumePrototypeInstanceBySourceSnapshotContext `json:"volume" validate:"required"` } -// NewVolumeAttachmentPrototypeInstanceContext : Instantiate VolumeAttachmentPrototypeInstanceContext (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeInstanceContext(volume VolumeAttachmentVolumePrototypeInstanceContextIntf) (_model *VolumeAttachmentPrototypeInstanceContext, err error) { - _model = &VolumeAttachmentPrototypeInstanceContext{ +// NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext : Instantiate VolumeAttachmentPrototypeInstanceBySourceSnapshotContext (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(volume *VolumePrototypeInstanceBySourceSnapshotContext) (_model *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, err error) { + _model = &VolumeAttachmentPrototypeInstanceBySourceSnapshotContext{ Volume: volume, } err = core.ValidateStruct(_model, "required parameters") return } -// UnmarshalVolumeAttachmentPrototypeInstanceContext unmarshals an instance of VolumeAttachmentPrototypeInstanceContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeInstanceContext) +// UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext unmarshals an instance of VolumeAttachmentPrototypeInstanceBySourceSnapshotContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeInstanceBySourceSnapshotContext) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { return @@ -63132,7 +63177,7 @@ func UnmarshalVolumeAttachmentPrototypeInstanceContext(m map[string]json.RawMess if err != nil { return } - err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeAttachmentVolumePrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceBySourceSnapshotContext) if err != nil { return } @@ -63158,7 +63203,8 @@ type VolumeAttachmentPrototypeVolume struct { // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` - // The unique user-defined name for this volume. + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to @@ -63253,7 +63299,7 @@ type VolumeAttachmentReferenceInstanceContext struct { // The unique identifier for this volume attachment. ID *string `json:"id" validate:"required"` - // The user-defined name for this volume attachment. + // The name for this volume attachment. The name is unique across all volume attachments on the instance. Name *string `json:"name" validate:"required"` // The attached volume. @@ -63313,7 +63359,7 @@ func UnmarshalVolumeAttachmentReferenceInstanceContextDeleted(m map[string]json. // VolumeAttachmentReferenceVolumeContext : VolumeAttachmentReferenceVolumeContext struct type VolumeAttachmentReferenceVolumeContext struct { - // If set to true, when deleting the instance the volume will also be deleted. + // Indicates whether deleting the instance will also delete the attached volume. DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete" validate:"required"` // If present, this property indicates the referenced resource has been deleted, and provides @@ -63334,7 +63380,7 @@ type VolumeAttachmentReferenceVolumeContext struct { // The attached instance. Instance *InstanceReference `json:"instance" validate:"required"` - // The user-defined name for this volume attachment. + // The name for this volume attachment. The name is unique across all volume attachments on the instance. Name *string `json:"name" validate:"required"` // The type of volume attachment. @@ -63405,102 +63451,6 @@ func UnmarshalVolumeAttachmentReferenceVolumeContextDeleted(m map[string]json.Ra return } -// VolumeAttachmentVolumePrototypeInstanceContext : An existing volume to attach to the instance, or a prototype object for a new volume. -// Models which "extend" this model: -// - VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity -// - VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext -type VolumeAttachmentVolumePrototypeInstanceContext struct { - // The unique identifier for this volume. - ID *string `json:"id,omitempty"` - - // The CRN for this volume. - CRN *string `json:"crn,omitempty"` - - // The URL for this volume. - Href *string `json:"href,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The unique user-defined name for this volume. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to - // use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` -} - -func (*VolumeAttachmentVolumePrototypeInstanceContext) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { - return true -} - -type VolumeAttachmentVolumePrototypeInstanceContextIntf interface { - isaVolumeAttachmentVolumePrototypeInstanceContext() bool -} - -// UnmarshalVolumeAttachmentVolumePrototypeInstanceContext unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentVolumePrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentVolumePrototypeInstanceContext) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VolumeCollection : VolumeCollection struct type VolumeCollection struct { // A link to the first page of resources. @@ -63642,7 +63592,7 @@ type VolumePatch struct { // `family` of `custom`. The volume must be attached as a data volume to a running virtual server instance. Iops *int64 `json:"iops,omitempty"` - // The unique user-defined name for this volume. + // The name for this volume. The name must not be used by another volume in the region. Name *string `json:"name,omitempty"` // The profile to use for this volume. The requested profile must be in the same @@ -63898,7 +63848,8 @@ type VolumePrototype struct { // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` - // The unique user-defined name for this volume. + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to @@ -63996,7 +63947,8 @@ type VolumePrototypeInstanceByImageContext struct { // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` - // The unique user-defined name for this volume. + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to @@ -64064,7 +64016,8 @@ type VolumePrototypeInstanceBySourceSnapshotContext struct { // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` - // The unique user-defined name for this volume. + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to @@ -64138,7 +64091,7 @@ type VolumeReference struct { // The unique identifier for this volume. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this volume. + // The name for this volume. The name is unique across all volumes in the region. Name *string `json:"name" validate:"required"` } @@ -64359,7 +64312,7 @@ type BareMetalServerBootTargetBareMetalServerDiskReference struct { // The unique identifier for this bare metal server disk. ID *string `json:"id" validate:"required"` - // The user-defined name for this disk. + // 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. @@ -64487,7 +64440,7 @@ type BareMetalServerNetworkInterfaceByHiperSocket struct { // The MAC address of the interface. If absent, the value is not known. MacAddress *string `json:"mac_address" validate:"required"` - // The user-defined name for this network interface. + // The name for this network interface. Name *string `json:"name" validate:"required"` // The network interface port speed in Mbps. @@ -64654,7 +64607,7 @@ type BareMetalServerNetworkInterfaceByPci struct { // The MAC address of the interface. If absent, the value is not known. MacAddress *string `json:"mac_address" validate:"required"` - // The user-defined name for this network interface. + // The name for this network interface. Name *string `json:"name" validate:"required"` // The network interface port speed in Mbps. @@ -64834,7 +64787,7 @@ type BareMetalServerNetworkInterfaceByVlan struct { // The MAC address of the interface. If absent, the value is not known. MacAddress *string `json:"mac_address" validate:"required"` - // The user-defined name for this network interface. + // The name for this network interface. Name *string `json:"name" validate:"required"` // The network interface port speed in Mbps. @@ -65008,8 +64961,8 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHi // This must be `true` when `interface_type` is `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The user-defined name for network interface. Names must be unique within the instance the network interface resides - // in. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this 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 network interface. This can be specified using an existing reserved IP, or a @@ -65108,8 +65061,8 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc // This must be `true` when `interface_type` is `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The user-defined name for network interface. Names must be unique within the instance the network interface resides - // in. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this 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 network interface. This can be specified using an existing reserved IP, or a @@ -65221,8 +65174,8 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // This must be `true` when `interface_type` is `hipersocket`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The user-defined name for network interface. Names must be unique within the instance the network interface resides - // in. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this 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 network interface. This can be specified using an existing reserved IP, or a @@ -67098,8 +67051,8 @@ type DedicatedHostPrototypeDedicatedHostByGroup struct { // If set to true, instances can be placed on this dedicated host. InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` - // The unique user-defined name for this dedicated host. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, + // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this dedicated host. @@ -67158,8 +67111,8 @@ type DedicatedHostPrototypeDedicatedHostByZone struct { // If set to true, instances can be placed on this dedicated host. InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` - // The unique user-defined name for this dedicated host. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, + // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this dedicated host. @@ -67304,9 +67257,9 @@ type EndpointGatewayReservedIPReservedIPPrototypeTargetContext struct { // `target` is deleted, or the reserved IP is unbound. AutoDelete *bool `json:"auto_delete,omitempty"` - // The user-defined name for this reserved IP. If unspecified, the name will be a hyphenated list of randomly-selected - // words. Names must be unique within the subnet the reserved IP resides in. Names beginning with `ibm-` are reserved - // for provider-owned resources. + // The name for this reserved IP. The name must not be used by another reserved IP in the 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"` // The subnet in which to create this reserved IP. @@ -67580,8 +67533,8 @@ func UnmarshalFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentity // FloatingIPPrototypeFloatingIPByTarget : FloatingIPPrototypeFloatingIPByTarget struct // This model "extends" FloatingIPPrototype type FloatingIPPrototypeFloatingIPByTarget struct { - // The unique user-defined name for this floating IP. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the + // name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -67625,8 +67578,8 @@ func UnmarshalFloatingIPPrototypeFloatingIPByTarget(m map[string]json.RawMessage // FloatingIPPrototypeFloatingIPByZone : FloatingIPPrototypeFloatingIPByZone struct // This model "extends" FloatingIPPrototype type FloatingIPPrototypeFloatingIPByZone struct { - // The unique user-defined name for this floating IP. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the + // name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -67742,7 +67695,7 @@ type FloatingIPTargetNetworkInterfaceReference struct { // The unique identifier for this network interface. ID *string `json:"id" validate:"required"` - // The user-defined name for this network interface. + // The name for this network interface. Name *string `json:"name" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -67808,7 +67761,7 @@ type FloatingIPTargetPublicGatewayReference struct { // The unique identifier for this public gateway. ID *string `json:"id" validate:"required"` - // The user-defined name for this public gateway. + // The name for this public gateway. The name is unique across all public gateways in the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -68060,7 +68013,7 @@ type FlowLogCollectorTargetInstanceReference struct { // The unique identifier for this virtual server instance. ID *string `json:"id" validate:"required"` - // The user-defined name for this virtual server instance (and default system hostname). + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. Name *string `json:"name" validate:"required"` } @@ -68108,7 +68061,7 @@ type FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct { // The unique identifier for this network interface. ID *string `json:"id" validate:"required"` - // The user-defined name for this network interface. + // The name for this network interface. Name *string `json:"name" validate:"required"` // The resource type. @@ -68168,7 +68121,7 @@ type FlowLogCollectorTargetSubnetReference struct { // The unique identifier for this subnet. ID *string `json:"id" validate:"required"` - // The user-defined name for this subnet. + // The name for this subnet. The name is unique across all subnets in the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -68232,7 +68185,7 @@ type FlowLogCollectorTargetVPCReference struct { // The unique identifier for this VPC. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this VPC. + // The name for this VPC. The name is unique across all VPCs in the region. Name *string `json:"name" validate:"required"` // The resource type. @@ -68376,8 +68329,9 @@ func UnmarshalImageIdentityByID(m map[string]json.RawMessage, result interface{} // ImagePrototypeImageByFile : ImagePrototypeImageByFile struct // This model "extends" ImagePrototype type ImagePrototypeImageByFile struct { - // The unique user-defined name for this image. Names starting with `ibm-` are not allowed. If unspecified, the name - // will be a hyphenated list of randomly-selected words. + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are + // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. Name *string `json:"name,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -68456,8 +68410,9 @@ func UnmarshalImagePrototypeImageByFile(m map[string]json.RawMessage, result int // ImagePrototypeImageBySourceVolume : ImagePrototypeImageBySourceVolume struct // This model "extends" ImagePrototype type ImagePrototypeImageBySourceVolume struct { - // The unique user-defined name for this image. Names starting with `ibm-` are not allowed. If unspecified, the name - // will be a hyphenated list of randomly-selected words. + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are + // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. Name *string `json:"name,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -68583,7 +68538,7 @@ func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(m map[str // - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec // This model "extends" InstanceGroupManagerActionPrototype type InstanceGroupManagerActionPrototypeScheduledActionPrototype struct { - // The user-defined name for this instance group manager action. Names must be unique within the instance group + // The name for this instance group manager action. The name must not be used by another action for the instance group // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -68664,7 +68619,8 @@ type InstanceGroupManagerActionScheduledAction struct { // The unique identifier for this instance group manager action. ID *string `json:"id" validate:"required"` - // The user-defined name for this instance group manager action. + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. Name *string `json:"name" validate:"required"` // The resource type. @@ -68822,7 +68778,7 @@ type InstanceGroupManagerAutoScale struct { // Indicates whether this manager will control the instance group. ManagementEnabled *bool `json:"management_enabled" validate:"required"` - // The user-defined name for this instance group manager. + // The name for this instance group manager. The name is unique across all managers for the instance group. Name *string `json:"name" validate:"required"` // The date and time that the instance group manager was updated. @@ -68915,7 +68871,7 @@ func UnmarshalInstanceGroupManagerAutoScale(m map[string]json.RawMessage, result // InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype : InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype struct // This model "extends" InstanceGroupManagerPolicyPrototype type InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype struct { - // The user-defined name for this instance group manager policy. Names must be unique within the instance group + // The name for this instance group manager policy. The name must not be used by another policy for the instance group // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -68994,7 +68950,8 @@ type InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy struct { // The unique identifier for this instance group manager policy. ID *string `json:"id" validate:"required"` - // The user-defined name for this instance group manager policy. + // The name for this instance group manager policy. The name is unique across all policies for the instance group + // manager. Name *string `json:"name" validate:"required"` // The date and time that the instance group manager policy was updated. @@ -69074,7 +69031,7 @@ type InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype struct // Indicates whether this manager will control the instance group. ManagementEnabled *bool `json:"management_enabled,omitempty"` - // The user-defined name for this instance group manager. Names must be unique within the instance group. If + // The name for this instance group manager. The name must not be used by another manager for the instance group. If // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -69155,7 +69112,7 @@ type InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype struct // Indicates whether this manager will control the instance group. ManagementEnabled *bool `json:"management_enabled,omitempty"` - // The user-defined name for this instance group manager. Names must be unique within the instance group. If + // The name for this instance group manager. The name must not be used by another manager for the instance group. If // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -69216,7 +69173,7 @@ type InstanceGroupManagerScheduled struct { // Indicates whether this manager will control the instance group. ManagementEnabled *bool `json:"management_enabled" validate:"required"` - // The user-defined name for this instance group manager. + // The name for this instance group manager. The name is unique across all managers for the instance group. Name *string `json:"name" validate:"required"` // The date and time that the instance group manager was updated. @@ -69291,7 +69248,7 @@ type InstanceGroupManagerScheduledActionManagerAutoScale struct { // The unique identifier for this instance group manager. ID *string `json:"id" validate:"required"` - // The user-defined name for this instance group manager. + // The name for this instance group manager. The name is unique across all managers for the instance group. Name *string `json:"name" validate:"required"` // The desired maximum number of instance group members at the scheduled time. @@ -69716,7 +69673,7 @@ type InstancePlacementTargetDedicatedHostGroupReference struct { // The unique identifier for this dedicated host group. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this dedicated host group. + // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. Name *string `json:"name" validate:"required"` // The resource type. @@ -69780,7 +69737,7 @@ type InstancePlacementTargetDedicatedHostReference struct { // The unique identifier for this dedicated host. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this dedicated host. + // The name for this dedicated host. The name is unique across all dedicated hosts in the region. Name *string `json:"name" validate:"required"` // The resource type. @@ -69844,7 +69801,7 @@ type InstancePlacementTargetPlacementGroupReference struct { // The unique identifier for this placement group. ID *string `json:"id" validate:"required"` - // The user-defined name for this placement group. + // The name for this placement group. The name is unique across all placement groups in the region. Name *string `json:"name" validate:"required"` // The resource type. @@ -71340,8 +71297,10 @@ type InstancePrototypeInstanceByCatalogOffering struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the - // name will be a hyphenated list of randomly-selected words. + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 additional network interfaces to create for the virtual server instance. @@ -71366,7 +71325,7 @@ type InstancePrototypeInstanceByCatalogOffering struct { UserData *string `json:"user_data,omitempty"` // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the // instance's network interfaces. @@ -71454,7 +71413,7 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } @@ -71509,8 +71468,10 @@ type InstancePrototypeInstanceByImage struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the - // name will be a hyphenated list of randomly-selected words. + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 additional network interfaces to create for the virtual server instance. @@ -71535,7 +71496,7 @@ type InstancePrototypeInstanceByImage struct { UserData *string `json:"user_data,omitempty"` // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the // instance's network interfaces. @@ -71616,7 +71577,7 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } @@ -71671,8 +71632,10 @@ type InstancePrototypeInstanceBySourceSnapshot struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the - // name will be a hyphenated list of randomly-selected words. + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 additional network interfaces to create for the virtual server instance. @@ -71697,7 +71660,7 @@ type InstancePrototypeInstanceBySourceSnapshot struct { UserData *string `json:"user_data,omitempty"` // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the // instance's network interfaces. @@ -71775,7 +71738,7 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } @@ -71826,8 +71789,10 @@ type InstancePrototypeInstanceBySourceTemplate struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the - // name will be a hyphenated list of randomly-selected words. + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 additional network interfaces to create for the virtual server instance. @@ -71852,7 +71817,7 @@ type InstancePrototypeInstanceBySourceTemplate struct { UserData *string `json:"user_data,omitempty"` // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the // instance's network interfaces. @@ -71945,7 +71910,7 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } @@ -72101,8 +72066,8 @@ type InstanceTemplatePrototypeInstanceByCatalogOffering struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the - // name will be a hyphenated list of randomly-selected words. + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The additional network interfaces to create for the virtual server instance. @@ -72127,7 +72092,7 @@ type InstanceTemplatePrototypeInstanceByCatalogOffering struct { UserData *string `json:"user_data,omitempty"` // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the // instance's network interfaces. @@ -72215,7 +72180,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceByCatalogOffering(m map[string]js if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } @@ -72270,8 +72235,8 @@ type InstanceTemplatePrototypeInstanceByImage struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the - // name will be a hyphenated list of randomly-selected words. + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The additional network interfaces to create for the virtual server instance. @@ -72296,7 +72261,7 @@ type InstanceTemplatePrototypeInstanceByImage struct { UserData *string `json:"user_data,omitempty"` // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the // instance's network interfaces. @@ -72377,7 +72342,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceByImage(m map[string]json.RawMess if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } @@ -72432,8 +72397,8 @@ type InstanceTemplatePrototypeInstanceBySourceSnapshot struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the - // name will be a hyphenated list of randomly-selected words. + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The additional network interfaces to create for the virtual server instance. @@ -72458,7 +72423,7 @@ type InstanceTemplatePrototypeInstanceBySourceSnapshot struct { UserData *string `json:"user_data,omitempty"` // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the // instance's network interfaces. @@ -72536,7 +72501,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot(m map[string]jso if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } @@ -72587,8 +72552,8 @@ type InstanceTemplatePrototypeInstanceBySourceTemplate struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the - // name will be a hyphenated list of randomly-selected words. + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The additional network interfaces to create for the virtual server instance. @@ -72613,7 +72578,7 @@ type InstanceTemplatePrototypeInstanceBySourceTemplate struct { UserData *string `json:"user_data,omitempty"` // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the // instance's network interfaces. @@ -72706,7 +72671,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]jso if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } @@ -72781,7 +72746,7 @@ type InstanceTemplateInstanceByCatalogOffering struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this instance template. + // The name for this instance template. The name is unique across all instance templates in the region. Name *string `json:"name" validate:"required"` // The additional network interfaces to create for the virtual server instance. @@ -72807,7 +72772,7 @@ type InstanceTemplateInstanceByCatalogOffering struct { UserData *string `json:"user_data,omitempty"` // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the // instance's network interfaces. @@ -72900,7 +72865,7 @@ func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } @@ -72967,7 +72932,7 @@ type InstanceTemplateInstanceByImage struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this instance template. + // The name for this instance template. The name is unique across all instance templates in the region. Name *string `json:"name" validate:"required"` // The additional network interfaces to create for the virtual server instance. @@ -72993,7 +72958,7 @@ type InstanceTemplateInstanceByImage struct { UserData *string `json:"user_data,omitempty"` // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the // instance's network interfaces. @@ -73079,7 +73044,7 @@ func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, resu if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } @@ -73146,7 +73111,7 @@ type InstanceTemplateInstanceBySourceSnapshot struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The unique user-defined name for this instance template. + // The name for this instance template. The name is unique across all instance templates in the region. Name *string `json:"name" validate:"required"` // The additional network interfaces to create for the virtual server instance. @@ -73172,7 +73137,7 @@ type InstanceTemplateInstanceBySourceSnapshot struct { UserData *string `json:"user_data,omitempty"` // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the // instance's network interfaces. @@ -73255,7 +73220,7 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMess if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } @@ -73899,7 +73864,7 @@ type LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct { // The unique identifier for this load balancer pool. ID *string `json:"id" validate:"required"` - // The user-defined name for this load balancer pool. + // The name for this load balancer pool. The name is unique across all pools for the load balancer. Name *string `json:"name" validate:"required"` } @@ -74118,7 +74083,7 @@ type LoadBalancerPoolMemberTargetInstanceReference struct { // The unique identifier for this virtual server instance. ID *string `json:"id" validate:"required"` - // The user-defined name for this virtual server instance (and default system hostname). + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. Name *string `json:"name" validate:"required"` } @@ -74500,8 +74465,8 @@ func UnmarshalNetworkACLIdentityByID(m map[string]json.RawMessage, result interf // NetworkACLPrototypeNetworkACLByRules : NetworkACLPrototypeNetworkACLByRules struct // This model "extends" NetworkACLPrototype type NetworkACLPrototypeNetworkACLByRules struct { - // The user-defined name for this network ACL. Names must be unique within the VPC the network ACL resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the + // name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -74553,8 +74518,8 @@ func UnmarshalNetworkACLPrototypeNetworkACLByRules(m map[string]json.RawMessage, // NetworkACLPrototypeNetworkACLBySourceNetworkACL : NetworkACLPrototypeNetworkACLBySourceNetworkACL struct // This model "extends" NetworkACLPrototype type NetworkACLPrototypeNetworkACLBySourceNetworkACL struct { - // The user-defined name for this network ACL. Names must be unique within the VPC the network ACL resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the + // name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -74755,7 +74720,7 @@ type NetworkACLRuleItemNetworkACLRuleProtocolAll struct { // The IP version for this rule. IPVersion *string `json:"ip_version" validate:"required"` - // The user-defined name for this network ACL rule. + // The name for this network ACL rule. The name is unique across all rules for the network ACL. Name *string `json:"name" validate:"required"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -74874,7 +74839,7 @@ type NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct { // The IP version for this rule. IPVersion *string `json:"ip_version" validate:"required"` - // The user-defined name for this network ACL rule. + // The name for this network ACL rule. The name is unique across all rules for the network ACL. Name *string `json:"name" validate:"required"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -75011,7 +74976,7 @@ type NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct { // The IP version for this rule. IPVersion *string `json:"ip_version" validate:"required"` - // The user-defined name for this network ACL rule. + // The name for this network ACL rule. The name is unique across all rules for the network ACL. Name *string `json:"name" validate:"required"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -75143,8 +75108,8 @@ type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` - // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -75234,8 +75199,8 @@ type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` - // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -75343,8 +75308,8 @@ type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototy // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` - // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -75465,8 +75430,8 @@ type NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct { // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` - // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -75562,8 +75527,8 @@ type NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct { // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` - // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -75677,8 +75642,8 @@ type NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct { // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` - // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If - // unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -75816,7 +75781,7 @@ type NetworkACLRuleNetworkACLRuleProtocolAll struct { // The IP version for this rule. IPVersion *string `json:"ip_version" validate:"required"` - // The user-defined name for this network ACL rule. + // The name for this network ACL rule. The name is unique across all rules for the network ACL. Name *string `json:"name" validate:"required"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -75934,7 +75899,7 @@ type NetworkACLRuleNetworkACLRuleProtocolIcmp struct { // The IP version for this rule. IPVersion *string `json:"ip_version" validate:"required"` - // The user-defined name for this network ACL rule. + // The name for this network ACL rule. The name is unique across all rules for the network ACL. Name *string `json:"name" validate:"required"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -76070,7 +76035,7 @@ type NetworkACLRuleNetworkACLRuleProtocolTcpudp struct { // The IP version for this rule. IPVersion *string `json:"ip_version" validate:"required"` - // The user-defined name for this network ACL rule. + // The name for this network ACL rule. The name is unique across all rules for the network ACL. Name *string `json:"name" validate:"required"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -76243,9 +76208,9 @@ type NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext struc // `target` is deleted, or the reserved IP is unbound. AutoDelete *bool `json:"auto_delete,omitempty"` - // The user-defined name for this reserved IP. If unspecified, the name will be a hyphenated list of randomly-selected - // words. Names must be unique within the subnet the reserved IP resides in. Names beginning with `ibm-` are reserved - // for provider-owned resources. + // The name for this reserved IP. The name must not be used by another reserved IP in the 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"` } @@ -76394,8 +76359,8 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity(m map[string]js // PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext : PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct // This model "extends" PublicGatewayFloatingIPPrototype type PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct { - // The unique user-defined name for this floating IP. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this floating IP. The name must not be used by another floating IP in the region. 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 @@ -76580,7 +76545,7 @@ type ReservedIPTargetEndpointGatewayReference struct { // The unique identifier for this endpoint gateway. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this endpoint gateway. + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -76687,7 +76652,7 @@ type ReservedIPTargetLoadBalancerReference struct { // The unique identifier for this load balancer. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this load balancer. + // The name for this load balancer. The name is unique across all load balancers in the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -76748,7 +76713,7 @@ type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { // The unique identifier for this network interface. ID *string `json:"id" validate:"required"` - // The user-defined name for this network interface. + // The name for this network interface. Name *string `json:"name" validate:"required"` // The resource type. @@ -76808,7 +76773,7 @@ type ReservedIPTargetVPNGatewayReference struct { // The unique identifier for this VPN gateway. ID *string `json:"id" validate:"required"` - // The user-defined name for this VPN gateway. + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -76872,7 +76837,7 @@ type ReservedIPTargetVPNServerReference struct { // The unique identifier for this VPN server. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this VPN server. + // The name for this VPN server. The name is unique across all VPN servers in the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -76967,7 +76932,7 @@ type RouteCreatorVPNGatewayReference struct { // The unique identifier for this VPN gateway. ID *string `json:"id" validate:"required"` - // The user-defined name for this VPN gateway. + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -77031,7 +76996,7 @@ type RouteCreatorVPNServerReference struct { // The unique identifier for this VPN server. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this VPN server. + // The name for this VPN server. The name is unique across all VPN servers in the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -77118,7 +77083,7 @@ type RouteNextHopVPNGatewayConnectionReference struct { // The unique identifier for this VPN gateway connection. ID *string `json:"id" validate:"required"` - // The user-defined name for this VPN connection. + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. Name *string `json:"name" validate:"required"` // The resource type. @@ -77978,7 +77943,7 @@ type SecurityGroupRuleRemoteSecurityGroupReference struct { // The unique identifier for this security group. ID *string `json:"id" validate:"required"` - // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + // The name for this security group. The name is unique across all security groups for the VPC. Name *string `json:"name" validate:"required"` } @@ -78298,7 +78263,7 @@ type SecurityGroupTargetReferenceEndpointGatewayReference struct { // The unique identifier for this endpoint gateway. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this endpoint gateway. + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -78362,7 +78327,7 @@ type SecurityGroupTargetReferenceLoadBalancerReference struct { // The unique identifier for this load balancer. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this load balancer. + // The name for this load balancer. The name is unique across all load balancers in the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -78423,7 +78388,7 @@ type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { // The unique identifier for this network interface. ID *string `json:"id" validate:"required"` - // The user-defined name for this network interface. + // The name for this network interface. Name *string `json:"name" validate:"required"` // The resource type. @@ -78483,7 +78448,7 @@ type SecurityGroupTargetReferenceVPNServerReference struct { // The unique identifier for this VPN server. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this VPN server. + // The name for this VPN server. The name is unique across all VPN servers in the VPC. Name *string `json:"name" validate:"required"` // The resource type. @@ -78627,8 +78592,8 @@ func UnmarshalSnapshotIdentityByID(m map[string]json.RawMessage, result interfac // SnapshotPrototypeSnapshotBySourceVolume : SnapshotPrototypeSnapshotBySourceVolume struct // This model "extends" SnapshotPrototype type SnapshotPrototypeSnapshotBySourceVolume struct { - // The unique user-defined name for this snapshot. If unspecified, the name will be a hyphenated list of - // randomly-selected words. + // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name + // will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -78775,8 +78740,8 @@ type SubnetPrototypeSubnetByCIDR struct { // The IP version(s) to support for this subnet. IPVersion *string `json:"ip_version,omitempty"` - // The user-defined name for this subnet. Names must be unique within the VPC the subnet resides in. If unspecified, - // the name will be a hyphenated list of randomly-selected words. + // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a + // hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The network ACL to use for this subnet. If unspecified, the default network ACL for the VPC is used. @@ -78877,8 +78842,8 @@ type SubnetPrototypeSubnetByTotalCount struct { // The IP version(s) to support for this subnet. IPVersion *string `json:"ip_version,omitempty"` - // The user-defined name for this subnet. Names must be unique within the VPC the subnet resides in. If unspecified, - // the name will be a hyphenated list of randomly-selected words. + // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a + // hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The network ACL to use for this subnet. If unspecified, the default network ACL for the VPC is used. @@ -79479,7 +79444,7 @@ type VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch struct { IpsecPolicy VPNGatewayConnectionIPsecPolicyPatchIntf `json:"ipsec_policy,omitempty"` - // The user-defined name for this VPN gateway connection. + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. Name *string `json:"name,omitempty"` // The IP address of the peer VPN gateway. @@ -79582,7 +79547,7 @@ type VPNGatewayConnectionPolicyMode struct { // The mode of the VPN gateway. Mode *string `json:"mode" validate:"required"` - // The user-defined name for this VPN gateway connection. + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. Name *string `json:"name" validate:"required"` // The IP address of the peer VPN gateway. @@ -79717,7 +79682,8 @@ type VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` - // The user-defined name for this VPN gateway connection. + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The IP address of the peer VPN gateway. @@ -79804,7 +79770,8 @@ type VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype s IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` - // The user-defined name for this VPN gateway connection. + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The IP address of the peer VPN gateway. @@ -79907,7 +79874,7 @@ type VPNGatewayConnectionStaticRouteMode struct { // The mode of the VPN gateway. Mode *string `json:"mode" validate:"required"` - // The user-defined name for this VPN gateway connection. + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. Name *string `json:"name" validate:"required"` // The IP address of the peer VPN gateway. @@ -80057,7 +80024,7 @@ type VPNGatewayPolicyMode struct { // Collection of VPN gateway members. Members []VPNGatewayMember `json:"members" validate:"required"` - // The user-defined name for this VPN gateway. + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. Name *string `json:"name" validate:"required"` // The resource group for this VPN gateway. @@ -80165,7 +80132,8 @@ func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interfac // VPNGatewayPrototypeVPNGatewayPolicyModePrototype : VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct // This model "extends" VPNGatewayPrototype type VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct { - // The user-defined name for this VPN gateway. + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name + // will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -80221,7 +80189,8 @@ func UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype(m map[string]json // VPNGatewayPrototypeVPNGatewayRouteModePrototype : VPNGatewayPrototypeVPNGatewayRouteModePrototype struct // This model "extends" VPNGatewayPrototype type VPNGatewayPrototypeVPNGatewayRouteModePrototype struct { - // The user-defined name for this VPN gateway. + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name + // will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -80295,7 +80264,7 @@ type VPNGatewayRouteMode struct { // Collection of VPN gateway members. Members []VPNGatewayMember `json:"members" validate:"required"` - // The user-defined name for this VPN gateway. + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. Name *string `json:"name" validate:"required"` // The resource group for this VPN gateway. @@ -80684,7 +80653,8 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` - // The unique user-defined name for this volume. + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to @@ -80755,136 +80725,6 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext(m ma return } -// VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity : Identifies a volume by a unique property. -// Models which "extend" this model: -// - VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID -// - VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN -// - VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref -// This model "extends" VolumeAttachmentVolumePrototypeInstanceContext -type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity struct { - // The unique identifier for this volume. - ID *string `json:"id,omitempty"` - - // The CRN for this volume. - CRN *string `json:"crn,omitempty"` - - // The URL for this volume. - Href *string `json:"href,omitempty"` -} - -func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity) isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool { - return true -} - -type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityIntf interface { - VolumeAttachmentVolumePrototypeInstanceContextIntf - isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool -} - -func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { - return true -} - -// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity from the specified map of raw messages. -func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext : VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext struct -// Models which "extend" this model: -// - VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity -// - VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot -// This model "extends" VolumeAttachmentVolumePrototypeInstanceContext -type VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext struct { - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The unique user-defined name for this volume. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to - // use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` -} - -func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext) isaVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext() bool { - return true -} - -type VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextIntf interface { - VolumeAttachmentVolumePrototypeInstanceContextIntf - isaVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext() bool -} - -func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { - return true -} - -// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VolumeIdentityByCRN : VolumeIdentityByCRN struct // This model "extends" VolumeIdentity type VolumeIdentityByCRN struct { @@ -81047,7 +80887,8 @@ type VolumePrototypeVolumeByCapacity struct { // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` - // The unique user-defined name for this volume. + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. @@ -81132,7 +80973,8 @@ type VolumePrototypeVolumeBySourceSnapshot struct { // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` - // The unique user-defined name for this volume. + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. @@ -81843,7 +81685,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(m map[st // - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager // This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototype type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec struct { - // The user-defined name for this instance group manager action. Names must be unique within the instance group + // The name for this instance group manager action. The name must not be used by another action for the instance group // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -81902,7 +81744,7 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronS // - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager // This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototype type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt struct { - // The user-defined name for this instance group manager action. Names must be unique within the instance group + // The name for this instance group manager action. The name must not be used by another action for the instance group // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -81976,7 +81818,8 @@ type InstanceGroupManagerActionScheduledActionGroupTarget struct { // The unique identifier for this instance group manager action. ID *string `json:"id" validate:"required"` - // The user-defined name for this instance group manager action. + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. Name *string `json:"name" validate:"required"` // The resource type. @@ -82130,7 +81973,8 @@ type InstanceGroupManagerActionScheduledActionManagerTarget struct { // The unique identifier for this instance group manager action. ID *string `json:"id" validate:"required"` - // The user-defined name for this instance group manager action. + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. Name *string `json:"name" validate:"required"` // The resource type. @@ -83837,7 +83681,8 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototyp // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` - // The unique user-defined name for this volume. + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. @@ -83912,7 +83757,8 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototyp // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` - // The unique user-defined name for this volume. + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. @@ -83989,274 +83835,10 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolum return } -// VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN : VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN struct -// This model "extends" VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity -type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN struct { - // The CRN for this volume. - CRN *string `json:"crn" validate:"required"` -} - -// NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN : Instantiate VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN(crn string) (_model *VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN, err error) { - _model = &VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool { - return true -} - -func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { - return true -} - -// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN from the specified map of raw messages. -func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref : VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref struct -// This model "extends" VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity -type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref struct { - // The URL for this volume. - Href *string `json:"href" validate:"required"` -} - -// NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref : Instantiate VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref(href string) (_model *VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref, err error) { - _model = &VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool { - return true -} - -func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { - return true -} - -// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref from the specified map of raw messages. -func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID : VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID struct -// This model "extends" VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity -type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID struct { - // The unique identifier for this volume. - ID *string `json:"id" validate:"required"` -} - -// NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID : Instantiate VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID(id string) (_model *VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID, err error) { - _model = &VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool { - return true -} - -func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { - return true -} - -// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID from the specified map of raw messages. -func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct -// This model "extends" VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext -type VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct { - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The unique user-defined name for this volume. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. - Capacity *int64 `json:"capacity" validate:"required"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` -} - -// NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : Instantiate VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(profile VolumeProfileIdentityIntf, capacity int64) (_model *VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity, err error) { - _model = &VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity{ - Profile: profile, - Capacity: core.Int64Ptr(capacity), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext() bool { - return true -} - -func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { - return true -} - -// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity from the specified map of raw messages. -func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct -// This model "extends" VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext -type VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct { - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The unique user-defined name for this volume. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's - // `minimum_capacity`. The maximum value may increase in the future. - // - // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` -} - -// NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : Instantiate VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(profile VolumeProfileIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot, err error) { - _model = &VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot{ - Profile: profile, - SourceSnapshot: sourceSnapshot, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) isaVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext() bool { - return true -} - -func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { - return true -} - -// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot from the specified map of raw messages. -func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup struct // This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup struct { - // The user-defined name for this instance group manager action. Names must be unique within the instance group + // The name for this instance group manager action. The name must not be used by another action for the instance group // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -84310,7 +83892,7 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronS // InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager struct // This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager struct { - // The user-defined name for this instance group manager action. Names must be unique within the instance group + // The name for this instance group manager action. The name must not be used by another action for the instance group // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -84364,7 +83946,7 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronS // InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup struct // This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup struct { - // The user-defined name for this instance group manager action. Names must be unique within the instance group + // The name for this instance group manager action. The name must not be used by another action for the instance group // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -84417,7 +83999,7 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt // InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager struct // This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager struct { - // The user-defined name for this instance group manager action. Names must be unique within the instance group + // The name for this instance group manager action. The name must not be used by another action for the instance group // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go index 32735910aa..a34376e4ca 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go @@ -27,10 +27,10 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" - "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/go-openapi/strfmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + "github.ibm.com/ibmcloud/vpc-go-sdk/vpcv1" ) var _ = Describe(`VpcV1`, func() { @@ -2153,7 +2153,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-2", "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": "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}`) })) }) It(`Invoke ListVPCAddressPrefixes successfully with retries`, func() { @@ -2214,7 +2214,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-2", "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": "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}`) })) }) It(`Invoke ListVPCAddressPrefixes successfully`, func() { @@ -2362,9 +2362,9 @@ var _ = Describe(`VpcV1`, func() { res.WriteHeader(200) requestNumber++ if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"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-2","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"},"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"}}],"total_count":2,"limit":1}`) } else if requestNumber == 2 { - 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-2","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", `{"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"}}],"total_count":2,"limit":1}`) } else { res.WriteHeader(400) } @@ -2459,7 +2459,7 @@ var _ = Describe(`VpcV1`, func() { createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) - createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-2") + createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-1") createVPCAddressPrefixOptionsModel.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.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModel) @@ -2515,7 +2515,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"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-2", "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", `{"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"}}`) })) }) It(`Invoke CreateVPCAddressPrefix successfully with retries`, func() { @@ -2538,7 +2538,7 @@ var _ = Describe(`VpcV1`, func() { createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) - createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-2") + createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-1") createVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -2596,7 +2596,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"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-2", "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", `{"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"}}`) })) }) It(`Invoke CreateVPCAddressPrefix successfully`, func() { @@ -2624,7 +2624,7 @@ var _ = Describe(`VpcV1`, func() { createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) - createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-2") + createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-1") createVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -2653,7 +2653,7 @@ var _ = Describe(`VpcV1`, func() { createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) - createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-2") + createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-1") createVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -2703,7 +2703,7 @@ var _ = Describe(`VpcV1`, func() { createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) - createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-2") + createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-1") createVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -2864,7 +2864,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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-2", "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", `{"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"}}`) })) }) It(`Invoke GetVPCAddressPrefix successfully with retries`, func() { @@ -2922,7 +2922,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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-2", "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", `{"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"}}`) })) }) It(`Invoke GetVPCAddressPrefix successfully`, func() { @@ -3054,7 +3054,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the AddressPrefixPatch model addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) addressPrefixPatchModel.IsDefault = core.BoolPtr(false) - addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-2") + addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-1") addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -3118,7 +3118,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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-2", "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", `{"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"}}`) })) }) It(`Invoke UpdateVPCAddressPrefix successfully with retries`, func() { @@ -3134,7 +3134,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the AddressPrefixPatch model addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) addressPrefixPatchModel.IsDefault = core.BoolPtr(false) - addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-2") + addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-1") addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -3200,7 +3200,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"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-2", "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", `{"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"}}`) })) }) It(`Invoke UpdateVPCAddressPrefix successfully`, func() { @@ -3221,7 +3221,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the AddressPrefixPatch model addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) addressPrefixPatchModel.IsDefault = core.BoolPtr(false) - addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-2") + addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-1") addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -3251,7 +3251,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the AddressPrefixPatch model addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) addressPrefixPatchModel.IsDefault = core.BoolPtr(false) - addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-2") + addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-1") addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -3302,7 +3302,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the AddressPrefixPatch model addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) addressPrefixPatchModel.IsDefault = core.BoolPtr(false) - addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-2") + addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-1") addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -15223,7 +15223,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}], "total_count": 132}`) + 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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListInstanceTemplates successfully with retries`, func() { @@ -15279,7 +15279,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}], "total_count": 132}`) + 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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListInstanceTemplates successfully`, func() { @@ -15450,15 +15450,15 @@ var _ = Describe(`VpcV1`, func() { resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID model - volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) - volumeAttachmentVolumePrototypeInstanceContextModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model - volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) - volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + // Construct an instance of the VolumeAttachmentPrototype model + volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) + volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -15508,7 +15508,7 @@ var _ = Describe(`VpcV1`, func() { instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") - instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} instanceTemplatePrototypeModel.VPC = vpcIdentityModel instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel instanceTemplatePrototypeModel.Image = imageIdentityModel @@ -15573,7 +15573,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) })) }) It(`Invoke CreateInstanceTemplate successfully with retries`, func() { @@ -15641,15 +15641,15 @@ var _ = Describe(`VpcV1`, func() { resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID model - volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) - volumeAttachmentVolumePrototypeInstanceContextModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model - volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) - volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + // Construct an instance of the VolumeAttachmentPrototype model + volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) + volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -15699,7 +15699,7 @@ var _ = Describe(`VpcV1`, func() { instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") - instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} instanceTemplatePrototypeModel.VPC = vpcIdentityModel instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel instanceTemplatePrototypeModel.Image = imageIdentityModel @@ -15766,7 +15766,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) })) }) It(`Invoke CreateInstanceTemplate successfully`, func() { @@ -15839,15 +15839,15 @@ var _ = Describe(`VpcV1`, func() { resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID model - volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) - volumeAttachmentVolumePrototypeInstanceContextModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model - volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) - volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + // Construct an instance of the VolumeAttachmentPrototype model + volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) + volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -15897,7 +15897,7 @@ var _ = Describe(`VpcV1`, func() { instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") - instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} instanceTemplatePrototypeModel.VPC = vpcIdentityModel instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel instanceTemplatePrototypeModel.Image = imageIdentityModel @@ -15980,15 +15980,15 @@ var _ = Describe(`VpcV1`, func() { resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID model - volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) - volumeAttachmentVolumePrototypeInstanceContextModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model - volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) - volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + // Construct an instance of the VolumeAttachmentPrototype model + volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) + volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -16038,7 +16038,7 @@ var _ = Describe(`VpcV1`, func() { instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") - instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} instanceTemplatePrototypeModel.VPC = vpcIdentityModel instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel instanceTemplatePrototypeModel.Image = imageIdentityModel @@ -16142,15 +16142,15 @@ var _ = Describe(`VpcV1`, func() { resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID model - volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) - volumeAttachmentVolumePrototypeInstanceContextModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model - volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) - volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + // Construct an instance of the VolumeAttachmentPrototype model + volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) + volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -16200,7 +16200,7 @@ var _ = Describe(`VpcV1`, func() { instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") - instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} instanceTemplatePrototypeModel.VPC = vpcIdentityModel instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel instanceTemplatePrototypeModel.Image = imageIdentityModel @@ -16367,7 +16367,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) })) }) It(`Invoke GetInstanceTemplate successfully with retries`, func() { @@ -16424,7 +16424,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) })) }) It(`Invoke GetInstanceTemplate successfully`, func() { @@ -16615,7 +16615,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) })) }) It(`Invoke UpdateInstanceTemplate successfully with retries`, func() { @@ -16695,7 +16695,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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": true, "name": "my-volume-attachment", "volume": {"id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) })) }) It(`Invoke UpdateInstanceTemplate successfully`, func() { @@ -17345,20 +17345,20 @@ var _ = Describe(`VpcV1`, func() { encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") - // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model - volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) - volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) - volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") - volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel - volumeAttachmentVolumePrototypeInstanceContextModel.UserTags = []string{"testString"} - volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) - volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model - volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) - volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + volumeAttachmentPrototypeVolumeModel.Iops = core.Int64Ptr(int64(10000)) + volumeAttachmentPrototypeVolumeModel.Name = core.StringPtr("my-data-volume") + volumeAttachmentPrototypeVolumeModel.Profile = volumeProfileIdentityModel + volumeAttachmentPrototypeVolumeModel.UserTags = []string{"testString"} + volumeAttachmentPrototypeVolumeModel.Capacity = core.Int64Ptr(int64(1000)) + volumeAttachmentPrototypeVolumeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the VolumeAttachmentPrototype model + volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) + volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -17400,7 +17400,7 @@ var _ = Describe(`VpcV1`, func() { instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) instancePrototypeModel.UserData = core.StringPtr("testString") - instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} instancePrototypeModel.VPC = vpcIdentityModel instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel instancePrototypeModel.Image = imageIdentityModel @@ -17541,20 +17541,20 @@ var _ = Describe(`VpcV1`, func() { encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") - // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model - volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) - volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) - volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") - volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel - volumeAttachmentVolumePrototypeInstanceContextModel.UserTags = []string{"testString"} - volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) - volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model - volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) - volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + volumeAttachmentPrototypeVolumeModel.Iops = core.Int64Ptr(int64(10000)) + volumeAttachmentPrototypeVolumeModel.Name = core.StringPtr("my-data-volume") + volumeAttachmentPrototypeVolumeModel.Profile = volumeProfileIdentityModel + volumeAttachmentPrototypeVolumeModel.UserTags = []string{"testString"} + volumeAttachmentPrototypeVolumeModel.Capacity = core.Int64Ptr(int64(1000)) + volumeAttachmentPrototypeVolumeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the VolumeAttachmentPrototype model + volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) + volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -17596,7 +17596,7 @@ var _ = Describe(`VpcV1`, func() { instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) instancePrototypeModel.UserData = core.StringPtr("testString") - instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} instancePrototypeModel.VPC = vpcIdentityModel instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel instancePrototypeModel.Image = imageIdentityModel @@ -17744,20 +17744,20 @@ var _ = Describe(`VpcV1`, func() { encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") - // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model - volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) - volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) - volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") - volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel - volumeAttachmentVolumePrototypeInstanceContextModel.UserTags = []string{"testString"} - volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) - volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model - volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) - volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + volumeAttachmentPrototypeVolumeModel.Iops = core.Int64Ptr(int64(10000)) + volumeAttachmentPrototypeVolumeModel.Name = core.StringPtr("my-data-volume") + volumeAttachmentPrototypeVolumeModel.Profile = volumeProfileIdentityModel + volumeAttachmentPrototypeVolumeModel.UserTags = []string{"testString"} + volumeAttachmentPrototypeVolumeModel.Capacity = core.Int64Ptr(int64(1000)) + volumeAttachmentPrototypeVolumeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the VolumeAttachmentPrototype model + volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) + volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -17799,7 +17799,7 @@ var _ = Describe(`VpcV1`, func() { instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) instancePrototypeModel.UserData = core.StringPtr("testString") - instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} instancePrototypeModel.VPC = vpcIdentityModel instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel instancePrototypeModel.Image = imageIdentityModel @@ -17890,20 +17890,20 @@ var _ = Describe(`VpcV1`, func() { encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") - // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model - volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) - volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) - volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") - volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel - volumeAttachmentVolumePrototypeInstanceContextModel.UserTags = []string{"testString"} - volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) - volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model - volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) - volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + volumeAttachmentPrototypeVolumeModel.Iops = core.Int64Ptr(int64(10000)) + volumeAttachmentPrototypeVolumeModel.Name = core.StringPtr("my-data-volume") + volumeAttachmentPrototypeVolumeModel.Profile = volumeProfileIdentityModel + volumeAttachmentPrototypeVolumeModel.UserTags = []string{"testString"} + volumeAttachmentPrototypeVolumeModel.Capacity = core.Int64Ptr(int64(1000)) + volumeAttachmentPrototypeVolumeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the VolumeAttachmentPrototype model + volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) + volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -17945,7 +17945,7 @@ var _ = Describe(`VpcV1`, func() { instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) instancePrototypeModel.UserData = core.StringPtr("testString") - instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} instancePrototypeModel.VPC = vpcIdentityModel instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel instancePrototypeModel.Image = imageIdentityModel @@ -18057,20 +18057,20 @@ var _ = Describe(`VpcV1`, func() { encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") - // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model - volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) - volumeAttachmentVolumePrototypeInstanceContextModel.Iops = core.Int64Ptr(int64(10000)) - volumeAttachmentVolumePrototypeInstanceContextModel.Name = core.StringPtr("my-data-volume") - volumeAttachmentVolumePrototypeInstanceContextModel.Profile = volumeProfileIdentityModel - volumeAttachmentVolumePrototypeInstanceContextModel.UserTags = []string{"testString"} - volumeAttachmentVolumePrototypeInstanceContextModel.Capacity = core.Int64Ptr(int64(1000)) - volumeAttachmentVolumePrototypeInstanceContextModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model - volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) - volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + volumeAttachmentPrototypeVolumeModel.Iops = core.Int64Ptr(int64(10000)) + volumeAttachmentPrototypeVolumeModel.Name = core.StringPtr("my-data-volume") + volumeAttachmentPrototypeVolumeModel.Profile = volumeProfileIdentityModel + volumeAttachmentPrototypeVolumeModel.UserTags = []string{"testString"} + volumeAttachmentPrototypeVolumeModel.Capacity = core.Int64Ptr(int64(1000)) + volumeAttachmentPrototypeVolumeModel.EncryptionKey = encryptionKeyIdentityModel + + // Construct an instance of the VolumeAttachmentPrototype model + volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) + volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -18112,7 +18112,7 @@ var _ = Describe(`VpcV1`, func() { instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) instancePrototypeModel.UserData = core.StringPtr("testString") - instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} instancePrototypeModel.VPC = vpcIdentityModel instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel instancePrototypeModel.Image = imageIdentityModel @@ -26868,7 +26868,7 @@ 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": "*/5 1,2,3 * * *", "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", `{"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}`) })) }) It(`Invoke ListInstanceGroupManagerActions successfully with retries`, func() { @@ -26930,7 +26930,7 @@ 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": "*/5 1,2,3 * * *", "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", `{"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}`) })) }) It(`Invoke ListInstanceGroupManagerActions successfully`, func() { @@ -27081,9 +27081,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,"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":"*/5 1,2,3 * * *","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,"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,"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":"*/5 1,2,3 * * *","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,"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) } @@ -27240,7 +27240,7 @@ 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": "*/5 1,2,3 * * *", "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", `{"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 CreateInstanceGroupManagerAction successfully with retries`, func() { @@ -27325,7 +27325,7 @@ 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": "*/5 1,2,3 * * *", "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", `{"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 CreateInstanceGroupManagerAction successfully`, func() { @@ -27608,7 +27608,7 @@ 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": "*/5 1,2,3 * * *", "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", `{"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 GetInstanceGroupManagerAction successfully with retries`, func() { @@ -27667,7 +27667,7 @@ 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": "*/5 1,2,3 * * *", "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", `{"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 GetInstanceGroupManagerAction successfully`, func() { @@ -27810,7 +27810,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstanceGroupManagerActionPatch model instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") @@ -27879,7 +27879,7 @@ 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": "*/5 1,2,3 * * *", "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", `{"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 UpdateInstanceGroupManagerAction successfully with retries`, func() { @@ -27903,7 +27903,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstanceGroupManagerActionPatch model instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") @@ -27974,7 +27974,7 @@ 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": "*/5 1,2,3 * * *", "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", `{"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 UpdateInstanceGroupManagerAction successfully`, func() { @@ -28003,7 +28003,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstanceGroupManagerActionPatch model instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") @@ -28046,7 +28046,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstanceGroupManagerActionPatch model instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") @@ -28110,7 +28110,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the InstanceGroupManagerActionPatch model instanceGroupManagerActionPatchModel := new(vpcv1.InstanceGroupManagerActionPatch) - instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + instanceGroupManagerActionPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") instanceGroupManagerActionPatchModel.Group = instanceGroupManagerActionGroupPatchModel instanceGroupManagerActionPatchModel.Manager = instanceGroupManagerActionManagerPatchModel instanceGroupManagerActionPatchModel.Name = core.StringPtr("my-instance-group-manager-action") @@ -34721,7 +34721,7 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") @@ -34814,7 +34814,7 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") @@ -34914,7 +34914,7 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") @@ -34957,7 +34957,7 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") @@ -35014,7 +35014,7 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") @@ -35116,7 +35116,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}]}`) + fmt.Fprintf(res, "%s", `{"plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}]}`) })) }) It(`Invoke ListBackupPolicyPlans successfully with retries`, func() { @@ -35175,7 +35175,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}]}`) + fmt.Fprintf(res, "%s", `{"plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}]}`) })) }) It(`Invoke ListBackupPolicyPlans successfully`, func() { @@ -35312,7 +35312,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the CreateBackupPolicyPlanOptions model createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) @@ -35373,7 +35373,7 @@ 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"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}`) })) }) It(`Invoke CreateBackupPolicyPlan successfully with retries`, func() { @@ -35394,7 +35394,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the CreateBackupPolicyPlanOptions model createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) @@ -35457,7 +35457,7 @@ 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"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}`) })) }) It(`Invoke CreateBackupPolicyPlan successfully`, func() { @@ -35483,7 +35483,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the CreateBackupPolicyPlanOptions model createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) @@ -35515,7 +35515,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the CreateBackupPolicyPlanOptions model createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) @@ -35568,7 +35568,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the CreateBackupPolicyPlanOptions model createBackupPolicyPlanOptionsModel := new(vpcv1.CreateBackupPolicyPlanOptions) createBackupPolicyPlanOptionsModel.BackupPolicyID = core.StringPtr("testString") - createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + createBackupPolicyPlanOptionsModel.CronSpec = core.StringPtr("30 */2 * * 1-5") createBackupPolicyPlanOptionsModel.Active = core.BoolPtr(true) createBackupPolicyPlanOptionsModel.AttachUserTags = []string{"my-daily-backup-plan"} createBackupPolicyPlanOptionsModel.CopyUserTags = core.BoolPtr(true) @@ -35664,7 +35664,7 @@ 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"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}`) })) }) It(`Invoke DeleteBackupPolicyPlan successfully with retries`, func() { @@ -35725,7 +35725,7 @@ 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"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}`) })) }) It(`Invoke DeleteBackupPolicyPlan successfully`, func() { @@ -35900,7 +35900,7 @@ 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"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}`) })) }) It(`Invoke GetBackupPolicyPlan successfully with retries`, func() { @@ -35958,7 +35958,7 @@ 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"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}`) })) }) It(`Invoke GetBackupPolicyPlan successfully`, func() { @@ -36099,7 +36099,7 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanPatchModel.Active = core.BoolPtr(true) backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() @@ -36168,7 +36168,7 @@ 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"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}`) })) }) It(`Invoke UpdateBackupPolicyPlan successfully with retries`, func() { @@ -36191,7 +36191,7 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanPatchModel.Active = core.BoolPtr(true) backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() @@ -36262,7 +36262,7 @@ 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"], "copy_user_tags": true, "created_at": "2019-01-01T12:00:00.000Z", "cron_spec": "*/5 1,2,3 * * *", "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", "resource_type": "backup_policy_plan"}`) + fmt.Fprintf(res, "%s", `{"active": true, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}`) })) }) It(`Invoke UpdateBackupPolicyPlan successfully`, func() { @@ -36290,7 +36290,7 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanPatchModel.Active = core.BoolPtr(true) backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() @@ -36330,7 +36330,7 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanPatchModel.Active = core.BoolPtr(true) backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() @@ -36391,7 +36391,7 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanPatchModel.Active = core.BoolPtr(true) backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") backupPolicyPlanPatchModelAsPatch, asPatchErr := backupPolicyPlanPatchModel.AsPatch() @@ -39047,7 +39047,7 @@ var _ = Describe(`VpcV1`, func() { // 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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) })) }) It(`Invoke ListBareMetalServers successfully with retries`, func() { @@ -39123,7 +39123,7 @@ var _ = Describe(`VpcV1`, func() { // 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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) })) }) It(`Invoke ListBareMetalServers successfully`, func() { @@ -39285,9 +39285,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,"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-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/123456::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-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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":"failed","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":"tpm_2"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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,"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/123456::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,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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":"failed","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":"tpm_2"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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-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/123456::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-disk","resource_type":"bare_metal_server_disk","size":100}],"enable_secure_boot":false,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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":"failed","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":"tpm_2"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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,"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/123456::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,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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":"failed","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":"tpm_2"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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) } @@ -39516,7 +39516,7 @@ 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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -39661,7 +39661,7 @@ 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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -40312,7 +40312,7 @@ 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/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-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}`) + 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}]}`) })) }) It(`Invoke ListBareMetalServerDisks successfully with retries`, func() { @@ -40369,7 +40369,7 @@ 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/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-disk", "resource_type": "bare_metal_server_disk", "size": 100}]}`) + 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}]}`) })) }) It(`Invoke ListBareMetalServerDisks successfully`, func() { @@ -40538,7 +40538,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", "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-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + 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}`) })) }) It(`Invoke GetBareMetalServerDisk successfully with retries`, func() { @@ -40596,7 +40596,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", "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-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + 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}`) })) }) It(`Invoke GetBareMetalServerDisk successfully`, func() { @@ -40791,7 +40791,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", "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-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + 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}`) })) }) It(`Invoke UpdateBareMetalServerDisk successfully with retries`, func() { @@ -40872,7 +40872,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", "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-disk", "resource_type": "bare_metal_server_disk", "size": 100}`) + 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}`) })) }) It(`Invoke UpdateBareMetalServerDisk successfully`, func() { @@ -43722,7 +43722,7 @@ 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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -43779,7 +43779,7 @@ 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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -43970,7 +43970,7 @@ 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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -44050,7 +44050,7 @@ 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-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/123456::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-disk", "resource_type": "bare_metal_server_disk", "size": 100}], "enable_secure_boot": false, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -58555,7 +58555,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the UpdateIkePolicyOptions model updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) updateIkePolicyOptionsModel.ID = core.StringPtr("testString") - updateIkePolicyOptionsModel.IkePolicyPatch = make(map[string]interface{}) + updateIkePolicyOptionsModel.IkePolicyPatch = map[string]interface{}{"anyKey": "anyValue"} updateIkePolicyOptionsModel.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.UpdateIkePolicy(updateIkePolicyOptionsModel) @@ -58627,7 +58627,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the UpdateIkePolicyOptions model updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) updateIkePolicyOptionsModel.ID = core.StringPtr("testString") - updateIkePolicyOptionsModel.IkePolicyPatch = make(map[string]interface{}) + updateIkePolicyOptionsModel.IkePolicyPatch = map[string]interface{}{"anyKey": "anyValue"} updateIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -58706,7 +58706,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the UpdateIkePolicyOptions model updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) updateIkePolicyOptionsModel.ID = core.StringPtr("testString") - updateIkePolicyOptionsModel.IkePolicyPatch = make(map[string]interface{}) + updateIkePolicyOptionsModel.IkePolicyPatch = map[string]interface{}{"anyKey": "anyValue"} updateIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -58728,7 +58728,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the UpdateIkePolicyOptions model updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) updateIkePolicyOptionsModel.ID = core.StringPtr("testString") - updateIkePolicyOptionsModel.IkePolicyPatch = make(map[string]interface{}) + updateIkePolicyOptionsModel.IkePolicyPatch = map[string]interface{}{"anyKey": "anyValue"} updateIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -58771,7 +58771,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the UpdateIkePolicyOptions model updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) updateIkePolicyOptionsModel.ID = core.StringPtr("testString") - updateIkePolicyOptionsModel.IkePolicyPatch = make(map[string]interface{}) + updateIkePolicyOptionsModel.IkePolicyPatch = map[string]interface{}{"anyKey": "anyValue"} updateIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -68361,7 +68361,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": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers?limit=20"}, "limit": 20, "load_balancers": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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}`) })) }) It(`Invoke ListLoadBalancers successfully with retries`, func() { @@ -68421,7 +68421,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": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers?limit=20"}, "limit": 20, "load_balancers": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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}`) })) }) It(`Invoke ListLoadBalancers successfully`, func() { @@ -68559,9 +68559,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,"load_balancers":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727","hostname":"my-load-balancer-123456-us-south-1.lb.bluemix.net","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"dd754295-e9e0-4c9d-bf6c-58fbc59e5727","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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"load_balancers":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727","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","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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"load_balancers":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727","hostname":"my-load-balancer-123456-us-south-1.lb.bluemix.net","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727","id":"dd754295-e9e0-4c9d-bf6c-58fbc59e5727","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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"load_balancers":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727","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","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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}`) } else { res.WriteHeader(400) } @@ -68799,7 +68799,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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) })) }) It(`Invoke CreateLoadBalancer successfully with retries`, func() { @@ -68969,7 +68969,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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) })) }) It(`Invoke CreateLoadBalancer successfully`, func() { @@ -69505,7 +69505,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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) })) }) It(`Invoke GetLoadBalancer successfully with retries`, func() { @@ -69562,7 +69562,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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) })) }) It(`Invoke GetLoadBalancer successfully`, func() { @@ -69772,7 +69772,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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) })) }) It(`Invoke UpdateLoadBalancer successfully with retries`, func() { @@ -69869,7 +69869,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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "hostname": "my-load-balancer-123456-us-south-1.lb.bluemix.net", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "id": "dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) })) }) It(`Invoke UpdateLoadBalancer successfully`, func() { @@ -70328,7 +70328,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}`) + fmt.Fprintf(res, "%s", `{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}`) })) }) It(`Invoke ListLoadBalancerListeners successfully with retries`, func() { @@ -70385,7 +70385,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}`) + fmt.Fprintf(res, "%s", `{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}`) })) }) It(`Invoke ListLoadBalancerListeners successfully`, func() { @@ -70616,7 +70616,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) })) }) It(`Invoke CreateLoadBalancerListener successfully with retries`, func() { @@ -70736,7 +70736,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) })) }) It(`Invoke CreateLoadBalancerListener successfully`, func() { @@ -71121,7 +71121,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) })) }) It(`Invoke GetLoadBalancerListener successfully with retries`, func() { @@ -71179,7 +71179,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) })) }) It(`Invoke GetLoadBalancerListener successfully`, func() { @@ -71400,7 +71400,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) })) }) It(`Invoke UpdateLoadBalancerListener successfully with retries`, func() { @@ -71507,7 +71507,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) + fmt.Fprintf(res, "%s", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) })) }) It(`Invoke UpdateLoadBalancerListener successfully`, func() { @@ -80549,7 +80549,7 @@ var _ = Describe(`VpcV1`, func() { Expect(addVPNGatewayConnectionPeerCIDROptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewBackupPolicyPlanPrototype successfully`, func() { - cronSpec := "*/5 1,2,3 * * *" + cronSpec := "30 */2 * * 1-5" _model, err := vpcService.NewBackupPolicyPlanPrototype(cronSpec) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) @@ -80618,13 +80618,13 @@ var _ = Describe(`VpcV1`, func() { backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("*/5 1,2,3 * * *") + backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") Expect(backupPolicyPlanPrototypeModel.Active).To(Equal(core.BoolPtr(true))) Expect(backupPolicyPlanPrototypeModel.AttachUserTags).To(Equal([]string{"my-daily-backup-plan"})) Expect(backupPolicyPlanPrototypeModel.CopyUserTags).To(Equal(core.BoolPtr(true))) - Expect(backupPolicyPlanPrototypeModel.CronSpec).To(Equal(core.StringPtr("*/5 1,2,3 * * *"))) + Expect(backupPolicyPlanPrototypeModel.CronSpec).To(Equal(core.StringPtr("30 */2 * * 1-5"))) Expect(backupPolicyPlanPrototypeModel.DeletionTrigger).To(Equal(backupPolicyPlanDeletionTriggerPrototypeModel)) Expect(backupPolicyPlanPrototypeModel.Name).To(Equal(core.StringPtr("my-policy-plan"))) @@ -80661,10 +80661,10 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the CreateBackupPolicyPlanOptions model backupPolicyID := "testString" - createBackupPolicyPlanOptionsCronSpec := "*/5 1,2,3 * * *" + createBackupPolicyPlanOptionsCronSpec := "30 */2 * * 1-5" createBackupPolicyPlanOptionsModel := vpcService.NewCreateBackupPolicyPlanOptions(backupPolicyID, createBackupPolicyPlanOptionsCronSpec) createBackupPolicyPlanOptionsModel.SetBackupPolicyID("testString") - createBackupPolicyPlanOptionsModel.SetCronSpec("*/5 1,2,3 * * *") + createBackupPolicyPlanOptionsModel.SetCronSpec("30 */2 * * 1-5") createBackupPolicyPlanOptionsModel.SetActive(true) createBackupPolicyPlanOptionsModel.SetAttachUserTags([]string{"my-daily-backup-plan"}) createBackupPolicyPlanOptionsModel.SetCopyUserTags(true) @@ -80673,7 +80673,7 @@ var _ = Describe(`VpcV1`, func() { createBackupPolicyPlanOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createBackupPolicyPlanOptionsModel).ToNot(BeNil()) Expect(createBackupPolicyPlanOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) - Expect(createBackupPolicyPlanOptionsModel.CronSpec).To(Equal(core.StringPtr("*/5 1,2,3 * * *"))) + Expect(createBackupPolicyPlanOptionsModel.CronSpec).To(Equal(core.StringPtr("30 */2 * * 1-5"))) Expect(createBackupPolicyPlanOptionsModel.Active).To(Equal(core.BoolPtr(true))) Expect(createBackupPolicyPlanOptionsModel.AttachUserTags).To(Equal([]string{"my-daily-backup-plan"})) Expect(createBackupPolicyPlanOptionsModel.CopyUserTags).To(Equal(core.BoolPtr(true))) @@ -81462,21 +81462,21 @@ var _ = Describe(`VpcV1`, func() { resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") Expect(resourceGroupIdentityModel.ID).To(Equal(core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345"))) - // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID model - volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) - Expect(volumeAttachmentVolumePrototypeInstanceContextModel).ToNot(BeNil()) - volumeAttachmentVolumePrototypeInstanceContextModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - Expect(volumeAttachmentVolumePrototypeInstanceContextModel.ID).To(Equal(core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5"))) - - // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model - volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) - Expect(volumeAttachmentPrototypeInstanceContextModel).ToNot(BeNil()) - volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel - Expect(volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete).To(Equal(core.BoolPtr(true))) - Expect(volumeAttachmentPrototypeInstanceContextModel.Name).To(Equal(core.StringPtr("my-volume-attachment"))) - Expect(volumeAttachmentPrototypeInstanceContextModel.Volume).To(Equal(volumeAttachmentVolumePrototypeInstanceContextModel)) + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + Expect(volumeAttachmentPrototypeVolumeModel).ToNot(BeNil()) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + Expect(volumeAttachmentPrototypeVolumeModel.ID).To(Equal(core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5"))) + + // Construct an instance of the VolumeAttachmentPrototype model + volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) + Expect(volumeAttachmentPrototypeModel).ToNot(BeNil()) + volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel + Expect(volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete).To(Equal(core.BoolPtr(false))) + Expect(volumeAttachmentPrototypeModel.Name).To(Equal(core.StringPtr("my-volume-attachment"))) + Expect(volumeAttachmentPrototypeModel.Volume).To(Equal(volumeAttachmentPrototypeVolumeModel)) // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -81548,7 +81548,7 @@ var _ = Describe(`VpcV1`, func() { instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) instancePrototypeModel.UserData = core.StringPtr("testString") - instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} instancePrototypeModel.VPC = vpcIdentityModel instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel instancePrototypeModel.Image = imageIdentityModel @@ -81565,7 +81565,7 @@ var _ = Describe(`VpcV1`, func() { Expect(instancePrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) Expect(instancePrototypeModel.TotalVolumeBandwidth).To(Equal(core.Int64Ptr(int64(500)))) Expect(instancePrototypeModel.UserData).To(Equal(core.StringPtr("testString"))) - Expect(instancePrototypeModel.VolumeAttachments).To(Equal([]vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel})) + Expect(instancePrototypeModel.VolumeAttachments).To(Equal([]vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel})) Expect(instancePrototypeModel.VPC).To(Equal(vpcIdentityModel)) Expect(instancePrototypeModel.BootVolumeAttachment).To(Equal(volumeAttachmentPrototypeInstanceByImageContextModel)) Expect(instancePrototypeModel.Image).To(Equal(imageIdentityModel)) @@ -81668,21 +81668,21 @@ var _ = Describe(`VpcV1`, func() { resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") Expect(resourceGroupIdentityModel.ID).To(Equal(core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345"))) - // Construct an instance of the VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID model - volumeAttachmentVolumePrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) - Expect(volumeAttachmentVolumePrototypeInstanceContextModel).ToNot(BeNil()) - volumeAttachmentVolumePrototypeInstanceContextModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - Expect(volumeAttachmentVolumePrototypeInstanceContextModel.ID).To(Equal(core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5"))) - - // Construct an instance of the VolumeAttachmentPrototypeInstanceContext model - volumeAttachmentPrototypeInstanceContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceContext) - Expect(volumeAttachmentPrototypeInstanceContextModel).ToNot(BeNil()) - volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceContextModel.Volume = volumeAttachmentVolumePrototypeInstanceContextModel - Expect(volumeAttachmentPrototypeInstanceContextModel.DeleteVolumeOnInstanceDelete).To(Equal(core.BoolPtr(true))) - Expect(volumeAttachmentPrototypeInstanceContextModel.Name).To(Equal(core.StringPtr("my-volume-attachment"))) - Expect(volumeAttachmentPrototypeInstanceContextModel.Volume).To(Equal(volumeAttachmentVolumePrototypeInstanceContextModel)) + // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model + volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + Expect(volumeAttachmentPrototypeVolumeModel).ToNot(BeNil()) + volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") + Expect(volumeAttachmentPrototypeVolumeModel.ID).To(Equal(core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5"))) + + // Construct an instance of the VolumeAttachmentPrototype model + volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) + Expect(volumeAttachmentPrototypeModel).ToNot(BeNil()) + volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) + volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") + volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel + Expect(volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete).To(Equal(core.BoolPtr(false))) + Expect(volumeAttachmentPrototypeModel.Name).To(Equal(core.StringPtr("my-volume-attachment"))) + Expect(volumeAttachmentPrototypeModel.Volume).To(Equal(volumeAttachmentPrototypeVolumeModel)) // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) @@ -81754,7 +81754,7 @@ var _ = Describe(`VpcV1`, func() { instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") - instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel} + instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} instanceTemplatePrototypeModel.VPC = vpcIdentityModel instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel instanceTemplatePrototypeModel.Image = imageIdentityModel @@ -81771,7 +81771,7 @@ var _ = Describe(`VpcV1`, func() { Expect(instanceTemplatePrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) Expect(instanceTemplatePrototypeModel.TotalVolumeBandwidth).To(Equal(core.Int64Ptr(int64(500)))) Expect(instanceTemplatePrototypeModel.UserData).To(Equal(core.StringPtr("testString"))) - Expect(instanceTemplatePrototypeModel.VolumeAttachments).To(Equal([]vpcv1.VolumeAttachmentPrototypeInstanceContext{*volumeAttachmentPrototypeInstanceContextModel})) + Expect(instanceTemplatePrototypeModel.VolumeAttachments).To(Equal([]vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel})) Expect(instanceTemplatePrototypeModel.VPC).To(Equal(vpcIdentityModel)) Expect(instanceTemplatePrototypeModel.BootVolumeAttachment).To(Equal(volumeAttachmentPrototypeInstanceByImageContextModel)) Expect(instanceTemplatePrototypeModel.Image).To(Equal(imageIdentityModel)) @@ -82739,14 +82739,14 @@ var _ = Describe(`VpcV1`, func() { createVPCAddressPrefixOptionsModel.SetCIDR("10.0.0.0/24") createVPCAddressPrefixOptionsModel.SetZone(zoneIdentityModel) createVPCAddressPrefixOptionsModel.SetIsDefault(true) - createVPCAddressPrefixOptionsModel.SetName("my-address-prefix-2") + createVPCAddressPrefixOptionsModel.SetName("my-address-prefix-1") createVPCAddressPrefixOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createVPCAddressPrefixOptionsModel).ToNot(BeNil()) Expect(createVPCAddressPrefixOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(createVPCAddressPrefixOptionsModel.CIDR).To(Equal(core.StringPtr("10.0.0.0/24"))) Expect(createVPCAddressPrefixOptionsModel.Zone).To(Equal(zoneIdentityModel)) Expect(createVPCAddressPrefixOptionsModel.IsDefault).To(Equal(core.BoolPtr(true))) - Expect(createVPCAddressPrefixOptionsModel.Name).To(Equal(core.StringPtr("my-address-prefix-2"))) + Expect(createVPCAddressPrefixOptionsModel.Name).To(Equal(core.StringPtr("my-address-prefix-1"))) Expect(createVPCAddressPrefixOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateVPCOptions successfully`, func() { @@ -85905,15 +85905,15 @@ var _ = Describe(`VpcV1`, func() { It(`Invoke NewUpdateBackupPolicyOptions successfully`, func() { // Construct an instance of the UpdateBackupPolicyOptions model id := "testString" - backupPolicyPatch := make(map[string]interface{}) + backupPolicyPatch := map[string]interface{}{"anyKey": "anyValue"} updateBackupPolicyOptionsModel := vpcService.NewUpdateBackupPolicyOptions(id, backupPolicyPatch) updateBackupPolicyOptionsModel.SetID("testString") - updateBackupPolicyOptionsModel.SetBackupPolicyPatch(make(map[string]interface{})) + updateBackupPolicyOptionsModel.SetBackupPolicyPatch(map[string]interface{}{"anyKey": "anyValue"}) updateBackupPolicyOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateBackupPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateBackupPolicyOptionsModel).ToNot(BeNil()) Expect(updateBackupPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateBackupPolicyOptionsModel.BackupPolicyPatch).To(Equal(make(map[string]interface{}))) + Expect(updateBackupPolicyOptionsModel.BackupPolicyPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateBackupPolicyOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(updateBackupPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -85921,17 +85921,17 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the UpdateBackupPolicyPlanOptions model backupPolicyID := "testString" id := "testString" - backupPolicyPlanPatch := make(map[string]interface{}) + backupPolicyPlanPatch := map[string]interface{}{"anyKey": "anyValue"} updateBackupPolicyPlanOptionsModel := vpcService.NewUpdateBackupPolicyPlanOptions(backupPolicyID, id, backupPolicyPlanPatch) updateBackupPolicyPlanOptionsModel.SetBackupPolicyID("testString") updateBackupPolicyPlanOptionsModel.SetID("testString") - updateBackupPolicyPlanOptionsModel.SetBackupPolicyPlanPatch(make(map[string]interface{})) + updateBackupPolicyPlanOptionsModel.SetBackupPolicyPlanPatch(map[string]interface{}{"anyKey": "anyValue"}) updateBackupPolicyPlanOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateBackupPolicyPlanOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateBackupPolicyPlanOptionsModel).ToNot(BeNil()) Expect(updateBackupPolicyPlanOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) Expect(updateBackupPolicyPlanOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch).To(Equal(make(map[string]interface{}))) + Expect(updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateBackupPolicyPlanOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(updateBackupPolicyPlanOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -85939,168 +85939,168 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the UpdateBareMetalServerDiskOptions model bareMetalServerID := "testString" id := "testString" - bareMetalServerDiskPatch := make(map[string]interface{}) + bareMetalServerDiskPatch := map[string]interface{}{"anyKey": "anyValue"} updateBareMetalServerDiskOptionsModel := vpcService.NewUpdateBareMetalServerDiskOptions(bareMetalServerID, id, bareMetalServerDiskPatch) updateBareMetalServerDiskOptionsModel.SetBareMetalServerID("testString") updateBareMetalServerDiskOptionsModel.SetID("testString") - updateBareMetalServerDiskOptionsModel.SetBareMetalServerDiskPatch(make(map[string]interface{})) + updateBareMetalServerDiskOptionsModel.SetBareMetalServerDiskPatch(map[string]interface{}{"anyKey": "anyValue"}) updateBareMetalServerDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateBareMetalServerDiskOptionsModel).ToNot(BeNil()) Expect(updateBareMetalServerDiskOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) Expect(updateBareMetalServerDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch).To(Equal(make(map[string]interface{}))) + Expect(updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateBareMetalServerDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateBareMetalServerNetworkInterfaceOptions successfully`, func() { // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model bareMetalServerID := "testString" id := "testString" - bareMetalServerNetworkInterfacePatch := make(map[string]interface{}) + bareMetalServerNetworkInterfacePatch := map[string]interface{}{"anyKey": "anyValue"} updateBareMetalServerNetworkInterfaceOptionsModel := vpcService.NewUpdateBareMetalServerNetworkInterfaceOptions(bareMetalServerID, id, bareMetalServerNetworkInterfacePatch) updateBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerID("testString") updateBareMetalServerNetworkInterfaceOptionsModel.SetID("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerNetworkInterfacePatch(make(map[string]interface{})) + updateBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerNetworkInterfacePatch(map[string]interface{}{"anyKey": "anyValue"}) updateBareMetalServerNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateBareMetalServerNetworkInterfaceOptionsModel).ToNot(BeNil()) Expect(updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) Expect(updateBareMetalServerNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch).To(Equal(make(map[string]interface{}))) + Expect(updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateBareMetalServerNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateBareMetalServerOptions successfully`, func() { // Construct an instance of the UpdateBareMetalServerOptions model id := "testString" - bareMetalServerPatch := make(map[string]interface{}) + bareMetalServerPatch := map[string]interface{}{"anyKey": "anyValue"} updateBareMetalServerOptionsModel := vpcService.NewUpdateBareMetalServerOptions(id, bareMetalServerPatch) updateBareMetalServerOptionsModel.SetID("testString") - updateBareMetalServerOptionsModel.SetBareMetalServerPatch(make(map[string]interface{})) + updateBareMetalServerOptionsModel.SetBareMetalServerPatch(map[string]interface{}{"anyKey": "anyValue"}) updateBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateBareMetalServerOptionsModel).ToNot(BeNil()) Expect(updateBareMetalServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateBareMetalServerOptionsModel.BareMetalServerPatch).To(Equal(make(map[string]interface{}))) + Expect(updateBareMetalServerOptionsModel.BareMetalServerPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateDedicatedHostDiskOptions successfully`, func() { // Construct an instance of the UpdateDedicatedHostDiskOptions model dedicatedHostID := "testString" id := "testString" - dedicatedHostDiskPatch := make(map[string]interface{}) + dedicatedHostDiskPatch := map[string]interface{}{"anyKey": "anyValue"} updateDedicatedHostDiskOptionsModel := vpcService.NewUpdateDedicatedHostDiskOptions(dedicatedHostID, id, dedicatedHostDiskPatch) updateDedicatedHostDiskOptionsModel.SetDedicatedHostID("testString") updateDedicatedHostDiskOptionsModel.SetID("testString") - updateDedicatedHostDiskOptionsModel.SetDedicatedHostDiskPatch(make(map[string]interface{})) + updateDedicatedHostDiskOptionsModel.SetDedicatedHostDiskPatch(map[string]interface{}{"anyKey": "anyValue"}) updateDedicatedHostDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateDedicatedHostDiskOptionsModel).ToNot(BeNil()) Expect(updateDedicatedHostDiskOptionsModel.DedicatedHostID).To(Equal(core.StringPtr("testString"))) Expect(updateDedicatedHostDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch).To(Equal(make(map[string]interface{}))) + Expect(updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateDedicatedHostDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateDedicatedHostGroupOptions successfully`, func() { // Construct an instance of the UpdateDedicatedHostGroupOptions model id := "testString" - dedicatedHostGroupPatch := make(map[string]interface{}) + dedicatedHostGroupPatch := map[string]interface{}{"anyKey": "anyValue"} updateDedicatedHostGroupOptionsModel := vpcService.NewUpdateDedicatedHostGroupOptions(id, dedicatedHostGroupPatch) updateDedicatedHostGroupOptionsModel.SetID("testString") - updateDedicatedHostGroupOptionsModel.SetDedicatedHostGroupPatch(make(map[string]interface{})) + updateDedicatedHostGroupOptionsModel.SetDedicatedHostGroupPatch(map[string]interface{}{"anyKey": "anyValue"}) updateDedicatedHostGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateDedicatedHostGroupOptionsModel).ToNot(BeNil()) Expect(updateDedicatedHostGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch).To(Equal(make(map[string]interface{}))) + Expect(updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateDedicatedHostGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateDedicatedHostOptions successfully`, func() { // Construct an instance of the UpdateDedicatedHostOptions model id := "testString" - dedicatedHostPatch := make(map[string]interface{}) + dedicatedHostPatch := map[string]interface{}{"anyKey": "anyValue"} updateDedicatedHostOptionsModel := vpcService.NewUpdateDedicatedHostOptions(id, dedicatedHostPatch) updateDedicatedHostOptionsModel.SetID("testString") - updateDedicatedHostOptionsModel.SetDedicatedHostPatch(make(map[string]interface{})) + updateDedicatedHostOptionsModel.SetDedicatedHostPatch(map[string]interface{}{"anyKey": "anyValue"}) updateDedicatedHostOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateDedicatedHostOptionsModel).ToNot(BeNil()) Expect(updateDedicatedHostOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateDedicatedHostOptionsModel.DedicatedHostPatch).To(Equal(make(map[string]interface{}))) + Expect(updateDedicatedHostOptionsModel.DedicatedHostPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateDedicatedHostOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateEndpointGatewayOptions successfully`, func() { // Construct an instance of the UpdateEndpointGatewayOptions model id := "testString" - endpointGatewayPatch := make(map[string]interface{}) + endpointGatewayPatch := map[string]interface{}{"anyKey": "anyValue"} updateEndpointGatewayOptionsModel := vpcService.NewUpdateEndpointGatewayOptions(id, endpointGatewayPatch) updateEndpointGatewayOptionsModel.SetID("testString") - updateEndpointGatewayOptionsModel.SetEndpointGatewayPatch(make(map[string]interface{})) + updateEndpointGatewayOptionsModel.SetEndpointGatewayPatch(map[string]interface{}{"anyKey": "anyValue"}) updateEndpointGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateEndpointGatewayOptionsModel).ToNot(BeNil()) Expect(updateEndpointGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateEndpointGatewayOptionsModel.EndpointGatewayPatch).To(Equal(make(map[string]interface{}))) + Expect(updateEndpointGatewayOptionsModel.EndpointGatewayPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateEndpointGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateFloatingIPOptions successfully`, func() { // Construct an instance of the UpdateFloatingIPOptions model id := "testString" - floatingIPPatch := make(map[string]interface{}) + floatingIPPatch := map[string]interface{}{"anyKey": "anyValue"} updateFloatingIPOptionsModel := vpcService.NewUpdateFloatingIPOptions(id, floatingIPPatch) updateFloatingIPOptionsModel.SetID("testString") - updateFloatingIPOptionsModel.SetFloatingIPPatch(make(map[string]interface{})) + updateFloatingIPOptionsModel.SetFloatingIPPatch(map[string]interface{}{"anyKey": "anyValue"}) updateFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateFloatingIPOptionsModel).ToNot(BeNil()) Expect(updateFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateFloatingIPOptionsModel.FloatingIPPatch).To(Equal(make(map[string]interface{}))) + Expect(updateFloatingIPOptionsModel.FloatingIPPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateFlowLogCollectorOptions successfully`, func() { // Construct an instance of the UpdateFlowLogCollectorOptions model id := "testString" - flowLogCollectorPatch := make(map[string]interface{}) + flowLogCollectorPatch := map[string]interface{}{"anyKey": "anyValue"} updateFlowLogCollectorOptionsModel := vpcService.NewUpdateFlowLogCollectorOptions(id, flowLogCollectorPatch) updateFlowLogCollectorOptionsModel.SetID("testString") - updateFlowLogCollectorOptionsModel.SetFlowLogCollectorPatch(make(map[string]interface{})) + updateFlowLogCollectorOptionsModel.SetFlowLogCollectorPatch(map[string]interface{}{"anyKey": "anyValue"}) updateFlowLogCollectorOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateFlowLogCollectorOptionsModel).ToNot(BeNil()) Expect(updateFlowLogCollectorOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateFlowLogCollectorOptionsModel.FlowLogCollectorPatch).To(Equal(make(map[string]interface{}))) + Expect(updateFlowLogCollectorOptionsModel.FlowLogCollectorPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateFlowLogCollectorOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateIkePolicyOptions successfully`, func() { // Construct an instance of the UpdateIkePolicyOptions model id := "testString" - ikePolicyPatch := make(map[string]interface{}) + ikePolicyPatch := map[string]interface{}{"anyKey": "anyValue"} updateIkePolicyOptionsModel := vpcService.NewUpdateIkePolicyOptions(id, ikePolicyPatch) updateIkePolicyOptionsModel.SetID("testString") - updateIkePolicyOptionsModel.SetIkePolicyPatch(make(map[string]interface{})) + updateIkePolicyOptionsModel.SetIkePolicyPatch(map[string]interface{}{"anyKey": "anyValue"}) updateIkePolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateIkePolicyOptionsModel).ToNot(BeNil()) Expect(updateIkePolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateIkePolicyOptionsModel.IkePolicyPatch).To(Equal(make(map[string]interface{}))) + Expect(updateIkePolicyOptionsModel.IkePolicyPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateIkePolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateImageOptions successfully`, func() { // Construct an instance of the UpdateImageOptions model id := "testString" - imagePatch := make(map[string]interface{}) + imagePatch := map[string]interface{}{"anyKey": "anyValue"} updateImageOptionsModel := vpcService.NewUpdateImageOptions(id, imagePatch) updateImageOptionsModel.SetID("testString") - updateImageOptionsModel.SetImagePatch(make(map[string]interface{})) + updateImageOptionsModel.SetImagePatch(map[string]interface{}{"anyKey": "anyValue"}) updateImageOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateImageOptionsModel).ToNot(BeNil()) Expect(updateImageOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateImageOptionsModel.ImagePatch).To(Equal(make(map[string]interface{}))) + Expect(updateImageOptionsModel.ImagePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateImageOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateInstanceDiskOptions successfully`, func() { // Construct an instance of the UpdateInstanceDiskOptions model instanceID := "testString" id := "testString" - instanceDiskPatch := make(map[string]interface{}) + instanceDiskPatch := map[string]interface{}{"anyKey": "anyValue"} updateInstanceDiskOptionsModel := vpcService.NewUpdateInstanceDiskOptions(instanceID, id, instanceDiskPatch) updateInstanceDiskOptionsModel.SetInstanceID("testString") updateInstanceDiskOptionsModel.SetID("testString") - updateInstanceDiskOptionsModel.SetInstanceDiskPatch(make(map[string]interface{})) + updateInstanceDiskOptionsModel.SetInstanceDiskPatch(map[string]interface{}{"anyKey": "anyValue"}) updateInstanceDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateInstanceDiskOptionsModel).ToNot(BeNil()) Expect(updateInstanceDiskOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) Expect(updateInstanceDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceDiskOptionsModel.InstanceDiskPatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceDiskOptionsModel.InstanceDiskPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateInstanceDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateInstanceGroupManagerActionOptions successfully`, func() { @@ -86108,34 +86108,34 @@ var _ = Describe(`VpcV1`, func() { instanceGroupID := "testString" instanceGroupManagerID := "testString" id := "testString" - instanceGroupManagerActionPatch := make(map[string]interface{}) + instanceGroupManagerActionPatch := map[string]interface{}{"anyKey": "anyValue"} updateInstanceGroupManagerActionOptionsModel := vpcService.NewUpdateInstanceGroupManagerActionOptions(instanceGroupID, instanceGroupManagerID, id, instanceGroupManagerActionPatch) updateInstanceGroupManagerActionOptionsModel.SetInstanceGroupID("testString") updateInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerID("testString") updateInstanceGroupManagerActionOptionsModel.SetID("testString") - updateInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerActionPatch(make(map[string]interface{})) + updateInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerActionPatch(map[string]interface{}{"anyKey": "anyValue"}) updateInstanceGroupManagerActionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateInstanceGroupManagerActionOptionsModel).ToNot(BeNil()) Expect(updateInstanceGroupManagerActionOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) Expect(updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) Expect(updateInstanceGroupManagerActionOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateInstanceGroupManagerActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateInstanceGroupManagerOptions successfully`, func() { // Construct an instance of the UpdateInstanceGroupManagerOptions model instanceGroupID := "testString" id := "testString" - instanceGroupManagerPatch := make(map[string]interface{}) + instanceGroupManagerPatch := map[string]interface{}{"anyKey": "anyValue"} updateInstanceGroupManagerOptionsModel := vpcService.NewUpdateInstanceGroupManagerOptions(instanceGroupID, id, instanceGroupManagerPatch) updateInstanceGroupManagerOptionsModel.SetInstanceGroupID("testString") updateInstanceGroupManagerOptionsModel.SetID("testString") - updateInstanceGroupManagerOptionsModel.SetInstanceGroupManagerPatch(make(map[string]interface{})) + updateInstanceGroupManagerOptionsModel.SetInstanceGroupManagerPatch(map[string]interface{}{"anyKey": "anyValue"}) updateInstanceGroupManagerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateInstanceGroupManagerOptionsModel).ToNot(BeNil()) Expect(updateInstanceGroupManagerOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) Expect(updateInstanceGroupManagerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateInstanceGroupManagerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateInstanceGroupManagerPolicyOptions successfully`, func() { @@ -86143,147 +86143,147 @@ var _ = Describe(`VpcV1`, func() { instanceGroupID := "testString" instanceGroupManagerID := "testString" id := "testString" - instanceGroupManagerPolicyPatch := make(map[string]interface{}) + instanceGroupManagerPolicyPatch := map[string]interface{}{"anyKey": "anyValue"} updateInstanceGroupManagerPolicyOptionsModel := vpcService.NewUpdateInstanceGroupManagerPolicyOptions(instanceGroupID, instanceGroupManagerID, id, instanceGroupManagerPolicyPatch) updateInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupID("testString") updateInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerID("testString") updateInstanceGroupManagerPolicyOptionsModel.SetID("testString") - updateInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerPolicyPatch(make(map[string]interface{})) + updateInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerPolicyPatch(map[string]interface{}{"anyKey": "anyValue"}) updateInstanceGroupManagerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateInstanceGroupManagerPolicyOptionsModel).ToNot(BeNil()) Expect(updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) Expect(updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) Expect(updateInstanceGroupManagerPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateInstanceGroupManagerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateInstanceGroupMembershipOptions successfully`, func() { // Construct an instance of the UpdateInstanceGroupMembershipOptions model instanceGroupID := "testString" id := "testString" - instanceGroupMembershipPatch := make(map[string]interface{}) + instanceGroupMembershipPatch := map[string]interface{}{"anyKey": "anyValue"} updateInstanceGroupMembershipOptionsModel := vpcService.NewUpdateInstanceGroupMembershipOptions(instanceGroupID, id, instanceGroupMembershipPatch) updateInstanceGroupMembershipOptionsModel.SetInstanceGroupID("testString") updateInstanceGroupMembershipOptionsModel.SetID("testString") - updateInstanceGroupMembershipOptionsModel.SetInstanceGroupMembershipPatch(make(map[string]interface{})) + updateInstanceGroupMembershipOptionsModel.SetInstanceGroupMembershipPatch(map[string]interface{}{"anyKey": "anyValue"}) updateInstanceGroupMembershipOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateInstanceGroupMembershipOptionsModel).ToNot(BeNil()) Expect(updateInstanceGroupMembershipOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) Expect(updateInstanceGroupMembershipOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateInstanceGroupMembershipOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateInstanceGroupOptions successfully`, func() { // Construct an instance of the UpdateInstanceGroupOptions model id := "testString" - instanceGroupPatch := make(map[string]interface{}) + instanceGroupPatch := map[string]interface{}{"anyKey": "anyValue"} updateInstanceGroupOptionsModel := vpcService.NewUpdateInstanceGroupOptions(id, instanceGroupPatch) updateInstanceGroupOptionsModel.SetID("testString") - updateInstanceGroupOptionsModel.SetInstanceGroupPatch(make(map[string]interface{})) + updateInstanceGroupOptionsModel.SetInstanceGroupPatch(map[string]interface{}{"anyKey": "anyValue"}) updateInstanceGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateInstanceGroupOptionsModel).ToNot(BeNil()) Expect(updateInstanceGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupOptionsModel.InstanceGroupPatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceGroupOptionsModel.InstanceGroupPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateInstanceGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateInstanceNetworkInterfaceOptions successfully`, func() { // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model instanceID := "testString" id := "testString" - networkInterfacePatch := make(map[string]interface{}) + networkInterfacePatch := map[string]interface{}{"anyKey": "anyValue"} updateInstanceNetworkInterfaceOptionsModel := vpcService.NewUpdateInstanceNetworkInterfaceOptions(instanceID, id, networkInterfacePatch) updateInstanceNetworkInterfaceOptionsModel.SetInstanceID("testString") updateInstanceNetworkInterfaceOptionsModel.SetID("testString") - updateInstanceNetworkInterfaceOptionsModel.SetNetworkInterfacePatch(make(map[string]interface{})) + updateInstanceNetworkInterfaceOptionsModel.SetNetworkInterfacePatch(map[string]interface{}{"anyKey": "anyValue"}) updateInstanceNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateInstanceNetworkInterfaceOptionsModel).ToNot(BeNil()) Expect(updateInstanceNetworkInterfaceOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) Expect(updateInstanceNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateInstanceNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateInstanceOptions successfully`, func() { // Construct an instance of the UpdateInstanceOptions model id := "testString" - instancePatch := make(map[string]interface{}) + instancePatch := map[string]interface{}{"anyKey": "anyValue"} updateInstanceOptionsModel := vpcService.NewUpdateInstanceOptions(id, instancePatch) updateInstanceOptionsModel.SetID("testString") - updateInstanceOptionsModel.SetInstancePatch(make(map[string]interface{})) + updateInstanceOptionsModel.SetInstancePatch(map[string]interface{}{"anyKey": "anyValue"}) updateInstanceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateInstanceOptionsModel).ToNot(BeNil()) Expect(updateInstanceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceOptionsModel.InstancePatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceOptionsModel.InstancePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateInstanceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateInstanceTemplateOptions successfully`, func() { // Construct an instance of the UpdateInstanceTemplateOptions model id := "testString" - instanceTemplatePatch := make(map[string]interface{}) + instanceTemplatePatch := map[string]interface{}{"anyKey": "anyValue"} updateInstanceTemplateOptionsModel := vpcService.NewUpdateInstanceTemplateOptions(id, instanceTemplatePatch) updateInstanceTemplateOptionsModel.SetID("testString") - updateInstanceTemplateOptionsModel.SetInstanceTemplatePatch(make(map[string]interface{})) + updateInstanceTemplateOptionsModel.SetInstanceTemplatePatch(map[string]interface{}{"anyKey": "anyValue"}) updateInstanceTemplateOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateInstanceTemplateOptionsModel).ToNot(BeNil()) Expect(updateInstanceTemplateOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceTemplateOptionsModel.InstanceTemplatePatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceTemplateOptionsModel.InstanceTemplatePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateInstanceTemplateOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateInstanceVolumeAttachmentOptions successfully`, func() { // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model instanceID := "testString" id := "testString" - volumeAttachmentPatch := make(map[string]interface{}) + volumeAttachmentPatch := map[string]interface{}{"anyKey": "anyValue"} updateInstanceVolumeAttachmentOptionsModel := vpcService.NewUpdateInstanceVolumeAttachmentOptions(instanceID, id, volumeAttachmentPatch) updateInstanceVolumeAttachmentOptionsModel.SetInstanceID("testString") updateInstanceVolumeAttachmentOptionsModel.SetID("testString") - updateInstanceVolumeAttachmentOptionsModel.SetVolumeAttachmentPatch(make(map[string]interface{})) + updateInstanceVolumeAttachmentOptionsModel.SetVolumeAttachmentPatch(map[string]interface{}{"anyKey": "anyValue"}) updateInstanceVolumeAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateInstanceVolumeAttachmentOptionsModel).ToNot(BeNil()) Expect(updateInstanceVolumeAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) Expect(updateInstanceVolumeAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch).To(Equal(make(map[string]interface{}))) + Expect(updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateInstanceVolumeAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateIpsecPolicyOptions successfully`, func() { // Construct an instance of the UpdateIpsecPolicyOptions model id := "testString" - iPsecPolicyPatch := make(map[string]interface{}) + iPsecPolicyPatch := map[string]interface{}{"anyKey": "anyValue"} updateIpsecPolicyOptionsModel := vpcService.NewUpdateIpsecPolicyOptions(id, iPsecPolicyPatch) updateIpsecPolicyOptionsModel.SetID("testString") - updateIpsecPolicyOptionsModel.SetIPsecPolicyPatch(make(map[string]interface{})) + updateIpsecPolicyOptionsModel.SetIPsecPolicyPatch(map[string]interface{}{"anyKey": "anyValue"}) updateIpsecPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateIpsecPolicyOptionsModel).ToNot(BeNil()) Expect(updateIpsecPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateIpsecPolicyOptionsModel.IPsecPolicyPatch).To(Equal(make(map[string]interface{}))) + Expect(updateIpsecPolicyOptionsModel.IPsecPolicyPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateIpsecPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateKeyOptions successfully`, func() { // Construct an instance of the UpdateKeyOptions model id := "testString" - keyPatch := make(map[string]interface{}) + keyPatch := map[string]interface{}{"anyKey": "anyValue"} updateKeyOptionsModel := vpcService.NewUpdateKeyOptions(id, keyPatch) updateKeyOptionsModel.SetID("testString") - updateKeyOptionsModel.SetKeyPatch(make(map[string]interface{})) + updateKeyOptionsModel.SetKeyPatch(map[string]interface{}{"anyKey": "anyValue"}) updateKeyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateKeyOptionsModel).ToNot(BeNil()) Expect(updateKeyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateKeyOptionsModel.KeyPatch).To(Equal(make(map[string]interface{}))) + Expect(updateKeyOptionsModel.KeyPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateKeyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateLoadBalancerListenerOptions successfully`, func() { // Construct an instance of the UpdateLoadBalancerListenerOptions model loadBalancerID := "testString" id := "testString" - loadBalancerListenerPatch := make(map[string]interface{}) + loadBalancerListenerPatch := map[string]interface{}{"anyKey": "anyValue"} updateLoadBalancerListenerOptionsModel := vpcService.NewUpdateLoadBalancerListenerOptions(loadBalancerID, id, loadBalancerListenerPatch) updateLoadBalancerListenerOptionsModel.SetLoadBalancerID("testString") updateLoadBalancerListenerOptionsModel.SetID("testString") - updateLoadBalancerListenerOptionsModel.SetLoadBalancerListenerPatch(make(map[string]interface{})) + updateLoadBalancerListenerOptionsModel.SetLoadBalancerListenerPatch(map[string]interface{}{"anyKey": "anyValue"}) updateLoadBalancerListenerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateLoadBalancerListenerOptionsModel).ToNot(BeNil()) Expect(updateLoadBalancerListenerOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) Expect(updateLoadBalancerListenerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerListenerOptionsModel.LoadBalancerListenerPatch).To(Equal(make(map[string]interface{}))) + Expect(updateLoadBalancerListenerOptionsModel.LoadBalancerListenerPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateLoadBalancerListenerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateLoadBalancerListenerPolicyOptions successfully`, func() { @@ -86291,18 +86291,18 @@ var _ = Describe(`VpcV1`, func() { loadBalancerID := "testString" listenerID := "testString" id := "testString" - loadBalancerListenerPolicyPatch := make(map[string]interface{}) + loadBalancerListenerPolicyPatch := map[string]interface{}{"anyKey": "anyValue"} updateLoadBalancerListenerPolicyOptionsModel := vpcService.NewUpdateLoadBalancerListenerPolicyOptions(loadBalancerID, listenerID, id, loadBalancerListenerPolicyPatch) updateLoadBalancerListenerPolicyOptionsModel.SetLoadBalancerID("testString") updateLoadBalancerListenerPolicyOptionsModel.SetListenerID("testString") updateLoadBalancerListenerPolicyOptionsModel.SetID("testString") - updateLoadBalancerListenerPolicyOptionsModel.SetLoadBalancerListenerPolicyPatch(make(map[string]interface{})) + updateLoadBalancerListenerPolicyOptionsModel.SetLoadBalancerListenerPolicyPatch(map[string]interface{}{"anyKey": "anyValue"}) updateLoadBalancerListenerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateLoadBalancerListenerPolicyOptionsModel).ToNot(BeNil()) Expect(updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) Expect(updateLoadBalancerListenerPolicyOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) Expect(updateLoadBalancerListenerPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerListenerPolicyPatch).To(Equal(make(map[string]interface{}))) + Expect(updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerListenerPolicyPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateLoadBalancerListenerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateLoadBalancerListenerPolicyRuleOptions successfully`, func() { @@ -86311,34 +86311,34 @@ var _ = Describe(`VpcV1`, func() { listenerID := "testString" policyID := "testString" id := "testString" - loadBalancerListenerPolicyRulePatch := make(map[string]interface{}) + loadBalancerListenerPolicyRulePatch := map[string]interface{}{"anyKey": "anyValue"} updateLoadBalancerListenerPolicyRuleOptionsModel := vpcService.NewUpdateLoadBalancerListenerPolicyRuleOptions(loadBalancerID, listenerID, policyID, id, loadBalancerListenerPolicyRulePatch) updateLoadBalancerListenerPolicyRuleOptionsModel.SetLoadBalancerID("testString") updateLoadBalancerListenerPolicyRuleOptionsModel.SetListenerID("testString") updateLoadBalancerListenerPolicyRuleOptionsModel.SetPolicyID("testString") updateLoadBalancerListenerPolicyRuleOptionsModel.SetID("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.SetLoadBalancerListenerPolicyRulePatch(make(map[string]interface{})) + updateLoadBalancerListenerPolicyRuleOptionsModel.SetLoadBalancerListenerPolicyRulePatch(map[string]interface{}{"anyKey": "anyValue"}) updateLoadBalancerListenerPolicyRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateLoadBalancerListenerPolicyRuleOptionsModel).ToNot(BeNil()) Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.PolicyID).To(Equal(core.StringPtr("testString"))) Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerListenerPolicyRulePatch).To(Equal(make(map[string]interface{}))) + Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerListenerPolicyRulePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateLoadBalancerOptions successfully`, func() { // Construct an instance of the UpdateLoadBalancerOptions model id := "testString" - loadBalancerPatch := make(map[string]interface{}) + loadBalancerPatch := map[string]interface{}{"anyKey": "anyValue"} updateLoadBalancerOptionsModel := vpcService.NewUpdateLoadBalancerOptions(id, loadBalancerPatch) updateLoadBalancerOptionsModel.SetID("testString") - updateLoadBalancerOptionsModel.SetLoadBalancerPatch(make(map[string]interface{})) + updateLoadBalancerOptionsModel.SetLoadBalancerPatch(map[string]interface{}{"anyKey": "anyValue"}) updateLoadBalancerOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateLoadBalancerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateLoadBalancerOptionsModel).ToNot(BeNil()) Expect(updateLoadBalancerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerOptionsModel.LoadBalancerPatch).To(Equal(make(map[string]interface{}))) + Expect(updateLoadBalancerOptionsModel.LoadBalancerPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateLoadBalancerOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(updateLoadBalancerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -86347,176 +86347,176 @@ var _ = Describe(`VpcV1`, func() { loadBalancerID := "testString" poolID := "testString" id := "testString" - loadBalancerPoolMemberPatch := make(map[string]interface{}) + loadBalancerPoolMemberPatch := map[string]interface{}{"anyKey": "anyValue"} updateLoadBalancerPoolMemberOptionsModel := vpcService.NewUpdateLoadBalancerPoolMemberOptions(loadBalancerID, poolID, id, loadBalancerPoolMemberPatch) updateLoadBalancerPoolMemberOptionsModel.SetLoadBalancerID("testString") updateLoadBalancerPoolMemberOptionsModel.SetPoolID("testString") updateLoadBalancerPoolMemberOptionsModel.SetID("testString") - updateLoadBalancerPoolMemberOptionsModel.SetLoadBalancerPoolMemberPatch(make(map[string]interface{})) + updateLoadBalancerPoolMemberOptionsModel.SetLoadBalancerPoolMemberPatch(map[string]interface{}{"anyKey": "anyValue"}) updateLoadBalancerPoolMemberOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateLoadBalancerPoolMemberOptionsModel).ToNot(BeNil()) Expect(updateLoadBalancerPoolMemberOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) Expect(updateLoadBalancerPoolMemberOptionsModel.PoolID).To(Equal(core.StringPtr("testString"))) Expect(updateLoadBalancerPoolMemberOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerPoolMemberOptionsModel.LoadBalancerPoolMemberPatch).To(Equal(make(map[string]interface{}))) + Expect(updateLoadBalancerPoolMemberOptionsModel.LoadBalancerPoolMemberPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateLoadBalancerPoolMemberOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateLoadBalancerPoolOptions successfully`, func() { // Construct an instance of the UpdateLoadBalancerPoolOptions model loadBalancerID := "testString" id := "testString" - loadBalancerPoolPatch := make(map[string]interface{}) + loadBalancerPoolPatch := map[string]interface{}{"anyKey": "anyValue"} updateLoadBalancerPoolOptionsModel := vpcService.NewUpdateLoadBalancerPoolOptions(loadBalancerID, id, loadBalancerPoolPatch) updateLoadBalancerPoolOptionsModel.SetLoadBalancerID("testString") updateLoadBalancerPoolOptionsModel.SetID("testString") - updateLoadBalancerPoolOptionsModel.SetLoadBalancerPoolPatch(make(map[string]interface{})) + updateLoadBalancerPoolOptionsModel.SetLoadBalancerPoolPatch(map[string]interface{}{"anyKey": "anyValue"}) updateLoadBalancerPoolOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateLoadBalancerPoolOptionsModel).ToNot(BeNil()) Expect(updateLoadBalancerPoolOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) Expect(updateLoadBalancerPoolOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerPoolOptionsModel.LoadBalancerPoolPatch).To(Equal(make(map[string]interface{}))) + Expect(updateLoadBalancerPoolOptionsModel.LoadBalancerPoolPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateLoadBalancerPoolOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateNetworkACLOptions successfully`, func() { // Construct an instance of the UpdateNetworkACLOptions model id := "testString" - networkACLPatch := make(map[string]interface{}) + networkACLPatch := map[string]interface{}{"anyKey": "anyValue"} updateNetworkACLOptionsModel := vpcService.NewUpdateNetworkACLOptions(id, networkACLPatch) updateNetworkACLOptionsModel.SetID("testString") - updateNetworkACLOptionsModel.SetNetworkACLPatch(make(map[string]interface{})) + updateNetworkACLOptionsModel.SetNetworkACLPatch(map[string]interface{}{"anyKey": "anyValue"}) updateNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateNetworkACLOptionsModel).ToNot(BeNil()) Expect(updateNetworkACLOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateNetworkACLOptionsModel.NetworkACLPatch).To(Equal(make(map[string]interface{}))) + Expect(updateNetworkACLOptionsModel.NetworkACLPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateNetworkACLRuleOptions successfully`, func() { // Construct an instance of the UpdateNetworkACLRuleOptions model networkACLID := "testString" id := "testString" - networkACLRulePatch := make(map[string]interface{}) + networkACLRulePatch := map[string]interface{}{"anyKey": "anyValue"} updateNetworkACLRuleOptionsModel := vpcService.NewUpdateNetworkACLRuleOptions(networkACLID, id, networkACLRulePatch) updateNetworkACLRuleOptionsModel.SetNetworkACLID("testString") updateNetworkACLRuleOptionsModel.SetID("testString") - updateNetworkACLRuleOptionsModel.SetNetworkACLRulePatch(make(map[string]interface{})) + updateNetworkACLRuleOptionsModel.SetNetworkACLRulePatch(map[string]interface{}{"anyKey": "anyValue"}) updateNetworkACLRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateNetworkACLRuleOptionsModel).ToNot(BeNil()) Expect(updateNetworkACLRuleOptionsModel.NetworkACLID).To(Equal(core.StringPtr("testString"))) Expect(updateNetworkACLRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateNetworkACLRuleOptionsModel.NetworkACLRulePatch).To(Equal(make(map[string]interface{}))) + Expect(updateNetworkACLRuleOptionsModel.NetworkACLRulePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateNetworkACLRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdatePlacementGroupOptions successfully`, func() { // Construct an instance of the UpdatePlacementGroupOptions model id := "testString" - placementGroupPatch := make(map[string]interface{}) + placementGroupPatch := map[string]interface{}{"anyKey": "anyValue"} updatePlacementGroupOptionsModel := vpcService.NewUpdatePlacementGroupOptions(id, placementGroupPatch) updatePlacementGroupOptionsModel.SetID("testString") - updatePlacementGroupOptionsModel.SetPlacementGroupPatch(make(map[string]interface{})) + updatePlacementGroupOptionsModel.SetPlacementGroupPatch(map[string]interface{}{"anyKey": "anyValue"}) updatePlacementGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updatePlacementGroupOptionsModel).ToNot(BeNil()) Expect(updatePlacementGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updatePlacementGroupOptionsModel.PlacementGroupPatch).To(Equal(make(map[string]interface{}))) + Expect(updatePlacementGroupOptionsModel.PlacementGroupPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updatePlacementGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdatePublicGatewayOptions successfully`, func() { // Construct an instance of the UpdatePublicGatewayOptions model id := "testString" - publicGatewayPatch := make(map[string]interface{}) + publicGatewayPatch := map[string]interface{}{"anyKey": "anyValue"} updatePublicGatewayOptionsModel := vpcService.NewUpdatePublicGatewayOptions(id, publicGatewayPatch) updatePublicGatewayOptionsModel.SetID("testString") - updatePublicGatewayOptionsModel.SetPublicGatewayPatch(make(map[string]interface{})) + updatePublicGatewayOptionsModel.SetPublicGatewayPatch(map[string]interface{}{"anyKey": "anyValue"}) updatePublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updatePublicGatewayOptionsModel).ToNot(BeNil()) Expect(updatePublicGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updatePublicGatewayOptionsModel.PublicGatewayPatch).To(Equal(make(map[string]interface{}))) + Expect(updatePublicGatewayOptionsModel.PublicGatewayPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updatePublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateSecurityGroupOptions successfully`, func() { // Construct an instance of the UpdateSecurityGroupOptions model id := "testString" - securityGroupPatch := make(map[string]interface{}) + securityGroupPatch := map[string]interface{}{"anyKey": "anyValue"} updateSecurityGroupOptionsModel := vpcService.NewUpdateSecurityGroupOptions(id, securityGroupPatch) updateSecurityGroupOptionsModel.SetID("testString") - updateSecurityGroupOptionsModel.SetSecurityGroupPatch(make(map[string]interface{})) + updateSecurityGroupOptionsModel.SetSecurityGroupPatch(map[string]interface{}{"anyKey": "anyValue"}) updateSecurityGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateSecurityGroupOptionsModel).ToNot(BeNil()) Expect(updateSecurityGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateSecurityGroupOptionsModel.SecurityGroupPatch).To(Equal(make(map[string]interface{}))) + Expect(updateSecurityGroupOptionsModel.SecurityGroupPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateSecurityGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateSecurityGroupRuleOptions successfully`, func() { // Construct an instance of the UpdateSecurityGroupRuleOptions model securityGroupID := "testString" id := "testString" - securityGroupRulePatch := make(map[string]interface{}) + securityGroupRulePatch := map[string]interface{}{"anyKey": "anyValue"} updateSecurityGroupRuleOptionsModel := vpcService.NewUpdateSecurityGroupRuleOptions(securityGroupID, id, securityGroupRulePatch) updateSecurityGroupRuleOptionsModel.SetSecurityGroupID("testString") updateSecurityGroupRuleOptionsModel.SetID("testString") - updateSecurityGroupRuleOptionsModel.SetSecurityGroupRulePatch(make(map[string]interface{})) + updateSecurityGroupRuleOptionsModel.SetSecurityGroupRulePatch(map[string]interface{}{"anyKey": "anyValue"}) updateSecurityGroupRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateSecurityGroupRuleOptionsModel).ToNot(BeNil()) Expect(updateSecurityGroupRuleOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) Expect(updateSecurityGroupRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateSecurityGroupRuleOptionsModel.SecurityGroupRulePatch).To(Equal(make(map[string]interface{}))) + Expect(updateSecurityGroupRuleOptionsModel.SecurityGroupRulePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateSecurityGroupRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateSnapshotOptions successfully`, func() { // Construct an instance of the UpdateSnapshotOptions model id := "testString" - snapshotPatch := make(map[string]interface{}) + snapshotPatch := map[string]interface{}{"anyKey": "anyValue"} updateSnapshotOptionsModel := vpcService.NewUpdateSnapshotOptions(id, snapshotPatch) updateSnapshotOptionsModel.SetID("testString") - updateSnapshotOptionsModel.SetSnapshotPatch(make(map[string]interface{})) + updateSnapshotOptionsModel.SetSnapshotPatch(map[string]interface{}{"anyKey": "anyValue"}) updateSnapshotOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateSnapshotOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateSnapshotOptionsModel).ToNot(BeNil()) Expect(updateSnapshotOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateSnapshotOptionsModel.SnapshotPatch).To(Equal(make(map[string]interface{}))) + Expect(updateSnapshotOptionsModel.SnapshotPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateSnapshotOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(updateSnapshotOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateSubnetOptions successfully`, func() { // Construct an instance of the UpdateSubnetOptions model id := "testString" - subnetPatch := make(map[string]interface{}) + subnetPatch := map[string]interface{}{"anyKey": "anyValue"} updateSubnetOptionsModel := vpcService.NewUpdateSubnetOptions(id, subnetPatch) updateSubnetOptionsModel.SetID("testString") - updateSubnetOptionsModel.SetSubnetPatch(make(map[string]interface{})) + updateSubnetOptionsModel.SetSubnetPatch(map[string]interface{}{"anyKey": "anyValue"}) updateSubnetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateSubnetOptionsModel).ToNot(BeNil()) Expect(updateSubnetOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateSubnetOptionsModel.SubnetPatch).To(Equal(make(map[string]interface{}))) + Expect(updateSubnetOptionsModel.SubnetPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateSubnetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateSubnetReservedIPOptions successfully`, func() { // Construct an instance of the UpdateSubnetReservedIPOptions model subnetID := "testString" id := "testString" - reservedIPPatch := make(map[string]interface{}) + reservedIPPatch := map[string]interface{}{"anyKey": "anyValue"} updateSubnetReservedIPOptionsModel := vpcService.NewUpdateSubnetReservedIPOptions(subnetID, id, reservedIPPatch) updateSubnetReservedIPOptionsModel.SetSubnetID("testString") updateSubnetReservedIPOptionsModel.SetID("testString") - updateSubnetReservedIPOptionsModel.SetReservedIPPatch(make(map[string]interface{})) + updateSubnetReservedIPOptionsModel.SetReservedIPPatch(map[string]interface{}{"anyKey": "anyValue"}) updateSubnetReservedIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateSubnetReservedIPOptionsModel).ToNot(BeNil()) Expect(updateSubnetReservedIPOptionsModel.SubnetID).To(Equal(core.StringPtr("testString"))) Expect(updateSubnetReservedIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateSubnetReservedIPOptionsModel.ReservedIPPatch).To(Equal(make(map[string]interface{}))) + Expect(updateSubnetReservedIPOptionsModel.ReservedIPPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateVolumeOptions successfully`, func() { // Construct an instance of the UpdateVolumeOptions model id := "testString" - volumePatch := make(map[string]interface{}) + volumePatch := map[string]interface{}{"anyKey": "anyValue"} updateVolumeOptionsModel := vpcService.NewUpdateVolumeOptions(id, volumePatch) updateVolumeOptionsModel.SetID("testString") - updateVolumeOptionsModel.SetVolumePatch(make(map[string]interface{})) + updateVolumeOptionsModel.SetVolumePatch(map[string]interface{}{"anyKey": "anyValue"}) updateVolumeOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateVolumeOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateVolumeOptionsModel).ToNot(BeNil()) Expect(updateVolumeOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVolumeOptionsModel.VolumePatch).To(Equal(make(map[string]interface{}))) + Expect(updateVolumeOptionsModel.VolumePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateVolumeOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(updateVolumeOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -86524,62 +86524,62 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the UpdateVPCAddressPrefixOptions model vpcID := "testString" id := "testString" - addressPrefixPatch := make(map[string]interface{}) + addressPrefixPatch := map[string]interface{}{"anyKey": "anyValue"} updateVPCAddressPrefixOptionsModel := vpcService.NewUpdateVPCAddressPrefixOptions(vpcID, id, addressPrefixPatch) updateVPCAddressPrefixOptionsModel.SetVPCID("testString") updateVPCAddressPrefixOptionsModel.SetID("testString") - updateVPCAddressPrefixOptionsModel.SetAddressPrefixPatch(make(map[string]interface{})) + updateVPCAddressPrefixOptionsModel.SetAddressPrefixPatch(map[string]interface{}{"anyKey": "anyValue"}) updateVPCAddressPrefixOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateVPCAddressPrefixOptionsModel).ToNot(BeNil()) Expect(updateVPCAddressPrefixOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(updateVPCAddressPrefixOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCAddressPrefixOptionsModel.AddressPrefixPatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPCAddressPrefixOptionsModel.AddressPrefixPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateVPCAddressPrefixOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateVPCOptions successfully`, func() { // Construct an instance of the UpdateVPCOptions model id := "testString" - vpcPatch := make(map[string]interface{}) + vpcPatch := map[string]interface{}{"anyKey": "anyValue"} updateVPCOptionsModel := vpcService.NewUpdateVPCOptions(id, vpcPatch) updateVPCOptionsModel.SetID("testString") - updateVPCOptionsModel.SetVPCPatch(make(map[string]interface{})) + updateVPCOptionsModel.SetVPCPatch(map[string]interface{}{"anyKey": "anyValue"}) updateVPCOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateVPCOptionsModel).ToNot(BeNil()) Expect(updateVPCOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCOptionsModel.VPCPatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPCOptionsModel.VPCPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateVPCOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateVPCRouteOptions successfully`, func() { // Construct an instance of the UpdateVPCRouteOptions model vpcID := "testString" id := "testString" - routePatch := make(map[string]interface{}) + routePatch := map[string]interface{}{"anyKey": "anyValue"} updateVPCRouteOptionsModel := vpcService.NewUpdateVPCRouteOptions(vpcID, id, routePatch) updateVPCRouteOptionsModel.SetVPCID("testString") updateVPCRouteOptionsModel.SetID("testString") - updateVPCRouteOptionsModel.SetRoutePatch(make(map[string]interface{})) + updateVPCRouteOptionsModel.SetRoutePatch(map[string]interface{}{"anyKey": "anyValue"}) updateVPCRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateVPCRouteOptionsModel).ToNot(BeNil()) Expect(updateVPCRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(updateVPCRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCRouteOptionsModel.RoutePatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPCRouteOptionsModel.RoutePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateVPCRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateVPCRoutingTableOptions successfully`, func() { // Construct an instance of the UpdateVPCRoutingTableOptions model vpcID := "testString" id := "testString" - routingTablePatch := make(map[string]interface{}) + routingTablePatch := map[string]interface{}{"anyKey": "anyValue"} updateVPCRoutingTableOptionsModel := vpcService.NewUpdateVPCRoutingTableOptions(vpcID, id, routingTablePatch) updateVPCRoutingTableOptionsModel.SetVPCID("testString") updateVPCRoutingTableOptionsModel.SetID("testString") - updateVPCRoutingTableOptionsModel.SetRoutingTablePatch(make(map[string]interface{})) + updateVPCRoutingTableOptionsModel.SetRoutingTablePatch(map[string]interface{}{"anyKey": "anyValue"}) updateVPCRoutingTableOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateVPCRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateVPCRoutingTableOptionsModel).ToNot(BeNil()) Expect(updateVPCRoutingTableOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(updateVPCRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCRoutingTableOptionsModel.RoutingTablePatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPCRoutingTableOptionsModel.RoutingTablePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateVPCRoutingTableOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(updateVPCRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -86588,61 +86588,61 @@ var _ = Describe(`VpcV1`, func() { vpcID := "testString" routingTableID := "testString" id := "testString" - routePatch := make(map[string]interface{}) + routePatch := map[string]interface{}{"anyKey": "anyValue"} updateVPCRoutingTableRouteOptionsModel := vpcService.NewUpdateVPCRoutingTableRouteOptions(vpcID, routingTableID, id, routePatch) updateVPCRoutingTableRouteOptionsModel.SetVPCID("testString") updateVPCRoutingTableRouteOptionsModel.SetRoutingTableID("testString") updateVPCRoutingTableRouteOptionsModel.SetID("testString") - updateVPCRoutingTableRouteOptionsModel.SetRoutePatch(make(map[string]interface{})) + updateVPCRoutingTableRouteOptionsModel.SetRoutePatch(map[string]interface{}{"anyKey": "anyValue"}) updateVPCRoutingTableRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateVPCRoutingTableRouteOptionsModel).ToNot(BeNil()) Expect(updateVPCRoutingTableRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(updateVPCRoutingTableRouteOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) Expect(updateVPCRoutingTableRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCRoutingTableRouteOptionsModel.RoutePatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPCRoutingTableRouteOptionsModel.RoutePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateVPCRoutingTableRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateVPNGatewayConnectionOptions successfully`, func() { // Construct an instance of the UpdateVPNGatewayConnectionOptions model vpnGatewayID := "testString" id := "testString" - vpnGatewayConnectionPatch := make(map[string]interface{}) + vpnGatewayConnectionPatch := map[string]interface{}{"anyKey": "anyValue"} updateVPNGatewayConnectionOptionsModel := vpcService.NewUpdateVPNGatewayConnectionOptions(vpnGatewayID, id, vpnGatewayConnectionPatch) updateVPNGatewayConnectionOptionsModel.SetVPNGatewayID("testString") updateVPNGatewayConnectionOptionsModel.SetID("testString") - updateVPNGatewayConnectionOptionsModel.SetVPNGatewayConnectionPatch(make(map[string]interface{})) + updateVPNGatewayConnectionOptionsModel.SetVPNGatewayConnectionPatch(map[string]interface{}{"anyKey": "anyValue"}) updateVPNGatewayConnectionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateVPNGatewayConnectionOptionsModel).ToNot(BeNil()) Expect(updateVPNGatewayConnectionOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) Expect(updateVPNGatewayConnectionOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateVPNGatewayConnectionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateVPNGatewayOptions successfully`, func() { // Construct an instance of the UpdateVPNGatewayOptions model id := "testString" - vpnGatewayPatch := make(map[string]interface{}) + vpnGatewayPatch := map[string]interface{}{"anyKey": "anyValue"} updateVPNGatewayOptionsModel := vpcService.NewUpdateVPNGatewayOptions(id, vpnGatewayPatch) updateVPNGatewayOptionsModel.SetID("testString") - updateVPNGatewayOptionsModel.SetVPNGatewayPatch(make(map[string]interface{})) + updateVPNGatewayOptionsModel.SetVPNGatewayPatch(map[string]interface{}{"anyKey": "anyValue"}) updateVPNGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateVPNGatewayOptionsModel).ToNot(BeNil()) Expect(updateVPNGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPNGatewayOptionsModel.VPNGatewayPatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPNGatewayOptionsModel.VPNGatewayPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateVPNGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateVPNServerOptions successfully`, func() { // Construct an instance of the UpdateVPNServerOptions model id := "testString" - vpnServerPatch := make(map[string]interface{}) + vpnServerPatch := map[string]interface{}{"anyKey": "anyValue"} updateVPNServerOptionsModel := vpcService.NewUpdateVPNServerOptions(id, vpnServerPatch) updateVPNServerOptionsModel.SetID("testString") - updateVPNServerOptionsModel.SetVPNServerPatch(make(map[string]interface{})) + updateVPNServerOptionsModel.SetVPNServerPatch(map[string]interface{}{"anyKey": "anyValue"}) updateVPNServerOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateVPNServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateVPNServerOptionsModel).ToNot(BeNil()) Expect(updateVPNServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPNServerOptionsModel.VPNServerPatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPNServerOptionsModel.VPNServerPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateVPNServerOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(updateVPNServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -86650,18 +86650,23 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the UpdateVPNServerRouteOptions model vpnServerID := "testString" id := "testString" - vpnServerRoutePatch := make(map[string]interface{}) + vpnServerRoutePatch := map[string]interface{}{"anyKey": "anyValue"} updateVPNServerRouteOptionsModel := vpcService.NewUpdateVPNServerRouteOptions(vpnServerID, id, vpnServerRoutePatch) updateVPNServerRouteOptionsModel.SetVPNServerID("testString") updateVPNServerRouteOptionsModel.SetID("testString") - updateVPNServerRouteOptionsModel.SetVPNServerRoutePatch(make(map[string]interface{})) + updateVPNServerRouteOptionsModel.SetVPNServerRoutePatch(map[string]interface{}{"anyKey": "anyValue"}) updateVPNServerRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateVPNServerRouteOptionsModel).ToNot(BeNil()) Expect(updateVPNServerRouteOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) Expect(updateVPNServerRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPNServerRouteOptionsModel.VPNServerRoutePatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPNServerRouteOptionsModel.VPNServerRoutePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateVPNServerRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewVolumeAttachmentPrototype successfully`, func() { + var volume vpcv1.VolumeAttachmentPrototypeVolumeIntf = nil + _, err := vpcService.NewVolumeAttachmentPrototype(volume) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewVolumeAttachmentPrototypeInstanceByImageContext successfully`, func() { var volume *vpcv1.VolumePrototypeInstanceByImageContext = nil _, err := vpcService.NewVolumeAttachmentPrototypeInstanceByImageContext(volume) @@ -86672,11 +86677,6 @@ var _ = Describe(`VpcV1`, func() { _, err := vpcService.NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(volume) Expect(err).ToNot(BeNil()) }) - It(`Invoke NewVolumeAttachmentPrototypeInstanceContext successfully`, func() { - var volume vpcv1.VolumeAttachmentVolumePrototypeInstanceContextIntf = nil - _, err := vpcService.NewVolumeAttachmentPrototypeInstanceContext(volume) - Expect(err).ToNot(BeNil()) - }) It(`Invoke NewVolumePrototypeInstanceByImageContext successfully`, func() { var profile vpcv1.VolumeProfileIdentityIntf = nil _, err := vpcService.NewVolumePrototypeInstanceByImageContext(profile) @@ -87929,36 +87929,6 @@ var _ = Describe(`VpcV1`, func() { _, err := vpcService.NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(profile, sourceSnapshot) Expect(err).ToNot(BeNil()) }) - It(`Invoke NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5" - _model, err := vpcService.NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5" - _model, err := vpcService.NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID successfully`, func() { - id := "1a6b7274-678d-4dfb-8981-c71dd9d4daa5" - _model, err := vpcService.NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity successfully`, func() { - var profile vpcv1.VolumeProfileIdentityIntf = nil - capacity := int64(100) - _, err := vpcService.NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(profile, capacity) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot successfully`, func() { - var profile vpcv1.VolumeProfileIdentityIntf = nil - var sourceSnapshot vpcv1.SnapshotIdentityIntf = nil - _, err := vpcService.NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(profile, sourceSnapshot) - Expect(err).ToNot(BeNil()) - }) It(`Invoke NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup successfully`, func() { var group *vpcv1.InstanceGroupManagerScheduledActionGroupPrototype = nil _, err := vpcService.NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup(group) From 220f036b7e38ff6d588488f67da5ea0324a98d0f Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 24 Nov 2022 09:48:12 +0530 Subject: [PATCH 012/103] Update vpc_v1_test.go --- common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go index a34376e4ca..17b350d071 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go @@ -27,10 +27,10 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/go-openapi/strfmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.ibm.com/ibmcloud/vpc-go-sdk/vpcv1" ) var _ = Describe(`VpcV1`, func() { From a5e954ac277045b1a7a7e4e9a3425f0d3fb427ab Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 24 Nov 2022 09:57:34 +0530 Subject: [PATCH 013/103] sdk breaking changes --- .../vpc/data_source_ibm_is_instance_template.go | 4 ++-- .../vpc/data_source_ibm_is_instance_templates.go | 2 +- ibm/service/vpc/resource_ibm_is_instance_template.go | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_instance_template.go b/ibm/service/vpc/data_source_ibm_is_instance_template.go index 3787c211b9..ea4ba223f6 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance_template.go +++ b/ibm/service/vpc/data_source_ibm_is_instance_template.go @@ -565,7 +565,7 @@ func dataSourceIBMISInstanceTemplateRead(context context.Context, d *schema.Reso volumeAttach[isInstanceTemplateVolAttName] = *volume.Name volumeAttach[isInstanceTemplateDeleteVolume] = *volume.DeleteVolumeOnInstanceDelete volumeIntf := volume.Volume - volumeInst := volumeIntf.(*vpcv1.VolumeAttachmentVolumePrototypeInstanceContext) + volumeInst := volumeIntf.(*vpcv1.VolumeAttachmentPrototypeVolume) newVolumeArr := []map[string]interface{}{} newVolume := map[string]interface{}{} @@ -817,7 +817,7 @@ func dataSourceIBMISInstanceTemplateRead(context context.Context, d *schema.Reso volumeAttach[isInstanceTemplateVolAttName] = *volume.Name volumeAttach[isInstanceTemplateDeleteVolume] = *volume.DeleteVolumeOnInstanceDelete volumeIntf := volume.Volume - volumeInst := volumeIntf.(*vpcv1.VolumeAttachmentVolumePrototypeInstanceContext) + volumeInst := volumeIntf.(*vpcv1.VolumeAttachmentPrototypeVolume) newVolumeArr := []map[string]interface{}{} newVolume := map[string]interface{}{} diff --git a/ibm/service/vpc/data_source_ibm_is_instance_templates.go b/ibm/service/vpc/data_source_ibm_is_instance_templates.go index c8743f62c6..b33a6d38ab 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance_templates.go +++ b/ibm/service/vpc/data_source_ibm_is_instance_templates.go @@ -589,7 +589,7 @@ func dataSourceIBMISInstanceTemplatesRead(d *schema.ResourceData, meta interface volumeAttach[isInstanceTemplateVolAttName] = *volume.Name volumeAttach[isInstanceTemplateDeleteVolume] = *volume.DeleteVolumeOnInstanceDelete volumeIntf := volume.Volume - volumeInst := volumeIntf.(*vpcv1.VolumeAttachmentVolumePrototypeInstanceContext) + volumeInst := volumeIntf.(*vpcv1.VolumeAttachmentPrototypeVolume) newVolumeArr := []map[string]interface{}{} newVolume := map[string]interface{}{} diff --git a/ibm/service/vpc/resource_ibm_is_instance_template.go b/ibm/service/vpc/resource_ibm_is_instance_template.go index 215003ed1c..b8ff203a6a 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_template.go +++ b/ibm/service/vpc/resource_ibm_is_instance_template.go @@ -741,10 +741,10 @@ func instanceTemplateCreate(d *schema.ResourceData, meta interface{}, profile, n // Handle volume attachments if volsintf, ok := d.GetOk(isInstanceTemplateVolumeAttachments); ok { vols := volsintf.([]interface{}) - var intfs []vpcv1.VolumeAttachmentPrototypeInstanceContext + var intfs []vpcv1.VolumeAttachmentPrototype for _, resource := range vols { vol := resource.(map[string]interface{}) - volInterface := &vpcv1.VolumeAttachmentPrototypeInstanceContext{} + volInterface := &vpcv1.VolumeAttachmentPrototype{} deleteVolBool := vol[isInstanceTemplateVolumeDeleteOnInstanceDelete].(bool) volInterface.DeleteVolumeOnInstanceDelete = &deleteVolBool attachmentnamestr := vol[isInstanceTemplateVolAttachmentName].(string) @@ -752,7 +752,7 @@ func instanceTemplateCreate(d *schema.ResourceData, meta interface{}, profile, n volIdStr := vol[isInstanceTemplateVolAttVol].(string) if volIdStr != "" { - volInterface.Volume = &vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity{ + volInterface.Volume = &vpcv1.VolumeAttachmentPrototypeVolume{ ID: &volIdStr, } } else { @@ -761,7 +761,7 @@ func instanceTemplateCreate(d *schema.ResourceData, meta interface{}, profile, n profileName := newvol[isInstanceTemplateVolAttVolProfile].(string) capacity := int64(newvol[isInstanceTemplateVolAttVolCapacity].(int)) - volPrototype := &vpcv1.VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext{ + volPrototype := &vpcv1.VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext{ Profile: &vpcv1.VolumeProfileIdentity{ Name: &profileName, }, @@ -1215,7 +1215,7 @@ func instanceTemplateGet(d *schema.ResourceData, meta interface{}, ID string) er newVolumeArr := []map[string]interface{}{} newVolume := map[string]interface{}{} volumeIntf := volume.Volume - volumeInst := volumeIntf.(*vpcv1.VolumeAttachmentVolumePrototypeInstanceContext) + volumeInst := volumeIntf.(*vpcv1.VolumeAttachmentPrototypeVolume) if volumeInst.ID != nil { volumeAttach[isInstanceTemplateVolAttVol] = *volumeInst.ID } From 53501fbe565f6f0eb069cec7ec6693577ce249e0 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 14 Dec 2022 11:33:07 +0530 Subject: [PATCH 014/103] sdk updated --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 86 ++++++++++++++++++- .../IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go | 22 ++--- 2 files changed, 93 insertions(+), 15 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 5f6fef170d..c9c6e510f0 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -30,14 +30,14 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" - common "github.com/IBM/vpc-go-sdk/common" "github.com/go-openapi/strfmt" + common "github.com/IBM/vpc-go-sdk/common" ) // 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: 2022-11-22 +// API Version: 2022-12-13 type VpcV1 struct { Service *core.BaseService @@ -14837,7 +14837,8 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS // 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 network interface identifier +// - An instance network interface identifier +// - A bare metal server network interface identifier // - A VPN server identifier // - An application load balancer identifier // - An endpoint gateway identifier @@ -14962,7 +14963,8 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu // 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 network interface identifier +// - An instance network interface identifier +// - A bare metal server network interface identifier // - A VPN server identifier // - An application load balancer identifier // - An endpoint gateway identifier @@ -62720,6 +62722,22 @@ type Volume struct { // `user_managed`. EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` + // The reasons for the current `health_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VolumeHealthReason `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 volume. Href *string `json:"href" validate:"required"` @@ -62783,6 +62801,21 @@ const ( VolumeEncryptionUserManagedConst = "user_managed" ) +// Constants associated with the Volume.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 ( + VolumeHealthStateDegradedConst = "degraded" + VolumeHealthStateFaultedConst = "faulted" + VolumeHealthStateInapplicableConst = "inapplicable" + VolumeHealthStateOkConst = "ok" +) + // Constants associated with the Volume.Status property. // The status of the volume. // @@ -62833,6 +62866,14 @@ func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err erro if err != nil { return } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVolumeHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -63536,6 +63577,43 @@ func UnmarshalVolumeCollectionNext(m map[string]json.RawMessage, result interfac return } +// VolumeHealthReason : VolumeHealthReason struct +type VolumeHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the VolumeHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + VolumeHealthReasonCodeInitializingFromSnapshotConst = "initializing_from_snapshot" +) + +// UnmarshalVolumeHealthReason unmarshals an instance of VolumeHealthReason from the specified map of raw messages. +func UnmarshalVolumeHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VolumeIdentity : Identifies a volume by a unique property. // Models which "extend" this model: // - VolumeIdentityByID diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go index 17b350d071..0e59ba63a6 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go @@ -27,10 +27,10 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" - "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/go-openapi/strfmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + "github.com/IBM/vpc-go-sdk/vpcv1" ) var _ = Describe(`VpcV1`, func() { @@ -45267,7 +45267,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/volumes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "volumes": [{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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", `{"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"}, "volumes": [{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 ListVolumes successfully with retries`, func() { @@ -45331,7 +45331,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/volumes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/volumes?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "volumes": [{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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", `{"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"}, "volumes": [{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 ListVolumes successfully`, func() { @@ -45475,9 +45475,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,"volumes":[{"active":true,"bandwidth":1000,"busy":true,"capacity":1000,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64"},"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"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-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", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"volumes":[{"active":true,"bandwidth":1000,"busy":true,"capacity":1000,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64"},"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"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-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,"bandwidth":1000,"busy":true,"capacity":1000,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"},"href":"https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64"},"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"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-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", `{"total_count":2,"limit":1,"volumes":[{"active":true,"bandwidth":1000,"busy":true,"capacity":1000,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64"},"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"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-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) } @@ -45649,7 +45649,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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", `{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 CreateVolume successfully with retries`, func() { @@ -45749,7 +45749,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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", `{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 CreateVolume successfully`, func() { @@ -46075,7 +46075,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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", `{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 GetVolume successfully with retries`, func() { @@ -46132,7 +46132,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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", `{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 GetVolume successfully`, func() { @@ -46336,7 +46336,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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", `{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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() { @@ -46427,7 +46427,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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", `{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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`, func() { From 6d70566922665e67fe1d8871c3aff41799e565b8 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 14 Dec 2022 11:35:34 +0530 Subject: [PATCH 015/103] fmt changes --- common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 2 +- common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index c9c6e510f0..202d387872 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -30,8 +30,8 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" - "github.com/go-openapi/strfmt" common "github.com/IBM/vpc-go-sdk/common" + "github.com/go-openapi/strfmt" ) // VpcV1 : The IBM Cloud Virtual Private Cloud (VPC) API can be used to programmatically provision and manage virtual diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go index 0e59ba63a6..3b072464b0 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go @@ -27,10 +27,10 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/go-openapi/strfmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/IBM/vpc-go-sdk/vpcv1" ) var _ = Describe(`VpcV1`, func() { From f8ae1d4d98b6a43d6bff8c7f5c180320c8e2c9df Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 15 Dec 2022 19:28:23 +0530 Subject: [PATCH 016/103] updated to latest --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index d6b39542f5..f706f149c9 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/IBM/scc-go-sdk/v4 v4.0.2 github.com/IBM/schematics-go-sdk v0.2.1 github.com/IBM/secrets-manager-go-sdk v0.1.19 - github.com/IBM/vpc-go-sdk v0.27.0 + github.com/IBM/vpc-go-sdk v0.28.0 github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5 github.com/Shopify/sarama v1.29.1 github.com/apache/openwhisk-client-go v0.0.0-20200201143223-a804fb82d105 diff --git a/go.sum b/go.sum index 960b3efbb1..674218ef0b 100644 --- a/go.sum +++ b/go.sum @@ -106,6 +106,8 @@ github.com/IBM/secrets-manager-go-sdk v0.1.19 h1:0GPs5EoTaWNsjo4QPj64GNxlWfN8VHJ github.com/IBM/secrets-manager-go-sdk v0.1.19/go.mod h1:eO3dBhzPrHkkt+yPex/jB2xD6qHZxBko+Aw+0tfqHeA= github.com/IBM/vpc-go-sdk v0.27.0 h1:PBpgjh5bjxrMT5BlaHfyaiJ/71pvycbmVQMuPOQ33ZY= github.com/IBM/vpc-go-sdk v0.27.0/go.mod h1:jYjS3EySPkC7DuOg33gMHtm8DcIf75Tc+Gxo3zmMBTQ= +github.com/IBM/vpc-go-sdk v0.28.0 h1:cOxzyxqjSZZqdSY0EiQEAzAGAVtYh2JBcvbve6OZguc= +github.com/IBM/vpc-go-sdk v0.28.0/go.mod h1:jYjS3EySPkC7DuOg33gMHtm8DcIf75Tc+Gxo3zmMBTQ= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56/go.mod h1:Zb3OT4l0mf7P/GOs2w2Ilj5sdm5Whoq3pa24dAEBHFc= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= From ddf5a3bfbc76559b75a482e61e62108af47bfbd3 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 12 Jan 2023 10:47:46 +0530 Subject: [PATCH 017/103] sdk update --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 886 +++++++++++++++++- .../IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go | 864 +++++++++++++++-- go.mod | 2 +- 3 files changed, 1641 insertions(+), 111 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 202d387872..1cd241633c 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2020, 2021, 2022. + * (C) Copyright IBM Corp. 2021, 2022, 2023. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,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: 2022-12-13 +// API Version: 2023-01-10 type VpcV1 struct { Service *core.BaseService @@ -9094,6 +9094,158 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku return } +// ListBackupPolicyJobs : List all jobs for a backup policy +// This request retrieves all jobs for a backup policy. A backup job represents the execution of a backup policy plan +// for a resource matching the policy's criteria. +func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) +} + +// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") + 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 listBackupPolicyJobsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) + } + if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) + } + if listBackupPolicyJobsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) + } + if listBackupPolicyJobsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) + } + if listBackupPolicyJobsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) + } + if listBackupPolicyJobsOptions.SourceID != nil { + builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { + builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { + builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBackupPolicyJob : Retrieve a backup policy job +// This request retrieves a single backup policy job specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + return vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) +} + +// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, + "id": *getBackupPolicyJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBackupPolicyJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) + if err != nil { + return + } + response.Result = result + } + + return +} + // ListBackupPolicyPlans : List all plans for a backup policy // This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { @@ -18167,6 +18319,9 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB if createLoadBalancerOptions.Subnets != nil { body["subnets"] = createLoadBalancerOptions.Subnets } + if createLoadBalancerOptions.Datapath != nil { + body["datapath"] = createLoadBalancerOptions.Datapath + } if createLoadBalancerOptions.Listeners != nil { body["listeners"] = createLoadBalancerOptions.Listeners } @@ -21864,6 +22019,352 @@ func UnmarshalBackupPolicyCollectionNext(m map[string]json.RawMessage, result in 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. + 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 will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the + // unexpected property value was encountered. + 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 will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + 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"` +} + +// Constants associated with the BackupPolicyJob.JobType property. +// The type of backup policy job. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the +// unexpected property value was encountered. +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 will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the +// unexpected property value was encountered. +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 { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_after", &obj.AutoDeleteAfter) + if err != nil { + return + } + err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "job_type", &obj.JobType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalBackupPolicyJobSource) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBackupPolicyJobStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target_snapshots", &obj.TargetSnapshots, UnmarshalSnapshotReference) + if err != nil { + 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"` + + // Collection of backup policy jobs. + 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 *BackupPolicyJobCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" 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 { + return + } + err = core.UnmarshalModel(m, "jobs", &obj.Jobs, UnmarshalBackupPolicyJob) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyJobCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + return start, nil +} + +// 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"` +} + +// 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) + if err != nil { + return + } + 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) + if err != nil { + 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)). +// Models which "extend" this model: +// - BackupPolicyJobSourceVolumeReference +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 *VolumeReferenceDeleted `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"` +} + +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 { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyJobStatusReason : BackupPolicyJobStatusReason struct +type BackupPolicyJobStatusReason struct { + // A snake case string succinctly identifying the status reason: + // - `internal_error`: Internal error (contact IBM support) + // - `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). + 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 snake case string succinctly identifying the status reason: +// - `internal_error`: Internal error (contact IBM support) +// - `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). +const ( + BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error" + BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" + BackupPolicyJobStatusReasonCodeSnapshotVolumeLimitConst = "snapshot_volume_limit" + BackupPolicyJobStatusReasonCodeSourceVolumeBusyConst = "source_volume_busy" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BackupPolicyPatch : BackupPolicyPatch struct type BackupPolicyPatch struct { // The user tags this backup policy applies to (replacing any existing tags). Resources that have both a matching user @@ -26832,6 +27333,9 @@ type CreateLoadBalancerOptions struct { // Load balancers in the `network` family allow only one subnet to be specified. Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` + // The datapath logging configuration for this load balancer. + Datapath *LoadBalancerLoggingDatapathPrototype `json:"datapath,omitempty"` + // The listeners of this load balancer. Listeners []LoadBalancerListenerPrototypeLoadBalancerContext `json:"listeners,omitempty"` @@ -26840,7 +27344,7 @@ type CreateLoadBalancerOptions struct { // format, fields and permitted values. // // To activate logging, the load balancer profile must support the specified logging type. - Logging *LoadBalancerLogging `json:"logging,omitempty"` + Logging *LoadBalancerLoggingPrototype `json:"logging,omitempty"` // The name for this load balancer. The name must not be used by another load balancer in the VPC. If unspecified, the // name will be a hyphenated list of randomly-selected words. @@ -26892,6 +27396,12 @@ func (_options *CreateLoadBalancerOptions) SetSubnets(subnets []SubnetIdentityIn return _options } +// SetDatapath : Allow user to set Datapath +func (_options *CreateLoadBalancerOptions) SetDatapath(datapath *LoadBalancerLoggingDatapathPrototype) *CreateLoadBalancerOptions { + _options.Datapath = datapath + return _options +} + // SetListeners : Allow user to set Listeners func (_options *CreateLoadBalancerOptions) SetListeners(listeners []LoadBalancerListenerPrototypeLoadBalancerContext) *CreateLoadBalancerOptions { _options.Listeners = listeners @@ -26899,7 +27409,7 @@ func (_options *CreateLoadBalancerOptions) SetListeners(listeners []LoadBalancer } // SetLogging : Allow user to set Logging -func (_options *CreateLoadBalancerOptions) SetLogging(logging *LoadBalancerLogging) *CreateLoadBalancerOptions { +func (_options *CreateLoadBalancerOptions) SetLogging(logging *LoadBalancerLoggingPrototype) *CreateLoadBalancerOptions { _options.Logging = logging return _options } @@ -33724,6 +34234,44 @@ func UnmarshalGenericResourceReferenceDeleted(m map[string]json.RawMessage, resu return } +// GetBackupPolicyJobOptions : The GetBackupPolicyJob options. +type GetBackupPolicyJobOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // The backup policy job identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBackupPolicyJobOptions : Instantiate GetBackupPolicyJobOptions +func (*VpcV1) NewGetBackupPolicyJobOptions(backupPolicyID string, id string) *GetBackupPolicyJobOptions { + return &GetBackupPolicyJobOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + ID: core.StringPtr(id), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *GetBackupPolicyJobOptions) SetBackupPolicyID(backupPolicyID string) *GetBackupPolicyJobOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBackupPolicyJobOptions) SetID(id string) *GetBackupPolicyJobOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBackupPolicyJobOptions) SetHeaders(param map[string]string) *GetBackupPolicyJobOptions { + options.Headers = param + return options +} + // GetBackupPolicyOptions : The GetBackupPolicy options. type GetBackupPolicyOptions struct { // The backup policy identifier. @@ -40921,6 +41469,7 @@ type InstancePatch struct { // instance is placed on a dedicated host, the requested profile `family` must be // the same as the dedicated host `family`. // - Have the same `vcpu.architecture`. + // - Support the number of network interfaces currently attached to the instance. Profile InstancePatchProfileIntf `json:"profile,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -40979,6 +41528,7 @@ func (instancePatch *InstancePatch) AsPatch() (_patch map[string]interface{}, er // instance is placed on a dedicated host, the requested profile `family` must be // the same as the dedicated host `family`. // - Have the same `vcpu.architecture`. +// - Support the number of network interfaces currently attached to the instance. // // Models which "extend" this model: // - InstancePatchProfileInstanceProfileIdentityByName @@ -43656,6 +44206,117 @@ func (options *ListBackupPoliciesOptions) SetHeaders(param map[string]string) *L return options } +// ListBackupPolicyJobsOptions : The ListBackupPolicyJobs options. +type ListBackupPolicyJobsOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // Filters the collection to backup policy jobs with the specified status. + Status *string `json:"status,omitempty"` + + // Filters the collection to backup policy jobs with the backup plan with the specified identifier. + BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` + + // 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"` + + // 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 backup policy jobs with a source with the specified identifier. + SourceID *string `json:"source.id,omitempty"` + + // Filters the collection to resources with the target snapshot with the specified identifier. + TargetSnapshotsID *string `json:"target_snapshots[].id,omitempty"` + + // Filters the collection to backup policy jobs with the target snapshot with the specified CRN. + TargetSnapshotsCRN *string `json:"target_snapshots[].crn,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListBackupPolicyJobsOptions.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 ( + ListBackupPolicyJobsOptionsSortCreatedAtConst = "created_at" + ListBackupPolicyJobsOptionsSortNameConst = "name" +) + +// NewListBackupPolicyJobsOptions : Instantiate ListBackupPolicyJobsOptions +func (*VpcV1) NewListBackupPolicyJobsOptions(backupPolicyID string) *ListBackupPolicyJobsOptions { + return &ListBackupPolicyJobsOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *ListBackupPolicyJobsOptions) SetBackupPolicyID(backupPolicyID string) *ListBackupPolicyJobsOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetStatus : Allow user to set Status +func (_options *ListBackupPolicyJobsOptions) SetStatus(status string) *ListBackupPolicyJobsOptions { + _options.Status = core.StringPtr(status) + return _options +} + +// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID +func (_options *ListBackupPolicyJobsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListBackupPolicyJobsOptions { + _options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListBackupPolicyJobsOptions) SetStart(start string) *ListBackupPolicyJobsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBackupPolicyJobsOptions) SetLimit(limit int64) *ListBackupPolicyJobsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListBackupPolicyJobsOptions) SetSort(sort string) *ListBackupPolicyJobsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetSourceID : Allow user to set SourceID +func (_options *ListBackupPolicyJobsOptions) SetSourceID(sourceID string) *ListBackupPolicyJobsOptions { + _options.SourceID = core.StringPtr(sourceID) + return _options +} + +// SetTargetSnapshotsID : Allow user to set TargetSnapshotsID +func (_options *ListBackupPolicyJobsOptions) SetTargetSnapshotsID(targetSnapshotsID string) *ListBackupPolicyJobsOptions { + _options.TargetSnapshotsID = core.StringPtr(targetSnapshotsID) + return _options +} + +// SetTargetSnapshotsCRN : Allow user to set TargetSnapshotsCRN +func (_options *ListBackupPolicyJobsOptions) SetTargetSnapshotsCRN(targetSnapshotsCRN string) *ListBackupPolicyJobsOptions { + _options.TargetSnapshotsCRN = core.StringPtr(targetSnapshotsCRN) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBackupPolicyJobsOptions) SetHeaders(param map[string]string) *ListBackupPolicyJobsOptions { + options.Headers = param + return options +} + // ListBackupPolicyPlansOptions : The ListBackupPolicyPlans options. type ListBackupPolicyPlansOptions struct { // The backup policy identifier. @@ -48839,7 +49500,7 @@ func UnmarshalLoadBalancerListenerReferenceDeleted(m map[string]json.RawMessage, // LoadBalancerLogging : LoadBalancerLogging struct type LoadBalancerLogging struct { // The datapath logging configuration for this load balancer. - Datapath *LoadBalancerLoggingDatapath `json:"datapath,omitempty"` + Datapath *LoadBalancerLoggingDatapath `json:"datapath" validate:"required"` } // UnmarshalLoadBalancerLogging unmarshals an instance of LoadBalancerLogging from the specified map of raw messages. @@ -48859,18 +49520,43 @@ type LoadBalancerLoggingDatapath struct { Active *bool `json:"active" validate:"required"` } -// NewLoadBalancerLoggingDatapath : Instantiate LoadBalancerLoggingDatapath (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerLoggingDatapath(active bool) (_model *LoadBalancerLoggingDatapath, err error) { - _model = &LoadBalancerLoggingDatapath{ - Active: core.BoolPtr(active), +// UnmarshalLoadBalancerLoggingDatapath unmarshals an instance of LoadBalancerLoggingDatapath from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingDatapath(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingDatapath) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// UnmarshalLoadBalancerLoggingDatapath unmarshals an instance of LoadBalancerLoggingDatapath from the specified map of raw messages. -func UnmarshalLoadBalancerLoggingDatapath(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerLoggingDatapath) +// LoadBalancerLoggingDatapathPatch : The datapath logging configuration for this load balancer. +type LoadBalancerLoggingDatapathPatch struct { + // Indicates whether datapath logging will be active for this load balancer. + Active *bool `json:"active,omitempty"` +} + +// UnmarshalLoadBalancerLoggingDatapathPatch unmarshals an instance of LoadBalancerLoggingDatapathPatch from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingDatapathPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingDatapathPatch) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLoggingDatapathPrototype : The datapath logging configuration for this load balancer. +type LoadBalancerLoggingDatapathPrototype struct { + // Indicates whether datapath logging will be active for this load balancer. + Active *bool `json:"active,omitempty"` +} + +// UnmarshalLoadBalancerLoggingDatapathPrototype unmarshals an instance of LoadBalancerLoggingDatapathPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingDatapathPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingDatapathPrototype) err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { return @@ -48879,12 +49565,46 @@ func UnmarshalLoadBalancerLoggingDatapath(m map[string]json.RawMessage, result i return } +// LoadBalancerLoggingPatch : LoadBalancerLoggingPatch struct +type LoadBalancerLoggingPatch struct { + // The datapath logging configuration for this load balancer. + Datapath *LoadBalancerLoggingDatapathPatch `json:"datapath,omitempty"` +} + +// UnmarshalLoadBalancerLoggingPatch unmarshals an instance of LoadBalancerLoggingPatch from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingPatch) + err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLoggingPrototype : LoadBalancerLoggingPrototype struct +type LoadBalancerLoggingPrototype struct { + // The datapath logging configuration for this load balancer. + Datapath *LoadBalancerLoggingDatapathPrototype `json:"datapath,omitempty"` +} + +// UnmarshalLoadBalancerLoggingPrototype unmarshals an instance of LoadBalancerLoggingPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingPrototype) + err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // LoadBalancerPatch : LoadBalancerPatch struct type LoadBalancerPatch struct { // The logging configuration to use for this load balancer. // // To activate logging, the load balancer profile must support the specified logging type. - Logging *LoadBalancerLogging `json:"logging,omitempty"` + Logging *LoadBalancerLoggingPatch `json:"logging,omitempty"` // The name for this load balancer. The name must not be used by another load balancer in the VPC. Name *string `json:"name,omitempty"` @@ -48902,7 +49622,7 @@ type LoadBalancerPatch struct { // UnmarshalLoadBalancerPatch unmarshals an instance of LoadBalancerPatch from the specified map of raw messages. func UnmarshalLoadBalancerPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerPatch) - err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLogging) + err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLoggingPatch) if err != nil { return } @@ -64377,6 +65097,57 @@ func UnmarshalZoneReference(m map[string]json.RawMessage, result interface{}) (e return } +// BackupPolicyJobSourceVolumeReference : BackupPolicyJobSourceVolumeReference struct +// This model "extends" BackupPolicyJobSource +type BackupPolicyJobSourceVolumeReference struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this volume. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` + + // The name for this volume. The name is unique across all volumes in the region. + Name *string `json:"name" validate:"required"` +} + +func (*BackupPolicyJobSourceVolumeReference) isaBackupPolicyJobSource() bool { + return true +} + +// UnmarshalBackupPolicyJobSourceVolumeReference unmarshals an instance of BackupPolicyJobSourceVolumeReference from the specified map of raw messages. +func UnmarshalBackupPolicyJobSourceVolumeReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobSourceVolumeReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerBootTargetBareMetalServerDiskReference : BareMetalServerBootTargetBareMetalServerDiskReference struct // This model "extends" BareMetalServerBootTarget type BareMetalServerBootTargetBareMetalServerDiskReference struct { @@ -85912,6 +86683,91 @@ func (pager *BackupPoliciesPager) GetAll() (allItems []BackupPolicy, err error) return pager.GetAllWithContext(context.Background()) } +// BackupPolicyJobsPager can be used to simplify the use of the "ListBackupPolicyJobs" method. +type BackupPolicyJobsPager struct { + hasNext bool + options *ListBackupPolicyJobsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBackupPolicyJobsPager returns a new BackupPolicyJobsPager instance. +func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) (pager *BackupPolicyJobsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBackupPolicyJobsOptions = *options + pager = &BackupPolicyJobsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BackupPolicyJobsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyJob, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBackupPolicyJobsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Jobs + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyJob, err error) { + for pager.HasNext() { + var nextPage []BackupPolicyJob + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BackupPolicyJobsPager) GetNext() (page []BackupPolicyJob, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err error) { + return pager.GetAllWithContext(context.Background()) +} + // PlacementGroupsPager can be used to simplify the use of the "ListPlacementGroups" method. type PlacementGroupsPager struct { hasNext bool diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go index 3b072464b0..d03b621c8b 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2020, 2021, 2022. + * (C) Copyright IBM Corp. 2021, 2022, 2023. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35044,6 +35044,640 @@ var _ = Describe(`VpcV1`, func() { }) }) }) + Describe(`ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) - Operation response error`, func() { + version := "testString" + 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(listBackupPolicyJobsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["status"]).To(Equal([]string{"testString"})) + 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{"testString"})) + 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() { + 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 ListBackupPolicyJobsOptions model + listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) + listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Status = core.StringPtr("testString") + 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("testString") + 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.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.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions)`, func() { + version := "testString" + 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(listBackupPolicyJobsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["status"]).To(Equal([]string{"testString"})) + 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{"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/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", "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/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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}`) + })) + }) + It(`Invoke ListBackupPolicyJobs 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 ListBackupPolicyJobsOptions model + listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) + listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Status = core.StringPtr("testString") + 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("testString") + 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.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.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + 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.ListBackupPolicyJobsWithContext(ctx, listBackupPolicyJobsOptionsModel) + 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(listBackupPolicyJobsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["status"]).To(Equal([]string{"testString"})) + 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{"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/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", "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/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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}`) + })) + }) + It(`Invoke ListBackupPolicyJobs 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.ListBackupPolicyJobs(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("testString") + 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("testString") + listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListBackupPolicyJobs 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 ListBackupPolicyJobsOptions model + listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) + listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Status = core.StringPtr("testString") + 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("testString") + 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.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 ListBackupPolicyJobsOptions model with no property values + listBackupPolicyJobsOptionsModelNew := new(vpcv1.ListBackupPolicyJobsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModelNew) + 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 ListBackupPolicyJobs 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 ListBackupPolicyJobsOptions model + listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) + listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") + listBackupPolicyJobsOptionsModel.Status = core.StringPtr("testString") + 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("testString") + listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) + 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.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","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/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"Message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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","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/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"Message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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("testString"), + BackupPolicyPlanID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + SourceID: core.StringPtr("testString"), + TargetSnapshotsID: core.StringPtr("testString"), + TargetSnapshotsCRN: core.StringPtr("testString"), + } + + 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("testString"), + BackupPolicyPlanID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Sort: core.StringPtr("name"), + SourceID: core.StringPtr("testString"), + TargetSnapshotsID: core.StringPtr("testString"), + TargetSnapshotsCRN: core.StringPtr("testString"), + } + + 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() { + version := "testString" + 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(getBackupPolicyJobPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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 GetBackupPolicyJob 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 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.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.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions)`, func() { + version := "testString" + 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(getBackupPolicyJobPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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", "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/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "resource_type": "snapshot"}]}`) + })) + }) + It(`Invoke GetBackupPolicyJob 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 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.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.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + 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.GetBackupPolicyJobWithContext(ctx, getBackupPolicyJobOptionsModel) + 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(getBackupPolicyJobPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + 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", `{"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", "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/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "resource_type": "snapshot"}]}`) + })) + }) + It(`Invoke GetBackupPolicyJob 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.GetBackupPolicyJob(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"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetBackupPolicyJob 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 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.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 GetBackupPolicyJobOptions model with no property values + getBackupPolicyJobOptionsModelNew := new(vpcv1.GetBackupPolicyJobOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModelNew) + 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 GetBackupPolicyJob 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 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.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) Describe(`ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) - Operation response error`, func() { version := "testString" listBackupPolicyPlansPath := "/backup_policies/testString/plans" @@ -68648,6 +69282,10 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the LoadBalancerLoggingDatapathPrototype model + loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) + loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) + // Construct an instance of the CertificateInstanceIdentityByCRN model certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") @@ -68678,13 +69316,9 @@ var _ = Describe(`VpcV1`, func() { loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") - // Construct an instance of the LoadBalancerLoggingDatapath model - loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) - loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) - - // Construct an instance of the LoadBalancerLogging model - loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) - loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // Construct an instance of the LoadBalancerLoggingPrototype model + loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) + loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) @@ -68736,8 +69370,9 @@ var _ = Describe(`VpcV1`, func() { createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} - createLoadBalancerOptionsModel.Logging = loadBalancerLoggingModel + createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel @@ -68816,6 +69451,10 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the LoadBalancerLoggingDatapathPrototype model + loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) + loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) + // Construct an instance of the CertificateInstanceIdentityByCRN model certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") @@ -68846,13 +69485,9 @@ var _ = Describe(`VpcV1`, func() { loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") - // Construct an instance of the LoadBalancerLoggingDatapath model - loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) - loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) - - // Construct an instance of the LoadBalancerLogging model - loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) - loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // Construct an instance of the LoadBalancerLoggingPrototype model + loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) + loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) @@ -68904,8 +69539,9 @@ var _ = Describe(`VpcV1`, func() { createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} - createLoadBalancerOptionsModel.Logging = loadBalancerLoggingModel + createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel @@ -68991,6 +69627,10 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the LoadBalancerLoggingDatapathPrototype model + loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) + loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) + // Construct an instance of the CertificateInstanceIdentityByCRN model certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") @@ -69021,13 +69661,9 @@ var _ = Describe(`VpcV1`, func() { loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") - // Construct an instance of the LoadBalancerLoggingDatapath model - loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) - loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) - - // Construct an instance of the LoadBalancerLogging model - loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) - loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // Construct an instance of the LoadBalancerLoggingPrototype model + loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) + loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) @@ -69079,8 +69715,9 @@ var _ = Describe(`VpcV1`, func() { createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} - createLoadBalancerOptionsModel.Logging = loadBalancerLoggingModel + createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel @@ -69109,6 +69746,10 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the LoadBalancerLoggingDatapathPrototype model + loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) + loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) + // Construct an instance of the CertificateInstanceIdentityByCRN model certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") @@ -69139,13 +69780,9 @@ var _ = Describe(`VpcV1`, func() { loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") - // Construct an instance of the LoadBalancerLoggingDatapath model - loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) - loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) - - // Construct an instance of the LoadBalancerLogging model - loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) - loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // Construct an instance of the LoadBalancerLoggingPrototype model + loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) + loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) @@ -69197,8 +69834,9 @@ var _ = Describe(`VpcV1`, func() { createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} - createLoadBalancerOptionsModel.Logging = loadBalancerLoggingModel + createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel @@ -69248,6 +69886,10 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel := new(vpcv1.SubnetIdentityByID) subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + // Construct an instance of the LoadBalancerLoggingDatapathPrototype model + loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) + loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) + // Construct an instance of the CertificateInstanceIdentityByCRN model certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") @@ -69278,13 +69920,9 @@ var _ = Describe(`VpcV1`, func() { loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") - // Construct an instance of the LoadBalancerLoggingDatapath model - loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) - loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) - - // Construct an instance of the LoadBalancerLogging model - loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) - loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // Construct an instance of the LoadBalancerLoggingPrototype model + loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) + loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) @@ -69336,8 +69974,9 @@ var _ = Describe(`VpcV1`, func() { createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} - createLoadBalancerOptionsModel.Logging = loadBalancerLoggingModel + createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel @@ -69690,13 +70329,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the LoadBalancerLoggingDatapath model - loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) - loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + // Construct an instance of the LoadBalancerLoggingDatapathPatch model + loadBalancerLoggingDatapathPatchModel := new(vpcv1.LoadBalancerLoggingDatapathPatch) + loadBalancerLoggingDatapathPatchModel.Active = core.BoolPtr(true) - // Construct an instance of the LoadBalancerLogging model - loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) - loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // Construct an instance of the LoadBalancerLoggingPatch model + loadBalancerLoggingPatchModel := new(vpcv1.LoadBalancerLoggingPatch) + loadBalancerLoggingPatchModel.Datapath = loadBalancerLoggingDatapathPatchModel // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -69704,7 +70343,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPatch model loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) - loadBalancerPatchModel.Logging = loadBalancerLoggingModel + loadBalancerPatchModel.Logging = loadBalancerLoggingPatchModel loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() @@ -69785,13 +70424,13 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the LoadBalancerLoggingDatapath model - loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) - loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + // Construct an instance of the LoadBalancerLoggingDatapathPatch model + loadBalancerLoggingDatapathPatchModel := new(vpcv1.LoadBalancerLoggingDatapathPatch) + loadBalancerLoggingDatapathPatchModel.Active = core.BoolPtr(true) - // Construct an instance of the LoadBalancerLogging model - loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) - loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // Construct an instance of the LoadBalancerLoggingPatch model + loadBalancerLoggingPatchModel := new(vpcv1.LoadBalancerLoggingPatch) + loadBalancerLoggingPatchModel.Datapath = loadBalancerLoggingDatapathPatchModel // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -69799,7 +70438,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPatch model loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) - loadBalancerPatchModel.Logging = loadBalancerLoggingModel + loadBalancerPatchModel.Logging = loadBalancerLoggingPatchModel loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() @@ -69887,13 +70526,13 @@ var _ = Describe(`VpcV1`, func() { Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the LoadBalancerLoggingDatapath model - loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) - loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + // Construct an instance of the LoadBalancerLoggingDatapathPatch model + loadBalancerLoggingDatapathPatchModel := new(vpcv1.LoadBalancerLoggingDatapathPatch) + loadBalancerLoggingDatapathPatchModel.Active = core.BoolPtr(true) - // Construct an instance of the LoadBalancerLogging model - loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) - loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // Construct an instance of the LoadBalancerLoggingPatch model + loadBalancerLoggingPatchModel := new(vpcv1.LoadBalancerLoggingPatch) + loadBalancerLoggingPatchModel.Datapath = loadBalancerLoggingDatapathPatchModel // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -69901,7 +70540,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPatch model loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) - loadBalancerPatchModel.Logging = loadBalancerLoggingModel + loadBalancerPatchModel.Logging = loadBalancerLoggingPatchModel loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() @@ -69930,13 +70569,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the LoadBalancerLoggingDatapath model - loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) - loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + // Construct an instance of the LoadBalancerLoggingDatapathPatch model + loadBalancerLoggingDatapathPatchModel := new(vpcv1.LoadBalancerLoggingDatapathPatch) + loadBalancerLoggingDatapathPatchModel.Active = core.BoolPtr(true) - // Construct an instance of the LoadBalancerLogging model - loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) - loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // Construct an instance of the LoadBalancerLoggingPatch model + loadBalancerLoggingPatchModel := new(vpcv1.LoadBalancerLoggingPatch) + loadBalancerLoggingPatchModel.Datapath = loadBalancerLoggingDatapathPatchModel // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -69944,7 +70583,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPatch model loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) - loadBalancerPatchModel.Logging = loadBalancerLoggingModel + loadBalancerPatchModel.Logging = loadBalancerLoggingPatchModel loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() @@ -69994,13 +70633,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the LoadBalancerLoggingDatapath model - loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) - loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) + // Construct an instance of the LoadBalancerLoggingDatapathPatch model + loadBalancerLoggingDatapathPatchModel := new(vpcv1.LoadBalancerLoggingDatapathPatch) + loadBalancerLoggingDatapathPatchModel.Active = core.BoolPtr(true) - // Construct an instance of the LoadBalancerLogging model - loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) - loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel + // Construct an instance of the LoadBalancerLoggingPatch model + loadBalancerLoggingPatchModel := new(vpcv1.LoadBalancerLoggingPatch) + loadBalancerLoggingPatchModel.Datapath = loadBalancerLoggingDatapathPatchModel // Construct an instance of the SubnetIdentityByID model subnetIdentityModel := new(vpcv1.SubnetIdentityByID) @@ -70008,7 +70647,7 @@ var _ = Describe(`VpcV1`, func() { // Construct an instance of the LoadBalancerPatch model loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) - loadBalancerPatchModel.Logging = loadBalancerLoggingModel + loadBalancerPatchModel.Logging = loadBalancerLoggingPatchModel loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() @@ -82028,6 +82667,12 @@ var _ = Describe(`VpcV1`, func() { subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) + // Construct an instance of the LoadBalancerLoggingDatapathPrototype model + loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) + Expect(loadBalancerLoggingDatapathPrototypeModel).ToNot(BeNil()) + loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) + Expect(loadBalancerLoggingDatapathPrototypeModel.Active).To(Equal(core.BoolPtr(true))) + // Construct an instance of the CertificateInstanceIdentityByCRN model certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) Expect(certificateInstanceIdentityModel).ToNot(BeNil()) @@ -82078,17 +82723,11 @@ var _ = Describe(`VpcV1`, func() { Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin).To(Equal(core.Int64Ptr(int64(443)))) Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol).To(Equal(core.StringPtr("http"))) - // Construct an instance of the LoadBalancerLoggingDatapath model - loadBalancerLoggingDatapathModel := new(vpcv1.LoadBalancerLoggingDatapath) - Expect(loadBalancerLoggingDatapathModel).ToNot(BeNil()) - loadBalancerLoggingDatapathModel.Active = core.BoolPtr(true) - Expect(loadBalancerLoggingDatapathModel.Active).To(Equal(core.BoolPtr(true))) - - // Construct an instance of the LoadBalancerLogging model - loadBalancerLoggingModel := new(vpcv1.LoadBalancerLogging) - Expect(loadBalancerLoggingModel).ToNot(BeNil()) - loadBalancerLoggingModel.Datapath = loadBalancerLoggingDatapathModel - Expect(loadBalancerLoggingModel.Datapath).To(Equal(loadBalancerLoggingDatapathModel)) + // Construct an instance of the LoadBalancerLoggingPrototype model + loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) + Expect(loadBalancerLoggingPrototypeModel).ToNot(BeNil()) + loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel + Expect(loadBalancerLoggingPrototypeModel.Datapath).To(Equal(loadBalancerLoggingDatapathPrototypeModel)) // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) @@ -82172,8 +82811,9 @@ var _ = Describe(`VpcV1`, func() { createLoadBalancerOptionsModel := vpcService.NewCreateLoadBalancerOptions(createLoadBalancerOptionsIsPublic, createLoadBalancerOptionsSubnets) createLoadBalancerOptionsModel.SetIsPublic(true) createLoadBalancerOptionsModel.SetSubnets([]vpcv1.SubnetIdentityIntf{subnetIdentityModel}) + createLoadBalancerOptionsModel.SetDatapath(loadBalancerLoggingDatapathPrototypeModel) createLoadBalancerOptionsModel.SetListeners([]vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel}) - createLoadBalancerOptionsModel.SetLogging(loadBalancerLoggingModel) + createLoadBalancerOptionsModel.SetLogging(loadBalancerLoggingPrototypeModel) createLoadBalancerOptionsModel.SetName("my-load-balancer") createLoadBalancerOptionsModel.SetPools([]vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel}) createLoadBalancerOptionsModel.SetProfile(loadBalancerProfileIdentityModel) @@ -82184,8 +82824,9 @@ var _ = Describe(`VpcV1`, func() { Expect(createLoadBalancerOptionsModel).ToNot(BeNil()) Expect(createLoadBalancerOptionsModel.IsPublic).To(Equal(core.BoolPtr(true))) Expect(createLoadBalancerOptionsModel.Subnets).To(Equal([]vpcv1.SubnetIdentityIntf{subnetIdentityModel})) + Expect(createLoadBalancerOptionsModel.Datapath).To(Equal(loadBalancerLoggingDatapathPrototypeModel)) Expect(createLoadBalancerOptionsModel.Listeners).To(Equal([]vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel})) - Expect(createLoadBalancerOptionsModel.Logging).To(Equal(loadBalancerLoggingModel)) + Expect(createLoadBalancerOptionsModel.Logging).To(Equal(loadBalancerLoggingPrototypeModel)) Expect(createLoadBalancerOptionsModel.Name).To(Equal(core.StringPtr("my-load-balancer"))) Expect(createLoadBalancerOptionsModel.Pools).To(Equal([]vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel})) Expect(createLoadBalancerOptionsModel.Profile).To(Equal(loadBalancerProfileIdentityModel)) @@ -83722,6 +84363,19 @@ var _ = Describe(`VpcV1`, func() { Expect(disconnectVPNClientOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(disconnectVPNClientOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetBackupPolicyJobOptions successfully`, func() { + // Construct an instance of the GetBackupPolicyJobOptions model + backupPolicyID := "testString" + id := "testString" + getBackupPolicyJobOptionsModel := vpcService.NewGetBackupPolicyJobOptions(backupPolicyID, id) + getBackupPolicyJobOptionsModel.SetBackupPolicyID("testString") + getBackupPolicyJobOptionsModel.SetID("testString") + getBackupPolicyJobOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getBackupPolicyJobOptionsModel).ToNot(BeNil()) + Expect(getBackupPolicyJobOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) + Expect(getBackupPolicyJobOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getBackupPolicyJobOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetBackupPolicyOptions successfully`, func() { // Construct an instance of the GetBackupPolicyOptions model id := "testString" @@ -84644,6 +85298,32 @@ var _ = Describe(`VpcV1`, func() { Expect(listBackupPoliciesOptionsModel.Tag).To(Equal(core.StringPtr("testString"))) Expect(listBackupPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListBackupPolicyJobsOptions successfully`, func() { + // Construct an instance of the ListBackupPolicyJobsOptions model + backupPolicyID := "testString" + listBackupPolicyJobsOptionsModel := vpcService.NewListBackupPolicyJobsOptions(backupPolicyID) + listBackupPolicyJobsOptionsModel.SetBackupPolicyID("testString") + listBackupPolicyJobsOptionsModel.SetStatus("testString") + listBackupPolicyJobsOptionsModel.SetBackupPolicyPlanID("testString") + listBackupPolicyJobsOptionsModel.SetStart("testString") + listBackupPolicyJobsOptionsModel.SetLimit(int64(10)) + listBackupPolicyJobsOptionsModel.SetSort("name") + listBackupPolicyJobsOptionsModel.SetSourceID("testString") + listBackupPolicyJobsOptionsModel.SetTargetSnapshotsID("testString") + listBackupPolicyJobsOptionsModel.SetTargetSnapshotsCRN("testString") + listBackupPolicyJobsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listBackupPolicyJobsOptionsModel).ToNot(BeNil()) + Expect(listBackupPolicyJobsOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) + Expect(listBackupPolicyJobsOptionsModel.Status).To(Equal(core.StringPtr("testString"))) + Expect(listBackupPolicyJobsOptionsModel.BackupPolicyPlanID).To(Equal(core.StringPtr("testString"))) + Expect(listBackupPolicyJobsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listBackupPolicyJobsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listBackupPolicyJobsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listBackupPolicyJobsOptionsModel.SourceID).To(Equal(core.StringPtr("testString"))) + Expect(listBackupPolicyJobsOptionsModel.TargetSnapshotsID).To(Equal(core.StringPtr("testString"))) + Expect(listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN).To(Equal(core.StringPtr("testString"))) + Expect(listBackupPolicyJobsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListBackupPolicyPlansOptions successfully`, func() { // Construct an instance of the ListBackupPolicyPlansOptions model backupPolicyID := "testString" @@ -85627,12 +86307,6 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewLoadBalancerLoggingDatapath successfully`, func() { - active := true - _model, err := vpcService.NewLoadBalancerLoggingDatapath(active) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) It(`Invoke NewLoadBalancerPoolHealthMonitorPatch successfully`, func() { delay := int64(5) maxRetries := int64(2) diff --git a/go.mod b/go.mod index ed20c04255..eb6ab02001 100644 --- a/go.mod +++ b/go.mod @@ -173,4 +173,4 @@ replace github.com/softlayer/softlayer-go v1.0.3 => github.com/IBM-Cloud/softlay replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt/jwt v3.2.1+incompatible -replace github.com/IBM/vpc-go-sdk v0.27.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.28.0 => ./common/github.com/IBM/vpc-go-sdk From 7cd244da15f15f5041c2d7bc47a4ba076d619c42 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 12 Jan 2023 10:48:01 +0530 Subject: [PATCH 018/103] breaking changes on new sdk 0.30.0 --- ibm/service/vpc/resource_ibm_is_lb.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_lb.go b/ibm/service/vpc/resource_ibm_is_lb.go index 5c0ea974dc..da220687fd 100644 --- a/ibm/service/vpc/resource_ibm_is_lb.go +++ b/ibm/service/vpc/resource_ibm_is_lb.go @@ -414,10 +414,10 @@ func lbCreate(d *schema.ResourceData, meta interface{}, name, lbType, rg string, options.Profile = loadBalancerProfileIdentityModel } else { - dataPath := &vpcv1.LoadBalancerLoggingDatapath{ + dataPath := &vpcv1.LoadBalancerLoggingDatapathPrototype{ Active: &isLogging, } - loadBalancerLogging := &vpcv1.LoadBalancerLogging{ + loadBalancerLogging := &vpcv1.LoadBalancerLoggingPrototype{ Datapath: dataPath, } options.Logging = loadBalancerLogging @@ -721,10 +721,10 @@ func lbUpdate(d *schema.ResourceData, meta interface{}, id, name string, hasChan updateLoadBalancerOptions := &vpcv1.UpdateLoadBalancerOptions{ ID: &id, } - dataPath := &vpcv1.LoadBalancerLoggingDatapath{ + dataPath := &vpcv1.LoadBalancerLoggingDatapathPatch{ Active: &isLogging, } - loadBalancerLogging := &vpcv1.LoadBalancerLogging{ + loadBalancerLogging := &vpcv1.LoadBalancerLoggingPatch{ Datapath: dataPath, } loadBalancerPatchModel := &vpcv1.LoadBalancerPatch{ From 3274ad59fa5bc5caf68f5b94b7b972562a9b073c Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 1 Feb 2023 10:33:42 +0530 Subject: [PATCH 019/103] sdk update --- common/github.com/IBM/vpc-go-sdk/go.mod | 10 +- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 269 ++++++++++++++++-- .../IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go | 134 +++++++-- 3 files changed, 360 insertions(+), 53 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/go.mod b/common/github.com/IBM/vpc-go-sdk/go.mod index e5a8a79f8e..19fdf6d00a 100644 --- a/common/github.com/IBM/vpc-go-sdk/go.mod +++ b/common/github.com/IBM/vpc-go-sdk/go.mod @@ -3,11 +3,11 @@ module github.com/IBM/vpc-go-sdk go 1.16 require ( - github.com/IBM/go-sdk-core/v5 v5.9.5 - github.com/go-openapi/strfmt v0.21.1 - github.com/onsi/ginkgo v1.14.2 - github.com/onsi/gomega v1.10.5 - github.com/stretchr/testify v1.7.0 + github.com/IBM/go-sdk-core/v5 v5.12.0 + github.com/go-openapi/strfmt v0.21.3 + github.com/onsi/ginkgo v1.16.5 + github.com/onsi/gomega v1.20.0 + github.com/stretchr/testify v1.8.0 ) retract ( diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 1cd241633c..3c82564021 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.60.2-95dc7721-20221102-203229 + * IBM OpenAPI SDK Code Generator Version: 3.63.0-5dae26c1-20230111-193039 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -30,14 +30,14 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" - common "github.com/IBM/vpc-go-sdk/common" "github.com/go-openapi/strfmt" + common "github.ibm.com/ibmcloud/vpc-go-sdk/common" ) // 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: 2023-01-10 +// API Version: 2023-01-31 type VpcV1 struct { Service *core.BaseService @@ -330,9 +330,9 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr // DeleteVPC : Delete a VPC // This request deletes a VPC. This operation cannot be reversed. For this request to succeed, the VPC must not contain -// any instances, subnets, or public gateways. All security groups and network ACLs associated with the VPC are -// automatically deleted. All flow log collectors with `auto_delete` set to `true` targeting the VPC or any resource in -// the VPC are automatically deleted. +// any instances, subnets, public gateways, or endpoint gateways. All security groups and network ACLs associated with +// the VPC are automatically deleted. All flow log collectors with `auto_delete` set to `true` targeting the VPC or any +// resource in the VPC are automatically deleted. func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) } @@ -10408,6 +10408,9 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa if createBareMetalServerOptions.Zone != nil { body["zone"] = createBareMetalServerOptions.Zone } + if createBareMetalServerOptions.EnableSecureBoot != nil { + body["enable_secure_boot"] = createBareMetalServerOptions.EnableSecureBoot + } if createBareMetalServerOptions.Name != nil { body["name"] = createBareMetalServerOptions.Name } @@ -10417,6 +10420,9 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa if createBareMetalServerOptions.ResourceGroup != nil { body["resource_group"] = createBareMetalServerOptions.ResourceGroup } + if createBareMetalServerOptions.TrustedPlatformModule != nil { + body["trusted_platform_module"] = createBareMetalServerOptions.TrustedPlatformModule + } if createBareMetalServerOptions.VPC != nil { body["vpc"] = createBareMetalServerOptions.VPC } @@ -22879,6 +22885,7 @@ const ( // Constants associated with the BareMetalServer.Status property. // The status of the bare metal server. const ( + BareMetalServerStatusDeletingConst = "deleting" BareMetalServerStatusFailedConst = "failed" BareMetalServerStatusMaintenanceConst = "maintenance" BareMetalServerStatusPendingConst = "pending" @@ -23968,18 +23975,35 @@ func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMess // BareMetalServerPatch : BareMetalServerPatch struct type BareMetalServerPatch struct { + // 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, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -25033,13 +25057,15 @@ const ( // 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 are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. const ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" ) // UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes unmarshals an instance of BareMetalServerProfileSupportedTrustedPlatformModuleModes from the specified map of raw messages. @@ -25114,23 +25140,42 @@ type BareMetalServerTrustedPlatformModule struct { 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 are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. - Mode *string `json:"mode,omitempty"` + 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 are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. const ( - BareMetalServerTrustedPlatformModuleModeTpm2Const = "tpm_2" + 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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerTrustedPlatformModuleSupportedModesDisabledConst = "disabled" + BareMetalServerTrustedPlatformModuleSupportedModesTpm2Const = "tpm_2" ) // UnmarshalBareMetalServerTrustedPlatformModule unmarshals an instance of BareMetalServerTrustedPlatformModule from the specified map of raw messages. @@ -25144,6 +25189,66 @@ func UnmarshalBareMetalServerTrustedPlatformModule(m map[string]json.RawMessage, if err != nil { return } + err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) + if err != nil { + 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 { + return + } + 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`. + 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`. +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 { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -25654,6 +25759,10 @@ type CreateBareMetalServerOptions struct { // The zone this bare metal server will reside in. Zone ZoneIdentityIntf `json:"zone" 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 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. // @@ -25667,6 +25776,8 @@ type CreateBareMetalServerOptions struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is 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 of the server's network @@ -25711,6 +25822,12 @@ func (_options *CreateBareMetalServerOptions) SetZone(zone ZoneIdentityIntf) *Cr return _options } +// SetEnableSecureBoot : Allow user to set EnableSecureBoot +func (_options *CreateBareMetalServerOptions) SetEnableSecureBoot(enableSecureBoot bool) *CreateBareMetalServerOptions { + _options.EnableSecureBoot = core.BoolPtr(enableSecureBoot) + return _options +} + // SetName : Allow user to set Name func (_options *CreateBareMetalServerOptions) SetName(name string) *CreateBareMetalServerOptions { _options.Name = core.StringPtr(name) @@ -25729,6 +25846,12 @@ func (_options *CreateBareMetalServerOptions) SetResourceGroup(resourceGroup Res return _options } +// SetTrustedPlatformModule : Allow user to set TrustedPlatformModule +func (_options *CreateBareMetalServerOptions) SetTrustedPlatformModule(trustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype) *CreateBareMetalServerOptions { + _options.TrustedPlatformModule = trustedPlatformModule + return _options +} + // SetVPC : Allow user to set VPC func (_options *CreateBareMetalServerOptions) SetVPC(vpc VPCIdentityIntf) *CreateBareMetalServerOptions { _options.VPC = vpc @@ -52177,7 +52300,9 @@ type NetworkACLRulePatch struct { // Specify `null` to move this rule after all existing rules. Before NetworkACLRuleBeforePatchIntf `json:"before,omitempty"` - // The ICMP traffic code to match. + // The ICMP traffic code to match. If set, `type` must also be set. + // + // Specify `null` to remove an existing ICMP traffic code. Code *int64 `json:"code,omitempty"` // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. @@ -52208,6 +52333,8 @@ type NetworkACLRulePatch struct { SourcePortMin *int64 `json:"source_port_min,omitempty"` // The ICMP traffic type to match. + // + // Specify `null` to remove an existing ICMP traffic type value. Type *int64 `json:"type,omitempty"` } @@ -52323,6 +52450,9 @@ type NetworkACLRulePrototype struct { // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -52370,6 +52500,12 @@ const ( NetworkACLRulePrototypeDirectionOutboundConst = "outbound" ) +// Constants associated with the NetworkACLRulePrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeIPVersionIpv4Const = "ipv4" +) + // Constants associated with the NetworkACLRulePrototype.Protocol property. // The protocol to enforce. const ( @@ -52429,6 +52565,9 @@ type NetworkACLRulePrototypeNetworkACLContext struct { // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -52476,6 +52615,12 @@ const ( NetworkACLRulePrototypeNetworkACLContextDirectionOutboundConst = "outbound" ) +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextIPVersionIpv4Const = "ipv4" +) + // Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Protocol property. // The protocol to enforce. const ( @@ -56073,7 +56218,8 @@ type RoutingTablePatch struct { // Indicates whether this routing table is used to route traffic that originates from // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to `true` selects this routing table, provided // no other routing table in the VPC already has this property set to `true`, and no subnets are attached to this - // routing table. Updating to `false` deselects this routing table. + // routing table. Updating to + // `false` deselects this routing table. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in @@ -63464,8 +63610,7 @@ type Volume struct { // The unique identifier for this volume. ID *string `json:"id" validate:"required"` - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile - // `family` of `custom`. + // The maximum I/O operations per second (IOPS) for this volume. Iops *int64 `json:"iops" validate:"required"` // The name for this volume. The name is unique across all volumes in the region. @@ -63960,7 +64105,7 @@ type VolumeAttachmentPrototypeVolume struct { // The URL for this volume. Href *string `json:"href,omitempty"` - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` @@ -64386,7 +64531,7 @@ type VolumePatch struct { // The minimum and maximum capacity limits for creating or updating volumes may expand in the future. Capacity *int64 `json:"capacity,omitempty"` - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile // `family` of `custom`. The volume must be attached as a data volume to a running virtual server instance. Iops *int64 `json:"iops,omitempty"` @@ -64642,7 +64787,7 @@ func UnmarshalVolumeProfileReference(m map[string]json.RawMessage, result interf // - VolumePrototypeVolumeByCapacity // - VolumePrototypeVolumeBySourceSnapshot type VolumePrototype struct { - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` @@ -64741,7 +64886,7 @@ type VolumePrototypeInstanceByImageContext struct { // If unspecified, the `encryption` type for the volume will be `provider_managed`. EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` @@ -64810,7 +64955,7 @@ type VolumePrototypeInstanceBySourceSnapshotContext struct { // If unspecified, the `encryption` type for the volume will be `provider_managed`. EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` @@ -75957,6 +76102,9 @@ type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -75982,6 +76130,12 @@ const ( NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" ) +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeIPVersionIpv4Const = "ipv4" +) + // Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Protocol property. // The protocol to enforce. const ( @@ -76020,6 +76174,10 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllP if err != nil { return } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -76048,6 +76206,9 @@ type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -76083,6 +76244,12 @@ const ( NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" ) +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeIPVersionIpv4Const = "ipv4" +) + // Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Protocol property. // The protocol to enforce. const ( @@ -76121,6 +76288,10 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp if err != nil { return } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -76157,6 +76328,9 @@ type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototy // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -76194,6 +76368,12 @@ const ( NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" ) +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeIPVersionIpv4Const = "ipv4" +) + // Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Protocol property. // The protocol to enforce. const ( @@ -76233,6 +76413,10 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpu if err != nil { return } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -76279,6 +76463,9 @@ type NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct { // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -76304,6 +76491,12 @@ const ( NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" ) +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeIPVersionIpv4Const = "ipv4" +) + // Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Protocol property. // The protocol to enforce. const ( @@ -76346,6 +76539,10 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(m map[st if err != nil { return } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -76376,6 +76573,9 @@ type NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct { // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -76411,6 +76611,12 @@ const ( NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" ) +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeIPVersionIpv4Const = "ipv4" +) + // Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Protocol property. // The protocol to enforce. const ( @@ -76453,6 +76659,10 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(m map[s if err != nil { return } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -76491,6 +76701,9 @@ type NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct { // The direction of traffic to match. Direction *string `json:"direction" validate:"required"` + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -76528,6 +76741,12 @@ const ( NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" ) +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeIPVersionIpv4Const = "ipv4" +) + // Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Protocol property. // The protocol to enforce. const ( @@ -76571,6 +76790,10 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(m map if err != nil { return } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -81498,7 +81721,7 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentity(m map[string]json.Ra // - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot // This model "extends" VolumeAttachmentPrototypeVolume type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` @@ -81732,7 +81955,7 @@ func UnmarshalVolumeProfileIdentityByName(m map[string]json.RawMessage, result i // VolumePrototypeVolumeByCapacity : VolumePrototypeVolumeByCapacity struct // This model "extends" VolumePrototype type VolumePrototypeVolumeByCapacity struct { - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` @@ -81818,7 +82041,7 @@ func UnmarshalVolumePrototypeVolumeByCapacity(m map[string]json.RawMessage, resu // VolumePrototypeVolumeBySourceSnapshot : VolumePrototypeVolumeBySourceSnapshot struct // This model "extends" VolumePrototype type VolumePrototypeVolumeBySourceSnapshot struct { - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` @@ -84526,7 +84749,7 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(m // VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct // This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct { - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` @@ -84602,7 +84825,7 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolum // VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct // This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct { - // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile // `family` of `custom`. Iops *int64 `json:"iops,omitempty"` diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go index d03b621c8b..a89cf8fbc4 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go @@ -27,10 +27,10 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" - "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/go-openapi/strfmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + "github.ibm.com/ibmcloud/vpc-go-sdk/vpcv1" ) var _ = Describe(`VpcV1`, func() { @@ -5009,7 +5009,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") + createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) @@ -5107,7 +5107,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") + createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) @@ -5212,7 +5212,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") + createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) @@ -5260,7 +5260,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") + createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) @@ -5329,7 +5329,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") + createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) @@ -39102,7 +39102,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/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}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}], "total_count": 132}`) + 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}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}}], "total_count": 132}`) })) }) It(`Invoke ListBareMetalServerProfiles successfully with retries`, func() { @@ -39162,7 +39162,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/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}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}], "total_count": 132}`) + 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}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}}], "total_count": 132}`) })) }) It(`Invoke ListBareMetalServerProfiles successfully`, func() { @@ -39300,9 +39300,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,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"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","os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["tpm_2"]}}]}`) + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"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","os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["disabled"]}}]}`) } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"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","os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["tpm_2"]}}]}`) + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"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","os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["disabled"]}}]}`) } else { res.WriteHeader(400) } @@ -39427,7 +39427,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}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}`) + fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}}`) })) }) It(`Invoke GetBareMetalServerProfile successfully with retries`, func() { @@ -39484,7 +39484,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}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["tpm_2"]}}`) + fmt.Fprintf(res, "%s", `{"bandwidth": {"type": "fixed", "value": 20000}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}}`) })) }) It(`Invoke GetBareMetalServerProfile successfully`, func() { @@ -39681,7 +39681,7 @@ var _ = Describe(`VpcV1`, func() { // 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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) })) }) It(`Invoke ListBareMetalServers successfully with retries`, func() { @@ -39757,7 +39757,7 @@ var _ = Describe(`VpcV1`, func() { // 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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) })) }) It(`Invoke ListBareMetalServers successfully`, func() { @@ -39919,9 +39919,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,"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/123456::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,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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":"failed","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":"tpm_2"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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,"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/123456::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,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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/123456::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,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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":"failed","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":"tpm_2"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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,"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/123456::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,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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) } @@ -40081,6 +40081,10 @@ var _ = Describe(`VpcV1`, func() { 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("4727d842-f94f-4a2d-824a-9bc9b02c523b") @@ -40091,9 +40095,11 @@ var _ = Describe(`VpcV1`, func() { createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel createBareMetalServerOptionsModel.Zone = zoneIdentityModel + createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel createBareMetalServerOptionsModel.VPC = vpcIdentityModel createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -40150,7 +40156,7 @@ 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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -40224,6 +40230,10 @@ var _ = Describe(`VpcV1`, func() { 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("4727d842-f94f-4a2d-824a-9bc9b02c523b") @@ -40234,9 +40244,11 @@ var _ = Describe(`VpcV1`, func() { createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel createBareMetalServerOptionsModel.Zone = zoneIdentityModel + createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel createBareMetalServerOptionsModel.VPC = vpcIdentityModel createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -40295,7 +40307,7 @@ 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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -40374,6 +40386,10 @@ var _ = Describe(`VpcV1`, func() { 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("4727d842-f94f-4a2d-824a-9bc9b02c523b") @@ -40384,9 +40400,11 @@ var _ = Describe(`VpcV1`, func() { createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel createBareMetalServerOptionsModel.Zone = zoneIdentityModel + createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel createBareMetalServerOptionsModel.VPC = vpcIdentityModel createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -40467,6 +40485,10 @@ var _ = Describe(`VpcV1`, func() { 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("4727d842-f94f-4a2d-824a-9bc9b02c523b") @@ -40477,9 +40499,11 @@ var _ = Describe(`VpcV1`, func() { createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel createBareMetalServerOptionsModel.Zone = zoneIdentityModel + createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel createBareMetalServerOptionsModel.VPC = vpcIdentityModel createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -40581,6 +40605,10 @@ var _ = Describe(`VpcV1`, func() { 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("4727d842-f94f-4a2d-824a-9bc9b02c523b") @@ -40591,9 +40619,11 @@ var _ = Describe(`VpcV1`, func() { createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel createBareMetalServerOptionsModel.Zone = zoneIdentityModel + createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel createBareMetalServerOptionsModel.VPC = vpcIdentityModel createBareMetalServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -44228,7 +44258,7 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) + res.WriteHeader(202) })) }) It(`Invoke DeleteBareMetalServer successfully`, func() { @@ -44356,7 +44386,7 @@ 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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -44413,7 +44443,7 @@ 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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -44539,9 +44569,15 @@ 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.EnableSecureBoot = core.BoolPtr(false) bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -44604,7 +44640,7 @@ 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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -44617,9 +44653,15 @@ 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.EnableSecureBoot = core.BoolPtr(false) bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -44684,7 +44726,7 @@ 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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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": "failed", "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": "tpm_2"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { @@ -44702,9 +44744,15 @@ var _ = Describe(`VpcV1`, func() { 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.EnableSecureBoot = core.BoolPtr(false) bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -44730,9 +44778,15 @@ 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.EnableSecureBoot = core.BoolPtr(false) bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -44779,9 +44833,15 @@ 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.EnableSecureBoot = core.BoolPtr(false) bareMetalServerPatchModel.Name = core.StringPtr("my-bare-metal-server") + bareMetalServerPatchModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePatchModel bareMetalServerPatchModelAsPatch, asPatchErr := bareMetalServerPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) @@ -52496,6 +52556,7 @@ var _ = Describe(`VpcV1`, func() { networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeNetworkACLContextModel.IPVersion = core.StringPtr("ipv4") networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) @@ -52595,6 +52656,7 @@ var _ = Describe(`VpcV1`, func() { networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeNetworkACLContextModel.IPVersion = core.StringPtr("ipv4") networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) @@ -52701,6 +52763,7 @@ var _ = Describe(`VpcV1`, func() { networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeNetworkACLContextModel.IPVersion = core.StringPtr("ipv4") networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) @@ -52750,6 +52813,7 @@ var _ = Describe(`VpcV1`, func() { networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeNetworkACLContextModel.IPVersion = core.StringPtr("ipv4") networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) @@ -52813,6 +52877,7 @@ var _ = Describe(`VpcV1`, func() { networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeNetworkACLContextModel.IPVersion = core.StringPtr("ipv4") networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) @@ -53827,6 +53892,7 @@ var _ = Describe(`VpcV1`, func() { networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeModel.IPVersion = core.StringPtr("ipv4") networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) @@ -53917,6 +53983,7 @@ var _ = Describe(`VpcV1`, func() { networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeModel.IPVersion = core.StringPtr("ipv4") networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) @@ -54014,6 +54081,7 @@ var _ = Describe(`VpcV1`, func() { networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeModel.IPVersion = core.StringPtr("ipv4") networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) @@ -54054,6 +54122,7 @@ var _ = Describe(`VpcV1`, func() { networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeModel.IPVersion = core.StringPtr("ipv4") networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) @@ -54115,6 +54184,7 @@ var _ = Describe(`VpcV1`, func() { networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeModel.IPVersion = core.StringPtr("ipv4") networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) @@ -81489,6 +81559,12 @@ var _ = Describe(`VpcV1`, func() { resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") Expect(resourceGroupIdentityModel.ID).To(Equal(core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345"))) + // Construct an instance of the BareMetalServerTrustedPlatformModulePrototype model + bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) + Expect(bareMetalServerTrustedPlatformModulePrototypeModel).ToNot(BeNil()) + bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") + Expect(bareMetalServerTrustedPlatformModulePrototypeModel.Mode).To(Equal(core.StringPtr("disabled"))) + // Construct an instance of the VPCIdentityByID model vpcIdentityModel := new(vpcv1.VPCIdentityByID) Expect(vpcIdentityModel).ToNot(BeNil()) @@ -81505,9 +81581,11 @@ var _ = Describe(`VpcV1`, func() { createBareMetalServerOptionsModel.SetPrimaryNetworkInterface(bareMetalServerPrimaryNetworkInterfacePrototypeModel) createBareMetalServerOptionsModel.SetProfile(bareMetalServerProfileIdentityModel) createBareMetalServerOptionsModel.SetZone(zoneIdentityModel) + createBareMetalServerOptionsModel.SetEnableSecureBoot(false) createBareMetalServerOptionsModel.SetName("my-bare-metal-server") createBareMetalServerOptionsModel.SetNetworkInterfaces([]vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel}) createBareMetalServerOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createBareMetalServerOptionsModel.SetTrustedPlatformModule(bareMetalServerTrustedPlatformModulePrototypeModel) createBareMetalServerOptionsModel.SetVPC(vpcIdentityModel) createBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createBareMetalServerOptionsModel).ToNot(BeNil()) @@ -81515,9 +81593,11 @@ var _ = Describe(`VpcV1`, func() { Expect(createBareMetalServerOptionsModel.PrimaryNetworkInterface).To(Equal(bareMetalServerPrimaryNetworkInterfacePrototypeModel)) Expect(createBareMetalServerOptionsModel.Profile).To(Equal(bareMetalServerProfileIdentityModel)) Expect(createBareMetalServerOptionsModel.Zone).To(Equal(zoneIdentityModel)) + Expect(createBareMetalServerOptionsModel.EnableSecureBoot).To(Equal(core.BoolPtr(false))) Expect(createBareMetalServerOptionsModel.Name).To(Equal(core.StringPtr("my-bare-metal-server"))) Expect(createBareMetalServerOptionsModel.NetworkInterfaces).To(Equal([]vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel})) Expect(createBareMetalServerOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createBareMetalServerOptionsModel.TrustedPlatformModule).To(Equal(bareMetalServerTrustedPlatformModulePrototypeModel)) Expect(createBareMetalServerOptionsModel.VPC).To(Equal(vpcIdentityModel)) Expect(createBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -82948,6 +83028,7 @@ var _ = Describe(`VpcV1`, func() { networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeNetworkACLContextModel.IPVersion = core.StringPtr("ipv4") networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) @@ -82958,6 +83039,7 @@ var _ = Describe(`VpcV1`, func() { Expect(networkACLRulePrototypeNetworkACLContextModel.Action).To(Equal(core.StringPtr("allow"))) Expect(networkACLRulePrototypeNetworkACLContextModel.Destination).To(Equal(core.StringPtr("192.168.3.2/32"))) Expect(networkACLRulePrototypeNetworkACLContextModel.Direction).To(Equal(core.StringPtr("inbound"))) + Expect(networkACLRulePrototypeNetworkACLContextModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) Expect(networkACLRulePrototypeNetworkACLContextModel.Name).To(Equal(core.StringPtr("my-rule-2"))) Expect(networkACLRulePrototypeNetworkACLContextModel.Source).To(Equal(core.StringPtr("192.168.3.2/32"))) Expect(networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax).To(Equal(core.Int64Ptr(int64(22)))) @@ -83000,6 +83082,7 @@ var _ = Describe(`VpcV1`, func() { networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") + networkACLRulePrototypeModel.IPVersion = core.StringPtr("ipv4") networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) @@ -83011,6 +83094,7 @@ var _ = Describe(`VpcV1`, func() { Expect(networkACLRulePrototypeModel.Before).To(Equal(networkACLRuleBeforePrototypeModel)) Expect(networkACLRulePrototypeModel.Destination).To(Equal(core.StringPtr("192.168.3.2/32"))) Expect(networkACLRulePrototypeModel.Direction).To(Equal(core.StringPtr("inbound"))) + Expect(networkACLRulePrototypeModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) Expect(networkACLRulePrototypeModel.Name).To(Equal(core.StringPtr("my-rule-2"))) Expect(networkACLRulePrototypeModel.Source).To(Equal(core.StringPtr("192.168.3.2/32"))) Expect(networkACLRulePrototypeModel.DestinationPortMax).To(Equal(core.Int64Ptr(int64(22)))) @@ -83483,7 +83567,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel := vpcService.NewCreateVPCRoutingTableOptions(vpcID) createVPCRoutingTableOptionsModel.SetVPCID("testString") createVPCRoutingTableOptionsModel.SetAcceptRoutesFrom([]vpcv1.ResourceFilter{*resourceFilterModel}) - createVPCRoutingTableOptionsModel.SetName("my-routing-table-2") + createVPCRoutingTableOptionsModel.SetName("my-routing-table-1") createVPCRoutingTableOptionsModel.SetRouteDirectLinkIngress(false) createVPCRoutingTableOptionsModel.SetRouteInternetIngress(false) createVPCRoutingTableOptionsModel.SetRouteTransitGatewayIngress(false) @@ -83493,7 +83577,7 @@ var _ = Describe(`VpcV1`, func() { Expect(createVPCRoutingTableOptionsModel).ToNot(BeNil()) Expect(createVPCRoutingTableOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(createVPCRoutingTableOptionsModel.AcceptRoutesFrom).To(Equal([]vpcv1.ResourceFilter{*resourceFilterModel})) - Expect(createVPCRoutingTableOptionsModel.Name).To(Equal(core.StringPtr("my-routing-table-2"))) + Expect(createVPCRoutingTableOptionsModel.Name).To(Equal(core.StringPtr("my-routing-table-1"))) Expect(createVPCRoutingTableOptionsModel.RouteDirectLinkIngress).To(Equal(core.BoolPtr(false))) Expect(createVPCRoutingTableOptionsModel.RouteInternetIngress).To(Equal(core.BoolPtr(false))) Expect(createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress).To(Equal(core.BoolPtr(false))) From 53982cf885f6b3d3b8e29d1bef7627dacfdfeffe Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 1 Feb 2023 10:38:31 +0530 Subject: [PATCH 020/103] changes --- common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 2 +- common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go | 2 +- go.mod | 4 ++-- go.sum | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 3c82564021..79a9f0316f 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -30,8 +30,8 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" + common "github.com/IBM/vpc-go-sdk/common" "github.com/go-openapi/strfmt" - common "github.ibm.com/ibmcloud/vpc-go-sdk/common" ) // VpcV1 : The IBM Cloud Virtual Private Cloud (VPC) API can be used to programmatically provision and manage virtual diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go index a89cf8fbc4..37b4c4fac1 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go @@ -27,10 +27,10 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/go-openapi/strfmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.ibm.com/ibmcloud/vpc-go-sdk/vpcv1" ) var _ = Describe(`VpcV1`, func() { diff --git a/go.mod b/go.mod index da0ff666d3..dd204834c4 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/IBM/continuous-delivery-go-sdk v1.0.4 github.com/IBM/event-notifications-go-admin-sdk v0.1.2 github.com/IBM/eventstreams-go-sdk v1.2.0 - github.com/IBM/go-sdk-core/v5 v5.10.2 + github.com/IBM/go-sdk-core/v5 v5.12.0 github.com/IBM/ibm-cos-sdk-go v1.9.0 github.com/IBM/ibm-cos-sdk-go-config v1.2.0 github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20211109141421-a4b61b05f7d1 @@ -173,4 +173,4 @@ replace github.com/softlayer/softlayer-go v1.0.3 => github.com/IBM-Cloud/softlay replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt/jwt v3.2.1+incompatible -replace github.com/IBM/vpc-go-sdk v0.28.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.30.0 => ./common/github.com/IBM/vpc-go-sdk diff --git a/go.sum b/go.sum index 7a0c1c6db2..b19150fab2 100644 --- a/go.sum +++ b/go.sum @@ -75,6 +75,8 @@ github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.10.2 h1:bfqhYNwwpJ3zJQSYpF3umhmRIKaa762itvJkTAWCCLU= github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= +github.com/IBM/go-sdk-core/v5 v5.12.0 h1:S7sSYQUe0f/xLh87ubwoXWQeUmRCwDNUv3qB4LMC0SI= +github.com/IBM/go-sdk-core/v5 v5.12.0/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= github.com/IBM/ibm-cos-sdk-go v1.3.1/go.mod h1:YLBAYobEA8bD27P7xpMwSQeNQu6W3DNBtBComXrRzRY= github.com/IBM/ibm-cos-sdk-go v1.9.0 h1:kXTLB9GBwks3+YZopYz/eRbdyeVl2BXFALeqtQ8Duoc= github.com/IBM/ibm-cos-sdk-go v1.9.0/go.mod h1:Oi8AC5WNDhmUJgbo1GL2FtBdo0nRgbzE/1HmCL1SERU= From ee193871a4b99716c8fa25bd2d3eea717f63591c Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 8 Feb 2023 10:24:41 +0530 Subject: [PATCH 021/103] updated the sdk to latest on 2023-02-07 --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 608 +- .../IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go | 88781 ---------------- 2 files changed, 607 insertions(+), 88782 deletions(-) delete mode 100644 common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 79a9f0316f..15f553296b 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -37,7 +37,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: 2023-01-31 +// API Version: 2023-02-07 type VpcV1 struct { Service *core.BaseService @@ -9372,6 +9372,9 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB if createBackupPolicyPlanOptions.AttachUserTags != nil { body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags } + if createBackupPolicyPlanOptions.ClonePolicy != nil { + body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy + } if createBackupPolicyPlanOptions.CopyUserTags != nil { body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags } @@ -12423,6 +12426,9 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt if listSnapshotsOptions.BackupPolicyPlanID != nil { builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) } + if listSnapshotsOptions.ClonesZoneName != nil { + builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName)) + } request, err := builder.Build() if err != nil { @@ -12700,6 +12706,251 @@ func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotO return } +// ListSnapshotClones : List all clones for a snapshot +// This request lists all clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. +func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + return vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) +} + +// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *listSnapshotClonesOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listSnapshotClonesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSnapshotClone : Delete a snapshot clone +// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated +// from the snapshot. +func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) +} + +// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSnapshotCloneOptions.ID, + "zone_name": *deleteSnapshotCloneOptions.ZoneName, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSnapshotClone : Retrieve a snapshot clone +// This request retrieves a single clone specified by the snapshot identifier and zone name in the URL. +func (vpc *VpcV1) GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + return vpc.GetSnapshotCloneWithContext(context.Background(), getSnapshotCloneOptions) +} + +// GetSnapshotCloneWithContext is an alternate form of the GetSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotCloneOptions, "getSnapshotCloneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSnapshotCloneOptions, "getSnapshotCloneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSnapshotCloneOptions.ID, + "zone_name": *getSnapshotCloneOptions.ZoneName, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSnapshotCloneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSnapshotClone : Create a clone for a snapshot +// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if +// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. +func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + return vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) +} + +// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *createSnapshotCloneOptions.ID, + "zone_name": *createSnapshotCloneOptions.ZoneName, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createSnapshotCloneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + if err != nil { + return + } + response.Result = result + } + + return +} + // ListRegions : List all regions // This request lists all regions. Each region is a separate geographic area that contains multiple isolated zones. // Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones @@ -22414,6 +22665,8 @@ type BackupPolicyPlan struct { // 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"` @@ -22474,6 +22727,10 @@ func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicy) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) if err != nil { return @@ -22514,6 +22771,88 @@ func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) 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 { + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneReference) + if err != nil { + 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 { + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) + if err != nil { + 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") + 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 { + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BackupPolicyPlanCollection : BackupPolicyPlanCollection struct type BackupPolicyPlanCollection struct { // Collection of backup policy plans. @@ -22612,6 +22951,8 @@ type BackupPolicyPlanPatch struct { // 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"` @@ -22639,6 +22980,10 @@ func UnmarshalBackupPolicyPlanPatch(m map[string]json.RawMessage, result interfa if err != nil { return } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPatch) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) if err != nil { return @@ -22677,6 +23022,8 @@ type BackupPolicyPlanPrototype struct { // 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"` @@ -22714,6 +23061,10 @@ func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result int if err != nil { return } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPrototype) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) if err != nil { return @@ -25579,6 +25930,8 @@ type CreateBackupPolicyPlanOptions struct { // 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"` @@ -25624,6 +25977,12 @@ func (_options *CreateBackupPolicyPlanOptions) SetAttachUserTags(attachUserTags return _options } +// SetClonePolicy : Allow user to set ClonePolicy +func (_options *CreateBackupPolicyPlanOptions) SetClonePolicy(clonePolicy *BackupPolicyPlanClonePolicyPrototype) *CreateBackupPolicyPlanOptions { + _options.ClonePolicy = clonePolicy + return _options +} + // SetCopyUserTags : Allow user to set CopyUserTags func (_options *CreateBackupPolicyPlanOptions) SetCopyUserTags(copyUserTags bool) *CreateBackupPolicyPlanOptions { _options.CopyUserTags = core.BoolPtr(copyUserTags) @@ -28123,6 +28482,44 @@ func (options *CreateSecurityGroupTargetBindingOptions) SetHeaders(param map[str return options } +// CreateSnapshotCloneOptions : The CreateSnapshotClone options. +type CreateSnapshotCloneOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // The zone name. + ZoneName *string `json:"zone_name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSnapshotCloneOptions : Instantiate CreateSnapshotCloneOptions +func (*VpcV1) NewCreateSnapshotCloneOptions(id string, zoneName string) *CreateSnapshotCloneOptions { + return &CreateSnapshotCloneOptions{ + ID: core.StringPtr(id), + ZoneName: core.StringPtr(zoneName), + } +} + +// SetID : Allow user to set ID +func (_options *CreateSnapshotCloneOptions) SetID(id string) *CreateSnapshotCloneOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *CreateSnapshotCloneOptions) SetZoneName(zoneName string) *CreateSnapshotCloneOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSnapshotCloneOptions) SetHeaders(param map[string]string) *CreateSnapshotCloneOptions { + options.Headers = param + return options +} + // CreateSnapshotOptions : The CreateSnapshot options. type CreateSnapshotOptions struct { // The snapshot prototype object. @@ -32366,6 +32763,44 @@ func (options *DeleteSecurityGroupTargetBindingOptions) SetHeaders(param map[str return options } +// DeleteSnapshotCloneOptions : The DeleteSnapshotClone options. +type DeleteSnapshotCloneOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // The zone name. + ZoneName *string `json:"zone_name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSnapshotCloneOptions : Instantiate DeleteSnapshotCloneOptions +func (*VpcV1) NewDeleteSnapshotCloneOptions(id string, zoneName string) *DeleteSnapshotCloneOptions { + return &DeleteSnapshotCloneOptions{ + ID: core.StringPtr(id), + ZoneName: core.StringPtr(zoneName), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteSnapshotCloneOptions) SetID(id string) *DeleteSnapshotCloneOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *DeleteSnapshotCloneOptions) SetZoneName(zoneName string) *DeleteSnapshotCloneOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSnapshotCloneOptions) SetHeaders(param map[string]string) *DeleteSnapshotCloneOptions { + options.Headers = param + return options +} + // DeleteSnapshotOptions : The DeleteSnapshot options. type DeleteSnapshotOptions struct { // The snapshot identifier. @@ -36229,6 +36664,44 @@ func (options *GetSecurityGroupTargetOptions) SetHeaders(param map[string]string return options } +// GetSnapshotCloneOptions : The GetSnapshotClone options. +type GetSnapshotCloneOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // The zone name. + ZoneName *string `json:"zone_name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSnapshotCloneOptions : Instantiate GetSnapshotCloneOptions +func (*VpcV1) NewGetSnapshotCloneOptions(id string, zoneName string) *GetSnapshotCloneOptions { + return &GetSnapshotCloneOptions{ + ID: core.StringPtr(id), + ZoneName: core.StringPtr(zoneName), + } +} + +// SetID : Allow user to set ID +func (_options *GetSnapshotCloneOptions) SetID(id string) *GetSnapshotCloneOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *GetSnapshotCloneOptions) SetZoneName(zoneName string) *GetSnapshotCloneOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSnapshotCloneOptions) SetHeaders(param map[string]string) *GetSnapshotCloneOptions { + options.Headers = param + return options +} + // GetSnapshotOptions : The GetSnapshot options. type GetSnapshotOptions struct { // The snapshot identifier. @@ -46734,6 +47207,34 @@ func (options *ListSecurityGroupsOptions) SetHeaders(param map[string]string) *L return options } +// ListSnapshotClonesOptions : The ListSnapshotClones options. +type ListSnapshotClonesOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSnapshotClonesOptions : Instantiate ListSnapshotClonesOptions +func (*VpcV1) NewListSnapshotClonesOptions(id string) *ListSnapshotClonesOptions { + return &ListSnapshotClonesOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListSnapshotClonesOptions) SetID(id string) *ListSnapshotClonesOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSnapshotClonesOptions) SetHeaders(param map[string]string) *ListSnapshotClonesOptions { + options.Headers = param + return options +} + // ListSnapshotsOptions : The ListSnapshots options. type ListSnapshotsOptions struct { // A server-provided token determining what resource to start the page on. @@ -46777,6 +47278,9 @@ type ListSnapshotsOptions struct { // Filters the collection to backup policy jobs with the backup plan with the specified identifier. BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` + // Filters the collection to resources with a clone in the specified zone. + ClonesZoneName *string `json:"clones[].zone.name,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -46861,6 +47365,12 @@ func (_options *ListSnapshotsOptions) SetBackupPolicyPlanID(backupPolicyPlanID s return _options } +// SetClonesZoneName : Allow user to set ClonesZoneName +func (_options *ListSnapshotsOptions) SetClonesZoneName(clonesZoneName string) *ListSnapshotsOptions { + _options.ClonesZoneName = core.StringPtr(clonesZoneName) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListSnapshotsOptions) SetHeaders(param map[string]string) *ListSnapshotsOptions { options.Headers = param @@ -57429,6 +57939,9 @@ type Snapshot struct { // created before 1 January 2022. CapturedAt *strfmt.DateTime `json:"captured_at,omitempty"` + // Clones for this snapshot. + Clones []SnapshotClone `json:"clones" validate:"required"` + // The date and time that this snapshot was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -57532,6 +58045,10 @@ func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err er if err != nil { return } + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -57608,6 +58125,81 @@ func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err er return } +// SnapshotClone : SnapshotClone struct +type SnapshotClone struct { + // Indicates whether this snapshot clone is available for use. + Available *bool `json:"available" validate:"required"` + + // The date and time that this snapshot clone was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The zone this snapshot clone resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalSnapshotClone unmarshals an instance of SnapshotClone from the specified map of raw messages. +func UnmarshalSnapshotClone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotClone) + err = core.UnmarshalPrimitive(m, "available", &obj.Available) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotCloneCollection : SnapshotCloneCollection struct +type SnapshotCloneCollection struct { + // Collection of snapshot clones. + Clones []SnapshotClone `json:"clones" validate:"required"` +} + +// UnmarshalSnapshotCloneCollection unmarshals an instance of SnapshotCloneCollection from the specified map of raw messages. +func UnmarshalSnapshotCloneCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotCloneCollection) + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotClonePrototype : SnapshotClonePrototype struct +type SnapshotClonePrototype struct { + // The zone this snapshot clone will reside in. Must be in the same region as the + // snapshot. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewSnapshotClonePrototype : Instantiate SnapshotClonePrototype (Generic Model Constructor) +func (*VpcV1) NewSnapshotClonePrototype(zone ZoneIdentityIntf) (_model *SnapshotClonePrototype, err error) { + _model = &SnapshotClonePrototype{ + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalSnapshotClonePrototype unmarshals an instance of SnapshotClonePrototype from the specified map of raw messages. +func UnmarshalSnapshotClonePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotClonePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SnapshotCollection : SnapshotCollection struct type SnapshotCollection struct { // A link to the first page of resources. @@ -57781,6 +58373,9 @@ func (snapshotPatch *SnapshotPatch) AsPatch() (_patch map[string]interface{}, er // Models which "extend" this model: // - SnapshotPrototypeSnapshotBySourceVolume type SnapshotPrototype struct { + // Clones to create for this snapshot. + Clones []SnapshotClonePrototype `json:"clones,omitempty"` + // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name // will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -57807,6 +58402,10 @@ type SnapshotPrototypeIntf interface { // UnmarshalSnapshotPrototype unmarshals an instance of SnapshotPrototype from the specified map of raw messages. func UnmarshalSnapshotPrototype(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SnapshotPrototype) + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -79664,6 +80263,9 @@ func UnmarshalSnapshotIdentityByID(m map[string]json.RawMessage, result interfac // SnapshotPrototypeSnapshotBySourceVolume : SnapshotPrototypeSnapshotBySourceVolume struct // This model "extends" SnapshotPrototype type SnapshotPrototypeSnapshotBySourceVolume struct { + // Clones to create for this snapshot. + Clones []SnapshotClonePrototype `json:"clones,omitempty"` + // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name // will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -79693,6 +80295,10 @@ func (*SnapshotPrototypeSnapshotBySourceVolume) isaSnapshotPrototype() bool { // UnmarshalSnapshotPrototypeSnapshotBySourceVolume unmarshals an instance of SnapshotPrototypeSnapshotBySourceVolume from the specified map of raw messages. func UnmarshalSnapshotPrototypeSnapshotBySourceVolume(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SnapshotPrototypeSnapshotBySourceVolume) + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go deleted file mode 100644 index 37b4c4fac1..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1_test.go +++ /dev/null @@ -1,88781 +0,0 @@ -/** - * (C) Copyright IBM Corp. 2021, 2022, 2023. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package vpcv1_test - -import ( - "bytes" - "context" - "fmt" - "io" - "net/http" - "net/http/httptest" - "os" - "time" - - "github.com/IBM/go-sdk-core/v5/core" - "github.com/IBM/vpc-go-sdk/vpcv1" - "github.com/go-openapi/strfmt" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe(`VpcV1`, func() { - var testServer *httptest.Server - Describe(`Service constructor tests`, func() { - version := "testString" - It(`Instantiate service client`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(vpcService).ToNot(BeNil()) - Expect(serviceErr).To(BeNil()) - }) - It(`Instantiate service client with error: Invalid URL`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: "{BAD_URL_STRING", - Version: core.StringPtr(version), - }) - Expect(vpcService).To(BeNil()) - Expect(serviceErr).ToNot(BeNil()) - }) - It(`Instantiate service client with error: Invalid Auth`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: "https://vpcv1/api", - Version: core.StringPtr(version), - Authenticator: &core.BasicAuthenticator{ - Username: "", - Password: "", - }, - }) - Expect(vpcService).To(BeNil()) - Expect(serviceErr).ToNot(BeNil()) - }) - It(`Instantiate service client with error: Validation Error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{}) - Expect(vpcService).To(BeNil()) - Expect(serviceErr).ToNot(BeNil()) - }) - }) - Describe(`Service constructor tests using external config`, func() { - version := "testString" - Context(`Using external config, construct service client instances`, func() { - // Map containing environment variables used in testing. - var testEnvironment = map[string]string{ - "VPC_URL": "https://vpcv1/api", - "VPC_AUTH_TYPE": "noauth", - } - - It(`Create service client using external config successfully`, func() { - SetTestEnvironment(testEnvironment) - vpcService, serviceErr := vpcv1.NewVpcV1UsingExternalConfig(&vpcv1.VpcV1Options{ - Version: core.StringPtr(version), - }) - Expect(vpcService).ToNot(BeNil()) - Expect(serviceErr).To(BeNil()) - ClearTestEnvironment(testEnvironment) - - clone := vpcService.Clone() - Expect(clone).ToNot(BeNil()) - Expect(clone.Service != vpcService.Service).To(BeTrue()) - Expect(clone.GetServiceURL()).To(Equal(vpcService.GetServiceURL())) - Expect(clone.Service.Options.Authenticator).To(Equal(vpcService.Service.Options.Authenticator)) - }) - It(`Create service client using external config and set url from constructor successfully`, func() { - SetTestEnvironment(testEnvironment) - vpcService, serviceErr := vpcv1.NewVpcV1UsingExternalConfig(&vpcv1.VpcV1Options{ - URL: "https://testService/api", - Version: core.StringPtr(version), - }) - Expect(vpcService).ToNot(BeNil()) - Expect(serviceErr).To(BeNil()) - Expect(vpcService.Service.GetServiceURL()).To(Equal("https://testService/api")) - ClearTestEnvironment(testEnvironment) - - clone := vpcService.Clone() - Expect(clone).ToNot(BeNil()) - Expect(clone.Service != vpcService.Service).To(BeTrue()) - Expect(clone.GetServiceURL()).To(Equal(vpcService.GetServiceURL())) - Expect(clone.Service.Options.Authenticator).To(Equal(vpcService.Service.Options.Authenticator)) - }) - It(`Create service client using external config and set url programatically successfully`, func() { - SetTestEnvironment(testEnvironment) - vpcService, serviceErr := vpcv1.NewVpcV1UsingExternalConfig(&vpcv1.VpcV1Options{ - Version: core.StringPtr(version), - }) - err := vpcService.SetServiceURL("https://testService/api") - Expect(err).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - Expect(serviceErr).To(BeNil()) - Expect(vpcService.Service.GetServiceURL()).To(Equal("https://testService/api")) - ClearTestEnvironment(testEnvironment) - - clone := vpcService.Clone() - Expect(clone).ToNot(BeNil()) - Expect(clone.Service != vpcService.Service).To(BeTrue()) - Expect(clone.GetServiceURL()).To(Equal(vpcService.GetServiceURL())) - Expect(clone.Service.Options.Authenticator).To(Equal(vpcService.Service.Options.Authenticator)) - }) - }) - Context(`Using external config, construct service client instances with error: Invalid Auth`, func() { - // Map containing environment variables used in testing. - var testEnvironment = map[string]string{ - "VPC_URL": "https://vpcv1/api", - "VPC_AUTH_TYPE": "someOtherAuth", - } - - SetTestEnvironment(testEnvironment) - vpcService, serviceErr := vpcv1.NewVpcV1UsingExternalConfig(&vpcv1.VpcV1Options{ - Version: core.StringPtr(version), - }) - - It(`Instantiate service client with error`, func() { - Expect(vpcService).To(BeNil()) - Expect(serviceErr).ToNot(BeNil()) - ClearTestEnvironment(testEnvironment) - }) - }) - Context(`Using external config, construct service client instances with error: Invalid URL`, func() { - // Map containing environment variables used in testing. - var testEnvironment = map[string]string{ - "VPC_AUTH_TYPE": "NOAuth", - } - - SetTestEnvironment(testEnvironment) - vpcService, serviceErr := vpcv1.NewVpcV1UsingExternalConfig(&vpcv1.VpcV1Options{ - URL: "{BAD_URL_STRING", - Version: core.StringPtr(version), - }) - - It(`Instantiate service client with error`, func() { - Expect(vpcService).To(BeNil()) - Expect(serviceErr).ToNot(BeNil()) - ClearTestEnvironment(testEnvironment) - }) - }) - }) - Describe(`Regional endpoint tests`, func() { - It(`GetServiceURLForRegion(region string)`, func() { - var url string - var err error - url, err = vpcv1.GetServiceURLForRegion("INVALID_REGION") - Expect(url).To(BeEmpty()) - Expect(err).ToNot(BeNil()) - fmt.Fprintf(GinkgoWriter, "Expected error: %s\n", err.Error()) - }) - }) - Describe(`ListVpcs(listVpcsOptions *ListVpcsOptions) - Operation response error`, func() { - version := "testString" - listVpcsPath := "/vpcs" - 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(listVpcsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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"})) - // TODO: Add check for classic_access query parameter - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListVpcs 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 ListVpcsOptions model - listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) - listVpcsOptionsModel.Start = core.StringPtr("testString") - listVpcsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) - listVpcsOptionsModel.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.ListVpcs(listVpcsOptionsModel) - 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.ListVpcs(listVpcsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVpcs(listVpcsOptions *ListVpcsOptions)`, func() { - version := "testString" - listVpcsPath := "/vpcs" - 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(listVpcsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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"})) - // TODO: Add check for classic_access query parameter - // 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/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/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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 ListVpcsOptions model - listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) - listVpcsOptionsModel.Start = core.StringPtr("testString") - listVpcsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) - listVpcsOptionsModel.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.ListVpcsWithContext(ctx, listVpcsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVpcs(listVpcsOptionsModel) - 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.ListVpcsWithContext(ctx, listVpcsOptionsModel) - 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(listVpcsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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"})) - // TODO: Add check for classic_access query parameter - // 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/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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.ListVpcs(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListVpcsOptions model - listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) - listVpcsOptionsModel.Start = core.StringPtr("testString") - listVpcsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) - listVpcsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVpcs(listVpcsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListVpcs 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 ListVpcsOptions model - listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) - listVpcsOptionsModel.Start = core.StringPtr("testString") - listVpcsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) - listVpcsOptionsModel.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.ListVpcs(listVpcsOptionsModel) - 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 ListVpcs 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 ListVpcsOptions model - listVpcsOptionsModel := new(vpcv1.ListVpcsOptions) - listVpcsOptionsModel.Start = core.StringPtr("testString") - listVpcsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVpcsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVpcsOptionsModel.ClassicAccess = core.BoolPtr(true) - listVpcsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListVpcs(listVpcsOptionsModel) - 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.VPCCollection) - nextObject := new(vpcv1.VPCCollectionNext) - 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.VPCCollection) - - 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.VPCCollection) - nextObject := new(vpcv1.VPCCollectionNext) - 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(listVpcsPath)) - 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,"vpcs":[{"classic_access":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"default_routing_table":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","name":"my-routing-table-1","resource_type":"routing_table"},"default_security_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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"}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"vpcs":[{"classic_access":false,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"default_routing_table":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","name":"my-routing-table-1","resource_type":"routing_table"},"default_security_group":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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"}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use VpcsPager.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()) - - listVpcsOptionsModel := &vpcv1.ListVpcsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - ClassicAccess: core.BoolPtr(true), - } - - pager, err := vpcService.NewVpcsPager(listVpcsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.VPC - 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 VpcsPager.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()) - - listVpcsOptionsModel := &vpcv1.ListVpcsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - ClassicAccess: core.BoolPtr(true), - } - - pager, err := vpcService.NewVpcsPager(listVpcsOptionsModel) - 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(`CreateVPC(createVPCOptions *CreateVPCOptions) - Operation response error`, func() { - version := "testString" - createVPCPath := "/vpcs" - 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(createVPCPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateVPC 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateVPCOptions model - createVPCOptionsModel := new(vpcv1.CreateVPCOptions) - createVPCOptionsModel.AddressPrefixManagement = core.StringPtr("manual") - createVPCOptionsModel.ClassicAccess = core.BoolPtr(false) - createVPCOptionsModel.Name = core.StringPtr("my-vpc") - createVPCOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVPCOptionsModel.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.CreateVPC(createVPCOptionsModel) - 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.CreateVPC(createVPCOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateVPC(createVPCOptions *CreateVPCOptions)`, func() { - version := "testString" - createVPCPath := "/vpcs" - 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(createVPCPath)) - 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{"testString"})) - 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", `{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 CreateVPC 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateVPCOptions model - createVPCOptionsModel := new(vpcv1.CreateVPCOptions) - createVPCOptionsModel.AddressPrefixManagement = core.StringPtr("manual") - createVPCOptionsModel.ClassicAccess = core.BoolPtr(false) - createVPCOptionsModel.Name = core.StringPtr("my-vpc") - createVPCOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVPCOptionsModel.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.CreateVPCWithContext(ctx, createVPCOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateVPC(createVPCOptionsModel) - 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.CreateVPCWithContext(ctx, createVPCOptionsModel) - 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(createVPCPath)) - 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{"testString"})) - 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", `{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 CreateVPC 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.CreateVPC(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 CreateVPCOptions model - createVPCOptionsModel := new(vpcv1.CreateVPCOptions) - createVPCOptionsModel.AddressPrefixManagement = core.StringPtr("manual") - createVPCOptionsModel.ClassicAccess = core.BoolPtr(false) - createVPCOptionsModel.Name = core.StringPtr("my-vpc") - createVPCOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVPCOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateVPC(createVPCOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateVPC 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateVPCOptions model - createVPCOptionsModel := new(vpcv1.CreateVPCOptions) - createVPCOptionsModel.AddressPrefixManagement = core.StringPtr("manual") - createVPCOptionsModel.ClassicAccess = core.BoolPtr(false) - createVPCOptionsModel.Name = core.StringPtr("my-vpc") - createVPCOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVPCOptionsModel.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.CreateVPC(createVPCOptionsModel) - 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(201) - })) - }) - It(`Invoke CreateVPC 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") - - // Construct an instance of the CreateVPCOptions model - createVPCOptionsModel := new(vpcv1.CreateVPCOptions) - createVPCOptionsModel.AddressPrefixManagement = core.StringPtr("manual") - createVPCOptionsModel.ClassicAccess = core.BoolPtr(false) - createVPCOptionsModel.Name = core.StringPtr("my-vpc") - createVPCOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVPCOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateVPC(createVPCOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteVPC(deleteVPCOptions *DeleteVPCOptions)`, func() { - version := "testString" - deleteVPCPath := "/vpcs/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(deleteVPCPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteVPC 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.DeleteVPC(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteVPCOptions model - deleteVPCOptionsModel := new(vpcv1.DeleteVPCOptions) - deleteVPCOptionsModel.ID = core.StringPtr("testString") - deleteVPCOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteVPC(deleteVPCOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteVPC 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 DeleteVPCOptions model - deleteVPCOptionsModel := new(vpcv1.DeleteVPCOptions) - deleteVPCOptionsModel.ID = core.StringPtr("testString") - deleteVPCOptionsModel.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.DeleteVPC(deleteVPCOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteVPCOptions model with no property values - deleteVPCOptionsModelNew := new(vpcv1.DeleteVPCOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteVPC(deleteVPCOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPC(getVPCOptions *GetVPCOptions) - Operation response error`, func() { - version := "testString" - getVPCPath := "/vpcs/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(getVPCPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVPC 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 GetVPCOptions model - getVPCOptionsModel := new(vpcv1.GetVPCOptions) - getVPCOptionsModel.ID = core.StringPtr("testString") - getVPCOptionsModel.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.GetVPC(getVPCOptionsModel) - 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.GetVPC(getVPCOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPC(getVPCOptions *GetVPCOptions)`, func() { - version := "testString" - getVPCPath := "/vpcs/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(getVPCPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 GetVPC 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 GetVPCOptions model - getVPCOptionsModel := new(vpcv1.GetVPCOptions) - getVPCOptionsModel.ID = core.StringPtr("testString") - getVPCOptionsModel.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.GetVPCWithContext(ctx, getVPCOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVPC(getVPCOptionsModel) - 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.GetVPCWithContext(ctx, getVPCOptionsModel) - 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(getVPCPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 GetVPC 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.GetVPC(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetVPCOptions model - getVPCOptionsModel := new(vpcv1.GetVPCOptions) - getVPCOptionsModel.ID = core.StringPtr("testString") - getVPCOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVPC(getVPCOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVPC 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 GetVPCOptions model - getVPCOptionsModel := new(vpcv1.GetVPCOptions) - getVPCOptionsModel.ID = core.StringPtr("testString") - getVPCOptionsModel.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.GetVPC(getVPCOptionsModel) - 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 GetVPCOptions model with no property values - getVPCOptionsModelNew := new(vpcv1.GetVPCOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVPC(getVPCOptionsModelNew) - 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 GetVPC 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 GetVPCOptions model - getVPCOptionsModel := new(vpcv1.GetVPCOptions) - getVPCOptionsModel.ID = core.StringPtr("testString") - getVPCOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVPC(getVPCOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPC(updateVPCOptions *UpdateVPCOptions) - Operation response error`, func() { - version := "testString" - updateVPCPath := "/vpcs/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(updateVPCPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateVPC 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 VPCPatch model - vpcPatchModel := new(vpcv1.VPCPatch) - vpcPatchModel.Name = core.StringPtr("my-vpc") - vpcPatchModelAsPatch, asPatchErr := vpcPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCOptions model - updateVPCOptionsModel := new(vpcv1.UpdateVPCOptions) - updateVPCOptionsModel.ID = core.StringPtr("testString") - updateVPCOptionsModel.VPCPatch = vpcPatchModelAsPatch - updateVPCOptionsModel.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.UpdateVPC(updateVPCOptionsModel) - 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.UpdateVPC(updateVPCOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPC(updateVPCOptions *UpdateVPCOptions)`, func() { - version := "testString" - updateVPCPath := "/vpcs/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(updateVPCPath)) - 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{"testString"})) - 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", `{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 UpdateVPC 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 VPCPatch model - vpcPatchModel := new(vpcv1.VPCPatch) - vpcPatchModel.Name = core.StringPtr("my-vpc") - vpcPatchModelAsPatch, asPatchErr := vpcPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCOptions model - updateVPCOptionsModel := new(vpcv1.UpdateVPCOptions) - updateVPCOptionsModel.ID = core.StringPtr("testString") - updateVPCOptionsModel.VPCPatch = vpcPatchModelAsPatch - updateVPCOptionsModel.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.UpdateVPCWithContext(ctx, updateVPCOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateVPC(updateVPCOptionsModel) - 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.UpdateVPCWithContext(ctx, updateVPCOptionsModel) - 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(updateVPCPath)) - 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{"testString"})) - 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", `{"classic_access": false, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "default_routing_table": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-routing-table-1", "resource_type": "routing_table"}, "default_security_group": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 UpdateVPC 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.UpdateVPC(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the VPCPatch model - vpcPatchModel := new(vpcv1.VPCPatch) - vpcPatchModel.Name = core.StringPtr("my-vpc") - vpcPatchModelAsPatch, asPatchErr := vpcPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCOptions model - updateVPCOptionsModel := new(vpcv1.UpdateVPCOptions) - updateVPCOptionsModel.ID = core.StringPtr("testString") - updateVPCOptionsModel.VPCPatch = vpcPatchModelAsPatch - updateVPCOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateVPC(updateVPCOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateVPC 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 VPCPatch model - vpcPatchModel := new(vpcv1.VPCPatch) - vpcPatchModel.Name = core.StringPtr("my-vpc") - vpcPatchModelAsPatch, asPatchErr := vpcPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCOptions model - updateVPCOptionsModel := new(vpcv1.UpdateVPCOptions) - updateVPCOptionsModel.ID = core.StringPtr("testString") - updateVPCOptionsModel.VPCPatch = vpcPatchModelAsPatch - updateVPCOptionsModel.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.UpdateVPC(updateVPCOptionsModel) - 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 UpdateVPCOptions model with no property values - updateVPCOptionsModelNew := new(vpcv1.UpdateVPCOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateVPC(updateVPCOptionsModelNew) - 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 UpdateVPC 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 VPCPatch model - vpcPatchModel := new(vpcv1.VPCPatch) - vpcPatchModel.Name = core.StringPtr("my-vpc") - vpcPatchModelAsPatch, asPatchErr := vpcPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCOptions model - updateVPCOptionsModel := new(vpcv1.UpdateVPCOptions) - updateVPCOptionsModel.ID = core.StringPtr("testString") - updateVPCOptionsModel.VPCPatch = vpcPatchModelAsPatch - updateVPCOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateVPC(updateVPCOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) - Operation response error`, func() { - version := "testString" - getVPCDefaultNetworkACLPath := "/vpcs/testString/default_network_acl" - 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(getVPCDefaultNetworkACLPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVPCDefaultNetworkACL 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 GetVPCDefaultNetworkACLOptions model - getVPCDefaultNetworkACLOptionsModel := new(vpcv1.GetVPCDefaultNetworkACLOptions) - getVPCDefaultNetworkACLOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultNetworkACLOptionsModel.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.GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptionsModel) - 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.GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions)`, func() { - version := "testString" - getVPCDefaultNetworkACLPath := "/vpcs/testString/default_network_acl" - 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(getVPCDefaultNetworkACLPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "mnemonic-ersatz-eatery-mythology", "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetVPCDefaultNetworkACL 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 GetVPCDefaultNetworkACLOptions model - getVPCDefaultNetworkACLOptionsModel := new(vpcv1.GetVPCDefaultNetworkACLOptions) - getVPCDefaultNetworkACLOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultNetworkACLOptionsModel.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.GetVPCDefaultNetworkACLWithContext(ctx, getVPCDefaultNetworkACLOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptionsModel) - 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.GetVPCDefaultNetworkACLWithContext(ctx, getVPCDefaultNetworkACLOptionsModel) - 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(getVPCDefaultNetworkACLPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "mnemonic-ersatz-eatery-mythology", "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetVPCDefaultNetworkACL 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.GetVPCDefaultNetworkACL(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetVPCDefaultNetworkACLOptions model - getVPCDefaultNetworkACLOptionsModel := new(vpcv1.GetVPCDefaultNetworkACLOptions) - getVPCDefaultNetworkACLOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVPCDefaultNetworkACL 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 GetVPCDefaultNetworkACLOptions model - getVPCDefaultNetworkACLOptionsModel := new(vpcv1.GetVPCDefaultNetworkACLOptions) - getVPCDefaultNetworkACLOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultNetworkACLOptionsModel.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.GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptionsModel) - 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 GetVPCDefaultNetworkACLOptions model with no property values - getVPCDefaultNetworkACLOptionsModelNew := new(vpcv1.GetVPCDefaultNetworkACLOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptionsModelNew) - 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 GetVPCDefaultNetworkACL 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 GetVPCDefaultNetworkACLOptions model - getVPCDefaultNetworkACLOptionsModel := new(vpcv1.GetVPCDefaultNetworkACLOptions) - getVPCDefaultNetworkACLOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) - Operation response error`, func() { - version := "testString" - getVPCDefaultRoutingTablePath := "/vpcs/testString/default_routing_table" - 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(getVPCDefaultRoutingTablePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVPCDefaultRoutingTable 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 GetVPCDefaultRoutingTableOptions model - getVPCDefaultRoutingTableOptionsModel := new(vpcv1.GetVPCDefaultRoutingTableOptions) - getVPCDefaultRoutingTableOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultRoutingTableOptionsModel.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.GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptionsModel) - 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.GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions)`, func() { - version := "testString" - getVPCDefaultRoutingTablePath := "/vpcs/testString/default_routing_table" - 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(getVPCDefaultRoutingTablePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) - })) - }) - It(`Invoke GetVPCDefaultRoutingTable 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 GetVPCDefaultRoutingTableOptions model - getVPCDefaultRoutingTableOptionsModel := new(vpcv1.GetVPCDefaultRoutingTableOptions) - getVPCDefaultRoutingTableOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultRoutingTableOptionsModel.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.GetVPCDefaultRoutingTableWithContext(ctx, getVPCDefaultRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptionsModel) - 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.GetVPCDefaultRoutingTableWithContext(ctx, getVPCDefaultRoutingTableOptionsModel) - 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(getVPCDefaultRoutingTablePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) - })) - }) - It(`Invoke GetVPCDefaultRoutingTable 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.GetVPCDefaultRoutingTable(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetVPCDefaultRoutingTableOptions model - getVPCDefaultRoutingTableOptionsModel := new(vpcv1.GetVPCDefaultRoutingTableOptions) - getVPCDefaultRoutingTableOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVPCDefaultRoutingTable 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 GetVPCDefaultRoutingTableOptions model - getVPCDefaultRoutingTableOptionsModel := new(vpcv1.GetVPCDefaultRoutingTableOptions) - getVPCDefaultRoutingTableOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultRoutingTableOptionsModel.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.GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptionsModel) - 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 GetVPCDefaultRoutingTableOptions model with no property values - getVPCDefaultRoutingTableOptionsModelNew := new(vpcv1.GetVPCDefaultRoutingTableOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptionsModelNew) - 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 GetVPCDefaultRoutingTable 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 GetVPCDefaultRoutingTableOptions model - getVPCDefaultRoutingTableOptionsModel := new(vpcv1.GetVPCDefaultRoutingTableOptions) - getVPCDefaultRoutingTableOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) - Operation response error`, func() { - version := "testString" - getVPCDefaultSecurityGroupPath := "/vpcs/testString/default_security_group" - 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(getVPCDefaultSecurityGroupPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVPCDefaultSecurityGroup 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 GetVPCDefaultSecurityGroupOptions model - getVPCDefaultSecurityGroupOptionsModel := new(vpcv1.GetVPCDefaultSecurityGroupOptions) - getVPCDefaultSecurityGroupOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultSecurityGroupOptionsModel.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.GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptionsModel) - 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.GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions)`, func() { - version := "testString" - getVPCDefaultSecurityGroupPath := "/vpcs/testString/default_security_group" - 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(getVPCDefaultSecurityGroupPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetVPCDefaultSecurityGroup 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 GetVPCDefaultSecurityGroupOptions model - getVPCDefaultSecurityGroupOptionsModel := new(vpcv1.GetVPCDefaultSecurityGroupOptions) - getVPCDefaultSecurityGroupOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultSecurityGroupOptionsModel.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.GetVPCDefaultSecurityGroupWithContext(ctx, getVPCDefaultSecurityGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptionsModel) - 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.GetVPCDefaultSecurityGroupWithContext(ctx, getVPCDefaultSecurityGroupOptionsModel) - 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(getVPCDefaultSecurityGroupPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetVPCDefaultSecurityGroup 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.GetVPCDefaultSecurityGroup(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetVPCDefaultSecurityGroupOptions model - getVPCDefaultSecurityGroupOptionsModel := new(vpcv1.GetVPCDefaultSecurityGroupOptions) - getVPCDefaultSecurityGroupOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVPCDefaultSecurityGroup 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 GetVPCDefaultSecurityGroupOptions model - getVPCDefaultSecurityGroupOptionsModel := new(vpcv1.GetVPCDefaultSecurityGroupOptions) - getVPCDefaultSecurityGroupOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultSecurityGroupOptionsModel.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.GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptionsModel) - 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 GetVPCDefaultSecurityGroupOptions model with no property values - getVPCDefaultSecurityGroupOptionsModelNew := new(vpcv1.GetVPCDefaultSecurityGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptionsModelNew) - 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 GetVPCDefaultSecurityGroup 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 GetVPCDefaultSecurityGroupOptions model - getVPCDefaultSecurityGroupOptionsModel := new(vpcv1.GetVPCDefaultSecurityGroupOptions) - getVPCDefaultSecurityGroupOptionsModel.ID = core.StringPtr("testString") - getVPCDefaultSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) - Operation response error`, func() { - version := "testString" - listVPCAddressPrefixesPath := "/vpcs/testString/address_prefixes" - 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(listVPCAddressPrefixesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListVPCAddressPrefixes 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 ListVPCAddressPrefixesOptions model - listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) - listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCAddressPrefixesOptionsModel.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.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModel) - 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.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions)`, func() { - version := "testString" - listVPCAddressPrefixesPath := "/vpcs/testString/address_prefixes" - 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(listVPCAddressPrefixesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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}`) - })) - }) - It(`Invoke ListVPCAddressPrefixes 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 ListVPCAddressPrefixesOptions model - listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) - listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCAddressPrefixesOptionsModel.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.ListVPCAddressPrefixesWithContext(ctx, listVPCAddressPrefixesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModel) - 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.ListVPCAddressPrefixesWithContext(ctx, listVPCAddressPrefixesOptionsModel) - 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(listVPCAddressPrefixesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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}`) - })) - }) - It(`Invoke ListVPCAddressPrefixes 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.ListVPCAddressPrefixes(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListVPCAddressPrefixesOptions model - listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) - listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCAddressPrefixesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListVPCAddressPrefixes 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 ListVPCAddressPrefixesOptions model - listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) - listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCAddressPrefixesOptionsModel.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.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModel) - 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 ListVPCAddressPrefixesOptions model with no property values - listVPCAddressPrefixesOptionsModelNew := new(vpcv1.ListVPCAddressPrefixesOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModelNew) - 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 ListVPCAddressPrefixes 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 ListVPCAddressPrefixesOptions model - listVPCAddressPrefixesOptionsModel := new(vpcv1.ListVPCAddressPrefixesOptions) - listVPCAddressPrefixesOptionsModel.VPCID = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Start = core.StringPtr("testString") - listVPCAddressPrefixesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCAddressPrefixesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListVPCAddressPrefixes(listVPCAddressPrefixesOptionsModel) - 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.AddressPrefixCollection) - nextObject := new(vpcv1.AddressPrefixCollectionNext) - 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.AddressPrefixCollection) - - 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.AddressPrefixCollection) - nextObject := new(vpcv1.AddressPrefixCollectionNext) - 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(listVPCAddressPrefixesPath)) - 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"},"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"}}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - 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"}}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use VPCAddressPrefixesPager.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()) - - listVPCAddressPrefixesOptionsModel := &vpcv1.ListVPCAddressPrefixesOptions{ - VPCID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewVPCAddressPrefixesPager(listVPCAddressPrefixesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.AddressPrefix - 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 VPCAddressPrefixesPager.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()) - - listVPCAddressPrefixesOptionsModel := &vpcv1.ListVPCAddressPrefixesOptions{ - VPCID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewVPCAddressPrefixesPager(listVPCAddressPrefixesOptionsModel) - 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(`CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) - Operation response error`, func() { - version := "testString" - createVPCAddressPrefixPath := "/vpcs/testString/address_prefixes" - 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(createVPCAddressPrefixPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateVPCAddressPrefix 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 ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the CreateVPCAddressPrefixOptions model - createVPCAddressPrefixOptionsModel := new(vpcv1.CreateVPCAddressPrefixOptions) - createVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") - createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel - createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) - createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-1") - createVPCAddressPrefixOptionsModel.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.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModel) - 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.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions)`, func() { - version := "testString" - createVPCAddressPrefixPath := "/vpcs/testString/address_prefixes" - 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(createVPCAddressPrefixPath)) - 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{"testString"})) - 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", `{"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"}}`) - })) - }) - It(`Invoke CreateVPCAddressPrefix 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 ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the CreateVPCAddressPrefixOptions model - createVPCAddressPrefixOptionsModel := new(vpcv1.CreateVPCAddressPrefixOptions) - createVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") - createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel - createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) - createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-1") - createVPCAddressPrefixOptionsModel.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.CreateVPCAddressPrefixWithContext(ctx, createVPCAddressPrefixOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModel) - 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.CreateVPCAddressPrefixWithContext(ctx, createVPCAddressPrefixOptionsModel) - 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(createVPCAddressPrefixPath)) - 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{"testString"})) - 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", `{"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"}}`) - })) - }) - It(`Invoke CreateVPCAddressPrefix 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.CreateVPCAddressPrefix(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 CreateVPCAddressPrefixOptions model - createVPCAddressPrefixOptionsModel := new(vpcv1.CreateVPCAddressPrefixOptions) - createVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") - createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel - createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) - createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-1") - createVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateVPCAddressPrefix 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 CreateVPCAddressPrefixOptions model - createVPCAddressPrefixOptionsModel := new(vpcv1.CreateVPCAddressPrefixOptions) - createVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") - createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel - createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) - createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-1") - createVPCAddressPrefixOptionsModel.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.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModel) - 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 CreateVPCAddressPrefixOptions model with no property values - createVPCAddressPrefixOptionsModelNew := new(vpcv1.CreateVPCAddressPrefixOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModelNew) - 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 CreateVPCAddressPrefix 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 CreateVPCAddressPrefixOptions model - createVPCAddressPrefixOptionsModel := new(vpcv1.CreateVPCAddressPrefixOptions) - createVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - createVPCAddressPrefixOptionsModel.CIDR = core.StringPtr("10.0.0.0/24") - createVPCAddressPrefixOptionsModel.Zone = zoneIdentityModel - createVPCAddressPrefixOptionsModel.IsDefault = core.BoolPtr(true) - createVPCAddressPrefixOptionsModel.Name = core.StringPtr("my-address-prefix-1") - createVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateVPCAddressPrefix(createVPCAddressPrefixOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions)`, func() { - version := "testString" - deleteVPCAddressPrefixPath := "/vpcs/testString/address_prefixes/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(deleteVPCAddressPrefixPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteVPCAddressPrefix 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.DeleteVPCAddressPrefix(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteVPCAddressPrefixOptions model - deleteVPCAddressPrefixOptionsModel := new(vpcv1.DeleteVPCAddressPrefixOptions) - deleteVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - deleteVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") - deleteVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteVPCAddressPrefix 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 DeleteVPCAddressPrefixOptions model - deleteVPCAddressPrefixOptionsModel := new(vpcv1.DeleteVPCAddressPrefixOptions) - deleteVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - deleteVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") - deleteVPCAddressPrefixOptionsModel.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.DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteVPCAddressPrefixOptions model with no property values - deleteVPCAddressPrefixOptionsModelNew := new(vpcv1.DeleteVPCAddressPrefixOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) - Operation response error`, func() { - version := "testString" - getVPCAddressPrefixPath := "/vpcs/testString/address_prefixes/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(getVPCAddressPrefixPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVPCAddressPrefix 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 GetVPCAddressPrefixOptions model - getVPCAddressPrefixOptionsModel := new(vpcv1.GetVPCAddressPrefixOptions) - getVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - getVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") - getVPCAddressPrefixOptionsModel.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.GetVPCAddressPrefix(getVPCAddressPrefixOptionsModel) - 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.GetVPCAddressPrefix(getVPCAddressPrefixOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions)`, func() { - version := "testString" - getVPCAddressPrefixPath := "/vpcs/testString/address_prefixes/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(getVPCAddressPrefixPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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"}}`) - })) - }) - It(`Invoke GetVPCAddressPrefix 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 GetVPCAddressPrefixOptions model - getVPCAddressPrefixOptionsModel := new(vpcv1.GetVPCAddressPrefixOptions) - getVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - getVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") - getVPCAddressPrefixOptionsModel.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.GetVPCAddressPrefixWithContext(ctx, getVPCAddressPrefixOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVPCAddressPrefix(getVPCAddressPrefixOptionsModel) - 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.GetVPCAddressPrefixWithContext(ctx, getVPCAddressPrefixOptionsModel) - 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(getVPCAddressPrefixPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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"}}`) - })) - }) - It(`Invoke GetVPCAddressPrefix 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.GetVPCAddressPrefix(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetVPCAddressPrefixOptions model - getVPCAddressPrefixOptionsModel := new(vpcv1.GetVPCAddressPrefixOptions) - getVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - getVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") - getVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVPCAddressPrefix(getVPCAddressPrefixOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVPCAddressPrefix 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 GetVPCAddressPrefixOptions model - getVPCAddressPrefixOptionsModel := new(vpcv1.GetVPCAddressPrefixOptions) - getVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - getVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") - getVPCAddressPrefixOptionsModel.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.GetVPCAddressPrefix(getVPCAddressPrefixOptionsModel) - 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 GetVPCAddressPrefixOptions model with no property values - getVPCAddressPrefixOptionsModelNew := new(vpcv1.GetVPCAddressPrefixOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVPCAddressPrefix(getVPCAddressPrefixOptionsModelNew) - 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 GetVPCAddressPrefix 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 GetVPCAddressPrefixOptions model - getVPCAddressPrefixOptionsModel := new(vpcv1.GetVPCAddressPrefixOptions) - getVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - getVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") - getVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVPCAddressPrefix(getVPCAddressPrefixOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) - Operation response error`, func() { - version := "testString" - updateVPCAddressPrefixPath := "/vpcs/testString/address_prefixes/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(updateVPCAddressPrefixPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateVPCAddressPrefix 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 AddressPrefixPatch model - addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) - addressPrefixPatchModel.IsDefault = core.BoolPtr(false) - addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-1") - addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCAddressPrefixOptions model - updateVPCAddressPrefixOptionsModel := new(vpcv1.UpdateVPCAddressPrefixOptions) - updateVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - updateVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") - updateVPCAddressPrefixOptionsModel.AddressPrefixPatch = addressPrefixPatchModelAsPatch - updateVPCAddressPrefixOptionsModel.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.UpdateVPCAddressPrefix(updateVPCAddressPrefixOptionsModel) - 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.UpdateVPCAddressPrefix(updateVPCAddressPrefixOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions)`, func() { - version := "testString" - updateVPCAddressPrefixPath := "/vpcs/testString/address_prefixes/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(updateVPCAddressPrefixPath)) - 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{"testString"})) - 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", `{"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"}}`) - })) - }) - It(`Invoke UpdateVPCAddressPrefix 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 AddressPrefixPatch model - addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) - addressPrefixPatchModel.IsDefault = core.BoolPtr(false) - addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-1") - addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCAddressPrefixOptions model - updateVPCAddressPrefixOptionsModel := new(vpcv1.UpdateVPCAddressPrefixOptions) - updateVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - updateVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") - updateVPCAddressPrefixOptionsModel.AddressPrefixPatch = addressPrefixPatchModelAsPatch - updateVPCAddressPrefixOptionsModel.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.UpdateVPCAddressPrefixWithContext(ctx, updateVPCAddressPrefixOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateVPCAddressPrefix(updateVPCAddressPrefixOptionsModel) - 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.UpdateVPCAddressPrefixWithContext(ctx, updateVPCAddressPrefixOptionsModel) - 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(updateVPCAddressPrefixPath)) - 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{"testString"})) - 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", `{"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"}}`) - })) - }) - It(`Invoke UpdateVPCAddressPrefix 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.UpdateVPCAddressPrefix(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the AddressPrefixPatch model - addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) - addressPrefixPatchModel.IsDefault = core.BoolPtr(false) - addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-1") - addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCAddressPrefixOptions model - updateVPCAddressPrefixOptionsModel := new(vpcv1.UpdateVPCAddressPrefixOptions) - updateVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - updateVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") - updateVPCAddressPrefixOptionsModel.AddressPrefixPatch = addressPrefixPatchModelAsPatch - updateVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateVPCAddressPrefix(updateVPCAddressPrefixOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateVPCAddressPrefix 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 AddressPrefixPatch model - addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) - addressPrefixPatchModel.IsDefault = core.BoolPtr(false) - addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-1") - addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCAddressPrefixOptions model - updateVPCAddressPrefixOptionsModel := new(vpcv1.UpdateVPCAddressPrefixOptions) - updateVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - updateVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") - updateVPCAddressPrefixOptionsModel.AddressPrefixPatch = addressPrefixPatchModelAsPatch - updateVPCAddressPrefixOptionsModel.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.UpdateVPCAddressPrefix(updateVPCAddressPrefixOptionsModel) - 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 UpdateVPCAddressPrefixOptions model with no property values - updateVPCAddressPrefixOptionsModelNew := new(vpcv1.UpdateVPCAddressPrefixOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateVPCAddressPrefix(updateVPCAddressPrefixOptionsModelNew) - 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 UpdateVPCAddressPrefix 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 AddressPrefixPatch model - addressPrefixPatchModel := new(vpcv1.AddressPrefixPatch) - addressPrefixPatchModel.IsDefault = core.BoolPtr(false) - addressPrefixPatchModel.Name = core.StringPtr("my-address-prefix-1") - addressPrefixPatchModelAsPatch, asPatchErr := addressPrefixPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCAddressPrefixOptions model - updateVPCAddressPrefixOptionsModel := new(vpcv1.UpdateVPCAddressPrefixOptions) - updateVPCAddressPrefixOptionsModel.VPCID = core.StringPtr("testString") - updateVPCAddressPrefixOptionsModel.ID = core.StringPtr("testString") - updateVPCAddressPrefixOptionsModel.AddressPrefixPatch = addressPrefixPatchModelAsPatch - updateVPCAddressPrefixOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateVPCAddressPrefix(updateVPCAddressPrefixOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) - Operation response error`, func() { - version := "testString" - listVPCRoutesPath := "/vpcs/testString/routes" - 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(listVPCRoutesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["zone.name"]).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))})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListVPCRoutes 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 ListVPCRoutesOptions model - listVPCRoutesOptionsModel := new(vpcv1.ListVPCRoutesOptions) - listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") - listVPCRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutesOptionsModel.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.ListVPCRoutes(listVPCRoutesOptionsModel) - 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.ListVPCRoutes(listVPCRoutesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions)`, func() { - version := "testString" - listVPCRoutesPath := "/vpcs/testString/routes" - 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(listVPCRoutesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["zone.name"]).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))})) - // 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/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", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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() { - 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 ListVPCRoutesOptions model - listVPCRoutesOptionsModel := new(vpcv1.ListVPCRoutesOptions) - listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") - listVPCRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutesOptionsModel.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.ListVPCRoutesWithContext(ctx, listVPCRoutesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVPCRoutes(listVPCRoutesOptionsModel) - 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.ListVPCRoutesWithContext(ctx, listVPCRoutesOptionsModel) - 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(listVPCRoutesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["zone.name"]).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))})) - // 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", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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() { - 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.ListVPCRoutes(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListVPCRoutesOptions model - listVPCRoutesOptionsModel := new(vpcv1.ListVPCRoutesOptions) - listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") - listVPCRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVPCRoutes(listVPCRoutesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListVPCRoutes 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 ListVPCRoutesOptions model - listVPCRoutesOptionsModel := new(vpcv1.ListVPCRoutesOptions) - listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") - listVPCRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutesOptionsModel.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.ListVPCRoutes(listVPCRoutesOptionsModel) - 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 ListVPCRoutesOptions model with no property values - listVPCRoutesOptionsModelNew := new(vpcv1.ListVPCRoutesOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListVPCRoutes(listVPCRoutesOptionsModelNew) - 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 ListVPCRoutes 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 ListVPCRoutesOptions model - listVPCRoutesOptionsModel := new(vpcv1.ListVPCRoutesOptions) - listVPCRoutesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutesOptionsModel.ZoneName = core.StringPtr("testString") - listVPCRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListVPCRoutes(listVPCRoutesOptionsModel) - 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.RouteCollection) - nextObject := new(vpcv1.RouteCollectionNext) - 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.RouteCollection) - - 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.RouteCollection) - nextObject := new(vpcv1.RouteCollectionNext) - 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(listVPCRoutesPath)) - 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"},"routes":[{"action":"delegate","created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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","created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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 VPCRoutesPager.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()) - - listVPCRoutesOptionsModel := &vpcv1.ListVPCRoutesOptions{ - VPCID: core.StringPtr("testString"), - ZoneName: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewVPCRoutesPager(listVPCRoutesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.Route - 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 VPCRoutesPager.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()) - - listVPCRoutesOptionsModel := &vpcv1.ListVPCRoutesOptions{ - VPCID: core.StringPtr("testString"), - ZoneName: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewVPCRoutesPager(listVPCRoutesOptionsModel) - 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(`CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) - Operation response error`, func() { - version := "testString" - createVPCRoutePath := "/vpcs/testString/routes" - 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(createVPCRoutePath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateVPCRoute 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 ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the CreateVPCRouteOptions model - createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) - createVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") - createVPCRouteOptionsModel.Zone = zoneIdentityModel - createVPCRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") - createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel - createVPCRouteOptionsModel.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.CreateVPCRoute(createVPCRouteOptionsModel) - 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.CreateVPCRoute(createVPCRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions)`, func() { - version := "testString" - createVPCRoutePath := "/vpcs/testString/routes" - 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(createVPCRoutePath)) - 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{"testString"})) - 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke CreateVPCRoute 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 ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the CreateVPCRouteOptions model - createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) - createVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") - createVPCRouteOptionsModel.Zone = zoneIdentityModel - createVPCRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") - createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel - createVPCRouteOptionsModel.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.CreateVPCRouteWithContext(ctx, createVPCRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateVPCRoute(createVPCRouteOptionsModel) - 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.CreateVPCRouteWithContext(ctx, createVPCRouteOptionsModel) - 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(createVPCRoutePath)) - 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{"testString"})) - 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke CreateVPCRoute 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.CreateVPCRoute(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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the CreateVPCRouteOptions model - createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) - createVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") - createVPCRouteOptionsModel.Zone = zoneIdentityModel - createVPCRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") - createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel - createVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateVPCRoute(createVPCRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateVPCRoute 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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the CreateVPCRouteOptions model - createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) - createVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") - createVPCRouteOptionsModel.Zone = zoneIdentityModel - createVPCRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") - createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel - createVPCRouteOptionsModel.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.CreateVPCRoute(createVPCRouteOptionsModel) - 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 CreateVPCRouteOptions model with no property values - createVPCRouteOptionsModelNew := new(vpcv1.CreateVPCRouteOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateVPCRoute(createVPCRouteOptionsModelNew) - 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 CreateVPCRoute 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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the CreateVPCRouteOptions model - createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) - createVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") - createVPCRouteOptionsModel.Zone = zoneIdentityModel - createVPCRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") - createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel - createVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateVPCRoute(createVPCRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions)`, func() { - version := "testString" - deleteVPCRoutePath := "/vpcs/testString/routes/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(deleteVPCRoutePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteVPCRoute 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.DeleteVPCRoute(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteVPCRouteOptions model - deleteVPCRouteOptionsModel := new(vpcv1.DeleteVPCRouteOptions) - deleteVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - deleteVPCRouteOptionsModel.ID = core.StringPtr("testString") - deleteVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteVPCRoute(deleteVPCRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteVPCRoute 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 DeleteVPCRouteOptions model - deleteVPCRouteOptionsModel := new(vpcv1.DeleteVPCRouteOptions) - deleteVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - deleteVPCRouteOptionsModel.ID = core.StringPtr("testString") - deleteVPCRouteOptionsModel.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.DeleteVPCRoute(deleteVPCRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteVPCRouteOptions model with no property values - deleteVPCRouteOptionsModelNew := new(vpcv1.DeleteVPCRouteOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteVPCRoute(deleteVPCRouteOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) - Operation response error`, func() { - version := "testString" - getVPCRoutePath := "/vpcs/testString/routes/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(getVPCRoutePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVPCRoute 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 GetVPCRouteOptions model - getVPCRouteOptionsModel := new(vpcv1.GetVPCRouteOptions) - getVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - getVPCRouteOptionsModel.ID = core.StringPtr("testString") - getVPCRouteOptionsModel.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.GetVPCRoute(getVPCRouteOptionsModel) - 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.GetVPCRoute(getVPCRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions)`, func() { - version := "testString" - getVPCRoutePath := "/vpcs/testString/routes/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(getVPCRoutePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke GetVPCRoute 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 GetVPCRouteOptions model - getVPCRouteOptionsModel := new(vpcv1.GetVPCRouteOptions) - getVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - getVPCRouteOptionsModel.ID = core.StringPtr("testString") - getVPCRouteOptionsModel.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.GetVPCRouteWithContext(ctx, getVPCRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVPCRoute(getVPCRouteOptionsModel) - 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.GetVPCRouteWithContext(ctx, getVPCRouteOptionsModel) - 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(getVPCRoutePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke GetVPCRoute 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.GetVPCRoute(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetVPCRouteOptions model - getVPCRouteOptionsModel := new(vpcv1.GetVPCRouteOptions) - getVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - getVPCRouteOptionsModel.ID = core.StringPtr("testString") - getVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVPCRoute(getVPCRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVPCRoute 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 GetVPCRouteOptions model - getVPCRouteOptionsModel := new(vpcv1.GetVPCRouteOptions) - getVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - getVPCRouteOptionsModel.ID = core.StringPtr("testString") - getVPCRouteOptionsModel.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.GetVPCRoute(getVPCRouteOptionsModel) - 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 GetVPCRouteOptions model with no property values - getVPCRouteOptionsModelNew := new(vpcv1.GetVPCRouteOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVPCRoute(getVPCRouteOptionsModelNew) - 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 GetVPCRoute 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 GetVPCRouteOptions model - getVPCRouteOptionsModel := new(vpcv1.GetVPCRouteOptions) - getVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - getVPCRouteOptionsModel.ID = core.StringPtr("testString") - getVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVPCRoute(getVPCRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) - Operation response error`, func() { - version := "testString" - updateVPCRoutePath := "/vpcs/testString/routes/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(updateVPCRoutePath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateVPCRoute 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 RoutePatch model - routePatchModel := new(vpcv1.RoutePatch) - routePatchModel.Name = core.StringPtr("my-route-2") - routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRouteOptions model - updateVPCRouteOptionsModel := new(vpcv1.UpdateVPCRouteOptions) - updateVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRouteOptionsModel.ID = core.StringPtr("testString") - updateVPCRouteOptionsModel.RoutePatch = routePatchModelAsPatch - updateVPCRouteOptionsModel.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.UpdateVPCRoute(updateVPCRouteOptionsModel) - 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.UpdateVPCRoute(updateVPCRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions)`, func() { - version := "testString" - updateVPCRoutePath := "/vpcs/testString/routes/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(updateVPCRoutePath)) - 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{"testString"})) - 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke UpdateVPCRoute 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 RoutePatch model - routePatchModel := new(vpcv1.RoutePatch) - routePatchModel.Name = core.StringPtr("my-route-2") - routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRouteOptions model - updateVPCRouteOptionsModel := new(vpcv1.UpdateVPCRouteOptions) - updateVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRouteOptionsModel.ID = core.StringPtr("testString") - updateVPCRouteOptionsModel.RoutePatch = routePatchModelAsPatch - updateVPCRouteOptionsModel.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.UpdateVPCRouteWithContext(ctx, updateVPCRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateVPCRoute(updateVPCRouteOptionsModel) - 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.UpdateVPCRouteWithContext(ctx, updateVPCRouteOptionsModel) - 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(updateVPCRoutePath)) - 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{"testString"})) - 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke UpdateVPCRoute 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.UpdateVPCRoute(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the RoutePatch model - routePatchModel := new(vpcv1.RoutePatch) - routePatchModel.Name = core.StringPtr("my-route-2") - routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRouteOptions model - updateVPCRouteOptionsModel := new(vpcv1.UpdateVPCRouteOptions) - updateVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRouteOptionsModel.ID = core.StringPtr("testString") - updateVPCRouteOptionsModel.RoutePatch = routePatchModelAsPatch - updateVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateVPCRoute(updateVPCRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateVPCRoute 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 RoutePatch model - routePatchModel := new(vpcv1.RoutePatch) - routePatchModel.Name = core.StringPtr("my-route-2") - routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRouteOptions model - updateVPCRouteOptionsModel := new(vpcv1.UpdateVPCRouteOptions) - updateVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRouteOptionsModel.ID = core.StringPtr("testString") - updateVPCRouteOptionsModel.RoutePatch = routePatchModelAsPatch - updateVPCRouteOptionsModel.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.UpdateVPCRoute(updateVPCRouteOptionsModel) - 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 UpdateVPCRouteOptions model with no property values - updateVPCRouteOptionsModelNew := new(vpcv1.UpdateVPCRouteOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateVPCRoute(updateVPCRouteOptionsModelNew) - 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 UpdateVPCRoute 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 RoutePatch model - routePatchModel := new(vpcv1.RoutePatch) - routePatchModel.Name = core.StringPtr("my-route-2") - routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRouteOptions model - updateVPCRouteOptionsModel := new(vpcv1.UpdateVPCRouteOptions) - updateVPCRouteOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRouteOptionsModel.ID = core.StringPtr("testString") - updateVPCRouteOptionsModel.RoutePatch = routePatchModelAsPatch - updateVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateVPCRoute(updateVPCRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) - Operation response error`, func() { - version := "testString" - listVPCRoutingTablesPath := "/vpcs/testString/routing_tables" - 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(listVPCRoutingTablesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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))})) - // TODO: Add check for is_default query parameter - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListVPCRoutingTables 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 ListVPCRoutingTablesOptions model - listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) - listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) - listVPCRoutingTablesOptionsModel.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.ListVPCRoutingTables(listVPCRoutingTablesOptionsModel) - 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.ListVPCRoutingTables(listVPCRoutingTablesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions)`, func() { - version := "testString" - listVPCRoutingTablesPath := "/vpcs/testString/routing_tables" - 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(listVPCRoutingTablesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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))})) - // TODO: Add check for is_default query parameter - // 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/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) - })) - }) - It(`Invoke ListVPCRoutingTables 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 ListVPCRoutingTablesOptions model - listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) - listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) - listVPCRoutingTablesOptionsModel.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.ListVPCRoutingTablesWithContext(ctx, listVPCRoutingTablesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVPCRoutingTables(listVPCRoutingTablesOptionsModel) - 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.ListVPCRoutingTablesWithContext(ctx, listVPCRoutingTablesOptionsModel) - 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(listVPCRoutingTablesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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))})) - // TODO: Add check for is_default query parameter - // 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?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) - })) - }) - It(`Invoke ListVPCRoutingTables 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.ListVPCRoutingTables(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListVPCRoutingTablesOptions model - listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) - listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) - listVPCRoutingTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVPCRoutingTables(listVPCRoutingTablesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListVPCRoutingTables 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 ListVPCRoutingTablesOptions model - listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) - listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) - listVPCRoutingTablesOptionsModel.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.ListVPCRoutingTables(listVPCRoutingTablesOptionsModel) - 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 ListVPCRoutingTablesOptions model with no property values - listVPCRoutingTablesOptionsModelNew := new(vpcv1.ListVPCRoutingTablesOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListVPCRoutingTables(listVPCRoutingTablesOptionsModelNew) - 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 ListVPCRoutingTables 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 ListVPCRoutingTablesOptions model - listVPCRoutingTablesOptionsModel := new(vpcv1.ListVPCRoutingTablesOptions) - listVPCRoutingTablesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTablesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutingTablesOptionsModel.IsDefault = core.BoolPtr(true) - listVPCRoutingTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListVPCRoutingTables(listVPCRoutingTablesOptionsModel) - 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.RoutingTableCollection) - nextObject := new(vpcv1.RoutingTableCollectionNext) - 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.RoutingTableCollection) - - 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.RoutingTableCollection) - nextObject := new(vpcv1.RoutingTableCollectionNext) - 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(listVPCRoutingTablesPath)) - 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"},"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_gateway"}],"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","is_default":false,"lifecycle_state":"stable","name":"my-routing-table-1","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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"routing_tables":[{"accept_routes_from":[{"resource_type":"vpn_gateway"}],"created_at":"2019-01-01T12:00:00.000Z","href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","is_default":false,"lifecycle_state":"stable","name":"my-routing-table-1","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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}]}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use VPCRoutingTablesPager.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()) - - listVPCRoutingTablesOptionsModel := &vpcv1.ListVPCRoutingTablesOptions{ - VPCID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - IsDefault: core.BoolPtr(true), - } - - pager, err := vpcService.NewVPCRoutingTablesPager(listVPCRoutingTablesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.RoutingTable - 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 VPCRoutingTablesPager.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()) - - listVPCRoutingTablesOptionsModel := &vpcv1.ListVPCRoutingTablesOptions{ - VPCID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - IsDefault: core.BoolPtr(true), - } - - pager, err := vpcService.NewVPCRoutingTablesPager(listVPCRoutingTablesOptionsModel) - 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(`CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) - Operation response error`, func() { - version := "testString" - createVPCRoutingTablePath := "/vpcs/testString/routing_tables" - 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(createVPCRoutingTablePath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateVPCRoutingTable 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 ResourceFilter model - resourceFilterModel := new(vpcv1.ResourceFilter) - resourceFilterModel.ResourceType = core.StringPtr("vpn_server") - - // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the RoutePrototype model - routePrototypeModel := new(vpcv1.RoutePrototype) - routePrototypeModel.Action = core.StringPtr("deliver") - routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") - routePrototypeModel.Name = core.StringPtr("my-route-1") - routePrototypeModel.NextHop = routePrototypeNextHopModel - routePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateVPCRoutingTableOptions model - createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) - createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") - createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} - createVPCRoutingTableOptionsModel.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.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) - 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.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions)`, func() { - version := "testString" - createVPCRoutingTablePath := "/vpcs/testString/routing_tables" - 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(createVPCRoutingTablePath)) - 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{"testString"})) - 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) - })) - }) - It(`Invoke CreateVPCRoutingTable 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 ResourceFilter model - resourceFilterModel := new(vpcv1.ResourceFilter) - resourceFilterModel.ResourceType = core.StringPtr("vpn_server") - - // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the RoutePrototype model - routePrototypeModel := new(vpcv1.RoutePrototype) - routePrototypeModel.Action = core.StringPtr("deliver") - routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") - routePrototypeModel.Name = core.StringPtr("my-route-1") - routePrototypeModel.NextHop = routePrototypeNextHopModel - routePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateVPCRoutingTableOptions model - createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) - createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") - createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} - createVPCRoutingTableOptionsModel.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.CreateVPCRoutingTableWithContext(ctx, createVPCRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) - 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.CreateVPCRoutingTableWithContext(ctx, createVPCRoutingTableOptionsModel) - 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(createVPCRoutingTablePath)) - 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{"testString"})) - 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) - })) - }) - It(`Invoke CreateVPCRoutingTable 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.CreateVPCRoutingTable(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ResourceFilter model - resourceFilterModel := new(vpcv1.ResourceFilter) - resourceFilterModel.ResourceType = core.StringPtr("vpn_server") - - // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the RoutePrototype model - routePrototypeModel := new(vpcv1.RoutePrototype) - routePrototypeModel.Action = core.StringPtr("deliver") - routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") - routePrototypeModel.Name = core.StringPtr("my-route-1") - routePrototypeModel.NextHop = routePrototypeNextHopModel - routePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateVPCRoutingTableOptions model - createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) - createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") - createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} - createVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateVPCRoutingTable 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 ResourceFilter model - resourceFilterModel := new(vpcv1.ResourceFilter) - resourceFilterModel.ResourceType = core.StringPtr("vpn_server") - - // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the RoutePrototype model - routePrototypeModel := new(vpcv1.RoutePrototype) - routePrototypeModel.Action = core.StringPtr("deliver") - routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") - routePrototypeModel.Name = core.StringPtr("my-route-1") - routePrototypeModel.NextHop = routePrototypeNextHopModel - routePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateVPCRoutingTableOptions model - createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) - createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") - createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} - createVPCRoutingTableOptionsModel.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.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) - 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 CreateVPCRoutingTableOptions model with no property values - createVPCRoutingTableOptionsModelNew := new(vpcv1.CreateVPCRoutingTableOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateVPCRoutingTable(createVPCRoutingTableOptionsModelNew) - 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 CreateVPCRoutingTable 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 ResourceFilter model - resourceFilterModel := new(vpcv1.ResourceFilter) - resourceFilterModel.ResourceType = core.StringPtr("vpn_server") - - // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the RoutePrototype model - routePrototypeModel := new(vpcv1.RoutePrototype) - routePrototypeModel.Action = core.StringPtr("deliver") - routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") - routePrototypeModel.Name = core.StringPtr("my-route-1") - routePrototypeModel.NextHop = routePrototypeNextHopModel - routePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateVPCRoutingTableOptions model - createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) - createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-1") - createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteInternetIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.RouteVPCZoneIngress = core.BoolPtr(false) - createVPCRoutingTableOptionsModel.Routes = []vpcv1.RoutePrototype{*routePrototypeModel} - createVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateVPCRoutingTable(createVPCRoutingTableOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions)`, func() { - version := "testString" - deleteVPCRoutingTablePath := "/vpcs/testString/routing_tables/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(deleteVPCRoutingTablePath)) - 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{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteVPCRoutingTable 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.DeleteVPCRoutingTable(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteVPCRoutingTableOptions model - deleteVPCRoutingTableOptionsModel := new(vpcv1.DeleteVPCRoutingTableOptions) - deleteVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - deleteVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") - deleteVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteVPCRoutingTable(deleteVPCRoutingTableOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteVPCRoutingTable 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 DeleteVPCRoutingTableOptions model - deleteVPCRoutingTableOptionsModel := new(vpcv1.DeleteVPCRoutingTableOptions) - deleteVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - deleteVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") - deleteVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteVPCRoutingTableOptionsModel.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.DeleteVPCRoutingTable(deleteVPCRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteVPCRoutingTableOptions model with no property values - deleteVPCRoutingTableOptionsModelNew := new(vpcv1.DeleteVPCRoutingTableOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteVPCRoutingTable(deleteVPCRoutingTableOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) - Operation response error`, func() { - version := "testString" - getVPCRoutingTablePath := "/vpcs/testString/routing_tables/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(getVPCRoutingTablePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVPCRoutingTable 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 GetVPCRoutingTableOptions model - getVPCRoutingTableOptionsModel := new(vpcv1.GetVPCRoutingTableOptions) - getVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - getVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") - getVPCRoutingTableOptionsModel.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.GetVPCRoutingTable(getVPCRoutingTableOptionsModel) - 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.GetVPCRoutingTable(getVPCRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions)`, func() { - version := "testString" - getVPCRoutingTablePath := "/vpcs/testString/routing_tables/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(getVPCRoutingTablePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) - })) - }) - It(`Invoke GetVPCRoutingTable 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 GetVPCRoutingTableOptions model - getVPCRoutingTableOptionsModel := new(vpcv1.GetVPCRoutingTableOptions) - getVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - getVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") - getVPCRoutingTableOptionsModel.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.GetVPCRoutingTableWithContext(ctx, getVPCRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVPCRoutingTable(getVPCRoutingTableOptionsModel) - 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.GetVPCRoutingTableWithContext(ctx, getVPCRoutingTableOptionsModel) - 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(getVPCRoutingTablePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) - })) - }) - It(`Invoke GetVPCRoutingTable 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.GetVPCRoutingTable(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetVPCRoutingTableOptions model - getVPCRoutingTableOptionsModel := new(vpcv1.GetVPCRoutingTableOptions) - getVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - getVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") - getVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVPCRoutingTable(getVPCRoutingTableOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVPCRoutingTable 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 GetVPCRoutingTableOptions model - getVPCRoutingTableOptionsModel := new(vpcv1.GetVPCRoutingTableOptions) - getVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - getVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") - getVPCRoutingTableOptionsModel.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.GetVPCRoutingTable(getVPCRoutingTableOptionsModel) - 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 GetVPCRoutingTableOptions model with no property values - getVPCRoutingTableOptionsModelNew := new(vpcv1.GetVPCRoutingTableOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVPCRoutingTable(getVPCRoutingTableOptionsModelNew) - 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 GetVPCRoutingTable 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 GetVPCRoutingTableOptions model - getVPCRoutingTableOptionsModel := new(vpcv1.GetVPCRoutingTableOptions) - getVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - getVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") - getVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVPCRoutingTable(getVPCRoutingTableOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) - Operation response error`, func() { - version := "testString" - updateVPCRoutingTablePath := "/vpcs/testString/routing_tables/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(updateVPCRoutingTablePath)) - 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{"testString"})) - 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 UpdateVPCRoutingTable 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 ResourceFilter model - resourceFilterModel := new(vpcv1.ResourceFilter) - resourceFilterModel.ResourceType = core.StringPtr("vpn_server") - - // Construct an instance of the RoutingTablePatch model - routingTablePatchModel := new(vpcv1.RoutingTablePatch) - routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") - routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) - routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) - routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) - routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) - routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRoutingTableOptions model - updateVPCRoutingTableOptionsModel := new(vpcv1.UpdateVPCRoutingTableOptions) - updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") - updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch - updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVPCRoutingTableOptionsModel.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.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModel) - 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.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions)`, func() { - version := "testString" - updateVPCRoutingTablePath := "/vpcs/testString/routing_tables/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(updateVPCRoutingTablePath)) - 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{"testString"})) - 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) - })) - }) - It(`Invoke UpdateVPCRoutingTable 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 ResourceFilter model - resourceFilterModel := new(vpcv1.ResourceFilter) - resourceFilterModel.ResourceType = core.StringPtr("vpn_server") - - // Construct an instance of the RoutingTablePatch model - routingTablePatchModel := new(vpcv1.RoutingTablePatch) - routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") - routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) - routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) - routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) - routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) - routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRoutingTableOptions model - updateVPCRoutingTableOptionsModel := new(vpcv1.UpdateVPCRoutingTableOptions) - updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") - updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch - updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVPCRoutingTableOptionsModel.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.UpdateVPCRoutingTableWithContext(ctx, updateVPCRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModel) - 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.UpdateVPCRoutingTableWithContext(ctx, updateVPCRoutingTableOptionsModel) - 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(updateVPCRoutingTablePath)) - 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{"testString"})) - 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) - })) - }) - It(`Invoke UpdateVPCRoutingTable 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.UpdateVPCRoutingTable(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ResourceFilter model - resourceFilterModel := new(vpcv1.ResourceFilter) - resourceFilterModel.ResourceType = core.StringPtr("vpn_server") - - // Construct an instance of the RoutingTablePatch model - routingTablePatchModel := new(vpcv1.RoutingTablePatch) - routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") - routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) - routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) - routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) - routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) - routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRoutingTableOptions model - updateVPCRoutingTableOptionsModel := new(vpcv1.UpdateVPCRoutingTableOptions) - updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") - updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch - updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateVPCRoutingTable 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 ResourceFilter model - resourceFilterModel := new(vpcv1.ResourceFilter) - resourceFilterModel.ResourceType = core.StringPtr("vpn_server") - - // Construct an instance of the RoutingTablePatch model - routingTablePatchModel := new(vpcv1.RoutingTablePatch) - routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") - routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) - routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) - routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) - routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) - routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRoutingTableOptions model - updateVPCRoutingTableOptionsModel := new(vpcv1.UpdateVPCRoutingTableOptions) - updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") - updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch - updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVPCRoutingTableOptionsModel.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.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModel) - 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 UpdateVPCRoutingTableOptions model with no property values - updateVPCRoutingTableOptionsModelNew := new(vpcv1.UpdateVPCRoutingTableOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModelNew) - 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 UpdateVPCRoutingTable 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 ResourceFilter model - resourceFilterModel := new(vpcv1.ResourceFilter) - resourceFilterModel.ResourceType = core.StringPtr("vpn_server") - - // Construct an instance of the RoutingTablePatch model - routingTablePatchModel := new(vpcv1.RoutingTablePatch) - routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} - routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") - routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) - routingTablePatchModel.RouteInternetIngress = core.BoolPtr(true) - routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) - routingTablePatchModel.RouteVPCZoneIngress = core.BoolPtr(true) - routingTablePatchModelAsPatch, asPatchErr := routingTablePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRoutingTableOptions model - updateVPCRoutingTableOptionsModel := new(vpcv1.UpdateVPCRoutingTableOptions) - updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") - updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch - updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) - Operation response error`, func() { - version := "testString" - listVPCRoutingTableRoutesPath := "/vpcs/testString/routing_tables/testString/routes" - 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(listVPCRoutingTableRoutesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListVPCRoutingTableRoutes 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 ListVPCRoutingTableRoutesOptions model - listVPCRoutingTableRoutesOptionsModel := new(vpcv1.ListVPCRoutingTableRoutesOptions) - listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutingTableRoutesOptionsModel.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.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModel) - 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.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions)`, func() { - version := "testString" - listVPCRoutingTableRoutesPath := "/vpcs/testString/routing_tables/testString/routes" - 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(listVPCRoutingTableRoutesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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() { - 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 ListVPCRoutingTableRoutesOptions model - listVPCRoutingTableRoutesOptionsModel := new(vpcv1.ListVPCRoutingTableRoutesOptions) - listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutingTableRoutesOptionsModel.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.ListVPCRoutingTableRoutesWithContext(ctx, listVPCRoutingTableRoutesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModel) - 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.ListVPCRoutingTableRoutesWithContext(ctx, listVPCRoutingTableRoutesOptionsModel) - 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(listVPCRoutingTableRoutesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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() { - 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.ListVPCRoutingTableRoutes(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListVPCRoutingTableRoutesOptions model - listVPCRoutingTableRoutesOptionsModel := new(vpcv1.ListVPCRoutingTableRoutesOptions) - listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutingTableRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListVPCRoutingTableRoutes 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 ListVPCRoutingTableRoutesOptions model - listVPCRoutingTableRoutesOptionsModel := new(vpcv1.ListVPCRoutingTableRoutesOptions) - listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutingTableRoutesOptionsModel.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.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModel) - 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 ListVPCRoutingTableRoutesOptions model with no property values - listVPCRoutingTableRoutesOptionsModelNew := new(vpcv1.ListVPCRoutingTableRoutesOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModelNew) - 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 ListVPCRoutingTableRoutes 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 ListVPCRoutingTableRoutesOptions model - listVPCRoutingTableRoutesOptionsModel := new(vpcv1.ListVPCRoutingTableRoutesOptions) - listVPCRoutingTableRoutesOptionsModel.VPCID = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.RoutingTableID = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Start = core.StringPtr("testString") - listVPCRoutingTableRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPCRoutingTableRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptionsModel) - 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.RouteCollection) - nextObject := new(vpcv1.RouteCollectionNext) - 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.RouteCollection) - - 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.RouteCollection) - nextObject := new(vpcv1.RouteCollectionNext) - 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(listVPCRoutingTableRoutesPath)) - 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"},"routes":[{"action":"delegate","created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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","created_at":"2019-01-01T12:00:00.000Z","creator":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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 VPCRoutingTableRoutesPager.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()) - - listVPCRoutingTableRoutesOptionsModel := &vpcv1.ListVPCRoutingTableRoutesOptions{ - VPCID: core.StringPtr("testString"), - RoutingTableID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewVPCRoutingTableRoutesPager(listVPCRoutingTableRoutesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.Route - 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 VPCRoutingTableRoutesPager.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()) - - listVPCRoutingTableRoutesOptionsModel := &vpcv1.ListVPCRoutingTableRoutesOptions{ - VPCID: core.StringPtr("testString"), - RoutingTableID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewVPCRoutingTableRoutesPager(listVPCRoutingTableRoutesOptionsModel) - 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(`CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) - Operation response error`, func() { - version := "testString" - createVPCRoutingTableRoutePath := "/vpcs/testString/routing_tables/testString/routes" - 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(createVPCRoutingTableRoutePath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateVPCRoutingTableRoute 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 ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the CreateVPCRoutingTableRouteOptions model - createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) - createVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - createVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") - createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel - createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") - createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel - createVPCRoutingTableRouteOptionsModel.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.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModel) - 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.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions)`, func() { - version := "testString" - createVPCRoutingTableRoutePath := "/vpcs/testString/routing_tables/testString/routes" - 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(createVPCRoutingTableRoutePath)) - 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{"testString"})) - 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke CreateVPCRoutingTableRoute 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 ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the CreateVPCRoutingTableRouteOptions model - createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) - createVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - createVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") - createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel - createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") - createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel - createVPCRoutingTableRouteOptionsModel.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.CreateVPCRoutingTableRouteWithContext(ctx, createVPCRoutingTableRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModel) - 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.CreateVPCRoutingTableRouteWithContext(ctx, createVPCRoutingTableRouteOptionsModel) - 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(createVPCRoutingTableRoutePath)) - 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{"testString"})) - 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke CreateVPCRoutingTableRoute 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.CreateVPCRoutingTableRoute(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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the CreateVPCRoutingTableRouteOptions model - createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) - createVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - createVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") - createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel - createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") - createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel - createVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateVPCRoutingTableRoute 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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the CreateVPCRoutingTableRouteOptions model - createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) - createVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - createVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") - createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel - createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") - createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel - createVPCRoutingTableRouteOptionsModel.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.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModel) - 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 CreateVPCRoutingTableRouteOptions model with no property values - createVPCRoutingTableRouteOptionsModelNew := new(vpcv1.CreateVPCRoutingTableRouteOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModelNew) - 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 CreateVPCRoutingTableRoute 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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the CreateVPCRoutingTableRouteOptions model - createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) - createVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - createVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") - createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel - createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") - createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel - createVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions)`, func() { - version := "testString" - deleteVPCRoutingTableRoutePath := "/vpcs/testString/routing_tables/testString/routes/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(deleteVPCRoutingTableRoutePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteVPCRoutingTableRoute 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.DeleteVPCRoutingTableRoute(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteVPCRoutingTableRouteOptions model - deleteVPCRoutingTableRouteOptionsModel := new(vpcv1.DeleteVPCRoutingTableRouteOptions) - deleteVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - deleteVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - deleteVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") - deleteVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteVPCRoutingTableRoute 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 DeleteVPCRoutingTableRouteOptions model - deleteVPCRoutingTableRouteOptionsModel := new(vpcv1.DeleteVPCRoutingTableRouteOptions) - deleteVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - deleteVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - deleteVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") - deleteVPCRoutingTableRouteOptionsModel.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.DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteVPCRoutingTableRouteOptions model with no property values - deleteVPCRoutingTableRouteOptionsModelNew := new(vpcv1.DeleteVPCRoutingTableRouteOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) - Operation response error`, func() { - version := "testString" - getVPCRoutingTableRoutePath := "/vpcs/testString/routing_tables/testString/routes/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(getVPCRoutingTableRoutePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVPCRoutingTableRoute 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 GetVPCRoutingTableRouteOptions model - getVPCRoutingTableRouteOptionsModel := new(vpcv1.GetVPCRoutingTableRouteOptions) - getVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.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.GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptionsModel) - 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.GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions)`, func() { - version := "testString" - getVPCRoutingTableRoutePath := "/vpcs/testString/routing_tables/testString/routes/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(getVPCRoutingTableRoutePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke GetVPCRoutingTableRoute 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 GetVPCRoutingTableRouteOptions model - getVPCRoutingTableRouteOptionsModel := new(vpcv1.GetVPCRoutingTableRouteOptions) - getVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.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.GetVPCRoutingTableRouteWithContext(ctx, getVPCRoutingTableRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptionsModel) - 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.GetVPCRoutingTableRouteWithContext(ctx, getVPCRoutingTableRouteOptionsModel) - 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(getVPCRoutingTableRoutePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke GetVPCRoutingTableRoute 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.GetVPCRoutingTableRoute(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetVPCRoutingTableRouteOptions model - getVPCRoutingTableRouteOptionsModel := new(vpcv1.GetVPCRoutingTableRouteOptions) - getVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVPCRoutingTableRoute 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 GetVPCRoutingTableRouteOptions model - getVPCRoutingTableRouteOptionsModel := new(vpcv1.GetVPCRoutingTableRouteOptions) - getVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.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.GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptionsModel) - 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 GetVPCRoutingTableRouteOptions model with no property values - getVPCRoutingTableRouteOptionsModelNew := new(vpcv1.GetVPCRoutingTableRouteOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptionsModelNew) - 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 GetVPCRoutingTableRoute 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 GetVPCRoutingTableRouteOptions model - getVPCRoutingTableRouteOptionsModel := new(vpcv1.GetVPCRoutingTableRouteOptions) - getVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") - getVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) - Operation response error`, func() { - version := "testString" - updateVPCRoutingTableRoutePath := "/vpcs/testString/routing_tables/testString/routes/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(updateVPCRoutingTableRoutePath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateVPCRoutingTableRoute 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 RoutePatch model - routePatchModel := new(vpcv1.RoutePatch) - routePatchModel.Name = core.StringPtr("my-route-2") - routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRoutingTableRouteOptions model - updateVPCRoutingTableRouteOptionsModel := new(vpcv1.UpdateVPCRoutingTableRouteOptions) - updateVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.RoutePatch = routePatchModelAsPatch - updateVPCRoutingTableRouteOptionsModel.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.UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptionsModel) - 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.UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions)`, func() { - version := "testString" - updateVPCRoutingTableRoutePath := "/vpcs/testString/routing_tables/testString/routes/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(updateVPCRoutingTableRoutePath)) - 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{"testString"})) - 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke UpdateVPCRoutingTableRoute 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 RoutePatch model - routePatchModel := new(vpcv1.RoutePatch) - routePatchModel.Name = core.StringPtr("my-route-2") - routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRoutingTableRouteOptions model - updateVPCRoutingTableRouteOptionsModel := new(vpcv1.UpdateVPCRoutingTableRouteOptions) - updateVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.RoutePatch = routePatchModelAsPatch - updateVPCRoutingTableRouteOptionsModel.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.UpdateVPCRoutingTableRouteWithContext(ctx, updateVPCRoutingTableRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptionsModel) - 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.UpdateVPCRoutingTableRouteWithContext(ctx, updateVPCRoutingTableRouteOptionsModel) - 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(updateVPCRoutingTableRoutePath)) - 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{"testString"})) - 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", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke UpdateVPCRoutingTableRoute 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.UpdateVPCRoutingTableRoute(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the RoutePatch model - routePatchModel := new(vpcv1.RoutePatch) - routePatchModel.Name = core.StringPtr("my-route-2") - routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRoutingTableRouteOptions model - updateVPCRoutingTableRouteOptionsModel := new(vpcv1.UpdateVPCRoutingTableRouteOptions) - updateVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.RoutePatch = routePatchModelAsPatch - updateVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateVPCRoutingTableRoute 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 RoutePatch model - routePatchModel := new(vpcv1.RoutePatch) - routePatchModel.Name = core.StringPtr("my-route-2") - routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRoutingTableRouteOptions model - updateVPCRoutingTableRouteOptionsModel := new(vpcv1.UpdateVPCRoutingTableRouteOptions) - updateVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.RoutePatch = routePatchModelAsPatch - updateVPCRoutingTableRouteOptionsModel.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.UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptionsModel) - 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 UpdateVPCRoutingTableRouteOptions model with no property values - updateVPCRoutingTableRouteOptionsModelNew := new(vpcv1.UpdateVPCRoutingTableRouteOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptionsModelNew) - 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 UpdateVPCRoutingTableRoute 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 RoutePatch model - routePatchModel := new(vpcv1.RoutePatch) - routePatchModel.Name = core.StringPtr("my-route-2") - routePatchModelAsPatch, asPatchErr := routePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPCRoutingTableRouteOptions model - updateVPCRoutingTableRouteOptionsModel := new(vpcv1.UpdateVPCRoutingTableRouteOptions) - updateVPCRoutingTableRouteOptionsModel.VPCID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.RoutingTableID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.ID = core.StringPtr("testString") - updateVPCRoutingTableRouteOptionsModel.RoutePatch = routePatchModelAsPatch - updateVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListSubnets(listSubnetsOptions *ListSubnetsOptions) - Operation response error`, func() { - version := "testString" - listSubnetsPath := "/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(listSubnetsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["routing_table.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["routing_table.name"]).To(Equal([]string{"testString"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListSubnets 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 ListSubnetsOptions model - listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) - listSubnetsOptionsModel.Start = core.StringPtr("testString") - listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") - listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") - listSubnetsOptionsModel.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.ListSubnets(listSubnetsOptionsModel) - 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.ListSubnets(listSubnetsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListSubnets(listSubnetsOptions *ListSubnetsOptions)`, func() { - version := "testString" - listSubnetsPath := "/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(listSubnetsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["routing_table.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["routing_table.name"]).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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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 ListSubnetsOptions model - listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) - listSubnetsOptionsModel.Start = core.StringPtr("testString") - listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") - listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") - listSubnetsOptionsModel.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.ListSubnetsWithContext(ctx, listSubnetsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListSubnets(listSubnetsOptionsModel) - 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.ListSubnetsWithContext(ctx, listSubnetsOptionsModel) - 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(listSubnetsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["routing_table.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["routing_table.name"]).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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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.ListSubnets(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListSubnetsOptions model - listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) - listSubnetsOptionsModel.Start = core.StringPtr("testString") - listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") - listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") - listSubnetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListSubnets(listSubnetsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListSubnets 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 ListSubnetsOptions model - listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) - listSubnetsOptionsModel.Start = core.StringPtr("testString") - listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") - listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") - listSubnetsOptionsModel.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.ListSubnets(listSubnetsOptionsModel) - 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 ListSubnets 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 ListSubnetsOptions model - listSubnetsOptionsModel := new(vpcv1.ListSubnetsOptions) - listSubnetsOptionsModel.Start = core.StringPtr("testString") - listSubnetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSubnetsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSubnetsOptionsModel.RoutingTableID = core.StringPtr("testString") - listSubnetsOptionsModel.RoutingTableName = core.StringPtr("testString") - listSubnetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListSubnets(listSubnetsOptionsModel) - 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.SubnetCollection) - nextObject := new(vpcv1.SubnetCollectionNext) - 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.SubnetCollection) - - 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.SubnetCollection) - nextObject := new(vpcv1.SubnetCollectionNext) - 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(listSubnetsPath)) - 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,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"public_gateway":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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,"subnets":[{"available_ipv4_address_count":15,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"a4e28308-8ee7-46ab-8108-9f881f22bdbf","name":"my-network-acl"},"public_gateway":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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":{"deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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 SubnetsPager.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()) - - listSubnetsOptionsModel := &vpcv1.ListSubnetsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - RoutingTableID: core.StringPtr("testString"), - RoutingTableName: core.StringPtr("testString"), - } - - pager, err := vpcService.NewSubnetsPager(listSubnetsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.Subnet - 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 SubnetsPager.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()) - - listSubnetsOptionsModel := &vpcv1.ListSubnetsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - RoutingTableID: core.StringPtr("testString"), - RoutingTableName: core.StringPtr("testString"), - } - - pager, err := vpcService.NewSubnetsPager(listSubnetsOptionsModel) - 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(`CreateSubnet(createSubnetOptions *CreateSubnetOptions) - Operation response error`, func() { - version := "testString" - createSubnetPath := "/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(createSubnetPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateSubnet 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 NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model - publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) - publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("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 SubnetPrototypeSubnetByTotalCount model - subnetPrototypeModel := new(vpcv1.SubnetPrototypeSubnetByTotalCount) - subnetPrototypeModel.IPVersion = core.StringPtr("ipv4") - subnetPrototypeModel.Name = core.StringPtr("my-subnet") - subnetPrototypeModel.NetworkACL = networkACLIdentityModel - subnetPrototypeModel.PublicGateway = publicGatewayIdentityModel - subnetPrototypeModel.ResourceGroup = resourceGroupIdentityModel - subnetPrototypeModel.RoutingTable = routingTableIdentityModel - subnetPrototypeModel.VPC = vpcIdentityModel - subnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) - subnetPrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateSubnetOptions model - createSubnetOptionsModel := new(vpcv1.CreateSubnetOptions) - createSubnetOptionsModel.SubnetPrototype = subnetPrototypeModel - createSubnetOptionsModel.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.CreateSubnet(createSubnetOptionsModel) - 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.CreateSubnet(createSubnetOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateSubnet(createSubnetOptions *CreateSubnetOptions)`, func() { - version := "testString" - createSubnetPath := "/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(createSubnetPath)) - 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{"testString"})) - 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", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 CreateSubnet 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 NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model - publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) - publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("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 SubnetPrototypeSubnetByTotalCount model - subnetPrototypeModel := new(vpcv1.SubnetPrototypeSubnetByTotalCount) - subnetPrototypeModel.IPVersion = core.StringPtr("ipv4") - subnetPrototypeModel.Name = core.StringPtr("my-subnet") - subnetPrototypeModel.NetworkACL = networkACLIdentityModel - subnetPrototypeModel.PublicGateway = publicGatewayIdentityModel - subnetPrototypeModel.ResourceGroup = resourceGroupIdentityModel - subnetPrototypeModel.RoutingTable = routingTableIdentityModel - subnetPrototypeModel.VPC = vpcIdentityModel - subnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) - subnetPrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateSubnetOptions model - createSubnetOptionsModel := new(vpcv1.CreateSubnetOptions) - createSubnetOptionsModel.SubnetPrototype = subnetPrototypeModel - createSubnetOptionsModel.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.CreateSubnetWithContext(ctx, createSubnetOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateSubnet(createSubnetOptionsModel) - 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.CreateSubnetWithContext(ctx, createSubnetOptionsModel) - 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(createSubnetPath)) - 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{"testString"})) - 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", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 CreateSubnet 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.CreateSubnet(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model - publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) - publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("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 SubnetPrototypeSubnetByTotalCount model - subnetPrototypeModel := new(vpcv1.SubnetPrototypeSubnetByTotalCount) - subnetPrototypeModel.IPVersion = core.StringPtr("ipv4") - subnetPrototypeModel.Name = core.StringPtr("my-subnet") - subnetPrototypeModel.NetworkACL = networkACLIdentityModel - subnetPrototypeModel.PublicGateway = publicGatewayIdentityModel - subnetPrototypeModel.ResourceGroup = resourceGroupIdentityModel - subnetPrototypeModel.RoutingTable = routingTableIdentityModel - subnetPrototypeModel.VPC = vpcIdentityModel - subnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) - subnetPrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateSubnetOptions model - createSubnetOptionsModel := new(vpcv1.CreateSubnetOptions) - createSubnetOptionsModel.SubnetPrototype = subnetPrototypeModel - createSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateSubnet(createSubnetOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateSubnet 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 NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model - publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) - publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("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 SubnetPrototypeSubnetByTotalCount model - subnetPrototypeModel := new(vpcv1.SubnetPrototypeSubnetByTotalCount) - subnetPrototypeModel.IPVersion = core.StringPtr("ipv4") - subnetPrototypeModel.Name = core.StringPtr("my-subnet") - subnetPrototypeModel.NetworkACL = networkACLIdentityModel - subnetPrototypeModel.PublicGateway = publicGatewayIdentityModel - subnetPrototypeModel.ResourceGroup = resourceGroupIdentityModel - subnetPrototypeModel.RoutingTable = routingTableIdentityModel - subnetPrototypeModel.VPC = vpcIdentityModel - subnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) - subnetPrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateSubnetOptions model - createSubnetOptionsModel := new(vpcv1.CreateSubnetOptions) - createSubnetOptionsModel.SubnetPrototype = subnetPrototypeModel - createSubnetOptionsModel.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.CreateSubnet(createSubnetOptionsModel) - 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 CreateSubnetOptions model with no property values - createSubnetOptionsModelNew := new(vpcv1.CreateSubnetOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateSubnet(createSubnetOptionsModelNew) - 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 CreateSubnet 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 NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model - publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) - publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("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 SubnetPrototypeSubnetByTotalCount model - subnetPrototypeModel := new(vpcv1.SubnetPrototypeSubnetByTotalCount) - subnetPrototypeModel.IPVersion = core.StringPtr("ipv4") - subnetPrototypeModel.Name = core.StringPtr("my-subnet") - subnetPrototypeModel.NetworkACL = networkACLIdentityModel - subnetPrototypeModel.PublicGateway = publicGatewayIdentityModel - subnetPrototypeModel.ResourceGroup = resourceGroupIdentityModel - subnetPrototypeModel.RoutingTable = routingTableIdentityModel - subnetPrototypeModel.VPC = vpcIdentityModel - subnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) - subnetPrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateSubnetOptions model - createSubnetOptionsModel := new(vpcv1.CreateSubnetOptions) - createSubnetOptionsModel.SubnetPrototype = subnetPrototypeModel - createSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateSubnet(createSubnetOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteSubnet(deleteSubnetOptions *DeleteSubnetOptions)`, func() { - version := "testString" - deleteSubnetPath := "/subnets/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(deleteSubnetPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteSubnet 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.DeleteSubnet(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteSubnetOptions model - deleteSubnetOptionsModel := new(vpcv1.DeleteSubnetOptions) - deleteSubnetOptionsModel.ID = core.StringPtr("testString") - deleteSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteSubnet(deleteSubnetOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteSubnet 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 DeleteSubnetOptions model - deleteSubnetOptionsModel := new(vpcv1.DeleteSubnetOptions) - deleteSubnetOptionsModel.ID = core.StringPtr("testString") - deleteSubnetOptionsModel.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.DeleteSubnet(deleteSubnetOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSubnetOptions model with no property values - deleteSubnetOptionsModelNew := new(vpcv1.DeleteSubnetOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteSubnet(deleteSubnetOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSubnet(getSubnetOptions *GetSubnetOptions) - Operation response error`, func() { - version := "testString" - getSubnetPath := "/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(getSubnetPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetSubnet 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 GetSubnetOptions model - getSubnetOptionsModel := new(vpcv1.GetSubnetOptions) - getSubnetOptionsModel.ID = core.StringPtr("testString") - getSubnetOptionsModel.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.GetSubnet(getSubnetOptionsModel) - 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.GetSubnet(getSubnetOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSubnet(getSubnetOptions *GetSubnetOptions)`, func() { - version := "testString" - getSubnetPath := "/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(getSubnetPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 GetSubnet 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 GetSubnetOptions model - getSubnetOptionsModel := new(vpcv1.GetSubnetOptions) - getSubnetOptionsModel.ID = core.StringPtr("testString") - getSubnetOptionsModel.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.GetSubnetWithContext(ctx, getSubnetOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetSubnet(getSubnetOptionsModel) - 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.GetSubnetWithContext(ctx, getSubnetOptionsModel) - 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(getSubnetPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 GetSubnet 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.GetSubnet(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetSubnetOptions model - getSubnetOptionsModel := new(vpcv1.GetSubnetOptions) - getSubnetOptionsModel.ID = core.StringPtr("testString") - getSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSubnet(getSubnetOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetSubnet 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 GetSubnetOptions model - getSubnetOptionsModel := new(vpcv1.GetSubnetOptions) - getSubnetOptionsModel.ID = core.StringPtr("testString") - getSubnetOptionsModel.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.GetSubnet(getSubnetOptionsModel) - 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 GetSubnetOptions model with no property values - getSubnetOptionsModelNew := new(vpcv1.GetSubnetOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetSubnet(getSubnetOptionsModelNew) - 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 GetSubnet 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 GetSubnetOptions model - getSubnetOptionsModel := new(vpcv1.GetSubnetOptions) - getSubnetOptionsModel.ID = core.StringPtr("testString") - getSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetSubnet(getSubnetOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) - Operation response error`, func() { - version := "testString" - updateSubnetPath := "/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(updateSubnetPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateSubnet 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 NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the SubnetPublicGatewayPatchPublicGatewayIdentityByID model - subnetPublicGatewayPatchModel := new(vpcv1.SubnetPublicGatewayPatchPublicGatewayIdentityByID) - subnetPublicGatewayPatchModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") - - // Construct an instance of the SubnetPatch model - subnetPatchModel := new(vpcv1.SubnetPatch) - subnetPatchModel.Name = core.StringPtr("my-subnet") - subnetPatchModel.NetworkACL = networkACLIdentityModel - subnetPatchModel.PublicGateway = subnetPublicGatewayPatchModel - subnetPatchModel.RoutingTable = routingTableIdentityModel - subnetPatchModelAsPatch, asPatchErr := subnetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSubnetOptions model - updateSubnetOptionsModel := new(vpcv1.UpdateSubnetOptions) - updateSubnetOptionsModel.ID = core.StringPtr("testString") - updateSubnetOptionsModel.SubnetPatch = subnetPatchModelAsPatch - updateSubnetOptionsModel.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.UpdateSubnet(updateSubnetOptionsModel) - 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.UpdateSubnet(updateSubnetOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions)`, func() { - version := "testString" - updateSubnetPath := "/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(updateSubnetPath)) - 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{"testString"})) - 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", `{"available_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 UpdateSubnet 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 NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the SubnetPublicGatewayPatchPublicGatewayIdentityByID model - subnetPublicGatewayPatchModel := new(vpcv1.SubnetPublicGatewayPatchPublicGatewayIdentityByID) - subnetPublicGatewayPatchModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") - - // Construct an instance of the SubnetPatch model - subnetPatchModel := new(vpcv1.SubnetPatch) - subnetPatchModel.Name = core.StringPtr("my-subnet") - subnetPatchModel.NetworkACL = networkACLIdentityModel - subnetPatchModel.PublicGateway = subnetPublicGatewayPatchModel - subnetPatchModel.RoutingTable = routingTableIdentityModel - subnetPatchModelAsPatch, asPatchErr := subnetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSubnetOptions model - updateSubnetOptionsModel := new(vpcv1.UpdateSubnetOptions) - updateSubnetOptionsModel.ID = core.StringPtr("testString") - updateSubnetOptionsModel.SubnetPatch = subnetPatchModelAsPatch - updateSubnetOptionsModel.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.UpdateSubnetWithContext(ctx, updateSubnetOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateSubnet(updateSubnetOptionsModel) - 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.UpdateSubnetWithContext(ctx, updateSubnetOptionsModel) - 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(updateSubnetPath)) - 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{"testString"})) - 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_ipv4_address_count": 15, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::network-acl: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/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "my-network-acl"}, "public_gateway": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 UpdateSubnet 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.UpdateSubnet(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the SubnetPublicGatewayPatchPublicGatewayIdentityByID model - subnetPublicGatewayPatchModel := new(vpcv1.SubnetPublicGatewayPatchPublicGatewayIdentityByID) - subnetPublicGatewayPatchModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") - - // Construct an instance of the SubnetPatch model - subnetPatchModel := new(vpcv1.SubnetPatch) - subnetPatchModel.Name = core.StringPtr("my-subnet") - subnetPatchModel.NetworkACL = networkACLIdentityModel - subnetPatchModel.PublicGateway = subnetPublicGatewayPatchModel - subnetPatchModel.RoutingTable = routingTableIdentityModel - subnetPatchModelAsPatch, asPatchErr := subnetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSubnetOptions model - updateSubnetOptionsModel := new(vpcv1.UpdateSubnetOptions) - updateSubnetOptionsModel.ID = core.StringPtr("testString") - updateSubnetOptionsModel.SubnetPatch = subnetPatchModelAsPatch - updateSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateSubnet(updateSubnetOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateSubnet 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 NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the SubnetPublicGatewayPatchPublicGatewayIdentityByID model - subnetPublicGatewayPatchModel := new(vpcv1.SubnetPublicGatewayPatchPublicGatewayIdentityByID) - subnetPublicGatewayPatchModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") - - // Construct an instance of the SubnetPatch model - subnetPatchModel := new(vpcv1.SubnetPatch) - subnetPatchModel.Name = core.StringPtr("my-subnet") - subnetPatchModel.NetworkACL = networkACLIdentityModel - subnetPatchModel.PublicGateway = subnetPublicGatewayPatchModel - subnetPatchModel.RoutingTable = routingTableIdentityModel - subnetPatchModelAsPatch, asPatchErr := subnetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSubnetOptions model - updateSubnetOptionsModel := new(vpcv1.UpdateSubnetOptions) - updateSubnetOptionsModel.ID = core.StringPtr("testString") - updateSubnetOptionsModel.SubnetPatch = subnetPatchModelAsPatch - updateSubnetOptionsModel.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.UpdateSubnet(updateSubnetOptionsModel) - 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 UpdateSubnetOptions model with no property values - updateSubnetOptionsModelNew := new(vpcv1.UpdateSubnetOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateSubnet(updateSubnetOptionsModelNew) - 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 UpdateSubnet 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 NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the SubnetPublicGatewayPatchPublicGatewayIdentityByID model - subnetPublicGatewayPatchModel := new(vpcv1.SubnetPublicGatewayPatchPublicGatewayIdentityByID) - subnetPublicGatewayPatchModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") - - // Construct an instance of the SubnetPatch model - subnetPatchModel := new(vpcv1.SubnetPatch) - subnetPatchModel.Name = core.StringPtr("my-subnet") - subnetPatchModel.NetworkACL = networkACLIdentityModel - subnetPatchModel.PublicGateway = subnetPublicGatewayPatchModel - subnetPatchModel.RoutingTable = routingTableIdentityModel - subnetPatchModelAsPatch, asPatchErr := subnetPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSubnetOptions model - updateSubnetOptionsModel := new(vpcv1.UpdateSubnetOptions) - updateSubnetOptionsModel.ID = core.StringPtr("testString") - updateSubnetOptionsModel.SubnetPatch = subnetPatchModelAsPatch - updateSubnetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateSubnet(updateSubnetOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSubnetNetworkACL(getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) - Operation response error`, func() { - version := "testString" - getSubnetNetworkACLPath := "/subnets/testString/network_acl" - 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(getSubnetNetworkACLPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetSubnetNetworkACL 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 GetSubnetNetworkACLOptions model - getSubnetNetworkACLOptionsModel := new(vpcv1.GetSubnetNetworkACLOptions) - getSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") - getSubnetNetworkACLOptionsModel.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.GetSubnetNetworkACL(getSubnetNetworkACLOptionsModel) - 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.GetSubnetNetworkACL(getSubnetNetworkACLOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSubnetNetworkACL(getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions)`, func() { - version := "testString" - getSubnetNetworkACLPath := "/subnets/testString/network_acl" - 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(getSubnetNetworkACLPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetSubnetNetworkACL 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 GetSubnetNetworkACLOptions model - getSubnetNetworkACLOptionsModel := new(vpcv1.GetSubnetNetworkACLOptions) - getSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") - getSubnetNetworkACLOptionsModel.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.GetSubnetNetworkACLWithContext(ctx, getSubnetNetworkACLOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetSubnetNetworkACL(getSubnetNetworkACLOptionsModel) - 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.GetSubnetNetworkACLWithContext(ctx, getSubnetNetworkACLOptionsModel) - 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(getSubnetNetworkACLPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetSubnetNetworkACL 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.GetSubnetNetworkACL(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetSubnetNetworkACLOptions model - getSubnetNetworkACLOptionsModel := new(vpcv1.GetSubnetNetworkACLOptions) - getSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") - getSubnetNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSubnetNetworkACL(getSubnetNetworkACLOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetSubnetNetworkACL 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 GetSubnetNetworkACLOptions model - getSubnetNetworkACLOptionsModel := new(vpcv1.GetSubnetNetworkACLOptions) - getSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") - getSubnetNetworkACLOptionsModel.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.GetSubnetNetworkACL(getSubnetNetworkACLOptionsModel) - 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 GetSubnetNetworkACLOptions model with no property values - getSubnetNetworkACLOptionsModelNew := new(vpcv1.GetSubnetNetworkACLOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetSubnetNetworkACL(getSubnetNetworkACLOptionsModelNew) - 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 GetSubnetNetworkACL 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 GetSubnetNetworkACLOptions model - getSubnetNetworkACLOptionsModel := new(vpcv1.GetSubnetNetworkACLOptions) - getSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") - getSubnetNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetSubnetNetworkACL(getSubnetNetworkACLOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) - Operation response error`, func() { - version := "testString" - replaceSubnetNetworkACLPath := "/subnets/testString/network_acl" - 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(replaceSubnetNetworkACLPath)) - Expect(req.Method).To(Equal("PUT")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ReplaceSubnetNetworkACL 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 NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the ReplaceSubnetNetworkACLOptions model - replaceSubnetNetworkACLOptionsModel := new(vpcv1.ReplaceSubnetNetworkACLOptions) - replaceSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") - replaceSubnetNetworkACLOptionsModel.NetworkACLIdentity = networkACLIdentityModel - replaceSubnetNetworkACLOptionsModel.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.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModel) - 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.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions)`, func() { - version := "testString" - replaceSubnetNetworkACLPath := "/subnets/testString/network_acl" - 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(replaceSubnetNetworkACLPath)) - 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{"testString"})) - 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke ReplaceSubnetNetworkACL 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 NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the ReplaceSubnetNetworkACLOptions model - replaceSubnetNetworkACLOptionsModel := new(vpcv1.ReplaceSubnetNetworkACLOptions) - replaceSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") - replaceSubnetNetworkACLOptionsModel.NetworkACLIdentity = networkACLIdentityModel - replaceSubnetNetworkACLOptionsModel.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.ReplaceSubnetNetworkACLWithContext(ctx, replaceSubnetNetworkACLOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModel) - 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.ReplaceSubnetNetworkACLWithContext(ctx, replaceSubnetNetworkACLOptionsModel) - 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(replaceSubnetNetworkACLPath)) - 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{"testString"})) - 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke ReplaceSubnetNetworkACL 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.ReplaceSubnetNetworkACL(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the ReplaceSubnetNetworkACLOptions model - replaceSubnetNetworkACLOptionsModel := new(vpcv1.ReplaceSubnetNetworkACLOptions) - replaceSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") - replaceSubnetNetworkACLOptionsModel.NetworkACLIdentity = networkACLIdentityModel - replaceSubnetNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ReplaceSubnetNetworkACL 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 NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the ReplaceSubnetNetworkACLOptions model - replaceSubnetNetworkACLOptionsModel := new(vpcv1.ReplaceSubnetNetworkACLOptions) - replaceSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") - replaceSubnetNetworkACLOptionsModel.NetworkACLIdentity = networkACLIdentityModel - replaceSubnetNetworkACLOptionsModel.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.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModel) - 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 ReplaceSubnetNetworkACLOptions model with no property values - replaceSubnetNetworkACLOptionsModelNew := new(vpcv1.ReplaceSubnetNetworkACLOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModelNew) - 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 ReplaceSubnetNetworkACL 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 NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - - // Construct an instance of the ReplaceSubnetNetworkACLOptions model - replaceSubnetNetworkACLOptionsModel := new(vpcv1.ReplaceSubnetNetworkACLOptions) - replaceSubnetNetworkACLOptionsModel.ID = core.StringPtr("testString") - replaceSubnetNetworkACLOptionsModel.NetworkACLIdentity = networkACLIdentityModel - replaceSubnetNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions)`, func() { - version := "testString" - unsetSubnetPublicGatewayPath := "/subnets/testString/public_gateway" - 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(unsetSubnetPublicGatewayPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke UnsetSubnetPublicGateway 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.UnsetSubnetPublicGateway(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the UnsetSubnetPublicGatewayOptions model - unsetSubnetPublicGatewayOptionsModel := new(vpcv1.UnsetSubnetPublicGatewayOptions) - unsetSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") - unsetSubnetPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke UnsetSubnetPublicGateway 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 UnsetSubnetPublicGatewayOptions model - unsetSubnetPublicGatewayOptionsModel := new(vpcv1.UnsetSubnetPublicGatewayOptions) - unsetSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") - unsetSubnetPublicGatewayOptionsModel.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.UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the UnsetSubnetPublicGatewayOptions model with no property values - unsetSubnetPublicGatewayOptionsModelNew := new(vpcv1.UnsetSubnetPublicGatewayOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) - Operation response error`, func() { - version := "testString" - getSubnetPublicGatewayPath := "/subnets/testString/public_gateway" - 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(getSubnetPublicGatewayPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetSubnetPublicGateway 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 GetSubnetPublicGatewayOptions model - getSubnetPublicGatewayOptionsModel := new(vpcv1.GetSubnetPublicGatewayOptions) - getSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") - getSubnetPublicGatewayOptionsModel.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.GetSubnetPublicGateway(getSubnetPublicGatewayOptionsModel) - 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.GetSubnetPublicGateway(getSubnetPublicGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions)`, func() { - version := "testString" - getSubnetPublicGatewayPath := "/subnets/testString/public_gateway" - 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(getSubnetPublicGatewayPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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 GetSubnetPublicGatewayOptions model - getSubnetPublicGatewayOptionsModel := new(vpcv1.GetSubnetPublicGatewayOptions) - getSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") - getSubnetPublicGatewayOptionsModel.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.GetSubnetPublicGatewayWithContext(ctx, getSubnetPublicGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetSubnetPublicGateway(getSubnetPublicGatewayOptionsModel) - 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.GetSubnetPublicGatewayWithContext(ctx, getSubnetPublicGatewayOptionsModel) - 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(getSubnetPublicGatewayPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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.GetSubnetPublicGateway(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetSubnetPublicGatewayOptions model - getSubnetPublicGatewayOptionsModel := new(vpcv1.GetSubnetPublicGatewayOptions) - getSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") - getSubnetPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSubnetPublicGateway(getSubnetPublicGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetSubnetPublicGateway 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 GetSubnetPublicGatewayOptions model - getSubnetPublicGatewayOptionsModel := new(vpcv1.GetSubnetPublicGatewayOptions) - getSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") - getSubnetPublicGatewayOptionsModel.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.GetSubnetPublicGateway(getSubnetPublicGatewayOptionsModel) - 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 GetSubnetPublicGatewayOptions model with no property values - getSubnetPublicGatewayOptionsModelNew := new(vpcv1.GetSubnetPublicGatewayOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetSubnetPublicGateway(getSubnetPublicGatewayOptionsModelNew) - 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 GetSubnetPublicGateway 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 GetSubnetPublicGatewayOptions model - getSubnetPublicGatewayOptionsModel := new(vpcv1.GetSubnetPublicGatewayOptions) - getSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") - getSubnetPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetSubnetPublicGateway(getSubnetPublicGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) - Operation response error`, func() { - version := "testString" - setSubnetPublicGatewayPath := "/subnets/testString/public_gateway" - 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(setSubnetPublicGatewayPath)) - Expect(req.Method).To(Equal("PUT")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 SetSubnetPublicGateway 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 PublicGatewayIdentityPublicGatewayIdentityByID model - publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) - publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the SetSubnetPublicGatewayOptions model - setSubnetPublicGatewayOptionsModel := new(vpcv1.SetSubnetPublicGatewayOptions) - setSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") - setSubnetPublicGatewayOptionsModel.PublicGatewayIdentity = publicGatewayIdentityModel - setSubnetPublicGatewayOptionsModel.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.SetSubnetPublicGateway(setSubnetPublicGatewayOptionsModel) - 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.SetSubnetPublicGateway(setSubnetPublicGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions)`, func() { - version := "testString" - setSubnetPublicGatewayPath := "/subnets/testString/public_gateway" - 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(setSubnetPublicGatewayPath)) - 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{"testString"})) - 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", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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 PublicGatewayIdentityPublicGatewayIdentityByID model - publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) - publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the SetSubnetPublicGatewayOptions model - setSubnetPublicGatewayOptionsModel := new(vpcv1.SetSubnetPublicGatewayOptions) - setSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") - setSubnetPublicGatewayOptionsModel.PublicGatewayIdentity = publicGatewayIdentityModel - setSubnetPublicGatewayOptionsModel.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.SetSubnetPublicGatewayWithContext(ctx, setSubnetPublicGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.SetSubnetPublicGateway(setSubnetPublicGatewayOptionsModel) - 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.SetSubnetPublicGatewayWithContext(ctx, setSubnetPublicGatewayOptionsModel) - 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(setSubnetPublicGatewayPath)) - 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{"testString"})) - 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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.SetSubnetPublicGateway(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model - publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) - publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the SetSubnetPublicGatewayOptions model - setSubnetPublicGatewayOptionsModel := new(vpcv1.SetSubnetPublicGatewayOptions) - setSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") - setSubnetPublicGatewayOptionsModel.PublicGatewayIdentity = publicGatewayIdentityModel - setSubnetPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.SetSubnetPublicGateway(setSubnetPublicGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke SetSubnetPublicGateway 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 PublicGatewayIdentityPublicGatewayIdentityByID model - publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) - publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the SetSubnetPublicGatewayOptions model - setSubnetPublicGatewayOptionsModel := new(vpcv1.SetSubnetPublicGatewayOptions) - setSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") - setSubnetPublicGatewayOptionsModel.PublicGatewayIdentity = publicGatewayIdentityModel - setSubnetPublicGatewayOptionsModel.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.SetSubnetPublicGateway(setSubnetPublicGatewayOptionsModel) - 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 SetSubnetPublicGatewayOptions model with no property values - setSubnetPublicGatewayOptionsModelNew := new(vpcv1.SetSubnetPublicGatewayOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.SetSubnetPublicGateway(setSubnetPublicGatewayOptionsModelNew) - 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 SetSubnetPublicGateway 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 PublicGatewayIdentityPublicGatewayIdentityByID model - publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) - publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - - // Construct an instance of the SetSubnetPublicGatewayOptions model - setSubnetPublicGatewayOptionsModel := new(vpcv1.SetSubnetPublicGatewayOptions) - setSubnetPublicGatewayOptionsModel.ID = core.StringPtr("testString") - setSubnetPublicGatewayOptionsModel.PublicGatewayIdentity = publicGatewayIdentityModel - setSubnetPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.SetSubnetPublicGateway(setSubnetPublicGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) - Operation response error`, func() { - version := "testString" - getSubnetRoutingTablePath := "/subnets/testString/routing_table" - 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(getSubnetRoutingTablePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetSubnetRoutingTable 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 GetSubnetRoutingTableOptions model - getSubnetRoutingTableOptionsModel := new(vpcv1.GetSubnetRoutingTableOptions) - getSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") - getSubnetRoutingTableOptionsModel.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.GetSubnetRoutingTable(getSubnetRoutingTableOptionsModel) - 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.GetSubnetRoutingTable(getSubnetRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions)`, func() { - version := "testString" - getSubnetRoutingTablePath := "/subnets/testString/routing_table" - 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(getSubnetRoutingTablePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) - })) - }) - It(`Invoke GetSubnetRoutingTable 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 GetSubnetRoutingTableOptions model - getSubnetRoutingTableOptionsModel := new(vpcv1.GetSubnetRoutingTableOptions) - getSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") - getSubnetRoutingTableOptionsModel.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.GetSubnetRoutingTableWithContext(ctx, getSubnetRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetSubnetRoutingTable(getSubnetRoutingTableOptionsModel) - 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.GetSubnetRoutingTableWithContext(ctx, getSubnetRoutingTableOptionsModel) - 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(getSubnetRoutingTablePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) - })) - }) - It(`Invoke GetSubnetRoutingTable 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.GetSubnetRoutingTable(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetSubnetRoutingTableOptions model - getSubnetRoutingTableOptionsModel := new(vpcv1.GetSubnetRoutingTableOptions) - getSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") - getSubnetRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSubnetRoutingTable(getSubnetRoutingTableOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetSubnetRoutingTable 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 GetSubnetRoutingTableOptions model - getSubnetRoutingTableOptionsModel := new(vpcv1.GetSubnetRoutingTableOptions) - getSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") - getSubnetRoutingTableOptionsModel.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.GetSubnetRoutingTable(getSubnetRoutingTableOptionsModel) - 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 GetSubnetRoutingTableOptions model with no property values - getSubnetRoutingTableOptionsModelNew := new(vpcv1.GetSubnetRoutingTableOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetSubnetRoutingTable(getSubnetRoutingTableOptionsModelNew) - 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 GetSubnetRoutingTable 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 GetSubnetRoutingTableOptions model - getSubnetRoutingTableOptionsModel := new(vpcv1.GetSubnetRoutingTableOptions) - getSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") - getSubnetRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetSubnetRoutingTable(getSubnetRoutingTableOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) - Operation response error`, func() { - version := "testString" - replaceSubnetRoutingTablePath := "/subnets/testString/routing_table" - 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(replaceSubnetRoutingTablePath)) - Expect(req.Method).To(Equal("PUT")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ReplaceSubnetRoutingTable 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 RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("1a15dca5-7e33-45e1-b7c5-bc690e569531") - - // Construct an instance of the ReplaceSubnetRoutingTableOptions model - replaceSubnetRoutingTableOptionsModel := new(vpcv1.ReplaceSubnetRoutingTableOptions) - replaceSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") - replaceSubnetRoutingTableOptionsModel.RoutingTableIdentity = routingTableIdentityModel - replaceSubnetRoutingTableOptionsModel.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.ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptionsModel) - 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.ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions)`, func() { - version := "testString" - replaceSubnetRoutingTablePath := "/subnets/testString/routing_table" - 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(replaceSubnetRoutingTablePath)) - 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{"testString"})) - 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) - })) - }) - It(`Invoke ReplaceSubnetRoutingTable 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 RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("1a15dca5-7e33-45e1-b7c5-bc690e569531") - - // Construct an instance of the ReplaceSubnetRoutingTableOptions model - replaceSubnetRoutingTableOptionsModel := new(vpcv1.ReplaceSubnetRoutingTableOptions) - replaceSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") - replaceSubnetRoutingTableOptionsModel.RoutingTableIdentity = routingTableIdentityModel - replaceSubnetRoutingTableOptionsModel.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.ReplaceSubnetRoutingTableWithContext(ctx, replaceSubnetRoutingTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptionsModel) - 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.ReplaceSubnetRoutingTableWithContext(ctx, replaceSubnetRoutingTableOptionsModel) - 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(replaceSubnetRoutingTablePath)) - 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{"testString"})) - 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", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "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/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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) - })) - }) - It(`Invoke ReplaceSubnetRoutingTable 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.ReplaceSubnetRoutingTable(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("1a15dca5-7e33-45e1-b7c5-bc690e569531") - - // Construct an instance of the ReplaceSubnetRoutingTableOptions model - replaceSubnetRoutingTableOptionsModel := new(vpcv1.ReplaceSubnetRoutingTableOptions) - replaceSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") - replaceSubnetRoutingTableOptionsModel.RoutingTableIdentity = routingTableIdentityModel - replaceSubnetRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ReplaceSubnetRoutingTable 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 RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("1a15dca5-7e33-45e1-b7c5-bc690e569531") - - // Construct an instance of the ReplaceSubnetRoutingTableOptions model - replaceSubnetRoutingTableOptionsModel := new(vpcv1.ReplaceSubnetRoutingTableOptions) - replaceSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") - replaceSubnetRoutingTableOptionsModel.RoutingTableIdentity = routingTableIdentityModel - replaceSubnetRoutingTableOptionsModel.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.ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptionsModel) - 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 ReplaceSubnetRoutingTableOptions model with no property values - replaceSubnetRoutingTableOptionsModelNew := new(vpcv1.ReplaceSubnetRoutingTableOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptionsModelNew) - 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 ReplaceSubnetRoutingTable 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 RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - routingTableIdentityModel.ID = core.StringPtr("1a15dca5-7e33-45e1-b7c5-bc690e569531") - - // Construct an instance of the ReplaceSubnetRoutingTableOptions model - replaceSubnetRoutingTableOptionsModel := new(vpcv1.ReplaceSubnetRoutingTableOptions) - replaceSubnetRoutingTableOptionsModel.ID = core.StringPtr("testString") - replaceSubnetRoutingTableOptionsModel.RoutingTableIdentity = routingTableIdentityModel - replaceSubnetRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) - Operation response error`, func() { - version := "testString" - listSubnetReservedIpsPath := "/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(listSubnetReservedIpsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListSubnetReservedIps 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 ListSubnetReservedIpsOptions model - listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) - listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") - listSubnetReservedIpsOptionsModel.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.ListSubnetReservedIps(listSubnetReservedIpsOptionsModel) - 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.ListSubnetReservedIps(listSubnetReservedIpsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions)`, func() { - version := "testString" - listSubnetReservedIpsPath := "/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(listSubnetReservedIpsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "total_count": 132}`) - })) - }) - It(`Invoke ListSubnetReservedIps 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 ListSubnetReservedIpsOptions model - listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) - listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") - listSubnetReservedIpsOptionsModel.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.ListSubnetReservedIpsWithContext(ctx, listSubnetReservedIpsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListSubnetReservedIps(listSubnetReservedIpsOptionsModel) - 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.ListSubnetReservedIpsWithContext(ctx, listSubnetReservedIpsOptionsModel) - 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(listSubnetReservedIpsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "total_count": 132}`) - })) - }) - It(`Invoke ListSubnetReservedIps 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.ListSubnetReservedIps(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListSubnetReservedIpsOptions model - listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) - listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") - listSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListSubnetReservedIps(listSubnetReservedIpsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListSubnetReservedIps 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 ListSubnetReservedIpsOptions model - listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) - listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") - listSubnetReservedIpsOptionsModel.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.ListSubnetReservedIps(listSubnetReservedIpsOptionsModel) - 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 ListSubnetReservedIpsOptions model with no property values - listSubnetReservedIpsOptionsModelNew := new(vpcv1.ListSubnetReservedIpsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListSubnetReservedIps(listSubnetReservedIpsOptionsModelNew) - 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 ListSubnetReservedIps 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 ListSubnetReservedIpsOptions model - listSubnetReservedIpsOptionsModel := new(vpcv1.ListSubnetReservedIpsOptions) - listSubnetReservedIpsOptionsModel.SubnetID = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Start = core.StringPtr("testString") - listSubnetReservedIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSubnetReservedIpsOptionsModel.Sort = core.StringPtr("name") - listSubnetReservedIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListSubnetReservedIps(listSubnetReservedIpsOptionsModel) - 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.ReservedIPCollection) - nextObject := new(vpcv1.ReservedIPCollectionNext) - 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.ReservedIPCollection) - - 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.ReservedIPCollection) - nextObject := new(vpcv1.ReservedIPCollectionNext) - 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(listSubnetReservedIpsPath)) - 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":"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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"user","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"d7cc5196-9864-48c4-82d8-3f30da41fcc5","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"user","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"d7cc5196-9864-48c4-82d8-3f30da41fcc5","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use SubnetReservedIpsPager.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()) - - listSubnetReservedIpsOptionsModel := &vpcv1.ListSubnetReservedIpsOptions{ - SubnetID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - } - - pager, err := vpcService.NewSubnetReservedIpsPager(listSubnetReservedIpsOptionsModel) - 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 SubnetReservedIpsPager.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()) - - listSubnetReservedIpsOptionsModel := &vpcv1.ListSubnetReservedIpsOptions{ - SubnetID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - } - - pager, err := vpcService.NewSubnetReservedIpsPager(listSubnetReservedIpsOptionsModel) - 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(`CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) - Operation response error`, func() { - version := "testString" - createSubnetReservedIPPath := "/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(createSubnetReservedIPPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateSubnetReservedIP 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 ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID model - reservedIPTargetPrototypeModel := new(vpcv1.ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) - reservedIPTargetPrototypeModel.ID = core.StringPtr("d7cc5196-9864-48c4-82d8-3f30da41fcc5") - - // Construct an instance of the CreateSubnetReservedIPOptions model - createSubnetReservedIPOptionsModel := new(vpcv1.CreateSubnetReservedIPOptions) - createSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - createSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") - createSubnetReservedIPOptionsModel.AutoDelete = core.BoolPtr(false) - createSubnetReservedIPOptionsModel.Name = core.StringPtr("my-reserved-ip") - createSubnetReservedIPOptionsModel.Target = reservedIPTargetPrototypeModel - createSubnetReservedIPOptionsModel.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.CreateSubnetReservedIP(createSubnetReservedIPOptionsModel) - 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.CreateSubnetReservedIP(createSubnetReservedIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions)`, func() { - version := "testString" - createSubnetReservedIPPath := "/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(createSubnetReservedIPPath)) - 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{"testString"})) - 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": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) - })) - }) - It(`Invoke CreateSubnetReservedIP 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 ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID model - reservedIPTargetPrototypeModel := new(vpcv1.ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) - reservedIPTargetPrototypeModel.ID = core.StringPtr("d7cc5196-9864-48c4-82d8-3f30da41fcc5") - - // Construct an instance of the CreateSubnetReservedIPOptions model - createSubnetReservedIPOptionsModel := new(vpcv1.CreateSubnetReservedIPOptions) - createSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - createSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") - createSubnetReservedIPOptionsModel.AutoDelete = core.BoolPtr(false) - createSubnetReservedIPOptionsModel.Name = core.StringPtr("my-reserved-ip") - createSubnetReservedIPOptionsModel.Target = reservedIPTargetPrototypeModel - createSubnetReservedIPOptionsModel.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.CreateSubnetReservedIPWithContext(ctx, createSubnetReservedIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateSubnetReservedIP(createSubnetReservedIPOptionsModel) - 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.CreateSubnetReservedIPWithContext(ctx, createSubnetReservedIPOptionsModel) - 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(createSubnetReservedIPPath)) - 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{"testString"})) - 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": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) - })) - }) - It(`Invoke CreateSubnetReservedIP 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.CreateSubnetReservedIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID model - reservedIPTargetPrototypeModel := new(vpcv1.ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) - reservedIPTargetPrototypeModel.ID = core.StringPtr("d7cc5196-9864-48c4-82d8-3f30da41fcc5") - - // Construct an instance of the CreateSubnetReservedIPOptions model - createSubnetReservedIPOptionsModel := new(vpcv1.CreateSubnetReservedIPOptions) - createSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - createSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") - createSubnetReservedIPOptionsModel.AutoDelete = core.BoolPtr(false) - createSubnetReservedIPOptionsModel.Name = core.StringPtr("my-reserved-ip") - createSubnetReservedIPOptionsModel.Target = reservedIPTargetPrototypeModel - createSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateSubnetReservedIP(createSubnetReservedIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateSubnetReservedIP 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 ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID model - reservedIPTargetPrototypeModel := new(vpcv1.ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) - reservedIPTargetPrototypeModel.ID = core.StringPtr("d7cc5196-9864-48c4-82d8-3f30da41fcc5") - - // Construct an instance of the CreateSubnetReservedIPOptions model - createSubnetReservedIPOptionsModel := new(vpcv1.CreateSubnetReservedIPOptions) - createSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - createSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") - createSubnetReservedIPOptionsModel.AutoDelete = core.BoolPtr(false) - createSubnetReservedIPOptionsModel.Name = core.StringPtr("my-reserved-ip") - createSubnetReservedIPOptionsModel.Target = reservedIPTargetPrototypeModel - createSubnetReservedIPOptionsModel.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.CreateSubnetReservedIP(createSubnetReservedIPOptionsModel) - 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 CreateSubnetReservedIPOptions model with no property values - createSubnetReservedIPOptionsModelNew := new(vpcv1.CreateSubnetReservedIPOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateSubnetReservedIP(createSubnetReservedIPOptionsModelNew) - 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 CreateSubnetReservedIP 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 ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID model - reservedIPTargetPrototypeModel := new(vpcv1.ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) - reservedIPTargetPrototypeModel.ID = core.StringPtr("d7cc5196-9864-48c4-82d8-3f30da41fcc5") - - // Construct an instance of the CreateSubnetReservedIPOptions model - createSubnetReservedIPOptionsModel := new(vpcv1.CreateSubnetReservedIPOptions) - createSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - createSubnetReservedIPOptionsModel.Address = core.StringPtr("192.168.3.4") - createSubnetReservedIPOptionsModel.AutoDelete = core.BoolPtr(false) - createSubnetReservedIPOptionsModel.Name = core.StringPtr("my-reserved-ip") - createSubnetReservedIPOptionsModel.Target = reservedIPTargetPrototypeModel - createSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateSubnetReservedIP(createSubnetReservedIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions)`, func() { - version := "testString" - deleteSubnetReservedIPPath := "/subnets/testString/reserved_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(deleteSubnetReservedIPPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteSubnetReservedIP 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.DeleteSubnetReservedIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteSubnetReservedIPOptions model - deleteSubnetReservedIPOptionsModel := new(vpcv1.DeleteSubnetReservedIPOptions) - deleteSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - deleteSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") - deleteSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteSubnetReservedIP(deleteSubnetReservedIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteSubnetReservedIP 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 DeleteSubnetReservedIPOptions model - deleteSubnetReservedIPOptionsModel := new(vpcv1.DeleteSubnetReservedIPOptions) - deleteSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - deleteSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") - deleteSubnetReservedIPOptionsModel.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.DeleteSubnetReservedIP(deleteSubnetReservedIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSubnetReservedIPOptions model with no property values - deleteSubnetReservedIPOptionsModelNew := new(vpcv1.DeleteSubnetReservedIPOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteSubnetReservedIP(deleteSubnetReservedIPOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) - Operation response error`, func() { - version := "testString" - getSubnetReservedIPPath := "/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(getSubnetReservedIPPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetSubnetReservedIP 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 GetSubnetReservedIPOptions model - getSubnetReservedIPOptionsModel := new(vpcv1.GetSubnetReservedIPOptions) - getSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - getSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") - getSubnetReservedIPOptionsModel.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.GetSubnetReservedIP(getSubnetReservedIPOptionsModel) - 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.GetSubnetReservedIP(getSubnetReservedIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions)`, func() { - version := "testString" - getSubnetReservedIPPath := "/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(getSubnetReservedIPPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) - })) - }) - It(`Invoke GetSubnetReservedIP 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 GetSubnetReservedIPOptions model - getSubnetReservedIPOptionsModel := new(vpcv1.GetSubnetReservedIPOptions) - getSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - getSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") - getSubnetReservedIPOptionsModel.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.GetSubnetReservedIPWithContext(ctx, getSubnetReservedIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetSubnetReservedIP(getSubnetReservedIPOptionsModel) - 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.GetSubnetReservedIPWithContext(ctx, getSubnetReservedIPOptionsModel) - 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(getSubnetReservedIPPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) - })) - }) - It(`Invoke GetSubnetReservedIP 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.GetSubnetReservedIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetSubnetReservedIPOptions model - getSubnetReservedIPOptionsModel := new(vpcv1.GetSubnetReservedIPOptions) - getSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - getSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") - getSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSubnetReservedIP(getSubnetReservedIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetSubnetReservedIP 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 GetSubnetReservedIPOptions model - getSubnetReservedIPOptionsModel := new(vpcv1.GetSubnetReservedIPOptions) - getSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - getSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") - getSubnetReservedIPOptionsModel.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.GetSubnetReservedIP(getSubnetReservedIPOptionsModel) - 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 GetSubnetReservedIPOptions model with no property values - getSubnetReservedIPOptionsModelNew := new(vpcv1.GetSubnetReservedIPOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetSubnetReservedIP(getSubnetReservedIPOptionsModelNew) - 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 GetSubnetReservedIP 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 GetSubnetReservedIPOptions model - getSubnetReservedIPOptionsModel := new(vpcv1.GetSubnetReservedIPOptions) - getSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - getSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") - getSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetSubnetReservedIP(getSubnetReservedIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateSubnetReservedIP(updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) - Operation response error`, func() { - version := "testString" - updateSubnetReservedIPPath := "/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(updateSubnetReservedIPPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateSubnetReservedIP 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 ReservedIPPatch model - reservedIPPatchModel := new(vpcv1.ReservedIPPatch) - reservedIPPatchModel.AutoDelete = core.BoolPtr(false) - reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") - reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSubnetReservedIPOptions model - updateSubnetReservedIPOptionsModel := new(vpcv1.UpdateSubnetReservedIPOptions) - updateSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - updateSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") - updateSubnetReservedIPOptionsModel.ReservedIPPatch = reservedIPPatchModelAsPatch - updateSubnetReservedIPOptionsModel.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.UpdateSubnetReservedIP(updateSubnetReservedIPOptionsModel) - 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.UpdateSubnetReservedIP(updateSubnetReservedIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateSubnetReservedIP(updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions)`, func() { - version := "testString" - updateSubnetReservedIPPath := "/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(updateSubnetReservedIPPath)) - 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{"testString"})) - 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) - })) - }) - It(`Invoke UpdateSubnetReservedIP 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 ReservedIPPatch model - reservedIPPatchModel := new(vpcv1.ReservedIPPatch) - reservedIPPatchModel.AutoDelete = core.BoolPtr(false) - reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") - reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSubnetReservedIPOptions model - updateSubnetReservedIPOptionsModel := new(vpcv1.UpdateSubnetReservedIPOptions) - updateSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - updateSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") - updateSubnetReservedIPOptionsModel.ReservedIPPatch = reservedIPPatchModelAsPatch - updateSubnetReservedIPOptionsModel.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.UpdateSubnetReservedIPWithContext(ctx, updateSubnetReservedIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateSubnetReservedIP(updateSubnetReservedIPOptionsModel) - 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.UpdateSubnetReservedIPWithContext(ctx, updateSubnetReservedIPOptionsModel) - 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(updateSubnetReservedIPPath)) - 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{"testString"})) - 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) - })) - }) - It(`Invoke UpdateSubnetReservedIP 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.UpdateSubnetReservedIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ReservedIPPatch model - reservedIPPatchModel := new(vpcv1.ReservedIPPatch) - reservedIPPatchModel.AutoDelete = core.BoolPtr(false) - reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") - reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSubnetReservedIPOptions model - updateSubnetReservedIPOptionsModel := new(vpcv1.UpdateSubnetReservedIPOptions) - updateSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - updateSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") - updateSubnetReservedIPOptionsModel.ReservedIPPatch = reservedIPPatchModelAsPatch - updateSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateSubnetReservedIP(updateSubnetReservedIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateSubnetReservedIP 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 ReservedIPPatch model - reservedIPPatchModel := new(vpcv1.ReservedIPPatch) - reservedIPPatchModel.AutoDelete = core.BoolPtr(false) - reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") - reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSubnetReservedIPOptions model - updateSubnetReservedIPOptionsModel := new(vpcv1.UpdateSubnetReservedIPOptions) - updateSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - updateSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") - updateSubnetReservedIPOptionsModel.ReservedIPPatch = reservedIPPatchModelAsPatch - updateSubnetReservedIPOptionsModel.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.UpdateSubnetReservedIP(updateSubnetReservedIPOptionsModel) - 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 UpdateSubnetReservedIPOptions model with no property values - updateSubnetReservedIPOptionsModelNew := new(vpcv1.UpdateSubnetReservedIPOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateSubnetReservedIP(updateSubnetReservedIPOptionsModelNew) - 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 UpdateSubnetReservedIP 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 ReservedIPPatch model - reservedIPPatchModel := new(vpcv1.ReservedIPPatch) - reservedIPPatchModel.AutoDelete = core.BoolPtr(false) - reservedIPPatchModel.Name = core.StringPtr("my-reserved-ip") - reservedIPPatchModelAsPatch, asPatchErr := reservedIPPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSubnetReservedIPOptions model - updateSubnetReservedIPOptionsModel := new(vpcv1.UpdateSubnetReservedIPOptions) - updateSubnetReservedIPOptionsModel.SubnetID = core.StringPtr("testString") - updateSubnetReservedIPOptionsModel.ID = core.StringPtr("testString") - updateSubnetReservedIPOptionsModel.ReservedIPPatch = reservedIPPatchModelAsPatch - updateSubnetReservedIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateSubnetReservedIP(updateSubnetReservedIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListImages(listImagesOptions *ListImagesOptions) - Operation response error`, func() { - version := "testString" - listImagesPath := "/images" - 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(listImagesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["visibility"]).To(Equal([]string{"private"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListImages 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 ListImagesOptions model - listImagesOptionsModel := new(vpcv1.ListImagesOptions) - listImagesOptionsModel.Start = core.StringPtr("testString") - listImagesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listImagesOptionsModel.Name = core.StringPtr("testString") - listImagesOptionsModel.Visibility = core.StringPtr("private") - listImagesOptionsModel.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.ListImages(listImagesOptionsModel) - 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.ListImages(listImagesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListImages(listImagesOptions *ListImagesOptions)`, func() { - version := "testString" - listImagesPath := "/images" - 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(listImagesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["visibility"]).To(Equal([]string{"private"})) - // 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/images?limit=20"}, "images": [{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/images?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}}`) - })) - }) - It(`Invoke ListImages 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 ListImagesOptions model - listImagesOptionsModel := new(vpcv1.ListImagesOptions) - listImagesOptionsModel.Start = core.StringPtr("testString") - listImagesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listImagesOptionsModel.Name = core.StringPtr("testString") - listImagesOptionsModel.Visibility = core.StringPtr("private") - listImagesOptionsModel.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.ListImagesWithContext(ctx, listImagesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListImages(listImagesOptionsModel) - 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.ListImagesWithContext(ctx, listImagesOptionsModel) - 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(listImagesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["visibility"]).To(Equal([]string{"private"})) - // 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/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/images?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}}`) - })) - }) - It(`Invoke ListImages 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.ListImages(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListImagesOptions model - listImagesOptionsModel := new(vpcv1.ListImagesOptions) - listImagesOptionsModel.Start = core.StringPtr("testString") - listImagesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listImagesOptionsModel.Name = core.StringPtr("testString") - listImagesOptionsModel.Visibility = core.StringPtr("private") - listImagesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListImages(listImagesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListImages 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 ListImagesOptions model - listImagesOptionsModel := new(vpcv1.ListImagesOptions) - listImagesOptionsModel.Start = core.StringPtr("testString") - listImagesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listImagesOptionsModel.Name = core.StringPtr("testString") - listImagesOptionsModel.Visibility = core.StringPtr("private") - listImagesOptionsModel.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.ListImages(listImagesOptionsModel) - 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 ListImages 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 ListImagesOptions model - listImagesOptionsModel := new(vpcv1.ListImagesOptions) - listImagesOptionsModel.Start = core.StringPtr("testString") - listImagesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listImagesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listImagesOptionsModel.Name = core.StringPtr("testString") - listImagesOptionsModel.Visibility = core.StringPtr("private") - listImagesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListImages(listImagesOptionsModel) - 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.ImageCollection) - nextObject := new(vpcv1.ImageCollectionNext) - 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.ImageCollection) - - 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.ImageCollection) - nextObject := new(vpcv1.ImageCollectionNext) - 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(listImagesPath)) - 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"},"images":[{"catalog_offering":{"managed":false,"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":22,"name":"my-image","operating_system":{"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-16-amd64","name":"ubuntu-16-amd64","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"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-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"}],"visibility":"private"}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"images":[{"catalog_offering":{"managed":false,"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","encryption":"user_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","minimum_provisioned_size":22,"name":"my-image","operating_system":{"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-16-amd64","name":"ubuntu-16-amd64","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"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-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"}],"visibility":"private"}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use ImagesPager.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()) - - listImagesOptionsModel := &vpcv1.ListImagesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Visibility: core.StringPtr("private"), - } - - pager, err := vpcService.NewImagesPager(listImagesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.Image - 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 ImagesPager.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()) - - listImagesOptionsModel := &vpcv1.ListImagesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Visibility: core.StringPtr("private"), - } - - pager, err := vpcService.NewImagesPager(listImagesOptionsModel) - 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(`CreateImage(createImageOptions *CreateImageOptions) - Operation response error`, func() { - version := "testString" - createImagePath := "/images" - 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(createImagePath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateImage 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the ImageFilePrototype model - imageFilePrototypeModel := new(vpcv1.ImageFilePrototype) - imageFilePrototypeModel.Href = core.StringPtr("cos://us-south/my-bucket/my-image.qcow2") - - // Construct an instance of the OperatingSystemIdentityByName model - operatingSystemIdentityModel := new(vpcv1.OperatingSystemIdentityByName) - operatingSystemIdentityModel.Name = core.StringPtr("debian-9-amd64") - - // Construct an instance of the ImagePrototypeImageByFile model - imagePrototypeModel := new(vpcv1.ImagePrototypeImageByFile) - imagePrototypeModel.Name = core.StringPtr("my-image") - imagePrototypeModel.ResourceGroup = resourceGroupIdentityModel - imagePrototypeModel.EncryptedDataKey = core.StringPtr("testString") - imagePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - imagePrototypeModel.File = imageFilePrototypeModel - imagePrototypeModel.OperatingSystem = operatingSystemIdentityModel - - // Construct an instance of the CreateImageOptions model - createImageOptionsModel := new(vpcv1.CreateImageOptions) - createImageOptionsModel.ImagePrototype = imagePrototypeModel - createImageOptionsModel.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.CreateImage(createImageOptionsModel) - 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.CreateImage(createImageOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateImage(createImageOptions *CreateImageOptions)`, func() { - version := "testString" - createImagePath := "/images" - 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(createImagePath)) - 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{"testString"})) - 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", `{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) - })) - }) - It(`Invoke CreateImage 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the ImageFilePrototype model - imageFilePrototypeModel := new(vpcv1.ImageFilePrototype) - imageFilePrototypeModel.Href = core.StringPtr("cos://us-south/my-bucket/my-image.qcow2") - - // Construct an instance of the OperatingSystemIdentityByName model - operatingSystemIdentityModel := new(vpcv1.OperatingSystemIdentityByName) - operatingSystemIdentityModel.Name = core.StringPtr("debian-9-amd64") - - // Construct an instance of the ImagePrototypeImageByFile model - imagePrototypeModel := new(vpcv1.ImagePrototypeImageByFile) - imagePrototypeModel.Name = core.StringPtr("my-image") - imagePrototypeModel.ResourceGroup = resourceGroupIdentityModel - imagePrototypeModel.EncryptedDataKey = core.StringPtr("testString") - imagePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - imagePrototypeModel.File = imageFilePrototypeModel - imagePrototypeModel.OperatingSystem = operatingSystemIdentityModel - - // Construct an instance of the CreateImageOptions model - createImageOptionsModel := new(vpcv1.CreateImageOptions) - createImageOptionsModel.ImagePrototype = imagePrototypeModel - createImageOptionsModel.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.CreateImageWithContext(ctx, createImageOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateImage(createImageOptionsModel) - 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.CreateImageWithContext(ctx, createImageOptionsModel) - 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(createImagePath)) - 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{"testString"})) - 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", `{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) - })) - }) - It(`Invoke CreateImage 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.CreateImage(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 EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the ImageFilePrototype model - imageFilePrototypeModel := new(vpcv1.ImageFilePrototype) - imageFilePrototypeModel.Href = core.StringPtr("cos://us-south/my-bucket/my-image.qcow2") - - // Construct an instance of the OperatingSystemIdentityByName model - operatingSystemIdentityModel := new(vpcv1.OperatingSystemIdentityByName) - operatingSystemIdentityModel.Name = core.StringPtr("debian-9-amd64") - - // Construct an instance of the ImagePrototypeImageByFile model - imagePrototypeModel := new(vpcv1.ImagePrototypeImageByFile) - imagePrototypeModel.Name = core.StringPtr("my-image") - imagePrototypeModel.ResourceGroup = resourceGroupIdentityModel - imagePrototypeModel.EncryptedDataKey = core.StringPtr("testString") - imagePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - imagePrototypeModel.File = imageFilePrototypeModel - imagePrototypeModel.OperatingSystem = operatingSystemIdentityModel - - // Construct an instance of the CreateImageOptions model - createImageOptionsModel := new(vpcv1.CreateImageOptions) - createImageOptionsModel.ImagePrototype = imagePrototypeModel - createImageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateImage(createImageOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateImage 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 EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the ImageFilePrototype model - imageFilePrototypeModel := new(vpcv1.ImageFilePrototype) - imageFilePrototypeModel.Href = core.StringPtr("cos://us-south/my-bucket/my-image.qcow2") - - // Construct an instance of the OperatingSystemIdentityByName model - operatingSystemIdentityModel := new(vpcv1.OperatingSystemIdentityByName) - operatingSystemIdentityModel.Name = core.StringPtr("debian-9-amd64") - - // Construct an instance of the ImagePrototypeImageByFile model - imagePrototypeModel := new(vpcv1.ImagePrototypeImageByFile) - imagePrototypeModel.Name = core.StringPtr("my-image") - imagePrototypeModel.ResourceGroup = resourceGroupIdentityModel - imagePrototypeModel.EncryptedDataKey = core.StringPtr("testString") - imagePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - imagePrototypeModel.File = imageFilePrototypeModel - imagePrototypeModel.OperatingSystem = operatingSystemIdentityModel - - // Construct an instance of the CreateImageOptions model - createImageOptionsModel := new(vpcv1.CreateImageOptions) - createImageOptionsModel.ImagePrototype = imagePrototypeModel - createImageOptionsModel.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.CreateImage(createImageOptionsModel) - 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 CreateImageOptions model with no property values - createImageOptionsModelNew := new(vpcv1.CreateImageOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateImage(createImageOptionsModelNew) - 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 CreateImage 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") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the ImageFilePrototype model - imageFilePrototypeModel := new(vpcv1.ImageFilePrototype) - imageFilePrototypeModel.Href = core.StringPtr("cos://us-south/my-bucket/my-image.qcow2") - - // Construct an instance of the OperatingSystemIdentityByName model - operatingSystemIdentityModel := new(vpcv1.OperatingSystemIdentityByName) - operatingSystemIdentityModel.Name = core.StringPtr("debian-9-amd64") - - // Construct an instance of the ImagePrototypeImageByFile model - imagePrototypeModel := new(vpcv1.ImagePrototypeImageByFile) - imagePrototypeModel.Name = core.StringPtr("my-image") - imagePrototypeModel.ResourceGroup = resourceGroupIdentityModel - imagePrototypeModel.EncryptedDataKey = core.StringPtr("testString") - imagePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - imagePrototypeModel.File = imageFilePrototypeModel - imagePrototypeModel.OperatingSystem = operatingSystemIdentityModel - - // Construct an instance of the CreateImageOptions model - createImageOptionsModel := new(vpcv1.CreateImageOptions) - createImageOptionsModel.ImagePrototype = imagePrototypeModel - createImageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateImage(createImageOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteImage(deleteImageOptions *DeleteImageOptions)`, func() { - version := "testString" - deleteImagePath := "/images/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(deleteImagePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteImage 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.DeleteImage(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteImageOptions model - deleteImageOptionsModel := new(vpcv1.DeleteImageOptions) - deleteImageOptionsModel.ID = core.StringPtr("testString") - deleteImageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteImage(deleteImageOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteImage 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 DeleteImageOptions model - deleteImageOptionsModel := new(vpcv1.DeleteImageOptions) - deleteImageOptionsModel.ID = core.StringPtr("testString") - deleteImageOptionsModel.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.DeleteImage(deleteImageOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteImageOptions model with no property values - deleteImageOptionsModelNew := new(vpcv1.DeleteImageOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteImage(deleteImageOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetImage(getImageOptions *GetImageOptions) - Operation response error`, func() { - version := "testString" - getImagePath := "/images/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(getImagePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetImage 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 GetImageOptions model - getImageOptionsModel := new(vpcv1.GetImageOptions) - getImageOptionsModel.ID = core.StringPtr("testString") - getImageOptionsModel.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.GetImage(getImageOptionsModel) - 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.GetImage(getImageOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetImage(getImageOptions *GetImageOptions)`, func() { - version := "testString" - getImagePath := "/images/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(getImagePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) - })) - }) - It(`Invoke GetImage 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 GetImageOptions model - getImageOptionsModel := new(vpcv1.GetImageOptions) - getImageOptionsModel.ID = core.StringPtr("testString") - getImageOptionsModel.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.GetImageWithContext(ctx, getImageOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetImage(getImageOptionsModel) - 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.GetImageWithContext(ctx, getImageOptionsModel) - 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(getImagePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) - })) - }) - It(`Invoke GetImage 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.GetImage(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetImageOptions model - getImageOptionsModel := new(vpcv1.GetImageOptions) - getImageOptionsModel.ID = core.StringPtr("testString") - getImageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetImage(getImageOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetImage 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 GetImageOptions model - getImageOptionsModel := new(vpcv1.GetImageOptions) - getImageOptionsModel.ID = core.StringPtr("testString") - getImageOptionsModel.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.GetImage(getImageOptionsModel) - 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 GetImageOptions model with no property values - getImageOptionsModelNew := new(vpcv1.GetImageOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetImage(getImageOptionsModelNew) - 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 GetImage 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 GetImageOptions model - getImageOptionsModel := new(vpcv1.GetImageOptions) - getImageOptionsModel.ID = core.StringPtr("testString") - getImageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetImage(getImageOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateImage(updateImageOptions *UpdateImageOptions) - Operation response error`, func() { - version := "testString" - updateImagePath := "/images/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(updateImagePath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateImage 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 ImagePatch model - imagePatchModel := new(vpcv1.ImagePatch) - imagePatchModel.Name = core.StringPtr("my-image") - imagePatchModelAsPatch, asPatchErr := imagePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateImageOptions model - updateImageOptionsModel := new(vpcv1.UpdateImageOptions) - updateImageOptionsModel.ID = core.StringPtr("testString") - updateImageOptionsModel.ImagePatch = imagePatchModelAsPatch - updateImageOptionsModel.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.UpdateImage(updateImageOptionsModel) - 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.UpdateImage(updateImageOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateImage(updateImageOptions *UpdateImageOptions)`, func() { - version := "testString" - updateImagePath := "/images/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(updateImagePath)) - 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{"testString"})) - 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", `{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) - })) - }) - It(`Invoke UpdateImage 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 ImagePatch model - imagePatchModel := new(vpcv1.ImagePatch) - imagePatchModel.Name = core.StringPtr("my-image") - imagePatchModelAsPatch, asPatchErr := imagePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateImageOptions model - updateImageOptionsModel := new(vpcv1.UpdateImageOptions) - updateImageOptionsModel.ID = core.StringPtr("testString") - updateImageOptionsModel.ImagePatch = imagePatchModelAsPatch - updateImageOptionsModel.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.UpdateImageWithContext(ctx, updateImageOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateImage(updateImageOptionsModel) - 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.UpdateImageWithContext(ctx, updateImageOptionsModel) - 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(updateImagePath)) - 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{"testString"})) - 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", `{"catalog_offering": {"managed": false, "version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "encryption": "user_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "minimum_provisioned_size": 22, "name": "my-image", "operating_system": {"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-16-amd64", "name": "ubuntu-16-amd64", "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"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-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"}], "visibility": "private"}`) - })) - }) - It(`Invoke UpdateImage 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.UpdateImage(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ImagePatch model - imagePatchModel := new(vpcv1.ImagePatch) - imagePatchModel.Name = core.StringPtr("my-image") - imagePatchModelAsPatch, asPatchErr := imagePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateImageOptions model - updateImageOptionsModel := new(vpcv1.UpdateImageOptions) - updateImageOptionsModel.ID = core.StringPtr("testString") - updateImageOptionsModel.ImagePatch = imagePatchModelAsPatch - updateImageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateImage(updateImageOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateImage 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 ImagePatch model - imagePatchModel := new(vpcv1.ImagePatch) - imagePatchModel.Name = core.StringPtr("my-image") - imagePatchModelAsPatch, asPatchErr := imagePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateImageOptions model - updateImageOptionsModel := new(vpcv1.UpdateImageOptions) - updateImageOptionsModel.ID = core.StringPtr("testString") - updateImageOptionsModel.ImagePatch = imagePatchModelAsPatch - updateImageOptionsModel.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.UpdateImage(updateImageOptionsModel) - 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 UpdateImageOptions model with no property values - updateImageOptionsModelNew := new(vpcv1.UpdateImageOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateImage(updateImageOptionsModelNew) - 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 UpdateImage 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 ImagePatch model - imagePatchModel := new(vpcv1.ImagePatch) - imagePatchModel.Name = core.StringPtr("my-image") - imagePatchModelAsPatch, asPatchErr := imagePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateImageOptions model - updateImageOptionsModel := new(vpcv1.UpdateImageOptions) - updateImageOptionsModel.ID = core.StringPtr("testString") - updateImageOptionsModel.ImagePatch = imagePatchModelAsPatch - updateImageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateImage(updateImageOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) - Operation response error`, func() { - version := "testString" - listOperatingSystemsPath := "/operating_systems" - 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(listOperatingSystemsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListOperatingSystems 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 ListOperatingSystemsOptions model - listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) - listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") - listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listOperatingSystemsOptionsModel.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.ListOperatingSystems(listOperatingSystemsOptionsModel) - 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.ListOperatingSystems(listOperatingSystemsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions)`, func() { - version := "testString" - listOperatingSystemsPath := "/operating_systems" - 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(listOperatingSystemsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/operating_systems?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "operating_systems": [{"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-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}]}`) - })) - }) - It(`Invoke ListOperatingSystems 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 ListOperatingSystemsOptions model - listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) - listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") - listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listOperatingSystemsOptionsModel.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.ListOperatingSystemsWithContext(ctx, listOperatingSystemsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListOperatingSystems(listOperatingSystemsOptionsModel) - 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.ListOperatingSystemsWithContext(ctx, listOperatingSystemsOptionsModel) - 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(listOperatingSystemsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/operating_systems?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "operating_systems": [{"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-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}]}`) - })) - }) - It(`Invoke ListOperatingSystems 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.ListOperatingSystems(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListOperatingSystemsOptions model - listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) - listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") - listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listOperatingSystemsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListOperatingSystems(listOperatingSystemsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListOperatingSystems 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 ListOperatingSystemsOptions model - listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) - listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") - listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listOperatingSystemsOptionsModel.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.ListOperatingSystems(listOperatingSystemsOptionsModel) - 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 ListOperatingSystems 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 ListOperatingSystemsOptions model - listOperatingSystemsOptionsModel := new(vpcv1.ListOperatingSystemsOptions) - listOperatingSystemsOptionsModel.Start = core.StringPtr("testString") - listOperatingSystemsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listOperatingSystemsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListOperatingSystems(listOperatingSystemsOptionsModel) - 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.OperatingSystemCollection) - nextObject := new(vpcv1.OperatingSystemCollectionNext) - 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.OperatingSystemCollection) - - 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.OperatingSystemCollection) - nextObject := new(vpcv1.OperatingSystemCollectionNext) - 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(listOperatingSystemsPath)) - 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"},"operating_systems":[{"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-16-amd64","name":"ubuntu-16-amd64","vendor":"Canonical","version":"16.04 LTS"}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"operating_systems":[{"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-16-amd64","name":"ubuntu-16-amd64","vendor":"Canonical","version":"16.04 LTS"}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use OperatingSystemsPager.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()) - - listOperatingSystemsOptionsModel := &vpcv1.ListOperatingSystemsOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewOperatingSystemsPager(listOperatingSystemsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.OperatingSystem - 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 OperatingSystemsPager.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()) - - listOperatingSystemsOptionsModel := &vpcv1.ListOperatingSystemsOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewOperatingSystemsPager(listOperatingSystemsOptionsModel) - 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(`GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) - Operation response error`, func() { - version := "testString" - getOperatingSystemPath := "/operating_systems/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(getOperatingSystemPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetOperatingSystem 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 GetOperatingSystemOptions model - getOperatingSystemOptionsModel := new(vpcv1.GetOperatingSystemOptions) - getOperatingSystemOptionsModel.Name = core.StringPtr("testString") - getOperatingSystemOptionsModel.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.GetOperatingSystem(getOperatingSystemOptionsModel) - 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.GetOperatingSystem(getOperatingSystemOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions)`, func() { - version := "testString" - getOperatingSystemPath := "/operating_systems/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(getOperatingSystemPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}`) - })) - }) - It(`Invoke GetOperatingSystem 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 GetOperatingSystemOptions model - getOperatingSystemOptionsModel := new(vpcv1.GetOperatingSystemOptions) - getOperatingSystemOptionsModel.Name = core.StringPtr("testString") - getOperatingSystemOptionsModel.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.GetOperatingSystemWithContext(ctx, getOperatingSystemOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetOperatingSystem(getOperatingSystemOptionsModel) - 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.GetOperatingSystemWithContext(ctx, getOperatingSystemOptionsModel) - 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(getOperatingSystemPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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-16-amd64", "name": "ubuntu-16-amd64", "vendor": "Canonical", "version": "16.04 LTS"}`) - })) - }) - It(`Invoke GetOperatingSystem 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.GetOperatingSystem(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetOperatingSystemOptions model - getOperatingSystemOptionsModel := new(vpcv1.GetOperatingSystemOptions) - getOperatingSystemOptionsModel.Name = core.StringPtr("testString") - getOperatingSystemOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetOperatingSystem(getOperatingSystemOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetOperatingSystem 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 GetOperatingSystemOptions model - getOperatingSystemOptionsModel := new(vpcv1.GetOperatingSystemOptions) - getOperatingSystemOptionsModel.Name = core.StringPtr("testString") - getOperatingSystemOptionsModel.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.GetOperatingSystem(getOperatingSystemOptionsModel) - 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 GetOperatingSystemOptions model with no property values - getOperatingSystemOptionsModelNew := new(vpcv1.GetOperatingSystemOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetOperatingSystem(getOperatingSystemOptionsModelNew) - 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 GetOperatingSystem 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 GetOperatingSystemOptions model - getOperatingSystemOptionsModel := new(vpcv1.GetOperatingSystemOptions) - getOperatingSystemOptionsModel.Name = core.StringPtr("testString") - getOperatingSystemOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetOperatingSystem(getOperatingSystemOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListKeys(listKeysOptions *ListKeysOptions) - Operation response error`, func() { - version := "testString" - listKeysPath := "/keys" - 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(listKeysPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListKeys 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 ListKeysOptions model - listKeysOptionsModel := new(vpcv1.ListKeysOptions) - listKeysOptionsModel.Start = core.StringPtr("testString") - listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) - 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) - 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.ListKeys(listKeysOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListKeys(listKeysOptions *ListKeysOptions)`, func() { - version := "testString" - listKeysPath := "/keys" - 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(listKeysPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/keys?limit=20"}, "keys": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/keys?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) - })) - }) - It(`Invoke ListKeys 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 ListKeysOptions model - listKeysOptionsModel := new(vpcv1.ListKeysOptions) - listKeysOptionsModel.Start = core.StringPtr("testString") - listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listKeysOptionsModel.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.ListKeysWithContext(ctx, listKeysOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListKeys(listKeysOptionsModel) - 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.ListKeysWithContext(ctx, listKeysOptionsModel) - 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(listKeysPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/keys?limit=20"}, "keys": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/keys?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "total_count": 132}`) - })) - }) - It(`Invoke ListKeys 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.ListKeys(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListKeysOptions model - listKeysOptionsModel := new(vpcv1.ListKeysOptions) - listKeysOptionsModel.Start = core.StringPtr("testString") - listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listKeysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListKeys(listKeysOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListKeys 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 ListKeysOptions model - listKeysOptionsModel := new(vpcv1.ListKeysOptions) - listKeysOptionsModel.Start = core.StringPtr("testString") - listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listKeysOptionsModel.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.ListKeys(listKeysOptionsModel) - 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 ListKeys 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 ListKeysOptions model - listKeysOptionsModel := new(vpcv1.ListKeysOptions) - listKeysOptionsModel.Start = core.StringPtr("testString") - listKeysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listKeysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListKeys(listKeysOptionsModel) - 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.KeyCollection) - nextObject := new(vpcv1.KeyCollectionNext) - 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.KeyCollection) - - 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.KeyCollection) - nextObject := new(vpcv1.KeyCollectionNext) - 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(listKeysPath)) - 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,"keys":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","length":2048,"name":"my-key","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":"rsa"}],"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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803","fingerprint":"SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY","href":"https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803","id":"a6b1a881-2ce8-41a3-80fc-36316a73f803","length":2048,"name":"my-key","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":"rsa"}],"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use KeysPager.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()) - - listKeysOptionsModel := &vpcv1.ListKeysOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewKeysPager(listKeysOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.Key - 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 KeysPager.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()) - - listKeysOptionsModel := &vpcv1.ListKeysOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewKeysPager(listKeysOptionsModel) - 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(`CreateKey(createKeyOptions *CreateKeyOptions) - Operation response error`, func() { - version := "testString" - createKeyPath := "/keys" - 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(createKeyPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateKey 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateKeyOptions model - createKeyOptionsModel := new(vpcv1.CreateKeyOptions) - createKeyOptionsModel.PublicKey = core.StringPtr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En") - createKeyOptionsModel.Name = core.StringPtr("my-key") - createKeyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createKeyOptionsModel.Type = core.StringPtr("rsa") - createKeyOptionsModel.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.CreateKey(createKeyOptionsModel) - 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.CreateKey(createKeyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateKey(createKeyOptions *CreateKeyOptions)`, func() { - version := "testString" - createKeyPath := "/keys" - 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(createKeyPath)) - 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{"testString"})) - 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}`) - })) - }) - It(`Invoke CreateKey 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateKeyOptions model - createKeyOptionsModel := new(vpcv1.CreateKeyOptions) - createKeyOptionsModel.PublicKey = core.StringPtr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En") - createKeyOptionsModel.Name = core.StringPtr("my-key") - createKeyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createKeyOptionsModel.Type = core.StringPtr("rsa") - createKeyOptionsModel.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.CreateKeyWithContext(ctx, createKeyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateKey(createKeyOptionsModel) - 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.CreateKeyWithContext(ctx, createKeyOptionsModel) - 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(createKeyPath)) - 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{"testString"})) - 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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}`) - })) - }) - It(`Invoke CreateKey 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.CreateKey(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 CreateKeyOptions model - createKeyOptionsModel := new(vpcv1.CreateKeyOptions) - createKeyOptionsModel.PublicKey = core.StringPtr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En") - createKeyOptionsModel.Name = core.StringPtr("my-key") - createKeyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createKeyOptionsModel.Type = core.StringPtr("rsa") - createKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateKey(createKeyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateKey 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 CreateKeyOptions model - createKeyOptionsModel := new(vpcv1.CreateKeyOptions) - createKeyOptionsModel.PublicKey = core.StringPtr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En") - createKeyOptionsModel.Name = core.StringPtr("my-key") - createKeyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createKeyOptionsModel.Type = core.StringPtr("rsa") - createKeyOptionsModel.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.CreateKey(createKeyOptionsModel) - 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 CreateKeyOptions model with no property values - createKeyOptionsModelNew := new(vpcv1.CreateKeyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateKey(createKeyOptionsModelNew) - 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 CreateKey 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") - - // Construct an instance of the CreateKeyOptions model - createKeyOptionsModel := new(vpcv1.CreateKeyOptions) - createKeyOptionsModel.PublicKey = core.StringPtr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En") - createKeyOptionsModel.Name = core.StringPtr("my-key") - createKeyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createKeyOptionsModel.Type = core.StringPtr("rsa") - createKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateKey(createKeyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteKey(deleteKeyOptions *DeleteKeyOptions)`, func() { - version := "testString" - deleteKeyPath := "/keys/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(deleteKeyPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteKey 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.DeleteKey(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteKeyOptions model - deleteKeyOptionsModel := new(vpcv1.DeleteKeyOptions) - deleteKeyOptionsModel.ID = core.StringPtr("testString") - deleteKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteKey(deleteKeyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteKey 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 DeleteKeyOptions model - deleteKeyOptionsModel := new(vpcv1.DeleteKeyOptions) - deleteKeyOptionsModel.ID = core.StringPtr("testString") - deleteKeyOptionsModel.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.DeleteKey(deleteKeyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteKeyOptions model with no property values - deleteKeyOptionsModelNew := new(vpcv1.DeleteKeyOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteKey(deleteKeyOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetKey(getKeyOptions *GetKeyOptions) - Operation response error`, func() { - version := "testString" - getKeyPath := "/keys/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(getKeyPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetKey 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 GetKeyOptions model - getKeyOptionsModel := new(vpcv1.GetKeyOptions) - getKeyOptionsModel.ID = core.StringPtr("testString") - getKeyOptionsModel.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.GetKey(getKeyOptionsModel) - 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.GetKey(getKeyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetKey(getKeyOptions *GetKeyOptions)`, func() { - version := "testString" - getKeyPath := "/keys/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(getKeyPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}`) - })) - }) - It(`Invoke GetKey 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 GetKeyOptions model - getKeyOptionsModel := new(vpcv1.GetKeyOptions) - getKeyOptionsModel.ID = core.StringPtr("testString") - getKeyOptionsModel.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.GetKeyWithContext(ctx, getKeyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetKey(getKeyOptionsModel) - 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.GetKeyWithContext(ctx, getKeyOptionsModel) - 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(getKeyPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}`) - })) - }) - It(`Invoke GetKey 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.GetKey(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetKeyOptions model - getKeyOptionsModel := new(vpcv1.GetKeyOptions) - getKeyOptionsModel.ID = core.StringPtr("testString") - getKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetKey(getKeyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetKey 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 GetKeyOptions model - getKeyOptionsModel := new(vpcv1.GetKeyOptions) - getKeyOptionsModel.ID = core.StringPtr("testString") - getKeyOptionsModel.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.GetKey(getKeyOptionsModel) - 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 GetKeyOptions model with no property values - getKeyOptionsModelNew := new(vpcv1.GetKeyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetKey(getKeyOptionsModelNew) - 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 GetKey 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 GetKeyOptions model - getKeyOptionsModel := new(vpcv1.GetKeyOptions) - getKeyOptionsModel.ID = core.StringPtr("testString") - getKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetKey(getKeyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateKey(updateKeyOptions *UpdateKeyOptions) - Operation response error`, func() { - version := "testString" - updateKeyPath := "/keys/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(updateKeyPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateKey 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 KeyPatch model - keyPatchModel := new(vpcv1.KeyPatch) - keyPatchModel.Name = core.StringPtr("my-key") - keyPatchModelAsPatch, asPatchErr := keyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateKeyOptions model - updateKeyOptionsModel := new(vpcv1.UpdateKeyOptions) - updateKeyOptionsModel.ID = core.StringPtr("testString") - updateKeyOptionsModel.KeyPatch = keyPatchModelAsPatch - updateKeyOptionsModel.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.UpdateKey(updateKeyOptionsModel) - 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.UpdateKey(updateKeyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateKey(updateKeyOptions *UpdateKeyOptions)`, func() { - version := "testString" - updateKeyPath := "/keys/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(updateKeyPath)) - 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{"testString"})) - 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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}`) - })) - }) - It(`Invoke UpdateKey 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 KeyPatch model - keyPatchModel := new(vpcv1.KeyPatch) - keyPatchModel.Name = core.StringPtr("my-key") - keyPatchModelAsPatch, asPatchErr := keyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateKeyOptions model - updateKeyOptionsModel := new(vpcv1.UpdateKeyOptions) - updateKeyOptionsModel.ID = core.StringPtr("testString") - updateKeyOptionsModel.KeyPatch = keyPatchModelAsPatch - updateKeyOptionsModel.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.UpdateKeyWithContext(ctx, updateKeyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateKey(updateKeyOptionsModel) - 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.UpdateKeyWithContext(ctx, updateKeyOptionsModel) - 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(updateKeyPath)) - 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{"testString"})) - 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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY", "href": "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "length": 2048, "name": "my-key", "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": "rsa"}`) - })) - }) - It(`Invoke UpdateKey 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.UpdateKey(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the KeyPatch model - keyPatchModel := new(vpcv1.KeyPatch) - keyPatchModel.Name = core.StringPtr("my-key") - keyPatchModelAsPatch, asPatchErr := keyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateKeyOptions model - updateKeyOptionsModel := new(vpcv1.UpdateKeyOptions) - updateKeyOptionsModel.ID = core.StringPtr("testString") - updateKeyOptionsModel.KeyPatch = keyPatchModelAsPatch - updateKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateKey(updateKeyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateKey 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 KeyPatch model - keyPatchModel := new(vpcv1.KeyPatch) - keyPatchModel.Name = core.StringPtr("my-key") - keyPatchModelAsPatch, asPatchErr := keyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateKeyOptions model - updateKeyOptionsModel := new(vpcv1.UpdateKeyOptions) - updateKeyOptionsModel.ID = core.StringPtr("testString") - updateKeyOptionsModel.KeyPatch = keyPatchModelAsPatch - updateKeyOptionsModel.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.UpdateKey(updateKeyOptionsModel) - 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 UpdateKeyOptions model with no property values - updateKeyOptionsModelNew := new(vpcv1.UpdateKeyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateKey(updateKeyOptionsModelNew) - 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 UpdateKey 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 KeyPatch model - keyPatchModel := new(vpcv1.KeyPatch) - keyPatchModel.Name = core.StringPtr("my-key") - keyPatchModelAsPatch, asPatchErr := keyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateKeyOptions model - updateKeyOptionsModel := new(vpcv1.UpdateKeyOptions) - updateKeyOptionsModel.ID = core.StringPtr("testString") - updateKeyOptionsModel.KeyPatch = keyPatchModelAsPatch - updateKeyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateKey(updateKeyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) - Operation response error`, func() { - version := "testString" - listInstanceProfilesPath := "/instance/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(listInstanceProfilesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListInstanceProfiles 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 ListInstanceProfilesOptions model - listInstanceProfilesOptionsModel := new(vpcv1.ListInstanceProfilesOptions) - listInstanceProfilesOptionsModel.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.ListInstanceProfiles(listInstanceProfilesOptionsModel) - 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.ListInstanceProfiles(listInstanceProfilesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions)`, func() { - version := "testString" - listInstanceProfilesPath := "/instance/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(listInstanceProfilesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "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", "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}]}`) - })) - }) - It(`Invoke ListInstanceProfiles 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 ListInstanceProfilesOptions model - listInstanceProfilesOptionsModel := new(vpcv1.ListInstanceProfilesOptions) - listInstanceProfilesOptionsModel.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.ListInstanceProfilesWithContext(ctx, listInstanceProfilesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceProfiles(listInstanceProfilesOptionsModel) - 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.ListInstanceProfilesWithContext(ctx, listInstanceProfilesOptionsModel) - 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(listInstanceProfilesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"profiles": [{"bandwidth": {"type": "fixed", "value": 20000}, "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", "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}]}`) - })) - }) - It(`Invoke ListInstanceProfiles 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.ListInstanceProfiles(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListInstanceProfilesOptions model - listInstanceProfilesOptionsModel := new(vpcv1.ListInstanceProfilesOptions) - listInstanceProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceProfiles(listInstanceProfilesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListInstanceProfiles 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 ListInstanceProfilesOptions model - listInstanceProfilesOptionsModel := new(vpcv1.ListInstanceProfilesOptions) - listInstanceProfilesOptionsModel.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.ListInstanceProfiles(listInstanceProfilesOptionsModel) - 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 ListInstanceProfiles 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 ListInstanceProfilesOptions model - listInstanceProfilesOptionsModel := new(vpcv1.ListInstanceProfilesOptions) - listInstanceProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListInstanceProfiles(listInstanceProfilesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) - Operation response error`, func() { - version := "testString" - getInstanceProfilePath := "/instance/profiles/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(getInstanceProfilePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetInstanceProfile 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 GetInstanceProfileOptions model - getInstanceProfileOptionsModel := new(vpcv1.GetInstanceProfileOptions) - getInstanceProfileOptionsModel.Name = core.StringPtr("testString") - getInstanceProfileOptionsModel.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.GetInstanceProfile(getInstanceProfileOptionsModel) - 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.GetInstanceProfile(getInstanceProfileOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions)`, func() { - version := "testString" - getInstanceProfilePath := "/instance/profiles/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(getInstanceProfilePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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}, "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", "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}`) - })) - }) - It(`Invoke GetInstanceProfile 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 GetInstanceProfileOptions model - getInstanceProfileOptionsModel := new(vpcv1.GetInstanceProfileOptions) - getInstanceProfileOptionsModel.Name = core.StringPtr("testString") - getInstanceProfileOptionsModel.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.GetInstanceProfileWithContext(ctx, getInstanceProfileOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceProfile(getInstanceProfileOptionsModel) - 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.GetInstanceProfileWithContext(ctx, getInstanceProfileOptionsModel) - 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(getInstanceProfilePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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}, "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", "os_architecture": {"default": "Default", "type": "enum", "values": ["amd64"]}, "port_speed": {"type": "fixed", "value": 1000}, "total_volume_bandwidth": {"type": "fixed", "value": 20000}, "vcpu_architecture": {"default": "Default", "type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}`) - })) - }) - It(`Invoke GetInstanceProfile 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.GetInstanceProfile(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetInstanceProfileOptions model - getInstanceProfileOptionsModel := new(vpcv1.GetInstanceProfileOptions) - getInstanceProfileOptionsModel.Name = core.StringPtr("testString") - getInstanceProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceProfile(getInstanceProfileOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetInstanceProfile 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 GetInstanceProfileOptions model - getInstanceProfileOptionsModel := new(vpcv1.GetInstanceProfileOptions) - getInstanceProfileOptionsModel.Name = core.StringPtr("testString") - getInstanceProfileOptionsModel.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.GetInstanceProfile(getInstanceProfileOptionsModel) - 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 GetInstanceProfileOptions model with no property values - getInstanceProfileOptionsModelNew := new(vpcv1.GetInstanceProfileOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceProfile(getInstanceProfileOptionsModelNew) - 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 GetInstanceProfile 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 GetInstanceProfileOptions model - getInstanceProfileOptionsModel := new(vpcv1.GetInstanceProfileOptions) - getInstanceProfileOptionsModel.Name = core.StringPtr("testString") - getInstanceProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetInstanceProfile(getInstanceProfileOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) - Operation response error`, func() { - version := "testString" - listInstanceTemplatesPath := "/instance/templates" - 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(listInstanceTemplatesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListInstanceTemplates 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 ListInstanceTemplatesOptions model - listInstanceTemplatesOptionsModel := new(vpcv1.ListInstanceTemplatesOptions) - listInstanceTemplatesOptionsModel.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.ListInstanceTemplates(listInstanceTemplatesOptionsModel) - 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.ListInstanceTemplates(listInstanceTemplatesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions)`, func() { - version := "testString" - listInstanceTemplatesPath := "/instance/templates" - 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(listInstanceTemplatesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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": "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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}], "total_count": 132}`) - })) - }) - It(`Invoke ListInstanceTemplates 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 ListInstanceTemplatesOptions model - listInstanceTemplatesOptionsModel := new(vpcv1.ListInstanceTemplatesOptions) - listInstanceTemplatesOptionsModel.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.ListInstanceTemplatesWithContext(ctx, listInstanceTemplatesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstanceTemplates(listInstanceTemplatesOptionsModel) - 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.ListInstanceTemplatesWithContext(ctx, listInstanceTemplatesOptionsModel) - 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(listInstanceTemplatesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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": "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"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}], "total_count": 132}`) - })) - }) - It(`Invoke ListInstanceTemplates 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.ListInstanceTemplates(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListInstanceTemplatesOptions model - listInstanceTemplatesOptionsModel := new(vpcv1.ListInstanceTemplatesOptions) - listInstanceTemplatesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceTemplates(listInstanceTemplatesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListInstanceTemplates 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 ListInstanceTemplatesOptions model - listInstanceTemplatesOptionsModel := new(vpcv1.ListInstanceTemplatesOptions) - listInstanceTemplatesOptionsModel.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.ListInstanceTemplates(listInstanceTemplatesOptionsModel) - 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 ListInstanceTemplates 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 ListInstanceTemplatesOptions model - listInstanceTemplatesOptionsModel := new(vpcv1.ListInstanceTemplatesOptions) - listInstanceTemplatesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListInstanceTemplates(listInstanceTemplatesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions) - Operation response error`, func() { - version := "testString" - createInstanceTemplatePath := "/instance/templates" - 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(createInstanceTemplatePath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateInstanceTemplate 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 InstanceAvailabilityPrototype model - instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) - instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) - trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") - - // Construct an instance of the InstanceDefaultTrustedProfilePrototype model - instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) - instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) - instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") - - // Construct an instance of the InstanceMetadataServicePrototype model - instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) - instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) - - // 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 NetworkInterfacePrototype model - networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) - networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - networkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the InstanceProfileIdentityByName model - instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) - instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") - - // 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("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the VolumeAttachmentPrototype model - volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) - volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("dc201ab2-8536-4904-86a8-084d84582133") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - - // Construct an instance of the VolumePrototypeInstanceByImageContext model - volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) - volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) - volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel - volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") - volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel - volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} - - // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model - volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) - volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("3f9a2d96-830e-4100-9b4c-663225a3f872") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the InstanceTemplatePrototypeInstanceByImage model - instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceByImage) - instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel - instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel - instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - instanceTemplatePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel - instanceTemplatePrototypeModel.Name = core.StringPtr("my-instance-template") - instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} - instanceTemplatePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel - instanceTemplatePrototypeModel.Profile = instanceProfileIdentityModel - instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel - instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") - instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} - instanceTemplatePrototypeModel.VPC = vpcIdentityModel - instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel - instanceTemplatePrototypeModel.Image = imageIdentityModel - instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel - instanceTemplatePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateInstanceTemplateOptions model - createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) - createInstanceTemplateOptionsModel.InstanceTemplatePrototype = instanceTemplatePrototypeModel - createInstanceTemplateOptionsModel.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.CreateInstanceTemplate(createInstanceTemplateOptionsModel) - 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.CreateInstanceTemplate(createInstanceTemplateOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions)`, func() { - version := "testString" - createInstanceTemplatePath := "/instance/templates" - 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(createInstanceTemplatePath)) - 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{"testString"})) - 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", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) - })) - }) - It(`Invoke CreateInstanceTemplate 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 InstanceAvailabilityPrototype model - instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) - instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) - trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") - - // Construct an instance of the InstanceDefaultTrustedProfilePrototype model - instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) - instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) - instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") - - // Construct an instance of the InstanceMetadataServicePrototype model - instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) - instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) - - // 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 NetworkInterfacePrototype model - networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) - networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - networkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the InstanceProfileIdentityByName model - instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) - instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") - - // 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("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the VolumeAttachmentPrototype model - volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) - volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("dc201ab2-8536-4904-86a8-084d84582133") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - - // Construct an instance of the VolumePrototypeInstanceByImageContext model - volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) - volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) - volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel - volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") - volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel - volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} - - // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model - volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) - volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("3f9a2d96-830e-4100-9b4c-663225a3f872") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the InstanceTemplatePrototypeInstanceByImage model - instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceByImage) - instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel - instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel - instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - instanceTemplatePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel - instanceTemplatePrototypeModel.Name = core.StringPtr("my-instance-template") - instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} - instanceTemplatePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel - instanceTemplatePrototypeModel.Profile = instanceProfileIdentityModel - instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel - instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") - instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} - instanceTemplatePrototypeModel.VPC = vpcIdentityModel - instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel - instanceTemplatePrototypeModel.Image = imageIdentityModel - instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel - instanceTemplatePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateInstanceTemplateOptions model - createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) - createInstanceTemplateOptionsModel.InstanceTemplatePrototype = instanceTemplatePrototypeModel - createInstanceTemplateOptionsModel.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.CreateInstanceTemplateWithContext(ctx, createInstanceTemplateOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceTemplate(createInstanceTemplateOptionsModel) - 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.CreateInstanceTemplateWithContext(ctx, createInstanceTemplateOptionsModel) - 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(createInstanceTemplatePath)) - 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{"testString"})) - 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", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) - })) - }) - It(`Invoke CreateInstanceTemplate 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.CreateInstanceTemplate(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the InstanceAvailabilityPrototype model - instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) - instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) - trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") - - // Construct an instance of the InstanceDefaultTrustedProfilePrototype model - instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) - instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) - instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") - - // Construct an instance of the InstanceMetadataServicePrototype model - instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) - instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) - - // 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 NetworkInterfacePrototype model - networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) - networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - networkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the InstanceProfileIdentityByName model - instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) - instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") - - // 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("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the VolumeAttachmentPrototype model - volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) - volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("dc201ab2-8536-4904-86a8-084d84582133") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - - // Construct an instance of the VolumePrototypeInstanceByImageContext model - volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) - volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) - volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel - volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") - volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel - volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} - - // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model - volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) - volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("3f9a2d96-830e-4100-9b4c-663225a3f872") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the InstanceTemplatePrototypeInstanceByImage model - instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceByImage) - instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel - instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel - instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - instanceTemplatePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel - instanceTemplatePrototypeModel.Name = core.StringPtr("my-instance-template") - instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} - instanceTemplatePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel - instanceTemplatePrototypeModel.Profile = instanceProfileIdentityModel - instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel - instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") - instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} - instanceTemplatePrototypeModel.VPC = vpcIdentityModel - instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel - instanceTemplatePrototypeModel.Image = imageIdentityModel - instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel - instanceTemplatePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateInstanceTemplateOptions model - createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) - createInstanceTemplateOptionsModel.InstanceTemplatePrototype = instanceTemplatePrototypeModel - createInstanceTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceTemplate(createInstanceTemplateOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateInstanceTemplate 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 InstanceAvailabilityPrototype model - instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) - instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) - trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") - - // Construct an instance of the InstanceDefaultTrustedProfilePrototype model - instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) - instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) - instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") - - // Construct an instance of the InstanceMetadataServicePrototype model - instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) - instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) - - // 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 NetworkInterfacePrototype model - networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) - networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - networkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the InstanceProfileIdentityByName model - instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) - instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") - - // 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("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the VolumeAttachmentPrototype model - volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) - volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("dc201ab2-8536-4904-86a8-084d84582133") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - - // Construct an instance of the VolumePrototypeInstanceByImageContext model - volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) - volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) - volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel - volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") - volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel - volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} - - // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model - volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) - volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("3f9a2d96-830e-4100-9b4c-663225a3f872") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the InstanceTemplatePrototypeInstanceByImage model - instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceByImage) - instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel - instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel - instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - instanceTemplatePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel - instanceTemplatePrototypeModel.Name = core.StringPtr("my-instance-template") - instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} - instanceTemplatePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel - instanceTemplatePrototypeModel.Profile = instanceProfileIdentityModel - instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel - instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") - instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} - instanceTemplatePrototypeModel.VPC = vpcIdentityModel - instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel - instanceTemplatePrototypeModel.Image = imageIdentityModel - instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel - instanceTemplatePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateInstanceTemplateOptions model - createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) - createInstanceTemplateOptionsModel.InstanceTemplatePrototype = instanceTemplatePrototypeModel - createInstanceTemplateOptionsModel.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.CreateInstanceTemplate(createInstanceTemplateOptionsModel) - 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 CreateInstanceTemplateOptions model with no property values - createInstanceTemplateOptionsModelNew := new(vpcv1.CreateInstanceTemplateOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceTemplate(createInstanceTemplateOptionsModelNew) - 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 CreateInstanceTemplate 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 InstanceAvailabilityPrototype model - instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) - instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) - trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") - - // Construct an instance of the InstanceDefaultTrustedProfilePrototype model - instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) - instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) - instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") - - // Construct an instance of the InstanceMetadataServicePrototype model - instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) - instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) - - // 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 NetworkInterfacePrototype model - networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) - networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - networkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the InstanceProfileIdentityByName model - instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) - instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") - - // 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("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the VolumeAttachmentPrototype model - volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) - volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("dc201ab2-8536-4904-86a8-084d84582133") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - - // Construct an instance of the VolumePrototypeInstanceByImageContext model - volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) - volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) - volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel - volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") - volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel - volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} - - // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model - volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) - volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("3f9a2d96-830e-4100-9b4c-663225a3f872") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the InstanceTemplatePrototypeInstanceByImage model - instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceByImage) - instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel - instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel - instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - instanceTemplatePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel - instanceTemplatePrototypeModel.Name = core.StringPtr("my-instance-template") - instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} - instanceTemplatePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel - instanceTemplatePrototypeModel.Profile = instanceProfileIdentityModel - instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel - instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") - instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} - instanceTemplatePrototypeModel.VPC = vpcIdentityModel - instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel - instanceTemplatePrototypeModel.Image = imageIdentityModel - instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel - instanceTemplatePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateInstanceTemplateOptions model - createInstanceTemplateOptionsModel := new(vpcv1.CreateInstanceTemplateOptions) - createInstanceTemplateOptionsModel.InstanceTemplatePrototype = instanceTemplatePrototypeModel - createInstanceTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateInstanceTemplate(createInstanceTemplateOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions)`, func() { - version := "testString" - deleteInstanceTemplatePath := "/instance/templates/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(deleteInstanceTemplatePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteInstanceTemplate 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.DeleteInstanceTemplate(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteInstanceTemplateOptions model - deleteInstanceTemplateOptionsModel := new(vpcv1.DeleteInstanceTemplateOptions) - deleteInstanceTemplateOptionsModel.ID = core.StringPtr("testString") - deleteInstanceTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceTemplate(deleteInstanceTemplateOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteInstanceTemplate 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 DeleteInstanceTemplateOptions model - deleteInstanceTemplateOptionsModel := new(vpcv1.DeleteInstanceTemplateOptions) - deleteInstanceTemplateOptionsModel.ID = core.StringPtr("testString") - deleteInstanceTemplateOptionsModel.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.DeleteInstanceTemplate(deleteInstanceTemplateOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceTemplateOptions model with no property values - deleteInstanceTemplateOptionsModelNew := new(vpcv1.DeleteInstanceTemplateOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceTemplate(deleteInstanceTemplateOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) - Operation response error`, func() { - version := "testString" - getInstanceTemplatePath := "/instance/templates/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(getInstanceTemplatePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetInstanceTemplate 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 GetInstanceTemplateOptions model - getInstanceTemplateOptionsModel := new(vpcv1.GetInstanceTemplateOptions) - getInstanceTemplateOptionsModel.ID = core.StringPtr("testString") - getInstanceTemplateOptionsModel.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.GetInstanceTemplate(getInstanceTemplateOptionsModel) - 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.GetInstanceTemplate(getInstanceTemplateOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions)`, func() { - version := "testString" - getInstanceTemplatePath := "/instance/templates/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(getInstanceTemplatePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) - })) - }) - It(`Invoke GetInstanceTemplate 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 GetInstanceTemplateOptions model - getInstanceTemplateOptionsModel := new(vpcv1.GetInstanceTemplateOptions) - getInstanceTemplateOptionsModel.ID = core.StringPtr("testString") - getInstanceTemplateOptionsModel.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.GetInstanceTemplateWithContext(ctx, getInstanceTemplateOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceTemplate(getInstanceTemplateOptionsModel) - 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.GetInstanceTemplateWithContext(ctx, getInstanceTemplateOptionsModel) - 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(getInstanceTemplatePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) - })) - }) - It(`Invoke GetInstanceTemplate 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.GetInstanceTemplate(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetInstanceTemplateOptions model - getInstanceTemplateOptionsModel := new(vpcv1.GetInstanceTemplateOptions) - getInstanceTemplateOptionsModel.ID = core.StringPtr("testString") - getInstanceTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceTemplate(getInstanceTemplateOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetInstanceTemplate 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 GetInstanceTemplateOptions model - getInstanceTemplateOptionsModel := new(vpcv1.GetInstanceTemplateOptions) - getInstanceTemplateOptionsModel.ID = core.StringPtr("testString") - getInstanceTemplateOptionsModel.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.GetInstanceTemplate(getInstanceTemplateOptionsModel) - 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 GetInstanceTemplateOptions model with no property values - getInstanceTemplateOptionsModelNew := new(vpcv1.GetInstanceTemplateOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceTemplate(getInstanceTemplateOptionsModelNew) - 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 GetInstanceTemplate 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 GetInstanceTemplateOptions model - getInstanceTemplateOptionsModel := new(vpcv1.GetInstanceTemplateOptions) - getInstanceTemplateOptionsModel.ID = core.StringPtr("testString") - getInstanceTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetInstanceTemplate(getInstanceTemplateOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) - Operation response error`, func() { - version := "testString" - updateInstanceTemplatePath := "/instance/templates/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(updateInstanceTemplatePath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateInstanceTemplate 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 InstanceTemplatePatch model - instanceTemplatePatchModel := new(vpcv1.InstanceTemplatePatch) - instanceTemplatePatchModel.Name = core.StringPtr("my-instance-template") - instanceTemplatePatchModelAsPatch, asPatchErr := instanceTemplatePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceTemplateOptions model - updateInstanceTemplateOptionsModel := new(vpcv1.UpdateInstanceTemplateOptions) - updateInstanceTemplateOptionsModel.ID = core.StringPtr("testString") - updateInstanceTemplateOptionsModel.InstanceTemplatePatch = instanceTemplatePatchModelAsPatch - updateInstanceTemplateOptionsModel.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.UpdateInstanceTemplate(updateInstanceTemplateOptionsModel) - 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.UpdateInstanceTemplate(updateInstanceTemplateOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions)`, func() { - version := "testString" - updateInstanceTemplatePath := "/instance/templates/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(updateInstanceTemplatePath)) - 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{"testString"})) - 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", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) - })) - }) - It(`Invoke UpdateInstanceTemplate 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 InstanceTemplatePatch model - instanceTemplatePatchModel := new(vpcv1.InstanceTemplatePatch) - instanceTemplatePatchModel.Name = core.StringPtr("my-instance-template") - instanceTemplatePatchModelAsPatch, asPatchErr := instanceTemplatePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceTemplateOptions model - updateInstanceTemplateOptionsModel := new(vpcv1.UpdateInstanceTemplateOptions) - updateInstanceTemplateOptionsModel.ID = core.StringPtr("testString") - updateInstanceTemplateOptionsModel.InstanceTemplatePatch = instanceTemplatePatchModelAsPatch - updateInstanceTemplateOptionsModel.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.UpdateInstanceTemplateWithContext(ctx, updateInstanceTemplateOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceTemplate(updateInstanceTemplateOptionsModel) - 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.UpdateInstanceTemplateWithContext(ctx, updateInstanceTemplateOptionsModel) - 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(updateInstanceTemplatePath)) - 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{"testString"})) - 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", `{"availability_policy": {"host_failure": "restart"}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a", "default_trusted_profile": {"auto_link": false, "target": {"id": "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5"}}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "keys": [{"id": "a6b1a881-2ce8-41a3-80fc-36316a73f803"}], "metadata_service": {"enabled": false}, "name": "my-instance-template", "network_interfaces": [{"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}], "placement_target": {"id": "1e09281b-f177-46fb-baf1-bc152b2e391a"}, "profile": {"name": "bx2-4x16"}, "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": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5"}}], "vpc": {"id": "4727d842-f94f-4a2d-824a-9bc9b02c523b"}, "boot_volume_attachment": {"delete_volume_on_instance_delete": true, "name": "my-volume-attachment", "volume": {"capacity": 250, "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"}, "iops": 10000, "name": "my-volume", "profile": {"name": "general-purpose"}, "user_tags": ["UserTags"]}}, "image": {"id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"}, "primary_network_interface": {"allow_ip_spoofing": true, "name": "my-network-interface", "primary_ip": {"id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb"}, "security_groups": [{"id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271"}], "subnet": {"id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e"}}, "zone": {"name": "us-south-1"}}`) - })) - }) - It(`Invoke UpdateInstanceTemplate 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.UpdateInstanceTemplate(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the InstanceTemplatePatch model - instanceTemplatePatchModel := new(vpcv1.InstanceTemplatePatch) - instanceTemplatePatchModel.Name = core.StringPtr("my-instance-template") - instanceTemplatePatchModelAsPatch, asPatchErr := instanceTemplatePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceTemplateOptions model - updateInstanceTemplateOptionsModel := new(vpcv1.UpdateInstanceTemplateOptions) - updateInstanceTemplateOptionsModel.ID = core.StringPtr("testString") - updateInstanceTemplateOptionsModel.InstanceTemplatePatch = instanceTemplatePatchModelAsPatch - updateInstanceTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceTemplate(updateInstanceTemplateOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateInstanceTemplate 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 InstanceTemplatePatch model - instanceTemplatePatchModel := new(vpcv1.InstanceTemplatePatch) - instanceTemplatePatchModel.Name = core.StringPtr("my-instance-template") - instanceTemplatePatchModelAsPatch, asPatchErr := instanceTemplatePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceTemplateOptions model - updateInstanceTemplateOptionsModel := new(vpcv1.UpdateInstanceTemplateOptions) - updateInstanceTemplateOptionsModel.ID = core.StringPtr("testString") - updateInstanceTemplateOptionsModel.InstanceTemplatePatch = instanceTemplatePatchModelAsPatch - updateInstanceTemplateOptionsModel.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.UpdateInstanceTemplate(updateInstanceTemplateOptionsModel) - 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 UpdateInstanceTemplateOptions model with no property values - updateInstanceTemplateOptionsModelNew := new(vpcv1.UpdateInstanceTemplateOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceTemplate(updateInstanceTemplateOptionsModelNew) - 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 UpdateInstanceTemplate 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 InstanceTemplatePatch model - instanceTemplatePatchModel := new(vpcv1.InstanceTemplatePatch) - instanceTemplatePatchModel.Name = core.StringPtr("my-instance-template") - instanceTemplatePatchModelAsPatch, asPatchErr := instanceTemplatePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceTemplateOptions model - updateInstanceTemplateOptionsModel := new(vpcv1.UpdateInstanceTemplateOptions) - updateInstanceTemplateOptionsModel.ID = core.StringPtr("testString") - updateInstanceTemplateOptionsModel.InstanceTemplatePatch = instanceTemplatePatchModelAsPatch - updateInstanceTemplateOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceTemplate(updateInstanceTemplateOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstances(listInstancesOptions *ListInstancesOptions) - Operation response error`, func() { - version := "testString" - listInstancesPath := "/instances" - 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(listInstancesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["dedicated_host.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["dedicated_host.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["dedicated_host.name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["placement_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["placement_group.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["placement_group.name"]).To(Equal([]string{"testString"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListInstances 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 ListInstancesOptions model - listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) - listInstancesOptionsModel.Start = core.StringPtr("testString") - listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listInstancesOptionsModel.Name = core.StringPtr("testString") - listInstancesOptionsModel.VPCID = core.StringPtr("testString") - listInstancesOptionsModel.VPCCRN = core.StringPtr("testString") - listInstancesOptionsModel.VPCName = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostName = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupID = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupCRN = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupName = core.StringPtr("testString") - listInstancesOptionsModel.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.ListInstances(listInstancesOptionsModel) - 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.ListInstances(listInstancesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstances(listInstancesOptions *ListInstancesOptions)`, func() { - version := "testString" - listInstancesPath := "/instances" - 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(listInstancesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["dedicated_host.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["dedicated_host.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["dedicated_host.name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["placement_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["placement_group.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["placement_group.name"]).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/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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) - })) - }) - It(`Invoke ListInstances 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 ListInstancesOptions model - listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) - listInstancesOptionsModel.Start = core.StringPtr("testString") - listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listInstancesOptionsModel.Name = core.StringPtr("testString") - listInstancesOptionsModel.VPCID = core.StringPtr("testString") - listInstancesOptionsModel.VPCCRN = core.StringPtr("testString") - listInstancesOptionsModel.VPCName = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostName = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupID = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupCRN = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupName = core.StringPtr("testString") - listInstancesOptionsModel.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.ListInstancesWithContext(ctx, listInstancesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListInstances(listInstancesOptionsModel) - 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.ListInstancesWithContext(ctx, listInstancesOptionsModel) - 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(listInstancesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["dedicated_host.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["dedicated_host.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["dedicated_host.name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["placement_group.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["placement_group.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["placement_group.name"]).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/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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) - })) - }) - It(`Invoke ListInstances 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.ListInstances(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListInstancesOptions model - listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) - listInstancesOptionsModel.Start = core.StringPtr("testString") - listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listInstancesOptionsModel.Name = core.StringPtr("testString") - listInstancesOptionsModel.VPCID = core.StringPtr("testString") - listInstancesOptionsModel.VPCCRN = core.StringPtr("testString") - listInstancesOptionsModel.VPCName = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostName = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupID = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupCRN = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupName = core.StringPtr("testString") - listInstancesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstances(listInstancesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListInstances 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 ListInstancesOptions model - listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) - listInstancesOptionsModel.Start = core.StringPtr("testString") - listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listInstancesOptionsModel.Name = core.StringPtr("testString") - listInstancesOptionsModel.VPCID = core.StringPtr("testString") - listInstancesOptionsModel.VPCCRN = core.StringPtr("testString") - listInstancesOptionsModel.VPCName = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostName = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupID = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupCRN = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupName = core.StringPtr("testString") - listInstancesOptionsModel.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.ListInstances(listInstancesOptionsModel) - 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 ListInstances 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 ListInstancesOptions model - listInstancesOptionsModel := new(vpcv1.ListInstancesOptions) - listInstancesOptionsModel.Start = core.StringPtr("testString") - listInstancesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listInstancesOptionsModel.ResourceGroupID = core.StringPtr("testString") - listInstancesOptionsModel.Name = core.StringPtr("testString") - listInstancesOptionsModel.VPCID = core.StringPtr("testString") - listInstancesOptionsModel.VPCCRN = core.StringPtr("testString") - listInstancesOptionsModel.VPCName = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostID = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostCRN = core.StringPtr("testString") - listInstancesOptionsModel.DedicatedHostName = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupID = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupCRN = core.StringPtr("testString") - listInstancesOptionsModel.PlacementGroupName = core.StringPtr("testString") - listInstancesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListInstances(listInstancesOptionsModel) - 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.InstanceCollection) - nextObject := new(vpcv1.InstanceCollectionNext) - 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.InstanceCollection) - - 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.InstanceCollection) - nextObject := new(vpcv1.InstanceCollectionNext) - 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(listInstancesPath)) - 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"},"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}},"catalog_offering":{"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"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}],"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-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":8,"metadata_service":{"enabled":false},"name":"my-instance","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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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_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},"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}},"catalog_offering":{"version":{"crn":"crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a","dedicated_host":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"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}],"gpu":{"count":1,"manufacturer":"nvidia","memory":1,"model":"Tesla V100"},"href":"https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-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":8,"metadata_service":{"enabled":false},"name":"my-instance","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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"placement_target":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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_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},"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","name":"my-volume-attachment","volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"}}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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 InstancesPager.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()) - - listInstancesOptionsModel := &vpcv1.ListInstancesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - VPCID: core.StringPtr("testString"), - VPCCRN: core.StringPtr("testString"), - VPCName: core.StringPtr("testString"), - DedicatedHostID: core.StringPtr("testString"), - DedicatedHostCRN: core.StringPtr("testString"), - DedicatedHostName: core.StringPtr("testString"), - PlacementGroupID: core.StringPtr("testString"), - PlacementGroupCRN: core.StringPtr("testString"), - PlacementGroupName: core.StringPtr("testString"), - } - - pager, err := vpcService.NewInstancesPager(listInstancesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.Instance - 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 InstancesPager.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()) - - listInstancesOptionsModel := &vpcv1.ListInstancesOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - VPCID: core.StringPtr("testString"), - VPCCRN: core.StringPtr("testString"), - VPCName: core.StringPtr("testString"), - DedicatedHostID: core.StringPtr("testString"), - DedicatedHostCRN: core.StringPtr("testString"), - DedicatedHostName: core.StringPtr("testString"), - PlacementGroupID: core.StringPtr("testString"), - PlacementGroupCRN: core.StringPtr("testString"), - PlacementGroupName: core.StringPtr("testString"), - } - - pager, err := vpcService.NewInstancesPager(listInstancesOptionsModel) - 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(`CreateInstance(createInstanceOptions *CreateInstanceOptions) - Operation response error`, func() { - version := "testString" - createInstancePath := "/instances" - 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(createInstancePath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateInstance 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 InstanceAvailabilityPrototype model - instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) - instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) - trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") - - // Construct an instance of the InstanceDefaultTrustedProfilePrototype model - instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) - instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) - instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") - - // Construct an instance of the InstanceMetadataServicePrototype model - instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) - instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) - - // 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 NetworkInterfacePrototype model - networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) - networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - networkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPrototypeModel.ID = core.StringPtr("0787-8c2a09be-ee18-4af2-8ef4-6a6060732221") - - // Construct an instance of the InstanceProfileIdentityByName model - instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) - instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") - - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) - volumeAttachmentPrototypeVolumeModel.Iops = core.Int64Ptr(int64(10000)) - volumeAttachmentPrototypeVolumeModel.Name = core.StringPtr("my-data-volume") - volumeAttachmentPrototypeVolumeModel.Profile = volumeProfileIdentityModel - volumeAttachmentPrototypeVolumeModel.UserTags = []string{"testString"} - volumeAttachmentPrototypeVolumeModel.Capacity = core.Int64Ptr(int64(1000)) - volumeAttachmentPrototypeVolumeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the VolumeAttachmentPrototype model - volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) - volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") - - // Construct an instance of the VolumePrototypeInstanceByImageContext model - volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) - volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) - volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel - volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") - volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel - volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} - - // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model - volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) - volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("9aaf3bcb-dcd7-4de7-bb60-24e39ff9d366") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the InstancePrototypeInstanceByImage model - instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) - instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel - instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel - instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - instancePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel - instancePrototypeModel.Name = core.StringPtr("my-instance") - instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} - instancePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel - instancePrototypeModel.Profile = instanceProfileIdentityModel - instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel - instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instancePrototypeModel.UserData = core.StringPtr("testString") - instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} - instancePrototypeModel.VPC = vpcIdentityModel - instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel - instancePrototypeModel.Image = imageIdentityModel - instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel - instancePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateInstanceOptions model - createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) - createInstanceOptionsModel.InstancePrototype = instancePrototypeModel - createInstanceOptionsModel.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.CreateInstance(createInstanceOptionsModel) - 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.CreateInstance(createInstanceOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstance(createInstanceOptions *CreateInstanceOptions)`, func() { - version := "testString" - createInstancePath := "/instances" - 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(createInstancePath)) - 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{"testString"})) - 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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 InstanceAvailabilityPrototype model - instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) - instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) - trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") - - // Construct an instance of the InstanceDefaultTrustedProfilePrototype model - instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) - instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) - instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") - - // Construct an instance of the InstanceMetadataServicePrototype model - instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) - instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) - - // 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 NetworkInterfacePrototype model - networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) - networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - networkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPrototypeModel.ID = core.StringPtr("0787-8c2a09be-ee18-4af2-8ef4-6a6060732221") - - // Construct an instance of the InstanceProfileIdentityByName model - instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) - instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") - - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) - volumeAttachmentPrototypeVolumeModel.Iops = core.Int64Ptr(int64(10000)) - volumeAttachmentPrototypeVolumeModel.Name = core.StringPtr("my-data-volume") - volumeAttachmentPrototypeVolumeModel.Profile = volumeProfileIdentityModel - volumeAttachmentPrototypeVolumeModel.UserTags = []string{"testString"} - volumeAttachmentPrototypeVolumeModel.Capacity = core.Int64Ptr(int64(1000)) - volumeAttachmentPrototypeVolumeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the VolumeAttachmentPrototype model - volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) - volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") - - // Construct an instance of the VolumePrototypeInstanceByImageContext model - volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) - volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) - volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel - volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") - volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel - volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} - - // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model - volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) - volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("9aaf3bcb-dcd7-4de7-bb60-24e39ff9d366") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the InstancePrototypeInstanceByImage model - instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) - instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel - instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel - instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - instancePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel - instancePrototypeModel.Name = core.StringPtr("my-instance") - instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} - instancePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel - instancePrototypeModel.Profile = instanceProfileIdentityModel - instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel - instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instancePrototypeModel.UserData = core.StringPtr("testString") - instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} - instancePrototypeModel.VPC = vpcIdentityModel - instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel - instancePrototypeModel.Image = imageIdentityModel - instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel - instancePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateInstanceOptions model - createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) - createInstanceOptionsModel.InstancePrototype = instancePrototypeModel - createInstanceOptionsModel.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.CreateInstanceWithContext(ctx, createInstanceOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstance(createInstanceOptionsModel) - 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.CreateInstanceWithContext(ctx, createInstanceOptionsModel) - 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(createInstancePath)) - 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{"testString"})) - 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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.CreateInstance(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the InstanceAvailabilityPrototype model - instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) - instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) - trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") - - // Construct an instance of the InstanceDefaultTrustedProfilePrototype model - instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) - instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) - instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") - - // Construct an instance of the InstanceMetadataServicePrototype model - instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) - instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) - - // 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 NetworkInterfacePrototype model - networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) - networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - networkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPrototypeModel.ID = core.StringPtr("0787-8c2a09be-ee18-4af2-8ef4-6a6060732221") - - // Construct an instance of the InstanceProfileIdentityByName model - instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) - instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") - - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) - volumeAttachmentPrototypeVolumeModel.Iops = core.Int64Ptr(int64(10000)) - volumeAttachmentPrototypeVolumeModel.Name = core.StringPtr("my-data-volume") - volumeAttachmentPrototypeVolumeModel.Profile = volumeProfileIdentityModel - volumeAttachmentPrototypeVolumeModel.UserTags = []string{"testString"} - volumeAttachmentPrototypeVolumeModel.Capacity = core.Int64Ptr(int64(1000)) - volumeAttachmentPrototypeVolumeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the VolumeAttachmentPrototype model - volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) - volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") - - // Construct an instance of the VolumePrototypeInstanceByImageContext model - volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) - volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) - volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel - volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") - volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel - volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} - - // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model - volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) - volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("9aaf3bcb-dcd7-4de7-bb60-24e39ff9d366") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the InstancePrototypeInstanceByImage model - instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) - instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel - instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel - instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - instancePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel - instancePrototypeModel.Name = core.StringPtr("my-instance") - instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} - instancePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel - instancePrototypeModel.Profile = instanceProfileIdentityModel - instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel - instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instancePrototypeModel.UserData = core.StringPtr("testString") - instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} - instancePrototypeModel.VPC = vpcIdentityModel - instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel - instancePrototypeModel.Image = imageIdentityModel - instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel - instancePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateInstanceOptions model - createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) - createInstanceOptionsModel.InstancePrototype = instancePrototypeModel - createInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstance(createInstanceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateInstance 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 InstanceAvailabilityPrototype model - instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) - instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) - trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") - - // Construct an instance of the InstanceDefaultTrustedProfilePrototype model - instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) - instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) - instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") - - // Construct an instance of the InstanceMetadataServicePrototype model - instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) - instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) - - // 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 NetworkInterfacePrototype model - networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) - networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - networkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPrototypeModel.ID = core.StringPtr("0787-8c2a09be-ee18-4af2-8ef4-6a6060732221") - - // Construct an instance of the InstanceProfileIdentityByName model - instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) - instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") - - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) - volumeAttachmentPrototypeVolumeModel.Iops = core.Int64Ptr(int64(10000)) - volumeAttachmentPrototypeVolumeModel.Name = core.StringPtr("my-data-volume") - volumeAttachmentPrototypeVolumeModel.Profile = volumeProfileIdentityModel - volumeAttachmentPrototypeVolumeModel.UserTags = []string{"testString"} - volumeAttachmentPrototypeVolumeModel.Capacity = core.Int64Ptr(int64(1000)) - volumeAttachmentPrototypeVolumeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the VolumeAttachmentPrototype model - volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) - volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") - - // Construct an instance of the VolumePrototypeInstanceByImageContext model - volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) - volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) - volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel - volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") - volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel - volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} - - // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model - volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) - volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("9aaf3bcb-dcd7-4de7-bb60-24e39ff9d366") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the InstancePrototypeInstanceByImage model - instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) - instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel - instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel - instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - instancePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel - instancePrototypeModel.Name = core.StringPtr("my-instance") - instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} - instancePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel - instancePrototypeModel.Profile = instanceProfileIdentityModel - instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel - instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instancePrototypeModel.UserData = core.StringPtr("testString") - instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} - instancePrototypeModel.VPC = vpcIdentityModel - instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel - instancePrototypeModel.Image = imageIdentityModel - instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel - instancePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateInstanceOptions model - createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) - createInstanceOptionsModel.InstancePrototype = instancePrototypeModel - createInstanceOptionsModel.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.CreateInstance(createInstanceOptionsModel) - 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 CreateInstanceOptions model with no property values - createInstanceOptionsModelNew := new(vpcv1.CreateInstanceOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstance(createInstanceOptionsModelNew) - 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 CreateInstance 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 InstanceAvailabilityPrototype model - instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) - instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) - trustedProfileIdentityModel.ID = core.StringPtr("Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5") - - // Construct an instance of the InstanceDefaultTrustedProfilePrototype model - instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) - instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) - instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - keyIdentityModel.ID = core.StringPtr("363f6d70-0000-0001-0000-00000013b96c") - - // Construct an instance of the InstanceMetadataServicePrototype model - instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) - instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) - - // 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 NetworkInterfacePrototype model - networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) - networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - networkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPrototypeModel.ID = core.StringPtr("0787-8c2a09be-ee18-4af2-8ef4-6a6060732221") - - // Construct an instance of the InstanceProfileIdentityByName model - instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) - instanceProfileIdentityModel.Name = core.StringPtr("bx2-2x8") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:[...]") - - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) - volumeAttachmentPrototypeVolumeModel.Iops = core.Int64Ptr(int64(10000)) - volumeAttachmentPrototypeVolumeModel.Name = core.StringPtr("my-data-volume") - volumeAttachmentPrototypeVolumeModel.Profile = volumeProfileIdentityModel - volumeAttachmentPrototypeVolumeModel.UserTags = []string{"testString"} - volumeAttachmentPrototypeVolumeModel.Capacity = core.Int64Ptr(int64(1000)) - volumeAttachmentPrototypeVolumeModel.EncryptionKey = encryptionKeyIdentityModel - - // Construct an instance of the VolumeAttachmentPrototype model - volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) - volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") - - // Construct an instance of the VolumePrototypeInstanceByImageContext model - volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) - volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) - volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel - volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-boot-volume") - volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel - volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} - - // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model - volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) - volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - imageIdentityModel.ID = core.StringPtr("9aaf3bcb-dcd7-4de7-bb60-24e39ff9d366") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the InstancePrototypeInstanceByImage model - instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) - instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel - instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel - instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - instancePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel - instancePrototypeModel.Name = core.StringPtr("my-instance") - instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} - instancePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel - instancePrototypeModel.Profile = instanceProfileIdentityModel - instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel - instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instancePrototypeModel.UserData = core.StringPtr("testString") - instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} - instancePrototypeModel.VPC = vpcIdentityModel - instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel - instancePrototypeModel.Image = imageIdentityModel - instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel - instancePrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateInstanceOptions model - createInstanceOptionsModel := new(vpcv1.CreateInstanceOptions) - createInstanceOptionsModel.InstancePrototype = instancePrototypeModel - createInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateInstance(createInstanceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions)`, func() { - version := "testString" - deleteInstancePath := "/instances/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(deleteInstancePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteInstance 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.DeleteInstance(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteInstanceOptions model - deleteInstanceOptionsModel := new(vpcv1.DeleteInstanceOptions) - deleteInstanceOptionsModel.ID = core.StringPtr("testString") - deleteInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstance(deleteInstanceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteInstance 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 DeleteInstanceOptions model - deleteInstanceOptionsModel := new(vpcv1.DeleteInstanceOptions) - deleteInstanceOptionsModel.ID = core.StringPtr("testString") - deleteInstanceOptionsModel.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.DeleteInstance(deleteInstanceOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteInstanceOptions model with no property values - deleteInstanceOptionsModelNew := new(vpcv1.DeleteInstanceOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstance(deleteInstanceOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstance(getInstanceOptions *GetInstanceOptions) - Operation response error`, func() { - version := "testString" - getInstancePath := "/instances/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(getInstancePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetInstance 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 GetInstanceOptions model - getInstanceOptionsModel := new(vpcv1.GetInstanceOptions) - getInstanceOptionsModel.ID = core.StringPtr("testString") - getInstanceOptionsModel.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.GetInstance(getInstanceOptionsModel) - 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.GetInstance(getInstanceOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstance(getInstanceOptions *GetInstanceOptions)`, func() { - version := "testString" - getInstancePath := "/instances/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(getInstancePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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 GetInstanceOptions model - getInstanceOptionsModel := new(vpcv1.GetInstanceOptions) - getInstanceOptionsModel.ID = core.StringPtr("testString") - getInstanceOptionsModel.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.GetInstanceWithContext(ctx, getInstanceOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstance(getInstanceOptionsModel) - 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.GetInstanceWithContext(ctx, getInstanceOptionsModel) - 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(getInstancePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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.GetInstance(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetInstanceOptions model - getInstanceOptionsModel := new(vpcv1.GetInstanceOptions) - getInstanceOptionsModel.ID = core.StringPtr("testString") - getInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstance(getInstanceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetInstance 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 GetInstanceOptions model - getInstanceOptionsModel := new(vpcv1.GetInstanceOptions) - getInstanceOptionsModel.ID = core.StringPtr("testString") - getInstanceOptionsModel.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.GetInstance(getInstanceOptionsModel) - 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 GetInstanceOptions model with no property values - getInstanceOptionsModelNew := new(vpcv1.GetInstanceOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstance(getInstanceOptionsModelNew) - 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 GetInstance 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 GetInstanceOptions model - getInstanceOptionsModel := new(vpcv1.GetInstanceOptions) - getInstanceOptionsModel.ID = core.StringPtr("testString") - getInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetInstance(getInstanceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) - Operation response error`, func() { - version := "testString" - updateInstancePath := "/instances/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(updateInstancePath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateInstance 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 InstanceAvailabilityPolicyPatch model - instanceAvailabilityPolicyPatchModel := new(vpcv1.InstanceAvailabilityPolicyPatch) - instanceAvailabilityPolicyPatchModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the InstanceMetadataServicePatch model - instanceMetadataServicePatchModel := new(vpcv1.InstanceMetadataServicePatch) - instanceMetadataServicePatchModel.Enabled = core.BoolPtr(true) - - // Construct an instance of the InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPatchModel := new(vpcv1.InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPatchModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the InstancePatchProfileInstanceProfileIdentityByName model - instancePatchProfileModel := new(vpcv1.InstancePatchProfileInstanceProfileIdentityByName) - instancePatchProfileModel.Name = core.StringPtr("bx2-4x16") - - // Construct an instance of the InstancePatch model - instancePatchModel := new(vpcv1.InstancePatch) - instancePatchModel.AvailabilityPolicy = instanceAvailabilityPolicyPatchModel - instancePatchModel.MetadataService = instanceMetadataServicePatchModel - instancePatchModel.Name = core.StringPtr("my-instance") - instancePatchModel.PlacementTarget = instancePlacementTargetPatchModel - instancePatchModel.Profile = instancePatchProfileModel - instancePatchModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instancePatchModelAsPatch, asPatchErr := instancePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceOptions model - updateInstanceOptionsModel := new(vpcv1.UpdateInstanceOptions) - updateInstanceOptionsModel.ID = core.StringPtr("testString") - updateInstanceOptionsModel.InstancePatch = instancePatchModelAsPatch - updateInstanceOptionsModel.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.UpdateInstance(updateInstanceOptionsModel) - 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.UpdateInstance(updateInstanceOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstance(updateInstanceOptions *UpdateInstanceOptions)`, func() { - version := "testString" - updateInstancePath := "/instances/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(updateInstancePath)) - 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{"testString"})) - 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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 InstanceAvailabilityPolicyPatch model - instanceAvailabilityPolicyPatchModel := new(vpcv1.InstanceAvailabilityPolicyPatch) - instanceAvailabilityPolicyPatchModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the InstanceMetadataServicePatch model - instanceMetadataServicePatchModel := new(vpcv1.InstanceMetadataServicePatch) - instanceMetadataServicePatchModel.Enabled = core.BoolPtr(true) - - // Construct an instance of the InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPatchModel := new(vpcv1.InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPatchModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the InstancePatchProfileInstanceProfileIdentityByName model - instancePatchProfileModel := new(vpcv1.InstancePatchProfileInstanceProfileIdentityByName) - instancePatchProfileModel.Name = core.StringPtr("bx2-4x16") - - // Construct an instance of the InstancePatch model - instancePatchModel := new(vpcv1.InstancePatch) - instancePatchModel.AvailabilityPolicy = instanceAvailabilityPolicyPatchModel - instancePatchModel.MetadataService = instanceMetadataServicePatchModel - instancePatchModel.Name = core.StringPtr("my-instance") - instancePatchModel.PlacementTarget = instancePlacementTargetPatchModel - instancePatchModel.Profile = instancePatchProfileModel - instancePatchModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instancePatchModelAsPatch, asPatchErr := instancePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceOptions model - updateInstanceOptionsModel := new(vpcv1.UpdateInstanceOptions) - updateInstanceOptionsModel.ID = core.StringPtr("testString") - updateInstanceOptionsModel.InstancePatch = instancePatchModelAsPatch - updateInstanceOptionsModel.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.UpdateInstanceWithContext(ctx, updateInstanceOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstance(updateInstanceOptionsModel) - 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.UpdateInstanceWithContext(ctx, updateInstanceOptionsModel) - 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(updateInstancePath)) - 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{"testString"})) - 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}, "catalog_offering": {"version": {"crn": "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456: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/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a", "dedicated_host": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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}], "gpu": {"count": 1, "manufacturer": "nvidia", "memory": 1, "model": "Tesla V100"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-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": 8, "metadata_service": {"enabled": false}, "name": "my-instance", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "placement_target": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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_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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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_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}, "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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.UpdateInstance(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the InstanceAvailabilityPolicyPatch model - instanceAvailabilityPolicyPatchModel := new(vpcv1.InstanceAvailabilityPolicyPatch) - instanceAvailabilityPolicyPatchModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the InstanceMetadataServicePatch model - instanceMetadataServicePatchModel := new(vpcv1.InstanceMetadataServicePatch) - instanceMetadataServicePatchModel.Enabled = core.BoolPtr(true) - - // Construct an instance of the InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPatchModel := new(vpcv1.InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPatchModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the InstancePatchProfileInstanceProfileIdentityByName model - instancePatchProfileModel := new(vpcv1.InstancePatchProfileInstanceProfileIdentityByName) - instancePatchProfileModel.Name = core.StringPtr("bx2-4x16") - - // Construct an instance of the InstancePatch model - instancePatchModel := new(vpcv1.InstancePatch) - instancePatchModel.AvailabilityPolicy = instanceAvailabilityPolicyPatchModel - instancePatchModel.MetadataService = instanceMetadataServicePatchModel - instancePatchModel.Name = core.StringPtr("my-instance") - instancePatchModel.PlacementTarget = instancePlacementTargetPatchModel - instancePatchModel.Profile = instancePatchProfileModel - instancePatchModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instancePatchModelAsPatch, asPatchErr := instancePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceOptions model - updateInstanceOptionsModel := new(vpcv1.UpdateInstanceOptions) - updateInstanceOptionsModel.ID = core.StringPtr("testString") - updateInstanceOptionsModel.InstancePatch = instancePatchModelAsPatch - updateInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstance(updateInstanceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateInstance 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 InstanceAvailabilityPolicyPatch model - instanceAvailabilityPolicyPatchModel := new(vpcv1.InstanceAvailabilityPolicyPatch) - instanceAvailabilityPolicyPatchModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the InstanceMetadataServicePatch model - instanceMetadataServicePatchModel := new(vpcv1.InstanceMetadataServicePatch) - instanceMetadataServicePatchModel.Enabled = core.BoolPtr(true) - - // Construct an instance of the InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPatchModel := new(vpcv1.InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPatchModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the InstancePatchProfileInstanceProfileIdentityByName model - instancePatchProfileModel := new(vpcv1.InstancePatchProfileInstanceProfileIdentityByName) - instancePatchProfileModel.Name = core.StringPtr("bx2-4x16") - - // Construct an instance of the InstancePatch model - instancePatchModel := new(vpcv1.InstancePatch) - instancePatchModel.AvailabilityPolicy = instanceAvailabilityPolicyPatchModel - instancePatchModel.MetadataService = instanceMetadataServicePatchModel - instancePatchModel.Name = core.StringPtr("my-instance") - instancePatchModel.PlacementTarget = instancePlacementTargetPatchModel - instancePatchModel.Profile = instancePatchProfileModel - instancePatchModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instancePatchModelAsPatch, asPatchErr := instancePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceOptions model - updateInstanceOptionsModel := new(vpcv1.UpdateInstanceOptions) - updateInstanceOptionsModel.ID = core.StringPtr("testString") - updateInstanceOptionsModel.InstancePatch = instancePatchModelAsPatch - updateInstanceOptionsModel.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.UpdateInstance(updateInstanceOptionsModel) - 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 UpdateInstanceOptions model with no property values - updateInstanceOptionsModelNew := new(vpcv1.UpdateInstanceOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstance(updateInstanceOptionsModelNew) - 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 UpdateInstance 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 InstanceAvailabilityPolicyPatch model - instanceAvailabilityPolicyPatchModel := new(vpcv1.InstanceAvailabilityPolicyPatch) - instanceAvailabilityPolicyPatchModel.HostFailure = core.StringPtr("restart") - - // Construct an instance of the InstanceMetadataServicePatch model - instanceMetadataServicePatchModel := new(vpcv1.InstanceMetadataServicePatch) - instanceMetadataServicePatchModel.Enabled = core.BoolPtr(true) - - // Construct an instance of the InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPatchModel := new(vpcv1.InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) - instancePlacementTargetPatchModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the InstancePatchProfileInstanceProfileIdentityByName model - instancePatchProfileModel := new(vpcv1.InstancePatchProfileInstanceProfileIdentityByName) - instancePatchProfileModel.Name = core.StringPtr("bx2-4x16") - - // Construct an instance of the InstancePatch model - instancePatchModel := new(vpcv1.InstancePatch) - instancePatchModel.AvailabilityPolicy = instanceAvailabilityPolicyPatchModel - instancePatchModel.MetadataService = instanceMetadataServicePatchModel - instancePatchModel.Name = core.StringPtr("my-instance") - instancePatchModel.PlacementTarget = instancePlacementTargetPatchModel - instancePatchModel.Profile = instancePatchProfileModel - instancePatchModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instancePatchModelAsPatch, asPatchErr := instancePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateInstanceOptions model - updateInstanceOptionsModel := new(vpcv1.UpdateInstanceOptions) - updateInstanceOptionsModel.ID = core.StringPtr("testString") - updateInstanceOptionsModel.InstancePatch = instancePatchModelAsPatch - updateInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateInstance(updateInstanceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) - Operation response error`, func() { - version := "testString" - getInstanceInitializationPath := "/instances/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(getInstanceInitializationPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetInstanceInitialization 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 GetInstanceInitializationOptions model - getInstanceInitializationOptionsModel := new(vpcv1.GetInstanceInitializationOptions) - getInstanceInitializationOptionsModel.ID = core.StringPtr("testString") - getInstanceInitializationOptionsModel.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.GetInstanceInitialization(getInstanceInitializationOptionsModel) - 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.GetInstanceInitialization(getInstanceInitializationOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions)`, func() { - version := "testString" - getInstanceInitializationPath := "/instances/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(getInstanceInitializationPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/123456::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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "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/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "password": {"encrypted_password": "VGhpcyBpcyBhbiBlbmNvZGVkIGJ5dGUgYXJyYXku", "encryption_key": {"fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY"}}}`) - })) - }) - It(`Invoke GetInstanceInitialization 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 GetInstanceInitializationOptions model - getInstanceInitializationOptionsModel := new(vpcv1.GetInstanceInitializationOptions) - getInstanceInitializationOptionsModel.ID = core.StringPtr("testString") - getInstanceInitializationOptionsModel.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.GetInstanceInitializationWithContext(ctx, getInstanceInitializationOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetInstanceInitialization(getInstanceInitializationOptionsModel) - 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.GetInstanceInitializationWithContext(ctx, getInstanceInitializationOptionsModel) - 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(getInstanceInitializationPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"default_trusted_profile": {"auto_link": true, "target": {"crn": "crn:v1:bluemix:public:iam-identity::a/123456::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/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "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/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "password": {"encrypted_password": "VGhpcyBpcyBhbiBlbmNvZGVkIGJ5dGUgYXJyYXku", "encryption_key": {"fingerprint": "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY"}}}`) - })) - }) - It(`Invoke GetInstanceInitialization 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.GetInstanceInitialization(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetInstanceInitializationOptions model - getInstanceInitializationOptionsModel := new(vpcv1.GetInstanceInitializationOptions) - getInstanceInitializationOptionsModel.ID = core.StringPtr("testString") - getInstanceInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceInitialization(getInstanceInitializationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetInstanceInitialization 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 GetInstanceInitializationOptions model - getInstanceInitializationOptionsModel := new(vpcv1.GetInstanceInitializationOptions) - getInstanceInitializationOptionsModel.ID = core.StringPtr("testString") - getInstanceInitializationOptionsModel.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.GetInstanceInitialization(getInstanceInitializationOptionsModel) - 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 GetInstanceInitializationOptions model with no property values - getInstanceInitializationOptionsModelNew := new(vpcv1.GetInstanceInitializationOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceInitialization(getInstanceInitializationOptionsModelNew) - 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 GetInstanceInitialization 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 GetInstanceInitializationOptions model - getInstanceInitializationOptionsModel := new(vpcv1.GetInstanceInitializationOptions) - getInstanceInitializationOptionsModel.ID = core.StringPtr("testString") - getInstanceInitializationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetInstanceInitialization(getInstanceInitializationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) - Operation response error`, func() { - version := "testString" - createInstanceActionPath := "/instances/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(createInstanceActionPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateInstanceAction 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 CreateInstanceActionOptions model - createInstanceActionOptionsModel := new(vpcv1.CreateInstanceActionOptions) - createInstanceActionOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceActionOptionsModel.Type = core.StringPtr("reboot") - createInstanceActionOptionsModel.Force = core.BoolPtr(true) - createInstanceActionOptionsModel.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.CreateInstanceAction(createInstanceActionOptionsModel) - 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.CreateInstanceAction(createInstanceActionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions)`, func() { - version := "testString" - createInstanceActionPath := "/instances/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(createInstanceActionPath)) - 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{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke CreateInstanceAction 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 CreateInstanceActionOptions model - createInstanceActionOptionsModel := new(vpcv1.CreateInstanceActionOptions) - createInstanceActionOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceActionOptionsModel.Type = core.StringPtr("reboot") - createInstanceActionOptionsModel.Force = core.BoolPtr(true) - createInstanceActionOptionsModel.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.CreateInstanceActionWithContext(ctx, createInstanceActionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateInstanceAction(createInstanceActionOptionsModel) - 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.CreateInstanceActionWithContext(ctx, createInstanceActionOptionsModel) - 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(createInstanceActionPath)) - 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{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke CreateInstanceAction 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.CreateInstanceAction(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the CreateInstanceActionOptions model - createInstanceActionOptionsModel := new(vpcv1.CreateInstanceActionOptions) - createInstanceActionOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceActionOptionsModel.Type = core.StringPtr("reboot") - createInstanceActionOptionsModel.Force = core.BoolPtr(true) - createInstanceActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceAction(createInstanceActionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateInstanceAction 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 CreateInstanceActionOptions model - createInstanceActionOptionsModel := new(vpcv1.CreateInstanceActionOptions) - createInstanceActionOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceActionOptionsModel.Type = core.StringPtr("reboot") - createInstanceActionOptionsModel.Force = core.BoolPtr(true) - createInstanceActionOptionsModel.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.CreateInstanceAction(createInstanceActionOptionsModel) - 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 CreateInstanceActionOptions model with no property values - createInstanceActionOptionsModelNew := new(vpcv1.CreateInstanceActionOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceAction(createInstanceActionOptionsModelNew) - 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 CreateInstanceAction 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 CreateInstanceActionOptions model - createInstanceActionOptionsModel := new(vpcv1.CreateInstanceActionOptions) - createInstanceActionOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceActionOptionsModel.Type = core.StringPtr("reboot") - createInstanceActionOptionsModel.Force = core.BoolPtr(true) - createInstanceActionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateInstanceAction(createInstanceActionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) - Operation response error`, func() { - version := "testString" - 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(createInstanceConsoleAccessTokenPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateInstanceConsoleAccessToken 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 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.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.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions)`, func() { - version := "testString" - 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(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{"testString"})) - 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": "VGhpcyBJcyBhIHRva2Vu", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/console?access_token=VGhpcyBJcyBhIHRva2Vu"}`) - })) - }) - It(`Invoke CreateInstanceConsoleAccessToken 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 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.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.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) - 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.CreateInstanceConsoleAccessTokenWithContext(ctx, createInstanceConsoleAccessTokenOptionsModel) - 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(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{"testString"})) - 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": "VGhpcyBJcyBhIHRva2Vu", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/console?access_token=VGhpcyBJcyBhIHRva2Vu"}`) - })) - }) - It(`Invoke CreateInstanceConsoleAccessToken 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.CreateInstanceConsoleAccessToken(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateInstanceConsoleAccessToken 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 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.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 CreateInstanceConsoleAccessTokenOptions model with no property values - createInstanceConsoleAccessTokenOptionsModelNew := new(vpcv1.CreateInstanceConsoleAccessTokenOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModelNew) - 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 CreateInstanceConsoleAccessToken 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 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.CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) - Operation response error`, func() { - version := "testString" - 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(listInstanceDisksPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListInstanceDisks 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 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.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.ListInstanceDisks(listInstanceDisksOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions)`, func() { - version := "testString" - 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(listInstanceDisksPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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}]}`) - })) - }) - It(`Invoke ListInstanceDisks 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 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 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")) - - // 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.ListInstanceDisksWithContext(ctx, listInstanceDisksOptionsModel) - 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(listInstanceDisksPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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}]}`) - })) - }) - It(`Invoke ListInstanceDisks 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.ListInstanceDisks(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceDisks(listInstanceDisksOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListInstanceDisks 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 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.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 ListInstanceDisksOptions model with no property values - listInstanceDisksOptionsModelNew := new(vpcv1.ListInstanceDisksOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceDisks(listInstanceDisksOptionsModelNew) - 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 ListInstanceDisks 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 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.ListInstanceDisks(listInstanceDisksOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) - Operation response error`, func() { - version := "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(getInstanceDiskPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetInstanceDisk 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 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.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.GetInstanceDisk(getInstanceDiskOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions)`, func() { - version := "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(getInstanceDiskPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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}`) - })) - }) - It(`Invoke GetInstanceDisk 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 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.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.GetInstanceDisk(getInstanceDiskOptionsModel) - 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.GetInstanceDiskWithContext(ctx, getInstanceDiskOptionsModel) - 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(getInstanceDiskPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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}`) - })) - }) - It(`Invoke GetInstanceDisk 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.GetInstanceDisk(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceDisk(getInstanceDiskOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetInstanceDisk 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 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.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 GetInstanceDiskOptions model with no property values - getInstanceDiskOptionsModelNew := new(vpcv1.GetInstanceDiskOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceDisk(getInstanceDiskOptionsModelNew) - 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 GetInstanceDisk 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 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.GetInstanceDisk(getInstanceDiskOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) - Operation response error`, func() { - version := "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(updateInstanceDiskPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateInstanceDisk 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 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 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.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.UpdateInstanceDisk(updateInstanceDiskOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions)`, func() { - version := "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(updateInstanceDiskPath)) - 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{"testString"})) - 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/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}`) - })) - }) - It(`Invoke UpdateInstanceDisk 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 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 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.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.UpdateInstanceDisk(updateInstanceDiskOptionsModel) - 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.UpdateInstanceDiskWithContext(ctx, updateInstanceDiskOptionsModel) - 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(updateInstanceDiskPath)) - 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{"testString"})) - 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/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}`) - })) - }) - It(`Invoke UpdateInstanceDisk 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.UpdateInstanceDisk(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() - 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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateInstanceDisk 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 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 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.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 UpdateInstanceDiskOptions model with no property values - updateInstanceDiskOptionsModelNew := new(vpcv1.UpdateInstanceDiskOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceDisk(updateInstanceDiskOptionsModelNew) - 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 UpdateInstanceDisk 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 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 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.UpdateInstanceDisk(updateInstanceDiskOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) - Operation response error`, func() { - version := "testString" - 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(listInstanceNetworkInterfacesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListInstanceNetworkInterfaces 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 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.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.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions)`, func() { - version := "testString" - 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(listInstanceNetworkInterfacesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}]}`) - })) - }) - It(`Invoke ListInstanceNetworkInterfaces 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 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.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.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) - 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.ListInstanceNetworkInterfacesWithContext(ctx, listInstanceNetworkInterfacesOptionsModel) - 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(listInstanceNetworkInterfacesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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_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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}]}`) - })) - }) - It(`Invoke ListInstanceNetworkInterfaces 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.ListInstanceNetworkInterfaces(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListInstanceNetworkInterfaces 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 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.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 ListInstanceNetworkInterfacesOptions model with no property values - listInstanceNetworkInterfacesOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfacesOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModelNew) - 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 ListInstanceNetworkInterfaces 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 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.ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) - Operation response error`, func() { - version := "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(createInstanceNetworkInterfacePath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateInstanceNetworkInterface 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 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("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-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.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.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions)`, func() { - version := "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(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{"testString"})) - 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", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) - })) - }) - It(`Invoke CreateInstanceNetworkInterface 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 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("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-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.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.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) - 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.CreateInstanceNetworkInterfaceWithContext(ctx, createInstanceNetworkInterfaceOptionsModel) - 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(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{"testString"})) - 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", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) - })) - }) - It(`Invoke CreateInstanceNetworkInterface 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.CreateInstanceNetworkInterface(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 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 CreateInstanceNetworkInterfaceOptions model - createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) - createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) - createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-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.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateInstanceNetworkInterface 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 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("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-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.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 CreateInstanceNetworkInterfaceOptions model with no property values - createInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.CreateInstanceNetworkInterfaceOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModelNew) - 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 CreateInstanceNetworkInterface 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") - - // 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 CreateInstanceNetworkInterfaceOptions model - createInstanceNetworkInterfaceOptionsModel := new(vpcv1.CreateInstanceNetworkInterfaceOptions) - createInstanceNetworkInterfaceOptionsModel.InstanceID = core.StringPtr("testString") - createInstanceNetworkInterfaceOptionsModel.Subnet = subnetIdentityModel - createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing = core.BoolPtr(true) - createInstanceNetworkInterfaceOptionsModel.Name = core.StringPtr("my-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.CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions)`, func() { - version := "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{"testString"})) - 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 := "testString" - 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(getInstanceNetworkInterfacePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetInstanceNetworkInterface 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 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.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.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions)`, func() { - version := "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(getInstanceNetworkInterfacePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) - })) - }) - It(`Invoke GetInstanceNetworkInterface 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 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.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.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) - 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.GetInstanceNetworkInterfaceWithContext(ctx, getInstanceNetworkInterfaceOptionsModel) - 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(getInstanceNetworkInterfacePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) - })) - }) - It(`Invoke GetInstanceNetworkInterface 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.GetInstanceNetworkInterface(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetInstanceNetworkInterface 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 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.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 GetInstanceNetworkInterfaceOptions model with no property values - getInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModelNew) - 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 GetInstanceNetworkInterface 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 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.GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) - Operation response error`, func() { - version := "testString" - 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(updateInstanceNetworkInterfacePath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateInstanceNetworkInterface 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 NetworkInterfacePatch model - networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) - networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") - 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.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.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions)`, func() { - version := "testString" - 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(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{"testString"})) - 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", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) - })) - }) - It(`Invoke UpdateInstanceNetworkInterface 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 NetworkInterfacePatch model - networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) - networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") - 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.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.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) - 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.UpdateInstanceNetworkInterfaceWithContext(ctx, updateInstanceNetworkInterfaceOptionsModel) - 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(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{"testString"})) - 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", "floating_ips": [{"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "type": "primary"}`) - })) - }) - It(`Invoke UpdateInstanceNetworkInterface 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.UpdateInstanceNetworkInterface(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() - 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.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateInstanceNetworkInterface 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 NetworkInterfacePatch model - networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) - networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") - 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.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 UpdateInstanceNetworkInterfaceOptions model with no property values - updateInstanceNetworkInterfaceOptionsModelNew := new(vpcv1.UpdateInstanceNetworkInterfaceOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModelNew) - 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 UpdateInstanceNetworkInterface 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 NetworkInterfacePatch model - networkInterfacePatchModel := new(vpcv1.NetworkInterfacePatch) - networkInterfacePatchModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePatchModel.Name = core.StringPtr("my-network-interface-1") - 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.UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) - Operation response error`, func() { - version := "testString" - 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(listInstanceNetworkInterfaceFloatingIpsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListInstanceNetworkInterfaceFloatingIps 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 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.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.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions)`, func() { - version := "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(listInstanceNetworkInterfaceFloatingIpsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 ListInstanceNetworkInterfaceFloatingIps 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 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.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.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) - 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.ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx, listInstanceNetworkInterfaceFloatingIpsOptionsModel) - 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(listInstanceNetworkInterfaceFloatingIpsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 ListInstanceNetworkInterfaceFloatingIps 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.ListInstanceNetworkInterfaceFloatingIps(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListInstanceNetworkInterfaceFloatingIps 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 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.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 ListInstanceNetworkInterfaceFloatingIpsOptions model with no property values - listInstanceNetworkInterfaceFloatingIpsOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfaceFloatingIpsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModelNew) - 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 ListInstanceNetworkInterfaceFloatingIps 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 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.ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions)`, func() { - version := "testString" - 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{"testString"})) - 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 := "testString" - 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(getInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetInstanceNetworkInterfaceFloatingIP 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 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.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.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions)`, func() { - version := "testString" - 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(getInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 GetInstanceNetworkInterfaceFloatingIP 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 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.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.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) - 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.GetInstanceNetworkInterfaceFloatingIPWithContext(ctx, getInstanceNetworkInterfaceFloatingIPOptionsModel) - 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(getInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 GetInstanceNetworkInterfaceFloatingIP 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.GetInstanceNetworkInterfaceFloatingIP(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetInstanceNetworkInterfaceFloatingIP 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 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.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 GetInstanceNetworkInterfaceFloatingIPOptions model with no property values - getInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceFloatingIPOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModelNew) - 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 GetInstanceNetworkInterfaceFloatingIP 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 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.GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) - Operation response error`, func() { - version := "testString" - 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(addInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 AddInstanceNetworkInterfaceFloatingIP 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 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.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.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions)`, func() { - version := "testString" - 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(addInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 AddInstanceNetworkInterfaceFloatingIP 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 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.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.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) - 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.AddInstanceNetworkInterfaceFloatingIPWithContext(ctx, addInstanceNetworkInterfaceFloatingIPOptionsModel) - 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(addInstanceNetworkInterfaceFloatingIPPath)) - Expect(req.Method).To(Equal("PUT")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 AddInstanceNetworkInterfaceFloatingIP 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.AddInstanceNetworkInterfaceFloatingIP(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke AddInstanceNetworkInterfaceFloatingIP 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 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 AddInstanceNetworkInterfaceFloatingIPOptions model with no property values - addInstanceNetworkInterfaceFloatingIPOptionsModelNew := new(vpcv1.AddInstanceNetworkInterfaceFloatingIPOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModelNew) - 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 AddInstanceNetworkInterfaceFloatingIP 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 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.AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) - Operation response error`, func() { - version := "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(listInstanceNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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() { - 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 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.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.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions)`, func() { - version := "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(listInstanceNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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}`) - })) - }) - It(`Invoke ListInstanceNetworkInterfaceIps 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 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.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.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) - 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.ListInstanceNetworkInterfaceIpsWithContext(ctx, listInstanceNetworkInterfaceIpsOptionsModel) - 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(listInstanceNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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}`) - })) - }) - It(`Invoke ListInstanceNetworkInterfaceIps 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.ListInstanceNetworkInterfaceIps(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListInstanceNetworkInterfaceIps 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 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.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 ListInstanceNetworkInterfaceIpsOptions model with no property values - listInstanceNetworkInterfaceIpsOptionsModelNew := new(vpcv1.ListInstanceNetworkInterfaceIpsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModelNew) - 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 ListInstanceNetworkInterfaceIps 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 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.ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptionsModel) - 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.ReservedIPCollectionNetworkInterfaceContext) - nextObject := new(vpcv1.ReservedIPCollectionNetworkInterfaceContextNext) - 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.ReservedIPCollectionNetworkInterfaceContext) - - 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.ReservedIPCollectionNetworkInterfaceContext) - nextObject := new(vpcv1.ReservedIPCollectionNetworkInterfaceContextNext) - 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"user","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"user","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"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 := "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(getInstanceNetworkInterfaceIPPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetInstanceNetworkInterfaceIP 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 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.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.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions)`, func() { - version := "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(getInstanceNetworkInterfaceIPPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) - })) - }) - It(`Invoke GetInstanceNetworkInterfaceIP 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 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.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.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) - 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.GetInstanceNetworkInterfaceIPWithContext(ctx, getInstanceNetworkInterfaceIPOptionsModel) - 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(getInstanceNetworkInterfaceIPPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) - })) - }) - It(`Invoke GetInstanceNetworkInterfaceIP 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.GetInstanceNetworkInterfaceIP(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetInstanceNetworkInterfaceIP 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 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.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 GetInstanceNetworkInterfaceIPOptions model with no property values - getInstanceNetworkInterfaceIPOptionsModelNew := new(vpcv1.GetInstanceNetworkInterfaceIPOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModelNew) - 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 GetInstanceNetworkInterfaceIP 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 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.GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) - Operation response error`, func() { - version := "testString" - 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(listInstanceVolumeAttachmentsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListInstanceVolumeAttachments 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 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.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.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions)`, func() { - version := "testString" - 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(listInstanceVolumeAttachmentsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}]}`) - })) - }) - It(`Invoke ListInstanceVolumeAttachments 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 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.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.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) - 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.ListInstanceVolumeAttachmentsWithContext(ctx, listInstanceVolumeAttachmentsOptionsModel) - 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(listInstanceVolumeAttachmentsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}]}`) - })) - }) - It(`Invoke ListInstanceVolumeAttachments 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.ListInstanceVolumeAttachments(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListInstanceVolumeAttachments 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 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.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() - }) - }) - 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 ListInstanceVolumeAttachments 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 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.ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) - Operation response error`, func() { - version := "testString" - 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(createInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateInstanceVolumeAttachment 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 VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("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"} - // Expect response parsing to fail since we are receiving a text/plain response - 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.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions)`, func() { - version := "testString" - 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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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": 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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}`) - })) - }) - It(`Invoke CreateInstanceVolumeAttachment 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 VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("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 a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, 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.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) - 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.CreateInstanceVolumeAttachmentWithContext(ctx, createInstanceVolumeAttachmentOptionsModel) - 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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}`) - })) - }) - It(`Invoke CreateInstanceVolumeAttachment 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.CreateInstanceVolumeAttachment(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("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 valid options model (positive test) - result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateInstanceVolumeAttachment 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 VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("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) - 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) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModelNew) - 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 CreateInstanceVolumeAttachment 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 VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("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 - result, response, operationErr := vpcService.CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions)`, func() { - version := "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(deleteInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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() { - version := "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(getInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetInstanceVolumeAttachment 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 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.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.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions)`, func() { - version := "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(getInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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": 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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}`) - })) - }) - It(`Invoke GetInstanceVolumeAttachment 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 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.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.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) - 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.GetInstanceVolumeAttachmentWithContext(ctx, getInstanceVolumeAttachmentOptionsModel) - 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(getInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}`) - })) - }) - It(`Invoke GetInstanceVolumeAttachment 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.GetInstanceVolumeAttachment(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetInstanceVolumeAttachment 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 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.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 GetInstanceVolumeAttachmentOptions model with no property values - getInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.GetInstanceVolumeAttachmentOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModelNew) - 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 GetInstanceVolumeAttachment 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 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.GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) - Operation response error`, func() { - version := "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(updateInstanceVolumeAttachmentPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateInstanceVolumeAttachment 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 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"} - // Expect response parsing to fail since we are receiving a text/plain response - 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.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions)`, func() { - version := "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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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": 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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}`) - })) - }) - It(`Invoke UpdateInstanceVolumeAttachment 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 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"} - - // 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) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) - 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.UpdateInstanceVolumeAttachmentWithContext(ctx, updateInstanceVolumeAttachmentOptionsModel) - 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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "name": "my-volume-attachment", "status": "attached", "type": "boot", "volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}}`) - })) - }) - It(`Invoke UpdateInstanceVolumeAttachment 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.UpdateInstanceVolumeAttachment(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateInstanceVolumeAttachment 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 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"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - 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 UpdateInstanceVolumeAttachmentOptions model with no property values - updateInstanceVolumeAttachmentOptionsModelNew := new(vpcv1.UpdateInstanceVolumeAttachmentOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModelNew) - 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 UpdateInstanceVolumeAttachment 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 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"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) - Operation response error`, func() { - version := "testString" - 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(listInstanceGroupsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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() { - 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 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.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.ListInstanceGroups(listInstanceGroupsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions)`, func() { - version := "testString" - 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(listInstanceGroupsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) - })) - }) - It(`Invoke ListInstanceGroups 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 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.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.ListInstanceGroups(listInstanceGroupsOptionsModel) - 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.ListInstanceGroupsWithContext(ctx, listInstanceGroupsOptionsModel) - 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(listInstanceGroupsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) - })) - }) - It(`Invoke ListInstanceGroups 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.ListInstanceGroups(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroups(listInstanceGroupsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListInstanceGroups 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 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.ListInstanceGroups(listInstanceGroupsOptionsModel) - 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 ListInstanceGroups 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 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.ListInstanceGroups(listInstanceGroupsOptionsModel) - 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.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/123456::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/123456::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"},"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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/123456::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/123456::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"},"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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() { - version := "testString" - 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(createInstanceGroupPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateInstanceGroup 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 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("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 LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - 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.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.CreateInstanceGroup(createInstanceGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions)`, func() { - version := "testString" - 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(createInstanceGroupPath)) - 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{"testString"})) - 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", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke CreateInstanceGroup 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 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("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 LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - 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.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.CreateInstanceGroup(createInstanceGroupOptionsModel) - 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.CreateInstanceGroupWithContext(ctx, createInstanceGroupOptionsModel) - 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(createInstanceGroupPath)) - 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{"testString"})) - 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", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke CreateInstanceGroup 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.CreateInstanceGroup(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("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 LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - 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.CreateInstanceGroup(createInstanceGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateInstanceGroup 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 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("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 LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - 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.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 CreateInstanceGroupOptions model with no property values - createInstanceGroupOptionsModelNew := new(vpcv1.CreateInstanceGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceGroup(createInstanceGroupOptionsModelNew) - 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 CreateInstanceGroup 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 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("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 LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - 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.CreateInstanceGroup(createInstanceGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions)`, func() { - version := "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(deleteInstanceGroupPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteInstanceGroup 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.DeleteInstanceGroup(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"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteInstanceGroup 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 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.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 DeleteInstanceGroupOptions model with no property values - deleteInstanceGroupOptionsModelNew := new(vpcv1.DeleteInstanceGroupOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroup(deleteInstanceGroupOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) - Operation response error`, func() { - version := "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(getInstanceGroupPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetInstanceGroup 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 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.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.GetInstanceGroup(getInstanceGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions)`, func() { - version := "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(getInstanceGroupPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetInstanceGroup 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 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.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.GetInstanceGroup(getInstanceGroupOptionsModel) - 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.GetInstanceGroupWithContext(ctx, getInstanceGroupOptionsModel) - 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(getInstanceGroupPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetInstanceGroup 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.GetInstanceGroup(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetInstanceGroup 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 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.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 GetInstanceGroupOptions model with no property values - getInstanceGroupOptionsModelNew := new(vpcv1.GetInstanceGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroup(getInstanceGroupOptionsModelNew) - 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 GetInstanceGroup 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 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.GetInstanceGroup(getInstanceGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) - Operation response error`, func() { - version := "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(updateInstanceGroupPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateInstanceGroup 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 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 LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // 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 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 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.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.UpdateInstanceGroup(updateInstanceGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions)`, func() { - version := "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(updateInstanceGroupPath)) - 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{"testString"})) - 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", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke UpdateInstanceGroup 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 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 LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // 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 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 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.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.UpdateInstanceGroup(updateInstanceGroupOptionsModel) - 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.UpdateInstanceGroupWithContext(ctx, updateInstanceGroupOptionsModel) - 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(updateInstanceGroupPath)) - 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{"testString"})) - 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", `{"application_port": 22, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::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"}, "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke UpdateInstanceGroup 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.UpdateInstanceGroup(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 LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // 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 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 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.UpdateInstanceGroup(updateInstanceGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateInstanceGroup 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 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 LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // 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 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 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.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 UpdateInstanceGroupOptions model with no property values - updateInstanceGroupOptionsModelNew := new(vpcv1.UpdateInstanceGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroup(updateInstanceGroupOptionsModelNew) - 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 UpdateInstanceGroup 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 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 LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // 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 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 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.UpdateInstanceGroup(updateInstanceGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions)`, func() { - version := "testString" - 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{"testString"})) - 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 := "testString" - 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(listInstanceGroupManagersPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListInstanceGroupManagers 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 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.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.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions)`, func() { - version := "testString" - 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(listInstanceGroupManagersPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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}`) - })) - }) - It(`Invoke ListInstanceGroupManagers 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 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.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.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) - 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.ListInstanceGroupManagersWithContext(ctx, listInstanceGroupManagersOptionsModel) - 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(listInstanceGroupManagersPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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}`) - })) - }) - It(`Invoke ListInstanceGroupManagers 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.ListInstanceGroupManagers(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListInstanceGroupManagers 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 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.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 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() - }) - }) - 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 ListInstanceGroupManagers 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 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.ListInstanceGroupManagers(listInstanceGroupManagersOptionsModel) - 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.InstanceGroupManagerCollection) - nextObject := new(vpcv1.InstanceGroupManagerCollectionNext) - 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.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.InstanceGroupManagerCollection) - nextObject := new(vpcv1.InstanceGroupManagerCollectionNext) - 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(listInstanceGroupManagersPath)) - 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,"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,"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 InstanceGroupManagersPager.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()) - - listInstanceGroupManagersOptionsModel := &vpcv1.ListInstanceGroupManagersOptions{ - InstanceGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceGroupManagersPager(listInstanceGroupManagersOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.InstanceGroupManagerIntf - 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 InstanceGroupManagersPager.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()) - - listInstanceGroupManagersOptionsModel := &vpcv1.ListInstanceGroupManagersOptions{ - InstanceGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceGroupManagersPager(listInstanceGroupManagersOptionsModel) - 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(`CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) - Operation response error`, func() { - version := "testString" - 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(createInstanceGroupManagerPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateInstanceGroupManager 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 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 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.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.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions)`, func() { - version := "testString" - 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(createInstanceGroupManagerPath)) - 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{"testString"})) - 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/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 CreateInstanceGroupManager 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 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 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.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.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) - 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.CreateInstanceGroupManagerWithContext(ctx, createInstanceGroupManagerOptionsModel) - 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(createInstanceGroupManagerPath)) - 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{"testString"})) - 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/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 CreateInstanceGroupManager 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.CreateInstanceGroupManager(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 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.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateInstanceGroupManager 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 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 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.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 CreateInstanceGroupManagerOptions model with no property values - createInstanceGroupManagerOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModelNew) - 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 CreateInstanceGroupManager 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 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 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.CreateInstanceGroupManager(createInstanceGroupManagerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions)`, func() { - version := "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(deleteInstanceGroupManagerPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteInstanceGroupManager 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.DeleteInstanceGroupManager(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"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteInstanceGroupManager 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 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.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 DeleteInstanceGroupManagerOptions model with no property values - deleteInstanceGroupManagerOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroupManager(deleteInstanceGroupManagerOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) - Operation response error`, func() { - version := "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(getInstanceGroupManagerPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetInstanceGroupManager 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 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.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.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions)`, func() { - version := "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(getInstanceGroupManagerPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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 GetInstanceGroupManager 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 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.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.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) - 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.GetInstanceGroupManagerWithContext(ctx, getInstanceGroupManagerOptionsModel) - 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(getInstanceGroupManagerPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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 GetInstanceGroupManager 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.GetInstanceGroupManager(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetInstanceGroupManager 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 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.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 GetInstanceGroupManagerOptions model with no property values - getInstanceGroupManagerOptionsModelNew := new(vpcv1.GetInstanceGroupManagerOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroupManager(getInstanceGroupManagerOptionsModelNew) - 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 GetInstanceGroupManager 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 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.GetInstanceGroupManager(getInstanceGroupManagerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) - Operation response error`, func() { - version := "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(updateInstanceGroupManagerPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateInstanceGroupManager 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 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 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.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.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions)`, func() { - version := "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(updateInstanceGroupManagerPath)) - 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{"testString"})) - 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/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 UpdateInstanceGroupManager 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 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 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.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.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) - 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.UpdateInstanceGroupManagerWithContext(ctx, updateInstanceGroupManagerOptionsModel) - 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(updateInstanceGroupManagerPath)) - 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{"testString"})) - 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/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 UpdateInstanceGroupManager 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.UpdateInstanceGroupManager(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() - 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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateInstanceGroupManager 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 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 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.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 UpdateInstanceGroupManagerOptions model with no property values - updateInstanceGroupManagerOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModelNew) - 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 UpdateInstanceGroupManager 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 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 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.UpdateInstanceGroupManager(updateInstanceGroupManagerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) - Operation response error`, func() { - version := "testString" - 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(listInstanceGroupManagerActionsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListInstanceGroupManagerActions 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 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.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.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions)`, func() { - version := "testString" - 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(listInstanceGroupManagerActionsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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}`) - })) - }) - It(`Invoke ListInstanceGroupManagerActions 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 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.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.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) - 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.ListInstanceGroupManagerActionsWithContext(ctx, listInstanceGroupManagerActionsOptionsModel) - 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(listInstanceGroupManagerActionsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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}`) - })) - }) - It(`Invoke ListInstanceGroupManagerActions 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.ListInstanceGroupManagerActions(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListInstanceGroupManagerActions 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 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.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 ListInstanceGroupManagerActionsOptions model with no property values - listInstanceGroupManagerActionsOptionsModelNew := new(vpcv1.ListInstanceGroupManagerActionsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModelNew) - 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 ListInstanceGroupManagerActions 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 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.ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptionsModel) - 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.InstanceGroupManagerActionsCollection) - nextObject := new(vpcv1.InstanceGroupManagerActionsCollectionNext) - 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.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.InstanceGroupManagerActionsCollection) - nextObject := new(vpcv1.InstanceGroupManagerActionsCollectionNext) - 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(listInstanceGroupManagerActionsPath)) - 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,"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,"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 InstanceGroupManagerActionsPager.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()) - - listInstanceGroupManagerActionsOptionsModel := &vpcv1.ListInstanceGroupManagerActionsOptions{ - InstanceGroupID: core.StringPtr("testString"), - InstanceGroupManagerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceGroupManagerActionsPager(listInstanceGroupManagerActionsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.InstanceGroupManagerActionIntf - 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 InstanceGroupManagerActionsPager.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()) - - listInstanceGroupManagerActionsOptionsModel := &vpcv1.ListInstanceGroupManagerActionsOptions{ - InstanceGroupID: core.StringPtr("testString"), - InstanceGroupManagerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceGroupManagerActionsPager(listInstanceGroupManagerActionsOptionsModel) - 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(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) - Operation response error`, func() { - version := "testString" - 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(createInstanceGroupManagerActionPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateInstanceGroupManagerAction 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 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 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.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.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions)`, func() { - version := "testString" - 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(createInstanceGroupManagerActionPath)) - 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{"testString"})) - 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", `{"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 CreateInstanceGroupManagerAction 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 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 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.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.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) - 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.CreateInstanceGroupManagerActionWithContext(ctx, createInstanceGroupManagerActionOptionsModel) - 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(createInstanceGroupManagerActionPath)) - 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{"testString"})) - 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", `{"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 CreateInstanceGroupManagerAction 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.CreateInstanceGroupManagerAction(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 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.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateInstanceGroupManagerAction 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 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 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.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 CreateInstanceGroupManagerActionOptions model with no property values - createInstanceGroupManagerActionOptionsModelNew := new(vpcv1.CreateInstanceGroupManagerActionOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModelNew) - 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 CreateInstanceGroupManagerAction 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 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 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.CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions)`, func() { - version := "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(deleteInstanceGroupManagerActionPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteInstanceGroupManagerAction 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.DeleteInstanceGroupManagerAction(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"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteInstanceGroupManagerAction 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 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.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 DeleteInstanceGroupManagerActionOptions model with no property values - deleteInstanceGroupManagerActionOptionsModelNew := new(vpcv1.DeleteInstanceGroupManagerActionOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) - Operation response error`, func() { - version := "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(getInstanceGroupManagerActionPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetInstanceGroupManagerAction 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 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.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.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions)`, func() { - version := "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(getInstanceGroupManagerActionPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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 GetInstanceGroupManagerAction 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 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.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.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) - 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.GetInstanceGroupManagerActionWithContext(ctx, getInstanceGroupManagerActionOptionsModel) - 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(getInstanceGroupManagerActionPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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 GetInstanceGroupManagerAction 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.GetInstanceGroupManagerAction(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetInstanceGroupManagerAction 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 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.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 GetInstanceGroupManagerActionOptions model with no property values - getInstanceGroupManagerActionOptionsModelNew := new(vpcv1.GetInstanceGroupManagerActionOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModelNew) - 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 GetInstanceGroupManagerAction 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 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.GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) - Operation response error`, func() { - version := "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(updateInstanceGroupManagerActionPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateInstanceGroupManagerAction 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 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.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 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.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.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions)`, func() { - version := "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(updateInstanceGroupManagerActionPath)) - 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{"testString"})) - 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", `{"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 UpdateInstanceGroupManagerAction 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 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.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 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.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.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) - 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.UpdateInstanceGroupManagerActionWithContext(ctx, updateInstanceGroupManagerActionOptionsModel) - 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(updateInstanceGroupManagerActionPath)) - 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{"testString"})) - 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", `{"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 UpdateInstanceGroupManagerAction 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.UpdateInstanceGroupManagerAction(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.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 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.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateInstanceGroupManagerAction 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 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.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 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.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 UpdateInstanceGroupManagerActionOptions model with no property values - updateInstanceGroupManagerActionOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerActionOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModelNew) - 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 UpdateInstanceGroupManagerAction 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 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.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 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.UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) - Operation response error`, func() { - version := "testString" - 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(listInstanceGroupManagerPoliciesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListInstanceGroupManagerPolicies 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 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.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.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions)`, func() { - version := "testString" - 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(listInstanceGroupManagerPoliciesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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}`) - })) - }) - It(`Invoke ListInstanceGroupManagerPolicies 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 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.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.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) - 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.ListInstanceGroupManagerPoliciesWithContext(ctx, listInstanceGroupManagerPoliciesOptionsModel) - 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(listInstanceGroupManagerPoliciesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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}`) - })) - }) - It(`Invoke ListInstanceGroupManagerPolicies 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.ListInstanceGroupManagerPolicies(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListInstanceGroupManagerPolicies 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 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.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 ListInstanceGroupManagerPoliciesOptions model with no property values - listInstanceGroupManagerPoliciesOptionsModelNew := new(vpcv1.ListInstanceGroupManagerPoliciesOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModelNew) - 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 ListInstanceGroupManagerPolicies 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 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.ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptionsModel) - 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.InstanceGroupManagerPolicyCollection) - nextObject := new(vpcv1.InstanceGroupManagerPolicyCollectionNext) - 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.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.InstanceGroupManagerPolicyCollection) - nextObject := new(vpcv1.InstanceGroupManagerPolicyCollectionNext) - 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(listInstanceGroupManagerPoliciesPath)) - 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,"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,"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 InstanceGroupManagerPoliciesPager.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()) - - listInstanceGroupManagerPoliciesOptionsModel := &vpcv1.ListInstanceGroupManagerPoliciesOptions{ - InstanceGroupID: core.StringPtr("testString"), - InstanceGroupManagerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceGroupManagerPoliciesPager(listInstanceGroupManagerPoliciesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.InstanceGroupManagerPolicyIntf - 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 InstanceGroupManagerPoliciesPager.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()) - - listInstanceGroupManagerPoliciesOptionsModel := &vpcv1.ListInstanceGroupManagerPoliciesOptions{ - InstanceGroupID: core.StringPtr("testString"), - InstanceGroupManagerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceGroupManagerPoliciesPager(listInstanceGroupManagerPoliciesOptionsModel) - 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(`CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) - Operation response error`, func() { - version := "testString" - 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(createInstanceGroupManagerPolicyPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateInstanceGroupManagerPolicy 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 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"} - // 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()) - - // 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()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions)`, func() { - version := "testString" - 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{"testString"})) - 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 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{"testString"})) - 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()) - result, response, operationErr := vpcService.CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptionsModel) - 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) - // Invoke operation with invalid model (negative test) - 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(`DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions)`, func() { - version := "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{"testString"})) - 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 := "testString" - 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(getInstanceGroupManagerPolicyPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetInstanceGroupManagerPolicy 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 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.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.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions)`, func() { - version := "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(getInstanceGroupManagerPolicyPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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 GetInstanceGroupManagerPolicy 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 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.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.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) - 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.GetInstanceGroupManagerPolicyWithContext(ctx, getInstanceGroupManagerPolicyOptionsModel) - 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(getInstanceGroupManagerPolicyPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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 GetInstanceGroupManagerPolicy 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.GetInstanceGroupManagerPolicy(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetInstanceGroupManagerPolicy 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 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.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 GetInstanceGroupManagerPolicyOptions model with no property values - getInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.GetInstanceGroupManagerPolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModelNew) - 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 GetInstanceGroupManagerPolicy 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 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.GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) - Operation response error`, func() { - version := "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(updateInstanceGroupManagerPolicyPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateInstanceGroupManagerPolicy 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 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"} - // Expect response parsing to fail since we are receiving a text/plain response - 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.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions)`, func() { - version := "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(updateInstanceGroupManagerPolicyPath)) - 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{"testString"})) - 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/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 UpdateInstanceGroupManagerPolicy 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 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 a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, 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.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) - 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.UpdateInstanceGroupManagerPolicyWithContext(ctx, updateInstanceGroupManagerPolicyOptionsModel) - 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(updateInstanceGroupManagerPolicyPath)) - 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{"testString"})) - 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/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 UpdateInstanceGroupManagerPolicy 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.UpdateInstanceGroupManagerPolicy(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() - 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.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateInstanceGroupManagerPolicy 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 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 empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - 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 UpdateInstanceGroupManagerPolicyOptions model with no property values - updateInstanceGroupManagerPolicyOptionsModelNew := new(vpcv1.UpdateInstanceGroupManagerPolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModelNew) - 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 UpdateInstanceGroupManagerPolicy 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 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 - result, response, operationErr := vpcService.UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions)`, func() { - version := "testString" - 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{"testString"})) - 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 := "testString" - 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(listInstanceGroupMembershipsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListInstanceGroupMemberships 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 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.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.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions)`, func() { - version := "testString" - 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(listInstanceGroupMembershipsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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}`) - })) - }) - It(`Invoke ListInstanceGroupMemberships 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 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.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.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) - 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.ListInstanceGroupMembershipsWithContext(ctx, listInstanceGroupMembershipsOptionsModel) - 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(listInstanceGroupMembershipsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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}`) - })) - }) - It(`Invoke ListInstanceGroupMemberships 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.ListInstanceGroupMemberships(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListInstanceGroupMemberships 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 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.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() - }) - }) - 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 ListInstanceGroupMemberships 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 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.ListInstanceGroupMemberships(listInstanceGroupMembershipsOptionsModel) - 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.InstanceGroupMembershipCollection) - nextObject := new(vpcv1.InstanceGroupMembershipCollectionNext) - 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.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.InstanceGroupMembershipCollection) - nextObject := new(vpcv1.InstanceGroupMembershipCollectionNext) - 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(listInstanceGroupMembershipsPath)) - 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,"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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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", `{"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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"},"instance_template":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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 InstanceGroupMembershipsPager.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()) - - listInstanceGroupMembershipsOptionsModel := &vpcv1.ListInstanceGroupMembershipsOptions{ - InstanceGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceGroupMembershipsPager(listInstanceGroupMembershipsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.InstanceGroupMembership - 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 InstanceGroupMembershipsPager.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()) - - listInstanceGroupMembershipsOptionsModel := &vpcv1.ListInstanceGroupMembershipsOptions{ - InstanceGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewInstanceGroupMembershipsPager(listInstanceGroupMembershipsOptionsModel) - 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(`DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions)`, func() { - version := "testString" - 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(deleteInstanceGroupMembershipPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteInstanceGroupMembership 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.DeleteInstanceGroupMembership(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // 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 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 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 := "testString" - 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() - - // 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{"testString"})) - 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 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.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.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions)`, func() { - version := "testString" - 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(getInstanceGroupMembershipPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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 GetInstanceGroupMembership 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 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.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.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) - 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.GetInstanceGroupMembershipWithContext(ctx, getInstanceGroupMembershipOptionsModel) - 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(getInstanceGroupMembershipPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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 GetInstanceGroupMembership 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.GetInstanceGroupMembership(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetInstanceGroupMembership 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 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.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 GetInstanceGroupMembershipOptions model with no property values - getInstanceGroupMembershipOptionsModelNew := new(vpcv1.GetInstanceGroupMembershipOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModelNew) - 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 GetInstanceGroupMembership 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 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.GetInstanceGroupMembership(getInstanceGroupMembershipOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) - Operation response error`, func() { - version := "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(updateInstanceGroupMembershipPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateInstanceGroupMembership 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 InstanceGroupMembershipPatch model - instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) - 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.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.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions)`, func() { - version := "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(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{"testString"})) - 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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 UpdateInstanceGroupMembership 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 InstanceGroupMembershipPatch model - instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) - 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.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.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) - 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.UpdateInstanceGroupMembershipWithContext(ctx, updateInstanceGroupMembershipOptionsModel) - 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(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{"testString"})) - 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "instance_template": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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 UpdateInstanceGroupMembership 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.UpdateInstanceGroupMembership(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.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.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateInstanceGroupMembership 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 InstanceGroupMembershipPatch model - instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) - 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.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 UpdateInstanceGroupMembershipOptions model with no property values - updateInstanceGroupMembershipOptionsModelNew := new(vpcv1.UpdateInstanceGroupMembershipOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModelNew) - 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 UpdateInstanceGroupMembership 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 InstanceGroupMembershipPatch model - instanceGroupMembershipPatchModel := new(vpcv1.InstanceGroupMembershipPatch) - 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.UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) - Operation response error`, func() { - version := "testString" - 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(listDedicatedHostGroupsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListDedicatedHostGroups 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 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("testString") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") - 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.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.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions)`, func() { - version := "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(listDedicatedHostGroupsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["name"]).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/dedicated_host/groups?limit=20"}, "groups": [{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "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}`) - })) - }) - It(`Invoke ListDedicatedHostGroups 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 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("testString") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") - 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.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.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) - 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.ListDedicatedHostGroupsWithContext(ctx, listDedicatedHostGroupsOptionsModel) - 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(listDedicatedHostGroupsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["name"]).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/dedicated_host/groups?limit=20"}, "groups": [{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "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}`) - })) - }) - It(`Invoke ListDedicatedHostGroups 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.ListDedicatedHostGroups(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("testString") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListDedicatedHostGroups 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 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("testString") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") - 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.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) - 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 ListDedicatedHostGroups 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 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("testString") - listDedicatedHostGroupsOptionsModel.Name = core.StringPtr("testString") - listDedicatedHostGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListDedicatedHostGroups(listDedicatedHostGroupsOptionsModel) - 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.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":"mx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"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"}],"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":"mx2","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0","dedicated_hosts":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"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"}],"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("testString"), - Name: core.StringPtr("testString"), - } - - 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("testString"), - Name: core.StringPtr("testString"), - } - - 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 := "testString" - 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{"testString"})) - 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 CreateDedicatedHostGroup 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 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 CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - 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.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.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions)`, func() { - version := "testString" - 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(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{"testString"})) - 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", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "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() { - 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 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 CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - 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.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.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) - 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.CreateDedicatedHostGroupWithContext(ctx, createDedicatedHostGroupOptionsModel) - 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(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{"testString"})) - 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": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "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() { - 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.CreateDedicatedHostGroup(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 ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateDedicatedHostGroup 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 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 CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - 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.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) - 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(201) - })) - }) - It(`Invoke CreateDedicatedHostGroup 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") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := new(vpcv1.CreateDedicatedHostGroupOptions) - createDedicatedHostGroupOptionsModel.Class = core.StringPtr("mx2") - createDedicatedHostGroupOptionsModel.Family = core.StringPtr("balanced") - createDedicatedHostGroupOptionsModel.Name = core.StringPtr("testString") - createDedicatedHostGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createDedicatedHostGroupOptionsModel.Zone = zoneIdentityModel - createDedicatedHostGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateDedicatedHostGroup(createDedicatedHostGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions)`, func() { - version := "testString" - deleteDedicatedHostGroupPath := "/dedicated_host/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(deleteDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteDedicatedHostGroup 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.DeleteDedicatedHostGroup(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(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"} - - // 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 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) - 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(`GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) - Operation response error`, func() { - version := "testString" - 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(getDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetDedicatedHostGroup 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 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 := "testString" - 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")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "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 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.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.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) - 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.GetDedicatedHostGroupWithContext(ctx, getDedicatedHostGroupOptionsModel) - 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(getDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "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() { - 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.GetDedicatedHostGroup(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetDedicatedHostGroup 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 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.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 GetDedicatedHostGroupOptions model with no property values - getDedicatedHostGroupOptionsModelNew := new(vpcv1.GetDedicatedHostGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModelNew) - 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 GetDedicatedHostGroup 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 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.GetDedicatedHostGroup(getDedicatedHostGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) - Operation response error`, func() { - version := "testString" - 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(updateDedicatedHostGroupPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateDedicatedHostGroup 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 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"} - // 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()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions)`, func() { - version := "testString" - 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(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{"testString"})) - 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", `{"class": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke UpdateDedicatedHostGroup 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 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"} - - // 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) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) - 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.UpdateDedicatedHostGroupWithContext(ctx, updateDedicatedHostGroupOptionsModel) - 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(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{"testString"})) - 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": "mx2", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group:bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0", "dedicated_hosts": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "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"}], "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke UpdateDedicatedHostGroup 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.UpdateDedicatedHostGroup(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateDedicatedHostGroup 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 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"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - 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() - }) - }) - 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 UpdateDedicatedHostGroup 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 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"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateDedicatedHostGroup(updateDedicatedHostGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) - Operation response error`, func() { - version := "testString" - 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(listDedicatedHostProfilesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListDedicatedHostProfiles 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 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.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.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions)`, func() { - version := "testString" - 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(listDedicatedHostProfilesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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": "mx2", "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/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}], "total_count": 132}`) - })) - }) - It(`Invoke ListDedicatedHostProfiles 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 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.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.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) - 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.ListDedicatedHostProfilesWithContext(ctx, listDedicatedHostProfilesOptionsModel) - 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(listDedicatedHostProfilesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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": "mx2", "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/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}], "total_count": 132}`) - })) - }) - It(`Invoke ListDedicatedHostProfiles 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.ListDedicatedHostProfiles(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListDedicatedHostProfiles 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 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.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) - 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 ListDedicatedHostProfiles 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 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.ListDedicatedHostProfiles(listDedicatedHostProfilesOptionsModel) - 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.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() { - 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":"mx2","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/1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"class":"mx2","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/1e09281b-f177-46fb-baf1-bc152b2e391a","memory":{"type":"fixed","value":16},"name":"mx2-host-152x1216","socket_count":{"type":"fixed","value":2},"supported_instance_profiles":[{"href":"https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16","name":"bx2-4x16"}],"vcpu_architecture":{"type":"fixed","value":"amd64"},"vcpu_count":{"type":"fixed","value":16}}]}`) - } 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(`GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) - Operation response error`, func() { - version := "testString" - getDedicatedHostProfilePath := "/dedicated_host/profiles/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.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetDedicatedHostProfile 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 GetDedicatedHostProfileOptions model - getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) - getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") - 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.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.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions)`, func() { - version := "testString" - getDedicatedHostProfilePath := "/dedicated_host/profiles/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.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"class": "mx2", "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/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}`) - })) - }) - It(`Invoke GetDedicatedHostProfile 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 GetDedicatedHostProfileOptions model - getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) - getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") - 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.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.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) - 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.GetDedicatedHostProfileWithContext(ctx, getDedicatedHostProfileOptionsModel) - 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(getDedicatedHostProfilePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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": "mx2", "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/1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": {"type": "fixed", "value": 16}, "name": "mx2-host-152x1216", "socket_count": {"type": "fixed", "value": 2}, "supported_instance_profiles": [{"href": "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16", "name": "bx2-4x16"}], "vcpu_architecture": {"type": "fixed", "value": "amd64"}, "vcpu_count": {"type": "fixed", "value": 16}}`) - })) - }) - It(`Invoke GetDedicatedHostProfile 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.GetDedicatedHostProfile(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("testString") - getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetDedicatedHostProfile 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 GetDedicatedHostProfileOptions model - getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) - getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") - 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.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 GetDedicatedHostProfileOptions model with no property values - getDedicatedHostProfileOptionsModelNew := new(vpcv1.GetDedicatedHostProfileOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModelNew) - 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 GetDedicatedHostProfile 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 GetDedicatedHostProfileOptions model - getDedicatedHostProfileOptionsModel := new(vpcv1.GetDedicatedHostProfileOptions) - getDedicatedHostProfileOptionsModel.Name = core.StringPtr("testString") - getDedicatedHostProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetDedicatedHostProfile(getDedicatedHostProfileOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) - Operation response error`, func() { - version := "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(listDedicatedHostsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - 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() { - 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 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("testString") - listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") - 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) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions)`, func() { - version := "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(listDedicatedHostsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["name"]).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", `{"dedicated_hosts": [{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "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}`) - })) - }) - It(`Invoke ListDedicatedHosts 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 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("testString") - listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") - 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.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.ListDedicatedHosts(listDedicatedHostsOptionsModel) - 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.ListDedicatedHostsWithContext(ctx, listDedicatedHostsOptionsModel) - 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(listDedicatedHostsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - // 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}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "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}`) - })) - }) - It(`Invoke ListDedicatedHosts 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.ListDedicatedHosts(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("testString") - listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListDedicatedHosts 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 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("testString") - listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") - 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.ListDedicatedHosts(listDedicatedHostsOptionsModel) - 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 ListDedicatedHosts 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 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("testString") - listDedicatedHostsOptionsModel.Name = core.StringPtr("testString") - listDedicatedHostsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListDedicatedHosts(listDedicatedHostsOptionsModel) - 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.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},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}],"vcpu":{"architecture":"amd64","count":4},"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},"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","instance_placement_enabled":true,"instances":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","name":"my-instance"}],"lifecycle_state":"stable","memory":128,"name":"my-host","profile":{"href":"https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}],"vcpu":{"architecture":"amd64","count":4},"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("testString"), - Name: core.StringPtr("testString"), - } - - 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("testString"), - Name: core.StringPtr("testString"), - } - - 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() { - version := "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(createDedicatedHostPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateDedicatedHost 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 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"} - // Expect response parsing to fail since we are receiving a text/plain response - 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.CreateDedicatedHost(createDedicatedHostOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions)`, func() { - version := "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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke CreateDedicatedHost 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 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"} - - // 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) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) - 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.CreateDedicatedHostWithContext(ctx, createDedicatedHostOptionsModel) - 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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke CreateDedicatedHost 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.CreateDedicatedHost(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateDedicatedHost 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 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"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - 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 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() - }) - }) - 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 CreateDedicatedHost 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 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"} - - // Invoke operation - result, response, operationErr := vpcService.CreateDedicatedHost(createDedicatedHostOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) - Operation response error`, func() { - version := "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(listDedicatedHostDisksPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListDedicatedHostDisks 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 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.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.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions)`, func() { - version := "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(listDedicatedHostDisksPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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": [{"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"]}]}`) - })) - }) - It(`Invoke ListDedicatedHostDisks 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 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.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.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) - 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.ListDedicatedHostDisksWithContext(ctx, listDedicatedHostDisksOptionsModel) - 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(listDedicatedHostDisksPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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": [{"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"]}]}`) - })) - }) - It(`Invoke ListDedicatedHostDisks 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.ListDedicatedHostDisks(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListDedicatedHostDisks 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 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.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 ListDedicatedHostDisksOptions model with no property values - listDedicatedHostDisksOptionsModelNew := new(vpcv1.ListDedicatedHostDisksOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModelNew) - 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 ListDedicatedHostDisks 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 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.ListDedicatedHostDisks(listDedicatedHostDisksOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) - Operation response error`, func() { - version := "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(getDedicatedHostDiskPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetDedicatedHostDisk 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 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.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.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions)`, func() { - version := "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(getDedicatedHostDiskPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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"]}`) - })) - }) - It(`Invoke GetDedicatedHostDisk 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 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.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.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) - 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.GetDedicatedHostDiskWithContext(ctx, getDedicatedHostDiskOptionsModel) - 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(getDedicatedHostDiskPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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"]}`) - })) - }) - It(`Invoke GetDedicatedHostDisk 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.GetDedicatedHostDisk(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetDedicatedHostDisk 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 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.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 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() - }) - }) - 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 GetDedicatedHostDisk 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 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.GetDedicatedHostDisk(getDedicatedHostDiskOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) - Operation response error`, func() { - version := "testString" - 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(updateDedicatedHostDiskPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateDedicatedHostDisk 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 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"} - // 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.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions)`, func() { - version := "testString" - 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(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{"testString"})) - 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", `{"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"]}`) - })) - }) - It(`Invoke UpdateDedicatedHostDisk 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 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 with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, 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.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) - 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.UpdateDedicatedHostDiskWithContext(ctx, updateDedicatedHostDiskOptionsModel) - 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(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{"testString"})) - 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"]}`) - })) - }) - It(`Invoke UpdateDedicatedHostDisk 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.UpdateDedicatedHostDisk(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 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.UpdateDedicatedHostDisk(updateDedicatedHostDiskOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateDedicatedHostDisk 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 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 with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - 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() - }) - }) - 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 UpdateDedicatedHostDisk 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 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 := "testString" - 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() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteDedicatedHostPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()) - - // 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 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 valid options model (positive test) - response, operationErr = vpcService.DeleteDedicatedHost(deleteDedicatedHostOptionsModel) - 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()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) - Operation response error`, func() { - version := "testString" - 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(getDedicatedHostPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetDedicatedHost 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 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.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.GetDedicatedHost(getDedicatedHostOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions)`, func() { - version := "testString" - 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(getDedicatedHostPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke GetDedicatedHost 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 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.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.GetDedicatedHost(getDedicatedHostOptionsModel) - 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.GetDedicatedHostWithContext(ctx, getDedicatedHostOptionsModel) - 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(getDedicatedHostPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke GetDedicatedHost 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.GetDedicatedHost(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetDedicatedHost 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 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.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 GetDedicatedHostOptions model with no property values - getDedicatedHostOptionsModelNew := new(vpcv1.GetDedicatedHostOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetDedicatedHost(getDedicatedHostOptionsModelNew) - 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 GetDedicatedHost 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 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.GetDedicatedHost(getDedicatedHostOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) - Operation response error`, func() { - version := "testString" - 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(updateDedicatedHostPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateDedicatedHost 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 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"} - // 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()) - Expect(result).To(BeNil()) - - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions)`, func() { - version := "testString" - 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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"available_memory": 128, "available_vcpu": {"architecture": "amd64", "count": 4}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke UpdateDedicatedHost 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 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"} - - // 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) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) - 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.UpdateDedicatedHostWithContext(ctx, updateDedicatedHostOptionsModel) - 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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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}, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host: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/123456::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/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "instance_placement_enabled": true, "instances": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}], "lifecycle_state": "stable", "memory": 128, "name": "my-host", "profile": {"href": "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/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"}], "vcpu": {"architecture": "amd64", "count": 4}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) - })) - }) - It(`Invoke UpdateDedicatedHost 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.UpdateDedicatedHost(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateDedicatedHost 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 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"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - 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 UpdateDedicatedHostOptions model with no property values - updateDedicatedHostOptionsModelNew := new(vpcv1.UpdateDedicatedHostOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModelNew) - 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 UpdateDedicatedHost 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 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"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateDedicatedHost(updateDedicatedHostOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) - Operation response error`, func() { - version := "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(listBackupPoliciesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - 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 ListBackupPolicies 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 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("testString") - 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.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.ListBackupPolicies(listBackupPoliciesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions)`, func() { - version := "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(listBackupPoliciesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - 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_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}], "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}`) - })) - }) - It(`Invoke ListBackupPolicies 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 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("testString") - 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.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.ListBackupPolicies(listBackupPoliciesOptionsModel) - 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.ListBackupPoliciesWithContext(ctx, listBackupPoliciesOptionsModel) - 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(listBackupPoliciesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - 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_policies": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}], "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}`) - })) - }) - 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()) - - // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBackupPolicies(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("testString") - 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.ListBackupPolicies(listBackupPoliciesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListBackupPolicies 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 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("testString") - 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.ListBackupPolicies(listBackupPoliciesOptionsModel) - 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 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("testString") - 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.BackupPolicyCollectionNext) - 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.BackupPolicyCollectionNext) - 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/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6","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_resource_types":["volume"],"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","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"}],"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/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6","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_resource_types":["volume"],"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","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"}],"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{}, - 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("testString"), - Tag: core.StringPtr("testString"), - } - - pager, err := vpcService.NewBackupPoliciesPager(listBackupPoliciesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.BackupPolicy - 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 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("testString"), - 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(`CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) - Operation response error`, func() { - version := "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(createBackupPolicyPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateBackupPolicy 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 BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.MatchResourceTypes = []string{"volume"} - createBackupPolicyOptionsModel.MatchUserTags = []string{"my-daily-backup-policy"} - createBackupPolicyOptionsModel.Name = core.StringPtr("my-backup-policy") - createBackupPolicyOptionsModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - createBackupPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - 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.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.CreateBackupPolicy(createBackupPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions)`, func() { - version := "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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) - })) - }) - It(`Invoke CreateBackupPolicy 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 BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.MatchResourceTypes = []string{"volume"} - createBackupPolicyOptionsModel.MatchUserTags = []string{"my-daily-backup-policy"} - createBackupPolicyOptionsModel.Name = core.StringPtr("my-backup-policy") - createBackupPolicyOptionsModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - createBackupPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - 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.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.CreateBackupPolicy(createBackupPolicyOptionsModel) - 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.CreateBackupPolicyWithContext(ctx, createBackupPolicyOptionsModel) - 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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) - })) - }) - 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()) - - // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.CreateBackupPolicy(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // 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 BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.MatchResourceTypes = []string{"volume"} - createBackupPolicyOptionsModel.MatchUserTags = []string{"my-daily-backup-policy"} - createBackupPolicyOptionsModel.Name = core.StringPtr("my-backup-policy") - createBackupPolicyOptionsModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - createBackupPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateBackupPolicy 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 BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.MatchResourceTypes = []string{"volume"} - createBackupPolicyOptionsModel.MatchUserTags = []string{"my-daily-backup-policy"} - createBackupPolicyOptionsModel.Name = core.StringPtr("my-backup-policy") - createBackupPolicyOptionsModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - createBackupPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - 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.CreateBackupPolicy(createBackupPolicyOptionsModel) - 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(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 BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := new(vpcv1.CreateBackupPolicyOptions) - createBackupPolicyOptionsModel.MatchResourceTypes = []string{"volume"} - createBackupPolicyOptionsModel.MatchUserTags = []string{"my-daily-backup-policy"} - createBackupPolicyOptionsModel.Name = core.StringPtr("my-backup-policy") - createBackupPolicyOptionsModel.Plans = []vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel} - createBackupPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createBackupPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateBackupPolicy(createBackupPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) - Operation response error`, func() { - version := "testString" - 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(listBackupPolicyJobsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["status"]).To(Equal([]string{"testString"})) - 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{"testString"})) - 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() { - 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 ListBackupPolicyJobsOptions model - listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) - listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Status = core.StringPtr("testString") - 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("testString") - 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.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.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions)`, func() { - version := "testString" - 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(listBackupPolicyJobsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["status"]).To(Equal([]string{"testString"})) - 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{"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/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", "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/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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}`) - })) - }) - It(`Invoke ListBackupPolicyJobs 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 ListBackupPolicyJobsOptions model - listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) - listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Status = core.StringPtr("testString") - 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("testString") - 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.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.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) - 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.ListBackupPolicyJobsWithContext(ctx, listBackupPolicyJobsOptionsModel) - 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(listBackupPolicyJobsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["status"]).To(Equal([]string{"testString"})) - 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{"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/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", "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/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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}`) - })) - }) - It(`Invoke ListBackupPolicyJobs 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.ListBackupPolicyJobs(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("testString") - 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("testString") - listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListBackupPolicyJobs 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 ListBackupPolicyJobsOptions model - listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) - listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Status = core.StringPtr("testString") - 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("testString") - 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.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 ListBackupPolicyJobsOptions model with no property values - listBackupPolicyJobsOptionsModelNew := new(vpcv1.ListBackupPolicyJobsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModelNew) - 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 ListBackupPolicyJobs 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 ListBackupPolicyJobsOptions model - listBackupPolicyJobsOptionsModel := new(vpcv1.ListBackupPolicyJobsOptions) - listBackupPolicyJobsOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyJobsOptionsModel.Status = core.StringPtr("testString") - 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("testString") - listBackupPolicyJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListBackupPolicyJobs(listBackupPolicyJobsOptionsModel) - 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.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","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/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"Message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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","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/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"},"status":"failed","status_reasons":[{"code":"source_volume_busy","message":"Message","more_info":"https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}],"target_snapshots":[{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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("testString"), - BackupPolicyPlanID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - SourceID: core.StringPtr("testString"), - TargetSnapshotsID: core.StringPtr("testString"), - TargetSnapshotsCRN: core.StringPtr("testString"), - } - - 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("testString"), - BackupPolicyPlanID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - SourceID: core.StringPtr("testString"), - TargetSnapshotsID: core.StringPtr("testString"), - TargetSnapshotsCRN: core.StringPtr("testString"), - } - - 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() { - version := "testString" - 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(getBackupPolicyJobPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetBackupPolicyJob 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 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.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.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions)`, func() { - version := "testString" - 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(getBackupPolicyJobPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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", "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/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "resource_type": "snapshot"}]}`) - })) - }) - It(`Invoke GetBackupPolicyJob 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 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.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.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) - 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.GetBackupPolicyJobWithContext(ctx, getBackupPolicyJobOptionsModel) - 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(getBackupPolicyJobPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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", "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/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "status": "failed", "status_reasons": [{"code": "source_volume_busy", "message": "Message", "more_info": "https://cloud.ibm.com/docs/vpc?topic=vpc-troubleshooting-backup-for-vpc"}], "target_snapshots": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "resource_type": "snapshot"}]}`) - })) - }) - It(`Invoke GetBackupPolicyJob 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.GetBackupPolicyJob(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetBackupPolicyJob 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 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.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 GetBackupPolicyJobOptions model with no property values - getBackupPolicyJobOptionsModelNew := new(vpcv1.GetBackupPolicyJobOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBackupPolicyJob(getBackupPolicyJobOptionsModelNew) - 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 GetBackupPolicyJob 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 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.GetBackupPolicyJob(getBackupPolicyJobOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) - Operation response error`, func() { - version := "testString" - 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(listBackupPolicyPlansPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - 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("testString") - 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()) - - // 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()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions)`, func() { - version := "testString" - 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(listBackupPolicyPlansPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).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", `{"plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}]}`) - })) - }) - It(`Invoke ListBackupPolicyPlans 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 ListBackupPolicyPlansOptions model - listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) - listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Name = core.StringPtr("testString") - 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")) - - // 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()) - - // 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")) - }) - 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(listBackupPolicyPlansPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"plans": [{"active": true, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}]}`) - })) - }) - 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()) - - // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBackupPolicyPlans(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("testString") - listBackupPolicyPlansOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListBackupPolicyPlans 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 ListBackupPolicyPlansOptions model - listBackupPolicyPlansOptionsModel := new(vpcv1.ListBackupPolicyPlansOptions) - listBackupPolicyPlansOptionsModel.BackupPolicyID = core.StringPtr("testString") - listBackupPolicyPlansOptionsModel.Name = core.StringPtr("testString") - 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.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 ListBackupPolicyPlansOptions model with no property values - listBackupPolicyPlansOptionsModelNew := new(vpcv1.ListBackupPolicyPlansOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBackupPolicyPlans(listBackupPolicyPlansOptionsModelNew) - 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("testString") - 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() { - version := "testString" - 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(createBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // 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.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - 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.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.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions)`, func() { - version := "testString" - 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(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{"testString"})) - 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", `{"active": true, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}`) - })) - }) - It(`Invoke CreateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // 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.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - 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.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.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) - 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.CreateBackupPolicyPlanWithContext(ctx, createBackupPolicyPlanOptionsModel) - 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(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{"testString"})) - 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"], "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", "resource_type": "backup_policy_plan"}`) - })) - }) - It(`Invoke CreateBackupPolicyPlan 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.CreateBackupPolicyPlan(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // 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 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.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // 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.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - 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.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() - }) - }) - 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 CreateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - - // 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.CopyUserTags = core.BoolPtr(true) - createBackupPolicyPlanOptionsModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - createBackupPolicyPlanOptionsModel.Name = core.StringPtr("my-policy-plan") - createBackupPolicyPlanOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateBackupPolicyPlan(createBackupPolicyPlanOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) - Operation response error`, func() { - version := "testString" - 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(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{"testString"})) - 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 DeleteBackupPolicyPlan 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 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.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.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions)`, func() { - version := "testString" - 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(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{"testString"})) - 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", `{"active": true, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}`) - })) - }) - It(`Invoke DeleteBackupPolicyPlan 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 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.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.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) - 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.DeleteBackupPolicyPlanWithContext(ctx, deleteBackupPolicyPlanOptionsModel) - 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(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{"testString"})) - 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"], "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", "resource_type": "backup_policy_plan"}`) - })) - }) - It(`Invoke DeleteBackupPolicyPlan 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.DeleteBackupPolicyPlan(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke DeleteBackupPolicyPlan 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 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.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 DeleteBackupPolicyPlanOptions model with no property values - deleteBackupPolicyPlanOptionsModelNew := new(vpcv1.DeleteBackupPolicyPlanOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModelNew) - 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 DeleteBackupPolicyPlan 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 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.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) - Operation response error`, func() { - version := "testString" - 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(getBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetBackupPolicyPlan 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 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.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.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions)`, func() { - version := "testString" - 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(getBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}`) - })) - }) - It(`Invoke GetBackupPolicyPlan 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 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.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.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) - 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.GetBackupPolicyPlanWithContext(ctx, getBackupPolicyPlanOptionsModel) - 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(getBackupPolicyPlanPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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"], "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", "resource_type": "backup_policy_plan"}`) - })) - }) - It(`Invoke GetBackupPolicyPlan 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.GetBackupPolicyPlan(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetBackupPolicyPlan 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 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.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() - }) - }) - 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 GetBackupPolicyPlan 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 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.GetBackupPolicyPlan(getBackupPolicyPlanOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) - Operation response error`, func() { - version := "testString" - 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(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{"testString"})) - 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 UpdateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(38)) - - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - 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.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.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions)`, func() { - version := "testString" - 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(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.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{"testString"})) - 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, "attach_user_tags": ["AttachUserTags"], "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", "resource_type": "backup_policy_plan"}`) - })) - }) - It(`Invoke UpdateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(38)) - - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - 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.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.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) - 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.UpdateBackupPolicyPlanWithContext(ctx, updateBackupPolicyPlanOptionsModel) - 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(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.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{"testString"})) - 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"], "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", "resource_type": "backup_policy_plan"}`) - })) - }) - It(`Invoke UpdateBackupPolicyPlan 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.UpdateBackupPolicyPlan(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(38)) - - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - 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.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(38)) - - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - 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.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 UpdateBackupPolicyPlanOptions model with no property values - updateBackupPolicyPlanOptionsModelNew := new(vpcv1.UpdateBackupPolicyPlanOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModelNew) - 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 UpdateBackupPolicyPlan 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 BackupPolicyPlanDeletionTriggerPatch model - backupPolicyPlanDeletionTriggerPatchModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPatch) - backupPolicyPlanDeletionTriggerPatchModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPatchModel.DeleteOverCount = core.Int64Ptr(int64(38)) - - // Construct an instance of the BackupPolicyPlanPatch model - backupPolicyPlanPatchModel := new(vpcv1.BackupPolicyPlanPatch) - backupPolicyPlanPatchModel.Active = core.BoolPtr(true) - backupPolicyPlanPatchModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPatchModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPatchModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPatchModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPatchModel - backupPolicyPlanPatchModel.Name = core.StringPtr("my-policy-plan") - 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.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) - Operation response error`, func() { - version := "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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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 DeleteBackupPolicy 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 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.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.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions)`, func() { - version := "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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) - })) - }) - It(`Invoke DeleteBackupPolicy 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 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.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.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) - 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.DeleteBackupPolicyWithContext(ctx, deleteBackupPolicyOptionsModel) - 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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) - })) - }) - It(`Invoke DeleteBackupPolicy 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.DeleteBackupPolicy(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke DeleteBackupPolicy 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 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.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 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() - }) - }) - 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 DeleteBackupPolicy 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 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.DeleteBackupPolicy(deleteBackupPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) - Operation response error`, func() { - version := "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(getBackupPolicyPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetBackupPolicy 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 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.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.GetBackupPolicy(getBackupPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions)`, func() { - version := "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(getBackupPolicyPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) - })) - }) - It(`Invoke GetBackupPolicy 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 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.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.GetBackupPolicy(getBackupPolicyOptionsModel) - 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.GetBackupPolicyWithContext(ctx, getBackupPolicyOptionsModel) - 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(getBackupPolicyPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) - })) - }) - It(`Invoke GetBackupPolicy 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.GetBackupPolicy(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetBackupPolicy 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 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.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 GetBackupPolicyOptions model with no property values - getBackupPolicyOptionsModelNew := new(vpcv1.GetBackupPolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBackupPolicy(getBackupPolicyOptionsModelNew) - 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 GetBackupPolicy 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 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.GetBackupPolicy(getBackupPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) - Operation response error`, func() { - version := "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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateBackupPolicy 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 BackupPolicyPatch model - backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) - 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"} - // Expect response parsing to fail since we are receiving a text/plain response - 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.UpdateBackupPolicy(updateBackupPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions)`, func() { - version := "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(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.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{"testString"})) - 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/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) - })) - }) - It(`Invoke UpdateBackupPolicy 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 BackupPolicyPatch model - backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) - 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"} - - // 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) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) - 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.UpdateBackupPolicyWithContext(ctx, updateBackupPolicyOptionsModel) - 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(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.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{"testString"})) - 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/123456::backup-policy:r134-076191ba-49c2-4763-94fd-c70de73ee2e6", "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_resource_types": ["volume"], "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", "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"}`) - })) - }) - It(`Invoke UpdateBackupPolicy 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.UpdateBackupPolicy(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.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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateBackupPolicy 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 BackupPolicyPatch model - backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) - 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"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - 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 UpdateBackupPolicyOptions model with no property values - updateBackupPolicyOptionsModelNew := new(vpcv1.UpdateBackupPolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModelNew) - 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 UpdateBackupPolicy 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 BackupPolicyPatch model - backupPolicyPatchModel := new(vpcv1.BackupPolicyPatch) - 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"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateBackupPolicy(updateBackupPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) - Operation response error`, func() { - version := "testString" - 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(listPlacementGroupsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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() { - 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 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) - 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) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions)`, func() { - version := "testString" - 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(listPlacementGroupsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::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}`) - })) - }) - It(`Invoke ListPlacementGroups 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 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.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.ListPlacementGroups(listPlacementGroupsOptionsModel) - 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.ListPlacementGroupsWithContext(ctx, listPlacementGroupsOptionsModel) - 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(listPlacementGroupsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::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}`) - })) - }) - It(`Invoke ListPlacementGroups 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.ListPlacementGroups(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListPlacementGroups(listPlacementGroupsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListPlacementGroups 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 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.ListPlacementGroups(listPlacementGroupsOptionsModel) - 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 ListPlacementGroups 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 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.ListPlacementGroups(listPlacementGroupsOptionsModel) - 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.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() { - 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")) - - // 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/123456::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/123456::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) - } - })) - }) - It(`Use PlacementGroupsPager.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()) - - listPlacementGroupsOptionsModel := &vpcv1.ListPlacementGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewPlacementGroupsPager(listPlacementGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - 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)) - }) - It(`Use PlacementGroupsPager.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()) - - 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() - Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) - }) - }) - }) - Describe(`CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) - Operation response error`, func() { - version := "testString" - 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(createPlacementGroupPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreatePlacementGroup 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 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.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.CreatePlacementGroup(createPlacementGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions)`, func() { - version := "testString" - 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(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{"testString"})) - 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::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 CreatePlacementGroup 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 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.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.CreatePlacementGroup(createPlacementGroupOptionsModel) - 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.CreatePlacementGroupWithContext(ctx, createPlacementGroupOptionsModel) - 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(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{"testString"})) - 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/123456::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 CreatePlacementGroup 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.CreatePlacementGroup(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreatePlacementGroup 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 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.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 CreatePlacementGroupOptions model with no property values - createPlacementGroupOptionsModelNew := new(vpcv1.CreatePlacementGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreatePlacementGroup(createPlacementGroupOptionsModelNew) - 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 CreatePlacementGroup 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") - - // 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.CreatePlacementGroup(createPlacementGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions)`, func() { - version := "testString" - 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{"testString"})) - 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 := "testString" - 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(getPlacementGroupPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 := "testString" - 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{"testString"})) - 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/123456::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{"testString"})) - 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/123456::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 := "testString" - 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{"testString"})) - 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 := "testString" - 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.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{"testString"})) - 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/123456::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 UpdatePlacementGroup 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 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"} - - // 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) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) - 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.UpdatePlacementGroupWithContext(ctx, updatePlacementGroupOptionsModel) - 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(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()) - - // 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{"testString"})) - 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/123456::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 UpdatePlacementGroup 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.UpdatePlacementGroup(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() - 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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdatePlacementGroup 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 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"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - 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 UpdatePlacementGroupOptions model with no property values - updatePlacementGroupOptionsModelNew := new(vpcv1.UpdatePlacementGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModelNew) - 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 UpdatePlacementGroup 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 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"} - - // Invoke operation - result, response, operationErr := vpcService.UpdatePlacementGroup(updatePlacementGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) - Operation response error`, func() { - version := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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/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}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}}], "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{"testString"})) - 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/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}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}}], "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.BareMetalServerProfileCollectionNext) - 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.BareMetalServerProfileCollectionNext) - 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},"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","os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["disabled"]}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"bandwidth":{"type":"fixed","value":20000},"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","os_architecture":{"default":"amd64","type":"enum","values":["amd64"]},"resource_type":"bare_metal_server_profile","supported_trusted_platform_module_modes":{"type":"enum","values":["disabled"]}}]}`) - } 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 := "testString" - getBareMetalServerProfilePath := "/bare_metal_server/profiles/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(getBareMetalServerProfilePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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("testString") - 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 := "testString" - getBareMetalServerProfilePath := "/bare_metal_server/profiles/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(getBareMetalServerProfilePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}}`) - })) - }) - 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("testString") - 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{"testString"})) - 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}, "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", "os_architecture": {"default": "amd64", "type": "enum", "values": ["amd64"]}, "resource_type": "bare_metal_server_profile", "supported_trusted_platform_module_modes": {"type": "enum", "values": ["disabled"]}}`) - })) - }) - 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("testString") - 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("testString") - 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("testString") - 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 := "testString" - 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{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["network_interfaces.subnet.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["network_interfaces.subnet.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["network_interfaces.subnet.name"]).To(Equal([]string{"testString"})) - 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("testString") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetID = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetCRN = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetName = core.StringPtr("testString") - 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 := "testString" - 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{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["network_interfaces.subnet.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["network_interfaces.subnet.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["network_interfaces.subnet.name"]).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", `{"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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) - })) - }) - 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("testString") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetID = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetCRN = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetName = core.StringPtr("testString") - 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{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["network_interfaces.subnet.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["network_interfaces.subnet.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["network_interfaces.subnet.name"]).To(Equal([]string{"testString"})) - // 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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) - })) - }) - 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("testString") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetID = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetCRN = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetName = core.StringPtr("testString") - 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("testString") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetID = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetCRN = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetName = core.StringPtr("testString") - 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("testString") - listBareMetalServersOptionsModel.VPCID = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCCRN = core.StringPtr("testString") - listBareMetalServersOptionsModel.VPCName = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetID = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetCRN = core.StringPtr("testString") - listBareMetalServersOptionsModel.NetworkInterfacesSubnetName = core.StringPtr("testString") - 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.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() { - 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/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/123456::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,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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/123456::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,"href":"https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-bc152b2e391a","memory":1536,"name":"my-bare-metal-server","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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}}],"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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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("testString"), - VPCID: core.StringPtr("testString"), - VPCCRN: core.StringPtr("testString"), - VPCName: core.StringPtr("testString"), - NetworkInterfacesSubnetID: core.StringPtr("testString"), - NetworkInterfacesSubnetCRN: core.StringPtr("testString"), - NetworkInterfacesSubnetName: core.StringPtr("testString"), - } - - 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("testString"), - VPCID: core.StringPtr("testString"), - VPCCRN: core.StringPtr("testString"), - VPCName: core.StringPtr("testString"), - NetworkInterfacesSubnetID: core.StringPtr("testString"), - NetworkInterfacesSubnetCRN: core.StringPtr("testString"), - NetworkInterfacesSubnetName: core.StringPtr("testString"), - } - - 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 := "testString" - 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{"testString"})) - 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("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 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 BareMetalServerPrimaryNetworkInterfacePrototype model - bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // 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-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // 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("4727d842-f94f-4a2d-824a-9bc9b02c523b") - - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel - createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel - createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel - createBareMetalServerOptionsModel.Zone = zoneIdentityModel - createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) - createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") - createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} - createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - createBareMetalServerOptionsModel.VPC = vpcIdentityModel - 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 := "testString" - 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{"testString"})) - 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/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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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("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 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 BareMetalServerPrimaryNetworkInterfacePrototype model - bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // 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-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // 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("4727d842-f94f-4a2d-824a-9bc9b02c523b") - - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel - createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel - createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel - createBareMetalServerOptionsModel.Zone = zoneIdentityModel - createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) - createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") - createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} - createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - createBareMetalServerOptionsModel.VPC = vpcIdentityModel - 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{"testString"})) - 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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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("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 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 BareMetalServerPrimaryNetworkInterfacePrototype model - bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // 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-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // 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("4727d842-f94f-4a2d-824a-9bc9b02c523b") - - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel - createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel - createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel - createBareMetalServerOptionsModel.Zone = zoneIdentityModel - createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) - createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") - createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} - createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - createBareMetalServerOptionsModel.VPC = vpcIdentityModel - 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("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 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 BareMetalServerPrimaryNetworkInterfacePrototype model - bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // 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-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // 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("4727d842-f94f-4a2d-824a-9bc9b02c523b") - - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel - createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel - createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel - createBareMetalServerOptionsModel.Zone = zoneIdentityModel - createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) - createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") - createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} - createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - createBareMetalServerOptionsModel.VPC = vpcIdentityModel - 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("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 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 BareMetalServerPrimaryNetworkInterfacePrototype model - bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // 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-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - - // 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("4727d842-f94f-4a2d-824a-9bc9b02c523b") - - // Construct an instance of the CreateBareMetalServerOptions model - createBareMetalServerOptionsModel := new(vpcv1.CreateBareMetalServerOptions) - createBareMetalServerOptionsModel.Initialization = bareMetalServerInitializationPrototypeModel - createBareMetalServerOptionsModel.PrimaryNetworkInterface = bareMetalServerPrimaryNetworkInterfacePrototypeModel - createBareMetalServerOptionsModel.Profile = bareMetalServerProfileIdentityModel - createBareMetalServerOptionsModel.Zone = zoneIdentityModel - createBareMetalServerOptionsModel.EnableSecureBoot = core.BoolPtr(false) - createBareMetalServerOptionsModel.Name = core.StringPtr("my-bare-metal-server") - createBareMetalServerOptionsModel.NetworkInterfaces = []vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel} - createBareMetalServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createBareMetalServerOptionsModel.TrustedPlatformModule = bareMetalServerTrustedPlatformModulePrototypeModel - createBareMetalServerOptionsModel.VPC = vpcIdentityModel - 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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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": "VGhpcyBJcyBhIHRva2Vu", "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=VGhpcyBJcyBhIHRva2Vu"}`) - })) - }) - 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{"testString"})) - 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": "VGhpcyBJcyBhIHRva2Vu", "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=VGhpcyBJcyBhIHRva2Vu"}`) - })) - }) - 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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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/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}]}`) - })) - }) - 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{"testString"})) - 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/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}]}`) - })) - }) - 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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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/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}`) - })) - }) - 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{"testString"})) - 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}`) - })) - }) - 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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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/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}`) - })) - }) - 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{"testString"})) - 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}`) - })) - }) - 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(`ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) - Operation response error`, func() { - version := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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}`) - })) - }) - 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{"testString"})) - 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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}`) - })) - }) - 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.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/123456::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:0a:00:23:94","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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/123456::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:0a:00:23:94","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"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 := "testString" - 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{"testString"})) - 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("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-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 := "testString" - 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{"testString"})) - 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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("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-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{"testString"})) - 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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("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-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("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-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("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-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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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{"testString"})) - 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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 := "testString" - 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{"testString"})) - 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-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 := "testString" - 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{"testString"})) - 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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-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{"testString"})) - 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/123456::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:0a:00:23:94", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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-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-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-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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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}`) - })) - }) - 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{"testString"})) - 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": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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}`) - })) - }) - 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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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{"testString"})) - 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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/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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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{"testString"})) - 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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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 := "testString" - 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{"testString"})) - 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.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 := "testString" - 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{"testString"})) - 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/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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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.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{"testString"})) - 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/123456::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, "href": "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "memory": 1536, "name": "my-bare-metal-server", "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}}], "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-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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.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.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.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(`GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) - Operation response error`, func() { - version := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "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/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "user_accounts": [{"encrypted_password": "VGhpcyBpcyBhbiBlbmNvZGVkIGJ5dGUgYXJyYXku", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "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/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}, "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{"testString"})) - 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/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "keys": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "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/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}], "user_accounts": [{"encrypted_password": "VGhpcyBpcyBhbiBlbmNvZGVkIGJ5dGUgYXJyYXku", "encryption_key": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803", "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/a6b1a881-2ce8-41a3-80fc-36316a73f803", "id": "a6b1a881-2ce8-41a3-80fc-36316a73f803", "name": "my-key"}, "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(`RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions)`, func() { - version := "testString" - 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{"testString"})) - 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()) - - // 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 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 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 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 := "testString" - 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() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(startBareMetalServerPath)) - Expect(req.Method).To(Equal("POST")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()) - - // 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 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 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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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 := "testString" - 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{"testString"})) - 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": [{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "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{"testString"})) - 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": [{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "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.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() - - // 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":[{"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","name":"general-purpose"}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"family":"tiered","href":"https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose","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()) - - listVolumeProfilesOptionsModel := &vpcv1.ListVolumeProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewVolumeProfilesPager(listVolumeProfilesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - 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()) - - listVolumeProfilesOptionsModel := &vpcv1.ListVolumeProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewVolumeProfilesPager(listVolumeProfilesOptionsModel) - 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(`GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) - Operation response error`, func() { - version := "testString" - getVolumeProfilePath := "/volume/profiles/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.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVolumeProfile 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 GetVolumeProfileOptions model - getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) - getVolumeProfileOptionsModel.Name = core.StringPtr("testString") - 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.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.GetVolumeProfile(getVolumeProfileOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions)`, func() { - version := "testString" - getVolumeProfilePath := "/volume/profiles/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.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}`) - })) - }) - It(`Invoke GetVolumeProfile 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 GetVolumeProfileOptions model - getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) - getVolumeProfileOptionsModel.Name = core.StringPtr("testString") - 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.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.GetVolumeProfile(getVolumeProfileOptionsModel) - 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.GetVolumeProfileWithContext(ctx, getVolumeProfileOptionsModel) - 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(getVolumeProfilePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"family": "tiered", "href": "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose", "name": "general-purpose"}`) - })) - }) - It(`Invoke GetVolumeProfile 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.GetVolumeProfile(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("testString") - getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVolumeProfile 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 GetVolumeProfileOptions model - getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) - getVolumeProfileOptionsModel.Name = core.StringPtr("testString") - 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.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 GetVolumeProfileOptions model with no property values - getVolumeProfileOptionsModelNew := new(vpcv1.GetVolumeProfileOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVolumeProfile(getVolumeProfileOptionsModelNew) - 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 GetVolumeProfile 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 GetVolumeProfileOptions model - getVolumeProfileOptionsModel := new(vpcv1.GetVolumeProfileOptions) - getVolumeProfileOptionsModel.Name = core.StringPtr("testString") - getVolumeProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVolumeProfile(getVolumeProfileOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVolumes(listVolumesOptions *ListVolumesOptions) - Operation response error`, func() { - version := "testString" - 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(listVolumesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["zone.name"]).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() { - 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("testString") - listVolumesOptionsModel.ZoneName = 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.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.ListVolumes(listVolumesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVolumes(listVolumesOptions *ListVolumesOptions)`, func() { - version := "testString" - 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(listVolumesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["zone.name"]).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"}, "volumes": [{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 ListVolumes 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 ListVolumesOptions model - listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) - listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumesOptionsModel.Name = core.StringPtr("testString") - listVolumesOptionsModel.ZoneName = 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.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.ListVolumes(listVolumesOptionsModel) - 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.ListVolumesWithContext(ctx, listVolumesOptionsModel) - 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(listVolumesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["zone.name"]).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"}, "volumes": [{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 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()) - - // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListVolumes(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("testString") - listVolumesOptionsModel.ZoneName = 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.ListVolumes(listVolumesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListVolumes 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 ListVolumesOptions model - listVolumesOptionsModel := new(vpcv1.ListVolumesOptions) - listVolumesOptionsModel.Start = core.StringPtr("testString") - listVolumesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVolumesOptionsModel.Name = core.StringPtr("testString") - listVolumesOptionsModel.ZoneName = 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.ListVolumes(listVolumesOptionsModel) - 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("testString") - listVolumesOptionsModel.ZoneName = 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 - 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() { - 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,"bandwidth":1000,"busy":true,"capacity":1000,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64"},"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"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-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,"bandwidth":1000,"busy":true,"capacity":1000,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5","encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","iops":10000,"name":"my-volume","operating_system":{"href":"https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64","name":"ubuntu-16-amd64"},"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"},"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image"},"source_snapshot":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::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","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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a","id":"82cbf856-9cbb-45fb-b62f-d7bcef32399a","instance":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a","id":"1e09281b-f177-46fb-baf1-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() { - 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("testString"), - ZoneName: 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("testString"), - ZoneName: 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(`CreateVolume(createVolumeOptions *CreateVolumeOptions) - Operation response error`, func() { - version := "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(createVolumePath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateVolume 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("5iops-tier") - - // 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/dffc98a0f1f0f95f6613b3b752286b87: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{"testString"} - 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.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.CreateVolume(createVolumeOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateVolume(createVolumeOptions *CreateVolumeOptions)`, func() { - version := "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(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{"testString"})) - 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", `{"active": true, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 CreateVolume 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("5iops-tier") - - // 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/dffc98a0f1f0f95f6613b3b752286b87: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{"testString"} - 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.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.CreateVolume(createVolumeOptionsModel) - 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.CreateVolumeWithContext(ctx, createVolumeOptionsModel) - 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(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{"testString"})) - 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, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 CreateVolume 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.CreateVolume(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("5iops-tier") - - // 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/dffc98a0f1f0f95f6613b3b752286b87: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{"testString"} - 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.CreateVolume(createVolumeOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateVolume 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 VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - volumeProfileIdentityModel.Name = core.StringPtr("5iops-tier") - - // 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/dffc98a0f1f0f95f6613b3b752286b87: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{"testString"} - 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.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 CreateVolumeOptions model with no property values - createVolumeOptionsModelNew := new(vpcv1.CreateVolumeOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateVolume(createVolumeOptionsModelNew) - 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 CreateVolume 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("5iops-tier") - - // 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/dffc98a0f1f0f95f6613b3b752286b87: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{"testString"} - 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.CreateVolume(createVolumeOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions)`, func() { - version := "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{"testString"})) - 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 := "testString" - 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(getVolumePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVolume 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 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.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.GetVolume(getVolumeOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVolume(getVolumeOptions *GetVolumeOptions)`, func() { - version := "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(getVolumePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 GetVolume 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 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.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.GetVolume(getVolumeOptionsModel) - 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.GetVolumeWithContext(ctx, getVolumeOptionsModel) - 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(getVolumePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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 GetVolume 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.GetVolume(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVolume 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 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.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 GetVolumeOptions model with no property values - getVolumeOptionsModelNew := new(vpcv1.GetVolumeOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVolume(getVolumeOptionsModelNew) - 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 GetVolume 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 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.GetVolume(getVolumeOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) - Operation response error`, func() { - version := "testString" - 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{"testString"})) - 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() { - version := "testString" - 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{"testString"})) - 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, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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() - }) - }) - 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")) - - // 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{"testString"})) - 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, "bandwidth": 1000, "busy": true, "capacity": 1000, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "iops": 10000, "name": "my-volume", "operating_system": {"href": "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64", "name": "ubuntu-16-amd64"}, "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"}, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_snapshot": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::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", "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/1e09281b-f177-46fb-baf1-bc152b2e391a/volume_attachments/82cbf856-9cbb-45fb-b62f-d7bcef32399a", "id": "82cbf856-9cbb-45fb-b62f-d7bcef32399a", "instance": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-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`, func() { - 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.UpdateVolume(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateVolume 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 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.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 UpdateVolumeOptions model with no property values - updateVolumeOptionsModelNew := new(vpcv1.UpdateVolumeOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateVolume(updateVolumeOptionsModelNew) - 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(`DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions)`, func() { - version := "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(deleteSnapshotsPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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(204) - })) - }) - It(`Invoke DeleteSnapshots 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.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 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()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) - Operation response error`, func() { - version := "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(listSnapshotsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"testString"})) - 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 ListSnapshots 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 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("testString") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - 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.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.ListSnapshots(listSnapshotsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions)`, func() { - version := "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(listSnapshotsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"testString"})) - 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/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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}], "total_count": 132}`) - })) - }) - It(`Invoke ListSnapshots 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 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("testString") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - 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.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.ListSnapshots(listSnapshotsOptionsModel) - 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.ListSnapshotsWithContext(ctx, listSnapshotsOptionsModel) - 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(listSnapshotsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["source_volume.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_volume.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_image.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["source_image.crn"]).To(Equal([]string{"testString"})) - 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/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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}], "total_count": 132}`) - })) - }) - 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()) - - // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListSnapshots(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("testString") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - listSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListSnapshots(listSnapshotsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListSnapshots 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 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("testString") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - 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.ListSnapshots(listSnapshotsOptionsModel) - 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 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("testString") - listSnapshotsOptionsModel.SourceVolumeID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceVolumeCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageID = core.StringPtr("testString") - listSnapshotsOptionsModel.SourceImageCRN = core.StringPtr("testString") - listSnapshotsOptionsModel.Sort = core.StringPtr("name") - listSnapshotsOptionsModel.BackupPolicyPlanID = core.StringPtr("testString") - 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(`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() { - 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")) - - // 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","resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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":{"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-16-amd64","name":"ubuntu-16-amd64","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,"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-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","resource_type":"backup_policy_plan"},"bootable":true,"captured_at":"2019-01-01T12:00:00.000Z","created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263","deletable":false,"encryption":"provider_managed","encryption_key":{"crn":"crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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":{"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-16-amd64","name":"ubuntu-16-amd64","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,"source_image":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","id":"72b27b5c-f4b0-48bb-b954-5becc7c1dcb8","name":"my-image"},"source_volume":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5","id":"1a6b7274-678d-4dfb-8981-c71dd9d4daa5","name":"my-volume"},"user_tags":["UserTags"]}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use SnapshotsPager.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()) - - listSnapshotsOptionsModel := &vpcv1.ListSnapshotsOptions{ - Limit: core.Int64Ptr(int64(10)), - Tag: core.StringPtr("testString"), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - SourceVolumeID: core.StringPtr("testString"), - SourceVolumeCRN: core.StringPtr("testString"), - SourceImageID: core.StringPtr("testString"), - SourceImageCRN: core.StringPtr("testString"), - Sort: core.StringPtr("name"), - BackupPolicyPlanID: core.StringPtr("testString"), - } - - pager, err := vpcService.NewSnapshotsPager(listSnapshotsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(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)) - }) - 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("testString"), - SourceVolumeID: core.StringPtr("testString"), - SourceVolumeCRN: core.StringPtr("testString"), - SourceImageID: core.StringPtr("testString"), - SourceImageCRN: core.StringPtr("testString"), - Sort: core.StringPtr("name"), - BackupPolicyPlanID: core.StringPtr("testString"), - } - - 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(`CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) - Operation response error`, func() { - version := "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(createSnapshotPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateSnapshot 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 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("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{"testString"} - 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.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.CreateSnapshot(createSnapshotOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions)`, func() { - version := "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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}`) - })) - }) - It(`Invoke CreateSnapshot 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 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("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{"testString"} - 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.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.CreateSnapshot(createSnapshotOptionsModel) - 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.CreateSnapshotWithContext(ctx, createSnapshotOptionsModel) - 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(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.Query()["version"]).To(Equal([]string{"testString"})) - 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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}`) - })) - }) - It(`Invoke CreateSnapshot 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.CreateSnapshot(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("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{"testString"} - 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.CreateSnapshot(createSnapshotOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateSnapshot 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("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{"testString"} - 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.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 CreateSnapshotOptions model with no property values - createSnapshotOptionsModelNew := new(vpcv1.CreateSnapshotOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateSnapshot(createSnapshotOptionsModelNew) - 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 CreateSnapshot 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") - - // Construct an instance of the VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{"testString"} - 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.CreateSnapshot(createSnapshotOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions)`, func() { - version := "testString" - 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{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - 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 := "testString" - 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(getSnapshotPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetSnapshot 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 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.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.GetSnapshot(getSnapshotOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSnapshot(getSnapshotOptions *GetSnapshotOptions)`, func() { - version := "testString" - 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(getSnapshotPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}`) - })) - }) - It(`Invoke GetSnapshot 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 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.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.GetSnapshot(getSnapshotOptionsModel) - 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.GetSnapshotWithContext(ctx, getSnapshotOptionsModel) - 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(getSnapshotPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}`) - })) - }) - It(`Invoke GetSnapshot 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.GetSnapshot(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSnapshot(getSnapshotOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetSnapshot 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 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.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 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() - }) - }) - 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 GetSnapshot 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 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.GetSnapshot(getSnapshotOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) - Operation response error`, func() { - version := "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(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{"testString"})) - 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 UpdateSnapshot 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 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.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.UpdateSnapshot(updateSnapshotOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions)`, func() { - version := "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(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{"testString"})) - 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", `{"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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}`) - })) - }) - It(`Invoke UpdateSnapshot 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 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.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.UpdateSnapshot(updateSnapshotOptionsModel) - 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.UpdateSnapshotWithContext(ctx, updateSnapshotOptionsModel) - 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(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{"testString"})) - 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", "resource_type": "backup_policy_plan"}, "bootable": true, "captured_at": "2019-01-01T12:00:00.000Z", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263", "deletable": false, "encryption": "provider_managed", "encryption_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87: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": {"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-16-amd64", "name": "ubuntu-16-amd64", "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, "source_image": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::image: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/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "id": "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8", "name": "my-image"}, "source_volume": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::volume: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/1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "id": "1a6b7274-678d-4dfb-8981-c71dd9d4daa5", "name": "my-volume"}, "user_tags": ["UserTags"]}`) - })) - }) - It(`Invoke UpdateSnapshot 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.UpdateSnapshot(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 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.UpdateSnapshot(updateSnapshotOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateSnapshot 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 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.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 UpdateSnapshotOptions model with no property values - updateSnapshotOptionsModelNew := new(vpcv1.UpdateSnapshotOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateSnapshot(updateSnapshotOptionsModelNew) - 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 UpdateSnapshot 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 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.UpdateSnapshot(updateSnapshotOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListRegions(listRegionsOptions *ListRegionsOptions) - Operation response error`, func() { - version := "testString" - 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(listRegionsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListRegions 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 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.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.ListRegions(listRegionsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListRegions(listRegionsOptions *ListRegionsOptions)`, func() { - version := "testString" - 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(listRegionsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"regions": [{"endpoint": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}`) - })) - }) - It(`Invoke ListRegions 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 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.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.ListRegions(listRegionsOptionsModel) - 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.ListRegionsWithContext(ctx, listRegionsOptionsModel) - 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(listRegionsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}]}`) - })) - }) - It(`Invoke ListRegions 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.ListRegions(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"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListRegions(listRegionsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListRegions 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 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.ListRegions(listRegionsOptionsModel) - 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 ListRegions 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 ListRegionsOptions model - listRegionsOptionsModel := new(vpcv1.ListRegionsOptions) - listRegionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListRegions(listRegionsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetRegion(getRegionOptions *GetRegionOptions) - Operation response error`, func() { - version := "testString" - getRegionPath := "/regions/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.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetRegion 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 GetRegionOptions model - getRegionOptionsModel := new(vpcv1.GetRegionOptions) - getRegionOptionsModel.Name = core.StringPtr("testString") - 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.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.GetRegion(getRegionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetRegion(getRegionOptions *GetRegionOptions)`, func() { - version := "testString" - getRegionPath := "/regions/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.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"endpoint": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}`) - })) - }) - It(`Invoke GetRegion 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 GetRegionOptions model - getRegionOptionsModel := new(vpcv1.GetRegionOptions) - getRegionOptionsModel.Name = core.StringPtr("testString") - 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.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.GetRegion(getRegionOptionsModel) - 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.GetRegionWithContext(ctx, getRegionOptionsModel) - 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(getRegionPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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": "Endpoint", "href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south", "name": "us-south", "status": "available"}`) - })) - }) - It(`Invoke GetRegion 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.GetRegion(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("testString") - getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetRegion(getRegionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetRegion 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 GetRegionOptions model - getRegionOptionsModel := new(vpcv1.GetRegionOptions) - getRegionOptionsModel.Name = core.StringPtr("testString") - 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.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 GetRegionOptions model with no property values - getRegionOptionsModelNew := new(vpcv1.GetRegionOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetRegion(getRegionOptionsModelNew) - 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 GetRegion 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 GetRegionOptions model - getRegionOptionsModel := new(vpcv1.GetRegionOptions) - getRegionOptionsModel.Name = core.StringPtr("testString") - getRegionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetRegion(getRegionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) - Operation response error`, func() { - version := "testString" - listRegionZonesPath := "/regions/testString/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(listRegionZonesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListRegionZones 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 ListRegionZonesOptions model - listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) - listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") - 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.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.ListRegionZones(listRegionZonesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions)`, func() { - version := "testString" - listRegionZonesPath := "/regions/testString/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(listRegionZonesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"zones": [{"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"}]}`) - })) - }) - It(`Invoke ListRegionZones 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 ListRegionZonesOptions model - listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) - listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") - 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.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.ListRegionZones(listRegionZonesOptionsModel) - 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.ListRegionZonesWithContext(ctx, listRegionZonesOptionsModel) - 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(listRegionZonesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"zones": [{"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"}]}`) - })) - }) - It(`Invoke ListRegionZones 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.ListRegionZones(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("testString") - listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListRegionZones 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 ListRegionZonesOptions model - listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) - listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") - 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.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 ListRegionZonesOptions model with no property values - listRegionZonesOptionsModelNew := new(vpcv1.ListRegionZonesOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListRegionZones(listRegionZonesOptionsModelNew) - 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 ListRegionZones 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 ListRegionZonesOptions model - listRegionZonesOptionsModel := new(vpcv1.ListRegionZonesOptions) - listRegionZonesOptionsModel.RegionName = core.StringPtr("testString") - listRegionZonesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListRegionZones(listRegionZonesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) - Operation response error`, func() { - version := "testString" - getRegionZonePath := "/regions/testString/zones/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.Query()["version"]).To(Equal([]string{"testString"})) - 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 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()) - - // Construct an instance of the GetRegionZoneOptions model - getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) - getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") - getRegionZoneOptionsModel.Name = core.StringPtr("testString") - 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()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions)`, func() { - version := "testString" - getRegionZonePath := "/regions/testString/zones/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.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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"}`) - })) - }) - 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("testString") - getRegionZoneOptionsModel.Name = core.StringPtr("testString") - 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`, func() { - BeforeEach(func() { - testServer = httptest.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.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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"}`) - })) - }) - 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("testString") - getRegionZoneOptionsModel.Name = core.StringPtr("testString") - 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()) - - }) - It(`Invoke GetRegionZone 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 GetRegionZoneOptions model - getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) - getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") - getRegionZoneOptionsModel.Name = core.StringPtr("testString") - 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()) - 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() - - // Set success status code with no respoonse body - res.WriteHeader(200) - })) - }) - 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()) - - // Construct an instance of the GetRegionZoneOptions model - getRegionZoneOptionsModel := new(vpcv1.GetRegionZoneOptions) - getRegionZoneOptionsModel.RegionName = core.StringPtr("testString") - getRegionZoneOptionsModel.Name = core.StringPtr("testString") - getRegionZoneOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetRegionZone(getRegionZoneOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListPublicGateways(listPublicGatewaysOptions *ListPublicGatewaysOptions) - Operation response error`, func() { - version := "testString" - listPublicGatewaysPath := "/public_gateways" - 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(listPublicGatewaysPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 {`) - })) - }) - It(`Invoke ListPublicGateways 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 ListPublicGatewaysOptions model - listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) - listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") - listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listPublicGatewaysOptionsModel.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.ListPublicGateways(listPublicGatewaysOptionsModel) - 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.ListPublicGateways(listPublicGatewaysOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListPublicGateways(listPublicGatewaysOptions *ListPublicGatewaysOptions)`, func() { - version := "testString" - listPublicGatewaysPath := "/public_gateways" - 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(listPublicGatewaysPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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 ListPublicGatewaysOptions model - listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) - listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") - listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listPublicGatewaysOptionsModel.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.ListPublicGatewaysWithContext(ctx, listPublicGatewaysOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListPublicGateways(listPublicGatewaysOptionsModel) - 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.ListPublicGatewaysWithContext(ctx, listPublicGatewaysOptionsModel) - 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(listPublicGatewaysPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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.ListPublicGateways(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListPublicGatewaysOptions model - listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) - listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") - listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listPublicGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListPublicGateways(listPublicGatewaysOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListPublicGateways 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 ListPublicGatewaysOptions model - listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) - listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") - listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listPublicGatewaysOptionsModel.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.ListPublicGateways(listPublicGatewaysOptionsModel) - 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 ListPublicGateways 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 ListPublicGatewaysOptions model - listPublicGatewaysOptionsModel := new(vpcv1.ListPublicGatewaysOptions) - listPublicGatewaysOptionsModel.Start = core.StringPtr("testString") - listPublicGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listPublicGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listPublicGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListPublicGateways(listPublicGatewaysOptionsModel) - 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.PublicGatewayCollection) - nextObject := new(vpcv1.PublicGatewayCollectionNext) - 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.PublicGatewayCollection) - - 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.PublicGatewayCollection) - nextObject := new(vpcv1.PublicGatewayCollectionNext) - 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(listPublicGatewaysPath)) - 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,"public_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241","floating_ip":{"address":"203.0.113.1","crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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 PublicGatewaysPager.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()) - - listPublicGatewaysOptionsModel := &vpcv1.ListPublicGatewaysOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - } - - pager, err := vpcService.NewPublicGatewaysPager(listPublicGatewaysOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.PublicGateway - 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 PublicGatewaysPager.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()) - - listPublicGatewaysOptionsModel := &vpcv1.ListPublicGatewaysOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - } - - pager, err := vpcService.NewPublicGatewaysPager(listPublicGatewaysOptionsModel) - 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(`CreatePublicGateway(createPublicGatewayOptions *CreatePublicGatewayOptions) - Operation response error`, func() { - version := "testString" - createPublicGatewayPath := "/public_gateways" - 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(createPublicGatewayPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreatePublicGateway 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 VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("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 PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model - publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) - publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePublicGatewayOptions model - createPublicGatewayOptionsModel := new(vpcv1.CreatePublicGatewayOptions) - createPublicGatewayOptionsModel.VPC = vpcIdentityModel - createPublicGatewayOptionsModel.Zone = zoneIdentityModel - createPublicGatewayOptionsModel.FloatingIP = publicGatewayFloatingIPPrototypeModel - createPublicGatewayOptionsModel.Name = core.StringPtr("my-public-gateway") - createPublicGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPublicGatewayOptionsModel.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.CreatePublicGateway(createPublicGatewayOptionsModel) - 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.CreatePublicGateway(createPublicGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreatePublicGateway(createPublicGatewayOptions *CreatePublicGatewayOptions)`, func() { - version := "testString" - createPublicGatewayPath := "/public_gateways" - 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(createPublicGatewayPath)) - 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{"testString"})) - 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", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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 VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("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 PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model - publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) - publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePublicGatewayOptions model - createPublicGatewayOptionsModel := new(vpcv1.CreatePublicGatewayOptions) - createPublicGatewayOptionsModel.VPC = vpcIdentityModel - createPublicGatewayOptionsModel.Zone = zoneIdentityModel - createPublicGatewayOptionsModel.FloatingIP = publicGatewayFloatingIPPrototypeModel - createPublicGatewayOptionsModel.Name = core.StringPtr("my-public-gateway") - createPublicGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPublicGatewayOptionsModel.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.CreatePublicGatewayWithContext(ctx, createPublicGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreatePublicGateway(createPublicGatewayOptionsModel) - 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.CreatePublicGatewayWithContext(ctx, createPublicGatewayOptionsModel) - 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(createPublicGatewayPath)) - 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{"testString"})) - 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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.CreatePublicGateway(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("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 PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model - publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) - publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePublicGatewayOptions model - createPublicGatewayOptionsModel := new(vpcv1.CreatePublicGatewayOptions) - createPublicGatewayOptionsModel.VPC = vpcIdentityModel - createPublicGatewayOptionsModel.Zone = zoneIdentityModel - createPublicGatewayOptionsModel.FloatingIP = publicGatewayFloatingIPPrototypeModel - createPublicGatewayOptionsModel.Name = core.StringPtr("my-public-gateway") - createPublicGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreatePublicGateway(createPublicGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreatePublicGateway 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 VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("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 PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model - publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) - publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePublicGatewayOptions model - createPublicGatewayOptionsModel := new(vpcv1.CreatePublicGatewayOptions) - createPublicGatewayOptionsModel.VPC = vpcIdentityModel - createPublicGatewayOptionsModel.Zone = zoneIdentityModel - createPublicGatewayOptionsModel.FloatingIP = publicGatewayFloatingIPPrototypeModel - createPublicGatewayOptionsModel.Name = core.StringPtr("my-public-gateway") - createPublicGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPublicGatewayOptionsModel.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.CreatePublicGateway(createPublicGatewayOptionsModel) - 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 CreatePublicGatewayOptions model with no property values - createPublicGatewayOptionsModelNew := new(vpcv1.CreatePublicGatewayOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreatePublicGateway(createPublicGatewayOptionsModelNew) - 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 CreatePublicGateway 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 VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("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 PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID model - publicGatewayFloatingIPPrototypeModel := new(vpcv1.PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) - publicGatewayFloatingIPPrototypeModel.ID = core.StringPtr("39300233-9995-4806-89a5-3c1b6eb88689") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreatePublicGatewayOptions model - createPublicGatewayOptionsModel := new(vpcv1.CreatePublicGatewayOptions) - createPublicGatewayOptionsModel.VPC = vpcIdentityModel - createPublicGatewayOptionsModel.Zone = zoneIdentityModel - createPublicGatewayOptionsModel.FloatingIP = publicGatewayFloatingIPPrototypeModel - createPublicGatewayOptionsModel.Name = core.StringPtr("my-public-gateway") - createPublicGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel - createPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreatePublicGateway(createPublicGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeletePublicGateway(deletePublicGatewayOptions *DeletePublicGatewayOptions)`, func() { - version := "testString" - deletePublicGatewayPath := "/public_gateways/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(deletePublicGatewayPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeletePublicGateway 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.DeletePublicGateway(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeletePublicGatewayOptions model - deletePublicGatewayOptionsModel := new(vpcv1.DeletePublicGatewayOptions) - deletePublicGatewayOptionsModel.ID = core.StringPtr("testString") - deletePublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeletePublicGateway(deletePublicGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeletePublicGateway 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 DeletePublicGatewayOptions model - deletePublicGatewayOptionsModel := new(vpcv1.DeletePublicGatewayOptions) - deletePublicGatewayOptionsModel.ID = core.StringPtr("testString") - deletePublicGatewayOptionsModel.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.DeletePublicGateway(deletePublicGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeletePublicGatewayOptions model with no property values - deletePublicGatewayOptionsModelNew := new(vpcv1.DeletePublicGatewayOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeletePublicGateway(deletePublicGatewayOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetPublicGateway(getPublicGatewayOptions *GetPublicGatewayOptions) - Operation response error`, func() { - version := "testString" - getPublicGatewayPath := "/public_gateways/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(getPublicGatewayPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetPublicGateway 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 GetPublicGatewayOptions model - getPublicGatewayOptionsModel := new(vpcv1.GetPublicGatewayOptions) - getPublicGatewayOptionsModel.ID = core.StringPtr("testString") - getPublicGatewayOptionsModel.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.GetPublicGateway(getPublicGatewayOptionsModel) - 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.GetPublicGateway(getPublicGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetPublicGateway(getPublicGatewayOptions *GetPublicGatewayOptions)`, func() { - version := "testString" - getPublicGatewayPath := "/public_gateways/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(getPublicGatewayPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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 GetPublicGatewayOptions model - getPublicGatewayOptionsModel := new(vpcv1.GetPublicGatewayOptions) - getPublicGatewayOptionsModel.ID = core.StringPtr("testString") - getPublicGatewayOptionsModel.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.GetPublicGatewayWithContext(ctx, getPublicGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetPublicGateway(getPublicGatewayOptionsModel) - 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.GetPublicGatewayWithContext(ctx, getPublicGatewayOptionsModel) - 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(getPublicGatewayPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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.GetPublicGateway(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetPublicGatewayOptions model - getPublicGatewayOptionsModel := new(vpcv1.GetPublicGatewayOptions) - getPublicGatewayOptionsModel.ID = core.StringPtr("testString") - getPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetPublicGateway(getPublicGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetPublicGateway 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 GetPublicGatewayOptions model - getPublicGatewayOptionsModel := new(vpcv1.GetPublicGatewayOptions) - getPublicGatewayOptionsModel.ID = core.StringPtr("testString") - getPublicGatewayOptionsModel.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.GetPublicGateway(getPublicGatewayOptionsModel) - 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 GetPublicGatewayOptions model with no property values - getPublicGatewayOptionsModelNew := new(vpcv1.GetPublicGatewayOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetPublicGateway(getPublicGatewayOptionsModelNew) - 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 GetPublicGateway 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 GetPublicGatewayOptions model - getPublicGatewayOptionsModel := new(vpcv1.GetPublicGatewayOptions) - getPublicGatewayOptionsModel.ID = core.StringPtr("testString") - getPublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetPublicGateway(getPublicGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdatePublicGateway(updatePublicGatewayOptions *UpdatePublicGatewayOptions) - Operation response error`, func() { - version := "testString" - updatePublicGatewayPath := "/public_gateways/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(updatePublicGatewayPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdatePublicGateway 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 PublicGatewayPatch model - publicGatewayPatchModel := new(vpcv1.PublicGatewayPatch) - publicGatewayPatchModel.Name = core.StringPtr("my-public-gateway") - publicGatewayPatchModelAsPatch, asPatchErr := publicGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdatePublicGatewayOptions model - updatePublicGatewayOptionsModel := new(vpcv1.UpdatePublicGatewayOptions) - updatePublicGatewayOptionsModel.ID = core.StringPtr("testString") - updatePublicGatewayOptionsModel.PublicGatewayPatch = publicGatewayPatchModelAsPatch - updatePublicGatewayOptionsModel.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.UpdatePublicGateway(updatePublicGatewayOptionsModel) - 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.UpdatePublicGateway(updatePublicGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdatePublicGateway(updatePublicGatewayOptions *UpdatePublicGatewayOptions)`, func() { - version := "testString" - updatePublicGatewayPath := "/public_gateways/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(updatePublicGatewayPath)) - 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{"testString"})) - 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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 PublicGatewayPatch model - publicGatewayPatchModel := new(vpcv1.PublicGatewayPatch) - publicGatewayPatchModel.Name = core.StringPtr("my-public-gateway") - publicGatewayPatchModelAsPatch, asPatchErr := publicGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdatePublicGatewayOptions model - updatePublicGatewayOptionsModel := new(vpcv1.UpdatePublicGatewayOptions) - updatePublicGatewayOptionsModel.ID = core.StringPtr("testString") - updatePublicGatewayOptionsModel.PublicGatewayPatch = publicGatewayPatchModelAsPatch - updatePublicGatewayOptionsModel.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.UpdatePublicGatewayWithContext(ctx, updatePublicGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdatePublicGateway(updatePublicGatewayOptionsModel) - 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.UpdatePublicGatewayWithContext(ctx, updatePublicGatewayOptionsModel) - 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(updatePublicGatewayPath)) - 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{"testString"})) - 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-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241", "floating_ip": {"address": "203.0.113.1", "crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::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/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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() { - 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.UpdatePublicGateway(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the PublicGatewayPatch model - publicGatewayPatchModel := new(vpcv1.PublicGatewayPatch) - publicGatewayPatchModel.Name = core.StringPtr("my-public-gateway") - publicGatewayPatchModelAsPatch, asPatchErr := publicGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdatePublicGatewayOptions model - updatePublicGatewayOptionsModel := new(vpcv1.UpdatePublicGatewayOptions) - updatePublicGatewayOptionsModel.ID = core.StringPtr("testString") - updatePublicGatewayOptionsModel.PublicGatewayPatch = publicGatewayPatchModelAsPatch - updatePublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdatePublicGateway(updatePublicGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdatePublicGateway 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 PublicGatewayPatch model - publicGatewayPatchModel := new(vpcv1.PublicGatewayPatch) - publicGatewayPatchModel.Name = core.StringPtr("my-public-gateway") - publicGatewayPatchModelAsPatch, asPatchErr := publicGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdatePublicGatewayOptions model - updatePublicGatewayOptionsModel := new(vpcv1.UpdatePublicGatewayOptions) - updatePublicGatewayOptionsModel.ID = core.StringPtr("testString") - updatePublicGatewayOptionsModel.PublicGatewayPatch = publicGatewayPatchModelAsPatch - updatePublicGatewayOptionsModel.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.UpdatePublicGateway(updatePublicGatewayOptionsModel) - 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 UpdatePublicGatewayOptions model with no property values - updatePublicGatewayOptionsModelNew := new(vpcv1.UpdatePublicGatewayOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdatePublicGateway(updatePublicGatewayOptionsModelNew) - 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 UpdatePublicGateway 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 PublicGatewayPatch model - publicGatewayPatchModel := new(vpcv1.PublicGatewayPatch) - publicGatewayPatchModel.Name = core.StringPtr("my-public-gateway") - publicGatewayPatchModelAsPatch, asPatchErr := publicGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdatePublicGatewayOptions model - updatePublicGatewayOptionsModel := new(vpcv1.UpdatePublicGatewayOptions) - updatePublicGatewayOptionsModel.ID = core.StringPtr("testString") - updatePublicGatewayOptionsModel.PublicGatewayPatch = publicGatewayPatchModelAsPatch - updatePublicGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdatePublicGateway(updatePublicGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListFloatingIps(listFloatingIpsOptions *ListFloatingIpsOptions) - Operation response error`, func() { - version := "testString" - listFloatingIpsPath := "/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(listFloatingIpsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["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 ListFloatingIps 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 ListFloatingIpsOptions model - listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) - listFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listFloatingIpsOptionsModel.Sort = core.StringPtr("name") - listFloatingIpsOptionsModel.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.ListFloatingIps(listFloatingIpsOptionsModel) - 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.ListFloatingIps(listFloatingIpsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListFloatingIps(listFloatingIpsOptions *ListFloatingIpsOptions)`, func() { - version := "testString" - listFloatingIpsPath := "/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(listFloatingIpsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["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/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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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}`) - })) - }) - It(`Invoke ListFloatingIps 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 ListFloatingIpsOptions model - listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) - listFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listFloatingIpsOptionsModel.Sort = core.StringPtr("name") - listFloatingIpsOptionsModel.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.ListFloatingIpsWithContext(ctx, listFloatingIpsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListFloatingIps(listFloatingIpsOptionsModel) - 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.ListFloatingIpsWithContext(ctx, listFloatingIpsOptionsModel) - 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(listFloatingIpsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["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/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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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}`) - })) - }) - It(`Invoke ListFloatingIps 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.ListFloatingIps(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListFloatingIpsOptions model - listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) - listFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listFloatingIpsOptionsModel.Sort = core.StringPtr("name") - listFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListFloatingIps(listFloatingIpsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListFloatingIps 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 ListFloatingIpsOptions model - listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) - listFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listFloatingIpsOptionsModel.Sort = core.StringPtr("name") - listFloatingIpsOptionsModel.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.ListFloatingIps(listFloatingIpsOptionsModel) - 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 ListFloatingIps 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 ListFloatingIpsOptions model - listFloatingIpsOptionsModel := new(vpcv1.ListFloatingIpsOptions) - listFloatingIpsOptionsModel.Start = core.StringPtr("testString") - listFloatingIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listFloatingIpsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listFloatingIpsOptionsModel.Sort = core.StringPtr("name") - listFloatingIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListFloatingIps(listFloatingIpsOptionsModel) - 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.FloatingIPCollection) - nextObject := new(vpcv1.FloatingIPCollectionNext) - 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.FloatingIPCollection) - - 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.FloatingIPCollection) - nextObject := new(vpcv1.FloatingIPCollectionNext) - 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(listFloatingIpsPath)) - 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,"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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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) - } - })) - }) - It(`Use FloatingIpsPager.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()) - - listFloatingIpsOptionsModel := &vpcv1.ListFloatingIpsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Sort: core.StringPtr("name"), - } - - pager, err := vpcService.NewFloatingIpsPager(listFloatingIpsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.FloatingIP - 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 FloatingIpsPager.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()) - - listFloatingIpsOptionsModel := &vpcv1.ListFloatingIpsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Sort: core.StringPtr("name"), - } - - pager, err := vpcService.NewFloatingIpsPager(listFloatingIpsOptionsModel) - 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(`CreateFloatingIP(createFloatingIPOptions *CreateFloatingIPOptions) - Operation response error`, func() { - version := "testString" - createFloatingIPPath := "/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(createFloatingIPPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateFloatingIP 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 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 FloatingIPPrototypeFloatingIPByZone model - floatingIPPrototypeModel := new(vpcv1.FloatingIPPrototypeFloatingIPByZone) - floatingIPPrototypeModel.Name = core.StringPtr("my-floating-ip") - floatingIPPrototypeModel.ResourceGroup = resourceGroupIdentityModel - floatingIPPrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateFloatingIPOptions model - createFloatingIPOptionsModel := new(vpcv1.CreateFloatingIPOptions) - createFloatingIPOptionsModel.FloatingIPPrototype = floatingIPPrototypeModel - createFloatingIPOptionsModel.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.CreateFloatingIP(createFloatingIPOptionsModel) - 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.CreateFloatingIP(createFloatingIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateFloatingIP(createFloatingIPOptions *CreateFloatingIPOptions)`, func() { - version := "testString" - createFloatingIPPath := "/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(createFloatingIPPath)) - 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{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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() { - 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 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 FloatingIPPrototypeFloatingIPByZone model - floatingIPPrototypeModel := new(vpcv1.FloatingIPPrototypeFloatingIPByZone) - floatingIPPrototypeModel.Name = core.StringPtr("my-floating-ip") - floatingIPPrototypeModel.ResourceGroup = resourceGroupIdentityModel - floatingIPPrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateFloatingIPOptions model - createFloatingIPOptionsModel := new(vpcv1.CreateFloatingIPOptions) - createFloatingIPOptionsModel.FloatingIPPrototype = floatingIPPrototypeModel - createFloatingIPOptionsModel.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.CreateFloatingIPWithContext(ctx, createFloatingIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateFloatingIP(createFloatingIPOptionsModel) - 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.CreateFloatingIPWithContext(ctx, createFloatingIPOptionsModel) - 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(createFloatingIPPath)) - 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{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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() { - 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.CreateFloatingIP(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 ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the FloatingIPPrototypeFloatingIPByZone model - floatingIPPrototypeModel := new(vpcv1.FloatingIPPrototypeFloatingIPByZone) - floatingIPPrototypeModel.Name = core.StringPtr("my-floating-ip") - floatingIPPrototypeModel.ResourceGroup = resourceGroupIdentityModel - floatingIPPrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateFloatingIPOptions model - createFloatingIPOptionsModel := new(vpcv1.CreateFloatingIPOptions) - createFloatingIPOptionsModel.FloatingIPPrototype = floatingIPPrototypeModel - createFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateFloatingIP(createFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateFloatingIP 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 ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the FloatingIPPrototypeFloatingIPByZone model - floatingIPPrototypeModel := new(vpcv1.FloatingIPPrototypeFloatingIPByZone) - floatingIPPrototypeModel.Name = core.StringPtr("my-floating-ip") - floatingIPPrototypeModel.ResourceGroup = resourceGroupIdentityModel - floatingIPPrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateFloatingIPOptions model - createFloatingIPOptionsModel := new(vpcv1.CreateFloatingIPOptions) - createFloatingIPOptionsModel.FloatingIPPrototype = floatingIPPrototypeModel - createFloatingIPOptionsModel.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.CreateFloatingIP(createFloatingIPOptionsModel) - 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 CreateFloatingIPOptions model with no property values - createFloatingIPOptionsModelNew := new(vpcv1.CreateFloatingIPOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateFloatingIP(createFloatingIPOptionsModelNew) - 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 CreateFloatingIP 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") - - // Construct an instance of the ZoneIdentityByName model - zoneIdentityModel := new(vpcv1.ZoneIdentityByName) - zoneIdentityModel.Name = core.StringPtr("us-south-1") - - // Construct an instance of the FloatingIPPrototypeFloatingIPByZone model - floatingIPPrototypeModel := new(vpcv1.FloatingIPPrototypeFloatingIPByZone) - floatingIPPrototypeModel.Name = core.StringPtr("my-floating-ip") - floatingIPPrototypeModel.ResourceGroup = resourceGroupIdentityModel - floatingIPPrototypeModel.Zone = zoneIdentityModel - - // Construct an instance of the CreateFloatingIPOptions model - createFloatingIPOptionsModel := new(vpcv1.CreateFloatingIPOptions) - createFloatingIPOptionsModel.FloatingIPPrototype = floatingIPPrototypeModel - createFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateFloatingIP(createFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteFloatingIP(deleteFloatingIPOptions *DeleteFloatingIPOptions)`, func() { - version := "testString" - deleteFloatingIPPath := "/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(deleteFloatingIPPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteFloatingIP 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.DeleteFloatingIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteFloatingIPOptions model - deleteFloatingIPOptionsModel := new(vpcv1.DeleteFloatingIPOptions) - deleteFloatingIPOptionsModel.ID = core.StringPtr("testString") - deleteFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteFloatingIP(deleteFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteFloatingIP 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 DeleteFloatingIPOptions model - deleteFloatingIPOptionsModel := new(vpcv1.DeleteFloatingIPOptions) - deleteFloatingIPOptionsModel.ID = core.StringPtr("testString") - deleteFloatingIPOptionsModel.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.DeleteFloatingIP(deleteFloatingIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteFloatingIPOptions model with no property values - deleteFloatingIPOptionsModelNew := new(vpcv1.DeleteFloatingIPOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteFloatingIP(deleteFloatingIPOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetFloatingIP(getFloatingIPOptions *GetFloatingIPOptions) - Operation response error`, func() { - version := "testString" - getFloatingIPPath := "/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(getFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetFloatingIP 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 GetFloatingIPOptions model - getFloatingIPOptionsModel := new(vpcv1.GetFloatingIPOptions) - getFloatingIPOptionsModel.ID = core.StringPtr("testString") - getFloatingIPOptionsModel.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.GetFloatingIP(getFloatingIPOptionsModel) - 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.GetFloatingIP(getFloatingIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetFloatingIP(getFloatingIPOptions *GetFloatingIPOptions)`, func() { - version := "testString" - getFloatingIPPath := "/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(getFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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() { - 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 GetFloatingIPOptions model - getFloatingIPOptionsModel := new(vpcv1.GetFloatingIPOptions) - getFloatingIPOptionsModel.ID = core.StringPtr("testString") - getFloatingIPOptionsModel.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.GetFloatingIPWithContext(ctx, getFloatingIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetFloatingIP(getFloatingIPOptionsModel) - 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.GetFloatingIPWithContext(ctx, getFloatingIPOptionsModel) - 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(getFloatingIPPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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() { - 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.GetFloatingIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetFloatingIPOptions model - getFloatingIPOptionsModel := new(vpcv1.GetFloatingIPOptions) - getFloatingIPOptionsModel.ID = core.StringPtr("testString") - getFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetFloatingIP(getFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetFloatingIP 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 GetFloatingIPOptions model - getFloatingIPOptionsModel := new(vpcv1.GetFloatingIPOptions) - getFloatingIPOptionsModel.ID = core.StringPtr("testString") - getFloatingIPOptionsModel.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.GetFloatingIP(getFloatingIPOptionsModel) - 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 GetFloatingIPOptions model with no property values - getFloatingIPOptionsModelNew := new(vpcv1.GetFloatingIPOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetFloatingIP(getFloatingIPOptionsModelNew) - 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 GetFloatingIP 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 GetFloatingIPOptions model - getFloatingIPOptionsModel := new(vpcv1.GetFloatingIPOptions) - getFloatingIPOptionsModel.ID = core.StringPtr("testString") - getFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetFloatingIP(getFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateFloatingIP(updateFloatingIPOptions *UpdateFloatingIPOptions) - Operation response error`, func() { - version := "testString" - updateFloatingIPPath := "/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(updateFloatingIPPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateFloatingIP 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 FloatingIPTargetPatchNetworkInterfaceIdentityByID model - floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchNetworkInterfaceIdentityByID) - floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - - // Construct an instance of the FloatingIPPatch model - floatingIPPatchModel := new(vpcv1.FloatingIPPatch) - floatingIPPatchModel.Name = core.StringPtr("my-floating-ip") - floatingIPPatchModel.Target = floatingIPTargetPatchModel - floatingIPPatchModelAsPatch, asPatchErr := floatingIPPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateFloatingIPOptions model - updateFloatingIPOptionsModel := new(vpcv1.UpdateFloatingIPOptions) - updateFloatingIPOptionsModel.ID = core.StringPtr("testString") - updateFloatingIPOptionsModel.FloatingIPPatch = floatingIPPatchModelAsPatch - updateFloatingIPOptionsModel.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.UpdateFloatingIP(updateFloatingIPOptionsModel) - 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.UpdateFloatingIP(updateFloatingIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateFloatingIP(updateFloatingIPOptions *UpdateFloatingIPOptions)`, func() { - version := "testString" - updateFloatingIPPath := "/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(updateFloatingIPPath)) - 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{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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() { - 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 FloatingIPTargetPatchNetworkInterfaceIdentityByID model - floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchNetworkInterfaceIdentityByID) - floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - - // Construct an instance of the FloatingIPPatch model - floatingIPPatchModel := new(vpcv1.FloatingIPPatch) - floatingIPPatchModel.Name = core.StringPtr("my-floating-ip") - floatingIPPatchModel.Target = floatingIPTargetPatchModel - floatingIPPatchModelAsPatch, asPatchErr := floatingIPPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateFloatingIPOptions model - updateFloatingIPOptionsModel := new(vpcv1.UpdateFloatingIPOptions) - updateFloatingIPOptionsModel.ID = core.StringPtr("testString") - updateFloatingIPOptionsModel.FloatingIPPatch = floatingIPPatchModelAsPatch - updateFloatingIPOptionsModel.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.UpdateFloatingIPWithContext(ctx, updateFloatingIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateFloatingIP(updateFloatingIPOptionsModel) - 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.UpdateFloatingIPWithContext(ctx, updateFloatingIPOptionsModel) - 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(updateFloatingIPPath)) - 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{"testString"})) - 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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() { - 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.UpdateFloatingIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the FloatingIPTargetPatchNetworkInterfaceIdentityByID model - floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchNetworkInterfaceIdentityByID) - floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - - // Construct an instance of the FloatingIPPatch model - floatingIPPatchModel := new(vpcv1.FloatingIPPatch) - floatingIPPatchModel.Name = core.StringPtr("my-floating-ip") - floatingIPPatchModel.Target = floatingIPTargetPatchModel - floatingIPPatchModelAsPatch, asPatchErr := floatingIPPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateFloatingIPOptions model - updateFloatingIPOptionsModel := new(vpcv1.UpdateFloatingIPOptions) - updateFloatingIPOptionsModel.ID = core.StringPtr("testString") - updateFloatingIPOptionsModel.FloatingIPPatch = floatingIPPatchModelAsPatch - updateFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateFloatingIP(updateFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateFloatingIP 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 FloatingIPTargetPatchNetworkInterfaceIdentityByID model - floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchNetworkInterfaceIdentityByID) - floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - - // Construct an instance of the FloatingIPPatch model - floatingIPPatchModel := new(vpcv1.FloatingIPPatch) - floatingIPPatchModel.Name = core.StringPtr("my-floating-ip") - floatingIPPatchModel.Target = floatingIPTargetPatchModel - floatingIPPatchModelAsPatch, asPatchErr := floatingIPPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateFloatingIPOptions model - updateFloatingIPOptionsModel := new(vpcv1.UpdateFloatingIPOptions) - updateFloatingIPOptionsModel.ID = core.StringPtr("testString") - updateFloatingIPOptionsModel.FloatingIPPatch = floatingIPPatchModelAsPatch - updateFloatingIPOptionsModel.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.UpdateFloatingIP(updateFloatingIPOptionsModel) - 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 UpdateFloatingIPOptions model with no property values - updateFloatingIPOptionsModelNew := new(vpcv1.UpdateFloatingIPOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateFloatingIP(updateFloatingIPOptionsModelNew) - 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 UpdateFloatingIP 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 FloatingIPTargetPatchNetworkInterfaceIdentityByID model - floatingIPTargetPatchModel := new(vpcv1.FloatingIPTargetPatchNetworkInterfaceIdentityByID) - floatingIPTargetPatchModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - - // Construct an instance of the FloatingIPPatch model - floatingIPPatchModel := new(vpcv1.FloatingIPPatch) - floatingIPPatchModel.Name = core.StringPtr("my-floating-ip") - floatingIPPatchModel.Target = floatingIPTargetPatchModel - floatingIPPatchModelAsPatch, asPatchErr := floatingIPPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateFloatingIPOptions model - updateFloatingIPOptionsModel := new(vpcv1.UpdateFloatingIPOptions) - updateFloatingIPOptionsModel.ID = core.StringPtr("testString") - updateFloatingIPOptionsModel.FloatingIPPatch = floatingIPPatchModelAsPatch - updateFloatingIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateFloatingIP(updateFloatingIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListNetworkAcls(listNetworkAclsOptions *ListNetworkAclsOptions) - Operation response error`, func() { - version := "testString" - listNetworkAclsPath := "/network_acls" - 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(listNetworkAclsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 {`) - })) - }) - It(`Invoke ListNetworkAcls 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 ListNetworkAclsOptions model - listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) - listNetworkAclsOptionsModel.Start = core.StringPtr("testString") - listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listNetworkAclsOptionsModel.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.ListNetworkAcls(listNetworkAclsOptionsModel) - 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.ListNetworkAcls(listNetworkAclsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListNetworkAcls(listNetworkAclsOptions *ListNetworkAclsOptions)`, func() { - version := "testString" - listNetworkAclsPath := "/network_acls" - 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(listNetworkAclsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) - })) - }) - It(`Invoke ListNetworkAcls 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 ListNetworkAclsOptions model - listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) - listNetworkAclsOptionsModel.Start = core.StringPtr("testString") - listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listNetworkAclsOptionsModel.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.ListNetworkAclsWithContext(ctx, listNetworkAclsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListNetworkAcls(listNetworkAclsOptionsModel) - 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.ListNetworkAclsWithContext(ctx, listNetworkAclsOptionsModel) - 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(listNetworkAclsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) - })) - }) - It(`Invoke ListNetworkAcls 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.ListNetworkAcls(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListNetworkAclsOptions model - listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) - listNetworkAclsOptionsModel.Start = core.StringPtr("testString") - listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listNetworkAclsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListNetworkAcls(listNetworkAclsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListNetworkAcls 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 ListNetworkAclsOptions model - listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) - listNetworkAclsOptionsModel.Start = core.StringPtr("testString") - listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listNetworkAclsOptionsModel.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.ListNetworkAcls(listNetworkAclsOptionsModel) - 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 ListNetworkAcls 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 ListNetworkAclsOptions model - listNetworkAclsOptionsModel := new(vpcv1.ListNetworkAclsOptions) - listNetworkAclsOptionsModel.Start = core.StringPtr("testString") - listNetworkAclsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkAclsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listNetworkAclsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListNetworkAcls(listNetworkAclsOptionsModel) - 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.NetworkACLCollection) - nextObject := new(vpcv1.NetworkACLCollectionNext) - 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.NetworkACLCollection) - - 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.NetworkACLCollection) - nextObject := new(vpcv1.NetworkACLCollectionNext) - 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(listNetworkAclsPath)) - 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"},"network_acls":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf","href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"network_acls":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf","href":"https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf","id":"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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use NetworkAclsPager.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()) - - listNetworkAclsOptionsModel := &vpcv1.ListNetworkAclsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - } - - pager, err := vpcService.NewNetworkAclsPager(listNetworkAclsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.NetworkACL - 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 NetworkAclsPager.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()) - - listNetworkAclsOptionsModel := &vpcv1.ListNetworkAclsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - } - - pager, err := vpcService.NewNetworkAclsPager(listNetworkAclsOptionsModel) - 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(`CreateNetworkACL(createNetworkACLOptions *CreateNetworkACLOptions) - Operation response error`, func() { - version := "testString" - createNetworkACLPath := "/network_acls" - 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(createNetworkACLPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateNetworkACL 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") - - // Construct an instance of the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype model - networkACLRulePrototypeNetworkACLContextModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") - networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") - networkACLRulePrototypeNetworkACLContextModel.IPVersion = core.StringPtr("ipv4") - networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") - networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePrototypeNetworkACLContextModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePrototypeNetworkACLContextModel.Protocol = core.StringPtr("udp") - networkACLRulePrototypeNetworkACLContextModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePrototypeNetworkACLContextModel.SourcePortMin = core.Int64Ptr(int64(49152)) - - // Construct an instance of the NetworkACLPrototypeNetworkACLByRules model - networkACLPrototypeModel := new(vpcv1.NetworkACLPrototypeNetworkACLByRules) - networkACLPrototypeModel.Name = core.StringPtr("my-network-acl") - networkACLPrototypeModel.ResourceGroup = resourceGroupIdentityModel - networkACLPrototypeModel.VPC = vpcIdentityModel - networkACLPrototypeModel.Rules = []vpcv1.NetworkACLRulePrototypeNetworkACLContextIntf{networkACLRulePrototypeNetworkACLContextModel} - - // Construct an instance of the CreateNetworkACLOptions model - createNetworkACLOptionsModel := new(vpcv1.CreateNetworkACLOptions) - createNetworkACLOptionsModel.NetworkACLPrototype = networkACLPrototypeModel - createNetworkACLOptionsModel.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.CreateNetworkACL(createNetworkACLOptionsModel) - 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.CreateNetworkACL(createNetworkACLOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateNetworkACL(createNetworkACLOptions *CreateNetworkACLOptions)`, func() { - version := "testString" - createNetworkACLPath := "/network_acls" - 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(createNetworkACLPath)) - 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{"testString"})) - 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke CreateNetworkACL 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") - - // Construct an instance of the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype model - networkACLRulePrototypeNetworkACLContextModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") - networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") - networkACLRulePrototypeNetworkACLContextModel.IPVersion = core.StringPtr("ipv4") - networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") - networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePrototypeNetworkACLContextModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePrototypeNetworkACLContextModel.Protocol = core.StringPtr("udp") - networkACLRulePrototypeNetworkACLContextModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePrototypeNetworkACLContextModel.SourcePortMin = core.Int64Ptr(int64(49152)) - - // Construct an instance of the NetworkACLPrototypeNetworkACLByRules model - networkACLPrototypeModel := new(vpcv1.NetworkACLPrototypeNetworkACLByRules) - networkACLPrototypeModel.Name = core.StringPtr("my-network-acl") - networkACLPrototypeModel.ResourceGroup = resourceGroupIdentityModel - networkACLPrototypeModel.VPC = vpcIdentityModel - networkACLPrototypeModel.Rules = []vpcv1.NetworkACLRulePrototypeNetworkACLContextIntf{networkACLRulePrototypeNetworkACLContextModel} - - // Construct an instance of the CreateNetworkACLOptions model - createNetworkACLOptionsModel := new(vpcv1.CreateNetworkACLOptions) - createNetworkACLOptionsModel.NetworkACLPrototype = networkACLPrototypeModel - createNetworkACLOptionsModel.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.CreateNetworkACLWithContext(ctx, createNetworkACLOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateNetworkACL(createNetworkACLOptionsModel) - 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.CreateNetworkACLWithContext(ctx, createNetworkACLOptionsModel) - 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(createNetworkACLPath)) - 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{"testString"})) - 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke CreateNetworkACL 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.CreateNetworkACL(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 VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") - - // Construct an instance of the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype model - networkACLRulePrototypeNetworkACLContextModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") - networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") - networkACLRulePrototypeNetworkACLContextModel.IPVersion = core.StringPtr("ipv4") - networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") - networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePrototypeNetworkACLContextModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePrototypeNetworkACLContextModel.Protocol = core.StringPtr("udp") - networkACLRulePrototypeNetworkACLContextModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePrototypeNetworkACLContextModel.SourcePortMin = core.Int64Ptr(int64(49152)) - - // Construct an instance of the NetworkACLPrototypeNetworkACLByRules model - networkACLPrototypeModel := new(vpcv1.NetworkACLPrototypeNetworkACLByRules) - networkACLPrototypeModel.Name = core.StringPtr("my-network-acl") - networkACLPrototypeModel.ResourceGroup = resourceGroupIdentityModel - networkACLPrototypeModel.VPC = vpcIdentityModel - networkACLPrototypeModel.Rules = []vpcv1.NetworkACLRulePrototypeNetworkACLContextIntf{networkACLRulePrototypeNetworkACLContextModel} - - // Construct an instance of the CreateNetworkACLOptions model - createNetworkACLOptionsModel := new(vpcv1.CreateNetworkACLOptions) - createNetworkACLOptionsModel.NetworkACLPrototype = networkACLPrototypeModel - createNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateNetworkACL(createNetworkACLOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateNetworkACL 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") - - // Construct an instance of the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype model - networkACLRulePrototypeNetworkACLContextModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") - networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") - networkACLRulePrototypeNetworkACLContextModel.IPVersion = core.StringPtr("ipv4") - networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") - networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePrototypeNetworkACLContextModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePrototypeNetworkACLContextModel.Protocol = core.StringPtr("udp") - networkACLRulePrototypeNetworkACLContextModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePrototypeNetworkACLContextModel.SourcePortMin = core.Int64Ptr(int64(49152)) - - // Construct an instance of the NetworkACLPrototypeNetworkACLByRules model - networkACLPrototypeModel := new(vpcv1.NetworkACLPrototypeNetworkACLByRules) - networkACLPrototypeModel.Name = core.StringPtr("my-network-acl") - networkACLPrototypeModel.ResourceGroup = resourceGroupIdentityModel - networkACLPrototypeModel.VPC = vpcIdentityModel - networkACLPrototypeModel.Rules = []vpcv1.NetworkACLRulePrototypeNetworkACLContextIntf{networkACLRulePrototypeNetworkACLContextModel} - - // Construct an instance of the CreateNetworkACLOptions model - createNetworkACLOptionsModel := new(vpcv1.CreateNetworkACLOptions) - createNetworkACLOptionsModel.NetworkACLPrototype = networkACLPrototypeModel - createNetworkACLOptionsModel.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.CreateNetworkACL(createNetworkACLOptionsModel) - 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(201) - })) - }) - It(`Invoke CreateNetworkACL 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") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f0aae929-7047-46d1-92e1-9102b07a7f6f") - - // Construct an instance of the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype model - networkACLRulePrototypeNetworkACLContextModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") - networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") - networkACLRulePrototypeNetworkACLContextModel.IPVersion = core.StringPtr("ipv4") - networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") - networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePrototypeNetworkACLContextModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePrototypeNetworkACLContextModel.Protocol = core.StringPtr("udp") - networkACLRulePrototypeNetworkACLContextModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePrototypeNetworkACLContextModel.SourcePortMin = core.Int64Ptr(int64(49152)) - - // Construct an instance of the NetworkACLPrototypeNetworkACLByRules model - networkACLPrototypeModel := new(vpcv1.NetworkACLPrototypeNetworkACLByRules) - networkACLPrototypeModel.Name = core.StringPtr("my-network-acl") - networkACLPrototypeModel.ResourceGroup = resourceGroupIdentityModel - networkACLPrototypeModel.VPC = vpcIdentityModel - networkACLPrototypeModel.Rules = []vpcv1.NetworkACLRulePrototypeNetworkACLContextIntf{networkACLRulePrototypeNetworkACLContextModel} - - // Construct an instance of the CreateNetworkACLOptions model - createNetworkACLOptionsModel := new(vpcv1.CreateNetworkACLOptions) - createNetworkACLOptionsModel.NetworkACLPrototype = networkACLPrototypeModel - createNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateNetworkACL(createNetworkACLOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteNetworkACL(deleteNetworkACLOptions *DeleteNetworkACLOptions)`, func() { - version := "testString" - deleteNetworkACLPath := "/network_acls/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(deleteNetworkACLPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteNetworkACL 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.DeleteNetworkACL(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteNetworkACLOptions model - deleteNetworkACLOptionsModel := new(vpcv1.DeleteNetworkACLOptions) - deleteNetworkACLOptionsModel.ID = core.StringPtr("testString") - deleteNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteNetworkACL(deleteNetworkACLOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteNetworkACL 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 DeleteNetworkACLOptions model - deleteNetworkACLOptionsModel := new(vpcv1.DeleteNetworkACLOptions) - deleteNetworkACLOptionsModel.ID = core.StringPtr("testString") - deleteNetworkACLOptionsModel.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.DeleteNetworkACL(deleteNetworkACLOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteNetworkACLOptions model with no property values - deleteNetworkACLOptionsModelNew := new(vpcv1.DeleteNetworkACLOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteNetworkACL(deleteNetworkACLOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetNetworkACL(getNetworkACLOptions *GetNetworkACLOptions) - Operation response error`, func() { - version := "testString" - getNetworkACLPath := "/network_acls/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(getNetworkACLPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetNetworkACL 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 GetNetworkACLOptions model - getNetworkACLOptionsModel := new(vpcv1.GetNetworkACLOptions) - getNetworkACLOptionsModel.ID = core.StringPtr("testString") - getNetworkACLOptionsModel.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.GetNetworkACL(getNetworkACLOptionsModel) - 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.GetNetworkACL(getNetworkACLOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetNetworkACL(getNetworkACLOptions *GetNetworkACLOptions)`, func() { - version := "testString" - getNetworkACLPath := "/network_acls/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(getNetworkACLPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetNetworkACL 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 GetNetworkACLOptions model - getNetworkACLOptionsModel := new(vpcv1.GetNetworkACLOptions) - getNetworkACLOptionsModel.ID = core.StringPtr("testString") - getNetworkACLOptionsModel.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.GetNetworkACLWithContext(ctx, getNetworkACLOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetNetworkACL(getNetworkACLOptionsModel) - 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.GetNetworkACLWithContext(ctx, getNetworkACLOptionsModel) - 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(getNetworkACLPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetNetworkACL 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.GetNetworkACL(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetNetworkACLOptions model - getNetworkACLOptionsModel := new(vpcv1.GetNetworkACLOptions) - getNetworkACLOptionsModel.ID = core.StringPtr("testString") - getNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetNetworkACL(getNetworkACLOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetNetworkACL 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 GetNetworkACLOptions model - getNetworkACLOptionsModel := new(vpcv1.GetNetworkACLOptions) - getNetworkACLOptionsModel.ID = core.StringPtr("testString") - getNetworkACLOptionsModel.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.GetNetworkACL(getNetworkACLOptionsModel) - 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 GetNetworkACLOptions model with no property values - getNetworkACLOptionsModelNew := new(vpcv1.GetNetworkACLOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetNetworkACL(getNetworkACLOptionsModelNew) - 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 GetNetworkACL 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 GetNetworkACLOptions model - getNetworkACLOptionsModel := new(vpcv1.GetNetworkACLOptions) - getNetworkACLOptionsModel.ID = core.StringPtr("testString") - getNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetNetworkACL(getNetworkACLOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateNetworkACL(updateNetworkACLOptions *UpdateNetworkACLOptions) - Operation response error`, func() { - version := "testString" - updateNetworkACLPath := "/network_acls/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(updateNetworkACLPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateNetworkACL 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 NetworkACLPatch model - networkACLPatchModel := new(vpcv1.NetworkACLPatch) - networkACLPatchModel.Name = core.StringPtr("my-network-acl") - networkACLPatchModelAsPatch, asPatchErr := networkACLPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateNetworkACLOptions model - updateNetworkACLOptionsModel := new(vpcv1.UpdateNetworkACLOptions) - updateNetworkACLOptionsModel.ID = core.StringPtr("testString") - updateNetworkACLOptionsModel.NetworkACLPatch = networkACLPatchModelAsPatch - updateNetworkACLOptionsModel.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.UpdateNetworkACL(updateNetworkACLOptionsModel) - 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.UpdateNetworkACL(updateNetworkACLOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateNetworkACL(updateNetworkACLOptions *UpdateNetworkACLOptions)`, func() { - version := "testString" - updateNetworkACLPath := "/network_acls/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(updateNetworkACLPath)) - 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{"testString"})) - 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke UpdateNetworkACL 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 NetworkACLPatch model - networkACLPatchModel := new(vpcv1.NetworkACLPatch) - networkACLPatchModel.Name = core.StringPtr("my-network-acl") - networkACLPatchModelAsPatch, asPatchErr := networkACLPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateNetworkACLOptions model - updateNetworkACLOptionsModel := new(vpcv1.UpdateNetworkACLOptions) - updateNetworkACLOptionsModel.ID = core.StringPtr("testString") - updateNetworkACLOptionsModel.NetworkACLPatch = networkACLPatchModelAsPatch - updateNetworkACLOptionsModel.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.UpdateNetworkACLWithContext(ctx, updateNetworkACLOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateNetworkACL(updateNetworkACLOptionsModel) - 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.UpdateNetworkACLWithContext(ctx, updateNetworkACLOptionsModel) - 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(updateNetworkACLPath)) - 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{"testString"})) - 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/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "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/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke UpdateNetworkACL 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.UpdateNetworkACL(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the NetworkACLPatch model - networkACLPatchModel := new(vpcv1.NetworkACLPatch) - networkACLPatchModel.Name = core.StringPtr("my-network-acl") - networkACLPatchModelAsPatch, asPatchErr := networkACLPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateNetworkACLOptions model - updateNetworkACLOptionsModel := new(vpcv1.UpdateNetworkACLOptions) - updateNetworkACLOptionsModel.ID = core.StringPtr("testString") - updateNetworkACLOptionsModel.NetworkACLPatch = networkACLPatchModelAsPatch - updateNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateNetworkACL(updateNetworkACLOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateNetworkACL 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 NetworkACLPatch model - networkACLPatchModel := new(vpcv1.NetworkACLPatch) - networkACLPatchModel.Name = core.StringPtr("my-network-acl") - networkACLPatchModelAsPatch, asPatchErr := networkACLPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateNetworkACLOptions model - updateNetworkACLOptionsModel := new(vpcv1.UpdateNetworkACLOptions) - updateNetworkACLOptionsModel.ID = core.StringPtr("testString") - updateNetworkACLOptionsModel.NetworkACLPatch = networkACLPatchModelAsPatch - updateNetworkACLOptionsModel.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.UpdateNetworkACL(updateNetworkACLOptionsModel) - 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 UpdateNetworkACLOptions model with no property values - updateNetworkACLOptionsModelNew := new(vpcv1.UpdateNetworkACLOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateNetworkACL(updateNetworkACLOptionsModelNew) - 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 UpdateNetworkACL 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 NetworkACLPatch model - networkACLPatchModel := new(vpcv1.NetworkACLPatch) - networkACLPatchModel.Name = core.StringPtr("my-network-acl") - networkACLPatchModelAsPatch, asPatchErr := networkACLPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateNetworkACLOptions model - updateNetworkACLOptionsModel := new(vpcv1.UpdateNetworkACLOptions) - updateNetworkACLOptionsModel.ID = core.StringPtr("testString") - updateNetworkACLOptionsModel.NetworkACLPatch = networkACLPatchModelAsPatch - updateNetworkACLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateNetworkACL(updateNetworkACLOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListNetworkACLRules(listNetworkACLRulesOptions *ListNetworkACLRulesOptions) - Operation response error`, func() { - version := "testString" - listNetworkACLRulesPath := "/network_acls/testString/rules" - 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(listNetworkACLRulesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["direction"]).To(Equal([]string{"inbound"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListNetworkACLRules 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 ListNetworkACLRulesOptions model - listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) - listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") - listNetworkACLRulesOptionsModel.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.ListNetworkACLRules(listNetworkACLRulesOptionsModel) - 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.ListNetworkACLRules(listNetworkACLRulesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListNetworkACLRules(listNetworkACLRulesOptions *ListNetworkACLRulesOptions)`, func() { - version := "testString" - listNetworkACLRulesPath := "/network_acls/testString/rules" - 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(listNetworkACLRulesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["direction"]).To(Equal([]string{"inbound"})) - // 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/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}`) - })) - }) - It(`Invoke ListNetworkACLRules 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 ListNetworkACLRulesOptions model - listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) - listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") - listNetworkACLRulesOptionsModel.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.ListNetworkACLRulesWithContext(ctx, listNetworkACLRulesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListNetworkACLRules(listNetworkACLRulesOptionsModel) - 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.ListNetworkACLRulesWithContext(ctx, listNetworkACLRulesOptionsModel) - 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(listNetworkACLRulesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["direction"]).To(Equal([]string{"inbound"})) - // 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}`) - })) - }) - It(`Invoke ListNetworkACLRules 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.ListNetworkACLRules(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListNetworkACLRulesOptions model - listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) - listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") - listNetworkACLRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListNetworkACLRules(listNetworkACLRulesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListNetworkACLRules 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 ListNetworkACLRulesOptions model - listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) - listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") - listNetworkACLRulesOptionsModel.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.ListNetworkACLRules(listNetworkACLRulesOptionsModel) - 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 ListNetworkACLRulesOptions model with no property values - listNetworkACLRulesOptionsModelNew := new(vpcv1.ListNetworkACLRulesOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListNetworkACLRules(listNetworkACLRulesOptionsModelNew) - 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 ListNetworkACLRules 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 ListNetworkACLRulesOptions model - listNetworkACLRulesOptionsModel := new(vpcv1.ListNetworkACLRulesOptions) - listNetworkACLRulesOptionsModel.NetworkACLID = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Start = core.StringPtr("testString") - listNetworkACLRulesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listNetworkACLRulesOptionsModel.Direction = core.StringPtr("inbound") - listNetworkACLRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListNetworkACLRules(listNetworkACLRulesOptionsModel) - 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.NetworkACLRuleCollection) - nextObject := new(vpcv1.NetworkACLRuleCollectionNext) - 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.NetworkACLRuleCollection) - - 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.NetworkACLRuleCollection) - nextObject := new(vpcv1.NetworkACLRuleCollectionNext) - 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(listNetworkACLRulesPath)) - 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,"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}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"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}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use NetworkACLRulesPager.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()) - - listNetworkACLRulesOptionsModel := &vpcv1.ListNetworkACLRulesOptions{ - NetworkACLID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Direction: core.StringPtr("inbound"), - } - - pager, err := vpcService.NewNetworkACLRulesPager(listNetworkACLRulesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.NetworkACLRuleItemIntf - 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 NetworkACLRulesPager.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()) - - listNetworkACLRulesOptionsModel := &vpcv1.ListNetworkACLRulesOptions{ - NetworkACLID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Direction: core.StringPtr("inbound"), - } - - pager, err := vpcService.NewNetworkACLRulesPager(listNetworkACLRulesOptionsModel) - 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(`CreateNetworkACLRule(createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) - Operation response error`, func() { - version := "testString" - createNetworkACLRulePath := "/network_acls/testString/rules" - 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(createNetworkACLRulePath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateNetworkACLRule 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 NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID model - networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) - networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - - // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype model - networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - networkACLRulePrototypeModel.Action = core.StringPtr("allow") - networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel - networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") - networkACLRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") - networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePrototypeModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePrototypeModel.Protocol = core.StringPtr("udp") - networkACLRulePrototypeModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePrototypeModel.SourcePortMin = core.Int64Ptr(int64(49152)) - - // Construct an instance of the CreateNetworkACLRuleOptions model - createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) - createNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - createNetworkACLRuleOptionsModel.NetworkACLRulePrototype = networkACLRulePrototypeModel - createNetworkACLRuleOptionsModel.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.CreateNetworkACLRule(createNetworkACLRuleOptionsModel) - 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.CreateNetworkACLRule(createNetworkACLRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateNetworkACLRule(createNetworkACLRuleOptions *CreateNetworkACLRuleOptions)`, func() { - version := "testString" - createNetworkACLRulePath := "/network_acls/testString/rules" - 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(createNetworkACLRulePath)) - 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{"testString"})) - 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", `{"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}`) - })) - }) - It(`Invoke CreateNetworkACLRule 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 NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID model - networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) - networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - - // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype model - networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - networkACLRulePrototypeModel.Action = core.StringPtr("allow") - networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel - networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") - networkACLRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") - networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePrototypeModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePrototypeModel.Protocol = core.StringPtr("udp") - networkACLRulePrototypeModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePrototypeModel.SourcePortMin = core.Int64Ptr(int64(49152)) - - // Construct an instance of the CreateNetworkACLRuleOptions model - createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) - createNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - createNetworkACLRuleOptionsModel.NetworkACLRulePrototype = networkACLRulePrototypeModel - createNetworkACLRuleOptionsModel.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.CreateNetworkACLRuleWithContext(ctx, createNetworkACLRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateNetworkACLRule(createNetworkACLRuleOptionsModel) - 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.CreateNetworkACLRuleWithContext(ctx, createNetworkACLRuleOptionsModel) - 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(createNetworkACLRulePath)) - 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{"testString"})) - 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", `{"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}`) - })) - }) - It(`Invoke CreateNetworkACLRule 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.CreateNetworkACLRule(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID model - networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) - networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - - // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype model - networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - networkACLRulePrototypeModel.Action = core.StringPtr("allow") - networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel - networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") - networkACLRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") - networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePrototypeModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePrototypeModel.Protocol = core.StringPtr("udp") - networkACLRulePrototypeModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePrototypeModel.SourcePortMin = core.Int64Ptr(int64(49152)) - - // Construct an instance of the CreateNetworkACLRuleOptions model - createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) - createNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - createNetworkACLRuleOptionsModel.NetworkACLRulePrototype = networkACLRulePrototypeModel - createNetworkACLRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateNetworkACLRule(createNetworkACLRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateNetworkACLRule 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 NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID model - networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) - networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - - // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype model - networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - networkACLRulePrototypeModel.Action = core.StringPtr("allow") - networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel - networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") - networkACLRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") - networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePrototypeModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePrototypeModel.Protocol = core.StringPtr("udp") - networkACLRulePrototypeModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePrototypeModel.SourcePortMin = core.Int64Ptr(int64(49152)) - - // Construct an instance of the CreateNetworkACLRuleOptions model - createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) - createNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - createNetworkACLRuleOptionsModel.NetworkACLRulePrototype = networkACLRulePrototypeModel - createNetworkACLRuleOptionsModel.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.CreateNetworkACLRule(createNetworkACLRuleOptionsModel) - 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 CreateNetworkACLRuleOptions model with no property values - createNetworkACLRuleOptionsModelNew := new(vpcv1.CreateNetworkACLRuleOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateNetworkACLRule(createNetworkACLRuleOptionsModelNew) - 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 CreateNetworkACLRule 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 NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID model - networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) - networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - - // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype model - networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - networkACLRulePrototypeModel.Action = core.StringPtr("allow") - networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel - networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") - networkACLRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") - networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePrototypeModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePrototypeModel.Protocol = core.StringPtr("udp") - networkACLRulePrototypeModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePrototypeModel.SourcePortMin = core.Int64Ptr(int64(49152)) - - // Construct an instance of the CreateNetworkACLRuleOptions model - createNetworkACLRuleOptionsModel := new(vpcv1.CreateNetworkACLRuleOptions) - createNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - createNetworkACLRuleOptionsModel.NetworkACLRulePrototype = networkACLRulePrototypeModel - createNetworkACLRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateNetworkACLRule(createNetworkACLRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteNetworkACLRule(deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions)`, func() { - version := "testString" - deleteNetworkACLRulePath := "/network_acls/testString/rules/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(deleteNetworkACLRulePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteNetworkACLRule 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.DeleteNetworkACLRule(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteNetworkACLRuleOptions model - deleteNetworkACLRuleOptionsModel := new(vpcv1.DeleteNetworkACLRuleOptions) - deleteNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - deleteNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") - deleteNetworkACLRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteNetworkACLRule(deleteNetworkACLRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteNetworkACLRule 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 DeleteNetworkACLRuleOptions model - deleteNetworkACLRuleOptionsModel := new(vpcv1.DeleteNetworkACLRuleOptions) - deleteNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - deleteNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") - deleteNetworkACLRuleOptionsModel.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.DeleteNetworkACLRule(deleteNetworkACLRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteNetworkACLRuleOptions model with no property values - deleteNetworkACLRuleOptionsModelNew := new(vpcv1.DeleteNetworkACLRuleOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteNetworkACLRule(deleteNetworkACLRuleOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetNetworkACLRule(getNetworkACLRuleOptions *GetNetworkACLRuleOptions) - Operation response error`, func() { - version := "testString" - getNetworkACLRulePath := "/network_acls/testString/rules/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(getNetworkACLRulePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetNetworkACLRule 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 GetNetworkACLRuleOptions model - getNetworkACLRuleOptionsModel := new(vpcv1.GetNetworkACLRuleOptions) - getNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - getNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") - getNetworkACLRuleOptionsModel.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.GetNetworkACLRule(getNetworkACLRuleOptionsModel) - 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.GetNetworkACLRule(getNetworkACLRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetNetworkACLRule(getNetworkACLRuleOptions *GetNetworkACLRuleOptions)`, func() { - version := "testString" - getNetworkACLRulePath := "/network_acls/testString/rules/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(getNetworkACLRulePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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}`) - })) - }) - It(`Invoke GetNetworkACLRule 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 GetNetworkACLRuleOptions model - getNetworkACLRuleOptionsModel := new(vpcv1.GetNetworkACLRuleOptions) - getNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - getNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") - getNetworkACLRuleOptionsModel.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.GetNetworkACLRuleWithContext(ctx, getNetworkACLRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetNetworkACLRule(getNetworkACLRuleOptionsModel) - 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.GetNetworkACLRuleWithContext(ctx, getNetworkACLRuleOptionsModel) - 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(getNetworkACLRulePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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}`) - })) - }) - It(`Invoke GetNetworkACLRule 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.GetNetworkACLRule(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetNetworkACLRuleOptions model - getNetworkACLRuleOptionsModel := new(vpcv1.GetNetworkACLRuleOptions) - getNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - getNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") - getNetworkACLRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetNetworkACLRule(getNetworkACLRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetNetworkACLRule 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 GetNetworkACLRuleOptions model - getNetworkACLRuleOptionsModel := new(vpcv1.GetNetworkACLRuleOptions) - getNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - getNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") - getNetworkACLRuleOptionsModel.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.GetNetworkACLRule(getNetworkACLRuleOptionsModel) - 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 GetNetworkACLRuleOptions model with no property values - getNetworkACLRuleOptionsModelNew := new(vpcv1.GetNetworkACLRuleOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetNetworkACLRule(getNetworkACLRuleOptionsModelNew) - 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 GetNetworkACLRule 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 GetNetworkACLRuleOptions model - getNetworkACLRuleOptionsModel := new(vpcv1.GetNetworkACLRuleOptions) - getNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - getNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") - getNetworkACLRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetNetworkACLRule(getNetworkACLRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) - Operation response error`, func() { - version := "testString" - updateNetworkACLRulePath := "/network_acls/testString/rules/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(updateNetworkACLRulePath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateNetworkACLRule 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 NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID model - networkACLRuleBeforePatchModel := new(vpcv1.NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) - networkACLRuleBeforePatchModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - - // Construct an instance of the NetworkACLRulePatch model - networkACLRulePatchModel := new(vpcv1.NetworkACLRulePatch) - networkACLRulePatchModel.Action = core.StringPtr("allow") - networkACLRulePatchModel.Before = networkACLRuleBeforePatchModel - networkACLRulePatchModel.Code = core.Int64Ptr(int64(0)) - networkACLRulePatchModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePatchModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePatchModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePatchModel.Direction = core.StringPtr("inbound") - networkACLRulePatchModel.Name = core.StringPtr("my-rule-1") - networkACLRulePatchModel.Protocol = core.StringPtr("tcp") - networkACLRulePatchModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePatchModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePatchModel.SourcePortMin = core.Int64Ptr(int64(49152)) - networkACLRulePatchModel.Type = core.Int64Ptr(int64(8)) - networkACLRulePatchModelAsPatch, asPatchErr := networkACLRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateNetworkACLRuleOptions model - updateNetworkACLRuleOptionsModel := new(vpcv1.UpdateNetworkACLRuleOptions) - updateNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - updateNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") - updateNetworkACLRuleOptionsModel.NetworkACLRulePatch = networkACLRulePatchModelAsPatch - updateNetworkACLRuleOptionsModel.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.UpdateNetworkACLRule(updateNetworkACLRuleOptionsModel) - 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.UpdateNetworkACLRule(updateNetworkACLRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions)`, func() { - version := "testString" - updateNetworkACLRulePath := "/network_acls/testString/rules/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(updateNetworkACLRulePath)) - 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{"testString"})) - 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", `{"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}`) - })) - }) - It(`Invoke UpdateNetworkACLRule 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 NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID model - networkACLRuleBeforePatchModel := new(vpcv1.NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) - networkACLRuleBeforePatchModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - - // Construct an instance of the NetworkACLRulePatch model - networkACLRulePatchModel := new(vpcv1.NetworkACLRulePatch) - networkACLRulePatchModel.Action = core.StringPtr("allow") - networkACLRulePatchModel.Before = networkACLRuleBeforePatchModel - networkACLRulePatchModel.Code = core.Int64Ptr(int64(0)) - networkACLRulePatchModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePatchModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePatchModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePatchModel.Direction = core.StringPtr("inbound") - networkACLRulePatchModel.Name = core.StringPtr("my-rule-1") - networkACLRulePatchModel.Protocol = core.StringPtr("tcp") - networkACLRulePatchModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePatchModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePatchModel.SourcePortMin = core.Int64Ptr(int64(49152)) - networkACLRulePatchModel.Type = core.Int64Ptr(int64(8)) - networkACLRulePatchModelAsPatch, asPatchErr := networkACLRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateNetworkACLRuleOptions model - updateNetworkACLRuleOptionsModel := new(vpcv1.UpdateNetworkACLRuleOptions) - updateNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - updateNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") - updateNetworkACLRuleOptionsModel.NetworkACLRulePatch = networkACLRulePatchModelAsPatch - updateNetworkACLRuleOptionsModel.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.UpdateNetworkACLRuleWithContext(ctx, updateNetworkACLRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateNetworkACLRule(updateNetworkACLRuleOptionsModel) - 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.UpdateNetworkACLRuleWithContext(ctx, updateNetworkACLRuleOptionsModel) - 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(updateNetworkACLRulePath)) - 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{"testString"})) - 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", `{"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}`) - })) - }) - It(`Invoke UpdateNetworkACLRule 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.UpdateNetworkACLRule(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID model - networkACLRuleBeforePatchModel := new(vpcv1.NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) - networkACLRuleBeforePatchModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - - // Construct an instance of the NetworkACLRulePatch model - networkACLRulePatchModel := new(vpcv1.NetworkACLRulePatch) - networkACLRulePatchModel.Action = core.StringPtr("allow") - networkACLRulePatchModel.Before = networkACLRuleBeforePatchModel - networkACLRulePatchModel.Code = core.Int64Ptr(int64(0)) - networkACLRulePatchModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePatchModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePatchModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePatchModel.Direction = core.StringPtr("inbound") - networkACLRulePatchModel.Name = core.StringPtr("my-rule-1") - networkACLRulePatchModel.Protocol = core.StringPtr("tcp") - networkACLRulePatchModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePatchModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePatchModel.SourcePortMin = core.Int64Ptr(int64(49152)) - networkACLRulePatchModel.Type = core.Int64Ptr(int64(8)) - networkACLRulePatchModelAsPatch, asPatchErr := networkACLRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateNetworkACLRuleOptions model - updateNetworkACLRuleOptionsModel := new(vpcv1.UpdateNetworkACLRuleOptions) - updateNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - updateNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") - updateNetworkACLRuleOptionsModel.NetworkACLRulePatch = networkACLRulePatchModelAsPatch - updateNetworkACLRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateNetworkACLRule(updateNetworkACLRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateNetworkACLRule 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 NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID model - networkACLRuleBeforePatchModel := new(vpcv1.NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) - networkACLRuleBeforePatchModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - - // Construct an instance of the NetworkACLRulePatch model - networkACLRulePatchModel := new(vpcv1.NetworkACLRulePatch) - networkACLRulePatchModel.Action = core.StringPtr("allow") - networkACLRulePatchModel.Before = networkACLRuleBeforePatchModel - networkACLRulePatchModel.Code = core.Int64Ptr(int64(0)) - networkACLRulePatchModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePatchModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePatchModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePatchModel.Direction = core.StringPtr("inbound") - networkACLRulePatchModel.Name = core.StringPtr("my-rule-1") - networkACLRulePatchModel.Protocol = core.StringPtr("tcp") - networkACLRulePatchModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePatchModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePatchModel.SourcePortMin = core.Int64Ptr(int64(49152)) - networkACLRulePatchModel.Type = core.Int64Ptr(int64(8)) - networkACLRulePatchModelAsPatch, asPatchErr := networkACLRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateNetworkACLRuleOptions model - updateNetworkACLRuleOptionsModel := new(vpcv1.UpdateNetworkACLRuleOptions) - updateNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - updateNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") - updateNetworkACLRuleOptionsModel.NetworkACLRulePatch = networkACLRulePatchModelAsPatch - updateNetworkACLRuleOptionsModel.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.UpdateNetworkACLRule(updateNetworkACLRuleOptionsModel) - 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 UpdateNetworkACLRuleOptions model with no property values - updateNetworkACLRuleOptionsModelNew := new(vpcv1.UpdateNetworkACLRuleOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateNetworkACLRule(updateNetworkACLRuleOptionsModelNew) - 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 UpdateNetworkACLRule 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 NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID model - networkACLRuleBeforePatchModel := new(vpcv1.NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) - networkACLRuleBeforePatchModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - - // Construct an instance of the NetworkACLRulePatch model - networkACLRulePatchModel := new(vpcv1.NetworkACLRulePatch) - networkACLRulePatchModel.Action = core.StringPtr("allow") - networkACLRulePatchModel.Before = networkACLRuleBeforePatchModel - networkACLRulePatchModel.Code = core.Int64Ptr(int64(0)) - networkACLRulePatchModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePatchModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePatchModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePatchModel.Direction = core.StringPtr("inbound") - networkACLRulePatchModel.Name = core.StringPtr("my-rule-1") - networkACLRulePatchModel.Protocol = core.StringPtr("tcp") - networkACLRulePatchModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePatchModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePatchModel.SourcePortMin = core.Int64Ptr(int64(49152)) - networkACLRulePatchModel.Type = core.Int64Ptr(int64(8)) - networkACLRulePatchModelAsPatch, asPatchErr := networkACLRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateNetworkACLRuleOptions model - updateNetworkACLRuleOptionsModel := new(vpcv1.UpdateNetworkACLRuleOptions) - updateNetworkACLRuleOptionsModel.NetworkACLID = core.StringPtr("testString") - updateNetworkACLRuleOptionsModel.ID = core.StringPtr("testString") - updateNetworkACLRuleOptionsModel.NetworkACLRulePatch = networkACLRulePatchModelAsPatch - updateNetworkACLRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateNetworkACLRule(updateNetworkACLRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListSecurityGroups(listSecurityGroupsOptions *ListSecurityGroupsOptions) - Operation response error`, func() { - version := "testString" - listSecurityGroupsPath := "/security_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(listSecurityGroupsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListSecurityGroups 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 ListSecurityGroupsOptions model - listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) - listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCName = core.StringPtr("testString") - listSecurityGroupsOptionsModel.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.ListSecurityGroups(listSecurityGroupsOptionsModel) - 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.ListSecurityGroups(listSecurityGroupsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListSecurityGroups(listSecurityGroupsOptions *ListSecurityGroupsOptions)`, func() { - version := "testString" - listSecurityGroupsPath := "/security_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(listSecurityGroupsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.name"]).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/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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}`) - })) - }) - It(`Invoke ListSecurityGroups 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 ListSecurityGroupsOptions model - listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) - listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCName = core.StringPtr("testString") - listSecurityGroupsOptionsModel.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.ListSecurityGroupsWithContext(ctx, listSecurityGroupsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListSecurityGroups(listSecurityGroupsOptionsModel) - 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.ListSecurityGroupsWithContext(ctx, listSecurityGroupsOptionsModel) - 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(listSecurityGroupsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.name"]).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/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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}], "total_count": 132}`) - })) - }) - It(`Invoke ListSecurityGroups 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.ListSecurityGroups(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListSecurityGroupsOptions model - listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) - listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCName = core.StringPtr("testString") - listSecurityGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListSecurityGroups(listSecurityGroupsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListSecurityGroups 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 ListSecurityGroupsOptions model - listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) - listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCName = core.StringPtr("testString") - listSecurityGroupsOptionsModel.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.ListSecurityGroups(listSecurityGroupsOptionsModel) - 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 ListSecurityGroups 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 ListSecurityGroupsOptions model - listSecurityGroupsOptionsModel := new(vpcv1.ListSecurityGroupsOptions) - listSecurityGroupsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSecurityGroupsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCID = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCCRN = core.StringPtr("testString") - listSecurityGroupsOptionsModel.VPCName = core.StringPtr("testString") - listSecurityGroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListSecurityGroups(listSecurityGroupsOptionsModel) - 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.SecurityGroupCollection) - nextObject := new(vpcv1.SecurityGroupCollectionNext) - 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.SecurityGroupCollection) - - 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.SecurityGroupCollection) - nextObject := new(vpcv1.SecurityGroupCollectionNext) - 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(listSecurityGroupsPath)) - 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"},"security_groups":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"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","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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271","href":"https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"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","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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-network-interface","resource_type":"network_interface"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use SecurityGroupsPager.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()) - - listSecurityGroupsOptionsModel := &vpcv1.ListSecurityGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - VPCID: core.StringPtr("testString"), - VPCCRN: core.StringPtr("testString"), - VPCName: core.StringPtr("testString"), - } - - pager, err := vpcService.NewSecurityGroupsPager(listSecurityGroupsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.SecurityGroup - 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 SecurityGroupsPager.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()) - - listSecurityGroupsOptionsModel := &vpcv1.ListSecurityGroupsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - VPCID: core.StringPtr("testString"), - VPCCRN: core.StringPtr("testString"), - VPCName: core.StringPtr("testString"), - } - - pager, err := vpcService.NewSecurityGroupsPager(listSecurityGroupsOptionsModel) - 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(`CreateSecurityGroup(createSecurityGroupOptions *CreateSecurityGroupOptions) - Operation response error`, func() { - version := "testString" - createSecurityGroupPath := "/security_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(createSecurityGroupPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateSecurityGroup 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 VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupRuleRemotePrototypeIP model - securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) - securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") - securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - - // Construct an instance of the CreateSecurityGroupOptions model - createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) - createSecurityGroupOptionsModel.VPC = vpcIdentityModel - createSecurityGroupOptionsModel.Name = core.StringPtr("my-security-group") - createSecurityGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createSecurityGroupOptionsModel.Rules = []vpcv1.SecurityGroupRulePrototypeIntf{securityGroupRulePrototypeModel} - createSecurityGroupOptionsModel.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.CreateSecurityGroup(createSecurityGroupOptionsModel) - 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.CreateSecurityGroup(createSecurityGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateSecurityGroup(createSecurityGroupOptions *CreateSecurityGroupOptions)`, func() { - version := "testString" - createSecurityGroupPath := "/security_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(createSecurityGroupPath)) - 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{"testString"})) - 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke CreateSecurityGroup 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 VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupRuleRemotePrototypeIP model - securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) - securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") - securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - - // Construct an instance of the CreateSecurityGroupOptions model - createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) - createSecurityGroupOptionsModel.VPC = vpcIdentityModel - createSecurityGroupOptionsModel.Name = core.StringPtr("my-security-group") - createSecurityGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createSecurityGroupOptionsModel.Rules = []vpcv1.SecurityGroupRulePrototypeIntf{securityGroupRulePrototypeModel} - createSecurityGroupOptionsModel.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.CreateSecurityGroupWithContext(ctx, createSecurityGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateSecurityGroup(createSecurityGroupOptionsModel) - 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.CreateSecurityGroupWithContext(ctx, createSecurityGroupOptionsModel) - 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(createSecurityGroupPath)) - 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{"testString"})) - 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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke CreateSecurityGroup 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.CreateSecurityGroup(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupRuleRemotePrototypeIP model - securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) - securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") - securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - - // Construct an instance of the CreateSecurityGroupOptions model - createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) - createSecurityGroupOptionsModel.VPC = vpcIdentityModel - createSecurityGroupOptionsModel.Name = core.StringPtr("my-security-group") - createSecurityGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createSecurityGroupOptionsModel.Rules = []vpcv1.SecurityGroupRulePrototypeIntf{securityGroupRulePrototypeModel} - createSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateSecurityGroup(createSecurityGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateSecurityGroup 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 VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupRuleRemotePrototypeIP model - securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) - securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") - securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - - // Construct an instance of the CreateSecurityGroupOptions model - createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) - createSecurityGroupOptionsModel.VPC = vpcIdentityModel - createSecurityGroupOptionsModel.Name = core.StringPtr("my-security-group") - createSecurityGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createSecurityGroupOptionsModel.Rules = []vpcv1.SecurityGroupRulePrototypeIntf{securityGroupRulePrototypeModel} - createSecurityGroupOptionsModel.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.CreateSecurityGroup(createSecurityGroupOptionsModel) - 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 CreateSecurityGroupOptions model with no property values - createSecurityGroupOptionsModelNew := new(vpcv1.CreateSecurityGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateSecurityGroup(createSecurityGroupOptionsModelNew) - 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 CreateSecurityGroup 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 VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the SecurityGroupRuleRemotePrototypeIP model - securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) - securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") - securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - - // Construct an instance of the CreateSecurityGroupOptions model - createSecurityGroupOptionsModel := new(vpcv1.CreateSecurityGroupOptions) - createSecurityGroupOptionsModel.VPC = vpcIdentityModel - createSecurityGroupOptionsModel.Name = core.StringPtr("my-security-group") - createSecurityGroupOptionsModel.ResourceGroup = resourceGroupIdentityModel - createSecurityGroupOptionsModel.Rules = []vpcv1.SecurityGroupRulePrototypeIntf{securityGroupRulePrototypeModel} - createSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateSecurityGroup(createSecurityGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteSecurityGroup(deleteSecurityGroupOptions *DeleteSecurityGroupOptions)`, func() { - version := "testString" - deleteSecurityGroupPath := "/security_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(deleteSecurityGroupPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteSecurityGroup 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.DeleteSecurityGroup(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteSecurityGroupOptions model - deleteSecurityGroupOptionsModel := new(vpcv1.DeleteSecurityGroupOptions) - deleteSecurityGroupOptionsModel.ID = core.StringPtr("testString") - deleteSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteSecurityGroup(deleteSecurityGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteSecurityGroup 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 DeleteSecurityGroupOptions model - deleteSecurityGroupOptionsModel := new(vpcv1.DeleteSecurityGroupOptions) - deleteSecurityGroupOptionsModel.ID = core.StringPtr("testString") - deleteSecurityGroupOptionsModel.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.DeleteSecurityGroup(deleteSecurityGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSecurityGroupOptions model with no property values - deleteSecurityGroupOptionsModelNew := new(vpcv1.DeleteSecurityGroupOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteSecurityGroup(deleteSecurityGroupOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSecurityGroup(getSecurityGroupOptions *GetSecurityGroupOptions) - Operation response error`, func() { - version := "testString" - getSecurityGroupPath := "/security_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(getSecurityGroupPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetSecurityGroup 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 GetSecurityGroupOptions model - getSecurityGroupOptionsModel := new(vpcv1.GetSecurityGroupOptions) - getSecurityGroupOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupOptionsModel.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.GetSecurityGroup(getSecurityGroupOptionsModel) - 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.GetSecurityGroup(getSecurityGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSecurityGroup(getSecurityGroupOptions *GetSecurityGroupOptions)`, func() { - version := "testString" - getSecurityGroupPath := "/security_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(getSecurityGroupPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetSecurityGroup 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 GetSecurityGroupOptions model - getSecurityGroupOptionsModel := new(vpcv1.GetSecurityGroupOptions) - getSecurityGroupOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupOptionsModel.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.GetSecurityGroupWithContext(ctx, getSecurityGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetSecurityGroup(getSecurityGroupOptionsModel) - 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.GetSecurityGroupWithContext(ctx, getSecurityGroupOptionsModel) - 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(getSecurityGroupPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetSecurityGroup 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.GetSecurityGroup(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetSecurityGroupOptions model - getSecurityGroupOptionsModel := new(vpcv1.GetSecurityGroupOptions) - getSecurityGroupOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSecurityGroup(getSecurityGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetSecurityGroup 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 GetSecurityGroupOptions model - getSecurityGroupOptionsModel := new(vpcv1.GetSecurityGroupOptions) - getSecurityGroupOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupOptionsModel.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.GetSecurityGroup(getSecurityGroupOptionsModel) - 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 GetSecurityGroupOptions model with no property values - getSecurityGroupOptionsModelNew := new(vpcv1.GetSecurityGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetSecurityGroup(getSecurityGroupOptionsModelNew) - 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 GetSecurityGroup 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 GetSecurityGroupOptions model - getSecurityGroupOptionsModel := new(vpcv1.GetSecurityGroupOptions) - getSecurityGroupOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetSecurityGroup(getSecurityGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateSecurityGroup(updateSecurityGroupOptions *UpdateSecurityGroupOptions) - Operation response error`, func() { - version := "testString" - updateSecurityGroupPath := "/security_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(updateSecurityGroupPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateSecurityGroup 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 SecurityGroupPatch model - securityGroupPatchModel := new(vpcv1.SecurityGroupPatch) - securityGroupPatchModel.Name = core.StringPtr("my-security-group") - securityGroupPatchModelAsPatch, asPatchErr := securityGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSecurityGroupOptions model - updateSecurityGroupOptionsModel := new(vpcv1.UpdateSecurityGroupOptions) - updateSecurityGroupOptionsModel.ID = core.StringPtr("testString") - updateSecurityGroupOptionsModel.SecurityGroupPatch = securityGroupPatchModelAsPatch - updateSecurityGroupOptionsModel.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.UpdateSecurityGroup(updateSecurityGroupOptionsModel) - 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.UpdateSecurityGroup(updateSecurityGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateSecurityGroup(updateSecurityGroupOptions *UpdateSecurityGroupOptions)`, func() { - version := "testString" - updateSecurityGroupPath := "/security_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(updateSecurityGroupPath)) - 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{"testString"})) - 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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke UpdateSecurityGroup 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 SecurityGroupPatch model - securityGroupPatchModel := new(vpcv1.SecurityGroupPatch) - securityGroupPatchModel.Name = core.StringPtr("my-security-group") - securityGroupPatchModelAsPatch, asPatchErr := securityGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSecurityGroupOptions model - updateSecurityGroupOptionsModel := new(vpcv1.UpdateSecurityGroupOptions) - updateSecurityGroupOptionsModel.ID = core.StringPtr("testString") - updateSecurityGroupOptionsModel.SecurityGroupPatch = securityGroupPatchModelAsPatch - updateSecurityGroupOptionsModel.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.UpdateSecurityGroupWithContext(ctx, updateSecurityGroupOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateSecurityGroup(updateSecurityGroupOptionsModel) - 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.UpdateSecurityGroupWithContext(ctx, updateSecurityGroupOptionsModel) - 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(updateSecurityGroupPath)) - 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{"testString"})) - 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/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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", "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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke UpdateSecurityGroup 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.UpdateSecurityGroup(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the SecurityGroupPatch model - securityGroupPatchModel := new(vpcv1.SecurityGroupPatch) - securityGroupPatchModel.Name = core.StringPtr("my-security-group") - securityGroupPatchModelAsPatch, asPatchErr := securityGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSecurityGroupOptions model - updateSecurityGroupOptionsModel := new(vpcv1.UpdateSecurityGroupOptions) - updateSecurityGroupOptionsModel.ID = core.StringPtr("testString") - updateSecurityGroupOptionsModel.SecurityGroupPatch = securityGroupPatchModelAsPatch - updateSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateSecurityGroup(updateSecurityGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateSecurityGroup 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 SecurityGroupPatch model - securityGroupPatchModel := new(vpcv1.SecurityGroupPatch) - securityGroupPatchModel.Name = core.StringPtr("my-security-group") - securityGroupPatchModelAsPatch, asPatchErr := securityGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSecurityGroupOptions model - updateSecurityGroupOptionsModel := new(vpcv1.UpdateSecurityGroupOptions) - updateSecurityGroupOptionsModel.ID = core.StringPtr("testString") - updateSecurityGroupOptionsModel.SecurityGroupPatch = securityGroupPatchModelAsPatch - updateSecurityGroupOptionsModel.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.UpdateSecurityGroup(updateSecurityGroupOptionsModel) - 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 UpdateSecurityGroupOptions model with no property values - updateSecurityGroupOptionsModelNew := new(vpcv1.UpdateSecurityGroupOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateSecurityGroup(updateSecurityGroupOptionsModelNew) - 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 UpdateSecurityGroup 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 SecurityGroupPatch model - securityGroupPatchModel := new(vpcv1.SecurityGroupPatch) - securityGroupPatchModel.Name = core.StringPtr("my-security-group") - securityGroupPatchModelAsPatch, asPatchErr := securityGroupPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSecurityGroupOptions model - updateSecurityGroupOptionsModel := new(vpcv1.UpdateSecurityGroupOptions) - updateSecurityGroupOptionsModel.ID = core.StringPtr("testString") - updateSecurityGroupOptionsModel.SecurityGroupPatch = securityGroupPatchModelAsPatch - updateSecurityGroupOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateSecurityGroup(updateSecurityGroupOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListSecurityGroupRules(listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) - Operation response error`, func() { - version := "testString" - listSecurityGroupRulesPath := "/security_groups/testString/rules" - 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(listSecurityGroupRulesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListSecurityGroupRules 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 ListSecurityGroupRulesOptions model - listSecurityGroupRulesOptionsModel := new(vpcv1.ListSecurityGroupRulesOptions) - listSecurityGroupRulesOptionsModel.SecurityGroupID = core.StringPtr("testString") - listSecurityGroupRulesOptionsModel.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.ListSecurityGroupRules(listSecurityGroupRulesOptionsModel) - 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.ListSecurityGroupRules(listSecurityGroupRulesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListSecurityGroupRules(listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions)`, func() { - version := "testString" - listSecurityGroupRulesPath := "/security_groups/testString/rules" - 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(listSecurityGroupRulesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}`) - })) - }) - It(`Invoke ListSecurityGroupRules 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 ListSecurityGroupRulesOptions model - listSecurityGroupRulesOptionsModel := new(vpcv1.ListSecurityGroupRulesOptions) - listSecurityGroupRulesOptionsModel.SecurityGroupID = core.StringPtr("testString") - listSecurityGroupRulesOptionsModel.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.ListSecurityGroupRulesWithContext(ctx, listSecurityGroupRulesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListSecurityGroupRules(listSecurityGroupRulesOptionsModel) - 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.ListSecurityGroupRulesWithContext(ctx, listSecurityGroupRulesOptionsModel) - 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(listSecurityGroupRulesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}]}`) - })) - }) - It(`Invoke ListSecurityGroupRules 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.ListSecurityGroupRules(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListSecurityGroupRulesOptions model - listSecurityGroupRulesOptionsModel := new(vpcv1.ListSecurityGroupRulesOptions) - listSecurityGroupRulesOptionsModel.SecurityGroupID = core.StringPtr("testString") - listSecurityGroupRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListSecurityGroupRules(listSecurityGroupRulesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListSecurityGroupRules 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 ListSecurityGroupRulesOptions model - listSecurityGroupRulesOptionsModel := new(vpcv1.ListSecurityGroupRulesOptions) - listSecurityGroupRulesOptionsModel.SecurityGroupID = core.StringPtr("testString") - listSecurityGroupRulesOptionsModel.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.ListSecurityGroupRules(listSecurityGroupRulesOptionsModel) - 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 ListSecurityGroupRulesOptions model with no property values - listSecurityGroupRulesOptionsModelNew := new(vpcv1.ListSecurityGroupRulesOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListSecurityGroupRules(listSecurityGroupRulesOptionsModelNew) - 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 ListSecurityGroupRules 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 ListSecurityGroupRulesOptions model - listSecurityGroupRulesOptionsModel := new(vpcv1.ListSecurityGroupRulesOptions) - listSecurityGroupRulesOptionsModel.SecurityGroupID = core.StringPtr("testString") - listSecurityGroupRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListSecurityGroupRules(listSecurityGroupRulesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateSecurityGroupRule(createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) - Operation response error`, func() { - version := "testString" - createSecurityGroupRulePath := "/security_groups/testString/rules" - 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(createSecurityGroupRulePath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateSecurityGroupRule 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 SecurityGroupRuleRemotePrototypeIP model - securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) - securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") - securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - - // Construct an instance of the CreateSecurityGroupRuleOptions model - createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) - createSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - createSecurityGroupRuleOptionsModel.SecurityGroupRulePrototype = securityGroupRulePrototypeModel - createSecurityGroupRuleOptionsModel.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.CreateSecurityGroupRule(createSecurityGroupRuleOptionsModel) - 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.CreateSecurityGroupRule(createSecurityGroupRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateSecurityGroupRule(createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions)`, func() { - version := "testString" - createSecurityGroupRulePath := "/security_groups/testString/rules" - 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(createSecurityGroupRulePath)) - 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{"testString"})) - 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) - })) - }) - It(`Invoke CreateSecurityGroupRule 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 SecurityGroupRuleRemotePrototypeIP model - securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) - securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") - securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - - // Construct an instance of the CreateSecurityGroupRuleOptions model - createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) - createSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - createSecurityGroupRuleOptionsModel.SecurityGroupRulePrototype = securityGroupRulePrototypeModel - createSecurityGroupRuleOptionsModel.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.CreateSecurityGroupRuleWithContext(ctx, createSecurityGroupRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateSecurityGroupRule(createSecurityGroupRuleOptionsModel) - 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.CreateSecurityGroupRuleWithContext(ctx, createSecurityGroupRuleOptionsModel) - 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(createSecurityGroupRulePath)) - 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{"testString"})) - 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) - })) - }) - It(`Invoke CreateSecurityGroupRule 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.CreateSecurityGroupRule(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the SecurityGroupRuleRemotePrototypeIP model - securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) - securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") - securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - - // Construct an instance of the CreateSecurityGroupRuleOptions model - createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) - createSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - createSecurityGroupRuleOptionsModel.SecurityGroupRulePrototype = securityGroupRulePrototypeModel - createSecurityGroupRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateSecurityGroupRule(createSecurityGroupRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateSecurityGroupRule 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 SecurityGroupRuleRemotePrototypeIP model - securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) - securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") - securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - - // Construct an instance of the CreateSecurityGroupRuleOptions model - createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) - createSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - createSecurityGroupRuleOptionsModel.SecurityGroupRulePrototype = securityGroupRulePrototypeModel - createSecurityGroupRuleOptionsModel.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.CreateSecurityGroupRule(createSecurityGroupRuleOptionsModel) - 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 CreateSecurityGroupRuleOptions model with no property values - createSecurityGroupRuleOptionsModelNew := new(vpcv1.CreateSecurityGroupRuleOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateSecurityGroupRule(createSecurityGroupRuleOptionsModelNew) - 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 CreateSecurityGroupRule 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 SecurityGroupRuleRemotePrototypeIP model - securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) - securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") - securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - - // Construct an instance of the CreateSecurityGroupRuleOptions model - createSecurityGroupRuleOptionsModel := new(vpcv1.CreateSecurityGroupRuleOptions) - createSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - createSecurityGroupRuleOptionsModel.SecurityGroupRulePrototype = securityGroupRulePrototypeModel - createSecurityGroupRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateSecurityGroupRule(createSecurityGroupRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteSecurityGroupRule(deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions)`, func() { - version := "testString" - deleteSecurityGroupRulePath := "/security_groups/testString/rules/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(deleteSecurityGroupRulePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteSecurityGroupRule 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.DeleteSecurityGroupRule(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteSecurityGroupRuleOptions model - deleteSecurityGroupRuleOptionsModel := new(vpcv1.DeleteSecurityGroupRuleOptions) - deleteSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - deleteSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") - deleteSecurityGroupRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteSecurityGroupRule(deleteSecurityGroupRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteSecurityGroupRule 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 DeleteSecurityGroupRuleOptions model - deleteSecurityGroupRuleOptionsModel := new(vpcv1.DeleteSecurityGroupRuleOptions) - deleteSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - deleteSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") - deleteSecurityGroupRuleOptionsModel.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.DeleteSecurityGroupRule(deleteSecurityGroupRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSecurityGroupRuleOptions model with no property values - deleteSecurityGroupRuleOptionsModelNew := new(vpcv1.DeleteSecurityGroupRuleOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteSecurityGroupRule(deleteSecurityGroupRuleOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSecurityGroupRule(getSecurityGroupRuleOptions *GetSecurityGroupRuleOptions) - Operation response error`, func() { - version := "testString" - getSecurityGroupRulePath := "/security_groups/testString/rules/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(getSecurityGroupRulePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetSecurityGroupRule 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 GetSecurityGroupRuleOptions model - getSecurityGroupRuleOptionsModel := new(vpcv1.GetSecurityGroupRuleOptions) - getSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - getSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupRuleOptionsModel.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.GetSecurityGroupRule(getSecurityGroupRuleOptionsModel) - 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.GetSecurityGroupRule(getSecurityGroupRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSecurityGroupRule(getSecurityGroupRuleOptions *GetSecurityGroupRuleOptions)`, func() { - version := "testString" - getSecurityGroupRulePath := "/security_groups/testString/rules/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(getSecurityGroupRulePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) - })) - }) - It(`Invoke GetSecurityGroupRule 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 GetSecurityGroupRuleOptions model - getSecurityGroupRuleOptionsModel := new(vpcv1.GetSecurityGroupRuleOptions) - getSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - getSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupRuleOptionsModel.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.GetSecurityGroupRuleWithContext(ctx, getSecurityGroupRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetSecurityGroupRule(getSecurityGroupRuleOptionsModel) - 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.GetSecurityGroupRuleWithContext(ctx, getSecurityGroupRuleOptionsModel) - 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(getSecurityGroupRulePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) - })) - }) - It(`Invoke GetSecurityGroupRule 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.GetSecurityGroupRule(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetSecurityGroupRuleOptions model - getSecurityGroupRuleOptionsModel := new(vpcv1.GetSecurityGroupRuleOptions) - getSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - getSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSecurityGroupRule(getSecurityGroupRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetSecurityGroupRule 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 GetSecurityGroupRuleOptions model - getSecurityGroupRuleOptionsModel := new(vpcv1.GetSecurityGroupRuleOptions) - getSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - getSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupRuleOptionsModel.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.GetSecurityGroupRule(getSecurityGroupRuleOptionsModel) - 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 GetSecurityGroupRuleOptions model with no property values - getSecurityGroupRuleOptionsModelNew := new(vpcv1.GetSecurityGroupRuleOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetSecurityGroupRule(getSecurityGroupRuleOptionsModelNew) - 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 GetSecurityGroupRule 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 GetSecurityGroupRuleOptions model - getSecurityGroupRuleOptionsModel := new(vpcv1.GetSecurityGroupRuleOptions) - getSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - getSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetSecurityGroupRule(getSecurityGroupRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) - Operation response error`, func() { - version := "testString" - updateSecurityGroupRulePath := "/security_groups/testString/rules/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(updateSecurityGroupRulePath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateSecurityGroupRule 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 SecurityGroupRuleRemotePatchIP model - securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) - securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePatch model - securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) - securityGroupRulePatchModel.Code = core.Int64Ptr(int64(0)) - securityGroupRulePatchModel.Direction = core.StringPtr("inbound") - securityGroupRulePatchModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePatchModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePatchModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePatchModel.Remote = securityGroupRuleRemotePatchModel - securityGroupRulePatchModel.Type = core.Int64Ptr(int64(8)) - securityGroupRulePatchModelAsPatch, asPatchErr := securityGroupRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSecurityGroupRuleOptions model - updateSecurityGroupRuleOptionsModel := new(vpcv1.UpdateSecurityGroupRuleOptions) - updateSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - updateSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") - updateSecurityGroupRuleOptionsModel.SecurityGroupRulePatch = securityGroupRulePatchModelAsPatch - updateSecurityGroupRuleOptionsModel.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.UpdateSecurityGroupRule(updateSecurityGroupRuleOptionsModel) - 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.UpdateSecurityGroupRule(updateSecurityGroupRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions)`, func() { - version := "testString" - updateSecurityGroupRulePath := "/security_groups/testString/rules/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(updateSecurityGroupRulePath)) - 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{"testString"})) - 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) - })) - }) - It(`Invoke UpdateSecurityGroupRule 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 SecurityGroupRuleRemotePatchIP model - securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) - securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePatch model - securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) - securityGroupRulePatchModel.Code = core.Int64Ptr(int64(0)) - securityGroupRulePatchModel.Direction = core.StringPtr("inbound") - securityGroupRulePatchModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePatchModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePatchModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePatchModel.Remote = securityGroupRuleRemotePatchModel - securityGroupRulePatchModel.Type = core.Int64Ptr(int64(8)) - securityGroupRulePatchModelAsPatch, asPatchErr := securityGroupRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSecurityGroupRuleOptions model - updateSecurityGroupRuleOptionsModel := new(vpcv1.UpdateSecurityGroupRuleOptions) - updateSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - updateSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") - updateSecurityGroupRuleOptionsModel.SecurityGroupRulePatch = securityGroupRulePatchModelAsPatch - updateSecurityGroupRuleOptionsModel.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.UpdateSecurityGroupRuleWithContext(ctx, updateSecurityGroupRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateSecurityGroupRule(updateSecurityGroupRuleOptionsModel) - 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.UpdateSecurityGroupRuleWithContext(ctx, updateSecurityGroupRuleOptionsModel) - 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(updateSecurityGroupRulePath)) - 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{"testString"})) - 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", `{"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", "remote": {"address": "192.168.3.4"}, "protocol": "all"}`) - })) - }) - It(`Invoke UpdateSecurityGroupRule 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.UpdateSecurityGroupRule(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the SecurityGroupRuleRemotePatchIP model - securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) - securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePatch model - securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) - securityGroupRulePatchModel.Code = core.Int64Ptr(int64(0)) - securityGroupRulePatchModel.Direction = core.StringPtr("inbound") - securityGroupRulePatchModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePatchModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePatchModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePatchModel.Remote = securityGroupRuleRemotePatchModel - securityGroupRulePatchModel.Type = core.Int64Ptr(int64(8)) - securityGroupRulePatchModelAsPatch, asPatchErr := securityGroupRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSecurityGroupRuleOptions model - updateSecurityGroupRuleOptionsModel := new(vpcv1.UpdateSecurityGroupRuleOptions) - updateSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - updateSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") - updateSecurityGroupRuleOptionsModel.SecurityGroupRulePatch = securityGroupRulePatchModelAsPatch - updateSecurityGroupRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateSecurityGroupRule(updateSecurityGroupRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateSecurityGroupRule 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 SecurityGroupRuleRemotePatchIP model - securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) - securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePatch model - securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) - securityGroupRulePatchModel.Code = core.Int64Ptr(int64(0)) - securityGroupRulePatchModel.Direction = core.StringPtr("inbound") - securityGroupRulePatchModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePatchModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePatchModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePatchModel.Remote = securityGroupRuleRemotePatchModel - securityGroupRulePatchModel.Type = core.Int64Ptr(int64(8)) - securityGroupRulePatchModelAsPatch, asPatchErr := securityGroupRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSecurityGroupRuleOptions model - updateSecurityGroupRuleOptionsModel := new(vpcv1.UpdateSecurityGroupRuleOptions) - updateSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - updateSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") - updateSecurityGroupRuleOptionsModel.SecurityGroupRulePatch = securityGroupRulePatchModelAsPatch - updateSecurityGroupRuleOptionsModel.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.UpdateSecurityGroupRule(updateSecurityGroupRuleOptionsModel) - 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 UpdateSecurityGroupRuleOptions model with no property values - updateSecurityGroupRuleOptionsModelNew := new(vpcv1.UpdateSecurityGroupRuleOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateSecurityGroupRule(updateSecurityGroupRuleOptionsModelNew) - 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 UpdateSecurityGroupRule 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 SecurityGroupRuleRemotePatchIP model - securityGroupRuleRemotePatchModel := new(vpcv1.SecurityGroupRuleRemotePatchIP) - securityGroupRuleRemotePatchModel.Address = core.StringPtr("192.168.3.4") - - // Construct an instance of the SecurityGroupRulePatch model - securityGroupRulePatchModel := new(vpcv1.SecurityGroupRulePatch) - securityGroupRulePatchModel.Code = core.Int64Ptr(int64(0)) - securityGroupRulePatchModel.Direction = core.StringPtr("inbound") - securityGroupRulePatchModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePatchModel.PortMax = core.Int64Ptr(int64(22)) - securityGroupRulePatchModel.PortMin = core.Int64Ptr(int64(22)) - securityGroupRulePatchModel.Remote = securityGroupRuleRemotePatchModel - securityGroupRulePatchModel.Type = core.Int64Ptr(int64(8)) - securityGroupRulePatchModelAsPatch, asPatchErr := securityGroupRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSecurityGroupRuleOptions model - updateSecurityGroupRuleOptionsModel := new(vpcv1.UpdateSecurityGroupRuleOptions) - updateSecurityGroupRuleOptionsModel.SecurityGroupID = core.StringPtr("testString") - updateSecurityGroupRuleOptionsModel.ID = core.StringPtr("testString") - updateSecurityGroupRuleOptionsModel.SecurityGroupRulePatch = securityGroupRulePatchModelAsPatch - updateSecurityGroupRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateSecurityGroupRule(updateSecurityGroupRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListSecurityGroupTargets(listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) - Operation response error`, func() { - version := "testString" - listSecurityGroupTargetsPath := "/security_groups/testString/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(listSecurityGroupTargetsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListSecurityGroupTargets 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 ListSecurityGroupTargetsOptions model - listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) - listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSecurityGroupTargetsOptionsModel.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.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModel) - 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.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListSecurityGroupTargets(listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions)`, func() { - version := "testString" - listSecurityGroupTargetsPath := "/security_groups/testString/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(listSecurityGroupTargetsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "total_count": 132}`) - })) - }) - It(`Invoke ListSecurityGroupTargets 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 ListSecurityGroupTargetsOptions model - listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) - listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSecurityGroupTargetsOptionsModel.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.ListSecurityGroupTargetsWithContext(ctx, listSecurityGroupTargetsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModel) - 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.ListSecurityGroupTargetsWithContext(ctx, listSecurityGroupTargetsOptionsModel) - 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(listSecurityGroupTargetsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}], "total_count": 132}`) - })) - }) - It(`Invoke ListSecurityGroupTargets 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.ListSecurityGroupTargets(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListSecurityGroupTargetsOptions model - listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) - listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSecurityGroupTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListSecurityGroupTargets 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 ListSecurityGroupTargetsOptions model - listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) - listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSecurityGroupTargetsOptionsModel.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.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModel) - 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 ListSecurityGroupTargetsOptions model with no property values - listSecurityGroupTargetsOptionsModelNew := new(vpcv1.ListSecurityGroupTargetsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModelNew) - 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 ListSecurityGroupTargets 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 ListSecurityGroupTargetsOptions model - listSecurityGroupTargetsOptionsModel := new(vpcv1.ListSecurityGroupTargetsOptions) - listSecurityGroupTargetsOptionsModel.SecurityGroupID = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Start = core.StringPtr("testString") - listSecurityGroupTargetsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listSecurityGroupTargetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListSecurityGroupTargets(listSecurityGroupTargetsOptionsModel) - 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.SecurityGroupTargetCollection) - nextObject := new(vpcv1.SecurityGroupTargetCollectionNext) - 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.SecurityGroupTargetCollection) - - 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.SecurityGroupTargetCollection) - nextObject := new(vpcv1.SecurityGroupTargetCollectionNext) - 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(listSecurityGroupTargetsPath)) - 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,"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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-network-interface","resource_type":"network_interface"}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use SecurityGroupTargetsPager.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()) - - listSecurityGroupTargetsOptionsModel := &vpcv1.ListSecurityGroupTargetsOptions{ - SecurityGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewSecurityGroupTargetsPager(listSecurityGroupTargetsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.SecurityGroupTargetReferenceIntf - 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 SecurityGroupTargetsPager.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()) - - listSecurityGroupTargetsOptionsModel := &vpcv1.ListSecurityGroupTargetsOptions{ - SecurityGroupID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewSecurityGroupTargetsPager(listSecurityGroupTargetsOptionsModel) - 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(`DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions)`, func() { - version := "testString" - deleteSecurityGroupTargetBindingPath := "/security_groups/testString/targets/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(deleteSecurityGroupTargetBindingPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteSecurityGroupTargetBinding 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.DeleteSecurityGroupTargetBinding(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteSecurityGroupTargetBindingOptions model - deleteSecurityGroupTargetBindingOptionsModel := new(vpcv1.DeleteSecurityGroupTargetBindingOptions) - deleteSecurityGroupTargetBindingOptionsModel.SecurityGroupID = core.StringPtr("testString") - deleteSecurityGroupTargetBindingOptionsModel.ID = core.StringPtr("testString") - deleteSecurityGroupTargetBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteSecurityGroupTargetBinding 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 DeleteSecurityGroupTargetBindingOptions model - deleteSecurityGroupTargetBindingOptionsModel := new(vpcv1.DeleteSecurityGroupTargetBindingOptions) - deleteSecurityGroupTargetBindingOptionsModel.SecurityGroupID = core.StringPtr("testString") - deleteSecurityGroupTargetBindingOptionsModel.ID = core.StringPtr("testString") - deleteSecurityGroupTargetBindingOptionsModel.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.DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSecurityGroupTargetBindingOptions model with no property values - deleteSecurityGroupTargetBindingOptionsModelNew := new(vpcv1.DeleteSecurityGroupTargetBindingOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSecurityGroupTarget(getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) - Operation response error`, func() { - version := "testString" - getSecurityGroupTargetPath := "/security_groups/testString/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(getSecurityGroupTargetPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetSecurityGroupTarget 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 GetSecurityGroupTargetOptions model - getSecurityGroupTargetOptionsModel := new(vpcv1.GetSecurityGroupTargetOptions) - getSecurityGroupTargetOptionsModel.SecurityGroupID = core.StringPtr("testString") - getSecurityGroupTargetOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupTargetOptionsModel.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.GetSecurityGroupTarget(getSecurityGroupTargetOptionsModel) - 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.GetSecurityGroupTarget(getSecurityGroupTargetOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSecurityGroupTarget(getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions)`, func() { - version := "testString" - getSecurityGroupTargetPath := "/security_groups/testString/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(getSecurityGroupTargetPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}`) - })) - }) - It(`Invoke GetSecurityGroupTarget 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 GetSecurityGroupTargetOptions model - getSecurityGroupTargetOptionsModel := new(vpcv1.GetSecurityGroupTargetOptions) - getSecurityGroupTargetOptionsModel.SecurityGroupID = core.StringPtr("testString") - getSecurityGroupTargetOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupTargetOptionsModel.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.GetSecurityGroupTargetWithContext(ctx, getSecurityGroupTargetOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetSecurityGroupTarget(getSecurityGroupTargetOptionsModel) - 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.GetSecurityGroupTargetWithContext(ctx, getSecurityGroupTargetOptionsModel) - 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(getSecurityGroupTargetPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}`) - })) - }) - It(`Invoke GetSecurityGroupTarget 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.GetSecurityGroupTarget(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetSecurityGroupTargetOptions model - getSecurityGroupTargetOptionsModel := new(vpcv1.GetSecurityGroupTargetOptions) - getSecurityGroupTargetOptionsModel.SecurityGroupID = core.StringPtr("testString") - getSecurityGroupTargetOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetSecurityGroupTarget(getSecurityGroupTargetOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetSecurityGroupTarget 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 GetSecurityGroupTargetOptions model - getSecurityGroupTargetOptionsModel := new(vpcv1.GetSecurityGroupTargetOptions) - getSecurityGroupTargetOptionsModel.SecurityGroupID = core.StringPtr("testString") - getSecurityGroupTargetOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupTargetOptionsModel.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.GetSecurityGroupTarget(getSecurityGroupTargetOptionsModel) - 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 GetSecurityGroupTargetOptions model with no property values - getSecurityGroupTargetOptionsModelNew := new(vpcv1.GetSecurityGroupTargetOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetSecurityGroupTarget(getSecurityGroupTargetOptionsModelNew) - 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 GetSecurityGroupTarget 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 GetSecurityGroupTargetOptions model - getSecurityGroupTargetOptionsModel := new(vpcv1.GetSecurityGroupTargetOptions) - getSecurityGroupTargetOptionsModel.SecurityGroupID = core.StringPtr("testString") - getSecurityGroupTargetOptionsModel.ID = core.StringPtr("testString") - getSecurityGroupTargetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetSecurityGroupTarget(getSecurityGroupTargetOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) - Operation response error`, func() { - version := "testString" - createSecurityGroupTargetBindingPath := "/security_groups/testString/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(createSecurityGroupTargetBindingPath)) - Expect(req.Method).To(Equal("PUT")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateSecurityGroupTargetBinding 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 CreateSecurityGroupTargetBindingOptions model - createSecurityGroupTargetBindingOptionsModel := new(vpcv1.CreateSecurityGroupTargetBindingOptions) - createSecurityGroupTargetBindingOptionsModel.SecurityGroupID = core.StringPtr("testString") - createSecurityGroupTargetBindingOptionsModel.ID = core.StringPtr("testString") - createSecurityGroupTargetBindingOptionsModel.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.CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptionsModel) - 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.CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions)`, func() { - version := "testString" - createSecurityGroupTargetBindingPath := "/security_groups/testString/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(createSecurityGroupTargetBindingPath)) - Expect(req.Method).To(Equal("PUT")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}`) - })) - }) - It(`Invoke CreateSecurityGroupTargetBinding 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 CreateSecurityGroupTargetBindingOptions model - createSecurityGroupTargetBindingOptionsModel := new(vpcv1.CreateSecurityGroupTargetBindingOptions) - createSecurityGroupTargetBindingOptionsModel.SecurityGroupID = core.StringPtr("testString") - createSecurityGroupTargetBindingOptionsModel.ID = core.StringPtr("testString") - createSecurityGroupTargetBindingOptionsModel.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.CreateSecurityGroupTargetBindingWithContext(ctx, createSecurityGroupTargetBindingOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptionsModel) - 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.CreateSecurityGroupTargetBindingWithContext(ctx, createSecurityGroupTargetBindingOptionsModel) - 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(createSecurityGroupTargetBindingPath)) - Expect(req.Method).To(Equal("PUT")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}`) - })) - }) - It(`Invoke CreateSecurityGroupTargetBinding 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.CreateSecurityGroupTargetBinding(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the CreateSecurityGroupTargetBindingOptions model - createSecurityGroupTargetBindingOptionsModel := new(vpcv1.CreateSecurityGroupTargetBindingOptions) - createSecurityGroupTargetBindingOptionsModel.SecurityGroupID = core.StringPtr("testString") - createSecurityGroupTargetBindingOptionsModel.ID = core.StringPtr("testString") - createSecurityGroupTargetBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateSecurityGroupTargetBinding 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 CreateSecurityGroupTargetBindingOptions model - createSecurityGroupTargetBindingOptionsModel := new(vpcv1.CreateSecurityGroupTargetBindingOptions) - createSecurityGroupTargetBindingOptionsModel.SecurityGroupID = core.StringPtr("testString") - createSecurityGroupTargetBindingOptionsModel.ID = core.StringPtr("testString") - createSecurityGroupTargetBindingOptionsModel.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.CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptionsModel) - 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 CreateSecurityGroupTargetBindingOptions model with no property values - createSecurityGroupTargetBindingOptionsModelNew := new(vpcv1.CreateSecurityGroupTargetBindingOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptionsModelNew) - 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 CreateSecurityGroupTargetBinding 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 CreateSecurityGroupTargetBindingOptions model - createSecurityGroupTargetBindingOptionsModel := new(vpcv1.CreateSecurityGroupTargetBindingOptions) - createSecurityGroupTargetBindingOptionsModel.SecurityGroupID = core.StringPtr("testString") - createSecurityGroupTargetBindingOptionsModel.ID = core.StringPtr("testString") - createSecurityGroupTargetBindingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) - Operation response error`, func() { - version := "testString" - listIkePoliciesPath := "/ike_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(listIkePoliciesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListIkePolicies 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 ListIkePoliciesOptions model - listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) - listIkePoliciesOptionsModel.Start = core.StringPtr("testString") - listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listIkePoliciesOptionsModel.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.ListIkePolicies(listIkePoliciesOptionsModel) - 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.ListIkePolicies(listIkePoliciesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions)`, func() { - version := "testString" - listIkePoliciesPath := "/ike_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(listIkePoliciesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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}`) - })) - }) - It(`Invoke ListIkePolicies 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 ListIkePoliciesOptions model - listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) - listIkePoliciesOptionsModel.Start = core.StringPtr("testString") - listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listIkePoliciesOptionsModel.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.ListIkePoliciesWithContext(ctx, listIkePoliciesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListIkePolicies(listIkePoliciesOptionsModel) - 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.ListIkePoliciesWithContext(ctx, listIkePoliciesOptionsModel) - 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(listIkePoliciesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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}`) - })) - }) - It(`Invoke ListIkePolicies 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.ListIkePolicies(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListIkePoliciesOptions model - listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) - listIkePoliciesOptionsModel.Start = core.StringPtr("testString") - listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listIkePoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListIkePolicies(listIkePoliciesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListIkePolicies 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 ListIkePoliciesOptions model - listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) - listIkePoliciesOptionsModel.Start = core.StringPtr("testString") - listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listIkePoliciesOptionsModel.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.ListIkePolicies(listIkePoliciesOptionsModel) - 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 ListIkePolicies 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 ListIkePoliciesOptions model - listIkePoliciesOptionsModel := new(vpcv1.ListIkePoliciesOptions) - listIkePoliciesOptionsModel.Start = core.StringPtr("testString") - listIkePoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listIkePoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListIkePolicies(listIkePoliciesOptionsModel) - 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.IkePolicyCollection) - nextObject := new(vpcv1.IkePolicyCollectionNext) - 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.IkePolicyCollection) - - 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.IkePolicyCollection) - nextObject := new(vpcv1.IkePolicyCollectionNext) - 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(listIkePoliciesPath)) - 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,"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":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"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":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use IkePoliciesPager.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()) - - listIkePoliciesOptionsModel := &vpcv1.ListIkePoliciesOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewIkePoliciesPager(listIkePoliciesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.IkePolicy - 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 IkePoliciesPager.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()) - - listIkePoliciesOptionsModel := &vpcv1.ListIkePoliciesOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewIkePoliciesPager(listIkePoliciesOptionsModel) - 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(`CreateIkePolicy(createIkePolicyOptions *CreateIkePolicyOptions) - Operation response error`, func() { - version := "testString" - createIkePolicyPath := "/ike_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(createIkePolicyPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateIkePolicy 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateIkePolicyOptions model - createIkePolicyOptionsModel := new(vpcv1.CreateIkePolicyOptions) - createIkePolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") - createIkePolicyOptionsModel.DhGroup = core.Int64Ptr(int64(14)) - createIkePolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") - createIkePolicyOptionsModel.IkeVersion = core.Int64Ptr(int64(1)) - createIkePolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(28800)) - createIkePolicyOptionsModel.Name = core.StringPtr("my-ike-policy") - createIkePolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createIkePolicyOptionsModel.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.CreateIkePolicy(createIkePolicyOptionsModel) - 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.CreateIkePolicy(createIkePolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateIkePolicy(createIkePolicyOptions *CreateIkePolicyOptions)`, func() { - version := "testString" - createIkePolicyPath := "/ike_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(createIkePolicyPath)) - 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{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke CreateIkePolicy 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateIkePolicyOptions model - createIkePolicyOptionsModel := new(vpcv1.CreateIkePolicyOptions) - createIkePolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") - createIkePolicyOptionsModel.DhGroup = core.Int64Ptr(int64(14)) - createIkePolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") - createIkePolicyOptionsModel.IkeVersion = core.Int64Ptr(int64(1)) - createIkePolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(28800)) - createIkePolicyOptionsModel.Name = core.StringPtr("my-ike-policy") - createIkePolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createIkePolicyOptionsModel.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.CreateIkePolicyWithContext(ctx, createIkePolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateIkePolicy(createIkePolicyOptionsModel) - 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.CreateIkePolicyWithContext(ctx, createIkePolicyOptionsModel) - 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(createIkePolicyPath)) - 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{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke CreateIkePolicy 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.CreateIkePolicy(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 CreateIkePolicyOptions model - createIkePolicyOptionsModel := new(vpcv1.CreateIkePolicyOptions) - createIkePolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") - createIkePolicyOptionsModel.DhGroup = core.Int64Ptr(int64(14)) - createIkePolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") - createIkePolicyOptionsModel.IkeVersion = core.Int64Ptr(int64(1)) - createIkePolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(28800)) - createIkePolicyOptionsModel.Name = core.StringPtr("my-ike-policy") - createIkePolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateIkePolicy(createIkePolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateIkePolicy 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 CreateIkePolicyOptions model - createIkePolicyOptionsModel := new(vpcv1.CreateIkePolicyOptions) - createIkePolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") - createIkePolicyOptionsModel.DhGroup = core.Int64Ptr(int64(14)) - createIkePolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") - createIkePolicyOptionsModel.IkeVersion = core.Int64Ptr(int64(1)) - createIkePolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(28800)) - createIkePolicyOptionsModel.Name = core.StringPtr("my-ike-policy") - createIkePolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createIkePolicyOptionsModel.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.CreateIkePolicy(createIkePolicyOptionsModel) - 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 CreateIkePolicyOptions model with no property values - createIkePolicyOptionsModelNew := new(vpcv1.CreateIkePolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateIkePolicy(createIkePolicyOptionsModelNew) - 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 CreateIkePolicy 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") - - // Construct an instance of the CreateIkePolicyOptions model - createIkePolicyOptionsModel := new(vpcv1.CreateIkePolicyOptions) - createIkePolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("md5") - createIkePolicyOptionsModel.DhGroup = core.Int64Ptr(int64(14)) - createIkePolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") - createIkePolicyOptionsModel.IkeVersion = core.Int64Ptr(int64(1)) - createIkePolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(28800)) - createIkePolicyOptionsModel.Name = core.StringPtr("my-ike-policy") - createIkePolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateIkePolicy(createIkePolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteIkePolicy(deleteIkePolicyOptions *DeleteIkePolicyOptions)`, func() { - version := "testString" - deleteIkePolicyPath := "/ike_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(deleteIkePolicyPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteIkePolicy 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.DeleteIkePolicy(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteIkePolicyOptions model - deleteIkePolicyOptionsModel := new(vpcv1.DeleteIkePolicyOptions) - deleteIkePolicyOptionsModel.ID = core.StringPtr("testString") - deleteIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteIkePolicy(deleteIkePolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteIkePolicy 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 DeleteIkePolicyOptions model - deleteIkePolicyOptionsModel := new(vpcv1.DeleteIkePolicyOptions) - deleteIkePolicyOptionsModel.ID = core.StringPtr("testString") - deleteIkePolicyOptionsModel.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.DeleteIkePolicy(deleteIkePolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteIkePolicyOptions model with no property values - deleteIkePolicyOptionsModelNew := new(vpcv1.DeleteIkePolicyOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteIkePolicy(deleteIkePolicyOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetIkePolicy(getIkePolicyOptions *GetIkePolicyOptions) - Operation response error`, func() { - version := "testString" - getIkePolicyPath := "/ike_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(getIkePolicyPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetIkePolicy 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 GetIkePolicyOptions model - getIkePolicyOptionsModel := new(vpcv1.GetIkePolicyOptions) - getIkePolicyOptionsModel.ID = core.StringPtr("testString") - getIkePolicyOptionsModel.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.GetIkePolicy(getIkePolicyOptionsModel) - 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.GetIkePolicy(getIkePolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetIkePolicy(getIkePolicyOptions *GetIkePolicyOptions)`, func() { - version := "testString" - getIkePolicyPath := "/ike_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(getIkePolicyPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke GetIkePolicy 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 GetIkePolicyOptions model - getIkePolicyOptionsModel := new(vpcv1.GetIkePolicyOptions) - getIkePolicyOptionsModel.ID = core.StringPtr("testString") - getIkePolicyOptionsModel.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.GetIkePolicyWithContext(ctx, getIkePolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetIkePolicy(getIkePolicyOptionsModel) - 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.GetIkePolicyWithContext(ctx, getIkePolicyOptionsModel) - 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(getIkePolicyPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke GetIkePolicy 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.GetIkePolicy(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetIkePolicyOptions model - getIkePolicyOptionsModel := new(vpcv1.GetIkePolicyOptions) - getIkePolicyOptionsModel.ID = core.StringPtr("testString") - getIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetIkePolicy(getIkePolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetIkePolicy 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 GetIkePolicyOptions model - getIkePolicyOptionsModel := new(vpcv1.GetIkePolicyOptions) - getIkePolicyOptionsModel.ID = core.StringPtr("testString") - getIkePolicyOptionsModel.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.GetIkePolicy(getIkePolicyOptionsModel) - 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 GetIkePolicyOptions model with no property values - getIkePolicyOptionsModelNew := new(vpcv1.GetIkePolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetIkePolicy(getIkePolicyOptionsModelNew) - 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 GetIkePolicy 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 GetIkePolicyOptions model - getIkePolicyOptionsModel := new(vpcv1.GetIkePolicyOptions) - getIkePolicyOptionsModel.ID = core.StringPtr("testString") - getIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetIkePolicy(getIkePolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateIkePolicy(updateIkePolicyOptions *UpdateIkePolicyOptions) - Operation response error`, func() { - version := "testString" - updateIkePolicyPath := "/ike_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(updateIkePolicyPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateIkePolicy 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 UpdateIkePolicyOptions model - updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) - updateIkePolicyOptionsModel.ID = core.StringPtr("testString") - updateIkePolicyOptionsModel.IkePolicyPatch = map[string]interface{}{"anyKey": "anyValue"} - updateIkePolicyOptionsModel.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.UpdateIkePolicy(updateIkePolicyOptionsModel) - 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.UpdateIkePolicy(updateIkePolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateIkePolicy(updateIkePolicyOptions *UpdateIkePolicyOptions)`, func() { - version := "testString" - updateIkePolicyPath := "/ike_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(updateIkePolicyPath)) - 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{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke UpdateIkePolicy 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 UpdateIkePolicyOptions model - updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) - updateIkePolicyOptionsModel.ID = core.StringPtr("testString") - updateIkePolicyOptionsModel.IkePolicyPatch = map[string]interface{}{"anyKey": "anyValue"} - updateIkePolicyOptionsModel.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.UpdateIkePolicyWithContext(ctx, updateIkePolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateIkePolicy(updateIkePolicyOptionsModel) - 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.UpdateIkePolicyWithContext(ctx, updateIkePolicyOptionsModel) - 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(updateIkePolicyPath)) - 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{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke UpdateIkePolicy 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.UpdateIkePolicy(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the UpdateIkePolicyOptions model - updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) - updateIkePolicyOptionsModel.ID = core.StringPtr("testString") - updateIkePolicyOptionsModel.IkePolicyPatch = map[string]interface{}{"anyKey": "anyValue"} - updateIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateIkePolicy(updateIkePolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateIkePolicy 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 UpdateIkePolicyOptions model - updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) - updateIkePolicyOptionsModel.ID = core.StringPtr("testString") - updateIkePolicyOptionsModel.IkePolicyPatch = map[string]interface{}{"anyKey": "anyValue"} - updateIkePolicyOptionsModel.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.UpdateIkePolicy(updateIkePolicyOptionsModel) - 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 UpdateIkePolicyOptions model with no property values - updateIkePolicyOptionsModelNew := new(vpcv1.UpdateIkePolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateIkePolicy(updateIkePolicyOptionsModelNew) - 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 UpdateIkePolicy 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 UpdateIkePolicyOptions model - updateIkePolicyOptionsModel := new(vpcv1.UpdateIkePolicyOptions) - updateIkePolicyOptionsModel.ID = core.StringPtr("testString") - updateIkePolicyOptionsModel.IkePolicyPatch = map[string]interface{}{"anyKey": "anyValue"} - updateIkePolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateIkePolicy(updateIkePolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) - Operation response error`, func() { - version := "testString" - listIkePolicyConnectionsPath := "/ike_policies/testString/connections" - 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(listIkePolicyConnectionsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListIkePolicyConnections 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 ListIkePolicyConnectionsOptions model - listIkePolicyConnectionsOptionsModel := new(vpcv1.ListIkePolicyConnectionsOptions) - listIkePolicyConnectionsOptionsModel.ID = core.StringPtr("testString") - listIkePolicyConnectionsOptionsModel.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.ListIkePolicyConnections(listIkePolicyConnectionsOptionsModel) - 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.ListIkePolicyConnections(listIkePolicyConnectionsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions)`, func() { - version := "testString" - listIkePolicyConnectionsPath := "/ike_policies/testString/connections" - 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(listIkePolicyConnectionsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}`) - })) - }) - It(`Invoke ListIkePolicyConnections 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 ListIkePolicyConnectionsOptions model - listIkePolicyConnectionsOptionsModel := new(vpcv1.ListIkePolicyConnectionsOptions) - listIkePolicyConnectionsOptionsModel.ID = core.StringPtr("testString") - listIkePolicyConnectionsOptionsModel.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.ListIkePolicyConnectionsWithContext(ctx, listIkePolicyConnectionsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListIkePolicyConnections(listIkePolicyConnectionsOptionsModel) - 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.ListIkePolicyConnectionsWithContext(ctx, listIkePolicyConnectionsOptionsModel) - 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(listIkePolicyConnectionsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}`) - })) - }) - It(`Invoke ListIkePolicyConnections 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.ListIkePolicyConnections(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListIkePolicyConnectionsOptions model - listIkePolicyConnectionsOptionsModel := new(vpcv1.ListIkePolicyConnectionsOptions) - listIkePolicyConnectionsOptionsModel.ID = core.StringPtr("testString") - listIkePolicyConnectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListIkePolicyConnections(listIkePolicyConnectionsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListIkePolicyConnections 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 ListIkePolicyConnectionsOptions model - listIkePolicyConnectionsOptionsModel := new(vpcv1.ListIkePolicyConnectionsOptions) - listIkePolicyConnectionsOptionsModel.ID = core.StringPtr("testString") - listIkePolicyConnectionsOptionsModel.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.ListIkePolicyConnections(listIkePolicyConnectionsOptionsModel) - 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 ListIkePolicyConnectionsOptions model with no property values - listIkePolicyConnectionsOptionsModelNew := new(vpcv1.ListIkePolicyConnectionsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListIkePolicyConnections(listIkePolicyConnectionsOptionsModelNew) - 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 ListIkePolicyConnections 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 ListIkePolicyConnectionsOptions model - listIkePolicyConnectionsOptionsModel := new(vpcv1.ListIkePolicyConnectionsOptions) - listIkePolicyConnectionsOptionsModel.ID = core.StringPtr("testString") - listIkePolicyConnectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListIkePolicyConnections(listIkePolicyConnectionsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) - Operation response error`, func() { - version := "testString" - listIpsecPoliciesPath := "/ipsec_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(listIpsecPoliciesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListIpsecPolicies 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 ListIpsecPoliciesOptions model - listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) - listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") - listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listIpsecPoliciesOptionsModel.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.ListIpsecPolicies(listIpsecPoliciesOptionsModel) - 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.ListIpsecPolicies(listIpsecPoliciesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions)`, func() { - version := "testString" - listIpsecPoliciesPath := "/ipsec_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(listIpsecPoliciesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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}`) - })) - }) - It(`Invoke ListIpsecPolicies 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 ListIpsecPoliciesOptions model - listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) - listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") - listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listIpsecPoliciesOptionsModel.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.ListIpsecPoliciesWithContext(ctx, listIpsecPoliciesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListIpsecPolicies(listIpsecPoliciesOptionsModel) - 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.ListIpsecPoliciesWithContext(ctx, listIpsecPoliciesOptionsModel) - 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(listIpsecPoliciesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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}`) - })) - }) - It(`Invoke ListIpsecPolicies 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.ListIpsecPolicies(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListIpsecPoliciesOptions model - listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) - listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") - listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listIpsecPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListIpsecPolicies(listIpsecPoliciesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListIpsecPolicies 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 ListIpsecPoliciesOptions model - listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) - listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") - listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listIpsecPoliciesOptionsModel.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.ListIpsecPolicies(listIpsecPoliciesOptionsModel) - 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 ListIpsecPolicies 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 ListIpsecPoliciesOptions model - listIpsecPoliciesOptionsModel := new(vpcv1.ListIpsecPoliciesOptions) - listIpsecPoliciesOptionsModel.Start = core.StringPtr("testString") - listIpsecPoliciesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listIpsecPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListIpsecPolicies(listIpsecPoliciesOptionsModel) - 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.IPsecPolicyCollection) - nextObject := new(vpcv1.IPsecPolicyCollectionNext) - 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.IPsecPolicyCollection) - - 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.IPsecPolicyCollection) - nextObject := new(vpcv1.IPsecPolicyCollectionNext) - 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(listIpsecPoliciesPath)) - 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"},"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"}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"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"}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use IpsecPoliciesPager.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()) - - listIpsecPoliciesOptionsModel := &vpcv1.ListIpsecPoliciesOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewIpsecPoliciesPager(listIpsecPoliciesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.IPsecPolicy - 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 IpsecPoliciesPager.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()) - - listIpsecPoliciesOptionsModel := &vpcv1.ListIpsecPoliciesOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewIpsecPoliciesPager(listIpsecPoliciesOptionsModel) - 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(`CreateIpsecPolicy(createIpsecPolicyOptions *CreateIpsecPolicyOptions) - Operation response error`, func() { - version := "testString" - createIpsecPolicyPath := "/ipsec_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(createIpsecPolicyPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateIpsecPolicy 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateIpsecPolicyOptions model - createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) - createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("disabled") - createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") - createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") - createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) - createIpsecPolicyOptionsModel.Name = core.StringPtr("my-ipsec-policy") - createIpsecPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createIpsecPolicyOptionsModel.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.CreateIpsecPolicy(createIpsecPolicyOptionsModel) - 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.CreateIpsecPolicy(createIpsecPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateIpsecPolicy(createIpsecPolicyOptions *CreateIpsecPolicyOptions)`, func() { - version := "testString" - createIpsecPolicyPath := "/ipsec_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(createIpsecPolicyPath)) - 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{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke CreateIpsecPolicy 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateIpsecPolicyOptions model - createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) - createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("disabled") - createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") - createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") - createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) - createIpsecPolicyOptionsModel.Name = core.StringPtr("my-ipsec-policy") - createIpsecPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createIpsecPolicyOptionsModel.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.CreateIpsecPolicyWithContext(ctx, createIpsecPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateIpsecPolicy(createIpsecPolicyOptionsModel) - 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.CreateIpsecPolicyWithContext(ctx, createIpsecPolicyOptionsModel) - 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(createIpsecPolicyPath)) - 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{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke CreateIpsecPolicy 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.CreateIpsecPolicy(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 CreateIpsecPolicyOptions model - createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) - createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("disabled") - createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") - createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") - createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) - createIpsecPolicyOptionsModel.Name = core.StringPtr("my-ipsec-policy") - createIpsecPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createIpsecPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateIpsecPolicy(createIpsecPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateIpsecPolicy 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 CreateIpsecPolicyOptions model - createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) - createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("disabled") - createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") - createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") - createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) - createIpsecPolicyOptionsModel.Name = core.StringPtr("my-ipsec-policy") - createIpsecPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createIpsecPolicyOptionsModel.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.CreateIpsecPolicy(createIpsecPolicyOptionsModel) - 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 CreateIpsecPolicyOptions model with no property values - createIpsecPolicyOptionsModelNew := new(vpcv1.CreateIpsecPolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateIpsecPolicy(createIpsecPolicyOptionsModelNew) - 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 CreateIpsecPolicy 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") - - // Construct an instance of the CreateIpsecPolicyOptions model - createIpsecPolicyOptionsModel := new(vpcv1.CreateIpsecPolicyOptions) - createIpsecPolicyOptionsModel.AuthenticationAlgorithm = core.StringPtr("disabled") - createIpsecPolicyOptionsModel.EncryptionAlgorithm = core.StringPtr("aes128") - createIpsecPolicyOptionsModel.Pfs = core.StringPtr("disabled") - createIpsecPolicyOptionsModel.KeyLifetime = core.Int64Ptr(int64(3600)) - createIpsecPolicyOptionsModel.Name = core.StringPtr("my-ipsec-policy") - createIpsecPolicyOptionsModel.ResourceGroup = resourceGroupIdentityModel - createIpsecPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateIpsecPolicy(createIpsecPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteIpsecPolicy(deleteIpsecPolicyOptions *DeleteIpsecPolicyOptions)`, func() { - version := "testString" - deleteIpsecPolicyPath := "/ipsec_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(deleteIpsecPolicyPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteIpsecPolicy 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.DeleteIpsecPolicy(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteIpsecPolicyOptions model - deleteIpsecPolicyOptionsModel := new(vpcv1.DeleteIpsecPolicyOptions) - deleteIpsecPolicyOptionsModel.ID = core.StringPtr("testString") - deleteIpsecPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteIpsecPolicy(deleteIpsecPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteIpsecPolicy 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 DeleteIpsecPolicyOptions model - deleteIpsecPolicyOptionsModel := new(vpcv1.DeleteIpsecPolicyOptions) - deleteIpsecPolicyOptionsModel.ID = core.StringPtr("testString") - deleteIpsecPolicyOptionsModel.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.DeleteIpsecPolicy(deleteIpsecPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteIpsecPolicyOptions model with no property values - deleteIpsecPolicyOptionsModelNew := new(vpcv1.DeleteIpsecPolicyOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteIpsecPolicy(deleteIpsecPolicyOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetIpsecPolicy(getIpsecPolicyOptions *GetIpsecPolicyOptions) - Operation response error`, func() { - version := "testString" - getIpsecPolicyPath := "/ipsec_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(getIpsecPolicyPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetIpsecPolicy 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 GetIpsecPolicyOptions model - getIpsecPolicyOptionsModel := new(vpcv1.GetIpsecPolicyOptions) - getIpsecPolicyOptionsModel.ID = core.StringPtr("testString") - getIpsecPolicyOptionsModel.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.GetIpsecPolicy(getIpsecPolicyOptionsModel) - 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.GetIpsecPolicy(getIpsecPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetIpsecPolicy(getIpsecPolicyOptions *GetIpsecPolicyOptions)`, func() { - version := "testString" - getIpsecPolicyPath := "/ipsec_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(getIpsecPolicyPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke GetIpsecPolicy 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 GetIpsecPolicyOptions model - getIpsecPolicyOptionsModel := new(vpcv1.GetIpsecPolicyOptions) - getIpsecPolicyOptionsModel.ID = core.StringPtr("testString") - getIpsecPolicyOptionsModel.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.GetIpsecPolicyWithContext(ctx, getIpsecPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetIpsecPolicy(getIpsecPolicyOptionsModel) - 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.GetIpsecPolicyWithContext(ctx, getIpsecPolicyOptionsModel) - 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(getIpsecPolicyPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke GetIpsecPolicy 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.GetIpsecPolicy(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetIpsecPolicyOptions model - getIpsecPolicyOptionsModel := new(vpcv1.GetIpsecPolicyOptions) - getIpsecPolicyOptionsModel.ID = core.StringPtr("testString") - getIpsecPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetIpsecPolicy(getIpsecPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetIpsecPolicy 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 GetIpsecPolicyOptions model - getIpsecPolicyOptionsModel := new(vpcv1.GetIpsecPolicyOptions) - getIpsecPolicyOptionsModel.ID = core.StringPtr("testString") - getIpsecPolicyOptionsModel.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.GetIpsecPolicy(getIpsecPolicyOptionsModel) - 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 GetIpsecPolicyOptions model with no property values - getIpsecPolicyOptionsModelNew := new(vpcv1.GetIpsecPolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetIpsecPolicy(getIpsecPolicyOptionsModelNew) - 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 GetIpsecPolicy 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 GetIpsecPolicyOptions model - getIpsecPolicyOptionsModel := new(vpcv1.GetIpsecPolicyOptions) - getIpsecPolicyOptionsModel.ID = core.StringPtr("testString") - getIpsecPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetIpsecPolicy(getIpsecPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateIpsecPolicy(updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) - Operation response error`, func() { - version := "testString" - updateIpsecPolicyPath := "/ipsec_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(updateIpsecPolicyPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateIpsecPolicy 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 IPsecPolicyPatch model - iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) - iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("disabled") - iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") - iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) - iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") - iPsecPolicyPatchModel.Pfs = core.StringPtr("disabled") - iPsecPolicyPatchModelAsPatch, asPatchErr := iPsecPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateIpsecPolicyOptions model - updateIpsecPolicyOptionsModel := new(vpcv1.UpdateIpsecPolicyOptions) - updateIpsecPolicyOptionsModel.ID = core.StringPtr("testString") - updateIpsecPolicyOptionsModel.IPsecPolicyPatch = iPsecPolicyPatchModelAsPatch - updateIpsecPolicyOptionsModel.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.UpdateIpsecPolicy(updateIpsecPolicyOptionsModel) - 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.UpdateIpsecPolicy(updateIpsecPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateIpsecPolicy(updateIpsecPolicyOptions *UpdateIpsecPolicyOptions)`, func() { - version := "testString" - updateIpsecPolicyPath := "/ipsec_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(updateIpsecPolicyPath)) - 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{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke UpdateIpsecPolicy 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 IPsecPolicyPatch model - iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) - iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("disabled") - iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") - iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) - iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") - iPsecPolicyPatchModel.Pfs = core.StringPtr("disabled") - iPsecPolicyPatchModelAsPatch, asPatchErr := iPsecPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateIpsecPolicyOptions model - updateIpsecPolicyOptionsModel := new(vpcv1.UpdateIpsecPolicyOptions) - updateIpsecPolicyOptionsModel.ID = core.StringPtr("testString") - updateIpsecPolicyOptionsModel.IPsecPolicyPatch = iPsecPolicyPatchModelAsPatch - updateIpsecPolicyOptionsModel.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.UpdateIpsecPolicyWithContext(ctx, updateIpsecPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateIpsecPolicy(updateIpsecPolicyOptionsModel) - 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.UpdateIpsecPolicyWithContext(ctx, updateIpsecPolicyOptionsModel) - 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(updateIpsecPolicyPath)) - 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{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke UpdateIpsecPolicy 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.UpdateIpsecPolicy(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the IPsecPolicyPatch model - iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) - iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("disabled") - iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") - iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) - iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") - iPsecPolicyPatchModel.Pfs = core.StringPtr("disabled") - iPsecPolicyPatchModelAsPatch, asPatchErr := iPsecPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateIpsecPolicyOptions model - updateIpsecPolicyOptionsModel := new(vpcv1.UpdateIpsecPolicyOptions) - updateIpsecPolicyOptionsModel.ID = core.StringPtr("testString") - updateIpsecPolicyOptionsModel.IPsecPolicyPatch = iPsecPolicyPatchModelAsPatch - updateIpsecPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateIpsecPolicy(updateIpsecPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateIpsecPolicy 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 IPsecPolicyPatch model - iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) - iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("disabled") - iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") - iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) - iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") - iPsecPolicyPatchModel.Pfs = core.StringPtr("disabled") - iPsecPolicyPatchModelAsPatch, asPatchErr := iPsecPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateIpsecPolicyOptions model - updateIpsecPolicyOptionsModel := new(vpcv1.UpdateIpsecPolicyOptions) - updateIpsecPolicyOptionsModel.ID = core.StringPtr("testString") - updateIpsecPolicyOptionsModel.IPsecPolicyPatch = iPsecPolicyPatchModelAsPatch - updateIpsecPolicyOptionsModel.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.UpdateIpsecPolicy(updateIpsecPolicyOptionsModel) - 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 UpdateIpsecPolicyOptions model with no property values - updateIpsecPolicyOptionsModelNew := new(vpcv1.UpdateIpsecPolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateIpsecPolicy(updateIpsecPolicyOptionsModelNew) - 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 UpdateIpsecPolicy 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 IPsecPolicyPatch model - iPsecPolicyPatchModel := new(vpcv1.IPsecPolicyPatch) - iPsecPolicyPatchModel.AuthenticationAlgorithm = core.StringPtr("disabled") - iPsecPolicyPatchModel.EncryptionAlgorithm = core.StringPtr("aes128") - iPsecPolicyPatchModel.KeyLifetime = core.Int64Ptr(int64(3600)) - iPsecPolicyPatchModel.Name = core.StringPtr("my-ipsec-policy") - iPsecPolicyPatchModel.Pfs = core.StringPtr("disabled") - iPsecPolicyPatchModelAsPatch, asPatchErr := iPsecPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateIpsecPolicyOptions model - updateIpsecPolicyOptionsModel := new(vpcv1.UpdateIpsecPolicyOptions) - updateIpsecPolicyOptionsModel.ID = core.StringPtr("testString") - updateIpsecPolicyOptionsModel.IPsecPolicyPatch = iPsecPolicyPatchModelAsPatch - updateIpsecPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateIpsecPolicy(updateIpsecPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) - Operation response error`, func() { - version := "testString" - listIpsecPolicyConnectionsPath := "/ipsec_policies/testString/connections" - 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(listIpsecPolicyConnectionsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListIpsecPolicyConnections 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 ListIpsecPolicyConnectionsOptions model - listIpsecPolicyConnectionsOptionsModel := new(vpcv1.ListIpsecPolicyConnectionsOptions) - listIpsecPolicyConnectionsOptionsModel.ID = core.StringPtr("testString") - listIpsecPolicyConnectionsOptionsModel.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.ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptionsModel) - 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.ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions)`, func() { - version := "testString" - listIpsecPolicyConnectionsPath := "/ipsec_policies/testString/connections" - 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(listIpsecPolicyConnectionsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}`) - })) - }) - It(`Invoke ListIpsecPolicyConnections 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 ListIpsecPolicyConnectionsOptions model - listIpsecPolicyConnectionsOptionsModel := new(vpcv1.ListIpsecPolicyConnectionsOptions) - listIpsecPolicyConnectionsOptionsModel.ID = core.StringPtr("testString") - listIpsecPolicyConnectionsOptionsModel.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.ListIpsecPolicyConnectionsWithContext(ctx, listIpsecPolicyConnectionsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptionsModel) - 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.ListIpsecPolicyConnectionsWithContext(ctx, listIpsecPolicyConnectionsOptionsModel) - 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(listIpsecPolicyConnectionsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}`) - })) - }) - It(`Invoke ListIpsecPolicyConnections 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.ListIpsecPolicyConnections(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListIpsecPolicyConnectionsOptions model - listIpsecPolicyConnectionsOptionsModel := new(vpcv1.ListIpsecPolicyConnectionsOptions) - listIpsecPolicyConnectionsOptionsModel.ID = core.StringPtr("testString") - listIpsecPolicyConnectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListIpsecPolicyConnections 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 ListIpsecPolicyConnectionsOptions model - listIpsecPolicyConnectionsOptionsModel := new(vpcv1.ListIpsecPolicyConnectionsOptions) - listIpsecPolicyConnectionsOptionsModel.ID = core.StringPtr("testString") - listIpsecPolicyConnectionsOptionsModel.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.ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptionsModel) - 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 ListIpsecPolicyConnectionsOptions model with no property values - listIpsecPolicyConnectionsOptionsModelNew := new(vpcv1.ListIpsecPolicyConnectionsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptionsModelNew) - 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 ListIpsecPolicyConnections 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 ListIpsecPolicyConnectionsOptions model - listIpsecPolicyConnectionsOptionsModel := new(vpcv1.ListIpsecPolicyConnectionsOptions) - listIpsecPolicyConnectionsOptionsModel.ID = core.StringPtr("testString") - listIpsecPolicyConnectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) - Operation response error`, func() { - version := "testString" - listVPNGatewaysPath := "/vpn_gateways" - 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(listVPNGatewaysPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["mode"]).To(Equal([]string{"route"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListVPNGateways 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 ListVPNGatewaysOptions model - listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) - listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Sort = core.StringPtr("name") - listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") - listVPNGatewaysOptionsModel.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.ListVPNGateways(listVPNGatewaysOptionsModel) - 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.ListVPNGateways(listVPNGatewaysOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions)`, func() { - version := "testString" - listVPNGatewaysPath := "/vpn_gateways" - 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(listVPNGatewaysPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["mode"]).To(Equal([]string{"route"})) - // 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/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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}]}`) - })) - }) - It(`Invoke ListVPNGateways 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 ListVPNGatewaysOptions model - listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) - listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Sort = core.StringPtr("name") - listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") - listVPNGatewaysOptionsModel.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.ListVPNGatewaysWithContext(ctx, listVPNGatewaysOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVPNGateways(listVPNGatewaysOptionsModel) - 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.ListVPNGatewaysWithContext(ctx, listVPNGatewaysOptionsModel) - 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(listVPNGatewaysPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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()["sort"]).To(Equal([]string{"name"})) - Expect(req.URL.Query()["mode"]).To(Equal([]string{"route"})) - // 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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}]}`) - })) - }) - It(`Invoke ListVPNGateways 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.ListVPNGateways(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListVPNGatewaysOptions model - listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) - listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Sort = core.StringPtr("name") - listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") - listVPNGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVPNGateways(listVPNGatewaysOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListVPNGateways 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 ListVPNGatewaysOptions model - listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) - listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Sort = core.StringPtr("name") - listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") - listVPNGatewaysOptionsModel.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.ListVPNGateways(listVPNGatewaysOptionsModel) - 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 ListVPNGateways 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 ListVPNGatewaysOptions model - listVPNGatewaysOptionsModel := new(vpcv1.ListVPNGatewaysOptions) - listVPNGatewaysOptionsModel.Start = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVPNGatewaysOptionsModel.Sort = core.StringPtr("name") - listVPNGatewaysOptionsModel.Mode = core.StringPtr("route") - listVPNGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListVPNGateways(listVPNGatewaysOptionsModel) - 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.VPNGatewayCollection) - nextObject := new(vpcv1.VPNGatewayCollectionNext) - 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.VPNGatewayCollection) - - 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.VPNGatewayCollection) - nextObject := new(vpcv1.VPNGatewayCollectionNext) - 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(listVPNGatewaysPath)) - 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,"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"ddf51bec-3424-11e8-b467-0ed5f89f718b","members":[{"private_ip":{"address":"192.168.3.4"},"public_ip":{"address":"192.168.3.4"},"role":"active","status":"available"}],"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","status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"mode":"route"}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b","href":"https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b","id":"ddf51bec-3424-11e8-b467-0ed5f89f718b","members":[{"private_ip":{"address":"192.168.3.4"},"public_ip":{"address":"192.168.3.4"},"role":"active","status":"available"}],"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","status":"available","subnet":{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"},"mode":"route"}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use VPNGatewaysPager.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()) - - listVPNGatewaysOptionsModel := &vpcv1.ListVPNGatewaysOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Sort: core.StringPtr("name"), - Mode: core.StringPtr("route"), - } - - pager, err := vpcService.NewVPNGatewaysPager(listVPNGatewaysOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.VPNGatewayIntf - 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 VPNGatewaysPager.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()) - - listVPNGatewaysOptionsModel := &vpcv1.ListVPNGatewaysOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Sort: core.StringPtr("name"), - Mode: core.StringPtr("route"), - } - - pager, err := vpcService.NewVPNGatewaysPager(listVPNGatewaysOptionsModel) - 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(`CreateVPNGateway(createVPNGatewayOptions *CreateVPNGatewayOptions) - Operation response error`, func() { - version := "testString" - createVPNGatewayPath := "/vpn_gateways" - 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(createVPNGatewayPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateVPNGateway 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // 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 VPNGatewayPrototypeVPNGatewayRouteModePrototype model - vpnGatewayPrototypeModel := new(vpcv1.VPNGatewayPrototypeVPNGatewayRouteModePrototype) - vpnGatewayPrototypeModel.Name = core.StringPtr("my-vpn-gateway") - vpnGatewayPrototypeModel.ResourceGroup = resourceGroupIdentityModel - vpnGatewayPrototypeModel.Subnet = subnetIdentityModel - vpnGatewayPrototypeModel.Mode = core.StringPtr("route") - - // Construct an instance of the CreateVPNGatewayOptions model - createVPNGatewayOptionsModel := new(vpcv1.CreateVPNGatewayOptions) - createVPNGatewayOptionsModel.VPNGatewayPrototype = vpnGatewayPrototypeModel - createVPNGatewayOptionsModel.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.CreateVPNGateway(createVPNGatewayOptionsModel) - 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.CreateVPNGateway(createVPNGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateVPNGateway(createVPNGatewayOptions *CreateVPNGatewayOptions)`, func() { - version := "testString" - createVPNGatewayPath := "/vpn_gateways" - 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(createVPNGatewayPath)) - 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{"testString"})) - 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", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}`) - })) - }) - It(`Invoke CreateVPNGateway 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 ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // 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 VPNGatewayPrototypeVPNGatewayRouteModePrototype model - vpnGatewayPrototypeModel := new(vpcv1.VPNGatewayPrototypeVPNGatewayRouteModePrototype) - vpnGatewayPrototypeModel.Name = core.StringPtr("my-vpn-gateway") - vpnGatewayPrototypeModel.ResourceGroup = resourceGroupIdentityModel - vpnGatewayPrototypeModel.Subnet = subnetIdentityModel - vpnGatewayPrototypeModel.Mode = core.StringPtr("route") - - // Construct an instance of the CreateVPNGatewayOptions model - createVPNGatewayOptionsModel := new(vpcv1.CreateVPNGatewayOptions) - createVPNGatewayOptionsModel.VPNGatewayPrototype = vpnGatewayPrototypeModel - createVPNGatewayOptionsModel.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.CreateVPNGatewayWithContext(ctx, createVPNGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateVPNGateway(createVPNGatewayOptionsModel) - 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.CreateVPNGatewayWithContext(ctx, createVPNGatewayOptionsModel) - 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(createVPNGatewayPath)) - 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{"testString"})) - 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", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}`) - })) - }) - It(`Invoke CreateVPNGateway 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.CreateVPNGateway(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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the VPNGatewayPrototypeVPNGatewayRouteModePrototype model - vpnGatewayPrototypeModel := new(vpcv1.VPNGatewayPrototypeVPNGatewayRouteModePrototype) - vpnGatewayPrototypeModel.Name = core.StringPtr("my-vpn-gateway") - vpnGatewayPrototypeModel.ResourceGroup = resourceGroupIdentityModel - vpnGatewayPrototypeModel.Subnet = subnetIdentityModel - vpnGatewayPrototypeModel.Mode = core.StringPtr("route") - - // Construct an instance of the CreateVPNGatewayOptions model - createVPNGatewayOptionsModel := new(vpcv1.CreateVPNGatewayOptions) - createVPNGatewayOptionsModel.VPNGatewayPrototype = vpnGatewayPrototypeModel - createVPNGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateVPNGateway(createVPNGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateVPNGateway 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the VPNGatewayPrototypeVPNGatewayRouteModePrototype model - vpnGatewayPrototypeModel := new(vpcv1.VPNGatewayPrototypeVPNGatewayRouteModePrototype) - vpnGatewayPrototypeModel.Name = core.StringPtr("my-vpn-gateway") - vpnGatewayPrototypeModel.ResourceGroup = resourceGroupIdentityModel - vpnGatewayPrototypeModel.Subnet = subnetIdentityModel - vpnGatewayPrototypeModel.Mode = core.StringPtr("route") - - // Construct an instance of the CreateVPNGatewayOptions model - createVPNGatewayOptionsModel := new(vpcv1.CreateVPNGatewayOptions) - createVPNGatewayOptionsModel.VPNGatewayPrototype = vpnGatewayPrototypeModel - createVPNGatewayOptionsModel.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.CreateVPNGateway(createVPNGatewayOptionsModel) - 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 CreateVPNGatewayOptions model with no property values - createVPNGatewayOptionsModelNew := new(vpcv1.CreateVPNGatewayOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateVPNGateway(createVPNGatewayOptionsModelNew) - 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 CreateVPNGateway 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") - - // 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 VPNGatewayPrototypeVPNGatewayRouteModePrototype model - vpnGatewayPrototypeModel := new(vpcv1.VPNGatewayPrototypeVPNGatewayRouteModePrototype) - vpnGatewayPrototypeModel.Name = core.StringPtr("my-vpn-gateway") - vpnGatewayPrototypeModel.ResourceGroup = resourceGroupIdentityModel - vpnGatewayPrototypeModel.Subnet = subnetIdentityModel - vpnGatewayPrototypeModel.Mode = core.StringPtr("route") - - // Construct an instance of the CreateVPNGatewayOptions model - createVPNGatewayOptionsModel := new(vpcv1.CreateVPNGatewayOptions) - createVPNGatewayOptionsModel.VPNGatewayPrototype = vpnGatewayPrototypeModel - createVPNGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateVPNGateway(createVPNGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteVPNGateway(deleteVPNGatewayOptions *DeleteVPNGatewayOptions)`, func() { - version := "testString" - deleteVPNGatewayPath := "/vpn_gateways/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(deleteVPNGatewayPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteVPNGateway 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.DeleteVPNGateway(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteVPNGatewayOptions model - deleteVPNGatewayOptionsModel := new(vpcv1.DeleteVPNGatewayOptions) - deleteVPNGatewayOptionsModel.ID = core.StringPtr("testString") - deleteVPNGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteVPNGateway(deleteVPNGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteVPNGateway 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 DeleteVPNGatewayOptions model - deleteVPNGatewayOptionsModel := new(vpcv1.DeleteVPNGatewayOptions) - deleteVPNGatewayOptionsModel.ID = core.StringPtr("testString") - deleteVPNGatewayOptionsModel.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.DeleteVPNGateway(deleteVPNGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteVPNGatewayOptions model with no property values - deleteVPNGatewayOptionsModelNew := new(vpcv1.DeleteVPNGatewayOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteVPNGateway(deleteVPNGatewayOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPNGateway(getVPNGatewayOptions *GetVPNGatewayOptions) - Operation response error`, func() { - version := "testString" - getVPNGatewayPath := "/vpn_gateways/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(getVPNGatewayPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVPNGateway 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 GetVPNGatewayOptions model - getVPNGatewayOptionsModel := new(vpcv1.GetVPNGatewayOptions) - getVPNGatewayOptionsModel.ID = core.StringPtr("testString") - getVPNGatewayOptionsModel.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.GetVPNGateway(getVPNGatewayOptionsModel) - 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.GetVPNGateway(getVPNGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPNGateway(getVPNGatewayOptions *GetVPNGatewayOptions)`, func() { - version := "testString" - getVPNGatewayPath := "/vpn_gateways/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(getVPNGatewayPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}`) - })) - }) - It(`Invoke GetVPNGateway 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 GetVPNGatewayOptions model - getVPNGatewayOptionsModel := new(vpcv1.GetVPNGatewayOptions) - getVPNGatewayOptionsModel.ID = core.StringPtr("testString") - getVPNGatewayOptionsModel.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.GetVPNGatewayWithContext(ctx, getVPNGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVPNGateway(getVPNGatewayOptionsModel) - 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.GetVPNGatewayWithContext(ctx, getVPNGatewayOptionsModel) - 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(getVPNGatewayPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}`) - })) - }) - It(`Invoke GetVPNGateway 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.GetVPNGateway(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetVPNGatewayOptions model - getVPNGatewayOptionsModel := new(vpcv1.GetVPNGatewayOptions) - getVPNGatewayOptionsModel.ID = core.StringPtr("testString") - getVPNGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVPNGateway(getVPNGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVPNGateway 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 GetVPNGatewayOptions model - getVPNGatewayOptionsModel := new(vpcv1.GetVPNGatewayOptions) - getVPNGatewayOptionsModel.ID = core.StringPtr("testString") - getVPNGatewayOptionsModel.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.GetVPNGateway(getVPNGatewayOptionsModel) - 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 GetVPNGatewayOptions model with no property values - getVPNGatewayOptionsModelNew := new(vpcv1.GetVPNGatewayOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVPNGateway(getVPNGatewayOptionsModelNew) - 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 GetVPNGateway 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 GetVPNGatewayOptions model - getVPNGatewayOptionsModel := new(vpcv1.GetVPNGatewayOptions) - getVPNGatewayOptionsModel.ID = core.StringPtr("testString") - getVPNGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVPNGateway(getVPNGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPNGateway(updateVPNGatewayOptions *UpdateVPNGatewayOptions) - Operation response error`, func() { - version := "testString" - updateVPNGatewayPath := "/vpn_gateways/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(updateVPNGatewayPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateVPNGateway 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 VPNGatewayPatch model - vpnGatewayPatchModel := new(vpcv1.VPNGatewayPatch) - vpnGatewayPatchModel.Name = core.StringPtr("my-vpn-gateway") - vpnGatewayPatchModelAsPatch, asPatchErr := vpnGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNGatewayOptions model - updateVPNGatewayOptionsModel := new(vpcv1.UpdateVPNGatewayOptions) - updateVPNGatewayOptionsModel.ID = core.StringPtr("testString") - updateVPNGatewayOptionsModel.VPNGatewayPatch = vpnGatewayPatchModelAsPatch - updateVPNGatewayOptionsModel.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.UpdateVPNGateway(updateVPNGatewayOptionsModel) - 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.UpdateVPNGateway(updateVPNGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPNGateway(updateVPNGatewayOptions *UpdateVPNGatewayOptions)`, func() { - version := "testString" - updateVPNGatewayPath := "/vpn_gateways/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(updateVPNGatewayPath)) - 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{"testString"})) - 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", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}`) - })) - }) - It(`Invoke UpdateVPNGateway 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 VPNGatewayPatch model - vpnGatewayPatchModel := new(vpcv1.VPNGatewayPatch) - vpnGatewayPatchModel.Name = core.StringPtr("my-vpn-gateway") - vpnGatewayPatchModelAsPatch, asPatchErr := vpnGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNGatewayOptions model - updateVPNGatewayOptionsModel := new(vpcv1.UpdateVPNGatewayOptions) - updateVPNGatewayOptionsModel.ID = core.StringPtr("testString") - updateVPNGatewayOptionsModel.VPNGatewayPatch = vpnGatewayPatchModelAsPatch - updateVPNGatewayOptionsModel.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.UpdateVPNGatewayWithContext(ctx, updateVPNGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateVPNGateway(updateVPNGatewayOptionsModel) - 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.UpdateVPNGatewayWithContext(ctx, updateVPNGatewayOptionsModel) - 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(updateVPNGatewayPath)) - 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{"testString"})) - 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", `{"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/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "members": [{"private_ip": {"address": "192.168.3.4"}, "public_ip": {"address": "192.168.3.4"}, "role": "active", "status": "available"}], "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", "status": "available", "subnet": {"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}, "mode": "route"}`) - })) - }) - It(`Invoke UpdateVPNGateway 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.UpdateVPNGateway(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the VPNGatewayPatch model - vpnGatewayPatchModel := new(vpcv1.VPNGatewayPatch) - vpnGatewayPatchModel.Name = core.StringPtr("my-vpn-gateway") - vpnGatewayPatchModelAsPatch, asPatchErr := vpnGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNGatewayOptions model - updateVPNGatewayOptionsModel := new(vpcv1.UpdateVPNGatewayOptions) - updateVPNGatewayOptionsModel.ID = core.StringPtr("testString") - updateVPNGatewayOptionsModel.VPNGatewayPatch = vpnGatewayPatchModelAsPatch - updateVPNGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateVPNGateway(updateVPNGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateVPNGateway 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 VPNGatewayPatch model - vpnGatewayPatchModel := new(vpcv1.VPNGatewayPatch) - vpnGatewayPatchModel.Name = core.StringPtr("my-vpn-gateway") - vpnGatewayPatchModelAsPatch, asPatchErr := vpnGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNGatewayOptions model - updateVPNGatewayOptionsModel := new(vpcv1.UpdateVPNGatewayOptions) - updateVPNGatewayOptionsModel.ID = core.StringPtr("testString") - updateVPNGatewayOptionsModel.VPNGatewayPatch = vpnGatewayPatchModelAsPatch - updateVPNGatewayOptionsModel.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.UpdateVPNGateway(updateVPNGatewayOptionsModel) - 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 UpdateVPNGatewayOptions model with no property values - updateVPNGatewayOptionsModelNew := new(vpcv1.UpdateVPNGatewayOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateVPNGateway(updateVPNGatewayOptionsModelNew) - 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 UpdateVPNGateway 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 VPNGatewayPatch model - vpnGatewayPatchModel := new(vpcv1.VPNGatewayPatch) - vpnGatewayPatchModel.Name = core.StringPtr("my-vpn-gateway") - vpnGatewayPatchModelAsPatch, asPatchErr := vpnGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNGatewayOptions model - updateVPNGatewayOptionsModel := new(vpcv1.UpdateVPNGatewayOptions) - updateVPNGatewayOptionsModel.ID = core.StringPtr("testString") - updateVPNGatewayOptionsModel.VPNGatewayPatch = vpnGatewayPatchModelAsPatch - updateVPNGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateVPNGateway(updateVPNGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) - Operation response error`, func() { - version := "testString" - listVPNGatewayConnectionsPath := "/vpn_gateways/testString/connections" - 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(listVPNGatewayConnectionsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["status"]).To(Equal([]string{"testString"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListVPNGatewayConnections 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 ListVPNGatewayConnectionsOptions model - listVPNGatewayConnectionsOptionsModel := new(vpcv1.ListVPNGatewayConnectionsOptions) - listVPNGatewayConnectionsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionsOptionsModel.Status = core.StringPtr("testString") - listVPNGatewayConnectionsOptionsModel.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.ListVPNGatewayConnections(listVPNGatewayConnectionsOptionsModel) - 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.ListVPNGatewayConnections(listVPNGatewayConnectionsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions)`, func() { - version := "testString" - listVPNGatewayConnectionsPath := "/vpn_gateways/testString/connections" - 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(listVPNGatewayConnectionsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["status"]).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", `{"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}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}`) - })) - }) - It(`Invoke ListVPNGatewayConnections 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 ListVPNGatewayConnectionsOptions model - listVPNGatewayConnectionsOptionsModel := new(vpcv1.ListVPNGatewayConnectionsOptions) - listVPNGatewayConnectionsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionsOptionsModel.Status = core.StringPtr("testString") - listVPNGatewayConnectionsOptionsModel.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.ListVPNGatewayConnectionsWithContext(ctx, listVPNGatewayConnectionsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVPNGatewayConnections(listVPNGatewayConnectionsOptionsModel) - 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.ListVPNGatewayConnectionsWithContext(ctx, listVPNGatewayConnectionsOptionsModel) - 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(listVPNGatewayConnectionsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["status"]).To(Equal([]string{"testString"})) - // 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}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}]}`) - })) - }) - It(`Invoke ListVPNGatewayConnections 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.ListVPNGatewayConnections(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListVPNGatewayConnectionsOptions model - listVPNGatewayConnectionsOptionsModel := new(vpcv1.ListVPNGatewayConnectionsOptions) - listVPNGatewayConnectionsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionsOptionsModel.Status = core.StringPtr("testString") - listVPNGatewayConnectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVPNGatewayConnections(listVPNGatewayConnectionsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListVPNGatewayConnections 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 ListVPNGatewayConnectionsOptions model - listVPNGatewayConnectionsOptionsModel := new(vpcv1.ListVPNGatewayConnectionsOptions) - listVPNGatewayConnectionsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionsOptionsModel.Status = core.StringPtr("testString") - listVPNGatewayConnectionsOptionsModel.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.ListVPNGatewayConnections(listVPNGatewayConnectionsOptionsModel) - 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 ListVPNGatewayConnectionsOptions model with no property values - listVPNGatewayConnectionsOptionsModelNew := new(vpcv1.ListVPNGatewayConnectionsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListVPNGatewayConnections(listVPNGatewayConnectionsOptionsModelNew) - 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 ListVPNGatewayConnections 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 ListVPNGatewayConnectionsOptions model - listVPNGatewayConnectionsOptionsModel := new(vpcv1.ListVPNGatewayConnectionsOptions) - listVPNGatewayConnectionsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionsOptionsModel.Status = core.StringPtr("testString") - listVPNGatewayConnectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListVPNGatewayConnections(listVPNGatewayConnectionsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateVPNGatewayConnection(createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) - Operation response error`, func() { - version := "testString" - createVPNGatewayConnectionPath := "/vpn_gateways/testString/connections" - 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(createVPNGatewayConnectionPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateVPNGatewayConnection 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 VPNGatewayConnectionDpdPrototype model - vpnGatewayConnectionDpdPrototypeModel := new(vpcv1.VPNGatewayConnectionDpdPrototype) - vpnGatewayConnectionDpdPrototypeModel.Action = core.StringPtr("restart") - vpnGatewayConnectionDpdPrototypeModel.Interval = core.Int64Ptr(int64(30)) - vpnGatewayConnectionDpdPrototypeModel.Timeout = core.Int64Ptr(int64(120)) - - // Construct an instance of the VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID model - vpnGatewayConnectionIkePolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) - vpnGatewayConnectionIkePolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID model - vpnGatewayConnectionIPsecPolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) - vpnGatewayConnectionIPsecPolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model - vpnGatewayConnectionPrototypeModel := new(vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) - vpnGatewayConnectionPrototypeModel.AdminStateUp = core.BoolPtr(true) - vpnGatewayConnectionPrototypeModel.DeadPeerDetection = vpnGatewayConnectionDpdPrototypeModel - vpnGatewayConnectionPrototypeModel.IkePolicy = vpnGatewayConnectionIkePolicyPrototypeModel - vpnGatewayConnectionPrototypeModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPrototypeModel - vpnGatewayConnectionPrototypeModel.Name = core.StringPtr("my-vpn-connection") - vpnGatewayConnectionPrototypeModel.PeerAddress = core.StringPtr("169.21.50.5") - vpnGatewayConnectionPrototypeModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") - vpnGatewayConnectionPrototypeModel.RoutingProtocol = core.StringPtr("none") - - // Construct an instance of the CreateVPNGatewayConnectionOptions model - createVPNGatewayConnectionOptionsModel := new(vpcv1.CreateVPNGatewayConnectionOptions) - createVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - createVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototypeModel - createVPNGatewayConnectionOptionsModel.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.CreateVPNGatewayConnection(createVPNGatewayConnectionOptionsModel) - 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.CreateVPNGatewayConnection(createVPNGatewayConnectionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateVPNGatewayConnection(createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions)`, func() { - version := "testString" - createVPNGatewayConnectionPath := "/vpn_gateways/testString/connections" - 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(createVPNGatewayConnectionPath)) - 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{"testString"})) - 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", `{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}`) - })) - }) - It(`Invoke CreateVPNGatewayConnection 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 VPNGatewayConnectionDpdPrototype model - vpnGatewayConnectionDpdPrototypeModel := new(vpcv1.VPNGatewayConnectionDpdPrototype) - vpnGatewayConnectionDpdPrototypeModel.Action = core.StringPtr("restart") - vpnGatewayConnectionDpdPrototypeModel.Interval = core.Int64Ptr(int64(30)) - vpnGatewayConnectionDpdPrototypeModel.Timeout = core.Int64Ptr(int64(120)) - - // Construct an instance of the VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID model - vpnGatewayConnectionIkePolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) - vpnGatewayConnectionIkePolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID model - vpnGatewayConnectionIPsecPolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) - vpnGatewayConnectionIPsecPolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model - vpnGatewayConnectionPrototypeModel := new(vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) - vpnGatewayConnectionPrototypeModel.AdminStateUp = core.BoolPtr(true) - vpnGatewayConnectionPrototypeModel.DeadPeerDetection = vpnGatewayConnectionDpdPrototypeModel - vpnGatewayConnectionPrototypeModel.IkePolicy = vpnGatewayConnectionIkePolicyPrototypeModel - vpnGatewayConnectionPrototypeModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPrototypeModel - vpnGatewayConnectionPrototypeModel.Name = core.StringPtr("my-vpn-connection") - vpnGatewayConnectionPrototypeModel.PeerAddress = core.StringPtr("169.21.50.5") - vpnGatewayConnectionPrototypeModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") - vpnGatewayConnectionPrototypeModel.RoutingProtocol = core.StringPtr("none") - - // Construct an instance of the CreateVPNGatewayConnectionOptions model - createVPNGatewayConnectionOptionsModel := new(vpcv1.CreateVPNGatewayConnectionOptions) - createVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - createVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototypeModel - createVPNGatewayConnectionOptionsModel.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.CreateVPNGatewayConnectionWithContext(ctx, createVPNGatewayConnectionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateVPNGatewayConnection(createVPNGatewayConnectionOptionsModel) - 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.CreateVPNGatewayConnectionWithContext(ctx, createVPNGatewayConnectionOptionsModel) - 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(createVPNGatewayConnectionPath)) - 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{"testString"})) - 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", `{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}`) - })) - }) - It(`Invoke CreateVPNGatewayConnection 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.CreateVPNGatewayConnection(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the VPNGatewayConnectionDpdPrototype model - vpnGatewayConnectionDpdPrototypeModel := new(vpcv1.VPNGatewayConnectionDpdPrototype) - vpnGatewayConnectionDpdPrototypeModel.Action = core.StringPtr("restart") - vpnGatewayConnectionDpdPrototypeModel.Interval = core.Int64Ptr(int64(30)) - vpnGatewayConnectionDpdPrototypeModel.Timeout = core.Int64Ptr(int64(120)) - - // Construct an instance of the VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID model - vpnGatewayConnectionIkePolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) - vpnGatewayConnectionIkePolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID model - vpnGatewayConnectionIPsecPolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) - vpnGatewayConnectionIPsecPolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model - vpnGatewayConnectionPrototypeModel := new(vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) - vpnGatewayConnectionPrototypeModel.AdminStateUp = core.BoolPtr(true) - vpnGatewayConnectionPrototypeModel.DeadPeerDetection = vpnGatewayConnectionDpdPrototypeModel - vpnGatewayConnectionPrototypeModel.IkePolicy = vpnGatewayConnectionIkePolicyPrototypeModel - vpnGatewayConnectionPrototypeModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPrototypeModel - vpnGatewayConnectionPrototypeModel.Name = core.StringPtr("my-vpn-connection") - vpnGatewayConnectionPrototypeModel.PeerAddress = core.StringPtr("169.21.50.5") - vpnGatewayConnectionPrototypeModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") - vpnGatewayConnectionPrototypeModel.RoutingProtocol = core.StringPtr("none") - - // Construct an instance of the CreateVPNGatewayConnectionOptions model - createVPNGatewayConnectionOptionsModel := new(vpcv1.CreateVPNGatewayConnectionOptions) - createVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - createVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototypeModel - createVPNGatewayConnectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateVPNGatewayConnection(createVPNGatewayConnectionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateVPNGatewayConnection 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 VPNGatewayConnectionDpdPrototype model - vpnGatewayConnectionDpdPrototypeModel := new(vpcv1.VPNGatewayConnectionDpdPrototype) - vpnGatewayConnectionDpdPrototypeModel.Action = core.StringPtr("restart") - vpnGatewayConnectionDpdPrototypeModel.Interval = core.Int64Ptr(int64(30)) - vpnGatewayConnectionDpdPrototypeModel.Timeout = core.Int64Ptr(int64(120)) - - // Construct an instance of the VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID model - vpnGatewayConnectionIkePolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) - vpnGatewayConnectionIkePolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID model - vpnGatewayConnectionIPsecPolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) - vpnGatewayConnectionIPsecPolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model - vpnGatewayConnectionPrototypeModel := new(vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) - vpnGatewayConnectionPrototypeModel.AdminStateUp = core.BoolPtr(true) - vpnGatewayConnectionPrototypeModel.DeadPeerDetection = vpnGatewayConnectionDpdPrototypeModel - vpnGatewayConnectionPrototypeModel.IkePolicy = vpnGatewayConnectionIkePolicyPrototypeModel - vpnGatewayConnectionPrototypeModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPrototypeModel - vpnGatewayConnectionPrototypeModel.Name = core.StringPtr("my-vpn-connection") - vpnGatewayConnectionPrototypeModel.PeerAddress = core.StringPtr("169.21.50.5") - vpnGatewayConnectionPrototypeModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") - vpnGatewayConnectionPrototypeModel.RoutingProtocol = core.StringPtr("none") - - // Construct an instance of the CreateVPNGatewayConnectionOptions model - createVPNGatewayConnectionOptionsModel := new(vpcv1.CreateVPNGatewayConnectionOptions) - createVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - createVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototypeModel - createVPNGatewayConnectionOptionsModel.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.CreateVPNGatewayConnection(createVPNGatewayConnectionOptionsModel) - 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 CreateVPNGatewayConnectionOptions model with no property values - createVPNGatewayConnectionOptionsModelNew := new(vpcv1.CreateVPNGatewayConnectionOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateVPNGatewayConnection(createVPNGatewayConnectionOptionsModelNew) - 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 CreateVPNGatewayConnection 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 VPNGatewayConnectionDpdPrototype model - vpnGatewayConnectionDpdPrototypeModel := new(vpcv1.VPNGatewayConnectionDpdPrototype) - vpnGatewayConnectionDpdPrototypeModel.Action = core.StringPtr("restart") - vpnGatewayConnectionDpdPrototypeModel.Interval = core.Int64Ptr(int64(30)) - vpnGatewayConnectionDpdPrototypeModel.Timeout = core.Int64Ptr(int64(120)) - - // Construct an instance of the VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID model - vpnGatewayConnectionIkePolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) - vpnGatewayConnectionIkePolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID model - vpnGatewayConnectionIPsecPolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) - vpnGatewayConnectionIPsecPolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model - vpnGatewayConnectionPrototypeModel := new(vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) - vpnGatewayConnectionPrototypeModel.AdminStateUp = core.BoolPtr(true) - vpnGatewayConnectionPrototypeModel.DeadPeerDetection = vpnGatewayConnectionDpdPrototypeModel - vpnGatewayConnectionPrototypeModel.IkePolicy = vpnGatewayConnectionIkePolicyPrototypeModel - vpnGatewayConnectionPrototypeModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPrototypeModel - vpnGatewayConnectionPrototypeModel.Name = core.StringPtr("my-vpn-connection") - vpnGatewayConnectionPrototypeModel.PeerAddress = core.StringPtr("169.21.50.5") - vpnGatewayConnectionPrototypeModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") - vpnGatewayConnectionPrototypeModel.RoutingProtocol = core.StringPtr("none") - - // Construct an instance of the CreateVPNGatewayConnectionOptions model - createVPNGatewayConnectionOptionsModel := new(vpcv1.CreateVPNGatewayConnectionOptions) - createVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - createVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototypeModel - createVPNGatewayConnectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateVPNGatewayConnection(createVPNGatewayConnectionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions)`, func() { - version := "testString" - deleteVPNGatewayConnectionPath := "/vpn_gateways/testString/connections/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(deleteVPNGatewayConnectionPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteVPNGatewayConnection 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.DeleteVPNGatewayConnection(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteVPNGatewayConnectionOptions model - deleteVPNGatewayConnectionOptionsModel := new(vpcv1.DeleteVPNGatewayConnectionOptions) - deleteVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - deleteVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") - deleteVPNGatewayConnectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteVPNGatewayConnection 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 DeleteVPNGatewayConnectionOptions model - deleteVPNGatewayConnectionOptionsModel := new(vpcv1.DeleteVPNGatewayConnectionOptions) - deleteVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - deleteVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") - deleteVPNGatewayConnectionOptionsModel.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.DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteVPNGatewayConnectionOptions model with no property values - deleteVPNGatewayConnectionOptionsModelNew := new(vpcv1.DeleteVPNGatewayConnectionOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPNGatewayConnection(getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) - Operation response error`, func() { - version := "testString" - getVPNGatewayConnectionPath := "/vpn_gateways/testString/connections/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(getVPNGatewayConnectionPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVPNGatewayConnection 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 GetVPNGatewayConnectionOptions model - getVPNGatewayConnectionOptionsModel := new(vpcv1.GetVPNGatewayConnectionOptions) - getVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - getVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") - getVPNGatewayConnectionOptionsModel.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.GetVPNGatewayConnection(getVPNGatewayConnectionOptionsModel) - 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.GetVPNGatewayConnection(getVPNGatewayConnectionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPNGatewayConnection(getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions)`, func() { - version := "testString" - getVPNGatewayConnectionPath := "/vpn_gateways/testString/connections/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(getVPNGatewayConnectionPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}`) - })) - }) - It(`Invoke GetVPNGatewayConnection 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 GetVPNGatewayConnectionOptions model - getVPNGatewayConnectionOptionsModel := new(vpcv1.GetVPNGatewayConnectionOptions) - getVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - getVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") - getVPNGatewayConnectionOptionsModel.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.GetVPNGatewayConnectionWithContext(ctx, getVPNGatewayConnectionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVPNGatewayConnection(getVPNGatewayConnectionOptionsModel) - 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.GetVPNGatewayConnectionWithContext(ctx, getVPNGatewayConnectionOptionsModel) - 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(getVPNGatewayConnectionPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}`) - })) - }) - It(`Invoke GetVPNGatewayConnection 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.GetVPNGatewayConnection(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetVPNGatewayConnectionOptions model - getVPNGatewayConnectionOptionsModel := new(vpcv1.GetVPNGatewayConnectionOptions) - getVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - getVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") - getVPNGatewayConnectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVPNGatewayConnection(getVPNGatewayConnectionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVPNGatewayConnection 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 GetVPNGatewayConnectionOptions model - getVPNGatewayConnectionOptionsModel := new(vpcv1.GetVPNGatewayConnectionOptions) - getVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - getVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") - getVPNGatewayConnectionOptionsModel.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.GetVPNGatewayConnection(getVPNGatewayConnectionOptionsModel) - 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 GetVPNGatewayConnectionOptions model with no property values - getVPNGatewayConnectionOptionsModelNew := new(vpcv1.GetVPNGatewayConnectionOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVPNGatewayConnection(getVPNGatewayConnectionOptionsModelNew) - 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 GetVPNGatewayConnection 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 GetVPNGatewayConnectionOptions model - getVPNGatewayConnectionOptionsModel := new(vpcv1.GetVPNGatewayConnectionOptions) - getVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - getVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") - getVPNGatewayConnectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVPNGatewayConnection(getVPNGatewayConnectionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) - Operation response error`, func() { - version := "testString" - updateVPNGatewayConnectionPath := "/vpn_gateways/testString/connections/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(updateVPNGatewayConnectionPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateVPNGatewayConnection 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 VPNGatewayConnectionDpdPatch model - vpnGatewayConnectionDpdPatchModel := new(vpcv1.VPNGatewayConnectionDpdPatch) - vpnGatewayConnectionDpdPatchModel.Action = core.StringPtr("restart") - vpnGatewayConnectionDpdPatchModel.Interval = core.Int64Ptr(int64(30)) - vpnGatewayConnectionDpdPatchModel.Timeout = core.Int64Ptr(int64(120)) - - // Construct an instance of the VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID model - vpnGatewayConnectionIkePolicyPatchModel := new(vpcv1.VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) - vpnGatewayConnectionIkePolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID model - vpnGatewayConnectionIPsecPolicyPatchModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) - vpnGatewayConnectionIPsecPolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch model - vpnGatewayConnectionPatchModel := new(vpcv1.VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) - vpnGatewayConnectionPatchModel.AdminStateUp = core.BoolPtr(true) - vpnGatewayConnectionPatchModel.DeadPeerDetection = vpnGatewayConnectionDpdPatchModel - vpnGatewayConnectionPatchModel.IkePolicy = vpnGatewayConnectionIkePolicyPatchModel - vpnGatewayConnectionPatchModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPatchModel - vpnGatewayConnectionPatchModel.Name = core.StringPtr("my-vpn-connection") - vpnGatewayConnectionPatchModel.PeerAddress = core.StringPtr("169.21.50.5") - vpnGatewayConnectionPatchModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") - vpnGatewayConnectionPatchModel.RoutingProtocol = core.StringPtr("none") - vpnGatewayConnectionPatchModelAsPatch, asPatchErr := vpnGatewayConnectionPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNGatewayConnectionOptions model - updateVPNGatewayConnectionOptionsModel := new(vpcv1.UpdateVPNGatewayConnectionOptions) - updateVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - updateVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") - updateVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPatch = vpnGatewayConnectionPatchModelAsPatch - updateVPNGatewayConnectionOptionsModel.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.UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptionsModel) - 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.UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions)`, func() { - version := "testString" - updateVPNGatewayConnectionPath := "/vpn_gateways/testString/connections/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(updateVPNGatewayConnectionPath)) - 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{"testString"})) - 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", `{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}`) - })) - }) - It(`Invoke UpdateVPNGatewayConnection 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 VPNGatewayConnectionDpdPatch model - vpnGatewayConnectionDpdPatchModel := new(vpcv1.VPNGatewayConnectionDpdPatch) - vpnGatewayConnectionDpdPatchModel.Action = core.StringPtr("restart") - vpnGatewayConnectionDpdPatchModel.Interval = core.Int64Ptr(int64(30)) - vpnGatewayConnectionDpdPatchModel.Timeout = core.Int64Ptr(int64(120)) - - // Construct an instance of the VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID model - vpnGatewayConnectionIkePolicyPatchModel := new(vpcv1.VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) - vpnGatewayConnectionIkePolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID model - vpnGatewayConnectionIPsecPolicyPatchModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) - vpnGatewayConnectionIPsecPolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch model - vpnGatewayConnectionPatchModel := new(vpcv1.VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) - vpnGatewayConnectionPatchModel.AdminStateUp = core.BoolPtr(true) - vpnGatewayConnectionPatchModel.DeadPeerDetection = vpnGatewayConnectionDpdPatchModel - vpnGatewayConnectionPatchModel.IkePolicy = vpnGatewayConnectionIkePolicyPatchModel - vpnGatewayConnectionPatchModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPatchModel - vpnGatewayConnectionPatchModel.Name = core.StringPtr("my-vpn-connection") - vpnGatewayConnectionPatchModel.PeerAddress = core.StringPtr("169.21.50.5") - vpnGatewayConnectionPatchModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") - vpnGatewayConnectionPatchModel.RoutingProtocol = core.StringPtr("none") - vpnGatewayConnectionPatchModelAsPatch, asPatchErr := vpnGatewayConnectionPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNGatewayConnectionOptions model - updateVPNGatewayConnectionOptionsModel := new(vpcv1.UpdateVPNGatewayConnectionOptions) - updateVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - updateVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") - updateVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPatch = vpnGatewayConnectionPatchModelAsPatch - updateVPNGatewayConnectionOptionsModel.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.UpdateVPNGatewayConnectionWithContext(ctx, updateVPNGatewayConnectionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptionsModel) - 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.UpdateVPNGatewayConnectionWithContext(ctx, updateVPNGatewayConnectionOptionsModel) - 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(updateVPNGatewayConnectionPath)) - 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{"testString"})) - 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", `{"admin_state_up": true, "authentication_mode": "psk", "created_at": "2019-01-01T12:00:00.000Z", "dead_peer_detection": {"action": "restart", "interval": 30, "timeout": 120}, "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": "route", "name": "my-vpn-connection", "peer_address": "169.21.50.5", "psk": "lkj14b1oi0alcniejkso", "resource_type": "vpn_gateway_connection", "status": "down", "routing_protocol": "none", "tunnels": [{"public_ip": {"address": "192.168.3.4"}, "status": "down"}]}`) - })) - }) - It(`Invoke UpdateVPNGatewayConnection 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.UpdateVPNGatewayConnection(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the VPNGatewayConnectionDpdPatch model - vpnGatewayConnectionDpdPatchModel := new(vpcv1.VPNGatewayConnectionDpdPatch) - vpnGatewayConnectionDpdPatchModel.Action = core.StringPtr("restart") - vpnGatewayConnectionDpdPatchModel.Interval = core.Int64Ptr(int64(30)) - vpnGatewayConnectionDpdPatchModel.Timeout = core.Int64Ptr(int64(120)) - - // Construct an instance of the VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID model - vpnGatewayConnectionIkePolicyPatchModel := new(vpcv1.VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) - vpnGatewayConnectionIkePolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID model - vpnGatewayConnectionIPsecPolicyPatchModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) - vpnGatewayConnectionIPsecPolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch model - vpnGatewayConnectionPatchModel := new(vpcv1.VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) - vpnGatewayConnectionPatchModel.AdminStateUp = core.BoolPtr(true) - vpnGatewayConnectionPatchModel.DeadPeerDetection = vpnGatewayConnectionDpdPatchModel - vpnGatewayConnectionPatchModel.IkePolicy = vpnGatewayConnectionIkePolicyPatchModel - vpnGatewayConnectionPatchModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPatchModel - vpnGatewayConnectionPatchModel.Name = core.StringPtr("my-vpn-connection") - vpnGatewayConnectionPatchModel.PeerAddress = core.StringPtr("169.21.50.5") - vpnGatewayConnectionPatchModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") - vpnGatewayConnectionPatchModel.RoutingProtocol = core.StringPtr("none") - vpnGatewayConnectionPatchModelAsPatch, asPatchErr := vpnGatewayConnectionPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNGatewayConnectionOptions model - updateVPNGatewayConnectionOptionsModel := new(vpcv1.UpdateVPNGatewayConnectionOptions) - updateVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - updateVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") - updateVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPatch = vpnGatewayConnectionPatchModelAsPatch - updateVPNGatewayConnectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateVPNGatewayConnection 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 VPNGatewayConnectionDpdPatch model - vpnGatewayConnectionDpdPatchModel := new(vpcv1.VPNGatewayConnectionDpdPatch) - vpnGatewayConnectionDpdPatchModel.Action = core.StringPtr("restart") - vpnGatewayConnectionDpdPatchModel.Interval = core.Int64Ptr(int64(30)) - vpnGatewayConnectionDpdPatchModel.Timeout = core.Int64Ptr(int64(120)) - - // Construct an instance of the VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID model - vpnGatewayConnectionIkePolicyPatchModel := new(vpcv1.VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) - vpnGatewayConnectionIkePolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID model - vpnGatewayConnectionIPsecPolicyPatchModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) - vpnGatewayConnectionIPsecPolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch model - vpnGatewayConnectionPatchModel := new(vpcv1.VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) - vpnGatewayConnectionPatchModel.AdminStateUp = core.BoolPtr(true) - vpnGatewayConnectionPatchModel.DeadPeerDetection = vpnGatewayConnectionDpdPatchModel - vpnGatewayConnectionPatchModel.IkePolicy = vpnGatewayConnectionIkePolicyPatchModel - vpnGatewayConnectionPatchModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPatchModel - vpnGatewayConnectionPatchModel.Name = core.StringPtr("my-vpn-connection") - vpnGatewayConnectionPatchModel.PeerAddress = core.StringPtr("169.21.50.5") - vpnGatewayConnectionPatchModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") - vpnGatewayConnectionPatchModel.RoutingProtocol = core.StringPtr("none") - vpnGatewayConnectionPatchModelAsPatch, asPatchErr := vpnGatewayConnectionPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNGatewayConnectionOptions model - updateVPNGatewayConnectionOptionsModel := new(vpcv1.UpdateVPNGatewayConnectionOptions) - updateVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - updateVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") - updateVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPatch = vpnGatewayConnectionPatchModelAsPatch - updateVPNGatewayConnectionOptionsModel.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.UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptionsModel) - 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 UpdateVPNGatewayConnectionOptions model with no property values - updateVPNGatewayConnectionOptionsModelNew := new(vpcv1.UpdateVPNGatewayConnectionOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptionsModelNew) - 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 UpdateVPNGatewayConnection 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 VPNGatewayConnectionDpdPatch model - vpnGatewayConnectionDpdPatchModel := new(vpcv1.VPNGatewayConnectionDpdPatch) - vpnGatewayConnectionDpdPatchModel.Action = core.StringPtr("restart") - vpnGatewayConnectionDpdPatchModel.Interval = core.Int64Ptr(int64(30)) - vpnGatewayConnectionDpdPatchModel.Timeout = core.Int64Ptr(int64(120)) - - // Construct an instance of the VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID model - vpnGatewayConnectionIkePolicyPatchModel := new(vpcv1.VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) - vpnGatewayConnectionIkePolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID model - vpnGatewayConnectionIPsecPolicyPatchModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) - vpnGatewayConnectionIPsecPolicyPatchModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - - // Construct an instance of the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch model - vpnGatewayConnectionPatchModel := new(vpcv1.VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) - vpnGatewayConnectionPatchModel.AdminStateUp = core.BoolPtr(true) - vpnGatewayConnectionPatchModel.DeadPeerDetection = vpnGatewayConnectionDpdPatchModel - vpnGatewayConnectionPatchModel.IkePolicy = vpnGatewayConnectionIkePolicyPatchModel - vpnGatewayConnectionPatchModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPatchModel - vpnGatewayConnectionPatchModel.Name = core.StringPtr("my-vpn-connection") - vpnGatewayConnectionPatchModel.PeerAddress = core.StringPtr("169.21.50.5") - vpnGatewayConnectionPatchModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") - vpnGatewayConnectionPatchModel.RoutingProtocol = core.StringPtr("none") - vpnGatewayConnectionPatchModelAsPatch, asPatchErr := vpnGatewayConnectionPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNGatewayConnectionOptions model - updateVPNGatewayConnectionOptionsModel := new(vpcv1.UpdateVPNGatewayConnectionOptions) - updateVPNGatewayConnectionOptionsModel.VPNGatewayID = core.StringPtr("testString") - updateVPNGatewayConnectionOptionsModel.ID = core.StringPtr("testString") - updateVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPatch = vpnGatewayConnectionPatchModelAsPatch - updateVPNGatewayConnectionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) - Operation response error`, func() { - version := "testString" - listVPNGatewayConnectionLocalCIDRsPath := "/vpn_gateways/testString/connections/testString/local_cidrs" - 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(listVPNGatewayConnectionLocalCIDRsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListVPNGatewayConnectionLocalCIDRs 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 ListVPNGatewayConnectionLocalCIDRsOptions model - listVPNGatewayConnectionLocalCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionLocalCIDRsOptions) - listVPNGatewayConnectionLocalCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionLocalCIDRsOptionsModel.ID = core.StringPtr("testString") - listVPNGatewayConnectionLocalCIDRsOptionsModel.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.ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptionsModel) - 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.ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions)`, func() { - version := "testString" - listVPNGatewayConnectionLocalCIDRsPath := "/vpn_gateways/testString/connections/testString/local_cidrs" - 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(listVPNGatewayConnectionLocalCIDRsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"local_cidrs": ["192.168.1.0/24"]}`) - })) - }) - It(`Invoke ListVPNGatewayConnectionLocalCIDRs 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 ListVPNGatewayConnectionLocalCIDRsOptions model - listVPNGatewayConnectionLocalCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionLocalCIDRsOptions) - listVPNGatewayConnectionLocalCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionLocalCIDRsOptionsModel.ID = core.StringPtr("testString") - listVPNGatewayConnectionLocalCIDRsOptionsModel.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.ListVPNGatewayConnectionLocalCIDRsWithContext(ctx, listVPNGatewayConnectionLocalCIDRsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptionsModel) - 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.ListVPNGatewayConnectionLocalCIDRsWithContext(ctx, listVPNGatewayConnectionLocalCIDRsOptionsModel) - 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(listVPNGatewayConnectionLocalCIDRsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"local_cidrs": ["192.168.1.0/24"]}`) - })) - }) - It(`Invoke ListVPNGatewayConnectionLocalCIDRs 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.ListVPNGatewayConnectionLocalCIDRs(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListVPNGatewayConnectionLocalCIDRsOptions model - listVPNGatewayConnectionLocalCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionLocalCIDRsOptions) - listVPNGatewayConnectionLocalCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionLocalCIDRsOptionsModel.ID = core.StringPtr("testString") - listVPNGatewayConnectionLocalCIDRsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListVPNGatewayConnectionLocalCIDRs 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 ListVPNGatewayConnectionLocalCIDRsOptions model - listVPNGatewayConnectionLocalCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionLocalCIDRsOptions) - listVPNGatewayConnectionLocalCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionLocalCIDRsOptionsModel.ID = core.StringPtr("testString") - listVPNGatewayConnectionLocalCIDRsOptionsModel.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.ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptionsModel) - 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 ListVPNGatewayConnectionLocalCIDRsOptions model with no property values - listVPNGatewayConnectionLocalCIDRsOptionsModelNew := new(vpcv1.ListVPNGatewayConnectionLocalCIDRsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptionsModelNew) - 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 ListVPNGatewayConnectionLocalCIDRs 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 ListVPNGatewayConnectionLocalCIDRsOptions model - listVPNGatewayConnectionLocalCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionLocalCIDRsOptions) - listVPNGatewayConnectionLocalCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionLocalCIDRsOptionsModel.ID = core.StringPtr("testString") - listVPNGatewayConnectionLocalCIDRsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions)`, func() { - version := "testString" - removeVPNGatewayConnectionLocalCIDRPath := "/vpn_gateways/testString/connections/testString/local_cidrs/testString/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(removeVPNGatewayConnectionLocalCIDRPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke RemoveVPNGatewayConnectionLocalCIDR 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.RemoveVPNGatewayConnectionLocalCIDR(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the RemoveVPNGatewayConnectionLocalCIDROptions model - removeVPNGatewayConnectionLocalCIDROptionsModel := new(vpcv1.RemoveVPNGatewayConnectionLocalCIDROptions) - removeVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") - removeVPNGatewayConnectionLocalCIDROptionsModel.ID = core.StringPtr("testString") - removeVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") - removeVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength = core.StringPtr("testString") - removeVPNGatewayConnectionLocalCIDROptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke RemoveVPNGatewayConnectionLocalCIDR 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 RemoveVPNGatewayConnectionLocalCIDROptions model - removeVPNGatewayConnectionLocalCIDROptionsModel := new(vpcv1.RemoveVPNGatewayConnectionLocalCIDROptions) - removeVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") - removeVPNGatewayConnectionLocalCIDROptionsModel.ID = core.StringPtr("testString") - removeVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") - removeVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength = core.StringPtr("testString") - removeVPNGatewayConnectionLocalCIDROptionsModel.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.RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the RemoveVPNGatewayConnectionLocalCIDROptions model with no property values - removeVPNGatewayConnectionLocalCIDROptionsModelNew := new(vpcv1.RemoveVPNGatewayConnectionLocalCIDROptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions)`, func() { - version := "testString" - checkVPNGatewayConnectionLocalCIDRPath := "/vpn_gateways/testString/connections/testString/local_cidrs/testString/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(checkVPNGatewayConnectionLocalCIDRPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke CheckVPNGatewayConnectionLocalCIDR 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.CheckVPNGatewayConnectionLocalCIDR(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the CheckVPNGatewayConnectionLocalCIDROptions model - checkVPNGatewayConnectionLocalCIDROptionsModel := new(vpcv1.CheckVPNGatewayConnectionLocalCIDROptions) - checkVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") - checkVPNGatewayConnectionLocalCIDROptionsModel.ID = core.StringPtr("testString") - checkVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") - checkVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength = core.StringPtr("testString") - checkVPNGatewayConnectionLocalCIDROptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke CheckVPNGatewayConnectionLocalCIDR 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 CheckVPNGatewayConnectionLocalCIDROptions model - checkVPNGatewayConnectionLocalCIDROptionsModel := new(vpcv1.CheckVPNGatewayConnectionLocalCIDROptions) - checkVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") - checkVPNGatewayConnectionLocalCIDROptionsModel.ID = core.StringPtr("testString") - checkVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") - checkVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength = core.StringPtr("testString") - checkVPNGatewayConnectionLocalCIDROptionsModel.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.CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the CheckVPNGatewayConnectionLocalCIDROptions model with no property values - checkVPNGatewayConnectionLocalCIDROptionsModelNew := new(vpcv1.CheckVPNGatewayConnectionLocalCIDROptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions)`, func() { - version := "testString" - addVPNGatewayConnectionLocalCIDRPath := "/vpn_gateways/testString/connections/testString/local_cidrs/testString/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(addVPNGatewayConnectionLocalCIDRPath)) - Expect(req.Method).To(Equal("PUT")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke AddVPNGatewayConnectionLocalCIDR 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.AddVPNGatewayConnectionLocalCIDR(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the AddVPNGatewayConnectionLocalCIDROptions model - addVPNGatewayConnectionLocalCIDROptionsModel := new(vpcv1.AddVPNGatewayConnectionLocalCIDROptions) - addVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") - addVPNGatewayConnectionLocalCIDROptionsModel.ID = core.StringPtr("testString") - addVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") - addVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength = core.StringPtr("testString") - addVPNGatewayConnectionLocalCIDROptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke AddVPNGatewayConnectionLocalCIDR 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 AddVPNGatewayConnectionLocalCIDROptions model - addVPNGatewayConnectionLocalCIDROptionsModel := new(vpcv1.AddVPNGatewayConnectionLocalCIDROptions) - addVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") - addVPNGatewayConnectionLocalCIDROptionsModel.ID = core.StringPtr("testString") - addVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") - addVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength = core.StringPtr("testString") - addVPNGatewayConnectionLocalCIDROptionsModel.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.AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the AddVPNGatewayConnectionLocalCIDROptions model with no property values - addVPNGatewayConnectionLocalCIDROptionsModelNew := new(vpcv1.AddVPNGatewayConnectionLocalCIDROptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) - Operation response error`, func() { - version := "testString" - listVPNGatewayConnectionPeerCIDRsPath := "/vpn_gateways/testString/connections/testString/peer_cidrs" - 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(listVPNGatewayConnectionPeerCIDRsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListVPNGatewayConnectionPeerCIDRs 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 ListVPNGatewayConnectionPeerCIDRsOptions model - listVPNGatewayConnectionPeerCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionPeerCIDRsOptions) - listVPNGatewayConnectionPeerCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionPeerCIDRsOptionsModel.ID = core.StringPtr("testString") - listVPNGatewayConnectionPeerCIDRsOptionsModel.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.ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptionsModel) - 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.ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions)`, func() { - version := "testString" - listVPNGatewayConnectionPeerCIDRsPath := "/vpn_gateways/testString/connections/testString/peer_cidrs" - 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(listVPNGatewayConnectionPeerCIDRsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"peer_cidrs": ["10.45.1.0/24"]}`) - })) - }) - It(`Invoke ListVPNGatewayConnectionPeerCIDRs 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 ListVPNGatewayConnectionPeerCIDRsOptions model - listVPNGatewayConnectionPeerCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionPeerCIDRsOptions) - listVPNGatewayConnectionPeerCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionPeerCIDRsOptionsModel.ID = core.StringPtr("testString") - listVPNGatewayConnectionPeerCIDRsOptionsModel.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.ListVPNGatewayConnectionPeerCIDRsWithContext(ctx, listVPNGatewayConnectionPeerCIDRsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptionsModel) - 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.ListVPNGatewayConnectionPeerCIDRsWithContext(ctx, listVPNGatewayConnectionPeerCIDRsOptionsModel) - 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(listVPNGatewayConnectionPeerCIDRsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"peer_cidrs": ["10.45.1.0/24"]}`) - })) - }) - It(`Invoke ListVPNGatewayConnectionPeerCIDRs 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.ListVPNGatewayConnectionPeerCIDRs(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListVPNGatewayConnectionPeerCIDRsOptions model - listVPNGatewayConnectionPeerCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionPeerCIDRsOptions) - listVPNGatewayConnectionPeerCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionPeerCIDRsOptionsModel.ID = core.StringPtr("testString") - listVPNGatewayConnectionPeerCIDRsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListVPNGatewayConnectionPeerCIDRs 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 ListVPNGatewayConnectionPeerCIDRsOptions model - listVPNGatewayConnectionPeerCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionPeerCIDRsOptions) - listVPNGatewayConnectionPeerCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionPeerCIDRsOptionsModel.ID = core.StringPtr("testString") - listVPNGatewayConnectionPeerCIDRsOptionsModel.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.ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptionsModel) - 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 ListVPNGatewayConnectionPeerCIDRsOptions model with no property values - listVPNGatewayConnectionPeerCIDRsOptionsModelNew := new(vpcv1.ListVPNGatewayConnectionPeerCIDRsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptionsModelNew) - 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 ListVPNGatewayConnectionPeerCIDRs 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 ListVPNGatewayConnectionPeerCIDRsOptions model - listVPNGatewayConnectionPeerCIDRsOptionsModel := new(vpcv1.ListVPNGatewayConnectionPeerCIDRsOptions) - listVPNGatewayConnectionPeerCIDRsOptionsModel.VPNGatewayID = core.StringPtr("testString") - listVPNGatewayConnectionPeerCIDRsOptionsModel.ID = core.StringPtr("testString") - listVPNGatewayConnectionPeerCIDRsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions)`, func() { - version := "testString" - removeVPNGatewayConnectionPeerCIDRPath := "/vpn_gateways/testString/connections/testString/peer_cidrs/testString/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(removeVPNGatewayConnectionPeerCIDRPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke RemoveVPNGatewayConnectionPeerCIDR 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.RemoveVPNGatewayConnectionPeerCIDR(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the RemoveVPNGatewayConnectionPeerCIDROptions model - removeVPNGatewayConnectionPeerCIDROptionsModel := new(vpcv1.RemoveVPNGatewayConnectionPeerCIDROptions) - removeVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") - removeVPNGatewayConnectionPeerCIDROptionsModel.ID = core.StringPtr("testString") - removeVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") - removeVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength = core.StringPtr("testString") - removeVPNGatewayConnectionPeerCIDROptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke RemoveVPNGatewayConnectionPeerCIDR 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 RemoveVPNGatewayConnectionPeerCIDROptions model - removeVPNGatewayConnectionPeerCIDROptionsModel := new(vpcv1.RemoveVPNGatewayConnectionPeerCIDROptions) - removeVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") - removeVPNGatewayConnectionPeerCIDROptionsModel.ID = core.StringPtr("testString") - removeVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") - removeVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength = core.StringPtr("testString") - removeVPNGatewayConnectionPeerCIDROptionsModel.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.RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the RemoveVPNGatewayConnectionPeerCIDROptions model with no property values - removeVPNGatewayConnectionPeerCIDROptionsModelNew := new(vpcv1.RemoveVPNGatewayConnectionPeerCIDROptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions)`, func() { - version := "testString" - checkVPNGatewayConnectionPeerCIDRPath := "/vpn_gateways/testString/connections/testString/peer_cidrs/testString/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(checkVPNGatewayConnectionPeerCIDRPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke CheckVPNGatewayConnectionPeerCIDR 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.CheckVPNGatewayConnectionPeerCIDR(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the CheckVPNGatewayConnectionPeerCIDROptions model - checkVPNGatewayConnectionPeerCIDROptionsModel := new(vpcv1.CheckVPNGatewayConnectionPeerCIDROptions) - checkVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") - checkVPNGatewayConnectionPeerCIDROptionsModel.ID = core.StringPtr("testString") - checkVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") - checkVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength = core.StringPtr("testString") - checkVPNGatewayConnectionPeerCIDROptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke CheckVPNGatewayConnectionPeerCIDR 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 CheckVPNGatewayConnectionPeerCIDROptions model - checkVPNGatewayConnectionPeerCIDROptionsModel := new(vpcv1.CheckVPNGatewayConnectionPeerCIDROptions) - checkVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") - checkVPNGatewayConnectionPeerCIDROptionsModel.ID = core.StringPtr("testString") - checkVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") - checkVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength = core.StringPtr("testString") - checkVPNGatewayConnectionPeerCIDROptionsModel.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.CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the CheckVPNGatewayConnectionPeerCIDROptions model with no property values - checkVPNGatewayConnectionPeerCIDROptionsModelNew := new(vpcv1.CheckVPNGatewayConnectionPeerCIDROptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions)`, func() { - version := "testString" - addVPNGatewayConnectionPeerCIDRPath := "/vpn_gateways/testString/connections/testString/peer_cidrs/testString/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(addVPNGatewayConnectionPeerCIDRPath)) - Expect(req.Method).To(Equal("PUT")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke AddVPNGatewayConnectionPeerCIDR 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.AddVPNGatewayConnectionPeerCIDR(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the AddVPNGatewayConnectionPeerCIDROptions model - addVPNGatewayConnectionPeerCIDROptionsModel := new(vpcv1.AddVPNGatewayConnectionPeerCIDROptions) - addVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") - addVPNGatewayConnectionPeerCIDROptionsModel.ID = core.StringPtr("testString") - addVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") - addVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength = core.StringPtr("testString") - addVPNGatewayConnectionPeerCIDROptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke AddVPNGatewayConnectionPeerCIDR 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 AddVPNGatewayConnectionPeerCIDROptions model - addVPNGatewayConnectionPeerCIDROptionsModel := new(vpcv1.AddVPNGatewayConnectionPeerCIDROptions) - addVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID = core.StringPtr("testString") - addVPNGatewayConnectionPeerCIDROptionsModel.ID = core.StringPtr("testString") - addVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix = core.StringPtr("testString") - addVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength = core.StringPtr("testString") - addVPNGatewayConnectionPeerCIDROptionsModel.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.AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the AddVPNGatewayConnectionPeerCIDROptions model with no property values - addVPNGatewayConnectionPeerCIDROptionsModelNew := new(vpcv1.AddVPNGatewayConnectionPeerCIDROptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPNServers(listVPNServersOptions *ListVPNServersOptions) - Operation response error`, func() { - version := "testString" - listVPNServersPath := "/vpn_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(listVPNServersPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).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()["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 ListVPNServers 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 ListVPNServersOptions model - listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) - listVPNServersOptionsModel.Name = core.StringPtr("testString") - listVPNServersOptionsModel.Start = core.StringPtr("testString") - listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVPNServersOptionsModel.Sort = core.StringPtr("name") - listVPNServersOptionsModel.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.ListVPNServers(listVPNServersOptionsModel) - 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.ListVPNServers(listVPNServersOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPNServers(listVPNServersOptions *ListVPNServersOptions)`, func() { - version := "testString" - listVPNServersPath := "/vpn_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(listVPNServersPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).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()["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/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/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}`) - })) - }) - It(`Invoke ListVPNServers 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 ListVPNServersOptions model - listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) - listVPNServersOptionsModel.Name = core.StringPtr("testString") - listVPNServersOptionsModel.Start = core.StringPtr("testString") - listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVPNServersOptionsModel.Sort = core.StringPtr("name") - listVPNServersOptionsModel.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.ListVPNServersWithContext(ctx, listVPNServersOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVPNServers(listVPNServersOptionsModel) - 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.ListVPNServersWithContext(ctx, listVPNServersOptionsModel) - 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(listVPNServersPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).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()["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/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/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}`) - })) - }) - It(`Invoke ListVPNServers 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.ListVPNServers(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListVPNServersOptions model - listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) - listVPNServersOptionsModel.Name = core.StringPtr("testString") - listVPNServersOptionsModel.Start = core.StringPtr("testString") - listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVPNServersOptionsModel.Sort = core.StringPtr("name") - listVPNServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVPNServers(listVPNServersOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListVPNServers 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 ListVPNServersOptions model - listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) - listVPNServersOptionsModel.Name = core.StringPtr("testString") - listVPNServersOptionsModel.Start = core.StringPtr("testString") - listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVPNServersOptionsModel.Sort = core.StringPtr("name") - listVPNServersOptionsModel.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.ListVPNServers(listVPNServersOptionsModel) - 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 ListVPNServers 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 ListVPNServersOptions model - listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) - listVPNServersOptionsModel.Name = core.StringPtr("testString") - listVPNServersOptionsModel.Start = core.StringPtr("testString") - listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") - listVPNServersOptionsModel.Sort = core.StringPtr("name") - listVPNServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListVPNServers(listVPNServersOptionsModel) - 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.VPNServerCollection) - nextObject := new(vpcv1.VPNServerCollectionNext) - 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.VPNServerCollection) - - 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.VPNServerCollection) - nextObject := new(vpcv1.VPNServerCollectionNext) - 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(listVPNServersPath)) - 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"},"vpn_servers":[{"certificate":{"crn":"crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5","enable_split_tunneling":true,"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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"protocol":"udp","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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"vpn_servers":[{"certificate":{"crn":"crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5","enable_split_tunneling":true,"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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"protocol":"udp","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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use VPNServersPager.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()) - - listVPNServersOptionsModel := &vpcv1.ListVPNServersOptions{ - Name: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Sort: core.StringPtr("name"), - } - - pager, err := vpcService.NewVPNServersPager(listVPNServersOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.VPNServer - 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 VPNServersPager.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()) - - listVPNServersOptionsModel := &vpcv1.ListVPNServersOptions{ - Name: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Sort: core.StringPtr("name"), - } - - pager, err := vpcService.NewVPNServersPager(listVPNServersOptionsModel) - 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(`CreateVPNServer(createVPNServerOptions *CreateVPNServerOptions) - Operation response error`, func() { - version := "testString" - createVPNServerPath := "/vpn_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(createVPNServerPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateVPNServer 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model - vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) - vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") - - // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model - vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") - vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel - - // 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 IP model - ipModel := new(vpcv1.IP) - ipModel.Address = core.StringPtr("192.168.3.4") - - // 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 CreateVPNServerOptions model - createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) - createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel - createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} - createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") - createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} - createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) - createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) - createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") - createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) - createVPNServerOptionsModel.Protocol = core.StringPtr("udp") - createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createVPNServerOptionsModel.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.CreateVPNServer(createVPNServerOptionsModel) - 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.CreateVPNServer(createVPNServerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateVPNServer(createVPNServerOptions *CreateVPNServerOptions)`, func() { - version := "testString" - createVPNServerPath := "/vpn_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(createVPNServerPath)) - 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{"testString"})) - 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", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke CreateVPNServer 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model - vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) - vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") - - // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model - vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") - vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel - - // 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 IP model - ipModel := new(vpcv1.IP) - ipModel.Address = core.StringPtr("192.168.3.4") - - // 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 CreateVPNServerOptions model - createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) - createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel - createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} - createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") - createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} - createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) - createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) - createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") - createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) - createVPNServerOptionsModel.Protocol = core.StringPtr("udp") - createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createVPNServerOptionsModel.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.CreateVPNServerWithContext(ctx, createVPNServerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateVPNServer(createVPNServerOptionsModel) - 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.CreateVPNServerWithContext(ctx, createVPNServerOptionsModel) - 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(createVPNServerPath)) - 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{"testString"})) - 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", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke CreateVPNServer 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.CreateVPNServer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model - vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) - vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") - - // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model - vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") - vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel - - // 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 IP model - ipModel := new(vpcv1.IP) - ipModel.Address = core.StringPtr("192.168.3.4") - - // 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 CreateVPNServerOptions model - createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) - createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel - createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} - createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") - createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} - createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) - createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) - createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") - createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) - createVPNServerOptionsModel.Protocol = core.StringPtr("udp") - createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateVPNServer(createVPNServerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateVPNServer 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model - vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) - vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") - - // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model - vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") - vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel - - // 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 IP model - ipModel := new(vpcv1.IP) - ipModel.Address = core.StringPtr("192.168.3.4") - - // 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 CreateVPNServerOptions model - createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) - createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel - createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} - createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") - createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} - createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) - createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) - createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") - createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) - createVPNServerOptionsModel.Protocol = core.StringPtr("udp") - createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createVPNServerOptionsModel.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.CreateVPNServer(createVPNServerOptionsModel) - 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 CreateVPNServerOptions model with no property values - createVPNServerOptionsModelNew := new(vpcv1.CreateVPNServerOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateVPNServer(createVPNServerOptionsModelNew) - 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 CreateVPNServer 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model - vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) - vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") - - // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model - vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") - vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel - - // 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 IP model - ipModel := new(vpcv1.IP) - ipModel.Address = core.StringPtr("192.168.3.4") - - // 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 CreateVPNServerOptions model - createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) - createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel - createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} - createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") - createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} - createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) - createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) - createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") - createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) - createVPNServerOptionsModel.Protocol = core.StringPtr("udp") - createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateVPNServer(createVPNServerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteVPNServer(deleteVPNServerOptions *DeleteVPNServerOptions)`, func() { - version := "testString" - deleteVPNServerPath := "/vpn_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(deleteVPNServerPath)) - 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{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteVPNServer 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.DeleteVPNServer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteVPNServerOptions model - deleteVPNServerOptionsModel := new(vpcv1.DeleteVPNServerOptions) - deleteVPNServerOptionsModel.ID = core.StringPtr("testString") - deleteVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteVPNServer(deleteVPNServerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteVPNServer 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 DeleteVPNServerOptions model - deleteVPNServerOptionsModel := new(vpcv1.DeleteVPNServerOptions) - deleteVPNServerOptionsModel.ID = core.StringPtr("testString") - deleteVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteVPNServerOptionsModel.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.DeleteVPNServer(deleteVPNServerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteVPNServerOptions model with no property values - deleteVPNServerOptionsModelNew := new(vpcv1.DeleteVPNServerOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteVPNServer(deleteVPNServerOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPNServer(getVPNServerOptions *GetVPNServerOptions) - Operation response error`, func() { - version := "testString" - getVPNServerPath := "/vpn_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(getVPNServerPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVPNServer 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 GetVPNServerOptions model - getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) - getVPNServerOptionsModel.ID = core.StringPtr("testString") - getVPNServerOptionsModel.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.GetVPNServer(getVPNServerOptionsModel) - 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.GetVPNServer(getVPNServerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPNServer(getVPNServerOptions *GetVPNServerOptions)`, func() { - version := "testString" - getVPNServerPath := "/vpn_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(getVPNServerPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetVPNServer 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 GetVPNServerOptions model - getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) - getVPNServerOptionsModel.ID = core.StringPtr("testString") - getVPNServerOptionsModel.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.GetVPNServerWithContext(ctx, getVPNServerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVPNServer(getVPNServerOptionsModel) - 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.GetVPNServerWithContext(ctx, getVPNServerOptionsModel) - 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(getVPNServerPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetVPNServer 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.GetVPNServer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetVPNServerOptions model - getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) - getVPNServerOptionsModel.ID = core.StringPtr("testString") - getVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVPNServer(getVPNServerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVPNServer 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 GetVPNServerOptions model - getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) - getVPNServerOptionsModel.ID = core.StringPtr("testString") - getVPNServerOptionsModel.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.GetVPNServer(getVPNServerOptionsModel) - 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 GetVPNServerOptions model with no property values - getVPNServerOptionsModelNew := new(vpcv1.GetVPNServerOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVPNServer(getVPNServerOptionsModelNew) - 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 GetVPNServer 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 GetVPNServerOptions model - getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) - getVPNServerOptionsModel.ID = core.StringPtr("testString") - getVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVPNServer(getVPNServerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) - Operation response error`, func() { - version := "testString" - updateVPNServerPath := "/vpn_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(updateVPNServerPath)) - 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{"testString"})) - 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 UpdateVPNServer 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model - vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) - vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") - - // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model - vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") - vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel - - // Construct an instance of the IP model - ipModel := new(vpcv1.IP) - ipModel.Address = core.StringPtr("192.168.3.4") - - // 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 VPNServerPatch model - vpnServerPatchModel := new(vpcv1.VPNServerPatch) - vpnServerPatchModel.Certificate = certificateInstanceIdentityModel - vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} - vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} - vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) - vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") - vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) - vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") - vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) - vpnServerPatchModel.Protocol = core.StringPtr("udp") - vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNServerOptions model - updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) - updateVPNServerOptionsModel.ID = core.StringPtr("testString") - updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch - updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVPNServerOptionsModel.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.UpdateVPNServer(updateVPNServerOptionsModel) - 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.UpdateVPNServer(updateVPNServerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions)`, func() { - version := "testString" - updateVPNServerPath := "/vpn_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(updateVPNServerPath)) - 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{"testString"})) - 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", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke UpdateVPNServer 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model - vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) - vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") - - // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model - vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") - vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel - - // Construct an instance of the IP model - ipModel := new(vpcv1.IP) - ipModel.Address = core.StringPtr("192.168.3.4") - - // 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 VPNServerPatch model - vpnServerPatchModel := new(vpcv1.VPNServerPatch) - vpnServerPatchModel.Certificate = certificateInstanceIdentityModel - vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} - vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} - vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) - vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") - vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) - vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") - vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) - vpnServerPatchModel.Protocol = core.StringPtr("udp") - vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNServerOptions model - updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) - updateVPNServerOptionsModel.ID = core.StringPtr("testString") - updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch - updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVPNServerOptionsModel.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.UpdateVPNServerWithContext(ctx, updateVPNServerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateVPNServer(updateVPNServerOptionsModel) - 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.UpdateVPNServerWithContext(ctx, updateVPNServerOptionsModel) - 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(updateVPNServerPath)) - 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{"testString"})) - 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", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456: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/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "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_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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke UpdateVPNServer 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.UpdateVPNServer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model - vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) - vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") - - // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model - vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") - vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel - - // Construct an instance of the IP model - ipModel := new(vpcv1.IP) - ipModel.Address = core.StringPtr("192.168.3.4") - - // 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 VPNServerPatch model - vpnServerPatchModel := new(vpcv1.VPNServerPatch) - vpnServerPatchModel.Certificate = certificateInstanceIdentityModel - vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} - vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} - vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) - vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") - vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) - vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") - vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) - vpnServerPatchModel.Protocol = core.StringPtr("udp") - vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNServerOptions model - updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) - updateVPNServerOptionsModel.ID = core.StringPtr("testString") - updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch - updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateVPNServer(updateVPNServerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateVPNServer 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model - vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) - vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") - - // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model - vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") - vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel - - // Construct an instance of the IP model - ipModel := new(vpcv1.IP) - ipModel.Address = core.StringPtr("192.168.3.4") - - // 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 VPNServerPatch model - vpnServerPatchModel := new(vpcv1.VPNServerPatch) - vpnServerPatchModel.Certificate = certificateInstanceIdentityModel - vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} - vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} - vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) - vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") - vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) - vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") - vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) - vpnServerPatchModel.Protocol = core.StringPtr("udp") - vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNServerOptions model - updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) - updateVPNServerOptionsModel.ID = core.StringPtr("testString") - updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch - updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVPNServerOptionsModel.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.UpdateVPNServer(updateVPNServerOptionsModel) - 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 UpdateVPNServerOptions model with no property values - updateVPNServerOptionsModelNew := new(vpcv1.UpdateVPNServerOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateVPNServer(updateVPNServerOptionsModelNew) - 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 UpdateVPNServer 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model - vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) - vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") - - // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model - vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") - vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel - - // Construct an instance of the IP model - ipModel := new(vpcv1.IP) - ipModel.Address = core.StringPtr("192.168.3.4") - - // 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 VPNServerPatch model - vpnServerPatchModel := new(vpcv1.VPNServerPatch) - vpnServerPatchModel.Certificate = certificateInstanceIdentityModel - vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} - vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} - vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) - vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") - vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) - vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") - vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) - vpnServerPatchModel.Protocol = core.StringPtr("udp") - vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNServerOptions model - updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) - updateVPNServerOptionsModel.ID = core.StringPtr("testString") - updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch - updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateVPNServer(updateVPNServerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions)`, func() { - version := "testString" - getVPNServerClientConfigurationPath := "/vpn_servers/testString/client_configuration" - 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(getVPNServerClientConfigurationPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", "text/plain") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `"client\nproto udp\nremote a8506291.us-south.vpn-server.appdomain.cloud\nport 443\n\ndev tun\nnobind\n\n-----BEGIN CERTIFICATE-----\nxxxxxx\n-----END CERTIFICATE-----\n"`) - })) - }) - It(`Invoke GetVPNServerClientConfiguration 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 GetVPNServerClientConfigurationOptions model - getVPNServerClientConfigurationOptionsModel := new(vpcv1.GetVPNServerClientConfigurationOptions) - getVPNServerClientConfigurationOptionsModel.ID = core.StringPtr("testString") - getVPNServerClientConfigurationOptionsModel.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.GetVPNServerClientConfigurationWithContext(ctx, getVPNServerClientConfigurationOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModel) - 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.GetVPNServerClientConfigurationWithContext(ctx, getVPNServerClientConfigurationOptionsModel) - 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(getVPNServerClientConfigurationPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - // Set mock response - res.Header().Set("Content-type", "text/plain") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `"client\nproto udp\nremote a8506291.us-south.vpn-server.appdomain.cloud\nport 443\n\ndev tun\nnobind\n\n-----BEGIN CERTIFICATE-----\nxxxxxx\n-----END CERTIFICATE-----\n"`) - })) - }) - It(`Invoke GetVPNServerClientConfiguration 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.GetVPNServerClientConfiguration(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetVPNServerClientConfigurationOptions model - getVPNServerClientConfigurationOptionsModel := new(vpcv1.GetVPNServerClientConfigurationOptions) - getVPNServerClientConfigurationOptionsModel.ID = core.StringPtr("testString") - getVPNServerClientConfigurationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVPNServerClientConfiguration 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 GetVPNServerClientConfigurationOptions model - getVPNServerClientConfigurationOptionsModel := new(vpcv1.GetVPNServerClientConfigurationOptions) - getVPNServerClientConfigurationOptionsModel.ID = core.StringPtr("testString") - getVPNServerClientConfigurationOptionsModel.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.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModel) - 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 GetVPNServerClientConfigurationOptions model with no property values - getVPNServerClientConfigurationOptionsModelNew := new(vpcv1.GetVPNServerClientConfigurationOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModelNew) - 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 GetVPNServerClientConfiguration 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 GetVPNServerClientConfigurationOptions model - getVPNServerClientConfigurationOptionsModel := new(vpcv1.GetVPNServerClientConfigurationOptions) - getVPNServerClientConfigurationOptionsModel.ID = core.StringPtr("testString") - getVPNServerClientConfigurationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPNServerClients(listVPNServerClientsOptions *ListVPNServerClientsOptions) - Operation response error`, func() { - version := "testString" - listVPNServerClientsPath := "/vpn_servers/testString/clients" - 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(listVPNServerClientsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"created_at"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListVPNServerClients 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 ListVPNServerClientsOptions model - listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) - listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") - listVPNServerClientsOptionsModel.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.ListVPNServerClients(listVPNServerClientsOptionsModel) - 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.ListVPNServerClients(listVPNServerClientsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPNServerClients(listVPNServerClientsOptions *ListVPNServerClientsOptions)`, func() { - version := "testString" - listVPNServerClientsPath := "/vpn_servers/testString/clients" - 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(listVPNServerClientsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"created_at"})) - // 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", `{"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}`) - })) - }) - It(`Invoke ListVPNServerClients 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 ListVPNServerClientsOptions model - listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) - listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") - listVPNServerClientsOptionsModel.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.ListVPNServerClientsWithContext(ctx, listVPNServerClientsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVPNServerClients(listVPNServerClientsOptionsModel) - 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.ListVPNServerClientsWithContext(ctx, listVPNServerClientsOptionsModel) - 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(listVPNServerClientsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"created_at"})) - // 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}`) - })) - }) - It(`Invoke ListVPNServerClients 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.ListVPNServerClients(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListVPNServerClientsOptions model - listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) - listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") - listVPNServerClientsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVPNServerClients(listVPNServerClientsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListVPNServerClients 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 ListVPNServerClientsOptions model - listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) - listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") - listVPNServerClientsOptionsModel.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.ListVPNServerClients(listVPNServerClientsOptionsModel) - 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 ListVPNServerClientsOptions model with no property values - listVPNServerClientsOptionsModelNew := new(vpcv1.ListVPNServerClientsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListVPNServerClients(listVPNServerClientsOptionsModelNew) - 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 ListVPNServerClients 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 ListVPNServerClientsOptions model - listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) - listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") - listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") - listVPNServerClientsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListVPNServerClients(listVPNServerClientsOptionsModel) - 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.VPNServerClientCollection) - nextObject := new(vpcv1.VPNServerClientCollectionNext) - 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.VPNServerClientCollection) - - 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.VPNServerClientCollection) - nextObject := new(vpcv1.VPNServerClientCollectionNext) - 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(listVPNServerClientsPath)) - 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"},"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"}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - 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"}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use VPNServerClientsPager.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()) - - listVPNServerClientsOptionsModel := &vpcv1.ListVPNServerClientsOptions{ - VPNServerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("created_at"), - } - - pager, err := vpcService.NewVPNServerClientsPager(listVPNServerClientsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.VPNServerClient - 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 VPNServerClientsPager.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()) - - listVPNServerClientsOptionsModel := &vpcv1.ListVPNServerClientsOptions{ - VPNServerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("created_at"), - } - - pager, err := vpcService.NewVPNServerClientsPager(listVPNServerClientsOptionsModel) - 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(`DeleteVPNServerClient(deleteVPNServerClientOptions *DeleteVPNServerClientOptions)`, func() { - version := "testString" - deleteVPNServerClientPath := "/vpn_servers/testString/clients/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(deleteVPNServerClientPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteVPNServerClient 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.DeleteVPNServerClient(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteVPNServerClientOptions model - deleteVPNServerClientOptionsModel := new(vpcv1.DeleteVPNServerClientOptions) - deleteVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") - deleteVPNServerClientOptionsModel.ID = core.StringPtr("testString") - deleteVPNServerClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteVPNServerClient(deleteVPNServerClientOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteVPNServerClient 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 DeleteVPNServerClientOptions model - deleteVPNServerClientOptionsModel := new(vpcv1.DeleteVPNServerClientOptions) - deleteVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") - deleteVPNServerClientOptionsModel.ID = core.StringPtr("testString") - deleteVPNServerClientOptionsModel.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.DeleteVPNServerClient(deleteVPNServerClientOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteVPNServerClientOptions model with no property values - deleteVPNServerClientOptionsModelNew := new(vpcv1.DeleteVPNServerClientOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteVPNServerClient(deleteVPNServerClientOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPNServerClient(getVPNServerClientOptions *GetVPNServerClientOptions) - Operation response error`, func() { - version := "testString" - getVPNServerClientPath := "/vpn_servers/testString/clients/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(getVPNServerClientPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVPNServerClient 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 GetVPNServerClientOptions model - getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) - getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") - getVPNServerClientOptionsModel.ID = core.StringPtr("testString") - getVPNServerClientOptionsModel.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.GetVPNServerClient(getVPNServerClientOptionsModel) - 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.GetVPNServerClient(getVPNServerClientOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPNServerClient(getVPNServerClientOptions *GetVPNServerClientOptions)`, func() { - version := "testString" - getVPNServerClientPath := "/vpn_servers/testString/clients/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(getVPNServerClientPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke GetVPNServerClient 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 GetVPNServerClientOptions model - getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) - getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") - getVPNServerClientOptionsModel.ID = core.StringPtr("testString") - getVPNServerClientOptionsModel.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.GetVPNServerClientWithContext(ctx, getVPNServerClientOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVPNServerClient(getVPNServerClientOptionsModel) - 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.GetVPNServerClientWithContext(ctx, getVPNServerClientOptionsModel) - 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(getVPNServerClientPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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"}`) - })) - }) - It(`Invoke GetVPNServerClient 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.GetVPNServerClient(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetVPNServerClientOptions model - getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) - getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") - getVPNServerClientOptionsModel.ID = core.StringPtr("testString") - getVPNServerClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVPNServerClient(getVPNServerClientOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVPNServerClient 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 GetVPNServerClientOptions model - getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) - getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") - getVPNServerClientOptionsModel.ID = core.StringPtr("testString") - getVPNServerClientOptionsModel.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.GetVPNServerClient(getVPNServerClientOptionsModel) - 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 GetVPNServerClientOptions model with no property values - getVPNServerClientOptionsModelNew := new(vpcv1.GetVPNServerClientOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVPNServerClient(getVPNServerClientOptionsModelNew) - 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 GetVPNServerClient 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 GetVPNServerClientOptions model - getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) - getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") - getVPNServerClientOptionsModel.ID = core.StringPtr("testString") - getVPNServerClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVPNServerClient(getVPNServerClientOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DisconnectVPNClient(disconnectVPNClientOptions *DisconnectVPNClientOptions)`, func() { - version := "testString" - disconnectVPNClientPath := "/vpn_servers/testString/clients/testString/disconnect" - 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(disconnectVPNClientPath)) - Expect(req.Method).To(Equal("POST")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DisconnectVPNClient 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.DisconnectVPNClient(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DisconnectVPNClientOptions model - disconnectVPNClientOptionsModel := new(vpcv1.DisconnectVPNClientOptions) - disconnectVPNClientOptionsModel.VPNServerID = core.StringPtr("testString") - disconnectVPNClientOptionsModel.ID = core.StringPtr("testString") - disconnectVPNClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DisconnectVPNClient(disconnectVPNClientOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DisconnectVPNClient 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 DisconnectVPNClientOptions model - disconnectVPNClientOptionsModel := new(vpcv1.DisconnectVPNClientOptions) - disconnectVPNClientOptionsModel.VPNServerID = core.StringPtr("testString") - disconnectVPNClientOptionsModel.ID = core.StringPtr("testString") - disconnectVPNClientOptionsModel.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.DisconnectVPNClient(disconnectVPNClientOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DisconnectVPNClientOptions model with no property values - disconnectVPNClientOptionsModelNew := new(vpcv1.DisconnectVPNClientOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DisconnectVPNClient(disconnectVPNClientOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPNServerRoutes(listVPNServerRoutesOptions *ListVPNServerRoutesOptions) - Operation response error`, func() { - version := "testString" - listVPNServerRoutesPath := "/vpn_servers/testString/routes" - 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(listVPNServerRoutesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListVPNServerRoutes 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 ListVPNServerRoutesOptions model - listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) - listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") - listVPNServerRoutesOptionsModel.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.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) - 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.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListVPNServerRoutes(listVPNServerRoutesOptions *ListVPNServerRoutesOptions)`, func() { - version := "testString" - listVPNServerRoutesPath := "/vpn_servers/testString/routes" - 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(listVPNServerRoutesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}`) - })) - }) - It(`Invoke ListVPNServerRoutes 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 ListVPNServerRoutesOptions model - listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) - listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") - listVPNServerRoutesOptionsModel.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.ListVPNServerRoutesWithContext(ctx, listVPNServerRoutesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) - 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.ListVPNServerRoutesWithContext(ctx, listVPNServerRoutesOptionsModel) - 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(listVPNServerRoutesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}`) - })) - }) - It(`Invoke ListVPNServerRoutes 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.ListVPNServerRoutes(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListVPNServerRoutesOptions model - listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) - listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") - listVPNServerRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListVPNServerRoutes 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 ListVPNServerRoutesOptions model - listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) - listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") - listVPNServerRoutesOptionsModel.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.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) - 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 ListVPNServerRoutesOptions model with no property values - listVPNServerRoutesOptionsModelNew := new(vpcv1.ListVPNServerRoutesOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModelNew) - 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 ListVPNServerRoutes 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 ListVPNServerRoutesOptions model - listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) - listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") - listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") - listVPNServerRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) - 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.VPNServerRouteCollection) - nextObject := new(vpcv1.VPNServerRouteCollectionNext) - 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.VPNServerRouteCollection) - - 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.VPNServerRouteCollection) - nextObject := new(vpcv1.VPNServerRouteCollectionNext) - 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(listVPNServerRoutesPath)) - 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"},"routes":[{"action":"deliver","created_at":"2019-01-01T12:00:00.000Z","destination":"192.168.3.0/24","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_state":"stable","name":"my-vpn-route-1","resource_type":"vpn_server_route"}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"routes":[{"action":"deliver","created_at":"2019-01-01T12:00:00.000Z","destination":"192.168.3.0/24","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_state":"stable","name":"my-vpn-route-1","resource_type":"vpn_server_route"}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use VPNServerRoutesPager.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()) - - listVPNServerRoutesOptionsModel := &vpcv1.ListVPNServerRoutesOptions{ - VPNServerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - } - - pager, err := vpcService.NewVPNServerRoutesPager(listVPNServerRoutesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.VPNServerRoute - 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 VPNServerRoutesPager.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()) - - listVPNServerRoutesOptionsModel := &vpcv1.ListVPNServerRoutesOptions{ - VPNServerID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - } - - pager, err := vpcService.NewVPNServerRoutesPager(listVPNServerRoutesOptionsModel) - 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(`CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) - Operation response error`, func() { - version := "testString" - createVPNServerRoutePath := "/vpn_servers/testString/routes" - 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(createVPNServerRoutePath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateVPNServerRoute 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 CreateVPNServerRouteOptions model - createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) - createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") - createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") - createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") - createVPNServerRouteOptionsModel.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.CreateVPNServerRoute(createVPNServerRouteOptionsModel) - 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.CreateVPNServerRoute(createVPNServerRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions)`, func() { - version := "testString" - createVPNServerRoutePath := "/vpn_servers/testString/routes" - 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(createVPNServerRoutePath)) - 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{"testString"})) - 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", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) - })) - }) - It(`Invoke CreateVPNServerRoute 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 CreateVPNServerRouteOptions model - createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) - createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") - createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") - createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") - createVPNServerRouteOptionsModel.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.CreateVPNServerRouteWithContext(ctx, createVPNServerRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModel) - 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.CreateVPNServerRouteWithContext(ctx, createVPNServerRouteOptionsModel) - 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(createVPNServerRoutePath)) - 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{"testString"})) - 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", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) - })) - }) - It(`Invoke CreateVPNServerRoute 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.CreateVPNServerRoute(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the CreateVPNServerRouteOptions model - createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) - createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") - createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") - createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") - createVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateVPNServerRoute 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 CreateVPNServerRouteOptions model - createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) - createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") - createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") - createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") - createVPNServerRouteOptionsModel.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.CreateVPNServerRoute(createVPNServerRouteOptionsModel) - 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 CreateVPNServerRouteOptions model with no property values - createVPNServerRouteOptionsModelNew := new(vpcv1.CreateVPNServerRouteOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModelNew) - 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 CreateVPNServerRoute 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 CreateVPNServerRouteOptions model - createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) - createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") - createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") - createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") - createVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteVPNServerRoute(deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions)`, func() { - version := "testString" - deleteVPNServerRoutePath := "/vpn_servers/testString/routes/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(deleteVPNServerRoutePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteVPNServerRoute 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.DeleteVPNServerRoute(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteVPNServerRouteOptions model - deleteVPNServerRouteOptionsModel := new(vpcv1.DeleteVPNServerRouteOptions) - deleteVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - deleteVPNServerRouteOptionsModel.ID = core.StringPtr("testString") - deleteVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteVPNServerRoute(deleteVPNServerRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteVPNServerRoute 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 DeleteVPNServerRouteOptions model - deleteVPNServerRouteOptionsModel := new(vpcv1.DeleteVPNServerRouteOptions) - deleteVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - deleteVPNServerRouteOptionsModel.ID = core.StringPtr("testString") - deleteVPNServerRouteOptionsModel.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.DeleteVPNServerRoute(deleteVPNServerRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteVPNServerRouteOptions model with no property values - deleteVPNServerRouteOptionsModelNew := new(vpcv1.DeleteVPNServerRouteOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteVPNServerRoute(deleteVPNServerRouteOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPNServerRoute(getVPNServerRouteOptions *GetVPNServerRouteOptions) - Operation response error`, func() { - version := "testString" - getVPNServerRoutePath := "/vpn_servers/testString/routes/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(getVPNServerRoutePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetVPNServerRoute 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 GetVPNServerRouteOptions model - getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) - getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") - getVPNServerRouteOptionsModel.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.GetVPNServerRoute(getVPNServerRouteOptionsModel) - 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.GetVPNServerRoute(getVPNServerRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetVPNServerRoute(getVPNServerRouteOptions *GetVPNServerRouteOptions)`, func() { - version := "testString" - getVPNServerRoutePath := "/vpn_servers/testString/routes/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(getVPNServerRoutePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) - })) - }) - It(`Invoke GetVPNServerRoute 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 GetVPNServerRouteOptions model - getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) - getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") - getVPNServerRouteOptionsModel.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.GetVPNServerRouteWithContext(ctx, getVPNServerRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModel) - 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.GetVPNServerRouteWithContext(ctx, getVPNServerRouteOptionsModel) - 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(getVPNServerRoutePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) - })) - }) - It(`Invoke GetVPNServerRoute 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.GetVPNServerRoute(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetVPNServerRouteOptions model - getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) - getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") - getVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetVPNServerRoute 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 GetVPNServerRouteOptions model - getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) - getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") - getVPNServerRouteOptionsModel.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.GetVPNServerRoute(getVPNServerRouteOptionsModel) - 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 GetVPNServerRouteOptions model with no property values - getVPNServerRouteOptionsModelNew := new(vpcv1.GetVPNServerRouteOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModelNew) - 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 GetVPNServerRoute 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 GetVPNServerRouteOptions model - getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) - getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") - getVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPNServerRoute(updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) - Operation response error`, func() { - version := "testString" - updateVPNServerRoutePath := "/vpn_servers/testString/routes/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(updateVPNServerRoutePath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateVPNServerRoute 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 VPNServerRoutePatch model - vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) - vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") - vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNServerRouteOptions model - updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) - updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") - updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch - updateVPNServerRouteOptionsModel.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.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) - 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.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateVPNServerRoute(updateVPNServerRouteOptions *UpdateVPNServerRouteOptions)`, func() { - version := "testString" - updateVPNServerRoutePath := "/vpn_servers/testString/routes/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(updateVPNServerRoutePath)) - 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{"testString"})) - 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", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) - })) - }) - It(`Invoke UpdateVPNServerRoute 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 VPNServerRoutePatch model - vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) - vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") - vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNServerRouteOptions model - updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) - updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") - updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch - updateVPNServerRouteOptionsModel.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.UpdateVPNServerRouteWithContext(ctx, updateVPNServerRouteOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) - 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.UpdateVPNServerRouteWithContext(ctx, updateVPNServerRouteOptionsModel) - 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(updateVPNServerRoutePath)) - 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{"testString"})) - 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", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "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_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) - })) - }) - It(`Invoke UpdateVPNServerRoute 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.UpdateVPNServerRoute(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the VPNServerRoutePatch model - vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) - vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") - vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNServerRouteOptions model - updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) - updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") - updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch - updateVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateVPNServerRoute 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 VPNServerRoutePatch model - vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) - vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") - vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNServerRouteOptions model - updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) - updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") - updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch - updateVPNServerRouteOptionsModel.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.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) - 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 UpdateVPNServerRouteOptions model with no property values - updateVPNServerRouteOptionsModelNew := new(vpcv1.UpdateVPNServerRouteOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModelNew) - 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 UpdateVPNServerRoute 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 VPNServerRoutePatch model - vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) - vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") - vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateVPNServerRouteOptions model - updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) - updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") - updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") - updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch - updateVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListLoadBalancerProfiles(listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) - Operation response error`, func() { - version := "testString" - listLoadBalancerProfilesPath := "/load_balancer/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(listLoadBalancerProfilesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListLoadBalancerProfiles 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 ListLoadBalancerProfilesOptions model - listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) - listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") - listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listLoadBalancerProfilesOptionsModel.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.ListLoadBalancerProfiles(listLoadBalancerProfilesOptionsModel) - 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.ListLoadBalancerProfiles(listLoadBalancerProfilesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListLoadBalancerProfiles(listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions)`, func() { - version := "testString" - listLoadBalancerProfilesPath := "/load_balancer/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(listLoadBalancerProfilesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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": [{"family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "udp_supported": {"type": "fixed", "value": true}}], "total_count": 132}`) - })) - }) - It(`Invoke ListLoadBalancerProfiles 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 ListLoadBalancerProfilesOptions model - listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) - listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") - listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listLoadBalancerProfilesOptionsModel.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.ListLoadBalancerProfilesWithContext(ctx, listLoadBalancerProfilesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListLoadBalancerProfiles(listLoadBalancerProfilesOptionsModel) - 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.ListLoadBalancerProfilesWithContext(ctx, listLoadBalancerProfilesOptionsModel) - 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(listLoadBalancerProfilesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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": [{"family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "udp_supported": {"type": "fixed", "value": true}}], "total_count": 132}`) - })) - }) - It(`Invoke ListLoadBalancerProfiles 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.ListLoadBalancerProfiles(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListLoadBalancerProfilesOptions model - listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) - listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") - listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listLoadBalancerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListLoadBalancerProfiles(listLoadBalancerProfilesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListLoadBalancerProfiles 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 ListLoadBalancerProfilesOptions model - listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) - listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") - listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listLoadBalancerProfilesOptionsModel.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.ListLoadBalancerProfiles(listLoadBalancerProfilesOptionsModel) - 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 ListLoadBalancerProfiles 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 ListLoadBalancerProfilesOptions model - listLoadBalancerProfilesOptionsModel := new(vpcv1.ListLoadBalancerProfilesOptions) - listLoadBalancerProfilesOptionsModel.Start = core.StringPtr("testString") - listLoadBalancerProfilesOptionsModel.Limit = core.Int64Ptr(int64(10)) - listLoadBalancerProfilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListLoadBalancerProfiles(listLoadBalancerProfilesOptionsModel) - 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.LoadBalancerProfileCollection) - nextObject := new(vpcv1.LoadBalancerProfileCollectionNext) - 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.LoadBalancerProfileCollection) - - 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.LoadBalancerProfileCollection) - nextObject := new(vpcv1.LoadBalancerProfileCollectionNext) - 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(listLoadBalancerProfilesPath)) - 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":[{"family":"network","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","logging_supported":{"type":"fixed","value":["datapath"]},"name":"network-fixed","route_mode_supported":{"type":"fixed","value":true},"security_groups_supported":{"type":"fixed","value":true},"udp_supported":{"type":"fixed","value":true}}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"profiles":[{"family":"network","href":"https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed","logging_supported":{"type":"fixed","value":["datapath"]},"name":"network-fixed","route_mode_supported":{"type":"fixed","value":true},"security_groups_supported":{"type":"fixed","value":true},"udp_supported":{"type":"fixed","value":true}}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use LoadBalancerProfilesPager.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()) - - listLoadBalancerProfilesOptionsModel := &vpcv1.ListLoadBalancerProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewLoadBalancerProfilesPager(listLoadBalancerProfilesOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.LoadBalancerProfile - 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 LoadBalancerProfilesPager.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()) - - listLoadBalancerProfilesOptionsModel := &vpcv1.ListLoadBalancerProfilesOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewLoadBalancerProfilesPager(listLoadBalancerProfilesOptionsModel) - 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(`GetLoadBalancerProfile(getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) - Operation response error`, func() { - version := "testString" - getLoadBalancerProfilePath := "/load_balancer/profiles/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(getLoadBalancerProfilePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetLoadBalancerProfile 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 GetLoadBalancerProfileOptions model - getLoadBalancerProfileOptionsModel := new(vpcv1.GetLoadBalancerProfileOptions) - getLoadBalancerProfileOptionsModel.Name = core.StringPtr("testString") - getLoadBalancerProfileOptionsModel.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.GetLoadBalancerProfile(getLoadBalancerProfileOptionsModel) - 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.GetLoadBalancerProfile(getLoadBalancerProfileOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancerProfile(getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions)`, func() { - version := "testString" - getLoadBalancerProfilePath := "/load_balancer/profiles/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(getLoadBalancerProfilePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "udp_supported": {"type": "fixed", "value": true}}`) - })) - }) - It(`Invoke GetLoadBalancerProfile 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 GetLoadBalancerProfileOptions model - getLoadBalancerProfileOptionsModel := new(vpcv1.GetLoadBalancerProfileOptions) - getLoadBalancerProfileOptionsModel.Name = core.StringPtr("testString") - getLoadBalancerProfileOptionsModel.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.GetLoadBalancerProfileWithContext(ctx, getLoadBalancerProfileOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetLoadBalancerProfile(getLoadBalancerProfileOptionsModel) - 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.GetLoadBalancerProfileWithContext(ctx, getLoadBalancerProfileOptionsModel) - 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(getLoadBalancerProfilePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"family": "network", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed", "logging_supported": {"type": "fixed", "value": ["datapath"]}, "name": "network-fixed", "route_mode_supported": {"type": "fixed", "value": true}, "security_groups_supported": {"type": "fixed", "value": true}, "udp_supported": {"type": "fixed", "value": true}}`) - })) - }) - It(`Invoke GetLoadBalancerProfile 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.GetLoadBalancerProfile(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetLoadBalancerProfileOptions model - getLoadBalancerProfileOptionsModel := new(vpcv1.GetLoadBalancerProfileOptions) - getLoadBalancerProfileOptionsModel.Name = core.StringPtr("testString") - getLoadBalancerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetLoadBalancerProfile(getLoadBalancerProfileOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetLoadBalancerProfile 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 GetLoadBalancerProfileOptions model - getLoadBalancerProfileOptionsModel := new(vpcv1.GetLoadBalancerProfileOptions) - getLoadBalancerProfileOptionsModel.Name = core.StringPtr("testString") - getLoadBalancerProfileOptionsModel.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.GetLoadBalancerProfile(getLoadBalancerProfileOptionsModel) - 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 GetLoadBalancerProfileOptions model with no property values - getLoadBalancerProfileOptionsModelNew := new(vpcv1.GetLoadBalancerProfileOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetLoadBalancerProfile(getLoadBalancerProfileOptionsModelNew) - 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 GetLoadBalancerProfile 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 GetLoadBalancerProfileOptions model - getLoadBalancerProfileOptionsModel := new(vpcv1.GetLoadBalancerProfileOptions) - getLoadBalancerProfileOptionsModel.Name = core.StringPtr("testString") - getLoadBalancerProfileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetLoadBalancerProfile(getLoadBalancerProfileOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) - Operation response error`, func() { - version := "testString" - listLoadBalancersPath := "/load_balancers" - 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(listLoadBalancersPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListLoadBalancers 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 ListLoadBalancersOptions model - listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) - listLoadBalancersOptionsModel.Start = core.StringPtr("testString") - listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listLoadBalancersOptionsModel.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.ListLoadBalancers(listLoadBalancersOptionsModel) - 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.ListLoadBalancers(listLoadBalancersOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions)`, func() { - version := "testString" - listLoadBalancersPath := "/load_balancers" - 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(listLoadBalancersPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/load_balancers?limit=20"}, "limit": 20, "load_balancers": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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}`) - })) - }) - It(`Invoke ListLoadBalancers 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 ListLoadBalancersOptions model - listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) - listLoadBalancersOptionsModel.Start = core.StringPtr("testString") - listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listLoadBalancersOptionsModel.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.ListLoadBalancersWithContext(ctx, listLoadBalancersOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListLoadBalancers(listLoadBalancersOptionsModel) - 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.ListLoadBalancersWithContext(ctx, listLoadBalancersOptionsModel) - 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(listLoadBalancersPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/load_balancers?limit=20"}, "limit": 20, "load_balancers": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "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}`) - })) - }) - It(`Invoke ListLoadBalancers 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.ListLoadBalancers(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListLoadBalancersOptions model - listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) - listLoadBalancersOptionsModel.Start = core.StringPtr("testString") - listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listLoadBalancersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListLoadBalancers(listLoadBalancersOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListLoadBalancers 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 ListLoadBalancersOptions model - listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) - listLoadBalancersOptionsModel.Start = core.StringPtr("testString") - listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listLoadBalancersOptionsModel.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.ListLoadBalancers(listLoadBalancersOptionsModel) - 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 ListLoadBalancers 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 ListLoadBalancersOptions model - listLoadBalancersOptionsModel := new(vpcv1.ListLoadBalancersOptions) - listLoadBalancersOptionsModel.Start = core.StringPtr("testString") - listLoadBalancersOptionsModel.Limit = core.Int64Ptr(int64(10)) - listLoadBalancersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListLoadBalancers(listLoadBalancersOptionsModel) - 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.LoadBalancerCollection) - nextObject := new(vpcv1.LoadBalancerCollectionNext) - 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.LoadBalancerCollection) - - 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.LoadBalancerCollection) - nextObject := new(vpcv1.LoadBalancerCollectionNext) - 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(listLoadBalancersPath)) - 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,"load_balancers":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727","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","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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"load_balancers":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727","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","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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"be5df5ca-12a0-494b-907e-aa6ec2bfa271","name":"my-security-group"}],"security_groups_supported":false,"subnets":[{"crn":"crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e","deleted":{"more_info":"https://cloud.ibm.com/apidocs/vpc#deleted-resources"},"href":"https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e","id":"7ec86020-1c6e-4889-b3f0-a15f2e50f87e","name":"my-subnet","resource_type":"subnet"}],"udp_supported":true}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use LoadBalancersPager.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()) - - listLoadBalancersOptionsModel := &vpcv1.ListLoadBalancersOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewLoadBalancersPager(listLoadBalancersOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.LoadBalancer - 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 LoadBalancersPager.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()) - - listLoadBalancersOptionsModel := &vpcv1.ListLoadBalancersOptions{ - Limit: core.Int64Ptr(int64(10)), - } - - pager, err := vpcService.NewLoadBalancersPager(listLoadBalancersOptionsModel) - 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(`CreateLoadBalancer(createLoadBalancerOptions *CreateLoadBalancerOptions) - Operation response error`, func() { - version := "testString" - createLoadBalancerPath := "/load_balancers" - 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(createLoadBalancerPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateLoadBalancer 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the LoadBalancerLoggingDatapathPrototype model - loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) - loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) - - // Construct an instance of the CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByName model - loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) - loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model - loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) - loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model - loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) - loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) - loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance = certificateInstanceIdentityModel - loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel - loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel - loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) - loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) - loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) - loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") - - // Construct an instance of the LoadBalancerLoggingPrototype model - loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) - loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel - - // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model - loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) - loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model - loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) - loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the LoadBalancerPoolPrototype model - loadBalancerPoolPrototypeModel := new(vpcv1.LoadBalancerPoolPrototype) - loadBalancerPoolPrototypeModel.Algorithm = core.StringPtr("least_connections") - loadBalancerPoolPrototypeModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel - loadBalancerPoolPrototypeModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - loadBalancerPoolPrototypeModel.Name = core.StringPtr("my-load-balancer-pool") - loadBalancerPoolPrototypeModel.Protocol = core.StringPtr("http") - loadBalancerPoolPrototypeModel.ProxyProtocol = core.StringPtr("disabled") - loadBalancerPoolPrototypeModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel - - // Construct an instance of the LoadBalancerProfileIdentityByName model - loadBalancerProfileIdentityModel := new(vpcv1.LoadBalancerProfileIdentityByName) - loadBalancerProfileIdentityModel.Name = core.StringPtr("network-fixed") - - // 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 CreateLoadBalancerOptions model - createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) - createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) - createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel - createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} - createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel - createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") - createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} - createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel - createLoadBalancerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createLoadBalancerOptionsModel.RouteMode = core.BoolPtr(true) - createLoadBalancerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createLoadBalancerOptionsModel.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.CreateLoadBalancer(createLoadBalancerOptionsModel) - 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.CreateLoadBalancer(createLoadBalancerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateLoadBalancer(createLoadBalancerOptions *CreateLoadBalancerOptions)`, func() { - version := "testString" - createLoadBalancerPath := "/load_balancers" - 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(createLoadBalancerPath)) - 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{"testString"})) - 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) - })) - }) - It(`Invoke CreateLoadBalancer 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the LoadBalancerLoggingDatapathPrototype model - loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) - loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) - - // Construct an instance of the CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByName model - loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) - loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model - loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) - loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model - loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) - loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) - loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance = certificateInstanceIdentityModel - loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel - loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel - loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) - loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) - loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) - loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") - - // Construct an instance of the LoadBalancerLoggingPrototype model - loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) - loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel - - // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model - loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) - loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model - loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) - loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the LoadBalancerPoolPrototype model - loadBalancerPoolPrototypeModel := new(vpcv1.LoadBalancerPoolPrototype) - loadBalancerPoolPrototypeModel.Algorithm = core.StringPtr("least_connections") - loadBalancerPoolPrototypeModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel - loadBalancerPoolPrototypeModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - loadBalancerPoolPrototypeModel.Name = core.StringPtr("my-load-balancer-pool") - loadBalancerPoolPrototypeModel.Protocol = core.StringPtr("http") - loadBalancerPoolPrototypeModel.ProxyProtocol = core.StringPtr("disabled") - loadBalancerPoolPrototypeModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel - - // Construct an instance of the LoadBalancerProfileIdentityByName model - loadBalancerProfileIdentityModel := new(vpcv1.LoadBalancerProfileIdentityByName) - loadBalancerProfileIdentityModel.Name = core.StringPtr("network-fixed") - - // 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 CreateLoadBalancerOptions model - createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) - createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) - createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel - createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} - createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel - createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") - createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} - createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel - createLoadBalancerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createLoadBalancerOptionsModel.RouteMode = core.BoolPtr(true) - createLoadBalancerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createLoadBalancerOptionsModel.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.CreateLoadBalancerWithContext(ctx, createLoadBalancerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateLoadBalancer(createLoadBalancerOptionsModel) - 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.CreateLoadBalancerWithContext(ctx, createLoadBalancerOptionsModel) - 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(createLoadBalancerPath)) - 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{"testString"})) - 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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) - })) - }) - It(`Invoke CreateLoadBalancer 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.CreateLoadBalancer(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 LoadBalancerLoggingDatapathPrototype model - loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) - loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) - - // Construct an instance of the CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByName model - loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) - loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model - loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) - loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model - loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) - loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) - loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance = certificateInstanceIdentityModel - loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel - loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel - loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) - loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) - loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) - loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") - - // Construct an instance of the LoadBalancerLoggingPrototype model - loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) - loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel - - // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model - loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) - loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model - loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) - loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the LoadBalancerPoolPrototype model - loadBalancerPoolPrototypeModel := new(vpcv1.LoadBalancerPoolPrototype) - loadBalancerPoolPrototypeModel.Algorithm = core.StringPtr("least_connections") - loadBalancerPoolPrototypeModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel - loadBalancerPoolPrototypeModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - loadBalancerPoolPrototypeModel.Name = core.StringPtr("my-load-balancer-pool") - loadBalancerPoolPrototypeModel.Protocol = core.StringPtr("http") - loadBalancerPoolPrototypeModel.ProxyProtocol = core.StringPtr("disabled") - loadBalancerPoolPrototypeModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel - - // Construct an instance of the LoadBalancerProfileIdentityByName model - loadBalancerProfileIdentityModel := new(vpcv1.LoadBalancerProfileIdentityByName) - loadBalancerProfileIdentityModel.Name = core.StringPtr("network-fixed") - - // 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 CreateLoadBalancerOptions model - createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) - createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) - createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel - createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} - createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel - createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") - createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} - createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel - createLoadBalancerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createLoadBalancerOptionsModel.RouteMode = core.BoolPtr(true) - createLoadBalancerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateLoadBalancer(createLoadBalancerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateLoadBalancer 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - - // Construct an instance of the LoadBalancerLoggingDatapathPrototype model - loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) - loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) - - // Construct an instance of the CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByName model - loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) - loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model - loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) - loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model - loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) - loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) - loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance = certificateInstanceIdentityModel - loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel - loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel - loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) - loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) - loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) - loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") - - // Construct an instance of the LoadBalancerLoggingPrototype model - loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) - loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel - - // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model - loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) - loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model - loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) - loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the LoadBalancerPoolPrototype model - loadBalancerPoolPrototypeModel := new(vpcv1.LoadBalancerPoolPrototype) - loadBalancerPoolPrototypeModel.Algorithm = core.StringPtr("least_connections") - loadBalancerPoolPrototypeModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel - loadBalancerPoolPrototypeModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - loadBalancerPoolPrototypeModel.Name = core.StringPtr("my-load-balancer-pool") - loadBalancerPoolPrototypeModel.Protocol = core.StringPtr("http") - loadBalancerPoolPrototypeModel.ProxyProtocol = core.StringPtr("disabled") - loadBalancerPoolPrototypeModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel - - // Construct an instance of the LoadBalancerProfileIdentityByName model - loadBalancerProfileIdentityModel := new(vpcv1.LoadBalancerProfileIdentityByName) - loadBalancerProfileIdentityModel.Name = core.StringPtr("network-fixed") - - // 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 CreateLoadBalancerOptions model - createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) - createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) - createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel - createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} - createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel - createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") - createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} - createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel - createLoadBalancerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createLoadBalancerOptionsModel.RouteMode = core.BoolPtr(true) - createLoadBalancerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createLoadBalancerOptionsModel.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.CreateLoadBalancer(createLoadBalancerOptionsModel) - 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 CreateLoadBalancerOptions model with no property values - createLoadBalancerOptionsModelNew := new(vpcv1.CreateLoadBalancerOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateLoadBalancer(createLoadBalancerOptionsModelNew) - 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 CreateLoadBalancer 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") - - // Construct an instance of the LoadBalancerLoggingDatapathPrototype model - loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) - loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) - - // Construct an instance of the CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByName model - loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) - loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model - loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) - loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model - loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) - loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) - loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance = certificateInstanceIdentityModel - loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel - loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel - loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) - loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) - loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) - loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") - - // Construct an instance of the LoadBalancerLoggingPrototype model - loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) - loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel - - // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model - loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) - loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model - loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) - loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the LoadBalancerPoolPrototype model - loadBalancerPoolPrototypeModel := new(vpcv1.LoadBalancerPoolPrototype) - loadBalancerPoolPrototypeModel.Algorithm = core.StringPtr("least_connections") - loadBalancerPoolPrototypeModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel - loadBalancerPoolPrototypeModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - loadBalancerPoolPrototypeModel.Name = core.StringPtr("my-load-balancer-pool") - loadBalancerPoolPrototypeModel.Protocol = core.StringPtr("http") - loadBalancerPoolPrototypeModel.ProxyProtocol = core.StringPtr("disabled") - loadBalancerPoolPrototypeModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel - - // Construct an instance of the LoadBalancerProfileIdentityByName model - loadBalancerProfileIdentityModel := new(vpcv1.LoadBalancerProfileIdentityByName) - loadBalancerProfileIdentityModel.Name = core.StringPtr("network-fixed") - - // 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 CreateLoadBalancerOptions model - createLoadBalancerOptionsModel := new(vpcv1.CreateLoadBalancerOptions) - createLoadBalancerOptionsModel.IsPublic = core.BoolPtr(true) - createLoadBalancerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - createLoadBalancerOptionsModel.Datapath = loadBalancerLoggingDatapathPrototypeModel - createLoadBalancerOptionsModel.Listeners = []vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel} - createLoadBalancerOptionsModel.Logging = loadBalancerLoggingPrototypeModel - createLoadBalancerOptionsModel.Name = core.StringPtr("my-load-balancer") - createLoadBalancerOptionsModel.Pools = []vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel} - createLoadBalancerOptionsModel.Profile = loadBalancerProfileIdentityModel - createLoadBalancerOptionsModel.ResourceGroup = resourceGroupIdentityModel - createLoadBalancerOptionsModel.RouteMode = core.BoolPtr(true) - createLoadBalancerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateLoadBalancer(createLoadBalancerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions)`, func() { - version := "testString" - deleteLoadBalancerPath := "/load_balancers/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(deleteLoadBalancerPath)) - 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{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteLoadBalancer 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.DeleteLoadBalancer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteLoadBalancerOptions model - deleteLoadBalancerOptionsModel := new(vpcv1.DeleteLoadBalancerOptions) - deleteLoadBalancerOptionsModel.ID = core.StringPtr("testString") - deleteLoadBalancerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteLoadBalancer(deleteLoadBalancerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteLoadBalancer 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 DeleteLoadBalancerOptions model - deleteLoadBalancerOptionsModel := new(vpcv1.DeleteLoadBalancerOptions) - deleteLoadBalancerOptionsModel.ID = core.StringPtr("testString") - deleteLoadBalancerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteLoadBalancerOptionsModel.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.DeleteLoadBalancer(deleteLoadBalancerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteLoadBalancerOptions model with no property values - deleteLoadBalancerOptionsModelNew := new(vpcv1.DeleteLoadBalancerOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteLoadBalancer(deleteLoadBalancerOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancer(getLoadBalancerOptions *GetLoadBalancerOptions) - Operation response error`, func() { - version := "testString" - getLoadBalancerPath := "/load_balancers/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(getLoadBalancerPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetLoadBalancer 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 GetLoadBalancerOptions model - getLoadBalancerOptionsModel := new(vpcv1.GetLoadBalancerOptions) - getLoadBalancerOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerOptionsModel.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.GetLoadBalancer(getLoadBalancerOptionsModel) - 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.GetLoadBalancer(getLoadBalancerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancer(getLoadBalancerOptions *GetLoadBalancerOptions)`, func() { - version := "testString" - getLoadBalancerPath := "/load_balancers/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(getLoadBalancerPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) - })) - }) - It(`Invoke GetLoadBalancer 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 GetLoadBalancerOptions model - getLoadBalancerOptionsModel := new(vpcv1.GetLoadBalancerOptions) - getLoadBalancerOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerOptionsModel.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.GetLoadBalancerWithContext(ctx, getLoadBalancerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetLoadBalancer(getLoadBalancerOptionsModel) - 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.GetLoadBalancerWithContext(ctx, getLoadBalancerOptionsModel) - 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(getLoadBalancerPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) - })) - }) - It(`Invoke GetLoadBalancer 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.GetLoadBalancer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetLoadBalancerOptions model - getLoadBalancerOptionsModel := new(vpcv1.GetLoadBalancerOptions) - getLoadBalancerOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetLoadBalancer(getLoadBalancerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetLoadBalancer 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 GetLoadBalancerOptions model - getLoadBalancerOptionsModel := new(vpcv1.GetLoadBalancerOptions) - getLoadBalancerOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerOptionsModel.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.GetLoadBalancer(getLoadBalancerOptionsModel) - 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 GetLoadBalancerOptions model with no property values - getLoadBalancerOptionsModelNew := new(vpcv1.GetLoadBalancerOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetLoadBalancer(getLoadBalancerOptionsModelNew) - 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 GetLoadBalancer 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 GetLoadBalancerOptions model - getLoadBalancerOptionsModel := new(vpcv1.GetLoadBalancerOptions) - getLoadBalancerOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetLoadBalancer(getLoadBalancerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateLoadBalancer(updateLoadBalancerOptions *UpdateLoadBalancerOptions) - Operation response error`, func() { - version := "testString" - updateLoadBalancerPath := "/load_balancers/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(updateLoadBalancerPath)) - 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{"testString"})) - 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 UpdateLoadBalancer 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 LoadBalancerLoggingDatapathPatch model - loadBalancerLoggingDatapathPatchModel := new(vpcv1.LoadBalancerLoggingDatapathPatch) - loadBalancerLoggingDatapathPatchModel.Active = core.BoolPtr(true) - - // Construct an instance of the LoadBalancerLoggingPatch model - loadBalancerLoggingPatchModel := new(vpcv1.LoadBalancerLoggingPatch) - loadBalancerLoggingPatchModel.Datapath = loadBalancerLoggingDatapathPatchModel - - // 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 LoadBalancerPatch model - loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) - loadBalancerPatchModel.Logging = loadBalancerLoggingPatchModel - loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") - loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerOptions model - updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) - updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch - updateLoadBalancerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateLoadBalancerOptionsModel.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.UpdateLoadBalancer(updateLoadBalancerOptionsModel) - 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.UpdateLoadBalancer(updateLoadBalancerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateLoadBalancer(updateLoadBalancerOptions *UpdateLoadBalancerOptions)`, func() { - version := "testString" - updateLoadBalancerPath := "/load_balancers/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(updateLoadBalancerPath)) - 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{"testString"})) - 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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) - })) - }) - It(`Invoke UpdateLoadBalancer 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 LoadBalancerLoggingDatapathPatch model - loadBalancerLoggingDatapathPatchModel := new(vpcv1.LoadBalancerLoggingDatapathPatch) - loadBalancerLoggingDatapathPatchModel.Active = core.BoolPtr(true) - - // Construct an instance of the LoadBalancerLoggingPatch model - loadBalancerLoggingPatchModel := new(vpcv1.LoadBalancerLoggingPatch) - loadBalancerLoggingPatchModel.Datapath = loadBalancerLoggingDatapathPatchModel - - // 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 LoadBalancerPatch model - loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) - loadBalancerPatchModel.Logging = loadBalancerLoggingPatchModel - loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") - loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerOptions model - updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) - updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch - updateLoadBalancerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateLoadBalancerOptionsModel.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.UpdateLoadBalancerWithContext(ctx, updateLoadBalancerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateLoadBalancer(updateLoadBalancerOptionsModel) - 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.UpdateLoadBalancerWithContext(ctx, updateLoadBalancerOptionsModel) - 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(updateLoadBalancerPath)) - 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{"testString"})) - 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/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727", "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", "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "security_groups_supported": false, "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "udp_supported": true}`) - })) - }) - It(`Invoke UpdateLoadBalancer 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.UpdateLoadBalancer(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the LoadBalancerLoggingDatapathPatch model - loadBalancerLoggingDatapathPatchModel := new(vpcv1.LoadBalancerLoggingDatapathPatch) - loadBalancerLoggingDatapathPatchModel.Active = core.BoolPtr(true) - - // Construct an instance of the LoadBalancerLoggingPatch model - loadBalancerLoggingPatchModel := new(vpcv1.LoadBalancerLoggingPatch) - loadBalancerLoggingPatchModel.Datapath = loadBalancerLoggingDatapathPatchModel - - // 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 LoadBalancerPatch model - loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) - loadBalancerPatchModel.Logging = loadBalancerLoggingPatchModel - loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") - loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerOptions model - updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) - updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch - updateLoadBalancerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateLoadBalancer(updateLoadBalancerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateLoadBalancer 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 LoadBalancerLoggingDatapathPatch model - loadBalancerLoggingDatapathPatchModel := new(vpcv1.LoadBalancerLoggingDatapathPatch) - loadBalancerLoggingDatapathPatchModel.Active = core.BoolPtr(true) - - // Construct an instance of the LoadBalancerLoggingPatch model - loadBalancerLoggingPatchModel := new(vpcv1.LoadBalancerLoggingPatch) - loadBalancerLoggingPatchModel.Datapath = loadBalancerLoggingDatapathPatchModel - - // 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 LoadBalancerPatch model - loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) - loadBalancerPatchModel.Logging = loadBalancerLoggingPatchModel - loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") - loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerOptions model - updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) - updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch - updateLoadBalancerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateLoadBalancerOptionsModel.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.UpdateLoadBalancer(updateLoadBalancerOptionsModel) - 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 UpdateLoadBalancerOptions model with no property values - updateLoadBalancerOptionsModelNew := new(vpcv1.UpdateLoadBalancerOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateLoadBalancer(updateLoadBalancerOptionsModelNew) - 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 UpdateLoadBalancer 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 LoadBalancerLoggingDatapathPatch model - loadBalancerLoggingDatapathPatchModel := new(vpcv1.LoadBalancerLoggingDatapathPatch) - loadBalancerLoggingDatapathPatchModel.Active = core.BoolPtr(true) - - // Construct an instance of the LoadBalancerLoggingPatch model - loadBalancerLoggingPatchModel := new(vpcv1.LoadBalancerLoggingPatch) - loadBalancerLoggingPatchModel.Datapath = loadBalancerLoggingDatapathPatchModel - - // 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 LoadBalancerPatch model - loadBalancerPatchModel := new(vpcv1.LoadBalancerPatch) - loadBalancerPatchModel.Logging = loadBalancerLoggingPatchModel - loadBalancerPatchModel.Name = core.StringPtr("my-load-balancer") - loadBalancerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} - loadBalancerPatchModelAsPatch, asPatchErr := loadBalancerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerOptions model - updateLoadBalancerOptionsModel := new(vpcv1.UpdateLoadBalancerOptions) - updateLoadBalancerOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerOptionsModel.LoadBalancerPatch = loadBalancerPatchModelAsPatch - updateLoadBalancerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateLoadBalancerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateLoadBalancer(updateLoadBalancerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancerStatistics(getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) - Operation response error`, func() { - version := "testString" - getLoadBalancerStatisticsPath := "/load_balancers/testString/statistics" - 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(getLoadBalancerStatisticsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetLoadBalancerStatistics 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 GetLoadBalancerStatisticsOptions model - getLoadBalancerStatisticsOptionsModel := new(vpcv1.GetLoadBalancerStatisticsOptions) - getLoadBalancerStatisticsOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerStatisticsOptionsModel.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.GetLoadBalancerStatistics(getLoadBalancerStatisticsOptionsModel) - 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.GetLoadBalancerStatistics(getLoadBalancerStatisticsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancerStatistics(getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions)`, func() { - version := "testString" - getLoadBalancerStatisticsPath := "/load_balancers/testString/statistics" - 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(getLoadBalancerStatisticsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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_connections": 797, "connection_rate": 91.121, "data_processed_this_month": 10093173145, "throughput": 167.278}`) - })) - }) - It(`Invoke GetLoadBalancerStatistics 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 GetLoadBalancerStatisticsOptions model - getLoadBalancerStatisticsOptionsModel := new(vpcv1.GetLoadBalancerStatisticsOptions) - getLoadBalancerStatisticsOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerStatisticsOptionsModel.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.GetLoadBalancerStatisticsWithContext(ctx, getLoadBalancerStatisticsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetLoadBalancerStatistics(getLoadBalancerStatisticsOptionsModel) - 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.GetLoadBalancerStatisticsWithContext(ctx, getLoadBalancerStatisticsOptionsModel) - 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(getLoadBalancerStatisticsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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_connections": 797, "connection_rate": 91.121, "data_processed_this_month": 10093173145, "throughput": 167.278}`) - })) - }) - It(`Invoke GetLoadBalancerStatistics 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.GetLoadBalancerStatistics(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetLoadBalancerStatisticsOptions model - getLoadBalancerStatisticsOptionsModel := new(vpcv1.GetLoadBalancerStatisticsOptions) - getLoadBalancerStatisticsOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerStatisticsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetLoadBalancerStatistics(getLoadBalancerStatisticsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetLoadBalancerStatistics 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 GetLoadBalancerStatisticsOptions model - getLoadBalancerStatisticsOptionsModel := new(vpcv1.GetLoadBalancerStatisticsOptions) - getLoadBalancerStatisticsOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerStatisticsOptionsModel.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.GetLoadBalancerStatistics(getLoadBalancerStatisticsOptionsModel) - 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 GetLoadBalancerStatisticsOptions model with no property values - getLoadBalancerStatisticsOptionsModelNew := new(vpcv1.GetLoadBalancerStatisticsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetLoadBalancerStatistics(getLoadBalancerStatisticsOptionsModelNew) - 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 GetLoadBalancerStatistics 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 GetLoadBalancerStatisticsOptions model - getLoadBalancerStatisticsOptionsModel := new(vpcv1.GetLoadBalancerStatisticsOptions) - getLoadBalancerStatisticsOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerStatisticsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetLoadBalancerStatistics(getLoadBalancerStatisticsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) - Operation response error`, func() { - version := "testString" - listLoadBalancerListenersPath := "/load_balancers/testString/listeners" - 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(listLoadBalancerListenersPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListLoadBalancerListeners 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 ListLoadBalancerListenersOptions model - listLoadBalancerListenersOptionsModel := new(vpcv1.ListLoadBalancerListenersOptions) - listLoadBalancerListenersOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenersOptionsModel.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.ListLoadBalancerListeners(listLoadBalancerListenersOptionsModel) - 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.ListLoadBalancerListeners(listLoadBalancerListenersOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions)`, func() { - version := "testString" - listLoadBalancerListenersPath := "/load_balancers/testString/listeners" - 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(listLoadBalancerListenersPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}`) - })) - }) - It(`Invoke ListLoadBalancerListeners 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 ListLoadBalancerListenersOptions model - listLoadBalancerListenersOptionsModel := new(vpcv1.ListLoadBalancerListenersOptions) - listLoadBalancerListenersOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenersOptionsModel.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.ListLoadBalancerListenersWithContext(ctx, listLoadBalancerListenersOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListLoadBalancerListeners(listLoadBalancerListenersOptionsModel) - 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.ListLoadBalancerListenersWithContext(ctx, listLoadBalancerListenersOptionsModel) - 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(listLoadBalancerListenersPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"listeners": [{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}]}`) - })) - }) - It(`Invoke ListLoadBalancerListeners 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.ListLoadBalancerListeners(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListLoadBalancerListenersOptions model - listLoadBalancerListenersOptionsModel := new(vpcv1.ListLoadBalancerListenersOptions) - listLoadBalancerListenersOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListLoadBalancerListeners(listLoadBalancerListenersOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListLoadBalancerListeners 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 ListLoadBalancerListenersOptions model - listLoadBalancerListenersOptionsModel := new(vpcv1.ListLoadBalancerListenersOptions) - listLoadBalancerListenersOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenersOptionsModel.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.ListLoadBalancerListeners(listLoadBalancerListenersOptionsModel) - 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 ListLoadBalancerListenersOptions model with no property values - listLoadBalancerListenersOptionsModelNew := new(vpcv1.ListLoadBalancerListenersOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListLoadBalancerListeners(listLoadBalancerListenersOptionsModelNew) - 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 ListLoadBalancerListeners 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 ListLoadBalancerListenersOptions model - listLoadBalancerListenersOptionsModel := new(vpcv1.ListLoadBalancerListenersOptions) - listLoadBalancerListenersOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListLoadBalancerListeners(listLoadBalancerListenersOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateLoadBalancerListener(createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) - Operation response error`, func() { - version := "testString" - createLoadBalancerListenerPath := "/load_balancers/testString/listeners" - 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(createLoadBalancerListenerPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model - loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) - loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model - loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) - loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") - - // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerPolicyPrototype model - loadBalancerListenerPolicyPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyPrototype) - loadBalancerListenerPolicyPrototypeModel.Action = core.StringPtr("forward") - loadBalancerListenerPolicyPrototypeModel.Name = core.StringPtr("my-policy") - loadBalancerListenerPolicyPrototypeModel.Priority = core.Int64Ptr(int64(5)) - loadBalancerListenerPolicyPrototypeModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} - loadBalancerListenerPolicyPrototypeModel.Target = loadBalancerListenerPolicyTargetPrototypeModel - - // Construct an instance of the CreateLoadBalancerListenerOptions model - createLoadBalancerListenerOptionsModel := new(vpcv1.CreateLoadBalancerListenerOptions) - createLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerOptionsModel.Protocol = core.StringPtr("http") - createLoadBalancerListenerOptionsModel.AcceptProxyProtocol = core.BoolPtr(true) - createLoadBalancerListenerOptionsModel.CertificateInstance = certificateInstanceIdentityModel - createLoadBalancerListenerOptionsModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - createLoadBalancerListenerOptionsModel.DefaultPool = loadBalancerPoolIdentityModel - createLoadBalancerListenerOptionsModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel - createLoadBalancerListenerOptionsModel.Policies = []vpcv1.LoadBalancerListenerPolicyPrototype{*loadBalancerListenerPolicyPrototypeModel} - createLoadBalancerListenerOptionsModel.Port = core.Int64Ptr(int64(443)) - createLoadBalancerListenerOptionsModel.PortMax = core.Int64Ptr(int64(499)) - createLoadBalancerListenerOptionsModel.PortMin = core.Int64Ptr(int64(443)) - createLoadBalancerListenerOptionsModel.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.CreateLoadBalancerListener(createLoadBalancerListenerOptionsModel) - 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.CreateLoadBalancerListener(createLoadBalancerListenerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateLoadBalancerListener(createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions)`, func() { - version := "testString" - createLoadBalancerListenerPath := "/load_balancers/testString/listeners" - 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(createLoadBalancerListenerPath)) - 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{"testString"})) - 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", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) - })) - }) - It(`Invoke CreateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model - loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) - loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model - loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) - loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") - - // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerPolicyPrototype model - loadBalancerListenerPolicyPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyPrototype) - loadBalancerListenerPolicyPrototypeModel.Action = core.StringPtr("forward") - loadBalancerListenerPolicyPrototypeModel.Name = core.StringPtr("my-policy") - loadBalancerListenerPolicyPrototypeModel.Priority = core.Int64Ptr(int64(5)) - loadBalancerListenerPolicyPrototypeModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} - loadBalancerListenerPolicyPrototypeModel.Target = loadBalancerListenerPolicyTargetPrototypeModel - - // Construct an instance of the CreateLoadBalancerListenerOptions model - createLoadBalancerListenerOptionsModel := new(vpcv1.CreateLoadBalancerListenerOptions) - createLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerOptionsModel.Protocol = core.StringPtr("http") - createLoadBalancerListenerOptionsModel.AcceptProxyProtocol = core.BoolPtr(true) - createLoadBalancerListenerOptionsModel.CertificateInstance = certificateInstanceIdentityModel - createLoadBalancerListenerOptionsModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - createLoadBalancerListenerOptionsModel.DefaultPool = loadBalancerPoolIdentityModel - createLoadBalancerListenerOptionsModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel - createLoadBalancerListenerOptionsModel.Policies = []vpcv1.LoadBalancerListenerPolicyPrototype{*loadBalancerListenerPolicyPrototypeModel} - createLoadBalancerListenerOptionsModel.Port = core.Int64Ptr(int64(443)) - createLoadBalancerListenerOptionsModel.PortMax = core.Int64Ptr(int64(499)) - createLoadBalancerListenerOptionsModel.PortMin = core.Int64Ptr(int64(443)) - createLoadBalancerListenerOptionsModel.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.CreateLoadBalancerListenerWithContext(ctx, createLoadBalancerListenerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateLoadBalancerListener(createLoadBalancerListenerOptionsModel) - 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.CreateLoadBalancerListenerWithContext(ctx, createLoadBalancerListenerOptionsModel) - 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(createLoadBalancerListenerPath)) - 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{"testString"})) - 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", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) - })) - }) - It(`Invoke CreateLoadBalancerListener 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.CreateLoadBalancerListener(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model - loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) - loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model - loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) - loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") - - // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerPolicyPrototype model - loadBalancerListenerPolicyPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyPrototype) - loadBalancerListenerPolicyPrototypeModel.Action = core.StringPtr("forward") - loadBalancerListenerPolicyPrototypeModel.Name = core.StringPtr("my-policy") - loadBalancerListenerPolicyPrototypeModel.Priority = core.Int64Ptr(int64(5)) - loadBalancerListenerPolicyPrototypeModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} - loadBalancerListenerPolicyPrototypeModel.Target = loadBalancerListenerPolicyTargetPrototypeModel - - // Construct an instance of the CreateLoadBalancerListenerOptions model - createLoadBalancerListenerOptionsModel := new(vpcv1.CreateLoadBalancerListenerOptions) - createLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerOptionsModel.Protocol = core.StringPtr("http") - createLoadBalancerListenerOptionsModel.AcceptProxyProtocol = core.BoolPtr(true) - createLoadBalancerListenerOptionsModel.CertificateInstance = certificateInstanceIdentityModel - createLoadBalancerListenerOptionsModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - createLoadBalancerListenerOptionsModel.DefaultPool = loadBalancerPoolIdentityModel - createLoadBalancerListenerOptionsModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel - createLoadBalancerListenerOptionsModel.Policies = []vpcv1.LoadBalancerListenerPolicyPrototype{*loadBalancerListenerPolicyPrototypeModel} - createLoadBalancerListenerOptionsModel.Port = core.Int64Ptr(int64(443)) - createLoadBalancerListenerOptionsModel.PortMax = core.Int64Ptr(int64(499)) - createLoadBalancerListenerOptionsModel.PortMin = core.Int64Ptr(int64(443)) - createLoadBalancerListenerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateLoadBalancerListener(createLoadBalancerListenerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model - loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) - loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model - loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) - loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") - - // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerPolicyPrototype model - loadBalancerListenerPolicyPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyPrototype) - loadBalancerListenerPolicyPrototypeModel.Action = core.StringPtr("forward") - loadBalancerListenerPolicyPrototypeModel.Name = core.StringPtr("my-policy") - loadBalancerListenerPolicyPrototypeModel.Priority = core.Int64Ptr(int64(5)) - loadBalancerListenerPolicyPrototypeModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} - loadBalancerListenerPolicyPrototypeModel.Target = loadBalancerListenerPolicyTargetPrototypeModel - - // Construct an instance of the CreateLoadBalancerListenerOptions model - createLoadBalancerListenerOptionsModel := new(vpcv1.CreateLoadBalancerListenerOptions) - createLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerOptionsModel.Protocol = core.StringPtr("http") - createLoadBalancerListenerOptionsModel.AcceptProxyProtocol = core.BoolPtr(true) - createLoadBalancerListenerOptionsModel.CertificateInstance = certificateInstanceIdentityModel - createLoadBalancerListenerOptionsModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - createLoadBalancerListenerOptionsModel.DefaultPool = loadBalancerPoolIdentityModel - createLoadBalancerListenerOptionsModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel - createLoadBalancerListenerOptionsModel.Policies = []vpcv1.LoadBalancerListenerPolicyPrototype{*loadBalancerListenerPolicyPrototypeModel} - createLoadBalancerListenerOptionsModel.Port = core.Int64Ptr(int64(443)) - createLoadBalancerListenerOptionsModel.PortMax = core.Int64Ptr(int64(499)) - createLoadBalancerListenerOptionsModel.PortMin = core.Int64Ptr(int64(443)) - createLoadBalancerListenerOptionsModel.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.CreateLoadBalancerListener(createLoadBalancerListenerOptionsModel) - 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 CreateLoadBalancerListenerOptions model with no property values - createLoadBalancerListenerOptionsModelNew := new(vpcv1.CreateLoadBalancerListenerOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateLoadBalancerListener(createLoadBalancerListenerOptionsModelNew) - 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 CreateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model - loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) - loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model - loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) - loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") - - // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerPolicyPrototype model - loadBalancerListenerPolicyPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyPrototype) - loadBalancerListenerPolicyPrototypeModel.Action = core.StringPtr("forward") - loadBalancerListenerPolicyPrototypeModel.Name = core.StringPtr("my-policy") - loadBalancerListenerPolicyPrototypeModel.Priority = core.Int64Ptr(int64(5)) - loadBalancerListenerPolicyPrototypeModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} - loadBalancerListenerPolicyPrototypeModel.Target = loadBalancerListenerPolicyTargetPrototypeModel - - // Construct an instance of the CreateLoadBalancerListenerOptions model - createLoadBalancerListenerOptionsModel := new(vpcv1.CreateLoadBalancerListenerOptions) - createLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerOptionsModel.Protocol = core.StringPtr("http") - createLoadBalancerListenerOptionsModel.AcceptProxyProtocol = core.BoolPtr(true) - createLoadBalancerListenerOptionsModel.CertificateInstance = certificateInstanceIdentityModel - createLoadBalancerListenerOptionsModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - createLoadBalancerListenerOptionsModel.DefaultPool = loadBalancerPoolIdentityModel - createLoadBalancerListenerOptionsModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel - createLoadBalancerListenerOptionsModel.Policies = []vpcv1.LoadBalancerListenerPolicyPrototype{*loadBalancerListenerPolicyPrototypeModel} - createLoadBalancerListenerOptionsModel.Port = core.Int64Ptr(int64(443)) - createLoadBalancerListenerOptionsModel.PortMax = core.Int64Ptr(int64(499)) - createLoadBalancerListenerOptionsModel.PortMin = core.Int64Ptr(int64(443)) - createLoadBalancerListenerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateLoadBalancerListener(createLoadBalancerListenerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteLoadBalancerListener(deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions)`, func() { - version := "testString" - deleteLoadBalancerListenerPath := "/load_balancers/testString/listeners/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(deleteLoadBalancerListenerPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteLoadBalancerListener 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.DeleteLoadBalancerListener(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteLoadBalancerListenerOptions model - deleteLoadBalancerListenerOptionsModel := new(vpcv1.DeleteLoadBalancerListenerOptions) - deleteLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - deleteLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") - deleteLoadBalancerListenerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteLoadBalancerListener(deleteLoadBalancerListenerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteLoadBalancerListener 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 DeleteLoadBalancerListenerOptions model - deleteLoadBalancerListenerOptionsModel := new(vpcv1.DeleteLoadBalancerListenerOptions) - deleteLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - deleteLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") - deleteLoadBalancerListenerOptionsModel.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.DeleteLoadBalancerListener(deleteLoadBalancerListenerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteLoadBalancerListenerOptions model with no property values - deleteLoadBalancerListenerOptionsModelNew := new(vpcv1.DeleteLoadBalancerListenerOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteLoadBalancerListener(deleteLoadBalancerListenerOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancerListener(getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) - Operation response error`, func() { - version := "testString" - getLoadBalancerListenerPath := "/load_balancers/testString/listeners/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(getLoadBalancerListenerPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetLoadBalancerListener 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 GetLoadBalancerListenerOptions model - getLoadBalancerListenerOptionsModel := new(vpcv1.GetLoadBalancerListenerOptions) - getLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerOptionsModel.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.GetLoadBalancerListener(getLoadBalancerListenerOptionsModel) - 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.GetLoadBalancerListener(getLoadBalancerListenerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancerListener(getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions)`, func() { - version := "testString" - getLoadBalancerListenerPath := "/load_balancers/testString/listeners/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(getLoadBalancerListenerPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) - })) - }) - It(`Invoke GetLoadBalancerListener 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 GetLoadBalancerListenerOptions model - getLoadBalancerListenerOptionsModel := new(vpcv1.GetLoadBalancerListenerOptions) - getLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerOptionsModel.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.GetLoadBalancerListenerWithContext(ctx, getLoadBalancerListenerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetLoadBalancerListener(getLoadBalancerListenerOptionsModel) - 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.GetLoadBalancerListenerWithContext(ctx, getLoadBalancerListenerOptionsModel) - 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(getLoadBalancerListenerPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) - })) - }) - It(`Invoke GetLoadBalancerListener 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.GetLoadBalancerListener(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetLoadBalancerListenerOptions model - getLoadBalancerListenerOptionsModel := new(vpcv1.GetLoadBalancerListenerOptions) - getLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetLoadBalancerListener(getLoadBalancerListenerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetLoadBalancerListener 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 GetLoadBalancerListenerOptions model - getLoadBalancerListenerOptionsModel := new(vpcv1.GetLoadBalancerListenerOptions) - getLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerOptionsModel.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.GetLoadBalancerListener(getLoadBalancerListenerOptionsModel) - 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 GetLoadBalancerListenerOptions model with no property values - getLoadBalancerListenerOptionsModelNew := new(vpcv1.GetLoadBalancerListenerOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetLoadBalancerListener(getLoadBalancerListenerOptionsModelNew) - 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 GetLoadBalancerListener 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 GetLoadBalancerListenerOptions model - getLoadBalancerListenerOptionsModel := new(vpcv1.GetLoadBalancerListenerOptions) - getLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetLoadBalancerListener(getLoadBalancerListenerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateLoadBalancerListener(updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) - Operation response error`, func() { - version := "testString" - updateLoadBalancerListenerPath := "/load_balancers/testString/listeners/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(updateLoadBalancerListenerPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPatch model - loadBalancerListenerHTTPSRedirectPatchModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPatch) - loadBalancerListenerHTTPSRedirectPatchModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPatchModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPatchModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPatch model - loadBalancerListenerPatchModel := new(vpcv1.LoadBalancerListenerPatch) - loadBalancerListenerPatchModel.AcceptProxyProtocol = core.BoolPtr(true) - loadBalancerListenerPatchModel.CertificateInstance = certificateInstanceIdentityModel - loadBalancerListenerPatchModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - loadBalancerListenerPatchModel.DefaultPool = loadBalancerPoolIdentityModel - loadBalancerListenerPatchModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPatchModel - loadBalancerListenerPatchModel.Port = core.Int64Ptr(int64(443)) - loadBalancerListenerPatchModel.PortMax = core.Int64Ptr(int64(499)) - loadBalancerListenerPatchModel.PortMin = core.Int64Ptr(int64(443)) - loadBalancerListenerPatchModel.Protocol = core.StringPtr("http") - loadBalancerListenerPatchModelAsPatch, asPatchErr := loadBalancerListenerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerOptions model - updateLoadBalancerListenerOptionsModel := new(vpcv1.UpdateLoadBalancerListenerOptions) - updateLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerOptionsModel.LoadBalancerListenerPatch = loadBalancerListenerPatchModelAsPatch - updateLoadBalancerListenerOptionsModel.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.UpdateLoadBalancerListener(updateLoadBalancerListenerOptionsModel) - 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.UpdateLoadBalancerListener(updateLoadBalancerListenerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateLoadBalancerListener(updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions)`, func() { - version := "testString" - updateLoadBalancerListenerPath := "/load_balancers/testString/listeners/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(updateLoadBalancerListenerPath)) - 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{"testString"})) - 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", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) - })) - }) - It(`Invoke UpdateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPatch model - loadBalancerListenerHTTPSRedirectPatchModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPatch) - loadBalancerListenerHTTPSRedirectPatchModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPatchModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPatchModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPatch model - loadBalancerListenerPatchModel := new(vpcv1.LoadBalancerListenerPatch) - loadBalancerListenerPatchModel.AcceptProxyProtocol = core.BoolPtr(true) - loadBalancerListenerPatchModel.CertificateInstance = certificateInstanceIdentityModel - loadBalancerListenerPatchModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - loadBalancerListenerPatchModel.DefaultPool = loadBalancerPoolIdentityModel - loadBalancerListenerPatchModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPatchModel - loadBalancerListenerPatchModel.Port = core.Int64Ptr(int64(443)) - loadBalancerListenerPatchModel.PortMax = core.Int64Ptr(int64(499)) - loadBalancerListenerPatchModel.PortMin = core.Int64Ptr(int64(443)) - loadBalancerListenerPatchModel.Protocol = core.StringPtr("http") - loadBalancerListenerPatchModelAsPatch, asPatchErr := loadBalancerListenerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerOptions model - updateLoadBalancerListenerOptionsModel := new(vpcv1.UpdateLoadBalancerListenerOptions) - updateLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerOptionsModel.LoadBalancerListenerPatch = loadBalancerListenerPatchModelAsPatch - updateLoadBalancerListenerOptionsModel.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.UpdateLoadBalancerListenerWithContext(ctx, updateLoadBalancerListenerOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateLoadBalancerListener(updateLoadBalancerListenerOptionsModel) - 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.UpdateLoadBalancerListenerWithContext(ctx, updateLoadBalancerListenerOptionsModel) - 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(updateLoadBalancerListenerPath)) - 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{"testString"})) - 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", `{"accept_proxy_protocol": true, "certificate_instance": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "connection_limit": 2000, "created_at": "2019-01-01T12:00:00.000Z", "default_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"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004", "https_redirect": {"http_status_code": 301, "listener": {"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"}, "uri": "/example?doc=get"}, "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "policies": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "anyValue"}], "port": 443, "port_max": 499, "port_min": 443, "protocol": "http", "provisioning_status": "active"}`) - })) - }) - It(`Invoke UpdateLoadBalancerListener 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.UpdateLoadBalancerListener(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPatch model - loadBalancerListenerHTTPSRedirectPatchModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPatch) - loadBalancerListenerHTTPSRedirectPatchModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPatchModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPatchModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPatch model - loadBalancerListenerPatchModel := new(vpcv1.LoadBalancerListenerPatch) - loadBalancerListenerPatchModel.AcceptProxyProtocol = core.BoolPtr(true) - loadBalancerListenerPatchModel.CertificateInstance = certificateInstanceIdentityModel - loadBalancerListenerPatchModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - loadBalancerListenerPatchModel.DefaultPool = loadBalancerPoolIdentityModel - loadBalancerListenerPatchModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPatchModel - loadBalancerListenerPatchModel.Port = core.Int64Ptr(int64(443)) - loadBalancerListenerPatchModel.PortMax = core.Int64Ptr(int64(499)) - loadBalancerListenerPatchModel.PortMin = core.Int64Ptr(int64(443)) - loadBalancerListenerPatchModel.Protocol = core.StringPtr("http") - loadBalancerListenerPatchModelAsPatch, asPatchErr := loadBalancerListenerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerOptions model - updateLoadBalancerListenerOptionsModel := new(vpcv1.UpdateLoadBalancerListenerOptions) - updateLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerOptionsModel.LoadBalancerListenerPatch = loadBalancerListenerPatchModelAsPatch - updateLoadBalancerListenerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateLoadBalancerListener(updateLoadBalancerListenerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPatch model - loadBalancerListenerHTTPSRedirectPatchModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPatch) - loadBalancerListenerHTTPSRedirectPatchModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPatchModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPatchModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPatch model - loadBalancerListenerPatchModel := new(vpcv1.LoadBalancerListenerPatch) - loadBalancerListenerPatchModel.AcceptProxyProtocol = core.BoolPtr(true) - loadBalancerListenerPatchModel.CertificateInstance = certificateInstanceIdentityModel - loadBalancerListenerPatchModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - loadBalancerListenerPatchModel.DefaultPool = loadBalancerPoolIdentityModel - loadBalancerListenerPatchModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPatchModel - loadBalancerListenerPatchModel.Port = core.Int64Ptr(int64(443)) - loadBalancerListenerPatchModel.PortMax = core.Int64Ptr(int64(499)) - loadBalancerListenerPatchModel.PortMin = core.Int64Ptr(int64(443)) - loadBalancerListenerPatchModel.Protocol = core.StringPtr("http") - loadBalancerListenerPatchModelAsPatch, asPatchErr := loadBalancerListenerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerOptions model - updateLoadBalancerListenerOptionsModel := new(vpcv1.UpdateLoadBalancerListenerOptions) - updateLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerOptionsModel.LoadBalancerListenerPatch = loadBalancerListenerPatchModelAsPatch - updateLoadBalancerListenerOptionsModel.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.UpdateLoadBalancerListener(updateLoadBalancerListenerOptionsModel) - 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 UpdateLoadBalancerListenerOptions model with no property values - updateLoadBalancerListenerOptionsModelNew := new(vpcv1.UpdateLoadBalancerListenerOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateLoadBalancerListener(updateLoadBalancerListenerOptionsModelNew) - 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 UpdateLoadBalancerListener 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 CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPatch model - loadBalancerListenerHTTPSRedirectPatchModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPatch) - loadBalancerListenerHTTPSRedirectPatchModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPatchModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPatchModel.URI = core.StringPtr("/example?doc=get") - - // Construct an instance of the LoadBalancerListenerPatch model - loadBalancerListenerPatchModel := new(vpcv1.LoadBalancerListenerPatch) - loadBalancerListenerPatchModel.AcceptProxyProtocol = core.BoolPtr(true) - loadBalancerListenerPatchModel.CertificateInstance = certificateInstanceIdentityModel - loadBalancerListenerPatchModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - loadBalancerListenerPatchModel.DefaultPool = loadBalancerPoolIdentityModel - loadBalancerListenerPatchModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPatchModel - loadBalancerListenerPatchModel.Port = core.Int64Ptr(int64(443)) - loadBalancerListenerPatchModel.PortMax = core.Int64Ptr(int64(499)) - loadBalancerListenerPatchModel.PortMin = core.Int64Ptr(int64(443)) - loadBalancerListenerPatchModel.Protocol = core.StringPtr("http") - loadBalancerListenerPatchModelAsPatch, asPatchErr := loadBalancerListenerPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerOptions model - updateLoadBalancerListenerOptionsModel := new(vpcv1.UpdateLoadBalancerListenerOptions) - updateLoadBalancerListenerOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerOptionsModel.LoadBalancerListenerPatch = loadBalancerListenerPatchModelAsPatch - updateLoadBalancerListenerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateLoadBalancerListener(updateLoadBalancerListenerOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) - Operation response error`, func() { - version := "testString" - listLoadBalancerListenerPoliciesPath := "/load_balancers/testString/listeners/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(listLoadBalancerListenerPoliciesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListLoadBalancerListenerPolicies 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 ListLoadBalancerListenerPoliciesOptions model - listLoadBalancerListenerPoliciesOptionsModel := new(vpcv1.ListLoadBalancerListenerPoliciesOptions) - listLoadBalancerListenerPoliciesOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenerPoliciesOptionsModel.ListenerID = core.StringPtr("testString") - listLoadBalancerListenerPoliciesOptionsModel.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.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptionsModel) - 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.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions)`, func() { - version := "testString" - listLoadBalancerListenerPoliciesPath := "/load_balancers/testString/listeners/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(listLoadBalancerListenerPoliciesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"policies": [{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}]}`) - })) - }) - It(`Invoke ListLoadBalancerListenerPolicies 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 ListLoadBalancerListenerPoliciesOptions model - listLoadBalancerListenerPoliciesOptionsModel := new(vpcv1.ListLoadBalancerListenerPoliciesOptions) - listLoadBalancerListenerPoliciesOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenerPoliciesOptionsModel.ListenerID = core.StringPtr("testString") - listLoadBalancerListenerPoliciesOptionsModel.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.ListLoadBalancerListenerPoliciesWithContext(ctx, listLoadBalancerListenerPoliciesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptionsModel) - 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.ListLoadBalancerListenerPoliciesWithContext(ctx, listLoadBalancerListenerPoliciesOptionsModel) - 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(listLoadBalancerListenerPoliciesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"policies": [{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}]}`) - })) - }) - It(`Invoke ListLoadBalancerListenerPolicies 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.ListLoadBalancerListenerPolicies(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListLoadBalancerListenerPoliciesOptions model - listLoadBalancerListenerPoliciesOptionsModel := new(vpcv1.ListLoadBalancerListenerPoliciesOptions) - listLoadBalancerListenerPoliciesOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenerPoliciesOptionsModel.ListenerID = core.StringPtr("testString") - listLoadBalancerListenerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListLoadBalancerListenerPolicies 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 ListLoadBalancerListenerPoliciesOptions model - listLoadBalancerListenerPoliciesOptionsModel := new(vpcv1.ListLoadBalancerListenerPoliciesOptions) - listLoadBalancerListenerPoliciesOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenerPoliciesOptionsModel.ListenerID = core.StringPtr("testString") - listLoadBalancerListenerPoliciesOptionsModel.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.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptionsModel) - 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 ListLoadBalancerListenerPoliciesOptions model with no property values - listLoadBalancerListenerPoliciesOptionsModelNew := new(vpcv1.ListLoadBalancerListenerPoliciesOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptionsModelNew) - 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 ListLoadBalancerListenerPolicies 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 ListLoadBalancerListenerPoliciesOptions model - listLoadBalancerListenerPoliciesOptionsModel := new(vpcv1.ListLoadBalancerListenerPoliciesOptions) - listLoadBalancerListenerPoliciesOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenerPoliciesOptionsModel.ListenerID = core.StringPtr("testString") - listLoadBalancerListenerPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) - Operation response error`, func() { - version := "testString" - createLoadBalancerListenerPolicyPath := "/load_balancers/testString/listeners/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(createLoadBalancerListenerPolicyPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyRulePrototype model - loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) - loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") - - // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the CreateLoadBalancerListenerPolicyOptions model - createLoadBalancerListenerPolicyOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyOptions) - createLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyOptionsModel.Action = core.StringPtr("forward") - createLoadBalancerListenerPolicyOptionsModel.Priority = core.Int64Ptr(int64(5)) - createLoadBalancerListenerPolicyOptionsModel.Name = core.StringPtr("my-policy") - createLoadBalancerListenerPolicyOptionsModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} - createLoadBalancerListenerPolicyOptionsModel.Target = loadBalancerListenerPolicyTargetPrototypeModel - createLoadBalancerListenerPolicyOptionsModel.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.CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptionsModel) - 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.CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions)`, func() { - version := "testString" - createLoadBalancerListenerPolicyPath := "/load_balancers/testString/listeners/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(createLoadBalancerListenerPolicyPath)) - 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{"testString"})) - 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", `{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}`) - })) - }) - It(`Invoke CreateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyRulePrototype model - loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) - loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") - - // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the CreateLoadBalancerListenerPolicyOptions model - createLoadBalancerListenerPolicyOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyOptions) - createLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyOptionsModel.Action = core.StringPtr("forward") - createLoadBalancerListenerPolicyOptionsModel.Priority = core.Int64Ptr(int64(5)) - createLoadBalancerListenerPolicyOptionsModel.Name = core.StringPtr("my-policy") - createLoadBalancerListenerPolicyOptionsModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} - createLoadBalancerListenerPolicyOptionsModel.Target = loadBalancerListenerPolicyTargetPrototypeModel - createLoadBalancerListenerPolicyOptionsModel.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.CreateLoadBalancerListenerPolicyWithContext(ctx, createLoadBalancerListenerPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptionsModel) - 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.CreateLoadBalancerListenerPolicyWithContext(ctx, createLoadBalancerListenerPolicyOptionsModel) - 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(createLoadBalancerListenerPolicyPath)) - 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{"testString"})) - 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", `{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}`) - })) - }) - It(`Invoke CreateLoadBalancerListenerPolicy 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.CreateLoadBalancerListenerPolicy(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model - loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) - loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") - - // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the CreateLoadBalancerListenerPolicyOptions model - createLoadBalancerListenerPolicyOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyOptions) - createLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyOptionsModel.Action = core.StringPtr("forward") - createLoadBalancerListenerPolicyOptionsModel.Priority = core.Int64Ptr(int64(5)) - createLoadBalancerListenerPolicyOptionsModel.Name = core.StringPtr("my-policy") - createLoadBalancerListenerPolicyOptionsModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} - createLoadBalancerListenerPolicyOptionsModel.Target = loadBalancerListenerPolicyTargetPrototypeModel - createLoadBalancerListenerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyRulePrototype model - loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) - loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") - - // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the CreateLoadBalancerListenerPolicyOptions model - createLoadBalancerListenerPolicyOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyOptions) - createLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyOptionsModel.Action = core.StringPtr("forward") - createLoadBalancerListenerPolicyOptionsModel.Priority = core.Int64Ptr(int64(5)) - createLoadBalancerListenerPolicyOptionsModel.Name = core.StringPtr("my-policy") - createLoadBalancerListenerPolicyOptionsModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} - createLoadBalancerListenerPolicyOptionsModel.Target = loadBalancerListenerPolicyTargetPrototypeModel - createLoadBalancerListenerPolicyOptionsModel.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.CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptionsModel) - 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 CreateLoadBalancerListenerPolicyOptions model with no property values - createLoadBalancerListenerPolicyOptionsModelNew := new(vpcv1.CreateLoadBalancerListenerPolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptionsModelNew) - 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 CreateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyRulePrototype model - loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) - loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") - - // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the CreateLoadBalancerListenerPolicyOptions model - createLoadBalancerListenerPolicyOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyOptions) - createLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyOptionsModel.Action = core.StringPtr("forward") - createLoadBalancerListenerPolicyOptionsModel.Priority = core.Int64Ptr(int64(5)) - createLoadBalancerListenerPolicyOptionsModel.Name = core.StringPtr("my-policy") - createLoadBalancerListenerPolicyOptionsModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} - createLoadBalancerListenerPolicyOptionsModel.Target = loadBalancerListenerPolicyTargetPrototypeModel - createLoadBalancerListenerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions)`, func() { - version := "testString" - deleteLoadBalancerListenerPolicyPath := "/load_balancers/testString/listeners/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(deleteLoadBalancerListenerPolicyPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteLoadBalancerListenerPolicy 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.DeleteLoadBalancerListenerPolicy(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteLoadBalancerListenerPolicyOptions model - deleteLoadBalancerListenerPolicyOptionsModel := new(vpcv1.DeleteLoadBalancerListenerPolicyOptions) - deleteLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - deleteLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - deleteLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") - deleteLoadBalancerListenerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteLoadBalancerListenerPolicy 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 DeleteLoadBalancerListenerPolicyOptions model - deleteLoadBalancerListenerPolicyOptionsModel := new(vpcv1.DeleteLoadBalancerListenerPolicyOptions) - deleteLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - deleteLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - deleteLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") - deleteLoadBalancerListenerPolicyOptionsModel.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.DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteLoadBalancerListenerPolicyOptions model with no property values - deleteLoadBalancerListenerPolicyOptionsModelNew := new(vpcv1.DeleteLoadBalancerListenerPolicyOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) - Operation response error`, func() { - version := "testString" - getLoadBalancerListenerPolicyPath := "/load_balancers/testString/listeners/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(getLoadBalancerListenerPolicyPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetLoadBalancerListenerPolicy 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 GetLoadBalancerListenerPolicyOptions model - getLoadBalancerListenerPolicyOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyOptions) - getLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.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.GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptionsModel) - 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.GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions)`, func() { - version := "testString" - getLoadBalancerListenerPolicyPath := "/load_balancers/testString/listeners/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(getLoadBalancerListenerPolicyPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}`) - })) - }) - It(`Invoke GetLoadBalancerListenerPolicy 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 GetLoadBalancerListenerPolicyOptions model - getLoadBalancerListenerPolicyOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyOptions) - getLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.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.GetLoadBalancerListenerPolicyWithContext(ctx, getLoadBalancerListenerPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptionsModel) - 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.GetLoadBalancerListenerPolicyWithContext(ctx, getLoadBalancerListenerPolicyOptionsModel) - 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(getLoadBalancerListenerPolicyPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}`) - })) - }) - It(`Invoke GetLoadBalancerListenerPolicy 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.GetLoadBalancerListenerPolicy(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetLoadBalancerListenerPolicyOptions model - getLoadBalancerListenerPolicyOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyOptions) - getLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetLoadBalancerListenerPolicy 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 GetLoadBalancerListenerPolicyOptions model - getLoadBalancerListenerPolicyOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyOptions) - getLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.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.GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptionsModel) - 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 GetLoadBalancerListenerPolicyOptions model with no property values - getLoadBalancerListenerPolicyOptionsModelNew := new(vpcv1.GetLoadBalancerListenerPolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptionsModelNew) - 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 GetLoadBalancerListenerPolicy 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 GetLoadBalancerListenerPolicyOptions model - getLoadBalancerListenerPolicyOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyOptions) - getLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) - Operation response error`, func() { - version := "testString" - updateLoadBalancerListenerPolicyPath := "/load_balancers/testString/listeners/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(updateLoadBalancerListenerPolicyPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPatchModel := new(vpcv1.LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPatchModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerPolicyPatch model - loadBalancerListenerPolicyPatchModel := new(vpcv1.LoadBalancerListenerPolicyPatch) - loadBalancerListenerPolicyPatchModel.Name = core.StringPtr("my-policy") - loadBalancerListenerPolicyPatchModel.Priority = core.Int64Ptr(int64(5)) - loadBalancerListenerPolicyPatchModel.Target = loadBalancerListenerPolicyTargetPatchModel - loadBalancerListenerPolicyPatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerPolicyOptions model - updateLoadBalancerListenerPolicyOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyOptions) - updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatchModelAsPatch - updateLoadBalancerListenerPolicyOptionsModel.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.UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptionsModel) - 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.UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions)`, func() { - version := "testString" - updateLoadBalancerListenerPolicyPath := "/load_balancers/testString/listeners/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(updateLoadBalancerListenerPolicyPath)) - 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{"testString"})) - 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", `{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}`) - })) - }) - It(`Invoke UpdateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPatchModel := new(vpcv1.LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPatchModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerPolicyPatch model - loadBalancerListenerPolicyPatchModel := new(vpcv1.LoadBalancerListenerPolicyPatch) - loadBalancerListenerPolicyPatchModel.Name = core.StringPtr("my-policy") - loadBalancerListenerPolicyPatchModel.Priority = core.Int64Ptr(int64(5)) - loadBalancerListenerPolicyPatchModel.Target = loadBalancerListenerPolicyTargetPatchModel - loadBalancerListenerPolicyPatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerPolicyOptions model - updateLoadBalancerListenerPolicyOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyOptions) - updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatchModelAsPatch - updateLoadBalancerListenerPolicyOptionsModel.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.UpdateLoadBalancerListenerPolicyWithContext(ctx, updateLoadBalancerListenerPolicyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptionsModel) - 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.UpdateLoadBalancerListenerPolicyWithContext(ctx, updateLoadBalancerListenerPolicyOptionsModel) - 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(updateLoadBalancerListenerPolicyPath)) - 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{"testString"})) - 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", `{"action": "forward", "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "name": "my-policy", "priority": 5, "provisioning_status": "active", "rules": [{"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/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004"}], "target": {"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"}}`) - })) - }) - It(`Invoke UpdateLoadBalancerListenerPolicy 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.UpdateLoadBalancerListenerPolicy(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPatchModel := new(vpcv1.LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPatchModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerPolicyPatch model - loadBalancerListenerPolicyPatchModel := new(vpcv1.LoadBalancerListenerPolicyPatch) - loadBalancerListenerPolicyPatchModel.Name = core.StringPtr("my-policy") - loadBalancerListenerPolicyPatchModel.Priority = core.Int64Ptr(int64(5)) - loadBalancerListenerPolicyPatchModel.Target = loadBalancerListenerPolicyTargetPatchModel - loadBalancerListenerPolicyPatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerPolicyOptions model - updateLoadBalancerListenerPolicyOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyOptions) - updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatchModelAsPatch - updateLoadBalancerListenerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPatchModel := new(vpcv1.LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPatchModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerPolicyPatch model - loadBalancerListenerPolicyPatchModel := new(vpcv1.LoadBalancerListenerPolicyPatch) - loadBalancerListenerPolicyPatchModel.Name = core.StringPtr("my-policy") - loadBalancerListenerPolicyPatchModel.Priority = core.Int64Ptr(int64(5)) - loadBalancerListenerPolicyPatchModel.Target = loadBalancerListenerPolicyTargetPatchModel - loadBalancerListenerPolicyPatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerPolicyOptions model - updateLoadBalancerListenerPolicyOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyOptions) - updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatchModelAsPatch - updateLoadBalancerListenerPolicyOptionsModel.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.UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptionsModel) - 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 UpdateLoadBalancerListenerPolicyOptions model with no property values - updateLoadBalancerListenerPolicyOptionsModelNew := new(vpcv1.UpdateLoadBalancerListenerPolicyOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptionsModelNew) - 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 UpdateLoadBalancerListenerPolicy 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 LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPatchModel := new(vpcv1.LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - loadBalancerListenerPolicyTargetPatchModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - - // Construct an instance of the LoadBalancerListenerPolicyPatch model - loadBalancerListenerPolicyPatchModel := new(vpcv1.LoadBalancerListenerPolicyPatch) - loadBalancerListenerPolicyPatchModel.Name = core.StringPtr("my-policy") - loadBalancerListenerPolicyPatchModel.Priority = core.Int64Ptr(int64(5)) - loadBalancerListenerPolicyPatchModel.Target = loadBalancerListenerPolicyTargetPatchModel - loadBalancerListenerPolicyPatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerPolicyOptions model - updateLoadBalancerListenerPolicyOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyOptions) - updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.ListenerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatchModelAsPatch - updateLoadBalancerListenerPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) - Operation response error`, func() { - version := "testString" - listLoadBalancerListenerPolicyRulesPath := "/load_balancers/testString/listeners/testString/policies/testString/rules" - 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(listLoadBalancerListenerPolicyRulesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListLoadBalancerListenerPolicyRules 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 ListLoadBalancerListenerPolicyRulesOptions model - listLoadBalancerListenerPolicyRulesOptionsModel := new(vpcv1.ListLoadBalancerListenerPolicyRulesOptions) - listLoadBalancerListenerPolicyRulesOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.ListenerID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.PolicyID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.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.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptionsModel) - 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.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions)`, func() { - version := "testString" - listLoadBalancerListenerPolicyRulesPath := "/load_balancers/testString/listeners/testString/policies/testString/rules" - 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(listLoadBalancerListenerPolicyRulesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"rules": [{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}]}`) - })) - }) - It(`Invoke ListLoadBalancerListenerPolicyRules 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 ListLoadBalancerListenerPolicyRulesOptions model - listLoadBalancerListenerPolicyRulesOptionsModel := new(vpcv1.ListLoadBalancerListenerPolicyRulesOptions) - listLoadBalancerListenerPolicyRulesOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.ListenerID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.PolicyID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.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.ListLoadBalancerListenerPolicyRulesWithContext(ctx, listLoadBalancerListenerPolicyRulesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptionsModel) - 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.ListLoadBalancerListenerPolicyRulesWithContext(ctx, listLoadBalancerListenerPolicyRulesOptionsModel) - 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(listLoadBalancerListenerPolicyRulesPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"rules": [{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}]}`) - })) - }) - It(`Invoke ListLoadBalancerListenerPolicyRules 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.ListLoadBalancerListenerPolicyRules(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListLoadBalancerListenerPolicyRulesOptions model - listLoadBalancerListenerPolicyRulesOptionsModel := new(vpcv1.ListLoadBalancerListenerPolicyRulesOptions) - listLoadBalancerListenerPolicyRulesOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.ListenerID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.PolicyID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListLoadBalancerListenerPolicyRules 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 ListLoadBalancerListenerPolicyRulesOptions model - listLoadBalancerListenerPolicyRulesOptionsModel := new(vpcv1.ListLoadBalancerListenerPolicyRulesOptions) - listLoadBalancerListenerPolicyRulesOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.ListenerID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.PolicyID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.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.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptionsModel) - 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 ListLoadBalancerListenerPolicyRulesOptions model with no property values - listLoadBalancerListenerPolicyRulesOptionsModelNew := new(vpcv1.ListLoadBalancerListenerPolicyRulesOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptionsModelNew) - 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 ListLoadBalancerListenerPolicyRules 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 ListLoadBalancerListenerPolicyRulesOptions model - listLoadBalancerListenerPolicyRulesOptionsModel := new(vpcv1.ListLoadBalancerListenerPolicyRulesOptions) - listLoadBalancerListenerPolicyRulesOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.ListenerID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.PolicyID = core.StringPtr("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) - Operation response error`, func() { - version := "testString" - createLoadBalancerListenerPolicyRulePath := "/load_balancers/testString/listeners/testString/policies/testString/rules" - 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(createLoadBalancerListenerPolicyRulePath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateLoadBalancerListenerPolicyRule 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 CreateLoadBalancerListenerPolicyRuleOptions model - createLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyRuleOptions) - createLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.Condition = core.StringPtr("contains") - createLoadBalancerListenerPolicyRuleOptionsModel.Type = core.StringPtr("body") - createLoadBalancerListenerPolicyRuleOptionsModel.Value = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.Field = core.StringPtr("MY-APP-HEADER") - createLoadBalancerListenerPolicyRuleOptionsModel.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.CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptionsModel) - 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.CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions)`, func() { - version := "testString" - createLoadBalancerListenerPolicyRulePath := "/load_balancers/testString/listeners/testString/policies/testString/rules" - 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(createLoadBalancerListenerPolicyRulePath)) - 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{"testString"})) - 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", `{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}`) - })) - }) - It(`Invoke CreateLoadBalancerListenerPolicyRule 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 CreateLoadBalancerListenerPolicyRuleOptions model - createLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyRuleOptions) - createLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.Condition = core.StringPtr("contains") - createLoadBalancerListenerPolicyRuleOptionsModel.Type = core.StringPtr("body") - createLoadBalancerListenerPolicyRuleOptionsModel.Value = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.Field = core.StringPtr("MY-APP-HEADER") - createLoadBalancerListenerPolicyRuleOptionsModel.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.CreateLoadBalancerListenerPolicyRuleWithContext(ctx, createLoadBalancerListenerPolicyRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptionsModel) - 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.CreateLoadBalancerListenerPolicyRuleWithContext(ctx, createLoadBalancerListenerPolicyRuleOptionsModel) - 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(createLoadBalancerListenerPolicyRulePath)) - 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{"testString"})) - 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", `{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}`) - })) - }) - It(`Invoke CreateLoadBalancerListenerPolicyRule 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.CreateLoadBalancerListenerPolicyRule(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the CreateLoadBalancerListenerPolicyRuleOptions model - createLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyRuleOptions) - createLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.Condition = core.StringPtr("contains") - createLoadBalancerListenerPolicyRuleOptionsModel.Type = core.StringPtr("body") - createLoadBalancerListenerPolicyRuleOptionsModel.Value = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.Field = core.StringPtr("MY-APP-HEADER") - createLoadBalancerListenerPolicyRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateLoadBalancerListenerPolicyRule 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 CreateLoadBalancerListenerPolicyRuleOptions model - createLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyRuleOptions) - createLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.Condition = core.StringPtr("contains") - createLoadBalancerListenerPolicyRuleOptionsModel.Type = core.StringPtr("body") - createLoadBalancerListenerPolicyRuleOptionsModel.Value = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.Field = core.StringPtr("MY-APP-HEADER") - createLoadBalancerListenerPolicyRuleOptionsModel.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.CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptionsModel) - 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 CreateLoadBalancerListenerPolicyRuleOptions model with no property values - createLoadBalancerListenerPolicyRuleOptionsModelNew := new(vpcv1.CreateLoadBalancerListenerPolicyRuleOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptionsModelNew) - 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 CreateLoadBalancerListenerPolicyRule 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 CreateLoadBalancerListenerPolicyRuleOptions model - createLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.CreateLoadBalancerListenerPolicyRuleOptions) - createLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.Condition = core.StringPtr("contains") - createLoadBalancerListenerPolicyRuleOptionsModel.Type = core.StringPtr("body") - createLoadBalancerListenerPolicyRuleOptionsModel.Value = core.StringPtr("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.Field = core.StringPtr("MY-APP-HEADER") - createLoadBalancerListenerPolicyRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions)`, func() { - version := "testString" - deleteLoadBalancerListenerPolicyRulePath := "/load_balancers/testString/listeners/testString/policies/testString/rules/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(deleteLoadBalancerListenerPolicyRulePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteLoadBalancerListenerPolicyRule 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.DeleteLoadBalancerListenerPolicyRule(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteLoadBalancerListenerPolicyRuleOptions model - deleteLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.DeleteLoadBalancerListenerPolicyRuleOptions) - deleteLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - deleteLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - deleteLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - deleteLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") - deleteLoadBalancerListenerPolicyRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteLoadBalancerListenerPolicyRule 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 DeleteLoadBalancerListenerPolicyRuleOptions model - deleteLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.DeleteLoadBalancerListenerPolicyRuleOptions) - deleteLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - deleteLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - deleteLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - deleteLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") - deleteLoadBalancerListenerPolicyRuleOptionsModel.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.DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteLoadBalancerListenerPolicyRuleOptions model with no property values - deleteLoadBalancerListenerPolicyRuleOptionsModelNew := new(vpcv1.DeleteLoadBalancerListenerPolicyRuleOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) - Operation response error`, func() { - version := "testString" - getLoadBalancerListenerPolicyRulePath := "/load_balancers/testString/listeners/testString/policies/testString/rules/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(getLoadBalancerListenerPolicyRulePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetLoadBalancerListenerPolicyRule 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 GetLoadBalancerListenerPolicyRuleOptions model - getLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyRuleOptions) - getLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.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.GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptionsModel) - 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.GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions)`, func() { - version := "testString" - getLoadBalancerListenerPolicyRulePath := "/load_balancers/testString/listeners/testString/policies/testString/rules/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(getLoadBalancerListenerPolicyRulePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}`) - })) - }) - It(`Invoke GetLoadBalancerListenerPolicyRule 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 GetLoadBalancerListenerPolicyRuleOptions model - getLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyRuleOptions) - getLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.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.GetLoadBalancerListenerPolicyRuleWithContext(ctx, getLoadBalancerListenerPolicyRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptionsModel) - 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.GetLoadBalancerListenerPolicyRuleWithContext(ctx, getLoadBalancerListenerPolicyRuleOptionsModel) - 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(getLoadBalancerListenerPolicyRulePath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}`) - })) - }) - It(`Invoke GetLoadBalancerListenerPolicyRule 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.GetLoadBalancerListenerPolicyRule(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetLoadBalancerListenerPolicyRuleOptions model - getLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyRuleOptions) - getLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetLoadBalancerListenerPolicyRule 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 GetLoadBalancerListenerPolicyRuleOptions model - getLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyRuleOptions) - getLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.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.GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptionsModel) - 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 GetLoadBalancerListenerPolicyRuleOptions model with no property values - getLoadBalancerListenerPolicyRuleOptionsModelNew := new(vpcv1.GetLoadBalancerListenerPolicyRuleOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptionsModelNew) - 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 GetLoadBalancerListenerPolicyRule 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 GetLoadBalancerListenerPolicyRuleOptions model - getLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.GetLoadBalancerListenerPolicyRuleOptions) - getLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) - Operation response error`, func() { - version := "testString" - updateLoadBalancerListenerPolicyRulePath := "/load_balancers/testString/listeners/testString/policies/testString/rules/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(updateLoadBalancerListenerPolicyRulePath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateLoadBalancerListenerPolicyRule 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 LoadBalancerListenerPolicyRulePatch model - loadBalancerListenerPolicyRulePatchModel := new(vpcv1.LoadBalancerListenerPolicyRulePatch) - loadBalancerListenerPolicyRulePatchModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePatchModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePatchModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePatchModel.Value = core.StringPtr("testString") - loadBalancerListenerPolicyRulePatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerPolicyRuleOptions model - updateLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyRuleOptions) - updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatchModelAsPatch - updateLoadBalancerListenerPolicyRuleOptionsModel.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.UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptionsModel) - 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.UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions)`, func() { - version := "testString" - updateLoadBalancerListenerPolicyRulePath := "/load_balancers/testString/listeners/testString/policies/testString/rules/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(updateLoadBalancerListenerPolicyRulePath)) - 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{"testString"})) - 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", `{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}`) - })) - }) - It(`Invoke UpdateLoadBalancerListenerPolicyRule 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 LoadBalancerListenerPolicyRulePatch model - loadBalancerListenerPolicyRulePatchModel := new(vpcv1.LoadBalancerListenerPolicyRulePatch) - loadBalancerListenerPolicyRulePatchModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePatchModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePatchModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePatchModel.Value = core.StringPtr("testString") - loadBalancerListenerPolicyRulePatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerPolicyRuleOptions model - updateLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyRuleOptions) - updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatchModelAsPatch - updateLoadBalancerListenerPolicyRuleOptionsModel.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.UpdateLoadBalancerListenerPolicyRuleWithContext(ctx, updateLoadBalancerListenerPolicyRuleOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptionsModel) - 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.UpdateLoadBalancerListenerPolicyRuleWithContext(ctx, updateLoadBalancerListenerPolicyRuleOptionsModel) - 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(updateLoadBalancerListenerPolicyRulePath)) - 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{"testString"})) - 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", `{"condition": "contains", "created_at": "2019-01-01T12:00:00.000Z", "field": "MY-APP-HEADER", "href": "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004/policies/f3187486-7b27-4c79-990c-47d33c0e2278/rules/873a84b0-84d6-49c6-8948-1fa527b25762", "id": "70294e14-4e61-11e8-bcf4-0242ac110004", "provisioning_status": "active", "type": "body", "value": "Value"}`) - })) - }) - It(`Invoke UpdateLoadBalancerListenerPolicyRule 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.UpdateLoadBalancerListenerPolicyRule(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the LoadBalancerListenerPolicyRulePatch model - loadBalancerListenerPolicyRulePatchModel := new(vpcv1.LoadBalancerListenerPolicyRulePatch) - loadBalancerListenerPolicyRulePatchModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePatchModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePatchModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePatchModel.Value = core.StringPtr("testString") - loadBalancerListenerPolicyRulePatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerPolicyRuleOptions model - updateLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyRuleOptions) - updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatchModelAsPatch - updateLoadBalancerListenerPolicyRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateLoadBalancerListenerPolicyRule 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 LoadBalancerListenerPolicyRulePatch model - loadBalancerListenerPolicyRulePatchModel := new(vpcv1.LoadBalancerListenerPolicyRulePatch) - loadBalancerListenerPolicyRulePatchModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePatchModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePatchModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePatchModel.Value = core.StringPtr("testString") - loadBalancerListenerPolicyRulePatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerPolicyRuleOptions model - updateLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyRuleOptions) - updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatchModelAsPatch - updateLoadBalancerListenerPolicyRuleOptionsModel.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.UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptionsModel) - 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 UpdateLoadBalancerListenerPolicyRuleOptions model with no property values - updateLoadBalancerListenerPolicyRuleOptionsModelNew := new(vpcv1.UpdateLoadBalancerListenerPolicyRuleOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptionsModelNew) - 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 UpdateLoadBalancerListenerPolicyRule 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 LoadBalancerListenerPolicyRulePatch model - loadBalancerListenerPolicyRulePatchModel := new(vpcv1.LoadBalancerListenerPolicyRulePatch) - loadBalancerListenerPolicyRulePatchModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePatchModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePatchModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePatchModel.Value = core.StringPtr("testString") - loadBalancerListenerPolicyRulePatchModelAsPatch, asPatchErr := loadBalancerListenerPolicyRulePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerListenerPolicyRuleOptions model - updateLoadBalancerListenerPolicyRuleOptionsModel := new(vpcv1.UpdateLoadBalancerListenerPolicyRuleOptions) - updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.ListenerID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.PolicyID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatchModelAsPatch - updateLoadBalancerListenerPolicyRuleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) - Operation response error`, func() { - version := "testString" - listLoadBalancerPoolsPath := "/load_balancers/testString/pools" - 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(listLoadBalancerPoolsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListLoadBalancerPools 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 ListLoadBalancerPoolsOptions model - listLoadBalancerPoolsOptionsModel := new(vpcv1.ListLoadBalancerPoolsOptions) - listLoadBalancerPoolsOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerPoolsOptionsModel.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.ListLoadBalancerPools(listLoadBalancerPoolsOptionsModel) - 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.ListLoadBalancerPools(listLoadBalancerPoolsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions)`, func() { - version := "testString" - listLoadBalancerPoolsPath := "/load_balancers/testString/pools" - 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(listLoadBalancerPoolsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/123456::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() { - 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 ListLoadBalancerPoolsOptions model - listLoadBalancerPoolsOptionsModel := new(vpcv1.ListLoadBalancerPoolsOptions) - listLoadBalancerPoolsOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerPoolsOptionsModel.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.ListLoadBalancerPoolsWithContext(ctx, listLoadBalancerPoolsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListLoadBalancerPools(listLoadBalancerPoolsOptionsModel) - 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.ListLoadBalancerPoolsWithContext(ctx, listLoadBalancerPoolsOptionsModel) - 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(listLoadBalancerPoolsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/123456::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() { - 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.ListLoadBalancerPools(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListLoadBalancerPoolsOptions model - listLoadBalancerPoolsOptionsModel := new(vpcv1.ListLoadBalancerPoolsOptions) - listLoadBalancerPoolsOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerPoolsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListLoadBalancerPools(listLoadBalancerPoolsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListLoadBalancerPools 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 ListLoadBalancerPoolsOptions model - listLoadBalancerPoolsOptionsModel := new(vpcv1.ListLoadBalancerPoolsOptions) - listLoadBalancerPoolsOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerPoolsOptionsModel.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.ListLoadBalancerPools(listLoadBalancerPoolsOptionsModel) - 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 ListLoadBalancerPoolsOptions model with no property values - listLoadBalancerPoolsOptionsModelNew := new(vpcv1.ListLoadBalancerPoolsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListLoadBalancerPools(listLoadBalancerPoolsOptionsModelNew) - 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 ListLoadBalancerPools 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 ListLoadBalancerPoolsOptions model - listLoadBalancerPoolsOptionsModel := new(vpcv1.ListLoadBalancerPoolsOptions) - listLoadBalancerPoolsOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerPoolsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListLoadBalancerPools(listLoadBalancerPoolsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateLoadBalancerPool(createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) - Operation response error`, func() { - version := "testString" - createLoadBalancerPoolPath := "/load_balancers/testString/pools" - 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(createLoadBalancerPoolPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateLoadBalancerPool 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 LoadBalancerPoolHealthMonitorPrototype model - loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) - loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model - loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) - loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the CreateLoadBalancerPoolOptions model - createLoadBalancerPoolOptionsModel := new(vpcv1.CreateLoadBalancerPoolOptions) - createLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerPoolOptionsModel.Algorithm = core.StringPtr("least_connections") - createLoadBalancerPoolOptionsModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel - createLoadBalancerPoolOptionsModel.Protocol = core.StringPtr("http") - createLoadBalancerPoolOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - createLoadBalancerPoolOptionsModel.Name = core.StringPtr("my-load-balancer-pool") - createLoadBalancerPoolOptionsModel.ProxyProtocol = core.StringPtr("disabled") - createLoadBalancerPoolOptionsModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel - createLoadBalancerPoolOptionsModel.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.CreateLoadBalancerPool(createLoadBalancerPoolOptionsModel) - 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.CreateLoadBalancerPool(createLoadBalancerPoolOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateLoadBalancerPool(createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions)`, func() { - version := "testString" - createLoadBalancerPoolPath := "/load_balancers/testString/pools" - 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(createLoadBalancerPoolPath)) - 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{"testString"})) - 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", `{"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/123456::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() { - 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 LoadBalancerPoolHealthMonitorPrototype model - loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) - loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model - loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) - loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the CreateLoadBalancerPoolOptions model - createLoadBalancerPoolOptionsModel := new(vpcv1.CreateLoadBalancerPoolOptions) - createLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerPoolOptionsModel.Algorithm = core.StringPtr("least_connections") - createLoadBalancerPoolOptionsModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel - createLoadBalancerPoolOptionsModel.Protocol = core.StringPtr("http") - createLoadBalancerPoolOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - createLoadBalancerPoolOptionsModel.Name = core.StringPtr("my-load-balancer-pool") - createLoadBalancerPoolOptionsModel.ProxyProtocol = core.StringPtr("disabled") - createLoadBalancerPoolOptionsModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel - createLoadBalancerPoolOptionsModel.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.CreateLoadBalancerPoolWithContext(ctx, createLoadBalancerPoolOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateLoadBalancerPool(createLoadBalancerPoolOptionsModel) - 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.CreateLoadBalancerPoolWithContext(ctx, createLoadBalancerPoolOptionsModel) - 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(createLoadBalancerPoolPath)) - 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{"testString"})) - 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", `{"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/123456::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() { - 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.CreateLoadBalancerPool(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model - loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) - loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model - loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) - loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the CreateLoadBalancerPoolOptions model - createLoadBalancerPoolOptionsModel := new(vpcv1.CreateLoadBalancerPoolOptions) - createLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerPoolOptionsModel.Algorithm = core.StringPtr("least_connections") - createLoadBalancerPoolOptionsModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel - createLoadBalancerPoolOptionsModel.Protocol = core.StringPtr("http") - createLoadBalancerPoolOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - createLoadBalancerPoolOptionsModel.Name = core.StringPtr("my-load-balancer-pool") - createLoadBalancerPoolOptionsModel.ProxyProtocol = core.StringPtr("disabled") - createLoadBalancerPoolOptionsModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel - createLoadBalancerPoolOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateLoadBalancerPool(createLoadBalancerPoolOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateLoadBalancerPool 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 LoadBalancerPoolHealthMonitorPrototype model - loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) - loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model - loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) - loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the CreateLoadBalancerPoolOptions model - createLoadBalancerPoolOptionsModel := new(vpcv1.CreateLoadBalancerPoolOptions) - createLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerPoolOptionsModel.Algorithm = core.StringPtr("least_connections") - createLoadBalancerPoolOptionsModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel - createLoadBalancerPoolOptionsModel.Protocol = core.StringPtr("http") - createLoadBalancerPoolOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - createLoadBalancerPoolOptionsModel.Name = core.StringPtr("my-load-balancer-pool") - createLoadBalancerPoolOptionsModel.ProxyProtocol = core.StringPtr("disabled") - createLoadBalancerPoolOptionsModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel - createLoadBalancerPoolOptionsModel.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.CreateLoadBalancerPool(createLoadBalancerPoolOptionsModel) - 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 CreateLoadBalancerPoolOptions model with no property values - createLoadBalancerPoolOptionsModelNew := new(vpcv1.CreateLoadBalancerPoolOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateLoadBalancerPool(createLoadBalancerPoolOptionsModelNew) - 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 CreateLoadBalancerPool 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 LoadBalancerPoolHealthMonitorPrototype model - loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) - loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model - loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) - loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the CreateLoadBalancerPoolOptions model - createLoadBalancerPoolOptionsModel := new(vpcv1.CreateLoadBalancerPoolOptions) - createLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerPoolOptionsModel.Algorithm = core.StringPtr("least_connections") - createLoadBalancerPoolOptionsModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel - createLoadBalancerPoolOptionsModel.Protocol = core.StringPtr("http") - createLoadBalancerPoolOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - createLoadBalancerPoolOptionsModel.Name = core.StringPtr("my-load-balancer-pool") - createLoadBalancerPoolOptionsModel.ProxyProtocol = core.StringPtr("disabled") - createLoadBalancerPoolOptionsModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel - createLoadBalancerPoolOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateLoadBalancerPool(createLoadBalancerPoolOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteLoadBalancerPool(deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions)`, func() { - version := "testString" - deleteLoadBalancerPoolPath := "/load_balancers/testString/pools/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(deleteLoadBalancerPoolPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteLoadBalancerPool 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.DeleteLoadBalancerPool(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteLoadBalancerPoolOptions model - deleteLoadBalancerPoolOptionsModel := new(vpcv1.DeleteLoadBalancerPoolOptions) - deleteLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - deleteLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") - deleteLoadBalancerPoolOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteLoadBalancerPool(deleteLoadBalancerPoolOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteLoadBalancerPool 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 DeleteLoadBalancerPoolOptions model - deleteLoadBalancerPoolOptionsModel := new(vpcv1.DeleteLoadBalancerPoolOptions) - deleteLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - deleteLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") - deleteLoadBalancerPoolOptionsModel.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.DeleteLoadBalancerPool(deleteLoadBalancerPoolOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteLoadBalancerPoolOptions model with no property values - deleteLoadBalancerPoolOptionsModelNew := new(vpcv1.DeleteLoadBalancerPoolOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteLoadBalancerPool(deleteLoadBalancerPoolOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancerPool(getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) - Operation response error`, func() { - version := "testString" - getLoadBalancerPoolPath := "/load_balancers/testString/pools/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(getLoadBalancerPoolPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetLoadBalancerPool 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 GetLoadBalancerPoolOptions model - getLoadBalancerPoolOptionsModel := new(vpcv1.GetLoadBalancerPoolOptions) - getLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerPoolOptionsModel.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.GetLoadBalancerPool(getLoadBalancerPoolOptionsModel) - 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.GetLoadBalancerPool(getLoadBalancerPoolOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancerPool(getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions)`, func() { - version := "testString" - getLoadBalancerPoolPath := "/load_balancers/testString/pools/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(getLoadBalancerPoolPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/123456::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() { - 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 GetLoadBalancerPoolOptions model - getLoadBalancerPoolOptionsModel := new(vpcv1.GetLoadBalancerPoolOptions) - getLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerPoolOptionsModel.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.GetLoadBalancerPoolWithContext(ctx, getLoadBalancerPoolOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetLoadBalancerPool(getLoadBalancerPoolOptionsModel) - 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.GetLoadBalancerPoolWithContext(ctx, getLoadBalancerPoolOptionsModel) - 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(getLoadBalancerPoolPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/123456::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() { - 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.GetLoadBalancerPool(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetLoadBalancerPoolOptions model - getLoadBalancerPoolOptionsModel := new(vpcv1.GetLoadBalancerPoolOptions) - getLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerPoolOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetLoadBalancerPool(getLoadBalancerPoolOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetLoadBalancerPool 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 GetLoadBalancerPoolOptions model - getLoadBalancerPoolOptionsModel := new(vpcv1.GetLoadBalancerPoolOptions) - getLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerPoolOptionsModel.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.GetLoadBalancerPool(getLoadBalancerPoolOptionsModel) - 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 GetLoadBalancerPoolOptions model with no property values - getLoadBalancerPoolOptionsModelNew := new(vpcv1.GetLoadBalancerPoolOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetLoadBalancerPool(getLoadBalancerPoolOptionsModelNew) - 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 GetLoadBalancerPool 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 GetLoadBalancerPoolOptions model - getLoadBalancerPoolOptionsModel := new(vpcv1.GetLoadBalancerPoolOptions) - getLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerPoolOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetLoadBalancerPool(getLoadBalancerPoolOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateLoadBalancerPool(updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) - Operation response error`, func() { - version := "testString" - updateLoadBalancerPoolPath := "/load_balancers/testString/pools/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(updateLoadBalancerPoolPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateLoadBalancerPool 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 LoadBalancerPoolHealthMonitorPatch model - loadBalancerPoolHealthMonitorPatchModel := new(vpcv1.LoadBalancerPoolHealthMonitorPatch) - loadBalancerPoolHealthMonitorPatchModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPatchModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPatchModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPatchModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPatchModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPatchModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolSessionPersistencePatch model - loadBalancerPoolSessionPersistencePatchModel := new(vpcv1.LoadBalancerPoolSessionPersistencePatch) - loadBalancerPoolSessionPersistencePatchModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePatchModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the LoadBalancerPoolPatch model - loadBalancerPoolPatchModel := new(vpcv1.LoadBalancerPoolPatch) - loadBalancerPoolPatchModel.Algorithm = core.StringPtr("least_connections") - loadBalancerPoolPatchModel.HealthMonitor = loadBalancerPoolHealthMonitorPatchModel - loadBalancerPoolPatchModel.Name = core.StringPtr("my-load-balancer-pool") - loadBalancerPoolPatchModel.Protocol = core.StringPtr("http") - loadBalancerPoolPatchModel.ProxyProtocol = core.StringPtr("disabled") - loadBalancerPoolPatchModel.SessionPersistence = loadBalancerPoolSessionPersistencePatchModel - loadBalancerPoolPatchModelAsPatch, asPatchErr := loadBalancerPoolPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerPoolOptions model - updateLoadBalancerPoolOptionsModel := new(vpcv1.UpdateLoadBalancerPoolOptions) - updateLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerPoolOptionsModel.LoadBalancerPoolPatch = loadBalancerPoolPatchModelAsPatch - updateLoadBalancerPoolOptionsModel.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.UpdateLoadBalancerPool(updateLoadBalancerPoolOptionsModel) - 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.UpdateLoadBalancerPool(updateLoadBalancerPoolOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateLoadBalancerPool(updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions)`, func() { - version := "testString" - updateLoadBalancerPoolPath := "/load_balancers/testString/pools/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(updateLoadBalancerPoolPath)) - 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{"testString"})) - 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", `{"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/123456::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() { - 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 LoadBalancerPoolHealthMonitorPatch model - loadBalancerPoolHealthMonitorPatchModel := new(vpcv1.LoadBalancerPoolHealthMonitorPatch) - loadBalancerPoolHealthMonitorPatchModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPatchModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPatchModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPatchModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPatchModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPatchModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolSessionPersistencePatch model - loadBalancerPoolSessionPersistencePatchModel := new(vpcv1.LoadBalancerPoolSessionPersistencePatch) - loadBalancerPoolSessionPersistencePatchModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePatchModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the LoadBalancerPoolPatch model - loadBalancerPoolPatchModel := new(vpcv1.LoadBalancerPoolPatch) - loadBalancerPoolPatchModel.Algorithm = core.StringPtr("least_connections") - loadBalancerPoolPatchModel.HealthMonitor = loadBalancerPoolHealthMonitorPatchModel - loadBalancerPoolPatchModel.Name = core.StringPtr("my-load-balancer-pool") - loadBalancerPoolPatchModel.Protocol = core.StringPtr("http") - loadBalancerPoolPatchModel.ProxyProtocol = core.StringPtr("disabled") - loadBalancerPoolPatchModel.SessionPersistence = loadBalancerPoolSessionPersistencePatchModel - loadBalancerPoolPatchModelAsPatch, asPatchErr := loadBalancerPoolPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerPoolOptions model - updateLoadBalancerPoolOptionsModel := new(vpcv1.UpdateLoadBalancerPoolOptions) - updateLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerPoolOptionsModel.LoadBalancerPoolPatch = loadBalancerPoolPatchModelAsPatch - updateLoadBalancerPoolOptionsModel.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.UpdateLoadBalancerPoolWithContext(ctx, updateLoadBalancerPoolOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateLoadBalancerPool(updateLoadBalancerPoolOptionsModel) - 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.UpdateLoadBalancerPoolWithContext(ctx, updateLoadBalancerPoolOptionsModel) - 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(updateLoadBalancerPoolPath)) - 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{"testString"})) - 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", `{"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/123456::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() { - 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.UpdateLoadBalancerPool(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the LoadBalancerPoolHealthMonitorPatch model - loadBalancerPoolHealthMonitorPatchModel := new(vpcv1.LoadBalancerPoolHealthMonitorPatch) - loadBalancerPoolHealthMonitorPatchModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPatchModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPatchModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPatchModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPatchModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPatchModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolSessionPersistencePatch model - loadBalancerPoolSessionPersistencePatchModel := new(vpcv1.LoadBalancerPoolSessionPersistencePatch) - loadBalancerPoolSessionPersistencePatchModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePatchModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the LoadBalancerPoolPatch model - loadBalancerPoolPatchModel := new(vpcv1.LoadBalancerPoolPatch) - loadBalancerPoolPatchModel.Algorithm = core.StringPtr("least_connections") - loadBalancerPoolPatchModel.HealthMonitor = loadBalancerPoolHealthMonitorPatchModel - loadBalancerPoolPatchModel.Name = core.StringPtr("my-load-balancer-pool") - loadBalancerPoolPatchModel.Protocol = core.StringPtr("http") - loadBalancerPoolPatchModel.ProxyProtocol = core.StringPtr("disabled") - loadBalancerPoolPatchModel.SessionPersistence = loadBalancerPoolSessionPersistencePatchModel - loadBalancerPoolPatchModelAsPatch, asPatchErr := loadBalancerPoolPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerPoolOptions model - updateLoadBalancerPoolOptionsModel := new(vpcv1.UpdateLoadBalancerPoolOptions) - updateLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerPoolOptionsModel.LoadBalancerPoolPatch = loadBalancerPoolPatchModelAsPatch - updateLoadBalancerPoolOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateLoadBalancerPool(updateLoadBalancerPoolOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateLoadBalancerPool 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 LoadBalancerPoolHealthMonitorPatch model - loadBalancerPoolHealthMonitorPatchModel := new(vpcv1.LoadBalancerPoolHealthMonitorPatch) - loadBalancerPoolHealthMonitorPatchModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPatchModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPatchModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPatchModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPatchModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPatchModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolSessionPersistencePatch model - loadBalancerPoolSessionPersistencePatchModel := new(vpcv1.LoadBalancerPoolSessionPersistencePatch) - loadBalancerPoolSessionPersistencePatchModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePatchModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the LoadBalancerPoolPatch model - loadBalancerPoolPatchModel := new(vpcv1.LoadBalancerPoolPatch) - loadBalancerPoolPatchModel.Algorithm = core.StringPtr("least_connections") - loadBalancerPoolPatchModel.HealthMonitor = loadBalancerPoolHealthMonitorPatchModel - loadBalancerPoolPatchModel.Name = core.StringPtr("my-load-balancer-pool") - loadBalancerPoolPatchModel.Protocol = core.StringPtr("http") - loadBalancerPoolPatchModel.ProxyProtocol = core.StringPtr("disabled") - loadBalancerPoolPatchModel.SessionPersistence = loadBalancerPoolSessionPersistencePatchModel - loadBalancerPoolPatchModelAsPatch, asPatchErr := loadBalancerPoolPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerPoolOptions model - updateLoadBalancerPoolOptionsModel := new(vpcv1.UpdateLoadBalancerPoolOptions) - updateLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerPoolOptionsModel.LoadBalancerPoolPatch = loadBalancerPoolPatchModelAsPatch - updateLoadBalancerPoolOptionsModel.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.UpdateLoadBalancerPool(updateLoadBalancerPoolOptionsModel) - 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 UpdateLoadBalancerPoolOptions model with no property values - updateLoadBalancerPoolOptionsModelNew := new(vpcv1.UpdateLoadBalancerPoolOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateLoadBalancerPool(updateLoadBalancerPoolOptionsModelNew) - 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 UpdateLoadBalancerPool 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 LoadBalancerPoolHealthMonitorPatch model - loadBalancerPoolHealthMonitorPatchModel := new(vpcv1.LoadBalancerPoolHealthMonitorPatch) - loadBalancerPoolHealthMonitorPatchModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPatchModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPatchModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPatchModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPatchModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPatchModel.URLPath = core.StringPtr("/") - - // Construct an instance of the LoadBalancerPoolSessionPersistencePatch model - loadBalancerPoolSessionPersistencePatchModel := new(vpcv1.LoadBalancerPoolSessionPersistencePatch) - loadBalancerPoolSessionPersistencePatchModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePatchModel.Type = core.StringPtr("app_cookie") - - // Construct an instance of the LoadBalancerPoolPatch model - loadBalancerPoolPatchModel := new(vpcv1.LoadBalancerPoolPatch) - loadBalancerPoolPatchModel.Algorithm = core.StringPtr("least_connections") - loadBalancerPoolPatchModel.HealthMonitor = loadBalancerPoolHealthMonitorPatchModel - loadBalancerPoolPatchModel.Name = core.StringPtr("my-load-balancer-pool") - loadBalancerPoolPatchModel.Protocol = core.StringPtr("http") - loadBalancerPoolPatchModel.ProxyProtocol = core.StringPtr("disabled") - loadBalancerPoolPatchModel.SessionPersistence = loadBalancerPoolSessionPersistencePatchModel - loadBalancerPoolPatchModelAsPatch, asPatchErr := loadBalancerPoolPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerPoolOptions model - updateLoadBalancerPoolOptionsModel := new(vpcv1.UpdateLoadBalancerPoolOptions) - updateLoadBalancerPoolOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerPoolOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerPoolOptionsModel.LoadBalancerPoolPatch = loadBalancerPoolPatchModelAsPatch - updateLoadBalancerPoolOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateLoadBalancerPool(updateLoadBalancerPoolOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) - Operation response error`, func() { - version := "testString" - listLoadBalancerPoolMembersPath := "/load_balancers/testString/pools/testString/members" - 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(listLoadBalancerPoolMembersPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListLoadBalancerPoolMembers 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 ListLoadBalancerPoolMembersOptions model - listLoadBalancerPoolMembersOptionsModel := new(vpcv1.ListLoadBalancerPoolMembersOptions) - listLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") - listLoadBalancerPoolMembersOptionsModel.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.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptionsModel) - 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.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions)`, func() { - version := "testString" - listLoadBalancerPoolMembersPath := "/load_balancers/testString/pools/testString/members" - 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(listLoadBalancerPoolMembersPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}]}`) - })) - }) - It(`Invoke ListLoadBalancerPoolMembers 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 ListLoadBalancerPoolMembersOptions model - listLoadBalancerPoolMembersOptionsModel := new(vpcv1.ListLoadBalancerPoolMembersOptions) - listLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") - listLoadBalancerPoolMembersOptionsModel.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.ListLoadBalancerPoolMembersWithContext(ctx, listLoadBalancerPoolMembersOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptionsModel) - 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.ListLoadBalancerPoolMembersWithContext(ctx, listLoadBalancerPoolMembersOptionsModel) - 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(listLoadBalancerPoolMembersPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", `{"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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}]}`) - })) - }) - It(`Invoke ListLoadBalancerPoolMembers 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.ListLoadBalancerPoolMembers(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListLoadBalancerPoolMembersOptions model - listLoadBalancerPoolMembersOptionsModel := new(vpcv1.ListLoadBalancerPoolMembersOptions) - listLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") - listLoadBalancerPoolMembersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListLoadBalancerPoolMembers 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 ListLoadBalancerPoolMembersOptions model - listLoadBalancerPoolMembersOptionsModel := new(vpcv1.ListLoadBalancerPoolMembersOptions) - listLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") - listLoadBalancerPoolMembersOptionsModel.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.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptionsModel) - 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 ListLoadBalancerPoolMembersOptions model with no property values - listLoadBalancerPoolMembersOptionsModelNew := new(vpcv1.ListLoadBalancerPoolMembersOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptionsModelNew) - 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 ListLoadBalancerPoolMembers 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 ListLoadBalancerPoolMembersOptions model - listLoadBalancerPoolMembersOptionsModel := new(vpcv1.ListLoadBalancerPoolMembersOptions) - listLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") - listLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") - listLoadBalancerPoolMembersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) - Operation response error`, func() { - version := "testString" - createLoadBalancerPoolMemberPath := "/load_balancers/testString/pools/testString/members" - 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(createLoadBalancerPoolMemberPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the CreateLoadBalancerPoolMemberOptions model - createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) - createLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - createLoadBalancerPoolMemberOptionsModel.Port = core.Int64Ptr(int64(80)) - createLoadBalancerPoolMemberOptionsModel.Target = loadBalancerPoolMemberTargetPrototypeModel - createLoadBalancerPoolMemberOptionsModel.Weight = core.Int64Ptr(int64(50)) - createLoadBalancerPoolMemberOptionsModel.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.CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptionsModel) - 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.CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions)`, func() { - version := "testString" - createLoadBalancerPoolMemberPath := "/load_balancers/testString/pools/testString/members" - 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(createLoadBalancerPoolMemberPath)) - 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{"testString"})) - 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) - })) - }) - It(`Invoke CreateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the CreateLoadBalancerPoolMemberOptions model - createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) - createLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - createLoadBalancerPoolMemberOptionsModel.Port = core.Int64Ptr(int64(80)) - createLoadBalancerPoolMemberOptionsModel.Target = loadBalancerPoolMemberTargetPrototypeModel - createLoadBalancerPoolMemberOptionsModel.Weight = core.Int64Ptr(int64(50)) - createLoadBalancerPoolMemberOptionsModel.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.CreateLoadBalancerPoolMemberWithContext(ctx, createLoadBalancerPoolMemberOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptionsModel) - 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.CreateLoadBalancerPoolMemberWithContext(ctx, createLoadBalancerPoolMemberOptionsModel) - 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(createLoadBalancerPoolMemberPath)) - 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{"testString"})) - 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) - })) - }) - It(`Invoke CreateLoadBalancerPoolMember 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.CreateLoadBalancerPoolMember(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the CreateLoadBalancerPoolMemberOptions model - createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) - createLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - createLoadBalancerPoolMemberOptionsModel.Port = core.Int64Ptr(int64(80)) - createLoadBalancerPoolMemberOptionsModel.Target = loadBalancerPoolMemberTargetPrototypeModel - createLoadBalancerPoolMemberOptionsModel.Weight = core.Int64Ptr(int64(50)) - createLoadBalancerPoolMemberOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the CreateLoadBalancerPoolMemberOptions model - createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) - createLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - createLoadBalancerPoolMemberOptionsModel.Port = core.Int64Ptr(int64(80)) - createLoadBalancerPoolMemberOptionsModel.Target = loadBalancerPoolMemberTargetPrototypeModel - createLoadBalancerPoolMemberOptionsModel.Weight = core.Int64Ptr(int64(50)) - createLoadBalancerPoolMemberOptionsModel.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.CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptionsModel) - 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 CreateLoadBalancerPoolMemberOptions model with no property values - createLoadBalancerPoolMemberOptionsModelNew := new(vpcv1.CreateLoadBalancerPoolMemberOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptionsModelNew) - 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 CreateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the CreateLoadBalancerPoolMemberOptions model - createLoadBalancerPoolMemberOptionsModel := new(vpcv1.CreateLoadBalancerPoolMemberOptions) - createLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - createLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - createLoadBalancerPoolMemberOptionsModel.Port = core.Int64Ptr(int64(80)) - createLoadBalancerPoolMemberOptionsModel.Target = loadBalancerPoolMemberTargetPrototypeModel - createLoadBalancerPoolMemberOptionsModel.Weight = core.Int64Ptr(int64(50)) - createLoadBalancerPoolMemberOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) - Operation response error`, func() { - version := "testString" - replaceLoadBalancerPoolMembersPath := "/load_balancers/testString/pools/testString/members" - 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(replaceLoadBalancerPoolMembersPath)) - Expect(req.Method).To(Equal("PUT")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ReplaceLoadBalancerPoolMembers 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the ReplaceLoadBalancerPoolMembersOptions model - replaceLoadBalancerPoolMembersOptionsModel := new(vpcv1.ReplaceLoadBalancerPoolMembersOptions) - replaceLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") - replaceLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") - replaceLoadBalancerPoolMembersOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - replaceLoadBalancerPoolMembersOptionsModel.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.ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptionsModel) - 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.ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions)`, func() { - version := "testString" - replaceLoadBalancerPoolMembersPath := "/load_balancers/testString/pools/testString/members" - 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(replaceLoadBalancerPoolMembersPath)) - 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{"testString"})) - 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", `{"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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}]}`) - })) - }) - It(`Invoke ReplaceLoadBalancerPoolMembers 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the ReplaceLoadBalancerPoolMembersOptions model - replaceLoadBalancerPoolMembersOptionsModel := new(vpcv1.ReplaceLoadBalancerPoolMembersOptions) - replaceLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") - replaceLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") - replaceLoadBalancerPoolMembersOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - replaceLoadBalancerPoolMembersOptionsModel.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.ReplaceLoadBalancerPoolMembersWithContext(ctx, replaceLoadBalancerPoolMembersOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptionsModel) - 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.ReplaceLoadBalancerPoolMembersWithContext(ctx, replaceLoadBalancerPoolMembersOptionsModel) - 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(replaceLoadBalancerPoolMembersPath)) - 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{"testString"})) - 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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}]}`) - })) - }) - It(`Invoke ReplaceLoadBalancerPoolMembers 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.ReplaceLoadBalancerPoolMembers(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the ReplaceLoadBalancerPoolMembersOptions model - replaceLoadBalancerPoolMembersOptionsModel := new(vpcv1.ReplaceLoadBalancerPoolMembersOptions) - replaceLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") - replaceLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") - replaceLoadBalancerPoolMembersOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - replaceLoadBalancerPoolMembersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ReplaceLoadBalancerPoolMembers 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the ReplaceLoadBalancerPoolMembersOptions model - replaceLoadBalancerPoolMembersOptionsModel := new(vpcv1.ReplaceLoadBalancerPoolMembersOptions) - replaceLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") - replaceLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") - replaceLoadBalancerPoolMembersOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - replaceLoadBalancerPoolMembersOptionsModel.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.ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptionsModel) - 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 ReplaceLoadBalancerPoolMembersOptions model with no property values - replaceLoadBalancerPoolMembersOptionsModelNew := new(vpcv1.ReplaceLoadBalancerPoolMembersOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptionsModelNew) - 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 ReplaceLoadBalancerPoolMembers 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - - // Construct an instance of the ReplaceLoadBalancerPoolMembersOptions model - replaceLoadBalancerPoolMembersOptionsModel := new(vpcv1.ReplaceLoadBalancerPoolMembersOptions) - replaceLoadBalancerPoolMembersOptionsModel.LoadBalancerID = core.StringPtr("testString") - replaceLoadBalancerPoolMembersOptionsModel.PoolID = core.StringPtr("testString") - replaceLoadBalancerPoolMembersOptionsModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - replaceLoadBalancerPoolMembersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions)`, func() { - version := "testString" - deleteLoadBalancerPoolMemberPath := "/load_balancers/testString/pools/testString/members/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(deleteLoadBalancerPoolMemberPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(202) - })) - }) - It(`Invoke DeleteLoadBalancerPoolMember 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.DeleteLoadBalancerPoolMember(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteLoadBalancerPoolMemberOptions model - deleteLoadBalancerPoolMemberOptionsModel := new(vpcv1.DeleteLoadBalancerPoolMemberOptions) - deleteLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - deleteLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - deleteLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") - deleteLoadBalancerPoolMemberOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteLoadBalancerPoolMember 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 DeleteLoadBalancerPoolMemberOptions model - deleteLoadBalancerPoolMemberOptionsModel := new(vpcv1.DeleteLoadBalancerPoolMemberOptions) - deleteLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - deleteLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - deleteLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") - deleteLoadBalancerPoolMemberOptionsModel.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.DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteLoadBalancerPoolMemberOptions model with no property values - deleteLoadBalancerPoolMemberOptionsModelNew := new(vpcv1.DeleteLoadBalancerPoolMemberOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) - Operation response error`, func() { - version := "testString" - getLoadBalancerPoolMemberPath := "/load_balancers/testString/pools/testString/members/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(getLoadBalancerPoolMemberPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetLoadBalancerPoolMember 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 GetLoadBalancerPoolMemberOptions model - getLoadBalancerPoolMemberOptionsModel := new(vpcv1.GetLoadBalancerPoolMemberOptions) - getLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.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.GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptionsModel) - 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.GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions)`, func() { - version := "testString" - getLoadBalancerPoolMemberPath := "/load_balancers/testString/pools/testString/members/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(getLoadBalancerPoolMemberPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) - })) - }) - It(`Invoke GetLoadBalancerPoolMember 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 GetLoadBalancerPoolMemberOptions model - getLoadBalancerPoolMemberOptionsModel := new(vpcv1.GetLoadBalancerPoolMemberOptions) - getLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.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.GetLoadBalancerPoolMemberWithContext(ctx, getLoadBalancerPoolMemberOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptionsModel) - 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.GetLoadBalancerPoolMemberWithContext(ctx, getLoadBalancerPoolMemberOptionsModel) - 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(getLoadBalancerPoolMemberPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) - })) - }) - It(`Invoke GetLoadBalancerPoolMember 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.GetLoadBalancerPoolMember(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetLoadBalancerPoolMemberOptions model - getLoadBalancerPoolMemberOptionsModel := new(vpcv1.GetLoadBalancerPoolMemberOptions) - getLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetLoadBalancerPoolMember 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 GetLoadBalancerPoolMemberOptions model - getLoadBalancerPoolMemberOptionsModel := new(vpcv1.GetLoadBalancerPoolMemberOptions) - getLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.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.GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptionsModel) - 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 GetLoadBalancerPoolMemberOptions model with no property values - getLoadBalancerPoolMemberOptionsModelNew := new(vpcv1.GetLoadBalancerPoolMemberOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptionsModelNew) - 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 GetLoadBalancerPoolMember 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 GetLoadBalancerPoolMemberOptions model - getLoadBalancerPoolMemberOptionsModel := new(vpcv1.GetLoadBalancerPoolMemberOptions) - getLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") - getLoadBalancerPoolMemberOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) - Operation response error`, func() { - version := "testString" - updateLoadBalancerPoolMemberPath := "/load_balancers/testString/pools/testString/members/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(updateLoadBalancerPoolMemberPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPatch model - loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) - loadBalancerPoolMemberPatchModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPatchModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPatchModel.Weight = core.Int64Ptr(int64(50)) - loadBalancerPoolMemberPatchModelAsPatch, asPatchErr := loadBalancerPoolMemberPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerPoolMemberOptions model - updateLoadBalancerPoolMemberOptionsModel := new(vpcv1.UpdateLoadBalancerPoolMemberOptions) - updateLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatchModelAsPatch - updateLoadBalancerPoolMemberOptionsModel.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.UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptionsModel) - 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.UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions)`, func() { - version := "testString" - updateLoadBalancerPoolMemberPath := "/load_balancers/testString/pools/testString/members/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(updateLoadBalancerPoolMemberPath)) - 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{"testString"})) - 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) - })) - }) - It(`Invoke UpdateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPatch model - loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) - loadBalancerPoolMemberPatchModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPatchModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPatchModel.Weight = core.Int64Ptr(int64(50)) - loadBalancerPoolMemberPatchModelAsPatch, asPatchErr := loadBalancerPoolMemberPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerPoolMemberOptions model - updateLoadBalancerPoolMemberOptionsModel := new(vpcv1.UpdateLoadBalancerPoolMemberOptions) - updateLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatchModelAsPatch - updateLoadBalancerPoolMemberOptionsModel.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.UpdateLoadBalancerPoolMemberWithContext(ctx, updateLoadBalancerPoolMemberOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptionsModel) - 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.UpdateLoadBalancerPoolMemberWithContext(ctx, updateLoadBalancerPoolMemberOptionsModel) - 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(updateLoadBalancerPoolMemberPath)) - 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{"testString"})) - 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", "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/123456::instance: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/instances/1e09281b-f177-46fb-baf1-bc152b2e391a", "id": "1e09281b-f177-46fb-baf1-bc152b2e391a", "name": "my-instance"}, "weight": 50}`) - })) - }) - It(`Invoke UpdateLoadBalancerPoolMember 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.UpdateLoadBalancerPoolMember(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPatch model - loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) - loadBalancerPoolMemberPatchModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPatchModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPatchModel.Weight = core.Int64Ptr(int64(50)) - loadBalancerPoolMemberPatchModelAsPatch, asPatchErr := loadBalancerPoolMemberPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerPoolMemberOptions model - updateLoadBalancerPoolMemberOptionsModel := new(vpcv1.UpdateLoadBalancerPoolMemberOptions) - updateLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatchModelAsPatch - updateLoadBalancerPoolMemberOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPatch model - loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) - loadBalancerPoolMemberPatchModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPatchModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPatchModel.Weight = core.Int64Ptr(int64(50)) - loadBalancerPoolMemberPatchModelAsPatch, asPatchErr := loadBalancerPoolMemberPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerPoolMemberOptions model - updateLoadBalancerPoolMemberOptionsModel := new(vpcv1.UpdateLoadBalancerPoolMemberOptions) - updateLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatchModelAsPatch - updateLoadBalancerPoolMemberOptionsModel.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.UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptionsModel) - 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 UpdateLoadBalancerPoolMemberOptions model with no property values - updateLoadBalancerPoolMemberOptionsModelNew := new(vpcv1.UpdateLoadBalancerPoolMemberOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptionsModelNew) - 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 UpdateLoadBalancerPoolMember 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 LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - - // Construct an instance of the LoadBalancerPoolMemberPatch model - loadBalancerPoolMemberPatchModel := new(vpcv1.LoadBalancerPoolMemberPatch) - loadBalancerPoolMemberPatchModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPatchModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPatchModel.Weight = core.Int64Ptr(int64(50)) - loadBalancerPoolMemberPatchModelAsPatch, asPatchErr := loadBalancerPoolMemberPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateLoadBalancerPoolMemberOptions model - updateLoadBalancerPoolMemberOptionsModel := new(vpcv1.UpdateLoadBalancerPoolMemberOptions) - updateLoadBalancerPoolMemberOptionsModel.LoadBalancerID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.PoolID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.ID = core.StringPtr("testString") - updateLoadBalancerPoolMemberOptionsModel.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatchModelAsPatch - updateLoadBalancerPoolMemberOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListEndpointGateways(listEndpointGatewaysOptions *ListEndpointGatewaysOptions) - Operation response error`, func() { - version := "testString" - listEndpointGatewaysPath := "/endpoint_gateways" - 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(listEndpointGatewaysPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).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"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListEndpointGateways 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 ListEndpointGatewaysOptions model - listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) - listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.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.ListEndpointGateways(listEndpointGatewaysOptionsModel) - 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.ListEndpointGateways(listEndpointGatewaysOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListEndpointGateways(listEndpointGatewaysOptions *ListEndpointGatewaysOptions)`, func() { - version := "testString" - listEndpointGatewaysPath := "/endpoint_gateways" - 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(listEndpointGatewaysPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).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"})) - // 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", `{"endpoint_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) - })) - }) - It(`Invoke ListEndpointGateways 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 ListEndpointGatewaysOptions model - listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) - listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.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.ListEndpointGatewaysWithContext(ctx, listEndpointGatewaysOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListEndpointGateways(listEndpointGatewaysOptionsModel) - 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.ListEndpointGatewaysWithContext(ctx, listEndpointGatewaysOptionsModel) - 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(listEndpointGatewaysPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - Expect(req.URL.Query()["name"]).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"})) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"endpoint_gateways": [{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) - })) - }) - It(`Invoke ListEndpointGateways 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.ListEndpointGateways(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListEndpointGatewaysOptions model - listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) - listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListEndpointGateways(listEndpointGatewaysOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListEndpointGateways 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 ListEndpointGatewaysOptions model - listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) - listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.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.ListEndpointGateways(listEndpointGatewaysOptionsModel) - 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 ListEndpointGateways 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 ListEndpointGatewaysOptions model - listEndpointGatewaysOptionsModel := new(vpcv1.ListEndpointGatewaysOptions) - listEndpointGatewaysOptionsModel.Name = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Limit = core.Int64Ptr(int64(10)) - listEndpointGatewaysOptionsModel.ResourceGroupID = core.StringPtr("testString") - listEndpointGatewaysOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListEndpointGateways(listEndpointGatewaysOptionsModel) - 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.EndpointGatewayCollection) - nextObject := new(vpcv1.EndpointGatewayCollectionNext) - 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.EndpointGatewayCollection) - - 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.EndpointGatewayCollection) - nextObject := new(vpcv1.EndpointGatewayCollectionNext) - 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(listEndpointGatewaysPath)) - 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"},"endpoint_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5","health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::","resource_type":"provider_cloud_service"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"endpoint_gateways":[{"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5","health_state":"ok","href":"https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","name":"my-reserved-ip","resource_type":"subnet_reserved_ip"}],"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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271","id":"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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::","resource_type":"provider_cloud_service"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}],"total_count":2,"limit":1}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use EndpointGatewaysPager.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()) - - listEndpointGatewaysOptionsModel := &vpcv1.ListEndpointGatewaysOptions{ - Name: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - } - - pager, err := vpcService.NewEndpointGatewaysPager(listEndpointGatewaysOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.EndpointGateway - 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 EndpointGatewaysPager.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()) - - listEndpointGatewaysOptionsModel := &vpcv1.ListEndpointGatewaysOptions{ - Name: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - } - - pager, err := vpcService.NewEndpointGatewaysPager(listEndpointGatewaysOptionsModel) - 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(`CreateEndpointGateway(createEndpointGatewayOptions *CreateEndpointGatewayOptions) - Operation response error`, func() { - version := "testString" - createEndpointGatewayPath := "/endpoint_gateways" - 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(createEndpointGatewayPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateEndpointGateway 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 EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName model - endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) - endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") - endpointGatewayTargetPrototypeModel.Name = core.StringPtr("ibm-ntp-server") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f025b503-ae66-46de-a011-3bd08fd5f7bf") - - // Construct an instance of the EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID model - endpointGatewayReservedIPModel := new(vpcv1.EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) - endpointGatewayReservedIPModel.ID = core.StringPtr("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("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the CreateEndpointGatewayOptions model - createEndpointGatewayOptionsModel := new(vpcv1.CreateEndpointGatewayOptions) - createEndpointGatewayOptionsModel.Target = endpointGatewayTargetPrototypeModel - createEndpointGatewayOptionsModel.VPC = vpcIdentityModel - createEndpointGatewayOptionsModel.Ips = []vpcv1.EndpointGatewayReservedIPIntf{endpointGatewayReservedIPModel} - createEndpointGatewayOptionsModel.Name = core.StringPtr("testString") - createEndpointGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel - createEndpointGatewayOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createEndpointGatewayOptionsModel.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.CreateEndpointGateway(createEndpointGatewayOptionsModel) - 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.CreateEndpointGateway(createEndpointGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateEndpointGateway(createEndpointGatewayOptions *CreateEndpointGatewayOptions)`, func() { - version := "testString" - createEndpointGatewayPath := "/endpoint_gateways" - 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(createEndpointGatewayPath)) - 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{"testString"})) - 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", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke CreateEndpointGateway 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 EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName model - endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) - endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") - endpointGatewayTargetPrototypeModel.Name = core.StringPtr("ibm-ntp-server") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f025b503-ae66-46de-a011-3bd08fd5f7bf") - - // Construct an instance of the EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID model - endpointGatewayReservedIPModel := new(vpcv1.EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) - endpointGatewayReservedIPModel.ID = core.StringPtr("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("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the CreateEndpointGatewayOptions model - createEndpointGatewayOptionsModel := new(vpcv1.CreateEndpointGatewayOptions) - createEndpointGatewayOptionsModel.Target = endpointGatewayTargetPrototypeModel - createEndpointGatewayOptionsModel.VPC = vpcIdentityModel - createEndpointGatewayOptionsModel.Ips = []vpcv1.EndpointGatewayReservedIPIntf{endpointGatewayReservedIPModel} - createEndpointGatewayOptionsModel.Name = core.StringPtr("testString") - createEndpointGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel - createEndpointGatewayOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createEndpointGatewayOptionsModel.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.CreateEndpointGatewayWithContext(ctx, createEndpointGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateEndpointGateway(createEndpointGatewayOptionsModel) - 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.CreateEndpointGatewayWithContext(ctx, createEndpointGatewayOptionsModel) - 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(createEndpointGatewayPath)) - 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{"testString"})) - 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/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke CreateEndpointGateway 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.CreateEndpointGateway(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName model - endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) - endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") - endpointGatewayTargetPrototypeModel.Name = core.StringPtr("ibm-ntp-server") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f025b503-ae66-46de-a011-3bd08fd5f7bf") - - // Construct an instance of the EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID model - endpointGatewayReservedIPModel := new(vpcv1.EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) - endpointGatewayReservedIPModel.ID = core.StringPtr("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("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the CreateEndpointGatewayOptions model - createEndpointGatewayOptionsModel := new(vpcv1.CreateEndpointGatewayOptions) - createEndpointGatewayOptionsModel.Target = endpointGatewayTargetPrototypeModel - createEndpointGatewayOptionsModel.VPC = vpcIdentityModel - createEndpointGatewayOptionsModel.Ips = []vpcv1.EndpointGatewayReservedIPIntf{endpointGatewayReservedIPModel} - createEndpointGatewayOptionsModel.Name = core.StringPtr("testString") - createEndpointGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel - createEndpointGatewayOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createEndpointGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateEndpointGateway(createEndpointGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateEndpointGateway 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 EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName model - endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) - endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") - endpointGatewayTargetPrototypeModel.Name = core.StringPtr("ibm-ntp-server") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f025b503-ae66-46de-a011-3bd08fd5f7bf") - - // Construct an instance of the EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID model - endpointGatewayReservedIPModel := new(vpcv1.EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) - endpointGatewayReservedIPModel.ID = core.StringPtr("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("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the CreateEndpointGatewayOptions model - createEndpointGatewayOptionsModel := new(vpcv1.CreateEndpointGatewayOptions) - createEndpointGatewayOptionsModel.Target = endpointGatewayTargetPrototypeModel - createEndpointGatewayOptionsModel.VPC = vpcIdentityModel - createEndpointGatewayOptionsModel.Ips = []vpcv1.EndpointGatewayReservedIPIntf{endpointGatewayReservedIPModel} - createEndpointGatewayOptionsModel.Name = core.StringPtr("testString") - createEndpointGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel - createEndpointGatewayOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createEndpointGatewayOptionsModel.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.CreateEndpointGateway(createEndpointGatewayOptionsModel) - 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 CreateEndpointGatewayOptions model with no property values - createEndpointGatewayOptionsModelNew := new(vpcv1.CreateEndpointGatewayOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateEndpointGateway(createEndpointGatewayOptionsModelNew) - 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 CreateEndpointGateway 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 EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName model - endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) - endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") - endpointGatewayTargetPrototypeModel.Name = core.StringPtr("ibm-ntp-server") - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - vpcIdentityModel.ID = core.StringPtr("f025b503-ae66-46de-a011-3bd08fd5f7bf") - - // Construct an instance of the EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID model - endpointGatewayReservedIPModel := new(vpcv1.EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) - endpointGatewayReservedIPModel.ID = core.StringPtr("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("be5df5ca-12a0-494b-907e-aa6ec2bfa271") - - // Construct an instance of the CreateEndpointGatewayOptions model - createEndpointGatewayOptionsModel := new(vpcv1.CreateEndpointGatewayOptions) - createEndpointGatewayOptionsModel.Target = endpointGatewayTargetPrototypeModel - createEndpointGatewayOptionsModel.VPC = vpcIdentityModel - createEndpointGatewayOptionsModel.Ips = []vpcv1.EndpointGatewayReservedIPIntf{endpointGatewayReservedIPModel} - createEndpointGatewayOptionsModel.Name = core.StringPtr("testString") - createEndpointGatewayOptionsModel.ResourceGroup = resourceGroupIdentityModel - createEndpointGatewayOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - createEndpointGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateEndpointGateway(createEndpointGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) - Operation response error`, func() { - version := "testString" - listEndpointGatewayIpsPath := "/endpoint_gateways/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(listEndpointGatewayIpsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 ListEndpointGatewayIps 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 ListEndpointGatewayIpsOptions model - listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) - listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") - listEndpointGatewayIpsOptionsModel.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.ListEndpointGatewayIps(listEndpointGatewayIpsOptionsModel) - 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.ListEndpointGatewayIps(listEndpointGatewayIpsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions)`, func() { - version := "testString" - listEndpointGatewayIpsPath := "/endpoint_gateways/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(listEndpointGatewayIpsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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}`) - })) - }) - It(`Invoke ListEndpointGatewayIps 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 ListEndpointGatewayIpsOptions model - listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) - listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") - listEndpointGatewayIpsOptionsModel.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.ListEndpointGatewayIpsWithContext(ctx, listEndpointGatewayIpsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListEndpointGatewayIps(listEndpointGatewayIpsOptionsModel) - 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.ListEndpointGatewayIpsWithContext(ctx, listEndpointGatewayIpsOptionsModel) - 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(listEndpointGatewayIpsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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}`) - })) - }) - It(`Invoke ListEndpointGatewayIps 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.ListEndpointGatewayIps(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListEndpointGatewayIpsOptions model - listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) - listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") - listEndpointGatewayIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListEndpointGatewayIps(listEndpointGatewayIpsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListEndpointGatewayIps 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 ListEndpointGatewayIpsOptions model - listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) - listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") - listEndpointGatewayIpsOptionsModel.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.ListEndpointGatewayIps(listEndpointGatewayIpsOptionsModel) - 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 ListEndpointGatewayIpsOptions model with no property values - listEndpointGatewayIpsOptionsModelNew := new(vpcv1.ListEndpointGatewayIpsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListEndpointGatewayIps(listEndpointGatewayIpsOptionsModelNew) - 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 ListEndpointGatewayIps 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 ListEndpointGatewayIpsOptions model - listEndpointGatewayIpsOptionsModel := new(vpcv1.ListEndpointGatewayIpsOptions) - listEndpointGatewayIpsOptionsModel.EndpointGatewayID = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Start = core.StringPtr("testString") - listEndpointGatewayIpsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listEndpointGatewayIpsOptionsModel.Sort = core.StringPtr("name") - listEndpointGatewayIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListEndpointGatewayIps(listEndpointGatewayIpsOptionsModel) - 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.ReservedIPCollectionEndpointGatewayContext) - nextObject := new(vpcv1.ReservedIPCollectionEndpointGatewayContextNext) - 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.ReservedIPCollectionEndpointGatewayContext) - - 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.ReservedIPCollectionEndpointGatewayContext) - nextObject := new(vpcv1.ReservedIPCollectionEndpointGatewayContextNext) - 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(listEndpointGatewayIpsPath)) - 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"user","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb","id":"6d353a0f-aeb1-4ae1-832e-1110d10981bb","lifecycle_state":"stable","name":"my-reserved-ip","owner":"user","resource_type":"subnet_reserved_ip","target":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5","id":"d7cc5196-9864-48c4-82d8-3f30da41fcc5","name":"my-endpoint-gateway","resource_type":"endpoint_gateway"}}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use EndpointGatewayIpsPager.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()) - - listEndpointGatewayIpsOptionsModel := &vpcv1.ListEndpointGatewayIpsOptions{ - EndpointGatewayID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - } - - pager, err := vpcService.NewEndpointGatewayIpsPager(listEndpointGatewayIpsOptionsModel) - 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 EndpointGatewayIpsPager.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()) - - listEndpointGatewayIpsOptionsModel := &vpcv1.ListEndpointGatewayIpsOptions{ - EndpointGatewayID: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(10)), - Sort: core.StringPtr("name"), - } - - pager, err := vpcService.NewEndpointGatewayIpsPager(listEndpointGatewayIpsOptionsModel) - 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(`RemoveEndpointGatewayIP(removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions)`, func() { - version := "testString" - removeEndpointGatewayIPPath := "/endpoint_gateways/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(removeEndpointGatewayIPPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke RemoveEndpointGatewayIP 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.RemoveEndpointGatewayIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the RemoveEndpointGatewayIPOptions model - removeEndpointGatewayIPOptionsModel := new(vpcv1.RemoveEndpointGatewayIPOptions) - removeEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") - removeEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") - removeEndpointGatewayIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.RemoveEndpointGatewayIP(removeEndpointGatewayIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke RemoveEndpointGatewayIP 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 RemoveEndpointGatewayIPOptions model - removeEndpointGatewayIPOptionsModel := new(vpcv1.RemoveEndpointGatewayIPOptions) - removeEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") - removeEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") - removeEndpointGatewayIPOptionsModel.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.RemoveEndpointGatewayIP(removeEndpointGatewayIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the RemoveEndpointGatewayIPOptions model with no property values - removeEndpointGatewayIPOptionsModelNew := new(vpcv1.RemoveEndpointGatewayIPOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.RemoveEndpointGatewayIP(removeEndpointGatewayIPOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetEndpointGatewayIP(getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) - Operation response error`, func() { - version := "testString" - getEndpointGatewayIPPath := "/endpoint_gateways/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(getEndpointGatewayIPPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetEndpointGatewayIP 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 GetEndpointGatewayIPOptions model - getEndpointGatewayIPOptionsModel := new(vpcv1.GetEndpointGatewayIPOptions) - getEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") - getEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") - getEndpointGatewayIPOptionsModel.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.GetEndpointGatewayIP(getEndpointGatewayIPOptionsModel) - 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.GetEndpointGatewayIP(getEndpointGatewayIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetEndpointGatewayIP(getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions)`, func() { - version := "testString" - getEndpointGatewayIPPath := "/endpoint_gateways/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(getEndpointGatewayIPPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) - })) - }) - It(`Invoke GetEndpointGatewayIP 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 GetEndpointGatewayIPOptions model - getEndpointGatewayIPOptionsModel := new(vpcv1.GetEndpointGatewayIPOptions) - getEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") - getEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") - getEndpointGatewayIPOptionsModel.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.GetEndpointGatewayIPWithContext(ctx, getEndpointGatewayIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetEndpointGatewayIP(getEndpointGatewayIPOptionsModel) - 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.GetEndpointGatewayIPWithContext(ctx, getEndpointGatewayIPOptionsModel) - 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(getEndpointGatewayIPPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) - })) - }) - It(`Invoke GetEndpointGatewayIP 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.GetEndpointGatewayIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetEndpointGatewayIPOptions model - getEndpointGatewayIPOptionsModel := new(vpcv1.GetEndpointGatewayIPOptions) - getEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") - getEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") - getEndpointGatewayIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetEndpointGatewayIP(getEndpointGatewayIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetEndpointGatewayIP 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 GetEndpointGatewayIPOptions model - getEndpointGatewayIPOptionsModel := new(vpcv1.GetEndpointGatewayIPOptions) - getEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") - getEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") - getEndpointGatewayIPOptionsModel.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.GetEndpointGatewayIP(getEndpointGatewayIPOptionsModel) - 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 GetEndpointGatewayIPOptions model with no property values - getEndpointGatewayIPOptionsModelNew := new(vpcv1.GetEndpointGatewayIPOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetEndpointGatewayIP(getEndpointGatewayIPOptionsModelNew) - 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 GetEndpointGatewayIP 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 GetEndpointGatewayIPOptions model - getEndpointGatewayIPOptionsModel := new(vpcv1.GetEndpointGatewayIPOptions) - getEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") - getEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") - getEndpointGatewayIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetEndpointGatewayIP(getEndpointGatewayIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`AddEndpointGatewayIP(addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) - Operation response error`, func() { - version := "testString" - addEndpointGatewayIPPath := "/endpoint_gateways/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(addEndpointGatewayIPPath)) - Expect(req.Method).To(Equal("PUT")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 AddEndpointGatewayIP 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 AddEndpointGatewayIPOptions model - addEndpointGatewayIPOptionsModel := new(vpcv1.AddEndpointGatewayIPOptions) - addEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") - addEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") - addEndpointGatewayIPOptionsModel.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.AddEndpointGatewayIP(addEndpointGatewayIPOptionsModel) - 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.AddEndpointGatewayIP(addEndpointGatewayIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`AddEndpointGatewayIP(addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions)`, func() { - version := "testString" - addEndpointGatewayIPPath := "/endpoint_gateways/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(addEndpointGatewayIPPath)) - Expect(req.Method).To(Equal("PUT")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) - })) - }) - It(`Invoke AddEndpointGatewayIP 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 AddEndpointGatewayIPOptions model - addEndpointGatewayIPOptionsModel := new(vpcv1.AddEndpointGatewayIPOptions) - addEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") - addEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") - addEndpointGatewayIPOptionsModel.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.AddEndpointGatewayIPWithContext(ctx, addEndpointGatewayIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.AddEndpointGatewayIP(addEndpointGatewayIPOptionsModel) - 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.AddEndpointGatewayIPWithContext(ctx, addEndpointGatewayIPOptionsModel) - 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(addEndpointGatewayIPPath)) - Expect(req.Method).To(Equal("PUT")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway: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/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) - })) - }) - It(`Invoke AddEndpointGatewayIP 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.AddEndpointGatewayIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the AddEndpointGatewayIPOptions model - addEndpointGatewayIPOptionsModel := new(vpcv1.AddEndpointGatewayIPOptions) - addEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") - addEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") - addEndpointGatewayIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.AddEndpointGatewayIP(addEndpointGatewayIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke AddEndpointGatewayIP 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 AddEndpointGatewayIPOptions model - addEndpointGatewayIPOptionsModel := new(vpcv1.AddEndpointGatewayIPOptions) - addEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") - addEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") - addEndpointGatewayIPOptionsModel.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.AddEndpointGatewayIP(addEndpointGatewayIPOptionsModel) - 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 AddEndpointGatewayIPOptions model with no property values - addEndpointGatewayIPOptionsModelNew := new(vpcv1.AddEndpointGatewayIPOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.AddEndpointGatewayIP(addEndpointGatewayIPOptionsModelNew) - 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 AddEndpointGatewayIP 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 AddEndpointGatewayIPOptions model - addEndpointGatewayIPOptionsModel := new(vpcv1.AddEndpointGatewayIPOptions) - addEndpointGatewayIPOptionsModel.EndpointGatewayID = core.StringPtr("testString") - addEndpointGatewayIPOptionsModel.ID = core.StringPtr("testString") - addEndpointGatewayIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.AddEndpointGatewayIP(addEndpointGatewayIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteEndpointGateway(deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions)`, func() { - version := "testString" - deleteEndpointGatewayPath := "/endpoint_gateways/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(deleteEndpointGatewayPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteEndpointGateway 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.DeleteEndpointGateway(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteEndpointGatewayOptions model - deleteEndpointGatewayOptionsModel := new(vpcv1.DeleteEndpointGatewayOptions) - deleteEndpointGatewayOptionsModel.ID = core.StringPtr("testString") - deleteEndpointGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteEndpointGateway(deleteEndpointGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteEndpointGateway 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 DeleteEndpointGatewayOptions model - deleteEndpointGatewayOptionsModel := new(vpcv1.DeleteEndpointGatewayOptions) - deleteEndpointGatewayOptionsModel.ID = core.StringPtr("testString") - deleteEndpointGatewayOptionsModel.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.DeleteEndpointGateway(deleteEndpointGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteEndpointGatewayOptions model with no property values - deleteEndpointGatewayOptionsModelNew := new(vpcv1.DeleteEndpointGatewayOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteEndpointGateway(deleteEndpointGatewayOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetEndpointGateway(getEndpointGatewayOptions *GetEndpointGatewayOptions) - Operation response error`, func() { - version := "testString" - getEndpointGatewayPath := "/endpoint_gateways/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(getEndpointGatewayPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetEndpointGateway 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 GetEndpointGatewayOptions model - getEndpointGatewayOptionsModel := new(vpcv1.GetEndpointGatewayOptions) - getEndpointGatewayOptionsModel.ID = core.StringPtr("testString") - getEndpointGatewayOptionsModel.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.GetEndpointGateway(getEndpointGatewayOptionsModel) - 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.GetEndpointGateway(getEndpointGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetEndpointGateway(getEndpointGatewayOptions *GetEndpointGatewayOptions)`, func() { - version := "testString" - getEndpointGatewayPath := "/endpoint_gateways/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(getEndpointGatewayPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetEndpointGateway 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 GetEndpointGatewayOptions model - getEndpointGatewayOptionsModel := new(vpcv1.GetEndpointGatewayOptions) - getEndpointGatewayOptionsModel.ID = core.StringPtr("testString") - getEndpointGatewayOptionsModel.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.GetEndpointGatewayWithContext(ctx, getEndpointGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetEndpointGateway(getEndpointGatewayOptionsModel) - 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.GetEndpointGatewayWithContext(ctx, getEndpointGatewayOptionsModel) - 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(getEndpointGatewayPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetEndpointGateway 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.GetEndpointGateway(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetEndpointGatewayOptions model - getEndpointGatewayOptionsModel := new(vpcv1.GetEndpointGatewayOptions) - getEndpointGatewayOptionsModel.ID = core.StringPtr("testString") - getEndpointGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetEndpointGateway(getEndpointGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetEndpointGateway 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 GetEndpointGatewayOptions model - getEndpointGatewayOptionsModel := new(vpcv1.GetEndpointGatewayOptions) - getEndpointGatewayOptionsModel.ID = core.StringPtr("testString") - getEndpointGatewayOptionsModel.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.GetEndpointGateway(getEndpointGatewayOptionsModel) - 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 GetEndpointGatewayOptions model with no property values - getEndpointGatewayOptionsModelNew := new(vpcv1.GetEndpointGatewayOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetEndpointGateway(getEndpointGatewayOptionsModelNew) - 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 GetEndpointGateway 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 GetEndpointGatewayOptions model - getEndpointGatewayOptionsModel := new(vpcv1.GetEndpointGatewayOptions) - getEndpointGatewayOptionsModel.ID = core.StringPtr("testString") - getEndpointGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetEndpointGateway(getEndpointGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateEndpointGateway(updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) - Operation response error`, func() { - version := "testString" - updateEndpointGatewayPath := "/endpoint_gateways/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(updateEndpointGatewayPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateEndpointGateway 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 EndpointGatewayPatch model - endpointGatewayPatchModel := new(vpcv1.EndpointGatewayPatch) - endpointGatewayPatchModel.Name = core.StringPtr("my-endpoint-gateway") - endpointGatewayPatchModelAsPatch, asPatchErr := endpointGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateEndpointGatewayOptions model - updateEndpointGatewayOptionsModel := new(vpcv1.UpdateEndpointGatewayOptions) - updateEndpointGatewayOptionsModel.ID = core.StringPtr("testString") - updateEndpointGatewayOptionsModel.EndpointGatewayPatch = endpointGatewayPatchModelAsPatch - updateEndpointGatewayOptionsModel.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.UpdateEndpointGateway(updateEndpointGatewayOptionsModel) - 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.UpdateEndpointGateway(updateEndpointGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateEndpointGateway(updateEndpointGatewayOptions *UpdateEndpointGatewayOptions)`, func() { - version := "testString" - updateEndpointGatewayPath := "/endpoint_gateways/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(updateEndpointGatewayPath)) - 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{"testString"})) - 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/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke UpdateEndpointGateway 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 EndpointGatewayPatch model - endpointGatewayPatchModel := new(vpcv1.EndpointGatewayPatch) - endpointGatewayPatchModel.Name = core.StringPtr("my-endpoint-gateway") - endpointGatewayPatchModelAsPatch, asPatchErr := endpointGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateEndpointGatewayOptions model - updateEndpointGatewayOptionsModel := new(vpcv1.UpdateEndpointGatewayOptions) - updateEndpointGatewayOptionsModel.ID = core.StringPtr("testString") - updateEndpointGatewayOptionsModel.EndpointGatewayPatch = endpointGatewayPatchModelAsPatch - updateEndpointGatewayOptionsModel.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.UpdateEndpointGatewayWithContext(ctx, updateEndpointGatewayOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateEndpointGateway(updateEndpointGatewayOptionsModel) - 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.UpdateEndpointGatewayWithContext(ctx, updateEndpointGatewayOptionsModel) - 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(updateEndpointGatewayPath)) - 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{"testString"})) - 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/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "health_state": "ok", "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "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/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "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/123456::security-group: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/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "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:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::", "resource_type": "provider_cloud_service"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke UpdateEndpointGateway 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.UpdateEndpointGateway(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the EndpointGatewayPatch model - endpointGatewayPatchModel := new(vpcv1.EndpointGatewayPatch) - endpointGatewayPatchModel.Name = core.StringPtr("my-endpoint-gateway") - endpointGatewayPatchModelAsPatch, asPatchErr := endpointGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateEndpointGatewayOptions model - updateEndpointGatewayOptionsModel := new(vpcv1.UpdateEndpointGatewayOptions) - updateEndpointGatewayOptionsModel.ID = core.StringPtr("testString") - updateEndpointGatewayOptionsModel.EndpointGatewayPatch = endpointGatewayPatchModelAsPatch - updateEndpointGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateEndpointGateway(updateEndpointGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateEndpointGateway 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 EndpointGatewayPatch model - endpointGatewayPatchModel := new(vpcv1.EndpointGatewayPatch) - endpointGatewayPatchModel.Name = core.StringPtr("my-endpoint-gateway") - endpointGatewayPatchModelAsPatch, asPatchErr := endpointGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateEndpointGatewayOptions model - updateEndpointGatewayOptionsModel := new(vpcv1.UpdateEndpointGatewayOptions) - updateEndpointGatewayOptionsModel.ID = core.StringPtr("testString") - updateEndpointGatewayOptionsModel.EndpointGatewayPatch = endpointGatewayPatchModelAsPatch - updateEndpointGatewayOptionsModel.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.UpdateEndpointGateway(updateEndpointGatewayOptionsModel) - 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 UpdateEndpointGatewayOptions model with no property values - updateEndpointGatewayOptionsModelNew := new(vpcv1.UpdateEndpointGatewayOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateEndpointGateway(updateEndpointGatewayOptionsModelNew) - 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 UpdateEndpointGateway 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 EndpointGatewayPatch model - endpointGatewayPatchModel := new(vpcv1.EndpointGatewayPatch) - endpointGatewayPatchModel.Name = core.StringPtr("my-endpoint-gateway") - endpointGatewayPatchModelAsPatch, asPatchErr := endpointGatewayPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateEndpointGatewayOptions model - updateEndpointGatewayOptionsModel := new(vpcv1.UpdateEndpointGatewayOptions) - updateEndpointGatewayOptionsModel.ID = core.StringPtr("testString") - updateEndpointGatewayOptionsModel.EndpointGatewayPatch = endpointGatewayPatchModelAsPatch - updateEndpointGatewayOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateEndpointGateway(updateEndpointGatewayOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) - Operation response error`, func() { - version := "testString" - listFlowLogCollectorsPath := "/flow_log_collectors" - 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(listFlowLogCollectorsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target.resource_type"]).To(Equal([]string{"instance"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListFlowLogCollectors 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 ListFlowLogCollectorsOptions model - listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) - listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCCRN = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCName = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.TargetID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.TargetResourceType = core.StringPtr("instance") - listFlowLogCollectorsOptionsModel.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.ListFlowLogCollectors(listFlowLogCollectorsOptionsModel) - 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.ListFlowLogCollectors(listFlowLogCollectorsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions)`, func() { - version := "testString" - listFlowLogCollectorsPath := "/flow_log_collectors" - 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(listFlowLogCollectorsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target.resource_type"]).To(Equal([]string{"instance"})) - // 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/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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) - })) - }) - It(`Invoke ListFlowLogCollectors 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 ListFlowLogCollectorsOptions model - listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) - listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCCRN = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCName = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.TargetID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.TargetResourceType = core.StringPtr("instance") - listFlowLogCollectorsOptionsModel.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.ListFlowLogCollectorsWithContext(ctx, listFlowLogCollectorsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListFlowLogCollectors(listFlowLogCollectorsOptionsModel) - 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.ListFlowLogCollectorsWithContext(ctx, listFlowLogCollectorsOptionsModel) - 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(listFlowLogCollectorsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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{"testString"})) - Expect(req.URL.Query()["vpc.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.crn"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["vpc.name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target.id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target.resource_type"]).To(Equal([]string{"instance"})) - // 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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "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}`) - })) - }) - It(`Invoke ListFlowLogCollectors 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.ListFlowLogCollectors(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListFlowLogCollectorsOptions model - listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) - listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCCRN = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCName = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.TargetID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.TargetResourceType = core.StringPtr("instance") - listFlowLogCollectorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListFlowLogCollectors(listFlowLogCollectorsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListFlowLogCollectors 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 ListFlowLogCollectorsOptions model - listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) - listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCCRN = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCName = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.TargetID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.TargetResourceType = core.StringPtr("instance") - listFlowLogCollectorsOptionsModel.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.ListFlowLogCollectors(listFlowLogCollectorsOptionsModel) - 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 ListFlowLogCollectors 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 ListFlowLogCollectorsOptions model - listFlowLogCollectorsOptionsModel := new(vpcv1.ListFlowLogCollectorsOptions) - listFlowLogCollectorsOptionsModel.Start = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Limit = core.Int64Ptr(int64(10)) - listFlowLogCollectorsOptionsModel.ResourceGroupID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.Name = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCCRN = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.VPCName = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.TargetID = core.StringPtr("testString") - listFlowLogCollectorsOptionsModel.TargetResourceType = core.StringPtr("instance") - listFlowLogCollectorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListFlowLogCollectors(listFlowLogCollectorsOptionsModel) - 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.FlowLogCollectorCollection) - nextObject := new(vpcv1.FlowLogCollectorCollectionNext) - 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.FlowLogCollectorCollection) - - 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.FlowLogCollectorCollection) - nextObject := new(vpcv1.FlowLogCollectorCollectionNext) - 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(listFlowLogCollectorsPath)) - 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,"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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"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/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e","id":"10c02d81-0ecb-4dc5-897d-28392913b81e","name":"my-network-interface","resource_type":"network_interface"},"vpc":{"crn":"crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b","id":"4727d842-f94f-4a2d-824a-9bc9b02c523b","name":"my-vpc","resource_type":"vpc"}}]}`) - } else { - res.WriteHeader(400) - } - })) - }) - It(`Use FlowLogCollectorsPager.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()) - - listFlowLogCollectorsOptionsModel := &vpcv1.ListFlowLogCollectorsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - VPCID: core.StringPtr("testString"), - VPCCRN: core.StringPtr("testString"), - VPCName: core.StringPtr("testString"), - TargetID: core.StringPtr("testString"), - TargetResourceType: core.StringPtr("instance"), - } - - pager, err := vpcService.NewFlowLogCollectorsPager(listFlowLogCollectorsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - var allResults []vpcv1.FlowLogCollector - 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 FlowLogCollectorsPager.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()) - - listFlowLogCollectorsOptionsModel := &vpcv1.ListFlowLogCollectorsOptions{ - Limit: core.Int64Ptr(int64(10)), - ResourceGroupID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - VPCID: core.StringPtr("testString"), - VPCCRN: core.StringPtr("testString"), - VPCName: core.StringPtr("testString"), - TargetID: core.StringPtr("testString"), - TargetResourceType: core.StringPtr("instance"), - } - - pager, err := vpcService.NewFlowLogCollectorsPager(listFlowLogCollectorsOptionsModel) - 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(`CreateFlowLogCollector(createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) - Operation response error`, func() { - version := "testString" - createFlowLogCollectorPath := "/flow_log_collectors" - 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(createFlowLogCollectorPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 CreateFlowLogCollector 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 LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model - legacyCloudObjectStorageBucketIdentityModel := new(vpcv1.LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) - legacyCloudObjectStorageBucketIdentityModel.Name = core.StringPtr("bucket-27200-lwx4cfvcue") - - // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID model - flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateFlowLogCollectorOptions model - createFlowLogCollectorOptionsModel := new(vpcv1.CreateFlowLogCollectorOptions) - createFlowLogCollectorOptionsModel.StorageBucket = legacyCloudObjectStorageBucketIdentityModel - createFlowLogCollectorOptionsModel.Target = flowLogCollectorTargetPrototypeModel - createFlowLogCollectorOptionsModel.Active = core.BoolPtr(false) - createFlowLogCollectorOptionsModel.Name = core.StringPtr("my-flow-log-collector") - createFlowLogCollectorOptionsModel.ResourceGroup = resourceGroupIdentityModel - createFlowLogCollectorOptionsModel.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.CreateFlowLogCollector(createFlowLogCollectorOptionsModel) - 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.CreateFlowLogCollector(createFlowLogCollectorOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateFlowLogCollector(createFlowLogCollectorOptions *CreateFlowLogCollectorOptions)`, func() { - version := "testString" - createFlowLogCollectorPath := "/flow_log_collectors" - 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(createFlowLogCollectorPath)) - 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{"testString"})) - 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", `{"active": true, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke CreateFlowLogCollector 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 LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model - legacyCloudObjectStorageBucketIdentityModel := new(vpcv1.LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) - legacyCloudObjectStorageBucketIdentityModel.Name = core.StringPtr("bucket-27200-lwx4cfvcue") - - // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID model - flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateFlowLogCollectorOptions model - createFlowLogCollectorOptionsModel := new(vpcv1.CreateFlowLogCollectorOptions) - createFlowLogCollectorOptionsModel.StorageBucket = legacyCloudObjectStorageBucketIdentityModel - createFlowLogCollectorOptionsModel.Target = flowLogCollectorTargetPrototypeModel - createFlowLogCollectorOptionsModel.Active = core.BoolPtr(false) - createFlowLogCollectorOptionsModel.Name = core.StringPtr("my-flow-log-collector") - createFlowLogCollectorOptionsModel.ResourceGroup = resourceGroupIdentityModel - createFlowLogCollectorOptionsModel.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.CreateFlowLogCollectorWithContext(ctx, createFlowLogCollectorOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.CreateFlowLogCollector(createFlowLogCollectorOptionsModel) - 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.CreateFlowLogCollectorWithContext(ctx, createFlowLogCollectorOptionsModel) - 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(createFlowLogCollectorPath)) - 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{"testString"})) - 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, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke CreateFlowLogCollector 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.CreateFlowLogCollector(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model - legacyCloudObjectStorageBucketIdentityModel := new(vpcv1.LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) - legacyCloudObjectStorageBucketIdentityModel.Name = core.StringPtr("bucket-27200-lwx4cfvcue") - - // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID model - flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateFlowLogCollectorOptions model - createFlowLogCollectorOptionsModel := new(vpcv1.CreateFlowLogCollectorOptions) - createFlowLogCollectorOptionsModel.StorageBucket = legacyCloudObjectStorageBucketIdentityModel - createFlowLogCollectorOptionsModel.Target = flowLogCollectorTargetPrototypeModel - createFlowLogCollectorOptionsModel.Active = core.BoolPtr(false) - createFlowLogCollectorOptionsModel.Name = core.StringPtr("my-flow-log-collector") - createFlowLogCollectorOptionsModel.ResourceGroup = resourceGroupIdentityModel - createFlowLogCollectorOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.CreateFlowLogCollector(createFlowLogCollectorOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateFlowLogCollector 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 LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model - legacyCloudObjectStorageBucketIdentityModel := new(vpcv1.LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) - legacyCloudObjectStorageBucketIdentityModel.Name = core.StringPtr("bucket-27200-lwx4cfvcue") - - // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID model - flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateFlowLogCollectorOptions model - createFlowLogCollectorOptionsModel := new(vpcv1.CreateFlowLogCollectorOptions) - createFlowLogCollectorOptionsModel.StorageBucket = legacyCloudObjectStorageBucketIdentityModel - createFlowLogCollectorOptionsModel.Target = flowLogCollectorTargetPrototypeModel - createFlowLogCollectorOptionsModel.Active = core.BoolPtr(false) - createFlowLogCollectorOptionsModel.Name = core.StringPtr("my-flow-log-collector") - createFlowLogCollectorOptionsModel.ResourceGroup = resourceGroupIdentityModel - createFlowLogCollectorOptionsModel.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.CreateFlowLogCollector(createFlowLogCollectorOptionsModel) - 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 CreateFlowLogCollectorOptions model with no property values - createFlowLogCollectorOptionsModelNew := new(vpcv1.CreateFlowLogCollectorOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.CreateFlowLogCollector(createFlowLogCollectorOptionsModelNew) - 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 CreateFlowLogCollector 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 LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model - legacyCloudObjectStorageBucketIdentityModel := new(vpcv1.LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) - legacyCloudObjectStorageBucketIdentityModel.Name = core.StringPtr("bucket-27200-lwx4cfvcue") - - // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID model - flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - - // Construct an instance of the ResourceGroupIdentityByID model - resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) - resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") - - // Construct an instance of the CreateFlowLogCollectorOptions model - createFlowLogCollectorOptionsModel := new(vpcv1.CreateFlowLogCollectorOptions) - createFlowLogCollectorOptionsModel.StorageBucket = legacyCloudObjectStorageBucketIdentityModel - createFlowLogCollectorOptionsModel.Target = flowLogCollectorTargetPrototypeModel - createFlowLogCollectorOptionsModel.Active = core.BoolPtr(false) - createFlowLogCollectorOptionsModel.Name = core.StringPtr("my-flow-log-collector") - createFlowLogCollectorOptionsModel.ResourceGroup = resourceGroupIdentityModel - createFlowLogCollectorOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.CreateFlowLogCollector(createFlowLogCollectorOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteFlowLogCollector(deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions)`, func() { - version := "testString" - deleteFlowLogCollectorPath := "/flow_log_collectors/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(deleteFlowLogCollectorPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteFlowLogCollector 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.DeleteFlowLogCollector(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteFlowLogCollectorOptions model - deleteFlowLogCollectorOptionsModel := new(vpcv1.DeleteFlowLogCollectorOptions) - deleteFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") - deleteFlowLogCollectorOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = vpcService.DeleteFlowLogCollector(deleteFlowLogCollectorOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteFlowLogCollector 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 DeleteFlowLogCollectorOptions model - deleteFlowLogCollectorOptionsModel := new(vpcv1.DeleteFlowLogCollectorOptions) - deleteFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") - deleteFlowLogCollectorOptionsModel.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.DeleteFlowLogCollector(deleteFlowLogCollectorOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteFlowLogCollectorOptions model with no property values - deleteFlowLogCollectorOptionsModelNew := new(vpcv1.DeleteFlowLogCollectorOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = vpcService.DeleteFlowLogCollector(deleteFlowLogCollectorOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetFlowLogCollector(getFlowLogCollectorOptions *GetFlowLogCollectorOptions) - Operation response error`, func() { - version := "testString" - getFlowLogCollectorPath := "/flow_log_collectors/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(getFlowLogCollectorPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 GetFlowLogCollector 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 GetFlowLogCollectorOptions model - getFlowLogCollectorOptionsModel := new(vpcv1.GetFlowLogCollectorOptions) - getFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") - getFlowLogCollectorOptionsModel.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.GetFlowLogCollector(getFlowLogCollectorOptionsModel) - 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.GetFlowLogCollector(getFlowLogCollectorOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetFlowLogCollector(getFlowLogCollectorOptions *GetFlowLogCollectorOptions)`, func() { - version := "testString" - getFlowLogCollectorPath := "/flow_log_collectors/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(getFlowLogCollectorPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetFlowLogCollector 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 GetFlowLogCollectorOptions model - getFlowLogCollectorOptionsModel := new(vpcv1.GetFlowLogCollectorOptions) - getFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") - getFlowLogCollectorOptionsModel.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.GetFlowLogCollectorWithContext(ctx, getFlowLogCollectorOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetFlowLogCollector(getFlowLogCollectorOptionsModel) - 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.GetFlowLogCollectorWithContext(ctx, getFlowLogCollectorOptionsModel) - 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(getFlowLogCollectorPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke GetFlowLogCollector 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.GetFlowLogCollector(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetFlowLogCollectorOptions model - getFlowLogCollectorOptionsModel := new(vpcv1.GetFlowLogCollectorOptions) - getFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") - getFlowLogCollectorOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetFlowLogCollector(getFlowLogCollectorOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetFlowLogCollector 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 GetFlowLogCollectorOptions model - getFlowLogCollectorOptionsModel := new(vpcv1.GetFlowLogCollectorOptions) - getFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") - getFlowLogCollectorOptionsModel.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.GetFlowLogCollector(getFlowLogCollectorOptionsModel) - 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 GetFlowLogCollectorOptions model with no property values - getFlowLogCollectorOptionsModelNew := new(vpcv1.GetFlowLogCollectorOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetFlowLogCollector(getFlowLogCollectorOptionsModelNew) - 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 GetFlowLogCollector 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 GetFlowLogCollectorOptions model - getFlowLogCollectorOptionsModel := new(vpcv1.GetFlowLogCollectorOptions) - getFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") - getFlowLogCollectorOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetFlowLogCollector(getFlowLogCollectorOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateFlowLogCollector(updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) - Operation response error`, func() { - version := "testString" - updateFlowLogCollectorPath := "/flow_log_collectors/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(updateFlowLogCollectorPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - 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 UpdateFlowLogCollector 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 FlowLogCollectorPatch model - flowLogCollectorPatchModel := new(vpcv1.FlowLogCollectorPatch) - flowLogCollectorPatchModel.Active = core.BoolPtr(true) - flowLogCollectorPatchModel.Name = core.StringPtr("my-flow-log-collector") - flowLogCollectorPatchModelAsPatch, asPatchErr := flowLogCollectorPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateFlowLogCollectorOptions model - updateFlowLogCollectorOptionsModel := new(vpcv1.UpdateFlowLogCollectorOptions) - updateFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") - updateFlowLogCollectorOptionsModel.FlowLogCollectorPatch = flowLogCollectorPatchModelAsPatch - updateFlowLogCollectorOptionsModel.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.UpdateFlowLogCollector(updateFlowLogCollectorOptionsModel) - 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.UpdateFlowLogCollector(updateFlowLogCollectorOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateFlowLogCollector(updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions)`, func() { - version := "testString" - updateFlowLogCollectorPath := "/flow_log_collectors/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(updateFlowLogCollectorPath)) - 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{"testString"})) - 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, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke UpdateFlowLogCollector 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 FlowLogCollectorPatch model - flowLogCollectorPatchModel := new(vpcv1.FlowLogCollectorPatch) - flowLogCollectorPatchModel.Active = core.BoolPtr(true) - flowLogCollectorPatchModel.Name = core.StringPtr("my-flow-log-collector") - flowLogCollectorPatchModelAsPatch, asPatchErr := flowLogCollectorPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateFlowLogCollectorOptions model - updateFlowLogCollectorOptionsModel := new(vpcv1.UpdateFlowLogCollectorOptions) - updateFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") - updateFlowLogCollectorOptionsModel.FlowLogCollectorPatch = flowLogCollectorPatchModelAsPatch - updateFlowLogCollectorOptionsModel.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.UpdateFlowLogCollectorWithContext(ctx, updateFlowLogCollectorOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.UpdateFlowLogCollector(updateFlowLogCollectorOptionsModel) - 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.UpdateFlowLogCollectorWithContext(ctx, updateFlowLogCollectorOptionsModel) - 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(updateFlowLogCollectorPath)) - 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{"testString"})) - 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, "auto_delete": true, "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::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/10c02d81-0ecb-4dc5-897d-28392913b81e", "id": "10c02d81-0ecb-4dc5-897d-28392913b81e", "name": "my-network-interface", "resource_type": "network_interface"}, "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc: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/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) - })) - }) - It(`Invoke UpdateFlowLogCollector 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.UpdateFlowLogCollector(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the FlowLogCollectorPatch model - flowLogCollectorPatchModel := new(vpcv1.FlowLogCollectorPatch) - flowLogCollectorPatchModel.Active = core.BoolPtr(true) - flowLogCollectorPatchModel.Name = core.StringPtr("my-flow-log-collector") - flowLogCollectorPatchModelAsPatch, asPatchErr := flowLogCollectorPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateFlowLogCollectorOptions model - updateFlowLogCollectorOptionsModel := new(vpcv1.UpdateFlowLogCollectorOptions) - updateFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") - updateFlowLogCollectorOptionsModel.FlowLogCollectorPatch = flowLogCollectorPatchModelAsPatch - updateFlowLogCollectorOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.UpdateFlowLogCollector(updateFlowLogCollectorOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke UpdateFlowLogCollector 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 FlowLogCollectorPatch model - flowLogCollectorPatchModel := new(vpcv1.FlowLogCollectorPatch) - flowLogCollectorPatchModel.Active = core.BoolPtr(true) - flowLogCollectorPatchModel.Name = core.StringPtr("my-flow-log-collector") - flowLogCollectorPatchModelAsPatch, asPatchErr := flowLogCollectorPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateFlowLogCollectorOptions model - updateFlowLogCollectorOptionsModel := new(vpcv1.UpdateFlowLogCollectorOptions) - updateFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") - updateFlowLogCollectorOptionsModel.FlowLogCollectorPatch = flowLogCollectorPatchModelAsPatch - updateFlowLogCollectorOptionsModel.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.UpdateFlowLogCollector(updateFlowLogCollectorOptionsModel) - 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 UpdateFlowLogCollectorOptions model with no property values - updateFlowLogCollectorOptionsModelNew := new(vpcv1.UpdateFlowLogCollectorOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.UpdateFlowLogCollector(updateFlowLogCollectorOptionsModelNew) - 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 UpdateFlowLogCollector 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 FlowLogCollectorPatch model - flowLogCollectorPatchModel := new(vpcv1.FlowLogCollectorPatch) - flowLogCollectorPatchModel.Active = core.BoolPtr(true) - flowLogCollectorPatchModel.Name = core.StringPtr("my-flow-log-collector") - flowLogCollectorPatchModelAsPatch, asPatchErr := flowLogCollectorPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateFlowLogCollectorOptions model - updateFlowLogCollectorOptionsModel := new(vpcv1.UpdateFlowLogCollectorOptions) - updateFlowLogCollectorOptionsModel.ID = core.StringPtr("testString") - updateFlowLogCollectorOptionsModel.FlowLogCollectorPatch = flowLogCollectorPatchModelAsPatch - updateFlowLogCollectorOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.UpdateFlowLogCollector(updateFlowLogCollectorOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`Model constructor tests`, func() { - Context(`Using a service client instance`, func() { - version := "testString" - vpcService, _ := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: "http://vpcv1modelgenerator.com", - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - It(`Invoke NewAddBareMetalServerNetworkInterfaceFloatingIPOptions successfully`, func() { - // Construct an instance of the AddBareMetalServerNetworkInterfaceFloatingIPOptions model - bareMetalServerID := "testString" - networkInterfaceID := "testString" - id := "testString" - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel := vpcService.NewAddBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID, networkInterfaceID, id) - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetBareMetalServerID("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetNetworkInterfaceID("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetID("testString") - addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) - Expect(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) - Expect(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(addBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewAddEndpointGatewayIPOptions successfully`, func() { - // Construct an instance of the AddEndpointGatewayIPOptions model - endpointGatewayID := "testString" - id := "testString" - addEndpointGatewayIPOptionsModel := vpcService.NewAddEndpointGatewayIPOptions(endpointGatewayID, id) - addEndpointGatewayIPOptionsModel.SetEndpointGatewayID("testString") - addEndpointGatewayIPOptionsModel.SetID("testString") - addEndpointGatewayIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(addEndpointGatewayIPOptionsModel).ToNot(BeNil()) - Expect(addEndpointGatewayIPOptionsModel.EndpointGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(addEndpointGatewayIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(addEndpointGatewayIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewAddInstanceNetworkInterfaceFloatingIPOptions successfully`, func() { - // Construct an instance of the AddInstanceNetworkInterfaceFloatingIPOptions model - instanceID := "testString" - networkInterfaceID := "testString" - id := "testString" - addInstanceNetworkInterfaceFloatingIPOptionsModel := vpcService.NewAddInstanceNetworkInterfaceFloatingIPOptions(instanceID, networkInterfaceID, id) - addInstanceNetworkInterfaceFloatingIPOptionsModel.SetInstanceID("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.SetNetworkInterfaceID("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.SetID("testString") - addInstanceNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(addInstanceNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) - Expect(addInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(addInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) - Expect(addInstanceNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(addInstanceNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewAddVPNGatewayConnectionLocalCIDROptions successfully`, func() { - // Construct an instance of the AddVPNGatewayConnectionLocalCIDROptions model - vpnGatewayID := "testString" - id := "testString" - cidrPrefix := "testString" - prefixLength := "testString" - addVPNGatewayConnectionLocalCIDROptionsModel := vpcService.NewAddVPNGatewayConnectionLocalCIDROptions(vpnGatewayID, id, cidrPrefix, prefixLength) - addVPNGatewayConnectionLocalCIDROptionsModel.SetVPNGatewayID("testString") - addVPNGatewayConnectionLocalCIDROptionsModel.SetID("testString") - addVPNGatewayConnectionLocalCIDROptionsModel.SetCIDRPrefix("testString") - addVPNGatewayConnectionLocalCIDROptionsModel.SetPrefixLength("testString") - addVPNGatewayConnectionLocalCIDROptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(addVPNGatewayConnectionLocalCIDROptionsModel).ToNot(BeNil()) - Expect(addVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(addVPNGatewayConnectionLocalCIDROptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(addVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix).To(Equal(core.StringPtr("testString"))) - Expect(addVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength).To(Equal(core.StringPtr("testString"))) - Expect(addVPNGatewayConnectionLocalCIDROptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewAddVPNGatewayConnectionPeerCIDROptions successfully`, func() { - // Construct an instance of the AddVPNGatewayConnectionPeerCIDROptions model - vpnGatewayID := "testString" - id := "testString" - cidrPrefix := "testString" - prefixLength := "testString" - addVPNGatewayConnectionPeerCIDROptionsModel := vpcService.NewAddVPNGatewayConnectionPeerCIDROptions(vpnGatewayID, id, cidrPrefix, prefixLength) - addVPNGatewayConnectionPeerCIDROptionsModel.SetVPNGatewayID("testString") - addVPNGatewayConnectionPeerCIDROptionsModel.SetID("testString") - addVPNGatewayConnectionPeerCIDROptionsModel.SetCIDRPrefix("testString") - addVPNGatewayConnectionPeerCIDROptionsModel.SetPrefixLength("testString") - addVPNGatewayConnectionPeerCIDROptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(addVPNGatewayConnectionPeerCIDROptionsModel).ToNot(BeNil()) - Expect(addVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(addVPNGatewayConnectionPeerCIDROptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(addVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix).To(Equal(core.StringPtr("testString"))) - Expect(addVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength).To(Equal(core.StringPtr("testString"))) - Expect(addVPNGatewayConnectionPeerCIDROptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewBackupPolicyPlanPrototype successfully`, func() { - cronSpec := "30 */2 * * 1-5" - _model, err := vpcService.NewBackupPolicyPlanPrototype(cronSpec) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewBareMetalServerInitializationPrototype successfully`, func() { - var image vpcv1.ImageIdentityIntf = nil - keys := []vpcv1.KeyIdentityIntf{} - _, err := vpcService.NewBareMetalServerInitializationPrototype(image, keys) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewBareMetalServerPrimaryNetworkInterfacePrototype successfully`, func() { - var subnet vpcv1.SubnetIdentityIntf = nil - _, err := vpcService.NewBareMetalServerPrimaryNetworkInterfacePrototype(subnet) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewCheckVPNGatewayConnectionLocalCIDROptions successfully`, func() { - // Construct an instance of the CheckVPNGatewayConnectionLocalCIDROptions model - vpnGatewayID := "testString" - id := "testString" - cidrPrefix := "testString" - prefixLength := "testString" - checkVPNGatewayConnectionLocalCIDROptionsModel := vpcService.NewCheckVPNGatewayConnectionLocalCIDROptions(vpnGatewayID, id, cidrPrefix, prefixLength) - checkVPNGatewayConnectionLocalCIDROptionsModel.SetVPNGatewayID("testString") - checkVPNGatewayConnectionLocalCIDROptionsModel.SetID("testString") - checkVPNGatewayConnectionLocalCIDROptionsModel.SetCIDRPrefix("testString") - checkVPNGatewayConnectionLocalCIDROptionsModel.SetPrefixLength("testString") - checkVPNGatewayConnectionLocalCIDROptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(checkVPNGatewayConnectionLocalCIDROptionsModel).ToNot(BeNil()) - Expect(checkVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(checkVPNGatewayConnectionLocalCIDROptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(checkVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix).To(Equal(core.StringPtr("testString"))) - Expect(checkVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength).To(Equal(core.StringPtr("testString"))) - Expect(checkVPNGatewayConnectionLocalCIDROptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCheckVPNGatewayConnectionPeerCIDROptions successfully`, func() { - // Construct an instance of the CheckVPNGatewayConnectionPeerCIDROptions model - vpnGatewayID := "testString" - id := "testString" - cidrPrefix := "testString" - prefixLength := "testString" - checkVPNGatewayConnectionPeerCIDROptionsModel := vpcService.NewCheckVPNGatewayConnectionPeerCIDROptions(vpnGatewayID, id, cidrPrefix, prefixLength) - checkVPNGatewayConnectionPeerCIDROptionsModel.SetVPNGatewayID("testString") - checkVPNGatewayConnectionPeerCIDROptionsModel.SetID("testString") - checkVPNGatewayConnectionPeerCIDROptionsModel.SetCIDRPrefix("testString") - checkVPNGatewayConnectionPeerCIDROptionsModel.SetPrefixLength("testString") - checkVPNGatewayConnectionPeerCIDROptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(checkVPNGatewayConnectionPeerCIDROptionsModel).ToNot(BeNil()) - Expect(checkVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(checkVPNGatewayConnectionPeerCIDROptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(checkVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix).To(Equal(core.StringPtr("testString"))) - Expect(checkVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength).To(Equal(core.StringPtr("testString"))) - Expect(checkVPNGatewayConnectionPeerCIDROptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateBackupPolicyOptions successfully`, func() { - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - Expect(backupPolicyPlanDeletionTriggerPrototypeModel).ToNot(BeNil()) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - Expect(backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter).To(Equal(core.Int64Ptr(int64(20)))) - Expect(backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount).To(Equal(core.Int64Ptr(int64(20)))) - - // Construct an instance of the BackupPolicyPlanPrototype model - backupPolicyPlanPrototypeModel := new(vpcv1.BackupPolicyPlanPrototype) - Expect(backupPolicyPlanPrototypeModel).ToNot(BeNil()) - backupPolicyPlanPrototypeModel.Active = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.AttachUserTags = []string{"my-daily-backup-plan"} - backupPolicyPlanPrototypeModel.CopyUserTags = core.BoolPtr(true) - backupPolicyPlanPrototypeModel.CronSpec = core.StringPtr("30 */2 * * 1-5") - backupPolicyPlanPrototypeModel.DeletionTrigger = backupPolicyPlanDeletionTriggerPrototypeModel - backupPolicyPlanPrototypeModel.Name = core.StringPtr("my-policy-plan") - Expect(backupPolicyPlanPrototypeModel.Active).To(Equal(core.BoolPtr(true))) - Expect(backupPolicyPlanPrototypeModel.AttachUserTags).To(Equal([]string{"my-daily-backup-plan"})) - Expect(backupPolicyPlanPrototypeModel.CopyUserTags).To(Equal(core.BoolPtr(true))) - Expect(backupPolicyPlanPrototypeModel.CronSpec).To(Equal(core.StringPtr("30 */2 * * 1-5"))) - Expect(backupPolicyPlanPrototypeModel.DeletionTrigger).To(Equal(backupPolicyPlanDeletionTriggerPrototypeModel)) - Expect(backupPolicyPlanPrototypeModel.Name).To(Equal(core.StringPtr("my-policy-plan"))) - - // 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 CreateBackupPolicyOptions model - createBackupPolicyOptionsModel := vpcService.NewCreateBackupPolicyOptions() - createBackupPolicyOptionsModel.SetMatchResourceTypes([]string{"volume"}) - createBackupPolicyOptionsModel.SetMatchUserTags([]string{"my-daily-backup-policy"}) - createBackupPolicyOptionsModel.SetName("my-backup-policy") - createBackupPolicyOptionsModel.SetPlans([]vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel}) - createBackupPolicyOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createBackupPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createBackupPolicyOptionsModel).ToNot(BeNil()) - Expect(createBackupPolicyOptionsModel.MatchResourceTypes).To(Equal([]string{"volume"})) - Expect(createBackupPolicyOptionsModel.MatchUserTags).To(Equal([]string{"my-daily-backup-policy"})) - Expect(createBackupPolicyOptionsModel.Name).To(Equal(core.StringPtr("my-backup-policy"))) - Expect(createBackupPolicyOptionsModel.Plans).To(Equal([]vpcv1.BackupPolicyPlanPrototype{*backupPolicyPlanPrototypeModel})) - Expect(createBackupPolicyOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createBackupPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateBackupPolicyPlanOptions successfully`, func() { - // Construct an instance of the BackupPolicyPlanDeletionTriggerPrototype model - backupPolicyPlanDeletionTriggerPrototypeModel := new(vpcv1.BackupPolicyPlanDeletionTriggerPrototype) - Expect(backupPolicyPlanDeletionTriggerPrototypeModel).ToNot(BeNil()) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter = core.Int64Ptr(int64(20)) - backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount = core.Int64Ptr(int64(20)) - Expect(backupPolicyPlanDeletionTriggerPrototypeModel.DeleteAfter).To(Equal(core.Int64Ptr(int64(20)))) - Expect(backupPolicyPlanDeletionTriggerPrototypeModel.DeleteOverCount).To(Equal(core.Int64Ptr(int64(20)))) - - // Construct an instance of the CreateBackupPolicyPlanOptions model - backupPolicyID := "testString" - createBackupPolicyPlanOptionsCronSpec := "30 */2 * * 1-5" - createBackupPolicyPlanOptionsModel := vpcService.NewCreateBackupPolicyPlanOptions(backupPolicyID, createBackupPolicyPlanOptionsCronSpec) - createBackupPolicyPlanOptionsModel.SetBackupPolicyID("testString") - createBackupPolicyPlanOptionsModel.SetCronSpec("30 */2 * * 1-5") - createBackupPolicyPlanOptionsModel.SetActive(true) - createBackupPolicyPlanOptionsModel.SetAttachUserTags([]string{"my-daily-backup-plan"}) - createBackupPolicyPlanOptionsModel.SetCopyUserTags(true) - createBackupPolicyPlanOptionsModel.SetDeletionTrigger(backupPolicyPlanDeletionTriggerPrototypeModel) - createBackupPolicyPlanOptionsModel.SetName("my-policy-plan") - createBackupPolicyPlanOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createBackupPolicyPlanOptionsModel).ToNot(BeNil()) - Expect(createBackupPolicyPlanOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) - Expect(createBackupPolicyPlanOptionsModel.CronSpec).To(Equal(core.StringPtr("30 */2 * * 1-5"))) - Expect(createBackupPolicyPlanOptionsModel.Active).To(Equal(core.BoolPtr(true))) - Expect(createBackupPolicyPlanOptionsModel.AttachUserTags).To(Equal([]string{"my-daily-backup-plan"})) - Expect(createBackupPolicyPlanOptionsModel.CopyUserTags).To(Equal(core.BoolPtr(true))) - Expect(createBackupPolicyPlanOptionsModel.DeletionTrigger).To(Equal(backupPolicyPlanDeletionTriggerPrototypeModel)) - Expect(createBackupPolicyPlanOptionsModel.Name).To(Equal(core.StringPtr("my-policy-plan"))) - Expect(createBackupPolicyPlanOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateBareMetalServerConsoleAccessTokenOptions successfully`, func() { - // Construct an instance of the CreateBareMetalServerConsoleAccessTokenOptions model - bareMetalServerID := "testString" - createBareMetalServerConsoleAccessTokenOptionsConsoleType := "serial" - createBareMetalServerConsoleAccessTokenOptionsModel := vpcService.NewCreateBareMetalServerConsoleAccessTokenOptions(bareMetalServerID, createBareMetalServerConsoleAccessTokenOptionsConsoleType) - createBareMetalServerConsoleAccessTokenOptionsModel.SetBareMetalServerID("testString") - createBareMetalServerConsoleAccessTokenOptionsModel.SetConsoleType("serial") - createBareMetalServerConsoleAccessTokenOptionsModel.SetForce(false) - createBareMetalServerConsoleAccessTokenOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createBareMetalServerConsoleAccessTokenOptionsModel).ToNot(BeNil()) - Expect(createBareMetalServerConsoleAccessTokenOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(createBareMetalServerConsoleAccessTokenOptionsModel.ConsoleType).To(Equal(core.StringPtr("serial"))) - Expect(createBareMetalServerConsoleAccessTokenOptionsModel.Force).To(Equal(core.BoolPtr(false))) - Expect(createBareMetalServerConsoleAccessTokenOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateBareMetalServerNetworkInterfaceOptions successfully`, func() { - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - Expect(networkInterfaceIPPrototypeModel).ToNot(BeNil()) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - Expect(networkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) - Expect(networkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) - Expect(networkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) - - // 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"))) - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - Expect(subnetIdentityModel).ToNot(BeNil()) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) - - // Construct an instance of the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - Expect(bareMetalServerNetworkInterfacePrototypeModel).ToNot(BeNil()) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - Expect(bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) - Expect(bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) - Expect(bareMetalServerNetworkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-network-interface"))) - Expect(bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) - Expect(bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) - Expect(bareMetalServerNetworkInterfacePrototypeModel.Subnet).To(Equal(subnetIdentityModel)) - Expect(bareMetalServerNetworkInterfacePrototypeModel.InterfaceType).To(Equal(core.StringPtr("hipersocket"))) - - // Construct an instance of the CreateBareMetalServerNetworkInterfaceOptions model - bareMetalServerID := "testString" - var bareMetalServerNetworkInterfacePrototype vpcv1.BareMetalServerNetworkInterfacePrototypeIntf = nil - createBareMetalServerNetworkInterfaceOptionsModel := vpcService.NewCreateBareMetalServerNetworkInterfaceOptions(bareMetalServerID, bareMetalServerNetworkInterfacePrototype) - createBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerID("testString") - createBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerNetworkInterfacePrototype(bareMetalServerNetworkInterfacePrototypeModel) - createBareMetalServerNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createBareMetalServerNetworkInterfaceOptionsModel).ToNot(BeNil()) - Expect(createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(createBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePrototype).To(Equal(bareMetalServerNetworkInterfacePrototypeModel)) - Expect(createBareMetalServerNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateBareMetalServerOptions successfully`, func() { - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - Expect(imageIdentityModel).ToNot(BeNil()) - imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - Expect(imageIdentityModel.ID).To(Equal(core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"))) - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - Expect(keyIdentityModel).ToNot(BeNil()) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - Expect(keyIdentityModel.ID).To(Equal(core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803"))) - - // Construct an instance of the BareMetalServerInitializationPrototype model - bareMetalServerInitializationPrototypeModel := new(vpcv1.BareMetalServerInitializationPrototype) - Expect(bareMetalServerInitializationPrototypeModel).ToNot(BeNil()) - bareMetalServerInitializationPrototypeModel.Image = imageIdentityModel - bareMetalServerInitializationPrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - bareMetalServerInitializationPrototypeModel.UserData = core.StringPtr("testString") - Expect(bareMetalServerInitializationPrototypeModel.Image).To(Equal(imageIdentityModel)) - Expect(bareMetalServerInitializationPrototypeModel.Keys).To(Equal([]vpcv1.KeyIdentityIntf{keyIdentityModel})) - Expect(bareMetalServerInitializationPrototypeModel.UserData).To(Equal(core.StringPtr("testString"))) - - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - Expect(networkInterfaceIPPrototypeModel).ToNot(BeNil()) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - Expect(networkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) - Expect(networkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) - Expect(networkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) - - // 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"))) - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - Expect(subnetIdentityModel).ToNot(BeNil()) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) - - // Construct an instance of the BareMetalServerPrimaryNetworkInterfacePrototype model - bareMetalServerPrimaryNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel).ToNot(BeNil()) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans = []int64{int64(4)} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("pci") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.AllowedVlans).To(Equal([]int64{int64(4)})) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.InterfaceType).To(Equal(core.StringPtr("pci"))) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-network-interface"))) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) - Expect(bareMetalServerPrimaryNetworkInterfacePrototypeModel.Subnet).To(Equal(subnetIdentityModel)) - - // Construct an instance of the BareMetalServerProfileIdentityByName model - bareMetalServerProfileIdentityModel := new(vpcv1.BareMetalServerProfileIdentityByName) - Expect(bareMetalServerProfileIdentityModel).ToNot(BeNil()) - bareMetalServerProfileIdentityModel.Name = core.StringPtr("bx2-metal-192x768") - Expect(bareMetalServerProfileIdentityModel.Name).To(Equal(core.StringPtr("bx2-metal-192x768"))) - - // 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 BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype model - bareMetalServerNetworkInterfacePrototypeModel := new(vpcv1.BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - Expect(bareMetalServerNetworkInterfacePrototypeModel).ToNot(BeNil()) - bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat = core.BoolPtr(true) - bareMetalServerNetworkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - bareMetalServerNetworkInterfacePrototypeModel.Subnet = subnetIdentityModel - bareMetalServerNetworkInterfacePrototypeModel.InterfaceType = core.StringPtr("hipersocket") - Expect(bareMetalServerNetworkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) - Expect(bareMetalServerNetworkInterfacePrototypeModel.EnableInfrastructureNat).To(Equal(core.BoolPtr(true))) - Expect(bareMetalServerNetworkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-network-interface"))) - Expect(bareMetalServerNetworkInterfacePrototypeModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) - Expect(bareMetalServerNetworkInterfacePrototypeModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) - Expect(bareMetalServerNetworkInterfacePrototypeModel.Subnet).To(Equal(subnetIdentityModel)) - Expect(bareMetalServerNetworkInterfacePrototypeModel.InterfaceType).To(Equal(core.StringPtr("hipersocket"))) - - // 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 BareMetalServerTrustedPlatformModulePrototype model - bareMetalServerTrustedPlatformModulePrototypeModel := new(vpcv1.BareMetalServerTrustedPlatformModulePrototype) - Expect(bareMetalServerTrustedPlatformModulePrototypeModel).ToNot(BeNil()) - bareMetalServerTrustedPlatformModulePrototypeModel.Mode = core.StringPtr("disabled") - Expect(bareMetalServerTrustedPlatformModulePrototypeModel.Mode).To(Equal(core.StringPtr("disabled"))) - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - Expect(vpcIdentityModel).ToNot(BeNil()) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") - Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b"))) - - // Construct an instance of the CreateBareMetalServerOptions model - var createBareMetalServerOptionsInitialization *vpcv1.BareMetalServerInitializationPrototype = nil - var createBareMetalServerOptionsPrimaryNetworkInterface *vpcv1.BareMetalServerPrimaryNetworkInterfacePrototype = nil - var createBareMetalServerOptionsProfile vpcv1.BareMetalServerProfileIdentityIntf = nil - var createBareMetalServerOptionsZone vpcv1.ZoneIdentityIntf = nil - createBareMetalServerOptionsModel := vpcService.NewCreateBareMetalServerOptions(createBareMetalServerOptionsInitialization, createBareMetalServerOptionsPrimaryNetworkInterface, createBareMetalServerOptionsProfile, createBareMetalServerOptionsZone) - createBareMetalServerOptionsModel.SetInitialization(bareMetalServerInitializationPrototypeModel) - createBareMetalServerOptionsModel.SetPrimaryNetworkInterface(bareMetalServerPrimaryNetworkInterfacePrototypeModel) - createBareMetalServerOptionsModel.SetProfile(bareMetalServerProfileIdentityModel) - createBareMetalServerOptionsModel.SetZone(zoneIdentityModel) - createBareMetalServerOptionsModel.SetEnableSecureBoot(false) - createBareMetalServerOptionsModel.SetName("my-bare-metal-server") - createBareMetalServerOptionsModel.SetNetworkInterfaces([]vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel}) - createBareMetalServerOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createBareMetalServerOptionsModel.SetTrustedPlatformModule(bareMetalServerTrustedPlatformModulePrototypeModel) - createBareMetalServerOptionsModel.SetVPC(vpcIdentityModel) - createBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createBareMetalServerOptionsModel).ToNot(BeNil()) - Expect(createBareMetalServerOptionsModel.Initialization).To(Equal(bareMetalServerInitializationPrototypeModel)) - Expect(createBareMetalServerOptionsModel.PrimaryNetworkInterface).To(Equal(bareMetalServerPrimaryNetworkInterfacePrototypeModel)) - Expect(createBareMetalServerOptionsModel.Profile).To(Equal(bareMetalServerProfileIdentityModel)) - Expect(createBareMetalServerOptionsModel.Zone).To(Equal(zoneIdentityModel)) - Expect(createBareMetalServerOptionsModel.EnableSecureBoot).To(Equal(core.BoolPtr(false))) - Expect(createBareMetalServerOptionsModel.Name).To(Equal(core.StringPtr("my-bare-metal-server"))) - Expect(createBareMetalServerOptionsModel.NetworkInterfaces).To(Equal([]vpcv1.BareMetalServerNetworkInterfacePrototypeIntf{bareMetalServerNetworkInterfacePrototypeModel})) - Expect(createBareMetalServerOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createBareMetalServerOptionsModel.TrustedPlatformModule).To(Equal(bareMetalServerTrustedPlatformModulePrototypeModel)) - Expect(createBareMetalServerOptionsModel.VPC).To(Equal(vpcIdentityModel)) - Expect(createBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateDedicatedHostGroupOptions successfully`, func() { - // 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 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 CreateDedicatedHostGroupOptions model - createDedicatedHostGroupOptionsModel := vpcService.NewCreateDedicatedHostGroupOptions() - createDedicatedHostGroupOptionsModel.SetClass("mx2") - createDedicatedHostGroupOptionsModel.SetFamily("balanced") - createDedicatedHostGroupOptionsModel.SetName("testString") - createDedicatedHostGroupOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createDedicatedHostGroupOptionsModel.SetZone(zoneIdentityModel) - createDedicatedHostGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createDedicatedHostGroupOptionsModel).ToNot(BeNil()) - Expect(createDedicatedHostGroupOptionsModel.Class).To(Equal(core.StringPtr("mx2"))) - Expect(createDedicatedHostGroupOptionsModel.Family).To(Equal(core.StringPtr("balanced"))) - Expect(createDedicatedHostGroupOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(createDedicatedHostGroupOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createDedicatedHostGroupOptionsModel.Zone).To(Equal(zoneIdentityModel)) - Expect(createDedicatedHostGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateDedicatedHostOptions successfully`, func() { - // Construct an instance of the DedicatedHostProfileIdentityByName model - dedicatedHostProfileIdentityModel := new(vpcv1.DedicatedHostProfileIdentityByName) - Expect(dedicatedHostProfileIdentityModel).ToNot(BeNil()) - dedicatedHostProfileIdentityModel.Name = core.StringPtr("mx2-host-152x1216") - Expect(dedicatedHostProfileIdentityModel.Name).To(Equal(core.StringPtr("mx2-host-152x1216"))) - - // 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 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"))) - - // Construct an instance of the DedicatedHostPrototypeDedicatedHostByGroup model - dedicatedHostPrototypeModel := new(vpcv1.DedicatedHostPrototypeDedicatedHostByGroup) - Expect(dedicatedHostPrototypeModel).ToNot(BeNil()) - dedicatedHostPrototypeModel.InstancePlacementEnabled = core.BoolPtr(true) - dedicatedHostPrototypeModel.Name = core.StringPtr("my-host") - dedicatedHostPrototypeModel.Profile = dedicatedHostProfileIdentityModel - dedicatedHostPrototypeModel.ResourceGroup = resourceGroupIdentityModel - dedicatedHostPrototypeModel.Group = dedicatedHostGroupIdentityModel - Expect(dedicatedHostPrototypeModel.InstancePlacementEnabled).To(Equal(core.BoolPtr(true))) - Expect(dedicatedHostPrototypeModel.Name).To(Equal(core.StringPtr("my-host"))) - Expect(dedicatedHostPrototypeModel.Profile).To(Equal(dedicatedHostProfileIdentityModel)) - Expect(dedicatedHostPrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(dedicatedHostPrototypeModel.Group).To(Equal(dedicatedHostGroupIdentityModel)) - - // Construct an instance of the CreateDedicatedHostOptions model - var dedicatedHostPrototype vpcv1.DedicatedHostPrototypeIntf = nil - createDedicatedHostOptionsModel := vpcService.NewCreateDedicatedHostOptions(dedicatedHostPrototype) - createDedicatedHostOptionsModel.SetDedicatedHostPrototype(dedicatedHostPrototypeModel) - createDedicatedHostOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createDedicatedHostOptionsModel).ToNot(BeNil()) - Expect(createDedicatedHostOptionsModel.DedicatedHostPrototype).To(Equal(dedicatedHostPrototypeModel)) - Expect(createDedicatedHostOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateEndpointGatewayOptions successfully`, func() { - // Construct an instance of the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName model - endpointGatewayTargetPrototypeModel := new(vpcv1.EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) - Expect(endpointGatewayTargetPrototypeModel).ToNot(BeNil()) - endpointGatewayTargetPrototypeModel.ResourceType = core.StringPtr("provider_infrastructure_service") - endpointGatewayTargetPrototypeModel.Name = core.StringPtr("ibm-ntp-server") - Expect(endpointGatewayTargetPrototypeModel.ResourceType).To(Equal(core.StringPtr("provider_infrastructure_service"))) - Expect(endpointGatewayTargetPrototypeModel.Name).To(Equal(core.StringPtr("ibm-ntp-server"))) - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - Expect(vpcIdentityModel).ToNot(BeNil()) - vpcIdentityModel.ID = core.StringPtr("f025b503-ae66-46de-a011-3bd08fd5f7bf") - Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("f025b503-ae66-46de-a011-3bd08fd5f7bf"))) - - // Construct an instance of the EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID model - endpointGatewayReservedIPModel := new(vpcv1.EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) - Expect(endpointGatewayReservedIPModel).ToNot(BeNil()) - endpointGatewayReservedIPModel.ID = core.StringPtr("6d353a0f-aeb1-4ae1-832e-1110d10981bb") - Expect(endpointGatewayReservedIPModel.ID).To(Equal(core.StringPtr("6d353a0f-aeb1-4ae1-832e-1110d10981bb"))) - - // 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 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"))) - - // Construct an instance of the CreateEndpointGatewayOptions model - var createEndpointGatewayOptionsTarget vpcv1.EndpointGatewayTargetPrototypeIntf = nil - var createEndpointGatewayOptionsVPC vpcv1.VPCIdentityIntf = nil - createEndpointGatewayOptionsModel := vpcService.NewCreateEndpointGatewayOptions(createEndpointGatewayOptionsTarget, createEndpointGatewayOptionsVPC) - createEndpointGatewayOptionsModel.SetTarget(endpointGatewayTargetPrototypeModel) - createEndpointGatewayOptionsModel.SetVPC(vpcIdentityModel) - createEndpointGatewayOptionsModel.SetIps([]vpcv1.EndpointGatewayReservedIPIntf{endpointGatewayReservedIPModel}) - createEndpointGatewayOptionsModel.SetName("testString") - createEndpointGatewayOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createEndpointGatewayOptionsModel.SetSecurityGroups([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel}) - createEndpointGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createEndpointGatewayOptionsModel).ToNot(BeNil()) - Expect(createEndpointGatewayOptionsModel.Target).To(Equal(endpointGatewayTargetPrototypeModel)) - Expect(createEndpointGatewayOptionsModel.VPC).To(Equal(vpcIdentityModel)) - Expect(createEndpointGatewayOptionsModel.Ips).To(Equal([]vpcv1.EndpointGatewayReservedIPIntf{endpointGatewayReservedIPModel})) - Expect(createEndpointGatewayOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(createEndpointGatewayOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createEndpointGatewayOptionsModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) - Expect(createEndpointGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateFloatingIPOptions successfully`, func() { - // 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 FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID model - floatingIPByTargetNetworkInterfaceIdentityModel := new(vpcv1.FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - Expect(floatingIPByTargetNetworkInterfaceIdentityModel).ToNot(BeNil()) - floatingIPByTargetNetworkInterfaceIdentityModel.ID = core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793") - Expect(floatingIPByTargetNetworkInterfaceIdentityModel.ID).To(Equal(core.StringPtr("69e55145-cc7d-4d8e-9e1f-cc3fb60b1793"))) - - // Construct an instance of the FloatingIPPrototypeFloatingIPByTarget model - floatingIPPrototypeModel := new(vpcv1.FloatingIPPrototypeFloatingIPByTarget) - Expect(floatingIPPrototypeModel).ToNot(BeNil()) - floatingIPPrototypeModel.Name = core.StringPtr("my-new-floating-ip") - floatingIPPrototypeModel.ResourceGroup = resourceGroupIdentityModel - floatingIPPrototypeModel.Target = floatingIPByTargetNetworkInterfaceIdentityModel - Expect(floatingIPPrototypeModel.Name).To(Equal(core.StringPtr("my-new-floating-ip"))) - Expect(floatingIPPrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(floatingIPPrototypeModel.Target).To(Equal(floatingIPByTargetNetworkInterfaceIdentityModel)) - - // Construct an instance of the CreateFloatingIPOptions model - var floatingIPPrototype vpcv1.FloatingIPPrototypeIntf = nil - createFloatingIPOptionsModel := vpcService.NewCreateFloatingIPOptions(floatingIPPrototype) - createFloatingIPOptionsModel.SetFloatingIPPrototype(floatingIPPrototypeModel) - createFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createFloatingIPOptionsModel).ToNot(BeNil()) - Expect(createFloatingIPOptionsModel.FloatingIPPrototype).To(Equal(floatingIPPrototypeModel)) - Expect(createFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateFlowLogCollectorOptions successfully`, func() { - // Construct an instance of the LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName model - legacyCloudObjectStorageBucketIdentityModel := new(vpcv1.LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) - Expect(legacyCloudObjectStorageBucketIdentityModel).ToNot(BeNil()) - legacyCloudObjectStorageBucketIdentityModel.Name = core.StringPtr("bucket-27200-lwx4cfvcue") - Expect(legacyCloudObjectStorageBucketIdentityModel.Name).To(Equal(core.StringPtr("bucket-27200-lwx4cfvcue"))) - - // Construct an instance of the FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID model - flowLogCollectorTargetPrototypeModel := new(vpcv1.FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - Expect(flowLogCollectorTargetPrototypeModel).ToNot(BeNil()) - flowLogCollectorTargetPrototypeModel.ID = core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e") - Expect(flowLogCollectorTargetPrototypeModel.ID).To(Equal(core.StringPtr("10c02d81-0ecb-4dc5-897d-28392913b81e"))) - - // 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 CreateFlowLogCollectorOptions model - var createFlowLogCollectorOptionsStorageBucket vpcv1.LegacyCloudObjectStorageBucketIdentityIntf = nil - var createFlowLogCollectorOptionsTarget vpcv1.FlowLogCollectorTargetPrototypeIntf = nil - createFlowLogCollectorOptionsModel := vpcService.NewCreateFlowLogCollectorOptions(createFlowLogCollectorOptionsStorageBucket, createFlowLogCollectorOptionsTarget) - createFlowLogCollectorOptionsModel.SetStorageBucket(legacyCloudObjectStorageBucketIdentityModel) - createFlowLogCollectorOptionsModel.SetTarget(flowLogCollectorTargetPrototypeModel) - createFlowLogCollectorOptionsModel.SetActive(false) - createFlowLogCollectorOptionsModel.SetName("my-flow-log-collector") - createFlowLogCollectorOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createFlowLogCollectorOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createFlowLogCollectorOptionsModel).ToNot(BeNil()) - Expect(createFlowLogCollectorOptionsModel.StorageBucket).To(Equal(legacyCloudObjectStorageBucketIdentityModel)) - Expect(createFlowLogCollectorOptionsModel.Target).To(Equal(flowLogCollectorTargetPrototypeModel)) - Expect(createFlowLogCollectorOptionsModel.Active).To(Equal(core.BoolPtr(false))) - Expect(createFlowLogCollectorOptionsModel.Name).To(Equal(core.StringPtr("my-flow-log-collector"))) - Expect(createFlowLogCollectorOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createFlowLogCollectorOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateIkePolicyOptions successfully`, func() { - // 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 CreateIkePolicyOptions model - createIkePolicyOptionsAuthenticationAlgorithm := "md5" - createIkePolicyOptionsDhGroup := int64(14) - createIkePolicyOptionsEncryptionAlgorithm := "aes128" - createIkePolicyOptionsIkeVersion := int64(1) - createIkePolicyOptionsModel := vpcService.NewCreateIkePolicyOptions(createIkePolicyOptionsAuthenticationAlgorithm, createIkePolicyOptionsDhGroup, createIkePolicyOptionsEncryptionAlgorithm, createIkePolicyOptionsIkeVersion) - createIkePolicyOptionsModel.SetAuthenticationAlgorithm("md5") - createIkePolicyOptionsModel.SetDhGroup(int64(14)) - createIkePolicyOptionsModel.SetEncryptionAlgorithm("aes128") - createIkePolicyOptionsModel.SetIkeVersion(int64(1)) - createIkePolicyOptionsModel.SetKeyLifetime(int64(28800)) - createIkePolicyOptionsModel.SetName("my-ike-policy") - createIkePolicyOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createIkePolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createIkePolicyOptionsModel).ToNot(BeNil()) - Expect(createIkePolicyOptionsModel.AuthenticationAlgorithm).To(Equal(core.StringPtr("md5"))) - Expect(createIkePolicyOptionsModel.DhGroup).To(Equal(core.Int64Ptr(int64(14)))) - Expect(createIkePolicyOptionsModel.EncryptionAlgorithm).To(Equal(core.StringPtr("aes128"))) - Expect(createIkePolicyOptionsModel.IkeVersion).To(Equal(core.Int64Ptr(int64(1)))) - Expect(createIkePolicyOptionsModel.KeyLifetime).To(Equal(core.Int64Ptr(int64(28800)))) - Expect(createIkePolicyOptionsModel.Name).To(Equal(core.StringPtr("my-ike-policy"))) - Expect(createIkePolicyOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createIkePolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateImageOptions successfully`, func() { - // 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 EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - Expect(encryptionKeyIdentityModel).ToNot(BeNil()) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - Expect(encryptionKeyIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"))) - - // Construct an instance of the ImageFilePrototype model - imageFilePrototypeModel := new(vpcv1.ImageFilePrototype) - Expect(imageFilePrototypeModel).ToNot(BeNil()) - imageFilePrototypeModel.Href = core.StringPtr("cos://us-south/custom-image-vpc-bucket/customImage-0.vhd") - Expect(imageFilePrototypeModel.Href).To(Equal(core.StringPtr("cos://us-south/custom-image-vpc-bucket/customImage-0.vhd"))) - - // Construct an instance of the OperatingSystemIdentityByName model - operatingSystemIdentityModel := new(vpcv1.OperatingSystemIdentityByName) - Expect(operatingSystemIdentityModel).ToNot(BeNil()) - operatingSystemIdentityModel.Name = core.StringPtr("ubuntu-16-amd64") - Expect(operatingSystemIdentityModel.Name).To(Equal(core.StringPtr("ubuntu-16-amd64"))) - - // Construct an instance of the ImagePrototypeImageByFile model - imagePrototypeModel := new(vpcv1.ImagePrototypeImageByFile) - Expect(imagePrototypeModel).ToNot(BeNil()) - imagePrototypeModel.Name = core.StringPtr("my-image") - imagePrototypeModel.ResourceGroup = resourceGroupIdentityModel - imagePrototypeModel.EncryptedDataKey = core.StringPtr("testString") - imagePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - imagePrototypeModel.File = imageFilePrototypeModel - imagePrototypeModel.OperatingSystem = operatingSystemIdentityModel - Expect(imagePrototypeModel.Name).To(Equal(core.StringPtr("my-image"))) - Expect(imagePrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(imagePrototypeModel.EncryptedDataKey).To(Equal(core.StringPtr("testString"))) - Expect(imagePrototypeModel.EncryptionKey).To(Equal(encryptionKeyIdentityModel)) - Expect(imagePrototypeModel.File).To(Equal(imageFilePrototypeModel)) - Expect(imagePrototypeModel.OperatingSystem).To(Equal(operatingSystemIdentityModel)) - - // Construct an instance of the CreateImageOptions model - var imagePrototype vpcv1.ImagePrototypeIntf = nil - createImageOptionsModel := vpcService.NewCreateImageOptions(imagePrototype) - createImageOptionsModel.SetImagePrototype(imagePrototypeModel) - createImageOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createImageOptionsModel).ToNot(BeNil()) - Expect(createImageOptionsModel.ImagePrototype).To(Equal(imagePrototypeModel)) - Expect(createImageOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateInstanceActionOptions successfully`, func() { - // Construct an instance of the CreateInstanceActionOptions model - instanceID := "testString" - createInstanceActionOptionsType := "reboot" - createInstanceActionOptionsModel := vpcService.NewCreateInstanceActionOptions(instanceID, createInstanceActionOptionsType) - createInstanceActionOptionsModel.SetInstanceID("testString") - createInstanceActionOptionsModel.SetType("reboot") - createInstanceActionOptionsModel.SetForce(true) - createInstanceActionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createInstanceActionOptionsModel).ToNot(BeNil()) - Expect(createInstanceActionOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createInstanceActionOptionsModel.Type).To(Equal(core.StringPtr("reboot"))) - Expect(createInstanceActionOptionsModel.Force).To(Equal(core.BoolPtr(true))) - Expect(createInstanceActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateInstanceConsoleAccessTokenOptions successfully`, func() { - // Construct an instance of the CreateInstanceConsoleAccessTokenOptions model - instanceID := "testString" - createInstanceConsoleAccessTokenOptionsConsoleType := "serial" - createInstanceConsoleAccessTokenOptionsModel := vpcService.NewCreateInstanceConsoleAccessTokenOptions(instanceID, createInstanceConsoleAccessTokenOptionsConsoleType) - createInstanceConsoleAccessTokenOptionsModel.SetInstanceID("testString") - createInstanceConsoleAccessTokenOptionsModel.SetConsoleType("serial") - createInstanceConsoleAccessTokenOptionsModel.SetForce(false) - createInstanceConsoleAccessTokenOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createInstanceConsoleAccessTokenOptionsModel).ToNot(BeNil()) - Expect(createInstanceConsoleAccessTokenOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createInstanceConsoleAccessTokenOptionsModel.ConsoleType).To(Equal(core.StringPtr("serial"))) - Expect(createInstanceConsoleAccessTokenOptionsModel.Force).To(Equal(core.BoolPtr(false))) - Expect(createInstanceConsoleAccessTokenOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateInstanceGroupManagerActionOptions successfully`, func() { - // Construct an instance of the InstanceGroupManagerScheduledActionGroupPrototype model - instanceGroupManagerScheduledActionGroupPrototypeModel := new(vpcv1.InstanceGroupManagerScheduledActionGroupPrototype) - Expect(instanceGroupManagerScheduledActionGroupPrototypeModel).ToNot(BeNil()) - instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount = core.Int64Ptr(int64(10)) - Expect(instanceGroupManagerScheduledActionGroupPrototypeModel.MembershipCount).To(Equal(core.Int64Ptr(int64(10)))) - - // Construct an instance of the InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup model - instanceGroupManagerActionPrototypeModel := new(vpcv1.InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) - Expect(instanceGroupManagerActionPrototypeModel).ToNot(BeNil()) - instanceGroupManagerActionPrototypeModel.Name = core.StringPtr("my-instance-group-manager-action") - instanceGroupManagerActionPrototypeModel.RunAt = CreateMockDateTime("2019-01-01T12:00:00.000Z") - instanceGroupManagerActionPrototypeModel.Group = instanceGroupManagerScheduledActionGroupPrototypeModel - Expect(instanceGroupManagerActionPrototypeModel.Name).To(Equal(core.StringPtr("my-instance-group-manager-action"))) - Expect(instanceGroupManagerActionPrototypeModel.RunAt).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) - Expect(instanceGroupManagerActionPrototypeModel.Group).To(Equal(instanceGroupManagerScheduledActionGroupPrototypeModel)) - - // Construct an instance of the CreateInstanceGroupManagerActionOptions model - instanceGroupID := "testString" - instanceGroupManagerID := "testString" - var instanceGroupManagerActionPrototype vpcv1.InstanceGroupManagerActionPrototypeIntf = nil - createInstanceGroupManagerActionOptionsModel := vpcService.NewCreateInstanceGroupManagerActionOptions(instanceGroupID, instanceGroupManagerID, instanceGroupManagerActionPrototype) - createInstanceGroupManagerActionOptionsModel.SetInstanceGroupID("testString") - createInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerID("testString") - createInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerActionPrototype(instanceGroupManagerActionPrototypeModel) - createInstanceGroupManagerActionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createInstanceGroupManagerActionOptionsModel).ToNot(BeNil()) - Expect(createInstanceGroupManagerActionOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) - Expect(createInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPrototype).To(Equal(instanceGroupManagerActionPrototypeModel)) - Expect(createInstanceGroupManagerActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateInstanceGroupManagerOptions successfully`, func() { - // Construct an instance of the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype model - instanceGroupManagerPrototypeModel := new(vpcv1.InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) - Expect(instanceGroupManagerPrototypeModel).ToNot(BeNil()) - 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)) - Expect(instanceGroupManagerPrototypeModel.ManagementEnabled).To(Equal(core.BoolPtr(true))) - Expect(instanceGroupManagerPrototypeModel.Name).To(Equal(core.StringPtr("my-instance-group-manager"))) - Expect(instanceGroupManagerPrototypeModel.AggregationWindow).To(Equal(core.Int64Ptr(int64(120)))) - Expect(instanceGroupManagerPrototypeModel.Cooldown).To(Equal(core.Int64Ptr(int64(210)))) - Expect(instanceGroupManagerPrototypeModel.ManagerType).To(Equal(core.StringPtr("autoscale"))) - Expect(instanceGroupManagerPrototypeModel.MaxMembershipCount).To(Equal(core.Int64Ptr(int64(10)))) - Expect(instanceGroupManagerPrototypeModel.MinMembershipCount).To(Equal(core.Int64Ptr(int64(10)))) - - // Construct an instance of the CreateInstanceGroupManagerOptions model - instanceGroupID := "testString" - var instanceGroupManagerPrototype vpcv1.InstanceGroupManagerPrototypeIntf = nil - createInstanceGroupManagerOptionsModel := vpcService.NewCreateInstanceGroupManagerOptions(instanceGroupID, instanceGroupManagerPrototype) - createInstanceGroupManagerOptionsModel.SetInstanceGroupID("testString") - createInstanceGroupManagerOptionsModel.SetInstanceGroupManagerPrototype(instanceGroupManagerPrototypeModel) - createInstanceGroupManagerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createInstanceGroupManagerOptionsModel).ToNot(BeNil()) - Expect(createInstanceGroupManagerOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(createInstanceGroupManagerOptionsModel.InstanceGroupManagerPrototype).To(Equal(instanceGroupManagerPrototypeModel)) - Expect(createInstanceGroupManagerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateInstanceGroupManagerPolicyOptions successfully`, func() { - // Construct an instance of the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype model - instanceGroupManagerPolicyPrototypeModel := new(vpcv1.InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) - Expect(instanceGroupManagerPolicyPrototypeModel).ToNot(BeNil()) - 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") - Expect(instanceGroupManagerPolicyPrototypeModel.Name).To(Equal(core.StringPtr("my-instance-group-manager-policy"))) - Expect(instanceGroupManagerPolicyPrototypeModel.MetricType).To(Equal(core.StringPtr("cpu"))) - Expect(instanceGroupManagerPolicyPrototypeModel.MetricValue).To(Equal(core.Int64Ptr(int64(38)))) - Expect(instanceGroupManagerPolicyPrototypeModel.PolicyType).To(Equal(core.StringPtr("target"))) - - // Construct an instance of the CreateInstanceGroupManagerPolicyOptions model - instanceGroupID := "testString" - instanceGroupManagerID := "testString" - var instanceGroupManagerPolicyPrototype vpcv1.InstanceGroupManagerPolicyPrototypeIntf = nil - createInstanceGroupManagerPolicyOptionsModel := vpcService.NewCreateInstanceGroupManagerPolicyOptions(instanceGroupID, instanceGroupManagerID, instanceGroupManagerPolicyPrototype) - createInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupID("testString") - createInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerID("testString") - createInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerPolicyPrototype(instanceGroupManagerPolicyPrototypeModel) - createInstanceGroupManagerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createInstanceGroupManagerPolicyOptionsModel).ToNot(BeNil()) - Expect(createInstanceGroupManagerPolicyOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) - Expect(createInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPrototype).To(Equal(instanceGroupManagerPolicyPrototypeModel)) - Expect(createInstanceGroupManagerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateInstanceGroupOptions successfully`, func() { - // Construct an instance of the InstanceTemplateIdentityByID model - instanceTemplateIdentityModel := new(vpcv1.InstanceTemplateIdentityByID) - Expect(instanceTemplateIdentityModel).ToNot(BeNil()) - instanceTemplateIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - Expect(instanceTemplateIdentityModel.ID).To(Equal(core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803"))) - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - Expect(subnetIdentityModel).ToNot(BeNil()) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) - - // Construct an instance of the LoadBalancerIdentityByID model - loadBalancerIdentityModel := new(vpcv1.LoadBalancerIdentityByID) - Expect(loadBalancerIdentityModel).ToNot(BeNil()) - loadBalancerIdentityModel.ID = core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727") - Expect(loadBalancerIdentityModel.ID).To(Equal(core.StringPtr("dd754295-e9e0-4c9d-bf6c-58fbc59e5727"))) - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - Expect(loadBalancerPoolIdentityModel).ToNot(BeNil()) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - Expect(loadBalancerPoolIdentityModel.ID).To(Equal(core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004"))) - - // 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 CreateInstanceGroupOptions model - var createInstanceGroupOptionsInstanceTemplate vpcv1.InstanceTemplateIdentityIntf = nil - createInstanceGroupOptionsSubnets := []vpcv1.SubnetIdentityIntf{} - createInstanceGroupOptionsModel := vpcService.NewCreateInstanceGroupOptions(createInstanceGroupOptionsInstanceTemplate, createInstanceGroupOptionsSubnets) - createInstanceGroupOptionsModel.SetInstanceTemplate(instanceTemplateIdentityModel) - createInstanceGroupOptionsModel.SetSubnets([]vpcv1.SubnetIdentityIntf{subnetIdentityModel}) - createInstanceGroupOptionsModel.SetApplicationPort(int64(22)) - createInstanceGroupOptionsModel.SetLoadBalancer(loadBalancerIdentityModel) - createInstanceGroupOptionsModel.SetLoadBalancerPool(loadBalancerPoolIdentityModel) - createInstanceGroupOptionsModel.SetMembershipCount(int64(10)) - createInstanceGroupOptionsModel.SetName("my-instance-group") - createInstanceGroupOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createInstanceGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createInstanceGroupOptionsModel).ToNot(BeNil()) - Expect(createInstanceGroupOptionsModel.InstanceTemplate).To(Equal(instanceTemplateIdentityModel)) - Expect(createInstanceGroupOptionsModel.Subnets).To(Equal([]vpcv1.SubnetIdentityIntf{subnetIdentityModel})) - Expect(createInstanceGroupOptionsModel.ApplicationPort).To(Equal(core.Int64Ptr(int64(22)))) - Expect(createInstanceGroupOptionsModel.LoadBalancer).To(Equal(loadBalancerIdentityModel)) - Expect(createInstanceGroupOptionsModel.LoadBalancerPool).To(Equal(loadBalancerPoolIdentityModel)) - Expect(createInstanceGroupOptionsModel.MembershipCount).To(Equal(core.Int64Ptr(int64(10)))) - Expect(createInstanceGroupOptionsModel.Name).To(Equal(core.StringPtr("my-instance-group"))) - Expect(createInstanceGroupOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createInstanceGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateInstanceNetworkInterfaceOptions successfully`, func() { - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - Expect(subnetIdentityModel).ToNot(BeNil()) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) - - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - Expect(networkInterfaceIPPrototypeModel).ToNot(BeNil()) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - Expect(networkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) - Expect(networkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) - Expect(networkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) - - // 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"))) - - // Construct an instance of the CreateInstanceNetworkInterfaceOptions model - instanceID := "testString" - var createInstanceNetworkInterfaceOptionsSubnet vpcv1.SubnetIdentityIntf = nil - createInstanceNetworkInterfaceOptionsModel := vpcService.NewCreateInstanceNetworkInterfaceOptions(instanceID, createInstanceNetworkInterfaceOptionsSubnet) - createInstanceNetworkInterfaceOptionsModel.SetInstanceID("testString") - createInstanceNetworkInterfaceOptionsModel.SetSubnet(subnetIdentityModel) - createInstanceNetworkInterfaceOptionsModel.SetAllowIPSpoofing(true) - createInstanceNetworkInterfaceOptionsModel.SetName("my-network-interface") - createInstanceNetworkInterfaceOptionsModel.SetPrimaryIP(networkInterfaceIPPrototypeModel) - createInstanceNetworkInterfaceOptionsModel.SetSecurityGroups([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel}) - createInstanceNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createInstanceNetworkInterfaceOptionsModel).ToNot(BeNil()) - Expect(createInstanceNetworkInterfaceOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createInstanceNetworkInterfaceOptionsModel.Subnet).To(Equal(subnetIdentityModel)) - Expect(createInstanceNetworkInterfaceOptionsModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) - Expect(createInstanceNetworkInterfaceOptionsModel.Name).To(Equal(core.StringPtr("my-network-interface"))) - Expect(createInstanceNetworkInterfaceOptionsModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) - Expect(createInstanceNetworkInterfaceOptionsModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) - Expect(createInstanceNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateInstanceOptions successfully`, func() { - // Construct an instance of the InstanceAvailabilityPrototype model - instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) - Expect(instanceAvailabilityPrototypeModel).ToNot(BeNil()) - instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") - Expect(instanceAvailabilityPrototypeModel.HostFailure).To(Equal(core.StringPtr("restart"))) - - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) - 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"))) - - // Construct an instance of the InstanceDefaultTrustedProfilePrototype model - instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) - Expect(instanceDefaultTrustedProfilePrototypeModel).ToNot(BeNil()) - instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) - instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel - Expect(instanceDefaultTrustedProfilePrototypeModel.AutoLink).To(Equal(core.BoolPtr(false))) - Expect(instanceDefaultTrustedProfilePrototypeModel.Target).To(Equal(trustedProfileIdentityModel)) - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - Expect(keyIdentityModel).ToNot(BeNil()) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - Expect(keyIdentityModel.ID).To(Equal(core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803"))) - - // Construct an instance of the InstanceMetadataServicePrototype model - instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) - Expect(instanceMetadataServicePrototypeModel).ToNot(BeNil()) - instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) - Expect(instanceMetadataServicePrototypeModel.Enabled).To(Equal(core.BoolPtr(false))) - - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - Expect(networkInterfaceIPPrototypeModel).ToNot(BeNil()) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - Expect(networkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) - Expect(networkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) - Expect(networkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) - - // 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"))) - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - Expect(subnetIdentityModel).ToNot(BeNil()) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) - - // Construct an instance of the NetworkInterfacePrototype model - networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) - Expect(networkInterfacePrototypeModel).ToNot(BeNil()) - networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - networkInterfacePrototypeModel.Subnet = subnetIdentityModel - Expect(networkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) - Expect(networkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-network-interface"))) - Expect(networkInterfacePrototypeModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) - Expect(networkInterfacePrototypeModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) - Expect(networkInterfacePrototypeModel.Subnet).To(Equal(subnetIdentityModel)) - - // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - Expect(instancePlacementTargetPrototypeModel).ToNot(BeNil()) - instancePlacementTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - Expect(instancePlacementTargetPrototypeModel.ID).To(Equal(core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a"))) - - // Construct an instance of the InstanceProfileIdentityByName model - instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) - Expect(instanceProfileIdentityModel).ToNot(BeNil()) - instanceProfileIdentityModel.Name = core.StringPtr("cx2-16x32") - Expect(instanceProfileIdentityModel.Name).To(Equal(core.StringPtr("cx2-16x32"))) - - // 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 VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - Expect(volumeAttachmentPrototypeVolumeModel).ToNot(BeNil()) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - Expect(volumeAttachmentPrototypeVolumeModel.ID).To(Equal(core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5"))) - - // Construct an instance of the VolumeAttachmentPrototype model - volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) - Expect(volumeAttachmentPrototypeModel).ToNot(BeNil()) - volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel - Expect(volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete).To(Equal(core.BoolPtr(false))) - Expect(volumeAttachmentPrototypeModel.Name).To(Equal(core.StringPtr("my-volume-attachment"))) - Expect(volumeAttachmentPrototypeModel.Volume).To(Equal(volumeAttachmentPrototypeVolumeModel)) - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - Expect(vpcIdentityModel).ToNot(BeNil()) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") - Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b"))) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - Expect(encryptionKeyIdentityModel).ToNot(BeNil()) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - Expect(encryptionKeyIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"))) - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - Expect(volumeProfileIdentityModel).ToNot(BeNil()) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - Expect(volumeProfileIdentityModel.Name).To(Equal(core.StringPtr("general-purpose"))) - - // Construct an instance of the VolumePrototypeInstanceByImageContext model - volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) - Expect(volumePrototypeInstanceByImageContextModel).ToNot(BeNil()) - volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) - volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel - volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") - volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel - volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} - Expect(volumePrototypeInstanceByImageContextModel.Capacity).To(Equal(core.Int64Ptr(int64(250)))) - Expect(volumePrototypeInstanceByImageContextModel.EncryptionKey).To(Equal(encryptionKeyIdentityModel)) - Expect(volumePrototypeInstanceByImageContextModel.Iops).To(Equal(core.Int64Ptr(int64(10000)))) - Expect(volumePrototypeInstanceByImageContextModel.Name).To(Equal(core.StringPtr("my-volume"))) - Expect(volumePrototypeInstanceByImageContextModel.Profile).To(Equal(volumeProfileIdentityModel)) - Expect(volumePrototypeInstanceByImageContextModel.UserTags).To(Equal([]string{"testString"})) - - // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model - volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) - Expect(volumeAttachmentPrototypeInstanceByImageContextModel).ToNot(BeNil()) - volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel - Expect(volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete).To(Equal(core.BoolPtr(true))) - Expect(volumeAttachmentPrototypeInstanceByImageContextModel.Name).To(Equal(core.StringPtr("my-volume-attachment"))) - Expect(volumeAttachmentPrototypeInstanceByImageContextModel.Volume).To(Equal(volumePrototypeInstanceByImageContextModel)) - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - Expect(imageIdentityModel).ToNot(BeNil()) - imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - Expect(imageIdentityModel.ID).To(Equal(core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"))) - - // 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 InstancePrototypeInstanceByImage model - instancePrototypeModel := new(vpcv1.InstancePrototypeInstanceByImage) - Expect(instancePrototypeModel).ToNot(BeNil()) - instancePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel - instancePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel - instancePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - instancePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel - instancePrototypeModel.Name = core.StringPtr("my-instance") - instancePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} - instancePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel - instancePrototypeModel.Profile = instanceProfileIdentityModel - instancePrototypeModel.ResourceGroup = resourceGroupIdentityModel - instancePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instancePrototypeModel.UserData = core.StringPtr("testString") - instancePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} - instancePrototypeModel.VPC = vpcIdentityModel - instancePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel - instancePrototypeModel.Image = imageIdentityModel - instancePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel - instancePrototypeModel.Zone = zoneIdentityModel - Expect(instancePrototypeModel.AvailabilityPolicy).To(Equal(instanceAvailabilityPrototypeModel)) - Expect(instancePrototypeModel.DefaultTrustedProfile).To(Equal(instanceDefaultTrustedProfilePrototypeModel)) - Expect(instancePrototypeModel.Keys).To(Equal([]vpcv1.KeyIdentityIntf{keyIdentityModel})) - Expect(instancePrototypeModel.MetadataService).To(Equal(instanceMetadataServicePrototypeModel)) - Expect(instancePrototypeModel.Name).To(Equal(core.StringPtr("my-instance"))) - Expect(instancePrototypeModel.NetworkInterfaces).To(Equal([]vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel})) - Expect(instancePrototypeModel.PlacementTarget).To(Equal(instancePlacementTargetPrototypeModel)) - Expect(instancePrototypeModel.Profile).To(Equal(instanceProfileIdentityModel)) - Expect(instancePrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(instancePrototypeModel.TotalVolumeBandwidth).To(Equal(core.Int64Ptr(int64(500)))) - Expect(instancePrototypeModel.UserData).To(Equal(core.StringPtr("testString"))) - Expect(instancePrototypeModel.VolumeAttachments).To(Equal([]vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel})) - Expect(instancePrototypeModel.VPC).To(Equal(vpcIdentityModel)) - Expect(instancePrototypeModel.BootVolumeAttachment).To(Equal(volumeAttachmentPrototypeInstanceByImageContextModel)) - Expect(instancePrototypeModel.Image).To(Equal(imageIdentityModel)) - Expect(instancePrototypeModel.PrimaryNetworkInterface).To(Equal(networkInterfacePrototypeModel)) - Expect(instancePrototypeModel.Zone).To(Equal(zoneIdentityModel)) - - // Construct an instance of the CreateInstanceOptions model - var instancePrototype vpcv1.InstancePrototypeIntf = nil - createInstanceOptionsModel := vpcService.NewCreateInstanceOptions(instancePrototype) - createInstanceOptionsModel.SetInstancePrototype(instancePrototypeModel) - createInstanceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createInstanceOptionsModel).ToNot(BeNil()) - Expect(createInstanceOptionsModel.InstancePrototype).To(Equal(instancePrototypeModel)) - Expect(createInstanceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateInstanceTemplateOptions successfully`, func() { - // Construct an instance of the InstanceAvailabilityPrototype model - instanceAvailabilityPrototypeModel := new(vpcv1.InstanceAvailabilityPrototype) - Expect(instanceAvailabilityPrototypeModel).ToNot(BeNil()) - instanceAvailabilityPrototypeModel.HostFailure = core.StringPtr("restart") - Expect(instanceAvailabilityPrototypeModel.HostFailure).To(Equal(core.StringPtr("restart"))) - - // Construct an instance of the TrustedProfileIdentityTrustedProfileByID model - trustedProfileIdentityModel := new(vpcv1.TrustedProfileIdentityTrustedProfileByID) - 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"))) - - // Construct an instance of the InstanceDefaultTrustedProfilePrototype model - instanceDefaultTrustedProfilePrototypeModel := new(vpcv1.InstanceDefaultTrustedProfilePrototype) - Expect(instanceDefaultTrustedProfilePrototypeModel).ToNot(BeNil()) - instanceDefaultTrustedProfilePrototypeModel.AutoLink = core.BoolPtr(false) - instanceDefaultTrustedProfilePrototypeModel.Target = trustedProfileIdentityModel - Expect(instanceDefaultTrustedProfilePrototypeModel.AutoLink).To(Equal(core.BoolPtr(false))) - Expect(instanceDefaultTrustedProfilePrototypeModel.Target).To(Equal(trustedProfileIdentityModel)) - - // Construct an instance of the KeyIdentityByID model - keyIdentityModel := new(vpcv1.KeyIdentityByID) - Expect(keyIdentityModel).ToNot(BeNil()) - keyIdentityModel.ID = core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803") - Expect(keyIdentityModel.ID).To(Equal(core.StringPtr("a6b1a881-2ce8-41a3-80fc-36316a73f803"))) - - // Construct an instance of the InstanceMetadataServicePrototype model - instanceMetadataServicePrototypeModel := new(vpcv1.InstanceMetadataServicePrototype) - Expect(instanceMetadataServicePrototypeModel).ToNot(BeNil()) - instanceMetadataServicePrototypeModel.Enabled = core.BoolPtr(false) - Expect(instanceMetadataServicePrototypeModel.Enabled).To(Equal(core.BoolPtr(false))) - - // Construct an instance of the NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext model - networkInterfaceIPPrototypeModel := new(vpcv1.NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - Expect(networkInterfaceIPPrototypeModel).ToNot(BeNil()) - networkInterfaceIPPrototypeModel.Address = core.StringPtr("10.0.0.5") - networkInterfaceIPPrototypeModel.AutoDelete = core.BoolPtr(false) - networkInterfaceIPPrototypeModel.Name = core.StringPtr("my-reserved-ip") - Expect(networkInterfaceIPPrototypeModel.Address).To(Equal(core.StringPtr("10.0.0.5"))) - Expect(networkInterfaceIPPrototypeModel.AutoDelete).To(Equal(core.BoolPtr(false))) - Expect(networkInterfaceIPPrototypeModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) - - // 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"))) - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - Expect(subnetIdentityModel).ToNot(BeNil()) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) - - // Construct an instance of the NetworkInterfacePrototype model - networkInterfacePrototypeModel := new(vpcv1.NetworkInterfacePrototype) - Expect(networkInterfacePrototypeModel).ToNot(BeNil()) - networkInterfacePrototypeModel.AllowIPSpoofing = core.BoolPtr(true) - networkInterfacePrototypeModel.Name = core.StringPtr("my-network-interface") - networkInterfacePrototypeModel.PrimaryIP = networkInterfaceIPPrototypeModel - networkInterfacePrototypeModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} - networkInterfacePrototypeModel.Subnet = subnetIdentityModel - Expect(networkInterfacePrototypeModel.AllowIPSpoofing).To(Equal(core.BoolPtr(true))) - Expect(networkInterfacePrototypeModel.Name).To(Equal(core.StringPtr("my-network-interface"))) - Expect(networkInterfacePrototypeModel.PrimaryIP).To(Equal(networkInterfaceIPPrototypeModel)) - Expect(networkInterfacePrototypeModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) - Expect(networkInterfacePrototypeModel.Subnet).To(Equal(subnetIdentityModel)) - - // Construct an instance of the InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID model - instancePlacementTargetPrototypeModel := new(vpcv1.InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - Expect(instancePlacementTargetPrototypeModel).ToNot(BeNil()) - instancePlacementTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - Expect(instancePlacementTargetPrototypeModel.ID).To(Equal(core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a"))) - - // Construct an instance of the InstanceProfileIdentityByName model - instanceProfileIdentityModel := new(vpcv1.InstanceProfileIdentityByName) - Expect(instanceProfileIdentityModel).ToNot(BeNil()) - instanceProfileIdentityModel.Name = core.StringPtr("cx2-16x32") - Expect(instanceProfileIdentityModel.Name).To(Equal(core.StringPtr("cx2-16x32"))) - - // 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 VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - Expect(volumeAttachmentPrototypeVolumeModel).ToNot(BeNil()) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - Expect(volumeAttachmentPrototypeVolumeModel.ID).To(Equal(core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5"))) - - // Construct an instance of the VolumeAttachmentPrototype model - volumeAttachmentPrototypeModel := new(vpcv1.VolumeAttachmentPrototype) - Expect(volumeAttachmentPrototypeModel).ToNot(BeNil()) - volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(false) - volumeAttachmentPrototypeModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeModel.Volume = volumeAttachmentPrototypeVolumeModel - Expect(volumeAttachmentPrototypeModel.DeleteVolumeOnInstanceDelete).To(Equal(core.BoolPtr(false))) - Expect(volumeAttachmentPrototypeModel.Name).To(Equal(core.StringPtr("my-volume-attachment"))) - Expect(volumeAttachmentPrototypeModel.Volume).To(Equal(volumeAttachmentPrototypeVolumeModel)) - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - Expect(vpcIdentityModel).ToNot(BeNil()) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") - Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b"))) - - // Construct an instance of the EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - Expect(encryptionKeyIdentityModel).ToNot(BeNil()) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - Expect(encryptionKeyIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"))) - - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - Expect(volumeProfileIdentityModel).ToNot(BeNil()) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - Expect(volumeProfileIdentityModel.Name).To(Equal(core.StringPtr("general-purpose"))) - - // Construct an instance of the VolumePrototypeInstanceByImageContext model - volumePrototypeInstanceByImageContextModel := new(vpcv1.VolumePrototypeInstanceByImageContext) - Expect(volumePrototypeInstanceByImageContextModel).ToNot(BeNil()) - volumePrototypeInstanceByImageContextModel.Capacity = core.Int64Ptr(int64(250)) - volumePrototypeInstanceByImageContextModel.EncryptionKey = encryptionKeyIdentityModel - volumePrototypeInstanceByImageContextModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume") - volumePrototypeInstanceByImageContextModel.Profile = volumeProfileIdentityModel - volumePrototypeInstanceByImageContextModel.UserTags = []string{"testString"} - Expect(volumePrototypeInstanceByImageContextModel.Capacity).To(Equal(core.Int64Ptr(int64(250)))) - Expect(volumePrototypeInstanceByImageContextModel.EncryptionKey).To(Equal(encryptionKeyIdentityModel)) - Expect(volumePrototypeInstanceByImageContextModel.Iops).To(Equal(core.Int64Ptr(int64(10000)))) - Expect(volumePrototypeInstanceByImageContextModel.Name).To(Equal(core.StringPtr("my-volume"))) - Expect(volumePrototypeInstanceByImageContextModel.Profile).To(Equal(volumeProfileIdentityModel)) - Expect(volumePrototypeInstanceByImageContextModel.UserTags).To(Equal([]string{"testString"})) - - // Construct an instance of the VolumeAttachmentPrototypeInstanceByImageContext model - volumeAttachmentPrototypeInstanceByImageContextModel := new(vpcv1.VolumeAttachmentPrototypeInstanceByImageContext) - Expect(volumeAttachmentPrototypeInstanceByImageContextModel).ToNot(BeNil()) - volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete = core.BoolPtr(true) - volumeAttachmentPrototypeInstanceByImageContextModel.Name = core.StringPtr("my-volume-attachment") - volumeAttachmentPrototypeInstanceByImageContextModel.Volume = volumePrototypeInstanceByImageContextModel - Expect(volumeAttachmentPrototypeInstanceByImageContextModel.DeleteVolumeOnInstanceDelete).To(Equal(core.BoolPtr(true))) - Expect(volumeAttachmentPrototypeInstanceByImageContextModel.Name).To(Equal(core.StringPtr("my-volume-attachment"))) - Expect(volumeAttachmentPrototypeInstanceByImageContextModel.Volume).To(Equal(volumePrototypeInstanceByImageContextModel)) - - // Construct an instance of the ImageIdentityByID model - imageIdentityModel := new(vpcv1.ImageIdentityByID) - Expect(imageIdentityModel).ToNot(BeNil()) - imageIdentityModel.ID = core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8") - Expect(imageIdentityModel.ID).To(Equal(core.StringPtr("72b27b5c-f4b0-48bb-b954-5becc7c1dcb8"))) - - // 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 InstanceTemplatePrototypeInstanceByImage model - instanceTemplatePrototypeModel := new(vpcv1.InstanceTemplatePrototypeInstanceByImage) - Expect(instanceTemplatePrototypeModel).ToNot(BeNil()) - instanceTemplatePrototypeModel.AvailabilityPolicy = instanceAvailabilityPrototypeModel - instanceTemplatePrototypeModel.DefaultTrustedProfile = instanceDefaultTrustedProfilePrototypeModel - instanceTemplatePrototypeModel.Keys = []vpcv1.KeyIdentityIntf{keyIdentityModel} - instanceTemplatePrototypeModel.MetadataService = instanceMetadataServicePrototypeModel - instanceTemplatePrototypeModel.Name = core.StringPtr("my-instance") - instanceTemplatePrototypeModel.NetworkInterfaces = []vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel} - instanceTemplatePrototypeModel.PlacementTarget = instancePlacementTargetPrototypeModel - instanceTemplatePrototypeModel.Profile = instanceProfileIdentityModel - instanceTemplatePrototypeModel.ResourceGroup = resourceGroupIdentityModel - instanceTemplatePrototypeModel.TotalVolumeBandwidth = core.Int64Ptr(int64(500)) - instanceTemplatePrototypeModel.UserData = core.StringPtr("testString") - instanceTemplatePrototypeModel.VolumeAttachments = []vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel} - instanceTemplatePrototypeModel.VPC = vpcIdentityModel - instanceTemplatePrototypeModel.BootVolumeAttachment = volumeAttachmentPrototypeInstanceByImageContextModel - instanceTemplatePrototypeModel.Image = imageIdentityModel - instanceTemplatePrototypeModel.PrimaryNetworkInterface = networkInterfacePrototypeModel - instanceTemplatePrototypeModel.Zone = zoneIdentityModel - Expect(instanceTemplatePrototypeModel.AvailabilityPolicy).To(Equal(instanceAvailabilityPrototypeModel)) - Expect(instanceTemplatePrototypeModel.DefaultTrustedProfile).To(Equal(instanceDefaultTrustedProfilePrototypeModel)) - Expect(instanceTemplatePrototypeModel.Keys).To(Equal([]vpcv1.KeyIdentityIntf{keyIdentityModel})) - Expect(instanceTemplatePrototypeModel.MetadataService).To(Equal(instanceMetadataServicePrototypeModel)) - Expect(instanceTemplatePrototypeModel.Name).To(Equal(core.StringPtr("my-instance"))) - Expect(instanceTemplatePrototypeModel.NetworkInterfaces).To(Equal([]vpcv1.NetworkInterfacePrototype{*networkInterfacePrototypeModel})) - Expect(instanceTemplatePrototypeModel.PlacementTarget).To(Equal(instancePlacementTargetPrototypeModel)) - Expect(instanceTemplatePrototypeModel.Profile).To(Equal(instanceProfileIdentityModel)) - Expect(instanceTemplatePrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(instanceTemplatePrototypeModel.TotalVolumeBandwidth).To(Equal(core.Int64Ptr(int64(500)))) - Expect(instanceTemplatePrototypeModel.UserData).To(Equal(core.StringPtr("testString"))) - Expect(instanceTemplatePrototypeModel.VolumeAttachments).To(Equal([]vpcv1.VolumeAttachmentPrototype{*volumeAttachmentPrototypeModel})) - Expect(instanceTemplatePrototypeModel.VPC).To(Equal(vpcIdentityModel)) - Expect(instanceTemplatePrototypeModel.BootVolumeAttachment).To(Equal(volumeAttachmentPrototypeInstanceByImageContextModel)) - Expect(instanceTemplatePrototypeModel.Image).To(Equal(imageIdentityModel)) - Expect(instanceTemplatePrototypeModel.PrimaryNetworkInterface).To(Equal(networkInterfacePrototypeModel)) - Expect(instanceTemplatePrototypeModel.Zone).To(Equal(zoneIdentityModel)) - - // Construct an instance of the CreateInstanceTemplateOptions model - var instanceTemplatePrototype vpcv1.InstanceTemplatePrototypeIntf = nil - createInstanceTemplateOptionsModel := vpcService.NewCreateInstanceTemplateOptions(instanceTemplatePrototype) - createInstanceTemplateOptionsModel.SetInstanceTemplatePrototype(instanceTemplatePrototypeModel) - createInstanceTemplateOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createInstanceTemplateOptionsModel).ToNot(BeNil()) - Expect(createInstanceTemplateOptionsModel.InstanceTemplatePrototype).To(Equal(instanceTemplatePrototypeModel)) - Expect(createInstanceTemplateOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateInstanceVolumeAttachmentOptions successfully`, func() { - // Construct an instance of the VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID model - volumeAttachmentPrototypeVolumeModel := new(vpcv1.VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - Expect(volumeAttachmentPrototypeVolumeModel).ToNot(BeNil()) - volumeAttachmentPrototypeVolumeModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - Expect(volumeAttachmentPrototypeVolumeModel.ID).To(Equal(core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5"))) - - // Construct an instance of the CreateInstanceVolumeAttachmentOptions model - instanceID := "testString" - var createInstanceVolumeAttachmentOptionsVolume vpcv1.VolumeAttachmentPrototypeVolumeIntf = nil - createInstanceVolumeAttachmentOptionsModel := vpcService.NewCreateInstanceVolumeAttachmentOptions(instanceID, createInstanceVolumeAttachmentOptionsVolume) - createInstanceVolumeAttachmentOptionsModel.SetInstanceID("testString") - createInstanceVolumeAttachmentOptionsModel.SetVolume(volumeAttachmentPrototypeVolumeModel) - createInstanceVolumeAttachmentOptionsModel.SetDeleteVolumeOnInstanceDelete(false) - createInstanceVolumeAttachmentOptionsModel.SetName("my-volume-attachment") - createInstanceVolumeAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createInstanceVolumeAttachmentOptionsModel).ToNot(BeNil()) - Expect(createInstanceVolumeAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createInstanceVolumeAttachmentOptionsModel.Volume).To(Equal(volumeAttachmentPrototypeVolumeModel)) - Expect(createInstanceVolumeAttachmentOptionsModel.DeleteVolumeOnInstanceDelete).To(Equal(core.BoolPtr(false))) - Expect(createInstanceVolumeAttachmentOptionsModel.Name).To(Equal(core.StringPtr("my-volume-attachment"))) - Expect(createInstanceVolumeAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateIpsecPolicyOptions successfully`, func() { - // 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 CreateIpsecPolicyOptions model - createIpsecPolicyOptionsAuthenticationAlgorithm := "disabled" - createIpsecPolicyOptionsEncryptionAlgorithm := "aes128" - createIpsecPolicyOptionsPfs := "disabled" - createIpsecPolicyOptionsModel := vpcService.NewCreateIpsecPolicyOptions(createIpsecPolicyOptionsAuthenticationAlgorithm, createIpsecPolicyOptionsEncryptionAlgorithm, createIpsecPolicyOptionsPfs) - createIpsecPolicyOptionsModel.SetAuthenticationAlgorithm("disabled") - createIpsecPolicyOptionsModel.SetEncryptionAlgorithm("aes128") - createIpsecPolicyOptionsModel.SetPfs("disabled") - createIpsecPolicyOptionsModel.SetKeyLifetime(int64(3600)) - createIpsecPolicyOptionsModel.SetName("my-ipsec-policy") - createIpsecPolicyOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createIpsecPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createIpsecPolicyOptionsModel).ToNot(BeNil()) - Expect(createIpsecPolicyOptionsModel.AuthenticationAlgorithm).To(Equal(core.StringPtr("disabled"))) - Expect(createIpsecPolicyOptionsModel.EncryptionAlgorithm).To(Equal(core.StringPtr("aes128"))) - Expect(createIpsecPolicyOptionsModel.Pfs).To(Equal(core.StringPtr("disabled"))) - Expect(createIpsecPolicyOptionsModel.KeyLifetime).To(Equal(core.Int64Ptr(int64(3600)))) - Expect(createIpsecPolicyOptionsModel.Name).To(Equal(core.StringPtr("my-ipsec-policy"))) - Expect(createIpsecPolicyOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createIpsecPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateKeyOptions successfully`, func() { - // 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 CreateKeyOptions model - createKeyOptionsPublicKey := "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En" - createKeyOptionsModel := vpcService.NewCreateKeyOptions(createKeyOptionsPublicKey) - createKeyOptionsModel.SetPublicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En") - createKeyOptionsModel.SetName("my-key") - createKeyOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createKeyOptionsModel.SetType("rsa") - createKeyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createKeyOptionsModel).ToNot(BeNil()) - Expect(createKeyOptionsModel.PublicKey).To(Equal(core.StringPtr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDGe50Bxa5T5NDddrrtbx2Y4/VGbiCgXqnBsYToIUKoFSHTQl5IX3PasGnneKanhcLwWz5M5MoCRvhxTp66NKzIfAz7r+FX9rxgR+ZgcM253YAqOVeIpOU408simDZKriTlN8kYsXL7P34tsWuAJf4MgZtJAQxous/2byetpdCv8ddnT4X3ltOg9w+LqSCPYfNivqH00Eh7S1Ldz7I8aw5WOp5a+sQFP/RbwfpwHp+ny7DfeIOokcuI42tJkoBn7UsLTVpCSmXr2EDRlSWe/1M/iHNRBzaT3CK0+SwZWd2AEjePxSnWKNGIEUJDlUYp7hKhiQcgT5ZAnWU121oc5En"))) - Expect(createKeyOptionsModel.Name).To(Equal(core.StringPtr("my-key"))) - Expect(createKeyOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createKeyOptionsModel.Type).To(Equal(core.StringPtr("rsa"))) - Expect(createKeyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateLoadBalancerListenerOptions successfully`, func() { - // Construct an instance of the CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - Expect(certificateInstanceIdentityModel).ToNot(BeNil()) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - Expect(certificateInstanceIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"))) - - // Construct an instance of the LoadBalancerPoolIdentityByID model - loadBalancerPoolIdentityModel := new(vpcv1.LoadBalancerPoolIdentityByID) - Expect(loadBalancerPoolIdentityModel).ToNot(BeNil()) - loadBalancerPoolIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - Expect(loadBalancerPoolIdentityModel.ID).To(Equal(core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004"))) - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - Expect(loadBalancerListenerIdentityModel).ToNot(BeNil()) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - Expect(loadBalancerListenerIdentityModel.ID).To(Equal(core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004"))) - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model - loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) - Expect(loadBalancerListenerHTTPSRedirectPrototypeModel).ToNot(BeNil()) - loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") - Expect(loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode).To(Equal(core.Int64Ptr(int64(301)))) - Expect(loadBalancerListenerHTTPSRedirectPrototypeModel.Listener).To(Equal(loadBalancerListenerIdentityModel)) - Expect(loadBalancerListenerHTTPSRedirectPrototypeModel.URI).To(Equal(core.StringPtr("/example?doc=get"))) - - // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model - loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) - Expect(loadBalancerListenerPolicyRulePrototypeModel).ToNot(BeNil()) - loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") - Expect(loadBalancerListenerPolicyRulePrototypeModel.Condition).To(Equal(core.StringPtr("contains"))) - Expect(loadBalancerListenerPolicyRulePrototypeModel.Field).To(Equal(core.StringPtr("MY-APP-HEADER"))) - Expect(loadBalancerListenerPolicyRulePrototypeModel.Type).To(Equal(core.StringPtr("body"))) - Expect(loadBalancerListenerPolicyRulePrototypeModel.Value).To(Equal(core.StringPtr("testString"))) - - // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - Expect(loadBalancerListenerPolicyTargetPrototypeModel).ToNot(BeNil()) - loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - Expect(loadBalancerListenerPolicyTargetPrototypeModel.ID).To(Equal(core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004"))) - - // Construct an instance of the LoadBalancerListenerPolicyPrototype model - loadBalancerListenerPolicyPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyPrototype) - Expect(loadBalancerListenerPolicyPrototypeModel).ToNot(BeNil()) - loadBalancerListenerPolicyPrototypeModel.Action = core.StringPtr("forward") - loadBalancerListenerPolicyPrototypeModel.Name = core.StringPtr("my-policy") - loadBalancerListenerPolicyPrototypeModel.Priority = core.Int64Ptr(int64(5)) - loadBalancerListenerPolicyPrototypeModel.Rules = []vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel} - loadBalancerListenerPolicyPrototypeModel.Target = loadBalancerListenerPolicyTargetPrototypeModel - Expect(loadBalancerListenerPolicyPrototypeModel.Action).To(Equal(core.StringPtr("forward"))) - Expect(loadBalancerListenerPolicyPrototypeModel.Name).To(Equal(core.StringPtr("my-policy"))) - Expect(loadBalancerListenerPolicyPrototypeModel.Priority).To(Equal(core.Int64Ptr(int64(5)))) - Expect(loadBalancerListenerPolicyPrototypeModel.Rules).To(Equal([]vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel})) - Expect(loadBalancerListenerPolicyPrototypeModel.Target).To(Equal(loadBalancerListenerPolicyTargetPrototypeModel)) - - // Construct an instance of the CreateLoadBalancerListenerOptions model - loadBalancerID := "testString" - createLoadBalancerListenerOptionsProtocol := "http" - createLoadBalancerListenerOptionsModel := vpcService.NewCreateLoadBalancerListenerOptions(loadBalancerID, createLoadBalancerListenerOptionsProtocol) - createLoadBalancerListenerOptionsModel.SetLoadBalancerID("testString") - createLoadBalancerListenerOptionsModel.SetProtocol("http") - createLoadBalancerListenerOptionsModel.SetAcceptProxyProtocol(true) - createLoadBalancerListenerOptionsModel.SetCertificateInstance(certificateInstanceIdentityModel) - createLoadBalancerListenerOptionsModel.SetConnectionLimit(int64(2000)) - createLoadBalancerListenerOptionsModel.SetDefaultPool(loadBalancerPoolIdentityModel) - createLoadBalancerListenerOptionsModel.SetHTTPSRedirect(loadBalancerListenerHTTPSRedirectPrototypeModel) - createLoadBalancerListenerOptionsModel.SetPolicies([]vpcv1.LoadBalancerListenerPolicyPrototype{*loadBalancerListenerPolicyPrototypeModel}) - createLoadBalancerListenerOptionsModel.SetPort(int64(443)) - createLoadBalancerListenerOptionsModel.SetPortMax(int64(499)) - createLoadBalancerListenerOptionsModel.SetPortMin(int64(443)) - createLoadBalancerListenerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createLoadBalancerListenerOptionsModel).ToNot(BeNil()) - Expect(createLoadBalancerListenerOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(createLoadBalancerListenerOptionsModel.Protocol).To(Equal(core.StringPtr("http"))) - Expect(createLoadBalancerListenerOptionsModel.AcceptProxyProtocol).To(Equal(core.BoolPtr(true))) - Expect(createLoadBalancerListenerOptionsModel.CertificateInstance).To(Equal(certificateInstanceIdentityModel)) - Expect(createLoadBalancerListenerOptionsModel.ConnectionLimit).To(Equal(core.Int64Ptr(int64(2000)))) - Expect(createLoadBalancerListenerOptionsModel.DefaultPool).To(Equal(loadBalancerPoolIdentityModel)) - Expect(createLoadBalancerListenerOptionsModel.HTTPSRedirect).To(Equal(loadBalancerListenerHTTPSRedirectPrototypeModel)) - Expect(createLoadBalancerListenerOptionsModel.Policies).To(Equal([]vpcv1.LoadBalancerListenerPolicyPrototype{*loadBalancerListenerPolicyPrototypeModel})) - Expect(createLoadBalancerListenerOptionsModel.Port).To(Equal(core.Int64Ptr(int64(443)))) - Expect(createLoadBalancerListenerOptionsModel.PortMax).To(Equal(core.Int64Ptr(int64(499)))) - Expect(createLoadBalancerListenerOptionsModel.PortMin).To(Equal(core.Int64Ptr(int64(443)))) - Expect(createLoadBalancerListenerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateLoadBalancerListenerPolicyOptions successfully`, func() { - // Construct an instance of the LoadBalancerListenerPolicyRulePrototype model - loadBalancerListenerPolicyRulePrototypeModel := new(vpcv1.LoadBalancerListenerPolicyRulePrototype) - Expect(loadBalancerListenerPolicyRulePrototypeModel).ToNot(BeNil()) - loadBalancerListenerPolicyRulePrototypeModel.Condition = core.StringPtr("contains") - loadBalancerListenerPolicyRulePrototypeModel.Field = core.StringPtr("MY-APP-HEADER") - loadBalancerListenerPolicyRulePrototypeModel.Type = core.StringPtr("body") - loadBalancerListenerPolicyRulePrototypeModel.Value = core.StringPtr("testString") - Expect(loadBalancerListenerPolicyRulePrototypeModel.Condition).To(Equal(core.StringPtr("contains"))) - Expect(loadBalancerListenerPolicyRulePrototypeModel.Field).To(Equal(core.StringPtr("MY-APP-HEADER"))) - Expect(loadBalancerListenerPolicyRulePrototypeModel.Type).To(Equal(core.StringPtr("body"))) - Expect(loadBalancerListenerPolicyRulePrototypeModel.Value).To(Equal(core.StringPtr("testString"))) - - // Construct an instance of the LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID model - loadBalancerListenerPolicyTargetPrototypeModel := new(vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - Expect(loadBalancerListenerPolicyTargetPrototypeModel).ToNot(BeNil()) - loadBalancerListenerPolicyTargetPrototypeModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - Expect(loadBalancerListenerPolicyTargetPrototypeModel.ID).To(Equal(core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004"))) - - // Construct an instance of the CreateLoadBalancerListenerPolicyOptions model - loadBalancerID := "testString" - listenerID := "testString" - createLoadBalancerListenerPolicyOptionsAction := "forward" - createLoadBalancerListenerPolicyOptionsPriority := int64(5) - createLoadBalancerListenerPolicyOptionsModel := vpcService.NewCreateLoadBalancerListenerPolicyOptions(loadBalancerID, listenerID, createLoadBalancerListenerPolicyOptionsAction, createLoadBalancerListenerPolicyOptionsPriority) - createLoadBalancerListenerPolicyOptionsModel.SetLoadBalancerID("testString") - createLoadBalancerListenerPolicyOptionsModel.SetListenerID("testString") - createLoadBalancerListenerPolicyOptionsModel.SetAction("forward") - createLoadBalancerListenerPolicyOptionsModel.SetPriority(int64(5)) - createLoadBalancerListenerPolicyOptionsModel.SetName("my-policy") - createLoadBalancerListenerPolicyOptionsModel.SetRules([]vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel}) - createLoadBalancerListenerPolicyOptionsModel.SetTarget(loadBalancerListenerPolicyTargetPrototypeModel) - createLoadBalancerListenerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createLoadBalancerListenerPolicyOptionsModel).ToNot(BeNil()) - Expect(createLoadBalancerListenerPolicyOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(createLoadBalancerListenerPolicyOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) - Expect(createLoadBalancerListenerPolicyOptionsModel.Action).To(Equal(core.StringPtr("forward"))) - Expect(createLoadBalancerListenerPolicyOptionsModel.Priority).To(Equal(core.Int64Ptr(int64(5)))) - Expect(createLoadBalancerListenerPolicyOptionsModel.Name).To(Equal(core.StringPtr("my-policy"))) - Expect(createLoadBalancerListenerPolicyOptionsModel.Rules).To(Equal([]vpcv1.LoadBalancerListenerPolicyRulePrototype{*loadBalancerListenerPolicyRulePrototypeModel})) - Expect(createLoadBalancerListenerPolicyOptionsModel.Target).To(Equal(loadBalancerListenerPolicyTargetPrototypeModel)) - Expect(createLoadBalancerListenerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateLoadBalancerListenerPolicyRuleOptions successfully`, func() { - // Construct an instance of the CreateLoadBalancerListenerPolicyRuleOptions model - loadBalancerID := "testString" - listenerID := "testString" - policyID := "testString" - createLoadBalancerListenerPolicyRuleOptionsCondition := "contains" - createLoadBalancerListenerPolicyRuleOptionsType := "body" - createLoadBalancerListenerPolicyRuleOptionsValue := "testString" - createLoadBalancerListenerPolicyRuleOptionsModel := vpcService.NewCreateLoadBalancerListenerPolicyRuleOptions(loadBalancerID, listenerID, policyID, createLoadBalancerListenerPolicyRuleOptionsCondition, createLoadBalancerListenerPolicyRuleOptionsType, createLoadBalancerListenerPolicyRuleOptionsValue) - createLoadBalancerListenerPolicyRuleOptionsModel.SetLoadBalancerID("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.SetListenerID("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.SetPolicyID("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.SetCondition("contains") - createLoadBalancerListenerPolicyRuleOptionsModel.SetType("body") - createLoadBalancerListenerPolicyRuleOptionsModel.SetValue("testString") - createLoadBalancerListenerPolicyRuleOptionsModel.SetField("MY-APP-HEADER") - createLoadBalancerListenerPolicyRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createLoadBalancerListenerPolicyRuleOptionsModel).ToNot(BeNil()) - Expect(createLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(createLoadBalancerListenerPolicyRuleOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) - Expect(createLoadBalancerListenerPolicyRuleOptionsModel.PolicyID).To(Equal(core.StringPtr("testString"))) - Expect(createLoadBalancerListenerPolicyRuleOptionsModel.Condition).To(Equal(core.StringPtr("contains"))) - Expect(createLoadBalancerListenerPolicyRuleOptionsModel.Type).To(Equal(core.StringPtr("body"))) - Expect(createLoadBalancerListenerPolicyRuleOptionsModel.Value).To(Equal(core.StringPtr("testString"))) - Expect(createLoadBalancerListenerPolicyRuleOptionsModel.Field).To(Equal(core.StringPtr("MY-APP-HEADER"))) - Expect(createLoadBalancerListenerPolicyRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateLoadBalancerOptions successfully`, func() { - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - Expect(subnetIdentityModel).ToNot(BeNil()) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) - - // Construct an instance of the LoadBalancerLoggingDatapathPrototype model - loadBalancerLoggingDatapathPrototypeModel := new(vpcv1.LoadBalancerLoggingDatapathPrototype) - Expect(loadBalancerLoggingDatapathPrototypeModel).ToNot(BeNil()) - loadBalancerLoggingDatapathPrototypeModel.Active = core.BoolPtr(true) - Expect(loadBalancerLoggingDatapathPrototypeModel.Active).To(Equal(core.BoolPtr(true))) - - // Construct an instance of the CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - Expect(certificateInstanceIdentityModel).ToNot(BeNil()) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - Expect(certificateInstanceIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"))) - - // Construct an instance of the LoadBalancerPoolIdentityByName model - loadBalancerPoolIdentityByNameModel := new(vpcv1.LoadBalancerPoolIdentityByName) - Expect(loadBalancerPoolIdentityByNameModel).ToNot(BeNil()) - loadBalancerPoolIdentityByNameModel.Name = core.StringPtr("my-load-balancer-pool") - Expect(loadBalancerPoolIdentityByNameModel.Name).To(Equal(core.StringPtr("my-load-balancer-pool"))) - - // Construct an instance of the LoadBalancerListenerIdentityByID model - loadBalancerListenerIdentityModel := new(vpcv1.LoadBalancerListenerIdentityByID) - Expect(loadBalancerListenerIdentityModel).ToNot(BeNil()) - loadBalancerListenerIdentityModel.ID = core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004") - Expect(loadBalancerListenerIdentityModel.ID).To(Equal(core.StringPtr("70294e14-4e61-11e8-bcf4-0242ac110004"))) - - // Construct an instance of the LoadBalancerListenerHTTPSRedirectPrototype model - loadBalancerListenerHTTPSRedirectPrototypeModel := new(vpcv1.LoadBalancerListenerHTTPSRedirectPrototype) - Expect(loadBalancerListenerHTTPSRedirectPrototypeModel).ToNot(BeNil()) - loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode = core.Int64Ptr(int64(301)) - loadBalancerListenerHTTPSRedirectPrototypeModel.Listener = loadBalancerListenerIdentityModel - loadBalancerListenerHTTPSRedirectPrototypeModel.URI = core.StringPtr("/example?doc=get") - Expect(loadBalancerListenerHTTPSRedirectPrototypeModel.HTTPStatusCode).To(Equal(core.Int64Ptr(int64(301)))) - Expect(loadBalancerListenerHTTPSRedirectPrototypeModel.Listener).To(Equal(loadBalancerListenerIdentityModel)) - Expect(loadBalancerListenerHTTPSRedirectPrototypeModel.URI).To(Equal(core.StringPtr("/example?doc=get"))) - - // Construct an instance of the LoadBalancerListenerPrototypeLoadBalancerContext model - loadBalancerListenerPrototypeLoadBalancerContextModel := new(vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext) - Expect(loadBalancerListenerPrototypeLoadBalancerContextModel).ToNot(BeNil()) - loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol = core.BoolPtr(true) - loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance = certificateInstanceIdentityModel - loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit = core.Int64Ptr(int64(2000)) - loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool = loadBalancerPoolIdentityByNameModel - loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect = loadBalancerListenerHTTPSRedirectPrototypeModel - loadBalancerListenerPrototypeLoadBalancerContextModel.Port = core.Int64Ptr(int64(443)) - loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax = core.Int64Ptr(int64(499)) - loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin = core.Int64Ptr(int64(443)) - loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol = core.StringPtr("http") - Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.AcceptProxyProtocol).To(Equal(core.BoolPtr(true))) - Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.CertificateInstance).To(Equal(certificateInstanceIdentityModel)) - Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.ConnectionLimit).To(Equal(core.Int64Ptr(int64(2000)))) - Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.DefaultPool).To(Equal(loadBalancerPoolIdentityByNameModel)) - Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.HTTPSRedirect).To(Equal(loadBalancerListenerHTTPSRedirectPrototypeModel)) - Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.Port).To(Equal(core.Int64Ptr(int64(443)))) - Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.PortMax).To(Equal(core.Int64Ptr(int64(499)))) - Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.PortMin).To(Equal(core.Int64Ptr(int64(443)))) - Expect(loadBalancerListenerPrototypeLoadBalancerContextModel.Protocol).To(Equal(core.StringPtr("http"))) - - // Construct an instance of the LoadBalancerLoggingPrototype model - loadBalancerLoggingPrototypeModel := new(vpcv1.LoadBalancerLoggingPrototype) - Expect(loadBalancerLoggingPrototypeModel).ToNot(BeNil()) - loadBalancerLoggingPrototypeModel.Datapath = loadBalancerLoggingDatapathPrototypeModel - Expect(loadBalancerLoggingPrototypeModel.Datapath).To(Equal(loadBalancerLoggingDatapathPrototypeModel)) - - // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model - loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) - Expect(loadBalancerPoolHealthMonitorPrototypeModel).ToNot(BeNil()) - loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") - Expect(loadBalancerPoolHealthMonitorPrototypeModel.Delay).To(Equal(core.Int64Ptr(int64(5)))) - Expect(loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries).To(Equal(core.Int64Ptr(int64(2)))) - Expect(loadBalancerPoolHealthMonitorPrototypeModel.Port).To(Equal(core.Int64Ptr(int64(22)))) - Expect(loadBalancerPoolHealthMonitorPrototypeModel.Timeout).To(Equal(core.Int64Ptr(int64(2)))) - Expect(loadBalancerPoolHealthMonitorPrototypeModel.Type).To(Equal(core.StringPtr("http"))) - Expect(loadBalancerPoolHealthMonitorPrototypeModel.URLPath).To(Equal(core.StringPtr("/"))) - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - Expect(loadBalancerPoolMemberTargetPrototypeModel).ToNot(BeNil()) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a"))) - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - Expect(loadBalancerPoolMemberPrototypeModel).ToNot(BeNil()) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - Expect(loadBalancerPoolMemberPrototypeModel.Port).To(Equal(core.Int64Ptr(int64(80)))) - Expect(loadBalancerPoolMemberPrototypeModel.Target).To(Equal(loadBalancerPoolMemberTargetPrototypeModel)) - Expect(loadBalancerPoolMemberPrototypeModel.Weight).To(Equal(core.Int64Ptr(int64(50)))) - - // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model - loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) - Expect(loadBalancerPoolSessionPersistencePrototypeModel).ToNot(BeNil()) - loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") - Expect(loadBalancerPoolSessionPersistencePrototypeModel.CookieName).To(Equal(core.StringPtr("my-cookie-name"))) - Expect(loadBalancerPoolSessionPersistencePrototypeModel.Type).To(Equal(core.StringPtr("app_cookie"))) - - // Construct an instance of the LoadBalancerPoolPrototype model - loadBalancerPoolPrototypeModel := new(vpcv1.LoadBalancerPoolPrototype) - Expect(loadBalancerPoolPrototypeModel).ToNot(BeNil()) - loadBalancerPoolPrototypeModel.Algorithm = core.StringPtr("least_connections") - loadBalancerPoolPrototypeModel.HealthMonitor = loadBalancerPoolHealthMonitorPrototypeModel - loadBalancerPoolPrototypeModel.Members = []vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel} - loadBalancerPoolPrototypeModel.Name = core.StringPtr("my-load-balancer-pool") - loadBalancerPoolPrototypeModel.Protocol = core.StringPtr("http") - loadBalancerPoolPrototypeModel.ProxyProtocol = core.StringPtr("disabled") - loadBalancerPoolPrototypeModel.SessionPersistence = loadBalancerPoolSessionPersistencePrototypeModel - Expect(loadBalancerPoolPrototypeModel.Algorithm).To(Equal(core.StringPtr("least_connections"))) - Expect(loadBalancerPoolPrototypeModel.HealthMonitor).To(Equal(loadBalancerPoolHealthMonitorPrototypeModel)) - Expect(loadBalancerPoolPrototypeModel.Members).To(Equal([]vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel})) - Expect(loadBalancerPoolPrototypeModel.Name).To(Equal(core.StringPtr("my-load-balancer-pool"))) - Expect(loadBalancerPoolPrototypeModel.Protocol).To(Equal(core.StringPtr("http"))) - Expect(loadBalancerPoolPrototypeModel.ProxyProtocol).To(Equal(core.StringPtr("disabled"))) - Expect(loadBalancerPoolPrototypeModel.SessionPersistence).To(Equal(loadBalancerPoolSessionPersistencePrototypeModel)) - - // Construct an instance of the LoadBalancerProfileIdentityByName model - loadBalancerProfileIdentityModel := new(vpcv1.LoadBalancerProfileIdentityByName) - Expect(loadBalancerProfileIdentityModel).ToNot(BeNil()) - loadBalancerProfileIdentityModel.Name = core.StringPtr("network-fixed") - Expect(loadBalancerProfileIdentityModel.Name).To(Equal(core.StringPtr("network-fixed"))) - - // 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 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"))) - - // Construct an instance of the CreateLoadBalancerOptions model - createLoadBalancerOptionsIsPublic := true - createLoadBalancerOptionsSubnets := []vpcv1.SubnetIdentityIntf{} - createLoadBalancerOptionsModel := vpcService.NewCreateLoadBalancerOptions(createLoadBalancerOptionsIsPublic, createLoadBalancerOptionsSubnets) - createLoadBalancerOptionsModel.SetIsPublic(true) - createLoadBalancerOptionsModel.SetSubnets([]vpcv1.SubnetIdentityIntf{subnetIdentityModel}) - createLoadBalancerOptionsModel.SetDatapath(loadBalancerLoggingDatapathPrototypeModel) - createLoadBalancerOptionsModel.SetListeners([]vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel}) - createLoadBalancerOptionsModel.SetLogging(loadBalancerLoggingPrototypeModel) - createLoadBalancerOptionsModel.SetName("my-load-balancer") - createLoadBalancerOptionsModel.SetPools([]vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel}) - createLoadBalancerOptionsModel.SetProfile(loadBalancerProfileIdentityModel) - createLoadBalancerOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createLoadBalancerOptionsModel.SetRouteMode(true) - createLoadBalancerOptionsModel.SetSecurityGroups([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel}) - createLoadBalancerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createLoadBalancerOptionsModel).ToNot(BeNil()) - Expect(createLoadBalancerOptionsModel.IsPublic).To(Equal(core.BoolPtr(true))) - Expect(createLoadBalancerOptionsModel.Subnets).To(Equal([]vpcv1.SubnetIdentityIntf{subnetIdentityModel})) - Expect(createLoadBalancerOptionsModel.Datapath).To(Equal(loadBalancerLoggingDatapathPrototypeModel)) - Expect(createLoadBalancerOptionsModel.Listeners).To(Equal([]vpcv1.LoadBalancerListenerPrototypeLoadBalancerContext{*loadBalancerListenerPrototypeLoadBalancerContextModel})) - Expect(createLoadBalancerOptionsModel.Logging).To(Equal(loadBalancerLoggingPrototypeModel)) - Expect(createLoadBalancerOptionsModel.Name).To(Equal(core.StringPtr("my-load-balancer"))) - Expect(createLoadBalancerOptionsModel.Pools).To(Equal([]vpcv1.LoadBalancerPoolPrototype{*loadBalancerPoolPrototypeModel})) - Expect(createLoadBalancerOptionsModel.Profile).To(Equal(loadBalancerProfileIdentityModel)) - Expect(createLoadBalancerOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createLoadBalancerOptionsModel.RouteMode).To(Equal(core.BoolPtr(true))) - Expect(createLoadBalancerOptionsModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) - Expect(createLoadBalancerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateLoadBalancerPoolMemberOptions successfully`, func() { - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - Expect(loadBalancerPoolMemberTargetPrototypeModel).ToNot(BeNil()) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a"))) - - // Construct an instance of the CreateLoadBalancerPoolMemberOptions model - loadBalancerID := "testString" - poolID := "testString" - createLoadBalancerPoolMemberOptionsPort := int64(80) - var createLoadBalancerPoolMemberOptionsTarget vpcv1.LoadBalancerPoolMemberTargetPrototypeIntf = nil - createLoadBalancerPoolMemberOptionsModel := vpcService.NewCreateLoadBalancerPoolMemberOptions(loadBalancerID, poolID, createLoadBalancerPoolMemberOptionsPort, createLoadBalancerPoolMemberOptionsTarget) - createLoadBalancerPoolMemberOptionsModel.SetLoadBalancerID("testString") - createLoadBalancerPoolMemberOptionsModel.SetPoolID("testString") - createLoadBalancerPoolMemberOptionsModel.SetPort(int64(80)) - createLoadBalancerPoolMemberOptionsModel.SetTarget(loadBalancerPoolMemberTargetPrototypeModel) - createLoadBalancerPoolMemberOptionsModel.SetWeight(int64(50)) - createLoadBalancerPoolMemberOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createLoadBalancerPoolMemberOptionsModel).ToNot(BeNil()) - Expect(createLoadBalancerPoolMemberOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(createLoadBalancerPoolMemberOptionsModel.PoolID).To(Equal(core.StringPtr("testString"))) - Expect(createLoadBalancerPoolMemberOptionsModel.Port).To(Equal(core.Int64Ptr(int64(80)))) - Expect(createLoadBalancerPoolMemberOptionsModel.Target).To(Equal(loadBalancerPoolMemberTargetPrototypeModel)) - Expect(createLoadBalancerPoolMemberOptionsModel.Weight).To(Equal(core.Int64Ptr(int64(50)))) - Expect(createLoadBalancerPoolMemberOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateLoadBalancerPoolOptions successfully`, func() { - // Construct an instance of the LoadBalancerPoolHealthMonitorPrototype model - loadBalancerPoolHealthMonitorPrototypeModel := new(vpcv1.LoadBalancerPoolHealthMonitorPrototype) - Expect(loadBalancerPoolHealthMonitorPrototypeModel).ToNot(BeNil()) - loadBalancerPoolHealthMonitorPrototypeModel.Delay = core.Int64Ptr(int64(5)) - loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Port = core.Int64Ptr(int64(22)) - loadBalancerPoolHealthMonitorPrototypeModel.Timeout = core.Int64Ptr(int64(2)) - loadBalancerPoolHealthMonitorPrototypeModel.Type = core.StringPtr("http") - loadBalancerPoolHealthMonitorPrototypeModel.URLPath = core.StringPtr("/") - Expect(loadBalancerPoolHealthMonitorPrototypeModel.Delay).To(Equal(core.Int64Ptr(int64(5)))) - Expect(loadBalancerPoolHealthMonitorPrototypeModel.MaxRetries).To(Equal(core.Int64Ptr(int64(2)))) - Expect(loadBalancerPoolHealthMonitorPrototypeModel.Port).To(Equal(core.Int64Ptr(int64(22)))) - Expect(loadBalancerPoolHealthMonitorPrototypeModel.Timeout).To(Equal(core.Int64Ptr(int64(2)))) - Expect(loadBalancerPoolHealthMonitorPrototypeModel.Type).To(Equal(core.StringPtr("http"))) - Expect(loadBalancerPoolHealthMonitorPrototypeModel.URLPath).To(Equal(core.StringPtr("/"))) - - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - Expect(loadBalancerPoolMemberTargetPrototypeModel).ToNot(BeNil()) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a"))) - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - Expect(loadBalancerPoolMemberPrototypeModel).ToNot(BeNil()) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - Expect(loadBalancerPoolMemberPrototypeModel.Port).To(Equal(core.Int64Ptr(int64(80)))) - Expect(loadBalancerPoolMemberPrototypeModel.Target).To(Equal(loadBalancerPoolMemberTargetPrototypeModel)) - Expect(loadBalancerPoolMemberPrototypeModel.Weight).To(Equal(core.Int64Ptr(int64(50)))) - - // Construct an instance of the LoadBalancerPoolSessionPersistencePrototype model - loadBalancerPoolSessionPersistencePrototypeModel := new(vpcv1.LoadBalancerPoolSessionPersistencePrototype) - Expect(loadBalancerPoolSessionPersistencePrototypeModel).ToNot(BeNil()) - loadBalancerPoolSessionPersistencePrototypeModel.CookieName = core.StringPtr("my-cookie-name") - loadBalancerPoolSessionPersistencePrototypeModel.Type = core.StringPtr("app_cookie") - Expect(loadBalancerPoolSessionPersistencePrototypeModel.CookieName).To(Equal(core.StringPtr("my-cookie-name"))) - Expect(loadBalancerPoolSessionPersistencePrototypeModel.Type).To(Equal(core.StringPtr("app_cookie"))) - - // Construct an instance of the CreateLoadBalancerPoolOptions model - loadBalancerID := "testString" - createLoadBalancerPoolOptionsAlgorithm := "least_connections" - var createLoadBalancerPoolOptionsHealthMonitor *vpcv1.LoadBalancerPoolHealthMonitorPrototype = nil - createLoadBalancerPoolOptionsProtocol := "http" - createLoadBalancerPoolOptionsModel := vpcService.NewCreateLoadBalancerPoolOptions(loadBalancerID, createLoadBalancerPoolOptionsAlgorithm, createLoadBalancerPoolOptionsHealthMonitor, createLoadBalancerPoolOptionsProtocol) - createLoadBalancerPoolOptionsModel.SetLoadBalancerID("testString") - createLoadBalancerPoolOptionsModel.SetAlgorithm("least_connections") - createLoadBalancerPoolOptionsModel.SetHealthMonitor(loadBalancerPoolHealthMonitorPrototypeModel) - createLoadBalancerPoolOptionsModel.SetProtocol("http") - createLoadBalancerPoolOptionsModel.SetMembers([]vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel}) - createLoadBalancerPoolOptionsModel.SetName("my-load-balancer-pool") - createLoadBalancerPoolOptionsModel.SetProxyProtocol("disabled") - createLoadBalancerPoolOptionsModel.SetSessionPersistence(loadBalancerPoolSessionPersistencePrototypeModel) - createLoadBalancerPoolOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createLoadBalancerPoolOptionsModel).ToNot(BeNil()) - Expect(createLoadBalancerPoolOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(createLoadBalancerPoolOptionsModel.Algorithm).To(Equal(core.StringPtr("least_connections"))) - Expect(createLoadBalancerPoolOptionsModel.HealthMonitor).To(Equal(loadBalancerPoolHealthMonitorPrototypeModel)) - Expect(createLoadBalancerPoolOptionsModel.Protocol).To(Equal(core.StringPtr("http"))) - Expect(createLoadBalancerPoolOptionsModel.Members).To(Equal([]vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel})) - Expect(createLoadBalancerPoolOptionsModel.Name).To(Equal(core.StringPtr("my-load-balancer-pool"))) - Expect(createLoadBalancerPoolOptionsModel.ProxyProtocol).To(Equal(core.StringPtr("disabled"))) - Expect(createLoadBalancerPoolOptionsModel.SessionPersistence).To(Equal(loadBalancerPoolSessionPersistencePrototypeModel)) - Expect(createLoadBalancerPoolOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateNetworkACLOptions successfully`, func() { - // 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 VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - Expect(vpcIdentityModel).ToNot(BeNil()) - vpcIdentityModel.ID = core.StringPtr("cf7cd5a-2f30-4336-a495-6addc820cd61") - Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("cf7cd5a-2f30-4336-a495-6addc820cd61"))) - - // Construct an instance of the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype model - networkACLRulePrototypeNetworkACLContextModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - Expect(networkACLRulePrototypeNetworkACLContextModel).ToNot(BeNil()) - networkACLRulePrototypeNetworkACLContextModel.Action = core.StringPtr("allow") - networkACLRulePrototypeNetworkACLContextModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeNetworkACLContextModel.Direction = core.StringPtr("inbound") - networkACLRulePrototypeNetworkACLContextModel.IPVersion = core.StringPtr("ipv4") - networkACLRulePrototypeNetworkACLContextModel.Name = core.StringPtr("my-rule-2") - networkACLRulePrototypeNetworkACLContextModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePrototypeNetworkACLContextModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePrototypeNetworkACLContextModel.Protocol = core.StringPtr("udp") - networkACLRulePrototypeNetworkACLContextModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePrototypeNetworkACLContextModel.SourcePortMin = core.Int64Ptr(int64(49152)) - Expect(networkACLRulePrototypeNetworkACLContextModel.Action).To(Equal(core.StringPtr("allow"))) - Expect(networkACLRulePrototypeNetworkACLContextModel.Destination).To(Equal(core.StringPtr("192.168.3.2/32"))) - Expect(networkACLRulePrototypeNetworkACLContextModel.Direction).To(Equal(core.StringPtr("inbound"))) - Expect(networkACLRulePrototypeNetworkACLContextModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) - Expect(networkACLRulePrototypeNetworkACLContextModel.Name).To(Equal(core.StringPtr("my-rule-2"))) - Expect(networkACLRulePrototypeNetworkACLContextModel.Source).To(Equal(core.StringPtr("192.168.3.2/32"))) - Expect(networkACLRulePrototypeNetworkACLContextModel.DestinationPortMax).To(Equal(core.Int64Ptr(int64(22)))) - Expect(networkACLRulePrototypeNetworkACLContextModel.DestinationPortMin).To(Equal(core.Int64Ptr(int64(22)))) - Expect(networkACLRulePrototypeNetworkACLContextModel.Protocol).To(Equal(core.StringPtr("udp"))) - Expect(networkACLRulePrototypeNetworkACLContextModel.SourcePortMax).To(Equal(core.Int64Ptr(int64(65535)))) - Expect(networkACLRulePrototypeNetworkACLContextModel.SourcePortMin).To(Equal(core.Int64Ptr(int64(49152)))) - - // Construct an instance of the NetworkACLPrototypeNetworkACLByRules model - networkACLPrototypeModel := new(vpcv1.NetworkACLPrototypeNetworkACLByRules) - Expect(networkACLPrototypeModel).ToNot(BeNil()) - networkACLPrototypeModel.Name = core.StringPtr("my-network-acl") - networkACLPrototypeModel.ResourceGroup = resourceGroupIdentityModel - networkACLPrototypeModel.VPC = vpcIdentityModel - networkACLPrototypeModel.Rules = []vpcv1.NetworkACLRulePrototypeNetworkACLContextIntf{networkACLRulePrototypeNetworkACLContextModel} - Expect(networkACLPrototypeModel.Name).To(Equal(core.StringPtr("my-network-acl"))) - Expect(networkACLPrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(networkACLPrototypeModel.VPC).To(Equal(vpcIdentityModel)) - Expect(networkACLPrototypeModel.Rules).To(Equal([]vpcv1.NetworkACLRulePrototypeNetworkACLContextIntf{networkACLRulePrototypeNetworkACLContextModel})) - - // Construct an instance of the CreateNetworkACLOptions model - createNetworkACLOptionsModel := vpcService.NewCreateNetworkACLOptions() - createNetworkACLOptionsModel.SetNetworkACLPrototype(networkACLPrototypeModel) - createNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createNetworkACLOptionsModel).ToNot(BeNil()) - Expect(createNetworkACLOptionsModel.NetworkACLPrototype).To(Equal(networkACLPrototypeModel)) - Expect(createNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateNetworkACLRuleOptions successfully`, func() { - // Construct an instance of the NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID model - networkACLRuleBeforePrototypeModel := new(vpcv1.NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) - Expect(networkACLRuleBeforePrototypeModel).ToNot(BeNil()) - networkACLRuleBeforePrototypeModel.ID = core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9") - Expect(networkACLRuleBeforePrototypeModel.ID).To(Equal(core.StringPtr("8daca77a-4980-4d33-8f3e-7038797be8f9"))) - - // Construct an instance of the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype model - networkACLRulePrototypeModel := new(vpcv1.NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - Expect(networkACLRulePrototypeModel).ToNot(BeNil()) - networkACLRulePrototypeModel.Action = core.StringPtr("allow") - networkACLRulePrototypeModel.Before = networkACLRuleBeforePrototypeModel - networkACLRulePrototypeModel.Destination = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.Direction = core.StringPtr("inbound") - networkACLRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - networkACLRulePrototypeModel.Name = core.StringPtr("my-rule-2") - networkACLRulePrototypeModel.Source = core.StringPtr("192.168.3.2/32") - networkACLRulePrototypeModel.DestinationPortMax = core.Int64Ptr(int64(22)) - networkACLRulePrototypeModel.DestinationPortMin = core.Int64Ptr(int64(22)) - networkACLRulePrototypeModel.Protocol = core.StringPtr("udp") - networkACLRulePrototypeModel.SourcePortMax = core.Int64Ptr(int64(65535)) - networkACLRulePrototypeModel.SourcePortMin = core.Int64Ptr(int64(49152)) - Expect(networkACLRulePrototypeModel.Action).To(Equal(core.StringPtr("allow"))) - Expect(networkACLRulePrototypeModel.Before).To(Equal(networkACLRuleBeforePrototypeModel)) - Expect(networkACLRulePrototypeModel.Destination).To(Equal(core.StringPtr("192.168.3.2/32"))) - Expect(networkACLRulePrototypeModel.Direction).To(Equal(core.StringPtr("inbound"))) - Expect(networkACLRulePrototypeModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) - Expect(networkACLRulePrototypeModel.Name).To(Equal(core.StringPtr("my-rule-2"))) - Expect(networkACLRulePrototypeModel.Source).To(Equal(core.StringPtr("192.168.3.2/32"))) - Expect(networkACLRulePrototypeModel.DestinationPortMax).To(Equal(core.Int64Ptr(int64(22)))) - Expect(networkACLRulePrototypeModel.DestinationPortMin).To(Equal(core.Int64Ptr(int64(22)))) - Expect(networkACLRulePrototypeModel.Protocol).To(Equal(core.StringPtr("udp"))) - Expect(networkACLRulePrototypeModel.SourcePortMax).To(Equal(core.Int64Ptr(int64(65535)))) - Expect(networkACLRulePrototypeModel.SourcePortMin).To(Equal(core.Int64Ptr(int64(49152)))) - - // Construct an instance of the CreateNetworkACLRuleOptions model - networkACLID := "testString" - var networkACLRulePrototype vpcv1.NetworkACLRulePrototypeIntf = nil - createNetworkACLRuleOptionsModel := vpcService.NewCreateNetworkACLRuleOptions(networkACLID, networkACLRulePrototype) - createNetworkACLRuleOptionsModel.SetNetworkACLID("testString") - createNetworkACLRuleOptionsModel.SetNetworkACLRulePrototype(networkACLRulePrototypeModel) - createNetworkACLRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createNetworkACLRuleOptionsModel).ToNot(BeNil()) - Expect(createNetworkACLRuleOptionsModel.NetworkACLID).To(Equal(core.StringPtr("testString"))) - Expect(createNetworkACLRuleOptionsModel.NetworkACLRulePrototype).To(Equal(networkACLRulePrototypeModel)) - Expect(createNetworkACLRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreatePlacementGroupOptions successfully`, func() { - // 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 CreatePlacementGroupOptions model - createPlacementGroupOptionsStrategy := "host_spread" - createPlacementGroupOptionsModel := vpcService.NewCreatePlacementGroupOptions(createPlacementGroupOptionsStrategy) - createPlacementGroupOptionsModel.SetStrategy("host_spread") - createPlacementGroupOptionsModel.SetName("my-placement-group") - createPlacementGroupOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createPlacementGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createPlacementGroupOptionsModel).ToNot(BeNil()) - Expect(createPlacementGroupOptionsModel.Strategy).To(Equal(core.StringPtr("host_spread"))) - Expect(createPlacementGroupOptionsModel.Name).To(Equal(core.StringPtr("my-placement-group"))) - Expect(createPlacementGroupOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createPlacementGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreatePublicGatewayOptions successfully`, func() { - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - Expect(vpcIdentityModel).ToNot(BeNil()) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") - Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("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 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"))) - - // 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 CreatePublicGatewayOptions model - var createPublicGatewayOptionsVPC vpcv1.VPCIdentityIntf = nil - var createPublicGatewayOptionsZone vpcv1.ZoneIdentityIntf = nil - createPublicGatewayOptionsModel := vpcService.NewCreatePublicGatewayOptions(createPublicGatewayOptionsVPC, createPublicGatewayOptionsZone) - createPublicGatewayOptionsModel.SetVPC(vpcIdentityModel) - createPublicGatewayOptionsModel.SetZone(zoneIdentityModel) - createPublicGatewayOptionsModel.SetFloatingIP(publicGatewayFloatingIPPrototypeModel) - createPublicGatewayOptionsModel.SetName("my-public-gateway") - createPublicGatewayOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createPublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createPublicGatewayOptionsModel).ToNot(BeNil()) - Expect(createPublicGatewayOptionsModel.VPC).To(Equal(vpcIdentityModel)) - Expect(createPublicGatewayOptionsModel.Zone).To(Equal(zoneIdentityModel)) - Expect(createPublicGatewayOptionsModel.FloatingIP).To(Equal(publicGatewayFloatingIPPrototypeModel)) - Expect(createPublicGatewayOptionsModel.Name).To(Equal(core.StringPtr("my-public-gateway"))) - Expect(createPublicGatewayOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createPublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateSecurityGroupOptions successfully`, func() { - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - Expect(vpcIdentityModel).ToNot(BeNil()) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") - Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b"))) - - // 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 SecurityGroupRuleRemotePrototypeIP model - securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) - Expect(securityGroupRuleRemotePrototypeModel).ToNot(BeNil()) - securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - Expect(securityGroupRuleRemotePrototypeModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) - - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - Expect(securityGroupRulePrototypeModel).ToNot(BeNil()) - securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") - securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - Expect(securityGroupRulePrototypeModel.Direction).To(Equal(core.StringPtr("inbound"))) - Expect(securityGroupRulePrototypeModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) - Expect(securityGroupRulePrototypeModel.Protocol).To(Equal(core.StringPtr("all"))) - Expect(securityGroupRulePrototypeModel.Remote).To(Equal(securityGroupRuleRemotePrototypeModel)) - - // Construct an instance of the CreateSecurityGroupOptions model - var createSecurityGroupOptionsVPC vpcv1.VPCIdentityIntf = nil - createSecurityGroupOptionsModel := vpcService.NewCreateSecurityGroupOptions(createSecurityGroupOptionsVPC) - createSecurityGroupOptionsModel.SetVPC(vpcIdentityModel) - createSecurityGroupOptionsModel.SetName("my-security-group") - createSecurityGroupOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createSecurityGroupOptionsModel.SetRules([]vpcv1.SecurityGroupRulePrototypeIntf{securityGroupRulePrototypeModel}) - createSecurityGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createSecurityGroupOptionsModel).ToNot(BeNil()) - Expect(createSecurityGroupOptionsModel.VPC).To(Equal(vpcIdentityModel)) - Expect(createSecurityGroupOptionsModel.Name).To(Equal(core.StringPtr("my-security-group"))) - Expect(createSecurityGroupOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createSecurityGroupOptionsModel.Rules).To(Equal([]vpcv1.SecurityGroupRulePrototypeIntf{securityGroupRulePrototypeModel})) - Expect(createSecurityGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateSecurityGroupRuleOptions successfully`, func() { - // Construct an instance of the SecurityGroupRuleRemotePrototypeIP model - securityGroupRuleRemotePrototypeModel := new(vpcv1.SecurityGroupRuleRemotePrototypeIP) - Expect(securityGroupRuleRemotePrototypeModel).ToNot(BeNil()) - securityGroupRuleRemotePrototypeModel.Address = core.StringPtr("192.168.3.4") - Expect(securityGroupRuleRemotePrototypeModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) - - // Construct an instance of the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll model - securityGroupRulePrototypeModel := new(vpcv1.SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - Expect(securityGroupRulePrototypeModel).ToNot(BeNil()) - securityGroupRulePrototypeModel.Direction = core.StringPtr("inbound") - securityGroupRulePrototypeModel.IPVersion = core.StringPtr("ipv4") - securityGroupRulePrototypeModel.Protocol = core.StringPtr("all") - securityGroupRulePrototypeModel.Remote = securityGroupRuleRemotePrototypeModel - Expect(securityGroupRulePrototypeModel.Direction).To(Equal(core.StringPtr("inbound"))) - Expect(securityGroupRulePrototypeModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) - Expect(securityGroupRulePrototypeModel.Protocol).To(Equal(core.StringPtr("all"))) - Expect(securityGroupRulePrototypeModel.Remote).To(Equal(securityGroupRuleRemotePrototypeModel)) - - // Construct an instance of the CreateSecurityGroupRuleOptions model - securityGroupID := "testString" - var securityGroupRulePrototype vpcv1.SecurityGroupRulePrototypeIntf = nil - createSecurityGroupRuleOptionsModel := vpcService.NewCreateSecurityGroupRuleOptions(securityGroupID, securityGroupRulePrototype) - createSecurityGroupRuleOptionsModel.SetSecurityGroupID("testString") - createSecurityGroupRuleOptionsModel.SetSecurityGroupRulePrototype(securityGroupRulePrototypeModel) - createSecurityGroupRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createSecurityGroupRuleOptionsModel).ToNot(BeNil()) - Expect(createSecurityGroupRuleOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) - Expect(createSecurityGroupRuleOptionsModel.SecurityGroupRulePrototype).To(Equal(securityGroupRulePrototypeModel)) - Expect(createSecurityGroupRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateSecurityGroupTargetBindingOptions successfully`, func() { - // Construct an instance of the CreateSecurityGroupTargetBindingOptions model - securityGroupID := "testString" - id := "testString" - createSecurityGroupTargetBindingOptionsModel := vpcService.NewCreateSecurityGroupTargetBindingOptions(securityGroupID, id) - createSecurityGroupTargetBindingOptionsModel.SetSecurityGroupID("testString") - createSecurityGroupTargetBindingOptionsModel.SetID("testString") - createSecurityGroupTargetBindingOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createSecurityGroupTargetBindingOptionsModel).ToNot(BeNil()) - Expect(createSecurityGroupTargetBindingOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) - Expect(createSecurityGroupTargetBindingOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(createSecurityGroupTargetBindingOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateSnapshotOptions successfully`, func() { - // 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 VolumeIdentityByID model - volumeIdentityModel := new(vpcv1.VolumeIdentityByID) - Expect(volumeIdentityModel).ToNot(BeNil()) - volumeIdentityModel.ID = core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5") - Expect(volumeIdentityModel.ID).To(Equal(core.StringPtr("1a6b7274-678d-4dfb-8981-c71dd9d4daa5"))) - - // Construct an instance of the SnapshotPrototypeSnapshotBySourceVolume model - snapshotPrototypeModel := new(vpcv1.SnapshotPrototypeSnapshotBySourceVolume) - Expect(snapshotPrototypeModel).ToNot(BeNil()) - snapshotPrototypeModel.Name = core.StringPtr("my-snapshot") - snapshotPrototypeModel.ResourceGroup = resourceGroupIdentityModel - snapshotPrototypeModel.UserTags = []string{"testString"} - snapshotPrototypeModel.SourceVolume = volumeIdentityModel - Expect(snapshotPrototypeModel.Name).To(Equal(core.StringPtr("my-snapshot"))) - Expect(snapshotPrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(snapshotPrototypeModel.UserTags).To(Equal([]string{"testString"})) - Expect(snapshotPrototypeModel.SourceVolume).To(Equal(volumeIdentityModel)) - - // Construct an instance of the CreateSnapshotOptions model - var snapshotPrototype vpcv1.SnapshotPrototypeIntf = nil - createSnapshotOptionsModel := vpcService.NewCreateSnapshotOptions(snapshotPrototype) - createSnapshotOptionsModel.SetSnapshotPrototype(snapshotPrototypeModel) - createSnapshotOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createSnapshotOptionsModel).ToNot(BeNil()) - Expect(createSnapshotOptionsModel.SnapshotPrototype).To(Equal(snapshotPrototypeModel)) - Expect(createSnapshotOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateSubnetOptions successfully`, func() { - // Construct an instance of the NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - Expect(networkACLIdentityModel).ToNot(BeNil()) - networkACLIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - Expect(networkACLIdentityModel.ID).To(Equal(core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf"))) - - // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model - publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) - Expect(publicGatewayIdentityModel).ToNot(BeNil()) - publicGatewayIdentityModel.ID = core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241") - Expect(publicGatewayIdentityModel.ID).To(Equal(core.StringPtr("dc5431ef-1fc6-4861-adc9-a59d077d1241"))) - - // 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 RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - Expect(routingTableIdentityModel).ToNot(BeNil()) - routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") - Expect(routingTableIdentityModel.ID).To(Equal(core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840"))) - - // Construct an instance of the VPCIdentityByID model - vpcIdentityModel := new(vpcv1.VPCIdentityByID) - Expect(vpcIdentityModel).ToNot(BeNil()) - vpcIdentityModel.ID = core.StringPtr("4727d842-f94f-4a2d-824a-9bc9b02c523b") - Expect(vpcIdentityModel.ID).To(Equal(core.StringPtr("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 SubnetPrototypeSubnetByTotalCount model - subnetPrototypeModel := new(vpcv1.SubnetPrototypeSubnetByTotalCount) - Expect(subnetPrototypeModel).ToNot(BeNil()) - subnetPrototypeModel.IPVersion = core.StringPtr("ipv4") - subnetPrototypeModel.Name = core.StringPtr("my-subnet") - subnetPrototypeModel.NetworkACL = networkACLIdentityModel - subnetPrototypeModel.PublicGateway = publicGatewayIdentityModel - subnetPrototypeModel.ResourceGroup = resourceGroupIdentityModel - subnetPrototypeModel.RoutingTable = routingTableIdentityModel - subnetPrototypeModel.VPC = vpcIdentityModel - subnetPrototypeModel.TotalIpv4AddressCount = core.Int64Ptr(int64(256)) - subnetPrototypeModel.Zone = zoneIdentityModel - Expect(subnetPrototypeModel.IPVersion).To(Equal(core.StringPtr("ipv4"))) - Expect(subnetPrototypeModel.Name).To(Equal(core.StringPtr("my-subnet"))) - Expect(subnetPrototypeModel.NetworkACL).To(Equal(networkACLIdentityModel)) - Expect(subnetPrototypeModel.PublicGateway).To(Equal(publicGatewayIdentityModel)) - Expect(subnetPrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(subnetPrototypeModel.RoutingTable).To(Equal(routingTableIdentityModel)) - Expect(subnetPrototypeModel.VPC).To(Equal(vpcIdentityModel)) - Expect(subnetPrototypeModel.TotalIpv4AddressCount).To(Equal(core.Int64Ptr(int64(256)))) - Expect(subnetPrototypeModel.Zone).To(Equal(zoneIdentityModel)) - - // Construct an instance of the CreateSubnetOptions model - var subnetPrototype vpcv1.SubnetPrototypeIntf = nil - createSubnetOptionsModel := vpcService.NewCreateSubnetOptions(subnetPrototype) - createSubnetOptionsModel.SetSubnetPrototype(subnetPrototypeModel) - createSubnetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createSubnetOptionsModel).ToNot(BeNil()) - Expect(createSubnetOptionsModel.SubnetPrototype).To(Equal(subnetPrototypeModel)) - Expect(createSubnetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateSubnetReservedIPOptions successfully`, func() { - // Construct an instance of the ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID model - reservedIPTargetPrototypeModel := new(vpcv1.ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) - Expect(reservedIPTargetPrototypeModel).ToNot(BeNil()) - reservedIPTargetPrototypeModel.ID = core.StringPtr("d7cc5196-9864-48c4-82d8-3f30da41fcc5") - Expect(reservedIPTargetPrototypeModel.ID).To(Equal(core.StringPtr("d7cc5196-9864-48c4-82d8-3f30da41fcc5"))) - - // Construct an instance of the CreateSubnetReservedIPOptions model - subnetID := "testString" - createSubnetReservedIPOptionsModel := vpcService.NewCreateSubnetReservedIPOptions(subnetID) - createSubnetReservedIPOptionsModel.SetSubnetID("testString") - createSubnetReservedIPOptionsModel.SetAddress("192.168.3.4") - createSubnetReservedIPOptionsModel.SetAutoDelete(false) - createSubnetReservedIPOptionsModel.SetName("my-reserved-ip") - createSubnetReservedIPOptionsModel.SetTarget(reservedIPTargetPrototypeModel) - createSubnetReservedIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createSubnetReservedIPOptionsModel).ToNot(BeNil()) - Expect(createSubnetReservedIPOptionsModel.SubnetID).To(Equal(core.StringPtr("testString"))) - Expect(createSubnetReservedIPOptionsModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) - Expect(createSubnetReservedIPOptionsModel.AutoDelete).To(Equal(core.BoolPtr(false))) - Expect(createSubnetReservedIPOptionsModel.Name).To(Equal(core.StringPtr("my-reserved-ip"))) - Expect(createSubnetReservedIPOptionsModel.Target).To(Equal(reservedIPTargetPrototypeModel)) - Expect(createSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateVolumeOptions successfully`, func() { - // Construct an instance of the VolumeProfileIdentityByName model - volumeProfileIdentityModel := new(vpcv1.VolumeProfileIdentityByName) - Expect(volumeProfileIdentityModel).ToNot(BeNil()) - volumeProfileIdentityModel.Name = core.StringPtr("general-purpose") - Expect(volumeProfileIdentityModel.Name).To(Equal(core.StringPtr("general-purpose"))) - - // 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 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 EncryptionKeyIdentityByCRN model - encryptionKeyIdentityModel := new(vpcv1.EncryptionKeyIdentityByCRN) - Expect(encryptionKeyIdentityModel).ToNot(BeNil()) - encryptionKeyIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179") - Expect(encryptionKeyIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179"))) - - // Construct an instance of the VolumePrototypeVolumeByCapacity model - volumePrototypeModel := new(vpcv1.VolumePrototypeVolumeByCapacity) - Expect(volumePrototypeModel).ToNot(BeNil()) - volumePrototypeModel.Iops = core.Int64Ptr(int64(10000)) - volumePrototypeModel.Name = core.StringPtr("my-volume") - volumePrototypeModel.Profile = volumeProfileIdentityModel - volumePrototypeModel.ResourceGroup = resourceGroupIdentityModel - volumePrototypeModel.UserTags = []string{"testString"} - volumePrototypeModel.Zone = zoneIdentityModel - volumePrototypeModel.Capacity = core.Int64Ptr(int64(100)) - volumePrototypeModel.EncryptionKey = encryptionKeyIdentityModel - Expect(volumePrototypeModel.Iops).To(Equal(core.Int64Ptr(int64(10000)))) - Expect(volumePrototypeModel.Name).To(Equal(core.StringPtr("my-volume"))) - Expect(volumePrototypeModel.Profile).To(Equal(volumeProfileIdentityModel)) - Expect(volumePrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(volumePrototypeModel.UserTags).To(Equal([]string{"testString"})) - Expect(volumePrototypeModel.Zone).To(Equal(zoneIdentityModel)) - Expect(volumePrototypeModel.Capacity).To(Equal(core.Int64Ptr(int64(100)))) - Expect(volumePrototypeModel.EncryptionKey).To(Equal(encryptionKeyIdentityModel)) - - // Construct an instance of the CreateVolumeOptions model - var volumePrototype vpcv1.VolumePrototypeIntf = nil - createVolumeOptionsModel := vpcService.NewCreateVolumeOptions(volumePrototype) - createVolumeOptionsModel.SetVolumePrototype(volumePrototypeModel) - createVolumeOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createVolumeOptionsModel).ToNot(BeNil()) - Expect(createVolumeOptionsModel.VolumePrototype).To(Equal(volumePrototypeModel)) - Expect(createVolumeOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateVPCAddressPrefixOptions successfully`, func() { - // 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 CreateVPCAddressPrefixOptions model - vpcID := "testString" - createVPCAddressPrefixOptionsCIDR := "10.0.0.0/24" - var createVPCAddressPrefixOptionsZone vpcv1.ZoneIdentityIntf = nil - createVPCAddressPrefixOptionsModel := vpcService.NewCreateVPCAddressPrefixOptions(vpcID, createVPCAddressPrefixOptionsCIDR, createVPCAddressPrefixOptionsZone) - createVPCAddressPrefixOptionsModel.SetVPCID("testString") - createVPCAddressPrefixOptionsModel.SetCIDR("10.0.0.0/24") - createVPCAddressPrefixOptionsModel.SetZone(zoneIdentityModel) - createVPCAddressPrefixOptionsModel.SetIsDefault(true) - createVPCAddressPrefixOptionsModel.SetName("my-address-prefix-1") - createVPCAddressPrefixOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createVPCAddressPrefixOptionsModel).ToNot(BeNil()) - Expect(createVPCAddressPrefixOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(createVPCAddressPrefixOptionsModel.CIDR).To(Equal(core.StringPtr("10.0.0.0/24"))) - Expect(createVPCAddressPrefixOptionsModel.Zone).To(Equal(zoneIdentityModel)) - Expect(createVPCAddressPrefixOptionsModel.IsDefault).To(Equal(core.BoolPtr(true))) - Expect(createVPCAddressPrefixOptionsModel.Name).To(Equal(core.StringPtr("my-address-prefix-1"))) - Expect(createVPCAddressPrefixOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateVPCOptions successfully`, func() { - // 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 CreateVPCOptions model - createVPCOptionsModel := vpcService.NewCreateVPCOptions() - createVPCOptionsModel.SetAddressPrefixManagement("manual") - createVPCOptionsModel.SetClassicAccess(false) - createVPCOptionsModel.SetName("my-vpc") - createVPCOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createVPCOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createVPCOptionsModel).ToNot(BeNil()) - Expect(createVPCOptionsModel.AddressPrefixManagement).To(Equal(core.StringPtr("manual"))) - Expect(createVPCOptionsModel.ClassicAccess).To(Equal(core.BoolPtr(false))) - Expect(createVPCOptionsModel.Name).To(Equal(core.StringPtr("my-vpc"))) - Expect(createVPCOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createVPCOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateVPCRouteOptions successfully`, func() { - // 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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - Expect(routePrototypeNextHopModel).ToNot(BeNil()) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - Expect(routePrototypeNextHopModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) - - // Construct an instance of the CreateVPCRouteOptions model - vpcID := "testString" - createVPCRouteOptionsDestination := "192.168.3.0/24" - var createVPCRouteOptionsZone vpcv1.ZoneIdentityIntf = nil - createVPCRouteOptionsModel := vpcService.NewCreateVPCRouteOptions(vpcID, createVPCRouteOptionsDestination, createVPCRouteOptionsZone) - createVPCRouteOptionsModel.SetVPCID("testString") - createVPCRouteOptionsModel.SetDestination("192.168.3.0/24") - createVPCRouteOptionsModel.SetZone(zoneIdentityModel) - createVPCRouteOptionsModel.SetAction("deliver") - createVPCRouteOptionsModel.SetName("my-route-1") - createVPCRouteOptionsModel.SetNextHop(routePrototypeNextHopModel) - createVPCRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createVPCRouteOptionsModel).ToNot(BeNil()) - Expect(createVPCRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(createVPCRouteOptionsModel.Destination).To(Equal(core.StringPtr("192.168.3.0/24"))) - Expect(createVPCRouteOptionsModel.Zone).To(Equal(zoneIdentityModel)) - Expect(createVPCRouteOptionsModel.Action).To(Equal(core.StringPtr("deliver"))) - Expect(createVPCRouteOptionsModel.Name).To(Equal(core.StringPtr("my-route-1"))) - Expect(createVPCRouteOptionsModel.NextHop).To(Equal(routePrototypeNextHopModel)) - Expect(createVPCRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateVPCRoutingTableOptions successfully`, func() { - // Construct an instance of the ResourceFilter model - resourceFilterModel := new(vpcv1.ResourceFilter) - Expect(resourceFilterModel).ToNot(BeNil()) - resourceFilterModel.ResourceType = core.StringPtr("vpn_server") - Expect(resourceFilterModel.ResourceType).To(Equal(core.StringPtr("vpn_server"))) - - // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - Expect(routePrototypeNextHopModel).ToNot(BeNil()) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - Expect(routePrototypeNextHopModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) - - // 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 RoutePrototype model - routePrototypeModel := new(vpcv1.RoutePrototype) - Expect(routePrototypeModel).ToNot(BeNil()) - routePrototypeModel.Action = core.StringPtr("deliver") - routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") - routePrototypeModel.Name = core.StringPtr("my-route-1") - routePrototypeModel.NextHop = routePrototypeNextHopModel - routePrototypeModel.Zone = zoneIdentityModel - Expect(routePrototypeModel.Action).To(Equal(core.StringPtr("deliver"))) - Expect(routePrototypeModel.Destination).To(Equal(core.StringPtr("192.168.3.0/24"))) - Expect(routePrototypeModel.Name).To(Equal(core.StringPtr("my-route-1"))) - Expect(routePrototypeModel.NextHop).To(Equal(routePrototypeNextHopModel)) - Expect(routePrototypeModel.Zone).To(Equal(zoneIdentityModel)) - - // Construct an instance of the CreateVPCRoutingTableOptions model - vpcID := "testString" - createVPCRoutingTableOptionsModel := vpcService.NewCreateVPCRoutingTableOptions(vpcID) - createVPCRoutingTableOptionsModel.SetVPCID("testString") - createVPCRoutingTableOptionsModel.SetAcceptRoutesFrom([]vpcv1.ResourceFilter{*resourceFilterModel}) - createVPCRoutingTableOptionsModel.SetName("my-routing-table-1") - createVPCRoutingTableOptionsModel.SetRouteDirectLinkIngress(false) - createVPCRoutingTableOptionsModel.SetRouteInternetIngress(false) - createVPCRoutingTableOptionsModel.SetRouteTransitGatewayIngress(false) - createVPCRoutingTableOptionsModel.SetRouteVPCZoneIngress(false) - createVPCRoutingTableOptionsModel.SetRoutes([]vpcv1.RoutePrototype{*routePrototypeModel}) - createVPCRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createVPCRoutingTableOptionsModel).ToNot(BeNil()) - Expect(createVPCRoutingTableOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(createVPCRoutingTableOptionsModel.AcceptRoutesFrom).To(Equal([]vpcv1.ResourceFilter{*resourceFilterModel})) - Expect(createVPCRoutingTableOptionsModel.Name).To(Equal(core.StringPtr("my-routing-table-1"))) - Expect(createVPCRoutingTableOptionsModel.RouteDirectLinkIngress).To(Equal(core.BoolPtr(false))) - Expect(createVPCRoutingTableOptionsModel.RouteInternetIngress).To(Equal(core.BoolPtr(false))) - Expect(createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress).To(Equal(core.BoolPtr(false))) - Expect(createVPCRoutingTableOptionsModel.RouteVPCZoneIngress).To(Equal(core.BoolPtr(false))) - Expect(createVPCRoutingTableOptionsModel.Routes).To(Equal([]vpcv1.RoutePrototype{*routePrototypeModel})) - Expect(createVPCRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateVPCRoutingTableRouteOptions successfully`, func() { - // 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 RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model - routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - Expect(routePrototypeNextHopModel).ToNot(BeNil()) - routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") - Expect(routePrototypeNextHopModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) - - // Construct an instance of the CreateVPCRoutingTableRouteOptions model - vpcID := "testString" - routingTableID := "testString" - createVPCRoutingTableRouteOptionsDestination := "192.168.3.0/24" - var createVPCRoutingTableRouteOptionsZone vpcv1.ZoneIdentityIntf = nil - createVPCRoutingTableRouteOptionsModel := vpcService.NewCreateVPCRoutingTableRouteOptions(vpcID, routingTableID, createVPCRoutingTableRouteOptionsDestination, createVPCRoutingTableRouteOptionsZone) - createVPCRoutingTableRouteOptionsModel.SetVPCID("testString") - createVPCRoutingTableRouteOptionsModel.SetRoutingTableID("testString") - createVPCRoutingTableRouteOptionsModel.SetDestination("192.168.3.0/24") - createVPCRoutingTableRouteOptionsModel.SetZone(zoneIdentityModel) - createVPCRoutingTableRouteOptionsModel.SetAction("deliver") - createVPCRoutingTableRouteOptionsModel.SetName("my-route-1") - createVPCRoutingTableRouteOptionsModel.SetNextHop(routePrototypeNextHopModel) - createVPCRoutingTableRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createVPCRoutingTableRouteOptionsModel).ToNot(BeNil()) - Expect(createVPCRoutingTableRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(createVPCRoutingTableRouteOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) - Expect(createVPCRoutingTableRouteOptionsModel.Destination).To(Equal(core.StringPtr("192.168.3.0/24"))) - Expect(createVPCRoutingTableRouteOptionsModel.Zone).To(Equal(zoneIdentityModel)) - Expect(createVPCRoutingTableRouteOptionsModel.Action).To(Equal(core.StringPtr("deliver"))) - Expect(createVPCRoutingTableRouteOptionsModel.Name).To(Equal(core.StringPtr("my-route-1"))) - Expect(createVPCRoutingTableRouteOptionsModel.NextHop).To(Equal(routePrototypeNextHopModel)) - Expect(createVPCRoutingTableRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateVPNGatewayConnectionOptions successfully`, func() { - // Construct an instance of the VPNGatewayConnectionDpdPrototype model - vpnGatewayConnectionDpdPrototypeModel := new(vpcv1.VPNGatewayConnectionDpdPrototype) - Expect(vpnGatewayConnectionDpdPrototypeModel).ToNot(BeNil()) - vpnGatewayConnectionDpdPrototypeModel.Action = core.StringPtr("restart") - vpnGatewayConnectionDpdPrototypeModel.Interval = core.Int64Ptr(int64(30)) - vpnGatewayConnectionDpdPrototypeModel.Timeout = core.Int64Ptr(int64(120)) - Expect(vpnGatewayConnectionDpdPrototypeModel.Action).To(Equal(core.StringPtr("restart"))) - Expect(vpnGatewayConnectionDpdPrototypeModel.Interval).To(Equal(core.Int64Ptr(int64(30)))) - Expect(vpnGatewayConnectionDpdPrototypeModel.Timeout).To(Equal(core.Int64Ptr(int64(120)))) - - // Construct an instance of the VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID model - vpnGatewayConnectionIkePolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) - Expect(vpnGatewayConnectionIkePolicyPrototypeModel).ToNot(BeNil()) - vpnGatewayConnectionIkePolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - Expect(vpnGatewayConnectionIkePolicyPrototypeModel.ID).To(Equal(core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b"))) - - // Construct an instance of the VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID model - vpnGatewayConnectionIPsecPolicyPrototypeModel := new(vpcv1.VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) - Expect(vpnGatewayConnectionIPsecPolicyPrototypeModel).ToNot(BeNil()) - vpnGatewayConnectionIPsecPolicyPrototypeModel.ID = core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b") - Expect(vpnGatewayConnectionIPsecPolicyPrototypeModel.ID).To(Equal(core.StringPtr("ddf51bec-3424-11e8-b467-0ed5f89f718b"))) - - // Construct an instance of the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype model - vpnGatewayConnectionPrototypeModel := new(vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) - Expect(vpnGatewayConnectionPrototypeModel).ToNot(BeNil()) - vpnGatewayConnectionPrototypeModel.AdminStateUp = core.BoolPtr(true) - vpnGatewayConnectionPrototypeModel.DeadPeerDetection = vpnGatewayConnectionDpdPrototypeModel - vpnGatewayConnectionPrototypeModel.IkePolicy = vpnGatewayConnectionIkePolicyPrototypeModel - vpnGatewayConnectionPrototypeModel.IpsecPolicy = vpnGatewayConnectionIPsecPolicyPrototypeModel - vpnGatewayConnectionPrototypeModel.Name = core.StringPtr("my-vpn-connection") - vpnGatewayConnectionPrototypeModel.PeerAddress = core.StringPtr("169.21.50.5") - vpnGatewayConnectionPrototypeModel.Psk = core.StringPtr("lkj14b1oi0alcniejkso") - vpnGatewayConnectionPrototypeModel.RoutingProtocol = core.StringPtr("none") - Expect(vpnGatewayConnectionPrototypeModel.AdminStateUp).To(Equal(core.BoolPtr(true))) - Expect(vpnGatewayConnectionPrototypeModel.DeadPeerDetection).To(Equal(vpnGatewayConnectionDpdPrototypeModel)) - Expect(vpnGatewayConnectionPrototypeModel.IkePolicy).To(Equal(vpnGatewayConnectionIkePolicyPrototypeModel)) - Expect(vpnGatewayConnectionPrototypeModel.IpsecPolicy).To(Equal(vpnGatewayConnectionIPsecPolicyPrototypeModel)) - Expect(vpnGatewayConnectionPrototypeModel.Name).To(Equal(core.StringPtr("my-vpn-connection"))) - Expect(vpnGatewayConnectionPrototypeModel.PeerAddress).To(Equal(core.StringPtr("169.21.50.5"))) - Expect(vpnGatewayConnectionPrototypeModel.Psk).To(Equal(core.StringPtr("lkj14b1oi0alcniejkso"))) - Expect(vpnGatewayConnectionPrototypeModel.RoutingProtocol).To(Equal(core.StringPtr("none"))) - - // Construct an instance of the CreateVPNGatewayConnectionOptions model - vpnGatewayID := "testString" - var vpnGatewayConnectionPrototype vpcv1.VPNGatewayConnectionPrototypeIntf = nil - createVPNGatewayConnectionOptionsModel := vpcService.NewCreateVPNGatewayConnectionOptions(vpnGatewayID, vpnGatewayConnectionPrototype) - createVPNGatewayConnectionOptionsModel.SetVPNGatewayID("testString") - createVPNGatewayConnectionOptionsModel.SetVPNGatewayConnectionPrototype(vpnGatewayConnectionPrototypeModel) - createVPNGatewayConnectionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createVPNGatewayConnectionOptionsModel).ToNot(BeNil()) - Expect(createVPNGatewayConnectionOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(createVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPrototype).To(Equal(vpnGatewayConnectionPrototypeModel)) - Expect(createVPNGatewayConnectionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateVPNGatewayOptions successfully`, func() { - // 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 SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - Expect(subnetIdentityModel).ToNot(BeNil()) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) - - // Construct an instance of the VPNGatewayPrototypeVPNGatewayRouteModePrototype model - vpnGatewayPrototypeModel := new(vpcv1.VPNGatewayPrototypeVPNGatewayRouteModePrototype) - Expect(vpnGatewayPrototypeModel).ToNot(BeNil()) - vpnGatewayPrototypeModel.Name = core.StringPtr("my-vpn-gateway") - vpnGatewayPrototypeModel.ResourceGroup = resourceGroupIdentityModel - vpnGatewayPrototypeModel.Subnet = subnetIdentityModel - vpnGatewayPrototypeModel.Mode = core.StringPtr("route") - Expect(vpnGatewayPrototypeModel.Name).To(Equal(core.StringPtr("my-vpn-gateway"))) - Expect(vpnGatewayPrototypeModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(vpnGatewayPrototypeModel.Subnet).To(Equal(subnetIdentityModel)) - Expect(vpnGatewayPrototypeModel.Mode).To(Equal(core.StringPtr("route"))) - - // Construct an instance of the CreateVPNGatewayOptions model - var vpnGatewayPrototype vpcv1.VPNGatewayPrototypeIntf = nil - createVPNGatewayOptionsModel := vpcService.NewCreateVPNGatewayOptions(vpnGatewayPrototype) - createVPNGatewayOptionsModel.SetVPNGatewayPrototype(vpnGatewayPrototypeModel) - createVPNGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createVPNGatewayOptionsModel).ToNot(BeNil()) - Expect(createVPNGatewayOptionsModel.VPNGatewayPrototype).To(Equal(vpnGatewayPrototypeModel)) - Expect(createVPNGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateVPNServerOptions successfully`, func() { - // Construct an instance of the CertificateInstanceIdentityByCRN model - certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) - Expect(certificateInstanceIdentityModel).ToNot(BeNil()) - certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") - Expect(certificateInstanceIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"))) - - // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model - vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) - Expect(vpnServerAuthenticationByUsernameIDProviderModel).ToNot(BeNil()) - vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") - Expect(vpnServerAuthenticationByUsernameIDProviderModel.ProviderType).To(Equal(core.StringPtr("iam"))) - - // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model - vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - Expect(vpnServerAuthenticationPrototypeModel).ToNot(BeNil()) - vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") - vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel - Expect(vpnServerAuthenticationPrototypeModel.Method).To(Equal(core.StringPtr("username"))) - Expect(vpnServerAuthenticationPrototypeModel.IdentityProvider).To(Equal(vpnServerAuthenticationByUsernameIDProviderModel)) - - // Construct an instance of the SubnetIdentityByID model - subnetIdentityModel := new(vpcv1.SubnetIdentityByID) - Expect(subnetIdentityModel).ToNot(BeNil()) - subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") - Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) - - // Construct an instance of the IP model - ipModel := new(vpcv1.IP) - Expect(ipModel).ToNot(BeNil()) - ipModel.Address = core.StringPtr("192.168.3.4") - Expect(ipModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) - - // 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 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"))) - - // Construct an instance of the CreateVPNServerOptions model - var createVPNServerOptionsCertificate vpcv1.CertificateInstanceIdentityIntf = nil - createVPNServerOptionsClientAuthentication := []vpcv1.VPNServerAuthenticationPrototypeIntf{} - createVPNServerOptionsClientIPPool := "172.16.0.0/16" - createVPNServerOptionsSubnets := []vpcv1.SubnetIdentityIntf{} - createVPNServerOptionsModel := vpcService.NewCreateVPNServerOptions(createVPNServerOptionsCertificate, createVPNServerOptionsClientAuthentication, createVPNServerOptionsClientIPPool, createVPNServerOptionsSubnets) - createVPNServerOptionsModel.SetCertificate(certificateInstanceIdentityModel) - createVPNServerOptionsModel.SetClientAuthentication([]vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel}) - createVPNServerOptionsModel.SetClientIPPool("172.16.0.0/16") - createVPNServerOptionsModel.SetSubnets([]vpcv1.SubnetIdentityIntf{subnetIdentityModel}) - createVPNServerOptionsModel.SetClientDnsServerIps([]vpcv1.IP{*ipModel}) - createVPNServerOptionsModel.SetClientIdleTimeout(int64(600)) - createVPNServerOptionsModel.SetEnableSplitTunneling(false) - createVPNServerOptionsModel.SetName("my-vpn-server") - createVPNServerOptionsModel.SetPort(int64(443)) - createVPNServerOptionsModel.SetProtocol("udp") - createVPNServerOptionsModel.SetResourceGroup(resourceGroupIdentityModel) - createVPNServerOptionsModel.SetSecurityGroups([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel}) - createVPNServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createVPNServerOptionsModel).ToNot(BeNil()) - Expect(createVPNServerOptionsModel.Certificate).To(Equal(certificateInstanceIdentityModel)) - Expect(createVPNServerOptionsModel.ClientAuthentication).To(Equal([]vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel})) - Expect(createVPNServerOptionsModel.ClientIPPool).To(Equal(core.StringPtr("172.16.0.0/16"))) - Expect(createVPNServerOptionsModel.Subnets).To(Equal([]vpcv1.SubnetIdentityIntf{subnetIdentityModel})) - Expect(createVPNServerOptionsModel.ClientDnsServerIps).To(Equal([]vpcv1.IP{*ipModel})) - Expect(createVPNServerOptionsModel.ClientIdleTimeout).To(Equal(core.Int64Ptr(int64(600)))) - Expect(createVPNServerOptionsModel.EnableSplitTunneling).To(Equal(core.BoolPtr(false))) - Expect(createVPNServerOptionsModel.Name).To(Equal(core.StringPtr("my-vpn-server"))) - Expect(createVPNServerOptionsModel.Port).To(Equal(core.Int64Ptr(int64(443)))) - Expect(createVPNServerOptionsModel.Protocol).To(Equal(core.StringPtr("udp"))) - Expect(createVPNServerOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) - Expect(createVPNServerOptionsModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) - Expect(createVPNServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateVPNServerRouteOptions successfully`, func() { - // Construct an instance of the CreateVPNServerRouteOptions model - vpnServerID := "testString" - createVPNServerRouteOptionsDestination := "172.16.0.0/16" - createVPNServerRouteOptionsModel := vpcService.NewCreateVPNServerRouteOptions(vpnServerID, createVPNServerRouteOptionsDestination) - createVPNServerRouteOptionsModel.SetVPNServerID("testString") - createVPNServerRouteOptionsModel.SetDestination("172.16.0.0/16") - createVPNServerRouteOptionsModel.SetAction("deliver") - createVPNServerRouteOptionsModel.SetName("my-vpn-route-2") - createVPNServerRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createVPNServerRouteOptionsModel).ToNot(BeNil()) - Expect(createVPNServerRouteOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) - Expect(createVPNServerRouteOptionsModel.Destination).To(Equal(core.StringPtr("172.16.0.0/16"))) - Expect(createVPNServerRouteOptionsModel.Action).To(Equal(core.StringPtr("deliver"))) - Expect(createVPNServerRouteOptionsModel.Name).To(Equal(core.StringPtr("my-vpn-route-2"))) - Expect(createVPNServerRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteBackupPolicyOptions successfully`, func() { - // Construct an instance of the DeleteBackupPolicyOptions model - id := "testString" - deleteBackupPolicyOptionsModel := vpcService.NewDeleteBackupPolicyOptions(id) - deleteBackupPolicyOptionsModel.SetID("testString") - deleteBackupPolicyOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteBackupPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteBackupPolicyOptionsModel).ToNot(BeNil()) - Expect(deleteBackupPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteBackupPolicyOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) - Expect(deleteBackupPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteBackupPolicyPlanOptions successfully`, func() { - // Construct an instance of the DeleteBackupPolicyPlanOptions model - backupPolicyID := "testString" - id := "testString" - deleteBackupPolicyPlanOptionsModel := vpcService.NewDeleteBackupPolicyPlanOptions(backupPolicyID, id) - deleteBackupPolicyPlanOptionsModel.SetBackupPolicyID("testString") - deleteBackupPolicyPlanOptionsModel.SetID("testString") - deleteBackupPolicyPlanOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteBackupPolicyPlanOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteBackupPolicyPlanOptionsModel).ToNot(BeNil()) - Expect(deleteBackupPolicyPlanOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) - Expect(deleteBackupPolicyPlanOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteBackupPolicyPlanOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) - Expect(deleteBackupPolicyPlanOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteBareMetalServerNetworkInterfaceOptions successfully`, func() { - // Construct an instance of the DeleteBareMetalServerNetworkInterfaceOptions model - bareMetalServerID := "testString" - id := "testString" - deleteBareMetalServerNetworkInterfaceOptionsModel := vpcService.NewDeleteBareMetalServerNetworkInterfaceOptions(bareMetalServerID, id) - deleteBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerID("testString") - deleteBareMetalServerNetworkInterfaceOptionsModel.SetID("testString") - deleteBareMetalServerNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteBareMetalServerNetworkInterfaceOptionsModel).ToNot(BeNil()) - Expect(deleteBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(deleteBareMetalServerNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteBareMetalServerNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteBareMetalServerOptions successfully`, func() { - // Construct an instance of the DeleteBareMetalServerOptions model - id := "testString" - deleteBareMetalServerOptionsModel := vpcService.NewDeleteBareMetalServerOptions(id) - deleteBareMetalServerOptionsModel.SetID("testString") - deleteBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteBareMetalServerOptionsModel).ToNot(BeNil()) - Expect(deleteBareMetalServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteDedicatedHostGroupOptions successfully`, func() { - // Construct an instance of the DeleteDedicatedHostGroupOptions model - id := "testString" - deleteDedicatedHostGroupOptionsModel := vpcService.NewDeleteDedicatedHostGroupOptions(id) - deleteDedicatedHostGroupOptionsModel.SetID("testString") - deleteDedicatedHostGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteDedicatedHostGroupOptionsModel).ToNot(BeNil()) - Expect(deleteDedicatedHostGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteDedicatedHostGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteDedicatedHostOptions successfully`, func() { - // Construct an instance of the DeleteDedicatedHostOptions model - id := "testString" - deleteDedicatedHostOptionsModel := vpcService.NewDeleteDedicatedHostOptions(id) - deleteDedicatedHostOptionsModel.SetID("testString") - deleteDedicatedHostOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteDedicatedHostOptionsModel).ToNot(BeNil()) - Expect(deleteDedicatedHostOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteDedicatedHostOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteEndpointGatewayOptions successfully`, func() { - // Construct an instance of the DeleteEndpointGatewayOptions model - id := "testString" - deleteEndpointGatewayOptionsModel := vpcService.NewDeleteEndpointGatewayOptions(id) - deleteEndpointGatewayOptionsModel.SetID("testString") - deleteEndpointGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteEndpointGatewayOptionsModel).ToNot(BeNil()) - Expect(deleteEndpointGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteEndpointGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteFloatingIPOptions successfully`, func() { - // Construct an instance of the DeleteFloatingIPOptions model - id := "testString" - deleteFloatingIPOptionsModel := vpcService.NewDeleteFloatingIPOptions(id) - deleteFloatingIPOptionsModel.SetID("testString") - deleteFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteFloatingIPOptionsModel).ToNot(BeNil()) - Expect(deleteFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteFlowLogCollectorOptions successfully`, func() { - // Construct an instance of the DeleteFlowLogCollectorOptions model - id := "testString" - deleteFlowLogCollectorOptionsModel := vpcService.NewDeleteFlowLogCollectorOptions(id) - deleteFlowLogCollectorOptionsModel.SetID("testString") - deleteFlowLogCollectorOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteFlowLogCollectorOptionsModel).ToNot(BeNil()) - Expect(deleteFlowLogCollectorOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteFlowLogCollectorOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteIkePolicyOptions successfully`, func() { - // Construct an instance of the DeleteIkePolicyOptions model - id := "testString" - deleteIkePolicyOptionsModel := vpcService.NewDeleteIkePolicyOptions(id) - deleteIkePolicyOptionsModel.SetID("testString") - deleteIkePolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteIkePolicyOptionsModel).ToNot(BeNil()) - Expect(deleteIkePolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteIkePolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteImageOptions successfully`, func() { - // Construct an instance of the DeleteImageOptions model - id := "testString" - deleteImageOptionsModel := vpcService.NewDeleteImageOptions(id) - deleteImageOptionsModel.SetID("testString") - deleteImageOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteImageOptionsModel).ToNot(BeNil()) - Expect(deleteImageOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteImageOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteInstanceGroupLoadBalancerOptions successfully`, func() { - // Construct an instance of the DeleteInstanceGroupLoadBalancerOptions model - instanceGroupID := "testString" - deleteInstanceGroupLoadBalancerOptionsModel := vpcService.NewDeleteInstanceGroupLoadBalancerOptions(instanceGroupID) - deleteInstanceGroupLoadBalancerOptionsModel.SetInstanceGroupID("testString") - deleteInstanceGroupLoadBalancerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteInstanceGroupLoadBalancerOptionsModel).ToNot(BeNil()) - Expect(deleteInstanceGroupLoadBalancerOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceGroupLoadBalancerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteInstanceGroupManagerActionOptions successfully`, func() { - // Construct an instance of the DeleteInstanceGroupManagerActionOptions model - instanceGroupID := "testString" - instanceGroupManagerID := "testString" - id := "testString" - deleteInstanceGroupManagerActionOptionsModel := vpcService.NewDeleteInstanceGroupManagerActionOptions(instanceGroupID, instanceGroupManagerID, id) - deleteInstanceGroupManagerActionOptionsModel.SetInstanceGroupID("testString") - deleteInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerID("testString") - deleteInstanceGroupManagerActionOptionsModel.SetID("testString") - deleteInstanceGroupManagerActionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteInstanceGroupManagerActionOptionsModel).ToNot(BeNil()) - Expect(deleteInstanceGroupManagerActionOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceGroupManagerActionOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceGroupManagerActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteInstanceGroupManagerOptions successfully`, func() { - // Construct an instance of the DeleteInstanceGroupManagerOptions model - instanceGroupID := "testString" - id := "testString" - deleteInstanceGroupManagerOptionsModel := vpcService.NewDeleteInstanceGroupManagerOptions(instanceGroupID, id) - deleteInstanceGroupManagerOptionsModel.SetInstanceGroupID("testString") - deleteInstanceGroupManagerOptionsModel.SetID("testString") - deleteInstanceGroupManagerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteInstanceGroupManagerOptionsModel).ToNot(BeNil()) - Expect(deleteInstanceGroupManagerOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceGroupManagerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceGroupManagerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteInstanceGroupManagerPolicyOptions successfully`, func() { - // Construct an instance of the DeleteInstanceGroupManagerPolicyOptions model - instanceGroupID := "testString" - instanceGroupManagerID := "testString" - id := "testString" - deleteInstanceGroupManagerPolicyOptionsModel := vpcService.NewDeleteInstanceGroupManagerPolicyOptions(instanceGroupID, instanceGroupManagerID, id) - deleteInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupID("testString") - deleteInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerID("testString") - deleteInstanceGroupManagerPolicyOptionsModel.SetID("testString") - deleteInstanceGroupManagerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteInstanceGroupManagerPolicyOptionsModel).ToNot(BeNil()) - Expect(deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceGroupManagerPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceGroupManagerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteInstanceGroupMembershipOptions successfully`, func() { - // Construct an instance of the DeleteInstanceGroupMembershipOptions model - instanceGroupID := "testString" - id := "testString" - deleteInstanceGroupMembershipOptionsModel := vpcService.NewDeleteInstanceGroupMembershipOptions(instanceGroupID, id) - deleteInstanceGroupMembershipOptionsModel.SetInstanceGroupID("testString") - deleteInstanceGroupMembershipOptionsModel.SetID("testString") - deleteInstanceGroupMembershipOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteInstanceGroupMembershipOptionsModel).ToNot(BeNil()) - Expect(deleteInstanceGroupMembershipOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceGroupMembershipOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceGroupMembershipOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteInstanceGroupMembershipsOptions successfully`, func() { - // Construct an instance of the DeleteInstanceGroupMembershipsOptions model - instanceGroupID := "testString" - deleteInstanceGroupMembershipsOptionsModel := vpcService.NewDeleteInstanceGroupMembershipsOptions(instanceGroupID) - deleteInstanceGroupMembershipsOptionsModel.SetInstanceGroupID("testString") - deleteInstanceGroupMembershipsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteInstanceGroupMembershipsOptionsModel).ToNot(BeNil()) - Expect(deleteInstanceGroupMembershipsOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceGroupMembershipsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteInstanceGroupOptions successfully`, func() { - // Construct an instance of the DeleteInstanceGroupOptions model - id := "testString" - deleteInstanceGroupOptionsModel := vpcService.NewDeleteInstanceGroupOptions(id) - deleteInstanceGroupOptionsModel.SetID("testString") - deleteInstanceGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteInstanceGroupOptionsModel).ToNot(BeNil()) - Expect(deleteInstanceGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteInstanceNetworkInterfaceOptions successfully`, func() { - // Construct an instance of the DeleteInstanceNetworkInterfaceOptions model - instanceID := "testString" - id := "testString" - deleteInstanceNetworkInterfaceOptionsModel := vpcService.NewDeleteInstanceNetworkInterfaceOptions(instanceID, id) - deleteInstanceNetworkInterfaceOptionsModel.SetInstanceID("testString") - deleteInstanceNetworkInterfaceOptionsModel.SetID("testString") - deleteInstanceNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteInstanceNetworkInterfaceOptionsModel).ToNot(BeNil()) - Expect(deleteInstanceNetworkInterfaceOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteInstanceOptions successfully`, func() { - // Construct an instance of the DeleteInstanceOptions model - id := "testString" - deleteInstanceOptionsModel := vpcService.NewDeleteInstanceOptions(id) - deleteInstanceOptionsModel.SetID("testString") - deleteInstanceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteInstanceOptionsModel).ToNot(BeNil()) - Expect(deleteInstanceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteInstanceTemplateOptions successfully`, func() { - // Construct an instance of the DeleteInstanceTemplateOptions model - id := "testString" - deleteInstanceTemplateOptionsModel := vpcService.NewDeleteInstanceTemplateOptions(id) - deleteInstanceTemplateOptionsModel.SetID("testString") - deleteInstanceTemplateOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteInstanceTemplateOptionsModel).ToNot(BeNil()) - Expect(deleteInstanceTemplateOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceTemplateOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteInstanceVolumeAttachmentOptions successfully`, func() { - // Construct an instance of the DeleteInstanceVolumeAttachmentOptions model - instanceID := "testString" - id := "testString" - deleteInstanceVolumeAttachmentOptionsModel := vpcService.NewDeleteInstanceVolumeAttachmentOptions(instanceID, id) - deleteInstanceVolumeAttachmentOptionsModel.SetInstanceID("testString") - deleteInstanceVolumeAttachmentOptionsModel.SetID("testString") - deleteInstanceVolumeAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteInstanceVolumeAttachmentOptionsModel).ToNot(BeNil()) - Expect(deleteInstanceVolumeAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceVolumeAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteInstanceVolumeAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteIpsecPolicyOptions successfully`, func() { - // Construct an instance of the DeleteIpsecPolicyOptions model - id := "testString" - deleteIpsecPolicyOptionsModel := vpcService.NewDeleteIpsecPolicyOptions(id) - deleteIpsecPolicyOptionsModel.SetID("testString") - deleteIpsecPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteIpsecPolicyOptionsModel).ToNot(BeNil()) - Expect(deleteIpsecPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteIpsecPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteKeyOptions successfully`, func() { - // Construct an instance of the DeleteKeyOptions model - id := "testString" - deleteKeyOptionsModel := vpcService.NewDeleteKeyOptions(id) - deleteKeyOptionsModel.SetID("testString") - deleteKeyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteKeyOptionsModel).ToNot(BeNil()) - Expect(deleteKeyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteKeyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteLoadBalancerListenerOptions successfully`, func() { - // Construct an instance of the DeleteLoadBalancerListenerOptions model - loadBalancerID := "testString" - id := "testString" - deleteLoadBalancerListenerOptionsModel := vpcService.NewDeleteLoadBalancerListenerOptions(loadBalancerID, id) - deleteLoadBalancerListenerOptionsModel.SetLoadBalancerID("testString") - deleteLoadBalancerListenerOptionsModel.SetID("testString") - deleteLoadBalancerListenerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteLoadBalancerListenerOptionsModel).ToNot(BeNil()) - Expect(deleteLoadBalancerListenerOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerListenerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerListenerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteLoadBalancerListenerPolicyOptions successfully`, func() { - // Construct an instance of the DeleteLoadBalancerListenerPolicyOptions model - loadBalancerID := "testString" - listenerID := "testString" - id := "testString" - deleteLoadBalancerListenerPolicyOptionsModel := vpcService.NewDeleteLoadBalancerListenerPolicyOptions(loadBalancerID, listenerID, id) - deleteLoadBalancerListenerPolicyOptionsModel.SetLoadBalancerID("testString") - deleteLoadBalancerListenerPolicyOptionsModel.SetListenerID("testString") - deleteLoadBalancerListenerPolicyOptionsModel.SetID("testString") - deleteLoadBalancerListenerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteLoadBalancerListenerPolicyOptionsModel).ToNot(BeNil()) - Expect(deleteLoadBalancerListenerPolicyOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerListenerPolicyOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerListenerPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerListenerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteLoadBalancerListenerPolicyRuleOptions successfully`, func() { - // Construct an instance of the DeleteLoadBalancerListenerPolicyRuleOptions model - loadBalancerID := "testString" - listenerID := "testString" - policyID := "testString" - id := "testString" - deleteLoadBalancerListenerPolicyRuleOptionsModel := vpcService.NewDeleteLoadBalancerListenerPolicyRuleOptions(loadBalancerID, listenerID, policyID, id) - deleteLoadBalancerListenerPolicyRuleOptionsModel.SetLoadBalancerID("testString") - deleteLoadBalancerListenerPolicyRuleOptionsModel.SetListenerID("testString") - deleteLoadBalancerListenerPolicyRuleOptionsModel.SetPolicyID("testString") - deleteLoadBalancerListenerPolicyRuleOptionsModel.SetID("testString") - deleteLoadBalancerListenerPolicyRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteLoadBalancerListenerPolicyRuleOptionsModel).ToNot(BeNil()) - Expect(deleteLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerListenerPolicyRuleOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerListenerPolicyRuleOptionsModel.PolicyID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerListenerPolicyRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerListenerPolicyRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteLoadBalancerOptions successfully`, func() { - // Construct an instance of the DeleteLoadBalancerOptions model - id := "testString" - deleteLoadBalancerOptionsModel := vpcService.NewDeleteLoadBalancerOptions(id) - deleteLoadBalancerOptionsModel.SetID("testString") - deleteLoadBalancerOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteLoadBalancerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteLoadBalancerOptionsModel).ToNot(BeNil()) - Expect(deleteLoadBalancerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) - Expect(deleteLoadBalancerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteLoadBalancerPoolMemberOptions successfully`, func() { - // Construct an instance of the DeleteLoadBalancerPoolMemberOptions model - loadBalancerID := "testString" - poolID := "testString" - id := "testString" - deleteLoadBalancerPoolMemberOptionsModel := vpcService.NewDeleteLoadBalancerPoolMemberOptions(loadBalancerID, poolID, id) - deleteLoadBalancerPoolMemberOptionsModel.SetLoadBalancerID("testString") - deleteLoadBalancerPoolMemberOptionsModel.SetPoolID("testString") - deleteLoadBalancerPoolMemberOptionsModel.SetID("testString") - deleteLoadBalancerPoolMemberOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteLoadBalancerPoolMemberOptionsModel).ToNot(BeNil()) - Expect(deleteLoadBalancerPoolMemberOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerPoolMemberOptionsModel.PoolID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerPoolMemberOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerPoolMemberOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteLoadBalancerPoolOptions successfully`, func() { - // Construct an instance of the DeleteLoadBalancerPoolOptions model - loadBalancerID := "testString" - id := "testString" - deleteLoadBalancerPoolOptionsModel := vpcService.NewDeleteLoadBalancerPoolOptions(loadBalancerID, id) - deleteLoadBalancerPoolOptionsModel.SetLoadBalancerID("testString") - deleteLoadBalancerPoolOptionsModel.SetID("testString") - deleteLoadBalancerPoolOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteLoadBalancerPoolOptionsModel).ToNot(BeNil()) - Expect(deleteLoadBalancerPoolOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerPoolOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteLoadBalancerPoolOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteNetworkACLOptions successfully`, func() { - // Construct an instance of the DeleteNetworkACLOptions model - id := "testString" - deleteNetworkACLOptionsModel := vpcService.NewDeleteNetworkACLOptions(id) - deleteNetworkACLOptionsModel.SetID("testString") - deleteNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteNetworkACLOptionsModel).ToNot(BeNil()) - Expect(deleteNetworkACLOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteNetworkACLRuleOptions successfully`, func() { - // Construct an instance of the DeleteNetworkACLRuleOptions model - networkACLID := "testString" - id := "testString" - deleteNetworkACLRuleOptionsModel := vpcService.NewDeleteNetworkACLRuleOptions(networkACLID, id) - deleteNetworkACLRuleOptionsModel.SetNetworkACLID("testString") - deleteNetworkACLRuleOptionsModel.SetID("testString") - deleteNetworkACLRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteNetworkACLRuleOptionsModel).ToNot(BeNil()) - Expect(deleteNetworkACLRuleOptionsModel.NetworkACLID).To(Equal(core.StringPtr("testString"))) - Expect(deleteNetworkACLRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteNetworkACLRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeletePlacementGroupOptions successfully`, func() { - // Construct an instance of the DeletePlacementGroupOptions model - id := "testString" - deletePlacementGroupOptionsModel := vpcService.NewDeletePlacementGroupOptions(id) - deletePlacementGroupOptionsModel.SetID("testString") - deletePlacementGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deletePlacementGroupOptionsModel).ToNot(BeNil()) - Expect(deletePlacementGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deletePlacementGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeletePublicGatewayOptions successfully`, func() { - // Construct an instance of the DeletePublicGatewayOptions model - id := "testString" - deletePublicGatewayOptionsModel := vpcService.NewDeletePublicGatewayOptions(id) - deletePublicGatewayOptionsModel.SetID("testString") - deletePublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deletePublicGatewayOptionsModel).ToNot(BeNil()) - Expect(deletePublicGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deletePublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteSecurityGroupOptions successfully`, func() { - // Construct an instance of the DeleteSecurityGroupOptions model - id := "testString" - deleteSecurityGroupOptionsModel := vpcService.NewDeleteSecurityGroupOptions(id) - deleteSecurityGroupOptionsModel.SetID("testString") - deleteSecurityGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteSecurityGroupOptionsModel).ToNot(BeNil()) - Expect(deleteSecurityGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSecurityGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteSecurityGroupRuleOptions successfully`, func() { - // Construct an instance of the DeleteSecurityGroupRuleOptions model - securityGroupID := "testString" - id := "testString" - deleteSecurityGroupRuleOptionsModel := vpcService.NewDeleteSecurityGroupRuleOptions(securityGroupID, id) - deleteSecurityGroupRuleOptionsModel.SetSecurityGroupID("testString") - deleteSecurityGroupRuleOptionsModel.SetID("testString") - deleteSecurityGroupRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteSecurityGroupRuleOptionsModel).ToNot(BeNil()) - Expect(deleteSecurityGroupRuleOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSecurityGroupRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSecurityGroupRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteSecurityGroupTargetBindingOptions successfully`, func() { - // Construct an instance of the DeleteSecurityGroupTargetBindingOptions model - securityGroupID := "testString" - id := "testString" - deleteSecurityGroupTargetBindingOptionsModel := vpcService.NewDeleteSecurityGroupTargetBindingOptions(securityGroupID, id) - deleteSecurityGroupTargetBindingOptionsModel.SetSecurityGroupID("testString") - deleteSecurityGroupTargetBindingOptionsModel.SetID("testString") - deleteSecurityGroupTargetBindingOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteSecurityGroupTargetBindingOptionsModel).ToNot(BeNil()) - Expect(deleteSecurityGroupTargetBindingOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSecurityGroupTargetBindingOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSecurityGroupTargetBindingOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteSnapshotOptions successfully`, func() { - // Construct an instance of the DeleteSnapshotOptions model - id := "testString" - deleteSnapshotOptionsModel := vpcService.NewDeleteSnapshotOptions(id) - deleteSnapshotOptionsModel.SetID("testString") - deleteSnapshotOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteSnapshotOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteSnapshotOptionsModel).ToNot(BeNil()) - Expect(deleteSnapshotOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSnapshotOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) - Expect(deleteSnapshotOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteSnapshotsOptions successfully`, func() { - // Construct an instance of the DeleteSnapshotsOptions model - sourceVolumeID := "testString" - deleteSnapshotsOptionsModel := vpcService.NewDeleteSnapshotsOptions(sourceVolumeID) - deleteSnapshotsOptionsModel.SetSourceVolumeID("testString") - deleteSnapshotsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteSnapshotsOptionsModel).ToNot(BeNil()) - Expect(deleteSnapshotsOptionsModel.SourceVolumeID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSnapshotsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteSubnetOptions successfully`, func() { - // Construct an instance of the DeleteSubnetOptions model - id := "testString" - deleteSubnetOptionsModel := vpcService.NewDeleteSubnetOptions(id) - deleteSubnetOptionsModel.SetID("testString") - deleteSubnetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteSubnetOptionsModel).ToNot(BeNil()) - Expect(deleteSubnetOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSubnetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteSubnetReservedIPOptions successfully`, func() { - // Construct an instance of the DeleteSubnetReservedIPOptions model - subnetID := "testString" - id := "testString" - deleteSubnetReservedIPOptionsModel := vpcService.NewDeleteSubnetReservedIPOptions(subnetID, id) - deleteSubnetReservedIPOptionsModel.SetSubnetID("testString") - deleteSubnetReservedIPOptionsModel.SetID("testString") - deleteSubnetReservedIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteSubnetReservedIPOptionsModel).ToNot(BeNil()) - Expect(deleteSubnetReservedIPOptionsModel.SubnetID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSubnetReservedIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteVolumeOptions successfully`, func() { - // Construct an instance of the DeleteVolumeOptions model - id := "testString" - deleteVolumeOptionsModel := vpcService.NewDeleteVolumeOptions(id) - deleteVolumeOptionsModel.SetID("testString") - deleteVolumeOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteVolumeOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteVolumeOptionsModel).ToNot(BeNil()) - Expect(deleteVolumeOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVolumeOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) - Expect(deleteVolumeOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteVPCAddressPrefixOptions successfully`, func() { - // Construct an instance of the DeleteVPCAddressPrefixOptions model - vpcID := "testString" - id := "testString" - deleteVPCAddressPrefixOptionsModel := vpcService.NewDeleteVPCAddressPrefixOptions(vpcID, id) - deleteVPCAddressPrefixOptionsModel.SetVPCID("testString") - deleteVPCAddressPrefixOptionsModel.SetID("testString") - deleteVPCAddressPrefixOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteVPCAddressPrefixOptionsModel).ToNot(BeNil()) - Expect(deleteVPCAddressPrefixOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPCAddressPrefixOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPCAddressPrefixOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteVPCOptions successfully`, func() { - // Construct an instance of the DeleteVPCOptions model - id := "testString" - deleteVPCOptionsModel := vpcService.NewDeleteVPCOptions(id) - deleteVPCOptionsModel.SetID("testString") - deleteVPCOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteVPCOptionsModel).ToNot(BeNil()) - Expect(deleteVPCOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPCOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteVPCRouteOptions successfully`, func() { - // Construct an instance of the DeleteVPCRouteOptions model - vpcID := "testString" - id := "testString" - deleteVPCRouteOptionsModel := vpcService.NewDeleteVPCRouteOptions(vpcID, id) - deleteVPCRouteOptionsModel.SetVPCID("testString") - deleteVPCRouteOptionsModel.SetID("testString") - deleteVPCRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteVPCRouteOptionsModel).ToNot(BeNil()) - Expect(deleteVPCRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPCRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPCRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteVPCRoutingTableOptions successfully`, func() { - // Construct an instance of the DeleteVPCRoutingTableOptions model - vpcID := "testString" - id := "testString" - deleteVPCRoutingTableOptionsModel := vpcService.NewDeleteVPCRoutingTableOptions(vpcID, id) - deleteVPCRoutingTableOptionsModel.SetVPCID("testString") - deleteVPCRoutingTableOptionsModel.SetID("testString") - deleteVPCRoutingTableOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteVPCRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteVPCRoutingTableOptionsModel).ToNot(BeNil()) - Expect(deleteVPCRoutingTableOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPCRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPCRoutingTableOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) - Expect(deleteVPCRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteVPCRoutingTableRouteOptions successfully`, func() { - // Construct an instance of the DeleteVPCRoutingTableRouteOptions model - vpcID := "testString" - routingTableID := "testString" - id := "testString" - deleteVPCRoutingTableRouteOptionsModel := vpcService.NewDeleteVPCRoutingTableRouteOptions(vpcID, routingTableID, id) - deleteVPCRoutingTableRouteOptionsModel.SetVPCID("testString") - deleteVPCRoutingTableRouteOptionsModel.SetRoutingTableID("testString") - deleteVPCRoutingTableRouteOptionsModel.SetID("testString") - deleteVPCRoutingTableRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteVPCRoutingTableRouteOptionsModel).ToNot(BeNil()) - Expect(deleteVPCRoutingTableRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPCRoutingTableRouteOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPCRoutingTableRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPCRoutingTableRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteVPNGatewayConnectionOptions successfully`, func() { - // Construct an instance of the DeleteVPNGatewayConnectionOptions model - vpnGatewayID := "testString" - id := "testString" - deleteVPNGatewayConnectionOptionsModel := vpcService.NewDeleteVPNGatewayConnectionOptions(vpnGatewayID, id) - deleteVPNGatewayConnectionOptionsModel.SetVPNGatewayID("testString") - deleteVPNGatewayConnectionOptionsModel.SetID("testString") - deleteVPNGatewayConnectionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteVPNGatewayConnectionOptionsModel).ToNot(BeNil()) - Expect(deleteVPNGatewayConnectionOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPNGatewayConnectionOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPNGatewayConnectionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteVPNGatewayOptions successfully`, func() { - // Construct an instance of the DeleteVPNGatewayOptions model - id := "testString" - deleteVPNGatewayOptionsModel := vpcService.NewDeleteVPNGatewayOptions(id) - deleteVPNGatewayOptionsModel.SetID("testString") - deleteVPNGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteVPNGatewayOptionsModel).ToNot(BeNil()) - Expect(deleteVPNGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPNGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteVPNServerClientOptions successfully`, func() { - // Construct an instance of the DeleteVPNServerClientOptions model - vpnServerID := "testString" - id := "testString" - deleteVPNServerClientOptionsModel := vpcService.NewDeleteVPNServerClientOptions(vpnServerID, id) - deleteVPNServerClientOptionsModel.SetVPNServerID("testString") - deleteVPNServerClientOptionsModel.SetID("testString") - deleteVPNServerClientOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteVPNServerClientOptionsModel).ToNot(BeNil()) - Expect(deleteVPNServerClientOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPNServerClientOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPNServerClientOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteVPNServerOptions successfully`, func() { - // Construct an instance of the DeleteVPNServerOptions model - id := "testString" - deleteVPNServerOptionsModel := vpcService.NewDeleteVPNServerOptions(id) - deleteVPNServerOptionsModel.SetID("testString") - deleteVPNServerOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - deleteVPNServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteVPNServerOptionsModel).ToNot(BeNil()) - Expect(deleteVPNServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPNServerOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) - Expect(deleteVPNServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteVPNServerRouteOptions successfully`, func() { - // Construct an instance of the DeleteVPNServerRouteOptions model - vpnServerID := "testString" - id := "testString" - deleteVPNServerRouteOptionsModel := vpcService.NewDeleteVPNServerRouteOptions(vpnServerID, id) - deleteVPNServerRouteOptionsModel.SetVPNServerID("testString") - deleteVPNServerRouteOptionsModel.SetID("testString") - deleteVPNServerRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteVPNServerRouteOptionsModel).ToNot(BeNil()) - Expect(deleteVPNServerRouteOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPNServerRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(deleteVPNServerRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDisconnectVPNClientOptions successfully`, func() { - // Construct an instance of the DisconnectVPNClientOptions model - vpnServerID := "testString" - id := "testString" - disconnectVPNClientOptionsModel := vpcService.NewDisconnectVPNClientOptions(vpnServerID, id) - disconnectVPNClientOptionsModel.SetVPNServerID("testString") - disconnectVPNClientOptionsModel.SetID("testString") - disconnectVPNClientOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(disconnectVPNClientOptionsModel).ToNot(BeNil()) - Expect(disconnectVPNClientOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) - Expect(disconnectVPNClientOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(disconnectVPNClientOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetBackupPolicyJobOptions successfully`, func() { - // Construct an instance of the GetBackupPolicyJobOptions model - backupPolicyID := "testString" - id := "testString" - getBackupPolicyJobOptionsModel := vpcService.NewGetBackupPolicyJobOptions(backupPolicyID, id) - getBackupPolicyJobOptionsModel.SetBackupPolicyID("testString") - getBackupPolicyJobOptionsModel.SetID("testString") - getBackupPolicyJobOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getBackupPolicyJobOptionsModel).ToNot(BeNil()) - Expect(getBackupPolicyJobOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) - Expect(getBackupPolicyJobOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getBackupPolicyJobOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetBackupPolicyOptions successfully`, func() { - // Construct an instance of the GetBackupPolicyOptions model - id := "testString" - getBackupPolicyOptionsModel := vpcService.NewGetBackupPolicyOptions(id) - getBackupPolicyOptionsModel.SetID("testString") - getBackupPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getBackupPolicyOptionsModel).ToNot(BeNil()) - Expect(getBackupPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getBackupPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetBackupPolicyPlanOptions successfully`, func() { - // Construct an instance of the GetBackupPolicyPlanOptions model - backupPolicyID := "testString" - id := "testString" - getBackupPolicyPlanOptionsModel := vpcService.NewGetBackupPolicyPlanOptions(backupPolicyID, id) - getBackupPolicyPlanOptionsModel.SetBackupPolicyID("testString") - getBackupPolicyPlanOptionsModel.SetID("testString") - getBackupPolicyPlanOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getBackupPolicyPlanOptionsModel).ToNot(BeNil()) - Expect(getBackupPolicyPlanOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) - Expect(getBackupPolicyPlanOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getBackupPolicyPlanOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetBareMetalServerDiskOptions successfully`, func() { - // Construct an instance of the GetBareMetalServerDiskOptions model - bareMetalServerID := "testString" - id := "testString" - getBareMetalServerDiskOptionsModel := vpcService.NewGetBareMetalServerDiskOptions(bareMetalServerID, id) - getBareMetalServerDiskOptionsModel.SetBareMetalServerID("testString") - getBareMetalServerDiskOptionsModel.SetID("testString") - getBareMetalServerDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getBareMetalServerDiskOptionsModel).ToNot(BeNil()) - Expect(getBareMetalServerDiskOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetBareMetalServerInitializationOptions successfully`, func() { - // Construct an instance of the GetBareMetalServerInitializationOptions model - id := "testString" - getBareMetalServerInitializationOptionsModel := vpcService.NewGetBareMetalServerInitializationOptions(id) - getBareMetalServerInitializationOptionsModel.SetID("testString") - getBareMetalServerInitializationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getBareMetalServerInitializationOptionsModel).ToNot(BeNil()) - Expect(getBareMetalServerInitializationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerInitializationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetBareMetalServerNetworkInterfaceFloatingIPOptions successfully`, func() { - // Construct an instance of the GetBareMetalServerNetworkInterfaceFloatingIPOptions model - bareMetalServerID := "testString" - networkInterfaceID := "testString" - id := "testString" - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel := vpcService.NewGetBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID, networkInterfaceID, id) - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetBareMetalServerID("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetNetworkInterfaceID("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetID("testString") - getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) - Expect(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetBareMetalServerNetworkInterfaceIPOptions successfully`, func() { - // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model - bareMetalServerID := "testString" - networkInterfaceID := "testString" - id := "testString" - getBareMetalServerNetworkInterfaceIPOptionsModel := vpcService.NewGetBareMetalServerNetworkInterfaceIPOptions(bareMetalServerID, networkInterfaceID, id) - getBareMetalServerNetworkInterfaceIPOptionsModel.SetBareMetalServerID("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.SetNetworkInterfaceID("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.SetID("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getBareMetalServerNetworkInterfaceIPOptionsModel).ToNot(BeNil()) - Expect(getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerNetworkInterfaceIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerNetworkInterfaceIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetBareMetalServerNetworkInterfaceOptions successfully`, func() { - // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model - bareMetalServerID := "testString" - id := "testString" - getBareMetalServerNetworkInterfaceOptionsModel := vpcService.NewGetBareMetalServerNetworkInterfaceOptions(bareMetalServerID, id) - getBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerID("testString") - getBareMetalServerNetworkInterfaceOptionsModel.SetID("testString") - getBareMetalServerNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getBareMetalServerNetworkInterfaceOptionsModel).ToNot(BeNil()) - Expect(getBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetBareMetalServerOptions successfully`, func() { - // Construct an instance of the GetBareMetalServerOptions model - id := "testString" - getBareMetalServerOptionsModel := vpcService.NewGetBareMetalServerOptions(id) - getBareMetalServerOptionsModel.SetID("testString") - getBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getBareMetalServerOptionsModel).ToNot(BeNil()) - Expect(getBareMetalServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetBareMetalServerProfileOptions successfully`, func() { - // Construct an instance of the GetBareMetalServerProfileOptions model - name := "testString" - getBareMetalServerProfileOptionsModel := vpcService.NewGetBareMetalServerProfileOptions(name) - getBareMetalServerProfileOptionsModel.SetName("testString") - getBareMetalServerProfileOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getBareMetalServerProfileOptionsModel).ToNot(BeNil()) - Expect(getBareMetalServerProfileOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerProfileOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetDedicatedHostDiskOptions successfully`, func() { - // Construct an instance of the GetDedicatedHostDiskOptions model - dedicatedHostID := "testString" - id := "testString" - getDedicatedHostDiskOptionsModel := vpcService.NewGetDedicatedHostDiskOptions(dedicatedHostID, id) - getDedicatedHostDiskOptionsModel.SetDedicatedHostID("testString") - getDedicatedHostDiskOptionsModel.SetID("testString") - getDedicatedHostDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getDedicatedHostDiskOptionsModel).ToNot(BeNil()) - Expect(getDedicatedHostDiskOptionsModel.DedicatedHostID).To(Equal(core.StringPtr("testString"))) - Expect(getDedicatedHostDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getDedicatedHostDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetDedicatedHostGroupOptions successfully`, func() { - // Construct an instance of the GetDedicatedHostGroupOptions model - id := "testString" - getDedicatedHostGroupOptionsModel := vpcService.NewGetDedicatedHostGroupOptions(id) - getDedicatedHostGroupOptionsModel.SetID("testString") - getDedicatedHostGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getDedicatedHostGroupOptionsModel).ToNot(BeNil()) - Expect(getDedicatedHostGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getDedicatedHostGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetDedicatedHostOptions successfully`, func() { - // Construct an instance of the GetDedicatedHostOptions model - id := "testString" - getDedicatedHostOptionsModel := vpcService.NewGetDedicatedHostOptions(id) - getDedicatedHostOptionsModel.SetID("testString") - getDedicatedHostOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getDedicatedHostOptionsModel).ToNot(BeNil()) - Expect(getDedicatedHostOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getDedicatedHostOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetDedicatedHostProfileOptions successfully`, func() { - // Construct an instance of the GetDedicatedHostProfileOptions model - name := "testString" - getDedicatedHostProfileOptionsModel := vpcService.NewGetDedicatedHostProfileOptions(name) - getDedicatedHostProfileOptionsModel.SetName("testString") - getDedicatedHostProfileOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getDedicatedHostProfileOptionsModel).ToNot(BeNil()) - Expect(getDedicatedHostProfileOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(getDedicatedHostProfileOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetEndpointGatewayIPOptions successfully`, func() { - // Construct an instance of the GetEndpointGatewayIPOptions model - endpointGatewayID := "testString" - id := "testString" - getEndpointGatewayIPOptionsModel := vpcService.NewGetEndpointGatewayIPOptions(endpointGatewayID, id) - getEndpointGatewayIPOptionsModel.SetEndpointGatewayID("testString") - getEndpointGatewayIPOptionsModel.SetID("testString") - getEndpointGatewayIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getEndpointGatewayIPOptionsModel).ToNot(BeNil()) - Expect(getEndpointGatewayIPOptionsModel.EndpointGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(getEndpointGatewayIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getEndpointGatewayIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetEndpointGatewayOptions successfully`, func() { - // Construct an instance of the GetEndpointGatewayOptions model - id := "testString" - getEndpointGatewayOptionsModel := vpcService.NewGetEndpointGatewayOptions(id) - getEndpointGatewayOptionsModel.SetID("testString") - getEndpointGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getEndpointGatewayOptionsModel).ToNot(BeNil()) - Expect(getEndpointGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getEndpointGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetFloatingIPOptions successfully`, func() { - // Construct an instance of the GetFloatingIPOptions model - id := "testString" - getFloatingIPOptionsModel := vpcService.NewGetFloatingIPOptions(id) - getFloatingIPOptionsModel.SetID("testString") - getFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getFloatingIPOptionsModel).ToNot(BeNil()) - Expect(getFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetFlowLogCollectorOptions successfully`, func() { - // Construct an instance of the GetFlowLogCollectorOptions model - id := "testString" - getFlowLogCollectorOptionsModel := vpcService.NewGetFlowLogCollectorOptions(id) - getFlowLogCollectorOptionsModel.SetID("testString") - getFlowLogCollectorOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getFlowLogCollectorOptionsModel).ToNot(BeNil()) - Expect(getFlowLogCollectorOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getFlowLogCollectorOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetIkePolicyOptions successfully`, func() { - // Construct an instance of the GetIkePolicyOptions model - id := "testString" - getIkePolicyOptionsModel := vpcService.NewGetIkePolicyOptions(id) - getIkePolicyOptionsModel.SetID("testString") - getIkePolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getIkePolicyOptionsModel).ToNot(BeNil()) - Expect(getIkePolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getIkePolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetImageOptions successfully`, func() { - // Construct an instance of the GetImageOptions model - id := "testString" - getImageOptionsModel := vpcService.NewGetImageOptions(id) - getImageOptionsModel.SetID("testString") - getImageOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getImageOptionsModel).ToNot(BeNil()) - Expect(getImageOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getImageOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetInstanceDiskOptions successfully`, func() { - // Construct an instance of the GetInstanceDiskOptions model - instanceID := "testString" - id := "testString" - getInstanceDiskOptionsModel := vpcService.NewGetInstanceDiskOptions(instanceID, id) - getInstanceDiskOptionsModel.SetInstanceID("testString") - getInstanceDiskOptionsModel.SetID("testString") - getInstanceDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getInstanceDiskOptionsModel).ToNot(BeNil()) - Expect(getInstanceDiskOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetInstanceGroupManagerActionOptions successfully`, func() { - // Construct an instance of the GetInstanceGroupManagerActionOptions model - instanceGroupID := "testString" - instanceGroupManagerID := "testString" - id := "testString" - getInstanceGroupManagerActionOptionsModel := vpcService.NewGetInstanceGroupManagerActionOptions(instanceGroupID, instanceGroupManagerID, id) - getInstanceGroupManagerActionOptionsModel.SetInstanceGroupID("testString") - getInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerID("testString") - getInstanceGroupManagerActionOptionsModel.SetID("testString") - getInstanceGroupManagerActionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getInstanceGroupManagerActionOptionsModel).ToNot(BeNil()) - Expect(getInstanceGroupManagerActionOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceGroupManagerActionOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceGroupManagerActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetInstanceGroupManagerOptions successfully`, func() { - // Construct an instance of the GetInstanceGroupManagerOptions model - instanceGroupID := "testString" - id := "testString" - getInstanceGroupManagerOptionsModel := vpcService.NewGetInstanceGroupManagerOptions(instanceGroupID, id) - getInstanceGroupManagerOptionsModel.SetInstanceGroupID("testString") - getInstanceGroupManagerOptionsModel.SetID("testString") - getInstanceGroupManagerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getInstanceGroupManagerOptionsModel).ToNot(BeNil()) - Expect(getInstanceGroupManagerOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceGroupManagerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceGroupManagerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetInstanceGroupManagerPolicyOptions successfully`, func() { - // Construct an instance of the GetInstanceGroupManagerPolicyOptions model - instanceGroupID := "testString" - instanceGroupManagerID := "testString" - id := "testString" - getInstanceGroupManagerPolicyOptionsModel := vpcService.NewGetInstanceGroupManagerPolicyOptions(instanceGroupID, instanceGroupManagerID, id) - getInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupID("testString") - getInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerID("testString") - getInstanceGroupManagerPolicyOptionsModel.SetID("testString") - getInstanceGroupManagerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getInstanceGroupManagerPolicyOptionsModel).ToNot(BeNil()) - Expect(getInstanceGroupManagerPolicyOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceGroupManagerPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceGroupManagerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetInstanceGroupMembershipOptions successfully`, func() { - // Construct an instance of the GetInstanceGroupMembershipOptions model - instanceGroupID := "testString" - id := "testString" - getInstanceGroupMembershipOptionsModel := vpcService.NewGetInstanceGroupMembershipOptions(instanceGroupID, id) - getInstanceGroupMembershipOptionsModel.SetInstanceGroupID("testString") - getInstanceGroupMembershipOptionsModel.SetID("testString") - getInstanceGroupMembershipOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getInstanceGroupMembershipOptionsModel).ToNot(BeNil()) - Expect(getInstanceGroupMembershipOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceGroupMembershipOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceGroupMembershipOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetInstanceGroupOptions successfully`, func() { - // Construct an instance of the GetInstanceGroupOptions model - id := "testString" - getInstanceGroupOptionsModel := vpcService.NewGetInstanceGroupOptions(id) - getInstanceGroupOptionsModel.SetID("testString") - getInstanceGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getInstanceGroupOptionsModel).ToNot(BeNil()) - Expect(getInstanceGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetInstanceInitializationOptions successfully`, func() { - // Construct an instance of the GetInstanceInitializationOptions model - id := "testString" - getInstanceInitializationOptionsModel := vpcService.NewGetInstanceInitializationOptions(id) - getInstanceInitializationOptionsModel.SetID("testString") - getInstanceInitializationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getInstanceInitializationOptionsModel).ToNot(BeNil()) - Expect(getInstanceInitializationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceInitializationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetInstanceNetworkInterfaceFloatingIPOptions successfully`, func() { - // Construct an instance of the GetInstanceNetworkInterfaceFloatingIPOptions model - instanceID := "testString" - networkInterfaceID := "testString" - id := "testString" - getInstanceNetworkInterfaceFloatingIPOptionsModel := vpcService.NewGetInstanceNetworkInterfaceFloatingIPOptions(instanceID, networkInterfaceID, id) - getInstanceNetworkInterfaceFloatingIPOptionsModel.SetInstanceID("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.SetNetworkInterfaceID("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.SetID("testString") - getInstanceNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getInstanceNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) - Expect(getInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetInstanceNetworkInterfaceIPOptions successfully`, func() { - // Construct an instance of the GetInstanceNetworkInterfaceIPOptions model - instanceID := "testString" - networkInterfaceID := "testString" - id := "testString" - getInstanceNetworkInterfaceIPOptionsModel := vpcService.NewGetInstanceNetworkInterfaceIPOptions(instanceID, networkInterfaceID, id) - getInstanceNetworkInterfaceIPOptionsModel.SetInstanceID("testString") - getInstanceNetworkInterfaceIPOptionsModel.SetNetworkInterfaceID("testString") - getInstanceNetworkInterfaceIPOptionsModel.SetID("testString") - getInstanceNetworkInterfaceIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getInstanceNetworkInterfaceIPOptionsModel).ToNot(BeNil()) - Expect(getInstanceNetworkInterfaceIPOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceNetworkInterfaceIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceNetworkInterfaceIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceNetworkInterfaceIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetInstanceNetworkInterfaceOptions successfully`, func() { - // Construct an instance of the GetInstanceNetworkInterfaceOptions model - instanceID := "testString" - id := "testString" - getInstanceNetworkInterfaceOptionsModel := vpcService.NewGetInstanceNetworkInterfaceOptions(instanceID, id) - getInstanceNetworkInterfaceOptionsModel.SetInstanceID("testString") - getInstanceNetworkInterfaceOptionsModel.SetID("testString") - getInstanceNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getInstanceNetworkInterfaceOptionsModel).ToNot(BeNil()) - Expect(getInstanceNetworkInterfaceOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetInstanceOptions successfully`, func() { - // Construct an instance of the GetInstanceOptions model - id := "testString" - getInstanceOptionsModel := vpcService.NewGetInstanceOptions(id) - getInstanceOptionsModel.SetID("testString") - getInstanceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getInstanceOptionsModel).ToNot(BeNil()) - Expect(getInstanceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetInstanceProfileOptions successfully`, func() { - // Construct an instance of the GetInstanceProfileOptions model - name := "testString" - getInstanceProfileOptionsModel := vpcService.NewGetInstanceProfileOptions(name) - getInstanceProfileOptionsModel.SetName("testString") - getInstanceProfileOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getInstanceProfileOptionsModel).ToNot(BeNil()) - Expect(getInstanceProfileOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceProfileOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetInstanceTemplateOptions successfully`, func() { - // Construct an instance of the GetInstanceTemplateOptions model - id := "testString" - getInstanceTemplateOptionsModel := vpcService.NewGetInstanceTemplateOptions(id) - getInstanceTemplateOptionsModel.SetID("testString") - getInstanceTemplateOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getInstanceTemplateOptionsModel).ToNot(BeNil()) - Expect(getInstanceTemplateOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceTemplateOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetInstanceVolumeAttachmentOptions successfully`, func() { - // Construct an instance of the GetInstanceVolumeAttachmentOptions model - instanceID := "testString" - id := "testString" - getInstanceVolumeAttachmentOptionsModel := vpcService.NewGetInstanceVolumeAttachmentOptions(instanceID, id) - getInstanceVolumeAttachmentOptionsModel.SetInstanceID("testString") - getInstanceVolumeAttachmentOptionsModel.SetID("testString") - getInstanceVolumeAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getInstanceVolumeAttachmentOptionsModel).ToNot(BeNil()) - Expect(getInstanceVolumeAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceVolumeAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getInstanceVolumeAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetIpsecPolicyOptions successfully`, func() { - // Construct an instance of the GetIpsecPolicyOptions model - id := "testString" - getIpsecPolicyOptionsModel := vpcService.NewGetIpsecPolicyOptions(id) - getIpsecPolicyOptionsModel.SetID("testString") - getIpsecPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getIpsecPolicyOptionsModel).ToNot(BeNil()) - Expect(getIpsecPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getIpsecPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetKeyOptions successfully`, func() { - // Construct an instance of the GetKeyOptions model - id := "testString" - getKeyOptionsModel := vpcService.NewGetKeyOptions(id) - getKeyOptionsModel.SetID("testString") - getKeyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getKeyOptionsModel).ToNot(BeNil()) - Expect(getKeyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getKeyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetLoadBalancerListenerOptions successfully`, func() { - // Construct an instance of the GetLoadBalancerListenerOptions model - loadBalancerID := "testString" - id := "testString" - getLoadBalancerListenerOptionsModel := vpcService.NewGetLoadBalancerListenerOptions(loadBalancerID, id) - getLoadBalancerListenerOptionsModel.SetLoadBalancerID("testString") - getLoadBalancerListenerOptionsModel.SetID("testString") - getLoadBalancerListenerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getLoadBalancerListenerOptionsModel).ToNot(BeNil()) - Expect(getLoadBalancerListenerOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerListenerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerListenerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetLoadBalancerListenerPolicyOptions successfully`, func() { - // Construct an instance of the GetLoadBalancerListenerPolicyOptions model - loadBalancerID := "testString" - listenerID := "testString" - id := "testString" - getLoadBalancerListenerPolicyOptionsModel := vpcService.NewGetLoadBalancerListenerPolicyOptions(loadBalancerID, listenerID, id) - getLoadBalancerListenerPolicyOptionsModel.SetLoadBalancerID("testString") - getLoadBalancerListenerPolicyOptionsModel.SetListenerID("testString") - getLoadBalancerListenerPolicyOptionsModel.SetID("testString") - getLoadBalancerListenerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getLoadBalancerListenerPolicyOptionsModel).ToNot(BeNil()) - Expect(getLoadBalancerListenerPolicyOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerListenerPolicyOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerListenerPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerListenerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetLoadBalancerListenerPolicyRuleOptions successfully`, func() { - // Construct an instance of the GetLoadBalancerListenerPolicyRuleOptions model - loadBalancerID := "testString" - listenerID := "testString" - policyID := "testString" - id := "testString" - getLoadBalancerListenerPolicyRuleOptionsModel := vpcService.NewGetLoadBalancerListenerPolicyRuleOptions(loadBalancerID, listenerID, policyID, id) - getLoadBalancerListenerPolicyRuleOptionsModel.SetLoadBalancerID("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.SetListenerID("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.SetPolicyID("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.SetID("testString") - getLoadBalancerListenerPolicyRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getLoadBalancerListenerPolicyRuleOptionsModel).ToNot(BeNil()) - Expect(getLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerListenerPolicyRuleOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerListenerPolicyRuleOptionsModel.PolicyID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerListenerPolicyRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerListenerPolicyRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetLoadBalancerOptions successfully`, func() { - // Construct an instance of the GetLoadBalancerOptions model - id := "testString" - getLoadBalancerOptionsModel := vpcService.NewGetLoadBalancerOptions(id) - getLoadBalancerOptionsModel.SetID("testString") - getLoadBalancerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getLoadBalancerOptionsModel).ToNot(BeNil()) - Expect(getLoadBalancerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetLoadBalancerPoolMemberOptions successfully`, func() { - // Construct an instance of the GetLoadBalancerPoolMemberOptions model - loadBalancerID := "testString" - poolID := "testString" - id := "testString" - getLoadBalancerPoolMemberOptionsModel := vpcService.NewGetLoadBalancerPoolMemberOptions(loadBalancerID, poolID, id) - getLoadBalancerPoolMemberOptionsModel.SetLoadBalancerID("testString") - getLoadBalancerPoolMemberOptionsModel.SetPoolID("testString") - getLoadBalancerPoolMemberOptionsModel.SetID("testString") - getLoadBalancerPoolMemberOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getLoadBalancerPoolMemberOptionsModel).ToNot(BeNil()) - Expect(getLoadBalancerPoolMemberOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerPoolMemberOptionsModel.PoolID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerPoolMemberOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerPoolMemberOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetLoadBalancerPoolOptions successfully`, func() { - // Construct an instance of the GetLoadBalancerPoolOptions model - loadBalancerID := "testString" - id := "testString" - getLoadBalancerPoolOptionsModel := vpcService.NewGetLoadBalancerPoolOptions(loadBalancerID, id) - getLoadBalancerPoolOptionsModel.SetLoadBalancerID("testString") - getLoadBalancerPoolOptionsModel.SetID("testString") - getLoadBalancerPoolOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getLoadBalancerPoolOptionsModel).ToNot(BeNil()) - Expect(getLoadBalancerPoolOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerPoolOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerPoolOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetLoadBalancerProfileOptions successfully`, func() { - // Construct an instance of the GetLoadBalancerProfileOptions model - name := "testString" - getLoadBalancerProfileOptionsModel := vpcService.NewGetLoadBalancerProfileOptions(name) - getLoadBalancerProfileOptionsModel.SetName("testString") - getLoadBalancerProfileOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getLoadBalancerProfileOptionsModel).ToNot(BeNil()) - Expect(getLoadBalancerProfileOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerProfileOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetLoadBalancerStatisticsOptions successfully`, func() { - // Construct an instance of the GetLoadBalancerStatisticsOptions model - id := "testString" - getLoadBalancerStatisticsOptionsModel := vpcService.NewGetLoadBalancerStatisticsOptions(id) - getLoadBalancerStatisticsOptionsModel.SetID("testString") - getLoadBalancerStatisticsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getLoadBalancerStatisticsOptionsModel).ToNot(BeNil()) - Expect(getLoadBalancerStatisticsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getLoadBalancerStatisticsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetNetworkACLOptions successfully`, func() { - // Construct an instance of the GetNetworkACLOptions model - id := "testString" - getNetworkACLOptionsModel := vpcService.NewGetNetworkACLOptions(id) - getNetworkACLOptionsModel.SetID("testString") - getNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getNetworkACLOptionsModel).ToNot(BeNil()) - Expect(getNetworkACLOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetNetworkACLRuleOptions successfully`, func() { - // Construct an instance of the GetNetworkACLRuleOptions model - networkACLID := "testString" - id := "testString" - getNetworkACLRuleOptionsModel := vpcService.NewGetNetworkACLRuleOptions(networkACLID, id) - getNetworkACLRuleOptionsModel.SetNetworkACLID("testString") - getNetworkACLRuleOptionsModel.SetID("testString") - getNetworkACLRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getNetworkACLRuleOptionsModel).ToNot(BeNil()) - Expect(getNetworkACLRuleOptionsModel.NetworkACLID).To(Equal(core.StringPtr("testString"))) - Expect(getNetworkACLRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getNetworkACLRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetOperatingSystemOptions successfully`, func() { - // Construct an instance of the GetOperatingSystemOptions model - name := "testString" - getOperatingSystemOptionsModel := vpcService.NewGetOperatingSystemOptions(name) - getOperatingSystemOptionsModel.SetName("testString") - getOperatingSystemOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getOperatingSystemOptionsModel).ToNot(BeNil()) - Expect(getOperatingSystemOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(getOperatingSystemOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetPlacementGroupOptions successfully`, func() { - // Construct an instance of the GetPlacementGroupOptions model - id := "testString" - getPlacementGroupOptionsModel := vpcService.NewGetPlacementGroupOptions(id) - getPlacementGroupOptionsModel.SetID("testString") - getPlacementGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getPlacementGroupOptionsModel).ToNot(BeNil()) - Expect(getPlacementGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getPlacementGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetPublicGatewayOptions successfully`, func() { - // Construct an instance of the GetPublicGatewayOptions model - id := "testString" - getPublicGatewayOptionsModel := vpcService.NewGetPublicGatewayOptions(id) - getPublicGatewayOptionsModel.SetID("testString") - getPublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getPublicGatewayOptionsModel).ToNot(BeNil()) - Expect(getPublicGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getPublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetRegionOptions successfully`, func() { - // Construct an instance of the GetRegionOptions model - name := "testString" - getRegionOptionsModel := vpcService.NewGetRegionOptions(name) - getRegionOptionsModel.SetName("testString") - getRegionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getRegionOptionsModel).ToNot(BeNil()) - Expect(getRegionOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(getRegionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetRegionZoneOptions successfully`, func() { - // Construct an instance of the GetRegionZoneOptions model - regionName := "testString" - name := "testString" - getRegionZoneOptionsModel := vpcService.NewGetRegionZoneOptions(regionName, name) - getRegionZoneOptionsModel.SetRegionName("testString") - getRegionZoneOptionsModel.SetName("testString") - getRegionZoneOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getRegionZoneOptionsModel).ToNot(BeNil()) - Expect(getRegionZoneOptionsModel.RegionName).To(Equal(core.StringPtr("testString"))) - Expect(getRegionZoneOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(getRegionZoneOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetSecurityGroupOptions successfully`, func() { - // Construct an instance of the GetSecurityGroupOptions model - id := "testString" - getSecurityGroupOptionsModel := vpcService.NewGetSecurityGroupOptions(id) - getSecurityGroupOptionsModel.SetID("testString") - getSecurityGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSecurityGroupOptionsModel).ToNot(BeNil()) - Expect(getSecurityGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getSecurityGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetSecurityGroupRuleOptions successfully`, func() { - // Construct an instance of the GetSecurityGroupRuleOptions model - securityGroupID := "testString" - id := "testString" - getSecurityGroupRuleOptionsModel := vpcService.NewGetSecurityGroupRuleOptions(securityGroupID, id) - getSecurityGroupRuleOptionsModel.SetSecurityGroupID("testString") - getSecurityGroupRuleOptionsModel.SetID("testString") - getSecurityGroupRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSecurityGroupRuleOptionsModel).ToNot(BeNil()) - Expect(getSecurityGroupRuleOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) - Expect(getSecurityGroupRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getSecurityGroupRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetSecurityGroupTargetOptions successfully`, func() { - // Construct an instance of the GetSecurityGroupTargetOptions model - securityGroupID := "testString" - id := "testString" - getSecurityGroupTargetOptionsModel := vpcService.NewGetSecurityGroupTargetOptions(securityGroupID, id) - getSecurityGroupTargetOptionsModel.SetSecurityGroupID("testString") - getSecurityGroupTargetOptionsModel.SetID("testString") - getSecurityGroupTargetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSecurityGroupTargetOptionsModel).ToNot(BeNil()) - Expect(getSecurityGroupTargetOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) - Expect(getSecurityGroupTargetOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getSecurityGroupTargetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetSnapshotOptions successfully`, func() { - // Construct an instance of the GetSnapshotOptions model - id := "testString" - getSnapshotOptionsModel := vpcService.NewGetSnapshotOptions(id) - getSnapshotOptionsModel.SetID("testString") - getSnapshotOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSnapshotOptionsModel).ToNot(BeNil()) - Expect(getSnapshotOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getSnapshotOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetSubnetNetworkACLOptions successfully`, func() { - // Construct an instance of the GetSubnetNetworkACLOptions model - id := "testString" - getSubnetNetworkACLOptionsModel := vpcService.NewGetSubnetNetworkACLOptions(id) - getSubnetNetworkACLOptionsModel.SetID("testString") - getSubnetNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSubnetNetworkACLOptionsModel).ToNot(BeNil()) - Expect(getSubnetNetworkACLOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getSubnetNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetSubnetOptions successfully`, func() { - // Construct an instance of the GetSubnetOptions model - id := "testString" - getSubnetOptionsModel := vpcService.NewGetSubnetOptions(id) - getSubnetOptionsModel.SetID("testString") - getSubnetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSubnetOptionsModel).ToNot(BeNil()) - Expect(getSubnetOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getSubnetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetSubnetPublicGatewayOptions successfully`, func() { - // Construct an instance of the GetSubnetPublicGatewayOptions model - id := "testString" - getSubnetPublicGatewayOptionsModel := vpcService.NewGetSubnetPublicGatewayOptions(id) - getSubnetPublicGatewayOptionsModel.SetID("testString") - getSubnetPublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSubnetPublicGatewayOptionsModel).ToNot(BeNil()) - Expect(getSubnetPublicGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getSubnetPublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetSubnetReservedIPOptions successfully`, func() { - // Construct an instance of the GetSubnetReservedIPOptions model - subnetID := "testString" - id := "testString" - getSubnetReservedIPOptionsModel := vpcService.NewGetSubnetReservedIPOptions(subnetID, id) - getSubnetReservedIPOptionsModel.SetSubnetID("testString") - getSubnetReservedIPOptionsModel.SetID("testString") - getSubnetReservedIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSubnetReservedIPOptionsModel).ToNot(BeNil()) - Expect(getSubnetReservedIPOptionsModel.SubnetID).To(Equal(core.StringPtr("testString"))) - Expect(getSubnetReservedIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetSubnetRoutingTableOptions successfully`, func() { - // Construct an instance of the GetSubnetRoutingTableOptions model - id := "testString" - getSubnetRoutingTableOptionsModel := vpcService.NewGetSubnetRoutingTableOptions(id) - getSubnetRoutingTableOptionsModel.SetID("testString") - getSubnetRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSubnetRoutingTableOptionsModel).ToNot(BeNil()) - Expect(getSubnetRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getSubnetRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVolumeOptions successfully`, func() { - // Construct an instance of the GetVolumeOptions model - id := "testString" - getVolumeOptionsModel := vpcService.NewGetVolumeOptions(id) - getVolumeOptionsModel.SetID("testString") - getVolumeOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVolumeOptionsModel).ToNot(BeNil()) - Expect(getVolumeOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVolumeOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVolumeProfileOptions successfully`, func() { - // Construct an instance of the GetVolumeProfileOptions model - name := "testString" - getVolumeProfileOptionsModel := vpcService.NewGetVolumeProfileOptions(name) - getVolumeProfileOptionsModel.SetName("testString") - getVolumeProfileOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVolumeProfileOptionsModel).ToNot(BeNil()) - Expect(getVolumeProfileOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(getVolumeProfileOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVPCAddressPrefixOptions successfully`, func() { - // Construct an instance of the GetVPCAddressPrefixOptions model - vpcID := "testString" - id := "testString" - getVPCAddressPrefixOptionsModel := vpcService.NewGetVPCAddressPrefixOptions(vpcID, id) - getVPCAddressPrefixOptionsModel.SetVPCID("testString") - getVPCAddressPrefixOptionsModel.SetID("testString") - getVPCAddressPrefixOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVPCAddressPrefixOptionsModel).ToNot(BeNil()) - Expect(getVPCAddressPrefixOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(getVPCAddressPrefixOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVPCAddressPrefixOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVPCDefaultNetworkACLOptions successfully`, func() { - // Construct an instance of the GetVPCDefaultNetworkACLOptions model - id := "testString" - getVPCDefaultNetworkACLOptionsModel := vpcService.NewGetVPCDefaultNetworkACLOptions(id) - getVPCDefaultNetworkACLOptionsModel.SetID("testString") - getVPCDefaultNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVPCDefaultNetworkACLOptionsModel).ToNot(BeNil()) - Expect(getVPCDefaultNetworkACLOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVPCDefaultNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVPCDefaultRoutingTableOptions successfully`, func() { - // Construct an instance of the GetVPCDefaultRoutingTableOptions model - id := "testString" - getVPCDefaultRoutingTableOptionsModel := vpcService.NewGetVPCDefaultRoutingTableOptions(id) - getVPCDefaultRoutingTableOptionsModel.SetID("testString") - getVPCDefaultRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVPCDefaultRoutingTableOptionsModel).ToNot(BeNil()) - Expect(getVPCDefaultRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVPCDefaultRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVPCDefaultSecurityGroupOptions successfully`, func() { - // Construct an instance of the GetVPCDefaultSecurityGroupOptions model - id := "testString" - getVPCDefaultSecurityGroupOptionsModel := vpcService.NewGetVPCDefaultSecurityGroupOptions(id) - getVPCDefaultSecurityGroupOptionsModel.SetID("testString") - getVPCDefaultSecurityGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVPCDefaultSecurityGroupOptionsModel).ToNot(BeNil()) - Expect(getVPCDefaultSecurityGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVPCDefaultSecurityGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVPCOptions successfully`, func() { - // Construct an instance of the GetVPCOptions model - id := "testString" - getVPCOptionsModel := vpcService.NewGetVPCOptions(id) - getVPCOptionsModel.SetID("testString") - getVPCOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVPCOptionsModel).ToNot(BeNil()) - Expect(getVPCOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVPCOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVPCRouteOptions successfully`, func() { - // Construct an instance of the GetVPCRouteOptions model - vpcID := "testString" - id := "testString" - getVPCRouteOptionsModel := vpcService.NewGetVPCRouteOptions(vpcID, id) - getVPCRouteOptionsModel.SetVPCID("testString") - getVPCRouteOptionsModel.SetID("testString") - getVPCRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVPCRouteOptionsModel).ToNot(BeNil()) - Expect(getVPCRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(getVPCRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVPCRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVPCRoutingTableOptions successfully`, func() { - // Construct an instance of the GetVPCRoutingTableOptions model - vpcID := "testString" - id := "testString" - getVPCRoutingTableOptionsModel := vpcService.NewGetVPCRoutingTableOptions(vpcID, id) - getVPCRoutingTableOptionsModel.SetVPCID("testString") - getVPCRoutingTableOptionsModel.SetID("testString") - getVPCRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVPCRoutingTableOptionsModel).ToNot(BeNil()) - Expect(getVPCRoutingTableOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(getVPCRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVPCRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVPCRoutingTableRouteOptions successfully`, func() { - // Construct an instance of the GetVPCRoutingTableRouteOptions model - vpcID := "testString" - routingTableID := "testString" - id := "testString" - getVPCRoutingTableRouteOptionsModel := vpcService.NewGetVPCRoutingTableRouteOptions(vpcID, routingTableID, id) - getVPCRoutingTableRouteOptionsModel.SetVPCID("testString") - getVPCRoutingTableRouteOptionsModel.SetRoutingTableID("testString") - getVPCRoutingTableRouteOptionsModel.SetID("testString") - getVPCRoutingTableRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVPCRoutingTableRouteOptionsModel).ToNot(BeNil()) - Expect(getVPCRoutingTableRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(getVPCRoutingTableRouteOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) - Expect(getVPCRoutingTableRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVPCRoutingTableRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVPNGatewayConnectionOptions successfully`, func() { - // Construct an instance of the GetVPNGatewayConnectionOptions model - vpnGatewayID := "testString" - id := "testString" - getVPNGatewayConnectionOptionsModel := vpcService.NewGetVPNGatewayConnectionOptions(vpnGatewayID, id) - getVPNGatewayConnectionOptionsModel.SetVPNGatewayID("testString") - getVPNGatewayConnectionOptionsModel.SetID("testString") - getVPNGatewayConnectionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVPNGatewayConnectionOptionsModel).ToNot(BeNil()) - Expect(getVPNGatewayConnectionOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(getVPNGatewayConnectionOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVPNGatewayConnectionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVPNGatewayOptions successfully`, func() { - // Construct an instance of the GetVPNGatewayOptions model - id := "testString" - getVPNGatewayOptionsModel := vpcService.NewGetVPNGatewayOptions(id) - getVPNGatewayOptionsModel.SetID("testString") - getVPNGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVPNGatewayOptionsModel).ToNot(BeNil()) - Expect(getVPNGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVPNGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVPNServerClientConfigurationOptions successfully`, func() { - // Construct an instance of the GetVPNServerClientConfigurationOptions model - id := "testString" - getVPNServerClientConfigurationOptionsModel := vpcService.NewGetVPNServerClientConfigurationOptions(id) - getVPNServerClientConfigurationOptionsModel.SetID("testString") - getVPNServerClientConfigurationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVPNServerClientConfigurationOptionsModel).ToNot(BeNil()) - Expect(getVPNServerClientConfigurationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVPNServerClientConfigurationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVPNServerClientOptions successfully`, func() { - // Construct an instance of the GetVPNServerClientOptions model - vpnServerID := "testString" - id := "testString" - getVPNServerClientOptionsModel := vpcService.NewGetVPNServerClientOptions(vpnServerID, id) - getVPNServerClientOptionsModel.SetVPNServerID("testString") - getVPNServerClientOptionsModel.SetID("testString") - getVPNServerClientOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVPNServerClientOptionsModel).ToNot(BeNil()) - Expect(getVPNServerClientOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) - Expect(getVPNServerClientOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVPNServerClientOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVPNServerOptions successfully`, func() { - // Construct an instance of the GetVPNServerOptions model - id := "testString" - getVPNServerOptionsModel := vpcService.NewGetVPNServerOptions(id) - getVPNServerOptionsModel.SetID("testString") - getVPNServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVPNServerOptionsModel).ToNot(BeNil()) - Expect(getVPNServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVPNServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetVPNServerRouteOptions successfully`, func() { - // Construct an instance of the GetVPNServerRouteOptions model - vpnServerID := "testString" - id := "testString" - getVPNServerRouteOptionsModel := vpcService.NewGetVPNServerRouteOptions(vpnServerID, id) - getVPNServerRouteOptionsModel.SetVPNServerID("testString") - getVPNServerRouteOptionsModel.SetID("testString") - getVPNServerRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getVPNServerRouteOptionsModel).ToNot(BeNil()) - Expect(getVPNServerRouteOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) - Expect(getVPNServerRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getVPNServerRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewIP successfully`, func() { - address := "192.168.3.4" - _model, err := vpcService.NewIP(address) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewImageFilePrototype successfully`, func() { - href := "cos://us-south/custom-image-vpc-bucket/customImage-0.vhd" - _model, err := vpcService.NewImageFilePrototype(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstanceDefaultTrustedProfilePrototype successfully`, func() { - var target vpcv1.TrustedProfileIdentityIntf = nil - _, err := vpcService.NewInstanceDefaultTrustedProfilePrototype(target) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstanceGroupManagerScheduledActionGroupPrototype successfully`, func() { - membershipCount := int64(10) - _model, err := vpcService.NewInstanceGroupManagerScheduledActionGroupPrototype(membershipCount) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewListBackupPoliciesOptions successfully`, func() { - // Construct an instance of the ListBackupPoliciesOptions model - listBackupPoliciesOptionsModel := vpcService.NewListBackupPoliciesOptions() - listBackupPoliciesOptionsModel.SetStart("testString") - listBackupPoliciesOptionsModel.SetLimit(int64(10)) - listBackupPoliciesOptionsModel.SetResourceGroupID("testString") - listBackupPoliciesOptionsModel.SetName("testString") - listBackupPoliciesOptionsModel.SetTag("testString") - listBackupPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listBackupPoliciesOptionsModel).ToNot(BeNil()) - Expect(listBackupPoliciesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listBackupPoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listBackupPoliciesOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listBackupPoliciesOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(listBackupPoliciesOptionsModel.Tag).To(Equal(core.StringPtr("testString"))) - Expect(listBackupPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListBackupPolicyJobsOptions successfully`, func() { - // Construct an instance of the ListBackupPolicyJobsOptions model - backupPolicyID := "testString" - listBackupPolicyJobsOptionsModel := vpcService.NewListBackupPolicyJobsOptions(backupPolicyID) - listBackupPolicyJobsOptionsModel.SetBackupPolicyID("testString") - listBackupPolicyJobsOptionsModel.SetStatus("testString") - listBackupPolicyJobsOptionsModel.SetBackupPolicyPlanID("testString") - listBackupPolicyJobsOptionsModel.SetStart("testString") - listBackupPolicyJobsOptionsModel.SetLimit(int64(10)) - listBackupPolicyJobsOptionsModel.SetSort("name") - listBackupPolicyJobsOptionsModel.SetSourceID("testString") - listBackupPolicyJobsOptionsModel.SetTargetSnapshotsID("testString") - listBackupPolicyJobsOptionsModel.SetTargetSnapshotsCRN("testString") - listBackupPolicyJobsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listBackupPolicyJobsOptionsModel).ToNot(BeNil()) - Expect(listBackupPolicyJobsOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) - Expect(listBackupPolicyJobsOptionsModel.Status).To(Equal(core.StringPtr("testString"))) - Expect(listBackupPolicyJobsOptionsModel.BackupPolicyPlanID).To(Equal(core.StringPtr("testString"))) - Expect(listBackupPolicyJobsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listBackupPolicyJobsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listBackupPolicyJobsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) - Expect(listBackupPolicyJobsOptionsModel.SourceID).To(Equal(core.StringPtr("testString"))) - Expect(listBackupPolicyJobsOptionsModel.TargetSnapshotsID).To(Equal(core.StringPtr("testString"))) - Expect(listBackupPolicyJobsOptionsModel.TargetSnapshotsCRN).To(Equal(core.StringPtr("testString"))) - Expect(listBackupPolicyJobsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListBackupPolicyPlansOptions successfully`, func() { - // Construct an instance of the ListBackupPolicyPlansOptions model - backupPolicyID := "testString" - listBackupPolicyPlansOptionsModel := vpcService.NewListBackupPolicyPlansOptions(backupPolicyID) - listBackupPolicyPlansOptionsModel.SetBackupPolicyID("testString") - listBackupPolicyPlansOptionsModel.SetName("testString") - listBackupPolicyPlansOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listBackupPolicyPlansOptionsModel).ToNot(BeNil()) - Expect(listBackupPolicyPlansOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) - Expect(listBackupPolicyPlansOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(listBackupPolicyPlansOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListBareMetalServerDisksOptions successfully`, func() { - // Construct an instance of the ListBareMetalServerDisksOptions model - bareMetalServerID := "testString" - listBareMetalServerDisksOptionsModel := vpcService.NewListBareMetalServerDisksOptions(bareMetalServerID) - listBareMetalServerDisksOptionsModel.SetBareMetalServerID("testString") - listBareMetalServerDisksOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listBareMetalServerDisksOptionsModel).ToNot(BeNil()) - Expect(listBareMetalServerDisksOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServerDisksOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListBareMetalServerNetworkInterfaceFloatingIpsOptions successfully`, func() { - // Construct an instance of the ListBareMetalServerNetworkInterfaceFloatingIpsOptions model - bareMetalServerID := "testString" - networkInterfaceID := "testString" - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel := vpcService.NewListBareMetalServerNetworkInterfaceFloatingIpsOptions(bareMetalServerID, networkInterfaceID) - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.SetBareMetalServerID("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.SetNetworkInterfaceID("testString") - listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel).ToNot(BeNil()) - Expect(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListBareMetalServerNetworkInterfaceIpsOptions successfully`, func() { - // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model - bareMetalServerID := "testString" - networkInterfaceID := "testString" - listBareMetalServerNetworkInterfaceIpsOptionsModel := vpcService.NewListBareMetalServerNetworkInterfaceIpsOptions(bareMetalServerID, networkInterfaceID) - listBareMetalServerNetworkInterfaceIpsOptionsModel.SetBareMetalServerID("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.SetNetworkInterfaceID("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listBareMetalServerNetworkInterfaceIpsOptionsModel).ToNot(BeNil()) - Expect(listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListBareMetalServerNetworkInterfacesOptions successfully`, func() { - // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model - bareMetalServerID := "testString" - listBareMetalServerNetworkInterfacesOptionsModel := vpcService.NewListBareMetalServerNetworkInterfacesOptions(bareMetalServerID) - listBareMetalServerNetworkInterfacesOptionsModel.SetBareMetalServerID("testString") - listBareMetalServerNetworkInterfacesOptionsModel.SetStart("testString") - listBareMetalServerNetworkInterfacesOptionsModel.SetLimit(int64(10)) - listBareMetalServerNetworkInterfacesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listBareMetalServerNetworkInterfacesOptionsModel).ToNot(BeNil()) - Expect(listBareMetalServerNetworkInterfacesOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServerNetworkInterfacesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServerNetworkInterfacesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listBareMetalServerNetworkInterfacesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListBareMetalServerProfilesOptions successfully`, func() { - // Construct an instance of the ListBareMetalServerProfilesOptions model - listBareMetalServerProfilesOptionsModel := vpcService.NewListBareMetalServerProfilesOptions() - listBareMetalServerProfilesOptionsModel.SetStart("testString") - listBareMetalServerProfilesOptionsModel.SetLimit(int64(10)) - listBareMetalServerProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listBareMetalServerProfilesOptionsModel).ToNot(BeNil()) - Expect(listBareMetalServerProfilesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServerProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listBareMetalServerProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListBareMetalServersOptions successfully`, func() { - // Construct an instance of the ListBareMetalServersOptions model - listBareMetalServersOptionsModel := vpcService.NewListBareMetalServersOptions() - listBareMetalServersOptionsModel.SetStart("testString") - listBareMetalServersOptionsModel.SetLimit(int64(10)) - listBareMetalServersOptionsModel.SetResourceGroupID("testString") - listBareMetalServersOptionsModel.SetName("testString") - listBareMetalServersOptionsModel.SetVPCID("testString") - listBareMetalServersOptionsModel.SetVPCCRN("testString") - listBareMetalServersOptionsModel.SetVPCName("testString") - listBareMetalServersOptionsModel.SetNetworkInterfacesSubnetID("testString") - listBareMetalServersOptionsModel.SetNetworkInterfacesSubnetCRN("testString") - listBareMetalServersOptionsModel.SetNetworkInterfacesSubnetName("testString") - listBareMetalServersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listBareMetalServersOptionsModel).ToNot(BeNil()) - Expect(listBareMetalServersOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listBareMetalServersOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServersOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServersOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServersOptionsModel.VPCCRN).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServersOptionsModel.VPCName).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServersOptionsModel.NetworkInterfacesSubnetID).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServersOptionsModel.NetworkInterfacesSubnetCRN).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServersOptionsModel.NetworkInterfacesSubnetName).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListDedicatedHostDisksOptions successfully`, func() { - // Construct an instance of the ListDedicatedHostDisksOptions model - dedicatedHostID := "testString" - listDedicatedHostDisksOptionsModel := vpcService.NewListDedicatedHostDisksOptions(dedicatedHostID) - listDedicatedHostDisksOptionsModel.SetDedicatedHostID("testString") - listDedicatedHostDisksOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listDedicatedHostDisksOptionsModel).ToNot(BeNil()) - Expect(listDedicatedHostDisksOptionsModel.DedicatedHostID).To(Equal(core.StringPtr("testString"))) - Expect(listDedicatedHostDisksOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListDedicatedHostGroupsOptions successfully`, func() { - // Construct an instance of the ListDedicatedHostGroupsOptions model - listDedicatedHostGroupsOptionsModel := vpcService.NewListDedicatedHostGroupsOptions() - listDedicatedHostGroupsOptionsModel.SetStart("testString") - listDedicatedHostGroupsOptionsModel.SetLimit(int64(10)) - listDedicatedHostGroupsOptionsModel.SetResourceGroupID("testString") - listDedicatedHostGroupsOptionsModel.SetZoneName("testString") - listDedicatedHostGroupsOptionsModel.SetName("testString") - listDedicatedHostGroupsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listDedicatedHostGroupsOptionsModel).ToNot(BeNil()) - Expect(listDedicatedHostGroupsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listDedicatedHostGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listDedicatedHostGroupsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listDedicatedHostGroupsOptionsModel.ZoneName).To(Equal(core.StringPtr("testString"))) - Expect(listDedicatedHostGroupsOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(listDedicatedHostGroupsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListDedicatedHostProfilesOptions successfully`, func() { - // Construct an instance of the ListDedicatedHostProfilesOptions model - listDedicatedHostProfilesOptionsModel := vpcService.NewListDedicatedHostProfilesOptions() - listDedicatedHostProfilesOptionsModel.SetStart("testString") - listDedicatedHostProfilesOptionsModel.SetLimit(int64(10)) - listDedicatedHostProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listDedicatedHostProfilesOptionsModel).ToNot(BeNil()) - Expect(listDedicatedHostProfilesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listDedicatedHostProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listDedicatedHostProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListDedicatedHostsOptions successfully`, func() { - // Construct an instance of the ListDedicatedHostsOptions model - listDedicatedHostsOptionsModel := vpcService.NewListDedicatedHostsOptions() - listDedicatedHostsOptionsModel.SetDedicatedHostGroupID("testString") - listDedicatedHostsOptionsModel.SetStart("testString") - listDedicatedHostsOptionsModel.SetLimit(int64(10)) - listDedicatedHostsOptionsModel.SetResourceGroupID("testString") - listDedicatedHostsOptionsModel.SetZoneName("testString") - listDedicatedHostsOptionsModel.SetName("testString") - listDedicatedHostsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listDedicatedHostsOptionsModel).ToNot(BeNil()) - Expect(listDedicatedHostsOptionsModel.DedicatedHostGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listDedicatedHostsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listDedicatedHostsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listDedicatedHostsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listDedicatedHostsOptionsModel.ZoneName).To(Equal(core.StringPtr("testString"))) - Expect(listDedicatedHostsOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(listDedicatedHostsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListEndpointGatewayIpsOptions successfully`, func() { - // Construct an instance of the ListEndpointGatewayIpsOptions model - endpointGatewayID := "testString" - listEndpointGatewayIpsOptionsModel := vpcService.NewListEndpointGatewayIpsOptions(endpointGatewayID) - listEndpointGatewayIpsOptionsModel.SetEndpointGatewayID("testString") - listEndpointGatewayIpsOptionsModel.SetStart("testString") - listEndpointGatewayIpsOptionsModel.SetLimit(int64(10)) - listEndpointGatewayIpsOptionsModel.SetSort("name") - listEndpointGatewayIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listEndpointGatewayIpsOptionsModel).ToNot(BeNil()) - Expect(listEndpointGatewayIpsOptionsModel.EndpointGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(listEndpointGatewayIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listEndpointGatewayIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listEndpointGatewayIpsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) - Expect(listEndpointGatewayIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListEndpointGatewaysOptions successfully`, func() { - // Construct an instance of the ListEndpointGatewaysOptions model - listEndpointGatewaysOptionsModel := vpcService.NewListEndpointGatewaysOptions() - listEndpointGatewaysOptionsModel.SetName("testString") - listEndpointGatewaysOptionsModel.SetStart("testString") - listEndpointGatewaysOptionsModel.SetLimit(int64(10)) - listEndpointGatewaysOptionsModel.SetResourceGroupID("testString") - listEndpointGatewaysOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listEndpointGatewaysOptionsModel).ToNot(BeNil()) - Expect(listEndpointGatewaysOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(listEndpointGatewaysOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listEndpointGatewaysOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listEndpointGatewaysOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listEndpointGatewaysOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListFloatingIpsOptions successfully`, func() { - // Construct an instance of the ListFloatingIpsOptions model - listFloatingIpsOptionsModel := vpcService.NewListFloatingIpsOptions() - listFloatingIpsOptionsModel.SetStart("testString") - listFloatingIpsOptionsModel.SetLimit(int64(10)) - listFloatingIpsOptionsModel.SetResourceGroupID("testString") - listFloatingIpsOptionsModel.SetSort("name") - listFloatingIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listFloatingIpsOptionsModel).ToNot(BeNil()) - Expect(listFloatingIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listFloatingIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listFloatingIpsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listFloatingIpsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) - Expect(listFloatingIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListFlowLogCollectorsOptions successfully`, func() { - // Construct an instance of the ListFlowLogCollectorsOptions model - listFlowLogCollectorsOptionsModel := vpcService.NewListFlowLogCollectorsOptions() - listFlowLogCollectorsOptionsModel.SetStart("testString") - listFlowLogCollectorsOptionsModel.SetLimit(int64(10)) - listFlowLogCollectorsOptionsModel.SetResourceGroupID("testString") - listFlowLogCollectorsOptionsModel.SetName("testString") - listFlowLogCollectorsOptionsModel.SetVPCID("testString") - listFlowLogCollectorsOptionsModel.SetVPCCRN("testString") - listFlowLogCollectorsOptionsModel.SetVPCName("testString") - listFlowLogCollectorsOptionsModel.SetTargetID("testString") - listFlowLogCollectorsOptionsModel.SetTargetResourceType("instance") - listFlowLogCollectorsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listFlowLogCollectorsOptionsModel).ToNot(BeNil()) - Expect(listFlowLogCollectorsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listFlowLogCollectorsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listFlowLogCollectorsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listFlowLogCollectorsOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(listFlowLogCollectorsOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(listFlowLogCollectorsOptionsModel.VPCCRN).To(Equal(core.StringPtr("testString"))) - Expect(listFlowLogCollectorsOptionsModel.VPCName).To(Equal(core.StringPtr("testString"))) - Expect(listFlowLogCollectorsOptionsModel.TargetID).To(Equal(core.StringPtr("testString"))) - Expect(listFlowLogCollectorsOptionsModel.TargetResourceType).To(Equal(core.StringPtr("instance"))) - Expect(listFlowLogCollectorsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListIkePoliciesOptions successfully`, func() { - // Construct an instance of the ListIkePoliciesOptions model - listIkePoliciesOptionsModel := vpcService.NewListIkePoliciesOptions() - listIkePoliciesOptionsModel.SetStart("testString") - listIkePoliciesOptionsModel.SetLimit(int64(10)) - listIkePoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listIkePoliciesOptionsModel).ToNot(BeNil()) - Expect(listIkePoliciesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listIkePoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listIkePoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListIkePolicyConnectionsOptions successfully`, func() { - // Construct an instance of the ListIkePolicyConnectionsOptions model - id := "testString" - listIkePolicyConnectionsOptionsModel := vpcService.NewListIkePolicyConnectionsOptions(id) - listIkePolicyConnectionsOptionsModel.SetID("testString") - listIkePolicyConnectionsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listIkePolicyConnectionsOptionsModel).ToNot(BeNil()) - Expect(listIkePolicyConnectionsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(listIkePolicyConnectionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListImagesOptions successfully`, func() { - // Construct an instance of the ListImagesOptions model - listImagesOptionsModel := vpcService.NewListImagesOptions() - listImagesOptionsModel.SetStart("testString") - listImagesOptionsModel.SetLimit(int64(10)) - listImagesOptionsModel.SetResourceGroupID("testString") - listImagesOptionsModel.SetName("testString") - listImagesOptionsModel.SetVisibility("private") - listImagesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listImagesOptionsModel).ToNot(BeNil()) - Expect(listImagesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listImagesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listImagesOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listImagesOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(listImagesOptionsModel.Visibility).To(Equal(core.StringPtr("private"))) - Expect(listImagesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListInstanceDisksOptions successfully`, func() { - // Construct an instance of the ListInstanceDisksOptions model - instanceID := "testString" - listInstanceDisksOptionsModel := vpcService.NewListInstanceDisksOptions(instanceID) - listInstanceDisksOptionsModel.SetInstanceID("testString") - listInstanceDisksOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstanceDisksOptionsModel).ToNot(BeNil()) - Expect(listInstanceDisksOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceDisksOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListInstanceGroupManagerActionsOptions successfully`, func() { - // Construct an instance of the ListInstanceGroupManagerActionsOptions model - instanceGroupID := "testString" - instanceGroupManagerID := "testString" - listInstanceGroupManagerActionsOptionsModel := vpcService.NewListInstanceGroupManagerActionsOptions(instanceGroupID, instanceGroupManagerID) - listInstanceGroupManagerActionsOptionsModel.SetInstanceGroupID("testString") - listInstanceGroupManagerActionsOptionsModel.SetInstanceGroupManagerID("testString") - listInstanceGroupManagerActionsOptionsModel.SetStart("testString") - listInstanceGroupManagerActionsOptionsModel.SetLimit(int64(10)) - listInstanceGroupManagerActionsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstanceGroupManagerActionsOptionsModel).ToNot(BeNil()) - Expect(listInstanceGroupManagerActionsOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupManagerActionsOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupManagerActionsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupManagerActionsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listInstanceGroupManagerActionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListInstanceGroupManagerPoliciesOptions successfully`, func() { - // Construct an instance of the ListInstanceGroupManagerPoliciesOptions model - instanceGroupID := "testString" - instanceGroupManagerID := "testString" - listInstanceGroupManagerPoliciesOptionsModel := vpcService.NewListInstanceGroupManagerPoliciesOptions(instanceGroupID, instanceGroupManagerID) - listInstanceGroupManagerPoliciesOptionsModel.SetInstanceGroupID("testString") - listInstanceGroupManagerPoliciesOptionsModel.SetInstanceGroupManagerID("testString") - listInstanceGroupManagerPoliciesOptionsModel.SetStart("testString") - listInstanceGroupManagerPoliciesOptionsModel.SetLimit(int64(10)) - listInstanceGroupManagerPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstanceGroupManagerPoliciesOptionsModel).ToNot(BeNil()) - Expect(listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupManagerPoliciesOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupManagerPoliciesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupManagerPoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listInstanceGroupManagerPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListInstanceGroupManagersOptions successfully`, func() { - // Construct an instance of the ListInstanceGroupManagersOptions model - instanceGroupID := "testString" - listInstanceGroupManagersOptionsModel := vpcService.NewListInstanceGroupManagersOptions(instanceGroupID) - listInstanceGroupManagersOptionsModel.SetInstanceGroupID("testString") - listInstanceGroupManagersOptionsModel.SetStart("testString") - listInstanceGroupManagersOptionsModel.SetLimit(int64(10)) - listInstanceGroupManagersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstanceGroupManagersOptionsModel).ToNot(BeNil()) - Expect(listInstanceGroupManagersOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupManagersOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupManagersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listInstanceGroupManagersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListInstanceGroupMembershipsOptions successfully`, func() { - // Construct an instance of the ListInstanceGroupMembershipsOptions model - instanceGroupID := "testString" - listInstanceGroupMembershipsOptionsModel := vpcService.NewListInstanceGroupMembershipsOptions(instanceGroupID) - listInstanceGroupMembershipsOptionsModel.SetInstanceGroupID("testString") - listInstanceGroupMembershipsOptionsModel.SetStart("testString") - listInstanceGroupMembershipsOptionsModel.SetLimit(int64(10)) - listInstanceGroupMembershipsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstanceGroupMembershipsOptionsModel).ToNot(BeNil()) - Expect(listInstanceGroupMembershipsOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupMembershipsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupMembershipsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listInstanceGroupMembershipsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListInstanceGroupsOptions successfully`, func() { - // Construct an instance of the ListInstanceGroupsOptions model - listInstanceGroupsOptionsModel := vpcService.NewListInstanceGroupsOptions() - listInstanceGroupsOptionsModel.SetStart("testString") - listInstanceGroupsOptionsModel.SetLimit(int64(10)) - listInstanceGroupsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstanceGroupsOptionsModel).ToNot(BeNil()) - Expect(listInstanceGroupsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listInstanceGroupsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListInstanceNetworkInterfaceFloatingIpsOptions successfully`, func() { - // Construct an instance of the ListInstanceNetworkInterfaceFloatingIpsOptions model - instanceID := "testString" - networkInterfaceID := "testString" - listInstanceNetworkInterfaceFloatingIpsOptionsModel := vpcService.NewListInstanceNetworkInterfaceFloatingIpsOptions(instanceID, networkInterfaceID) - listInstanceNetworkInterfaceFloatingIpsOptionsModel.SetInstanceID("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.SetNetworkInterfaceID("testString") - listInstanceNetworkInterfaceFloatingIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstanceNetworkInterfaceFloatingIpsOptionsModel).ToNot(BeNil()) - Expect(listInstanceNetworkInterfaceFloatingIpsOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceNetworkInterfaceFloatingIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListInstanceNetworkInterfaceIpsOptions successfully`, func() { - // Construct an instance of the ListInstanceNetworkInterfaceIpsOptions model - instanceID := "testString" - networkInterfaceID := "testString" - listInstanceNetworkInterfaceIpsOptionsModel := vpcService.NewListInstanceNetworkInterfaceIpsOptions(instanceID, networkInterfaceID) - listInstanceNetworkInterfaceIpsOptionsModel.SetInstanceID("testString") - listInstanceNetworkInterfaceIpsOptionsModel.SetNetworkInterfaceID("testString") - listInstanceNetworkInterfaceIpsOptionsModel.SetStart("testString") - listInstanceNetworkInterfaceIpsOptionsModel.SetLimit(int64(10)) - listInstanceNetworkInterfaceIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstanceNetworkInterfaceIpsOptionsModel).ToNot(BeNil()) - Expect(listInstanceNetworkInterfaceIpsOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceNetworkInterfaceIpsOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceNetworkInterfaceIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceNetworkInterfaceIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listInstanceNetworkInterfaceIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListInstanceNetworkInterfacesOptions successfully`, func() { - // Construct an instance of the ListInstanceNetworkInterfacesOptions model - instanceID := "testString" - listInstanceNetworkInterfacesOptionsModel := vpcService.NewListInstanceNetworkInterfacesOptions(instanceID) - listInstanceNetworkInterfacesOptionsModel.SetInstanceID("testString") - listInstanceNetworkInterfacesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstanceNetworkInterfacesOptionsModel).ToNot(BeNil()) - Expect(listInstanceNetworkInterfacesOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceNetworkInterfacesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListInstanceProfilesOptions successfully`, func() { - // Construct an instance of the ListInstanceProfilesOptions model - listInstanceProfilesOptionsModel := vpcService.NewListInstanceProfilesOptions() - listInstanceProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstanceProfilesOptionsModel).ToNot(BeNil()) - Expect(listInstanceProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListInstanceTemplatesOptions successfully`, func() { - // Construct an instance of the ListInstanceTemplatesOptions model - listInstanceTemplatesOptionsModel := vpcService.NewListInstanceTemplatesOptions() - listInstanceTemplatesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstanceTemplatesOptionsModel).ToNot(BeNil()) - Expect(listInstanceTemplatesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListInstanceVolumeAttachmentsOptions successfully`, func() { - // Construct an instance of the ListInstanceVolumeAttachmentsOptions model - instanceID := "testString" - listInstanceVolumeAttachmentsOptionsModel := vpcService.NewListInstanceVolumeAttachmentsOptions(instanceID) - listInstanceVolumeAttachmentsOptionsModel.SetInstanceID("testString") - listInstanceVolumeAttachmentsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstanceVolumeAttachmentsOptionsModel).ToNot(BeNil()) - Expect(listInstanceVolumeAttachmentsOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceVolumeAttachmentsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListInstancesOptions successfully`, func() { - // Construct an instance of the ListInstancesOptions model - listInstancesOptionsModel := vpcService.NewListInstancesOptions() - listInstancesOptionsModel.SetStart("testString") - listInstancesOptionsModel.SetLimit(int64(10)) - listInstancesOptionsModel.SetResourceGroupID("testString") - listInstancesOptionsModel.SetName("testString") - listInstancesOptionsModel.SetVPCID("testString") - listInstancesOptionsModel.SetVPCCRN("testString") - listInstancesOptionsModel.SetVPCName("testString") - listInstancesOptionsModel.SetDedicatedHostID("testString") - listInstancesOptionsModel.SetDedicatedHostCRN("testString") - listInstancesOptionsModel.SetDedicatedHostName("testString") - listInstancesOptionsModel.SetPlacementGroupID("testString") - listInstancesOptionsModel.SetPlacementGroupCRN("testString") - listInstancesOptionsModel.SetPlacementGroupName("testString") - listInstancesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstancesOptionsModel).ToNot(BeNil()) - Expect(listInstancesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listInstancesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listInstancesOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listInstancesOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(listInstancesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(listInstancesOptionsModel.VPCCRN).To(Equal(core.StringPtr("testString"))) - Expect(listInstancesOptionsModel.VPCName).To(Equal(core.StringPtr("testString"))) - Expect(listInstancesOptionsModel.DedicatedHostID).To(Equal(core.StringPtr("testString"))) - Expect(listInstancesOptionsModel.DedicatedHostCRN).To(Equal(core.StringPtr("testString"))) - Expect(listInstancesOptionsModel.DedicatedHostName).To(Equal(core.StringPtr("testString"))) - Expect(listInstancesOptionsModel.PlacementGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listInstancesOptionsModel.PlacementGroupCRN).To(Equal(core.StringPtr("testString"))) - Expect(listInstancesOptionsModel.PlacementGroupName).To(Equal(core.StringPtr("testString"))) - Expect(listInstancesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListIpsecPoliciesOptions successfully`, func() { - // Construct an instance of the ListIpsecPoliciesOptions model - listIpsecPoliciesOptionsModel := vpcService.NewListIpsecPoliciesOptions() - listIpsecPoliciesOptionsModel.SetStart("testString") - listIpsecPoliciesOptionsModel.SetLimit(int64(10)) - listIpsecPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listIpsecPoliciesOptionsModel).ToNot(BeNil()) - Expect(listIpsecPoliciesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listIpsecPoliciesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listIpsecPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListIpsecPolicyConnectionsOptions successfully`, func() { - // Construct an instance of the ListIpsecPolicyConnectionsOptions model - id := "testString" - listIpsecPolicyConnectionsOptionsModel := vpcService.NewListIpsecPolicyConnectionsOptions(id) - listIpsecPolicyConnectionsOptionsModel.SetID("testString") - listIpsecPolicyConnectionsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listIpsecPolicyConnectionsOptionsModel).ToNot(BeNil()) - Expect(listIpsecPolicyConnectionsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(listIpsecPolicyConnectionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListKeysOptions successfully`, func() { - // Construct an instance of the ListKeysOptions model - listKeysOptionsModel := vpcService.NewListKeysOptions() - listKeysOptionsModel.SetStart("testString") - listKeysOptionsModel.SetLimit(int64(10)) - 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.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListLoadBalancerListenerPoliciesOptions successfully`, func() { - // Construct an instance of the ListLoadBalancerListenerPoliciesOptions model - loadBalancerID := "testString" - listenerID := "testString" - listLoadBalancerListenerPoliciesOptionsModel := vpcService.NewListLoadBalancerListenerPoliciesOptions(loadBalancerID, listenerID) - listLoadBalancerListenerPoliciesOptionsModel.SetLoadBalancerID("testString") - listLoadBalancerListenerPoliciesOptionsModel.SetListenerID("testString") - listLoadBalancerListenerPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listLoadBalancerListenerPoliciesOptionsModel).ToNot(BeNil()) - Expect(listLoadBalancerListenerPoliciesOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(listLoadBalancerListenerPoliciesOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) - Expect(listLoadBalancerListenerPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListLoadBalancerListenerPolicyRulesOptions successfully`, func() { - // Construct an instance of the ListLoadBalancerListenerPolicyRulesOptions model - loadBalancerID := "testString" - listenerID := "testString" - policyID := "testString" - listLoadBalancerListenerPolicyRulesOptionsModel := vpcService.NewListLoadBalancerListenerPolicyRulesOptions(loadBalancerID, listenerID, policyID) - listLoadBalancerListenerPolicyRulesOptionsModel.SetLoadBalancerID("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.SetListenerID("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.SetPolicyID("testString") - listLoadBalancerListenerPolicyRulesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listLoadBalancerListenerPolicyRulesOptionsModel).ToNot(BeNil()) - Expect(listLoadBalancerListenerPolicyRulesOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(listLoadBalancerListenerPolicyRulesOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) - Expect(listLoadBalancerListenerPolicyRulesOptionsModel.PolicyID).To(Equal(core.StringPtr("testString"))) - Expect(listLoadBalancerListenerPolicyRulesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListLoadBalancerListenersOptions successfully`, func() { - // Construct an instance of the ListLoadBalancerListenersOptions model - loadBalancerID := "testString" - listLoadBalancerListenersOptionsModel := vpcService.NewListLoadBalancerListenersOptions(loadBalancerID) - listLoadBalancerListenersOptionsModel.SetLoadBalancerID("testString") - listLoadBalancerListenersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listLoadBalancerListenersOptionsModel).ToNot(BeNil()) - Expect(listLoadBalancerListenersOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(listLoadBalancerListenersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListLoadBalancerPoolMembersOptions successfully`, func() { - // Construct an instance of the ListLoadBalancerPoolMembersOptions model - loadBalancerID := "testString" - poolID := "testString" - listLoadBalancerPoolMembersOptionsModel := vpcService.NewListLoadBalancerPoolMembersOptions(loadBalancerID, poolID) - listLoadBalancerPoolMembersOptionsModel.SetLoadBalancerID("testString") - listLoadBalancerPoolMembersOptionsModel.SetPoolID("testString") - listLoadBalancerPoolMembersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listLoadBalancerPoolMembersOptionsModel).ToNot(BeNil()) - Expect(listLoadBalancerPoolMembersOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(listLoadBalancerPoolMembersOptionsModel.PoolID).To(Equal(core.StringPtr("testString"))) - Expect(listLoadBalancerPoolMembersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListLoadBalancerPoolsOptions successfully`, func() { - // Construct an instance of the ListLoadBalancerPoolsOptions model - loadBalancerID := "testString" - listLoadBalancerPoolsOptionsModel := vpcService.NewListLoadBalancerPoolsOptions(loadBalancerID) - listLoadBalancerPoolsOptionsModel.SetLoadBalancerID("testString") - listLoadBalancerPoolsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listLoadBalancerPoolsOptionsModel).ToNot(BeNil()) - Expect(listLoadBalancerPoolsOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(listLoadBalancerPoolsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListLoadBalancerProfilesOptions successfully`, func() { - // Construct an instance of the ListLoadBalancerProfilesOptions model - listLoadBalancerProfilesOptionsModel := vpcService.NewListLoadBalancerProfilesOptions() - listLoadBalancerProfilesOptionsModel.SetStart("testString") - listLoadBalancerProfilesOptionsModel.SetLimit(int64(10)) - listLoadBalancerProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listLoadBalancerProfilesOptionsModel).ToNot(BeNil()) - Expect(listLoadBalancerProfilesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listLoadBalancerProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listLoadBalancerProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListLoadBalancersOptions successfully`, func() { - // Construct an instance of the ListLoadBalancersOptions model - listLoadBalancersOptionsModel := vpcService.NewListLoadBalancersOptions() - listLoadBalancersOptionsModel.SetStart("testString") - listLoadBalancersOptionsModel.SetLimit(int64(10)) - listLoadBalancersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listLoadBalancersOptionsModel).ToNot(BeNil()) - Expect(listLoadBalancersOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listLoadBalancersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listLoadBalancersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListNetworkACLRulesOptions successfully`, func() { - // Construct an instance of the ListNetworkACLRulesOptions model - networkACLID := "testString" - listNetworkACLRulesOptionsModel := vpcService.NewListNetworkACLRulesOptions(networkACLID) - listNetworkACLRulesOptionsModel.SetNetworkACLID("testString") - listNetworkACLRulesOptionsModel.SetStart("testString") - listNetworkACLRulesOptionsModel.SetLimit(int64(10)) - listNetworkACLRulesOptionsModel.SetDirection("inbound") - listNetworkACLRulesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listNetworkACLRulesOptionsModel).ToNot(BeNil()) - Expect(listNetworkACLRulesOptionsModel.NetworkACLID).To(Equal(core.StringPtr("testString"))) - Expect(listNetworkACLRulesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listNetworkACLRulesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listNetworkACLRulesOptionsModel.Direction).To(Equal(core.StringPtr("inbound"))) - Expect(listNetworkACLRulesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListNetworkAclsOptions successfully`, func() { - // Construct an instance of the ListNetworkAclsOptions model - listNetworkAclsOptionsModel := vpcService.NewListNetworkAclsOptions() - listNetworkAclsOptionsModel.SetStart("testString") - listNetworkAclsOptionsModel.SetLimit(int64(10)) - listNetworkAclsOptionsModel.SetResourceGroupID("testString") - listNetworkAclsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listNetworkAclsOptionsModel).ToNot(BeNil()) - Expect(listNetworkAclsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listNetworkAclsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listNetworkAclsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listNetworkAclsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListOperatingSystemsOptions successfully`, func() { - // Construct an instance of the ListOperatingSystemsOptions model - listOperatingSystemsOptionsModel := vpcService.NewListOperatingSystemsOptions() - listOperatingSystemsOptionsModel.SetStart("testString") - listOperatingSystemsOptionsModel.SetLimit(int64(10)) - listOperatingSystemsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listOperatingSystemsOptionsModel).ToNot(BeNil()) - Expect(listOperatingSystemsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listOperatingSystemsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listOperatingSystemsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListPlacementGroupsOptions successfully`, func() { - // Construct an instance of the ListPlacementGroupsOptions model - listPlacementGroupsOptionsModel := vpcService.NewListPlacementGroupsOptions() - listPlacementGroupsOptionsModel.SetStart("testString") - listPlacementGroupsOptionsModel.SetLimit(int64(10)) - listPlacementGroupsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listPlacementGroupsOptionsModel).ToNot(BeNil()) - Expect(listPlacementGroupsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listPlacementGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listPlacementGroupsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListPublicGatewaysOptions successfully`, func() { - // Construct an instance of the ListPublicGatewaysOptions model - listPublicGatewaysOptionsModel := vpcService.NewListPublicGatewaysOptions() - listPublicGatewaysOptionsModel.SetStart("testString") - listPublicGatewaysOptionsModel.SetLimit(int64(10)) - listPublicGatewaysOptionsModel.SetResourceGroupID("testString") - listPublicGatewaysOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listPublicGatewaysOptionsModel).ToNot(BeNil()) - Expect(listPublicGatewaysOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listPublicGatewaysOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listPublicGatewaysOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listPublicGatewaysOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListRegionZonesOptions successfully`, func() { - // Construct an instance of the ListRegionZonesOptions model - regionName := "testString" - listRegionZonesOptionsModel := vpcService.NewListRegionZonesOptions(regionName) - listRegionZonesOptionsModel.SetRegionName("testString") - listRegionZonesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listRegionZonesOptionsModel).ToNot(BeNil()) - Expect(listRegionZonesOptionsModel.RegionName).To(Equal(core.StringPtr("testString"))) - Expect(listRegionZonesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListRegionsOptions successfully`, func() { - // Construct an instance of the ListRegionsOptions model - listRegionsOptionsModel := vpcService.NewListRegionsOptions() - listRegionsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listRegionsOptionsModel).ToNot(BeNil()) - Expect(listRegionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListSecurityGroupRulesOptions successfully`, func() { - // Construct an instance of the ListSecurityGroupRulesOptions model - securityGroupID := "testString" - listSecurityGroupRulesOptionsModel := vpcService.NewListSecurityGroupRulesOptions(securityGroupID) - listSecurityGroupRulesOptionsModel.SetSecurityGroupID("testString") - listSecurityGroupRulesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listSecurityGroupRulesOptionsModel).ToNot(BeNil()) - Expect(listSecurityGroupRulesOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listSecurityGroupRulesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListSecurityGroupTargetsOptions successfully`, func() { - // Construct an instance of the ListSecurityGroupTargetsOptions model - securityGroupID := "testString" - listSecurityGroupTargetsOptionsModel := vpcService.NewListSecurityGroupTargetsOptions(securityGroupID) - listSecurityGroupTargetsOptionsModel.SetSecurityGroupID("testString") - listSecurityGroupTargetsOptionsModel.SetStart("testString") - listSecurityGroupTargetsOptionsModel.SetLimit(int64(10)) - listSecurityGroupTargetsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listSecurityGroupTargetsOptionsModel).ToNot(BeNil()) - Expect(listSecurityGroupTargetsOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listSecurityGroupTargetsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listSecurityGroupTargetsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listSecurityGroupTargetsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListSecurityGroupsOptions successfully`, func() { - // Construct an instance of the ListSecurityGroupsOptions model - listSecurityGroupsOptionsModel := vpcService.NewListSecurityGroupsOptions() - listSecurityGroupsOptionsModel.SetStart("testString") - listSecurityGroupsOptionsModel.SetLimit(int64(10)) - listSecurityGroupsOptionsModel.SetResourceGroupID("testString") - listSecurityGroupsOptionsModel.SetVPCID("testString") - listSecurityGroupsOptionsModel.SetVPCCRN("testString") - listSecurityGroupsOptionsModel.SetVPCName("testString") - listSecurityGroupsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listSecurityGroupsOptionsModel).ToNot(BeNil()) - Expect(listSecurityGroupsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listSecurityGroupsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listSecurityGroupsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listSecurityGroupsOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(listSecurityGroupsOptionsModel.VPCCRN).To(Equal(core.StringPtr("testString"))) - Expect(listSecurityGroupsOptionsModel.VPCName).To(Equal(core.StringPtr("testString"))) - Expect(listSecurityGroupsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListSnapshotsOptions successfully`, func() { - // Construct an instance of the ListSnapshotsOptions model - listSnapshotsOptionsModel := vpcService.NewListSnapshotsOptions() - listSnapshotsOptionsModel.SetStart("testString") - listSnapshotsOptionsModel.SetLimit(int64(10)) - listSnapshotsOptionsModel.SetTag("testString") - listSnapshotsOptionsModel.SetResourceGroupID("testString") - listSnapshotsOptionsModel.SetName("testString") - listSnapshotsOptionsModel.SetSourceVolumeID("testString") - listSnapshotsOptionsModel.SetSourceVolumeCRN("testString") - listSnapshotsOptionsModel.SetSourceImageID("testString") - listSnapshotsOptionsModel.SetSourceImageCRN("testString") - listSnapshotsOptionsModel.SetSort("name") - listSnapshotsOptionsModel.SetBackupPolicyPlanID("testString") - listSnapshotsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listSnapshotsOptionsModel).ToNot(BeNil()) - Expect(listSnapshotsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listSnapshotsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listSnapshotsOptionsModel.Tag).To(Equal(core.StringPtr("testString"))) - Expect(listSnapshotsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listSnapshotsOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(listSnapshotsOptionsModel.SourceVolumeID).To(Equal(core.StringPtr("testString"))) - Expect(listSnapshotsOptionsModel.SourceVolumeCRN).To(Equal(core.StringPtr("testString"))) - Expect(listSnapshotsOptionsModel.SourceImageID).To(Equal(core.StringPtr("testString"))) - Expect(listSnapshotsOptionsModel.SourceImageCRN).To(Equal(core.StringPtr("testString"))) - Expect(listSnapshotsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) - Expect(listSnapshotsOptionsModel.BackupPolicyPlanID).To(Equal(core.StringPtr("testString"))) - Expect(listSnapshotsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListSubnetReservedIpsOptions successfully`, func() { - // Construct an instance of the ListSubnetReservedIpsOptions model - subnetID := "testString" - listSubnetReservedIpsOptionsModel := vpcService.NewListSubnetReservedIpsOptions(subnetID) - listSubnetReservedIpsOptionsModel.SetSubnetID("testString") - listSubnetReservedIpsOptionsModel.SetStart("testString") - listSubnetReservedIpsOptionsModel.SetLimit(int64(10)) - listSubnetReservedIpsOptionsModel.SetSort("name") - listSubnetReservedIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listSubnetReservedIpsOptionsModel).ToNot(BeNil()) - Expect(listSubnetReservedIpsOptionsModel.SubnetID).To(Equal(core.StringPtr("testString"))) - Expect(listSubnetReservedIpsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listSubnetReservedIpsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listSubnetReservedIpsOptionsModel.Sort).To(Equal(core.StringPtr("name"))) - Expect(listSubnetReservedIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListSubnetsOptions successfully`, func() { - // Construct an instance of the ListSubnetsOptions model - listSubnetsOptionsModel := vpcService.NewListSubnetsOptions() - listSubnetsOptionsModel.SetStart("testString") - listSubnetsOptionsModel.SetLimit(int64(10)) - listSubnetsOptionsModel.SetResourceGroupID("testString") - listSubnetsOptionsModel.SetRoutingTableID("testString") - listSubnetsOptionsModel.SetRoutingTableName("testString") - listSubnetsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listSubnetsOptionsModel).ToNot(BeNil()) - Expect(listSubnetsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listSubnetsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listSubnetsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listSubnetsOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) - Expect(listSubnetsOptionsModel.RoutingTableName).To(Equal(core.StringPtr("testString"))) - Expect(listSubnetsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListVolumeProfilesOptions successfully`, func() { - // Construct an instance of the ListVolumeProfilesOptions model - listVolumeProfilesOptionsModel := vpcService.NewListVolumeProfilesOptions() - listVolumeProfilesOptionsModel.SetStart("testString") - listVolumeProfilesOptionsModel.SetLimit(int64(10)) - listVolumeProfilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listVolumeProfilesOptionsModel).ToNot(BeNil()) - Expect(listVolumeProfilesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVolumeProfilesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listVolumeProfilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListVolumesOptions successfully`, func() { - // Construct an instance of the ListVolumesOptions model - listVolumesOptionsModel := vpcService.NewListVolumesOptions() - listVolumesOptionsModel.SetStart("testString") - listVolumesOptionsModel.SetLimit(int64(10)) - listVolumesOptionsModel.SetName("testString") - listVolumesOptionsModel.SetZoneName("testString") - listVolumesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listVolumesOptionsModel).ToNot(BeNil()) - Expect(listVolumesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVolumesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listVolumesOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(listVolumesOptionsModel.ZoneName).To(Equal(core.StringPtr("testString"))) - Expect(listVolumesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListVPCAddressPrefixesOptions successfully`, func() { - // Construct an instance of the ListVPCAddressPrefixesOptions model - vpcID := "testString" - listVPCAddressPrefixesOptionsModel := vpcService.NewListVPCAddressPrefixesOptions(vpcID) - listVPCAddressPrefixesOptionsModel.SetVPCID("testString") - listVPCAddressPrefixesOptionsModel.SetStart("testString") - listVPCAddressPrefixesOptionsModel.SetLimit(int64(10)) - listVPCAddressPrefixesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listVPCAddressPrefixesOptionsModel).ToNot(BeNil()) - Expect(listVPCAddressPrefixesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(listVPCAddressPrefixesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPCAddressPrefixesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listVPCAddressPrefixesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListVPCRoutesOptions successfully`, func() { - // Construct an instance of the ListVPCRoutesOptions model - vpcID := "testString" - listVPCRoutesOptionsModel := vpcService.NewListVPCRoutesOptions(vpcID) - listVPCRoutesOptionsModel.SetVPCID("testString") - listVPCRoutesOptionsModel.SetZoneName("testString") - listVPCRoutesOptionsModel.SetStart("testString") - listVPCRoutesOptionsModel.SetLimit(int64(10)) - listVPCRoutesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listVPCRoutesOptionsModel).ToNot(BeNil()) - Expect(listVPCRoutesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(listVPCRoutesOptionsModel.ZoneName).To(Equal(core.StringPtr("testString"))) - Expect(listVPCRoutesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPCRoutesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listVPCRoutesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListVPCRoutingTableRoutesOptions successfully`, func() { - // Construct an instance of the ListVPCRoutingTableRoutesOptions model - vpcID := "testString" - routingTableID := "testString" - listVPCRoutingTableRoutesOptionsModel := vpcService.NewListVPCRoutingTableRoutesOptions(vpcID, routingTableID) - listVPCRoutingTableRoutesOptionsModel.SetVPCID("testString") - listVPCRoutingTableRoutesOptionsModel.SetRoutingTableID("testString") - listVPCRoutingTableRoutesOptionsModel.SetStart("testString") - listVPCRoutingTableRoutesOptionsModel.SetLimit(int64(10)) - listVPCRoutingTableRoutesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listVPCRoutingTableRoutesOptionsModel).ToNot(BeNil()) - Expect(listVPCRoutingTableRoutesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(listVPCRoutingTableRoutesOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) - Expect(listVPCRoutingTableRoutesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPCRoutingTableRoutesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listVPCRoutingTableRoutesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListVPCRoutingTablesOptions successfully`, func() { - // Construct an instance of the ListVPCRoutingTablesOptions model - vpcID := "testString" - listVPCRoutingTablesOptionsModel := vpcService.NewListVPCRoutingTablesOptions(vpcID) - listVPCRoutingTablesOptionsModel.SetVPCID("testString") - listVPCRoutingTablesOptionsModel.SetStart("testString") - listVPCRoutingTablesOptionsModel.SetLimit(int64(10)) - listVPCRoutingTablesOptionsModel.SetIsDefault(true) - listVPCRoutingTablesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listVPCRoutingTablesOptionsModel).ToNot(BeNil()) - Expect(listVPCRoutingTablesOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(listVPCRoutingTablesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPCRoutingTablesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listVPCRoutingTablesOptionsModel.IsDefault).To(Equal(core.BoolPtr(true))) - Expect(listVPCRoutingTablesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListVpcsOptions successfully`, func() { - // Construct an instance of the ListVpcsOptions model - listVpcsOptionsModel := vpcService.NewListVpcsOptions() - listVpcsOptionsModel.SetStart("testString") - listVpcsOptionsModel.SetLimit(int64(10)) - listVpcsOptionsModel.SetResourceGroupID("testString") - listVpcsOptionsModel.SetClassicAccess(true) - listVpcsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listVpcsOptionsModel).ToNot(BeNil()) - Expect(listVpcsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVpcsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listVpcsOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listVpcsOptionsModel.ClassicAccess).To(Equal(core.BoolPtr(true))) - Expect(listVpcsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListVPNGatewayConnectionLocalCIDRsOptions successfully`, func() { - // Construct an instance of the ListVPNGatewayConnectionLocalCIDRsOptions model - vpnGatewayID := "testString" - id := "testString" - listVPNGatewayConnectionLocalCIDRsOptionsModel := vpcService.NewListVPNGatewayConnectionLocalCIDRsOptions(vpnGatewayID, id) - listVPNGatewayConnectionLocalCIDRsOptionsModel.SetVPNGatewayID("testString") - listVPNGatewayConnectionLocalCIDRsOptionsModel.SetID("testString") - listVPNGatewayConnectionLocalCIDRsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listVPNGatewayConnectionLocalCIDRsOptionsModel).ToNot(BeNil()) - Expect(listVPNGatewayConnectionLocalCIDRsOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(listVPNGatewayConnectionLocalCIDRsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(listVPNGatewayConnectionLocalCIDRsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListVPNGatewayConnectionPeerCIDRsOptions successfully`, func() { - // Construct an instance of the ListVPNGatewayConnectionPeerCIDRsOptions model - vpnGatewayID := "testString" - id := "testString" - listVPNGatewayConnectionPeerCIDRsOptionsModel := vpcService.NewListVPNGatewayConnectionPeerCIDRsOptions(vpnGatewayID, id) - listVPNGatewayConnectionPeerCIDRsOptionsModel.SetVPNGatewayID("testString") - listVPNGatewayConnectionPeerCIDRsOptionsModel.SetID("testString") - listVPNGatewayConnectionPeerCIDRsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listVPNGatewayConnectionPeerCIDRsOptionsModel).ToNot(BeNil()) - Expect(listVPNGatewayConnectionPeerCIDRsOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(listVPNGatewayConnectionPeerCIDRsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(listVPNGatewayConnectionPeerCIDRsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListVPNGatewayConnectionsOptions successfully`, func() { - // Construct an instance of the ListVPNGatewayConnectionsOptions model - vpnGatewayID := "testString" - listVPNGatewayConnectionsOptionsModel := vpcService.NewListVPNGatewayConnectionsOptions(vpnGatewayID) - listVPNGatewayConnectionsOptionsModel.SetVPNGatewayID("testString") - listVPNGatewayConnectionsOptionsModel.SetStatus("testString") - listVPNGatewayConnectionsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listVPNGatewayConnectionsOptionsModel).ToNot(BeNil()) - Expect(listVPNGatewayConnectionsOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(listVPNGatewayConnectionsOptionsModel.Status).To(Equal(core.StringPtr("testString"))) - Expect(listVPNGatewayConnectionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListVPNGatewaysOptions successfully`, func() { - // Construct an instance of the ListVPNGatewaysOptions model - listVPNGatewaysOptionsModel := vpcService.NewListVPNGatewaysOptions() - listVPNGatewaysOptionsModel.SetStart("testString") - listVPNGatewaysOptionsModel.SetLimit(int64(10)) - listVPNGatewaysOptionsModel.SetResourceGroupID("testString") - listVPNGatewaysOptionsModel.SetSort("name") - listVPNGatewaysOptionsModel.SetMode("route") - listVPNGatewaysOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listVPNGatewaysOptionsModel).ToNot(BeNil()) - Expect(listVPNGatewaysOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPNGatewaysOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listVPNGatewaysOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listVPNGatewaysOptionsModel.Sort).To(Equal(core.StringPtr("name"))) - Expect(listVPNGatewaysOptionsModel.Mode).To(Equal(core.StringPtr("route"))) - Expect(listVPNGatewaysOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListVPNServerClientsOptions successfully`, func() { - // Construct an instance of the ListVPNServerClientsOptions model - vpnServerID := "testString" - listVPNServerClientsOptionsModel := vpcService.NewListVPNServerClientsOptions(vpnServerID) - listVPNServerClientsOptionsModel.SetVPNServerID("testString") - listVPNServerClientsOptionsModel.SetStart("testString") - listVPNServerClientsOptionsModel.SetLimit(int64(10)) - listVPNServerClientsOptionsModel.SetSort("created_at") - listVPNServerClientsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listVPNServerClientsOptionsModel).ToNot(BeNil()) - Expect(listVPNServerClientsOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) - Expect(listVPNServerClientsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPNServerClientsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listVPNServerClientsOptionsModel.Sort).To(Equal(core.StringPtr("created_at"))) - Expect(listVPNServerClientsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListVPNServerRoutesOptions successfully`, func() { - // Construct an instance of the ListVPNServerRoutesOptions model - vpnServerID := "testString" - listVPNServerRoutesOptionsModel := vpcService.NewListVPNServerRoutesOptions(vpnServerID) - listVPNServerRoutesOptionsModel.SetVPNServerID("testString") - listVPNServerRoutesOptionsModel.SetStart("testString") - listVPNServerRoutesOptionsModel.SetLimit(int64(10)) - listVPNServerRoutesOptionsModel.SetSort("name") - listVPNServerRoutesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listVPNServerRoutesOptionsModel).ToNot(BeNil()) - Expect(listVPNServerRoutesOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) - Expect(listVPNServerRoutesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPNServerRoutesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listVPNServerRoutesOptionsModel.Sort).To(Equal(core.StringPtr("name"))) - Expect(listVPNServerRoutesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListVPNServersOptions successfully`, func() { - // Construct an instance of the ListVPNServersOptions model - listVPNServersOptionsModel := vpcService.NewListVPNServersOptions() - listVPNServersOptionsModel.SetName("testString") - listVPNServersOptionsModel.SetStart("testString") - listVPNServersOptionsModel.SetLimit(int64(10)) - listVPNServersOptionsModel.SetResourceGroupID("testString") - listVPNServersOptionsModel.SetSort("name") - listVPNServersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listVPNServersOptionsModel).ToNot(BeNil()) - Expect(listVPNServersOptionsModel.Name).To(Equal(core.StringPtr("testString"))) - Expect(listVPNServersOptionsModel.Start).To(Equal(core.StringPtr("testString"))) - Expect(listVPNServersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) - Expect(listVPNServersOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(listVPNServersOptionsModel.Sort).To(Equal(core.StringPtr("name"))) - Expect(listVPNServersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewLoadBalancerListenerHTTPSRedirectPrototype successfully`, func() { - httpStatusCode := int64(301) - var listener vpcv1.LoadBalancerListenerIdentityIntf = nil - _, err := vpcService.NewLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode, listener) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewLoadBalancerListenerPolicyPrototype successfully`, func() { - action := "forward" - priority := int64(5) - _model, err := vpcService.NewLoadBalancerListenerPolicyPrototype(action, priority) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerListenerPolicyRulePrototype successfully`, func() { - condition := "contains" - typeVar := "body" - value := "testString" - _model, err := vpcService.NewLoadBalancerListenerPolicyRulePrototype(condition, typeVar, value) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerListenerPrototypeLoadBalancerContext successfully`, func() { - protocol := "http" - _model, err := vpcService.NewLoadBalancerListenerPrototypeLoadBalancerContext(protocol) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerPoolHealthMonitorPatch successfully`, func() { - delay := int64(5) - maxRetries := int64(2) - timeout := int64(2) - typeVar := "http" - _model, err := vpcService.NewLoadBalancerPoolHealthMonitorPatch(delay, maxRetries, timeout, typeVar) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerPoolHealthMonitorPrototype successfully`, func() { - delay := int64(5) - maxRetries := int64(2) - timeout := int64(2) - typeVar := "http" - _model, err := vpcService.NewLoadBalancerPoolHealthMonitorPrototype(delay, maxRetries, timeout, typeVar) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerPoolIdentityByName successfully`, func() { - name := "my-load-balancer-pool" - _model, err := vpcService.NewLoadBalancerPoolIdentityByName(name) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerPoolMemberPrototype successfully`, func() { - port := int64(80) - var target vpcv1.LoadBalancerPoolMemberTargetPrototypeIntf = nil - _, err := vpcService.NewLoadBalancerPoolMemberPrototype(port, target) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewLoadBalancerPoolPrototype successfully`, func() { - algorithm := "least_connections" - var healthMonitor *vpcv1.LoadBalancerPoolHealthMonitorPrototype = nil - protocol := "http" - _, err := vpcService.NewLoadBalancerPoolPrototype(algorithm, healthMonitor, protocol) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewLoadBalancerPoolSessionPersistencePrototype successfully`, func() { - typeVar := "app_cookie" - _model, err := vpcService.NewLoadBalancerPoolSessionPersistencePrototype(typeVar) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkInterfacePrototype successfully`, func() { - var subnet vpcv1.SubnetIdentityIntf = nil - _, err := vpcService.NewNetworkInterfacePrototype(subnet) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions successfully`, func() { - // Construct an instance of the RemoveBareMetalServerNetworkInterfaceFloatingIPOptions model - bareMetalServerID := "testString" - networkInterfaceID := "testString" - id := "testString" - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel := vpcService.NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID, networkInterfaceID, id) - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetBareMetalServerID("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetNetworkInterfaceID("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetID("testString") - removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) - Expect(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) - Expect(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(removeBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewRemoveEndpointGatewayIPOptions successfully`, func() { - // Construct an instance of the RemoveEndpointGatewayIPOptions model - endpointGatewayID := "testString" - id := "testString" - removeEndpointGatewayIPOptionsModel := vpcService.NewRemoveEndpointGatewayIPOptions(endpointGatewayID, id) - removeEndpointGatewayIPOptionsModel.SetEndpointGatewayID("testString") - removeEndpointGatewayIPOptionsModel.SetID("testString") - removeEndpointGatewayIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(removeEndpointGatewayIPOptionsModel).ToNot(BeNil()) - Expect(removeEndpointGatewayIPOptionsModel.EndpointGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(removeEndpointGatewayIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(removeEndpointGatewayIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewRemoveInstanceNetworkInterfaceFloatingIPOptions successfully`, func() { - // Construct an instance of the RemoveInstanceNetworkInterfaceFloatingIPOptions model - instanceID := "testString" - networkInterfaceID := "testString" - id := "testString" - removeInstanceNetworkInterfaceFloatingIPOptionsModel := vpcService.NewRemoveInstanceNetworkInterfaceFloatingIPOptions(instanceID, networkInterfaceID, id) - removeInstanceNetworkInterfaceFloatingIPOptionsModel.SetInstanceID("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.SetNetworkInterfaceID("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.SetID("testString") - removeInstanceNetworkInterfaceFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(removeInstanceNetworkInterfaceFloatingIPOptionsModel).ToNot(BeNil()) - Expect(removeInstanceNetworkInterfaceFloatingIPOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(removeInstanceNetworkInterfaceFloatingIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) - Expect(removeInstanceNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(removeInstanceNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewRemoveVPNGatewayConnectionLocalCIDROptions successfully`, func() { - // Construct an instance of the RemoveVPNGatewayConnectionLocalCIDROptions model - vpnGatewayID := "testString" - id := "testString" - cidrPrefix := "testString" - prefixLength := "testString" - removeVPNGatewayConnectionLocalCIDROptionsModel := vpcService.NewRemoveVPNGatewayConnectionLocalCIDROptions(vpnGatewayID, id, cidrPrefix, prefixLength) - removeVPNGatewayConnectionLocalCIDROptionsModel.SetVPNGatewayID("testString") - removeVPNGatewayConnectionLocalCIDROptionsModel.SetID("testString") - removeVPNGatewayConnectionLocalCIDROptionsModel.SetCIDRPrefix("testString") - removeVPNGatewayConnectionLocalCIDROptionsModel.SetPrefixLength("testString") - removeVPNGatewayConnectionLocalCIDROptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(removeVPNGatewayConnectionLocalCIDROptionsModel).ToNot(BeNil()) - Expect(removeVPNGatewayConnectionLocalCIDROptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(removeVPNGatewayConnectionLocalCIDROptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(removeVPNGatewayConnectionLocalCIDROptionsModel.CIDRPrefix).To(Equal(core.StringPtr("testString"))) - Expect(removeVPNGatewayConnectionLocalCIDROptionsModel.PrefixLength).To(Equal(core.StringPtr("testString"))) - Expect(removeVPNGatewayConnectionLocalCIDROptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewRemoveVPNGatewayConnectionPeerCIDROptions successfully`, func() { - // Construct an instance of the RemoveVPNGatewayConnectionPeerCIDROptions model - vpnGatewayID := "testString" - id := "testString" - cidrPrefix := "testString" - prefixLength := "testString" - removeVPNGatewayConnectionPeerCIDROptionsModel := vpcService.NewRemoveVPNGatewayConnectionPeerCIDROptions(vpnGatewayID, id, cidrPrefix, prefixLength) - removeVPNGatewayConnectionPeerCIDROptionsModel.SetVPNGatewayID("testString") - removeVPNGatewayConnectionPeerCIDROptionsModel.SetID("testString") - removeVPNGatewayConnectionPeerCIDROptionsModel.SetCIDRPrefix("testString") - removeVPNGatewayConnectionPeerCIDROptionsModel.SetPrefixLength("testString") - removeVPNGatewayConnectionPeerCIDROptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(removeVPNGatewayConnectionPeerCIDROptionsModel).ToNot(BeNil()) - Expect(removeVPNGatewayConnectionPeerCIDROptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(removeVPNGatewayConnectionPeerCIDROptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(removeVPNGatewayConnectionPeerCIDROptionsModel.CIDRPrefix).To(Equal(core.StringPtr("testString"))) - Expect(removeVPNGatewayConnectionPeerCIDROptionsModel.PrefixLength).To(Equal(core.StringPtr("testString"))) - Expect(removeVPNGatewayConnectionPeerCIDROptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewReplaceLoadBalancerPoolMembersOptions successfully`, func() { - // Construct an instance of the LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID model - loadBalancerPoolMemberTargetPrototypeModel := new(vpcv1.LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - Expect(loadBalancerPoolMemberTargetPrototypeModel).ToNot(BeNil()) - loadBalancerPoolMemberTargetPrototypeModel.ID = core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a") - Expect(loadBalancerPoolMemberTargetPrototypeModel.ID).To(Equal(core.StringPtr("1e09281b-f177-46fb-baf1-bc152b2e391a"))) - - // Construct an instance of the LoadBalancerPoolMemberPrototype model - loadBalancerPoolMemberPrototypeModel := new(vpcv1.LoadBalancerPoolMemberPrototype) - Expect(loadBalancerPoolMemberPrototypeModel).ToNot(BeNil()) - loadBalancerPoolMemberPrototypeModel.Port = core.Int64Ptr(int64(80)) - loadBalancerPoolMemberPrototypeModel.Target = loadBalancerPoolMemberTargetPrototypeModel - loadBalancerPoolMemberPrototypeModel.Weight = core.Int64Ptr(int64(50)) - Expect(loadBalancerPoolMemberPrototypeModel.Port).To(Equal(core.Int64Ptr(int64(80)))) - Expect(loadBalancerPoolMemberPrototypeModel.Target).To(Equal(loadBalancerPoolMemberTargetPrototypeModel)) - Expect(loadBalancerPoolMemberPrototypeModel.Weight).To(Equal(core.Int64Ptr(int64(50)))) - - // Construct an instance of the ReplaceLoadBalancerPoolMembersOptions model - loadBalancerID := "testString" - poolID := "testString" - replaceLoadBalancerPoolMembersOptionsMembers := []vpcv1.LoadBalancerPoolMemberPrototype{} - replaceLoadBalancerPoolMembersOptionsModel := vpcService.NewReplaceLoadBalancerPoolMembersOptions(loadBalancerID, poolID, replaceLoadBalancerPoolMembersOptionsMembers) - replaceLoadBalancerPoolMembersOptionsModel.SetLoadBalancerID("testString") - replaceLoadBalancerPoolMembersOptionsModel.SetPoolID("testString") - replaceLoadBalancerPoolMembersOptionsModel.SetMembers([]vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel}) - replaceLoadBalancerPoolMembersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(replaceLoadBalancerPoolMembersOptionsModel).ToNot(BeNil()) - Expect(replaceLoadBalancerPoolMembersOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(replaceLoadBalancerPoolMembersOptionsModel.PoolID).To(Equal(core.StringPtr("testString"))) - Expect(replaceLoadBalancerPoolMembersOptionsModel.Members).To(Equal([]vpcv1.LoadBalancerPoolMemberPrototype{*loadBalancerPoolMemberPrototypeModel})) - Expect(replaceLoadBalancerPoolMembersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewReplaceSubnetNetworkACLOptions successfully`, func() { - // Construct an instance of the NetworkACLIdentityByID model - networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID) - Expect(networkACLIdentityModel).ToNot(BeNil()) - networkACLIdentityModel.ID = core.StringPtr("8ec3e730-f2b0-4855-a1a5-88be30024658") - Expect(networkACLIdentityModel.ID).To(Equal(core.StringPtr("8ec3e730-f2b0-4855-a1a5-88be30024658"))) - - // Construct an instance of the ReplaceSubnetNetworkACLOptions model - id := "testString" - var networkACLIdentity vpcv1.NetworkACLIdentityIntf = nil - replaceSubnetNetworkACLOptionsModel := vpcService.NewReplaceSubnetNetworkACLOptions(id, networkACLIdentity) - replaceSubnetNetworkACLOptionsModel.SetID("testString") - replaceSubnetNetworkACLOptionsModel.SetNetworkACLIdentity(networkACLIdentityModel) - replaceSubnetNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(replaceSubnetNetworkACLOptionsModel).ToNot(BeNil()) - Expect(replaceSubnetNetworkACLOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(replaceSubnetNetworkACLOptionsModel.NetworkACLIdentity).To(Equal(networkACLIdentityModel)) - Expect(replaceSubnetNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewReplaceSubnetRoutingTableOptions successfully`, func() { - // Construct an instance of the RoutingTableIdentityByID model - routingTableIdentityModel := new(vpcv1.RoutingTableIdentityByID) - Expect(routingTableIdentityModel).ToNot(BeNil()) - routingTableIdentityModel.ID = core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840") - Expect(routingTableIdentityModel.ID).To(Equal(core.StringPtr("6885e83f-03b2-4603-8a86-db2a0f55c840"))) - - // Construct an instance of the ReplaceSubnetRoutingTableOptions model - id := "testString" - var routingTableIdentity vpcv1.RoutingTableIdentityIntf = nil - replaceSubnetRoutingTableOptionsModel := vpcService.NewReplaceSubnetRoutingTableOptions(id, routingTableIdentity) - replaceSubnetRoutingTableOptionsModel.SetID("testString") - replaceSubnetRoutingTableOptionsModel.SetRoutingTableIdentity(routingTableIdentityModel) - replaceSubnetRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(replaceSubnetRoutingTableOptionsModel).ToNot(BeNil()) - Expect(replaceSubnetRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(replaceSubnetRoutingTableOptionsModel.RoutingTableIdentity).To(Equal(routingTableIdentityModel)) - Expect(replaceSubnetRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewRestartBareMetalServerOptions successfully`, func() { - // Construct an instance of the RestartBareMetalServerOptions model - id := "testString" - restartBareMetalServerOptionsModel := vpcService.NewRestartBareMetalServerOptions(id) - restartBareMetalServerOptionsModel.SetID("testString") - restartBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(restartBareMetalServerOptionsModel).ToNot(BeNil()) - Expect(restartBareMetalServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(restartBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewRoutePrototype successfully`, func() { - destination := "192.168.3.0/24" - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewRoutePrototype(destination, zone) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewSetSubnetPublicGatewayOptions successfully`, func() { - // Construct an instance of the PublicGatewayIdentityPublicGatewayIdentityByID model - publicGatewayIdentityModel := new(vpcv1.PublicGatewayIdentityPublicGatewayIdentityByID) - Expect(publicGatewayIdentityModel).ToNot(BeNil()) - publicGatewayIdentityModel.ID = core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf") - Expect(publicGatewayIdentityModel.ID).To(Equal(core.StringPtr("a4e28308-8ee7-46ab-8108-9f881f22bdbf"))) - - // Construct an instance of the SetSubnetPublicGatewayOptions model - id := "testString" - var publicGatewayIdentity vpcv1.PublicGatewayIdentityIntf = nil - setSubnetPublicGatewayOptionsModel := vpcService.NewSetSubnetPublicGatewayOptions(id, publicGatewayIdentity) - setSubnetPublicGatewayOptionsModel.SetID("testString") - setSubnetPublicGatewayOptionsModel.SetPublicGatewayIdentity(publicGatewayIdentityModel) - setSubnetPublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(setSubnetPublicGatewayOptionsModel).ToNot(BeNil()) - Expect(setSubnetPublicGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(setSubnetPublicGatewayOptionsModel.PublicGatewayIdentity).To(Equal(publicGatewayIdentityModel)) - Expect(setSubnetPublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewStartBareMetalServerOptions successfully`, func() { - // Construct an instance of the StartBareMetalServerOptions model - id := "testString" - startBareMetalServerOptionsModel := vpcService.NewStartBareMetalServerOptions(id) - startBareMetalServerOptionsModel.SetID("testString") - startBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(startBareMetalServerOptionsModel).ToNot(BeNil()) - Expect(startBareMetalServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(startBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewStopBareMetalServerOptions successfully`, func() { - // Construct an instance of the StopBareMetalServerOptions model - id := "testString" - stopBareMetalServerOptionsType := "hard" - stopBareMetalServerOptionsModel := vpcService.NewStopBareMetalServerOptions(id, stopBareMetalServerOptionsType) - stopBareMetalServerOptionsModel.SetID("testString") - stopBareMetalServerOptionsModel.SetType("hard") - stopBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(stopBareMetalServerOptionsModel).ToNot(BeNil()) - Expect(stopBareMetalServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(stopBareMetalServerOptionsModel.Type).To(Equal(core.StringPtr("hard"))) - Expect(stopBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUnsetSubnetPublicGatewayOptions successfully`, func() { - // Construct an instance of the UnsetSubnetPublicGatewayOptions model - id := "testString" - unsetSubnetPublicGatewayOptionsModel := vpcService.NewUnsetSubnetPublicGatewayOptions(id) - unsetSubnetPublicGatewayOptionsModel.SetID("testString") - unsetSubnetPublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(unsetSubnetPublicGatewayOptionsModel).ToNot(BeNil()) - Expect(unsetSubnetPublicGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(unsetSubnetPublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateBackupPolicyOptions successfully`, func() { - // Construct an instance of the UpdateBackupPolicyOptions model - id := "testString" - backupPolicyPatch := map[string]interface{}{"anyKey": "anyValue"} - updateBackupPolicyOptionsModel := vpcService.NewUpdateBackupPolicyOptions(id, backupPolicyPatch) - updateBackupPolicyOptionsModel.SetID("testString") - updateBackupPolicyOptionsModel.SetBackupPolicyPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateBackupPolicyOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateBackupPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateBackupPolicyOptionsModel).ToNot(BeNil()) - Expect(updateBackupPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateBackupPolicyOptionsModel.BackupPolicyPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateBackupPolicyOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) - Expect(updateBackupPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateBackupPolicyPlanOptions successfully`, func() { - // Construct an instance of the UpdateBackupPolicyPlanOptions model - backupPolicyID := "testString" - id := "testString" - backupPolicyPlanPatch := map[string]interface{}{"anyKey": "anyValue"} - updateBackupPolicyPlanOptionsModel := vpcService.NewUpdateBackupPolicyPlanOptions(backupPolicyID, id, backupPolicyPlanPatch) - updateBackupPolicyPlanOptionsModel.SetBackupPolicyID("testString") - updateBackupPolicyPlanOptionsModel.SetID("testString") - updateBackupPolicyPlanOptionsModel.SetBackupPolicyPlanPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateBackupPolicyPlanOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateBackupPolicyPlanOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateBackupPolicyPlanOptionsModel).ToNot(BeNil()) - Expect(updateBackupPolicyPlanOptionsModel.BackupPolicyID).To(Equal(core.StringPtr("testString"))) - Expect(updateBackupPolicyPlanOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateBackupPolicyPlanOptionsModel.BackupPolicyPlanPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateBackupPolicyPlanOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) - Expect(updateBackupPolicyPlanOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateBareMetalServerDiskOptions successfully`, func() { - // Construct an instance of the UpdateBareMetalServerDiskOptions model - bareMetalServerID := "testString" - id := "testString" - bareMetalServerDiskPatch := map[string]interface{}{"anyKey": "anyValue"} - updateBareMetalServerDiskOptionsModel := vpcService.NewUpdateBareMetalServerDiskOptions(bareMetalServerID, id, bareMetalServerDiskPatch) - updateBareMetalServerDiskOptionsModel.SetBareMetalServerID("testString") - updateBareMetalServerDiskOptionsModel.SetID("testString") - updateBareMetalServerDiskOptionsModel.SetBareMetalServerDiskPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateBareMetalServerDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateBareMetalServerDiskOptionsModel).ToNot(BeNil()) - Expect(updateBareMetalServerDiskOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(updateBareMetalServerDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateBareMetalServerDiskOptionsModel.BareMetalServerDiskPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateBareMetalServerDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateBareMetalServerNetworkInterfaceOptions successfully`, func() { - // Construct an instance of the UpdateBareMetalServerNetworkInterfaceOptions model - bareMetalServerID := "testString" - id := "testString" - bareMetalServerNetworkInterfacePatch := map[string]interface{}{"anyKey": "anyValue"} - updateBareMetalServerNetworkInterfaceOptionsModel := vpcService.NewUpdateBareMetalServerNetworkInterfaceOptions(bareMetalServerID, id, bareMetalServerNetworkInterfacePatch) - updateBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerID("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.SetID("testString") - updateBareMetalServerNetworkInterfaceOptionsModel.SetBareMetalServerNetworkInterfacePatch(map[string]interface{}{"anyKey": "anyValue"}) - updateBareMetalServerNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateBareMetalServerNetworkInterfaceOptionsModel).ToNot(BeNil()) - Expect(updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(updateBareMetalServerNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateBareMetalServerNetworkInterfaceOptionsModel.BareMetalServerNetworkInterfacePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateBareMetalServerNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateBareMetalServerOptions successfully`, func() { - // Construct an instance of the UpdateBareMetalServerOptions model - id := "testString" - bareMetalServerPatch := map[string]interface{}{"anyKey": "anyValue"} - updateBareMetalServerOptionsModel := vpcService.NewUpdateBareMetalServerOptions(id, bareMetalServerPatch) - updateBareMetalServerOptionsModel.SetID("testString") - updateBareMetalServerOptionsModel.SetBareMetalServerPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateBareMetalServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateBareMetalServerOptionsModel).ToNot(BeNil()) - Expect(updateBareMetalServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateBareMetalServerOptionsModel.BareMetalServerPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateBareMetalServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateDedicatedHostDiskOptions successfully`, func() { - // Construct an instance of the UpdateDedicatedHostDiskOptions model - dedicatedHostID := "testString" - id := "testString" - dedicatedHostDiskPatch := map[string]interface{}{"anyKey": "anyValue"} - updateDedicatedHostDiskOptionsModel := vpcService.NewUpdateDedicatedHostDiskOptions(dedicatedHostID, id, dedicatedHostDiskPatch) - updateDedicatedHostDiskOptionsModel.SetDedicatedHostID("testString") - updateDedicatedHostDiskOptionsModel.SetID("testString") - updateDedicatedHostDiskOptionsModel.SetDedicatedHostDiskPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateDedicatedHostDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateDedicatedHostDiskOptionsModel).ToNot(BeNil()) - Expect(updateDedicatedHostDiskOptionsModel.DedicatedHostID).To(Equal(core.StringPtr("testString"))) - Expect(updateDedicatedHostDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateDedicatedHostDiskOptionsModel.DedicatedHostDiskPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateDedicatedHostDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateDedicatedHostGroupOptions successfully`, func() { - // Construct an instance of the UpdateDedicatedHostGroupOptions model - id := "testString" - dedicatedHostGroupPatch := map[string]interface{}{"anyKey": "anyValue"} - updateDedicatedHostGroupOptionsModel := vpcService.NewUpdateDedicatedHostGroupOptions(id, dedicatedHostGroupPatch) - updateDedicatedHostGroupOptionsModel.SetID("testString") - updateDedicatedHostGroupOptionsModel.SetDedicatedHostGroupPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateDedicatedHostGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateDedicatedHostGroupOptionsModel).ToNot(BeNil()) - Expect(updateDedicatedHostGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateDedicatedHostGroupOptionsModel.DedicatedHostGroupPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateDedicatedHostGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateDedicatedHostOptions successfully`, func() { - // Construct an instance of the UpdateDedicatedHostOptions model - id := "testString" - dedicatedHostPatch := map[string]interface{}{"anyKey": "anyValue"} - updateDedicatedHostOptionsModel := vpcService.NewUpdateDedicatedHostOptions(id, dedicatedHostPatch) - updateDedicatedHostOptionsModel.SetID("testString") - updateDedicatedHostOptionsModel.SetDedicatedHostPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateDedicatedHostOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateDedicatedHostOptionsModel).ToNot(BeNil()) - Expect(updateDedicatedHostOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateDedicatedHostOptionsModel.DedicatedHostPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateDedicatedHostOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateEndpointGatewayOptions successfully`, func() { - // Construct an instance of the UpdateEndpointGatewayOptions model - id := "testString" - endpointGatewayPatch := map[string]interface{}{"anyKey": "anyValue"} - updateEndpointGatewayOptionsModel := vpcService.NewUpdateEndpointGatewayOptions(id, endpointGatewayPatch) - updateEndpointGatewayOptionsModel.SetID("testString") - updateEndpointGatewayOptionsModel.SetEndpointGatewayPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateEndpointGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateEndpointGatewayOptionsModel).ToNot(BeNil()) - Expect(updateEndpointGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateEndpointGatewayOptionsModel.EndpointGatewayPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateEndpointGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateFloatingIPOptions successfully`, func() { - // Construct an instance of the UpdateFloatingIPOptions model - id := "testString" - floatingIPPatch := map[string]interface{}{"anyKey": "anyValue"} - updateFloatingIPOptionsModel := vpcService.NewUpdateFloatingIPOptions(id, floatingIPPatch) - updateFloatingIPOptionsModel.SetID("testString") - updateFloatingIPOptionsModel.SetFloatingIPPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateFloatingIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateFloatingIPOptionsModel).ToNot(BeNil()) - Expect(updateFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateFloatingIPOptionsModel.FloatingIPPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateFlowLogCollectorOptions successfully`, func() { - // Construct an instance of the UpdateFlowLogCollectorOptions model - id := "testString" - flowLogCollectorPatch := map[string]interface{}{"anyKey": "anyValue"} - updateFlowLogCollectorOptionsModel := vpcService.NewUpdateFlowLogCollectorOptions(id, flowLogCollectorPatch) - updateFlowLogCollectorOptionsModel.SetID("testString") - updateFlowLogCollectorOptionsModel.SetFlowLogCollectorPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateFlowLogCollectorOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateFlowLogCollectorOptionsModel).ToNot(BeNil()) - Expect(updateFlowLogCollectorOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateFlowLogCollectorOptionsModel.FlowLogCollectorPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateFlowLogCollectorOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateIkePolicyOptions successfully`, func() { - // Construct an instance of the UpdateIkePolicyOptions model - id := "testString" - ikePolicyPatch := map[string]interface{}{"anyKey": "anyValue"} - updateIkePolicyOptionsModel := vpcService.NewUpdateIkePolicyOptions(id, ikePolicyPatch) - updateIkePolicyOptionsModel.SetID("testString") - updateIkePolicyOptionsModel.SetIkePolicyPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateIkePolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateIkePolicyOptionsModel).ToNot(BeNil()) - Expect(updateIkePolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateIkePolicyOptionsModel.IkePolicyPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateIkePolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateImageOptions successfully`, func() { - // Construct an instance of the UpdateImageOptions model - id := "testString" - imagePatch := map[string]interface{}{"anyKey": "anyValue"} - updateImageOptionsModel := vpcService.NewUpdateImageOptions(id, imagePatch) - updateImageOptionsModel.SetID("testString") - updateImageOptionsModel.SetImagePatch(map[string]interface{}{"anyKey": "anyValue"}) - updateImageOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateImageOptionsModel).ToNot(BeNil()) - Expect(updateImageOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateImageOptionsModel.ImagePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateImageOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateInstanceDiskOptions successfully`, func() { - // Construct an instance of the UpdateInstanceDiskOptions model - instanceID := "testString" - id := "testString" - instanceDiskPatch := map[string]interface{}{"anyKey": "anyValue"} - updateInstanceDiskOptionsModel := vpcService.NewUpdateInstanceDiskOptions(instanceID, id, instanceDiskPatch) - updateInstanceDiskOptionsModel.SetInstanceID("testString") - updateInstanceDiskOptionsModel.SetID("testString") - updateInstanceDiskOptionsModel.SetInstanceDiskPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateInstanceDiskOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateInstanceDiskOptionsModel).ToNot(BeNil()) - Expect(updateInstanceDiskOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceDiskOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceDiskOptionsModel.InstanceDiskPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateInstanceDiskOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateInstanceGroupManagerActionOptions successfully`, func() { - // Construct an instance of the UpdateInstanceGroupManagerActionOptions model - instanceGroupID := "testString" - instanceGroupManagerID := "testString" - id := "testString" - instanceGroupManagerActionPatch := map[string]interface{}{"anyKey": "anyValue"} - updateInstanceGroupManagerActionOptionsModel := vpcService.NewUpdateInstanceGroupManagerActionOptions(instanceGroupID, instanceGroupManagerID, id, instanceGroupManagerActionPatch) - updateInstanceGroupManagerActionOptionsModel.SetInstanceGroupID("testString") - updateInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerID("testString") - updateInstanceGroupManagerActionOptionsModel.SetID("testString") - updateInstanceGroupManagerActionOptionsModel.SetInstanceGroupManagerActionPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateInstanceGroupManagerActionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateInstanceGroupManagerActionOptionsModel).ToNot(BeNil()) - Expect(updateInstanceGroupManagerActionOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupManagerActionOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupManagerActionOptionsModel.InstanceGroupManagerActionPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateInstanceGroupManagerActionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateInstanceGroupManagerOptions successfully`, func() { - // Construct an instance of the UpdateInstanceGroupManagerOptions model - instanceGroupID := "testString" - id := "testString" - instanceGroupManagerPatch := map[string]interface{}{"anyKey": "anyValue"} - updateInstanceGroupManagerOptionsModel := vpcService.NewUpdateInstanceGroupManagerOptions(instanceGroupID, id, instanceGroupManagerPatch) - updateInstanceGroupManagerOptionsModel.SetInstanceGroupID("testString") - updateInstanceGroupManagerOptionsModel.SetID("testString") - updateInstanceGroupManagerOptionsModel.SetInstanceGroupManagerPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateInstanceGroupManagerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateInstanceGroupManagerOptionsModel).ToNot(BeNil()) - Expect(updateInstanceGroupManagerOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupManagerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupManagerOptionsModel.InstanceGroupManagerPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateInstanceGroupManagerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateInstanceGroupManagerPolicyOptions successfully`, func() { - // Construct an instance of the UpdateInstanceGroupManagerPolicyOptions model - instanceGroupID := "testString" - instanceGroupManagerID := "testString" - id := "testString" - instanceGroupManagerPolicyPatch := map[string]interface{}{"anyKey": "anyValue"} - updateInstanceGroupManagerPolicyOptionsModel := vpcService.NewUpdateInstanceGroupManagerPolicyOptions(instanceGroupID, instanceGroupManagerID, id, instanceGroupManagerPolicyPatch) - updateInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupID("testString") - updateInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerID("testString") - updateInstanceGroupManagerPolicyOptionsModel.SetID("testString") - updateInstanceGroupManagerPolicyOptionsModel.SetInstanceGroupManagerPolicyPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateInstanceGroupManagerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateInstanceGroupManagerPolicyOptionsModel).ToNot(BeNil()) - Expect(updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupManagerPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupManagerPolicyOptionsModel.InstanceGroupManagerPolicyPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateInstanceGroupManagerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateInstanceGroupMembershipOptions successfully`, func() { - // Construct an instance of the UpdateInstanceGroupMembershipOptions model - instanceGroupID := "testString" - id := "testString" - instanceGroupMembershipPatch := map[string]interface{}{"anyKey": "anyValue"} - updateInstanceGroupMembershipOptionsModel := vpcService.NewUpdateInstanceGroupMembershipOptions(instanceGroupID, id, instanceGroupMembershipPatch) - updateInstanceGroupMembershipOptionsModel.SetInstanceGroupID("testString") - updateInstanceGroupMembershipOptionsModel.SetID("testString") - updateInstanceGroupMembershipOptionsModel.SetInstanceGroupMembershipPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateInstanceGroupMembershipOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateInstanceGroupMembershipOptionsModel).ToNot(BeNil()) - Expect(updateInstanceGroupMembershipOptionsModel.InstanceGroupID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupMembershipOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupMembershipOptionsModel.InstanceGroupMembershipPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateInstanceGroupMembershipOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateInstanceGroupOptions successfully`, func() { - // Construct an instance of the UpdateInstanceGroupOptions model - id := "testString" - instanceGroupPatch := map[string]interface{}{"anyKey": "anyValue"} - updateInstanceGroupOptionsModel := vpcService.NewUpdateInstanceGroupOptions(id, instanceGroupPatch) - updateInstanceGroupOptionsModel.SetID("testString") - updateInstanceGroupOptionsModel.SetInstanceGroupPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateInstanceGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateInstanceGroupOptionsModel).ToNot(BeNil()) - Expect(updateInstanceGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceGroupOptionsModel.InstanceGroupPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateInstanceGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateInstanceNetworkInterfaceOptions successfully`, func() { - // Construct an instance of the UpdateInstanceNetworkInterfaceOptions model - instanceID := "testString" - id := "testString" - networkInterfacePatch := map[string]interface{}{"anyKey": "anyValue"} - updateInstanceNetworkInterfaceOptionsModel := vpcService.NewUpdateInstanceNetworkInterfaceOptions(instanceID, id, networkInterfacePatch) - updateInstanceNetworkInterfaceOptionsModel.SetInstanceID("testString") - updateInstanceNetworkInterfaceOptionsModel.SetID("testString") - updateInstanceNetworkInterfaceOptionsModel.SetNetworkInterfacePatch(map[string]interface{}{"anyKey": "anyValue"}) - updateInstanceNetworkInterfaceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateInstanceNetworkInterfaceOptionsModel).ToNot(BeNil()) - Expect(updateInstanceNetworkInterfaceOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceNetworkInterfaceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceNetworkInterfaceOptionsModel.NetworkInterfacePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateInstanceNetworkInterfaceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateInstanceOptions successfully`, func() { - // Construct an instance of the UpdateInstanceOptions model - id := "testString" - instancePatch := map[string]interface{}{"anyKey": "anyValue"} - updateInstanceOptionsModel := vpcService.NewUpdateInstanceOptions(id, instancePatch) - updateInstanceOptionsModel.SetID("testString") - updateInstanceOptionsModel.SetInstancePatch(map[string]interface{}{"anyKey": "anyValue"}) - updateInstanceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateInstanceOptionsModel).ToNot(BeNil()) - Expect(updateInstanceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceOptionsModel.InstancePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateInstanceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateInstanceTemplateOptions successfully`, func() { - // Construct an instance of the UpdateInstanceTemplateOptions model - id := "testString" - instanceTemplatePatch := map[string]interface{}{"anyKey": "anyValue"} - updateInstanceTemplateOptionsModel := vpcService.NewUpdateInstanceTemplateOptions(id, instanceTemplatePatch) - updateInstanceTemplateOptionsModel.SetID("testString") - updateInstanceTemplateOptionsModel.SetInstanceTemplatePatch(map[string]interface{}{"anyKey": "anyValue"}) - updateInstanceTemplateOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateInstanceTemplateOptionsModel).ToNot(BeNil()) - Expect(updateInstanceTemplateOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceTemplateOptionsModel.InstanceTemplatePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateInstanceTemplateOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateInstanceVolumeAttachmentOptions successfully`, func() { - // Construct an instance of the UpdateInstanceVolumeAttachmentOptions model - instanceID := "testString" - id := "testString" - volumeAttachmentPatch := map[string]interface{}{"anyKey": "anyValue"} - updateInstanceVolumeAttachmentOptionsModel := vpcService.NewUpdateInstanceVolumeAttachmentOptions(instanceID, id, volumeAttachmentPatch) - updateInstanceVolumeAttachmentOptionsModel.SetInstanceID("testString") - updateInstanceVolumeAttachmentOptionsModel.SetID("testString") - updateInstanceVolumeAttachmentOptionsModel.SetVolumeAttachmentPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateInstanceVolumeAttachmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateInstanceVolumeAttachmentOptionsModel).ToNot(BeNil()) - Expect(updateInstanceVolumeAttachmentOptionsModel.InstanceID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceVolumeAttachmentOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateInstanceVolumeAttachmentOptionsModel.VolumeAttachmentPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateInstanceVolumeAttachmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateIpsecPolicyOptions successfully`, func() { - // Construct an instance of the UpdateIpsecPolicyOptions model - id := "testString" - iPsecPolicyPatch := map[string]interface{}{"anyKey": "anyValue"} - updateIpsecPolicyOptionsModel := vpcService.NewUpdateIpsecPolicyOptions(id, iPsecPolicyPatch) - updateIpsecPolicyOptionsModel.SetID("testString") - updateIpsecPolicyOptionsModel.SetIPsecPolicyPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateIpsecPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateIpsecPolicyOptionsModel).ToNot(BeNil()) - Expect(updateIpsecPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateIpsecPolicyOptionsModel.IPsecPolicyPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateIpsecPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateKeyOptions successfully`, func() { - // Construct an instance of the UpdateKeyOptions model - id := "testString" - keyPatch := map[string]interface{}{"anyKey": "anyValue"} - updateKeyOptionsModel := vpcService.NewUpdateKeyOptions(id, keyPatch) - updateKeyOptionsModel.SetID("testString") - updateKeyOptionsModel.SetKeyPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateKeyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateKeyOptionsModel).ToNot(BeNil()) - Expect(updateKeyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateKeyOptionsModel.KeyPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateKeyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateLoadBalancerListenerOptions successfully`, func() { - // Construct an instance of the UpdateLoadBalancerListenerOptions model - loadBalancerID := "testString" - id := "testString" - loadBalancerListenerPatch := map[string]interface{}{"anyKey": "anyValue"} - updateLoadBalancerListenerOptionsModel := vpcService.NewUpdateLoadBalancerListenerOptions(loadBalancerID, id, loadBalancerListenerPatch) - updateLoadBalancerListenerOptionsModel.SetLoadBalancerID("testString") - updateLoadBalancerListenerOptionsModel.SetID("testString") - updateLoadBalancerListenerOptionsModel.SetLoadBalancerListenerPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateLoadBalancerListenerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateLoadBalancerListenerOptionsModel).ToNot(BeNil()) - Expect(updateLoadBalancerListenerOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerListenerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerListenerOptionsModel.LoadBalancerListenerPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateLoadBalancerListenerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateLoadBalancerListenerPolicyOptions successfully`, func() { - // Construct an instance of the UpdateLoadBalancerListenerPolicyOptions model - loadBalancerID := "testString" - listenerID := "testString" - id := "testString" - loadBalancerListenerPolicyPatch := map[string]interface{}{"anyKey": "anyValue"} - updateLoadBalancerListenerPolicyOptionsModel := vpcService.NewUpdateLoadBalancerListenerPolicyOptions(loadBalancerID, listenerID, id, loadBalancerListenerPolicyPatch) - updateLoadBalancerListenerPolicyOptionsModel.SetLoadBalancerID("testString") - updateLoadBalancerListenerPolicyOptionsModel.SetListenerID("testString") - updateLoadBalancerListenerPolicyOptionsModel.SetID("testString") - updateLoadBalancerListenerPolicyOptionsModel.SetLoadBalancerListenerPolicyPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateLoadBalancerListenerPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateLoadBalancerListenerPolicyOptionsModel).ToNot(BeNil()) - Expect(updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerListenerPolicyOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerListenerPolicyOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerListenerPolicyOptionsModel.LoadBalancerListenerPolicyPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateLoadBalancerListenerPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateLoadBalancerListenerPolicyRuleOptions successfully`, func() { - // Construct an instance of the UpdateLoadBalancerListenerPolicyRuleOptions model - loadBalancerID := "testString" - listenerID := "testString" - policyID := "testString" - id := "testString" - loadBalancerListenerPolicyRulePatch := map[string]interface{}{"anyKey": "anyValue"} - updateLoadBalancerListenerPolicyRuleOptionsModel := vpcService.NewUpdateLoadBalancerListenerPolicyRuleOptions(loadBalancerID, listenerID, policyID, id, loadBalancerListenerPolicyRulePatch) - updateLoadBalancerListenerPolicyRuleOptionsModel.SetLoadBalancerID("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.SetListenerID("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.SetPolicyID("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.SetID("testString") - updateLoadBalancerListenerPolicyRuleOptionsModel.SetLoadBalancerListenerPolicyRulePatch(map[string]interface{}{"anyKey": "anyValue"}) - updateLoadBalancerListenerPolicyRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateLoadBalancerListenerPolicyRuleOptionsModel).ToNot(BeNil()) - Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.ListenerID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.PolicyID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.LoadBalancerListenerPolicyRulePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateLoadBalancerListenerPolicyRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateLoadBalancerOptions successfully`, func() { - // Construct an instance of the UpdateLoadBalancerOptions model - id := "testString" - loadBalancerPatch := map[string]interface{}{"anyKey": "anyValue"} - updateLoadBalancerOptionsModel := vpcService.NewUpdateLoadBalancerOptions(id, loadBalancerPatch) - updateLoadBalancerOptionsModel.SetID("testString") - updateLoadBalancerOptionsModel.SetLoadBalancerPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateLoadBalancerOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateLoadBalancerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateLoadBalancerOptionsModel).ToNot(BeNil()) - Expect(updateLoadBalancerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerOptionsModel.LoadBalancerPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateLoadBalancerOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) - Expect(updateLoadBalancerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateLoadBalancerPoolMemberOptions successfully`, func() { - // Construct an instance of the UpdateLoadBalancerPoolMemberOptions model - loadBalancerID := "testString" - poolID := "testString" - id := "testString" - loadBalancerPoolMemberPatch := map[string]interface{}{"anyKey": "anyValue"} - updateLoadBalancerPoolMemberOptionsModel := vpcService.NewUpdateLoadBalancerPoolMemberOptions(loadBalancerID, poolID, id, loadBalancerPoolMemberPatch) - updateLoadBalancerPoolMemberOptionsModel.SetLoadBalancerID("testString") - updateLoadBalancerPoolMemberOptionsModel.SetPoolID("testString") - updateLoadBalancerPoolMemberOptionsModel.SetID("testString") - updateLoadBalancerPoolMemberOptionsModel.SetLoadBalancerPoolMemberPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateLoadBalancerPoolMemberOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateLoadBalancerPoolMemberOptionsModel).ToNot(BeNil()) - Expect(updateLoadBalancerPoolMemberOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerPoolMemberOptionsModel.PoolID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerPoolMemberOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerPoolMemberOptionsModel.LoadBalancerPoolMemberPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateLoadBalancerPoolMemberOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateLoadBalancerPoolOptions successfully`, func() { - // Construct an instance of the UpdateLoadBalancerPoolOptions model - loadBalancerID := "testString" - id := "testString" - loadBalancerPoolPatch := map[string]interface{}{"anyKey": "anyValue"} - updateLoadBalancerPoolOptionsModel := vpcService.NewUpdateLoadBalancerPoolOptions(loadBalancerID, id, loadBalancerPoolPatch) - updateLoadBalancerPoolOptionsModel.SetLoadBalancerID("testString") - updateLoadBalancerPoolOptionsModel.SetID("testString") - updateLoadBalancerPoolOptionsModel.SetLoadBalancerPoolPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateLoadBalancerPoolOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateLoadBalancerPoolOptionsModel).ToNot(BeNil()) - Expect(updateLoadBalancerPoolOptionsModel.LoadBalancerID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerPoolOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateLoadBalancerPoolOptionsModel.LoadBalancerPoolPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateLoadBalancerPoolOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateNetworkACLOptions successfully`, func() { - // Construct an instance of the UpdateNetworkACLOptions model - id := "testString" - networkACLPatch := map[string]interface{}{"anyKey": "anyValue"} - updateNetworkACLOptionsModel := vpcService.NewUpdateNetworkACLOptions(id, networkACLPatch) - updateNetworkACLOptionsModel.SetID("testString") - updateNetworkACLOptionsModel.SetNetworkACLPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateNetworkACLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateNetworkACLOptionsModel).ToNot(BeNil()) - Expect(updateNetworkACLOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateNetworkACLOptionsModel.NetworkACLPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateNetworkACLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateNetworkACLRuleOptions successfully`, func() { - // Construct an instance of the UpdateNetworkACLRuleOptions model - networkACLID := "testString" - id := "testString" - networkACLRulePatch := map[string]interface{}{"anyKey": "anyValue"} - updateNetworkACLRuleOptionsModel := vpcService.NewUpdateNetworkACLRuleOptions(networkACLID, id, networkACLRulePatch) - updateNetworkACLRuleOptionsModel.SetNetworkACLID("testString") - updateNetworkACLRuleOptionsModel.SetID("testString") - updateNetworkACLRuleOptionsModel.SetNetworkACLRulePatch(map[string]interface{}{"anyKey": "anyValue"}) - updateNetworkACLRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateNetworkACLRuleOptionsModel).ToNot(BeNil()) - Expect(updateNetworkACLRuleOptionsModel.NetworkACLID).To(Equal(core.StringPtr("testString"))) - Expect(updateNetworkACLRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateNetworkACLRuleOptionsModel.NetworkACLRulePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateNetworkACLRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdatePlacementGroupOptions successfully`, func() { - // Construct an instance of the UpdatePlacementGroupOptions model - id := "testString" - placementGroupPatch := map[string]interface{}{"anyKey": "anyValue"} - updatePlacementGroupOptionsModel := vpcService.NewUpdatePlacementGroupOptions(id, placementGroupPatch) - updatePlacementGroupOptionsModel.SetID("testString") - updatePlacementGroupOptionsModel.SetPlacementGroupPatch(map[string]interface{}{"anyKey": "anyValue"}) - updatePlacementGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updatePlacementGroupOptionsModel).ToNot(BeNil()) - Expect(updatePlacementGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updatePlacementGroupOptionsModel.PlacementGroupPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updatePlacementGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdatePublicGatewayOptions successfully`, func() { - // Construct an instance of the UpdatePublicGatewayOptions model - id := "testString" - publicGatewayPatch := map[string]interface{}{"anyKey": "anyValue"} - updatePublicGatewayOptionsModel := vpcService.NewUpdatePublicGatewayOptions(id, publicGatewayPatch) - updatePublicGatewayOptionsModel.SetID("testString") - updatePublicGatewayOptionsModel.SetPublicGatewayPatch(map[string]interface{}{"anyKey": "anyValue"}) - updatePublicGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updatePublicGatewayOptionsModel).ToNot(BeNil()) - Expect(updatePublicGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updatePublicGatewayOptionsModel.PublicGatewayPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updatePublicGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateSecurityGroupOptions successfully`, func() { - // Construct an instance of the UpdateSecurityGroupOptions model - id := "testString" - securityGroupPatch := map[string]interface{}{"anyKey": "anyValue"} - updateSecurityGroupOptionsModel := vpcService.NewUpdateSecurityGroupOptions(id, securityGroupPatch) - updateSecurityGroupOptionsModel.SetID("testString") - updateSecurityGroupOptionsModel.SetSecurityGroupPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateSecurityGroupOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateSecurityGroupOptionsModel).ToNot(BeNil()) - Expect(updateSecurityGroupOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateSecurityGroupOptionsModel.SecurityGroupPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateSecurityGroupOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateSecurityGroupRuleOptions successfully`, func() { - // Construct an instance of the UpdateSecurityGroupRuleOptions model - securityGroupID := "testString" - id := "testString" - securityGroupRulePatch := map[string]interface{}{"anyKey": "anyValue"} - updateSecurityGroupRuleOptionsModel := vpcService.NewUpdateSecurityGroupRuleOptions(securityGroupID, id, securityGroupRulePatch) - updateSecurityGroupRuleOptionsModel.SetSecurityGroupID("testString") - updateSecurityGroupRuleOptionsModel.SetID("testString") - updateSecurityGroupRuleOptionsModel.SetSecurityGroupRulePatch(map[string]interface{}{"anyKey": "anyValue"}) - updateSecurityGroupRuleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateSecurityGroupRuleOptionsModel).ToNot(BeNil()) - Expect(updateSecurityGroupRuleOptionsModel.SecurityGroupID).To(Equal(core.StringPtr("testString"))) - Expect(updateSecurityGroupRuleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateSecurityGroupRuleOptionsModel.SecurityGroupRulePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateSecurityGroupRuleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateSnapshotOptions successfully`, func() { - // Construct an instance of the UpdateSnapshotOptions model - id := "testString" - snapshotPatch := map[string]interface{}{"anyKey": "anyValue"} - updateSnapshotOptionsModel := vpcService.NewUpdateSnapshotOptions(id, snapshotPatch) - updateSnapshotOptionsModel.SetID("testString") - updateSnapshotOptionsModel.SetSnapshotPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateSnapshotOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateSnapshotOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateSnapshotOptionsModel).ToNot(BeNil()) - Expect(updateSnapshotOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateSnapshotOptionsModel.SnapshotPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateSnapshotOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) - Expect(updateSnapshotOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateSubnetOptions successfully`, func() { - // Construct an instance of the UpdateSubnetOptions model - id := "testString" - subnetPatch := map[string]interface{}{"anyKey": "anyValue"} - updateSubnetOptionsModel := vpcService.NewUpdateSubnetOptions(id, subnetPatch) - updateSubnetOptionsModel.SetID("testString") - updateSubnetOptionsModel.SetSubnetPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateSubnetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateSubnetOptionsModel).ToNot(BeNil()) - Expect(updateSubnetOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateSubnetOptionsModel.SubnetPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateSubnetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateSubnetReservedIPOptions successfully`, func() { - // Construct an instance of the UpdateSubnetReservedIPOptions model - subnetID := "testString" - id := "testString" - reservedIPPatch := map[string]interface{}{"anyKey": "anyValue"} - updateSubnetReservedIPOptionsModel := vpcService.NewUpdateSubnetReservedIPOptions(subnetID, id, reservedIPPatch) - updateSubnetReservedIPOptionsModel.SetSubnetID("testString") - updateSubnetReservedIPOptionsModel.SetID("testString") - updateSubnetReservedIPOptionsModel.SetReservedIPPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateSubnetReservedIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateSubnetReservedIPOptionsModel).ToNot(BeNil()) - Expect(updateSubnetReservedIPOptionsModel.SubnetID).To(Equal(core.StringPtr("testString"))) - Expect(updateSubnetReservedIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateSubnetReservedIPOptionsModel.ReservedIPPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateSubnetReservedIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateVolumeOptions successfully`, func() { - // Construct an instance of the UpdateVolumeOptions model - id := "testString" - volumePatch := map[string]interface{}{"anyKey": "anyValue"} - updateVolumeOptionsModel := vpcService.NewUpdateVolumeOptions(id, volumePatch) - updateVolumeOptionsModel.SetID("testString") - updateVolumeOptionsModel.SetVolumePatch(map[string]interface{}{"anyKey": "anyValue"}) - updateVolumeOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVolumeOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateVolumeOptionsModel).ToNot(BeNil()) - Expect(updateVolumeOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVolumeOptionsModel.VolumePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateVolumeOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) - Expect(updateVolumeOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateVPCAddressPrefixOptions successfully`, func() { - // Construct an instance of the UpdateVPCAddressPrefixOptions model - vpcID := "testString" - id := "testString" - addressPrefixPatch := map[string]interface{}{"anyKey": "anyValue"} - updateVPCAddressPrefixOptionsModel := vpcService.NewUpdateVPCAddressPrefixOptions(vpcID, id, addressPrefixPatch) - updateVPCAddressPrefixOptionsModel.SetVPCID("testString") - updateVPCAddressPrefixOptionsModel.SetID("testString") - updateVPCAddressPrefixOptionsModel.SetAddressPrefixPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateVPCAddressPrefixOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateVPCAddressPrefixOptionsModel).ToNot(BeNil()) - Expect(updateVPCAddressPrefixOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCAddressPrefixOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCAddressPrefixOptionsModel.AddressPrefixPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateVPCAddressPrefixOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateVPCOptions successfully`, func() { - // Construct an instance of the UpdateVPCOptions model - id := "testString" - vpcPatch := map[string]interface{}{"anyKey": "anyValue"} - updateVPCOptionsModel := vpcService.NewUpdateVPCOptions(id, vpcPatch) - updateVPCOptionsModel.SetID("testString") - updateVPCOptionsModel.SetVPCPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateVPCOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateVPCOptionsModel).ToNot(BeNil()) - Expect(updateVPCOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCOptionsModel.VPCPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateVPCOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateVPCRouteOptions successfully`, func() { - // Construct an instance of the UpdateVPCRouteOptions model - vpcID := "testString" - id := "testString" - routePatch := map[string]interface{}{"anyKey": "anyValue"} - updateVPCRouteOptionsModel := vpcService.NewUpdateVPCRouteOptions(vpcID, id, routePatch) - updateVPCRouteOptionsModel.SetVPCID("testString") - updateVPCRouteOptionsModel.SetID("testString") - updateVPCRouteOptionsModel.SetRoutePatch(map[string]interface{}{"anyKey": "anyValue"}) - updateVPCRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateVPCRouteOptionsModel).ToNot(BeNil()) - Expect(updateVPCRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCRouteOptionsModel.RoutePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateVPCRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateVPCRoutingTableOptions successfully`, func() { - // Construct an instance of the UpdateVPCRoutingTableOptions model - vpcID := "testString" - id := "testString" - routingTablePatch := map[string]interface{}{"anyKey": "anyValue"} - updateVPCRoutingTableOptionsModel := vpcService.NewUpdateVPCRoutingTableOptions(vpcID, id, routingTablePatch) - updateVPCRoutingTableOptionsModel.SetVPCID("testString") - updateVPCRoutingTableOptionsModel.SetID("testString") - updateVPCRoutingTableOptionsModel.SetRoutingTablePatch(map[string]interface{}{"anyKey": "anyValue"}) - updateVPCRoutingTableOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVPCRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateVPCRoutingTableOptionsModel).ToNot(BeNil()) - Expect(updateVPCRoutingTableOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCRoutingTableOptionsModel.RoutingTablePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateVPCRoutingTableOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) - Expect(updateVPCRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateVPCRoutingTableRouteOptions successfully`, func() { - // Construct an instance of the UpdateVPCRoutingTableRouteOptions model - vpcID := "testString" - routingTableID := "testString" - id := "testString" - routePatch := map[string]interface{}{"anyKey": "anyValue"} - updateVPCRoutingTableRouteOptionsModel := vpcService.NewUpdateVPCRoutingTableRouteOptions(vpcID, routingTableID, id, routePatch) - updateVPCRoutingTableRouteOptionsModel.SetVPCID("testString") - updateVPCRoutingTableRouteOptionsModel.SetRoutingTableID("testString") - updateVPCRoutingTableRouteOptionsModel.SetID("testString") - updateVPCRoutingTableRouteOptionsModel.SetRoutePatch(map[string]interface{}{"anyKey": "anyValue"}) - updateVPCRoutingTableRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateVPCRoutingTableRouteOptionsModel).ToNot(BeNil()) - Expect(updateVPCRoutingTableRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCRoutingTableRouteOptionsModel.RoutingTableID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCRoutingTableRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPCRoutingTableRouteOptionsModel.RoutePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateVPCRoutingTableRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateVPNGatewayConnectionOptions successfully`, func() { - // Construct an instance of the UpdateVPNGatewayConnectionOptions model - vpnGatewayID := "testString" - id := "testString" - vpnGatewayConnectionPatch := map[string]interface{}{"anyKey": "anyValue"} - updateVPNGatewayConnectionOptionsModel := vpcService.NewUpdateVPNGatewayConnectionOptions(vpnGatewayID, id, vpnGatewayConnectionPatch) - updateVPNGatewayConnectionOptionsModel.SetVPNGatewayID("testString") - updateVPNGatewayConnectionOptionsModel.SetID("testString") - updateVPNGatewayConnectionOptionsModel.SetVPNGatewayConnectionPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateVPNGatewayConnectionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateVPNGatewayConnectionOptionsModel).ToNot(BeNil()) - Expect(updateVPNGatewayConnectionOptionsModel.VPNGatewayID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPNGatewayConnectionOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPNGatewayConnectionOptionsModel.VPNGatewayConnectionPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateVPNGatewayConnectionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateVPNGatewayOptions successfully`, func() { - // Construct an instance of the UpdateVPNGatewayOptions model - id := "testString" - vpnGatewayPatch := map[string]interface{}{"anyKey": "anyValue"} - updateVPNGatewayOptionsModel := vpcService.NewUpdateVPNGatewayOptions(id, vpnGatewayPatch) - updateVPNGatewayOptionsModel.SetID("testString") - updateVPNGatewayOptionsModel.SetVPNGatewayPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateVPNGatewayOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateVPNGatewayOptionsModel).ToNot(BeNil()) - Expect(updateVPNGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPNGatewayOptionsModel.VPNGatewayPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateVPNGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateVPNServerOptions successfully`, func() { - // Construct an instance of the UpdateVPNServerOptions model - id := "testString" - vpnServerPatch := map[string]interface{}{"anyKey": "anyValue"} - updateVPNServerOptionsModel := vpcService.NewUpdateVPNServerOptions(id, vpnServerPatch) - updateVPNServerOptionsModel.SetID("testString") - updateVPNServerOptionsModel.SetVPNServerPatch(map[string]interface{}{"anyKey": "anyValue"}) - updateVPNServerOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) - updateVPNServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateVPNServerOptionsModel).ToNot(BeNil()) - Expect(updateVPNServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPNServerOptionsModel.VPNServerPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateVPNServerOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) - Expect(updateVPNServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewUpdateVPNServerRouteOptions successfully`, func() { - // Construct an instance of the UpdateVPNServerRouteOptions model - vpnServerID := "testString" - id := "testString" - vpnServerRoutePatch := map[string]interface{}{"anyKey": "anyValue"} - updateVPNServerRouteOptionsModel := vpcService.NewUpdateVPNServerRouteOptions(vpnServerID, id, vpnServerRoutePatch) - updateVPNServerRouteOptionsModel.SetVPNServerID("testString") - updateVPNServerRouteOptionsModel.SetID("testString") - updateVPNServerRouteOptionsModel.SetVPNServerRoutePatch(map[string]interface{}{"anyKey": "anyValue"}) - updateVPNServerRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateVPNServerRouteOptionsModel).ToNot(BeNil()) - Expect(updateVPNServerRouteOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPNServerRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(updateVPNServerRouteOptionsModel.VPNServerRoutePatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateVPNServerRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewVolumeAttachmentPrototype successfully`, func() { - var volume vpcv1.VolumeAttachmentPrototypeVolumeIntf = nil - _, err := vpcService.NewVolumeAttachmentPrototype(volume) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewVolumeAttachmentPrototypeInstanceByImageContext successfully`, func() { - var volume *vpcv1.VolumePrototypeInstanceByImageContext = nil - _, err := vpcService.NewVolumeAttachmentPrototypeInstanceByImageContext(volume) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext successfully`, func() { - var volume *vpcv1.VolumePrototypeInstanceBySourceSnapshotContext = nil - _, err := vpcService.NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(volume) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewVolumePrototypeInstanceByImageContext successfully`, func() { - var profile vpcv1.VolumeProfileIdentityIntf = nil - _, err := vpcService.NewVolumePrototypeInstanceByImageContext(profile) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewVolumePrototypeInstanceBySourceSnapshotContext successfully`, func() { - var profile vpcv1.VolumeProfileIdentityIntf = nil - var sourceSnapshot vpcv1.SnapshotIdentityIntf = nil - _, err := vpcService.NewVolumePrototypeInstanceBySourceSnapshotContext(profile, sourceSnapshot) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype successfully`, func() { - var subnet vpcv1.SubnetIdentityIntf = nil - interfaceType := "hipersocket" - _, err := vpcService.NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(subnet, interfaceType) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype successfully`, func() { - var subnet vpcv1.SubnetIdentityIntf = nil - interfaceType := "pci" - _, err := vpcService.NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(subnet, interfaceType) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype successfully`, func() { - var subnet vpcv1.SubnetIdentityIntf = nil - interfaceType := "vlan" - vlan := int64(4) - _, err := vpcService.NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(subnet, interfaceType, vlan) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewBareMetalServerProfileIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/bare_metal_servers/profiles/bx2-metal-192x768" - _model, err := vpcService.NewBareMetalServerProfileIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewBareMetalServerProfileIdentityByName successfully`, func() { - name := "bx2-metal-192x768" - _model, err := vpcService.NewBareMetalServerProfileIdentityByName(name) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewCatalogOfferingIdentityCatalogOfferingByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:offering:00111601-0ec5-41ac-b142-96d1e64e6442" - _model, err := vpcService.NewCatalogOfferingIdentityCatalogOfferingByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:globalcatalog-collection:global:a/123456:1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc:version:00111601-0ec5-41ac-b142-96d1e64e6442/ec66bec2-6a33-42d6-9323-26dd4dc8875d" - _model, err := vpcService.NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewCertificateInstanceIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5" - _model, err := vpcService.NewCertificateInstanceIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewDedicatedHostGroupIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group: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" - _model, err := vpcService.NewDedicatedHostGroupIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewDedicatedHostGroupIdentityByID successfully`, func() { - id := "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" - _model, err := vpcService.NewDedicatedHostGroupIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewDedicatedHostProfileIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/dedicated_host/profiles/mx2-host-152x1216" - _model, err := vpcService.NewDedicatedHostProfileIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewDedicatedHostProfileIdentityByName successfully`, func() { - name := "mx2-host-152x1216" - _model, err := vpcService.NewDedicatedHostProfileIdentityByName(name) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewDedicatedHostPrototypeDedicatedHostByGroup successfully`, func() { - var profile vpcv1.DedicatedHostProfileIdentityIntf = nil - var group vpcv1.DedicatedHostGroupIdentityIntf = nil - _, err := vpcService.NewDedicatedHostPrototypeDedicatedHostByGroup(profile, group) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewDedicatedHostPrototypeDedicatedHostByZone successfully`, func() { - var profile vpcv1.DedicatedHostProfileIdentityIntf = nil - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewDedicatedHostPrototypeDedicatedHostByZone(profile, zone) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewEncryptionKeyIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:kms:us-south:a/dffc98a0f1f0f95f6613b3b752286b87:e4a29d1a-2ef0-42a6-8fd2-350deb1c647e:key:5437653b-c4b1-447f-9646-b2a2a4cd6179" - _model, err := vpcService.NewEncryptionKeyIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext successfully`, func() { - var subnet vpcv1.SubnetIdentityIntf = nil - _, err := vpcService.NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext(subnet) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e" - _model, err := vpcService.NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID successfully`, func() { - id := "10c02d81-0ecb-4dc5-897d-28392913b81e" - _model, err := vpcService.NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewFloatingIPPrototypeFloatingIPByTarget successfully`, func() { - var target vpcv1.FloatingIPByTargetNetworkInterfaceIdentityIntf = nil - _, err := vpcService.NewFloatingIPPrototypeFloatingIPByTarget(target) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewFloatingIPPrototypeFloatingIPByZone successfully`, func() { - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewFloatingIPPrototypeFloatingIPByZone(zone) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewFloatingIPTargetPatchNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e" - _model, err := vpcService.NewFloatingIPTargetPatchNetworkInterfaceIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewFloatingIPTargetPatchNetworkInterfaceIdentityByID successfully`, func() { - id := "10c02d81-0ecb-4dc5-897d-28392913b81e" - _model, err := vpcService.NewFloatingIPTargetPatchNetworkInterfaceIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewImageIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/123456::image:72b27b5c-f4b0-48bb-b954-5becc7c1dcb8" - _model, err := vpcService.NewImageIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewImageIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/images/72b27b5c-f4b0-48bb-b954-5becc7c1dcb8" - _model, err := vpcService.NewImageIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewImageIdentityByID successfully`, func() { - id := "72b27b5c-f4b0-48bb-b954-5becc7c1dcb8" - _model, err := vpcService.NewImageIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewImagePrototypeImageByFile successfully`, func() { - var file *vpcv1.ImageFilePrototype = nil - var operatingSystem vpcv1.OperatingSystemIdentityIntf = nil - _, err := vpcService.NewImagePrototypeImageByFile(file, operatingSystem) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewImagePrototypeImageBySourceVolume successfully`, func() { - var sourceVolume vpcv1.VolumeIdentityIntf = nil - _, err := vpcService.NewImagePrototypeImageBySourceVolume(sourceVolume) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering successfully`, func() { - var offering vpcv1.CatalogOfferingIdentityIntf = nil - _, err := vpcService.NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(offering) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion successfully`, func() { - var version vpcv1.CatalogOfferingVersionIdentityIntf = nil - _, err := vpcService.NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(version) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype successfully`, func() { - metricType := "cpu" - metricValue := int64(38) - policyType := "target" - _model, err := vpcService.NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype(metricType, metricValue, policyType) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype successfully`, func() { - managerType := "autoscale" - maxMembershipCount := int64(10) - _model, err := vpcService.NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype(managerType, maxMembershipCount) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype successfully`, func() { - managerType := "scheduled" - _model, err := vpcService.NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype(managerType) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstancePatchProfileInstanceProfileIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16" - _model, err := vpcService.NewInstancePatchProfileInstanceProfileIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstancePatchProfileInstanceProfileIdentityByName successfully`, func() { - name := "bx2-4x16" - _model, err := vpcService.NewInstancePatchProfileInstanceProfileIdentityByName(name) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstanceProfileIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/instance/profiles/bx2-4x16" - _model, err := vpcService.NewInstanceProfileIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstanceProfileIdentityByName successfully`, func() { - name := "bx2-4x16" - _model, err := vpcService.NewInstanceProfileIdentityByName(name) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstancePrototypeInstanceByCatalogOffering successfully`, func() { - var catalogOffering vpcv1.InstanceCatalogOfferingPrototypeIntf = nil - var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewInstancePrototypeInstanceByCatalogOffering(catalogOffering, primaryNetworkInterface, zone) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstancePrototypeInstanceByImage successfully`, func() { - var image vpcv1.ImageIdentityIntf = nil - var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewInstancePrototypeInstanceByImage(image, primaryNetworkInterface, zone) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstancePrototypeInstanceBySourceSnapshot successfully`, func() { - var bootVolumeAttachment *vpcv1.VolumeAttachmentPrototypeInstanceBySourceSnapshotContext = nil - var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewInstancePrototypeInstanceBySourceSnapshot(bootVolumeAttachment, primaryNetworkInterface, zone) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstancePrototypeInstanceBySourceTemplate successfully`, func() { - var sourceTemplate vpcv1.InstanceTemplateIdentityIntf = nil - _, err := vpcService.NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstanceTemplateIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::instance-template:1e09281b-f177-46fb-baf1-bc152b2e391a" - _model, err := vpcService.NewInstanceTemplateIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstanceTemplateIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/instance/templates/1e09281b-f177-46fb-baf1-bc152b2e391a" - _model, err := vpcService.NewInstanceTemplateIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstanceTemplateIdentityByID successfully`, func() { - id := "a6b1a881-2ce8-41a3-80fc-36316a73f803" - _model, err := vpcService.NewInstanceTemplateIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstanceTemplatePrototypeInstanceByCatalogOffering successfully`, func() { - var catalogOffering vpcv1.InstanceCatalogOfferingPrototypeIntf = nil - var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewInstanceTemplatePrototypeInstanceByCatalogOffering(catalogOffering, primaryNetworkInterface, zone) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstanceTemplatePrototypeInstanceByImage successfully`, func() { - var image vpcv1.ImageIdentityIntf = nil - var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewInstanceTemplatePrototypeInstanceByImage(image, primaryNetworkInterface, zone) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstanceTemplatePrototypeInstanceBySourceSnapshot successfully`, func() { - var bootVolumeAttachment *vpcv1.VolumeAttachmentPrototypeInstanceBySourceSnapshotContext = nil - var primaryNetworkInterface *vpcv1.NetworkInterfacePrototype = nil - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewInstanceTemplatePrototypeInstanceBySourceSnapshot(bootVolumeAttachment, primaryNetworkInterface, zone) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstanceTemplatePrototypeInstanceBySourceTemplate successfully`, func() { - var sourceTemplate vpcv1.InstanceTemplateIdentityIntf = nil - _, err := vpcService.NewInstanceTemplatePrototypeInstanceBySourceTemplate(sourceTemplate) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewKeyIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/123456::key:a6b1a881-2ce8-41a3-80fc-36316a73f803" - _model, err := vpcService.NewKeyIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewKeyIdentityByFingerprint successfully`, func() { - fingerprint := "SHA256:yxavE4CIOL2NlsqcurRO3xGjkP6m/0mp8ugojH5yxlY" - _model, err := vpcService.NewKeyIdentityByFingerprint(fingerprint) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewKeyIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/keys/a6b1a881-2ce8-41a3-80fc-36316a73f803" - _model, err := vpcService.NewKeyIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewKeyIdentityByID successfully`, func() { - id := "a6b1a881-2ce8-41a3-80fc-36316a73f803" - _model, err := vpcService.NewKeyIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName successfully`, func() { - name := "bucket-27200-lwx4cfvcue" - _model, err := vpcService.NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(name) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/123456::load-balancer:dd754295-e9e0-4c9d-bf6c-58fbc59e5727" - _model, err := vpcService.NewLoadBalancerIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727" - _model, err := vpcService.NewLoadBalancerIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerIdentityByID successfully`, func() { - id := "dd754295-e9e0-4c9d-bf6c-58fbc59e5727" - _model, err := vpcService.NewLoadBalancerIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerListenerIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/listeners/70294e14-4e61-11e8-bcf4-0242ac110004" - _model, err := vpcService.NewLoadBalancerListenerIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerListenerIdentityByID successfully`, func() { - id := "70294e14-4e61-11e8-bcf4-0242ac110004" - _model, err := vpcService.NewLoadBalancerListenerIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype successfully`, func() { - httpStatusCode := int64(301) - var listener vpcv1.LoadBalancerListenerIdentityIntf = nil - _, err := vpcService.NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode, listener) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype successfully`, func() { - httpStatusCode := int64(301) - url := "https://www.redirect.com" - _model, err := vpcService.NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(httpStatusCode, url) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerPoolIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004" - _model, err := vpcService.NewLoadBalancerPoolIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerPoolIdentityByID successfully`, func() { - id := "70294e14-4e61-11e8-bcf4-0242ac110004" - _model, err := vpcService.NewLoadBalancerPoolIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerPoolMemberTargetPrototypeIP successfully`, func() { - address := "192.168.3.4" - _model, err := vpcService.NewLoadBalancerPoolMemberTargetPrototypeIP(address) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerProfileIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/load_balancer/profiles/network-fixed" - _model, err := vpcService.NewLoadBalancerProfileIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerProfileIdentityByName successfully`, func() { - name := "network-fixed" - _model, err := vpcService.NewLoadBalancerProfileIdentityByName(name) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkACLIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf" - _model, err := vpcService.NewNetworkACLIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkACLIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf" - _model, err := vpcService.NewNetworkACLIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkACLIdentityByID successfully`, func() { - id := "a4e28308-8ee7-46ab-8108-9f881f22bdbf" - _model, err := vpcService.NewNetworkACLIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkACLPrototypeNetworkACLByRules successfully`, func() { - var vpc vpcv1.VPCIdentityIntf = nil - _, err := vpcService.NewNetworkACLPrototypeNetworkACLByRules(vpc) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewNetworkACLPrototypeNetworkACLBySourceNetworkACL successfully`, func() { - var vpc vpcv1.VPCIdentityIntf = nil - var sourceNetworkACL vpcv1.NetworkACLIdentityIntf = nil - _, err := vpcService.NewNetworkACLPrototypeNetworkACLBySourceNetworkACL(vpc, sourceNetworkACL) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9" - _model, err := vpcService.NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID successfully`, func() { - id := "8daca77a-4980-4d33-8f3e-7038797be8f9" - _model, err := vpcService.NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9" - _model, err := vpcService.NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID successfully`, func() { - id := "8daca77a-4980-4d33-8f3e-7038797be8f9" - _model, err := vpcService.NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype successfully`, func() { - action := "allow" - destination := "192.168.3.2/32" - direction := "inbound" - source := "192.168.3.2/32" - protocol := "all" - _model, err := vpcService.NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(action, destination, direction, source, protocol) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype successfully`, func() { - action := "allow" - destination := "192.168.3.2/32" - direction := "inbound" - source := "192.168.3.2/32" - protocol := "icmp" - _model, err := vpcService.NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(action, destination, direction, source, protocol) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype successfully`, func() { - action := "allow" - destination := "192.168.3.2/32" - direction := "inbound" - source := "192.168.3.2/32" - protocol := "udp" - _model, err := vpcService.NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(action, destination, direction, source, protocol) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype successfully`, func() { - action := "allow" - destination := "192.168.3.2/32" - direction := "inbound" - source := "192.168.3.2/32" - protocol := "all" - _model, err := vpcService.NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(action, destination, direction, source, protocol) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype successfully`, func() { - action := "allow" - destination := "192.168.3.2/32" - direction := "inbound" - source := "192.168.3.2/32" - protocol := "icmp" - _model, err := vpcService.NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(action, destination, direction, source, protocol) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype successfully`, func() { - action := "allow" - destination := "192.168.3.2/32" - direction := "inbound" - source := "192.168.3.2/32" - protocol := "udp" - _model, err := vpcService.NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(action, destination, direction, source, protocol) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewOperatingSystemIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/operating_systems/ubuntu-16-amd64" - _model, err := vpcService.NewOperatingSystemIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewOperatingSystemIdentityByName successfully`, func() { - name := "ubuntu-16-amd64" - _model, err := vpcService.NewOperatingSystemIdentityByName(name) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewPublicGatewayIdentityPublicGatewayIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241" - _model, err := vpcService.NewPublicGatewayIdentityPublicGatewayIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewPublicGatewayIdentityPublicGatewayIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241" - _model, err := vpcService.NewPublicGatewayIdentityPublicGatewayIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewPublicGatewayIdentityPublicGatewayIdentityByID successfully`, func() { - id := "dc5431ef-1fc6-4861-adc9-a59d077d1241" - _model, err := vpcService.NewPublicGatewayIdentityPublicGatewayIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewResourceGroupIdentityByID successfully`, func() { - id := "fee82deba12e4c0fb69c3b09d1f12345" - _model, err := vpcService.NewResourceGroupIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP successfully`, func() { - address := "192.168.3.4" - _model, err := vpcService.NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(address) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewRoutingTableIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840" - _model, err := vpcService.NewRoutingTableIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewRoutingTableIdentityByID successfully`, func() { - id := "1a15dca5-7e33-45e1-b7c5-bc690e569531" - _model, err := vpcService.NewRoutingTableIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" - _model, err := vpcService.NewSecurityGroupIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" - _model, err := vpcService.NewSecurityGroupIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupIdentityByID successfully`, func() { - id := "be5df5ca-12a0-494b-907e-aa6ec2bfa271" - _model, err := vpcService.NewSecurityGroupIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll successfully`, func() { - direction := "inbound" - protocol := "all" - _model, err := vpcService.NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(direction, protocol) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp successfully`, func() { - direction := "inbound" - protocol := "icmp" - _model, err := vpcService.NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(direction, protocol) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp successfully`, func() { - direction := "inbound" - protocol := "udp" - _model, err := vpcService.NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(direction, protocol) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupRuleRemotePatchCIDR successfully`, func() { - cidrBlock := "192.168.3.0/24" - _model, err := vpcService.NewSecurityGroupRuleRemotePatchCIDR(cidrBlock) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupRuleRemotePatchIP successfully`, func() { - address := "192.168.3.4" - _model, err := vpcService.NewSecurityGroupRuleRemotePatchIP(address) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupRuleRemotePrototypeCIDR successfully`, func() { - cidrBlock := "192.168.3.0/24" - _model, err := vpcService.NewSecurityGroupRuleRemotePrototypeCIDR(cidrBlock) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupRuleRemotePrototypeIP successfully`, func() { - address := "192.168.3.4" - _model, err := vpcService.NewSecurityGroupRuleRemotePrototypeIP(address) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSnapshotIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/123456::snapshot:r134-f6bfa329-0e36-433f-a3bb-0df632e79263" - _model, err := vpcService.NewSnapshotIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSnapshotIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/snapshots/r134-f6bfa329-0e36-433f-a3bb-0df632e79263" - _model, err := vpcService.NewSnapshotIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSnapshotIdentityByID successfully`, func() { - id := "r134-f6bfa329-0e36-433f-a3bb-0df632e79263" - _model, err := vpcService.NewSnapshotIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSnapshotPrototypeSnapshotBySourceVolume successfully`, func() { - var sourceVolume vpcv1.VolumeIdentityIntf = nil - _, err := vpcService.NewSnapshotPrototypeSnapshotBySourceVolume(sourceVolume) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewSubnetIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - _model, err := vpcService.NewSubnetIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSubnetIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - _model, err := vpcService.NewSubnetIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSubnetIdentityByID successfully`, func() { - id := "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - _model, err := vpcService.NewSubnetIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSubnetPrototypeSubnetByCIDR successfully`, func() { - var vpc vpcv1.VPCIdentityIntf = nil - ipv4CIDRBlock := "10.0.0.0/24" - _, err := vpcService.NewSubnetPrototypeSubnetByCIDR(vpc, ipv4CIDRBlock) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewSubnetPrototypeSubnetByTotalCount successfully`, func() { - var vpc vpcv1.VPCIdentityIntf = nil - totalIpv4AddressCount := int64(256) - var zone vpcv1.ZoneIdentityIntf = nil - _, err := vpcService.NewSubnetPrototypeSubnetByTotalCount(vpc, totalIpv4AddressCount, zone) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::public-gateway:dc5431ef-1fc6-4861-adc9-a59d077d1241" - _model, err := vpcService.NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/public_gateways/dc5431ef-1fc6-4861-adc9-a59d077d1241" - _model, err := vpcService.NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSubnetPublicGatewayPatchPublicGatewayIdentityByID successfully`, func() { - id := "dc5431ef-1fc6-4861-adc9-a59d077d1241" - _model, err := vpcService.NewSubnetPublicGatewayPatchPublicGatewayIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewTrustedProfileIdentityTrustedProfileByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:iam-identity::a/123456::profile:Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5" - _model, err := vpcService.NewTrustedProfileIdentityTrustedProfileByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewTrustedProfileIdentityTrustedProfileByID successfully`, func() { - id := "Profile-9fd84246-7df4-4667-94e4-8ecde51d5ac5" - _model, err := vpcService.NewTrustedProfileIdentityTrustedProfileByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPCIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b" - _model, err := vpcService.NewVPCIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPCIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b" - _model, err := vpcService.NewVPCIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPCIdentityByID successfully`, func() { - id := "4727d842-f94f-4a2d-824a-9bc9b02c523b" - _model, err := vpcService.NewVPCIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b" - _model, err := vpcService.NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID successfully`, func() { - id := "ddf51bec-3424-11e8-b467-0ed5f89f718b" - _model, err := vpcService.NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/ike_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b" - _model, err := vpcService.NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID successfully`, func() { - id := "ddf51bec-3424-11e8-b467-0ed5f89f718b" - _model, err := vpcService.NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b" - _model, err := vpcService.NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID successfully`, func() { - id := "ddf51bec-3424-11e8-b467-0ed5f89f718b" - _model, err := vpcService.NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/ipsec_policies/ddf51bec-3424-11e8-b467-0ed5f89f718b" - _model, err := vpcService.NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID successfully`, func() { - id := "ddf51bec-3424-11e8-b467-0ed5f89f718b" - _model, err := vpcService.NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype successfully`, func() { - peerAddress := "169.21.50.5" - psk := "lkj14b1oi0alcniejkso" - localCIDRs := []string{"192.168.1.0/24"} - peerCIDRs := []string{"10.45.1.0/24"} - _model, err := vpcService.NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(peerAddress, psk, localCIDRs, peerCIDRs) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype successfully`, func() { - peerAddress := "169.21.50.5" - psk := "lkj14b1oi0alcniejkso" - _model, err := vpcService.NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(peerAddress, psk) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype successfully`, func() { - var subnet vpcv1.SubnetIdentityIntf = nil - _, err := vpcService.NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewVPNGatewayPrototypeVPNGatewayRouteModePrototype successfully`, func() { - var subnet vpcv1.SubnetIdentityIntf = nil - _, err := vpcService.NewVPNGatewayPrototypeVPNGatewayRouteModePrototype(subnet) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewVPNServerAuthenticationByUsernameIDProviderByIam successfully`, func() { - providerType := "iam" - _model, err := vpcService.NewVPNServerAuthenticationByUsernameIDProviderByIam(providerType) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype successfully`, func() { - method := "certificate" - var clientCa vpcv1.CertificateInstanceIdentityIntf = nil - _, err := vpcService.NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(method, clientCa) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype successfully`, func() { - method := "username" - var identityProvider vpcv1.VPNServerAuthenticationByUsernameIDProviderIntf = nil - _, err := vpcService.NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(method, identityProvider) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewVolumeIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5" - _model, err := vpcService.NewVolumeIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVolumeIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5" - _model, err := vpcService.NewVolumeIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVolumeIdentityByID successfully`, func() { - id := "1a6b7274-678d-4dfb-8981-c71dd9d4daa5" - _model, err := vpcService.NewVolumeIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVolumeProfileIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/volume/profiles/general-purpose" - _model, err := vpcService.NewVolumeProfileIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVolumeProfileIdentityByName successfully`, func() { - name := "general-purpose" - _model, err := vpcService.NewVolumeProfileIdentityByName(name) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVolumePrototypeVolumeByCapacity successfully`, func() { - var profile vpcv1.VolumeProfileIdentityIntf = nil - var zone vpcv1.ZoneIdentityIntf = nil - capacity := int64(100) - _, err := vpcService.NewVolumePrototypeVolumeByCapacity(profile, zone, capacity) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewVolumePrototypeVolumeBySourceSnapshot successfully`, func() { - var profile vpcv1.VolumeProfileIdentityIntf = nil - var zone vpcv1.ZoneIdentityIntf = nil - var sourceSnapshot vpcv1.SnapshotIdentityIntf = nil - _, err := vpcService.NewVolumePrototypeVolumeBySourceSnapshot(profile, zone, sourceSnapshot) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewZoneIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1" - _model, err := vpcService.NewZoneIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewZoneIdentityByName successfully`, func() { - name := "us-south-1" - _model, err := vpcService.NewZoneIdentityByName(name) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" - _model, err := vpcService.NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID successfully`, func() { - id := "6d353a0f-aeb1-4ae1-832e-1110d10981bb" - _model, err := vpcService.NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN successfully`, func() { - resourceType := "provider_cloud_service" - crn := "crn:v1:bluemix:public:cloudant:us-south:a/123456:3527280b-9327-4411-8020-591092e60353::" - _model, err := vpcService.NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(resourceType, crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName successfully`, func() { - resourceType := "provider_cloud_service" - name := "ibm-ntp-server" - _model, err := vpcService.NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(resourceType, name) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a" - _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/1e09281b-f177-46fb-baf1-bc152b2e391a" - _model, err := vpcService.NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID successfully`, func() { - id := "1e09281b-f177-46fb-baf1-bc152b2e391a" - _model, err := vpcService.NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e" - _model, err := vpcService.NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID successfully`, func() { - id := "10c02d81-0ecb-4dc5-897d-28392913b81e" - _model, err := vpcService.NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - _model, err := vpcService.NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - _model, err := vpcService.NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID successfully`, func() { - id := "7ec86020-1c6e-4889-b3f0-a15f2e50f87e" - _model, err := vpcService.NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b" - _model, err := vpcService.NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b" - _model, err := vpcService.NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID successfully`, func() { - id := "4727d842-f94f-4a2d-824a-9bc9b02c523b" - _model, err := vpcService.NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(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) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID successfully`, func() { - id := "1e09281b-f177-46fb-baf1-bc152b2e391a" - _model, err := vpcService.NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group: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" - _model, err := vpcService.NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID successfully`, func() { - id := "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" - _model, err := vpcService.NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a" - _model, err := vpcService.NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a" - _model, err := vpcService.NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID successfully`, func() { - id := "1e09281b-f177-46fb-baf1-bc152b2e391a" - _model, err := vpcService.NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host-group: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" - _model, err := vpcService.NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID successfully`, func() { - id := "bcc5b834-1258-4b9c-c3b4-43bc9cf5cde0" - _model, err := vpcService.NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::dedicated-host:1e09281b-f177-46fb-baf1-bc152b2e391a" - _model, err := vpcService.NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/dedicated_hosts/1e09281b-f177-46fb-baf1-bc152b2e391a" - _model, err := vpcService.NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID successfully`, func() { - id := "1e09281b-f177-46fb-baf1-bc152b2e391a" - _model, err := vpcService.NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/123456::placement-group:r018-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" - _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" - _model, err := vpcService.NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004" - _model, err := vpcService.NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID successfully`, func() { - id := "70294e14-4e61-11e8-bcf4-0242ac110004" - _model, err := vpcService.NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/load_balancers/dd754295-e9e0-4c9d-bf6c-58fbc59e5727/pools/70294e14-4e61-11e8-bcf4-0242ac110004" - _model, err := vpcService.NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID successfully`, func() { - id := "70294e14-4e61-11e8-bcf4-0242ac110004" - _model, err := vpcService.NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::instance:1e09281b-f177-46fb-baf1-bc152b2e391a" - _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/1e09281b-f177-46fb-baf1-bc152b2e391a" - _model, err := vpcService.NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID successfully`, func() { - id := "1e09281b-f177-46fb-baf1-bc152b2e391a" - _model, err := vpcService.NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb" - _model, err := vpcService.NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID successfully`, func() { - id := "6d353a0f-aeb1-4ae1-832e-1110d10981bb" - _model, err := vpcService.NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress successfully`, func() { - address := "203.0.113.1" - _model, err := vpcService.NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress(address) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::floating-ip:39300233-9995-4806-89a5-3c1b6eb88689" - _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" - _model, err := vpcService.NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID successfully`, func() { - id := "39300233-9995-4806-89a5-3c1b6eb88689" - _model, err := vpcService.NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5" - _model, err := vpcService.NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5" - _model, err := vpcService.NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID successfully`, func() { - id := "d7cc5196-9864-48c4-82d8-3f30da41fcc5" - _model, err := vpcService.NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b" - _model, err := vpcService.NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID successfully`, func() { - id := "a10a5771-dc23-442c-8460-c3601d8542f7" - _model, err := vpcService.NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" - _model, err := vpcService.NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" - _model, err := vpcService.NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID successfully`, func() { - id := "be5df5ca-12a0-494b-907e-aa6ec2bfa271" - _model, err := vpcService.NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271" - _model, err := vpcService.NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271" - _model, err := vpcService.NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID successfully`, func() { - id := "be5df5ca-12a0-494b-907e-aa6ec2bfa271" - _model, err := vpcService.NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN successfully`, func() { - crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5" - _model, err := vpcService.NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN(crn) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref successfully`, func() { - href := "https://us-south.iaas.cloud.ibm.com/v1/volumes/1a6b7274-678d-4dfb-8981-c71dd9d4daa5" - _model, err := vpcService.NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref(href) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID successfully`, func() { - id := "1a6b7274-678d-4dfb-8981-c71dd9d4daa5" - _model, err := vpcService.NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(id) - Expect(_model).ToNot(BeNil()) - Expect(err).To(BeNil()) - }) - It(`Invoke NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity successfully`, func() { - var profile vpcv1.VolumeProfileIdentityIntf = nil - capacity := int64(100) - _, err := vpcService.NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(profile, capacity) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot successfully`, func() { - var profile vpcv1.VolumeProfileIdentityIntf = nil - var sourceSnapshot vpcv1.SnapshotIdentityIntf = nil - _, err := vpcService.NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(profile, sourceSnapshot) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup successfully`, func() { - var group *vpcv1.InstanceGroupManagerScheduledActionGroupPrototype = nil - _, err := vpcService.NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup(group) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager successfully`, func() { - var manager vpcv1.InstanceGroupManagerScheduledActionManagerPrototypeIntf = nil - _, err := vpcService.NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager(manager) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup successfully`, func() { - var group *vpcv1.InstanceGroupManagerScheduledActionGroupPrototype = nil - _, err := vpcService.NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup(group) - Expect(err).ToNot(BeNil()) - }) - It(`Invoke NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager successfully`, func() { - var manager vpcv1.InstanceGroupManagerScheduledActionManagerPrototypeIntf = nil - _, err := vpcService.NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager(manager) - Expect(err).ToNot(BeNil()) - }) - }) - }) - Describe(`Utility function tests`, func() { - It(`Invoke CreateMockByteArray() successfully`, func() { - mockByteArray := CreateMockByteArray("This is a test") - Expect(mockByteArray).ToNot(BeNil()) - }) - It(`Invoke CreateMockUUID() successfully`, func() { - mockUUID := CreateMockUUID("9fab83da-98cb-4f18-a7ba-b6f0435c9673") - Expect(mockUUID).ToNot(BeNil()) - }) - It(`Invoke CreateMockReader() successfully`, func() { - mockReader := CreateMockReader("This is a test.") - Expect(mockReader).ToNot(BeNil()) - }) - It(`Invoke CreateMockDate() successfully`, func() { - mockDate := CreateMockDate("2019-01-01") - Expect(mockDate).ToNot(BeNil()) - }) - It(`Invoke CreateMockDateTime() successfully`, func() { - mockDateTime := CreateMockDateTime("2019-01-01T12:00:00.000Z") - Expect(mockDateTime).ToNot(BeNil()) - }) - }) -}) - -// -// Utility functions used by the generated test code -// - -func CreateMockByteArray(mockData string) *[]byte { - ba := make([]byte, 0) - ba = append(ba, mockData...) - return &ba -} - -func CreateMockUUID(mockData string) *strfmt.UUID { - uuid := strfmt.UUID(mockData) - return &uuid -} - -func CreateMockReader(mockData string) io.ReadCloser { - return io.NopCloser(bytes.NewReader([]byte(mockData))) -} - -func CreateMockDate(mockData string) *strfmt.Date { - d, err := core.ParseDate(mockData) - if err != nil { - return nil - } - return &d -} - -func CreateMockDateTime(mockData string) *strfmt.DateTime { - d, err := core.ParseDateTime(mockData) - if err != nil { - return nil - } - return &d -} - -func SetTestEnvironment(testEnvironment map[string]string) { - for key, value := range testEnvironment { - os.Setenv(key, value) - } -} - -func ClearTestEnvironment(testEnvironment map[string]string) { - for key := range testEnvironment { - os.Unsetenv(key) - } -} From 186fcad223196f2fd7a97545cd62dda64ad21b78 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 9 Mar 2023 09:12:59 +0530 Subject: [PATCH 022/103] sdk update --- common/github.com/IBM/vpc-go-sdk/go.mod | 2 +- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 378 +++++++++++++----- 2 files changed, 273 insertions(+), 107 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/go.mod b/common/github.com/IBM/vpc-go-sdk/go.mod index 19fdf6d00a..466fa3d20e 100644 --- a/common/github.com/IBM/vpc-go-sdk/go.mod +++ b/common/github.com/IBM/vpc-go-sdk/go.mod @@ -3,7 +3,7 @@ module github.com/IBM/vpc-go-sdk go 1.16 require ( - github.com/IBM/go-sdk-core/v5 v5.12.0 + github.com/IBM/go-sdk-core/v5 v5.12.1 github.com/go-openapi/strfmt v0.21.3 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.20.0 diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 15f553296b..e8f3c7bad2 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.63.0-5dae26c1-20230111-193039 + * IBM OpenAPI SDK Code Generator Version: 3.65.0-79fc0b8f-20230209-215651 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -37,17 +37,17 @@ 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: 2023-02-07 +// API Version: 2023-03-07 type VpcV1 struct { Service *core.BaseService - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and today's date (UTC). - Version *string - // The infrastructure generation. For the API behavior documented here, specify // `2`. generation *int64 + + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` + // and today's date (UTC). + Version *string } // DefaultServiceURL is the default URL to make service requests to. @@ -126,8 +126,8 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { service = &VpcV1{ Service: baseService, - Version: options.Version, generation: core.Int64Ptr(2), + Version: options.Version, } return @@ -19009,6 +19009,9 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre 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 } @@ -27445,6 +27448,9 @@ type CreateLoadBalancerListenerOptions struct { // `protocol` of `http`, and the target 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. + IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` + // The policy prototype objects for this listener. The load balancer must be in the // `application` family. Policies []LoadBalancerListenerPolicyPrototype `json:"policies,omitempty"` @@ -27548,6 +27554,12 @@ func (_options *CreateLoadBalancerListenerOptions) SetHTTPSRedirect(httpsRedirec return _options } +// SetIdleConnectionTimeout : Allow user to set IdleConnectionTimeout +func (_options *CreateLoadBalancerListenerOptions) SetIdleConnectionTimeout(idleConnectionTimeout int64) *CreateLoadBalancerListenerOptions { + _options.IdleConnectionTimeout = core.Int64Ptr(idleConnectionTimeout) + return _options +} + // SetPolicies : Allow user to set Policies func (_options *CreateLoadBalancerListenerOptions) SetPolicies(policies []LoadBalancerListenerPolicyPrototype) *CreateLoadBalancerListenerOptions { _options.Policies = policies @@ -39003,7 +39015,7 @@ type Instance struct { // The enumerated reason code values for this property will expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected reason code was encountered. - LifecycleReasons []LifecycleReason `json:"lifecycle_reasons" validate:"required"` + LifecycleReasons []InstanceLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the virtual server instance. LifecycleState *string `json:"lifecycle_state" validate:"required"` @@ -39160,7 +39172,7 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er if err != nil { return } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalLifecycleReason) + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceLifecycleReason) if err != nil { return } @@ -39372,22 +39384,14 @@ func UnmarshalInstanceAvailabilityPolicy(m map[string]json.RawMessage, result in type InstanceAvailabilityPolicyPatch struct { // The action to perform if the compute host experiences a failure. // - `restart`: Automatically restart the virtual server instance after host failure - // - `stop`: Leave the virtual server instance stopped after host failure - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the - // unexpected property value was encountered. + // - `stop`: Leave the virtual server instance stopped after host failure. HostFailure *string `json:"host_failure,omitempty"` } // Constants associated with the InstanceAvailabilityPolicyPatch.HostFailure property. // The action to perform if the compute host experiences a failure. // - `restart`: Automatically restart the virtual server instance after host failure -// - `stop`: Leave the virtual server instance stopped after host failure -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the -// unexpected property value was encountered. +// - `stop`: Leave the virtual server instance stopped after host failure. const ( InstanceAvailabilityPolicyPatchHostFailureRestartConst = "restart" InstanceAvailabilityPolicyPatchHostFailureStopConst = "stop" @@ -39404,34 +39408,26 @@ func UnmarshalInstanceAvailabilityPolicyPatch(m map[string]json.RawMessage, resu return } -// InstanceAvailabilityPrototype : InstanceAvailabilityPrototype struct -type InstanceAvailabilityPrototype struct { +// InstanceAvailabilityPolicyPrototype : InstanceAvailabilityPolicyPrototype struct +type InstanceAvailabilityPolicyPrototype struct { // The action to perform if the compute host experiences a failure. // - `restart`: Automatically restart the virtual server instance after host failure - // - `stop`: Leave the virtual server instance stopped after host failure - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the - // unexpected property value was encountered. + // - `stop`: Leave the virtual server instance stopped after host failure. HostFailure *string `json:"host_failure,omitempty"` } -// Constants associated with the InstanceAvailabilityPrototype.HostFailure property. +// Constants associated with the InstanceAvailabilityPolicyPrototype.HostFailure property. // The action to perform if the compute host experiences a failure. // - `restart`: Automatically restart the virtual server instance after host failure -// - `stop`: Leave the virtual server instance stopped after host failure -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the -// unexpected property value was encountered. +// - `stop`: Leave the virtual server instance stopped after host failure. const ( - InstanceAvailabilityPrototypeHostFailureRestartConst = "restart" - InstanceAvailabilityPrototypeHostFailureStopConst = "stop" + InstanceAvailabilityPolicyPrototypeHostFailureRestartConst = "restart" + InstanceAvailabilityPolicyPrototypeHostFailureStopConst = "stop" ) -// UnmarshalInstanceAvailabilityPrototype unmarshals an instance of InstanceAvailabilityPrototype from the specified map of raw messages. -func UnmarshalInstanceAvailabilityPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceAvailabilityPrototype) +// UnmarshalInstanceAvailabilityPolicyPrototype unmarshals an instance of InstanceAvailabilityPolicyPrototype from the specified map of raw messages. +func UnmarshalInstanceAvailabilityPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceAvailabilityPolicyPrototype) err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) if err != nil { return @@ -41988,12 +41984,69 @@ func UnmarshalInstanceInitializationPassword(m map[string]json.RawMessage, resul return } +// InstanceLifecycleReason : InstanceLifecycleReason struct +type InstanceLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 InstanceLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + InstanceLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalInstanceLifecycleReason unmarshals an instance of InstanceLifecycleReason from the specified map of raw messages. +func UnmarshalInstanceLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceMetadataService : The metadata service configuration. type InstanceMetadataService struct { // Indicates whether the metadata service endpoint is available to the virtual server instance. Enabled *bool `json:"enabled" validate:"required"` + + // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is + // enabled. + // - `http`: HTTP protocol (unencrypted) + // - `https`: HTTP Secure protocol. + Protocol *string `json:"protocol" validate:"required"` + + // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata + // service is enabled. + ResponseHopLimit *int64 `json:"response_hop_limit" validate:"required"` } +// Constants associated with the InstanceMetadataService.Protocol property. +// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is +// enabled. +// - `http`: HTTP protocol (unencrypted) +// - `https`: HTTP Secure protocol. +const ( + InstanceMetadataServiceProtocolHTTPConst = "http" + InstanceMetadataServiceProtocolHTTPSConst = "https" +) + // UnmarshalInstanceMetadataService unmarshals an instance of InstanceMetadataService from the specified map of raw messages. func UnmarshalInstanceMetadataService(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceMetadataService) @@ -42001,6 +42054,14 @@ func UnmarshalInstanceMetadataService(m map[string]json.RawMessage, result inter if err != nil { return } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -42009,8 +42070,28 @@ func UnmarshalInstanceMetadataService(m map[string]json.RawMessage, result inter type InstanceMetadataServicePatch struct { // Indicates whether the metadata service endpoint will be available to the virtual server instance. Enabled *bool `json:"enabled,omitempty"` + + // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is + // enabled. + // - `http`: HTTP protocol (unencrypted) + // - `https`: HTTP Secure protocol. + Protocol *string `json:"protocol,omitempty"` + + // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata + // service is enabled. + ResponseHopLimit *int64 `json:"response_hop_limit,omitempty"` } +// Constants associated with the InstanceMetadataServicePatch.Protocol property. +// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is +// enabled. +// - `http`: HTTP protocol (unencrypted) +// - `https`: HTTP Secure protocol. +const ( + InstanceMetadataServicePatchProtocolHTTPConst = "http" + InstanceMetadataServicePatchProtocolHTTPSConst = "https" +) + // UnmarshalInstanceMetadataServicePatch unmarshals an instance of InstanceMetadataServicePatch from the specified map of raw messages. func UnmarshalInstanceMetadataServicePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceMetadataServicePatch) @@ -42018,6 +42099,14 @@ func UnmarshalInstanceMetadataServicePatch(m map[string]json.RawMessage, result if err != nil { return } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -42026,8 +42115,28 @@ func UnmarshalInstanceMetadataServicePatch(m map[string]json.RawMessage, result type InstanceMetadataServicePrototype struct { // Indicates whether the metadata service endpoint will be available to the virtual server instance. Enabled *bool `json:"enabled,omitempty"` + + // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is + // enabled. + // - `http`: HTTP protocol (unencrypted) + // - `https`: HTTP Secure protocol. + Protocol *string `json:"protocol,omitempty"` + + // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata + // service is enabled. + ResponseHopLimit *int64 `json:"response_hop_limit,omitempty"` } +// Constants associated with the InstanceMetadataServicePrototype.Protocol property. +// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is +// enabled. +// - `http`: HTTP protocol (unencrypted) +// - `https`: HTTP Secure protocol. +const ( + InstanceMetadataServicePrototypeProtocolHTTPConst = "http" + InstanceMetadataServicePrototypeProtocolHTTPSConst = "https" +) + // UnmarshalInstanceMetadataServicePrototype unmarshals an instance of InstanceMetadataServicePrototype from the specified map of raw messages. func UnmarshalInstanceMetadataServicePrototype(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceMetadataServicePrototype) @@ -42035,6 +42144,14 @@ func UnmarshalInstanceMetadataServicePrototype(m map[string]json.RawMessage, res if err != nil { return } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -43394,7 +43511,7 @@ func UnmarshalInstanceProfileVolumeBandwidth(m map[string]json.RawMessage, resul // - InstancePrototypeInstanceBySourceTemplate type InstancePrototype struct { // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` // The default trusted profile configuration to use for this virtual server instance // @@ -43499,7 +43616,7 @@ type InstancePrototypeIntf interface { // UnmarshalInstancePrototype unmarshals an instance of InstancePrototype from the specified map of raw messages. func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstancePrototype) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -43696,7 +43813,7 @@ func UnmarshalInstanceStatusReason(m map[string]json.RawMessage, result interfac // - InstanceTemplateInstanceByCatalogOffering type InstanceTemplate struct { // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -43806,7 +43923,7 @@ type InstanceTemplateIntf interface { // UnmarshalInstanceTemplate unmarshals an instance of InstanceTemplate from the specified map of raw messages. func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceTemplate) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -44056,7 +44173,7 @@ func (instanceTemplatePatch *InstanceTemplatePatch) AsPatch() (_patch map[string // - InstanceTemplatePrototypeInstanceByCatalogOffering type InstanceTemplatePrototype struct { // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` // The default trusted profile configuration to use for this virtual server instance // @@ -44160,7 +44277,7 @@ type InstanceTemplatePrototypeIntf interface { // UnmarshalInstanceTemplatePrototype unmarshals an instance of InstanceTemplatePrototype from the specified map of raw messages. func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceTemplatePrototype) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -44703,43 +44820,6 @@ func UnmarshalLegacyCloudObjectStorageBucketReference(m map[string]json.RawMessa return } -// LifecycleReason : LifecycleReason struct -type LifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. - 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 LifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. -const ( - LifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalLifecycleReason unmarshals an instance of LifecycleReason from the specified map of raw messages. -func UnmarshalLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LifecycleReason) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // ListBackupPoliciesOptions : The ListBackupPolicies options. type ListBackupPoliciesOptions struct { // A server-provided token determining what resource to start the page on. @@ -48657,6 +48737,10 @@ 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. + IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` + // The policies for this listener. Policies []LoadBalancerListenerPolicyReference `json:"policies,omitempty"` @@ -48750,6 +48834,10 @@ func UnmarshalLoadBalancerListener(m map[string]json.RawMessage, result interfac if err != nil { return } + err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) + if err != nil { + return + } err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicyReference) if err != nil { return @@ -48965,6 +49053,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. + 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 // have a unique `port` and `protocol` combination. // @@ -49047,6 +49138,10 @@ func UnmarshalLoadBalancerListenerPatch(m map[string]json.RawMessage, result int if err != nil { return } + err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { return @@ -49969,6 +50064,9 @@ type LoadBalancerListenerPrototypeLoadBalancerContext struct { // `protocol` of `http`, and the target 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. + 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 // have a unique `port` and `protocol` combination. // @@ -50060,6 +50158,10 @@ func UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext(m map[string]json if err != nil { return } + err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { return @@ -64433,7 +64535,7 @@ type VolumeAttachment struct { // The attached volume. // // This property will be absent if the volume has not yet been provisioned. - Volume *VolumeReference `json:"volume,omitempty"` + Volume *VolumeReferenceVolumeAttachmentContext `json:"volume,omitempty"` } // Constants associated with the VolumeAttachment.Status property. @@ -64491,7 +64593,7 @@ func UnmarshalVolumeAttachment(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReference) + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReferenceVolumeAttachmentContext) if err != nil { return } @@ -64810,7 +64912,7 @@ type VolumeAttachmentReferenceInstanceContext struct { // The attached volume. // // This property will be absent if the volume has not yet been provisioned. - Volume *VolumeReference `json:"volume,omitempty"` + Volume *VolumeReferenceVolumeAttachmentContext `json:"volume,omitempty"` } // UnmarshalVolumeAttachmentReferenceInstanceContext unmarshals an instance of VolumeAttachmentReferenceInstanceContext from the specified map of raw messages. @@ -64836,7 +64938,7 @@ func UnmarshalVolumeAttachmentReferenceInstanceContext(m map[string]json.RawMess if err != nil { return } - err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReference) + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReferenceVolumeAttachmentContext) if err != nil { return } @@ -65682,6 +65784,70 @@ func UnmarshalVolumeReferenceDeleted(m map[string]json.RawMessage, result interf return } +// VolumeReferenceVolumeAttachmentContext : VolumeReferenceVolumeAttachmentContext struct +type VolumeReferenceVolumeAttachmentContext struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeReferenceVolumeAttachmentContextDeleted `json:"deleted,omitempty"` + + // The URL for this volume. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` + + // The name for this volume. The name is unique across all volumes in the region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalVolumeReferenceVolumeAttachmentContext unmarshals an instance of VolumeReferenceVolumeAttachmentContext from the specified map of raw messages. +func UnmarshalVolumeReferenceVolumeAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeReferenceVolumeAttachmentContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceVolumeAttachmentContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeReferenceVolumeAttachmentContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VolumeReferenceVolumeAttachmentContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeReferenceVolumeAttachmentContextDeleted unmarshals an instance of VolumeReferenceVolumeAttachmentContextDeleted from the specified map of raw messages. +func UnmarshalVolumeReferenceVolumeAttachmentContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeReferenceVolumeAttachmentContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VolumeStatusReason : VolumeStatusReason struct type VolumeStatusReason struct { // A snake case string succinctly identifying the status reason. @@ -72867,7 +73033,7 @@ func UnmarshalInstanceProfileVolumeBandwidthRange(m map[string]json.RawMessage, // This model "extends" InstancePrototype type InstancePrototypeInstanceByCatalogOffering struct { // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` // The default trusted profile configuration to use for this virtual server instance This property's value is used // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an @@ -72962,7 +73128,7 @@ func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototype() bool { // UnmarshalInstancePrototypeInstanceByCatalogOffering unmarshals an instance of InstancePrototypeInstanceByCatalogOffering from the specified map of raw messages. func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstancePrototypeInstanceByCatalogOffering) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -73038,7 +73204,7 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe // This model "extends" InstancePrototype type InstancePrototypeInstanceByImage struct { // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` // The default trusted profile configuration to use for this virtual server instance This property's value is used // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an @@ -73126,7 +73292,7 @@ func (*InstancePrototypeInstanceByImage) isaInstancePrototype() bool { // UnmarshalInstancePrototypeInstanceByImage unmarshals an instance of InstancePrototypeInstanceByImage from the specified map of raw messages. func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstancePrototypeInstanceByImage) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -73202,7 +73368,7 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res // This model "extends" InstancePrototype type InstancePrototypeInstanceBySourceSnapshot struct { // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` // The default trusted profile configuration to use for this virtual server instance This property's value is used // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an @@ -73287,7 +73453,7 @@ func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototype() bool { // UnmarshalInstancePrototypeInstanceBySourceSnapshot unmarshals an instance of InstancePrototypeInstanceBySourceSnapshot from the specified map of raw messages. func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstancePrototypeInstanceBySourceSnapshot) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -73359,7 +73525,7 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes // This model "extends" InstancePrototype type InstancePrototypeInstanceBySourceTemplate struct { // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` // The default trusted profile configuration to use for this virtual server instance This property's value is used // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an @@ -73459,7 +73625,7 @@ func (*InstancePrototypeInstanceBySourceTemplate) isaInstancePrototype() bool { // UnmarshalInstancePrototypeInstanceBySourceTemplate unmarshals an instance of InstancePrototypeInstanceBySourceTemplate from the specified map of raw messages. func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstancePrototypeInstanceBySourceTemplate) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -73636,7 +73802,7 @@ func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result // This model "extends" InstanceTemplatePrototype type InstanceTemplatePrototypeInstanceByCatalogOffering struct { // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` // The default trusted profile configuration to use for this virtual server instance This property's value is used // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an @@ -73729,7 +73895,7 @@ func (*InstanceTemplatePrototypeInstanceByCatalogOffering) isaInstanceTemplatePr // UnmarshalInstanceTemplatePrototypeInstanceByCatalogOffering unmarshals an instance of InstanceTemplatePrototypeInstanceByCatalogOffering from the specified map of raw messages. func UnmarshalInstanceTemplatePrototypeInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceTemplatePrototypeInstanceByCatalogOffering) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -73805,7 +73971,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceByCatalogOffering(m map[string]js // This model "extends" InstanceTemplatePrototype type InstanceTemplatePrototypeInstanceByImage struct { // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` // The default trusted profile configuration to use for this virtual server instance This property's value is used // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an @@ -73891,7 +74057,7 @@ func (*InstanceTemplatePrototypeInstanceByImage) isaInstanceTemplatePrototype() // UnmarshalInstanceTemplatePrototypeInstanceByImage unmarshals an instance of InstanceTemplatePrototypeInstanceByImage from the specified map of raw messages. func UnmarshalInstanceTemplatePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceTemplatePrototypeInstanceByImage) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -73967,7 +74133,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceByImage(m map[string]json.RawMess // This model "extends" InstanceTemplatePrototype type InstanceTemplatePrototypeInstanceBySourceSnapshot struct { // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` // The default trusted profile configuration to use for this virtual server instance This property's value is used // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an @@ -74050,7 +74216,7 @@ func (*InstanceTemplatePrototypeInstanceBySourceSnapshot) isaInstanceTemplatePro // UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceBySourceSnapshot from the specified map of raw messages. func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceTemplatePrototypeInstanceBySourceSnapshot) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -74122,7 +74288,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot(m map[string]jso // This model "extends" InstanceTemplatePrototype type InstanceTemplatePrototypeInstanceBySourceTemplate struct { // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` // The default trusted profile configuration to use for this virtual server instance This property's value is used // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an @@ -74220,7 +74386,7 @@ func (*InstanceTemplatePrototypeInstanceBySourceTemplate) isaInstanceTemplatePro // UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceBySourceTemplate from the specified map of raw messages. func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceTemplatePrototypeInstanceBySourceTemplate) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -74304,7 +74470,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]jso // This model "extends" InstanceTemplate type InstanceTemplateInstanceByCatalogOffering struct { // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -74398,7 +74564,7 @@ func (*InstanceTemplateInstanceByCatalogOffering) isaInstanceTemplate() bool { // UnmarshalInstanceTemplateInstanceByCatalogOffering unmarshals an instance of InstanceTemplateInstanceByCatalogOffering from the specified map of raw messages. func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceTemplateInstanceByCatalogOffering) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -74490,7 +74656,7 @@ func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMes // This model "extends" InstanceTemplate type InstanceTemplateInstanceByImage struct { // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -74577,7 +74743,7 @@ func (*InstanceTemplateInstanceByImage) isaInstanceTemplate() bool { // UnmarshalInstanceTemplateInstanceByImage unmarshals an instance of InstanceTemplateInstanceByImage from the specified map of raw messages. func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceTemplateInstanceByImage) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -74669,7 +74835,7 @@ func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, resu // This model "extends" InstanceTemplate type InstanceTemplateInstanceBySourceSnapshot struct { // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPrototype `json:"availability_policy,omitempty"` + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -74753,7 +74919,7 @@ func (*InstanceTemplateInstanceBySourceSnapshot) isaInstanceTemplate() bool { // UnmarshalInstanceTemplateInstanceBySourceSnapshot unmarshals an instance of InstanceTemplateInstanceBySourceSnapshot from the specified map of raw messages. func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceTemplateInstanceBySourceSnapshot) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } From e72dbf31114cbac9fbe6e79ceacf87ea30a1d9d4 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 9 Mar 2023 09:26:14 +0530 Subject: [PATCH 023/103] go mod update and breaking change --- go.mod | 9 ++++++--- go.sum | 9 ++------- ibm/service/vpc/data_source_ibm_is_instance.go | 2 +- ibm/service/vpc/resource_ibm_is_instance.go | 8 ++++---- ibm/service/vpc/resource_ibm_is_instance_template.go | 4 ++-- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index 82a28fb7de..26bc3b504e 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/IBM/continuous-delivery-go-sdk v1.0.4 github.com/IBM/event-notifications-go-admin-sdk v0.1.7 github.com/IBM/eventstreams-go-sdk v1.2.0 - github.com/IBM/go-sdk-core/v5 v5.12.0 + github.com/IBM/go-sdk-core/v5 v5.12.1 github.com/IBM/ibm-cos-sdk-go v1.9.0 github.com/IBM/ibm-cos-sdk-go-config v1.2.0 github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20211109141421-a4b61b05f7d1 @@ -54,7 +54,10 @@ require ( k8s.io/client-go v0.25.0 ) -require github.com/IBM/go-sdk-core/v3 v3.2.4 +require ( + github.com/IBM/go-sdk-core/v3 v3.2.4 + github.com/pkg/errors v0.9.1 +) require ( github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 // indirect @@ -139,7 +142,6 @@ require ( github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pelletier/go-toml v1.7.0 // indirect github.com/pierrec/lz4 v2.6.0+incompatible // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/softlayer/xmlrpc v0.0.0-20200409220501-5f089df7cb7e // indirect github.com/spf13/pflag v1.0.5 // indirect @@ -174,4 +176,5 @@ replace github.com/softlayer/softlayer-go v1.0.3 => github.com/IBM-Cloud/softlay replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt/jwt v3.2.1+incompatible replace github.com/IBM/vpc-go-sdk v0.32.0 => ./common/github.com/IBM/vpc-go-sdk + replace github.com/IBM/secrets-manager-go-sdk v1.0.49 => github.com/IBM/secrets-manager-go-sdk v1.0.50-0.20230202132733-fd8f31729d57 diff --git a/go.sum b/go.sum index f9e7be6bd2..4a7d9956f2 100644 --- a/go.sum +++ b/go.sum @@ -72,10 +72,9 @@ github.com/IBM/go-sdk-core/v5 v5.7.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc github.com/IBM/go-sdk-core/v5 v5.8.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc0XQUqRO9Jc= github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= -github.com/IBM/go-sdk-core/v5 v5.10.2 h1:bfqhYNwwpJ3zJQSYpF3umhmRIKaa762itvJkTAWCCLU= github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= -github.com/IBM/go-sdk-core/v5 v5.12.0 h1:S7sSYQUe0f/xLh87ubwoXWQeUmRCwDNUv3qB4LMC0SI= -github.com/IBM/go-sdk-core/v5 v5.12.0/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= +github.com/IBM/go-sdk-core/v5 v5.12.1 h1:9hb9oosBma4+N05xmKmtAW13T1nfADMVYRE7fu06lZ0= +github.com/IBM/go-sdk-core/v5 v5.12.1/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= github.com/IBM/ibm-cos-sdk-go v1.3.1/go.mod h1:YLBAYobEA8bD27P7xpMwSQeNQu6W3DNBtBComXrRzRY= github.com/IBM/ibm-cos-sdk-go v1.9.0 h1:kXTLB9GBwks3+YZopYz/eRbdyeVl2BXFALeqtQ8Duoc= github.com/IBM/ibm-cos-sdk-go v1.9.0/go.mod h1:Oi8AC5WNDhmUJgbo1GL2FtBdo0nRgbzE/1HmCL1SERU= @@ -101,8 +100,6 @@ github.com/IBM/schematics-go-sdk v0.2.1 h1:byATysGD+Z1k/wdtNqQmKALcAPjgSLuSyzcab github.com/IBM/schematics-go-sdk v0.2.1/go.mod h1:Tw2OSAPdpC69AxcwoyqcYYaGTTW6YpERF9uNEU+BFRQ= github.com/IBM/secrets-manager-go-sdk v1.0.50-0.20230202132733-fd8f31729d57 h1:/l0OC4K6m+xiruPvXiOtqawg+uwwg+18e8LqEAIUcyk= github.com/IBM/secrets-manager-go-sdk v1.0.50-0.20230202132733-fd8f31729d57/go.mod h1:QyDSznC6gJEXIGaj+JPxoEVtyXfkaxzId87mxcEb+vM= -github.com/IBM/vpc-go-sdk v0.32.0 h1:LDuU8xkeBISvLc6/artN7aQ1YsdKvDWRXalfsPHUBu4= -github.com/IBM/vpc-go-sdk v0.32.0/go.mod h1:jYjS3EySPkC7DuOg33gMHtm8DcIf75Tc+Gxo3zmMBTQ= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56/go.mod h1:Zb3OT4l0mf7P/GOs2w2Ilj5sdm5Whoq3pa24dAEBHFc= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= @@ -125,8 +122,6 @@ github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWso github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= -github.com/adya1303/platform-services-go-sdk v0.0.0-20230117172144-bd4c95d35229 h1:EfhxzxrNImEd1585XBbMLs8YolWTGieWA3RKh+L/JKw= -github.com/adya1303/platform-services-go-sdk v0.0.0-20230117172144-bd4c95d35229/go.mod h1:jy0Ahvj5Gkkua3Gd7t22bo0GfmHRQaPZcaqwfVgEY7k= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= diff --git a/ibm/service/vpc/data_source_ibm_is_instance.go b/ibm/service/vpc/data_source_ibm_is_instance.go index 7b101b01a7..18f9c7d999 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance.go +++ b/ibm/service/vpc/data_source_ibm_is_instance.go @@ -1169,7 +1169,7 @@ func dataSourceInstanceDisksToMap(disksItem vpcv1.InstanceDisk) (disksMap map[st return disksMap } -func dataSourceInstanceFlattenLifecycleReasons(lifecycleReasons []vpcv1.LifecycleReason) (lifecycleReasonsList []map[string]interface{}) { +func dataSourceInstanceFlattenLifecycleReasons(lifecycleReasons []vpcv1.InstanceLifecycleReason) (lifecycleReasonsList []map[string]interface{}) { lifecycleReasonsList = make([]map[string]interface{}, 0) for _, lr := range lifecycleReasons { currentLR := map[string]interface{}{} diff --git a/ibm/service/vpc/resource_ibm_is_instance.go b/ibm/service/vpc/resource_ibm_is_instance.go index 1d065ef0b5..9056d51bcc 100644 --- a/ibm/service/vpc/resource_ibm_is_instance.go +++ b/ibm/service/vpc/resource_ibm_is_instance.go @@ -1126,7 +1126,7 @@ func instanceCreateByImage(d *schema.ResourceData, meta interface{}, profile, na } if availablePolicyItem, ok := d.GetOk(isInstanceAvailablePolicyHostFailure); ok { hostFailure := availablePolicyItem.(string) - instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPrototype{ + instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPolicyPrototype{ HostFailure: &hostFailure, } } @@ -1511,7 +1511,7 @@ func instanceCreateByCatalogOffering(d *schema.ResourceData, meta interface{}, p } if availablePolicyItem, ok := d.GetOk(isInstanceAvailablePolicyHostFailure); ok { hostFailure := availablePolicyItem.(string) - instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPrototype{ + instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPolicyPrototype{ HostFailure: &hostFailure, } } @@ -1894,7 +1894,7 @@ func instanceCreateByTemplate(d *schema.ResourceData, meta interface{}, profile, } if availablePolicyItem, ok := d.GetOk(isInstanceAvailablePolicyHostFailure); ok { hostFailure := availablePolicyItem.(string) - instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPrototype{ + instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPolicyPrototype{ HostFailure: &hostFailure, } } @@ -2520,7 +2520,7 @@ func instanceCreateByVolume(d *schema.ResourceData, meta interface{}, profile, n } if availablePolicyItem, ok := d.GetOk(isInstanceAvailablePolicyHostFailure); ok { hostFailure := availablePolicyItem.(string) - instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPrototype{ + instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPolicyPrototype{ HostFailure: &hostFailure, } } diff --git a/ibm/service/vpc/resource_ibm_is_instance_template.go b/ibm/service/vpc/resource_ibm_is_instance_template.go index a27b371007..cdca5c6d7e 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_template.go +++ b/ibm/service/vpc/resource_ibm_is_instance_template.go @@ -756,7 +756,7 @@ func instanceTemplateCreateByCatalogOffering(d *schema.ResourceData, meta interf } if availablePolicyHostFailureIntf, ok := d.GetOk(isInstanceTemplateAvailablePolicyHostFailure); ok { availablePolicyHostFailure := availablePolicyHostFailureIntf.(string) - instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPrototype{ + instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPolicyPrototype{ HostFailure: &availablePolicyHostFailure, } } @@ -1179,7 +1179,7 @@ func instanceTemplateCreate(d *schema.ResourceData, meta interface{}, profile, n } if availablePolicyHostFailureIntf, ok := d.GetOk(isInstanceTemplateAvailablePolicyHostFailure); ok { availablePolicyHostFailure := availablePolicyHostFailureIntf.(string) - instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPrototype{ + instanceproto.AvailabilityPolicy = &vpcv1.InstanceAvailabilityPolicyPrototype{ HostFailure: &availablePolicyHostFailure, } } From 7a3f40214665fe9c885e11f80cc26f516c02f310 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 23 Mar 2023 08:11:16 +0530 Subject: [PATCH 024/103] updated sdk --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 785 +++++++++++++++--- 1 file changed, 657 insertions(+), 128 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index e8f3c7bad2..51c5bf16c8 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.65.0-79fc0b8f-20230209-215651 + * IBM OpenAPI SDK Code Generator Version: 3.67.0-df2073a1-20230222-221157 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -37,7 +37,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: 2023-03-07 +// API Version: 2023-03-21 type VpcV1 struct { Service *core.BaseService @@ -1189,6 +1189,9 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO if createVPCRouteOptions.NextHop != nil { body["next_hop"] = createVPCRouteOptions.NextHop } + if createVPCRouteOptions.Priority != nil { + body["priority"] = createVPCRouteOptions.Priority + } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -1775,8 +1778,9 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP // ListVPCRoutingTableRoutes : List all routes in a VPC routing table // This request lists all routes in a VPC routing table. If subnets are associated with this routing table, delivery of // packets sent on a subnet is performed according to the action of the most specific matching route in the table -// (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, traffic will be -// distributed across them. If no routes match, delivery will be controlled by the system's built-in routes. +// (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, the route with the +// highest priority will be used. If two matching routes have the same destination and priority, traffic will be +// distributed between them. If no routes match, delivery will be controlled by the system's built-in routes. func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { return vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) } @@ -1906,6 +1910,9 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre if createVPCRoutingTableRouteOptions.NextHop != nil { body["next_hop"] = createVPCRoutingTableRouteOptions.NextHop } + if createVPCRoutingTableRouteOptions.Priority != nil { + body["priority"] = createVPCRoutingTableRouteOptions.Priority + } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -5684,7 +5691,7 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex } // GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request a retrieves a specified floating IP address if it is associated with the network interface and instance +// This request retrieves a specified floating IP address if it is associated with the network interface and instance // specified in the URL. func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) @@ -5887,7 +5894,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context } // GetInstanceNetworkInterfaceIP : Retrieve bound reserved IP -// This request a retrieves the specified reserved IP address if it is bound to the network interface and instance +// This request retrieves the specified reserved IP address if it is bound to the network interface and instance // specified in the URL. func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) @@ -11184,8 +11191,8 @@ func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx } // GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request a retrieves a specified floating IP address if it is associated with the network interface and bare -// metal server specified in the URL. +// This request retrieves a specified floating IP address if it is associated with the network interface and bare metal +// server specified in the URL. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) } @@ -11382,7 +11389,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. } // GetBareMetalServerNetworkInterfaceIP : Retrieve bound reserved IP -// This request a retrieves the specified reserved IP address if it is bound to the network interface and bare metal +// This request retrieves the specified reserved IP address if it is bound to the network interface and bare metal // server specified in the URL. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) @@ -12029,6 +12036,18 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions if listVolumesOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) } + if listVolumesOptions.AttachmentState != nil { + builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) + } + if listVolumesOptions.Encryption != nil { + builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) + } + if listVolumesOptions.OperatingSystemFamily != nil { + builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) + } + if listVolumesOptions.OperatingSystemArchitecture != nil { + builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) + } if listVolumesOptions.ZoneName != nil { builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) } @@ -20945,8 +20964,7 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove } // GetEndpointGatewayIP : Retrieve a reserved IP bound to an endpoint gateway -// This request a retrieves the specified reserved IP address if it is bound to the endpoint gateway specified in the -// URL. +// 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) { return vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) } @@ -23891,20 +23909,18 @@ type BareMetalServerNetworkInterface struct { CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - A single floating IP can be assigned to the network interface. + // - 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 network interface, - // allowing the workload to perform any needed NAT operations. - // - Multiple floating IPs can be assigned to the network interface. - // - `allow_ip_spoofing` must be set to `false`. - // - // This must be `true` when `interface_type` is `hipersocket`. + // - Packets are passed unchanged to/from the 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 floating IPs associated with this network interface. - FloatingIps []FloatingIPReference `json:"floating_ips,omitempty"` + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` // The URL for this network interface. Href *string `json:"href" validate:"required"` @@ -24150,16 +24166,14 @@ type BareMetalServerNetworkInterfacePatch struct { AllowedVlans []int64 `json:"allowed_vlans,omitempty"` // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - A single floating IP can be assigned to the network interface. + // - 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 network interface, - // allowing the workload to perform any needed NAT operations. - // - Multiple floating IPs can be assigned to the network interface. - // - `allow_ip_spoofing` must be set to `false`. - // - // This must be `true` when `interface_type` is `hipersocket`. + // - Packets are passed unchanged to/from the 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,omitempty"` // The name for this network interface. The name must not be used by another network interface on the bare metal @@ -24211,16 +24225,14 @@ type BareMetalServerNetworkInterfacePrototype struct { AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - A single floating IP can be assigned to the network interface. + // - 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 network interface, - // allowing the workload to perform any needed NAT operations. - // - Multiple floating IPs can be assigned to the network interface. - // - `allow_ip_spoofing` must be set to `false`. - // - // This must be `true` when `interface_type` is `hipersocket`. + // - Packets are passed unchanged to/from the 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,omitempty"` // The network interface type: @@ -24382,16 +24394,14 @@ type BareMetalServerPrimaryNetworkInterfacePrototype struct { AllowedVlans []int64 `json:"allowed_vlans,omitempty"` // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - A single floating IP can be assigned to the network interface. + // - 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 network interface, - // allowing the workload to perform any needed NAT operations. - // - Multiple floating IPs can be assigned to the network interface. - // - `allow_ip_spoofing` must be set to `false`. - // - // This must be `true` when `interface_type` is `hipersocket`. + // - Packets are passed unchanged to/from the 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,omitempty"` // The network interface type: @@ -28846,8 +28856,8 @@ type CreateVPCRouteOptions struct { // The VPC identifier. VPCID *string `json:"vpc_id" validate:"required,ne="` - // The destination of the route. At most two routes per `zone` in a table can have the same destination, and only if - // both routes have an `action` of `deliver` and the `next_hop` is an IP address. + // The destination of the route. At most two routes per `zone` in a table can have the same `destination` and + // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Destination *string `json:"destination" validate:"required"` // The zone to apply the route to. (Traffic from subnets in this zone will be @@ -28870,6 +28880,16 @@ type CreateVPCRouteOptions struct { // values, it must be omitted or specified as `0.0.0.0`. NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + // 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. + // + // At most two routes per `zone` in a table can have the same `destination` and + // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. + Priority *int64 `json:"priority,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -28932,6 +28952,12 @@ func (_options *CreateVPCRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopI return _options } +// SetPriority : Allow user to set Priority +func (_options *CreateVPCRouteOptions) SetPriority(priority int64) *CreateVPCRouteOptions { + _options.Priority = core.Int64Ptr(priority) + return _options +} + // SetHeaders : Allow user to set Headers func (options *CreateVPCRouteOptions) SetHeaders(param map[string]string) *CreateVPCRouteOptions { options.Headers = param @@ -29075,8 +29101,8 @@ type CreateVPCRoutingTableRouteOptions struct { // The routing table identifier. RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` - // The destination of the route. At most two routes per `zone` in a table can have the same destination, and only if - // both routes have an `action` of `deliver` and the `next_hop` is an IP address. + // The destination of the route. At most two routes per `zone` in a table can have the same `destination` and + // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Destination *string `json:"destination" validate:"required"` // The zone to apply the route to. (Traffic from subnets in this zone will be @@ -29099,6 +29125,16 @@ type CreateVPCRoutingTableRouteOptions struct { // values, it must be omitted or specified as `0.0.0.0`. NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + // 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. + // + // At most two routes per `zone` in a table can have the same `destination` and + // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. + Priority *int64 `json:"priority,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -29168,6 +29204,12 @@ func (_options *CreateVPCRoutingTableRouteOptions) SetNextHop(nextHop RouteProto return _options } +// SetPriority : Allow user to set Priority +func (_options *CreateVPCRoutingTableRouteOptions) SetPriority(priority int64) *CreateVPCRoutingTableRouteOptions { + _options.Priority = core.Int64Ptr(priority) + return _options +} + // SetHeaders : Allow user to set Headers func (options *CreateVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *CreateVPCRoutingTableRouteOptions { options.Headers = param @@ -43507,6 +43549,7 @@ func UnmarshalInstanceProfileVolumeBandwidth(m map[string]json.RawMessage, resul // Models which "extend" this model: // - InstancePrototypeInstanceByImage // - InstancePrototypeInstanceByCatalogOffering +// - InstancePrototypeInstanceByVolume // - InstancePrototypeInstanceBySourceSnapshot // - InstancePrototypeInstanceBySourceTemplate type InstancePrototype struct { @@ -47632,6 +47675,24 @@ type ListVolumesOptions struct { // Filters the collection to resources with the exact specified name. Name *string `json:"name,omitempty"` + // Filters the collection to volumes with the specified attachment state. + AttachmentState *string `json:"attachment_state,omitempty"` + + // Filters the collection to resources with the specified encryption type. + Encryption *string `json:"encryption,omitempty"` + + // Filters the collection to resources with the exact specified operating system family. + // + // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no + // operating system or any operating system, respectively. + OperatingSystemFamily *string `json:"operating_system.family,omitempty"` + + // Filters the collection to resources with the exact specified operating system architecture. + // + // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no + // operating system or any operating system, respectively. + OperatingSystemArchitecture *string `json:"operating_system.architecture,omitempty"` + // Filters the collection to resources in the zone with the exact specified name. ZoneName *string `json:"zone.name,omitempty"` @@ -47639,6 +47700,21 @@ type ListVolumesOptions struct { Headers map[string]string } +// Constants associated with the ListVolumesOptions.AttachmentState property. +// Filters the collection to volumes with the specified attachment state. +const ( + ListVolumesOptionsAttachmentStateAttachedConst = "attached" + ListVolumesOptionsAttachmentStateUnattachedConst = "unattached" + ListVolumesOptionsAttachmentStateUnusableConst = "unusable" +) + +// Constants associated with the ListVolumesOptions.Encryption property. +// Filters the collection to resources with the specified encryption type. +const ( + ListVolumesOptionsEncryptionProviderManagedConst = "provider_managed" + ListVolumesOptionsEncryptionUserManagedConst = "user_managed" +) + // NewListVolumesOptions : Instantiate ListVolumesOptions func (*VpcV1) NewListVolumesOptions() *ListVolumesOptions { return &ListVolumesOptions{} @@ -47662,6 +47738,30 @@ func (_options *ListVolumesOptions) SetName(name string) *ListVolumesOptions { return _options } +// SetAttachmentState : Allow user to set AttachmentState +func (_options *ListVolumesOptions) SetAttachmentState(attachmentState string) *ListVolumesOptions { + _options.AttachmentState = core.StringPtr(attachmentState) + return _options +} + +// SetEncryption : Allow user to set Encryption +func (_options *ListVolumesOptions) SetEncryption(encryption string) *ListVolumesOptions { + _options.Encryption = core.StringPtr(encryption) + return _options +} + +// SetOperatingSystemFamily : Allow user to set OperatingSystemFamily +func (_options *ListVolumesOptions) SetOperatingSystemFamily(operatingSystemFamily string) *ListVolumesOptions { + _options.OperatingSystemFamily = core.StringPtr(operatingSystemFamily) + return _options +} + +// SetOperatingSystemArchitecture : Allow user to set OperatingSystemArchitecture +func (_options *ListVolumesOptions) SetOperatingSystemArchitecture(operatingSystemArchitecture string) *ListVolumesOptions { + _options.OperatingSystemArchitecture = core.StringPtr(operatingSystemArchitecture) + return _options +} + // SetZoneName : Allow user to set ZoneName func (_options *ListVolumesOptions) SetZoneName(zoneName string) *ListVolumesOptions { _options.ZoneName = core.StringPtr(zoneName) @@ -53344,7 +53444,7 @@ type NetworkInterface struct { CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // The floating IPs associated with this network interface. - FloatingIps []FloatingIPReference `json:"floating_ips,omitempty"` + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` // The URL for this network interface. Href *string `json:"href" validate:"required"` @@ -54020,30 +54120,6 @@ func UnmarshalOperatingSystemIdentity(m map[string]json.RawMessage, result inter return } -// OperatingSystemReference : OperatingSystemReference struct -type OperatingSystemReference struct { - // The URL for this operating system. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this operating system. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalOperatingSystemReference unmarshals an instance of OperatingSystemReference from the specified map of raw messages. -func UnmarshalOperatingSystemReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // PlacementGroup : PlacementGroup struct type PlacementGroup struct { // The date and time that the placement group was created. @@ -55990,6 +56066,13 @@ type Route struct { // unexpected property value was encountered. Origin *string `json:"origin,omitempty"` + // 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. (Traffic from subnets in this zone will be // subject to this route.). Zone *ZoneReference `json:"zone" validate:"required"` @@ -56076,6 +56159,10 @@ func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error if err != nil { return } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) if err != nil { return @@ -56322,11 +56409,78 @@ func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (er return } +// RouteNextHopPatch : The next hop that packets will be delivered to, if `action` is `deliver`. For other `action` values, specify +// `0.0.0.0` or remove it by specifying `null`. +// +// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only if both routes have +// an `action` of `deliver` and the `next_hop` is an IP address. +// Models which "extend" this model: +// - RouteNextHopPatchRouteNextHopIP +// - RouteNextHopPatchVPNGatewayConnectionIdentity +type RouteNextHopPatch struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RouteNextHopPatch) isaRouteNextHopPatch() bool { + return true +} + +type RouteNextHopPatchIntf interface { + isaRouteNextHopPatch() bool +} + +// UnmarshalRouteNextHopPatch unmarshals an instance of RouteNextHopPatch from the specified map of raw messages. +func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // RoutePatch : RoutePatch struct type RoutePatch struct { // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` // are reserved for system-provided routes, and are not allowed. Name *string `json:"name,omitempty"` + + // The next hop that packets will be delivered to, if `action` is `deliver`. For other `action` + // values, specify `0.0.0.0` or remove it by specifying `null`. + // + // At most two routes per `zone` in a table can have the same `destination` and `priority`, and + // only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. + NextHop RouteNextHopPatchIntf `json:"next_hop,omitempty"` + + // 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. + // + // At most two routes per `zone` in a table can have the same `destination` and + // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. + Priority *int64 `json:"priority,omitempty"` } // UnmarshalRoutePatch unmarshals an instance of RoutePatch from the specified map of raw messages. @@ -56336,6 +56490,14 @@ func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err if err != nil { return } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHopPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -56359,8 +56521,8 @@ type RoutePrototype struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` - // The destination of the route. At most two routes per `zone` in a table can have the same destination, and only if - // both routes have an `action` of `deliver` and the `next_hop` is an IP address. + // The destination of the route. At most two routes per `zone` in a table can have the same `destination` and + // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Destination *string `json:"destination" validate:"required"` // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` @@ -56372,6 +56534,16 @@ type RoutePrototype struct { // values, it must be omitted or specified as `0.0.0.0`. NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + // 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. + // + // At most two routes per `zone` in a table can have the same `destination` and + // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. + Priority *int64 `json:"priority,omitempty"` + // The zone to apply the route to. (Traffic from subnets in this zone will be // subject to this route.). Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -56419,6 +56591,10 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( if err != nil { return } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -64263,6 +64439,12 @@ type Volume struct { // Indicates whether a running virtual server instance has an attachment to this volume. Active *bool `json:"active" validate:"required"` + // The attachment state of the volume + // - `unattached`: Not attached to any virtual server instances + // - `attached`: Attached to a virtual server instance (even if the instance is stopped) + // - `unusable`: Not able to be attached to any virtual server instances. + AttachmentState *string `json:"attachment_state" validate:"required"` + // The maximum bandwidth (in megabits per second) for the volume. Bandwidth *int64 `json:"bandwidth" validate:"required"` @@ -64319,7 +64501,7 @@ type Volume struct { // The operating system associated with this volume. If absent, this volume was not // created from an image, or the image did not include an operating system. - OperatingSystem *OperatingSystemReference `json:"operating_system,omitempty"` + OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) for // this volume. @@ -64360,6 +64542,17 @@ type Volume struct { Zone *ZoneReference `json:"zone" validate:"required"` } +// Constants associated with the Volume.AttachmentState property. +// The attachment state of the volume +// - `unattached`: Not attached to any virtual server instances +// - `attached`: Attached to a virtual server instance (even if the instance is stopped) +// - `unusable`: Not able to be attached to any virtual server instances. +const ( + VolumeAttachmentStateAttachedConst = "attached" + VolumeAttachmentStateUnattachedConst = "unattached" + VolumeAttachmentStateUnusableConst = "unusable" +) + // Constants associated with the Volume.Encryption property. // The type of encryption used on the volume. const ( @@ -64404,6 +64597,10 @@ func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err erro if err != nil { return } + err = core.UnmarshalPrimitive(m, "attachment_state", &obj.AttachmentState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) if err != nil { return @@ -64456,7 +64653,7 @@ func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err erro if err != nil { return } - err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemReference) + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) if err != nil { return } @@ -64792,6 +64989,47 @@ func UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(m map[str return } +// VolumeAttachmentPrototypeInstanceByVolumeContext : VolumeAttachmentPrototypeInstanceByVolumeContext struct +type VolumeAttachmentPrototypeInstanceByVolumeContext struct { + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // An existing volume to attach. + Volume VolumeIdentityIntf `json:"volume" validate:"required"` +} + +// NewVolumeAttachmentPrototypeInstanceByVolumeContext : Instantiate VolumeAttachmentPrototypeInstanceByVolumeContext (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByVolumeContext(volume VolumeIdentityIntf) (_model *VolumeAttachmentPrototypeInstanceByVolumeContext, err error) { + _model = &VolumeAttachmentPrototypeInstanceByVolumeContext{ + Volume: volume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext unmarshals an instance of VolumeAttachmentPrototypeInstanceByVolumeContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeInstanceByVolumeContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VolumeAttachmentPrototypeVolume : An existing volume to attach to the instance, or a prototype object for a new volume. // Models which "extend" this model: // - VolumeAttachmentPrototypeVolumeVolumeIdentity @@ -66175,20 +66413,18 @@ type BareMetalServerNetworkInterfaceByHiperSocket struct { CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - A single floating IP can be assigned to the network interface. + // - 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 network interface, - // allowing the workload to perform any needed NAT operations. - // - Multiple floating IPs can be assigned to the network interface. - // - `allow_ip_spoofing` must be set to `false`. - // - // This must be `true` when `interface_type` is `hipersocket`. + // - Packets are passed unchanged to/from the 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 floating IPs associated with this network interface. - FloatingIps []FloatingIPReference `json:"floating_ips,omitempty"` + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` // The URL for this network interface. Href *string `json:"href" validate:"required"` @@ -66342,20 +66578,18 @@ type BareMetalServerNetworkInterfaceByPci struct { CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - A single floating IP can be assigned to the network interface. + // - 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 network interface, - // allowing the workload to perform any needed NAT operations. - // - Multiple floating IPs can be assigned to the network interface. - // - `allow_ip_spoofing` must be set to `false`. - // - // This must be `true` when `interface_type` is `hipersocket`. + // - Packets are passed unchanged to/from the 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 floating IPs associated with this network interface. - FloatingIps []FloatingIPReference `json:"floating_ips,omitempty"` + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` // The URL for this network interface. Href *string `json:"href" validate:"required"` @@ -66522,20 +66756,18 @@ type BareMetalServerNetworkInterfaceByVlan struct { CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - A single floating IP can be assigned to the network interface. + // - 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 network interface, - // allowing the workload to perform any needed NAT operations. - // - Multiple floating IPs can be assigned to the network interface. - // - `allow_ip_spoofing` must be set to `false`. - // - // This must be `true` when `interface_type` is `hipersocket`. + // - Packets are passed unchanged to/from the 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 floating IPs associated with this network interface. - FloatingIps []FloatingIPReference `json:"floating_ips,omitempty"` + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` // The URL for this network interface. Href *string `json:"href" validate:"required"` @@ -66708,16 +66940,14 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHi AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - A single floating IP can be assigned to the network interface. + // - 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 network interface, - // allowing the workload to perform any needed NAT operations. - // - Multiple floating IPs can be assigned to the network interface. - // - `allow_ip_spoofing` must be set to `false`. - // - // This must be `true` when `interface_type` is `hipersocket`. + // - Packets are passed unchanged to/from the 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,omitempty"` // The name for this network interface. The name must not be used by another network interface on the bare metal @@ -66808,16 +67038,14 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - A single floating IP can be assigned to the network interface. + // - 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 network interface, - // allowing the workload to perform any needed NAT operations. - // - Multiple floating IPs can be assigned to the network interface. - // - `allow_ip_spoofing` must be set to `false`. - // - // This must be `true` when `interface_type` is `hipersocket`. + // - Packets are passed unchanged to/from the 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,omitempty"` // The name for this network interface. The name must not be used by another network interface on the bare metal @@ -66921,16 +67149,14 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - A single floating IP can be assigned to the network interface. + // - 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 network interface, - // allowing the workload to perform any needed NAT operations. - // - Multiple floating IPs can be assigned to the network interface. - // - `allow_ip_spoofing` must be set to `false`. - // - // This must be `true` when `interface_type` is `hipersocket`. + // - Packets are passed unchanged to/from the 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,omitempty"` // The name for this network interface. The name must not be used by another network interface on the bare metal @@ -73705,6 +73931,163 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes return } +// InstancePrototypeInstanceByVolume : InstancePrototypeInstanceByVolume struct +// This model "extends" InstancePrototype +type InstancePrototypeInstanceByVolume struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance This property's value is used + // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an + // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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 chosen to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If + // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewInstancePrototypeInstanceByVolume : Instantiate InstancePrototypeInstanceByVolume (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByVolume(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByVolume, err error) { + _model = &InstancePrototypeInstanceByVolume{ + BootVolumeAttachment: bootVolumeAttachment, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByVolume) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByVolume unmarshals an instance of InstancePrototypeInstanceByVolume from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByVolume) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceTemplateIdentityByCRN : InstanceTemplateIdentityByCRN struct // This model "extends" InstanceTemplateIdentity type InstanceTemplateIdentityByCRN struct { @@ -78907,6 +79290,82 @@ func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) ( return } +// RouteNextHopPatchRouteNextHopIP : The IP address of the next hop to which to route packets. +// This model "extends" RouteNextHopPatch +type RouteNextHopPatchRouteNextHopIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRouteNextHopPatchRouteNextHopIP : Instantiate RouteNextHopPatchRouteNextHopIP (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPatchRouteNextHopIP(address string) (_model *RouteNextHopPatchRouteNextHopIP, err error) { + _model = &RouteNextHopPatchRouteNextHopIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchRouteNextHopIP unmarshals an instance of RouteNextHopPatchRouteNextHopIP from the specified map of raw messages. +func UnmarshalRouteNextHopPatchRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchRouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. +// Models which "extend" this model: +// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID +// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref +// This model "extends" RouteNextHopPatch +type RouteNextHopPatchVPNGatewayConnectionIdentity struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentity) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { + return true +} + +type RouteNextHopPatchVPNGatewayConnectionIdentityIntf interface { + RouteNextHopPatchIntf + isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentity) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentity from the specified map of raw messages. +func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchVPNGatewayConnectionIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // RouteNextHopVPNGatewayConnectionReference : RouteNextHopVPNGatewayConnectionReference struct // This model "extends" RouteNextHop type RouteNextHopVPNGatewayConnectionReference struct { @@ -85133,6 +85592,76 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIde return } +// RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct +// This model "extends" RouteNextHopPatchVPNGatewayConnectionIdentity +type RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (_model *RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { + _model = &RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. +func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct +// This model "extends" RouteNextHopPatchVPNGatewayConnectionIdentity +type RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` +} + +// NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (_model *RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { + _model = &RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. +func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct // This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { From 539799461247a3e772b1f1dc13d6a0701417a8f8 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 23 Mar 2023 08:14:01 +0530 Subject: [PATCH 025/103] breaking change on 0.34.0 --- ibm/service/vpc/data_source_ibm_is_volumes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ibm/service/vpc/data_source_ibm_is_volumes.go b/ibm/service/vpc/data_source_ibm_is_volumes.go index 32d92ff6f0..6ee7abb60c 100644 --- a/ibm/service/vpc/data_source_ibm_is_volumes.go +++ b/ibm/service/vpc/data_source_ibm_is_volumes.go @@ -722,7 +722,7 @@ func dataSourceVolumeCollectionVolumesEncryptionKeyToMap(encryptionKeyItem vpcv1 return encryptionKeyMap } -func dataSourceVolumeCollectionVolumesOperatingSystemToMap(operatingSystemItem vpcv1.OperatingSystemReference) (operatingSystemMap map[string]interface{}) { +func dataSourceVolumeCollectionVolumesOperatingSystemToMap(operatingSystemItem vpcv1.OperatingSystem) (operatingSystemMap map[string]interface{}) { operatingSystemMap = map[string]interface{}{} if operatingSystemItem.Href != nil { From ade36e1d316c568e22aef788208283e649827917 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 30 Mar 2023 09:39:13 +0530 Subject: [PATCH 026/103] Update vpc_v1.go --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 497 +++++++++++++++++- 1 file changed, 492 insertions(+), 5 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 51c5bf16c8..c4ab226a54 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -37,7 +37,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: 2023-03-21 +// API Version: 2023-03-28 type VpcV1 struct { Service *core.BaseService @@ -644,9 +644,8 @@ func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getV } // GetVPCDefaultSecurityGroup : Retrieve a VPC's default security group -// This request retrieves the default security group for the VPC specified by the identifier in the URL. Resources that -// optionally allow a security group to be specified upon creation will be attached to this security group if a security -// group is not specified. +// This request retrieves the default security group for the VPC specified by the identifier in the URL. Resources +// created in this VPC that allow a security group to be optionally specified will use this security group by default. func (vpc *VpcV1) GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { return vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) } @@ -18598,6 +18597,9 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB if createLoadBalancerOptions.Datapath != nil { body["datapath"] = createLoadBalancerOptions.Datapath } + if createLoadBalancerOptions.Dns != nil { + body["dns"] = createLoadBalancerOptions.Dns + } if createLoadBalancerOptions.Listeners != nil { body["listeners"] = createLoadBalancerOptions.Listeners } @@ -27840,6 +27842,8 @@ type CreateLoadBalancerOptions struct { // The datapath logging configuration for this load balancer. Datapath *LoadBalancerLoggingDatapathPrototype `json:"datapath,omitempty"` + Dns *LoadBalancerDnsPrototype `json:"dns,omitempty"` + // The listeners of this load balancer. Listeners []LoadBalancerListenerPrototypeLoadBalancerContext `json:"listeners,omitempty"` @@ -27906,6 +27910,12 @@ func (_options *CreateLoadBalancerOptions) SetDatapath(datapath *LoadBalancerLog return _options } +// SetDns : Allow user to set Dns +func (_options *CreateLoadBalancerOptions) SetDns(dns *LoadBalancerDnsPrototype) *CreateLoadBalancerOptions { + _options.Dns = dns + return _options +} + // SetListeners : Allow user to set Listeners func (_options *CreateLoadBalancerOptions) SetListeners(listeners []LoadBalancerListenerPrototypeLoadBalancerContext) *CreateLoadBalancerOptions { _options.Listeners = listeners @@ -29515,6 +29525,92 @@ func (options *CreateVPNServerRouteOptions) SetHeaders(param map[string]string) return options } +// DnsInstanceIdentity : Identifies a DNS instance by a unique property. +// Models which "extend" this model: +// - DnsInstanceIdentityByCRN +type DnsInstanceIdentity struct { + // The CRN for this DNS instance. + CRN *string `json:"crn,omitempty"` +} + +func (*DnsInstanceIdentity) isaDnsInstanceIdentity() bool { + return true +} + +type DnsInstanceIdentityIntf interface { + isaDnsInstanceIdentity() bool +} + +// UnmarshalDnsInstanceIdentity unmarshals an instance of DnsInstanceIdentity from the specified map of raw messages. +func UnmarshalDnsInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsInstanceIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsInstanceReference : DnsInstanceReference struct +type DnsInstanceReference struct { + // The CRN for this DNS instance. + CRN *string `json:"crn" validate:"required"` +} + +// UnmarshalDnsInstanceReference unmarshals an instance of DnsInstanceReference from the specified map of raw messages. +func UnmarshalDnsInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsZoneIdentity : Identifies a DNS zone by a unique property. +// Models which "extend" this model: +// - DnsZoneIdentityByID +type DnsZoneIdentity struct { + ID *string `json:"id,omitempty"` +} + +func (*DnsZoneIdentity) isaDnsZoneIdentity() bool { + return true +} + +type DnsZoneIdentityIntf interface { + isaDnsZoneIdentity() bool +} + +// UnmarshalDnsZoneIdentity unmarshals an instance of DnsZoneIdentity from the specified map of raw messages. +func UnmarshalDnsZoneIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsZoneIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsZoneReference : DnsZoneReference struct +type DnsZoneReference struct { + ID *string `json:"id" validate:"required"` +} + +// UnmarshalDnsZoneReference unmarshals an instance of DnsZoneReference from the specified map of raw messages. +func UnmarshalDnsZoneReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsZoneReference) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // DedicatedHost : DedicatedHost struct type DedicatedHost struct { // The amount of memory in gibibytes that is currently available for instances. @@ -30425,6 +30521,8 @@ type DedicatedHostProfile struct { VcpuArchitecture *DedicatedHostProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` VcpuCount DedicatedHostProfileVcpuIntf `json:"vcpu_count" validate:"required"` + + VcpuManufacturer *DedicatedHostProfileVcpuManufacturer `json:"vcpu_manufacturer" validate:"required"` } // Constants associated with the DedicatedHostProfile.Family property. @@ -30482,6 +30580,10 @@ func UnmarshalDedicatedHostProfile(m map[string]json.RawMessage, result interfac if err != nil { return } + err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalDedicatedHostProfileVcpuManufacturer) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -31082,6 +31184,36 @@ func UnmarshalDedicatedHostProfileVcpuArchitecture(m map[string]json.RawMessage, return } +// DedicatedHostProfileVcpuManufacturer : DedicatedHostProfileVcpuManufacturer struct +type DedicatedHostProfileVcpuManufacturer struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The VCPU manufacturer for a dedicated host with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuManufacturer.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuManufacturerTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileVcpuManufacturer unmarshals an instance of DedicatedHostProfileVcpuManufacturer from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuManufacturer) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // DedicatedHostPrototype : DedicatedHostPrototype struct // Models which "extend" this model: // - DedicatedHostPrototypeDedicatedHostByGroup @@ -42501,6 +42633,8 @@ type InstanceProfile struct { // The globally unique name for this virtual server instance profile. Name *string `json:"name" validate:"required"` + NetworkInterfaceCount InstanceProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` + OsArchitecture *InstanceProfileOsArchitecture `json:"os_architecture" validate:"required"` PortSpeed InstanceProfilePortSpeedIntf `json:"port_speed" validate:"required"` @@ -42510,6 +42644,8 @@ type InstanceProfile struct { VcpuArchitecture *InstanceProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` VcpuCount InstanceProfileVcpuIntf `json:"vcpu_count" validate:"required"` + + VcpuManufacturer *InstanceProfileVcpuManufacturer `json:"vcpu_manufacturer" validate:"required"` } // UnmarshalInstanceProfile unmarshals an instance of InstanceProfile from the specified map of raw messages. @@ -42555,6 +42691,10 @@ func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalInstanceProfileNetworkInterfaceCount) + if err != nil { + return + } err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalInstanceProfileOsArchitecture) if err != nil { return @@ -42575,6 +42715,10 @@ func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalInstanceProfileVcpuManufacturer) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -43250,6 +43394,54 @@ func UnmarshalInstanceProfileMemory(m map[string]json.RawMessage, result interfa return } +// InstanceProfileNetworkInterfaceCount : InstanceProfileNetworkInterfaceCount struct +// Models which "extend" this model: +// - InstanceProfileNetworkInterfaceCountRange +// - InstanceProfileNetworkInterfaceCountDependent +type InstanceProfileNetworkInterfaceCount 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 InstanceProfileNetworkInterfaceCount.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkInterfaceCountTypeRangeConst = "range" +) + +func (*InstanceProfileNetworkInterfaceCount) isaInstanceProfileNetworkInterfaceCount() bool { + return true +} + +type InstanceProfileNetworkInterfaceCountIntf interface { + isaInstanceProfileNetworkInterfaceCount() bool +} + +// UnmarshalInstanceProfileNetworkInterfaceCount unmarshals an instance of InstanceProfileNetworkInterfaceCount from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkInterfaceCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkInterfaceCount) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceProfileOsArchitecture : InstanceProfileOsArchitecture struct type InstanceProfileOsArchitecture struct { // The default OS architecture for an instance with this profile. @@ -43467,6 +43659,43 @@ func UnmarshalInstanceProfileVcpuArchitecture(m map[string]json.RawMessage, resu return } +// InstanceProfileVcpuManufacturer : InstanceProfileVcpuManufacturer struct +type InstanceProfileVcpuManufacturer struct { + // The default VCPU manufacturer for an instance with this profile. + Default *string `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The VCPU manufacturer for an instance with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuManufacturer.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuManufacturerTypeFixedConst = "fixed" +) + +// UnmarshalInstanceProfileVcpuManufacturer unmarshals an instance of InstanceProfileVcpuManufacturer from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuManufacturer) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceProfileVolumeBandwidth : InstanceProfileVolumeBandwidth struct // Models which "extend" this model: // - InstanceProfileVolumeBandwidthFixed @@ -44471,6 +44700,9 @@ type InstanceVcpu struct { // The number of VCPUs assigned. Count *int64 `json:"count" validate:"required"` + + // The VCPU manufacturer. + Manufacturer *string `json:"manufacturer" validate:"required"` } // UnmarshalInstanceVcpu unmarshals an instance of InstanceVcpu from the specified map of raw messages. @@ -44484,6 +44716,10 @@ func UnmarshalInstanceVcpu(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -48444,6 +48680,12 @@ type LoadBalancer struct { // The load balancer's CRN. CRN *string `json:"crn" validate:"required"` + // 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 `lb.appdomain.cloud`. + Dns *LoadBalancerDns `json:"dns,omitempty"` + // Fully qualified domain name assigned to this load balancer. Hostname *string `json:"hostname" validate:"required"` @@ -48585,6 +48827,10 @@ func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalLoadBalancerDns) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) if err != nil { return @@ -48761,6 +49007,101 @@ func UnmarshalLoadBalancerCollectionNext(m map[string]json.RawMessage, result in 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 +// `lb.appdomain.cloud`. +type LoadBalancerDns struct { + // The DNS instance associated with this load balancer. + Instance *DnsInstanceReference `json:"instance" validate:"required"` + + // The DNS zone associated with this load balancer. + Zone *DnsZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalLoadBalancerDns unmarshals an instance of LoadBalancerDns from the specified map of raw messages. +func UnmarshalLoadBalancerDns(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerDns) + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerDnsPatch : LoadBalancerDnsPatch struct +type LoadBalancerDnsPatch struct { + // The DNS instance to associate with this load balancer. + // + // The specified instance may be in a different region or account, subject to IAM + // policies. + Instance DnsInstanceIdentityIntf `json:"instance,omitempty"` + + // The DNS zone to associate with this load balancer. + // + // The specified zone may be in a different region or account, subject to IAM policies. + Zone DnsZoneIdentityIntf `json:"zone,omitempty"` +} + +// UnmarshalLoadBalancerDnsPatch unmarshals an instance of LoadBalancerDnsPatch from the specified map of raw messages. +func UnmarshalLoadBalancerDnsPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerDnsPatch) + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerDnsPrototype : LoadBalancerDnsPrototype struct +type LoadBalancerDnsPrototype struct { + // The DNS instance to associate with this load balancer. + // + // The specified instance may be in a different region or account, subject to IAM + // policies. + Instance DnsInstanceIdentityIntf `json:"instance" validate:"required"` + + // The DNS zone to associate with this load balancer. + // + // The specified zone may be in a different region or account, subject to IAM policies. + Zone DnsZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewLoadBalancerDnsPrototype : Instantiate LoadBalancerDnsPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerDnsPrototype(instance DnsInstanceIdentityIntf, zone DnsZoneIdentityIntf) (_model *LoadBalancerDnsPrototype, err error) { + _model = &LoadBalancerDnsPrototype{ + Instance: instance, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerDnsPrototype unmarshals an instance of LoadBalancerDnsPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerDnsPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerDnsPrototype) + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // LoadBalancerIdentity : Identifies a load balancer by a unique property. // Models which "extend" this model: // - LoadBalancerIdentityByID @@ -50436,6 +50777,8 @@ func UnmarshalLoadBalancerLoggingPrototype(m map[string]json.RawMessage, result // LoadBalancerPatch : LoadBalancerPatch struct type LoadBalancerPatch struct { + Dns *LoadBalancerDnsPatch `json:"dns,omitempty"` + // The logging configuration to use for this load balancer. // // To activate logging, the load balancer profile must support the specified logging type. @@ -50457,6 +50800,10 @@ type LoadBalancerPatch struct { // UnmarshalLoadBalancerPatch unmarshals an instance of LoadBalancerPatch from the specified map of raw messages. func UnmarshalLoadBalancerPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerPatch) + err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalLoadBalancerDnsPatch) + if err != nil { + return + } err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLoggingPatch) if err != nil { return @@ -61822,6 +62169,9 @@ type Vcpu struct { // The number of VCPUs assigned. Count *int64 `json:"count" validate:"required"` + + // The VCPU manufacturer. + Manufacturer *string `json:"manufacturer" validate:"required"` } // UnmarshalVcpu unmarshals an instance of Vcpu from the specified map of raw messages. @@ -61835,6 +62185,10 @@ func UnmarshalVcpu(m map[string]json.RawMessage, result interface{}) (err error) if err != nil { return } + err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -61862,7 +62216,9 @@ type VPC struct { // The default routing table to use for subnets created in this VPC. DefaultRoutingTable *RoutingTableReference `json:"default_routing_table" validate:"required"` - // The default security group to use for network interfaces created in this VPC. + // The default security group for this VPC. Resources created in this VPC that allow + // a security group to be optionally specified will use this security group by + // default. DefaultSecurityGroup *SecurityGroupReference `json:"default_security_group" validate:"required"` // The URL for this VPC. @@ -68392,6 +68748,67 @@ func UnmarshalCertificateInstanceIdentityByCRN(m map[string]json.RawMessage, res return } +// DnsInstanceIdentityByCRN : DnsInstanceIdentityByCRN struct +// This model "extends" DnsInstanceIdentity +type DnsInstanceIdentityByCRN struct { + // The CRN for this DNS instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewDnsInstanceIdentityByCRN : Instantiate DnsInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewDnsInstanceIdentityByCRN(crn string) (_model *DnsInstanceIdentityByCRN, err error) { + _model = &DnsInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DnsInstanceIdentityByCRN) isaDnsInstanceIdentity() bool { + return true +} + +// UnmarshalDnsInstanceIdentityByCRN unmarshals an instance of DnsInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalDnsInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsZoneIdentityByID : DnsZoneIdentityByID struct +// This model "extends" DnsZoneIdentity +type DnsZoneIdentityByID struct { + ID *string `json:"id" validate:"required"` +} + +// NewDnsZoneIdentityByID : Instantiate DnsZoneIdentityByID (Generic Model Constructor) +func (*VpcV1) NewDnsZoneIdentityByID(id string) (_model *DnsZoneIdentityByID, err error) { + _model = &DnsZoneIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DnsZoneIdentityByID) isaDnsZoneIdentity() bool { + return true +} + +// UnmarshalDnsZoneIdentityByID unmarshals an instance of DnsZoneIdentityByID from the specified map of raw messages. +func UnmarshalDnsZoneIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsZoneIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // DedicatedHostGroupIdentityByCRN : DedicatedHostGroupIdentityByCRN struct // This model "extends" DedicatedHostGroupIdentity type DedicatedHostGroupIdentityByCRN struct { @@ -72867,6 +73284,76 @@ func UnmarshalInstanceProfileMemoryRange(m map[string]json.RawMessage, result in return } +// InstanceProfileNetworkInterfaceCountDependent : The number of network interfaces supported on an instance with this profile is dependent on its configuration. +// This model "extends" InstanceProfileNetworkInterfaceCount +type InstanceProfileNetworkInterfaceCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileNetworkInterfaceCountDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkInterfaceCountDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileNetworkInterfaceCountDependent) isaInstanceProfileNetworkInterfaceCount() bool { + return true +} + +// UnmarshalInstanceProfileNetworkInterfaceCountDependent unmarshals an instance of InstanceProfileNetworkInterfaceCountDependent from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkInterfaceCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkInterfaceCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkInterfaceCountRange : The number of network interfaces supported on an instance with this profile. +// This model "extends" InstanceProfileNetworkInterfaceCount +type InstanceProfileNetworkInterfaceCountRange 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" validate:"required"` +} + +// Constants associated with the InstanceProfileNetworkInterfaceCountRange.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkInterfaceCountRangeTypeRangeConst = "range" +) + +func (*InstanceProfileNetworkInterfaceCountRange) isaInstanceProfileNetworkInterfaceCount() bool { + return true +} + +// UnmarshalInstanceProfileNetworkInterfaceCountRange unmarshals an instance of InstanceProfileNetworkInterfaceCountRange from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkInterfaceCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkInterfaceCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceProfilePortSpeedDependent : The port speed of each network interface of an instance with this profile depends on its configuration. // This model "extends" InstanceProfilePortSpeed type InstanceProfilePortSpeedDependent struct { From 379fe39f30f85a0459e960fba0e06a743061ce84 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 18 Apr 2023 10:28:56 +0530 Subject: [PATCH 027/103] sdk update on 2023-04-18 --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 893 +++++++++++++----- go.mod | 2 +- go.sum | 7 +- 3 files changed, 637 insertions(+), 265 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index c4ab226a54..12010dc2e0 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.67.0-df2073a1-20230222-221157 + * IBM OpenAPI SDK Code Generator Version: 3.69.0-370d6400-20230329-174648 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -37,7 +37,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: 2023-03-28 +// API Version: 2022-09-13 type VpcV1 struct { Service *core.BaseService @@ -11190,8 +11190,8 @@ func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx } // GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP address if it is associated with the network interface and bare metal -// server specified in the URL. +// This request retrieves a specified floating IP if it is associated with the network interface and bare metal server +// specified in the URL. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) } @@ -15264,11 +15264,11 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS // 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: // -// - An instance network interface identifier // - A bare metal server network interface identifier // - A VPN server identifier // - An application 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. @@ -15390,11 +15390,11 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu // CreateSecurityGroupTargetBinding : Add a target to a security group // This request adds a resource to an existing security group. The specified target identifier can be: // -// - An instance network interface identifier // - A bare metal server network interface identifier // - A VPN server identifier // - An application 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. @@ -21723,7 +21723,7 @@ func (options *AddEndpointGatewayIPOptions) SetHeaders(param map[string]string) // AddInstanceNetworkInterfaceFloatingIPOptions : The AddInstanceNetworkInterfaceFloatingIP options. type AddInstanceNetworkInterfaceFloatingIPOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The network interface identifier. @@ -23209,6 +23209,16 @@ type BareMetalServer struct { // The unique identifier for this bare metal server. ID *string `json:"id" validate:"required"` + // The reasons for the current `lifecycle_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []BareMetalServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the bare metal server. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + // The amount of memory, truncated to whole gibibytes. Memory *int64 `json:"memory" validate:"required"` @@ -23250,6 +23260,18 @@ type BareMetalServer struct { Zone *ZoneReference `json:"zone" 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. // The resource type. const ( @@ -23309,6 +23331,14 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalBareMetalServerLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) if err != nil { return @@ -23897,6 +23927,43 @@ func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMess return } +// BareMetalServerLifecycleReason : BareMetalServerLifecycleReason struct +type BareMetalServerLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 BareMetalServerLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + BareMetalServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct // Models which "extend" this model: // - BareMetalServerNetworkInterfaceByHiperSocket @@ -24505,6 +24572,9 @@ func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json. 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"` @@ -24525,6 +24595,8 @@ type BareMetalServerProfile struct { // The name for this bare metal server profile. Name *string `json:"name" validate:"required"` + NetworkInterfaceCount BareMetalServerProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` + OsArchitecture *BareMetalServerProfileOsArchitecture `json:"os_architecture" validate:"required"` // The resource type. @@ -24547,6 +24619,10 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf if err != nil { return } + err = core.UnmarshalModel(m, "console_types", &obj.ConsoleTypes, UnmarshalBareMetalServerProfileConsoleTypes) + if err != nil { + return + } err = core.UnmarshalModel(m, "cpu_architecture", &obj.CpuArchitecture, UnmarshalBareMetalServerProfileCpuArchitecture) if err != nil { return @@ -24579,6 +24655,10 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf if err != nil { return } + err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalBareMetalServerProfileNetworkInterfaceCount) + if err != nil { + return + } err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture) if err != nil { return @@ -24958,6 +25038,43 @@ func UnmarshalBareMetalServerProfileCollectionNext(m map[string]json.RawMessage, return } +// 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"` +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + 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"` @@ -25332,6 +25449,54 @@ func UnmarshalBareMetalServerProfileMemory(m map[string]json.RawMessage, result return } +// 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 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 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 { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + 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. @@ -26661,7 +26826,7 @@ func (options *CreateImageOptions) SetHeaders(param map[string]string) *CreateIm // CreateInstanceActionOptions : The CreateInstanceAction options. type CreateInstanceActionOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The type of action. @@ -26716,7 +26881,7 @@ func (options *CreateInstanceActionOptions) SetHeaders(param map[string]string) // CreateInstanceConsoleAccessTokenOptions : The CreateInstanceConsoleAccessToken options. type CreateInstanceConsoleAccessTokenOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The instance console type for which this token may be used. @@ -27010,7 +27175,7 @@ func (options *CreateInstanceGroupOptions) SetHeaders(param map[string]string) * // CreateInstanceNetworkInterfaceOptions : The CreateInstanceNetworkInterface options. type CreateInstanceNetworkInterfaceOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The associated subnet. @@ -27147,7 +27312,7 @@ func (options *CreateInstanceTemplateOptions) SetHeaders(param map[string]string // CreateInstanceVolumeAttachmentOptions : The CreateInstanceVolumeAttachment options. type CreateInstanceVolumeAttachmentOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // An existing volume to attach to the instance, or a prototype object for a new volume. @@ -27842,6 +28007,11 @@ type CreateLoadBalancerOptions struct { // The datapath logging configuration for this load balancer. Datapath *LoadBalancerLoggingDatapathPrototype `json:"datapath,omitempty"` + // 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 `lb.appdomain.cloud`. Otherwise, those DNS `A` records will be + // added to the specified `zone`. Dns *LoadBalancerDnsPrototype `json:"dns,omitempty"` // The listeners of this load balancer. @@ -32270,7 +32440,7 @@ func (options *DeleteInstanceGroupOptions) SetHeaders(param map[string]string) * // DeleteInstanceNetworkInterfaceOptions : The DeleteInstanceNetworkInterface options. type DeleteInstanceNetworkInterfaceOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The network interface identifier. @@ -32308,7 +32478,7 @@ func (options *DeleteInstanceNetworkInterfaceOptions) SetHeaders(param map[strin // DeleteInstanceOptions : The DeleteInstance options. type DeleteInstanceOptions struct { - // The instance identifier. + // The virtual server instance identifier. ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests @@ -32364,7 +32534,7 @@ func (options *DeleteInstanceTemplateOptions) SetHeaders(param map[string]string // DeleteInstanceVolumeAttachmentOptions : The DeleteInstanceVolumeAttachment options. type DeleteInstanceVolumeAttachmentOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The volume attachment identifier. @@ -34173,41 +34343,6 @@ func UnmarshalFloatingIP(m map[string]json.RawMessage, result interface{}) (err return } -// FloatingIPByTargetNetworkInterfaceIdentity : The network interface this floating IP is to be bound to. -// Models which "extend" this model: -// - FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID -// - FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref -type FloatingIPByTargetNetworkInterfaceIdentity struct { - // The unique identifier for this network interface. - ID *string `json:"id,omitempty"` - - // The URL for this network interface. - Href *string `json:"href,omitempty"` -} - -func (*FloatingIPByTargetNetworkInterfaceIdentity) isaFloatingIPByTargetNetworkInterfaceIdentity() bool { - return true -} - -type FloatingIPByTargetNetworkInterfaceIdentityIntf interface { - isaFloatingIPByTargetNetworkInterfaceIdentity() bool -} - -// UnmarshalFloatingIPByTargetNetworkInterfaceIdentity unmarshals an instance of FloatingIPByTargetNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFloatingIPByTargetNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPByTargetNetworkInterfaceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // FloatingIPCollection : FloatingIPCollection struct type FloatingIPCollection struct { // A link to the first page of resources. @@ -34305,8 +34440,14 @@ type FloatingIPPatch struct { // The name for this floating IP. The name must not be used by another floating IP in the region. Name *string `json:"name,omitempty"` - // The network interface to bind the floating IP to, replacing any existing binding. + // The target resource to bind this floating IP to, replacing any existing binding. // The floating IP must not be required by another resource, such as a public gateway. + // + // The target resource must not already have a floating IP bound to it if the target + // resource is: + // + // - an instance network interface + // - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. Target FloatingIPTargetPatchIntf `json:"target,omitempty"` } @@ -34351,8 +34492,14 @@ type FloatingIPPrototype struct { // The zone this floating IP will reside in. Zone ZoneIdentityIntf `json:"zone,omitempty"` - // The network interface this floating IP is to be bound to. - Target FloatingIPByTargetNetworkInterfaceIdentityIntf `json:"target,omitempty"` + // 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: + // + // - an instance network interface + // - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. + Target FloatingIPTargetPrototypeIntf `json:"target,omitempty"` } func (*FloatingIPPrototype) isaFloatingIPPrototype() bool { @@ -34378,7 +34525,7 @@ func UnmarshalFloatingIPPrototype(m map[string]json.RawMessage, result interface if err != nil { return } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPByTargetNetworkInterfaceIdentity) + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype) if err != nil { return } @@ -34533,11 +34680,15 @@ func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) return } -// FloatingIPTargetPatch : The network interface to bind the floating IP to, replacing any existing binding. The floating IP must not be -// required by another resource, such as a public gateway. +// FloatingIPTargetPatch : The target resource to bind this floating IP to, replacing any existing binding. The floating IP must not be required +// by another resource, such as a public gateway. +// +// The target resource must not already have a floating IP bound to it if the target resource is: +// +// - an instance network interface +// - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. // Models which "extend" this model: -// - FloatingIPTargetPatchNetworkInterfaceIdentityByID -// - FloatingIPTargetPatchNetworkInterfaceIdentityByHref +// - FloatingIPTargetPatchNetworkInterfaceIdentity type FloatingIPTargetPatch struct { // The unique identifier for this network interface. ID *string `json:"id,omitempty"` @@ -34569,6 +34720,45 @@ func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interfa 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: +// +// - an instance network interface +// - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. +// Models which "extend" this model: +// - FloatingIPTargetPrototypeNetworkInterfaceIdentity +type FloatingIPTargetPrototype struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` +} + +func (*FloatingIPTargetPrototype) isaFloatingIPTargetPrototype() bool { + return true +} + +type FloatingIPTargetPrototypeIntf interface { + isaFloatingIPTargetPrototype() bool +} + +// UnmarshalFloatingIPTargetPrototype unmarshals an instance of FloatingIPTargetPrototype from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPUnpaginatedCollection : FloatingIPUnpaginatedCollection struct type FloatingIPUnpaginatedCollection struct { // Collection of floating IPs. @@ -35640,7 +35830,7 @@ func (options *GetImageOptions) SetHeaders(param map[string]string) *GetImageOpt // GetInstanceDiskOptions : The GetInstanceDisk options. type GetInstanceDiskOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The instance disk identifier. @@ -35906,7 +36096,7 @@ func (options *GetInstanceInitializationOptions) SetHeaders(param map[string]str // GetInstanceNetworkInterfaceFloatingIPOptions : The GetInstanceNetworkInterfaceFloatingIP options. type GetInstanceNetworkInterfaceFloatingIPOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The network interface identifier. @@ -35954,7 +36144,7 @@ func (options *GetInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param ma // GetInstanceNetworkInterfaceIPOptions : The GetInstanceNetworkInterfaceIP options. type GetInstanceNetworkInterfaceIPOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The network interface identifier. @@ -36002,7 +36192,7 @@ func (options *GetInstanceNetworkInterfaceIPOptions) SetHeaders(param map[string // GetInstanceNetworkInterfaceOptions : The GetInstanceNetworkInterface options. type GetInstanceNetworkInterfaceOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The network interface identifier. @@ -36040,7 +36230,7 @@ func (options *GetInstanceNetworkInterfaceOptions) SetHeaders(param map[string]s // GetInstanceOptions : The GetInstance options. type GetInstanceOptions struct { - // The instance identifier. + // The virtual server instance identifier. ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests @@ -36124,7 +36314,7 @@ func (options *GetInstanceTemplateOptions) SetHeaders(param map[string]string) * // GetInstanceVolumeAttachmentOptions : The GetInstanceVolumeAttachment options. type GetInstanceVolumeAttachmentOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The volume attachment identifier. @@ -44080,9 +44270,9 @@ func UnmarshalInstanceStatusReason(m map[string]json.RawMessage, result interfac // InstanceTemplate : InstanceTemplate struct // Models which "extend" this model: -// - InstanceTemplateInstanceByImage -// - InstanceTemplateInstanceBySourceSnapshot -// - InstanceTemplateInstanceByCatalogOffering +// - InstanceTemplateInstanceByImageInstanceTemplateContext +// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext +// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext type InstanceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -44439,10 +44629,10 @@ func (instanceTemplatePatch *InstanceTemplatePatch) AsPatch() (_patch map[string // InstanceTemplatePrototype : InstanceTemplatePrototype struct // Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceByImage +// - InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext // - InstanceTemplatePrototypeInstanceBySourceTemplate -// - InstanceTemplatePrototypeInstanceBySourceSnapshot -// - InstanceTemplatePrototypeInstanceByCatalogOffering +// - InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext +// - InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext type InstanceTemplatePrototype struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -46222,7 +46412,7 @@ func (options *ListImagesOptions) SetHeaders(param map[string]string) *ListImage // ListInstanceDisksOptions : The ListInstanceDisks options. type ListInstanceDisksOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // Allows users to set headers on API requests @@ -46489,7 +46679,7 @@ func (options *ListInstanceGroupsOptions) SetHeaders(param map[string]string) *L // ListInstanceNetworkInterfaceFloatingIpsOptions : The ListInstanceNetworkInterfaceFloatingIps options. type ListInstanceNetworkInterfaceFloatingIpsOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The network interface identifier. @@ -46527,7 +46717,7 @@ func (options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetHeaders(param // ListInstanceNetworkInterfaceIpsOptions : The ListInstanceNetworkInterfaceIps options. type ListInstanceNetworkInterfaceIpsOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The network interface identifier. @@ -46583,7 +46773,7 @@ func (options *ListInstanceNetworkInterfaceIpsOptions) SetHeaders(param map[stri // ListInstanceNetworkInterfacesOptions : The ListInstanceNetworkInterfaces options. type ListInstanceNetworkInterfacesOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // Allows users to set headers on API requests @@ -46647,7 +46837,7 @@ func (options *ListInstanceTemplatesOptions) SetHeaders(param map[string]string) // ListInstanceVolumeAttachmentsOptions : The ListInstanceVolumeAttachments options. type ListInstanceVolumeAttachmentsOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // Allows users to set headers on API requests @@ -49034,7 +49224,10 @@ func UnmarshalLoadBalancerDns(m map[string]json.RawMessage, result interface{}) return } -// LoadBalancerDnsPatch : LoadBalancerDnsPatch struct +// LoadBalancerDnsPatch : The DNS configuration for this load balancer. +// +// Specify `null` to remove the existing DNS configuration, which will remove all DNS `A` records for this load balancer +// that had been added to `zone`, and add equivalent `A` records to the public DNS zone `lb.appdomain.cloud`. type LoadBalancerDnsPatch struct { // The DNS instance to associate with this load balancer. // @@ -49063,7 +49256,10 @@ func UnmarshalLoadBalancerDnsPatch(m map[string]json.RawMessage, result interfac return } -// LoadBalancerDnsPrototype : LoadBalancerDnsPrototype struct +// 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 +// `lb.appdomain.cloud`. Otherwise, those DNS `A` records will be added to the specified `zone`. type LoadBalancerDnsPrototype struct { // The DNS instance to associate with this load balancer. // @@ -50777,6 +50973,11 @@ func UnmarshalLoadBalancerLoggingPrototype(m map[string]json.RawMessage, result // LoadBalancerPatch : LoadBalancerPatch struct type LoadBalancerPatch struct { + // The DNS configuration for this load balancer. + // + // Specify `null` to remove the existing DNS configuration, which will remove all DNS `A` + // records for this load balancer that had been added to `zone`, and add equivalent `A` + // records to the public DNS zone `lb.appdomain.cloud`. Dns *LoadBalancerDnsPatch `json:"dns,omitempty"` // The logging configuration to use for this load balancer. @@ -55347,7 +55548,7 @@ func (options *RemoveEndpointGatewayIPOptions) SetHeaders(param map[string]strin // RemoveInstanceNetworkInterfaceFloatingIPOptions : The RemoveInstanceNetworkInterfaceFloatingIP options. type RemoveInstanceNetworkInterfaceFloatingIPOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The network interface identifier. @@ -60428,7 +60629,7 @@ func (options *UpdateImageOptions) SetHeaders(param map[string]string) *UpdateIm // UpdateInstanceDiskOptions : The UpdateInstanceDisk options. type UpdateInstanceDiskOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The instance disk identifier. @@ -60726,7 +60927,7 @@ func (options *UpdateInstanceGroupOptions) SetHeaders(param map[string]string) * // UpdateInstanceNetworkInterfaceOptions : The UpdateInstanceNetworkInterface options. type UpdateInstanceNetworkInterfaceOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The network interface identifier. @@ -60774,7 +60975,7 @@ func (options *UpdateInstanceNetworkInterfaceOptions) SetHeaders(param map[strin // UpdateInstanceOptions : The UpdateInstance options. type UpdateInstanceOptions struct { - // The instance identifier. + // The virtual server instance identifier. ID *string `json:"id" validate:"required,ne="` // The instance patch. @@ -60850,7 +61051,7 @@ func (options *UpdateInstanceTemplateOptions) SetHeaders(param map[string]string // UpdateInstanceVolumeAttachmentOptions : The UpdateInstanceVolumeAttachment options. type UpdateInstanceVolumeAttachmentOptions struct { - // The instance identifier. + // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` // The volume attachment identifier. @@ -65834,8 +66035,8 @@ type VolumePatch struct { Name *string `json:"name,omitempty"` // The profile to use for this volume. The requested profile must be in the same - // `family` as the current profile. The volume must be attached as a data volume to a - // running virtual server instance, and must have a `capacity` within the range + // `family` as the current profile. The volume must be attached as a data volume to + // a running virtual server instance, and must have a `capacity` within the range // supported by the specified profile. Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` @@ -68653,6 +68854,77 @@ func UnmarshalBareMetalServerProfileMemoryRange(m map[string]json.RawMessage, re return } +// BareMetalServerProfileNetworkInterfaceCountDependent : The number of network interfaces supported on a bare metal server with this profile is dependent on its +// configuration. +// This model "extends" BareMetalServerProfileNetworkInterfaceCount +type BareMetalServerProfileNetworkInterfaceCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileNetworkInterfaceCountDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkInterfaceCountDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileNetworkInterfaceCountDependent) isaBareMetalServerProfileNetworkInterfaceCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileNetworkInterfaceCountDependent unmarshals an instance of BareMetalServerProfileNetworkInterfaceCountDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkInterfaceCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkInterfaceCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileNetworkInterfaceCountRange : The number of network interfaces supported on a bare metal server with this profile. +// This model "extends" BareMetalServerProfileNetworkInterfaceCount +type BareMetalServerProfileNetworkInterfaceCountRange 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" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileNetworkInterfaceCountRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkInterfaceCountRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileNetworkInterfaceCountRange) isaBareMetalServerProfileNetworkInterfaceCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileNetworkInterfaceCountRange unmarshals an instance of BareMetalServerProfileNetworkInterfaceCountRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkInterfaceCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkInterfaceCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // CatalogOfferingIdentityCatalogOfferingByCRN : CatalogOfferingIdentityCatalogOfferingByCRN struct // This model "extends" CatalogOfferingIdentity type CatalogOfferingIdentityCatalogOfferingByCRN struct { @@ -69870,68 +70142,6 @@ func UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference(m map[ return } -// FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct -// This model "extends" FloatingIPByTargetNetworkInterfaceIdentity -type FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { - // The URL for this network interface. - Href *string `json:"href" validate:"required"` -} - -// NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { - _model = &FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPByTargetNetworkInterfaceIdentity() bool { - return true -} - -// UnmarshalFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct -// This model "extends" FloatingIPByTargetNetworkInterfaceIdentity -type FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { - // The unique identifier for this network interface. - ID *string `json:"id" validate:"required"` -} - -// NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { - _model = &FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPByTargetNetworkInterfaceIdentity() bool { - return true -} - -// UnmarshalFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // FloatingIPPrototypeFloatingIPByTarget : FloatingIPPrototypeFloatingIPByTarget struct // This model "extends" FloatingIPPrototype type FloatingIPPrototypeFloatingIPByTarget struct { @@ -69941,12 +70151,18 @@ type FloatingIPPrototypeFloatingIPByTarget struct { ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The network interface this floating IP is to be bound to. - Target FloatingIPByTargetNetworkInterfaceIdentityIntf `json:"target" validate:"required"` + // 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: + // + // - an instance network interface + // - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. + Target FloatingIPTargetPrototypeIntf `json:"target" validate:"required"` } // NewFloatingIPPrototypeFloatingIPByTarget : Instantiate FloatingIPPrototypeFloatingIPByTarget (Generic Model Constructor) -func (*VpcV1) NewFloatingIPPrototypeFloatingIPByTarget(target FloatingIPByTargetNetworkInterfaceIdentityIntf) (_model *FloatingIPPrototypeFloatingIPByTarget, err error) { +func (*VpcV1) NewFloatingIPPrototypeFloatingIPByTarget(target FloatingIPTargetPrototypeIntf) (_model *FloatingIPPrototypeFloatingIPByTarget, err error) { _model = &FloatingIPPrototypeFloatingIPByTarget{ Target: target, } @@ -69969,7 +70185,7 @@ func UnmarshalFloatingIPPrototypeFloatingIPByTarget(m map[string]json.RawMessage if err != nil { return } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPByTargetNetworkInterfaceIdentity) + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype) if err != nil { return } @@ -70022,29 +70238,39 @@ func UnmarshalFloatingIPPrototypeFloatingIPByZone(m map[string]json.RawMessage, return } -// FloatingIPTargetPatchNetworkInterfaceIdentityByHref : FloatingIPTargetPatchNetworkInterfaceIdentityByHref struct +// FloatingIPTargetPatchNetworkInterfaceIdentity : Identifies a network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID +// - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref // This model "extends" FloatingIPTargetPatch -type FloatingIPTargetPatchNetworkInterfaceIdentityByHref struct { +type FloatingIPTargetPatchNetworkInterfaceIdentity struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + // The URL for this network interface. - Href *string `json:"href" validate:"required"` + Href *string `json:"href,omitempty"` } -// NewFloatingIPTargetPatchNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchNetworkInterfaceIdentityByHref, err error) { - _model = &FloatingIPTargetPatchNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*FloatingIPTargetPatchNetworkInterfaceIdentity) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPatchNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPatchIntf + isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool } -func (*FloatingIPTargetPatchNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { +func (*FloatingIPTargetPatchNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { return true } -// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityByHref) +// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -70053,33 +70279,43 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityByHref(m map[string]j return } -// FloatingIPTargetPatchNetworkInterfaceIdentityByID : FloatingIPTargetPatchNetworkInterfaceIdentityByID struct -// This model "extends" FloatingIPTargetPatch -type FloatingIPTargetPatchNetworkInterfaceIdentityByID struct { +// FloatingIPTargetPrototypeNetworkInterfaceIdentity : Identifies a network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID +// - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref +// This model "extends" FloatingIPTargetPrototype +type FloatingIPTargetPrototypeNetworkInterfaceIdentity struct { // The unique identifier for this network interface. - ID *string `json:"id" validate:"required"` + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` } -// NewFloatingIPTargetPatchNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchNetworkInterfaceIdentityByID, err error) { - _model = &FloatingIPTargetPatchNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { + return true } -func (*FloatingIPTargetPatchNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { +type FloatingIPTargetPrototypeNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPrototypeIntf + isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { return true } -// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityByID) +// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -70262,8 +70498,8 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity(m map[string]json. // FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity : Identifies a network interface by a unique property. // Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID -// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref +// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID +// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref // This model "extends" FlowLogCollectorTargetPrototype type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity struct { // The unique identifier for this network interface. @@ -74668,9 +74904,9 @@ func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result return } -// InstanceTemplatePrototypeInstanceByCatalogOffering : InstanceTemplatePrototypeInstanceByCatalogOffering struct +// InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext : InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext struct // This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceByCatalogOffering struct { +type InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -74741,30 +74977,29 @@ type InstanceTemplatePrototypeInstanceByCatalogOffering struct { CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` // Primary network interface. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceByCatalogOffering : Instantiate InstanceTemplatePrototypeInstanceByCatalogOffering (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceByCatalogOffering(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceByCatalogOffering, err error) { - _model = &InstanceTemplatePrototypeInstanceByCatalogOffering{ - CatalogOffering: catalogOffering, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, +// NewInstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext : Instantiate InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext, err error) { + _model = &InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext{ + CatalogOffering: catalogOffering, + Zone: zone, } err = core.ValidateStruct(_model, "required parameters") return } -func (*InstanceTemplatePrototypeInstanceByCatalogOffering) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceByCatalogOffering unmarshals an instance of InstanceTemplatePrototypeInstanceByCatalogOffering from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceByCatalogOffering) +// UnmarshalInstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext unmarshals an instance of InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -74837,9 +75072,9 @@ func UnmarshalInstanceTemplatePrototypeInstanceByCatalogOffering(m map[string]js return } -// InstanceTemplatePrototypeInstanceByImage : InstanceTemplatePrototypeInstanceByImage struct +// InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext : InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext struct // This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceByImage struct { +type InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -74903,30 +75138,29 @@ type InstanceTemplatePrototypeInstanceByImage struct { Image ImageIdentityIntf `json:"image" validate:"required"` // Primary network interface. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceByImage : Instantiate InstanceTemplatePrototypeInstanceByImage (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceByImage, err error) { - _model = &InstanceTemplatePrototypeInstanceByImage{ - Image: image, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, +// NewInstanceTemplatePrototypeInstanceByImageInstanceTemplateContext : Instantiate InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceByImageInstanceTemplateContext(image ImageIdentityIntf, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext, err error) { + _model = &InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext{ + Image: image, + Zone: zone, } err = core.ValidateStruct(_model, "required parameters") return } -func (*InstanceTemplatePrototypeInstanceByImage) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceByImage unmarshals an instance of InstanceTemplatePrototypeInstanceByImage from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceByImage) +// UnmarshalInstanceTemplatePrototypeInstanceByImageInstanceTemplateContext unmarshals an instance of InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceByImageInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -74999,9 +75233,9 @@ func UnmarshalInstanceTemplatePrototypeInstanceByImage(m map[string]json.RawMess return } -// InstanceTemplatePrototypeInstanceBySourceSnapshot : InstanceTemplatePrototypeInstanceBySourceSnapshot struct +// InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext : InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext struct // This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceBySourceSnapshot struct { +type InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -75062,30 +75296,29 @@ type InstanceTemplatePrototypeInstanceBySourceSnapshot struct { BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` // Primary network interface. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceBySourceSnapshot : Instantiate InstanceTemplatePrototypeInstanceBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceBySourceSnapshot, err error) { - _model = &InstanceTemplatePrototypeInstanceBySourceSnapshot{ - BootVolumeAttachment: bootVolumeAttachment, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, +// NewInstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext : Instantiate InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext, err error) { + _model = &InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, } err = core.ValidateStruct(_model, "required parameters") return } -func (*InstanceTemplatePrototypeInstanceBySourceSnapshot) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceBySourceSnapshot) +// UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext unmarshals an instance of InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -75336,9 +75569,9 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]jso return } -// InstanceTemplateInstanceByCatalogOffering : InstanceTemplateInstanceByCatalogOffering struct +// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext : InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct // This model "extends" InstanceTemplate -type InstanceTemplateInstanceByCatalogOffering struct { +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -75421,19 +75654,19 @@ type InstanceTemplateInstanceByCatalogOffering struct { CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` // Primary network interface. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -func (*InstanceTemplateInstanceByCatalogOffering) isaInstanceTemplate() bool { +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceTemplateInstanceByCatalogOffering unmarshals an instance of InstanceTemplateInstanceByCatalogOffering from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOffering) +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -75522,9 +75755,9 @@ func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMes return } -// InstanceTemplateInstanceByImage : InstanceTemplateInstanceByImage struct +// InstanceTemplateInstanceByImageInstanceTemplateContext : InstanceTemplateInstanceByImageInstanceTemplateContext struct // This model "extends" InstanceTemplate -type InstanceTemplateInstanceByImage struct { +type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -75600,19 +75833,19 @@ type InstanceTemplateInstanceByImage struct { Image ImageIdentityIntf `json:"image" validate:"required"` // Primary network interface. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -func (*InstanceTemplateInstanceByImage) isaInstanceTemplate() bool { +func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceTemplateInstanceByImage unmarshals an instance of InstanceTemplateInstanceByImage from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImage) +// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -75701,9 +75934,9 @@ func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, resu return } -// InstanceTemplateInstanceBySourceSnapshot : InstanceTemplateInstanceBySourceSnapshot struct +// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext : InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct // This model "extends" InstanceTemplate -type InstanceTemplateInstanceBySourceSnapshot struct { +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -75776,19 +76009,19 @@ type InstanceTemplateInstanceBySourceSnapshot struct { BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` // Primary network interface. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -func (*InstanceTemplateInstanceBySourceSnapshot) isaInstanceTemplate() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceTemplateInstanceBySourceSnapshot unmarshals an instance of InstanceTemplateInstanceBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshot) +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -84084,6 +84317,146 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentit return } +// FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity +type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { + // The URL for this network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity +type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity +type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { + // The URL for this network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity +type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct // This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { @@ -84189,33 +84562,33 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByI return } -// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct // This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity -type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { // The URL for this network interface. Href *string `json:"href" validate:"required"` } -// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { - _model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ +// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { return true } -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { return true } -// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) +// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -84224,33 +84597,33 @@ func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInte return } -// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct // This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity -type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { // The unique identifier for this network interface. ID *string `json:"id" validate:"required"` } -// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { - _model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ +// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { return true } -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { return true } -// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) +// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return diff --git a/go.mod b/go.mod index ebf65684d9..321a31e80b 100644 --- a/go.mod +++ b/go.mod @@ -179,5 +179,5 @@ replace github.com/softlayer/softlayer-go v1.0.3 => github.com/IBM-Cloud/softlay replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt/jwt v3.2.1+incompatible replace github.com/IBM/secrets-manager-go-sdk v1.0.49 => github.com/IBM/secrets-manager-go-sdk v1.0.50-0.20230316070833-1e1d44fe67be + replace github.com/IBM/vpc-go-sdk v0.35.0 => ./common/github.com/IBM/vpc-go-sdk -replace github.com/IBM/secrets-manager-go-sdk v1.0.49 => github.com/IBM/secrets-manager-go-sdk v1.0.50-0.20230404201829-49a38f9b9a6e diff --git a/go.sum b/go.sum index d155d16750..fbe083d691 100644 --- a/go.sum +++ b/go.sum @@ -74,6 +74,7 @@ github.com/IBM/go-sdk-core/v5 v5.7.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= +github.com/IBM/go-sdk-core/v5 v5.12.1/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= github.com/IBM/go-sdk-core/v5 v5.13.0 h1:foXLa2LfTSr3kgldpizaSDXH3gS/HB3YKj1BK8ywrE4= github.com/IBM/go-sdk-core/v5 v5.13.0/go.mod h1:pVkN7IGmsSdmR1ZCU4E/cLcCclqRKMYgg7ya+O2Mk6g= github.com/IBM/ibm-cos-sdk-go v1.3.1/go.mod h1:YLBAYobEA8bD27P7xpMwSQeNQu6W3DNBtBComXrRzRY= @@ -99,12 +100,10 @@ github.com/IBM/scc-go-sdk/v4 v4.0.2 h1:8BHMRobCFurZwKaUhxWi8CdAA9+CvyzmlBOmo7KmX github.com/IBM/scc-go-sdk/v4 v4.0.2/go.mod h1:ufqf/kBtRn3Pq/pFXF6zQGHXV2P2EzPsntw1Sw19clE= github.com/IBM/schematics-go-sdk v0.2.1 h1:byATysGD+Z1k/wdtNqQmKALcAPjgSLuSyzcabh1jRAw= github.com/IBM/schematics-go-sdk v0.2.1/go.mod h1:Tw2OSAPdpC69AxcwoyqcYYaGTTW6YpERF9uNEU+BFRQ= -github.com/IBM/secrets-manager-go-sdk v1.0.50-0.20230404201829-49a38f9b9a6e h1:FaEVX404uS7J+veC3SghJPKl5bsL4lDxwxRelZ262Ws= -github.com/IBM/secrets-manager-go-sdk v1.0.50-0.20230404201829-49a38f9b9a6e/go.mod h1:qv+tQg8Z3Vb11DQYxDjEGeROHDtTLQxUWuOIrIdWg6E= +github.com/IBM/secrets-manager-go-sdk v1.0.50-0.20230316070833-1e1d44fe67be h1:fSMzsH48lTFPWFi4ulS0DYa6uK/l2oz5JiJEbFhwdjc= +github.com/IBM/secrets-manager-go-sdk v1.0.50-0.20230316070833-1e1d44fe67be/go.mod h1:qv+tQg8Z3Vb11DQYxDjEGeROHDtTLQxUWuOIrIdWg6E= github.com/IBM/vpc-beta-go-sdk v0.1.0 h1:+kdF+Y/0KY189HhpkqDrue9o0LluAr7rlOU5Zhu7hck= github.com/IBM/vpc-beta-go-sdk v0.1.0/go.mod h1:TGfLgJVmgQy6XvXc4lya8Vxvw7fvk83nqs5hdP+/VGo= -github.com/IBM/vpc-go-sdk v0.35.0 h1:Qc0OV2WIQLGwxuvPKusJdgeXiMwyHQITvSof+v125D8= -github.com/IBM/vpc-go-sdk v0.35.0/go.mod h1:Ozn0YBCs284Qvy+CNAmoLhh2eD48NnobiAyfgVd8wmA= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56/go.mod h1:Zb3OT4l0mf7P/GOs2w2Ilj5sdm5Whoq3pa24dAEBHFc= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= From 8e2eb005ca28cf9fdeb130d6ef577b4c9580f157 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 18 Apr 2023 10:31:07 +0530 Subject: [PATCH 028/103] breaking changes --- ibm/service/vpc/resource_ibm_is_floating_ip.go | 2 +- ibm/service/vpc/resource_ibm_is_instance_template.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_floating_ip.go b/ibm/service/vpc/resource_ibm_is_floating_ip.go index a75dbd1891..cbed74338c 100644 --- a/ibm/service/vpc/resource_ibm_is_floating_ip.go +++ b/ibm/service/vpc/resource_ibm_is_floating_ip.go @@ -345,7 +345,7 @@ func fipCreate(d *schema.ResourceData, meta interface{}, name string) error { if tgt, ok := d.GetOk(isFloatingIPTarget); ok { target = tgt.(string) - floatingIPPrototype.Target = &vpcv1.FloatingIPByTargetNetworkInterfaceIdentity{ + floatingIPPrototype.Target = &vpcv1.FloatingIPTargetPrototypeNetworkInterfaceIdentity{ ID: &target, } } diff --git a/ibm/service/vpc/resource_ibm_is_instance_template.go b/ibm/service/vpc/resource_ibm_is_instance_template.go index cdca5c6d7e..9ac2e29abe 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_template.go +++ b/ibm/service/vpc/resource_ibm_is_instance_template.go @@ -693,7 +693,7 @@ func instanceTemplateCreateByCatalogOffering(d *schema.ResourceData, meta interf return err } - instanceproto := &vpcv1.InstanceTemplatePrototypeInstanceByCatalogOffering{ + instanceproto := &vpcv1.InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext{ Zone: &vpcv1.ZoneIdentity{ Name: &zone, }, From 1a67a0b68b2b9b4dc99a52e027127e20888d23f6 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 3 May 2023 14:41:59 +0530 Subject: [PATCH 029/103] Update vpc_v1.go --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 1612 ++++++++++++++--- 1 file changed, 1380 insertions(+), 232 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 12010dc2e0..017dae1659 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -3397,8 +3397,8 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions } // DeleteImage : Delete an image -// This request deletes an image. This operation cannot be reversed. A system-provided image is not allowed to be -// deleted. Additionally, an image cannot be deleted if it: +// This request deletes an image. Any active image export jobs will be completed first. This operation cannot be +// reversed. A system-provided image is not allowed to be deleted. Additionally, an image cannot be deleted if it: // - has a `status` of `deleting` // - has a `status` of `pending` with a `status_reasons` code of `image_request_in_progress` // - has `catalog_offering.managed` set to `true`. @@ -3585,6 +3585,349 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions return } +// ListImageExportJobs : List all image export jobs +// This request lists all export jobs for an image. Each job tracks the exporting of the image to another location, such +// as a bucket within cloud object storage. +// +// The jobs will be sorted by their `created_at` property values, with newest jobs first. Jobs with identical +// `created_at` property values will in turn be sorted by ascending +// `name` property values. +func (vpc *VpcV1) ListImageExportJobs(listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListImageExportJobsWithContext(context.Background(), listImageExportJobsOptions) +} + +// ListImageExportJobsWithContext is an alternate form of the ListImageExportJobs method which supports a Context parameter +func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listImageExportJobsOptions, "listImageExportJobsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listImageExportJobsOptions, "listImageExportJobsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *listImageExportJobsOptions.ImageID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listImageExportJobsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageExportJobs") + 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 listImageExportJobsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listImageExportJobsOptions.Name)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJobUnpaginatedCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateImageExportJob : Create an image export job +// This request creates and queues a new export job for the image specified in the URL using the image export job +// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, `obsolete`, or +// `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains +// the information necessary to create and queue the new image export job. +func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + return vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) +} + +// CreateImageExportJobWithContext is an alternate form of the CreateImageExportJob method which supports a Context parameter +func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createImageExportJobOptions, "createImageExportJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createImageExportJobOptions, "createImageExportJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *createImageExportJobOptions.ImageID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createImageExportJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImageExportJob") + 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 createImageExportJobOptions.StorageBucket != nil { + body["storage_bucket"] = createImageExportJobOptions.StorageBucket + } + if createImageExportJobOptions.Format != nil { + body["format"] = createImageExportJobOptions.Format + } + if createImageExportJobOptions.Name != nil { + body["name"] = createImageExportJobOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteImageExportJob : Delete an image export job +// This request deletes an image export job. This operation cannot be reversed. If the job has not completed, the job +// will be canceled, and the incomplete exported image object deleted. If the job has completed, the exported image +// object will not be deleted. +func (vpc *VpcV1) DeleteImageExportJob(deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) +} + +// DeleteImageExportJobWithContext is an alternate form of the DeleteImageExportJob method which supports a Context parameter +func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteImageExportJobOptions, "deleteImageExportJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteImageExportJobOptions, "deleteImageExportJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *deleteImageExportJobOptions.ImageID, + "id": *deleteImageExportJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteImageExportJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImageExportJob") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetImageExportJob : Retrieve an image export job +// This request retrieves a single image export job specified by the identifier in the URL. +func (vpc *VpcV1) GetImageExportJob(getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + return vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) +} + +// GetImageExportJobWithContext is an alternate form of the GetImageExportJob method which supports a Context parameter +func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getImageExportJobOptions, "getImageExportJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getImageExportJobOptions, "getImageExportJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *getImageExportJobOptions.ImageID, + "id": *getImageExportJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getImageExportJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImageExportJob") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateImageExportJob : Update an image export job +// This request updates an image export job with the information in a provided image export job patch. The image export +// job patch object is structured in the same way as a retrieved image export job and contains only the information to +// be updated. +func (vpc *VpcV1) UpdateImageExportJob(updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + return vpc.UpdateImageExportJobWithContext(context.Background(), updateImageExportJobOptions) +} + +// UpdateImageExportJobWithContext is an alternate form of the UpdateImageExportJob method which supports a Context parameter +func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateImageExportJobOptions, "updateImageExportJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateImageExportJobOptions, "updateImageExportJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *updateImageExportJobOptions.ImageID, + "id": *updateImageExportJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateImageExportJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImageExportJob") + 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(updateImageExportJobOptions.ImageExportJobPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + if err != nil { + return + } + response.Result = result + } + + return +} + // ListOperatingSystems : List all operating systems // This request lists all operating systems in the region. func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { @@ -8050,6 +8393,10 @@ func (vpc *VpcV1) CreateDedicatedHostGroup(createDedicatedHostGroupOptions *Crea // CreateDedicatedHostGroupWithContext is an alternate form of the CreateDedicatedHostGroup method which supports a Context parameter func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } err = core.ValidateStruct(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions") if err != nil { return @@ -8084,15 +8431,15 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat if createDedicatedHostGroupOptions.Family != nil { body["family"] = createDedicatedHostGroupOptions.Family } + if createDedicatedHostGroupOptions.Zone != nil { + body["zone"] = createDedicatedHostGroupOptions.Zone + } if createDedicatedHostGroupOptions.Name != nil { body["name"] = createDedicatedHostGroupOptions.Name } if createDedicatedHostGroupOptions.ResourceGroup != nil { body["resource_group"] = createDedicatedHostGroupOptions.ResourceGroup } - if createDedicatedHostGroupOptions.Zone != nil { - body["zone"] = createDedicatedHostGroupOptions.Zone - } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -9031,6 +9378,10 @@ func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPoli // CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") + if err != nil { + return + } err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") if err != nil { return @@ -9059,12 +9410,12 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) - if createBackupPolicyOptions.MatchResourceTypes != nil { - body["match_resource_types"] = createBackupPolicyOptions.MatchResourceTypes - } if createBackupPolicyOptions.MatchUserTags != nil { body["match_user_tags"] = createBackupPolicyOptions.MatchUserTags } + if createBackupPolicyOptions.MatchResourceTypes != nil { + body["match_resource_types"] = createBackupPolicyOptions.MatchResourceTypes + } if createBackupPolicyOptions.Name != nil { body["name"] = createBackupPolicyOptions.Name } @@ -13949,6 +14300,10 @@ func (vpc *VpcV1) CreateNetworkACL(createNetworkACLOptions *CreateNetworkACLOpti // 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 { + return + } err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") if err != nil { return @@ -13976,11 +14331,9 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if createNetworkACLOptions.NetworkACLPrototype != nil { - _, err = builder.SetBodyContentJSON(createNetworkACLOptions.NetworkACLPrototype) - if err != nil { - return - } + _, err = builder.SetBodyContentJSON(createNetworkACLOptions.NetworkACLPrototype) + if err != nil { + return } request, err := builder.Build() @@ -26020,15 +26373,91 @@ func (options *CheckVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[st 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 of this Cloud Object Storage bucket. + CRN *string `json:"crn,omitempty"` +} + +func (*CloudObjectStorageBucketIdentity) isaCloudObjectStorageBucketIdentity() bool { + return true +} + +type CloudObjectStorageBucketIdentityIntf interface { + isaCloudObjectStorageBucketIdentity() 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // CreateBackupPolicyOptions : The CreateBackupPolicy options. type CreateBackupPolicyOptions struct { - // A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will + // 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. - MatchResourceTypes []string `json:"match_resource_types,omitempty"` + MatchUserTags []string `json:"match_user_tags" validate:"required"` - // The user tags this backup policy applies to. Resources that have both a matching user tag and a matching type will + // A 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. - MatchUserTags []string `json:"match_user_tags,omitempty"` + MatchResourceTypes []string `json:"match_resource_types,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. @@ -26052,14 +26481,10 @@ const ( ) // NewCreateBackupPolicyOptions : Instantiate CreateBackupPolicyOptions -func (*VpcV1) NewCreateBackupPolicyOptions() *CreateBackupPolicyOptions { - return &CreateBackupPolicyOptions{} -} - -// SetMatchResourceTypes : Allow user to set MatchResourceTypes -func (_options *CreateBackupPolicyOptions) SetMatchResourceTypes(matchResourceTypes []string) *CreateBackupPolicyOptions { - _options.MatchResourceTypes = matchResourceTypes - return _options +func (*VpcV1) NewCreateBackupPolicyOptions(matchUserTags []string) *CreateBackupPolicyOptions { + return &CreateBackupPolicyOptions{ + MatchUserTags: matchUserTags, + } } // SetMatchUserTags : Allow user to set MatchUserTags @@ -26068,6 +26493,12 @@ func (_options *CreateBackupPolicyOptions) SetMatchUserTags(matchUserTags []stri return _options } +// SetMatchResourceTypes : Allow user to set MatchResourceTypes +func (_options *CreateBackupPolicyOptions) SetMatchResourceTypes(matchResourceTypes []string) *CreateBackupPolicyOptions { + _options.MatchResourceTypes = matchResourceTypes + return _options +} + // SetName : Allow user to set Name func (_options *CreateBackupPolicyOptions) SetName(name string) *CreateBackupPolicyOptions { _options.Name = core.StringPtr(name) @@ -26288,7 +26719,7 @@ func (options *CreateBareMetalServerNetworkInterfaceOptions) SetHeaders(param ma type CreateBareMetalServerOptions struct { Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` - // Primary network interface for the bare metal server. + // The primary network interface to create for the bare metal server. PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) @@ -26406,10 +26837,13 @@ func (options *CreateBareMetalServerOptions) SetHeaders(param map[string]string) // CreateDedicatedHostGroupOptions : The CreateDedicatedHostGroup options. type CreateDedicatedHostGroupOptions struct { // The dedicated host profile class for hosts in this group. - Class *string `json:"class,omitempty"` + Class *string `json:"class" validate:"required"` // The dedicated host profile family for hosts in this group. - Family *string `json:"family,omitempty"` + Family *string `json:"family" validate:"required"` + + // The zone this dedicated host group will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. If // unspecified, the name will be a hyphenated list of randomly-selected words. @@ -26419,9 +26853,6 @@ type CreateDedicatedHostGroupOptions struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The zone this dedicated host group will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` - // Allows users to set headers on API requests Headers map[string]string } @@ -26435,8 +26866,12 @@ const ( ) // NewCreateDedicatedHostGroupOptions : Instantiate CreateDedicatedHostGroupOptions -func (*VpcV1) NewCreateDedicatedHostGroupOptions() *CreateDedicatedHostGroupOptions { - return &CreateDedicatedHostGroupOptions{} +func (*VpcV1) NewCreateDedicatedHostGroupOptions(class string, family string, zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions { + return &CreateDedicatedHostGroupOptions{ + Class: core.StringPtr(class), + Family: core.StringPtr(family), + Zone: zone, + } } // SetClass : Allow user to set Class @@ -26451,6 +26886,12 @@ func (_options *CreateDedicatedHostGroupOptions) SetFamily(family string) *Creat return _options } +// SetZone : Allow user to set Zone +func (_options *CreateDedicatedHostGroupOptions) SetZone(zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions { + _options.Zone = zone + return _options +} + // SetName : Allow user to set Name func (_options *CreateDedicatedHostGroupOptions) SetName(name string) *CreateDedicatedHostGroupOptions { _options.Name = core.StringPtr(name) @@ -26463,12 +26904,6 @@ func (_options *CreateDedicatedHostGroupOptions) SetResourceGroup(resourceGroup return _options } -// SetZone : Allow user to set Zone -func (_options *CreateDedicatedHostGroupOptions) SetZone(zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions { - _options.Zone = zone - return _options -} - // SetHeaders : Allow user to set Headers func (options *CreateDedicatedHostGroupOptions) SetHeaders(param map[string]string) *CreateDedicatedHostGroupOptions { options.Headers = param @@ -26624,7 +27059,7 @@ type CreateFlowLogCollectorOptions struct { // Indicates whether this collector will be active upon creation. Active *bool `json:"active,omitempty"` - // The name for this flow log collector. The name must not be used by another flow log collector in the region. If + // The name for this flow log collector. The name must not be used by another flow log collector in the VPC. If // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -26796,6 +27231,76 @@ func (options *CreateIkePolicyOptions) SetHeaders(param map[string]string) *Crea return options } +// CreateImageExportJobOptions : The CreateImageExportJob options. +type CreateImageExportJobOptions struct { + // The image identifier. + ImageID *string `json:"image_id" validate:"required,ne="` + + // The Cloud Object Storage bucket to export the image to. The bucket must exist and an IAM + // service authorization must grant `Image Service for VPC` of + // `VPC Infrastructure Services` writer access to the bucket. + StorageBucket CloudObjectStorageBucketIdentityIntf `json:"storage_bucket" validate:"required"` + + // The format to use for the exported image. If the image is encrypted, only `qcow2` is supported. + Format *string `json:"format,omitempty"` + + // The name for this image export job. The name must not be used by another export job for the image. If unspecified, + // the name will be a hyphenated list of randomly-selected words prefixed with the first 16 characters of the parent + // image name. + // + // The exported image object name in Cloud Object Storage (`storage_object.name` in the response) will be based on this + // name. The object name will be unique within the bucket. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateImageExportJobOptions.Format property. +// The format to use for the exported image. If the image is encrypted, only `qcow2` is supported. +const ( + CreateImageExportJobOptionsFormatQcow2Const = "qcow2" + CreateImageExportJobOptionsFormatVhdConst = "vhd" +) + +// NewCreateImageExportJobOptions : Instantiate CreateImageExportJobOptions +func (*VpcV1) NewCreateImageExportJobOptions(imageID string, storageBucket CloudObjectStorageBucketIdentityIntf) *CreateImageExportJobOptions { + return &CreateImageExportJobOptions{ + ImageID: core.StringPtr(imageID), + StorageBucket: storageBucket, + } +} + +// SetImageID : Allow user to set ImageID +func (_options *CreateImageExportJobOptions) SetImageID(imageID string) *CreateImageExportJobOptions { + _options.ImageID = core.StringPtr(imageID) + return _options +} + +// SetStorageBucket : Allow user to set StorageBucket +func (_options *CreateImageExportJobOptions) SetStorageBucket(storageBucket CloudObjectStorageBucketIdentityIntf) *CreateImageExportJobOptions { + _options.StorageBucket = storageBucket + return _options +} + +// SetFormat : Allow user to set Format +func (_options *CreateImageExportJobOptions) SetFormat(format string) *CreateImageExportJobOptions { + _options.Format = core.StringPtr(format) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateImageExportJobOptions) SetName(name string) *CreateImageExportJobOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateImageExportJobOptions) SetHeaders(param map[string]string) *CreateImageExportJobOptions { + options.Headers = param + return options +} + // CreateImageOptions : The CreateImage options. type CreateImageOptions struct { // The image prototype object. @@ -28356,15 +28861,17 @@ func (options *CreateLoadBalancerPoolOptions) SetHeaders(param map[string]string // CreateNetworkACLOptions : The CreateNetworkACL options. type CreateNetworkACLOptions struct { // The network ACL prototype object. - NetworkACLPrototype NetworkACLPrototypeIntf `json:"NetworkACLPrototype,omitempty"` + NetworkACLPrototype NetworkACLPrototypeIntf `json:"NetworkACLPrototype" validate:"required"` // Allows users to set headers on API requests Headers map[string]string } // NewCreateNetworkACLOptions : Instantiate CreateNetworkACLOptions -func (*VpcV1) NewCreateNetworkACLOptions() *CreateNetworkACLOptions { - return &CreateNetworkACLOptions{} +func (*VpcV1) NewCreateNetworkACLOptions(networkACLPrototype NetworkACLPrototypeIntf) *CreateNetworkACLOptions { + return &CreateNetworkACLOptions{ + NetworkACLPrototype: networkACLPrototype, + } } // SetNetworkACLPrototype : Allow user to set NetworkACLPrototype @@ -29056,8 +29563,11 @@ type CreateVPCRouteOptions struct { // randomly-selected words. Name *string `json:"name,omitempty"` - // If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` - // values, it must be omitted or specified as `0.0.0.0`. + // If `action` is `deliver`, the next hop that packets will be delivered to. For other + // `action` values, it must be omitted or specified as `0.0.0.0`. + // + // At most two routes per `zone` in a table can have the same `destination` and `priority`, + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -29065,9 +29575,6 @@ type CreateVPCRouteOptions struct { // 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. - // - // At most two routes per `zone` in a table can have the same `destination` and - // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Priority *int64 `json:"priority,omitempty"` // Allows users to set headers on API requests @@ -29301,8 +29808,11 @@ type CreateVPCRoutingTableRouteOptions struct { // randomly-selected words. Name *string `json:"name,omitempty"` - // If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` - // values, it must be omitted or specified as `0.0.0.0`. + // If `action` is `deliver`, the next hop that packets will be delivered to. For other + // `action` values, it must be omitted or specified as `0.0.0.0`. + // + // At most two routes per `zone` in a table can have the same `destination` and `priority`, + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -29310,9 +29820,6 @@ type CreateVPCRoutingTableRouteOptions struct { // 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. - // - // At most two routes per `zone` in a table can have the same `destination` and - // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Priority *int64 `json:"priority,omitempty"` // Allows users to set headers on API requests @@ -32154,6 +32661,44 @@ func (options *DeleteIkePolicyOptions) SetHeaders(param map[string]string) *Dele return options } +// DeleteImageExportJobOptions : The DeleteImageExportJob options. +type DeleteImageExportJobOptions struct { + // The image identifier. + ImageID *string `json:"image_id" validate:"required,ne="` + + // The image export job identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteImageExportJobOptions : Instantiate DeleteImageExportJobOptions +func (*VpcV1) NewDeleteImageExportJobOptions(imageID string, id string) *DeleteImageExportJobOptions { + return &DeleteImageExportJobOptions{ + ImageID: core.StringPtr(imageID), + ID: core.StringPtr(id), + } +} + +// SetImageID : Allow user to set ImageID +func (_options *DeleteImageExportJobOptions) SetImageID(imageID string) *DeleteImageExportJobOptions { + _options.ImageID = core.StringPtr(imageID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteImageExportJobOptions) SetID(id string) *DeleteImageExportJobOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteImageExportJobOptions) SetHeaders(param map[string]string) *DeleteImageExportJobOptions { + options.Headers = param + return options +} + // DeleteImageOptions : The DeleteImage options. type DeleteImageOptions struct { // The image identifier. @@ -34800,7 +35345,7 @@ type FlowLogCollector struct { // The lifecycle state of the flow log collector. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The name for this flow log collector. The name is unique across all flow log collectors in the region. + // The name for this flow log collector. The name is unique across all flow log collectors in the VPC. Name *string `json:"name" validate:"required"` // The resource group for this flow log collector. @@ -34992,7 +35537,7 @@ type FlowLogCollectorPatch struct { // activates the collector. Active *bool `json:"active,omitempty"` - // The name for this flow log collector. The name must not be used by another flow log collector in the region. + // The name for this flow log collector. The name must not be used by another flow log collector in the VPC. Name *string `json:"name,omitempty"` } @@ -35800,6 +36345,44 @@ func (options *GetIkePolicyOptions) SetHeaders(param map[string]string) *GetIkeP return options } +// GetImageExportJobOptions : The GetImageExportJob options. +type GetImageExportJobOptions struct { + // The image identifier. + ImageID *string `json:"image_id" validate:"required,ne="` + + // The image export job identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetImageExportJobOptions : Instantiate GetImageExportJobOptions +func (*VpcV1) NewGetImageExportJobOptions(imageID string, id string) *GetImageExportJobOptions { + return &GetImageExportJobOptions{ + ImageID: core.StringPtr(imageID), + ID: core.StringPtr(id), + } +} + +// SetImageID : Allow user to set ImageID +func (_options *GetImageExportJobOptions) SetImageID(imageID string) *GetImageExportJobOptions { + _options.ImageID = core.StringPtr(imageID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetImageExportJobOptions) SetID(id string) *GetImageExportJobOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetImageExportJobOptions) SetHeaders(param map[string]string) *GetImageExportJobOptions { + options.Headers = param + return options +} + // GetImageOptions : The GetImage options. type GetImageOptions struct { // The image identifier. @@ -38989,6 +39572,254 @@ func UnmarshalImageCollectionNext(m map[string]json.RawMessage, result interface return } +// ImageExportJob : ImageExportJob struct +type ImageExportJob struct { + // The date and time that the image export job was completed. + // + // If absent, the export job has not yet completed. + CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` + + // The date and time that the image export job was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // A base64-encoded, encrypted representation of the key that was used to encrypt the data for the exported image. This + // key can be unwrapped with the image's `encryption_key` root key using either Key Protect or Hyper Protect Crypto + // Services. + // + // If absent, the export job is for an unencrypted image. + EncryptedDataKey *[]byte `json:"encrypted_data_key,omitempty"` + + // The format of the exported image. + Format *string `json:"format" validate:"required"` + + // The URL for this image export job. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this image export job. + ID *string `json:"id" validate:"required"` + + // The name for this image export job. The name must not be used by another export job for the image. Changing the name + // will not affect the exported image name, + // `storage_object.name`, or `storage_href` values. + Name *string `json:"name" validate:"required"` + + // The type of resource referenced. + ResourceType *string `json:"resource_type" validate:"required"` + + // The date and time that the image export job started running. + // + // If absent, the export job has not yet started. + StartedAt *strfmt.DateTime `json:"started_at,omitempty"` + + // The status of this image export job: + // - `deleting`: Export job is being deleted + // - `failed`: Export job could not be completed successfully + // - `queued`: Export job is queued + // - `running`: Export job is in progress + // - `succeeded`: Export job was completed successfully + // + // The exported image object is automatically deleted for `failed` jobs. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []ImageExportJobStatusReason `json:"status_reasons" validate:"required"` + + // The Cloud Object Storage bucket of the exported image object. + StorageBucket *CloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` + + // The Cloud Object Storage location of the exported image object. The object at this location will not exist until the + // job completes successfully. The exported image object is not managed by the IBM VPC service, and may be removed or + // replaced with a different object by any user or service with IAM authorization to the storage bucket. + StorageHref *string `json:"storage_href" validate:"required"` + + // The Cloud Object Storage object for the exported image. This object will not exist until + // the job completes successfully. The exported image object is not managed by the IBM VPC + // service, and may be removed or replaced with a different object by any user or service + // with IAM authorization to the storage bucket. + StorageObject *CloudObjectStorageObjectReference `json:"storage_object" validate:"required"` +} + +// Constants associated with the ImageExportJob.Format property. +// The format of the exported image. +const ( + ImageExportJobFormatQcow2Const = "qcow2" + ImageExportJobFormatVhdConst = "vhd" +) + +// Constants associated with the ImageExportJob.ResourceType property. +// The type of resource referenced. +const ( + ImageExportJobResourceTypeImageExportJobConst = "image_export_job" +) + +// Constants associated with the ImageExportJob.Status property. +// The status of this image export job: +// - `deleting`: Export job is being deleted +// - `failed`: Export job could not be completed successfully +// - `queued`: Export job is queued +// - `running`: Export job is in progress +// - `succeeded`: Export job was completed successfully +// +// The exported image object is automatically deleted for `failed` jobs. +const ( + ImageExportJobStatusDeletingConst = "deleting" + ImageExportJobStatusFailedConst = "failed" + ImageExportJobStatusQueuedConst = "queued" + ImageExportJobStatusRunningConst = "running" + ImageExportJobStatusSucceededConst = "succeeded" +) + +// UnmarshalImageExportJob unmarshals an instance of ImageExportJob from the specified map of raw messages. +func UnmarshalImageExportJob(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageExportJob) + err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "format", &obj.Format) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalImageExportJobStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalCloudObjectStorageBucketReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "storage_href", &obj.StorageHref) + if err != nil { + return + } + err = core.UnmarshalModel(m, "storage_object", &obj.StorageObject, UnmarshalCloudObjectStorageObjectReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageExportJobPatch : ImageExportJobPatch struct +type ImageExportJobPatch struct { + // The name for this image export job. The name must not be used by another export job for the image. Changing the name + // will not affect the exported image name, + // `storage_object.name`, or `storage_href` values. + Name *string `json:"name,omitempty"` +} + +// UnmarshalImageExportJobPatch unmarshals an instance of ImageExportJobPatch from the specified map of raw messages. +func UnmarshalImageExportJobPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageExportJobPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// ImageExportJobStatusReason : ImageExportJobStatusReason struct +type ImageExportJobStatusReason struct { + // A snake case string succinctly identifying the status reason. + 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 ImageExportJobStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + ImageExportJobStatusReasonCodeCannotAccessStorageBucketConst = "cannot_access_storage_bucket" + ImageExportJobStatusReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalImageExportJobStatusReason unmarshals an instance of ImageExportJobStatusReason from the specified map of raw messages. +func UnmarshalImageExportJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageExportJobStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageExportJobUnpaginatedCollection : ImageExportJobUnpaginatedCollection struct +type ImageExportJobUnpaginatedCollection struct { + // Collection of image export jobs. + ExportJobs []ImageExportJob `json:"export_jobs" validate:"required"` +} + +// UnmarshalImageExportJobUnpaginatedCollection unmarshals an instance of ImageExportJobUnpaginatedCollection from the specified map of raw messages. +func UnmarshalImageExportJobUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageExportJobUnpaginatedCollection) + err = core.UnmarshalModel(m, "export_jobs", &obj.ExportJobs, UnmarshalImageExportJob) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ImageFile : ImageFile struct type ImageFile struct { // Checksums for this image file. @@ -42142,10 +42973,10 @@ type InstanceGroupPatch struct { // At present, only load balancers in the `application` family are supported. LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` - // If specified, the load balancer pool this instance group will manage. A pool member - // will be created for each instance created by this group. + // If set, the load balancer pool this instance group will manage. A pool member will + // be created for each instance created by this group. // - // If specified, `load_balancer` and `application_port` must also be specified. + // If set, `load_balancer` and `application_port` must also be set. LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"` // The number of instances in the instance group. @@ -44006,9 +44837,6 @@ type InstancePrototype struct { // The system hostname will be based on this name. Name *string `json:"name,omitempty"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -44041,13 +44869,16 @@ type InstancePrototype struct { // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. + // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. @@ -44098,10 +44929,6 @@ func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{} if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -44138,6 +44965,10 @@ func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{} if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -44317,9 +45148,6 @@ type InstanceTemplate struct { // The name for this instance template. The name is unique across all instance templates in the region. Name *string `json:"name" validate:"required"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -44351,13 +45179,16 @@ type InstanceTemplate struct { // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. + // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. @@ -44421,10 +45252,6 @@ func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -44461,6 +45288,10 @@ func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -44666,9 +45497,6 @@ type InstanceTemplatePrototype struct { // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -44701,13 +45529,16 @@ type InstanceTemplatePrototype struct { // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. + // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. @@ -44759,10 +45590,6 @@ func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result int if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -44799,6 +45626,10 @@ func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result int if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -46341,6 +47172,43 @@ func (options *ListIkePolicyConnectionsOptions) SetHeaders(param map[string]stri return options } +// ListImageExportJobsOptions : The ListImageExportJobs options. +type ListImageExportJobsOptions struct { + // The image identifier. + ImageID *string `json:"image_id" validate:"required,ne="` + + // Filters the collection to resources with the exact specified name. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListImageExportJobsOptions : Instantiate ListImageExportJobsOptions +func (*VpcV1) NewListImageExportJobsOptions(imageID string) *ListImageExportJobsOptions { + return &ListImageExportJobsOptions{ + ImageID: core.StringPtr(imageID), + } +} + +// SetImageID : Allow user to set ImageID +func (_options *ListImageExportJobsOptions) SetImageID(imageID string) *ListImageExportJobsOptions { + _options.ImageID = core.StringPtr(imageID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListImageExportJobsOptions) SetName(name string) *ListImageExportJobsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListImageExportJobsOptions) SetHeaders(param map[string]string) *ListImageExportJobsOptions { + options.Headers = param + return options +} + // ListImagesOptions : The ListImages options. type ListImagesOptions struct { // A server-provided token determining what resource to start the page on. @@ -56957,16 +57825,16 @@ func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (er return } -// RouteNextHopPatch : The next hop that packets will be delivered to, if `action` is `deliver`. For other `action` values, specify -// `0.0.0.0` or remove it by specifying `null`. +// RouteNextHopPatch : If `action` is `deliver`, the next hop that packets will be delivered to. For other +// `action` values, specify `0.0.0.0` or remove it by specifying `null`. // -// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only if both routes have -// an `action` of `deliver` and the `next_hop` is an IP address. +// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has +// an `action` of `deliver` and `next_hop` is an IP address. // Models which "extend" this model: // - RouteNextHopPatchRouteNextHopIP // - RouteNextHopPatchVPNGatewayConnectionIdentity type RouteNextHopPatch struct { - // The IP address. + // The sentinel IP address (`0.0.0.0`). // // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the @@ -57013,11 +57881,11 @@ type RoutePatch struct { // are reserved for system-provided routes, and are not allowed. Name *string `json:"name,omitempty"` - // The next hop that packets will be delivered to, if `action` is `deliver`. For other `action` - // values, specify `0.0.0.0` or remove it by specifying `null`. + // If `action` is `deliver`, the next hop that packets will be delivered to. For other + // `action` values, specify `0.0.0.0` or remove it by specifying `null`. // - // At most two routes per `zone` in a table can have the same `destination` and `priority`, and - // only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. + // At most two routes per `zone` in a table can have the same `destination` and `priority`, + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. NextHop RouteNextHopPatchIntf `json:"next_hop,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -57025,9 +57893,6 @@ type RoutePatch struct { // 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. - // - // At most two routes per `zone` in a table can have the same `destination` and - // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Priority *int64 `json:"priority,omitempty"` } @@ -57078,8 +57943,11 @@ type RoutePrototype struct { // randomly-selected words. Name *string `json:"name,omitempty"` - // If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` - // values, it must be omitted or specified as `0.0.0.0`. + // If `action` is `deliver`, the next hop that packets will be delivered to. For other + // `action` values, it must be omitted or specified as `0.0.0.0`. + // + // At most two routes per `zone` in a table can have the same `destination` and `priority`, + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -57087,9 +57955,6 @@ type RoutePrototype struct { // 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. - // - // At most two routes per `zone` in a table can have the same `destination` and - // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Priority *int64 `json:"priority,omitempty"` // The zone to apply the route to. (Traffic from subnets in this zone will be @@ -57151,13 +58016,16 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( return } -// RoutePrototypeNextHop : If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` values, it must be -// omitted or specified as `0.0.0.0`. +// RoutePrototypeNextHop : If `action` is `deliver`, the next hop that packets will be delivered to. For other +// `action` values, it must be omitted or specified as `0.0.0.0`. +// +// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has +// an `action` of `deliver` and `next_hop` is an IP address. // Models which "extend" this model: // - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP // - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity type RoutePrototypeNextHop struct { - // The IP address. + // The sentinel IP address (`0.0.0.0`). // // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the @@ -60589,6 +61457,54 @@ func (options *UpdateIkePolicyOptions) SetHeaders(param map[string]string) *Upda return options } +// UpdateImageExportJobOptions : The UpdateImageExportJob options. +type UpdateImageExportJobOptions struct { + // The image identifier. + ImageID *string `json:"image_id" validate:"required,ne="` + + // The image export job identifier. + ID *string `json:"id" validate:"required,ne="` + + // The image export job patch. + ImageExportJobPatch map[string]interface{} `json:"ImageExportJob_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateImageExportJobOptions : Instantiate UpdateImageExportJobOptions +func (*VpcV1) NewUpdateImageExportJobOptions(imageID string, id string, imageExportJobPatch map[string]interface{}) *UpdateImageExportJobOptions { + return &UpdateImageExportJobOptions{ + ImageID: core.StringPtr(imageID), + ID: core.StringPtr(id), + ImageExportJobPatch: imageExportJobPatch, + } +} + +// SetImageID : Allow user to set ImageID +func (_options *UpdateImageExportJobOptions) SetImageID(imageID string) *UpdateImageExportJobOptions { + _options.ImageID = core.StringPtr(imageID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateImageExportJobOptions) SetID(id string) *UpdateImageExportJobOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetImageExportJobPatch : Allow user to set ImageExportJobPatch +func (_options *UpdateImageExportJobOptions) SetImageExportJobPatch(imageExportJobPatch map[string]interface{}) *UpdateImageExportJobOptions { + _options.ImageExportJobPatch = imageExportJobPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateImageExportJobOptions) SetHeaders(param map[string]string) *UpdateImageExportJobOptions { + options.Headers = param + return options +} + // UpdateImageOptions : The UpdateImage options. type UpdateImageOptions struct { // The image identifier. @@ -69020,6 +69936,68 @@ func UnmarshalCertificateInstanceIdentityByCRN(m map[string]json.RawMessage, res return } +// CloudObjectStorageBucketIdentityByCRN : CloudObjectStorageBucketIdentityByCRN struct +// This model "extends" CloudObjectStorageBucketIdentity +type CloudObjectStorageBucketIdentityByCRN struct { + // The CRN of this Cloud Object Storage bucket. + CRN *string `json:"crn" validate:"required"` +} + +// NewCloudObjectStorageBucketIdentityByCRN : Instantiate CloudObjectStorageBucketIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewCloudObjectStorageBucketIdentityByCRN(crn string) (_model *CloudObjectStorageBucketIdentityByCRN, err error) { + _model = &CloudObjectStorageBucketIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CloudObjectStorageBucketIdentityByCRN) isaCloudObjectStorageBucketIdentity() bool { + return true +} + +// UnmarshalCloudObjectStorageBucketIdentityByCRN unmarshals an instance of CloudObjectStorageBucketIdentityByCRN from the specified map of raw messages. +func UnmarshalCloudObjectStorageBucketIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageBucketIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct +// This model "extends" CloudObjectStorageBucketIdentity +type CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct { + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name" validate:"required"` +} + +// NewCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : Instantiate CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName (Generic Model Constructor) +func (*VpcV1) NewCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(name string) (_model *CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName, err error) { + _model = &CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) isaCloudObjectStorageBucketIdentity() bool { + return true +} + +// UnmarshalCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName unmarshals an instance of CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName from the specified map of raw messages. +func UnmarshalCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // DnsInstanceIdentityByCRN : DnsInstanceIdentityByCRN struct // This model "extends" DnsInstanceIdentity type DnsInstanceIdentityByCRN struct { @@ -74011,9 +74989,6 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The system hostname will be based on this name. Name *string `json:"name,omitempty"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -74039,7 +75014,7 @@ type InstancePrototypeInstanceByCatalogOffering struct { // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. + // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering @@ -74052,7 +75027,10 @@ type InstancePrototypeInstanceByCatalogOffering struct { // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. @@ -74097,10 +75075,6 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -74137,6 +75111,10 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -74182,9 +75160,6 @@ type InstancePrototypeInstanceByImage struct { // The system hostname will be based on this name. Name *string `json:"name,omitempty"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -74210,13 +75185,16 @@ type InstancePrototypeInstanceByImage struct { // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. + // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image" validate:"required"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. @@ -74261,10 +75239,6 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -74301,6 +75275,10 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -74346,9 +75324,6 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The system hostname will be based on this name. Name *string `json:"name,omitempty"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -74374,10 +75349,13 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. + // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. @@ -74422,10 +75400,6 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -74458,6 +75432,10 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -74503,9 +75481,6 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The system hostname will be based on this name. Name *string `json:"name,omitempty"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -74531,7 +75506,7 @@ type InstancePrototypeInstanceBySourceTemplate struct { // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. + // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) @@ -74548,7 +75523,10 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The template to create this virtual server instance from. @@ -74594,10 +75572,6 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -74638,6 +75612,10 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -74687,9 +75665,6 @@ type InstancePrototypeInstanceByVolume struct { // The system hostname will be based on this name. Name *string `json:"name,omitempty"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -74718,7 +75693,10 @@ type InstancePrototypeInstanceByVolume struct { // The boot volume attachment for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. @@ -74763,10 +75741,6 @@ func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, re if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -74799,6 +75773,10 @@ func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, re if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -74935,9 +75913,6 @@ type InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext s // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -74963,7 +75938,7 @@ type InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext s // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. + // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering @@ -74976,7 +75951,10 @@ type InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext s // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. @@ -75020,10 +75998,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplate if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -75060,6 +76034,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplate if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -75103,9 +76081,6 @@ type InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext struct { // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -75131,13 +76106,16 @@ type InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext struct { // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. + // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image" validate:"required"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. @@ -75181,10 +76159,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceByImageInstanceTemplateContext(m if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -75221,6 +76195,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceByImageInstanceTemplateContext(m if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -75264,9 +76242,6 @@ type InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext st // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -75292,10 +76267,13 @@ type InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext st // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. + // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. @@ -75339,10 +76317,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateC if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -75375,6 +76349,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateC if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -75418,9 +76396,6 @@ type InstanceTemplatePrototypeInstanceBySourceTemplate struct { // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -75446,7 +76421,7 @@ type InstanceTemplatePrototypeInstanceBySourceTemplate struct { // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. + // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) @@ -75463,7 +76438,10 @@ type InstanceTemplatePrototypeInstanceBySourceTemplate struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The template to create this virtual server instance from. @@ -75509,10 +76487,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]jso if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -75553,6 +76527,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]jso if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -75611,9 +76589,6 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // The name for this instance template. The name is unique across all instance templates in the region. Name *string `json:"name" validate:"required"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -75640,7 +76615,7 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. + // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering @@ -75653,7 +76628,10 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. @@ -75703,10 +76681,6 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -75743,6 +76717,10 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -75797,9 +76775,6 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // The name for this instance template. The name is unique across all instance templates in the region. Name *string `json:"name" validate:"required"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -75826,13 +76801,16 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. + // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image" validate:"required"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. @@ -75882,10 +76860,6 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[strin if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -75922,6 +76896,10 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[strin if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -75976,9 +76954,6 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // The name for this instance template. The name is unique across all instance templates in the region. Name *string `json:"name" validate:"required"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` @@ -76005,10 +76980,13 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // instance's network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. + // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - // Primary network interface. + // The additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network interface to create for the virtual server instance. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. @@ -76058,10 +77036,6 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return @@ -76094,6 +77068,10 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m if err != nil { return } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -80010,24 +80988,27 @@ func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) ( return } -// RouteNextHopPatchRouteNextHopIP : The IP address of the next hop to which to route packets. +// RouteNextHopPatchRouteNextHopIP : RouteNextHopPatchRouteNextHopIP struct +// Models which "extend" this model: +// - RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP +// - RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP // This model "extends" RouteNextHopPatch type RouteNextHopPatchRouteNextHopIP struct { - // The IP address. + // The sentinel IP address (`0.0.0.0`). // // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` + Address *string `json:"address,omitempty"` } -// NewRouteNextHopPatchRouteNextHopIP : Instantiate RouteNextHopPatchRouteNextHopIP (Generic Model Constructor) -func (*VpcV1) NewRouteNextHopPatchRouteNextHopIP(address string) (_model *RouteNextHopPatchRouteNextHopIP, err error) { - _model = &RouteNextHopPatchRouteNextHopIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatchRouteNextHopIP() bool { + return true +} + +type RouteNextHopPatchRouteNextHopIPIntf interface { + RouteNextHopPatchIntf + isaRouteNextHopPatchRouteNextHopIP() bool } func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatch() bool { @@ -80143,24 +81124,27 @@ func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMes return } -// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP : The IP address of the next hop to which to route packets. +// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct +// Models which "extend" this model: +// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP +// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP // This model "extends" RoutePrototypeNextHop type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct { - // The IP address. + // The sentinel IP address (`0.0.0.0`). // // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` + Address *string `json:"address,omitempty"` } -// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP (Generic Model Constructor) -func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP, err error) { - _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { + return true +} + +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPIntf interface { + RoutePrototypeNextHopIntf + isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool } func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHop() bool { @@ -86452,6 +87436,88 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIde return } +// RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP : RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct +// This model "extends" RouteNextHopPatchRouteNextHopIP +type RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP : Instantiate RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(address string) (_model *RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP, err error) { + _model = &RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPatchRouteNextHopIP() bool { + return true +} + +func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP unmarshals an instance of RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP from the specified map of raw messages. +func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP : RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP struct +// This model "extends" RouteNextHopPatchRouteNextHopIP +type RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP struct { + // A unicast IP address, which must not be any of the following values: + // + // - `0.0.0.0` (the sentinel IP address) + // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) + // - `255.255.255.255` (the broadcast IP address) + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP : Instantiate RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(address string) (_model *RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP, err error) { + _model = &RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPatchRouteNextHopIP() bool { + return true +} + +func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP unmarshals an instance of RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP from the specified map of raw messages. +func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct // This model "extends" RouteNextHopPatchVPNGatewayConnectionIdentity type RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { @@ -86522,6 +87588,88 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionI return } +// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct +// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { + return true +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP struct +// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP struct { + // A unicast IP address, which must not be any of the following values: + // + // - `0.0.0.0` (the sentinel IP address) + // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) + // - `255.255.255.255` (the broadcast IP address) + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { + return true +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct // This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { From b2afd1e864e3fa25354a6df44a8fac04af53cba1 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 16 May 2023 10:49:09 +0530 Subject: [PATCH 030/103] Update vpc_v1.go --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 53 ++++++++++++------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 017dae1659..a2a462d677 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -446,7 +446,8 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp } // UpdateVPC : Update a VPC -// This request updates a VPC's name. +// This request updates a VPC with the information provided in a VPC patch object. The patch object is structured in the +// same way as a retrieved VPC and needs to contain only the information to be updated. func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { return vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) } @@ -3658,9 +3659,9 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE // CreateImageExportJob : Create an image export job // This request creates and queues a new export job for the image specified in the URL using the image export job -// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, `obsolete`, or -// `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains -// the information necessary to create and queue the new image export job. +// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, or `unusable` +// state. The prototype object is structured in the same way as a retrieved image export job, and contains the +// information necessary to create and queue the new image export job. func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { return vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) } @@ -39501,6 +39502,9 @@ 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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } // UnmarshalImageCollection unmarshals an instance of ImageCollection from the specified map of raw messages. @@ -39522,6 +39526,10 @@ func UnmarshalImageCollection(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -46529,13 +46537,13 @@ type ListBareMetalServersOptions struct { // Filters the collection to resources with the exact specified name. Name *string `json:"name,omitempty"` - // Filters the collection to resources in the VPC with the specified identifier. + // Filters the collection to resources with `vpc.id` matching the specified identifier. VPCID *string `json:"vpc.id,omitempty"` - // Filters the collection to resources in the VPC with the specified CRN. + // Filters the collection to resources with `vpc.crn` matching the specified CRN. VPCCRN *string `json:"vpc.crn,omitempty"` - // Filters the collection to resources in the VPC with the exact specified name. + // Filters the collection to resources with a `vpc.name` value matching the exact specified name. VPCName *string `json:"vpc.name,omitempty"` // Filters the collection to bare metal servers on the subnet with the specified identifier. @@ -47016,13 +47024,13 @@ type ListFlowLogCollectorsOptions struct { // Filters the collection to resources with the exact specified name. Name *string `json:"name,omitempty"` - // Filters the collection to resources in the VPC with the specified identifier. + // Filters the collection to resources with `vpc.id` matching the specified identifier. VPCID *string `json:"vpc.id,omitempty"` - // Filters the collection to resources in the VPC with the specified CRN. + // Filters the collection to resources with `vpc.crn` matching the specified CRN. VPCCRN *string `json:"vpc.crn,omitempty"` - // Filters the collection to resources in the VPC with the exact specified name. + // Filters the collection to resources with a `vpc.name` value matching the exact specified name. VPCName *string `json:"vpc.name,omitempty"` // Filters the collection to flow log collectors that target the specified resource. @@ -47745,13 +47753,13 @@ type ListInstancesOptions struct { // Filters the collection to resources with the exact specified name. Name *string `json:"name,omitempty"` - // Filters the collection to resources in the VPC with the specified identifier. + // Filters the collection to resources with `vpc.id` matching the specified identifier. VPCID *string `json:"vpc.id,omitempty"` - // Filters the collection to resources in the VPC with the specified CRN. + // Filters the collection to resources with `vpc.crn` matching the specified CRN. VPCCRN *string `json:"vpc.crn,omitempty"` - // Filters the collection to resources in the VPC with the exact specified name. + // Filters the collection to resources with a `vpc.name` value matching the exact specified name. VPCName *string `json:"vpc.name,omitempty"` // Filters the collection to instances on the dedicated host with the specified identifier. @@ -48564,13 +48572,13 @@ type ListSecurityGroupsOptions struct { // Filters the collection to resources in the resource group with the specified identifier. ResourceGroupID *string `json:"resource_group.id,omitempty"` - // Filters the collection to resources in the VPC with the specified identifier. + // Filters the collection to resources with `vpc.id` matching the specified identifier. VPCID *string `json:"vpc.id,omitempty"` - // Filters the collection to resources in the VPC with the specified CRN. + // Filters the collection to resources with `vpc.crn` matching the specified CRN. VPCCRN *string `json:"vpc.crn,omitempty"` - // Filters the collection to resources in the VPC with the exact specified name. + // Filters the collection to resources with a `vpc.name` value matching the exact specified name. VPCName *string `json:"vpc.name,omitempty"` // Allows users to set headers on API requests @@ -55430,6 +55438,9 @@ type OperatingSystemCollection struct { // Collection of operating systems. OperatingSystems []OperatingSystem `json:"operating_systems" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } // UnmarshalOperatingSystemCollection unmarshals an instance of OperatingSystemCollection from the specified map of raw messages. @@ -55451,6 +55462,10 @@ func UnmarshalOperatingSystemCollection(m map[string]json.RawMessage, result int if err != nil { return } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -64711,10 +64726,10 @@ func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMes // VPNGatewayMember : VPNGatewayMember struct type VPNGatewayMember struct { - // The private IP address assigned to the VPN gateway member. + // The reserved IP address assigned to the VPN gateway member. // // This property will be present only when the VPN gateway status is `available`. - PrivateIP *IP `json:"private_ip,omitempty"` + PrivateIP *ReservedIPReference `json:"private_ip" validate:"required"` // The public IP address assigned to the VPN gateway member. PublicIP *IP `json:"public_ip" validate:"required"` @@ -64745,7 +64760,7 @@ const ( // UnmarshalVPNGatewayMember unmarshals an instance of VPNGatewayMember from the specified map of raw messages. func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VPNGatewayMember) - err = core.UnmarshalModel(m, "private_ip", &obj.PrivateIP, UnmarshalIP) + err = core.UnmarshalModel(m, "private_ip", &obj.PrivateIP, UnmarshalReservedIPReference) if err != nil { return } From 300c2a08ee0d497c1ecb5a3b2ff3b53b64746ad7 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 25 May 2023 10:04:06 +0530 Subject: [PATCH 031/103] Update vpc_v1.go --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 343 ++++++++---------- 1 file changed, 153 insertions(+), 190 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index a2a462d677..69fa789533 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2021, 2022, 2023. + * (C) Copyright IBM Corp. 2023. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ type VpcV1 struct { generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and today's date (UTC). + // and `2023-05-25`. Version *string } @@ -63,8 +63,8 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and today's date (UTC). - Version *string + // and `2023-05-25`. + Version *string `validate:"required"` } // NewVpcV1UsingExternalConfig : constructs an instance of VpcV1 with passed in options and external configuration. @@ -121,7 +121,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2022-09-13") + options.Version = core.StringPtr("2023-05-23") } service = &VpcV1{ @@ -5154,8 +5154,8 @@ func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceO } // GetInstanceInitialization : Retrieve initialization configuration for an instance -// This request retrieves configuration variables used to initialize the instance, such as SSH keys and the Windows -// administrator password. +// This request retrieves configuration used to initialize the instance, such as SSH keys and the Windows administrator +// password. These can subsequently be changed on the instance and therefore may not be current. func (vpc *VpcV1) GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { return vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) } @@ -11991,9 +11991,9 @@ func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBa } // GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server -// This request retrieves configuration variables used to initialize the bare metal server, such as the image used, SSH -// keys, and any configured usernames and passwords. These attributes can subsequently be changed manually by the user -// and so are not guaranteed to be current. +// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and +// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be +// current. func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) } @@ -27118,19 +27118,13 @@ func (options *CreateFlowLogCollectorOptions) SetHeaders(param map[string]string // CreateIkePolicyOptions : The CreateIkePolicy options. type CreateIkePolicyOptions struct { - // The authentication algorithm - // - // The `md5` and `sha1` algorithms have been deprecated. + // The authentication algorithm. AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` - // The Diffie-Hellman group - // - // Groups `2` and `5` have been deprecated. + // The Diffie-Hellman group. DhGroup *int64 `json:"dh_group" validate:"required"` - // The encryption algorithm - // - // The `triple_des` algorithm has been deprecated. + // The encryption algorithm. EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` // The IKE protocol version. @@ -27152,26 +27146,19 @@ type CreateIkePolicyOptions struct { } // Constants associated with the CreateIkePolicyOptions.AuthenticationAlgorithm property. -// The authentication algorithm -// -// The `md5` and `sha1` algorithms have been deprecated. +// The authentication algorithm. const ( - CreateIkePolicyOptionsAuthenticationAlgorithmMd5Const = "md5" - CreateIkePolicyOptionsAuthenticationAlgorithmSha1Const = "sha1" CreateIkePolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" CreateIkePolicyOptionsAuthenticationAlgorithmSha384Const = "sha384" CreateIkePolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" ) // Constants associated with the CreateIkePolicyOptions.EncryptionAlgorithm property. -// The encryption algorithm -// -// The `triple_des` algorithm has been deprecated. +// The encryption algorithm. const ( - CreateIkePolicyOptionsEncryptionAlgorithmAes128Const = "aes128" - CreateIkePolicyOptionsEncryptionAlgorithmAes192Const = "aes192" - CreateIkePolicyOptionsEncryptionAlgorithmAes256Const = "aes256" - CreateIkePolicyOptionsEncryptionAlgorithmTripleDesConst = "triple_des" + CreateIkePolicyOptionsEncryptionAlgorithmAes128Const = "aes128" + CreateIkePolicyOptionsEncryptionAlgorithmAes192Const = "aes192" + CreateIkePolicyOptionsEncryptionAlgorithmAes256Const = "aes256" ) // NewCreateIkePolicyOptions : Instantiate CreateIkePolicyOptions @@ -27877,24 +27864,18 @@ func (options *CreateInstanceVolumeAttachmentOptions) SetHeaders(param map[strin type CreateIpsecPolicyOptions struct { // The authentication algorithm // - // The `md5` and `sha1` algorithms have been deprecated - // // Must be `disabled` if and only if the `encryption_algorithm` is // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` // The encryption algorithm // - // The `triple_des` algorithm has been deprecated - // // The `authentication_algorithm` must be `disabled` if and only if // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or // `aes256gcm16`. EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` - // Perfect Forward Secrecy - // - // Groups `group_2` and `group_5` have been deprecated. + // Perfect Forward Secrecy. Pfs *string `json:"pfs" validate:"required"` // The key lifetime in seconds. @@ -27915,14 +27896,10 @@ type CreateIpsecPolicyOptions struct { // Constants associated with the CreateIpsecPolicyOptions.AuthenticationAlgorithm property. // The authentication algorithm // -// # The `md5` and `sha1` algorithms have been deprecated -// // Must be `disabled` if and only if the `encryption_algorithm` is // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. const ( CreateIpsecPolicyOptionsAuthenticationAlgorithmDisabledConst = "disabled" - CreateIpsecPolicyOptionsAuthenticationAlgorithmMd5Const = "md5" - CreateIpsecPolicyOptionsAuthenticationAlgorithmSha1Const = "sha1" CreateIpsecPolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" CreateIpsecPolicyOptionsAuthenticationAlgorithmSha384Const = "sha384" CreateIpsecPolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" @@ -27931,8 +27908,6 @@ const ( // Constants associated with the CreateIpsecPolicyOptions.EncryptionAlgorithm property. // The encryption algorithm // -// The `triple_des` algorithm has been deprecated -// // The `authentication_algorithm` must be `disabled` if and only if // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or // `aes256gcm16`. @@ -27943,13 +27918,10 @@ const ( CreateIpsecPolicyOptionsEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" CreateIpsecPolicyOptionsEncryptionAlgorithmAes256Const = "aes256" CreateIpsecPolicyOptionsEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" - CreateIpsecPolicyOptionsEncryptionAlgorithmTripleDesConst = "triple_des" ) // Constants associated with the CreateIpsecPolicyOptions.Pfs property. -// Perfect Forward Secrecy -// -// Groups `group_2` and `group_5` have been deprecated. +// Perfect Forward Secrecy. const ( CreateIpsecPolicyOptionsPfsDisabledConst = "disabled" CreateIpsecPolicyOptionsPfsGroup14Const = "group_14" @@ -27958,14 +27930,12 @@ const ( CreateIpsecPolicyOptionsPfsGroup17Const = "group_17" CreateIpsecPolicyOptionsPfsGroup18Const = "group_18" CreateIpsecPolicyOptionsPfsGroup19Const = "group_19" - CreateIpsecPolicyOptionsPfsGroup2Const = "group_2" CreateIpsecPolicyOptionsPfsGroup20Const = "group_20" CreateIpsecPolicyOptionsPfsGroup21Const = "group_21" CreateIpsecPolicyOptionsPfsGroup22Const = "group_22" CreateIpsecPolicyOptionsPfsGroup23Const = "group_23" CreateIpsecPolicyOptionsPfsGroup24Const = "group_24" CreateIpsecPolicyOptionsPfsGroup31Const = "group_31" - CreateIpsecPolicyOptionsPfsGroup5Const = "group_5" ) // NewCreateIpsecPolicyOptions : Instantiate CreateIpsecPolicyOptions @@ -33742,7 +33712,7 @@ func (options *DeleteSnapshotOptions) SetHeaders(param map[string]string) *Delet // DeleteSnapshotsOptions : The DeleteSnapshots options. type DeleteSnapshotsOptions struct { - // Filters the collection to resources with the source volume with the specified identifier. + // 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 @@ -38570,19 +38540,13 @@ func (resp *IkePolicyCollection) GetNextStart() (*string, error) { // IkePolicyPatch : IkePolicyPatch struct type IkePolicyPatch struct { - // The authentication algorithm - // - // The `md5` and `sha1` algorithms have been deprecated. + // The authentication algorithm. AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` - // The Diffie-Hellman group - // - // Groups `2` and `5` have been deprecated. + // The Diffie-Hellman group. DhGroup *int64 `json:"dh_group,omitempty"` - // The encryption algorithm - // - // The `triple_des` algorithm has been deprecated. + // The encryption algorithm. EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` // The IKE protocol version. @@ -38596,26 +38560,19 @@ type IkePolicyPatch struct { } // Constants associated with the IkePolicyPatch.AuthenticationAlgorithm property. -// The authentication algorithm -// -// The `md5` and `sha1` algorithms have been deprecated. +// The authentication algorithm. const ( - IkePolicyPatchAuthenticationAlgorithmMd5Const = "md5" - IkePolicyPatchAuthenticationAlgorithmSha1Const = "sha1" IkePolicyPatchAuthenticationAlgorithmSha256Const = "sha256" IkePolicyPatchAuthenticationAlgorithmSha384Const = "sha384" IkePolicyPatchAuthenticationAlgorithmSha512Const = "sha512" ) // Constants associated with the IkePolicyPatch.EncryptionAlgorithm property. -// The encryption algorithm -// -// The `triple_des` algorithm has been deprecated. +// The encryption algorithm. const ( - IkePolicyPatchEncryptionAlgorithmAes128Const = "aes128" - IkePolicyPatchEncryptionAlgorithmAes192Const = "aes192" - IkePolicyPatchEncryptionAlgorithmAes256Const = "aes256" - IkePolicyPatchEncryptionAlgorithmTripleDesConst = "triple_des" + IkePolicyPatchEncryptionAlgorithmAes128Const = "aes128" + IkePolicyPatchEncryptionAlgorithmAes192Const = "aes192" + IkePolicyPatchEncryptionAlgorithmAes256Const = "aes256" ) // UnmarshalIkePolicyPatch unmarshals an instance of IkePolicyPatch from the specified map of raw messages. @@ -39025,16 +38982,12 @@ func UnmarshalIPsecPolicyCollectionNext(m map[string]json.RawMessage, result int type IPsecPolicyPatch struct { // The authentication algorithm // - // The `md5` and `sha1` algorithms have been deprecated - // // Must be `disabled` if and only if the `encryption_algorithm` is // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` // The encryption algorithm // - // The `triple_des` algorithm has been deprecated - // // The `authentication_algorithm` must be `disabled` if and only if // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or // `aes256gcm16`. @@ -39046,23 +38999,17 @@ type IPsecPolicyPatch struct { // The name for this IPsec policy. The name must not be used by another IPsec policy in the region. Name *string `json:"name,omitempty"` - // Perfect Forward Secrecy - // - // Groups `group_2` and `group_5` have been deprecated. + // Perfect Forward Secrecy. Pfs *string `json:"pfs,omitempty"` } // Constants associated with the IPsecPolicyPatch.AuthenticationAlgorithm property. // The authentication algorithm // -// # The `md5` and `sha1` algorithms have been deprecated -// // Must be `disabled` if and only if the `encryption_algorithm` is // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. const ( IPsecPolicyPatchAuthenticationAlgorithmDisabledConst = "disabled" - IPsecPolicyPatchAuthenticationAlgorithmMd5Const = "md5" - IPsecPolicyPatchAuthenticationAlgorithmSha1Const = "sha1" IPsecPolicyPatchAuthenticationAlgorithmSha256Const = "sha256" IPsecPolicyPatchAuthenticationAlgorithmSha384Const = "sha384" IPsecPolicyPatchAuthenticationAlgorithmSha512Const = "sha512" @@ -39071,8 +39018,6 @@ const ( // Constants associated with the IPsecPolicyPatch.EncryptionAlgorithm property. // The encryption algorithm // -// The `triple_des` algorithm has been deprecated -// // The `authentication_algorithm` must be `disabled` if and only if // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or // `aes256gcm16`. @@ -39083,13 +39028,10 @@ const ( IPsecPolicyPatchEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" IPsecPolicyPatchEncryptionAlgorithmAes256Const = "aes256" IPsecPolicyPatchEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" - IPsecPolicyPatchEncryptionAlgorithmTripleDesConst = "triple_des" ) // Constants associated with the IPsecPolicyPatch.Pfs property. -// Perfect Forward Secrecy -// -// Groups `group_2` and `group_5` have been deprecated. +// Perfect Forward Secrecy. const ( IPsecPolicyPatchPfsDisabledConst = "disabled" IPsecPolicyPatchPfsGroup14Const = "group_14" @@ -39098,14 +39040,12 @@ const ( IPsecPolicyPatchPfsGroup17Const = "group_17" IPsecPolicyPatchPfsGroup18Const = "group_18" IPsecPolicyPatchPfsGroup19Const = "group_19" - IPsecPolicyPatchPfsGroup2Const = "group_2" IPsecPolicyPatchPfsGroup20Const = "group_20" IPsecPolicyPatchPfsGroup21Const = "group_21" IPsecPolicyPatchPfsGroup22Const = "group_22" IPsecPolicyPatchPfsGroup23Const = "group_23" IPsecPolicyPatchPfsGroup24Const = "group_24" IPsecPolicyPatchPfsGroup31Const = "group_31" - IPsecPolicyPatchPfsGroup5Const = "group_5" ) // UnmarshalIPsecPolicyPatch unmarshals an instance of IPsecPolicyPatch from the specified map of raw messages. @@ -39346,7 +39286,9 @@ type Image struct { // unexpected reason code was encountered. StatusReasons []ImageStatusReason `json:"status_reasons" validate:"required"` - // Whether the image is publicly visible or private to the account. + // The visibility of this image. + // - `private`: Visible only to this account + // - `public`: Visible to all accounts. Visibility *string `json:"visibility" validate:"required"` } @@ -39380,7 +39322,9 @@ const ( ) // Constants associated with the Image.Visibility property. -// Whether the image is publicly visible or private to the account. +// The visibility of this image. +// - `private`: Visible only to this account +// - `public`: Visible to all accounts. const ( ImageVisibilityPrivateConst = "private" ImageVisibilityPublicConst = "public" @@ -46136,13 +46080,13 @@ type ListBackupPoliciesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // 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 the exact specified name. + // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` - // Filters the collection to resources with the exact tag value. + // 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 @@ -46195,10 +46139,11 @@ type ListBackupPolicyJobsOptions struct { // The backup policy identifier. BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - // Filters the collection to backup policy jobs with the specified status. + // Filters the collection to backup policy jobs with a `status` property matching the specified value. Status *string `json:"status,omitempty"` - // Filters the collection to backup policy jobs with the backup plan with the specified identifier. + // Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified + // identifier. BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` // A server-provided token determining what resource to start the page on. @@ -46212,19 +46157,29 @@ type ListBackupPolicyJobsOptions struct { // 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 backup policy jobs with a source with the specified identifier. + // Filters the collection to backup policy jobs with a `source.id` property matching the specified identifier. SourceID *string `json:"source.id,omitempty"` - // Filters the collection to resources with the target snapshot with the specified identifier. + // Filters the collection to backup policy jobs with an item in the `target_snapshots` property with an `id` property + // matching the specified identifier. TargetSnapshotsID *string `json:"target_snapshots[].id,omitempty"` - // Filters the collection to backup policy jobs with the target snapshot with the specified CRN. + // Filters the collection to backup policy jobs with an item in the `target_snapshots` property with a `crn` property + // matching the specified CRN. TargetSnapshotsCRN *string `json:"target_snapshots[].crn,omitempty"` // Allows users to set headers on API requests Headers map[string]string } +// Constants associated with the ListBackupPolicyJobsOptions.Status property. +// Filters the collection to backup policy jobs with a `status` property matching the specified value. +const ( + ListBackupPolicyJobsOptionsStatusFailedConst = "failed" + ListBackupPolicyJobsOptionsStatusRunningConst = "running" + ListBackupPolicyJobsOptionsStatusSucceededConst = "succeeded" +) + // Constants associated with the ListBackupPolicyJobsOptions.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 @@ -46306,7 +46261,7 @@ type ListBackupPolicyPlansOptions struct { // The backup policy identifier. BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - // Filters the collection to resources with the exact specified name. + // 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 @@ -46531,28 +46486,31 @@ type ListBareMetalServersOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // 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 the exact specified name. + // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` - // Filters the collection to resources with `vpc.id` matching the specified identifier. + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. VPCID *string `json:"vpc.id,omitempty"` - // Filters the collection to resources with `vpc.crn` matching the specified CRN. + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. VPCCRN *string `json:"vpc.crn,omitempty"` - // Filters the collection to resources with a `vpc.name` value matching the exact specified name. + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. VPCName *string `json:"vpc.name,omitempty"` - // Filters the collection to bare metal servers on the subnet with the specified identifier. + // Filters the collection to bare metal servers with an item in the `network_interfaces` property with a `subnet.id` + // property matching the specified identifier. NetworkInterfacesSubnetID *string `json:"network_interfaces.subnet.id,omitempty"` - // Filters the collection to bare metal servers on the subnet with the specified CRN. + // Filters the collection to bare metal servers with an item in the `network_interfaces` property with a `subnet.crn` + // property matching the specified CRN. NetworkInterfacesSubnetCRN *string `json:"network_interfaces.subnet.crn,omitempty"` - // Filters the collection to bare metal servers on the subnet with the specified name. + // Filters the collection to bare metal servers with an item in the `network_interfaces` property with a `subnet.name` + // property matching the exact specified name. NetworkInterfacesSubnetName *string `json:"network_interfaces.subnet.name,omitempty"` // Allows users to set headers on API requests @@ -46666,13 +46624,13 @@ type ListDedicatedHostGroupsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // 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 in the zone with the exact specified name. + // Filters the collection to resources with a `zone.name` property matching the exact specified name. ZoneName *string `json:"zone.name,omitempty"` - // Filters the collection to resources with the exact specified name. + // 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 @@ -46757,7 +46715,7 @@ func (options *ListDedicatedHostProfilesOptions) SetHeaders(param map[string]str // ListDedicatedHostsOptions : The ListDedicatedHosts options. type ListDedicatedHostsOptions struct { - // Filters the collection to dedicated host groups with the specified identifier. + // Filters the collection to dedicated hosts with a `group.id` property matching the specified identifier. DedicatedHostGroupID *string `json:"dedicated_host_group.id,omitempty"` // A server-provided token determining what resource to start the page on. @@ -46766,13 +46724,13 @@ type ListDedicatedHostsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // 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 in the zone with the exact specified name. + // Filters the collection to resources with a `zone.name` property matching the exact specified name. ZoneName *string `json:"zone.name,omitempty"` - // Filters the collection to resources with the exact specified name. + // 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 @@ -46895,7 +46853,7 @@ func (options *ListEndpointGatewayIpsOptions) SetHeaders(param map[string]string // ListEndpointGatewaysOptions : The ListEndpointGateways options. type ListEndpointGatewaysOptions struct { - // Filters the collection to resources with the exact specified name. + // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` // A server-provided token determining what resource to start the page on. @@ -46904,7 +46862,7 @@ type ListEndpointGatewaysOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // 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 @@ -46954,7 +46912,7 @@ type ListFloatingIpsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. ResourceGroupID *string `json:"resource_group.id,omitempty"` // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name @@ -47018,40 +46976,31 @@ type ListFlowLogCollectorsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // 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 the exact specified name. + // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` - // Filters the collection to resources with `vpc.id` matching the specified identifier. + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. VPCID *string `json:"vpc.id,omitempty"` - // Filters the collection to resources with `vpc.crn` matching the specified CRN. + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. VPCCRN *string `json:"vpc.crn,omitempty"` - // Filters the collection to resources with a `vpc.name` value matching the exact specified name. + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. VPCName *string `json:"vpc.name,omitempty"` - // Filters the collection to flow log collectors that target the specified resource. + // Filters the collection to resources with a `target.id` property matching the specified identifier. TargetID *string `json:"target.id,omitempty"` - // Filters the collection to flow log collectors that target the specified resource type. + // 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 Headers map[string]string } -// Constants associated with the ListFlowLogCollectorsOptions.TargetResourceType property. -// Filters the collection to flow log collectors that target the specified resource type. -const ( - ListFlowLogCollectorsOptionsTargetResourceTypeInstanceConst = "instance" - ListFlowLogCollectorsOptionsTargetResourceTypeNetworkInterfaceConst = "network_interface" - ListFlowLogCollectorsOptionsTargetResourceTypeSubnetConst = "subnet" - ListFlowLogCollectorsOptionsTargetResourceTypeVPCConst = "vpc" -) - // NewListFlowLogCollectorsOptions : Instantiate ListFlowLogCollectorsOptions func (*VpcV1) NewListFlowLogCollectorsOptions() *ListFlowLogCollectorsOptions { return &ListFlowLogCollectorsOptions{} @@ -47185,7 +47134,7 @@ type ListImageExportJobsOptions struct { // The image identifier. ImageID *string `json:"image_id" validate:"required,ne="` - // Filters the collection to resources with the exact specified name. + // 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 @@ -47225,13 +47174,13 @@ type ListImagesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // 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 the exact specified name. + // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` - // Filters the collection to images with the specified `visibility`. + // Filters the collection to images with a `visibility` property matching the specified value. Visibility *string `json:"visibility,omitempty"` // Allows users to set headers on API requests @@ -47239,7 +47188,7 @@ type ListImagesOptions struct { } // Constants associated with the ListImagesOptions.Visibility property. -// Filters the collection to images with the specified `visibility`. +// Filters the collection to images with a `visibility` property matching the specified value. const ( ListImagesOptionsVisibilityPrivateConst = "private" ListImagesOptionsVisibilityPublicConst = "public" @@ -47747,37 +47696,40 @@ type ListInstancesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // 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 the exact specified name. + // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` - // Filters the collection to resources with `vpc.id` matching the specified identifier. + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. VPCID *string `json:"vpc.id,omitempty"` - // Filters the collection to resources with `vpc.crn` matching the specified CRN. + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. VPCCRN *string `json:"vpc.crn,omitempty"` - // Filters the collection to resources with a `vpc.name` value matching the exact specified name. + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. VPCName *string `json:"vpc.name,omitempty"` - // Filters the collection to instances on the dedicated host with the specified identifier. + // Filters the collection to instances with a `dedicated_host.id` property matching the specified identifier. DedicatedHostID *string `json:"dedicated_host.id,omitempty"` - // Filters the collection to instances on the dedicated host with the specified CRN. + // Filters the collection to instances with a `dedicated_host.crn` property matching the specified CRN. DedicatedHostCRN *string `json:"dedicated_host.crn,omitempty"` - // Filters the collection to instances on the dedicated host with the specified name. + // Filters the collection to instances with a `dedicated_host.name` property matching the exact specified name. DedicatedHostName *string `json:"dedicated_host.name,omitempty"` - // Filters the collection to instances in the placement group with the specified identifier. + // Filters the collection to instances with a `placement_target.id` property matching the specified placement group + // identifier. PlacementGroupID *string `json:"placement_group.id,omitempty"` - // Filters the collection to instances in the placement group with the specified CRN. + // Filters the collection to instances with a `placement_target.crn` property matching the specified placement group + // CRN. PlacementGroupCRN *string `json:"placement_group.crn,omitempty"` - // Filters the collection to instances in the placement group with the specified name. + // Filters the collection to instances with a `placement_target.name` property matching the exact specified placement + // group name. PlacementGroupName *string `json:"placement_group.name,omitempty"` // Allows users to set headers on API requests @@ -48232,7 +48184,7 @@ type ListNetworkACLRulesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to rules with the specified direction. + // 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 @@ -48240,7 +48192,7 @@ type ListNetworkACLRulesOptions struct { } // Constants associated with the ListNetworkACLRulesOptions.Direction property. -// Filters the collection to rules with the specified direction. +// Filters the collection to rules with a `direction` property matching the specified value. const ( ListNetworkACLRulesOptionsDirectionInboundConst = "inbound" ListNetworkACLRulesOptionsDirectionOutboundConst = "outbound" @@ -48291,7 +48243,7 @@ type ListNetworkAclsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // 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 @@ -48405,7 +48357,7 @@ type ListPublicGatewaysOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // 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 @@ -48569,16 +48521,16 @@ type ListSecurityGroupsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // 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 `vpc.id` matching the specified identifier. + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. VPCID *string `json:"vpc.id,omitempty"` - // Filters the collection to resources with `vpc.crn` matching the specified CRN. + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. VPCCRN *string `json:"vpc.crn,omitempty"` - // Filters the collection to resources with a `vpc.name` value matching the exact specified name. + // 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 @@ -48668,28 +48620,28 @@ type ListSnapshotsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources with the exact tag value. + // Filters the collection to resources with an item in the `tags` property matching the exact specified tag. Tag *string `json:"tag,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // 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 the exact specified name. + // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` - // Filters the collection to resources with the source volume with the specified identifier. + // Filters the collection to resources with a `source_volume.id` property matching the specified identifier. SourceVolumeID *string `json:"source_volume.id,omitempty"` - // Filters the collection to resources with the source volume with the specified CRN. + // Filters the collection to resources with a `source_volume.crn` property matching the specified CRN. SourceVolumeCRN *string `json:"source_volume.crn,omitempty"` - // Filters the collection to resources with the source image with the specified identifier. + // Filters the collection to resources with a `source_image.id` property matching the specified identifier. // // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no // source image or any existent source image, respectively. SourceImageID *string `json:"source_image.id,omitempty"` - // Filters the collection to resources with the source volume with the specified CRN. + // Filters the collection to resources with a `source_image.crn` property matching the specified CRN. // // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no // source image or any existent source image, respectively. @@ -48700,10 +48652,12 @@ type ListSnapshotsOptions struct { // 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 backup policy jobs with the backup plan with the specified identifier. + // Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified + // identifier. BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` - // Filters the collection to resources with a clone in the specified zone. + // Filters the collection to snapshots with an item in the `clones` property with a `zone.name` property matching the + // exact specified name. ClonesZoneName *string `json:"clones[].zone.name,omitempty"` // Allows users to set headers on API requests @@ -48877,13 +48831,13 @@ type ListSubnetsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // 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 subnets attached to the routing table with the specified identifier. + // Filters the collection to subnets with a `routing_table.id` property matching the specified identifier. RoutingTableID *string `json:"routing_table.id,omitempty"` - // Filters the collection to subnets attached to the routing table with the specified name. + // 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 @@ -48974,28 +48928,30 @@ type ListVolumesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources with the exact specified name. + // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` - // Filters the collection to volumes with the specified attachment state. + // Filters the collection to volumes with an `attachment_state` property matching the specified value. AttachmentState *string `json:"attachment_state,omitempty"` - // Filters the collection to resources with the specified encryption type. + // Filters the collection to resources with an `encryption` property matching the specified value. Encryption *string `json:"encryption,omitempty"` - // Filters the collection to resources with the exact specified operating system family. + // Filters the collection to resources with an `operating_system.family` property matching the specified operating + // system family. // // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no // operating system or any operating system, respectively. OperatingSystemFamily *string `json:"operating_system.family,omitempty"` - // Filters the collection to resources with the exact specified operating system architecture. + // Filters the collection to resources with an `operating_system.architecture` property matching the specified + // operating system architecture. // // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no // operating system or any operating system, respectively. OperatingSystemArchitecture *string `json:"operating_system.architecture,omitempty"` - // Filters the collection to resources in the zone with the exact specified name. + // 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 @@ -49003,7 +48959,7 @@ type ListVolumesOptions struct { } // Constants associated with the ListVolumesOptions.AttachmentState property. -// Filters the collection to volumes with the specified attachment state. +// Filters the collection to volumes with an `attachment_state` property matching the specified value. const ( ListVolumesOptionsAttachmentStateAttachedConst = "attached" ListVolumesOptionsAttachmentStateUnattachedConst = "unattached" @@ -49011,7 +48967,7 @@ const ( ) // Constants associated with the ListVolumesOptions.Encryption property. -// Filters the collection to resources with the specified encryption type. +// Filters the collection to resources with an `encryption` property matching the specified value. const ( ListVolumesOptionsEncryptionProviderManagedConst = "provider_managed" ListVolumesOptionsEncryptionUserManagedConst = "user_managed" @@ -49127,7 +49083,7 @@ type ListVPCRoutesOptions struct { // The VPC identifier. VPCID *string `json:"vpc_id" validate:"required,ne="` - // Filters the collection to resources in the zone with the exact specified name. + // Filters the collection to resources with a `zone.name` property matching the exact specified name. ZoneName *string `json:"zone.name,omitempty"` // A server-provided token determining what resource to start the page on. @@ -49244,7 +49200,7 @@ type ListVPCRoutingTablesOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to routing tables with the specified `is_default` value. + // 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 @@ -49296,10 +49252,10 @@ type ListVpcsOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // 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 VPCs with the specified `classic_access` value. + // 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 @@ -49422,13 +49378,20 @@ type ListVPNGatewayConnectionsOptions struct { // The VPN gateway identifier. VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - // Filters the collection to VPN gateway connections with the specified status. + // 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 Headers map[string]string } +// Constants associated with the ListVPNGatewayConnectionsOptions.Status property. +// Filters the collection to VPN gateway connections with a `status` property matching the specified value. +const ( + ListVPNGatewayConnectionsOptionsStatusDownConst = "down" + ListVPNGatewayConnectionsOptionsStatusUpConst = "up" +) + // NewListVPNGatewayConnectionsOptions : Instantiate ListVPNGatewayConnectionsOptions func (*VpcV1) NewListVPNGatewayConnectionsOptions(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { return &ListVPNGatewayConnectionsOptions{ @@ -49462,7 +49425,7 @@ type ListVPNGatewaysOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. ResourceGroupID *string `json:"resource_group.id,omitempty"` // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name @@ -49470,7 +49433,7 @@ type ListVPNGatewaysOptions struct { // 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 VPN gateways with the specified mode. + // 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 @@ -49487,7 +49450,7 @@ const ( ) // Constants associated with the ListVPNGatewaysOptions.Mode property. -// Filters the collection to VPN gateways with the specified mode. +// Filters the collection to VPN gateways with a `mode` property matching the specified value. const ( ListVPNGatewaysOptionsModePolicyConst = "policy" ListVPNGatewaysOptionsModeRouteConst = "route" @@ -49667,7 +49630,7 @@ func (options *ListVPNServerRoutesOptions) SetHeaders(param map[string]string) * // ListVPNServersOptions : The ListVPNServers options. type ListVPNServersOptions struct { - // Filters the collection to resources with the exact specified name. + // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` // A server-provided token determining what resource to start the page on. @@ -49676,7 +49639,7 @@ type ListVPNServersOptions struct { // The number of resources to return on a page. Limit *int64 `json:"limit,omitempty"` - // Filters the collection to resources in the resource group with the specified identifier. + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. ResourceGroupID *string `json:"resource_group.id,omitempty"` // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name From b3d46fc6264246d943a1c59b517015e9ed18b63d Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 26 May 2023 09:39:11 +0530 Subject: [PATCH 032/103] Update vpc_v1.go --- common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 69fa789533..d7283fa0e9 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -64,7 +64,7 @@ type VpcV1Options struct { // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` // and `2023-05-25`. - Version *string `validate:"required"` + Version *string } // NewVpcV1UsingExternalConfig : constructs an instance of VpcV1 with passed in options and external configuration. From 1d0648560ec5477ac9b2a9f31a1d356e595f6230 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 6 Jul 2023 14:37:43 +0530 Subject: [PATCH 033/103] updated sdk --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 1522 +++++++++++++++-- go.mod | 2 + 2 files changed, 1384 insertions(+), 140 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index d7283fa0e9..0e9f35b3dd 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2021, 2022, 2023. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.69.0-370d6400-20230329-174648 + * IBM OpenAPI SDK Code Generator Version: 3.70.0-7df966bf-20230419-195904 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -37,7 +37,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: 2022-09-13 +// API Version: `2023-07-04` type VpcV1 struct { Service *core.BaseService @@ -46,7 +46,7 @@ type VpcV1 struct { generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-05-25`. + // and `2023-07-04`. Version *string } @@ -63,7 +63,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-05-25`. + // and `2023-07-04`. Version *string } @@ -121,7 +121,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2023-05-23") + options.Version = core.StringPtr("2023-06-27") } service = &VpcV1{ @@ -1053,13 +1053,13 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV // matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's // destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. // Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { return vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) } // ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter // Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { core.GetLogger().Warn("A deprecated operation has been invoked: ListVPCRoutes") err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") if err != nil { @@ -1115,7 +1115,7 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollectionVPCContext) if err != nil { return } @@ -9742,6 +9742,9 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB if createBackupPolicyPlanOptions.Name != nil { body["name"] = createBackupPolicyPlanOptions.Name } + if createBackupPolicyPlanOptions.RemoteRegionPolicies != nil { + body["remote_region_policies"] = createBackupPolicyPlanOptions.RemoteRegionPolicies + } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -12796,6 +12799,30 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt if listSnapshotsOptions.BackupPolicyPlanID != nil { builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) } + if listSnapshotsOptions.CopiesID != nil { + builder.AddQuery("copies[].id", fmt.Sprint(*listSnapshotsOptions.CopiesID)) + } + if listSnapshotsOptions.CopiesName != nil { + builder.AddQuery("copies[].name", fmt.Sprint(*listSnapshotsOptions.CopiesName)) + } + if listSnapshotsOptions.CopiesCRN != nil { + builder.AddQuery("copies[].crn", fmt.Sprint(*listSnapshotsOptions.CopiesCRN)) + } + if listSnapshotsOptions.CopiesRemoteRegionName != nil { + builder.AddQuery("copies[].remote.region.name", fmt.Sprint(*listSnapshotsOptions.CopiesRemoteRegionName)) + } + if listSnapshotsOptions.SourceSnapshotID != nil { + builder.AddQuery("source_snapshot.id", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotID)) + } + if listSnapshotsOptions.SourceSnapshotRemoteRegionName != nil { + builder.AddQuery("source_snapshot.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotRemoteRegionName)) + } + if listSnapshotsOptions.SourceVolumeRemoteRegionName != nil { + builder.AddQuery("source_volume.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceVolumeRemoteRegionName)) + } + if listSnapshotsOptions.SourceImageRemoteRegionName != nil { + builder.AddQuery("source_image.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceImageRemoteRegionName)) + } if listSnapshotsOptions.ClonesZoneName != nil { builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName)) } @@ -21989,6 +22016,36 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF 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 { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // AddBareMetalServerNetworkInterfaceFloatingIPOptions : The AddBareMetalServerNetworkInterfaceFloatingIP options. type AddBareMetalServerNetworkInterfaceFloatingIPOptions struct { // The bare metal server identifier. @@ -22914,8 +22971,21 @@ type BackupPolicyJobSource struct { // 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"` } +// Constants associated with the BackupPolicyJobSource.ResourceType property. +// The resource type. +const ( + BackupPolicyJobSourceResourceTypeVolumeConst = "volume" +) + func (*BackupPolicyJobSource) isaBackupPolicyJobSource() bool { return true } @@ -22947,6 +23017,14 @@ func UnmarshalBackupPolicyJobSource(m map[string]json.RawMessage, result interfa if err != nil { return } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -23071,6 +23149,9 @@ type BackupPolicyPlan struct { // 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 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"` } @@ -23140,6 +23221,10 @@ func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicy) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return @@ -23344,6 +23429,9 @@ type BackupPolicyPlanPatch struct { // 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. @@ -23377,6 +23465,10 @@ func UnmarshalBackupPolicyPlanPatch(m map[string]json.RawMessage, result interfa if err != nil { return } + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -23416,6 +23508,9 @@ type BackupPolicyPlanPrototype struct { // 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) @@ -23458,6 +23553,10 @@ func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result int if err != nil { return } + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -23477,6 +23576,10 @@ type BackupPolicyPlanReference struct { // The name for this backup policy plan. The name is unique across all plans in the backup policy. 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 resource type. ResourceType *string `json:"resource_type" validate:"required"` } @@ -23506,6 +23609,10 @@ func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result int if err != nil { return } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalBackupPolicyPlanRemote) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return @@ -23532,6 +23639,99 @@ func UnmarshalBackupPolicyPlanReferenceDeleted(m map[string]json.RawMessage, res 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"` +} + +// 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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"` + + // 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"` +} + +// 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 { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + 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"` + + // 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"` +} + +// 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") + 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 { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionIdentity) + if err != nil { + 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's network interfaces. @@ -26553,6 +26753,9 @@ type CreateBackupPolicyPlanOptions struct { // 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"` + // Allows users to set headers on API requests Headers map[string]string } @@ -26613,6 +26816,12 @@ func (_options *CreateBackupPolicyPlanOptions) SetName(name string) *CreateBacku return _options } +// SetRemoteRegionPolicies : Allow user to set RemoteRegionPolicies +func (_options *CreateBackupPolicyPlanOptions) SetRemoteRegionPolicies(remoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype) *CreateBackupPolicyPlanOptions { + _options.RemoteRegionPolicies = remoteRegionPolicies + return _options +} + // SetHeaders : Allow user to set Headers func (options *CreateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *CreateBackupPolicyPlanOptions { options.Headers = param @@ -27572,19 +27781,24 @@ type CreateInstanceGroupOptions struct { // The subnets to use when creating new instances. Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` - // The port to use for new load balancer pool members created by this instance group. + // The port to use for new load balancer pool members created by this instance group. The load balancer pool member + // will receive load balancer traffic on this port, unless the load balancer listener is using a port range. (Traffic + // received on a listener using a port range will be sent to members using the same port the listener received it on.) + // + // This port will also be used for health checks unless the port property of + // `health_monitor` property is specified. // // This property must be specified if and only if `load_balancer_pool` has been specified. ApplicationPort *int64 `json:"application_port,omitempty"` // The load balancer associated with the specified load balancer pool. - // Required if `load_balancer_pool` is specified. - // - // At present, only load balancers in the `application` family are supported. + // Required if `load_balancer_pool` is specified. The load balancer must have + // `instance_groups_supported` set to `true`. LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` - // If specified, the load balancer pool this instance group will manage. A pool member - // will be created for each instance created by this group. + // If specified, this instance group will manage the load balancer pool. A pool member + // will be created for each instance created by this group. The specified load + // balancer pool must not be used by another instance group in the VPC. // // If specified, `load_balancer` and `application_port` must also be specified. LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"` @@ -27994,6 +28208,9 @@ type CreateKeyOptions struct { // A unique public SSH key to import, in OpenSSH format (consisting of three space-separated fields: the algorithm // name, base64-encoded key, and a comment). The algorithm and comment fields may be omitted, as only the key field is // imported. + // + // Keys of type `rsa` may be 2048 or 4096 bits in length, however 4096 is recommended. Keys of type `ed25519` are 256 + // bits in length. PublicKey *string `json:"public_key" validate:"required"` // The name for this key. The name must not be used by another key in the region. If unspecified, the name will be a @@ -28014,7 +28231,8 @@ type CreateKeyOptions struct { // Constants associated with the CreateKeyOptions.Type property. // The crypto-system used by this key. const ( - CreateKeyOptionsTypeRsaConst = "rsa" + CreateKeyOptionsTypeEd25519Const = "ed25519" + CreateKeyOptionsTypeRsaConst = "rsa" ) // NewCreateKeyOptions : Instantiate CreateKeyOptions @@ -39249,6 +39467,9 @@ type Image struct { // The resource group for this image. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + // The volume used to create this image (this may be // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). // If absent, this image was not created from a volume. @@ -39299,6 +39520,12 @@ const ( ImageEncryptionUserManagedConst = "user_managed" ) +// Constants associated with the Image.ResourceType property. +// The resource type. +const ( + ImageResourceTypeImageConst = "image" +) + // Constants associated with the Image.Status property. // The status of this image // - available: image can be used (provisionable) @@ -39381,6 +39608,10 @@ func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error if err != nil { return } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) if err != nil { return @@ -40027,8 +40258,21 @@ type ImageReference struct { // The name for this image. The name is unique across all images in the region. 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 *ImageRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } +// Constants associated with the ImageReference.ResourceType property. +// The resource type. +const ( + ImageReferenceResourceTypeImageConst = "image" +) + // UnmarshalImageReference unmarshals an instance of ImageReference from the specified map of raw messages. func UnmarshalImageReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ImageReference) @@ -40052,6 +40296,14 @@ func UnmarshalImageReference(m map[string]json.RawMessage, result interface{}) ( if err != nil { return } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalImageRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -40074,6 +40326,33 @@ func UnmarshalImageReferenceDeleted(m map[string]json.RawMessage, result interfa return } +// ImageRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type ImageRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // account, and identifies the owning account. + Account *AccountReference `json:"account,omitempty"` + + // If present, this property indicates that the referenced resource is remote to this + // region, and identifies the native region. + Region *RegionReference `json:"region,omitempty"` +} + +// UnmarshalImageRemote unmarshals an instance of ImageRemote from the specified map of raw messages. +func UnmarshalImageRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageRemote) + err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ImageStatusReason : ImageStatusReason struct type ImageStatusReason struct { // A snake case string succinctly identifying the status reason. @@ -42919,14 +43198,15 @@ type InstanceGroupPatch struct { // `default_trusted_profile.auto_link`. InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template,omitempty"` - // The load balancer associated with the specified load balancer pool. - // Required if `load_balancer_pool` is specified. + // The load balancer associated with `load_balancer_pool`. + // The load balancer must have `instance_groups_supported` set to `true`. // - // At present, only load balancers in the `application` family are supported. + // This property must be set if and only if `load_balancer_pool` has been set. LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` - // If set, the load balancer pool this instance group will manage. A pool member will - // be created for each instance created by this group. + // If specified, this instance group will manage the load balancer pool. A pool member + // will be created for each instance created by this group. The specified load + // balancer pool must not be used by another instance group in the VPC. // // If set, `load_balancer` and `application_port` must also be set. LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"` @@ -44770,7 +45050,7 @@ type InstancePrototype struct { // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -45053,9 +45333,9 @@ func UnmarshalInstanceStatusReason(m map[string]json.RawMessage, result interfac // InstanceTemplate : InstanceTemplate struct // Models which "extend" this model: -// - InstanceTemplateInstanceByImageInstanceTemplateContext -// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext -// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext +// - InstanceTemplateInstanceByImage +// - InstanceTemplateInstanceBySourceSnapshot +// - InstanceTemplateInstanceByCatalogOffering type InstanceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -45084,7 +45364,7 @@ type InstanceTemplate struct { // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -45412,10 +45692,10 @@ func (instanceTemplatePatch *InstanceTemplatePatch) AsPatch() (_patch map[string // InstanceTemplatePrototype : InstanceTemplatePrototype struct // Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext -// - InstanceTemplatePrototypeInstanceBySourceTemplate -// - InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext -// - InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext +// - InstanceTemplatePrototypeInstanceTemplateByImage +// - InstanceTemplatePrototypeInstanceTemplateBySourceTemplate +// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot +// - InstanceTemplatePrototypeInstanceTemplateByCatalogOffering type InstanceTemplatePrototype struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -45432,7 +45712,7 @@ type InstanceTemplatePrototype struct { // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -45735,7 +46015,8 @@ type Key struct { // Constants associated with the Key.Type property. // The crypto-system used by this key. const ( - KeyTypeRsaConst = "rsa" + KeyTypeEd25519Const = "ed25519" + KeyTypeRsaConst = "rsa" ) // UnmarshalKey unmarshals an instance of Key from the specified map of raw messages. @@ -48656,6 +48937,37 @@ type ListSnapshotsOptions struct { // identifier. BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` + // Filters the collection to snapshots with an item in the `copies` property with an `id` property matching the + // specified identifier. + CopiesID *string `json:"copies[].id,omitempty"` + + // Filters the collection to snapshots with an item in the `copies` property with a `name` property matching the exact + // specified name. + CopiesName *string `json:"copies[].name,omitempty"` + + // Filters the collection to snapshots with an item in the `copies` property with an `id` property matching the + // specified CRN. + CopiesCRN *string `json:"copies[].crn,omitempty"` + + // Filters the collection to snapshots with an item in the `copies` property with a + // `remote.region.name` property matching the exact specified name. + CopiesRemoteRegionName *string `json:"copies[].remote.region.name,omitempty"` + + // Filters the collection to resources with a `source_snapshot.id` property matching the specified identifier. + SourceSnapshotID *string `json:"source_snapshot.id,omitempty"` + + // Filters the collection to resources with a `source_snapshot.remote.region.name` property matching the exact + // specified name. + SourceSnapshotRemoteRegionName *string `json:"source_snapshot.remote.region.name,omitempty"` + + // Filters the collection to resources with a `source_volume.remote.region.name` property matching the exact specified + // name. + SourceVolumeRemoteRegionName *string `json:"source_volume.remote.region.name,omitempty"` + + // Filters the collection to resources with a `source_image.remote.region.name` property matching the exact specified + // name. + SourceImageRemoteRegionName *string `json:"source_image.remote.region.name,omitempty"` + // Filters the collection to snapshots with an item in the `clones` property with a `zone.name` property matching the // exact specified name. ClonesZoneName *string `json:"clones[].zone.name,omitempty"` @@ -48744,6 +49056,54 @@ func (_options *ListSnapshotsOptions) SetBackupPolicyPlanID(backupPolicyPlanID s return _options } +// SetCopiesID : Allow user to set CopiesID +func (_options *ListSnapshotsOptions) SetCopiesID(copiesID string) *ListSnapshotsOptions { + _options.CopiesID = core.StringPtr(copiesID) + return _options +} + +// SetCopiesName : Allow user to set CopiesName +func (_options *ListSnapshotsOptions) SetCopiesName(copiesName string) *ListSnapshotsOptions { + _options.CopiesName = core.StringPtr(copiesName) + return _options +} + +// SetCopiesCRN : Allow user to set CopiesCRN +func (_options *ListSnapshotsOptions) SetCopiesCRN(copiesCRN string) *ListSnapshotsOptions { + _options.CopiesCRN = core.StringPtr(copiesCRN) + return _options +} + +// SetCopiesRemoteRegionName : Allow user to set CopiesRemoteRegionName +func (_options *ListSnapshotsOptions) SetCopiesRemoteRegionName(copiesRemoteRegionName string) *ListSnapshotsOptions { + _options.CopiesRemoteRegionName = core.StringPtr(copiesRemoteRegionName) + return _options +} + +// SetSourceSnapshotID : Allow user to set SourceSnapshotID +func (_options *ListSnapshotsOptions) SetSourceSnapshotID(sourceSnapshotID string) *ListSnapshotsOptions { + _options.SourceSnapshotID = core.StringPtr(sourceSnapshotID) + return _options +} + +// SetSourceSnapshotRemoteRegionName : Allow user to set SourceSnapshotRemoteRegionName +func (_options *ListSnapshotsOptions) SetSourceSnapshotRemoteRegionName(sourceSnapshotRemoteRegionName string) *ListSnapshotsOptions { + _options.SourceSnapshotRemoteRegionName = core.StringPtr(sourceSnapshotRemoteRegionName) + return _options +} + +// SetSourceVolumeRemoteRegionName : Allow user to set SourceVolumeRemoteRegionName +func (_options *ListSnapshotsOptions) SetSourceVolumeRemoteRegionName(sourceVolumeRemoteRegionName string) *ListSnapshotsOptions { + _options.SourceVolumeRemoteRegionName = core.StringPtr(sourceVolumeRemoteRegionName) + return _options +} + +// SetSourceImageRemoteRegionName : Allow user to set SourceImageRemoteRegionName +func (_options *ListSnapshotsOptions) SetSourceImageRemoteRegionName(sourceImageRemoteRegionName string) *ListSnapshotsOptions { + _options.SourceImageRemoteRegionName = core.StringPtr(sourceImageRemoteRegionName) + return _options +} + // SetClonesZoneName : Allow user to set ClonesZoneName func (_options *ListSnapshotsOptions) SetClonesZoneName(clonesZoneName string) *ListSnapshotsOptions { _options.ClonesZoneName = core.StringPtr(clonesZoneName) @@ -49724,6 +50084,9 @@ type LoadBalancer struct { // The unique identifier for this load balancer. ID *string `json:"id" validate:"required"` + // Indicates whether this load balancer supports instance groups. + InstanceGroupsSupported *bool `json:"instance_groups_supported" validate:"required"` + // The type of this load balancer, public or private. IsPublic *bool `json:"is_public" validate:"required"` @@ -49872,6 +50235,10 @@ func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalPrimitive(m, "instance_groups_supported", &obj.InstanceGroupsSupported) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "is_public", &obj.IsPublic) if err != nil { return @@ -53197,6 +53564,8 @@ type LoadBalancerProfile struct { // The URL for this load balancer profile. Href *string `json:"href" validate:"required"` + InstanceGroupsSupported LoadBalancerProfileInstanceGroupsSupportedIntf `json:"instance_groups_supported" validate:"required"` + // Indicates which logging type(s) are supported for a load balancer with this profile. LoggingSupported *LoadBalancerProfileLoggingSupported `json:"logging_supported" validate:"required"` @@ -53221,6 +53590,10 @@ func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface if err != nil { return } + err = core.UnmarshalModel(m, "instance_groups_supported", &obj.InstanceGroupsSupported, UnmarshalLoadBalancerProfileInstanceGroupsSupported) + if err != nil { + return + } err = core.UnmarshalModel(m, "logging_supported", &obj.LoggingSupported, UnmarshalLoadBalancerProfileLoggingSupported) if err != nil { return @@ -53372,6 +53745,47 @@ func UnmarshalLoadBalancerProfileIdentity(m map[string]json.RawMessage, result i return } +// LoadBalancerProfileInstanceGroupsSupported : LoadBalancerProfileInstanceGroupsSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileInstanceGroupsSupportedFixed +// - LoadBalancerProfileInstanceGroupsSupportedDependent +type LoadBalancerProfileInstanceGroupsSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileInstanceGroupsSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileInstanceGroupsSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileInstanceGroupsSupported) isaLoadBalancerProfileInstanceGroupsSupported() bool { + return true +} + +type LoadBalancerProfileInstanceGroupsSupportedIntf interface { + isaLoadBalancerProfileInstanceGroupsSupported() bool +} + +// UnmarshalLoadBalancerProfileInstanceGroupsSupported unmarshals an instance of LoadBalancerProfileInstanceGroupsSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileInstanceGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileInstanceGroupsSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // LoadBalancerProfileLoggingSupported : Indicates which logging type(s) are supported for a load balancer with this profile. type LoadBalancerProfileLoggingSupported struct { // The type for this profile field. @@ -56282,6 +56696,41 @@ func UnmarshalRegionCollection(m map[string]json.RawMessage, result interface{}) return } +// RegionIdentity : Identifies a region by a unique property. +// Models which "extend" this model: +// - RegionIdentityByName +// - RegionIdentityByHref +type RegionIdentity struct { + // The globally unique name for this region. + Name *string `json:"name,omitempty"` + + // The URL for this region. + Href *string `json:"href,omitempty"` +} + +func (*RegionIdentity) isaRegionIdentity() bool { + return true +} + +type RegionIdentityIntf interface { + isaRegionIdentity() bool +} + +// UnmarshalRegionIdentity unmarshals an instance of RegionIdentity from the specified map of raw messages. +func UnmarshalRegionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // RegionReference : RegionReference struct type RegionReference struct { // The URL for this region. @@ -57657,6 +58106,248 @@ func UnmarshalRouteCollectionNext(m map[string]json.RawMessage, result interface 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"` + + // Collection of routes. + 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 { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionVPCContextNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteCollectionVPCContextRoutesItem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + 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 { + 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 { + 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. + Action *string `json:"action" 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 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 are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + Origin *string `json:"origin,omitempty"` + + // 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. (Traffic from subnets 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. +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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +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 { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // 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. @@ -58894,10 +59585,10 @@ type SecurityGroupRule struct { // The ICMP traffic type to allow. If absent, all types are allowed. Type *int64 `json:"type,omitempty"` - // The inclusive upper bound of TCP/UDP port range. + // The inclusive upper bound of TCP/UDP destination port range. PortMax *int64 `json:"port_max,omitempty"` - // The inclusive lower bound of TCP/UDP port range. + // The inclusive lower bound of TCP/UDP destination port range. PortMin *int64 `json:"port_min,omitempty"` } @@ -58992,12 +59683,14 @@ type SecurityGroupRulePatch struct { // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` - // The inclusive upper bound of the protocol port range. If set, `port_min` must also be set, and must not be larger. + // The inclusive upper bound of the protocol destination port range. If set, `port_min` must also be set, and must not + // be larger. // // Specify `null` to remove an existing upper bound. PortMax *int64 `json:"port_max,omitempty"` - // The inclusive lower bound of the protocol port range. If set, `port_max` must also be set, and must not be smaller. + // The inclusive lower bound of the protocol destination port range. If set, `port_max` must also be set, and must not + // be smaller. // // Specify `null` to remove an existing lower bound. PortMin *int64 `json:"port_min,omitempty"` @@ -59109,16 +59802,16 @@ type SecurityGroupRulePrototype struct { // If unspecified, all types are allowed. Type *int64 `json:"type,omitempty"` - // The inclusive upper bound of TCP/UDP port range. + // The inclusive upper bound of TCP/UDP destination port range. // - // If specified, `port_min` must also be specified, and must not be larger. If unspecified, `port_min` must also be - // unspecified, allowing traffic on all ports. + // If specified, `port_min` must also be specified, and must not be larger. If unspecified, + // `port_min` must also be unspecified, allowing traffic on all destination ports. PortMax *int64 `json:"port_max,omitempty"` - // The inclusive lower bound of TCP/UDP port range + // The inclusive lower bound of TCP/UDP destination port range // // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be - // unspecified, allowing traffic on all ports. + // unspecified, allowing traffic on all destination ports. PortMin *int64 `json:"port_min,omitempty"` } @@ -59614,6 +60307,9 @@ type Snapshot struct { // Clones for this snapshot. Clones []SnapshotClone `json:"clones" validate:"required"` + // The copies of this snapshot. + Copies []SnapshotCopiesItem `json:"copies" validate:"required"` + // The date and time that this snapshot was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -59669,6 +60365,9 @@ type Snapshot struct { // provisioned. SourceImage *ImageReference `json:"source_image,omitempty"` + // If present, the source snapshot this snapshot was created from. + SourceSnapshot *SnapshotSourceSnapshot `json:"source_snapshot,omitempty"` + // The source volume this snapshot was created from (may be // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). SourceVolume *VolumeReference `json:"source_volume" validate:"required"` @@ -59721,6 +60420,10 @@ func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err er if err != nil { return } + err = core.UnmarshalModel(m, "copies", &obj.Copies, UnmarshalSnapshotCopiesItem) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -59785,6 +60488,10 @@ func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err er if err != nil { return } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotSourceSnapshot) + if err != nil { + return + } err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) if err != nil { return @@ -59964,6 +60671,73 @@ func UnmarshalSnapshotCollectionNext(m map[string]json.RawMessage, result interf return } +// SnapshotCopiesItem : SnapshotCopiesItem struct +type SnapshotCopiesItem struct { + // The CRN for the copied snapshot. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + + // The URL for the copied snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for the copied snapshot. + ID *string `json:"id" validate:"required"` + + // The name for the copied snapshot. + 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 *SnapshotRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SnapshotCopiesItem.ResourceType property. +// The resource type. +const ( + SnapshotCopiesItemResourceTypeSnapshotConst = "snapshot" +) + +// UnmarshalSnapshotCopiesItem unmarshals an instance of SnapshotCopiesItem from the specified map of raw messages. +func UnmarshalSnapshotCopiesItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotCopiesItem) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SnapshotIdentity : Identifies a snapshot by a unique property. // Models which "extend" this model: // - SnapshotIdentityByID @@ -60044,6 +60818,7 @@ func (snapshotPatch *SnapshotPatch) AsPatch() (_patch map[string]interface{}, er // SnapshotPrototype : SnapshotPrototype struct // Models which "extend" this model: // - SnapshotPrototypeSnapshotBySourceVolume +// - SnapshotPrototypeSnapshotBySourceSnapshot type SnapshotPrototype struct { // Clones to create for this snapshot. Clones []SnapshotClonePrototype `json:"clones,omitempty"` @@ -60061,6 +60836,21 @@ type SnapshotPrototype struct { // The volume to create this snapshot from. SourceVolume VolumeIdentityIntf `json:"source_volume,omitempty"` + + // The root key to use to wrap the data encryption key for this snapshot. + // + // A key must be specified if and only if the source snapshot has an `encryption` type of + // `user_managed`. To maximize snapshot availability and sharing of snapshot data, specify + // a key in the same region as the new snapshot, and use the same encryption key for all + // snapshots using the same source volume. + // + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The source snapshot (in another region) to create this snapshot from. + // The specified snapshot must not already be the source of another snapshot in this + // region. + SourceSnapshot *SnapshotIdentityByCRN `json:"source_snapshot,omitempty"` } func (*SnapshotPrototype) isaSnapshotPrototype() bool { @@ -60094,6 +60884,14 @@ func UnmarshalSnapshotPrototype(m map[string]json.RawMessage, result interface{} if err != nil { return } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -60116,6 +60914,10 @@ type SnapshotReference struct { // The name for this snapshot. The name is unique across all snapshots in the region. 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 *SnapshotRemote `json:"remote,omitempty"` + // The resource type. ResourceType *string `json:"resource_type" validate:"required"` } @@ -60149,6 +60951,10 @@ func UnmarshalSnapshotReference(m map[string]json.RawMessage, result interface{} if err != nil { return } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return @@ -60175,6 +60981,92 @@ func UnmarshalSnapshotReferenceDeleted(m map[string]json.RawMessage, result inte return } +// SnapshotRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type SnapshotRemote 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"` +} + +// UnmarshalSnapshotRemote unmarshals an instance of SnapshotRemote from the specified map of raw messages. +func UnmarshalSnapshotRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotRemote) + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotSourceSnapshot : If present, the source snapshot this snapshot was created from. +type SnapshotSourceSnapshot struct { + // The CRN of the source snapshot. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + + // The URL for the source snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for the source snapshot. + ID *string `json:"id" validate:"required"` + + // The name for the source snapshot. The name is unique across all snapshots in the source snapshot's native region. + 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 *SnapshotRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SnapshotSourceSnapshot.ResourceType property. +// The resource type. +const ( + SnapshotSourceSnapshotResourceTypeSnapshotConst = "snapshot" +) + +// UnmarshalSnapshotSourceSnapshot unmarshals an instance of SnapshotSourceSnapshot from the specified map of raw messages. +func UnmarshalSnapshotSourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotSourceSnapshot) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // StartBareMetalServerOptions : The StartBareMetalServer options. type StartBareMetalServerOptions struct { // The bare metal server identifier. @@ -65961,6 +66853,9 @@ type Volume struct { // The resource group for this volume. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + // The image from which this volume was created (this may be // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). // If absent, this volume was not created from an image. @@ -66026,6 +66921,12 @@ const ( VolumeHealthStateOkConst = "ok" ) +// Constants associated with the Volume.ResourceType property. +// The resource type. +const ( + VolumeResourceTypeVolumeConst = "volume" +) + // Constants associated with the Volume.Status property. // The status of the volume. // @@ -66116,6 +67017,10 @@ func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err erro if err != nil { return } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } err = core.UnmarshalModel(m, "source_image", &obj.SourceImage, UnmarshalImageReference) if err != nil { return @@ -66507,6 +67412,10 @@ type VolumeAttachmentPrototypeVolume struct { // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` + // The resource group to use for this volume. If unspecified, the instance's resource group + // will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` @@ -66558,6 +67467,10 @@ func UnmarshalVolumeAttachmentPrototypeVolume(m map[string]json.RawMessage, resu if err != nil { return } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { return @@ -66759,6 +67672,9 @@ type VolumeCollection struct { // except the last page. Next *VolumeCollectionNext `json:"next,omitempty"` + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + // Collection of volumes. Volumes []Volume `json:"volumes" validate:"required"` } @@ -66778,6 +67694,10 @@ func UnmarshalVolumeCollection(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } err = core.UnmarshalModel(m, "volumes", &obj.Volumes, UnmarshalVolume) if err != nil { return @@ -67288,6 +68208,10 @@ type VolumePrototypeInstanceByImageContext struct { // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + // The resource group to use for this volume. If unspecified, the instance's resource group + // will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` } @@ -67324,6 +68248,10 @@ func UnmarshalVolumePrototypeInstanceByImageContext(m map[string]json.RawMessage if err != nil { return } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { return @@ -67357,6 +68285,10 @@ type VolumePrototypeInstanceBySourceSnapshotContext struct { // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + // The resource group to use for this volume. If unspecified, the instance's resource group + // will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The snapshot from which to clone the volume. SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` @@ -67397,6 +68329,10 @@ func UnmarshalVolumePrototypeInstanceBySourceSnapshotContext(m map[string]json.R if err != nil { return } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) if err != nil { return @@ -67426,8 +68362,21 @@ type VolumeReference struct { // The name for this volume. The name is unique across all volumes in the region. 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 *VolumeRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } +// Constants associated with the VolumeReference.ResourceType property. +// The resource type. +const ( + VolumeReferenceResourceTypeVolumeConst = "volume" +) + // UnmarshalVolumeReference unmarshals an instance of VolumeReference from the specified map of raw messages. func UnmarshalVolumeReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VolumeReference) @@ -67451,6 +68400,14 @@ func UnmarshalVolumeReference(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -67490,8 +68447,17 @@ type VolumeReferenceVolumeAttachmentContext struct { // The name for this volume. The name is unique across all volumes in the region. Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } +// Constants associated with the VolumeReferenceVolumeAttachmentContext.ResourceType property. +// The resource type. +const ( + VolumeReferenceVolumeAttachmentContextResourceTypeVolumeConst = "volume" +) + // UnmarshalVolumeReferenceVolumeAttachmentContext unmarshals an instance of VolumeReferenceVolumeAttachmentContext from the specified map of raw messages. func UnmarshalVolumeReferenceVolumeAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VolumeReferenceVolumeAttachmentContext) @@ -67515,6 +68481,10 @@ func UnmarshalVolumeReferenceVolumeAttachmentContext(m map[string]json.RawMessag if err != nil { return } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -67537,6 +68507,25 @@ func UnmarshalVolumeReferenceVolumeAttachmentContextDeleted(m map[string]json.Ra return } +// VolumeRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type VolumeRemote 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"` +} + +// UnmarshalVolumeRemote unmarshals an instance of VolumeRemote from the specified map of raw messages. +func UnmarshalVolumeRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeRemote) + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VolumeStatusReason : VolumeStatusReason struct type VolumeStatusReason struct { // A snake case string succinctly identifying the status reason. @@ -67714,8 +68703,21 @@ type BackupPolicyJobSourceVolumeReference struct { // The name for this volume. The name is unique across all volumes in the region. 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 *VolumeRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } +// Constants associated with the BackupPolicyJobSourceVolumeReference.ResourceType property. +// The resource type. +const ( + BackupPolicyJobSourceVolumeReferenceResourceTypeVolumeConst = "volume" +) + func (*BackupPolicyJobSourceVolumeReference) isaBackupPolicyJobSource() bool { return true } @@ -67743,6 +68745,14 @@ func UnmarshalBackupPolicyJobSourceVolumeReference(m map[string]json.RawMessage, if err != nil { return } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -74934,7 +75944,7 @@ func UnmarshalInstanceProfileVolumeBandwidthRange(m map[string]json.RawMessage, return } -// InstancePrototypeInstanceByCatalogOffering : InstancePrototypeInstanceByCatalogOffering struct +// InstancePrototypeInstanceByCatalogOffering : Create an instance by using a catalog offering. // This model "extends" InstancePrototype type InstancePrototypeInstanceByCatalogOffering struct { // The availability policy to use for this virtual server instance. @@ -74949,7 +75959,7 @@ type InstancePrototypeInstanceByCatalogOffering struct { // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -75105,7 +76115,7 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe return } -// InstancePrototypeInstanceByImage : InstancePrototypeInstanceByImage struct +// InstancePrototypeInstanceByImage : Create an instance by using an image. // This model "extends" InstancePrototype type InstancePrototypeInstanceByImage struct { // The availability policy to use for this virtual server instance. @@ -75120,7 +76130,7 @@ type InstancePrototypeInstanceByImage struct { // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -75269,7 +76279,7 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res return } -// InstancePrototypeInstanceBySourceSnapshot : InstancePrototypeInstanceBySourceSnapshot struct +// InstancePrototypeInstanceBySourceSnapshot : Create an instance by using a snapshot. // This model "extends" InstancePrototype type InstancePrototypeInstanceBySourceSnapshot struct { // The availability policy to use for this virtual server instance. @@ -75284,7 +76294,7 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -75426,7 +76436,10 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes return } -// InstancePrototypeInstanceBySourceTemplate : InstancePrototypeInstanceBySourceTemplate struct +// InstancePrototypeInstanceBySourceTemplate : Create an instance by using an instance template. +// +// The `primary_network_interface` and `network_interfaces` properties may only be specified if +// `primary_network_interface` is specified in the source template. // This model "extends" InstancePrototype type InstancePrototypeInstanceBySourceTemplate struct { // The availability policy to use for this virtual server instance. @@ -75441,7 +76454,7 @@ type InstancePrototypeInstanceBySourceTemplate struct { // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -75610,7 +76623,7 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes return } -// InstancePrototypeInstanceByVolume : InstancePrototypeInstanceByVolume struct +// InstancePrototypeInstanceByVolume : Create an instance by using a boot volume. // This model "extends" InstancePrototype type InstancePrototypeInstanceByVolume struct { // The availability policy to use for this virtual server instance. @@ -75625,7 +76638,7 @@ type InstancePrototypeInstanceByVolume struct { // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -75860,9 +76873,9 @@ func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result return } -// InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext : InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext struct +// InstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Create an instance template that creates instances by using a catalog offering. // This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext struct { +type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -75875,7 +76888,7 @@ type InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext s // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -75933,29 +76946,30 @@ type InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext s NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` // The primary network interface to create for the virtual server instance. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext : Instantiate InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext, err error) { - _model = &InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext{ - CatalogOffering: catalogOffering, - Zone: zone, +// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOffering (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOffering, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOffering{ + CatalogOffering: catalogOffering, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, } err = core.ValidateStruct(_model, "required parameters") return } -func (*InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext unmarshals an instance of InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOffering from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -76028,9 +77042,9 @@ func UnmarshalInstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplate return } -// InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext : InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext struct +// InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image. // This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext struct { +type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -76043,7 +77057,7 @@ type InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext struct { // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -76094,29 +77108,30 @@ type InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext struct { NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` // The primary network interface to create for the virtual server instance. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceByImageInstanceTemplateContext : Instantiate InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceByImageInstanceTemplateContext(image ImageIdentityIntf, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext, err error) { - _model = &InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext{ - Image: image, - Zone: zone, +// NewInstanceTemplatePrototypeInstanceTemplateByImage : Instantiate InstanceTemplatePrototypeInstanceTemplateByImage (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateByImage, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByImage{ + Image: image, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, } err = core.ValidateStruct(_model, "required parameters") return } -func (*InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceByImageInstanceTemplateContext unmarshals an instance of InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceByImageInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceByImageInstanceTemplateContext) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImage from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImage) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -76189,9 +77204,9 @@ func UnmarshalInstanceTemplatePrototypeInstanceByImageInstanceTemplateContext(m return } -// InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext : InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext struct +// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Create an instance template that creates instances by using a snapshot. // This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext struct { +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -76204,7 +77219,7 @@ type InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext st // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -76252,29 +77267,30 @@ type InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext st NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` // The primary network interface to create for the virtual server instance. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext : Instantiate InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext, err error) { - _model = &InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, +// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot{ + BootVolumeAttachment: bootVolumeAttachment, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, } err = core.ValidateStruct(_model, "required parameters") return } -func (*InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext unmarshals an instance of InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateContext) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -76343,9 +77359,9 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceSnapshotInstanceTemplateC return } -// InstanceTemplatePrototypeInstanceBySourceTemplate : InstanceTemplatePrototypeInstanceBySourceTemplate struct +// InstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Create an instance template from an existing instance template. // This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceBySourceTemplate struct { +type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -76358,7 +77374,7 @@ type InstanceTemplatePrototypeInstanceBySourceTemplate struct { // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -76429,22 +77445,22 @@ type InstanceTemplatePrototypeInstanceBySourceTemplate struct { Zone ZoneIdentityIntf `json:"zone,omitempty"` } -// NewInstanceTemplatePrototypeInstanceBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceBySourceTemplate (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceBySourceTemplate, err error) { - _model = &InstanceTemplatePrototypeInstanceBySourceTemplate{ +// NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceTemplate, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceTemplate{ SourceTemplate: sourceTemplate, } err = core.ValidateStruct(_model, "required parameters") return } -func (*InstanceTemplatePrototypeInstanceBySourceTemplate) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceBySourceTemplate from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceBySourceTemplate) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceTemplate from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -76525,9 +77541,9 @@ func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]jso return } -// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext : InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct +// InstanceTemplateInstanceByCatalogOffering : Create an instance by using a catalog offering. // This model "extends" InstanceTemplate -type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { +type InstanceTemplateInstanceByCatalogOffering struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -76552,7 +77568,7 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -76610,19 +77626,19 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` // The primary network interface to create for the virtual server instance. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplate() bool { +func (*InstanceTemplateInstanceByCatalogOffering) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) +// UnmarshalInstanceTemplateInstanceByCatalogOffering unmarshals an instance of InstanceTemplateInstanceByCatalogOffering from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOffering) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -76711,9 +77727,9 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m return } -// InstanceTemplateInstanceByImageInstanceTemplateContext : InstanceTemplateInstanceByImageInstanceTemplateContext struct +// InstanceTemplateInstanceByImage : Create an instance by using an image. // This model "extends" InstanceTemplate -type InstanceTemplateInstanceByImageInstanceTemplateContext struct { +type InstanceTemplateInstanceByImage struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -76738,7 +77754,7 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -76789,19 +77805,19 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` // The primary network interface to create for the virtual server instance. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplate() bool { +func (*InstanceTemplateInstanceByImage) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContext from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImageInstanceTemplateContext) +// UnmarshalInstanceTemplateInstanceByImage unmarshals an instance of InstanceTemplateInstanceByImage from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImage) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -76890,9 +77906,9 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[strin return } -// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext : InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct +// InstanceTemplateInstanceBySourceSnapshot : Create an instance by using a snapshot. // This model "extends" InstanceTemplate -type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { +type InstanceTemplateInstanceBySourceSnapshot struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -76917,7 +77933,7 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // virtual server instance 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 chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -76965,19 +77981,19 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` // The primary network interface to create for the virtual server instance. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplate() bool { +func (*InstanceTemplateInstanceBySourceSnapshot) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) +// UnmarshalInstanceTemplateInstanceBySourceSnapshot unmarshals an instance of InstanceTemplateInstanceBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshot) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -77998,6 +79014,69 @@ func UnmarshalLoadBalancerProfileIdentityByName(m map[string]json.RawMessage, re return } +// LoadBalancerProfileInstanceGroupsSupportedDependent : The instance groups support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileInstanceGroupsSupported +type LoadBalancerProfileInstanceGroupsSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileInstanceGroupsSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileInstanceGroupsSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileInstanceGroupsSupportedDependent) isaLoadBalancerProfileInstanceGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileInstanceGroupsSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileInstanceGroupsSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileInstanceGroupsSupportedFixed : The instance groups support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileInstanceGroupsSupported +type LoadBalancerProfileInstanceGroupsSupportedFixed 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 LoadBalancerProfileInstanceGroupsSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileInstanceGroupsSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileInstanceGroupsSupportedFixed) isaLoadBalancerProfileInstanceGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileInstanceGroupsSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileInstanceGroupsSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // LoadBalancerProfileRouteModeSupportedDependent : The route mode support for a load balancer with this profile depends on its configuration. // This model "extends" LoadBalancerProfileRouteModeSupported type LoadBalancerProfileRouteModeSupportedDependent struct { @@ -80376,6 +81455,68 @@ func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID(m map[string]json.R return } +// RegionIdentityByHref : RegionIdentityByHref struct +// This model "extends" RegionIdentity +type RegionIdentityByHref struct { + // The URL for this region. + Href *string `json:"href" validate:"required"` +} + +// NewRegionIdentityByHref : Instantiate RegionIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRegionIdentityByHref(href string) (_model *RegionIdentityByHref, err error) { + _model = &RegionIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RegionIdentityByHref) isaRegionIdentity() bool { + return true +} + +// UnmarshalRegionIdentityByHref unmarshals an instance of RegionIdentityByHref from the specified map of raw messages. +func UnmarshalRegionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionIdentityByName : RegionIdentityByName struct +// This model "extends" RegionIdentity +type RegionIdentityByName struct { + // The globally unique name for this region. + Name *string `json:"name" validate:"required"` +} + +// NewRegionIdentityByName : Instantiate RegionIdentityByName (Generic Model Constructor) +func (*VpcV1) NewRegionIdentityByName(name string) (_model *RegionIdentityByName, err error) { + _model = &RegionIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RegionIdentityByName) isaRegionIdentity() bool { + return true +} + +// UnmarshalRegionIdentityByName unmarshals an instance of RegionIdentityByName from the specified map of raw messages. +func UnmarshalRegionIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ReservedIPTargetPrototypeEndpointGatewayIdentity : ReservedIPTargetPrototypeEndpointGatewayIdentity struct // Models which "extend" this model: // - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID @@ -81518,8 +82659,8 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[stri // SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. // -// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all ports are allowed for -// the protocol. When both have the same value, that single port is allowed. +// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all destination ports are +// allowed for the protocol. When both have the same value, that single destination port is allowed. // This model "extends" SecurityGroupRulePrototype type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { // The direction of traffic to enforce. @@ -81530,16 +82671,16 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` - // The inclusive upper bound of TCP/UDP port range. + // The inclusive upper bound of TCP/UDP destination port range. // - // If specified, `port_min` must also be specified, and must not be larger. If unspecified, `port_min` must also be - // unspecified, allowing traffic on all ports. + // If specified, `port_min` must also be specified, and must not be larger. If unspecified, + // `port_min` must also be unspecified, allowing traffic on all destination ports. PortMax *int64 `json:"port_max,omitempty"` - // The inclusive lower bound of TCP/UDP port range + // The inclusive lower bound of TCP/UDP destination port range // // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be - // unspecified, allowing traffic on all ports. + // unspecified, allowing traffic on all destination ports. PortMin *int64 `json:"port_min,omitempty"` // The protocol to enforce. @@ -82130,8 +83271,8 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.R // SecurityGroupRuleSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. // -// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all ports are allowed for -// the protocol. When both have the same value, that single port is allowed. +// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all destination ports are +// allowed for the protocol. When both have the same value, that single destination port is allowed. // This model "extends" SecurityGroupRule type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { // The direction of traffic to enforce. @@ -82150,10 +83291,10 @@ type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` - // The inclusive upper bound of TCP/UDP port range. + // The inclusive upper bound of TCP/UDP destination port range. PortMax *int64 `json:"port_max,omitempty"` - // The inclusive lower bound of TCP/UDP port range. + // The inclusive lower bound of TCP/UDP destination port range. PortMin *int64 `json:"port_min,omitempty"` // The protocol to enforce. @@ -82567,6 +83708,81 @@ func UnmarshalSnapshotIdentityByID(m map[string]json.RawMessage, result interfac return } +// SnapshotPrototypeSnapshotBySourceSnapshot : SnapshotPrototypeSnapshotBySourceSnapshot struct +// This model "extends" SnapshotPrototype +type SnapshotPrototypeSnapshotBySourceSnapshot struct { + // Clones to create for this snapshot. + Clones []SnapshotClonePrototype `json:"clones,omitempty"` + + // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` + + // The root key to use to wrap the data encryption key for this snapshot. + // + // A key must be specified if and only if the source snapshot has an `encryption` type of + // `user_managed`. To maximize snapshot availability and sharing of snapshot data, specify + // a key in the same region as the new snapshot, and use the same encryption key for all + // snapshots using the same source volume. + // + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The source snapshot (in another region) to create this snapshot from. + // The specified snapshot must not already be the source of another snapshot in this + // region. + SourceSnapshot *SnapshotIdentityByCRN `json:"source_snapshot" validate:"required"` +} + +// NewSnapshotPrototypeSnapshotBySourceSnapshot : Instantiate SnapshotPrototypeSnapshotBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewSnapshotPrototypeSnapshotBySourceSnapshot(sourceSnapshot *SnapshotIdentityByCRN) (_model *SnapshotPrototypeSnapshotBySourceSnapshot, err error) { + _model = &SnapshotPrototypeSnapshotBySourceSnapshot{ + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotPrototypeSnapshotBySourceSnapshot) isaSnapshotPrototype() bool { + return true +} + +// UnmarshalSnapshotPrototypeSnapshotBySourceSnapshot unmarshals an instance of SnapshotPrototypeSnapshotBySourceSnapshot from the specified map of raw messages. +func UnmarshalSnapshotPrototypeSnapshotBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPrototypeSnapshotBySourceSnapshot) + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SnapshotPrototypeSnapshotBySourceVolume : SnapshotPrototypeSnapshotBySourceVolume struct // This model "extends" SnapshotPrototype type SnapshotPrototypeSnapshotBySourceVolume struct { @@ -84646,6 +85862,10 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + // The resource group to use for this volume. If unspecified, the instance's resource group + // will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` @@ -84690,6 +85910,10 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext(m ma if err != nil { return } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { return @@ -84879,6 +86103,8 @@ type VolumePrototypeVolumeByCapacity struct { // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. Profile VolumeProfileIdentityIntf `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) is used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -84965,6 +86191,8 @@ type VolumePrototypeVolumeBySourceSnapshot struct { // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. Profile VolumeProfileIdentityIntf `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) is used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -88047,6 +89275,9 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototyp // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + // The resource group to use for this volume. If unspecified, the instance's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` @@ -88093,6 +89324,10 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolum if err != nil { return } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { return @@ -88123,6 +89358,9 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototyp // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + // The resource group to use for this volume. If unspecified, the instance's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` @@ -88174,6 +89412,10 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolum if err != nil { return } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { return @@ -88610,7 +89852,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 []Route, err error) { +func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []RouteCollectionVPCContextRoutesItem, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } @@ -88641,9 +89883,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 []Route, err error) { +func (pager *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems []RouteCollectionVPCContextRoutesItem, err error) { for pager.HasNext() { - var nextPage []Route + var nextPage []RouteCollectionVPCContextRoutesItem nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -88654,12 +89896,12 @@ func (pager *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems [] } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutesPager) GetNext() (page []Route, err error) { +func (pager *VPCRoutesPager) GetNext() (page []RouteCollectionVPCContextRoutesItem, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutesPager) GetAll() (allItems []Route, err error) { +func (pager *VPCRoutesPager) GetAll() (allItems []RouteCollectionVPCContextRoutesItem, err error) { return pager.GetAllWithContext(context.Background()) } diff --git a/go.mod b/go.mod index 5ea2eb8cc5..0bc1a10553 100644 --- a/go.mod +++ b/go.mod @@ -217,6 +217,8 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 +replace github.com/IBM/vpc-go-sdk v0.38.0 => ./common/github.com/IBM/vpc-go-sdk + exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible From 68b7035e8fb45e437aa3920b9048d928fa66c55b Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 6 Jul 2023 14:43:39 +0530 Subject: [PATCH 034/103] breaking change --- ibm/service/vpc/resource_ibm_is_instance_template.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ibm/service/vpc/resource_ibm_is_instance_template.go b/ibm/service/vpc/resource_ibm_is_instance_template.go index 9ac2e29abe..23514e4910 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_template.go +++ b/ibm/service/vpc/resource_ibm_is_instance_template.go @@ -693,7 +693,7 @@ func instanceTemplateCreateByCatalogOffering(d *schema.ResourceData, meta interf return err } - instanceproto := &vpcv1.InstanceTemplatePrototypeInstanceByCatalogOfferingInstanceTemplateContext{ + instanceproto := &vpcv1.InstanceTemplatePrototypeInstanceTemplateByCatalogOffering{ Zone: &vpcv1.ZoneIdentity{ Name: &zone, }, From 7f1a19c7ff1ecdb24ec5e5b8882cc95769e97433 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 12 Jul 2023 15:55:45 +0530 Subject: [PATCH 035/103] Update vpc_v1.go --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 378 +++++++++++++++++- 1 file changed, 366 insertions(+), 12 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 0e9f35b3dd..d944f0df63 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -27,6 +27,7 @@ import ( "fmt" "net/http" "reflect" + "strings" "time" "github.com/IBM/go-sdk-core/v5/core" @@ -37,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: `2023-07-04` +// API Version: 2023-07-11 type VpcV1 struct { Service *core.BaseService @@ -46,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 `2022-09-13` - // and `2023-07-04`. + // and `2023-07-11`. Version *string } @@ -63,7 +64,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-07-04`. + // and `2023-07-11`. Version *string } @@ -121,7 +122,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2023-06-27") + options.Version = core.StringPtr("2023-07-11") } service = &VpcV1{ @@ -3258,9 +3259,6 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS // ListImages : List all images // This request lists all images available in the region. An image provides source data for a volume. Images are either // system-provided, or created from another source, such as importing from Cloud Object Storage. -// -// The images will be sorted by their `created_at` property values, with the newest first. Images with identical -// `created_at` values will be secondarily sorted by ascending `id` property values. func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { return vpc.ListImagesWithContext(context.Background(), listImagesOptions) } @@ -3304,6 +3302,9 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * if listImagesOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) } + if listImagesOptions.Status != nil { + builder.AddQuery("status", strings.Join(listImagesOptions.Status, ",")) + } if listImagesOptions.Visibility != nil { builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) } @@ -3586,6 +3587,128 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions return } +// DeprecateImage : Deprecate an image +// This request deprecates an image, resulting in its `status` becoming `deprecated` and +// `deprecation_at` being set to the current date and time. +// +// The image must: +// - have a `status` of `available` +// - have `catalog_offering.managed` set to `false` +// - not have `deprecation_at` set +// +// The image must not have `deprecation_at` set, must have `catalog_offering.managed` set to +// `false`, and must have a `status` of `available`. +// +// A system-provided image is not allowed to be deprecated. +func (vpc *VpcV1) DeprecateImage(deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { + return vpc.DeprecateImageWithContext(context.Background(), deprecateImageOptions) +} + +// DeprecateImageWithContext is an alternate form of the DeprecateImage method which supports a Context parameter +func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deprecateImageOptions, "deprecateImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deprecateImageOptions, "deprecateImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deprecateImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/deprecate`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deprecateImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeprecateImage") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ObsoleteImage : Obsolete an image +// This request obsoletes an image, resulting in its `status` becoming `obsolete` and +// `obsolescence_at` being set to the current date and time. +// +// The image must: +// - have a `status` of `available` or `deprecated` +// - have `catalog_offering.managed` set to `false` +// - not have `deprecation_at` set in the future +// - not have `obsolescence_at` set +// +// A system-provided image is not allowed to be obsoleted. +func (vpc *VpcV1) ObsoleteImage(obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { + return vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) +} + +// ObsoleteImageWithContext is an alternate form of the ObsoleteImage method which supports a Context parameter +func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(obsoleteImageOptions, "obsoleteImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(obsoleteImageOptions, "obsoleteImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *obsoleteImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/obsolete`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range obsoleteImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ObsoleteImage") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + // ListImageExportJobs : List all image export jobs // This request lists all export jobs for an image. Each job tracks the exporting of the image to another location, such // as a bucket within cloud object storage. @@ -3659,9 +3782,9 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE // CreateImageExportJob : Create an image export job // This request creates and queues a new export job for the image specified in the URL using the image export job -// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, or `unusable` -// state. The prototype object is structured in the same way as a retrieved image export job, and contains the -// information necessary to create and queue the new image export job. +// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, `obsolete`, or +// `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains +// the information necessary to create and queue the new image export job. func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { return vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) } @@ -34437,6 +34560,34 @@ func (options *DeleteVPNServerRouteOptions) SetHeaders(param map[string]string) return options } +// DeprecateImageOptions : The DeprecateImage options. +type DeprecateImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeprecateImageOptions : Instantiate DeprecateImageOptions +func (*VpcV1) NewDeprecateImageOptions(id string) *DeprecateImageOptions { + return &DeprecateImageOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeprecateImageOptions) SetID(id string) *DeprecateImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeprecateImageOptions) SetHeaders(param map[string]string) *DeprecateImageOptions { + options.Headers = param + return options +} + // DisconnectVPNClientOptions : The DisconnectVPNClient options. type DisconnectVPNClientOptions struct { // The VPN server identifier. @@ -39435,6 +39586,11 @@ type Image struct { // The CRN for this image. CRN *string `json:"crn" validate:"required"` + // The deprecation date and time (UTC) for this image. + // + // If absent, no deprecation date and time has been set. + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + // The type of encryption used on the image. Encryption *string `json:"encryption" validate:"required"` @@ -39461,6 +39617,11 @@ type Image struct { // The name for this image. The name is unique across all images in the region. Name *string `json:"name" validate:"required"` + // The obsolescence date and time (UTC) for this image. + // + // If absent, no obsolescence date and time has been set. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` + // The operating system included in this image. OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` @@ -39479,8 +39640,9 @@ type Image struct { // - available: image can be used (provisionable) // - deleting: image is being deleted, and can no longer be used to provision new // resources - // - deprecated: image is administratively slated to be deleted + // - deprecated: image is administratively slated to become `obsolete` // - failed: image is corrupt or did not pass validation + // - obsolete: image administratively set to not be used for new resources // - pending: image is being imported and is not yet `available` // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) // @@ -39531,8 +39693,9 @@ const ( // - available: image can be used (provisionable) // - deleting: image is being deleted, and can no longer be used to provision new // resources -// - deprecated: image is administratively slated to be deleted +// - deprecated: image is administratively slated to become `obsolete` // - failed: image is corrupt or did not pass validation +// - obsolete: image administratively set to not be used for new resources // - pending: image is being imported and is not yet `available` // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) // @@ -39544,6 +39707,7 @@ const ( ImageStatusDeletingConst = "deleting" ImageStatusDeprecatedConst = "deprecated" ImageStatusFailedConst = "failed" + ImageStatusObsoleteConst = "obsolete" ImageStatusPendingConst = "pending" ImageStatusUnusableConst = "unusable" ) @@ -39572,6 +39736,10 @@ func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error if err != nil { return } + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) if err != nil { return @@ -39600,6 +39768,10 @@ func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error if err != nil { return } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) if err != nil { return @@ -40124,18 +40296,59 @@ func UnmarshalImageIdentity(m map[string]json.RawMessage, result interface{}) (e // ImagePatch : ImagePatch struct type ImagePatch struct { + // The deprecation date and time to set for this image. + // + // This cannot be set if the image has a `status` of `failed` or `deleting`, or if + // `catalog_offering.managed` is `true`. + // + // The date and time must not be in the past, and must be earlier than `obsolescence_at` + // (if `obsolescence_at` is set). Additionally, if the image status is currently + // `deprecated`, the value cannot be changed (but may be removed). + // + // Specify `null` to remove an existing deprecation date and time. If the image status is currently `deprecated`, it + // will become `available`. + // + // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will + // transition to `deprecated` upon its successful creation (or + // `obsolete` if the obsolescence date and time was also reached). + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are // reserved for system-provided images, and are not allowed. Name *string `json:"name,omitempty"` + + // The obsolescence date and time to set for this image. + // + // This cannot be set if the image has a `status` of `failed` or `deleting`, or if + // `catalog_offering.managed` is `true`. + // + // The date and time must not be in the past, and must be later than `deprecation_at` (if + // `deprecation_at` is set). Additionally, if the image status is currently `obsolete`, the value cannot be changed + // (but may be removed). + // + // Specify `null` to remove an existing obsolescence date and time. If the image status is currently `obsolete`, it + // will become `deprecated` if `deprecation_at` is in the past. Otherwise, it will become `available`. + // + // If the obsolescence date and time is reached while the image has a status of `pending`, the image's status will + // transition to `obsolete` upon its successful creation. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` } // UnmarshalImagePatch unmarshals an instance of ImagePatch from the specified map of raw messages. func UnmarshalImagePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ImagePatch) + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -40155,11 +40368,34 @@ func (imagePatch *ImagePatch) AsPatch() (_patch map[string]interface{}, err erro // - ImagePrototypeImageByFile // - ImagePrototypeImageBySourceVolume type ImagePrototype struct { + // The deprecation date and time to set for this image. + // + // The date and time must not be in the past, and must be earlier than `obsolescence_at` + // (if `obsolescence_at` is set). + // + // If unspecified, no deprecation date and time will be set. + // + // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will + // transition to `deprecated` upon its successful creation (or + // `obsolete` if the obsolescence date and time was also reached). + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of // randomly-selected words. Name *string `json:"name,omitempty"` + // The obsolescence date and time to set for this image. + // + // The date and time must not be in the past, and must be later than `deprecation_at` (if + // `deprecation_at` is set). + // + // If unspecified, no obsolescence date and time will be set. + // + // If the obsolescence date and time is reached while the image has a status of + // `pending`, the image's status will transition to `obsolete` upon its successful creation. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` + // The resource group to use. If unspecified, the account's [default resource // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -40209,10 +40445,18 @@ type ImagePrototypeIntf interface { // UnmarshalImagePrototype unmarshals an instance of ImagePrototype from the specified map of raw messages. func UnmarshalImagePrototype(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ImagePrototype) + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -47461,6 +47705,9 @@ type ListImagesOptions struct { // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` + // Filters the collection to images with a `status` property matching one of the specified comma-separated values. + Status []string `json:"status,omitempty"` + // Filters the collection to images with a `visibility` property matching the specified value. Visibility *string `json:"visibility,omitempty"` @@ -47468,6 +47715,17 @@ type ListImagesOptions struct { Headers map[string]string } +// Constants associated with the ListImagesOptions.Status property. +const ( + ListImagesOptionsStatusAvailableConst = "available" + ListImagesOptionsStatusDeletingConst = "deleting" + ListImagesOptionsStatusDeprecatedConst = "deprecated" + ListImagesOptionsStatusFailedConst = "failed" + ListImagesOptionsStatusObsoleteConst = "obsolete" + ListImagesOptionsStatusPendingConst = "pending" + ListImagesOptionsStatusUnusableConst = "unusable" +) + // Constants associated with the ListImagesOptions.Visibility property. // Filters the collection to images with a `visibility` property matching the specified value. const ( @@ -47504,6 +47762,12 @@ func (_options *ListImagesOptions) SetName(name string) *ListImagesOptions { return _options } +// SetStatus : Allow user to set Status +func (_options *ListImagesOptions) SetStatus(status []string) *ListImagesOptions { + _options.Status = status + return _options +} + // SetVisibility : Allow user to set Visibility func (_options *ListImagesOptions) SetVisibility(visibility string) *ListImagesOptions { _options.Visibility = core.StringPtr(visibility) @@ -55735,6 +55999,34 @@ func UnmarshalNetworkInterfaceUnpaginatedCollection(m map[string]json.RawMessage return } +// ObsoleteImageOptions : The ObsoleteImage options. +type ObsoleteImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewObsoleteImageOptions : Instantiate ObsoleteImageOptions +func (*VpcV1) NewObsoleteImageOptions(id string) *ObsoleteImageOptions { + return &ObsoleteImageOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ObsoleteImageOptions) SetID(id string) *ObsoleteImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ObsoleteImageOptions) SetHeaders(param map[string]string) *ObsoleteImageOptions { + options.Headers = param + return options +} + // OperatingSystem : OperatingSystem struct type OperatingSystem struct { // The operating system architecture. @@ -72933,11 +73225,34 @@ func UnmarshalImageIdentityByID(m map[string]json.RawMessage, result interface{} // ImagePrototypeImageByFile : ImagePrototypeImageByFile struct // This model "extends" ImagePrototype type ImagePrototypeImageByFile struct { + // The deprecation date and time to set for this image. + // + // The date and time must not be in the past, and must be earlier than `obsolescence_at` + // (if `obsolescence_at` is set). + // + // If unspecified, no deprecation date and time will be set. + // + // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will + // transition to `deprecated` upon its successful creation (or + // `obsolete` if the obsolescence date and time was also reached). + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of // randomly-selected words. Name *string `json:"name,omitempty"` + // The obsolescence date and time to set for this image. + // + // The date and time must not be in the past, and must be later than `deprecation_at` (if + // `deprecation_at` is set). + // + // If unspecified, no obsolescence date and time will be set. + // + // If the obsolescence date and time is reached while the image has a status of + // `pending`, the image's status will transition to `obsolete` upon its successful creation. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. @@ -72983,10 +73298,18 @@ func (*ImagePrototypeImageByFile) isaImagePrototype() bool { // UnmarshalImagePrototypeImageByFile unmarshals an instance of ImagePrototypeImageByFile from the specified map of raw messages. func UnmarshalImagePrototypeImageByFile(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ImagePrototypeImageByFile) + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -73014,11 +73337,34 @@ func UnmarshalImagePrototypeImageByFile(m map[string]json.RawMessage, result int // ImagePrototypeImageBySourceVolume : ImagePrototypeImageBySourceVolume struct // This model "extends" ImagePrototype type ImagePrototypeImageBySourceVolume struct { + // The deprecation date and time to set for this image. + // + // The date and time must not be in the past, and must be earlier than `obsolescence_at` + // (if `obsolescence_at` is set). + // + // If unspecified, no deprecation date and time will be set. + // + // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will + // transition to `deprecated` upon its successful creation (or + // `obsolete` if the obsolescence date and time was also reached). + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of // randomly-selected words. Name *string `json:"name,omitempty"` + // The obsolescence date and time to set for this image. + // + // The date and time must not be in the past, and must be later than `deprecation_at` (if + // `deprecation_at` is set). + // + // If unspecified, no obsolescence date and time will be set. + // + // If the obsolescence date and time is reached while the image has a status of + // `pending`, the image's status will transition to `obsolete` upon its successful creation. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The root key used to wrap the system-generated data encryption key for the image. @@ -73051,10 +73397,18 @@ func (*ImagePrototypeImageBySourceVolume) isaImagePrototype() bool { // UnmarshalImagePrototypeImageBySourceVolume unmarshals an instance of ImagePrototypeImageBySourceVolume from the specified map of raw messages. func UnmarshalImagePrototypeImageBySourceVolume(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ImagePrototypeImageBySourceVolume) + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return From f86a7e080dd92aa3fa3d982e4c41db1480c20c79 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 21 Sep 2023 16:41:01 +0530 Subject: [PATCH 036/103] udpated sdk --- .../IBM/vpc-go-sdk/common/headers.go | 14 + .../IBM/vpc-go-sdk/common/headers_test.go | 7 +- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 35640 +++++++++------- 3 files changed, 21184 insertions(+), 14477 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers.go b/common/github.com/IBM/vpc-go-sdk/common/headers.go index 00d92fdb3c..87cc2bfcd9 100644 --- a/common/github.com/IBM/vpc-go-sdk/common/headers.go +++ b/common/github.com/IBM/vpc-go-sdk/common/headers.go @@ -3,12 +3,18 @@ package common import ( "fmt" "runtime" + + "github.com/google/uuid" ) const ( HEADER_NAME_USER_AGENT = "User-Agent" SDK_NAME = "vpc-go-sdk" + + X_CORRELATION_ID = "X-Correlation-Id" + + X_REQUEST_ID = "X-Request-Id" ) // GetSdkHeaders - returns the set of SDK-specific headers to be included in an outgoing request. @@ -36,6 +42,8 @@ func GetSdkHeaders(serviceName string, serviceVersion string, operationId string sdkHeaders := make(map[string]string) sdkHeaders[HEADER_NAME_USER_AGENT] = GetUserAgentInfo() + sdkHeaders[X_CORRELATION_ID] = GetNewXCorrelationID() + sdkHeaders[X_REQUEST_ID] = GetNewXRequestID() return sdkHeaders } @@ -45,6 +53,12 @@ var UserAgent string = fmt.Sprintf("%s-%s %s", SDK_NAME, Version, GetSystemInfo( func GetUserAgentInfo() string { return UserAgent } +func GetNewXCorrelationID() string { + return uuid.New().String() +} +func GetNewXRequestID() string { + return uuid.New().String() +} var systemInfo = fmt.Sprintf("(arch=%s; os=%s; go.version=%s)", runtime.GOARCH, runtime.GOOS, runtime.Version()) diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers_test.go b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go index deca50645d..c8e610ed55 100644 --- a/common/github.com/IBM/vpc-go-sdk/common/headers_test.go +++ b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go @@ -1,9 +1,10 @@ package common import ( - "github.com/stretchr/testify/assert" "strings" "testing" + + "github.com/stretchr/testify/assert" ) func TestGetSystemInfo(t *testing.T) { @@ -22,4 +23,8 @@ func TestGetSdkHeaders(t *testing.T) { _, foundIt = headers[HEADER_NAME_USER_AGENT] assert.True(t, foundIt) + _, foundIt = headers[X_CORRELATION_ID] + assert.True(t, foundIt) + _, foundIt = headers[X_REQUEST_ID] + assert.True(t, foundIt) } diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index d944f0df63..3760914f76 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.70.0-7df966bf-20230419-195904 + * IBM OpenAPI SDK Code Generator Version: 3.78.0-67aec9b7-20230818-174940 */ // 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: 2023-07-11 +// API Version: 2023-09-20 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 `2022-09-13` - // and `2023-07-11`. + // and `2023-09-20`. Version *string } @@ -64,7 +64,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-07-11`. + // and `2023-09-20`. Version *string } @@ -122,7 +122,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2023-07-11") + options.Version = core.StringPtr("2023-08-08") } service = &VpcV1{ @@ -2175,6 +2175,18 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions if listSubnetsOptions.ResourceGroupID != nil { builder.AddQuery("resource_group.id", fmt.Sprint(*listSubnetsOptions.ResourceGroupID)) } + if listSubnetsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listSubnetsOptions.ZoneName)) + } + if listSubnetsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listSubnetsOptions.VPCID)) + } + if listSubnetsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listSubnetsOptions.VPCCRN)) + } + if listSubnetsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listSubnetsOptions.VPCName)) + } if listSubnetsOptions.RoutingTableID != nil { builder.AddQuery("routing_table.id", fmt.Sprint(*listSubnetsOptions.RoutingTableID)) } @@ -2272,9 +2284,10 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio // DeleteSubnet : Delete a subnet // This request deletes a subnet. This operation cannot be reversed. For this request to succeed, the subnet must not be -// referenced by any network interfaces, VPN gateways, or load balancers. A delete operation automatically detaches the -// subnet from any network ACLs, public gateways, or endpoint gateways. All flow log collectors with `auto_delete` set -// to `true` targeting the subnet or any resource in the subnet are automatically deleted. +// referenced by any bare metal server network interfaces, instance network interfaces, VPN gateways, or load balancers. +// A delete operation automatically detaches the subnet from any network ACLs, public gateways, or endpoint gateways. +// All flow log collectors with `auto_delete` set to `true` targeting the subnet or any resource in the subnet are +// automatically deleted. func (vpc *VpcV1) DeleteSubnet(deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteSubnetWithContext(context.Background(), deleteSubnetOptions) } @@ -3067,8 +3080,9 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS // DeleteSubnetReservedIP : Delete a reserved IP // This request releases a reserved IP. This operation cannot be reversed. // -// For this request to succeed, the reserved IP must not be required by another resource, such as a network interface -// for which it is the primary IP. A provider-owned reserved IP is not allowed to be deleted. +// For this request to succeed, the reserved IP must not be required by another resource, such as a bare metal server +// network interface or instance network interface for which it is the primary IP. A provider-owned reserved IP is not +// allowed to be deleted. func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) } @@ -5091,9 +5105,9 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO } // DeleteInstance : Delete an instance -// This request deletes an instance. This operation cannot be reversed. Any floating IPs associated with the instance's +// This request deletes an instance. This operation cannot be reversed. Any floating IPs associated with instance // network interfaces are implicitly disassociated. All flow log collectors with `auto_delete` set to `true` targeting -// the instance and/or the instance's network interfaces are automatically deleted. +// the instance and/or the instance network interfaces are automatically deleted. func (vpc *VpcV1) DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) } @@ -5696,10 +5710,10 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta } // ListInstanceNetworkInterfaces : List all network interfaces on an instance -// This request lists all network interfaces on an instance. A network interface is an abstract representation of a -// network interface card and connects an instance to a subnet. While each network interface can attach to only one -// subnet, multiple network interfaces can be created to attach to multiple subnets. Multiple interfaces may also attach -// to the same subnet. +// This request lists all network interfaces on an instance. An instance network interface is an abstract representation +// of a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to +// any subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on +// the instance may also attach to the same subnet. func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) } @@ -5762,10 +5776,10 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, } // CreateInstanceNetworkInterface : Create a network interface on an instance -// This request creates a new network interface from a network interface prototype object. The prototype object is -// structured in the same way as a retrieved network interface, and contains the information necessary to create the new -// network interface. Any subnet in the instance's VPC may be specified, even if it is already attached to another -// network interface. Addresses on the network interface must be within the specified subnet's CIDR blocks. +// This request creates a new instance network interface from an instance network interface prototype object. The +// prototype object is structured in the same way as a retrieved instance network interface, and contains the +// information necessary to create the new instance network interface. Any subnet in the instance's VPC may be +// specified. Addresses on the instance network interface must be within the specified subnet's CIDR blocks. func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) } @@ -5849,10 +5863,11 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, return } -// DeleteInstanceNetworkInterface : Delete a network interface -// This request deletes a network interface. This operation cannot be reversed. Any floating IPs associated with the -// network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to `true` targeting -// the network interface are automatically deleted. The primary network interface is not allowed to be deleted. +// DeleteInstanceNetworkInterface : Delete an instance network interface +// This request deletes an instance network interface. This operation cannot be reversed. Any floating IPs associated +// with the instance network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to +// `true` targeting the instance network interface are automatically deleted. The primary instance network interface is +// not allowed to be deleted. func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) } @@ -5903,8 +5918,8 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, return } -// GetInstanceNetworkInterface : Retrieve a network interface -// This request retrieves a single network interface specified by the identifier in the URL. +// GetInstanceNetworkInterface : Retrieve an instance network interface +// This request retrieves a single instance network interface specified by the identifier in the URL. func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) } @@ -5967,10 +5982,10 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge return } -// UpdateInstanceNetworkInterface : Update a network interface -// This request updates a network interface with the information provided in a network interface patch object. The -// network interface patch object is structured in the same way as a retrieved network interface and needs to contain -// only the information to be updated. +// UpdateInstanceNetworkInterface : Update an instance network interface +// This request updates an instance network interface with the information provided in an instance network interface +// patch object. The instance network interface patch object is structured in the same way as a retrieved instance +// network interface and needs to contain only the information to be updated. func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) } @@ -6039,8 +6054,8 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, return } -// ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with a network interface -// This request lists all floating IPs associated with a network interface. +// ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with an instance network interface +// This request lists all floating IPs associated with an instance network interface. func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) } @@ -6103,8 +6118,8 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context return } -// RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from a network interface -// This request disassociates the specified floating IP from the specified network interface. +// RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from an instance network interface +// This request disassociates the specified floating IP from the specified instance network interface. func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { return vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) } @@ -6157,8 +6172,8 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex } // GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP address if it is associated with the network interface and instance -// specified in the URL. +// This request retrieves a specified floating IP address if it is associated with the instance network interface and +// instance specified in the URL. func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) } @@ -6222,10 +6237,10 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } -// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with a network interface -// This request associates the specified floating IP with the specified network interface, replacing any existing -// association. For this request to succeed, the existing floating IP must not be required by another resource, such as -// a public gateway. A request body is not required, and if provided, is ignored. +// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with an instance network interface +// This request associates the specified floating IP with the specified instance network interface, replacing any +// existing association. For this request to succeed, the existing floating IP must not be required by another resource, +// such as a public gateway. A request body is not required, and if provided, is ignored. func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { return vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) } @@ -6289,14 +6304,14 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } -// ListInstanceNetworkInterfaceIps : List all reserved IPs bound to a network interface -// This request lists all reserved IPs bound to a network interface. -func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { +// ListInstanceNetworkInterfaceIps : List all reserved IPs bound to an instance network interface +// This request lists all reserved IPs bound to an instance network interface. +func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) } // ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter -func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") if err != nil { return @@ -6349,7 +6364,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionNetworkInterfaceContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext) if err != nil { return } @@ -11218,10 +11233,10 @@ func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, upda } // ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server -// This request lists all network interfaces on a bare metal server. A network interface is an abstract representation -// of a network interface card and connects a bare metal server to a subnet. While each network interface can attach to -// only one subnet, multiple network interfaces can be created to attach to multiple subnets. Multiple interfaces may -// also attach to the same subnet. +// This request lists all network interfaces on a bare metal server. A bare metal server network interface is an +// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network +// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to +// the bare metal server. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) } @@ -11290,10 +11305,11 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co } // CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server -// This request creates a new network interface from a network interface prototype object. The prototype object is -// structured in the same way as a retrieved network interface, and contains the information necessary to create the new -// network interface. Any subnet in the bare metal server's VPC may be specified, even if it is already attached to -// another network interface. Addresses on the network interface must be within the specified subnet's CIDR blocks. +// This request creates a new bare metal server network interface from a bare metal server network interface prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network interface, and +// contains the information necessary to create the new bare metal server network interface. Any subnet in the bare +// metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. +// Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) } @@ -11361,9 +11377,10 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// DeleteBareMetalServerNetworkInterface : Delete a network interface -// This request deletes a network interface. This operation cannot be reversed. Any floating IPs associated with the -// network interface are implicitly disassociated. The primary network interface is not allowed to be deleted. +// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface +// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server +// network interface is not allowed to be deleted. func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) } @@ -11414,8 +11431,8 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// GetBareMetalServerNetworkInterface : Retrieve a network interface -// This request retrieves a single network interface specified by the identifier in the URL. +// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface +// This request retrieves a single bare metal server network interface specified by the identifier in the URL. func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) } @@ -11478,10 +11495,10 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont return } -// UpdateBareMetalServerNetworkInterface : Update a network interface -// This request updates a network interface with the information provided in a network interface patch object. The -// network interface patch object is structured in the same way as a retrieved network interface and needs to contain -// only the information to be updated. +// UpdateBareMetalServerNetworkInterface : Update a bare metal server network interface +// This request updates a bare metal server network interface with the information provided in a bare metal server +// network interface patch object. The bare metal server network interface patch object is structured in the same way as +// a retrieved bare metal server network interface and needs to contain only the information to be updated. func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) } @@ -11550,8 +11567,8 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a network interface -// This request lists all floating IPs associated with a network interface. +// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a bare metal server network interface +// This request lists all floating IPs associated with a bare metal server network interface. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) } @@ -11614,8 +11631,8 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx return } -// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a network interface -// This request disassociates the specified floating IP from the specified network interface. +// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface +// This request disassociates the specified floating IP from the specified bare metal server network interface. func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { return vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) } @@ -11668,7 +11685,7 @@ func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx } // GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP if it is associated with the network interface and bare metal server +// This request retrieves a specified floating IP if it is associated with the bare metal server network interface // specified in the URL. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) @@ -11733,8 +11750,8 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } -// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a network interface -// This request associates the specified floating IP with the specified network interface. If +// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface +// This request associates the specified floating IP with the specified bare metal server network interface. If // `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` // is `true`, this replaces any existing association. For this request to succeed, the existing floating IP must not be // required by another resource, such as a public gateway. A request body is not required, and if provided, is ignored. @@ -11801,14 +11818,14 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } -// ListBareMetalServerNetworkInterfaceIps : List all reserved IPs bound to a network interface -// This request lists all reserved IPs bound to a network interface. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { +// ListBareMetalServerNetworkInterfaceIps : List all reserved IPs bound to a bare metal server network interface +// This request lists all reserved IPs bound to a bare metal server network interface. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) } // ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") if err != nil { return @@ -11855,7 +11872,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionNetworkInterfaceContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext) if err != nil { return } @@ -11866,7 +11883,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. } // GetBareMetalServerNetworkInterfaceIP : Retrieve bound reserved IP -// This request retrieves the specified reserved IP address if it is bound to the network interface and bare metal +// This request retrieves the specified reserved IP address if it is bound to the network interface for the bare metal // server specified in the URL. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) @@ -11933,7 +11950,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co // DeleteBareMetalServer : Delete a bare metal server // This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the -// bare metal server's network interfaces are implicitly disassociated. +// bare metal server network interfaces are implicitly disassociated. func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) } @@ -13155,7 +13172,8 @@ func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions } // UpdateSnapshot : Update a snapshot -// This request updates a snapshot's name. +// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group +// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { return vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) } @@ -13471,19 +13489,17 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap return } -// ListRegions : List all regions -// This request lists all regions. Each region is a separate geographic area that contains multiple isolated zones. -// Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones -// in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation -// available. Resources deployed within a single region also benefit from the low latency afforded by geographic -// proximity. -func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { - return vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) +// ListShareProfiles : List all file share profiles +// This request lists all [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) +// available in the region. A file share profile specifies the performance characteristics and pricing model for a file +// share. +func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) } -// ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter -func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") +// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter +func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") if err != nil { return } @@ -13491,16 +13507,16 @@ func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) if err != nil { return } - for headerName, headerValue := range listRegionsOptions.Headers { + for headerName, headerValue := range listShareProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13508,6 +13524,15 @@ func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listShareProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) + } + if listShareProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) + } + if listShareProfilesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) + } request, err := builder.Build() if err != nil { @@ -13520,7 +13545,7 @@ func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) if err != nil { return } @@ -13530,40 +13555,40 @@ func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions return } -// GetRegion : Retrieve a region -// This request retrieves a single region specified by the name in the URL. -func (vpc *VpcV1) GetRegion(getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { - return vpc.GetRegionWithContext(context.Background(), getRegionOptions) +// GetShareProfile : Retrieve a file share profile +// This request retrieves a single file share profile specified by the name in the URL. +func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + return vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) } -// GetRegionWithContext is an alternate form of the GetRegion method which supports a Context parameter -func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getRegionOptions, "getRegionOptions cannot be nil") +// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter +func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getRegionOptions, "getRegionOptions") + err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") if err != nil { return } pathParamsMap := map[string]string{ - "name": *getRegionOptions.Name, + "name": *getShareProfileOptions.Name, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getRegionOptions.Headers { + for headerName, headerValue := range getShareProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegion") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13583,7 +13608,7 @@ func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *Ge return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegion) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) if err != nil { return } @@ -13593,49 +13618,127 @@ func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *Ge return } -// ListRegionZones : List all zones in a region -// This request lists all zones in a region. Zones represent logically-isolated data centers with high-bandwidth and -// low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. -func (vpc *VpcV1) ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { - return vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) +// ListShares : List all file shares +// This request lists all file shares in the region. +func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + return vpc.ListSharesWithContext(context.Background(), listSharesOptions) } -// ListRegionZonesWithContext is an alternate form of the ListRegionZones method which supports a Context parameter -func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listRegionZonesOptions, "listRegionZonesOptions cannot be nil") +// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter +func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSharesOptions, "listSharesOptions") if err != nil { return } - err = core.ValidateStruct(listRegionZonesOptions, "listRegionZonesOptions") + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) if err != nil { return } - pathParamsMap := map[string]string{ - "region_name": *listRegionZonesOptions.RegionName, + for headerName, headerValue := range listSharesOptions.Headers { + builder.AddHeader(headerName, headerValue) } - builder := core.NewRequestBuilder(core.GET) + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") + 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 listSharesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) + } + if listSharesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) + } + if listSharesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) + } + if listSharesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) + } + if listSharesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) + } + if listSharesOptions.ReplicationRole != nil { + builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateShare : Create a file share +// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, +// a replica share, or both a source and replica share. +// +// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to +// provision the new file shares. +func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.CreateShareWithContext(context.Background(), createShareOptions) +} + +// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter +func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createShareOptions, "createShareOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) if err != nil { return } - for headerName, headerValue := range listRegionZonesOptions.Headers { + for headerName, headerValue := range createShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegionZones") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") 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(createShareOptions.SharePrototype) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -13647,7 +13750,7 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { return } @@ -13657,45 +13760,53 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone return } -// GetRegionZone : Retrieve a zone -// This request retrieves a single zone specified by the region and zone names in the URL. -func (vpc *VpcV1) GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { - return vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) +// DeleteShare : Delete a file share +// This request deletes a share. This operation cannot be reversed. A share cannot be deleted if it: +// - has share mount targets +// - has a `lifecycle_state` of `updating` +// - has a replication operation in progress +// +// If the request is accepted, the share `lifecycle_state` will be set to `deleting`. Once deletion processing +// completes, it will no longer be retrievable. +func (vpc *VpcV1) DeleteShare(deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.DeleteShareWithContext(context.Background(), deleteShareOptions) } -// GetRegionZoneWithContext is an alternate form of the GetRegionZone method which supports a Context parameter -func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getRegionZoneOptions, "getRegionZoneOptions cannot be nil") +// DeleteShareWithContext is an alternate form of the DeleteShare method which supports a Context parameter +func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareOptions, "deleteShareOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions") + err = core.ValidateStruct(deleteShareOptions, "deleteShareOptions") if err != nil { return } pathParamsMap := map[string]string{ - "region_name": *getRegionZoneOptions.RegionName, - "name": *getRegionZoneOptions.Name, + "id": *deleteShareOptions.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, `/regions/{region_name}/zones/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getRegionZoneOptions.Headers { + for headerName, headerValue := range deleteShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if deleteShareOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteShareOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -13711,7 +13822,7 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { return } @@ -13721,34 +13832,40 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt return } -// ListPublicGateways : List all public gateways -// This request lists all 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) { - return vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) +// GetShare : Retrieve a file share +// This request retrieves a single file share specified by the identifier in the URL. +func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.GetShareWithContext(context.Background(), getShareOptions) } -// 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") +// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter +func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getShareOptions, "getShareOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "id": *getShareOptions.ID, + } + 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, `/shares/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listPublicGatewaysOptions.Headers { + for headerName, headerValue := range getShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13756,15 +13873,6 @@ 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 listPublicGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) - } request, err := builder.Build() if err != nil { @@ -13777,7 +13885,7 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { return } @@ -13787,67 +13895,54 @@ 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) { - return vpc.CreatePublicGatewayWithContext(context.Background(), createPublicGatewayOptions) +// UpdateShare : Update a file share +// This request updates a share with the information in a provided share patch. The share patch object is structured in +// the same way as a retrieved share and contains only the information to be updated. +func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.UpdateShareWithContext(context.Background(), updateShareOptions) } -// 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") +// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter +func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions") + err = core.ValidateStruct(updateShareOptions, "updateShareOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *updateShareOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) 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, `/shares/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createPublicGatewayOptions.Headers { + for headerName, headerValue := range updateShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") 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 updateShareOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateShareOptions.IfMatch)) + } 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 - } - if createPublicGatewayOptions.FloatingIP != nil { - body["floating_ip"] = createPublicGatewayOptions.FloatingIP - } - if createPublicGatewayOptions.Name != nil { - body["name"] = createPublicGatewayOptions.Name - } - if createPublicGatewayOptions.ResourceGroup != nil { - body["resource_group"] = createPublicGatewayOptions.ResourceGroup - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) if err != nil { return } @@ -13863,7 +13958,7 @@ func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPubl return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { return } @@ -13873,49 +13968,65 @@ 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) { - return vpc.DeletePublicGatewayWithContext(context.Background(), deletePublicGatewayOptions) +// FailoverShare : Failover to replica file share +// This request triggers a failover to the replica file share specified by the identifier in the URL. The failover +// cannot be started if a source share or the replica share has a `lifecycle_state` of `updating`, or has a replication +// operation in progress. +// +// If `fallback_policy` is specified as `split`, and the request is accepted but the failover operation cannot be +// performed, a split will be triggered. +func (vpc *VpcV1) FailoverShare(failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { + return vpc.FailoverShareWithContext(context.Background(), failoverShareOptions) } -// 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") +// FailoverShareWithContext is an alternate form of the FailoverShare method which supports a Context parameter +func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(failoverShareOptions, "failoverShareOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deletePublicGatewayOptions, "deletePublicGatewayOptions") + err = core.ValidateStruct(failoverShareOptions, "failoverShareOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deletePublicGatewayOptions.ID, + "share_id": *failoverShareOptions.ShareID, } - 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, `/shares/{share_id}/failover`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deletePublicGatewayOptions.Headers { + for headerName, headerValue := range failoverShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare") 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 failoverShareOptions.FallbackPolicy != nil { + body["fallback_policy"] = failoverShareOptions.FallbackPolicy + } + if failoverShareOptions.Timeout != nil { + body["timeout"] = failoverShareOptions.Timeout + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -13926,40 +14037,44 @@ func (vpc *VpcV1) DeletePublicGatewayWithContext(ctx context.Context, deletePubl 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) { - return vpc.GetPublicGatewayWithContext(context.Background(), getPublicGatewayOptions) +// ListShareMountTargets : List all mount targets for a file share +// This request retrieves all share mount targets for a file share. A share mount target is a network endpoint at which +// a file share may be mounted. The file share can be mounted by clients in the same VPC and zone after creating share +// mount targets. +// +// The share mount targets will be sorted by their `created_at` property values, with newest targets first. +func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + return vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) } -// 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") +// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter +func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getPublicGatewayOptions, "getPublicGatewayOptions") + err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getPublicGatewayOptions.ID, + "share_id": *listShareMountTargetsOptions.ShareID, } 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, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getPublicGatewayOptions.Headers { + for headerName, headerValue := range listShareMountTargetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13967,6 +14082,15 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listShareMountTargetsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) + } + if listShareMountTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) + } + if listShareMountTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -13979,7 +14103,7 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) if err != nil { return } @@ -13989,50 +14113,53 @@ 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) { - return vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) +// CreateShareMountTarget : Create a mount target for a file share +// This request creates a new share mount target from a share mount target prototype object. +// +// The prototype object is structured in the same way as a retrieved share mount target, and contains the information +// necessary to provision the new file share mount target. +func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) } -// 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") +// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") + err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updatePublicGatewayOptions.ID, + "share_id": *createShareMountTargetOptions.ShareID, } - 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, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updatePublicGatewayOptions.Headers { + for headerName, headerValue := range createShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") 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) + _, err = builder.SetBodyContentJSON(createShareMountTargetOptions.ShareMountTargetPrototype) if err != nil { return } @@ -14048,7 +14175,7 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { return } @@ -14058,33 +14185,44 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl return } -// ListFloatingIps : List all floating IPs -// This request lists all 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) { - return vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) +// DeleteShareMountTarget : Delete a share mount target +// This request deletes a share mount target. This operation cannot be reversed. +// +// If the request is accepted, the share mount target `lifecycle_state` will be set to +// `deleting`. Once deletion processing completes, it will no longer be retrievable. +func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) } -// 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") +// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "share_id": *deleteShareMountTargetOptions.ShareID, + "id": *deleteShareMountTargetOptions.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, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listFloatingIpsOptions.Headers { + for headerName, headerValue := range deleteShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14092,18 +14230,6 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp 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)) - } request, err := builder.Build() if err != nil { @@ -14116,7 +14242,7 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { return } @@ -14126,50 +14252,49 @@ 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) { - return vpc.CreateFloatingIPWithContext(context.Background(), createFloatingIPOptions) +// GetShareMountTarget : Retrieve a share mount target +// This request retrieves a single share mount target specified by the identifier in the URL. +func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) } -// 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") +// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createFloatingIPOptions, "createFloatingIPOptions") + err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "share_id": *getShareMountTargetOptions.ShareID, + "id": *getShareMountTargetOptions.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, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createFloatingIPOptions.Headers { + for headerName, headerValue := range getShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") 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 { - return - } - request, err := builder.Build() if err != nil { return @@ -14181,7 +14306,7 @@ func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatin return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { return } @@ -14191,96 +14316,119 @@ 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) { - return vpc.DeleteFloatingIPWithContext(context.Background(), deleteFloatingIPOptions) +// UpdateShareMountTarget : Update a share mount target +// This request updates a share mount target with the information provided in a share mount target patch object. The +// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) } -// 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") +// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteFloatingIPOptions, "deleteFloatingIPOptions") + err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteFloatingIPOptions.ID, + "share_id": *updateShareMountTargetOptions.ShareID, + "id": *updateShareMountTargetOptions.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, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteFloatingIPOptions.Headers { + for headerName, headerValue := range updateShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") 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(updateShareMountTargetOptions.ShareMountTargetPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + if err != nil { + 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) { - return vpc.GetFloatingIPWithContext(context.Background(), getFloatingIPOptions) +// DeleteShareSource : Split the source file share from a replica share +// This request removes the replication relationship between a source share and the replica share specified by the +// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a +// `lifecycle_state` of `updating`, or has a replication operation in progress. +// +// This operation cannot be reversed. +func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) } -// 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") +// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter +func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getFloatingIPOptions, "getFloatingIPOptions") + err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getFloatingIPOptions.ID, + "share_id": *deleteShareSourceOptions.ShareID, } - 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, `/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getFloatingIPOptions.Headers { + for headerName, headerValue := range deleteShareSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") 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)) @@ -14290,70 +14438,54 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) 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) { - return vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) +// GetShareSource : Retrieve the source file share for a replica file share +// This request retrieves the source file share associated with the replica file share specified by the identifier in +// the URL. +func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) } -// 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") +// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter +func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") + err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateFloatingIPOptions.ID, + "share_id": *getShareSourceOptions.ShareID, } - 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, `/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateFloatingIPOptions.Headers { + for headerName, headerValue := range getShareSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") 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(updateFloatingIPOptions.FloatingIPPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -14365,7 +14497,7 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { return } @@ -14375,17 +14507,19 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin return } -// ListNetworkAcls : List all network ACLs -// This request lists all 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) { - return vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) +// ListRegions : List all regions +// This request lists all regions. Each region is a separate geographic area that contains multiple isolated zones. +// Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones +// in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation +// available. Resources deployed within a single region also benefit from the low latency afforded by geographic +// proximity. +func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + return vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) } -// 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") +// ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter +func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") if err != nil { return } @@ -14393,16 +14527,16 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl 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, `/regions`, nil) if err != nil { return } - for headerName, headerValue := range listNetworkAclsOptions.Headers { + for headerName, headerValue := range listRegionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14410,15 +14544,6 @@ 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 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() if err != nil { @@ -14431,7 +14556,7 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) if err != nil { return } @@ -14441,52 +14566,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) { - return vpc.CreateNetworkACLWithContext(context.Background(), createNetworkACLOptions) +// GetRegion : Retrieve a region +// This request retrieves a single region specified by the name in the URL. +func (vpc *VpcV1) GetRegion(getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { + return vpc.GetRegionWithContext(context.Background(), getRegionOptions) } -// 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") +// GetRegionWithContext is an alternate form of the GetRegion method which supports a Context parameter +func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getRegionOptions, "getRegionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") + err = core.ValidateStruct(getRegionOptions, "getRegionOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "name": *getRegionOptions.Name, + } + + 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, `/regions/{name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createNetworkACLOptions.Headers { + for headerName, headerValue := range getRegionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegion") 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 { - return - } - request, err := builder.Build() if err != nil { return @@ -14498,7 +14619,7 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegion) if err != nil { return } @@ -14508,44 +14629,45 @@ 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) { - return vpc.DeleteNetworkACLWithContext(context.Background(), deleteNetworkACLOptions) +// ListRegionZones : List all zones in a region +// This request lists all zones in a region. Zones represent logically-isolated data centers with high-bandwidth and +// low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. +func (vpc *VpcV1) ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { + return vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) } -// 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") +// ListRegionZonesWithContext is an alternate form of the ListRegionZones method which supports a Context parameter +func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listRegionZonesOptions, "listRegionZonesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteNetworkACLOptions, "deleteNetworkACLOptions") + err = core.ValidateStruct(listRegionZonesOptions, "listRegionZonesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteNetworkACLOptions.ID, + "region_name": *listRegionZonesOptions.RegionName, } - 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, `/network_acls/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteNetworkACLOptions.Headers { + for headerName, headerValue := range listRegionZonesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegionZones") 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)) @@ -14555,45 +14677,57 @@ func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetwork return } - response, err = vpc.Service.Request(request, nil) - - 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) { - return vpc.GetNetworkACLWithContext(context.Background(), getNetworkACLOptions) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneCollection) + if err != nil { + return + } + response.Result = result + } + + 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") +// GetRegionZone : Retrieve a zone +// This request retrieves a single zone specified by the region and zone names in the URL. +func (vpc *VpcV1) GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { + return vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) +} + +// GetRegionZoneWithContext is an alternate form of the GetRegionZone method which supports a Context parameter +func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getRegionZoneOptions, "getRegionZoneOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getNetworkACLOptions, "getNetworkACLOptions") + err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getNetworkACLOptions.ID, + "region_name": *getRegionZoneOptions.RegionName, + "name": *getRegionZoneOptions.Name, } 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, `/regions/{region_name}/zones/{name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getNetworkACLOptions.Headers { + for headerName, headerValue := range getRegionZoneOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14613,7 +14747,7 @@ func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOpt return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone) if err != nil { return } @@ -14623,54 +14757,117 @@ 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) { - return vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) +// ListVirtualNetworkInterfaces : List all virtual network interfaces +// This request lists all virtual network interfaces in the region. A virtual network interface is a logical abstraction +// of a virtual network interface in a subnet, and may be attached to a target resource. +// +// The virtual network interfaces will be sorted by their `created_at` property values, with newest virtual network +// interfaces first. Virtual network interfaces with identical +// `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + return vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) } -// 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") +// ListVirtualNetworkInterfacesWithContext is an alternate form of the ListVirtualNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVirtualNetworkInterfacesOptions, "listVirtualNetworkInterfacesOptions") if err != nil { return } - err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions") + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces") + 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 listVirtualNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) + } + if listVirtualNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Limit)) + } + if listVirtualNetworkInterfacesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVirtualNetworkInterfacesOptions.ResourceGroupID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterfaceCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVirtualNetworkInterface : Retrieve a virtual network interface +// This request retrieves a single virtual network interface specified by the identifier in the URL. +func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + return vpc.GetVirtualNetworkInterfaceWithContext(context.Background(), getVirtualNetworkInterfaceOptions) +} + +// GetVirtualNetworkInterfaceWithContext is an alternate form of the GetVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateNetworkACLOptions.ID, + "id": *getVirtualNetworkInterfaceOptions.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, `/network_acls/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateNetworkACLOptions.Headers { + for headerName, headerValue := range getVirtualNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterface") 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(updateNetworkACLOptions.NetworkACLPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -14682,7 +14879,7 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) if err != nil { return } @@ -14692,41 +14889,105 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork return } -// ListNetworkACLRules : List all rules for a network ACL -// This request lists all 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) { - return vpc.ListNetworkACLRulesWithContext(context.Background(), listNetworkACLRulesOptions) +// UpdateVirtualNetworkInterface : Update a virtual network interface +// This request updates a virtual network interface with the information in a provided virtual network interface patch. +// The virtual network interface patch object is structured in the same way as a retrieved virtual network interface and +// contains only the information to be updated. +func (vpc *VpcV1) UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + return vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) } -// 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") +// UpdateVirtualNetworkInterfaceWithContext is an alternate form of the UpdateVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listNetworkACLRulesOptions, "listNetworkACLRulesOptions") + err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "network_acl_id": *listNetworkACLRulesOptions.NetworkACLID, + "id": *updateVirtualNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVirtualNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVirtualNetworkInterface") + 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(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListPublicGateways : List all public gateways +// This request lists all 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) { + return vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) +} + +// 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 { + return } 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`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) if err != nil { return } - for headerName, headerValue := range listNetworkACLRulesOptions.Headers { + for headerName, headerValue := range listPublicGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkACLRules") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14734,14 +14995,14 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor 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)) + if listPublicGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) } - if listNetworkACLRulesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listNetworkACLRulesOptions.Limit)) + if listPublicGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) } - if listNetworkACLRulesOptions.Direction != nil { - builder.AddQuery("direction", fmt.Sprint(*listNetworkACLRulesOptions.Direction)) + if listPublicGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) } request, err := builder.Build() @@ -14755,7 +15016,7 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRuleCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) if err != nil { return } @@ -14765,41 +15026,41 @@ 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) { - return vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) +// 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) { + return vpc.CreatePublicGatewayWithContext(context.Background(), createPublicGatewayOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") + err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, - } - builder := core.NewRequestBuilder(core.POST) 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, `/public_gateways`, nil) if err != nil { return } - for headerName, headerValue := range createNetworkACLRuleOptions.Headers { + for headerName, headerValue := range createPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14809,7 +15070,23 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) + body := make(map[string]interface{}) + if createPublicGatewayOptions.VPC != nil { + body["vpc"] = createPublicGatewayOptions.VPC + } + if createPublicGatewayOptions.Zone != nil { + body["zone"] = createPublicGatewayOptions.Zone + } + if createPublicGatewayOptions.FloatingIP != nil { + body["floating_ip"] = createPublicGatewayOptions.FloatingIP + } + if createPublicGatewayOptions.Name != nil { + body["name"] = createPublicGatewayOptions.Name + } + if createPublicGatewayOptions.ResourceGroup != nil { + body["resource_group"] = createPublicGatewayOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } @@ -14825,7 +15102,7 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { return } @@ -14835,41 +15112,42 @@ 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) { - return vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) +// 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) { + return vpc.DeletePublicGatewayWithContext(context.Background(), deletePublicGatewayOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") + err = core.ValidateStruct(deletePublicGatewayOptions, "deletePublicGatewayOptions") if err != nil { return } pathParamsMap := map[string]string{ - "network_acl_id": *deleteNetworkACLRuleOptions.NetworkACLID, - "id": *deleteNetworkACLRuleOptions.ID, + "id": *deletePublicGatewayOptions.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, `/public_gateways/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { + for headerName, headerValue := range deletePublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14887,41 +15165,40 @@ func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNet 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) { - return vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) +// 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) { + return vpc.GetPublicGatewayWithContext(context.Background(), getPublicGatewayOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") + err = core.ValidateStruct(getPublicGatewayOptions, "getPublicGatewayOptions") if err != nil { return } pathParamsMap := map[string]string{ - "network_acl_id": *getNetworkACLRuleOptions.NetworkACLID, - "id": *getNetworkACLRuleOptions.ID, + "id": *getPublicGatewayOptions.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, `/public_gateways/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getNetworkACLRuleOptions.Headers { + for headerName, headerValue := range getPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14941,7 +15218,7 @@ func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkAC return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { return } @@ -14951,42 +15228,40 @@ 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 information is not applicable to the rule's protocol. -func (vpc *VpcV1) UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateNetworkACLRuleWithContext(context.Background(), updateNetworkACLRuleOptions) +// 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) { + return vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions") + err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") if err != nil { return } pathParamsMap := map[string]string{ - "network_acl_id": *updateNetworkACLRuleOptions.NetworkACLID, - "id": *updateNetworkACLRuleOptions.ID, + "id": *updatePublicGatewayOptions.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, `/public_gateways/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateNetworkACLRuleOptions.Headers { + for headerName, headerValue := range updatePublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACLRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14996,7 +15271,7 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateNetworkACLRuleOptions.NetworkACLRulePatch) + _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) if err != nil { return } @@ -15012,7 +15287,7 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { return } @@ -15022,18 +15297,16 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet return } -// ListSecurityGroups : List all security groups -// This request lists all 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) { - return vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) +// ListFloatingIps : List all floating IPs +// This request lists all 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) { + return vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) } -// 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") +// 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 { return } @@ -15041,16 +15314,16 @@ 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, `/floating_ips`, nil) if err != nil { return } - for headerName, headerValue := range listSecurityGroupsOptions.Headers { + for headerName, headerValue := range listFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15058,23 +15331,17 @@ 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 listFloatingIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listFloatingIpsOptions.Start)) } - if listSecurityGroupsOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listSecurityGroupsOptions.VPCID)) + if listFloatingIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listFloatingIpsOptions.Limit)) } - if listSecurityGroupsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listSecurityGroupsOptions.VPCCRN)) + if listFloatingIpsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listFloatingIpsOptions.ResourceGroupID)) } - if listSecurityGroupsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listSecurityGroupsOptions.VPCName)) + if listFloatingIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listFloatingIpsOptions.Sort)) } request, err := builder.Build() @@ -15088,7 +15355,7 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) if err != nil { return } @@ -15098,23 +15365,19 @@ 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 network interfaces on instances in that VPC can be added to the -// security group. -func (vpc *VpcV1) CreateSecurityGroup(createSecurityGroupOptions *CreateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { - return vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions) +// 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) { + return vpc.CreateFloatingIPWithContext(context.Background(), createFloatingIPOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createSecurityGroupOptions, "createSecurityGroupOptions") + err = core.ValidateStruct(createFloatingIPOptions, "createFloatingIPOptions") if err != nil { return } @@ -15122,16 +15385,16 @@ 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, `/floating_ips`, nil) if err != nil { return } - for headerName, headerValue := range createSecurityGroupOptions.Headers { + for headerName, headerValue := range createFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15141,20 +15404,7 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createSecurityGroupOptions.VPC != nil { - body["vpc"] = createSecurityGroupOptions.VPC - } - if createSecurityGroupOptions.Name != nil { - body["name"] = createSecurityGroupOptions.Name - } - if createSecurityGroupOptions.ResourceGroup != nil { - body["resource_group"] = createSecurityGroupOptions.ResourceGroup - } - if createSecurityGroupOptions.Rules != nil { - body["rules"] = createSecurityGroupOptions.Rules - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(createFloatingIPOptions.FloatingIPPrototype) if err != nil { return } @@ -15170,7 +15420,7 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { return } @@ -15180,41 +15430,41 @@ 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) { - return vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) +// 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) { + return vpc.DeleteFloatingIPWithContext(context.Background(), deleteFloatingIPOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") + err = core.ValidateStruct(deleteFloatingIPOptions, "deleteFloatingIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteSecurityGroupOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteSecurityGroupOptions.Headers { + for headerName, headerValue := range deleteFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15232,40 +15482,40 @@ 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) { - return vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) +// 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) { + return vpc.GetFloatingIPWithContext(context.Background(), getFloatingIPOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") + err = core.ValidateStruct(getFloatingIPOptions, "getFloatingIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getSecurityGroupOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getSecurityGroupOptions.Headers { + for headerName, headerValue := range getFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15285,7 +15535,7 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { return } @@ -15295,42 +15545,40 @@ 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) { - return vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) +// 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) { + return vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") + err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateSecurityGroupOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateSecurityGroupOptions.Headers { + for headerName, headerValue := range updateFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15340,7 +15588,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(updateFloatingIPOptions.FloatingIPPatch) if err != nil { return } @@ -15356,7 +15604,7 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { return } @@ -15366,42 +15614,34 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu return } -// ListSecurityGroupRules : List all rules in a security group -// This request lists all 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) { - return vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) -} - -// 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 { - return - } - err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") +// ListNetworkAcls : List all network ACLs +// This request lists all 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) { + return vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) +} + +// 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 { 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, `/network_acls`, nil) if err != nil { return } - for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { + for headerName, headerValue := range listNetworkAclsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15409,6 +15649,15 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec 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 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() if err != nil { @@ -15421,7 +15670,7 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection) if err != nil { return } @@ -15431,45 +15680,38 @@ 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) { - return vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) +// 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) { + return vpc.CreateNetworkACLWithContext(context.Background(), createNetworkACLOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") + err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") if err != nil { 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, `/network_acls`, nil) if err != nil { return } - for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range createNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15479,7 +15721,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(createNetworkACLOptions.NetworkACLPrototype) if err != nil { return } @@ -15495,7 +15737,7 @@ func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, create return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) if err != nil { return } @@ -15505,42 +15747,41 @@ 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) { - return vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) +// 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) { + return vpc.DeleteNetworkACLWithContext(context.Background(), deleteNetworkACLOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") + err = core.ValidateStruct(deleteNetworkACLOptions, "deleteNetworkACLOptions") if err != nil { return } pathParamsMap := map[string]string{ - "security_group_id": *deleteSecurityGroupRuleOptions.SecurityGroupID, - "id": *deleteSecurityGroupRuleOptions.ID, + "id": *deleteNetworkACLOptions.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, `/network_acls/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range deleteNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15558,41 +15799,40 @@ 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) { - return vpc.GetSecurityGroupRuleWithContext(context.Background(), getSecurityGroupRuleOptions) +// 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) { + return vpc.GetNetworkACLWithContext(context.Background(), getNetworkACLOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") + err = core.ValidateStruct(getNetworkACLOptions, "getNetworkACLOptions") if err != nil { return } pathParamsMap := map[string]string{ - "security_group_id": *getSecurityGroupRuleOptions.SecurityGroupID, - "id": *getSecurityGroupRuleOptions.ID, + "id": *getNetworkACLOptions.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, `/network_acls/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range getNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15612,7 +15852,7 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) if err != nil { return } @@ -15622,43 +15862,40 @@ 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 information is not applicable to the -// rule's protocol. -func (vpc *VpcV1) UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) +// 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) { + return vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") + err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions") if err != nil { return } pathParamsMap := map[string]string{ - "security_group_id": *updateSecurityGroupRuleOptions.SecurityGroupID, - "id": *updateSecurityGroupRuleOptions.ID, + "id": *updateNetworkACLOptions.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, `/network_acls/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range updateNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15668,7 +15905,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(updateNetworkACLOptions.NetworkACLPatch) if err != nil { return } @@ -15684,7 +15921,7 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) if err != nil { return } @@ -15694,41 +15931,41 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update return } -// ListSecurityGroupTargets : List all targets associated with a security group -// This request lists all 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) { - return vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) +// ListNetworkACLRules : List all rules for a network ACL +// This request lists all 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) { + return vpc.ListNetworkACLRulesWithContext(context.Background(), listNetworkACLRulesOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions") + err = core.ValidateStruct(listNetworkACLRulesOptions, "listNetworkACLRulesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "security_group_id": *listSecurityGroupTargetsOptions.SecurityGroupID, + "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, `/security_groups/{security_group_id}/targets`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers { + for headerName, headerValue := range listNetworkACLRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkACLRules") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15736,11 +15973,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 listNetworkACLRulesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkACLRulesOptions.Start)) } - if listSecurityGroupTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupTargetsOptions.Limit)) + if listNetworkACLRulesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkACLRulesOptions.Limit)) + } + if listNetworkACLRulesOptions.Direction != nil { + builder.AddQuery("direction", fmt.Sprint(*listNetworkACLRulesOptions.Direction)) } request, err := builder.Build() @@ -15754,7 +15994,7 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRuleCollection) if err != nil { return } @@ -15764,51 +16004,111 @@ 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 VPN server identifier -// - An application 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) { - return vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) +// 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) { + return vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") + err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "security_group_id": *deleteSecurityGroupTargetBindingOptions.SecurityGroupID, - "id": *deleteSecurityGroupTargetBindingOptions.ID, + "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *deleteNetworkACLRuleOptions.NetworkACLID, + "id": *deleteNetworkACLRuleOptions.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}/targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { + for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15826,42 +16126,41 @@ func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Contex 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) { - return vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) +// 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) { + return vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") + err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "security_group_id": *getSecurityGroupTargetOptions.SecurityGroupID, - "id": *getSecurityGroupTargetOptions.ID, + "network_acl_id": *getNetworkACLRuleOptions.NetworkACLID, + "id": *getNetworkACLRuleOptions.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}/targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { + for headerName, headerValue := range getNetworkACLRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15881,7 +16180,7 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) if err != nil { return } @@ -15891,58 +16190,56 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu 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 VPN server identifier -// - An application 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) { - return vpc.CreateSecurityGroupTargetBindingWithContext(context.Background(), createSecurityGroupTargetBindingOptions) +// 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 information is not applicable to the rule's protocol. +func (vpc *VpcV1) UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateNetworkACLRuleWithContext(context.Background(), updateNetworkACLRuleOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") + err = core.ValidateStruct(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "security_group_id": *createSecurityGroupTargetBindingOptions.SecurityGroupID, - "id": *createSecurityGroupTargetBindingOptions.ID, + "network_acl_id": *updateNetworkACLRuleOptions.NetworkACLID, + "id": *updateNetworkACLRuleOptions.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, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { + for headerName, headerValue := range updateNetworkACLRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") + 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)) + _, err = builder.SetBodyContentJSON(updateNetworkACLRuleOptions.NetworkACLRulePatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -15954,7 +16251,7 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) if err != nil { return } @@ -15964,15 +16261,18 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex return } -// ListIkePolicies : List all IKE policies -// This request lists all IKE policies in the region. -func (vpc *VpcV1) ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) +// ListSecurityGroups : List all security groups +// This request lists all 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) { + return vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) } -// 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") +// 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 { return } @@ -15980,16 +16280,16 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie 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, `/security_groups`, nil) if err != nil { return } - for headerName, headerValue := range listIkePoliciesOptions.Headers { + for headerName, headerValue := range listSecurityGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15997,11 +16297,23 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie 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 listSecurityGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSecurityGroupsOptions.Start)) } - if listIkePoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listIkePoliciesOptions.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() @@ -16015,7 +16327,7 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) if err != nil { return } @@ -16025,19 +16337,22 @@ 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) { - return vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) +// 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) { + return vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") + err = core.ValidateStruct(createSecurityGroupOptions, "createSecurityGroupOptions") if err != nil { return } @@ -16045,16 +16360,16 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic builder := core.NewRequestBuilder(core.POST) 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, `/security_groups`, nil) if err != nil { return } - for headerName, headerValue := range createIkePolicyOptions.Headers { + for headerName, headerValue := range createSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16065,26 +16380,17 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic 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 createSecurityGroupOptions.VPC != nil { + body["vpc"] = createSecurityGroupOptions.VPC } - if createIkePolicyOptions.KeyLifetime != nil { - body["key_lifetime"] = createIkePolicyOptions.KeyLifetime + if createSecurityGroupOptions.Name != nil { + body["name"] = createSecurityGroupOptions.Name } - if createIkePolicyOptions.Name != nil { - body["name"] = createIkePolicyOptions.Name + if createSecurityGroupOptions.ResourceGroup != nil { + body["resource_group"] = createSecurityGroupOptions.ResourceGroup } - if createIkePolicyOptions.ResourceGroup != nil { - body["resource_group"] = createIkePolicyOptions.ResourceGroup + if createSecurityGroupOptions.Rules != nil { + body["rules"] = createSecurityGroupOptions.Rules } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -16102,7 +16408,7 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { return } @@ -16112,41 +16418,41 @@ 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) { - return vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) +// 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) { + return vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions") + err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteIkePolicyOptions.ID, + "id": *deleteSecurityGroupOptions.ID, } 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, `/security_groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteIkePolicyOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16164,40 +16470,40 @@ func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolic 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) { - return vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) +// 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) { + return vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") + err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getIkePolicyOptions.ID, + "id": *getSecurityGroupOptions.ID, } 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, `/security_groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getIkePolicyOptions.Headers { + for headerName, headerValue := range getSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16217,7 +16523,7 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { return } @@ -16227,40 +16533,42 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio 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) { - return vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) +// 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) { + return vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") + err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateIkePolicyOptions.ID, + "id": *updateSecurityGroupOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) 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, `/security_groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateIkePolicyOptions.Headers { + for headerName, headerValue := range updateSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16270,7 +16578,7 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateIkePolicyOptions.IkePolicyPatch) + _, err = builder.SetBodyContentJSON(updateSecurityGroupOptions.SecurityGroupPatch) if err != nil { return } @@ -16286,7 +16594,7 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { return } @@ -16296,40 +16604,42 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic return } -// ListIkePolicyConnections : List all VPN gateway connections that use a specified IKE policy -// This request lists all VPN gateway connections that use a policy. -func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) +// ListSecurityGroupRules : List all rules in a security group +// This request lists all 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) { + return vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) } -// ListIkePolicyConnectionsWithContext is an alternate form of the ListIkePolicyConnections method which supports a Context parameter -func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions 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 { return } - err = core.ValidateStruct(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") + err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *listIkePolicyConnectionsOptions.ID, + "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, `/ike_policies/{id}/connections`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { + for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16349,7 +16659,7 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) if err != nil { return } @@ -16359,97 +16669,45 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI return } -// ListIpsecPolicies : List all IPsec policies -// This request lists all IPsec policies in the region. -func (vpc *VpcV1) ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) +// 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) { + return vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) } -// 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 { - return - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) - if err != nil { - return - } - - for headerName, headerValue := range listIpsecPoliciesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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() +// 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 { return } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") if err != nil { return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyCollection) - if err != nil { - return - } - response.Result = result - } - - 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) { - return vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) -} -// 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 { - return - } - err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") - if err != nil { - 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, `/ipsec_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createIpsecPolicyOptions.Headers { + for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIpsecPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16459,26 +16717,7 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP 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) + _, err = builder.SetBodyContentJSON(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) if err != nil { return } @@ -16494,7 +16733,7 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { return } @@ -16504,41 +16743,42 @@ 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) { - return vpc.DeleteIpsecPolicyWithContext(context.Background(), deleteIpsecPolicyOptions) +// 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) { + return vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") + err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteIpsecPolicyOptions.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, `/ipsec_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteIpsecPolicyOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16556,40 +16796,41 @@ 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) { - return vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) +// 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) { + return vpc.GetSecurityGroupRuleWithContext(context.Background(), getSecurityGroupRuleOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getIpsecPolicyOptions, "getIpsecPolicyOptions") + err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getIpsecPolicyOptions.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, `/ipsec_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getIpsecPolicyOptions.Headers { + for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16609,7 +16850,7 @@ func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyO return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { return } @@ -16619,40 +16860,43 @@ 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) { - return vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) +// 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 information is not applicable to the +// rule's protocol. +func (vpc *VpcV1) UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") + err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateIpsecPolicyOptions.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, `/ipsec_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateIpsecPolicyOptions.Headers { + for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIpsecPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16662,7 +16906,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(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) if err != nil { return } @@ -16678,7 +16922,7 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { return } @@ -16688,40 +16932,41 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP return } -// ListIpsecPolicyConnections : List all VPN gateway connections that use a specified IPsec policy -// This request lists all VPN gateway connections that use a policy. -func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) +// ListSecurityGroupTargets : List all targets associated with a security group +// This request lists all 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) { + return vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) } -// ListIpsecPolicyConnectionsWithContext is an alternate form of the ListIpsecPolicyConnections method which supports a Context parameter -func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions 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 { return } - err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") + err = core.ValidateStruct(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *listIpsecPolicyConnectionsOptions.ID, + "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, `/ipsec_policies/{id}/connections`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { + for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16729,6 +16974,12 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis 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 listSecurityGroupTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupTargetsOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -16741,7 +16992,7 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) if err != nil { return } @@ -16751,120 +17002,113 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis return } -// ListVPNGateways : List all VPN gateways -// This request lists all VPN gateways in the region. -func (vpc *VpcV1) ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewaysWithContext(context.Background(), listVPNGatewaysOptions) +// 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 +// - An application 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) { + return vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) } -// 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") +// 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 { + return + } + err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "security_group_id": *deleteSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *deleteSecurityGroupTargetBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) 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}/targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVPNGatewaysOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") 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 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 { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) 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) { - return vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) +// 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) { + return vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") + err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "security_group_id": *getSecurityGroupTargetOptions.SecurityGroupID, + "id": *getSecurityGroupTargetOptions.ID, + } + + 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}/targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createVPNGatewayOptions.Headers { + for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") 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(createVPNGatewayOptions.VPNGatewayPrototype) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -16876,7 +17120,7 @@ func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGate return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) if err != nil { return } @@ -16886,45 +17130,55 @@ 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) { - return vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) +// 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 +// - An application 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) { + return vpc.CreateSecurityGroupTargetBindingWithContext(context.Background(), createSecurityGroupTargetBindingOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") + err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteVPNGatewayOptions.ID, + "security_group_id": *createSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *createSecurityGroupTargetBindingOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PUT) 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}/targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteVPNGatewayOptions.Headers { + for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") 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)) @@ -16934,45 +17188,48 @@ func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGate return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + response.Result = result + } 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) { - return vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) +// ListIkePolicies : List all IKE policies +// This request lists all IKE policies in the region. +func (vpc *VpcV1) ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) } -// 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 { - return - } - err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") +// 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 { return } - pathParamsMap := map[string]string{ - "id": *getVPNGatewayOptions.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, `/ike_policies`, nil) if err != nil { return } - for headerName, headerValue := range getVPNGatewayOptions.Headers { + for headerName, headerValue := range listIkePoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16980,6 +17237,12 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt 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)) + } request, err := builder.Build() if err != nil { @@ -16992,7 +17255,7 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) if err != nil { return } @@ -17002,50 +17265,68 @@ 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) { - return vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) +// 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) { + return vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) } -// 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 { +// 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 { return } - err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") + err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *updateVPNGatewayOptions.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_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) if err != nil { return } - for headerName, headerValue := range updateVPNGatewayOptions.Headers { + for headerName, headerValue := range createIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGateway") + 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/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(updateVPNGatewayOptions.VPNGatewayPatch) + 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 { return } @@ -17061,7 +17342,7 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) if err != nil { return } @@ -17071,120 +17352,100 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate return } -// ListVPNGatewayConnections : List all connections of a VPN gateway -// This request lists all connections of a VPN gateway. -func (vpc *VpcV1) ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) +// 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) { + return vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") + err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionsOptions.VPNGatewayID, + "id": *deleteIkePolicyOptions.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_gateways/{vpn_gateway_id}/connections`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { + for headerName, headerValue := range deleteIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") 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 listVPNGatewayConnectionsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) - } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) 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) { - return vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) +// 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) { + return vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") + err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *createVPNGatewayConnectionOptions.VPNGatewayID, + "id": *getIkePolicyOptions.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_gateways/{vpn_gateway_id}/connections`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range getIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") 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 { - return - } - request, err := builder.Build() if err != nil { return @@ -17196,7 +17457,7 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) if err != nil { return } @@ -17206,94 +17467,109 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre 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) { - return vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) +// 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) { + return vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") + err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *deleteVPNGatewayConnectionOptions.VPNGatewayID, - "id": *deleteVPNGatewayConnectionOptions.ID, + "id": *updateIkePolicyOptions.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_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range updateIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") + 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 { + return + } + request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + 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) { - return vpc.GetVPNGatewayConnectionWithContext(context.Background(), getVPNGatewayConnectionOptions) +// ListIkePolicyConnections : List all VPN gateway connections that use a specified IKE policy +// This request lists all VPN gateway connections that use a policy. +func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) } -// 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") +// ListIkePolicyConnectionsWithContext is an alternate form of the ListIkePolicyConnections method which supports a Context parameter +func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") + err = core.ValidateStruct(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *getVPNGatewayConnectionOptions.VPNGatewayID, - "id": *getVPNGatewayConnectionOptions.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}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}/connections`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17313,7 +17589,7 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) if err != nil { return } @@ -17323,53 +17599,44 @@ 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) { - return vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) +// ListIpsecPolicies : List all IPsec policies +// This request lists all IPsec policies in the region. +func (vpc *VpcV1) ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) } -// 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 { - return - } - err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") +// 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 { 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, `/ipsec_policies`, nil) if err != nil { return } - for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range listIpsecPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies") 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 { - return + 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() @@ -17383,7 +17650,7 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyCollection) if err != nil { return } @@ -17393,51 +17660,69 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd return } -// ListVPNGatewayConnectionLocalCIDRs : List all local CIDRs for a VPN gateway connection -// This request lists all local CIDRs for a VPN gateway connection. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionLocalCIDRsOptions) +// 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) { + return vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) } -// ListVPNGatewayConnectionLocalCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionLocalCIDRs method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions 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 { return } - err = core.ValidateStruct(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions") + err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionLocalCIDRsOptions.VPNGatewayID, - "id": *listVPNGatewayConnectionLocalCIDRsOptions.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, `/ipsec_policies`, nil) if err != nil { return } - for headerName, headerValue := range listVPNGatewayConnectionLocalCIDRsOptions.Headers { + for headerName, headerValue := range createIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionLocalCIDRs") + 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 { + return + } + request, err := builder.Build() if err != nil { return @@ -17449,7 +17734,7 @@ func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Cont return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionLocalCIDRs) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) if err != nil { return } @@ -17459,45 +17744,41 @@ func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Cont return } -// RemoveVPNGatewayConnectionLocalCIDR : 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) RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveVPNGatewayConnectionLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionLocalCIDROptions) +// 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) { + return vpc.DeleteIpsecPolicyWithContext(context.Background(), deleteIpsecPolicyOptions) } -// RemoveVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionLocalCIDR method which supports a Context parameter -func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions 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 { return } - err = core.ValidateStruct(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions") + err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *removeVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, - "id": *removeVPNGatewayConnectionLocalCIDROptions.ID, - "cidr_prefix": *removeVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, - "prefix_length": *removeVPNGatewayConnectionLocalCIDROptions.PrefixLength, + "id": *deleteIpsecPolicyOptions.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_prefix}/{prefix_length}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range removeVPNGatewayConnectionLocalCIDROptions.Headers { + for headerName, headerValue := range deleteIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionLocalCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17515,48 +17796,44 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Con return } -// CheckVPNGatewayConnectionLocalCIDR : 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) CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.CheckVPNGatewayConnectionLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionLocalCIDROptions) +// 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) { + return vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) } -// CheckVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionLocalCIDR method which supports a Context parameter -func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions cannot be nil") +// 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 { return } - err = core.ValidateStruct(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions") + err = core.ValidateStruct(getIpsecPolicyOptions, "getIpsecPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *checkVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, - "id": *checkVPNGatewayConnectionLocalCIDROptions.ID, - "cidr_prefix": *checkVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, - "prefix_length": *checkVPNGatewayConnectionLocalCIDROptions.PrefixLength, + "id": *getIpsecPolicyOptions.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_prefix}/{prefix_length}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range checkVPNGatewayConnectionLocalCIDROptions.Headers { + for headerName, headerValue := range getIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionLocalCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") 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)) @@ -17566,105 +17843,125 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Cont return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result + } return } -// AddVPNGatewayConnectionLocalCIDR : 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) AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.AddVPNGatewayConnectionLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionLocalCIDROptions) +// 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) { + return vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) } -// AddVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the AddVPNGatewayConnectionLocalCIDR method which supports a Context parameter -func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions 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 { return } - err = core.ValidateStruct(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions") + err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *addVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, - "id": *addVPNGatewayConnectionLocalCIDROptions.ID, - "cidr_prefix": *addVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, - "prefix_length": *addVPNGatewayConnectionLocalCIDROptions.PrefixLength, + "id": *updateIpsecPolicyOptions.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_prefix}/{prefix_length}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range addVPNGatewayConnectionLocalCIDROptions.Headers { + for headerName, headerValue := range updateIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionLocalCIDR") + 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/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result + } return } -// ListVPNGatewayConnectionPeerCIDRs : List all peer CIDRs for a VPN gateway connection -// This request lists all peer CIDRs for a VPN gateway connection. -// -// This request is only supported for policy mode VPN gateways. -func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionPeerCIDRsOptions) +// ListIpsecPolicyConnections : List all VPN gateway connections that use a specified IPsec policy +// This request lists all VPN gateway connections that use a policy. +func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) } -// ListVPNGatewayConnectionPeerCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionPeerCIDRs method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions 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 *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions") + err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionPeerCIDRsOptions.VPNGatewayID, - "id": *listVPNGatewayConnectionPeerCIDRsOptions.ID, + "id": *listIpsecPolicyConnectionsOptions.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, `/ipsec_policies/{id}/connections`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVPNGatewayConnectionPeerCIDRsOptions.Headers { + for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionPeerCIDRs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17684,7 +17981,7 @@ func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Conte return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionPeerCIDRs) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) if err != nil { return } @@ -17694,158 +17991,177 @@ func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Conte return } -// RemoveVPNGatewayConnectionPeerCIDR : 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) RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveVPNGatewayConnectionPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionPeerCIDROptions) +// ListVPNGateways : List all VPN gateways +// This request lists all VPN gateways in the region. +func (vpc *VpcV1) ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewaysWithContext(context.Background(), listVPNGatewaysOptions) } -// RemoveVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions") +// 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 { return } - pathParamsMap := map[string]string{ - "vpn_gateway_id": *removeVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, - "id": *removeVPNGatewayConnectionPeerCIDROptions.ID, - "cidr_prefix": *removeVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, - "prefix_length": *removeVPNGatewayConnectionPeerCIDROptions.PrefixLength, - } - - 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_prefix}/{prefix_length}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) if err != nil { return } - for headerName, headerValue := range removeVPNGatewayConnectionPeerCIDROptions.Headers { + for headerName, headerValue := range listVPNGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionPeerCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") 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 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 { return } - response, err = vpc.Service.Request(request, nil) - - return -} - -// CheckVPNGatewayConnectionPeerCIDR : 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) CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.CheckVPNGatewayConnectionPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionPeerCIDROptions) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) + if err != nil { + return + } + response.Result = result + } + + return } -// CheckVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions cannot be nil") +// 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) { + return vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) +} + +// 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 { return } - err = core.ValidateStruct(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions") + err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "vpn_gateway_id": *checkVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, - "id": *checkVPNGatewayConnectionPeerCIDROptions.ID, - "cidr_prefix": *checkVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, - "prefix_length": *checkVPNGatewayConnectionPeerCIDROptions.PrefixLength, - } - - 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_prefix}/{prefix_length}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) if err != nil { return } - for headerName, headerValue := range checkVPNGatewayConnectionPeerCIDROptions.Headers { + for headerName, headerValue := range createVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionPeerCIDR") + 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/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + return + } + response.Result = result + } return } -// AddVPNGatewayConnectionPeerCIDR : 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) AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.AddVPNGatewayConnectionPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionPeerCIDROptions) +// 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) { + return vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) } -// AddVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the AddVPNGatewayConnectionPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions 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 { return } - err = core.ValidateStruct(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions") + err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *addVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, - "id": *addVPNGatewayConnectionPeerCIDROptions.ID, - "cidr_prefix": *addVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, - "prefix_length": *addVPNGatewayConnectionPeerCIDROptions.PrefixLength, + "id": *deleteVPNGatewayOptions.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_prefix}/{prefix_length}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range addVPNGatewayConnectionPeerCIDROptions.Headers { + for headerName, headerValue := range deleteVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionPeerCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17863,32 +18179,40 @@ func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context return } -// ListVPNServers : List all VPN servers -// This request lists all VPN servers. -func (vpc *VpcV1) ListVPNServers(listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) +// 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) { + return vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) } -// 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") +// 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 { + return + } + err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "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`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVPNServersOptions.Headers { + for headerName, headerValue := range getVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17896,21 +18220,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 { @@ -17923,7 +18232,7 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) if err != nil { return } @@ -17933,83 +18242,50 @@ 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) { - return vpc.CreateVPNServerWithContext(context.Background(), createVPNServerOptions) +// 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) { + return vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions") + err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *updateVPNGatewayOptions.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, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createVPNServerOptions.Headers { + for headerName, headerValue := range updateVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") + 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/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(updateVPNGatewayOptions.VPNGatewayPatch) if err != nil { return } @@ -18025,7 +18301,7 @@ func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServe return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) if err != nil { return } @@ -18035,94 +18311,40 @@ 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) { - return vpc.DeleteVPNServerWithContext(context.Background(), deleteVPNServerOptions) -} - -// 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 { - return - } - err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteVPNServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range deleteVPNServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - 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) { - return vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) +// ListVPNGatewayConnections : List all connections of a VPN gateway +// This request lists all connections of a VPN gateway. +func (vpc *VpcV1) ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getVPNServerOptions, "getVPNServerOptions") + err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getVPNServerOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPNServerOptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -18130,6 +18352,9 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPNGatewayConnectionsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) + } request, err := builder.Build() if err != nil { @@ -18142,7 +18367,7 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) if err != nil { return } @@ -18152,54 +18377,50 @@ 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 property changes will cause all connected VPN -// clients are disconnected from this VPN server except for the name change. -func (vpc *VpcV1) UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - return vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) +// 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) { + return vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") + err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateVPNServerOptions.ID, + "vpn_gateway_id": *createVPNGatewayConnectionOptions.VPNGatewayID, } - 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/{vpn_gateway_id}/connections`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateVPNServerOptions.Headers { + for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServer") + 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/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(createVPNGatewayConnectionOptions.VPNGatewayConnectionPrototype) if err != nil { return } @@ -18215,7 +18436,7 @@ func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServe return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) if err != nil { return } @@ -18225,45 +18446,45 @@ 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) { - return vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) +// 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) { + return vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") + err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getVPNServerClientConfigurationOptions.ID, + "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/{id}/client_configuration`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { + for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") 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)) @@ -18273,46 +18494,46 @@ func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context return } - response, err = vpc.Service.Request(request, &result) + response, err = vpc.Service.Request(request, nil) return } -// ListVPNServerClients : List all VPN clients for a VPN server -// This request retrieves all 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) { - return vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) +// 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) { + return vpc.GetVPNGatewayConnectionWithContext(context.Background(), getVPNGatewayConnectionOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") + err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *listVPNServerClientsOptions.VPNServerID, + "vpn_gateway_id": *getVPNGatewayConnectionOptions.VPNGatewayID, + "id": *getVPNGatewayConnectionOptions.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/{vpn_gateway_id}/connections/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVPNServerClientsOptions.Headers { + for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -18320,15 +18541,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 { @@ -18341,7 +18553,7 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) if err != nil { return } @@ -18351,95 +18563,113 @@ 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) { - return vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) +// 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) { + return vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions") + err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *deleteVPNServerClientOptions.VPNServerID, - "id": *deleteVPNServerClientOptions.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}/clients/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteVPNServerClientOptions.Headers { + for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") + 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)) + _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + 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) { - return vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) +// ListVPNGatewayConnectionLocalCIDRs : List all local CIDRs for a VPN gateway connection +// This request lists all local CIDRs for a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionLocalCIDRsOptions) } -// 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") +// ListVPNGatewayConnectionLocalCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionLocalCIDRs method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") + err = core.ValidateStruct(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *getVPNServerClientOptions.VPNServerID, - "id": *getVPNServerClientOptions.ID, + "vpn_gateway_id": *listVPNGatewayConnectionLocalCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionLocalCIDRsOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPNServerClientOptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionLocalCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionLocalCIDRs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -18459,7 +18689,7 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionLocalCIDRs) if err != nil { return } @@ -18469,43 +18699,45 @@ 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) { - return vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) +// RemoveVPNGatewayConnectionLocalCIDR : 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) RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveVPNGatewayConnectionLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionLocalCIDROptions) } -// 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") +// RemoveVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions") + err = core.ValidateStruct(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *disconnectVPNClientOptions.VPNServerID, - "id": *disconnectVPNClientOptions.ID, + "vpn_gateway_id": *removeVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, + "id": *removeVPNGatewayConnectionLocalCIDROptions.ID, + "cidr_prefix": *removeVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, + "prefix_length": *removeVPNGatewayConnectionLocalCIDROptions.PrefixLength, } - 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_servers/{vpn_server_id}/clients/{id}/disconnect`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range disconnectVPNClientOptions.Headers { + for headerName, headerValue := range removeVPNGatewayConnectionLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionLocalCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -18523,197 +18755,102 @@ func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnect return } -// ListVPNServerRoutes : List all VPN routes for a VPN server -// This request lists all 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) { - return vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) +// CheckVPNGatewayConnectionLocalCIDR : 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) CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.CheckVPNGatewayConnectionLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionLocalCIDROptions) } -// 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") +// CheckVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") + err = core.ValidateStruct(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *listVPNServerRoutesOptions.VPNServerID, + "vpn_gateway_id": *checkVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, + "id": *checkVPNGatewayConnectionLocalCIDROptions.ID, + "cidr_prefix": *checkVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, + "prefix_length": *checkVPNGatewayConnectionLocalCIDROptions.PrefixLength, } 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) - if err != nil { - return - } - - for headerName, headerValue := range listVPNServerRoutesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") - 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 { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRouteCollection) - if err != nil { - 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. destination of the -// packet. -func (vpc *VpcV1) CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - return vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) -} - -// 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 { - return - } - err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "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, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createVPNServerRouteOptions.Headers { + for headerName, headerValue := range checkVPNGatewayConnectionLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionLocalCIDR") 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 { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) 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) { - return vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) +// AddVPNGatewayConnectionLocalCIDR : 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) AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.AddVPNGatewayConnectionLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionLocalCIDROptions) } -// 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") +// AddVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the AddVPNGatewayConnectionLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") + err = core.ValidateStruct(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *deleteVPNServerRouteOptions.VPNServerID, - "id": *deleteVPNServerRouteOptions.ID, + "vpn_gateway_id": *addVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionLocalCIDROptions.ID, + "cidr_prefix": *addVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, + "prefix_length": *addVPNGatewayConnectionLocalCIDROptions.PrefixLength, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PUT) 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/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { + for headerName, headerValue := range addVPNGatewayConnectionLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionLocalCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -18731,41 +18868,43 @@ func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPN 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) { - return vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions) +// ListVPNGatewayConnectionPeerCIDRs : List all peer CIDRs for a VPN gateway connection +// This request lists all peer CIDRs for a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. +func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionPeerCIDRsOptions) } -// 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") +// ListVPNGatewayConnectionPeerCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionPeerCIDRs method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVPNServerRouteOptions, "getVPNServerRouteOptions") + err = core.ValidateStruct(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *getVPNServerRouteOptions.VPNServerID, - "id": *getVPNServerRouteOptions.ID, + "vpn_gateway_id": *listVPNGatewayConnectionPeerCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionPeerCIDRsOptions.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.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVPNServerRouteOptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionPeerCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionPeerCIDRs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -18785,7 +18924,7 @@ func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServer return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionPeerCIDRs) if err != nil { return } @@ -18795,177 +18934,161 @@ 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) { - return vpc.UpdateVPNServerRouteWithContext(context.Background(), updateVPNServerRouteOptions) +// RemoveVPNGatewayConnectionPeerCIDR : 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) RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveVPNGatewayConnectionPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionPeerCIDROptions) } -// 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") +// RemoveVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") + err = core.ValidateStruct(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions") if err != nil { return } pathParamsMap := map[string]string{ - "vpn_server_id": *updateVPNServerRouteOptions.VPNServerID, - "id": *updateVPNServerRouteOptions.ID, + "vpn_gateway_id": *removeVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *removeVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *removeVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *removeVPNGatewayConnectionPeerCIDROptions.PrefixLength, } - builder := core.NewRequestBuilder(core.PATCH) + 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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateVPNServerRouteOptions.Headers { + for headerName, headerValue := range removeVPNGatewayConnectionPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionPeerCIDR") 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 { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListLoadBalancerProfiles : List all load balancer profiles -// This request lists all 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) { - return vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) +// CheckVPNGatewayConnectionPeerCIDR : 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) CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.CheckVPNGatewayConnectionPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionPeerCIDROptions) } -// 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") +// CheckVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions") if err != nil { return } + pathParamsMap := map[string]string{ + "vpn_gateway_id": *checkVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *checkVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *checkVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *checkVPNGatewayConnectionPeerCIDROptions.PrefixLength, + } + builder := core.NewRequestBuilder(core.GET) 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}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { + for headerName, headerValue := range checkVPNGatewayConnectionPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionPeerCIDR") 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 { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfileCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) 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) { - return vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) +// AddVPNGatewayConnectionPeerCIDR : 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) AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.AddVPNGatewayConnectionPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionPeerCIDROptions) } -// 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") +// AddVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the AddVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") + err = core.ValidateStruct(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions") if err != nil { return } pathParamsMap := map[string]string{ - "name": *getLoadBalancerProfileOptions.Name, + "vpn_gateway_id": *addVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *addVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *addVPNGatewayConnectionPeerCIDROptions.PrefixLength, } - 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, `/load_balancer/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { + for headerName, headerValue := range addVPNGatewayConnectionPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionPeerCIDR") 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)) @@ -18975,31 +19098,20 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListLoadBalancers : List all load balancers -// This request lists all load balancers in the region. -func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) +// ListVPNServers : List all VPN servers +// This request lists all VPN servers. +func (vpc *VpcV1) ListVPNServers(listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) } -// 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") +// 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 { return } @@ -19007,16 +19119,16 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala 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_servers`, nil) if err != nil { return } - for headerName, headerValue := range listLoadBalancersOptions.Headers { + for headerName, headerValue := range listVPNServersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19024,11 +19136,20 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala 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 listVPNServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name)) } - if listLoadBalancersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listLoadBalancersOptions.Limit)) + 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() @@ -19042,7 +19163,7 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) if err != nil { return } @@ -19052,19 +19173,19 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala 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) { - return vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) +// 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) { + return vpc.CreateVPNServerWithContext(context.Background(), createVPNServerOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions") + err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions") if err != nil { return } @@ -19072,16 +19193,16 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB builder := core.NewRequestBuilder(core.POST) 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_servers`, nil) if err != nil { return } - for headerName, headerValue := range createLoadBalancerOptions.Headers { + for headerName, headerValue := range createVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19092,41 +19213,41 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) - if createLoadBalancerOptions.IsPublic != nil { - body["is_public"] = createLoadBalancerOptions.IsPublic + if createVPNServerOptions.Certificate != nil { + body["certificate"] = createVPNServerOptions.Certificate } - if createLoadBalancerOptions.Subnets != nil { - body["subnets"] = createLoadBalancerOptions.Subnets + if createVPNServerOptions.ClientAuthentication != nil { + body["client_authentication"] = createVPNServerOptions.ClientAuthentication } - if createLoadBalancerOptions.Datapath != nil { - body["datapath"] = createLoadBalancerOptions.Datapath + if createVPNServerOptions.ClientIPPool != nil { + body["client_ip_pool"] = createVPNServerOptions.ClientIPPool } - if createLoadBalancerOptions.Dns != nil { - body["dns"] = createLoadBalancerOptions.Dns + if createVPNServerOptions.Subnets != nil { + body["subnets"] = createVPNServerOptions.Subnets } - if createLoadBalancerOptions.Listeners != nil { - body["listeners"] = createLoadBalancerOptions.Listeners + if createVPNServerOptions.ClientDnsServerIps != nil { + body["client_dns_server_ips"] = createVPNServerOptions.ClientDnsServerIps } - if createLoadBalancerOptions.Logging != nil { - body["logging"] = createLoadBalancerOptions.Logging + if createVPNServerOptions.ClientIdleTimeout != nil { + body["client_idle_timeout"] = createVPNServerOptions.ClientIdleTimeout } - if createLoadBalancerOptions.Name != nil { - body["name"] = createLoadBalancerOptions.Name + if createVPNServerOptions.EnableSplitTunneling != nil { + body["enable_split_tunneling"] = createVPNServerOptions.EnableSplitTunneling } - if createLoadBalancerOptions.Pools != nil { - body["pools"] = createLoadBalancerOptions.Pools + if createVPNServerOptions.Name != nil { + body["name"] = createVPNServerOptions.Name } - if createLoadBalancerOptions.Profile != nil { - body["profile"] = createLoadBalancerOptions.Profile + if createVPNServerOptions.Port != nil { + body["port"] = createVPNServerOptions.Port } - if createLoadBalancerOptions.ResourceGroup != nil { - body["resource_group"] = createLoadBalancerOptions.ResourceGroup + if createVPNServerOptions.Protocol != nil { + body["protocol"] = createVPNServerOptions.Protocol } - if createLoadBalancerOptions.RouteMode != nil { - body["route_mode"] = createLoadBalancerOptions.RouteMode + if createVPNServerOptions.ResourceGroup != nil { + body["resource_group"] = createVPNServerOptions.ResourceGroup } - if createLoadBalancerOptions.SecurityGroups != nil { - body["security_groups"] = createLoadBalancerOptions.SecurityGroups + if createVPNServerOptions.SecurityGroups != nil { + body["security_groups"] = createVPNServerOptions.SecurityGroups } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -19144,7 +19265,7 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { return } @@ -19154,46 +19275,45 @@ 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`. -func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) +// 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) { + return vpc.DeleteVPNServerWithContext(context.Background(), deleteVPNServerOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") + err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteLoadBalancerOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerOptions.Headers { + for headerName, headerValue := range deleteVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteLoadBalancerOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteLoadBalancerOptions.IfMatch)) + if deleteVPNServerOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPNServerOptions.IfMatch)) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) @@ -19209,40 +19329,40 @@ 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) { - return vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) +// 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) { + return vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) } -// 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 { - 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 { + return } - err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") + err = core.ValidateStruct(getVPNServerOptions, "getVPNServerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getLoadBalancerOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerOptions.Headers { + for headerName, headerValue := range getVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19262,7 +19382,7 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { return } @@ -19272,55 +19392,54 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance 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) { - return vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) +// UpdateVPNServer : Update a VPN server +// This request updates the properties of an existing VPN server. Any property changes will cause all connected VPN +// clients are disconnected from this VPN server except for the name change. +func (vpc *VpcV1) UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + return vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") + err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateLoadBalancerOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerOptions.Headers { + for headerName, headerValue := range updateVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer") + 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 updateLoadBalancerOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateLoadBalancerOptions.IfMatch)) + 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(updateLoadBalancerOptions.LoadBalancerPatch) + _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) if err != nil { return } @@ -19336,7 +19455,7 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { return } @@ -19346,44 +19465,45 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB return } -// GetLoadBalancerStatistics : List all 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) { - return vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) +// 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) { + return vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") + err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getLoadBalancerStatisticsOptions.ID, + "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/{id}/statistics`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}/client_configuration`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { + for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") + 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)) @@ -19393,165 +19513,61 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerStatistics) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, &result) return } -// ListLoadBalancerListeners : List all listeners for a load balancer -// This request lists all listeners for a load balancer. -func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) +// ListVPNServerClients : List all VPN clients for a VPN server +// This request retrieves all 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) { + return vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") + err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, + "vpn_server_id": *listVPNServerClientsOptions.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`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") - 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 { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) - if err != nil { - return - } - response.Result = result - } - - 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) { - return vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) -} - -// 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 { - return - } - err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") - if err != nil { - 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/{vpn_server_id}/clients`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range listVPNServerClientsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") + 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 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 listVPNServerClientsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServerClientsOptions.Start)) } - if createLoadBalancerListenerOptions.PortMin != nil { - body["port_min"] = createLoadBalancerListenerOptions.PortMin + if listVPNServerClientsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServerClientsOptions.Limit)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return + if listVPNServerClientsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNServerClientsOptions.Sort)) } request, err := builder.Build() @@ -19565,7 +19581,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) if err != nil { return } @@ -19575,42 +19591,43 @@ 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) { - return vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) +// 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) { + return vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") + err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerListenerOptions.LoadBalancerID, - "id": *deleteLoadBalancerListenerOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range deleteVPNServerClientOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19628,41 +19645,41 @@ 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) { - return vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) +// 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) { + return vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") + err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerOptions.LoadBalancerID, - "id": *getLoadBalancerListenerOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range getVPNServerClientOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19682,7 +19699,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) if err != nil { return } @@ -19692,111 +19709,96 @@ 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) { - return vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) +// 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) { + return vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") + err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerOptions.LoadBalancerID, - "id": *updateLoadBalancerListenerOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}/disconnect`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range disconnectVPNClientOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") + 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(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListLoadBalancerListenerPolicies : List all policies for a load balancer listener -// This request lists all policies for a load balancer listener. -func (vpc *VpcV1) ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) +// ListVPNServerRoutes : List all VPN routes for a VPN server +// This request lists all 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) { + return vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") + err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenerPoliciesOptions.LoadBalancerID, - "listener_id": *listLoadBalancerListenerPoliciesOptions.ListenerID, + "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`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { + for headerName, headerValue := range listVPNServerRoutesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19804,6 +19806,15 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex 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 { @@ -19816,7 +19827,7 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRouteCollection) if err != nil { return } @@ -19826,41 +19837,43 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex return } -// CreateLoadBalancerListenerPolicy : Create a policy for a load balancer listener -// Creates a new policy for a load balancer listener. -func (vpc *VpcV1) CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) +// 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. destination of the +// packet. +func (vpc *VpcV1) CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + return vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *createLoadBalancerListenerPolicyOptions.ListenerID, + "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`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range createVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19871,20 +19884,14 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex 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 createVPNServerRouteOptions.Destination != nil { + body["destination"] = createVPNServerRouteOptions.Destination } - if createLoadBalancerListenerPolicyOptions.Rules != nil { - body["rules"] = createLoadBalancerListenerPolicyOptions.Rules + if createVPNServerRouteOptions.Action != nil { + body["action"] = createVPNServerRouteOptions.Action } - if createLoadBalancerListenerPolicyOptions.Target != nil { - body["target"] = createLoadBalancerListenerPolicyOptions.Target + if createVPNServerRouteOptions.Name != nil { + body["name"] = createVPNServerRouteOptions.Name } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -19902,7 +19909,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { return } @@ -19912,42 +19919,41 @@ 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) { - return vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) +// 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) { + return vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *deleteLoadBalancerListenerPolicyOptions.ListenerID, - "id": *deleteLoadBalancerListenerPolicyOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19965,42 +19971,41 @@ 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) { - return vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) +// 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) { + return vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(getVPNServerRouteOptions, "getVPNServerRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, - "id": *getLoadBalancerListenerPolicyOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range getVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -20020,7 +20025,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { return } @@ -20030,42 +20035,42 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, return } -// UpdateLoadBalancerListenerPolicy : Update a load balancer listener policy -// Updates a policy from a policy patch. -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) +// 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) { + return vpc.UpdateVPNServerRouteWithContext(context.Background(), updateVPNServerRouteOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, - "id": *updateLoadBalancerListenerPolicyOptions.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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range updateVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -20075,7 +20080,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) + _, err = builder.SetBodyContentJSON(updateVPNServerRouteOptions.VPNServerRoutePatch) if err != nil { return } @@ -20091,7 +20096,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { return } @@ -20101,42 +20106,33 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex return } -// ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy -// This request lists all rules of a load balancer listener policy. -func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) -} - -// 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 { - return - } - err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") +// ListLoadBalancerProfiles : List all load balancer profiles +// This request lists all 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) { + return vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) +} + +// 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 { return } - pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, - "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, - "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, - } - 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, `/load_balancer/profiles`, nil) if err != nil { return } - for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { + for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -20144,6 +20140,12 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con 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 { @@ -20156,7 +20158,7 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfileCollection) if err != nil { return } @@ -20166,69 +20168,48 @@ 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) { - return vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) +// 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) { + return vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, + "name": *getLoadBalancerProfileOptions.Name, } - 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/{policy_id}/rules`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles/{name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") 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 { - return - } - request, err := builder.Build() if err != nil { return @@ -20240,7 +20221,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile) if err != nil { return } @@ -20250,105 +20231,148 @@ 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) { - return vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) +// ListLoadBalancers : List all load balancers +// This request lists all load balancers in the region. +func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) } -// 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 { - return - } - err = core.ValidateStruct(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") +// 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 { 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 := 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, `/load_balancers`, nil) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range listLoadBalancersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") + 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 { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerCollection) + if err != nil { + return + } + response.Result = result + } 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) { - return vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) +// 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) { + return vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *getLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *getLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *getLoadBalancerListenerPolicyRuleOptions.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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) if err != nil { return } - for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range createLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") 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.Datapath != nil { + body["datapath"] = createLoadBalancerOptions.Datapath + } + if createLoadBalancerOptions.Dns != nil { + body["dns"] = createLoadBalancerOptions.Dns + } + 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 { + return + } + request, err := builder.Build() if err != nil { return @@ -20360,7 +20384,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) if err != nil { return } @@ -20370,112 +20394,95 @@ 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) { - return vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) +// 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`. +func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *updateLoadBalancerListenerPolicyRuleOptions.ID, + "id": *deleteLoadBalancerOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + 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, `/load_balancers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") + 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)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListLoadBalancerPools : List all pools of a load balancer -// This request lists all pools of a load balancer. -func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) +// 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) { + return vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") + err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerPoolsOptions.LoadBalancerID, + "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`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { + for headerName, headerValue := range getLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -20495,7 +20502,7 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) if err != nil { return } @@ -20505,72 +20512,55 @@ 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) { - return vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) +// 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) { + return vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") + err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerPoolOptions.LoadBalancerID, + "id": *updateLoadBalancerOptions.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, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range updateLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") + 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/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)) - body := make(map[string]interface{}) - if createLoadBalancerPoolOptions.Algorithm != nil { - body["algorithm"] = createLoadBalancerPoolOptions.Algorithm - } - if createLoadBalancerPoolOptions.HealthMonitor != nil { - body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor - } - if createLoadBalancerPoolOptions.Protocol != nil { - body["protocol"] = createLoadBalancerPoolOptions.Protocol - } - if createLoadBalancerPoolOptions.Members != nil { - body["members"] = createLoadBalancerPoolOptions.Members - } - 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) + _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) if err != nil { return } @@ -20586,7 +20576,7 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) if err != nil { return } @@ -20596,45 +20586,44 @@ 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) { - return vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) +// GetLoadBalancerStatistics : List all 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) { + return vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") + err = core.ValidateStruct(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerPoolOptions.LoadBalancerID, - "id": *deleteLoadBalancerPoolOptions.ID, + "id": *getLoadBalancerStatisticsOptions.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, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}/statistics`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") 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)) @@ -20644,46 +20633,56 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteL return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerStatistics) + if err != nil { + return + } + response.Result = result + } 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) { - return vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) +// ListLoadBalancerListeners : List all listeners for a load balancer +// This request lists all listeners for a load balancer. +func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") + err = core.ValidateStruct(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerPoolOptions.LoadBalancerID, - "id": *getLoadBalancerPoolOptions.ID, + "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, } 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/{load_balancer_id}/listeners`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -20703,7 +20702,7 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) if err != nil { return } @@ -20713,51 +20712,84 @@ 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) { - return vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) +// 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) { + return vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") + err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerPoolOptions.LoadBalancerID, - "id": *updateLoadBalancerPoolOptions.ID, + "load_balancer_id": *createLoadBalancerListenerOptions.LoadBalancerID, } - 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}/pools/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") 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(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) + body := make(map[string]interface{}) + 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 { return } @@ -20773,7 +20805,7 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { return } @@ -20783,45 +20815,45 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL return } -// ListLoadBalancerPoolMembers : List all members of a load balancer pool -// This request lists all members of a load balancer pool. -func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) +// 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) { + return vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") + err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerPoolMembersOptions.LoadBalancerID, - "pool_id": *listLoadBalancerPoolMembersOptions.PoolID, + "load_balancer_id": *deleteLoadBalancerListenerOptions.LoadBalancerID, + "id": *deleteLoadBalancerListenerOptions.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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") 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)) @@ -20831,81 +20863,54 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) 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) { - return vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) +// 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) { + return vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, + "load_balancer_id": *getLoadBalancerListenerOptions.LoadBalancerID, + "id": *getLoadBalancerListenerOptions.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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") 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 { - return - } - request, err := builder.Build() if err != nil { return @@ -20917,7 +20922,7 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { return } @@ -20927,56 +20932,51 @@ 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) { - return vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) +// 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) { + return vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") + err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *replaceLoadBalancerPoolMembersOptions.LoadBalancerID, - "pool_id": *replaceLoadBalancerPoolMembersOptions.PoolID, + "load_balancer_id": *updateLoadBalancerListenerOptions.LoadBalancerID, + "id": *updateLoadBalancerListenerOptions.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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") 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 replaceLoadBalancerPoolMembersOptions.Members != nil { - body["members"] = replaceLoadBalancerPoolMembersOptions.Members - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) if err != nil { return } @@ -20992,7 +20992,7 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { return } @@ -21002,45 +21002,45 @@ 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) { - return vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) +// ListLoadBalancerListenerPolicies : List all policies for a load balancer listener +// This request lists all policies for a load balancer listener. +func (vpc *VpcV1) ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *deleteLoadBalancerPoolMemberOptions.PoolID, - "id": *deleteLoadBalancerPoolMemberOptions.ID, + "load_balancer_id": *listLoadBalancerListenerPoliciesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPoliciesOptions.ListenerID, } - 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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") 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)) @@ -21050,55 +21050,87 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, d return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyCollection) + if err != nil { + return + } + response.Result = result + } 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) { - return vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) +// CreateLoadBalancerListenerPolicy : Create a policy for a load balancer listener +// Creates a new policy for a load balancer listener. +func (vpc *VpcV1) CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *getLoadBalancerPoolMemberOptions.PoolID, - "id": *getLoadBalancerPoolMemberOptions.ID, + "load_balancer_id": *createLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyOptions.ListenerID, } - 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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") 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 createLoadBalancerListenerPolicyOptions.Target != nil { + body["target"] = createLoadBalancerListenerPolicyOptions.Target + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -21110,7 +21142,7 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) if err != nil { return } @@ -21120,56 +21152,103 @@ 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) { - return vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) +// 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) { + return vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *updateLoadBalancerPoolMemberOptions.PoolID, - "id": *updateLoadBalancerPoolMemberOptions.ID, + "load_balancer_id": *deleteLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *deleteLoadBalancerListenerPolicyOptions.ListenerID, + "id": *deleteLoadBalancerListenerPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + 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/{listener_id}/policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") 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(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, + "id": *getLoadBalancerListenerPolicyOptions.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) if err != nil { return } + for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + request, err := builder.Build() if err != nil { return @@ -21181,7 +21260,7 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) if err != nil { return } @@ -21191,51 +21270,54 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u return } -// ListEndpointGateways : List all endpoint gateways -// This request lists all 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) { - return vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) +// UpdateLoadBalancerListenerPolicy : Update a load balancer listener policy +// Updates a policy from a policy patch. +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) } -// 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") +// 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 { + return + } + err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, + "id": *updateLoadBalancerListenerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) 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/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listEndpointGatewaysOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") + 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)) - 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)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) + if err != nil { + return } request, err := builder.Build() @@ -21249,7 +21331,7 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) if err != nil { return } @@ -21259,70 +21341,50 @@ 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) { - return vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) +// ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy +// This request lists all rules of a load balancer listener policy. +func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") + err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, + "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, + } + + 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/{policy_id}/rules`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createEndpointGatewayOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") 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 createEndpointGatewayOptions.Target != nil { - body["target"] = createEndpointGatewayOptions.Target - } - if createEndpointGatewayOptions.VPC != nil { - body["vpc"] = createEndpointGatewayOptions.VPC - } - 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 { - return - } - request, err := builder.Build() if err != nil { return @@ -21334,7 +21396,7 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) if err != nil { return } @@ -21344,55 +21406,67 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn return } -// ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway -// This request lists all reserved IPs bound to an endpoint gateway. -func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { - return vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) +// 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) { + return vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") + err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, + "load_balancer_id": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, } - 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, `/endpoint_gateways/{endpoint_gateway_id}/ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") + 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)) - if listEndpointGatewayIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listEndpointGatewayIpsOptions.Start)) + + body := make(map[string]interface{}) + if createLoadBalancerListenerPolicyRuleOptions.Condition != nil { + body["condition"] = createLoadBalancerListenerPolicyRuleOptions.Condition } - if listEndpointGatewayIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewayIpsOptions.Limit)) + if createLoadBalancerListenerPolicyRuleOptions.Type != nil { + body["type"] = createLoadBalancerListenerPolicyRuleOptions.Type } - if listEndpointGatewayIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listEndpointGatewayIpsOptions.Sort)) + if createLoadBalancerListenerPolicyRuleOptions.Value != nil { + body["value"] = createLoadBalancerListenerPolicyRuleOptions.Value + } + if createLoadBalancerListenerPolicyRuleOptions.Field != nil { + body["field"] = createLoadBalancerListenerPolicyRuleOptions.Field + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return } request, err := builder.Build() @@ -21406,7 +21480,7 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionEndpointGatewayContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { return } @@ -21416,42 +21490,43 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd 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) { - return vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) +// 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) { + return vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *removeEndpointGatewayIPOptions.EndpointGatewayID, - "id": *removeEndpointGatewayIPOptions.ID, + "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/{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/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21469,41 +21544,43 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove 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) { - return vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) +// 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) { + return vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") + err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *getEndpointGatewayIPOptions.EndpointGatewayID, - "id": *getEndpointGatewayIPOptions.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/{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/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21523,7 +21600,7 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { return } @@ -21533,52 +21610,57 @@ 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 -// - 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) { - return vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) +// 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) { + return vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") + err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, - "id": *addEndpointGatewayIPOptions.ID, + "load_balancer_id": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *updateLoadBalancerListenerPolicyRuleOptions.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, `/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/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") 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(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -21590,7 +21672,7 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { return } @@ -21600,46 +21682,44 @@ 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) { - return vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) +// ListLoadBalancerPools : List all pools of a load balancer +// This request lists all pools of a load balancer. +func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") + err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteEndpointGatewayOptions.ID, + "load_balancer_id": *listLoadBalancerPoolsOptions.LoadBalancerID, } - 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/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteEndpointGatewayOptions.Headers { + for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") 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)) @@ -21649,53 +21729,92 @@ func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEn return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) + if err != nil { + return + } + response.Result = result + } 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) { - return vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) +// 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) { + return vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") + err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getEndpointGatewayOptions.ID, + "load_balancer_id": *createLoadBalancerPoolOptions.LoadBalancerID, } - 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, `/endpoint_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getEndpointGatewayOptions.Headers { + for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") 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 createLoadBalancerPoolOptions.Algorithm != nil { + body["algorithm"] = createLoadBalancerPoolOptions.Algorithm + } + if createLoadBalancerPoolOptions.HealthMonitor != nil { + body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor + } + if createLoadBalancerPoolOptions.Protocol != nil { + body["protocol"] = createLoadBalancerPoolOptions.Protocol + } + if createLoadBalancerPoolOptions.Members != nil { + body["members"] = createLoadBalancerPoolOptions.Members + } + 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 { + return + } + request, err := builder.Build() if err != nil { return @@ -21707,7 +21826,7 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { return } @@ -21717,102 +21836,94 @@ 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) { - return vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) +// 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) { + return vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") + err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateEndpointGatewayOptions.ID, + "load_balancer_id": *deleteLoadBalancerPoolOptions.LoadBalancerID, + "id": *deleteLoadBalancerPoolOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + 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}/pools/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateEndpointGatewayOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") 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(updateEndpointGatewayOptions.EndpointGatewayPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListFlowLogCollectors : List all flow log collectors -// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over one or more -// network interfaces within a VPC, depending on the chosen target. -func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { - return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) +// 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) { + return vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) } -// 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") +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "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`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listFlowLogCollectorsOptions.Headers { + for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21820,33 +21931,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 { @@ -21859,7 +21943,7 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollectorCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { return } @@ -21869,64 +21953,51 @@ 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) { - return vpc.CreateFlowLogCollectorWithContext(context.Background(), createFlowLogCollectorOptions) +// 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) { + return vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(createFlowLogCollectorOptions, "createFlowLogCollectorOptions") + err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "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`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createFlowLogCollectorOptions.Headers { + for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFlowLogCollector") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") 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 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) + _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) if err != nil { return } @@ -21942,7 +22013,7 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { return } @@ -21952,45 +22023,45 @@ 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) { - return vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) +// ListLoadBalancerPoolMembers : List all members of a load balancer pool +// This request lists all members of a load balancer pool. +func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") + err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteFlowLogCollectorOptions.ID, + "load_balancer_id": *listLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *listLoadBalancerPoolMembersOptions.PoolID, } - 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, `/flow_log_collectors/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers { + for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") 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)) @@ -22000,53 +22071,81 @@ func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteF return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + if err != nil { + return + } + response.Result = result + } 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) { - return vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) +// 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) { + return vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") + err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getFlowLogCollectorOptions.ID, + "load_balancer_id": *createLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, } - 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, `/flow_log_collectors/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getFlowLogCollectorOptions.Headers { + for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") 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 { + return + } + request, err := builder.Build() if err != nil { return @@ -22058,7 +22157,7 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) if err != nil { return } @@ -22068,52 +22167,56 @@ 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) { - return vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) +// 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) { + return vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) } -// 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") +// 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 { return } - err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") + err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateFlowLogCollectorOptions.ID, + "load_balancer_id": *replaceLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *replaceLoadBalancerPoolMembersOptions.PoolID, } - 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, `/flow_log_collectors/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateFlowLogCollectorOptions.Headers { + for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFlowLogCollector") + 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/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(updateFlowLogCollectorOptions.FlowLogCollectorPatch) + body := make(map[string]interface{}) + if replaceLoadBalancerPoolMembersOptions.Members != nil { + body["members"] = replaceLoadBalancerPoolMembersOptions.Members + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } @@ -22129,7 +22232,7 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { return } @@ -22139,1060 +22242,1166 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF 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"` +// 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) { + return vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) } -// 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} -// AddBareMetalServerNetworkInterfaceFloatingIPOptions : The AddBareMetalServerNetworkInterfaceFloatingIP options. -type AddBareMetalServerNetworkInterfaceFloatingIPOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + pathParamsMap := map[string]string{ + "load_balancer_id": *deleteLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *deleteLoadBalancerPoolMemberOptions.PoolID, + "id": *deleteLoadBalancerPoolMemberOptions.ID, + } - // The network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + 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) + if err != nil { + return + } - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` + for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // Allows users to set headers on API requests - Headers map[string]string -} + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } -// 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), + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return } -} -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} + response, err = vpc.Service.Request(request, nil) -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options + return } -// SetID : Allow user to set ID -func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options +// 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) { + return vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) } -// 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), +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") + if err != nil { + return } -} - -// 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 -} + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *getLoadBalancerPoolMemberOptions.PoolID, + "id": *getLoadBalancerPoolMemberOptions.ID, + } -// AddInstanceNetworkInterfaceFloatingIPOptions : The AddInstanceNetworkInterfaceFloatingIP options. -type AddInstanceNetworkInterfaceFloatingIPOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` + 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) + if err != nil { + return + } - // The network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") - // Allows users to set headers on API requests - Headers map[string]string -} + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) -// 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), + request, err := builder.Build() + if err != nil { + return } -} -// SetInstanceID : Allow user to set InstanceID -func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + response.Result = result + } -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options + return } -// SetID : Allow user to set ID -func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *AddInstanceNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options +// 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) { + return vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) } -// SetHeaders : Allow user to set Headers -func (options *AddInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddInstanceNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} +// 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 { + return + } + err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") + if err != nil { + return + } -// AddVPNGatewayConnectionLocalCIDROptions : The AddVPNGatewayConnectionLocalCIDR options. -type AddVPNGatewayConnectionLocalCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *updateLoadBalancerPoolMemberOptions.PoolID, + "id": *updateLoadBalancerPoolMemberOptions.ID, + } - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` + 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) + if err != nil { + return + } - // The address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") - // Allows users to set headers on API requests - Headers map[string]string -} + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) -// NewAddVPNGatewayConnectionLocalCIDROptions : Instantiate AddVPNGatewayConnectionLocalCIDROptions -func (*VpcV1) NewAddVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { - return &AddVPNGatewayConnectionLocalCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), + _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) + if err != nil { + return } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionLocalCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} -// SetID : Allow user to set ID -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetID(id string) *AddVPNGatewayConnectionLocalCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} + request, err := builder.Build() + if err != nil { + return + } -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionLocalCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + response.Result = result + } -// SetPrefixLength : Allow user to set PrefixLength -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) - return _options + return } -// SetHeaders : Allow user to set Headers -func (options *AddVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionLocalCIDROptions { - options.Headers = param - return options +// ListEndpointGateways : List all endpoint gateways +// This request lists all 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) { + return vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) } -// AddVPNGatewayConnectionPeerCIDROptions : The AddVPNGatewayConnectionPeerCIDR options. -type AddVPNGatewayConnectionPeerCIDROptions 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 address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` +// 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 { + return + } - // Allows users to set headers on API requests - Headers map[string]string -} + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) + if err != nil { + return + } -// NewAddVPNGatewayConnectionPeerCIDROptions : Instantiate AddVPNGatewayConnectionPeerCIDROptions -func (*VpcV1) NewAddVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { - return &AddVPNGatewayConnectionPeerCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), + for headerName, headerValue := range listEndpointGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) } -} -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionPeerCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") -// SetID : Allow user to set ID -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetID(id string) *AddVPNGatewayConnectionPeerCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} + 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)) + } -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionPeerCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} + request, err := builder.Build() + if err != nil { + return + } -// SetPrefixLength : Allow user to set PrefixLength -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) - return _options -} + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) + if err != nil { + return + } + response.Result = result + } -// SetHeaders : Allow user to set Headers -func (options *AddVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionPeerCIDROptions { - options.Headers = param - return options + return } -// 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"` +// 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) { + return vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) } -// 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "has_subnets", &obj.HasSubnets) + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return + + for headerName, headerValue := range createEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + 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 createEndpointGatewayOptions.Target != nil { + body["target"] = createEndpointGatewayOptions.Target + } + if createEndpointGatewayOptions.VPC != nil { + body["vpc"] = createEndpointGatewayOptions.VPC + } + 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 { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + } + return } -// AddressPrefixCollection : AddressPrefixCollection struct -type AddressPrefixCollection struct { - // Collection of address prefixes. - AddressPrefixes []AddressPrefix `json:"address_prefixes" validate:"required"` - - // A link to the first page of resources. - First *AddressPrefixCollectionFirst `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 *AddressPrefixCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` +// ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway +// This request lists all reserved IPs bound to an endpoint gateway. +func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { + return vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) } -// 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) +// 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 { return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalAddressPrefixCollectionFirst) + err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, + } + + 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`, pathParamsMap) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalAddressPrefixCollectionNext) + + for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 { return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionEndpointGatewayContext) + if err != nil { + return + } + response.Result = result + } + 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 +// 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) { + return vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) +} + +// 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 { + return } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err + err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") + if err != nil { + return } - return start, nil -} -// 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"` -} + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *removeEndpointGatewayIPOptions.EndpointGatewayID, + "id": *removeEndpointGatewayIPOptions.ID, + } -// 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) + 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/{id}`, pathParamsMap) if err != nil { 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"` -} + for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } -// 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) + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") + 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 { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + + response, err = vpc.Service.Request(request, nil) + 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"` - - // The name for this address prefix. The name must not be used by another address prefix for the VPC. - Name *string `json:"name,omitempty"` +// 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) { + return vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) } -// 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") if err != nil { 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) + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *getEndpointGatewayIPOptions.EndpointGatewayID, + "id": *getEndpointGatewayIPOptions.ID, } - return -} - -// BackupPolicy : BackupPolicy struct -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 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"` + 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) + if err != nil { + return + } - // A 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 will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. - MatchResourceTypes []string `json:"match_resource_types" validate:"required"` + for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // 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"` + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") - // The name for this backup policy. The name is unique across all backup policies in the region. - Name *string `json:"name" validate:"required"` + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - // The plans for the backup policy. - Plans []BackupPolicyPlanReference `json:"plans" validate:"required"` + request, err := builder.Build() + if err != nil { + return + } - // The resource group for this backup policy. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + return } -// 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.MatchResourceTypes property. -// The resource type. -const ( - BackupPolicyMatchResourceTypesVolumeConst = "volume" -) - -// Constants associated with the BackupPolicy.ResourceType property. -// The resource type. -const ( - BackupPolicyResourceTypeBackupPolicyConst = "backup_policy" -) +// 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 +// - 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) { + return vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) +} -// 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, + "id": *addEndpointGatewayIPOptions.ID, } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) if err != nil { return } - err = core.UnmarshalPrimitive(m, "last_job_completed_at", &obj.LastJobCompletedAt) + + for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") + 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 { return } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { return } - err = core.UnmarshalPrimitive(m, "match_resource_types", &obj.MatchResourceTypes) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) +} + +// 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 { return } - err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + + pathParamsMap := map[string]string{ + "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 { return } - err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) + + 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 { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) +} + +// 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 { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} -// BackupPolicyCollection : BackupPolicyCollection struct -type BackupPolicyCollection struct { - // Collection of backup policies. - BackupPolicies []BackupPolicy `json:"backup_policies" validate:"required"` + pathParamsMap := map[string]string{ + "id": *getEndpointGatewayOptions.ID, + } - // A link to the first page of resources. - First *BackupPolicyCollectionFirst `json:"first" validate:"required"` + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + if err != nil { + return + } - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` + for headerName, headerValue := range getEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *BackupPolicyCollectionNext `json:"next,omitempty"` + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) -// 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) + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyCollectionFirst) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) +} + +// 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 { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyCollectionNext) + err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + + pathParamsMap := map[string]string{ + "id": *updateEndpointGatewayOptions.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) if err != nil { 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 + for headerName, headerValue := range updateEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - return start, nil -} + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") -// 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"` -} + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) -// 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) + _, err = builder.SetBodyContentJSON(updateEndpointGatewayOptions.EndpointGatewayPatch) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} -// 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"` -} + request, err := builder.Build() + if err != nil { + return + } -// 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) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + } + 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. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` +// ListFlowLogCollectors : List all flow log collectors +// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over the instance +// network interfaces contained within its target. +func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { + return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) +} - // The URL for this backup policy job. - Href *string `json:"href" validate:"required"` +// 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 { + return + } - // The unique identifier for this backup policy job. - ID *string `json:"id" validate:"required"` + 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 { + return + } - // The type of backup policy job. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the - // unexpected property value was encountered. - JobType *string `json:"job_type" validate:"required"` + for headerName, headerValue := range listFlowLogCollectorsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") - // The source this backup was created from (may be - // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - Source BackupPolicyJobSourceIntf `json:"source" validate:"required"` + 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)) + } - // The status of the backup policy job. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the - // unexpected property value was encountered. - Status *string `json:"status" validate:"required"` + request, err := builder.Build() + if err != nil { + return + } - // The reasons for the current status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - StatusReasons []BackupPolicyJobStatusReason `json:"status_reasons" validate:"required"` + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollectorCollection) + if err != nil { + return + } + response.Result = result + } - // 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"` + return } -// Constants associated with the BackupPolicyJob.JobType property. -// The type of backup policy job. -// -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the -// unexpected property value was encountered. -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 will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the -// unexpected property value was encountered. -const ( - BackupPolicyJobStatusFailedConst = "failed" - BackupPolicyJobStatusRunningConst = "running" - BackupPolicyJobStatusSucceededConst = "succeeded" -) +// 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) { + return vpc.CreateFlowLogCollectorWithContext(context.Background(), createFlowLogCollectorOptions) +} -// 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "auto_delete_after", &obj.AutoDeleteAfter) + err = core.ValidateStruct(createFlowLogCollectorOptions, "createFlowLogCollectorOptions") if err != nil { return } - err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference) + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) if err != nil { return } - err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) - if err != nil { - return + + for headerName, headerValue := range createFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return + 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 createFlowLogCollectorOptions.StorageBucket != nil { + body["storage_bucket"] = createFlowLogCollectorOptions.StorageBucket } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return + if createFlowLogCollectorOptions.Target != nil { + body["target"] = createFlowLogCollectorOptions.Target } - err = core.UnmarshalPrimitive(m, "job_type", &obj.JobType) - if err != nil { - return + if createFlowLogCollectorOptions.Active != nil { + body["active"] = createFlowLogCollectorOptions.Active } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return + if createFlowLogCollectorOptions.Name != nil { + body["name"] = createFlowLogCollectorOptions.Name } - err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalBackupPolicyJobSource) - if err != nil { - return + if createFlowLogCollectorOptions.ResourceGroup != nil { + body["resource_group"] = createFlowLogCollectorOptions.ResourceGroup } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + _, err = builder.SetBodyContentJSON(body) if err != nil { return } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBackupPolicyJobStatusReason) + + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalModel(m, "target_snapshots", &obj.TargetSnapshots, UnmarshalSnapshotReference) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + } + return } -// BackupPolicyJobCollection : BackupPolicyJobCollection struct -type BackupPolicyJobCollection struct { - // A link to the first page of resources. - First *BackupPolicyJobCollectionFirst `json:"first" validate:"required"` - - // Collection of backup policy jobs. - 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 *BackupPolicyJobCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` +// 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) { + return vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) } -// 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 { - return - } - err = core.UnmarshalModel(m, "jobs", &obj.Jobs, UnmarshalBackupPolicyJob) +// 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 { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyJobCollectionNext) - if err != nil { - return + + pathParamsMap := map[string]string{ + "id": *deleteFlowLogCollectorOptions.ID, } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + + 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) if err != nil { 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 + for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - return start, nil -} -// 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"` -} + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) -// 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) + request, err := builder.Build() if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + + response, err = vpc.Service.Request(request, nil) + 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"` +// 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) { + return vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) } -// 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) +// 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 { + return + } + err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") if err != nil { 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)). -// Models which "extend" this model: -// - BackupPolicyJobSourceVolumeReference -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 *VolumeReferenceDeleted `json:"deleted,omitempty"` + pathParamsMap := map[string]string{ + "id": *getFlowLogCollectorOptions.ID, + } - // The URL for this volume. - Href *string `json:"href,omitempty"` + 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) + if err != nil { + return + } - // The unique identifier for this volume. - ID *string `json:"id,omitempty"` + for headerName, headerValue := range getFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // The name for this volume. The name is unique across all volumes in the region. - Name *string `json:"name,omitempty"` + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") - // 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"` + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} + request, err := builder.Build() + if err != nil { + return + } -// Constants associated with the BackupPolicyJobSource.ResourceType property. -// The resource type. -const ( - BackupPolicyJobSourceResourceTypeVolumeConst = "volume" -) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + } -func (*BackupPolicyJobSource) isaBackupPolicyJobSource() bool { - return true + return } -type BackupPolicyJobSourceIntf interface { - isaBackupPolicyJobSource() bool +// 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) { + return vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) } -// 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) +// 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 { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) + err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return + + pathParamsMap := map[string]string{ + "id": *updateFlowLogCollectorOptions.ID, } - err = core.UnmarshalPrimitive(m, "id", &obj.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) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + + for headerName, headerValue := range updateFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 { return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + + request, err := builder.Build() if err != nil { 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 { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + } + return } -// BackupPolicyJobStatusReason : BackupPolicyJobStatusReason struct -type BackupPolicyJobStatusReason struct { - // A snake case string succinctly identifying the status reason: - // - `internal_error`: Internal error (contact IBM support) - // - `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). - Code *string `json:"code" validate:"required"` - - // An explanation of the status reason. - Message *string `json:"message" validate:"required"` +// AccountReference : AccountReference struct +type AccountReference struct { + // The unique identifier for this account. + ID *string `json:"id" validate:"required"` - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the BackupPolicyJobStatusReason.Code property. -// A snake case string succinctly identifying the status reason: -// - `internal_error`: Internal error (contact IBM support) -// - `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). +// Constants associated with the AccountReference.ResourceType property. +// The resource type. const ( - BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error" - BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" - BackupPolicyJobStatusReasonCodeSnapshotVolumeLimitConst = "snapshot_volume_limit" - BackupPolicyJobStatusReasonCodeSourceVolumeBusyConst = "source_volume_busy" + AccountReferenceResourceTypeAccountConst = "account" ) -// 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 { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) +// 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 { return } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -23200,119 +23409,289 @@ func UnmarshalBackupPolicyJobStatusReason(m map[string]json.RawMessage, result i return } -// BackupPolicyPatch : BackupPolicyPatch struct -type BackupPolicyPatch struct { - // The user tags this backup policy applies 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"` +// AddBareMetalServerNetworkInterfaceFloatingIPOptions : The AddBareMetalServerNetworkInterfaceFloatingIP options. +type AddBareMetalServerNetworkInterfaceFloatingIPOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // 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 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 } -// 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, "match_user_tags", &obj.MatchUserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - 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), } - 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) { - var jsonData []byte - jsonData, err = json.Marshal(backupPolicyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options } -// BackupPolicyPlan : BackupPolicyPlan struct -type BackupPolicyPlan struct { - // Indicates whether the plan is active. - Active *bool `json:"active" validate:"required"` +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} - // The user tags to attach to backups (snapshots) created by this plan. - AttachUserTags []string `json:"attach_user_tags" validate:"required"` +// SetID : Allow user to set ID +func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} - ClonePolicy *BackupPolicyPlanClonePolicy `json:"clone_policy" validate:"required"` +// SetHeaders : Allow user to set Headers +func (options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags" validate:"required"` +// AddEndpointGatewayIPOptions : The AddEndpointGatewayIP options. +type AddEndpointGatewayIPOptions struct { + // The endpoint gateway identifier. + EndpointGatewayID *string `json:"endpoint_gateway_id" validate:"required,ne="` - // The date and time that the backup policy plan was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + // The reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` - // 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"` + // Allows users to set headers on API requests + Headers map[string]string +} - DeletionTrigger *BackupPolicyPlanDeletionTrigger `json:"deletion_trigger" validate:"required"` +// NewAddEndpointGatewayIPOptions : Instantiate AddEndpointGatewayIPOptions +func (*VpcV1) NewAddEndpointGatewayIPOptions(endpointGatewayID string, id string) *AddEndpointGatewayIPOptions { + return &AddEndpointGatewayIPOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + ID: core.StringPtr(id), + } +} - // The URL for this backup policy plan. - Href *string `json:"href" validate:"required"` +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (_options *AddEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *AddEndpointGatewayIPOptions { + _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return _options +} - // The unique identifier for this backup policy plan. - ID *string `json:"id" validate:"required"` +// SetID : Allow user to set ID +func (_options *AddEndpointGatewayIPOptions) SetID(id string) *AddEndpointGatewayIPOptions { + _options.ID = core.StringPtr(id) + return _options +} - // The lifecycle state of this backup policy plan. - LifecycleState *string `json:"lifecycle_state" validate:"required"` +// SetHeaders : Allow user to set Headers +func (options *AddEndpointGatewayIPOptions) SetHeaders(param map[string]string) *AddEndpointGatewayIPOptions { + options.Headers = param + return options +} - // The name for this backup policy plan. The name is unique across all plans in the backup policy. - Name *string `json:"name" validate:"required"` +// AddInstanceNetworkInterfaceFloatingIPOptions : The AddInstanceNetworkInterfaceFloatingIP options. +type AddInstanceNetworkInterfaceFloatingIPOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` - // The policies for additional backups in remote regions. - RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicy `json:"remote_region_policies" validate:"required"` + // The instance network interface identifier. + NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string } -// 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" -) +// 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), + } +} -// Constants associated with the BackupPolicyPlan.ResourceType property. -// The resource type. -const ( - BackupPolicyPlanResourceTypeBackupPolicyPlanConst = "backup_policy_plan" -) +// SetInstanceID : Allow user to set InstanceID +func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} -// 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 { - return - } - err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) - if err != nil { - return +// 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 +} + +// AddVPNGatewayConnectionLocalCIDROptions : The AddVPNGatewayConnectionLocalCIDR options. +type AddVPNGatewayConnectionLocalCIDROptions 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 address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddVPNGatewayConnectionLocalCIDROptions : Instantiate AddVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewAddVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { + return &AddVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), } - err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicy) - if err != nil { - return +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetID(id string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionLocalCIDROptions { + options.Headers = param + return options +} + +// AddVPNGatewayConnectionPeerCIDROptions : The AddVPNGatewayConnectionPeerCIDR options. +type AddVPNGatewayConnectionPeerCIDROptions 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 address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddVPNGatewayConnectionPeerCIDROptions : Instantiate AddVPNGatewayConnectionPeerCIDROptions +func (*VpcV1) NewAddVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { + return &AddVPNGatewayConnectionPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), } - err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetID(id string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionPeerCIDROptions { + 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 { return } @@ -23320,11 +23699,7 @@ func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTrigger) + err = core.UnmarshalPrimitive(m, "has_subnets", &obj.HasSubnets) if err != nil { return } @@ -23336,7 +23711,7 @@ func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) if err != nil { return } @@ -23344,11 +23719,7 @@ func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicy) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) if err != nil { return } @@ -23356,81 +23727,45 @@ func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) 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"` +// AddressPrefixCollection : AddressPrefixCollection struct +type AddressPrefixCollection struct { + // Collection of address prefixes. + AddressPrefixes []AddressPrefix `json:"address_prefixes" validate:"required"` - // The zone this backup policy plan will create snapshot clones in. - Zones []ZoneReference `json:"zones" validate:"required"` -} + // A link to the first page of resources. + First *AddressPrefixCollectionFirst `json:"first" 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 { - return - } - err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` -// BackupPolicyPlanClonePolicyPatch : BackupPolicyPlanClonePolicyPatch struct -type BackupPolicyPlanClonePolicyPatch struct { - // The maximum number of recent snapshots (per source) that will keep clones. - MaxSnapshots *int64 `json:"max_snapshots,omitempty"` + // 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 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"` + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// 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) +// 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 { return } - err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalAddressPrefixCollectionFirst) if err != nil { 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.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - 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.UnmarshalModel(m, "next", &obj.Next, UnmarshalAddressPrefixCollectionNext) if err != nil { return } - err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } @@ -23438,16 +23773,28 @@ func UnmarshalBackupPolicyPlanClonePolicyPrototype(m map[string]json.RawMessage, return } -// BackupPolicyPlanCollection : BackupPolicyPlanCollection struct -type BackupPolicyPlanCollection struct { - // Collection of backup policy plans. - Plans []BackupPolicyPlan `json:"plans" validate:"required"` +// 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 || start == nil { + return nil, err + } + return start, nil } -// 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, "plans", &obj.Plans, UnmarshalBackupPolicyPlan) +// 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"` +} + +// 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) if err != nil { return } @@ -23455,23 +23802,16 @@ func UnmarshalBackupPolicyPlanCollection(m map[string]json.RawMessage, result in 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"` +// 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"` } -// 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 { - return - } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) +// 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) if err != nil { return } @@ -23479,23 +23819,25 @@ func UnmarshalBackupPolicyPlanDeletionTrigger(m map[string]json.RawMessage, resu return } -// BackupPolicyPlanDeletionTriggerPatch : BackupPolicyPlanDeletionTriggerPatch struct -type BackupPolicyPlanDeletionTriggerPatch struct { - // The maximum number of days to keep each backup after creation. - DeleteAfter *int64 `json:"delete_after,omitempty"` +// 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 maximum number of recent backups to keep. Specify `null` to remove any existing maximum. - DeleteOverCount *int64 `json:"delete_over_count,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"` } -// 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -23503,180 +23845,135 @@ func UnmarshalBackupPolicyPlanDeletionTriggerPatch(m map[string]json.RawMessage, 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 { - return - } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) - if err != nil { - 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) } - 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"` +// BackupPolicy : BackupPolicy struct +type BackupPolicy struct { + // The date and time that the backup policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" 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 CRN for this backup policy. + CRN *string `json:"crn" validate:"required"` - ClonePolicy *BackupPolicyPlanClonePolicyPatch `json:"clone_policy,omitempty"` + // The URL for this backup policy. + Href *string `json:"href" validate:"required"` - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags,omitempty"` + // The unique identifier for this backup policy. + ID *string `json:"id" 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 date and time that the most recent job for this backup policy completed. // - // All backup schedules for plans in the same policy must be at least an hour apart. - CronSpec *string `json:"cron_spec,omitempty"` + // If absent, no job has yet completed for this backup policy. + LastJobCompletedAt *strfmt.DateTime `json:"last_job_completed_at,omitempty"` - DeletionTrigger *BackupPolicyPlanDeletionTriggerPatch `json:"deletion_trigger,omitempty"` + // The lifecycle state of the backup policy. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // 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 resource types 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 will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + MatchResourceTypes []string `json:"match_resource_types" validate:"required"` - // The policies for additional backups in remote regions (replacing any existing policies). - RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` + // 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"` } -// 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 { - return - } - err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) +// 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.MatchResourceTypes property. +// The resource type. +const ( + BackupPolicyMatchResourceTypesVolumeConst = "volume" +) + +// Constants associated with the BackupPolicy.ResourceType property. +// The resource type. +const ( + BackupPolicyResourceTypeBackupPolicyConst = "backup_policy" +) + +// 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 { return } - err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPatch) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { 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) - } - 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") - 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, "last_job_completed_at", &obj.LastJobCompletedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return } - err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPrototype) + err = core.UnmarshalPrimitive(m, "match_resource_types", &obj.MatchResourceTypes) if err != nil { return } - err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) if err != nil { return } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPrototype) + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } - err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -23684,59 +23981,45 @@ func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result int return } -// BackupPolicyPlanReference : BackupPolicyPlanReference struct -type BackupPolicyPlanReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BackupPolicyPlanReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this backup policy plan. - Href *string `json:"href" validate:"required"` +// BackupPolicyCollection : BackupPolicyCollection struct +type BackupPolicyCollection struct { + // Collection of backup policies. + BackupPolicies []BackupPolicy `json:"backup_policies" validate:"required"` - // The unique identifier for this backup policy plan. - ID *string `json:"id" validate:"required"` + // A link to the first page of resources. + First *BackupPolicyCollectionFirst `json:"first" 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 maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" 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"` + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *BackupPolicyCollectionNext `json:"next,omitempty"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// 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, UnmarshalBackupPolicyPlanReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// 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 { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyCollectionFirst) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalBackupPolicyPlanRemote) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyCollectionNext) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } @@ -23744,67 +24027,28 @@ func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result int return } -// BackupPolicyPlanReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BackupPolicyPlanReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBackupPolicyPlanReferenceDeleted unmarshals an instance of BackupPolicyPlanReferenceDeleted from the specified map of raw messages. -func UnmarshalBackupPolicyPlanReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - 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 } - 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"` -} - -// 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 { - return + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return + return start, nil } -// 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"` +// 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"` } -// 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 { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) +// 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 { return } @@ -23812,42 +24056,16 @@ func UnmarshalBackupPolicyPlanRemoteRegionPolicy(m map[string]json.RawMessage, r return } -// 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"` -} - -// 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") - return +// 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"` } -// 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 { - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionIdentity) +// 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 { return } @@ -23855,70 +24073,53 @@ func UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype(m map[string]json.RawM return } -// BareMetalServer : BareMetalServer struct -type BareMetalServer struct { - // The total bandwidth (in megabits per second) shared across the bare metal server's network interfaces. - Bandwidth *int64 `json:"bandwidth" validate:"required"` - - // The possible resource types for this property are expected to expand in the future. - BootTarget BareMetalServerBootTargetIntf `json:"boot_target" validate:"required"` - - // The bare metal server CPU configuration. - Cpu *BareMetalServerCpu `json:"cpu" validate:"required"` +// 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 date and time that the bare metal server was created. - CreatedAt *strfmt.DateTime `json:"created_at" 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 CRN for this bare metal server. - CRN *string `json:"crn" 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 disks for this bare metal server, including any disks that are associated with the - // `boot_target`. - Disks []BareMetalServerDisk `json:"disks" 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"` - // 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 date and time that the backup policy job was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The URL for this bare metal server. + // The URL for this backup policy job. Href *string `json:"href" validate:"required"` - // The unique identifier for this bare metal server. + // The unique identifier for this backup policy job. ID *string `json:"id" validate:"required"` - // The reasons for the current `lifecycle_state` (if any). + // The type of backup policy job. // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - LifecycleReasons []BareMetalServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the bare metal server. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // 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 interfaces for this bare metal server, including the primary network interface. - NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces" validate:"required"` - - // Primary network interface. - PrimaryNetworkInterface *NetworkInterfaceBareMetalServerContextReference `json:"primary_network_interface" 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 bare metal server. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the + // unexpected property value was encountered. + JobType *string `json:"job_type" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The status of the bare metal server. + // 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 will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the + // unexpected property value was encountered. Status *string `json:"status" validate:"required"` // The reasons for the current status (if any). @@ -23926,77 +24127,62 @@ type BareMetalServer struct { // The enumerated reason code values for this property will expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected reason code was encountered. - 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"` + StatusReasons []BackupPolicyJobStatusReason `json:"status_reasons" validate:"required"` - // The zone this bare metal server resides in. - Zone *ZoneReference `json:"zone" 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"` } -// Constants associated with the BareMetalServer.LifecycleState property. -// The lifecycle state of the bare metal server. +// Constants associated with the BackupPolicyJob.JobType property. +// The type of backup policy job. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the +// unexpected property value was encountered. const ( - BareMetalServerLifecycleStateDeletingConst = "deleting" - BareMetalServerLifecycleStateFailedConst = "failed" - BareMetalServerLifecycleStatePendingConst = "pending" - BareMetalServerLifecycleStateStableConst = "stable" - BareMetalServerLifecycleStateSuspendedConst = "suspended" - BareMetalServerLifecycleStateUpdatingConst = "updating" - BareMetalServerLifecycleStateWaitingConst = "waiting" + BackupPolicyJobJobTypeCreationConst = "creation" + BackupPolicyJobJobTypeDeletionConst = "deletion" ) -// Constants associated with the BareMetalServer.ResourceType property. +// Constants associated with the BackupPolicyJob.ResourceType property. // The resource type. const ( - BareMetalServerResourceTypeBareMetalServerConst = "bare_metal_server" + BackupPolicyJobResourceTypeBackupPolicyJobConst = "backup_policy_job" ) -// Constants associated with the BareMetalServer.Status property. -// The status of the bare metal server. +// Constants associated with the BackupPolicyJob.Status property. +// The status of the backup policy job. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the +// unexpected property value was encountered. const ( - BareMetalServerStatusDeletingConst = "deleting" - BareMetalServerStatusFailedConst = "failed" - BareMetalServerStatusMaintenanceConst = "maintenance" - BareMetalServerStatusPendingConst = "pending" - BareMetalServerStatusRestartingConst = "restarting" - BareMetalServerStatusRunningConst = "running" - BareMetalServerStatusStartingConst = "starting" - BareMetalServerStatusStoppedConst = "stopped" - BareMetalServerStatusStoppingConst = "stopping" + BackupPolicyJobStatusFailedConst = "failed" + BackupPolicyJobStatusRunningConst = "running" + BackupPolicyJobStatusSucceededConst = "succeeded" ) -// 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 { - return - } - err = core.UnmarshalModel(m, "boot_target", &obj.BootTarget, UnmarshalBareMetalServerBootTarget) - if err != nil { - return - } - err = core.UnmarshalModel(m, "cpu", &obj.Cpu, UnmarshalBareMetalServerCpu) +// 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 { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalPrimitive(m, "auto_delete_after", &obj.AutoDeleteAfter) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference) if err != nil { return } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) + err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } @@ -24008,39 +24194,15 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalBareMetalServerLifecycleReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceBareMetalServerContextReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileReference) + err = core.UnmarshalPrimitive(m, "job_type", &obj.JobType) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalBackupPolicyJobSource) if err != nil { return } @@ -24048,119 +24210,11 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBareMetalServerStatusReason) + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBackupPolicyJobStatusReason) if err != nil { return } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModule) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerBootTarget : The possible resource types for this property are expected to expand 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 *BareMetalServerDiskReferenceDeleted `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, UnmarshalBareMetalServerDiskReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - 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 { - return - } - err = core.UnmarshalPrimitive(m, "core_count", &obj.CoreCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "threads_per_core", &obj.ThreadsPerCore) + err = core.UnmarshalModel(m, "target_snapshots", &obj.TargetSnapshots, UnmarshalSnapshotReference) if err != nil { return } @@ -24168,33 +24222,33 @@ func UnmarshalBareMetalServerCpu(m map[string]json.RawMessage, result interface{ return } -// BareMetalServerCollection : BareMetalServerCollection struct -type BareMetalServerCollection struct { - // Collection of bare metal servers. - BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` - +// BackupPolicyJobCollection : BackupPolicyJobCollection struct +type BackupPolicyJobCollection struct { // A link to the first page of resources. - First *BareMetalServerCollectionFirst `json:"first" validate:"required"` + First *BackupPolicyJobCollectionFirst `json:"first" validate:"required"` + + // Collection of backup policy jobs. + 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 *BareMetalServerCollectionNext `json:"next,omitempty"` + Next *BackupPolicyJobCollectionNext `json:"next,omitempty"` // 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) +// 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 { return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerCollectionFirst) + err = core.UnmarshalModel(m, "jobs", &obj.Jobs, UnmarshalBackupPolicyJob) if err != nil { return } @@ -24202,7 +24256,7 @@ func UnmarshalBareMetalServerCollection(m map[string]json.RawMessage, result int if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyJobCollectionNext) if err != nil { return } @@ -24215,7 +24269,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 *BackupPolicyJobCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -24226,15 +24280,15 @@ func (resp *BareMetalServerCollection) GetNextStart() (*string, error) { return start, nil } -// BareMetalServerCollectionFirst : A link to the first page of resources. -type BareMetalServerCollectionFirst struct { +// 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"` } -// 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) +// 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) if err != nil { return @@ -24243,15 +24297,15 @@ func UnmarshalBareMetalServerCollectionFirst(m map[string]json.RawMessage, resul return } -// BareMetalServerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BareMetalServerCollectionNext struct { +// 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"` } -// 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) +// 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) if err != nil { return @@ -24260,59 +24314,77 @@ func UnmarshalBareMetalServerCollectionNext(m map[string]json.RawMessage, result 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"` +// 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 +type BackupPolicyJobSource struct { + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` - // The bare metal server console type for which this token may be used. - ConsoleType *string `json:"console_type" validate:"required"` + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` - // The date and time that the access token was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + // The URL for this volume. + Href *string `json:"href,omitempty"` - // The date and time that the access token will expire. - ExpiresAt *strfmt.DateTime `json:"expires_at" validate:"required"` + // The unique identifier for this volume. + ID *string `json:"id,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 name for this volume. The name is unique across all volumes in the region. + Name *string `json:"name,omitempty"` - // The URL to access this bare metal server console. - Href *string `json:"href" validate:"required"` + // 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"` } -// Constants associated with the BareMetalServerConsoleAccessToken.ConsoleType property. -// The bare metal server console type for which this token may be used. +// Constants associated with the BackupPolicyJobSource.ResourceType property. +// The resource type. const ( - BareMetalServerConsoleAccessTokenConsoleTypeSerialConst = "serial" - BareMetalServerConsoleAccessTokenConsoleTypeVncConst = "vnc" + BackupPolicyJobSourceResourceTypeVolumeConst = "volume" ) -// 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 (*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 { return } - err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "force", &obj.Force) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -24320,67 +24392,182 @@ func UnmarshalBareMetalServerConsoleAccessToken(m map[string]json.RawMessage, re return } -// BareMetalServerDisk : BareMetalServerDisk struct -type BareMetalServerDisk struct { - // The date and time that the disk was created. +// BackupPolicyJobStatusReason : BackupPolicyJobStatusReason struct +type BackupPolicyJobStatusReason struct { + // A snake case string succinctly identifying the status reason: + // - `internal_error`: Internal error (contact IBM support) + // - `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). + 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 snake case string succinctly identifying the status reason: +// - `internal_error`: Internal error (contact IBM support) +// - `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). +const ( + BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error" + BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" + BackupPolicyJobStatusReasonCodeSnapshotVolumeLimitConst = "snapshot_volume_limit" + BackupPolicyJobStatusReasonCodeSourceVolumeBusyConst = "source_volume_busy" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPatch : BackupPolicyPatch struct +type BackupPolicyPatch struct { + // 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"` +} + +// 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, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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) { + var jsonData []byte + jsonData, err = json.Marshal(backupPolicyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + 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"` - // The URL for this bare metal server disk. + // 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 *BackupPolicyPlanDeletionTrigger `json:"deletion_trigger" validate:"required"` + + // The URL for this backup policy plan. Href *string `json:"href" validate:"required"` - // The unique identifier for this bare metal server disk. + // The unique identifier for this backup policy plan. ID *string `json:"id" validate:"required"` - // The disk interface used for attaching the disk. - // - // - `fcp`: Attached using Fiber Channel Protocol - // - `sata`: Attached using Serial Advanced Technology Attachment - // - `nvme`: Attached using Non-Volatile Memory Express - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - InterfaceType *string `json:"interface_type" validate:"required"` + // The lifecycle state of this backup policy plan. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The name for this bare metal server disk. The name is unique across all disks on the bare metal server. + // 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 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"` - - // The size of the disk in GB (gigabytes). - Size *int64 `json:"size" validate:"required"` } -// Constants associated with the BareMetalServerDisk.InterfaceType property. -// The disk interface used for attaching the disk. -// -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using Non-Volatile Memory Express -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// Constants associated with the BackupPolicyPlan.LifecycleState property. +// The lifecycle state of this backup policy plan. const ( - BareMetalServerDiskInterfaceTypeFcpConst = "fcp" - BareMetalServerDiskInterfaceTypeNvmeConst = "nvme" - BareMetalServerDiskInterfaceTypeSataConst = "sata" + BackupPolicyPlanLifecycleStateDeletingConst = "deleting" + BackupPolicyPlanLifecycleStateFailedConst = "failed" + BackupPolicyPlanLifecycleStatePendingConst = "pending" + BackupPolicyPlanLifecycleStateStableConst = "stable" + BackupPolicyPlanLifecycleStateSuspendedConst = "suspended" + BackupPolicyPlanLifecycleStateUpdatingConst = "updating" + BackupPolicyPlanLifecycleStateWaitingConst = "waiting" ) -// Constants associated with the BareMetalServerDisk.ResourceType property. +// Constants associated with the BackupPolicyPlan.ResourceType property. // The resource type. const ( - BareMetalServerDiskResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" + BackupPolicyPlanResourceTypeBackupPolicyPlanConst = "backup_policy_plan" ) -// 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) +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTrigger) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -24389,7 +24576,7 @@ func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface if err != nil { return } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return } @@ -24397,11 +24584,11 @@ func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicy) if err != nil { return } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -24409,16 +24596,23 @@ func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface return } -// BareMetalServerDiskCollection : BareMetalServerDiskCollection struct -type BareMetalServerDiskCollection struct { - // Collection of the bare metal server's disks. - Disks []BareMetalServerDisk `json:"disks" validate:"required"` +// 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"` } -// 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) +// 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 { + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneReference) if err != nil { return } @@ -24426,16 +24620,24 @@ func UnmarshalBareMetalServerDiskCollection(m map[string]json.RawMessage, result 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"` +// 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"` } -// 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) +// 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 { + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) if err != nil { return } @@ -24443,27 +24645,32 @@ func UnmarshalBareMetalServerDiskPatch(m map[string]json.RawMessage, result inte 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) - } - 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"` } -// BareMetalServerDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerDiskReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" 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") + return } -// UnmarshalBareMetalServerDiskReferenceDeleted unmarshals an instance of BareMetalServerDiskReferenceDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDiskReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) +// 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 { + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) if err != nil { return } @@ -24471,31 +24678,40 @@ func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, 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"` +// BackupPolicyPlanCollection : BackupPolicyPlanCollection struct +type BackupPolicyPlanCollection struct { + // Collection of backup policy plans. + Plans []BackupPolicyPlan `json:"plans" 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) +// 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, "plans", &obj.Plans, UnmarshalBackupPolicyPlan) if err != nil { return } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) + 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 { return } - err = core.UnmarshalModel(m, "user_accounts", &obj.UserAccounts, UnmarshalBareMetalServerInitializationUserAccount) + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) if err != nil { return } @@ -24503,46 +24719,47 @@ func UnmarshalBareMetalServerInitialization(m map[string]json.RawMessage, result return } -// BareMetalServerInitializationPrototype : BareMetalServerInitializationPrototype struct -type BareMetalServerInitializationPrototype struct { - // The image to be used when provisioning the bare metal server. - Image ImageIdentityIntf `json:"image" 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 chosen 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"` +// BackupPolicyPlanDeletionTriggerPatch : BackupPolicyPlanDeletionTriggerPatch struct +type BackupPolicyPlanDeletionTriggerPatch struct { + // The maximum number of days to keep each backup after creation. + DeleteAfter *int64 `json:"delete_after,omitempty"` - // User data to be made available when initializing the bare metal server. - UserData *string `json:"user_data,omitempty"` + // The maximum number of recent backups to keep. Specify `null` to remove any existing maximum. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` } -// NewBareMetalServerInitializationPrototype : Instantiate BareMetalServerInitializationPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerInitializationPrototype(image ImageIdentityIntf, keys []KeyIdentityIntf) (_model *BareMetalServerInitializationPrototype, err error) { - _model = &BareMetalServerInitializationPrototype{ - Image: image, - Keys: keys, +// 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 { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// 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) + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) if err != nil { return } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + 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 { return } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) if err != nil { return } @@ -24550,90 +24767,68 @@ func UnmarshalBareMetalServerInitializationPrototype(m map[string]json.RawMessag 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"` +// BackupPolicyPlanPatch : BackupPolicyPlanPatch struct +type BackupPolicyPlanPatch struct { + // Indicates whether the plan is active. + Active *bool `json:"active,omitempty"` - // The public SSH key used to encrypt the password. - EncryptionKey *KeyReference `json:"encryption_key,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"` - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` + ClonePolicy *BackupPolicyPlanClonePolicyPatch `json:"clone_policy,omitempty"` - // The username for the account created at initialization. - Username *string `json:"username,omitempty"` -} + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags,omitempty"` -// Constants associated with the BareMetalServerInitializationUserAccount.ResourceType property. -// The resource type. -const ( - BareMetalServerInitializationUserAccountResourceTypeHostUserAccountConst = "host_user_account" -) + // 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"` -func (*BareMetalServerInitializationUserAccount) isaBareMetalServerInitializationUserAccount() bool { - return true -} + DeletionTrigger *BackupPolicyPlanDeletionTriggerPatch `json:"deletion_trigger,omitempty"` -type BareMetalServerInitializationUserAccountIntf interface { - isaBareMetalServerInitializationUserAccount() bool + // 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"` } -// 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) +// 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 { return } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPatch) if err != nil { return } - err = core.UnmarshalPrimitive(m, "username", &obj.Username) + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerLifecycleReason : BareMetalServerLifecycleReason struct -type BareMetalServerLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. - 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 BareMetalServerLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. -const ( - BareMetalServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// 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) + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) if err != nil { return } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPatch) if err != nil { return } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) if err != nil { return } @@ -24641,214 +24836,87 @@ func UnmarshalBareMetalServerLifecycleReason(m map[string]json.RawMessage, resul return } -// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct -// Models which "extend" this model: -// - BareMetalServerNetworkInterfaceByHiperSocket -// - BareMetalServerNetworkInterfaceByPci -// - BareMetalServerNetworkInterfaceByVlan -type BareMetalServerNetworkInterface 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" validate:"required"` - - // The date and time that the network interface was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` +// 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) + } + return +} - // 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 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"` +// BackupPolicyPlanPrototype : BackupPolicyPlanPrototype struct +type BackupPolicyPlanPrototype struct { + // Indicates whether the plan is active. + Active *bool `json:"active,omitempty"` - // The floating IPs associated with this network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` + // 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"` - // The URL for this network interface. - Href *string `json:"href" validate:"required"` + ClonePolicy *BackupPolicyPlanClonePolicyPrototype `json:"clone_policy,omitempty"` - // The unique identifier for this network interface. - ID *string `json:"id" validate:"required"` + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags,omitempty"` - // The network interface type: - // - `hipersocket`: a virtual network 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 VLAN 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. + // 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 enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The MAC address of the interface. If absent, the value is not known. - MacAddress *string `json:"mac_address" validate:"required"` - - // The name for this network interface. - Name *string `json:"name" validate:"required"` - - // The network interface port speed in Mbps. - 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 network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the network interface. - Status *string `json:"status" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The type of this bare metal server network interface. - Type *string `json:"type" validate:"required"` - - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - - // Indicates if the interface can float to any other server within the same - // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal - // server in the resource group. Applies only to `vlan` type interfaces. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` - - // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. - Vlan *int64 `json:"vlan,omitempty"` -} - -// Constants associated with the BareMetalServerNetworkInterface.InterfaceType property. -// The network interface type: -// - `hipersocket`: a virtual network 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 VLAN 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. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - BareMetalServerNetworkInterfaceInterfaceTypeHipersocketConst = "hipersocket" - BareMetalServerNetworkInterfaceInterfaceTypePciConst = "pci" - BareMetalServerNetworkInterfaceInterfaceTypeVlanConst = "vlan" -) - -// Constants associated with the BareMetalServerNetworkInterface.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" -) + // All backup schedules for plans in the same policy must be at least an hour apart. + CronSpec *string `json:"cron_spec" validate:"required"` -// Constants associated with the BareMetalServerNetworkInterface.Status property. -// The status of the network interface. -const ( - BareMetalServerNetworkInterfaceStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceStatusPendingConst = "pending" -) + DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"` -// Constants associated with the BareMetalServerNetworkInterface.Type property. -// The type of this bare metal server network interface. -const ( - BareMetalServerNetworkInterfaceTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceTypeSecondaryConst = "secondary" -) + // 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"` -func (*BareMetalServerNetworkInterface) isaBareMetalServerNetworkInterface() bool { - return true + // The policies for additional backups in remote regions. + RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` } -type BareMetalServerNetworkInterfaceIntf interface { - isaBareMetalServerNetworkInterface() bool +// 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") + return } -// 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) +// 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 = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) return } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { return } - if discValue == "hipersocket" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByHiperSocket) - } else if discValue == "pci" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByPci) - } else if discValue == "vlan" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByVlan) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPrototype) + if err != nil { + return } - return -} - -// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct -type BareMetalServerNetworkInterfaceCollection struct { - // A link to the first page of resources. - First *BareMetalServerNetworkInterfaceCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // Collection of network interfaces. - 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"` - - // 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) + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) if err != nil { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) if err != nil { return } @@ -24856,93 +24924,59 @@ func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMes return } -// 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 || start == nil { - return nil, err - } - return start, nil -} +// BackupPolicyPlanReference : BackupPolicyPlanReference struct +type BackupPolicyPlanReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BackupPolicyPlanReferenceDeleted `json:"deleted,omitempty"` -// BareMetalServerNetworkInterfaceCollectionFirst : A link to the first page of resources. -type BareMetalServerNetworkInterfaceCollectionFirst struct { - // The URL for a page of resources. + // 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 name for this backup policy plan. The name is unique across all plans in the backup policy. + 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 resource type. + ResourceType *string `json:"resource_type" 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) +// 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, UnmarshalBackupPolicyPlanReferenceDeleted) if err != nil { 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 { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct -type BareMetalServerNetworkInterfacePatch 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"` - - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) 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 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,omitempty"` - - // The name for this network interface. The name must not be used by another network interface on the bare metal - // server. - Name *string `json:"name,omitempty"` -} - -// 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) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalBackupPolicyPlanRemote) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -24950,169 +24984,67 @@ func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, 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) - } - return +// BackupPolicyPlanReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BackupPolicyPlanReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` } -// BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct -// Models which "extend" this model: -// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype -// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype -// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype -type BareMetalServerNetworkInterfacePrototype 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"` - - // 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 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,omitempty"` - - // The network interface type: - // - `hipersocket`: a virtual network 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 VLAN 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 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 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 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 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"` - - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - - // Indicates if the interface can float to any other server within the same - // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal - // server in the resource group. Applies only to `vlan` type interfaces. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` - - // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. - Vlan *int64 `json:"vlan,omitempty"` -} - -// Constants associated with the BareMetalServerNetworkInterfacePrototype.InterfaceType property. -// The network interface type: -// - `hipersocket`: a virtual network 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 VLAN 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 +// UnmarshalBackupPolicyPlanReferenceDeleted unmarshals an instance of BackupPolicyPlanReferenceDeleted from the specified map of raw messages. +func UnmarshalBackupPolicyPlanReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -type BareMetalServerNetworkInterfacePrototypeIntf interface { - isaBareMetalServerNetworkInterfacePrototype() bool +// 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"` } -// 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) +// 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 = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) - return - } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") return } - if discValue == "hipersocket" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - } else if discValue == "pci" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) - } else if discValue == "vlan" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) - } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerPatch : BareMetalServerPatch struct -type BareMetalServerPatch struct { - // 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"` +// 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 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 root key used to rewrap the data encryption key for the backup (snapshot). + EncryptionKey *EncryptionKeyReference `json:"encryption_key" validate:"required"` - TrustedPlatformModule *BareMetalServerTrustedPlatformModulePatch `json:"trusted_platform_module,omitempty"` + // The region this backup policy plan will create backups in. + Region *RegionReference `json:"region" 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, "enable_secure_boot", &obj.EnableSecureBoot) +// 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 { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) if err != nil { return } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) if err != nil { return } @@ -25120,124 +25052,42 @@ func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interfac 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) - } - return -} - -// BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct -type BareMetalServerPrimaryNetworkInterfacePrototype 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"` - - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) 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 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,omitempty"` - - // The network interface type: - // - `hipersocket`: a virtual network 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 VLAN tag. - // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. - InterfaceType *string `json:"interface_type,omitempty"` - - // The name for this 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"` +// BackupPolicyPlanRemoteRegionPolicyPrototype : BackupPolicyPlanRemoteRegionPolicyPrototype struct +type BackupPolicyPlanRemoteRegionPolicyPrototype struct { + // The region this backup policy plan will create backups in. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` - // The primary IP address to bind to the network interface. This can be specified using - // an existing reserved IP, or a prototype object for a new reserved IP. + // The root key to use to rewrap the data encryption key for the backup (snapshot). // - // If an existing reserved IP or a prototype object with an address is specified, it must - // be available on the 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 network interface. If unspecified, the VPC's default security group is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + // 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 associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + // The region this backup policy plan will create backups in. + Region RegionIdentityIntf `json:"region" validate:"required"` } -// Constants associated with the BareMetalServerPrimaryNetworkInterfacePrototype.InterfaceType property. -// The network interface type: -// - `hipersocket`: a virtual network 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 VLAN tag. -// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. -const ( - BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" - BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypePciConst = "pci" -) - -// NewBareMetalServerPrimaryNetworkInterfacePrototype : Instantiate BareMetalServerPrimaryNetworkInterfacePrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrimaryNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *BareMetalServerPrimaryNetworkInterfacePrototype, err error) { - _model = &BareMetalServerPrimaryNetworkInterfacePrototype{ - Subnet: subnet, +// 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") return } -// 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 { - return - } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) +// 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 { return } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionIdentity) if err != nil { return } @@ -25245,78 +25095,148 @@ func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json. return } -// BareMetalServerProfile : BareMetalServerProfile struct -type BareMetalServerProfile struct { - Bandwidth BareMetalServerProfileBandwidthIntf `json:"bandwidth" validate:"required"` +// BareMetalServer : BareMetalServer struct +type BareMetalServer struct { + // The total bandwidth (in megabits per second) shared across the bare metal server network interfaces. + Bandwidth *int64 `json:"bandwidth" validate:"required"` - // The console type configuration for a bare metal server with this profile. - ConsoleTypes *BareMetalServerProfileConsoleTypes `json:"console_types" validate:"required"` + // The possible resource types for this property are expected to expand in the future. + BootTarget BareMetalServerBootTargetIntf `json:"boot_target" validate:"required"` - CpuArchitecture *BareMetalServerProfileCpuArchitecture `json:"cpu_architecture" validate:"required"` + // The bare metal server CPU configuration. + Cpu *BareMetalServerCpu `json:"cpu" validate:"required"` - CpuCoreCount BareMetalServerProfileCpuCoreCountIntf `json:"cpu_core_count" validate:"required"` + // The date and time that the bare metal server was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - CpuSocketCount BareMetalServerProfileCpuSocketCountIntf `json:"cpu_socket_count" validate:"required"` + // The CRN for this bare metal server. + CRN *string `json:"crn" validate:"required"` - // Collection of the bare metal server profile's disks. - Disks []BareMetalServerProfileDisk `json:"disks" 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 product family this bare metal server profile belongs to. - Family *string `json:"family" 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 bare metal server profile. + // The URL for this bare metal server. Href *string `json:"href" validate:"required"` - Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` + // The unique identifier for this bare metal server. + ID *string `json:"id" validate:"required"` - // The name for this bare metal server profile. + // The reasons for the current `lifecycle_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []BareMetalServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the bare metal server. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // 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"` - NetworkInterfaceCount BareMetalServerProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` + // The network interfaces for this bare metal server, including the primary network interface. + NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces" validate:"required"` - OsArchitecture *BareMetalServerProfileOsArchitecture `json:"os_architecture" validate:"required"` + // The primary network interface for this bare metal server. + PrimaryNetworkInterface *NetworkInterfaceBareMetalServerContextReference `json:"primary_network_interface" 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 bare metal server. + ResourceGroup *ResourceGroupReference `json:"resource_group" 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"` + // The status of the bare metal server. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + 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 BareMetalServerProfile.ResourceType property. +// 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. // The resource type. const ( - BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" + BareMetalServerResourceTypeBareMetalServerConst = "bare_metal_server" ) -// 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) +// Constants associated with the BareMetalServer.Status property. +// The status of the bare metal server. +const ( + BareMetalServerStatusDeletingConst = "deleting" + BareMetalServerStatusFailedConst = "failed" + BareMetalServerStatusMaintenanceConst = "maintenance" + BareMetalServerStatusPendingConst = "pending" + BareMetalServerStatusRestartingConst = "restarting" + BareMetalServerStatusRunningConst = "running" + BareMetalServerStatusStartingConst = "starting" + BareMetalServerStatusStoppedConst = "stopped" + BareMetalServerStatusStoppingConst = "stopping" +) + +// 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 { return } - err = core.UnmarshalModel(m, "console_types", &obj.ConsoleTypes, UnmarshalBareMetalServerProfileConsoleTypes) + err = core.UnmarshalModel(m, "boot_target", &obj.BootTarget, UnmarshalBareMetalServerBootTarget) if err != nil { return } - err = core.UnmarshalModel(m, "cpu_architecture", &obj.CpuArchitecture, UnmarshalBareMetalServerProfileCpuArchitecture) + err = core.UnmarshalModel(m, "cpu", &obj.Cpu, UnmarshalBareMetalServerCpu) if err != nil { return } - err = core.UnmarshalModel(m, "cpu_core_count", &obj.CpuCoreCount, UnmarshalBareMetalServerProfileCpuCoreCount) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalModel(m, "cpu_socket_count", &obj.CpuSocketCount, UnmarshalBareMetalServerProfileCpuSocketCount) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerProfileDisk) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) if err != nil { return } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { return } @@ -25324,7 +25244,19 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf if err != nil { return } - err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalBareMetalServerLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) if err != nil { return } @@ -25332,11 +25264,19 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf if err != nil { return } - err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalBareMetalServerProfileNetworkInterfaceCount) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) if err != nil { return } - err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceBareMetalServerContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -25344,7 +25284,23 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf if err != nil { return } - err = core.UnmarshalModel(m, "supported_trusted_platform_module_modes", &obj.SupportedTrustedPlatformModuleModes, UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes) + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBareMetalServerStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModule) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) if err != nil { return } @@ -25352,77 +25308,61 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf return } -// BareMetalServerProfileBandwidth : BareMetalServerProfileBandwidth struct +// BareMetalServerBootTarget : The possible resource types for this property are expected to expand 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"` +// - BareMetalServerBootTargetBareMetalServerDiskReference +type BareMetalServerBootTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerDiskReferenceDeleted `json:"deleted,omitempty"` - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` + // The URL for this bare metal server disk. + Href *string `json:"href,omitempty"` - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // The unique identifier for this bare metal server disk. + ID *string `json:"id,omitempty"` - // The increment step value for this profile field. - Step *int64 `json:"step,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 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 BareMetalServerBootTarget.ResourceType property. +// The resource type. const ( - BareMetalServerProfileBandwidthTypeFixedConst = "fixed" + BareMetalServerBootTargetResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" ) -func (*BareMetalServerProfileBandwidth) isaBareMetalServerProfileBandwidth() bool { +func (*BareMetalServerBootTarget) isaBareMetalServerBootTarget() bool { return true } -type BareMetalServerProfileBandwidthIntf interface { - isaBareMetalServerProfileBandwidth() bool +type BareMetalServerBootTargetIntf interface { + isaBareMetalServerBootTarget() 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 { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) +// 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, UnmarshalBareMetalServerDiskReferenceDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -25430,36 +25370,37 @@ func UnmarshalBareMetalServerProfileBandwidth(m map[string]json.RawMessage, resu return } -// BareMetalServerProfileCpuArchitecture : BareMetalServerProfileCpuArchitecture struct -type BareMetalServerProfileCpuArchitecture struct { - // The default CPU architecture for a bare metal server with this profile. - Default *string `json:"default,omitempty"` +// BareMetalServerCpu : The bare metal server CPU configuration. +type BareMetalServerCpu struct { + // The CPU architecture. + Architecture *string `json:"architecture" validate:"required"` - // The type for this profile field. - Type *string `json:"type" validate:"required"` + // The total number of cores. + CoreCount *int64 `json:"core_count" validate:"required"` - // The CPU architecture for a bare metal server with this profile. - Value *string `json:"value" validate:"required"` -} + // The total number of CPU sockets. + SocketCount *int64 `json:"socket_count" validate:"required"` -// Constants associated with the BareMetalServerProfileCpuArchitecture.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuArchitectureTypeFixedConst = "fixed" -) + // The total number of hardware threads per core. + ThreadsPerCore *int64 `json:"threads_per_core" validate:"required"` +} -// 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "core_count", &obj.CoreCount) if err != nil { return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "threads_per_core", &obj.ThreadsPerCore) if err != nil { return } @@ -25467,77 +25408,91 @@ func UnmarshalBareMetalServerProfileCpuArchitecture(m map[string]json.RawMessage 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"` +// BareMetalServerCollection : BareMetalServerCollection struct +type BareMetalServerCollection struct { + // Collection of bare metal servers. + BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} + // A link to the first page of resources. + First *BareMetalServerCollectionFirst `json:"first" validate:"required"` -// Constants associated with the BareMetalServerProfileCpuCoreCount.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuCoreCountTypeFixedConst = "fixed" -) + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` -func (*BareMetalServerProfileCpuCoreCount) isaBareMetalServerProfileCpuCoreCount() bool { - return true -} + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *BareMetalServerCollectionNext `json:"next,omitempty"` -type BareMetalServerProfileCpuCoreCountIntf interface { - isaBareMetalServerProfileCpuCoreCount() bool + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerCollectionFirst) if err != nil { return } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerCollectionNext) if err != nil { return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + 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 *BareMetalServerCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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"` +} + +// 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) if err != nil { return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + 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"` +} + +// 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) if err != nil { return } @@ -25545,77 +25500,59 @@ func UnmarshalBareMetalServerProfileCpuCoreCount(m map[string]json.RawMessage, r 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"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` +// 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"` - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` + // The bare metal server console type for which this token may be used. + ConsoleType *string `json:"console_type" validate:"required"` - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` + // The date and time that the access token was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // The date and time that the access token will expire. + ExpiresAt *strfmt.DateTime `json:"expires_at" validate:"required"` - // The increment step value for this profile field. - Step *int64 `json:"step,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 permitted values for this profile field. - Values []int64 `json:"values,omitempty"` + // The URL to access this bare metal server console. + Href *string `json:"href" validate:"required"` } -// Constants associated with the BareMetalServerProfileCpuSocketCount.Type property. -// The type for this profile field. +// Constants associated with the BareMetalServerConsoleAccessToken.ConsoleType property. +// The bare metal server console type for which this token may be used. const ( - BareMetalServerProfileCpuSocketCountTypeFixedConst = "fixed" + BareMetalServerConsoleAccessTokenConsoleTypeSerialConst = "serial" + BareMetalServerConsoleAccessTokenConsoleTypeVncConst = "vnc" ) -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 { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) +// 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 { return } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalPrimitive(m, "force", &obj.Force) if err != nil { return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -25623,45 +25560,88 @@ func UnmarshalBareMetalServerProfileCpuSocketCount(m map[string]json.RawMessage, return } -// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct -type BareMetalServerProfileCollection struct { - // A link to the first page of resources. - First *BareMetalServerProfileCollectionFirst `json:"first" validate:"required"` +// BareMetalServerDisk : BareMetalServerDisk struct +type BareMetalServerDisk struct { + // The date and time that the disk was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` + // The URL for this bare metal server disk. + Href *string `json:"href" 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"` + // The unique identifier for this bare metal server disk. + ID *string `json:"id" validate:"required"` - // Collection of bare metal server profiles. - Profiles []BareMetalServerProfile `json:"profiles" validate:"required"` + // The disk interface used for attaching the disk. + // + // - `fcp`: Attached using Fiber Channel Protocol + // - `sata`: Attached using Serial Advanced Technology Attachment + // - `nvme`: Attached using Non-Volatile Memory Express + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" 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 size of the disk in GB (gigabytes). + Size *int64 `json:"size" 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) +// Constants associated with the BareMetalServerDisk.InterfaceType property. +// The disk interface used for attaching the disk. +// +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerDiskInterfaceTypeFcpConst = "fcp" + BareMetalServerDiskInterfaceTypeNvmeConst = "nvme" + BareMetalServerDiskInterfaceTypeSataConst = "sata" +) + +// Constants associated with the BareMetalServerDisk.ResourceType property. +// The resource type. +const ( + BareMetalServerDiskResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" +) + +// 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 { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerProfileCollectionNext) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalBareMetalServerProfile) + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { return } @@ -25669,28 +25649,33 @@ func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, res return } -// Retrieve the value to be passed to a request to access the next page of results -func (resp *BareMetalServerProfileCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err +// BareMetalServerDiskCollection : BareMetalServerDiskCollection struct +type BareMetalServerDiskCollection struct { + // Collection of the bare metal server's disks. + 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 { + return } - return start, nil + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// 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"` +// 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"` } -// 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) +// 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 { return } @@ -25698,16 +25683,27 @@ func UnmarshalBareMetalServerProfileCollectionFirst(m map[string]json.RawMessage return } -// 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"` +// 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) + } + return } -// 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) +// BareMetalServerDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerDiskReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerDiskReferenceDeleted unmarshals an instance of BareMetalServerDiskReferenceDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDiskReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } @@ -25715,36 +25711,31 @@ func UnmarshalBareMetalServerProfileCollectionNext(m map[string]json.RawMessage, return } -// 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"` -} +// BareMetalServerInitialization : BareMetalServerInitialization struct +type BareMetalServerInitialization struct { + // The image the bare metal server was provisioned from. + Image *ImageReference `json:"image" validate:"required"` -// Constants associated with the BareMetalServerProfileConsoleTypes.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileConsoleTypesTypeEnumConst = "enum" -) + // The public SSH keys used at initialization. + Keys []KeyReference `json:"keys" validate:"required"` -// Constants associated with the BareMetalServerProfileConsoleTypes.Values property. -// A console type. -const ( - BareMetalServerProfileConsoleTypesValuesSerialConst = "serial" - BareMetalServerProfileConsoleTypesValuesVncConst = "vnc" -) + // 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"` +} -// 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "user_accounts", &obj.UserAccounts, UnmarshalBareMetalServerInitializationUserAccount) if err != nil { return } @@ -25752,27 +25743,46 @@ func UnmarshalBareMetalServerProfileConsoleTypes(m map[string]json.RawMessage, r return } -// BareMetalServerProfileDisk : Disks provided by this profile. -type BareMetalServerProfileDisk struct { - Quantity BareMetalServerProfileDiskQuantityIntf `json:"quantity" validate:"required"` +// BareMetalServerInitializationPrototype : BareMetalServerInitializationPrototype struct +type BareMetalServerInitializationPrototype struct { + // The image to be used when provisioning the bare metal server. + Image ImageIdentityIntf `json:"image" validate:"required"` - Size BareMetalServerProfileDiskSizeIntf `json:"size" 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"` - SupportedInterfaceTypes *BareMetalServerProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` + // User data to be made available when initializing the bare metal server. + UserData *string `json:"user_data,omitempty"` } -// 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) +// 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") + return +} + +// 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 { return } - err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalBareMetalServerProfileDiskSize) + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalBareMetalServerProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) if err != nil { return } @@ -25780,77 +25790,53 @@ func UnmarshalBareMetalServerProfileDisk(m map[string]json.RawMessage, result in return } -// BareMetalServerProfileDiskQuantity : BareMetalServerProfileDiskQuantity struct +// BareMetalServerInitializationUserAccount : BareMetalServerInitializationUserAccount 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"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` - - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` +// - BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount +type BareMetalServerInitializationUserAccount struct { + // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. + EncryptedPassword *[]byte `json:"encrypted_password,omitempty"` - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // The public SSH key used to encrypt the password. + EncryptionKey *KeyReference `json:"encryption_key,omitempty"` - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` + // The username for the account created at initialization. + Username *string `json:"username,omitempty"` } -// Constants associated with the BareMetalServerProfileDiskQuantity.Type property. -// The type for this profile field. +// Constants associated with the BareMetalServerInitializationUserAccount.ResourceType property. +// The resource type. const ( - BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" + BareMetalServerInitializationUserAccountResourceTypeHostUserAccountConst = "host_user_account" ) -func (*BareMetalServerProfileDiskQuantity) isaBareMetalServerProfileDiskQuantity() bool { +func (*BareMetalServerInitializationUserAccount) isaBareMetalServerInitializationUserAccount() bool { return true } -type BareMetalServerProfileDiskQuantityIntf interface { - isaBareMetalServerProfileDiskQuantity() bool +type BareMetalServerInitializationUserAccountIntf interface { + isaBareMetalServerInitializationUserAccount() 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "username", &obj.Username) if err != nil { return } @@ -25858,77 +25844,36 @@ func UnmarshalBareMetalServerProfileDiskQuantity(m map[string]json.RawMessage, r 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"` - - // 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"` +// BareMetalServerLifecycleReason : BareMetalServerLifecycleReason struct +type BareMetalServerLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 BareMetalServerProfileDiskSize.Type property. -// The type for this profile field. +// Constants associated with the BareMetalServerLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. const ( - BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" + BareMetalServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) -func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { - return true -} - -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 { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) +// 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 { return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalPrimitive(m, "message", &obj.Message) if err != nil { return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } @@ -25936,189 +25881,214 @@ func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, resul return } -// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct -type BareMetalServerProfileDiskSupportedInterfaces struct { - // The disk interface used for attaching the disk. +// 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. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + + // The date and time that the bare metal server 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. // - // - `fcp`: Attached using Fiber Channel Protocol - // - `sata`: Attached using Serial Advanced Technology Attachment - // - `nvme`: Attached using Non-Volatile Memory Express + // 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`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + + // The floating IPs associated with this bare metal server network interface. + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` + + // The URL for this bare metal server network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server network interface. + 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 VLAN 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. // // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. - Default *string `json:"default" validate:"required"` + InterfaceType *string `json:"interface_type" validate:"required"` - // The type for this profile field. + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. + MacAddress *string `json:"mac_address" validate:"required"` + + // The name for this bare metal server network interface. + Name *string `json:"name" validate:"required"` + + // The bare metal server network interface port speed in Mbps. + 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. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the bare metal server network interface. + Status *string `json:"status" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The bare metal server network interface type. Type *string `json:"type" validate:"required"` - // The supported disk interfaces used for attaching the disk. - Values []string `json:"values" validate:"required"` + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // Indicates if the interface can float to any other server within the same + // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal + // server in the resource group. Applies only to `vlan` type interfaces. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + + // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + Vlan *int64 `json:"vlan,omitempty"` } -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. -// The disk interface used for attaching the disk. -// -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using Non-Volatile Memory Express +// 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 VLAN 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. // // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. const ( - BareMetalServerProfileDiskSupportedInterfacesDefaultFcpConst = "fcp" - BareMetalServerProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" - BareMetalServerProfileDiskSupportedInterfacesDefaultSataConst = "sata" + BareMetalServerNetworkInterfaceInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkInterfaceInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfaceInterfaceTypeVlanConst = "vlan" ) -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Type property. -// The type for this profile field. +// Constants associated with the BareMetalServerNetworkInterface.ResourceType property. +// The resource type. const ( - BareMetalServerProfileDiskSupportedInterfacesTypeEnumConst = "enum" + BareMetalServerNetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" ) -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Values property. -// The disk interface used for attaching the disk. -// -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using Non-Volatile Memory Express -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// Constants associated with the BareMetalServerNetworkInterface.Status property. +// The status of the bare metal server network interface. const ( - BareMetalServerProfileDiskSupportedInterfacesValuesFcpConst = "fcp" - BareMetalServerProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" - BareMetalServerProfileDiskSupportedInterfacesValuesSataConst = "sata" + BareMetalServerNetworkInterfaceStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceStatusPendingConst = "pending" ) -// 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 { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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"` -} +// Constants associated with the BareMetalServerNetworkInterface.Type property. +// The bare metal server network interface type. +const ( + BareMetalServerNetworkInterfaceTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceTypeSecondaryConst = "secondary" +) -func (*BareMetalServerProfileIdentity) isaBareMetalServerProfileIdentity() bool { +func (*BareMetalServerNetworkInterface) isaBareMetalServerNetworkInterface() bool { return true } -type BareMetalServerProfileIdentityIntf interface { - isaBareMetalServerProfileIdentity() bool +type BareMetalServerNetworkInterfaceIntf interface { + isaBareMetalServerNetworkInterface() 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) +// 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 = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByHiperSocket) + } else if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByPci) + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByVlan) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + } 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"` - - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` +// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct +type BareMetalServerNetworkInterfaceCollection struct { + // A link to the first page of resources. + First *BareMetalServerNetworkInterfaceCollectionFirst `json:"first" validate:"required"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` -// Constants associated with the BareMetalServerProfileMemory.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileMemoryTypeFixedConst = "fixed" -) + // Collection of bare metal server network interfaces. + NetworkInterfaces []BareMetalServerNetworkInterfaceIntf `json:"network_interfaces" validate:"required"` -func (*BareMetalServerProfileMemory) isaBareMetalServerProfileMemory() bool { - return true -} + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *BareMetalServerNetworkInterfaceCollectionNext `json:"next,omitempty"` -type BareMetalServerProfileMemoryIntf interface { - isaBareMetalServerProfileMemory() bool + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// 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 { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) +// 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) if err != nil { return } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) if err != nil { return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) if err != nil { return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } @@ -26126,47 +26096,28 @@ func UnmarshalBareMetalServerProfileMemory(m map[string]json.RawMessage, result return } -// 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 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 BareMetalServerProfileNetworkInterfaceCount.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileNetworkInterfaceCountTypeRangeConst = "range" -) - -func (*BareMetalServerProfileNetworkInterfaceCount) isaBareMetalServerProfileNetworkInterfaceCount() bool { - return true +// 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 || start == nil { + return nil, err + } + return start, nil } -type BareMetalServerProfileNetworkInterfaceCountIntf interface { - isaBareMetalServerProfileNetworkInterfaceCount() bool +// 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"` } -// 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 { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) +// 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 { return } @@ -26174,36 +26125,16 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCount(m map[string]json.RawM 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"` +// 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"` } -// 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) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) +// 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 { return } @@ -26211,36 +26142,46 @@ func UnmarshalBareMetalServerProfileOsArchitecture(m map[string]json.RawMessage, return } -// BareMetalServerProfileReference : BareMetalServerProfileReference struct -type BareMetalServerProfileReference struct { - // The URL for this bare metal server profile. - Href *string `json:"href" validate:"required"` +// BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct +type BareMetalServerNetworkInterfacePatch struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // The name for this bare metal server profile. - Name *string `json:"name" validate:"required"` + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // The resource type. - ResourceType *string `json:"resource_type" 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`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` -// Constants associated with the BareMetalServerProfileReference.ResourceType property. -// The resource type. -const ( - BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" -) + // 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"` +} -// 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -26248,186 +26189,152 @@ 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 type for this profile field. - Type *string `json:"type" validate:"required"` - - // The supported trusted platform module modes. - Values []string `json:"values" validate:"required"` +// 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) + } + return } -// 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 are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" -) +// 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. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` -// 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, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // 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`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` -// 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. - Code *string `json:"code" 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 VLAN 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"` - // An explanation of the status reason. - Message *string `json:"message" 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"` - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,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"` -// 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. -const ( - BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" - BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" - BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" - BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" - BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" -) + // 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"` -// 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 { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` -// BareMetalServerTrustedPlatformModule : BareMetalServerTrustedPlatformModule struct -type BareMetalServerTrustedPlatformModule struct { - // Indicates whether the trusted platform module is enabled. - Enabled *bool `json:"enabled" validate:"required"` + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // The trusted platform module (TPM) mode: - // - `disabled`: No TPM functionality - // - `tpm_2`: TPM 2.0 - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - Mode *string `json:"mode" validate:"required"` + // Indicates if the interface can float to any other server within the same + // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal + // server in the resource group. Applies only to `vlan` type interfaces. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` - // The supported trusted platform module modes. - SupportedModes []string `json:"supported_modes" validate:"required"` + // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + Vlan *int64 `json:"vlan,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 are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// 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 VLAN 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 ( - BareMetalServerTrustedPlatformModuleModeDisabledConst = "disabled" - BareMetalServerTrustedPlatformModuleModeTpm2Const = "tpm_2" + BareMetalServerNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkInterfacePrototypeInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfacePrototypeInterfaceTypeVlanConst = "vlan" ) -// 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 are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - BareMetalServerTrustedPlatformModuleSupportedModesDisabledConst = "disabled" - BareMetalServerTrustedPlatformModuleSupportedModesTpm2Const = "tpm_2" -) +func (*BareMetalServerNetworkInterfacePrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} -// 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) +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) if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) return } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") return } - err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) - if err != nil { - return + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + } else if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) } - 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"` +// BareMetalServerNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkInterfaceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" 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" -) - -// 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) +// UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } @@ -26435,25 +26342,17 @@ func UnmarshalBareMetalServerTrustedPlatformModulePatch(m map[string]json.RawMes 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`. - Mode *string `json:"mode,omitempty"` +// BareMetalServerNetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkInterfaceReferenceTargetContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` } -// 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`. -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) +// UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } @@ -26461,75 +26360,34 @@ func UnmarshalBareMetalServerTrustedPlatformModulePrototype(m map[string]json.Ra 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"` -} +// BareMetalServerPatch : BareMetalServerPatch struct +type BareMetalServerPatch struct { + // 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"` -func (*CatalogOfferingIdentity) isaCatalogOfferingIdentity() bool { - return true -} + // 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"` -type CatalogOfferingIdentityIntf interface { - isaCatalogOfferingIdentity() bool + TrustedPlatformModule *BareMetalServerTrustedPlatformModulePatch `json:"trusted_platform_module,omitempty"` } -// 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) +// 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, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { 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"` -} - -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) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { 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.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) if err != nil { return } @@ -26537,43 +26395,124 @@ func UnmarshalCatalogOfferingVersionReference(m map[string]json.RawMessage, resu 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"` +// 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) + } + return } -func (*CertificateInstanceIdentity) isaCertificateInstanceIdentity() bool { - return true -} +// BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct +type BareMetalServerPrimaryNetworkInterfacePrototype struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` -type CertificateInstanceIdentityIntf interface { - isaCertificateInstanceIdentity() bool + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) 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`. + 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 VLAN 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 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"` } -// 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 { - return +// 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 VLAN tag. +// - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. +const ( + BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypePciConst = "pci" +) + +// NewBareMetalServerPrimaryNetworkInterfacePrototype : Instantiate BareMetalServerPrimaryNetworkInterfacePrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrimaryNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *BareMetalServerPrimaryNetworkInterfacePrototype, err error) { + _model = &BareMetalServerPrimaryNetworkInterfacePrototype{ + Subnet: subnet, } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + err = core.ValidateStruct(_model, "required parameters") 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) +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { return } @@ -26581,150 +26520,184 @@ func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result return } -// CheckVPNGatewayConnectionLocalCIDROptions : The CheckVPNGatewayConnectionLocalCIDR options. -type CheckVPNGatewayConnectionLocalCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` +// BareMetalServerProfile : BareMetalServerProfile struct +type BareMetalServerProfile struct { + Bandwidth BareMetalServerProfileBandwidthIntf `json:"bandwidth" validate:"required"` - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` + // The console type configuration for a bare metal server with this profile. + ConsoleTypes *BareMetalServerProfileConsoleTypes `json:"console_types" validate:"required"` - // The address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + CpuArchitecture *BareMetalServerProfileCpuArchitecture `json:"cpu_architecture" validate:"required"` - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` + CpuCoreCount BareMetalServerProfileCpuCoreCountIntf `json:"cpu_core_count" validate:"required"` - // Allows users to set headers on API requests - Headers map[string]string -} + CpuSocketCount BareMetalServerProfileCpuSocketCountIntf `json:"cpu_socket_count" validate:"required"` -// NewCheckVPNGatewayConnectionLocalCIDROptions : Instantiate CheckVPNGatewayConnectionLocalCIDROptions -func (*VpcV1) NewCheckVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { - return &CheckVPNGatewayConnectionLocalCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), - } -} + // Collection of the bare metal server profile's disks. + Disks []BareMetalServerProfileDisk `json:"disks" validate:"required"` -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionLocalCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} + // The product family this bare metal server profile belongs to. + Family *string `json:"family" validate:"required"` -// SetID : Allow user to set ID -func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetID(id string) *CheckVPNGatewayConnectionLocalCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} + // The URL for this bare metal server profile. + Href *string `json:"href" validate:"required"` -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *CheckVPNGatewayConnectionLocalCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} + Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` -// SetPrefixLength : Allow user to set PrefixLength -func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) - return _options -} + // The name for this bare metal server profile. + Name *string `json:"name" validate:"required"` -// SetHeaders : Allow user to set Headers -func (options *CheckVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionLocalCIDROptions { - options.Headers = param - return options -} + NetworkInterfaceCount BareMetalServerProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` -// CheckVPNGatewayConnectionPeerCIDROptions : The CheckVPNGatewayConnectionPeerCIDR options. -type CheckVPNGatewayConnectionPeerCIDROptions 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 address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + OsArchitecture *BareMetalServerProfileOsArchitecture `json:"os_architecture" validate:"required"` - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` - // Allows users to set headers on API requests - Headers map[string]string + // The supported trusted platform module modes for this bare metal server profile. + SupportedTrustedPlatformModuleModes *BareMetalServerProfileSupportedTrustedPlatformModuleModes `json:"supported_trusted_platform_module_modes" validate:"required"` } -// NewCheckVPNGatewayConnectionPeerCIDROptions : Instantiate CheckVPNGatewayConnectionPeerCIDROptions -func (*VpcV1) NewCheckVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionPeerCIDROptions { - return &CheckVPNGatewayConnectionPeerCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), +// Constants associated with the BareMetalServerProfile.ResourceType property. +// The resource type. +const ( + BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +// 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 { + return + } + err = core.UnmarshalModel(m, "console_types", &obj.ConsoleTypes, UnmarshalBareMetalServerProfileConsoleTypes) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_architecture", &obj.CpuArchitecture, UnmarshalBareMetalServerProfileCpuArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_core_count", &obj.CpuCoreCount, UnmarshalBareMetalServerProfileCpuCoreCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_socket_count", &obj.CpuSocketCount, UnmarshalBareMetalServerProfileCpuSocketCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerProfileDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalBareMetalServerProfileNetworkInterfaceCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_trusted_platform_module_modes", &obj.SupportedTrustedPlatformModuleModes, UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionPeerCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} +// 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"` -// SetID : Allow user to set ID -func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetID(id string) *CheckVPNGatewayConnectionPeerCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} + // The value for this profile field. + Value *int64 `json:"value,omitempty"` -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *CheckVPNGatewayConnectionPeerCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` -// SetPrefixLength : Allow user to set PrefixLength -func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *CheckVPNGatewayConnectionPeerCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) - return _options -} + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *CheckVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionPeerCIDROptions { - options.Headers = param - return options -} + // The minimum value for this profile field. + Min *int64 `json:"min,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. - Name *string `json:"name,omitempty"` + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` - // The CRN of this Cloud Object Storage bucket. - CRN *string `json:"crn,omitempty"` + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` } -func (*CloudObjectStorageBucketIdentity) isaCloudObjectStorageBucketIdentity() bool { +// Constants associated with the BareMetalServerProfileBandwidth.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileBandwidth) isaBareMetalServerProfileBandwidth() bool { return true } -type CloudObjectStorageBucketIdentityIntf interface { - isaCloudObjectStorageBucketIdentity() bool +type BareMetalServerProfileBandwidthIntf interface { + isaBareMetalServerProfileBandwidth() 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -26732,40 +26705,36 @@ func UnmarshalCloudObjectStorageBucketIdentity(m map[string]json.RawMessage, res return } -// CloudObjectStorageBucketReference : CloudObjectStorageBucketReference struct -type CloudObjectStorageBucketReference struct { - // The CRN of this Cloud Object Storage bucket. - CRN *string `json:"crn" validate:"required"` +// BareMetalServerProfileCpuArchitecture : BareMetalServerProfileCpuArchitecture struct +type BareMetalServerProfileCpuArchitecture struct { + // The default CPU architecture for a bare metal server with this profile. + Default *string `json:"default,omitempty"` - // The globally unique name of this Cloud Object Storage bucket. - Name *string `json:"name" validate:"required"` + // 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"` } -// 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { 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, "value", &obj.Value) if err != nil { return } @@ -26773,414 +26742,1720 @@ func UnmarshalCloudObjectStorageObjectReference(m map[string]json.RawMessage, re return } -// CreateBackupPolicyOptions : The CreateBackupPolicy options. -type CreateBackupPolicyOptions struct { - // 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"` +// 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"` - // A 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. - MatchResourceTypes []string `json:"match_resource_types,omitempty"` + // The value for this profile field. + Value *int64 `json:"value,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. - Name *string `json:"name,omitempty"` + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` - // The prototype objects for backup plans to be created for this backup policy. - Plans []BackupPolicyPlanPrototype `json:"plans,omitempty"` + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string + // 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 CreateBackupPolicyOptions.MatchResourceTypes property. -// The resource type. +// Constants associated with the BareMetalServerProfileCpuCoreCount.Type property. +// The type for this profile field. const ( - CreateBackupPolicyOptionsMatchResourceTypesVolumeConst = "volume" + BareMetalServerProfileCpuCoreCountTypeFixedConst = "fixed" ) -// NewCreateBackupPolicyOptions : Instantiate CreateBackupPolicyOptions -func (*VpcV1) NewCreateBackupPolicyOptions(matchUserTags []string) *CreateBackupPolicyOptions { - return &CreateBackupPolicyOptions{ - MatchUserTags: matchUserTags, - } +func (*BareMetalServerProfileCpuCoreCount) isaBareMetalServerProfileCpuCoreCount() bool { + return true } -// SetMatchUserTags : Allow user to set MatchUserTags -func (_options *CreateBackupPolicyOptions) SetMatchUserTags(matchUserTags []string) *CreateBackupPolicyOptions { - _options.MatchUserTags = matchUserTags - return _options +type BareMetalServerProfileCpuCoreCountIntf interface { + isaBareMetalServerProfileCpuCoreCount() bool } -// SetMatchResourceTypes : Allow user to set MatchResourceTypes -func (_options *CreateBackupPolicyOptions) SetMatchResourceTypes(matchResourceTypes []string) *CreateBackupPolicyOptions { - _options.MatchResourceTypes = matchResourceTypes - return _options +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetName : Allow user to set Name -func (_options *CreateBackupPolicyOptions) SetName(name string) *CreateBackupPolicyOptions { - _options.Name = core.StringPtr(name) - return _options -} +// 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"` -// SetPlans : Allow user to set Plans -func (_options *CreateBackupPolicyOptions) SetPlans(plans []BackupPolicyPlanPrototype) *CreateBackupPolicyOptions { - _options.Plans = plans - return _options -} + // The value for this profile field. + Value *int64 `json:"value,omitempty"` -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateBackupPolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateBackupPolicyOptions { - _options.ResourceGroup = resourceGroup - return _options -} + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *CreateBackupPolicyOptions) SetHeaders(param map[string]string) *CreateBackupPolicyOptions { - options.Headers = param - return options -} + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` -// CreateBackupPolicyPlanOptions : The CreateBackupPolicyPlan options. -type CreateBackupPolicyPlanOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + // The minimum value for this profile field. + Min *int64 `json:"min,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"` + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` - // Indicates whether the plan is active. - Active *bool `json:"active,omitempty"` + // The permitted values for this profile field. + Values []int64 `json:"values,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"` +// Constants associated with the BareMetalServerProfileCpuSocketCount.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountTypeFixedConst = "fixed" +) - ClonePolicy *BackupPolicyPlanClonePolicyPrototype `json:"clone_policy,omitempty"` +func (*BareMetalServerProfileCpuSocketCount) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags,omitempty"` +type BareMetalServerProfileCpuSocketCountIntf interface { + isaBareMetalServerProfileCpuSocketCount() bool +} - DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"` +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // 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"` +// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct +type BareMetalServerProfileCollection struct { + // A link to the first page of resources. + First *BareMetalServerProfileCollectionFirst `json:"first" validate:"required"` - // The policies for additional backups in remote regions. - RemoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype `json:"remote_region_policies,omitempty"` + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` - // Allows users to set headers on API requests - Headers map[string]string + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *BareMetalServerProfileCollectionNext `json:"next,omitempty"` + + // Collection 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"` } -// NewCreateBackupPolicyPlanOptions : Instantiate CreateBackupPolicyPlanOptions -func (*VpcV1) NewCreateBackupPolicyPlanOptions(backupPolicyID string, cronSpec string) *CreateBackupPolicyPlanOptions { - return &CreateBackupPolicyPlanOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - CronSpec: core.StringPtr(cronSpec), +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalBareMetalServerProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *CreateBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *CreateBackupPolicyPlanOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BareMetalServerProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil } -// SetCronSpec : Allow user to set CronSpec -func (_options *CreateBackupPolicyPlanOptions) SetCronSpec(cronSpec string) *CreateBackupPolicyPlanOptions { - _options.CronSpec = core.StringPtr(cronSpec) - return _options +// 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"` } -// SetActive : Allow user to set Active -func (_options *CreateBackupPolicyPlanOptions) SetActive(active bool) *CreateBackupPolicyPlanOptions { - _options.Active = core.BoolPtr(active) - return _options -} - -// SetAttachUserTags : Allow user to set AttachUserTags -func (_options *CreateBackupPolicyPlanOptions) SetAttachUserTags(attachUserTags []string) *CreateBackupPolicyPlanOptions { - _options.AttachUserTags = attachUserTags - return _options +// 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetClonePolicy : Allow user to set ClonePolicy -func (_options *CreateBackupPolicyPlanOptions) SetClonePolicy(clonePolicy *BackupPolicyPlanClonePolicyPrototype) *CreateBackupPolicyPlanOptions { - _options.ClonePolicy = clonePolicy - return _options +// 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"` } -// SetCopyUserTags : Allow user to set CopyUserTags -func (_options *CreateBackupPolicyPlanOptions) SetCopyUserTags(copyUserTags bool) *CreateBackupPolicyPlanOptions { - _options.CopyUserTags = core.BoolPtr(copyUserTags) - return _options +// 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetDeletionTrigger : Allow user to set DeletionTrigger -func (_options *CreateBackupPolicyPlanOptions) SetDeletionTrigger(deletionTrigger *BackupPolicyPlanDeletionTriggerPrototype) *CreateBackupPolicyPlanOptions { - _options.DeletionTrigger = deletionTrigger - return _options -} +// 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"` -// SetName : Allow user to set Name -func (_options *CreateBackupPolicyPlanOptions) SetName(name string) *CreateBackupPolicyPlanOptions { - _options.Name = core.StringPtr(name) - return _options + // The console types for a bare metal server with this profile. + Values []string `json:"values" validate:"required"` } -// SetRemoteRegionPolicies : Allow user to set RemoteRegionPolicies -func (_options *CreateBackupPolicyPlanOptions) SetRemoteRegionPolicies(remoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype) *CreateBackupPolicyPlanOptions { - _options.RemoteRegionPolicies = remoteRegionPolicies - return _options -} +// Constants associated with the BareMetalServerProfileConsoleTypes.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileConsoleTypesTypeEnumConst = "enum" +) -// SetHeaders : Allow user to set Headers -func (options *CreateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *CreateBackupPolicyPlanOptions { - options.Headers = param - return options -} +// Constants associated with the BareMetalServerProfileConsoleTypes.Values property. +// A console type. +const ( + BareMetalServerProfileConsoleTypesValuesSerialConst = "serial" + BareMetalServerProfileConsoleTypesValuesVncConst = "vnc" +) -// CreateBareMetalServerConsoleAccessTokenOptions : The CreateBareMetalServerConsoleAccessToken options. -type CreateBareMetalServerConsoleAccessTokenOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The bare metal server console type for which this token may be used - // - // Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`. - ConsoleType *string `json:"console_type" validate:"required"` +// BareMetalServerProfileDisk : Disks provided by this profile. +type BareMetalServerProfileDisk struct { + Quantity BareMetalServerProfileDiskQuantityIntf `json:"quantity" 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,omitempty"` + Size BareMetalServerProfileDiskSizeIntf `json:"size" validate:"required"` - // Allows users to set headers on API requests - Headers map[string]string + SupportedInterfaceTypes *BareMetalServerProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` } -// Constants associated with the CreateBareMetalServerConsoleAccessTokenOptions.ConsoleType property. -// The bare metal server console type for which this token may be used -// -// Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`. -const ( - CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeSerialConst = "serial" - CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeVncConst = "vnc" -) - -// NewCreateBareMetalServerConsoleAccessTokenOptions : Instantiate CreateBareMetalServerConsoleAccessTokenOptions -func (*VpcV1) NewCreateBareMetalServerConsoleAccessTokenOptions(bareMetalServerID string, consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions { - return &CreateBareMetalServerConsoleAccessTokenOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ConsoleType: core.StringPtr(consoleType), +// 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 { + return + } + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalBareMetalServerProfileDiskSize) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalBareMetalServerProfileDiskSupportedInterfaces) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerConsoleAccessTokenOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} +// 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"` -// SetConsoleType : Allow user to set ConsoleType -func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetConsoleType(consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions { - _options.ConsoleType = core.StringPtr(consoleType) - return _options -} + // The value for this profile field. + Value *int64 `json:"value,omitempty"` -// SetForce : Allow user to set Force -func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetForce(force bool) *CreateBareMetalServerConsoleAccessTokenOptions { - _options.Force = core.BoolPtr(force) - return _options -} + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *CreateBareMetalServerConsoleAccessTokenOptions) SetHeaders(param map[string]string) *CreateBareMetalServerConsoleAccessTokenOptions { - options.Headers = param - return options -} + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` -// CreateBareMetalServerNetworkInterfaceOptions : The CreateBareMetalServerNetworkInterface options. -type CreateBareMetalServerNetworkInterfaceOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` - // The network interface prototype object. - BareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf `json:"BareMetalServerNetworkInterfacePrototype" validate:"required"` + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` } -// NewCreateBareMetalServerNetworkInterfaceOptions : Instantiate CreateBareMetalServerNetworkInterfaceOptions -func (*VpcV1) NewCreateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { - return &CreateBareMetalServerNetworkInterfaceOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - BareMetalServerNetworkInterfacePrototype: bareMetalServerNetworkInterfacePrototype, - } -} +// Constants associated with the BareMetalServerProfileDiskQuantity.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" +) -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options +func (*BareMetalServerProfileDiskQuantity) isaBareMetalServerProfileDiskQuantity() bool { + return true } -// SetBareMetalServerNetworkInterfacePrototype : Allow user to set BareMetalServerNetworkInterfacePrototype -func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePrototype(bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototype - return _options +type BareMetalServerProfileDiskQuantityIntf interface { + isaBareMetalServerProfileDiskQuantity() bool } -// SetHeaders : Allow user to set Headers -func (options *CreateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkInterfaceOptions { - options.Headers = param - return options +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// CreateBareMetalServerOptions : The CreateBareMetalServer options. -type CreateBareMetalServerOptions struct { - Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` - - // The primary network interface to create for the bare metal server. - PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface" 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 [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 value for this profile field. + Value *int64 `json:"value,omitempty"` - // The zone this bare metal server will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` + // The default value for this profile field. + Default *int64 `json:"default,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"` + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` - // 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 minimum value for this profile field. + Min *int64 `json:"min,omitempty"` - // The additional network interfaces to create for the bare metal server. - NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} - TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` +// Constants associated with the BareMetalServerProfileDiskSize.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" +) - // The VPC this bare metal server will reside in. - // - // If specified, it must match the VPC for the subnets of the server's network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` +func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { + return true +} - // Allows users to set headers on API requests - Headers map[string]string +type BareMetalServerProfileDiskSizeIntf interface { + isaBareMetalServerProfileDiskSize() bool } -// NewCreateBareMetalServerOptions : Instantiate CreateBareMetalServerOptions -func (*VpcV1) NewCreateBareMetalServerOptions(initialization *BareMetalServerInitializationPrototype, primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf) *CreateBareMetalServerOptions { - return &CreateBareMetalServerOptions{ - Initialization: initialization, - PrimaryNetworkInterface: primaryNetworkInterface, - Profile: profile, - Zone: zone, +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetInitialization : Allow user to set Initialization -func (_options *CreateBareMetalServerOptions) SetInitialization(initialization *BareMetalServerInitializationPrototype) *CreateBareMetalServerOptions { - _options.Initialization = initialization - return _options -} +// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct +type BareMetalServerProfileDiskSupportedInterfaces struct { + // The disk interface used for attaching the disk. + // + // - `fcp`: Attached using Fiber Channel Protocol + // - `sata`: Attached using Serial Advanced Technology Attachment + // - `nvme`: Attached using Non-Volatile Memory Express + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Default *string `json:"default" validate:"required"` -// SetPrimaryNetworkInterface : Allow user to set PrimaryNetworkInterface -func (_options *CreateBareMetalServerOptions) SetPrimaryNetworkInterface(primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype) *CreateBareMetalServerOptions { - _options.PrimaryNetworkInterface = primaryNetworkInterface - return _options -} + // The type for this profile field. + Type *string `json:"type" validate:"required"` -// SetProfile : Allow user to set Profile -func (_options *CreateBareMetalServerOptions) SetProfile(profile BareMetalServerProfileIdentityIntf) *CreateBareMetalServerOptions { - _options.Profile = profile - return _options + // The supported disk interfaces used for attaching the disk. + Values []string `json:"values" validate:"required"` } -// SetZone : Allow user to set Zone -func (_options *CreateBareMetalServerOptions) SetZone(zone ZoneIdentityIntf) *CreateBareMetalServerOptions { - _options.Zone = zone - return _options -} +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. +// The disk interface used for attaching the disk. +// +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerProfileDiskSupportedInterfacesDefaultFcpConst = "fcp" + BareMetalServerProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" + BareMetalServerProfileDiskSupportedInterfacesDefaultSataConst = "sata" +) -// SetEnableSecureBoot : Allow user to set EnableSecureBoot -func (_options *CreateBareMetalServerOptions) SetEnableSecureBoot(enableSecureBoot bool) *CreateBareMetalServerOptions { - _options.EnableSecureBoot = core.BoolPtr(enableSecureBoot) - return _options -} +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSupportedInterfacesTypeEnumConst = "enum" +) -// SetName : Allow user to set Name -func (_options *CreateBareMetalServerOptions) SetName(name string) *CreateBareMetalServerOptions { - _options.Name = core.StringPtr(name) - return _options -} +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Values property. +// The disk interface used for attaching the disk. +// +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerProfileDiskSupportedInterfacesValuesFcpConst = "fcp" + BareMetalServerProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" + BareMetalServerProfileDiskSupportedInterfacesValuesSataConst = "sata" +) -// SetNetworkInterfaces : Allow user to set NetworkInterfaces -func (_options *CreateBareMetalServerOptions) SetNetworkInterfaces(networkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerOptions { - _options.NetworkInterfaces = networkInterfaces - return _options +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateBareMetalServerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateBareMetalServerOptions { - _options.ResourceGroup = resourceGroup - return _options +// 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"` } -// SetTrustedPlatformModule : Allow user to set TrustedPlatformModule -func (_options *CreateBareMetalServerOptions) SetTrustedPlatformModule(trustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype) *CreateBareMetalServerOptions { - _options.TrustedPlatformModule = trustedPlatformModule - return _options +func (*BareMetalServerProfileIdentity) isaBareMetalServerProfileIdentity() bool { + return true } -// SetVPC : Allow user to set VPC -func (_options *CreateBareMetalServerOptions) SetVPC(vpc VPCIdentityIntf) *CreateBareMetalServerOptions { - _options.VPC = vpc - return _options +type BareMetalServerProfileIdentityIntf interface { + isaBareMetalServerProfileIdentity() bool } -// SetHeaders : Allow user to set Headers -func (options *CreateBareMetalServerOptions) SetHeaders(param map[string]string) *CreateBareMetalServerOptions { - options.Headers = param - return options +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// CreateDedicatedHostGroupOptions : The CreateDedicatedHostGroup options. -type CreateDedicatedHostGroupOptions struct { - // The dedicated host profile class for hosts in this group. - Class *string `json:"class" validate:"required"` +// 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 dedicated host profile family for hosts in this group. - Family *string `json:"family" validate:"required"` + // The value for this profile field. + Value *int64 `json:"value,omitempty"` - // The zone this dedicated host group will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` - // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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 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 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 { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileReference : BareMetalServerProfileReference struct +type BareMetalServerProfileReference struct { + // The URL for this bare metal server profile. + Href *string `json:"href" 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"` +} + +// Constants associated with the BareMetalServerProfileReference.ResourceType property. +// The resource type. +const ( + BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileSupportedTrustedPlatformModuleModes : The supported trusted platform module modes for this bare metal server profile. +type BareMetalServerProfileSupportedTrustedPlatformModuleModes struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported trusted platform module modes. + Values []string `json:"values" validate:"required"` +} + +// 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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" +) + +// 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, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + 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. + 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 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. +const ( + BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" + BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" + BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" + BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" + BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + 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 are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + 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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +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 { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) + if err != nil { + 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 { + return + } + 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`. + 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`. +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 { + return + } + 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 { + 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"` +} + +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 { + 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) + if err != nil { + 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) + if err != nil { + 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) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CheckVPNGatewayConnectionLocalCIDROptions : The CheckVPNGatewayConnectionLocalCIDR options. +type CheckVPNGatewayConnectionLocalCIDROptions 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 address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCheckVPNGatewayConnectionLocalCIDROptions : Instantiate CheckVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewCheckVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { + return &CheckVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionLocalCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetID(id string) *CheckVPNGatewayConnectionLocalCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *CheckVPNGatewayConnectionLocalCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CheckVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionLocalCIDROptions { + options.Headers = param + return options +} + +// CheckVPNGatewayConnectionPeerCIDROptions : The CheckVPNGatewayConnectionPeerCIDR options. +type CheckVPNGatewayConnectionPeerCIDROptions 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 address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCheckVPNGatewayConnectionPeerCIDROptions : Instantiate CheckVPNGatewayConnectionPeerCIDROptions +func (*VpcV1) NewCheckVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionPeerCIDROptions { + return &CheckVPNGatewayConnectionPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionPeerCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetID(id string) *CheckVPNGatewayConnectionPeerCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *CheckVPNGatewayConnectionPeerCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *CheckVPNGatewayConnectionPeerCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CheckVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionPeerCIDROptions { + 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 of this Cloud Object Storage bucket. + CRN *string `json:"crn,omitempty"` +} + +func (*CloudObjectStorageBucketIdentity) isaCloudObjectStorageBucketIdentity() bool { + return true +} + +type CloudObjectStorageBucketIdentityIntf interface { + isaCloudObjectStorageBucketIdentity() 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CreateBackupPolicyOptions : The CreateBackupPolicy options. +type CreateBackupPolicyOptions struct { + // 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 resource types 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. + MatchResourceTypes []string `json:"match_resource_types,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. + 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateBackupPolicyOptions.MatchResourceTypes property. +// The resource type. +const ( + CreateBackupPolicyOptionsMatchResourceTypesVolumeConst = "volume" +) + +// NewCreateBackupPolicyOptions : Instantiate CreateBackupPolicyOptions +func (*VpcV1) NewCreateBackupPolicyOptions(matchUserTags []string) *CreateBackupPolicyOptions { + return &CreateBackupPolicyOptions{ + MatchUserTags: matchUserTags, + } +} + +// SetMatchUserTags : Allow user to set MatchUserTags +func (_options *CreateBackupPolicyOptions) SetMatchUserTags(matchUserTags []string) *CreateBackupPolicyOptions { + _options.MatchUserTags = matchUserTags + return _options +} + +// SetMatchResourceTypes : Allow user to set MatchResourceTypes +func (_options *CreateBackupPolicyOptions) SetMatchResourceTypes(matchResourceTypes []string) *CreateBackupPolicyOptions { + _options.MatchResourceTypes = matchResourceTypes + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateBackupPolicyOptions) SetName(name string) *CreateBackupPolicyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPlans : Allow user to set Plans +func (_options *CreateBackupPolicyOptions) SetPlans(plans []BackupPolicyPlanPrototype) *CreateBackupPolicyOptions { + _options.Plans = plans + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateBackupPolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateBackupPolicyOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBackupPolicyOptions) SetHeaders(param map[string]string) *CreateBackupPolicyOptions { + options.Headers = param + return options +} + +// CreateBackupPolicyPlanOptions : The CreateBackupPolicyPlan options. +type CreateBackupPolicyPlanOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // 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"` + + // 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"` + + 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateBackupPolicyPlanOptions : Instantiate CreateBackupPolicyPlanOptions +func (*VpcV1) NewCreateBackupPolicyPlanOptions(backupPolicyID string, cronSpec string) *CreateBackupPolicyPlanOptions { + return &CreateBackupPolicyPlanOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + CronSpec: core.StringPtr(cronSpec), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *CreateBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *CreateBackupPolicyPlanOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetCronSpec : Allow user to set CronSpec +func (_options *CreateBackupPolicyPlanOptions) SetCronSpec(cronSpec string) *CreateBackupPolicyPlanOptions { + _options.CronSpec = core.StringPtr(cronSpec) + return _options +} + +// SetActive : Allow user to set Active +func (_options *CreateBackupPolicyPlanOptions) SetActive(active bool) *CreateBackupPolicyPlanOptions { + _options.Active = core.BoolPtr(active) + return _options +} + +// SetAttachUserTags : Allow user to set AttachUserTags +func (_options *CreateBackupPolicyPlanOptions) SetAttachUserTags(attachUserTags []string) *CreateBackupPolicyPlanOptions { + _options.AttachUserTags = attachUserTags + return _options +} + +// SetClonePolicy : Allow user to set ClonePolicy +func (_options *CreateBackupPolicyPlanOptions) SetClonePolicy(clonePolicy *BackupPolicyPlanClonePolicyPrototype) *CreateBackupPolicyPlanOptions { + _options.ClonePolicy = clonePolicy + return _options +} + +// SetCopyUserTags : Allow user to set CopyUserTags +func (_options *CreateBackupPolicyPlanOptions) SetCopyUserTags(copyUserTags bool) *CreateBackupPolicyPlanOptions { + _options.CopyUserTags = core.BoolPtr(copyUserTags) + return _options +} + +// SetDeletionTrigger : Allow user to set DeletionTrigger +func (_options *CreateBackupPolicyPlanOptions) SetDeletionTrigger(deletionTrigger *BackupPolicyPlanDeletionTriggerPrototype) *CreateBackupPolicyPlanOptions { + _options.DeletionTrigger = deletionTrigger + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateBackupPolicyPlanOptions) SetName(name string) *CreateBackupPolicyPlanOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetRemoteRegionPolicies : Allow user to set RemoteRegionPolicies +func (_options *CreateBackupPolicyPlanOptions) SetRemoteRegionPolicies(remoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype) *CreateBackupPolicyPlanOptions { + _options.RemoteRegionPolicies = remoteRegionPolicies + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *CreateBackupPolicyPlanOptions { + options.Headers = param + return options +} + +// CreateBareMetalServerConsoleAccessTokenOptions : The CreateBareMetalServerConsoleAccessToken options. +type CreateBareMetalServerConsoleAccessTokenOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server console type for which this token may be used + // + // Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`. + ConsoleType *string `json:"console_type" 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,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateBareMetalServerConsoleAccessTokenOptions.ConsoleType property. +// The bare metal server console type for which this token may be used +// +// Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`. +const ( + CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeSerialConst = "serial" + CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeVncConst = "vnc" +) + +// NewCreateBareMetalServerConsoleAccessTokenOptions : Instantiate CreateBareMetalServerConsoleAccessTokenOptions +func (*VpcV1) NewCreateBareMetalServerConsoleAccessTokenOptions(bareMetalServerID string, consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions { + return &CreateBareMetalServerConsoleAccessTokenOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ConsoleType: core.StringPtr(consoleType), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerConsoleAccessTokenOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetConsoleType : Allow user to set ConsoleType +func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetConsoleType(consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions { + _options.ConsoleType = core.StringPtr(consoleType) + return _options +} + +// SetForce : Allow user to set Force +func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetForce(force bool) *CreateBareMetalServerConsoleAccessTokenOptions { + _options.Force = core.BoolPtr(force) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerConsoleAccessTokenOptions) SetHeaders(param map[string]string) *CreateBareMetalServerConsoleAccessTokenOptions { + options.Headers = param + return options +} + +// CreateBareMetalServerNetworkInterfaceOptions : The CreateBareMetalServerNetworkInterface options. +type CreateBareMetalServerNetworkInterfaceOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network interface prototype object. + BareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf `json:"BareMetalServerNetworkInterfacePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateBareMetalServerNetworkInterfaceOptions : Instantiate CreateBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewCreateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { + return &CreateBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + BareMetalServerNetworkInterfacePrototype: bareMetalServerNetworkInterfacePrototype, + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetBareMetalServerNetworkInterfacePrototype : Allow user to set BareMetalServerNetworkInterfacePrototype +func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePrototype(bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options +} + +// CreateBareMetalServerOptions : The CreateBareMetalServer options. +type CreateBareMetalServerOptions struct { + Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` + + // The primary bare metal server network interface to create. + PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_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 zone this bare metal server will reside in. + Zone ZoneIdentityIntf `json:"zone" 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 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 additional bare metal server network interfaces to create. + NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is 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 interfaces of + // the bare metal server are attached to. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateBareMetalServerOptions : Instantiate CreateBareMetalServerOptions +func (*VpcV1) NewCreateBareMetalServerOptions(initialization *BareMetalServerInitializationPrototype, primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf) *CreateBareMetalServerOptions { + return &CreateBareMetalServerOptions{ + Initialization: initialization, + PrimaryNetworkInterface: primaryNetworkInterface, + Profile: profile, + Zone: zone, + } +} + +// SetInitialization : Allow user to set Initialization +func (_options *CreateBareMetalServerOptions) SetInitialization(initialization *BareMetalServerInitializationPrototype) *CreateBareMetalServerOptions { + _options.Initialization = initialization + return _options +} + +// SetPrimaryNetworkInterface : Allow user to set PrimaryNetworkInterface +func (_options *CreateBareMetalServerOptions) SetPrimaryNetworkInterface(primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype) *CreateBareMetalServerOptions { + _options.PrimaryNetworkInterface = primaryNetworkInterface + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *CreateBareMetalServerOptions) SetProfile(profile BareMetalServerProfileIdentityIntf) *CreateBareMetalServerOptions { + _options.Profile = profile + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateBareMetalServerOptions) SetZone(zone ZoneIdentityIntf) *CreateBareMetalServerOptions { + _options.Zone = zone + return _options +} + +// SetEnableSecureBoot : Allow user to set EnableSecureBoot +func (_options *CreateBareMetalServerOptions) SetEnableSecureBoot(enableSecureBoot bool) *CreateBareMetalServerOptions { + _options.EnableSecureBoot = core.BoolPtr(enableSecureBoot) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateBareMetalServerOptions) SetName(name string) *CreateBareMetalServerOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetNetworkInterfaces : Allow user to set NetworkInterfaces +func (_options *CreateBareMetalServerOptions) SetNetworkInterfaces(networkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerOptions { + _options.NetworkInterfaces = networkInterfaces + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateBareMetalServerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateBareMetalServerOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetTrustedPlatformModule : Allow user to set TrustedPlatformModule +func (_options *CreateBareMetalServerOptions) SetTrustedPlatformModule(trustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype) *CreateBareMetalServerOptions { + _options.TrustedPlatformModule = trustedPlatformModule + return _options +} + +// SetVPC : Allow user to set VPC +func (_options *CreateBareMetalServerOptions) SetVPC(vpc VPCIdentityIntf) *CreateBareMetalServerOptions { + _options.VPC = vpc + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerOptions) SetHeaders(param map[string]string) *CreateBareMetalServerOptions { + options.Headers = param + return options +} + +// CreateDedicatedHostGroupOptions : The CreateDedicatedHostGroup options. +type CreateDedicatedHostGroupOptions struct { + // The dedicated host profile class for hosts in this group. + Class *string `json:"class" validate:"required"` + + // The dedicated host profile family for hosts in this group. + Family *string `json:"family" validate:"required"` + + // The zone this dedicated host group will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. 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) is used. @@ -27385,8 +28660,8 @@ type CreateFlowLogCollectorOptions struct { StorageBucket LegacyCloudObjectStorageBucketIdentityIntf `json:"storage_bucket" validate:"required"` // The target this collector will collect flow logs for. If the target is an instance, - // subnet, or VPC, flow logs will not be collected for any network interfaces within the - // target that are themselves the target of a more specific flow log collector. + // subnet, or VPC, flow logs will not be collected for any instance network interfaces within + // the target that are themselves the target of a more specific flow log collector. Target FlowLogCollectorTargetPrototypeIntf `json:"target" validate:"required"` // Indicates whether this collector will be active upon creation. @@ -28011,23 +29286,23 @@ type CreateInstanceNetworkInterfaceOptions struct { // The associated subnet. Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - // 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. + // Indicates whether source IP spoofing is allowed on this instance interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // The name for network interface. The name must not be used by another network interface on the virtual server - // instance. If unspecified, the name will be a hyphenated list of randomly-selected words. + // The name for the instance network interface. The name must not be used by another network interface on the virtual + // server instance. 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 network interface. This can be specified using - // an existing reserved IP, or a prototype object for a new reserved IP. + // The primary IP address to bind to the instance 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 network interface's subnet. Otherwise, an available address on the - // subnet will be automatically selected and reserved. + // be available on the instance 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 network interface. If unspecified, the VPC's default security group is used. + // The security groups to use for this instance network interface. If unspecified, the VPC's default security group is + // used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` // Allows users to set headers on API requests @@ -29503,6 +30778,72 @@ func (options *CreateSecurityGroupTargetBindingOptions) SetHeaders(param map[str return options } +// CreateShareMountTargetOptions : The CreateShareMountTarget options. +type CreateShareMountTargetOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share mount target prototype object. + ShareMountTargetPrototype ShareMountTargetPrototypeIntf `json:"ShareMountTargetPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateShareMountTargetOptions : Instantiate CreateShareMountTargetOptions +func (*VpcV1) NewCreateShareMountTargetOptions(shareID string, shareMountTargetPrototype ShareMountTargetPrototypeIntf) *CreateShareMountTargetOptions { + return &CreateShareMountTargetOptions{ + ShareID: core.StringPtr(shareID), + ShareMountTargetPrototype: shareMountTargetPrototype, + } +} + +// SetShareID : Allow user to set ShareID +func (_options *CreateShareMountTargetOptions) SetShareID(shareID string) *CreateShareMountTargetOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetShareMountTargetPrototype : Allow user to set ShareMountTargetPrototype +func (_options *CreateShareMountTargetOptions) SetShareMountTargetPrototype(shareMountTargetPrototype ShareMountTargetPrototypeIntf) *CreateShareMountTargetOptions { + _options.ShareMountTargetPrototype = shareMountTargetPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateShareMountTargetOptions) SetHeaders(param map[string]string) *CreateShareMountTargetOptions { + options.Headers = param + return options +} + +// CreateShareOptions : The CreateShare options. +type CreateShareOptions struct { + // The file share prototype object. + SharePrototype SharePrototypeIntf `json:"SharePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateShareOptions : Instantiate CreateShareOptions +func (*VpcV1) NewCreateShareOptions(sharePrototype SharePrototypeIntf) *CreateShareOptions { + return &CreateShareOptions{ + SharePrototype: sharePrototype, + } +} + +// SetSharePrototype : Allow user to set SharePrototype +func (_options *CreateShareOptions) SetSharePrototype(sharePrototype SharePrototypeIntf) *CreateShareOptions { + _options.SharePrototype = sharePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateShareOptions) SetHeaders(param map[string]string) *CreateShareOptions { + options.Headers = param + return options +} + // CreateSnapshotCloneOptions : The CreateSnapshotClone options. type CreateSnapshotCloneOptions struct { // The snapshot identifier. @@ -29855,7 +31196,9 @@ type CreateVPCRouteOptions struct { // The VPC identifier. VPCID *string `json:"vpc_id" validate:"required,ne="` - // The destination of the route. At most two routes per `zone` in a table can have the same `destination` and + // The destination CIDR of the route. The host identifier in the CIDR must be zero. + // + // At most two routes per `zone` in a table can have the same `destination` and // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Destination *string `json:"destination" validate:"required"` @@ -29983,9 +31326,9 @@ type CreateVPCRoutingTableOptions struct { // set to `true`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. // // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing @@ -29998,10 +31341,10 @@ type CreateVPCRoutingTableOptions struct { // Incoming traffic will be routed according to the routing table with two exceptions: // - Traffic destined for IP addresses associated with public gateways will not be // subject to routes in this routing table. - // - Routes with an action of deliver are treated as drop unless the `next_hop` is an - // IP address bound to a network interface on a subnet in the route's `zone`. - // Therefore, if an incoming packet matches a route with a `next_hop` of an - // internet-bound IP address or a VPN gateway connection, the packet will be dropped. + // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is + // an IP address in a subnet in the route's `zone` that is able to accept traffic. + // Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"` // If set to `true`, this routing table will be used to route traffic that originates from [Transit @@ -30009,17 +31352,17 @@ type CreateVPCRoutingTableOptions struct { // this property set to `true`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` // If set to `true`, this routing table will be used to route traffic that originates from subnets in other zones in // this VPC. The VPC must not already have a routing table with this property set to `true`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. - // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway // connection, the packet will be dropped. RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` @@ -30100,7 +31443,9 @@ type CreateVPCRoutingTableRouteOptions struct { // The routing table identifier. RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` - // The destination of the route. At most two routes per `zone` in a table can have the same `destination` and + // The destination CIDR of the route. The host identifier in the CIDR must be zero. + // + // At most two routes per `zone` in a table can have the same `destination` and // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Destination *string `json:"destination" validate:"required"` @@ -32456,9 +33801,9 @@ type DefaultRoutingTable struct { // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from the internet. @@ -32466,28 +33811,28 @@ type DefaultRoutingTable struct { // Incoming traffic will be routed according to the routing table with two exceptions: // - Traffic destined for IP addresses associated with public gateways will not be // subject to routes in this routing table. - // - Routes with an action of deliver are treated as drop unless the `next_hop` is an - // IP address bound to a network interface on a subnet in the route's `zone`. - // Therefore, if an incoming packet matches a route with a `next_hop` of an - // internet-bound IP address or a VPN gateway connection, the packet will be dropped. + // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is + // an IP address in a subnet in the route's `zone` that is able to accept traffic. + // Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from from [Transit // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this // VPC. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` // The routes for the default routing table for this VPC. The table is created with no routes, but routes may be added, @@ -32744,7 +34089,7 @@ type DeleteBareMetalServerNetworkInterfaceOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests @@ -33300,7 +34645,7 @@ type DeleteInstanceNetworkInterfaceOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests @@ -33976,6 +35321,109 @@ func (options *DeleteSecurityGroupTargetBindingOptions) SetHeaders(param map[str return options } +// DeleteShareMountTargetOptions : The DeleteShareMountTarget options. +type DeleteShareMountTargetOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share mount target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteShareMountTargetOptions : Instantiate DeleteShareMountTargetOptions +func (*VpcV1) NewDeleteShareMountTargetOptions(shareID string, id string) *DeleteShareMountTargetOptions { + return &DeleteShareMountTargetOptions{ + ShareID: core.StringPtr(shareID), + ID: core.StringPtr(id), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *DeleteShareMountTargetOptions) SetShareID(shareID string) *DeleteShareMountTargetOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteShareMountTargetOptions) SetID(id string) *DeleteShareMountTargetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteShareMountTargetOptions) SetHeaders(param map[string]string) *DeleteShareMountTargetOptions { + options.Headers = param + return options +} + +// DeleteShareOptions : The DeleteShare options. +type DeleteShareOptions struct { + // The file share 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 +} + +// NewDeleteShareOptions : Instantiate DeleteShareOptions +func (*VpcV1) NewDeleteShareOptions(id string) *DeleteShareOptions { + return &DeleteShareOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteShareOptions) SetID(id string) *DeleteShareOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteShareOptions) SetIfMatch(ifMatch string) *DeleteShareOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteShareOptions) SetHeaders(param map[string]string) *DeleteShareOptions { + options.Headers = param + return options +} + +// DeleteShareSourceOptions : The DeleteShareSource options. +type DeleteShareSourceOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteShareSourceOptions : Instantiate DeleteShareSourceOptions +func (*VpcV1) NewDeleteShareSourceOptions(shareID string) *DeleteShareSourceOptions { + return &DeleteShareSourceOptions{ + ShareID: core.StringPtr(shareID), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *DeleteShareSourceOptions) SetShareID(shareID string) *DeleteShareSourceOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteShareSourceOptions) SetHeaders(param map[string]string) *DeleteShareSourceOptions { + options.Headers = param + return options +} + // DeleteSnapshotCloneOptions : The DeleteSnapshotClone options. type DeleteSnapshotCloneOptions struct { // The snapshot identifier. @@ -35139,6 +36587,71 @@ func UnmarshalEndpointGatewayTargetPrototype(m map[string]json.RawMessage, resul return } +// FailoverShareOptions : The FailoverShare options. +type FailoverShareOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The action to take if the failover request is accepted but cannot be performed or times out: + // - `fail`: Fail the operation, resulting in the replication relationship being unchanged. + // - `split`: Split the replica from its source, resulting in two individual read-write + // file shares. Because the final sync was not completed, the replica may be + // out-of-date. This is useful in disaster recovery scenarios where the source is known + // to be unreachable. + FallbackPolicy *string `json:"fallback_policy,omitempty"` + + // The failover timeout in seconds. + // + // If the timeout is reached, the `fallback_policy` will be triggered. + Timeout *int64 `json:"timeout,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the FailoverShareOptions.FallbackPolicy property. +// The action to take if the failover request is accepted but cannot be performed or times out: +// - `fail`: Fail the operation, resulting in the replication relationship being unchanged. +// - `split`: Split the replica from its source, resulting in two individual read-write +// file shares. Because the final sync was not completed, the replica may be +// out-of-date. This is useful in disaster recovery scenarios where the source is known +// to be unreachable. +const ( + FailoverShareOptionsFallbackPolicyFailConst = "fail" + FailoverShareOptionsFallbackPolicySplitConst = "split" +) + +// NewFailoverShareOptions : Instantiate FailoverShareOptions +func (*VpcV1) NewFailoverShareOptions(shareID string) *FailoverShareOptions { + return &FailoverShareOptions{ + ShareID: core.StringPtr(shareID), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *FailoverShareOptions) SetShareID(shareID string) *FailoverShareOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetFallbackPolicy : Allow user to set FallbackPolicy +func (_options *FailoverShareOptions) SetFallbackPolicy(fallbackPolicy string) *FailoverShareOptions { + _options.FallbackPolicy = core.StringPtr(fallbackPolicy) + return _options +} + +// SetTimeout : Allow user to set Timeout +func (_options *FailoverShareOptions) SetTimeout(timeout int64) *FailoverShareOptions { + _options.Timeout = core.Int64Ptr(timeout) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *FailoverShareOptions) SetHeaders(param map[string]string) *FailoverShareOptions { + options.Headers = param + return options +} + // FloatingIP : FloatingIP struct type FloatingIP struct { // The globally unique IP address. @@ -35492,19 +37005,20 @@ func UnmarshalFloatingIPReferenceDeleted(m map[string]json.RawMessage, result in // FloatingIPTarget : The target of this floating IP. // Models which "extend" this model: // - FloatingIPTargetNetworkInterfaceReference +// - FloatingIPTargetBareMetalServerNetworkInterfaceReference // - FloatingIPTargetPublicGatewayReference type FloatingIPTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The name for this network interface. + // The name for this instance network interface. Name *string `json:"name,omitempty"` PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` @@ -35573,12 +37087,13 @@ func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) // - an instance network interface // - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. // Models which "extend" this model: +// - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity // - FloatingIPTargetPatchNetworkInterfaceIdentity type FloatingIPTargetPatch struct { - // The unique identifier for this network interface. + // The unique identifier for this bare metal server network interface. ID *string `json:"id,omitempty"` - // The URL for this network interface. + // The URL for this bare metal server network interface. Href *string `json:"href,omitempty"` } @@ -35612,12 +37127,13 @@ func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interfa // - an instance network interface // - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. // Models which "extend" this model: +// - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity // - FloatingIPTargetPrototypeNetworkInterfaceIdentity type FloatingIPTargetPrototype struct { - // The unique identifier for this network interface. + // The unique identifier for this bare metal server network interface. ID *string `json:"id,omitempty"` - // The URL for this network interface. + // The URL for this bare metal server network interface. Href *string `json:"href,omitempty"` } @@ -35695,16 +37211,16 @@ type FlowLogCollector struct { StorageBucket *LegacyCloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` // The target this collector is collecting flow logs for. - // - If the target is a network interface, flow logs will be collected - // for that network interface. + // - If the target is an instance network interface, flow logs will be collected + // for that instance network interface. // - If the target is a virtual server instance, flow logs will be collected - // for all network interfaces attached to that instance. + // for all network interfaces on that instance. // - If the target is a subnet, flow logs will be collected - // for all network interfaces attached to that subnet. - // - If the target is a VPC, flow logs will be collected for network interfaces + // for all instance network interfaces attached to that subnet. + // - If the target is a VPC, flow logs will be collected for instance network interfaces // attached to all subnets within that VPC. // If the target is an instance, subnet, or VPC, flow logs will not be collected - // for any network interfaces within the target that are themselves the target of + // for any instance network interfaces within the target that are themselves the target of // a more specific flow log collector. Target FlowLogCollectorTargetIntf `json:"target" validate:"required"` @@ -35907,17 +37423,17 @@ func (flowLogCollectorPatch *FlowLogCollectorPatch) AsPatch() (_patch map[string } // FlowLogCollectorTarget : The target this collector is collecting flow logs for. -// - If the target is a network interface, flow logs will be collected -// for that network interface. +// - If the target is an instance network interface, flow logs will be collected +// for that instance network interface. // - If the target is a virtual server instance, flow logs will be collected -// for all network interfaces attached to that instance. +// for all network interfaces on that instance. // - If the target is a subnet, flow logs will be collected -// for all network interfaces attached to that subnet. -// - If the target is a VPC, flow logs will be collected for network interfaces +// for all instance network interfaces attached to that subnet. +// - If the target is a VPC, flow logs will be collected for instance network interfaces // attached to all subnets within that VPC. If the target is an instance, subnet, or VPC, flow logs will not be // -// collected for any network interfaces within the target that are themselves the target of a more specific flow log -// collector. +// collected for any instance network interfaces within the target that are themselves the target of a more specific +// flow log collector. // Models which "extend" this model: // - FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext // - FlowLogCollectorTargetInstanceReference @@ -35928,13 +37444,13 @@ type FlowLogCollectorTarget struct { // some supplementary information. Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The name for this network interface. + // The name for this instance network interface. Name *string `json:"name,omitempty"` // The resource type. @@ -35990,18 +37506,18 @@ func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interf } // FlowLogCollectorTargetPrototype : The target this collector will collect flow logs for. If the target is an instance, subnet, or VPC, flow logs will -// not be collected for any network interfaces within the target that are themselves the target of a more specific flow -// log collector. +// not be collected for any instance network interfaces within the target that are themselves the target of a more +// specific flow log collector. // Models which "extend" this model: // - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity // - FlowLogCollectorTargetPrototypeInstanceIdentity // - FlowLogCollectorTargetPrototypeSubnetIdentity // - FlowLogCollectorTargetPrototypeVPCIdentity type FlowLogCollectorTargetPrototype struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` // The CRN for this virtual server instance. @@ -36228,7 +37744,7 @@ type GetBareMetalServerNetworkInterfaceFloatingIPOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // The floating IP identifier. @@ -36276,7 +37792,7 @@ type GetBareMetalServerNetworkInterfaceIPOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // The reserved IP identifier. @@ -36324,7 +37840,7 @@ type GetBareMetalServerNetworkInterfaceOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests @@ -37022,7 +38538,7 @@ type GetInstanceNetworkInterfaceFloatingIPOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // The floating IP identifier. @@ -37070,7 +38586,7 @@ type GetInstanceNetworkInterfaceIPOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // The reserved IP identifier. @@ -37118,7 +38634,7 @@ type GetInstanceNetworkInterfaceOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests @@ -37963,6 +39479,128 @@ func (options *GetSecurityGroupTargetOptions) SetHeaders(param map[string]string return options } +// GetShareMountTargetOptions : The GetShareMountTarget options. +type GetShareMountTargetOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share mount target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetShareMountTargetOptions : Instantiate GetShareMountTargetOptions +func (*VpcV1) NewGetShareMountTargetOptions(shareID string, id string) *GetShareMountTargetOptions { + return &GetShareMountTargetOptions{ + ShareID: core.StringPtr(shareID), + ID: core.StringPtr(id), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *GetShareMountTargetOptions) SetShareID(shareID string) *GetShareMountTargetOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetShareMountTargetOptions) SetID(id string) *GetShareMountTargetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetShareMountTargetOptions) SetHeaders(param map[string]string) *GetShareMountTargetOptions { + options.Headers = param + return options +} + +// GetShareOptions : The GetShare options. +type GetShareOptions struct { + // The file share identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetShareOptions : Instantiate GetShareOptions +func (*VpcV1) NewGetShareOptions(id string) *GetShareOptions { + return &GetShareOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetShareOptions) SetID(id string) *GetShareOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetShareOptions) SetHeaders(param map[string]string) *GetShareOptions { + options.Headers = param + return options +} + +// GetShareProfileOptions : The GetShareProfile options. +type GetShareProfileOptions struct { + // The file share profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetShareProfileOptions : Instantiate GetShareProfileOptions +func (*VpcV1) NewGetShareProfileOptions(name string) *GetShareProfileOptions { + return &GetShareProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetShareProfileOptions) SetName(name string) *GetShareProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetShareProfileOptions) SetHeaders(param map[string]string) *GetShareProfileOptions { + options.Headers = param + return options +} + +// GetShareSourceOptions : The GetShareSource options. +type GetShareSourceOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetShareSourceOptions : Instantiate GetShareSourceOptions +func (*VpcV1) NewGetShareSourceOptions(shareID string) *GetShareSourceOptions { + return &GetShareSourceOptions{ + ShareID: core.StringPtr(shareID), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *GetShareSourceOptions) SetShareID(shareID string) *GetShareSourceOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetShareSourceOptions) SetHeaders(param map[string]string) *GetShareSourceOptions { + options.Headers = param + return options +} + // GetSnapshotCloneOptions : The GetSnapshotClone options. type GetSnapshotCloneOptions struct { // The snapshot identifier. @@ -38179,6 +39817,34 @@ func (options *GetSubnetRoutingTableOptions) SetHeaders(param map[string]string) return options } +// GetVirtualNetworkInterfaceOptions : The GetVirtualNetworkInterface options. +type GetVirtualNetworkInterfaceOptions struct { + // The virtual network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVirtualNetworkInterfaceOptions : Instantiate GetVirtualNetworkInterfaceOptions +func (*VpcV1) NewGetVirtualNetworkInterfaceOptions(id string) *GetVirtualNetworkInterfaceOptions { + return &GetVirtualNetworkInterfaceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVirtualNetworkInterfaceOptions) SetID(id string) *GetVirtualNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetVirtualNetworkInterfaceOptions { + options.Headers = param + return options +} + // GetVolumeOptions : The GetVolume options. type GetVolumeOptions struct { // The volume identifier. @@ -40645,8 +42311,8 @@ type Instance struct { // The availability policy for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicy `json:"availability_policy" validate:"required"` - // The total bandwidth (in megabits per second) shared across the virtual server instance's network interfaces and - // storage volumes. + // The total bandwidth (in megabits per second) shared across the instance network interfaces and storage volumes of + // virtual server instance. Bandwidth *int64 `json:"bandwidth" validate:"required"` // Boot volume attachment. @@ -40699,13 +42365,13 @@ type Instance struct { // The name for this virtual server instance. The name is unique across all virtual server instances in the region. Name *string `json:"name" validate:"required"` - // The network interfaces for this virtual server instance, including the primary network interface. + // The network interfaces for this instance, including the primary network interface. NetworkInterfaces []NetworkInterfaceInstanceContextReference `json:"network_interfaces" validate:"required"` // The placement restrictions for the virtual server instance. PlacementTarget InstancePlacementTargetIntf `json:"placement_target,omitempty"` - // Primary network interface. + // The primary network interface for this virtual server instance. PrimaryNetworkInterface *NetworkInterfaceInstanceContextReference `json:"primary_network_interface" validate:"required"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this virtual @@ -43853,7 +45519,7 @@ type InstancePatch struct { // instance is placed on a dedicated host, the requested profile `family` must be // the same as the dedicated host `family`. // - Have the same `vcpu.architecture`. - // - Support the number of network interfaces currently attached to the instance. + // - Support the number of network interfaces the instance currently has. Profile InstancePatchProfileIntf `json:"profile,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -43912,7 +45578,7 @@ func (instancePatch *InstancePatch) AsPatch() (_patch map[string]interface{}, er // instance is placed on a dedicated host, the requested profile `family` must be // the same as the dedicated host `family`. // - Have the same `vcpu.architecture`. -// - Support the number of network interfaces currently attached to the instance. +// - Support the number of network interfaces the instance currently has. // // Models which "extend" this model: // - InstancePatchProfileInstanceProfileIdentityByName @@ -45294,7 +46960,7 @@ type InstancePrototype struct { // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -45341,7 +47007,7 @@ type InstancePrototype struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance's network + // If specified, it must match the VPC for the subnets of the instance network // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` @@ -45351,10 +47017,10 @@ type InstancePrototype struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. @@ -45577,9 +47243,9 @@ func UnmarshalInstanceStatusReason(m map[string]json.RawMessage, result interfac // InstanceTemplate : InstanceTemplate struct // Models which "extend" this model: -// - InstanceTemplateInstanceByImage -// - InstanceTemplateInstanceBySourceSnapshot -// - InstanceTemplateInstanceByCatalogOffering +// - InstanceTemplateInstanceByImageInstanceTemplateContext +// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext +// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext type InstanceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -45608,7 +47274,7 @@ type InstanceTemplate struct { // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -45651,7 +47317,7 @@ type InstanceTemplate struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance's network + // If specified, it must match the VPC for the subnets of the instance network // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` @@ -45661,10 +47327,10 @@ type InstanceTemplate struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. @@ -45956,7 +47622,7 @@ type InstanceTemplatePrototype struct { // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -46001,7 +47667,7 @@ type InstanceTemplatePrototype struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance's network + // If specified, it must match the VPC for the subnets of the instance network // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` @@ -46011,10 +47677,10 @@ type InstanceTemplatePrototype struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. @@ -46851,7 +48517,7 @@ type ListBareMetalServerNetworkInterfaceFloatingIpsOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // Allows users to set headers on API requests @@ -46889,7 +48555,7 @@ type ListBareMetalServerNetworkInterfaceIpsOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // Allows users to set headers on API requests @@ -48052,7 +49718,7 @@ type ListInstanceNetworkInterfaceFloatingIpsOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // Allows users to set headers on API requests @@ -48090,7 +49756,7 @@ type ListInstanceNetworkInterfaceIpsOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` // A server-provided token determining what resource to start the page on. @@ -49129,6 +50795,206 @@ func (options *ListSecurityGroupsOptions) SetHeaders(param map[string]string) *L return options } +// ListShareMountTargetsOptions : The ListShareMountTargets options. +type ListShareMountTargetsOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // 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 +} + +// NewListShareMountTargetsOptions : Instantiate ListShareMountTargetsOptions +func (*VpcV1) NewListShareMountTargetsOptions(shareID string) *ListShareMountTargetsOptions { + return &ListShareMountTargetsOptions{ + ShareID: core.StringPtr(shareID), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *ListShareMountTargetsOptions) SetShareID(shareID string) *ListShareMountTargetsOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListShareMountTargetsOptions) SetName(name string) *ListShareMountTargetsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListShareMountTargetsOptions) SetStart(start string) *ListShareMountTargetsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListShareMountTargetsOptions) SetLimit(limit int64) *ListShareMountTargetsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListShareMountTargetsOptions) SetHeaders(param map[string]string) *ListShareMountTargetsOptions { + options.Headers = param + return options +} + +// ListShareProfilesOptions : The ListShareProfiles options. +type ListShareProfilesOptions 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"` + + // 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 ListShareProfilesOptions.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 ( + ListShareProfilesOptionsSortCreatedAtConst = "created_at" + ListShareProfilesOptionsSortNameConst = "name" +) + +// NewListShareProfilesOptions : Instantiate ListShareProfilesOptions +func (*VpcV1) NewListShareProfilesOptions() *ListShareProfilesOptions { + return &ListShareProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListShareProfilesOptions) SetStart(start string) *ListShareProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListShareProfilesOptions) SetLimit(limit int64) *ListShareProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListShareProfilesOptions) SetSort(sort string) *ListShareProfilesOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListShareProfilesOptions) SetHeaders(param map[string]string) *ListShareProfilesOptions { + options.Headers = param + return options +} + +// ListSharesOptions : The ListShares options. +type ListSharesOptions 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 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 + Headers map[string]string +} + +// Constants associated with the ListSharesOptions.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 ( + ListSharesOptionsSortCreatedAtConst = "created_at" + ListSharesOptionsSortNameConst = "name" +) + +// Constants associated with the ListSharesOptions.ReplicationRole property. +// Filters the collection to file shares with a `replication_role` property matching the specified value. +const ( + ListSharesOptionsReplicationRoleNoneConst = "none" + ListSharesOptionsReplicationRoleReplicaConst = "replica" + ListSharesOptionsReplicationRoleSourceConst = "source" +) + +// NewListSharesOptions : Instantiate ListSharesOptions +func (*VpcV1) NewListSharesOptions() *ListSharesOptions { + return &ListSharesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListSharesOptions) SetStart(start string) *ListSharesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSharesOptions) SetLimit(limit int64) *ListSharesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListSharesOptions) SetResourceGroupID(resourceGroupID string) *ListSharesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListSharesOptions) SetName(name string) *ListSharesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListSharesOptions) SetSort(sort string) *ListSharesOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetReplicationRole : Allow user to set ReplicationRole +func (_options *ListSharesOptions) SetReplicationRole(replicationRole string) *ListSharesOptions { + _options.ReplicationRole = core.StringPtr(replicationRole) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSharesOptions) SetHeaders(param map[string]string) *ListSharesOptions { + options.Headers = param + return options +} + // ListSnapshotClonesOptions : The ListSnapshotClones options. type ListSnapshotClonesOptions struct { // The snapshot identifier. @@ -49458,6 +51324,18 @@ type ListSubnetsOptions struct { // 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 `zone.name` property matching the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + // Filters the collection to subnets with a `routing_table.id` property matching the specified identifier. RoutingTableID *string `json:"routing_table.id,omitempty"` @@ -49491,6 +51369,30 @@ func (_options *ListSubnetsOptions) SetResourceGroupID(resourceGroupID string) * return _options } +// SetZoneName : Allow user to set ZoneName +func (_options *ListSubnetsOptions) SetZoneName(zoneName string) *ListSubnetsOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListSubnetsOptions) SetVPCID(vpcID string) *ListSubnetsOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListSubnetsOptions) SetVPCCRN(vpcCRN string) *ListSubnetsOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListSubnetsOptions) SetVPCName(vpcName string) *ListSubnetsOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + // SetRoutingTableID : Allow user to set RoutingTableID func (_options *ListSubnetsOptions) SetRoutingTableID(routingTableID string) *ListSubnetsOptions { _options.RoutingTableID = core.StringPtr(routingTableID) @@ -49509,6 +51411,50 @@ func (options *ListSubnetsOptions) SetHeaders(param map[string]string) *ListSubn return options } +// ListVirtualNetworkInterfacesOptions : The ListVirtualNetworkInterfaces options. +type ListVirtualNetworkInterfacesOptions 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVirtualNetworkInterfacesOptions : Instantiate ListVirtualNetworkInterfacesOptions +func (*VpcV1) NewListVirtualNetworkInterfacesOptions() *ListVirtualNetworkInterfacesOptions { + return &ListVirtualNetworkInterfacesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListVirtualNetworkInterfacesOptions) SetStart(start string) *ListVirtualNetworkInterfacesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVirtualNetworkInterfacesOptions) SetLimit(limit int64) *ListVirtualNetworkInterfacesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListVirtualNetworkInterfacesOptions) SetResourceGroupID(resourceGroupID string) *ListVirtualNetworkInterfacesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVirtualNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListVirtualNetworkInterfacesOptions { + options.Headers = param + return options +} + // ListVolumeProfilesOptions : The ListVolumeProfiles options. type ListVolumeProfilesOptions struct { // A server-provided token determining what resource to start the page on. @@ -53717,37 +55663,516 @@ type LoadBalancerPoolSessionPersistencePrototype struct { // allowed. CookieName *string `json:"cookie_name,omitempty"` - // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` - // protocols. - Type *string `json:"type" validate:"required"` + // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` + // protocols. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerPoolSessionPersistencePrototype.Type property. +// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` +// protocols. +const ( + LoadBalancerPoolSessionPersistencePrototypeTypeAppCookieConst = "app_cookie" + LoadBalancerPoolSessionPersistencePrototypeTypeHTTPCookieConst = "http_cookie" + LoadBalancerPoolSessionPersistencePrototypeTypeSourceIPConst = "source_ip" +) + +// NewLoadBalancerPoolSessionPersistencePrototype : Instantiate LoadBalancerPoolSessionPersistencePrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolSessionPersistencePrototype(typeVar string) (_model *LoadBalancerPoolSessionPersistencePrototype, err error) { + _model = &LoadBalancerPoolSessionPersistencePrototype{ + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolSessionPersistencePrototype unmarshals an instance of LoadBalancerPoolSessionPersistencePrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolSessionPersistencePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolSessionPersistencePrototype) + err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPrivateIpsItem : LoadBalancerPrivateIpsItem struct +type LoadBalancerPrivateIpsItem struct { + // The IP address. + // + // If the address has not yet been selected, the value will be `0.0.0.0`. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` + + // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the LoadBalancerPrivateIpsItem.ResourceType property. +// The resource type. +const ( + LoadBalancerPrivateIpsItemResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" +) + +// UnmarshalLoadBalancerPrivateIpsItem unmarshals an instance of LoadBalancerPrivateIpsItem from the specified map of raw messages. +func UnmarshalLoadBalancerPrivateIpsItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPrivateIpsItem) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfile : LoadBalancerProfile struct +type LoadBalancerProfile struct { + // The product family this load balancer profile belongs to. + Family *string `json:"family" validate:"required"` + + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` + + InstanceGroupsSupported LoadBalancerProfileInstanceGroupsSupportedIntf `json:"instance_groups_supported" validate:"required"` + + // Indicates which logging type(s) are supported for a load balancer with this profile. + LoggingSupported *LoadBalancerProfileLoggingSupported `json:"logging_supported" validate:"required"` + + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` + + RouteModeSupported LoadBalancerProfileRouteModeSupportedIntf `json:"route_mode_supported" validate:"required"` + + SecurityGroupsSupported LoadBalancerProfileSecurityGroupsSupportedIntf `json:"security_groups_supported" validate:"required"` + + UDPSupported LoadBalancerProfileUDPSupportedIntf `json:"udp_supported" validate:"required"` +} + +// UnmarshalLoadBalancerProfile unmarshals an instance of LoadBalancerProfile from the specified map of raw messages. +func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfile) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_groups_supported", &obj.InstanceGroupsSupported, UnmarshalLoadBalancerProfileInstanceGroupsSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "logging_supported", &obj.LoggingSupported, UnmarshalLoadBalancerProfileLoggingSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "route_mode_supported", &obj.RouteModeSupported, UnmarshalLoadBalancerProfileRouteModeSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups_supported", &obj.SecurityGroupsSupported, UnmarshalLoadBalancerProfileSecurityGroupsSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "udp_supported", &obj.UDPSupported, UnmarshalLoadBalancerProfileUDPSupported) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileCollection : LoadBalancerProfileCollection struct +type LoadBalancerProfileCollection struct { + // A link to the first page of resources. + First *LoadBalancerProfileCollectionFirst `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"` + + // Collection of load balancer profiles. + Profiles []LoadBalancerProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalLoadBalancerProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *LoadBalancerProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 +// - LoadBalancerProfileIdentityByHref +type LoadBalancerProfileIdentity struct { + // The globally unique name for this load balancer profile. + Name *string `json:"name,omitempty"` + + // The URL for this load balancer profile. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerProfileIdentity) isaLoadBalancerProfileIdentity() bool { + return true +} + +type LoadBalancerProfileIdentityIntf interface { + isaLoadBalancerProfileIdentity() bool +} + +// UnmarshalLoadBalancerProfileIdentity unmarshals an instance of LoadBalancerProfileIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileInstanceGroupsSupported : LoadBalancerProfileInstanceGroupsSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileInstanceGroupsSupportedFixed +// - LoadBalancerProfileInstanceGroupsSupportedDependent +type LoadBalancerProfileInstanceGroupsSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileInstanceGroupsSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileInstanceGroupsSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileInstanceGroupsSupported) isaLoadBalancerProfileInstanceGroupsSupported() bool { + return true +} + +type LoadBalancerProfileInstanceGroupsSupportedIntf interface { + isaLoadBalancerProfileInstanceGroupsSupported() bool +} + +// UnmarshalLoadBalancerProfileInstanceGroupsSupported unmarshals an instance of LoadBalancerProfileInstanceGroupsSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileInstanceGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileInstanceGroupsSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileLoggingSupported : Indicates which logging type(s) are supported for a load balancer with this profile. +type LoadBalancerProfileLoggingSupported struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported logging type(s) for a load balancer with this profile. + Value []string `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileLoggingSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileLoggingSupportedTypeFixedConst = "fixed" +) + +// UnmarshalLoadBalancerProfileLoggingSupported unmarshals an instance of LoadBalancerProfileLoggingSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileLoggingSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileLoggingSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileReference : LoadBalancerProfileReference struct +type LoadBalancerProfileReference struct { + // The product family this load balancer profile belongs to. + Family *string `json:"family" validate:"required"` + + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalLoadBalancerProfileReference unmarshals an instance of LoadBalancerProfileReference from the specified map of raw messages. +func UnmarshalLoadBalancerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileReference) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileRouteModeSupported : LoadBalancerProfileRouteModeSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileRouteModeSupportedFixed +// - LoadBalancerProfileRouteModeSupportedDependent +type LoadBalancerProfileRouteModeSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileRouteModeSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileRouteModeSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileRouteModeSupported) isaLoadBalancerProfileRouteModeSupported() bool { + return true +} + +type LoadBalancerProfileRouteModeSupportedIntf interface { + isaLoadBalancerProfileRouteModeSupported() bool +} + +// UnmarshalLoadBalancerProfileRouteModeSupported unmarshals an instance of LoadBalancerProfileRouteModeSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileRouteModeSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileRouteModeSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileSecurityGroupsSupported : LoadBalancerProfileSecurityGroupsSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileSecurityGroupsSupportedFixed +// - LoadBalancerProfileSecurityGroupsSupportedDependent +type LoadBalancerProfileSecurityGroupsSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileSecurityGroupsSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileSecurityGroupsSupported) isaLoadBalancerProfileSecurityGroupsSupported() bool { + return true +} + +type LoadBalancerProfileSecurityGroupsSupportedIntf interface { + isaLoadBalancerProfileSecurityGroupsSupported() bool +} + +// UnmarshalLoadBalancerProfileSecurityGroupsSupported unmarshals an instance of LoadBalancerProfileSecurityGroupsSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileUDPSupported : LoadBalancerProfileUDPSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileUDPSupportedFixed +// - LoadBalancerProfileUDPSupportedDependent +type LoadBalancerProfileUDPSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` } -// Constants associated with the LoadBalancerPoolSessionPersistencePrototype.Type property. -// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` -// protocols. +// Constants associated with the LoadBalancerProfileUDPSupported.Type property. +// The type for this profile field. const ( - LoadBalancerPoolSessionPersistencePrototypeTypeAppCookieConst = "app_cookie" - LoadBalancerPoolSessionPersistencePrototypeTypeHTTPCookieConst = "http_cookie" - LoadBalancerPoolSessionPersistencePrototypeTypeSourceIPConst = "source_ip" + LoadBalancerProfileUDPSupportedTypeFixedConst = "fixed" ) -// NewLoadBalancerPoolSessionPersistencePrototype : Instantiate LoadBalancerPoolSessionPersistencePrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolSessionPersistencePrototype(typeVar string) (_model *LoadBalancerPoolSessionPersistencePrototype, err error) { - _model = &LoadBalancerPoolSessionPersistencePrototype{ - Type: core.StringPtr(typeVar), - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*LoadBalancerProfileUDPSupported) isaLoadBalancerProfileUDPSupported() bool { + return true } -// UnmarshalLoadBalancerPoolSessionPersistencePrototype unmarshals an instance of LoadBalancerPoolSessionPersistencePrototype from the specified map of raw messages. -func UnmarshalLoadBalancerPoolSessionPersistencePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolSessionPersistencePrototype) - err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) +type LoadBalancerProfileUDPSupportedIntf interface { + isaLoadBalancerProfileUDPSupported() bool +} + +// UnmarshalLoadBalancerProfileUDPSupported unmarshals an instance of LoadBalancerProfileUDPSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileUDPSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileUDPSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { return } @@ -53755,64 +56180,55 @@ func UnmarshalLoadBalancerPoolSessionPersistencePrototype(m map[string]json.RawM return } -// LoadBalancerPrivateIpsItem : LoadBalancerPrivateIpsItem struct -type LoadBalancerPrivateIpsItem struct { - // The IP address. - // - // If the address has not yet been selected, the value will be `0.0.0.0`. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` +// LoadBalancerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` +// UnmarshalLoadBalancerReferenceDeleted unmarshals an instance of LoadBalancerReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` +// LoadBalancerStatistics : LoadBalancerStatistics struct +type LoadBalancerStatistics struct { + // Number of active connections of this load balancer. + ActiveConnections *int64 `json:"active_connections" validate:"required"` - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` + // Current connection rate (connections per second) of this load balancer. + ConnectionRate *float32 `json:"connection_rate" validate:"required"` - // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - Name *string `json:"name" validate:"required"` + // Total number of data processed (bytes) of this load balancer within current calendar month. + DataProcessedThisMonth *int64 `json:"data_processed_this_month" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // Current throughput (Mbps) of this load balancer. + Throughput *float32 `json:"throughput" validate:"required"` } -// Constants associated with the LoadBalancerPrivateIpsItem.ResourceType property. -// The resource type. -const ( - LoadBalancerPrivateIpsItemResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" -) - -// UnmarshalLoadBalancerPrivateIpsItem unmarshals an instance of LoadBalancerPrivateIpsItem from the specified map of raw messages. -func UnmarshalLoadBalancerPrivateIpsItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPrivateIpsItem) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalLoadBalancerStatistics unmarshals an instance of LoadBalancerStatistics from the specified map of raw messages. +func UnmarshalLoadBalancerStatistics(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerStatistics) + err = core.UnmarshalPrimitive(m, "active_connections", &obj.ActiveConnections) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "connection_rate", &obj.ConnectionRate) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "data_processed_this_month", &obj.DataProcessedThisMonth) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "throughput", &obj.Throughput) if err != nil { return } @@ -53820,45 +56236,52 @@ func UnmarshalLoadBalancerPrivateIpsItem(m map[string]json.RawMessage, result in return } -// LoadBalancerProfile : LoadBalancerProfile struct -type LoadBalancerProfile struct { - // The product family this load balancer profile belongs to. - Family *string `json:"family" validate:"required"` +// NetworkACL : NetworkACL struct +type NetworkACL struct { + // The date and time that the network ACL was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The URL for this load balancer profile. - Href *string `json:"href" validate:"required"` + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` - InstanceGroupsSupported LoadBalancerProfileInstanceGroupsSupportedIntf `json:"instance_groups_supported" validate:"required"` + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` - // Indicates which logging type(s) are supported for a load balancer with this profile. - LoggingSupported *LoadBalancerProfileLoggingSupported `json:"logging_supported" validate:"required"` + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` - // The globally unique name for this load balancer profile. + // The name for this network ACL. The name is unique across all network ACLs for the VPC. Name *string `json:"name" validate:"required"` - RouteModeSupported LoadBalancerProfileRouteModeSupportedIntf `json:"route_mode_supported" validate:"required"` + // The resource group for this network ACL. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - SecurityGroupsSupported LoadBalancerProfileSecurityGroupsSupportedIntf `json:"security_groups_supported" validate:"required"` + // The ordered rules for this network ACL. If no rules exist, all traffic will be denied. + Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` - UDPSupported LoadBalancerProfileUDPSupportedIntf `json:"udp_supported" validate:"required"` + // The subnets to which this network ACL is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The VPC this network ACL resides in. + VPC *VPCReference `json:"vpc" validate:"required"` } -// UnmarshalLoadBalancerProfile unmarshals an instance of LoadBalancerProfile from the specified map of raw messages. -func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfile) - err = core.UnmarshalPrimitive(m, "family", &obj.Family) +// UnmarshalNetworkACL unmarshals an instance of NetworkACL from the specified map of raw messages. +func UnmarshalNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACL) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalModel(m, "instance_groups_supported", &obj.InstanceGroupsSupported, UnmarshalLoadBalancerProfileInstanceGroupsSupported) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalModel(m, "logging_supported", &obj.LoggingSupported, UnmarshalLoadBalancerProfileLoggingSupported) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } @@ -53866,15 +56289,19 @@ func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface if err != nil { return } - err = core.UnmarshalModel(m, "route_mode_supported", &obj.RouteModeSupported, UnmarshalLoadBalancerProfileRouteModeSupported) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } - err = core.UnmarshalModel(m, "security_groups_supported", &obj.SecurityGroupsSupported, UnmarshalLoadBalancerProfileSecurityGroupsSupported) + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) if err != nil { return } - err = core.UnmarshalModel(m, "udp_supported", &obj.UDPSupported, UnmarshalLoadBalancerProfileUDPSupported) + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { return } @@ -53882,29 +56309,29 @@ func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface return } -// LoadBalancerProfileCollection : LoadBalancerProfileCollection struct -type LoadBalancerProfileCollection struct { +// NetworkACLCollection : NetworkACLCollection struct +type NetworkACLCollection struct { // A link to the first page of resources. - First *LoadBalancerProfileCollectionFirst `json:"first" validate:"required"` + First *NetworkACLCollectionFirst `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` + // Collection of network ACLs. + NetworkAcls []NetworkACL `json:"network_acls" 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"` - - // Collection of load balancer profiles. - Profiles []LoadBalancerProfile `json:"profiles" validate:"required"` + Next *NetworkACLCollectionNext `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// 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) +// 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) if err != nil { return } @@ -53912,11 +56339,11 @@ func UnmarshalLoadBalancerProfileCollection(m map[string]json.RawMessage, result if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerProfileCollectionNext) + err = core.UnmarshalModel(m, "network_acls", &obj.NetworkAcls, UnmarshalNetworkACL) if err != nil { return } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalLoadBalancerProfile) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLCollectionNext) if err != nil { return } @@ -53929,7 +56356,7 @@ func UnmarshalLoadBalancerProfileCollection(m map[string]json.RawMessage, result } // Retrieve the value to be passed to a request to access the next page of results -func (resp *LoadBalancerProfileCollection) GetNextStart() (*string, error) { +func (resp *NetworkACLCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -53940,15 +56367,15 @@ func (resp *LoadBalancerProfileCollection) GetNextStart() (*string, error) { return start, nil } -// LoadBalancerProfileCollectionFirst : A link to the first page of resources. -type LoadBalancerProfileCollectionFirst struct { +// 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"` } -// 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) +// 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 { return @@ -53957,15 +56384,15 @@ func UnmarshalLoadBalancerProfileCollectionFirst(m map[string]json.RawMessage, r return } -// LoadBalancerProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type LoadBalancerProfileCollectionNext struct { +// 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"` } -// 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) +// 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 { return @@ -53974,30 +56401,38 @@ func UnmarshalLoadBalancerProfileCollectionNext(m map[string]json.RawMessage, re return } -// LoadBalancerProfileIdentity : Identifies a load balancer profile by a unique property. +// NetworkACLIdentity : Identifies a network ACL by a unique property. // Models which "extend" this model: -// - LoadBalancerProfileIdentityByName -// - LoadBalancerProfileIdentityByHref -type LoadBalancerProfileIdentity struct { - // The globally unique name for this load balancer profile. - Name *string `json:"name,omitempty"` +// - NetworkACLIdentityByID +// - NetworkACLIdentityByCRN +// - NetworkACLIdentityByHref +type NetworkACLIdentity struct { + // The unique identifier for this network ACL. + ID *string `json:"id,omitempty"` - // The URL for this load balancer profile. + // The CRN for this network ACL. + CRN *string `json:"crn,omitempty"` + + // The URL for this network ACL. Href *string `json:"href,omitempty"` } -func (*LoadBalancerProfileIdentity) isaLoadBalancerProfileIdentity() bool { +func (*NetworkACLIdentity) isaNetworkACLIdentity() bool { return true } -type LoadBalancerProfileIdentityIntf interface { - isaLoadBalancerProfileIdentity() bool +type NetworkACLIdentityIntf interface { + isaNetworkACLIdentity() bool } -// UnmarshalLoadBalancerProfileIdentity unmarshals an instance of LoadBalancerProfileIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +// UnmarshalNetworkACLIdentity unmarshals an instance of NetworkACLIdentity from the specified map of raw messages. +func UnmarshalNetworkACLIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } @@ -54009,70 +56444,85 @@ func UnmarshalLoadBalancerProfileIdentity(m map[string]json.RawMessage, result i return } -// LoadBalancerProfileInstanceGroupsSupported : LoadBalancerProfileInstanceGroupsSupported struct -// Models which "extend" this model: -// - LoadBalancerProfileInstanceGroupsSupportedFixed -// - LoadBalancerProfileInstanceGroupsSupportedDependent -type LoadBalancerProfileInstanceGroupsSupported struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` +// 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. + Name *string `json:"name,omitempty"` +} - // The value for this profile field. - Value *bool `json:"value,omitempty"` +// UnmarshalNetworkACLPatch unmarshals an instance of NetworkACLPatch from the specified map of raw messages. +func UnmarshalNetworkACLPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// Constants associated with the LoadBalancerProfileInstanceGroupsSupported.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileInstanceGroupsSupportedTypeFixedConst = "fixed" -) +// 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) + } + return +} -func (*LoadBalancerProfileInstanceGroupsSupported) isaLoadBalancerProfileInstanceGroupsSupported() bool { +// NetworkACLPrototype : NetworkACLPrototype struct +// Models which "extend" this model: +// - NetworkACLPrototypeNetworkACLByRules +// - NetworkACLPrototypeNetworkACLBySourceNetworkACL +type NetworkACLPrototype struct { + // The name for this network ACL. The name must not be used by another network ACL for the VPC. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The VPC this network ACL will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, + // resulting in all traffic being denied. + Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` + + // Network ACL to copy rules from. + SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl,omitempty"` +} + +func (*NetworkACLPrototype) isaNetworkACLPrototype() bool { return true } -type LoadBalancerProfileInstanceGroupsSupportedIntf interface { - isaLoadBalancerProfileInstanceGroupsSupported() bool +type NetworkACLPrototypeIntf interface { + isaNetworkACLPrototype() bool } -// UnmarshalLoadBalancerProfileInstanceGroupsSupported unmarshals an instance of LoadBalancerProfileInstanceGroupsSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileInstanceGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileInstanceGroupsSupported) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) +// UnmarshalNetworkACLPrototype unmarshals an instance of NetworkACLPrototype from the specified map of raw messages. +func UnmarshalNetworkACLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileLoggingSupported : Indicates which logging type(s) are supported for a load balancer with this profile. -type LoadBalancerProfileLoggingSupported struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The supported logging type(s) for a load balancer with this profile. - Value []string `json:"value" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileLoggingSupported.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileLoggingSupportedTypeFixedConst = "fixed" -) - -// UnmarshalLoadBalancerProfileLoggingSupported unmarshals an instance of LoadBalancerProfileLoggingSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileLoggingSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileLoggingSupported) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) if err != nil { return } @@ -54080,22 +56530,33 @@ func UnmarshalLoadBalancerProfileLoggingSupported(m map[string]json.RawMessage, return } -// LoadBalancerProfileReference : LoadBalancerProfileReference struct -type LoadBalancerProfileReference struct { - // The product family this load balancer profile belongs to. - Family *string `json:"family" validate:"required"` +// NetworkACLReference : NetworkACLReference struct +type NetworkACLReference struct { + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` - // The URL for this load balancer profile. + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkACLReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network ACL. Href *string `json:"href" validate:"required"` - // The globally unique name for this load balancer profile. + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` + + // The name for this network ACL. The name is unique across all network ACLs for the VPC. Name *string `json:"name" validate:"required"` } -// UnmarshalLoadBalancerProfileReference unmarshals an instance of LoadBalancerProfileReference from the specified map of raw messages. -func UnmarshalLoadBalancerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileReference) - err = core.UnmarshalPrimitive(m, "family", &obj.Family) +// UnmarshalNetworkACLReference unmarshals an instance of NetworkACLReference from the specified map of raw messages. +func UnmarshalNetworkACLReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLReferenceDeleted) if err != nil { return } @@ -54103,6 +56564,10 @@ func UnmarshalLoadBalancerProfileReference(m map[string]json.RawMessage, result if err != nil { return } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -54111,40 +56576,17 @@ func UnmarshalLoadBalancerProfileReference(m map[string]json.RawMessage, result return } -// LoadBalancerProfileRouteModeSupported : LoadBalancerProfileRouteModeSupported struct -// Models which "extend" this model: -// - LoadBalancerProfileRouteModeSupportedFixed -// - LoadBalancerProfileRouteModeSupportedDependent -type LoadBalancerProfileRouteModeSupported struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *bool `json:"value,omitempty"` -} - -// Constants associated with the LoadBalancerProfileRouteModeSupported.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileRouteModeSupportedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileRouteModeSupported) isaLoadBalancerProfileRouteModeSupported() bool { - return true -} - -type LoadBalancerProfileRouteModeSupportedIntf interface { - isaLoadBalancerProfileRouteModeSupported() bool +// NetworkACLReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkACLReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` } -// UnmarshalLoadBalancerProfileRouteModeSupported unmarshals an instance of LoadBalancerProfileRouteModeSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileRouteModeSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileRouteModeSupported) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) +// UnmarshalNetworkACLReferenceDeleted unmarshals an instance of NetworkACLReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkACLReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } @@ -54152,137 +56594,162 @@ func UnmarshalLoadBalancerProfileRouteModeSupported(m map[string]json.RawMessage return } -// LoadBalancerProfileSecurityGroupsSupported : LoadBalancerProfileSecurityGroupsSupported struct +// NetworkACLRule : NetworkACLRule struct // Models which "extend" this model: -// - LoadBalancerProfileSecurityGroupsSupportedFixed -// - LoadBalancerProfileSecurityGroupsSupportedDependent -type LoadBalancerProfileSecurityGroupsSupported struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` +// - NetworkACLRuleNetworkACLRuleProtocolTcpudp +// - NetworkACLRuleNetworkACLRuleProtocolIcmp +// - NetworkACLRuleNetworkACLRuleProtocolAll +type NetworkACLRule struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` - // The value for this profile field. - Value *bool `json:"value,omitempty"` + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` } -// Constants associated with the LoadBalancerProfileSecurityGroupsSupported.Type property. -// The type for this profile field. +// Constants associated with the NetworkACLRule.Action property. +// The action to perform for a packet matching the rule. const ( - LoadBalancerProfileSecurityGroupsSupportedTypeFixedConst = "fixed" + NetworkACLRuleActionAllowConst = "allow" + NetworkACLRuleActionDenyConst = "deny" ) -func (*LoadBalancerProfileSecurityGroupsSupported) isaLoadBalancerProfileSecurityGroupsSupported() bool { - return true -} - -type LoadBalancerProfileSecurityGroupsSupportedIntf interface { - isaLoadBalancerProfileSecurityGroupsSupported() bool -} - -// UnmarshalLoadBalancerProfileSecurityGroupsSupported unmarshals an instance of LoadBalancerProfileSecurityGroupsSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileSecurityGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileSecurityGroupsSupported) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileUDPSupported : LoadBalancerProfileUDPSupported struct -// Models which "extend" this model: -// - LoadBalancerProfileUDPSupportedFixed -// - LoadBalancerProfileUDPSupportedDependent -type LoadBalancerProfileUDPSupported struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` +// Constants associated with the NetworkACLRule.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleDirectionInboundConst = "inbound" + NetworkACLRuleDirectionOutboundConst = "outbound" +) - // The value for this profile field. - Value *bool `json:"value,omitempty"` -} +// Constants associated with the NetworkACLRule.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleIPVersionIpv4Const = "ipv4" +) -// Constants associated with the LoadBalancerProfileUDPSupported.Type property. -// The type for this profile field. +// Constants associated with the NetworkACLRule.Protocol property. +// The protocol to enforce. const ( - LoadBalancerProfileUDPSupportedTypeFixedConst = "fixed" + NetworkACLRuleProtocolAllConst = "all" + NetworkACLRuleProtocolIcmpConst = "icmp" + NetworkACLRuleProtocolTCPConst = "tcp" + NetworkACLRuleProtocolUDPConst = "udp" ) -func (*LoadBalancerProfileUDPSupported) isaLoadBalancerProfileUDPSupported() bool { +func (*NetworkACLRule) isaNetworkACLRule() bool { return true } -type LoadBalancerProfileUDPSupportedIntf interface { - isaLoadBalancerProfileUDPSupported() bool +type NetworkACLRuleIntf interface { + isaNetworkACLRule() bool } -// UnmarshalLoadBalancerProfileUDPSupported unmarshals an instance of LoadBalancerProfileUDPSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileUDPSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileUDPSupported) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) +// UnmarshalNetworkACLRule unmarshals an instance of NetworkACLRule from the specified map of raw messages. +func UnmarshalNetworkACLRule(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) if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerReferenceDeleted unmarshals an instance of LoadBalancerReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// LoadBalancerStatistics : LoadBalancerStatistics struct -type LoadBalancerStatistics struct { - // Number of active connections of this load balancer. - ActiveConnections *int64 `json:"active_connections" validate:"required"` +// NetworkACLRuleBeforePatch : The rule to move this rule immediately before. +// +// Specify `null` to move this rule after all existing rules. +// Models which "extend" this model: +// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID +// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref +type NetworkACLRuleBeforePatch struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id,omitempty"` - // Current connection rate (connections per second) of this load balancer. - ConnectionRate *float32 `json:"connection_rate" validate:"required"` + // The URL for this network ACL rule. + Href *string `json:"href,omitempty"` +} - // Total number of data processed (bytes) of this load balancer within current calendar month. - DataProcessedThisMonth *int64 `json:"data_processed_this_month" validate:"required"` +func (*NetworkACLRuleBeforePatch) isaNetworkACLRuleBeforePatch() bool { + return true +} - // Current throughput (Mbps) of this load balancer. - Throughput *float32 `json:"throughput" validate:"required"` +type NetworkACLRuleBeforePatchIntf interface { + isaNetworkACLRuleBeforePatch() bool } -// UnmarshalLoadBalancerStatistics unmarshals an instance of LoadBalancerStatistics from the specified map of raw messages. -func UnmarshalLoadBalancerStatistics(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerStatistics) - err = core.UnmarshalPrimitive(m, "active_connections", &obj.ActiveConnections) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "connection_rate", &obj.ConnectionRate) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "data_processed_this_month", &obj.DataProcessedThisMonth) +// UnmarshalNetworkACLRuleBeforePatch unmarshals an instance of NetworkACLRuleBeforePatch from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "throughput", &obj.Throughput) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -54290,72 +56757,36 @@ func UnmarshalLoadBalancerStatistics(m map[string]json.RawMessage, result interf return } -// NetworkACL : NetworkACL struct -type NetworkACL struct { - // The date and time that the network ACL was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this network ACL. - CRN *string `json:"crn" validate:"required"` - - // The URL for this network ACL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL. - ID *string `json:"id" validate:"required"` - - // The name for this network ACL. The name is unique across all network ACLs for the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this network ACL. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` +// NetworkACLRuleBeforePrototype : The rule to insert this rule immediately before. +// +// If unspecified, this rule will be inserted after all existing rules. +// Models which "extend" this model: +// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID +// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref +type NetworkACLRuleBeforePrototype struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id,omitempty"` - // The ordered rules for this network ACL. If no rules exist, all traffic will be denied. - Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` + // The URL for this network ACL rule. + Href *string `json:"href,omitempty"` +} - // The subnets to which this network ACL is attached. - Subnets []SubnetReference `json:"subnets" validate:"required"` +func (*NetworkACLRuleBeforePrototype) isaNetworkACLRuleBeforePrototype() bool { + return true +} - // The VPC this network ACL resides in. - VPC *VPCReference `json:"vpc" validate:"required"` +type NetworkACLRuleBeforePrototypeIntf interface { + isaNetworkACLRuleBeforePrototype() bool } -// UnmarshalNetworkACL unmarshals an instance of NetworkACL from the specified map of raw messages. -func UnmarshalNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACL) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } +// UnmarshalNetworkACLRuleBeforePrototype unmarshals an instance of NetworkACLRuleBeforePrototype from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototype) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -54363,29 +56794,29 @@ func UnmarshalNetworkACL(m map[string]json.RawMessage, result interface{}) (err return } -// NetworkACLCollection : NetworkACLCollection struct -type NetworkACLCollection struct { +// NetworkACLRuleCollection : NetworkACLRuleCollection struct +type NetworkACLRuleCollection struct { // A link to the first page of resources. - First *NetworkACLCollectionFirst `json:"first" validate:"required"` + First *NetworkACLRuleCollectionFirst `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` - // Collection of network ACLs. - NetworkAcls []NetworkACL `json:"network_acls" validate:"required"` - // 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 *NetworkACLRuleCollectionNext `json:"next,omitempty"` + + // Ordered collection of network ACL rules. + Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// 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) +// 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) if err != nil { return } @@ -54393,11 +56824,11 @@ func UnmarshalNetworkACLCollection(m map[string]json.RawMessage, result interfac if err != nil { return } - err = core.UnmarshalModel(m, "network_acls", &obj.NetworkAcls, UnmarshalNetworkACL) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLRuleCollectionNext) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLCollectionNext) + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) if err != nil { return } @@ -54410,7 +56841,7 @@ func UnmarshalNetworkACLCollection(m map[string]json.RawMessage, result interfac } // Retrieve the value to be passed to a request to access the next page of results -func (resp *NetworkACLCollection) GetNextStart() (*string, error) { +func (resp *NetworkACLRuleCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -54421,15 +56852,15 @@ func (resp *NetworkACLCollection) GetNextStart() (*string, error) { return start, nil } -// NetworkACLCollectionFirst : A link to the first page of resources. -type NetworkACLCollectionFirst struct { +// 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"` } -// 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) +// 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 { return @@ -54438,15 +56869,15 @@ func UnmarshalNetworkACLCollectionFirst(m map[string]json.RawMessage, result int return } -// NetworkACLCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type NetworkACLCollectionNext struct { +// 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"` } -// 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) +// 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 { return @@ -54455,59 +56886,256 @@ func UnmarshalNetworkACLCollectionNext(m map[string]json.RawMessage, result inte return } -// NetworkACLIdentity : Identifies a network ACL by a unique property. +// NetworkACLRuleItem : NetworkACLRuleItem struct // Models which "extend" this model: -// - NetworkACLIdentityByID -// - NetworkACLIdentityByCRN -// - NetworkACLIdentityByHref -type NetworkACLIdentity struct { - // The unique identifier for this network ACL. - ID *string `json:"id,omitempty"` +// - NetworkACLRuleItemNetworkACLRuleProtocolTcpudp +// - NetworkACLRuleItemNetworkACLRuleProtocolIcmp +// - NetworkACLRuleItemNetworkACLRuleProtocolAll +type NetworkACLRuleItem struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` - // The CRN for this network ACL. - CRN *string `json:"crn,omitempty"` + // The rule that this rule is immediately before. In a rule collection, this always + // refers to the next item in the collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` - // The URL for this network ACL. - Href *string `json:"href,omitempty"` + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` } -func (*NetworkACLIdentity) isaNetworkACLIdentity() bool { +// Constants associated with the NetworkACLRuleItem.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemActionAllowConst = "allow" + NetworkACLRuleItemActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItem.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemDirectionInboundConst = "inbound" + NetworkACLRuleItemDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItem.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItem.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemProtocolAllConst = "all" + NetworkACLRuleItemProtocolIcmpConst = "icmp" + NetworkACLRuleItemProtocolTCPConst = "tcp" + NetworkACLRuleItemProtocolUDPConst = "udp" +) + +func (*NetworkACLRuleItem) isaNetworkACLRuleItem() bool { return true } -type NetworkACLIdentityIntf interface { - isaNetworkACLIdentity() bool +type NetworkACLRuleItemIntf interface { + isaNetworkACLRuleItem() bool } -// UnmarshalNetworkACLIdentity unmarshals an instance of NetworkACLIdentity from the specified map of raw messages. -func UnmarshalNetworkACLIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalNetworkACLRuleItem unmarshals an instance of NetworkACLRuleItem from the specified map of raw messages. +func UnmarshalNetworkACLRuleItem(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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRulePatch : NetworkACLRulePatch struct +type NetworkACLRulePatch struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action,omitempty"` + + // The rule to move this rule immediately before. + // + // Specify `null` to move this rule after all existing rules. + Before NetworkACLRuleBeforePatchIntf `json:"before,omitempty"` + + // The ICMP traffic code to match. If set, `type` must also be set. + // + // Specify `null` to remove an existing ICMP traffic code. + Code *int64 `json:"code,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination,omitempty"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The direction of traffic to match. + Direction *string `json:"direction,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. + Name *string `json:"name,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic type to match. + // + // Specify `null` to remove an existing ICMP traffic type value. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePatch.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePatchActionAllowConst = "allow" + NetworkACLRulePatchActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePatch.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePatchDirectionInboundConst = "inbound" + NetworkACLRulePatchDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePatch.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePatchProtocolAllConst = "all" + NetworkACLRulePatchProtocolIcmpConst = "icmp" + NetworkACLRulePatchProtocolTCPConst = "tcp" + NetworkACLRulePatchProtocolUDPConst = "udp" +) + +// UnmarshalNetworkACLRulePatch unmarshals an instance of NetworkACLRulePatch from the specified map of raw messages. +func UnmarshalNetworkACLRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePatch) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - 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. - Name *string `json:"name,omitempty"` -} - -// UnmarshalNetworkACLPatch unmarshals an instance of NetworkACLPatch from the specified map of raw messages. -func UnmarshalNetworkACLPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -54515,102 +57143,271 @@ func UnmarshalNetworkACLPatch(m map[string]json.RawMessage, result interface{}) return } -// AsPatch returns a generic map representation of the NetworkACLPatch -func (networkACLPatch *NetworkACLPatch) AsPatch() (_patch map[string]interface{}, err error) { +// 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(networkACLPatch) + jsonData, err = json.Marshal(networkACLRulePatch) if err == nil { err = json.Unmarshal(jsonData, &_patch) } return } -// NetworkACLPrototype : NetworkACLPrototype struct +// NetworkACLRulePrototype : NetworkACLRulePrototype struct // Models which "extend" this model: -// - NetworkACLPrototypeNetworkACLByRules -// - NetworkACLPrototypeNetworkACLBySourceNetworkACL -type NetworkACLPrototype struct { - // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the - // name will be a hyphenated list of randomly-selected words. +// - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype +// - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype +// - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype +type NetworkACLRulePrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule to insert this rule immediately before. + // + // If unspecified, this rule will be inserted after all existing rules. + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. 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) is used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` - // The VPC this network ACL will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` - // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, - // resulting in all traffic being denied. - Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - // Network ACL to copy rules from. - SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl,omitempty"` + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` } -func (*NetworkACLPrototype) isaNetworkACLPrototype() bool { +// Constants associated with the NetworkACLRulePrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeProtocolAllConst = "all" + NetworkACLRulePrototypeProtocolIcmpConst = "icmp" + NetworkACLRulePrototypeProtocolTCPConst = "tcp" + NetworkACLRulePrototypeProtocolUDPConst = "udp" +) + +func (*NetworkACLRulePrototype) isaNetworkACLRulePrototype() bool { return true } -type NetworkACLPrototypeIntf interface { - isaNetworkACLPrototype() bool +type NetworkACLRulePrototypeIntf interface { + isaNetworkACLRulePrototype() bool } -// UnmarshalNetworkACLPrototype unmarshals an instance of NetworkACLPrototype from the specified map of raw messages. -func UnmarshalNetworkACLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +// UnmarshalNetworkACLRulePrototype unmarshals an instance of NetworkACLRulePrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototype(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) if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) + return +} + +// NetworkACLRulePrototypeNetworkACLContext : NetworkACLRulePrototypeNetworkACLContext struct +// Models which "extend" this model: +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype +type NetworkACLRulePrototypeNetworkACLContext struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextProtocolAllConst = "all" + NetworkACLRulePrototypeNetworkACLContextProtocolIcmpConst = "icmp" + NetworkACLRulePrototypeNetworkACLContextProtocolTCPConst = "tcp" + NetworkACLRulePrototypeNetworkACLContextProtocolUDPConst = "udp" +) + +func (*NetworkACLRulePrototypeNetworkACLContext) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +type NetworkACLRulePrototypeNetworkACLContextIntf interface { + isaNetworkACLRulePrototypeNetworkACLContext() bool +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContext unmarshals an instance of NetworkACLRulePrototypeNetworkACLContext from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContext(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) if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) return } - err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) - if err != nil { + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } return } -// NetworkACLReference : NetworkACLReference struct -type NetworkACLReference struct { - // The CRN for this network ACL. - CRN *string `json:"crn" validate:"required"` - +// NetworkACLRuleReference : NetworkACLRuleReference struct +type NetworkACLRuleReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *NetworkACLReferenceDeleted `json:"deleted,omitempty"` + Deleted *NetworkACLRuleReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network ACL. + // The URL for this network ACL rule. Href *string `json:"href" validate:"required"` - // The unique identifier for this network ACL. + // The unique identifier for this network ACL rule. ID *string `json:"id" validate:"required"` - // The name for this network ACL. The name is unique across all network ACLs for the VPC. + // The name for this network ACL rule. The name is unique across all rules for the network ACL. Name *string `json:"name" validate:"required"` } -// UnmarshalNetworkACLReference unmarshals an instance of NetworkACLReference from the specified map of raw messages. -func UnmarshalNetworkACLReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLReferenceDeleted) +// UnmarshalNetworkACLRuleReference unmarshals an instance of NetworkACLRuleReference from the specified map of raw messages. +func UnmarshalNetworkACLRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLRuleReferenceDeleted) if err != nil { return } @@ -54630,16 +57427,16 @@ func UnmarshalNetworkACLReference(m map[string]json.RawMessage, result interface return } -// NetworkACLReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// NetworkACLRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary // information. -type NetworkACLReferenceDeleted struct { +type NetworkACLRuleReferenceDeleted struct { // Link to documentation about deleted resources. MoreInfo *string `json:"more_info" validate:"required"` } -// UnmarshalNetworkACLReferenceDeleted unmarshals an instance of NetworkACLReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkACLReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLReferenceDeleted) +// UnmarshalNetworkACLRuleReferenceDeleted unmarshals an instance of NetworkACLRuleReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleReferenceDeleted) err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return @@ -54648,162 +57445,204 @@ func UnmarshalNetworkACLReferenceDeleted(m map[string]json.RawMessage, result in return } -// NetworkACLRule : NetworkACLRule struct -// Models which "extend" this model: -// - NetworkACLRuleNetworkACLRuleProtocolTcpudp -// - NetworkACLRuleNetworkACLRuleProtocolIcmp -// - NetworkACLRuleNetworkACLRuleProtocolAll -type NetworkACLRule struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` +// NetworkInterface : NetworkInterface struct +type NetworkInterface struct { + // Indicates whether source IP spoofing is allowed on this instance interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - // The date and time that the rule was created. + // The date and time that the instance network interface was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` + // The floating IPs associated with this instance network interface. + FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - // The URL for this network ACL rule. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network ACL rule. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. + // The name for this instance network interface. Name *string `json:"name" validate:"required"` - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` + // The instance network interface port speed in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` + // The security groups targeting this instance network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` + // The status of the instance network interface. + Status *string `json:"status" validate:"required"` - // The ICMP traffic code to match. - // - // If absent, all codes are matched. - Code *int64 `json:"code,omitempty"` + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` - // The ICMP traffic type to match. - // - // If absent, all types are matched. - Type *int64 `json:"type,omitempty"` + // The instance network interface type. + Type *string `json:"type" validate:"required"` } -// Constants associated with the NetworkACLRule.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleActionAllowConst = "allow" - NetworkACLRuleActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRule.Direction property. -// The direction of traffic to match. +// Constants associated with the NetworkInterface.ResourceType property. +// The resource type. const ( - NetworkACLRuleDirectionInboundConst = "inbound" - NetworkACLRuleDirectionOutboundConst = "outbound" + NetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" ) -// Constants associated with the NetworkACLRule.IPVersion property. -// The IP version for this rule. +// Constants associated with the NetworkInterface.Status property. +// The status of the instance network interface. const ( - NetworkACLRuleIPVersionIpv4Const = "ipv4" + NetworkInterfaceStatusAvailableConst = "available" + NetworkInterfaceStatusDeletingConst = "deleting" + NetworkInterfaceStatusFailedConst = "failed" + NetworkInterfaceStatusPendingConst = "pending" ) -// Constants associated with the NetworkACLRule.Protocol property. -// The protocol to enforce. +// Constants associated with the NetworkInterface.Type property. +// The instance network interface type. const ( - NetworkACLRuleProtocolAllConst = "all" - NetworkACLRuleProtocolIcmpConst = "icmp" - NetworkACLRuleProtocolTCPConst = "tcp" - NetworkACLRuleProtocolUDPConst = "udp" + NetworkInterfaceTypePrimaryConst = "primary" + NetworkInterfaceTypeSecondaryConst = "secondary" ) -func (*NetworkACLRule) isaNetworkACLRule() bool { - return true +// UnmarshalNetworkInterface unmarshals an instance of NetworkInterface from the specified map of raw messages. +func UnmarshalNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -type NetworkACLRuleIntf interface { - isaNetworkACLRule() bool +// NetworkInterfaceBareMetalServerContextReference : NetworkInterfaceBareMetalServerContextReference struct +type NetworkInterfaceBareMetalServerContextReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceBareMetalServerContextReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this bare metal server network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server network interface. + ID *string `json:"id" validate:"required"` + + // The name for this bare metal server network interface. + Name *string `json:"name" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` } -// UnmarshalNetworkACLRule unmarshals an instance of NetworkACLRule from the specified map of raw messages. -func UnmarshalNetworkACLRule(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) +// Constants associated with the NetworkInterfaceBareMetalServerContextReference.ResourceType property. +// The resource type. +const ( + NetworkInterfaceBareMetalServerContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// UnmarshalNetworkInterfaceBareMetalServerContextReference unmarshals an instance of NetworkInterfaceBareMetalServerContextReference from the specified map of raw messages. +func UnmarshalNetworkInterfaceBareMetalServerContextReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceBareMetalServerContextReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) return } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { return } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll) - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp) - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// NetworkACLRuleBeforePatch : The rule to move this rule immediately before. -// -// Specify `null` to move this rule after all existing rules. -// Models which "extend" this model: -// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID -// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref -type NetworkACLRuleBeforePatch struct { - // The unique identifier for this network ACL rule. - ID *string `json:"id,omitempty"` - - // The URL for this network ACL rule. - Href *string `json:"href,omitempty"` -} - -func (*NetworkACLRuleBeforePatch) isaNetworkACLRuleBeforePatch() bool { - return true -} - -type NetworkACLRuleBeforePatchIntf interface { - isaNetworkACLRuleBeforePatch() bool +// NetworkInterfaceBareMetalServerContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceBareMetalServerContextReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` } -// UnmarshalNetworkACLRuleBeforePatch unmarshals an instance of NetworkACLRuleBeforePatch from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePatch) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted unmarshals an instance of NetworkInterfaceBareMetalServerContextReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceBareMetalServerContextReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } @@ -54811,31 +57650,43 @@ func UnmarshalNetworkACLRuleBeforePatch(m map[string]json.RawMessage, result int return } -// NetworkACLRuleBeforePrototype : The rule to insert this rule immediately before. -// -// If unspecified, this rule will be inserted after all existing rules. +// NetworkInterfaceIPPrototype : NetworkInterfaceIPPrototype struct // Models which "extend" this model: -// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID -// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref -type NetworkACLRuleBeforePrototype struct { - // The unique identifier for this network ACL rule. +// - NetworkInterfaceIPPrototypeReservedIPIdentity +// - NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext +type NetworkInterfaceIPPrototype struct { + // The unique identifier for this reserved IP. ID *string `json:"id,omitempty"` - // The URL for this network ACL rule. + // The URL for this reserved IP. Href *string `json:"href,omitempty"` + + // 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*NetworkACLRuleBeforePrototype) isaNetworkACLRuleBeforePrototype() bool { +func (*NetworkInterfaceIPPrototype) isaNetworkInterfaceIPPrototype() bool { return true } -type NetworkACLRuleBeforePrototypeIntf interface { - isaNetworkACLRuleBeforePrototype() bool +type NetworkInterfaceIPPrototypeIntf interface { + isaNetworkInterfaceIPPrototype() bool } -// UnmarshalNetworkACLRuleBeforePrototype unmarshals an instance of NetworkACLRuleBeforePrototype from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePrototype) +// UnmarshalNetworkInterfaceIPPrototype unmarshals an instance of NetworkInterfaceIPPrototype from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototype) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -54844,78 +57695,98 @@ func UnmarshalNetworkACLRuleBeforePrototype(m map[string]json.RawMessage, result if err != nil { return } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// NetworkACLRuleCollection : NetworkACLRuleCollection struct -type NetworkACLRuleCollection struct { - // A link to the first page of resources. - First *NetworkACLRuleCollectionFirst `json:"first" validate:"required"` +// NetworkInterfaceInstanceContextReference : NetworkInterfaceInstanceContextReference struct +type NetworkInterfaceInstanceContextReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceInstanceContextReferenceDeleted `json:"deleted,omitempty"` - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` + // The URL for this instance network interface. + Href *string `json:"href" 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"` + // The unique identifier for this instance network interface. + ID *string `json:"id" validate:"required"` - // Ordered collection of network ACL rules. - Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` + // The name for this instance network interface. + Name *string `json:"name" validate:"required"` - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` } -// 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) +// Constants associated with the NetworkInterfaceInstanceContextReference.ResourceType property. +// The resource type. +const ( + NetworkInterfaceInstanceContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// UnmarshalNetworkInterfaceInstanceContextReference unmarshals an instance of NetworkInterfaceInstanceContextReference from the specified map of raw messages. +func UnmarshalNetworkInterfaceInstanceContextReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceInstanceContextReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceInstanceContextReferenceDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLRuleCollectionNext) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { 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 *NetworkACLRuleCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return } - return start, nil + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// 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"` +// NetworkInterfaceInstanceContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceInstanceContextReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" 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) +// UnmarshalNetworkInterfaceInstanceContextReferenceDeleted unmarshals an instance of NetworkInterfaceInstanceContextReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceInstanceContextReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } @@ -54923,16 +57794,24 @@ func UnmarshalNetworkACLRuleCollectionFirst(m map[string]json.RawMessage, result 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"` +// NetworkInterfacePatch : NetworkInterfacePatch struct +type NetworkInterfacePatch struct { + // Indicates whether source IP spoofing is allowed on this instance interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // The name for the instance network interface. The name must not be used by another network interface on the virtual + // server instance. + Name *string `json:"name,omitempty"` } -// 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) +// UnmarshalNetworkInterfacePatch unmarshals an instance of NetworkInterfacePatch from the specified map of raw messages. +func UnmarshalNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -54940,256 +57819,263 @@ func UnmarshalNetworkACLRuleCollectionNext(m map[string]json.RawMessage, result return } -// NetworkACLRuleItem : NetworkACLRuleItem struct -// Models which "extend" this model: -// - NetworkACLRuleItemNetworkACLRuleProtocolTcpudp -// - NetworkACLRuleItemNetworkACLRuleProtocolIcmp -// - NetworkACLRuleItemNetworkACLRuleProtocolAll -type NetworkACLRuleItem struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. In a rule collection, this always - // refers to the next item in the collection. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` - - // The ICMP traffic code to match. - // - // If absent, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The ICMP traffic type to match. - // - // If absent, all types are matched. - Type *int64 `json:"type,omitempty"` +// 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) + } + return } -// Constants associated with the NetworkACLRuleItem.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleItemActionAllowConst = "allow" - NetworkACLRuleItemActionDenyConst = "deny" -) +// NetworkInterfacePrototype : NetworkInterfacePrototype struct +type NetworkInterfacePrototype struct { + // Indicates whether source IP spoofing is allowed on this instance interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` -// Constants associated with the NetworkACLRuleItem.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleItemDirectionInboundConst = "inbound" - NetworkACLRuleItemDirectionOutboundConst = "outbound" -) + // The name for the instance network interface. The name must not be used by another network interface on the virtual + // server instance. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` -// Constants associated with the NetworkACLRuleItem.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleItemIPVersionIpv4Const = "ipv4" -) + // The primary IP address to bind to the instance 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 instance network interface's subnet. Otherwise, an + // available address on the subnet will be automatically selected and reserved. + PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` -// Constants associated with the NetworkACLRuleItem.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleItemProtocolAllConst = "all" - NetworkACLRuleItemProtocolIcmpConst = "icmp" - NetworkACLRuleItemProtocolTCPConst = "tcp" - NetworkACLRuleItemProtocolUDPConst = "udp" -) + // The security groups to use for this instance network interface. If unspecified, the VPC's default security group is + // used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` -func (*NetworkACLRuleItem) isaNetworkACLRuleItem() bool { - return true + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` } -type NetworkACLRuleItemIntf interface { - isaNetworkACLRuleItem() bool +// NewNetworkInterfacePrototype : Instantiate NetworkInterfacePrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *NetworkInterfacePrototype, err error) { + _model = &NetworkInterfacePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return } -// UnmarshalNetworkACLRuleItem unmarshals an instance of NetworkACLRuleItem from the specified map of raw messages. -func UnmarshalNetworkACLRuleItem(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) +// UnmarshalNetworkInterfacePrototype unmarshals an instance of NetworkInterfacePrototype from the specified map of raw messages. +func UnmarshalNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) return } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { return } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll) - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp) - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// NetworkACLRulePatch : NetworkACLRulePatch struct -type NetworkACLRulePatch struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action,omitempty"` +// NetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} - // The rule to move this rule immediately before. - // - // Specify `null` to move this rule after all existing rules. - Before NetworkACLRuleBeforePatchIntf `json:"before,omitempty"` +// UnmarshalNetworkInterfaceReferenceDeleted unmarshals an instance of NetworkInterfaceReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The ICMP traffic code to match. If set, `type` must also be set. - // - // Specify `null` to remove an existing ICMP traffic code. - Code *int64 `json:"code,omitempty"` +// NetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceReferenceTargetContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination,omitempty"` +// UnmarshalNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of NetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` +// NetworkInterfaceUnpaginatedCollection : NetworkInterfaceUnpaginatedCollection struct +type NetworkInterfaceUnpaginatedCollection struct { + // Collection of instance network interfaces. + NetworkInterfaces []NetworkInterface `json:"network_interfaces" validate:"required"` +} - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` +// UnmarshalNetworkInterfaceUnpaginatedCollection unmarshals an instance of NetworkInterfaceUnpaginatedCollection from the specified map of raw messages. +func UnmarshalNetworkInterfaceUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceUnpaginatedCollection) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterface) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The direction of traffic to match. - Direction *string `json:"direction,omitempty"` +// ObsoleteImageOptions : The ObsoleteImage options. +type ObsoleteImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. - Name *string `json:"name,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string +} - // The protocol to enforce. - Protocol *string `json:"protocol,omitempty"` +// NewObsoleteImageOptions : Instantiate ObsoleteImageOptions +func (*VpcV1) NewObsoleteImageOptions(id string) *ObsoleteImageOptions { + return &ObsoleteImageOptions{ + ID: core.StringPtr(id), + } +} - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source,omitempty"` +// SetID : Allow user to set ID +func (_options *ObsoleteImageOptions) SetID(id string) *ObsoleteImageOptions { + _options.ID = core.StringPtr(id) + return _options +} - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *ObsoleteImageOptions) SetHeaders(param map[string]string) *ObsoleteImageOptions { + options.Headers = param + return options +} - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` +// OperatingSystem : OperatingSystem struct +type OperatingSystem struct { + // The operating system architecture. + Architecture *string `json:"architecture" validate:"required"` - // The ICMP traffic type to match. - // - // Specify `null` to remove an existing ICMP traffic type value. - Type *int64 `json:"type,omitempty"` -} + // Images with this operating system can only be used on dedicated hosts or dedicated host groups. + DedicatedHostOnly *bool `json:"dedicated_host_only" validate:"required"` -// Constants associated with the NetworkACLRulePatch.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePatchActionAllowConst = "allow" - NetworkACLRulePatchActionDenyConst = "deny" -) + // A unique, display-friendly name for the operating system. + DisplayName *string `json:"display_name" validate:"required"` -// Constants associated with the NetworkACLRulePatch.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePatchDirectionInboundConst = "inbound" - NetworkACLRulePatchDirectionOutboundConst = "outbound" -) + // The software family for this operating system. + Family *string `json:"family" validate:"required"` -// Constants associated with the NetworkACLRulePatch.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePatchProtocolAllConst = "all" - NetworkACLRulePatchProtocolIcmpConst = "icmp" - NetworkACLRulePatchProtocolTCPConst = "tcp" - NetworkACLRulePatchProtocolUDPConst = "udp" -) + // The URL for this operating system. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this operating system. + Name *string `json:"name" validate:"required"` + + // The vendor of the operating system. + Vendor *string `json:"vendor" validate:"required"` -// UnmarshalNetworkACLRulePatch unmarshals an instance of NetworkACLRulePatch from the specified map of raw messages. -func UnmarshalNetworkACLRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePatch) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) + // The major release version of this operating system. + Version *string `json:"version" validate:"required"` +} + +// UnmarshalOperatingSystem unmarshals an instance of OperatingSystem from the specified map of raw messages. +func UnmarshalOperatingSystem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystem) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) if err != nil { return } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePatch) + err = core.UnmarshalPrimitive(m, "dedicated_host_only", &obj.DedicatedHostOnly) if err != nil { return } - err = core.UnmarshalPrimitive(m, "code", &obj.Code) + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) if err != nil { return } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { return } - err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + err = core.UnmarshalPrimitive(m, "vendor", &obj.Vendor) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "version", &obj.Version) if err != nil { return } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemCollection : OperatingSystemCollection struct +type OperatingSystemCollection struct { + // A link to the first page of resources. + First *OperatingSystemCollectionFirst `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"` + + // Collection of operating systems. + OperatingSystems []OperatingSystem `json:"operating_systems" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalOperatingSystemCollectionNext) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + err = core.UnmarshalModel(m, "operating_systems", &obj.OperatingSystems, UnmarshalOperatingSystem) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } @@ -55197,282 +58083,298 @@ func UnmarshalNetworkACLRulePatch(m map[string]json.RawMessage, result interface return } -// 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) +// Retrieve the value to be passed to a request to access the next page of results +func (resp *OperatingSystemCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil } - return + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil } -// NetworkACLRulePrototype : NetworkACLRulePrototype struct -// Models which "extend" this model: -// - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype -// - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype -// - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype -type NetworkACLRulePrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule to insert this rule immediately before. - // - // If unspecified, this rule will be inserted after all existing rules. - Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` +// 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"` +} - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` +// 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"` +} - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` +// 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. +// OperatingSystemIdentity : Identifies an operating system by a unique property. +// Models which "extend" this model: +// - OperatingSystemIdentityByName +// - OperatingSystemIdentityByHref +type OperatingSystemIdentity struct { + // The globally unique name for this operating system. Name *string `json:"name,omitempty"` - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` - - // The ICMP traffic code to match. - // - // If specified, `type` must also be specified. If unspecified, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The ICMP traffic type to match. - // - // If unspecified, all types are matched. - Type *int64 `json:"type,omitempty"` + // The URL for this operating system. + Href *string `json:"href,omitempty"` } -// Constants associated with the NetworkACLRulePrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeProtocolAllConst = "all" - NetworkACLRulePrototypeProtocolIcmpConst = "icmp" - NetworkACLRulePrototypeProtocolTCPConst = "tcp" - NetworkACLRulePrototypeProtocolUDPConst = "udp" -) - -func (*NetworkACLRulePrototype) isaNetworkACLRulePrototype() bool { +func (*OperatingSystemIdentity) isaOperatingSystemIdentity() bool { return true } -type NetworkACLRulePrototypeIntf interface { - isaNetworkACLRulePrototype() bool +type OperatingSystemIdentityIntf interface { + isaOperatingSystemIdentity() bool } -// UnmarshalNetworkACLRulePrototype unmarshals an instance of NetworkACLRulePrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototype(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) +// UnmarshalOperatingSystemIdentity unmarshals an instance of OperatingSystemIdentity from the specified map of raw messages. +func UnmarshalOperatingSystemIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) return } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { return } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) - } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// NetworkACLRulePrototypeNetworkACLContext : NetworkACLRulePrototypeNetworkACLContext struct -// Models which "extend" this model: -// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype -// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype -// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype -type NetworkACLRulePrototypeNetworkACLContext struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` +// PlacementGroup : PlacementGroup struct +type PlacementGroup struct { + // The date and time that the placement group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` + // The CRN for this placement group. + CRN *string `json:"crn" validate:"required"` - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` + // The URL for this placement group. + Href *string `json:"href" validate:"required"` - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + // The unique identifier for this placement group. + ID *string `json:"id" validate:"required"` - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + // The lifecycle state of the placement group. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` + // The name for this placement group. The name is unique across all placement groups in the region. + Name *string `json:"name" validate:"required"` - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` + // The resource group for this placement group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - // The ICMP traffic code to match. - // - // If specified, `type` must also be specified. If unspecified, all codes are matched. - Code *int64 `json:"code,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` - // The ICMP traffic type to match. + // The strategy for this placement group + // - `host_spread`: place on different compute hosts + // - `power_spread`: place on compute hosts that use different power sources // - // If unspecified, all types are matched. - Type *int64 `json:"type,omitempty"` + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the + // unexpected strategy was encountered. + Strategy *string `json:"strategy" validate:"required"` } -// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLContextActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLContextActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Direction property. -// The direction of traffic to match. +// Constants associated with the PlacementGroup.LifecycleState property. +// The lifecycle state of the placement group. const ( - NetworkACLRulePrototypeNetworkACLContextDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLContextDirectionOutboundConst = "outbound" + PlacementGroupLifecycleStateDeletingConst = "deleting" + PlacementGroupLifecycleStateFailedConst = "failed" + PlacementGroupLifecycleStatePendingConst = "pending" + PlacementGroupLifecycleStateStableConst = "stable" + PlacementGroupLifecycleStateSuspendedConst = "suspended" + PlacementGroupLifecycleStateUpdatingConst = "updating" + PlacementGroupLifecycleStateWaitingConst = "waiting" ) -// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.IPVersion property. -// The IP version for this rule. +// Constants associated with the PlacementGroup.ResourceType property. +// The resource type. const ( - NetworkACLRulePrototypeNetworkACLContextIPVersionIpv4Const = "ipv4" + PlacementGroupResourceTypePlacementGroupConst = "placement_group" ) -// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Protocol property. -// The protocol to enforce. +// Constants associated with the PlacementGroup.Strategy property. +// The strategy for this placement group +// - `host_spread`: place on different compute hosts +// - `power_spread`: place on compute hosts that use different power sources +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the +// unexpected strategy was encountered. const ( - NetworkACLRulePrototypeNetworkACLContextProtocolAllConst = "all" - NetworkACLRulePrototypeNetworkACLContextProtocolIcmpConst = "icmp" - NetworkACLRulePrototypeNetworkACLContextProtocolTCPConst = "tcp" - NetworkACLRulePrototypeNetworkACLContextProtocolUDPConst = "udp" + PlacementGroupStrategyHostSpreadConst = "host_spread" + PlacementGroupStrategyPowerSpreadConst = "power_spread" ) -func (*NetworkACLRulePrototypeNetworkACLContext) isaNetworkACLRulePrototypeNetworkACLContext() bool { - return true -} - -type NetworkACLRulePrototypeNetworkACLContextIntf interface { - isaNetworkACLRulePrototypeNetworkACLContext() bool -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLContext unmarshals an instance of NetworkACLRulePrototypeNetworkACLContext from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLContext(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) +// UnmarshalPlacementGroup unmarshals an instance of PlacementGroup from the specified map of raw messages. +func UnmarshalPlacementGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroup) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) return } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { return } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "strategy", &obj.Strategy) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// NetworkACLRuleReference : NetworkACLRuleReference struct -type NetworkACLRuleReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkACLRuleReferenceDeleted `json:"deleted,omitempty"` +// PlacementGroupCollection : PlacementGroupCollection struct +type PlacementGroupCollection struct { + // A link to the first page of resources. + First *PlacementGroupCollectionFirst `json:"first" validate:"required"` - // The URL for this network ACL rule. - 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 network ACL rule. - 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 *PlacementGroupCollectionNext `json:"next,omitempty"` - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` + // Collection of placement groups. + PlacementGroups []PlacementGroup `json:"placement_groups" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalNetworkACLRuleReference unmarshals an instance of NetworkACLRuleReference from the specified map of raw messages. -func UnmarshalNetworkACLRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLRuleReferenceDeleted) +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPlacementGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_groups", &obj.PlacementGroups, UnmarshalPlacementGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { 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 *PlacementGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + 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 { 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. + Name *string `json:"name,omitempty"` +} + +// UnmarshalPlacementGroupPatch unmarshals an instance of PlacementGroupPatch from the specified map of raw messages. +func UnmarshalPlacementGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroupPatch) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -55481,16 +58383,26 @@ func UnmarshalNetworkACLRuleReference(m map[string]json.RawMessage, result inter return } -// NetworkACLRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// 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) + } + return +} + +// PlacementGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary // information. -type NetworkACLRuleReferenceDeleted struct { +type PlacementGroupReferenceDeleted struct { // Link to documentation about deleted resources. MoreInfo *string `json:"more_info" validate:"required"` } - -// UnmarshalNetworkACLRuleReferenceDeleted unmarshals an instance of NetworkACLRuleReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleReferenceDeleted) + +// UnmarshalPlacementGroupReferenceDeleted unmarshals an instance of PlacementGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalPlacementGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroupReferenceDeleted) err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return @@ -55499,82 +58411,69 @@ func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, resul return } -// NetworkInterface : NetworkInterface struct -type NetworkInterface 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" validate:"required"` - - // The date and time that the network interface was created. +// PublicGateway : PublicGateway struct +type PublicGateway struct { + // The date and time that the public gateway was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The floating IPs associated with this network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` + + // The floating IP bound to this public gateway. + FloatingIP *PublicGatewayFloatingIP `json:"floating_ip" validate:"required"` - // The URL for this network interface. + // The URL for this public gateway. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this public gateway. ID *string `json:"id" validate:"required"` - // The name for this network interface. + // The name for this public gateway. The name is unique across all public gateways in the VPC. Name *string `json:"name" validate:"required"` - // The network interface port speed in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + // The resource group for this public gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the network interface. + // The status of this public gateway. Status *string `json:"status" validate:"required"` - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` + // The VPC this public gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` - // The type of this network interface as it relates to an instance. - Type *string `json:"type" validate:"required"` + // The zone this public gateway resides in. + Zone *ZoneReference `json:"zone" validate:"required"` } -// Constants associated with the NetworkInterface.ResourceType property. +// Constants associated with the PublicGateway.ResourceType property. // The resource type. const ( - NetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" -) - -// Constants associated with the NetworkInterface.Status property. -// The status of the network interface. -const ( - NetworkInterfaceStatusAvailableConst = "available" - NetworkInterfaceStatusDeletingConst = "deleting" - NetworkInterfaceStatusFailedConst = "failed" - NetworkInterfaceStatusPendingConst = "pending" + PublicGatewayResourceTypePublicGatewayConst = "public_gateway" ) -// Constants associated with the NetworkInterface.Type property. -// The type of this network interface as it relates to an instance. +// Constants associated with the PublicGateway.Status property. +// The status of this public gateway. const ( - NetworkInterfaceTypePrimaryConst = "primary" - NetworkInterfaceTypeSecondaryConst = "secondary" + PublicGatewayStatusAvailableConst = "available" + PublicGatewayStatusDeletingConst = "deleting" + PublicGatewayStatusFailedConst = "failed" + PublicGatewayStatusPendingConst = "pending" ) -// UnmarshalNetworkInterface unmarshals an instance of NetworkInterface from the specified map of raw messages. -func UnmarshalNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterface) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) +// UnmarshalPublicGateway unmarshals an instance of PublicGateway from the specified map of raw messages. +func UnmarshalPublicGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGateway) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + err = core.UnmarshalModel(m, "floating_ip", &obj.FloatingIP, UnmarshalPublicGatewayFloatingIP) if err != nil { return } @@ -55590,11 +58489,7 @@ func UnmarshalNetworkInterface(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -55602,19 +58497,15 @@ func UnmarshalNetworkInterface(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) if err != nil { return } @@ -55622,64 +58513,91 @@ func UnmarshalNetworkInterface(m map[string]json.RawMessage, result interface{}) return } -// NetworkInterfaceBareMetalServerContextReference : NetworkInterfaceBareMetalServerContextReference struct -type NetworkInterfaceBareMetalServerContextReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceBareMetalServerContextReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network interface. - ID *string `json:"id" validate:"required"` +// PublicGatewayCollection : PublicGatewayCollection struct +type PublicGatewayCollection struct { + // A link to the first page of resources. + First *PublicGatewayCollectionFirst `json:"first" validate:"required"` - // The name for this network interface. - Name *string `json:"name" validate:"required"` + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` - PrimaryIP *ReservedIPReference `json:"primary_ip" 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"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // Collection of public gateways. + PublicGateways []PublicGateway `json:"public_gateways" validate:"required"` - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// Constants associated with the NetworkInterfaceBareMetalServerContextReference.ResourceType property. -// The resource type. -const ( - NetworkInterfaceBareMetalServerContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" -) - -// UnmarshalNetworkInterfaceBareMetalServerContextReference unmarshals an instance of NetworkInterfaceBareMetalServerContextReference from the specified map of raw messages. -func UnmarshalNetworkInterfaceBareMetalServerContextReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceBareMetalServerContextReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted) +// 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) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPublicGatewayCollectionNext) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "public_gateways", &obj.PublicGateways, UnmarshalPublicGateway) if err != nil { return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + 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 *PublicGatewayCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + 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 { return } @@ -55687,17 +58605,52 @@ func UnmarshalNetworkInterfaceBareMetalServerContextReference(m map[string]json. return } -// NetworkInterfaceBareMetalServerContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceBareMetalServerContextReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` +// PublicGatewayFloatingIP : The floating IP bound to this public gateway. +type PublicGatewayFloatingIP struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` + + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` + + // The name for this floating IP. The name is unique across all floating IPs in the region. + Name *string `json:"name" validate:"required"` } -// UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted unmarshals an instance of NetworkInterfaceBareMetalServerContextReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceBareMetalServerContextReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) +// UnmarshalPublicGatewayFloatingIP unmarshals an instance of PublicGatewayFloatingIP from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -55705,47 +58658,51 @@ func UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted(m map[strin return } -// NetworkInterfaceIPPrototype : NetworkInterfaceIPPrototype struct +// PublicGatewayFloatingIPPrototype : PublicGatewayFloatingIPPrototype struct // Models which "extend" this model: -// - NetworkInterfaceIPPrototypeReservedIPIdentity -// - NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext -type NetworkInterfaceIPPrototype struct { - // The unique identifier for this reserved IP. +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentity +// - PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext +type PublicGatewayFloatingIPPrototype struct { + // The unique identifier for this floating IP. ID *string `json:"id,omitempty"` - // The URL for this reserved IP. + // The CRN for this floating IP. + CRN *string `json:"crn,omitempty"` + + // The URL for this floating IP. Href *string `json:"href,omitempty"` - // 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. + // The globally unique IP address. Address *string `json:"address,omitempty"` - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the 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. + // The name for this floating IP. The name must not be used by another floating IP in the region. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` } -func (*NetworkInterfaceIPPrototype) isaNetworkInterfaceIPPrototype() bool { +func (*PublicGatewayFloatingIPPrototype) isaPublicGatewayFloatingIPPrototype() bool { return true } -type NetworkInterfaceIPPrototypeIntf interface { - isaNetworkInterfaceIPPrototype() bool +type PublicGatewayFloatingIPPrototypeIntf interface { + isaPublicGatewayFloatingIPPrototype() bool } -// UnmarshalNetworkInterfaceIPPrototype unmarshals an instance of NetworkInterfaceIPPrototype from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototype) +// UnmarshalPublicGatewayFloatingIPPrototype unmarshals an instance of PublicGatewayFloatingIPPrototype from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototype) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -55754,10 +58711,70 @@ func UnmarshalNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result i if err != nil { return } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentity : Identifies a public gateway by a unique property. +// Models which "extend" this model: +// - PublicGatewayIdentityPublicGatewayIdentityByID +// - PublicGatewayIdentityPublicGatewayIdentityByCRN +// - PublicGatewayIdentityPublicGatewayIdentityByHref +type PublicGatewayIdentity struct { + // The unique identifier for this public gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this public gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href,omitempty"` +} + +func (*PublicGatewayIdentity) isaPublicGatewayIdentity() bool { + return true +} + +type PublicGatewayIdentityIntf interface { + isaPublicGatewayIdentity() bool +} + +// UnmarshalPublicGatewayIdentity unmarshals an instance of PublicGatewayIdentity from the specified map of raw messages. +func UnmarshalPublicGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayPatch : PublicGatewayPatch struct +type PublicGatewayPatch struct { + // The name for this public gateway. The name must not be used by another public gateway in the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalPublicGatewayPatch unmarshals an instance of PublicGatewayPatch from the specified map of raw messages. +func UnmarshalPublicGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayPatch) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -55766,56 +58783,64 @@ func UnmarshalNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result i return } -// NetworkInterfaceInstanceContextReference : NetworkInterfaceInstanceContextReference struct -type NetworkInterfaceInstanceContextReference struct { +// 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) + } + return +} + +// PublicGatewayReference : PublicGatewayReference struct +type PublicGatewayReference struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` + // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *NetworkInterfaceInstanceContextReferenceDeleted `json:"deleted,omitempty"` + Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this public gateway. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this public gateway. ID *string `json:"id" validate:"required"` - // The name for this network interface. + // The name for this public gateway. The name is unique across all public gateways in the VPC. Name *string `json:"name" validate:"required"` - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` } -// Constants associated with the NetworkInterfaceInstanceContextReference.ResourceType property. +// Constants associated with the PublicGatewayReference.ResourceType property. // The resource type. const ( - NetworkInterfaceInstanceContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" + PublicGatewayReferenceResourceTypePublicGatewayConst = "public_gateway" ) -// UnmarshalNetworkInterfaceInstanceContextReference unmarshals an instance of NetworkInterfaceInstanceContextReference from the specified map of raw messages. -func UnmarshalNetworkInterfaceInstanceContextReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceInstanceContextReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceInstanceContextReferenceDeleted) +// UnmarshalPublicGatewayReference unmarshals an instance of PublicGatewayReference from the specified map of raw messages. +func UnmarshalPublicGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPublicGatewayReferenceDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -55823,24 +58848,20 @@ func UnmarshalNetworkInterfaceInstanceContextReference(m map[string]json.RawMess if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// NetworkInterfaceInstanceContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// PublicGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary // information. -type NetworkInterfaceInstanceContextReferenceDeleted struct { +type PublicGatewayReferenceDeleted struct { // Link to documentation about deleted resources. MoreInfo *string `json:"more_info" validate:"required"` } -// UnmarshalNetworkInterfaceInstanceContextReferenceDeleted unmarshals an instance of NetworkInterfaceInstanceContextReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceInstanceContextReferenceDeleted) +// UnmarshalPublicGatewayReferenceDeleted unmarshals an instance of PublicGatewayReferenceDeleted from the specified map of raw messages. +func UnmarshalPublicGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayReferenceDeleted) err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return @@ -55849,21 +58870,116 @@ func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json. return } -// NetworkInterfacePatch : NetworkInterfacePatch struct -type NetworkInterfacePatch 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"` +// Region : Region struct +type Region struct { + // The API endpoint for this region. + Endpoint *string `json:"endpoint" validate:"required"` - // The name for network interface. The name must not be used by another network interface on the virtual server - // instance. + // The URL for this region. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this region. + Name *string `json:"name" validate:"required"` + + // The availability status of this region. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the Region.Status property. +// The availability status of this region. +const ( + RegionStatusAvailableConst = "available" + RegionStatusUnavailableConst = "unavailable" +) + +// UnmarshalRegion unmarshals an instance of Region from the specified map of raw messages. +func UnmarshalRegion(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Region) + err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionCollection : RegionCollection struct +type RegionCollection struct { + // Collection of regions. + Regions []Region `json:"regions" validate:"required"` +} + +// UnmarshalRegionCollection unmarshals an instance of RegionCollection from the specified map of raw messages. +func UnmarshalRegionCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionCollection) + err = core.UnmarshalModel(m, "regions", &obj.Regions, UnmarshalRegion) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionIdentity : Identifies a region by a unique property. +// Models which "extend" this model: +// - RegionIdentityByName +// - RegionIdentityByHref +type RegionIdentity struct { + // The globally unique name for this region. Name *string `json:"name,omitempty"` + + // The URL for this region. + Href *string `json:"href,omitempty"` } -// UnmarshalNetworkInterfacePatch unmarshals an instance of NetworkInterfacePatch from the specified map of raw messages. -func UnmarshalNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfacePatch) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) +func (*RegionIdentity) isaRegionIdentity() bool { + return true +} + +type RegionIdentityIntf interface { + isaRegionIdentity() bool +} + +// UnmarshalRegionIdentity unmarshals an instance of RegionIdentity from the specified map of raw messages. +func UnmarshalRegionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionReference : RegionReference struct +type RegionReference struct { + // The URL for this region. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalRegionReference unmarshals an instance of RegionReference from the specified map of raw messages. +func UnmarshalRegionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -55875,426 +58991,459 @@ func UnmarshalNetworkInterfacePatch(m map[string]json.RawMessage, result interfa return } -// 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) +// RemoveBareMetalServerNetworkInterfaceFloatingIPOptions : The RemoveBareMetalServerNetworkInterfaceFloatingIP options. +type RemoveBareMetalServerNetworkInterfaceFloatingIPOptions 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 +} + +// NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate RemoveBareMetalServerNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + return &RemoveBareMetalServerNetworkInterfaceFloatingIPOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), } - return } -// NetworkInterfacePrototype : NetworkInterfacePrototype struct -type NetworkInterfacePrototype 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"` +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} - // The name for network interface. The name must not be used by another network interface on the virtual server - // instance. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} - // The primary IP address to bind to the 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 network interface's subnet. Otherwise, an available address on the - // subnet will be automatically selected and reserved. - PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` +// SetID : Allow user to set ID +func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} - // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} - // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` +// RemoveEndpointGatewayIPOptions : The RemoveEndpointGatewayIP options. +type RemoveEndpointGatewayIPOptions 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 } -// NewNetworkInterfacePrototype : Instantiate NetworkInterfacePrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *NetworkInterfacePrototype, err error) { - _model = &NetworkInterfacePrototype{ - Subnet: subnet, +// NewRemoveEndpointGatewayIPOptions : Instantiate RemoveEndpointGatewayIPOptions +func (*VpcV1) NewRemoveEndpointGatewayIPOptions(endpointGatewayID string, id string) *RemoveEndpointGatewayIPOptions { + return &RemoveEndpointGatewayIPOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + ID: core.StringPtr(id), } - err = core.ValidateStruct(_model, "required parameters") - return } -// UnmarshalNetworkInterfacePrototype unmarshals an instance of NetworkInterfacePrototype from the specified map of raw messages. -func UnmarshalNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfacePrototype) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (_options *RemoveEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *RemoveEndpointGatewayIPOptions { + _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return _options } -// NetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` +// SetID : Allow user to set ID +func (_options *RemoveEndpointGatewayIPOptions) SetID(id string) *RemoveEndpointGatewayIPOptions { + _options.ID = core.StringPtr(id) + return _options } -// UnmarshalNetworkInterfaceReferenceDeleted unmarshals an instance of NetworkInterfaceReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetHeaders : Allow user to set Headers +func (options *RemoveEndpointGatewayIPOptions) SetHeaders(param map[string]string) *RemoveEndpointGatewayIPOptions { + options.Headers = param + return options } -// NetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceReferenceTargetContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` +// RemoveInstanceNetworkInterfaceFloatingIPOptions : The RemoveInstanceNetworkInterfaceFloatingIP options. +type RemoveInstanceNetworkInterfaceFloatingIPOptions 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 } -// UnmarshalNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of NetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceReferenceTargetContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return +// NewRemoveInstanceNetworkInterfaceFloatingIPOptions : Instantiate RemoveInstanceNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewRemoveInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + return &RemoveInstanceNetworkInterfaceFloatingIPOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// NetworkInterfaceUnpaginatedCollection : NetworkInterfaceUnpaginatedCollection struct -type NetworkInterfaceUnpaginatedCollection struct { - // Collection of network interfaces. - NetworkInterfaces []NetworkInterface `json:"network_interfaces" validate:"required"` +// SetInstanceID : Allow user to set InstanceID +func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options } -// UnmarshalNetworkInterfaceUnpaginatedCollection unmarshals an instance of NetworkInterfaceUnpaginatedCollection from the specified map of raw messages. -func UnmarshalNetworkInterfaceUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceUnpaginatedCollection) - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterface) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options } -// ObsoleteImageOptions : The ObsoleteImage options. -type ObsoleteImageOptions struct { - // The image identifier. +// SetID : Allow user to set ID +func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// RemoveVPNGatewayConnectionLocalCIDROptions : The RemoveVPNGatewayConnectionLocalCIDR options. +type RemoveVPNGatewayConnectionLocalCIDROptions 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 address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + // Allows users to set headers on API requests Headers map[string]string } -// NewObsoleteImageOptions : Instantiate ObsoleteImageOptions -func (*VpcV1) NewObsoleteImageOptions(id string) *ObsoleteImageOptions { - return &ObsoleteImageOptions{ - ID: core.StringPtr(id), +// NewRemoveVPNGatewayConnectionLocalCIDROptions : Instantiate RemoveVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewRemoveVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *RemoveVPNGatewayConnectionLocalCIDROptions { + return &RemoveVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), } } +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionLocalCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + // SetID : Allow user to set ID -func (_options *ObsoleteImageOptions) SetID(id string) *ObsoleteImageOptions { +func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionLocalCIDROptions { _options.ID = core.StringPtr(id) return _options } +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *RemoveVPNGatewayConnectionLocalCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *RemoveVPNGatewayConnectionLocalCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + // SetHeaders : Allow user to set Headers -func (options *ObsoleteImageOptions) SetHeaders(param map[string]string) *ObsoleteImageOptions { +func (options *RemoveVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionLocalCIDROptions { options.Headers = param return options } -// OperatingSystem : OperatingSystem struct -type OperatingSystem struct { - // The operating system architecture. - Architecture *string `json:"architecture" validate:"required"` +// RemoveVPNGatewayConnectionPeerCIDROptions : The RemoveVPNGatewayConnectionPeerCIDR options. +type RemoveVPNGatewayConnectionPeerCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - // Images with this operating system can only be used on dedicated hosts or dedicated host groups. - DedicatedHostOnly *bool `json:"dedicated_host_only" validate:"required"` + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` - // A unique, display-friendly name for the operating system. - DisplayName *string `json:"display_name" validate:"required"` + // The address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - // The software family for this operating system. - Family *string `json:"family" validate:"required"` + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` - // The URL for this operating system. - Href *string `json:"href" validate:"required"` + // Allows users to set headers on API requests + Headers map[string]string +} - // The globally unique name for this operating system. - Name *string `json:"name" validate:"required"` +// NewRemoveVPNGatewayConnectionPeerCIDROptions : Instantiate RemoveVPNGatewayConnectionPeerCIDROptions +func (*VpcV1) NewRemoveVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *RemoveVPNGatewayConnectionPeerCIDROptions { + return &RemoveVPNGatewayConnectionPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} - // The vendor of the operating system. - Vendor *string `json:"vendor" validate:"required"` +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionPeerCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} - // The major release version of this operating system. - Version *string `json:"version" validate:"required"` +// SetID : Allow user to set ID +func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionPeerCIDROptions { + _options.ID = core.StringPtr(id) + return _options } -// UnmarshalOperatingSystem unmarshals an instance of OperatingSystem from the specified map of raw messages. -func UnmarshalOperatingSystem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystem) - err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "dedicated_host_only", &obj.DedicatedHostOnly) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "vendor", &obj.Vendor) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "version", &obj.Version) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *RemoveVPNGatewayConnectionPeerCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options } -// OperatingSystemCollection : OperatingSystemCollection struct -type OperatingSystemCollection struct { - // A link to the first page of resources. - First *OperatingSystemCollectionFirst `json:"first" validate:"required"` +// SetPrefixLength : Allow user to set PrefixLength +func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *RemoveVPNGatewayConnectionPeerCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` +// SetHeaders : Allow user to set Headers +func (options *RemoveVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionPeerCIDROptions { + options.Headers = param + return options +} - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *OperatingSystemCollectionNext `json:"next,omitempty"` +// ReplaceLoadBalancerPoolMembersOptions : The ReplaceLoadBalancerPoolMembers options. +type ReplaceLoadBalancerPoolMembersOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - // Collection of operating systems. - OperatingSystems []OperatingSystem `json:"operating_systems" validate:"required"` + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` + // The member prototype objects for this pool. + Members []LoadBalancerPoolMemberPrototype `json:"members" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string } -// 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) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalOperatingSystemCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "operating_systems", &obj.OperatingSystems, UnmarshalOperatingSystem) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return +// NewReplaceLoadBalancerPoolMembersOptions : Instantiate ReplaceLoadBalancerPoolMembersOptions +func (*VpcV1) NewReplaceLoadBalancerPoolMembersOptions(loadBalancerID string, poolID string, members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { + return &ReplaceLoadBalancerPoolMembersOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + Members: members, } - 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 *OperatingSystemCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ReplaceLoadBalancerPoolMembersOptions) SetLoadBalancerID(loadBalancerID string) *ReplaceLoadBalancerPoolMembersOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options } -// 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"` +// SetPoolID : Allow user to set PoolID +func (_options *ReplaceLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *ReplaceLoadBalancerPoolMembersOptions { + _options.PoolID = core.StringPtr(poolID) + return _options } -// 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 { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetMembers : Allow user to set Members +func (_options *ReplaceLoadBalancerPoolMembersOptions) SetMembers(members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { + _options.Members = members + return _options } -// 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"` +// SetHeaders : Allow user to set Headers +func (options *ReplaceLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ReplaceLoadBalancerPoolMembersOptions { + options.Headers = param + return options } -// 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 { - return +// ReplaceSubnetNetworkACLOptions : The ReplaceSubnetNetworkACL options. +type ReplaceSubnetNetworkACLOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The network ACL identity. + NetworkACLIdentity NetworkACLIdentityIntf `json:"NetworkACLIdentity" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceSubnetNetworkACLOptions : Instantiate ReplaceSubnetNetworkACLOptions +func (*VpcV1) NewReplaceSubnetNetworkACLOptions(id string, networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { + return &ReplaceSubnetNetworkACLOptions{ + ID: core.StringPtr(id), + NetworkACLIdentity: networkACLIdentity, } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// OperatingSystemIdentity : Identifies an operating system by a unique property. -// Models which "extend" this model: -// - OperatingSystemIdentityByName -// - OperatingSystemIdentityByHref -type OperatingSystemIdentity struct { - // The globally unique name for this operating system. - Name *string `json:"name,omitempty"` +// SetID : Allow user to set ID +func (_options *ReplaceSubnetNetworkACLOptions) SetID(id string) *ReplaceSubnetNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} - // The URL for this operating system. - Href *string `json:"href,omitempty"` +// SetNetworkACLIdentity : Allow user to set NetworkACLIdentity +func (_options *ReplaceSubnetNetworkACLOptions) SetNetworkACLIdentity(networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { + _options.NetworkACLIdentity = networkACLIdentity + return _options } -func (*OperatingSystemIdentity) isaOperatingSystemIdentity() bool { - return true +// SetHeaders : Allow user to set Headers +func (options *ReplaceSubnetNetworkACLOptions) SetHeaders(param map[string]string) *ReplaceSubnetNetworkACLOptions { + options.Headers = param + return options +} + +// ReplaceSubnetRoutingTableOptions : The ReplaceSubnetRoutingTable options. +type ReplaceSubnetRoutingTableOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The routing table identity. + RoutingTableIdentity RoutingTableIdentityIntf `json:"RoutingTableIdentity" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceSubnetRoutingTableOptions : Instantiate ReplaceSubnetRoutingTableOptions +func (*VpcV1) NewReplaceSubnetRoutingTableOptions(id string, routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { + return &ReplaceSubnetRoutingTableOptions{ + ID: core.StringPtr(id), + RoutingTableIdentity: routingTableIdentity, + } +} + +// SetID : Allow user to set ID +func (_options *ReplaceSubnetRoutingTableOptions) SetID(id string) *ReplaceSubnetRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options } -type OperatingSystemIdentityIntf interface { - isaOperatingSystemIdentity() bool +// SetRoutingTableIdentity : Allow user to set RoutingTableIdentity +func (_options *ReplaceSubnetRoutingTableOptions) SetRoutingTableIdentity(routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { + _options.RoutingTableIdentity = routingTableIdentity + return _options } -// UnmarshalOperatingSystemIdentity unmarshals an instance of OperatingSystemIdentity from the specified map of raw messages. -func UnmarshalOperatingSystemIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetHeaders : Allow user to set Headers +func (options *ReplaceSubnetRoutingTableOptions) SetHeaders(param map[string]string) *ReplaceSubnetRoutingTableOptions { + options.Headers = param + return options } -// PlacementGroup : PlacementGroup struct -type PlacementGroup struct { - // The date and time that the placement group was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` +// ReservedIP : ReservedIP struct +type ReservedIP struct { + // The IP address. + // + // If the address has not yet been selected, the value will be `0.0.0.0`. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` - // The CRN for this placement group. - CRN *string `json:"crn" validate:"required"` + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete" validate:"required"` - // The URL for this placement group. + // The date and time that the reserved IP was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this reserved IP. Href *string `json:"href" validate:"required"` - // The unique identifier for this placement group. + // The unique identifier for this reserved IP. ID *string `json:"id" validate:"required"` - // The lifecycle state of the placement group. + // The lifecycle state of the reserved IP. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The name for this placement group. The name is unique across all placement groups in the region. + // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. Name *string `json:"name" validate:"required"` - // The resource group for this placement group. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + // The owner of the reserved IP. + Owner *string `json:"owner" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The strategy for this placement group - // - `host_spread`: place on different compute hosts - // - `power_spread`: place on compute hosts that use different power sources + // The target this reserved IP is bound to. // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the - // unexpected strategy was encountered. - Strategy *string `json:"strategy" validate:"required"` + // If absent, this reserved IP is provider-owned or unbound. + Target ReservedIPTargetIntf `json:"target,omitempty"` } -// Constants associated with the PlacementGroup.LifecycleState property. -// The lifecycle state of the placement group. +// Constants associated with the ReservedIP.LifecycleState property. +// The lifecycle state of the reserved IP. const ( - PlacementGroupLifecycleStateDeletingConst = "deleting" - PlacementGroupLifecycleStateFailedConst = "failed" - PlacementGroupLifecycleStatePendingConst = "pending" - PlacementGroupLifecycleStateStableConst = "stable" - PlacementGroupLifecycleStateSuspendedConst = "suspended" - PlacementGroupLifecycleStateUpdatingConst = "updating" - PlacementGroupLifecycleStateWaitingConst = "waiting" + ReservedIPLifecycleStateDeletingConst = "deleting" + ReservedIPLifecycleStateFailedConst = "failed" + ReservedIPLifecycleStatePendingConst = "pending" + ReservedIPLifecycleStateStableConst = "stable" + ReservedIPLifecycleStateSuspendedConst = "suspended" + ReservedIPLifecycleStateUpdatingConst = "updating" + ReservedIPLifecycleStateWaitingConst = "waiting" ) -// Constants associated with the PlacementGroup.ResourceType property. -// The resource type. +// Constants associated with the ReservedIP.Owner property. +// The owner of the reserved IP. const ( - PlacementGroupResourceTypePlacementGroupConst = "placement_group" + ReservedIPOwnerProviderConst = "provider" + ReservedIPOwnerUserConst = "user" ) -// Constants associated with the PlacementGroup.Strategy property. -// The strategy for this placement group -// - `host_spread`: place on different compute hosts -// - `power_spread`: place on compute hosts that use different power sources -// -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the -// unexpected strategy was encountered. +// Constants associated with the ReservedIP.ResourceType property. +// The resource type. const ( - PlacementGroupStrategyHostSpreadConst = "host_spread" - PlacementGroupStrategyPowerSpreadConst = "power_spread" + ReservedIPResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" ) -// UnmarshalPlacementGroup unmarshals an instance of PlacementGroup from the specified map of raw messages. -func UnmarshalPlacementGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroup) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) +// UnmarshalReservedIP unmarshals an instance of ReservedIP from the specified map of raw messages. +func UnmarshalReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } @@ -56314,7 +59463,7 @@ func UnmarshalPlacementGroup(m map[string]json.RawMessage, result interface{}) ( if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalPrimitive(m, "owner", &obj.Owner) if err != nil { return } @@ -56322,7 +59471,7 @@ func UnmarshalPlacementGroup(m map[string]json.RawMessage, result interface{}) ( if err != nil { return } - err = core.UnmarshalPrimitive(m, "strategy", &obj.Strategy) + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalReservedIPTarget) if err != nil { return } @@ -56330,29 +59479,29 @@ func UnmarshalPlacementGroup(m map[string]json.RawMessage, result interface{}) ( return } -// PlacementGroupCollection : PlacementGroupCollection struct -type PlacementGroupCollection struct { +// ReservedIPCollection : ReservedIPCollection struct +type ReservedIPCollection struct { // A link to the first page of resources. - First *PlacementGroupCollectionFirst `json:"first" validate:"required"` + First *ReservedIPCollectionFirst `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 *ReservedIPCollectionNext `json:"next,omitempty"` - // Collection of placement groups. - PlacementGroups []PlacementGroup `json:"placement_groups" validate:"required"` + // Collection of reserved IPs in this subnet. + ReservedIps []ReservedIP `json:"reserved_ips" validate:"required"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// 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) +// 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) if err != nil { return } @@ -56360,11 +59509,11 @@ func UnmarshalPlacementGroupCollection(m map[string]json.RawMessage, result inte if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPlacementGroupCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionNext) if err != nil { return } - err = core.UnmarshalModel(m, "placement_groups", &obj.PlacementGroups, UnmarshalPlacementGroup) + err = core.UnmarshalModel(m, "reserved_ips", &obj.ReservedIps, UnmarshalReservedIP) if err != nil { return } @@ -56377,7 +59526,7 @@ func UnmarshalPlacementGroupCollection(m map[string]json.RawMessage, result inte } // Retrieve the value to be passed to a request to access the next page of results -func (resp *PlacementGroupCollection) GetNextStart() (*string, error) { +func (resp *ReservedIPCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -56388,78 +59537,62 @@ 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"` +// ReservedIPCollectionBareMetalServerNetworkInterfaceContext : ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct +type ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct { + // A link to the first page of resources. + First *ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst `json:"first" validate:"required"` + + // Collection of reserved IPs bound to a bare metal server network interface. + Ips []ReservedIP `json:"ips" 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 *ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" 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) +// 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) if err != nil { 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) + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) if err != nil { 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. - Name *string `json:"name,omitempty"` -} - -// UnmarshalPlacementGroupPatch unmarshals an instance of PlacementGroupPatch from the specified map of raw messages. -func UnmarshalPlacementGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroupPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// PlacementGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type PlacementGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` +// 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"` } -// UnmarshalPlacementGroupReferenceDeleted unmarshals an instance of PlacementGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalPlacementGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroupReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) +// 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 { return } @@ -56467,143 +59600,58 @@ func UnmarshalPlacementGroupReferenceDeleted(m map[string]json.RawMessage, resul return } -// PublicGateway : PublicGateway struct -type PublicGateway struct { - // The date and time that the public gateway was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this public gateway. - CRN *string `json:"crn" validate:"required"` - - // The floating IP bound to this public gateway. - FloatingIP *PublicGatewayFloatingIP `json:"floating_ip" validate:"required"` - - // The URL for this public gateway. +// 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"` - - // The unique identifier for this public gateway. - ID *string `json:"id" validate:"required"` - - // The name for this public gateway. The name is unique across all public gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this public gateway. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of this public gateway. - Status *string `json:"status" validate:"required"` - - // The VPC this public gateway resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // The zone this public gateway resides in. - Zone *ZoneReference `json:"zone" validate:"required"` } -// Constants associated with the PublicGateway.ResourceType property. -// The resource type. -const ( - PublicGatewayResourceTypePublicGatewayConst = "public_gateway" -) - -// Constants associated with the PublicGateway.Status property. -// The status of this public gateway. -const ( - PublicGatewayStatusAvailableConst = "available" - PublicGatewayStatusDeletingConst = "deleting" - PublicGatewayStatusFailedConst = "failed" - PublicGatewayStatusPendingConst = "pending" -) - -// UnmarshalPublicGateway unmarshals an instance of PublicGateway from the specified map of raw messages. -func UnmarshalPublicGateway(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGateway) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "floating_ip", &obj.FloatingIP, UnmarshalPublicGatewayFloatingIP) - if err != nil { - return - } +// 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 { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// PublicGatewayCollection : PublicGatewayCollection struct -type PublicGatewayCollection struct { +// ReservedIPCollectionEndpointGatewayContext : ReservedIPCollectionEndpointGatewayContext struct +type ReservedIPCollectionEndpointGatewayContext struct { // A link to the first page of resources. - First *PublicGatewayCollectionFirst `json:"first" validate:"required"` + First *ReservedIPCollectionEndpointGatewayContextFirst `json:"first" validate:"required"` + + // Collection of reserved IPs bound to an endpoint gateway. + Ips []ReservedIP `json:"ips" 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"` - - // Collection of public gateways. - PublicGateways []PublicGateway `json:"public_gateways" validate:"required"` + Next *ReservedIPCollectionEndpointGatewayContextNext `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// 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) +// 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) if err != nil { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPublicGatewayCollectionNext) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalModel(m, "public_gateways", &obj.PublicGateways, UnmarshalPublicGateway) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionEndpointGatewayContextNext) if err != nil { return } @@ -56616,7 +59664,7 @@ func UnmarshalPublicGatewayCollection(m map[string]json.RawMessage, result inter } // Retrieve the value to be passed to a request to access the next page of results -func (resp *PublicGatewayCollection) GetNextStart() (*string, error) { +func (resp *ReservedIPCollectionEndpointGatewayContext) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -56627,15 +59675,15 @@ func (resp *PublicGatewayCollection) GetNextStart() (*string, error) { return start, nil } -// PublicGatewayCollectionFirst : A link to the first page of resources. -type PublicGatewayCollectionFirst struct { +// 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"` } -// 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) +// 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 { return @@ -56644,15 +59692,15 @@ func UnmarshalPublicGatewayCollectionFirst(m map[string]json.RawMessage, result return } -// PublicGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type PublicGatewayCollectionNext struct { +// 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"` } -// 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) +// 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 { return @@ -56661,117 +59709,62 @@ func UnmarshalPublicGatewayCollectionNext(m map[string]json.RawMessage, result i return } -// PublicGatewayFloatingIP : The floating IP bound to this public gateway. -type PublicGatewayFloatingIP struct { - // The globally unique IP address. - Address *string `json:"address" validate:"required"` - - // The CRN for this floating IP. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this floating IP. +// 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"` - - // The unique identifier for this floating IP. - ID *string `json:"id" validate:"required"` - - // The name for this floating IP. The name is unique across all floating IPs in the region. - Name *string `json:"name" validate:"required"` } -// UnmarshalPublicGatewayFloatingIP unmarshals an instance of PublicGatewayFloatingIP from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) - if err != nil { - return - } +// 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 { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// PublicGatewayFloatingIPPrototype : PublicGatewayFloatingIPPrototype struct -// Models which "extend" this model: -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentity -// - PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext -type PublicGatewayFloatingIPPrototype struct { - // The unique identifier for this floating IP. - ID *string `json:"id,omitempty"` - - // The CRN for this floating IP. - CRN *string `json:"crn,omitempty"` - - // The URL for this floating IP. - Href *string `json:"href,omitempty"` - - // The globally unique IP address. - Address *string `json:"address,omitempty"` +// ReservedIPCollectionInstanceNetworkInterfaceContext : ReservedIPCollectionInstanceNetworkInterfaceContext struct +type ReservedIPCollectionInstanceNetworkInterfaceContext struct { + // A link to the first page of resources. + First *ReservedIPCollectionInstanceNetworkInterfaceContextFirst `json:"first" validate:"required"` - // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // Collection of reserved IPs bound to an instance network interface. + Ips []ReservedIP `json:"ips" validate:"required"` - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` -} + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` -func (*PublicGatewayFloatingIPPrototype) isaPublicGatewayFloatingIPPrototype() bool { - return true -} + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *ReservedIPCollectionInstanceNetworkInterfaceContextNext `json:"next,omitempty"` -type PublicGatewayFloatingIPPrototypeIntf interface { - isaPublicGatewayFloatingIPPrototype() bool + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalPublicGatewayFloatingIPPrototype unmarshals an instance of PublicGatewayFloatingIPPrototype from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// 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) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) if err != nil { return } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } @@ -56779,41 +59772,61 @@ func UnmarshalPublicGatewayFloatingIPPrototype(m map[string]json.RawMessage, res return } -// PublicGatewayIdentity : Identifies a public gateway by a unique property. -// Models which "extend" this model: -// - PublicGatewayIdentityPublicGatewayIdentityByID -// - PublicGatewayIdentityPublicGatewayIdentityByCRN -// - PublicGatewayIdentityPublicGatewayIdentityByHref -type PublicGatewayIdentity struct { - // The unique identifier for this public gateway. - ID *string `json:"id,omitempty"` - - // The CRN for this public gateway. - CRN *string `json:"crn,omitempty"` - - // The URL for this public gateway. - Href *string `json:"href,omitempty"` -} - -func (*PublicGatewayIdentity) isaPublicGatewayIdentity() bool { - return true +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ReservedIPCollectionInstanceNetworkInterfaceContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil } -type PublicGatewayIdentityIntf interface { - isaPublicGatewayIdentity() bool +// 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"` } -// UnmarshalPublicGatewayIdentity unmarshals an instance of PublicGatewayIdentity from the specified map of raw messages. -func UnmarshalPublicGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// 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 { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + 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 { 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 { return @@ -56822,15 +59835,24 @@ func UnmarshalPublicGatewayIdentity(m map[string]json.RawMessage, result interfa return } -// PublicGatewayPatch : PublicGatewayPatch struct -type PublicGatewayPatch struct { - // The name for this public gateway. The name must not be used by another public gateway in the VPC. +// ReservedIPPatch : ReservedIPPatch struct +type ReservedIPPatch struct { + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with + // `ibm-` are reserved for provider-owned resources, and are not allowed. Name *string `json:"name,omitempty"` } -// UnmarshalPublicGatewayPatch unmarshals an instance of PublicGatewayPatch from the specified map of raw messages. -func UnmarshalPublicGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayPatch) +// UnmarshalReservedIPPatch unmarshals an instance of ReservedIPPatch from the specified map of raw messages. +func UnmarshalReservedIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPPatch) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -56839,52 +59861,58 @@ func UnmarshalPublicGatewayPatch(m map[string]json.RawMessage, result interface{ return } -// AsPatch returns a generic map representation of the PublicGatewayPatch -func (publicGatewayPatch *PublicGatewayPatch) AsPatch() (_patch map[string]interface{}, err error) { +// 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(publicGatewayPatch) + jsonData, err = json.Marshal(reservedIPPatch) if err == nil { err = json.Unmarshal(jsonData, &_patch) } return } -// PublicGatewayReference : PublicGatewayReference struct -type PublicGatewayReference struct { - // The CRN for this public gateway. - CRN *string `json:"crn" validate:"required"` +// ReservedIPReference : ReservedIPReference struct +type ReservedIPReference struct { + // The IP address. + // + // If the address has not yet been selected, the value will be `0.0.0.0`. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` + Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` - // The URL for this public gateway. + // The URL for this reserved IP. Href *string `json:"href" validate:"required"` - // The unique identifier for this public gateway. + // The unique identifier for this reserved IP. ID *string `json:"id" validate:"required"` - // The name for this public gateway. The name is unique across all public gateways in the VPC. + // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. Name *string `json:"name" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the PublicGatewayReference.ResourceType property. +// Constants associated with the ReservedIPReference.ResourceType property. // The resource type. const ( - PublicGatewayReferenceResourceTypePublicGatewayConst = "public_gateway" + ReservedIPReferenceResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" ) -// UnmarshalPublicGatewayReference unmarshals an instance of PublicGatewayReference from the specified map of raw messages. -func UnmarshalPublicGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalReservedIPReference unmarshals an instance of ReservedIPReference from the specified map of raw messages. +func UnmarshalReservedIPReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPReference) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPublicGatewayReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) if err != nil { return } @@ -56908,16 +59936,16 @@ func UnmarshalPublicGatewayReference(m map[string]json.RawMessage, result interf return } -// PublicGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// ReservedIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary // information. -type PublicGatewayReferenceDeleted struct { +type ReservedIPReferenceDeleted struct { // Link to documentation about deleted resources. MoreInfo *string `json:"more_info" validate:"required"` } -// UnmarshalPublicGatewayReferenceDeleted unmarshals an instance of PublicGatewayReferenceDeleted from the specified map of raw messages. -func UnmarshalPublicGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayReferenceDeleted) +// UnmarshalReservedIPReferenceDeleted unmarshals an instance of ReservedIPReferenceDeleted from the specified map of raw messages. +func UnmarshalReservedIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPReferenceDeleted) err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return @@ -56926,32 +59954,61 @@ func UnmarshalPublicGatewayReferenceDeleted(m map[string]json.RawMessage, result return } -// Region : Region struct -type Region struct { - // The API endpoint for this region. - Endpoint *string `json:"endpoint" validate:"required"` +// ReservedIPTarget : The target this reserved IP is bound to. +// +// If absent, this reserved IP is provider-owned or unbound. +// Models which "extend" this model: +// - ReservedIPTargetEndpointGatewayReference +// - ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext +// - ReservedIPTargetNetworkInterfaceReferenceTargetContext +// - ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext +// - ReservedIPTargetLoadBalancerReference +// - ReservedIPTargetVPNGatewayReference +// - ReservedIPTargetVPNServerReference +// - ReservedIPTargetGenericResourceReference +type ReservedIPTarget struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` - // The URL for this region. - Href *string `json:"href" validate:"required"` + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` - // The globally unique name for this region. - Name *string `json:"name" validate:"required"` + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` - // The availability status of this region. - Status *string `json:"status" validate:"required"` + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` } -// Constants associated with the Region.Status property. -// The availability status of this region. +// Constants associated with the ReservedIPTarget.ResourceType property. +// The resource type. const ( - RegionStatusAvailableConst = "available" - RegionStatusUnavailableConst = "unavailable" + ReservedIPTargetResourceTypeEndpointGatewayConst = "endpoint_gateway" ) -// UnmarshalRegion unmarshals an instance of Region from the specified map of raw messages. -func UnmarshalRegion(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Region) - err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) +func (*ReservedIPTarget) isaReservedIPTarget() bool { + return true +} + +type ReservedIPTargetIntf interface { + isaReservedIPTarget() bool +} + +// UnmarshalReservedIPTarget unmarshals an instance of ReservedIPTarget from the specified map of raw messages. +func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTarget) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) if err != nil { return } @@ -56959,11 +60016,15 @@ func UnmarshalRegion(m map[string]json.RawMessage, result interface{}) (err erro if err != nil { return } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -56971,16 +60032,45 @@ func UnmarshalRegion(m map[string]json.RawMessage, result interface{}) (err erro return } -// RegionCollection : RegionCollection struct -type RegionCollection struct { - // Collection of regions. - Regions []Region `json:"regions" validate:"required"` +// ReservedIPTargetPrototype : The target to bind this reserved IP to. The target must be in the same VPC. +// +// At present, only endpoint gateway targets are supported. The endpoint gateway must not be already bound to a +// reserved IP in the subnet's zone. +// +// If unspecified, the reserved IP will be created unbound. +// Models which "extend" this model: +// - ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototype struct { + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` } -// UnmarshalRegionCollection unmarshals an instance of RegionCollection from the specified map of raw messages. -func UnmarshalRegionCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionCollection) - err = core.UnmarshalModel(m, "regions", &obj.Regions, UnmarshalRegion) +func (*ReservedIPTargetPrototype) isaReservedIPTargetPrototype() bool { + return true +} + +type ReservedIPTargetPrototypeIntf interface { + isaReservedIPTargetPrototype() bool +} + +// UnmarshalReservedIPTargetPrototype unmarshals an instance of ReservedIPTargetPrototype from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -56988,34 +60078,44 @@ func UnmarshalRegionCollection(m map[string]json.RawMessage, result interface{}) return } -// RegionIdentity : Identifies a region by a unique property. -// Models which "extend" this model: -// - RegionIdentityByName -// - RegionIdentityByHref -type RegionIdentity struct { - // The globally unique name for this region. - Name *string `json:"name,omitempty"` +// ResourceFilter : Identifies one or more resources according to the specified filter property. +type ResourceFilter struct { + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} - // The URL for this region. - Href *string `json:"href,omitempty"` +// UnmarshalResourceFilter unmarshals an instance of ResourceFilter from the specified map of raw messages. +func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceFilter) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -func (*RegionIdentity) isaRegionIdentity() bool { +// ResourceGroupIdentity : The resource group to use. If unspecified, the account's [default resource +// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. +// Models which "extend" this model: +// - ResourceGroupIdentityByID +type ResourceGroupIdentity struct { + // The unique identifier for this resource group. + ID *string `json:"id,omitempty"` +} + +func (*ResourceGroupIdentity) isaResourceGroupIdentity() bool { return true } -type RegionIdentityIntf interface { - isaRegionIdentity() bool +type ResourceGroupIdentityIntf interface { + isaResourceGroupIdentity() bool } -// UnmarshalRegionIdentity unmarshals an instance of RegionIdentity from the specified map of raw messages. -func UnmarshalRegionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionIdentity) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalResourceGroupIdentity unmarshals an instance of ResourceGroupIdentity from the specified map of raw messages. +func UnmarshalResourceGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } @@ -57023,22 +60123,29 @@ func UnmarshalRegionIdentity(m map[string]json.RawMessage, result interface{}) ( return } -// RegionReference : RegionReference struct -type RegionReference struct { - // The URL for this region. +// ResourceGroupReference : ResourceGroupReference struct +type ResourceGroupReference struct { + // The URL for this resource group. Href *string `json:"href" validate:"required"` - // The globally unique name for this region. + // The unique identifier for this resource group. + ID *string `json:"id" validate:"required"` + + // The name for this resource group. Name *string `json:"name" validate:"required"` } -// UnmarshalRegionReference unmarshals an instance of RegionReference from the specified map of raw messages. -func UnmarshalRegionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionReference) +// UnmarshalResourceGroupReference unmarshals an instance of ResourceGroupReference from the specified map of raw messages. +func UnmarshalResourceGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -57047,459 +60154,641 @@ func UnmarshalRegionReference(m map[string]json.RawMessage, result interface{}) return } -// RemoveBareMetalServerNetworkInterfaceFloatingIPOptions : The RemoveBareMetalServerNetworkInterfaceFloatingIP options. -type RemoveBareMetalServerNetworkInterfaceFloatingIPOptions struct { +// RestartBareMetalServerOptions : The RestartBareMetalServer options. +type RestartBareMetalServerOptions struct { // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The 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 } -// NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate RemoveBareMetalServerNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { - return &RemoveBareMetalServerNetworkInterfaceFloatingIPOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), +// NewRestartBareMetalServerOptions : Instantiate RestartBareMetalServerOptions +func (*VpcV1) NewRestartBareMetalServerOptions(id string) *RestartBareMetalServerOptions { + return &RestartBareMetalServerOptions{ + ID: core.StringPtr(id), } } -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - // SetID : Allow user to set ID -func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { +func (_options *RestartBareMetalServerOptions) SetID(id string) *RestartBareMetalServerOptions { _options.ID = core.StringPtr(id) return _options } // SetHeaders : Allow user to set Headers -func (options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { +func (options *RestartBareMetalServerOptions) SetHeaders(param map[string]string) *RestartBareMetalServerOptions { options.Headers = param return options } -// RemoveEndpointGatewayIPOptions : The RemoveEndpointGatewayIP options. -type RemoveEndpointGatewayIPOptions 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="` +// Route : Route struct +type Route 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. + Action *string `json:"action" validate:"required"` - // Allows users to set headers on API requests - Headers map[string]string -} + // The date and time that the route was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` -// NewRemoveEndpointGatewayIPOptions : Instantiate RemoveEndpointGatewayIPOptions -func (*VpcV1) NewRemoveEndpointGatewayIPOptions(endpointGatewayID string, id string) *RemoveEndpointGatewayIPOptions { - return &RemoveEndpointGatewayIPOptions{ - EndpointGatewayID: core.StringPtr(endpointGatewayID), - ID: core.StringPtr(id), - } -} + // 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"` -// SetEndpointGatewayID : Allow user to set EndpointGatewayID -func (_options *RemoveEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *RemoveEndpointGatewayIPOptions { - _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) - return _options -} + // The destination CIDR of the route. + Destination *string `json:"destination" validate:"required"` -// SetID : Allow user to set ID -func (_options *RemoveEndpointGatewayIPOptions) SetID(id string) *RemoveEndpointGatewayIPOptions { - _options.ID = core.StringPtr(id) - return _options -} + // The URL for this route. + Href *string `json:"href" validate:"required"` -// SetHeaders : Allow user to set Headers -func (options *RemoveEndpointGatewayIPOptions) SetHeaders(param map[string]string) *RemoveEndpointGatewayIPOptions { - options.Headers = param - return options -} + // The unique identifier for this route. + ID *string `json:"id" validate:"required"` -// RemoveInstanceNetworkInterfaceFloatingIPOptions : The RemoveInstanceNetworkInterfaceFloatingIP options. -type RemoveInstanceNetworkInterfaceFloatingIPOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` + // The lifecycle state of the route. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + // The name for this route. The name is unique across all routes in the routing table. + Name *string `json:"name" validate:"required"` - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` + // 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"` - // Allows users to set headers on API requests - Headers map[string]string -} + // 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 are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + Origin *string `json:"origin,omitempty"` -// NewRemoveInstanceNetworkInterfaceFloatingIPOptions : Instantiate RemoveInstanceNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewRemoveInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - return &RemoveInstanceNetworkInterfaceFloatingIPOptions{ - InstanceID: core.StringPtr(instanceID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), - } -} + // 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"` -// SetInstanceID : Allow user to set InstanceID -func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options + // The zone the route applies to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone *ZoneReference `json:"zone" validate:"required"` } -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} +// Constants associated with the Route.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. +const ( + RouteActionDelegateConst = "delegate" + RouteActionDelegateVPCConst = "delegate_vpc" + RouteActionDeliverConst = "deliver" + RouteActionDropConst = "drop" +) -// SetID : Allow user to set ID -func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} +// Constants associated with the Route.LifecycleState property. +// The lifecycle state of the route. +const ( + RouteLifecycleStateDeletingConst = "deleting" + RouteLifecycleStateFailedConst = "failed" + RouteLifecycleStatePendingConst = "pending" + RouteLifecycleStateStableConst = "stable" + RouteLifecycleStateSuspendedConst = "suspended" + RouteLifecycleStateUpdatingConst = "updating" + RouteLifecycleStateWaitingConst = "waiting" +) -// SetHeaders : Allow user to set Headers -func (options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} +// Constants associated with the Route.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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +const ( + RouteOriginServiceConst = "service" + RouteOriginUserConst = "user" +) -// RemoveVPNGatewayConnectionLocalCIDROptions : The RemoveVPNGatewayConnectionLocalCIDR options. -type RemoveVPNGatewayConnectionLocalCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` +// UnmarshalRoute unmarshals an instance of Route from the specified map of raw messages. +func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Route) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` +// RouteCollection : RouteCollection struct +type RouteCollection struct { + // A link to the first page of resources. + First *RouteCollectionFirst `json:"first" validate:"required"` - // The address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *RouteCollectionNext `json:"next,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string + // Collection of routes. + Routes []Route `json:"routes" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// NewRemoveVPNGatewayConnectionLocalCIDROptions : Instantiate RemoveVPNGatewayConnectionLocalCIDROptions -func (*VpcV1) NewRemoveVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *RemoveVPNGatewayConnectionLocalCIDROptions { - return &RemoveVPNGatewayConnectionLocalCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRoute) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionLocalCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options +// 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 || start == nil { + return nil, err + } + return start, nil } -// SetID : Allow user to set ID -func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionLocalCIDROptions { - _options.ID = core.StringPtr(id) - return _options +// 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"` } -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *RemoveVPNGatewayConnectionLocalCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options +// 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetPrefixLength : Allow user to set PrefixLength -func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *RemoveVPNGatewayConnectionLocalCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) - return _options +// 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"` } -// SetHeaders : Allow user to set Headers -func (options *RemoveVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionLocalCIDROptions { - options.Headers = param - return options +// 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// RemoveVPNGatewayConnectionPeerCIDROptions : The RemoveVPNGatewayConnectionPeerCIDR options. -type RemoveVPNGatewayConnectionPeerCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` +// RouteCollectionVPCContext : RouteCollectionVPCContext struct +type RouteCollectionVPCContext struct { + // A link to the first page of resources. + First *RouteCollectionVPCContextFirst `json:"first" validate:"required"` - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` - // The address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *RouteCollectionVPCContextNext `json:"next,omitempty"` - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` + // Collection of routes. + Routes []RouteCollectionVPCContextRoutesItem `json:"routes" validate:"required"` - // Allows users to set headers on API requests - Headers map[string]string + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// NewRemoveVPNGatewayConnectionPeerCIDROptions : Instantiate RemoveVPNGatewayConnectionPeerCIDROptions -func (*VpcV1) NewRemoveVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *RemoveVPNGatewayConnectionPeerCIDROptions { - return &RemoveVPNGatewayConnectionPeerCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionVPCContextNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteCollectionVPCContextRoutesItem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionPeerCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options +// 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 || start == nil { + return nil, err + } + return start, nil } -// SetID : Allow user to set ID -func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionPeerCIDROptions { - _options.ID = core.StringPtr(id) - return _options +// 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"` } -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *RemoveVPNGatewayConnectionPeerCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options +// 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetPrefixLength : Allow user to set PrefixLength -func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *RemoveVPNGatewayConnectionPeerCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) - return _options +// 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"` } -// SetHeaders : Allow user to set Headers -func (options *RemoveVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionPeerCIDROptions { - options.Headers = param - return options +// 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// ReplaceLoadBalancerPoolMembersOptions : The ReplaceLoadBalancerPoolMembers options. -type ReplaceLoadBalancerPoolMembersOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` +// 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. + Action *string `json:"action" validate:"required"` - // The pool identifier. - PoolID *string `json:"pool_id" validate:"required,ne="` + // The date and time that the route was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The member prototype objects for this pool. - Members []LoadBalancerPoolMemberPrototype `json:"members" 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"` - // Allows users to set headers on API requests - Headers map[string]string -} + // The destination CIDR of the route. + Destination *string `json:"destination" validate:"required"` -// NewReplaceLoadBalancerPoolMembersOptions : Instantiate ReplaceLoadBalancerPoolMembersOptions -func (*VpcV1) NewReplaceLoadBalancerPoolMembersOptions(loadBalancerID string, poolID string, members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { - return &ReplaceLoadBalancerPoolMembersOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - PoolID: core.StringPtr(poolID), - Members: members, - } -} + // The URL for this route. + Href *string `json:"href" validate:"required"` -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *ReplaceLoadBalancerPoolMembersOptions) SetLoadBalancerID(loadBalancerID string) *ReplaceLoadBalancerPoolMembersOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} + // The unique identifier for this route. + ID *string `json:"id" validate:"required"` -// SetPoolID : Allow user to set PoolID -func (_options *ReplaceLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *ReplaceLoadBalancerPoolMembersOptions { - _options.PoolID = core.StringPtr(poolID) - return _options -} + // The lifecycle state of the route. + LifecycleState *string `json:"lifecycle_state" validate:"required"` -// SetMembers : Allow user to set Members -func (_options *ReplaceLoadBalancerPoolMembersOptions) SetMembers(members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { - _options.Members = members - return _options -} + // The name for this route. The name is unique across all routes in the routing table. + Name *string `json:"name" validate:"required"` -// SetHeaders : Allow user to set Headers -func (options *ReplaceLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ReplaceLoadBalancerPoolMembersOptions { - options.Headers = param - return options -} + // 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"` -// ReplaceSubnetNetworkACLOptions : The ReplaceSubnetNetworkACL options. -type ReplaceSubnetNetworkACLOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` + // 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 are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + Origin *string `json:"origin,omitempty"` - // The network ACL identity. - NetworkACLIdentity NetworkACLIdentityIntf `json:"NetworkACLIdentity" 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"` - // Allows users to set headers on API requests - Headers map[string]string + // The zone the route applies to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone *ZoneReference `json:"zone" validate:"required"` } -// NewReplaceSubnetNetworkACLOptions : Instantiate ReplaceSubnetNetworkACLOptions -func (*VpcV1) NewReplaceSubnetNetworkACLOptions(id string, networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { - return &ReplaceSubnetNetworkACLOptions{ - ID: core.StringPtr(id), - NetworkACLIdentity: networkACLIdentity, +// 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. +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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +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 { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetID : Allow user to set ID -func (_options *ReplaceSubnetNetworkACLOptions) SetID(id string) *ReplaceSubnetNetworkACLOptions { - _options.ID = core.StringPtr(id) - return _options -} +// 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. +// Models which "extend" this model: +// - RouteCreatorVPNGatewayReference +// - RouteCreatorVPNServerReference +type RouteCreator struct { + // The VPN gateway's CRN. + CRN *string `json:"crn,omitempty"` -// SetNetworkACLIdentity : Allow user to set NetworkACLIdentity -func (_options *ReplaceSubnetNetworkACLOptions) SetNetworkACLIdentity(networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { - _options.NetworkACLIdentity = networkACLIdentity - return _options -} + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *ReplaceSubnetNetworkACLOptions) SetHeaders(param map[string]string) *ReplaceSubnetNetworkACLOptions { - options.Headers = param - return options -} + // The VPN gateway's canonical URL. + Href *string `json:"href,omitempty"` -// ReplaceSubnetRoutingTableOptions : The ReplaceSubnetRoutingTable options. -type ReplaceSubnetRoutingTableOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` + // The unique identifier for this VPN gateway. + ID *string `json:"id,omitempty"` - // The routing table identity. - RoutingTableIdentity RoutingTableIdentityIntf `json:"RoutingTableIdentity" validate:"required"` + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. + Name *string `json:"name,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` } -// NewReplaceSubnetRoutingTableOptions : Instantiate ReplaceSubnetRoutingTableOptions -func (*VpcV1) NewReplaceSubnetRoutingTableOptions(id string, routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { - return &ReplaceSubnetRoutingTableOptions{ - ID: core.StringPtr(id), - RoutingTableIdentity: routingTableIdentity, - } -} +// Constants associated with the RouteCreator.ResourceType property. +// The resource type. +const ( + RouteCreatorResourceTypeVPNGatewayConst = "vpn_gateway" +) -// SetID : Allow user to set ID -func (_options *ReplaceSubnetRoutingTableOptions) SetID(id string) *ReplaceSubnetRoutingTableOptions { - _options.ID = core.StringPtr(id) - return _options +func (*RouteCreator) isaRouteCreator() bool { + return true } -// SetRoutingTableIdentity : Allow user to set RoutingTableIdentity -func (_options *ReplaceSubnetRoutingTableOptions) SetRoutingTableIdentity(routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { - _options.RoutingTableIdentity = routingTableIdentity - return _options +type RouteCreatorIntf interface { + isaRouteCreator() bool } -// SetHeaders : Allow user to set Headers -func (options *ReplaceSubnetRoutingTableOptions) SetHeaders(param map[string]string) *ReplaceSubnetRoutingTableOptions { - options.Headers = param - return options +// UnmarshalRouteCreator unmarshals an instance of RouteCreator from the specified map of raw messages. +func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreator) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// ReservedIP : ReservedIP struct -type ReservedIP struct { +// RouteNextHop : RouteNextHop struct +// Models which "extend" this model: +// - RouteNextHopIP +// - RouteNextHopVPNGatewayConnectionReference +type RouteNextHop struct { // The IP address. // - // If the address has not yet been selected, the value will be `0.0.0.0`. - // // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` - - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // The date and time that the reserved IP was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` + Address *string `json:"address,omitempty"` - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` - // The lifecycle state of the reserved IP. - LifecycleState *string `json:"lifecycle_state" validate:"required"` + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` - // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - Name *string `json:"name" validate:"required"` + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` - // The owner of the reserved IP. - Owner *string `json:"owner" validate:"required"` + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name,omitempty"` // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The target this reserved IP is bound to. - // - // If absent, this reserved IP is provider-owned or unbound. - Target ReservedIPTargetIntf `json:"target,omitempty"` + ResourceType *string `json:"resource_type,omitempty"` } -// Constants associated with the ReservedIP.LifecycleState property. -// The lifecycle state of the reserved IP. +// Constants associated with the RouteNextHop.ResourceType property. +// The resource type. const ( - ReservedIPLifecycleStateDeletingConst = "deleting" - ReservedIPLifecycleStateFailedConst = "failed" - ReservedIPLifecycleStatePendingConst = "pending" - ReservedIPLifecycleStateStableConst = "stable" - ReservedIPLifecycleStateSuspendedConst = "suspended" - ReservedIPLifecycleStateUpdatingConst = "updating" - ReservedIPLifecycleStateWaitingConst = "waiting" + RouteNextHopResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" ) -// Constants associated with the ReservedIP.Owner property. -// The owner of the reserved IP. -const ( - ReservedIPOwnerProviderConst = "provider" - ReservedIPOwnerUserConst = "user" -) +func (*RouteNextHop) isaRouteNextHop() bool { + return true +} -// Constants associated with the ReservedIP.ResourceType property. -// The resource type. -const ( - ReservedIPResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" -) +type RouteNextHopIntf interface { + isaRouteNextHop() bool +} -// UnmarshalReservedIP unmarshals an instance of ReservedIP from the specified map of raw messages. -func UnmarshalReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIP) +// UnmarshalRouteNextHop unmarshals an instance of RouteNextHop from the specified map of raw messages. +func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHop) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) if err != nil { return } @@ -57511,69 +60800,101 @@ func UnmarshalReservedIP(m map[string]json.RawMessage, result interface{}) (err if err != nil { return } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "owner", &obj.Owner) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalReservedIPTarget) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// ReservedIPCollection : ReservedIPCollection struct -type ReservedIPCollection struct { - // A link to the first page of resources. - First *ReservedIPCollectionFirst `json:"first" validate:"required"` +// RouteNextHopPatch : If `action` is `deliver`, the next hop that packets will be delivered to. For other +// `action` values, specify `0.0.0.0` or remove it by specifying `null`. +// +// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has +// an `action` of `deliver` and `next_hop` is an IP address. +// Models which "extend" this model: +// - RouteNextHopPatchRouteNextHopIP +// - RouteNextHopPatchVPNGatewayConnectionIdentity +type RouteNextHopPatch struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *ReservedIPCollectionNext `json:"next,omitempty"` + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} - // Collection of reserved IPs in this subnet. - ReservedIps []ReservedIP `json:"reserved_ips" validate:"required"` +func (*RouteNextHopPatch) isaRouteNextHopPatch() bool { + return true +} - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` +type RouteNextHopPatchIntf interface { + isaRouteNextHopPatch() bool } -// 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) +// UnmarshalRouteNextHopPatch unmarshals an instance of RouteNextHopPatch from the specified map of raw messages. +func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalModel(m, "reserved_ips", &obj.ReservedIps, UnmarshalReservedIP) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePatch : RoutePatch struct +type RoutePatch struct { + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` + // are reserved for system-provided routes, and are not allowed. + Name *string `json:"name,omitempty"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For other + // `action` values, specify `0.0.0.0` or remove it by specifying `null`. + // + // At most two routes per `zone` in a table can have the same `destination` and `priority`, + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. + NextHop RouteNextHopPatchIntf `json:"next_hop,omitempty"` + + // 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,omitempty"` +} + +// UnmarshalRoutePatch unmarshals an instance of RoutePatch from the specified map of raw messages. +func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHopPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) if err != nil { return } @@ -57581,57 +60902,102 @@ func UnmarshalReservedIPCollection(m map[string]json.RawMessage, result interfac return } -// Retrieve the value to be passed to a request to access the next page of results -func (resp *ReservedIPCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, 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) } - return start, nil + return } -// ReservedIPCollectionEndpointGatewayContext : ReservedIPCollectionEndpointGatewayContext struct -type ReservedIPCollectionEndpointGatewayContext struct { - // A link to the first page of resources. - First *ReservedIPCollectionEndpointGatewayContextFirst `json:"first" validate:"required"` +// RoutePrototype : RoutePrototype struct +type RoutePrototype 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. + Action *string `json:"action,omitempty"` - // Collection of reserved IPs bound to an endpoint gateway. - Ips []ReservedIP `json:"ips" validate:"required"` + // The destination CIDR of the route. The host identifier in the CIDR must be zero. + // + // At most two routes per `zone` in a table can have the same `destination` and + // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. + Destination *string `json:"destination" validate:"required"` - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` + // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *ReservedIPCollectionEndpointGatewayContextNext `json:"next,omitempty"` + // If `action` is `deliver`, the next hop that packets will be delivered to. For other + // `action` values, it must be omitted or specified as `0.0.0.0`. + // + // At most two routes per `zone` in a table can have the same `destination` and `priority`, + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. + NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" 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,omitempty"` + + // The zone to apply the route to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// 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) +// Constants associated with the RoutePrototype.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. +const ( + RoutePrototypeActionDelegateConst = "delegate" + RoutePrototypeActionDelegateVPCConst = "delegate_vpc" + RoutePrototypeActionDeliverConst = "deliver" + RoutePrototypeActionDropConst = "drop" +) + +// NewRoutePrototype : Instantiate RoutePrototype (Generic Model Constructor) +func (*VpcV1) NewRoutePrototype(destination string, zone ZoneIdentityIntf) (_model *RoutePrototype, err error) { + _model = &RoutePrototype{ + Destination: core.StringPtr(destination), + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalRoutePrototype unmarshals an instance of RoutePrototype from the specified map of raw messages. +func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { return } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) if err != nil { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionEndpointGatewayContextNext) + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRoutePrototypeNextHop) if err != nil { return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } @@ -57639,62 +61005,261 @@ func UnmarshalReservedIPCollectionEndpointGatewayContext(m map[string]json.RawMe return } -// Retrieve the value to be passed to a request to access the next page of results -func (resp *ReservedIPCollectionEndpointGatewayContext) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil +// RoutePrototypeNextHop : If `action` is `deliver`, the next hop that packets will be delivered to. For other +// `action` values, it must be omitted or specified as `0.0.0.0`. +// +// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has +// an `action` of `deliver` and `next_hop` is an IP address. +// Models which "extend" this model: +// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity +type RoutePrototypeNextHop struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RoutePrototypeNextHop) isaRoutePrototypeNextHop() bool { + return true +} + +type RoutePrototypeNextHopIntf interface { + isaRoutePrototypeNextHop() bool +} + +// UnmarshalRoutePrototypeNextHop unmarshals an instance of RoutePrototypeNextHop from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHop(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHop) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return } - return start, nil + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// ReservedIPCollectionEndpointGatewayContextFirst : A link to the first page of resources. -type ReservedIPCollectionEndpointGatewayContextFirst struct { - // The URL for a page of resources. +// RouteReference : RouteReference struct +type RouteReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *RouteReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this route. Href *string `json:"href" validate:"required"` + + // The unique identifier for this route. + ID *string `json:"id" validate:"required"` + + // The name for this route. The name is unique across all routes in the routing table. + Name *string `json:"name" 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) +// UnmarshalRouteReference unmarshals an instance of RouteReference from the specified map of raw messages. +func UnmarshalRouteReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRouteReferenceDeleted) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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. +// RouteReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type RouteReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalRouteReferenceDeleted unmarshals an instance of RouteReferenceDeleted from the specified map of raw messages. +func UnmarshalRouteReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTable : RoutingTable struct +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 `vpn_server` value is supported, but filter + // support is expected to expand in the future. + AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` + + // The date and time that this routing table was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this routing table. Href *string `json:"href" validate:"required"` + + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` + + // Indicates whether this is the default routing table for this VPC. + IsDefault *bool `json:"is_default" validate:"required"` + + // The lifecycle state of the routing table. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this routing table. The name is unique across all routing tables for the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from the internet. + // + // Incoming traffic will be routed according to the routing table with two exceptions: + // - Traffic destined for IP addresses associated with public gateways will not be + // subject to routes in this routing table. + // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is + // an IP address in a subnet in the route's `zone` that is able to accept traffic. + // Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from from [Transit + // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this + // VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` + + // The routes for this routing table. + Routes []RouteReference `json:"routes" validate:"required"` + + // The subnets to which this routing table is attached. + Subnets []SubnetReference `json:"subnets" 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) +// Constants associated with the RoutingTable.LifecycleState property. +// The lifecycle state of the routing table. +const ( + RoutingTableLifecycleStateDeletingConst = "deleting" + RoutingTableLifecycleStateFailedConst = "failed" + RoutingTableLifecycleStatePendingConst = "pending" + RoutingTableLifecycleStateStableConst = "stable" + RoutingTableLifecycleStateSuspendedConst = "suspended" + RoutingTableLifecycleStateUpdatingConst = "updating" + RoutingTableLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the RoutingTable.ResourceType property. +// The resource type. +const ( + RoutingTableResourceTypeRoutingTableConst = "routing_table" +) + +// UnmarshalRoutingTable unmarshals an instance of RoutingTable from the specified map of raw messages. +func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTable) + err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { 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) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { return } @@ -57702,41 +61267,41 @@ func UnmarshalReservedIPCollectionFirst(m map[string]json.RawMessage, result int return } -// ReservedIPCollectionNetworkInterfaceContext : ReservedIPCollectionNetworkInterfaceContext struct -type ReservedIPCollectionNetworkInterfaceContext struct { +// RoutingTableCollection : RoutingTableCollection struct +type RoutingTableCollection struct { // A link to the first page of resources. - First *ReservedIPCollectionNetworkInterfaceContextFirst `json:"first" validate:"required"` - - // Collection of reserved IPs bound to a network interface. - Ips []ReservedIP `json:"ips" validate:"required"` + First *RoutingTableCollectionFirst `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 *ReservedIPCollectionNetworkInterfaceContextNext `json:"next,omitempty"` + Next *RoutingTableCollectionNext `json:"next,omitempty"` + + // Collection of routing tables. + RoutingTables []RoutingTable `json:"routing_tables" validate:"required"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalReservedIPCollectionNetworkInterfaceContext unmarshals an instance of ReservedIPCollectionNetworkInterfaceContext from the specified map of raw messages. -func UnmarshalReservedIPCollectionNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionNetworkInterfaceContext) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionNetworkInterfaceContextFirst) +// 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) if err != nil { return } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRoutingTableCollectionNext) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionNetworkInterfaceContextNext) + err = core.UnmarshalModel(m, "routing_tables", &obj.RoutingTables, UnmarshalRoutingTable) if err != nil { return } @@ -57749,7 +61314,7 @@ func UnmarshalReservedIPCollectionNetworkInterfaceContext(m map[string]json.RawM } // Retrieve the value to be passed to a request to access the next page of results -func (resp *ReservedIPCollectionNetworkInterfaceContext) GetNextStart() (*string, error) { +func (resp *RoutingTableCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -57760,15 +61325,15 @@ func (resp *ReservedIPCollectionNetworkInterfaceContext) GetNextStart() (*string return start, nil } -// ReservedIPCollectionNetworkInterfaceContextFirst : A link to the first page of resources. -type ReservedIPCollectionNetworkInterfaceContextFirst struct { +// 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"` } -// UnmarshalReservedIPCollectionNetworkInterfaceContextFirst unmarshals an instance of ReservedIPCollectionNetworkInterfaceContextFirst from the specified map of raw messages. -func UnmarshalReservedIPCollectionNetworkInterfaceContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionNetworkInterfaceContextFirst) +// 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 { return @@ -57777,15 +61342,15 @@ func UnmarshalReservedIPCollectionNetworkInterfaceContextFirst(m map[string]json return } -// ReservedIPCollectionNetworkInterfaceContextNext : A link to the next page of resources. This property is present for all pages except the last page. -type ReservedIPCollectionNetworkInterfaceContextNext struct { +// 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"` } -// UnmarshalReservedIPCollectionNetworkInterfaceContextNext unmarshals an instance of ReservedIPCollectionNetworkInterfaceContextNext from the specified map of raw messages. -func UnmarshalReservedIPCollectionNetworkInterfaceContextNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPCollectionNetworkInterfaceContextNext) +// 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 { return @@ -57794,42 +61359,34 @@ func UnmarshalReservedIPCollectionNetworkInterfaceContextNext(m map[string]json. 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"` -} +// RoutingTableIdentity : Identifies a routing table by a unique property. +// Models which "extend" this model: +// - RoutingTableIdentityByID +// - RoutingTableIdentityByHref +type RoutingTableIdentity struct { + // The unique identifier for this routing table. + ID *string `json:"id,omitempty"` -// 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 { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return + // The URL for this routing table. + Href *string `json:"href,omitempty"` } -// ReservedIPPatch : ReservedIPPatch struct -type ReservedIPPatch struct { - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` +func (*RoutingTableIdentity) isaRoutingTableIdentity() bool { + return true +} - // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with - // `ibm-` are reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` +type RoutingTableIdentityIntf interface { + isaRoutingTableIdentity() bool } -// UnmarshalReservedIPPatch unmarshals an instance of ReservedIPPatch from the specified map of raw messages. -func UnmarshalReservedIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPPatch) - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) +// UnmarshalRoutingTableIdentity unmarshals an instance of RoutingTableIdentity from the specified map of raw messages. +func UnmarshalRoutingTableIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -57837,74 +61394,96 @@ func UnmarshalReservedIPPatch(m map[string]json.RawMessage, result interface{}) return } -// 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) - } - return -} - -// ReservedIPReference : ReservedIPReference struct -type ReservedIPReference struct { - // The IP address. - // - // If the address has not yet been selected, the value will be `0.0.0.0`. +// 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. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` + // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter + // support is expected to expand in the future. + AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` + // The name for this routing table. The name must not be used by another routing table in the VPC. + Name *string `json:"name,omitempty"` - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` + // Indicates whether this routing table is used to route traffic that originates from + // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to `true` selects this routing table, provided + // no other routing table in the VPC already has this property set to `true`, and no subnets are attached to this + // routing table. Updating to + // `false` deselects this routing table. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` + // Indicates whether this routing table is used to route traffic that originates from the internet. Updating to `true` + // selects this routing table, provided no other routing table in the VPC already has this property set to `true`. + // Updating to `false` deselects this routing table. + // + // Incoming traffic will be routed according to the routing table with two exceptions: + // - Traffic destined for IP addresses associated with public gateways will not be subject + // to routes in this routing table. + // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is an + // IP address in a subnet in the route's `zone` that is able to accept traffic. + // Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"` - // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - Name *string `json:"name" validate:"required"` + // Indicates whether this routing table is used to route traffic that originates from + // [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. Updating to + // `true` selects this routing table, provided no other routing table in the VPC already has this property set to + // `true`, and no subnets are attached to this routing table. Updating to `false` deselects this routing table. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + // + // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled + // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing + // table. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this + // VPC. Updating to `true` selects this routing table, provided no other routing table in the VPC already has this + // property set to `true`, and no subnets are attached to this routing table. Updating to `false` deselects this + // routing table. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` } -// Constants associated with the ReservedIPReference.ResourceType property. -// The resource type. -const ( - ReservedIPReferenceResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" -) - -// UnmarshalReservedIPReference unmarshals an instance of ReservedIPReference from the specified map of raw messages. -func UnmarshalReservedIPReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPReference) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) +// UnmarshalRoutingTablePatch unmarshals an instance of RoutingTablePatch from the specified map of raw messages. +func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTablePatch) + err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) if err != nil { return } @@ -57912,77 +61491,45 @@ func UnmarshalReservedIPReference(m map[string]json.RawMessage, result interface return } -// ReservedIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ReservedIPReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalReservedIPReferenceDeleted unmarshals an instance of ReservedIPReferenceDeleted from the specified map of raw messages. -func UnmarshalReservedIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return +// 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) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// ReservedIPTarget : The target this reserved IP is bound to. -// -// If absent, this reserved IP is provider-owned or unbound. -// Models which "extend" this model: -// - ReservedIPTargetEndpointGatewayReference -// - ReservedIPTargetNetworkInterfaceReferenceTargetContext -// - ReservedIPTargetLoadBalancerReference -// - ReservedIPTargetVPNGatewayReference -// - ReservedIPTargetVPNServerReference -// - ReservedIPTargetGenericResourceReference -type ReservedIPTarget struct { - // The CRN for this endpoint gateway. - CRN *string `json:"crn,omitempty"` - +// RoutingTableReference : RoutingTableReference struct +type RoutingTableReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + Deleted *RoutingTableReferenceDeleted `json:"deleted,omitempty"` - // The URL for this endpoint gateway. - Href *string `json:"href,omitempty"` + // The URL for this routing table. + Href *string `json:"href" validate:"required"` - // The unique identifier for this endpoint gateway. - ID *string `json:"id,omitempty"` + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` - // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. - Name *string `json:"name,omitempty"` + // The name for this routing table. The name is unique across all routing tables for the VPC. + Name *string `json:"name" validate:"required"` // The resource type. - ResourceType *string `json:"resource_type,omitempty"` + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the ReservedIPTarget.ResourceType property. +// Constants associated with the RoutingTableReference.ResourceType property. // The resource type. const ( - ReservedIPTargetResourceTypeEndpointGatewayConst = "endpoint_gateway" + RoutingTableReferenceResourceTypeRoutingTableConst = "routing_table" ) -func (*ReservedIPTarget) isaReservedIPTarget() bool { - return true -} - -type ReservedIPTargetIntf interface { - isaReservedIPTarget() bool -} - -// UnmarshalReservedIPTarget unmarshals an instance of ReservedIPTarget from the specified map of raw messages. -func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTarget) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) +// UnmarshalRoutingTableReference unmarshals an instance of RoutingTableReference from the specified map of raw messages. +func UnmarshalRoutingTableReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRoutingTableReferenceDeleted) if err != nil { return } @@ -58006,121 +61553,17 @@ func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) return } -// ReservedIPTargetPrototype : The target to bind this reserved IP to. The target must be in the same VPC. -// -// At present, only endpoint gateway targets are supported. The endpoint gateway must not be already bound to a -// reserved IP in the subnet's zone. -// -// If unspecified, the reserved IP will be created unbound. -// Models which "extend" this model: -// - ReservedIPTargetPrototypeEndpointGatewayIdentity -type ReservedIPTargetPrototype struct { - // The unique identifier for this endpoint gateway. - ID *string `json:"id,omitempty"` - - // The CRN for this endpoint gateway. - CRN *string `json:"crn,omitempty"` - - // The URL for this endpoint gateway. - Href *string `json:"href,omitempty"` -} - -func (*ReservedIPTargetPrototype) isaReservedIPTargetPrototype() bool { - return true -} - -type ReservedIPTargetPrototypeIntf interface { - isaReservedIPTargetPrototype() bool -} - -// UnmarshalReservedIPTargetPrototype unmarshals an instance of ReservedIPTargetPrototype from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ResourceFilter : Identifies one or more resources according to the specified filter property. -type ResourceFilter struct { - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// UnmarshalResourceFilter unmarshals an instance of ResourceFilter from the specified map of raw messages. -func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResourceFilter) - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ResourceGroupIdentity : The resource group to use. If unspecified, the account's [default resource -// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. -// Models which "extend" this model: -// - ResourceGroupIdentityByID -type ResourceGroupIdentity struct { - // The unique identifier for this resource group. - ID *string `json:"id,omitempty"` -} - -func (*ResourceGroupIdentity) isaResourceGroupIdentity() bool { - return true -} - -type ResourceGroupIdentityIntf interface { - isaResourceGroupIdentity() bool -} - -// UnmarshalResourceGroupIdentity unmarshals an instance of ResourceGroupIdentity from the specified map of raw messages. -func UnmarshalResourceGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResourceGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ResourceGroupReference : ResourceGroupReference struct -type ResourceGroupReference struct { - // The URL for this resource group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this resource group. - ID *string `json:"id" validate:"required"` - - // The name for this resource group. - Name *string `json:"name" validate:"required"` +// RoutingTableReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type RoutingTableReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` } -// UnmarshalResourceGroupReference unmarshals an instance of ResourceGroupReference from the specified map of raw messages. -func UnmarshalResourceGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResourceGroupReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +// UnmarshalRoutingTableReferenceDeleted unmarshals an instance of RoutingTableReferenceDeleted from the specified map of raw messages. +func UnmarshalRoutingTableReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } @@ -58128,145 +61571,44 @@ func UnmarshalResourceGroupReference(m map[string]json.RawMessage, result interf return } -// RestartBareMetalServerOptions : The RestartBareMetalServer options. -type RestartBareMetalServerOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewRestartBareMetalServerOptions : Instantiate RestartBareMetalServerOptions -func (*VpcV1) NewRestartBareMetalServerOptions(id string) *RestartBareMetalServerOptions { - return &RestartBareMetalServerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *RestartBareMetalServerOptions) SetID(id string) *RestartBareMetalServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RestartBareMetalServerOptions) SetHeaders(param map[string]string) *RestartBareMetalServerOptions { - options.Headers = param - return options -} - -// Route : Route struct -type Route 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. - Action *string `json:"action" validate:"required"` - - // The date and time that the route was created. +// SecurityGroup : SecurityGroup struct +type SecurityGroup struct { + // The date and time that this security group 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 of the route. - Destination *string `json:"destination" validate:"required"` + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` - // The URL for this route. + // The security group's canonical URL. Href *string `json:"href" validate:"required"` - // The unique identifier for this route. + // The unique identifier for this security group. 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. + // The name for this security group. The name is unique across all security groups for the VPC. 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 are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. - Origin *string `json:"origin,omitempty"` - - // 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. (Traffic from subnets in this zone will be - // subject to this route.). - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the Route.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. -const ( - RouteActionDelegateConst = "delegate" - RouteActionDelegateVPCConst = "delegate_vpc" - RouteActionDeliverConst = "deliver" - RouteActionDropConst = "drop" -) + // The resource group for this security group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` -// Constants associated with the Route.LifecycleState property. -// The lifecycle state of the route. -const ( - RouteLifecycleStateDeletingConst = "deleting" - RouteLifecycleStateFailedConst = "failed" - RouteLifecycleStatePendingConst = "pending" - RouteLifecycleStateStableConst = "stable" - RouteLifecycleStateSuspendedConst = "suspended" - RouteLifecycleStateUpdatingConst = "updating" - RouteLifecycleStateWaitingConst = "waiting" -) + // The rules for this security group. If no rules exist, all traffic will be denied. + Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` -// Constants associated with the Route.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 are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. -const ( - RouteOriginServiceConst = "service" - RouteOriginUserConst = "user" -) + // The targets for this security group. + Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` -// UnmarshalRoute unmarshals an instance of Route from the specified map of raw messages. -func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Route) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } + // The VPC this security group resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalSecurityGroup unmarshals an instance of SecurityGroup from the specified map of raw messages. +func UnmarshalSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroup) err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } @@ -58278,27 +61620,23 @@ func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error if err != nil { return } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) if err != nil { return } - err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { return } @@ -58306,29 +61644,29 @@ func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error return } -// RouteCollection : RouteCollection struct -type RouteCollection struct { +// SecurityGroupCollection : SecurityGroupCollection struct +type SecurityGroupCollection struct { // A link to the first page of resources. - First *RouteCollectionFirst `json:"first" validate:"required"` + First *SecurityGroupCollectionFirst `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"` + Next *SecurityGroupCollectionNext `json:"next,omitempty"` - // Collection of routes. - Routes []Route `json:"routes" validate:"required"` + // Collection of security groups. + SecurityGroups []SecurityGroup `json:"security_groups" 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) +// 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) if err != nil { return } @@ -58336,11 +61674,11 @@ func UnmarshalRouteCollection(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupCollectionNext) if err != nil { return } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRoute) + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroup) if err != nil { return } @@ -58353,7 +61691,7 @@ func UnmarshalRouteCollection(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 *RouteCollection) GetNextStart() (*string, error) { +func (resp *SecurityGroupCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -58364,15 +61702,15 @@ func (resp *RouteCollection) GetNextStart() (*string, error) { return start, nil } -// RouteCollectionFirst : A link to the first page of resources. -type RouteCollectionFirst struct { +// 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"` } -// 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) +// 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 { return @@ -58381,15 +61719,15 @@ func UnmarshalRouteCollectionFirst(m map[string]json.RawMessage, result interfac return } -// RouteCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type RouteCollectionNext struct { +// 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"` } -// 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) +// 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 { return @@ -58398,45 +61736,59 @@ func UnmarshalRouteCollectionNext(m map[string]json.RawMessage, result interface return } -// RouteCollectionVPCContext : RouteCollectionVPCContext struct -type RouteCollectionVPCContext struct { - // A link to the first page of resources. - First *RouteCollectionVPCContextFirst `json:"first" validate:"required"` +// SecurityGroupIdentity : Identifies a security group by a unique property. +// Models which "extend" this model: +// - SecurityGroupIdentityByID +// - SecurityGroupIdentityByCRN +// - SecurityGroupIdentityByHref +type SecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` + // The security group's CRN. + CRN *string `json:"crn,omitempty"` - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *RouteCollectionVPCContextNext `json:"next,omitempty"` + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} - // Collection of routes. - Routes []RouteCollectionVPCContextRoutesItem `json:"routes" validate:"required"` +func (*SecurityGroupIdentity) isaSecurityGroupIdentity() bool { + return true +} - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` +type SecurityGroupIdentityIntf interface { + isaSecurityGroupIdentity() bool } -// 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 { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) +// UnmarshalSecurityGroupIdentity unmarshals an instance of SecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionVPCContextNext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteCollectionVPCContextRoutesItem) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupPatch : SecurityGroupPatch struct +type SecurityGroupPatch struct { + // The name for this security group. The name must not be used by another security group for the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalSecurityGroupPatch unmarshals an instance of SecurityGroupPatch from the specified map of raw messages. +func UnmarshalSecurityGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -58444,45 +61796,190 @@ func UnmarshalRouteCollectionVPCContext(m map[string]json.RawMessage, result int 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 || start == nil { - return nil, err +// 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) } - return start, nil + return } -// RouteCollectionVPCContextFirst : A link to the first page of resources. -type RouteCollectionVPCContextFirst struct { - // The URL for a page of resources. +// SecurityGroupReference : SecurityGroupReference struct +type SecurityGroupReference struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + + // The security group's canonical URL. Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The name for this security group. The name is unique across all security groups for the VPC. + Name *string `json:"name" 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) +// UnmarshalSecurityGroupReference unmarshals an instance of SecurityGroupReference from the specified map of raw messages. +func UnmarshalSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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. +// SecurityGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type SecurityGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalSecurityGroupReferenceDeleted unmarshals an instance of SecurityGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalSecurityGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRule : SecurityGroupRule struct +// Models which "extend" this model: +// - SecurityGroupRuleSecurityGroupRuleProtocolAll +// - SecurityGroupRuleSecurityGroupRuleProtocolIcmp +// - SecurityGroupRuleSecurityGroupRuleProtocolTcpudp +type SecurityGroupRule struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The remote IP addresses or security groups from which this rule allows traffic (or to + // which, for outbound rules). A CIDR block of `0.0.0.0/0` allows traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The ICMP traffic code to allow. If absent, all codes are allowed. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to allow. If absent, all types are allowed. + Type *int64 `json:"type,omitempty"` + + // The inclusive upper bound of TCP/UDP destination port range. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + PortMin *int64 `json:"port_min,omitempty"` } -// 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) +// Constants associated with the SecurityGroupRule.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleDirectionInboundConst = "inbound" + SecurityGroupRuleDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRule.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRule.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleProtocolAllConst = "all" + SecurityGroupRuleProtocolIcmpConst = "icmp" + SecurityGroupRuleProtocolTCPConst = "tcp" + SecurityGroupRuleProtocolUDPConst = "udp" +) + +func (*SecurityGroupRule) isaSecurityGroupRule() bool { + return true +} + +type SecurityGroupRuleIntf interface { + isaSecurityGroupRule() bool +} + +// UnmarshalSecurityGroupRule unmarshals an instance of SecurityGroupRule from the specified map of raw messages. +func UnmarshalSecurityGroupRule(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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// SecurityGroupRuleCollection : Collection of rules in a security group. +type SecurityGroupRuleCollection struct { + // Array of rules. + Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` +} + +// UnmarshalSecurityGroupRuleCollection unmarshals an instance of SecurityGroupRuleCollection from the specified map of raw messages. +func UnmarshalSecurityGroupRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleCollection) + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) if err != nil { return } @@ -58490,205 +61987,273 @@ func UnmarshalRouteCollectionVPCContextNext(m map[string]json.RawMessage, result 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. - Action *string `json:"action" validate:"required"` +// SecurityGroupRulePatch : SecurityGroupRulePatch struct +type SecurityGroupRulePatch struct { + // The ICMP traffic code to allow. If set, `type` must also be set. + // + // Specify `null` to remove an existing ICMP traffic code. + Code *int64 `json:"code,omitempty"` - // The date and time that the route was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + // The direction of traffic to enforce. + Direction *string `json:"direction,omitempty"` - // 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 IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` - // The destination of the route. - Destination *string `json:"destination" validate:"required"` + // The inclusive upper bound of the protocol destination port range. If set, `port_min` must also be set, and must not + // be larger. + // + // Specify `null` to remove an existing upper bound. + PortMax *int64 `json:"port_max,omitempty"` - // The URL for this route. - Href *string `json:"href" validate:"required"` + // The inclusive lower bound of the protocol destination port range. If set, `port_max` must also be set, and must not + // be smaller. + // + // Specify `null` to remove an existing lower bound. + PortMin *int64 `json:"port_min,omitempty"` - // The unique identifier for this route. - ID *string `json:"id" validate:"required"` + // 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. A CIDR block of `0.0.0.0/0` will allow traffic from any source (or to + // any destination, for outbound rules). + Remote SecurityGroupRuleRemotePatchIntf `json:"remote,omitempty"` - // The lifecycle state of the route. - LifecycleState *string `json:"lifecycle_state" validate:"required"` + // The ICMP traffic type to allow. + // + // Specify `null` to remove an existing ICMP traffic type value. + Type *int64 `json:"type,omitempty"` +} - // The name for this route. The name is unique across all routes in the routing table. - Name *string `json:"name" validate:"required"` +// Constants associated with the SecurityGroupRulePatch.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePatchDirectionInboundConst = "inbound" + SecurityGroupRulePatchDirectionOutboundConst = "outbound" +) - // 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"` +// Constants associated with the SecurityGroupRulePatch.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePatchIPVersionIpv4Const = "ipv4" +) - // The origin of this route: - // - `service`: route was directly created by a service - // - `user`: route was directly created by a user +// UnmarshalSecurityGroupRulePatch unmarshals an instance of SecurityGroupRulePatch from the specified map of raw messages. +func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePatch) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// SecurityGroupRulePrototype : SecurityGroupRulePrototype struct +// Models which "extend" this model: +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp +type SecurityGroupRulePrototype struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // 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. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. - Origin *string `json:"origin,omitempty"` + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` - // The priority of this route. Smaller values have higher priority. + // The ICMP traffic code to allow. // - // 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"` + // If specified, `type` must also be specified. If unspecified, all codes are allowed. + Code *int64 `json:"code,omitempty"` - // The zone the route applies to. (Traffic from subnets in this zone will be - // subject to this route.). - Zone *ZoneReference `json:"zone" validate:"required"` + // The ICMP traffic type to allow. + // + // If unspecified, all types are allowed. + Type *int64 `json:"type,omitempty"` + + // The inclusive upper bound of TCP/UDP destination port range. + // + // If specified, `port_min` must also be specified, and must not be larger. If unspecified, + // `port_min` must also be unspecified, allowing traffic on all destination ports. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range + // + // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be + // unspecified, allowing traffic on all destination ports. + PortMin *int64 `json:"port_min,omitempty"` } -// 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. +// Constants associated with the SecurityGroupRulePrototype.Direction property. +// The direction of traffic to enforce. const ( - RouteCollectionVPCContextRoutesItemActionDelegateConst = "delegate" - RouteCollectionVPCContextRoutesItemActionDelegateVPCConst = "delegate_vpc" - RouteCollectionVPCContextRoutesItemActionDeliverConst = "deliver" - RouteCollectionVPCContextRoutesItemActionDropConst = "drop" + SecurityGroupRulePrototypeDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeDirectionOutboundConst = "outbound" ) -// Constants associated with the RouteCollectionVPCContextRoutesItem.LifecycleState property. -// The lifecycle state of the route. +// Constants associated with the SecurityGroupRulePrototype.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. const ( - RouteCollectionVPCContextRoutesItemLifecycleStateDeletingConst = "deleting" - RouteCollectionVPCContextRoutesItemLifecycleStateFailedConst = "failed" - RouteCollectionVPCContextRoutesItemLifecycleStatePendingConst = "pending" - RouteCollectionVPCContextRoutesItemLifecycleStateStableConst = "stable" - RouteCollectionVPCContextRoutesItemLifecycleStateSuspendedConst = "suspended" - RouteCollectionVPCContextRoutesItemLifecycleStateUpdatingConst = "updating" - RouteCollectionVPCContextRoutesItemLifecycleStateWaitingConst = "waiting" + SecurityGroupRulePrototypeIPVersionIpv4Const = "ipv4" ) -// 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 are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. +// Constants associated with the SecurityGroupRulePrototype.Protocol property. +// The protocol to enforce. const ( - RouteCollectionVPCContextRoutesItemOriginServiceConst = "service" - RouteCollectionVPCContextRoutesItemOriginUserConst = "user" + SecurityGroupRulePrototypeProtocolAllConst = "all" + SecurityGroupRulePrototypeProtocolIcmpConst = "icmp" + SecurityGroupRulePrototypeProtocolTCPConst = "tcp" + SecurityGroupRulePrototypeProtocolUDPConst = "udp" ) -// 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 { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) +func (*SecurityGroupRulePrototype) isaSecurityGroupRulePrototype() bool { + return true +} + +type SecurityGroupRulePrototypeIntf interface { + isaSecurityGroupRulePrototype() bool +} + +// 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) if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) return } - err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) - if err != nil { + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - return + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// 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. +// SecurityGroupRuleRemote : The remote IP addresses or security groups from which this rule allows traffic (or to which, for outbound rules). A +// CIDR block of `0.0.0.0/0` allows traffic from any source +// (or to any destination, for outbound rules). // Models which "extend" this model: -// - RouteCreatorVPNGatewayReference -// - RouteCreatorVPNServerReference -type RouteCreator struct { - // The VPN gateway's CRN. +// - SecurityGroupRuleRemoteIP +// - SecurityGroupRuleRemoteCIDR +// - SecurityGroupRuleRemoteSecurityGroupReference +type SecurityGroupRuleRemote struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` + + // The security group's CRN. CRN *string `json:"crn,omitempty"` // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` - // The VPN gateway's canonical URL. + // The security group's canonical URL. Href *string `json:"href,omitempty"` - // The unique identifier for this VPN gateway. + // The unique identifier for this security group. ID *string `json:"id,omitempty"` - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. + // The name for this security group. The name is unique across all security groups for the VPC. Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` } -// Constants associated with the RouteCreator.ResourceType property. -// The resource type. -const ( - RouteCreatorResourceTypeVPNGatewayConst = "vpn_gateway" -) - -func (*RouteCreator) isaRouteCreator() bool { +func (*SecurityGroupRuleRemote) isaSecurityGroupRuleRemote() bool { return true } -type RouteCreatorIntf interface { - isaRouteCreator() bool +type SecurityGroupRuleRemoteIntf interface { + isaSecurityGroupRuleRemote() bool } -// UnmarshalRouteCreator unmarshals an instance of RouteCreator from the specified map of raw messages. -func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCreator) +// UnmarshalSecurityGroupRuleRemote unmarshals an instance of SecurityGroupRuleRemote from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemote) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) if err != nil { return } @@ -58704,19 +62269,18 @@ func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// RouteNextHop : RouteNextHop struct +// SecurityGroupRuleRemotePatch : 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. A CIDR block of `0.0.0.0/0` will allow traffic +// from any source (or to any destination, for outbound rules). // Models which "extend" this model: -// - RouteNextHopIP -// - RouteNextHopVPNGatewayConnectionReference -type RouteNextHop struct { +// - SecurityGroupRuleRemotePatchIP +// - SecurityGroupRuleRemotePatchCIDR +// - SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatch struct { // The IP address. // // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify @@ -58724,49 +62288,37 @@ type RouteNextHop struct { // error, or bypass the resource on which the unexpected IP address format was encountered. Address *string `json:"address,omitempty"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` - // The unique identifier for this VPN gateway connection. + // The unique identifier for this security group. ID *string `json:"id,omitempty"` - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name,omitempty"` + // The security group's CRN. + CRN *string `json:"crn,omitempty"` - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` + // The security group's canonical URL. + Href *string `json:"href,omitempty"` } -// Constants associated with the RouteNextHop.ResourceType property. -// The resource type. -const ( - RouteNextHopResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -func (*RouteNextHop) isaRouteNextHop() bool { +func (*SecurityGroupRuleRemotePatch) isaSecurityGroupRuleRemotePatch() bool { return true } -type RouteNextHopIntf interface { - isaRouteNextHop() bool +type SecurityGroupRuleRemotePatchIntf interface { + isaSecurityGroupRuleRemotePatch() bool } -// UnmarshalRouteNextHop unmarshals an instance of RouteNextHop from the specified map of raw messages. -func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHop) +// UnmarshalSecurityGroupRuleRemotePatch unmarshals an instance of SecurityGroupRuleRemotePatch from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatch) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { return } @@ -58774,11 +62326,11 @@ func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -58786,89 +62338,66 @@ func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (er return } -// RouteNextHopPatch : If `action` is `deliver`, the next hop that packets will be delivered to. For other -// `action` values, specify `0.0.0.0` or remove it by specifying `null`. +// 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. // -// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has -// an `action` of `deliver` and `next_hop` is an IP address. +// If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source +// (or to any destination, for outbound rules). // Models which "extend" this model: -// - RouteNextHopPatchRouteNextHopIP -// - RouteNextHopPatchVPNGatewayConnectionIdentity -type RouteNextHopPatch struct { - // The sentinel IP address (`0.0.0.0`). +// - SecurityGroupRuleRemotePrototypeIP +// - SecurityGroupRuleRemotePrototypeCIDR +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototype struct { + // The IP address. // // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the // error, or bypass the resource on which the unexpected IP address format was encountered. Address *string `json:"address,omitempty"` - // The unique identifier for this VPN gateway connection. + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` + + // The unique identifier for this security group. ID *string `json:"id,omitempty"` - // The VPN connection's canonical URL. + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. Href *string `json:"href,omitempty"` } -func (*RouteNextHopPatch) isaRouteNextHopPatch() bool { +func (*SecurityGroupRuleRemotePrototype) isaSecurityGroupRuleRemotePrototype() bool { return true } -type RouteNextHopPatchIntf interface { - isaRouteNextHopPatch() bool +type SecurityGroupRuleRemotePrototypeIntf interface { + isaSecurityGroupRuleRemotePrototype() bool } -// UnmarshalRouteNextHopPatch unmarshals an instance of RouteNextHopPatch from the specified map of raw messages. -func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatch) +// UnmarshalSecurityGroupRuleRemotePrototype unmarshals an instance of SecurityGroupRuleRemotePrototype from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototype) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePatch : RoutePatch struct -type RoutePatch struct { - // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` - // are reserved for system-provided routes, and are not allowed. - Name *string `json:"name,omitempty"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For other - // `action` values, specify `0.0.0.0` or remove it by specifying `null`. - // - // At most two routes per `zone` in a table can have the same `destination` and `priority`, - // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. - NextHop RouteNextHopPatchIntf `json:"next_hop,omitempty"` - - // 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,omitempty"` -} - -// UnmarshalRoutePatch unmarshals an instance of RoutePatch from the specified map of raw messages. -func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHopPatch) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -58876,100 +62405,91 @@ func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err return } -// 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) - } - return -} - -// RoutePrototype : RoutePrototype struct -type RoutePrototype 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. - Action *string `json:"action,omitempty"` - - // The destination of the route. At most two routes per `zone` in a table can have the same `destination` and - // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. - Destination *string `json:"destination" validate:"required"` +// SecurityGroupTargetCollection : SecurityGroupTargetCollection struct +type SecurityGroupTargetCollection struct { + // A link to the first page of resources. + First *SecurityGroupTargetCollectionFirst `json:"first" validate:"required"` - // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` - // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of - // randomly-selected words. - Name *string `json:"name,omitempty"` + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` - // If `action` is `deliver`, the next hop that packets will be delivered to. For other - // `action` values, it must be omitted or specified as `0.0.0.0`. - // - // At most two routes per `zone` in a table can have the same `destination` and `priority`, - // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. - NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *SecurityGroupTargetCollectionNext `json:"next,omitempty"` - // 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,omitempty"` + // Collection of targets for this security group. + Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` - // The zone to apply the route to. (Traffic from subnets in this zone will be - // subject to this route.). - Zone ZoneIdentityIntf `json:"zone" validate:"required"` + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// Constants associated with the RoutePrototype.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. -const ( - RoutePrototypeActionDelegateConst = "delegate" - RoutePrototypeActionDelegateVPCConst = "delegate_vpc" - RoutePrototypeActionDeliverConst = "deliver" - RoutePrototypeActionDropConst = "drop" -) - -// NewRoutePrototype : Instantiate RoutePrototype (Generic Model Constructor) -func (*VpcV1) NewRoutePrototype(destination string, zone ZoneIdentityIntf) (_model *RoutePrototype, err error) { - _model = &RoutePrototype{ - Destination: core.StringPtr(destination), - Zone: zone, +// 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) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalRoutePrototype unmarshals an instance of RoutePrototype from the specified map of raw messages. -func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupTargetCollectionNext) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) if err != nil { return } - err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRoutePrototypeNextHop) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } - err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + 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 *SecurityGroupTargetCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + 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 { return } @@ -58977,41 +62497,65 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( return } -// RoutePrototypeNextHop : If `action` is `deliver`, the next hop that packets will be delivered to. For other -// `action` values, it must be omitted or specified as `0.0.0.0`. -// -// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has -// an `action` of `deliver` and `next_hop` is an IP address. +// SecurityGroupTargetReference : The resource types that can be security group targets are expected to expand in the future. When iterating over +// security group targets, do not assume that every target resource will be from a known set of resource types. +// Optionally halt processing and surface an error, or bypass resources of unrecognized types. // Models which "extend" this model: -// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP -// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity -type RoutePrototypeNextHop struct { - // The sentinel IP address (`0.0.0.0`). - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` +// - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext +// - SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext +// - SecurityGroupTargetReferenceLoadBalancerReference +// - SecurityGroupTargetReferenceEndpointGatewayReference +// - SecurityGroupTargetReferenceVPNServerReference +// - SecurityGroupTargetReferenceVirtualNetworkInterfaceReference +type SecurityGroupTargetReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - // The unique identifier for this VPN gateway connection. + // The URL for this instance network interface. + Href *string `json:"href,omitempty"` + + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` + // The name for this instance network interface. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The load balancer's CRN. + CRN *string `json:"crn,omitempty"` + + // The primary IP for this virtual network interface. + PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet,omitempty"` } -func (*RoutePrototypeNextHop) isaRoutePrototypeNextHop() bool { +// Constants associated with the SecurityGroupTargetReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*SecurityGroupTargetReference) isaSecurityGroupTargetReference() bool { return true } -type RoutePrototypeNextHopIntf interface { - isaRoutePrototypeNextHop() bool +type SecurityGroupTargetReferenceIntf interface { + isaSecurityGroupTargetReference() bool } -// UnmarshalRoutePrototypeNextHop unmarshals an instance of RoutePrototypeNextHop from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHop(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHop) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) +// UnmarshalSecurityGroupTargetReference unmarshals an instance of SecurityGroupTargetReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -59019,46 +62563,23 @@ func UnmarshalRoutePrototypeNextHop(m map[string]json.RawMessage, result interfa if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteReference : RouteReference struct -type RouteReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *RouteReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this route. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this route. - ID *string `json:"id" validate:"required"` - - // The name for this route. The name is unique across all routes in the routing table. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalRouteReference unmarshals an instance of RouteReference from the specified map of raw messages. -func UnmarshalRouteReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRouteReferenceDeleted) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { return } @@ -59066,120 +62587,231 @@ func UnmarshalRouteReference(m map[string]json.RawMessage, result interface{}) ( return } -// RouteReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type RouteReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` +// SetSubnetPublicGatewayOptions : The SetSubnetPublicGateway options. +type SetSubnetPublicGatewayOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The public gateway identity. + PublicGatewayIdentity PublicGatewayIdentityIntf `json:"PublicGatewayIdentity" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string } -// UnmarshalRouteReferenceDeleted unmarshals an instance of RouteReferenceDeleted from the specified map of raw messages. -func UnmarshalRouteReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return +// NewSetSubnetPublicGatewayOptions : Instantiate SetSubnetPublicGatewayOptions +func (*VpcV1) NewSetSubnetPublicGatewayOptions(id string, publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { + return &SetSubnetPublicGatewayOptions{ + ID: core.StringPtr(id), + PublicGatewayIdentity: publicGatewayIdentity, } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// RoutingTable : RoutingTable struct -type RoutingTable struct { - // The filters specifying the resources that may create routes in this routing table. +// SetID : Allow user to set ID +func (_options *SetSubnetPublicGatewayOptions) SetID(id string) *SetSubnetPublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetPublicGatewayIdentity : Allow user to set PublicGatewayIdentity +func (_options *SetSubnetPublicGatewayOptions) SetPublicGatewayIdentity(publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { + _options.PublicGatewayIdentity = publicGatewayIdentity + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *SetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *SetSubnetPublicGatewayOptions { + options.Headers = param + return options +} + +// Share : Share struct +type Share struct { + // The access control mode for the share: // - // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter - // support is expected to expand in the future. - AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` + // - `security_group`: The security groups on the virtual network interface for a mount + // target control access to the mount target. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // + // The enumerated access control mode values for this property may expand in the future. When processing this property, + // check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which + // the unexpected access control mode was encountered. + AccessControlMode *string `json:"access_control_mode" validate:"required"` - // The date and time that this routing table was created. + // The date and time that the file share is created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The URL for this routing table. + // The CRN for this file share. + CRN *string `json:"crn" validate:"required"` + + // The type of encryption used for this file share. + Encryption *string `json:"encryption" validate:"required"` + + // The key used to encrypt this file share. + // + // This property will be present if `encryption_type` is `user_managed`. + EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` + + // The URL for this file share. Href *string `json:"href" validate:"required"` - // The unique identifier for this routing table. + // The unique identifier for this file share. ID *string `json:"id" validate:"required"` - // Indicates whether this is the default routing table for this VPC. - IsDefault *bool `json:"is_default" validate:"required"` + // The maximum input/output operations per second (IOPS) for the file share. In addition, each client accessing the + // share will be restricted to 48,000 IOPS. + // + // The maximum IOPS for a share may increase in the future. + Iops *int64 `json:"iops" validate:"required"` - // The lifecycle state of the routing table. + // The latest job associated with this file share. + // + // This property will be absent if no jobs have been created for this file share. + LatestJob *ShareJob `json:"latest_job,omitempty"` + + // The lifecycle state of the file share. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The name for this routing table. The name is unique across all routing tables for the VPC. + // The mount targets for the file share. + MountTargets []ShareMountTargetReference `json:"mount_targets" validate:"required"` + + // The name for this share. The name is unique across all shares in the region. Name *string `json:"name" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) for + // this file share. + Profile *ShareProfileReference `json:"profile" validate:"required"` - // Indicates whether this routing table is used to route traffic that originates from - // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. + // The replica file share for this source file share. // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. - RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` + // This property will be present when the `replication_role` is `source`. + ReplicaShare *ShareReference `json:"replica_share,omitempty"` - // Indicates whether this routing table is used to route traffic that originates from the internet. + // The cron specification for the file share replication schedule. // - // Incoming traffic will be routed according to the routing table with two exceptions: - // - Traffic destined for IP addresses associated with public gateways will not be - // subject to routes in this routing table. - // - Routes with an action of deliver are treated as drop unless the `next_hop` is an - // IP address bound to a network interface on a subnet in the route's `zone`. - // Therefore, if an incoming packet matches a route with a `next_hop` of an - // internet-bound IP address or a VPN gateway connection, the packet will be dropped. - RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` + // This property will be present when the `replication_role` is `replica`. + ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` - // Indicates whether this routing table is used to route traffic that originates from from [Transit - // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. + // The replication role of the file share. // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. - RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` + // * `none`: This share is not participating in replication. + // * `replica`: This share is a replication target. + // * `source`: This share is a replication source. + ReplicationRole *string `json:"replication_role" validate:"required"` - // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this - // VPC. + // The replication status of the file share. // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. - RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` + // * `active`: This share is actively participating in replication, and the replica's data is up-to-date with the + // replication schedule. + // * `failover_pending`: This share is performing a replication failover. + // * `initializing`: This share is initializing replication. + // * `none`: This share is not participating in replication. + // * `split_pending`: This share is performing a replication split. + ReplicationStatus *string `json:"replication_status" validate:"required"` + + // The reasons for the current replication status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + ReplicationStatusReasons []ShareReplicationStatusReason `json:"replication_status_reasons" validate:"required"` - // The routes for this routing table. - Routes []RouteReference `json:"routes" validate:"required"` + // The resource group for this file share. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - // The subnets to which this routing table is attached. - Subnets []SubnetReference `json:"subnets" validate:"required"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The size of the file share rounded up to the next gigabyte. + // + // The maximum size for a share may increase in the future. + Size *int64 `json:"size" validate:"required"` + + // The source file share for this replica file share. + // + // This property will be present when the `replication_role` is `replica`. + SourceShare *ShareReference `json:"source_share,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags" validate:"required"` + + // The zone this file share will reside in. + Zone *ZoneReference `json:"zone" validate:"required"` } -// Constants associated with the RoutingTable.LifecycleState property. -// The lifecycle state of the routing table. +// Constants associated with the Share.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a mount +// target control access to the mount target. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// +// The enumerated access control mode values for this property may expand in the future. When processing this property, +// check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which +// the unexpected access control mode was encountered. const ( - RoutingTableLifecycleStateDeletingConst = "deleting" - RoutingTableLifecycleStateFailedConst = "failed" - RoutingTableLifecycleStatePendingConst = "pending" - RoutingTableLifecycleStateStableConst = "stable" - RoutingTableLifecycleStateSuspendedConst = "suspended" - RoutingTableLifecycleStateUpdatingConst = "updating" - RoutingTableLifecycleStateWaitingConst = "waiting" + ShareAccessControlModeSecurityGroupConst = "security_group" + ShareAccessControlModeVPCConst = "vpc" ) -// Constants associated with the RoutingTable.ResourceType property. +// Constants associated with the Share.Encryption property. +// The type of encryption used for this file share. +const ( + ShareEncryptionProviderManagedConst = "provider_managed" + ShareEncryptionUserManagedConst = "user_managed" +) + +// Constants associated with the Share.LifecycleState property. +// The lifecycle state of the file share. +const ( + ShareLifecycleStateDeletingConst = "deleting" + ShareLifecycleStateFailedConst = "failed" + ShareLifecycleStatePendingConst = "pending" + ShareLifecycleStateStableConst = "stable" + ShareLifecycleStateSuspendedConst = "suspended" + ShareLifecycleStateUpdatingConst = "updating" + ShareLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Share.ReplicationRole property. +// The replication role of the file share. +// +// * `none`: This share is not participating in replication. +// * `replica`: This share is a replication target. +// * `source`: This share is a replication source. +const ( + ShareReplicationRoleNoneConst = "none" + ShareReplicationRoleReplicaConst = "replica" + ShareReplicationRoleSourceConst = "source" +) + +// Constants associated with the Share.ReplicationStatus property. +// The replication status of the file share. +// +// * `active`: This share is actively participating in replication, and the replica's data is up-to-date with the +// replication schedule. +// * `failover_pending`: This share is performing a replication failover. +// * `initializing`: This share is initializing replication. +// * `none`: This share is not participating in replication. +// * `split_pending`: This share is performing a replication split. +const ( + ShareReplicationStatusActiveConst = "active" + ShareReplicationStatusFailoverPendingConst = "failover_pending" + ShareReplicationStatusInitializingConst = "initializing" + ShareReplicationStatusNoneConst = "none" + ShareReplicationStatusSplitPendingConst = "split_pending" +) + +// Constants associated with the Share.ResourceType property. // The resource type. const ( - RoutingTableResourceTypeRoutingTableConst = "routing_table" + ShareResourceTypeShareConst = "share" ) -// UnmarshalRoutingTable unmarshals an instance of RoutingTable from the specified map of raw messages. -func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTable) - err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) +// UnmarshalShare unmarshals an instance of Share from the specified map of raw messages. +func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Share) + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { return } @@ -59187,6 +62819,18 @@ func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -59195,7 +62839,11 @@ func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } - err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalModel(m, "latest_job", &obj.LatestJob, UnmarshalShareJob) if err != nil { return } @@ -59203,35 +62851,59 @@ func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetReference) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) + err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalShareReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { return } - err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + err = core.UnmarshalPrimitive(m, "replication_role", &obj.ReplicationRole) if err != nil { return } - err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + err = core.UnmarshalPrimitive(m, "replication_status", &obj.ReplicationStatus) if err != nil { return } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) + err = core.UnmarshalModel(m, "replication_status_reasons", &obj.ReplicationStatusReasons, UnmarshalShareReplicationStatusReason) if err != nil { return } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) if err != nil { return } @@ -59239,29 +62911,29 @@ func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (er return } -// RoutingTableCollection : RoutingTableCollection struct -type RoutingTableCollection struct { +// ShareCollection : ShareCollection struct +type ShareCollection struct { // A link to the first page of resources. - First *RoutingTableCollectionFirst `json:"first" validate:"required"` + First *ShareCollectionFirst `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 *ShareCollectionNext `json:"next,omitempty"` - // Collection of routing tables. - RoutingTables []RoutingTable `json:"routing_tables" validate:"required"` + // Collection of file shares. + Shares []Share `json:"shares" validate:"required"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// 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) +// 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) if err != nil { return } @@ -59269,11 +62941,11 @@ func UnmarshalRoutingTableCollection(m map[string]json.RawMessage, result interf if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRoutingTableCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareCollectionNext) if err != nil { return } - err = core.UnmarshalModel(m, "routing_tables", &obj.RoutingTables, UnmarshalRoutingTable) + err = core.UnmarshalModel(m, "shares", &obj.Shares, UnmarshalShare) if err != nil { return } @@ -59286,7 +62958,7 @@ func UnmarshalRoutingTableCollection(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 *RoutingTableCollection) GetNextStart() (*string, error) { +func (resp *ShareCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -59297,15 +62969,15 @@ func (resp *RoutingTableCollection) GetNextStart() (*string, error) { return start, nil } -// RoutingTableCollectionFirst : A link to the first page of resources. -type RoutingTableCollectionFirst struct { +// 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"` } -// 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) +// 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 { return @@ -59314,15 +62986,15 @@ func UnmarshalRoutingTableCollectionFirst(m map[string]json.RawMessage, result i return } -// RoutingTableCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type RoutingTableCollectionNext struct { +// 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"` } -// 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) +// 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 { return @@ -59331,33 +63003,41 @@ func UnmarshalRoutingTableCollectionNext(m map[string]json.RawMessage, result in return } -// RoutingTableIdentity : Identifies a routing table by a unique property. +// ShareIdentity : Identifies a file share by a unique property. // Models which "extend" this model: -// - RoutingTableIdentityByID -// - RoutingTableIdentityByHref -type RoutingTableIdentity struct { - // The unique identifier for this routing table. +// - ShareIdentityByID +// - ShareIdentityByCRN +// - ShareIdentityByHref +type ShareIdentity struct { + // The unique identifier for this file share. ID *string `json:"id,omitempty"` - // The URL for this routing table. + // The CRN for this file share. + CRN *string `json:"crn,omitempty"` + + // The URL for this file share. Href *string `json:"href,omitempty"` } -func (*RoutingTableIdentity) isaRoutingTableIdentity() bool { +func (*ShareIdentity) isaShareIdentity() bool { return true } -type RoutingTableIdentityIntf interface { - isaRoutingTableIdentity() bool +type ShareIdentityIntf interface { + isaShareIdentity() bool } -// UnmarshalRoutingTableIdentity unmarshals an instance of RoutingTableIdentity from the specified map of raw messages. -func UnmarshalRoutingTableIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableIdentity) +// UnmarshalShareIdentity unmarshals an instance of ShareIdentity from the specified map of raw messages. +func UnmarshalShareIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -59366,96 +63046,112 @@ func UnmarshalRoutingTableIdentity(m map[string]json.RawMessage, result interfac 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. - // - // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter - // support is expected to expand in the future. - AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` +// ShareInitialOwner : ShareInitialOwner struct +type ShareInitialOwner struct { + // The initial group identifier for the file share. + Gid *int64 `json:"gid,omitempty"` - // The name for this routing table. The name must not be used by another routing table in the VPC. - Name *string `json:"name,omitempty"` + // The initial user identifier for the file share. + Uid *int64 `json:"uid,omitempty"` +} - // Indicates whether this routing table is used to route traffic that originates from - // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to `true` selects this routing table, provided - // no other routing table in the VPC already has this property set to `true`, and no subnets are attached to this - // routing table. Updating to - // `false` deselects this routing table. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. - RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` +// UnmarshalShareInitialOwner unmarshals an instance of ShareInitialOwner from the specified map of raw messages. +func UnmarshalShareInitialOwner(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareInitialOwner) + err = core.UnmarshalPrimitive(m, "gid", &obj.Gid) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uid", &obj.Uid) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // Indicates whether this routing table is used to route traffic that originates from the internet. Updating to `true` - // selects this routing table, provided no other routing table in the VPC already has this property set to `true`. - // Updating to `false` deselects this routing table. +// ShareJob : ShareJob struct +type ShareJob struct { + // The status of the file share job. // - // Incoming traffic will be routed according to the routing table with two exceptions: - // - Traffic destined for IP addresses associated with public gateways will not be subject - // to routes in this routing table. - // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is an - // IP address bound to a network interface on a subnet in the route's `zone`. Therefore, - // if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. - RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"` - - // Indicates whether this routing table is used to route traffic that originates from - // [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. Updating to - // `true` selects this routing table, provided no other routing table in the VPC already has this property set to - // `true`, and no subnets are attached to this routing table. Updating to `false` deselects this routing table. + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the + // unexpected property value was encountered. // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. + // * `cancelled`: This job has been cancelled. + // * `failed`: This job has failed. + // * `queued`: This job is queued. + // * `running`: This job is running. + // * `succeeded`: This job completed successfully. + Status *string `json:"status" validate:"required"` + + // The reasons for the file share job status (if any). // - // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled - // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing - // table. - RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []ShareJobStatusReason `json:"status_reasons" validate:"required"` - // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this - // VPC. Updating to `true` selects this routing table, provided no other routing table in the VPC already has this - // property set to `true`, and no subnets are attached to this routing table. Updating to `false` deselects this - // routing table. + // The type of the file share job. // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address bound to a network interface on a subnet in - // the route's `zone`. Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP - // address or a VPN gateway connection, the packet will be dropped. - RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the + // unexpected property value was encountered. + // + // * `replication_failover`: This is a share replication failover job. + // * `replication_init`: This is a share replication is initialization job. + // * `replication_split`: This is a share replication split job. + Type *string `json:"type" validate:"required"` } -// UnmarshalRoutingTablePatch unmarshals an instance of RoutingTablePatch from the specified map of raw messages. -func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTablePatch) - err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) +// Constants associated with the ShareJob.Status property. +// The status of the file share job. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the +// unexpected property value was encountered. +// +// * `cancelled`: This job has been cancelled. +// * `failed`: This job has failed. +// * `queued`: This job is queued. +// * `running`: This job is running. +// * `succeeded`: This job completed successfully. +const ( + ShareJobStatusCancelledConst = "cancelled" + ShareJobStatusFailedConst = "failed" + ShareJobStatusQueuedConst = "queued" + ShareJobStatusRunningConst = "running" + ShareJobStatusSucceededConst = "succeeded" +) + +// Constants associated with the ShareJob.Type property. +// The type of the file share job. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the +// unexpected property value was encountered. +// +// * `replication_failover`: This is a share replication failover job. +// * `replication_init`: This is a share replication is initialization job. +// * `replication_split`: This is a share replication split job. +const ( + ShareJobTypeReplicationFailoverConst = "replication_failover" + ShareJobTypeReplicationInitConst = "replication_init" + ShareJobTypeReplicationSplitConst = "replication_split" +) + +// UnmarshalShareJob unmarshals an instance of ShareJob from the specified map of raw messages. +func UnmarshalShareJob(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareJob) + err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { return } - err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalShareJobStatusReason) if err != nil { return } - err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -59463,78 +63159,37 @@ func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{} return } -// 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) - } - return -} - -// RoutingTableReference : RoutingTableReference struct -type RoutingTableReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *RoutingTableReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this routing table. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this routing table. - ID *string `json:"id" validate:"required"` +// ShareJobStatusReason : ShareJobStatusReason struct +type ShareJobStatusReason struct { + // A snake case string succinctly identifying the status reason. + Code *string `json:"code" validate:"required"` - // The name for this routing table. The name is unique across all routing tables for the VPC. - Name *string `json:"name" validate:"required"` + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` } -// Constants associated with the RoutingTableReference.ResourceType property. -// The resource type. +// Constants associated with the ShareJobStatusReason.Code property. +// A snake case string succinctly identifying the status reason. const ( - RoutingTableReferenceResourceTypeRoutingTableConst = "routing_table" + ShareJobStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication" + ShareJobStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share" + ShareJobStatusReasonCodeCannotReachSourceShareConst = "cannot_reach_source_share" ) -// UnmarshalRoutingTableReference unmarshals an instance of RoutingTableReference from the specified map of raw messages. -func UnmarshalRoutingTableReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRoutingTableReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +// UnmarshalShareJobStatusReason unmarshals an instance of ShareJobStatusReason from the specified map of raw messages. +func UnmarshalShareJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareJobStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "message", &obj.Message) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutingTableReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type RoutingTableReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalRoutingTableReferenceDeleted unmarshals an instance of RoutingTableReferenceDeleted from the specified map of raw messages. -func UnmarshalRoutingTableReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableReferenceDeleted) err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return @@ -59543,44 +63198,138 @@ func UnmarshalRoutingTableReferenceDeleted(m map[string]json.RawMessage, result return } -// SecurityGroup : SecurityGroup struct -type SecurityGroup struct { - // The date and time that this security group was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` +// ShareMountTarget : ShareMountTarget struct +type ShareMountTarget struct { + // The access control mode for the share: + // + // - `security_group`: The security groups on the virtual network interface for a mount + // target control access to the mount target. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // + // The enumerated access control mode values for this property may expand in the future. When processing this property, + // check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which + // the unexpected access control mode was encountered. + AccessControlMode *string `json:"access_control_mode" validate:"required"` - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` + // The date and time that the share mount target was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The security group's canonical URL. + // The URL for this share mount target. Href *string `json:"href" validate:"required"` - // The unique identifier for this security group. + // The unique identifier for this share mount target. ID *string `json:"id" validate:"required"` - // The name for this security group. The name is unique across all security groups for the VPC. + // The lifecycle state of the mount target. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The mount path for the share. The server component of the mount path may be either an IP address or a fully + // qualified domain name. + // + // This property will be absent if the `lifecycle_state` of the mount target is + // 'pending', `failed`, or `deleting`. + // + // If the share's `access_control_mode` is: + // + // - `security_group`: The IP address used in the mount path is the `primary_ip` + // address of the virtual network interface for this share mount target. + // - `vpc`: The fully-qualified domain name used in the mount path is an address that + // resolves to the share mount target. + MountPath *string `json:"mount_path,omitempty"` + + // The name for this share mount target. The name is unique across all mount targets for the file share. Name *string `json:"name" validate:"required"` - // The resource group for this security group. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + // The primary IP address of the virtual network interface for the share mount target. + // + // Absent if `access_control_mode` is `vpc`. + PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` - // The rules for this security group. If no rules exist, all traffic will be denied. - Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` - // The targets for this security group. - Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` + // The subnet of the virtual network interface for the share mount target. + // + // Absent if `access_control_mode` is `vpc`. + Subnet *SubnetReference `json:"subnet,omitempty"` - // The VPC this security group resides in. + // The transit encryption mode for this share mount target: + // - `none`: Not encrypted in transit + // - `user_managed`: Encrypted in transit using an instance identity certificate + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + TransitEncryption *string `json:"transit_encryption" validate:"required"` + + // The virtual network interface for this file share mount target. + // + // This property will be present when the `access_control_mode` is `security_group`. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface,omitempty"` + + // If `access_control_mode` is: + // + // - `security_group`: The VPC for the virtual network interface for this share mount + // target + // - `vpc`: The VPC in which clients can mount the file share using this share + // mount target. VPC *VPCReference `json:"vpc" validate:"required"` } -// UnmarshalSecurityGroup unmarshals an instance of SecurityGroup from the specified map of raw messages. -func UnmarshalSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroup) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) +// Constants associated with the ShareMountTarget.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a mount +// target control access to the mount target. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// +// The enumerated access control mode values for this property may expand in the future. When processing this property, +// check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which +// the unexpected access control mode was encountered. +const ( + ShareMountTargetAccessControlModeSecurityGroupConst = "security_group" + ShareMountTargetAccessControlModeVPCConst = "vpc" +) + +// Constants associated with the ShareMountTarget.LifecycleState property. +// The lifecycle state of the mount target. +const ( + ShareMountTargetLifecycleStateDeletingConst = "deleting" + ShareMountTargetLifecycleStateFailedConst = "failed" + ShareMountTargetLifecycleStatePendingConst = "pending" + ShareMountTargetLifecycleStateStableConst = "stable" + ShareMountTargetLifecycleStateSuspendedConst = "suspended" + ShareMountTargetLifecycleStateUpdatingConst = "updating" + ShareMountTargetLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the ShareMountTarget.ResourceType property. +// The resource type. +const ( + ShareMountTargetResourceTypeShareMountTargetConst = "share_mount_target" +) + +// Constants associated with the ShareMountTarget.TransitEncryption property. +// The transit encryption mode for this share mount target: +// - `none`: Not encrypted in transit +// - `user_managed`: Encrypted in transit using an instance identity certificate +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ShareMountTargetTransitEncryptionNoneConst = "none" + ShareMountTargetTransitEncryptionUserManagedConst = "user_managed" +) + +// UnmarshalShareMountTarget unmarshals an instance of ShareMountTarget from the specified map of raw messages. +func UnmarshalShareMountTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTarget) + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } @@ -59592,19 +63341,35 @@ func UnmarshalSecurityGroup(m map[string]json.RawMessage, result interface{}) (e if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mount_path", &obj.MountPath) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { return } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) + err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) if err != nil { return } - err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) if err != nil { return } @@ -59616,29 +63381,29 @@ func UnmarshalSecurityGroup(m map[string]json.RawMessage, result interface{}) (e return } -// SecurityGroupCollection : SecurityGroupCollection struct -type SecurityGroupCollection struct { +// ShareMountTargetCollection : ShareMountTargetCollection struct +type ShareMountTargetCollection struct { // A link to the first page of resources. - First *SecurityGroupCollectionFirst `json:"first" validate:"required"` + First *ShareMountTargetCollectionFirst `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` + // Collection of share mount targets. + MountTargets []ShareMountTarget `json:"mount_targets" 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"` - - // Collection of security groups. - SecurityGroups []SecurityGroup `json:"security_groups" validate:"required"` + Next *ShareMountTargetCollectionNext `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// 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) +// 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) if err != nil { return } @@ -59646,11 +63411,11 @@ func UnmarshalSecurityGroupCollection(m map[string]json.RawMessage, result inter if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupCollectionNext) + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTarget) if err != nil { return } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroup) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareMountTargetCollectionNext) if err != nil { return } @@ -59663,7 +63428,7 @@ func UnmarshalSecurityGroupCollection(m map[string]json.RawMessage, result inter } // Retrieve the value to be passed to a request to access the next page of results -func (resp *SecurityGroupCollection) GetNextStart() (*string, error) { +func (resp *ShareMountTargetCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -59674,15 +63439,15 @@ func (resp *SecurityGroupCollection) GetNextStart() (*string, error) { return start, nil } -// SecurityGroupCollectionFirst : A link to the first page of resources. -type SecurityGroupCollectionFirst struct { +// 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"` } -// 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) +// 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 { return @@ -59691,15 +63456,15 @@ func UnmarshalSecurityGroupCollectionFirst(m map[string]json.RawMessage, result return } -// SecurityGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type SecurityGroupCollectionNext struct { +// 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"` } -// 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) +// 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 { return @@ -59708,59 +63473,87 @@ func UnmarshalSecurityGroupCollectionNext(m map[string]json.RawMessage, result i return } -// SecurityGroupIdentity : Identifies a security group by a unique property. +// 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. + Name *string `json:"name,omitempty"` +} + +// UnmarshalShareMountTargetPatch unmarshals an instance of ShareMountTargetPatch from the specified map of raw messages. +func UnmarshalShareMountTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// ShareMountTargetPrototype : ShareMountTargetPrototype struct // Models which "extend" this model: -// - SecurityGroupIdentityByID -// - SecurityGroupIdentityByCRN -// - SecurityGroupIdentityByHref -type SecurityGroupIdentity struct { - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` +// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup +// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC +type ShareMountTargetPrototype struct { + // The name for this share mount target. The name must not be used by another mount target for the file share. + Name *string `json:"name,omitempty"` - // The security group's CRN. - CRN *string `json:"crn,omitempty"` + // The transit encryption mode to use for this share mount target: + // - `none`: Not encrypted in transit. + // - `user_managed`: Encrypted in transit using an instance identity certificate. The + // `access_control_mode` for the share must be `security_group`. + TransitEncryption *string `json:"transit_encryption,omitempty"` - // The security group's canonical URL. - Href *string `json:"href,omitempty"` + VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface,omitempty"` + + // Identifies a VPC by a unique property. + VPC VPCIdentityIntf `json:"vpc,omitempty"` } -func (*SecurityGroupIdentity) isaSecurityGroupIdentity() bool { +// Constants associated with the ShareMountTargetPrototype.TransitEncryption property. +// The transit encryption mode to use for this share mount target: +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. The +// `access_control_mode` for the share must be `security_group`. +const ( + ShareMountTargetPrototypeTransitEncryptionNoneConst = "none" + ShareMountTargetPrototypeTransitEncryptionUserManagedConst = "user_managed" +) + +func (*ShareMountTargetPrototype) isaShareMountTargetPrototype() bool { return true } -type SecurityGroupIdentityIntf interface { - isaSecurityGroupIdentity() bool +type ShareMountTargetPrototypeIntf interface { + isaShareMountTargetPrototype() bool } -// UnmarshalSecurityGroupIdentity unmarshals an instance of SecurityGroupIdentity from the specified map of raw messages. -func UnmarshalSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalShareMountTargetPrototype unmarshals an instance of ShareMountTargetPrototype from the specified map of raw messages. +func UnmarshalShareMountTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupPatch : SecurityGroupPatch struct -type SecurityGroupPatch struct { - // The name for this security group. The name must not be used by another security group for the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalSecurityGroupPatch unmarshals an instance of SecurityGroupPatch from the specified map of raw messages. -func UnmarshalSecurityGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { return } @@ -59768,43 +63561,35 @@ func UnmarshalSecurityGroupPatch(m map[string]json.RawMessage, result interface{ return } -// 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) - } - return -} - -// SecurityGroupReference : SecurityGroupReference struct -type SecurityGroupReference struct { - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` - +// ShareMountTargetReference : ShareMountTargetReference struct +type ShareMountTargetReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` - // The security group's canonical URL. + // The URL for this share mount target. Href *string `json:"href" validate:"required"` - // The unique identifier for this security group. + // The unique identifier for this share mount target. ID *string `json:"id" validate:"required"` - // The name for this security group. The name is unique across all security groups for the VPC. + // The name for this share mount target. The name is unique across all mount targets for the file share. Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// UnmarshalSecurityGroupReference unmarshals an instance of SecurityGroupReference from the specified map of raw messages. -func UnmarshalSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) +// Constants associated with the ShareMountTargetReference.ResourceType property. +// The resource type. +const ( + ShareMountTargetReferenceResourceTypeShareMountTargetConst = "share_mount_target" +) + +// UnmarshalShareMountTargetReference unmarshals an instance of ShareMountTargetReference from the specified map of raw messages. +func UnmarshalShareMountTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) if err != nil { return } @@ -59820,20 +63605,24 @@ func UnmarshalSecurityGroupReference(m map[string]json.RawMessage, result interf if err != nil { return } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SecurityGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// ShareMountTargetReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary // information. -type SecurityGroupReferenceDeleted struct { +type ShareMountTargetReferenceDeleted struct { // Link to documentation about deleted resources. MoreInfo *string `json:"more_info" validate:"required"` } -// UnmarshalSecurityGroupReferenceDeleted unmarshals an instance of SecurityGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalSecurityGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupReferenceDeleted) +// UnmarshalShareMountTargetReferenceDeleted unmarshals an instance of ShareMountTargetReferenceDeleted from the specified map of raw messages. +func UnmarshalShareMountTargetReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetReferenceDeleted) err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return @@ -59842,117 +63631,67 @@ func UnmarshalSecurityGroupReferenceDeleted(m map[string]json.RawMessage, result return } -// SecurityGroupRule : SecurityGroupRule struct +// ShareMountTargetVirtualNetworkInterfacePrototype : ShareMountTargetVirtualNetworkInterfacePrototype struct // Models which "extend" this model: -// - SecurityGroupRuleSecurityGroupRuleProtocolAll -// - SecurityGroupRuleSecurityGroupRuleProtocolIcmp -// - SecurityGroupRuleSecurityGroupRuleProtocolTcpudp -type SecurityGroupRule struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The URL for this security group rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group rule. - ID *string `json:"id" validate:"required"` - - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The IP addresses or security groups from which this rule allows traffic (or to which, for - // outbound rules). Can be specified as an IP address, a CIDR block, or a security group. A - // CIDR block of `0.0.0.0/0` allows traffic from any source (or to any destination, for - // outbound rules). - Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext +type ShareMountTargetVirtualNetworkInterfacePrototype struct { + // 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 ICMP traffic code to allow. If absent, all codes are allowed. - Code *int64 `json:"code,omitempty"` + // 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"` - // The ICMP traffic type to allow. If absent, all types are allowed. - Type *int64 `json:"type,omitempty"` + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The inclusive upper bound of TCP/UDP destination port range. - PortMax *int64 `json:"port_max,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 inclusive lower bound of TCP/UDP destination port range. - PortMin *int64 `json:"port_min,omitempty"` + // The associated subnet. Required if `primary_ip` does not specify a reserved IP and + // `primary_ip.address` is not specified. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` } -// Constants associated with the SecurityGroupRule.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRuleDirectionInboundConst = "inbound" - SecurityGroupRuleDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRule.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRuleIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRule.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRuleProtocolAllConst = "all" - SecurityGroupRuleProtocolIcmpConst = "icmp" - SecurityGroupRuleProtocolTCPConst = "tcp" - SecurityGroupRuleProtocolUDPConst = "udp" -) - -func (*SecurityGroupRule) isaSecurityGroupRule() bool { +func (*ShareMountTargetVirtualNetworkInterfacePrototype) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { return true } -type SecurityGroupRuleIntf interface { - isaSecurityGroupRule() bool +type ShareMountTargetVirtualNetworkInterfacePrototypeIntf interface { + isaShareMountTargetVirtualNetworkInterfacePrototype() bool } -// UnmarshalSecurityGroupRule unmarshals an instance of SecurityGroupRule from the specified map of raw messages. -func UnmarshalSecurityGroupRule(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) +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototype unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototype from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) return } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { return } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll) - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp) - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return } - return -} - -// SecurityGroupRuleCollection : Collection of rules in a security group. -type SecurityGroupRuleCollection struct { - // Array of rules. - Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` -} - -// UnmarshalSecurityGroupRuleCollection unmarshals an instance of SecurityGroupRuleCollection from the specified map of raw messages. -func UnmarshalSecurityGroupRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleCollection) - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { return } @@ -59960,88 +63699,91 @@ func UnmarshalSecurityGroupRuleCollection(m map[string]json.RawMessage, result i return } -// SecurityGroupRulePatch : SecurityGroupRulePatch struct -type SecurityGroupRulePatch struct { - // The ICMP traffic code to allow. If set, `type` must also be set. +// SharePatch : SharePatch struct +type SharePatch struct { + // The access control mode for the share: // - // Specify `null` to remove an existing ICMP traffic code. - Code *int64 `json:"code,omitempty"` + // - `security_group`: The security groups on the virtual network interface for a + // mount target control access to the mount target. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // + // For this property to be changed, the share must have no mount targets and + // `replication_role` must be `none`. + AccessControlMode *string `json:"access_control_mode,omitempty"` - // The direction of traffic to enforce. - Direction *string `json:"direction,omitempty"` + // The maximum input/output operations per second (IOPS) for the file share. The value must be in the range supported + // by the share's size. + // + // For this property to be changed, the share `lifecycle_state` must be `stable`. + Iops *int64 `json:"iops,omitempty"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` + // The name for this share. The name must not be used by another share in the region. + Name *string `json:"name,omitempty"` - // The inclusive upper bound of the protocol destination port range. If set, `port_min` must also be set, and must not - // be larger. + // The profile to use for this file share. // - // Specify `null` to remove an existing upper bound. - PortMax *int64 `json:"port_max,omitempty"` + // The requested profile must be in the same `family`. + Profile ShareProfileIdentityIntf `json:"profile,omitempty"` - // The inclusive lower bound of the protocol destination port range. If set, `port_max` must also be set, and must not - // be smaller. + // The cron specification for the file share replication schedule. // - // Specify `null` to remove an existing lower bound. - PortMin *int64 `json:"port_min,omitempty"` - - // The 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. A CIDR block of `0.0.0.0/0` will allow traffic from any source (or to - // any destination, for outbound rules). - Remote SecurityGroupRuleRemotePatchIntf `json:"remote,omitempty"` + // Replication of a share can be scheduled to occur at most once per hour. + // + // For this property to be changed, the share `replication_role` must be `replica`. + ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` - // The ICMP traffic type to allow. + // The size of the file share rounded up to the next gigabyte. The value must not be less than the share's current + // size, and must not exceed the maximum supported by the share's profile and IOPS. // - // Specify `null` to remove an existing ICMP traffic type value. - Type *int64 `json:"type,omitempty"` -} + // For this property to be changed, the share `lifecycle_state` must be `stable`. + Size *int64 `json:"size,omitempty"` -// Constants associated with the SecurityGroupRulePatch.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRulePatchDirectionInboundConst = "inbound" - SecurityGroupRulePatchDirectionOutboundConst = "outbound" -) + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` +} -// Constants associated with the SecurityGroupRulePatch.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. +// Constants associated with the SharePatch.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a +// mount target control access to the mount target. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// +// For this property to be changed, the share must have no mount targets and +// `replication_role` must be `none`. const ( - SecurityGroupRulePatchIPVersionIpv4Const = "ipv4" + SharePatchAccessControlModeSecurityGroupConst = "security_group" + SharePatchAccessControlModeVPCConst = "vpc" ) -// UnmarshalSecurityGroupRulePatch unmarshals an instance of SecurityGroupRulePatch from the specified map of raw messages. -func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRulePatch) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) +// UnmarshalSharePatch unmarshals an instance of SharePatch from the specified map of raw messages. +func UnmarshalSharePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePatch) + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { return } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePatch) + err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { return } @@ -60049,196 +63791,321 @@ func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interf return } -// AsPatch returns a generic map representation of the SecurityGroupRulePatch -func (securityGroupRulePatch *SecurityGroupRulePatch) AsPatch() (_patch map[string]interface{}, err error) { +// 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(securityGroupRulePatch) + jsonData, err = json.Marshal(sharePatch) if err == nil { err = json.Unmarshal(jsonData, &_patch) } return } -// SecurityGroupRulePrototype : SecurityGroupRulePrototype struct -// Models which "extend" this model: -// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll -// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp -// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp -type SecurityGroupRulePrototype struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` +// ShareProfile : ShareProfile struct +type ShareProfile struct { + // The permitted capacity range (in gigabytes) for a share with this profile. + Capacity ShareProfileCapacityIntf `json:"capacity" validate:"required"` - // The 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. - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source - // (or to any destination, for outbound rules). - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + // The product family this share profile belongs to. + Family *string `json:"family" validate:"required"` - // The ICMP traffic code to allow. - // - // If specified, `type` must also be specified. If unspecified, all codes are allowed. - Code *int64 `json:"code,omitempty"` + // The URL for this share profile. + Href *string `json:"href" validate:"required"` - // The ICMP traffic type to allow. - // - // If unspecified, all types are allowed. - Type *int64 `json:"type,omitempty"` + // The permitted IOPS range for a share with this profile. + Iops ShareProfileIopsIntf `json:"iops" validate:"required"` - // The inclusive upper bound of TCP/UDP destination port range. - // - // If specified, `port_min` must also be specified, and must not be larger. If unspecified, - // `port_min` must also be unspecified, allowing traffic on all destination ports. - PortMax *int64 `json:"port_max,omitempty"` + // The globally unique name for this share profile. + Name *string `json:"name" validate:"required"` - // The inclusive lower bound of TCP/UDP destination port range - // - // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be - // unspecified, allowing traffic on all destination ports. - PortMin *int64 `json:"port_min,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the SecurityGroupRulePrototype.Direction property. -// The direction of traffic to enforce. +// Constants associated with the ShareProfile.Family property. +// The product family this share profile belongs to. const ( - SecurityGroupRulePrototypeDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeDirectionOutboundConst = "outbound" + ShareProfileFamilyDefinedPerformanceConst = "defined_performance" ) -// Constants associated with the SecurityGroupRulePrototype.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. +// Constants associated with the ShareProfile.ResourceType property. +// The resource type. const ( - SecurityGroupRulePrototypeIPVersionIpv4Const = "ipv4" + ShareProfileResourceTypeShareProfileConst = "share_profile" ) -// Constants associated with the SecurityGroupRulePrototype.Protocol property. -// The protocol to enforce. +// UnmarshalShareProfile unmarshals an instance of ShareProfile from the specified map of raw messages. +func UnmarshalShareProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfile) + err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalShareProfileCapacity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "iops", &obj.Iops, UnmarshalShareProfileIops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileCapacity : ShareProfileCapacity struct +// Models which "extend" this model: +// - ShareProfileCapacityFixed +// - ShareProfileCapacityRange +// - ShareProfileCapacityEnum +// - ShareProfileCapacityDependentRange +type ShareProfileCapacity 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 ShareProfileCapacity.Type property. +// The type for this profile field. const ( - SecurityGroupRulePrototypeProtocolAllConst = "all" - SecurityGroupRulePrototypeProtocolIcmpConst = "icmp" - SecurityGroupRulePrototypeProtocolTCPConst = "tcp" - SecurityGroupRulePrototypeProtocolUDPConst = "udp" + ShareProfileCapacityTypeFixedConst = "fixed" ) -func (*SecurityGroupRulePrototype) isaSecurityGroupRulePrototype() bool { +func (*ShareProfileCapacity) isaShareProfileCapacity() bool { return true } -type SecurityGroupRulePrototypeIntf interface { - isaSecurityGroupRulePrototype() bool +type ShareProfileCapacityIntf interface { + isaShareProfileCapacity() bool +} + +// UnmarshalShareProfileCapacity unmarshals an instance of ShareProfileCapacity from the specified map of raw messages. +func UnmarshalShareProfileCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCapacity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileCollection : ShareProfileCollection struct +type ShareProfileCollection struct { + // A link to the first page of resources. + First *ShareProfileCollectionFirst `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"` + + // Collection of share profiles. + Profiles []ShareProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalShareProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ShareProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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"` } -// 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) +// 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 = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) return } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") - return - } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) - } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SecurityGroupRuleRemote : The IP addresses or security groups from which this rule allows traffic (or to which, for outbound rules). Can be -// specified as an IP address, a CIDR block, or a security group. A CIDR block of `0.0.0.0/0` allows traffic from any -// source (or to any destination, for outbound rules). +// ShareProfileIops : ShareProfileIops struct // Models which "extend" this model: -// - SecurityGroupRuleRemoteIP -// - SecurityGroupRuleRemoteCIDR -// - SecurityGroupRuleRemoteSecurityGroupReference -type SecurityGroupRuleRemote struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` +// - ShareProfileIopsFixed +// - ShareProfileIopsRange +// - ShareProfileIopsEnum +// - ShareProfileIopsDependentRange +type ShareProfileIops struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. - CIDRBlock *string `json:"cidr_block,omitempty"` + // The value for this profile field. + Value *int64 `json:"value,omitempty"` - // The security group's CRN. - CRN *string `json:"crn,omitempty"` + // 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 *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` - // The security group's canonical URL. - Href *string `json:"href,omitempty"` + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` - // The name for this security group. The name is unique across all security groups for the VPC. - Name *string `json:"name,omitempty"` + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` } -func (*SecurityGroupRuleRemote) isaSecurityGroupRuleRemote() bool { +// Constants associated with the ShareProfileIops.Type property. +// The type for this profile field. +const ( + ShareProfileIopsTypeFixedConst = "fixed" +) + +func (*ShareProfileIops) isaShareProfileIops() bool { return true } -type SecurityGroupRuleRemoteIntf interface { - isaSecurityGroupRuleRemote() bool +type ShareProfileIopsIntf interface { + isaShareProfileIops() bool } -// UnmarshalSecurityGroupRuleRemote unmarshals an instance of SecurityGroupRuleRemote from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemote) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) +// UnmarshalShareProfileIops unmarshals an instance of ShareProfileIops from the specified map of raw messages. +func UnmarshalShareProfileIops(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIops) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "min", &obj.Min) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "step", &obj.Step) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -60246,64 +64113,71 @@ func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result inter return } -// SecurityGroupRuleRemotePatch : The 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. A CIDR block of `0.0.0.0/0` will allow traffic from -// any source (or to any destination, for outbound rules). +// ShareProfileIdentity : Identifies a share profile by a unique property. // Models which "extend" this model: -// - SecurityGroupRuleRemotePatchIP -// - SecurityGroupRuleRemotePatchCIDR -// - SecurityGroupRuleRemotePatchSecurityGroupIdentity -type SecurityGroupRuleRemotePatch struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` - - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. - CIDRBlock *string `json:"cidr_block,omitempty"` - - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` - - // The security group's CRN. - CRN *string `json:"crn,omitempty"` +// - ShareProfileIdentityByName +// - ShareProfileIdentityByHref +type ShareProfileIdentity struct { + // The globally unique name for this share profile. + Name *string `json:"name,omitempty"` - // The security group's canonical URL. + // The URL for this share profile. Href *string `json:"href,omitempty"` } -func (*SecurityGroupRuleRemotePatch) isaSecurityGroupRuleRemotePatch() bool { +func (*ShareProfileIdentity) isaShareProfileIdentity() bool { return true } -type SecurityGroupRuleRemotePatchIntf interface { - isaSecurityGroupRuleRemotePatch() bool +type ShareProfileIdentityIntf interface { + isaShareProfileIdentity() bool } -// UnmarshalSecurityGroupRuleRemotePatch unmarshals an instance of SecurityGroupRuleRemotePatch from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatch) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) +// UnmarshalShareProfileIdentity unmarshals an instance of ShareProfileIdentity from the specified map of raw messages. +func UnmarshalShareProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileReference : ShareProfileReference struct +type ShareProfileReference struct { + // The URL for this share profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this share profile. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ShareProfileReference.ResourceType property. +// The resource type. +const ( + ShareProfileReferenceResourceTypeShareProfileConst = "share_profile" +) + +// UnmarshalShareProfileReference unmarshals an instance of ShareProfileReference from the specified map of raw messages. +func UnmarshalShareProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -60311,66 +64185,156 @@ func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result return } -// SecurityGroupRuleRemotePrototype : The 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. -// -// If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source -// (or to any destination, for outbound rules). +// SharePrototype : SharePrototype struct // Models which "extend" this model: -// - SecurityGroupRuleRemotePrototypeIP -// - SecurityGroupRuleRemotePrototypeCIDR -// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentity -type SecurityGroupRuleRemotePrototype struct { - // The IP address. +// - SharePrototypeShareBySize +// - SharePrototypeShareBySourceShare +type SharePrototype struct { + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` + // In addition, each client accessing the share will be restricted to 48,000 IOPS. + Iops *int64 `json:"iops,omitempty"` - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. - CIDRBlock *string `json:"cidr_block,omitempty"` + // The mount targets for the file share. Each mount target must be in a unique VPC. + MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` + // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be + // a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` - // The security group's CRN. - CRN *string `json:"crn,omitempty"` + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use + // for this file share. The profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - // The security group's canonical URL. - Href *string `json:"href,omitempty"` + // Configuration for a replica file share to create and associate with this file share. If + // unspecified, a replica may be subsequently added by creating a new file share with a + // `source_share` referencing this file share. + ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this file share will reside in. + // For a replica share, this must be a different zone in the same region as the source share. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The access control mode for the share: + // + // - `security_group`: The security groups on the virtual network interface for a + // mount target control access to the mount target. Mount targets for this share + // require a virtual network interface. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // Mount targets for this share require a VPC. + AccessControlMode *string `json:"access_control_mode,omitempty"` + + // The root key to use to wrap the data encryption key for the share. + // + // If unspecified, the `encryption` type for the share will be `provider_managed`. + // + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The owner assigned to the file share at creation. Subsequent changes to the owner + // must be performed by a client that has mounted the file share. + InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The size of the file share rounded up to the next gigabyte. + // + // The maximum size for a share may increase in the future. + Size *int64 `json:"size,omitempty"` + + // The cron specification for the file share replication schedule. + // + // Replication of a share can be scheduled to occur at most once per hour. + ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` + + // The source file share for this replica file share. The specified file share must not + // already have a replica, and must not be a replica. + SourceShare ShareIdentityIntf `json:"source_share,omitempty"` } -func (*SecurityGroupRuleRemotePrototype) isaSecurityGroupRuleRemotePrototype() bool { +// Constants associated with the SharePrototype.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a +// mount target control access to the mount target. Mount targets for this share +// require a virtual network interface. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// Mount targets for this share require a VPC. +const ( + SharePrototypeAccessControlModeSecurityGroupConst = "security_group" + SharePrototypeAccessControlModeVPCConst = "vpc" +) + +func (*SharePrototype) isaSharePrototype() bool { return true } -type SecurityGroupRuleRemotePrototypeIntf interface { - isaSecurityGroupRuleRemotePrototype() bool +type SharePrototypeIntf interface { + isaSharePrototype() bool } -// UnmarshalSecurityGroupRuleRemotePrototype unmarshals an instance of SecurityGroupRuleRemotePrototype from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototype) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) +// UnmarshalSharePrototype unmarshals an instance of SharePrototype from the specified map of raw messages. +func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePrototype) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { return } - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareIdentity) if err != nil { return } @@ -60378,91 +64342,90 @@ func UnmarshalSecurityGroupRuleRemotePrototype(m map[string]json.RawMessage, res return } -// SecurityGroupTargetCollection : SecurityGroupTargetCollection struct -type SecurityGroupTargetCollection struct { - // A link to the first page of resources. - First *SecurityGroupTargetCollectionFirst `json:"first" validate:"required"` +// SharePrototypeShareContext : Configuration for a replica file share to create and associate with this file share. If unspecified, a replica may be +// subsequently added by creating a new file share with a +// `source_share` referencing this file share. +type SharePrototypeShareContext struct { + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each client accessing the share will be restricted to 48,000 IOPS. + Iops *int64 `json:"iops,omitempty"` - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` + // The mount targets for this replica file share. Each mount target must be in a unique VPC. + // + // A replica's mount targets must be mounted read-only. + MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *SecurityGroupTargetCollectionNext `json:"next,omitempty"` + // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be + // a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` - // Collection of targets for this security group. - Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use + // for this file share. The profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` + // The cron specification for the file share replication schedule. + // + // Replication of a share can be scheduled to occur at most once per hour. + ReplicationCronSpec *string `json:"replication_cron_spec" validate:"required"` + + // The resource group to use. If unspecified, the resource group from + // the source share will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this replica file share will reside in. + // + // Must be a different zone in the same region as the source share. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// 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) +// NewSharePrototypeShareContext : Instantiate SharePrototypeShareContext (Generic Model Constructor) +func (*VpcV1) NewSharePrototypeShareContext(profile ShareProfileIdentityIntf, replicationCronSpec string, zone ZoneIdentityIntf) (_model *SharePrototypeShareContext, err error) { + _model = &SharePrototypeShareContext{ + Profile: profile, + ReplicationCronSpec: core.StringPtr(replicationCronSpec), + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalSharePrototypeShareContext unmarshals an instance of SharePrototypeShareContext from the specified map of raw messages. +func UnmarshalSharePrototypeShareContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePrototypeShareContext) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupTargetCollectionNext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { 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 *SecurityGroupTargetCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return } - 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) + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { 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) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } @@ -60470,53 +64433,42 @@ func UnmarshalSecurityGroupTargetCollectionNext(m map[string]json.RawMessage, re return } -// SecurityGroupTargetReference : The resource types that can be security group targets are expected to expand in the future. When iterating over -// security group targets, do not assume that every target resource will be from a known set of resource types. -// Optionally halt processing and surface an error, or bypass resources of unrecognized types. -// Models which "extend" this model: -// - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext -// - SecurityGroupTargetReferenceLoadBalancerReference -// - SecurityGroupTargetReferenceEndpointGatewayReference -// - SecurityGroupTargetReferenceVPNServerReference -type SecurityGroupTargetReference struct { +// ShareReference : ShareReference struct +type ShareReference struct { + // The CRN for this file share. + CRN *string `json:"crn" validate:"required"` + // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + Deleted *ShareReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network interface. - Href *string `json:"href,omitempty"` + // The URL for this file share. + Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. - ID *string `json:"id,omitempty"` + // The unique identifier for this file share. + ID *string `json:"id" validate:"required"` - // The name for this network interface. - Name *string `json:"name,omitempty"` + // The name for this share. The name is unique across all shares in the region. + Name *string `json:"name" validate:"required"` // The resource type. - ResourceType *string `json:"resource_type,omitempty"` - - // The load balancer's CRN. - CRN *string `json:"crn,omitempty"` + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the SecurityGroupTargetReference.ResourceType property. +// Constants associated with the ShareReference.ResourceType property. // The resource type. const ( - SecurityGroupTargetReferenceResourceTypeNetworkInterfaceConst = "network_interface" + ShareReferenceResourceTypeShareConst = "share" ) -func (*SecurityGroupTargetReference) isaSecurityGroupTargetReference() bool { - return true -} - -type SecurityGroupTargetReferenceIntf interface { - isaSecurityGroupTargetReference() bool -} - -// UnmarshalSecurityGroupTargetReference unmarshals an instance of SecurityGroupTargetReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) +// UnmarshalShareReference unmarshals an instance of ShareReference from the specified map of raw messages. +func UnmarshalShareReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareReferenceDeleted) if err != nil { return } @@ -60536,50 +64488,65 @@ func UnmarshalSecurityGroupTargetReference(m map[string]json.RawMessage, result if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SetSubnetPublicGatewayOptions : The SetSubnetPublicGateway options. -type SetSubnetPublicGatewayOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // The public gateway identity. - PublicGatewayIdentity PublicGatewayIdentityIntf `json:"PublicGatewayIdentity" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string +// ShareReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type ShareReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` } -// NewSetSubnetPublicGatewayOptions : Instantiate SetSubnetPublicGatewayOptions -func (*VpcV1) NewSetSubnetPublicGatewayOptions(id string, publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { - return &SetSubnetPublicGatewayOptions{ - ID: core.StringPtr(id), - PublicGatewayIdentity: publicGatewayIdentity, +// UnmarshalShareReferenceDeleted unmarshals an instance of ShareReferenceDeleted from the specified map of raw messages. +func UnmarshalShareReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetID : Allow user to set ID -func (_options *SetSubnetPublicGatewayOptions) SetID(id string) *SetSubnetPublicGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} +// ShareReplicationStatusReason : ShareReplicationStatusReason struct +type ShareReplicationStatusReason struct { + // A snake case string succinctly identifying the status reason. + Code *string `json:"code" validate:"required"` -// SetPublicGatewayIdentity : Allow user to set PublicGatewayIdentity -func (_options *SetSubnetPublicGatewayOptions) SetPublicGatewayIdentity(publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { - _options.PublicGatewayIdentity = publicGatewayIdentity - return _options + // 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"` } -// SetHeaders : Allow user to set Headers -func (options *SetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *SetSubnetPublicGatewayOptions { - options.Headers = param - return options +// Constants associated with the ShareReplicationStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + ShareReplicationStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication" + ShareReplicationStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share" + ShareReplicationStatusReasonCodeCannotReachSourceShareConst = "cannot_reach_source_share" +) + +// UnmarshalShareReplicationStatusReason unmarshals an instance of ShareReplicationStatusReason from the specified map of raw messages. +func UnmarshalShareReplicationStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareReplicationStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } // Snapshot : Snapshot struct @@ -60637,7 +64604,7 @@ type Snapshot struct { // The name for this snapshot. The name is unique across all snapshots in the region. Name *string `json:"name" validate:"required"` - // The operating system included in this image. + // The operating system included in this snapshot. OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` // The resource group for this snapshot. @@ -62262,10 +66229,10 @@ type UpdateBareMetalServerNetworkInterfaceOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The network interface identifier. + // The bare metal server network interface identifier. ID *string `json:"id" validate:"required,ne="` - // The network interface patch. + // The bare metal server network interface patch. BareMetalServerNetworkInterfacePatch map[string]interface{} `json:"BareMetalServerNetworkInterface_patch" validate:"required"` // Allows users to set headers on API requests @@ -62587,7 +66554,7 @@ type UpdateIkePolicyOptions struct { ID *string `json:"id" validate:"required,ne="` // The IKE policy patch. - IkePolicyPatch map[string]interface{} `json:"IKEPolicy_patch" validate:"required"` + IkePolicyPatch map[string]interface{} `json:"IkePolicy_patch" validate:"required"` // Allows users to set headers on API requests Headers map[string]string @@ -63008,10 +66975,10 @@ type UpdateInstanceNetworkInterfaceOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // The network interface identifier. + // The instance network interface identifier. ID *string `json:"id" validate:"required,ne="` - // The network interface patch. + // The instance network interface patch. NetworkInterfacePatch map[string]interface{} `json:"NetworkInterface_patch" validate:"required"` // Allows users to set headers on API requests @@ -63827,6 +67794,102 @@ func (options *UpdateSecurityGroupRuleOptions) SetHeaders(param map[string]strin return options } +// UpdateShareMountTargetOptions : The UpdateShareMountTarget options. +type UpdateShareMountTargetOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share mount target identifier. + ID *string `json:"id" validate:"required,ne="` + + // The share mount target patch. + ShareMountTargetPatch map[string]interface{} `json:"ShareMountTarget_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateShareMountTargetOptions : Instantiate UpdateShareMountTargetOptions +func (*VpcV1) NewUpdateShareMountTargetOptions(shareID string, id string, shareMountTargetPatch map[string]interface{}) *UpdateShareMountTargetOptions { + return &UpdateShareMountTargetOptions{ + ShareID: core.StringPtr(shareID), + ID: core.StringPtr(id), + ShareMountTargetPatch: shareMountTargetPatch, + } +} + +// SetShareID : Allow user to set ShareID +func (_options *UpdateShareMountTargetOptions) SetShareID(shareID string) *UpdateShareMountTargetOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateShareMountTargetOptions) SetID(id string) *UpdateShareMountTargetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetShareMountTargetPatch : Allow user to set ShareMountTargetPatch +func (_options *UpdateShareMountTargetOptions) SetShareMountTargetPatch(shareMountTargetPatch map[string]interface{}) *UpdateShareMountTargetOptions { + _options.ShareMountTargetPatch = shareMountTargetPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateShareMountTargetOptions) SetHeaders(param map[string]string) *UpdateShareMountTargetOptions { + options.Headers = param + return options +} + +// UpdateShareOptions : The UpdateShare options. +type UpdateShareOptions struct { + // The file share identifier. + ID *string `json:"id" validate:"required,ne="` + + // The file share patch. + SharePatch map[string]interface{} `json:"Share_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 +} + +// NewUpdateShareOptions : Instantiate UpdateShareOptions +func (*VpcV1) NewUpdateShareOptions(id string, sharePatch map[string]interface{}) *UpdateShareOptions { + return &UpdateShareOptions{ + ID: core.StringPtr(id), + SharePatch: sharePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateShareOptions) SetID(id string) *UpdateShareOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSharePatch : Allow user to set SharePatch +func (_options *UpdateShareOptions) SetSharePatch(sharePatch map[string]interface{}) *UpdateShareOptions { + _options.SharePatch = sharePatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateShareOptions) SetIfMatch(ifMatch string) *UpdateShareOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateShareOptions) SetHeaders(param map[string]string) *UpdateShareOptions { + options.Headers = param + return options +} + // UpdateSnapshotOptions : The UpdateSnapshot options. type UpdateSnapshotOptions struct { // The snapshot identifier. @@ -63961,6 +68024,44 @@ func (options *UpdateSubnetReservedIPOptions) SetHeaders(param map[string]string return options } +// UpdateVirtualNetworkInterfaceOptions : The UpdateVirtualNetworkInterface options. +type UpdateVirtualNetworkInterfaceOptions struct { + // The virtual network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // The virtual network interface patch. + VirtualNetworkInterfacePatch map[string]interface{} `json:"VirtualNetworkInterface_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVirtualNetworkInterfaceOptions : Instantiate UpdateVirtualNetworkInterfaceOptions +func (*VpcV1) NewUpdateVirtualNetworkInterfaceOptions(id string, virtualNetworkInterfacePatch map[string]interface{}) *UpdateVirtualNetworkInterfaceOptions { + return &UpdateVirtualNetworkInterfaceOptions{ + ID: core.StringPtr(id), + VirtualNetworkInterfacePatch: virtualNetworkInterfacePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVirtualNetworkInterfaceOptions) SetID(id string) *UpdateVirtualNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVirtualNetworkInterfacePatch : Allow user to set VirtualNetworkInterfacePatch +func (_options *UpdateVirtualNetworkInterfaceOptions) SetVirtualNetworkInterfacePatch(virtualNetworkInterfacePatch map[string]interface{}) *UpdateVirtualNetworkInterfaceOptions { + _options.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateVirtualNetworkInterfaceOptions { + options.Headers = param + return options +} + // UpdateVolumeOptions : The UpdateVolume options. type UpdateVolumeOptions struct { // The volume identifier. @@ -65120,7 +69221,7 @@ type VPNGatewayConnection struct { // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address" validate:"required"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk" validate:"required"` // The resource type. @@ -65583,7 +69684,7 @@ type VPNGatewayConnectionPatch struct { // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address,omitempty"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk,omitempty"` // Routing protocols are disabled for this VPN gateway connection. @@ -65696,7 +69797,7 @@ type VPNGatewayConnectionPrototype struct { // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address" validate:"required"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk" validate:"required"` // Routing protocols are disabled for this VPN gateway connection. @@ -67069,6 +71170,501 @@ func (vpnServerRoutePatch *VPNServerRoutePatch) AsPatch() (_patch map[string]int return } +// VirtualNetworkInterface : VirtualNetworkInterface struct +type VirtualNetworkInterface struct { + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // The date and time that the virtual network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the virtual network interface. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The reserved IP for this virtual network interface. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource group for this virtual network interface. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups for this virtual network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The target of this virtual network interface. + // + // If absent, this virtual network interface is not attached to a target. + Target VirtualNetworkInterfaceTargetIntf `json:"target,omitempty"` + + // The VPC this virtual network interface resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this virtual network interface resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the VirtualNetworkInterface.LifecycleState property. +// The lifecycle state of the virtual network interface. +const ( + VirtualNetworkInterfaceLifecycleStateDeletingConst = "deleting" + VirtualNetworkInterfaceLifecycleStateFailedConst = "failed" + VirtualNetworkInterfaceLifecycleStatePendingConst = "pending" + VirtualNetworkInterfaceLifecycleStateStableConst = "stable" + VirtualNetworkInterfaceLifecycleStateSuspendedConst = "suspended" + VirtualNetworkInterfaceLifecycleStateUpdatingConst = "updating" + VirtualNetworkInterfaceLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VirtualNetworkInterface.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +// UnmarshalVirtualNetworkInterface unmarshals an instance of VirtualNetworkInterface from the specified map of raw messages. +func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterface) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalVirtualNetworkInterfaceTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceCollection : VirtualNetworkInterfaceCollection struct +type VirtualNetworkInterfaceCollection struct { + // A link to the first page of resources. + First *VirtualNetworkInterfaceCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of virtual network interfaces. + VirtualNetworkInterfaces []VirtualNetworkInterface `json:"virtual_network_interfaces" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVirtualNetworkInterfaceCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interfaces", &obj.VirtualNetworkInterfaces, UnmarshalVirtualNetworkInterface) + if err != nil { + 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 *VirtualNetworkInterfaceCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePatch : VirtualNetworkInterfacePatch struct +type VirtualNetworkInterfacePatch struct { + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVirtualNetworkInterfacePatch unmarshals an instance of VirtualNetworkInterfacePatch from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VirtualNetworkInterfacePrimaryIPPrototype : VirtualNetworkInterfacePrimaryIPPrototype struct +// Models which "extend" this model: +// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext +// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext +type VirtualNetworkInterfacePrimaryIPPrototype struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` + + // 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*VirtualNetworkInterfacePrimaryIPPrototype) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +type VirtualNetworkInterfacePrimaryIPPrototypeIntf interface { + isaVirtualNetworkInterfacePrimaryIPPrototype() bool +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototype unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototype from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceReferenceAttachmentContext : VirtualNetworkInterfaceReferenceAttachmentContext struct +type VirtualNetworkInterfaceReferenceAttachmentContext struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VirtualNetworkInterfaceReferenceAttachmentContextDeleted `json:"deleted,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VirtualNetworkInterfaceReferenceAttachmentContext.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceReferenceAttachmentContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +// UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext unmarshals an instance of VirtualNetworkInterfaceReferenceAttachmentContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceReferenceAttachmentContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceReferenceAttachmentContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VirtualNetworkInterfaceReferenceAttachmentContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceAttachmentContextDeleted from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceReferenceAttachmentContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VirtualNetworkInterfaceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVirtualNetworkInterfaceReferenceDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceDeleted from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceTarget : A virtual network interface target. +// +// The resource types that can be virtual network interface targets are expected to expand in the future. When iterating +// over virtual network interface targets, do not assume that every target resource will be from a known set of resource +// types. Optionally halt processing and surface an error, or bypass resources of unrecognized types. +// Models which "extend" this model: +// - VirtualNetworkInterfaceTargetShareMountTargetReference +type VirtualNetworkInterfaceTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this share mount target. + Href *string `json:"href,omitempty"` + + // The unique identifier for this share mount target. + ID *string `json:"id,omitempty"` + + // The name for this share mount target. The name is unique across all mount targets for the file share. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the VirtualNetworkInterfaceTarget.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceTargetResourceTypeShareMountTargetConst = "share_mount_target" +) + +func (*VirtualNetworkInterfaceTarget) isaVirtualNetworkInterfaceTarget() bool { + return true +} + +type VirtualNetworkInterfaceTargetIntf interface { + isaVirtualNetworkInterfaceTarget() bool +} + +// UnmarshalVirtualNetworkInterfaceTarget unmarshals an instance of VirtualNetworkInterfaceTarget from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // Volume : Volume struct type Volume struct { // Indicates whether a running virtual server instance has an attachment to this volume. @@ -67704,8 +72300,8 @@ type VolumeAttachmentPrototypeVolume struct { // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` - // The resource group to use for this volume. If unspecified, the instance's resource group - // will be used. + // The resource group to use for this volume. If unspecified, the instance's resource + // group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -68500,8 +73096,8 @@ type VolumePrototypeInstanceByImageContext struct { // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - // The resource group to use for this volume. If unspecified, the instance's resource group - // will be used. + // The resource group to use for this volume. If unspecified, the instance's resource + // group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -68577,8 +73173,8 @@ type VolumePrototypeInstanceBySourceSnapshotContext struct { // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - // The resource group to use for this volume. If unspecified, the instance's resource group - // will be used. + // The resource group to use for this volume. If unspecified, the instance's resource + // group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The snapshot from which to clone the volume. @@ -69158,11 +73754,10 @@ func UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializat // BareMetalServerNetworkInterfaceByHiperSocket : BareMetalServerNetworkInterfaceByHiperSocket struct // This model "extends" BareMetalServerNetworkInterface type BareMetalServerNetworkInterfaceByHiperSocket 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. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - // The date and time that the network interface was created. + // The date and time that the bare metal server network interface was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: @@ -69170,28 +73765,29 @@ type BareMetalServerNetworkInterfaceByHiperSocket struct { // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - 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`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - // The floating IPs associated with this network interface. + // The floating IPs associated with this bare metal server network interface. FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - // The URL for this network interface. + // The URL for this bare metal server network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this bare metal server network interface. ID *string `json:"id" validate:"required"` - // The MAC address of the interface. If absent, the value is not known. + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. MacAddress *string `json:"mac_address" validate:"required"` - // The name for this network interface. + // The name for this bare metal server network interface. Name *string `json:"name" validate:"required"` - // The network interface port speed in Mbps. + // The bare metal server network interface port speed in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -69199,16 +73795,16 @@ type BareMetalServerNetworkInterfaceByHiperSocket struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this network interface. + // The security groups targeting this bare metal server network interface. SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - // The status of the network interface. + // The status of the bare metal server network interface. Status *string `json:"status" validate:"required"` // The associated subnet. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The type of this bare metal server network interface. + // The bare metal server network interface type. Type *string `json:"type" validate:"required"` // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity @@ -69223,7 +73819,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.Status property. -// The status of the network interface. +// The status of the bare metal server network interface. const ( BareMetalServerNetworkInterfaceByHiperSocketStatusAvailableConst = "available" BareMetalServerNetworkInterfaceByHiperSocketStatusDeletingConst = "deleting" @@ -69232,7 +73828,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.Type property. -// The type of this bare metal server network interface. +// The bare metal server network interface type. const ( BareMetalServerNetworkInterfaceByHiperSocketTypePrimaryConst = "primary" BareMetalServerNetworkInterfaceByHiperSocketTypeSecondaryConst = "secondary" @@ -69323,11 +73919,10 @@ func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.Raw // BareMetalServerNetworkInterfaceByPci : BareMetalServerNetworkInterfaceByPci struct // This model "extends" BareMetalServerNetworkInterface type BareMetalServerNetworkInterfaceByPci 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. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - // The date and time that the network interface was created. + // The date and time that the bare metal server network interface was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: @@ -69335,28 +73930,29 @@ type BareMetalServerNetworkInterfaceByPci struct { // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - 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`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - // The floating IPs associated with this network interface. + // The floating IPs associated with this bare metal server network interface. FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - // The URL for this network interface. + // The URL for this bare metal server network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this bare metal server network interface. ID *string `json:"id" validate:"required"` - // The MAC address of the interface. If absent, the value is not known. + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. MacAddress *string `json:"mac_address" validate:"required"` - // The name for this network interface. + // The name for this bare metal server network interface. Name *string `json:"name" validate:"required"` - // The network interface port speed in Mbps. + // The bare metal server network interface port speed in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -69364,16 +73960,16 @@ type BareMetalServerNetworkInterfaceByPci struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this network interface. + // The security groups targeting this bare metal server network interface. SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - // The status of the network interface. + // The status of the bare metal server network interface. Status *string `json:"status" validate:"required"` // The associated subnet. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The type of this bare metal server network interface. + // The bare metal server network interface type. Type *string `json:"type" validate:"required"` // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. @@ -69394,7 +73990,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkInterfaceByPci.Status property. -// The status of the network interface. +// The status of the bare metal server network interface. const ( BareMetalServerNetworkInterfaceByPciStatusAvailableConst = "available" BareMetalServerNetworkInterfaceByPciStatusDeletingConst = "deleting" @@ -69403,7 +73999,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkInterfaceByPci.Type property. -// The type of this bare metal server network interface. +// The bare metal server network interface type. const ( BareMetalServerNetworkInterfaceByPciTypePrimaryConst = "primary" BareMetalServerNetworkInterfaceByPciTypeSecondaryConst = "secondary" @@ -69501,11 +74097,10 @@ func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, // BareMetalServerNetworkInterfaceByVlan : BareMetalServerNetworkInterfaceByVlan struct // This model "extends" BareMetalServerNetworkInterface type BareMetalServerNetworkInterfaceByVlan 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. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - // The date and time that the network interface was created. + // The date and time that the bare metal server network interface was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: @@ -69513,28 +74108,29 @@ type BareMetalServerNetworkInterfaceByVlan struct { // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - 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`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - // The floating IPs associated with this network interface. + // The floating IPs associated with this bare metal server network interface. FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - // The URL for this network interface. + // The URL for this bare metal server network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this bare metal server network interface. ID *string `json:"id" validate:"required"` - // The MAC address of the interface. If absent, the value is not known. + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. MacAddress *string `json:"mac_address" validate:"required"` - // The name for this network interface. + // The name for this bare metal server network interface. Name *string `json:"name" validate:"required"` - // The network interface port speed in Mbps. + // The bare metal server network interface port speed in Mbps. PortSpeed *int64 `json:"port_speed" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -69542,16 +74138,16 @@ type BareMetalServerNetworkInterfaceByVlan struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this network interface. + // The security groups targeting this bare metal server network interface. SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - // The status of the network interface. + // The status of the bare metal server network interface. Status *string `json:"status" validate:"required"` // The associated subnet. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The type of this bare metal server network interface. + // The bare metal server network interface type. Type *string `json:"type" validate:"required"` // Indicates if the interface can float to any other server within the same @@ -69577,7 +74173,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkInterfaceByVlan.Status property. -// The status of the network interface. +// The status of the bare metal server network interface. const ( BareMetalServerNetworkInterfaceByVlanStatusAvailableConst = "available" BareMetalServerNetworkInterfaceByVlanStatusDeletingConst = "deleting" @@ -69586,7 +74182,7 @@ const ( ) // Constants associated with the BareMetalServerNetworkInterfaceByVlan.Type property. -// The type of this bare metal server network interface. +// The bare metal server network interface type. const ( BareMetalServerNetworkInterfaceByVlanTypePrimaryConst = "primary" BareMetalServerNetworkInterfaceByVlanTypeSecondaryConst = "secondary" @@ -69688,8 +74284,7 @@ func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage // BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct // This model "extends" BareMetalServerNetworkInterfacePrototype type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype 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. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // If `true`: @@ -69697,24 +74292,26 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHi // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - 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`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The name for this 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. + // 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 network interface. This can be specified using an existing reserved IP, or a - // prototype object for a new reserved IP. + // 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 network - // interface's subnet. Otherwise, an available address on the subnet will be automatically selected and reserved. + // 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 network interface. If unspecified, the VPC's default security group is used. + // 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. @@ -69786,8 +74383,7 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte // BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct // This model "extends" BareMetalServerNetworkInterfacePrototype type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype 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. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // If `true`: @@ -69795,24 +74391,26 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - 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`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The name for this 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. + // 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 network interface. This can be specified using an existing reserved IP, or a - // prototype object for a new reserved IP. + // 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 network - // interface's subnet. Otherwise, an available address on the subnet will be automatically selected and reserved. + // 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 network interface. If unspecified, the VPC's default security group is used. + // 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. @@ -69897,8 +74495,7 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte // BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct // This model "extends" BareMetalServerNetworkInterfacePrototype type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype 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. + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // If `true`: @@ -69906,24 +74503,26 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // - `floating_ips` must not have more than one floating IP. // // If `false`: - // - Packets are passed unchanged to/from the network interface, + // - 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`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The name for this 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. + // 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 network interface. This can be specified using an existing reserved IP, or a - // prototype object for a new reserved IP. + // 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 network - // interface's subnet. Otherwise, an available address on the subnet will be automatically selected and reserved. + // 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 network interface. If unspecified, the VPC's default security group is used. + // 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. @@ -70015,8 +74614,8 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte return } -// BareMetalServerProfileBandwidthDependent : The total bandwidth shared across the network interfaces of a bare metal server with this profile depends on its -// configuration. +// BareMetalServerProfileBandwidthDependent : The total bandwidth shared across the bare metal server network interfaces of a bare metal server with this profile +// depends on its configuration. // This model "extends" BareMetalServerProfileBandwidth type BareMetalServerProfileBandwidthDependent struct { // The type for this profile field. @@ -70044,8 +74643,8 @@ func UnmarshalBareMetalServerProfileBandwidthDependent(m map[string]json.RawMess return } -// BareMetalServerProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network interfaces of a bare metal -// server with this profile. +// BareMetalServerProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the bare metal server network interfaces +// of a bare metal server with this profile. // This model "extends" BareMetalServerProfileBandwidth type BareMetalServerProfileBandwidthEnum struct { // The default value for this profile field. @@ -70087,8 +74686,8 @@ func UnmarshalBareMetalServerProfileBandwidthEnum(m map[string]json.RawMessage, return } -// BareMetalServerProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network interfaces of a bare metal server with this -// profile. +// BareMetalServerProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the bare metal server network interfaces of a bare metal +// server with this profile. // This model "extends" BareMetalServerProfileBandwidth type BareMetalServerProfileBandwidthFixed struct { // The type for this profile field. @@ -70123,8 +74722,8 @@ func UnmarshalBareMetalServerProfileBandwidthFixed(m map[string]json.RawMessage, return } -// BareMetalServerProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network interfaces of a bare metal -// server with this profile. +// BareMetalServerProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the bare metal server network interfaces +// of a bare metal server with this profile. // This model "extends" BareMetalServerProfileBandwidth type BareMetalServerProfileBandwidthRange struct { // The default value for this profile field. @@ -71050,8 +75649,8 @@ func UnmarshalBareMetalServerProfileMemoryRange(m map[string]json.RawMessage, re return } -// BareMetalServerProfileNetworkInterfaceCountDependent : The number of network interfaces supported on a bare metal server with this profile is dependent on its -// configuration. +// BareMetalServerProfileNetworkInterfaceCountDependent : The number of bare metal server network interfaces supported on a bare metal server with this profile is dependent on +// its configuration. // This model "extends" BareMetalServerProfileNetworkInterfaceCount type BareMetalServerProfileNetworkInterfaceCountDependent struct { // The type for this profile field. @@ -71079,7 +75678,7 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCountDependent(m map[string] return } -// BareMetalServerProfileNetworkInterfaceCountRange : The number of network interfaces supported on a bare metal server with this profile. +// BareMetalServerProfileNetworkInterfaceCountRange : The number of bare metal server network interfaces supported on a bare metal server with this profile. // This model "extends" BareMetalServerProfileNetworkInterfaceCount type BareMetalServerProfileNetworkInterfaceCountRange struct { // The maximum value for this profile field. @@ -72138,8 +76737,8 @@ func UnmarshalEncryptionKeyIdentityByCRN(m map[string]json.RawMessage, result in // EndpointGatewayReservedIPReservedIPIdentity : Identifies a reserved IP by a unique property. // Models which "extend" this model: -// - EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID -// - EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref +// - EndpointGatewayReservedIPReservedIPIdentityByID +// - EndpointGatewayReservedIPReservedIPIdentityByHref // This model "extends" EndpointGatewayReservedIP type EndpointGatewayReservedIPReservedIPIdentity struct { // The unique identifier for this reserved IP. @@ -72496,16 +77095,57 @@ func UnmarshalFloatingIPPrototypeFloatingIPByZone(m map[string]json.RawMessage, return } -// FloatingIPTargetPatchNetworkInterfaceIdentity : Identifies a network interface by a unique property. +// FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity : Identifies a bare metal server network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID +// - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref +// This model "extends" FloatingIPTargetPatch +type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity struct { + // The unique identifier for this bare metal server network interface. + ID *string `json:"id,omitempty"` + + // The URL for this bare metal server network interface. + Href *string `json:"href,omitempty"` +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPatchIntf + isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. // Models which "extend" this model: // - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID // - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref // This model "extends" FloatingIPTargetPatch type FloatingIPTargetPatchNetworkInterfaceIdentity struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` } @@ -72537,16 +77177,57 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity(m map[string]json.Ra return } -// FloatingIPTargetPrototypeNetworkInterfaceIdentity : Identifies a network interface by a unique property. +// FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity : Identifies a bare metal server network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID +// - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref +// This model "extends" FloatingIPTargetPrototype +type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity struct { + // The unique identifier for this bare metal server network interface. + ID *string `json:"id,omitempty"` + + // The URL for this bare metal server network interface. + Href *string `json:"href,omitempty"` +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPrototypeIntf + isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. // Models which "extend" this model: // - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID // - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref // This model "extends" FloatingIPTargetPrototype type FloatingIPTargetPrototypeNetworkInterfaceIdentity struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` } @@ -72578,6 +77259,69 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity(m map[string]jso return } +// FloatingIPTargetBareMetalServerNetworkInterfaceReference : FloatingIPTargetBareMetalServerNetworkInterfaceReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetBareMetalServerNetworkInterfaceReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this bare metal server network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server network interface. + ID *string `json:"id" validate:"required"` + + // The name for this bare metal server network interface. + Name *string `json:"name" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FloatingIPTargetBareMetalServerNetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetBareMetalServerNetworkInterfaceReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FloatingIPTargetBareMetalServerNetworkInterfaceReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference unmarshals an instance of FloatingIPTargetBareMetalServerNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetBareMetalServerNetworkInterfaceReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPTargetNetworkInterfaceReference : FloatingIPTargetNetworkInterfaceReference struct // This model "extends" FloatingIPTarget type FloatingIPTargetNetworkInterfaceReference struct { @@ -72585,13 +77329,13 @@ type FloatingIPTargetNetworkInterfaceReference struct { // some supplementary information. Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` - // The name for this network interface. + // The name for this instance network interface. Name *string `json:"name" validate:"required"` PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` @@ -72754,16 +77498,16 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity(m map[string]json. return } -// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity : Identifies a network interface by a unique property. +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. // Models which "extend" this model: // - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID // - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref // This model "extends" FlowLogCollectorTargetPrototype type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href,omitempty"` } @@ -72951,13 +77695,13 @@ type FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct { // some supplementary information. Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` - // The name for this network interface. + // The name for this instance network interface. Name *string `json:"name" validate:"required"` // The resource type. @@ -76304,16 +81048,18 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -76334,8 +81080,9 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -76352,8 +81099,9 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -76369,10 +81117,10 @@ type InstancePrototypeInstanceByCatalogOffering struct { // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. @@ -76445,11 +81193,340 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByImage : Create an instance by using an image. +// This model "extends" InstancePrototype +type InstancePrototypeInstanceByImage struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewInstancePrototypeInstanceByImage : Instantiate InstancePrototypeInstanceByImage (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByImage, err error) { + _model = &InstancePrototypeInstanceByImage{ + Image: image, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByImage) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByImage unmarshals an instance of InstancePrototypeInstanceByImage from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByImage) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceSnapshot : Create an instance by using a snapshot. +// This model "extends" InstancePrototype +type InstancePrototypeInstanceBySourceSnapshot struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewInstancePrototypeInstanceBySourceSnapshot : Instantiate InstancePrototypeInstanceBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceBySourceSnapshot, err error) { + _model = &InstancePrototypeInstanceBySourceSnapshot{ + BootVolumeAttachment: bootVolumeAttachment, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceSnapshot unmarshals an instance of InstancePrototypeInstanceBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceSnapshot) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { return } @@ -76469,22 +81546,27 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe return } -// InstancePrototypeInstanceByImage : Create an instance by using an image. +// InstancePrototypeInstanceBySourceTemplate : Create an instance by using an instance template. +// +// The `primary_network_interface` and `network_interfaces` properties may only be specified if +// `primary_network_interface` is specified in the source template. // This model "extends" InstancePrototype -type InstancePrototypeInstanceByImage struct { +type InstancePrototypeInstanceBySourceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -76505,8 +81587,9 @@ type InstancePrototypeInstanceByImage struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -76523,44 +81606,57 @@ type InstancePrototypeInstanceByImage struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering version to use when provisioning this virtual server instance. + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account, subject to + // IAM policies. + // + // If specified, `image` must not be specified, and `source_template` must not have + // `image` specified. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` + // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` + Image ImageIdentityIntf `json:"image,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` + Zone ZoneIdentityIntf `json:"zone,omitempty"` } -// NewInstancePrototypeInstanceByImage : Instantiate InstancePrototypeInstanceByImage (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByImage, err error) { - _model = &InstancePrototypeInstanceByImage{ - Image: image, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, +// NewInstancePrototypeInstanceBySourceTemplate : Instantiate InstancePrototypeInstanceBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstancePrototypeInstanceBySourceTemplate, err error) { + _model = &InstancePrototypeInstanceBySourceTemplate{ + SourceTemplate: sourceTemplate, } err = core.ValidateStruct(_model, "required parameters") return } -func (*InstancePrototypeInstanceByImage) isaInstancePrototype() bool { +func (*InstancePrototypeInstanceBySourceTemplate) isaInstancePrototype() bool { return true } -// UnmarshalInstancePrototypeInstanceByImage unmarshals an instance of InstancePrototypeInstanceByImage from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByImage) +// UnmarshalInstancePrototypeInstanceBySourceTemplate unmarshals an instance of InstancePrototypeInstanceBySourceTemplate from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceTemplate) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -76613,6 +81709,10 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res if err != nil { return } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { return @@ -76625,6 +81725,10 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res if err != nil { return } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -76633,22 +81737,24 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res return } -// InstancePrototypeInstanceBySourceSnapshot : Create an instance by using a snapshot. +// InstancePrototypeInstanceByVolume : Create an instance by using a boot volume. // This model "extends" InstancePrototype -type InstancePrototypeInstanceBySourceSnapshot struct { +type InstancePrototypeInstanceByVolume struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -76669,8 +81775,9 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -76687,26 +81794,27 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// NewInstancePrototypeInstanceBySourceSnapshot : Instantiate InstancePrototypeInstanceBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceBySourceSnapshot, err error) { - _model = &InstancePrototypeInstanceBySourceSnapshot{ +// NewInstancePrototypeInstanceByVolume : Instantiate InstancePrototypeInstanceByVolume (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByVolume(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByVolume, err error) { + _model = &InstancePrototypeInstanceByVolume{ BootVolumeAttachment: bootVolumeAttachment, PrimaryNetworkInterface: primaryNetworkInterface, Zone: zone, @@ -76715,13 +81823,13 @@ func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshot(bootVolumeAttachment return } -func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototype() bool { +func (*InstancePrototypeInstanceByVolume) isaInstancePrototype() bool { return true } -// UnmarshalInstancePrototypeInstanceBySourceSnapshot unmarshals an instance of InstancePrototypeInstanceBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceBySourceSnapshot) +// UnmarshalInstancePrototypeInstanceByVolume unmarshals an instance of InstancePrototypeInstanceByVolume from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByVolume) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -76770,7 +81878,7 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) if err != nil { return } @@ -76790,25 +81898,117 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes return } -// InstancePrototypeInstanceBySourceTemplate : Create an instance by using an instance template. -// -// The `primary_network_interface` and `network_interfaces` properties may only be specified if -// `primary_network_interface` is specified in the source template. -// This model "extends" InstancePrototype -type InstancePrototypeInstanceBySourceTemplate struct { +// InstanceTemplateIdentityByCRN : InstanceTemplateIdentityByCRN struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByCRN struct { + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstanceTemplateIdentityByCRN : Instantiate InstanceTemplateIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByCRN(crn string) (_model *InstanceTemplateIdentityByCRN, err error) { + _model = &InstanceTemplateIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByCRN) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByCRN unmarshals an instance of InstanceTemplateIdentityByCRN from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByHref : InstanceTemplateIdentityByHref struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByHref struct { + // The URL for this instance template. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceTemplateIdentityByHref : Instantiate InstanceTemplateIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByHref(href string) (_model *InstanceTemplateIdentityByHref, err error) { + _model = &InstanceTemplateIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByHref) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByHref unmarshals an instance of InstanceTemplateIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByID : InstanceTemplateIdentityByID struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByID struct { + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceTemplateIdentityByID : Instantiate InstanceTemplateIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByID(id string) (_model *InstanceTemplateIdentityByID, err error) { + _model = &InstanceTemplateIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByID) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByID unmarshals an instance of InstanceTemplateIdentityByID from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Create an instance template that creates instances by using a catalog offering. +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -76820,17 +82020,16 @@ type InstancePrototypeInstanceBySourceTemplate struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this virtual server instance. The name must not be used by another virtual server instance 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. + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -76847,56 +82046,52 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering version to use when provisioning this virtual server instance. - // If an offering is specified, the latest version of that offering will be used. + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. // - // The specified offering or offering version may be in a different account, subject to - // IAM policies. + // If an offering is specified, the latest version of that offering will be used. // - // If specified, `image` must not be specified, and `source_template` must not have - // `image` specified. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image,omitempty"` + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The template to create this virtual server instance from. - SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` + Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// NewInstancePrototypeInstanceBySourceTemplate : Instantiate InstancePrototypeInstanceBySourceTemplate (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstancePrototypeInstanceBySourceTemplate, err error) { - _model = &InstancePrototypeInstanceBySourceTemplate{ - SourceTemplate: sourceTemplate, +// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOffering (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOffering, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOffering{ + CatalogOffering: catalogOffering, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, } err = core.ValidateStruct(_model, "required parameters") return } -func (*InstancePrototypeInstanceBySourceTemplate) isaInstancePrototype() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstancePrototypeInstanceBySourceTemplate unmarshals an instance of InstancePrototypeInstanceBySourceTemplate from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceBySourceTemplate) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOffering from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -76953,10 +82148,6 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - return - } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -76965,10 +82156,6 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - return - } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -76977,22 +82164,24 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes return } -// InstancePrototypeInstanceByVolume : Create an instance by using a boot volume. -// This model "extends" InstancePrototype -type InstancePrototypeInstanceByVolume struct { +// InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image. +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -77004,17 +82193,16 @@ type InstancePrototypeInstanceByVolume struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this virtual server instance. The name must not be used by another virtual server instance 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. + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -77031,27 +82219,31 @@ type InstancePrototypeInstanceByVolume struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The boot volume attachment for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// NewInstancePrototypeInstanceByVolume : Instantiate InstancePrototypeInstanceByVolume (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByVolume(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByVolume, err error) { - _model = &InstancePrototypeInstanceByVolume{ - BootVolumeAttachment: bootVolumeAttachment, +// NewInstanceTemplatePrototypeInstanceTemplateByImage : Instantiate InstanceTemplatePrototypeInstanceTemplateByImage (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateByImage, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByImage{ + Image: image, PrimaryNetworkInterface: primaryNetworkInterface, Zone: zone, } @@ -77059,13 +82251,13 @@ func (*VpcV1) NewInstancePrototypeInstanceByVolume(bootVolumeAttachment *VolumeA return } -func (*InstancePrototypeInstanceByVolume) isaInstancePrototype() bool { +func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstancePrototypeInstanceByVolume unmarshals an instance of InstancePrototypeInstanceByVolume from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByVolume) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImage from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImage) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -77114,112 +82306,23 @@ func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, re if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateIdentityByCRN : InstanceTemplateIdentityByCRN struct -// This model "extends" InstanceTemplateIdentity -type InstanceTemplateIdentityByCRN struct { - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstanceTemplateIdentityByCRN : Instantiate InstanceTemplateIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplateIdentityByCRN(crn string) (_model *InstanceTemplateIdentityByCRN, err error) { - _model = &InstanceTemplateIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplateIdentityByCRN) isaInstanceTemplateIdentity() bool { - return true -} - -// UnmarshalInstanceTemplateIdentityByCRN unmarshals an instance of InstanceTemplateIdentityByCRN from the specified map of raw messages. -func UnmarshalInstanceTemplateIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateIdentityByHref : InstanceTemplateIdentityByHref struct -// This model "extends" InstanceTemplateIdentity -type InstanceTemplateIdentityByHref struct { - // The URL for this instance template. - Href *string `json:"href" validate:"required"` -} - -// NewInstanceTemplateIdentityByHref : Instantiate InstanceTemplateIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplateIdentityByHref(href string) (_model *InstanceTemplateIdentityByHref, err error) { - _model = &InstanceTemplateIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplateIdentityByHref) isaInstanceTemplateIdentity() bool { - return true -} - -// UnmarshalInstanceTemplateIdentityByHref unmarshals an instance of InstanceTemplateIdentityByHref from the specified map of raw messages. -func UnmarshalInstanceTemplateIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateIdentityByID : InstanceTemplateIdentityByID struct -// This model "extends" InstanceTemplateIdentity -type InstanceTemplateIdentityByID struct { - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` -} - -// NewInstanceTemplateIdentityByID : Instantiate InstanceTemplateIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplateIdentityByID(id string) (_model *InstanceTemplateIdentityByID, err error) { - _model = &InstanceTemplateIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplateIdentityByID) isaInstanceTemplateIdentity() bool { - return true -} - -// UnmarshalInstanceTemplateIdentityByID unmarshals an instance of InstanceTemplateIdentityByID from the specified map of raw messages. -func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } @@ -77227,22 +82330,24 @@ func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result return } -// InstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Create an instance template that creates instances by using a catalog offering. +// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Create an instance template that creates instances by using a snapshot. // This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -77261,8 +82366,9 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -77279,37 +82385,28 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOffering (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOffering, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOffering{ - CatalogOffering: catalogOffering, +// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot{ + BootVolumeAttachment: bootVolumeAttachment, PrimaryNetworkInterface: primaryNetworkInterface, Zone: zone, } @@ -77317,13 +82414,13 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(cata return } -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOffering from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -77372,11 +82469,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { return } @@ -77396,22 +82489,24 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s return } -// InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image. +// InstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Create an instance template from an existing instance template. // This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateByImage struct { +type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -77430,8 +82525,9 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -77448,44 +82544,57 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering version to use when provisioning this virtual server instance. + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account, subject to + // IAM policies. + // + // If specified, `image` must not be specified, and `source_template` must not have + // `image` specified. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` + // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` + Image ImageIdentityIntf `json:"image,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` + Zone ZoneIdentityIntf `json:"zone,omitempty"` } -// NewInstanceTemplatePrototypeInstanceTemplateByImage : Instantiate InstanceTemplatePrototypeInstanceTemplateByImage (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateByImage, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByImage{ - Image: image, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, +// NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceTemplate, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceTemplate{ + SourceTemplate: sourceTemplate, } err = core.ValidateStruct(_model, "required parameters") return } -func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) isaInstanceTemplatePrototype() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImage from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateByImage) +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceTemplate from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -77538,6 +82647,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json if err != nil { return } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { return @@ -77550,6 +82663,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json if err != nil { return } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -77558,22 +82675,36 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json return } -// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Create an instance template that creates instances by using a snapshot. -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { +// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext : Create an instance by using a catalog offering. +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -77585,18 +82716,19 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -77610,49 +82742,65 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - // The additional network interfaces to create for the virtual server instance. + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot{ - BootVolumeAttachment: bootVolumeAttachment, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -77673,7 +82821,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -77693,7 +82841,11 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { return } @@ -77713,22 +82865,36 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st return } -// InstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Create an instance template from an existing instance template. -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { +// InstanceTemplateInstanceByImageInstanceTemplateContext : Create an instance by using an image. +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -77740,18 +82906,19 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to @@ -77765,64 +82932,58 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering version to use when provisioning this virtual server instance. - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account, subject to - // IAM policies. - // - // If specified, `image` must not be specified, and `source_template` must not have - // `image` specified. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image,omitempty"` + Image ImageIdentityIntf `json:"image" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - // The template to create this virtual server instance from. - SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceTemplate (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceTemplate, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceTemplate{ - SourceTemplate: sourceTemplate, - } - err = core.ValidateStruct(_model, "required parameters") - return + Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -func (*InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) isaInstanceTemplatePrototype() bool { +func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceTemplate from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) +// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return @@ -77843,7 +83004,7 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -77867,10 +83028,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { return @@ -77883,10 +83040,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - return - } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -77895,9 +83048,9 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st return } -// InstanceTemplateInstanceByCatalogOffering : Create an instance by using a catalog offering. +// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext : Create an instance by using a snapshot. // This model "extends" InstanceTemplate -type InstanceTemplateInstanceByCatalogOffering struct { +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -77907,9 +83060,11 @@ type InstanceTemplateInstanceByCatalogOffering struct { // The CRN for this instance template. CRN *string `json:"crn" validate:"required"` - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` // The URL for this instance template. @@ -77922,7 +83077,7 @@ type InstanceTemplateInstanceByCatalogOffering struct { // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator + // For Windows images, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. @@ -77940,8 +83095,9 @@ type InstanceTemplateInstanceByCatalogOffering struct { // The placement restrictions to use for the virtual server instance. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group for this instance template. @@ -77959,40 +83115,31 @@ type InstanceTemplateInstanceByCatalogOffering struct { // The additional volume attachments to create for the virtual server instance. VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - // The additional network interfaces to create for the virtual server instance. + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary network interface to create for the virtual server instance. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -func (*InstanceTemplateInstanceByCatalogOffering) isaInstanceTemplate() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceTemplateInstanceByCatalogOffering unmarshals an instance of InstanceTemplateInstanceByCatalogOffering from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOffering) +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return @@ -78057,11 +83204,7 @@ func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { return } @@ -78081,178 +83224,606 @@ func UnmarshalInstanceTemplateInstanceByCatalogOffering(m map[string]json.RawMes return } -// InstanceTemplateInstanceByImage : Create an instance by using an image. -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceByImage struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` +// KeyIdentityByCRN : KeyIdentityByCRN struct +// This model "extends" KeyIdentity +type KeyIdentityByCRN struct { + // The CRN for this key. + CRN *string `json:"crn" validate:"required"` +} - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` +// NewKeyIdentityByCRN : Instantiate KeyIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByCRN(crn string) (_model *KeyIdentityByCRN, err error) { + _model = &KeyIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` +func (*KeyIdentityByCRN) isaKeyIdentity() bool { + return true +} - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` +// UnmarshalKeyIdentityByCRN unmarshals an instance of KeyIdentityByCRN from the specified map of raw messages. +func UnmarshalKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The URL for this instance template. +// KeyIdentityByFingerprint : KeyIdentityByFingerprint struct +// This model "extends" KeyIdentity +type KeyIdentityByFingerprint struct { + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint" validate:"required"` +} + +// NewKeyIdentityByFingerprint : Instantiate KeyIdentityByFingerprint (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByFingerprint(fingerprint string) (_model *KeyIdentityByFingerprint, err error) { + _model = &KeyIdentityByFingerprint{ + Fingerprint: core.StringPtr(fingerprint), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*KeyIdentityByFingerprint) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByFingerprint unmarshals an instance of KeyIdentityByFingerprint from the specified map of raw messages. +func UnmarshalKeyIdentityByFingerprint(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByFingerprint) + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByHref : KeyIdentityByHref struct +// This model "extends" KeyIdentity +type KeyIdentityByHref struct { + // The URL for this key. Href *string `json:"href" validate:"required"` +} - // The unique identifier for this instance template. +// NewKeyIdentityByHref : Instantiate KeyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByHref(href string) (_model *KeyIdentityByHref, err error) { + _model = &KeyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*KeyIdentityByHref) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByHref unmarshals an instance of KeyIdentityByHref from the specified map of raw messages. +func UnmarshalKeyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByID : KeyIdentityByID struct +// This model "extends" KeyIdentity +type KeyIdentityByID struct { + // The unique identifier for this key. ID *string `json:"id" validate:"required"` +} - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` +// NewKeyIdentityByID : Instantiate KeyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByID(id string) (_model *KeyIdentityByID, err error) { + _model = &KeyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` +func (*KeyIdentityByID) isaKeyIdentity() bool { + return true +} - // The name for this instance template. The name is unique across all instance templates in the region. +// UnmarshalKeyIdentityByID unmarshals an instance of KeyIdentityByID from the specified map of raw messages. +func UnmarshalKeyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct +// This model "extends" LegacyCloudObjectStorageBucketIdentity +type LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct { + // The globally unique name of this Cloud Object Storage bucket. Name *string `json:"name" validate:"required"` +} - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` +// NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : Instantiate LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName (Generic Model Constructor) +func (*VpcV1) NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(name string) (_model *LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName, err error) { + _model = &LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` +func (*LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) isaLegacyCloudObjectStorageBucketIdentity() bool { + return true +} - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` +// UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName unmarshals an instance of LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName from the specified map of raw messages. +func UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` +// LoadBalancerIdentityByCRN : LoadBalancerIdentityByCRN struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByCRN struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` +} - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` +// NewLoadBalancerIdentityByCRN : Instantiate LoadBalancerIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByCRN(crn string) (_model *LoadBalancerIdentityByCRN, err error) { + _model = &LoadBalancerIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` +func (*LoadBalancerIdentityByCRN) isaLoadBalancerIdentity() bool { + return true +} - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` +// UnmarshalLoadBalancerIdentityByCRN unmarshals an instance of LoadBalancerIdentityByCRN from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` +// LoadBalancerIdentityByHref : LoadBalancerIdentityByHref struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByHref struct { + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` +} - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` +// NewLoadBalancerIdentityByHref : Instantiate LoadBalancerIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByHref(href string) (_model *LoadBalancerIdentityByHref, err error) { + _model = &LoadBalancerIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerIdentityByHref) isaLoadBalancerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerIdentityByHref unmarshals an instance of LoadBalancerIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentityByID : LoadBalancerIdentityByID struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByID struct { + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerIdentityByID : Instantiate LoadBalancerIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByID(id string) (_model *LoadBalancerIdentityByID, err error) { + _model = &LoadBalancerIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerIdentityByID) isaLoadBalancerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerIdentityByID unmarshals an instance of LoadBalancerIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerIdentityByHref : LoadBalancerListenerIdentityByHref struct +// This model "extends" LoadBalancerListenerIdentity +type LoadBalancerListenerIdentityByHref struct { + // The listener's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerIdentityByHref : Instantiate LoadBalancerListenerIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerIdentityByHref(href string) (_model *LoadBalancerListenerIdentityByHref, err error) { + _model = &LoadBalancerListenerIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerIdentityByHref) isaLoadBalancerListenerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerListenerIdentityByHref unmarshals an instance of LoadBalancerListenerIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerIdentityByID : LoadBalancerListenerIdentityByID struct +// This model "extends" LoadBalancerListenerIdentity +type LoadBalancerListenerIdentityByID struct { + // The unique identifier for this load balancer listener. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerIdentityByID : Instantiate LoadBalancerListenerIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerIdentityByID(id string) (_model *LoadBalancerListenerIdentityByID, err error) { + _model = &LoadBalancerListenerIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerIdentityByID) isaLoadBalancerListenerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerListenerIdentityByID unmarshals an instance of LoadBalancerListenerIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} - // The primary network interface to create for the virtual server instance. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { + return true +} - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityIntf interface { + LoadBalancerListenerPolicyTargetPatchIntf + isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool } -func (*InstanceTemplateInstanceByImage) isaInstanceTemplate() bool { +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatch() bool { return true } -// UnmarshalInstanceTemplateInstanceByImage unmarshals an instance of InstanceTemplateInstanceByImage from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImage) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener" validate:"required"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype{ + HTTPStatusCode: core.Int64Ptr(httpStatusCode), + Listener: listener, } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { return } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // The redirect target URL. + URL *string `json:"url" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(httpStatusCode int64, url string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype{ + HTTPStatusCode: core.Int64Ptr(httpStatusCode), + URL: core.StringPtr(url), } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { return } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityIntf interface { + LoadBalancerListenerPolicyTargetPrototypeIntf + isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect : LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + Listener *LoadBalancerListenerReference `json:"listener" validate:"required"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { return } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL : LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // The redirect target URL. + URL *string `json:"url" validate:"required"` +} + +func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { return } @@ -78260,107 +83831,31 @@ func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, resu return } -// InstanceTemplateInstanceBySourceSnapshot : Create an instance by using a snapshot. -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceBySourceSnapshot struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance This property's value is used - // when provisioning the virtual server instance, but not subsequently managed. Accordingly, it is reflected as an - // [instance initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` +// LoadBalancerListenerPolicyTargetLoadBalancerPoolReference : LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` - // The URL for this instance template. + // The pool's canonical URL. Href *string `json:"href" validate:"required"` - // The unique identifier for this instance template. + // The unique identifier for this load balancer pool. ID *string `json:"id" validate:"required"` - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be chosen to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. + // The name for this load balancer pool. The name is unique across all pools for the load balancer. Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. If - // unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. If specified, it must match the VPC for the subnets of the - // instance's network interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The additional network interfaces to create for the virtual server instance. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary network interface to create for the virtual server instance. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` } -func (*InstanceTemplateInstanceBySourceSnapshot) isaInstanceTemplate() bool { +func (*LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) isaLoadBalancerListenerPolicyTarget() bool { return true } -// UnmarshalInstanceTemplateInstanceBySourceSnapshot unmarshals an instance of InstanceTemplateInstanceBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshot) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerPoolReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) if err != nil { return } @@ -78372,59 +83867,230 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMess if err != nil { return } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerPoolIdentity +type LoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolIdentityByHref) isaLoadBalancerPoolIdentity() bool { + return true +} + +// UnmarshalLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentityByID : LoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerPoolIdentity +type LoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerPoolIdentityByID : Instantiate LoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolIdentityByID) isaLoadBalancerPoolIdentity() bool { + return true +} + +// UnmarshalLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeIP : LoadBalancerPoolMemberTargetPrototypeIP struct +// This model "extends" LoadBalancerPoolMemberTargetPrototype +type LoadBalancerPoolMemberTargetPrototypeIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeIP : Instantiate LoadBalancerPoolMemberTargetPrototypeIP (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeIP(address string) (_model *LoadBalancerPoolMemberTargetPrototypeIP, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeIP) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeIP unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeIP from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref +// This model "extends" LoadBalancerPoolMemberTargetPrototype +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentity struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityIntf interface { + LoadBalancerPoolMemberTargetPrototypeIntf + isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetIP : LoadBalancerPoolMemberTargetIP struct +// This model "extends" LoadBalancerPoolMemberTarget +type LoadBalancerPoolMemberTargetIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*LoadBalancerPoolMemberTargetIP) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetIP unmarshals an instance of LoadBalancerPoolMemberTargetIP from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetInstanceReference : LoadBalancerPoolMemberTargetInstanceReference struct +// This model "extends" LoadBalancerPoolMemberTarget +type LoadBalancerPoolMemberTargetInstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. + Name *string `json:"name" validate:"required"` +} + +func (*LoadBalancerPoolMemberTargetInstanceReference) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetInstanceReference unmarshals an instance of LoadBalancerPoolMemberTargetInstanceReference from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -78432,30 +84098,30 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshot(m map[string]json.RawMess return } -// KeyIdentityByCRN : KeyIdentityByCRN struct -// This model "extends" KeyIdentity -type KeyIdentityByCRN struct { - // The CRN for this key. - CRN *string `json:"crn" validate:"required"` +// LoadBalancerProfileIdentityByHref : LoadBalancerProfileIdentityByHref struct +// This model "extends" LoadBalancerProfileIdentity +type LoadBalancerProfileIdentityByHref struct { + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` } -// NewKeyIdentityByCRN : Instantiate KeyIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewKeyIdentityByCRN(crn string) (_model *KeyIdentityByCRN, err error) { - _model = &KeyIdentityByCRN{ - CRN: core.StringPtr(crn), +// NewLoadBalancerProfileIdentityByHref : Instantiate LoadBalancerProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerProfileIdentityByHref(href string) (_model *LoadBalancerProfileIdentityByHref, err error) { + _model = &LoadBalancerProfileIdentityByHref{ + Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*KeyIdentityByCRN) isaKeyIdentity() bool { +func (*LoadBalancerProfileIdentityByHref) isaLoadBalancerProfileIdentity() bool { return true } -// UnmarshalKeyIdentityByCRN unmarshals an instance of KeyIdentityByCRN from the specified map of raw messages. -func UnmarshalKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalLoadBalancerProfileIdentityByHref unmarshals an instance of LoadBalancerProfileIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -78463,31 +84129,30 @@ func UnmarshalKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) return } -// KeyIdentityByFingerprint : KeyIdentityByFingerprint struct -// This model "extends" KeyIdentity -type KeyIdentityByFingerprint struct { - // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always - // `SHA256`). - Fingerprint *string `json:"fingerprint" validate:"required"` +// LoadBalancerProfileIdentityByName : LoadBalancerProfileIdentityByName struct +// This model "extends" LoadBalancerProfileIdentity +type LoadBalancerProfileIdentityByName struct { + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` } -// NewKeyIdentityByFingerprint : Instantiate KeyIdentityByFingerprint (Generic Model Constructor) -func (*VpcV1) NewKeyIdentityByFingerprint(fingerprint string) (_model *KeyIdentityByFingerprint, err error) { - _model = &KeyIdentityByFingerprint{ - Fingerprint: core.StringPtr(fingerprint), +// NewLoadBalancerProfileIdentityByName : Instantiate LoadBalancerProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerProfileIdentityByName(name string) (_model *LoadBalancerProfileIdentityByName, err error) { + _model = &LoadBalancerProfileIdentityByName{ + Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") return } -func (*KeyIdentityByFingerprint) isaKeyIdentity() bool { +func (*LoadBalancerProfileIdentityByName) isaLoadBalancerProfileIdentity() bool { return true } -// UnmarshalKeyIdentityByFingerprint unmarshals an instance of KeyIdentityByFingerprint from the specified map of raw messages. -func UnmarshalKeyIdentityByFingerprint(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyIdentityByFingerprint) - err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) +// UnmarshalLoadBalancerProfileIdentityByName unmarshals an instance of LoadBalancerProfileIdentityByName from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -78495,30 +84160,27 @@ func UnmarshalKeyIdentityByFingerprint(m map[string]json.RawMessage, result inte return } -// KeyIdentityByHref : KeyIdentityByHref struct -// This model "extends" KeyIdentity -type KeyIdentityByHref struct { - // The URL for this key. - Href *string `json:"href" validate:"required"` +// LoadBalancerProfileInstanceGroupsSupportedDependent : The instance groups support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileInstanceGroupsSupported +type LoadBalancerProfileInstanceGroupsSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` } -// NewKeyIdentityByHref : Instantiate KeyIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewKeyIdentityByHref(href string) (_model *KeyIdentityByHref, err error) { - _model = &KeyIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} +// Constants associated with the LoadBalancerProfileInstanceGroupsSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileInstanceGroupsSupportedDependentTypeDependentConst = "dependent" +) -func (*KeyIdentityByHref) isaKeyIdentity() bool { +func (*LoadBalancerProfileInstanceGroupsSupportedDependent) isaLoadBalancerProfileInstanceGroupsSupported() bool { return true } -// UnmarshalKeyIdentityByHref unmarshals an instance of KeyIdentityByHref from the specified map of raw messages. -func UnmarshalKeyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileInstanceGroupsSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileInstanceGroupsSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -78526,30 +84188,34 @@ func UnmarshalKeyIdentityByHref(m map[string]json.RawMessage, result interface{} return } -// KeyIdentityByID : KeyIdentityByID struct -// This model "extends" KeyIdentity -type KeyIdentityByID struct { - // The unique identifier for this key. - ID *string `json:"id" validate:"required"` -} +// LoadBalancerProfileInstanceGroupsSupportedFixed : The instance groups support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileInstanceGroupsSupported +type LoadBalancerProfileInstanceGroupsSupportedFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` -// NewKeyIdentityByID : Instantiate KeyIdentityByID (Generic Model Constructor) -func (*VpcV1) NewKeyIdentityByID(id string) (_model *KeyIdentityByID, err error) { - _model = &KeyIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return + // The value for this profile field. + Value *bool `json:"value" validate:"required"` } -func (*KeyIdentityByID) isaKeyIdentity() bool { +// Constants associated with the LoadBalancerProfileInstanceGroupsSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileInstanceGroupsSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileInstanceGroupsSupportedFixed) isaLoadBalancerProfileInstanceGroupsSupported() bool { return true } -// UnmarshalKeyIdentityByID unmarshals an instance of KeyIdentityByID from the specified map of raw messages. -func UnmarshalKeyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileInstanceGroupsSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileInstanceGroupsSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { return } @@ -78557,30 +84223,62 @@ func UnmarshalKeyIdentityByID(m map[string]json.RawMessage, result interface{}) return } -// LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct -// This model "extends" LegacyCloudObjectStorageBucketIdentity -type LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct { - // The globally unique name of this Cloud Object Storage bucket. - Name *string `json:"name" validate:"required"` +// LoadBalancerProfileRouteModeSupportedDependent : The route mode support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileRouteModeSupported +type LoadBalancerProfileRouteModeSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` } -// NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : Instantiate LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName (Generic Model Constructor) -func (*VpcV1) NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(name string) (_model *LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName, err error) { - _model = &LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName{ - Name: core.StringPtr(name), +// Constants associated with the LoadBalancerProfileRouteModeSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileRouteModeSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileRouteModeSupportedDependent) isaLoadBalancerProfileRouteModeSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileRouteModeSupportedDependent unmarshals an instance of LoadBalancerProfileRouteModeSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileRouteModeSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileRouteModeSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -func (*LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) isaLegacyCloudObjectStorageBucketIdentity() bool { +// LoadBalancerProfileRouteModeSupportedFixed : The route mode support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileRouteModeSupported +type LoadBalancerProfileRouteModeSupportedFixed 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 LoadBalancerProfileRouteModeSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileRouteModeSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileRouteModeSupportedFixed) isaLoadBalancerProfileRouteModeSupported() bool { return true } -// UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName unmarshals an instance of LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName from the specified map of raw messages. -func UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +// UnmarshalLoadBalancerProfileRouteModeSupportedFixed unmarshals an instance of LoadBalancerProfileRouteModeSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileRouteModeSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileRouteModeSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { return } @@ -78588,30 +84286,62 @@ func UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIden return } -// LoadBalancerIdentityByCRN : LoadBalancerIdentityByCRN struct -// This model "extends" LoadBalancerIdentity -type LoadBalancerIdentityByCRN struct { - // The load balancer's CRN. - CRN *string `json:"crn" validate:"required"` +// LoadBalancerProfileSecurityGroupsSupportedDependent : The security group support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileSecurityGroupsSupported +type LoadBalancerProfileSecurityGroupsSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` } -// NewLoadBalancerIdentityByCRN : Instantiate LoadBalancerIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerIdentityByCRN(crn string) (_model *LoadBalancerIdentityByCRN, err error) { - _model = &LoadBalancerIdentityByCRN{ - CRN: core.StringPtr(crn), +// Constants associated with the LoadBalancerProfileSecurityGroupsSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileSecurityGroupsSupportedDependent) isaLoadBalancerProfileSecurityGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -func (*LoadBalancerIdentityByCRN) isaLoadBalancerIdentity() bool { +// LoadBalancerProfileSecurityGroupsSupportedFixed : The security group support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileSecurityGroupsSupported +type LoadBalancerProfileSecurityGroupsSupportedFixed 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 LoadBalancerProfileSecurityGroupsSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileSecurityGroupsSupportedFixed) isaLoadBalancerProfileSecurityGroupsSupported() bool { return true } -// UnmarshalLoadBalancerIdentityByCRN unmarshals an instance of LoadBalancerIdentityByCRN from the specified map of raw messages. -func UnmarshalLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { return } @@ -78619,30 +84349,62 @@ func UnmarshalLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result int return } -// LoadBalancerIdentityByHref : LoadBalancerIdentityByHref struct -// This model "extends" LoadBalancerIdentity -type LoadBalancerIdentityByHref struct { - // The load balancer's canonical URL. - Href *string `json:"href" validate:"required"` +// LoadBalancerProfileUDPSupportedDependent : The UDP support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileUDPSupported +type LoadBalancerProfileUDPSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` } -// NewLoadBalancerIdentityByHref : Instantiate LoadBalancerIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerIdentityByHref(href string) (_model *LoadBalancerIdentityByHref, err error) { - _model = &LoadBalancerIdentityByHref{ - Href: core.StringPtr(href), +// Constants associated with the LoadBalancerProfileUDPSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileUDPSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileUDPSupportedDependent) isaLoadBalancerProfileUDPSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileUDPSupportedDependent unmarshals an instance of LoadBalancerProfileUDPSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileUDPSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileUDPSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -func (*LoadBalancerIdentityByHref) isaLoadBalancerIdentity() bool { +// LoadBalancerProfileUDPSupportedFixed : The UDP support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileUDPSupported +type LoadBalancerProfileUDPSupportedFixed 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 LoadBalancerProfileUDPSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileUDPSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileUDPSupportedFixed) isaLoadBalancerProfileUDPSupported() bool { return true } -// UnmarshalLoadBalancerIdentityByHref unmarshals an instance of LoadBalancerIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalLoadBalancerProfileUDPSupportedFixed unmarshals an instance of LoadBalancerProfileUDPSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileUDPSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileUDPSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { return } @@ -78650,30 +84412,30 @@ func UnmarshalLoadBalancerIdentityByHref(m map[string]json.RawMessage, result in return } -// LoadBalancerIdentityByID : LoadBalancerIdentityByID struct -// This model "extends" LoadBalancerIdentity -type LoadBalancerIdentityByID struct { - // The unique identifier for this load balancer. - ID *string `json:"id" validate:"required"` +// NetworkACLIdentityByCRN : NetworkACLIdentityByCRN struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByCRN struct { + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` } -// NewLoadBalancerIdentityByID : Instantiate LoadBalancerIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerIdentityByID(id string) (_model *LoadBalancerIdentityByID, err error) { - _model = &LoadBalancerIdentityByID{ - ID: core.StringPtr(id), +// NewNetworkACLIdentityByCRN : Instantiate NetworkACLIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByCRN(crn string) (_model *NetworkACLIdentityByCRN, err error) { + _model = &NetworkACLIdentityByCRN{ + CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") return } -func (*LoadBalancerIdentityByID) isaLoadBalancerIdentity() bool { +func (*NetworkACLIdentityByCRN) isaNetworkACLIdentity() bool { return true } -// UnmarshalLoadBalancerIdentityByID unmarshals an instance of LoadBalancerIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalNetworkACLIdentityByCRN unmarshals an instance of NetworkACLIdentityByCRN from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } @@ -78681,29 +84443,29 @@ func UnmarshalLoadBalancerIdentityByID(m map[string]json.RawMessage, result inte return } -// LoadBalancerListenerIdentityByHref : LoadBalancerListenerIdentityByHref struct -// This model "extends" LoadBalancerListenerIdentity -type LoadBalancerListenerIdentityByHref struct { - // The listener's canonical URL. +// NetworkACLIdentityByHref : NetworkACLIdentityByHref struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByHref struct { + // The URL for this network ACL. Href *string `json:"href" validate:"required"` } -// NewLoadBalancerListenerIdentityByHref : Instantiate LoadBalancerListenerIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerIdentityByHref(href string) (_model *LoadBalancerListenerIdentityByHref, err error) { - _model = &LoadBalancerListenerIdentityByHref{ +// NewNetworkACLIdentityByHref : Instantiate NetworkACLIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByHref(href string) (_model *NetworkACLIdentityByHref, err error) { + _model = &NetworkACLIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*LoadBalancerListenerIdentityByHref) isaLoadBalancerListenerIdentity() bool { +func (*NetworkACLIdentityByHref) isaNetworkACLIdentity() bool { return true } -// UnmarshalLoadBalancerListenerIdentityByHref unmarshals an instance of LoadBalancerListenerIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerIdentityByHref) +// UnmarshalNetworkACLIdentityByHref unmarshals an instance of NetworkACLIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -78712,29 +84474,29 @@ func UnmarshalLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, r return } -// LoadBalancerListenerIdentityByID : LoadBalancerListenerIdentityByID struct -// This model "extends" LoadBalancerListenerIdentity -type LoadBalancerListenerIdentityByID struct { - // The unique identifier for this load balancer listener. +// NetworkACLIdentityByID : NetworkACLIdentityByID struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByID struct { + // The unique identifier for this network ACL. ID *string `json:"id" validate:"required"` } -// NewLoadBalancerListenerIdentityByID : Instantiate LoadBalancerListenerIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerIdentityByID(id string) (_model *LoadBalancerListenerIdentityByID, err error) { - _model = &LoadBalancerListenerIdentityByID{ +// NewNetworkACLIdentityByID : Instantiate NetworkACLIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByID(id string) (_model *NetworkACLIdentityByID, err error) { + _model = &NetworkACLIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*LoadBalancerListenerIdentityByID) isaLoadBalancerListenerIdentity() bool { +func (*NetworkACLIdentityByID) isaNetworkACLIdentity() bool { return true } -// UnmarshalLoadBalancerListenerIdentityByID unmarshals an instance of LoadBalancerListenerIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerIdentityByID) +// UnmarshalNetworkACLIdentityByID unmarshals an instance of NetworkACLIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -78743,35 +84505,52 @@ func UnmarshalLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, res return } -// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct -// This model "extends" LoadBalancerListenerPolicyTargetPatch -type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` +// NetworkACLPrototypeNetworkACLByRules : NetworkACLPrototypeNetworkACLByRules struct +// This model "extends" NetworkACLPrototype +type NetworkACLPrototypeNetworkACLByRules struct { + // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` - // Identifies a load balancer listener by a unique property. - Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` + // The VPC this network ACL will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, + // resulting in all traffic being denied. + Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` } -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { +// NewNetworkACLPrototypeNetworkACLByRules : Instantiate NetworkACLPrototypeNetworkACLByRules (Generic Model Constructor) +func (*VpcV1) NewNetworkACLPrototypeNetworkACLByRules(vpc VPCIdentityIntf) (_model *NetworkACLPrototypeNetworkACLByRules, err error) { + _model = &NetworkACLPrototypeNetworkACLByRules{ + VPC: vpc, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLPrototypeNetworkACLByRules) isaNetworkACLPrototype() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) +// UnmarshalNetworkACLPrototypeNetworkACLByRules unmarshals an instance of NetworkACLPrototypeNetworkACLByRules from the specified map of raw messages. +func UnmarshalNetworkACLPrototypeNetworkACLByRules(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototypeNetworkACLByRules) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) if err != nil { return } @@ -78779,28 +84558,52 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedi return } -// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct -// This model "extends" LoadBalancerListenerPolicyTargetPatch -type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` +// NetworkACLPrototypeNetworkACLBySourceNetworkACL : NetworkACLPrototypeNetworkACLBySourceNetworkACL struct +// This model "extends" NetworkACLPrototype +type NetworkACLPrototypeNetworkACLBySourceNetworkACL struct { + // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` - // The redirect target URL. - URL *string `json:"url,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The VPC this network ACL will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // Network ACL to copy rules from. + SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl" validate:"required"` } -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { +// NewNetworkACLPrototypeNetworkACLBySourceNetworkACL : Instantiate NetworkACLPrototypeNetworkACLBySourceNetworkACL (Generic Model Constructor) +func (*VpcV1) NewNetworkACLPrototypeNetworkACLBySourceNetworkACL(vpc VPCIdentityIntf, sourceNetworkACL NetworkACLIdentityIntf) (_model *NetworkACLPrototypeNetworkACLBySourceNetworkACL, err error) { + _model = &NetworkACLPrototypeNetworkACLBySourceNetworkACL{ + VPC: vpc, + SourceNetworkACL: sourceNetworkACL, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLPrototypeNetworkACLBySourceNetworkACL) isaNetworkACLPrototype() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) +// UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL unmarshals an instance of NetworkACLPrototypeNetworkACLBySourceNetworkACL from the specified map of raw messages. +func UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototypeNetworkACLBySourceNetworkACL) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) if err != nil { return } @@ -78808,39 +84611,29 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRed return } -// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref -// This model "extends" LoadBalancerListenerPolicyTargetPatch -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { - return true +// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct +// This model "extends" NetworkACLRuleBeforePatch +type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct { + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` } -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityIntf interface { - LoadBalancerListenerPolicyTargetPatchIntf - isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool +// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(href string) (_model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref, err error) { + _model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return } -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatch() bool { +func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePatch() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } +// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -78849,45 +84642,30 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity(m ma return } -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct -// This model "extends" LoadBalancerListenerPolicyTargetPrototype -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - // Identifies a load balancer listener by a unique property. - Listener LoadBalancerListenerIdentityIntf `json:"listener" validate:"required"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` +// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct +// This model "extends" NetworkACLRuleBeforePatch +type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` } -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype{ - HTTPStatusCode: core.Int64Ptr(httpStatusCode), - Listener: listener, +// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(id string) (_model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID, err error) { + _model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID{ + ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { +func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePatch() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) +// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } @@ -78895,38 +84673,30 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPS return } -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct -// This model "extends" LoadBalancerListenerPolicyTargetPrototype -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - // The redirect target URL. - URL *string `json:"url" validate:"required"` +// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct +// This model "extends" NetworkACLRuleBeforePrototype +type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct { + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` } -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(httpStatusCode int64, url string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype{ - HTTPStatusCode: core.Int64Ptr(httpStatusCode), - URL: core.StringPtr(url), +// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(href string) (_model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref, err error) { + _model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref{ + Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { +func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePrototype() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) +// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -78934,75 +84704,149 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolic return } -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref -// This model "extends" LoadBalancerListenerPolicyTargetPrototype -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { - return true +// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct +// This model "extends" NetworkACLRuleBeforePrototype +type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` } -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityIntf interface { - LoadBalancerListenerPolicyTargetPrototypeIntf - isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool +// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(id string) (_model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID, err error) { + _model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return } -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototype() bool { +func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePrototype() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) +// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect : LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct -// This model "extends" LoadBalancerListenerPolicyTarget -type LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` +// NetworkACLRuleItemNetworkACLRuleProtocolAll : NetworkACLRuleItemNetworkACLRuleProtocolAll struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolAll struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` - Listener *LoadBalancerListenerReference `json:"listener" validate:"required"` + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` } -func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) isaLoadBalancerListenerPolicyTarget() bool { +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolAllActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllProtocolAllConst = "all" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolAll) isaNetworkACLRuleItem() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolAll from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { return } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } @@ -79010,28 +84854,136 @@ func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect( return } -// LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL : LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct -// This model "extends" LoadBalancerListenerPolicyTarget -type LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` +// NetworkACLRuleItemNetworkACLRuleProtocolIcmp : NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` - // The redirect target URL. - URL *string `json:"url" validate:"required"` + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` } -func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) isaLoadBalancerListenerPolicyTarget() bool { +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolIcmp) isaNetworkACLRuleItem() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { return } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -79039,31 +84991,107 @@ func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirect return } -// LoadBalancerListenerPolicyTargetLoadBalancerPoolReference : LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct -// This model "extends" LoadBalancerListenerPolicyTarget -type LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` +// NetworkACLRuleItemNetworkACLRuleProtocolTcpudp : NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` - // The pool's canonical URL. + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. Href *string `json:"href" validate:"required"` - // The unique identifier for this load balancer pool. + // The unique identifier for this network ACL rule. ID *string `json:"id" validate:"required"` - // The name for this load balancer pool. The name is unique across all pools for the load balancer. + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max" validate:"required"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min" validate:"required"` } -func (*LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) isaLoadBalancerListenerPolicyTarget() bool { +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) isaNetworkACLRuleItem() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerPoolReference from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { return } @@ -79075,69 +85103,35 @@ func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference(m map[st if err != nil { return } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityByHref struct -// This model "extends" LoadBalancerPoolIdentity -type LoadBalancerPoolIdentityByHref struct { - // The pool's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerPoolIdentityByHref{ - Href: core.StringPtr(href), + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerPoolIdentityByHref) isaLoadBalancerPoolIdentity() bool { - return true -} - -// UnmarshalLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolIdentityByID : LoadBalancerPoolIdentityByID struct -// This model "extends" LoadBalancerPoolIdentity -type LoadBalancerPoolIdentityByID struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerPoolIdentityByID : Instantiate LoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerPoolIdentityByID{ - ID: core.StringPtr(id), + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerPoolIdentityByID) isaLoadBalancerPoolIdentity() bool { - return true -} - -// UnmarshalLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) if err != nil { return } @@ -79145,83 +85139,103 @@ func UnmarshalLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result return } -// LoadBalancerPoolMemberTargetPrototypeIP : LoadBalancerPoolMemberTargetPrototypeIP struct -// This model "extends" LoadBalancerPoolMemberTargetPrototype -type LoadBalancerPoolMemberTargetPrototypeIP struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` -// NewLoadBalancerPoolMemberTargetPrototypeIP : Instantiate LoadBalancerPoolMemberTargetPrototypeIP (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeIP(address string) (_model *LoadBalancerPoolMemberTargetPrototypeIP, err error) { - _model = &LoadBalancerPoolMemberTargetPrototypeIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - return -} + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` -func (*LoadBalancerPoolMemberTargetPrototypeIP) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` -// UnmarshalLoadBalancerPoolMemberTargetPrototypeIP unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeIP from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` -// LoadBalancerPoolMemberTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. -// Models which "extend" this model: -// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID -// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN -// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref -// This model "extends" LoadBalancerPoolMemberTargetPrototype -type LoadBalancerPoolMemberTargetPrototypeInstanceIdentity struct { - // The unique identifier for this virtual server instance. - ID *string `json:"id,omitempty"` + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` - // The CRN for this virtual server instance. - CRN *string `json:"crn,omitempty"` + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` - // The URL for this virtual server instance. - Href *string `json:"href,omitempty"` + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` } -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { - return true -} +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeActionDenyConst = "deny" +) -type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityIntf interface { - LoadBalancerPoolMemberTargetPrototypeIntf - isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" +) + +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return } -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototype() bool { +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { return true } -// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } @@ -79229,72 +85243,101 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity(m map[string return } -// LoadBalancerPoolMemberTargetIP : LoadBalancerPoolMemberTargetIP struct -// This model "extends" LoadBalancerPoolMemberTarget -type LoadBalancerPoolMemberTargetIP struct { - // The IP address. +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to match. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` -func (*LoadBalancerPoolMemberTargetIP) isaLoadBalancerPoolMemberTarget() bool { - return true -} + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` -// UnmarshalLoadBalancerPoolMemberTargetIP unmarshals an instance of LoadBalancerPoolMemberTargetIP from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` } -// LoadBalancerPoolMemberTargetInstanceReference : LoadBalancerPoolMemberTargetInstanceReference struct -// This model "extends" LoadBalancerPoolMemberTarget -type LoadBalancerPoolMemberTargetInstanceReference struct { - // The CRN for this virtual server instance. - CRN *string `json:"crn" validate:"required"` +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeActionDenyConst = "deny" +) - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" +) - // The URL for this virtual server instance. - Href *string `json:"href" validate:"required"` +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeIPVersionIpv4Const = "ipv4" +) - // The unique identifier for this virtual server instance. - ID *string `json:"id" validate:"required"` +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" +) - // The name for this virtual server instance. The name is unique across all virtual server instances in the region. - Name *string `json:"name" validate:"required"` +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return } -func (*LoadBalancerPoolMemberTargetInstanceReference) isaLoadBalancerPoolMemberTarget() bool { +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { return true } -// UnmarshalLoadBalancerPoolMemberTargetInstanceReference unmarshals an instance of LoadBalancerPoolMemberTargetInstanceReference from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetInstanceReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { return } @@ -79302,92 +85345,18 @@ func UnmarshalLoadBalancerPoolMemberTargetInstanceReference(m map[string]json.Ra if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileIdentityByHref : LoadBalancerProfileIdentityByHref struct -// This model "extends" LoadBalancerProfileIdentity -type LoadBalancerProfileIdentityByHref struct { - // The URL for this load balancer profile. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerProfileIdentityByHref : Instantiate LoadBalancerProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerProfileIdentityByHref(href string) (_model *LoadBalancerProfileIdentityByHref, err error) { - _model = &LoadBalancerProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerProfileIdentityByHref) isaLoadBalancerProfileIdentity() bool { - return true -} - -// UnmarshalLoadBalancerProfileIdentityByHref unmarshals an instance of LoadBalancerProfileIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "source", &obj.Source) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileIdentityByName : LoadBalancerProfileIdentityByName struct -// This model "extends" LoadBalancerProfileIdentity -type LoadBalancerProfileIdentityByName struct { - // The globally unique name for this load balancer profile. - Name *string `json:"name" validate:"required"` -} - -// NewLoadBalancerProfileIdentityByName : Instantiate LoadBalancerProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerProfileIdentityByName(name string) (_model *LoadBalancerProfileIdentityByName, err error) { - _model = &LoadBalancerProfileIdentityByName{ - Name: core.StringPtr(name), + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*LoadBalancerProfileIdentityByName) isaLoadBalancerProfileIdentity() bool { - return true -} - -// UnmarshalLoadBalancerProfileIdentityByName unmarshals an instance of LoadBalancerProfileIdentityByName from the specified map of raw messages. -func UnmarshalLoadBalancerProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileInstanceGroupsSupportedDependent : The instance groups support for a load balancer with this profile depends on its configuration. -// This model "extends" LoadBalancerProfileInstanceGroupsSupported -type LoadBalancerProfileInstanceGroupsSupportedDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileInstanceGroupsSupportedDependent.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileInstanceGroupsSupportedDependentTypeDependentConst = "dependent" -) - -func (*LoadBalancerProfileInstanceGroupsSupportedDependent) isaLoadBalancerProfileInstanceGroupsSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileInstanceGroupsSupportedDependent from the specified map of raw messages. -func UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileInstanceGroupsSupportedDependent) err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return @@ -79396,316 +85365,132 @@ func UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent(m map[string]j return } -// LoadBalancerProfileInstanceGroupsSupportedFixed : The instance groups support for a load balancer with this profile. -// This model "extends" LoadBalancerProfileInstanceGroupsSupported -type LoadBalancerProfileInstanceGroupsSupportedFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` - // The value for this profile field. - Value *bool `json:"value" validate:"required"` -} + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` -// Constants associated with the LoadBalancerProfileInstanceGroupsSupportedFixed.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileInstanceGroupsSupportedFixedTypeFixedConst = "fixed" -) + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` -func (*LoadBalancerProfileInstanceGroupsSupportedFixed) isaLoadBalancerProfileInstanceGroupsSupported() bool { - return true -} + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` -// UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileInstanceGroupsSupportedFixed from the specified map of raw messages. -func UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileInstanceGroupsSupportedFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` -// LoadBalancerProfileRouteModeSupportedDependent : The route mode support for a load balancer with this profile depends on its configuration. -// This model "extends" LoadBalancerProfileRouteModeSupported -type LoadBalancerProfileRouteModeSupportedDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` -// Constants associated with the LoadBalancerProfileRouteModeSupportedDependent.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileRouteModeSupportedDependentTypeDependentConst = "dependent" -) + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` -func (*LoadBalancerProfileRouteModeSupportedDependent) isaLoadBalancerProfileRouteModeSupported() bool { - return true -} + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` -// UnmarshalLoadBalancerProfileRouteModeSupportedDependent unmarshals an instance of LoadBalancerProfileRouteModeSupportedDependent from the specified map of raw messages. -func UnmarshalLoadBalancerProfileRouteModeSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileRouteModeSupportedDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` -// LoadBalancerProfileRouteModeSupportedFixed : The route mode support for a load balancer with this profile. -// This model "extends" LoadBalancerProfileRouteModeSupported -type LoadBalancerProfileRouteModeSupportedFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` - // The value for this profile field. - Value *bool `json:"value" validate:"required"` + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` } -// Constants associated with the LoadBalancerProfileRouteModeSupportedFixed.Type property. -// The type for this profile field. +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Action property. +// The action to perform for a packet matching the rule. const ( - LoadBalancerProfileRouteModeSupportedFixedTypeFixedConst = "fixed" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeActionDenyConst = "deny" ) -func (*LoadBalancerProfileRouteModeSupportedFixed) isaLoadBalancerProfileRouteModeSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileRouteModeSupportedFixed unmarshals an instance of LoadBalancerProfileRouteModeSupportedFixed from the specified map of raw messages. -func UnmarshalLoadBalancerProfileRouteModeSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileRouteModeSupportedFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" +) -// LoadBalancerProfileSecurityGroupsSupportedDependent : The security group support for a load balancer with this profile depends on its configuration. -// This model "extends" LoadBalancerProfileSecurityGroupsSupported -type LoadBalancerProfileSecurityGroupsSupportedDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeIPVersionIpv4Const = "ipv4" +) -// Constants associated with the LoadBalancerProfileSecurityGroupsSupportedDependent.Type property. -// The type for this profile field. +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Protocol property. +// The protocol to enforce. const ( - LoadBalancerProfileSecurityGroupsSupportedDependentTypeDependentConst = "dependent" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" ) -func (*LoadBalancerProfileSecurityGroupsSupportedDependent) isaLoadBalancerProfileSecurityGroupsSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedDependent from the specified map of raw messages. -func UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileSecurityGroupsSupportedDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + err = core.ValidateStruct(_model, "required parameters") return } -// LoadBalancerProfileSecurityGroupsSupportedFixed : The security group support for a load balancer with this profile. -// This model "extends" LoadBalancerProfileSecurityGroupsSupported -type LoadBalancerProfileSecurityGroupsSupportedFixed 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 LoadBalancerProfileSecurityGroupsSupportedFixed.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileSecurityGroupsSupportedFixedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileSecurityGroupsSupportedFixed) isaLoadBalancerProfileSecurityGroupsSupported() bool { +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { return true } -// UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedFixed from the specified map of raw messages. -func UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileSecurityGroupsSupportedFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileUDPSupportedDependent : The UDP support for a load balancer with this profile depends on its configuration. -// This model "extends" LoadBalancerProfileUDPSupported -type LoadBalancerProfileUDPSupportedDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileUDPSupportedDependent.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileUDPSupportedDependentTypeDependentConst = "dependent" -) - -func (*LoadBalancerProfileUDPSupportedDependent) isaLoadBalancerProfileUDPSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileUDPSupportedDependent unmarshals an instance of LoadBalancerProfileUDPSupportedDependent from the specified map of raw messages. -func UnmarshalLoadBalancerProfileUDPSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileUDPSupportedDependent) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileUDPSupportedFixed : The UDP support for a load balancer with this profile. -// This model "extends" LoadBalancerProfileUDPSupported -type LoadBalancerProfileUDPSupportedFixed 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 LoadBalancerProfileUDPSupportedFixed.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileUDPSupportedFixedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileUDPSupportedFixed) isaLoadBalancerProfileUDPSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileUDPSupportedFixed unmarshals an instance of LoadBalancerProfileUDPSupportedFixed from the specified map of raw messages. -func UnmarshalLoadBalancerProfileUDPSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileUDPSupportedFixed) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLIdentityByCRN : NetworkACLIdentityByCRN struct -// This model "extends" NetworkACLIdentity -type NetworkACLIdentityByCRN struct { - // The CRN for this network ACL. - CRN *string `json:"crn" validate:"required"` -} - -// NewNetworkACLIdentityByCRN : Instantiate NetworkACLIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewNetworkACLIdentityByCRN(crn string) (_model *NetworkACLIdentityByCRN, err error) { - _model = &NetworkACLIdentityByCRN{ - CRN: core.StringPtr(crn), + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLIdentityByCRN) isaNetworkACLIdentity() bool { - return true -} - -// UnmarshalNetworkACLIdentityByCRN unmarshals an instance of NetworkACLIdentityByCRN from the specified map of raw messages. -func UnmarshalNetworkACLIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLIdentityByHref : NetworkACLIdentityByHref struct -// This model "extends" NetworkACLIdentity -type NetworkACLIdentityByHref struct { - // The URL for this network ACL. - Href *string `json:"href" validate:"required"` -} - -// NewNetworkACLIdentityByHref : Instantiate NetworkACLIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewNetworkACLIdentityByHref(href string) (_model *NetworkACLIdentityByHref, err error) { - _model = &NetworkACLIdentityByHref{ - Href: core.StringPtr(href), + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLIdentityByHref) isaNetworkACLIdentity() bool { - return true -} - -// UnmarshalNetworkACLIdentityByHref unmarshals an instance of NetworkACLIdentityByHref from the specified map of raw messages. -func UnmarshalNetworkACLIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLIdentityByID : NetworkACLIdentityByID struct -// This model "extends" NetworkACLIdentity -type NetworkACLIdentityByID struct { - // The unique identifier for this network ACL. - ID *string `json:"id" validate:"required"` -} - -// NewNetworkACLIdentityByID : Instantiate NetworkACLIdentityByID (Generic Model Constructor) -func (*VpcV1) NewNetworkACLIdentityByID(id string) (_model *NetworkACLIdentityByID, err error) { - _model = &NetworkACLIdentityByID{ - ID: core.StringPtr(id), + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLIdentityByID) isaNetworkACLIdentity() bool { - return true -} - -// UnmarshalNetworkACLIdentityByID unmarshals an instance of NetworkACLIdentityByID from the specified map of raw messages. -func UnmarshalNetworkACLIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) if err != nil { return } @@ -79713,52 +85498,109 @@ func UnmarshalNetworkACLIdentityByID(m map[string]json.RawMessage, result interf return } -// NetworkACLPrototypeNetworkACLByRules : NetworkACLPrototypeNetworkACLByRules struct -// This model "extends" NetworkACLPrototype -type NetworkACLPrototypeNetworkACLByRules struct { - // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` +// NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` - // The VPC this network ACL will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` - // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, - // resulting in all traffic being denied. - Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` } -// NewNetworkACLPrototypeNetworkACLByRules : Instantiate NetworkACLPrototypeNetworkACLByRules (Generic Model Constructor) -func (*VpcV1) NewNetworkACLPrototypeNetworkACLByRules(vpc VPCIdentityIntf) (_model *NetworkACLPrototypeNetworkACLByRules, err error) { - _model = &NetworkACLPrototypeNetworkACLByRules{ - VPC: vpc, +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") return } -func (*NetworkACLPrototypeNetworkACLByRules) isaNetworkACLPrototype() bool { +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) isaNetworkACLRulePrototype() bool { return true } -// UnmarshalNetworkACLPrototypeNetworkACLByRules unmarshals an instance of NetworkACLPrototypeNetworkACLByRules from the specified map of raw messages. -func UnmarshalNetworkACLPrototypeNetworkACLByRules(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLPrototypeNetworkACLByRules) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) if err != nil { return } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } @@ -79766,52 +85608,127 @@ func UnmarshalNetworkACLPrototypeNetworkACLByRules(m map[string]json.RawMessage, return } -// NetworkACLPrototypeNetworkACLBySourceNetworkACL : NetworkACLPrototypeNetworkACLBySourceNetworkACL struct -// This model "extends" NetworkACLPrototype -type NetworkACLPrototypeNetworkACLBySourceNetworkACL struct { - // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the - // name will be a hyphenated list of randomly-selected words. +// NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` - // The VPC this network ACL will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` - // Network ACL to copy rules from. - SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl" validate:"required"` + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` } -// NewNetworkACLPrototypeNetworkACLBySourceNetworkACL : Instantiate NetworkACLPrototypeNetworkACLBySourceNetworkACL (Generic Model Constructor) -func (*VpcV1) NewNetworkACLPrototypeNetworkACLBySourceNetworkACL(vpc VPCIdentityIntf, sourceNetworkACL NetworkACLIdentityIntf) (_model *NetworkACLPrototypeNetworkACLBySourceNetworkACL, err error) { - _model = &NetworkACLPrototypeNetworkACLBySourceNetworkACL{ - VPC: vpc, - SourceNetworkACL: sourceNetworkACL, +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") return } -func (*NetworkACLPrototypeNetworkACLBySourceNetworkACL) isaNetworkACLPrototype() bool { +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) isaNetworkACLRulePrototype() bool { return true } -// UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL unmarshals an instance of NetworkACLPrototypeNetworkACLBySourceNetworkACL from the specified map of raw messages. -func UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLPrototypeNetworkACLBySourceNetworkACL) +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalPrimitive(m, "source", &obj.Source) if err != nil { return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { return } - err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -79819,123 +85736,138 @@ func UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL(m map[string]json. return } -// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct -// This model "extends" NetworkACLRuleBeforePatch -type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct { - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` -} +// NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` -// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(href string) (_model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref, err error) { - _model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` -func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePatch() bool { - return true -} + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` -// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` -// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct -// This model "extends" NetworkACLRuleBeforePatch -type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct { - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` } -// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(id string) (_model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID, err error) { - _model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID{ - ID: core.StringPtr(id), +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") return } -func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePatch() bool { +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) isaNetworkACLRulePrototype() bool { return true } -// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct -// This model "extends" NetworkACLRuleBeforePrototype -type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct { - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` -} - -// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(href string) (_model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref, err error) { - _model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref{ - Href: core.StringPtr(href), + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePrototype() bool { - return true -} - -// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct -// This model "extends" NetworkACLRuleBeforePrototype -type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct { - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` -} - -// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(id string) (_model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID, err error) { - _model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID{ - ID: core.StringPtr(id), + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePrototype() bool { - return true -} - -// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) if err != nil { return } @@ -79943,14 +85875,13 @@ func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(m map[stri return } -// NetworkACLRuleItemNetworkACLRuleProtocolAll : NetworkACLRuleItemNetworkACLRuleProtocolAll struct -// This model "extends" NetworkACLRuleItem -type NetworkACLRuleItemNetworkACLRuleProtocolAll struct { +// NetworkACLRuleNetworkACLRuleProtocolAll : NetworkACLRuleNetworkACLRuleProtocolAll struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolAll struct { // The action to perform for a packet matching the rule. Action *string `json:"action" validate:"required"` - // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the - // collection. If absent, this is the last rule. + // The rule that this rule is immediately before. If absent, this is the last rule. Before *NetworkACLRuleReference `json:"before,omitempty"` // The date and time that the rule was created. @@ -79981,39 +85912,39 @@ type NetworkACLRuleItemNetworkACLRuleProtocolAll struct { Protocol *string `json:"protocol" validate:"required"` } -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Action property. +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Action property. // The action to perform for a packet matching the rule. const ( - NetworkACLRuleItemNetworkACLRuleProtocolAllActionAllowConst = "allow" - NetworkACLRuleItemNetworkACLRuleProtocolAllActionDenyConst = "deny" + NetworkACLRuleNetworkACLRuleProtocolAllActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolAllActionDenyConst = "deny" ) -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Direction property. +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Direction property. // The direction of traffic to match. const ( - NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" - NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" + NetworkACLRuleNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" ) -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.IPVersion property. +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.IPVersion property. // The IP version for this rule. const ( - NetworkACLRuleItemNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" + NetworkACLRuleNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" ) -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Protocol property. +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Protocol property. // The protocol to enforce. const ( - NetworkACLRuleItemNetworkACLRuleProtocolAllProtocolAllConst = "all" + NetworkACLRuleNetworkACLRuleProtocolAllProtocolAllConst = "all" ) -func (*NetworkACLRuleItemNetworkACLRuleProtocolAll) isaNetworkACLRuleItem() bool { +func (*NetworkACLRuleNetworkACLRuleProtocolAll) isaNetworkACLRule() bool { return true } -// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolAll from the specified map of raw messages. -func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleItemNetworkACLRuleProtocolAll) +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolAll from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolAll) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { return @@ -80062,14 +85993,13 @@ func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll(m map[string]json.RawM return } -// NetworkACLRuleItemNetworkACLRuleProtocolIcmp : NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct -// This model "extends" NetworkACLRuleItem -type NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct { +// NetworkACLRuleNetworkACLRuleProtocolIcmp : NetworkACLRuleNetworkACLRuleProtocolIcmp struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolIcmp struct { // The action to perform for a packet matching the rule. Action *string `json:"action" validate:"required"` - // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the - // collection. If absent, this is the last rule. + // The rule that this rule is immediately before. If absent, this is the last rule. Before *NetworkACLRuleReference `json:"before,omitempty"` // The date and time that the rule was created. @@ -80110,39 +86040,39 @@ type NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct { Type *int64 `json:"type,omitempty"` } -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Action property. +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Action property. // The action to perform for a packet matching the rule. const ( - NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionAllowConst = "allow" - NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionDenyConst = "deny" + NetworkACLRuleNetworkACLRuleProtocolIcmpActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolIcmpActionDenyConst = "deny" ) -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Direction property. +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Direction property. // The direction of traffic to match. const ( - NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" - NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" + NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" ) -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.IPVersion property. +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.IPVersion property. // The IP version for this rule. const ( - NetworkACLRuleItemNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" + NetworkACLRuleNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" ) -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Protocol property. +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Protocol property. // The protocol to enforce. const ( - NetworkACLRuleItemNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" + NetworkACLRuleNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" ) -func (*NetworkACLRuleItemNetworkACLRuleProtocolIcmp) isaNetworkACLRuleItem() bool { +func (*NetworkACLRuleNetworkACLRuleProtocolIcmp) isaNetworkACLRule() bool { return true } -// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolIcmp from the specified map of raw messages. -func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleItemNetworkACLRuleProtocolIcmp) +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolIcmp) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { return @@ -80199,14 +86129,13 @@ func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp(m map[string]json.Raw return } -// NetworkACLRuleItemNetworkACLRuleProtocolTcpudp : NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct -// This model "extends" NetworkACLRuleItem -type NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct { +// NetworkACLRuleNetworkACLRuleProtocolTcpudp : NetworkACLRuleNetworkACLRuleProtocolTcpudp struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolTcpudp struct { // The action to perform for a packet matching the rule. Action *string `json:"action" validate:"required"` - // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the - // collection. If absent, this is the last rule. + // The rule that this rule is immediately before. If absent, this is the last rule. Before *NetworkACLRuleReference `json:"before,omitempty"` // The date and time that the rule was created. @@ -80249,40 +86178,40 @@ type NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct { SourcePortMin *int64 `json:"source_port_min" validate:"required"` } -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Action property. +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Action property. // The action to perform for a packet matching the rule. const ( - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" + NetworkACLRuleNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" ) -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Direction property. +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Direction property. // The direction of traffic to match. const ( - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" + NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" ) -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.IPVersion property. +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.IPVersion property. // The IP version for this rule. const ( - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" + NetworkACLRuleNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" ) -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Protocol property. +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Protocol property. // The protocol to enforce. const ( - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" + NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" + NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" ) -func (*NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) isaNetworkACLRuleItem() bool { +func (*NetworkACLRuleNetworkACLRuleProtocolTcpudp) isaNetworkACLRule() bool { return true } -// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolTcpudp from the specified map of raw messages. -func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolTcpudp) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { return @@ -80347,91 +86276,77 @@ func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp(m map[string]json.R return } -// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype struct -// This model "extends" NetworkACLRulePrototypeNetworkACLContext -type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` +// NetworkInterfaceIPPrototypeReservedIPIdentity : Identifies a reserved IP by a unique property. +// Models which "extend" this model: +// - NetworkInterfaceIPPrototypeReservedIPIdentityByID +// - NetworkInterfaceIPPrototypeReservedIPIdentityByHref +// This model "extends" NetworkInterfaceIPPrototype +type NetworkInterfaceIPPrototypeReservedIPIdentity struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` } -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" -) +func (*NetworkInterfaceIPPrototypeReservedIPIdentity) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { + return true +} -// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return +type NetworkInterfaceIPPrototypeReservedIPIdentityIntf interface { + NetworkInterfaceIPPrototypeIntf + isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool } -func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { +func (*NetworkInterfaceIPPrototypeReservedIPIdentity) isaNetworkInterfaceIPPrototype() bool { return true } -// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) +// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentity from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext : NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext struct +// This model "extends" NetworkInterfaceIPPrototype +type NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) isaNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) if err != nil { return } @@ -80439,133 +86354,153 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllP if err != nil { return } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype struct -// This model "extends" NetworkACLRulePrototypeNetworkACLContext -type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The ICMP traffic code to match. - // - // If specified, `type` must also be specified. If unspecified, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The ICMP traffic type to match. - // - // If unspecified, all types are matched. - Type *int64 `json:"type,omitempty"` +// OperatingSystemIdentityByHref : OperatingSystemIdentityByHref struct +// This model "extends" OperatingSystemIdentity +type OperatingSystemIdentityByHref struct { + // The URL for this operating system. + Href *string `json:"href" validate:"required"` } -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" -) - -// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), +// NewOperatingSystemIdentityByHref : Instantiate OperatingSystemIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewOperatingSystemIdentityByHref(href string) (_model *OperatingSystemIdentityByHref, err error) { + _model = &OperatingSystemIdentityByHref{ + Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { +func (*OperatingSystemIdentityByHref) isaOperatingSystemIdentity() bool { return true } -// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) +// UnmarshalOperatingSystemIdentityByHref unmarshals an instance of OperatingSystemIdentityByHref from the specified map of raw messages. +func UnmarshalOperatingSystemIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemIdentityByName : OperatingSystemIdentityByName struct +// This model "extends" OperatingSystemIdentity +type OperatingSystemIdentityByName struct { + // The globally unique name for this operating system. + Name *string `json:"name" validate:"required"` +} + +// NewOperatingSystemIdentityByName : Instantiate OperatingSystemIdentityByName (Generic Model Constructor) +func (*VpcV1) NewOperatingSystemIdentityByName(name string) (_model *OperatingSystemIdentityByName, err error) { + _model = &OperatingSystemIdentityByName{ + Name: core.StringPtr(name), } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*OperatingSystemIdentityByName) isaOperatingSystemIdentity() bool { + return true +} + +// UnmarshalOperatingSystemIdentityByName unmarshals an instance of OperatingSystemIdentityByName from the specified map of raw messages. +func UnmarshalOperatingSystemIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentity : Identifies a floating IP by a unique property. +// Models which "extend" this model: +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress +// This model "extends" PublicGatewayFloatingIPPrototype +type PublicGatewayFloatingIPPrototypeFloatingIPIdentity struct { + // The unique identifier for this floating IP. + ID *string `json:"id,omitempty"` + + // The CRN for this floating IP. + CRN *string `json:"crn,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href,omitempty"` + + // The globally unique IP address. + Address *string `json:"address,omitempty"` +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityIntf interface { + PublicGatewayFloatingIPPrototypeIntf + isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentity from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "code", &obj.Code) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext : PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct +// This model "extends" PublicGatewayFloatingIPPrototype +type PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct { + // The name for this floating IP. The name must not be used by another floating IP in the region. 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) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } @@ -80573,132 +86508,203 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp return } -// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype struct -// This model "extends" NetworkACLRulePrototypeNetworkACLContext -type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` +// PublicGatewayIdentityPublicGatewayIdentityByCRN : PublicGatewayIdentityPublicGatewayIdentityByCRN struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityPublicGatewayIdentityByCRN struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` +} - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` +// NewPublicGatewayIdentityPublicGatewayIdentityByCRN : Instantiate PublicGatewayIdentityPublicGatewayIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByCRN(crn string) (_model *PublicGatewayIdentityPublicGatewayIdentityByCRN, err error) { + _model = &PublicGatewayIdentityPublicGatewayIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` +func (*PublicGatewayIdentityPublicGatewayIdentityByCRN) isaPublicGatewayIdentity() bool { + return true +} - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` +// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByCRN from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityPublicGatewayIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` +// PublicGatewayIdentityPublicGatewayIdentityByHref : PublicGatewayIdentityPublicGatewayIdentityByHref struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityPublicGatewayIdentityByHref struct { + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` } -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeActionDenyConst = "deny" -) +// NewPublicGatewayIdentityPublicGatewayIdentityByHref : Instantiate PublicGatewayIdentityPublicGatewayIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByHref(href string) (_model *PublicGatewayIdentityPublicGatewayIdentityByHref, err error) { + _model = &PublicGatewayIdentityPublicGatewayIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" -) +func (*PublicGatewayIdentityPublicGatewayIdentityByHref) isaPublicGatewayIdentity() bool { + return true +} -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeIPVersionIpv4Const = "ipv4" -) +// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByHref from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityPublicGatewayIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" -) +// PublicGatewayIdentityPublicGatewayIdentityByID : PublicGatewayIdentityPublicGatewayIdentityByID struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityPublicGatewayIdentityByID struct { + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` +} -// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), +// NewPublicGatewayIdentityPublicGatewayIdentityByID : Instantiate PublicGatewayIdentityPublicGatewayIdentityByID (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByID(id string) (_model *PublicGatewayIdentityPublicGatewayIdentityByID, err error) { + _model = &PublicGatewayIdentityPublicGatewayIdentityByID{ + ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { +func (*PublicGatewayIdentityPublicGatewayIdentityByID) isaPublicGatewayIdentity() bool { return true } -// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) +// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByID from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityPublicGatewayIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionIdentityByHref : RegionIdentityByHref struct +// This model "extends" RegionIdentity +type RegionIdentityByHref struct { + // The URL for this region. + Href *string `json:"href" validate:"required"` +} + +// NewRegionIdentityByHref : Instantiate RegionIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRegionIdentityByHref(href string) (_model *RegionIdentityByHref, err error) { + _model = &RegionIdentityByHref{ + Href: core.StringPtr(href), } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RegionIdentityByHref) isaRegionIdentity() bool { + return true +} + +// UnmarshalRegionIdentityByHref unmarshals an instance of RegionIdentityByHref from the specified map of raw messages. +func UnmarshalRegionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionIdentityByName : RegionIdentityByName struct +// This model "extends" RegionIdentity +type RegionIdentityByName struct { + // The globally unique name for this region. + Name *string `json:"name" validate:"required"` +} + +// NewRegionIdentityByName : Instantiate RegionIdentityByName (Generic Model Constructor) +func (*VpcV1) NewRegionIdentityByName(name string) (_model *RegionIdentityByName, err error) { + _model = &RegionIdentityByName{ + Name: core.StringPtr(name), } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RegionIdentityByName) isaRegionIdentity() bool { + return true +} + +// UnmarshalRegionIdentityByName unmarshals an instance of RegionIdentityByName from the specified map of raw messages. +func UnmarshalRegionIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionIdentityByName) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentity : ReservedIPTargetPrototypeEndpointGatewayIdentity struct +// Models which "extend" this model: +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref +// This model "extends" ReservedIPTargetPrototype +type ReservedIPTargetPrototypeEndpointGatewayIdentity struct { + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +type ReservedIPTargetPrototypeEndpointGatewayIdentityIntf interface { + ReservedIPTargetPrototypeIntf + isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentity from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -80706,97 +86712,48 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpu return } -// NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct -// This model "extends" NetworkACLRulePrototype -type NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` +// ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext : ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` + // The URL for this bare metal server network interface. + Href *string `json:"href" validate:"required"` - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The unique identifier for this bare metal server network interface. + ID *string `json:"id" validate:"required"` - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` + // The name for this bare metal server network interface. + Name *string `json:"name" validate:"required"` - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Protocol property. -// The protocol to enforce. +// Constants associated with the ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" + ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" ) -// NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) isaNetworkACLRulePrototype() bool { +func (*ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) isaReservedIPTarget() bool { return true } -// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) +// UnmarshalReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } @@ -80804,11 +86761,7 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(m map[st if err != nil { return } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -80816,107 +86769,55 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(m map[st return } -// NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct -// This model "extends" NetworkACLRulePrototype -type NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` +// ReservedIPTargetEndpointGatewayReference : ReservedIPTargetEndpointGatewayReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetEndpointGatewayReference struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` - // The ICMP traffic code to match. - // - // If specified, `type` must also be specified. If unspecified, all codes are matched. - Code *int64 `json:"code,omitempty"` + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + Name *string `json:"name" validate:"required"` - // The ICMP traffic type to match. - // - // If unspecified, all types are matched. - Type *int64 `json:"type,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Protocol property. -// The protocol to enforce. +// Constants associated with the ReservedIPTargetEndpointGatewayReference.ResourceType property. +// The resource type. const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" + ReservedIPTargetEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" ) -// NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) isaNetworkACLRulePrototype() bool { +func (*ReservedIPTargetEndpointGatewayReference) isaReservedIPTarget() bool { return true } -// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) +// UnmarshalReservedIPTargetEndpointGatewayReference unmarshals an instance of ReservedIPTargetEndpointGatewayReference from the specified map of raw messages. +func UnmarshalReservedIPTargetEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetEndpointGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } @@ -80924,19 +86825,50 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(m map[s if err != nil { return } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "code", &obj.Code) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetGenericResourceReference : Identifying information for a resource that is not native to the VPC API. +// This model "extends" ReservedIPTarget +type ReservedIPTargetGenericResourceReference struct { + // The CRN for the resource. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *GenericResourceReferenceDeleted `json:"deleted,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetGenericResourceReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetGenericResourceReferenceResourceTypeCloudResourceConst = "cloud_resource" +) + +func (*ReservedIPTargetGenericResourceReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetGenericResourceReference unmarshals an instance of ReservedIPTargetGenericResourceReference from the specified map of raw messages. +func UnmarshalReservedIPTargetGenericResourceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetGenericResourceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalGenericResourceReferenceDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -80944,110 +86876,55 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(m map[s return } -// NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct -// This model "extends" NetworkACLRulePrototype -type NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` +// ReservedIPTargetLoadBalancerReference : ReservedIPTargetLoadBalancerReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetLoadBalancerReference struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` + // The name for this load balancer. The name is unique across all load balancers in the VPC. + Name *string `json:"name" validate:"required"` - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Protocol property. -// The protocol to enforce. +// Constants associated with the ReservedIPTargetLoadBalancerReference.ResourceType property. +// The resource type. const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" + ReservedIPTargetLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" ) -// NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) isaNetworkACLRulePrototype() bool { +func (*ReservedIPTargetLoadBalancerReference) isaReservedIPTarget() bool { return true } -// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) +// UnmarshalReservedIPTargetLoadBalancerReference unmarshals an instance of ReservedIPTargetLoadBalancerReference from the specified map of raw messages. +func UnmarshalReservedIPTargetLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetLoadBalancerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } @@ -81055,27 +86932,64 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(m map if err != nil { return } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetNetworkInterfaceReferenceTargetContext : ReservedIPTargetNetworkInterfaceReferenceTargetContext struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this instance network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance network interface. + ID *string `json:"id" validate:"required"` + + // The name for this instance network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + ReservedIPTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*ReservedIPTargetNetworkInterfaceReferenceTargetContext) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -81083,93 +86997,47 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(m map return } -// NetworkACLRuleNetworkACLRuleProtocolAll : NetworkACLRuleNetworkACLRuleProtocolAll struct -// This model "extends" NetworkACLRule -type NetworkACLRuleNetworkACLRuleProtocolAll struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` +// ReservedIPTargetVPNGatewayReference : ReservedIPTargetVPNGatewayReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetVPNGatewayReference struct { + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network ACL rule. + // The VPN gateway's canonical URL. Href *string `json:"href" validate:"required"` - // The unique identifier for this network ACL rule. + // The unique identifier for this VPN gateway. ID *string `json:"id" validate:"required"` - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. Name *string `json:"name" validate:"required"` - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolAllActionAllowConst = "allow" - NetworkACLRuleNetworkACLRuleProtocolAllActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" - NetworkACLRuleNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Protocol property. -// The protocol to enforce. +// Constants associated with the ReservedIPTargetVPNGatewayReference.ResourceType property. +// The resource type. const ( - NetworkACLRuleNetworkACLRuleProtocolAllProtocolAllConst = "all" + ReservedIPTargetVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" ) -func (*NetworkACLRuleNetworkACLRuleProtocolAll) isaNetworkACLRule() bool { +func (*ReservedIPTargetVPNGatewayReference) isaReservedIPTarget() bool { return true } -// UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolAll from the specified map of raw messages. -func UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleNetworkACLRuleProtocolAll) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) +// UnmarshalReservedIPTargetVPNGatewayReference unmarshals an instance of ReservedIPTargetVPNGatewayReference from the specified map of raw messages. +func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetVPNGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) if err != nil { return } @@ -81181,19 +87049,11 @@ func UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll(m map[string]json.RawMessa if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -81201,135 +87061,127 @@ func UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll(m map[string]json.RawMessa return } -// NetworkACLRuleNetworkACLRuleProtocolIcmp : NetworkACLRuleNetworkACLRuleProtocolIcmp struct -// This model "extends" NetworkACLRule -type NetworkACLRuleNetworkACLRuleProtocolIcmp struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` +// ReservedIPTargetVPNServerReference : ReservedIPTargetVPNServerReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network ACL rule. + // The URL for this VPN server. Href *string `json:"href" validate:"required"` - // The unique identifier for this network ACL rule. + // The unique identifier for this VPN server. ID *string `json:"id" validate:"required"` - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. + // The name for this VPN server. The name is unique across all VPN servers in the VPC. Name *string `json:"name" validate:"required"` - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The ICMP traffic code to match. - // - // If absent, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The ICMP traffic type to match. - // - // If absent, all types are matched. - Type *int64 `json:"type,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolIcmpActionAllowConst = "allow" - NetworkACLRuleNetworkACLRuleProtocolIcmpActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" - NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Protocol property. -// The protocol to enforce. +// Constants associated with the ReservedIPTargetVPNServerReference.ResourceType property. +// The resource type. const ( - NetworkACLRuleNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" + ReservedIPTargetVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" ) -func (*NetworkACLRuleNetworkACLRuleProtocolIcmp) isaNetworkACLRule() bool { +func (*ReservedIPTargetVPNServerReference) isaReservedIPTarget() bool { return true } -// UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolIcmp from the specified map of raw messages. -func UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleNetworkACLRuleProtocolIcmp) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) +// UnmarshalReservedIPTargetVPNServerReference unmarshals an instance of ReservedIPTargetVPNServerReference from the specified map of raw messages. +func UnmarshalReservedIPTargetVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext : ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext.ResourceType property. +// The resource type. +const ( + ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +func (*ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext unmarshals an instance of ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext from the specified map of raw messages. +func UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "code", &obj.Code) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -81337,106 +87189,78 @@ func UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp(m map[string]json.RawMess return } -// NetworkACLRuleNetworkACLRuleProtocolTcpudp : NetworkACLRuleNetworkACLRuleProtocolTcpudp struct -// This model "extends" NetworkACLRule -type NetworkACLRuleNetworkACLRuleProtocolTcpudp struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` +// ResourceGroupIdentityByID : ResourceGroupIdentityByID struct +// This model "extends" ResourceGroupIdentity +type ResourceGroupIdentityByID struct { + // The unique identifier for this resource group. + ID *string `json:"id" validate:"required"` +} - // The rule that this rule is immediately before. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` +// NewResourceGroupIdentityByID : Instantiate ResourceGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewResourceGroupIdentityByID(id string) (_model *ResourceGroupIdentityByID, err error) { + _model = &ResourceGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` +func (*ResourceGroupIdentityByID) isaResourceGroupIdentity() bool { + return true +} - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` +// UnmarshalResourceGroupIdentityByID unmarshals an instance of ResourceGroupIdentityByID from the specified map of raw messages. +func UnmarshalResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` +// RouteCreatorVPNGatewayReference : RouteCreatorVPNGatewayReference struct +// This model "extends" RouteCreator +type RouteCreatorVPNGatewayReference struct { + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` - // The URL for this network ACL rule. + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The VPN gateway's canonical URL. Href *string `json:"href" validate:"required"` - // The unique identifier for this network ACL rule. + // The unique identifier for this VPN gateway. ID *string `json:"id" validate:"required"` - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. Name *string `json:"name" validate:"required"` - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max" validate:"required"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min" validate:"required"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" - NetworkACLRuleNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" - NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. +// Constants associated with the RouteCreatorVPNGatewayReference.ResourceType property. +// The resource type. const ( - NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" - NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" + RouteCreatorVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" ) -func (*NetworkACLRuleNetworkACLRuleProtocolTcpudp) isaNetworkACLRule() bool { +func (*RouteCreatorVPNGatewayReference) isaRouteCreator() bool { return true } -// UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolTcpudp from the specified map of raw messages. -func UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleNetworkACLRuleProtocolTcpudp) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) +// UnmarshalRouteCreatorVPNGatewayReference unmarshals an instance of RouteCreatorVPNGatewayReference from the specified map of raw messages. +func UnmarshalRouteCreatorVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreatorVPNGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) if err != nil { return } @@ -81448,35 +87272,75 @@ func UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp(m map[string]json.RawMe if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCreatorVPNServerReference : RouteCreatorVPNServerReference struct +// This model "extends" RouteCreator +type RouteCreatorVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` + + // The name for this VPN server. The name is unique across all VPN servers in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RouteCreatorVPNServerReference.ResourceType property. +// The resource type. +const ( + RouteCreatorVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" +) + +func (*RouteCreatorVPNServerReference) isaRouteCreator() bool { + return true +} + +// UnmarshalRouteCreatorVPNServerReference unmarshals an instance of RouteCreatorVPNServerReference from the specified map of raw messages. +func UnmarshalRouteCreatorVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreatorVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -81484,40 +87348,25 @@ func UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp(m map[string]json.RawMe return } -// NetworkInterfaceIPPrototypeReservedIPIdentity : Identifies a reserved IP by a unique property. -// Models which "extend" this model: -// - NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID -// - NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref -// This model "extends" NetworkInterfaceIPPrototype -type NetworkInterfaceIPPrototypeReservedIPIdentity struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` -} - -func (*NetworkInterfaceIPPrototypeReservedIPIdentity) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { - return true -} - -type NetworkInterfaceIPPrototypeReservedIPIdentityIntf interface { - NetworkInterfaceIPPrototypeIntf - isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool +// RouteNextHopIP : RouteNextHopIP struct +// This model "extends" RouteNextHop +type RouteNextHopIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` } -func (*NetworkInterfaceIPPrototypeReservedIPIdentity) isaNetworkInterfaceIPPrototype() bool { +func (*RouteNextHopIP) isaRouteNextHop() bool { return true } -// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentity from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototypeReservedIPIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalRouteNextHopIP unmarshals an instance of RouteNextHopIP from the specified map of raw messages. +func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } @@ -81525,102 +87374,78 @@ func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity(m map[string]json.Ra return } -// NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext : NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext struct -// This model "extends" NetworkInterfaceIPPrototype -type NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext struct { - // The IP address to reserve, which must not already be reserved on the subnet. +// RouteNextHopPatchRouteNextHopIP : RouteNextHopPatchRouteNextHopIP struct +// Models which "extend" this model: +// - RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP +// - RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP +// This model "extends" RouteNextHopPatch +type RouteNextHopPatchRouteNextHopIP struct { + // The sentinel IP address (`0.0.0.0`). // - // If unspecified, an available address on the subnet will automatically be selected. + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. Address *string `json:"address,omitempty"` +} - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` +func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatchRouteNextHopIP() bool { + return true +} - // The name for this reserved IP. The name must not be used by another reserved IP in the 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"` +type RouteNextHopPatchRouteNextHopIPIntf interface { + RouteNextHopPatchIntf + isaRouteNextHopPatchRouteNextHopIP() bool } -func (*NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) isaNetworkInterfaceIPPrototype() bool { +func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatch() bool { return true } -// UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) +// UnmarshalRouteNextHopPatchRouteNextHopIP unmarshals an instance of RouteNextHopPatchRouteNextHopIP from the specified map of raw messages. +func UnmarshalRouteNextHopPatchRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchRouteNextHopIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// OperatingSystemIdentityByHref : OperatingSystemIdentityByHref struct -// This model "extends" OperatingSystemIdentity -type OperatingSystemIdentityByHref struct { - // The URL for this operating system. - Href *string `json:"href" validate:"required"` -} +// RouteNextHopPatchVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. +// Models which "extend" this model: +// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID +// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref +// This model "extends" RouteNextHopPatch +type RouteNextHopPatchVPNGatewayConnectionIdentity struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` -// NewOperatingSystemIdentityByHref : Instantiate OperatingSystemIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewOperatingSystemIdentityByHref(href string) (_model *OperatingSystemIdentityByHref, err error) { - _model = &OperatingSystemIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` } -func (*OperatingSystemIdentityByHref) isaOperatingSystemIdentity() bool { +func (*RouteNextHopPatchVPNGatewayConnectionIdentity) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { return true } -// UnmarshalOperatingSystemIdentityByHref unmarshals an instance of OperatingSystemIdentityByHref from the specified map of raw messages. -func UnmarshalOperatingSystemIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// OperatingSystemIdentityByName : OperatingSystemIdentityByName struct -// This model "extends" OperatingSystemIdentity -type OperatingSystemIdentityByName struct { - // The globally unique name for this operating system. - Name *string `json:"name" validate:"required"` -} - -// NewOperatingSystemIdentityByName : Instantiate OperatingSystemIdentityByName (Generic Model Constructor) -func (*VpcV1) NewOperatingSystemIdentityByName(name string) (_model *OperatingSystemIdentityByName, err error) { - _model = &OperatingSystemIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - return +type RouteNextHopPatchVPNGatewayConnectionIdentityIntf interface { + RouteNextHopPatchIntf + isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool } -func (*OperatingSystemIdentityByName) isaOperatingSystemIdentity() bool { +func (*RouteNextHopPatchVPNGatewayConnectionIdentity) isaRouteNextHopPatch() bool { return true } -// UnmarshalOperatingSystemIdentityByName unmarshals an instance of OperatingSystemIdentityByName from the specified map of raw messages. -func UnmarshalOperatingSystemIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentity from the specified map of raw messages. +func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchVPNGatewayConnectionIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -81628,56 +87453,56 @@ func UnmarshalOperatingSystemIdentityByName(m map[string]json.RawMessage, result return } -// PublicGatewayFloatingIPPrototypeFloatingIPIdentity : Identifies a floating IP by a unique property. -// Models which "extend" this model: -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress -// This model "extends" PublicGatewayFloatingIPPrototype -type PublicGatewayFloatingIPPrototypeFloatingIPIdentity struct { - // The unique identifier for this floating IP. - ID *string `json:"id,omitempty"` +// RouteNextHopVPNGatewayConnectionReference : RouteNextHopVPNGatewayConnectionReference struct +// This model "extends" RouteNextHop +type RouteNextHopVPNGatewayConnectionReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` - // The CRN for this floating IP. - CRN *string `json:"crn,omitempty"` + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` - // The URL for this floating IP. - Href *string `json:"href,omitempty"` + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` - // The globally unique IP address. - Address *string `json:"address,omitempty"` -} + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { - return true + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -type PublicGatewayFloatingIPPrototypeFloatingIPIdentityIntf interface { - PublicGatewayFloatingIPPrototypeIntf - isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool -} +// Constants associated with the RouteNextHopVPNGatewayConnectionReference.ResourceType property. +// The resource type. +const ( + RouteNextHopVPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototype() bool { +func (*RouteNextHopVPNGatewayConnectionReference) isaRouteNextHop() bool { return true } -// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentity from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalRouteNextHopVPNGatewayConnectionReference unmarshals an instance of RouteNextHopVPNGatewayConnectionReference from the specified map of raw messages. +func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopVPNGatewayConnectionReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -81685,30 +87510,37 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity(m map[string]js return } -// PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext : PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct -// This model "extends" PublicGatewayFloatingIPPrototype -type PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct { - // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` +// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct +// Models which "extend" this model: +// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP +// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP +// This model "extends" RoutePrototypeNextHop +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` +} - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { + return true } -func (*PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) isaPublicGatewayFloatingIPPrototype() bool { +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPIntf interface { + RoutePrototypeNextHopIntf + isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHop() bool { return true } -// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } @@ -81716,30 +87548,40 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext(m return } -// PublicGatewayIdentityPublicGatewayIdentityByCRN : PublicGatewayIdentityPublicGatewayIdentityByCRN struct -// This model "extends" PublicGatewayIdentity -type PublicGatewayIdentityPublicGatewayIdentityByCRN struct { - // The CRN for this public gateway. - CRN *string `json:"crn" validate:"required"` +// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. +// Models which "extend" this model: +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref +// This model "extends" RoutePrototypeNextHop +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` } -// NewPublicGatewayIdentityPublicGatewayIdentityByCRN : Instantiate PublicGatewayIdentityPublicGatewayIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByCRN(crn string) (_model *PublicGatewayIdentityPublicGatewayIdentityByCRN, err error) { - _model = &PublicGatewayIdentityPublicGatewayIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true } -func (*PublicGatewayIdentityPublicGatewayIdentityByCRN) isaPublicGatewayIdentity() bool { +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityIntf interface { + RoutePrototypeNextHopIntf + isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHop() bool { return true } -// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByCRN from the specified map of raw messages. -func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayIdentityPublicGatewayIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -81747,29 +87589,29 @@ func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN(m map[string]json. return } -// PublicGatewayIdentityPublicGatewayIdentityByHref : PublicGatewayIdentityPublicGatewayIdentityByHref struct -// This model "extends" PublicGatewayIdentity -type PublicGatewayIdentityPublicGatewayIdentityByHref struct { - // The URL for this public gateway. +// RoutingTableIdentityByHref : RoutingTableIdentityByHref struct +// This model "extends" RoutingTableIdentity +type RoutingTableIdentityByHref struct { + // The URL for this routing table. Href *string `json:"href" validate:"required"` } -// NewPublicGatewayIdentityPublicGatewayIdentityByHref : Instantiate PublicGatewayIdentityPublicGatewayIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByHref(href string) (_model *PublicGatewayIdentityPublicGatewayIdentityByHref, err error) { - _model = &PublicGatewayIdentityPublicGatewayIdentityByHref{ +// NewRoutingTableIdentityByHref : Instantiate RoutingTableIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRoutingTableIdentityByHref(href string) (_model *RoutingTableIdentityByHref, err error) { + _model = &RoutingTableIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*PublicGatewayIdentityPublicGatewayIdentityByHref) isaPublicGatewayIdentity() bool { +func (*RoutingTableIdentityByHref) isaRoutingTableIdentity() bool { return true } -// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByHref from the specified map of raw messages. -func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayIdentityPublicGatewayIdentityByHref) +// UnmarshalRoutingTableIdentityByHref unmarshals an instance of RoutingTableIdentityByHref from the specified map of raw messages. +func UnmarshalRoutingTableIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -81778,29 +87620,29 @@ func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref(m map[string]json return } -// PublicGatewayIdentityPublicGatewayIdentityByID : PublicGatewayIdentityPublicGatewayIdentityByID struct -// This model "extends" PublicGatewayIdentity -type PublicGatewayIdentityPublicGatewayIdentityByID struct { - // The unique identifier for this public gateway. +// RoutingTableIdentityByID : RoutingTableIdentityByID struct +// This model "extends" RoutingTableIdentity +type RoutingTableIdentityByID struct { + // The unique identifier for this routing table. ID *string `json:"id" validate:"required"` } -// NewPublicGatewayIdentityPublicGatewayIdentityByID : Instantiate PublicGatewayIdentityPublicGatewayIdentityByID (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByID(id string) (_model *PublicGatewayIdentityPublicGatewayIdentityByID, err error) { - _model = &PublicGatewayIdentityPublicGatewayIdentityByID{ +// NewRoutingTableIdentityByID : Instantiate RoutingTableIdentityByID (Generic Model Constructor) +func (*VpcV1) NewRoutingTableIdentityByID(id string) (_model *RoutingTableIdentityByID, err error) { + _model = &RoutingTableIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*PublicGatewayIdentityPublicGatewayIdentityByID) isaPublicGatewayIdentity() bool { +func (*RoutingTableIdentityByID) isaRoutingTableIdentity() bool { return true } -// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByID from the specified map of raw messages. -func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayIdentityPublicGatewayIdentityByID) +// UnmarshalRoutingTableIdentityByID unmarshals an instance of RoutingTableIdentityByID from the specified map of raw messages. +func UnmarshalRoutingTableIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -81809,30 +87651,30 @@ func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID(m map[string]json.R return } -// RegionIdentityByHref : RegionIdentityByHref struct -// This model "extends" RegionIdentity -type RegionIdentityByHref struct { - // The URL for this region. - Href *string `json:"href" validate:"required"` +// SecurityGroupIdentityByCRN : SecurityGroupIdentityByCRN struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByCRN struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` } -// NewRegionIdentityByHref : Instantiate RegionIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewRegionIdentityByHref(href string) (_model *RegionIdentityByHref, err error) { - _model = &RegionIdentityByHref{ - Href: core.StringPtr(href), +// NewSecurityGroupIdentityByCRN : Instantiate SecurityGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupIdentityByCRN, err error) { + _model = &SecurityGroupIdentityByCRN{ + CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") return } -func (*RegionIdentityByHref) isaRegionIdentity() bool { +func (*SecurityGroupIdentityByCRN) isaSecurityGroupIdentity() bool { return true } -// UnmarshalRegionIdentityByHref unmarshals an instance of RegionIdentityByHref from the specified map of raw messages. -func UnmarshalRegionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalSecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } @@ -81840,30 +87682,30 @@ func UnmarshalRegionIdentityByHref(m map[string]json.RawMessage, result interfac return } -// RegionIdentityByName : RegionIdentityByName struct -// This model "extends" RegionIdentity -type RegionIdentityByName struct { - // The globally unique name for this region. - Name *string `json:"name" validate:"required"` +// SecurityGroupIdentityByHref : SecurityGroupIdentityByHref struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByHref struct { + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` } -// NewRegionIdentityByName : Instantiate RegionIdentityByName (Generic Model Constructor) -func (*VpcV1) NewRegionIdentityByName(name string) (_model *RegionIdentityByName, err error) { - _model = &RegionIdentityByName{ - Name: core.StringPtr(name), +// NewSecurityGroupIdentityByHref : Instantiate SecurityGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByHref(href string) (_model *SecurityGroupIdentityByHref, err error) { + _model = &SecurityGroupIdentityByHref{ + Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*RegionIdentityByName) isaRegionIdentity() bool { +func (*SecurityGroupIdentityByHref) isaSecurityGroupIdentity() bool { return true } -// UnmarshalRegionIdentityByName unmarshals an instance of RegionIdentityByName from the specified map of raw messages. -func UnmarshalRegionIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionIdentityByName) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +// UnmarshalSecurityGroupIdentityByHref unmarshals an instance of SecurityGroupIdentityByHref from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -81871,112 +87713,111 @@ func UnmarshalRegionIdentityByName(m map[string]json.RawMessage, result interfac return } -// ReservedIPTargetPrototypeEndpointGatewayIdentity : ReservedIPTargetPrototypeEndpointGatewayIdentity struct -// Models which "extend" this model: -// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID -// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN -// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref -// This model "extends" ReservedIPTargetPrototype -type ReservedIPTargetPrototypeEndpointGatewayIdentity struct { - // The unique identifier for this endpoint gateway. - ID *string `json:"id,omitempty"` - - // The CRN for this endpoint gateway. - CRN *string `json:"crn,omitempty"` - - // The URL for this endpoint gateway. - Href *string `json:"href,omitempty"` -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { - return true +// SecurityGroupIdentityByID : SecurityGroupIdentityByID struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByID struct { + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` } -type ReservedIPTargetPrototypeEndpointGatewayIdentityIntf interface { - ReservedIPTargetPrototypeIntf - isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool +// NewSecurityGroupIdentityByID : Instantiate SecurityGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByID(id string) (_model *SecurityGroupIdentityByID, err error) { + _model = &SecurityGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return } -func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototype() bool { +func (*SecurityGroupIdentityByID) isaSecurityGroupIdentity() bool { return true } -// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentity from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentity) +// UnmarshalSecurityGroupIdentityByID unmarshals an instance of SecurityGroupIdentityByID from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// ReservedIPTargetEndpointGatewayReference : ReservedIPTargetEndpointGatewayReference struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetEndpointGatewayReference struct { - // The CRN for this endpoint gateway. - CRN *string `json:"crn" validate:"required"` +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` - // The URL for this endpoint gateway. - Href *string `json:"href" validate:"required"` + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` - // The unique identifier for this endpoint gateway. - ID *string `json:"id" validate:"required"` + // 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. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` +} - // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. - Name *string `json:"name" validate:"required"` +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" +) - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" +) -// Constants associated with the ReservedIPTargetEndpointGatewayReference.ResourceType property. -// The resource type. +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Protocol property. +// The protocol to enforce. const ( - ReservedIPTargetEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllProtocolAllConst = "all" ) -func (*ReservedIPTargetEndpointGatewayReference) isaReservedIPTarget() bool { +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll, err error) { + _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) isaSecurityGroupRulePrototype() bool { return true } -// UnmarshalReservedIPTargetEndpointGatewayReference unmarshals an instance of ReservedIPTargetEndpointGatewayReference from the specified map of raw messages. -func UnmarshalReservedIPTargetEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetEndpointGatewayReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) if err != nil { return } @@ -81984,42 +87825,98 @@ func UnmarshalReservedIPTargetEndpointGatewayReference(m map[string]json.RawMess return } -// ReservedIPTargetGenericResourceReference : Identifying information for a resource that is not native to the VPC API. -// This model "extends" ReservedIPTarget -type ReservedIPTargetGenericResourceReference struct { - // The CRN for the resource. - CRN *string `json:"crn" validate:"required"` +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { + // The ICMP traffic code to allow. + // + // If specified, `type` must also be specified. If unspecified, all codes are allowed. + Code *int64 `json:"code,omitempty"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *GenericResourceReferenceDeleted `json:"deleted,omitempty"` + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // 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. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The ICMP traffic type to allow. + // + // If unspecified, all types are allowed. + Type *int64 `json:"type,omitempty"` } -// Constants associated with the ReservedIPTargetGenericResourceReference.ResourceType property. -// The resource type. +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Direction property. +// The direction of traffic to enforce. const ( - ReservedIPTargetGenericResourceReferenceResourceTypeCloudResourceConst = "cloud_resource" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" ) -func (*ReservedIPTargetGenericResourceReference) isaReservedIPTarget() bool { +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp, err error) { + _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) isaSecurityGroupRulePrototype() bool { return true } -// UnmarshalReservedIPTargetGenericResourceReference unmarshals an instance of ReservedIPTargetGenericResourceReference from the specified map of raw messages. -func UnmarshalReservedIPTargetGenericResourceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetGenericResourceReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalGenericResourceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -82027,63 +87924,104 @@ func UnmarshalReservedIPTargetGenericResourceReference(m map[string]json.RawMess return } -// ReservedIPTargetLoadBalancerReference : ReservedIPTargetLoadBalancerReference struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetLoadBalancerReference struct { - // The load balancer's CRN. - CRN *string `json:"crn" validate:"required"` +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. +// +// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all destination ports are +// allowed for the protocol. When both have the same value, that single destination port is allowed. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` - // The load balancer's canonical URL. - Href *string `json:"href" validate:"required"` + // The inclusive upper bound of TCP/UDP destination port range. + // + // If specified, `port_min` must also be specified, and must not be larger. If unspecified, + // `port_min` must also be unspecified, allowing traffic on all destination ports. + PortMax *int64 `json:"port_max,omitempty"` - // The unique identifier for this load balancer. - ID *string `json:"id" validate:"required"` + // The inclusive lower bound of TCP/UDP destination port range + // + // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be + // unspecified, allowing traffic on all destination ports. + PortMin *int64 `json:"port_min,omitempty"` - // The name for this load balancer. The name is unique across all load balancers in the VPC. - Name *string `json:"name" validate:"required"` + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // 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. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` } -// Constants associated with the ReservedIPTargetLoadBalancerReference.ResourceType property. -// The resource type. +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Direction property. +// The direction of traffic to enforce. const ( - ReservedIPTargetLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" ) -func (*ReservedIPTargetLoadBalancerReference) isaReservedIPTarget() bool { +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp, err error) { + _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRulePrototype() bool { return true } -// UnmarshalReservedIPTargetLoadBalancerReference unmarshals an instance of ReservedIPTargetLoadBalancerReference from the specified map of raw messages. -func UnmarshalReservedIPTargetLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetLoadBalancerReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) if err != nil { return } @@ -82091,56 +88029,67 @@ func UnmarshalReservedIPTargetLoadBalancerReference(m map[string]json.RawMessage return } -// ReservedIPTargetNetworkInterfaceReferenceTargetContext : ReservedIPTargetNetworkInterfaceReferenceTargetContext struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // The URL for this network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network interface. - ID *string `json:"id" validate:"required"` - - // The name for this network interface. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` +// SecurityGroupRuleRemotePatchCIDR : SecurityGroupRuleRemotePatchCIDR struct +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` } -// Constants associated with the ReservedIPTargetNetworkInterfaceReferenceTargetContext.ResourceType property. -// The resource type. -const ( - ReservedIPTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" -) +// NewSecurityGroupRuleRemotePatchCIDR : Instantiate SecurityGroupRuleRemotePatchCIDR (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchCIDR(cidrBlock string) (_model *SecurityGroupRuleRemotePatchCIDR, err error) { + _model = &SecurityGroupRuleRemotePatchCIDR{ + CIDRBlock: core.StringPtr(cidrBlock), + } + err = core.ValidateStruct(_model, "required parameters") + return +} -func (*ReservedIPTargetNetworkInterfaceReferenceTargetContext) isaReservedIPTarget() bool { +func (*SecurityGroupRuleRemotePatchCIDR) isaSecurityGroupRuleRemotePatch() bool { return true } -// UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. -func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalSecurityGroupRuleRemotePatchCIDR unmarshals an instance of SecurityGroupRuleRemotePatchCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchIP : SecurityGroupRuleRemotePatchIP struct +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchIP : Instantiate SecurityGroupRuleRemotePatchIP (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchIP(address string) (_model *SecurityGroupRuleRemotePatchIP, err error) { + _model = &SecurityGroupRuleRemotePatchIP{ + Address: core.StringPtr(address), } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchIP) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchIP unmarshals an instance of SecurityGroupRuleRemotePatchIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } @@ -82148,47 +88097,44 @@ func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[strin return } -// ReservedIPTargetVPNGatewayReference : ReservedIPTargetVPNGatewayReference struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetVPNGatewayReference struct { - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The VPN gateway's canonical URL. - Href *string `json:"href" validate:"required"` +// SecurityGroupRuleRemotePatchSecurityGroupIdentity : Identifies a security group by a unique property. +// Models which "extend" this model: +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchSecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` - // The unique identifier for this VPN gateway. - ID *string `json:"id" validate:"required"` + // The security group's CRN. + CRN *string `json:"crn,omitempty"` - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name" validate:"required"` + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true } -// Constants associated with the ReservedIPTargetVPNGatewayReference.ResourceType property. -// The resource type. -const ( - ReservedIPTargetVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" -) +type SecurityGroupRuleRemotePatchSecurityGroupIdentityIntf interface { + SecurityGroupRuleRemotePatchIntf + isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool +} -func (*ReservedIPTargetVPNGatewayReference) isaReservedIPTarget() bool { +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatch() bool { return true } -// UnmarshalReservedIPTargetVPNGatewayReference unmarshals an instance of ReservedIPTargetVPNGatewayReference from the specified map of raw messages. -func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetVPNGatewayReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } @@ -82196,15 +88142,36 @@ func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeCIDR : SecurityGroupRuleRemotePrototypeCIDR struct +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeCIDR : Instantiate SecurityGroupRuleRemotePrototypeCIDR (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeCIDR(cidrBlock string) (_model *SecurityGroupRuleRemotePrototypeCIDR, err error) { + _model = &SecurityGroupRuleRemotePrototypeCIDR{ + CIDRBlock: core.StringPtr(cidrBlock), } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeCIDR) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeCIDR unmarshals an instance of SecurityGroupRuleRemotePrototypeCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { return } @@ -82212,63 +88179,83 @@ func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, return } -// ReservedIPTargetVPNServerReference : ReservedIPTargetVPNServerReference struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetVPNServerReference struct { - // The CRN for this VPN server. - CRN *string `json:"crn" validate:"required"` +// SecurityGroupRuleRemotePrototypeIP : SecurityGroupRuleRemotePrototypeIP struct +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` +// NewSecurityGroupRuleRemotePrototypeIP : Instantiate SecurityGroupRuleRemotePrototypeIP (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeIP(address string) (_model *SecurityGroupRuleRemotePrototypeIP, err error) { + _model = &SecurityGroupRuleRemotePrototypeIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeIP) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeIP unmarshals an instance of SecurityGroupRuleRemotePrototypeIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The URL for this VPN server. - Href *string `json:"href" validate:"required"` +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentity : Identifies a security group by a unique property. +// Models which "extend" this model: +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` - // The unique identifier for this VPN server. - ID *string `json:"id" validate:"required"` + // The security group's CRN. + CRN *string `json:"crn,omitempty"` - // The name for this VPN server. The name is unique across all VPN servers in the VPC. - Name *string `json:"name" validate:"required"` + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true } -// Constants associated with the ReservedIPTargetVPNServerReference.ResourceType property. -// The resource type. -const ( - ReservedIPTargetVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" -) +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentityIntf interface { + SecurityGroupRuleRemotePrototypeIntf + isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool +} -func (*ReservedIPTargetVPNServerReference) isaReservedIPTarget() bool { +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototype() bool { return true } -// UnmarshalReservedIPTargetVPNServerReference unmarshals an instance of ReservedIPTargetVPNServerReference from the specified map of raw messages. -func UnmarshalReservedIPTargetVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetVPNServerReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -82276,30 +88263,49 @@ func UnmarshalReservedIPTargetVPNServerReference(m map[string]json.RawMessage, r return } -// ResourceGroupIdentityByID : ResourceGroupIdentityByID struct -// This model "extends" ResourceGroupIdentity -type ResourceGroupIdentityByID struct { - // The unique identifier for this resource group. - ID *string `json:"id" validate:"required"` +// SecurityGroupRuleRemoteCIDR : SecurityGroupRuleRemoteCIDR struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` } -// NewResourceGroupIdentityByID : Instantiate ResourceGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewResourceGroupIdentityByID(id string) (_model *ResourceGroupIdentityByID, err error) { - _model = &ResourceGroupIdentityByID{ - ID: core.StringPtr(id), +func (*SecurityGroupRuleRemoteCIDR) isaSecurityGroupRuleRemote() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemoteCIDR unmarshals an instance of SecurityGroupRuleRemoteCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -func (*ResourceGroupIdentityByID) isaResourceGroupIdentity() bool { +// SecurityGroupRuleRemoteIP : SecurityGroupRuleRemoteIP struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*SecurityGroupRuleRemoteIP) isaSecurityGroupRuleRemote() bool { return true } -// UnmarshalResourceGroupIdentityByID unmarshals an instance of ResourceGroupIdentityByID from the specified map of raw messages. -func UnmarshalResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResourceGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalSecurityGroupRuleRemoteIP unmarshals an instance of SecurityGroupRuleRemoteIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } @@ -82307,47 +88313,38 @@ func UnmarshalResourceGroupIdentityByID(m map[string]json.RawMessage, result int return } -// RouteCreatorVPNGatewayReference : RouteCreatorVPNGatewayReference struct -// This model "extends" RouteCreator -type RouteCreatorVPNGatewayReference struct { - // The VPN gateway's CRN. +// SecurityGroupRuleRemoteSecurityGroupReference : SecurityGroupRuleRemoteSecurityGroupReference struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteSecurityGroupReference struct { + // The security group's CRN. CRN *string `json:"crn" validate:"required"` // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` - // The VPN gateway's canonical URL. + // The security group's canonical URL. Href *string `json:"href" validate:"required"` - // The unique identifier for this VPN gateway. + // The unique identifier for this security group. ID *string `json:"id" validate:"required"` - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. + // The name for this security group. The name is unique across all security groups for the VPC. Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the RouteCreatorVPNGatewayReference.ResourceType property. -// The resource type. -const ( - RouteCreatorVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" -) - -func (*RouteCreatorVPNGatewayReference) isaRouteCreator() bool { +func (*SecurityGroupRuleRemoteSecurityGroupReference) isaSecurityGroupRuleRemote() bool { return true } -// UnmarshalRouteCreatorVPNGatewayReference unmarshals an instance of RouteCreatorVPNGatewayReference from the specified map of raw messages. -func UnmarshalRouteCreatorVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCreatorVPNGatewayReference) +// UnmarshalSecurityGroupRuleRemoteSecurityGroupReference unmarshals an instance of SecurityGroupRuleRemoteSecurityGroupReference from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteSecurityGroupReference) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) if err != nil { return } @@ -82363,55 +88360,62 @@ func UnmarshalRouteCreatorVPNGatewayReference(m map[string]json.RawMessage, resu if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// RouteCreatorVPNServerReference : RouteCreatorVPNServerReference struct -// This model "extends" RouteCreator -type RouteCreatorVPNServerReference struct { - // The CRN for this VPN server. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` +// SecurityGroupRuleSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` - // The URL for this VPN server. + // The URL for this security group rule. Href *string `json:"href" validate:"required"` - // The unique identifier for this VPN server. + // The unique identifier for this security group rule. ID *string `json:"id" validate:"required"` - // The name for this VPN server. The name is unique across all VPN servers in the VPC. - Name *string `json:"name" validate:"required"` + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` } -// Constants associated with the RouteCreatorVPNServerReference.ResourceType property. -// The resource type. +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Direction property. +// The direction of traffic to enforce. const ( - RouteCreatorVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" + SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" ) -func (*RouteCreatorVPNServerReference) isaRouteCreator() bool { +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllProtocolAllConst = "all" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolAll) isaSecurityGroupRule() bool { return true } -// UnmarshalRouteCreatorVPNServerReference unmarshals an instance of RouteCreatorVPNServerReference from the specified map of raw messages. -func UnmarshalRouteCreatorVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCreatorVPNServerReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolAll from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { return } @@ -82423,37 +88427,15 @@ func UnmarshalRouteCreatorVPNServerReference(m map[string]json.RawMessage, resul if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopIP : RouteNextHopIP struct -// This model "extends" RouteNextHop -type RouteNextHopIP struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} - -func (*RouteNextHopIP) isaRouteNextHop() bool { - return true -} - -// UnmarshalRouteNextHopIP unmarshals an instance of RouteNextHopIP from the specified map of raw messages. -func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } @@ -82461,74 +88443,64 @@ func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) ( return } -// RouteNextHopPatchRouteNextHopIP : RouteNextHopPatchRouteNextHopIP struct -// Models which "extend" this model: -// - RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP -// - RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP -// This model "extends" RouteNextHopPatch -type RouteNextHopPatchRouteNextHopIP struct { - // The sentinel IP address (`0.0.0.0`). - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` -} +// SecurityGroupRuleSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` -func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatchRouteNextHopIP() bool { - return true -} + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` -type RouteNextHopPatchRouteNextHopIPIntf interface { - RouteNextHopPatchIntf - isaRouteNextHopPatchRouteNextHopIP() bool -} + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` -func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatch() bool { - return true -} + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` -// UnmarshalRouteNextHopPatchRouteNextHopIP unmarshals an instance of RouteNextHopPatchRouteNextHopIP from the specified map of raw messages. -func UnmarshalRouteNextHopPatchRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatchRouteNextHopIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` -// RouteNextHopPatchVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. -// Models which "extend" this model: -// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID -// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref -// This model "extends" RouteNextHopPatch -type RouteNextHopPatchVPNGatewayConnectionIdentity struct { - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` + // The ICMP traffic code to allow. If absent, all codes are allowed. + Code *int64 `json:"code,omitempty"` - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` -} + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` -func (*RouteNextHopPatchVPNGatewayConnectionIdentity) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { - return true + // The ICMP traffic type to allow. If absent, all types are allowed. + Type *int64 `json:"type,omitempty"` } -type RouteNextHopPatchVPNGatewayConnectionIdentityIntf interface { - RouteNextHopPatchIntf - isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool -} +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" +) -func (*RouteNextHopPatchVPNGatewayConnectionIdentity) isaRouteNextHopPatch() bool { +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolIcmp) isaSecurityGroupRule() bool { return true } -// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentity from the specified map of raw messages. -func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatchVPNGatewayConnectionIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { return } @@ -82536,60 +88508,27 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity(m map[string]json.Ra if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopVPNGatewayConnectionReference : RouteNextHopVPNGatewayConnectionReference struct -// This model "extends" RouteNextHop -type RouteNextHopVPNGatewayConnectionReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the RouteNextHopVPNGatewayConnectionReference.ResourceType property. -// The resource type. -const ( - RouteNextHopVPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -func (*RouteNextHopVPNGatewayConnectionReference) isaRouteNextHop() bool { - return true -} - -// UnmarshalRouteNextHopVPNGatewayConnectionReference unmarshals an instance of RouteNextHopVPNGatewayConnectionReference from the specified map of raw messages. -func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopVPNGatewayConnectionReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -82597,109 +88536,96 @@ func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMes return } -// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct -// Models which "extend" this model: -// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP -// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP -// This model "extends" RoutePrototypeNextHop -type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct { - // The sentinel IP address (`0.0.0.0`). - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` -} +// SecurityGroupRuleSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. +// +// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all destination ports are +// allowed for the protocol. When both have the same value, that single destination port is allowed. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { - return true -} + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` -type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPIntf interface { - RoutePrototypeNextHopIntf - isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool -} + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHop() bool { - return true -} + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` -// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. -// Models which "extend" this model: -// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID -// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref -// This model "extends" RoutePrototypeNextHop -type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity struct { - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` + // The inclusive upper bound of TCP/UDP destination port range. + PortMax *int64 `json:"port_max,omitempty"` - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` -} + // The inclusive lower bound of TCP/UDP destination port range. + PortMin *int64 `json:"port_min,omitempty"` -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { - return true + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` } -type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityIntf interface { - RoutePrototypeNextHopIntf - isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool -} +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHop() bool { +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRule() bool { return true } -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutingTableIdentityByHref : RoutingTableIdentityByHref struct -// This model "extends" RoutingTableIdentity -type RoutingTableIdentityByHref struct { - // The URL for this routing table. - Href *string `json:"href" validate:"required"` -} - -// NewRoutingTableIdentityByHref : Instantiate RoutingTableIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewRoutingTableIdentityByHref(href string) (_model *RoutingTableIdentityByHref, err error) { - _model = &RoutingTableIdentityByHref{ - Href: core.StringPtr(href), + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*RoutingTableIdentityByHref) isaRoutingTableIdentity() bool { - return true -} - -// UnmarshalRoutingTableIdentityByHref unmarshals an instance of RoutingTableIdentityByHref from the specified map of raw messages. -func UnmarshalRoutingTableIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } @@ -82707,204 +88633,241 @@ func UnmarshalRoutingTableIdentityByHref(m map[string]json.RawMessage, result in return } -// RoutingTableIdentityByID : RoutingTableIdentityByID struct -// This model "extends" RoutingTableIdentity -type RoutingTableIdentityByID struct { - // The unique identifier for this routing table. +// SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this bare metal server network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server network interface. ID *string `json:"id" validate:"required"` -} -// NewRoutingTableIdentityByID : Instantiate RoutingTableIdentityByID (Generic Model Constructor) -func (*VpcV1) NewRoutingTableIdentityByID(id string) (_model *RoutingTableIdentityByID, err error) { - _model = &RoutingTableIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return + // The name for this bare metal server network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -func (*RoutingTableIdentityByID) isaRoutingTableIdentity() bool { +// Constants associated with the SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { return true } -// UnmarshalRoutingTableIdentityByID unmarshals an instance of RoutingTableIdentityByID from the specified map of raw messages. -func UnmarshalRoutingTableIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableIdentityByID) +// UnmarshalSecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SecurityGroupIdentityByCRN : SecurityGroupIdentityByCRN struct -// This model "extends" SecurityGroupIdentity -type SecurityGroupIdentityByCRN struct { - // The security group's CRN. +// SecurityGroupTargetReferenceEndpointGatewayReference : SecurityGroupTargetReferenceEndpointGatewayReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceEndpointGatewayReference struct { + // The CRN for this endpoint gateway. CRN *string `json:"crn" validate:"required"` -} -// NewSecurityGroupIdentityByCRN : Instantiate SecurityGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupIdentityByCRN, err error) { - _model = &SecurityGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -func (*SecurityGroupIdentityByCRN) isaSecurityGroupIdentity() bool { +// Constants associated with the SecurityGroupTargetReferenceEndpointGatewayReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +func (*SecurityGroupTargetReferenceEndpointGatewayReference) isaSecurityGroupTargetReference() bool { return true } -// UnmarshalSecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalSecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupIdentityByCRN) +// UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference unmarshals an instance of SecurityGroupTargetReferenceEndpointGatewayReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceEndpointGatewayReference) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupIdentityByHref : SecurityGroupIdentityByHref struct -// This model "extends" SecurityGroupIdentity -type SecurityGroupIdentityByHref struct { - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewSecurityGroupIdentityByHref : Instantiate SecurityGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupIdentityByHref(href string) (_model *SecurityGroupIdentityByHref, err error) { - _model = &SecurityGroupIdentityByHref{ - Href: core.StringPtr(href), + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupIdentityByHref) isaSecurityGroupIdentity() bool { - return true -} - -// UnmarshalSecurityGroupIdentityByHref unmarshals an instance of SecurityGroupIdentityByHref from the specified map of raw messages. -func UnmarshalSecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SecurityGroupIdentityByID : SecurityGroupIdentityByID struct -// This model "extends" SecurityGroupIdentity -type SecurityGroupIdentityByID struct { - // The unique identifier for this security group. +// SecurityGroupTargetReferenceLoadBalancerReference : SecurityGroupTargetReferenceLoadBalancerReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceLoadBalancerReference struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` + + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer. ID *string `json:"id" validate:"required"` -} -// NewSecurityGroupIdentityByID : Instantiate SecurityGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupIdentityByID(id string) (_model *SecurityGroupIdentityByID, err error) { - _model = &SecurityGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return + // The name for this load balancer. The name is unique across all load balancers in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -func (*SecurityGroupIdentityByID) isaSecurityGroupIdentity() bool { +// Constants associated with the SecurityGroupTargetReferenceLoadBalancerReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" +) + +func (*SecurityGroupTargetReferenceLoadBalancerReference) isaSecurityGroupTargetReference() bool { return true } -// UnmarshalSecurityGroupIdentityByID unmarshals an instance of SecurityGroupIdentityByID from the specified map of raw messages. -func UnmarshalSecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupIdentityByID) +// UnmarshalSecurityGroupTargetReferenceLoadBalancerReference unmarshals an instance of SecurityGroupTargetReferenceLoadBalancerReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceLoadBalancerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. -// This model "extends" SecurityGroupRulePrototype -type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` +// SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` + // The URL for this instance network interface. + Href *string `json:"href" validate:"required"` - // The 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. - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source - // (or to any destination, for outbound rules). - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` -} + // The unique identifier for this instance network interface. + ID *string `json:"id" validate:"required"` -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" -) + // The name for this instance network interface. + Name *string `json:"name" validate:"required"` -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" -) + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Protocol property. -// The protocol to enforce. +// Constants associated with the SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllProtocolAllConst = "all" + SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" ) -// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll, err error) { - _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll{ - Direction: core.StringPtr(direction), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) isaSecurityGroupRulePrototype() bool { +func (*SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { return true } -// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll from the specified map of raw messages. -func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) +// UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -82912,98 +88875,63 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[strin return } -// SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. -// This model "extends" SecurityGroupRulePrototype -type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { - // The ICMP traffic code to allow. - // - // If specified, `type` must also be specified. If unspecified, all codes are allowed. - Code *int64 `json:"code,omitempty"` +// SecurityGroupTargetReferenceVPNServerReference : SecurityGroupTargetReferenceVPNServerReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` - // The 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. - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source - // (or to any destination, for outbound rules). - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + // The name for this VPN server. The name is unique across all VPN servers in the VPC. + Name *string `json:"name" validate:"required"` - // The ICMP traffic type to allow. - // - // If unspecified, all types are allowed. - Type *int64 `json:"type,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Protocol property. -// The protocol to enforce. +// Constants associated with the SecurityGroupTargetReferenceVPNServerReference.ResourceType property. +// The resource type. const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" + SecurityGroupTargetReferenceVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" ) -// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp, err error) { - _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp{ - Direction: core.StringPtr(direction), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) isaSecurityGroupRulePrototype() bool { +func (*SecurityGroupTargetReferenceVPNServerReference) isaSecurityGroupTargetReference() bool { return true } -// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp from the specified map of raw messages. -func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) +// UnmarshalSecurityGroupTargetReferenceVPNServerReference unmarshals an instance of SecurityGroupTargetReferenceVPNServerReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -83011,104 +88939,77 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[stri return } -// SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. -// -// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all destination ports are -// allowed for the protocol. When both have the same value, that single destination port is allowed. -// This model "extends" SecurityGroupRulePrototype -type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` +// SecurityGroupTargetReferenceVirtualNetworkInterfaceReference : SecurityGroupTargetReferenceVirtualNetworkInterfaceReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceVirtualNetworkInterfaceReference struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VirtualNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - // The inclusive upper bound of TCP/UDP destination port range. - // - // If specified, `port_min` must also be specified, and must not be larger. If unspecified, - // `port_min` must also be unspecified, allowing traffic on all destination ports. - PortMax *int64 `json:"port_max,omitempty"` + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` - // The inclusive lower bound of TCP/UDP destination port range - // - // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be - // unspecified, allowing traffic on all destination ports. - PortMin *int64 `json:"port_min,omitempty"` + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` - // The 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. - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source - // (or to any destination, for outbound rules). - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` -} + // The primary IP for this virtual network interface. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" -) + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" -) + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. +// Constants associated with the SecurityGroupTargetReferenceVirtualNetworkInterfaceReference.ResourceType property. +// The resource type. const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" + SecurityGroupTargetReferenceVirtualNetworkInterfaceReferenceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" ) -// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp, err error) { - _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp{ - Direction: core.StringPtr(direction), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRulePrototype() bool { +func (*SecurityGroupTargetReferenceVirtualNetworkInterfaceReference) isaSecurityGroupTargetReference() bool { return true } -// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. -func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) +// UnmarshalSecurityGroupTargetReferenceVirtualNetworkInterfaceReference unmarshals an instance of SecurityGroupTargetReferenceVirtualNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceVirtualNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceVirtualNetworkInterfaceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { return } @@ -83116,32 +89017,61 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[st return } -// SecurityGroupRuleRemotePatchCIDR : SecurityGroupRuleRemotePatchCIDR struct -// This model "extends" SecurityGroupRuleRemotePatch -type SecurityGroupRuleRemotePatchCIDR struct { - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. - CIDRBlock *string `json:"cidr_block" validate:"required"` +// ShareIdentityByCRN : ShareIdentityByCRN struct +// This model "extends" ShareIdentity +type ShareIdentityByCRN struct { + // The CRN for this file share. + CRN *string `json:"crn" validate:"required"` +} + +// NewShareIdentityByCRN : Instantiate ShareIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewShareIdentityByCRN(crn string) (_model *ShareIdentityByCRN, err error) { + _model = &ShareIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareIdentityByCRN) isaShareIdentity() bool { + return true +} + +// UnmarshalShareIdentityByCRN unmarshals an instance of ShareIdentityByCRN from the specified map of raw messages. +func UnmarshalShareIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// NewSecurityGroupRuleRemotePatchCIDR : Instantiate SecurityGroupRuleRemotePatchCIDR (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePatchCIDR(cidrBlock string) (_model *SecurityGroupRuleRemotePatchCIDR, err error) { - _model = &SecurityGroupRuleRemotePatchCIDR{ - CIDRBlock: core.StringPtr(cidrBlock), +// ShareIdentityByHref : ShareIdentityByHref struct +// This model "extends" ShareIdentity +type ShareIdentityByHref struct { + // The URL for this file share. + Href *string `json:"href" validate:"required"` +} + +// NewShareIdentityByHref : Instantiate ShareIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewShareIdentityByHref(href string) (_model *ShareIdentityByHref, err error) { + _model = &ShareIdentityByHref{ + Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*SecurityGroupRuleRemotePatchCIDR) isaSecurityGroupRuleRemotePatch() bool { +func (*ShareIdentityByHref) isaShareIdentity() bool { return true } -// UnmarshalSecurityGroupRuleRemotePatchCIDR unmarshals an instance of SecurityGroupRuleRemotePatchCIDR from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchCIDR(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchCIDR) - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) +// UnmarshalShareIdentityByHref unmarshals an instance of ShareIdentityByHref from the specified map of raw messages. +func UnmarshalShareIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -83149,34 +89079,30 @@ func UnmarshalSecurityGroupRuleRemotePatchCIDR(m map[string]json.RawMessage, res return } -// SecurityGroupRuleRemotePatchIP : SecurityGroupRuleRemotePatchIP struct -// This model "extends" SecurityGroupRuleRemotePatch -type SecurityGroupRuleRemotePatchIP struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` +// ShareIdentityByID : ShareIdentityByID struct +// This model "extends" ShareIdentity +type ShareIdentityByID struct { + // The unique identifier for this file share. + ID *string `json:"id" validate:"required"` } -// NewSecurityGroupRuleRemotePatchIP : Instantiate SecurityGroupRuleRemotePatchIP (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePatchIP(address string) (_model *SecurityGroupRuleRemotePatchIP, err error) { - _model = &SecurityGroupRuleRemotePatchIP{ - Address: core.StringPtr(address), +// NewShareIdentityByID : Instantiate ShareIdentityByID (Generic Model Constructor) +func (*VpcV1) NewShareIdentityByID(id string) (_model *ShareIdentityByID, err error) { + _model = &ShareIdentityByID{ + ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*SecurityGroupRuleRemotePatchIP) isaSecurityGroupRuleRemotePatch() bool { +func (*ShareIdentityByID) isaShareIdentity() bool { return true } -// UnmarshalSecurityGroupRuleRemotePatchIP unmarshals an instance of SecurityGroupRuleRemotePatchIP from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) +// UnmarshalShareIdentityByID unmarshals an instance of ShareIdentityByID from the specified map of raw messages. +func UnmarshalShareIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } @@ -83184,48 +89110,59 @@ func UnmarshalSecurityGroupRuleRemotePatchIP(m map[string]json.RawMessage, resul return } -// SecurityGroupRuleRemotePatchSecurityGroupIdentity : Identifies a security group by a unique property. -// Models which "extend" this model: -// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID -// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN -// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref -// This model "extends" SecurityGroupRuleRemotePatch -type SecurityGroupRuleRemotePatchSecurityGroupIdentity struct { - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` +// ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : The virtual network interface for this share mount target. The virtual network interface's VPC must not be used by a +// virtual network interface for another mount target for this share. +// +// Required if the share's `access_control_mode` is `security_group`. +// This model "extends" ShareMountTargetPrototype +type ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup struct { + // The name for this share mount target. The name must not be used by another mount target for the file share. + Name *string `json:"name,omitempty"` - // The security group's CRN. - CRN *string `json:"crn,omitempty"` + // The transit encryption mode to use for this share mount target: + // - `none`: Not encrypted in transit. + // - `user_managed`: Encrypted in transit using an instance identity certificate. The + // `access_control_mode` for the share must be `security_group`. + TransitEncryption *string `json:"transit_encryption,omitempty"` - // The security group's canonical URL. - Href *string `json:"href,omitempty"` + VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface" validate:"required"` } -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { - return true -} +// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup.TransitEncryption property. +// The transit encryption mode to use for this share mount target: +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. The +// `access_control_mode` for the share must be `security_group`. +const ( + ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionNoneConst = "none" + ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionUserManagedConst = "user_managed" +) -type SecurityGroupRuleRemotePatchSecurityGroupIdentityIntf interface { - SecurityGroupRuleRemotePatchIntf - isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool +// NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(virtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup, err error) { + _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup{ + VirtualNetworkInterface: virtualNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return } -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatch() bool { +func (*ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) isaShareMountTargetPrototype() bool { return true } -// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentity from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup unmarshals an instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup from the specified map of raw messages. +func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype) if err != nil { return } @@ -83233,32 +89170,60 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity(m map[string]jso return } -// SecurityGroupRuleRemotePrototypeCIDR : SecurityGroupRuleRemotePrototypeCIDR struct -// This model "extends" SecurityGroupRuleRemotePrototype -type SecurityGroupRuleRemotePrototypeCIDR struct { - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. - CIDRBlock *string `json:"cidr_block" validate:"required"` +// ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC : The VPC in which clients can mount the file share using this mount target. The VPC must not be used by another mount +// target for this share. +// +// Required if the share's `access_control_mode` is `vpc`. +// This model "extends" ShareMountTargetPrototype +type ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC struct { + // The name for this share mount target. The name must not be used by another mount target for the file share. + Name *string `json:"name,omitempty"` + + // The transit encryption mode to use for this share mount target: + // - `none`: Not encrypted in transit. + // - `user_managed`: Encrypted in transit using an instance identity certificate. The + // `access_control_mode` for the share must be `security_group`. + TransitEncryption *string `json:"transit_encryption,omitempty"` + + // Identifies a VPC by a unique property. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` } -// NewSecurityGroupRuleRemotePrototypeCIDR : Instantiate SecurityGroupRuleRemotePrototypeCIDR (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePrototypeCIDR(cidrBlock string) (_model *SecurityGroupRuleRemotePrototypeCIDR, err error) { - _model = &SecurityGroupRuleRemotePrototypeCIDR{ - CIDRBlock: core.StringPtr(cidrBlock), +// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC.TransitEncryption property. +// The transit encryption mode to use for this share mount target: +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. The +// `access_control_mode` for the share must be `security_group`. +const ( + ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionNoneConst = "none" + ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionUserManagedConst = "user_managed" +) + +// NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(vpc VPCIdentityIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC, err error) { + _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC{ + VPC: vpc, } err = core.ValidateStruct(_model, "required parameters") return } -func (*SecurityGroupRuleRemotePrototypeCIDR) isaSecurityGroupRuleRemotePrototype() bool { +func (*ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC) isaShareMountTargetPrototype() bool { return true } -// UnmarshalSecurityGroupRuleRemotePrototypeCIDR unmarshals an instance of SecurityGroupRuleRemotePrototypeCIDR from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeCIDR(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeCIDR) - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) +// UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC unmarshals an instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC from the specified map of raw messages. +func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { return } @@ -83266,34 +89231,62 @@ func UnmarshalSecurityGroupRuleRemotePrototypeCIDR(m map[string]json.RawMessage, return } -// SecurityGroupRuleRemotePrototypeIP : SecurityGroupRuleRemotePrototypeIP struct -// This model "extends" SecurityGroupRuleRemotePrototype -type SecurityGroupRuleRemotePrototypeIP struct { - // The IP address. +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext : The virtual network interface for this target. +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototype +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext struct { + // 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 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. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" 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"` -// NewSecurityGroupRuleRemotePrototypeIP : Instantiate SecurityGroupRuleRemotePrototypeIP (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePrototypeIP(address string) (_model *SecurityGroupRuleRemotePrototypeIP, err error) { - _model = &SecurityGroupRuleRemotePrototypeIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - return + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,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 and + // `primary_ip.address` is not specified. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` } -func (*SecurityGroupRuleRemotePrototypeIP) isaSecurityGroupRuleRemotePrototype() bool { +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { return true } -// UnmarshalSecurityGroupRuleRemotePrototypeIP unmarshals an instance of SecurityGroupRuleRemotePrototypeIP from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { return } @@ -83301,48 +89294,49 @@ func UnmarshalSecurityGroupRuleRemotePrototypeIP(m map[string]json.RawMessage, r return } -// SecurityGroupRuleRemotePrototypeSecurityGroupIdentity : Identifies a security group by a unique property. -// Models which "extend" this model: -// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID -// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN -// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref -// This model "extends" SecurityGroupRuleRemotePrototype -type SecurityGroupRuleRemotePrototypeSecurityGroupIdentity struct { - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` +// ShareProfileCapacityDependentRange : The permitted total capacity (in gigabytes) of a share with this profile depends on its configuration. +// This model "extends" ShareProfileCapacity +type ShareProfileCapacityDependentRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` - // The security group's CRN. - CRN *string `json:"crn,omitempty"` + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` - // The security group's canonical URL. - Href *string `json:"href,omitempty"` -} + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { - return true + // The type for this profile field. + Type *string `json:"type" validate:"required"` } -type SecurityGroupRuleRemotePrototypeSecurityGroupIdentityIntf interface { - SecurityGroupRuleRemotePrototypeIntf - isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool -} +// Constants associated with the ShareProfileCapacityDependentRange.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityDependentRangeTypeDependentConst = "dependent" + ShareProfileCapacityDependentRangeTypeDependentRangeConst = "dependent_range" +) -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototype() bool { +func (*ShareProfileCapacityDependentRange) isaShareProfileCapacity() bool { return true } -// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentity from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalShareProfileCapacityDependentRange unmarshals an instance of ShareProfileCapacityDependentRange from the specified map of raw messages. +func UnmarshalShareProfileCapacityDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCapacityDependentRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "min", &obj.Min) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -83350,23 +89344,41 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity(m map[string return } -// SecurityGroupRuleRemoteCIDR : SecurityGroupRuleRemoteCIDR struct -// This model "extends" SecurityGroupRuleRemote -type SecurityGroupRuleRemoteCIDR struct { - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. - CIDRBlock *string `json:"cidr_block" validate:"required"` +// 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 *int64 `json:"default" validate:"required"` + + // 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"` } -func (*SecurityGroupRuleRemoteCIDR) isaSecurityGroupRuleRemote() bool { +// Constants associated with the ShareProfileCapacityEnum.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityEnumTypeEnumConst = "enum" +) + +func (*ShareProfileCapacityEnum) isaShareProfileCapacity() bool { return true } -// UnmarshalSecurityGroupRuleRemoteCIDR unmarshals an instance of SecurityGroupRuleRemoteCIDR from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemoteCIDR(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemoteCIDR) - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -83374,25 +89386,34 @@ func UnmarshalSecurityGroupRuleRemoteCIDR(m map[string]json.RawMessage, result i return } -// SecurityGroupRuleRemoteIP : SecurityGroupRuleRemoteIP struct -// This model "extends" SecurityGroupRuleRemote -type SecurityGroupRuleRemoteIP struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` +// ShareProfileCapacityFixed : The permitted total capacity (in gigabytes) of a share with this profile is fixed. +// This model "extends" ShareProfileCapacity +type ShareProfileCapacityFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` } -func (*SecurityGroupRuleRemoteIP) isaSecurityGroupRuleRemote() bool { +// Constants associated with the ShareProfileCapacityFixed.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityFixedTypeFixedConst = "fixed" +) + +func (*ShareProfileCapacityFixed) isaShareProfileCapacity() bool { return true } -// UnmarshalSecurityGroupRuleRemoteIP unmarshals an instance of SecurityGroupRuleRemoteIP from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemoteIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemoteIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) +// UnmarshalShareProfileCapacityFixed unmarshals an instance of ShareProfileCapacityFixed from the specified map of raw messages. +func UnmarshalShareProfileCapacityFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCapacityFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { return } @@ -83400,50 +89421,55 @@ func UnmarshalSecurityGroupRuleRemoteIP(m map[string]json.RawMessage, result int return } -// SecurityGroupRuleRemoteSecurityGroupReference : SecurityGroupRuleRemoteSecurityGroupReference struct -// This model "extends" SecurityGroupRuleRemote -type SecurityGroupRuleRemoteSecurityGroupReference struct { - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` +// ShareProfileCapacityRange : The permitted total capacity range (in gigabytes) of a share with this profile. +// This model "extends" ShareProfileCapacity +type ShareProfileCapacityRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` - // The name for this security group. The name is unique across all security groups for the VPC. - Name *string `json:"name" validate:"required"` + // The type for this profile field. + Type *string `json:"type" validate:"required"` } -func (*SecurityGroupRuleRemoteSecurityGroupReference) isaSecurityGroupRuleRemote() bool { +// Constants associated with the ShareProfileCapacityRange.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityRangeTypeRangeConst = "range" +) + +func (*ShareProfileCapacityRange) isaShareProfileCapacity() bool { return true } -// UnmarshalSecurityGroupRuleRemoteSecurityGroupReference unmarshals an instance of SecurityGroupRuleRemoteSecurityGroupReference from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemoteSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemoteSecurityGroupReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalShareProfileCapacityRange unmarshals an instance of ShareProfileCapacityRange from the specified map of raw messages. +func UnmarshalShareProfileCapacityRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCapacityRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "min", &obj.Min) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "step", &obj.Step) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -83451,78 +89477,49 @@ func UnmarshalSecurityGroupRuleRemoteSecurityGroupReference(m map[string]json.Ra return } -// SecurityGroupRuleSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. -// This model "extends" SecurityGroupRule -type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The URL for this security group rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group rule. - ID *string `json:"id" validate:"required"` +// ShareProfileIopsDependentRange : The permitted IOPS range of a share with this profile depends on its configuration. +// This model "extends" ShareProfileIops +type ShareProfileIopsDependentRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version" validate:"required"` + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` - Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` + // The type for this profile field. + Type *string `json:"type" validate:"required"` } -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" - SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Protocol property. -// The protocol to enforce. +// Constants associated with the ShareProfileIopsDependentRange.Type property. +// The type for this profile field. const ( - SecurityGroupRuleSecurityGroupRuleProtocolAllProtocolAllConst = "all" + ShareProfileIopsDependentRangeTypeDependentConst = "dependent" + ShareProfileIopsDependentRangeTypeDependentRangeConst = "dependent_range" ) -func (*SecurityGroupRuleSecurityGroupRuleProtocolAll) isaSecurityGroupRule() bool { +func (*ShareProfileIopsDependentRange) isaShareProfileIops() bool { return true } -// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolAll from the specified map of raw messages. -func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleSecurityGroupRuleProtocolAll) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalShareProfileIopsDependentRange unmarshals an instance of ShareProfileIopsDependentRange from the specified map of raw messages. +func UnmarshalShareProfileIopsDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIopsDependentRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + err = core.UnmarshalPrimitive(m, "min", &obj.Min) if err != nil { return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + err = core.UnmarshalPrimitive(m, "step", &obj.Step) if err != nil { return } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -83530,92 +89527,76 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.Ra return } -// SecurityGroupRuleSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. -// This model "extends" SecurityGroupRule -type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The URL for this security group rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group rule. - ID *string `json:"id" validate:"required"` - - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version" validate:"required"` - - Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` - - // The ICMP traffic code to allow. If absent, all codes are allowed. - Code *int64 `json:"code,omitempty"` +// ShareProfileIopsEnum : The permitted IOPS values of a share with this profile. +// This model "extends" ShareProfileIops +type ShareProfileIopsEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` + // The type for this profile field. + Type *string `json:"type" validate:"required"` - // The ICMP traffic type to allow. If absent, all types are allowed. - Type *int64 `json:"type,omitempty"` + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` } -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" - SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Protocol property. -// The protocol to enforce. +// Constants associated with the ShareProfileIopsEnum.Type property. +// The type for this profile field. const ( - SecurityGroupRuleSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" + ShareProfileIopsEnumTypeEnumConst = "enum" ) -func (*SecurityGroupRuleSecurityGroupRuleProtocolIcmp) isaSecurityGroupRule() bool { +func (*ShareProfileIopsEnum) isaShareProfileIops() bool { return true } -// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolIcmp from the specified map of raw messages. -func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleSecurityGroupRuleProtocolIcmp) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) +// UnmarshalShareProfileIopsEnum unmarshals an instance of ShareProfileIopsEnum from the specified map of raw messages. +func UnmarshalShareProfileIopsEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIopsEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } - err = core.UnmarshalPrimitive(m, "code", &obj.Code) + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIopsFixed : The permitted IOPS of a share with this profile is fixed. +// This model "extends" ShareProfileIops +type ShareProfileIopsFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the ShareProfileIopsFixed.Type property. +// The type for this profile field. +const ( + ShareProfileIopsFixedTypeFixedConst = "fixed" +) + +func (*ShareProfileIopsFixed) isaShareProfileIops() bool { + return true +} + +// UnmarshalShareProfileIopsFixed unmarshals an instance of ShareProfileIopsFixed from the specified map of raw messages. +func UnmarshalShareProfileIopsFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIopsFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { return } @@ -83623,96 +89604,117 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.R return } -// SecurityGroupRuleSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. -// -// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all destination ports are -// allowed for the protocol. When both have the same value, that single destination port is allowed. -// This model "extends" SecurityGroupRule -type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The URL for this security group rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group rule. - ID *string `json:"id" validate:"required"` - - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version" validate:"required"` - - Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - PortMax *int64 `json:"port_max,omitempty"` +// ShareProfileIopsRange : The permitted IOPS range of a share with this profile. +// This model "extends" ShareProfileIops +type ShareProfileIopsRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` - // The inclusive lower bound of TCP/UDP destination port range. - PortMin *int64 `json:"port_min,omitempty"` + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` -} + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" -) + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" -) + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. +// Constants associated with the ShareProfileIopsRange.Type property. +// The type for this profile field. const ( - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" + ShareProfileIopsRangeTypeRangeConst = "range" ) -func (*SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRule() bool { +func (*ShareProfileIopsRange) isaShareProfileIops() bool { return true } -// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. -func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) +// UnmarshalShareProfileIopsRange unmarshals an instance of ShareProfileIopsRange from the specified map of raw messages. +func UnmarshalShareProfileIopsRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIopsRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "min", &obj.Min) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + err = core.UnmarshalPrimitive(m, "step", &obj.Step) if err != nil { return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } - err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) - if err != nil { - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIdentityByHref : ShareProfileIdentityByHref struct +// This model "extends" ShareProfileIdentity +type ShareProfileIdentityByHref struct { + // The URL for this share profile. + Href *string `json:"href" validate:"required"` +} + +// NewShareProfileIdentityByHref : Instantiate ShareProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewShareProfileIdentityByHref(href string) (_model *ShareProfileIdentityByHref, err error) { + _model = &ShareProfileIdentityByHref{ + Href: core.StringPtr(href), } - err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareProfileIdentityByHref) isaShareProfileIdentity() bool { + return true +} + +// UnmarshalShareProfileIdentityByHref unmarshals an instance of ShareProfileIdentityByHref from the specified map of raw messages. +func UnmarshalShareProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIdentityByName : ShareProfileIdentityByName struct +// This model "extends" ShareProfileIdentity +type ShareProfileIdentityByName struct { + // The globally unique name for this share profile. + Name *string `json:"name" validate:"required"` +} + +// NewShareProfileIdentityByName : Instantiate ShareProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewShareProfileIdentityByName(name string) (_model *ShareProfileIdentityByName, err error) { + _model = &ShareProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareProfileIdentityByName) isaShareProfileIdentity() bool { + return true +} + +// UnmarshalShareProfileIdentityByName unmarshals an instance of ShareProfileIdentityByName from the specified map of raw messages. +func UnmarshalShareProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -83720,127 +89722,141 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json return } -// SecurityGroupTargetReferenceEndpointGatewayReference : SecurityGroupTargetReferenceEndpointGatewayReference struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceEndpointGatewayReference struct { - // The CRN for this endpoint gateway. - CRN *string `json:"crn" validate:"required"` +// SharePrototypeShareBySize : Create a file share by size. +// This model "extends" SharePrototype +type SharePrototypeShareBySize struct { + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each client accessing the share will be restricted to 48,000 IOPS. + Iops *int64 `json:"iops,omitempty"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + // The mount targets for the file share. Each mount target must be in a unique VPC. + MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` - // The URL for this endpoint gateway. - Href *string `json:"href" validate:"required"` + // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be + // a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` - // The unique identifier for this endpoint gateway. - ID *string `json:"id" validate:"required"` + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use for this file share. The + // profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. - Name *string `json:"name" validate:"required"` + ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this file share will reside in. For a replica share, this must be a different zone in the same region as + // the source share. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The access control mode for the share: + // + // - `security_group`: The security groups on the virtual network interface for a + // mount target control access to the mount target. Mount targets for this share + // require a virtual network interface. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // Mount targets for this share require a VPC. + AccessControlMode *string `json:"access_control_mode,omitempty"` + + // The root key to use to wrap the data encryption key for the share. + // + // If unspecified, the `encryption` type for the share will be `provider_managed`. + // + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The owner assigned to the file share at creation. Subsequent changes to the owner + // must be performed by a client that has mounted the file share. + InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The size of the file share rounded up to the next gigabyte. + // + // The maximum size for a share may increase in the future. + Size *int64 `json:"size" validate:"required"` } -// Constants associated with the SecurityGroupTargetReferenceEndpointGatewayReference.ResourceType property. -// The resource type. +// Constants associated with the SharePrototypeShareBySize.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a +// mount target control access to the mount target. Mount targets for this share +// require a virtual network interface. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// Mount targets for this share require a VPC. const ( - SecurityGroupTargetReferenceEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" + SharePrototypeShareBySizeAccessControlModeSecurityGroupConst = "security_group" + SharePrototypeShareBySizeAccessControlModeVPCConst = "vpc" ) -func (*SecurityGroupTargetReferenceEndpointGatewayReference) isaSecurityGroupTargetReference() bool { +// NewSharePrototypeShareBySize : Instantiate SharePrototypeShareBySize (Generic Model Constructor) +func (*VpcV1) NewSharePrototypeShareBySize(profile ShareProfileIdentityIntf, zone ZoneIdentityIntf, size int64) (_model *SharePrototypeShareBySize, err error) { + _model = &SharePrototypeShareBySize{ + Profile: profile, + Zone: zone, + Size: core.Int64Ptr(size), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SharePrototypeShareBySize) isaSharePrototype() bool { return true } -// UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference unmarshals an instance of SecurityGroupTargetReferenceEndpointGatewayReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceEndpointGatewayReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) +// UnmarshalSharePrototypeShareBySize unmarshals an instance of SharePrototypeShareBySize from the specified map of raw messages. +func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePrototypeShareBySize) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupTargetReferenceLoadBalancerReference : SecurityGroupTargetReferenceLoadBalancerReference struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceLoadBalancerReference struct { - // The load balancer's CRN. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` - - // The load balancer's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer. - ID *string `json:"id" validate:"required"` - - // The name for this load balancer. The name is unique across all load balancers in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SecurityGroupTargetReferenceLoadBalancerReference.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" -) - -func (*SecurityGroupTargetReferenceLoadBalancerReference) isaSecurityGroupTargetReference() bool { - return true -} - -// UnmarshalSecurityGroupTargetReferenceLoadBalancerReference unmarshals an instance of SecurityGroupTargetReferenceLoadBalancerReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceLoadBalancerReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { return } @@ -83848,48 +89864,74 @@ func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]jso return } -// SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` +// SharePrototypeShareBySourceShare : Create a replica file share for an existing file share. The values for `access_control_mode`, +// `encryption_key`, `initial_owner`, and `size` will be inherited from `source_share`. +// This model "extends" SharePrototype +type SharePrototypeShareBySourceShare struct { + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each client accessing the share will be restricted to 48,000 IOPS. + Iops *int64 `json:"iops,omitempty"` - // The URL for this network interface. - Href *string `json:"href" validate:"required"` + // The mount targets for the file share. Each mount target must be in a unique VPC. + MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` - // The unique identifier for this network interface. - ID *string `json:"id" validate:"required"` + // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be + // a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` - // The name for this network interface. - Name *string `json:"name" validate:"required"` + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use for this file share. The + // profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this file share will reside in. For a replica share, this must be a different zone in the same region as + // the source share. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The cron specification for the file share replication schedule. + // + // Replication of a share can be scheduled to occur at most once per hour. + ReplicationCronSpec *string `json:"replication_cron_spec" validate:"required"` + + // The resource group to use. If unspecified, the resource group from + // the source share will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The source file share for this replica file share. The specified file share must not + // already have a replica, and must not be a replica. + SourceShare ShareIdentityIntf `json:"source_share" validate:"required"` } -// Constants associated with the SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" -) +// NewSharePrototypeShareBySourceShare : Instantiate SharePrototypeShareBySourceShare (Generic Model Constructor) +func (*VpcV1) NewSharePrototypeShareBySourceShare(profile ShareProfileIdentityIntf, zone ZoneIdentityIntf, replicationCronSpec string, sourceShare ShareIdentityIntf) (_model *SharePrototypeShareBySourceShare, err error) { + _model = &SharePrototypeShareBySourceShare{ + Profile: profile, + Zone: zone, + ReplicationCronSpec: core.StringPtr(replicationCronSpec), + SourceShare: sourceShare, + } + err = core.ValidateStruct(_model, "required parameters") + return +} -func (*SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { +func (*SharePrototypeShareBySourceShare) isaSharePrototype() bool { return true } -// UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalSharePrototypeShareBySourceShare unmarshals an instance of SharePrototypeShareBySourceShare from the specified map of raw messages. +func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePrototypeShareBySourceShare) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) if err != nil { return } @@ -83897,71 +89939,31 @@ func UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupTargetReferenceVPNServerReference : SecurityGroupTargetReferenceVPNServerReference struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceVPNServerReference struct { - // The CRN for this VPN server. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this VPN server. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN server. - ID *string `json:"id" validate:"required"` - - // The name for this VPN server. The name is unique across all VPN servers in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SecurityGroupTargetReferenceVPNServerReference.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" -) - -func (*SecurityGroupTargetReferenceVPNServerReference) isaSecurityGroupTargetReference() bool { - return true -} - -// UnmarshalSecurityGroupTargetReferenceVPNServerReference unmarshals an instance of SecurityGroupTargetReferenceVPNServerReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceVPNServerReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareIdentity) if err != nil { return } @@ -84299,7 +90301,7 @@ type SubnetPrototypeSubnetByCIDR struct { // hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The network ACL to use for this subnet. If unspecified, the default network ACL for the VPC is used. + // The network ACL to use for this subnet. NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` // The public gateway to use for internet-bound traffic for this subnet. If unspecified, the subnet will not be @@ -84401,7 +90403,7 @@ type SubnetPrototypeSubnetByTotalCount struct { // hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The network ACL to use for this subnet. If unspecified, the default network ACL for the VPC is used. + // The network ACL to use for this subnet. NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` // The public gateway to use for internet-bound traffic for this subnet. If unspecified, the subnet will not be @@ -85005,7 +91007,7 @@ type VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch struct { // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address,omitempty"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk,omitempty"` // Routing protocols are disabled for this VPN gateway connection. @@ -85108,7 +91110,7 @@ type VPNGatewayConnectionPolicyMode struct { // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address" validate:"required"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk" validate:"required"` // The resource type. @@ -85244,7 +91246,7 @@ type VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address" validate:"required"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk" validate:"required"` // The local CIDRs for this resource. @@ -85332,7 +91334,7 @@ type VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype s // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address" validate:"required"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk" validate:"required"` // Routing protocols are disabled for this VPN gateway connection. @@ -85435,7 +91437,7 @@ type VPNGatewayConnectionStaticRouteMode struct { // The IP address of the peer VPN gateway. PeerAddress *string `json:"peer_address" validate:"required"` - // The preshared key. + // The pre-shared key. Psk *string `json:"psk" validate:"required"` // The resource type. @@ -86149,6 +92151,146 @@ func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernameP return } +// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext : Identifies a reserved IP by a unique property. Required if `subnet` is not specified. The reserved IP must be +// currently unbound. +// Models which "extend" this model: +// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID +// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref +// This model "extends" VirtualNetworkInterfacePrimaryIPPrototype +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` +} + +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { + return true +} + +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextIntf interface { + VirtualNetworkInterfacePrimaryIPPrototypeIntf + isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool +} + +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext : The prototype for a new reserved IP. Requires `subnet` to be specified. +// This model "extends" VirtualNetworkInterfacePrimaryIPPrototype +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceTargetShareMountTargetReference : VirtualNetworkInterfaceTargetShareMountTargetReference struct +// This model "extends" VirtualNetworkInterfaceTarget +type VirtualNetworkInterfaceTargetShareMountTargetReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this share mount target. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this share mount target. + ID *string `json:"id" validate:"required"` + + // The name for this share mount target. The name is unique across all mount targets for the file share. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VirtualNetworkInterfaceTargetShareMountTargetReference.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceTargetShareMountTargetReferenceResourceTypeShareMountTargetConst = "share_mount_target" +) + +func (*VirtualNetworkInterfaceTargetShareMountTargetReference) isaVirtualNetworkInterfaceTarget() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceTargetShareMountTargetReference unmarshals an instance of VirtualNetworkInterfaceTargetShareMountTargetReference from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceTargetShareMountTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceTargetShareMountTargetReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VolumeAttachmentPrototypeVolumeVolumeIdentity : Identifies a volume by a unique property. // Models which "extend" this model: // - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID @@ -86216,8 +92358,8 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { // use for this volume. Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - // The resource group to use for this volume. If unspecified, the instance's resource group - // will be used. + // The resource group to use for this volume. If unspecified, the instance's resource + // group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -86457,8 +92599,6 @@ type VolumePrototypeVolumeByCapacity struct { // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. Profile VolumeProfileIdentityIntf `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) is used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -86545,8 +92685,6 @@ type VolumePrototypeVolumeBySourceSnapshot struct { // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. Profile VolumeProfileIdentityIntf `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) is used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -86690,33 +92828,33 @@ func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{ return } -// EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref struct +// EndpointGatewayReservedIPReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityByHref struct // This model "extends" EndpointGatewayReservedIPReservedIPIdentity -type EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref struct { +type EndpointGatewayReservedIPReservedIPIdentityByHref struct { // The URL for this reserved IP. Href *string `json:"href" validate:"required"` } -// NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref : Instantiate EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref(href string) (_model *EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref, err error) { - _model = &EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref{ +// NewEndpointGatewayReservedIPReservedIPIdentityByHref : Instantiate EndpointGatewayReservedIPReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityByHref(href string) (_model *EndpointGatewayReservedIPReservedIPIdentityByHref, err error) { + _model = &EndpointGatewayReservedIPReservedIPIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref) isaEndpointGatewayReservedIPReservedIPIdentity() bool { +func (*EndpointGatewayReservedIPReservedIPIdentityByHref) isaEndpointGatewayReservedIPReservedIPIdentity() bool { return true } -func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref) isaEndpointGatewayReservedIP() bool { +func (*EndpointGatewayReservedIPReservedIPIdentityByHref) isaEndpointGatewayReservedIP() bool { return true } -// UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref from the specified map of raw messages. -func UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref) +// UnmarshalEndpointGatewayReservedIPReservedIPIdentityByHref unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -86725,33 +92863,33 @@ func UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHre return } -// EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID : EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID struct +// EndpointGatewayReservedIPReservedIPIdentityByID : EndpointGatewayReservedIPReservedIPIdentityByID struct // This model "extends" EndpointGatewayReservedIPReservedIPIdentity -type EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID struct { +type EndpointGatewayReservedIPReservedIPIdentityByID struct { // The unique identifier for this reserved IP. ID *string `json:"id" validate:"required"` } -// NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID : Instantiate EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID(id string) (_model *EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID, err error) { - _model = &EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID{ +// NewEndpointGatewayReservedIPReservedIPIdentityByID : Instantiate EndpointGatewayReservedIPReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityByID(id string) (_model *EndpointGatewayReservedIPReservedIPIdentityByID, err error) { + _model = &EndpointGatewayReservedIPReservedIPIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) isaEndpointGatewayReservedIPReservedIPIdentity() bool { +func (*EndpointGatewayReservedIPReservedIPIdentityByID) isaEndpointGatewayReservedIPReservedIPIdentity() bool { return true } -func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) isaEndpointGatewayReservedIP() bool { +func (*EndpointGatewayReservedIPReservedIPIdentityByID) isaEndpointGatewayReservedIP() bool { return true } -// UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID from the specified map of raw messages. -func UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) +// UnmarshalEndpointGatewayReservedIPReservedIPIdentityByID unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -86861,10 +92999,80 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentit return } +// FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity +type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { + // The URL for this bare metal server network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity +type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { + // The unique identifier for this bare metal server network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct // This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` } @@ -86899,7 +93107,7 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdent // FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct // This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` } @@ -86931,10 +93139,80 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdent return } +// FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity +type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { + // The URL for this bare metal server network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity +type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { + // The unique identifier for this bare metal server network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct // This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` } @@ -86969,7 +93247,7 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceI // FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct // This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` } @@ -87109,7 +93387,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByI // FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct // This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { - // The URL for this network interface. + // The URL for this instance network interface. Href *string `json:"href" validate:"required"` } @@ -87144,7 +93422,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInte // FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct // This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { - // The unique identifier for this network interface. + // The unique identifier for this instance network interface. ID *string `json:"id" validate:"required"` } @@ -88681,33 +94959,33 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdent return } -// NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref : NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref struct +// NetworkInterfaceIPPrototypeReservedIPIdentityByHref : NetworkInterfaceIPPrototypeReservedIPIdentityByHref struct // This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity -type NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref struct { +type NetworkInterfaceIPPrototypeReservedIPIdentityByHref struct { // The URL for this reserved IP. Href *string `json:"href" validate:"required"` } -// NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref(href string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref, err error) { - _model = &NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref{ +// NewNetworkInterfaceIPPrototypeReservedIPIdentityByHref : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityByHref(href string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityByHref, err error) { + _model = &NetworkInterfaceIPPrototypeReservedIPIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { +func (*NetworkInterfaceIPPrototypeReservedIPIdentityByHref) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { return true } -func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref) isaNetworkInterfaceIPPrototype() bool { +func (*NetworkInterfaceIPPrototypeReservedIPIdentityByHref) isaNetworkInterfaceIPPrototype() bool { return true } -// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByHref) +// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByHref unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -88716,33 +94994,33 @@ func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByH return } -// NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID : NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID struct +// NetworkInterfaceIPPrototypeReservedIPIdentityByID : NetworkInterfaceIPPrototypeReservedIPIdentityByID struct // This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity -type NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID struct { +type NetworkInterfaceIPPrototypeReservedIPIdentityByID struct { // The unique identifier for this reserved IP. ID *string `json:"id" validate:"required"` } -// NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID (Generic Model Constructor) -func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID(id string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID, err error) { - _model = &NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID{ +// NewNetworkInterfaceIPPrototypeReservedIPIdentityByID : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityByID(id string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityByID, err error) { + _model = &NetworkInterfaceIPPrototypeReservedIPIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { +func (*NetworkInterfaceIPPrototypeReservedIPIdentityByID) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { return true } -func (*NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID) isaNetworkInterfaceIPPrototype() bool { +func (*NetworkInterfaceIPPrototypeReservedIPIdentityByID) isaNetworkInterfaceIPPrototype() bool { return true } -// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityReservedIPIdentityByID) +// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByID unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -89510,6 +95788,76 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroup return } +// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref struct +// This model "extends" VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref : Instantiate VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref(href string) (_model *VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref, err error) { + _model = &VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { + return true +} + +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID struct +// This model "extends" VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID : Instantiate VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID(id string) (_model *VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID, err error) { + _model = &VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { + return true +} + +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN struct // This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN struct { @@ -92469,6 +98817,346 @@ func (pager *SnapshotsPager) GetAll() (allItems []Snapshot, err error) { return pager.GetAllWithContext(context.Background()) } +// ShareProfilesPager can be used to simplify the use of the "ListShareProfiles" method. +type ShareProfilesPager struct { + hasNext bool + options *ListShareProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewShareProfilesPager returns a new ShareProfilesPager instance. +func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (pager *ShareProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListShareProfilesOptions = *options + pager = &ShareProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ShareProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page []ShareProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListShareProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItems []ShareProfile, err error) { + for pager.HasNext() { + var nextPage []ShareProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ShareProfilesPager) GetNext() (page []ShareProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ShareProfilesPager) GetAll() (allItems []ShareProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SharesPager can be used to simplify the use of the "ListShares" method. +type SharesPager struct { + hasNext bool + options *ListSharesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSharesPager returns a new SharesPager instance. +func (vpc *VpcV1) NewSharesPager(options *ListSharesOptions) (pager *SharesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSharesOptions = *options + pager = &SharesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SharesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSharesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Shares + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Share, err error) { + for pager.HasNext() { + var nextPage []Share + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SharesPager) GetNext() (page []Share, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SharesPager) GetAll() (allItems []Share, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// ShareMountTargetsPager can be used to simplify the use of the "ListShareMountTargets" method. +type ShareMountTargetsPager struct { + hasNext bool + options *ListShareMountTargetsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewShareMountTargetsPager returns a new ShareMountTargetsPager instance. +func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOptions) (pager *ShareMountTargetsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListShareMountTargetsOptions = *options + pager = &ShareMountTargetsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ShareMountTargetsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (page []ShareMountTarget, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListShareMountTargetsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.MountTargets + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (allItems []ShareMountTarget, err error) { + for pager.HasNext() { + var nextPage []ShareMountTarget + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ShareMountTargetsPager) GetNext() (page []ShareMountTarget, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. +type VirtualNetworkInterfacesPager struct { + hasNext bool + options *ListVirtualNetworkInterfacesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. +func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVirtualNetworkInterfacesOptions = *options + pager = &VirtualNetworkInterfacesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VirtualNetworkInterfacesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []VirtualNetworkInterface, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVirtualNetworkInterfacesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.VirtualNetworkInterfaces + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []VirtualNetworkInterface, err error) { + for pager.HasNext() { + var nextPage []VirtualNetworkInterface + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VirtualNetworkInterfacesPager) GetNext() (page []VirtualNetworkInterface, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, err error) { + return pager.GetAllWithContext(context.Background()) +} + // PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. type PublicGatewaysPager struct { hasNext bool From 4222aaaef75872316baff29240f9df829ac4a35d Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 21 Sep 2023 16:42:56 +0530 Subject: [PATCH 037/103] Update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 8ac30b0d36..6010ec382c 100644 --- a/go.mod +++ b/go.mod @@ -224,7 +224,7 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.38.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.41.0 => ./common/github.com/IBM/vpc-go-sdk exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 From 1a39d96714f421e253f856d4b79096df063b5729 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 16 Nov 2023 18:04:15 +0530 Subject: [PATCH 038/103] updated --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 4095 +++++++++++++++-- go.mod | 2 +- 2 files changed, 3825 insertions(+), 272 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 3760914f76..52d1205c20 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.78.0-67aec9b7-20230818-174940 + * IBM OpenAPI SDK Code Generator Version: 3.80.0-29334a73-20230925-151553 */ // 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: 2023-09-20 +// API Version: 2023-11-15 type VpcV1 struct { Service *core.BaseService @@ -46,8 +46,8 @@ type VpcV1 struct { // `2`. generation *int64 - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-09-20`. + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-10-10` + // and `2023-11-15`. Version *string } @@ -63,8 +63,8 @@ type VpcV1Options struct { URL string Authenticator core.Authenticator - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2022-09-13` - // and `2023-09-20`. + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-10-10` + // and `2023-11-15`. Version *string } @@ -122,7 +122,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2023-08-08") + options.Version = core.StringPtr("2023-10-24") } service = &VpcV1{ @@ -297,6 +297,9 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr if createVPCOptions.ClassicAccess != nil { body["classic_access"] = createVPCOptions.ClassicAccess } + if createVPCOptions.Dns != nil { + body["dns"] = createVPCOptions.Dns + } if createVPCOptions.Name != nil { body["name"] = createVPCOptions.Name } @@ -330,10 +333,15 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr } // DeleteVPC : Delete a VPC -// This request deletes a VPC. This operation cannot be reversed. For this request to succeed, the VPC must not contain -// any instances, subnets, public gateways, or endpoint gateways. All security groups and network ACLs associated with -// the VPC are automatically deleted. All flow log collectors with `auto_delete` set to `true` targeting the VPC or any -// resource in the VPC are automatically deleted. +// This request deletes a VPC. This operation cannot be reversed. +// +// For this request to succeed: +// - Instances, subnets, public gateways, and endpoint gateways must not reside in this VPC +// - The VPC must not be providing DNS resolution for any other VPCs +// - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero +// +// All security groups and network ACLs associated with the VPC are automatically deleted. All flow log collectors with +// `auto_delete` set to `true` targeting the VPC or any resource in the VPC are automatically deleted. func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) } @@ -369,6 +377,9 @@ func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *De for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + if deleteVPCOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -486,6 +497,9 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVPCOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPCOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -1049,6 +1063,378 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV return } +// ListVPCDnsResolutionBindings : List all DNS resolution bindings for a VPC +// This request lists all DNS resolution bindings for a VPC. A DNS resolution binding represents an association with +// another VPC for centralizing DNS name resolution. +// +// If the VPC specified by the identifier in the URL is a DNS hub VPC (has `dns.enable_hub` set to `true`) then there is +// one binding for each VPC bound to the hub VPC. The endpoint gateways in the bound VPCs can allow (using +// `allow_dns_resolution_binding`) the hub VPC to centralize resolution of their DNS names. +// +// If the VPC specified by the identifier in the URL is not a DNS hub VPC, then there is at most one binding (to a hub +// VPC). The endpoint gateways in the VPC specified by the identifier in the URL can allow (using +// `allow_dns_resolution_binding`) its hub VPC to centralize resolution of their DNS names. +// +// To make use of centralized DNS resolution, a VPC bound to a DNS hub VPC must delegate DNS resolution to its hub VPC +// by setting `dns.resolver.type` to `delegate`. +// +// The bindings will be sorted by their `created_at` property values, with newest bindings first. Bindings with +// identical `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListVPCDnsResolutionBindings(listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) +} + +// ListVPCDnsResolutionBindingsWithContext is an alternate form of the ListVPCDnsResolutionBindings method which supports a Context parameter +func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCDnsResolutionBindingsOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCDnsResolutionBindingsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCDnsResolutionBindings") + 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 listVPCDnsResolutionBindingsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Sort)) + } + if listVPCDnsResolutionBindingsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Start)) + } + if listVPCDnsResolutionBindingsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Limit)) + } + if listVPCDnsResolutionBindingsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Name)) + } + if listVPCDnsResolutionBindingsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCCRN)) + } + if listVPCDnsResolutionBindingsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCName)) + } + if listVPCDnsResolutionBindingsOptions.AccountID != nil { + builder.AddQuery("account.id", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.AccountID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBindingCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPCDnsResolutionBinding : Create a DNS resolution binding +// This request creates a new DNS resolution binding from a DNS resolution binding prototype object. The prototype +// object is structured in the same way as a retrieved DNS resolution binding, and contains the information necessary to +// create the new DNS resolution binding. +// +// For this request to succeed, `dns.enable_hub` must be `false` for the VPC specified by the identifier in the URL, and +// the VPC must not already have a DNS resolution binding. +// +// See [About DNS sharing for VPE gateways](/docs/vpc?topic=vpc-hub-spoke-model) for more information. +func (vpc *VpcV1) CreateVPCDnsResolutionBinding(createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + return vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) +} + +// CreateVPCDnsResolutionBindingWithContext is an alternate form of the CreateVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCDnsResolutionBindingOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCDnsResolutionBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCDnsResolutionBinding") + 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 createVPCDnsResolutionBindingOptions.VPC != nil { + body["vpc"] = createVPCDnsResolutionBindingOptions.VPC + } + if createVPCDnsResolutionBindingOptions.Name != nil { + body["name"] = createVPCDnsResolutionBindingOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPCDnsResolutionBinding : Delete a DNS resolution binding +// This request deletes a DNS resolution binding. This operation cannot be reversed. +// +// A DNS resolution binding for a VPC with `dns.enable_hub` set to `true` cannot be deleted. +func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) +} + +// DeleteVPCDnsResolutionBindingWithContext is an alternate form of the DeleteVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCDnsResolutionBindingOptions.VPCID, + "id": *deleteVPCDnsResolutionBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCDnsResolutionBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCDnsResolutionBinding") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPCDnsResolutionBinding : Retrieve a DNS resolution binding +// This request retrieves a single DNS resolution binding specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCDnsResolutionBinding(getVPCDnsResolutionBindingOptions *GetVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + return vpc.GetVPCDnsResolutionBindingWithContext(context.Background(), getVPCDnsResolutionBindingOptions) +} + +// GetVPCDnsResolutionBindingWithContext is an alternate form of the GetVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, getVPCDnsResolutionBindingOptions *GetVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCDnsResolutionBindingOptions.VPCID, + "id": *getVPCDnsResolutionBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDnsResolutionBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDnsResolutionBinding") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCDnsResolutionBinding : Update a DNS resolution binding +// This request updates a DNS resolution binding with the information in a provided DNS resolution binding patch. The +// DNS resolution binding patch object is structured in the same way as a retrieved DNS resolution binding and contains +// only the information to be updated. +func (vpc *VpcV1) UpdateVPCDnsResolutionBinding(updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) +} + +// UpdateVPCDnsResolutionBindingWithContext is an alternate form of the UpdateVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCDnsResolutionBindingOptions.VPCID, + "id": *updateVPCDnsResolutionBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCDnsResolutionBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCDnsResolutionBinding") + 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(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + if err != nil { + return + } + response.Result = result + } + + return +} + // ListVPCRoutes : List all routes in a VPC's default routing table // This request lists all routes in the VPC's default routing table. Each route is zone-specific and directs any packets // matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's @@ -6304,8 +6690,8 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } -// ListInstanceNetworkInterfaceIps : List all reserved IPs bound to an instance network interface -// This request lists all reserved IPs bound to an instance network interface. +// ListInstanceNetworkInterfaceIps : List the primary reserved IP for an instance network interface +// This request lists the primary reserved IP for an instance network interface. func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) } @@ -6374,9 +6760,8 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context return } -// GetInstanceNetworkInterfaceIP : Retrieve bound reserved IP -// This request retrieves the specified reserved IP address if it is bound to the network interface and instance -// specified in the URL. +// GetInstanceNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for an instance network interface. func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) } @@ -9564,6 +9949,9 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku if createBackupPolicyOptions.ResourceGroup != nil { body["resource_group"] = createBackupPolicyOptions.ResourceGroup } + if createBackupPolicyOptions.Scope != nil { + body["scope"] = createBackupPolicyOptions.Scope + } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -10825,15 +11213,6 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM if listBareMetalServersOptions.VPCName != nil { builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) } - if listBareMetalServersOptions.NetworkInterfacesSubnetID != nil { - builder.AddQuery("network_interfaces.subnet.id", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetID)) - } - if listBareMetalServersOptions.NetworkInterfacesSubnetCRN != nil { - builder.AddQuery("network_interfaces.subnet.crn", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetCRN)) - } - if listBareMetalServersOptions.NetworkInterfacesSubnetName != nil { - builder.AddQuery("network_interfaces.subnet.name", fmt.Sprint(*listBareMetalServersOptions.NetworkInterfacesSubnetName)) - } request, err := builder.Build() if err != nil { @@ -11818,8 +12197,8 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } -// ListBareMetalServerNetworkInterfaceIps : List all reserved IPs bound to a bare metal server network interface -// This request lists all reserved IPs bound to a bare metal server network interface. +// ListBareMetalServerNetworkInterfaceIps : List the primary reserved IP for a bare metal server network interface +// This request lists the primary reserved IP for a bare metal server network interface. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) } @@ -11882,9 +12261,8 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. return } -// GetBareMetalServerNetworkInterfaceIP : Retrieve bound reserved IP -// This request retrieves the specified reserved IP address if it is bound to the network interface for the bare metal -// server specified in the URL. +// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for a bare metal server network interface. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) } @@ -14446,12 +14824,12 @@ func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareS // GetShareSource : Retrieve the source file share for a replica file share // This request retrieves the source file share associated with the replica file share specified by the identifier in // the URL. -func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *Share, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { return vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) } // GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter -func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *Share, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") if err != nil { return @@ -14497,7 +14875,7 @@ func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceO return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) if err != nil { return } @@ -17009,7 +17387,7 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS // - A bare metal server network interface identifier // - A virtual network interface identifier // - A VPN server identifier -// - An application load balancer identifier +// - A load balancer identifier // - An endpoint gateway identifier // - An instance network interface identifier // @@ -17136,7 +17514,7 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu // - A bare metal server network interface identifier // - A virtual network interface identifier // - A VPN server identifier -// - An application load balancer identifier +// - A load balancer identifier // - An endpoint gateway identifier // - An instance network interface identifier // @@ -22477,6 +22855,18 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo if listEndpointGatewaysOptions.ResourceGroupID != nil { builder.AddQuery("resource_group.id", fmt.Sprint(*listEndpointGatewaysOptions.ResourceGroupID)) } + 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 { @@ -22546,6 +22936,9 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn 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 } @@ -23863,6 +24256,22 @@ type BackupPolicy struct { // The CRN for this backup policy. CRN *string `json:"crn" validate:"required"` + // The reasons for the current `health_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + 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"` @@ -23900,8 +24309,26 @@ type BackupPolicy struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` + + // The scope for this backup policy. + Scope BackupPolicyScopeIntf `json:"scope" 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. +const ( + BackupPolicyHealthStateDegradedConst = "degraded" + BackupPolicyHealthStateFaultedConst = "faulted" + BackupPolicyHealthStateInapplicableConst = "inapplicable" + BackupPolicyHealthStateOkConst = "ok" +) + // Constants associated with the BackupPolicy.LifecycleState property. // The lifecycle state of the backup policy. const ( @@ -23937,6 +24364,14 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalBackupPolicyHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -23977,6 +24412,10 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScope) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -24073,6 +24512,43 @@ func UnmarshalBackupPolicyCollectionNext(m map[string]json.RawMessage, result in return } +// BackupPolicyHealthReason : BackupPolicyHealthReason struct +type BackupPolicyHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the BackupPolicyHealthReason.Code property. +// A snake case string succinctly identifying the reason 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 { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + 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 @@ -25095,6 +25571,83 @@ func UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype(m map[string]json.RawM return } +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + 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) + if err != nil { + 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 interfaces. @@ -25920,10 +26473,10 @@ type BareMetalServerNetworkInterface struct { // 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 VLAN tag. + // - 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. + // - 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. // @@ -25959,15 +26512,22 @@ type BareMetalServerNetworkInterface struct { // The bare metal server network interface type. Type *string `json:"type" validate:"required"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // Indicates if the interface can float to any other server within the same - // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal - // server in the resource group. Applies only to `vlan` type interfaces. + // 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`. AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` - // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. Vlan *int64 `json:"vlan,omitempty"` } @@ -25979,10 +26539,10 @@ type BareMetalServerNetworkInterface struct { // 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 VLAN tag. +// - 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. +// - 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. // @@ -26147,7 +26707,8 @@ type BareMetalServerNetworkInterfacePatch struct { // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + // 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`: @@ -26227,11 +26788,11 @@ type BareMetalServerNetworkInterfacePrototype struct { // 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 VLAN tag. + // - 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. + // - 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`. @@ -26256,15 +26817,22 @@ type BareMetalServerNetworkInterfacePrototype struct { // The associated subnet. Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + // The VLAN IDs to allow for `vlan` interfaces using this PCI interface. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` - // Indicates if the interface can float to any other server within the same - // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal - // server in the resource group. Applies only to `vlan` type interfaces. + // 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`. AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` - // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. Vlan *int64 `json:"vlan,omitempty"` } @@ -26277,11 +26845,11 @@ type BareMetalServerNetworkInterfacePrototype struct { // 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 VLAN tag. +// - 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. +// - 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`. @@ -26410,7 +26978,7 @@ type BareMetalServerPrimaryNetworkInterfacePrototype struct { // Indicates whether source IP spoofing is allowed on this bare metal server network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` // If `true`: @@ -26432,7 +27000,7 @@ type BareMetalServerPrimaryNetworkInterfacePrototype struct { // 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 VLAN tag. + // - 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"` @@ -26465,7 +27033,7 @@ type BareMetalServerPrimaryNetworkInterfacePrototype struct { // 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 VLAN tag. +// - Cannot directly use an IEEE 802.1Q tag. // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" @@ -28066,9 +28634,14 @@ type CreateBackupPolicyOptions struct { 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) is used. + // 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"` + // Allows users to set headers on API requests Headers map[string]string } @@ -28116,6 +28689,12 @@ func (_options *CreateBackupPolicyOptions) SetResourceGroup(resourceGroup Resour return _options } +// SetScope : Allow user to set Scope +func (_options *CreateBackupPolicyOptions) SetScope(scope BackupPolicyScopePrototypeIntf) *CreateBackupPolicyOptions { + _options.Scope = scope + return _options +} + // SetHeaders : Allow user to set Headers func (options *CreateBackupPolicyOptions) SetHeaders(param map[string]string) *CreateBackupPolicyOptions { options.Headers = param @@ -28351,7 +28930,7 @@ type CreateBareMetalServerOptions struct { NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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"` @@ -28458,7 +29037,7 @@ type CreateDedicatedHostGroupOptions struct { 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) is used. + // 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 @@ -28555,6 +29134,13 @@ type CreateEndpointGatewayOptions struct { // The VPC this endpoint gateway will reside in. VPC VPCIdentityIntf `json:"vpc" validate:"required"` + // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in + // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. + // + // Must be `true` if the VPC this endpoint gateway resides in has `dns.enable_hub` set to + // `true`. + AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` + // The reserved IPs to bind to this endpoint gateway. At most one reserved IP per zone is allowed. Ips []EndpointGatewayReservedIPIntf `json:"ips,omitempty"` @@ -28563,7 +29149,7 @@ type CreateEndpointGatewayOptions struct { 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) is used. + // 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 endpoint gateway. If unspecified, the VPC's default security group is used. @@ -28593,6 +29179,12 @@ func (_options *CreateEndpointGatewayOptions) SetVPC(vpc VPCIdentityIntf) *Creat return _options } +// SetAllowDnsResolutionBinding : Allow user to set AllowDnsResolutionBinding +func (_options *CreateEndpointGatewayOptions) SetAllowDnsResolutionBinding(allowDnsResolutionBinding bool) *CreateEndpointGatewayOptions { + _options.AllowDnsResolutionBinding = core.BoolPtr(allowDnsResolutionBinding) + return _options +} + // SetIps : Allow user to set Ips func (_options *CreateEndpointGatewayOptions) SetIps(ips []EndpointGatewayReservedIPIntf) *CreateEndpointGatewayOptions { _options.Ips = ips @@ -28656,7 +29248,8 @@ type CreateFlowLogCollectorOptions struct { // The Cloud Object Storage bucket where the collected flows will be logged. // The bucket must exist and an IAM service authorization must grant // `IBM Cloud Flow Logs` resources of `VPC Infrastructure Services` writer - // access to the bucket. + // access to the bucket. For more information, see [Creating a flow log + // collector](https://cloud.ibm.com/docs/vpc?topic=vpc-ordering-flow-log-collector). StorageBucket LegacyCloudObjectStorageBucketIdentityIntf `json:"storage_bucket" validate:"required"` // The target this collector will collect flow logs for. If the target is an instance, @@ -28672,7 +29265,7 @@ type CreateFlowLogCollectorOptions struct { 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) is used. + // 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 @@ -28745,7 +29338,7 @@ type CreateIkePolicyOptions struct { 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) is used. + // 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 @@ -29209,7 +29802,7 @@ type CreateInstanceGroupOptions struct { 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) is used. + // 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 @@ -29286,7 +29879,7 @@ type CreateInstanceNetworkInterfaceOptions struct { // The associated subnet. Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - // Indicates whether source IP spoofing is allowed on this instance interface. + // Indicates whether source IP spoofing is allowed on this instance network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // The name for the instance network interface. The name must not be used by another network interface on the virtual @@ -29498,7 +30091,7 @@ type CreateIpsecPolicyOptions struct { 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) is used. + // 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 @@ -29616,7 +30209,7 @@ type CreateKeyOptions struct { 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) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The crypto-system used by this key. @@ -30129,7 +30722,7 @@ type CreateLoadBalancerOptions struct { Profile LoadBalancerProfileIdentityIntf `json:"profile,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Indicates whether route mode is enabled for this load balancer. @@ -30527,7 +31120,7 @@ type CreatePlacementGroupOptions struct { 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) is used. + // 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 @@ -30593,7 +31186,7 @@ type CreatePublicGatewayOptions struct { 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) is used. + // 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 @@ -30654,7 +31247,7 @@ type CreateSecurityGroupOptions struct { 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) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The prototype objects for rules to be created for this security group. If unspecified, no rules will be created, @@ -31117,6 +31710,59 @@ func (options *CreateVPCAddressPrefixOptions) SetHeaders(param map[string]string return options } +// CreateVPCDnsResolutionBindingOptions : The CreateVPCDnsResolutionBinding options. +type CreateVPCDnsResolutionBindingOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // Another VPC to bind this VPC to for DNS resolution. The VPC must have + // `dns.enable_hub` set to `true`, and may be in a different account (subject to + // IAM policies). + // + // Additionally, the VPC specified in the URL (this VPC) must have `dns.enable_hub` + // set to `false` and a `dns.resolution_binding_count` of zero. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The name for this DNS resolution binding. The name must not be used by another DNS resolution binding for the VPC. + // 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 +} + +// NewCreateVPCDnsResolutionBindingOptions : Instantiate CreateVPCDnsResolutionBindingOptions +func (*VpcV1) NewCreateVPCDnsResolutionBindingOptions(vpcID string, vpc VPCIdentityIntf) *CreateVPCDnsResolutionBindingOptions { + return &CreateVPCDnsResolutionBindingOptions{ + VPCID: core.StringPtr(vpcID), + VPC: vpc, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *CreateVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *CreateVPCDnsResolutionBindingOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPC : Allow user to set VPC +func (_options *CreateVPCDnsResolutionBindingOptions) SetVPC(vpc VPCIdentityIntf) *CreateVPCDnsResolutionBindingOptions { + _options.VPC = vpc + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCDnsResolutionBindingOptions) SetName(name string) *CreateVPCDnsResolutionBindingOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *CreateVPCDnsResolutionBindingOptions { + options.Headers = param + return options +} + // CreateVPCOptions : The CreateVPC options. type CreateVPCOptions struct { // Indicates whether a [default address prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes) @@ -31132,12 +31778,18 @@ type CreateVPCOptions struct { // connected in this way. This value is set at creation and subsequently immutable. ClassicAccess *bool `json:"classic_access,omitempty"` + // The DNS configuration for this VPC. + // + // If unspecified, the system will assign DNS servers capable of resolving hosts and endpoint + // gateways within this VPC, and hosts on the internet. + Dns *VpcdnsPrototype `json:"dns,omitempty"` + // The name for this VPC. The name must not be used by another VPC in the region. 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) is used. + // 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 @@ -31173,6 +31825,12 @@ func (_options *CreateVPCOptions) SetClassicAccess(classicAccess bool) *CreateVP return _options } +// SetDns : Allow user to set Dns +func (_options *CreateVPCOptions) SetDns(dns *VpcdnsPrototype) *CreateVPCOptions { + _options.Dns = dns + return _options +} + // SetName : Allow user to set Name func (_options *CreateVPCOptions) SetName(name string) *CreateVPCOptions { _options.Name = core.StringPtr(name) @@ -31672,7 +32330,7 @@ type CreateVPNServerOptions struct { Protocol *string `json:"protocol,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // 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 VPN server. If unspecified, the VPC's default security group is used. @@ -31903,6 +32561,71 @@ func UnmarshalDnsInstanceReference(m map[string]json.RawMessage, result interfac return } +// DnsServer : A DNS server. +type DnsServer struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // If present, DHCP configuration for this zone will have this DNS server listed first. + ZoneAffinity *ZoneReference `json:"zone_affinity,omitempty"` +} + +// UnmarshalDnsServer unmarshals an instance of DnsServer from the specified map of raw messages. +func UnmarshalDnsServer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsServer) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsServerPrototype : DnsServerPrototype struct +type DnsServerPrototype struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // DHCP configuration for the specified zone will have this DNS server listed first. + ZoneAffinity ZoneIdentityIntf `json:"zone_affinity,omitempty"` +} + +// NewDnsServerPrototype : Instantiate DnsServerPrototype (Generic Model Constructor) +func (*VpcV1) NewDnsServerPrototype(address string) (_model *DnsServerPrototype, err error) { + _model = &DnsServerPrototype{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalDnsServerPrototype unmarshals an instance of DnsServerPrototype from the specified map of raw messages. +func UnmarshalDnsServerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsServerPrototype) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // DnsZoneIdentity : Identifies a DNS zone by a unique property. // Models which "extend" this model: // - DnsZoneIdentityByID @@ -31986,6 +32709,9 @@ type DedicatedHost struct { // The name for this dedicated host. The name is unique across all dedicated hosts in the region. Name *string `json:"name" validate:"required"` + // The dedicated host NUMA configuration. + Numa *DedicatedHostNuma `json:"numa" validate:"required"` + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) for this // dedicated host. Profile *DedicatedHostProfileReference `json:"profile" validate:"required"` @@ -32105,6 +32831,10 @@ func UnmarshalDedicatedHost(m map[string]json.RawMessage, result interface{}) (e if err != nil { return } + err = core.UnmarshalModel(m, "numa", &obj.Numa, UnmarshalDedicatedHostNuma) + if err != nil { + return + } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileReference) if err != nil { return @@ -32790,6 +33520,54 @@ func UnmarshalDedicatedHostGroupReferenceDeleted(m map[string]json.RawMessage, r return } +// DedicatedHostNuma : The dedicated host NUMA configuration. +type DedicatedHostNuma struct { + // The total number of NUMA nodes for this dedicated host. + Count *int64 `json:"count" validate:"required"` + + // The NUMA nodes for this dedicated host. + Nodes []DedicatedHostNumaNode `json:"nodes" validate:"required"` +} + +// UnmarshalDedicatedHostNuma unmarshals an instance of DedicatedHostNuma from the specified map of raw messages. +func UnmarshalDedicatedHostNuma(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostNuma) + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalModel(m, "nodes", &obj.Nodes, UnmarshalDedicatedHostNumaNode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostNumaNode : The dedicated host NUMA node configuration. +type DedicatedHostNumaNode struct { + // The available VCPU for this NUMA node. + AvailableVcpu *int64 `json:"available_vcpu" validate:"required"` + + // The total VCPU capacity for this NUMA node. + Vcpu *int64 `json:"vcpu" validate:"required"` +} + +// UnmarshalDedicatedHostNumaNode unmarshals an instance of DedicatedHostNumaNode from the specified map of raw messages. +func UnmarshalDedicatedHostNumaNode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostNumaNode) + err = core.UnmarshalPrimitive(m, "available_vcpu", &obj.AvailableVcpu) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vcpu", &obj.Vcpu) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // DedicatedHostPatch : DedicatedHostPatch struct type DedicatedHostPatch struct { // If set to true, instances can be placed on this dedicated host. @@ -32849,6 +33627,21 @@ type DedicatedHostProfile struct { SocketCount DedicatedHostProfileSocketIntf `json:"socket_count" validate:"required"` + // The status of the dedicated host profile: + // - `previous`: This dedicated host profile is an older revision, but remains provisionable + // and usable. + // - `current`: This profile is the latest revision. + // + // Note that revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming + // conventions] + // (https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information on how + // generations are defined within a dedicated host profile. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + // The instance profiles usable by instances placed on dedicated hosts with this profile. SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` @@ -32871,6 +33664,25 @@ const ( DedicatedHostProfileFamilyMemoryConst = "memory" ) +// Constants associated with the DedicatedHostProfile.Status property. +// The status of the dedicated host profile: +// - `previous`: This dedicated host profile is an older revision, but remains provisionable +// and usable. +// - `current`: This profile is the latest revision. +// +// Note that revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming +// conventions] +// (https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information on how +// generations are defined within a dedicated host profile. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the +// unexpected property value was encountered. +const ( + DedicatedHostProfileStatusCurrentConst = "current" + DedicatedHostProfileStatusPreviousConst = "previous" +) + // UnmarshalDedicatedHostProfile unmarshals an instance of DedicatedHostProfile from the specified map of raw messages. func UnmarshalDedicatedHostProfile(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(DedicatedHostProfile) @@ -32902,6 +33714,10 @@ func UnmarshalDedicatedHostProfile(m map[string]json.RawMessage, result interfac if err != nil { return } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) if err != nil { return @@ -33565,7 +34381,7 @@ type DedicatedHostPrototype struct { Profile DedicatedHostProfileIdentityIntf `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) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The dedicated host group for this dedicated host. @@ -35668,11 +36484,52 @@ func (options *DeleteVPCAddressPrefixOptions) SetHeaders(param map[string]string return options } +// DeleteVPCDnsResolutionBindingOptions : The DeleteVPCDnsResolutionBinding options. +type DeleteVPCDnsResolutionBindingOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The DNS resolution binding identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCDnsResolutionBindingOptions : Instantiate DeleteVPCDnsResolutionBindingOptions +func (*VpcV1) NewDeleteVPCDnsResolutionBindingOptions(vpcID string, id string) *DeleteVPCDnsResolutionBindingOptions { + return &DeleteVPCDnsResolutionBindingOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *DeleteVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *DeleteVPCDnsResolutionBindingOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCDnsResolutionBindingOptions) SetID(id string) *DeleteVPCDnsResolutionBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *DeleteVPCDnsResolutionBindingOptions { + options.Headers = param + return options +} + // DeleteVPCOptions : The DeleteVPC options. type DeleteVPCOptions struct { // The VPC 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 } @@ -35690,6 +36547,12 @@ func (_options *DeleteVPCOptions) SetID(id string) *DeleteVPCOptions { return _options } +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteVPCOptions) SetIfMatch(ifMatch string) *DeleteVPCOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + // SetHeaders : Allow user to set Headers func (options *DeleteVPCOptions) SetHeaders(param map[string]string) *DeleteVPCOptions { options.Headers = param @@ -36124,6 +36987,10 @@ func UnmarshalEncryptionKeyReference(m map[string]json.RawMessage, result interf // EndpointGateway : EndpointGateway struct type EndpointGateway struct { + // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in + // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. + AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding" validate:"required"` + // The date and time that the endpoint gateway was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -36213,6 +37080,10 @@ const ( // UnmarshalEndpointGateway unmarshals an instance of EndpointGateway from the specified map of raw messages. func UnmarshalEndpointGateway(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(EndpointGateway) + err = core.UnmarshalPrimitive(m, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -36371,6 +37242,13 @@ func UnmarshalEndpointGatewayCollectionNext(m map[string]json.RawMessage, result // EndpointGatewayPatch : EndpointGatewayPatch struct type EndpointGatewayPatch struct { + // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in + // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. + // + // Must be `true` if the VPC this endpoint gateway resides in has `dns.enable_hub` set to + // `true`. + AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` + // The name for this endpoint gateway. The name must not be used by another endpoint gateway in the VPC. Name *string `json:"name,omitempty"` } @@ -36378,6 +37256,10 @@ type EndpointGatewayPatch struct { // UnmarshalEndpointGatewayPatch unmarshals an instance of EndpointGatewayPatch from the specified map of raw messages. func UnmarshalEndpointGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(EndpointGatewayPatch) + err = core.UnmarshalPrimitive(m, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -36414,6 +37296,92 @@ func UnmarshalEndpointGatewayReferenceDeleted(m map[string]json.RawMessage, resu return } +// EndpointGatewayReferenceRemote : EndpointGatewayReferenceRemote struct +type EndpointGatewayReferenceRemote struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` + + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + 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 *EndpointGatewayRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the EndpointGatewayReferenceRemote.ResourceType property. +// The resource type. +const ( + EndpointGatewayReferenceRemoteResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +// UnmarshalEndpointGatewayReferenceRemote unmarshals an instance of EndpointGatewayReferenceRemote from the specified map of raw messages. +func UnmarshalEndpointGatewayReferenceRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReferenceRemote) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalEndpointGatewayRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type EndpointGatewayRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // account, and identifies the owning account. + Account *AccountReference `json:"account,omitempty"` + + // If present, this property indicates that the referenced resource is remote to this + // region, and identifies the native region. + Region *RegionReference `json:"region,omitempty"` +} + +// UnmarshalEndpointGatewayRemote unmarshals an instance of EndpointGatewayRemote from the specified map of raw messages. +func UnmarshalEndpointGatewayRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayRemote) + err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // EndpointGatewayReservedIP : A reserved IP to bind to the endpoint gateway. This can be specified using an existing reserved IP, or a prototype // object for a new reserved IP. The reserved IP will be bound to the endpoint gateway to function as a virtual private // endpoint for the service. @@ -36596,8 +37564,8 @@ type FailoverShareOptions struct { // - `fail`: Fail the operation, resulting in the replication relationship being unchanged. // - `split`: Split the replica from its source, resulting in two individual read-write // file shares. Because the final sync was not completed, the replica may be - // out-of-date. This is useful in disaster recovery scenarios where the source is known - // to be unreachable. + // out-of-date. This occurs in disaster recovery scenarios where the source is known to + // be unreachable. FallbackPolicy *string `json:"fallback_policy,omitempty"` // The failover timeout in seconds. @@ -36614,8 +37582,8 @@ type FailoverShareOptions struct { // - `fail`: Fail the operation, resulting in the replication relationship being unchanged. // - `split`: Split the replica from its source, resulting in two individual read-write // file shares. Because the final sync was not completed, the replica may be -// out-of-date. This is useful in disaster recovery scenarios where the source is known -// to be unreachable. +// out-of-date. This occurs in disaster recovery scenarios where the source is known to +// be unreachable. const ( FailoverShareOptionsFallbackPolicyFailConst = "fail" FailoverShareOptionsFallbackPolicySplitConst = "split" @@ -36884,7 +37852,7 @@ type FloatingIPPrototype struct { 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) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The zone this floating IP will reside in. @@ -37207,7 +38175,9 @@ type FlowLogCollector struct { // The resource group for this flow log collector. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - // The Cloud Object Storage bucket where the collected flows are logged. + // The Cloud Object Storage bucket where the collected flows are logged. For more + // information, see [Viewing flow log + // objects](https://cloud.ibm.com/docs/vpc?topic=vpc-fl-analyze). StorageBucket *LegacyCloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` // The target this collector is collecting flow logs for. @@ -40023,6 +40993,44 @@ func (options *GetVPCDefaultSecurityGroupOptions) SetHeaders(param map[string]st return options } +// GetVPCDnsResolutionBindingOptions : The GetVPCDnsResolutionBinding options. +type GetVPCDnsResolutionBindingOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The DNS resolution binding identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDnsResolutionBindingOptions : Instantiate GetVPCDnsResolutionBindingOptions +func (*VpcV1) NewGetVPCDnsResolutionBindingOptions(vpcID string, id string) *GetVPCDnsResolutionBindingOptions { + return &GetVPCDnsResolutionBindingOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *GetVPCDnsResolutionBindingOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCDnsResolutionBindingOptions) SetID(id string) *GetVPCDnsResolutionBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *GetVPCDnsResolutionBindingOptions { + options.Headers = param + return options +} + // GetVPCOptions : The GetVPC options. type GetVPCOptions struct { // The VPC identifier. @@ -42063,7 +43071,7 @@ type ImagePrototype struct { ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. @@ -42368,6 +43376,11 @@ type Instance struct { // The network interfaces for this instance, including the primary network interface. NetworkInterfaces []NetworkInterfaceInstanceContextReference `json:"network_interfaces" validate:"required"` + // The number of NUMA nodes this virtual server instance is provisioned on. + // + // This property will be absent if the instance's `status` is not `running`. + NumaCount *int64 `json:"numa_count,omitempty"` + // The placement restrictions for the virtual server instance. PlacementTarget InstancePlacementTargetIntf `json:"placement_target,omitempty"` @@ -42532,6 +43545,10 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er if err != nil { return } + err = core.UnmarshalPrimitive(m, "numa_count", &obj.NumaCount) + if err != nil { + return + } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTarget) if err != nil { return @@ -45798,10 +46815,27 @@ type InstanceProfile struct { NetworkInterfaceCount InstanceProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` + NumaCount InstanceProfileNumaCountIntf `json:"numa_count,omitempty"` + OsArchitecture *InstanceProfileOsArchitecture `json:"os_architecture" validate:"required"` PortSpeed InstanceProfilePortSpeedIntf `json:"port_speed" validate:"required"` + // The status of the instance profile: + // - `previous`: This instance profile is an older revision, but remains provisionable and + // usable. + // - `current`: This profile is the latest revision. + // + // Note that revisions are indicated by the generation of an instance profile. Refer to the + // [profile naming conventions] + // (https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on how + // generations are defined within an instance profile. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + TotalVolumeBandwidth InstanceProfileVolumeBandwidthIntf `json:"total_volume_bandwidth" validate:"required"` VcpuArchitecture *InstanceProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` @@ -45811,6 +46845,25 @@ type InstanceProfile struct { VcpuManufacturer *InstanceProfileVcpuManufacturer `json:"vcpu_manufacturer" validate:"required"` } +// Constants associated with the InstanceProfile.Status property. +// The status of the instance profile: +// - `previous`: This instance profile is an older revision, but remains provisionable and +// usable. +// - `current`: This profile is the latest revision. +// +// Note that revisions are indicated by the generation of an instance profile. Refer to the +// [profile naming conventions] +// (https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on how +// generations are defined within an instance profile. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the +// unexpected property value was encountered. +const ( + InstanceProfileStatusCurrentConst = "current" + InstanceProfileStatusPreviousConst = "previous" +) + // UnmarshalInstanceProfile unmarshals an instance of InstanceProfile from the specified map of raw messages. func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceProfile) @@ -45858,6 +46911,10 @@ func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "numa_count", &obj.NumaCount, UnmarshalInstanceProfileNumaCount) + if err != nil { + return + } err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalInstanceProfileOsArchitecture) if err != nil { return @@ -45866,6 +46923,10 @@ func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } err = core.UnmarshalModel(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth, UnmarshalInstanceProfileVolumeBandwidth) if err != nil { return @@ -46557,6 +47618,47 @@ func UnmarshalInstanceProfileMemory(m map[string]json.RawMessage, result interfa return } +// InstanceProfileNumaCount : InstanceProfileNumaCount struct +// Models which "extend" this model: +// - InstanceProfileNumaCountFixed +// - InstanceProfileNumaCountDependent +type InstanceProfileNumaCount struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` +} + +// Constants associated with the InstanceProfileNumaCount.Type property. +// The type for this profile field. +const ( + InstanceProfileNumaCountTypeFixedConst = "fixed" +) + +func (*InstanceProfileNumaCount) isaInstanceProfileNumaCount() bool { + return true +} + +type InstanceProfileNumaCountIntf interface { + isaInstanceProfileNumaCount() bool +} + +// UnmarshalInstanceProfileNumaCount unmarshals an instance of InstanceProfileNumaCount from the specified map of raw messages. +func UnmarshalInstanceProfileNumaCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNumaCount) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceProfileNetworkInterfaceCount : InstanceProfileNetworkInterfaceCount struct // Models which "extend" this model: // - InstanceProfileNetworkInterfaceCountRange @@ -46990,7 +48092,7 @@ type InstancePrototype struct { Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -47650,7 +48752,7 @@ type InstanceTemplatePrototype struct { Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -48692,18 +49794,6 @@ type ListBareMetalServersOptions struct { // Filters the collection to resources with a `vpc.name` property matching the exact specified name. VPCName *string `json:"vpc.name,omitempty"` - // Filters the collection to bare metal servers with an item in the `network_interfaces` property with a `subnet.id` - // property matching the specified identifier. - NetworkInterfacesSubnetID *string `json:"network_interfaces.subnet.id,omitempty"` - - // Filters the collection to bare metal servers with an item in the `network_interfaces` property with a `subnet.crn` - // property matching the specified CRN. - NetworkInterfacesSubnetCRN *string `json:"network_interfaces.subnet.crn,omitempty"` - - // Filters the collection to bare metal servers with an item in the `network_interfaces` property with a `subnet.name` - // property matching the exact specified name. - NetworkInterfacesSubnetName *string `json:"network_interfaces.subnet.name,omitempty"` - // Allows users to set headers on API requests Headers map[string]string } @@ -48755,24 +49845,6 @@ func (_options *ListBareMetalServersOptions) SetVPCName(vpcName string) *ListBar return _options } -// SetNetworkInterfacesSubnetID : Allow user to set NetworkInterfacesSubnetID -func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetID(networkInterfacesSubnetID string) *ListBareMetalServersOptions { - _options.NetworkInterfacesSubnetID = core.StringPtr(networkInterfacesSubnetID) - return _options -} - -// SetNetworkInterfacesSubnetCRN : Allow user to set NetworkInterfacesSubnetCRN -func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetCRN(networkInterfacesSubnetCRN string) *ListBareMetalServersOptions { - _options.NetworkInterfacesSubnetCRN = core.StringPtr(networkInterfacesSubnetCRN) - return _options -} - -// SetNetworkInterfacesSubnetName : Allow user to set NetworkInterfacesSubnetName -func (_options *ListBareMetalServersOptions) SetNetworkInterfacesSubnetName(networkInterfacesSubnetName string) *ListBareMetalServersOptions { - _options.NetworkInterfacesSubnetName = core.StringPtr(networkInterfacesSubnetName) - return _options -} - // SetHeaders : Allow user to set Headers func (options *ListBareMetalServersOptions) SetHeaders(param map[string]string) *ListBareMetalServersOptions { options.Headers = param @@ -49056,6 +50128,19 @@ type ListEndpointGatewaysOptions struct { // 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 `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to endpoint gateways with an `allow_dns_resolution_binding` property matching the specified + // value. + AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -49089,6 +50174,30 @@ func (_options *ListEndpointGatewaysOptions) SetResourceGroupID(resourceGroupID return _options } +// SetVPCID : Allow user to set VPCID +func (_options *ListEndpointGatewaysOptions) SetVPCID(vpcID string) *ListEndpointGatewaysOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListEndpointGatewaysOptions) SetVPCCRN(vpcCRN string) *ListEndpointGatewaysOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListEndpointGatewaysOptions) SetVPCName(vpcName string) *ListEndpointGatewaysOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetAllowDnsResolutionBinding : Allow user to set AllowDnsResolutionBinding +func (_options *ListEndpointGatewaysOptions) SetAllowDnsResolutionBinding(allowDnsResolutionBinding bool) *ListEndpointGatewaysOptions { + _options.AllowDnsResolutionBinding = core.BoolPtr(allowDnsResolutionBinding) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListEndpointGatewaysOptions) SetHeaders(param map[string]string) *ListEndpointGatewaysOptions { options.Headers = param @@ -51648,6 +52757,109 @@ func (options *ListVPCAddressPrefixesOptions) SetHeaders(param map[string]string return options } +// ListVPCDnsResolutionBindingsOptions : The ListVPCDnsResolutionBindings options. +type ListVPCDnsResolutionBindingsOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // 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"` + + // 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"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to resources with a `vpc.remote.account.id` property matching the specified account + // identifier. + AccountID *string `json:"account.id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPCDnsResolutionBindingsOptions.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 ( + ListVPCDnsResolutionBindingsOptionsSortCreatedAtConst = "created_at" + ListVPCDnsResolutionBindingsOptionsSortNameConst = "name" +) + +// NewListVPCDnsResolutionBindingsOptions : Instantiate ListVPCDnsResolutionBindingsOptions +func (*VpcV1) NewListVPCDnsResolutionBindingsOptions(vpcID string) *ListVPCDnsResolutionBindingsOptions { + return &ListVPCDnsResolutionBindingsOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCID(vpcID string) *ListVPCDnsResolutionBindingsOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPCDnsResolutionBindingsOptions) SetSort(sort string) *ListVPCDnsResolutionBindingsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPCDnsResolutionBindingsOptions) SetStart(start string) *ListVPCDnsResolutionBindingsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPCDnsResolutionBindingsOptions) SetLimit(limit int64) *ListVPCDnsResolutionBindingsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListVPCDnsResolutionBindingsOptions) SetName(name string) *ListVPCDnsResolutionBindingsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCCRN(vpcCRN string) *ListVPCDnsResolutionBindingsOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCName(vpcName string) *ListVPCDnsResolutionBindingsOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetAccountID : Allow user to set AccountID +func (_options *ListVPCDnsResolutionBindingsOptions) SetAccountID(accountID string) *ListVPCDnsResolutionBindingsOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCDnsResolutionBindingsOptions) SetHeaders(param map[string]string) *ListVPCDnsResolutionBindingsOptions { + options.Headers = param + return options +} + // ListVPCRoutesOptions : The ListVPCRoutes options. type ListVPCRoutesOptions struct { // The VPC identifier. @@ -52357,6 +53569,8 @@ type LoadBalancer struct { // The security groups targeting this load balancer. // + // If empty, all inbound and outbound traffic is allowed. + // // Applicable only for load balancers that support security groups. SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` @@ -56481,7 +57695,7 @@ type NetworkACLPrototype struct { 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) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The VPC this network ACL will reside in. @@ -57447,7 +58661,7 @@ func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, resul // NetworkInterface : NetworkInterface struct type NetworkInterface struct { - // Indicates whether source IP spoofing is allowed on this instance interface. + // Indicates whether source IP spoofing is allowed on this instance network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` // The date and time that the instance network interface was created. @@ -57796,7 +59010,7 @@ func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json. // NetworkInterfacePatch : NetworkInterfacePatch struct type NetworkInterfacePatch struct { - // Indicates whether source IP spoofing is allowed on this instance interface. + // Indicates whether source IP spoofing is allowed on this instance network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // The name for the instance network interface. The name must not be used by another network interface on the virtual @@ -57831,7 +59045,7 @@ func (networkInterfacePatch *NetworkInterfacePatch) AsPatch() (_patch map[string // NetworkInterfacePrototype : NetworkInterfacePrototype struct type NetworkInterfacePrototype struct { - // Indicates whether source IP spoofing is allowed on this instance interface. + // Indicates whether source IP spoofing is allowed on this instance network interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` // The name for the instance network interface. The name must not be used by another network interface on the virtual @@ -58680,7 +59894,7 @@ type PublicGatewayFloatingIPPrototype struct { 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) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` } @@ -60096,7 +61310,7 @@ func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) ( } // ResourceGroupIdentity : The resource group to use. If unspecified, the account's [default resource -// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. +// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. // Models which "extend" this model: // - ResourceGroupIdentityByID type ResourceGroupIdentity struct { @@ -63651,16 +64865,16 @@ type ShareMountTargetVirtualNetworkInterfacePrototype struct { // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `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) is used. + // The resource group to use for this virtual network interface. If unspecified, the + // share's resource group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,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 and - // `primary_ip.address` is not specified. + // The associated subnet. Required if `primary_ip` does not specify a reserved IP + // identity. Subnet SubnetIdentityIntf `json:"subnet,omitempty"` } @@ -64216,7 +65430,9 @@ type SharePrototype struct { UserTags []string `json:"user_tags,omitempty"` // The zone this file share will reside in. - // For a replica share, this must be a different zone in the same region as the source share. + // + // For a replica share, this must be a different zone in the same region as the + // source share. Zone ZoneIdentityIntf `json:"zone" validate:"required"` // The access control mode for the share: @@ -64240,7 +65456,7 @@ type SharePrototype struct { InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The size of the file share rounded up to the next gigabyte. @@ -65087,7 +66303,7 @@ type SnapshotPrototype struct { 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) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. @@ -65762,7 +66978,7 @@ type SubnetPrototype struct { PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The routing table to use for this subnet. If unspecified, the default routing table @@ -68158,6 +69374,54 @@ func (options *UpdateVPCAddressPrefixOptions) SetHeaders(param map[string]string return options } +// UpdateVPCDnsResolutionBindingOptions : The UpdateVPCDnsResolutionBinding options. +type UpdateVPCDnsResolutionBindingOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The DNS resolution binding identifier. + ID *string `json:"id" validate:"required,ne="` + + // The DNS resolution binding patch. + VpcdnsResolutionBindingPatch map[string]interface{} `json:"VpcdnsResolutionBinding_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCDnsResolutionBindingOptions : Instantiate UpdateVPCDnsResolutionBindingOptions +func (*VpcV1) NewUpdateVPCDnsResolutionBindingOptions(vpcID string, id string, vpcdnsResolutionBindingPatch map[string]interface{}) *UpdateVPCDnsResolutionBindingOptions { + return &UpdateVPCDnsResolutionBindingOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + VpcdnsResolutionBindingPatch: vpcdnsResolutionBindingPatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *UpdateVPCDnsResolutionBindingOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCDnsResolutionBindingOptions) SetID(id string) *UpdateVPCDnsResolutionBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVpcdnsResolutionBindingPatch : Allow user to set VpcdnsResolutionBindingPatch +func (_options *UpdateVPCDnsResolutionBindingOptions) SetVpcdnsResolutionBindingPatch(vpcdnsResolutionBindingPatch map[string]interface{}) *UpdateVPCDnsResolutionBindingOptions { + _options.VpcdnsResolutionBindingPatch = vpcdnsResolutionBindingPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *UpdateVPCDnsResolutionBindingOptions { + options.Headers = param + return options +} + // UpdateVPCOptions : The UpdateVPC options. type UpdateVPCOptions struct { // The VPC identifier. @@ -68166,6 +69430,10 @@ type UpdateVPCOptions struct { // The VPC patch. VPCPatch map[string]interface{} `json:"VPC_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 } @@ -68190,6 +69458,12 @@ func (_options *UpdateVPCOptions) SetVPCPatch(vpcPatch map[string]interface{}) * return _options } +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVPCOptions) SetIfMatch(ifMatch string) *UpdateVPCOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + // SetHeaders : Allow user to set Headers func (options *UpdateVPCOptions) SetHeaders(param map[string]string) *UpdateVPCOptions { options.Headers = param @@ -68601,6 +69875,25 @@ type VPC struct { // default. DefaultSecurityGroup *SecurityGroupReference `json:"default_security_group" validate:"required"` + // The DNS configuration for this VPC. + Dns *Vpcdns `json:"dns" validate:"required"` + + // The reasons for the current `health_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPCHealthReason `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 VPC. Href *string `json:"href" validate:"required"` @@ -68620,6 +69913,21 @@ type VPC struct { Status *string `json:"status" validate:"required"` } +// Constants associated with the VPC.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 ( + VPCHealthStateDegradedConst = "degraded" + VPCHealthStateFaultedConst = "faulted" + VPCHealthStateInapplicableConst = "inapplicable" + VPCHealthStateOkConst = "ok" +) + // Constants associated with the VPC.ResourceType property. // The resource type. const ( @@ -68666,6 +69974,18 @@ func UnmarshalVPC(m map[string]json.RawMessage, result interface{}) (err error) if err != nil { return } + err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdns) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPCHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -68810,6 +70130,604 @@ func UnmarshalVPCCollectionNext(m map[string]json.RawMessage, result interface{} return } +// Vpcdns : The DNS configuration for this VPC. +type Vpcdns struct { + // Indicates whether this VPC is enabled as a DNS name resolution hub. + EnableHub *bool `json:"enable_hub" validate:"required"` + + // The number of DNS resolution bindings for this VPC. + ResolutionBindingCount *int64 `json:"resolution_binding_count" validate:"required"` + + // The DNS resolver configuration for the VPC. + Resolver VpcdnsResolverIntf `json:"resolver" validate:"required"` +} + +// UnmarshalVpcdns unmarshals an instance of Vpcdns from the specified map of raw messages. +func UnmarshalVpcdns(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Vpcdns) + err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resolution_binding_count", &obj.ResolutionBindingCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolver) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsPatch : The DNS configuration for this VPC. +type VpcdnsPatch struct { + // Indicates whether this VPC is enabled as a DNS name resolution hub. + // + // Updating the value to `true` requires `allow_dns_resolution_binding` to be `true` for all endpoint gateways residing + // in this VPC. + // + // Changing the value requires `dns.resolution_binding_count` to be zero. + EnableHub *bool `json:"enable_hub,omitempty"` + + Resolver *VpcdnsResolverPatch `json:"resolver,omitempty"` +} + +// UnmarshalVpcdnsPatch unmarshals an instance of VpcdnsPatch from the specified map of raw messages. +func UnmarshalVpcdnsPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsPatch) + err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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, +// and hosts on the internet. +type VpcdnsPrototype struct { + // Indicates whether this VPC is enabled as a DNS name resolution hub. + EnableHub *bool `json:"enable_hub,omitempty"` + + Resolver VpcdnsResolverPrototypeIntf `json:"resolver,omitempty"` +} + +// UnmarshalVpcdnsPrototype unmarshals an instance of VpcdnsPrototype from the specified map of raw messages. +func UnmarshalVpcdnsPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsPrototype) + err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolutionBinding : VpcdnsResolutionBinding struct +type VpcdnsResolutionBinding struct { + // The date and time that the DNS resolution binding was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The endpoint gateways that have `allow_dns_resolution_binding` set to `true` and reside in the VPC that has + // `dns.enable_hub` set to `false`. + // + // The endpoint gateways may be remote and therefore may not be directly retrievable. + EndpointGateways []EndpointGatewayReferenceRemote `json:"endpoint_gateways" validate:"required"` + + // The URL for this DNS resolution binding. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this DNS resolution binding. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the DNS resolution binding. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this DNS resolution binding. The name is unique across all DNS resolution bindings for the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The VPC bound to for DNS resolution. + // + // The VPC may be remote and therefore may not be directly retrievable. + VPC *VPCReferenceRemote `json:"vpc" validate:"required"` +} + +// Constants associated with the VpcdnsResolutionBinding.LifecycleState property. +// The lifecycle state of the DNS resolution binding. +const ( + VpcdnsResolutionBindingLifecycleStateDeletingConst = "deleting" + VpcdnsResolutionBindingLifecycleStateFailedConst = "failed" + VpcdnsResolutionBindingLifecycleStatePendingConst = "pending" + VpcdnsResolutionBindingLifecycleStateStableConst = "stable" + VpcdnsResolutionBindingLifecycleStateSuspendedConst = "suspended" + VpcdnsResolutionBindingLifecycleStateUpdatingConst = "updating" + VpcdnsResolutionBindingLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VpcdnsResolutionBinding.ResourceType property. +// The resource type. +const ( + VpcdnsResolutionBindingResourceTypeVPCDnsResolutionBindingConst = "vpc_dns_resolution_binding" +) + +// UnmarshalVpcdnsResolutionBinding unmarshals an instance of VpcdnsResolutionBinding from the specified map of raw messages. +func UnmarshalVpcdnsResolutionBinding(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolutionBinding) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGatewayReferenceRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceRemote) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolutionBindingCollection : VpcdnsResolutionBindingCollection struct +type VpcdnsResolutionBindingCollection struct { + // Collection of DNS resolution bindings for this VPC. + DnsResolutionBindings []VpcdnsResolutionBinding `json:"dns_resolution_bindings" validate:"required"` + + // A link to the first page of resources. + First *VpcdnsResolutionBindingCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalVpcdnsResolutionBindingCollection unmarshals an instance of VpcdnsResolutionBindingCollection from the specified map of raw messages. +func UnmarshalVpcdnsResolutionBindingCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolutionBindingCollection) + err = core.UnmarshalModel(m, "dns_resolution_bindings", &obj.DnsResolutionBindings, UnmarshalVpcdnsResolutionBinding) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVpcdnsResolutionBindingCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVpcdnsResolutionBindingCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *VpcdnsResolutionBindingCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// VpcdnsResolutionBindingPatch : VpcdnsResolutionBindingPatch struct +type VpcdnsResolutionBindingPatch struct { + // The name for this DNS resolution binding. The name must not be used by another DNS resolution binding for the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVpcdnsResolutionBindingPatch unmarshals an instance of VpcdnsResolutionBindingPatch from the specified map of raw messages. +func UnmarshalVpcdnsResolutionBindingPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolutionBindingPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VpcdnsResolver : VpcdnsResolver struct +// Models which "extend" this model: +// - VpcdnsResolverTypeDelegated +// - VpcdnsResolverTypeManual +// - VpcdnsResolverTypeSystem +type VpcdnsResolver struct { + // The DNS servers for this VPC. The servers are populated: + // + // - by the system when `dns.resolver.type` is `system` + // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + Servers []DnsServer `json:"servers" validate:"required"` + + // The type of the DNS resolver used for the VPC. + // + // - `delegated`: DNS server addresses are provided by the DNS resolver of the VPC + // specified in `dns.resolver.vpc`. + // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. + // - `system`: DNS server addresses are provided by the system. + Type *string `json:"type" validate:"required"` + + // The VPC whose DNS resolver provides the DNS server addresses for this VPC. + // + // The VPC may be remote and therefore may not be directly retrievable. + VPC *VPCReferenceDnsResolverContext `json:"vpc,omitempty"` + + // The manually specified DNS servers for this VPC. + ManualServers []DnsServer `json:"manual_servers,omitempty"` + + // The configuration of the system DNS resolver for this VPC. + // + // - `custom_resolver`: A custom DNS resolver is configured for this VPC. + // + // - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when + // the VPC has either or both of the following: + // + // - at least one endpoint gateway residing in it + // - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it + // + // - `default`: The provider default DNS resolvers are configured for this VPC. + // + // This system DNS resolver configuration is used when the VPC has: + // + // - no custom DNS resolver configured for it, and + // - no endpoint gateways residing in it, and + // - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. + Configuration *string `json:"configuration,omitempty"` +} + +// Constants associated with the VpcdnsResolver.Type property. +// The type of the DNS resolver used for the VPC. +// +// - `delegated`: DNS server addresses are provided by the DNS resolver of the VPC +// specified in `dns.resolver.vpc`. +// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. +// - `system`: DNS server addresses are provided by the system. +const ( + VpcdnsResolverTypeDelegatedConst = "delegated" + VpcdnsResolverTypeManualConst = "manual" + VpcdnsResolverTypeSystemConst = "system" +) + +// Constants associated with the VpcdnsResolver.Configuration property. +// The configuration of the system DNS resolver for this VPC. +// +// - `custom_resolver`: A custom DNS resolver is configured for this VPC. +// +// - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when +// the VPC has either or both of the following: +// +// - at least one endpoint gateway residing in it +// +// - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it +// +// - `default`: The provider default DNS resolvers are configured for this VPC. +// +// This system DNS resolver configuration is used when the VPC has: +// +// - no custom DNS resolver configured for it, and +// - no endpoint gateways residing in it, and +// - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. +const ( + VpcdnsResolverConfigurationCustomResolverConst = "custom_resolver" + VpcdnsResolverConfigurationDefaultConst = "default" + VpcdnsResolverConfigurationPrivateResolverConst = "private_resolver" +) + +func (*VpcdnsResolver) isaVpcdnsResolver() bool { + return true +} + +type VpcdnsResolverIntf interface { + isaVpcdnsResolver() bool +} + +// UnmarshalVpcdnsResolver unmarshals an instance of VpcdnsResolver from the specified map of raw messages. +func UnmarshalVpcdnsResolver(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolver) + err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverPatch : VpcdnsResolverPatch struct +type VpcdnsResolverPatch struct { + // The DNS servers to use for this VPC, replacing any existing servers. All the DNS servers must either: + // + // - have a unique `zone_affinity`, or + // - not have a `zone_affinity`. + // + // `dns.resolver.manual_servers` must be set if and only if `dns.resolver.type` is `manual`. + ManualServers []DnsServerPrototype `json:"manual_servers,omitempty"` + + // The type of the DNS resolver to use. + // + // - `delegated`: DNS server addresses will be provided by the resolver for the VPC + // specified in `dns.resolver.vpc`. Requires `dns.enable_hub` to be + // `false`. + // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. + // - `system`: DNS server addresses will be provided by the system and depend on the + // configuration. + // + // Updating from `manual` requires `dns.resolver.manual_servers` to be specified as + // `null`. + // + // Updating to `manual` requires `dns.resolver.manual_servers` to be specified and not empty. + // + // Updating from `delegated` requires `dns.resolver.vpc` to be specified as `null`. + Type *string `json:"type,omitempty"` + + // The VPC to provide DNS server addresses for this VPC. The specified VPC must be configured + // with a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) custom resolver and must be in + // one of this VPC's DNS resolution bindings. + // + // Specify `null` to remove an existing VPC. + // + // This property must be set if and only if `dns.resolver.type` is `delegated`. + VPC VpcdnsResolverVPCPatchIntf `json:"vpc,omitempty"` +} + +// Constants associated with the VpcdnsResolverPatch.Type property. +// The type of the DNS resolver to use. +// +// - `delegated`: DNS server addresses will be provided by the resolver for the VPC +// specified in `dns.resolver.vpc`. Requires `dns.enable_hub` to be +// `false`. +// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. +// - `system`: DNS server addresses will be provided by the system and depend on the +// configuration. +// +// Updating from `manual` requires `dns.resolver.manual_servers` to be specified as +// `null`. +// +// Updating to `manual` requires `dns.resolver.manual_servers` to be specified and not empty. +// +// Updating from `delegated` requires `dns.resolver.vpc` to be specified as `null`. +const ( + VpcdnsResolverPatchTypeDelegatedConst = "delegated" + VpcdnsResolverPatchTypeManualConst = "manual" + VpcdnsResolverPatchTypeSystemConst = "system" +) + +// UnmarshalVpcdnsResolverPatch unmarshals an instance of VpcdnsResolverPatch from the specified map of raw messages. +func UnmarshalVpcdnsResolverPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverPatch) + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVpcdnsResolverVPCPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverPrototype : VpcdnsResolverPrototype struct +// Models which "extend" this model: +// - VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype +// - VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype +type VpcdnsResolverPrototype struct { + // The type of the DNS resolver to use. + // + // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. + // - `system`: DNS server addresses will be provided by the system and depend on the + // configuration. + Type *string `json:"type,omitempty"` + + // The DNS servers to use for this VPC. All the DNS servers must either: + // + // - have a unique `zone_affinity`, or + // - not have a `zone_affinity`. + ManualServers []DnsServerPrototype `json:"manual_servers,omitempty"` +} + +// Constants associated with the VpcdnsResolverPrototype.Type property. +// The type of the DNS resolver to use. +// +// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. +// - `system`: DNS server addresses will be provided by the system and depend on the +// configuration. +const ( + VpcdnsResolverPrototypeTypeManualConst = "manual" + VpcdnsResolverPrototypeTypeSystemConst = "system" +) + +func (*VpcdnsResolverPrototype) isaVpcdnsResolverPrototype() bool { + return true +} + +type VpcdnsResolverPrototypeIntf interface { + isaVpcdnsResolverPrototype() bool +} + +// UnmarshalVpcdnsResolverPrototype unmarshals an instance of VpcdnsResolverPrototype from the specified map of raw messages. +func UnmarshalVpcdnsResolverPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverPrototype) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverVPCPatch : The VPC to provide DNS server addresses for this VPC. The specified VPC must be configured with a [DNS +// Services](https://cloud.ibm.com/docs/dns-svcs) custom resolver and must be in one of this VPC's DNS resolution +// bindings. +// +// Specify `null` to remove an existing VPC. +// +// This property must be set if and only if `dns.resolver.type` is `delegated`. +// Models which "extend" this model: +// - VpcdnsResolverVPCPatchVPCIdentityByID +// - VpcdnsResolverVPCPatchVPCIdentityByCRN +// - VpcdnsResolverVPCPatchVPCIdentityByHref +type VpcdnsResolverVPCPatch struct { + // The unique identifier for this VPC. + ID *string `json:"id,omitempty"` + + // The CRN for this VPC. + CRN *string `json:"crn,omitempty"` + + // The URL for this VPC. + Href *string `json:"href,omitempty"` +} + +func (*VpcdnsResolverVPCPatch) isaVpcdnsResolverVPCPatch() bool { + return true +} + +type VpcdnsResolverVPCPatchIntf interface { + isaVpcdnsResolverVPCPatch() bool +} + +// UnmarshalVpcdnsResolverVPCPatch unmarshals an instance of VpcdnsResolverVPCPatch from the specified map of raw messages. +func UnmarshalVpcdnsResolverVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverVPCPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCHealthReason : VPCHealthReason struct +type VPCHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the VPCHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + VPCHealthReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalVPCHealthReason unmarshals an instance of VPCHealthReason from the specified map of raw messages. +func UnmarshalVPCHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPCIdentity : Identifies a VPC by a unique property. // Models which "extend" this model: // - VPCIdentityByID @@ -68855,6 +70773,9 @@ func UnmarshalVPCIdentity(m map[string]json.RawMessage, result interface{}) (err // VPCPatch : VPCPatch struct type VPCPatch struct { + // The DNS configuration for this VPC. + Dns *VpcdnsPatch `json:"dns,omitempty"` + // The name for this VPC. The name must not be used by another VPC in the region. Name *string `json:"name,omitempty"` } @@ -68862,6 +70783,10 @@ type VPCPatch struct { // UnmarshalVPCPatch unmarshals an instance of VPCPatch from the specified map of raw messages. func UnmarshalVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VPCPatch) + err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdnsPatch) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -68939,6 +70864,75 @@ func UnmarshalVPCReference(m map[string]json.RawMessage, result interface{}) (er return } +// VPCReferenceDnsResolverContext : A VPC whose DNS resolver is delegated to provide DNS servers for this VPC. +// +// The VPC may be remote and therefore may not be directly retrievable. +type VPCReferenceDnsResolverContext struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPCReferenceDnsResolverContextDeleted `json:"deleted,omitempty"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The name for this VPC. The name is unique across all VPCs in the region. + 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 *VPCRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPCReferenceDnsResolverContext.ResourceType property. +// The resource type. +const ( + VPCReferenceDnsResolverContextResourceTypeVPCConst = "vpc" +) + +// UnmarshalVPCReferenceDnsResolverContext unmarshals an instance of VPCReferenceDnsResolverContext from the specified map of raw messages. +func UnmarshalVPCReferenceDnsResolverContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReferenceDnsResolverContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDnsResolverContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVPCRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPCReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary // information. type VPCReferenceDeleted struct { @@ -68957,6 +70951,110 @@ func UnmarshalVPCReferenceDeleted(m map[string]json.RawMessage, result interface return } +// VPCReferenceDnsResolverContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPCReferenceDnsResolverContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPCReferenceDnsResolverContextDeleted unmarshals an instance of VPCReferenceDnsResolverContextDeleted from the specified map of raw messages. +func UnmarshalVPCReferenceDnsResolverContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReferenceDnsResolverContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCReferenceRemote : VPCReferenceRemote struct +type VPCReferenceRemote struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The name for this VPC. The name is unique across all VPCs in the region. + 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 *VPCRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPCReferenceRemote.ResourceType property. +// The resource type. +const ( + VPCReferenceRemoteResourceTypeVPCConst = "vpc" +) + +// UnmarshalVPCReferenceRemote unmarshals an instance of VPCReferenceRemote from the specified map of raw messages. +func UnmarshalVPCReferenceRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReferenceRemote) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVPCRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type VPCRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // account, and identifies the owning account. + Account *AccountReference `json:"account,omitempty"` + + // If present, this property indicates that the referenced resource is remote to this + // region, and identifies the native region. + Region *RegionReference `json:"region,omitempty"` +} + +// UnmarshalVPCRemote unmarshals an instance of VPCRemote from the specified map of raw messages. +func UnmarshalVPCRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCRemote) + err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNGateway : VPNGateway struct // Models which "extend" this model: // - VPNGatewayRouteMode @@ -68971,12 +71069,44 @@ type VPNGateway struct { // The VPN gateway's CRN. CRN *string `json:"crn" validate:"required"` + // The reasons for the current VPN gateway health_state (if any): + // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (contact IBM support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPNGatewayHealthReason `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 VPN gateway's canonical URL. Href *string `json:"href" validate:"required"` // The unique identifier for this VPN gateway. ID *string `json:"id" validate:"required"` + // The reasons for the current VPN gateway lifecycle_state (if any): + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the VPN gateway. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + // Collection of VPN gateway members. Members []VPNGatewayMember `json:"members" validate:"required"` @@ -68989,9 +71119,6 @@ type VPNGateway struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The status of the VPN gateway. - Status *string `json:"status" validate:"required"` - Subnet *SubnetReference `json:"subnet" validate:"required"` // The VPC this VPN gateway resides in. @@ -69001,19 +71128,37 @@ type VPNGateway struct { Mode *string `json:"mode,omitempty"` } -// Constants associated with the VPNGateway.ResourceType property. -// The resource type. +// Constants associated with the VPNGateway.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 ( - VPNGatewayResourceTypeVPNGatewayConst = "vpn_gateway" + VPNGatewayHealthStateDegradedConst = "degraded" + VPNGatewayHealthStateFaultedConst = "faulted" + VPNGatewayHealthStateInapplicableConst = "inapplicable" + VPNGatewayHealthStateOkConst = "ok" ) -// Constants associated with the VPNGateway.Status property. -// The status of the VPN gateway. +// Constants associated with the VPNGateway.LifecycleState property. +// The lifecycle state of the VPN gateway. const ( - VPNGatewayStatusAvailableConst = "available" - VPNGatewayStatusDeletingConst = "deleting" - VPNGatewayStatusFailedConst = "failed" - VPNGatewayStatusPendingConst = "pending" + VPNGatewayLifecycleStateDeletingConst = "deleting" + VPNGatewayLifecycleStateFailedConst = "failed" + VPNGatewayLifecycleStatePendingConst = "pending" + VPNGatewayLifecycleStateStableConst = "stable" + VPNGatewayLifecycleStateSuspendedConst = "suspended" + VPNGatewayLifecycleStateUpdatingConst = "updating" + VPNGatewayLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNGateway.ResourceType property. +// The resource type. +const ( + VPNGatewayResourceTypeVPNGatewayConst = "vpn_gateway" ) // Constants associated with the VPNGateway.Mode property. @@ -69045,6 +71190,14 @@ func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err if err != nil { return } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -69053,6 +71206,14 @@ func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err if err != nil { return } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) if err != nil { return @@ -69069,10 +71230,6 @@ func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { return @@ -69230,6 +71387,27 @@ type VPNGatewayConnection struct { // The status of a VPN gateway connection. Status *string `json:"status" validate:"required"` + // The reasons for the current VPN gateway connection status (if any): + // - `cannot_authenticate_connection`: Failed to authenticate a connection because of + // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) + // - `internal_error`: Internal error (contact IBM support) + // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check + // the IKE policies on both sides of the VPN) + // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and + // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE + // V1 configuration) + // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE + // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) + // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable + // (check the IPsec policies on both sides of the VPN) + // - `peer_not_responding`: No response from peer (check network ACL configuration, peer + // availability, and on-premise firewall configuration) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + // Routing protocols are disabled for this VPN gateway connection. RoutingProtocol *string `json:"routing_protocol,omitempty"` @@ -69342,6 +71520,10 @@ func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interfac if err != nil { return } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) if err != nil { return @@ -69948,6 +72130,27 @@ type VPNGatewayConnectionStaticRouteModeTunnel struct { // The status of the VPN Tunnel. Status *string `json:"status" validate:"required"` + + // The reasons for the current VPN gateway connection tunnels status (if any): + // - `cannot_authenticate_connection`: Failed to authenticate a connection because of + // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) + // - `internal_error`: Internal error (contact IBM support) + // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check + // the IKE policies on both sides of the VPN) + // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and + // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE + // V1 configuration) + // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE + // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) + // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable + // (check the IPsec policies on both sides of the VPN) + // - `peer_not_responding`: No response from peer (check network ACL configuration, peer + // availability, and on-premise firewall configuration) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []VPNGatewayConnectionTunnelStatusReason `json:"status_reasons" validate:"required"` } // Constants associated with the VPNGatewayConnectionStaticRouteModeTunnel.Status property. @@ -69968,12 +72171,209 @@ func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMes if err != nil { return } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionTunnelStatusReason) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStatusReason : VPNGatewayConnectionStatusReason struct +type VPNGatewayConnectionStatusReason struct { + // A snake case string succinctly identifying the status reason. + Code *string `json:"code" validate:"required"` + + // An explanation of the reason for this VPN gateway connection's status. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + VPNGatewayConnectionStatusReasonCodeCannotAuthenticateConnectionConst = "cannot_authenticate_connection" + VPNGatewayConnectionStatusReasonCodeIkePolicyMismatchConst = "ike_policy_mismatch" + VPNGatewayConnectionStatusReasonCodeIkeV1IDLocalRemoteCIDRMismatchConst = "ike_v1_id_local_remote_cidr_mismatch" + VPNGatewayConnectionStatusReasonCodeIkeV2LocalRemoteCIDRMismatchConst = "ike_v2_local_remote_cidr_mismatch" + VPNGatewayConnectionStatusReasonCodeInternalErrorConst = "internal_error" + VPNGatewayConnectionStatusReasonCodeIpsecPolicyMismatchConst = "ipsec_policy_mismatch" + VPNGatewayConnectionStatusReasonCodePeerNotRespondingConst = "peer_not_responding" +) + +// UnmarshalVPNGatewayConnectionStatusReason unmarshals an instance of VPNGatewayConnectionStatusReason from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionTunnelStatusReason : VPNGatewayConnectionTunnelStatusReason struct +type VPNGatewayConnectionTunnelStatusReason struct { + // A snake case string succinctly identifying the status reason. + Code *string `json:"code" validate:"required"` + + // An explanation of the reason for this VPN gateway connection tunnel's status. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionTunnelStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + VPNGatewayConnectionTunnelStatusReasonCodeCannotAuthenticateConnectionConst = "cannot_authenticate_connection" + VPNGatewayConnectionTunnelStatusReasonCodeIkePolicyMismatchConst = "ike_policy_mismatch" + VPNGatewayConnectionTunnelStatusReasonCodeIkeV1IDLocalRemoteCIDRMismatchConst = "ike_v1_id_local_remote_cidr_mismatch" + VPNGatewayConnectionTunnelStatusReasonCodeIkeV2LocalRemoteCIDRMismatchConst = "ike_v2_local_remote_cidr_mismatch" + VPNGatewayConnectionTunnelStatusReasonCodeInternalErrorConst = "internal_error" + VPNGatewayConnectionTunnelStatusReasonCodeIpsecPolicyMismatchConst = "ipsec_policy_mismatch" + VPNGatewayConnectionTunnelStatusReasonCodePeerNotRespondingConst = "peer_not_responding" +) + +// UnmarshalVPNGatewayConnectionTunnelStatusReason unmarshals an instance of VPNGatewayConnectionTunnelStatusReason from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionTunnelStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionTunnelStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayHealthReason : VPNGatewayHealthReason struct +type VPNGatewayHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the VPNGatewayHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + VPNGatewayHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route" + VPNGatewayHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" + VPNGatewayHealthReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalVPNGatewayHealthReason unmarshals an instance of VPNGatewayHealthReason from the specified map of raw messages. +func UnmarshalVPNGatewayHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayLifecycleReason : VPNGatewayLifecycleReason struct +type VPNGatewayLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 VPNGatewayLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + VPNGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalVPNGatewayLifecycleReason unmarshals an instance of VPNGatewayLifecycleReason from the specified map of raw messages. +func UnmarshalVPNGatewayLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } // VPNGatewayMember : VPNGatewayMember struct type VPNGatewayMember struct { + // The reasons for the current VPN gateway member health_state (if any): + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (contact IBM support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPNGatewayMemberHealthReason `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 reasons for the current VPN gateway member lifecycle_state (if any): + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []VPNGatewayMemberLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the VPN gateway member. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + // The reserved IP address assigned to the VPN gateway member. // // This property will be present only when the VPN gateway status is `available`. @@ -69984,11 +72384,35 @@ type VPNGatewayMember struct { // The high availability role assigned to the VPN gateway member. Role *string `json:"role" validate:"required"` - - // The status of the VPN gateway member. - Status *string `json:"status" validate:"required"` } +// Constants associated with the VPNGatewayMember.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 ( + VPNGatewayMemberHealthStateDegradedConst = "degraded" + VPNGatewayMemberHealthStateFaultedConst = "faulted" + VPNGatewayMemberHealthStateInapplicableConst = "inapplicable" + VPNGatewayMemberHealthStateOkConst = "ok" +) + +// Constants associated with the VPNGatewayMember.LifecycleState property. +// The lifecycle state of the VPN gateway member. +const ( + VPNGatewayMemberLifecycleStateDeletingConst = "deleting" + VPNGatewayMemberLifecycleStateFailedConst = "failed" + VPNGatewayMemberLifecycleStatePendingConst = "pending" + VPNGatewayMemberLifecycleStateStableConst = "stable" + VPNGatewayMemberLifecycleStateSuspendedConst = "suspended" + VPNGatewayMemberLifecycleStateUpdatingConst = "updating" + VPNGatewayMemberLifecycleStateWaitingConst = "waiting" +) + // Constants associated with the VPNGatewayMember.Role property. // The high availability role assigned to the VPN gateway member. const ( @@ -69996,18 +72420,25 @@ const ( VPNGatewayMemberRoleStandbyConst = "standby" ) -// Constants associated with the VPNGatewayMember.Status property. -// The status of the VPN gateway member. -const ( - VPNGatewayMemberStatusAvailableConst = "available" - VPNGatewayMemberStatusDeletingConst = "deleting" - VPNGatewayMemberStatusFailedConst = "failed" - VPNGatewayMemberStatusPendingConst = "pending" -) - // UnmarshalVPNGatewayMember unmarshals an instance of VPNGatewayMember from the specified map of raw messages. func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VPNGatewayMember) + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayMemberHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayMemberLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } err = core.UnmarshalModel(m, "private_ip", &obj.PrivateIP, UnmarshalReservedIPReference) if err != nil { return @@ -70020,7 +72451,78 @@ func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayMemberHealthReason : VPNGatewayMemberHealthReason struct +type VPNGatewayMemberHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the VPNGatewayMemberHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + VPNGatewayMemberHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" + VPNGatewayMemberHealthReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalVPNGatewayMemberHealthReason unmarshals an instance of VPNGatewayMemberHealthReason from the specified map of raw messages. +func UnmarshalVPNGatewayMemberHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayMemberHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayMemberLifecycleReason : VPNGatewayMemberLifecycleReason struct +type VPNGatewayMemberLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 VPNGatewayMemberLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + VPNGatewayMemberLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalVPNGatewayMemberLifecycleReason unmarshals an instance of VPNGatewayMemberLifecycleReason from the specified map of raw messages. +func UnmarshalVPNGatewayMemberLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayMemberLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } @@ -70065,7 +72567,7 @@ type VPNGatewayPrototype struct { 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) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // Identifies a subnet by a unique property. @@ -70167,6 +72669,23 @@ type VPNServer struct { // Indicates whether the split tunneling is enabled on this VPN server. EnableSplitTunneling *bool `json:"enable_split_tunneling" validate:"required"` + // The reasons for the current VPN server health_state (if any): + // - `cannot_access_client_certificate`: VPN server's client certificate is inaccessible + // (verify certificate exists and that IAM policies grant `VPN server for VPC` access to + // `Secrets Manager`) + // - `cannot_access_server_certificate`: VPN server's server certificate is inaccessible + // (verify certificate exists and that IAM policies grant `VPN server for VPC` access to + // `Secrets Manager`) + // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (contact IBM support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPNServerHealthReason `json:"health_reasons" validate:"required"` + // The health of this resource. // - `ok`: No abnormal behavior detected // - `degraded`: Experiencing compromised performance, capacity, or connectivity @@ -70185,6 +72704,15 @@ type VPNServer struct { // The unique identifier for this VPN server. ID *string `json:"id" validate:"required"` + // The reasons for the current VPN server lifecycle_state (if any): + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []VPNServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` + // The lifecycle state of the VPN server. LifecycleState *string `json:"lifecycle_state" validate:"required"` @@ -70299,6 +72827,10 @@ func UnmarshalVPNServer(m map[string]json.RawMessage, result interface{}) (err e if err != nil { return } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNServerHealthReason) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) if err != nil { return @@ -70315,6 +72847,10 @@ func UnmarshalVPNServer(m map[string]json.RawMessage, result interface{}) (err e if err != nil { return } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNServerLifecycleReason) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return @@ -70816,6 +73352,84 @@ func UnmarshalVPNServerCollectionNext(m map[string]json.RawMessage, result inter return } +// VPNServerHealthReason : VPNServerHealthReason struct +type VPNServerHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the VPNServerHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + VPNServerHealthReasonCodeCannotAccessClientCertificateConst = "cannot_access_client_certificate" + VPNServerHealthReasonCodeCannotAccessServerCertificateConst = "cannot_access_server_certificate" + VPNServerHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route" + VPNServerHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" + VPNServerHealthReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalVPNServerHealthReason unmarshals an instance of VPNServerHealthReason from the specified map of raw messages. +func UnmarshalVPNServerHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerLifecycleReason : VPNServerLifecycleReason struct +type VPNServerLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 VPNServerLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + VPNServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalVPNServerLifecycleReason unmarshals an instance of VPNServerLifecycleReason from the specified map of raw messages. +func UnmarshalVPNServerLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNServerPatch : VPNServerPatch struct type VPNServerPatch struct { // The certificate instance for this VPN server. @@ -70963,12 +73577,38 @@ type VPNServerRoute struct { // be dropped. Destination *string `json:"destination" validate:"required"` + // The reasons for the current VPN server route health_state (if any): + // - `internal_error`: Internal error (contact IBM support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPNServerRouteHealthReason `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 VPN route. Href *string `json:"href" validate:"required"` // The unique identifier for this VPN route. ID *string `json:"id" validate:"required"` + // The reasons for the current VPN server route lifecycle_state (if any): + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []VPNServerRouteLifecycleReason `json:"lifecycle_reasons" validate:"required"` + // The lifecycle state of the VPN route. LifecycleState *string `json:"lifecycle_state" validate:"required"` @@ -70994,6 +73634,21 @@ const ( VPNServerRouteActionTranslateConst = "translate" ) +// Constants associated with the VPNServerRoute.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 ( + VPNServerRouteHealthStateDegradedConst = "degraded" + VPNServerRouteHealthStateFaultedConst = "faulted" + VPNServerRouteHealthStateInapplicableConst = "inapplicable" + VPNServerRouteHealthStateOkConst = "ok" +) + // Constants associated with the VPNServerRoute.LifecycleState property. // The lifecycle state of the VPN route. const ( @@ -71027,6 +73682,14 @@ func UnmarshalVPNServerRoute(m map[string]json.RawMessage, result interface{}) ( if err != nil { return } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNServerRouteHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -71035,6 +73698,10 @@ func UnmarshalVPNServerRoute(m map[string]json.RawMessage, result interface{}) ( if err != nil { return } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNServerRouteLifecycleReason) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return @@ -71143,6 +73810,80 @@ func UnmarshalVPNServerRouteCollectionNext(m map[string]json.RawMessage, result return } +// VPNServerRouteHealthReason : VPNServerRouteHealthReason struct +type VPNServerRouteHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the VPNServerRouteHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + VPNServerRouteHealthReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalVPNServerRouteHealthReason unmarshals an instance of VPNServerRouteHealthReason from the specified map of raw messages. +func UnmarshalVPNServerRouteHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRouteHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerRouteLifecycleReason : VPNServerRouteLifecycleReason struct +type VPNServerRouteLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 VPNServerRouteLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + VPNServerRouteLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalVPNServerRouteLifecycleReason unmarshals an instance of VPNServerRouteLifecycleReason from the specified map of raw messages. +func UnmarshalVPNServerRouteLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRouteLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNServerRoutePatch : VPNServerRoutePatch struct type VPNServerRoutePatch struct { // The name for this VPN server route. The name must not be used by another route for the VPN server. @@ -71491,10 +74232,6 @@ type VirtualNetworkInterfaceReferenceAttachmentContext struct { // The CRN for this virtual network interface. CRN *string `json:"crn" validate:"required"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VirtualNetworkInterfaceReferenceAttachmentContextDeleted `json:"deleted,omitempty"` - // The URL for this virtual network interface. Href *string `json:"href" validate:"required"` @@ -71521,10 +74258,6 @@ func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]jso if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -71545,24 +74278,6 @@ func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]jso return } -// VirtualNetworkInterfaceReferenceAttachmentContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VirtualNetworkInterfaceReferenceAttachmentContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceAttachmentContextDeleted from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceReferenceAttachmentContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VirtualNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary // information. type VirtualNetworkInterfaceReferenceDeleted struct { @@ -71581,24 +74296,6 @@ func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessa return } -// VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VirtualNetworkInterfaceTarget : A virtual network interface target. // // The resource types that can be virtual network interface targets are expected to expand in the future. When iterating @@ -72998,7 +75695,7 @@ type VolumePrototype struct { Profile VolumeProfileIdentityIntf `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) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -73451,6 +76148,40 @@ 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // Zone : Zone struct type Zone struct { // The URL for this zone. @@ -73645,6 +76376,116 @@ func UnmarshalBackupPolicyJobSourceVolumeReference(m map[string]json.RawMessage, return } +// BackupPolicyScopePrototypeEnterpriseIdentity : Identifies an enterprise by a unique property. +// Models which "extend" this model: +// - BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN +// This model "extends" BackupPolicyScopePrototype +type BackupPolicyScopePrototypeEnterpriseIdentity struct { + // The CRN for this enterprise. + CRN *string `json:"crn,omitempty"` +} + +func (*BackupPolicyScopePrototypeEnterpriseIdentity) isaBackupPolicyScopePrototypeEnterpriseIdentity() bool { + return true +} + +type BackupPolicyScopePrototypeEnterpriseIdentityIntf interface { + BackupPolicyScopePrototypeIntf + isaBackupPolicyScopePrototypeEnterpriseIdentity() bool +} + +func (*BackupPolicyScopePrototypeEnterpriseIdentity) isaBackupPolicyScopePrototype() bool { + return true +} + +// UnmarshalBackupPolicyScopePrototypeEnterpriseIdentity unmarshals an instance of BackupPolicyScopePrototypeEnterpriseIdentity from the specified map of raw messages. +func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopePrototypeEnterpriseIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyScopeAccountReference : BackupPolicyScopeAccountReference struct +// This model "extends" BackupPolicyScope +type BackupPolicyScopeAccountReference 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 BackupPolicyScopeAccountReference.ResourceType property. +// The resource type. +const ( + BackupPolicyScopeAccountReferenceResourceTypeAccountConst = "account" +) + +func (*BackupPolicyScopeAccountReference) isaBackupPolicyScope() bool { + return true +} + +// UnmarshalBackupPolicyScopeAccountReference unmarshals an instance of BackupPolicyScopeAccountReference from the specified map of raw messages. +func UnmarshalBackupPolicyScopeAccountReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopeAccountReference) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyScopeEnterpriseReference : BackupPolicyScopeEnterpriseReference struct +// This model "extends" BackupPolicyScope +type BackupPolicyScopeEnterpriseReference struct { + // The CRN for this enterprise. + CRN *string `json:"crn" validate:"required"` + + // The unique identifier for this enterprise. + ID *string `json:"id" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyScopeEnterpriseReference.ResourceType property. +// The resource type. +const ( + BackupPolicyScopeEnterpriseReferenceResourceTypeEnterpriseConst = "enterprise" +) + +func (*BackupPolicyScopeEnterpriseReference) isaBackupPolicyScope() bool { + return true +} + +// UnmarshalBackupPolicyScopeEnterpriseReference unmarshals an instance of BackupPolicyScopeEnterpriseReference from the specified map of raw messages. +func UnmarshalBackupPolicyScopeEnterpriseReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopeEnterpriseReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerBootTargetBareMetalServerDiskReference : BareMetalServerBootTargetBareMetalServerDiskReference struct // This model "extends" BareMetalServerBootTarget type BareMetalServerBootTargetBareMetalServerDiskReference struct { @@ -73972,14 +76813,14 @@ type BareMetalServerNetworkInterfaceByPci struct { // The bare metal server network interface type. Type *string `json:"type" validate:"required"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` // - `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 VLAN tag. + // - Cannot directly use an IEEE 802.1Q tag. InterfaceType *string `json:"interface_type" validate:"required"` } @@ -74010,7 +76851,7 @@ const ( // 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 VLAN tag. +// - Cannot directly use an IEEE 802.1Q tag. const ( BareMetalServerNetworkInterfaceByPciInterfaceTypePciConst = "pci" ) @@ -74150,19 +76991,26 @@ type BareMetalServerNetworkInterfaceByVlan struct { // The bare metal server network interface type. Type *string `json:"type" validate:"required"` - // Indicates if the interface can float to any other server within the same - // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal - // server in the resource group. Applies only to `vlan` type interfaces. + // 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`. AllowInterfaceToFloat *bool `json:"allow_interface_to_float" validate:"required"` // - `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. + // - 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. InterfaceType *string `json:"interface_type" validate:"required"` - // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. Vlan *int64 `json:"vlan" validate:"required"` } @@ -74191,7 +77039,7 @@ const ( // Constants associated with the BareMetalServerNetworkInterfaceByVlan.InterfaceType property. // - `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. +// - 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. const ( @@ -74416,14 +77264,14 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc // The associated subnet. Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. + // The VLAN IDs to allow for `vlan` interfaces using this PCI interface. AllowedVlans []int64 `json:"allowed_vlans,omitempty"` // - `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 VLAN tag. + // - 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" validate:"required"` } @@ -74433,7 +77281,7 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc // 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 VLAN tag. +// - Cannot directly use an IEEE 802.1Q tag. // - Not supported on bare metal servers with a `cpu.architecture` of `s390x`. const ( BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototypeInterfaceTypePciConst = "pci" @@ -74528,27 +77376,34 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // The associated subnet. Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - // Indicates if the interface can float to any other server within the same - // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal - // server in the resource group. Applies only to `vlan` type interfaces. + // 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`. AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` // - `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. + // - 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"` - // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. Vlan *int64 `json:"vlan" validate:"required"` } // Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype.InterfaceType property. // - `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. +// - 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`. @@ -80584,6 +83439,70 @@ func UnmarshalInstanceProfileMemoryRange(m map[string]json.RawMessage, result in return } +// InstanceProfileNumaCountDependent : The total number of NUMA nodes for an instance with this profile depends on its configuration and the capacity +// constraints within the zone. +// This model "extends" InstanceProfileNumaCount +type InstanceProfileNumaCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileNumaCountDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileNumaCountDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileNumaCountDependent) isaInstanceProfileNumaCount() bool { + return true +} + +// UnmarshalInstanceProfileNumaCountDependent unmarshals an instance of InstanceProfileNumaCountDependent from the specified map of raw messages. +func UnmarshalInstanceProfileNumaCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNumaCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNumaCountFixed : The total number of NUMA nodes for an instance with this profile. +// This model "extends" InstanceProfileNumaCount +type InstanceProfileNumaCountFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileNumaCountFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileNumaCountFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileNumaCountFixed) isaInstanceProfileNumaCount() bool { + return true +} + +// UnmarshalInstanceProfileNumaCountFixed unmarshals an instance of InstanceProfileNumaCountFixed from the specified map of raw messages. +func UnmarshalInstanceProfileNumaCountFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNumaCountFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceProfileNetworkInterfaceCountDependent : The number of network interfaces supported on an instance with this profile is dependent on its configuration. // This model "extends" InstanceProfileNetworkInterfaceCount type InstanceProfileNetworkInterfaceCountDependent struct { @@ -86485,7 +89404,7 @@ type PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct { 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) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` } @@ -87131,10 +90050,6 @@ type ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext str // The CRN for this virtual network interface. CRN *string `json:"crn" validate:"required"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted `json:"deleted,omitempty"` - // The URL for this virtual network interface. Href *string `json:"href" validate:"required"` @@ -87165,10 +90080,6 @@ func UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetCo if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceReservedIPTargetContextDeleted) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -89250,16 +92161,16 @@ type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceProt // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `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) is used. + // The resource group to use for this virtual network interface. If unspecified, the + // share's resource group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,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 and - // `primary_ip.address` is not specified. + // The associated subnet. Required if `primary_ip` does not specify a reserved IP + // identity. Subnet SubnetIdentityIntf `json:"subnet,omitempty"` } @@ -89747,8 +92658,9 @@ type SharePrototypeShareBySize struct { // Tags for this resource. UserTags []string `json:"user_tags,omitempty"` - // The zone this file share will reside in. For a replica share, this must be a different zone in the same region as - // the source share. + // The zone this file share will reside in. + // + // For a replica share, this must be a different zone in the same region as the source share. Zone ZoneIdentityIntf `json:"zone" validate:"required"` // The access control mode for the share: @@ -89772,7 +92684,7 @@ type SharePrototypeShareBySize struct { InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The size of the file share rounded up to the next gigabyte. @@ -89890,8 +92802,9 @@ type SharePrototypeShareBySourceShare struct { // Tags for this resource. UserTags []string `json:"user_tags,omitempty"` - // The zone this file share will reside in. For a replica share, this must be a different zone in the same region as - // the source share. + // The zone this file share will reside in. + // + // For a replica share, this must be a different zone in the same region as the source share. Zone ZoneIdentityIntf `json:"zone" validate:"required"` // The cron specification for the file share replication schedule. @@ -90648,6 +93561,358 @@ func UnmarshalTrustedProfileIdentityTrustedProfileByID(m map[string]json.RawMess return } +// VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype : Manually specify the DNS server addresses for this VPC. +// This model "extends" VpcdnsResolverPrototype +type VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype struct { + // The DNS servers to use for this VPC. All the DNS servers must either: + // + // - have a unique `zone_affinity`, or + // - not have a `zone_affinity`. + ManualServers []DnsServerPrototype `json:"manual_servers" validate:"required"` + + // The type of the DNS resolver to use. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype.Type property. +// The type of the DNS resolver to use. +const ( + VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototypeTypeManualConst = "manual" +) + +// NewVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype : Instantiate VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype (Generic Model Constructor) +func (*VpcV1) NewVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype(manualServers []DnsServerPrototype, typeVar string) (_model *VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype, err error) { + _model = &VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype{ + ManualServers: manualServers, + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype) isaVpcdnsResolverPrototype() bool { + return true +} + +// UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype unmarshals an instance of VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype from the specified map of raw messages. +func UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype) + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype : The system will provide DNS server addresses for this VPC. The system-provided DNS server addresses depend on whether +// any endpoint gateways reside in the VPC, and whether a +// [DNS Services](https://cloud.ibm.com/docs/dns-svcs) instance is configured for the VPC. +// This model "extends" VpcdnsResolverPrototype +type VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype struct { + // The type of the DNS resolver to use. + Type *string `json:"type,omitempty"` +} + +// Constants associated with the VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype.Type property. +// The type of the DNS resolver to use. +const ( + VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototypeTypeSystemConst = "system" +) + +func (*VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype) isaVpcdnsResolverPrototype() bool { + return true +} + +// UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype unmarshals an instance of VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype from the specified map of raw messages. +func UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverTypeDelegated : The DNS server addresses are delegated to the DNS resolver of another VPC. +// This model "extends" VpcdnsResolver +type VpcdnsResolverTypeDelegated struct { + // The DNS servers for this VPC. The servers are populated: + // + // - by the system when `dns.resolver.type` is `system` + // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + Servers []DnsServer `json:"servers" validate:"required"` + + // The type of the DNS resolver used for the VPC. + Type *string `json:"type" validate:"required"` + + // The VPC whose DNS resolver provides the DNS server addresses for this VPC. + // + // The VPC may be remote and therefore may not be directly retrievable. + VPC *VPCReferenceDnsResolverContext `json:"vpc" validate:"required"` +} + +// Constants associated with the VpcdnsResolverTypeDelegated.Type property. +// The type of the DNS resolver used for the VPC. +const ( + VpcdnsResolverTypeDelegatedTypeDelegatedConst = "delegated" +) + +func (*VpcdnsResolverTypeDelegated) isaVpcdnsResolver() bool { + return true +} + +// UnmarshalVpcdnsResolverTypeDelegated unmarshals an instance of VpcdnsResolverTypeDelegated from the specified map of raw messages. +func UnmarshalVpcdnsResolverTypeDelegated(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverTypeDelegated) + err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverTypeManual : The DNS server addresses are manually specified. +// This model "extends" VpcdnsResolver +type VpcdnsResolverTypeManual struct { + // The DNS servers for this VPC. The servers are populated: + // + // - by the system when `dns.resolver.type` is `system` + // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + Servers []DnsServer `json:"servers" validate:"required"` + + // The manually specified DNS servers for this VPC. + ManualServers []DnsServer `json:"manual_servers" validate:"required"` + + // The type of the DNS resolver used for the VPC. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VpcdnsResolverTypeManual.Type property. +// The type of the DNS resolver used for the VPC. +const ( + VpcdnsResolverTypeManualTypeManualConst = "manual" +) + +func (*VpcdnsResolverTypeManual) isaVpcdnsResolver() bool { + return true +} + +// UnmarshalVpcdnsResolverTypeManual unmarshals an instance of VpcdnsResolverTypeManual from the specified map of raw messages. +func UnmarshalVpcdnsResolverTypeManual(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverTypeManual) + err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverTypeSystem : The DNS server addresses are provided by the system and depend on the configuration. +// This model "extends" VpcdnsResolver +type VpcdnsResolverTypeSystem struct { + // The DNS servers for this VPC. The servers are populated: + // + // - by the system when `dns.resolver.type` is `system` + // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + Servers []DnsServer `json:"servers" validate:"required"` + + // The configuration of the system DNS resolver for this VPC. + // + // - `custom_resolver`: A custom DNS resolver is configured for this VPC. + // + // - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when + // the VPC has either or both of the following: + // + // - at least one endpoint gateway residing in it + // - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it + // + // - `default`: The provider default DNS resolvers are configured for this VPC. + // + // This system DNS resolver configuration is used when the VPC has: + // + // - no custom DNS resolver configured for it, and + // - no endpoint gateways residing in it, and + // - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. + Configuration *string `json:"configuration" validate:"required"` + + // The type of the DNS resolver used for the VPC. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VpcdnsResolverTypeSystem.Configuration property. +// The configuration of the system DNS resolver for this VPC. +// +// - `custom_resolver`: A custom DNS resolver is configured for this VPC. +// +// - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when +// the VPC has either or both of the following: +// +// - at least one endpoint gateway residing in it +// +// - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it +// +// - `default`: The provider default DNS resolvers are configured for this VPC. +// +// This system DNS resolver configuration is used when the VPC has: +// +// - no custom DNS resolver configured for it, and +// - no endpoint gateways residing in it, and +// - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. +const ( + VpcdnsResolverTypeSystemConfigurationCustomResolverConst = "custom_resolver" + VpcdnsResolverTypeSystemConfigurationDefaultConst = "default" + VpcdnsResolverTypeSystemConfigurationPrivateResolverConst = "private_resolver" +) + +// Constants associated with the VpcdnsResolverTypeSystem.Type property. +// The type of the DNS resolver used for the VPC. +const ( + VpcdnsResolverTypeSystemTypeSystemConst = "system" +) + +func (*VpcdnsResolverTypeSystem) isaVpcdnsResolver() bool { + return true +} + +// UnmarshalVpcdnsResolverTypeSystem unmarshals an instance of VpcdnsResolverTypeSystem from the specified map of raw messages. +func UnmarshalVpcdnsResolverTypeSystem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverTypeSystem) + err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverVPCPatchVPCIdentityByCRN : VpcdnsResolverVPCPatchVPCIdentityByCRN struct +// This model "extends" VpcdnsResolverVPCPatch +type VpcdnsResolverVPCPatchVPCIdentityByCRN struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` +} + +// NewVpcdnsResolverVPCPatchVPCIdentityByCRN : Instantiate VpcdnsResolverVPCPatchVPCIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByCRN(crn string) (_model *VpcdnsResolverVPCPatchVPCIdentityByCRN, err error) { + _model = &VpcdnsResolverVPCPatchVPCIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VpcdnsResolverVPCPatchVPCIdentityByCRN) isaVpcdnsResolverVPCPatch() bool { + return true +} + +// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByCRN unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByCRN from the specified map of raw messages. +func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverVPCPatchVPCIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverVPCPatchVPCIdentityByHref : VpcdnsResolverVPCPatchVPCIdentityByHref struct +// This model "extends" VpcdnsResolverVPCPatch +type VpcdnsResolverVPCPatchVPCIdentityByHref struct { + // The URL for this VPC. + Href *string `json:"href" validate:"required"` +} + +// NewVpcdnsResolverVPCPatchVPCIdentityByHref : Instantiate VpcdnsResolverVPCPatchVPCIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByHref(href string) (_model *VpcdnsResolverVPCPatchVPCIdentityByHref, err error) { + _model = &VpcdnsResolverVPCPatchVPCIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VpcdnsResolverVPCPatchVPCIdentityByHref) isaVpcdnsResolverVPCPatch() bool { + return true +} + +// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByHref unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByHref from the specified map of raw messages. +func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverVPCPatchVPCIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverVPCPatchVPCIdentityByID : VpcdnsResolverVPCPatchVPCIdentityByID struct +// This model "extends" VpcdnsResolverVPCPatch +type VpcdnsResolverVPCPatchVPCIdentityByID struct { + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` +} + +// NewVpcdnsResolverVPCPatchVPCIdentityByID : Instantiate VpcdnsResolverVPCPatchVPCIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByID(id string) (_model *VpcdnsResolverVPCPatchVPCIdentityByID, err error) { + _model = &VpcdnsResolverVPCPatchVPCIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VpcdnsResolverVPCPatchVPCIdentityByID) isaVpcdnsResolverVPCPatch() bool { + return true +} + +// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByID unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByID from the specified map of raw messages. +func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverVPCPatchVPCIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPCIdentityByCRN : VPCIdentityByCRN struct // This model "extends" VPCIdentity type VPCIdentityByCRN struct { @@ -91119,6 +94384,27 @@ type VPNGatewayConnectionPolicyMode struct { // The status of a VPN gateway connection. Status *string `json:"status" validate:"required"` + // The reasons for the current VPN gateway connection status (if any): + // - `cannot_authenticate_connection`: Failed to authenticate a connection because of + // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) + // - `internal_error`: Internal error (contact IBM support) + // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check + // the IKE policies on both sides of the VPN) + // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and + // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE + // V1 configuration) + // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE + // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) + // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable + // (check the IPsec policies on both sides of the VPN) + // - `peer_not_responding`: No response from peer (check network ACL configuration, peer + // availability, and on-premise firewall configuration) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + // The local CIDRs for this resource. LocalCIDRs []string `json:"local_cidrs" validate:"required"` @@ -91215,6 +94501,10 @@ func UnmarshalVPNGatewayConnectionPolicyMode(m map[string]json.RawMessage, resul if err != nil { return } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) if err != nil { return @@ -91446,6 +94736,27 @@ type VPNGatewayConnectionStaticRouteMode struct { // The status of a VPN gateway connection. Status *string `json:"status" validate:"required"` + // The reasons for the current VPN gateway connection status (if any): + // - `cannot_authenticate_connection`: Failed to authenticate a connection because of + // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) + // - `internal_error`: Internal error (contact IBM support) + // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check + // the IKE policies on both sides of the VPN) + // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and + // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE + // V1 configuration) + // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE + // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) + // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable + // (check the IPsec policies on both sides of the VPN) + // - `peer_not_responding`: No response from peer (check network ACL configuration, peer + // availability, and on-premise firewall configuration) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + // Routing protocols are disabled for this VPN gateway connection. RoutingProtocol *string `json:"routing_protocol" validate:"required"` @@ -91548,6 +94859,10 @@ func UnmarshalVPNGatewayConnectionStaticRouteMode(m map[string]json.RawMessage, if err != nil { return } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) if err != nil { return @@ -91572,12 +94887,44 @@ type VPNGatewayPolicyMode struct { // The VPN gateway's CRN. CRN *string `json:"crn" validate:"required"` + // The reasons for the current VPN gateway health_state (if any): + // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (contact IBM support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPNGatewayHealthReason `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 VPN gateway's canonical URL. Href *string `json:"href" validate:"required"` // The unique identifier for this VPN gateway. ID *string `json:"id" validate:"required"` + // The reasons for the current VPN gateway lifecycle_state (if any): + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the VPN gateway. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + // Collection of VPN gateway members. Members []VPNGatewayMember `json:"members" validate:"required"` @@ -91590,9 +94937,6 @@ type VPNGatewayPolicyMode struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The status of the VPN gateway. - Status *string `json:"status" validate:"required"` - Subnet *SubnetReference `json:"subnet" validate:"required"` // The VPC this VPN gateway resides in. @@ -91602,19 +94946,37 @@ type VPNGatewayPolicyMode struct { Mode *string `json:"mode" validate:"required"` } -// Constants associated with the VPNGatewayPolicyMode.ResourceType property. -// The resource type. +// Constants associated with the VPNGatewayPolicyMode.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 ( - VPNGatewayPolicyModeResourceTypeVPNGatewayConst = "vpn_gateway" + VPNGatewayPolicyModeHealthStateDegradedConst = "degraded" + VPNGatewayPolicyModeHealthStateFaultedConst = "faulted" + VPNGatewayPolicyModeHealthStateInapplicableConst = "inapplicable" + VPNGatewayPolicyModeHealthStateOkConst = "ok" ) -// Constants associated with the VPNGatewayPolicyMode.Status property. -// The status of the VPN gateway. +// Constants associated with the VPNGatewayPolicyMode.LifecycleState property. +// The lifecycle state of the VPN gateway. const ( - VPNGatewayPolicyModeStatusAvailableConst = "available" - VPNGatewayPolicyModeStatusDeletingConst = "deleting" - VPNGatewayPolicyModeStatusFailedConst = "failed" - VPNGatewayPolicyModeStatusPendingConst = "pending" + VPNGatewayPolicyModeLifecycleStateDeletingConst = "deleting" + VPNGatewayPolicyModeLifecycleStateFailedConst = "failed" + VPNGatewayPolicyModeLifecycleStatePendingConst = "pending" + VPNGatewayPolicyModeLifecycleStateStableConst = "stable" + VPNGatewayPolicyModeLifecycleStateSuspendedConst = "suspended" + VPNGatewayPolicyModeLifecycleStateUpdatingConst = "updating" + VPNGatewayPolicyModeLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNGatewayPolicyMode.ResourceType property. +// The resource type. +const ( + VPNGatewayPolicyModeResourceTypeVPNGatewayConst = "vpn_gateway" ) // Constants associated with the VPNGatewayPolicyMode.Mode property. @@ -91642,6 +95004,14 @@ func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interfac if err != nil { return } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -91650,6 +95020,14 @@ func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interfac if err != nil { return } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) if err != nil { return @@ -91666,10 +95044,6 @@ func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interfac if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { return @@ -91812,12 +95186,44 @@ type VPNGatewayRouteMode struct { // The VPN gateway's CRN. CRN *string `json:"crn" validate:"required"` + // The reasons for the current VPN gateway health_state (if any): + // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (contact IBM support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPNGatewayHealthReason `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 VPN gateway's canonical URL. Href *string `json:"href" validate:"required"` // The unique identifier for this VPN gateway. ID *string `json:"id" validate:"required"` + // The reasons for the current VPN gateway lifecycle_state (if any): + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the VPN gateway. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + // Collection of VPN gateway members. Members []VPNGatewayMember `json:"members" validate:"required"` @@ -91830,9 +95236,6 @@ type VPNGatewayRouteMode struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The status of the VPN gateway. - Status *string `json:"status" validate:"required"` - Subnet *SubnetReference `json:"subnet" validate:"required"` // The VPC this VPN gateway resides in. @@ -91842,19 +95245,37 @@ type VPNGatewayRouteMode struct { Mode *string `json:"mode" validate:"required"` } -// Constants associated with the VPNGatewayRouteMode.ResourceType property. -// The resource type. +// Constants associated with the VPNGatewayRouteMode.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 ( - VPNGatewayRouteModeResourceTypeVPNGatewayConst = "vpn_gateway" + VPNGatewayRouteModeHealthStateDegradedConst = "degraded" + VPNGatewayRouteModeHealthStateFaultedConst = "faulted" + VPNGatewayRouteModeHealthStateInapplicableConst = "inapplicable" + VPNGatewayRouteModeHealthStateOkConst = "ok" ) -// Constants associated with the VPNGatewayRouteMode.Status property. -// The status of the VPN gateway. +// Constants associated with the VPNGatewayRouteMode.LifecycleState property. +// The lifecycle state of the VPN gateway. const ( - VPNGatewayRouteModeStatusAvailableConst = "available" - VPNGatewayRouteModeStatusDeletingConst = "deleting" - VPNGatewayRouteModeStatusFailedConst = "failed" - VPNGatewayRouteModeStatusPendingConst = "pending" + VPNGatewayRouteModeLifecycleStateDeletingConst = "deleting" + VPNGatewayRouteModeLifecycleStateFailedConst = "failed" + VPNGatewayRouteModeLifecycleStatePendingConst = "pending" + VPNGatewayRouteModeLifecycleStateStableConst = "stable" + VPNGatewayRouteModeLifecycleStateSuspendedConst = "suspended" + VPNGatewayRouteModeLifecycleStateUpdatingConst = "updating" + VPNGatewayRouteModeLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNGatewayRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayRouteModeResourceTypeVPNGatewayConst = "vpn_gateway" ) // Constants associated with the VPNGatewayRouteMode.Mode property. @@ -91882,6 +95303,14 @@ func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface if err != nil { return } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -91890,6 +95319,14 @@ func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface if err != nil { return } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) if err != nil { return @@ -91906,10 +95343,6 @@ func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { return @@ -92828,6 +96261,41 @@ func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{ return } +// BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN : BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN struct +// This model "extends" BackupPolicyScopePrototypeEnterpriseIdentity +type BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN struct { + // The CRN for this enterprise. + CRN *string `json:"crn" validate:"required"` +} + +// NewBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN : Instantiate BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN(crn string) (_model *BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN, err error) { + _model = &BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) isaBackupPolicyScopePrototypeEnterpriseIdentity() bool { + return true +} + +func (*BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) isaBackupPolicyScopePrototype() bool { + return true +} + +// UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN unmarshals an instance of BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN from the specified map of raw messages. +func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // EndpointGatewayReservedIPReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityByHref struct // This model "extends" EndpointGatewayReservedIPReservedIPIdentity type EndpointGatewayReservedIPReservedIPIdentityByHref struct { @@ -96522,6 +99990,91 @@ func (pager *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err er return pager.GetAllWithContext(context.Background()) } +// VPCDnsResolutionBindingsPager can be used to simplify the use of the "ListVPCDnsResolutionBindings" method. +type VPCDnsResolutionBindingsPager struct { + hasNext bool + options *ListVPCDnsResolutionBindingsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCDnsResolutionBindingsPager returns a new VPCDnsResolutionBindingsPager instance. +func (vpc *VpcV1) NewVPCDnsResolutionBindingsPager(options *ListVPCDnsResolutionBindingsOptions) (pager *VPCDnsResolutionBindingsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCDnsResolutionBindingsOptions = *options + pager = &VPCDnsResolutionBindingsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCDnsResolutionBindingsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Context) (page []VpcdnsResolutionBinding, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCDnsResolutionBindingsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.DnsResolutionBindings + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Context) (allItems []VpcdnsResolutionBinding, err error) { + for pager.HasNext() { + var nextPage []VpcdnsResolutionBinding + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCDnsResolutionBindingsPager) GetNext() (page []VpcdnsResolutionBinding, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCDnsResolutionBindingsPager) GetAll() (allItems []VpcdnsResolutionBinding, err error) { + return pager.GetAllWithContext(context.Background()) +} + // VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. type VPCRoutesPager struct { hasNext bool diff --git a/go.mod b/go.mod index 3520f0f2e6..db94fc947a 100644 --- a/go.mod +++ b/go.mod @@ -230,7 +230,7 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.41.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.43.0 => ./common/github.com/IBM/vpc-go-sdk exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 From 968967195b6af69faa7f20338588f3c86d610fb0 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 23 Nov 2023 11:46:42 +0530 Subject: [PATCH 039/103] sdk update --- .../IBM/vpc-go-sdk/common/headers.go | 6 - .../IBM/vpc-go-sdk/common/headers_test.go | 2 - .../IBM/vpc-go-sdk/common/version.go | 2 +- common/github.com/IBM/vpc-go-sdk/go.mod | 2 +- common/github.com/IBM/vpc-go-sdk/go.sum | 4 +- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 116 ++++++++++++++++-- 6 files changed, 112 insertions(+), 20 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers.go b/common/github.com/IBM/vpc-go-sdk/common/headers.go index 87cc2bfcd9..62651e40c7 100644 --- a/common/github.com/IBM/vpc-go-sdk/common/headers.go +++ b/common/github.com/IBM/vpc-go-sdk/common/headers.go @@ -12,8 +12,6 @@ const ( SDK_NAME = "vpc-go-sdk" - X_CORRELATION_ID = "X-Correlation-Id" - X_REQUEST_ID = "X-Request-Id" ) @@ -42,7 +40,6 @@ func GetSdkHeaders(serviceName string, serviceVersion string, operationId string sdkHeaders := make(map[string]string) sdkHeaders[HEADER_NAME_USER_AGENT] = GetUserAgentInfo() - sdkHeaders[X_CORRELATION_ID] = GetNewXCorrelationID() sdkHeaders[X_REQUEST_ID] = GetNewXRequestID() return sdkHeaders @@ -53,9 +50,6 @@ var UserAgent string = fmt.Sprintf("%s-%s %s", SDK_NAME, Version, GetSystemInfo( func GetUserAgentInfo() string { return UserAgent } -func GetNewXCorrelationID() string { - return uuid.New().String() -} func GetNewXRequestID() string { return uuid.New().String() } diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers_test.go b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go index c8e610ed55..64f0f82272 100644 --- a/common/github.com/IBM/vpc-go-sdk/common/headers_test.go +++ b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go @@ -23,8 +23,6 @@ func TestGetSdkHeaders(t *testing.T) { _, foundIt = headers[HEADER_NAME_USER_AGENT] assert.True(t, foundIt) - _, foundIt = headers[X_CORRELATION_ID] - assert.True(t, foundIt) _, foundIt = headers[X_REQUEST_ID] assert.True(t, foundIt) } diff --git a/common/github.com/IBM/vpc-go-sdk/common/version.go b/common/github.com/IBM/vpc-go-sdk/common/version.go index 623548bdac..3c8b8f1217 100644 --- a/common/github.com/IBM/vpc-go-sdk/common/version.go +++ b/common/github.com/IBM/vpc-go-sdk/common/version.go @@ -1,4 +1,4 @@ package common // Version of the SDK -const Version = "0.6.0" +const Version = "0.44.0" diff --git a/common/github.com/IBM/vpc-go-sdk/go.mod b/common/github.com/IBM/vpc-go-sdk/go.mod index 466fa3d20e..d1b5fdfdca 100644 --- a/common/github.com/IBM/vpc-go-sdk/go.mod +++ b/common/github.com/IBM/vpc-go-sdk/go.mod @@ -3,7 +3,7 @@ module github.com/IBM/vpc-go-sdk go 1.16 require ( - github.com/IBM/go-sdk-core/v5 v5.12.1 + github.com/IBM/go-sdk-core/v5 v5.14.1 github.com/go-openapi/strfmt v0.21.3 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.20.0 diff --git a/common/github.com/IBM/vpc-go-sdk/go.sum b/common/github.com/IBM/vpc-go-sdk/go.sum index 88c822dd8e..13e2cacdc6 100644 --- a/common/github.com/IBM/vpc-go-sdk/go.sum +++ b/common/github.com/IBM/vpc-go-sdk/go.sum @@ -1,5 +1,5 @@ -github.com/IBM/go-sdk-core/v5 v5.9.1 h1:06pXbD9Rgmqqe2HA5YAeQbB4eYRRFgIoOT+Kh3cp1zo= -github.com/IBM/go-sdk-core/v5 v5.9.1/go.mod h1:axE2JrRq79gIJTjKPBwV6gWHswvVptBjbcvvCPIxARM= +github.com/IBM/go-sdk-core/v5 v5.14.1 h1:WR1r0zz+gDW++xzZjF41r9ueY4JyjS2vgZjiYs8lO3c= +github.com/IBM/go-sdk-core/v5 v5.14.1/go.mod h1:MUvIr/1mgGh198ZXL+ByKz9Qs1JoEh80v/96x8jPXNY= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 52d1205c20..5099c5ca04 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -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: 2023-11-15 +// API Version: 2023-11-22 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 `2023-10-10` - // and `2023-11-15`. + // and `2023-11-22`. Version *string } @@ -64,7 +64,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-10-10` - // and `2023-11-15`. + // and `2023-11-22`. Version *string } @@ -1248,13 +1248,14 @@ func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, // DeleteVPCDnsResolutionBinding : Delete a DNS resolution binding // This request deletes a DNS resolution binding. This operation cannot be reversed. // -// A DNS resolution binding for a VPC with `dns.enable_hub` set to `true` cannot be deleted. -func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (response *core.DetailedResponse, err error) { +// For this request to succeed, the VPC specified by the identifier in the URL must not have +// `dns.resolver.type` set to `delegated`. +func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { return vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) } // DeleteVPCDnsResolutionBindingWithContext is an alternate form of the DeleteVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (response *core.DetailedResponse, err error) { +func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions cannot be nil") if err != nil { return @@ -1285,6 +1286,7 @@ func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, 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)) @@ -1294,7 +1296,18 @@ func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + if err != nil { + return + } + response.Result = result + } return } @@ -37015,6 +37028,10 @@ type EndpointGateway struct { // The reserved IPs bound to this endpoint gateway. Ips []ReservedIPReference `json:"ips" validate:"required"` + // The reasons for the current `lifecycle_state` (if any): + // - `dns_resolution_binding_pending`: the DNS resolution binding is being set up. + LifecycleReasons []EndpointGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` + // The lifecycle state of the endpoint gateway. LifecycleState *string `json:"lifecycle_state" validate:"required"` @@ -37108,6 +37125,10 @@ func UnmarshalEndpointGateway(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalEndpointGatewayLifecycleReason) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return @@ -37240,6 +37261,44 @@ func UnmarshalEndpointGatewayCollectionNext(m map[string]json.RawMessage, result return } +// EndpointGatewayLifecycleReason : EndpointGatewayLifecycleReason struct +type EndpointGatewayLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 EndpointGatewayLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + EndpointGatewayLifecycleReasonCodeDnsResolutionBindingPendingConst = "dns_resolution_binding_pending" + EndpointGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalEndpointGatewayLifecycleReason unmarshals an instance of EndpointGatewayLifecycleReason from the specified map of raw messages. +func UnmarshalEndpointGatewayLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // EndpointGatewayPatch : EndpointGatewayPatch struct type EndpointGatewayPatch struct { // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in @@ -70416,6 +70475,14 @@ type VpcdnsResolver struct { VPC *VPCReferenceDnsResolverContext `json:"vpc,omitempty"` // The manually specified DNS servers for this VPC. + // + // If the DNS servers have `zone_affinity`, the DHCP [Domain Name Server + // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list the DNS server with the + // affinity for that zone first, followed by the unique DNS servers from other zones. + // + // If the DNS servers do not have `zone_affinity`, the DHCP [Domain Name Server + // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS + // servers in the order specified. ManualServers []DnsServer `json:"manual_servers,omitempty"` // The configuration of the system DNS resolver for this VPC. @@ -70518,6 +70585,14 @@ type VpcdnsResolverPatch struct { // - have a unique `zone_affinity`, or // - not have a `zone_affinity`. // + // If `zone_affinity` is specified, exactly one DNS server must be specified for each zone in the region. The DHCP + // [Domain Name Server Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list this DNS + // server first, followed by unique DNS servers from other zones if available. + // + // If `zone_affinity` is not specified, the DHCP [Domain Name Server + // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS + // servers in the order specified. + // // `dns.resolver.manual_servers` must be set if and only if `dns.resolver.type` is `manual`. ManualServers []DnsServerPrototype `json:"manual_servers,omitempty"` @@ -70605,6 +70680,14 @@ type VpcdnsResolverPrototype struct { // // - have a unique `zone_affinity`, or // - not have a `zone_affinity`. + // + // If `zone_affinity` is specified, exactly one DNS server must be specified for each zone in the region. The DHCP + // [Domain Name Server Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list this DNS + // server first, followed by unique DNS servers from other zones if available. + // + // If `zone_affinity` is not specified, the DHCP [Domain Name Server + // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS + // servers in the order specified. ManualServers []DnsServerPrototype `json:"manual_servers,omitempty"` } @@ -70706,7 +70789,8 @@ type VPCHealthReason struct { // Constants associated with the VPCHealthReason.Code property. // A snake case string succinctly identifying the reason for this health state. const ( - VPCHealthReasonCodeInternalErrorConst = "internal_error" + VPCHealthReasonCodeDnsResolutionBindingFailedConst = "dns_resolution_binding_failed" + VPCHealthReasonCodeInternalErrorConst = "internal_error" ) // UnmarshalVPCHealthReason unmarshals an instance of VPCHealthReason from the specified map of raw messages. @@ -93568,6 +93652,14 @@ type VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype struct { // // - have a unique `zone_affinity`, or // - not have a `zone_affinity`. + // + // If `zone_affinity` is specified, exactly one DNS server must be specified for each zone in the region. The DHCP + // [Domain Name Server Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list this DNS + // server first, followed by unique DNS servers from other zones if available. + // + // If `zone_affinity` is not specified, the DHCP [Domain Name Server + // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS + // servers in the order specified. ManualServers []DnsServerPrototype `json:"manual_servers" validate:"required"` // The type of the DNS resolver to use. @@ -93698,6 +93790,14 @@ type VpcdnsResolverTypeManual struct { Servers []DnsServer `json:"servers" validate:"required"` // The manually specified DNS servers for this VPC. + // + // If the DNS servers have `zone_affinity`, the DHCP [Domain Name Server + // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list the DNS server with the + // affinity for that zone first, followed by the unique DNS servers from other zones. + // + // If the DNS servers do not have `zone_affinity`, the DHCP [Domain Name Server + // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS + // servers in the order specified. ManualServers []DnsServer `json:"manual_servers" validate:"required"` // The type of the DNS resolver used for the VPC. From 337108864bd7a54c1635a553ca59675efa20438e Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 23 Nov 2023 11:49:44 +0530 Subject: [PATCH 040/103] Update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index ddb9fcf327..d5a6efb3d5 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/IBM/schematics-go-sdk v0.2.2 github.com/IBM/secrets-manager-go-sdk/v2 v2.0.1 github.com/IBM/vpc-beta-go-sdk v0.6.0 - github.com/IBM/vpc-go-sdk v0.43.0 + github.com/IBM/vpc-go-sdk v0.44.0 github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5 github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 github.com/akamai/AkamaiOPEN-edgegrid-golang/v5 v5.0.0 From 88e4781030796cc56b1c79f196898c8aafab1ef7 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 23 Nov 2023 11:49:52 +0530 Subject: [PATCH 041/103] Update resource_ibm_is_vpc_dns_resolution_binding.go --- ...ource_ibm_is_vpc_dns_resolution_binding.go | 49 ++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/ibm/service/vpc/resource_ibm_is_vpc_dns_resolution_binding.go b/ibm/service/vpc/resource_ibm_is_vpc_dns_resolution_binding.go index 3ec4a1ff60..d96a32240d 100644 --- a/ibm/service/vpc/resource_ibm_is_vpc_dns_resolution_binding.go +++ b/ibm/service/vpc/resource_ibm_is_vpc_dns_resolution_binding.go @@ -8,8 +8,10 @@ import ( "fmt" "log" "strings" + "time" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" @@ -24,6 +26,11 @@ func ResourceIBMIsVPCDnsResolutionBinding() *schema.Resource { DeleteContext: resourceIBMIsVPCDnsResolutionBindingDelete, Importer: &schema.ResourceImporter{}, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Delete: schema.DefaultTimeout(10 * time.Minute), + }, + Schema: map[string]*schema.Schema{ "vpc_id": &schema.Schema{ Type: schema.TypeString, @@ -404,13 +411,17 @@ func resourceIBMIsVPCDnsResolutionBindingDelete(context context.Context, d *sche deleteVPCDnsResolutionBindingOptions.SetVPCID(vpcId) deleteVPCDnsResolutionBindingOptions.SetID(id) - response, err := sess.DeleteVPCDnsResolutionBindingWithContext(context, deleteVPCDnsResolutionBindingOptions) + dns, response, err := sess.DeleteVPCDnsResolutionBindingWithContext(context, deleteVPCDnsResolutionBindingOptions) if err != nil { log.Printf("[DEBUG] DeleteVPCDnsResolutionBindingWithContext failed %s\n%s", err, response) if response.StatusCode != 404 { return diag.FromErr(fmt.Errorf("DeleteVPCDnsResolutionBindingWithContext failed %s\n%s", err, response)) } } + _, err = isWaitForVpcDnsDeleted(sess, vpcId, id, d.Timeout(schema.TimeoutDelete), dns) + if err != nil { + return diag.FromErr(err) + } d.SetId("") return nil } @@ -430,3 +441,39 @@ func ParseVPCDNSTerraformID(s string) (string, string, error) { } return segments[0], segments[1], nil } + +func isWaitForVpcDnsDeleted(sess *vpcv1.VpcV1, vpcid, id string, timeout time.Duration, dns *vpcv1.VpcdnsResolutionBinding) (interface{}, error) { + log.Printf("Waiting for vpc dns (%s) to be deleted.", id) + + stateConf := &resource.StateChangeConf{ + Pending: []string{"retry", isVolumeDeleting}, + Target: []string{"done", ""}, + Refresh: isVpcDnsDeleteRefreshFunc(sess, vpcid, id, dns), + Timeout: timeout, + Delay: 10 * time.Second, + MinTimeout: 10 * time.Second, + } + + return stateConf.WaitForState() +} + +func isVpcDnsDeleteRefreshFunc(sess *vpcv1.VpcV1, vpcid, id string, dns *vpcv1.VpcdnsResolutionBinding) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + getVPCDnsResolutionBindingOptions := &vpcv1.GetVPCDnsResolutionBindingOptions{} + + getVPCDnsResolutionBindingOptions.SetVPCID(vpcid) + getVPCDnsResolutionBindingOptions.SetID(id) + + vpcdnsResolutionBinding, response, err := sess.GetVPCDnsResolutionBinding(getVPCDnsResolutionBindingOptions) + if vpcdnsResolutionBinding == nil { + vpcdnsResolutionBinding = dns + } + if err != nil { + if response != nil && response.StatusCode == 404 { + return vpcdnsResolutionBinding, isVolumeDeleted, nil + } + return vpcdnsResolutionBinding, "", fmt.Errorf("[ERROR] Error getting vpcdnsResolutionBinding: %s\n%s", err, response) + } + return vpcdnsResolutionBinding, isVolumeDeleting, err + } +} From 45d2f8cfadf1eb0ec97e05d13cd2b667ed23b3c5 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 6 Dec 2023 10:52:39 +0530 Subject: [PATCH 042/103] Update vpc_v1.go --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 2369 +++++++++++++++-- 1 file changed, 2153 insertions(+), 216 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 5099c5ca04..aeabf1f231 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -31,14 +31,14 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" - common "github.com/IBM/vpc-go-sdk/common" "github.com/go-openapi/strfmt" + common "github.ibm.com/ibmcloud/vpc-go-sdk/common" ) // 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: 2023-11-22 +// API Version: 2023-12-06 type VpcV1 struct { Service *core.BaseService @@ -46,8 +46,8 @@ type VpcV1 struct { // `2`. generation *int64 - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-10-10` - // and `2023-11-22`. + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` + // and `2023-12-06`. Version *string } @@ -63,8 +63,8 @@ type VpcV1Options struct { URL string Authenticator core.Authenticator - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-10-10` - // and `2023-11-22`. + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` + // and `2023-12-06`. Version *string } @@ -122,7 +122,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2023-10-24") + options.Version = core.StringPtr("2023-12-05") } service = &VpcV1{ @@ -6638,8 +6638,13 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C // AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with an instance network interface // This request associates the specified floating IP with the specified instance network interface, replacing any -// existing association. For this request to succeed, the existing floating IP must not be required by another resource, -// such as a public gateway. A request body is not required, and if provided, is ignored. +// existing association. +// +// The existing floating IP must: +// - not be required by another resource, such as a public gateway +// - be in the same `zone` as the instance +// +// A request body is not required, and if provided, is ignored. func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { return vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) } @@ -9909,12 +9914,12 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP // CreateBackupPolicy : Create a backup policy // This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in // the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. -func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { return vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) } // CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") if err != nil { return @@ -9946,26 +9951,7 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createBackupPolicyOptions.MatchUserTags != nil { - body["match_user_tags"] = createBackupPolicyOptions.MatchUserTags - } - if createBackupPolicyOptions.MatchResourceTypes != nil { - body["match_resource_types"] = createBackupPolicyOptions.MatchResourceTypes - } - if createBackupPolicyOptions.Name != nil { - body["name"] = createBackupPolicyOptions.Name - } - if createBackupPolicyOptions.Plans != nil { - body["plans"] = createBackupPolicyOptions.Plans - } - if createBackupPolicyOptions.ResourceGroup != nil { - body["resource_group"] = createBackupPolicyOptions.ResourceGroup - } - if createBackupPolicyOptions.Scope != nil { - body["scope"] = createBackupPolicyOptions.Scope - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(createBackupPolicyOptions.BackupPolicyPrototype) if err != nil { return } @@ -10525,12 +10511,12 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB // // If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, // the backup policy will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { return vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) } // DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") if err != nil { return @@ -10591,12 +10577,12 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku // GetBackupPolicy : Retrieve a backup policy // This request retrieves a single backup policy specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { return vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) } // GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") if err != nil { return @@ -10655,12 +10641,12 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic // UpdateBackupPolicy : Update a backup policy // This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch // object is structured in the same way as a retrieved backup policy and contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { return vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) } // UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result *BackupPolicy, response *core.DetailedResponse, err error) { +func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") if err != nil { return @@ -12145,8 +12131,13 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co // AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface // This request associates the specified floating IP with the specified bare metal server network interface. If // `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` -// is `true`, this replaces any existing association. For this request to succeed, the existing floating IP must not be -// required by another resource, such as a public gateway. A request body is not required, and if provided, is ignored. +// is `true`, this replaces any existing association. +// +// The existing floating IP must: +// - not be required by another resource, such as a public gateway +// - be in the same `zone` as the bare metal server +// +// A request body is not required, and if provided, is ignored. func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { return vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) } @@ -13215,6 +13206,348 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio return } +// ListSnapshotConsistencyGroups : List all snapshot consistency groups +// This request lists all snapshot consistency groups in the region. A snapshot consistency group is a collection of +// individual snapshots taken at the same time. +func (vpc *VpcV1) ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions) +} + +// ListSnapshotConsistencyGroupsWithContext is an alternate form of the ListSnapshotConsistencyGroups method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSnapshotConsistencyGroupsOptions, "listSnapshotConsistencyGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSnapshotConsistencyGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups") + 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 listSnapshotConsistencyGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Start)) + } + if listSnapshotConsistencyGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Limit)) + } + if listSnapshotConsistencyGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.ResourceGroupID)) + } + if listSnapshotConsistencyGroupsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Name)) + } + if listSnapshotConsistencyGroupsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Sort)) + } + if listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroupCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSnapshotConsistencyGroup : Create a snapshot consistency group +// This request creates a new snapshot consistency group from a snapshot consistency group object. The prototype object +// is structured in the same way as a retrieved consistency group, and contains the information necessary to provision +// the new snapshot consistency group. +func (vpc *VpcV1) CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + return vpc.CreateSnapshotConsistencyGroupWithContext(context.Background(), createSnapshotConsistencyGroupOptions) +} + +// CreateSnapshotConsistencyGroupWithContext is an alternate form of the CreateSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createSnapshotConsistencyGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup") + 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(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSnapshotConsistencyGroup : Delete a snapshot consistency group +// This request deletes snapshot consistency group. This operation cannot be reversed. If the +// `delete_snapshots_on_delete` property is `true`, all snapshots in the consistency group will also be deleted. +func (vpc *VpcV1) DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotConsistencyGroupWithContext(context.Background(), deleteSnapshotConsistencyGroupOptions) +} + +// DeleteSnapshotConsistencyGroupWithContext is an alternate form of the DeleteSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSnapshotConsistencyGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSnapshotConsistencyGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotConsistencyGroup") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetSnapshotConsistencyGroup : Retrieve a snapshot consistency group +// This request retrieves a single snapshot consistency group specified by the identifier in the URL. +func (vpc *VpcV1) GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + return vpc.GetSnapshotConsistencyGroupWithContext(context.Background(), getSnapshotConsistencyGroupOptions) +} + +// GetSnapshotConsistencyGroupWithContext is an alternate form of the GetSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSnapshotConsistencyGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSnapshotConsistencyGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateSnapshotConsistencyGroup : Update a snapshot consistency group +// This request updates a snapshot consistency group with the information in a provided snapshot consistency group +// patch. The snapshot consistency group patch object is structured in the same way as a retrieved snapshot consistency +// group and contains only the information to be updated. +func (vpc *VpcV1) UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateSnapshotConsistencyGroupWithContext(context.Background(), updateSnapshotConsistencyGroupOptions) +} + +// UpdateSnapshotConsistencyGroupWithContext is an alternate form of the UpdateSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateSnapshotConsistencyGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateSnapshotConsistencyGroupOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotConsistencyGroupOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + // DeleteSnapshots : Delete a filtered collection of snapshots // This request deletes all snapshots created from a specific source volume. func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { @@ -13357,6 +13690,12 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt if listSnapshotsOptions.ClonesZoneName != nil { builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName)) } + if listSnapshotsOptions.SnapshotConsistencyGroupID != nil { + builder.AddQuery("snapshot_consistency_group.id", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupID)) + } + if listSnapshotsOptions.SnapshotConsistencyGroupCRN != nil { + builder.AddQuery("snapshot_consistency_group.crn", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupCRN)) + } request, err := builder.Build() if err != nil { @@ -24262,6 +24601,9 @@ func (addressPrefixPatch *AddressPrefixPatch) AsPatch() (_patch map[string]inter } // 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"` @@ -24299,13 +24641,13 @@ type BackupPolicy struct { // The lifecycle state of the backup policy. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The resource types this backup policy applies to. Resources that have both a matching type and a matching user tag + // 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 will expand in the future. When processing this property, check for and log + // The enumerated values for this property may expand in the future. When processing this property, check for and log // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the // unexpected property value was encountered. - MatchResourceTypes []string `json:"match_resource_types" validate:"required"` + 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. @@ -24325,6 +24667,15 @@ type BackupPolicy struct { // 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 in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + IncludedContent []string `json:"included_content,omitempty"` } // Constants associated with the BackupPolicy.HealthState property. @@ -24354,10 +24705,16 @@ const ( BackupPolicyLifecycleStateWaitingConst = "waiting" ) -// Constants associated with the BackupPolicy.MatchResourceTypes property. -// The resource type. +// 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 in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected +// property value was encountered. const ( - BackupPolicyMatchResourceTypesVolumeConst = "volume" + BackupPolicyMatchResourceTypeInstanceConst = "instance" + BackupPolicyMatchResourceTypeVolumeConst = "volume" ) // Constants associated with the BackupPolicy.ResourceType property. @@ -24366,6 +24723,21 @@ 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) @@ -24401,7 +24773,7 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } - err = core.UnmarshalPrimitive(m, "match_resource_types", &obj.MatchResourceTypes) + err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) if err != nil { return } @@ -24429,6 +24801,10 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -24436,7 +24812,7 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er // BackupPolicyCollection : BackupPolicyCollection struct type BackupPolicyCollection struct { // Collection of backup policies. - BackupPolicies []BackupPolicy `json:"backup_policies" validate:"required"` + BackupPolicies []BackupPolicyIntf `json:"backup_policies" validate:"required"` // A link to the first page of resources. First *BackupPolicyCollectionFirst `json:"first" validate:"required"` @@ -24807,6 +25183,7 @@ func UnmarshalBackupPolicyJobCollectionNext(m map[string]json.RawMessage, result // [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"` @@ -24931,6 +25308,11 @@ func UnmarshalBackupPolicyJobStatusReason(m map[string]json.RawMessage, result i // 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"` @@ -24939,9 +25321,20 @@ type BackupPolicyPatch struct { 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 { + return + } err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) if err != nil { return @@ -25584,6 +25977,99 @@ func UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype(m map[string]json.RawM 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"` +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScopePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BackupPolicyScope : The scope for this backup policy. // Models which "extend" this model: // - BackupPolicyScopeEnterpriseReference @@ -28631,80 +29117,23 @@ func UnmarshalCloudObjectStorageObjectReference(m map[string]json.RawMessage, re // CreateBackupPolicyOptions : The CreateBackupPolicy options. type CreateBackupPolicyOptions struct { - // 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 resource types 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. - MatchResourceTypes []string `json:"match_resource_types,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. - 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 backup policy prototype object. + BackupPolicyPrototype BackupPolicyPrototypeIntf `json:"BackupPolicyPrototype" validate:"required"` // Allows users to set headers on API requests Headers map[string]string } -// Constants associated with the CreateBackupPolicyOptions.MatchResourceTypes property. -// The resource type. -const ( - CreateBackupPolicyOptionsMatchResourceTypesVolumeConst = "volume" -) - // NewCreateBackupPolicyOptions : Instantiate CreateBackupPolicyOptions -func (*VpcV1) NewCreateBackupPolicyOptions(matchUserTags []string) *CreateBackupPolicyOptions { +func (*VpcV1) NewCreateBackupPolicyOptions(backupPolicyPrototype BackupPolicyPrototypeIntf) *CreateBackupPolicyOptions { return &CreateBackupPolicyOptions{ - MatchUserTags: matchUserTags, + BackupPolicyPrototype: backupPolicyPrototype, } } -// SetMatchUserTags : Allow user to set MatchUserTags -func (_options *CreateBackupPolicyOptions) SetMatchUserTags(matchUserTags []string) *CreateBackupPolicyOptions { - _options.MatchUserTags = matchUserTags - return _options -} - -// SetMatchResourceTypes : Allow user to set MatchResourceTypes -func (_options *CreateBackupPolicyOptions) SetMatchResourceTypes(matchResourceTypes []string) *CreateBackupPolicyOptions { - _options.MatchResourceTypes = matchResourceTypes - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateBackupPolicyOptions) SetName(name string) *CreateBackupPolicyOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetPlans : Allow user to set Plans -func (_options *CreateBackupPolicyOptions) SetPlans(plans []BackupPolicyPlanPrototype) *CreateBackupPolicyOptions { - _options.Plans = plans - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateBackupPolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateBackupPolicyOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetScope : Allow user to set Scope -func (_options *CreateBackupPolicyOptions) SetScope(scope BackupPolicyScopePrototypeIntf) *CreateBackupPolicyOptions { - _options.Scope = scope +// SetBackupPolicyPrototype : Allow user to set BackupPolicyPrototype +func (_options *CreateBackupPolicyOptions) SetBackupPolicyPrototype(backupPolicyPrototype BackupPolicyPrototypeIntf) *CreateBackupPolicyOptions { + _options.BackupPolicyPrototype = backupPolicyPrototype return _options } @@ -31488,6 +31917,34 @@ func (options *CreateSnapshotCloneOptions) SetHeaders(param map[string]string) * return options } +// CreateSnapshotConsistencyGroupOptions : The CreateSnapshotConsistencyGroup options. +type CreateSnapshotConsistencyGroupOptions struct { + // The snapshot consistency group prototype object. + SnapshotConsistencyGroupPrototype SnapshotConsistencyGroupPrototypeIntf `json:"SnapshotConsistencyGroupPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSnapshotConsistencyGroupOptions : Instantiate CreateSnapshotConsistencyGroupOptions +func (*VpcV1) NewCreateSnapshotConsistencyGroupOptions(snapshotConsistencyGroupPrototype SnapshotConsistencyGroupPrototypeIntf) *CreateSnapshotConsistencyGroupOptions { + return &CreateSnapshotConsistencyGroupOptions{ + SnapshotConsistencyGroupPrototype: snapshotConsistencyGroupPrototype, + } +} + +// SetSnapshotConsistencyGroupPrototype : Allow user to set SnapshotConsistencyGroupPrototype +func (_options *CreateSnapshotConsistencyGroupOptions) SetSnapshotConsistencyGroupPrototype(snapshotConsistencyGroupPrototype SnapshotConsistencyGroupPrototypeIntf) *CreateSnapshotConsistencyGroupOptions { + _options.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *CreateSnapshotConsistencyGroupOptions { + options.Headers = param + return options +} + // CreateSnapshotOptions : The CreateSnapshot options. type CreateSnapshotOptions struct { // The snapshot prototype object. @@ -36291,6 +36748,34 @@ func (options *DeleteSnapshotCloneOptions) SetHeaders(param map[string]string) * return options } +// DeleteSnapshotConsistencyGroupOptions : The DeleteSnapshotConsistencyGroup options. +type DeleteSnapshotConsistencyGroupOptions struct { + // The snapshot consistency group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSnapshotConsistencyGroupOptions : Instantiate DeleteSnapshotConsistencyGroupOptions +func (*VpcV1) NewDeleteSnapshotConsistencyGroupOptions(id string) *DeleteSnapshotConsistencyGroupOptions { + return &DeleteSnapshotConsistencyGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteSnapshotConsistencyGroupOptions) SetID(id string) *DeleteSnapshotConsistencyGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *DeleteSnapshotConsistencyGroupOptions { + options.Headers = param + return options +} + // DeleteSnapshotOptions : The DeleteSnapshot options. type DeleteSnapshotOptions struct { // The snapshot identifier. @@ -37872,7 +38357,9 @@ type FloatingIPPatch struct { // resource is: // // - an instance network interface - // - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. + // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` + // + // Specify `null` to remove an existing binding. Target FloatingIPTargetPatchIntf `json:"target,omitempty"` } @@ -38112,7 +38599,9 @@ func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) // The target resource must not already have a floating IP bound to it if the target resource is: // // - an instance network interface -// - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. +// - a bare metal server network interface with `enable_infrastructure_nat` set to `true` +// +// Specify `null` to remove an existing binding. // Models which "extend" this model: // - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity // - FloatingIPTargetPatchNetworkInterfaceIdentity @@ -40668,6 +41157,34 @@ func (options *GetSnapshotCloneOptions) SetHeaders(param map[string]string) *Get return options } +// GetSnapshotConsistencyGroupOptions : The GetSnapshotConsistencyGroup options. +type GetSnapshotConsistencyGroupOptions struct { + // The snapshot consistency group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSnapshotConsistencyGroupOptions : Instantiate GetSnapshotConsistencyGroupOptions +func (*VpcV1) NewGetSnapshotConsistencyGroupOptions(id string) *GetSnapshotConsistencyGroupOptions { + return &GetSnapshotConsistencyGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSnapshotConsistencyGroupOptions) SetID(id string) *GetSnapshotConsistencyGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *GetSnapshotConsistencyGroupOptions { + options.Headers = param + return options +} + // GetSnapshotOptions : The GetSnapshot options. type GetSnapshotOptions struct { // The snapshot identifier. @@ -52191,6 +52708,89 @@ func (options *ListSnapshotClonesOptions) SetHeaders(param map[string]string) *L return options } +// ListSnapshotConsistencyGroupsOptions : The ListSnapshotConsistencyGroups options. +type ListSnapshotConsistencyGroupsOptions 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 backup policy jobs with a `backup_policy_plan.id` property matching the specified + // identifier. + BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListSnapshotConsistencyGroupsOptions.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 ( + ListSnapshotConsistencyGroupsOptionsSortCreatedAtConst = "created_at" + ListSnapshotConsistencyGroupsOptionsSortNameConst = "name" +) + +// NewListSnapshotConsistencyGroupsOptions : Instantiate ListSnapshotConsistencyGroupsOptions +func (*VpcV1) NewListSnapshotConsistencyGroupsOptions() *ListSnapshotConsistencyGroupsOptions { + return &ListSnapshotConsistencyGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListSnapshotConsistencyGroupsOptions) SetStart(start string) *ListSnapshotConsistencyGroupsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSnapshotConsistencyGroupsOptions) SetLimit(limit int64) *ListSnapshotConsistencyGroupsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListSnapshotConsistencyGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListSnapshotConsistencyGroupsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListSnapshotConsistencyGroupsOptions) SetName(name string) *ListSnapshotConsistencyGroupsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListSnapshotConsistencyGroupsOptions) SetSort(sort string) *ListSnapshotConsistencyGroupsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID +func (_options *ListSnapshotConsistencyGroupsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListSnapshotConsistencyGroupsOptions { + _options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSnapshotConsistencyGroupsOptions) SetHeaders(param map[string]string) *ListSnapshotConsistencyGroupsOptions { + options.Headers = param + return options +} + // ListSnapshotsOptions : The ListSnapshots options. type ListSnapshotsOptions struct { // A server-provided token determining what resource to start the page on. @@ -52270,6 +52870,14 @@ type ListSnapshotsOptions struct { // exact specified name. ClonesZoneName *string `json:"clones[].zone.name,omitempty"` + // Filters the collection to resources with a `snapshot_consistency_group.id` property matching the specified + // identifier. + SnapshotConsistencyGroupID *string `json:"snapshot_consistency_group.id,omitempty"` + + // Filters the collection to resources with a `snapshot_consistency_group.crn` property matching the specified + // identifier. + SnapshotConsistencyGroupCRN *string `json:"snapshot_consistency_group.crn,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -52408,6 +53016,18 @@ func (_options *ListSnapshotsOptions) SetClonesZoneName(clonesZoneName string) * return _options } +// SetSnapshotConsistencyGroupID : Allow user to set SnapshotConsistencyGroupID +func (_options *ListSnapshotsOptions) SetSnapshotConsistencyGroupID(snapshotConsistencyGroupID string) *ListSnapshotsOptions { + _options.SnapshotConsistencyGroupID = core.StringPtr(snapshotConsistencyGroupID) + return _options +} + +// SetSnapshotConsistencyGroupCRN : Allow user to set SnapshotConsistencyGroupCRN +func (_options *ListSnapshotsOptions) SetSnapshotConsistencyGroupCRN(snapshotConsistencyGroupCRN string) *ListSnapshotsOptions { + _options.SnapshotConsistencyGroupCRN = core.StringPtr(snapshotConsistencyGroupCRN) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListSnapshotsOptions) SetHeaders(param map[string]string) *ListSnapshotsOptions { options.Headers = param @@ -65895,6 +66515,9 @@ type Snapshot struct { // The size of this snapshot rounded up to the next gigabyte. Size *int64 `json:"size" validate:"required"` + // If present, the snapshot consistency group which created this snapshot. + SnapshotConsistencyGroup *SnapshotConsistencyGroupReference `json:"snapshot_consistency_group,omitempty"` + // If present, the image from which the data on this snapshot was most directly // provisioned. SourceImage *ImageReference `json:"source_image,omitempty"` @@ -66018,6 +66641,10 @@ func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err er if err != nil { return } + err = core.UnmarshalModel(m, "snapshot_consistency_group", &obj.SnapshotConsistencyGroup, UnmarshalSnapshotConsistencyGroupReference) + if err != nil { + return + } err = core.UnmarshalModel(m, "source_image", &obj.SourceImage, UnmarshalImageReference) if err != nil { return @@ -66205,46 +66832,83 @@ func UnmarshalSnapshotCollectionNext(m map[string]json.RawMessage, result interf return } -// SnapshotCopiesItem : SnapshotCopiesItem struct -type SnapshotCopiesItem struct { - // The CRN for the copied snapshot. +// SnapshotConsistencyGroup : SnapshotConsistencyGroup struct +type SnapshotConsistencyGroup struct { + // If present, the backup policy plan which created this snapshot consistency group. + BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan,omitempty"` + + // The date and time that this snapshot consistency group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN of this snapshot consistency group. CRN *string `json:"crn" validate:"required"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + // Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. + DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete" validate:"required"` - // The URL for the copied snapshot. + // The URL for this snapshot consistency group. Href *string `json:"href" validate:"required"` - // The unique identifier for the copied snapshot. + // The unique identifier for this snapshot consistency group. ID *string `json:"id" validate:"required"` - // The name for the copied snapshot. + // The lifecycle state of this snapshot consistency group. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the + // region. 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 *SnapshotRemote `json:"remote,omitempty"` + // The resource group for this snapshot consistency group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` + + // The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot consistency + // group. Each tag is prefixed with + // [is.instance:](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-faqs). + ServiceTags []string `json:"service_tags" validate:"required"` + + // The member snapshots that are data-consistent with respect to captured time. (may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + Snapshots []SnapshotConsistencyGroupSnapshotsItem `json:"snapshots" validate:"required"` } -// Constants associated with the SnapshotCopiesItem.ResourceType property. +// Constants associated with the SnapshotConsistencyGroup.LifecycleState property. +// The lifecycle state of this snapshot consistency group. +const ( + SnapshotConsistencyGroupLifecycleStateDeletingConst = "deleting" + SnapshotConsistencyGroupLifecycleStateFailedConst = "failed" + SnapshotConsistencyGroupLifecycleStatePendingConst = "pending" + SnapshotConsistencyGroupLifecycleStateStableConst = "stable" + SnapshotConsistencyGroupLifecycleStateSuspendedConst = "suspended" + SnapshotConsistencyGroupLifecycleStateUpdatingConst = "updating" + SnapshotConsistencyGroupLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the SnapshotConsistencyGroup.ResourceType property. // The resource type. const ( - SnapshotCopiesItemResourceTypeSnapshotConst = "snapshot" + SnapshotConsistencyGroupResourceTypeSnapshotConsistencyGroupConst = "snapshot_consistency_group" ) -// UnmarshalSnapshotCopiesItem unmarshals an instance of SnapshotCopiesItem from the specified map of raw messages. -func UnmarshalSnapshotCopiesItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotCopiesItem) +// UnmarshalSnapshotConsistencyGroup unmarshals an instance of SnapshotConsistencyGroup from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroup) + err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) if err != nil { return } @@ -66256,11 +66920,15 @@ func UnmarshalSnapshotCopiesItem(m map[string]json.RawMessage, result interface{ if err != nil { return } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } @@ -66268,45 +66936,102 @@ func UnmarshalSnapshotCopiesItem(m map[string]json.RawMessage, result interface{ if err != nil { return } + err = core.UnmarshalPrimitive(m, "service_tags", &obj.ServiceTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotConsistencyGroupSnapshotsItem) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SnapshotIdentity : Identifies a snapshot by a unique property. -// Models which "extend" this model: -// - SnapshotIdentityByID -// - SnapshotIdentityByCRN -// - SnapshotIdentityByHref -type SnapshotIdentity struct { - // The unique identifier for this snapshot. - ID *string `json:"id,omitempty"` +// SnapshotConsistencyGroupCollection : SnapshotConsistencyGroupCollection struct +type SnapshotConsistencyGroupCollection struct { + // A link to the first page of resources. + First *SnapshotConsistencyGroupCollectionFirst `json:"first" validate:"required"` - // The CRN of this snapshot. - CRN *string `json:"crn,omitempty"` + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` - // The URL for this snapshot. - Href *string `json:"href,omitempty"` -} + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *SnapshotConsistencyGroupCollectionNext `json:"next,omitempty"` -func (*SnapshotIdentity) isaSnapshotIdentity() bool { - return true -} + // Collection of snapshot consistency groups. + SnapshotConsistencyGroups []SnapshotConsistencyGroup `json:"snapshot_consistency_groups" validate:"required"` -type SnapshotIdentityIntf interface { - isaSnapshotIdentity() bool + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalSnapshotIdentity unmarshals an instance of SnapshotIdentity from the specified map of raw messages. -func UnmarshalSnapshotIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// 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) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSnapshotConsistencyGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "snapshot_consistency_groups", &obj.SnapshotConsistencyGroups, UnmarshalSnapshotConsistencyGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *SnapshotConsistencyGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { 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 { return @@ -66315,23 +67040,24 @@ func UnmarshalSnapshotIdentity(m map[string]json.RawMessage, result interface{}) return } -// SnapshotPatch : SnapshotPatch struct -type SnapshotPatch struct { - // The name for this snapshot. The name must not be used by another snapshot in the region. - Name *string `json:"name,omitempty"` +// SnapshotConsistencyGroupPatch : SnapshotConsistencyGroupPatch struct +type SnapshotConsistencyGroupPatch struct { + // Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. + DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete,omitempty"` - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. - UserTags []string `json:"user_tags,omitempty"` + // The name for this snapshot consistency group. The name must not be used by another snapshot consistency groups in + // the region. + Name *string `json:"name,omitempty"` } -// UnmarshalSnapshotPatch unmarshals an instance of SnapshotPatch from the specified map of raw messages. -func UnmarshalSnapshotPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +// UnmarshalSnapshotConsistencyGroupPatch unmarshals an instance of SnapshotConsistencyGroupPatch from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroupPatch) + err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) if err != nil { return } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -66339,90 +67065,222 @@ func UnmarshalSnapshotPatch(m map[string]json.RawMessage, result interface{}) (e return } -// AsPatch returns a generic map representation of the SnapshotPatch -func (snapshotPatch *SnapshotPatch) AsPatch() (_patch map[string]interface{}, err error) { +// 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(snapshotPatch) + jsonData, err = json.Marshal(snapshotConsistencyGroupPatch) if err == nil { err = json.Unmarshal(jsonData, &_patch) } return } -// SnapshotPrototype : SnapshotPrototype struct +// SnapshotConsistencyGroupPrototype : SnapshotConsistencyGroupPrototype struct // Models which "extend" this model: -// - SnapshotPrototypeSnapshotBySourceVolume -// - SnapshotPrototypeSnapshotBySourceSnapshot -type SnapshotPrototype struct { - // Clones to create for this snapshot. - Clones []SnapshotClonePrototype `json:"clones,omitempty"` +// - SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots +type SnapshotConsistencyGroupPrototype struct { + // Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. + DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete,omitempty"` - // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name - // will be a hyphenated list of randomly-selected words. + // The name for this snapshot consistency group. The name must be unique across all snapshot consistency groups in the + // region. + // + // 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"` + // The data-consistent member snapshots to create. All snapshots must specify a + // `source_volume` attached to the same virtual server instance. + Snapshots []SnapshotConsistencyGroupPrototypeSnapshotsItem `json:"snapshots,omitempty"` +} + +func (*SnapshotConsistencyGroupPrototype) isaSnapshotConsistencyGroupPrototype() bool { + return true +} + +type SnapshotConsistencyGroupPrototypeIntf interface { + isaSnapshotConsistencyGroupPrototype() bool +} + +// UnmarshalSnapshotConsistencyGroupPrototype unmarshals an instance of SnapshotConsistencyGroupPrototype from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroupPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroupPrototype) + err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotConsistencyGroupPrototypeSnapshotsItem) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem : SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem struct +type SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem struct { + // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The volume to create this snapshot from. + SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. UserTags []string `json:"user_tags,omitempty"` +} + +// NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem : Instantiate SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem (Generic Model Constructor) +func (*VpcV1) NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem(sourceVolume VolumeIdentityIntf) (_model *SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem, err error) { + _model = &SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem{ + SourceVolume: sourceVolume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem unmarshals an instance of SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotConsistencyGroupPrototypeSnapshotsItem : SnapshotConsistencyGroupPrototypeSnapshotsItem struct +type SnapshotConsistencyGroupPrototypeSnapshotsItem struct { + // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` // The volume to create this snapshot from. - SourceVolume VolumeIdentityIntf `json:"source_volume,omitempty"` + SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` - // The root key to use to wrap the data encryption key for this snapshot. - // - // A key must be specified if and only if the source snapshot has an `encryption` type of - // `user_managed`. To maximize snapshot availability and sharing of snapshot data, specify - // a key in the same region as the new snapshot, and use the same encryption key for all - // snapshots using the same source volume. - // - // The specified key may be in a different account, subject to IAM policies. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` +} - // The source snapshot (in another region) to create this snapshot from. - // The specified snapshot must not already be the source of another snapshot in this - // region. - SourceSnapshot *SnapshotIdentityByCRN `json:"source_snapshot,omitempty"` +// NewSnapshotConsistencyGroupPrototypeSnapshotsItem : Instantiate SnapshotConsistencyGroupPrototypeSnapshotsItem (Generic Model Constructor) +func (*VpcV1) NewSnapshotConsistencyGroupPrototypeSnapshotsItem(sourceVolume VolumeIdentityIntf) (_model *SnapshotConsistencyGroupPrototypeSnapshotsItem, err error) { + _model = &SnapshotConsistencyGroupPrototypeSnapshotsItem{ + SourceVolume: sourceVolume, + } + err = core.ValidateStruct(_model, "required parameters") + return } -func (*SnapshotPrototype) isaSnapshotPrototype() bool { - return true +// UnmarshalSnapshotConsistencyGroupPrototypeSnapshotsItem unmarshals an instance of SnapshotConsistencyGroupPrototypeSnapshotsItem from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroupPrototypeSnapshotsItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroupPrototypeSnapshotsItem) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -type SnapshotPrototypeIntf interface { - isaSnapshotPrototype() bool +// SnapshotConsistencyGroupReference : SnapshotConsistencyGroupReference struct +type SnapshotConsistencyGroupReference struct { + // The CRN of this snapshot consistency group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SnapshotConsistencyGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this snapshot consistency group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this snapshot consistency group. + ID *string `json:"id" validate:"required"` + + // The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the + // region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// UnmarshalSnapshotPrototype unmarshals an instance of SnapshotPrototype from the specified map of raw messages. -func UnmarshalSnapshotPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotPrototype) - err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) +// Constants associated with the SnapshotConsistencyGroupReference.ResourceType property. +// The resource type. +const ( + SnapshotConsistencyGroupReferenceResourceTypeSnapshotConsistencyGroupConst = "snapshot_consistency_group" +) + +// UnmarshalSnapshotConsistencyGroupReference unmarshals an instance of SnapshotConsistencyGroupReference from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotConsistencyGroupReferenceDeleted) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotConsistencyGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type SnapshotConsistencyGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalSnapshotConsistencyGroupReferenceDeleted unmarshals an instance of SnapshotConsistencyGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } @@ -66430,8 +67288,300 @@ func UnmarshalSnapshotPrototype(m map[string]json.RawMessage, result interface{} return } -// SnapshotReference : SnapshotReference struct -type SnapshotReference struct { +// SnapshotConsistencyGroupSnapshotsItem : SnapshotConsistencyGroupSnapshotsItem struct +type SnapshotConsistencyGroupSnapshotsItem struct { + // The CRN of this snapshot. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this snapshot. + ID *string `json:"id" validate:"required"` + + // The name for this snapshot. The name is unique across all snapshots in the region. + 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 *SnapshotRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SnapshotConsistencyGroupSnapshotsItem.ResourceType property. +// The resource type. +const ( + SnapshotConsistencyGroupSnapshotsItemResourceTypeSnapshotConst = "snapshot" +) + +// UnmarshalSnapshotConsistencyGroupSnapshotsItem unmarshals an instance of SnapshotConsistencyGroupSnapshotsItem from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroupSnapshotsItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroupSnapshotsItem) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotCopiesItem : SnapshotCopiesItem struct +type SnapshotCopiesItem struct { + // The CRN for the copied snapshot. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + + // The URL for the copied snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for the copied snapshot. + ID *string `json:"id" validate:"required"` + + // The name for the copied snapshot. + 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 *SnapshotRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SnapshotCopiesItem.ResourceType property. +// The resource type. +const ( + SnapshotCopiesItemResourceTypeSnapshotConst = "snapshot" +) + +// UnmarshalSnapshotCopiesItem unmarshals an instance of SnapshotCopiesItem from the specified map of raw messages. +func UnmarshalSnapshotCopiesItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotCopiesItem) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotIdentity : Identifies a snapshot by a unique property. +// Models which "extend" this model: +// - SnapshotIdentityByID +// - SnapshotIdentityByCRN +// - SnapshotIdentityByHref +type SnapshotIdentity struct { + // The unique identifier for this snapshot. + ID *string `json:"id,omitempty"` + + // The CRN of this snapshot. + CRN *string `json:"crn,omitempty"` + + // The URL for this snapshot. + Href *string `json:"href,omitempty"` +} + +func (*SnapshotIdentity) isaSnapshotIdentity() bool { + return true +} + +type SnapshotIdentityIntf interface { + isaSnapshotIdentity() bool +} + +// UnmarshalSnapshotIdentity unmarshals an instance of SnapshotIdentity from the specified map of raw messages. +func UnmarshalSnapshotIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotPatch : SnapshotPatch struct +type SnapshotPatch struct { + // The name for this snapshot. The name must not be used by another snapshot in the region. + Name *string `json:"name,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` +} + +// UnmarshalSnapshotPatch unmarshals an instance of SnapshotPatch from the specified map of raw messages. +func UnmarshalSnapshotPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// SnapshotPrototype : SnapshotPrototype struct +// Models which "extend" this model: +// - SnapshotPrototypeSnapshotBySourceVolume +// - SnapshotPrototypeSnapshotBySourceSnapshot +type SnapshotPrototype struct { + // Clones to create for this snapshot. + Clones []SnapshotClonePrototype `json:"clones,omitempty"` + + // The name for this snapshot. The name must not be used by another snapshot in the region. 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"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` + + // The volume to create this snapshot from. + SourceVolume VolumeIdentityIntf `json:"source_volume,omitempty"` + + // The root key to use to wrap the data encryption key for this snapshot. + // + // A key must be specified if and only if the source snapshot has an `encryption` type of + // `user_managed`. To maximize snapshot availability and sharing of snapshot data, specify + // a key in the same region as the new snapshot, and use the same encryption key for all + // snapshots using the same source volume. + // + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The source snapshot (in another region) to create this snapshot from. + // The specified snapshot must not already be the source of another snapshot in this + // region. + SourceSnapshot *SnapshotIdentityByCRN `json:"source_snapshot,omitempty"` +} + +func (*SnapshotPrototype) isaSnapshotPrototype() bool { + return true +} + +type SnapshotPrototypeIntf interface { + isaSnapshotPrototype() bool +} + +// UnmarshalSnapshotPrototype unmarshals an instance of SnapshotPrototype from the specified map of raw messages. +func UnmarshalSnapshotPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPrototype) + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotReference : SnapshotReference struct +type SnapshotReference struct { // The CRN of this snapshot. CRN *string `json:"crn" validate:"required"` @@ -69165,6 +70315,54 @@ func (options *UpdateShareOptions) SetHeaders(param map[string]string) *UpdateSh return options } +// UpdateSnapshotConsistencyGroupOptions : The UpdateSnapshotConsistencyGroup options. +type UpdateSnapshotConsistencyGroupOptions struct { + // The snapshot consistency group identifier. + ID *string `json:"id" validate:"required,ne="` + + // The snapshot consistency group patch. + SnapshotConsistencyGroupPatch map[string]interface{} `json:"SnapshotConsistencyGroup_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 +} + +// NewUpdateSnapshotConsistencyGroupOptions : Instantiate UpdateSnapshotConsistencyGroupOptions +func (*VpcV1) NewUpdateSnapshotConsistencyGroupOptions(id string, snapshotConsistencyGroupPatch map[string]interface{}) *UpdateSnapshotConsistencyGroupOptions { + return &UpdateSnapshotConsistencyGroupOptions{ + ID: core.StringPtr(id), + SnapshotConsistencyGroupPatch: snapshotConsistencyGroupPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateSnapshotConsistencyGroupOptions) SetID(id string) *UpdateSnapshotConsistencyGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSnapshotConsistencyGroupPatch : Allow user to set SnapshotConsistencyGroupPatch +func (_options *UpdateSnapshotConsistencyGroupOptions) SetSnapshotConsistencyGroupPatch(snapshotConsistencyGroupPatch map[string]interface{}) *UpdateSnapshotConsistencyGroupOptions { + _options.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateSnapshotConsistencyGroupOptions) SetIfMatch(ifMatch string) *UpdateSnapshotConsistencyGroupOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *UpdateSnapshotConsistencyGroupOptions { + options.Headers = param + return options +} + // UpdateSnapshotOptions : The UpdateSnapshot options. type UpdateSnapshotOptions struct { // The snapshot identifier. @@ -72755,11 +73953,11 @@ type VPNServer struct { // The reasons for the current VPN server health_state (if any): // - `cannot_access_client_certificate`: VPN server's client certificate is inaccessible - // (verify certificate exists and that IAM policies grant `VPN server for VPC` access to - // `Secrets Manager`) + // (verify certificate exists and that IAM policies grant `VPN server for VPC` access + // to `Secrets Manager`) // - `cannot_access_server_certificate`: VPN server's server certificate is inaccessible - // (verify certificate exists and that IAM policies grant `VPN server for VPC` access to - // `Secrets Manager`) + // (verify certificate exists and that IAM policies grant `VPN server for VPC` access + // to `Secrets Manager`) // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's // subnet) @@ -76388,6 +77586,57 @@ func UnmarshalZoneReference(m map[string]json.RawMessage, result interface{}) (e return } +// BackupPolicyJobSourceInstanceReference : BackupPolicyJobSourceInstanceReference struct +// This model "extends" BackupPolicyJobSource +type BackupPolicyJobSourceInstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. + Name *string `json:"name" validate:"required"` +} + +func (*BackupPolicyJobSourceInstanceReference) isaBackupPolicyJobSource() bool { + return true +} + +// UnmarshalBackupPolicyJobSourceInstanceReference unmarshals an instance of BackupPolicyJobSourceInstanceReference from the specified map of raw messages. +func UnmarshalBackupPolicyJobSourceInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobSourceInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BackupPolicyJobSourceVolumeReference : BackupPolicyJobSourceVolumeReference struct // This model "extends" BackupPolicyJobSource type BackupPolicyJobSourceVolumeReference struct { @@ -76460,6 +77709,554 @@ func UnmarshalBackupPolicyJobSourceVolumeReference(m map[string]json.RawMessage, return } +// BackupPolicyMatchResourceTypeInstance : BackupPolicyMatchResourceTypeInstance struct +// This model "extends" BackupPolicy +type BackupPolicyMatchResourceTypeInstance 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). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + 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 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"` + + 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 in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + IncludedContent []string `json:"included_content" 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 in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + MatchResourceType *string `json:"match_resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyMatchResourceTypeInstance.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 ( + BackupPolicyMatchResourceTypeInstanceHealthStateDegradedConst = "degraded" + BackupPolicyMatchResourceTypeInstanceHealthStateFaultedConst = "faulted" + BackupPolicyMatchResourceTypeInstanceHealthStateInapplicableConst = "inapplicable" + BackupPolicyMatchResourceTypeInstanceHealthStateOkConst = "ok" +) + +// Constants associated with the BackupPolicyMatchResourceTypeInstance.LifecycleState property. +// The lifecycle state of the backup policy. +const ( + BackupPolicyMatchResourceTypeInstanceLifecycleStateDeletingConst = "deleting" + BackupPolicyMatchResourceTypeInstanceLifecycleStateFailedConst = "failed" + BackupPolicyMatchResourceTypeInstanceLifecycleStatePendingConst = "pending" + BackupPolicyMatchResourceTypeInstanceLifecycleStateStableConst = "stable" + BackupPolicyMatchResourceTypeInstanceLifecycleStateSuspendedConst = "suspended" + BackupPolicyMatchResourceTypeInstanceLifecycleStateUpdatingConst = "updating" + BackupPolicyMatchResourceTypeInstanceLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BackupPolicyMatchResourceTypeInstance.ResourceType property. +// The resource type. +const ( + BackupPolicyMatchResourceTypeInstanceResourceTypeBackupPolicyConst = "backup_policy" +) + +// Constants associated with the BackupPolicyMatchResourceTypeInstance.IncludedContent property. +// An item to include. +const ( + BackupPolicyMatchResourceTypeInstanceIncludedContentBootVolumeConst = "boot_volume" + BackupPolicyMatchResourceTypeInstanceIncludedContentDataVolumesConst = "data_volumes" +) + +// Constants associated with the BackupPolicyMatchResourceTypeInstance.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 in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected +// property value was encountered. +const ( + BackupPolicyMatchResourceTypeInstanceMatchResourceTypeInstanceConst = "instance" +) + +func (*BackupPolicyMatchResourceTypeInstance) isaBackupPolicy() bool { + return true +} + +// UnmarshalBackupPolicyMatchResourceTypeInstance unmarshals an instance of BackupPolicyMatchResourceTypeInstance from the specified map of raw messages. +func UnmarshalBackupPolicyMatchResourceTypeInstance(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyMatchResourceTypeInstance) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalBackupPolicyHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_job_completed_at", &obj.LastJobCompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScope) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyMatchResourceTypeVolume : BackupPolicyMatchResourceTypeVolume struct +// This model "extends" BackupPolicy +type BackupPolicyMatchResourceTypeVolume 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). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + 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 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"` + + Scope BackupPolicyScopeIntf `json:"scope" 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 in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + MatchResourceType *string `json:"match_resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyMatchResourceTypeVolume.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 ( + BackupPolicyMatchResourceTypeVolumeHealthStateDegradedConst = "degraded" + BackupPolicyMatchResourceTypeVolumeHealthStateFaultedConst = "faulted" + BackupPolicyMatchResourceTypeVolumeHealthStateInapplicableConst = "inapplicable" + BackupPolicyMatchResourceTypeVolumeHealthStateOkConst = "ok" +) + +// Constants associated with the BackupPolicyMatchResourceTypeVolume.LifecycleState property. +// The lifecycle state of the backup policy. +const ( + BackupPolicyMatchResourceTypeVolumeLifecycleStateDeletingConst = "deleting" + BackupPolicyMatchResourceTypeVolumeLifecycleStateFailedConst = "failed" + BackupPolicyMatchResourceTypeVolumeLifecycleStatePendingConst = "pending" + BackupPolicyMatchResourceTypeVolumeLifecycleStateStableConst = "stable" + BackupPolicyMatchResourceTypeVolumeLifecycleStateSuspendedConst = "suspended" + BackupPolicyMatchResourceTypeVolumeLifecycleStateUpdatingConst = "updating" + BackupPolicyMatchResourceTypeVolumeLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BackupPolicyMatchResourceTypeVolume.ResourceType property. +// The resource type. +const ( + BackupPolicyMatchResourceTypeVolumeResourceTypeBackupPolicyConst = "backup_policy" +) + +// Constants associated with the BackupPolicyMatchResourceTypeVolume.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 in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected +// property value was encountered. +const ( + BackupPolicyMatchResourceTypeVolumeMatchResourceTypeVolumeConst = "volume" +) + +func (*BackupPolicyMatchResourceTypeVolume) isaBackupPolicy() bool { + return true +} + +// UnmarshalBackupPolicyMatchResourceTypeVolume unmarshals an instance of BackupPolicyMatchResourceTypeVolume from the specified map of raw messages. +func UnmarshalBackupPolicyMatchResourceTypeVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyMatchResourceTypeVolume) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalBackupPolicyHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_job_completed_at", &obj.LastJobCompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScope) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype : BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype struct +// This model "extends" BackupPolicyPrototype +type BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype struct { + // 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"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + 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"` + + // 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"` +} + +// Constants associated with the BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype.IncludedContent property. +// An item to include. +const ( + BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototypeIncludedContentBootVolumeConst = "boot_volume" + BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototypeIncludedContentDataVolumesConst = "data_volumes" +) + +// Constants associated with the BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype.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 ( + BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototypeMatchResourceTypeInstanceConst = "instance" +) + +// NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype : Instantiate BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype(matchUserTags []string, matchResourceType string) (_model *BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype, err error) { + _model = &BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype{ + MatchUserTags: matchUserTags, + MatchResourceType: core.StringPtr(matchResourceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype) isaBackupPolicyPrototype() bool { + return true +} + +// UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype unmarshals an instance of BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype) + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScopePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype : BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype struct +// This model "extends" BackupPolicyPrototype +type BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype struct { + // 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"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Scope BackupPolicyScopePrototypeIntf `json:"scope,omitempty"` + + // 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"` +} + +// Constants associated with the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype.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 ( + BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototypeMatchResourceTypeVolumeConst = "volume" +) + +// NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype : Instantiate BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype(matchUserTags []string, matchResourceType string) (_model *BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype, err error) { + _model = &BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype{ + MatchUserTags: matchUserTags, + MatchResourceType: core.StringPtr(matchResourceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) isaBackupPolicyPrototype() bool { + return true +} + +// UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype unmarshals an instance of BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScopePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BackupPolicyScopePrototypeEnterpriseIdentity : Identifies an enterprise by a unique property. // Models which "extend" this model: // - BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN @@ -92968,6 +94765,61 @@ func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, res return } +// SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots : SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots struct +// This model "extends" SnapshotConsistencyGroupPrototype +type SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots struct { + // Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. + DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete,omitempty"` + + // The name for this snapshot consistency group. The name must be unique across all snapshot consistency groups in the + // region. + // + // If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The data-consistent member snapshots to create. All snapshots must specify a + // `source_volume` attached to the same virtual server instance. + Snapshots []SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem `json:"snapshots" validate:"required"` +} + +// NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots : Instantiate SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots (Generic Model Constructor) +func (*VpcV1) NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots(snapshots []SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) (_model *SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots, err error) { + _model = &SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots{ + Snapshots: snapshots, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) isaSnapshotConsistencyGroupPrototype() bool { + return true +} + +// UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots unmarshals an instance of SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) + err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SnapshotIdentityByCRN : SnapshotIdentityByCRN struct // This model "extends" SnapshotIdentity type SnapshotIdentityByCRN struct { @@ -101737,7 +103589,7 @@ func (pager *BackupPoliciesPager) HasNext() bool { } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicy, err error) { +func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } @@ -101768,9 +103620,9 @@ func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicy, err error) { +func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyIntf, err error) { for pager.HasNext() { - var nextPage []BackupPolicy + var nextPage []BackupPolicyIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { return @@ -101781,12 +103633,12 @@ func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allIte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BackupPoliciesPager) GetNext() (page []BackupPolicy, err error) { +func (pager *BackupPoliciesPager) GetNext() (page []BackupPolicyIntf, err error) { return pager.GetNextWithContext(context.Background()) } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *BackupPoliciesPager) GetAll() (allItems []BackupPolicy, err error) { +func (pager *BackupPoliciesPager) GetAll() (allItems []BackupPolicyIntf, err error) { return pager.GetAllWithContext(context.Background()) } @@ -102385,6 +104237,91 @@ func (pager *VolumesPager) GetAll() (allItems []Volume, err error) { return pager.GetAllWithContext(context.Background()) } +// SnapshotConsistencyGroupsPager can be used to simplify the use of the "ListSnapshotConsistencyGroups" method. +type SnapshotConsistencyGroupsPager struct { + hasNext bool + options *ListSnapshotConsistencyGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSnapshotConsistencyGroupsPager returns a new SnapshotConsistencyGroupsPager instance. +func (vpc *VpcV1) NewSnapshotConsistencyGroupsPager(options *ListSnapshotConsistencyGroupsOptions) (pager *SnapshotConsistencyGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSnapshotConsistencyGroupsOptions = *options + pager = &SnapshotConsistencyGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SnapshotConsistencyGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SnapshotConsistencyGroupsPager) GetNextWithContext(ctx context.Context) (page []SnapshotConsistencyGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSnapshotConsistencyGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.SnapshotConsistencyGroups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SnapshotConsistencyGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SnapshotConsistencyGroup, err error) { + for pager.HasNext() { + var nextPage []SnapshotConsistencyGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SnapshotConsistencyGroupsPager) GetNext() (page []SnapshotConsistencyGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SnapshotConsistencyGroupsPager) GetAll() (allItems []SnapshotConsistencyGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + // SnapshotsPager can be used to simplify the use of the "ListSnapshots" method. type SnapshotsPager struct { hasNext bool From 46deb020b2d92df9ba33246b7f71d21ffdd5683f Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 6 Dec 2023 10:54:27 +0530 Subject: [PATCH 043/103] Update vpc_v1.go --- common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index aeabf1f231..c69c8a4d0b 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -31,8 +31,8 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" + common "github.com/IBM/vpc-go-sdk/common" "github.com/go-openapi/strfmt" - common "github.ibm.com/ibmcloud/vpc-go-sdk/common" ) // VpcV1 : The IBM Cloud Virtual Private Cloud (VPC) API can be used to programmatically provision and manage virtual From 9548a72193617e62da659d4580817935d191d163 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 6 Dec 2023 10:57:08 +0530 Subject: [PATCH 044/103] Update go.sum --- go.sum | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.sum b/go.sum index abd13996b4..0639f80ffc 100644 --- a/go.sum +++ b/go.sum @@ -173,6 +173,8 @@ github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQy github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA= github.com/IBM/vpc-go-sdk v0.43.0 h1:uy/qWIqETCXraUG2cq5sjScr6pZ79ZteY1v5iLUVQ3Q= github.com/IBM/vpc-go-sdk v0.43.0/go.mod h1:kRz9tqPvpHoA/qGrC/qVjTbi4ICuTChpG76L89liGL4= +github.com/IBM/vpc-go-sdk v0.44.0 h1:sDR5+scEEVYVfycVXcjlzCnHF54qnLqKd10ugYaU0kQ= +github.com/IBM/vpc-go-sdk v0.44.0/go.mod h1:4Hs5d/aClmsxAzwDQkwG+ri0vW2ykPJdpM6hDLRwKcA= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= From c7d76f9533df7b5b8c39a6fd4adab2d20783cea4 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 14 Dec 2023 12:25:03 +0530 Subject: [PATCH 045/103] migration --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 107 ++++++++++++++++-- go.mod | 2 +- .../vpc/data_source_ibm_is_backup_policies.go | 20 ++-- .../vpc/data_source_ibm_is_backup_policy.go | 19 ++-- .../vpc/resource_ibm_is_backup_policy.go | 46 ++++---- 5 files changed, 144 insertions(+), 50 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index c69c8a4d0b..b808fdd547 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -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: 2023-12-06 +// API Version: 2023-12-13 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 `2023-12-05` - // and `2023-12-06`. + // and `2023-12-13`. Version *string } @@ -64,7 +64,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2023-12-06`. + // and `2023-12-13`. Version *string } @@ -122,7 +122,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2023-12-05") + options.Version = core.StringPtr("2023-12-12") } service = &VpcV1{ @@ -64562,6 +64562,12 @@ type Share struct { // This property will be absent if no jobs have been created for this file share. LatestJob *ShareJob `json:"latest_job,omitempty"` + // Information about the latest synchronization for this file share. + // + // This property will be present when the `replication_role` is `replica` and at least + // one replication sync has been completed. + LatestSync *ShareLatestSync `json:"latest_sync,omitempty"` + // The lifecycle state of the file share. LifecycleState *string `json:"lifecycle_state" validate:"required"` @@ -64596,6 +64602,8 @@ type Share struct { // // * `active`: This share is actively participating in replication, and the replica's data is up-to-date with the // replication schedule. + // * `degraded`: This is share is participating in replication, but the replica's data has fallen behind the + // replication schedule. // * `failover_pending`: This share is performing a replication failover. // * `initializing`: This share is initializing replication. // * `none`: This share is not participating in replication. @@ -64683,12 +64691,15 @@ const ( // // * `active`: This share is actively participating in replication, and the replica's data is up-to-date with the // replication schedule. +// * `degraded`: This is share is participating in replication, but the replica's data has fallen behind the replication +// schedule. // * `failover_pending`: This share is performing a replication failover. // * `initializing`: This share is initializing replication. // * `none`: This share is not participating in replication. // * `split_pending`: This share is performing a replication split. const ( ShareReplicationStatusActiveConst = "active" + ShareReplicationStatusDegradedConst = "degraded" ShareReplicationStatusFailoverPendingConst = "failover_pending" ShareReplicationStatusInitializingConst = "initializing" ShareReplicationStatusNoneConst = "none" @@ -64740,6 +64751,10 @@ func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error if err != nil { return } + err = core.UnmarshalModel(m, "latest_sync", &obj.LatestSync, UnmarshalShareLatestSync) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return @@ -65091,6 +65106,40 @@ func UnmarshalShareJobStatusReason(m map[string]json.RawMessage, result interfac return } +// ShareLatestSync : Information about the latest synchronization for this file share. +// +// This property will be present when the `replication_role` is `replica` and at least one replication sync has been +// completed. +type ShareLatestSync struct { + // The completed date and time of last synchronization between the replica share and its source. + CompletedAt *strfmt.DateTime `json:"completed_at" validate:"required"` + + // The data transferred (in bytes) in the last synchronization between the replica and its source. + DataTransferred *int64 `json:"data_transferred" validate:"required"` + + // The start date and time of last synchronization between the replica share and its source. + StartedAt *strfmt.DateTime `json:"started_at" validate:"required"` +} + +// UnmarshalShareLatestSync unmarshals an instance of ShareLatestSync from the specified map of raw messages. +func UnmarshalShareLatestSync(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareLatestSync) + err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "data_transferred", &obj.DataTransferred) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ShareMountTarget : ShareMountTarget struct type ShareMountTarget struct { // The access control mode for the share: @@ -66149,7 +66198,9 @@ type SharePrototype struct { ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` // The source file share for this replica file share. The specified file share must not - // already have a replica, and must not be a replica. + // already have a replica, and must not be a replica. If source file share is specified + // by CRN, it may be in an [associated partner + // region](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-replication). SourceShare ShareIdentityIntf `json:"source_share,omitempty"` } @@ -66346,6 +66397,10 @@ type ShareReference struct { // The name for this share. The name is unique across all shares in the region. 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 *ShareRemote `json:"remote,omitempty"` + // The resource type. ResourceType *string `json:"resource_type" validate:"required"` } @@ -66379,6 +66434,10 @@ func UnmarshalShareReference(m map[string]json.RawMessage, result interface{}) ( if err != nil { return } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalShareRemote) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return @@ -66405,6 +66464,25 @@ func UnmarshalShareReferenceDeleted(m map[string]json.RawMessage, result interfa return } +// ShareRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type ShareRemote 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"` +} + +// UnmarshalShareRemote unmarshals an instance of ShareRemote from the specified map of raw messages. +func UnmarshalShareRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareRemote) + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ShareReplicationStatusReason : ShareReplicationStatusReason struct type ShareReplicationStatusReason struct { // A snake case string succinctly identifying the status reason. @@ -94657,8 +94735,8 @@ func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result int return } -// SharePrototypeShareBySourceShare : Create a replica file share for an existing file share. The values for `access_control_mode`, -// `encryption_key`, `initial_owner`, and `size` will be inherited from `source_share`. +// SharePrototypeShareBySourceShare : Create a replica file share for an existing file share. The values for `initial_owner`, +// `access_control_mode`, `encryption_key` and `size` will be inherited from `source_share`. // This model "extends" SharePrototype type SharePrototypeShareBySourceShare struct { // The maximum input/output operations per second (IOPS) for the file share. The share must be in the @@ -94688,6 +94766,13 @@ type SharePrototypeShareBySourceShare struct { // For a replica share, this must be a different zone in the same region as the source share. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + // The root key to use to wrap the data encryption key for the share. + // + // This property must be specified if the `source_share` is in a different region and has + // an `encryption` type of `user_managed`, and must not be specified otherwise (its value + // will be inherited from `source_share`). + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + // The cron specification for the file share replication schedule. // // Replication of a share can be scheduled to occur at most once per hour. @@ -94698,7 +94783,9 @@ type SharePrototypeShareBySourceShare struct { ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The source file share for this replica file share. The specified file share must not - // already have a replica, and must not be a replica. + // already have a replica, and must not be a replica. If source file share is specified + // by CRN, it may be in an [associated partner + // region](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-replication). SourceShare ShareIdentityIntf `json:"source_share" validate:"required"` } @@ -94749,6 +94836,10 @@ func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, res if err != nil { return } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { return diff --git a/go.mod b/go.mod index e4dde3eabf..735de2fa97 100644 --- a/go.mod +++ b/go.mod @@ -231,7 +231,7 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.43.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.44.0 => ./common/github.com/IBM/vpc-go-sdk exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policies.go b/ibm/service/vpc/data_source_ibm_is_backup_policies.go index d9f03c7f53..f39a3c8859 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policies.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policies.go @@ -233,7 +233,7 @@ func dataSourceIBMIsBackupPoliciesRead(context context.Context, d *schema.Resour } start := "" - matchBackupPolicies := []vpcv1.BackupPolicy{} + matchBackupPolicies := []vpcv1.BackupPolicyIntf{} var resourceGroup string if v, ok := d.GetOk("resource_group"); ok { @@ -282,12 +282,12 @@ func dataSourceIBMIsBackupPoliciesRead(context context.Context, d *schema.Resour d.SetId(dataSourceIBMIsBackupPoliciesID(d)) - if matchBackupPolicies != nil { - err = d.Set("backup_policies", dataSourceBackupPolicyCollectionFlattenBackupPolicies(matchBackupPolicies)) - if err != nil { - return diag.FromErr(fmt.Errorf("[ERROR] Error setting backup_policies %s", err)) - } - } + // if matchBackupPolicies != nil { + // err = d.Set("backup_policies", dataSourceBackupPolicyCollectionFlattenBackupPolicies(matchBackupPolicies)) + // if err != nil { + // return diag.FromErr(fmt.Errorf("[ERROR] Error setting backup_policies %s", err)) + // } + // } return nil } @@ -326,9 +326,9 @@ func dataSourceBackupPolicyCollectionBackupPoliciesToMap(backupPoliciesItem vpcv if backupPoliciesItem.LastJobCompletedAt != nil { backupPoliciesMap["last_job_completed_at"] = flex.DateTimeToString(backupPoliciesItem.LastJobCompletedAt) } - if backupPoliciesItem.MatchResourceTypes != nil { - backupPoliciesMap["match_resource_types"] = backupPoliciesItem.MatchResourceTypes - } + // if backupPoliciesItem.MatchResourceTypes != nil { + // backupPoliciesMap["match_resource_types"] = backupPoliciesItem.MatchResourceTypes + // } if backupPoliciesItem.MatchUserTags != nil { backupPoliciesMap["match_user_tags"] = backupPoliciesItem.MatchUserTags } diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policy.go b/ibm/service/vpc/data_source_ibm_is_backup_policy.go index 7baaafa6cb..85cef806be 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policy.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policy.go @@ -223,13 +223,13 @@ func dataSourceIBMIsBackupPolicyRead(context context.Context, d *schema.Resource log.Printf("[DEBUG] GetBackupPolicyWithContext failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("[ERROR] GetBackupPolicyWithContext failed %s\n%s", err, response)) } - backupPolicy = backupPolicyInfo + backupPolicy = backupPolicyInfo.(*vpcv1.BackupPolicy) } else if v, ok := d.GetOk("name"); ok { name := v.(string) start := "" - allrecs := []vpcv1.BackupPolicy{} + allrecs := []vpcv1.BackupPolicyIntf{} for { listBackupPoliciesOptions := &vpcv1.ListBackupPoliciesOptions{} if start != "" { @@ -249,9 +249,10 @@ func dataSourceIBMIsBackupPolicyRead(context context.Context, d *schema.Resource break } } - for _, backupPolicyInfo := range allrecs { + for _, backupPolicyIntf := range allrecs { + backupPolicyInfo := backupPolicyIntf.(*vpcv1.BackupPolicy) if *backupPolicyInfo.Name == name { - backupPolicy = &backupPolicyInfo + backupPolicy = backupPolicyInfo break } } @@ -316,11 +317,11 @@ func dataSourceIBMIsBackupPolicyRead(context context.Context, d *schema.Resource } } - matchResourceType := make([]string, 0) - if backupPolicy.MatchResourceTypes != nil { - for _, matchResourceTyp := range backupPolicy.MatchResourceTypes { - matchResourceType = append(matchResourceType, matchResourceTyp) - } + var matchResourceType string + if backupPolicy.MatchResourceType != nil { + // for _, matchResourceTyp := range backupPolicy.MatchResourceType { + matchResourceType = *backupPolicy.MatchResourceType + // } } d.Set("match_resource_types", matchResourceType) diff --git a/ibm/service/vpc/resource_ibm_is_backup_policy.go b/ibm/service/vpc/resource_ibm_is_backup_policy.go index 2f9f94e9a6..7c1a5b44e8 100644 --- a/ibm/service/vpc/resource_ibm_is_backup_policy.go +++ b/ibm/service/vpc/resource_ibm_is_backup_policy.go @@ -202,28 +202,29 @@ func resourceIBMIsBackupPolicyCreate(context context.Context, d *schema.Resource return diag.FromErr(err) } - createBackupPolicyOptions := &vpcv1.CreateBackupPolicyOptions{} + createBackupPolicyOptions := &vpcv1.BackupPolicyPrototype{} + options := &vpcv1.CreateBackupPolicyOptions{} if matchResourceType, ok := d.GetOk("match_resource_type"); ok { matchResourceTypes := matchResourceType.(string) - matchResourceTypesList := []string{matchResourceTypes} - createBackupPolicyOptions.SetMatchResourceTypes(matchResourceTypesList) - } else if _, ok := d.GetOk("match_resource_types"); ok { + // matchResourceTypesList := []string{matchResourceTypes} + createBackupPolicyOptions.MatchResourceType = &matchResourceTypes + } /*else if _, ok := d.GetOk("match_resource_types"); ok { createBackupPolicyOptions.SetMatchResourceTypes(flex.ExpandStringList((d.Get("match_resource_types").(*schema.Set)).List())) - } + }*/ if _, ok := d.GetOk("match_user_tags"); ok { - createBackupPolicyOptions.SetMatchUserTags((flex.ExpandStringList((d.Get("match_user_tags").(*schema.Set)).List()))) + createBackupPolicyOptions.MatchUserTags = flex.ExpandStringList((d.Get("match_user_tags").(*schema.Set)).List()) } if _, ok := d.GetOk("name"); ok { - createBackupPolicyOptions.SetName(d.Get("name").(string)) + createBackupPolicyOptions.Name = core.StringPtr(d.Get("name").(string)) } if resGroup, ok := d.GetOk("resource_group"); ok { resourceGroupStr := resGroup.(string) resourceGroup := vpcv1.ResourceGroupIdentity{ ID: &resourceGroupStr, } - createBackupPolicyOptions.SetResourceGroup(&resourceGroup) + createBackupPolicyOptions.ResourceGroup = &resourceGroup } if _, ok := d.GetOk("scope"); ok { @@ -234,15 +235,15 @@ func resourceIBMIsBackupPolicyCreate(context context.Context, d *schema.Resource bkpPolicyScopePrototype.CRN = core.StringPtr(crnStr) } } - createBackupPolicyOptions.SetScope(&bkpPolicyScopePrototype) + createBackupPolicyOptions.Scope = &bkpPolicyScopePrototype } - - backupPolicy, response, err := vpcClient.CreateBackupPolicyWithContext(context, createBackupPolicyOptions) + options.BackupPolicyPrototype = createBackupPolicyOptions + backupPolicyIntf, response, err := vpcClient.CreateBackupPolicyWithContext(context, options) if err != nil { log.Printf("[DEBUG] CreateBackupPolicyWithContext failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("[ERROR] CreateBackupPolicyWithContext failed %s\n%s", err, response)) } - + backupPolicy := backupPolicyIntf.(*vpcv1.BackupPolicy) d.SetId(*backupPolicy.ID) return resourceIBMIsBackupPolicyRead(context, d, meta) @@ -258,7 +259,7 @@ func resourceIBMIsBackupPolicyRead(context context.Context, d *schema.ResourceDa getBackupPolicyOptions.SetID(d.Id()) - backupPolicy, response, err := vpcClient.GetBackupPolicyWithContext(context, getBackupPolicyOptions) + backupPolicyIntf, response, err := vpcClient.GetBackupPolicyWithContext(context, getBackupPolicyOptions) if err != nil { if response != nil && response.StatusCode == 404 { d.SetId("") @@ -267,19 +268,20 @@ func resourceIBMIsBackupPolicyRead(context context.Context, d *schema.ResourceDa log.Printf("[DEBUG] GetBackupPolicyWithContext failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("[ERROR] GetBackupPolicyWithContext failed %s\n%s", err, response)) } + backupPolicy := backupPolicyIntf.(*vpcv1.BackupPolicy) - if backupPolicy.MatchResourceTypes != nil { - if err = d.Set("match_resource_types", backupPolicy.MatchResourceTypes); err != nil { + if backupPolicy.MatchResourceType != nil { + if err = d.Set("match_resource_types", backupPolicy.MatchResourceType); err != nil { return diag.FromErr(fmt.Errorf("[ERROR] Error setting match_resource_types: %s", err)) } } - if backupPolicy.MatchResourceTypes != nil { - for _, matchResourceTypes := range backupPolicy.MatchResourceTypes { - if err = d.Set("match_resource_type", matchResourceTypes); err != nil { - return diag.FromErr(fmt.Errorf("[ERROR] Error setting match_resource_type: %s", err)) - } - } - } + // if backupPolicy.MatchResourceType != nil { + // for _, matchResourceTypes := range backupPolicy.MatchResourceType { + // if err = d.Set("match_resource_type", matchResourceTypes); err != nil { + // return diag.FromErr(fmt.Errorf("[ERROR] Error setting match_resource_type: %s", err)) + // } + // } + // } if backupPolicy.MatchUserTags != nil { if err = d.Set("match_user_tags", backupPolicy.MatchUserTags); err != nil { return diag.FromErr(fmt.Errorf("[ERROR] Error setting match_user_tags: %s", err)) From 856079bc0f76ccb54beb62445062a01861fe94cf Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 15 Dec 2023 11:30:25 +0530 Subject: [PATCH 046/103] Update vpc_v1.go --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index b808fdd547..489220cb4e 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2021, 2022, 2023. + * (C) Copyright IBM Corp. 2023. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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: 2023-12-13 +// API Version: today type VpcV1 struct { Service *core.BaseService @@ -47,12 +47,12 @@ type VpcV1 struct { generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2023-12-13`. + // and `2023-12-15`. Version *string } // DefaultServiceURL is the default URL to make service requests to. -const DefaultServiceURL = "https://us-south.iaas.cloud.ibm.com/v1" +const DefaultServiceURL = "https://au-syd.iaas.cloud.ibm.com/v1" // DefaultServiceName is the default key used to find external configuration information. const DefaultServiceName = "vpc" @@ -64,7 +64,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2023-12-13`. + // and `2023-12-15`. Version *string } @@ -21068,9 +21068,6 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB if createLoadBalancerOptions.Subnets != nil { body["subnets"] = createLoadBalancerOptions.Subnets } - if createLoadBalancerOptions.Datapath != nil { - body["datapath"] = createLoadBalancerOptions.Datapath - } if createLoadBalancerOptions.Dns != nil { body["dns"] = createLoadBalancerOptions.Dns } @@ -31131,9 +31128,6 @@ type CreateLoadBalancerOptions struct { // Load balancers in the `network` family allow only one subnet to be specified. Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` - // The datapath logging configuration for this load balancer. - Datapath *LoadBalancerLoggingDatapathPrototype `json:"datapath,omitempty"` - // The DNS configuration for this load balancer. // // If unspecified, DNS `A` records for this load balancer's `hostname` property will be added @@ -31146,7 +31140,7 @@ type CreateLoadBalancerOptions struct { // The logging configuration to use for this load balancer. See [VPC Datapath // Logging](https://cloud.ibm.com/docs/vpc?topic=vpc-datapath-logging) on the logging - // format, fields and permitted values. + // format, fields and permitted values. If unspecified, `datapath.active` will be `false`. // // To activate logging, the load balancer profile must support the specified logging type. Logging *LoadBalancerLoggingPrototype `json:"logging,omitempty"` @@ -31201,12 +31195,6 @@ func (_options *CreateLoadBalancerOptions) SetSubnets(subnets []SubnetIdentityIn return _options } -// SetDatapath : Allow user to set Datapath -func (_options *CreateLoadBalancerOptions) SetDatapath(datapath *LoadBalancerLoggingDatapathPrototype) *CreateLoadBalancerOptions { - _options.Datapath = datapath - return _options -} - // SetDns : Allow user to set Dns func (_options *CreateLoadBalancerOptions) SetDns(dns *LoadBalancerDnsPrototype) *CreateLoadBalancerOptions { _options.Dns = dns @@ -54666,7 +54654,7 @@ type LoadBalancerListener struct { CertificateInstance *CertificateInstanceReference `json:"certificate_instance,omitempty"` // The connection limit of the listener. - ConnectionLimit *int64 `json:"connection_limit,omitempty"` + ConnectionLimit *int64 `json:"connection_limit" validate:"required"` // The date and time that this listener was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -55378,7 +55366,9 @@ type LoadBalancerListenerPolicyReference struct { // The policy's unique identifier. ID *string `json:"id" validate:"required"` - Name interface{} `json:"name" validate:"required"` + // The name for this load balancer listener policy. The name is unique across all policies for the load balancer + // listener. + Name *string `json:"name" validate:"required"` } // UnmarshalLoadBalancerListenerPolicyReference unmarshals an instance of LoadBalancerListenerPolicyReference from the specified map of raw messages. From 6c1a9409a06b4a89998e0e9f0cb35ff6e0b4b977 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 20 Dec 2023 11:03:43 +0530 Subject: [PATCH 047/103] Update vpc_v1.go --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 17345 +++++++++++++--- 1 file changed, 14672 insertions(+), 2673 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 489220cb4e..ad1d930d93 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2023. + * (C) Copyright IBM Corp. 2021, 2022, 2023. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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: today +// API Version: 2023-12-20 type VpcV1 struct { Service *core.BaseService @@ -47,12 +47,12 @@ type VpcV1 struct { generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2023-12-15`. + // and `2023-12-20`. Version *string } // DefaultServiceURL is the default URL to make service requests to. -const DefaultServiceURL = "https://au-syd.iaas.cloud.ibm.com/v1" +const DefaultServiceURL = "https://us-south.iaas.cloud.ibm.com/v1" // DefaultServiceName is the default key used to find external configuration information. const DefaultServiceName = "vpc" @@ -64,7 +64,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2023-12-15`. + // and `2023-12-20`. Version *string } @@ -122,7 +122,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2023-12-12") + options.Version = core.StringPtr("2023-12-19") } service = &VpcV1{ @@ -1583,6 +1583,9 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO if createVPCRouteOptions.Action != nil { body["action"] = createVPCRouteOptions.Action } + if createVPCRouteOptions.Advertise != nil { + body["advertise"] = createVPCRouteOptions.Advertise + } if createVPCRouteOptions.Name != nil { body["name"] = createVPCRouteOptions.Name } @@ -1937,6 +1940,9 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP if createVPCRoutingTableOptions.AcceptRoutesFrom != nil { body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom } + if createVPCRoutingTableOptions.AdvertiseRoutesTo != nil { + body["advertise_routes_to"] = createVPCRoutingTableOptions.AdvertiseRoutesTo + } if createVPCRoutingTableOptions.Name != nil { body["name"] = createVPCRoutingTableOptions.Name } @@ -2304,6 +2310,9 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre if createVPCRoutingTableRouteOptions.Action != nil { body["action"] = createVPCRoutingTableRouteOptions.Action } + if createVPCRoutingTableRouteOptions.Advertise != nil { + body["advertise"] = createVPCRoutingTableRouteOptions.Advertise + } if createVPCRoutingTableRouteOptions.Name != nil { body["name"] = createVPCRoutingTableRouteOptions.Name } @@ -2683,10 +2692,10 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio // DeleteSubnet : Delete a subnet // This request deletes a subnet. This operation cannot be reversed. For this request to succeed, the subnet must not be -// referenced by any bare metal server network interfaces, instance network interfaces, VPN gateways, or load balancers. -// A delete operation automatically detaches the subnet from any network ACLs, public gateways, or endpoint gateways. -// All flow log collectors with `auto_delete` set to `true` targeting the subnet or any resource in the subnet are -// automatically deleted. +// referenced by any bare metal server network interfaces, instance network interfaces, virtual network interfaces, VPN +// gateways, or load balancers. A delete operation automatically detaches the subnet from any network ACLs, public +// gateways, or endpoint gateways. All flow log collectors with `auto_delete` set to `true` targeting the subnet or any +// resource in the subnet are automatically deleted. func (vpc *VpcV1) DeleteSubnet(deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteSubnetWithContext(context.Background(), deleteSubnetOptions) } @@ -3371,6 +3380,18 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn if listSubnetReservedIpsOptions.Sort != nil { builder.AddQuery("sort", fmt.Sprint(*listSubnetReservedIpsOptions.Sort)) } + if listSubnetReservedIpsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listSubnetReservedIpsOptions.TargetID)) + } + if listSubnetReservedIpsOptions.TargetCRN != nil { + builder.AddQuery("target.crn", fmt.Sprint(*listSubnetReservedIpsOptions.TargetCRN)) + } + if listSubnetReservedIpsOptions.TargetName != nil { + builder.AddQuery("target.name", fmt.Sprint(*listSubnetReservedIpsOptions.TargetName)) + } + if listSubnetReservedIpsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listSubnetReservedIpsOptions.TargetResourceType)) + } request, err := builder.Build() if err != nil { @@ -3480,8 +3501,8 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS // This request releases a reserved IP. This operation cannot be reversed. // // For this request to succeed, the reserved IP must not be required by another resource, such as a bare metal server -// network interface or instance network interface for which it is the primary IP. A provider-owned reserved IP is not -// allowed to be deleted. +// network interface, instance network interface or virtual network interface for which it is the primary IP. A +// provider-owned reserved IP is not allowed to be deleted. func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) } @@ -5505,8 +5526,10 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO // DeleteInstance : Delete an instance // This request deletes an instance. This operation cannot be reversed. Any floating IPs associated with instance -// network interfaces are implicitly disassociated. All flow log collectors with `auto_delete` set to `true` targeting -// the instance and/or the instance network interfaces are automatically deleted. +// network interfaces are implicitly disassociated. All virtual network interfaces with `auto_delete` set to `true` +// targeting instance network attachments on the instance are automatically deleted. All flow log collectors with +// `auto_delete` set to `true` targeting the instance, the instance network attachments, the instance network +// interfaces, or the automatically deleted virtual network interfaces are automatically deleted. func (vpc *VpcV1) DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) } @@ -6108,11 +6131,352 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta return } +// ListInstanceNetworkAttachments : List all network attachments on an instance +// This request lists all network attachments on an instance. A network attachment represents a device on the instance +// to which a virtual network interface is attached. +// +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) +} + +// ListInstanceNetworkAttachmentsWithContext is an alternate form of the ListInstanceNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkAttachmentsOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkAttachmentsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachmentCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceNetworkAttachment : Create a network attachment on an instance +// This request creates a new instance network attachment from an instance network attachment prototype object. The +// prototype object is structured in the same way as a retrieved instance network attachment, and contains the +// information necessary to create the new instance network attachment. +func (vpc *VpcV1) CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) +} + +// CreateInstanceNetworkAttachmentWithContext is an alternate form of the CreateInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context, createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceNetworkAttachmentOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkAttachment") + 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 createInstanceNetworkAttachmentOptions.VirtualNetworkInterface != nil { + body["virtual_network_interface"] = createInstanceNetworkAttachmentOptions.VirtualNetworkInterface + } + if createInstanceNetworkAttachmentOptions.Name != nil { + body["name"] = createInstanceNetworkAttachmentOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceNetworkAttachment : Delete an instance network attachment +// This request deletes an instance network attachment. This operation cannot be reversed. Any floating IPs associated +// with the instance network attachment are implicitly disassociated. All flow log collectors with `auto_delete` set to +// `true` targeting the instance network attachment are automatically deleted. The primary instance network attachment +// is not allowed to be deleted. +func (vpc *VpcV1) DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) +} + +// DeleteInstanceNetworkAttachmentWithContext is an alternate form of the DeleteInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context, deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *deleteInstanceNetworkAttachmentOptions.InstanceID, + "id": *deleteInstanceNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceNetworkAttachment : Retrieve an instance network attachment +// This request retrieves a single instance network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) +} + +// GetInstanceNetworkAttachmentWithContext is an alternate form of the GetInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkAttachmentOptions.InstanceID, + "id": *getInstanceNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceNetworkAttachment : Update an instance network attachment +// This request updates an instance network attachment with the information provided in an instance network interface +// patch object. The instance network attachment patch object is structured in the same way as a retrieved instance +// network attachment and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) +} + +// UpdateInstanceNetworkAttachmentWithContext is an alternate form of the UpdateInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context, updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceNetworkAttachmentOptions.InstanceID, + "id": *updateInstanceNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkAttachment") + 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(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + // ListInstanceNetworkInterfaces : List all network interfaces on an instance // This request lists all network interfaces on an instance. An instance network interface is an abstract representation // of a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to // any subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on // the instance may also attach to the same subnet. +// +// If this instance has network attachments, each returned network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface. func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) } @@ -6179,6 +6543,10 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, // prototype object is structured in the same way as a retrieved instance network interface, and contains the // information necessary to create the new instance network interface. Any subnet in the instance's VPC may be // specified. Addresses on the instance network interface must be within the specified subnet's CIDR blocks. +// +// If this instance has network attachments, each network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface, and new network interfaces are not allowed to be created. func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) } @@ -6267,6 +6635,10 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, // with the instance network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to // `true` targeting the instance network interface are automatically deleted. The primary instance network interface is // not allowed to be deleted. +// +// If this instance has network attachments, this network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface, and is not allowed to be deleted. func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) } @@ -6319,6 +6691,10 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, // GetInstanceNetworkInterface : Retrieve an instance network interface // This request retrieves a single instance network interface specified by the identifier in the URL. +// +// If this instance has network attachments, the retrieved network interface is a +// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network +// attachment and its attached virtual network interface. func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) } @@ -6385,6 +6761,10 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge // This request updates an instance network interface with the information provided in an instance network interface // patch object. The instance network interface patch object is structured in the same way as a retrieved instance // network interface and needs to contain only the information to be updated. +// +// If this instance has network attachments, this network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface, and is not allowed to be updated. func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) } @@ -11275,38 +11655,7 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createBareMetalServerOptions.Initialization != nil { - body["initialization"] = createBareMetalServerOptions.Initialization - } - if createBareMetalServerOptions.PrimaryNetworkInterface != nil { - body["primary_network_interface"] = createBareMetalServerOptions.PrimaryNetworkInterface - } - if createBareMetalServerOptions.Profile != nil { - body["profile"] = createBareMetalServerOptions.Profile - } - if createBareMetalServerOptions.Zone != nil { - body["zone"] = createBareMetalServerOptions.Zone - } - if createBareMetalServerOptions.EnableSecureBoot != nil { - body["enable_secure_boot"] = createBareMetalServerOptions.EnableSecureBoot - } - if createBareMetalServerOptions.Name != nil { - body["name"] = createBareMetalServerOptions.Name - } - if createBareMetalServerOptions.NetworkInterfaces != nil { - body["network_interfaces"] = createBareMetalServerOptions.NetworkInterfaces - } - if createBareMetalServerOptions.ResourceGroup != nil { - body["resource_group"] = createBareMetalServerOptions.ResourceGroup - } - if createBareMetalServerOptions.TrustedPlatformModule != nil { - body["trusted_platform_module"] = createBareMetalServerOptions.TrustedPlatformModule - } - if createBareMetalServerOptions.VPC != nil { - body["vpc"] = createBareMetalServerOptions.VPC - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(createBareMetalServerOptions.BareMetalServerPrototype) if err != nil { return } @@ -11610,11 +11959,353 @@ func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, upda return } +// ListBareMetalServerNetworkAttachments : List all network attachments on a bare metal server +// This request lists all network attachments on a bare metal server. A bare metal server network attachment is an +// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network +// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to +// the bare metal server. +// +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) +} + +// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") + 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 listBareMetalServerNetworkAttachmentsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) + } + if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server +// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and +// contains the information necessary to create the new bare metal server network attachment. +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) +} + +// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") + 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(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment +// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network attachment are implicitly disassociated. +// +// The bare metal server's primary network attachment cannot be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) +} + +// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment +// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) +} + +// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment +// This request updates a bare metal server network attachment with the information provided in a bare metal server +// network attachment patch object. The bare metal server network attachment patch object is structured in the same way +// as a retrieved bare metal server network attachment and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) +} + +// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") + 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(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + // ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server // This request lists all network interfaces on a bare metal server. A bare metal server network interface is an // abstract representation of a network device and attaches a bare metal server to a single subnet. Each network // interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to // the bare metal server. +// +// If this bare metal server has network attachments, each returned network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) } @@ -11688,6 +12379,10 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co // contains the information necessary to create the new bare metal server network interface. Any subnet in the bare // metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. // Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. +// +// If this bare metal server has network attachments, each network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface, and new network interfaces are not allowed to be created. func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) } @@ -11759,6 +12454,10 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C // This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs // associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server // network interface is not allowed to be deleted. +// +// If this bare metal server has network attachments, this network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface, and is not allowed to be deleted. func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) } @@ -11811,6 +12510,10 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C // GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface // This request retrieves a single bare metal server network interface specified by the identifier in the URL. +// +// If this bare metal server has network attachments, the retrieved network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface. func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) } @@ -11877,6 +12580,10 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont // This request updates a bare metal server network interface with the information provided in a bare metal server // network interface patch object. The bare metal server network interface patch object is structured in the same way as // a retrieved bare metal server network interface and needs to contain only the information to be updated. +// +// If this bare metal server has network attachments, this network interface is a [read-only +// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and +// its attached virtual network interface, and is not allowed to be updated. func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) } @@ -15556,6 +16263,154 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l return } +// CreateVirtualNetworkInterface : Create a virtual network interface +// This request creates a new virtual network interface from a virtual network interface prototype object. The prototype +// object is structured in the same way as a retrieved virtual network interface, and contains the information necessary +// to create the new virtual network interface. +func (vpc *VpcV1) CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + return vpc.CreateVirtualNetworkInterfaceWithContext(context.Background(), createVirtualNetworkInterfaceOptions) +} + +// CreateVirtualNetworkInterfaceWithContext is an alternate form of the CreateVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVirtualNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVirtualNetworkInterface") + 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 createVirtualNetworkInterfaceOptions.AllowIPSpoofing != nil { + body["allow_ip_spoofing"] = createVirtualNetworkInterfaceOptions.AllowIPSpoofing + } + if createVirtualNetworkInterfaceOptions.AutoDelete != nil { + body["auto_delete"] = createVirtualNetworkInterfaceOptions.AutoDelete + } + if createVirtualNetworkInterfaceOptions.EnableInfrastructureNat != nil { + body["enable_infrastructure_nat"] = createVirtualNetworkInterfaceOptions.EnableInfrastructureNat + } + if createVirtualNetworkInterfaceOptions.Ips != nil { + body["ips"] = createVirtualNetworkInterfaceOptions.Ips + } + if createVirtualNetworkInterfaceOptions.Name != nil { + body["name"] = createVirtualNetworkInterfaceOptions.Name + } + if createVirtualNetworkInterfaceOptions.PrimaryIP != nil { + body["primary_ip"] = createVirtualNetworkInterfaceOptions.PrimaryIP + } + if createVirtualNetworkInterfaceOptions.ResourceGroup != nil { + body["resource_group"] = createVirtualNetworkInterfaceOptions.ResourceGroup + } + if createVirtualNetworkInterfaceOptions.SecurityGroups != nil { + body["security_groups"] = createVirtualNetworkInterfaceOptions.SecurityGroups + } + if createVirtualNetworkInterfaceOptions.Subnet != nil { + body["subnet"] = createVirtualNetworkInterfaceOptions.Subnet + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVirtualNetworkInterfaces : Delete a virtual network interface +// This request deletes a virtual network interface. This operation cannot be reversed. For this request to succeed, the +// virtual network interface must not be required by another resource, such as the primary network attachment for an +// instance. +func (vpc *VpcV1) DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) +} + +// DeleteVirtualNetworkInterfacesWithContext is an alternate form of the DeleteVirtualNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVirtualNetworkInterfacesOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVirtualNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVirtualNetworkInterfaces") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + // GetVirtualNetworkInterface : Retrieve a virtual network interface // This request retrieves a single virtual network interface specified by the identifier in the URL. func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { @@ -15690,6 +16545,533 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, return } +// ListNetworkInterfaceFloatingIps : List all floating IPs associated with a virtual network interface +// This request lists all floating IPs associated with a virtual network interface. +func (vpc *VpcV1) ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) +} + +// ListNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *listNetworkInterfaceFloatingIpsOptions.VirtualNetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listNetworkInterfaceFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkInterfaceFloatingIps") + 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 listNetworkInterfaceFloatingIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start)) + } + if listNetworkInterfaceFloatingIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Limit)) + } + if listNetworkInterfaceFloatingIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface +// This request disassociates the specified floating IP from the specified virtual network interface. +func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) +} + +// RemoveNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *removeNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *removeNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP if it is associated with the virtual network interface specified in +// the URL. +func (vpc *VpcV1) GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + return vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) +} + +// GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *getNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *getNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddNetworkInterfaceFloatingIP : Add an association between a floating IP and a virtual network interface +// This request adds an association between the specified floating IP and the specified virtual network interface. +// +// If the virtual network interface has `enable_infrastructure_nat` set to `true`, no more than one floating IP can be +// associated, and network address translation is performed between the floating IP address and the virtual network +// interface's `primary_ip` address. +// +// If the virtual network interface has `enable_infrastructure_nat` set to `false`, packets are passed unchanged to/from +// the virtual network interface. +// +// The floating IP must: +// - be in the same `zone` as the virtual network interface +// - not currently be associated with another resource +// +// The virtual network interface's `target` must not currently be a file share mount target. +// +// A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + return vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) +} + +// AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *addNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *addNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVirtualNetworkInterfaceIps : List all reserved IPs bound to a virtual network interface +// This request lists all reserved IPs bound to a virtual network interface. +func (vpc *VpcV1) ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) +} + +// ListVirtualNetworkInterfaceIpsWithContext is an alternate form of the ListVirtualNetworkInterfaceIps method which supports a Context parameter +func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *listVirtualNetworkInterfaceIpsOptions.VirtualNetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVirtualNetworkInterfaceIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaceIps") + 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 listVirtualNetworkInterfaceIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Start)) + } + if listVirtualNetworkInterfaceIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Limit)) + } + if listVirtualNetworkInterfaceIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveVirtualNetworkInterfaceIP : Unbind a reserved IP from a virtual network interface +// This request unbinds the specified reserved IP from the specified virtual network interface. If the reserved IP has +// `auto_delete` set to `true`, the reserved IP will be deleted. +// +// The reserved IP for the `primary_ip` cannot be unbound. +func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveVirtualNetworkInterfaceIPWithContext(context.Background(), removeVirtualNetworkInterfaceIPOptions) +} + +// RemoveVirtualNetworkInterfaceIPWithContext is an alternate form of the RemoveVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context, removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *removeVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *removeVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeVirtualNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVirtualNetworkInterfaceIP") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVirtualNetworkInterfaceIP : Retrieve bound reserved IP +// This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in +// the URL. +func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + return vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) +} + +// GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *getVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *getVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddVirtualNetworkInterfaceIP : Bind a reserved IP to a virtual network interface +// This request binds the specified reserved IP to the specified virtual network interface. +// +// The reserved IP must currently be unbound and in the primary IP's subnet. The virtual network interface's `target` +// must not currently be a file share mount target. +func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + return vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) +} + +// AddVirtualNetworkInterfaceIPWithContext is an alternate form of the AddVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *addVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *addVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addVirtualNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + // ListPublicGateways : List all public gateways // This request lists all 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 @@ -16073,6 +17455,18 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp 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 { @@ -21123,7 +22517,7 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB // 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`. +// `provisioning_status` is `delete_pending` or it is referenced by a resource. func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) } @@ -23518,7 +24912,7 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi // 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 +// - 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) { return vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) @@ -23770,7 +25164,7 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn // ListFlowLogCollectors : List all flow log collectors // This request lists all flow log collectors in the region. A flow log collector summarizes data sent over the instance -// network interfaces contained within its target. +// network interfaces and instance network attachments contained within its target. func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) } @@ -24285,6 +25679,82 @@ func (options *AddInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param ma 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 +} + // AddVPNGatewayConnectionLocalCIDROptions : The AddVPNGatewayConnectionLocalCIDR options. type AddVPNGatewayConnectionLocalCIDROptions struct { // The VPN gateway identifier. @@ -26146,7 +27616,8 @@ func UnmarshalBackupPolicyScopePrototype(m map[string]json.RawMessage, result in // BareMetalServer : BareMetalServer struct type BareMetalServer struct { - // The total bandwidth (in megabits per second) shared across the bare metal server network interfaces. + // 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 possible resource types for this property are expected to expand in the future. @@ -26191,10 +27662,25 @@ type BareMetalServer struct { // 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. + // + // If this bare metal server has network attachments, each network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment and its attached virtual network interface. NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces" validate:"required"` + // The primary network attachment for this bare metal server. + PrimaryNetworkAttachment *BareMetalServerNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` + // 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=vni-old-api-clients) + // of the primary network attachment and its attached virtual network interface. PrimaryNetworkInterface *NetworkInterfaceBareMetalServerContextReference `json:"primary_network_interface" validate:"required"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) @@ -26313,10 +27799,18 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentReference) + if err != nil { + return + } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) if err != nil { return } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerNetworkAttachmentReference) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceBareMetalServerContextReference) if err != nil { return @@ -26930,205 +28424,224 @@ func UnmarshalBareMetalServerLifecycleReason(m map[string]json.RawMessage, resul return } -// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct +// BareMetalServerNetworkAttachment : BareMetalServerNetworkAttachment 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. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - - // The date and time that the bare metal server network interface was created. +// - 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"` - // 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`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The floating IPs associated with this bare metal server network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this bare metal server network interface. + // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this bare metal server network interface. + // The unique identifier for this bare metal server 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 + // 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 interface + // 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. - // - Has its own security groups and does not inherit those of the PCI device through - // which traffic flows. // // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. 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 an empty string. - MacAddress *string `json:"mac_address" validate:"required"` + // The lifecycle state of the bare metal server network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The name for this bare metal server network interface. + // 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 bare metal server network interface port speed in Mbps. + // The port speed for this bare metal server network attachment in Mbps. PortSpeed *int64 `json:"port_speed" 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 resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this bare metal server network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the bare metal server network interface. - Status *string `json:"status" validate:"required"` - - // The associated subnet. + // The subnet of the virtual network interface for the bare metal server network + // attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The bare metal server network interface type. + // The bare metal server network attachment type. Type *string `json:"type" validate:"required"` - // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. + // The virtual network interface for this bare metal server network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` + + // The VLAN IDs allowed for `vlan` attachments using this PCI 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`. + // 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 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. + // 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 interface with `interface_type` of `pci` with `allowed_vlans` including - // this network interface's `vlan`. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + // `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 VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. + // 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 BareMetalServerNetworkInterface.InterfaceType property. -// The interface type: -// - `hipersocket`: a virtual device that provides high-speed TCP/IP connectivity -// within a `s390x` based system +// 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 interface +// 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. -// - Has its own security groups and does not inherit those of the PCI device through -// which traffic flows. // // The enumerated values for this property are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the // unexpected property value was encountered. const ( - BareMetalServerNetworkInterfaceInterfaceTypeHipersocketConst = "hipersocket" - BareMetalServerNetworkInterfaceInterfaceTypePciConst = "pci" - BareMetalServerNetworkInterfaceInterfaceTypeVlanConst = "vlan" + BareMetalServerNetworkAttachmentInterfaceTypePciConst = "pci" + BareMetalServerNetworkAttachmentInterfaceTypeVlanConst = "vlan" ) -// Constants associated with the BareMetalServerNetworkInterface.ResourceType property. -// The resource type. +// Constants associated with the BareMetalServerNetworkAttachment.LifecycleState property. +// The lifecycle state of the bare metal server network attachment. const ( - BareMetalServerNetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" + BareMetalServerNetworkAttachmentLifecycleStateDeletingConst = "deleting" + BareMetalServerNetworkAttachmentLifecycleStateFailedConst = "failed" + BareMetalServerNetworkAttachmentLifecycleStatePendingConst = "pending" + BareMetalServerNetworkAttachmentLifecycleStateStableConst = "stable" + BareMetalServerNetworkAttachmentLifecycleStateSuspendedConst = "suspended" + BareMetalServerNetworkAttachmentLifecycleStateUpdatingConst = "updating" + BareMetalServerNetworkAttachmentLifecycleStateWaitingConst = "waiting" ) -// Constants associated with the BareMetalServerNetworkInterface.Status property. -// The status of the bare metal server network interface. +// Constants associated with the BareMetalServerNetworkAttachment.ResourceType property. +// The resource type. const ( - BareMetalServerNetworkInterfaceStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceStatusPendingConst = "pending" + BareMetalServerNetworkAttachmentResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" ) -// Constants associated with the BareMetalServerNetworkInterface.Type property. -// The bare metal server network interface type. +// Constants associated with the BareMetalServerNetworkAttachment.Type property. +// The bare metal server network attachment type. const ( - BareMetalServerNetworkInterfaceTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceTypeSecondaryConst = "secondary" + BareMetalServerNetworkAttachmentTypePrimaryConst = "primary" + BareMetalServerNetworkAttachmentTypeSecondaryConst = "secondary" ) -func (*BareMetalServerNetworkInterface) isaBareMetalServerNetworkInterface() bool { +func (*BareMetalServerNetworkAttachment) isaBareMetalServerNetworkAttachment() bool { return true } -type BareMetalServerNetworkInterfaceIntf interface { - isaBareMetalServerNetworkInterface() bool +type BareMetalServerNetworkAttachmentIntf interface { + isaBareMetalServerNetworkAttachment() 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) +// 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 = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) return } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { return } - if discValue == "hipersocket" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByHiperSocket) - } else if discValue == "pci" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByPci) - } else if discValue == "vlan" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByVlan) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct -type BareMetalServerNetworkInterfaceCollection struct { +// BareMetalServerNetworkAttachmentCollection : BareMetalServerNetworkAttachmentCollection struct +type BareMetalServerNetworkAttachmentCollection struct { // A link to the first page of resources. - First *BareMetalServerNetworkInterfaceCollectionFirst `json:"first" validate:"required"` + First *BareMetalServerNetworkAttachmentCollectionFirst `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` - // Collection of bare metal server network interfaces. - NetworkInterfaces []BareMetalServerNetworkInterfaceIntf `json:"network_interfaces" validate:"required"` + // Collection of bare metal server network attachments. + 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 *BareMetalServerNetworkInterfaceCollectionNext `json:"next,omitempty"` + Next *BareMetalServerNetworkAttachmentCollectionNext `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) +// 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) if err != nil { return } @@ -27136,11 +28649,11 @@ func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachment) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkAttachmentCollectionNext) if err != nil { return } @@ -27153,7 +28666,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 *BareMetalServerNetworkAttachmentCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -27164,15 +28677,15 @@ func (resp *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, return start, nil } -// BareMetalServerNetworkInterfaceCollectionFirst : A link to the first page of resources. -type BareMetalServerNetworkInterfaceCollectionFirst struct { +// 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"` } -// 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) +// 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) if err != nil { return @@ -27181,15 +28694,15 @@ func UnmarshalBareMetalServerNetworkInterfaceCollectionFirst(m map[string]json.R return } -// BareMetalServerNetworkInterfaceCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BareMetalServerNetworkInterfaceCollectionNext struct { +// 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"` } -// 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) +// 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) if err != nil { return @@ -27198,46 +28711,24 @@ func UnmarshalBareMetalServerNetworkInterfaceCollectionNext(m map[string]json.Ra return } -// BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct -type BareMetalServerNetworkInterfacePatch struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // 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. +// 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"` - // 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`. - 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. + // 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"` } -// 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 { - return - } +// 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 { return } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -27246,212 +28737,115 @@ func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, return } -// AsPatch returns a generic map representation of the BareMetalServerNetworkInterfacePatch -func (bareMetalServerNetworkInterfacePatch *BareMetalServerNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { +// 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(bareMetalServerNetworkInterfacePatch) + jsonData, err = json.Marshal(bareMetalServerNetworkAttachmentPatch) if err == nil { err = json.Unmarshal(jsonData, &_patch) } return } -// BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct +// BareMetalServerNetworkAttachmentPrototype : BareMetalServerNetworkAttachmentPrototype 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. - 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`. - 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` +// - 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 interface + // 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. - // - 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. + // 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 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. + // 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 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"` + // 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` interfaces using this PCI interface. + // 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 interface can float to another bare metal server. Can only be `true` for - // network interfaces with an `interface_type` of `vlan`. + // 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 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. + // 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 interface with `interface_type` of `pci` with `allowed_vlans` including - // this network interface's `vlan`. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + // `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 VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. + // 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 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` +// 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 interface +// 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. -// - 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" + BareMetalServerNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" + BareMetalServerNetworkAttachmentPrototypeInterfaceTypeVlanConst = "vlan" ) -func (*BareMetalServerNetworkInterfacePrototype) isaBareMetalServerNetworkInterfacePrototype() bool { +func (*BareMetalServerNetworkAttachmentPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { return true } -type BareMetalServerNetworkInterfacePrototypeIntf interface { - isaBareMetalServerNetworkInterfacePrototype() bool +type BareMetalServerNetworkAttachmentPrototypeIntf interface { + isaBareMetalServerNetworkAttachmentPrototype() 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) +// 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 = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) - return - } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") return } - if discValue == "hipersocket" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - } else if discValue == "pci" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) - } else if discValue == "vlan" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) - } - return -} - -// BareMetalServerNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerNetworkInterfaceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerNetworkInterfaceReferenceTargetContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceReferenceTargetContextDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPatch : BareMetalServerPatch struct -type BareMetalServerPatch struct { - // 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, "enable_secure_boot", &obj.EnableSecureBoot) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) if err != nil { return } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) if err != nil { return } @@ -27459,100 +28853,99 @@ func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interfac 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) - } - return -} - -// BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct -type BareMetalServerPrimaryNetworkInterfacePrototype struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. +// 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"` - // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,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, + // - 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`. + // - 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 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"` + // 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"` - // 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. + // 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 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 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 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"` + // 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"` - // The security groups to use for this bare metal server network interface. If unspecified, the VPC's default security - // group is used. + // 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 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. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + // 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"` } -// 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" -) +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} -// 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") - return +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface { + isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool } -// 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) if err != nil { return } @@ -27560,7 +28953,7 @@ func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json. if err != nil { return } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) if err != nil { return } @@ -27568,94 +28961,23 @@ func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json. if err != nil { return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - 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"` - - // Collection of the bare metal server profile's disks. - Disks []BareMetalServerProfileDisk `json:"disks" validate:"required"` - - // The product family this bare metal server profile belongs to. - Family *string `json:"family" validate:"required"` - - // The URL for this bare metal server profile. - Href *string `json:"href" validate:"required"` - - Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` - - // The name for this bare metal server profile. - Name *string `json:"name" validate:"required"` - - NetworkInterfaceCount BareMetalServerProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` - - OsArchitecture *BareMetalServerProfileOsArchitecture `json:"os_architecture" 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"` -} - -// Constants associated with the BareMetalServerProfile.ResourceType property. -// The resource type. -const ( - BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" -) - -// 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 { - return - } - err = core.UnmarshalModel(m, "console_types", &obj.ConsoleTypes, UnmarshalBareMetalServerProfileConsoleTypes) - if err != nil { - return - } - err = core.UnmarshalModel(m, "cpu_architecture", &obj.CpuArchitecture, UnmarshalBareMetalServerProfileCpuArchitecture) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "cpu_core_count", &obj.CpuCoreCount, UnmarshalBareMetalServerProfileCpuCoreCount) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "cpu_socket_count", &obj.CpuSocketCount, UnmarshalBareMetalServerProfileCpuSocketCount) + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerProfileDisk) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } @@ -27663,27 +28985,7 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf if err != nil { return } - err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalBareMetalServerProfileNetworkInterfaceCount) - if err != nil { - return - } - err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalModel(m, "supported_trusted_platform_module_modes", &obj.SupportedTrustedPlatformModuleModes, UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } @@ -27691,77 +28993,68 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf 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"` +// BareMetalServerNetworkAttachmentReference : BareMetalServerNetworkAttachmentReference struct +type BareMetalServerNetworkAttachmentReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` - // The value for this profile field. - Value *int64 `json:"value,omitempty"` + // The URL for this bare metal server network attachment. + Href *string `json:"href" validate:"required"` - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` + // The unique identifier for this bare metal server network attachment. + ID *string `json:"id" validate:"required"` - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` + // 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 minimum value for this profile field. - Min *int64 `json:"min,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 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 subnet of the virtual network interface for the bare metal server network + // attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` } -// Constants associated with the BareMetalServerProfileBandwidth.Type property. -// The type for this profile field. +// Constants associated with the BareMetalServerNetworkAttachmentReference.ResourceType property. +// The resource type. const ( - BareMetalServerProfileBandwidthTypeFixedConst = "fixed" + BareMetalServerNetworkAttachmentReferenceResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" ) -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) +// 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, UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted) if err != nil { return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { return } @@ -27769,36 +29062,17 @@ func UnmarshalBareMetalServerProfileBandwidth(m map[string]json.RawMessage, resu 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"` +// BareMetalServerNetworkAttachmentReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkAttachmentReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" 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 { - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) +// UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted unmarshals an instance of BareMetalServerNetworkAttachmentReferenceDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } @@ -27806,185 +29080,293 @@ func UnmarshalBareMetalServerProfileCpuArchitecture(m map[string]json.RawMessage return } -// BareMetalServerProfileCpuCoreCount : BareMetalServerProfileCpuCoreCount struct +// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct // Models which "extend" this model: -// - BareMetalServerProfileCpuCoreCountFixed -// - BareMetalServerProfileCpuCoreCountRange -// - BareMetalServerProfileCpuCoreCountEnum -// - BareMetalServerProfileCpuCoreCountDependent -type BareMetalServerProfileCpuCoreCount struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` +// - 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=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 value for this profile field. - Value *int64 `json:"value,omitempty"` + // 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=vni-old-api-clients) when its corresponding network attachment + // was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The default value for this profile field. - Default *int64 `json:"default,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=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 maximum value for this profile field. - Max *int64 `json:"max,omitempty"` + // 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=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 minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // 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=vni-old-api-clients) of its corresponding network + // attachment. + Href *string `json:"href" validate:"required"` - // The increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + // 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=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 permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} + // 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=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 are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` -// Constants associated with the BareMetalServerProfileCpuCoreCount.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuCoreCountTypeFixedConst = "fixed" -) + // The MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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"` -func (*BareMetalServerProfileCpuCoreCount) isaBareMetalServerProfileCpuCoreCount() bool { - return true -} + // 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=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"` -type BareMetalServerProfileCpuCoreCountIntf interface { - isaBareMetalServerProfileCpuCoreCount() bool -} + // 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=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"` -// 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 { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + PrimaryIP *ReservedIPReference `json:"primary_ip" 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 resource type. + ResourceType *string `json:"resource_type" validate:"required"` - // The value for this profile field. - Value *int64 `json:"value,omitempty"` + // 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=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 default value for this profile field. - Default *int64 `json:"default,omitempty"` + // 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=vni-old-api-clients). + Status *string `json:"status" validate:"required"` - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` - // The minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // 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=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 increment step value for this profile field. - Step *int64 `json:"step,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=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 permitted values for this profile field. - Values []int64 `json:"values,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=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=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 BareMetalServerProfileCpuSocketCount.Type property. -// The type for this profile field. +// 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=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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. const ( - BareMetalServerProfileCpuSocketCountTypeFixedConst = "fixed" + BareMetalServerNetworkInterfaceInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkInterfaceInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfaceInterfaceTypeVlanConst = "vlan" ) -func (*BareMetalServerProfileCpuSocketCount) isaBareMetalServerProfileCpuSocketCount() bool { +// 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=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=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 BareMetalServerProfileCpuSocketCountIntf interface { - isaBareMetalServerProfileCpuSocketCount() bool +type BareMetalServerNetworkInterfaceIntf interface { + isaBareMetalServerNetworkInterface() 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 { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) +// 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 = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) - if err != nil { + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) - if err != nil { - return + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByHiperSocket) + } else if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByPci) + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByVlan) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct -type BareMetalServerProfileCollection struct { +// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct +type BareMetalServerNetworkInterfaceCollection struct { // A link to the first page of resources. - First *BareMetalServerProfileCollectionFirst `json:"first" validate:"required"` + First *BareMetalServerNetworkInterfaceCollectionFirst `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` + // Collection of bare metal server network interfaces. + 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 *BareMetalServerProfileCollectionNext `json:"next,omitempty"` - - // Collection of bare metal server profiles. - Profiles []BareMetalServerProfile `json:"profiles" validate:"required"` + Next *BareMetalServerNetworkInterfaceCollectionNext `json:"next,omitempty"` // 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) +// 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) if err != nil { return } @@ -27992,11 +29374,11 @@ func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, res if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerProfileCollectionNext) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) if err != nil { return } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalBareMetalServerProfile) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) if err != nil { return } @@ -28009,7 +29391,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 *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -28020,15 +29402,15 @@ func (resp *BareMetalServerProfileCollection) GetNextStart() (*string, error) { return start, nil } -// BareMetalServerProfileCollectionFirst : A link to the first page of resources. -type BareMetalServerProfileCollectionFirst struct { +// 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"` } -// 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) +// 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 { return @@ -28037,15 +29419,15 @@ func UnmarshalBareMetalServerProfileCollectionFirst(m map[string]json.RawMessage return } -// BareMetalServerProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BareMetalServerProfileCollectionNext struct { +// 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"` } -// 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) +// 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 { return @@ -28054,64 +29436,57 @@ func UnmarshalBareMetalServerProfileCollectionNext(m map[string]json.RawMessage, return } -// 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"` +// 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=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 console types for a bare metal server with this profile. - Values []string `json:"values" 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"` -// Constants associated with the BareMetalServerProfileConsoleTypes.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileConsoleTypesTypeEnumConst = "enum" -) + // 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=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"` -// Constants associated with the BareMetalServerProfileConsoleTypes.Values property. -// A console type. -const ( - BareMetalServerProfileConsoleTypesValuesSerialConst = "serial" - BareMetalServerProfileConsoleTypesValuesVncConst = "vnc" -) + // 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"` +} -// 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 { - return - } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) +// 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 { 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"` - - Size BareMetalServerProfileDiskSizeIntf `json:"size" validate:"required"` - - SupportedInterfaceTypes *BareMetalServerProfileDiskSupportedInterfaces `json:"supported_interface_types" 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) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { return } - err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalBareMetalServerProfileDiskSize) + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) if err != nil { return } - err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalBareMetalServerProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -28119,77 +29494,232 @@ func UnmarshalBareMetalServerProfileDisk(m map[string]json.RawMessage, result in return } -// BareMetalServerProfileDiskQuantity : BareMetalServerProfileDiskQuantity struct +// 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) + } + return +} + +// BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct // Models which "extend" this model: -// - BareMetalServerProfileDiskQuantityFixed -// - BareMetalServerProfileDiskQuantityRange -// - BareMetalServerProfileDiskQuantityEnum -// - BareMetalServerProfileDiskQuantityDependent -type BareMetalServerProfileDiskQuantity struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` +// - 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=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 value for this profile field. - Value *int64 `json:"value,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=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 default value for this profile field. - Default *int64 `json:"default,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 maximum value for this profile field. - Max *int64 `json:"max,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 minimum value for this profile field. - Min *int64 `json:"min,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 increment step value for this profile field. - Step *int64 `json:"step,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 permitted values for this profile field. - Values []int64 `json:"values,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=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=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 BareMetalServerProfileDiskQuantity.Type property. -// The type for this profile field. +// 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 ( - BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" + BareMetalServerNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkInterfacePrototypeInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfacePrototypeInterfaceTypeVlanConst = "vlan" ) -func (*BareMetalServerProfileDiskQuantity) isaBareMetalServerProfileDiskQuantity() bool { +func (*BareMetalServerNetworkInterfacePrototype) isaBareMetalServerNetworkInterfacePrototype() bool { return true } -type BareMetalServerProfileDiskQuantityIntf interface { - isaBareMetalServerProfileDiskQuantity() bool +type BareMetalServerNetworkInterfacePrototypeIntf interface { + isaBareMetalServerNetworkInterfacePrototype() 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) +// 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 = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") return } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + } else if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + } + return +} + +// BareMetalServerNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkInterfaceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkInterfaceReferenceTargetContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPatch : BareMetalServerPatch struct +type BareMetalServerPatch struct { + // 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, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) if err != nil { return } @@ -28197,77 +29727,81 @@ func UnmarshalBareMetalServerProfileDiskQuantity(m map[string]json.RawMessage, r 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"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` - - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` +// 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) + } + return +} - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` +// 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 minimum value for this profile field. - Min *int64 `json:"min,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 increment step value for this profile field. - Step *int64 `json:"step,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 permitted values for this profile field. - Values []int64 `json:"values,omitempty"` + // The VLAN IDs to allow for `vlan` attachments using this PCI attachment. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` } -// Constants associated with the BareMetalServerProfileDiskSize.Type property. -// The type for this profile field. +// 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 ( - BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" + BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" ) -func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { +func (*BareMetalServerPrimaryNetworkAttachmentPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { return true } -type BareMetalServerProfileDiskSizeIntf interface { - isaBareMetalServerProfileDiskSize() bool +type BareMetalServerPrimaryNetworkAttachmentPrototypeIntf interface { + isaBareMetalServerPrimaryNetworkAttachmentPrototype() 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 { - return - } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) +// 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 { return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { return } @@ -28275,76 +29809,129 @@ func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, resul return } -// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct -type BareMetalServerProfileDiskSupportedInterfaces struct { - // The disk interface used for attaching the disk. +// BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct +type BareMetalServerPrimaryNetworkInterfacePrototype struct { + // Indicates whether source IP spoofing is allowed on this bare metal server network interface. // - // - `fcp`: Attached using Fiber Channel Protocol - // - `sata`: Attached using Serial Advanced Technology Attachment - // - `nvme`: Attached using Non-Volatile Memory Express + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - Default *string `json:"default" 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=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 type for this profile field. - Type *string `json:"type" 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=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 supported disk interfaces used for attaching the disk. - Values []string `json:"values" 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"` -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. -// The disk interface used for attaching the disk. -// -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using Non-Volatile Memory Express -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - BareMetalServerProfileDiskSupportedInterfacesDefaultFcpConst = "fcp" - BareMetalServerProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" - BareMetalServerProfileDiskSupportedInterfacesDefaultSataConst = "sata" -) + // 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"` -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskSupportedInterfacesTypeEnumConst = "enum" -) + // 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"` -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Values property. -// The disk interface used for attaching the disk. -// -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using Non-Volatile Memory Express -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. + // 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 ( - BareMetalServerProfileDiskSupportedInterfacesValuesFcpConst = "fcp" - BareMetalServerProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" - BareMetalServerProfileDiskSupportedInterfacesValuesSataConst = "sata" + BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerPrimaryNetworkInterfacePrototypeInterfaceTypePciConst = "pci" ) -// 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) +// 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") + return +} + +// 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 { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { return } @@ -28352,30 +29939,83 @@ func UnmarshalBareMetalServerProfileDiskSupportedInterfaces(m map[string]json.Ra return } -// 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"` +// 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"` + + // Collection of the bare metal server profile's disks. + Disks []BareMetalServerProfileDisk `json:"disks" validate:"required"` + + // The product family this bare metal server profile belongs to. + Family *string `json:"family" validate:"required"` // The URL for this bare metal server profile. - Href *string `json:"href,omitempty"` -} + Href *string `json:"href" validate:"required"` -func (*BareMetalServerProfileIdentity) isaBareMetalServerProfileIdentity() bool { - return true -} + Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` -type BareMetalServerProfileIdentityIntf interface { - isaBareMetalServerProfileIdentity() bool + // The name for this bare metal server profile. + 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 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"` } -// 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) +// Constants associated with the BareMetalServerProfile.ResourceType property. +// The resource type. +const ( + BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +// 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 { + return + } + err = core.UnmarshalModel(m, "console_types", &obj.ConsoleTypes, UnmarshalBareMetalServerProfileConsoleTypes) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_architecture", &obj.CpuArchitecture, UnmarshalBareMetalServerProfileCpuArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_core_count", &obj.CpuCoreCount, UnmarshalBareMetalServerProfileCpuCoreCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_socket_count", &obj.CpuSocketCount, UnmarshalBareMetalServerProfileCpuSocketCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerProfileDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { return } @@ -28383,17 +30023,49 @@ func UnmarshalBareMetalServerProfileIdentity(m map[string]json.RawMessage, resul if err != nil { return } + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalBareMetalServerProfileNetworkAttachmentCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalBareMetalServerProfileNetworkInterfaceCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_trusted_platform_module_modes", &obj.SupportedTrustedPlatformModuleModes, UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interfaces_supported", &obj.VirtualNetworkInterfacesSupported, UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileMemory : BareMetalServerProfileMemory struct +// BareMetalServerProfileBandwidth : BareMetalServerProfileBandwidth struct // Models which "extend" this model: -// - BareMetalServerProfileMemoryFixed -// - BareMetalServerProfileMemoryRange -// - BareMetalServerProfileMemoryEnum -// - BareMetalServerProfileMemoryDependent -type BareMetalServerProfileMemory struct { +// - BareMetalServerProfileBandwidthFixed +// - BareMetalServerProfileBandwidthRange +// - BareMetalServerProfileBandwidthEnum +// - BareMetalServerProfileBandwidthDependent +type BareMetalServerProfileBandwidth struct { // The type for this profile field. Type *string `json:"type,omitempty"` @@ -28416,23 +30088,23 @@ type BareMetalServerProfileMemory struct { Values []int64 `json:"values,omitempty"` } -// Constants associated with the BareMetalServerProfileMemory.Type property. +// Constants associated with the BareMetalServerProfileBandwidth.Type property. // The type for this profile field. const ( - BareMetalServerProfileMemoryTypeFixedConst = "fixed" + BareMetalServerProfileBandwidthTypeFixedConst = "fixed" ) -func (*BareMetalServerProfileMemory) isaBareMetalServerProfileMemory() bool { +func (*BareMetalServerProfileBandwidth) isaBareMetalServerProfileBandwidth() bool { return true } -type BareMetalServerProfileMemoryIntf interface { - isaBareMetalServerProfileMemory() bool +type BareMetalServerProfileBandwidthIntf interface { + isaBareMetalServerProfileBandwidth() 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) +// 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 { return @@ -28465,38 +30137,101 @@ func UnmarshalBareMetalServerProfileMemory(m map[string]json.RawMessage, result return } -// BareMetalServerProfileNetworkInterfaceCount : BareMetalServerProfileNetworkInterfaceCount struct +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCount : BareMetalServerProfileCpuCoreCount struct // Models which "extend" this model: -// - BareMetalServerProfileNetworkInterfaceCountRange -// - BareMetalServerProfileNetworkInterfaceCountDependent -type BareMetalServerProfileNetworkInterfaceCount struct { +// - 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 type for this profile field. - Type *string `json:"type,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 BareMetalServerProfileNetworkInterfaceCount.Type property. +// Constants associated with the BareMetalServerProfileCpuCoreCount.Type property. // The type for this profile field. const ( - BareMetalServerProfileNetworkInterfaceCountTypeRangeConst = "range" + BareMetalServerProfileCpuCoreCountTypeFixedConst = "fixed" ) -func (*BareMetalServerProfileNetworkInterfaceCount) isaBareMetalServerProfileNetworkInterfaceCount() bool { +func (*BareMetalServerProfileCpuCoreCount) isaBareMetalServerProfileCpuCoreCount() bool { return true } -type BareMetalServerProfileNetworkInterfaceCountIntf interface { - isaBareMetalServerProfileNetworkInterfaceCount() bool +type BareMetalServerProfileCpuCoreCountIntf interface { + isaBareMetalServerProfileCpuCoreCount() 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) +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { return @@ -28505,7 +30240,11 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCount(m map[string]json.RawM if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -28513,32 +30252,73 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCount(m map[string]json.RawM 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"` - +// 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" validate:"required"` + Type *string `json:"type,omitempty"` - // The supported OS architecture(s) for a bare metal server with this profile. - Values []string `json:"values" validate:"required"` + // 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 BareMetalServerProfileOsArchitecture.Type property. +// Constants associated with the BareMetalServerProfileCpuSocketCount.Type property. // The type for this profile field. const ( - BareMetalServerProfileOsArchitectureTypeEnumConst = "enum" + BareMetalServerProfileCpuSocketCountTypeFixedConst = "fixed" ) -// 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) +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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "default", &obj.Default) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) if err != nil { return } @@ -28550,36 +30330,45 @@ func UnmarshalBareMetalServerProfileOsArchitecture(m map[string]json.RawMessage, return } -// BareMetalServerProfileReference : BareMetalServerProfileReference struct -type BareMetalServerProfileReference struct { - // The URL for this bare metal server profile. - Href *string `json:"href" validate:"required"` +// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct +type BareMetalServerProfileCollection struct { + // A link to the first page of resources. + First *BareMetalServerProfileCollectionFirst `json:"first" validate:"required"` - // The name for this bare metal server profile. - Name *string `json:"name" validate:"required"` + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" 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"` -// Constants associated with the BareMetalServerProfileReference.ResourceType property. -// The resource type. -const ( - BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" -) + // Collection of bare metal server profiles. + Profiles []BareMetalServerProfile `json:"profiles" validate:"required"` -// 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) + // 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) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalBareMetalServerProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } @@ -28587,37 +30376,77 @@ 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 { +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BareMetalServerProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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"` +} + +// 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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 supported trusted platform module modes. + // The console types for a bare metal server with this profile. Values []string `json:"values" validate:"required"` } -// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Type property. +// Constants associated with the BareMetalServerProfileConsoleTypes.Type property. // The type for this profile field. const ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesTypeEnumConst = "enum" + BareMetalServerProfileConsoleTypesTypeEnumConst = "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 are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// Constants associated with the BareMetalServerProfileConsoleTypes.Values property. +// A console type. const ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" + BareMetalServerProfileConsoleTypesValuesSerialConst = "serial" + BareMetalServerProfileConsoleTypesValuesVncConst = "vnc" ) -// 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) +// 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 { return @@ -28630,50 +30459,27 @@ func UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes(m map[st 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. - Code *string `json:"code" validate:"required"` +// BareMetalServerProfileDisk : Disks provided by this profile. +type BareMetalServerProfileDisk struct { + Quantity BareMetalServerProfileDiskQuantityIntf `json:"quantity" validate:"required"` - // An explanation of the status reason. - Message *string `json:"message" validate:"required"` + Size BareMetalServerProfileDiskSizeIntf `json:"size" validate:"required"` - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` + SupportedInterfaceTypes *BareMetalServerProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` } -// 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. -const ( - BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" - BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" - BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" - BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" - BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" -) - -// 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) +// 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 { return } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalBareMetalServerProfileDiskSize) if err != nil { return } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalBareMetalServerProfileDiskSupportedInterfaces) if err != nil { return } @@ -28681,62 +30487,77 @@ 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 are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - Mode *string `json:"mode" 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 supported trusted platform module modes. - SupportedModes []string `json:"supported_modes" validate:"required"` + // 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 BareMetalServerTrustedPlatformModule.Mode property. -// The trusted platform module (TPM) mode: -// - `disabled`: No TPM functionality -// - `tpm_2`: TPM 2.0 -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// Constants associated with the BareMetalServerProfileDiskQuantity.Type property. +// The type for this profile field. const ( - BareMetalServerTrustedPlatformModuleModeDisabledConst = "disabled" - BareMetalServerTrustedPlatformModuleModeTpm2Const = "tpm_2" + BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" ) -// 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 are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - BareMetalServerTrustedPlatformModuleSupportedModesDisabledConst = "disabled" - BareMetalServerTrustedPlatformModuleSupportedModesTpm2Const = "tpm_2" -) +func (*BareMetalServerProfileDiskQuantity) isaBareMetalServerProfileDiskQuantity() bool { + return true +} -// 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) +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 { return } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { return } - err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -28744,29 +30565,77 @@ func UnmarshalBareMetalServerTrustedPlatformModule(m map[string]json.RawMessage, 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"` +// 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 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 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`. +// Constants associated with the BareMetalServerProfileDiskSize.Type property. +// The type for this profile field. const ( - BareMetalServerTrustedPlatformModulePatchModeDisabledConst = "disabled" - BareMetalServerTrustedPlatformModulePatchModeTpm2Const = "tpm_2" + BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" ) -// 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) +func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { + return true +} + +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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -28774,25 +30643,76 @@ func UnmarshalBareMetalServerTrustedPlatformModulePatch(m map[string]json.RawMes 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`. - Mode *string `json:"mode,omitempty"` +// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct +type BareMetalServerProfileDiskSupportedInterfaces struct { + // The disk interface used for attaching the disk. + // + // - `fcp`: Attached using Fiber Channel Protocol + // - `sata`: Attached using Serial Advanced Technology Attachment + // - `nvme`: Attached using Non-Volatile Memory Express + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + 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"` } -// 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`. +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. +// The disk interface used for attaching the disk. +// +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. const ( - BareMetalServerTrustedPlatformModulePrototypeModeDisabledConst = "disabled" - BareMetalServerTrustedPlatformModulePrototypeModeTpm2Const = "tpm_2" + BareMetalServerProfileDiskSupportedInterfacesDefaultFcpConst = "fcp" + BareMetalServerProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" + BareMetalServerProfileDiskSupportedInterfacesDefaultSataConst = "sata" ) -// 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) +// 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 interface used for attaching the disk. +// +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +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 { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -28800,28 +30720,34 @@ func UnmarshalBareMetalServerTrustedPlatformModulePrototype(m map[string]json.Ra return } -// CatalogOfferingIdentity : Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique -// property. +// BareMetalServerProfileIdentity : Identifies a bare metal server profile 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"` +// - 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"` } -func (*CatalogOfferingIdentity) isaCatalogOfferingIdentity() bool { +func (*BareMetalServerProfileIdentity) isaBareMetalServerProfileIdentity() bool { return true } -type CatalogOfferingIdentityIntf interface { - isaCatalogOfferingIdentity() bool +type BareMetalServerProfileIdentityIntf interface { + isaBareMetalServerProfileIdentity() 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) +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -28829,28 +30755,77 @@ func UnmarshalCatalogOfferingIdentity(m map[string]json.RawMessage, result inter return } -// CatalogOfferingVersionIdentity : Identifies a version of a -// [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a unique property. +// BareMetalServerProfileMemory : BareMetalServerProfileMemory struct // 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"` +// - 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"` } -func (*CatalogOfferingVersionIdentity) isaCatalogOfferingVersionIdentity() bool { +// Constants associated with the BareMetalServerProfileMemory.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileMemory) isaBareMetalServerProfileMemory() bool { return true } -type CatalogOfferingVersionIdentityIntf interface { - isaCatalogOfferingVersionIdentity() bool +type BareMetalServerProfileMemoryIntf interface { + isaBareMetalServerProfileMemory() 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) +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -28858,17 +30833,47 @@ func UnmarshalCatalogOfferingVersionIdentity(m map[string]json.RawMessage, resul 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"` +// 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"` } -// 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) +// Constants associated with the BareMetalServerProfileNetworkAttachmentCount.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkAttachmentCountTypeRangeConst = "range" +) + +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 { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -28876,26 +30881,47 @@ func UnmarshalCatalogOfferingVersionReference(m map[string]json.RawMessage, resu return } -// CertificateInstanceIdentity : Identifies a certificate instance by a unique property. +// BareMetalServerProfileNetworkInterfaceCount : BareMetalServerProfileNetworkInterfaceCount struct // Models which "extend" this model: -// - CertificateInstanceIdentityByCRN -type CertificateInstanceIdentity struct { - // The CRN for this certificate instance. - CRN *string `json:"crn,omitempty"` +// - BareMetalServerProfileNetworkInterfaceCountRange +// - BareMetalServerProfileNetworkInterfaceCountDependent +type BareMetalServerProfileNetworkInterfaceCount 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"` } -func (*CertificateInstanceIdentity) isaCertificateInstanceIdentity() bool { +// Constants associated with the BareMetalServerProfileNetworkInterfaceCount.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkInterfaceCountTypeRangeConst = "range" +) + +func (*BareMetalServerProfileNetworkInterfaceCount) isaBareMetalServerProfileNetworkInterfaceCount() bool { return true } -type CertificateInstanceIdentityIntf interface { - isaCertificateInstanceIdentity() bool +type BareMetalServerProfileNetworkInterfaceCountIntf interface { + isaBareMetalServerProfileNetworkInterfaceCount() 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) +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -28903,16 +30929,36 @@ func UnmarshalCertificateInstanceIdentity(m map[string]json.RawMessage, result i return } -// CertificateInstanceReference : CertificateInstanceReference struct -type CertificateInstanceReference struct { - // The CRN for this certificate instance. - CRN *string `json:"crn" 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 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"` } -// 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) +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { return } @@ -28920,32 +30966,544 @@ func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result return } -// CheckVPNGatewayConnectionLocalCIDROptions : The CheckVPNGatewayConnectionLocalCIDR options. -type CheckVPNGatewayConnectionLocalCIDROptions 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 address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` +// BareMetalServerProfileReference : BareMetalServerProfileReference struct +type BareMetalServerProfileReference struct { + // The URL for this bare metal server profile. + Href *string `json:"href" validate:"required"` - // Allows users to set headers on API requests - Headers map[string]string -} + // The name for this bare metal server profile. + Name *string `json:"name" validate:"required"` -// NewCheckVPNGatewayConnectionLocalCIDROptions : Instantiate CheckVPNGatewayConnectionLocalCIDROptions -func (*VpcV1) NewCheckVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { - return &CheckVPNGatewayConnectionLocalCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), - } + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileReference.ResourceType property. +// The resource type. +const ( + BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileSupportedTrustedPlatformModuleModes : The supported trusted platform module modes for this bare metal server profile. +type BareMetalServerProfileSupportedTrustedPlatformModuleModes struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported trusted platform module modes. + Values []string `json:"values" validate:"required"` +} + +// 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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" +) + +// 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, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrototype : BareMetalServerPrototype struct +// Models which "extend" this model: +// - BareMetalServerPrototypeBareMetalServerByNetworkAttachment +// - BareMetalServerPrototypeBareMetalServerByNetworkInterface +type BareMetalServerPrototype struct { + // 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, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) + if err != nil { + 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. + 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 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. +const ( + BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" + BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" + BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" + BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" + BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + 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 are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + 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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +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 { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) + if err != nil { + 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 { + return + } + 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`. + 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`. +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 { + return + } + 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 { + 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"` +} + +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 { + 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) + if err != nil { + 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) + if err != nil { + 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) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CheckVPNGatewayConnectionLocalCIDROptions : The CheckVPNGatewayConnectionLocalCIDR options. +type CheckVPNGatewayConnectionLocalCIDROptions 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 address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCheckVPNGatewayConnectionLocalCIDROptions : Instantiate CheckVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewCheckVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { + return &CheckVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } } // SetVPNGatewayID : Allow user to set VPNGatewayID @@ -29303,154 +31861,101 @@ func (options *CreateBareMetalServerConsoleAccessTokenOptions) SetHeaders(param return options } -// CreateBareMetalServerNetworkInterfaceOptions : The CreateBareMetalServerNetworkInterface options. -type CreateBareMetalServerNetworkInterfaceOptions struct { +// CreateBareMetalServerNetworkAttachmentOptions : The CreateBareMetalServerNetworkAttachment options. +type CreateBareMetalServerNetworkAttachmentOptions struct { // The bare metal server identifier. BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The bare metal server network interface prototype object. - BareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf `json:"BareMetalServerNetworkInterfacePrototype" validate:"required"` + // The bare metal server network attachment prototype object. + BareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf `json:"BareMetalServerNetworkAttachmentPrototype" validate:"required"` // Allows users to set headers on API requests Headers map[string]string } -// NewCreateBareMetalServerNetworkInterfaceOptions : Instantiate CreateBareMetalServerNetworkInterfaceOptions -func (*VpcV1) NewCreateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { - return &CreateBareMetalServerNetworkInterfaceOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - BareMetalServerNetworkInterfacePrototype: bareMetalServerNetworkInterfacePrototype, +// NewCreateBareMetalServerNetworkAttachmentOptions : Instantiate CreateBareMetalServerNetworkAttachmentOptions +func (*VpcV1) NewCreateBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, bareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf) *CreateBareMetalServerNetworkAttachmentOptions { + return &CreateBareMetalServerNetworkAttachmentOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + BareMetalServerNetworkAttachmentPrototype: bareMetalServerNetworkAttachmentPrototype, } } // SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkInterfaceOptions { +func (_options *CreateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkAttachmentOptions { _options.BareMetalServerID = core.StringPtr(bareMetalServerID) return _options } -// SetBareMetalServerNetworkInterfacePrototype : Allow user to set BareMetalServerNetworkInterfacePrototype -func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePrototype(bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototype +// SetBareMetalServerNetworkAttachmentPrototype : Allow user to set BareMetalServerNetworkAttachmentPrototype +func (_options *CreateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerNetworkAttachmentPrototype(bareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf) *CreateBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototype return _options } // SetHeaders : Allow user to set Headers -func (options *CreateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkInterfaceOptions { +func (options *CreateBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkAttachmentOptions { options.Headers = param return options } -// CreateBareMetalServerOptions : The CreateBareMetalServer options. -type CreateBareMetalServerOptions struct { - Initialization *BareMetalServerInitializationPrototype `json:"initialization" validate:"required"` - - // The primary bare metal server network interface to create. - PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_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 zone this bare metal server will reside in. - Zone ZoneIdentityIntf `json:"zone" 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 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 additional bare metal server network interfaces to create. - NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,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"` - - TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` +// CreateBareMetalServerNetworkInterfaceOptions : The CreateBareMetalServerNetworkInterface options. +type CreateBareMetalServerNetworkInterfaceOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - // The VPC this bare metal server will reside in. - // - // If specified, it must match the VPC for the subnets that the network interfaces of - // the bare metal server are attached to. - VPC VPCIdentityIntf `json:"vpc,omitempty"` + // The bare metal server network interface prototype object. + BareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf `json:"BareMetalServerNetworkInterfacePrototype" validate:"required"` // Allows users to set headers on API requests Headers map[string]string } -// NewCreateBareMetalServerOptions : Instantiate CreateBareMetalServerOptions -func (*VpcV1) NewCreateBareMetalServerOptions(initialization *BareMetalServerInitializationPrototype, primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf) *CreateBareMetalServerOptions { - return &CreateBareMetalServerOptions{ - Initialization: initialization, - PrimaryNetworkInterface: primaryNetworkInterface, - Profile: profile, - Zone: zone, +// NewCreateBareMetalServerNetworkInterfaceOptions : Instantiate CreateBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewCreateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { + return &CreateBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + BareMetalServerNetworkInterfacePrototype: bareMetalServerNetworkInterfacePrototype, } } -// SetInitialization : Allow user to set Initialization -func (_options *CreateBareMetalServerOptions) SetInitialization(initialization *BareMetalServerInitializationPrototype) *CreateBareMetalServerOptions { - _options.Initialization = initialization - return _options -} - -// SetPrimaryNetworkInterface : Allow user to set PrimaryNetworkInterface -func (_options *CreateBareMetalServerOptions) SetPrimaryNetworkInterface(primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype) *CreateBareMetalServerOptions { - _options.PrimaryNetworkInterface = primaryNetworkInterface - return _options -} - -// SetProfile : Allow user to set Profile -func (_options *CreateBareMetalServerOptions) SetProfile(profile BareMetalServerProfileIdentityIntf) *CreateBareMetalServerOptions { - _options.Profile = profile - return _options -} - -// SetZone : Allow user to set Zone -func (_options *CreateBareMetalServerOptions) SetZone(zone ZoneIdentityIntf) *CreateBareMetalServerOptions { - _options.Zone = zone +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) return _options } -// SetEnableSecureBoot : Allow user to set EnableSecureBoot -func (_options *CreateBareMetalServerOptions) SetEnableSecureBoot(enableSecureBoot bool) *CreateBareMetalServerOptions { - _options.EnableSecureBoot = core.BoolPtr(enableSecureBoot) +// SetBareMetalServerNetworkInterfacePrototype : Allow user to set BareMetalServerNetworkInterfacePrototype +func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePrototype(bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototype return _options } -// SetName : Allow user to set Name -func (_options *CreateBareMetalServerOptions) SetName(name string) *CreateBareMetalServerOptions { - _options.Name = core.StringPtr(name) - return _options +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options } -// SetNetworkInterfaces : Allow user to set NetworkInterfaces -func (_options *CreateBareMetalServerOptions) SetNetworkInterfaces(networkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerOptions { - _options.NetworkInterfaces = networkInterfaces - return _options -} +// CreateBareMetalServerOptions : The CreateBareMetalServer options. +type CreateBareMetalServerOptions struct { + // The bare metal server prototype object. + BareMetalServerPrototype BareMetalServerPrototypeIntf `json:"BareMetalServerPrototype" validate:"required"` -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateBareMetalServerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateBareMetalServerOptions { - _options.ResourceGroup = resourceGroup - return _options + // Allows users to set headers on API requests + Headers map[string]string } -// SetTrustedPlatformModule : Allow user to set TrustedPlatformModule -func (_options *CreateBareMetalServerOptions) SetTrustedPlatformModule(trustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype) *CreateBareMetalServerOptions { - _options.TrustedPlatformModule = trustedPlatformModule - return _options +// NewCreateBareMetalServerOptions : Instantiate CreateBareMetalServerOptions +func (*VpcV1) NewCreateBareMetalServerOptions(bareMetalServerPrototype BareMetalServerPrototypeIntf) *CreateBareMetalServerOptions { + return &CreateBareMetalServerOptions{ + BareMetalServerPrototype: bareMetalServerPrototype, + } } -// SetVPC : Allow user to set VPC -func (_options *CreateBareMetalServerOptions) SetVPC(vpc VPCIdentityIntf) *CreateBareMetalServerOptions { - _options.VPC = vpc +// SetBareMetalServerPrototype : Allow user to set BareMetalServerPrototype +func (_options *CreateBareMetalServerOptions) SetBareMetalServerPrototype(bareMetalServerPrototype BareMetalServerPrototypeIntf) *CreateBareMetalServerOptions { + _options.BareMetalServerPrototype = bareMetalServerPrototype return _options } @@ -29691,9 +32196,14 @@ type CreateFlowLogCollectorOptions struct { // collector](https://cloud.ibm.com/docs/vpc?topic=vpc-ordering-flow-log-collector). StorageBucket LegacyCloudObjectStorageBucketIdentityIntf `json:"storage_bucket" validate:"required"` - // The target this collector will collect flow logs for. If the target is an instance, - // subnet, or VPC, flow logs will not be collected for any instance network interfaces within - // the target that are themselves the target of a more specific flow log collector. + // The target this collector will collect flow logs for. + // + // If the target is an instance, subnet, or VPC, flow logs will not be collected for any + // instance network attachments, virtual network interfaces or instance network interfaces + // within the target that are themselves the target of a more specific flow log collector. + // + // The target must not be a virtual network interface that is attached to a bare metal server + // network attachment or to a file share mount target. Target FlowLogCollectorTargetPrototypeIntf `json:"target" validate:"required"` // Indicates whether this collector will be active upon creation. @@ -30310,6 +32820,59 @@ func (options *CreateInstanceGroupOptions) SetHeaders(param map[string]string) * return options } +// CreateInstanceNetworkAttachmentOptions : The CreateInstanceNetworkAttachment options. +type CreateInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // A virtual network interface for the instance 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, `enable_infrastructure_nat` must be + // `true`. + VirtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` + + // The name for this network attachment. Names must be unique within the instance the network attachment resides in. 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 +} + +// NewCreateInstanceNetworkAttachmentOptions : Instantiate CreateInstanceNetworkAttachmentOptions +func (*VpcV1) NewCreateInstanceNetworkAttachmentOptions(instanceID string, virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) *CreateInstanceNetworkAttachmentOptions { + return &CreateInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + VirtualNetworkInterface: virtualNetworkInterface, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *CreateInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *CreateInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetVirtualNetworkInterface : Allow user to set VirtualNetworkInterface +func (_options *CreateInstanceNetworkAttachmentOptions) SetVirtualNetworkInterface(virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) *CreateInstanceNetworkAttachmentOptions { + _options.VirtualNetworkInterface = virtualNetworkInterface + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateInstanceNetworkAttachmentOptions) SetName(name string) *CreateInstanceNetworkAttachmentOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *CreateInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + // CreateInstanceNetworkInterfaceOptions : The CreateInstanceNetworkInterface options. type CreateInstanceNetworkInterfaceOptions struct { // The virtual server instance identifier. @@ -30319,6 +32882,11 @@ type CreateInstanceNetworkInterfaceOptions struct { Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` // Indicates whether source IP spoofing is allowed on this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 name for the instance network interface. The name must not be used by another network interface on the virtual @@ -32010,8 +34578,9 @@ type CreateSubnetReservedIPOptions struct { // The target to bind this reserved IP to. The target must be in the same VPC. // - // At present, only endpoint gateway targets are supported. The endpoint gateway must - // not be already bound to a reserved IP in the subnet's zone. + // The following targets are supported: + // - An endpoint gateway not already bound to a reserved IP in the subnet's zone. + // - A virtual network interface. // // If unspecified, the reserved IP will be created unbound. Target ReservedIPTargetPrototypeIntf `json:"target,omitempty"` @@ -32063,6 +34632,136 @@ func (options *CreateSubnetReservedIPOptions) SetHeaders(param map[string]string return options } +// CreateVirtualNetworkInterfaceOptions : The CreateVirtualNetworkInterface options. +type CreateVirtualNetworkInterfaceOptions 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"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. Must be `false` if the virtual network interface is unbound. + AutoDelete *bool `json:"auto_delete,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"` + + // 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"` + + // 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 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"` + + // 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 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVirtualNetworkInterfaceOptions : Instantiate CreateVirtualNetworkInterfaceOptions +func (*VpcV1) NewCreateVirtualNetworkInterfaceOptions() *CreateVirtualNetworkInterfaceOptions { + return &CreateVirtualNetworkInterfaceOptions{} +} + +// SetAllowIPSpoofing : Allow user to set AllowIPSpoofing +func (_options *CreateVirtualNetworkInterfaceOptions) SetAllowIPSpoofing(allowIPSpoofing bool) *CreateVirtualNetworkInterfaceOptions { + _options.AllowIPSpoofing = core.BoolPtr(allowIPSpoofing) + return _options +} + +// SetAutoDelete : Allow user to set AutoDelete +func (_options *CreateVirtualNetworkInterfaceOptions) SetAutoDelete(autoDelete bool) *CreateVirtualNetworkInterfaceOptions { + _options.AutoDelete = core.BoolPtr(autoDelete) + return _options +} + +// SetEnableInfrastructureNat : Allow user to set EnableInfrastructureNat +func (_options *CreateVirtualNetworkInterfaceOptions) SetEnableInfrastructureNat(enableInfrastructureNat bool) *CreateVirtualNetworkInterfaceOptions { + _options.EnableInfrastructureNat = core.BoolPtr(enableInfrastructureNat) + return _options +} + +// SetIps : Allow user to set Ips +func (_options *CreateVirtualNetworkInterfaceOptions) SetIps(ips []VirtualNetworkInterfaceIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { + _options.Ips = ips + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVirtualNetworkInterfaceOptions) SetName(name string) *CreateVirtualNetworkInterfaceOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPrimaryIP : Allow user to set PrimaryIP +func (_options *CreateVirtualNetworkInterfaceOptions) SetPrimaryIP(primaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { + _options.PrimaryIP = primaryIP + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateVirtualNetworkInterfaceOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVirtualNetworkInterfaceOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateVirtualNetworkInterfaceOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateVirtualNetworkInterfaceOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetSubnet : Allow user to set Subnet +func (_options *CreateVirtualNetworkInterfaceOptions) SetSubnet(subnet SubnetIdentityIntf) *CreateVirtualNetworkInterfaceOptions { + _options.Subnet = subnet + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateVirtualNetworkInterfaceOptions { + options.Headers = param + return options +} + // CreateVolumeOptions : The CreateVolume options. type CreateVolumeOptions struct { // The volume prototype object. @@ -32329,6 +35028,13 @@ type CreateVPCRouteOptions struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // All routes in a routing table with the same `destination` and `zone` must have the same + // `advertise` value. + Advertise *bool `json:"advertise,omitempty"` + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of // randomly-selected words. @@ -32398,6 +35104,12 @@ func (_options *CreateVPCRouteOptions) SetAction(action string) *CreateVPCRouteO return _options } +// SetAdvertise : Allow user to set Advertise +func (_options *CreateVPCRouteOptions) SetAdvertise(advertise bool) *CreateVPCRouteOptions { + _options.Advertise = core.BoolPtr(advertise) + return _options +} + // SetName : Allow user to set Name func (_options *CreateVPCRouteOptions) SetName(name string) *CreateVPCRouteOptions { _options.Name = core.StringPtr(name) @@ -32433,6 +35145,10 @@ type CreateVPCRoutingTableOptions struct { // support is expected to expand in the future. 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 + // sources. + AdvertiseRoutesTo []string `json:"advertise_routes_to,omitempty"` + // The name for this routing table. The name must not be used by another routing table in the VPC. If unspecified, the // name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -32490,6 +35206,16 @@ type CreateVPCRoutingTableOptions struct { Headers map[string]string } +// Constants associated with the CreateVPCRoutingTableOptions.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + CreateVPCRoutingTableOptionsAdvertiseRoutesToDirectLinkConst = "direct_link" + CreateVPCRoutingTableOptionsAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + // NewCreateVPCRoutingTableOptions : Instantiate CreateVPCRoutingTableOptions func (*VpcV1) NewCreateVPCRoutingTableOptions(vpcID string) *CreateVPCRoutingTableOptions { return &CreateVPCRoutingTableOptions{ @@ -32509,6 +35235,12 @@ func (_options *CreateVPCRoutingTableOptions) SetAcceptRoutesFrom(acceptRoutesFr return _options } +// SetAdvertiseRoutesTo : Allow user to set AdvertiseRoutesTo +func (_options *CreateVPCRoutingTableOptions) SetAdvertiseRoutesTo(advertiseRoutesTo []string) *CreateVPCRoutingTableOptions { + _options.AdvertiseRoutesTo = advertiseRoutesTo + return _options +} + // SetName : Allow user to set Name func (_options *CreateVPCRoutingTableOptions) SetName(name string) *CreateVPCRoutingTableOptions { _options.Name = core.StringPtr(name) @@ -32576,6 +35308,13 @@ type CreateVPCRoutingTableRouteOptions struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // All routes in a routing table with the same `destination` and `zone` must have the same + // `advertise` value. + Advertise *bool `json:"advertise,omitempty"` + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of // randomly-selected words. @@ -32652,6 +35391,12 @@ func (_options *CreateVPCRoutingTableRouteOptions) SetAction(action string) *Cre return _options } +// SetAdvertise : Allow user to set Advertise +func (_options *CreateVPCRoutingTableRouteOptions) SetAdvertise(advertise bool) *CreateVPCRoutingTableRouteOptions { + _options.Advertise = core.BoolPtr(advertise) + return _options +} + // SetName : Allow user to set Name func (_options *CreateVPCRoutingTableRouteOptions) SetName(name string) *CreateVPCRoutingTableRouteOptions { _options.Name = core.StringPtr(name) @@ -35049,6 +37794,14 @@ type DefaultRoutingTable struct { // support is expected to expand 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 + // sources. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` + // The date and time that this routing table was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -35117,6 +37870,16 @@ type DefaultRoutingTable struct { Subnets []SubnetReference `json:"subnets" validate:"required"` } +// Constants associated with the DefaultRoutingTable.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + DefaultRoutingTableAdvertiseRoutesToDirectLinkConst = "direct_link" + DefaultRoutingTableAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + // Constants associated with the DefaultRoutingTable.LifecycleState property. // The lifecycle state of the routing table. const ( @@ -35142,6 +37905,10 @@ func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -35358,6 +38125,44 @@ func (options *DeleteBackupPolicyPlanOptions) SetHeaders(param map[string]string return options } +// DeleteBareMetalServerNetworkAttachmentOptions : The DeleteBareMetalServerNetworkAttachment options. +type DeleteBareMetalServerNetworkAttachmentOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteBareMetalServerNetworkAttachmentOptions : Instantiate DeleteBareMetalServerNetworkAttachmentOptions +func (*VpcV1) NewDeleteBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string) *DeleteBareMetalServerNetworkAttachmentOptions { + return &DeleteBareMetalServerNetworkAttachmentOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *DeleteBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *DeleteBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteBareMetalServerNetworkAttachmentOptions) SetID(id string) *DeleteBareMetalServerNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerNetworkAttachmentOptions { + options.Headers = param + return options +} + // DeleteBareMetalServerNetworkInterfaceOptions : The DeleteBareMetalServerNetworkInterface options. type DeleteBareMetalServerNetworkInterfaceOptions struct { // The bare metal server identifier. @@ -35914,6 +38719,44 @@ func (options *DeleteInstanceGroupOptions) SetHeaders(param map[string]string) * return options } +// DeleteInstanceNetworkAttachmentOptions : The DeleteInstanceNetworkAttachment options. +type DeleteInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceNetworkAttachmentOptions : Instantiate DeleteInstanceNetworkAttachmentOptions +func (*VpcV1) NewDeleteInstanceNetworkAttachmentOptions(instanceID string, id string) *DeleteInstanceNetworkAttachmentOptions { + return &DeleteInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *DeleteInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceNetworkAttachmentOptions) SetID(id string) *DeleteInstanceNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + // DeleteInstanceNetworkInterfaceOptions : The DeleteInstanceNetworkInterface options. type DeleteInstanceNetworkInterfaceOptions struct { // The virtual server instance identifier. @@ -36895,6 +39738,34 @@ func (options *DeleteSubnetReservedIPOptions) SetHeaders(param map[string]string return options } +// DeleteVirtualNetworkInterfacesOptions : The DeleteVirtualNetworkInterfaces options. +type DeleteVirtualNetworkInterfacesOptions struct { + // The virtual network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVirtualNetworkInterfacesOptions : Instantiate DeleteVirtualNetworkInterfacesOptions +func (*VpcV1) NewDeleteVirtualNetworkInterfacesOptions(id string) *DeleteVirtualNetworkInterfacesOptions { + return &DeleteVirtualNetworkInterfacesOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVirtualNetworkInterfacesOptions) SetID(id string) *DeleteVirtualNetworkInterfacesOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVirtualNetworkInterfacesOptions) SetHeaders(param map[string]string) *DeleteVirtualNetworkInterfacesOptions { + options.Headers = param + return options +} + // DeleteVolumeOptions : The DeleteVolume options. type DeleteVolumeOptions struct { // The volume identifier. @@ -38333,6 +41204,98 @@ func UnmarshalFloatingIPCollectionNext(m map[string]json.RawMessage, result inte return } +// FloatingIPCollectionVirtualNetworkInterfaceContext : FloatingIPCollectionVirtualNetworkInterfaceContext struct +type FloatingIPCollectionVirtualNetworkInterfaceContext struct { + // A link to the first page of resources. + First *FloatingIPCollectionVirtualNetworkInterfaceContextFirst `json:"first" validate:"required"` + + // Collection of floating IPs bound to the virtual network interface specified by the identifier in the URL. + FloatingIps []FloatingIPReference `json:"floating_ips" 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 *FloatingIPCollectionVirtualNetworkInterfaceContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *FloatingIPCollectionVirtualNetworkInterfaceContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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. @@ -38346,6 +41309,7 @@ type FloatingIPPatch struct { // // - an instance network interface // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` + // - a virtual network interface with `enable_infrastructure_nat` set to `true` // // Specify `null` to remove an existing binding. Target FloatingIPTargetPatchIntf `json:"target,omitempty"` @@ -38398,7 +41362,8 @@ type FloatingIPPrototype struct { // resource is: // // - an instance network interface - // - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. + // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` + // - a virtual network interface with `enable_infrastructure_nat` set to `true`. Target FloatingIPTargetPrototypeIntf `json:"target,omitempty"` } @@ -38509,15 +41474,25 @@ func UnmarshalFloatingIPReferenceDeleted(m map[string]json.RawMessage, result in // - FloatingIPTargetNetworkInterfaceReference // - FloatingIPTargetBareMetalServerNetworkInterfaceReference // - FloatingIPTargetPublicGatewayReference +// - FloatingIPTargetVirtualNetworkInterfaceReference type FloatingIPTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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,omitempty"` // The name for this instance network interface. @@ -38530,6 +41505,9 @@ type FloatingIPTarget struct { // The CRN for this public gateway. CRN *string `json:"crn,omitempty"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet,omitempty"` } // Constants associated with the FloatingIPTarget.ResourceType property. @@ -38577,6 +41555,10 @@ func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -38588,17 +41570,31 @@ func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) // // - an instance network interface // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` +// - a virtual network interface with `enable_infrastructure_nat` set to `true` // // Specify `null` to remove an existing binding. // Models which "extend" this model: // - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity // - FloatingIPTargetPatchNetworkInterfaceIdentity +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentity type FloatingIPTargetPatch struct { // 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=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,omitempty"` // 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=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` } func (*FloatingIPTargetPatch) isaFloatingIPTargetPatch() bool { @@ -38620,6 +41616,10 @@ func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interfa if err != nil { return } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -38629,16 +41629,30 @@ func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interfa // The target resource must not already have a floating IP bound to it if the target resource is: // // - an instance network interface -// - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. +// - a bare metal server network interface with `enable_infrastructure_nat` set to `true` +// - a virtual network interface with `enable_infrastructure_nat` set to `true`. // Models which "extend" this model: // - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity // - FloatingIPTargetPrototypeNetworkInterfaceIdentity +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity type FloatingIPTargetPrototype struct { // 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=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,omitempty"` // 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=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` } func (*FloatingIPTargetPrototype) isaFloatingIPTargetPrototype() bool { @@ -38660,6 +41674,10 @@ func UnmarshalFloatingIPTargetPrototype(m map[string]json.RawMessage, result int if err != nil { return } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -38717,17 +41735,23 @@ type FlowLogCollector struct { StorageBucket *LegacyCloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` // The target this collector is collecting flow logs for. + // - If the target is an instance network attachment, flow logs will be collected + // for that instance network attachment. // - If the target is an instance network interface, flow logs will be collected // for that instance network interface. + // - If the target is a virtual network interface, flow logs will be collected for the + // the virtual network interface's `target` resource if the resource is: + // - an instance network attachment // - If the target is a virtual server instance, flow logs will be collected - // for all network interfaces on that instance. + // for all network attachments or network interfaces on that instance. // - If the target is a subnet, flow logs will be collected - // for all instance network interfaces attached to that subnet. - // - If the target is a VPC, flow logs will be collected for instance network interfaces - // attached to all subnets within that VPC. + // for all instance network interfaces and virtual network interfaces + // attached to that subnet. + // - If the target is a VPC, flow logs will be collected for all instance network + // interfaces and virtual network interfaces attached to all subnets within that VPC. // If the target is an instance, subnet, or VPC, flow logs will not be collected - // for any instance network interfaces within the target that are themselves the target of - // a more specific flow log collector. + // for any instance network attachments or instance network interfaces within the target + // that are themselves the target of a more specific flow log collector. Target FlowLogCollectorTargetIntf `json:"target" validate:"required"` // The VPC this flow log collector resides in. @@ -38929,31 +41953,48 @@ func (flowLogCollectorPatch *FlowLogCollectorPatch) AsPatch() (_patch map[string } // FlowLogCollectorTarget : The target this collector is collecting flow logs for. +// - If the target is an instance network attachment, flow logs will be collected +// for that instance network attachment. // - If the target is an instance network interface, flow logs will be collected // for that instance network interface. +// - If the target is a virtual network interface, flow logs will be collected for the +// the virtual network interface's `target` resource if the resource is: +// - an instance network attachment // - If the target is a virtual server instance, flow logs will be collected -// for all network interfaces on that instance. +// for all network attachments or network interfaces on that instance. // - If the target is a subnet, flow logs will be collected -// for all instance network interfaces attached to that subnet. -// - If the target is a VPC, flow logs will be collected for instance network interfaces -// attached to all subnets within that VPC. If the target is an instance, subnet, or VPC, flow logs will not be +// for all instance network interfaces and virtual network interfaces +// attached to that subnet. +// - If the target is a VPC, flow logs will be collected for all instance network +// interfaces and virtual network interfaces attached to all subnets within that VPC. If the target is an instance, // -// collected for any instance network interfaces within the target that are themselves the target of a more specific -// flow log collector. +// subnet, or VPC, flow logs will not be collected for any instance network attachments or instance network interfaces +// within the target that are themselves the target of a more specific flow log collector. // Models which "extend" this model: // - FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext // - FlowLogCollectorTargetInstanceReference // - FlowLogCollectorTargetSubnetReference // - FlowLogCollectorTargetVPCReference +// - FlowLogCollectorTargetInstanceNetworkAttachmentReference +// - FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext type FlowLogCollectorTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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,omitempty"` // The name for this instance network interface. @@ -38964,6 +42005,13 @@ type FlowLogCollectorTarget struct { // The CRN for this virtual server instance. CRN *string `json:"crn,omitempty"` + + // The primary IP address of the virtual network interface for the instance network + // attachment. + PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` + + // The subnet of the virtual network interface for the instance network attachment. + Subnet *SubnetReference `json:"subnet,omitempty"` } // Constants associated with the FlowLogCollectorTarget.ResourceType property. @@ -39007,23 +42055,47 @@ func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interf if err != nil { return } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// FlowLogCollectorTargetPrototype : The target this collector will collect flow logs for. If the target is an instance, subnet, or VPC, flow logs will -// not be collected for any instance network interfaces within the target that are themselves the target of a more +// FlowLogCollectorTargetPrototype : The target this collector will collect flow logs for. +// +// If the target is an instance, subnet, or VPC, flow logs will not be collected for any instance network attachments, +// virtual network interfaces or instance network interfaces within the target that are themselves the target of a more // specific flow log collector. +// +// The target must not be a virtual network interface that is attached to a bare metal server network attachment or to a +// file share mount target. // Models which "extend" this model: // - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity // - FlowLogCollectorTargetPrototypeInstanceIdentity // - FlowLogCollectorTargetPrototypeSubnetIdentity // - FlowLogCollectorTargetPrototypeVPCIdentity +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity type FlowLogCollectorTargetPrototype struct { // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` // The CRN for this virtual server instance. @@ -39245,6 +42317,44 @@ func (options *GetBareMetalServerInitializationOptions) SetHeaders(param map[str return options } +// GetBareMetalServerNetworkAttachmentOptions : The GetBareMetalServerNetworkAttachment options. +type GetBareMetalServerNetworkAttachmentOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerNetworkAttachmentOptions : Instantiate GetBareMetalServerNetworkAttachmentOptions +func (*VpcV1) NewGetBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string) *GetBareMetalServerNetworkAttachmentOptions { + return &GetBareMetalServerNetworkAttachmentOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *GetBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerNetworkAttachmentOptions) SetID(id string) *GetBareMetalServerNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkAttachmentOptions { + options.Headers = param + return options +} + // GetBareMetalServerNetworkInterfaceFloatingIPOptions : The GetBareMetalServerNetworkInterfaceFloatingIP options. type GetBareMetalServerNetworkInterfaceFloatingIPOptions struct { // The bare metal server identifier. @@ -40039,6 +43149,44 @@ func (options *GetInstanceInitializationOptions) SetHeaders(param map[string]str return options } +// GetInstanceNetworkAttachmentOptions : The GetInstanceNetworkAttachment options. +type GetInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceNetworkAttachmentOptions : Instantiate GetInstanceNetworkAttachmentOptions +func (*VpcV1) NewGetInstanceNetworkAttachmentOptions(instanceID string, id string) *GetInstanceNetworkAttachmentOptions { + return &GetInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceNetworkAttachmentOptions) SetID(id string) *GetInstanceNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + // GetInstanceNetworkInterfaceFloatingIPOptions : The GetInstanceNetworkInterfaceFloatingIP options. type GetInstanceNetworkInterfaceFloatingIPOptions struct { // The virtual server instance identifier. @@ -40731,6 +43879,44 @@ func (options *GetNetworkACLRuleOptions) SetHeaders(param map[string]string) *Ge return options } +// GetNetworkInterfaceFloatingIPOptions : The GetNetworkInterfaceFloatingIP options. +type GetNetworkInterfaceFloatingIPOptions 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 +} + +// NewGetNetworkInterfaceFloatingIPOptions : Instantiate GetNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewGetNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *GetNetworkInterfaceFloatingIPOptions { + return &GetNetworkInterfaceFloatingIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *GetNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *GetNetworkInterfaceFloatingIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetNetworkInterfaceFloatingIPOptions) SetID(id string) *GetNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + // GetOperatingSystemOptions : The GetOperatingSystem options. type GetOperatingSystemOptions struct { // The operating system name. @@ -41351,6 +44537,44 @@ func (options *GetSubnetRoutingTableOptions) SetHeaders(param map[string]string) return options } +// GetVirtualNetworkInterfaceIPOptions : The GetVirtualNetworkInterfaceIP options. +type GetVirtualNetworkInterfaceIPOptions 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 +} + +// NewGetVirtualNetworkInterfaceIPOptions : Instantiate GetVirtualNetworkInterfaceIPOptions +func (*VpcV1) NewGetVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *GetVirtualNetworkInterfaceIPOptions { + return &GetVirtualNetworkInterfaceIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *GetVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *GetVirtualNetworkInterfaceIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVirtualNetworkInterfaceIPOptions) SetID(id string) *GetVirtualNetworkInterfaceIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetVirtualNetworkInterfaceIPOptions { + options.Headers = param + return options +} + // GetVirtualNetworkInterfaceOptions : The GetVirtualNetworkInterface options. type GetVirtualNetworkInterfaceOptions struct { // The virtual network interface identifier. @@ -43883,8 +47107,8 @@ type Instance struct { // The availability policy for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicy `json:"availability_policy" validate:"required"` - // The total bandwidth (in megabits per second) shared across the instance network interfaces and storage volumes of - // virtual server instance. + // The total bandwidth (in megabits per second) shared across the instance network attachments or instance network + // interfaces and storage volumes of the virtual server instance. Bandwidth *int64 `json:"bandwidth" validate:"required"` // Boot volume attachment. @@ -43937,7 +47161,14 @@ type Instance struct { // The name for this virtual server instance. The name is unique across all virtual server instances in the region. Name *string `json:"name" validate:"required"` + // The network attachments for this virtual server instance, including the primary network attachment. + NetworkAttachments []InstanceNetworkAttachmentReference `json:"network_attachments" validate:"required"` + // The network interfaces for this instance, including the primary network interface. + // + // If this instance has network attachments, each network interface is a [read-only + // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment + // and its attached virtual network interface. NetworkInterfaces []NetworkInterfaceInstanceContextReference `json:"network_interfaces" validate:"required"` // The number of NUMA nodes this virtual server instance is provisioned on. @@ -43948,7 +47179,15 @@ type Instance struct { // The placement restrictions for the virtual server instance. PlacementTarget InstancePlacementTargetIntf `json:"placement_target,omitempty"` + // The primary network attachment for this virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` + // The primary network interface for this virtual server instance. + // + // If this instance has network attachments, this primary network interface is a + // [read-only + // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) + // of the primary network attachment and its attached virtual network interface. PrimaryNetworkInterface *NetworkInterfaceInstanceContextReference `json:"primary_network_interface" validate:"required"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this virtual @@ -43978,7 +47217,8 @@ type Instance struct { // unexpected reason code was encountered. StatusReasons []InstanceStatusReason `json:"status_reasons" validate:"required"` - // The amount of bandwidth (in megabits per second) allocated exclusively to instance network interfaces. + // The amount of bandwidth (in megabits per second) allocated exclusively to instance network attachments or instance + // network interfaces. TotalNetworkBandwidth *int64 `json:"total_network_bandwidth" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -44105,6 +47345,10 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentReference) + if err != nil { + return + } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceInstanceContextReference) if err != nil { return @@ -44117,6 +47361,10 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er if err != nil { return } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentReference) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceInstanceContextReference) if err != nil { return @@ -47074,6 +50322,428 @@ func UnmarshalInstanceMetadataServicePrototype(m map[string]json.RawMessage, res return } +// InstanceNetworkAttachment : InstanceNetworkAttachment struct +type InstanceNetworkAttachment struct { + // The date and time that the instance network attachment was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the instance network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this instance network attachment. The name is unique across all network attachments for the instance. + Name *string `json:"name" validate:"required"` + + // The port speed for this instance network attachment in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + // The primary IP address of the virtual network interface for the instance 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 instance network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The instance network attachment type. + Type *string `json:"type" validate:"required"` + + // The virtual network interface for this instance network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` +} + +// Constants associated with the InstanceNetworkAttachment.LifecycleState property. +// The lifecycle state of the instance network attachment. +const ( + InstanceNetworkAttachmentLifecycleStateDeletingConst = "deleting" + InstanceNetworkAttachmentLifecycleStateFailedConst = "failed" + InstanceNetworkAttachmentLifecycleStatePendingConst = "pending" + InstanceNetworkAttachmentLifecycleStateStableConst = "stable" + InstanceNetworkAttachmentLifecycleStateSuspendedConst = "suspended" + InstanceNetworkAttachmentLifecycleStateUpdatingConst = "updating" + InstanceNetworkAttachmentLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the InstanceNetworkAttachment.ResourceType property. +// The resource type. +const ( + InstanceNetworkAttachmentResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" +) + +// Constants associated with the InstanceNetworkAttachment.Type property. +// The instance network attachment type. +const ( + InstanceNetworkAttachmentTypePrimaryConst = "primary" + InstanceNetworkAttachmentTypeSecondaryConst = "secondary" +) + +// UnmarshalInstanceNetworkAttachment unmarshals an instance of InstanceNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachment) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentCollection : InstanceNetworkAttachmentCollection struct +type InstanceNetworkAttachmentCollection struct { + // Collection of instance network attachments. + NetworkAttachments []InstanceNetworkAttachment `json:"network_attachments" validate:"required"` +} + +// UnmarshalInstanceNetworkAttachmentCollection unmarshals an instance of InstanceNetworkAttachmentCollection from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentCollection) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPatch : InstanceNetworkAttachmentPatch struct +type InstanceNetworkAttachmentPatch struct { + // The name for this network attachment. The name must not be used by another network attachment for the instance. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceNetworkAttachmentPatch unmarshals an instance of InstanceNetworkAttachmentPatch from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceNetworkAttachmentPrototype : InstanceNetworkAttachmentPrototype struct +type InstanceNetworkAttachmentPrototype struct { + // The name for this network attachment. Names must be unique within the instance 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 instance 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, `enable_infrastructure_nat` must be + // `true`. + VirtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototype : Instantiate InstanceNetworkAttachmentPrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototype(virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) (_model *InstanceNetworkAttachmentPrototype, err error) { + _model = &InstanceNetworkAttachmentPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalInstanceNetworkAttachmentPrototype unmarshals an instance of InstanceNetworkAttachmentPrototype from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterface : A virtual network interface for the instance 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, `enable_infrastructure_nat` must be +// `true`. +// Models which "extend" this model: +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterface 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"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,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"` + + // 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"` + + // 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 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"` + + // The resource group to use for this virtual network interface. If unspecified, the + // virtual server instance's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,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"` +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface { + isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentReference : InstanceNetworkAttachmentReference struct +type InstanceNetworkAttachmentReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` + + // The name for this instance network attachment. The name is unique across all network attachments for the instance. + Name *string `json:"name" validate:"required"` + + // The primary IP address of the virtual network interface for the instance 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 instance network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the InstanceNetworkAttachmentReference.ResourceType property. +// The resource type. +const ( + InstanceNetworkAttachmentReferenceResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" +) + +// UnmarshalInstanceNetworkAttachmentReference unmarshals an instance of InstanceNetworkAttachmentReference from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceNetworkAttachmentReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceNetworkAttachmentReferenceDeleted unmarshals an instance of InstanceNetworkAttachmentReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstancePatch : InstancePatch struct type InstancePatch struct { // The availability policy for this virtual server instance. @@ -47100,7 +50770,8 @@ type InstancePatch struct { // instance is placed on a dedicated host, the requested profile `family` must be // the same as the dedicated host `family`. // - Have the same `vcpu.architecture`. - // - Support the number of network interfaces the instance currently has. + // - Support the number of network attachments or network interfaces the instance + // currently has. Profile InstancePatchProfileIntf `json:"profile,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -47159,7 +50830,8 @@ func (instancePatch *InstancePatch) AsPatch() (_patch map[string]interface{}, er // instance is placed on a dedicated host, the requested profile `family` must be // the same as the dedicated host `family`. // - Have the same `vcpu.architecture`. -// - Support the number of network interfaces the instance currently has. +// - Support the number of network attachments or network interfaces the instance +// currently has. // // Models which "extend" this model: // - InstancePatchProfileInstanceProfileIdentityByName @@ -47377,6 +51049,8 @@ type InstanceProfile struct { // The globally unique name for this virtual server instance profile. Name *string `json:"name" validate:"required"` + NetworkAttachmentCount InstanceProfileNetworkAttachmentCountIntf `json:"network_attachment_count" validate:"required"` + NetworkInterfaceCount InstanceProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` NumaCount InstanceProfileNumaCountIntf `json:"numa_count,omitempty"` @@ -47471,6 +51145,10 @@ func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalInstanceProfileNetworkAttachmentCount) + if err != nil { + return + } err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalInstanceProfileNetworkInterfaceCount) if err != nil { return @@ -48223,6 +51901,54 @@ func UnmarshalInstanceProfileNumaCount(m map[string]json.RawMessage, result inte return } +// InstanceProfileNetworkAttachmentCount : InstanceProfileNetworkAttachmentCount struct +// Models which "extend" this model: +// - InstanceProfileNetworkAttachmentCountRange +// - InstanceProfileNetworkAttachmentCountDependent +type InstanceProfileNetworkAttachmentCount 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 InstanceProfileNetworkAttachmentCount.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkAttachmentCountTypeRangeConst = "range" +) + +func (*InstanceProfileNetworkAttachmentCount) isaInstanceProfileNetworkAttachmentCount() bool { + return true +} + +type InstanceProfileNetworkAttachmentCountIntf interface { + isaInstanceProfileNetworkAttachmentCount() bool +} + +// UnmarshalInstanceProfileNetworkAttachmentCount unmarshals an instance of InstanceProfileNetworkAttachmentCount from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkAttachmentCount) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceProfileNetworkInterfaceCount : InstanceProfileNetworkInterfaceCount struct // Models which "extend" this model: // - InstanceProfileNetworkInterfaceCountRange @@ -48674,7 +52400,7 @@ type InstancePrototype struct { // The VPC this virtual server instance will reside in. // // If specified, it must match the VPC for the subnets of the instance network - // interfaces. + // attachments or instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -48692,6 +52418,12 @@ type InstancePrototype struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone,omitempty"` + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering // or offering version to use when provisioning this virtual server instance. // @@ -48785,6 +52517,14 @@ func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{} if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { return @@ -48984,7 +52724,7 @@ type InstanceTemplate struct { // The VPC this virtual server instance will reside in. // // If specified, it must match the VPC for the subnets of the instance network - // interfaces. + // attachments or instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -49002,6 +52742,12 @@ type InstanceTemplate struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone,omitempty"` + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering // or offering version to use when provisioning this virtual server instance. // @@ -49108,6 +52854,14 @@ func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { return @@ -49334,7 +53088,7 @@ type InstanceTemplatePrototype struct { // The VPC this virtual server instance will reside in. // // If specified, it must match the VPC for the subnets of the instance network - // interfaces. + // attachments or instance network interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -49352,6 +53106,12 @@ type InstanceTemplatePrototype struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone,omitempty"` + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) // offering version to use when provisioning this virtual server instance. // If an offering is specified, the latest version of that offering will be used. @@ -49446,6 +53206,14 @@ func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result int if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { return @@ -50178,6 +53946,52 @@ func (options *ListBareMetalServerDisksOptions) SetHeaders(param map[string]stri return options } +// ListBareMetalServerNetworkAttachmentsOptions : The ListBareMetalServerNetworkAttachments options. +type ListBareMetalServerNetworkAttachmentsOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_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 +} + +// NewListBareMetalServerNetworkAttachmentsOptions : Instantiate ListBareMetalServerNetworkAttachmentsOptions +func (*VpcV1) NewListBareMetalServerNetworkAttachmentsOptions(bareMetalServerID string) *ListBareMetalServerNetworkAttachmentsOptions { + return &ListBareMetalServerNetworkAttachmentsOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkAttachmentsOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetStart(start string) *ListBareMetalServerNetworkAttachmentsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetLimit(limit int64) *ListBareMetalServerNetworkAttachmentsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkAttachmentsOptions { + options.Headers = param + return options +} + // ListBareMetalServerNetworkInterfaceFloatingIpsOptions : The ListBareMetalServerNetworkInterfaceFloatingIps options. type ListBareMetalServerNetworkInterfaceFloatingIpsOptions struct { // The bare metal server identifier. @@ -50784,6 +54598,18 @@ type ListFloatingIpsOptions struct { // 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 resources with a `target.id` property matching the specified identifier. + TargetID *string `json:"target.id,omitempty"` + + // Filters the collection to resources with a `target.crn` property matching the specified CRN. + TargetCRN *string `json:"target.crn,omitempty"` + + // Filters the collection to resources with a `target.name` property matching the exact specified name. + TargetName *string `json:"target.name,omitempty"` + + // 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 Headers map[string]string } @@ -50826,6 +54652,30 @@ func (_options *ListFloatingIpsOptions) SetSort(sort string) *ListFloatingIpsOpt return _options } +// SetTargetID : Allow user to set TargetID +func (_options *ListFloatingIpsOptions) SetTargetID(targetID string) *ListFloatingIpsOptions { + _options.TargetID = core.StringPtr(targetID) + return _options +} + +// SetTargetCRN : Allow user to set TargetCRN +func (_options *ListFloatingIpsOptions) SetTargetCRN(targetCRN string) *ListFloatingIpsOptions { + _options.TargetCRN = core.StringPtr(targetCRN) + return _options +} + +// SetTargetName : Allow user to set TargetName +func (_options *ListFloatingIpsOptions) SetTargetName(targetName string) *ListFloatingIpsOptions { + _options.TargetName = core.StringPtr(targetName) + return _options +} + +// SetTargetResourceType : Allow user to set TargetResourceType +func (_options *ListFloatingIpsOptions) SetTargetResourceType(targetResourceType string) *ListFloatingIpsOptions { + _options.TargetResourceType = core.StringPtr(targetResourceType) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListFloatingIpsOptions) SetHeaders(param map[string]string) *ListFloatingIpsOptions { options.Headers = param @@ -51386,6 +55236,34 @@ func (options *ListInstanceGroupsOptions) SetHeaders(param map[string]string) *L return options } +// ListInstanceNetworkAttachmentsOptions : The ListInstanceNetworkAttachments options. +type ListInstanceNetworkAttachmentsOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceNetworkAttachmentsOptions : Instantiate ListInstanceNetworkAttachmentsOptions +func (*VpcV1) NewListInstanceNetworkAttachmentsOptions(instanceID string) *ListInstanceNetworkAttachmentsOptions { + return &ListInstanceNetworkAttachmentsOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceNetworkAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkAttachmentsOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkAttachmentsOptions { + options.Headers = param + return options +} + // ListInstanceNetworkInterfaceFloatingIpsOptions : The ListInstanceNetworkInterfaceFloatingIps options. type ListInstanceNetworkInterfaceFloatingIpsOptions struct { // The virtual server instance identifier. @@ -52163,6 +56041,74 @@ func (options *ListNetworkAclsOptions) SetHeaders(param map[string]string) *List return options } +// ListNetworkInterfaceFloatingIpsOptions : The ListNetworkInterfaceFloatingIps options. +type ListNetworkInterfaceFloatingIpsOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_network_interface_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"` + + // 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 + // `-name` sorts the collection by the `name` 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 ListNetworkInterfaceFloatingIpsOptions.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 +// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` +// property in ascending order. +const ( + ListNetworkInterfaceFloatingIpsOptionsSortAddressConst = "address" + ListNetworkInterfaceFloatingIpsOptionsSortNameConst = "name" +) + +// NewListNetworkInterfaceFloatingIpsOptions : Instantiate ListNetworkInterfaceFloatingIpsOptions +func (*VpcV1) NewListNetworkInterfaceFloatingIpsOptions(virtualNetworkInterfaceID string) *ListNetworkInterfaceFloatingIpsOptions { + return &ListNetworkInterfaceFloatingIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *ListNetworkInterfaceFloatingIpsOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetStart(start string) *ListNetworkInterfaceFloatingIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetLimit(limit int64) *ListNetworkInterfaceFloatingIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetSort(sort string) *ListNetworkInterfaceFloatingIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListNetworkInterfaceFloatingIpsOptions { + options.Headers = param + return options +} + // ListOperatingSystemsOptions : The ListOperatingSystems options. type ListOperatingSystemsOptions struct { // A server-provided token determining what resource to start the page on. @@ -53038,6 +56984,18 @@ type ListSubnetReservedIpsOptions struct { // 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 resources with a `target.id` property matching the specified identifier. + TargetID *string `json:"target.id,omitempty"` + + // Filters the collection to resources with a `target.crn` property matching the specified CRN. + TargetCRN *string `json:"target.crn,omitempty"` + + // Filters the collection to resources with a `target.name` property matching the exact specified name. + TargetName *string `json:"target.name,omitempty"` + + // 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 Headers map[string]string } @@ -53083,6 +57041,30 @@ func (_options *ListSubnetReservedIpsOptions) SetSort(sort string) *ListSubnetRe return _options } +// SetTargetID : Allow user to set TargetID +func (_options *ListSubnetReservedIpsOptions) SetTargetID(targetID string) *ListSubnetReservedIpsOptions { + _options.TargetID = core.StringPtr(targetID) + return _options +} + +// SetTargetCRN : Allow user to set TargetCRN +func (_options *ListSubnetReservedIpsOptions) SetTargetCRN(targetCRN string) *ListSubnetReservedIpsOptions { + _options.TargetCRN = core.StringPtr(targetCRN) + return _options +} + +// SetTargetName : Allow user to set TargetName +func (_options *ListSubnetReservedIpsOptions) SetTargetName(targetName string) *ListSubnetReservedIpsOptions { + _options.TargetName = core.StringPtr(targetName) + return _options +} + +// SetTargetResourceType : Allow user to set TargetResourceType +func (_options *ListSubnetReservedIpsOptions) SetTargetResourceType(targetResourceType string) *ListSubnetReservedIpsOptions { + _options.TargetResourceType = core.StringPtr(targetResourceType) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListSubnetReservedIpsOptions) SetHeaders(param map[string]string) *ListSubnetReservedIpsOptions { options.Headers = param @@ -53187,6 +57169,74 @@ func (options *ListSubnetsOptions) SetHeaders(param map[string]string) *ListSubn return options } +// ListVirtualNetworkInterfaceIpsOptions : The ListVirtualNetworkInterfaceIps options. +type ListVirtualNetworkInterfaceIpsOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_network_interface_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"` + + // 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 + // `-name` sorts the collection by the `name` 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 ListVirtualNetworkInterfaceIpsOptions.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 +// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` +// property in ascending order. +const ( + ListVirtualNetworkInterfaceIpsOptionsSortAddressConst = "address" + ListVirtualNetworkInterfaceIpsOptionsSortNameConst = "name" +) + +// NewListVirtualNetworkInterfaceIpsOptions : Instantiate ListVirtualNetworkInterfaceIpsOptions +func (*VpcV1) NewListVirtualNetworkInterfaceIpsOptions(virtualNetworkInterfaceID string) *ListVirtualNetworkInterfaceIpsOptions { + return &ListVirtualNetworkInterfaceIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *ListVirtualNetworkInterfaceIpsOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetStart(start string) *ListVirtualNetworkInterfaceIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetLimit(limit int64) *ListVirtualNetworkInterfaceIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetSort(sort string) *ListVirtualNetworkInterfaceIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVirtualNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListVirtualNetworkInterfaceIpsOptions { + options.Headers = param + return options +} + // ListVirtualNetworkInterfacesOptions : The ListVirtualNetworkInterfaces options. type ListVirtualNetworkInterfacesOptions struct { // A server-provided token determining what resource to start the page on. @@ -59331,24 +63381,56 @@ func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, resul // NetworkInterface : NetworkInterface struct type NetworkInterface struct { // Indicates whether source IP spoofing is allowed on this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 instance network interface was created. + // + // If this instance has network attachments, this network interface was created as a [read-only + // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) when its corresponding network attachment + // was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // The floating IPs associated with this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 name for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 instance network interface port speed in Mbps. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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"` @@ -59357,15 +63439,28 @@ type NetworkInterface struct { ResourceType *string `json:"resource_type" validate:"required"` // The security groups targeting this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 instance network interface. + // + // If this instance 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=vni-old-api-clients). Status *string `json:"status" validate:"required"` // The associated subnet. Subnet *SubnetReference `json:"subnet" validate:"required"` // The instance network interface type. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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"` } @@ -59377,6 +63472,10 @@ const ( // Constants associated with the NetworkInterface.Status property. // The status of the instance network interface. +// +// If this instance 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=vni-old-api-clients). const ( NetworkInterfaceStatusAvailableConst = "available" NetworkInterfaceStatusDeletingConst = "deleting" @@ -59386,6 +63485,10 @@ const ( // Constants associated with the NetworkInterface.Type property. // The instance network interface type. +// +// If this instance has network attachments, this network interface is a +// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 ( NetworkInterfaceTypePrimaryConst = "primary" NetworkInterfaceTypeSecondaryConst = "secondary" @@ -59457,9 +63560,18 @@ type NetworkInterfaceBareMetalServerContextReference struct { Deleted *NetworkInterfaceBareMetalServerContextReferenceDeleted `json:"deleted,omitempty"` // 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=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=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 name for this bare metal server network interface. @@ -59601,9 +63713,18 @@ type NetworkInterfaceInstanceContextReference struct { Deleted *NetworkInterfaceInstanceContextReferenceDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 name for this instance network interface. @@ -59680,6 +63801,11 @@ func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json. // NetworkInterfacePatch : NetworkInterfacePatch struct type NetworkInterfacePatch struct { // Indicates whether source IP spoofing is allowed on this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 name for the instance network interface. The name must not be used by another network interface on the virtual @@ -59715,6 +63841,11 @@ func (networkInterfacePatch *NetworkInterfacePatch) AsPatch() (_patch map[string // NetworkInterfacePrototype : NetworkInterfacePrototype struct type NetworkInterfacePrototype struct { // Indicates whether source IP spoofing is allowed on this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 name for the instance network interface. The name must not be used by another network interface on the virtual @@ -61008,6 +65139,82 @@ func (options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param return options } +// RemoveNetworkInterfaceFloatingIPOptions : The RemoveNetworkInterfaceFloatingIP options. +type RemoveNetworkInterfaceFloatingIPOptions 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 +} + +// NewRemoveNetworkInterfaceFloatingIPOptions : Instantiate RemoveNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewRemoveNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *RemoveNetworkInterfaceFloatingIPOptions { + return &RemoveNetworkInterfaceFloatingIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *RemoveNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *RemoveNetworkInterfaceFloatingIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// RemoveVirtualNetworkInterfaceIPOptions : The RemoveVirtualNetworkInterfaceIP options. +type RemoveVirtualNetworkInterfaceIPOptions 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 +} + +// NewRemoveVirtualNetworkInterfaceIPOptions : Instantiate RemoveVirtualNetworkInterfaceIPOptions +func (*VpcV1) NewRemoveVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *RemoveVirtualNetworkInterfaceIPOptions { + return &RemoveVirtualNetworkInterfaceIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *RemoveVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *RemoveVirtualNetworkInterfaceIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveVirtualNetworkInterfaceIPOptions) SetID(id string) *RemoveVirtualNetworkInterfaceIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *RemoveVirtualNetworkInterfaceIPOptions { + options.Headers = param + return options +} + // RemoveVPNGatewayConnectionLocalCIDROptions : The RemoveVPNGatewayConnectionLocalCIDR options. type RemoveVPNGatewayConnectionLocalCIDROptions struct { // The VPN gateway identifier. @@ -61718,6 +65925,98 @@ func UnmarshalReservedIPCollectionNext(m map[string]json.RawMessage, result inte return } +// ReservedIPCollectionVirtualNetworkInterfaceContext : ReservedIPCollectionVirtualNetworkInterfaceContext struct +type ReservedIPCollectionVirtualNetworkInterfaceContext struct { + // A link to the first page of resources. + First *ReservedIPCollectionVirtualNetworkInterfaceContextFirst `json:"first" validate:"required"` + + // Collection of reserved IPs bound to the virtual network interface specified by the identifier in the URL. + Ips []ReservedIPReference `json:"ips" 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 *ReservedIPCollectionVirtualNetworkInterfaceContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ReservedIPCollectionVirtualNetworkInterfaceContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 @@ -61917,12 +66216,14 @@ func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) // ReservedIPTargetPrototype : The target to bind this reserved IP to. The target must be in the same VPC. // -// At present, only endpoint gateway targets are supported. The endpoint gateway must not be already bound to a -// reserved IP in the subnet's zone. +// The following targets are supported: +// - An endpoint gateway not already bound to a reserved IP in the subnet's zone. +// - A virtual network interface. // // If unspecified, the reserved IP will be created unbound. // Models which "extend" this model: // - ReservedIPTargetPrototypeEndpointGatewayIdentity +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity type ReservedIPTargetPrototype struct { // The unique identifier for this endpoint gateway. ID *string `json:"id,omitempty"` @@ -62074,6 +66375,10 @@ type Route struct { // - `drop`: drop the packet. 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"` @@ -62167,6 +66472,10 @@ func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -62408,6 +66717,10 @@ type RouteCollectionVPCContextRoutesItem struct { // - `drop`: drop the packet. 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"` @@ -62501,6 +66814,10 @@ func UnmarshalRouteCollectionVPCContextRoutesItem(m map[string]json.RawMessage, if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -62747,6 +67064,15 @@ func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{} // RoutePatch : RoutePatch struct type RoutePatch struct { + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // Since all routes in a routing table with the same `destination` and `zone` must have the same `advertise` value, + // this property can only be changed for routes with a unique + // `destination` and `zone` in the routing table. For more information, see [Advertising + // routes](https://cloud.ibm.com/docs/vpc?topic=vpc-about-custom-routes#rt-advertising-routes). + Advertise *bool `json:"advertise,omitempty"` + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` // are reserved for system-provided routes, and are not allowed. Name *string `json:"name,omitempty"` @@ -62769,6 +67095,10 @@ type RoutePatch struct { // UnmarshalRoutePatch unmarshals an instance of RoutePatch from the specified map of raw messages. func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(RoutePatch) + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -62804,6 +67134,13 @@ type RoutePrototype struct { // - `drop`: drop the packet. Action *string `json:"action,omitempty"` + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // All routes in a routing table with the same `destination` and `zone` must have the same + // `advertise` value. + Advertise *bool `json:"advertise,omitempty"` + // The destination CIDR of the route. The host identifier in the CIDR must be zero. // // At most two routes per `zone` in a table can have the same `destination` and @@ -62864,6 +67201,10 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) if err != nil { return @@ -63003,6 +67344,14 @@ type RoutingTable struct { // support is expected to expand 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 + // sources. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` + // The date and time that this routing table was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -63069,6 +67418,16 @@ type RoutingTable struct { Subnets []SubnetReference `json:"subnets" validate:"required"` } +// Constants associated with the RoutingTable.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + RoutingTableAdvertiseRoutesToDirectLinkConst = "direct_link" + RoutingTableAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + // Constants associated with the RoutingTable.LifecycleState property. // The lifecycle state of the routing table. const ( @@ -63094,6 +67453,10 @@ func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (er if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -63288,6 +67651,10 @@ type RoutingTablePatch struct { // support is expected to expand in the future. 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 + // `advertise` enabled will be advertised to these sources. + AdvertiseRoutesTo []string `json:"advertise_routes_to,omitempty"` + // The name for this routing table. The name must not be used by another routing table in the VPC. Name *string `json:"name,omitempty"` @@ -63295,7 +67662,8 @@ type RoutingTablePatch struct { // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to `true` selects this routing table, provided // no other routing table in the VPC already has this property set to `true`, and no subnets are attached to this // routing table. Updating to - // `false` deselects this routing table. + // `false` deselects this routing table, provided `direct_link` is absent from + // `advertise_routes_to`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is @@ -63319,7 +67687,8 @@ type RoutingTablePatch struct { // Indicates whether this routing table is used to route traffic that originates from // [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. Updating to // `true` selects this routing table, provided no other routing table in the VPC already has this property set to - // `true`, and no subnets are attached to this routing table. Updating to `false` deselects this routing table. + // `true`, and no subnets are attached to this routing table. Updating to `false` deselects this routing table, + // provided `transit_gateway` is absent from `advertise_routes_to`. // // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is @@ -63343,6 +67712,16 @@ type RoutingTablePatch struct { RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` } +// Constants associated with the RoutingTablePatch.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + RoutingTablePatchAdvertiseRoutesToDirectLinkConst = "direct_link" + RoutingTablePatchAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + // UnmarshalRoutingTablePatch unmarshals an instance of RoutingTablePatch from the specified map of raw messages. func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(RoutingTablePatch) @@ -63350,6 +67729,10 @@ func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{} if err != nil { return } + err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -64396,9 +68779,18 @@ type SecurityGroupTargetReference struct { Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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,omitempty"` // The name for this instance network interface. @@ -65566,7 +69958,39 @@ func UnmarshalShareMountTargetReferenceDeleted(m map[string]json.RawMessage, res // ShareMountTargetVirtualNetworkInterfacePrototype : ShareMountTargetVirtualNetworkInterfacePrototype struct // Models which "extend" this model: // - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity type ShareMountTargetVirtualNetworkInterfacePrototype 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"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,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"` + + // 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"` + // 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. @@ -65594,6 +70018,15 @@ type ShareMountTargetVirtualNetworkInterfacePrototype struct { // 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"` } func (*ShareMountTargetVirtualNetworkInterfacePrototype) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { @@ -65607,6 +70040,22 @@ type ShareMountTargetVirtualNetworkInterfacePrototypeIntf interface { // UnmarshalShareMountTargetVirtualNetworkInterfacePrototype unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototype from the specified map of raw messages. func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ShareMountTargetVirtualNetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -65627,6 +70076,18 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json if err != nil { return } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -68717,6 +73178,54 @@ func (options *UpdateBareMetalServerDiskOptions) SetHeaders(param map[string]str return options } +// UpdateBareMetalServerNetworkAttachmentOptions : The UpdateBareMetalServerNetworkAttachment options. +type UpdateBareMetalServerNetworkAttachmentOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // The bare metal server network attachment patch. + BareMetalServerNetworkAttachmentPatch map[string]interface{} `json:"BareMetalServerNetworkAttachment_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateBareMetalServerNetworkAttachmentOptions : Instantiate UpdateBareMetalServerNetworkAttachmentOptions +func (*VpcV1) NewUpdateBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string, bareMetalServerNetworkAttachmentPatch map[string]interface{}) *UpdateBareMetalServerNetworkAttachmentOptions { + return &UpdateBareMetalServerNetworkAttachmentOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + BareMetalServerNetworkAttachmentPatch: bareMetalServerNetworkAttachmentPatch, + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetID(id string) *UpdateBareMetalServerNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBareMetalServerNetworkAttachmentPatch : Allow user to set BareMetalServerNetworkAttachmentPatch +func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerNetworkAttachmentPatch(bareMetalServerNetworkAttachmentPatch map[string]interface{}) *UpdateBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerNetworkAttachmentOptions { + options.Headers = param + return options +} + // UpdateBareMetalServerNetworkInterfaceOptions : The UpdateBareMetalServerNetworkInterface options. type UpdateBareMetalServerNetworkInterfaceOptions struct { // The bare metal server identifier. @@ -69463,6 +73972,54 @@ func (options *UpdateInstanceGroupOptions) SetHeaders(param map[string]string) * return options } +// UpdateInstanceNetworkAttachmentOptions : The UpdateInstanceNetworkAttachment options. +type UpdateInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance network attachment patch. + InstanceNetworkAttachmentPatch map[string]interface{} `json:"InstanceNetworkAttachment_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceNetworkAttachmentOptions : Instantiate UpdateInstanceNetworkAttachmentOptions +func (*VpcV1) NewUpdateInstanceNetworkAttachmentOptions(instanceID string, id string, instanceNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceNetworkAttachmentOptions { + return &UpdateInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + InstanceNetworkAttachmentPatch: instanceNetworkAttachmentPatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *UpdateInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceNetworkAttachmentOptions) SetID(id string) *UpdateInstanceNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceNetworkAttachmentPatch : Allow user to set InstanceNetworkAttachmentPatch +func (_options *UpdateInstanceNetworkAttachmentOptions) SetInstanceNetworkAttachmentPatch(instanceNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceNetworkAttachmentOptions { + _options.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + // UpdateInstanceNetworkInterfaceOptions : The UpdateInstanceNetworkInterface options. type UpdateInstanceNetworkInterfaceOptions struct { // The virtual server instance identifier. @@ -75263,6 +79820,10 @@ func (vpnServerRoutePatch *VPNServerRoutePatch) AsPatch() (_patch map[string]int // VirtualNetworkInterface : VirtualNetworkInterface struct type VirtualNetworkInterface 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" validate:"required"` + // Indicates whether this virtual network interface will be automatically deleted when // `target` is deleted. AutoDelete *bool `json:"auto_delete" validate:"required"` @@ -75273,15 +79834,35 @@ type VirtualNetworkInterface struct { // The CRN for this virtual network interface. CRN *string `json:"crn" 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 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" validate:"required"` + // The URL for this virtual network interface. Href *string `json:"href" validate:"required"` // The unique identifier for this virtual network interface. ID *string `json:"id" validate:"required"` + // The reserved IPs bound to this virtual network interface. + // + // May be empty when `lifecycle_state` is `pending`. + Ips []ReservedIPReference `json:"ips" validate:"required"` + // The lifecycle state of the virtual network interface. LifecycleState *string `json:"lifecycle_state" validate:"required"` + // The MAC address of the virtual network interface. May be absent if `lifecycle_state` is `pending`. + MacAddress *string `json:"mac_address,omitempty"` + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. Name *string `json:"name" validate:"required"` @@ -75333,6 +79914,10 @@ const ( // UnmarshalVirtualNetworkInterface unmarshals an instance of VirtualNetworkInterface from the specified map of raw messages. func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VirtualNetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) if err != nil { return @@ -75345,6 +79930,10 @@ func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result inter if err != nil { return } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -75353,10 +79942,18 @@ func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result inter if err != nil { return } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -75489,15 +80086,110 @@ func UnmarshalVirtualNetworkInterfaceCollectionNext(m map[string]json.RawMessage return } +// VirtualNetworkInterfaceIPPrototype : VirtualNetworkInterfaceIPPrototype struct +// Models which "extend" this model: +// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +// - VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPPrototype struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` + + // 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*VirtualNetworkInterfaceIPPrototype) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +type VirtualNetworkInterfaceIPPrototypeIntf interface { + isaVirtualNetworkInterfaceIPPrototype() bool +} + +// UnmarshalVirtualNetworkInterfaceIPPrototype unmarshals an instance of VirtualNetworkInterfaceIPPrototype from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VirtualNetworkInterfacePatch : VirtualNetworkInterfacePatch struct type VirtualNetworkInterfacePatch struct { - // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + // Indicates whether source IP spoofing is allowed on this interface. + // + // Must be `false` if `target` is a file share mount target. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. Must be `false` if the virtual network interface is unbound. + AutoDelete *bool `json:"auto_delete,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"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // region. Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. Name *string `json:"name,omitempty"` } // UnmarshalVirtualNetworkInterfacePatch unmarshals an instance of VirtualNetworkInterfacePatch from the specified map of raw messages. func UnmarshalVirtualNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VirtualNetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -75653,6 +80345,8 @@ func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessa // types. Optionally halt processing and surface an error, or bypass resources of unrecognized types. // Models which "extend" this model: // - VirtualNetworkInterfaceTargetShareMountTargetReference +// - VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext +// - VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext type VirtualNetworkInterfaceTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. @@ -78541,119 +83235,100 @@ func UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializat return } -// BareMetalServerNetworkInterfaceByHiperSocket : BareMetalServerNetworkInterfaceByHiperSocket struct -// This model "extends" BareMetalServerNetworkInterface -type BareMetalServerNetworkInterfaceByHiperSocket struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - - // The date and time that the bare metal server network interface was created. +// BareMetalServerNetworkAttachmentByPci : BareMetalServerNetworkAttachmentByPci struct +// This model "extends" BareMetalServerNetworkAttachment +type BareMetalServerNetworkAttachmentByPci struct { + // The date and time that the bare metal server 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`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The floating IPs associated with this bare metal server network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this bare metal server network interface. + // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this bare metal server network interface. + // The unique identifier for this bare metal server network attachment. ID *string `json:"id" 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 an empty string. - MacAddress *string `json:"mac_address" validate:"required"` + // The lifecycle state of the bare metal server network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The name for this bare metal server network interface. + // 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 bare metal server network interface port speed in Mbps. + // The port speed for this bare metal server network attachment in Mbps. PortSpeed *int64 `json:"port_speed" 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 resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this bare metal server network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the bare metal server network interface. - Status *string `json:"status" validate:"required"` - - // The associated subnet. + // The subnet of the virtual network interface for the bare metal server network attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The bare metal server network interface type. + // The bare metal server network attachment type. Type *string `json:"type" validate:"required"` - // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity - // within a `s390x` based system. + // The virtual network interface for this bare metal server network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` + + // The VLAN IDs allowed for `vlan` attachments using this PCI attachment. + AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` + + // - `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. InterfaceType *string `json:"interface_type" validate:"required"` } -// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.ResourceType property. -// The resource type. +// Constants associated with the BareMetalServerNetworkAttachmentByPci.LifecycleState property. +// The lifecycle state of the bare metal server network attachment. const ( - BareMetalServerNetworkInterfaceByHiperSocketResourceTypeNetworkInterfaceConst = "network_interface" + BareMetalServerNetworkAttachmentByPciLifecycleStateDeletingConst = "deleting" + BareMetalServerNetworkAttachmentByPciLifecycleStateFailedConst = "failed" + BareMetalServerNetworkAttachmentByPciLifecycleStatePendingConst = "pending" + BareMetalServerNetworkAttachmentByPciLifecycleStateStableConst = "stable" + BareMetalServerNetworkAttachmentByPciLifecycleStateSuspendedConst = "suspended" + BareMetalServerNetworkAttachmentByPciLifecycleStateUpdatingConst = "updating" + BareMetalServerNetworkAttachmentByPciLifecycleStateWaitingConst = "waiting" ) -// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.Status property. -// The status of the bare metal server network interface. +// Constants associated with the BareMetalServerNetworkAttachmentByPci.ResourceType property. +// The resource type. const ( - BareMetalServerNetworkInterfaceByHiperSocketStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceByHiperSocketStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceByHiperSocketStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceByHiperSocketStatusPendingConst = "pending" + BareMetalServerNetworkAttachmentByPciResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" ) -// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.Type property. -// The bare metal server network interface type. +// Constants associated with the BareMetalServerNetworkAttachmentByPci.Type property. +// The bare metal server network attachment type. const ( - BareMetalServerNetworkInterfaceByHiperSocketTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceByHiperSocketTypeSecondaryConst = "secondary" + BareMetalServerNetworkAttachmentByPciTypePrimaryConst = "primary" + BareMetalServerNetworkAttachmentByPciTypeSecondaryConst = "secondary" ) -// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.InterfaceType property. -// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity -// within a `s390x` based system. +// Constants associated with the BareMetalServerNetworkAttachmentByPci.InterfaceType property. +// - `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. const ( - BareMetalServerNetworkInterfaceByHiperSocketInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkAttachmentByPciInterfaceTypePciConst = "pci" ) -func (*BareMetalServerNetworkInterfaceByHiperSocket) isaBareMetalServerNetworkInterface() bool { +func (*BareMetalServerNetworkAttachmentByPci) isaBareMetalServerNetworkAttachment() bool { return true } -// UnmarshalBareMetalServerNetworkInterfaceByHiperSocket unmarshals an instance of BareMetalServerNetworkInterfaceByHiperSocket from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceByHiperSocket) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return - } +// UnmarshalBareMetalServerNetworkAttachmentByPci unmarshals an instance of BareMetalServerNetworkAttachmentByPci from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentByPci(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentByPci) err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - return - } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -78662,7 +83337,7 @@ func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.Raw if err != nil { return } - err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return } @@ -78682,19 +83357,19 @@ func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.Raw if err != nil { return } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { return } @@ -78706,177 +83381,207 @@ func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.Raw return } -// BareMetalServerNetworkInterfaceByPci : BareMetalServerNetworkInterfaceByPci struct -// This model "extends" BareMetalServerNetworkInterface -type BareMetalServerNetworkInterfaceByPci struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` - - // The date and time that the bare metal server network interface was created. +// BareMetalServerNetworkAttachmentByVlan : BareMetalServerNetworkAttachmentByVlan struct +// This model "extends" BareMetalServerNetworkAttachment +type BareMetalServerNetworkAttachmentByVlan struct { + // The date and time that the bare metal server 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`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` - - // The floating IPs associated with this bare metal server network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this bare metal server network interface. + // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` - // The unique identifier for this bare metal server network interface. + // The unique identifier for this bare metal server network attachment. ID *string `json:"id" 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 an empty string. - MacAddress *string `json:"mac_address" validate:"required"` + // The lifecycle state of the bare metal server network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The name for this bare metal server network interface. + // 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 bare metal server network interface port speed in Mbps. + // The port speed for this bare metal server network attachment in Mbps. PortSpeed *int64 `json:"port_speed" 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 resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this bare metal server network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the bare metal server network interface. - Status *string `json:"status" validate:"required"` - - // The associated subnet. + // The subnet of the virtual network interface for the bare metal server network attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` - // The bare metal server network interface type. + // The bare metal server network attachment type. Type *string `json:"type" validate:"required"` - // The VLAN IDs allowed for `vlan` interfaces using this PCI interface. - AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` + // The virtual network interface for this bare metal server network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` - // - `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. + // 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" validate:"required"` + + // - `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. InterfaceType *string `json:"interface_type" validate:"required"` + + // The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment. + Vlan *int64 `json:"vlan" validate:"required"` } -// Constants associated with the BareMetalServerNetworkInterfaceByPci.ResourceType property. -// The resource type. +// Constants associated with the BareMetalServerNetworkAttachmentByVlan.LifecycleState property. +// The lifecycle state of the bare metal server network attachment. const ( - BareMetalServerNetworkInterfaceByPciResourceTypeNetworkInterfaceConst = "network_interface" + BareMetalServerNetworkAttachmentByVlanLifecycleStateDeletingConst = "deleting" + BareMetalServerNetworkAttachmentByVlanLifecycleStateFailedConst = "failed" + BareMetalServerNetworkAttachmentByVlanLifecycleStatePendingConst = "pending" + BareMetalServerNetworkAttachmentByVlanLifecycleStateStableConst = "stable" + BareMetalServerNetworkAttachmentByVlanLifecycleStateSuspendedConst = "suspended" + BareMetalServerNetworkAttachmentByVlanLifecycleStateUpdatingConst = "updating" + BareMetalServerNetworkAttachmentByVlanLifecycleStateWaitingConst = "waiting" ) -// Constants associated with the BareMetalServerNetworkInterfaceByPci.Status property. -// The status of the bare metal server network interface. +// Constants associated with the BareMetalServerNetworkAttachmentByVlan.ResourceType property. +// The resource type. const ( - BareMetalServerNetworkInterfaceByPciStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceByPciStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceByPciStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceByPciStatusPendingConst = "pending" + BareMetalServerNetworkAttachmentByVlanResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" ) -// Constants associated with the BareMetalServerNetworkInterfaceByPci.Type property. -// The bare metal server network interface type. +// Constants associated with the BareMetalServerNetworkAttachmentByVlan.Type property. +// The bare metal server network attachment type. const ( - BareMetalServerNetworkInterfaceByPciTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceByPciTypeSecondaryConst = "secondary" + BareMetalServerNetworkAttachmentByVlanTypePrimaryConst = "primary" + BareMetalServerNetworkAttachmentByVlanTypeSecondaryConst = "secondary" ) -// Constants associated with the BareMetalServerNetworkInterfaceByPci.InterfaceType property. -// - `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. +// Constants associated with the BareMetalServerNetworkAttachmentByVlan.InterfaceType property. +// - `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. const ( - BareMetalServerNetworkInterfaceByPciInterfaceTypePciConst = "pci" + BareMetalServerNetworkAttachmentByVlanInterfaceTypeVlanConst = "vlan" ) -func (*BareMetalServerNetworkInterfaceByPci) isaBareMetalServerNetworkInterface() bool { +func (*BareMetalServerNetworkAttachmentByVlan) isaBareMetalServerNetworkAttachment() bool { return true } -// UnmarshalBareMetalServerNetworkInterfaceByPci unmarshals an instance of BareMetalServerNetworkInterfaceByPci from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceByPci) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) +// UnmarshalBareMetalServerNetworkAttachmentByVlan unmarshals an instance of BareMetalServerNetworkAttachmentByVlan from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentByVlan(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentByVlan) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { return } - err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) if err != nil { return } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity struct { + // 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"` +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityIntf interface { + BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf + isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } @@ -78884,129 +83589,81 @@ func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, return } -// BareMetalServerNetworkInterfaceByVlan : BareMetalServerNetworkInterfaceByVlan struct -// This model "extends" BareMetalServerNetworkInterface -type BareMetalServerNetworkInterfaceByVlan struct { - // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext : The virtual network interface for this target. +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext 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"` - // The date and time that the bare metal server network interface was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,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, + // - 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 floating IPs associated with this bare metal server network interface. - FloatingIps []FloatingIPReference `json:"floating_ips" validate:"required"` - - // The URL for this bare metal server network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server network interface. - ID *string `json:"id" 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 an empty string. - MacAddress *string `json:"mac_address" validate:"required"` - - // The name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - // The bare metal server network interface port speed in Mbps. - 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. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the bare metal server network interface. - Status *string `json:"status" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The bare metal server network interface type. - Type *string `json:"type" validate:"required"` + // - Can only be attached to a `target` with a `resource_type` of + // `bare_metal_server_network_attachment`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,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`. + // 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 `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. + // If reserved IP identities are provided, the specified reserved IPs must be unbound. // - // 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`. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float" validate:"required"` - - // - `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. - InterfaceType *string `json:"interface_type" validate:"required"` + // 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"` - // The VLAN ID used in the IEEE 802.1Q tag present in all traffic on this interface. - Vlan *int64 `json:"vlan" validate:"required"` -} + // 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"` -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkInterfaceByVlanResourceTypeNetworkInterfaceConst = "network_interface" -) + // 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"` -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Status property. -// The status of the bare metal server network interface. -const ( - BareMetalServerNetworkInterfaceByVlanStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceByVlanStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceByVlanStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceByVlanStatusPendingConst = "pending" -) + // 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"` -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.Type property. -// The bare metal server network interface type. -const ( - BareMetalServerNetworkInterfaceByVlanTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceByVlanTypeSecondaryConst = "secondary" -) + // 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"` -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.InterfaceType property. -// - `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. -const ( - BareMetalServerNetworkInterfaceByVlanInterfaceTypeVlanConst = "vlan" -) + // The associated subnet. Required if `primary_ip` does not specify a reserved IP + // identity. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` +} -func (*BareMetalServerNetworkInterfaceByVlan) isaBareMetalServerNetworkInterface() bool { +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { return true } -// UnmarshalBareMetalServerNetworkInterfaceByVlan unmarshals an instance of BareMetalServerNetworkInterfaceByVlan from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceByVlan) +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) if err != nil { return } @@ -79014,55 +83671,169 @@ func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage if err != nil { return } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct +// This model "extends" BareMetalServerNetworkAttachmentPrototype +type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct { + // 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"` + + 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"` + + // - `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" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype.InterfaceType property. +// - `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 ( + BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototypeInterfaceTypePciConst = "pci" +) + +// NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { return } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype struct +// This model "extends" BareMetalServerNetworkAttachmentPrototype +type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype struct { + // 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"` + + VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" 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"` + + // - `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. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment. + Vlan *int64 `json:"vlan" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype.InterfaceType property. +// - `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. +const ( + BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototypeInterfaceTypeVlanConst = "vlan" +) + +// NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + InterfaceType: core.StringPtr(interfaceType), + Vlan: core.Int64Ptr(vlan), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { return } - err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) if err != nil { return } @@ -79078,11 +83849,23 @@ func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage return } -// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct -// This model "extends" BareMetalServerNetworkInterfacePrototype -type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct { +// BareMetalServerNetworkInterfaceByHiperSocket : BareMetalServerNetworkInterfaceByHiperSocket struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByHiperSocket struct { // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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=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. @@ -79093,79 +83876,196 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHi // 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,omitempty"` + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 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 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=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 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 URL for this bare metal server network interface. // - // 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"` + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. + Href *string `json:"href" 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"` + // 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=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 MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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=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=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=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=vni-old-api-clients). + Status *string `json:"status" validate:"required"` // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + 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=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"` // - `hipersocket`: a virtual network 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`. InterfaceType *string `json:"interface_type" validate:"required"` } -// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype.InterfaceType property. +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceByHiperSocketResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.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=vni-old-api-clients). +const ( + BareMetalServerNetworkInterfaceByHiperSocketStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByHiperSocketStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByHiperSocketStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByHiperSocketStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.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=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 ( + BareMetalServerNetworkInterfaceByHiperSocketTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByHiperSocketTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.InterfaceType property. // - `hipersocket`: a virtual network 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`. const ( - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototypeInterfaceTypeHipersocketConst = "hipersocket" + BareMetalServerNetworkInterfaceByHiperSocketInterfaceTypeHipersocketConst = "hipersocket" ) -// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype, err error) { - _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype{ - Subnet: subnet, - InterfaceType: core.StringPtr(interfaceType), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { +func (*BareMetalServerNetworkInterfaceByHiperSocket) isaBareMetalServerNetworkInterface() bool { return true } -// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) +// UnmarshalBareMetalServerNetworkInterfaceByHiperSocket unmarshals an instance of BareMetalServerNetworkInterfaceByHiperSocket from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByHiperSocket) err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) if err != nil { return } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { return } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -79177,11 +84077,23 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte return } -// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct -// This model "extends" BareMetalServerNetworkInterfacePrototype -type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct { +// BareMetalServerNetworkInterfaceByPci : BareMetalServerNetworkInterfaceByPci struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByPci struct { // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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=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. @@ -79192,88 +84104,210 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc // 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,omitempty"` + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 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 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=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 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 URL for this bare metal server network interface. // - // 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"` + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. + Href *string `json:"href" 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"` + // 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=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 MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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=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=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=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=vni-old-api-clients). + Status *string `json:"status" validate:"required"` // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + Subnet *SubnetReference `json:"subnet" validate:"required"` - // The VLAN IDs to allow for `vlan` interfaces using this PCI interface. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + // 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=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=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" validate:"required"` // - `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" validate:"required"` } -// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype.InterfaceType property. +// Constants associated with the BareMetalServerNetworkInterfaceByPci.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceByPciResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.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=vni-old-api-clients). +const ( + BareMetalServerNetworkInterfaceByPciStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByPciStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByPciStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByPciStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.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=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 ( + BareMetalServerNetworkInterfaceByPciTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByPciTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.InterfaceType property. // - `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 ( - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototypeInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfaceByPciInterfaceTypePciConst = "pci" ) -// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype, err error) { - _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype{ - Subnet: subnet, - InterfaceType: core.StringPtr(interfaceType), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { +func (*BareMetalServerNetworkInterfaceByPci) isaBareMetalServerNetworkInterface() bool { return true } -// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) +// UnmarshalBareMetalServerNetworkInterfaceByPci unmarshals an instance of BareMetalServerNetworkInterfaceByPci from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByPci) err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) if err != nil { return } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) if err != nil { return } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { return } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } @@ -79289,11 +84323,23 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte return } -// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct -// This model "extends" BareMetalServerNetworkInterfacePrototype -type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct { +// BareMetalServerNetworkInterfaceByVlan : BareMetalServerNetworkInterfaceByVlan struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByVlan struct { // Indicates whether source IP spoofing is allowed on this bare metal server network interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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=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. @@ -79304,26 +84350,89 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // 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,omitempty"` + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 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 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=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 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 URL for this bare metal server network interface. // - // 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"` + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. + Href *string `json:"href" 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"` + // 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=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 MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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=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=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=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=vni-old-api-clients). + Status *string `json:"status" validate:"required"` // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + 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=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"` // 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`. @@ -79335,38 +84444,481 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // 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`. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + // + // If this bare metal server has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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" validate:"required"` // - `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 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=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" validate:"required"` } -// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype.InterfaceType property. +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceByVlanResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.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=vni-old-api-clients). +const ( + BareMetalServerNetworkInterfaceByVlanStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByVlanStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByVlanStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByVlanStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.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=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 ( + BareMetalServerNetworkInterfaceByVlanTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByVlanTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.InterfaceType property. // - `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 ( - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototypeInterfaceTypeVlanConst = "vlan" + BareMetalServerNetworkInterfaceByVlanInterfaceTypeVlanConst = "vlan" ) -// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(subnet SubnetIdentityIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype, err error) { - _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype{ - Subnet: subnet, - InterfaceType: core.StringPtr(interfaceType), - Vlan: core.Int64Ptr(vlan), - } +func (*BareMetalServerNetworkInterfaceByVlan) isaBareMetalServerNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfaceByVlan unmarshals an instance of BareMetalServerNetworkInterfaceByVlan from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByVlan) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype 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=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=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. 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"` + + // - `hipersocket`: a virtual network 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`. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype.InterfaceType property. +// - `hipersocket`: a virtual network 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`. +const ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototypeInterfaceTypeHipersocketConst = "hipersocket" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype 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=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=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. 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"` + + // - `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" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype.InterfaceType property. +// - `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 ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototypeInterfaceTypePciConst = "pci" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype 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=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=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. 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"` + + // 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=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"` + + // - `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 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=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" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype.InterfaceType property. +// - `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 ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototypeInterfaceTypeVlanConst = "vlan" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(subnet SubnetIdentityIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + Vlan: core.Int64Ptr(vlan), + } err = core.ValidateStruct(_model, "required parameters") return } @@ -79418,8 +84970,76 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte return } -// BareMetalServerProfileBandwidthDependent : The total bandwidth shared across the bare metal server network interfaces of a bare metal server with this profile -// depends on its configuration. +// BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype : BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype struct +// This model "extends" BareMetalServerPrimaryNetworkAttachmentPrototype +type BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype struct { + // 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"` + + 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"` + + // - `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"` +} + +// Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype.InterfaceType property. +// - `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 ( + BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototypeInterfaceTypePciConst = "pci" +) + +// NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype : Instantiate BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) (_model *BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype, err error) { + _model = &BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { + return true +} + +// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidthDependent : The total bandwidth shared across the bare metal server network attachments or bare metal server network interfaces +// of a bare metal server with this profile depends on its configuration. // This model "extends" BareMetalServerProfileBandwidth type BareMetalServerProfileBandwidthDependent struct { // The type for this profile field. @@ -79447,8 +85067,8 @@ func UnmarshalBareMetalServerProfileBandwidthDependent(m map[string]json.RawMess return } -// BareMetalServerProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the bare metal server network interfaces -// of a bare metal server with this profile. +// BareMetalServerProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the bare metal server network attachments +// or bare metal server network interfaces of a bare metal server with this profile. // This model "extends" BareMetalServerProfileBandwidth type BareMetalServerProfileBandwidthEnum struct { // The default value for this profile field. @@ -79490,8 +85110,8 @@ func UnmarshalBareMetalServerProfileBandwidthEnum(m map[string]json.RawMessage, return } -// BareMetalServerProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the bare metal server network interfaces of a bare metal -// server with this profile. +// BareMetalServerProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the bare metal server network attachments or bare metal +// server network interfaces of a bare metal server with this profile. // This model "extends" BareMetalServerProfileBandwidth type BareMetalServerProfileBandwidthFixed struct { // The type for this profile field. @@ -79526,8 +85146,8 @@ func UnmarshalBareMetalServerProfileBandwidthFixed(m map[string]json.RawMessage, return } -// BareMetalServerProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the bare metal server network interfaces -// of a bare metal server with this profile. +// BareMetalServerProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network attachments or network +// interfaces of a bare metal server with this profile. // This model "extends" BareMetalServerProfileBandwidth type BareMetalServerProfileBandwidthRange struct { // The default value for this profile field. @@ -80453,6 +86073,77 @@ func UnmarshalBareMetalServerProfileMemoryRange(m map[string]json.RawMessage, re return } +// BareMetalServerProfileNetworkAttachmentCountDependent : The number of network attachments supported on a bare metal server with this profile is dependent on its +// configuration. +// This model "extends" BareMetalServerProfileNetworkAttachmentCount +type BareMetalServerProfileNetworkAttachmentCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileNetworkAttachmentCountDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkAttachmentCountDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileNetworkAttachmentCountDependent) isaBareMetalServerProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileNetworkAttachmentCountDependent unmarshals an instance of BareMetalServerProfileNetworkAttachmentCountDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkAttachmentCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkAttachmentCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileNetworkAttachmentCountRange : The number of network attachments supported on a bare metal server with this profile. +// This model "extends" BareMetalServerProfileNetworkAttachmentCount +type BareMetalServerProfileNetworkAttachmentCountRange 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" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileNetworkAttachmentCountRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkAttachmentCountRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileNetworkAttachmentCountRange) isaBareMetalServerProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileNetworkAttachmentCountRange unmarshals an instance of BareMetalServerProfileNetworkAttachmentCountRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkAttachmentCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkAttachmentCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerProfileNetworkInterfaceCountDependent : The number of bare metal server network interfaces supported on a bare metal server with this profile is dependent on // its configuration. // This model "extends" BareMetalServerProfileNetworkInterfaceCount @@ -80524,6 +86215,210 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCountRange(m map[string]json return } +// BareMetalServerPrototypeBareMetalServerByNetworkAttachment : BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct +// This model "extends" BareMetalServerPrototype +type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { + // 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"` + + 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" validate:"required"` +} + +// NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment : Instantiate BareMetalServerPrototypeBareMetalServerByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment(initialization *BareMetalServerInitializationPrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf) (_model *BareMetalServerPrototypeBareMetalServerByNetworkAttachment, err error) { + _model = &BareMetalServerPrototypeBareMetalServerByNetworkAttachment{ + Initialization: initialization, + Profile: profile, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrototypeBareMetalServerByNetworkAttachment) isaBareMetalServerPrototype() bool { + return true +} + +// UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment unmarshals an instance of BareMetalServerPrototypeBareMetalServerByNetworkAttachment from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrototypeBareMetalServerByNetworkInterface : BareMetalServerPrototypeBareMetalServerByNetworkInterface struct +// This model "extends" BareMetalServerPrototype +type BareMetalServerPrototypeBareMetalServerByNetworkInterface struct { + // 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"` + + 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 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" validate:"required"` +} + +// NewBareMetalServerPrototypeBareMetalServerByNetworkInterface : Instantiate BareMetalServerPrototypeBareMetalServerByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkInterface(initialization *BareMetalServerInitializationPrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype) (_model *BareMetalServerPrototypeBareMetalServerByNetworkInterface, err error) { + _model = &BareMetalServerPrototypeBareMetalServerByNetworkInterface{ + Initialization: initialization, + Profile: profile, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrototypeBareMetalServerByNetworkInterface) isaBareMetalServerPrototype() bool { + return true +} + +// UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface unmarshals an instance of BareMetalServerPrototypeBareMetalServerByNetworkInterface from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeBareMetalServerByNetworkInterface) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // CatalogOfferingIdentityCatalogOfferingByCRN : CatalogOfferingIdentityCatalogOfferingByCRN struct // This model "extends" CatalogOfferingIdentity type CatalogOfferingIdentityCatalogOfferingByCRN struct { @@ -81818,7 +87713,8 @@ type FloatingIPPrototypeFloatingIPByTarget struct { // resource is: // // - an instance network interface - // - a bare metal server network interface with `enable_infrastructure_nat` set to `true`. + // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` + // - a virtual network interface with `enable_infrastructure_nat` set to `true`. Target FloatingIPTargetPrototypeIntf `json:"target" validate:"required"` } @@ -81906,9 +87802,18 @@ func UnmarshalFloatingIPPrototypeFloatingIPByZone(m map[string]json.RawMessage, // This model "extends" FloatingIPTargetPatch type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity struct { // 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=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,omitempty"` // 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=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` } @@ -81947,9 +87852,18 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity(m map // This model "extends" FloatingIPTargetPatch type FloatingIPTargetPatchNetworkInterfaceIdentity struct { // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` } @@ -81981,6 +87895,55 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity(m map[string]json.Ra return } +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" FloatingIPTargetPatch +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentity struct { + // 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"` +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPatchIntf + isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity : Identifies a bare metal server network interface by a unique property. // Models which "extend" this model: // - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID @@ -81988,9 +87951,18 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity(m map[string]json.Ra // This model "extends" FloatingIPTargetPrototype type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity struct { // 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=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,omitempty"` // 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=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` } @@ -82029,9 +88001,18 @@ func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity(m // This model "extends" FloatingIPTargetPrototype type FloatingIPTargetPrototypeNetworkInterfaceIdentity struct { // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` } @@ -82063,6 +88044,55 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity(m map[string]jso return } +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" FloatingIPTargetPrototype +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity struct { + // 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"` +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPrototypeIntf + isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPTargetBareMetalServerNetworkInterfaceReference : FloatingIPTargetBareMetalServerNetworkInterfaceReference struct // This model "extends" FloatingIPTarget type FloatingIPTargetBareMetalServerNetworkInterfaceReference struct { @@ -82071,9 +88101,18 @@ type FloatingIPTargetBareMetalServerNetworkInterfaceReference struct { Deleted *BareMetalServerNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` // 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=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=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 name for this bare metal server network interface. @@ -82134,9 +88173,18 @@ type FloatingIPTargetNetworkInterfaceReference struct { Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 name for this instance network interface. @@ -82253,6 +88301,84 @@ func UnmarshalFloatingIPTargetPublicGatewayReference(m map[string]json.RawMessag return } +// FloatingIPTargetVirtualNetworkInterfaceReference : FloatingIPTargetVirtualNetworkInterfaceReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetVirtualNetworkInterfaceReference struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VirtualNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The primary IP for this virtual network interface. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the FloatingIPTargetVirtualNetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetVirtualNetworkInterfaceReferenceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +func (*FloatingIPTargetVirtualNetworkInterfaceReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference unmarshals an instance of FloatingIPTargetVirtualNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetVirtualNetworkInterfaceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FlowLogCollectorTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. // Models which "extend" this model: // - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID @@ -82302,6 +88428,47 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity(m map[string]json. return } +// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity : Identifies an instance network attachment by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID +// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity struct { + // The unique identifier for this instance network attachment. + ID *string `json:"id,omitempty"` + + // The URL for this instance network attachment. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. // Models which "extend" this model: // - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID @@ -82309,9 +88476,18 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity(m map[string]json. // This model "extends" FlowLogCollectorTargetPrototype type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity struct { // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href,omitempty"` } @@ -82441,6 +88617,127 @@ func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity(m map[string]json.RawMe return } +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity struct { + // 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"` +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetInstanceNetworkAttachmentReference : FlowLogCollectorTargetInstanceNetworkAttachmentReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetInstanceNetworkAttachmentReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` + + // The name for this instance network attachment. The name is unique across all network attachments for the instance. + Name *string `json:"name" validate:"required"` + + // The primary IP address of the virtual network interface for the instance 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 instance network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetInstanceNetworkAttachmentReference.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetInstanceNetworkAttachmentReferenceResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" +) + +func (*FlowLogCollectorTargetInstanceNetworkAttachmentReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference unmarshals an instance of FlowLogCollectorTargetInstanceNetworkAttachmentReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetInstanceNetworkAttachmentReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FlowLogCollectorTargetInstanceReference : FlowLogCollectorTargetInstanceReference struct // This model "extends" FlowLogCollectorTarget type FlowLogCollectorTargetInstanceReference struct { @@ -82500,9 +88797,18 @@ type FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct { Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 name for this instance network interface. @@ -82677,6 +88983,62 @@ func UnmarshalFlowLogCollectorTargetVPCReference(m map[string]json.RawMessage, r return } +// FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext : FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +func (*FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext unmarshals an instance of FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ImageIdentityByCRN : ImageIdentityByCRN struct // This model "extends" ImageIdentity type ImageIdentityByCRN struct { @@ -83856,6 +90218,165 @@ func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScaleProtot return } +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterface +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity struct { + // 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"` +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityIntf interface { + InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf + isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext : The virtual network interface for this target. +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterface +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext 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"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,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"` + + // 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"` + + // 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 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"` + + // The resource group to use for this virtual network interface. If unspecified, the + // virtual server instance's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,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"` +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstancePatchProfileInstanceProfileIdentityByHref : InstancePatchProfileInstanceProfileIdentityByHref struct // This model "extends" InstancePatchProfile type InstancePatchProfileInstanceProfileIdentityByHref struct { @@ -84355,8 +90876,8 @@ func UnmarshalInstancePlacementTargetPlacementGroupReference(m map[string]json.R return } -// InstanceProfileBandwidthDependent : The total bandwidth shared across the network interfaces and storage volumes of an instance with this profile depends -// on its configuration. +// InstanceProfileBandwidthDependent : The total bandwidth shared across the network attachments or network interfaces and storage volumes of an instance +// with this profile depends on its configuration. // This model "extends" InstanceProfileBandwidth type InstanceProfileBandwidthDependent struct { // The type for this profile field. @@ -84384,8 +90905,8 @@ func UnmarshalInstanceProfileBandwidthDependent(m map[string]json.RawMessage, re return } -// InstanceProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network interfaces and storage -// volumes of an instance with this profile. +// InstanceProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network attachments or network +// interfaces and storage volumes of an instance with this profile. // This model "extends" InstanceProfileBandwidth type InstanceProfileBandwidthEnum struct { // The default value for this profile field. @@ -84427,8 +90948,8 @@ func UnmarshalInstanceProfileBandwidthEnum(m map[string]json.RawMessage, result return } -// InstanceProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network interfaces and storage volumes of an instance -// with this profile. +// InstanceProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network attachments or network interfaces and storage +// volumes of an instance with this profile. // This model "extends" InstanceProfileBandwidth type InstanceProfileBandwidthFixed struct { // The type for this profile field. @@ -84463,8 +90984,8 @@ func UnmarshalInstanceProfileBandwidthFixed(m map[string]json.RawMessage, result return } -// InstanceProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network interfaces and storage volumes -// of an instance with this profile. +// InstanceProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network attachments or network +// interfaces and storage volumes of an instance with this profile. // This model "extends" InstanceProfileBandwidth type InstanceProfileBandwidthRange struct { // The default value for this profile field. @@ -85452,6 +91973,76 @@ func UnmarshalInstanceProfileNumaCountFixed(m map[string]json.RawMessage, result return } +// InstanceProfileNetworkAttachmentCountDependent : The number of network attachments supported on an instance with this profile is dependent on its configuration. +// This model "extends" InstanceProfileNetworkAttachmentCount +type InstanceProfileNetworkAttachmentCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileNetworkAttachmentCountDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkAttachmentCountDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileNetworkAttachmentCountDependent) isaInstanceProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalInstanceProfileNetworkAttachmentCountDependent unmarshals an instance of InstanceProfileNetworkAttachmentCountDependent from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkAttachmentCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkAttachmentCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkAttachmentCountRange : The number of network attachments supported on an instance with this profile. +// This model "extends" InstanceProfileNetworkAttachmentCount +type InstanceProfileNetworkAttachmentCountRange 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" validate:"required"` +} + +// Constants associated with the InstanceProfileNetworkAttachmentCountRange.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkAttachmentCountRangeTypeRangeConst = "range" +) + +func (*InstanceProfileNetworkAttachmentCountRange) isaInstanceProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalInstanceProfileNetworkAttachmentCountRange unmarshals an instance of InstanceProfileNetworkAttachmentCountRange from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkAttachmentCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkAttachmentCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceProfileNetworkInterfaceCountDependent : The number of network interfaces supported on an instance with this profile is dependent on its configuration. // This model "extends" InstanceProfileNetworkInterfaceCount type InstanceProfileNetworkInterfaceCountDependent struct { @@ -85911,6 +92502,9 @@ func UnmarshalInstanceProfileVolumeBandwidthRange(m map[string]json.RawMessage, } // InstancePrototypeInstanceByCatalogOffering : Create an instance by using a catalog offering. +// Models which "extend" this model: +// - InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment +// - InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface // This model "extends" InstancePrototype type InstancePrototypeInstanceByCatalogOffering struct { // The availability policy to use for this virtual server instance. @@ -85969,7 +92563,8 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -85993,17 +92588,21 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` } -// NewInstancePrototypeInstanceByCatalogOffering : Instantiate InstancePrototypeInstanceByCatalogOffering (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByCatalogOffering(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByCatalogOffering, err error) { - _model = &InstancePrototypeInstanceByCatalogOffering{ - CatalogOffering: catalogOffering, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototypeInstanceByCatalogOffering() bool { + return true +} + +type InstancePrototypeInstanceByCatalogOfferingIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceByCatalogOffering() bool } func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototype() bool { @@ -86081,11 +92680,22 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } // InstancePrototypeInstanceByImage : Create an instance by using an image. +// Models which "extend" this model: +// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment +// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface // This model "extends" InstancePrototype type InstancePrototypeInstanceByImage struct { // The availability policy to use for this virtual server instance. @@ -86144,7 +92754,8 @@ type InstancePrototypeInstanceByImage struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -86161,17 +92772,21 @@ type InstancePrototypeInstanceByImage struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` } -// NewInstancePrototypeInstanceByImage : Instantiate InstancePrototypeInstanceByImage (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByImage, err error) { - _model = &InstancePrototypeInstanceByImage{ - Image: image, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*InstancePrototypeInstanceByImage) isaInstancePrototypeInstanceByImage() bool { + return true +} + +type InstancePrototypeInstanceByImageIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceByImage() bool } func (*InstancePrototypeInstanceByImage) isaInstancePrototype() bool { @@ -86249,11 +92864,22 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } // InstancePrototypeInstanceBySourceSnapshot : Create an instance by using a snapshot. +// Models which "extend" this model: +// - InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment +// - InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface // This model "extends" InstancePrototype type InstancePrototypeInstanceBySourceSnapshot struct { // The availability policy to use for this virtual server instance. @@ -86312,7 +92938,8 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -86326,17 +92953,21 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` } -// NewInstancePrototypeInstanceBySourceSnapshot : Instantiate InstancePrototypeInstanceBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceBySourceSnapshot, err error) { - _model = &InstancePrototypeInstanceBySourceSnapshot{ - BootVolumeAttachment: bootVolumeAttachment, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototypeInstanceBySourceSnapshot() bool { + return true +} + +type InstancePrototypeInstanceBySourceSnapshotIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceBySourceSnapshot() bool } func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototype() bool { @@ -86410,12 +93041,23 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } // InstancePrototypeInstanceBySourceTemplate : Create an instance by using an instance template. // +// The `primary_network_attachment` and `network_attachments` properties may only be specified if +// `primary_network_attachment` is specified in the source template. +// // The `primary_network_interface` and `network_interfaces` properties may only be specified if // `primary_network_interface` is specified in the source template. // This model "extends" InstancePrototype @@ -86476,7 +93118,8 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -86496,9 +93139,15 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` @@ -86585,10 +93234,18 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -86606,6 +93263,9 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes } // InstancePrototypeInstanceByVolume : Create an instance by using a boot volume. +// Models which "extend" this model: +// - InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment +// - InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface // This model "extends" InstancePrototype type InstancePrototypeInstanceByVolume struct { // The availability policy to use for this virtual server instance. @@ -86664,7 +93324,8 @@ type InstancePrototypeInstanceByVolume struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment for the virtual server instance. @@ -86678,17 +93339,21 @@ type InstancePrototypeInstanceByVolume struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` } -// NewInstancePrototypeInstanceByVolume : Instantiate InstancePrototypeInstanceByVolume (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByVolume(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstancePrototypeInstanceByVolume, err error) { - _model = &InstancePrototypeInstanceByVolume{ - BootVolumeAttachment: bootVolumeAttachment, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*InstancePrototypeInstanceByVolume) isaInstancePrototypeInstanceByVolume() bool { + return true +} + +type InstancePrototypeInstanceByVolumeIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceByVolume() bool } func (*InstancePrototypeInstanceByVolume) isaInstancePrototype() bool { @@ -86762,6 +93427,14 @@ func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, re if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -86860,6 +93533,9 @@ func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result } // InstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Create an instance template that creates instances by using a catalog offering. +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment +// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface // This model "extends" InstanceTemplatePrototype type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The availability policy to use for this virtual server instance. @@ -86916,7 +93592,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -86940,17 +93617,21 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` } -// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOffering (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOffering, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOffering{ - CatalogOffering: catalogOffering, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { + return true +} + +type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool } func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototype() bool { @@ -87028,11 +93709,22 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } // InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image. +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment +// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface // This model "extends" InstanceTemplatePrototype type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The availability policy to use for this virtual server instance. @@ -87089,7 +93781,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -87106,17 +93799,21 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` } -// NewInstanceTemplatePrototypeInstanceTemplateByImage : Instantiate InstanceTemplatePrototypeInstanceTemplateByImage (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateByImage, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByImage{ - Image: image, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { + return true +} + +type InstanceTemplatePrototypeInstanceTemplateByImageIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateByImage() bool } func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototype() bool { @@ -87194,11 +93891,22 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } // InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Create an instance template that creates instances by using a snapshot. +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment +// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface // This model "extends" InstanceTemplatePrototype type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The availability policy to use for this virtual server instance. @@ -87255,7 +93963,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -87269,17 +93978,21 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` } -// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot{ - BootVolumeAttachment: bootVolumeAttachment, - PrimaryNetworkInterface: primaryNetworkInterface, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - return +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { + return true +} + +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool } func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototype() bool { @@ -87353,6 +94066,14 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -87414,7 +94135,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -87434,9 +94156,15 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The primary instance network interface to create. PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` @@ -87523,205 +94251,23 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext : Create an instance by using a catalog offering. -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` -} - -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) - if err != nil { - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) if err != nil { return } @@ -87733,9 +94279,12 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m return } -// InstanceTemplateInstanceByImageInstanceTemplateContext : Create an instance by using an image. +// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext : Create an instance by using a catalog offering. +// Models which "extend" this model: +// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface // This model "extends" InstanceTemplate -type InstanceTemplateInstanceByImageInstanceTemplateContext struct { +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` @@ -87802,7 +94351,225 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { + return true +} + +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByImageInstanceTemplateContext : Create an instance by using an image. +// Models which "extend" this model: +// - InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByImageInstanceTemplateContext struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. @@ -87815,10 +94582,25 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` +} + +func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { + return true +} + +type InstanceTemplateInstanceByImageInstanceTemplateContextIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool } func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplate() bool { @@ -87912,11 +94694,22 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[strin if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } // InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext : Create an instance by using a snapshot. +// Models which "extend" this model: +// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface // This model "extends" InstanceTemplate type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. @@ -87985,22 +94778,38 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // The VPC this virtual server instance will reside in. // - // If specified, it must match the VPC for the subnets of the instance network interfaces. + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. VPC VPCIdentityIntf `json:"vpc,omitempty"` // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { + return true +} + +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool +} + func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplate() bool { return true } @@ -88076,10 +94885,18 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m if err != nil { return } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return @@ -91580,6 +98397,55 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity(m map[string]json return } +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" ReservedIPTargetPrototype +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity struct { + // 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"` +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { + ReservedIPTargetPrototypeIntf + isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext : ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct // This model "extends" ReservedIPTarget type ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct { @@ -91588,9 +98454,18 @@ type ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struc Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` // 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=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=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 name for this bare metal server network interface. @@ -91816,9 +98691,18 @@ type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 name for this instance network interface. @@ -93501,9 +100385,18 @@ type SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetC Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` // 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=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=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 name for this bare metal server network interface. @@ -93686,9 +100579,18 @@ type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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 name for this instance network interface. @@ -93970,8 +100872,15 @@ func UnmarshalShareIdentityByID(m map[string]json.RawMessage, result interface{} return } -// ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : The virtual network interface for this share mount target. The virtual network interface's VPC must not be used by a -// virtual network interface for another mount target for this share. +// ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : The virtual network interface for this share mount target. The virtual network interface must: +// +// - have `allow_ip_spoofing` set to `false` +// - have `enable_infrastructure_nat` set to `true` +// - not be in the same VPC as an existing mount target for this share +// - not have `ips` other than the `primary_ip` address +// +// If an existing virtual network interface is specified, it must not have a floating IP bound to it, and it must not be +// the target of a flow log collector. // // Required if the share's `access_control_mode` is `security_group`. // This model "extends" ShareMountTargetPrototype @@ -94091,9 +101000,89 @@ func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(m return } +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototype +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity struct { + // 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"` +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityIntf interface { + ShareMountTargetVirtualNetworkInterfacePrototypeIntf + isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext : The virtual network interface for this target. // This model "extends" ShareMountTargetVirtualNetworkInterfacePrototype type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext 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"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,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"` + + // 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"` + // 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. @@ -94130,6 +101119,22 @@ func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePr // UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext from the specified map of raw messages. func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -97617,6 +104622,89 @@ func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernameP 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: +// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID +// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref +// This model "extends" VirtualNetworkInterfaceIPPrototype +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { + return true +} + +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextIntf interface { + VirtualNetworkInterfaceIPPrototypeIntf + isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext : The prototype for a new reserved IP. Must be in the primary IP's subnet. +// This model "extends" VirtualNetworkInterfaceIPPrototype +type VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext : Identifies a reserved IP by a unique property. Required if `subnet` is not specified. The reserved IP must be // currently unbound. // Models which "extend" this model: @@ -97700,6 +104788,105 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtua return } +// VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct +// This model "extends" VirtualNetworkInterfaceTarget +type VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { + // 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 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 resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" +) + +func (*VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext) isaVirtualNetworkInterfaceTarget() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext unmarshals an instance of VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct +// This model "extends" VirtualNetworkInterfaceTarget +type VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` + + // The name for this instance 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 VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" +) + +func (*VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) isaVirtualNetworkInterfaceTarget() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext unmarshals an instance of VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VirtualNetworkInterfaceTargetShareMountTargetReference : VirtualNetworkInterfaceTargetShareMountTargetReference struct // This model "extends" VirtualNetworkInterfaceTarget type VirtualNetworkInterfaceTargetShareMountTargetReference struct { @@ -98329,6 +105516,111 @@ func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCR return } +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // EndpointGatewayReservedIPReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityByHref struct // This model "extends" EndpointGatewayReservedIPReservedIPIdentity type EndpointGatewayReservedIPReservedIPIdentityByHref struct { @@ -98504,6 +105796,10 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentit // This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { // 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=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` } @@ -98539,6 +105835,11 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMe // This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { // 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=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"` } @@ -98574,6 +105875,10 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMe // This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` } @@ -98609,6 +105914,11 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdent // This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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"` } @@ -98640,10 +105950,119 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdent return } +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct // This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { // 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=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` } @@ -98679,6 +106098,11 @@ func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBa // This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { // 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=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"` } @@ -98714,6 +106138,10 @@ func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBa // This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` } @@ -98749,6 +106177,11 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceI // This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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"` } @@ -98780,6 +106213,111 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceI return } +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct // This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { @@ -98885,10 +106423,84 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByI return } +// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref : FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref struct { + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID : FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID struct { + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID : Instantiate FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct // This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { // The URL for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network + // attachment. Href *string `json:"href" validate:"required"` } @@ -98924,6 +106536,11 @@ func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInte // This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { // The unique identifier for this instance network interface. + // + // If this instance has network attachments, this network interface is a + // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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"` } @@ -99165,6 +106782,111 @@ func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(m map[st return } +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec struct // Models which "extend" this model: // - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup @@ -99308,84 +107030,4190 @@ type InstanceGroupManagerActionScheduledActionGroupTarget struct { // manager. Name *string `json:"name" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type" validate:"required"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroup `json:"group" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetStatusActiveConst = "active" + InstanceGroupManagerActionScheduledActionGroupTargetStatusCompletedConst = "completed" + InstanceGroupManagerActionScheduledActionGroupTargetStatusFailedConst = "failed" + InstanceGroupManagerActionScheduledActionGroupTargetStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionScheduledActionGroupTargetStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerActionScheduledAction() bool { + return true +} + +func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerAction() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionGroupTarget from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionScheduledActionGroupTarget) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionScheduledActionManagerTarget : InstanceGroupManagerActionScheduledActionManagerTarget struct +// This model "extends" InstanceGroupManagerActionScheduledAction +type InstanceGroupManagerActionScheduledActionManagerTarget struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. 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`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the + // future. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` + + // The date and time that the instance group manager action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type" validate:"required"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetStatusActiveConst = "active" + InstanceGroupManagerActionScheduledActionManagerTargetStatusCompletedConst = "completed" + InstanceGroupManagerActionScheduledActionManagerTargetStatusFailedConst = "failed" + InstanceGroupManagerActionScheduledActionManagerTargetStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionScheduledActionManagerTargetStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerActionScheduledAction() bool { + return true +} + +func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerAction() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionManagerTarget from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionScheduledActionManagerTarget) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct +// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(href string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref, err error) { + _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { + return true +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct +// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(id string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID, err error) { + _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { + return true +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct { + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct { + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct { + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct { + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct { + // The CRN for this placement group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct { + // The URL for this placement group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct { + // The unique identifier for this placement group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceByCatalogOffering +type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment{ + CatalogOffering: catalogOffering, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstancePrototypeInstanceByCatalogOffering() bool { + return true +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceByCatalogOffering +type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstancePrototypeInstanceByCatalogOffering() bool { + return true +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment : InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceByImage +type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment{ + Image: image, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstancePrototypeInstanceByImage() bool { + return true +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface : InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceByImage +type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface{ + Image: image, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstancePrototypeInstanceByImage() bool { + return true +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceBySourceSnapshot +type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment{ + BootVolumeAttachment: bootVolumeAttachment, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstancePrototypeInstanceBySourceSnapshot() bool { + return true +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceBySourceSnapshot +type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstancePrototypeInstanceBySourceSnapshot() bool { + return true +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment : InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceByVolume +type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment{ + BootVolumeAttachment: bootVolumeAttachment, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) isaInstancePrototypeInstanceByVolume() bool { + return true +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface : InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceByVolume +type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) isaInstancePrototypeInstanceByVolume() bool { + return true +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering +type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment{ + CatalogOffering: catalogOffering, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering +type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage +type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment{ + Image: image, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage +type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface{ + Image: image, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment{ + BootVolumeAttachment: bootVolumeAttachment, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { + return true +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { + return true +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceByImageInstanceTemplateContext +type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { + return true +} + +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceByImageInstanceTemplateContext +type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The status of the instance group action - // - `active`: Action is ready to be run - // - `completed`: Action was completed successfully - // - `failed`: Action could not be completed successfully - // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. - Status *string `json:"status" validate:"required"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - // The date and time that the instance group manager action was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - // The type of action for the instance group. - ActionType *string `json:"action_type" validate:"required"` + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The date and time the scheduled action was last applied. If absent, the action has never been applied. - LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` - // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run - // time. - NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - Group *InstanceGroupManagerScheduledActionGroup `json:"group" validate:"required"` -} + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` -// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ResourceType property. -// The resource type. -const ( - InstanceGroupManagerActionScheduledActionGroupTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" -) + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` -// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.Status property. -// The status of the instance group action -// - `active`: Action is ready to be run -// - `completed`: Action was completed successfully -// - `failed`: Action could not be completed successfully -// - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. -const ( - InstanceGroupManagerActionScheduledActionGroupTargetStatusActiveConst = "active" - InstanceGroupManagerActionScheduledActionGroupTargetStatusCompletedConst = "completed" - InstanceGroupManagerActionScheduledActionGroupTargetStatusFailedConst = "failed" - InstanceGroupManagerActionScheduledActionGroupTargetStatusIncompatibleConst = "incompatible" - InstanceGroupManagerActionScheduledActionGroupTargetStatusOmittedConst = "omitted" -) + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` -// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ActionType property. -// The type of action for the instance group. -const ( - InstanceGroupManagerActionScheduledActionGroupTargetActionTypeScheduledConst = "scheduled" -) + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} -func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerActionScheduledAction() bool { +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { return true } -func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerAction() bool { +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionGroupTarget from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionScheduledActionGroupTarget) - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) +// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } @@ -99397,39 +111225,63 @@ func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string] if err != nil { return } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { return } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) if err != nil { return } - err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -99437,106 +111289,110 @@ func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string] return } -// InstanceGroupManagerActionScheduledActionManagerTarget : InstanceGroupManagerActionScheduledActionManagerTarget struct -// This model "extends" InstanceGroupManagerActionScheduledAction -type InstanceGroupManagerActionScheduledActionManagerTarget struct { - // Indicates whether this scheduled action will be automatically deleted after it has completed and - // `auto_delete_timeout` hours have passed. 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`, and this scheduled action has finished, the hours after which it will be automatically - // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the - // future. - AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` +// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - // The date and time that the instance group manager action was created. + // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The URL for this instance group manager action. + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. Href *string `json:"href" validate:"required"` - // The unique identifier for this instance group manager action. + // The unique identifier for this instance template. ID *string `json:"id" validate:"required"` - // The name for this instance group manager action. The name is unique across all actions for the instance group - // manager. + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. Name *string `json:"name" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - // The status of the instance group action - // - `active`: Action is ready to be run - // - `completed`: Action was completed successfully - // - `failed`: Action could not be completed successfully - // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. - Status *string `json:"status" validate:"required"` + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - // The date and time that the instance group manager action was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - // The type of action for the instance group. - ActionType *string `json:"action_type" validate:"required"` + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` - // The date and time the scheduled action was last applied. If absent, the action has never been applied. - LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run - // time. - NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` - Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager" validate:"required"` -} + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` -// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ResourceType property. -// The resource type. -const ( - InstanceGroupManagerActionScheduledActionManagerTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" -) + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` -// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.Status property. -// The status of the instance group action -// - `active`: Action is ready to be run -// - `completed`: Action was completed successfully -// - `failed`: Action could not be completed successfully -// - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. -const ( - InstanceGroupManagerActionScheduledActionManagerTargetStatusActiveConst = "active" - InstanceGroupManagerActionScheduledActionManagerTargetStatusCompletedConst = "completed" - InstanceGroupManagerActionScheduledActionManagerTargetStatusFailedConst = "failed" - InstanceGroupManagerActionScheduledActionManagerTargetStatusIncompatibleConst = "incompatible" - InstanceGroupManagerActionScheduledActionManagerTargetStatusOmittedConst = "omitted" -) + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ActionType property. -// The type of action for the instance group. -const ( - InstanceGroupManagerActionScheduledActionManagerTargetActionTypeScheduledConst = "scheduled" -) + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` -func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerActionScheduledAction() bool { + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { return true } -func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerAction() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { return true } -// UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionManagerTarget from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionScheduledActionManagerTarget) - err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } @@ -99544,285 +111400,83 @@ func UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget(m map[strin if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct -// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype -type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct { - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The URL for this instance group manager. - Href *string `json:"href" validate:"required"` -} - -// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(href string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref, err error) { - _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { - return true -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { return } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct -// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype -type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct { - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The unique identifier for this instance group manager. - ID *string `json:"id" validate:"required"` -} - -// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(id string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID, err error) { - _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { - return true -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity -type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity -type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity -type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity -type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct { - // The CRN for this dedicated host. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } @@ -99830,384 +111484,194 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIden return } -// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity -type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct { - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` -} +// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` -// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { - return true -} + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatch() bool { - return true -} + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` -// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The URL for this instance template. + Href *string `json:"href" validate:"required"` -// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity -type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct { - // The unique identifier for this dedicated host. + // The unique identifier for this instance template. ID *string `json:"id" validate:"required"` -} -// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { - return true -} + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatch() bool { - return true -} + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` -// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The placement restrictions to use for the virtual server instance. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` -// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` -} + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` -// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - return -} + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { - return true -} + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { - return true -} + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` -// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` -} + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` -// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - return -} + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { - return true -} + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { - return true -} + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` -// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` -} + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` -// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { return true } -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { return true } -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity -type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct { - // The CRN for this dedicated host. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN{ - CRN: core.StringPtr(crn), + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity -type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct { - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref{ - Href: core.StringPtr(href), + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity -type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct { - // The unique identifier for this dedicated host. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct -// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity -type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct { - // The CRN for this placement group. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN, err error) { - _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN{ - CRN: core.StringPtr(crn), + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct -// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity -type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct { - // The URL for this placement group. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref, err error) { - _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref{ - Href: core.StringPtr(href), + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct -// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity -type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct { - // The unique identifier for this placement group. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID, err error) { - _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID{ - ID: core.StringPtr(id), + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -100775,6 +112239,111 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIde return } +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP : RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct // This model "extends" RouteNextHopPatchRouteNextHopIP type RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct { @@ -101289,6 +112858,181 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroup return } +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct +// This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref(href string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref, err error) { + _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { + return true +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID struct +// This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID(id string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID, err error) { + _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { + return true +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref struct // This model "extends" VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref struct { @@ -104063,6 +115807,91 @@ func (pager *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err er return pager.GetAllWithContext(context.Background()) } +// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. +type BareMetalServerNetworkAttachmentsPager struct { + hasNext bool + options *ListBareMetalServerNetworkAttachmentsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBareMetalServerNetworkAttachmentsOptions = *options + pager = &BareMetalServerNetworkAttachmentsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BareMetalServerNetworkAttachmentsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkAttachmentIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.NetworkAttachments + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { + for pager.HasNext() { + var nextPage []BareMetalServerNetworkAttachmentIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + // BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. type BareMetalServerNetworkInterfacesPager struct { hasNext bool @@ -104828,6 +116657,176 @@ func (pager *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkI return pager.GetAllWithContext(context.Background()) } +// NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "ListNetworkInterfaceFloatingIps" method. +type NetworkInterfaceFloatingIpsPager struct { + hasNext bool + options *ListNetworkInterfaceFloatingIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewNetworkInterfaceFloatingIpsPager returns a new NetworkInterfaceFloatingIpsPager instance. +func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterfaceFloatingIpsOptions) (pager *NetworkInterfaceFloatingIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListNetworkInterfaceFloatingIpsOptions = *options + pager = &NetworkInterfaceFloatingIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *NetworkInterfaceFloatingIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIPReference, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListNetworkInterfaceFloatingIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.FloatingIps + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIPReference, err error) { + for pager.HasNext() { + var nextPage []FloatingIPReference + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *NetworkInterfaceFloatingIpsPager) GetNext() (page []FloatingIPReference, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *NetworkInterfaceFloatingIpsPager) GetAll() (allItems []FloatingIPReference, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "ListVirtualNetworkInterfaceIps" method. +type VirtualNetworkInterfaceIpsPager struct { + hasNext bool + options *ListVirtualNetworkInterfaceIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVirtualNetworkInterfaceIpsPager returns a new VirtualNetworkInterfaceIpsPager instance. +func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetworkInterfaceIpsOptions) (pager *VirtualNetworkInterfaceIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVirtualNetworkInterfaceIpsOptions = *options + pager = &VirtualNetworkInterfaceIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VirtualNetworkInterfaceIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIPReference, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVirtualNetworkInterfaceIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Ips + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIPReference, err error) { + for pager.HasNext() { + var nextPage []ReservedIPReference + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VirtualNetworkInterfaceIpsPager) GetNext() (page []ReservedIPReference, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPReference, err error) { + return pager.GetAllWithContext(context.Background()) +} + // PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. type PublicGatewaysPager struct { hasNext bool From 977ce3a5b48ac0624f0913e9beb113eed72806e6 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 20 Dec 2023 12:31:04 +0530 Subject: [PATCH 048/103] migration updated --- go.mod | 2 +- ibm/service/vpc/resource_ibm_is_bare_metal_server.go | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 7ea5561438..84c9a742e0 100644 --- a/go.mod +++ b/go.mod @@ -237,7 +237,7 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.45.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.46.0 => ./common/github.com/IBM/vpc-go-sdk exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 diff --git a/ibm/service/vpc/resource_ibm_is_bare_metal_server.go b/ibm/service/vpc/resource_ibm_is_bare_metal_server.go index 94c1ede67f..8e419168b9 100644 --- a/ibm/service/vpc/resource_ibm_is_bare_metal_server.go +++ b/ibm/service/vpc/resource_ibm_is_bare_metal_server.go @@ -696,7 +696,8 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou if err != nil { return diag.FromErr(err) } - options := &vpcv1.CreateBareMetalServerOptions{} + createbmsoptions := &vpcv1.CreateBareMetalServerOptions{} + options := &vpcv1.BareMetalServerPrototype{} var imageStr string if image, ok := d.GetOk(isBareMetalServerImage); ok { imageStr = image.(string) @@ -705,7 +706,7 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou // enable secure boot if _, ok := d.GetOkExists(isBareMetalServerEnableSecureBoot); ok { - options.SetEnableSecureBoot(d.Get(isBareMetalServerEnableSecureBoot).(bool)) + options.EnableSecureBoot = core.BoolPtr(d.Get(isBareMetalServerEnableSecureBoot).(bool)) } // trusted_platform_module @@ -715,7 +716,7 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou if err != nil { return diag.FromErr(err) } - options.SetTrustedPlatformModule(trustedPlatformModuleModel) + options.TrustedPlatformModule = trustedPlatformModuleModel } keySet := d.Get(isBareMetalServerKeys).(*schema.Set) @@ -1300,8 +1301,8 @@ func resourceIBMISBareMetalServerCreate(context context.Context, d *schema.Resou ID: &vpc, } } - - bms, response, err := sess.CreateBareMetalServerWithContext(context, options) + createbmsoptions.BareMetalServerPrototype = options + bms, response, err := sess.CreateBareMetalServerWithContext(context, createbmsoptions) if err != nil { return diag.FromErr(fmt.Errorf("[DEBUG] Create bare metal server err %s\n%s", err, response)) } From 6bbf64849da3be4201040b6e238108684bf8e9ec Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 24 Jan 2024 19:34:23 +0530 Subject: [PATCH 049/103] Update build.sh --- scripts/build.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 9d374b19d0..2cbb3f93b6 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -51,13 +51,14 @@ if [[ -n "${TF_RELEASE}" ]]; then fi # Build! +VERSION="1.62.0" echo "==> Building..." gox \ -os="${XC_OS}" \ -arch="${XC_ARCH}" \ -osarch="${XC_EXCLUDE_OSARCH}" \ -ldflags "${LD_FLAGS}" \ - -output "pkg/{{.OS}}_{{.Arch}}/terraform-provider-ibm" \ + -output "pkg/{{.OS}}_{{.Arch}}/terraform-provider-ibm_${VERSION}_{{.OS}}_{{.Arch}}" \ . # Move all the compiled things to the $GOPATH/bin @@ -91,10 +92,11 @@ if [ "${TF_DEV}x" = "x" ]; then echo "==> Packaging..." for PLATFORM in $(find ./pkg -mindepth 1 -maxdepth 1 -type d); do OSARCH=$(basename ${PLATFORM}) + ZIPNAME="terraform-provider-ibm_${VERSION}_${OSARCH}" echo "--> ${OSARCH}" pushd $PLATFORM >/dev/null 2>&1 - zip ../${OSARCH}.zip ./* + zip ../${ZIPNAME}.zip ./* popd >/dev/null 2>&1 done fi From f7a9d9c22d76c12f4ba71592a2749f8d256290de Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Mon, 29 Jan 2024 11:43:01 +0530 Subject: [PATCH 050/103] Update vpc_v1.go --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 4470 ++++++++++++----- 1 file changed, 3332 insertions(+), 1138 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index ad1d930d93..e4b19462a6 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2021, 2022, 2023. + * (C) Copyright IBM Corp. 2022, 2023, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.80.0-29334a73-20230925-151553 + * IBM OpenAPI SDK Code Generator Version: 3.84.0-a4533f12-20240103-170852 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -31,14 +31,14 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" - common "github.com/IBM/vpc-go-sdk/common" "github.com/go-openapi/strfmt" + common "github.ibm.com/ibmcloud/vpc-go-sdk/common" ) // 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: 2023-12-20 +// API Version: 2024-01-24 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 `2023-12-05` - // and `2023-12-20`. + // and `2024-01-29`. Version *string } @@ -64,7 +64,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2023-12-20`. + // and `2024-01-29`. Version *string } @@ -3261,7 +3261,7 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne // This request replaces the existing routing table for a subnet with the routing table specified in the request body. // // For this request to succeed, the routing table `route_direct_link_ingress`, -// `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. +// `route_internet_ingress`, `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { return vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) } @@ -5435,6 +5435,15 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt if listInstancesOptions.PlacementGroupName != nil { builder.AddQuery("placement_group.name", fmt.Sprint(*listInstancesOptions.PlacementGroupName)) } + if listInstancesOptions.ReservationID != nil { + builder.AddQuery("reservation.id", fmt.Sprint(*listInstancesOptions.ReservationID)) + } + if listInstancesOptions.ReservationCRN != nil { + builder.AddQuery("reservation.crn", fmt.Sprint(*listInstancesOptions.ReservationCRN)) + } + if listInstancesOptions.ReservationName != nil { + builder.AddQuery("reservation.name", fmt.Sprint(*listInstancesOptions.ReservationName)) + } request, err := builder.Build() if err != nil { @@ -5565,6 +5574,9 @@ func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceO for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + if deleteInstanceOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteInstanceOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -5682,6 +5694,9 @@ func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceO } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateInstanceOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateInstanceOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -6475,8 +6490,8 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context // the instance may also attach to the same subnet. // // If this instance has network attachments, each returned network interface is a [read-only -// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and -// its attached virtual network interface. +// 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. func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) } @@ -6545,8 +6560,8 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, // specified. Addresses on the instance network interface must be within the specified subnet's CIDR blocks. // // If this instance has network attachments, each network interface is a [read-only -// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and -// its attached virtual network interface, and new network interfaces are not allowed to be created. +// 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 new network interfaces are not allowed to be created. func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) } @@ -6637,8 +6652,8 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, // not allowed to be deleted. // // If this instance has network attachments, this network interface is a [read-only -// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and -// its attached virtual network interface, and is not allowed to be deleted. +// 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 is not allowed to be deleted. func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) } @@ -6693,8 +6708,8 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, // This request retrieves a single instance network interface specified by the identifier in the URL. // // If this instance has network attachments, the retrieved network interface is a -// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network -// attachment and its attached virtual network interface. +// [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. func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) } @@ -6763,8 +6778,8 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge // network interface and needs to contain only the information to be updated. // // If this instance has network attachments, this network interface is a [read-only -// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and -// its attached virtual network interface, and is not allowed to be updated. +// 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 is not allowed to be updated. func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) } @@ -9236,6 +9251,416 @@ func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, return } +// ListReservations : List all reservations +// This request lists all reservations in the region. A reservation provides reserved capacity for a specified profile +// in a specified zone. A reservation can also include a long-term committed use discount. +// +// The reservations will be sorted by their `created_at` property values, with newest reservations first. Reservations +// with identical `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListReservations(listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { + return vpc.ListReservationsWithContext(context.Background(), listReservationsOptions) +} + +// ListReservationsWithContext is an alternate form of the ListReservations method which supports a Context parameter +func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listReservationsOptions, "listReservationsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listReservationsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListReservations") + 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 listReservationsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listReservationsOptions.Start)) + } + if listReservationsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listReservationsOptions.Limit)) + } + if listReservationsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listReservationsOptions.Name)) + } + if listReservationsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listReservationsOptions.ResourceGroupID)) + } + if listReservationsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listReservationsOptions.ZoneName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservationCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateReservation : Create a reservation +// This request creates a new reservation from a reservation prototype object. The prototype object is structured in the +// same way as a retrieved reservation, and contains the information necessary to create the new reservation. +func (vpc *VpcV1) CreateReservation(createReservationOptions *CreateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + return vpc.CreateReservationWithContext(context.Background(), createReservationOptions) +} + +// CreateReservationWithContext is an alternate form of the CreateReservation method which supports a Context parameter +func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReservationOptions *CreateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createReservationOptions, "createReservationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createReservationOptions, "createReservationOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createReservationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateReservation") + 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 createReservationOptions.Capacity != nil { + body["capacity"] = createReservationOptions.Capacity + } + if createReservationOptions.CommittedUse != nil { + body["committed_use"] = createReservationOptions.CommittedUse + } + if createReservationOptions.Profile != nil { + body["profile"] = createReservationOptions.Profile + } + if createReservationOptions.Zone != nil { + body["zone"] = createReservationOptions.Zone + } + if createReservationOptions.AffinityPolicy != nil { + body["affinity_policy"] = createReservationOptions.AffinityPolicy + } + if createReservationOptions.Name != nil { + body["name"] = createReservationOptions.Name + } + if createReservationOptions.ResourceGroup != nil { + body["resource_group"] = createReservationOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteReservation : Delete a reservation +// This request deletes a reservation. This operation cannot be reversed. Reservations with a `status` of `active` are +// not allowed to be deleted. +func (vpc *VpcV1) DeleteReservation(deleteReservationOptions *DeleteReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + return vpc.DeleteReservationWithContext(context.Background(), deleteReservationOptions) +} + +// DeleteReservationWithContext is an alternate form of the DeleteReservation method which supports a Context parameter +func (vpc *VpcV1) DeleteReservationWithContext(ctx context.Context, deleteReservationOptions *DeleteReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteReservationOptions, "deleteReservationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteReservationOptions, "deleteReservationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteReservationOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteReservationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteReservation") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetReservation : Retrieve a reservation +// This request retrieves a single reservation specified by identifier in the URL. +func (vpc *VpcV1) GetReservation(getReservationOptions *GetReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + return vpc.GetReservationWithContext(context.Background(), getReservationOptions) +} + +// GetReservationWithContext is an alternate form of the GetReservation method which supports a Context parameter +func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationOptions *GetReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getReservationOptions, "getReservationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getReservationOptions, "getReservationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getReservationOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getReservationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetReservation") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateReservation : Update a reservation +// This request updates a reservation with the information provided in a reservation patch object. The patch object is +// structured in the same way as a retrieved reservation and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateReservation(updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + return vpc.UpdateReservationWithContext(context.Background(), updateReservationOptions) +} + +// UpdateReservationWithContext is an alternate form of the UpdateReservation method which supports a Context parameter +func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateReservationOptions, "updateReservationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateReservationOptions, "updateReservationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateReservationOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateReservationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateReservation") + 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(updateReservationOptions.ReservationPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ActivateReservation : Activate a reservation +// This request activates a reservation. For this request to succeed, the reservation status must be `inactive`. +func (vpc *VpcV1) ActivateReservation(activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { + return vpc.ActivateReservationWithContext(context.Background(), activateReservationOptions) +} + +// ActivateReservationWithContext is an alternate form of the ActivateReservation method which supports a Context parameter +func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(activateReservationOptions, "activateReservationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(activateReservationOptions, "activateReservationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *activateReservationOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}/activate`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range activateReservationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ActivateReservation") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + // ListDedicatedHostGroups : List all dedicated host groups // This request lists all dedicated host groups in the region. Host groups are a collection of dedicated hosts for // placement of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. @@ -12304,8 +12729,8 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. // the bare metal server. // // If this bare metal server has network attachments, each returned network interface is a [read-only -// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and -// its attached virtual network interface. +// 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. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) } @@ -12381,8 +12806,8 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co // Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. // // If this bare metal server has network attachments, each network interface is a [read-only -// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and -// its attached virtual network interface, and new network interfaces are not allowed to be created. +// 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 new network interfaces are not allowed to be created. func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) } @@ -12456,8 +12881,8 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C // network interface is not allowed to be deleted. // // If this bare metal server has network attachments, this network interface is a [read-only -// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and -// its attached virtual network interface, and is not allowed to be deleted. +// 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 is not allowed to be deleted. func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) } @@ -12512,8 +12937,8 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C // This request retrieves a single bare metal server network interface specified by the identifier in the URL. // // If this bare metal server has network attachments, the retrieved network interface is a [read-only -// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and -// its attached virtual network interface. +// 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. func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) } @@ -12582,8 +13007,8 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont // a retrieved bare metal server network interface and needs to contain only the information to be updated. // // If this bare metal server has network attachments, this network interface is a [read-only -// representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment and -// its attached virtual network interface, and is not allowed to be updated. +// 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 is not allowed to be updated. func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) } @@ -25545,6 +25970,34 @@ func UnmarshalAccountReference(m map[string]json.RawMessage, result interface{}) 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. @@ -27668,8 +28121,8 @@ type BareMetalServer struct { // 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=vni-old-api-clients) of its corresponding network - // attachment and its attached virtual network interface. + // [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 primary network attachment for this bare metal server. @@ -27679,7 +28132,7 @@ type BareMetalServer struct { // // If this bare metal server has network attachments, this primary network interface is // a [read-only - // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) + // 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"` @@ -29089,16 +29542,16 @@ 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=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. + // [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=vni-old-api-clients) when its corresponding network attachment - // was created. + // 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`: @@ -29112,32 +29565,32 @@ type BareMetalServerNetworkInterface struct { // - `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=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. + // [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=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. + // [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=vni-old-api-clients) of its corresponding network - // attachment. + // [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=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. + // [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: @@ -29155,9 +29608,9 @@ type BareMetalServerNetworkInterface struct { // 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=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. + // [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 are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the @@ -29168,24 +29621,25 @@ type BareMetalServerNetworkInterface struct { // will be an empty string. // // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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=vni-old-api-clients) of its corresponding network - // attachment and its attached virtual network interface, and the name matches its corresponding network attachment. + // [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=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. + // [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"` @@ -29196,16 +29650,16 @@ type BareMetalServerNetworkInterface struct { // 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=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. + // [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=vni-old-api-clients). + // them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients). Status *string `json:"status" validate:"required"` // The associated subnet. @@ -29214,16 +29668,17 @@ type BareMetalServerNetworkInterface struct { // 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=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. + // [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=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. + // [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 @@ -29238,17 +29693,17 @@ type BareMetalServerNetworkInterface struct { // 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=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. + // [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=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. + // [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"` } @@ -29268,9 +29723,9 @@ type BareMetalServerNetworkInterface struct { // 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=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. +// [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 are expected to expand in the future. When processing this property, check // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the @@ -29292,7 +29747,7 @@ const ( // // 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=vni-old-api-clients). +// them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients). const ( BareMetalServerNetworkInterfaceStatusAvailableConst = "available" BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting" @@ -29304,8 +29759,9 @@ const ( // 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=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. +// [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" @@ -29441,9 +29897,9 @@ 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=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. + // [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 to allow for `vlan` interfaces using this PCI interface, replacing any existing VLAN IDs. The specified @@ -29461,9 +29917,9 @@ type BareMetalServerNetworkInterfacePatch struct { // - `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=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. + // [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 @@ -29513,9 +29969,9 @@ 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=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. + // [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`: @@ -29529,9 +29985,9 @@ type BareMetalServerNetworkInterfacePrototype struct { // - `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=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. + // [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: @@ -29586,17 +30042,17 @@ type BareMetalServerNetworkInterfacePrototype struct { // 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=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. + // [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=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. + // [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"` } @@ -29814,17 +30270,17 @@ 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=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. + // [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=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. + // [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"` // If `true`: @@ -29838,9 +30294,9 @@ type BareMetalServerPrimaryNetworkInterfacePrototype struct { // - `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=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. + // [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: @@ -32884,9 +33340,9 @@ type CreateInstanceNetworkInterfaceOptions struct { // Indicates whether source IP spoofing is allowed on this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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 name for the instance network interface. The name must not be used by another network interface on the virtual @@ -34235,6 +34691,102 @@ func (options *CreatePublicGatewayOptions) SetHeaders(param map[string]string) * return options } +// CreateReservationOptions : The CreateReservation options. +type CreateReservationOptions struct { + // The capacity reservation configuration to use. + Capacity *ReservationCapacityPrototype `json:"capacity" validate:"required"` + + // The committed use configuration to use for this reservation. + CommittedUse *ReservationCommittedUsePrototype `json:"committed_use" validate:"required"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this + // reservation. + Profile *ReservationProfilePrototype `json:"profile" validate:"required"` + + // The zone to use for this reservation. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The affinity policy to use for this reservation: + // - `restricted`: The reservation must be manually requested. + AffinityPolicy *string `json:"affinity_policy,omitempty"` + + // The name for this reservation. The name must not be used by another reservation in the region. 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateReservationOptions.AffinityPolicy property. +// The affinity policy to use for this reservation: +// - `restricted`: The reservation must be manually requested. +const ( + CreateReservationOptionsAffinityPolicyRestrictedConst = "restricted" +) + +// NewCreateReservationOptions : Instantiate CreateReservationOptions +func (*VpcV1) NewCreateReservationOptions(capacity *ReservationCapacityPrototype, committedUse *ReservationCommittedUsePrototype, profile *ReservationProfilePrototype, zone ZoneIdentityIntf) *CreateReservationOptions { + return &CreateReservationOptions{ + Capacity: capacity, + CommittedUse: committedUse, + Profile: profile, + Zone: zone, + } +} + +// SetCapacity : Allow user to set Capacity +func (_options *CreateReservationOptions) SetCapacity(capacity *ReservationCapacityPrototype) *CreateReservationOptions { + _options.Capacity = capacity + return _options +} + +// SetCommittedUse : Allow user to set CommittedUse +func (_options *CreateReservationOptions) SetCommittedUse(committedUse *ReservationCommittedUsePrototype) *CreateReservationOptions { + _options.CommittedUse = committedUse + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *CreateReservationOptions) SetProfile(profile *ReservationProfilePrototype) *CreateReservationOptions { + _options.Profile = profile + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateReservationOptions) SetZone(zone ZoneIdentityIntf) *CreateReservationOptions { + _options.Zone = zone + return _options +} + +// SetAffinityPolicy : Allow user to set AffinityPolicy +func (_options *CreateReservationOptions) SetAffinityPolicy(affinityPolicy string) *CreateReservationOptions { + _options.AffinityPolicy = core.StringPtr(affinityPolicy) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateReservationOptions) SetName(name string) *CreateReservationOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateReservationOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateReservationOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateReservationOptions) SetHeaders(param map[string]string) *CreateReservationOptions { + options.Headers = param + return options +} + // CreateSecurityGroupOptions : The CreateSecurityGroup options. type CreateSecurityGroupOptions struct { // The VPC this security group will reside in. @@ -35017,8 +35569,13 @@ type CreateVPCRouteOptions struct { // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Destination *string `json:"destination" validate:"required"` - // The zone to apply the route to. (Traffic from subnets in this zone will be - // subject to this route.). + // The zone to apply the route 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 ZoneIdentityIntf `json:"zone" validate:"required"` // The action to perform with a packet matching the route: @@ -35297,8 +35854,13 @@ type CreateVPCRoutingTableRouteOptions struct { // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. Destination *string `json:"destination" validate:"required"` - // The zone to apply the route to. (Traffic from subnets in this zone will be - // subject to this route.). + // The zone to apply the route 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 ZoneIdentityIntf `json:"zone" validate:"required"` // The action to perform with a packet matching the route: @@ -38800,6 +39362,9 @@ type DeleteInstanceOptions struct { // The virtual server instance 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 } @@ -38817,6 +39382,12 @@ func (_options *DeleteInstanceOptions) SetID(id string) *DeleteInstanceOptions { return _options } +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteInstanceOptions) SetIfMatch(ifMatch string) *DeleteInstanceOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + // SetHeaders : Allow user to set Headers func (options *DeleteInstanceOptions) SetHeaders(param map[string]string) *DeleteInstanceOptions { options.Headers = param @@ -39334,6 +39905,34 @@ func (options *DeletePublicGatewayOptions) SetHeaders(param map[string]string) * return options } +// DeleteReservationOptions : The DeleteReservation options. +type DeleteReservationOptions struct { + // The reservation identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteReservationOptions : Instantiate DeleteReservationOptions +func (*VpcV1) NewDeleteReservationOptions(id string) *DeleteReservationOptions { + return &DeleteReservationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteReservationOptions) SetID(id string) *DeleteReservationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteReservationOptions) SetHeaders(param map[string]string) *DeleteReservationOptions { + options.Headers = param + return options +} + // DeleteSecurityGroupOptions : The DeleteSecurityGroup options. type DeleteSecurityGroupOptions struct { // The security group identifier. @@ -41483,16 +42082,16 @@ type FloatingIPTarget struct { // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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,omitempty"` // The unique identifier for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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,omitempty"` // The name for this instance network interface. @@ -41581,16 +42180,16 @@ type FloatingIPTargetPatch struct { // 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=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. + // [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,omitempty"` // 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=vni-old-api-clients) of its corresponding network - // attachment. + // [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,omitempty"` // The CRN for this virtual network interface. @@ -41639,16 +42238,16 @@ type FloatingIPTargetPrototype struct { // 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=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. + // [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,omitempty"` // 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=vni-old-api-clients) of its corresponding network - // attachment. + // [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,omitempty"` // The CRN for this virtual network interface. @@ -41985,16 +42584,16 @@ type FlowLogCollectorTarget struct { // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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,omitempty"` // The unique identifier for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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,omitempty"` // The name for this instance network interface. @@ -42086,16 +42685,16 @@ type FlowLogCollectorTargetPrototype struct { // The unique identifier for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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,omitempty"` // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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,omitempty"` // The CRN for this virtual server instance. @@ -44067,6 +44666,34 @@ func (options *GetRegionZoneOptions) SetHeaders(param map[string]string) *GetReg return options } +// GetReservationOptions : The GetReservation options. +type GetReservationOptions struct { + // The reservation identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetReservationOptions : Instantiate GetReservationOptions +func (*VpcV1) NewGetReservationOptions(id string) *GetReservationOptions { + return &GetReservationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetReservationOptions) SetID(id string) *GetReservationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetReservationOptions) SetHeaders(param map[string]string) *GetReservationOptions { + options.Headers = param + return options +} + // GetSecurityGroupOptions : The GetSecurityGroup options. type GetSecurityGroupOptions struct { // The security group identifier. @@ -47133,6 +47760,27 @@ type Instance struct { // The virtual server instance GPU configuration. Gpu *InstanceGpu `json:"gpu,omitempty"` + // The reasons for the current instance `health_state` (if any): + // - `reservation_capacity_unavailable`: The reservation affinity pool has no + // available capacity. + // - `reservation_deleted`: The reservation affinity pool has a deleted reservation. + // - `reservation_expired`: The reservation affinity pool has an expired reservation. + // - `reservation_failed`: The reservation affinity pool has a failed reservation. + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []InstanceHealthReason `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 virtual server instance. Href *string `json:"href" validate:"required"` @@ -47167,8 +47815,8 @@ type Instance struct { // The network interfaces for this instance, including the primary network interface. // // If this instance has network attachments, each network interface is a [read-only - // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network attachment - // and its attached virtual network interface. + // 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 []NetworkInterfaceInstanceContextReference `json:"network_interfaces" validate:"required"` // The number of NUMA nodes this virtual server instance is provisioned on. @@ -47186,7 +47834,7 @@ type Instance struct { // // If this instance has network attachments, this primary network interface is a // [read-only - // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) + // 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 *NetworkInterfaceInstanceContextReference `json:"primary_network_interface" validate:"required"` @@ -47194,6 +47842,13 @@ type Instance struct { // server instance. Profile *InstanceProfileReference `json:"profile" validate:"required"` + // The reservation used by this virtual server instance. + // + // If absent, no reservation is in use. + Reservation *ReservationReference `json:"reservation,omitempty"` + + ReservationAffinity *InstanceReservationAffinity `json:"reservation_affinity" validate:"required"` + // The resource group for this instance. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -47239,6 +47894,21 @@ type Instance struct { Zone *ZoneReference `json:"zone" validate:"required"` } +// Constants associated with the Instance.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 ( + InstanceHealthStateDegradedConst = "degraded" + InstanceHealthStateFaultedConst = "faulted" + InstanceHealthStateInapplicableConst = "inapplicable" + InstanceHealthStateOkConst = "ok" +) + // Constants associated with the Instance.LifecycleState property. // The lifecycle state of the virtual server instance. const ( @@ -47313,6 +47983,14 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er if err != nil { return } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalInstanceHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -47373,6 +48051,14 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er if err != nil { return } + err = core.UnmarshalModel(m, "reservation", &obj.Reservation, UnmarshalReservationReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinity) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return @@ -50069,6 +50755,46 @@ func UnmarshalInstanceGroupReferenceDeleted(m map[string]json.RawMessage, result return } +// InstanceHealthReason : InstanceHealthReason struct +type InstanceHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the InstanceHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + InstanceHealthReasonCodeReservationCapacityUnavailableConst = "reservation_capacity_unavailable" + InstanceHealthReasonCodeReservationDeletedConst = "reservation_deleted" + InstanceHealthReasonCodeReservationExpiredConst = "reservation_expired" + InstanceHealthReasonCodeReservationFailedConst = "reservation_failed" +) + +// UnmarshalInstanceHealthReason unmarshals an instance of InstanceHealthReason from the specified map of raw messages. +func UnmarshalInstanceHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceInitialization : InstanceInitialization struct type InstanceInitialization struct { // The default trusted profile configuration specified at virtual server instance @@ -50758,6 +51484,8 @@ type InstancePatch struct { // The placement restrictions to use for the virtual server instance. For the placement // restrictions to be changed, the instance `status` must be `stopping` or `stopped`. + // + // 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, @@ -50774,6 +51502,8 @@ type InstancePatch struct { // currently has. Profile InstancePatchProfileIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPatch `json:"reservation_affinity,omitempty"` + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in // this value will result in a corresponding decrease to // `total_network_bandwidth`. @@ -50803,6 +51533,10 @@ func UnmarshalInstancePatch(m map[string]json.RawMessage, result interface{}) (e if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPatch) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { return @@ -51059,6 +51793,11 @@ type InstanceProfile struct { PortSpeed InstanceProfilePortSpeedIntf `json:"port_speed" validate:"required"` + ReservationTerms *InstanceProfileReservationTerms `json:"reservation_terms" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + // The status of the instance profile: // - `previous`: This instance profile is an older revision, but remains provisionable and // usable. @@ -51083,6 +51822,12 @@ type InstanceProfile struct { VcpuManufacturer *InstanceProfileVcpuManufacturer `json:"vcpu_manufacturer" validate:"required"` } +// Constants associated with the InstanceProfile.ResourceType property. +// The resource type. +const ( + InstanceProfileResourceTypeInstanceProfileConst = "instance_profile" +) + // Constants associated with the InstanceProfile.Status property. // The status of the instance profile: // - `previous`: This instance profile is an older revision, but remains provisionable and @@ -51165,6 +51910,14 @@ func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "reservation_terms", &obj.ReservationTerms, UnmarshalInstanceProfileReservationTerms) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { return @@ -52082,8 +52835,17 @@ type InstanceProfileReference struct { // The globally unique name for this virtual server instance profile. Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } +// Constants associated with the InstanceProfileReference.ResourceType property. +// The resource type. +const ( + InstanceProfileReferenceResourceTypeInstanceProfileConst = "instance_profile" +) + // UnmarshalInstanceProfileReference unmarshals an instance of InstanceProfileReference from the specified map of raw messages. func UnmarshalInstanceProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceProfileReference) @@ -52095,6 +52857,46 @@ func UnmarshalInstanceProfileReference(m map[string]json.RawMessage, result inte if err != nil { return } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileReservationTerms : InstanceProfileReservationTerms struct +type InstanceProfileReservationTerms struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported committed use terms for a reservation using this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileReservationTerms.Type property. +// The type for this profile field. +const ( + InstanceProfileReservationTermsTypeEnumConst = "enum" +) + +// Constants associated with the InstanceProfileReservationTerms.Values property. +const ( + InstanceProfileReservationTermsValuesOneYearConst = "one_year" + InstanceProfileReservationTermsValuesThreeYearConst = "three_year" +) + +// UnmarshalInstanceProfileReservationTerms unmarshals an instance of InstanceProfileReservationTerms from the specified map of raw messages. +func UnmarshalInstanceProfileReservationTerms(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileReservationTerms) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -52372,6 +53174,8 @@ type InstancePrototype struct { Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this @@ -52381,6 +53185,8 @@ type InstancePrototype struct { // in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,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"` @@ -52409,12 +53215,6 @@ type InstancePrototype struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone,omitempty"` @@ -52424,6 +53224,12 @@ type InstancePrototype struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering // or offering version to use when provisioning this virtual server instance. // @@ -52477,6 +53283,10 @@ func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{} if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -52505,23 +53315,23 @@ func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{} if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -52601,6 +53411,132 @@ func UnmarshalInstanceReferenceDeleted(m map[string]json.RawMessage, result inte return } +// InstanceReservationAffinity : InstanceReservationAffinity struct +type InstanceReservationAffinity struct { + // The reservation affinity policy to use for this virtual server instance: + // - `disabled`: Reservations will not be used + // - `manual`: Reservations in `pool` are available for use. + Policy *string `json:"policy" validate:"required"` + + // The pool of reservations available for use by this virtual server instance. + Pool []ReservationReference `json:"pool" validate:"required"` +} + +// Constants associated with the InstanceReservationAffinity.Policy property. +// The reservation affinity policy to use for this virtual server instance: +// - `disabled`: Reservations will not be used +// - `manual`: Reservations in `pool` are available for use. +const ( + InstanceReservationAffinityPolicyDisabledConst = "disabled" + InstanceReservationAffinityPolicyManualConst = "manual" +) + +// UnmarshalInstanceReservationAffinity unmarshals an instance of InstanceReservationAffinity from the specified map of raw messages. +func UnmarshalInstanceReservationAffinity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceReservationAffinity) + err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceReservationAffinityPatch : InstanceReservationAffinityPatch struct +type InstanceReservationAffinityPatch struct { + // The reservation affinity policy for this virtual server instance. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Policy *string `json:"policy,omitempty"` + + // The pool of reservations available for use by this virtual server instance, replacing the existing pool of + // reservations. + // + // Specified reservations must have a `status` of `active`, and have the same `profile` and + // `zone` as this virtual server instance. + // + // If `policy` is `manual`, a pool must be specified with at least one reservation. If + // `policy` is `disabled` and a pool is specified, it must be empty. + Pool []ReservationIdentityIntf `json:"pool,omitempty"` +} + +// Constants associated with the InstanceReservationAffinityPatch.Policy property. +// The reservation affinity policy for this virtual server instance. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + InstanceReservationAffinityPatchPolicyDisabledConst = "disabled" + InstanceReservationAffinityPatchPolicyManualConst = "manual" +) + +// UnmarshalInstanceReservationAffinityPatch unmarshals an instance of InstanceReservationAffinityPatch from the specified map of raw messages. +func UnmarshalInstanceReservationAffinityPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceReservationAffinityPatch) + err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceReservationAffinityPrototype : InstanceReservationAffinityPrototype struct +type InstanceReservationAffinityPrototype struct { + // The reservation affinity policy to use for this virtual server instance: + // - `disabled`: Reservations will not be used + // - `manual`: Reservations in `pool` will be available for use + // + // The policy will default to `manual` if `pool` is not empty, and `disabled` otherwise. + Policy *string `json:"policy,omitempty"` + + // The pool of reservations available for use by this virtual server instance. + // + // Specified reservations must have a `status` of `active`, and have the same `profile` and + // `zone` as this virtual server instance. + // + // If `policy` is `manual`, a pool must be specified with at least one reservation. If + // `policy` is `disabled` and a pool is specified, it must be empty. + Pool []ReservationIdentityIntf `json:"pool,omitempty"` +} + +// Constants associated with the InstanceReservationAffinityPrototype.Policy property. +// The reservation affinity policy to use for this virtual server instance: +// - `disabled`: Reservations will not be used +// - `manual`: Reservations in `pool` will be available for use +// +// The policy will default to `manual` if `pool` is not empty, and `disabled` otherwise. +const ( + InstanceReservationAffinityPrototypePolicyDisabledConst = "disabled" + InstanceReservationAffinityPrototypePolicyManualConst = "manual" +) + +// UnmarshalInstanceReservationAffinityPrototype unmarshals an instance of InstanceReservationAffinityPrototype from the specified map of raw messages. +func UnmarshalInstanceReservationAffinityPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceReservationAffinityPrototype) + err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceStatusReason : InstanceStatusReason struct type InstanceStatusReason struct { // A snake case string succinctly identifying the status reason. @@ -52616,16 +53552,18 @@ type InstanceStatusReason struct { // Constants associated with the InstanceStatusReason.Code property. // A snake case string succinctly identifying the status reason. const ( - InstanceStatusReasonCodeCannotStartConst = "cannot_start" - InstanceStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" - InstanceStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" - InstanceStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" - InstanceStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" - InstanceStatusReasonCodeCannotStartPlacementGroupConst = "cannot_start_placement_group" - InstanceStatusReasonCodeCannotStartStorageConst = "cannot_start_storage" - InstanceStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" - InstanceStatusReasonCodeStoppedByHostFailureConst = "stopped_by_host_failure" - InstanceStatusReasonCodeStoppedForImageCreationConst = "stopped_for_image_creation" + InstanceStatusReasonCodeCannotStartConst = "cannot_start" + InstanceStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" + InstanceStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" + InstanceStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" + InstanceStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" + InstanceStatusReasonCodeCannotStartPlacementGroupConst = "cannot_start_placement_group" + InstanceStatusReasonCodeCannotStartReservationCapacityConst = "cannot_start_reservation_capacity" + InstanceStatusReasonCodeCannotStartReservationExpiredConst = "cannot_start_reservation_expired" + InstanceStatusReasonCodeCannotStartStorageConst = "cannot_start_storage" + InstanceStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" + InstanceStatusReasonCodeStoppedByHostFailureConst = "stopped_by_host_failure" + InstanceStatusReasonCodeStoppedForImageCreationConst = "stopped_for_image_creation" ) // UnmarshalInstanceStatusReason unmarshals an instance of InstanceStatusReason from the specified map of raw messages. @@ -52697,6 +53635,8 @@ type InstanceTemplate struct { Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this @@ -52706,6 +53646,8 @@ type InstanceTemplate struct { // in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + // The resource group for this instance template. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -52733,12 +53675,6 @@ type InstanceTemplate struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone,omitempty"` @@ -52748,6 +53684,12 @@ type InstanceTemplate struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering // or offering version to use when provisioning this virtual server instance. // @@ -52814,6 +53756,10 @@ func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return @@ -52842,23 +53788,23 @@ func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -53060,6 +54006,8 @@ type InstanceTemplatePrototype struct { Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this @@ -53069,6 +54017,8 @@ type InstanceTemplatePrototype struct { // in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,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"` @@ -53097,12 +54047,6 @@ type InstanceTemplatePrototype struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image,omitempty"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone,omitempty"` @@ -53112,6 +54056,12 @@ type InstanceTemplatePrototype struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) // offering version to use when provisioning this virtual server instance. // If an offering is specified, the latest version of that offering will be used. @@ -53166,6 +54116,10 @@ func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result int if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -53194,23 +54148,23 @@ func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result int if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -55494,6 +56448,15 @@ type ListInstancesOptions struct { // group name. PlacementGroupName *string `json:"placement_group.name,omitempty"` + // Filters the collection to instances with a `reservation.id` property matching the specified identifier. + ReservationID *string `json:"reservation.id,omitempty"` + + // Filters the collection to instances with a `reservation.crn` property matching the specified CRN. + ReservationCRN *string `json:"reservation.crn,omitempty"` + + // Filters the collection to resources with a `reservation.name` property matching the exact specified name. + ReservationName *string `json:"reservation.name,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -55581,6 +56544,24 @@ func (_options *ListInstancesOptions) SetPlacementGroupName(placementGroupName s return _options } +// SetReservationID : Allow user to set ReservationID +func (_options *ListInstancesOptions) SetReservationID(reservationID string) *ListInstancesOptions { + _options.ReservationID = core.StringPtr(reservationID) + return _options +} + +// SetReservationCRN : Allow user to set ReservationCRN +func (_options *ListInstancesOptions) SetReservationCRN(reservationCRN string) *ListInstancesOptions { + _options.ReservationCRN = core.StringPtr(reservationCRN) + return _options +} + +// SetReservationName : Allow user to set ReservationName +func (_options *ListInstancesOptions) SetReservationName(reservationName string) *ListInstancesOptions { + _options.ReservationName = core.StringPtr(reservationName) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListInstancesOptions) SetHeaders(param map[string]string) *ListInstancesOptions { options.Headers = param @@ -56269,6 +57250,68 @@ func (options *ListRegionsOptions) SetHeaders(param map[string]string) *ListRegi return options } +// ListReservationsOptions : The ListReservations options. +type ListReservationsOptions 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 `name` property matching the exact specified name. + Name *string `json:"name,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 `zone.name` property matching the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListReservationsOptions : Instantiate ListReservationsOptions +func (*VpcV1) NewListReservationsOptions() *ListReservationsOptions { + return &ListReservationsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListReservationsOptions) SetStart(start string) *ListReservationsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListReservationsOptions) SetLimit(limit int64) *ListReservationsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListReservationsOptions) SetName(name string) *ListReservationsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListReservationsOptions) SetResourceGroupID(resourceGroupID string) *ListReservationsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *ListReservationsOptions) SetZoneName(zoneName string) *ListReservationsOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListReservationsOptions) SetHeaders(param map[string]string) *ListReservationsOptions { + options.Headers = param + return options +} + // ListSecurityGroupRulesOptions : The ListSecurityGroupRules options. type ListSecurityGroupRulesOptions struct { // The security group identifier. @@ -63383,54 +64426,55 @@ type NetworkInterface struct { // Indicates whether source IP spoofing is allowed on this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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 instance network interface was created. // // If this instance has network attachments, this network interface was created as a [read-only - // representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) when its corresponding network attachment - // was created. + // 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"` // The floating IPs associated with this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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 instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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 instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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 name for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment and its attached virtual network interface, and the name matches its corresponding network attachment. + // [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 instance network interface port speed in Mbps. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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"` @@ -63441,16 +64485,16 @@ type NetworkInterface struct { // The security groups targeting this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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 instance network interface. // // If this instance 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=vni-old-api-clients). + // them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients). Status *string `json:"status" validate:"required"` // The associated subnet. @@ -63459,8 +64503,9 @@ type NetworkInterface struct { // The instance network interface type. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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"` } @@ -63475,7 +64520,7 @@ const ( // // If this instance 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=vni-old-api-clients). +// them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients). const ( NetworkInterfaceStatusAvailableConst = "available" NetworkInterfaceStatusDeletingConst = "deleting" @@ -63487,8 +64532,9 @@ const ( // The instance network interface type. // // If this instance has network attachments, this network interface is a -// [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. +// [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 ( NetworkInterfaceTypePrimaryConst = "primary" NetworkInterfaceTypeSecondaryConst = "secondary" @@ -63562,16 +64608,16 @@ type NetworkInterfaceBareMetalServerContextReference struct { // 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=vni-old-api-clients) of its corresponding network - // attachment. + // [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=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. + // [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 name for this bare metal server network interface. @@ -63715,16 +64761,16 @@ type NetworkInterfaceInstanceContextReference struct { // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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 instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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 name for this instance network interface. @@ -63803,9 +64849,9 @@ type NetworkInterfacePatch struct { // Indicates whether source IP spoofing is allowed on this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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 name for the instance network interface. The name must not be used by another network interface on the virtual @@ -63843,9 +64889,9 @@ type NetworkInterfacePrototype struct { // Indicates whether source IP spoofing is allowed on this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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 name for the instance network interface. The name must not be used by another network interface on the virtual @@ -65455,6 +66501,882 @@ func (options *ReplaceSubnetRoutingTableOptions) SetHeaders(param map[string]str return options } +// Reservation : Reservation struct +type Reservation struct { + // The affinity policy to use for this reservation: + // - `restricted`: The reservation must be manually requested + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + AffinityPolicy *string `json:"affinity_policy" validate:"required"` + + // The capacity configuration for this reservation + // + // If absent, this reservation has no assigned capacity. + Capacity *ReservationCapacity `json:"capacity,omitempty"` + + // The committed use configuration for this reservation. + // + // If absent, this reservation has no commitment for use. + CommittedUse *ReservationCommittedUse `json:"committed_use,omitempty"` + + // The date and time that the reservation was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this reservation. + CRN *string `json:"crn" validate:"required"` + + // The URL for this reservation. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reservation. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of this reservation. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this reservation. The name is unique across all reservations in the region. + Name *string `json:"name" validate:"required"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this reservation. + Profile *ReservationProfile `json:"profile" validate:"required"` + + // The resource group for this reservation. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the reservation. + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []ReservationStatusReason `json:"status_reasons" validate:"required"` + + // The zone for this reservation. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Reservation.AffinityPolicy property. +// The affinity policy to use for this reservation: +// - `restricted`: The reservation must be manually requested +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ReservationAffinityPolicyRestrictedConst = "restricted" +) + +// Constants associated with the Reservation.LifecycleState property. +// The lifecycle state of this reservation. +const ( + ReservationLifecycleStateDeletingConst = "deleting" + ReservationLifecycleStateFailedConst = "failed" + ReservationLifecycleStatePendingConst = "pending" + ReservationLifecycleStateStableConst = "stable" + ReservationLifecycleStateSuspendedConst = "suspended" + ReservationLifecycleStateUpdatingConst = "updating" + ReservationLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Reservation.ResourceType property. +// The resource type. +const ( + ReservationResourceTypeReservationConst = "reservation" +) + +// Constants associated with the Reservation.Status property. +// The status of the reservation. +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ReservationStatusActivatingConst = "activating" + ReservationStatusActiveConst = "active" + ReservationStatusDeactivatingConst = "deactivating" + ReservationStatusExpiredConst = "expired" + ReservationStatusFailedConst = "failed" + ReservationStatusInactiveConst = "inactive" +) + +// UnmarshalReservation unmarshals an instance of Reservation from the specified map of raw messages. +func UnmarshalReservation(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Reservation) + err = core.UnmarshalPrimitive(m, "affinity_policy", &obj.AffinityPolicy) + if err != nil { + return + } + err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalReservationCapacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "committed_use", &obj.CommittedUse, UnmarshalReservationCommittedUse) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalReservationProfile) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalReservationStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationCapacity : The capacity configuration for this reservation +// +// If absent, this reservation has no assigned capacity. +type ReservationCapacity struct { + // The amount allocated to this capacity reservation. + Allocated *int64 `json:"allocated" validate:"required"` + + // The amount of this capacity reservation available for new attachments. + Available *int64 `json:"available" validate:"required"` + + // The status of the capacity reservation: + // - `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. + // - `unallocated`: The capacity reservation is not allocated for use + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + Status *string `json:"status" validate:"required"` + + // The total amount of this capacity reservation. + Total *int64 `json:"total" validate:"required"` + + // The amount of this capacity reservation used by existing attachments. + Used *int64 `json:"used" validate:"required"` +} + +// Constants associated with the ReservationCapacity.Status property. +// The status of the capacity reservation: +// - `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. +// - `unallocated`: The capacity reservation is not allocated for use +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ReservationCapacityStatusAllocatedConst = "allocated" + ReservationCapacityStatusAllocatingConst = "allocating" + ReservationCapacityStatusDegradedConst = "degraded" + ReservationCapacityStatusUnallocatedConst = "unallocated" +) + +// UnmarshalReservationCapacity unmarshals an instance of ReservationCapacity from the specified map of raw messages. +func UnmarshalReservationCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationCapacity) + err = core.UnmarshalPrimitive(m, "allocated", &obj.Allocated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "available", &obj.Available) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total", &obj.Total) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "used", &obj.Used) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationCapacityPatch : The capacity reservation configuration to use. +// +// The configuration can only be changed for reservations with a `status` of `inactive`. +type ReservationCapacityPatch struct { + // The total amount to use for this capacity reservation. + Total *int64 `json:"total,omitempty"` +} + +// UnmarshalReservationCapacityPatch unmarshals an instance of ReservationCapacityPatch from the specified map of raw messages. +func UnmarshalReservationCapacityPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationCapacityPatch) + err = core.UnmarshalPrimitive(m, "total", &obj.Total) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationCapacityPrototype : The capacity reservation configuration to use. +type ReservationCapacityPrototype struct { + // The total amount to use for this capacity reservation. + Total *int64 `json:"total" validate:"required"` +} + +// NewReservationCapacityPrototype : Instantiate ReservationCapacityPrototype (Generic Model Constructor) +func (*VpcV1) NewReservationCapacityPrototype(total int64) (_model *ReservationCapacityPrototype, err error) { + _model = &ReservationCapacityPrototype{ + Total: core.Int64Ptr(total), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalReservationCapacityPrototype unmarshals an instance of ReservationCapacityPrototype from the specified map of raw messages. +func UnmarshalReservationCapacityPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationCapacityPrototype) + err = core.UnmarshalPrimitive(m, "total", &obj.Total) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationCollection : ReservationCollection struct +type ReservationCollection struct { + // A link to the first page of resources. + First *ReservationCollectionFirst `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"` + + // Collection of reservations. + Reservations []Reservation `json:"reservations" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservationCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservations", &obj.Reservations, UnmarshalReservation) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ReservationCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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. + ExpirationAt *strfmt.DateTime `json:"expiration_at" validate:"required"` + + // The policy to apply when the committed use term expires: + // - `release`: Release any available capacity and let the reservation expire. + // - `renew`: Renew for another term, provided the term remains listed in the + // `reservation_terms` for the profile. Otherwise, let the reservation expire. + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + ExpirationPolicy *string `json:"expiration_policy" validate:"required"` + + // The term for this committed use reservation: + // - `one_year`: 1 year + // - `three_year`: 3 years + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + Term *string `json:"term" validate:"required"` +} + +// Constants associated with the ReservationCommittedUse.ExpirationPolicy property. +// The policy to apply when the committed use term expires: +// - `release`: Release any available capacity and let the reservation expire. +// - `renew`: Renew for another term, provided the term remains listed in the +// `reservation_terms` for the profile. Otherwise, let the reservation expire. +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ReservationCommittedUseExpirationPolicyReleaseConst = "release" + ReservationCommittedUseExpirationPolicyRenewConst = "renew" +) + +// UnmarshalReservationCommittedUse unmarshals an instance of ReservationCommittedUse from the specified map of raw messages. +func UnmarshalReservationCommittedUse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationCommittedUse) + err = core.UnmarshalPrimitive(m, "expiration_at", &obj.ExpirationAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "term", &obj.Term) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationCommittedUsePatch : ReservationCommittedUsePatch struct +type ReservationCommittedUsePatch struct { + // The policy to apply when the committed use term expires: + // - `release`: Release any available capacity and let the reservation expire. + // - `renew`: Renew for another term, provided the term remains listed in the + // `reservation_terms` for the profile. Otherwise, let the reservation expire. + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + ExpirationPolicy *string `json:"expiration_policy,omitempty"` + + // The term for this committed use reservation: + // - `one_year`: 1 year + // - `three_year`: 3 years + // + // The specified value must be listed in the `reservation_terms` in the profile for this reservation. The term can only + // be changed for a reservation with a `status` of + // `inactive`. + Term *string `json:"term,omitempty"` +} + +// Constants associated with the ReservationCommittedUsePatch.ExpirationPolicy property. +// The policy to apply when the committed use term expires: +// - `release`: Release any available capacity and let the reservation expire. +// - `renew`: Renew for another term, provided the term remains listed in the +// `reservation_terms` for the profile. Otherwise, let the reservation expire. +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ReservationCommittedUsePatchExpirationPolicyReleaseConst = "release" + ReservationCommittedUsePatchExpirationPolicyRenewConst = "renew" +) + +// UnmarshalReservationCommittedUsePatch unmarshals an instance of ReservationCommittedUsePatch from the specified map of raw messages. +func UnmarshalReservationCommittedUsePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationCommittedUsePatch) + err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "term", &obj.Term) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationCommittedUsePrototype : ReservationCommittedUsePrototype struct +type ReservationCommittedUsePrototype struct { + // The policy to apply when the committed use term expires: + // - `release`: Release any available capacity and let the reservation expire. + // - `renew`: Renew for another term, provided the term remains listed in the + // `reservation_terms` for the profile. Otherwise, let the reservation expire. + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + ExpirationPolicy *string `json:"expiration_policy,omitempty"` + + // The term for this committed use reservation: + // - `one_year`: 1 year + // - `three_year`: 3 years + // + // The specified value must be listed in the `reservation_terms` in the profile for this reservation. + Term *string `json:"term" validate:"required"` +} + +// Constants associated with the ReservationCommittedUsePrototype.ExpirationPolicy property. +// The policy to apply when the committed use term expires: +// - `release`: Release any available capacity and let the reservation expire. +// - `renew`: Renew for another term, provided the term remains listed in the +// `reservation_terms` for the profile. Otherwise, let the reservation expire. +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ReservationCommittedUsePrototypeExpirationPolicyReleaseConst = "release" + ReservationCommittedUsePrototypeExpirationPolicyRenewConst = "renew" +) + +// NewReservationCommittedUsePrototype : Instantiate ReservationCommittedUsePrototype (Generic Model Constructor) +func (*VpcV1) NewReservationCommittedUsePrototype(term string) (_model *ReservationCommittedUsePrototype, err error) { + _model = &ReservationCommittedUsePrototype{ + Term: core.StringPtr(term), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalReservationCommittedUsePrototype unmarshals an instance of ReservationCommittedUsePrototype from the specified map of raw messages. +func UnmarshalReservationCommittedUsePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationCommittedUsePrototype) + err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "term", &obj.Term) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationIdentity : Identifies a reservation by a unique property. +// Models which "extend" this model: +// - ReservationIdentityByID +// - ReservationIdentityByCRN +// - ReservationIdentityByHref +type ReservationIdentity struct { + // The unique identifier for this reservation. + ID *string `json:"id,omitempty"` + + // The CRN for this reservation. + CRN *string `json:"crn,omitempty"` + + // The URL for this reservation. + Href *string `json:"href,omitempty"` +} + +func (*ReservationIdentity) isaReservationIdentity() bool { + return true +} + +type ReservationIdentityIntf interface { + isaReservationIdentity() bool +} + +// UnmarshalReservationIdentity unmarshals an instance of ReservationIdentity from the specified map of raw messages. +func UnmarshalReservationIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationPatch : ReservationPatch struct +type ReservationPatch struct { + // The capacity reservation configuration to use. + // + // The configuration can only be changed for reservations with a `status` of `inactive`. + Capacity *ReservationCapacityPatch `json:"capacity,omitempty"` + + // The committed use configuration to use for this reservation. + CommittedUse *ReservationCommittedUsePatch `json:"committed_use,omitempty"` + + // The name for this reservation. The name must not be used by another reservation in the region. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this + // reservation. + // + // The profile can only be changed for a reservation with a `status` of `inactive`. + Profile *ReservationProfilePatch `json:"profile,omitempty"` +} + +// UnmarshalReservationPatch unmarshals an instance of ReservationPatch from the specified map of raw messages. +func UnmarshalReservationPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationPatch) + err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalReservationCapacityPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "committed_use", &obj.CommittedUse, UnmarshalReservationCommittedUsePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalReservationProfilePatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// ReservationProfile : The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this reservation. +type ReservationProfile struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservationProfile.ResourceType property. +// The resource type. +const ( + ReservationProfileResourceTypeInstanceProfileConst = "instance_profile" +) + +// UnmarshalReservationProfile unmarshals an instance of ReservationProfile from the specified map of raw messages. +func UnmarshalReservationProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationProfile) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationProfilePatch : The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this reservation. +// +// The profile can only be changed for a reservation with a `status` of `inactive`. +type ReservationProfilePatch struct { + // The globally unique name of the profile. + Name *string `json:"name,omitempty"` + + // The resource type of the profile. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the ReservationProfilePatch.ResourceType property. +// The resource type of the profile. +const ( + ReservationProfilePatchResourceTypeInstanceProfileConst = "instance_profile" +) + +// UnmarshalReservationProfilePatch unmarshals an instance of ReservationProfilePatch from the specified map of raw messages. +func UnmarshalReservationProfilePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationProfilePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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. + Name *string `json:"name" validate:"required"` + + // The resource type of the profile. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservationProfilePrototype.ResourceType property. +// The resource type of the profile. +const ( + ReservationProfilePrototypeResourceTypeInstanceProfileConst = "instance_profile" +) + +// NewReservationProfilePrototype : Instantiate ReservationProfilePrototype (Generic Model Constructor) +func (*VpcV1) NewReservationProfilePrototype(name string, resourceType string) (_model *ReservationProfilePrototype, err error) { + _model = &ReservationProfilePrototype{ + Name: core.StringPtr(name), + ResourceType: core.StringPtr(resourceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalReservationProfilePrototype unmarshals an instance of ReservationProfilePrototype from the specified map of raw messages. +func UnmarshalReservationProfilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationProfilePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationReference : ReservationReference struct +type ReservationReference struct { + // The CRN for this reservation. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ReservationReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this reservation. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reservation. + ID *string `json:"id" validate:"required"` + + // The name for this reservation. The name is unique across all reservations in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservationReference.ResourceType property. +// The resource type. +const ( + ReservationReferenceResourceTypeReservationConst = "reservation" +) + +// UnmarshalReservationReference unmarshals an instance of ReservationReference from the specified map of raw messages. +func UnmarshalReservationReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservationReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type ReservationReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalReservationReferenceDeleted unmarshals an instance of ReservationReferenceDeleted from the specified map of raw messages. +func UnmarshalReservationReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationStatusReason : ReservationStatusReason struct +type ReservationStatusReason struct { + // A snake case string succinctly identifying the status reason. + 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 ReservationStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + ReservationStatusReasonCodeCannotActivateNoCapacityAvailableConst = "cannot_activate_no_capacity_available" + ReservationStatusReasonCodeCannotRenewUnsupportedProfileTermConst = "cannot_renew_unsupported_profile_term" +) + +// UnmarshalReservationStatusReason unmarshals an instance of ReservationStatusReason from the specified map of raw messages. +func UnmarshalReservationStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ReservedIP : ReservedIP struct type ReservedIP struct { // The IP address. @@ -66422,350 +68344,360 @@ type Route struct { // distributed between them. Priority *int64 `json:"priority" validate:"required"` - // The zone the route applies to. (Traffic from subnets in this zone will be - // subject to this route.). - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the Route.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. -const ( - RouteActionDelegateConst = "delegate" - RouteActionDelegateVPCConst = "delegate_vpc" - RouteActionDeliverConst = "deliver" - RouteActionDropConst = "drop" -) - -// Constants associated with the Route.LifecycleState property. -// The lifecycle state of the route. -const ( - RouteLifecycleStateDeletingConst = "deleting" - RouteLifecycleStateFailedConst = "failed" - RouteLifecycleStatePendingConst = "pending" - RouteLifecycleStateStableConst = "stable" - RouteLifecycleStateSuspendedConst = "suspended" - RouteLifecycleStateUpdatingConst = "updating" - RouteLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the Route.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 are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. -const ( - RouteOriginServiceConst = "service" - RouteOriginUserConst = "user" -) - -// UnmarshalRoute unmarshals an instance of Route from the specified map of raw messages. -func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Route) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) - if err != nil { - 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 *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"` - - // Collection of routes. - 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 { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRoute) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - 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 || start == nil { - return nil, err - } - 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 { - 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 { - 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"` - - // Collection of routes. - 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 { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionVPCContextNext) - if err != nil { - return - } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteCollectionVPCContextRoutesItem) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - 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 || start == nil { - return nil, err - } - 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 { - 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 { - 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. - 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 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 Route.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. +const ( + RouteActionDelegateConst = "delegate" + RouteActionDelegateVPCConst = "delegate_vpc" + RouteActionDeliverConst = "deliver" + RouteActionDropConst = "drop" +) + +// Constants associated with the Route.LifecycleState property. +// The lifecycle state of the route. +const ( + RouteLifecycleStateDeletingConst = "deleting" + RouteLifecycleStateFailedConst = "failed" + RouteLifecycleStatePendingConst = "pending" + RouteLifecycleStateStableConst = "stable" + RouteLifecycleStateSuspendedConst = "suspended" + RouteLifecycleStateUpdatingConst = "updating" + RouteLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Route.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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +const ( + RouteOriginServiceConst = "service" + RouteOriginUserConst = "user" +) + +// UnmarshalRoute unmarshals an instance of Route from the specified map of raw messages. +func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Route) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + 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 *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"` + + // Collection of routes. + 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 { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRoute) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + 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 { + 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 { + 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"` + + // Collection of routes. + 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 { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionVPCContextNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteCollectionVPCContextRoutesItem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + 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 { + 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 { + 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. + 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 are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + Origin *string `json:"origin,omitempty"` + + // 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. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. - Origin *string `json:"origin,omitempty"` - - // 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. (Traffic from subnets in this zone will be - // subject to this route.). + // 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"` } @@ -67166,8 +69098,13 @@ type RoutePrototype struct { // distributed between them. Priority *int64 `json:"priority,omitempty"` - // The zone to apply the route to. (Traffic from subnets in this zone will be - // subject to this route.). + // The zone to apply the route 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 ZoneIdentityIntf `json:"zone" validate:"required"` } @@ -68781,16 +70718,16 @@ type SecurityGroupTargetReference struct { // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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,omitempty"` // The unique identifier for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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,omitempty"` // The name for this instance network interface. @@ -74076,6 +76013,10 @@ type UpdateInstanceOptions struct { // The instance patch. InstancePatch map[string]interface{} `json:"Instance_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 } @@ -74100,6 +76041,12 @@ func (_options *UpdateInstanceOptions) SetInstancePatch(instancePatch map[string return _options } +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateInstanceOptions) SetIfMatch(ifMatch string) *UpdateInstanceOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + // SetHeaders : Allow user to set Headers func (options *UpdateInstanceOptions) SetHeaders(param map[string]string) *UpdateInstanceOptions { options.Headers = param @@ -74758,6 +76705,44 @@ func (options *UpdatePublicGatewayOptions) SetHeaders(param map[string]string) * return options } +// UpdateReservationOptions : The UpdateReservation options. +type UpdateReservationOptions struct { + // The reservation identifier. + ID *string `json:"id" validate:"required,ne="` + + // The reservation patch. + ReservationPatch map[string]interface{} `json:"Reservation_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateReservationOptions : Instantiate UpdateReservationOptions +func (*VpcV1) NewUpdateReservationOptions(id string, reservationPatch map[string]interface{}) *UpdateReservationOptions { + return &UpdateReservationOptions{ + ID: core.StringPtr(id), + ReservationPatch: reservationPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateReservationOptions) SetID(id string) *UpdateReservationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetReservationPatch : Allow user to set ReservationPatch +func (_options *UpdateReservationOptions) SetReservationPatch(reservationPatch map[string]interface{}) *UpdateReservationOptions { + _options.ReservationPatch = reservationPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateReservationOptions) SetHeaders(param map[string]string) *UpdateReservationOptions { + options.Headers = param + return options +} + // UpdateSecurityGroupOptions : The UpdateSecurityGroup options. type UpdateSecurityGroupOptions struct { // The security group identifier. @@ -77750,8 +79735,6 @@ func UnmarshalVPNGatewayConnectionLocalCIDRs(m map[string]json.RawMessage, resul } // VPNGatewayConnectionPatch : VPNGatewayConnectionPatch struct -// Models which "extend" this model: -// - VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch type VPNGatewayConnectionPatch struct { // If set to false, the VPN gateway connection is shut down. AdminStateUp *bool `json:"admin_state_up,omitempty"` @@ -77786,14 +79769,6 @@ const ( VPNGatewayConnectionPatchRoutingProtocolNoneConst = "none" ) -func (*VPNGatewayConnectionPatch) isaVPNGatewayConnectionPatch() bool { - return true -} - -type VPNGatewayConnectionPatchIntf interface { - isaVPNGatewayConnectionPatch() bool -} - // UnmarshalVPNGatewayConnectionPatch unmarshals an instance of VPNGatewayConnectionPatch from the specified map of raw messages. func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VPNGatewayConnectionPatch) @@ -83855,16 +85830,16 @@ type BareMetalServerNetworkInterfaceByHiperSocket 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=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. + // [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=vni-old-api-clients) when its corresponding network attachment - // was created. + // 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`: @@ -83878,56 +85853,57 @@ type BareMetalServerNetworkInterfaceByHiperSocket struct { // - `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=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. + // [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=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. + // [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=vni-old-api-clients) of its corresponding network - // attachment. + // [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=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. + // [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 MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value // will be an empty string. // // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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=vni-old-api-clients) of its corresponding network - // attachment and its attached virtual network interface, and the name matches its corresponding network attachment. + // [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=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. + // [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"` @@ -83938,16 +85914,16 @@ type BareMetalServerNetworkInterfaceByHiperSocket struct { // 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=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. + // [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=vni-old-api-clients). + // them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients). Status *string `json:"status" validate:"required"` // The associated subnet. @@ -83956,8 +85932,9 @@ type BareMetalServerNetworkInterfaceByHiperSocket struct { // 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=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. + // [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"` // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity @@ -83976,7 +85953,7 @@ const ( // // 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=vni-old-api-clients). +// them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients). const ( BareMetalServerNetworkInterfaceByHiperSocketStatusAvailableConst = "available" BareMetalServerNetworkInterfaceByHiperSocketStatusDeletingConst = "deleting" @@ -83988,8 +85965,9 @@ const ( // 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=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. +// [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 ( BareMetalServerNetworkInterfaceByHiperSocketTypePrimaryConst = "primary" BareMetalServerNetworkInterfaceByHiperSocketTypeSecondaryConst = "secondary" @@ -84083,16 +86061,16 @@ type BareMetalServerNetworkInterfaceByPci 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=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. + // [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=vni-old-api-clients) when its corresponding network attachment - // was created. + // 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`: @@ -84106,56 +86084,57 @@ type BareMetalServerNetworkInterfaceByPci struct { // - `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=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. + // [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=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. + // [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=vni-old-api-clients) of its corresponding network - // attachment. + // [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=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. + // [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 MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value // will be an empty string. // // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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=vni-old-api-clients) of its corresponding network - // attachment and its attached virtual network interface, and the name matches its corresponding network attachment. + // [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=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. + // [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"` @@ -84166,16 +86145,16 @@ type BareMetalServerNetworkInterfaceByPci struct { // 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=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. + // [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=vni-old-api-clients). + // them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients). Status *string `json:"status" validate:"required"` // The associated subnet. @@ -84184,16 +86163,17 @@ type BareMetalServerNetworkInterfaceByPci struct { // 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=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. + // [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=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. + // [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" validate:"required"` // - `pci`: a physical PCI device which can only be created or deleted when the bare metal @@ -84215,7 +86195,7 @@ const ( // // 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=vni-old-api-clients). +// them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients). const ( BareMetalServerNetworkInterfaceByPciStatusAvailableConst = "available" BareMetalServerNetworkInterfaceByPciStatusDeletingConst = "deleting" @@ -84227,8 +86207,9 @@ const ( // 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=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. +// [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 ( BareMetalServerNetworkInterfaceByPciTypePrimaryConst = "primary" BareMetalServerNetworkInterfaceByPciTypeSecondaryConst = "secondary" @@ -84329,16 +86310,16 @@ type BareMetalServerNetworkInterfaceByVlan 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=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. + // [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=vni-old-api-clients) when its corresponding network attachment - // was created. + // 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`: @@ -84352,56 +86333,57 @@ type BareMetalServerNetworkInterfaceByVlan struct { // - `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=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. + // [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=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. + // [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=vni-old-api-clients) of its corresponding network - // attachment. + // [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=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. + // [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 MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value // will be an empty string. // // If this bare metal server has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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=vni-old-api-clients) of its corresponding network - // attachment and its attached virtual network interface, and the name matches its corresponding network attachment. + // [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=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. + // [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"` @@ -84412,16 +86394,16 @@ type BareMetalServerNetworkInterfaceByVlan struct { // 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=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. + // [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=vni-old-api-clients). + // them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients). Status *string `json:"status" validate:"required"` // The associated subnet. @@ -84430,8 +86412,9 @@ type BareMetalServerNetworkInterfaceByVlan struct { // 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=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. + // [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"` // Indicates if the data path for the network interface can float to another bare metal server. Can only be `true` for @@ -84446,9 +86429,9 @@ type BareMetalServerNetworkInterfaceByVlan struct { // 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=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. + // [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" validate:"required"` // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array @@ -84461,9 +86444,9 @@ type BareMetalServerNetworkInterfaceByVlan struct { // 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=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. + // [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" validate:"required"` } @@ -84478,7 +86461,7 @@ const ( // // 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=vni-old-api-clients). +// them](https://cloud.ibm.com/docs/vpc?topic=vpc-vni-about#vni-old-api-clients). const ( BareMetalServerNetworkInterfaceByVlanStatusAvailableConst = "available" BareMetalServerNetworkInterfaceByVlanStatusDeletingConst = "deleting" @@ -84490,8 +86473,9 @@ const ( // 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=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. +// [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 ( BareMetalServerNetworkInterfaceByVlanTypePrimaryConst = "primary" BareMetalServerNetworkInterfaceByVlanTypeSecondaryConst = "secondary" @@ -84596,9 +86580,9 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHi // 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=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. + // [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`: @@ -84612,9 +86596,9 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHi // - `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=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. + // [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 @@ -84705,9 +86689,9 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc // 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=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. + // [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`: @@ -84721,9 +86705,9 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPc // - `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=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. + // [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 @@ -84827,9 +86811,9 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // 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=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. + // [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`: @@ -84843,9 +86827,9 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // - `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=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. + // [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 @@ -84879,9 +86863,9 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // 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=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. + // [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"` // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its array @@ -84895,9 +86879,9 @@ type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVl // 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=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. + // [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" validate:"required"` } @@ -87804,16 +89788,16 @@ type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity struct { // 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=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. + // [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,omitempty"` // 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=vni-old-api-clients) of its corresponding network - // attachment. + // [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,omitempty"` } @@ -87854,16 +89838,16 @@ type FloatingIPTargetPatchNetworkInterfaceIdentity struct { // The unique identifier for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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,omitempty"` // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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,omitempty"` } @@ -87953,16 +89937,16 @@ type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity struct { // 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=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. + // [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,omitempty"` // 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=vni-old-api-clients) of its corresponding network - // attachment. + // [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,omitempty"` } @@ -88003,16 +89987,16 @@ type FloatingIPTargetPrototypeNetworkInterfaceIdentity struct { // The unique identifier for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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,omitempty"` // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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,omitempty"` } @@ -88103,16 +90087,16 @@ type FloatingIPTargetBareMetalServerNetworkInterfaceReference struct { // 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=vni-old-api-clients) of its corresponding network - // attachment. + // [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=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. + // [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 name for this bare metal server network interface. @@ -88175,16 +90159,16 @@ type FloatingIPTargetNetworkInterfaceReference struct { // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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 instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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 name for this instance network interface. @@ -88478,16 +90462,16 @@ type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity struct { // The unique identifier for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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,omitempty"` // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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,omitempty"` } @@ -88799,16 +90783,16 @@ type FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct { // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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 instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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 name for this instance network interface. @@ -92540,6 +94524,8 @@ type InstancePrototypeInstanceByCatalogOffering struct { Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -92547,6 +94533,8 @@ type InstancePrototypeInstanceByCatalogOffering struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -92580,12 +94568,6 @@ type InstancePrototypeInstanceByCatalogOffering struct { // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -92594,6 +94576,12 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototypeInstanceByCatalogOffering() bool { @@ -92640,6 +94628,10 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -92668,23 +94660,23 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -92731,6 +94723,8 @@ type InstancePrototypeInstanceByImage struct { Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -92738,6 +94732,8 @@ type InstancePrototypeInstanceByImage struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -92764,12 +94760,6 @@ type InstancePrototypeInstanceByImage struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -92778,6 +94768,12 @@ type InstancePrototypeInstanceByImage struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } func (*InstancePrototypeInstanceByImage) isaInstancePrototypeInstanceByImage() bool { @@ -92824,6 +94820,10 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -92852,23 +94852,23 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -92915,6 +94915,8 @@ type InstancePrototypeInstanceBySourceSnapshot struct { Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -92922,6 +94924,8 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -92945,12 +94949,6 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -92959,6 +94957,12 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototypeInstanceBySourceSnapshot() bool { @@ -93005,6 +95009,10 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -93029,23 +95037,23 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -93095,6 +95103,8 @@ type InstancePrototypeInstanceBySourceTemplate struct { Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -93102,6 +95112,8 @@ type InstancePrototypeInstanceBySourceTemplate struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -93202,6 +95214,10 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -93301,6 +95317,8 @@ type InstancePrototypeInstanceByVolume struct { Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -93308,6 +95326,8 @@ type InstancePrototypeInstanceByVolume struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -93331,12 +95351,6 @@ type InstancePrototypeInstanceByVolume struct { // The boot volume attachment for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -93345,6 +95359,12 @@ type InstancePrototypeInstanceByVolume struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } func (*InstancePrototypeInstanceByVolume) isaInstancePrototypeInstanceByVolume() bool { @@ -93391,6 +95411,10 @@ func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, re if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -93415,23 +95439,23 @@ func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, re if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -93569,6 +95593,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -93576,6 +95602,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -93609,12 +95637,6 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -93623,6 +95645,12 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { @@ -93669,6 +95697,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -93697,23 +95729,23 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -93758,6 +95790,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -93765,6 +95799,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -93791,12 +95827,6 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -93805,6 +95835,12 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { @@ -93851,6 +95887,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -93879,23 +95919,23 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -93940,6 +95980,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -93947,6 +95989,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -93970,12 +96014,6 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -93984,6 +96022,12 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { @@ -94030,6 +96074,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -94054,23 +96102,23 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -94112,6 +96160,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -94119,6 +96169,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -94219,6 +96271,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -94327,6 +96383,8 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -94334,6 +96392,8 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + // The resource group for this instance template. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -94368,12 +96428,6 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -94382,6 +96436,12 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { @@ -94444,6 +96504,10 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return @@ -94472,23 +96536,23 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -94544,6 +96608,8 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -94551,6 +96617,8 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + // The resource group for this instance template. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -94578,12 +96646,6 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -94592,6 +96654,12 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { @@ -94654,6 +96722,10 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[strin if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return @@ -94682,23 +96754,23 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[strin if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -94754,6 +96826,8 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -94761,6 +96835,8 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + // The resource group for this instance template. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -94794,11 +96870,11 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // The primary network attachment to create for the virtual server instance. PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { @@ -94861,6 +96937,10 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return @@ -94897,11 +96977,11 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { return } @@ -98348,6 +100428,99 @@ func UnmarshalRegionIdentityByName(m map[string]json.RawMessage, result interfac return } +// ReservationIdentityByCRN : ReservationIdentityByCRN struct +// This model "extends" ReservationIdentity +type ReservationIdentityByCRN struct { + // The CRN for this reservation. + CRN *string `json:"crn" validate:"required"` +} + +// NewReservationIdentityByCRN : Instantiate ReservationIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewReservationIdentityByCRN(crn string) (_model *ReservationIdentityByCRN, err error) { + _model = &ReservationIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservationIdentityByCRN) isaReservationIdentity() bool { + return true +} + +// UnmarshalReservationIdentityByCRN unmarshals an instance of ReservationIdentityByCRN from the specified map of raw messages. +func UnmarshalReservationIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationIdentityByHref : ReservationIdentityByHref struct +// This model "extends" ReservationIdentity +type ReservationIdentityByHref struct { + // The URL for this reservation. + Href *string `json:"href" validate:"required"` +} + +// NewReservationIdentityByHref : Instantiate ReservationIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewReservationIdentityByHref(href string) (_model *ReservationIdentityByHref, err error) { + _model = &ReservationIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservationIdentityByHref) isaReservationIdentity() bool { + return true +} + +// UnmarshalReservationIdentityByHref unmarshals an instance of ReservationIdentityByHref from the specified map of raw messages. +func UnmarshalReservationIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationIdentityByID : ReservationIdentityByID struct +// This model "extends" ReservationIdentity +type ReservationIdentityByID struct { + // The unique identifier for this reservation. + ID *string `json:"id" validate:"required"` +} + +// NewReservationIdentityByID : Instantiate ReservationIdentityByID (Generic Model Constructor) +func (*VpcV1) NewReservationIdentityByID(id string) (_model *ReservationIdentityByID, err error) { + _model = &ReservationIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservationIdentityByID) isaReservationIdentity() bool { + return true +} + +// UnmarshalReservationIdentityByID unmarshals an instance of ReservationIdentityByID from the specified map of raw messages. +func UnmarshalReservationIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ReservedIPTargetPrototypeEndpointGatewayIdentity : ReservedIPTargetPrototypeEndpointGatewayIdentity struct // Models which "extend" this model: // - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID @@ -98456,16 +100629,16 @@ type ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struc // 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=vni-old-api-clients) of its corresponding network - // attachment. + // [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=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. + // [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 name for this bare metal server network interface. @@ -98693,16 +100866,16 @@ type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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 instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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 name for this instance network interface. @@ -100387,16 +102560,16 @@ type SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetC // 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=vni-old-api-clients) of its corresponding network - // attachment. + // [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=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. + // [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 name for this bare metal server network interface. @@ -100581,16 +102754,16 @@ type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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 instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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 name for this instance network interface. @@ -103292,90 +105465,6 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(m return } -// VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch : VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch struct -// This model "extends" VPNGatewayConnectionPatch -type VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up,omitempty"` - - DeadPeerDetection *VPNGatewayConnectionDpdPatch `json:"dead_peer_detection,omitempty"` - - IkePolicy VPNGatewayConnectionIkePolicyPatchIntf `json:"ike_policy,omitempty"` - - IpsecPolicy VPNGatewayConnectionIPsecPolicyPatchIntf `json:"ipsec_policy,omitempty"` - - // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. - Name *string `json:"name,omitempty"` - - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address,omitempty"` - - // The pre-shared key. - Psk *string `json:"psk,omitempty"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatchRoutingProtocolNoneConst = "none" -) - -func (*VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) isaVPNGatewayConnectionPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch unmarshals an instance of VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPatch) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch -func (vpnGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch *VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpnGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - // VPNGatewayConnectionPolicyMode : VPNGatewayConnectionPolicyMode struct // This model "extends" VPNGatewayConnection type VPNGatewayConnectionPolicyMode struct { @@ -105798,8 +107887,8 @@ type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServer // 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=vni-old-api-clients) of its corresponding network - // attachment. + // [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"` } @@ -105837,9 +107926,9 @@ type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServer // 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=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. + // [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"` } @@ -105877,8 +107966,8 @@ type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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"` } @@ -105916,9 +108005,9 @@ type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID s // The unique identifier for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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"` } @@ -106061,8 +108150,8 @@ type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalSe // 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=vni-old-api-clients) of its corresponding network - // attachment. + // [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"` } @@ -106100,9 +108189,9 @@ type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalSe // 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=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. + // [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"` } @@ -106140,8 +108229,8 @@ type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityBy // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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"` } @@ -106179,9 +108268,9 @@ type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityBy // The unique identifier for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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"` } @@ -106499,8 +108588,8 @@ type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIden // The URL for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=vni-old-api-clients) of its corresponding network - // attachment. + // [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"` } @@ -106538,9 +108627,9 @@ type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIden // The unique identifier for this instance network interface. // // If this instance has network attachments, this network interface is a - // [read-only representation](https://cloud.ibm.com/docs/vpc?topic=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. + // [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"` } @@ -108078,6 +110167,8 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -108085,6 +110176,8 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -108110,12 +110203,6 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -108127,10 +110214,9 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance } // NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment, err error) { +func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment, err error) { _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment{ CatalogOffering: catalogOffering, - PrimaryNetworkInterface: primaryNetworkInterface, Zone: zone, PrimaryNetworkAttachment: primaryNetworkAttachment, } @@ -108177,6 +110263,10 @@ func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferin if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -108205,14 +110295,6 @@ func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferin if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -108265,6 +110347,8 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -108272,6 +110356,8 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -108357,6 +110443,10 @@ func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferin if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -108437,6 +110527,8 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -108444,6 +110536,8 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -108470,12 +110564,6 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -108487,10 +110575,9 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment } // NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment, err error) { +func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment, err error) { _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment{ Image: image, - PrimaryNetworkInterface: primaryNetworkInterface, Zone: zone, PrimaryNetworkAttachment: primaryNetworkAttachment, } @@ -108537,6 +110624,10 @@ func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAt if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -108565,14 +110656,6 @@ func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAt if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -108625,6 +110708,8 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface s Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -108632,6 +110717,8 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface s // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -108718,6 +110805,10 @@ func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkIn if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -108798,6 +110889,8 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -108805,6 +110898,8 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -108828,12 +110923,6 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -108845,10 +110934,9 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy } // NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment, err error) { +func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment, err error) { _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment{ BootVolumeAttachment: bootVolumeAttachment, - PrimaryNetworkInterface: primaryNetworkInterface, Zone: zone, PrimaryNetworkAttachment: primaryNetworkAttachment, } @@ -108895,6 +110983,10 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotI if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -108919,14 +111011,6 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotI if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -108979,6 +111063,8 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -108986,6 +111072,8 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -109069,6 +111157,10 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotI if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -109145,6 +111237,8 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmen Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -109152,6 +111246,8 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmen // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -109175,12 +111271,6 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmen // The boot volume attachment for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -109192,10 +111282,9 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmen } // NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment, err error) { +func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment, err error) { _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment{ BootVolumeAttachment: bootVolumeAttachment, - PrimaryNetworkInterface: primaryNetworkInterface, Zone: zone, PrimaryNetworkAttachment: primaryNetworkAttachment, } @@ -109242,6 +111331,10 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -109266,14 +111359,6 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -109326,6 +111411,8 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -109333,6 +111420,8 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -109416,6 +111505,10 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -109490,6 +111583,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -109497,6 +111592,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -109522,12 +111619,6 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -109539,10 +111630,9 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB } // NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment, err error) { +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment, err error) { _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment{ CatalogOffering: catalogOffering, - PrimaryNetworkInterface: primaryNetworkInterface, Zone: zone, PrimaryNetworkAttachment: primaryNetworkAttachment, } @@ -109589,6 +111679,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -109617,14 +111711,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -109675,6 +111761,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -109682,6 +111770,8 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -109767,6 +111857,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -109845,6 +111939,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -109852,6 +111948,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -109878,12 +111976,6 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -109895,10 +111987,9 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst } // NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment, err error) { +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment, err error) { _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment{ Image: image, - PrimaryNetworkInterface: primaryNetworkInterface, Zone: zone, PrimaryNetworkAttachment: primaryNetworkAttachment, } @@ -109945,6 +112036,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -109973,14 +112068,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -110031,6 +112118,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -110038,6 +112127,8 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -110124,6 +112215,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -110202,6 +112297,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -110209,6 +112306,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -110232,12 +112331,6 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // The boot volume attachment to create for the virtual server instance. BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -110249,10 +112342,9 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy } // NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment, err error) { +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment, err error) { _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment{ BootVolumeAttachment: bootVolumeAttachment, - PrimaryNetworkInterface: primaryNetworkInterface, Zone: zone, PrimaryNetworkAttachment: primaryNetworkAttachment, } @@ -110299,6 +112391,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -110323,14 +112419,6 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -110381,6 +112469,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy Name *string `json:"name,omitempty"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -110388,6 +112478,8 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in @@ -110471,6 +112563,10 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return @@ -110556,6 +112652,8 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -110563,6 +112661,8 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + // The resource group for this instance template. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -110589,12 +112689,6 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -110660,6 +112754,10 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return @@ -110688,14 +112786,6 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -110757,6 +112847,8 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -110764,6 +112856,8 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + // The resource group for this instance template. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -110855,6 +112949,10 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return @@ -110944,6 +113042,8 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -110951,6 +113051,8 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + // The resource group for this instance template. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -110978,12 +113080,6 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan // The image to use when provisioning the virtual server instance. Image ImageIdentityIntf `json:"image" validate:"required"` - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -111049,6 +113145,10 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return @@ -111077,14 +113177,6 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -111146,6 +113238,8 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -111153,6 +113247,8 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + // The resource group for this instance template. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -111245,6 +113341,10 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return @@ -111334,6 +113434,8 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -111341,6 +113443,8 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + // The resource group for this instance template. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -111368,9 +113472,6 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo // The additional instance network interfaces to create. NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` - // The zone this virtual server instance will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -111436,6 +113537,10 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return @@ -111464,10 +113569,6 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns if err != nil { return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - return - } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { return @@ -111529,6 +113630,8 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo Name *string `json:"name" validate:"required"` // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. @@ -111536,6 +113639,8 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + // The resource group for this instance template. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -111631,6 +113736,10 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns if err != nil { return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return @@ -115127,6 +117236,91 @@ func (pager *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMe return pager.GetAllWithContext(context.Background()) } +// ReservationsPager can be used to simplify the use of the "ListReservations" method. +type ReservationsPager struct { + hasNext bool + options *ListReservationsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewReservationsPager returns a new ReservationsPager instance. +func (vpc *VpcV1) NewReservationsPager(options *ListReservationsOptions) (pager *ReservationsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListReservationsOptions = *options + pager = &ReservationsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ReservationsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ReservationsPager) GetNextWithContext(ctx context.Context) (page []Reservation, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListReservationsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Reservations + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ReservationsPager) GetAllWithContext(ctx context.Context) (allItems []Reservation, err error) { + for pager.HasNext() { + var nextPage []Reservation + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ReservationsPager) GetNext() (page []Reservation, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ReservationsPager) GetAll() (allItems []Reservation, err error) { + return pager.GetAllWithContext(context.Background()) +} + // DedicatedHostGroupsPager can be used to simplify the use of the "ListDedicatedHostGroups" method. type DedicatedHostGroupsPager struct { hasNext bool From adc69ccbd9492574e9696d97a6963cf3c931cc69 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Mon, 29 Jan 2024 11:43:16 +0530 Subject: [PATCH 051/103] Update vpc_v1.go --- common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index e4b19462a6..7180467af9 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -31,8 +31,8 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" + common "github.com/IBM/vpc-go-sdk/common" "github.com/go-openapi/strfmt" - common "github.ibm.com/ibmcloud/vpc-go-sdk/common" ) // VpcV1 : The IBM Cloud Virtual Private Cloud (VPC) API can be used to programmatically provision and manage virtual From 9f12a08a3340ae100cedce386527adcea567b693 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Mon, 29 Jan 2024 11:43:57 +0530 Subject: [PATCH 052/103] Update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index a8d5dab3a4..6910c627b3 100644 --- a/go.mod +++ b/go.mod @@ -238,7 +238,7 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt // add sdk changes. replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.46.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.47.0 => ./common/github.com/IBM/vpc-go-sdk exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 From a21f46b7da6077431e8cc2c5e3503b220846f5e0 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 5 Mar 2024 10:56:57 +0530 Subject: [PATCH 053/103] updated sdk --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 318 ++++++++---------- go.mod | 2 +- 2 files changed, 133 insertions(+), 187 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 7180467af9..bbd6337f00 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.84.0-a4533f12-20240103-170852 + * IBM OpenAPI SDK Code Generator Version: 3.85.0-75c38f8f-20240206-210220 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -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 `2023-12-05` - // and `2024-01-29`. + // and `2024-03-04`. Version *string } @@ -64,7 +64,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2024-01-29`. + // and `2024-03-04`. Version *string } @@ -122,7 +122,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2023-12-19") + options.Version = core.StringPtr("2024-01-24") } service = &VpcV1{ @@ -14059,6 +14059,9 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions if listVolumesOptions.ZoneName != nil { builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) } + if listVolumesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) + } request, err := builder.Build() if err != nil { @@ -23549,7 +23552,8 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd } // ListLoadBalancerListenerPolicies : List all policies for a load balancer listener -// This request lists all policies for a load balancer listener. +// This request lists all 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) { return vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) } @@ -23613,7 +23617,9 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex } // CreateLoadBalancerListenerPolicy : Create a policy for a load balancer listener -// Creates a new 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) { return vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) } @@ -23817,7 +23823,8 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, } // UpdateLoadBalancerListenerPolicy : Update a load balancer listener policy -// Updates a policy from a policy patch. +// 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) { return vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) } @@ -42334,13 +42341,14 @@ type FlowLogCollector struct { StorageBucket *LegacyCloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` // The target this collector is collecting flow logs for. + // // - If the target is an instance network attachment, flow logs will be collected // for that instance network attachment. // - If the target is an instance network interface, flow logs will be collected // for that instance network interface. // - If the target is a virtual network interface, flow logs will be collected for the - // the virtual network interface's `target` resource if the resource is: - // - an instance network attachment + // virtual network interface's `target` resource if the resource is an instance network + // attachment, unless the target resource is itself the target of a flow log collector. // - If the target is a virtual server instance, flow logs will be collected // for all network attachments or network interfaces on that instance. // - If the target is a subnet, flow logs will be collected @@ -42348,6 +42356,7 @@ type FlowLogCollector struct { // attached to that subnet. // - If the target is a VPC, flow logs will be collected for all instance network // interfaces and virtual network interfaces attached to all subnets within that VPC. + // // If the target is an instance, subnet, or VPC, flow logs will not be collected // for any instance network attachments or instance network interfaces within the target // that are themselves the target of a more specific flow log collector. @@ -42552,23 +42561,24 @@ func (flowLogCollectorPatch *FlowLogCollectorPatch) AsPatch() (_patch map[string } // FlowLogCollectorTarget : The target this collector is collecting flow logs for. +// // - If the target is an instance network attachment, flow logs will be collected // for that instance network attachment. // - If the target is an instance network interface, flow logs will be collected // for that instance network interface. // - If the target is a virtual network interface, flow logs will be collected for the -// the virtual network interface's `target` resource if the resource is: -// - an instance network attachment +// virtual network interface's `target` resource if the resource is an instance network +// attachment, unless the target resource is itself the target of a flow log collector. // - If the target is a virtual server instance, flow logs will be collected // for all network attachments or network interfaces on that instance. // - If the target is a subnet, flow logs will be collected // for all instance network interfaces and virtual network interfaces // attached to that subnet. // - If the target is a VPC, flow logs will be collected for all instance network -// interfaces and virtual network interfaces attached to all subnets within that VPC. If the target is an instance, +// interfaces and virtual network interfaces attached to all subnets within that VPC. // -// subnet, or VPC, flow logs will not be collected for any instance network attachments or instance network interfaces -// within the target that are themselves the target of a more specific flow log collector. +// If the target is an instance, subnet, or VPC, flow logs will not be collected for any instance network attachments or +// instance network interfaces within the target that are themselves the target of a more specific flow log collector. // Models which "extend" this model: // - FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext // - FlowLogCollectorTargetInstanceReference @@ -53448,11 +53458,9 @@ func UnmarshalInstanceReservationAffinity(m map[string]json.RawMessage, result i // InstanceReservationAffinityPatch : InstanceReservationAffinityPatch struct type InstanceReservationAffinityPatch struct { - // The reservation affinity policy for this virtual server instance. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // The reservation affinity policy to use for this virtual server instance: + // - `disabled`: Reservations will not be used + // - `manual`: Reservations in `pool` are available for use. Policy *string `json:"policy,omitempty"` // The pool of reservations available for use by this virtual server instance, replacing the existing pool of @@ -53467,11 +53475,9 @@ type InstanceReservationAffinityPatch struct { } // Constants associated with the InstanceReservationAffinityPatch.Policy property. -// The reservation affinity policy for this virtual server instance. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The reservation affinity policy to use for this virtual server instance: +// - `disabled`: Reservations will not be used +// - `manual`: Reservations in `pool` are available for use. const ( InstanceReservationAffinityPatchPolicyDisabledConst = "disabled" InstanceReservationAffinityPatchPolicyManualConst = "manual" @@ -58393,6 +58399,9 @@ type ListVolumesOptions struct { // Filters the collection to resources with a `zone.name` property matching the exact specified name. ZoneName *string `json:"zone.name,omitempty"` + // 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 Headers map[string]string } @@ -58465,6 +58474,12 @@ func (_options *ListVolumesOptions) SetZoneName(zoneName string) *ListVolumesOpt return _options } +// SetTag : Allow user to set Tag +func (_options *ListVolumesOptions) SetTag(tag string) *ListVolumesOptions { + _options.Tag = core.StringPtr(tag) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListVolumesOptions) SetHeaders(param map[string]string) *ListVolumesOptions { options.Headers = param @@ -62745,6 +62760,10 @@ func UnmarshalLoadBalancerPrivateIpsItem(m map[string]json.RawMessage, result in // LoadBalancerProfile : LoadBalancerProfile struct type LoadBalancerProfile struct { // The product family this load balancer profile belongs to. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the + // unexpected property value was encountered. Family *string `json:"family" validate:"required"` // The URL for this load balancer profile. @@ -62765,6 +62784,17 @@ type LoadBalancerProfile struct { UDPSupported LoadBalancerProfileUDPSupportedIntf `json:"udp_supported" validate:"required"` } +// Constants associated with the LoadBalancerProfile.Family property. +// The product family this load balancer profile belongs to. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the +// unexpected property value was encountered. +const ( + LoadBalancerProfileFamilyApplicationConst = "application" + LoadBalancerProfileFamilyNetworkConst = "network" +) + // UnmarshalLoadBalancerProfile unmarshals an instance of LoadBalancerProfile from the specified map of raw messages. func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerProfile) @@ -63005,6 +63035,10 @@ func UnmarshalLoadBalancerProfileLoggingSupported(m map[string]json.RawMessage, // LoadBalancerProfileReference : LoadBalancerProfileReference struct type LoadBalancerProfileReference struct { // The product family this load balancer profile belongs to. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the + // unexpected property value was encountered. Family *string `json:"family" validate:"required"` // The URL for this load balancer profile. @@ -63014,6 +63048,17 @@ type LoadBalancerProfileReference struct { Name *string `json:"name" validate:"required"` } +// Constants associated with the LoadBalancerProfileReference.Family property. +// The product family this load balancer profile belongs to. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the +// unexpected property value was encountered. +const ( + LoadBalancerProfileReferenceFamilyApplicationConst = "application" + LoadBalancerProfileReferenceFamilyNetworkConst = "network" +) + // UnmarshalLoadBalancerProfileReference unmarshals an instance of LoadBalancerProfileReference from the specified map of raw messages. func UnmarshalLoadBalancerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerProfileReference) @@ -70861,7 +70906,7 @@ type Share struct { // The key used to encrypt this file share. // - // This property will be present if `encryption_type` is `user_managed`. + // This property will be present if `encryption` is `user_managed`. EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` // The URL for this file share. @@ -72044,7 +72089,8 @@ type SharePatch struct { // The maximum input/output operations per second (IOPS) for the file share. The value must be in the range supported // by the share's size. // - // For this property to be changed, the share `lifecycle_state` must be `stable`. + // For this property to be changed, the share `lifecycle_state` must be `stable` and + // `replication_role` must not be `replica`. Iops *int64 `json:"iops,omitempty"` // The name for this share. The name must not be used by another share in the region. @@ -72065,7 +72111,8 @@ type SharePatch struct { // The size of the file share rounded up to the next gigabyte. The value must not be less than the share's current // size, and must not exceed the maximum supported by the share's profile and IOPS. // - // For this property to be changed, the share `lifecycle_state` must be `stable`. + // For this property to be changed, the share `lifecycle_state` must be `stable` and + // `replication_role` must not be `replica`. Size *int64 `json:"size,omitempty"` // Tags for this resource. @@ -73338,7 +73385,7 @@ type SnapshotConsistencyGroup struct { // The member snapshots that are data-consistent with respect to captured time. (may be // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - Snapshots []SnapshotConsistencyGroupSnapshotsItem `json:"snapshots" validate:"required"` + Snapshots []SnapshotReference `json:"snapshots" validate:"required"` } // Constants associated with the SnapshotConsistencyGroup.LifecycleState property. @@ -73406,7 +73453,7 @@ func UnmarshalSnapshotConsistencyGroup(m map[string]json.RawMessage, result inte if err != nil { return } - err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotConsistencyGroupSnapshotsItem) + err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotReference) if err != nil { return } @@ -73560,7 +73607,7 @@ type SnapshotConsistencyGroupPrototype struct { // The data-consistent member snapshots to create. All snapshots must specify a // `source_volume` attached to the same virtual server instance. - Snapshots []SnapshotConsistencyGroupPrototypeSnapshotsItem `json:"snapshots,omitempty"` + Snapshots []SnapshotPrototypeSnapshotConsistencyGroupContext `json:"snapshots,omitempty"` } func (*SnapshotConsistencyGroupPrototype) isaSnapshotConsistencyGroupPrototype() bool { @@ -73586,89 +73633,7 @@ func UnmarshalSnapshotConsistencyGroupPrototype(m map[string]json.RawMessage, re if err != nil { return } - err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotConsistencyGroupPrototypeSnapshotsItem) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem : SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem struct -type SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem struct { - // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The volume to create this snapshot from. - SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. - UserTags []string `json:"user_tags,omitempty"` -} - -// NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem : Instantiate SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem (Generic Model Constructor) -func (*VpcV1) NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem(sourceVolume VolumeIdentityIntf) (_model *SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem, err error) { - _model = &SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem{ - SourceVolume: sourceVolume, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem unmarshals an instance of SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem from the specified map of raw messages. -func UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotConsistencyGroupPrototypeSnapshotsItem : SnapshotConsistencyGroupPrototypeSnapshotsItem struct -type SnapshotConsistencyGroupPrototypeSnapshotsItem struct { - // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The volume to create this snapshot from. - SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. - UserTags []string `json:"user_tags,omitempty"` -} - -// NewSnapshotConsistencyGroupPrototypeSnapshotsItem : Instantiate SnapshotConsistencyGroupPrototypeSnapshotsItem (Generic Model Constructor) -func (*VpcV1) NewSnapshotConsistencyGroupPrototypeSnapshotsItem(sourceVolume VolumeIdentityIntf) (_model *SnapshotConsistencyGroupPrototypeSnapshotsItem, err error) { - _model = &SnapshotConsistencyGroupPrototypeSnapshotsItem{ - SourceVolume: sourceVolume, - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -// UnmarshalSnapshotConsistencyGroupPrototypeSnapshotsItem unmarshals an instance of SnapshotConsistencyGroupPrototypeSnapshotsItem from the specified map of raw messages. -func UnmarshalSnapshotConsistencyGroupPrototypeSnapshotsItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotConsistencyGroupPrototypeSnapshotsItem) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext) if err != nil { return } @@ -73754,73 +73719,6 @@ func UnmarshalSnapshotConsistencyGroupReferenceDeleted(m map[string]json.RawMess return } -// SnapshotConsistencyGroupSnapshotsItem : SnapshotConsistencyGroupSnapshotsItem struct -type SnapshotConsistencyGroupSnapshotsItem struct { - // The CRN of this snapshot. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this snapshot. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this snapshot. - ID *string `json:"id" validate:"required"` - - // The name for this snapshot. The name is unique across all snapshots in the region. - 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 *SnapshotRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SnapshotConsistencyGroupSnapshotsItem.ResourceType property. -// The resource type. -const ( - SnapshotConsistencyGroupSnapshotsItemResourceTypeSnapshotConst = "snapshot" -) - -// UnmarshalSnapshotConsistencyGroupSnapshotsItem unmarshals an instance of SnapshotConsistencyGroupSnapshotsItem from the specified map of raw messages. -func UnmarshalSnapshotConsistencyGroupSnapshotsItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotConsistencyGroupSnapshotsItem) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // SnapshotCopiesItem : SnapshotCopiesItem struct type SnapshotCopiesItem struct { // The CRN for the copied snapshot. @@ -74046,6 +73944,47 @@ func UnmarshalSnapshotPrototype(m map[string]json.RawMessage, result interface{} return } +// SnapshotPrototypeSnapshotConsistencyGroupContext : SnapshotPrototypeSnapshotConsistencyGroupContext struct +type SnapshotPrototypeSnapshotConsistencyGroupContext struct { + // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The volume to create this snapshot from. + SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` +} + +// NewSnapshotPrototypeSnapshotConsistencyGroupContext : Instantiate SnapshotPrototypeSnapshotConsistencyGroupContext (Generic Model Constructor) +func (*VpcV1) NewSnapshotPrototypeSnapshotConsistencyGroupContext(sourceVolume VolumeIdentityIntf) (_model *SnapshotPrototypeSnapshotConsistencyGroupContext, err error) { + _model = &SnapshotPrototypeSnapshotConsistencyGroupContext{ + SourceVolume: sourceVolume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext unmarshals an instance of SnapshotPrototypeSnapshotConsistencyGroupContext from the specified map of raw messages. +func UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPrototypeSnapshotConsistencyGroupContext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SnapshotReference : SnapshotReference struct type SnapshotReference struct { // The CRN of this snapshot. @@ -79720,7 +79659,7 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPrototype(m map[string]json.RawMess // VPNGatewayConnectionLocalCIDRs : VPNGatewayConnectionLocalCIDRs struct type VPNGatewayConnectionLocalCIDRs struct { // The local CIDRs for this resource. - LocalCIDRs []string `json:"local_cidrs,omitempty"` + LocalCIDRs []string `json:"local_cidrs" validate:"required"` } // UnmarshalVPNGatewayConnectionLocalCIDRs unmarshals an instance of VPNGatewayConnectionLocalCIDRs from the specified map of raw messages. @@ -79821,7 +79760,7 @@ func (vpnGatewayConnectionPatch *VPNGatewayConnectionPatch) AsPatch() (_patch ma // VPNGatewayConnectionPeerCIDRs : VPNGatewayConnectionPeerCIDRs struct type VPNGatewayConnectionPeerCIDRs struct { // The peer CIDRs for this resource. - PeerCIDRs []string `json:"peer_cidrs,omitempty"` + PeerCIDRs []string `json:"peer_cidrs" validate:"required"` } // UnmarshalVPNGatewayConnectionPeerCIDRs unmarshals an instance of VPNGatewayConnectionPeerCIDRs from the specified map of raw messages. @@ -96126,7 +96065,13 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st return } -// InstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Create an instance template from an existing instance template. +// InstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Create an instance template from an existing source instance template. +// +// The `primary_network_attachment` and `network_attachments` properties may only be specified if +// `primary_network_attachment` is specified in the source template. +// +// The `primary_network_interface` and `network_interfaces` properties may only be specified if +// `primary_network_interface` is specified in the source template. // This model "extends" InstanceTemplatePrototype type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The availability policy to use for this virtual server instance. @@ -103047,6 +102992,7 @@ func UnmarshalShareIdentityByID(m map[string]json.RawMessage, result interface{} // ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : The virtual network interface for this share mount target. The virtual network interface must: // +// - be in the same `zone` as the share // - have `allow_ip_spoofing` set to `false` // - have `enable_infrastructure_nat` set to `true` // - not be in the same VPC as an existing mount target for this share @@ -104040,11 +103986,11 @@ type SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots struct // The data-consistent member snapshots to create. All snapshots must specify a // `source_volume` attached to the same virtual server instance. - Snapshots []SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem `json:"snapshots" validate:"required"` + Snapshots []SnapshotPrototypeSnapshotConsistencyGroupContext `json:"snapshots" validate:"required"` } // NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots : Instantiate SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots (Generic Model Constructor) -func (*VpcV1) NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots(snapshots []SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) (_model *SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots, err error) { +func (*VpcV1) NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots(snapshots []SnapshotPrototypeSnapshotConsistencyGroupContext) (_model *SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots, err error) { _model = &SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots{ Snapshots: snapshots, } @@ -104071,7 +104017,7 @@ func UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapsho if err != nil { return } - err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshotsSnapshotsItem) + err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext) if err != nil { return } diff --git a/go.mod b/go.mod index 0b640f60ec..6cabcc588a 100644 --- a/go.mod +++ b/go.mod @@ -238,7 +238,7 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt // add sdk changes. replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.47.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.48.0 => ./common/github.com/IBM/vpc-go-sdk exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 From 909cb1fda14ff3a9fa8ece90f6887812a955ab77 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 5 Mar 2024 10:58:49 +0530 Subject: [PATCH 054/103] breaking changes --- ibm/service/iampolicy/resource_ibm_iam_user_policy_test.go | 2 -- .../vpc/data_source_ibm_is_snapshot_consistency_group.go | 2 +- .../vpc/resource_ibm_is_snapshot_consistency_group.go | 6 +++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ibm/service/iampolicy/resource_ibm_iam_user_policy_test.go b/ibm/service/iampolicy/resource_ibm_iam_user_policy_test.go index 91b62395a5..ce861ce2f4 100644 --- a/ibm/service/iampolicy/resource_ibm_iam_user_policy_test.go +++ b/ibm/service/iampolicy/resource_ibm_iam_user_policy_test.go @@ -226,7 +226,6 @@ func TestAccIBMIAMUserPolicy_With_Resource_Attributes_Without_Wildcard(t *testin }) } - func TestAccIBMIAMUserPolicy_account_management(t *testing.T) { var conf iampolicymanagementv1.V2PolicyTemplateMetaData name := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) @@ -848,7 +847,6 @@ func testAccCheckIBMIAMUserPolicyResourceAttributesWithoutWildcard() string { `, acc.IAMUser) } - func testAccCheckIBMIAMUserPolicyResourceAttributesUpdate() string { return fmt.Sprintf(` resource "ibm_iam_user_policy" "policy" { diff --git a/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go index 74a7efa3c0..6dc6c45c17 100644 --- a/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go +++ b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go @@ -543,7 +543,7 @@ func dataSourceIBMIsSnapshotConsistencyGroupResourceGroupReferenceToMap(model *v return modelMap, nil } -func dataSourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(model *vpcv1.SnapshotConsistencyGroupSnapshotsItem) (map[string]interface{}, error) { +func dataSourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(model *vpcv1.SnapshotReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["crn"] = model.CRN if model.Deleted != nil { diff --git a/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go b/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go index c73112fb3d..b7c38774e4 100644 --- a/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go +++ b/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go @@ -316,11 +316,11 @@ func resourceIBMIsSnapshotConsistencyGroupCreate(context context.Context, d *sch ID: &rg, } } - var snapshotConsistencyGroupPrototypeSnapshotsItemArray []vpcv1.SnapshotConsistencyGroupPrototypeSnapshotsItem + var snapshotConsistencyGroupPrototypeSnapshotsItemArray []vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext snapshotsArray := d.Get("snapshots").([]interface{}) for _, snapshot := range snapshotsArray { snapshotVal := snapshot.(map[string]interface{}) - snapshotConsistencyGroupPrototypeSnapshotsItem := &vpcv1.SnapshotConsistencyGroupPrototypeSnapshotsItem{} + snapshotConsistencyGroupPrototypeSnapshotsItem := &vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext{} volume := snapshotVal["source_volume"].(string) snapshotConsistencyGroupPrototypeSnapshotsItem.SourceVolume = &vpcv1.VolumeIdentity{ @@ -714,7 +714,7 @@ func resourceIBMIsSnapshotConsistencyGroupResourceGroupReferenceToMap(model *vpc return modelMap, nil } -func resourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(model *vpcv1.SnapshotConsistencyGroupSnapshotsItem) (map[string]interface{}, error) { +func resourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(model *vpcv1.SnapshotReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["crn"] = model.CRN if model.Deleted != nil { From ff09301308773b066cc7c1e4f1b6aab1c2a5764a Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 6 Mar 2024 15:59:25 +0530 Subject: [PATCH 055/103] sdk changes --- .../IBM/vpc-go-sdk/.bumpversion.cfg | 13 + .../github.com/IBM/vpc-go-sdk/.gitattributes | 1 + common/github.com/IBM/vpc-go-sdk/.gitignore | 18 + common/github.com/IBM/vpc-go-sdk/.releaserc | 21 + common/github.com/IBM/vpc-go-sdk/.travis.yml | 39 + common/github.com/IBM/vpc-go-sdk/CHANGELOG.md | 96 + .../IBM/vpc-go-sdk/CODE_OF_CONDUCT.md | 76 + .../github.com/IBM/vpc-go-sdk/CONTRIBUTING.md | 14 + common/github.com/IBM/vpc-go-sdk/LICENSE | 201 + common/github.com/IBM/vpc-go-sdk/Makefile | 23 + common/github.com/IBM/vpc-go-sdk/README.md | 195 + .../IBM/vpc-go-sdk/common/headers.go | 67 + .../IBM/vpc-go-sdk/common/headers_test.go | 30 + .../IBM/vpc-go-sdk/common/version.go | 4 + common/github.com/IBM/vpc-go-sdk/go.mod | 17 + common/github.com/IBM/vpc-go-sdk/go.sum | 143 + .../IBM/vpc-go-sdk/package-lock.json | 828 + .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 122271 +++++++++++++++ go.mod | 2 + .../resource_ibm_iam_user_policy_test.go | 2 - ...ource_ibm_is_snapshot_consistency_group.go | 2 +- 21 files changed, 124060 insertions(+), 3 deletions(-) create mode 100644 common/github.com/IBM/vpc-go-sdk/.bumpversion.cfg create mode 100644 common/github.com/IBM/vpc-go-sdk/.gitattributes create mode 100644 common/github.com/IBM/vpc-go-sdk/.gitignore create mode 100644 common/github.com/IBM/vpc-go-sdk/.releaserc create mode 100644 common/github.com/IBM/vpc-go-sdk/.travis.yml create mode 100644 common/github.com/IBM/vpc-go-sdk/CHANGELOG.md create mode 100644 common/github.com/IBM/vpc-go-sdk/CODE_OF_CONDUCT.md create mode 100644 common/github.com/IBM/vpc-go-sdk/CONTRIBUTING.md create mode 100644 common/github.com/IBM/vpc-go-sdk/LICENSE create mode 100644 common/github.com/IBM/vpc-go-sdk/Makefile create mode 100644 common/github.com/IBM/vpc-go-sdk/README.md create mode 100644 common/github.com/IBM/vpc-go-sdk/common/headers.go create mode 100644 common/github.com/IBM/vpc-go-sdk/common/headers_test.go create mode 100644 common/github.com/IBM/vpc-go-sdk/common/version.go create mode 100644 common/github.com/IBM/vpc-go-sdk/go.mod create mode 100644 common/github.com/IBM/vpc-go-sdk/go.sum create mode 100644 common/github.com/IBM/vpc-go-sdk/package-lock.json create mode 100644 common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go diff --git a/common/github.com/IBM/vpc-go-sdk/.bumpversion.cfg b/common/github.com/IBM/vpc-go-sdk/.bumpversion.cfg new file mode 100644 index 0000000000..75285ab0b2 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/.bumpversion.cfg @@ -0,0 +1,13 @@ +[bumpversion] +current_version = 0.6.0 +commit = True +message = Update version {current_version} -> {new_version} [skip ci] + +[bumpversion:file:common/version.go] +search = const Version = "{current_version}" +replace = const Version = "{new_version}" + +[bumpversion:file:README.md] +search = {current_version} +replace = {new_version} + diff --git a/common/github.com/IBM/vpc-go-sdk/.gitattributes b/common/github.com/IBM/vpc-go-sdk/.gitattributes new file mode 100644 index 0000000000..3bfcae65ad --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/.gitattributes @@ -0,0 +1 @@ +*.enc binary \ No newline at end of file diff --git a/common/github.com/IBM/vpc-go-sdk/.gitignore b/common/github.com/IBM/vpc-go-sdk/.gitignore new file mode 100644 index 0000000000..2be5a24d4d --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/.gitignore @@ -0,0 +1,18 @@ +# OS stuff +.DS_Store + +# generator files +.openapi-generator-ignore +.openapi-generator/VERSION + +# credentials +.env +*.env + +# ignore vendor/ +vendor/ + +/.project +/.openapi-generator/ + +main/ \ No newline at end of file diff --git a/common/github.com/IBM/vpc-go-sdk/.releaserc b/common/github.com/IBM/vpc-go-sdk/.releaserc new file mode 100644 index 0000000000..a746388363 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/.releaserc @@ -0,0 +1,21 @@ +{ + "debug": true, + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + [ + "@semantic-release/exec", + { + "prepareCmd": "bump2version --allow-dirty --current-version ${lastRelease.version} --new-version ${nextRelease.version} patch" + } + ], + [ + "@semantic-release/git", + { + "message": "chore(release): ${nextRelease.version} release notes [skip ci]\n\n${nextRelease.notes}" + } + ], + "@semantic-release/github" + ] +} diff --git a/common/github.com/IBM/vpc-go-sdk/.travis.yml b/common/github.com/IBM/vpc-go-sdk/.travis.yml new file mode 100644 index 0000000000..464cdde97c --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/.travis.yml @@ -0,0 +1,39 @@ +language: go + +dist: xenial + +notifications: + email: true + +go: +- 1.14.x + +env: + global: + - GO111MODULE=on + +before_install: +- sudo apt-get update +- sudo apt-get install python +- nvm install 12 +- npm install -g npm@6.x + +install: +- curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.37.1 + +script: +- make travis-ci + +# before_deploy: +# - pip install --user bump2version +# - npm install @semantic-release/changelog +# - npm install @semantic-release/exec +# - npm install @semantic-release/git +# - npm install @semantic-release/github + +# deploy: +# - provider: script +# script: npx semantic-release +# skip_cleanup: true +# on: +# branch: master diff --git a/common/github.com/IBM/vpc-go-sdk/CHANGELOG.md b/common/github.com/IBM/vpc-go-sdk/CHANGELOG.md new file mode 100644 index 0000000000..37bf62185e --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/CHANGELOG.md @@ -0,0 +1,96 @@ +## [1.0.1](https://github.com/IBM/vpc-go-sdk/compare/v1.0.0...v1.0.1) (2021-04-07) + + +### Bug Fixes + +* **release:** Update SDKs to use API version 2021-03-30 ([#27](https://github.com/IBM/vpc-go-sdk/issues/27)) ([ba27a36](https://github.com/IBM/vpc-go-sdk/commit/ba27a36f743d07a1cae4fb45f83478adf4d33d79)) + +# [1.0.0](https://github.com/IBM/vpc-go-sdk/compare/v0.4.2...v1.0.0) (2021-03-16) + + +### Performance Improvements + +* **Instance-groups:** Update VPC SDK with API version 2021-03-09 ([#23](https://github.com/IBM/vpc-go-sdk/issues/23)) ([d6dc319](https://github.com/IBM/vpc-go-sdk/commit/d6dc319bb5aa19aff4fd89872198b6e573545110)) + + +### BREAKING CHANGES + +* **Instance-groups:** - Methods for Instance group manager is now producing InstanceGroupManagerIntf instead of InstanceGroupManager + +## [0.4.2](https://github.com/IBM/vpc-go-sdk/compare/v0.4.1...v0.4.2) (2021-03-02) + + +### Bug Fixes + +* **release:** Update SDKs to use API version 2021-02-09 ([#20](https://github.com/IBM/vpc-go-sdk/issues/20)) ([ae348ee](https://github.com/IBM/vpc-go-sdk/commit/ae348ee347f7405fac4ab4574392673a9194f6bd)) + +## [0.4.1](https://github.com/IBM/vpc-go-sdk/compare/v0.4.0...v0.4.1) (2021-01-18) + + +### Bug Fixes + +* **release:** Update SDKs to use API version 2020-01-12 ([#18](https://github.com/IBM/vpc-go-sdk/issues/18)) ([d8c2134](https://github.com/IBM/vpc-go-sdk/commit/d8c21345b1ed032484fbaf57456d4f476423b5fc)) + +# [0.4.0](https://github.com/IBM/vpc-go-sdk/compare/v0.3.1...v0.4.0) (2020-12-17) + + +### Features + +* **enhancement:** Update VPC service with API version 2020-12-15 ([#17](https://github.com/IBM/vpc-go-sdk/issues/17)) ([affcaed](https://github.com/IBM/vpc-go-sdk/commit/affcaed4e8f7e515148cb9aac82755ad2a3ea8ca)) + +## [0.3.1](https://github.com/IBM/vpc-go-sdk/compare/v0.3.0...v0.3.1) (2020-11-20) + + +### Bug Fixes + +* **SecurityGroup:** Update both VPC services fixing security group issue. ([#16](https://github.com/IBM/vpc-go-sdk/issues/16)) ([270decd](https://github.com/IBM/vpc-go-sdk/commit/270decd989abd0ed5b9cd101d6c7a2fcb9deecc2)) + +# [0.3.0](https://github.com/IBM/vpc-go-sdk/compare/v0.2.0...v0.3.0) (2020-11-20) + + +### Features + +* **SDK:** Update VPC Gen2 and Gen1 services with API version 2020-11-17 ([#15](https://github.com/IBM/vpc-go-sdk/issues/15)) ([6f97a1a](https://github.com/IBM/vpc-go-sdk/commit/6f97a1a643dce6d76f8ada9caecc49d864b656fa)) + +# [0.2.0](https://github.com/IBM/vpc-go-sdk/compare/v0.1.1...v0.2.0) (2020-10-16) + + +### Features + +* **version update:** Update both services with API version 2020-10-06 ([#14](https://github.com/IBM/vpc-go-sdk/issues/14)) ([179880c](https://github.com/IBM/vpc-go-sdk/commit/179880c4775e0d6e6a9e683546348b34e9f9b785)) + +## [0.1.1](https://github.com/IBM/vpc-go-sdk/compare/v0.1.0...v0.1.1) (2020-09-09) + + +### Bug Fixes + +* **NLB:** update NLB feature ([#13](https://github.com/IBM/vpc-go-sdk/issues/13)) ([99d207d](https://github.com/IBM/vpc-go-sdk/commit/99d207dba81fef5214be63864aa7a4b91af82c89)) + +# [0.1.0](https://github.com/IBM/vpc-go-sdk/compare/v0.0.3...v0.1.0) (2020-09-03) + + +### Features + +* **autoscale:** Add autoscale feature and NLB feature ([#12](https://github.com/IBM/vpc-go-sdk/issues/12)) ([0ee5ea1](https://github.com/IBM/vpc-go-sdk/commit/0ee5ea16247a6f94794674d0499c01e78857d6a4)) + +## [0.0.3](https://github.com/IBM/vpc-go-sdk/compare/v0.0.2...v0.0.3) (2020-08-06) + + +### Bug Fixes + +* **version:** Release SDK for API version 2020-07-28 ([#10](https://github.com/IBM/vpc-go-sdk/issues/10)) ([4550ccc](https://github.com/IBM/vpc-go-sdk/commit/4550cccb167443bad8857dc88fc097ad18061734)) + +## [0.0.2](https://github.com/IBM/vpc-go-sdk/compare/v0.0.1...v0.0.2) (2020-07-06) + + +### Bug Fixes + +* **doc:** Minor update to example code in the README ([#9](https://github.com/IBM/vpc-go-sdk/issues/9)) ([f3841fc](https://github.com/IBM/vpc-go-sdk/commit/f3841fcfbffab66d970ec966b558a48180f0651c)) + +## [0.0.1](https://github.com/IBM/vpc-go-sdk/compare/v0.0.0...v0.0.1) (2020-06-19) + + +### Bug Fixes + +* **go-sdk:** adding semantic release versioning ([#4](https://github.com/IBM/vpc-go-sdk/issues/4)) ([1d92ee5](https://github.com/IBM/vpc-go-sdk/commit/1d92ee5d6481c923382628e8dfc9b9de51cc7ddd)) +* **version:** Update version to enable semantic release ([#6](https://github.com/IBM/vpc-go-sdk/issues/6)) ([2699a61](https://github.com/IBM/vpc-go-sdk/commit/2699a615cd9fad5de60ef442c7512a8744c676a1)) diff --git a/common/github.com/IBM/vpc-go-sdk/CODE_OF_CONDUCT.md b/common/github.com/IBM/vpc-go-sdk/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..7303c87870 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at phil_adams@us.ibm.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/common/github.com/IBM/vpc-go-sdk/CONTRIBUTING.md b/common/github.com/IBM/vpc-go-sdk/CONTRIBUTING.md new file mode 100644 index 0000000000..fee9f665c1 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/CONTRIBUTING.md @@ -0,0 +1,14 @@ +# Questions +If you are having problems using the APIs or have a question about IBM Cloud services, +please ask a question at +[Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-cloud). + +# Issues +If you encounter an issue with the project, you are welcome to submit a +[bug report](https://github.com/IBM/vpc-go-sdk/issues). +Before that, please search for similar issues. It's possible that someone has already reported the problem. + +# General Information +For general guidance on contributing to this project, please see +[this link](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/CONTRIBUTING_go.md) + diff --git a/common/github.com/IBM/vpc-go-sdk/LICENSE b/common/github.com/IBM/vpc-go-sdk/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/common/github.com/IBM/vpc-go-sdk/Makefile b/common/github.com/IBM/vpc-go-sdk/Makefile new file mode 100644 index 0000000000..81fb2e0b5a --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/Makefile @@ -0,0 +1,23 @@ +# Makefile + +all: build lint tidy + +travis-ci: build lint tidy test-unit + +build: + go build ./vpcv1 + +test-unit: + go test `go list ./... | grep vpcv1` -v -tags=unit + +test-integration: + go test `go list ./... | grep vpcv1` -v -tags=integration -skipForMockTesting -testCount + +test-examples: + go test `go list ./... | grep vpcv1` -v -tags=examples + +lint: + golangci-lint --timeout=2m run + +tidy: + go mod tidy diff --git a/common/github.com/IBM/vpc-go-sdk/README.md b/common/github.com/IBM/vpc-go-sdk/README.md new file mode 100644 index 0000000000..495cea1a68 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/README.md @@ -0,0 +1,195 @@ +[![Build Status](https://travis-ci.com/IBM/vpc-go-sdk.svg?branch=master)](https://travis-ci.com/IBM/vpc-go-sdk) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +![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.16.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.16.0 from now on. Refrain from using commands like `go get -u ..` and `go get ..@latest` 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 + + + + +- [Overview](#overview) +- [Prerequisites](#prerequisites) +- [Installation](#installation) + + [`go get` command](#go-get-command) + + [Go modules](#go-modules) + + [`dep` dependency manager](#dep-dependency-manager) +- [Using the SDK](#using-the-sdk) +- [Setting up VPC service](#setting-up-vpc-service) +- [Questions](#questions) +- [Issues](#issues) +- [Open source @ IBM](#open-source--ibm) +- [Contributing](#contributing) +- [License](#license) + + + +## Overview + +The IBM Cloud VPC Go SDK allows developers to programmatically interact with the following IBM Cloud services: + +Service Name | Package name +--- | --- +[VPC](https://cloud.ibm.com/apidocs/vpc) | vpcv1 + +## Prerequisites + +[ibm-cloud-onboarding]: https://cloud.ibm.com/registration + +* An [IBM Cloud][ibm-cloud-onboarding] account. +* An IAM API key to allow the SDK to access your account. Create an apikey [here](https://cloud.ibm.com/iam/apikeys). +* Go version 1.12 or above. + +## Installation +There are a few different ways to download and install the VPC Go SDK services for use by your +Go application: + +#### `go get` command +Use this command to download and install the VPC Go SDK service to allow your Go application to +use it: + +``` +go get github.com/IBM/vpc-go-sdk@v0.14.0 +``` + + +#### Go modules +If your application is using Go modules, you can add a suitable import to your +Go application, like this: + + +```go +import ( + "github.com/IBM/vpc-go-sdk/vpcv1" +) +``` + +Then run `go mod tidy` to download and install the new dependency and update your Go application's +`go.mod` file. + + +#### `dep` dependency manager +If your application is using the `dep` dependency management tool, you can add a dependency +to your `Gopkg.toml` file. Here is an example: + +``` +[[constraint]] + name = "github.com/IBM/vpc-go-sdk/" + version = "0.16.0" +``` + +Then run `dep ensure`. + +## Using the SDK +For general SDK usage information, see the [IBM Cloud SDK Common README](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/README.md) + +## Setting up VPC service + +A quick example to get you up and running with VPC Go SDK service in Dallas (us-south) region. + +For other regions, see [API Endpoints for VPC](https://cloud.ibm.com/apidocs/vpc#api-endpoint) and update the `URL` variable accordingly. + + +Refer to the [VPC Release Notes](https://cloud.ibm.com/docs/vpc?topic=vpc-release-notes) to find out latest version release. + +```go +package main + +import ( + "log" + "os" + + "github.com/IBM/go-sdk-core/v4/core" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func main() { + apiKey := os.Getenv("IBMCLOUD_API_KEY") + if apiKey == "" { + log.Fatal("No API key set") + } + + // Instantiate the service with an API key based IAM authenticator + vpcService, err := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + Authenticator: &core.IamAuthenticator{ + ApiKey: apiKey, + }, + }) + if err != nil { + log.Fatal("Error creating VPC Service.") + } + + // Retrieve the list of regions for your account. + regions, detailedResponse, err := vpcService.ListRegions(&vpcv1.ListRegionsOptions{}) + if err != nil { + log.Fatalf("Failed to list the regions: %v and the response is: %s", err, detailedResponse) + } + log.Printf("Regions: %#v", regions) + + // Retrieve the list of vpcs for your account. + vpcs, detailedResponse, err := vpcService.ListVpcs(&vpcv1.ListVpcsOptions{}) + if err != nil { + log.Fatalf("Failed to list vpcs: %v and the response is: %s", err, detailedResponse) + } + log.Printf("VPCs: %#v", vpcs) + + // Create an SSH key + sshKeyOptions := &vpcv1.CreateKeyOptions{ + Name: core.StringPtr("my-ssh-key"), + } + // Setters also exist to set fields are the struct has been created + sshKeyOptions.SetPublicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsnrSAe8eBi8mS576Z96UtYgUzDR9Sbw/s1ELxsa1KUK82JQ0Ejmz31N6sHyiT/l5533JgGL6rKamLFziMY2VX2bdyuF5YzyHhmapT+e21kuTatB50UsXzxlYEWpCmFdnd4LhwFn6AycJWOV0k3e0ePpVxgHc+pVfE89322cbmfuppeHxvxc+KSzQNYC59A+A2vhucbuWppyL3EIF4YgLwOr5iDISm1IR0+EEL3yJQIG4M2WKu526anI85QBcIWyFwQXOpdcX2eZRcd6WW2EgAM3fIOaezkm0CFrsz8rQ0MPYZI4BS2CWwg5d4Bj7SU2sjXz62gfQkQGTYWSqhizVb root@localhost") + key, detailedResponse, err := vpcService.CreateKey(sshKeyOptions) + if err != nil { + log.Fatalf("Failed to create the ssh key: %v and the response is: %s", err, detailedResponse) + } + log.Printf("SSH key: %s created with ID: %s", *key.Name, *key.ID) + + // Delete SSH key + detailedResponse, err = vpcService.DeleteKey(&vpcv1.DeleteKeyOptions{ + ID: key.ID, + }) + if err != nil { + log.Fatalf("Failed to delete the ssh key: %v and the response is: %s", err, detailedResponse) + } + + log.Printf("SSH key: %s deleted with ID: %s", *key.Name, *key.ID) +} +``` + +## Questions + +If you have difficulties using this SDK or you have a question about the IBM Cloud services, +ask a question at +[Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-cloud). + +## Issues +If you encounter an issue with the project, you are welcome to submit a +[bug report](/issues). +Before you create a new issue, search for similar issues. It's possible that someone has already reported the problem. + +## Open source @ IBM +Find more open source projects on the [IBM Github Page](http://ibm.github.io/). + +## Contributing +See [CONTRIBUTING](CONTRIBUTING.md). + +## License + +This SDK project is released under the Apache 2.0 license. +The license's full text can be found in [LICENSE](LICENSE). diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers.go b/common/github.com/IBM/vpc-go-sdk/common/headers.go new file mode 100644 index 0000000000..87cc2bfcd9 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/common/headers.go @@ -0,0 +1,67 @@ +package common + +import ( + "fmt" + "runtime" + + "github.com/google/uuid" +) + +const ( + HEADER_NAME_USER_AGENT = "User-Agent" + + SDK_NAME = "vpc-go-sdk" + + X_CORRELATION_ID = "X-Correlation-Id" + + X_REQUEST_ID = "X-Request-Id" +) + +// GetSdkHeaders - returns the set of SDK-specific headers to be included in an outgoing request. +// +// This function is invoked by generated service methods (i.e. methods which implement the REST API operations +// defined within the API definition). The purpose of this function is to give the SDK implementor the opportunity +// to provide SDK-specific HTTP headers that will be sent with an outgoing REST API request. +// This function is invoked for each invocation of a generated service method, +// so the set of HTTP headers could be request-specific. +// As an optimization, if your SDK will be returning the same set of HTTP headers for each invocation of this +// function, it is recommended that you initialize the returned map just once (perhaps by using +// lazy initialization) and simply return it each time the function is invoked, instead of building it each time +// as in the example below. +// +// Parameters: +// +// serviceName - the name of the service as defined in the API definition (e.g. "MyService1") +// serviceVersion - the version of the service as defined in the API definition (e.g. "V1") +// operationId - the operationId as defined in the API definition (e.g. getContext) +// +// Returns: +// +// a Map which contains the set of headers to be included in the REST API request +func GetSdkHeaders(serviceName string, serviceVersion string, operationId string) map[string]string { + sdkHeaders := make(map[string]string) + + sdkHeaders[HEADER_NAME_USER_AGENT] = GetUserAgentInfo() + sdkHeaders[X_CORRELATION_ID] = GetNewXCorrelationID() + sdkHeaders[X_REQUEST_ID] = GetNewXRequestID() + + return sdkHeaders +} + +var UserAgent string = fmt.Sprintf("%s-%s %s", SDK_NAME, Version, GetSystemInfo()) + +func GetUserAgentInfo() string { + return UserAgent +} +func GetNewXCorrelationID() string { + return uuid.New().String() +} +func GetNewXRequestID() string { + return uuid.New().String() +} + +var systemInfo = fmt.Sprintf("(arch=%s; os=%s; go.version=%s)", runtime.GOARCH, runtime.GOOS, runtime.Version()) + +func GetSystemInfo() string { + return systemInfo +} diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers_test.go b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go new file mode 100644 index 0000000000..c8e610ed55 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go @@ -0,0 +1,30 @@ +package common + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestGetSystemInfo(t *testing.T) { + var sysinfo = GetSystemInfo() + assert.NotNil(t, sysinfo) + assert.True(t, strings.Contains(sysinfo, "arch=")) + assert.True(t, strings.Contains(sysinfo, "os=")) + assert.True(t, strings.Contains(sysinfo, "go.version=")) +} + +func TestGetSdkHeaders(t *testing.T) { + var headers = GetSdkHeaders("myService", "v123", "myOperation") + assert.NotNil(t, headers) + + var foundIt bool + + _, foundIt = headers[HEADER_NAME_USER_AGENT] + assert.True(t, foundIt) + _, foundIt = headers[X_CORRELATION_ID] + assert.True(t, foundIt) + _, foundIt = headers[X_REQUEST_ID] + assert.True(t, foundIt) +} diff --git a/common/github.com/IBM/vpc-go-sdk/common/version.go b/common/github.com/IBM/vpc-go-sdk/common/version.go new file mode 100644 index 0000000000..623548bdac --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/common/version.go @@ -0,0 +1,4 @@ +package common + +// Version of the SDK +const Version = "0.6.0" diff --git a/common/github.com/IBM/vpc-go-sdk/go.mod b/common/github.com/IBM/vpc-go-sdk/go.mod new file mode 100644 index 0000000000..466fa3d20e --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/go.mod @@ -0,0 +1,17 @@ +module github.com/IBM/vpc-go-sdk + +go 1.16 + +require ( + github.com/IBM/go-sdk-core/v5 v5.12.1 + github.com/go-openapi/strfmt v0.21.3 + github.com/onsi/ginkgo v1.16.5 + github.com/onsi/gomega v1.20.0 + github.com/stretchr/testify v1.8.0 +) + +retract ( + v1.0.2 + v1.0.1 + v1.0.0 +) \ No newline at end of file diff --git a/common/github.com/IBM/vpc-go-sdk/go.sum b/common/github.com/IBM/vpc-go-sdk/go.sum new file mode 100644 index 0000000000..88c822dd8e --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/go.sum @@ -0,0 +1,143 @@ +github.com/IBM/go-sdk-core/v5 v5.9.1 h1:06pXbD9Rgmqqe2HA5YAeQbB4eYRRFgIoOT+Kh3cp1zo= +github.com/IBM/go-sdk-core/v5 v5.9.1/go.mod h1:axE2JrRq79gIJTjKPBwV6gWHswvVptBjbcvvCPIxARM= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +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/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/go-openapi/errors v0.19.8 h1:doM+tQdZbUm9gydV9yR+iQNmztbjj7I3sW4sIcAwIzc= +github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/strfmt v0.21.1 h1:G6s2t5V5kGCHLVbSdZ/6lI8Wm4OzoPFkc3/cjAsKQrM= +github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= +github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +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= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +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.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4= +github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +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.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +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 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M= +github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +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.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ= +github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +go.mongodb.org/mongo-driver v1.7.5 h1:ny3p0reEpgsR2cfA5cjgwFZg3Cv/ofFh/8jbhGtz9VI= +go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/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/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v9 v9.31.0 h1:bmXmP2RSNtFES+bn4uYuHT7iJFJv7Vj+an+ZQdDaD1M= +gopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= +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= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/common/github.com/IBM/vpc-go-sdk/package-lock.json b/common/github.com/IBM/vpc-go-sdk/package-lock.json new file mode 100644 index 0000000000..20f48c59f1 --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/package-lock.json @@ -0,0 +1,828 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "@babel/code-frame": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", + "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", + "requires": { + "@babel/highlight": "^7.12.13" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==" + }, + "@babel/highlight": { + "version": "7.13.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz", + "integrity": "sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==", + "requires": { + "@babel/helper-validator-identifier": "^7.12.11", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", + "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", + "requires": { + "@nodelib/fs.stat": "2.0.4", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==" + }, + "@nodelib/fs.walk": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", + "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", + "requires": { + "@nodelib/fs.scandir": "2.1.4", + "fastq": "^1.6.0" + } + }, + "@octokit/auth-token": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz", + "integrity": "sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA==", + "requires": { + "@octokit/types": "^6.0.3" + } + }, + "@octokit/core": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.4.0.tgz", + "integrity": "sha512-6/vlKPP8NF17cgYXqucdshWqmMZGXkuvtcrWCgU5NOI0Pl2GjlmZyWgBMrU8zJ3v2MJlM6++CiB45VKYmhiWWg==", + "requires": { + "@octokit/auth-token": "^2.4.4", + "@octokit/graphql": "^4.5.8", + "@octokit/request": "^5.4.12", + "@octokit/request-error": "^2.0.5", + "@octokit/types": "^6.0.3", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/endpoint": { + "version": "6.0.11", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.11.tgz", + "integrity": "sha512-fUIPpx+pZyoLW4GCs3yMnlj2LfoXTWDUVPTC4V3MUEKZm48W+XYpeWSZCv+vYF1ZABUm2CqnDVf1sFtIYrj7KQ==", + "requires": { + "@octokit/types": "^6.0.3", + "is-plain-object": "^5.0.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/graphql": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.6.1.tgz", + "integrity": "sha512-2lYlvf4YTDgZCTXTW4+OX+9WTLFtEUc6hGm4qM1nlZjzxj+arizM4aHWzBVBCxY9glh7GIs0WEuiSgbVzv8cmA==", + "requires": { + "@octokit/request": "^5.3.0", + "@octokit/types": "^6.0.3", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/openapi-types": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-6.0.0.tgz", + "integrity": "sha512-CnDdK7ivHkBtJYzWzZm7gEkanA7gKH6a09Eguz7flHw//GacPJLmkHA3f3N++MJmlxD1Fl+mB7B32EEpSCwztQ==" + }, + "@octokit/plugin-paginate-rest": { + "version": "2.13.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.13.3.tgz", + "integrity": "sha512-46lptzM9lTeSmIBt/sVP/FLSTPGx6DCzAdSX3PfeJ3mTf4h9sGC26WpaQzMEq/Z44cOcmx8VsOhO+uEgE3cjYg==", + "requires": { + "@octokit/types": "^6.11.0" + } + }, + "@octokit/plugin-request-log": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.3.tgz", + "integrity": "sha512-4RFU4li238jMJAzLgAwkBAw+4Loile5haQMQr+uhFq27BmyJXcXSKvoQKqh0agsZEiUlW6iSv3FAgvmGkur7OQ==" + }, + "@octokit/plugin-rest-endpoint-methods": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.0.0.tgz", + "integrity": "sha512-Jc7CLNUueIshXT+HWt6T+M0sySPjF32mSFQAK7UfAg8qGeRI6OM1GSBxDLwbXjkqy2NVdnqCedJcP1nC785JYg==", + "requires": { + "@octokit/types": "^6.13.0", + "deprecation": "^2.3.1" + } + }, + "@octokit/request": { + "version": "5.4.14", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.14.tgz", + "integrity": "sha512-VkmtacOIQp9daSnBmDI92xNIeLuSRDOIuplp/CJomkvzt7M18NXgG044Cx/LFKLgjKt9T2tZR6AtJayba9GTSA==", + "requires": { + "@octokit/endpoint": "^6.0.1", + "@octokit/request-error": "^2.0.0", + "@octokit/types": "^6.7.1", + "deprecation": "^2.0.0", + "is-plain-object": "^5.0.0", + "node-fetch": "^2.6.1", + "once": "^1.4.0", + "universal-user-agent": "^6.0.0" + } + }, + "@octokit/request-error": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.5.tgz", + "integrity": "sha512-T/2wcCFyM7SkXzNoyVNWjyVlUwBvW3igM3Btr/eKYiPmucXTtkxt2RBsf6gn3LTzaLSLTQtNmvg+dGsOxQrjZg==", + "requires": { + "@octokit/types": "^6.0.3", + "deprecation": "^2.0.0", + "once": "^1.4.0" + } + }, + "@octokit/rest": { + "version": "18.5.2", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.5.2.tgz", + "integrity": "sha512-Kz03XYfKS0yYdi61BkL9/aJ0pP2A/WK5vF/syhu9/kY30J8He3P68hv9GRpn8bULFx2K0A9MEErn4v3QEdbZcw==", + "requires": { + "@octokit/core": "^3.2.3", + "@octokit/plugin-paginate-rest": "^2.6.2", + "@octokit/plugin-request-log": "^1.0.2", + "@octokit/plugin-rest-endpoint-methods": "5.0.0" + } + }, + "@octokit/types": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.13.0.tgz", + "integrity": "sha512-W2J9qlVIU11jMwKHUp5/rbVUeErqelCsO5vW5PKNb7wAXQVUz87Rc+imjlEvpvbH8yUb+KHmv8NEjVZdsdpyxA==", + "requires": { + "@octokit/openapi-types": "^6.0.0" + } + }, + "@semantic-release/changelog": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@semantic-release/changelog/-/changelog-5.0.1.tgz", + "integrity": "sha512-unvqHo5jk4dvAf2nZ3aw4imrlwQ2I50eVVvq9D47Qc3R+keNqepx1vDYwkjF8guFXnOYaYcR28yrZWno1hFbiw==", + "requires": { + "@semantic-release/error": "^2.1.0", + "aggregate-error": "^3.0.0", + "fs-extra": "^9.0.0", + "lodash": "^4.17.4" + } + }, + "@semantic-release/error": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-2.2.0.tgz", + "integrity": "sha512-9Tj/qn+y2j+sjCI3Jd+qseGtHjOAeg7dU2/lVcqIQ9TV3QDaDXDYXcoOHU+7o2Hwh8L8ymL4gfuO7KxDs3q2zg==" + }, + "@semantic-release/exec": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/exec/-/exec-5.0.0.tgz", + "integrity": "sha512-t7LWXIvDJQbuGCy2WmMG51WyaGSLTvZBv9INvcI4S0kn+QjnnVVUMhcioIqhb0r3yqqarMzHVcABFug0q0OXjw==", + "requires": { + "@semantic-release/error": "^2.1.0", + "aggregate-error": "^3.0.0", + "debug": "^4.0.0", + "execa": "^4.0.0", + "lodash": "^4.17.4", + "parse-json": "^5.0.0" + } + }, + "@semantic-release/git": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/git/-/git-9.0.0.tgz", + "integrity": "sha512-AZ4Zha5NAPAciIJH3ipzw/WU9qLAn8ENaoVAhD6srRPxTpTzuV3NhNh14rcAo8Paj9dO+5u4rTKcpetOBluYVw==", + "requires": { + "@semantic-release/error": "^2.1.0", + "aggregate-error": "^3.0.0", + "debug": "^4.0.0", + "dir-glob": "^3.0.0", + "execa": "^4.0.0", + "lodash": "^4.17.4", + "micromatch": "^4.0.0", + "p-reduce": "^2.0.0" + } + }, + "@semantic-release/github": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/@semantic-release/github/-/github-7.2.1.tgz", + "integrity": "sha512-+gOhbaG4T3xJb6aTZu1/7KvCmYKRChkasdIyFWdaGaTWVeGpdl4o0zMviV1z3kRcgPOSXeqjHSQ6SOQAfHQiDw==", + "requires": { + "@octokit/rest": "^18.0.0", + "@semantic-release/error": "^2.2.0", + "aggregate-error": "^3.0.0", + "bottleneck": "^2.18.1", + "debug": "^4.0.0", + "dir-glob": "^3.0.0", + "fs-extra": "^9.0.0", + "globby": "^11.0.0", + "http-proxy-agent": "^4.0.0", + "https-proxy-agent": "^5.0.0", + "issue-parser": "^6.0.0", + "lodash": "^4.17.4", + "mime": "^2.4.3", + "p-filter": "^2.0.0", + "p-retry": "^4.0.0", + "url-join": "^4.0.0" + } + }, + "@tootallnate/once": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", + "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==" + }, + "@types/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==" + }, + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "requires": { + "debug": "4" + } + }, + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==" + }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" + }, + "before-after-hook": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.1.tgz", + "integrity": "sha512-/6FKxSTWoJdbsLDF8tdIjaRiFXiE6UHsEHE3OPI/cwPURCVi1ukP0gmLn7XWEiFk5TcwQjjY5PWsU+j+tgXgmw==" + }, + "bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==" + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==" + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + } + }, + "deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "requires": { + "path-type": "^4.0.0" + } + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "execa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", + "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + } + }, + "fast-glob": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + } + }, + "fastq": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", + "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "requires": { + "reusify": "^1.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "requires": { + "pump": "^3.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "requires": { + "is-glob": "^4.0.1" + } + }, + "globby": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.3.tgz", + "integrity": "sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg==", + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + }, + "graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "http-proxy-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", + "requires": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + } + }, + "https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "requires": { + "agent-base": "6", + "debug": "4" + } + }, + "human-signals": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", + "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==" + }, + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==" + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==" + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "issue-parser": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/issue-parser/-/issue-parser-6.0.0.tgz", + "integrity": "sha512-zKa/Dxq2lGsBIXQ7CUZWTHfvxPC2ej0KfO7fIPqLlHB9J2hJ7rGhZ5rilhuufylr4RXYPzJUeFjKxz305OsNlA==", + "requires": { + "lodash.capitalize": "^4.2.1", + "lodash.escaperegexp": "^4.1.2", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.uniqby": "^4.7.0" + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=" + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "lodash.capitalize": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz", + "integrity": "sha1-+CbJtOKoUR2E46yinbBeGk87cqk=" + }, + "lodash.escaperegexp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", + "integrity": "sha1-ZHYsSGGAglGKw99Mz11YhtriA0c=" + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" + }, + "lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" + }, + "lodash.uniqby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz", + "integrity": "sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI=" + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "mime": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", + "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==" + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "requires": { + "path-key": "^3.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "p-filter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-filter/-/p-filter-2.1.0.tgz", + "integrity": "sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==", + "requires": { + "p-map": "^2.0.0" + } + }, + "p-map": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", + "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==" + }, + "p-reduce": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-2.1.0.tgz", + "integrity": "sha512-2USApvnsutq8uoxZBGbbWM0JIYLiEMJ9RlaN7fAzVNb9OZN0SHjjTTfIcb667XynS5Y1VhwDJVDa72TnPzAYWw==" + }, + "p-retry": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.5.0.tgz", + "integrity": "sha512-5Hwh4aVQSu6BEP+w2zKlVXtFAaYQe1qWuVADSgoeVlLjwe/Q/AMSoRR4MDeaAfu8llT+YNbEijWu/YF3m6avkg==", + "requires": { + "@types/retry": "^0.12.0", + "retry": "^0.12.0" + } + }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" + }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=" + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, + "universal-user-agent": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", + "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + }, + "url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + } + } +} diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go new file mode 100644 index 0000000000..1122c47ddc --- /dev/null +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -0,0 +1,122271 @@ +/** + * (C) Copyright IBM Corp. 2024. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.85.0-75c38f8f-20240206-210220 + */ + +// Package vpcv1 : Operations and models for the VpcV1 service +package vpcv1 + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "reflect" + "strings" + "time" + + "github.com/IBM/go-sdk-core/v5/core" + common "github.com/IBM/vpc-go-sdk/common" + "github.com/go-openapi/strfmt" +) + +// 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: 2023-12-05 + +const ( + YYYYMMDD = "2006-01-02" +) + +type VpcV1 struct { + Service *core.BaseService + + // The infrastructure generation. For the API behavior documented here, specify + // `2`. + generation *int64 + + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` + // and `2024-03-06`. + Version *string +} + +// DefaultServiceURL is the default URL to make service requests to. +const DefaultServiceURL = "https://us-south.iaas.cloud.ibm.com/v1" + +// DefaultServiceName is the default key used to find external configuration information. +const DefaultServiceName = "vpc" + +// VpcV1Options : Service options +type VpcV1Options struct { + ServiceName string + URL string + Authenticator core.Authenticator + + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` + // and `2024-03-06`. + Version *string +} + +// NewVpcV1UsingExternalConfig : constructs an instance of VpcV1 with passed in options and external configuration. +func NewVpcV1UsingExternalConfig(options *VpcV1Options) (vpc *VpcV1, err error) { + if options.ServiceName == "" { + options.ServiceName = DefaultServiceName + } + + if options.Authenticator == nil { + options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) + if err != nil { + return + } + } + + vpc, err = NewVpcV1(options) + if err != nil { + return + } + + err = vpc.Service.ConfigureService(options.ServiceName) + if err != nil { + return + } + + if options.URL != "" { + err = vpc.Service.SetServiceURL(options.URL) + } + return +} + +// NewVpcV1 : constructs an instance of VpcV1 with passed in options. +func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { + serviceOptions := &core.ServiceOptions{ + URL: DefaultServiceURL, + Authenticator: options.Authenticator, + } + + err = core.ValidateStruct(options, "options") + if err != nil { + return + } + + baseService, err := core.NewBaseService(serviceOptions) + if err != nil { + return + } + + if options.URL != "" { + err = baseService.SetServiceURL(options.URL) + if err != nil { + return + } + } + + now := time.Now().UTC() + if options.Version == nil { + options.Version = core.StringPtr(now.Format(YYYYMMDD)) + } + + service = &VpcV1{ + Service: baseService, + generation: core.Int64Ptr(2), + Version: options.Version, + } + + return +} + +// GetServiceURLForRegion returns the service URL to be used for the specified region +func GetServiceURLForRegion(region string) (string, error) { + return "", fmt.Errorf("service does not support regional URLs") +} + +// Clone makes a copy of "vpc" suitable for processing requests. +func (vpc *VpcV1) Clone() *VpcV1 { + if core.IsNil(vpc) { + return nil + } + clone := *vpc + clone.Service = vpc.Service.Clone() + return &clone +} + +// SetServiceURL sets the service URL +func (vpc *VpcV1) SetServiceURL(url string) error { + return vpc.Service.SetServiceURL(url) +} + +// GetServiceURL returns the service URL +func (vpc *VpcV1) GetServiceURL() string { + return vpc.Service.GetServiceURL() +} + +// SetDefaultHeaders sets HTTP headers to be sent in every request +func (vpc *VpcV1) SetDefaultHeaders(headers http.Header) { + vpc.Service.SetDefaultHeaders(headers) +} + +// SetEnableGzipCompression sets the service's EnableGzipCompression field +func (vpc *VpcV1) SetEnableGzipCompression(enableGzip bool) { + vpc.Service.SetEnableGzipCompression(enableGzip) +} + +// GetEnableGzipCompression returns the service's EnableGzipCompression field +func (vpc *VpcV1) GetEnableGzipCompression() bool { + return vpc.Service.GetEnableGzipCompression() +} + +// EnableRetries enables automatic retries for requests invoked for this service instance. +// If either parameter is specified as 0, then a default value is used instead. +func (vpc *VpcV1) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { + vpc.Service.EnableRetries(maxRetries, maxRetryInterval) +} + +// DisableRetries disables automatic retries for requests invoked for this service instance. +func (vpc *VpcV1) DisableRetries() { + vpc.Service.DisableRetries() +} + +// CreateVPC : Create a VPC +// This request creates a new VPC from a VPC prototype object. The prototype object is structured in the same way as a +// retrieved VPC, and contains the information necessary to create the new VPC. +func (vpc *VpcV1) CreateVPC(createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + return vpc.CreateVPCWithContext(context.Background(), createVPCOptions) +} + +// CreateVPCWithContext is an alternate form of the CreateVPC method which supports a Context parameter +func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(createVPCOptions, "createVPCOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPC") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCOptions.AddressPrefixManagement != nil { + body["address_prefix_management"] = createVPCOptions.AddressPrefixManagement + } + if createVPCOptions.ClassicAccess != nil { + body["classic_access"] = createVPCOptions.ClassicAccess + } + if createVPCOptions.Dns != nil { + body["dns"] = createVPCOptions.Dns + } + if createVPCOptions.Name != nil { + body["name"] = createVPCOptions.Name + } + if createVPCOptions.ResourceGroup != nil { + body["resource_group"] = createVPCOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPCAddressPrefix : Create an address prefix for a VPC +// This request creates a new prefix from a prefix prototype object. The prototype object is structured in the same way +// as a retrieved prefix, and contains the information necessary to create the new prefix. +func (vpc *VpcV1) CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) +} + +// CreateVPCAddressPrefixWithContext is an alternate form of the CreateVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCAddressPrefixOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCAddressPrefixOptions.CIDR != nil { + body["cidr"] = createVPCAddressPrefixOptions.CIDR + } + if createVPCAddressPrefixOptions.Zone != nil { + body["zone"] = createVPCAddressPrefixOptions.Zone + } + if createVPCAddressPrefixOptions.IsDefault != nil { + body["is_default"] = createVPCAddressPrefixOptions.IsDefault + } + if createVPCAddressPrefixOptions.Name != nil { + body["name"] = createVPCAddressPrefixOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPCDnsResolutionBinding : Create a DNS resolution binding +// This request creates a new DNS resolution binding from a DNS resolution binding prototype object. The prototype +// object is structured in the same way as a retrieved DNS resolution binding, and contains the information necessary to +// create the new DNS resolution binding. +// +// For this request to succeed, `dns.enable_hub` must be `false` for the VPC specified by the identifier in the URL, and +// the VPC must not already have a DNS resolution binding. +// +// See [About DNS sharing for VPE gateways](/docs/vpc?topic=vpc-hub-spoke-model) for more information. +func (vpc *VpcV1) CreateVPCDnsResolutionBinding(createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + return vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) +} + +// CreateVPCDnsResolutionBindingWithContext is an alternate form of the CreateVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCDnsResolutionBindingOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCDnsResolutionBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCDnsResolutionBinding") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCDnsResolutionBindingOptions.VPC != nil { + body["vpc"] = createVPCDnsResolutionBindingOptions.VPC + } + if createVPCDnsResolutionBindingOptions.Name != nil { + body["name"] = createVPCDnsResolutionBindingOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPCRoute : Create a route in a VPC's default routing table +// This request creates a new route in the VPC's default routing table. The route prototype object is structured in the +// same way as a retrieved route, and contains the information necessary to create the new route. The request will fail +// if the new route will cause a loop. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) +} + +// CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: CreateVPCRoute") + err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCRouteOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoute") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCRouteOptions.Destination != nil { + body["destination"] = createVPCRouteOptions.Destination + } + if createVPCRouteOptions.Zone != nil { + body["zone"] = createVPCRouteOptions.Zone + } + if createVPCRouteOptions.Action != nil { + body["action"] = createVPCRouteOptions.Action + } + if createVPCRouteOptions.Advertise != nil { + body["advertise"] = createVPCRouteOptions.Advertise + } + if createVPCRouteOptions.Name != nil { + body["name"] = createVPCRouteOptions.Name + } + if createVPCRouteOptions.NextHop != nil { + body["next_hop"] = createVPCRouteOptions.NextHop + } + if createVPCRouteOptions.Priority != nil { + body["priority"] = createVPCRouteOptions.Priority + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPCRoutingTable : Create a routing table for a VPC +// This request creates a routing table from a routing table prototype object. The prototype object is structured in the +// same way as a retrieved routing table, and contains the information necessary to create the new routing table. +func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) +} + +// CreateVPCRoutingTableWithContext is an alternate form of the CreateVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRoutingTableOptions, "createVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCRoutingTableOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTable") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCRoutingTableOptions.AcceptRoutesFrom != nil { + body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom + } + if createVPCRoutingTableOptions.AdvertiseRoutesTo != nil { + body["advertise_routes_to"] = createVPCRoutingTableOptions.AdvertiseRoutesTo + } + if createVPCRoutingTableOptions.Name != nil { + body["name"] = createVPCRoutingTableOptions.Name + } + if createVPCRoutingTableOptions.RouteDirectLinkIngress != nil { + body["route_direct_link_ingress"] = createVPCRoutingTableOptions.RouteDirectLinkIngress + } + if createVPCRoutingTableOptions.RouteInternetIngress != nil { + body["route_internet_ingress"] = createVPCRoutingTableOptions.RouteInternetIngress + } + if createVPCRoutingTableOptions.RouteTransitGatewayIngress != nil { + body["route_transit_gateway_ingress"] = createVPCRoutingTableOptions.RouteTransitGatewayIngress + } + if createVPCRoutingTableOptions.RouteVPCZoneIngress != nil { + body["route_vpc_zone_ingress"] = createVPCRoutingTableOptions.RouteVPCZoneIngress + } + if createVPCRoutingTableOptions.Routes != nil { + body["routes"] = createVPCRoutingTableOptions.Routes + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVPCRoutingTableRoute : Create a route in a VPC routing table +// This request creates a new VPC route from a VPC route prototype object. The prototype object is structured in the +// same way as a retrieved VPC route and contains the information necessary to create the route. +func (vpc *VpcV1) CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) +} + +// CreateVPCRoutingTableRouteWithContext is an alternate form of the CreateVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *createVPCRoutingTableRouteOptions.RoutingTableID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTableRoute") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCRoutingTableRouteOptions.Destination != nil { + body["destination"] = createVPCRoutingTableRouteOptions.Destination + } + if createVPCRoutingTableRouteOptions.Zone != nil { + body["zone"] = createVPCRoutingTableRouteOptions.Zone + } + if createVPCRoutingTableRouteOptions.Action != nil { + body["action"] = createVPCRoutingTableRouteOptions.Action + } + if createVPCRoutingTableRouteOptions.Advertise != nil { + body["advertise"] = createVPCRoutingTableRouteOptions.Advertise + } + if createVPCRoutingTableRouteOptions.Name != nil { + body["name"] = createVPCRoutingTableRouteOptions.Name + } + if createVPCRoutingTableRouteOptions.NextHop != nil { + body["next_hop"] = createVPCRoutingTableRouteOptions.NextHop + } + if createVPCRoutingTableRouteOptions.Priority != nil { + body["priority"] = createVPCRoutingTableRouteOptions.Priority + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPC : Delete a VPC +// This request deletes a VPC. This operation cannot be reversed. +// +// For this request to succeed: +// - Instances, subnets, public gateways, and endpoint gateways must not reside in this VPC +// - The VPC must not be providing DNS resolution for any other VPCs +// - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero +// +// All security groups and network ACLs associated with the VPC are automatically deleted. All flow log collectors with +// `auto_delete` set to `true` targeting the VPC or any resource in the VPC are automatically deleted. +func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) +} + +// DeleteVPCWithContext is an alternate form of the DeleteVPC method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCOptions, "deleteVPCOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVPCOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteVPCOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteVPCAddressPrefix : Delete an address prefix +// This request deletes a prefix. This operation cannot be reversed. The request will fail if any subnets use addresses +// from this prefix. +func (vpc *VpcV1) DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) +} + +// DeleteVPCAddressPrefixWithContext is an alternate form of the DeleteVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCAddressPrefixOptions.VPCID, + "id": *deleteVPCAddressPrefixOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteVPCDnsResolutionBinding : Delete a DNS resolution binding +// This request deletes a DNS resolution binding. This operation cannot be reversed. +// +// For this request to succeed, the VPC specified by the identifier in the URL must not have +// `dns.resolver.type` set to `delegated`. +func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + return vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) +} + +// DeleteVPCDnsResolutionBindingWithContext is an alternate form of the DeleteVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCDnsResolutionBindingOptions.VPCID, + "id": *deleteVPCDnsResolutionBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCDnsResolutionBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCDnsResolutionBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVPCRoute : Delete a VPC route +// This request deletes a route. This operation cannot be reversed. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) +} + +// DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: DeleteVPCRoute") + err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRouteOptions.VPCID, + "id": *deleteVPCRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteVPCRoutingTable : Delete a VPC routing table +// This request deletes a routing table. A routing table cannot be deleted if it is associated with any subnets in the +// VPC. Additionally, a VPC's default routing table cannot be deleted. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) +} + +// DeleteVPCRoutingTableWithContext is an alternate form of the DeleteVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRoutingTableOptions.VPCID, + "id": *deleteVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteVPCRoutingTableOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCRoutingTableOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteVPCRoutingTableRoute : Delete a VPC routing table route +// This request deletes a VPC route. This operation cannot be reversed. Only VPC routes with an `origin` of `user` are +// allowed to be deleted. +func (vpc *VpcV1) DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) +} + +// DeleteVPCRoutingTableRouteWithContext is an alternate form of the DeleteVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *deleteVPCRoutingTableRouteOptions.RoutingTableID, + "id": *deleteVPCRoutingTableRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPC : Retrieve a VPC +// This request retrieves a single VPC specified by the identifier in the URL. +func (vpc *VpcV1) GetVPC(getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + return vpc.GetVPCWithContext(context.Background(), getVPCOptions) +} + +// GetVPCWithContext is an alternate form of the GetVPC method which supports a Context parameter +func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCOptions, "getVPCOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCOptions, "getVPCOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPCAddressPrefix : Retrieve an address prefix +// This request retrieves a single prefix specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) +} + +// GetVPCAddressPrefixWithContext is an alternate form of the GetVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCAddressPrefixOptions.VPCID, + "id": *getVPCAddressPrefixOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPCDefaultNetworkACL : Retrieve a VPC's default network ACL +// This request retrieves the default network ACL for the VPC specified by the identifier in the URL. The default +// network ACL is applied to any new subnets in the VPC which do not specify a network ACL. +func (vpc *VpcV1) GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) +} + +// GetVPCDefaultNetworkACLWithContext is an alternate form of the GetVPCDefaultNetworkACL method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCDefaultNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_network_acl`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDefaultNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultNetworkACL) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPCDefaultRoutingTable : Retrieve a VPC's default routing table +// This request retrieves the default routing table for the VPC specified by the identifier in the URL. The default +// routing table is associated with any subnets in the VPC which have not been explicitly associated with another +// routing table. +func (vpc *VpcV1) GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) +} + +// GetVPCDefaultRoutingTableWithContext is an alternate form of the GetVPCDefaultRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCDefaultRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_routing_table`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPCDefaultSecurityGroup : Retrieve a VPC's default security group +// This request retrieves the default security group for the VPC specified by the identifier in the URL. Resources +// created in this VPC that allow a security group to be optionally specified will use this security group by default. +func (vpc *VpcV1) GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) +} + +// GetVPCDefaultSecurityGroupWithContext is an alternate form of the GetVPCDefaultSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCDefaultSecurityGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_security_group`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDefaultSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultSecurityGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPCDnsResolutionBinding : Retrieve a DNS resolution binding +// This request retrieves a single DNS resolution binding specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCDnsResolutionBinding(getVPCDnsResolutionBindingOptions *GetVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + return vpc.GetVPCDnsResolutionBindingWithContext(context.Background(), getVPCDnsResolutionBindingOptions) +} + +// GetVPCDnsResolutionBindingWithContext is an alternate form of the GetVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, getVPCDnsResolutionBindingOptions *GetVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCDnsResolutionBindingOptions.VPCID, + "id": *getVPCDnsResolutionBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDnsResolutionBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDnsResolutionBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPCRoute : Retrieve a VPC route +// This request retrieves a single route specified by the identifier in the URL. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) +} + +// GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetVPCRoute") + err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCRouteOptions.VPCID, + "id": *getVPCRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPCRoutingTable : Retrieve a VPC routing table +// This request retrieves a single routing table specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) +} + +// GetVPCRoutingTableWithContext is an alternate form of the GetVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRoutingTableOptions, "getVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCRoutingTableOptions.VPCID, + "id": *getVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVPCRoutingTableRoute : Retrieve a VPC routing table route +// This request retrieves a single VPC route specified by the identifier in the URL path. +func (vpc *VpcV1) GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) +} + +// GetVPCRoutingTableRouteWithContext is an alternate form of the GetVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *getVPCRoutingTableRouteOptions.RoutingTableID, + "id": *getVPCRoutingTableRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPCAddressPrefixes : List all address prefixes for a VPC +// This request lists all address pool prefixes for a VPC. +func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) +} + +// ListVPCAddressPrefixesWithContext is an alternate form of the ListVPCAddressPrefixes method which supports a Context parameter +func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCAddressPrefixesOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCAddressPrefixesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCAddressPrefixesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) + } + if listVPCAddressPrefixesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCAddressPrefixesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefixCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPCDnsResolutionBindings : List all DNS resolution bindings for a VPC +// This request lists all DNS resolution bindings for a VPC. A DNS resolution binding represents an association with +// another VPC for centralizing DNS name resolution. +// +// If the VPC specified by the identifier in the URL is a DNS hub VPC (has `dns.enable_hub` set to `true`) then there is +// one binding for each VPC bound to the hub VPC. The endpoint gateways in the bound VPCs can allow (using +// `allow_dns_resolution_binding`) the hub VPC to centralize resolution of their DNS names. +// +// If the VPC specified by the identifier in the URL is not a DNS hub VPC, then there is at most one binding (to a hub +// VPC). The endpoint gateways in the VPC specified by the identifier in the URL can allow (using +// `allow_dns_resolution_binding`) its hub VPC to centralize resolution of their DNS names. +// +// To make use of centralized DNS resolution, a VPC bound to a DNS hub VPC must delegate DNS resolution to its hub VPC +// by setting `dns.resolver.type` to `delegate`. +// +// The bindings will be sorted by their `created_at` property values, with newest bindings first. Bindings with +// identical `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListVPCDnsResolutionBindings(listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) +} + +// ListVPCDnsResolutionBindingsWithContext is an alternate form of the ListVPCDnsResolutionBindings method which supports a Context parameter +func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCDnsResolutionBindingsOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCDnsResolutionBindingsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCDnsResolutionBindings") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCDnsResolutionBindingsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Sort)) + } + if listVPCDnsResolutionBindingsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Start)) + } + if listVPCDnsResolutionBindingsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Limit)) + } + if listVPCDnsResolutionBindingsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Name)) + } + if listVPCDnsResolutionBindingsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCCRN)) + } + if listVPCDnsResolutionBindingsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCName)) + } + if listVPCDnsResolutionBindingsOptions.AccountID != nil { + builder.AddQuery("account.id", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.AccountID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBindingCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPCRoutes : List all routes in a VPC's default routing table +// This request lists all routes in the VPC's default routing table. Each route is zone-specific and directs any packets +// matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's +// destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) +} + +// ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListVPCRoutes") + err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCRoutesOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCRoutesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCRoutesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) + } + if listVPCRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutesOptions.Start)) + } + if listVPCRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollectionVPCContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPCRoutingTableRoutes : List all routes in a VPC routing table +// This request lists all routes in a VPC routing table. If subnets are associated with this routing table, delivery of +// packets sent on a subnet is performed according to the action of the most specific matching route in the table +// (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, the route with the +// highest priority will be used. If two matching routes have the same destination and priority, traffic will be +// distributed between them. If no routes match, delivery will be controlled by the system's built-in routes. +func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) +} + +// ListVPCRoutingTableRoutesWithContext is an alternate form of the ListVPCRoutingTableRoutes method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCRoutingTableRoutesOptions.VPCID, + "routing_table_id": *listVPCRoutingTableRoutesOptions.RoutingTableID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCRoutingTableRoutesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCRoutingTableRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) + } + if listVPCRoutingTableRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPCRoutingTables : List all routing tables for a VPC +// This request lists all routing tables for a VPC. Each subnet in a VPC is associated with a routing table, which +// controls delivery of packets sent on that subnet according to the action of the most specific matching route in the +// table. If multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, +// delivery will be controlled by the system's built-in routes. +func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) +} + +// ListVPCRoutingTablesWithContext is an alternate form of the ListVPCRoutingTables method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCRoutingTablesOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCRoutingTablesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCRoutingTablesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) + } + if listVPCRoutingTablesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTablesOptions.Limit)) + } + if listVPCRoutingTablesOptions.IsDefault != nil { + builder.AddQuery("is_default", fmt.Sprint(*listVPCRoutingTablesOptions.IsDefault)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTableCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVpcs : List all VPCs +// This request lists all VPCs in the region. A VPC is a virtual network that belongs to an account and provides logical +// isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC +// can contain resources in multiple zones in a region. +func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { + return vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) +} + +// ListVpcsWithContext is an alternate form of the ListVpcs method which supports a Context parameter +func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVpcsOptions, "listVpcsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVpcsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVpcsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) + } + if listVpcsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVpcsOptions.Limit)) + } + if listVpcsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVpcsOptions.ResourceGroupID)) + } + if listVpcsOptions.ClassicAccess != nil { + builder.AddQuery("classic_access", fmt.Sprint(*listVpcsOptions.ClassicAccess)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPCCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPC : Update a VPC +// This request updates a VPC with the information provided in a VPC patch object. The patch object is structured in the +// same way as a retrieved VPC and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) +} + +// UpdateVPCWithContext is an alternate form of the UpdateVPC method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCOptions, "updateVPCOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVPCOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPC") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVPCOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPCOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCAddressPrefix : Update an address prefix +// This request updates a prefix with the information in a provided prefix patch. The prefix patch object is structured +// in the same way as a retrieved prefix and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) +} + +// UpdateVPCAddressPrefixWithContext is an alternate form of the UpdateVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCAddressPrefixOptions.VPCID, + "id": *updateVPCAddressPrefixOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCAddressPrefix") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCAddressPrefixOptions.AddressPrefixPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCDnsResolutionBinding : Update a DNS resolution binding +// This request updates a DNS resolution binding with the information in a provided DNS resolution binding patch. The +// DNS resolution binding patch object is structured in the same way as a retrieved DNS resolution binding and contains +// only the information to be updated. +func (vpc *VpcV1) UpdateVPCDnsResolutionBinding(updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) +} + +// UpdateVPCDnsResolutionBindingWithContext is an alternate form of the UpdateVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCDnsResolutionBindingOptions.VPCID, + "id": *updateVPCDnsResolutionBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCDnsResolutionBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCDnsResolutionBinding") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCRoute : Update a VPC route +// This request updates a route with the information in a provided route patch. The route patch object is structured in +// the same way as a retrieved route and contains only the information to be updated. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) +} + +// UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: UpdateVPCRoute") + err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCRouteOptions.VPCID, + "id": *updateVPCRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoute") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCRouteOptions.RoutePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCRoutingTable : Update a VPC routing table +// This request updates a routing table with the information in a provided routing table patch. The patch object is +// structured in the same way as a retrieved table and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) +} + +// UpdateVPCRoutingTableWithContext is an alternate form of the UpdateVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCRoutingTableOptions.VPCID, + "id": *updateVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVPCRoutingTableOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPCRoutingTableOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPCRoutingTableRoute : Update a VPC routing table route +// This request updates a VPC route with the information provided in a route patch object. The patch object is +// structured in the same way as a retrieved VPC route and needs to contain only the information to be updated. Only VPC +// routes with an `origin` of `user` are allowed to be updated. +func (vpc *VpcV1) UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCRoutingTableRouteWithContext(context.Background(), updateVPCRoutingTableRouteOptions) +} + +// UpdateVPCRoutingTableRouteWithContext is an alternate form of the UpdateVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *updateVPCRoutingTableRouteOptions.RoutingTableID, + "id": *updateVPCRoutingTableRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTableRoute") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCRoutingTableRouteOptions.RoutePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSubnet : Create a subnet +// This request creates a new subnet from a subnet prototype object. The prototype object is structured in the same way +// as a retrieved subnet, and contains the information necessary to create the new subnet. For this request to succeed, +// the prototype's CIDR block must not overlap with an existing subnet in the VPC. +func (vpc *VpcV1) CreateSubnet(createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) +} + +// CreateSubnetWithContext is an alternate form of the CreateSubnet method which supports a Context parameter +func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSubnetOptions, "createSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createSubnetOptions.SubnetPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSubnetReservedIP : Reserve an IP in a subnet +// This request reserves an IP address in a subnet. If the provided prototype object includes an `address`, the address +// must not already be reserved. +func (vpc *VpcV1) CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) +} + +// CreateSubnetReservedIPWithContext is an alternate form of the CreateSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSubnetReservedIPOptions, "createSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *createSubnetReservedIPOptions.SubnetID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createSubnetReservedIPOptions.Address != nil { + body["address"] = createSubnetReservedIPOptions.Address + } + if createSubnetReservedIPOptions.AutoDelete != nil { + body["auto_delete"] = createSubnetReservedIPOptions.AutoDelete + } + if createSubnetReservedIPOptions.Name != nil { + body["name"] = createSubnetReservedIPOptions.Name + } + if createSubnetReservedIPOptions.Target != nil { + body["target"] = createSubnetReservedIPOptions.Target + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSubnet : Delete a subnet +// This request deletes a subnet. This operation cannot be reversed. For this request to succeed, the subnet must not be +// referenced by any bare metal server network interfaces, instance network interfaces, virtual network interfaces, VPN +// gateways, or load balancers. A delete operation automatically detaches the subnet from any network ACLs, public +// gateways, or endpoint gateways. All flow log collectors with `auto_delete` set to `true` targeting the subnet or any +// resource in the subnet are automatically deleted. +func (vpc *VpcV1) DeleteSubnet(deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSubnetWithContext(context.Background(), deleteSubnetOptions) +} + +// DeleteSubnetWithContext is an alternate form of the DeleteSubnet method which supports a Context parameter +func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSubnetOptions, "deleteSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSubnetOptions, "deleteSubnetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnet") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteSubnetReservedIP : Delete a reserved IP +// This request releases a reserved IP. This operation cannot be reversed. +// +// For this request to succeed, the reserved IP must not be required by another resource, such as a bare metal server +// network interface, instance network interface or virtual network interface for which it is the primary IP. A +// provider-owned reserved IP is not allowed to be deleted. +func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) +} + +// DeleteSubnetReservedIPWithContext is an alternate form of the DeleteSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *deleteSubnetReservedIPOptions.SubnetID, + "id": *deleteSubnetReservedIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSubnet : Retrieve a subnet +// This request retrieves a single subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnet(getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) +} + +// GetSubnetWithContext is an alternate form of the GetSubnet method which supports a Context parameter +func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetOptions, "getSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetSubnetNetworkACL : Retrieve a subnet's attached network ACL +// This request retrieves the network ACL attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetNetworkACL(getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.GetSubnetNetworkACLWithContext(context.Background(), getSubnetNetworkACLOptions) +} + +// GetSubnetNetworkACLWithContext is an alternate form of the GetSubnetNetworkACL method which supports a Context parameter +func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetSubnetPublicGateway : Retrieve a subnet's attached public gateway +// This request retrieves the public gateway attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) +} + +// GetSubnetPublicGatewayWithContext is an alternate form of the GetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetSubnetReservedIP : Retrieve a reserved IP +// This request retrieves a single reserved IP specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) +} + +// GetSubnetReservedIPWithContext is an alternate form of the GetSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetReservedIPOptions, "getSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *getSubnetReservedIPOptions.SubnetID, + "id": *getSubnetReservedIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetSubnetRoutingTable : Retrieve a subnet's attached routing table +// This request retrieves the routing table attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) +} + +// GetSubnetRoutingTableWithContext is an alternate form of the GetSubnetRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSubnetReservedIps : List all reserved IPs in a subnet +// This request lists all reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet +// which is not available for use. +func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { + return vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) +} + +// ListSubnetReservedIpsWithContext is an alternate form of the ListSubnetReservedIps method which supports a Context parameter +func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *listSubnetReservedIpsOptions.SubnetID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listSubnetReservedIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSubnetReservedIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) + } + if listSubnetReservedIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSubnetReservedIpsOptions.Limit)) + } + if listSubnetReservedIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSubnetReservedIpsOptions.Sort)) + } + if listSubnetReservedIpsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listSubnetReservedIpsOptions.TargetID)) + } + if listSubnetReservedIpsOptions.TargetCRN != nil { + builder.AddQuery("target.crn", fmt.Sprint(*listSubnetReservedIpsOptions.TargetCRN)) + } + if listSubnetReservedIpsOptions.TargetName != nil { + builder.AddQuery("target.name", fmt.Sprint(*listSubnetReservedIpsOptions.TargetName)) + } + if listSubnetReservedIpsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listSubnetReservedIpsOptions.TargetResourceType)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSubnets : List all subnets +// This request lists all subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block +// notation. Each subnet is within a particular zone and cannot span multiple zones or regions. +func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { + return vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) +} + +// ListSubnetsWithContext is an alternate form of the ListSubnets method which supports a Context parameter +func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSubnetsOptions, "listSubnetsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSubnetsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSubnetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) + } + if listSubnetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSubnetsOptions.Limit)) + } + if listSubnetsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSubnetsOptions.ResourceGroupID)) + } + if listSubnetsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listSubnetsOptions.ZoneName)) + } + if listSubnetsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listSubnetsOptions.VPCID)) + } + if listSubnetsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listSubnetsOptions.VPCCRN)) + } + if listSubnetsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listSubnetsOptions.VPCName)) + } + if listSubnetsOptions.RoutingTableID != nil { + builder.AddQuery("routing_table.id", fmt.Sprint(*listSubnetsOptions.RoutingTableID)) + } + if listSubnetsOptions.RoutingTableName != nil { + builder.AddQuery("routing_table.name", fmt.Sprint(*listSubnetsOptions.RoutingTableName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnetCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ReplaceSubnetNetworkACL : Replace the network ACL for a subnet +// This request replaces the existing network ACL for a subnet with the network ACL specified in the request body. +func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) +} + +// ReplaceSubnetNetworkACLWithContext is an alternate form of the ReplaceSubnetNetworkACL method which supports a Context parameter +func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *replaceSubnetNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range replaceSubnetNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(replaceSubnetNetworkACLOptions.NetworkACLIdentity) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ReplaceSubnetRoutingTable : Replace the routing table for a subnet +// This request replaces the existing routing table for a subnet with the routing table specified in the request body. +// +// For this request to succeed, the routing table `route_direct_link_ingress`, +// `route_internet_ingress`, `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. +func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) +} + +// ReplaceSubnetRoutingTableWithContext is an alternate form of the ReplaceSubnetRoutingTable method which supports a Context parameter +func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *replaceSubnetRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range replaceSubnetRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(replaceSubnetRoutingTableOptions.RoutingTableIdentity) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + } + + return +} + +// SetSubnetPublicGateway : Attach a public gateway to a subnet +// This request attaches the public gateway, specified in the request body, to the subnet specified by the subnet +// identifier in the URL. The public gateway must have the same VPC and zone as the subnet. +func (vpc *VpcV1) SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) +} + +// SetSubnetPublicGatewayWithContext is an alternate form of the SetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *setSubnetPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(setSubnetPublicGatewayOptions.PublicGatewayIdentity) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UnsetSubnetPublicGateway : Detach a public gateway from a subnet +// This request detaches the public gateway from the subnet specified by the subnet identifier in the URL. +func (vpc *VpcV1) UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { + return vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) +} + +// UnsetSubnetPublicGatewayWithContext is an alternate form of the UnsetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *unsetSubnetPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// UpdateSubnet : Update a subnet +// This request updates a subnet with the information in a provided subnet patch. The subnet patch object is structured +// in the same way as a retrieved subnet and contains only the information to be updated. +func (vpc *VpcV1) UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) +} + +// UpdateSubnetWithContext is an alternate form of the UpdateSubnet method which supports a Context parameter +func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSubnetOptions, "updateSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSubnetOptions.SubnetPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateSubnetReservedIP : Update a reserved IP +// This request updates a reserved IP with the information in a provided reserved IP patch. The reserved IP patch object +// is structured in the same way as a retrieved reserved IP and contains only the information to be updated. +// +// A provider-owned reserved IP is not allowed to be updated. +func (vpc *VpcV1) UpdateSubnetReservedIP(updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.UpdateSubnetReservedIPWithContext(context.Background(), updateSubnetReservedIPOptions) +} + +// UpdateSubnetReservedIPWithContext is an alternate form of the UpdateSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *updateSubnetReservedIPOptions.SubnetID, + "id": *updateSubnetReservedIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnetReservedIP") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSubnetReservedIPOptions.ReservedIPPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateImage : Create an image +// This request creates a new image from an image prototype object. The prototype object is structured in the same way +// as a retrieved image, and contains the information necessary to create the new image. If an image is being imported, +// a URL to the image file on object storage must be specified. If an image is being created from an existing volume, +// that volume must be specified. +func (vpc *VpcV1) CreateImage(createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.CreateImageWithContext(context.Background(), createImageOptions) +} + +// CreateImageWithContext is an alternate form of the CreateImage method which supports a Context parameter +func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createImageOptions, "createImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createImageOptions, "createImageOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createImageOptions.ImagePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateImageExportJob : Create an image export job +// This request creates and queues a new export job for the image specified in the URL using the image export job +// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, `obsolete`, or +// `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains +// the information necessary to create and queue the new image export job. +func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + return vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) +} + +// CreateImageExportJobWithContext is an alternate form of the CreateImageExportJob method which supports a Context parameter +func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createImageExportJobOptions, "createImageExportJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createImageExportJobOptions, "createImageExportJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *createImageExportJobOptions.ImageID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createImageExportJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImageExportJob") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createImageExportJobOptions.StorageBucket != nil { + body["storage_bucket"] = createImageExportJobOptions.StorageBucket + } + if createImageExportJobOptions.Format != nil { + body["format"] = createImageExportJobOptions.Format + } + if createImageExportJobOptions.Name != nil { + body["name"] = createImageExportJobOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteImage : Delete an image +// This request deletes an image. Any active image export jobs will be completed first. This operation cannot be +// reversed. A system-provided image is not allowed to be deleted. Additionally, an image cannot be deleted if it: +// - has a `status` of `deleting` +// - has a `status` of `pending` with a `status_reasons` code of `image_request_in_progress` +// - has `catalog_offering.managed` set to `true`. +func (vpc *VpcV1) DeleteImage(deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteImageWithContext(context.Background(), deleteImageOptions) +} + +// DeleteImageWithContext is an alternate form of the DeleteImage method which supports a Context parameter +func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteImageOptions, "deleteImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteImageOptions, "deleteImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteImageExportJob : Delete an image export job +// This request deletes an image export job. This operation cannot be reversed. If the job has not completed, the job +// will be canceled, and the incomplete exported image object deleted. If the job has completed, the exported image +// object will not be deleted. +func (vpc *VpcV1) DeleteImageExportJob(deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) +} + +// DeleteImageExportJobWithContext is an alternate form of the DeleteImageExportJob method which supports a Context parameter +func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteImageExportJobOptions, "deleteImageExportJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteImageExportJobOptions, "deleteImageExportJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *deleteImageExportJobOptions.ImageID, + "id": *deleteImageExportJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteImageExportJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImageExportJob") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeprecateImage : Deprecate an image +// This request deprecates an image, resulting in its `status` becoming `deprecated` and +// `deprecation_at` being set to the current date and time. +// +// The image must: +// - have a `status` of `available` +// - have `catalog_offering.managed` set to `false` +// - not have `deprecation_at` set +// +// The image must not have `deprecation_at` set, must have `catalog_offering.managed` set to +// `false`, and must have a `status` of `available`. +// +// A system-provided image is not allowed to be deprecated. +func (vpc *VpcV1) DeprecateImage(deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { + return vpc.DeprecateImageWithContext(context.Background(), deprecateImageOptions) +} + +// DeprecateImageWithContext is an alternate form of the DeprecateImage method which supports a Context parameter +func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deprecateImageOptions, "deprecateImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deprecateImageOptions, "deprecateImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deprecateImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/deprecate`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deprecateImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeprecateImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetImage : Retrieve an image +// This request retrieves a single image specified by the identifier in the URL. +func (vpc *VpcV1) GetImage(getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.GetImageWithContext(context.Background(), getImageOptions) +} + +// GetImageWithContext is an alternate form of the GetImage method which supports a Context parameter +func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getImageOptions, "getImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getImageOptions, "getImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetImageExportJob : Retrieve an image export job +// This request retrieves a single image export job specified by the identifier in the URL. +func (vpc *VpcV1) GetImageExportJob(getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + return vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) +} + +// GetImageExportJobWithContext is an alternate form of the GetImageExportJob method which supports a Context parameter +func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getImageExportJobOptions, "getImageExportJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getImageExportJobOptions, "getImageExportJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *getImageExportJobOptions.ImageID, + "id": *getImageExportJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getImageExportJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImageExportJob") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetOperatingSystem : Retrieve an operating system +// This request retrieves a single operating system specified by the name in the URL. +func (vpc *VpcV1) GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { + return vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) +} + +// GetOperatingSystemWithContext is an alternate form of the GetOperatingSystem method which supports a Context parameter +func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOperatingSystemOptions, "getOperatingSystemOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getOperatingSystemOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getOperatingSystemOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetOperatingSystem") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystem) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListImageExportJobs : List all image export jobs +// This request lists all export jobs for an image. Each job tracks the exporting of the image to another location, such +// as a bucket within cloud object storage. +// +// The jobs will be sorted by their `created_at` property values, with newest jobs first. Jobs with identical +// `created_at` property values will in turn be sorted by ascending +// `name` property values. +func (vpc *VpcV1) ListImageExportJobs(listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListImageExportJobsWithContext(context.Background(), listImageExportJobsOptions) +} + +// ListImageExportJobsWithContext is an alternate form of the ListImageExportJobs method which supports a Context parameter +func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listImageExportJobsOptions, "listImageExportJobsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listImageExportJobsOptions, "listImageExportJobsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *listImageExportJobsOptions.ImageID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listImageExportJobsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageExportJobs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listImageExportJobsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listImageExportJobsOptions.Name)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJobUnpaginatedCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListImages : List all images +// This request lists all images available in the region. An image provides source data for a volume. Images are either +// system-provided, or created from another source, such as importing from Cloud Object Storage. +func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { + return vpc.ListImagesWithContext(context.Background(), listImagesOptions) +} + +// ListImagesWithContext is an alternate form of the ListImages method which supports a Context parameter +func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listImagesOptions, "listImagesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listImagesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listImagesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) + } + if listImagesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listImagesOptions.Limit)) + } + if listImagesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listImagesOptions.ResourceGroupID)) + } + if listImagesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) + } + if listImagesOptions.Status != nil { + builder.AddQuery("status", strings.Join(listImagesOptions.Status, ",")) + } + if listImagesOptions.Visibility != nil { + builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListOperatingSystems : List all operating systems +// This request lists all operating systems in the region. +func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { + return vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) +} + +// ListOperatingSystemsWithContext is an alternate form of the ListOperatingSystems method which supports a Context parameter +func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listOperatingSystemsOptions, "listOperatingSystemsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listOperatingSystemsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listOperatingSystemsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) + } + if listOperatingSystemsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listOperatingSystemsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystemCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ObsoleteImage : Obsolete an image +// This request obsoletes an image, resulting in its `status` becoming `obsolete` and +// `obsolescence_at` being set to the current date and time. +// +// The image must: +// - have a `status` of `available` or `deprecated` +// - have `catalog_offering.managed` set to `false` +// - not have `deprecation_at` set in the future +// - not have `obsolescence_at` set +// +// A system-provided image is not allowed to be obsoleted. +func (vpc *VpcV1) ObsoleteImage(obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { + return vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) +} + +// ObsoleteImageWithContext is an alternate form of the ObsoleteImage method which supports a Context parameter +func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(obsoleteImageOptions, "obsoleteImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(obsoleteImageOptions, "obsoleteImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *obsoleteImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/obsolete`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range obsoleteImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ObsoleteImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// UpdateImage : Update an image +// This request updates an image with the information in a provided image patch. The image patch object is structured in +// the same way as a retrieved image and contains only the information to be updated. A system-provided image is not +// allowed to be updated. An image with a `status` of `deleting` cannot be updated. +func (vpc *VpcV1) UpdateImage(updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.UpdateImageWithContext(context.Background(), updateImageOptions) +} + +// UpdateImageWithContext is an alternate form of the UpdateImage method which supports a Context parameter +func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateImageOptions, "updateImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateImageOptions, "updateImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImage") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateImageOptions.ImagePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateImageExportJob : Update an image export job +// This request updates an image export job with the information in a provided image export job patch. The image export +// job patch object is structured in the same way as a retrieved image export job and contains only the information to +// be updated. +func (vpc *VpcV1) UpdateImageExportJob(updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + return vpc.UpdateImageExportJobWithContext(context.Background(), updateImageExportJobOptions) +} + +// UpdateImageExportJobWithContext is an alternate form of the UpdateImageExportJob method which supports a Context parameter +func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateImageExportJobOptions, "updateImageExportJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateImageExportJobOptions, "updateImageExportJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "image_id": *updateImageExportJobOptions.ImageID, + "id": *updateImageExportJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateImageExportJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImageExportJob") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateImageExportJobOptions.ImageExportJobPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateKey : Create a key +// This request creates a new SSH key from an key prototype object. The prototype object is structured in the same way +// as a retrieved key, and contains the information necessary to create the new key. The public key value must be +// provided. +func (vpc *VpcV1) CreateKey(createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.CreateKeyWithContext(context.Background(), createKeyOptions) +} + +// CreateKeyWithContext is an alternate form of the CreateKey method which supports a Context parameter +func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createKeyOptions, "createKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createKeyOptions, "createKeyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateKey") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createKeyOptions.PublicKey != nil { + body["public_key"] = createKeyOptions.PublicKey + } + if createKeyOptions.Name != nil { + body["name"] = createKeyOptions.Name + } + if createKeyOptions.ResourceGroup != nil { + body["resource_group"] = createKeyOptions.ResourceGroup + } + if createKeyOptions.Type != nil { + body["type"] = createKeyOptions.Type + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteKey : Delete a key +// This request deletes a key. This operation cannot be reversed. +func (vpc *VpcV1) DeleteKey(deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteKeyWithContext(context.Background(), deleteKeyOptions) +} + +// DeleteKeyWithContext is an alternate form of the DeleteKey method which supports a Context parameter +func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteKeyOptions, "deleteKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteKeyOptions, "deleteKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetKey : Retrieve a key +// This request retrieves a single key specified by the identifier in the URL. +func (vpc *VpcV1) GetKey(getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.GetKeyWithContext(context.Background(), getKeyOptions) +} + +// GetKeyWithContext is an alternate form of the GetKey method which supports a Context parameter +func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getKeyOptions, "getKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getKeyOptions, "getKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListKeys : List all keys +// This request lists all keys in the region. A key contains a public SSH key which may be installed on instances when +// they are created. Private keys are not stored. +func (vpc *VpcV1) ListKeys(listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { + return vpc.ListKeysWithContext(context.Background(), listKeysOptions) +} + +// ListKeysWithContext is an alternate form of the ListKeys method which supports a Context parameter +func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listKeysOptions, "listKeysOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listKeysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListKeys") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listKeysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listKeysOptions.Start)) + } + if listKeysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listKeysOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKeyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateKey : Update a key +// This request updates a key's name. +func (vpc *VpcV1) UpdateKey(updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.UpdateKeyWithContext(context.Background(), updateKeyOptions) +} + +// UpdateKeyWithContext is an alternate form of the UpdateKey method which supports a Context parameter +func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateKeyOptions, "updateKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateKeyOptions, "updateKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateKey") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateKeyOptions.KeyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with an instance network interface +// This request associates the specified floating IP with the specified instance network interface, replacing any +// existing association. +// +// The existing floating IP must: +// - not be required by another resource, such as a public gateway +// - be in the same `zone` as the instance +// +// A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) +} + +// AddInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the AddInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *addInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *addInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addInstanceNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addInstanceNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddInstanceNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstance : Create an instance +// This request provisions a new instance from an instance prototype object. The prototype object is structured in the +// same way as a retrieved instance, and contains the information necessary to provision the new instance. The instance +// is automatically started. +func (vpc *VpcV1) CreateInstance(createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) +} + +// CreateInstanceWithContext is an alternate form of the CreateInstance method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceOptions, "createInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceOptions, "createInstanceOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstance") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createInstanceOptions.InstancePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceAction : Create an instance action +// This request creates a new action which will be queued up to run as soon as any pending or running actions have +// completed. +func (vpc *VpcV1) CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) +} + +// CreateInstanceActionWithContext is an alternate form of the CreateInstanceAction method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceActionOptions, "createInstanceActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceActionOptions, "createInstanceActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceActionOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/actions`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceAction") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceActionOptions.Type != nil { + body["type"] = createInstanceActionOptions.Type + } + if createInstanceActionOptions.Force != nil { + body["force"] = createInstanceActionOptions.Force + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) + if err != nil { + 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 +// request. The access token is only valid for a short period of time, and a maximum of one token is valid for a given +// instance at a time. +func (vpc *VpcV1) CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) +} + +// CreateInstanceConsoleAccessTokenWithContext is an alternate form of the CreateInstanceConsoleAccessToken method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Context, createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceConsoleAccessTokenOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/console_access_token`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceConsoleAccessTokenOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceConsoleAccessToken") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceConsoleAccessTokenOptions.ConsoleType != nil { + body["console_type"] = createInstanceConsoleAccessTokenOptions.ConsoleType + } + if createInstanceConsoleAccessTokenOptions.Force != nil { + body["force"] = createInstanceConsoleAccessTokenOptions.Force + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceNetworkAttachment : Create a network attachment on an instance +// This request creates a new instance network attachment from an instance network attachment prototype object. The +// prototype object is structured in the same way as a retrieved instance network attachment, and contains the +// information necessary to create the new instance network attachment. +func (vpc *VpcV1) CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) +} + +// CreateInstanceNetworkAttachmentWithContext is an alternate form of the CreateInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context, createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceNetworkAttachmentOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkAttachment") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceNetworkAttachmentOptions.VirtualNetworkInterface != nil { + body["virtual_network_interface"] = createInstanceNetworkAttachmentOptions.VirtualNetworkInterface + } + if createInstanceNetworkAttachmentOptions.Name != nil { + body["name"] = createInstanceNetworkAttachmentOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceNetworkInterface : Create a network interface on an instance +// This request creates a new instance network interface from an instance network interface prototype object. The +// prototype object is structured in the same way as a retrieved instance network interface, and contains the +// information necessary to create the new instance network interface. Any subnet in the instance's VPC may be +// specified. Addresses on the instance network interface must be within the specified subnet's CIDR blocks. +// +// If this instance 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, and new network interfaces are not allowed to be created. +func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) +} + +// CreateInstanceNetworkInterfaceWithContext is an alternate form of the CreateInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceNetworkInterfaceOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkInterface") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceNetworkInterfaceOptions.Subnet != nil { + body["subnet"] = createInstanceNetworkInterfaceOptions.Subnet + } + if createInstanceNetworkInterfaceOptions.AllowIPSpoofing != nil { + body["allow_ip_spoofing"] = createInstanceNetworkInterfaceOptions.AllowIPSpoofing + } + if createInstanceNetworkInterfaceOptions.Name != nil { + body["name"] = createInstanceNetworkInterfaceOptions.Name + } + if createInstanceNetworkInterfaceOptions.PrimaryIP != nil { + body["primary_ip"] = createInstanceNetworkInterfaceOptions.PrimaryIP + } + if createInstanceNetworkInterfaceOptions.SecurityGroups != nil { + body["security_groups"] = createInstanceNetworkInterfaceOptions.SecurityGroups + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceTemplate : Create an instance template +// This request creates a new instance template. The prototype object is structured in the same way as a retrieved +// instance template, and contains the information necessary to provision a new instance from the template. +// +// If a `source_template` is specified in the prototype object, its contents are copied into the new template prior to +// copying any other properties provided in the prototype object. +func (vpc *VpcV1) CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceTemplateWithContext(context.Background(), createInstanceTemplateOptions) +} + +// CreateInstanceTemplateWithContext is an alternate form of the CreateInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceTemplateOptions, "createInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceTemplateOptions, "createInstanceTemplateOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceTemplate") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createInstanceTemplateOptions.InstanceTemplatePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceVolumeAttachment : Create a volume attachment on an instance +// This request creates a new volume attachment from a volume attachment prototype object, connecting a volume to an +// instance. For this request to succeed, the specified volume must not be busy. The prototype object is structured in +// the same way as a retrieved volume attachment, and contains the information necessary to create the new volume +// attachment. +func (vpc *VpcV1) CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) +} + +// CreateInstanceVolumeAttachmentWithContext is an alternate form of the CreateInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceVolumeAttachmentOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceVolumeAttachment") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceVolumeAttachmentOptions.Volume != nil { + body["volume"] = createInstanceVolumeAttachmentOptions.Volume + } + if createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete != nil { + body["delete_volume_on_instance_delete"] = createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete + } + if createInstanceVolumeAttachmentOptions.Name != nil { + body["name"] = createInstanceVolumeAttachmentOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstance : Delete an instance +// This request deletes an instance. This operation cannot be reversed. Any floating IPs associated with instance +// network interfaces are implicitly disassociated. All virtual network interfaces with `auto_delete` set to `true` +// targeting instance network attachments on the instance are automatically deleted. All flow log collectors with +// `auto_delete` set to `true` targeting the instance, the instance network attachments, the instance network +// interfaces, or the automatically deleted virtual network interfaces are automatically deleted. +func (vpc *VpcV1) DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) +} + +// DeleteInstanceWithContext is an alternate form of the DeleteInstance method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceOptions, "deleteInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceOptions, "deleteInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteInstanceOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteInstanceOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteInstanceNetworkAttachment : Delete an instance network attachment +// This request deletes an instance network attachment. This operation cannot be reversed. Any floating IPs associated +// with the instance network attachment are implicitly disassociated. All flow log collectors with `auto_delete` set to +// `true` targeting the instance network attachment are automatically deleted. The primary instance network attachment +// is not allowed to be deleted. +func (vpc *VpcV1) DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) +} + +// DeleteInstanceNetworkAttachmentWithContext is an alternate form of the DeleteInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context, deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *deleteInstanceNetworkAttachmentOptions.InstanceID, + "id": *deleteInstanceNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteInstanceNetworkInterface : Delete an instance network interface +// This request deletes an instance network interface. This operation cannot be reversed. Any floating IPs associated +// with the instance network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to +// `true` targeting the instance network interface are automatically deleted. The primary instance network interface is +// not allowed to be deleted. +// +// If this instance 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 is not allowed to be deleted. +func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) +} + +// DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *deleteInstanceNetworkInterfaceOptions.InstanceID, + "id": *deleteInstanceNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteInstanceTemplate : Delete an instance template +// This request deletes the instance template. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) +} + +// DeleteInstanceTemplateWithContext is an alternate form of the DeleteInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteInstanceTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceTemplate") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteInstanceVolumeAttachment : Delete a volume attachment +// This request deletes a volume attachment. This operation cannot be reversed, but a new volume attachment may +// subsequently be created for the volume. For this request to succeed, the volume must not be busy. +func (vpc *VpcV1) DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) +} + +// DeleteInstanceVolumeAttachmentWithContext is an alternate form of the DeleteInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *deleteInstanceVolumeAttachmentOptions.InstanceID, + "id": *deleteInstanceVolumeAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstance : Retrieve an instance +// This request retrieves a single instance specified by the identifier in the URL. +func (vpc *VpcV1) GetInstance(getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + return vpc.GetInstanceWithContext(context.Background(), getInstanceOptions) +} + +// GetInstanceWithContext is an alternate form of the GetInstance method which supports a Context parameter +func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceOptions, "getInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceOptions, "getInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceDisk : Retrieve an instance disk +// This request retrieves a single instance disk specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + return vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) +} + +// GetInstanceDiskWithContext is an alternate form of the GetInstanceDisk method which supports a Context parameter +func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceDiskOptions, "getInstanceDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceDiskOptions.InstanceID, + "id": *getInstanceDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceInitialization : Retrieve initialization configuration for an instance +// This request retrieves configuration used to initialize the instance, such as SSH keys and the Windows administrator +// password. These can subsequently be changed on the instance and therefore may not be current. +func (vpc *VpcV1) GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { + return vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) +} + +// GetInstanceInitializationWithContext is an alternate form of the GetInstanceInitialization method which supports a Context parameter +func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceInitializationOptions, "getInstanceInitializationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceInitializationOptions, "getInstanceInitializationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceInitializationOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}/initialization`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceInitializationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceInitialization") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceInitialization) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceNetworkAttachment : Retrieve an instance network attachment +// This request retrieves a single instance network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) +} + +// GetInstanceNetworkAttachmentWithContext is an alternate form of the GetInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkAttachmentOptions.InstanceID, + "id": *getInstanceNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceNetworkInterface : Retrieve an instance network interface +// This request retrieves a single instance network interface specified by the identifier in the URL. +// +// If this instance has network attachments, the retrieved 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. +func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) +} + +// GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkInterfaceOptions.InstanceID, + "id": *getInstanceNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP address if it is associated with the instance network interface and +// instance specified in the URL. +func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) +} + +// GetInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the GetInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *getInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getInstanceNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for an instance network interface. +func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) +} + +// GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkInterfaceIPOptions.InstanceID, + "network_interface_id": *getInstanceNetworkInterfaceIPOptions.NetworkInterfaceID, + "id": *getInstanceNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceProfile : Retrieve an instance profile +// This request retrieves a single instance profile specified by the name in the URL. +func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { + return vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) +} + +// GetInstanceProfileWithContext is an alternate form of the GetInstanceProfile method which supports a Context parameter +func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceProfileOptions, "getInstanceProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getInstanceProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceTemplate : Retrieve an instance template +// This request retrieves a single instance template specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) +} + +// GetInstanceTemplateWithContext is an alternate form of the GetInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceTemplateOptions, "getInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceVolumeAttachment : Retrieve a volume attachment +// This request retrieves a single volume attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) +} + +// GetInstanceVolumeAttachmentWithContext is an alternate form of the GetInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceVolumeAttachmentOptions.InstanceID, + "id": *getInstanceVolumeAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceDisks : List all disks on an instance +// This request lists all disks on an instance. A disk is a block device that is locally attached to the instance's +// physical host and is also referred to as instance storage. By default, the listed disks are sorted by their +// `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) +} + +// ListInstanceDisksWithContext is an alternate form of the ListInstanceDisks method which supports a Context parameter +func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceDisksOptions, "listInstanceDisksOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceDisksOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceDisksOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceDisks") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceNetworkAttachments : List all network attachments on an instance +// This request lists all network attachments on an instance. A network attachment represents a device on the instance +// to which a virtual network interface is attached. +// +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) +} + +// ListInstanceNetworkAttachmentsWithContext is an alternate form of the ListInstanceNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkAttachmentsOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkAttachmentsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachmentCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with an instance network interface +// This request lists all floating IPs associated with an instance network interface. +func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) +} + +// ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkInterfaceFloatingIpsOptions.InstanceID, + "network_interface_id": *listInstanceNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkInterfaceFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceNetworkInterfaceIps : List the primary reserved IP for an instance network interface +// This request lists the primary reserved IP for an instance network interface. +func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) +} + +// ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkInterfaceIpsOptions.InstanceID, + "network_interface_id": *listInstanceNetworkInterfaceIpsOptions.NetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkInterfaceIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceNetworkInterfaceIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Start)) + } + if listInstanceNetworkInterfaceIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceNetworkInterfaces : List all network interfaces on an instance +// This request lists all network interfaces on an instance. An instance network interface is an abstract representation +// of a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to +// any subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on +// the instance may also attach to the same subnet. +// +// If this instance has network attachments, each returned 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. +func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) +} + +// ListInstanceNetworkInterfacesWithContext is an alternate form of the ListInstanceNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkInterfacesOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceUnpaginatedCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceProfiles : List all instance profiles +// This request lists provisionable [instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the +// region. An instance profile specifies the performance characteristics and pricing model for an instance. +func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) +} + +// ListInstanceProfilesWithContext is an alternate form of the ListInstanceProfiles method which supports a Context parameter +func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceProfilesOptions, "listInstanceProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceTemplates : List all instance templates +// This request lists all instance templates in the region. +func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) +} + +// ListInstanceTemplatesWithContext is an alternate form of the ListInstanceTemplates method which supports a Context parameter +func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceTemplatesOptions, "listInstanceTemplatesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceTemplatesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplateCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceVolumeAttachments : List all volumes attachments on an instance +// This request lists all volume attachments on an instance. A volume attachment connects a volume to an instance. Each +// instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one +// volume. +func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) +} + +// ListInstanceVolumeAttachmentsWithContext is an alternate form of the ListInstanceVolumeAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceVolumeAttachmentsOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachmentCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstances : List all instances +// This request lists all instances in the region. +func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) +} + +// ListInstancesWithContext is an alternate form of the ListInstances method which supports a Context parameter +func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstancesOptions, "listInstancesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstancesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstancesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) + } + if listInstancesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstancesOptions.Limit)) + } + if listInstancesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listInstancesOptions.ResourceGroupID)) + } + if listInstancesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) + } + if listInstancesOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) + } + if listInstancesOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) + } + if listInstancesOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) + } + if listInstancesOptions.DedicatedHostID != nil { + builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) + } + if listInstancesOptions.DedicatedHostCRN != nil { + builder.AddQuery("dedicated_host.crn", fmt.Sprint(*listInstancesOptions.DedicatedHostCRN)) + } + if listInstancesOptions.DedicatedHostName != nil { + builder.AddQuery("dedicated_host.name", fmt.Sprint(*listInstancesOptions.DedicatedHostName)) + } + if listInstancesOptions.PlacementGroupID != nil { + builder.AddQuery("placement_group.id", fmt.Sprint(*listInstancesOptions.PlacementGroupID)) + } + if listInstancesOptions.PlacementGroupCRN != nil { + builder.AddQuery("placement_group.crn", fmt.Sprint(*listInstancesOptions.PlacementGroupCRN)) + } + if listInstancesOptions.PlacementGroupName != nil { + builder.AddQuery("placement_group.name", fmt.Sprint(*listInstancesOptions.PlacementGroupName)) + } + if listInstancesOptions.ReservationID != nil { + builder.AddQuery("reservation.id", fmt.Sprint(*listInstancesOptions.ReservationID)) + } + if listInstancesOptions.ReservationCRN != nil { + builder.AddQuery("reservation.crn", fmt.Sprint(*listInstancesOptions.ReservationCRN)) + } + if listInstancesOptions.ReservationName != nil { + builder.AddQuery("reservation.name", fmt.Sprint(*listInstancesOptions.ReservationName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from an instance network interface +// This request disassociates the specified floating IP from the specified instance network interface. +func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) +} + +// RemoveInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *removeInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *removeInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *removeInstanceNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeInstanceNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveInstanceNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// UpdateInstance : Update an instance +// This request updates an instance with the information in a provided instance patch. The instance patch object is +// structured in the same way as a retrieved instance and contains only the information to be updated. +func (vpc *VpcV1) UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) +} + +// UpdateInstanceWithContext is an alternate form of the UpdateInstance method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceOptions, "updateInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateInstanceOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateInstanceOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceDisk : Update an instance disk +// This request updates the instance disk with the information in a provided patch. +func (vpc *VpcV1) UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) +} + +// UpdateInstanceDiskWithContext is an alternate form of the UpdateInstanceDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceDiskOptions, "updateInstanceDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceDiskOptions.InstanceID, + "id": *updateInstanceDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceDisk") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceDiskOptions.InstanceDiskPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceNetworkAttachment : Update an instance network attachment +// This request updates an instance network attachment with the information provided in an instance network interface +// patch object. The instance network attachment patch object is structured in the same way as a retrieved instance +// network attachment and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) +} + +// UpdateInstanceNetworkAttachmentWithContext is an alternate form of the UpdateInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context, updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceNetworkAttachmentOptions.InstanceID, + "id": *updateInstanceNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkAttachment") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceNetworkInterface : Update an instance network interface +// This request updates an instance network interface with the information provided in an instance network interface +// patch object. The instance network interface patch object is structured in the same way as a retrieved instance +// network interface and needs to contain only the information to be updated. +// +// If this instance 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 is not allowed to be updated. +func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) +} + +// UpdateInstanceNetworkInterfaceWithContext is an alternate form of the UpdateInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceNetworkInterfaceOptions.InstanceID, + "id": *updateInstanceNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkInterface") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceTemplate : Update an instance template +// This request updates an instance template with the information provided in the instance template patch. The instance +// template patch object is structured in the same way as a retrieved instance template and contains only the +// information to be updated. +func (vpc *VpcV1) UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) +} + +// UpdateInstanceTemplateWithContext is an alternate form of the UpdateInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceTemplateOptions, "updateInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateInstanceTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceTemplate") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceTemplateOptions.InstanceTemplatePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceVolumeAttachment : Update a volume attachment +// This request updates a volume attachment with the information provided in a volume attachment patch object. The +// volume attachment patch object is structured in the same way as a retrieved volume attachment and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) +} + +// UpdateInstanceVolumeAttachmentWithContext is an alternate form of the UpdateInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceVolumeAttachmentOptions.InstanceID, + "id": *updateInstanceVolumeAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceVolumeAttachment") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceGroup : Create an instance group +// This request creates a new instance group. +func (vpc *VpcV1) CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupWithContext(context.Background(), createInstanceGroupOptions) +} + +// CreateInstanceGroupWithContext is an alternate form of the CreateInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupOptions, "createInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupOptions, "createInstanceGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroup") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceGroupOptions.InstanceTemplate != nil { + body["instance_template"] = createInstanceGroupOptions.InstanceTemplate + } + if createInstanceGroupOptions.Subnets != nil { + body["subnets"] = createInstanceGroupOptions.Subnets + } + if createInstanceGroupOptions.ApplicationPort != nil { + body["application_port"] = createInstanceGroupOptions.ApplicationPort + } + if createInstanceGroupOptions.LoadBalancer != nil { + body["load_balancer"] = createInstanceGroupOptions.LoadBalancer + } + if createInstanceGroupOptions.LoadBalancerPool != nil { + body["load_balancer_pool"] = createInstanceGroupOptions.LoadBalancerPool + } + if createInstanceGroupOptions.MembershipCount != nil { + body["membership_count"] = createInstanceGroupOptions.MembershipCount + } + if createInstanceGroupOptions.Name != nil { + body["name"] = createInstanceGroupOptions.Name + } + if createInstanceGroupOptions.ResourceGroup != nil { + body["resource_group"] = createInstanceGroupOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceGroupManager : Create a manager for an instance group +// This request creates a new instance group manager. +func (vpc *VpcV1) CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) +} + +// CreateInstanceGroupManagerWithContext is an alternate form of the CreateInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *createInstanceGroupManagerOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManager") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceGroupManagerAction : Create an instance group manager action +// This request creates a new instance group manager action. +func (vpc *VpcV1) CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) +} + +// CreateInstanceGroupManagerActionWithContext is an alternate form of the CreateInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Context, createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *createInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *createInstanceGroupManagerActionOptions.InstanceGroupManagerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupManagerActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerAction") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateInstanceGroupManagerPolicy : Create a policy for an instance group manager +// This request creates a new instance group manager policy. +func (vpc *VpcV1) CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) +} + +// CreateInstanceGroupManagerPolicyWithContext is an alternate form of the CreateInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Context, createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteInstanceGroup : Delete an instance group +// This request deletes an instance group. This operation cannot be reversed. Any instances associated with the group +// will be deleted. +func (vpc *VpcV1) DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupWithContext(context.Background(), deleteInstanceGroupOptions) +} + +// DeleteInstanceGroupWithContext is an alternate form of the DeleteInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupOptions, "deleteInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupOptions, "deleteInstanceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteInstanceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteInstanceGroupLoadBalancer : Delete an instance group load balancer +// This request unbinds the instance group from the load balancer pool, and deletes the load balancer pool members. +func (vpc *VpcV1) DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) +} + +// DeleteInstanceGroupLoadBalancerWithContext is an alternate form of the DeleteInstanceGroupLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context, deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupLoadBalancerOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/load_balancer`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteInstanceGroupManager : Delete an instance group manager +// This request deletes an instance group manager. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) +} + +// DeleteInstanceGroupManagerWithContext is an alternate form of the DeleteInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupManagerOptions.InstanceGroupID, + "id": *deleteInstanceGroupManagerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteInstanceGroupManagerAction : Delete specified instance group manager action +// This request deletes an instance group manager action. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) +} + +// DeleteInstanceGroupManagerActionWithContext is an alternate form of the DeleteInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Context, deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *deleteInstanceGroupManagerActionOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupManagerActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerAction") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteInstanceGroupManagerPolicy : Delete an instance group manager policy +// This request deletes an instance group manager policy. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) +} + +// DeleteInstanceGroupManagerPolicyWithContext is an alternate form of the DeleteInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Context, deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *deleteInstanceGroupManagerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteInstanceGroupMembership : Delete an instance group membership +// This request deletes a memberships of an instance group. This operation cannot be reversed. reversed. If the +// membership has `delete_instance_on_membership_delete` set to `true`, the instance will also be deleted. +func (vpc *VpcV1) DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) +} + +// DeleteInstanceGroupMembershipWithContext is an alternate form of the DeleteInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupMembershipOptions.InstanceGroupID, + "id": *deleteInstanceGroupMembershipOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupMembershipOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteInstanceGroupMemberships : Delete all memberships from an instance group +// This request deletes all memberships of an instance group. This operation cannot be reversed. reversed. Any +// memberships that have `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. +func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) +} + +// DeleteInstanceGroupMembershipsWithContext is an alternate form of the DeleteInstanceGroupMemberships method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupMembershipsOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupMembershipsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroup : Retrieve an instance group +// This request retrieves a single instance group specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) +} + +// GetInstanceGroupWithContext is an alternate form of the GetInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupOptions, "getInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupOptions, "getInstanceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceGroupManager : Retrieve an instance group manager +// This request retrieves a single instance group manager specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) +} + +// GetInstanceGroupManagerWithContext is an alternate form of the GetInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupManagerOptions.InstanceGroupID, + "id": *getInstanceGroupManagerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceGroupManagerAction : Retrieve specified instance group manager action +// This request retrieves a single instance group manager action specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupManagerActionWithContext(context.Background(), getInstanceGroupManagerActionOptions) +} + +// GetInstanceGroupManagerActionWithContext is an alternate form of the GetInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *getInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *getInstanceGroupManagerActionOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupManagerActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerAction") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceGroupManagerPolicy : Retrieve an instance group manager policy +// This request retrieves a single instance group manager policy specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) +} + +// GetInstanceGroupManagerPolicyWithContext is an alternate form of the GetInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *getInstanceGroupManagerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetInstanceGroupMembership : Retrieve an instance group membership +// This request retrieves a single instance group membership specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) +} + +// GetInstanceGroupMembershipWithContext is an alternate form of the GetInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupMembershipOptions.InstanceGroupID, + "id": *getInstanceGroupMembershipOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupMembershipOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceGroupManagerActions : List all actions for an instance group manager +// This request lists all instance group actions for an instance group manager. +func (vpc *VpcV1) ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) +} + +// ListInstanceGroupManagerActionsWithContext is an alternate form of the ListInstanceGroupManagerActions method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context, listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupManagerActionsOptions.InstanceGroupID, + "instance_group_manager_id": *listInstanceGroupManagerActionsOptions.InstanceGroupManagerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupManagerActionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerActions") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupManagerActionsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) + } + if listInstanceGroupManagerActionsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerActionsCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceGroupManagerPolicies : List all policies for an instance group manager +// This request lists all policies for an instance group manager. +func (vpc *VpcV1) ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) +} + +// ListInstanceGroupManagerPoliciesWithContext is an alternate form of the ListInstanceGroupManagerPolicies method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Context, listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupID, + "instance_group_manager_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupManagerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupManagerPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerPolicies") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupManagerPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Start)) + } + if listInstanceGroupManagerPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceGroupManagers : List all managers for an instance group +// This request lists all managers for an instance group. +func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) +} + +// ListInstanceGroupManagersWithContext is an alternate form of the ListInstanceGroupManagers method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupManagersOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupManagersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupManagersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) + } + if listInstanceGroupManagersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagersOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceGroupMemberships : List all memberships for an instance group +// This request lists all instance group memberships for an instance group. +func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) +} + +// ListInstanceGroupMembershipsWithContext is an alternate form of the ListInstanceGroupMemberships method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupMembershipsOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupMembershipsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupMemberships") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupMembershipsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) + } + if listInstanceGroupMembershipsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupMembershipsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembershipCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListInstanceGroups : List all instance groups +// This request lists all instance groups in the region. +func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) +} + +// ListInstanceGroupsWithContext is an alternate form of the ListInstanceGroups method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceGroupsOptions, "listInstanceGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) + } + if listInstanceGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroup : Update an instance group +// This request updates an instance group with the information provided instance group patch. The instance group patch +// object is structured in the same way as a retrieved instance group and contains only the information to be updated. +func (vpc *VpcV1) UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) +} + +// UpdateInstanceGroupWithContext is an alternate form of the UpdateInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupOptions, "updateInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupOptions, "updateInstanceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateInstanceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupOptions.InstanceGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroupManager : Update an instance group manager +// This request updates an instance group manager with the information provided instance group manager patch. +func (vpc *VpcV1) UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) +} + +// UpdateInstanceGroupManagerWithContext is an alternate form of the UpdateInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupManagerOptions.InstanceGroupID, + "id": *updateInstanceGroupManagerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManager") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroupManagerAction : Update specified instance group manager action +// This request updates an instance group manager action. +func (vpc *VpcV1) UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) +} + +// UpdateInstanceGroupManagerActionWithContext is an alternate form of the UpdateInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Context, updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *updateInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *updateInstanceGroupManagerActionOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupManagerActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerAction") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroupManagerPolicy : Update an instance group manager policy +// This request updates an instance group manager policy. +func (vpc *VpcV1) UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) +} + +// UpdateInstanceGroupManagerPolicyWithContext is an alternate form of the UpdateInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Context, updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *updateInstanceGroupManagerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerPolicy") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateInstanceGroupMembership : Update an instance group membership +// This request updates an instance group membership with the information provided instance group membership patch. +func (vpc *VpcV1) UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupMembershipWithContext(context.Background(), updateInstanceGroupMembershipOptions) +} + +// UpdateInstanceGroupMembershipWithContext is an alternate form of the UpdateInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupMembershipOptions.InstanceGroupID, + "id": *updateInstanceGroupMembershipOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupMembershipOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupMembership") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupMembershipOptions.InstanceGroupMembershipPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ActivateReservation : Activate a reservation +// This request activates a reservation. For this request to succeed, the reservation status must be `inactive`. +func (vpc *VpcV1) ActivateReservation(activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { + return vpc.ActivateReservationWithContext(context.Background(), activateReservationOptions) +} + +// ActivateReservationWithContext is an alternate form of the ActivateReservation method which supports a Context parameter +func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(activateReservationOptions, "activateReservationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(activateReservationOptions, "activateReservationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *activateReservationOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}/activate`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range activateReservationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ActivateReservation") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// CreateReservation : Create a reservation +// This request creates a new reservation from a reservation prototype object. The prototype object is structured in the +// same way as a retrieved reservation, and contains the information necessary to create the new reservation. +func (vpc *VpcV1) CreateReservation(createReservationOptions *CreateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + return vpc.CreateReservationWithContext(context.Background(), createReservationOptions) +} + +// CreateReservationWithContext is an alternate form of the CreateReservation method which supports a Context parameter +func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReservationOptions *CreateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createReservationOptions, "createReservationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createReservationOptions, "createReservationOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createReservationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateReservation") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createReservationOptions.Capacity != nil { + body["capacity"] = createReservationOptions.Capacity + } + if createReservationOptions.CommittedUse != nil { + body["committed_use"] = createReservationOptions.CommittedUse + } + if createReservationOptions.Profile != nil { + body["profile"] = createReservationOptions.Profile + } + if createReservationOptions.Zone != nil { + body["zone"] = createReservationOptions.Zone + } + if createReservationOptions.AffinityPolicy != nil { + body["affinity_policy"] = createReservationOptions.AffinityPolicy + } + if createReservationOptions.Name != nil { + body["name"] = createReservationOptions.Name + } + if createReservationOptions.ResourceGroup != nil { + body["resource_group"] = createReservationOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteReservation : Delete a reservation +// This request deletes a reservation. This operation cannot be reversed. Reservations with a `status` of `active` are +// not allowed to be deleted. +func (vpc *VpcV1) DeleteReservation(deleteReservationOptions *DeleteReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + return vpc.DeleteReservationWithContext(context.Background(), deleteReservationOptions) +} + +// DeleteReservationWithContext is an alternate form of the DeleteReservation method which supports a Context parameter +func (vpc *VpcV1) DeleteReservationWithContext(ctx context.Context, deleteReservationOptions *DeleteReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteReservationOptions, "deleteReservationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteReservationOptions, "deleteReservationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteReservationOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteReservationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteReservation") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetReservation : Retrieve a reservation +// This request retrieves a single reservation specified by identifier in the URL. +func (vpc *VpcV1) GetReservation(getReservationOptions *GetReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + return vpc.GetReservationWithContext(context.Background(), getReservationOptions) +} + +// GetReservationWithContext is an alternate form of the GetReservation method which supports a Context parameter +func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationOptions *GetReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getReservationOptions, "getReservationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getReservationOptions, "getReservationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getReservationOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getReservationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetReservation") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListReservations : List all reservations +// This request lists all reservations in the region. A reservation provides reserved capacity for a specified profile +// in a specified zone. A reservation can also include a long-term committed use discount. +// +// The reservations will be sorted by their `created_at` property values, with newest reservations first. Reservations +// with identical `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListReservations(listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { + return vpc.ListReservationsWithContext(context.Background(), listReservationsOptions) +} + +// ListReservationsWithContext is an alternate form of the ListReservations method which supports a Context parameter +func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listReservationsOptions, "listReservationsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listReservationsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListReservations") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listReservationsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listReservationsOptions.Start)) + } + if listReservationsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listReservationsOptions.Limit)) + } + if listReservationsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listReservationsOptions.Name)) + } + if listReservationsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listReservationsOptions.ResourceGroupID)) + } + if listReservationsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listReservationsOptions.ZoneName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservationCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateReservation : Update a reservation +// This request updates a reservation with the information provided in a reservation patch object. The patch object is +// structured in the same way as a retrieved reservation and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateReservation(updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + return vpc.UpdateReservationWithContext(context.Background(), updateReservationOptions) +} + +// UpdateReservationWithContext is an alternate form of the UpdateReservation method which supports a Context parameter +func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateReservationOptions, "updateReservationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateReservationOptions, "updateReservationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateReservationOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateReservationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateReservation") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateReservationOptions.ReservationPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateDedicatedHost : Create a dedicated host +// This request creates a new dedicated host. +func (vpc *VpcV1) CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) +} + +// CreateDedicatedHostWithContext is an alternate form of the CreateDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createDedicatedHostOptions, "createDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createDedicatedHostOptions.DedicatedHostPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateDedicatedHostGroup : Create a dedicated host group +// This request creates a new dedicated host group. +func (vpc *VpcV1) CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + return vpc.CreateDedicatedHostGroupWithContext(context.Background(), createDedicatedHostGroupOptions) +} + +// CreateDedicatedHostGroupWithContext is an alternate form of the CreateDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHostGroup") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createDedicatedHostGroupOptions.Class != nil { + body["class"] = createDedicatedHostGroupOptions.Class + } + if createDedicatedHostGroupOptions.Family != nil { + body["family"] = createDedicatedHostGroupOptions.Family + } + if createDedicatedHostGroupOptions.Zone != nil { + body["zone"] = createDedicatedHostGroupOptions.Zone + } + if createDedicatedHostGroupOptions.Name != nil { + body["name"] = createDedicatedHostGroupOptions.Name + } + if createDedicatedHostGroupOptions.ResourceGroup != nil { + body["resource_group"] = createDedicatedHostGroupOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteDedicatedHost : Delete a dedicated host +// This request deletes a dedicated host. +func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) +} + +// DeleteDedicatedHostWithContext is an alternate form of the DeleteDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteDedicatedHostOptions, "deleteDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteDedicatedHostGroup : Delete a dedicated host group +// This request deletes a dedicated host group. +func (vpc *VpcV1) DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteDedicatedHostGroupWithContext(context.Background(), deleteDedicatedHostGroupOptions) +} + +// DeleteDedicatedHostGroupWithContext is an alternate form of the DeleteDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteDedicatedHostGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHostGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetDedicatedHost : Retrieve a dedicated host +// This request retrieves a single dedicated host specified by the identifiers in the URL. +func (vpc *VpcV1) GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) +} + +// GetDedicatedHostWithContext is an alternate form of the GetDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostOptions, "getDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetDedicatedHostDisk : Retrieve a dedicated host disk +// This request retrieves a single dedicated host disk specified by the identifier in the URL. +func (vpc *VpcV1) GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) +} + +// GetDedicatedHostDiskWithContext is an alternate form of the GetDedicatedHostDisk method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "dedicated_host_id": *getDedicatedHostDiskOptions.DedicatedHostID, + "id": *getDedicatedHostDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetDedicatedHostGroup : Retrieve a dedicated host group +// This request retrieves a single dedicated host group specified by the identifier in the URL. +func (vpc *VpcV1) GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) +} + +// GetDedicatedHostGroupWithContext is an alternate form of the GetDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getDedicatedHostGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetDedicatedHostProfile : Retrieve a dedicated host profile +// This request retrieves a single dedicated host profile specified by the name in the URL. +func (vpc *VpcV1) GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostProfileWithContext(context.Background(), getDedicatedHostProfileOptions) +} + +// GetDedicatedHostProfileWithContext is an alternate form of the GetDedicatedHostProfile method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getDedicatedHostProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListDedicatedHostDisks : List all disks on a dedicated host +// This request lists all disks on a dedicated host. A disk is a physical device that is locally attached to the +// compute node. By default, the listed disks are sorted by their +// `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) +} + +// ListDedicatedHostDisksWithContext is an alternate form of the ListDedicatedHostDisks method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "dedicated_host_id": *listDedicatedHostDisksOptions.DedicatedHostID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDiskCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListDedicatedHostGroups : List all dedicated host groups +// This request lists all dedicated host groups in the region. Host groups are a collection of dedicated hosts for +// placement of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. +func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) +} + +// ListDedicatedHostGroupsWithContext is an alternate form of the ListDedicatedHostGroups method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostGroupsOptions, "listDedicatedHostGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listDedicatedHostGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) + } + if listDedicatedHostGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostGroupsOptions.Limit)) + } + if listDedicatedHostGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostGroupsOptions.ResourceGroupID)) + } + if listDedicatedHostGroupsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostGroupsOptions.ZoneName)) + } + if listDedicatedHostGroupsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listDedicatedHostGroupsOptions.Name)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroupCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListDedicatedHostProfiles : List all dedicated host profiles +// This request lists provisionable [dedicated host profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in +// the region. A dedicated host profile specifies the hardware characteristics for a dedicated host. +func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) +} + +// ListDedicatedHostProfilesWithContext is an alternate form of the ListDedicatedHostProfiles method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostProfilesOptions, "listDedicatedHostProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listDedicatedHostProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) + } + if listDedicatedHostProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostProfilesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListDedicatedHosts : List all dedicated hosts +// This request lists all dedicated hosts in the region. +func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) +} + +// ListDedicatedHostsWithContext is an alternate form of the ListDedicatedHosts method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostsOptions, "listDedicatedHostsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listDedicatedHostsOptions.DedicatedHostGroupID != nil { + builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) + } + if listDedicatedHostsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostsOptions.Start)) + } + if listDedicatedHostsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostsOptions.Limit)) + } + if listDedicatedHostsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostsOptions.ResourceGroupID)) + } + if listDedicatedHostsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostsOptions.ZoneName)) + } + if listDedicatedHostsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listDedicatedHostsOptions.Name)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateDedicatedHost : Update a dedicated host +// This request updates a dedicated host with the information in a provided dedicated host patch. The dedicated host +// patch object is structured in the same way as a retrieved dedicated host and contains only the information to be +// updated. +func (vpc *VpcV1) UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) +} + +// UpdateDedicatedHostWithContext is an alternate form of the UpdateDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostOptions, "updateDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateDedicatedHostOptions.DedicatedHostPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateDedicatedHostDisk : Update a dedicated host disk +// This request updates the dedicated host disk with the information in a provided patch. +func (vpc *VpcV1) UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) +} + +// UpdateDedicatedHostDiskWithContext is an alternate form of the UpdateDedicatedHostDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "dedicated_host_id": *updateDedicatedHostDiskOptions.DedicatedHostID, + "id": *updateDedicatedHostDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateDedicatedHostGroup : Update a dedicated host group +// This request updates a dedicated host group with the information in a provided dedicated host group patch. The +// dedicated host group patch object is structured in the same way as a retrieved dedicated host group and contains only +// the information to be updated. +func (vpc *VpcV1) UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) +} + +// UpdateDedicatedHostGroupWithContext is an alternate form of the UpdateDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateDedicatedHostGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBackupPolicy : Create a backup policy +// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in +// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. +func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) +} + +// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createBackupPolicyOptions.BackupPolicyPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBackupPolicyPlan : Create a plan for a backup policy +// This request creates a new backup policy plan from a backup policy plan prototype object. The prototype object is +// structured in the same way as a retrieved backup policy plan, and contains the information necessary to create the +// new backup policy plan. +// +// Backups created by this plan will use the resource group of the source being backed up. +// +// Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character +// suffix. +func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) +} + +// CreateBackupPolicyPlanWithContext is an alternate form of the CreateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createBackupPolicyPlanOptions.CronSpec != nil { + body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec + } + if createBackupPolicyPlanOptions.Active != nil { + body["active"] = createBackupPolicyPlanOptions.Active + } + if createBackupPolicyPlanOptions.AttachUserTags != nil { + body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags + } + if createBackupPolicyPlanOptions.ClonePolicy != nil { + body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy + } + if createBackupPolicyPlanOptions.CopyUserTags != nil { + body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags + } + if createBackupPolicyPlanOptions.DeletionTrigger != nil { + body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger + } + if createBackupPolicyPlanOptions.Name != nil { + body["name"] = createBackupPolicyPlanOptions.Name + } + if createBackupPolicyPlanOptions.RemoteRegionPolicies != nil { + body["remote_region_policies"] = createBackupPolicyPlanOptions.RemoteRegionPolicies + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteBackupPolicy : Delete a backup policy +// This request deletes a backup policy. This operation cannot be reversed. +// +// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, +// the backup policy will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) +} + +// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteBackupPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + if deleteBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteBackupPolicyPlan : Delete a backup policy plan +// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by +// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with +// the plan will run to completion before the plan is deleted. +// +// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing +// completes, the backup policy plan will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) +} + +// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, + "id": *deleteBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + if deleteBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBackupPolicy : Retrieve a backup policy +// This request retrieves a single backup policy specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) +} + +// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getBackupPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBackupPolicyJob : Retrieve a backup policy job +// This request retrieves a single backup policy job specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + return vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) +} + +// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, + "id": *getBackupPolicyJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBackupPolicyJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBackupPolicyPlan : Retrieve a backup policy plan +// This request retrieves a single backup policy plan specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) +} + +// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, + "id": *getBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBackupPolicies : List all backup policies +// This request lists all backup policies in the region. Backup policies control which sources are selected for backup +// and include a set of backup policy plans that provide the backup schedules and deletion triggers. +func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) +} + +// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter +func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listBackupPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBackupPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) + } + if listBackupPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) + } + if listBackupPoliciesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) + } + if listBackupPoliciesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) + } + if listBackupPoliciesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBackupPolicyJobs : List all jobs for a backup policy +// This request retrieves all jobs for a backup policy. A backup job represents the execution of a backup policy plan +// for a resource matching the policy's criteria. +func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) +} + +// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBackupPolicyJobsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) + } + if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) + } + if listBackupPolicyJobsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) + } + if listBackupPolicyJobsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) + } + if listBackupPolicyJobsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) + } + if listBackupPolicyJobsOptions.SourceID != nil { + builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { + builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { + builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBackupPolicyPlans : List all plans for a backup policy +// This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. +func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) +} + +// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBackupPolicyPlansOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBackupPolicy : Update a backup policy +// This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch +// object is structured in the same way as a retrieved backup policy and contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) +} + +// UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateBackupPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBackupPolicyPlan : Update a backup policy plan +// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is +// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) +} + +// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, + "id": *updateBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreatePlacementGroup : Create a placement group +// This request creates a new placement group. +func (vpc *VpcV1) CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + return vpc.CreatePlacementGroupWithContext(context.Background(), createPlacementGroupOptions) +} + +// CreatePlacementGroupWithContext is an alternate form of the CreatePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPlacementGroupOptions, "createPlacementGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createPlacementGroupOptions, "createPlacementGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createPlacementGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePlacementGroup") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createPlacementGroupOptions.Strategy != nil { + body["strategy"] = createPlacementGroupOptions.Strategy + } + if createPlacementGroupOptions.Name != nil { + body["name"] = createPlacementGroupOptions.Name + } + if createPlacementGroupOptions.ResourceGroup != nil { + body["resource_group"] = createPlacementGroupOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeletePlacementGroup : Delete a placement group +// This request deletes a placement group. This operation cannot be reversed. For this request to succeed, the placement +// group must not be associated with an instance. +func (vpc *VpcV1) DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeletePlacementGroupWithContext(context.Background(), deletePlacementGroupOptions) +} + +// DeletePlacementGroupWithContext is an alternate form of the DeletePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePlacementGroupOptions, "deletePlacementGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deletePlacementGroupOptions, "deletePlacementGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deletePlacementGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deletePlacementGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePlacementGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetPlacementGroup : Retrieve a placement group +// This request retrieves a single placement group specified by identifier in the URL. +func (vpc *VpcV1) GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + return vpc.GetPlacementGroupWithContext(context.Background(), getPlacementGroupOptions) +} + +// GetPlacementGroupWithContext is an alternate form of the GetPlacementGroup method which supports a Context parameter +func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPlacementGroupOptions, "getPlacementGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getPlacementGroupOptions, "getPlacementGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getPlacementGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getPlacementGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPlacementGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListPlacementGroups : List all placement groups +// This request lists all placement groups in the region. +func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) +} + +// ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter +func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listPlacementGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listPlacementGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) + } + if listPlacementGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdatePlacementGroup : Update a placement group +// This request updates a placement group with the information provided placement group patch. The placement group patch +// object is structured in the same way as a retrieved placement group and contains only the information to be updated. +func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + return vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) +} + +// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updatePlacementGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updatePlacementGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updatePlacementGroupOptions.PlacementGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface +// This request associates the specified floating IP with the specified bare metal server network interface. If +// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` +// is `true`, this replaces any existing association. +// +// The existing floating IP must: +// - not be required by another resource, such as a public gateway +// - be in the same `zone` as the bare metal server +// +// A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) +} + +// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBareMetalServer : Create a bare metal server +// This request provisions a new bare metal server from a prototype object. The prototype object is structured in the +// same way as a retrieved bare metal server, and contains the information necessary to provision the new bare metal +// server. The bare metal server is automatically started. +func (vpc *VpcV1) CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerWithContext(context.Background(), createBareMetalServerOptions) +} + +// CreateBareMetalServerWithContext is an alternate form of the CreateBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerOptions, "createBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBareMetalServerOptions, "createBareMetalServerOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServer") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createBareMetalServerOptions.BareMetalServerPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBareMetalServerConsoleAccessToken : Create a console access token for a bare metal server +// This request creates a new single-use console access token for a bare metal server. All console configuration is +// provided at token create time, and the token is subsequently used in the `access_token` query parameter for the +// WebSocket request. The access token is only valid for a short period of time, and a maximum of one token is valid +// for a given bare metal server at a time. +func (vpc *VpcV1) CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerConsoleAccessTokenWithContext(context.Background(), createBareMetalServerConsoleAccessTokenOptions) +} + +// CreateBareMetalServerConsoleAccessTokenWithContext is an alternate form of the CreateBareMetalServerConsoleAccessToken method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context.Context, createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *createBareMetalServerConsoleAccessTokenOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/console_access_token`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createBareMetalServerConsoleAccessTokenOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerConsoleAccessToken") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createBareMetalServerConsoleAccessTokenOptions.ConsoleType != nil { + body["console_type"] = createBareMetalServerConsoleAccessTokenOptions.ConsoleType + } + if createBareMetalServerConsoleAccessTokenOptions.Force != nil { + body["force"] = createBareMetalServerConsoleAccessTokenOptions.Force + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerConsoleAccessToken) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server +// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and +// contains the information necessary to create the new bare metal server network attachment. +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) +} + +// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server +// This request creates a new bare metal server network interface from a bare metal server network interface prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network interface, and +// contains the information necessary to create the new bare metal server network interface. Any subnet in the bare +// metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. +// Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. +// +// 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, and new network interfaces are not allowed to be created. +func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) +} + +// CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteBareMetalServer : Delete a bare metal server +// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the +// bare metal server network interfaces are implicitly disassociated. +func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) +} + +// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment +// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network attachment are implicitly disassociated. +// +// The bare metal server's primary network attachment cannot be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) +} + +// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface +// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server +// network interface is not allowed to be deleted. +// +// 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 is not allowed to be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) +} + +// DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetBareMetalServer : Retrieve a bare metal server +// This request retrieves a single bare metal server specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) +} + +// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerDisk : Retrieve a bare metal server disk +// This request retrieves a single disk specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) +} + +// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, + "id": *getBareMetalServerDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server +// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and +// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be +// current. +func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) +} + +// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getBareMetalServerInitializationOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment +// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) +} + +// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface +// This request retrieves a single bare metal server network interface specified by the identifier in the URL. +// +// If this bare metal server has network attachments, the retrieved 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. +func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) +} + +// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP if it is associated with the bare metal server network interface +// specified in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) +} + +// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for a bare metal server network interface. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) +} + +// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetBareMetalServerProfile : Retrieve a bare metal server profile +// This request retrieves a single bare metal server profile specified by the name in the URL. +func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) +} + +// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getBareMetalServerProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerDisks : List all disks on a bare metal server +// This request lists all disks on a bare metal server. A disk is a block device that is locally attached to the +// physical server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk +// first. +func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) +} + +// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerNetworkAttachments : List all network attachments on a bare metal server +// This request lists all network attachments on a bare metal server. A bare metal server network attachment is an +// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network +// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to +// the bare metal server. +// +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) +} + +// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServerNetworkAttachmentsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) + } + if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a bare metal server network interface +// This request lists all floating IPs associated with a bare metal server network interface. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) +} + +// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerNetworkInterfaceIps : List the primary reserved IP for a bare metal server network interface +// This request lists the primary reserved IP for a bare metal server network interface. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) +} + +// ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceIpsOptions.NetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerNetworkInterfaceIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server +// This request lists all network interfaces on a bare metal server. A bare metal server network interface is an +// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network +// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to +// the bare metal server. +// +// If this bare metal server has network attachments, each returned 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. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) +} + +// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServerNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) + } + if listBareMetalServerNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerProfiles : List all bare metal server profiles +// This request lists all [bare metal server +// profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) available in the region. A bare metal +// server profile specifies the performance characteristics and pricing model for a bare metal server. +func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) +} + +// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) + } + if listBareMetalServerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListBareMetalServers : List all bare metal servers +// This request lists all bare metal servers in the region. +func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) +} + +// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listBareMetalServersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) + } + if listBareMetalServersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) + } + if listBareMetalServersOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) + } + if listBareMetalServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) + } + if listBareMetalServersOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) + } + if listBareMetalServersOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) + } + if listBareMetalServersOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface +// This request disassociates the specified floating IP from the specified bare metal server network interface. +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) +} + +// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// RestartBareMetalServer : Restart a bare metal server +// This request restarts a bare metal server. It will run immediately regardless of the state of the server. +func (vpc *VpcV1) RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.RestartBareMetalServerWithContext(context.Background(), restartBareMetalServerOptions) +} + +// RestartBareMetalServerWithContext is an alternate form of the RestartBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(restartBareMetalServerOptions, "restartBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(restartBareMetalServerOptions, "restartBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *restartBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/restart`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range restartBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RestartBareMetalServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// StartBareMetalServer : Start a bare metal server +// This request starts a bare metal server. It will run immediately provided the server is stopped. +func (vpc *VpcV1) StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.StartBareMetalServerWithContext(context.Background(), startBareMetalServerOptions) +} + +// StartBareMetalServerWithContext is an alternate form of the StartBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(startBareMetalServerOptions, "startBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(startBareMetalServerOptions, "startBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *startBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/start`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range startBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StartBareMetalServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// StopBareMetalServer : Stop a bare metal server +// This request stops a bare metal server. It will run immediately provided the server is running. Note: A soft stop may +// not complete as it relies on the operating system to perform the operation. +func (vpc *VpcV1) StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.StopBareMetalServerWithContext(context.Background(), stopBareMetalServerOptions) +} + +// StopBareMetalServerWithContext is an alternate form of the StopBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(stopBareMetalServerOptions, "stopBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(stopBareMetalServerOptions, "stopBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *stopBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/stop`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range stopBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StopBareMetalServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if stopBareMetalServerOptions.Type != nil { + body["type"] = stopBareMetalServerOptions.Type + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// UpdateBareMetalServer : Update a bare metal server +// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object +// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) +} + +// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerOptions.BareMetalServerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBareMetalServerDisk : Update a bare metal server disk +// This request updates the bare metal server disk with the information in a provided patch. +func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) +} + +// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, + "id": *updateBareMetalServerDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment +// This request updates a bare metal server network attachment with the information provided in a bare metal server +// network attachment patch object. The bare metal server network attachment patch object is structured in the same way +// as a retrieved bare metal server network attachment and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) +} + +// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBareMetalServerNetworkInterface : Update a bare metal server network interface +// This request updates a bare metal server network interface with the information provided in a bare metal server +// network interface patch object. The bare metal server network interface patch object is structured in the same way as +// a retrieved bare metal server network interface and needs to contain only the information to be updated. +// +// 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 is not allowed to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) +} + +// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVolume : Create a volume +// This request creates a new volume from a volume prototype object. The prototype object is structured in the same way +// as a retrieved volume, and contains the information necessary to create the new volume. +func (vpc *VpcV1) CreateVolume(createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions) +} + +// CreateVolumeWithContext is an alternate form of the CreateVolume method which supports a Context parameter +func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVolumeOptions, "createVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createVolumeOptions.VolumePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVolume : Delete a volume +// This request deletes a volume. This operation cannot be reversed. For this request to succeed, the volume must not be +// attached to any instances. +func (vpc *VpcV1) DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions) +} + +// DeleteVolumeWithContext is an alternate form of the DeleteVolume method which supports a Context parameter +func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVolumeOptions, "deleteVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVolumeOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteVolumeOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVolumeOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVolume : Retrieve a volume +// This request retrieves a single volume specified by the identifier in the URL. +func (vpc *VpcV1) GetVolume(getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.GetVolumeWithContext(context.Background(), getVolumeOptions) +} + +// GetVolumeWithContext is an alternate form of the GetVolume method which supports a Context parameter +func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeOptions, "getVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVolumeOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVolumeProfile : Retrieve a volume profile +// This request retrieves a single volume profile specified by the name in the URL. +func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + return vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) +} + +// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter +func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getVolumeProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVolumeProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVolumeProfiles : List all volume profiles +// This request lists all [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available +// in the region. A volume profile specifies the performance characteristics and pricing model for a volume. +func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) +} + +// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter +func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVolumeProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVolumeProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) + } + if listVolumeProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVolumes : List all volumes +// This request lists all volumes in the region. Volumes are network-connected block storage devices that may be +// attached to one or more instances in the same region. +func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + return vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) +} + +// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter +func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVolumesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVolumesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) + } + if listVolumesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) + } + if listVolumesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) + } + if listVolumesOptions.AttachmentState != nil { + builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) + } + if listVolumesOptions.Encryption != nil { + builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) + } + if listVolumesOptions.OperatingSystemFamily != nil { + builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) + } + if listVolumesOptions.OperatingSystemArchitecture != nil { + builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) + } + if listVolumesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) + } + if listVolumesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVolume : Update a volume +// This request updates a volume with the information in a provided volume patch. The volume patch object is structured +// in the same way as a retrieved volume and contains only the information to be updated. +func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) +} + +// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter +func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVolumeOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVolumeOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSnapshot : Create a snapshot +// This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same +// way as a retrieved snapshot, and contains the information necessary to provision the new snapshot. +func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + return vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) +} + +// CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createSnapshotOptions.SnapshotPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSnapshotClone : Create a clone for a snapshot +// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if +// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. +func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + return vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) +} + +// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *createSnapshotCloneOptions.ID, + "zone_name": *createSnapshotCloneOptions.ZoneName, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createSnapshotCloneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateSnapshotConsistencyGroup : Create a snapshot consistency group +// This request creates a new snapshot consistency group from a snapshot consistency group object. The prototype object +// is structured in the same way as a retrieved consistency group, and contains the information necessary to provision +// the new snapshot consistency group. +func (vpc *VpcV1) CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + return vpc.CreateSnapshotConsistencyGroupWithContext(context.Background(), createSnapshotConsistencyGroupOptions) +} + +// CreateSnapshotConsistencyGroupWithContext is an alternate form of the CreateSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createSnapshotConsistencyGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSnapshot : Delete a snapshot +// This request deletes a snapshot. This operation cannot be reversed. +func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) +} + +// DeleteSnapshotWithContext is an alternate form of the DeleteSnapshot method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotOptions, "deleteSnapshotOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteSnapshotClone : Delete a snapshot clone +// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated +// from the snapshot. +func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) +} + +// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSnapshotCloneOptions.ID, + "zone_name": *deleteSnapshotCloneOptions.ZoneName, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// DeleteSnapshotConsistencyGroup : Delete a snapshot consistency group +// This request deletes snapshot consistency group. This operation cannot be reversed. If the +// `delete_snapshots_on_delete` property is `true`, all snapshots in the consistency group will also be deleted. +func (vpc *VpcV1) DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotConsistencyGroupWithContext(context.Background(), deleteSnapshotConsistencyGroupOptions) +} + +// DeleteSnapshotConsistencyGroupWithContext is an alternate form of the DeleteSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSnapshotConsistencyGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSnapshotConsistencyGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotConsistencyGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteSnapshots : Delete a filtered collection of snapshots +// This request deletes all snapshots created from a specific source volume. +func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) +} + +// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + if err != nil { + return + } + + for headerName, headerValue := range deleteSnapshotsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSnapshot : Retrieve a snapshot +// This request retrieves a single snapshot specified by the identifier in the URL. +func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + return vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) +} + +// GetSnapshotWithContext is an alternate form of the GetSnapshot method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotOptions, "getSnapshotOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetSnapshotClone : Retrieve a snapshot clone +// This request retrieves a single clone specified by the snapshot identifier and zone name in the URL. +func (vpc *VpcV1) GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + return vpc.GetSnapshotCloneWithContext(context.Background(), getSnapshotCloneOptions) +} + +// GetSnapshotCloneWithContext is an alternate form of the GetSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotCloneOptions, "getSnapshotCloneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSnapshotCloneOptions, "getSnapshotCloneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSnapshotCloneOptions.ID, + "zone_name": *getSnapshotCloneOptions.ZoneName, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSnapshotCloneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetSnapshotConsistencyGroup : Retrieve a snapshot consistency group +// This request retrieves a single snapshot consistency group specified by the identifier in the URL. +func (vpc *VpcV1) GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + return vpc.GetSnapshotConsistencyGroupWithContext(context.Background(), getSnapshotConsistencyGroupOptions) +} + +// GetSnapshotConsistencyGroupWithContext is an alternate form of the GetSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSnapshotConsistencyGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSnapshotConsistencyGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSnapshotClones : List all clones for a snapshot +// This request lists all clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. +func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + return vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) +} + +// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *listSnapshotClonesOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listSnapshotClonesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSnapshotConsistencyGroups : List all snapshot consistency groups +// This request lists all snapshot consistency groups in the region. A snapshot consistency group is a collection of +// individual snapshots taken at the same time. +func (vpc *VpcV1) ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions) +} + +// ListSnapshotConsistencyGroupsWithContext is an alternate form of the ListSnapshotConsistencyGroups method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSnapshotConsistencyGroupsOptions, "listSnapshotConsistencyGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSnapshotConsistencyGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSnapshotConsistencyGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Start)) + } + if listSnapshotConsistencyGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Limit)) + } + if listSnapshotConsistencyGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.ResourceGroupID)) + } + if listSnapshotConsistencyGroupsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Name)) + } + if listSnapshotConsistencyGroupsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Sort)) + } + if listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroupCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSnapshots : List all snapshots +// This request lists all snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is +// created. +func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + return vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) +} + +// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSnapshotsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSnapshotsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) + } + if listSnapshotsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) + } + if listSnapshotsOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag)) + } + if listSnapshotsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID)) + } + if listSnapshotsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name)) + } + if listSnapshotsOptions.SourceVolumeID != nil { + builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID)) + } + if listSnapshotsOptions.SourceVolumeCRN != nil { + builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN)) + } + if listSnapshotsOptions.SourceImageID != nil { + builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID)) + } + if listSnapshotsOptions.SourceImageCRN != nil { + builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN)) + } + if listSnapshotsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort)) + } + if listSnapshotsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) + } + if listSnapshotsOptions.CopiesID != nil { + builder.AddQuery("copies[].id", fmt.Sprint(*listSnapshotsOptions.CopiesID)) + } + if listSnapshotsOptions.CopiesName != nil { + builder.AddQuery("copies[].name", fmt.Sprint(*listSnapshotsOptions.CopiesName)) + } + if listSnapshotsOptions.CopiesCRN != nil { + builder.AddQuery("copies[].crn", fmt.Sprint(*listSnapshotsOptions.CopiesCRN)) + } + if listSnapshotsOptions.CopiesRemoteRegionName != nil { + builder.AddQuery("copies[].remote.region.name", fmt.Sprint(*listSnapshotsOptions.CopiesRemoteRegionName)) + } + if listSnapshotsOptions.SourceSnapshotID != nil { + builder.AddQuery("source_snapshot.id", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotID)) + } + if listSnapshotsOptions.SourceSnapshotRemoteRegionName != nil { + builder.AddQuery("source_snapshot.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotRemoteRegionName)) + } + if listSnapshotsOptions.SourceVolumeRemoteRegionName != nil { + builder.AddQuery("source_volume.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceVolumeRemoteRegionName)) + } + if listSnapshotsOptions.SourceImageRemoteRegionName != nil { + builder.AddQuery("source_image.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceImageRemoteRegionName)) + } + if listSnapshotsOptions.ClonesZoneName != nil { + builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName)) + } + if listSnapshotsOptions.SnapshotConsistencyGroupID != nil { + builder.AddQuery("snapshot_consistency_group.id", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupID)) + } + if listSnapshotsOptions.SnapshotConsistencyGroupCRN != nil { + builder.AddQuery("snapshot_consistency_group.crn", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupCRN)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateSnapshot : Update a snapshot +// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group +// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. +func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + return vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) +} + +// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter +func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateSnapshotConsistencyGroup : Update a snapshot consistency group +// This request updates a snapshot consistency group with the information in a provided snapshot consistency group +// patch. The snapshot consistency group patch object is structured in the same way as a retrieved snapshot consistency +// group and contains only the information to be updated. +func (vpc *VpcV1) UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateSnapshotConsistencyGroupWithContext(context.Background(), updateSnapshotConsistencyGroupOptions) +} + +// UpdateSnapshotConsistencyGroupWithContext is an alternate form of the UpdateSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateSnapshotConsistencyGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateSnapshotConsistencyGroupOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotConsistencyGroupOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateShare : Create a file share +// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, +// a replica share, or both a source and replica share. +// +// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to +// provision the new file shares. +func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.CreateShareWithContext(context.Background(), createShareOptions) +} + +// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter +func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createShareOptions, "createShareOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createShareOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createShareOptions.SharePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateShareMountTarget : Create a mount target for a file share +// This request creates a new share mount target from a share mount target prototype object. +// +// The prototype object is structured in the same way as a retrieved share mount target, and contains the information +// necessary to provision the new file share mount target. +func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) +} + +// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *createShareMountTargetOptions.ShareID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createShareMountTargetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createShareMountTargetOptions.ShareMountTargetPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteShare : Delete a file share +// This request deletes a share. This operation cannot be reversed. A share cannot be deleted if it: +// - has share mount targets +// - has a `lifecycle_state` of `updating` +// - has a replication operation in progress +// +// If the request is accepted, the share `lifecycle_state` will be set to `deleting`. Once deletion processing +// completes, it will no longer be retrievable. +func (vpc *VpcV1) DeleteShare(deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.DeleteShareWithContext(context.Background(), deleteShareOptions) +} + +// DeleteShareWithContext is an alternate form of the DeleteShare method which supports a Context parameter +func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareOptions, "deleteShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteShareOptions, "deleteShareOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteShareOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteShareOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + if deleteShareOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteShareOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteShareMountTarget : Delete a share mount target +// This request deletes a share mount target. This operation cannot be reversed. +// +// If the request is accepted, the share mount target `lifecycle_state` will be set to +// `deleting`. Once deletion processing completes, it will no longer be retrievable. +func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) +} + +// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *deleteShareMountTargetOptions.ShareID, + "id": *deleteShareMountTargetOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteShareMountTargetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteShareSource : Split the source file share from a replica share +// This request removes the replication relationship between a source share and the replica share specified by the +// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a +// `lifecycle_state` of `updating`, or has a replication operation in progress. +// +// This operation cannot be reversed. +func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) +} + +// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter +func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *deleteShareSourceOptions.ShareID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteShareSourceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// FailoverShare : Failover to replica file share +// This request triggers a failover to the replica file share specified by the identifier in the URL. The failover +// cannot be started if a source share or the replica share has a `lifecycle_state` of `updating`, or has a replication +// operation in progress. +// +// If `fallback_policy` is specified as `split`, and the request is accepted but the failover operation cannot be +// performed, a split will be triggered. +func (vpc *VpcV1) FailoverShare(failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { + return vpc.FailoverShareWithContext(context.Background(), failoverShareOptions) +} + +// FailoverShareWithContext is an alternate form of the FailoverShare method which supports a Context parameter +func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(failoverShareOptions, "failoverShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(failoverShareOptions, "failoverShareOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *failoverShareOptions.ShareID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/failover`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range failoverShareOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if failoverShareOptions.FallbackPolicy != nil { + body["fallback_policy"] = failoverShareOptions.FallbackPolicy + } + if failoverShareOptions.Timeout != nil { + body["timeout"] = failoverShareOptions.Timeout + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetShare : Retrieve a file share +// This request retrieves a single file share specified by the identifier in the URL. +func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.GetShareWithContext(context.Background(), getShareOptions) +} + +// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter +func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getShareOptions, "getShareOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getShareOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getShareOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetShareMountTarget : Retrieve a share mount target +// This request retrieves a single share mount target specified by the identifier in the URL. +func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) +} + +// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *getShareMountTargetOptions.ShareID, + "id": *getShareMountTargetOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getShareMountTargetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetShareProfile : Retrieve a file share profile +// This request retrieves a single file share profile specified by the name in the URL. +func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + return vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) +} + +// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter +func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getShareProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getShareProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetShareSource : Retrieve the source file share for a replica file share +// This request retrieves the source file share associated with the replica file share specified by the identifier in +// the URL. +func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { + return vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) +} + +// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter +func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *getShareSourceOptions.ShareID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getShareSourceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListShareMountTargets : List all mount targets for a file share +// This request retrieves all share mount targets for a file share. A share mount target is a network endpoint at which +// a file share may be mounted. The file share can be mounted by clients in the same VPC and zone after creating share +// mount targets. +// +// The share mount targets will be sorted by their `created_at` property values, with newest targets first. +func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + return vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) +} + +// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter +func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *listShareMountTargetsOptions.ShareID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listShareMountTargetsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listShareMountTargetsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) + } + if listShareMountTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) + } + if listShareMountTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListShareProfiles : List all file share profiles +// This request lists all [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) +// available in the region. A file share profile specifies the performance characteristics and pricing model for a file +// share. +func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) +} + +// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter +func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listShareProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listShareProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) + } + if listShareProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) + } + if listShareProfilesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListShares : List all file shares +// This request lists all file shares in the region. +func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + return vpc.ListSharesWithContext(context.Background(), listSharesOptions) +} + +// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter +func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSharesOptions, "listSharesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSharesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSharesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) + } + if listSharesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) + } + if listSharesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) + } + if listSharesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) + } + if listSharesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) + } + if listSharesOptions.ReplicationRole != nil { + builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateShare : Update a file share +// This request updates a share with the information in a provided share patch. The share patch object is structured in +// the same way as a retrieved share and contains only the information to be updated. +func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.UpdateShareWithContext(context.Background(), updateShareOptions) +} + +// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter +func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateShareOptions, "updateShareOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateShareOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateShareOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateShareOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateShareOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateShareMountTarget : Update a share mount target +// This request updates a share mount target with the information provided in a share mount target patch object. The +// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) +} + +// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "share_id": *updateShareMountTargetOptions.ShareID, + "id": *updateShareMountTargetOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateShareMountTargetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateShareMountTargetOptions.ShareMountTargetPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetRegion : Retrieve a region +// This request retrieves a single region specified by the name in the URL. +func (vpc *VpcV1) GetRegion(getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { + return vpc.GetRegionWithContext(context.Background(), getRegionOptions) +} + +// GetRegionWithContext is an alternate form of the GetRegion method which supports a Context parameter +func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getRegionOptions, "getRegionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getRegionOptions, "getRegionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getRegionOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getRegionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegion") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegion) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetRegionZone : Retrieve a zone +// This request retrieves a single zone specified by the region and zone names in the URL. +func (vpc *VpcV1) GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { + return vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) +} + +// GetRegionZoneWithContext is an alternate form of the GetRegionZone method which supports a Context parameter +func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getRegionZoneOptions, "getRegionZoneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "region_name": *getRegionZoneOptions.RegionName, + "name": *getRegionZoneOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getRegionZoneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListRegionZones : List all zones in a region +// This request lists all zones in a region. Zones represent logically-isolated data centers with high-bandwidth and +// low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. +func (vpc *VpcV1) ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { + return vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) +} + +// ListRegionZonesWithContext is an alternate form of the ListRegionZones method which supports a Context parameter +func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listRegionZonesOptions, "listRegionZonesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listRegionZonesOptions, "listRegionZonesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "region_name": *listRegionZonesOptions.RegionName, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listRegionZonesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegionZones") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListRegions : List all regions +// This request lists all regions. Each region is a separate geographic area that contains multiple isolated zones. +// Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones +// in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation +// available. Resources deployed within a single region also benefit from the low latency afforded by geographic +// proximity. +func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + return vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) +} + +// ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter +func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listRegionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddNetworkInterfaceFloatingIP : Add an association between a floating IP and a virtual network interface +// This request adds an association between the specified floating IP and the specified virtual network interface. +// +// If the virtual network interface has `enable_infrastructure_nat` set to `true`, no more than one floating IP can be +// associated, and network address translation is performed between the floating IP address and the virtual network +// interface's `primary_ip` address. +// +// If the virtual network interface has `enable_infrastructure_nat` set to `false`, packets are passed unchanged to/from +// the virtual network interface. +// +// The floating IP must: +// - be in the same `zone` as the virtual network interface +// - not currently be associated with another resource +// +// The virtual network interface's `target` must not currently be a file share mount target. +// +// A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + return vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) +} + +// AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *addNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *addNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AddVirtualNetworkInterfaceIP : Bind a reserved IP to a virtual network interface +// This request binds the specified reserved IP to the specified virtual network interface. +// +// The reserved IP must currently be unbound and in the primary IP's subnet. The virtual network interface's `target` +// must not currently be a file share mount target. +func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + return vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) +} + +// AddVirtualNetworkInterfaceIPWithContext is an alternate form of the AddVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *addVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *addVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addVirtualNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateVirtualNetworkInterface : Create a virtual network interface +// This request creates a new virtual network interface from a virtual network interface prototype object. The prototype +// object is structured in the same way as a retrieved virtual network interface, and contains the information necessary +// to create the new virtual network interface. +func (vpc *VpcV1) CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + return vpc.CreateVirtualNetworkInterfaceWithContext(context.Background(), createVirtualNetworkInterfaceOptions) +} + +// CreateVirtualNetworkInterfaceWithContext is an alternate form of the CreateVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVirtualNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVirtualNetworkInterface") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVirtualNetworkInterfaceOptions.AllowIPSpoofing != nil { + body["allow_ip_spoofing"] = createVirtualNetworkInterfaceOptions.AllowIPSpoofing + } + if createVirtualNetworkInterfaceOptions.AutoDelete != nil { + body["auto_delete"] = createVirtualNetworkInterfaceOptions.AutoDelete + } + if createVirtualNetworkInterfaceOptions.EnableInfrastructureNat != nil { + body["enable_infrastructure_nat"] = createVirtualNetworkInterfaceOptions.EnableInfrastructureNat + } + if createVirtualNetworkInterfaceOptions.Ips != nil { + body["ips"] = createVirtualNetworkInterfaceOptions.Ips + } + if createVirtualNetworkInterfaceOptions.Name != nil { + body["name"] = createVirtualNetworkInterfaceOptions.Name + } + if createVirtualNetworkInterfaceOptions.PrimaryIP != nil { + body["primary_ip"] = createVirtualNetworkInterfaceOptions.PrimaryIP + } + if createVirtualNetworkInterfaceOptions.ResourceGroup != nil { + body["resource_group"] = createVirtualNetworkInterfaceOptions.ResourceGroup + } + if createVirtualNetworkInterfaceOptions.SecurityGroups != nil { + body["security_groups"] = createVirtualNetworkInterfaceOptions.SecurityGroups + } + if createVirtualNetworkInterfaceOptions.Subnet != nil { + body["subnet"] = createVirtualNetworkInterfaceOptions.Subnet + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteVirtualNetworkInterfaces : Delete a virtual network interface +// This request deletes a virtual network interface. This operation cannot be reversed. For this request to succeed, the +// virtual network interface must not be required by another resource, such as the primary network attachment for an +// instance. +func (vpc *VpcV1) DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) +} + +// DeleteVirtualNetworkInterfacesWithContext is an alternate form of the DeleteVirtualNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVirtualNetworkInterfacesOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVirtualNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVirtualNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP if it is associated with the virtual network interface specified in +// the URL. +func (vpc *VpcV1) GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + return vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) +} + +// GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *getNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *getNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVirtualNetworkInterface : Retrieve a virtual network interface +// This request retrieves a single virtual network interface specified by the identifier in the URL. +func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + return vpc.GetVirtualNetworkInterfaceWithContext(context.Background(), getVirtualNetworkInterfaceOptions) +} + +// GetVirtualNetworkInterfaceWithContext is an alternate form of the GetVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVirtualNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVirtualNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetVirtualNetworkInterfaceIP : Retrieve bound reserved IP +// This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in +// the URL. +func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + return vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) +} + +// GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *getVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *getVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListNetworkInterfaceFloatingIps : List all floating IPs associated with a virtual network interface +// This request lists all floating IPs associated with a virtual network interface. +func (vpc *VpcV1) ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) +} + +// ListNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *listNetworkInterfaceFloatingIpsOptions.VirtualNetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listNetworkInterfaceFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkInterfaceFloatingIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listNetworkInterfaceFloatingIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start)) + } + if listNetworkInterfaceFloatingIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Limit)) + } + if listNetworkInterfaceFloatingIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVirtualNetworkInterfaceIps : List all reserved IPs bound to a virtual network interface +// This request lists all reserved IPs bound to a virtual network interface. +func (vpc *VpcV1) ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) +} + +// ListVirtualNetworkInterfaceIpsWithContext is an alternate form of the ListVirtualNetworkInterfaceIps method which supports a Context parameter +func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *listVirtualNetworkInterfaceIpsOptions.VirtualNetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVirtualNetworkInterfaceIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaceIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVirtualNetworkInterfaceIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Start)) + } + if listVirtualNetworkInterfaceIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Limit)) + } + if listVirtualNetworkInterfaceIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVirtualNetworkInterfaces : List all virtual network interfaces +// This request lists all virtual network interfaces in the region. A virtual network interface is a logical abstraction +// of a virtual network interface in a subnet, and may be attached to a target resource. +// +// The virtual network interfaces will be sorted by their `created_at` property values, with newest virtual network +// interfaces first. Virtual network interfaces with identical +// `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + return vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) +} + +// ListVirtualNetworkInterfacesWithContext is an alternate form of the ListVirtualNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVirtualNetworkInterfacesOptions, "listVirtualNetworkInterfacesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVirtualNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) + } + if listVirtualNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Limit)) + } + if listVirtualNetworkInterfacesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVirtualNetworkInterfacesOptions.ResourceGroupID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterfaceCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface +// This request disassociates the specified floating IP from the specified virtual network interface. +func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) +} + +// RemoveNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *removeNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *removeNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// RemoveVirtualNetworkInterfaceIP : Unbind a reserved IP from a virtual network interface +// This request unbinds the specified reserved IP from the specified virtual network interface. If the reserved IP has +// `auto_delete` set to `true`, the reserved IP will be deleted. +// +// The reserved IP for the `primary_ip` cannot be unbound. +func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveVirtualNetworkInterfaceIPWithContext(context.Background(), removeVirtualNetworkInterfaceIPOptions) +} + +// RemoveVirtualNetworkInterfaceIPWithContext is an alternate form of the RemoveVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context, removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *removeVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *removeVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeVirtualNetworkInterfaceIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVirtualNetworkInterfaceIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// UpdateVirtualNetworkInterface : Update a virtual network interface +// This request updates a virtual network interface with the information in a provided virtual network interface patch. +// The virtual network interface patch object is structured in the same way as a retrieved virtual network interface and +// contains only the information to be updated. +func (vpc *VpcV1) UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + return vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) +} + +// UpdateVirtualNetworkInterfaceWithContext is an alternate form of the UpdateVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVirtualNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVirtualNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVirtualNetworkInterface") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreatePublicGatewayWithContext(context.Background(), createPublicGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") + 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("maturity", fmt.Sprint("development")) + 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 + } + if createPublicGatewayOptions.FloatingIP != nil { + body["floating_ip"] = createPublicGatewayOptions.FloatingIP + } + if createPublicGatewayOptions.Name != nil { + body["name"] = createPublicGatewayOptions.Name + } + if createPublicGatewayOptions.ResourceGroup != nil { + body["resource_group"] = createPublicGatewayOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeletePublicGatewayWithContext(context.Background(), deletePublicGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deletePublicGatewayOptions, "deletePublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deletePublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deletePublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetPublicGatewayWithContext(context.Background(), getPublicGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getPublicGatewayOptions, "getPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListPublicGateways : List all public gateways +// This request lists all 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) { + return vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listPublicGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + 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 listPublicGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updatePublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updatePublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateFloatingIPWithContext(context.Background(), createFloatingIPOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createFloatingIPOptions, "createFloatingIPOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFloatingIP") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createFloatingIPOptions.FloatingIPPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteFloatingIPWithContext(context.Background(), deleteFloatingIPOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteFloatingIPOptions, "deleteFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetFloatingIPWithContext(context.Background(), getFloatingIPOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getFloatingIPOptions, "getFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListFloatingIps : List all floating IPs +// This request lists all 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) { + return vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateFloatingIPOptions.FloatingIPPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateNetworkACLWithContext(context.Background(), createNetworkACLOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createNetworkACLOptions.NetworkACLPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteNetworkACLWithContext(context.Background(), deleteNetworkACLOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteNetworkACLOptions, "deleteNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteNetworkACLOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range deleteNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *deleteNetworkACLRuleOptions.NetworkACLID, + "id": *deleteNetworkACLRuleOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetNetworkACLWithContext(context.Background(), getNetworkACLOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getNetworkACLOptions, "getNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getNetworkACLOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range getNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + 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) { + return vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *getNetworkACLRuleOptions.NetworkACLID, + "id": *getNetworkACLRuleOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range getNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListNetworkACLRules : List all rules for a network ACL +// This request lists all 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) { + return vpc.ListNetworkACLRulesWithContext(context.Background(), listNetworkACLRulesOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listNetworkACLRulesOptions, "listNetworkACLRulesOptions") + if err != nil { + return + } + + 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, `/network_acls/{network_acl_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listNetworkACLRulesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkACLRules") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listNetworkACLRulesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkACLRulesOptions.Start)) + } + if listNetworkACLRulesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkACLRulesOptions.Limit)) + } + if listNetworkACLRulesOptions.Direction != nil { + builder.AddQuery("direction", fmt.Sprint(*listNetworkACLRulesOptions.Direction)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRuleCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListNetworkAcls : List all network ACLs +// This request lists all 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) { + return vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listNetworkAclsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listNetworkAclsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) + } + 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() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions") + if err != nil { + return + } + + 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, `/network_acls/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + } + + 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 information is not applicable to the rule's protocol. +func (vpc *VpcV1) UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateNetworkACLRuleWithContext(context.Background(), updateNetworkACLRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *updateNetworkACLRuleOptions.NetworkACLID, + "id": *updateNetworkACLRuleOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range updateNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateNetworkACLRuleOptions.NetworkACLRulePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createSecurityGroupOptions, "createSecurityGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createSecurityGroupOptions.VPC != nil { + body["vpc"] = createSecurityGroupOptions.VPC + } + if createSecurityGroupOptions.Name != nil { + body["name"] = createSecurityGroupOptions.Name + } + if createSecurityGroupOptions.ResourceGroup != nil { + body["resource_group"] = createSecurityGroupOptions.ResourceGroup + } + if createSecurityGroupOptions.Rules != nil { + body["rules"] = createSecurityGroupOptions.Rules + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") + if err != nil { + 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) + if err != nil { + return + } + + for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + if err != nil { + 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) { + return vpc.CreateSecurityGroupTargetBindingWithContext(context.Background(), createSecurityGroupTargetBindingOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *createSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *createSecurityGroupTargetBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSecurityGroupOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range deleteSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *deleteSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *deleteSecurityGroupTargetBindingOptions.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}/targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSecurityGroupOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range getSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.GetSecurityGroupRuleWithContext(context.Background(), getSecurityGroupRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + if err != nil { + 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) { + return vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *getSecurityGroupTargetOptions.SecurityGroupID, + "id": *getSecurityGroupTargetOptions.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}/targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSecurityGroupRules : List all rules in a security group +// This request lists all 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) { + return vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") + if err != nil { + 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) + if err != nil { + return + } + + for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSecurityGroupTargets : List all targets associated with a security group +// This request lists all 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) { + return vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions") + if err != nil { + 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) + if err != nil { + return + } + + for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSecurityGroupTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) + } + if listSecurityGroupTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupTargetsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListSecurityGroups : List all security groups +// This request lists all 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) { + return vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSecurityGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + 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 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() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateSecurityGroupOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range updateSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSecurityGroupOptions.SecurityGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + if err != nil { + return + } + response.Result = result + } + + 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 information is not applicable to the +// rule's protocol. +func (vpc *VpcV1) UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + if err != nil { + 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) { + return vpc.AddVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionsLocalCIDROptions) +} + +// 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 { + return + } + err = core.ValidateStruct(addVPNGatewayConnectionsLocalCIDROptions, "addVPNGatewayConnectionsLocalCIDROptions") + if err != nil { + return + } + + 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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addVPNGatewayConnectionsLocalCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsLocalCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.AddVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionsPeerCIDROptions) +} + +// 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 { + return + } + err = core.ValidateStruct(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *addVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionsPeerCIDROptions.ID, + "cidr": *addVPNGatewayConnectionsPeerCIDROptions.CIDR, + } + + 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}/peer/cidrs/{cidr}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addVPNGatewayConnectionsPeerCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsPeerCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.CheckVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionsLocalCIDROptions) +} + +// 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 { + return + } + err = core.ValidateStruct(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range checkVPNGatewayConnectionsLocalCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsLocalCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.CheckVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionsPeerCIDROptions) +} + +// 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 { + return + } + err = core.ValidateStruct(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range checkVPNGatewayConnectionsPeerCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsPeerCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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_gateways/{vpn_gateway_id}/connections`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createVPNGatewayConnectionOptions.VPNGatewayConnectionPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteIkePolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.DeleteIpsecPolicyWithContext(context.Background(), deleteIpsecPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteIpsecPolicyOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range deleteIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVPNGatewayOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *deleteVPNGatewayConnectionOptions.VPNGatewayID, + "id": *deleteVPNGatewayConnectionOptions.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}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getIkePolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getIpsecPolicyOptions, "getIpsecPolicyOptions") + if err != nil { + 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, `/ipsec_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPNGatewayOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range getVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + 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) { + return vpc.GetVPNGatewayConnectionWithContext(context.Background(), getVPNGatewayConnectionOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *getVPNGatewayConnectionOptions.VPNGatewayID, + "id": *getVPNGatewayConnectionOptions.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}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListIkePolicies : List all IKE policies +// This request lists all IKE policies in the region. +func (vpc *VpcV1) ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listIkePoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + 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)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListIkePolicyConnections : List all VPN gateway connections that use a specified IKE policy +// This request lists all VPN gateway connections that use a policy. +func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) +} + +// ListIkePolicyConnectionsWithContext is an alternate form of the ListIkePolicyConnections method which supports a Context parameter +func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *listIkePolicyConnectionsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}/connections`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListIpsecPolicies : List all IPsec policies +// This request lists all IPsec policies in the region. +func (vpc *VpcV1) ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listIpsecPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListIpsecPolicyConnections : List all VPN gateway connections that use a specified IPsec policy +// This request lists all VPN gateway connections that use a policy. +func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) +} + +// ListIpsecPolicyConnectionsWithContext is an alternate form of the ListIpsecPolicyConnections method which supports a Context parameter +func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") + if err != nil { + 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 { + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPNGatewayConnections : List all connections of a VPN gateway +// This request lists all connections of a VPN gateway. +func (vpc *VpcV1) ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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_gateways/{vpn_gateway_id}/connections`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPNGatewayConnectionsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPNGatewayConnectionsLocalCIDRs : List all local CIDRs for a VPN gateway connection +// This request lists all 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) { + return vpc.ListVPNGatewayConnectionsLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionsLocalCIDRsOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *listVPNGatewayConnectionsLocalCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionsLocalCIDRsOptions.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`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewayConnectionsLocalCIDRsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsLocalCIDRs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCIDRs) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPNGatewayConnectionsPeerCIDRs : List all peer CIDRs for a VPN gateway connection +// This request lists all 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) { + return vpc.ListVPNGatewayConnectionsPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionsPeerCIDRsOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions") + if err != nil { + return + } + + 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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewayConnectionsPeerCIDRsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsPeerCIDRs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCIDRs) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPNGateways : List all VPN gateways +// This request lists all VPN gateways in the region. +func (vpc *VpcV1) ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewaysWithContext(context.Background(), listVPNGatewaysOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.RemoveVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionsLocalCIDROptions) +} + +// 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 { + return + } + err = core.ValidateStruct(removeVPNGatewayConnectionsLocalCIDROptions, "removeVPNGatewayConnectionsLocalCIDROptions") + if err != nil { + return + } + + 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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeVPNGatewayConnectionsLocalCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsLocalCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.RemoveVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionsPeerCIDROptions) +} + +// 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 { + return + } + err = core.ValidateStruct(removeVPNGatewayConnectionsPeerCIDROptions, "removeVPNGatewayConnectionsPeerCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeVPNGatewayConnectionsPeerCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsPeerCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateIkePolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateIkePolicyOptions.IkePolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") + if err != nil { + return + } + + 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, `/ipsec_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVPNGatewayOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range updateVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPNGatewayOptions.VPNGatewayPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *updateVPNGatewayConnectionOptions.VPNGatewayID, + "id": *updateVPNGatewayConnectionOptions.ID, + } + + 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}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateVPNServerWithContext(context.Background(), createVPNServerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") + 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("maturity", fmt.Sprint("development")) + 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) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + if err != nil { + 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. destination of the +// packet. +func (vpc *VpcV1) CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + return vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPNServerRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") + 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("maturity", fmt.Sprint("development")) + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteVPNServerWithContext(context.Background(), deleteVPNServerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVPNServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNServerClientOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *disconnectVPNClientOptions.VPNServerID, + "id": *disconnectVPNClientOptions.ID, + } + + 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) + if err != nil { + return + } + + for headerName, headerValue := range disconnectVPNClientOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getVPNServerOptions, "getVPNServerOptions") + if err != nil { + 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) + if err != nil { + return + } + + for headerName, headerValue := range getVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + if err != nil { + 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) { + return vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNServerClientOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPNServerClientConfigurationOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}/client_configuration`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "text/plain") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, &result) + + 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) { + return vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getVPNServerRouteOptions, "getVPNServerRouteOptions") + if err != nil { + 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) + if err != nil { + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPNServerClients : List all VPN clients for a VPN server +// This request retrieves all 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) { + return vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *listVPNServerClientsOptions.VPNServerID, + } + + 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) + if err != nil { + return + } + + for headerName, headerValue := range listVPNServerClientsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPNServerRoutes : List all VPN routes for a VPN server +// This request lists all 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) { + return vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNServerRoutesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRouteCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListVPNServers : List all VPN servers +// This request lists all VPN servers. +func (vpc *VpcV1) ListVPNServers(listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVPNServersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateVPNServer : Update a VPN server +// This request updates the properties of an existing VPN server. Any property changes will cause all connected VPN +// clients are disconnected from this VPN server except for the name change. +func (vpc *VpcV1) UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + return vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVPNServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateVPNServerRouteWithContext(context.Background(), updateVPNServerRouteOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPNServerRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPNServerRouteOptions.VPNServerRoutePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) + if err != nil { + 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) { + return vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") + 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("maturity", fmt.Sprint("development")) + 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.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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") + if err != nil { + 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) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + if err != nil { + 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) { + return vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") + if err != nil { + 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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") + 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("maturity", fmt.Sprint("development")) + 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 createLoadBalancerListenerPolicyOptions.Target != nil { + body["target"] = createLoadBalancerListenerPolicyOptions.Target + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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 { + 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("maturity", fmt.Sprint("development")) + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") + if err != nil { + 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, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createLoadBalancerPoolOptions.Algorithm != nil { + body["algorithm"] = createLoadBalancerPoolOptions.Algorithm + } + if createLoadBalancerPoolOptions.HealthMonitor != nil { + body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor + } + if createLoadBalancerPoolOptions.Protocol != nil { + body["protocol"] = createLoadBalancerPoolOptions.Protocol + } + if createLoadBalancerPoolOptions.Members != nil { + body["members"] = createLoadBalancerPoolOptions.Members + } + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") + if err != nil { + 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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") + 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("maturity", fmt.Sprint("development")) + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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}/listeners/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *deleteLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *deleteLoadBalancerListenerPolicyOptions.ListenerID, + "id": *deleteLoadBalancerListenerPolicyOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") + if err != nil { + 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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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}/listeners/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, + "id": *getLoadBalancerListenerPolicyOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + 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) { + return vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getLoadBalancerProfileOptions.Name, + } + + 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) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetLoadBalancerStatistics : List all 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) { + return vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") + if err != nil { + 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) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerStatistics) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerListenerPolicies : List all policies for a load balancer listener +// This request lists all 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) { + return vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") + if err != nil { + 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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy +// This request lists all rules of a load balancer listener policy. +func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, + "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, + } + + 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) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerListeners : List all listeners for a load balancer +// This request lists all listeners for a load balancer. +func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, + } + + 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 { + return + } + + for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerPoolMembers : List all members of a load balancer pool +// This request lists all members of a load balancer pool. +func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") + if err != nil { + 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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerPools : List all pools of a load balancer +// This request lists all pools of a load balancer. +func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") + if err != nil { + 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, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancerProfiles : List all load balancer profiles +// This request lists all 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) { + return vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) +} + +// 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 { + 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 { + 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("maturity", fmt.Sprint("development")) + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfileCollection) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLoadBalancers : List all load balancers +// This request lists all load balancers in the region. +func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) +} + +// 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 { + return + } + + 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 { + return + } + + 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("maturity", fmt.Sprint("development")) + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerCollection) + if err != nil { + 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) { + return vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") + if err != nil { + 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 { + 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("maturity", fmt.Sprint("development")) + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + if err != nil { + 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) { + return vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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}/listeners/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, + "id": *updateLoadBalancerListenerPolicyOptions.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/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, + "id": *addEndpointGatewayIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") + 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("maturity", fmt.Sprint("development")) + 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 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "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 { + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") + if err != nil { + 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, `/endpoint_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + 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) { + return vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *getEndpointGatewayIPOptions.EndpointGatewayID, + "id": *getEndpointGatewayIPOptions.ID, + } + + 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) + if err != nil { + return + } + + for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway +// This request lists all reserved IPs bound to an endpoint gateway. +func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { + return vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, + } + + 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`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionEndpointGatewayContext) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListEndpointGateways : List all endpoint gateways +// This request lists all 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) { + return vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) +} + +// 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 { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listEndpointGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + 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.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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) + if err != nil { + 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) { + return vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *removeEndpointGatewayIPOptions.EndpointGatewayID, + "id": *removeEndpointGatewayIPOptions.ID, + } + + 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/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateEndpointGatewayOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range updateEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateEndpointGatewayOptions.EndpointGatewayPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + 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) { + return vpc.CreateFlowLogCollectorWithContext(context.Background(), createFlowLogCollectorOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(createFlowLogCollectorOptions, "createFlowLogCollectorOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + 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 { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteFlowLogCollectorOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + 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) { + return vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getFlowLogCollectorOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range getFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListFlowLogCollectors : List all flow log collectors +// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over the instance +// network interfaces and instance network attachments contained within its target. +func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { + return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) +} + +// 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 { + return + } + + 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 { + return + } + + 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("maturity", fmt.Sprint("development")) + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollectorCollection) + if err != nil { + return + } + response.Result = result + } + + 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) { + return vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) +} + +// 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 { + return + } + err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateFlowLogCollectorOptions.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) + if err != nil { + return + } + + for headerName, headerValue := range updateFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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("maturity", fmt.Sprint("development")) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateFlowLogCollectorOptions.FlowLogCollectorPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + } + + 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 { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + 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 { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + 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 { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "has_subnets", &obj.HasSubnets) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AddressPrefixCollection : AddressPrefixCollection struct +type AddressPrefixCollection struct { + // Collection of address prefixes. + AddressPrefixes []AddressPrefix `json:"address_prefixes" validate:"required"` + + // A link to the first page of resources. + First *AddressPrefixCollectionFirst `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 *AddressPrefixCollectionNext `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 { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalAddressPrefixCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalAddressPrefixCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + return start, nil +} + +// 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"` +} + +// 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) + if err != nil { + 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"` +} + +// 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) + if err != nil { + 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"` + + // 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 { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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) + } + 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). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + 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 in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + 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 in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + 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 in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected +// property value was encountered. +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 { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalBackupPolicyHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_job_completed_at", &obj.LastJobCompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScope) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyCollection : BackupPolicyCollection struct +type BackupPolicyCollection struct { + // Collection of backup policies. + BackupPolicies []BackupPolicyIntf `json:"backup_policies" validate:"required"` + + // A link to the first page of resources. + First *BackupPolicyCollectionFirst `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"` + + // 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 { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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"` +} + +// 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyHealthReason : BackupPolicyHealthReason struct +type BackupPolicyHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the BackupPolicyHealthReason.Code property. +// A snake case string succinctly identifying the reason 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 { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + 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. + 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 will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the + // unexpected property value was encountered. + 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 will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + 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"` +} + +// Constants associated with the BackupPolicyJob.JobType property. +// The type of backup policy job. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the +// unexpected property value was encountered. +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 will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the +// unexpected property value was encountered. +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 { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_after", &obj.AutoDeleteAfter) + if err != nil { + return + } + err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "job_type", &obj.JobType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalBackupPolicyJobSource) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBackupPolicyJobStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target_snapshots", &obj.TargetSnapshots, UnmarshalSnapshotReference) + if err != nil { + 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"` + + // Collection of backup policy jobs. + 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 *BackupPolicyJobCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" 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 { + return + } + err = core.UnmarshalModel(m, "jobs", &obj.Jobs, UnmarshalBackupPolicyJob) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyJobCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + return start, nil +} + +// 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"` +} + +// 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) + if err != nil { + return + } + 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) + if err != nil { + 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)). +// 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 *VolumeReferenceDeleted `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"` +} + +// Constants associated with the BackupPolicyJobSource.ResourceType property. +// The resource type. +const ( + BackupPolicyJobSourceResourceTypeVolumeConst = "volume" +) + +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 { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyJobStatusReason : BackupPolicyJobStatusReason struct +type BackupPolicyJobStatusReason struct { + // A snake case string succinctly identifying the status reason: + // - `internal_error`: Internal error (contact IBM support) + // - `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). + 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 snake case string succinctly identifying the status reason: +// - `internal_error`: Internal error (contact IBM support) +// - `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). +const ( + BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error" + BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" + BackupPolicyJobStatusReasonCodeSnapshotVolumeLimitConst = "snapshot_volume_limit" + BackupPolicyJobStatusReasonCodeSourceVolumeBusyConst = "source_volume_busy" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + 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 { + return + } + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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) { + var jsonData []byte + jsonData, err = json.Marshal(backupPolicyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + 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"` + + // 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 *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 lifecycle state of this backup policy plan. + LifecycleState *string `json:"lifecycle_state" 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 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"` +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTrigger) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + 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 { + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneReference) + if err != nil { + 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 { + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) + if err != nil { + 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") + 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 { + return + } + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanCollection : BackupPolicyPlanCollection struct +type BackupPolicyPlanCollection struct { + // Collection of backup policy plans. + Plans []BackupPolicyPlan `json:"plans" 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, "plans", &obj.Plans, UnmarshalBackupPolicyPlan) + if err != nil { + 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 { + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + 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 { + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + return + } + 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 { + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) + if err != nil { + 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 { + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) + if err != nil { + 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) + } + 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") + 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 { + return + } + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "clone_policy", &obj.ClonePolicy, UnmarshalBackupPolicyPlanClonePolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote_region_policies", &obj.RemoteRegionPolicies, UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanReference : BackupPolicyPlanReference struct +type BackupPolicyPlanReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BackupPolicyPlanReferenceDeleted `json:"deleted,omitempty"` + + // 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 name for this backup policy plan. The name is unique across all plans in the backup policy. + 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 resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// 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, UnmarshalBackupPolicyPlanReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalBackupPolicyPlanRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BackupPolicyPlanReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBackupPolicyPlanReferenceDeleted unmarshals an instance of BackupPolicyPlanReferenceDeleted from the specified map of raw messages. +func UnmarshalBackupPolicyPlanReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + 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"` +} + +// 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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"` + + // 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"` +} + +// 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 { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + 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"` + + // 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"` +} + +// 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") + 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 { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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"` +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScopePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + 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) + if err != nil { + 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 possible resource types for this property are expected to expand 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 bare metal server. + CRN *string `json:"crn" 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"` + + // 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 bare metal server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server. + ID *string `json:"id" validate:"required"` + + // The reasons for the current `lifecycle_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []BareMetalServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the bare metal server. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // 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. + // + // 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 primary network attachment for this bare metal server. + PrimaryNetworkAttachment *BareMetalServerNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` + + // 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 [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 bare metal server. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the bare metal server. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + 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 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. +// The resource type. +const ( + BareMetalServerResourceTypeBareMetalServerConst = "bare_metal_server" +) + +// Constants associated with the BareMetalServer.Status property. +// The status of the bare metal server. +const ( + BareMetalServerStatusDeletingConst = "deleting" + BareMetalServerStatusFailedConst = "failed" + BareMetalServerStatusMaintenanceConst = "maintenance" + BareMetalServerStatusPendingConst = "pending" + BareMetalServerStatusRestartingConst = "restarting" + BareMetalServerStatusRunningConst = "running" + BareMetalServerStatusStartingConst = "starting" + BareMetalServerStatusStoppedConst = "stopped" + BareMetalServerStatusStoppingConst = "stopping" +) + +// 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 { + return + } + err = core.UnmarshalModel(m, "boot_target", &obj.BootTarget, UnmarshalBareMetalServerBootTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu", &obj.Cpu, UnmarshalBareMetalServerCpu) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalBareMetalServerLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerNetworkAttachmentReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceBareMetalServerContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBareMetalServerStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModule) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerBootTarget : The possible resource types for this property are expected to expand 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 *BareMetalServerDiskReferenceDeleted `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, UnmarshalBareMetalServerDiskReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + 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 { + return + } + err = core.UnmarshalPrimitive(m, "core_count", &obj.CoreCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "threads_per_core", &obj.ThreadsPerCore) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerCollection : BareMetalServerCollection struct +type BareMetalServerCollection struct { + // Collection of bare metal servers. + BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` + + // A link to the first page of resources. + First *BareMetalServerCollectionFirst `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"` + + // 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 { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *BareMetalServerCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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"` +} + +// 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) + if err != nil { + 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"` +} + +// 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) + if err != nil { + 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"` + + // The bare metal server console type for which this token may be used. + ConsoleType *string `json:"console_type" validate:"required"` + + // The date and time that the access token was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The date and time that the access token will expire. + ExpiresAt *strfmt.DateTime `json:"expires_at" 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"` + + // The URL to access this bare metal server console. + Href *string `json:"href" validate:"required"` +} + +// Constants associated with the BareMetalServerConsoleAccessToken.ConsoleType property. +// The bare metal server console type for which this token may be used. +const ( + BareMetalServerConsoleAccessTokenConsoleTypeSerialConst = "serial" + BareMetalServerConsoleAccessTokenConsoleTypeVncConst = "vnc" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "force", &obj.Force) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + 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"` + + // The URL for this bare metal server disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server disk. + ID *string `json:"id" validate:"required"` + + // The disk interface used for attaching the disk. + // + // - `fcp`: Attached using Fiber Channel Protocol + // - `sata`: Attached using Serial Advanced Technology Attachment + // - `nvme`: Attached using Non-Volatile Memory Express + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + 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 size of the disk in GB (gigabytes). + Size *int64 `json:"size" validate:"required"` +} + +// Constants associated with the BareMetalServerDisk.InterfaceType property. +// The disk interface used for attaching the disk. +// +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerDiskInterfaceTypeFcpConst = "fcp" + BareMetalServerDiskInterfaceTypeNvmeConst = "nvme" + BareMetalServerDiskInterfaceTypeSataConst = "sata" +) + +// Constants associated with the BareMetalServerDisk.ResourceType property. +// The resource type. +const ( + BareMetalServerDiskResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerDiskCollection : BareMetalServerDiskCollection struct +type BareMetalServerDiskCollection struct { + // Collection of the bare metal server's disks. + 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 { + 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. + 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 { + 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) + } + return +} + +// BareMetalServerDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerDiskReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerDiskReferenceDeleted unmarshals an instance of BareMetalServerDiskReferenceDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDiskReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + 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"` + + // 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 { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "user_accounts", &obj.UserAccounts, UnmarshalBareMetalServerInitializationUserAccount) + if err != nil { + 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"` + + // 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. + UserData *string `json:"user_data,omitempty"` +} + +// 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") + return +} + +// 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 { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + 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"` + + // 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 BareMetalServerInitializationUserAccount.ResourceType property. +// The resource type. +const ( + BareMetalServerInitializationUserAccountResourceTypeHostUserAccountConst = "host_user_account" +) + +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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "username", &obj.Username) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerLifecycleReason : BareMetalServerLifecycleReason struct +type BareMetalServerLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 BareMetalServerLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + BareMetalServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + 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 are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The lifecycle state of the bare metal server network attachment. + LifecycleState *string `json:"lifecycle_state" 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 port speed for this bare metal server network attachment in Mbps. + PortSpeed *int64 `json:"port_speed" 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 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 bare metal server network attachment type. + Type *string `json:"type" validate:"required"` + + // The virtual network interface for this bare metal server network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` + + // The VLAN IDs allowed 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"` +} + +// 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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerNetworkAttachmentInterfaceTypePciConst = "pci" + BareMetalServerNetworkAttachmentInterfaceTypeVlanConst = "vlan" +) + +// 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 ( + BareMetalServerNetworkAttachmentResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" +) + +// Constants associated with the BareMetalServerNetworkAttachment.Type property. +// The bare metal server network attachment type. +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 { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + 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"` + + // Collection of bare metal server network attachments. + 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 *BareMetalServerNetworkAttachmentCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkAttachmentCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + return start, nil +} + +// 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"` +} + +// 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) + if err != nil { + 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"` +} + +// 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) + if err != nil { + 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"` + + // 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"` +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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) + } + return +} + +// 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 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"` +} + +// 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 { + return true +} + +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 { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + 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"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,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"` + + // 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"` + + // 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 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"` + + // 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 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"` +} + +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 { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + 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 *BareMetalServerNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` + + // 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 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 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"` +} + +// Constants associated with the BareMetalServerNetworkAttachmentReference.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkAttachmentReferenceResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" +) + +// 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, UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkAttachmentReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted unmarshals an instance of BareMetalServerNetworkAttachmentReferenceDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + 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 are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + 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 an empty string. + // + // 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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +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 = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + return + } + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByHiperSocket) + } else if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByPci) + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByVlan) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + } + return +} + +// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct +type BareMetalServerNetworkInterfaceCollection struct { + // A link to the first page of resources. + First *BareMetalServerNetworkInterfaceCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of bare metal server network interfaces. + 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"` + + // 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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"` + + // 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"` +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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) + } + 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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + return + } + if discValue == "hipersocket" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + } else if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + } + return +} + +// BareMetalServerNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkInterfaceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type BareMetalServerNetworkInterfaceReferenceTargetContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPatch : BareMetalServerPatch struct +type BareMetalServerPatch struct { + // 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, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) + if err != nil { + 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) + } + return +} + +// 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. + // + // 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 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 ( + BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" +) + +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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + 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"` + + // 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`. + InterfaceType *string `json:"interface_type,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 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"` +} + +// 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" +) + +// 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") + return +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + 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"` + + // Collection of the bare metal server profile's disks. + Disks []BareMetalServerProfileDisk `json:"disks" validate:"required"` + + // The product family this bare metal server profile belongs to. + Family *string `json:"family" validate:"required"` + + // The URL for this bare metal server profile. + Href *string `json:"href" validate:"required"` + + Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` + + // The name for this bare metal server profile. + 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 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"` +} + +// Constants associated with the BareMetalServerProfile.ResourceType property. +// The resource type. +const ( + BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +// 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 { + return + } + err = core.UnmarshalModel(m, "console_types", &obj.ConsoleTypes, UnmarshalBareMetalServerProfileConsoleTypes) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_architecture", &obj.CpuArchitecture, UnmarshalBareMetalServerProfileCpuArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_core_count", &obj.CpuCoreCount, UnmarshalBareMetalServerProfileCpuCoreCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu_socket_count", &obj.CpuSocketCount, UnmarshalBareMetalServerProfileCpuSocketCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerProfileDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalBareMetalServerProfileNetworkAttachmentCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalBareMetalServerProfileNetworkInterfaceCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_trusted_platform_module_modes", &obj.SupportedTrustedPlatformModuleModes, UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interfaces_supported", &obj.VirtualNetworkInterfacesSupported, UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported) + if err != nil { + return + } + 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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + 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"` + + // 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 { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + 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 +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + 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"` + + // 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 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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct +type BareMetalServerProfileCollection struct { + // A link to the first page of resources. + First *BareMetalServerProfileCollectionFirst `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"` + + // Collection 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"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalBareMetalServerProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *BareMetalServerProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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"` +} + +// 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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"` +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + 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"` + + Size BareMetalServerProfileDiskSizeIntf `json:"size" validate:"required"` + + SupportedInterfaceTypes *BareMetalServerProfileDiskSupportedInterfaces `json:"supported_interface_types" 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalBareMetalServerProfileDiskSize) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalBareMetalServerProfileDiskSupportedInterfaces) + if err != nil { + 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"` + + // 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 BareMetalServerProfileDiskQuantity.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" +) + +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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + 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"` + + // 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 BareMetalServerProfileDiskSize.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { + return true +} + +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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct +type BareMetalServerProfileDiskSupportedInterfaces struct { + // The disk interface used for attaching the disk. + // + // - `fcp`: Attached using Fiber Channel Protocol + // - `sata`: Attached using Serial Advanced Technology Attachment + // - `nvme`: Attached using Non-Volatile Memory Express + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + 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"` +} + +// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. +// The disk interface used for attaching the disk. +// +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +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 interface used for attaching the disk. +// +// - `fcp`: Attached using Fiber Channel Protocol +// - `sata`: Attached using Serial Advanced Technology Attachment +// - `nvme`: Attached using Non-Volatile Memory Express +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +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 { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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"` +} + +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 { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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"` + + // 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 { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + 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"` + + // The type for this profile field. + Type *string `json:"type,omitempty"` +} + +// Constants associated with the BareMetalServerProfileNetworkAttachmentCount.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkAttachmentCountTypeRangeConst = "range" +) + +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 { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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 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 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 { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileReference : BareMetalServerProfileReference struct +type BareMetalServerProfileReference struct { + // The URL for this bare metal server profile. + Href *string `json:"href" 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"` +} + +// Constants associated with the BareMetalServerProfileReference.ResourceType property. +// The resource type. +const ( + BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileSupportedTrustedPlatformModuleModes : The supported trusted platform module modes for this bare metal server profile. +type BareMetalServerProfileSupportedTrustedPlatformModuleModes struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported trusted platform module modes. + Values []string `json:"values" validate:"required"` +} + +// 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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" +) + +// 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, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrototype : BareMetalServerPrototype struct +// Models which "extend" this model: +// - BareMetalServerPrototypeBareMetalServerByNetworkAttachment +// - BareMetalServerPrototypeBareMetalServerByNetworkInterface +type BareMetalServerPrototype struct { + // 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, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) + if err != nil { + 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. + 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 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. +const ( + BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" + BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" + BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" + BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" + BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" +) + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + 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 are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + 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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +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 { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) + if err != nil { + 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 { + return + } + 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`. + 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`. +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 { + return + } + 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 { + 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"` +} + +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 { + 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) + if err != nil { + 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) + if err != nil { + 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) + if err != nil { + 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 +} + +// 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 of this Cloud Object Storage bucket. + CRN *string `json:"crn,omitempty"` +} + +func (*CloudObjectStorageBucketIdentity) isaCloudObjectStorageBucketIdentity() bool { + return true +} + +type CloudObjectStorageBucketIdentityIntf interface { + isaCloudObjectStorageBucketIdentity() 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + 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) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CreateBackupPolicyOptions : The CreateBackupPolicy options. +type CreateBackupPolicyOptions struct { + // The backup policy prototype object. + BackupPolicyPrototype BackupPolicyPrototypeIntf `json:"BackupPolicyPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateBackupPolicyOptions : Instantiate CreateBackupPolicyOptions +func (*VpcV1) NewCreateBackupPolicyOptions(backupPolicyPrototype BackupPolicyPrototypeIntf) *CreateBackupPolicyOptions { + return &CreateBackupPolicyOptions{ + BackupPolicyPrototype: backupPolicyPrototype, + } +} + +// SetBackupPolicyPrototype : Allow user to set BackupPolicyPrototype +func (_options *CreateBackupPolicyOptions) SetBackupPolicyPrototype(backupPolicyPrototype BackupPolicyPrototypeIntf) *CreateBackupPolicyOptions { + _options.BackupPolicyPrototype = backupPolicyPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBackupPolicyOptions) SetHeaders(param map[string]string) *CreateBackupPolicyOptions { + options.Headers = param + return options +} + +// CreateBackupPolicyPlanOptions : The CreateBackupPolicyPlan options. +type CreateBackupPolicyPlanOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // 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"` + + // 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"` + + 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateBackupPolicyPlanOptions : Instantiate CreateBackupPolicyPlanOptions +func (*VpcV1) NewCreateBackupPolicyPlanOptions(backupPolicyID string, cronSpec string) *CreateBackupPolicyPlanOptions { + return &CreateBackupPolicyPlanOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + CronSpec: core.StringPtr(cronSpec), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *CreateBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *CreateBackupPolicyPlanOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetCronSpec : Allow user to set CronSpec +func (_options *CreateBackupPolicyPlanOptions) SetCronSpec(cronSpec string) *CreateBackupPolicyPlanOptions { + _options.CronSpec = core.StringPtr(cronSpec) + return _options +} + +// SetActive : Allow user to set Active +func (_options *CreateBackupPolicyPlanOptions) SetActive(active bool) *CreateBackupPolicyPlanOptions { + _options.Active = core.BoolPtr(active) + return _options +} + +// SetAttachUserTags : Allow user to set AttachUserTags +func (_options *CreateBackupPolicyPlanOptions) SetAttachUserTags(attachUserTags []string) *CreateBackupPolicyPlanOptions { + _options.AttachUserTags = attachUserTags + return _options +} + +// SetClonePolicy : Allow user to set ClonePolicy +func (_options *CreateBackupPolicyPlanOptions) SetClonePolicy(clonePolicy *BackupPolicyPlanClonePolicyPrototype) *CreateBackupPolicyPlanOptions { + _options.ClonePolicy = clonePolicy + return _options +} + +// SetCopyUserTags : Allow user to set CopyUserTags +func (_options *CreateBackupPolicyPlanOptions) SetCopyUserTags(copyUserTags bool) *CreateBackupPolicyPlanOptions { + _options.CopyUserTags = core.BoolPtr(copyUserTags) + return _options +} + +// SetDeletionTrigger : Allow user to set DeletionTrigger +func (_options *CreateBackupPolicyPlanOptions) SetDeletionTrigger(deletionTrigger *BackupPolicyPlanDeletionTriggerPrototype) *CreateBackupPolicyPlanOptions { + _options.DeletionTrigger = deletionTrigger + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateBackupPolicyPlanOptions) SetName(name string) *CreateBackupPolicyPlanOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetRemoteRegionPolicies : Allow user to set RemoteRegionPolicies +func (_options *CreateBackupPolicyPlanOptions) SetRemoteRegionPolicies(remoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype) *CreateBackupPolicyPlanOptions { + _options.RemoteRegionPolicies = remoteRegionPolicies + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *CreateBackupPolicyPlanOptions { + options.Headers = param + return options +} + +// CreateBareMetalServerConsoleAccessTokenOptions : The CreateBareMetalServerConsoleAccessToken options. +type CreateBareMetalServerConsoleAccessTokenOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server console type for which this token may be used + // + // Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`. + ConsoleType *string `json:"console_type" 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,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateBareMetalServerConsoleAccessTokenOptions.ConsoleType property. +// The bare metal server console type for which this token may be used +// +// Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`. +const ( + CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeSerialConst = "serial" + CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeVncConst = "vnc" +) + +// NewCreateBareMetalServerConsoleAccessTokenOptions : Instantiate CreateBareMetalServerConsoleAccessTokenOptions +func (*VpcV1) NewCreateBareMetalServerConsoleAccessTokenOptions(bareMetalServerID string, consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions { + return &CreateBareMetalServerConsoleAccessTokenOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ConsoleType: core.StringPtr(consoleType), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerConsoleAccessTokenOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetConsoleType : Allow user to set ConsoleType +func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetConsoleType(consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions { + _options.ConsoleType = core.StringPtr(consoleType) + return _options +} + +// SetForce : Allow user to set Force +func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetForce(force bool) *CreateBareMetalServerConsoleAccessTokenOptions { + _options.Force = core.BoolPtr(force) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerConsoleAccessTokenOptions) SetHeaders(param map[string]string) *CreateBareMetalServerConsoleAccessTokenOptions { + options.Headers = param + return options +} + +// CreateBareMetalServerNetworkAttachmentOptions : The CreateBareMetalServerNetworkAttachment options. +type CreateBareMetalServerNetworkAttachmentOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network attachment prototype object. + BareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf `json:"BareMetalServerNetworkAttachmentPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateBareMetalServerNetworkAttachmentOptions : Instantiate CreateBareMetalServerNetworkAttachmentOptions +func (*VpcV1) NewCreateBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, bareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf) *CreateBareMetalServerNetworkAttachmentOptions { + return &CreateBareMetalServerNetworkAttachmentOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + BareMetalServerNetworkAttachmentPrototype: bareMetalServerNetworkAttachmentPrototype, + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *CreateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetBareMetalServerNetworkAttachmentPrototype : Allow user to set BareMetalServerNetworkAttachmentPrototype +func (_options *CreateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerNetworkAttachmentPrototype(bareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf) *CreateBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkAttachmentOptions { + options.Headers = param + return options +} + +// CreateBareMetalServerNetworkInterfaceOptions : The CreateBareMetalServerNetworkInterface options. +type CreateBareMetalServerNetworkInterfaceOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network interface prototype object. + BareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf `json:"BareMetalServerNetworkInterfacePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateBareMetalServerNetworkInterfaceOptions : Instantiate CreateBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewCreateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { + return &CreateBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + BareMetalServerNetworkInterfacePrototype: bareMetalServerNetworkInterfacePrototype, + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetBareMetalServerNetworkInterfacePrototype : Allow user to set BareMetalServerNetworkInterfacePrototype +func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePrototype(bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options +} + +// CreateBareMetalServerOptions : The CreateBareMetalServer options. +type CreateBareMetalServerOptions struct { + // The bare metal server prototype object. + BareMetalServerPrototype BareMetalServerPrototypeIntf `json:"BareMetalServerPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateBareMetalServerOptions : Instantiate CreateBareMetalServerOptions +func (*VpcV1) NewCreateBareMetalServerOptions(bareMetalServerPrototype BareMetalServerPrototypeIntf) *CreateBareMetalServerOptions { + return &CreateBareMetalServerOptions{ + BareMetalServerPrototype: bareMetalServerPrototype, + } +} + +// SetBareMetalServerPrototype : Allow user to set BareMetalServerPrototype +func (_options *CreateBareMetalServerOptions) SetBareMetalServerPrototype(bareMetalServerPrototype BareMetalServerPrototypeIntf) *CreateBareMetalServerOptions { + _options.BareMetalServerPrototype = bareMetalServerPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateBareMetalServerOptions) SetHeaders(param map[string]string) *CreateBareMetalServerOptions { + options.Headers = param + return options +} + +// CreateDedicatedHostGroupOptions : The CreateDedicatedHostGroup options. +type CreateDedicatedHostGroupOptions struct { + // The dedicated host profile class for hosts in this group. + Class *string `json:"class" validate:"required"` + + // The dedicated host profile family for hosts in this group. + Family *string `json:"family" validate:"required"` + + // The zone this dedicated host group will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateDedicatedHostGroupOptions.Family property. +// The dedicated host profile family for hosts in this group. +const ( + CreateDedicatedHostGroupOptionsFamilyBalancedConst = "balanced" + CreateDedicatedHostGroupOptionsFamilyComputeConst = "compute" + CreateDedicatedHostGroupOptionsFamilyMemoryConst = "memory" +) + +// NewCreateDedicatedHostGroupOptions : Instantiate CreateDedicatedHostGroupOptions +func (*VpcV1) NewCreateDedicatedHostGroupOptions(class string, family string, zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions { + return &CreateDedicatedHostGroupOptions{ + Class: core.StringPtr(class), + Family: core.StringPtr(family), + Zone: zone, + } +} + +// SetClass : Allow user to set Class +func (_options *CreateDedicatedHostGroupOptions) SetClass(class string) *CreateDedicatedHostGroupOptions { + _options.Class = core.StringPtr(class) + return _options +} + +// SetFamily : Allow user to set Family +func (_options *CreateDedicatedHostGroupOptions) SetFamily(family string) *CreateDedicatedHostGroupOptions { + _options.Family = core.StringPtr(family) + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateDedicatedHostGroupOptions) SetZone(zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions { + _options.Zone = zone + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateDedicatedHostGroupOptions) SetName(name string) *CreateDedicatedHostGroupOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateDedicatedHostGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateDedicatedHostGroupOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateDedicatedHostGroupOptions) SetHeaders(param map[string]string) *CreateDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// CreateDedicatedHostOptions : The CreateDedicatedHost options. +type CreateDedicatedHostOptions struct { + // The dedicated host prototype object. + DedicatedHostPrototype DedicatedHostPrototypeIntf `json:"DedicatedHostPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateDedicatedHostOptions : Instantiate CreateDedicatedHostOptions +func (*VpcV1) NewCreateDedicatedHostOptions(dedicatedHostPrototype DedicatedHostPrototypeIntf) *CreateDedicatedHostOptions { + return &CreateDedicatedHostOptions{ + DedicatedHostPrototype: dedicatedHostPrototype, + } +} + +// SetDedicatedHostPrototype : Allow user to set DedicatedHostPrototype +func (_options *CreateDedicatedHostOptions) SetDedicatedHostPrototype(dedicatedHostPrototype DedicatedHostPrototypeIntf) *CreateDedicatedHostOptions { + _options.DedicatedHostPrototype = dedicatedHostPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateDedicatedHostOptions) SetHeaders(param map[string]string) *CreateDedicatedHostOptions { + options.Headers = param + return options +} + +// CreateEndpointGatewayOptions : The CreateEndpointGateway options. +type CreateEndpointGatewayOptions struct { + // The target to use for this endpoint gateway. Must not already be the target of another + // endpoint gateway in the VPC. + Target EndpointGatewayTargetPrototypeIntf `json:"target" validate:"required"` + + // The VPC this endpoint gateway will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in + // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. + // + // Must be `true` if the VPC this endpoint gateway resides in has `dns.enable_hub` set to + // `true`. + AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` + + // The reserved IPs to bind to this endpoint gateway. At most one reserved IP per zone is allowed. + Ips []EndpointGatewayReservedIPIntf `json:"ips,omitempty"` + + // The name for this endpoint gateway. The name must not be used by another endpoint gateway in the VPC. 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"` + + // 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 + Headers map[string]string +} + +// NewCreateEndpointGatewayOptions : Instantiate CreateEndpointGatewayOptions +func (*VpcV1) NewCreateEndpointGatewayOptions(target EndpointGatewayTargetPrototypeIntf, vpc VPCIdentityIntf) *CreateEndpointGatewayOptions { + return &CreateEndpointGatewayOptions{ + Target: target, + VPC: vpc, + } +} + +// SetTarget : Allow user to set Target +func (_options *CreateEndpointGatewayOptions) SetTarget(target EndpointGatewayTargetPrototypeIntf) *CreateEndpointGatewayOptions { + _options.Target = target + return _options +} + +// SetVPC : Allow user to set VPC +func (_options *CreateEndpointGatewayOptions) SetVPC(vpc VPCIdentityIntf) *CreateEndpointGatewayOptions { + _options.VPC = vpc + return _options +} + +// SetAllowDnsResolutionBinding : Allow user to set AllowDnsResolutionBinding +func (_options *CreateEndpointGatewayOptions) SetAllowDnsResolutionBinding(allowDnsResolutionBinding bool) *CreateEndpointGatewayOptions { + _options.AllowDnsResolutionBinding = core.BoolPtr(allowDnsResolutionBinding) + return _options +} + +// SetIps : Allow user to set Ips +func (_options *CreateEndpointGatewayOptions) SetIps(ips []EndpointGatewayReservedIPIntf) *CreateEndpointGatewayOptions { + _options.Ips = ips + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateEndpointGatewayOptions) SetName(name string) *CreateEndpointGatewayOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateEndpointGatewayOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateEndpointGatewayOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateEndpointGatewayOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateEndpointGatewayOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateEndpointGatewayOptions) SetHeaders(param map[string]string) *CreateEndpointGatewayOptions { + options.Headers = param + return options +} + +// CreateFloatingIPOptions : The CreateFloatingIP options. +type CreateFloatingIPOptions struct { + // The floating IP prototype object. + FloatingIPPrototype FloatingIPPrototypeIntf `json:"FloatingIPPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateFloatingIPOptions : Instantiate CreateFloatingIPOptions +func (*VpcV1) NewCreateFloatingIPOptions(floatingIPPrototype FloatingIPPrototypeIntf) *CreateFloatingIPOptions { + return &CreateFloatingIPOptions{ + FloatingIPPrototype: floatingIPPrototype, + } +} + +// SetFloatingIPPrototype : Allow user to set FloatingIPPrototype +func (_options *CreateFloatingIPOptions) SetFloatingIPPrototype(floatingIPPrototype FloatingIPPrototypeIntf) *CreateFloatingIPOptions { + _options.FloatingIPPrototype = floatingIPPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateFloatingIPOptions) SetHeaders(param map[string]string) *CreateFloatingIPOptions { + options.Headers = param + return options +} + +// CreateFlowLogCollectorOptions : The CreateFlowLogCollector options. +type CreateFlowLogCollectorOptions struct { + // The Cloud Object Storage bucket where the collected flows will be logged. + // The bucket must exist and an IAM service authorization must grant + // `IBM Cloud Flow Logs` resources of `VPC Infrastructure Services` writer + // access to the bucket. For more information, see [Creating a flow log + // collector](https://cloud.ibm.com/docs/vpc?topic=vpc-ordering-flow-log-collector). + StorageBucket LegacyCloudObjectStorageBucketIdentityIntf `json:"storage_bucket" validate:"required"` + + // The target this collector will collect flow logs for. + // + // If the target is an instance, subnet, or VPC, flow logs will not be collected for any + // instance network attachments, virtual network interfaces or instance network interfaces + // within the target that are themselves the target of a more specific flow log collector. + // + // The target must not be a virtual network interface that is attached to a bare metal server + // network attachment or to a file share mount target. + Target FlowLogCollectorTargetPrototypeIntf `json:"target" validate:"required"` + + // Indicates whether this collector will be active upon creation. + Active *bool `json:"active,omitempty"` + + // The name for this flow log collector. The name must not be used by another flow log collector in the VPC. 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateFlowLogCollectorOptions : Instantiate CreateFlowLogCollectorOptions +func (*VpcV1) NewCreateFlowLogCollectorOptions(storageBucket LegacyCloudObjectStorageBucketIdentityIntf, target FlowLogCollectorTargetPrototypeIntf) *CreateFlowLogCollectorOptions { + return &CreateFlowLogCollectorOptions{ + StorageBucket: storageBucket, + Target: target, + } +} + +// SetStorageBucket : Allow user to set StorageBucket +func (_options *CreateFlowLogCollectorOptions) SetStorageBucket(storageBucket LegacyCloudObjectStorageBucketIdentityIntf) *CreateFlowLogCollectorOptions { + _options.StorageBucket = storageBucket + return _options +} + +// SetTarget : Allow user to set Target +func (_options *CreateFlowLogCollectorOptions) SetTarget(target FlowLogCollectorTargetPrototypeIntf) *CreateFlowLogCollectorOptions { + _options.Target = target + return _options +} + +// SetActive : Allow user to set Active +func (_options *CreateFlowLogCollectorOptions) SetActive(active bool) *CreateFlowLogCollectorOptions { + _options.Active = core.BoolPtr(active) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateFlowLogCollectorOptions) SetName(name string) *CreateFlowLogCollectorOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateFlowLogCollectorOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateFlowLogCollectorOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateFlowLogCollectorOptions) SetHeaders(param map[string]string) *CreateFlowLogCollectorOptions { + options.Headers = param + return options +} + +// CreateIkePolicyOptions : The CreateIkePolicy options. +type CreateIkePolicyOptions struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` + + // The Diffie-Hellman group. + DhGroup *int64 `json:"dh_group" validate:"required"` + + // The encryption algorithm. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // The IKE protocol version. + IkeVersion *int64 `json:"ike_version" validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime,omitempty"` + + // The name for this IKE policy. The name must not be used by another IKE policies in the region. 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateIkePolicyOptions.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + CreateIkePolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" + CreateIkePolicyOptionsAuthenticationAlgorithmSha384Const = "sha384" + CreateIkePolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the CreateIkePolicyOptions.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + CreateIkePolicyOptionsEncryptionAlgorithmAes128Const = "aes128" + CreateIkePolicyOptionsEncryptionAlgorithmAes192Const = "aes192" + CreateIkePolicyOptionsEncryptionAlgorithmAes256Const = "aes256" +) + +// NewCreateIkePolicyOptions : Instantiate CreateIkePolicyOptions +func (*VpcV1) NewCreateIkePolicyOptions(authenticationAlgorithm string, dhGroup int64, encryptionAlgorithm string, ikeVersion int64) *CreateIkePolicyOptions { + return &CreateIkePolicyOptions{ + AuthenticationAlgorithm: core.StringPtr(authenticationAlgorithm), + DhGroup: core.Int64Ptr(dhGroup), + EncryptionAlgorithm: core.StringPtr(encryptionAlgorithm), + IkeVersion: core.Int64Ptr(ikeVersion), + } +} + +// SetAuthenticationAlgorithm : Allow user to set AuthenticationAlgorithm +func (_options *CreateIkePolicyOptions) SetAuthenticationAlgorithm(authenticationAlgorithm string) *CreateIkePolicyOptions { + _options.AuthenticationAlgorithm = core.StringPtr(authenticationAlgorithm) + return _options +} + +// SetDhGroup : Allow user to set DhGroup +func (_options *CreateIkePolicyOptions) SetDhGroup(dhGroup int64) *CreateIkePolicyOptions { + _options.DhGroup = core.Int64Ptr(dhGroup) + return _options +} + +// SetEncryptionAlgorithm : Allow user to set EncryptionAlgorithm +func (_options *CreateIkePolicyOptions) SetEncryptionAlgorithm(encryptionAlgorithm string) *CreateIkePolicyOptions { + _options.EncryptionAlgorithm = core.StringPtr(encryptionAlgorithm) + return _options +} + +// SetIkeVersion : Allow user to set IkeVersion +func (_options *CreateIkePolicyOptions) SetIkeVersion(ikeVersion int64) *CreateIkePolicyOptions { + _options.IkeVersion = core.Int64Ptr(ikeVersion) + return _options +} + +// SetKeyLifetime : Allow user to set KeyLifetime +func (_options *CreateIkePolicyOptions) SetKeyLifetime(keyLifetime int64) *CreateIkePolicyOptions { + _options.KeyLifetime = core.Int64Ptr(keyLifetime) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateIkePolicyOptions) SetName(name string) *CreateIkePolicyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateIkePolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateIkePolicyOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateIkePolicyOptions) SetHeaders(param map[string]string) *CreateIkePolicyOptions { + options.Headers = param + return options +} + +// CreateImageExportJobOptions : The CreateImageExportJob options. +type CreateImageExportJobOptions struct { + // The image identifier. + ImageID *string `json:"image_id" validate:"required,ne="` + + // The Cloud Object Storage bucket to export the image to. The bucket must exist and an IAM + // service authorization must grant `Image Service for VPC` of + // `VPC Infrastructure Services` writer access to the bucket. + StorageBucket CloudObjectStorageBucketIdentityIntf `json:"storage_bucket" validate:"required"` + + // The format to use for the exported image. If the image is encrypted, only `qcow2` is supported. + Format *string `json:"format,omitempty"` + + // The name for this image export job. The name must not be used by another export job for the image. If unspecified, + // the name will be a hyphenated list of randomly-selected words prefixed with the first 16 characters of the parent + // image name. + // + // The exported image object name in Cloud Object Storage (`storage_object.name` in the response) will be based on this + // name. The object name will be unique within the bucket. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateImageExportJobOptions.Format property. +// The format to use for the exported image. If the image is encrypted, only `qcow2` is supported. +const ( + CreateImageExportJobOptionsFormatQcow2Const = "qcow2" + CreateImageExportJobOptionsFormatVhdConst = "vhd" +) + +// NewCreateImageExportJobOptions : Instantiate CreateImageExportJobOptions +func (*VpcV1) NewCreateImageExportJobOptions(imageID string, storageBucket CloudObjectStorageBucketIdentityIntf) *CreateImageExportJobOptions { + return &CreateImageExportJobOptions{ + ImageID: core.StringPtr(imageID), + StorageBucket: storageBucket, + } +} + +// SetImageID : Allow user to set ImageID +func (_options *CreateImageExportJobOptions) SetImageID(imageID string) *CreateImageExportJobOptions { + _options.ImageID = core.StringPtr(imageID) + return _options +} + +// SetStorageBucket : Allow user to set StorageBucket +func (_options *CreateImageExportJobOptions) SetStorageBucket(storageBucket CloudObjectStorageBucketIdentityIntf) *CreateImageExportJobOptions { + _options.StorageBucket = storageBucket + return _options +} + +// SetFormat : Allow user to set Format +func (_options *CreateImageExportJobOptions) SetFormat(format string) *CreateImageExportJobOptions { + _options.Format = core.StringPtr(format) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateImageExportJobOptions) SetName(name string) *CreateImageExportJobOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateImageExportJobOptions) SetHeaders(param map[string]string) *CreateImageExportJobOptions { + options.Headers = param + return options +} + +// CreateImageOptions : The CreateImage options. +type CreateImageOptions struct { + // The image prototype object. + ImagePrototype ImagePrototypeIntf `json:"ImagePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateImageOptions : Instantiate CreateImageOptions +func (*VpcV1) NewCreateImageOptions(imagePrototype ImagePrototypeIntf) *CreateImageOptions { + return &CreateImageOptions{ + ImagePrototype: imagePrototype, + } +} + +// SetImagePrototype : Allow user to set ImagePrototype +func (_options *CreateImageOptions) SetImagePrototype(imagePrototype ImagePrototypeIntf) *CreateImageOptions { + _options.ImagePrototype = imagePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateImageOptions) SetHeaders(param map[string]string) *CreateImageOptions { + options.Headers = param + return options +} + +// CreateInstanceActionOptions : The CreateInstanceAction options. +type CreateInstanceActionOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The type of action. + Type *string `json:"type" validate:"required"` + + // 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 + Headers map[string]string +} + +// Constants associated with the CreateInstanceActionOptions.Type property. +// The type of action. +const ( + CreateInstanceActionOptionsTypeRebootConst = "reboot" + CreateInstanceActionOptionsTypeStartConst = "start" + CreateInstanceActionOptionsTypeStopConst = "stop" +) + +// NewCreateInstanceActionOptions : Instantiate CreateInstanceActionOptions +func (*VpcV1) NewCreateInstanceActionOptions(instanceID string, typeVar string) *CreateInstanceActionOptions { + return &CreateInstanceActionOptions{ + InstanceID: core.StringPtr(instanceID), + Type: core.StringPtr(typeVar), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *CreateInstanceActionOptions) SetInstanceID(instanceID string) *CreateInstanceActionOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetType : Allow user to set Type +func (_options *CreateInstanceActionOptions) SetType(typeVar string) *CreateInstanceActionOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetForce : Allow user to set Force +func (_options *CreateInstanceActionOptions) SetForce(force bool) *CreateInstanceActionOptions { + _options.Force = core.BoolPtr(force) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceActionOptions) SetHeaders(param map[string]string) *CreateInstanceActionOptions { + options.Headers = param + return options +} + +// CreateInstanceConsoleAccessTokenOptions : The CreateInstanceConsoleAccessToken options. +type CreateInstanceConsoleAccessTokenOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance console type for which this token may be used. + ConsoleType *string `json:"console_type" 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,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateInstanceConsoleAccessTokenOptions.ConsoleType property. +// The instance console type for which this token may be used. +const ( + CreateInstanceConsoleAccessTokenOptionsConsoleTypeSerialConst = "serial" + CreateInstanceConsoleAccessTokenOptionsConsoleTypeVncConst = "vnc" +) + +// NewCreateInstanceConsoleAccessTokenOptions : Instantiate CreateInstanceConsoleAccessTokenOptions +func (*VpcV1) NewCreateInstanceConsoleAccessTokenOptions(instanceID string, consoleType string) *CreateInstanceConsoleAccessTokenOptions { + return &CreateInstanceConsoleAccessTokenOptions{ + InstanceID: core.StringPtr(instanceID), + ConsoleType: core.StringPtr(consoleType), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *CreateInstanceConsoleAccessTokenOptions) SetInstanceID(instanceID string) *CreateInstanceConsoleAccessTokenOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetConsoleType : Allow user to set ConsoleType +func (_options *CreateInstanceConsoleAccessTokenOptions) SetConsoleType(consoleType string) *CreateInstanceConsoleAccessTokenOptions { + _options.ConsoleType = core.StringPtr(consoleType) + return _options +} + +// SetForce : Allow user to set Force +func (_options *CreateInstanceConsoleAccessTokenOptions) SetForce(force bool) *CreateInstanceConsoleAccessTokenOptions { + _options.Force = core.BoolPtr(force) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceConsoleAccessTokenOptions) SetHeaders(param map[string]string) *CreateInstanceConsoleAccessTokenOptions { + options.Headers = param + return options +} + +// CreateInstanceGroupManagerActionOptions : The CreateInstanceGroupManagerAction options. +type CreateInstanceGroupManagerActionOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager action prototype object. + InstanceGroupManagerActionPrototype InstanceGroupManagerActionPrototypeIntf `json:"InstanceGroupManagerActionPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceGroupManagerActionOptions : Instantiate CreateInstanceGroupManagerActionOptions +func (*VpcV1) NewCreateInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, instanceGroupManagerActionPrototype InstanceGroupManagerActionPrototypeIntf) *CreateInstanceGroupManagerActionOptions { + return &CreateInstanceGroupManagerActionOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + InstanceGroupManagerActionPrototype: instanceGroupManagerActionPrototype, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *CreateInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *CreateInstanceGroupManagerActionOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *CreateInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *CreateInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetInstanceGroupManagerActionPrototype : Allow user to set InstanceGroupManagerActionPrototype +func (_options *CreateInstanceGroupManagerActionOptions) SetInstanceGroupManagerActionPrototype(instanceGroupManagerActionPrototype InstanceGroupManagerActionPrototypeIntf) *CreateInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *CreateInstanceGroupManagerActionOptions { + options.Headers = param + return options +} + +// CreateInstanceGroupManagerOptions : The CreateInstanceGroupManager options. +type CreateInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager prototype object. + InstanceGroupManagerPrototype InstanceGroupManagerPrototypeIntf `json:"InstanceGroupManagerPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceGroupManagerOptions : Instantiate CreateInstanceGroupManagerOptions +func (*VpcV1) NewCreateInstanceGroupManagerOptions(instanceGroupID string, instanceGroupManagerPrototype InstanceGroupManagerPrototypeIntf) *CreateInstanceGroupManagerOptions { + return &CreateInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerPrototype: instanceGroupManagerPrototype, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *CreateInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *CreateInstanceGroupManagerOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerPrototype : Allow user to set InstanceGroupManagerPrototype +func (_options *CreateInstanceGroupManagerOptions) SetInstanceGroupManagerPrototype(instanceGroupManagerPrototype InstanceGroupManagerPrototypeIntf) *CreateInstanceGroupManagerOptions { + _options.InstanceGroupManagerPrototype = instanceGroupManagerPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceGroupManagerOptions) SetHeaders(param map[string]string) *CreateInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// CreateInstanceGroupManagerPolicyOptions : The CreateInstanceGroupManagerPolicy options. +type CreateInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager policy prototype object. + InstanceGroupManagerPolicyPrototype InstanceGroupManagerPolicyPrototypeIntf `json:"InstanceGroupManagerPolicyPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceGroupManagerPolicyOptions : Instantiate CreateInstanceGroupManagerPolicyOptions +func (*VpcV1) NewCreateInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, instanceGroupManagerPolicyPrototype InstanceGroupManagerPolicyPrototypeIntf) *CreateInstanceGroupManagerPolicyOptions { + return &CreateInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + InstanceGroupManagerPolicyPrototype: instanceGroupManagerPolicyPrototype, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *CreateInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *CreateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *CreateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *CreateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetInstanceGroupManagerPolicyPrototype : Allow user to set InstanceGroupManagerPolicyPrototype +func (_options *CreateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerPolicyPrototype(instanceGroupManagerPolicyPrototype InstanceGroupManagerPolicyPrototypeIntf) *CreateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *CreateInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// CreateInstanceGroupOptions : The CreateInstanceGroup options. +type CreateInstanceGroupOptions struct { + // Instance template to use when creating new instances. + // + // Instance groups are not compatible with instance templates that specify `true` for + // `default_trusted_profile.auto_link`. + InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template" validate:"required"` + + // The subnets to use when creating new instances. + Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` + + // The port to use for new load balancer pool members created by this instance group. The load balancer pool member + // will receive load balancer traffic on this port, unless the load balancer listener is using a port range. (Traffic + // received on a listener using a port range will be sent to members using the same port the listener received it on.) + // + // This port will also be used for health checks unless the port property of + // `health_monitor` property is specified. + // + // This property must be specified if and only if `load_balancer_pool` has been specified. + ApplicationPort *int64 `json:"application_port,omitempty"` + + // The load balancer associated with the specified load balancer pool. + // Required if `load_balancer_pool` is specified. The load balancer must have + // `instance_groups_supported` set to `true`. + LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` + + // If specified, this instance group will manage the load balancer pool. A pool member + // will be created for each instance created by this group. The specified load + // balancer pool must not be used by another instance group in the VPC. + // + // If specified, `load_balancer` and `application_port` must also be specified. + LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"` + + // The number of instances in the instance group. + MembershipCount *int64 `json:"membership_count,omitempty"` + + // The name for this instance group. The name must not be used by another instance group in the region. 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceGroupOptions : Instantiate CreateInstanceGroupOptions +func (*VpcV1) NewCreateInstanceGroupOptions(instanceTemplate InstanceTemplateIdentityIntf, subnets []SubnetIdentityIntf) *CreateInstanceGroupOptions { + return &CreateInstanceGroupOptions{ + InstanceTemplate: instanceTemplate, + Subnets: subnets, + } +} + +// SetInstanceTemplate : Allow user to set InstanceTemplate +func (_options *CreateInstanceGroupOptions) SetInstanceTemplate(instanceTemplate InstanceTemplateIdentityIntf) *CreateInstanceGroupOptions { + _options.InstanceTemplate = instanceTemplate + return _options +} + +// SetSubnets : Allow user to set Subnets +func (_options *CreateInstanceGroupOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateInstanceGroupOptions { + _options.Subnets = subnets + return _options +} + +// SetApplicationPort : Allow user to set ApplicationPort +func (_options *CreateInstanceGroupOptions) SetApplicationPort(applicationPort int64) *CreateInstanceGroupOptions { + _options.ApplicationPort = core.Int64Ptr(applicationPort) + return _options +} + +// SetLoadBalancer : Allow user to set LoadBalancer +func (_options *CreateInstanceGroupOptions) SetLoadBalancer(loadBalancer LoadBalancerIdentityIntf) *CreateInstanceGroupOptions { + _options.LoadBalancer = loadBalancer + return _options +} + +// SetLoadBalancerPool : Allow user to set LoadBalancerPool +func (_options *CreateInstanceGroupOptions) SetLoadBalancerPool(loadBalancerPool LoadBalancerPoolIdentityIntf) *CreateInstanceGroupOptions { + _options.LoadBalancerPool = loadBalancerPool + return _options +} + +// SetMembershipCount : Allow user to set MembershipCount +func (_options *CreateInstanceGroupOptions) SetMembershipCount(membershipCount int64) *CreateInstanceGroupOptions { + _options.MembershipCount = core.Int64Ptr(membershipCount) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateInstanceGroupOptions) SetName(name string) *CreateInstanceGroupOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateInstanceGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateInstanceGroupOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceGroupOptions) SetHeaders(param map[string]string) *CreateInstanceGroupOptions { + options.Headers = param + return options +} + +// CreateInstanceNetworkAttachmentOptions : The CreateInstanceNetworkAttachment options. +type CreateInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // A virtual network interface for the instance 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, `enable_infrastructure_nat` must be + // `true`. + VirtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` + + // The name for this network attachment. Names must be unique within the instance the network attachment resides in. 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 +} + +// NewCreateInstanceNetworkAttachmentOptions : Instantiate CreateInstanceNetworkAttachmentOptions +func (*VpcV1) NewCreateInstanceNetworkAttachmentOptions(instanceID string, virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) *CreateInstanceNetworkAttachmentOptions { + return &CreateInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + VirtualNetworkInterface: virtualNetworkInterface, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *CreateInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *CreateInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetVirtualNetworkInterface : Allow user to set VirtualNetworkInterface +func (_options *CreateInstanceNetworkAttachmentOptions) SetVirtualNetworkInterface(virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) *CreateInstanceNetworkAttachmentOptions { + _options.VirtualNetworkInterface = virtualNetworkInterface + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateInstanceNetworkAttachmentOptions) SetName(name string) *CreateInstanceNetworkAttachmentOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *CreateInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + +// CreateInstanceNetworkInterfaceOptions : The CreateInstanceNetworkInterface options. +type CreateInstanceNetworkInterfaceOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Indicates whether source IP spoofing is allowed on this instance network interface. + // + // If this instance 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 name for the instance network interface. The name must not be used by another network interface on the virtual + // server instance. 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 instance 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 instance 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 instance network interface. If unspecified, the VPC's default security group is + // used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceNetworkInterfaceOptions : Instantiate CreateInstanceNetworkInterfaceOptions +func (*VpcV1) NewCreateInstanceNetworkInterfaceOptions(instanceID string, subnet SubnetIdentityIntf) *CreateInstanceNetworkInterfaceOptions { + return &CreateInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + Subnet: subnet, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *CreateInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *CreateInstanceNetworkInterfaceOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetSubnet : Allow user to set Subnet +func (_options *CreateInstanceNetworkInterfaceOptions) SetSubnet(subnet SubnetIdentityIntf) *CreateInstanceNetworkInterfaceOptions { + _options.Subnet = subnet + return _options +} + +// SetAllowIPSpoofing : Allow user to set AllowIPSpoofing +func (_options *CreateInstanceNetworkInterfaceOptions) SetAllowIPSpoofing(allowIPSpoofing bool) *CreateInstanceNetworkInterfaceOptions { + _options.AllowIPSpoofing = core.BoolPtr(allowIPSpoofing) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateInstanceNetworkInterfaceOptions) SetName(name string) *CreateInstanceNetworkInterfaceOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPrimaryIP : Allow user to set PrimaryIP +func (_options *CreateInstanceNetworkInterfaceOptions) SetPrimaryIP(primaryIP NetworkInterfaceIPPrototypeIntf) *CreateInstanceNetworkInterfaceOptions { + _options.PrimaryIP = primaryIP + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateInstanceNetworkInterfaceOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateInstanceNetworkInterfaceOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// CreateInstanceOptions : The CreateInstance options. +type CreateInstanceOptions struct { + // The instance prototype object. + InstancePrototype InstancePrototypeIntf `json:"InstancePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceOptions : Instantiate CreateInstanceOptions +func (*VpcV1) NewCreateInstanceOptions(instancePrototype InstancePrototypeIntf) *CreateInstanceOptions { + return &CreateInstanceOptions{ + InstancePrototype: instancePrototype, + } +} + +// SetInstancePrototype : Allow user to set InstancePrototype +func (_options *CreateInstanceOptions) SetInstancePrototype(instancePrototype InstancePrototypeIntf) *CreateInstanceOptions { + _options.InstancePrototype = instancePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceOptions) SetHeaders(param map[string]string) *CreateInstanceOptions { + options.Headers = param + return options +} + +// CreateInstanceTemplateOptions : The CreateInstanceTemplate options. +type CreateInstanceTemplateOptions struct { + // The instance template prototype object. + InstanceTemplatePrototype InstanceTemplatePrototypeIntf `json:"InstanceTemplatePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceTemplateOptions : Instantiate CreateInstanceTemplateOptions +func (*VpcV1) NewCreateInstanceTemplateOptions(instanceTemplatePrototype InstanceTemplatePrototypeIntf) *CreateInstanceTemplateOptions { + return &CreateInstanceTemplateOptions{ + InstanceTemplatePrototype: instanceTemplatePrototype, + } +} + +// SetInstanceTemplatePrototype : Allow user to set InstanceTemplatePrototype +func (_options *CreateInstanceTemplateOptions) SetInstanceTemplatePrototype(instanceTemplatePrototype InstanceTemplatePrototypeIntf) *CreateInstanceTemplateOptions { + _options.InstanceTemplatePrototype = instanceTemplatePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceTemplateOptions) SetHeaders(param map[string]string) *CreateInstanceTemplateOptions { + options.Headers = param + return options +} + +// CreateInstanceVolumeAttachmentOptions : The CreateInstanceVolumeAttachment options. +type CreateInstanceVolumeAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // An existing volume to attach to the instance, or a prototype object for a new volume. + Volume VolumeAttachmentPrototypeVolumeIntf `json:"volume" validate:"required"` + + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. 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 +} + +// NewCreateInstanceVolumeAttachmentOptions : Instantiate CreateInstanceVolumeAttachmentOptions +func (*VpcV1) NewCreateInstanceVolumeAttachmentOptions(instanceID string, volume VolumeAttachmentPrototypeVolumeIntf) *CreateInstanceVolumeAttachmentOptions { + return &CreateInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + Volume: volume, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *CreateInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *CreateInstanceVolumeAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetVolume : Allow user to set Volume +func (_options *CreateInstanceVolumeAttachmentOptions) SetVolume(volume VolumeAttachmentPrototypeVolumeIntf) *CreateInstanceVolumeAttachmentOptions { + _options.Volume = volume + return _options +} + +// SetDeleteVolumeOnInstanceDelete : Allow user to set DeleteVolumeOnInstanceDelete +func (_options *CreateInstanceVolumeAttachmentOptions) SetDeleteVolumeOnInstanceDelete(deleteVolumeOnInstanceDelete bool) *CreateInstanceVolumeAttachmentOptions { + _options.DeleteVolumeOnInstanceDelete = core.BoolPtr(deleteVolumeOnInstanceDelete) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateInstanceVolumeAttachmentOptions) SetName(name string) *CreateInstanceVolumeAttachmentOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *CreateInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// CreateIpsecPolicyOptions : The CreateIpsecPolicy options. +type CreateIpsecPolicyOptions struct { + // The authentication algorithm + // + // Must be `disabled` if and only if the `encryption_algorithm` is + // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. + AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` + + // The encryption algorithm + // + // The `authentication_algorithm` must be `disabled` if and only if + // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or + // `aes256gcm16`. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // Perfect Forward Secrecy. + Pfs *string `json:"pfs" validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime,omitempty"` + + // The name for this IPsec policy. The name must not be used by another IPsec policies in the region. 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateIpsecPolicyOptions.AuthenticationAlgorithm property. +// The authentication algorithm +// +// Must be `disabled` if and only if the `encryption_algorithm` is +// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. +const ( + CreateIpsecPolicyOptionsAuthenticationAlgorithmDisabledConst = "disabled" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha384Const = "sha384" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the CreateIpsecPolicyOptions.EncryptionAlgorithm property. +// The encryption algorithm +// +// The `authentication_algorithm` must be `disabled` if and only if +// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or +// `aes256gcm16`. +const ( + CreateIpsecPolicyOptionsEncryptionAlgorithmAes128Const = "aes128" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes192Const = "aes192" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes256Const = "aes256" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" +) + +// Constants associated with the CreateIpsecPolicyOptions.Pfs property. +// Perfect Forward Secrecy. +const ( + CreateIpsecPolicyOptionsPfsDisabledConst = "disabled" + CreateIpsecPolicyOptionsPfsGroup14Const = "group_14" + CreateIpsecPolicyOptionsPfsGroup15Const = "group_15" + CreateIpsecPolicyOptionsPfsGroup16Const = "group_16" + CreateIpsecPolicyOptionsPfsGroup17Const = "group_17" + CreateIpsecPolicyOptionsPfsGroup18Const = "group_18" + CreateIpsecPolicyOptionsPfsGroup19Const = "group_19" + CreateIpsecPolicyOptionsPfsGroup20Const = "group_20" + CreateIpsecPolicyOptionsPfsGroup21Const = "group_21" + CreateIpsecPolicyOptionsPfsGroup22Const = "group_22" + CreateIpsecPolicyOptionsPfsGroup23Const = "group_23" + CreateIpsecPolicyOptionsPfsGroup24Const = "group_24" + CreateIpsecPolicyOptionsPfsGroup31Const = "group_31" +) + +// NewCreateIpsecPolicyOptions : Instantiate CreateIpsecPolicyOptions +func (*VpcV1) NewCreateIpsecPolicyOptions(authenticationAlgorithm string, encryptionAlgorithm string, pfs string) *CreateIpsecPolicyOptions { + return &CreateIpsecPolicyOptions{ + AuthenticationAlgorithm: core.StringPtr(authenticationAlgorithm), + EncryptionAlgorithm: core.StringPtr(encryptionAlgorithm), + Pfs: core.StringPtr(pfs), + } +} + +// SetAuthenticationAlgorithm : Allow user to set AuthenticationAlgorithm +func (_options *CreateIpsecPolicyOptions) SetAuthenticationAlgorithm(authenticationAlgorithm string) *CreateIpsecPolicyOptions { + _options.AuthenticationAlgorithm = core.StringPtr(authenticationAlgorithm) + return _options +} + +// SetEncryptionAlgorithm : Allow user to set EncryptionAlgorithm +func (_options *CreateIpsecPolicyOptions) SetEncryptionAlgorithm(encryptionAlgorithm string) *CreateIpsecPolicyOptions { + _options.EncryptionAlgorithm = core.StringPtr(encryptionAlgorithm) + return _options +} + +// SetPfs : Allow user to set Pfs +func (_options *CreateIpsecPolicyOptions) SetPfs(pfs string) *CreateIpsecPolicyOptions { + _options.Pfs = core.StringPtr(pfs) + return _options +} + +// SetKeyLifetime : Allow user to set KeyLifetime +func (_options *CreateIpsecPolicyOptions) SetKeyLifetime(keyLifetime int64) *CreateIpsecPolicyOptions { + _options.KeyLifetime = core.Int64Ptr(keyLifetime) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateIpsecPolicyOptions) SetName(name string) *CreateIpsecPolicyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateIpsecPolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateIpsecPolicyOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateIpsecPolicyOptions) SetHeaders(param map[string]string) *CreateIpsecPolicyOptions { + options.Headers = param + return options +} + +// CreateKeyOptions : The CreateKey options. +type CreateKeyOptions struct { + // A unique public SSH key to import, in OpenSSH format (consisting of three space-separated fields: the algorithm + // name, base64-encoded key, and a comment). The algorithm and comment fields may be omitted, as only the key field is + // imported. + // + // Keys of type `rsa` may be 2048 or 4096 bits in length, however 4096 is recommended. Keys of type `ed25519` are 256 + // bits in length. + PublicKey *string `json:"public_key" validate:"required"` + + // The name for this key. The name must not be used by another key in the region. 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"` + + // The crypto-system used by this key. + Type *string `json:"type,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateKeyOptions.Type property. +// The crypto-system used by this key. +const ( + CreateKeyOptionsTypeEd25519Const = "ed25519" + CreateKeyOptionsTypeRsaConst = "rsa" +) + +// NewCreateKeyOptions : Instantiate CreateKeyOptions +func (*VpcV1) NewCreateKeyOptions(publicKey string) *CreateKeyOptions { + return &CreateKeyOptions{ + PublicKey: core.StringPtr(publicKey), + } +} + +// SetPublicKey : Allow user to set PublicKey +func (_options *CreateKeyOptions) SetPublicKey(publicKey string) *CreateKeyOptions { + _options.PublicKey = core.StringPtr(publicKey) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateKeyOptions) SetName(name string) *CreateKeyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateKeyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateKeyOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetType : Allow user to set Type +func (_options *CreateKeyOptions) SetType(typeVar string) *CreateKeyOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateKeyOptions) SetHeaders(param map[string]string) *CreateKeyOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerListenerOptions : The CreateLoadBalancerListener options. +type CreateLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. + // + // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http` and + // `https`. + // + // Additional restrictions: + // - If `default_pool` is set, the pool's protocol must match, or be compatible with + // the listener's protocol. At present, the compatible protocols are `http` and + // `https`. + // - If `https_redirect` is set, the protocol must be `http`. + Protocol *string `json:"protocol" validate:"required"` + + // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in + // the `application` family (otherwise always `false`). Additional restrictions: + // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must + // match the `accept_proxy_protocol` value of the `https_redirect` listener. + // - If this listener is the target of another listener's `https_redirect`, its + // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. + AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` + + // The certificate instance to use for SSL termination. The listener must have a + // `protocol` of `https`. + CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` + + // The connection limit of the listener. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` + + // The default pool for this listener. If specified, the pool must: + // - Belong to this load balancer. + // - Have the same `protocol` as this listener, or have a compatible protocol. + // At present, the compatible protocols are `http` and `https`. + // - Not already be the `default_pool` for another listener. + // + // If unspecified, this listener will be created with no default pool, but one may be + // subsequently set. + DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` + + // The target listener that requests will be redirected to. This listener must have a + // `protocol` of `http`, and the target 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. + IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` + + // The policy prototype objects for this listener. The load balancer must be in the + // `application` family. + Policies []LoadBalancerListenerPolicyPrototype `json:"policies,omitempty"` + + // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must + // have a unique `port` and `protocol` combination. + // + // Not supported for load balancers operating with route mode enabled. + Port *int64 `json:"port,omitempty"` + + // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `65535` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `1` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMin *int64 `json:"port_min,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerListenerOptions.Protocol property. +// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. +// +// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http` and +// `https`. +// +// Additional restrictions: +// - If `default_pool` is set, the pool's protocol must match, or be compatible with +// the listener's protocol. At present, the compatible protocols are `http` and +// `https`. +// - If `https_redirect` is set, the protocol must be `http`. +const ( + CreateLoadBalancerListenerOptionsProtocolHTTPConst = "http" + CreateLoadBalancerListenerOptionsProtocolHTTPSConst = "https" + CreateLoadBalancerListenerOptionsProtocolTCPConst = "tcp" + CreateLoadBalancerListenerOptionsProtocolUDPConst = "udp" +) + +// NewCreateLoadBalancerListenerOptions : Instantiate CreateLoadBalancerListenerOptions +func (*VpcV1) NewCreateLoadBalancerListenerOptions(loadBalancerID string, protocol string) *CreateLoadBalancerListenerOptions { + return &CreateLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + Protocol: core.StringPtr(protocol), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetProtocol : Allow user to set Protocol +func (_options *CreateLoadBalancerListenerOptions) SetProtocol(protocol string) *CreateLoadBalancerListenerOptions { + _options.Protocol = core.StringPtr(protocol) + return _options +} + +// SetAcceptProxyProtocol : Allow user to set AcceptProxyProtocol +func (_options *CreateLoadBalancerListenerOptions) SetAcceptProxyProtocol(acceptProxyProtocol bool) *CreateLoadBalancerListenerOptions { + _options.AcceptProxyProtocol = core.BoolPtr(acceptProxyProtocol) + return _options +} + +// SetCertificateInstance : Allow user to set CertificateInstance +func (_options *CreateLoadBalancerListenerOptions) SetCertificateInstance(certificateInstance CertificateInstanceIdentityIntf) *CreateLoadBalancerListenerOptions { + _options.CertificateInstance = certificateInstance + return _options +} + +// SetConnectionLimit : Allow user to set ConnectionLimit +func (_options *CreateLoadBalancerListenerOptions) SetConnectionLimit(connectionLimit int64) *CreateLoadBalancerListenerOptions { + _options.ConnectionLimit = core.Int64Ptr(connectionLimit) + return _options +} + +// SetDefaultPool : Allow user to set DefaultPool +func (_options *CreateLoadBalancerListenerOptions) SetDefaultPool(defaultPool LoadBalancerPoolIdentityIntf) *CreateLoadBalancerListenerOptions { + _options.DefaultPool = defaultPool + return _options +} + +// SetHTTPSRedirect : Allow user to set HTTPSRedirect +func (_options *CreateLoadBalancerListenerOptions) SetHTTPSRedirect(httpsRedirect *LoadBalancerListenerHTTPSRedirectPrototype) *CreateLoadBalancerListenerOptions { + _options.HTTPSRedirect = httpsRedirect + return _options +} + +// SetIdleConnectionTimeout : Allow user to set IdleConnectionTimeout +func (_options *CreateLoadBalancerListenerOptions) SetIdleConnectionTimeout(idleConnectionTimeout int64) *CreateLoadBalancerListenerOptions { + _options.IdleConnectionTimeout = core.Int64Ptr(idleConnectionTimeout) + return _options +} + +// SetPolicies : Allow user to set Policies +func (_options *CreateLoadBalancerListenerOptions) SetPolicies(policies []LoadBalancerListenerPolicyPrototype) *CreateLoadBalancerListenerOptions { + _options.Policies = policies + return _options +} + +// SetPort : Allow user to set Port +func (_options *CreateLoadBalancerListenerOptions) SetPort(port int64) *CreateLoadBalancerListenerOptions { + _options.Port = core.Int64Ptr(port) + return _options +} + +// SetPortMax : Allow user to set PortMax +func (_options *CreateLoadBalancerListenerOptions) SetPortMax(portMax int64) *CreateLoadBalancerListenerOptions { + _options.PortMax = core.Int64Ptr(portMax) + return _options +} + +// SetPortMin : Allow user to set PortMin +func (_options *CreateLoadBalancerListenerOptions) SetPortMin(portMin int64) *CreateLoadBalancerListenerOptions { + _options.PortMin = core.Int64Ptr(portMin) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerListenerOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerListenerPolicyOptions : The CreateLoadBalancerListenerPolicy options. +type CreateLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy action. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the + // unexpected property value was encountered. + Action *string `json:"action" validate:"required"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority" validate:"required"` + + // The name for this policy. The name must not be used by another policy for the load balancer listener. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The rule prototype objects for this policy. + Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` + + // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. + // - If `action` is `https_redirect`, specify a + // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerListenerPolicyOptions.Action property. +// The policy action. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the +// unexpected property value was encountered. +const ( + CreateLoadBalancerListenerPolicyOptionsActionForwardConst = "forward" + CreateLoadBalancerListenerPolicyOptionsActionHTTPSRedirectConst = "https_redirect" + CreateLoadBalancerListenerPolicyOptionsActionRedirectConst = "redirect" + CreateLoadBalancerListenerPolicyOptionsActionRejectConst = "reject" +) + +// NewCreateLoadBalancerListenerPolicyOptions : Instantiate CreateLoadBalancerListenerPolicyOptions +func (*VpcV1) NewCreateLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, action string, priority int64) *CreateLoadBalancerListenerPolicyOptions { + return &CreateLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + Action: core.StringPtr(action), + Priority: core.Int64Ptr(priority), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerPolicyOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *CreateLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *CreateLoadBalancerListenerPolicyOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetAction : Allow user to set Action +func (_options *CreateLoadBalancerListenerPolicyOptions) SetAction(action string) *CreateLoadBalancerListenerPolicyOptions { + _options.Action = core.StringPtr(action) + return _options +} + +// SetPriority : Allow user to set Priority +func (_options *CreateLoadBalancerListenerPolicyOptions) SetPriority(priority int64) *CreateLoadBalancerListenerPolicyOptions { + _options.Priority = core.Int64Ptr(priority) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateLoadBalancerListenerPolicyOptions) SetName(name string) *CreateLoadBalancerListenerPolicyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetRules : Allow user to set Rules +func (_options *CreateLoadBalancerListenerPolicyOptions) SetRules(rules []LoadBalancerListenerPolicyRulePrototype) *CreateLoadBalancerListenerPolicyOptions { + _options.Rules = rules + return _options +} + +// SetTarget : Allow user to set Target +func (_options *CreateLoadBalancerListenerPolicyOptions) SetTarget(target LoadBalancerListenerPolicyTargetPrototypeIntf) *CreateLoadBalancerListenerPolicyOptions { + _options.Target = target + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerListenerPolicyRuleOptions : The CreateLoadBalancerListenerPolicyRule options. +type CreateLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // The condition of the rule. + Condition *string `json:"condition" validate:"required"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type" validate:"required"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value" validate:"required"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this property is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Condition property. +// The condition of the rule. +const ( + CreateLoadBalancerListenerPolicyRuleOptionsConditionContainsConst = "contains" + CreateLoadBalancerListenerPolicyRuleOptionsConditionEqualsConst = "equals" + CreateLoadBalancerListenerPolicyRuleOptionsConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + CreateLoadBalancerListenerPolicyRuleOptionsTypeBodyConst = "body" + CreateLoadBalancerListenerPolicyRuleOptionsTypeHeaderConst = "header" + CreateLoadBalancerListenerPolicyRuleOptionsTypeHostnameConst = "hostname" + CreateLoadBalancerListenerPolicyRuleOptionsTypePathConst = "path" + CreateLoadBalancerListenerPolicyRuleOptionsTypeQueryConst = "query" +) + +// NewCreateLoadBalancerListenerPolicyRuleOptions : Instantiate CreateLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewCreateLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, condition string, typeVar string, value string) *CreateLoadBalancerListenerPolicyRuleOptions { + return &CreateLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + Condition: core.StringPtr(condition), + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetCondition : Allow user to set Condition +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetCondition(condition string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.Condition = core.StringPtr(condition) + return _options +} + +// SetType : Allow user to set Type +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetType(typeVar string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetValue : Allow user to set Value +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetValue(value string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.Value = core.StringPtr(value) + return _options +} + +// SetField : Allow user to set Field +func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetField(field string) *CreateLoadBalancerListenerPolicyRuleOptions { + _options.Field = core.StringPtr(field) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerOptions : The CreateLoadBalancer options. +type CreateLoadBalancerOptions struct { + // Indicates whether this load balancer is public. + // + // At present, if route mode is enabled, the load balancer must not be public. + IsPublic *bool `json:"is_public" validate:"required"` + + // The subnets to provision this load balancer in. The subnets must be in the same VPC. The load balancer's + // availability will depend on the availability of the zones that the subnets reside in. + // + // Load balancers in the `network` family allow only one subnet to be specified. + Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` + + // 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 `lb.appdomain.cloud`. Otherwise, those DNS `A` records will be + // added to the specified `zone`. + Dns *LoadBalancerDnsPrototype `json:"dns,omitempty"` + + // The listeners of this load balancer. + Listeners []LoadBalancerListenerPrototypeLoadBalancerContext `json:"listeners,omitempty"` + + // The logging configuration to use for this load balancer. See [VPC Datapath + // Logging](https://cloud.ibm.com/docs/vpc?topic=vpc-datapath-logging) on the logging + // format, fields and permitted values. If unspecified, `datapath.active` will be `false`. + // + // To activate logging, the load balancer profile must support the specified logging type. + Logging *LoadBalancerLoggingPrototype `json:"logging,omitempty"` + + // The name for this load balancer. The name must not be used by another load balancer in the VPC. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The pools of this load balancer. + Pools []LoadBalancerPoolPrototype `json:"pools,omitempty"` + + // The profile to use for this load balancer. + // + // If unspecified, `application` will be used. + Profile LoadBalancerProfileIdentityIntf `json:"profile,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 whether route mode is enabled for this load balancer. + // + // At present, public load balancers are not supported with route mode enabled. + RouteMode *bool `json:"route_mode,omitempty"` + + // The security groups to use for this load balancer. If unspecified, the VPC's default security group is used. + // + // The load balancer profile must support security groups. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateLoadBalancerOptions : Instantiate CreateLoadBalancerOptions +func (*VpcV1) NewCreateLoadBalancerOptions(isPublic bool, subnets []SubnetIdentityIntf) *CreateLoadBalancerOptions { + return &CreateLoadBalancerOptions{ + IsPublic: core.BoolPtr(isPublic), + Subnets: subnets, + } +} + +// SetIsPublic : Allow user to set IsPublic +func (_options *CreateLoadBalancerOptions) SetIsPublic(isPublic bool) *CreateLoadBalancerOptions { + _options.IsPublic = core.BoolPtr(isPublic) + return _options +} + +// SetSubnets : Allow user to set Subnets +func (_options *CreateLoadBalancerOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateLoadBalancerOptions { + _options.Subnets = subnets + return _options +} + +// SetDns : Allow user to set Dns +func (_options *CreateLoadBalancerOptions) SetDns(dns *LoadBalancerDnsPrototype) *CreateLoadBalancerOptions { + _options.Dns = dns + return _options +} + +// SetListeners : Allow user to set Listeners +func (_options *CreateLoadBalancerOptions) SetListeners(listeners []LoadBalancerListenerPrototypeLoadBalancerContext) *CreateLoadBalancerOptions { + _options.Listeners = listeners + return _options +} + +// SetLogging : Allow user to set Logging +func (_options *CreateLoadBalancerOptions) SetLogging(logging *LoadBalancerLoggingPrototype) *CreateLoadBalancerOptions { + _options.Logging = logging + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateLoadBalancerOptions) SetName(name string) *CreateLoadBalancerOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPools : Allow user to set Pools +func (_options *CreateLoadBalancerOptions) SetPools(pools []LoadBalancerPoolPrototype) *CreateLoadBalancerOptions { + _options.Pools = pools + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *CreateLoadBalancerOptions) SetProfile(profile LoadBalancerProfileIdentityIntf) *CreateLoadBalancerOptions { + _options.Profile = profile + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateLoadBalancerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateLoadBalancerOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetRouteMode : Allow user to set RouteMode +func (_options *CreateLoadBalancerOptions) SetRouteMode(routeMode bool) *CreateLoadBalancerOptions { + _options.RouteMode = core.BoolPtr(routeMode) + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateLoadBalancerOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateLoadBalancerOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerOptions) SetHeaders(param map[string]string) *CreateLoadBalancerOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerPoolMemberOptions : The CreateLoadBalancerPoolMember options. +type CreateLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a + // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive + // the traffic on the same port the listener received it on.) + // + // This port will also be used for health checks unless the `port` property of + // `health_monitor` property is specified. + // + // The port must be unique across all members for all pools associated with this pool's listener. + Port *int64 `json:"port" validate:"required"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. + Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateLoadBalancerPoolMemberOptions : Instantiate CreateLoadBalancerPoolMemberOptions +func (*VpcV1) NewCreateLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, port int64, target LoadBalancerPoolMemberTargetPrototypeIntf) *CreateLoadBalancerPoolMemberOptions { + return &CreateLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + Port: core.Int64Ptr(port), + Target: target, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerPoolMemberOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *CreateLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *CreateLoadBalancerPoolMemberOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetPort : Allow user to set Port +func (_options *CreateLoadBalancerPoolMemberOptions) SetPort(port int64) *CreateLoadBalancerPoolMemberOptions { + _options.Port = core.Int64Ptr(port) + return _options +} + +// SetTarget : Allow user to set Target +func (_options *CreateLoadBalancerPoolMemberOptions) SetTarget(target LoadBalancerPoolMemberTargetPrototypeIntf) *CreateLoadBalancerPoolMemberOptions { + _options.Target = target + return _options +} + +// SetWeight : Allow user to set Weight +func (_options *CreateLoadBalancerPoolMemberOptions) SetWeight(weight int64) *CreateLoadBalancerPoolMemberOptions { + _options.Weight = core.Int64Ptr(weight) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *CreateLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerPoolOptions : The CreateLoadBalancerPool options. +type CreateLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The load balancing algorithm. + Algorithm *string `json:"algorithm" validate:"required"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitorPrototype `json:"health_monitor" validate:"required"` + + // The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if + // `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http`, and `https`. + Protocol *string `json:"protocol" validate:"required"` + + // The members for this load balancer pool. For load balancers in the `network` family, the same `port` and `target` + // tuple cannot be shared by a pool member of any other load balancer in the same VPC. + Members []LoadBalancerPoolMemberPrototype `json:"members,omitempty"` + + // The name for this load balancer pool. The name must not be used by another pool for the load balancer. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol,omitempty"` + + // The session persistence of this pool. + SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerPoolOptions.Algorithm property. +// The load balancing algorithm. +const ( + CreateLoadBalancerPoolOptionsAlgorithmLeastConnectionsConst = "least_connections" + CreateLoadBalancerPoolOptionsAlgorithmRoundRobinConst = "round_robin" + CreateLoadBalancerPoolOptionsAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the CreateLoadBalancerPoolOptions.Protocol property. +// The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if +// `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http`, and `https`. +const ( + CreateLoadBalancerPoolOptionsProtocolHTTPConst = "http" + CreateLoadBalancerPoolOptionsProtocolHTTPSConst = "https" + CreateLoadBalancerPoolOptionsProtocolTCPConst = "tcp" + CreateLoadBalancerPoolOptionsProtocolUDPConst = "udp" +) + +// Constants associated with the CreateLoadBalancerPoolOptions.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + CreateLoadBalancerPoolOptionsProxyProtocolDisabledConst = "disabled" + CreateLoadBalancerPoolOptionsProxyProtocolV1Const = "v1" + CreateLoadBalancerPoolOptionsProxyProtocolV2Const = "v2" +) + +// NewCreateLoadBalancerPoolOptions : Instantiate CreateLoadBalancerPoolOptions +func (*VpcV1) NewCreateLoadBalancerPoolOptions(loadBalancerID string, algorithm string, healthMonitor *LoadBalancerPoolHealthMonitorPrototype, protocol string) *CreateLoadBalancerPoolOptions { + return &CreateLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + Algorithm: core.StringPtr(algorithm), + HealthMonitor: healthMonitor, + Protocol: core.StringPtr(protocol), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *CreateLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerPoolOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetAlgorithm : Allow user to set Algorithm +func (_options *CreateLoadBalancerPoolOptions) SetAlgorithm(algorithm string) *CreateLoadBalancerPoolOptions { + _options.Algorithm = core.StringPtr(algorithm) + return _options +} + +// SetHealthMonitor : Allow user to set HealthMonitor +func (_options *CreateLoadBalancerPoolOptions) SetHealthMonitor(healthMonitor *LoadBalancerPoolHealthMonitorPrototype) *CreateLoadBalancerPoolOptions { + _options.HealthMonitor = healthMonitor + return _options +} + +// SetProtocol : Allow user to set Protocol +func (_options *CreateLoadBalancerPoolOptions) SetProtocol(protocol string) *CreateLoadBalancerPoolOptions { + _options.Protocol = core.StringPtr(protocol) + return _options +} + +// SetMembers : Allow user to set Members +func (_options *CreateLoadBalancerPoolOptions) SetMembers(members []LoadBalancerPoolMemberPrototype) *CreateLoadBalancerPoolOptions { + _options.Members = members + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateLoadBalancerPoolOptions) SetName(name string) *CreateLoadBalancerPoolOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetProxyProtocol : Allow user to set ProxyProtocol +func (_options *CreateLoadBalancerPoolOptions) SetProxyProtocol(proxyProtocol string) *CreateLoadBalancerPoolOptions { + _options.ProxyProtocol = core.StringPtr(proxyProtocol) + return _options +} + +// SetSessionPersistence : Allow user to set SessionPersistence +func (_options *CreateLoadBalancerPoolOptions) SetSessionPersistence(sessionPersistence *LoadBalancerPoolSessionPersistencePrototype) *CreateLoadBalancerPoolOptions { + _options.SessionPersistence = sessionPersistence + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerPoolOptions) SetHeaders(param map[string]string) *CreateLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// CreateNetworkACLOptions : The CreateNetworkACL options. +type CreateNetworkACLOptions struct { + // The network ACL prototype object. + NetworkACLPrototype NetworkACLPrototypeIntf `json:"NetworkACLPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateNetworkACLOptions : Instantiate CreateNetworkACLOptions +func (*VpcV1) NewCreateNetworkACLOptions(networkACLPrototype NetworkACLPrototypeIntf) *CreateNetworkACLOptions { + return &CreateNetworkACLOptions{ + NetworkACLPrototype: networkACLPrototype, + } +} + +// SetNetworkACLPrototype : Allow user to set NetworkACLPrototype +func (_options *CreateNetworkACLOptions) SetNetworkACLPrototype(networkACLPrototype NetworkACLPrototypeIntf) *CreateNetworkACLOptions { + _options.NetworkACLPrototype = networkACLPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateNetworkACLOptions) SetHeaders(param map[string]string) *CreateNetworkACLOptions { + options.Headers = param + return options +} + +// CreateNetworkACLRuleOptions : The CreateNetworkACLRule options. +type CreateNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` + + // The network ACL rule prototype object. + NetworkACLRulePrototype NetworkACLRulePrototypeIntf `json:"NetworkACLRulePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateNetworkACLRuleOptions : Instantiate CreateNetworkACLRuleOptions +func (*VpcV1) NewCreateNetworkACLRuleOptions(networkACLID string, networkACLRulePrototype NetworkACLRulePrototypeIntf) *CreateNetworkACLRuleOptions { + return &CreateNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + NetworkACLRulePrototype: networkACLRulePrototype, + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *CreateNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *CreateNetworkACLRuleOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetNetworkACLRulePrototype : Allow user to set NetworkACLRulePrototype +func (_options *CreateNetworkACLRuleOptions) SetNetworkACLRulePrototype(networkACLRulePrototype NetworkACLRulePrototypeIntf) *CreateNetworkACLRuleOptions { + _options.NetworkACLRulePrototype = networkACLRulePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateNetworkACLRuleOptions) SetHeaders(param map[string]string) *CreateNetworkACLRuleOptions { + options.Headers = param + return options +} + +// CreatePlacementGroupOptions : The CreatePlacementGroup options. +type CreatePlacementGroupOptions struct { + // The strategy for this placement group + // - `host_spread`: place on different compute hosts + // - `power_spread`: place on compute hosts that use different power sources + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the + // unexpected strategy was encountered. + Strategy *string `json:"strategy" validate:"required"` + + // The name for this placement group. The name must not be used by another placement group in the region. 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreatePlacementGroupOptions.Strategy property. +// The strategy for this placement group +// - `host_spread`: place on different compute hosts +// - `power_spread`: place on compute hosts that use different power sources +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the +// unexpected strategy was encountered. +const ( + CreatePlacementGroupOptionsStrategyHostSpreadConst = "host_spread" + CreatePlacementGroupOptionsStrategyPowerSpreadConst = "power_spread" +) + +// NewCreatePlacementGroupOptions : Instantiate CreatePlacementGroupOptions +func (*VpcV1) NewCreatePlacementGroupOptions(strategy string) *CreatePlacementGroupOptions { + return &CreatePlacementGroupOptions{ + Strategy: core.StringPtr(strategy), + } +} + +// SetStrategy : Allow user to set Strategy +func (_options *CreatePlacementGroupOptions) SetStrategy(strategy string) *CreatePlacementGroupOptions { + _options.Strategy = core.StringPtr(strategy) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreatePlacementGroupOptions) SetName(name string) *CreatePlacementGroupOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreatePlacementGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePlacementGroupOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreatePlacementGroupOptions) SetHeaders(param map[string]string) *CreatePlacementGroupOptions { + options.Headers = param + return options +} + +// CreatePublicGatewayOptions : The CreatePublicGateway options. +type CreatePublicGatewayOptions struct { + // The VPC this public gateway will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The zone this public gateway will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + FloatingIP PublicGatewayFloatingIPPrototypeIntf `json:"floating_ip,omitempty"` + + // The name for this public gateway. The name must not be used by another public gateway in the VPC. 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreatePublicGatewayOptions : Instantiate CreatePublicGatewayOptions +func (*VpcV1) NewCreatePublicGatewayOptions(vpc VPCIdentityIntf, zone ZoneIdentityIntf) *CreatePublicGatewayOptions { + return &CreatePublicGatewayOptions{ + VPC: vpc, + Zone: zone, + } +} + +// SetVPC : Allow user to set VPC +func (_options *CreatePublicGatewayOptions) SetVPC(vpc VPCIdentityIntf) *CreatePublicGatewayOptions { + _options.VPC = vpc + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreatePublicGatewayOptions) SetZone(zone ZoneIdentityIntf) *CreatePublicGatewayOptions { + _options.Zone = zone + return _options +} + +// SetFloatingIP : Allow user to set FloatingIP +func (_options *CreatePublicGatewayOptions) SetFloatingIP(floatingIP PublicGatewayFloatingIPPrototypeIntf) *CreatePublicGatewayOptions { + _options.FloatingIP = floatingIP + return _options +} + +// SetName : Allow user to set Name +func (_options *CreatePublicGatewayOptions) SetName(name string) *CreatePublicGatewayOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreatePublicGatewayOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePublicGatewayOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreatePublicGatewayOptions) SetHeaders(param map[string]string) *CreatePublicGatewayOptions { + options.Headers = param + return options +} + +// CreateReservationOptions : The CreateReservation options. +type CreateReservationOptions struct { + // The capacity reservation configuration to use. + Capacity *ReservationCapacityPrototype `json:"capacity" validate:"required"` + + // The committed use configuration to use for this reservation. + CommittedUse *ReservationCommittedUsePrototype `json:"committed_use" validate:"required"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this + // reservation. + Profile *ReservationProfilePrototype `json:"profile" validate:"required"` + + // The zone to use for this reservation. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The affinity policy to use for this reservation: + // - `restricted`: The reservation must be manually requested. + AffinityPolicy *string `json:"affinity_policy,omitempty"` + + // The name for this reservation. The name must not be used by another reservation in the region. 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateReservationOptions.AffinityPolicy property. +// The affinity policy to use for this reservation: +// - `restricted`: The reservation must be manually requested. +const ( + CreateReservationOptionsAffinityPolicyRestrictedConst = "restricted" +) + +// NewCreateReservationOptions : Instantiate CreateReservationOptions +func (*VpcV1) NewCreateReservationOptions(capacity *ReservationCapacityPrototype, committedUse *ReservationCommittedUsePrototype, profile *ReservationProfilePrototype, zone ZoneIdentityIntf) *CreateReservationOptions { + return &CreateReservationOptions{ + Capacity: capacity, + CommittedUse: committedUse, + Profile: profile, + Zone: zone, + } +} + +// SetCapacity : Allow user to set Capacity +func (_options *CreateReservationOptions) SetCapacity(capacity *ReservationCapacityPrototype) *CreateReservationOptions { + _options.Capacity = capacity + return _options +} + +// SetCommittedUse : Allow user to set CommittedUse +func (_options *CreateReservationOptions) SetCommittedUse(committedUse *ReservationCommittedUsePrototype) *CreateReservationOptions { + _options.CommittedUse = committedUse + return _options +} + +// SetProfile : Allow user to set Profile +func (_options *CreateReservationOptions) SetProfile(profile *ReservationProfilePrototype) *CreateReservationOptions { + _options.Profile = profile + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateReservationOptions) SetZone(zone ZoneIdentityIntf) *CreateReservationOptions { + _options.Zone = zone + return _options +} + +// SetAffinityPolicy : Allow user to set AffinityPolicy +func (_options *CreateReservationOptions) SetAffinityPolicy(affinityPolicy string) *CreateReservationOptions { + _options.AffinityPolicy = core.StringPtr(affinityPolicy) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateReservationOptions) SetName(name string) *CreateReservationOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateReservationOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateReservationOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateReservationOptions) SetHeaders(param map[string]string) *CreateReservationOptions { + options.Headers = param + return options +} + +// CreateSecurityGroupOptions : The CreateSecurityGroup options. +type CreateSecurityGroupOptions struct { + // The VPC this security group will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The name for this security group. The name must not be used by another security group for the VPC. 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"` + + // The prototype objects for rules to be created for this security group. If unspecified, no rules will be created, + // resulting in all traffic being denied. + Rules []SecurityGroupRulePrototypeIntf `json:"rules,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSecurityGroupOptions : Instantiate CreateSecurityGroupOptions +func (*VpcV1) NewCreateSecurityGroupOptions(vpc VPCIdentityIntf) *CreateSecurityGroupOptions { + return &CreateSecurityGroupOptions{ + VPC: vpc, + } +} + +// SetVPC : Allow user to set VPC +func (_options *CreateSecurityGroupOptions) SetVPC(vpc VPCIdentityIntf) *CreateSecurityGroupOptions { + _options.VPC = vpc + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateSecurityGroupOptions) SetName(name string) *CreateSecurityGroupOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateSecurityGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateSecurityGroupOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetRules : Allow user to set Rules +func (_options *CreateSecurityGroupOptions) SetRules(rules []SecurityGroupRulePrototypeIntf) *CreateSecurityGroupOptions { + _options.Rules = rules + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSecurityGroupOptions) SetHeaders(param map[string]string) *CreateSecurityGroupOptions { + options.Headers = param + return options +} + +// CreateSecurityGroupRuleOptions : The CreateSecurityGroupRule options. +type CreateSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The properties of the security group rule to be created. + SecurityGroupRulePrototype SecurityGroupRulePrototypeIntf `json:"SecurityGroupRulePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSecurityGroupRuleOptions : Instantiate CreateSecurityGroupRuleOptions +func (*VpcV1) NewCreateSecurityGroupRuleOptions(securityGroupID string, securityGroupRulePrototype SecurityGroupRulePrototypeIntf) *CreateSecurityGroupRuleOptions { + return &CreateSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + SecurityGroupRulePrototype: securityGroupRulePrototype, + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *CreateSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *CreateSecurityGroupRuleOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetSecurityGroupRulePrototype : Allow user to set SecurityGroupRulePrototype +func (_options *CreateSecurityGroupRuleOptions) SetSecurityGroupRulePrototype(securityGroupRulePrototype SecurityGroupRulePrototypeIntf) *CreateSecurityGroupRuleOptions { + _options.SecurityGroupRulePrototype = securityGroupRulePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSecurityGroupRuleOptions) SetHeaders(param map[string]string) *CreateSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// CreateSecurityGroupTargetBindingOptions : The CreateSecurityGroupTargetBinding options. +type CreateSecurityGroupTargetBindingOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The security group target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSecurityGroupTargetBindingOptions : Instantiate CreateSecurityGroupTargetBindingOptions +func (*VpcV1) NewCreateSecurityGroupTargetBindingOptions(securityGroupID string, id string) *CreateSecurityGroupTargetBindingOptions { + return &CreateSecurityGroupTargetBindingOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *CreateSecurityGroupTargetBindingOptions) SetSecurityGroupID(securityGroupID string) *CreateSecurityGroupTargetBindingOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *CreateSecurityGroupTargetBindingOptions) SetID(id string) *CreateSecurityGroupTargetBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSecurityGroupTargetBindingOptions) SetHeaders(param map[string]string) *CreateSecurityGroupTargetBindingOptions { + options.Headers = param + return options +} + +// CreateShareMountTargetOptions : The CreateShareMountTarget options. +type CreateShareMountTargetOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share mount target prototype object. + ShareMountTargetPrototype ShareMountTargetPrototypeIntf `json:"ShareMountTargetPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateShareMountTargetOptions : Instantiate CreateShareMountTargetOptions +func (*VpcV1) NewCreateShareMountTargetOptions(shareID string, shareMountTargetPrototype ShareMountTargetPrototypeIntf) *CreateShareMountTargetOptions { + return &CreateShareMountTargetOptions{ + ShareID: core.StringPtr(shareID), + ShareMountTargetPrototype: shareMountTargetPrototype, + } +} + +// SetShareID : Allow user to set ShareID +func (_options *CreateShareMountTargetOptions) SetShareID(shareID string) *CreateShareMountTargetOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetShareMountTargetPrototype : Allow user to set ShareMountTargetPrototype +func (_options *CreateShareMountTargetOptions) SetShareMountTargetPrototype(shareMountTargetPrototype ShareMountTargetPrototypeIntf) *CreateShareMountTargetOptions { + _options.ShareMountTargetPrototype = shareMountTargetPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateShareMountTargetOptions) SetHeaders(param map[string]string) *CreateShareMountTargetOptions { + options.Headers = param + return options +} + +// CreateShareOptions : The CreateShare options. +type CreateShareOptions struct { + // The file share prototype object. + SharePrototype SharePrototypeIntf `json:"SharePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateShareOptions : Instantiate CreateShareOptions +func (*VpcV1) NewCreateShareOptions(sharePrototype SharePrototypeIntf) *CreateShareOptions { + return &CreateShareOptions{ + SharePrototype: sharePrototype, + } +} + +// SetSharePrototype : Allow user to set SharePrototype +func (_options *CreateShareOptions) SetSharePrototype(sharePrototype SharePrototypeIntf) *CreateShareOptions { + _options.SharePrototype = sharePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateShareOptions) SetHeaders(param map[string]string) *CreateShareOptions { + options.Headers = param + return options +} + +// CreateSnapshotCloneOptions : The CreateSnapshotClone options. +type CreateSnapshotCloneOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // The zone name. + ZoneName *string `json:"zone_name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSnapshotCloneOptions : Instantiate CreateSnapshotCloneOptions +func (*VpcV1) NewCreateSnapshotCloneOptions(id string, zoneName string) *CreateSnapshotCloneOptions { + return &CreateSnapshotCloneOptions{ + ID: core.StringPtr(id), + ZoneName: core.StringPtr(zoneName), + } +} + +// SetID : Allow user to set ID +func (_options *CreateSnapshotCloneOptions) SetID(id string) *CreateSnapshotCloneOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *CreateSnapshotCloneOptions) SetZoneName(zoneName string) *CreateSnapshotCloneOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSnapshotCloneOptions) SetHeaders(param map[string]string) *CreateSnapshotCloneOptions { + options.Headers = param + return options +} + +// CreateSnapshotConsistencyGroupOptions : The CreateSnapshotConsistencyGroup options. +type CreateSnapshotConsistencyGroupOptions struct { + // The snapshot consistency group prototype object. + SnapshotConsistencyGroupPrototype SnapshotConsistencyGroupPrototypeIntf `json:"SnapshotConsistencyGroupPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSnapshotConsistencyGroupOptions : Instantiate CreateSnapshotConsistencyGroupOptions +func (*VpcV1) NewCreateSnapshotConsistencyGroupOptions(snapshotConsistencyGroupPrototype SnapshotConsistencyGroupPrototypeIntf) *CreateSnapshotConsistencyGroupOptions { + return &CreateSnapshotConsistencyGroupOptions{ + SnapshotConsistencyGroupPrototype: snapshotConsistencyGroupPrototype, + } +} + +// SetSnapshotConsistencyGroupPrototype : Allow user to set SnapshotConsistencyGroupPrototype +func (_options *CreateSnapshotConsistencyGroupOptions) SetSnapshotConsistencyGroupPrototype(snapshotConsistencyGroupPrototype SnapshotConsistencyGroupPrototypeIntf) *CreateSnapshotConsistencyGroupOptions { + _options.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *CreateSnapshotConsistencyGroupOptions { + options.Headers = param + return options +} + +// CreateSnapshotOptions : The CreateSnapshot options. +type CreateSnapshotOptions struct { + // The snapshot prototype object. + SnapshotPrototype SnapshotPrototypeIntf `json:"SnapshotPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSnapshotOptions : Instantiate CreateSnapshotOptions +func (*VpcV1) NewCreateSnapshotOptions(snapshotPrototype SnapshotPrototypeIntf) *CreateSnapshotOptions { + return &CreateSnapshotOptions{ + SnapshotPrototype: snapshotPrototype, + } +} + +// SetSnapshotPrototype : Allow user to set SnapshotPrototype +func (_options *CreateSnapshotOptions) SetSnapshotPrototype(snapshotPrototype SnapshotPrototypeIntf) *CreateSnapshotOptions { + _options.SnapshotPrototype = snapshotPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSnapshotOptions) SetHeaders(param map[string]string) *CreateSnapshotOptions { + options.Headers = param + return options +} + +// CreateSubnetOptions : The CreateSubnet options. +type CreateSubnetOptions struct { + // The subnet prototype object. + SubnetPrototype SubnetPrototypeIntf `json:"SubnetPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSubnetOptions : Instantiate CreateSubnetOptions +func (*VpcV1) NewCreateSubnetOptions(subnetPrototype SubnetPrototypeIntf) *CreateSubnetOptions { + return &CreateSubnetOptions{ + SubnetPrototype: subnetPrototype, + } +} + +// SetSubnetPrototype : Allow user to set SubnetPrototype +func (_options *CreateSubnetOptions) SetSubnetPrototype(subnetPrototype SubnetPrototypeIntf) *CreateSubnetOptions { + _options.SubnetPrototype = subnetPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSubnetOptions) SetHeaders(param map[string]string) *CreateSubnetOptions { + options.Headers = param + return options +} + +// CreateSubnetReservedIPOptions : The CreateSubnetReservedIP options. +type CreateSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `json:"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"` + + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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"` + + // The target to bind this reserved IP to. The target must be in the same VPC. + // + // The following targets are supported: + // - An endpoint gateway not already bound to a reserved IP in the subnet's zone. + // - A virtual network interface. + // + // If unspecified, the reserved IP will be created unbound. + Target ReservedIPTargetPrototypeIntf `json:"target,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSubnetReservedIPOptions : Instantiate CreateSubnetReservedIPOptions +func (*VpcV1) NewCreateSubnetReservedIPOptions(subnetID string) *CreateSubnetReservedIPOptions { + return &CreateSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + } +} + +// SetSubnetID : Allow user to set SubnetID +func (_options *CreateSubnetReservedIPOptions) SetSubnetID(subnetID string) *CreateSubnetReservedIPOptions { + _options.SubnetID = core.StringPtr(subnetID) + return _options +} + +// SetAddress : Allow user to set Address +func (_options *CreateSubnetReservedIPOptions) SetAddress(address string) *CreateSubnetReservedIPOptions { + _options.Address = core.StringPtr(address) + return _options +} + +// SetAutoDelete : Allow user to set AutoDelete +func (_options *CreateSubnetReservedIPOptions) SetAutoDelete(autoDelete bool) *CreateSubnetReservedIPOptions { + _options.AutoDelete = core.BoolPtr(autoDelete) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateSubnetReservedIPOptions) SetName(name string) *CreateSubnetReservedIPOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetTarget : Allow user to set Target +func (_options *CreateSubnetReservedIPOptions) SetTarget(target ReservedIPTargetPrototypeIntf) *CreateSubnetReservedIPOptions { + _options.Target = target + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSubnetReservedIPOptions) SetHeaders(param map[string]string) *CreateSubnetReservedIPOptions { + options.Headers = param + return options +} + +// CreateVirtualNetworkInterfaceOptions : The CreateVirtualNetworkInterface options. +type CreateVirtualNetworkInterfaceOptions 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"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. Must be `false` if the virtual network interface is unbound. + AutoDelete *bool `json:"auto_delete,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"` + + // 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"` + + // 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 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"` + + // 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 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVirtualNetworkInterfaceOptions : Instantiate CreateVirtualNetworkInterfaceOptions +func (*VpcV1) NewCreateVirtualNetworkInterfaceOptions() *CreateVirtualNetworkInterfaceOptions { + return &CreateVirtualNetworkInterfaceOptions{} +} + +// SetAllowIPSpoofing : Allow user to set AllowIPSpoofing +func (_options *CreateVirtualNetworkInterfaceOptions) SetAllowIPSpoofing(allowIPSpoofing bool) *CreateVirtualNetworkInterfaceOptions { + _options.AllowIPSpoofing = core.BoolPtr(allowIPSpoofing) + return _options +} + +// SetAutoDelete : Allow user to set AutoDelete +func (_options *CreateVirtualNetworkInterfaceOptions) SetAutoDelete(autoDelete bool) *CreateVirtualNetworkInterfaceOptions { + _options.AutoDelete = core.BoolPtr(autoDelete) + return _options +} + +// SetEnableInfrastructureNat : Allow user to set EnableInfrastructureNat +func (_options *CreateVirtualNetworkInterfaceOptions) SetEnableInfrastructureNat(enableInfrastructureNat bool) *CreateVirtualNetworkInterfaceOptions { + _options.EnableInfrastructureNat = core.BoolPtr(enableInfrastructureNat) + return _options +} + +// SetIps : Allow user to set Ips +func (_options *CreateVirtualNetworkInterfaceOptions) SetIps(ips []VirtualNetworkInterfaceIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { + _options.Ips = ips + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVirtualNetworkInterfaceOptions) SetName(name string) *CreateVirtualNetworkInterfaceOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPrimaryIP : Allow user to set PrimaryIP +func (_options *CreateVirtualNetworkInterfaceOptions) SetPrimaryIP(primaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { + _options.PrimaryIP = primaryIP + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateVirtualNetworkInterfaceOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVirtualNetworkInterfaceOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateVirtualNetworkInterfaceOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateVirtualNetworkInterfaceOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetSubnet : Allow user to set Subnet +func (_options *CreateVirtualNetworkInterfaceOptions) SetSubnet(subnet SubnetIdentityIntf) *CreateVirtualNetworkInterfaceOptions { + _options.Subnet = subnet + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateVirtualNetworkInterfaceOptions { + options.Headers = param + return options +} + +// CreateVolumeOptions : The CreateVolume options. +type CreateVolumeOptions struct { + // The volume prototype object. + VolumePrototype VolumePrototypeIntf `json:"VolumePrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVolumeOptions : Instantiate CreateVolumeOptions +func (*VpcV1) NewCreateVolumeOptions(volumePrototype VolumePrototypeIntf) *CreateVolumeOptions { + return &CreateVolumeOptions{ + VolumePrototype: volumePrototype, + } +} + +// SetVolumePrototype : Allow user to set VolumePrototype +func (_options *CreateVolumeOptions) SetVolumePrototype(volumePrototype VolumePrototypeIntf) *CreateVolumeOptions { + _options.VolumePrototype = volumePrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVolumeOptions) SetHeaders(param map[string]string) *CreateVolumeOptions { + options.Headers = param + return options +} + +// CreateVPCAddressPrefixOptions : The CreateVPCAddressPrefix options. +type CreateVPCAddressPrefixOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The IPv4 range of the address prefix, expressed in CIDR format. The range must not overlap with any existing address + // prefixes in the VPC or any of the following reserved address ranges: + // + // - `127.0.0.0/8` (IPv4 loopback addresses) + // - `161.26.0.0/16` (IBM services) + // - `166.8.0.0/14` (Cloud Service Endpoints) + // - `169.254.0.0/16` (IPv4 link-local addresses) + // - `224.0.0.0/4` (IPv4 multicast addresses) + // + // The prefix length of the address prefix's CIDR must be between `/9` (8,388,608 addresses) and `/29` (8 addresses). + CIDR *string `json:"cidr" validate:"required"` + + // The zone this address prefix will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // Indicates whether this will be the default address prefix for this zone in this VPC. If `true`, the VPC must not + // have a default address prefix for this zone. + 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. 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 +} + +// NewCreateVPCAddressPrefixOptions : Instantiate CreateVPCAddressPrefixOptions +func (*VpcV1) NewCreateVPCAddressPrefixOptions(vpcID string, cidr string, zone ZoneIdentityIntf) *CreateVPCAddressPrefixOptions { + return &CreateVPCAddressPrefixOptions{ + VPCID: core.StringPtr(vpcID), + CIDR: core.StringPtr(cidr), + Zone: zone, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *CreateVPCAddressPrefixOptions) SetVPCID(vpcID string) *CreateVPCAddressPrefixOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetCIDR : Allow user to set CIDR +func (_options *CreateVPCAddressPrefixOptions) SetCIDR(cidr string) *CreateVPCAddressPrefixOptions { + _options.CIDR = core.StringPtr(cidr) + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateVPCAddressPrefixOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCAddressPrefixOptions { + _options.Zone = zone + return _options +} + +// SetIsDefault : Allow user to set IsDefault +func (_options *CreateVPCAddressPrefixOptions) SetIsDefault(isDefault bool) *CreateVPCAddressPrefixOptions { + _options.IsDefault = core.BoolPtr(isDefault) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCAddressPrefixOptions) SetName(name string) *CreateVPCAddressPrefixOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCAddressPrefixOptions) SetHeaders(param map[string]string) *CreateVPCAddressPrefixOptions { + options.Headers = param + return options +} + +// CreateVPCDnsResolutionBindingOptions : The CreateVPCDnsResolutionBinding options. +type CreateVPCDnsResolutionBindingOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // Another VPC to bind this VPC to for DNS resolution. The VPC must have + // `dns.enable_hub` set to `true`, and may be in a different account (subject to + // IAM policies). + // + // Additionally, the VPC specified in the URL (this VPC) must have `dns.enable_hub` + // set to `false` and a `dns.resolution_binding_count` of zero. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The name for this DNS resolution binding. The name must not be used by another DNS resolution binding for the VPC. + // 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 +} + +// NewCreateVPCDnsResolutionBindingOptions : Instantiate CreateVPCDnsResolutionBindingOptions +func (*VpcV1) NewCreateVPCDnsResolutionBindingOptions(vpcID string, vpc VPCIdentityIntf) *CreateVPCDnsResolutionBindingOptions { + return &CreateVPCDnsResolutionBindingOptions{ + VPCID: core.StringPtr(vpcID), + VPC: vpc, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *CreateVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *CreateVPCDnsResolutionBindingOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPC : Allow user to set VPC +func (_options *CreateVPCDnsResolutionBindingOptions) SetVPC(vpc VPCIdentityIntf) *CreateVPCDnsResolutionBindingOptions { + _options.VPC = vpc + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCDnsResolutionBindingOptions) SetName(name string) *CreateVPCDnsResolutionBindingOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *CreateVPCDnsResolutionBindingOptions { + options.Headers = param + return options +} + +// CreateVPCOptions : The CreateVPC options. +type CreateVPCOptions struct { + // Indicates whether a [default address prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes) + // will be automatically created for each zone in this VPC. If `manual`, this VPC will be created with no default + // address prefixes. + // + // Since address prefixes are managed identically regardless of whether they were automatically created, the value is + // not preserved as a VPC property. + AddressPrefixManagement *string `json:"address_prefix_management,omitempty"` + + // 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. + ClassicAccess *bool `json:"classic_access,omitempty"` + + // The DNS configuration for this VPC. + // + // If unspecified, the system will assign DNS servers capable of resolving hosts and endpoint + // gateways within this VPC, and hosts on the internet. + Dns *VpcdnsPrototype `json:"dns,omitempty"` + + // The name for this VPC. The name must not be used by another VPC in the region. 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPCOptions.AddressPrefixManagement property. +// Indicates whether a [default address prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes) +// will be automatically created for each zone in this VPC. If `manual`, this VPC will be created with no default +// address prefixes. +// +// Since address prefixes are managed identically regardless of whether they were automatically created, the value is +// not preserved as a VPC property. +const ( + CreateVPCOptionsAddressPrefixManagementAutoConst = "auto" + CreateVPCOptionsAddressPrefixManagementManualConst = "manual" +) + +// NewCreateVPCOptions : Instantiate CreateVPCOptions +func (*VpcV1) NewCreateVPCOptions() *CreateVPCOptions { + return &CreateVPCOptions{} +} + +// SetAddressPrefixManagement : Allow user to set AddressPrefixManagement +func (_options *CreateVPCOptions) SetAddressPrefixManagement(addressPrefixManagement string) *CreateVPCOptions { + _options.AddressPrefixManagement = core.StringPtr(addressPrefixManagement) + return _options +} + +// SetClassicAccess : Allow user to set ClassicAccess +func (_options *CreateVPCOptions) SetClassicAccess(classicAccess bool) *CreateVPCOptions { + _options.ClassicAccess = core.BoolPtr(classicAccess) + return _options +} + +// SetDns : Allow user to set Dns +func (_options *CreateVPCOptions) SetDns(dns *VpcdnsPrototype) *CreateVPCOptions { + _options.Dns = dns + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCOptions) SetName(name string) *CreateVPCOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateVPCOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVPCOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCOptions) SetHeaders(param map[string]string) *CreateVPCOptions { + options.Headers = param + return options +} + +// CreateVPCRouteOptions : The CreateVPCRoute options. +type CreateVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The destination CIDR of the route. The host identifier in the CIDR must be zero. + // + // At most two routes per `zone` in a table can have the same `destination` and + // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. + Destination *string `json:"destination" validate:"required"` + + // The zone to apply the route 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 ZoneIdentityIntf `json:"zone" validate:"required"` + + // 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. + Action *string `json:"action,omitempty"` + + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // All routes in a routing table with the same `destination` and `zone` must have the same + // `advertise` value. + Advertise *bool `json:"advertise,omitempty"` + + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` + // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For other + // `action` values, it must be omitted or specified as `0.0.0.0`. + // + // At most two routes per `zone` in a table can have the same `destination` and `priority`, + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. + NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + + // 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,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPCRouteOptions.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. +const ( + CreateVPCRouteOptionsActionDelegateConst = "delegate" + CreateVPCRouteOptionsActionDelegateVPCConst = "delegate_vpc" + CreateVPCRouteOptionsActionDeliverConst = "deliver" + CreateVPCRouteOptionsActionDropConst = "drop" +) + +// NewCreateVPCRouteOptions : Instantiate CreateVPCRouteOptions +func (*VpcV1) NewCreateVPCRouteOptions(vpcID string, destination string, zone ZoneIdentityIntf) *CreateVPCRouteOptions { + return &CreateVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + Destination: core.StringPtr(destination), + Zone: zone, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *CreateVPCRouteOptions) SetVPCID(vpcID string) *CreateVPCRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetDestination : Allow user to set Destination +func (_options *CreateVPCRouteOptions) SetDestination(destination string) *CreateVPCRouteOptions { + _options.Destination = core.StringPtr(destination) + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateVPCRouteOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCRouteOptions { + _options.Zone = zone + return _options +} + +// SetAction : Allow user to set Action +func (_options *CreateVPCRouteOptions) SetAction(action string) *CreateVPCRouteOptions { + _options.Action = core.StringPtr(action) + return _options +} + +// SetAdvertise : Allow user to set Advertise +func (_options *CreateVPCRouteOptions) SetAdvertise(advertise bool) *CreateVPCRouteOptions { + _options.Advertise = core.BoolPtr(advertise) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCRouteOptions) SetName(name string) *CreateVPCRouteOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetNextHop : Allow user to set NextHop +func (_options *CreateVPCRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopIntf) *CreateVPCRouteOptions { + _options.NextHop = nextHop + return _options +} + +// SetPriority : Allow user to set Priority +func (_options *CreateVPCRouteOptions) SetPriority(priority int64) *CreateVPCRouteOptions { + _options.Priority = core.Int64Ptr(priority) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCRouteOptions) SetHeaders(param map[string]string) *CreateVPCRouteOptions { + options.Headers = param + return options +} + +// CreateVPCRoutingTableOptions : The CreateVPCRoutingTable options. +type CreateVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // 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 `vpn_server` value is supported, but filter + // support is expected to expand in the future. + 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 + // sources. + AdvertiseRoutesTo []string `json:"advertise_routes_to,omitempty"` + + // The name for this routing table. The name must not be used by another routing table in the VPC. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // If set to `true`, this routing table will be used to route traffic that originates from [Direct + // Link](https://cloud.ibm.com/docs/dl) to this VPC. The VPC must not already have a routing table with this property + // set to `true`. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + // + // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled + // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing + // table. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` + + // If set to `true`, this routing table will be used to route traffic that originates from the internet. For this to + // succeed, the VPC must not already have a routing table with this property set to `true`. + // + // Incoming traffic will be routed according to the routing table with two exceptions: + // - Traffic destined for IP addresses associated with public gateways will not be + // subject to routes in this routing table. + // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is + // an IP address in a subnet in the route's `zone` that is able to accept traffic. + // Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"` + + // If set to `true`, this routing table will be used to route traffic that originates from [Transit + // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. The VPC must not already have a routing table with + // this property set to `true`. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` + + // If set to `true`, this routing table will be used to route traffic that originates from subnets in other zones in + // this VPC. The VPC must not already have a routing table with this property set to `true`. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` + + // The prototype objects for routes to create for this routing table. If unspecified, the routing table will be created + // with no routes. + Routes []RoutePrototype `json:"routes,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPCRoutingTableOptions.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + CreateVPCRoutingTableOptionsAdvertiseRoutesToDirectLinkConst = "direct_link" + CreateVPCRoutingTableOptionsAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + +// NewCreateVPCRoutingTableOptions : Instantiate CreateVPCRoutingTableOptions +func (*VpcV1) NewCreateVPCRoutingTableOptions(vpcID string) *CreateVPCRoutingTableOptions { + return &CreateVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *CreateVPCRoutingTableOptions) SetVPCID(vpcID string) *CreateVPCRoutingTableOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetAcceptRoutesFrom : Allow user to set AcceptRoutesFrom +func (_options *CreateVPCRoutingTableOptions) SetAcceptRoutesFrom(acceptRoutesFrom []ResourceFilter) *CreateVPCRoutingTableOptions { + _options.AcceptRoutesFrom = acceptRoutesFrom + return _options +} + +// SetAdvertiseRoutesTo : Allow user to set AdvertiseRoutesTo +func (_options *CreateVPCRoutingTableOptions) SetAdvertiseRoutesTo(advertiseRoutesTo []string) *CreateVPCRoutingTableOptions { + _options.AdvertiseRoutesTo = advertiseRoutesTo + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCRoutingTableOptions) SetName(name string) *CreateVPCRoutingTableOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetRouteDirectLinkIngress : Allow user to set RouteDirectLinkIngress +func (_options *CreateVPCRoutingTableOptions) SetRouteDirectLinkIngress(routeDirectLinkIngress bool) *CreateVPCRoutingTableOptions { + _options.RouteDirectLinkIngress = core.BoolPtr(routeDirectLinkIngress) + return _options +} + +// SetRouteInternetIngress : Allow user to set RouteInternetIngress +func (_options *CreateVPCRoutingTableOptions) SetRouteInternetIngress(routeInternetIngress bool) *CreateVPCRoutingTableOptions { + _options.RouteInternetIngress = core.BoolPtr(routeInternetIngress) + return _options +} + +// SetRouteTransitGatewayIngress : Allow user to set RouteTransitGatewayIngress +func (_options *CreateVPCRoutingTableOptions) SetRouteTransitGatewayIngress(routeTransitGatewayIngress bool) *CreateVPCRoutingTableOptions { + _options.RouteTransitGatewayIngress = core.BoolPtr(routeTransitGatewayIngress) + return _options +} + +// SetRouteVPCZoneIngress : Allow user to set RouteVPCZoneIngress +func (_options *CreateVPCRoutingTableOptions) SetRouteVPCZoneIngress(routeVPCZoneIngress bool) *CreateVPCRoutingTableOptions { + _options.RouteVPCZoneIngress = core.BoolPtr(routeVPCZoneIngress) + return _options +} + +// SetRoutes : Allow user to set Routes +func (_options *CreateVPCRoutingTableOptions) SetRoutes(routes []RoutePrototype) *CreateVPCRoutingTableOptions { + _options.Routes = routes + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCRoutingTableOptions) SetHeaders(param map[string]string) *CreateVPCRoutingTableOptions { + options.Headers = param + return options +} + +// CreateVPCRoutingTableRouteOptions : The CreateVPCRoutingTableRoute options. +type CreateVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` + + // The destination CIDR of the route. The host identifier in the CIDR must be zero. + // + // At most two routes per `zone` in a table can have the same `destination` and + // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. + Destination *string `json:"destination" validate:"required"` + + // The zone to apply the route 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 ZoneIdentityIntf `json:"zone" validate:"required"` + + // 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. + Action *string `json:"action,omitempty"` + + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // All routes in a routing table with the same `destination` and `zone` must have the same + // `advertise` value. + Advertise *bool `json:"advertise,omitempty"` + + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` + // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For other + // `action` values, it must be omitted or specified as `0.0.0.0`. + // + // At most two routes per `zone` in a table can have the same `destination` and `priority`, + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. + NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + + // 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,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPCRoutingTableRouteOptions.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. +const ( + CreateVPCRoutingTableRouteOptionsActionDelegateConst = "delegate" + CreateVPCRoutingTableRouteOptionsActionDelegateVPCConst = "delegate_vpc" + CreateVPCRoutingTableRouteOptionsActionDeliverConst = "deliver" + CreateVPCRoutingTableRouteOptionsActionDropConst = "drop" +) + +// NewCreateVPCRoutingTableRouteOptions : Instantiate CreateVPCRoutingTableRouteOptions +func (*VpcV1) NewCreateVPCRoutingTableRouteOptions(vpcID string, routingTableID string, destination string, zone ZoneIdentityIntf) *CreateVPCRoutingTableRouteOptions { + return &CreateVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + Destination: core.StringPtr(destination), + Zone: zone, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *CreateVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *CreateVPCRoutingTableRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *CreateVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *CreateVPCRoutingTableRouteOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetDestination : Allow user to set Destination +func (_options *CreateVPCRoutingTableRouteOptions) SetDestination(destination string) *CreateVPCRoutingTableRouteOptions { + _options.Destination = core.StringPtr(destination) + return _options +} + +// SetZone : Allow user to set Zone +func (_options *CreateVPCRoutingTableRouteOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCRoutingTableRouteOptions { + _options.Zone = zone + return _options +} + +// SetAction : Allow user to set Action +func (_options *CreateVPCRoutingTableRouteOptions) SetAction(action string) *CreateVPCRoutingTableRouteOptions { + _options.Action = core.StringPtr(action) + return _options +} + +// SetAdvertise : Allow user to set Advertise +func (_options *CreateVPCRoutingTableRouteOptions) SetAdvertise(advertise bool) *CreateVPCRoutingTableRouteOptions { + _options.Advertise = core.BoolPtr(advertise) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPCRoutingTableRouteOptions) SetName(name string) *CreateVPCRoutingTableRouteOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetNextHop : Allow user to set NextHop +func (_options *CreateVPCRoutingTableRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopIntf) *CreateVPCRoutingTableRouteOptions { + _options.NextHop = nextHop + return _options +} + +// SetPriority : Allow user to set Priority +func (_options *CreateVPCRoutingTableRouteOptions) SetPriority(priority int64) *CreateVPCRoutingTableRouteOptions { + _options.Priority = core.Int64Ptr(priority) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *CreateVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// CreateVPNGatewayConnectionOptions : The CreateVPNGatewayConnection options. +type CreateVPNGatewayConnectionOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection prototype object. + VPNGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf `json:"VPNGatewayConnectionPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVPNGatewayConnectionOptions : Instantiate CreateVPNGatewayConnectionOptions +func (*VpcV1) NewCreateVPNGatewayConnectionOptions(vpnGatewayID string, vpnGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf) *CreateVPNGatewayConnectionOptions { + return &CreateVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + VPNGatewayConnectionPrototype: vpnGatewayConnectionPrototype, + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *CreateVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *CreateVPNGatewayConnectionOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetVPNGatewayConnectionPrototype : Allow user to set VPNGatewayConnectionPrototype +func (_options *CreateVPNGatewayConnectionOptions) SetVPNGatewayConnectionPrototype(vpnGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf) *CreateVPNGatewayConnectionOptions { + _options.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *CreateVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// CreateVPNGatewayOptions : The CreateVPNGateway options. +type CreateVPNGatewayOptions struct { + // The VPN gateway prototype object. + VPNGatewayPrototype VPNGatewayPrototypeIntf `json:"VPNGatewayPrototype" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVPNGatewayOptions : Instantiate CreateVPNGatewayOptions +func (*VpcV1) NewCreateVPNGatewayOptions(vpnGatewayPrototype VPNGatewayPrototypeIntf) *CreateVPNGatewayOptions { + return &CreateVPNGatewayOptions{ + VPNGatewayPrototype: vpnGatewayPrototype, + } +} + +// SetVPNGatewayPrototype : Allow user to set VPNGatewayPrototype +func (_options *CreateVPNGatewayOptions) SetVPNGatewayPrototype(vpnGatewayPrototype VPNGatewayPrototypeIntf) *CreateVPNGatewayOptions { + _options.VPNGatewayPrototype = vpnGatewayPrototype + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNGatewayOptions) SetHeaders(param map[string]string) *CreateVPNGatewayOptions { + options.Headers = param + return options +} + +// CreateVPNServerOptions : The CreateVPNServer options. +type CreateVPNServerOptions struct { + // The certificate instance for this VPN server. + Certificate CertificateInstanceIdentityIntf `json:"certificate" validate:"required"` + + // The methods used to authenticate VPN clients to this VPN server. VPN clients must authenticate against all specified + // methods. + ClientAuthentication []VPNServerAuthenticationPrototypeIntf `json:"client_authentication" validate:"required"` + + // The VPN client IPv4 address pool, expressed in CIDR format. The request must not overlap with any existing address + // prefixes in the VPC or any of the following reserved address ranges: + // - `127.0.0.0/8` (IPv4 loopback addresses) + // - `161.26.0.0/16` (IBM services) + // - `166.8.0.0/14` (Cloud Service Endpoints) + // - `169.254.0.0/16` (IPv4 link-local addresses) + // - `224.0.0.0/4` (IPv4 multicast addresses) + // + // The prefix length of the client IP address pool's CIDR must be between + // `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that contains twice the number of IP addresses + // that are required to enable the maximum number of concurrent connections is recommended. + ClientIPPool *string `json:"client_ip_pool" validate:"required"` + + // The subnets to provision this VPN server in. Use subnets in different zones for high availability. + Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` + + // The DNS server addresses that will be provided to VPN clients connected to this VPN server. + ClientDnsServerIps []IP `json:"client_dns_server_ips,omitempty"` + + // The seconds a VPN client can be idle before this VPN server will disconnect it. Specify `0` to prevent the server + // from disconnecting idle clients. + ClientIdleTimeout *int64 `json:"client_idle_timeout,omitempty"` + + // Indicates whether the split tunneling is enabled on this VPN server. + EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"` + + // The name for this VPN server. The name must not be used by another VPN server in the VPC. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The port number to use for this VPN server. + Port *int64 `json:"port,omitempty"` + + // The transport protocol to use for this VPN server. + Protocol *string `json:"protocol,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 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 + Headers map[string]string +} + +// Constants associated with the CreateVPNServerOptions.Protocol property. +// The transport protocol to use for this VPN server. +const ( + CreateVPNServerOptionsProtocolTCPConst = "tcp" + CreateVPNServerOptionsProtocolUDPConst = "udp" +) + +// NewCreateVPNServerOptions : Instantiate CreateVPNServerOptions +func (*VpcV1) NewCreateVPNServerOptions(certificate CertificateInstanceIdentityIntf, clientAuthentication []VPNServerAuthenticationPrototypeIntf, clientIPPool string, subnets []SubnetIdentityIntf) *CreateVPNServerOptions { + return &CreateVPNServerOptions{ + Certificate: certificate, + ClientAuthentication: clientAuthentication, + ClientIPPool: core.StringPtr(clientIPPool), + Subnets: subnets, + } +} + +// SetCertificate : Allow user to set Certificate +func (_options *CreateVPNServerOptions) SetCertificate(certificate CertificateInstanceIdentityIntf) *CreateVPNServerOptions { + _options.Certificate = certificate + return _options +} + +// SetClientAuthentication : Allow user to set ClientAuthentication +func (_options *CreateVPNServerOptions) SetClientAuthentication(clientAuthentication []VPNServerAuthenticationPrototypeIntf) *CreateVPNServerOptions { + _options.ClientAuthentication = clientAuthentication + return _options +} + +// SetClientIPPool : Allow user to set ClientIPPool +func (_options *CreateVPNServerOptions) SetClientIPPool(clientIPPool string) *CreateVPNServerOptions { + _options.ClientIPPool = core.StringPtr(clientIPPool) + return _options +} + +// SetSubnets : Allow user to set Subnets +func (_options *CreateVPNServerOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateVPNServerOptions { + _options.Subnets = subnets + return _options +} + +// SetClientDnsServerIps : Allow user to set ClientDnsServerIps +func (_options *CreateVPNServerOptions) SetClientDnsServerIps(clientDnsServerIps []IP) *CreateVPNServerOptions { + _options.ClientDnsServerIps = clientDnsServerIps + return _options +} + +// SetClientIdleTimeout : Allow user to set ClientIdleTimeout +func (_options *CreateVPNServerOptions) SetClientIdleTimeout(clientIdleTimeout int64) *CreateVPNServerOptions { + _options.ClientIdleTimeout = core.Int64Ptr(clientIdleTimeout) + return _options +} + +// SetEnableSplitTunneling : Allow user to set EnableSplitTunneling +func (_options *CreateVPNServerOptions) SetEnableSplitTunneling(enableSplitTunneling bool) *CreateVPNServerOptions { + _options.EnableSplitTunneling = core.BoolPtr(enableSplitTunneling) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPNServerOptions) SetName(name string) *CreateVPNServerOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPort : Allow user to set Port +func (_options *CreateVPNServerOptions) SetPort(port int64) *CreateVPNServerOptions { + _options.Port = core.Int64Ptr(port) + return _options +} + +// SetProtocol : Allow user to set Protocol +func (_options *CreateVPNServerOptions) SetProtocol(protocol string) *CreateVPNServerOptions { + _options.Protocol = core.StringPtr(protocol) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateVPNServerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVPNServerOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateVPNServerOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateVPNServerOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNServerOptions) SetHeaders(param map[string]string) *CreateVPNServerOptions { + options.Headers = param + return options +} + +// CreateVPNServerRouteOptions : The CreateVPNServerRoute options. +type CreateVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The destination to use for this VPN route in the VPN server. Must be unique within the VPN server. If an incoming + // packet does not match any destination, it will be dropped. + Destination *string `json:"destination" validate:"required"` + + // The action to perform with a packet matching the VPN route: + // - `translate`: translate the source IP address to one of the private IP addresses of the VPN server, then deliver + // the packet to target. + // - `deliver`: deliver the packet to the target. + // - `drop`: drop the packet + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the + // unexpected property value was encountered. + Action *string `json:"action,omitempty"` + + // The name for this VPN server route. The name must not be used by another route for the VPN server. 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 +} + +// Constants associated with the CreateVPNServerRouteOptions.Action property. +// The action to perform with a packet matching the VPN route: +// - `translate`: translate the source IP address to one of the private IP addresses of the VPN server, then deliver the +// packet to target. +// - `deliver`: deliver the packet to the target. +// - `drop`: drop the packet +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the +// unexpected property value was encountered. +const ( + CreateVPNServerRouteOptionsActionDeliverConst = "deliver" + CreateVPNServerRouteOptionsActionDropConst = "drop" + CreateVPNServerRouteOptionsActionTranslateConst = "translate" +) + +// NewCreateVPNServerRouteOptions : Instantiate CreateVPNServerRouteOptions +func (*VpcV1) NewCreateVPNServerRouteOptions(vpnServerID string, destination string) *CreateVPNServerRouteOptions { + return &CreateVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + Destination: core.StringPtr(destination), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *CreateVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *CreateVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetDestination : Allow user to set Destination +func (_options *CreateVPNServerRouteOptions) SetDestination(destination string) *CreateVPNServerRouteOptions { + _options.Destination = core.StringPtr(destination) + return _options +} + +// SetAction : Allow user to set Action +func (_options *CreateVPNServerRouteOptions) SetAction(action string) *CreateVPNServerRouteOptions { + _options.Action = core.StringPtr(action) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPNServerRouteOptions) SetName(name string) *CreateVPNServerRouteOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNServerRouteOptions) SetHeaders(param map[string]string) *CreateVPNServerRouteOptions { + options.Headers = param + return options +} + +// DnsInstanceIdentity : Identifies a DNS instance by a unique property. +// Models which "extend" this model: +// - DnsInstanceIdentityByCRN +type DnsInstanceIdentity struct { + // The CRN for this DNS instance. + CRN *string `json:"crn,omitempty"` +} + +func (*DnsInstanceIdentity) isaDnsInstanceIdentity() bool { + return true +} + +type DnsInstanceIdentityIntf interface { + isaDnsInstanceIdentity() bool +} + +// UnmarshalDnsInstanceIdentity unmarshals an instance of DnsInstanceIdentity from the specified map of raw messages. +func UnmarshalDnsInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsInstanceIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsInstanceReference : DnsInstanceReference struct +type DnsInstanceReference struct { + // The CRN for this DNS instance. + CRN *string `json:"crn" validate:"required"` +} + +// UnmarshalDnsInstanceReference unmarshals an instance of DnsInstanceReference from the specified map of raw messages. +func UnmarshalDnsInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsServer : A DNS server. +type DnsServer struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // If present, DHCP configuration for this zone will have this DNS server listed first. + ZoneAffinity *ZoneReference `json:"zone_affinity,omitempty"` +} + +// UnmarshalDnsServer unmarshals an instance of DnsServer from the specified map of raw messages. +func UnmarshalDnsServer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsServer) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsServerPrototype : DnsServerPrototype struct +type DnsServerPrototype struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // DHCP configuration for the specified zone will have this DNS server listed first. + ZoneAffinity ZoneIdentityIntf `json:"zone_affinity,omitempty"` +} + +// NewDnsServerPrototype : Instantiate DnsServerPrototype (Generic Model Constructor) +func (*VpcV1) NewDnsServerPrototype(address string) (_model *DnsServerPrototype, err error) { + _model = &DnsServerPrototype{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalDnsServerPrototype unmarshals an instance of DnsServerPrototype from the specified map of raw messages. +func UnmarshalDnsServerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsServerPrototype) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsZoneIdentity : Identifies a DNS zone by a unique property. +// Models which "extend" this model: +// - DnsZoneIdentityByID +type DnsZoneIdentity struct { + ID *string `json:"id,omitempty"` +} + +func (*DnsZoneIdentity) isaDnsZoneIdentity() bool { + return true +} + +type DnsZoneIdentityIntf interface { + isaDnsZoneIdentity() bool +} + +// UnmarshalDnsZoneIdentity unmarshals an instance of DnsZoneIdentity from the specified map of raw messages. +func UnmarshalDnsZoneIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsZoneIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsZoneReference : DnsZoneReference struct +type DnsZoneReference struct { + ID *string `json:"id" validate:"required"` +} + +// UnmarshalDnsZoneReference unmarshals an instance of DnsZoneReference from the specified map of raw messages. +func UnmarshalDnsZoneReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsZoneReference) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHost : DedicatedHost struct +type DedicatedHost struct { + // The amount of memory in gibibytes that is currently available for instances. + AvailableMemory *int64 `json:"available_memory" validate:"required"` + + // The available VCPU for the dedicated host. + AvailableVcpu *Vcpu `json:"available_vcpu" validate:"required"` + + // The date and time that the dedicated host was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` + + // Collection of the dedicated host's disks. + Disks []DedicatedHostDisk `json:"disks" validate:"required"` + + // The dedicated host group this dedicated host is in. + Group *DedicatedHostGroupReference `json:"group" validate:"required"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` + + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled" validate:"required"` + + // The instances that are allocated to this dedicated host. + Instances []InstanceReference `json:"instances" validate:"required"` + + // The lifecycle state of the dedicated host. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The total amount of memory in gibibytes for this host. + Memory *int64 `json:"memory" validate:"required"` + + // The name for this dedicated host. The name is unique across all dedicated hosts in the region. + Name *string `json:"name" validate:"required"` + + // The dedicated host NUMA configuration. + Numa *DedicatedHostNuma `json:"numa" validate:"required"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) for this + // dedicated host. + Profile *DedicatedHostProfileReference `json:"profile" validate:"required"` + + // Indicates whether this dedicated host is available for instance creation. + Provisionable *bool `json:"provisionable" validate:"required"` + + // The resource group for this dedicated host. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The total number of sockets for this host. + SocketCount *int64 `json:"socket_count" validate:"required"` + + // The administrative state of the dedicated host. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the dedicated host on which + // the unexpected property value was encountered. + State *string `json:"state" validate:"required"` + + // The instance profiles usable by instances placed on this dedicated host. + SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` + + // The total VCPU of the dedicated host. + Vcpu *Vcpu `json:"vcpu" validate:"required"` + + // The zone this dedicated host resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the DedicatedHost.LifecycleState property. +// The lifecycle state of the dedicated host. +const ( + DedicatedHostLifecycleStateDeletingConst = "deleting" + DedicatedHostLifecycleStateFailedConst = "failed" + DedicatedHostLifecycleStatePendingConst = "pending" + DedicatedHostLifecycleStateStableConst = "stable" + DedicatedHostLifecycleStateSuspendedConst = "suspended" + DedicatedHostLifecycleStateUpdatingConst = "updating" + DedicatedHostLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the DedicatedHost.ResourceType property. +// The resource type. +const ( + DedicatedHostResourceTypeDedicatedHostConst = "dedicated_host" +) + +// Constants associated with the DedicatedHost.State property. +// The administrative state of the dedicated host. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the dedicated host on which +// the unexpected property value was encountered. +const ( + DedicatedHostStateAvailableConst = "available" + DedicatedHostStateDegradedConst = "degraded" + DedicatedHostStateMigratingConst = "migrating" + DedicatedHostStateUnavailableConst = "unavailable" +) + +// UnmarshalDedicatedHost unmarshals an instance of DedicatedHost from the specified map of raw messages. +func UnmarshalDedicatedHost(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHost) + err = core.UnmarshalPrimitive(m, "available_memory", &obj.AvailableMemory) + if err != nil { + return + } + err = core.UnmarshalModel(m, "available_vcpu", &obj.AvailableVcpu, UnmarshalVcpu) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "numa", &obj.Numa, UnmarshalDedicatedHostNuma) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalVcpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostCollection : DedicatedHostCollection struct +type DedicatedHostCollection struct { + // Collection of dedicated hosts. + DedicatedHosts []DedicatedHost `json:"dedicated_hosts" validate:"required"` + + // A link to the first page of resources. + First *DedicatedHostCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalDedicatedHostCollection unmarshals an instance of DedicatedHostCollection from the specified map of raw messages. +func UnmarshalDedicatedHostCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostCollection) + err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHost) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *DedicatedHostCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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). + Available *int64 `json:"available" validate:"required"` + + // The date and time that the disk was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this disk. + ID *string `json:"id" validate:"required"` + + // Instance disks that are on this dedicated host disk. + InstanceDisks []InstanceDiskReference `json:"instance_disks" validate:"required"` + + // The disk interface used for attaching the disk + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The lifecycle state of this dedicated host disk. + LifecycleState *string `json:"lifecycle_state,omitempty"` + + // The name for this dedicated host disk. The name is unique across all disks on the dedicated host. + Name *string `json:"name" validate:"required"` + + // Indicates whether this dedicated host disk is available for instance disk creation. + Provisionable *bool `json:"provisionable" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *int64 `json:"size" validate:"required"` + + // The instance disk interfaces supported for this dedicated host disk. + SupportedInstanceInterfaceTypes []string `json:"supported_instance_interface_types" validate:"required"` +} + +// Constants associated with the DedicatedHostDisk.InterfaceType property. +// The disk interface used for attaching the disk +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostDiskInterfaceTypeNvmeConst = "nvme" +) + +// Constants associated with the DedicatedHostDisk.LifecycleState property. +// The lifecycle state of this dedicated host disk. +const ( + DedicatedHostDiskLifecycleStateDeletingConst = "deleting" + DedicatedHostDiskLifecycleStateFailedConst = "failed" + DedicatedHostDiskLifecycleStatePendingConst = "pending" + DedicatedHostDiskLifecycleStateStableConst = "stable" + DedicatedHostDiskLifecycleStateSuspendedConst = "suspended" + DedicatedHostDiskLifecycleStateUpdatingConst = "updating" + DedicatedHostDiskLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the DedicatedHostDisk.ResourceType property. +// The resource type. +const ( + DedicatedHostDiskResourceTypeDedicatedHostDiskConst = "dedicated_host_disk" +) + +// Constants associated with the DedicatedHostDisk.SupportedInstanceInterfaceTypes property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostDiskSupportedInstanceInterfaceTypesNvmeConst = "nvme" + DedicatedHostDiskSupportedInstanceInterfaceTypesVirtioBlkConst = "virtio_blk" +) + +// UnmarshalDedicatedHostDisk unmarshals an instance of DedicatedHostDisk from the specified map of raw messages. +func UnmarshalDedicatedHostDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostDisk) + err = core.UnmarshalPrimitive(m, "available", &obj.Available) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_disks", &obj.InstanceDisks, UnmarshalInstanceDiskReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostDiskCollection : DedicatedHostDiskCollection struct +type DedicatedHostDiskCollection struct { + // Collection of the dedicated host's disks. + Disks []DedicatedHostDisk `json:"disks" validate:"required"` +} + +// UnmarshalDedicatedHostDiskCollection unmarshals an instance of DedicatedHostDiskCollection from the specified map of raw messages. +func UnmarshalDedicatedHostDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostDiskCollection) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostDiskPatch : DedicatedHostDiskPatch struct +type DedicatedHostDiskPatch struct { + // The name for this dedicated host disk. The name must not be used by another disk on the dedicated host. + Name *string `json:"name,omitempty"` +} + +// UnmarshalDedicatedHostDiskPatch unmarshals an instance of DedicatedHostDiskPatch from the specified map of raw messages. +func UnmarshalDedicatedHostDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostDiskPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// DedicatedHostGroup : DedicatedHostGroup struct +type DedicatedHostGroup struct { + // The dedicated host profile class for hosts in this group. + Class *string `json:"class" validate:"required"` + + // The date and time that the dedicated host group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` + + // The dedicated hosts that are in this dedicated host group. + DedicatedHosts []DedicatedHostReference `json:"dedicated_hosts" validate:"required"` + + // The dedicated host profile family for hosts in this group. + Family *string `json:"family" validate:"required"` + + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` + + // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. + Name *string `json:"name" validate:"required"` + + // The resource group for this dedicated host group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The instance profiles usable by instances placed on this dedicated host group. + SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` + + // The zone this dedicated host group resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the DedicatedHostGroup.Family property. +// The dedicated host profile family for hosts in this group. +const ( + DedicatedHostGroupFamilyBalancedConst = "balanced" + DedicatedHostGroupFamilyComputeConst = "compute" + DedicatedHostGroupFamilyMemoryConst = "memory" +) + +// Constants associated with the DedicatedHostGroup.ResourceType property. +// The resource type. +const ( + DedicatedHostGroupResourceTypeDedicatedHostGroupConst = "dedicated_host_group" +) + +// UnmarshalDedicatedHostGroup unmarshals an instance of DedicatedHostGroup from the specified map of raw messages. +func UnmarshalDedicatedHostGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroup) + err = core.UnmarshalPrimitive(m, "class", &obj.Class) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHostReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupCollection : DedicatedHostGroupCollection struct +type DedicatedHostGroupCollection struct { + // A link to the first page of resources. + First *DedicatedHostGroupCollectionFirst `json:"first" validate:"required"` + + // Collection of dedicated host groups. + Groups []DedicatedHostGroup `json:"groups" 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 *DedicatedHostGroupCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "groups", &obj.Groups, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *DedicatedHostGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 +// - DedicatedHostGroupIdentityByCRN +// - DedicatedHostGroupIdentityByHref +type DedicatedHostGroupIdentity struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host group. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href,omitempty"` +} + +func (*DedicatedHostGroupIdentity) isaDedicatedHostGroupIdentity() bool { + return true +} + +type DedicatedHostGroupIdentityIntf interface { + isaDedicatedHostGroupIdentity() bool +} + +// UnmarshalDedicatedHostGroupIdentity unmarshals an instance of DedicatedHostGroupIdentity from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupPatch : DedicatedHostGroupPatch struct +type DedicatedHostGroupPatch struct { + // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. + Name *string `json:"name,omitempty"` +} + +// UnmarshalDedicatedHostGroupPatch unmarshals an instance of DedicatedHostGroupPatch from the specified map of raw messages. +func UnmarshalDedicatedHostGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// DedicatedHostGroupPrototypeDedicatedHostByZoneContext : DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct +type DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct { + // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. 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 host's resource group is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` +} + +// UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext unmarshals an instance of DedicatedHostGroupPrototypeDedicatedHostByZoneContext from the specified map of raw messages. +func UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupPrototypeDedicatedHostByZoneContext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupReference : DedicatedHostGroupReference struct +type DedicatedHostGroupReference struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` + + // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the DedicatedHostGroupReference.ResourceType property. +// The resource type. +const ( + DedicatedHostGroupReferenceResourceTypeDedicatedHostGroupConst = "dedicated_host_group" +) + +// UnmarshalDedicatedHostGroupReference unmarshals an instance of DedicatedHostGroupReference from the specified map of raw messages. +func UnmarshalDedicatedHostGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type DedicatedHostGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalDedicatedHostGroupReferenceDeleted unmarshals an instance of DedicatedHostGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalDedicatedHostGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostNuma : The dedicated host NUMA configuration. +type DedicatedHostNuma struct { + // The total number of NUMA nodes for this dedicated host. + Count *int64 `json:"count" validate:"required"` + + // The NUMA nodes for this dedicated host. + Nodes []DedicatedHostNumaNode `json:"nodes" validate:"required"` +} + +// UnmarshalDedicatedHostNuma unmarshals an instance of DedicatedHostNuma from the specified map of raw messages. +func UnmarshalDedicatedHostNuma(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostNuma) + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalModel(m, "nodes", &obj.Nodes, UnmarshalDedicatedHostNumaNode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostNumaNode : The dedicated host NUMA node configuration. +type DedicatedHostNumaNode struct { + // The available VCPU for this NUMA node. + AvailableVcpu *int64 `json:"available_vcpu" validate:"required"` + + // The total VCPU capacity for this NUMA node. + Vcpu *int64 `json:"vcpu" validate:"required"` +} + +// UnmarshalDedicatedHostNumaNode unmarshals an instance of DedicatedHostNumaNode from the specified map of raw messages. +func UnmarshalDedicatedHostNumaNode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostNumaNode) + err = core.UnmarshalPrimitive(m, "available_vcpu", &obj.AvailableVcpu) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vcpu", &obj.Vcpu) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPatch : DedicatedHostPatch struct +type DedicatedHostPatch struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The name for this dedicated host. The name must not be used by another dedicated host in the region. + Name *string `json:"name,omitempty"` +} + +// UnmarshalDedicatedHostPatch unmarshals an instance of DedicatedHostPatch from the specified map of raw messages. +func UnmarshalDedicatedHostPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPatch) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// DedicatedHostProfile : DedicatedHostProfile struct +type DedicatedHostProfile struct { + // The product class this dedicated host profile belongs to. + Class *string `json:"class" validate:"required"` + + // Collection of the dedicated host profile's disks. + Disks []DedicatedHostProfileDisk `json:"disks" validate:"required"` + + // The product family this dedicated host profile belongs to + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Family *string `json:"family" validate:"required"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + Memory DedicatedHostProfileMemoryIntf `json:"memory" validate:"required"` + + // The globally unique name for this dedicated host profile. + Name *string `json:"name" validate:"required"` + + SocketCount DedicatedHostProfileSocketIntf `json:"socket_count" validate:"required"` + + // The status of the dedicated host profile: + // - `previous`: This dedicated host profile is an older revision, but remains provisionable + // and usable. + // - `current`: This profile is the latest revision. + // + // Note that revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming + // conventions] + // (https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information on how + // generations are defined within a dedicated host profile. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + + // The instance profiles usable by instances placed on dedicated hosts with this profile. + SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` + + VcpuArchitecture *DedicatedHostProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` + + VcpuCount DedicatedHostProfileVcpuIntf `json:"vcpu_count" validate:"required"` + + VcpuManufacturer *DedicatedHostProfileVcpuManufacturer `json:"vcpu_manufacturer" validate:"required"` +} + +// Constants associated with the DedicatedHostProfile.Family property. +// The product family this dedicated host profile belongs to +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostProfileFamilyBalancedConst = "balanced" + DedicatedHostProfileFamilyComputeConst = "compute" + DedicatedHostProfileFamilyMemoryConst = "memory" +) + +// Constants associated with the DedicatedHostProfile.Status property. +// The status of the dedicated host profile: +// - `previous`: This dedicated host profile is an older revision, but remains provisionable +// and usable. +// - `current`: This profile is the latest revision. +// +// Note that revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming +// conventions] +// (https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information on how +// generations are defined within a dedicated host profile. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the +// unexpected property value was encountered. +const ( + DedicatedHostProfileStatusCurrentConst = "current" + DedicatedHostProfileStatusPreviousConst = "previous" +) + +// UnmarshalDedicatedHostProfile unmarshals an instance of DedicatedHostProfile from the specified map of raw messages. +func UnmarshalDedicatedHostProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfile) + err = core.UnmarshalPrimitive(m, "class", &obj.Class) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostProfileDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalDedicatedHostProfileMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "socket_count", &obj.SocketCount, UnmarshalDedicatedHostProfileSocket) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalDedicatedHostProfileVcpuArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalDedicatedHostProfileVcpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalDedicatedHostProfileVcpuManufacturer) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileCollection : DedicatedHostProfileCollection struct +type DedicatedHostProfileCollection struct { + // A link to the first page of resources. + First *DedicatedHostProfileCollectionFirst `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"` + + // Collection of dedicated host profiles. + Profiles []DedicatedHostProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalDedicatedHostProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *DedicatedHostProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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"` + + // The number of disks of this type for a dedicated host with this profile. + Quantity *DedicatedHostProfileDiskQuantity `json:"quantity" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *DedicatedHostProfileDiskSize `json:"size" validate:"required"` + + SupportedInstanceInterfaceTypes *DedicatedHostProfileDiskSupportedInterfaces `json:"supported_instance_interface_types" validate:"required"` +} + +// UnmarshalDedicatedHostProfileDisk unmarshals an instance of DedicatedHostProfileDisk from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDisk) + err = core.UnmarshalModel(m, "interface_type", &obj.InterfaceType, UnmarshalDedicatedHostProfileDiskInterface) + if err != nil { + return + } + err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalDedicatedHostProfileDiskQuantity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalDedicatedHostProfileDiskSize) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes, UnmarshalDedicatedHostProfileDiskSupportedInterfaces) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskInterface : DedicatedHostProfileDiskInterface struct +type DedicatedHostProfileDiskInterface struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The interface of the disk for a dedicated host with this profile + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskInterface.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskInterfaceTypeFixedConst = "fixed" +) + +// Constants associated with the DedicatedHostProfileDiskInterface.Value property. +// The interface of the disk for a dedicated host with this profile +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostProfileDiskInterfaceValueNvmeConst = "nvme" +) + +// UnmarshalDedicatedHostProfileDiskInterface unmarshals an instance of DedicatedHostProfileDiskInterface from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskInterface) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskQuantity : The number of disks of this type for a dedicated host with this profile. +type DedicatedHostProfileDiskQuantity struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskQuantity.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskQuantityTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileDiskQuantity unmarshals an instance of DedicatedHostProfileDiskQuantity from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskQuantity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskSize : The size of the disk in GB (gigabytes). +type DedicatedHostProfileDiskSize struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskSize.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskSizeTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileDiskSize unmarshals an instance of DedicatedHostProfileDiskSize from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskSize) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskSupportedInterfaces : DedicatedHostProfileDiskSupportedInterfaces struct +type DedicatedHostProfileDiskSupportedInterfaces struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The instance disk interfaces supported for a dedicated host with this profile. + Value []string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskSupportedInterfaces.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskSupportedInterfacesTypeFixedConst = "fixed" +) + +// Constants associated with the DedicatedHostProfileDiskSupportedInterfaces.Value property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostProfileDiskSupportedInterfacesValueNvmeConst = "nvme" + DedicatedHostProfileDiskSupportedInterfacesValueVirtioBlkConst = "virtio_blk" +) + +// UnmarshalDedicatedHostProfileDiskSupportedInterfaces unmarshals an instance of DedicatedHostProfileDiskSupportedInterfaces from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileIdentity : Identifies a dedicated host profile by a unique property. +// Models which "extend" this model: +// - DedicatedHostProfileIdentityByName +// - DedicatedHostProfileIdentityByHref +type DedicatedHostProfileIdentity struct { + // The globally unique name for this dedicated host profile. + Name *string `json:"name,omitempty"` + + // The URL for this dedicated host profile. + Href *string `json:"href,omitempty"` +} + +func (*DedicatedHostProfileIdentity) isaDedicatedHostProfileIdentity() bool { + return true +} + +type DedicatedHostProfileIdentityIntf interface { + isaDedicatedHostProfileIdentity() bool +} + +// UnmarshalDedicatedHostProfileIdentity unmarshals an instance of DedicatedHostProfileIdentity from the specified map of raw messages. +func UnmarshalDedicatedHostProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemory : DedicatedHostProfileMemory struct +// Models which "extend" this model: +// - DedicatedHostProfileMemoryFixed +// - DedicatedHostProfileMemoryRange +// - DedicatedHostProfileMemoryEnum +// - DedicatedHostProfileMemoryDependent +type DedicatedHostProfileMemory 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 DedicatedHostProfileMemory.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileMemory) isaDedicatedHostProfileMemory() bool { + return true +} + +type DedicatedHostProfileMemoryIntf interface { + isaDedicatedHostProfileMemory() bool +} + +// UnmarshalDedicatedHostProfileMemory unmarshals an instance of DedicatedHostProfileMemory from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileReference : DedicatedHostProfileReference struct +type DedicatedHostProfileReference struct { + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this dedicated host profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalDedicatedHostProfileReference unmarshals an instance of DedicatedHostProfileReference from the specified map of raw messages. +func UnmarshalDedicatedHostProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocket : DedicatedHostProfileSocket struct +// Models which "extend" this model: +// - DedicatedHostProfileSocketFixed +// - DedicatedHostProfileSocketRange +// - DedicatedHostProfileSocketEnum +// - DedicatedHostProfileSocketDependent +type DedicatedHostProfileSocket 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 DedicatedHostProfileSocket.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileSocket) isaDedicatedHostProfileSocket() bool { + return true +} + +type DedicatedHostProfileSocketIntf interface { + isaDedicatedHostProfileSocket() bool +} + +// UnmarshalDedicatedHostProfileSocket unmarshals an instance of DedicatedHostProfileSocket from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocket(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocket) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpu : DedicatedHostProfileVcpu struct +// Models which "extend" this model: +// - DedicatedHostProfileVcpuFixed +// - DedicatedHostProfileVcpuRange +// - DedicatedHostProfileVcpuEnum +// - DedicatedHostProfileVcpuDependent +type DedicatedHostProfileVcpu 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 DedicatedHostProfileVcpu.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileVcpu) isaDedicatedHostProfileVcpu() bool { + return true +} + +type DedicatedHostProfileVcpuIntf interface { + isaDedicatedHostProfileVcpu() bool +} + +// UnmarshalDedicatedHostProfileVcpu unmarshals an instance of DedicatedHostProfileVcpu from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpu) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuArchitecture : DedicatedHostProfileVcpuArchitecture struct +type DedicatedHostProfileVcpuArchitecture struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The VCPU architecture for a dedicated host with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuArchitecture.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuArchitectureTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileVcpuArchitecture unmarshals an instance of DedicatedHostProfileVcpuArchitecture from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuArchitecture) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuManufacturer : DedicatedHostProfileVcpuManufacturer struct +type DedicatedHostProfileVcpuManufacturer struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The VCPU manufacturer for a dedicated host with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuManufacturer.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuManufacturerTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileVcpuManufacturer unmarshals an instance of DedicatedHostProfileVcpuManufacturer from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuManufacturer) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPrototype : DedicatedHostPrototype struct +// Models which "extend" this model: +// - DedicatedHostPrototypeDedicatedHostByGroup +// - DedicatedHostPrototypeDedicatedHostByZone +type DedicatedHostPrototype struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this + // dedicated host. + Profile DedicatedHostProfileIdentityIntf `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"` + + // The dedicated host group for this dedicated host. + Group DedicatedHostGroupIdentityIntf `json:"group,omitempty"` + + // The zone this dedicated host will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +func (*DedicatedHostPrototype) isaDedicatedHostPrototype() bool { + return true +} + +type DedicatedHostPrototypeIntf interface { + isaDedicatedHostPrototype() bool +} + +// UnmarshalDedicatedHostPrototype unmarshals an instance of DedicatedHostPrototype from the specified map of raw messages. +func UnmarshalDedicatedHostPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPrototype) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostReference : DedicatedHostReference struct +type DedicatedHostReference struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` + + // The name for this dedicated host. The name is unique across all dedicated hosts in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the DedicatedHostReference.ResourceType property. +// The resource type. +const ( + DedicatedHostReferenceResourceTypeDedicatedHostConst = "dedicated_host" +) + +// UnmarshalDedicatedHostReference unmarshals an instance of DedicatedHostReference from the specified map of raw messages. +func UnmarshalDedicatedHostReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type DedicatedHostReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalDedicatedHostReferenceDeleted unmarshals an instance of DedicatedHostReferenceDeleted from the specified map of raw messages. +func UnmarshalDedicatedHostReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DefaultNetworkACL : DefaultNetworkACL struct +type DefaultNetworkACL struct { + // The date and time that the network ACL was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` + + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` + + // The name of the default network ACL created for a VPC. The name will be a hyphenated list of randomly-selected words + // at creation, but may be changed. + Name *string `json:"name" validate:"required"` + + // The resource group for the default network ACL for a VPC. Set to the VPC's + // resource group at creation. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The ordered rules for the default network ACL for a VPC. Defaults to two rules which allow all inbound and outbound + // traffic, respectively. Rules for the default network ACL may be changed, added, or removed. + Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` + + // The subnets to which this network ACL is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The VPC this network ACL resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalDefaultNetworkACL unmarshals an instance of DefaultNetworkACL from the specified map of raw messages. +func UnmarshalDefaultNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DefaultNetworkACL) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DefaultRoutingTable : DefaultRoutingTable struct +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 `vpn_server` value is supported, but filter + // support is expected to expand 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 + // sources. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` + + // The date and time that this routing table was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this routing table. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` + + // Indicates whether this is the default routing table for this VPC. + IsDefault *bool `json:"is_default" validate:"required"` + + // The lifecycle state of the routing table. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name of the default routing table created for this VPC. The name will be a hyphenated list of randomly-selected + // words at creation, but may be changed. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from the internet. + // + // Incoming traffic will be routed according to the routing table with two exceptions: + // - Traffic destined for IP addresses associated with public gateways will not be + // subject to routes in this routing table. + // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is + // an IP address in a subnet in the route's `zone` that is able to accept traffic. + // Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from from [Transit + // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this + // VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` + + // The routes for the default routing table for this VPC. The table is created with no routes, but routes may be added, + // changed, or removed with a subsequent request. + Routes []RouteReference `json:"routes" validate:"required"` + + // The subnets to which this routing table is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` +} + +// Constants associated with the DefaultRoutingTable.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + DefaultRoutingTableAdvertiseRoutesToDirectLinkConst = "direct_link" + DefaultRoutingTableAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + +// Constants associated with the DefaultRoutingTable.LifecycleState property. +// The lifecycle state of the routing table. +const ( + DefaultRoutingTableLifecycleStateDeletingConst = "deleting" + DefaultRoutingTableLifecycleStateFailedConst = "failed" + DefaultRoutingTableLifecycleStatePendingConst = "pending" + DefaultRoutingTableLifecycleStateStableConst = "stable" + DefaultRoutingTableLifecycleStateSuspendedConst = "suspended" + DefaultRoutingTableLifecycleStateUpdatingConst = "updating" + DefaultRoutingTableLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the DefaultRoutingTable.ResourceType property. +// The resource type. +const ( + DefaultRoutingTableResourceTypeRoutingTableConst = "routing_table" +) + +// UnmarshalDefaultRoutingTable unmarshals an instance of DefaultRoutingTable from the specified map of raw messages. +func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DefaultRoutingTable) + err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DefaultSecurityGroup : DefaultSecurityGroup struct +type DefaultSecurityGroup struct { + // The date and time that this security group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The name for the default security group for a VPC. The name will be a hyphenated list of randomly-selected words at + // creation, but may changed. + Name *string `json:"name" validate:"required"` + + // The resource group for this security group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The rules for the default security group for a VPC. Defaults to allowing all outbound traffic, and allowing all + // inbound traffic from other interfaces in the VPC's default security group. Rules for the default security group may + // be changed, added or removed. + Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` + + // The targets for this security group. + Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` + + // The VPC this security group resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalDefaultSecurityGroup unmarshals an instance of DefaultSecurityGroup from the specified map of raw messages. +func UnmarshalDefaultSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DefaultSecurityGroup) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) + if err != nil { + return + } + err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DeleteBackupPolicyOptions : The DeleteBackupPolicy options. +type DeleteBackupPolicyOptions struct { + // The backup policy 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 +} + +// NewDeleteBackupPolicyOptions : Instantiate DeleteBackupPolicyOptions +func (*VpcV1) NewDeleteBackupPolicyOptions(id string) *DeleteBackupPolicyOptions { + return &DeleteBackupPolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteBackupPolicyOptions) SetID(id string) *DeleteBackupPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteBackupPolicyOptions) SetIfMatch(ifMatch string) *DeleteBackupPolicyOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBackupPolicyOptions) SetHeaders(param map[string]string) *DeleteBackupPolicyOptions { + options.Headers = param + return options +} + +// DeleteBackupPolicyPlanOptions : The DeleteBackupPolicyPlan options. +type DeleteBackupPolicyPlanOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // The backup policy plan 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 +} + +// NewDeleteBackupPolicyPlanOptions : Instantiate DeleteBackupPolicyPlanOptions +func (*VpcV1) NewDeleteBackupPolicyPlanOptions(backupPolicyID string, id string) *DeleteBackupPolicyPlanOptions { + return &DeleteBackupPolicyPlanOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + ID: core.StringPtr(id), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *DeleteBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *DeleteBackupPolicyPlanOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteBackupPolicyPlanOptions) SetID(id string) *DeleteBackupPolicyPlanOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteBackupPolicyPlanOptions) SetIfMatch(ifMatch string) *DeleteBackupPolicyPlanOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBackupPolicyPlanOptions) SetHeaders(param map[string]string) *DeleteBackupPolicyPlanOptions { + options.Headers = param + return options +} + +// DeleteBareMetalServerNetworkAttachmentOptions : The DeleteBareMetalServerNetworkAttachment options. +type DeleteBareMetalServerNetworkAttachmentOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteBareMetalServerNetworkAttachmentOptions : Instantiate DeleteBareMetalServerNetworkAttachmentOptions +func (*VpcV1) NewDeleteBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string) *DeleteBareMetalServerNetworkAttachmentOptions { + return &DeleteBareMetalServerNetworkAttachmentOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *DeleteBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *DeleteBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteBareMetalServerNetworkAttachmentOptions) SetID(id string) *DeleteBareMetalServerNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerNetworkAttachmentOptions { + options.Headers = param + return options +} + +// DeleteBareMetalServerNetworkInterfaceOptions : The DeleteBareMetalServerNetworkInterface options. +type DeleteBareMetalServerNetworkInterfaceOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteBareMetalServerNetworkInterfaceOptions : Instantiate DeleteBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewDeleteBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string) *DeleteBareMetalServerNetworkInterfaceOptions { + return &DeleteBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *DeleteBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *DeleteBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteBareMetalServerNetworkInterfaceOptions) SetID(id string) *DeleteBareMetalServerNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options +} + +// DeleteBareMetalServerOptions : The DeleteBareMetalServer options. +type DeleteBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteBareMetalServerOptions : Instantiate DeleteBareMetalServerOptions +func (*VpcV1) NewDeleteBareMetalServerOptions(id string) *DeleteBareMetalServerOptions { + return &DeleteBareMetalServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteBareMetalServerOptions) SetID(id string) *DeleteBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteBareMetalServerOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerOptions { + 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 + Headers map[string]string +} + +// NewDeleteDedicatedHostGroupOptions : Instantiate DeleteDedicatedHostGroupOptions +func (*VpcV1) NewDeleteDedicatedHostGroupOptions(id string) *DeleteDedicatedHostGroupOptions { + return &DeleteDedicatedHostGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteDedicatedHostGroupOptions) SetID(id string) *DeleteDedicatedHostGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteDedicatedHostGroupOptions) SetHeaders(param map[string]string) *DeleteDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// DeleteDedicatedHostOptions : The DeleteDedicatedHost options. +type DeleteDedicatedHostOptions struct { + // The dedicated host identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteDedicatedHostOptions : Instantiate DeleteDedicatedHostOptions +func (*VpcV1) NewDeleteDedicatedHostOptions(id string) *DeleteDedicatedHostOptions { + return &DeleteDedicatedHostOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteDedicatedHostOptions) SetID(id string) *DeleteDedicatedHostOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteDedicatedHostOptions) SetHeaders(param map[string]string) *DeleteDedicatedHostOptions { + options.Headers = param + return options +} + +// DeleteEndpointGatewayOptions : The DeleteEndpointGateway options. +type DeleteEndpointGatewayOptions struct { + // The endpoint gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteEndpointGatewayOptions : Instantiate DeleteEndpointGatewayOptions +func (*VpcV1) NewDeleteEndpointGatewayOptions(id string) *DeleteEndpointGatewayOptions { + return &DeleteEndpointGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteEndpointGatewayOptions) SetID(id string) *DeleteEndpointGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteEndpointGatewayOptions) SetHeaders(param map[string]string) *DeleteEndpointGatewayOptions { + options.Headers = param + return options +} + +// DeleteFloatingIPOptions : The DeleteFloatingIP options. +type DeleteFloatingIPOptions struct { + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteFloatingIPOptions : Instantiate DeleteFloatingIPOptions +func (*VpcV1) NewDeleteFloatingIPOptions(id string) *DeleteFloatingIPOptions { + return &DeleteFloatingIPOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteFloatingIPOptions) SetID(id string) *DeleteFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteFloatingIPOptions) SetHeaders(param map[string]string) *DeleteFloatingIPOptions { + options.Headers = param + return options +} + +// DeleteFlowLogCollectorOptions : The DeleteFlowLogCollector options. +type DeleteFlowLogCollectorOptions struct { + // The flow log collector identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteFlowLogCollectorOptions : Instantiate DeleteFlowLogCollectorOptions +func (*VpcV1) NewDeleteFlowLogCollectorOptions(id string) *DeleteFlowLogCollectorOptions { + return &DeleteFlowLogCollectorOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteFlowLogCollectorOptions) SetID(id string) *DeleteFlowLogCollectorOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteFlowLogCollectorOptions) SetHeaders(param map[string]string) *DeleteFlowLogCollectorOptions { + options.Headers = param + return options +} + +// DeleteIkePolicyOptions : The DeleteIkePolicy options. +type DeleteIkePolicyOptions struct { + // The IKE policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteIkePolicyOptions : Instantiate DeleteIkePolicyOptions +func (*VpcV1) NewDeleteIkePolicyOptions(id string) *DeleteIkePolicyOptions { + return &DeleteIkePolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteIkePolicyOptions) SetID(id string) *DeleteIkePolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteIkePolicyOptions) SetHeaders(param map[string]string) *DeleteIkePolicyOptions { + options.Headers = param + return options +} + +// DeleteImageExportJobOptions : The DeleteImageExportJob options. +type DeleteImageExportJobOptions struct { + // The image identifier. + ImageID *string `json:"image_id" validate:"required,ne="` + + // The image export job identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteImageExportJobOptions : Instantiate DeleteImageExportJobOptions +func (*VpcV1) NewDeleteImageExportJobOptions(imageID string, id string) *DeleteImageExportJobOptions { + return &DeleteImageExportJobOptions{ + ImageID: core.StringPtr(imageID), + ID: core.StringPtr(id), + } +} + +// SetImageID : Allow user to set ImageID +func (_options *DeleteImageExportJobOptions) SetImageID(imageID string) *DeleteImageExportJobOptions { + _options.ImageID = core.StringPtr(imageID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteImageExportJobOptions) SetID(id string) *DeleteImageExportJobOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteImageExportJobOptions) SetHeaders(param map[string]string) *DeleteImageExportJobOptions { + options.Headers = param + return options +} + +// DeleteImageOptions : The DeleteImage options. +type DeleteImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteImageOptions : Instantiate DeleteImageOptions +func (*VpcV1) NewDeleteImageOptions(id string) *DeleteImageOptions { + return &DeleteImageOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteImageOptions) SetID(id string) *DeleteImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteImageOptions) SetHeaders(param map[string]string) *DeleteImageOptions { + 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 + Headers map[string]string +} + +// NewDeleteInstanceGroupLoadBalancerOptions : Instantiate DeleteInstanceGroupLoadBalancerOptions +func (*VpcV1) NewDeleteInstanceGroupLoadBalancerOptions(instanceGroupID string) *DeleteInstanceGroupLoadBalancerOptions { + return &DeleteInstanceGroupLoadBalancerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupLoadBalancerOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupLoadBalancerOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupLoadBalancerOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupLoadBalancerOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupManagerActionOptions : The DeleteInstanceGroupManagerAction options. +type DeleteInstanceGroupManagerActionOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager action identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupManagerActionOptions : Instantiate DeleteInstanceGroupManagerActionOptions +func (*VpcV1) NewDeleteInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string) *DeleteInstanceGroupManagerActionOptions { + return &DeleteInstanceGroupManagerActionOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerActionOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *DeleteInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *DeleteInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupManagerActionOptions) SetID(id string) *DeleteInstanceGroupManagerActionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerActionOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupManagerOptions : The DeleteInstanceGroupManager options. +type DeleteInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupManagerOptions : Instantiate DeleteInstanceGroupManagerOptions +func (*VpcV1) NewDeleteInstanceGroupManagerOptions(instanceGroupID string, id string) *DeleteInstanceGroupManagerOptions { + return &DeleteInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupManagerOptions) SetID(id string) *DeleteInstanceGroupManagerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupManagerOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupManagerPolicyOptions : The DeleteInstanceGroupManagerPolicy options. +type DeleteInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupManagerPolicyOptions : Instantiate DeleteInstanceGroupManagerPolicyOptions +func (*VpcV1) NewDeleteInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string) *DeleteInstanceGroupManagerPolicyOptions { + return &DeleteInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerPolicyOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *DeleteInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *DeleteInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupManagerPolicyOptions) SetID(id string) *DeleteInstanceGroupManagerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupMembershipOptions : The DeleteInstanceGroupMembership options. +type DeleteInstanceGroupMembershipOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group membership identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupMembershipOptions : Instantiate DeleteInstanceGroupMembershipOptions +func (*VpcV1) NewDeleteInstanceGroupMembershipOptions(instanceGroupID string, id string) *DeleteInstanceGroupMembershipOptions { + return &DeleteInstanceGroupMembershipOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupMembershipOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupMembershipOptions) SetID(id string) *DeleteInstanceGroupMembershipOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupMembershipOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupMembershipsOptions : The DeleteInstanceGroupMemberships options. +type DeleteInstanceGroupMembershipsOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupMembershipsOptions : Instantiate DeleteInstanceGroupMembershipsOptions +func (*VpcV1) NewDeleteInstanceGroupMembershipsOptions(instanceGroupID string) *DeleteInstanceGroupMembershipsOptions { + return &DeleteInstanceGroupMembershipsOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *DeleteInstanceGroupMembershipsOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupMembershipsOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupMembershipsOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupMembershipsOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupOptions : The DeleteInstanceGroup options. +type DeleteInstanceGroupOptions struct { + // The instance group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupOptions : Instantiate DeleteInstanceGroupOptions +func (*VpcV1) NewDeleteInstanceGroupOptions(id string) *DeleteInstanceGroupOptions { + return &DeleteInstanceGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceGroupOptions) SetID(id string) *DeleteInstanceGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupOptions { + options.Headers = param + return options +} + +// DeleteInstanceNetworkAttachmentOptions : The DeleteInstanceNetworkAttachment options. +type DeleteInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceNetworkAttachmentOptions : Instantiate DeleteInstanceNetworkAttachmentOptions +func (*VpcV1) NewDeleteInstanceNetworkAttachmentOptions(instanceID string, id string) *DeleteInstanceNetworkAttachmentOptions { + return &DeleteInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *DeleteInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceNetworkAttachmentOptions) SetID(id string) *DeleteInstanceNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + +// DeleteInstanceNetworkInterfaceOptions : The DeleteInstanceNetworkInterface options. +type DeleteInstanceNetworkInterfaceOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceNetworkInterfaceOptions : Instantiate DeleteInstanceNetworkInterfaceOptions +func (*VpcV1) NewDeleteInstanceNetworkInterfaceOptions(instanceID string, id string) *DeleteInstanceNetworkInterfaceOptions { + return &DeleteInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *DeleteInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *DeleteInstanceNetworkInterfaceOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceNetworkInterfaceOptions) SetID(id string) *DeleteInstanceNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *DeleteInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// DeleteInstanceOptions : The DeleteInstance options. +type DeleteInstanceOptions struct { + // The virtual server instance 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 +} + +// NewDeleteInstanceOptions : Instantiate DeleteInstanceOptions +func (*VpcV1) NewDeleteInstanceOptions(id string) *DeleteInstanceOptions { + return &DeleteInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceOptions) SetID(id string) *DeleteInstanceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteInstanceOptions) SetIfMatch(ifMatch string) *DeleteInstanceOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceOptions) SetHeaders(param map[string]string) *DeleteInstanceOptions { + options.Headers = param + return options +} + +// DeleteInstanceTemplateOptions : The DeleteInstanceTemplate options. +type DeleteInstanceTemplateOptions struct { + // The instance template identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceTemplateOptions : Instantiate DeleteInstanceTemplateOptions +func (*VpcV1) NewDeleteInstanceTemplateOptions(id string) *DeleteInstanceTemplateOptions { + return &DeleteInstanceTemplateOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceTemplateOptions) SetID(id string) *DeleteInstanceTemplateOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceTemplateOptions) SetHeaders(param map[string]string) *DeleteInstanceTemplateOptions { + options.Headers = param + return options +} + +// DeleteInstanceVolumeAttachmentOptions : The DeleteInstanceVolumeAttachment options. +type DeleteInstanceVolumeAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The volume attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceVolumeAttachmentOptions : Instantiate DeleteInstanceVolumeAttachmentOptions +func (*VpcV1) NewDeleteInstanceVolumeAttachmentOptions(instanceID string, id string) *DeleteInstanceVolumeAttachmentOptions { + return &DeleteInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *DeleteInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceVolumeAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteInstanceVolumeAttachmentOptions) SetID(id string) *DeleteInstanceVolumeAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// DeleteIpsecPolicyOptions : The DeleteIpsecPolicy options. +type DeleteIpsecPolicyOptions struct { + // The IPsec policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteIpsecPolicyOptions : Instantiate DeleteIpsecPolicyOptions +func (*VpcV1) NewDeleteIpsecPolicyOptions(id string) *DeleteIpsecPolicyOptions { + return &DeleteIpsecPolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteIpsecPolicyOptions) SetID(id string) *DeleteIpsecPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteIpsecPolicyOptions) SetHeaders(param map[string]string) *DeleteIpsecPolicyOptions { + options.Headers = param + return options +} + +// DeleteKeyOptions : The DeleteKey options. +type DeleteKeyOptions struct { + // The key identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteKeyOptions : Instantiate DeleteKeyOptions +func (*VpcV1) NewDeleteKeyOptions(id string) *DeleteKeyOptions { + return &DeleteKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteKeyOptions) SetID(id string) *DeleteKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteKeyOptions) SetHeaders(param map[string]string) *DeleteKeyOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerListenerOptions : The DeleteLoadBalancerListener options. +type DeleteLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerListenerOptions : Instantiate DeleteLoadBalancerListenerOptions +func (*VpcV1) NewDeleteLoadBalancerListenerOptions(loadBalancerID string, id string) *DeleteLoadBalancerListenerOptions { + return &DeleteLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerListenerOptions) SetID(id string) *DeleteLoadBalancerListenerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerListenerOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerListenerPolicyOptions : The DeleteLoadBalancerListenerPolicy options. +type DeleteLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerListenerPolicyOptions : Instantiate DeleteLoadBalancerListenerPolicyOptions +func (*VpcV1) NewDeleteLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string) *DeleteLoadBalancerListenerPolicyOptions { + return &DeleteLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerPolicyOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *DeleteLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *DeleteLoadBalancerListenerPolicyOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerListenerPolicyOptions) SetID(id string) *DeleteLoadBalancerListenerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerListenerPolicyRuleOptions : The DeleteLoadBalancerListenerPolicyRule options. +type DeleteLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerListenerPolicyRuleOptions : Instantiate DeleteLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewDeleteLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string) *DeleteLoadBalancerListenerPolicyRuleOptions { + return &DeleteLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *DeleteLoadBalancerListenerPolicyRuleOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *DeleteLoadBalancerListenerPolicyRuleOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetID(id string) *DeleteLoadBalancerListenerPolicyRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerOptions : The DeleteLoadBalancer options. +type DeleteLoadBalancerOptions struct { + // The load balancer 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 +} + +// NewDeleteLoadBalancerOptions : Instantiate DeleteLoadBalancerOptions +func (*VpcV1) NewDeleteLoadBalancerOptions(id string) *DeleteLoadBalancerOptions { + return &DeleteLoadBalancerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerOptions) SetID(id string) *DeleteLoadBalancerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteLoadBalancerOptions) SetIfMatch(ifMatch string) *DeleteLoadBalancerOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerPoolMemberOptions : The DeleteLoadBalancerPoolMember options. +type DeleteLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The member identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerPoolMemberOptions : Instantiate DeleteLoadBalancerPoolMemberOptions +func (*VpcV1) NewDeleteLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string) *DeleteLoadBalancerPoolMemberOptions { + return &DeleteLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerPoolMemberOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *DeleteLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *DeleteLoadBalancerPoolMemberOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerPoolMemberOptions) SetID(id string) *DeleteLoadBalancerPoolMemberOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerPoolOptions : The DeleteLoadBalancerPool options. +type DeleteLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerPoolOptions : Instantiate DeleteLoadBalancerPoolOptions +func (*VpcV1) NewDeleteLoadBalancerPoolOptions(loadBalancerID string, id string) *DeleteLoadBalancerPoolOptions { + return &DeleteLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *DeleteLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerPoolOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteLoadBalancerPoolOptions) SetID(id string) *DeleteLoadBalancerPoolOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerPoolOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// DeleteNetworkACLOptions : The DeleteNetworkACL options. +type DeleteNetworkACLOptions struct { + // The network ACL identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteNetworkACLOptions : Instantiate DeleteNetworkACLOptions +func (*VpcV1) NewDeleteNetworkACLOptions(id string) *DeleteNetworkACLOptions { + return &DeleteNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteNetworkACLOptions) SetID(id string) *DeleteNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteNetworkACLOptions) SetHeaders(param map[string]string) *DeleteNetworkACLOptions { + options.Headers = param + return options +} + +// DeleteNetworkACLRuleOptions : The DeleteNetworkACLRule options. +type DeleteNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteNetworkACLRuleOptions : Instantiate DeleteNetworkACLRuleOptions +func (*VpcV1) NewDeleteNetworkACLRuleOptions(networkACLID string, id string) *DeleteNetworkACLRuleOptions { + return &DeleteNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + ID: core.StringPtr(id), + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *DeleteNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *DeleteNetworkACLRuleOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteNetworkACLRuleOptions) SetID(id string) *DeleteNetworkACLRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteNetworkACLRuleOptions) SetHeaders(param map[string]string) *DeleteNetworkACLRuleOptions { + options.Headers = param + return options +} + +// DeletePlacementGroupOptions : The DeletePlacementGroup options. +type DeletePlacementGroupOptions struct { + // The placement group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeletePlacementGroupOptions : Instantiate DeletePlacementGroupOptions +func (*VpcV1) NewDeletePlacementGroupOptions(id string) *DeletePlacementGroupOptions { + return &DeletePlacementGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeletePlacementGroupOptions) SetID(id string) *DeletePlacementGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeletePlacementGroupOptions) SetHeaders(param map[string]string) *DeletePlacementGroupOptions { + options.Headers = param + return options +} + +// DeletePublicGatewayOptions : The DeletePublicGateway options. +type DeletePublicGatewayOptions struct { + // The public gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeletePublicGatewayOptions : Instantiate DeletePublicGatewayOptions +func (*VpcV1) NewDeletePublicGatewayOptions(id string) *DeletePublicGatewayOptions { + return &DeletePublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeletePublicGatewayOptions) SetID(id string) *DeletePublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeletePublicGatewayOptions) SetHeaders(param map[string]string) *DeletePublicGatewayOptions { + options.Headers = param + return options +} + +// DeleteReservationOptions : The DeleteReservation options. +type DeleteReservationOptions struct { + // The reservation identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteReservationOptions : Instantiate DeleteReservationOptions +func (*VpcV1) NewDeleteReservationOptions(id string) *DeleteReservationOptions { + return &DeleteReservationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteReservationOptions) SetID(id string) *DeleteReservationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteReservationOptions) SetHeaders(param map[string]string) *DeleteReservationOptions { + options.Headers = param + return options +} + +// DeleteSecurityGroupOptions : The DeleteSecurityGroup options. +type DeleteSecurityGroupOptions struct { + // The security group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSecurityGroupOptions : Instantiate DeleteSecurityGroupOptions +func (*VpcV1) NewDeleteSecurityGroupOptions(id string) *DeleteSecurityGroupOptions { + return &DeleteSecurityGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteSecurityGroupOptions) SetID(id string) *DeleteSecurityGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSecurityGroupOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupOptions { + options.Headers = param + return options +} + +// DeleteSecurityGroupRuleOptions : The DeleteSecurityGroupRule options. +type DeleteSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSecurityGroupRuleOptions : Instantiate DeleteSecurityGroupRuleOptions +func (*VpcV1) NewDeleteSecurityGroupRuleOptions(securityGroupID string, id string) *DeleteSecurityGroupRuleOptions { + return &DeleteSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *DeleteSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *DeleteSecurityGroupRuleOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteSecurityGroupRuleOptions) SetID(id string) *DeleteSecurityGroupRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSecurityGroupRuleOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// DeleteSecurityGroupTargetBindingOptions : The DeleteSecurityGroupTargetBinding options. +type DeleteSecurityGroupTargetBindingOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The security group target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSecurityGroupTargetBindingOptions : Instantiate DeleteSecurityGroupTargetBindingOptions +func (*VpcV1) NewDeleteSecurityGroupTargetBindingOptions(securityGroupID string, id string) *DeleteSecurityGroupTargetBindingOptions { + return &DeleteSecurityGroupTargetBindingOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *DeleteSecurityGroupTargetBindingOptions) SetSecurityGroupID(securityGroupID string) *DeleteSecurityGroupTargetBindingOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteSecurityGroupTargetBindingOptions) SetID(id string) *DeleteSecurityGroupTargetBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSecurityGroupTargetBindingOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupTargetBindingOptions { + options.Headers = param + return options +} + +// DeleteShareMountTargetOptions : The DeleteShareMountTarget options. +type DeleteShareMountTargetOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share mount target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteShareMountTargetOptions : Instantiate DeleteShareMountTargetOptions +func (*VpcV1) NewDeleteShareMountTargetOptions(shareID string, id string) *DeleteShareMountTargetOptions { + return &DeleteShareMountTargetOptions{ + ShareID: core.StringPtr(shareID), + ID: core.StringPtr(id), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *DeleteShareMountTargetOptions) SetShareID(shareID string) *DeleteShareMountTargetOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteShareMountTargetOptions) SetID(id string) *DeleteShareMountTargetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteShareMountTargetOptions) SetHeaders(param map[string]string) *DeleteShareMountTargetOptions { + options.Headers = param + return options +} + +// DeleteShareOptions : The DeleteShare options. +type DeleteShareOptions struct { + // The file share 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 +} + +// NewDeleteShareOptions : Instantiate DeleteShareOptions +func (*VpcV1) NewDeleteShareOptions(id string) *DeleteShareOptions { + return &DeleteShareOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteShareOptions) SetID(id string) *DeleteShareOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteShareOptions) SetIfMatch(ifMatch string) *DeleteShareOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteShareOptions) SetHeaders(param map[string]string) *DeleteShareOptions { + options.Headers = param + return options +} + +// DeleteShareSourceOptions : The DeleteShareSource options. +type DeleteShareSourceOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteShareSourceOptions : Instantiate DeleteShareSourceOptions +func (*VpcV1) NewDeleteShareSourceOptions(shareID string) *DeleteShareSourceOptions { + return &DeleteShareSourceOptions{ + ShareID: core.StringPtr(shareID), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *DeleteShareSourceOptions) SetShareID(shareID string) *DeleteShareSourceOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteShareSourceOptions) SetHeaders(param map[string]string) *DeleteShareSourceOptions { + options.Headers = param + return options +} + +// DeleteSnapshotCloneOptions : The DeleteSnapshotClone options. +type DeleteSnapshotCloneOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // The zone name. + ZoneName *string `json:"zone_name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSnapshotCloneOptions : Instantiate DeleteSnapshotCloneOptions +func (*VpcV1) NewDeleteSnapshotCloneOptions(id string, zoneName string) *DeleteSnapshotCloneOptions { + return &DeleteSnapshotCloneOptions{ + ID: core.StringPtr(id), + ZoneName: core.StringPtr(zoneName), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteSnapshotCloneOptions) SetID(id string) *DeleteSnapshotCloneOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *DeleteSnapshotCloneOptions) SetZoneName(zoneName string) *DeleteSnapshotCloneOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSnapshotCloneOptions) SetHeaders(param map[string]string) *DeleteSnapshotCloneOptions { + options.Headers = param + return options +} + +// DeleteSnapshotConsistencyGroupOptions : The DeleteSnapshotConsistencyGroup options. +type DeleteSnapshotConsistencyGroupOptions struct { + // The snapshot consistency group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSnapshotConsistencyGroupOptions : Instantiate DeleteSnapshotConsistencyGroupOptions +func (*VpcV1) NewDeleteSnapshotConsistencyGroupOptions(id string) *DeleteSnapshotConsistencyGroupOptions { + return &DeleteSnapshotConsistencyGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteSnapshotConsistencyGroupOptions) SetID(id string) *DeleteSnapshotConsistencyGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *DeleteSnapshotConsistencyGroupOptions { + options.Headers = param + return options +} + +// DeleteSnapshotOptions : The DeleteSnapshot options. +type DeleteSnapshotOptions struct { + // The snapshot 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 +} + +// NewDeleteSnapshotOptions : Instantiate DeleteSnapshotOptions +func (*VpcV1) NewDeleteSnapshotOptions(id string) *DeleteSnapshotOptions { + return &DeleteSnapshotOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteSnapshotOptions) SetID(id string) *DeleteSnapshotOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteSnapshotOptions) SetIfMatch(ifMatch string) *DeleteSnapshotOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSnapshotOptions) SetHeaders(param map[string]string) *DeleteSnapshotOptions { + options.Headers = param + return options +} + +// DeleteSnapshotsOptions : The DeleteSnapshots options. +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 + Headers map[string]string +} + +// NewDeleteSnapshotsOptions : Instantiate DeleteSnapshotsOptions +func (*VpcV1) NewDeleteSnapshotsOptions(sourceVolumeID string) *DeleteSnapshotsOptions { + return &DeleteSnapshotsOptions{ + SourceVolumeID: core.StringPtr(sourceVolumeID), + } +} + +// SetSourceVolumeID : Allow user to set SourceVolumeID +func (_options *DeleteSnapshotsOptions) SetSourceVolumeID(sourceVolumeID string) *DeleteSnapshotsOptions { + _options.SourceVolumeID = core.StringPtr(sourceVolumeID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSnapshotsOptions) SetHeaders(param map[string]string) *DeleteSnapshotsOptions { + options.Headers = param + return options +} + +// DeleteSubnetOptions : The DeleteSubnet options. +type DeleteSubnetOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSubnetOptions : Instantiate DeleteSubnetOptions +func (*VpcV1) NewDeleteSubnetOptions(id string) *DeleteSubnetOptions { + return &DeleteSubnetOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteSubnetOptions) SetID(id string) *DeleteSubnetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSubnetOptions) SetHeaders(param map[string]string) *DeleteSubnetOptions { + options.Headers = param + return options +} + +// DeleteSubnetReservedIPOptions : The DeleteSubnetReservedIP options. +type DeleteSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `json:"subnet_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 +} + +// NewDeleteSubnetReservedIPOptions : Instantiate DeleteSubnetReservedIPOptions +func (*VpcV1) NewDeleteSubnetReservedIPOptions(subnetID string, id string) *DeleteSubnetReservedIPOptions { + return &DeleteSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + ID: core.StringPtr(id), + } +} + +// SetSubnetID : Allow user to set SubnetID +func (_options *DeleteSubnetReservedIPOptions) SetSubnetID(subnetID string) *DeleteSubnetReservedIPOptions { + _options.SubnetID = core.StringPtr(subnetID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteSubnetReservedIPOptions) SetID(id string) *DeleteSubnetReservedIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSubnetReservedIPOptions) SetHeaders(param map[string]string) *DeleteSubnetReservedIPOptions { + options.Headers = param + return options +} + +// DeleteVirtualNetworkInterfacesOptions : The DeleteVirtualNetworkInterfaces options. +type DeleteVirtualNetworkInterfacesOptions struct { + // The virtual network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVirtualNetworkInterfacesOptions : Instantiate DeleteVirtualNetworkInterfacesOptions +func (*VpcV1) NewDeleteVirtualNetworkInterfacesOptions(id string) *DeleteVirtualNetworkInterfacesOptions { + return &DeleteVirtualNetworkInterfacesOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVirtualNetworkInterfacesOptions) SetID(id string) *DeleteVirtualNetworkInterfacesOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVirtualNetworkInterfacesOptions) SetHeaders(param map[string]string) *DeleteVirtualNetworkInterfacesOptions { + options.Headers = param + return options +} + +// DeleteVolumeOptions : The DeleteVolume options. +type DeleteVolumeOptions struct { + // The volume 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 +} + +// NewDeleteVolumeOptions : Instantiate DeleteVolumeOptions +func (*VpcV1) NewDeleteVolumeOptions(id string) *DeleteVolumeOptions { + return &DeleteVolumeOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVolumeOptions) SetID(id string) *DeleteVolumeOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteVolumeOptions) SetIfMatch(ifMatch string) *DeleteVolumeOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVolumeOptions) SetHeaders(param map[string]string) *DeleteVolumeOptions { + options.Headers = param + return options +} + +// DeleteVPCAddressPrefixOptions : The DeleteVPCAddressPrefix options. +type DeleteVPCAddressPrefixOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The prefix identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCAddressPrefixOptions : Instantiate DeleteVPCAddressPrefixOptions +func (*VpcV1) NewDeleteVPCAddressPrefixOptions(vpcID string, id string) *DeleteVPCAddressPrefixOptions { + return &DeleteVPCAddressPrefixOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *DeleteVPCAddressPrefixOptions) SetVPCID(vpcID string) *DeleteVPCAddressPrefixOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCAddressPrefixOptions) SetID(id string) *DeleteVPCAddressPrefixOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCAddressPrefixOptions) SetHeaders(param map[string]string) *DeleteVPCAddressPrefixOptions { + options.Headers = param + return options +} + +// DeleteVPCDnsResolutionBindingOptions : The DeleteVPCDnsResolutionBinding options. +type DeleteVPCDnsResolutionBindingOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The DNS resolution binding identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCDnsResolutionBindingOptions : Instantiate DeleteVPCDnsResolutionBindingOptions +func (*VpcV1) NewDeleteVPCDnsResolutionBindingOptions(vpcID string, id string) *DeleteVPCDnsResolutionBindingOptions { + return &DeleteVPCDnsResolutionBindingOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *DeleteVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *DeleteVPCDnsResolutionBindingOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCDnsResolutionBindingOptions) SetID(id string) *DeleteVPCDnsResolutionBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *DeleteVPCDnsResolutionBindingOptions { + options.Headers = param + return options +} + +// DeleteVPCOptions : The DeleteVPC options. +type DeleteVPCOptions struct { + // The VPC 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 +} + +// NewDeleteVPCOptions : Instantiate DeleteVPCOptions +func (*VpcV1) NewDeleteVPCOptions(id string) *DeleteVPCOptions { + return &DeleteVPCOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCOptions) SetID(id string) *DeleteVPCOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteVPCOptions) SetIfMatch(ifMatch string) *DeleteVPCOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCOptions) SetHeaders(param map[string]string) *DeleteVPCOptions { + options.Headers = param + return options +} + +// DeleteVPCRouteOptions : The DeleteVPCRoute options. +type DeleteVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCRouteOptions : Instantiate DeleteVPCRouteOptions +func (*VpcV1) NewDeleteVPCRouteOptions(vpcID string, id string) *DeleteVPCRouteOptions { + return &DeleteVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *DeleteVPCRouteOptions) SetVPCID(vpcID string) *DeleteVPCRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCRouteOptions) SetID(id string) *DeleteVPCRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCRouteOptions) SetHeaders(param map[string]string) *DeleteVPCRouteOptions { + options.Headers = param + return options +} + +// DeleteVPCRoutingTableOptions : The DeleteVPCRoutingTable options. +type DeleteVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table 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 +} + +// NewDeleteVPCRoutingTableOptions : Instantiate DeleteVPCRoutingTableOptions +func (*VpcV1) NewDeleteVPCRoutingTableOptions(vpcID string, id string) *DeleteVPCRoutingTableOptions { + return &DeleteVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *DeleteVPCRoutingTableOptions) SetVPCID(vpcID string) *DeleteVPCRoutingTableOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCRoutingTableOptions) SetID(id string) *DeleteVPCRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteVPCRoutingTableOptions) SetIfMatch(ifMatch string) *DeleteVPCRoutingTableOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCRoutingTableOptions) SetHeaders(param map[string]string) *DeleteVPCRoutingTableOptions { + options.Headers = param + return options +} + +// DeleteVPCRoutingTableRouteOptions : The DeleteVPCRoutingTableRoute options. +type DeleteVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` + + // The VPC routing table route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCRoutingTableRouteOptions : Instantiate DeleteVPCRoutingTableRouteOptions +func (*VpcV1) NewDeleteVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string) *DeleteVPCRoutingTableRouteOptions { + return &DeleteVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *DeleteVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *DeleteVPCRoutingTableRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *DeleteVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *DeleteVPCRoutingTableRouteOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPCRoutingTableRouteOptions) SetID(id string) *DeleteVPCRoutingTableRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *DeleteVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// DeleteVPNGatewayConnectionOptions : The DeleteVPNGatewayConnection options. +type DeleteVPNGatewayConnectionOptions 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="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNGatewayConnectionOptions : Instantiate DeleteVPNGatewayConnectionOptions +func (*VpcV1) NewDeleteVPNGatewayConnectionOptions(vpnGatewayID string, id string) *DeleteVPNGatewayConnectionOptions { + return &DeleteVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *DeleteVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *DeleteVPNGatewayConnectionOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNGatewayConnectionOptions) SetID(id string) *DeleteVPNGatewayConnectionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *DeleteVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// DeleteVPNGatewayOptions : The DeleteVPNGateway options. +type DeleteVPNGatewayOptions struct { + // The VPN gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNGatewayOptions : Instantiate DeleteVPNGatewayOptions +func (*VpcV1) NewDeleteVPNGatewayOptions(id string) *DeleteVPNGatewayOptions { + return &DeleteVPNGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNGatewayOptions) SetID(id string) *DeleteVPNGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNGatewayOptions) SetHeaders(param map[string]string) *DeleteVPNGatewayOptions { + options.Headers = param + return options +} + +// DeleteVPNServerClientOptions : The DeleteVPNServerClient options. +type DeleteVPNServerClientOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN client identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNServerClientOptions : Instantiate DeleteVPNServerClientOptions +func (*VpcV1) NewDeleteVPNServerClientOptions(vpnServerID string, id string) *DeleteVPNServerClientOptions { + return &DeleteVPNServerClientOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *DeleteVPNServerClientOptions) SetVPNServerID(vpnServerID string) *DeleteVPNServerClientOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNServerClientOptions) SetID(id string) *DeleteVPNServerClientOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNServerClientOptions) SetHeaders(param map[string]string) *DeleteVPNServerClientOptions { + options.Headers = param + return options +} + +// DeleteVPNServerOptions : The DeleteVPNServer options. +type DeleteVPNServerOptions struct { + // The VPN server 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 +} + +// NewDeleteVPNServerOptions : Instantiate DeleteVPNServerOptions +func (*VpcV1) NewDeleteVPNServerOptions(id string) *DeleteVPNServerOptions { + return &DeleteVPNServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNServerOptions) SetID(id string) *DeleteVPNServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteVPNServerOptions) SetIfMatch(ifMatch string) *DeleteVPNServerOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNServerOptions) SetHeaders(param map[string]string) *DeleteVPNServerOptions { + options.Headers = param + return options +} + +// DeleteVPNServerRouteOptions : The DeleteVPNServerRoute options. +type DeleteVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNServerRouteOptions : Instantiate DeleteVPNServerRouteOptions +func (*VpcV1) NewDeleteVPNServerRouteOptions(vpnServerID string, id string) *DeleteVPNServerRouteOptions { + return &DeleteVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *DeleteVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *DeleteVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNServerRouteOptions) SetID(id string) *DeleteVPNServerRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNServerRouteOptions) SetHeaders(param map[string]string) *DeleteVPNServerRouteOptions { + options.Headers = param + return options +} + +// DeprecateImageOptions : The DeprecateImage options. +type DeprecateImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeprecateImageOptions : Instantiate DeprecateImageOptions +func (*VpcV1) NewDeprecateImageOptions(id string) *DeprecateImageOptions { + return &DeprecateImageOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeprecateImageOptions) SetID(id string) *DeprecateImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeprecateImageOptions) SetHeaders(param map[string]string) *DeprecateImageOptions { + options.Headers = param + return options +} + +// DisconnectVPNClientOptions : The DisconnectVPNClient options. +type DisconnectVPNClientOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN client identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDisconnectVPNClientOptions : Instantiate DisconnectVPNClientOptions +func (*VpcV1) NewDisconnectVPNClientOptions(vpnServerID string, id string) *DisconnectVPNClientOptions { + return &DisconnectVPNClientOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *DisconnectVPNClientOptions) SetVPNServerID(vpnServerID string) *DisconnectVPNClientOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DisconnectVPNClientOptions) SetID(id string) *DisconnectVPNClientOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DisconnectVPNClientOptions) SetHeaders(param map[string]string) *DisconnectVPNClientOptions { + options.Headers = param + return options +} + +// EncryptionKeyIdentity : Identifies an encryption key by a unique property. +// Models which "extend" this model: +// - EncryptionKeyIdentityByCRN +type EncryptionKeyIdentity struct { + // The CRN of the [Key Protect Root + // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto + // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. + CRN *string `json:"crn,omitempty"` +} + +func (*EncryptionKeyIdentity) isaEncryptionKeyIdentity() bool { + return true +} + +type EncryptionKeyIdentityIntf interface { + isaEncryptionKeyIdentity() bool +} + +// UnmarshalEncryptionKeyIdentity unmarshals an instance of EncryptionKeyIdentity from the specified map of raw messages. +func UnmarshalEncryptionKeyIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EncryptionKeyIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EncryptionKeyReference : EncryptionKeyReference struct +type EncryptionKeyReference struct { + // The CRN of the [Key Protect Root + // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto + // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. + CRN *string `json:"crn" validate:"required"` +} + +// UnmarshalEncryptionKeyReference unmarshals an instance of EncryptionKeyReference from the specified map of raw messages. +func UnmarshalEncryptionKeyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EncryptionKeyReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGateway : EndpointGateway struct +type EndpointGateway struct { + // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in + // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. + AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding" validate:"required"` + + // The date and time that the endpoint gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this endpoint gateway. + CRN *string `json:"crn" 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 endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // The reserved IPs bound to this endpoint gateway. + Ips []ReservedIPReference `json:"ips" validate:"required"` + + // The reasons for the current `lifecycle_state` (if any): + // - `dns_resolution_binding_pending`: the DNS resolution binding is being set up. + LifecycleReasons []EndpointGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the endpoint gateway. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this endpoint gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups targeting this endpoint gateway. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The fully qualified domain name for the target service. + // Deprecated: this field is deprecated and may be removed in a future release. + ServiceEndpoint *string `json:"service_endpoint,omitempty"` + + // The fully qualified domain names for the target service. + ServiceEndpoints []string `json:"service_endpoints" validate:"required"` + + // The target for this endpoint gateway. + Target EndpointGatewayTargetIntf `json:"target" validate:"required"` + + // The VPC this endpoint gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the EndpointGateway.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 ( + EndpointGatewayHealthStateDegradedConst = "degraded" + EndpointGatewayHealthStateFaultedConst = "faulted" + EndpointGatewayHealthStateInapplicableConst = "inapplicable" + EndpointGatewayHealthStateOkConst = "ok" +) + +// Constants associated with the EndpointGateway.LifecycleState property. +// The lifecycle state of the endpoint gateway. +const ( + EndpointGatewayLifecycleStateDeletingConst = "deleting" + EndpointGatewayLifecycleStateFailedConst = "failed" + EndpointGatewayLifecycleStatePendingConst = "pending" + EndpointGatewayLifecycleStateStableConst = "stable" + EndpointGatewayLifecycleStateSuspendedConst = "suspended" + EndpointGatewayLifecycleStateUpdatingConst = "updating" + EndpointGatewayLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the EndpointGateway.ResourceType property. +// The resource type. +const ( + EndpointGatewayResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +// UnmarshalEndpointGateway unmarshals an instance of EndpointGateway from the specified map of raw messages. +func UnmarshalEndpointGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGateway) + err = core.UnmarshalPrimitive(m, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalEndpointGatewayLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_endpoint", &obj.ServiceEndpoint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_endpoints", &obj.ServiceEndpoints) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalEndpointGatewayTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayCollection : EndpointGatewayCollection struct +type EndpointGatewayCollection struct { + // Collection of endpoint gateways. + EndpointGateways []EndpointGateway `json:"endpoint_gateways" validate:"required"` + + // A link to the first page of resources. + First *EndpointGatewayCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalEndpointGatewayCollection unmarshals an instance of EndpointGatewayCollection from the specified map of raw messages. +func UnmarshalEndpointGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayCollection) + err = core.UnmarshalModel(m, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGateway) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalEndpointGatewayCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalEndpointGatewayCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *EndpointGatewayCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayLifecycleReason : EndpointGatewayLifecycleReason struct +type EndpointGatewayLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 EndpointGatewayLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + EndpointGatewayLifecycleReasonCodeDnsResolutionBindingPendingConst = "dns_resolution_binding_pending" + EndpointGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalEndpointGatewayLifecycleReason unmarshals an instance of EndpointGatewayLifecycleReason from the specified map of raw messages. +func UnmarshalEndpointGatewayLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayPatch : EndpointGatewayPatch struct +type EndpointGatewayPatch struct { + // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in + // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. + // + // Must be `true` if the VPC this endpoint gateway resides in has `dns.enable_hub` set to + // `true`. + AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` + + // The name for this endpoint gateway. The name must not be used by another endpoint gateway in the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalEndpointGatewayPatch unmarshals an instance of EndpointGatewayPatch from the specified map of raw messages. +func UnmarshalEndpointGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayPatch) + err = core.UnmarshalPrimitive(m, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// EndpointGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type EndpointGatewayReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalEndpointGatewayReferenceDeleted unmarshals an instance of EndpointGatewayReferenceDeleted from the specified map of raw messages. +func UnmarshalEndpointGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReferenceRemote : EndpointGatewayReferenceRemote struct +type EndpointGatewayReferenceRemote struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` + + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + 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 *EndpointGatewayRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the EndpointGatewayReferenceRemote.ResourceType property. +// The resource type. +const ( + EndpointGatewayReferenceRemoteResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +// UnmarshalEndpointGatewayReferenceRemote unmarshals an instance of EndpointGatewayReferenceRemote from the specified map of raw messages. +func UnmarshalEndpointGatewayReferenceRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReferenceRemote) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalEndpointGatewayRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type EndpointGatewayRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // account, and identifies the owning account. + Account *AccountReference `json:"account,omitempty"` + + // If present, this property indicates that the referenced resource is remote to this + // region, and identifies the native region. + Region *RegionReference `json:"region,omitempty"` +} + +// UnmarshalEndpointGatewayRemote unmarshals an instance of EndpointGatewayRemote from the specified map of raw messages. +func UnmarshalEndpointGatewayRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayRemote) + err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIP : A reserved IP to bind to the endpoint gateway. This can be specified using an existing reserved IP, or a prototype +// object for a new reserved IP. The reserved IP will be bound to the endpoint gateway to function as a virtual private +// endpoint for the service. +// Models which "extend" this model: +// - EndpointGatewayReservedIPReservedIPIdentity +// - EndpointGatewayReservedIPReservedIPPrototypeTargetContext +type EndpointGatewayReservedIP struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` + + // 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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"` + + // The subnet in which to create this reserved IP. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` +} + +func (*EndpointGatewayReservedIP) isaEndpointGatewayReservedIP() bool { + return true +} + +type EndpointGatewayReservedIPIntf interface { + isaEndpointGatewayReservedIP() bool +} + +// UnmarshalEndpointGatewayReservedIP unmarshals an instance of EndpointGatewayReservedIP from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIP) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTarget : The target for this endpoint gateway. +// Models which "extend" this model: +// - EndpointGatewayTargetProviderCloudServiceReference +// - EndpointGatewayTargetProviderInfrastructureServiceReference +type EndpointGatewayTarget struct { + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn,omitempty"` + + // The type of target. + ResourceType *string `json:"resource_type,omitempty"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the EndpointGatewayTarget.ResourceType property. +// The type of target. +const ( + EndpointGatewayTargetResourceTypeProviderCloudServiceConst = "provider_cloud_service" +) + +func (*EndpointGatewayTarget) isaEndpointGatewayTarget() bool { + return true +} + +type EndpointGatewayTargetIntf interface { + isaEndpointGatewayTarget() bool +} + +// 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, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototype : The target to use for this endpoint gateway. Must not already be the target of another endpoint gateway in the VPC. +// Models which "extend" this model: +// - EndpointGatewayTargetPrototypeProviderCloudServiceIdentity +// - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity +type EndpointGatewayTargetPrototype struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn,omitempty"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the EndpointGatewayTargetPrototype.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetPrototype) isaEndpointGatewayTargetPrototype() bool { + return true +} + +type EndpointGatewayTargetPrototypeIntf interface { + isaEndpointGatewayTargetPrototype() bool +} + +// UnmarshalEndpointGatewayTargetPrototype unmarshals an instance of EndpointGatewayTargetPrototype from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "resource_type", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'resource_type': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'resource_type' not found in JSON object") + return + } + if discValue == "provider_cloud_service" { + err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity) + } else if discValue == "provider_infrastructure_service" { + err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'resource_type': %s", discValue) + } + return +} + +// FailoverShareOptions : The FailoverShare options. +type FailoverShareOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The action to take if the failover request is accepted but cannot be performed or times out: + // - `fail`: Fail the operation, resulting in the replication relationship being unchanged. + // - `split`: Split the replica from its source, resulting in two individual read-write + // file shares. Because the final sync was not completed, the replica may be + // out-of-date. This occurs in disaster recovery scenarios where the source is known to + // be unreachable. + FallbackPolicy *string `json:"fallback_policy,omitempty"` + + // The failover timeout in seconds. + // + // If the timeout is reached, the `fallback_policy` will be triggered. + Timeout *int64 `json:"timeout,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the FailoverShareOptions.FallbackPolicy property. +// The action to take if the failover request is accepted but cannot be performed or times out: +// - `fail`: Fail the operation, resulting in the replication relationship being unchanged. +// - `split`: Split the replica from its source, resulting in two individual read-write +// file shares. Because the final sync was not completed, the replica may be +// out-of-date. This occurs in disaster recovery scenarios where the source is known to +// be unreachable. +const ( + FailoverShareOptionsFallbackPolicyFailConst = "fail" + FailoverShareOptionsFallbackPolicySplitConst = "split" +) + +// NewFailoverShareOptions : Instantiate FailoverShareOptions +func (*VpcV1) NewFailoverShareOptions(shareID string) *FailoverShareOptions { + return &FailoverShareOptions{ + ShareID: core.StringPtr(shareID), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *FailoverShareOptions) SetShareID(shareID string) *FailoverShareOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetFallbackPolicy : Allow user to set FallbackPolicy +func (_options *FailoverShareOptions) SetFallbackPolicy(fallbackPolicy string) *FailoverShareOptions { + _options.FallbackPolicy = core.StringPtr(fallbackPolicy) + return _options +} + +// SetTimeout : Allow user to set Timeout +func (_options *FailoverShareOptions) SetTimeout(timeout int64) *FailoverShareOptions { + _options.Timeout = core.Int64Ptr(timeout) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *FailoverShareOptions) SetHeaders(param map[string]string) *FailoverShareOptions { + options.Headers = param + return options +} + +// FloatingIP : FloatingIP struct +type FloatingIP struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` + + // The date and time that the floating IP was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` + + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` + + // The name for this floating IP. The name is unique across all floating IPs in the region. + Name *string `json:"name" validate:"required"` + + // The resource group for this floating IP. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The status of the floating IP. + Status *string `json:"status" validate:"required"` + + // The target of this floating IP. + Target FloatingIPTargetIntf `json:"target,omitempty"` + + // The zone this floating IP resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the FloatingIP.Status property. +// The status of the floating IP. +const ( + FloatingIPStatusAvailableConst = "available" + FloatingIPStatusDeletingConst = "deleting" + FloatingIPStatusFailedConst = "failed" + FloatingIPStatusPendingConst = "pending" +) + +// UnmarshalFloatingIP unmarshals an instance of FloatingIP from the specified map of raw messages. +func UnmarshalFloatingIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPCollection : FloatingIPCollection struct +type FloatingIPCollection struct { + // A link to the first page of resources. + First *FloatingIPCollectionFirst `json:"first" validate:"required"` + + // Collection of floating IPs. + FloatingIps []FloatingIP `json:"floating_ips" 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 *FloatingIPCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFloatingIPCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *FloatingIPCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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"` + + // Collection of floating IPs bound to the virtual network interface specified by the identifier in the URL. + FloatingIps []FloatingIPReference `json:"floating_ips" 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 *FloatingIPCollectionVirtualNetworkInterfaceContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *FloatingIPCollectionVirtualNetworkInterfaceContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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. + Name *string `json:"name,omitempty"` + + // The target resource to bind this floating IP to, replacing any existing binding. + // The floating IP must not be required by another resource, such as a public gateway. + // + // The target resource must not already have a floating IP bound to it if the target + // resource is: + // + // - an instance network interface + // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` + // - a virtual network interface with `enable_infrastructure_nat` set to `true` + // + // Specify `null` to remove an existing binding. + Target FloatingIPTargetPatchIntf `json:"target,omitempty"` +} + +// UnmarshalFloatingIPPatch unmarshals an instance of FloatingIPPatch from the specified map of raw messages. +func UnmarshalFloatingIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// FloatingIPPrototype : FloatingIPPrototype struct +// Models which "extend" this model: +// - FloatingIPPrototypeFloatingIPByZone +// - FloatingIPPrototypeFloatingIPByTarget +type FloatingIPPrototype struct { + // The name for this floating IP. The name must not be used by another floating IP in the region. 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"` + + // The zone this floating IP will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // 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: + // + // - an instance network interface + // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` + // - a virtual network interface with `enable_infrastructure_nat` set to `true`. + Target FloatingIPTargetPrototypeIntf `json:"target,omitempty"` +} + +func (*FloatingIPPrototype) isaFloatingIPPrototype() bool { + return true +} + +type FloatingIPPrototypeIntf interface { + isaFloatingIPPrototype() bool +} + +// UnmarshalFloatingIPPrototype unmarshals an instance of FloatingIPPrototype from the specified map of raw messages. +func UnmarshalFloatingIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPReference : FloatingIPReference struct +type FloatingIPReference struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` + + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` + + // The name for this floating IP. The name is unique across all floating IPs in the region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalFloatingIPReference unmarshals an instance of FloatingIPReference from the specified map of raw messages. +func UnmarshalFloatingIPReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPReference) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type FloatingIPReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalFloatingIPReferenceDeleted unmarshals an instance of FloatingIPReferenceDeleted from the specified map of raw messages. +func UnmarshalFloatingIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTarget : The target of this floating IP. +// Models which "extend" this model: +// - FloatingIPTargetNetworkInterfaceReference +// - FloatingIPTargetBareMetalServerNetworkInterfaceReference +// - FloatingIPTargetPublicGatewayReference +// - FloatingIPTargetVirtualNetworkInterfaceReference +type FloatingIPTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance network interface. + // + // If this instance 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,omitempty"` + + // The unique identifier for this instance network interface. + // + // If this instance 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,omitempty"` + + // The name for this instance network interface. + Name *string `json:"name,omitempty"` + + PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The CRN for this public gateway. + CRN *string `json:"crn,omitempty"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet,omitempty"` +} + +// Constants associated with the FloatingIPTarget.ResourceType property. +// The resource type. +const ( + FloatingIPTargetResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FloatingIPTarget) isaFloatingIPTarget() bool { + return true +} + +type FloatingIPTargetIntf interface { + isaFloatingIPTarget() bool +} + +// UnmarshalFloatingIPTarget unmarshals an instance of FloatingIPTarget from the specified map of raw messages. +func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatch : The target resource to bind this floating IP to, replacing any existing binding. The floating IP must not be required +// by another resource, such as a public gateway. +// +// The target resource must not already have a floating IP bound to it if the target resource is: +// +// - an instance network interface +// - a bare metal server network interface with `enable_infrastructure_nat` set to `true` +// - a virtual network interface with `enable_infrastructure_nat` set to `true` +// +// Specify `null` to remove an existing binding. +// Models which "extend" this model: +// - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity +// - FloatingIPTargetPatchNetworkInterfaceIdentity +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +type FloatingIPTargetPatch struct { + // 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,omitempty"` + + // 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,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*FloatingIPTargetPatch) isaFloatingIPTargetPatch() bool { + return true +} + +type FloatingIPTargetPatchIntf interface { + isaFloatingIPTargetPatch() bool +} + +// UnmarshalFloatingIPTargetPatch unmarshals an instance of FloatingIPTargetPatch from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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: +// +// - an instance network interface +// - a bare metal server network interface with `enable_infrastructure_nat` set to `true` +// - a virtual network interface with `enable_infrastructure_nat` set to `true`. +// Models which "extend" this model: +// - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity +// - FloatingIPTargetPrototypeNetworkInterfaceIdentity +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity +type FloatingIPTargetPrototype struct { + // 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,omitempty"` + + // 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,omitempty"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn,omitempty"` +} + +func (*FloatingIPTargetPrototype) isaFloatingIPTargetPrototype() bool { + return true +} + +type FloatingIPTargetPrototypeIntf interface { + isaFloatingIPTargetPrototype() bool +} + +// UnmarshalFloatingIPTargetPrototype unmarshals an instance of FloatingIPTargetPrototype from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPUnpaginatedCollection : FloatingIPUnpaginatedCollection struct +type FloatingIPUnpaginatedCollection struct { + // Collection of floating IPs. + FloatingIps []FloatingIP `json:"floating_ips" validate:"required"` +} + +// UnmarshalFloatingIPUnpaginatedCollection unmarshals an instance of FloatingIPUnpaginatedCollection from the specified map of raw messages. +func UnmarshalFloatingIPUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPUnpaginatedCollection) + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollector : FlowLogCollector struct +type FlowLogCollector struct { + // Indicates whether this collector is active. + Active *bool `json:"active" validate:"required"` + + // Indicates whether this flow log collector will be automatically deleted when `target` is deleted. At present, this + // is always `true`, but may be modifiable in the future. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // The date and time that the flow log collector was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this flow log collector. + CRN *string `json:"crn" validate:"required"` + + // The URL for this flow log collector. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this flow log collector. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the flow log collector. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this flow log collector. The name is unique across all flow log collectors in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this flow log collector. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The Cloud Object Storage bucket where the collected flows are logged. For more + // information, see [Viewing flow log + // objects](https://cloud.ibm.com/docs/vpc?topic=vpc-fl-analyze). + StorageBucket *LegacyCloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` + + // The target this collector is collecting flow logs for. + // + // - If the target is an instance network attachment, flow logs will be collected + // for that instance network attachment. + // - If the target is an instance network interface, flow logs will be collected + // for that instance network interface. + // - If the target is a virtual network interface, flow logs will be collected for the + // virtual network interface's `target` resource if the resource is an instance network + // attachment, unless the target resource is itself the target of a flow log collector. + // - If the target is a virtual server instance, flow logs will be collected + // for all network attachments or network interfaces on that instance. + // - If the target is a subnet, flow logs will be collected + // for all instance network interfaces and virtual network interfaces + // attached to that subnet. + // - If the target is a VPC, flow logs will be collected for all instance network + // interfaces and virtual network interfaces attached to all subnets within that VPC. + // + // If the target is an instance, subnet, or VPC, flow logs will not be collected + // for any instance network attachments or instance network interfaces within the target + // that are themselves the target of a more specific flow log collector. + Target FlowLogCollectorTargetIntf `json:"target" validate:"required"` + + // The VPC this flow log collector resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the FlowLogCollector.LifecycleState property. +// The lifecycle state of the flow log collector. +const ( + FlowLogCollectorLifecycleStateDeletingConst = "deleting" + FlowLogCollectorLifecycleStateFailedConst = "failed" + FlowLogCollectorLifecycleStatePendingConst = "pending" + FlowLogCollectorLifecycleStateStableConst = "stable" + FlowLogCollectorLifecycleStateSuspendedConst = "suspended" + FlowLogCollectorLifecycleStateUpdatingConst = "updating" + FlowLogCollectorLifecycleStateWaitingConst = "waiting" +) + +// UnmarshalFlowLogCollector unmarshals an instance of FlowLogCollector from the specified map of raw messages. +func UnmarshalFlowLogCollector(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollector) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalLegacyCloudObjectStorageBucketReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFlowLogCollectorTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorCollection : FlowLogCollectorCollection struct +type FlowLogCollectorCollection struct { + // A link to the first page of resources. + First *FlowLogCollectorCollectionFirst `json:"first" validate:"required"` + + // Collection of flow log collectors. + FlowLogCollectors []FlowLogCollector `json:"flow_log_collectors" 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 *FlowLogCollectorCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "flow_log_collectors", &obj.FlowLogCollectors, UnmarshalFlowLogCollector) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFlowLogCollectorCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *FlowLogCollectorCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 + // activates the collector. + Active *bool `json:"active,omitempty"` + + // The name for this flow log collector. The name must not be used by another flow log collector in the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalFlowLogCollectorPatch unmarshals an instance of FlowLogCollectorPatch from the specified map of raw messages. +func UnmarshalFlowLogCollectorPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorPatch) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// FlowLogCollectorTarget : The target this collector is collecting flow logs for. +// +// - If the target is an instance network attachment, flow logs will be collected +// for that instance network attachment. +// - If the target is an instance network interface, flow logs will be collected +// for that instance network interface. +// - If the target is a virtual network interface, flow logs will be collected for the +// virtual network interface's `target` resource if the resource is an instance network +// attachment, unless the target resource is itself the target of a flow log collector. +// - If the target is a virtual server instance, flow logs will be collected +// for all network attachments or network interfaces on that instance. +// - If the target is a subnet, flow logs will be collected +// for all instance network interfaces and virtual network interfaces +// attached to that subnet. +// - If the target is a VPC, flow logs will be collected for all instance network +// interfaces and virtual network interfaces attached to all subnets within that VPC. +// +// If the target is an instance, subnet, or VPC, flow logs will not be collected for any instance network attachments or +// instance network interfaces within the target that are themselves the target of a more specific flow log collector. +// Models which "extend" this model: +// - FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext +// - FlowLogCollectorTargetInstanceReference +// - FlowLogCollectorTargetSubnetReference +// - FlowLogCollectorTargetVPCReference +// - FlowLogCollectorTargetInstanceNetworkAttachmentReference +// - FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext +type FlowLogCollectorTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this instance network interface. + // + // If this instance 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,omitempty"` + + // The unique identifier for this instance network interface. + // + // If this instance 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,omitempty"` + + // The name for this instance network interface. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The primary IP address of the virtual network interface for the instance network + // attachment. + PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` + + // The subnet of the virtual network interface for the instance network attachment. + Subnet *SubnetReference `json:"subnet,omitempty"` +} + +// Constants associated with the FlowLogCollectorTarget.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FlowLogCollectorTarget) isaFlowLogCollectorTarget() bool { + return true +} + +type FlowLogCollectorTargetIntf interface { + isaFlowLogCollectorTarget() bool +} + +// UnmarshalFlowLogCollectorTarget unmarshals an instance of FlowLogCollectorTarget from the specified map of raw messages. +func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototype : The target this collector will collect flow logs for. +// +// If the target is an instance, subnet, or VPC, flow logs will not be collected for any instance network attachments, +// virtual network interfaces or instance network interfaces within the target that are themselves the target of a more +// specific flow log collector. +// +// The target must not be a virtual network interface that is attached to a bare metal server network attachment or to a +// file share mount target. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity +// - FlowLogCollectorTargetPrototypeInstanceIdentity +// - FlowLogCollectorTargetPrototypeSubnetIdentity +// - FlowLogCollectorTargetPrototypeVPCIdentity +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity +type FlowLogCollectorTargetPrototype struct { + // The unique identifier for this instance network interface. + // + // If this instance 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,omitempty"` + + // The URL for this instance network interface. + // + // If this instance 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,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` +} + +func (*FlowLogCollectorTargetPrototype) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +type FlowLogCollectorTargetPrototypeIntf interface { + isaFlowLogCollectorTargetPrototype() bool +} + +// UnmarshalFlowLogCollectorTargetPrototype unmarshals an instance of FlowLogCollectorTargetPrototype from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// GenericResourceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type GenericResourceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalGenericResourceReferenceDeleted unmarshals an instance of GenericResourceReferenceDeleted from the specified map of raw messages. +func UnmarshalGenericResourceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(GenericResourceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// GetBackupPolicyJobOptions : The GetBackupPolicyJob options. +type GetBackupPolicyJobOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // The backup policy job identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBackupPolicyJobOptions : Instantiate GetBackupPolicyJobOptions +func (*VpcV1) NewGetBackupPolicyJobOptions(backupPolicyID string, id string) *GetBackupPolicyJobOptions { + return &GetBackupPolicyJobOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + ID: core.StringPtr(id), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *GetBackupPolicyJobOptions) SetBackupPolicyID(backupPolicyID string) *GetBackupPolicyJobOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBackupPolicyJobOptions) SetID(id string) *GetBackupPolicyJobOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBackupPolicyJobOptions) SetHeaders(param map[string]string) *GetBackupPolicyJobOptions { + options.Headers = param + return options +} + +// GetBackupPolicyOptions : The GetBackupPolicy options. +type GetBackupPolicyOptions struct { + // The backup policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBackupPolicyOptions : Instantiate GetBackupPolicyOptions +func (*VpcV1) NewGetBackupPolicyOptions(id string) *GetBackupPolicyOptions { + return &GetBackupPolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetBackupPolicyOptions) SetID(id string) *GetBackupPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBackupPolicyOptions) SetHeaders(param map[string]string) *GetBackupPolicyOptions { + options.Headers = param + return options +} + +// GetBackupPolicyPlanOptions : The GetBackupPolicyPlan options. +type GetBackupPolicyPlanOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // The backup policy plan identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBackupPolicyPlanOptions : Instantiate GetBackupPolicyPlanOptions +func (*VpcV1) NewGetBackupPolicyPlanOptions(backupPolicyID string, id string) *GetBackupPolicyPlanOptions { + return &GetBackupPolicyPlanOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + ID: core.StringPtr(id), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *GetBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *GetBackupPolicyPlanOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBackupPolicyPlanOptions) SetID(id string) *GetBackupPolicyPlanOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBackupPolicyPlanOptions) SetHeaders(param map[string]string) *GetBackupPolicyPlanOptions { + options.Headers = param + return options +} + +// GetBareMetalServerDiskOptions : The GetBareMetalServerDisk options. +type GetBareMetalServerDiskOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerDiskOptions : Instantiate GetBareMetalServerDiskOptions +func (*VpcV1) NewGetBareMetalServerDiskOptions(bareMetalServerID string, id string) *GetBareMetalServerDiskOptions { + return &GetBareMetalServerDiskOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *GetBareMetalServerDiskOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerDiskOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerDiskOptions) SetID(id string) *GetBareMetalServerDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerDiskOptions) SetHeaders(param map[string]string) *GetBareMetalServerDiskOptions { + options.Headers = param + return options +} + +// GetBareMetalServerInitializationOptions : The GetBareMetalServerInitialization options. +type GetBareMetalServerInitializationOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerInitializationOptions : Instantiate GetBareMetalServerInitializationOptions +func (*VpcV1) NewGetBareMetalServerInitializationOptions(id string) *GetBareMetalServerInitializationOptions { + return &GetBareMetalServerInitializationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerInitializationOptions) SetID(id string) *GetBareMetalServerInitializationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerInitializationOptions) SetHeaders(param map[string]string) *GetBareMetalServerInitializationOptions { + options.Headers = param + return options +} + +// GetBareMetalServerNetworkAttachmentOptions : The GetBareMetalServerNetworkAttachment options. +type GetBareMetalServerNetworkAttachmentOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerNetworkAttachmentOptions : Instantiate GetBareMetalServerNetworkAttachmentOptions +func (*VpcV1) NewGetBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string) *GetBareMetalServerNetworkAttachmentOptions { + return &GetBareMetalServerNetworkAttachmentOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *GetBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerNetworkAttachmentOptions) SetID(id string) *GetBareMetalServerNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkAttachmentOptions { + options.Headers = param + return options +} + +// GetBareMetalServerNetworkInterfaceFloatingIPOptions : The GetBareMetalServerNetworkInterfaceFloatingIP options. +type GetBareMetalServerNetworkInterfaceFloatingIPOptions 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 +} + +// NewGetBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate GetBareMetalServerNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewGetBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { + return &GetBareMetalServerNetworkInterfaceFloatingIPOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// GetBareMetalServerNetworkInterfaceIPOptions : The GetBareMetalServerNetworkInterfaceIP options. +type GetBareMetalServerNetworkInterfaceIPOptions 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 reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerNetworkInterfaceIPOptions : Instantiate GetBareMetalServerNetworkInterfaceIPOptions +func (*VpcV1) NewGetBareMetalServerNetworkInterfaceIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *GetBareMetalServerNetworkInterfaceIPOptions { + return &GetBareMetalServerNetworkInterfaceIPOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceIPOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetBareMetalServerNetworkInterfaceIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceIPOptions { + options.Headers = param + return options +} + +// GetBareMetalServerNetworkInterfaceOptions : The GetBareMetalServerNetworkInterface options. +type GetBareMetalServerNetworkInterfaceOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerNetworkInterfaceOptions : Instantiate GetBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewGetBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string) *GetBareMetalServerNetworkInterfaceOptions { + return &GetBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *GetBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerNetworkInterfaceOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options +} + +// GetBareMetalServerOptions : The GetBareMetalServer options. +type GetBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerOptions : Instantiate GetBareMetalServerOptions +func (*VpcV1) NewGetBareMetalServerOptions(id string) *GetBareMetalServerOptions { + return &GetBareMetalServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetBareMetalServerOptions) SetID(id string) *GetBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerOptions) SetHeaders(param map[string]string) *GetBareMetalServerOptions { + options.Headers = param + return options +} + +// GetBareMetalServerProfileOptions : The GetBareMetalServerProfile options. +type GetBareMetalServerProfileOptions struct { + // The bare metal server profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetBareMetalServerProfileOptions : Instantiate GetBareMetalServerProfileOptions +func (*VpcV1) NewGetBareMetalServerProfileOptions(name string) *GetBareMetalServerProfileOptions { + return &GetBareMetalServerProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetBareMetalServerProfileOptions) SetName(name string) *GetBareMetalServerProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetBareMetalServerProfileOptions) SetHeaders(param map[string]string) *GetBareMetalServerProfileOptions { + options.Headers = param + return options +} + +// GetDedicatedHostDiskOptions : The GetDedicatedHostDisk options. +type GetDedicatedHostDiskOptions struct { + // The dedicated host identifier. + DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="` + + // The dedicated host disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostDiskOptions : Instantiate GetDedicatedHostDiskOptions +func (*VpcV1) NewGetDedicatedHostDiskOptions(dedicatedHostID string, id string) *GetDedicatedHostDiskOptions { + return &GetDedicatedHostDiskOptions{ + DedicatedHostID: core.StringPtr(dedicatedHostID), + ID: core.StringPtr(id), + } +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (_options *GetDedicatedHostDiskOptions) SetDedicatedHostID(dedicatedHostID string) *GetDedicatedHostDiskOptions { + _options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetDedicatedHostDiskOptions) SetID(id string) *GetDedicatedHostDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostDiskOptions) SetHeaders(param map[string]string) *GetDedicatedHostDiskOptions { + options.Headers = param + return options +} + +// GetDedicatedHostGroupOptions : The GetDedicatedHostGroup options. +type GetDedicatedHostGroupOptions struct { + // The dedicated host group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostGroupOptions : Instantiate GetDedicatedHostGroupOptions +func (*VpcV1) NewGetDedicatedHostGroupOptions(id string) *GetDedicatedHostGroupOptions { + return &GetDedicatedHostGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetDedicatedHostGroupOptions) SetID(id string) *GetDedicatedHostGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostGroupOptions) SetHeaders(param map[string]string) *GetDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// GetDedicatedHostOptions : The GetDedicatedHost options. +type GetDedicatedHostOptions struct { + // The dedicated host identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostOptions : Instantiate GetDedicatedHostOptions +func (*VpcV1) NewGetDedicatedHostOptions(id string) *GetDedicatedHostOptions { + return &GetDedicatedHostOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetDedicatedHostOptions) SetID(id string) *GetDedicatedHostOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostOptions) SetHeaders(param map[string]string) *GetDedicatedHostOptions { + options.Headers = param + return options +} + +// GetDedicatedHostProfileOptions : The GetDedicatedHostProfile options. +type GetDedicatedHostProfileOptions struct { + // The dedicated host profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostProfileOptions : Instantiate GetDedicatedHostProfileOptions +func (*VpcV1) NewGetDedicatedHostProfileOptions(name string) *GetDedicatedHostProfileOptions { + return &GetDedicatedHostProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetDedicatedHostProfileOptions) SetName(name string) *GetDedicatedHostProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostProfileOptions) SetHeaders(param map[string]string) *GetDedicatedHostProfileOptions { + options.Headers = param + return options +} + +// GetEndpointGatewayIPOptions : The GetEndpointGatewayIP options. +type GetEndpointGatewayIPOptions 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 +} + +// NewGetEndpointGatewayIPOptions : Instantiate GetEndpointGatewayIPOptions +func (*VpcV1) NewGetEndpointGatewayIPOptions(endpointGatewayID string, id string) *GetEndpointGatewayIPOptions { + return &GetEndpointGatewayIPOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + ID: core.StringPtr(id), + } +} + +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (_options *GetEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *GetEndpointGatewayIPOptions { + _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetEndpointGatewayIPOptions) SetID(id string) *GetEndpointGatewayIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetEndpointGatewayIPOptions) SetHeaders(param map[string]string) *GetEndpointGatewayIPOptions { + options.Headers = param + return options +} + +// GetEndpointGatewayOptions : The GetEndpointGateway options. +type GetEndpointGatewayOptions struct { + // The endpoint gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetEndpointGatewayOptions : Instantiate GetEndpointGatewayOptions +func (*VpcV1) NewGetEndpointGatewayOptions(id string) *GetEndpointGatewayOptions { + return &GetEndpointGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetEndpointGatewayOptions) SetID(id string) *GetEndpointGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetEndpointGatewayOptions) SetHeaders(param map[string]string) *GetEndpointGatewayOptions { + options.Headers = param + return options +} + +// GetFloatingIPOptions : The GetFloatingIP options. +type GetFloatingIPOptions struct { + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetFloatingIPOptions : Instantiate GetFloatingIPOptions +func (*VpcV1) NewGetFloatingIPOptions(id string) *GetFloatingIPOptions { + return &GetFloatingIPOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetFloatingIPOptions) SetID(id string) *GetFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetFloatingIPOptions) SetHeaders(param map[string]string) *GetFloatingIPOptions { + options.Headers = param + return options +} + +// GetFlowLogCollectorOptions : The GetFlowLogCollector options. +type GetFlowLogCollectorOptions struct { + // The flow log collector identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetFlowLogCollectorOptions : Instantiate GetFlowLogCollectorOptions +func (*VpcV1) NewGetFlowLogCollectorOptions(id string) *GetFlowLogCollectorOptions { + return &GetFlowLogCollectorOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetFlowLogCollectorOptions) SetID(id string) *GetFlowLogCollectorOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetFlowLogCollectorOptions) SetHeaders(param map[string]string) *GetFlowLogCollectorOptions { + options.Headers = param + return options +} + +// GetIkePolicyOptions : The GetIkePolicy options. +type GetIkePolicyOptions struct { + // The IKE policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetIkePolicyOptions : Instantiate GetIkePolicyOptions +func (*VpcV1) NewGetIkePolicyOptions(id string) *GetIkePolicyOptions { + return &GetIkePolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetIkePolicyOptions) SetID(id string) *GetIkePolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetIkePolicyOptions) SetHeaders(param map[string]string) *GetIkePolicyOptions { + options.Headers = param + return options +} + +// GetImageExportJobOptions : The GetImageExportJob options. +type GetImageExportJobOptions struct { + // The image identifier. + ImageID *string `json:"image_id" validate:"required,ne="` + + // The image export job identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetImageExportJobOptions : Instantiate GetImageExportJobOptions +func (*VpcV1) NewGetImageExportJobOptions(imageID string, id string) *GetImageExportJobOptions { + return &GetImageExportJobOptions{ + ImageID: core.StringPtr(imageID), + ID: core.StringPtr(id), + } +} + +// SetImageID : Allow user to set ImageID +func (_options *GetImageExportJobOptions) SetImageID(imageID string) *GetImageExportJobOptions { + _options.ImageID = core.StringPtr(imageID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetImageExportJobOptions) SetID(id string) *GetImageExportJobOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetImageExportJobOptions) SetHeaders(param map[string]string) *GetImageExportJobOptions { + options.Headers = param + return options +} + +// GetImageOptions : The GetImage options. +type GetImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetImageOptions : Instantiate GetImageOptions +func (*VpcV1) NewGetImageOptions(id string) *GetImageOptions { + return &GetImageOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetImageOptions) SetID(id string) *GetImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetImageOptions) SetHeaders(param map[string]string) *GetImageOptions { + options.Headers = param + return options +} + +// GetInstanceDiskOptions : The GetInstanceDisk options. +type GetInstanceDiskOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceDiskOptions : Instantiate GetInstanceDiskOptions +func (*VpcV1) NewGetInstanceDiskOptions(instanceID string, id string) *GetInstanceDiskOptions { + return &GetInstanceDiskOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceDiskOptions) SetInstanceID(instanceID string) *GetInstanceDiskOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceDiskOptions) SetID(id string) *GetInstanceDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceDiskOptions) SetHeaders(param map[string]string) *GetInstanceDiskOptions { + options.Headers = param + return options +} + +// GetInstanceGroupManagerActionOptions : The GetInstanceGroupManagerAction options. +type GetInstanceGroupManagerActionOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager action identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupManagerActionOptions : Instantiate GetInstanceGroupManagerActionOptions +func (*VpcV1) NewGetInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string) *GetInstanceGroupManagerActionOptions { + return &GetInstanceGroupManagerActionOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *GetInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerActionOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *GetInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *GetInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupManagerActionOptions) SetID(id string) *GetInstanceGroupManagerActionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerActionOptions { + options.Headers = param + return options +} + +// GetInstanceGroupManagerOptions : The GetInstanceGroupManager options. +type GetInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupManagerOptions : Instantiate GetInstanceGroupManagerOptions +func (*VpcV1) NewGetInstanceGroupManagerOptions(instanceGroupID string, id string) *GetInstanceGroupManagerOptions { + return &GetInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *GetInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupManagerOptions) SetID(id string) *GetInstanceGroupManagerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupManagerOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// GetInstanceGroupManagerPolicyOptions : The GetInstanceGroupManagerPolicy options. +type GetInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupManagerPolicyOptions : Instantiate GetInstanceGroupManagerPolicyOptions +func (*VpcV1) NewGetInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string) *GetInstanceGroupManagerPolicyOptions { + return &GetInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *GetInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerPolicyOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *GetInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *GetInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupManagerPolicyOptions) SetID(id string) *GetInstanceGroupManagerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// GetInstanceGroupMembershipOptions : The GetInstanceGroupMembership options. +type GetInstanceGroupMembershipOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group membership identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupMembershipOptions : Instantiate GetInstanceGroupMembershipOptions +func (*VpcV1) NewGetInstanceGroupMembershipOptions(instanceGroupID string, id string) *GetInstanceGroupMembershipOptions { + return &GetInstanceGroupMembershipOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *GetInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupMembershipOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupMembershipOptions) SetID(id string) *GetInstanceGroupMembershipOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *GetInstanceGroupMembershipOptions { + options.Headers = param + return options +} + +// GetInstanceGroupOptions : The GetInstanceGroup options. +type GetInstanceGroupOptions struct { + // The instance group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupOptions : Instantiate GetInstanceGroupOptions +func (*VpcV1) NewGetInstanceGroupOptions(id string) *GetInstanceGroupOptions { + return &GetInstanceGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetInstanceGroupOptions) SetID(id string) *GetInstanceGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupOptions) SetHeaders(param map[string]string) *GetInstanceGroupOptions { + options.Headers = param + return options +} + +// GetInstanceInitializationOptions : The GetInstanceInitialization options. +type GetInstanceInitializationOptions struct { + // The instance identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceInitializationOptions : Instantiate GetInstanceInitializationOptions +func (*VpcV1) NewGetInstanceInitializationOptions(id string) *GetInstanceInitializationOptions { + return &GetInstanceInitializationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetInstanceInitializationOptions) SetID(id string) *GetInstanceInitializationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceInitializationOptions) SetHeaders(param map[string]string) *GetInstanceInitializationOptions { + options.Headers = param + return options +} + +// GetInstanceNetworkAttachmentOptions : The GetInstanceNetworkAttachment options. +type GetInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceNetworkAttachmentOptions : Instantiate GetInstanceNetworkAttachmentOptions +func (*VpcV1) NewGetInstanceNetworkAttachmentOptions(instanceID string, id string) *GetInstanceNetworkAttachmentOptions { + return &GetInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceNetworkAttachmentOptions) SetID(id string) *GetInstanceNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + +// GetInstanceNetworkInterfaceFloatingIPOptions : The GetInstanceNetworkInterfaceFloatingIP options. +type GetInstanceNetworkInterfaceFloatingIPOptions 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 +} + +// NewGetInstanceNetworkInterfaceFloatingIPOptions : Instantiate GetInstanceNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewGetInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *GetInstanceNetworkInterfaceFloatingIPOptions { + return &GetInstanceNetworkInterfaceFloatingIPOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceFloatingIPOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *GetInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetInstanceNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *GetInstanceNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// GetInstanceNetworkInterfaceIPOptions : The GetInstanceNetworkInterfaceIP options. +type GetInstanceNetworkInterfaceIPOptions 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 reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceNetworkInterfaceIPOptions : Instantiate GetInstanceNetworkInterfaceIPOptions +func (*VpcV1) NewGetInstanceNetworkInterfaceIPOptions(instanceID string, networkInterfaceID string, id string) *GetInstanceNetworkInterfaceIPOptions { + return &GetInstanceNetworkInterfaceIPOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceNetworkInterfaceIPOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceIPOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *GetInstanceNetworkInterfaceIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetInstanceNetworkInterfaceIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceNetworkInterfaceIPOptions) SetID(id string) *GetInstanceNetworkInterfaceIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceIPOptions { + options.Headers = param + return options +} + +// GetInstanceNetworkInterfaceOptions : The GetInstanceNetworkInterface options. +type GetInstanceNetworkInterfaceOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceNetworkInterfaceOptions : Instantiate GetInstanceNetworkInterfaceOptions +func (*VpcV1) NewGetInstanceNetworkInterfaceOptions(instanceID string, id string) *GetInstanceNetworkInterfaceOptions { + return &GetInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceNetworkInterfaceOptions) SetID(id string) *GetInstanceNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// GetInstanceOptions : The GetInstance options. +type GetInstanceOptions struct { + // The virtual server instance identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceOptions : Instantiate GetInstanceOptions +func (*VpcV1) NewGetInstanceOptions(id string) *GetInstanceOptions { + return &GetInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetInstanceOptions) SetID(id string) *GetInstanceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceOptions) SetHeaders(param map[string]string) *GetInstanceOptions { + options.Headers = param + return options +} + +// GetInstanceProfileOptions : The GetInstanceProfile options. +type GetInstanceProfileOptions struct { + // The instance profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceProfileOptions : Instantiate GetInstanceProfileOptions +func (*VpcV1) NewGetInstanceProfileOptions(name string) *GetInstanceProfileOptions { + return &GetInstanceProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetInstanceProfileOptions) SetName(name string) *GetInstanceProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceProfileOptions) SetHeaders(param map[string]string) *GetInstanceProfileOptions { + options.Headers = param + return options +} + +// GetInstanceTemplateOptions : The GetInstanceTemplate options. +type GetInstanceTemplateOptions struct { + // The instance template identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceTemplateOptions : Instantiate GetInstanceTemplateOptions +func (*VpcV1) NewGetInstanceTemplateOptions(id string) *GetInstanceTemplateOptions { + return &GetInstanceTemplateOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetInstanceTemplateOptions) SetID(id string) *GetInstanceTemplateOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceTemplateOptions) SetHeaders(param map[string]string) *GetInstanceTemplateOptions { + options.Headers = param + return options +} + +// GetInstanceVolumeAttachmentOptions : The GetInstanceVolumeAttachment options. +type GetInstanceVolumeAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The volume attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceVolumeAttachmentOptions : Instantiate GetInstanceVolumeAttachmentOptions +func (*VpcV1) NewGetInstanceVolumeAttachmentOptions(instanceID string, id string) *GetInstanceVolumeAttachmentOptions { + return &GetInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *GetInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceVolumeAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetInstanceVolumeAttachmentOptions) SetID(id string) *GetInstanceVolumeAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// GetIpsecPolicyOptions : The GetIpsecPolicy options. +type GetIpsecPolicyOptions struct { + // The IPsec policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetIpsecPolicyOptions : Instantiate GetIpsecPolicyOptions +func (*VpcV1) NewGetIpsecPolicyOptions(id string) *GetIpsecPolicyOptions { + return &GetIpsecPolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetIpsecPolicyOptions) SetID(id string) *GetIpsecPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetIpsecPolicyOptions) SetHeaders(param map[string]string) *GetIpsecPolicyOptions { + options.Headers = param + return options +} + +// GetKeyOptions : The GetKey options. +type GetKeyOptions struct { + // The key identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetKeyOptions : Instantiate GetKeyOptions +func (*VpcV1) NewGetKeyOptions(id string) *GetKeyOptions { + return &GetKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetKeyOptions) SetID(id string) *GetKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetKeyOptions) SetHeaders(param map[string]string) *GetKeyOptions { + options.Headers = param + return options +} + +// GetLoadBalancerListenerOptions : The GetLoadBalancerListener options. +type GetLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerListenerOptions : Instantiate GetLoadBalancerListenerOptions +func (*VpcV1) NewGetLoadBalancerListenerOptions(loadBalancerID string, id string) *GetLoadBalancerListenerOptions { + return &GetLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerListenerOptions) SetID(id string) *GetLoadBalancerListenerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerListenerOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// GetLoadBalancerListenerPolicyOptions : The GetLoadBalancerListenerPolicy options. +type GetLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerListenerPolicyOptions : Instantiate GetLoadBalancerListenerPolicyOptions +func (*VpcV1) NewGetLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string) *GetLoadBalancerListenerPolicyOptions { + return &GetLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerPolicyOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *GetLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *GetLoadBalancerListenerPolicyOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerListenerPolicyOptions) SetID(id string) *GetLoadBalancerListenerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// GetLoadBalancerListenerPolicyRuleOptions : The GetLoadBalancerListenerPolicyRule options. +type GetLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerListenerPolicyRuleOptions : Instantiate GetLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewGetLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string) *GetLoadBalancerListenerPolicyRuleOptions { + return &GetLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *GetLoadBalancerListenerPolicyRuleOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *GetLoadBalancerListenerPolicyRuleOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetID(id string) *GetLoadBalancerListenerPolicyRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// GetLoadBalancerOptions : The GetLoadBalancer options. +type GetLoadBalancerOptions struct { + // The load balancer identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerOptions : Instantiate GetLoadBalancerOptions +func (*VpcV1) NewGetLoadBalancerOptions(id string) *GetLoadBalancerOptions { + return &GetLoadBalancerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerOptions) SetID(id string) *GetLoadBalancerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerOptions) SetHeaders(param map[string]string) *GetLoadBalancerOptions { + options.Headers = param + return options +} + +// GetLoadBalancerPoolMemberOptions : The GetLoadBalancerPoolMember options. +type GetLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The member identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerPoolMemberOptions : Instantiate GetLoadBalancerPoolMemberOptions +func (*VpcV1) NewGetLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string) *GetLoadBalancerPoolMemberOptions { + return &GetLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerPoolMemberOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *GetLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *GetLoadBalancerPoolMemberOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerPoolMemberOptions) SetID(id string) *GetLoadBalancerPoolMemberOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *GetLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// GetLoadBalancerPoolOptions : The GetLoadBalancerPool options. +type GetLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerPoolOptions : Instantiate GetLoadBalancerPoolOptions +func (*VpcV1) NewGetLoadBalancerPoolOptions(loadBalancerID string, id string) *GetLoadBalancerPoolOptions { + return &GetLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *GetLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerPoolOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerPoolOptions) SetID(id string) *GetLoadBalancerPoolOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerPoolOptions) SetHeaders(param map[string]string) *GetLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// GetLoadBalancerProfileOptions : The GetLoadBalancerProfile options. +type GetLoadBalancerProfileOptions struct { + // The load balancer profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerProfileOptions : Instantiate GetLoadBalancerProfileOptions +func (*VpcV1) NewGetLoadBalancerProfileOptions(name string) *GetLoadBalancerProfileOptions { + return &GetLoadBalancerProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetLoadBalancerProfileOptions) SetName(name string) *GetLoadBalancerProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerProfileOptions) SetHeaders(param map[string]string) *GetLoadBalancerProfileOptions { + options.Headers = param + return options +} + +// GetLoadBalancerStatisticsOptions : The GetLoadBalancerStatistics options. +type GetLoadBalancerStatisticsOptions struct { + // The load balancer identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerStatisticsOptions : Instantiate GetLoadBalancerStatisticsOptions +func (*VpcV1) NewGetLoadBalancerStatisticsOptions(id string) *GetLoadBalancerStatisticsOptions { + return &GetLoadBalancerStatisticsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetLoadBalancerStatisticsOptions) SetID(id string) *GetLoadBalancerStatisticsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerStatisticsOptions) SetHeaders(param map[string]string) *GetLoadBalancerStatisticsOptions { + options.Headers = param + return options +} + +// GetNetworkACLOptions : The GetNetworkACL options. +type GetNetworkACLOptions struct { + // The network ACL identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetNetworkACLOptions : Instantiate GetNetworkACLOptions +func (*VpcV1) NewGetNetworkACLOptions(id string) *GetNetworkACLOptions { + return &GetNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetNetworkACLOptions) SetID(id string) *GetNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetNetworkACLOptions) SetHeaders(param map[string]string) *GetNetworkACLOptions { + options.Headers = param + return options +} + +// GetNetworkACLRuleOptions : The GetNetworkACLRule options. +type GetNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetNetworkACLRuleOptions : Instantiate GetNetworkACLRuleOptions +func (*VpcV1) NewGetNetworkACLRuleOptions(networkACLID string, id string) *GetNetworkACLRuleOptions { + return &GetNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + ID: core.StringPtr(id), + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *GetNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *GetNetworkACLRuleOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetNetworkACLRuleOptions) SetID(id string) *GetNetworkACLRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetNetworkACLRuleOptions) SetHeaders(param map[string]string) *GetNetworkACLRuleOptions { + options.Headers = param + return options +} + +// GetNetworkInterfaceFloatingIPOptions : The GetNetworkInterfaceFloatingIP options. +type GetNetworkInterfaceFloatingIPOptions 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 +} + +// NewGetNetworkInterfaceFloatingIPOptions : Instantiate GetNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewGetNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *GetNetworkInterfaceFloatingIPOptions { + return &GetNetworkInterfaceFloatingIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *GetNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *GetNetworkInterfaceFloatingIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetNetworkInterfaceFloatingIPOptions) SetID(id string) *GetNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// GetOperatingSystemOptions : The GetOperatingSystem options. +type GetOperatingSystemOptions struct { + // The operating system name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetOperatingSystemOptions : Instantiate GetOperatingSystemOptions +func (*VpcV1) NewGetOperatingSystemOptions(name string) *GetOperatingSystemOptions { + return &GetOperatingSystemOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetOperatingSystemOptions) SetName(name string) *GetOperatingSystemOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetOperatingSystemOptions) SetHeaders(param map[string]string) *GetOperatingSystemOptions { + options.Headers = param + return options +} + +// GetPlacementGroupOptions : The GetPlacementGroup options. +type GetPlacementGroupOptions struct { + // The placement group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetPlacementGroupOptions : Instantiate GetPlacementGroupOptions +func (*VpcV1) NewGetPlacementGroupOptions(id string) *GetPlacementGroupOptions { + return &GetPlacementGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetPlacementGroupOptions) SetID(id string) *GetPlacementGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetPlacementGroupOptions) SetHeaders(param map[string]string) *GetPlacementGroupOptions { + options.Headers = param + return options +} + +// GetPublicGatewayOptions : The GetPublicGateway options. +type GetPublicGatewayOptions struct { + // The public gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetPublicGatewayOptions : Instantiate GetPublicGatewayOptions +func (*VpcV1) NewGetPublicGatewayOptions(id string) *GetPublicGatewayOptions { + return &GetPublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetPublicGatewayOptions) SetID(id string) *GetPublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetPublicGatewayOptions) SetHeaders(param map[string]string) *GetPublicGatewayOptions { + options.Headers = param + return options +} + +// GetRegionOptions : The GetRegion options. +type GetRegionOptions struct { + // The region name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetRegionOptions : Instantiate GetRegionOptions +func (*VpcV1) NewGetRegionOptions(name string) *GetRegionOptions { + return &GetRegionOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetRegionOptions) SetName(name string) *GetRegionOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetRegionOptions) SetHeaders(param map[string]string) *GetRegionOptions { + options.Headers = param + return options +} + +// GetRegionZoneOptions : The GetRegionZone options. +type GetRegionZoneOptions struct { + // The region name. + RegionName *string `json:"region_name" validate:"required,ne="` + + // The zone name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetRegionZoneOptions : Instantiate GetRegionZoneOptions +func (*VpcV1) NewGetRegionZoneOptions(regionName string, name string) *GetRegionZoneOptions { + return &GetRegionZoneOptions{ + RegionName: core.StringPtr(regionName), + Name: core.StringPtr(name), + } +} + +// SetRegionName : Allow user to set RegionName +func (_options *GetRegionZoneOptions) SetRegionName(regionName string) *GetRegionZoneOptions { + _options.RegionName = core.StringPtr(regionName) + return _options +} + +// SetName : Allow user to set Name +func (_options *GetRegionZoneOptions) SetName(name string) *GetRegionZoneOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetRegionZoneOptions) SetHeaders(param map[string]string) *GetRegionZoneOptions { + options.Headers = param + return options +} + +// GetReservationOptions : The GetReservation options. +type GetReservationOptions struct { + // The reservation identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetReservationOptions : Instantiate GetReservationOptions +func (*VpcV1) NewGetReservationOptions(id string) *GetReservationOptions { + return &GetReservationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetReservationOptions) SetID(id string) *GetReservationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetReservationOptions) SetHeaders(param map[string]string) *GetReservationOptions { + options.Headers = param + return options +} + +// GetSecurityGroupOptions : The GetSecurityGroup options. +type GetSecurityGroupOptions struct { + // The security group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSecurityGroupOptions : Instantiate GetSecurityGroupOptions +func (*VpcV1) NewGetSecurityGroupOptions(id string) *GetSecurityGroupOptions { + return &GetSecurityGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSecurityGroupOptions) SetID(id string) *GetSecurityGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSecurityGroupOptions) SetHeaders(param map[string]string) *GetSecurityGroupOptions { + options.Headers = param + return options +} + +// GetSecurityGroupRuleOptions : The GetSecurityGroupRule options. +type GetSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSecurityGroupRuleOptions : Instantiate GetSecurityGroupRuleOptions +func (*VpcV1) NewGetSecurityGroupRuleOptions(securityGroupID string, id string) *GetSecurityGroupRuleOptions { + return &GetSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *GetSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *GetSecurityGroupRuleOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetSecurityGroupRuleOptions) SetID(id string) *GetSecurityGroupRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSecurityGroupRuleOptions) SetHeaders(param map[string]string) *GetSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// GetSecurityGroupTargetOptions : The GetSecurityGroupTarget options. +type GetSecurityGroupTargetOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The security group target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSecurityGroupTargetOptions : Instantiate GetSecurityGroupTargetOptions +func (*VpcV1) NewGetSecurityGroupTargetOptions(securityGroupID string, id string) *GetSecurityGroupTargetOptions { + return &GetSecurityGroupTargetOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *GetSecurityGroupTargetOptions) SetSecurityGroupID(securityGroupID string) *GetSecurityGroupTargetOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetSecurityGroupTargetOptions) SetID(id string) *GetSecurityGroupTargetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSecurityGroupTargetOptions) SetHeaders(param map[string]string) *GetSecurityGroupTargetOptions { + options.Headers = param + return options +} + +// GetShareMountTargetOptions : The GetShareMountTarget options. +type GetShareMountTargetOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share mount target identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetShareMountTargetOptions : Instantiate GetShareMountTargetOptions +func (*VpcV1) NewGetShareMountTargetOptions(shareID string, id string) *GetShareMountTargetOptions { + return &GetShareMountTargetOptions{ + ShareID: core.StringPtr(shareID), + ID: core.StringPtr(id), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *GetShareMountTargetOptions) SetShareID(shareID string) *GetShareMountTargetOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetShareMountTargetOptions) SetID(id string) *GetShareMountTargetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetShareMountTargetOptions) SetHeaders(param map[string]string) *GetShareMountTargetOptions { + options.Headers = param + return options +} + +// GetShareOptions : The GetShare options. +type GetShareOptions struct { + // The file share identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetShareOptions : Instantiate GetShareOptions +func (*VpcV1) NewGetShareOptions(id string) *GetShareOptions { + return &GetShareOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetShareOptions) SetID(id string) *GetShareOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetShareOptions) SetHeaders(param map[string]string) *GetShareOptions { + options.Headers = param + return options +} + +// GetShareProfileOptions : The GetShareProfile options. +type GetShareProfileOptions struct { + // The file share profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetShareProfileOptions : Instantiate GetShareProfileOptions +func (*VpcV1) NewGetShareProfileOptions(name string) *GetShareProfileOptions { + return &GetShareProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetShareProfileOptions) SetName(name string) *GetShareProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetShareProfileOptions) SetHeaders(param map[string]string) *GetShareProfileOptions { + options.Headers = param + return options +} + +// GetShareSourceOptions : The GetShareSource options. +type GetShareSourceOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetShareSourceOptions : Instantiate GetShareSourceOptions +func (*VpcV1) NewGetShareSourceOptions(shareID string) *GetShareSourceOptions { + return &GetShareSourceOptions{ + ShareID: core.StringPtr(shareID), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *GetShareSourceOptions) SetShareID(shareID string) *GetShareSourceOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetShareSourceOptions) SetHeaders(param map[string]string) *GetShareSourceOptions { + options.Headers = param + return options +} + +// GetSnapshotCloneOptions : The GetSnapshotClone options. +type GetSnapshotCloneOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // The zone name. + ZoneName *string `json:"zone_name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSnapshotCloneOptions : Instantiate GetSnapshotCloneOptions +func (*VpcV1) NewGetSnapshotCloneOptions(id string, zoneName string) *GetSnapshotCloneOptions { + return &GetSnapshotCloneOptions{ + ID: core.StringPtr(id), + ZoneName: core.StringPtr(zoneName), + } +} + +// SetID : Allow user to set ID +func (_options *GetSnapshotCloneOptions) SetID(id string) *GetSnapshotCloneOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *GetSnapshotCloneOptions) SetZoneName(zoneName string) *GetSnapshotCloneOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSnapshotCloneOptions) SetHeaders(param map[string]string) *GetSnapshotCloneOptions { + options.Headers = param + return options +} + +// GetSnapshotConsistencyGroupOptions : The GetSnapshotConsistencyGroup options. +type GetSnapshotConsistencyGroupOptions struct { + // The snapshot consistency group identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSnapshotConsistencyGroupOptions : Instantiate GetSnapshotConsistencyGroupOptions +func (*VpcV1) NewGetSnapshotConsistencyGroupOptions(id string) *GetSnapshotConsistencyGroupOptions { + return &GetSnapshotConsistencyGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSnapshotConsistencyGroupOptions) SetID(id string) *GetSnapshotConsistencyGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *GetSnapshotConsistencyGroupOptions { + options.Headers = param + return options +} + +// GetSnapshotOptions : The GetSnapshot options. +type GetSnapshotOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSnapshotOptions : Instantiate GetSnapshotOptions +func (*VpcV1) NewGetSnapshotOptions(id string) *GetSnapshotOptions { + return &GetSnapshotOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSnapshotOptions) SetID(id string) *GetSnapshotOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSnapshotOptions) SetHeaders(param map[string]string) *GetSnapshotOptions { + options.Headers = param + return options +} + +// GetSubnetNetworkACLOptions : The GetSubnetNetworkACL options. +type GetSubnetNetworkACLOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetNetworkACLOptions : Instantiate GetSubnetNetworkACLOptions +func (*VpcV1) NewGetSubnetNetworkACLOptions(id string) *GetSubnetNetworkACLOptions { + return &GetSubnetNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSubnetNetworkACLOptions) SetID(id string) *GetSubnetNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetNetworkACLOptions) SetHeaders(param map[string]string) *GetSubnetNetworkACLOptions { + options.Headers = param + return options +} + +// GetSubnetOptions : The GetSubnet options. +type GetSubnetOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetOptions : Instantiate GetSubnetOptions +func (*VpcV1) NewGetSubnetOptions(id string) *GetSubnetOptions { + return &GetSubnetOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSubnetOptions) SetID(id string) *GetSubnetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetOptions) SetHeaders(param map[string]string) *GetSubnetOptions { + options.Headers = param + return options +} + +// GetSubnetPublicGatewayOptions : The GetSubnetPublicGateway options. +type GetSubnetPublicGatewayOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetPublicGatewayOptions : Instantiate GetSubnetPublicGatewayOptions +func (*VpcV1) NewGetSubnetPublicGatewayOptions(id string) *GetSubnetPublicGatewayOptions { + return &GetSubnetPublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSubnetPublicGatewayOptions) SetID(id string) *GetSubnetPublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *GetSubnetPublicGatewayOptions { + options.Headers = param + return options +} + +// GetSubnetReservedIPOptions : The GetSubnetReservedIP options. +type GetSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `json:"subnet_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 +} + +// NewGetSubnetReservedIPOptions : Instantiate GetSubnetReservedIPOptions +func (*VpcV1) NewGetSubnetReservedIPOptions(subnetID string, id string) *GetSubnetReservedIPOptions { + return &GetSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + ID: core.StringPtr(id), + } +} + +// SetSubnetID : Allow user to set SubnetID +func (_options *GetSubnetReservedIPOptions) SetSubnetID(subnetID string) *GetSubnetReservedIPOptions { + _options.SubnetID = core.StringPtr(subnetID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetSubnetReservedIPOptions) SetID(id string) *GetSubnetReservedIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetReservedIPOptions) SetHeaders(param map[string]string) *GetSubnetReservedIPOptions { + options.Headers = param + return options +} + +// GetSubnetRoutingTableOptions : The GetSubnetRoutingTable options. +type GetSubnetRoutingTableOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetRoutingTableOptions : Instantiate GetSubnetRoutingTableOptions +func (*VpcV1) NewGetSubnetRoutingTableOptions(id string) *GetSubnetRoutingTableOptions { + return &GetSubnetRoutingTableOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSubnetRoutingTableOptions) SetID(id string) *GetSubnetRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetRoutingTableOptions) SetHeaders(param map[string]string) *GetSubnetRoutingTableOptions { + options.Headers = param + return options +} + +// GetVirtualNetworkInterfaceIPOptions : The GetVirtualNetworkInterfaceIP options. +type GetVirtualNetworkInterfaceIPOptions 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 +} + +// NewGetVirtualNetworkInterfaceIPOptions : Instantiate GetVirtualNetworkInterfaceIPOptions +func (*VpcV1) NewGetVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *GetVirtualNetworkInterfaceIPOptions { + return &GetVirtualNetworkInterfaceIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *GetVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *GetVirtualNetworkInterfaceIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVirtualNetworkInterfaceIPOptions) SetID(id string) *GetVirtualNetworkInterfaceIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetVirtualNetworkInterfaceIPOptions { + options.Headers = param + return options +} + +// GetVirtualNetworkInterfaceOptions : The GetVirtualNetworkInterface options. +type GetVirtualNetworkInterfaceOptions struct { + // The virtual network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVirtualNetworkInterfaceOptions : Instantiate GetVirtualNetworkInterfaceOptions +func (*VpcV1) NewGetVirtualNetworkInterfaceOptions(id string) *GetVirtualNetworkInterfaceOptions { + return &GetVirtualNetworkInterfaceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVirtualNetworkInterfaceOptions) SetID(id string) *GetVirtualNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetVirtualNetworkInterfaceOptions { + options.Headers = param + return options +} + +// GetVolumeOptions : The GetVolume options. +type GetVolumeOptions struct { + // The volume identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVolumeOptions : Instantiate GetVolumeOptions +func (*VpcV1) NewGetVolumeOptions(id string) *GetVolumeOptions { + return &GetVolumeOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVolumeOptions) SetID(id string) *GetVolumeOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVolumeOptions) SetHeaders(param map[string]string) *GetVolumeOptions { + options.Headers = param + return options +} + +// GetVolumeProfileOptions : The GetVolumeProfile options. +type GetVolumeProfileOptions struct { + // The volume profile name. + Name *string `json:"name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVolumeProfileOptions : Instantiate GetVolumeProfileOptions +func (*VpcV1) NewGetVolumeProfileOptions(name string) *GetVolumeProfileOptions { + return &GetVolumeProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (_options *GetVolumeProfileOptions) SetName(name string) *GetVolumeProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVolumeProfileOptions) SetHeaders(param map[string]string) *GetVolumeProfileOptions { + options.Headers = param + return options +} + +// GetVPCAddressPrefixOptions : The GetVPCAddressPrefix options. +type GetVPCAddressPrefixOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The prefix identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCAddressPrefixOptions : Instantiate GetVPCAddressPrefixOptions +func (*VpcV1) NewGetVPCAddressPrefixOptions(vpcID string, id string) *GetVPCAddressPrefixOptions { + return &GetVPCAddressPrefixOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCAddressPrefixOptions) SetVPCID(vpcID string) *GetVPCAddressPrefixOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCAddressPrefixOptions) SetID(id string) *GetVPCAddressPrefixOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCAddressPrefixOptions) SetHeaders(param map[string]string) *GetVPCAddressPrefixOptions { + options.Headers = param + return options +} + +// GetVPCDefaultNetworkACLOptions : The GetVPCDefaultNetworkACL options. +type GetVPCDefaultNetworkACLOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDefaultNetworkACLOptions : Instantiate GetVPCDefaultNetworkACLOptions +func (*VpcV1) NewGetVPCDefaultNetworkACLOptions(id string) *GetVPCDefaultNetworkACLOptions { + return &GetVPCDefaultNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPCDefaultNetworkACLOptions) SetID(id string) *GetVPCDefaultNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDefaultNetworkACLOptions) SetHeaders(param map[string]string) *GetVPCDefaultNetworkACLOptions { + options.Headers = param + return options +} + +// GetVPCDefaultRoutingTableOptions : The GetVPCDefaultRoutingTable options. +type GetVPCDefaultRoutingTableOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDefaultRoutingTableOptions : Instantiate GetVPCDefaultRoutingTableOptions +func (*VpcV1) NewGetVPCDefaultRoutingTableOptions(id string) *GetVPCDefaultRoutingTableOptions { + return &GetVPCDefaultRoutingTableOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPCDefaultRoutingTableOptions) SetID(id string) *GetVPCDefaultRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDefaultRoutingTableOptions) SetHeaders(param map[string]string) *GetVPCDefaultRoutingTableOptions { + options.Headers = param + return options +} + +// GetVPCDefaultSecurityGroupOptions : The GetVPCDefaultSecurityGroup options. +type GetVPCDefaultSecurityGroupOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDefaultSecurityGroupOptions : Instantiate GetVPCDefaultSecurityGroupOptions +func (*VpcV1) NewGetVPCDefaultSecurityGroupOptions(id string) *GetVPCDefaultSecurityGroupOptions { + return &GetVPCDefaultSecurityGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPCDefaultSecurityGroupOptions) SetID(id string) *GetVPCDefaultSecurityGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDefaultSecurityGroupOptions) SetHeaders(param map[string]string) *GetVPCDefaultSecurityGroupOptions { + options.Headers = param + return options +} + +// GetVPCDnsResolutionBindingOptions : The GetVPCDnsResolutionBinding options. +type GetVPCDnsResolutionBindingOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The DNS resolution binding identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDnsResolutionBindingOptions : Instantiate GetVPCDnsResolutionBindingOptions +func (*VpcV1) NewGetVPCDnsResolutionBindingOptions(vpcID string, id string) *GetVPCDnsResolutionBindingOptions { + return &GetVPCDnsResolutionBindingOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *GetVPCDnsResolutionBindingOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCDnsResolutionBindingOptions) SetID(id string) *GetVPCDnsResolutionBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *GetVPCDnsResolutionBindingOptions { + options.Headers = param + return options +} + +// GetVPCOptions : The GetVPC options. +type GetVPCOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCOptions : Instantiate GetVPCOptions +func (*VpcV1) NewGetVPCOptions(id string) *GetVPCOptions { + return &GetVPCOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPCOptions) SetID(id string) *GetVPCOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCOptions) SetHeaders(param map[string]string) *GetVPCOptions { + options.Headers = param + return options +} + +// GetVPCRouteOptions : The GetVPCRoute options. +type GetVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCRouteOptions : Instantiate GetVPCRouteOptions +func (*VpcV1) NewGetVPCRouteOptions(vpcID string, id string) *GetVPCRouteOptions { + return &GetVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCRouteOptions) SetVPCID(vpcID string) *GetVPCRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCRouteOptions) SetID(id string) *GetVPCRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCRouteOptions) SetHeaders(param map[string]string) *GetVPCRouteOptions { + options.Headers = param + return options +} + +// GetVPCRoutingTableOptions : The GetVPCRoutingTable options. +type GetVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCRoutingTableOptions : Instantiate GetVPCRoutingTableOptions +func (*VpcV1) NewGetVPCRoutingTableOptions(vpcID string, id string) *GetVPCRoutingTableOptions { + return &GetVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCRoutingTableOptions) SetVPCID(vpcID string) *GetVPCRoutingTableOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCRoutingTableOptions) SetID(id string) *GetVPCRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCRoutingTableOptions) SetHeaders(param map[string]string) *GetVPCRoutingTableOptions { + options.Headers = param + return options +} + +// GetVPCRoutingTableRouteOptions : The GetVPCRoutingTableRoute options. +type GetVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` + + // The VPC routing table route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCRoutingTableRouteOptions : Instantiate GetVPCRoutingTableRouteOptions +func (*VpcV1) NewGetVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string) *GetVPCRoutingTableRouteOptions { + return &GetVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *GetVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *GetVPCRoutingTableRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *GetVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *GetVPCRoutingTableRouteOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPCRoutingTableRouteOptions) SetID(id string) *GetVPCRoutingTableRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *GetVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// GetVPNGatewayConnectionOptions : The GetVPNGatewayConnection options. +type GetVPNGatewayConnectionOptions 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="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNGatewayConnectionOptions : Instantiate GetVPNGatewayConnectionOptions +func (*VpcV1) NewGetVPNGatewayConnectionOptions(vpnGatewayID string, id string) *GetVPNGatewayConnectionOptions { + return &GetVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *GetVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *GetVPNGatewayConnectionOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPNGatewayConnectionOptions) SetID(id string) *GetVPNGatewayConnectionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *GetVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// GetVPNGatewayOptions : The GetVPNGateway options. +type GetVPNGatewayOptions struct { + // The VPN gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNGatewayOptions : Instantiate GetVPNGatewayOptions +func (*VpcV1) NewGetVPNGatewayOptions(id string) *GetVPNGatewayOptions { + return &GetVPNGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPNGatewayOptions) SetID(id string) *GetVPNGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNGatewayOptions) SetHeaders(param map[string]string) *GetVPNGatewayOptions { + options.Headers = param + return options +} + +// GetVPNServerClientConfigurationOptions : The GetVPNServerClientConfiguration options. +type GetVPNServerClientConfigurationOptions struct { + // The VPN server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerClientConfigurationOptions : Instantiate GetVPNServerClientConfigurationOptions +func (*VpcV1) NewGetVPNServerClientConfigurationOptions(id string) *GetVPNServerClientConfigurationOptions { + return &GetVPNServerClientConfigurationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerClientConfigurationOptions) SetID(id string) *GetVPNServerClientConfigurationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerClientConfigurationOptions) SetHeaders(param map[string]string) *GetVPNServerClientConfigurationOptions { + options.Headers = param + return options +} + +// GetVPNServerClientOptions : The GetVPNServerClient options. +type GetVPNServerClientOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN client identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerClientOptions : Instantiate GetVPNServerClientOptions +func (*VpcV1) NewGetVPNServerClientOptions(vpnServerID string, id string) *GetVPNServerClientOptions { + return &GetVPNServerClientOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *GetVPNServerClientOptions) SetVPNServerID(vpnServerID string) *GetVPNServerClientOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerClientOptions) SetID(id string) *GetVPNServerClientOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerClientOptions) SetHeaders(param map[string]string) *GetVPNServerClientOptions { + options.Headers = param + return options +} + +// GetVPNServerOptions : The GetVPNServer options. +type GetVPNServerOptions struct { + // The VPN server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerOptions : Instantiate GetVPNServerOptions +func (*VpcV1) NewGetVPNServerOptions(id string) *GetVPNServerOptions { + return &GetVPNServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerOptions) SetID(id string) *GetVPNServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerOptions) SetHeaders(param map[string]string) *GetVPNServerOptions { + options.Headers = param + return options +} + +// GetVPNServerRouteOptions : The GetVPNServerRoute options. +type GetVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerRouteOptions : Instantiate GetVPNServerRouteOptions +func (*VpcV1) NewGetVPNServerRouteOptions(vpnServerID string, id string) *GetVPNServerRouteOptions { + return &GetVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *GetVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *GetVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerRouteOptions) SetID(id string) *GetVPNServerRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerRouteOptions) SetHeaders(param map[string]string) *GetVPNServerRouteOptions { + options.Headers = param + return options +} + +// IkePolicy : IkePolicy struct +type IkePolicy struct { + // The authentication algorithm + // + // The `md5` and `sha1` algorithms have been deprecated. + AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` + + // The VPN gateway connections that use this IKE policy. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this IKE policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The Diffie-Hellman group + // + // Groups `2` and `5` have been deprecated. + DhGroup *int64 `json:"dh_group" validate:"required"` + + // The encryption algorithm + // + // The `triple_des` algorithm has been deprecated. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` + + // The IKE protocol version. + IkeVersion *int64 `json:"ike_version" validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime" validate:"required"` + + // The name for this IKE policy. The name is unique across all IKE policies in the region. + Name *string `json:"name" validate:"required"` + + // The IKE negotiation mode. Only `main` is supported. + NegotiationMode *string `json:"negotiation_mode" validate:"required"` + + // The resource group for this IKE policy. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the IkePolicy.AuthenticationAlgorithm property. +// The authentication algorithm +// +// The `md5` and `sha1` algorithms have been deprecated. +const ( + IkePolicyAuthenticationAlgorithmMd5Const = "md5" + IkePolicyAuthenticationAlgorithmSha1Const = "sha1" + IkePolicyAuthenticationAlgorithmSha256Const = "sha256" + IkePolicyAuthenticationAlgorithmSha384Const = "sha384" + IkePolicyAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IkePolicy.EncryptionAlgorithm property. +// The encryption algorithm +// +// The `triple_des` algorithm has been deprecated. +const ( + IkePolicyEncryptionAlgorithmAes128Const = "aes128" + IkePolicyEncryptionAlgorithmAes192Const = "aes192" + IkePolicyEncryptionAlgorithmAes256Const = "aes256" + IkePolicyEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// Constants associated with the IkePolicy.NegotiationMode property. +// The IKE negotiation mode. Only `main` is supported. +const ( + IkePolicyNegotiationModeMainConst = "main" +) + +// Constants associated with the IkePolicy.ResourceType property. +// The resource type. +const ( + IkePolicyResourceTypeIkePolicyConst = "ike_policy" +) + +// UnmarshalIkePolicy unmarshals an instance of IkePolicy from the specified map of raw messages. +func UnmarshalIkePolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicy) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "negotiation_mode", &obj.NegotiationMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyCollection : IkePolicyCollection struct +type IkePolicyCollection struct { + // A link to the first page of resources. + First *IkePolicyCollectionFirst `json:"first" validate:"required"` + + // Collection of IKE policies. + IkePolicies []IkePolicy `json:"ike_policies" 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 *IkePolicyCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policies", &obj.IkePolicies, UnmarshalIkePolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIkePolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *IkePolicyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// IkePolicyPatch : IkePolicyPatch struct +type IkePolicyPatch struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` + + // The Diffie-Hellman group. + DhGroup *int64 `json:"dh_group,omitempty"` + + // The encryption algorithm. + EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` + + // The IKE protocol version. + IkeVersion *int64 `json:"ike_version,omitempty"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime,omitempty"` + + // The name for this IKE policy. The name must not be used by another IKE policy in the region. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the IkePolicyPatch.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + IkePolicyPatchAuthenticationAlgorithmSha256Const = "sha256" + IkePolicyPatchAuthenticationAlgorithmSha384Const = "sha384" + IkePolicyPatchAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IkePolicyPatch.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + IkePolicyPatchEncryptionAlgorithmAes128Const = "aes128" + IkePolicyPatchEncryptionAlgorithmAes192Const = "aes192" + IkePolicyPatchEncryptionAlgorithmAes256Const = "aes256" +) + +// UnmarshalIkePolicyPatch unmarshals an instance of IkePolicyPatch from the specified map of raw messages. +func UnmarshalIkePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyPatch) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// IkePolicyReference : IkePolicyReference struct +type IkePolicyReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *IkePolicyReferenceDeleted `json:"deleted,omitempty"` + + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` + + // The name for this IKE policy. The name is unique across all IKE policies in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the IkePolicyReference.ResourceType property. +// The resource type. +const ( + IkePolicyReferenceResourceTypeIkePolicyConst = "ike_policy" +) + +// UnmarshalIkePolicyReference unmarshals an instance of IkePolicyReference from the specified map of raw messages. +func UnmarshalIkePolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIkePolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IP : IP struct +type IP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewIP : Instantiate IP (Generic Model Constructor) +func (*VpcV1) NewIP(address string) (_model *IP, err error) { + _model = &IP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalIP unmarshals an instance of IP from the specified map of raw messages. +func UnmarshalIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicy : IPsecPolicy struct +type IPsecPolicy struct { + // The authentication algorithm + // + // The `md5` and `sha1` algorithms have been deprecated + // + // Must be `disabled` if and only if the `encryption_algorithm` is + // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. + AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` + + // The VPN gateway connections that use this IPsec policy. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this IPsec policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The encapsulation mode used. Only `tunnel` is supported. + EncapsulationMode *string `json:"encapsulation_mode" validate:"required"` + + // The encryption algorithm + // + // The `triple_des` algorithm has been deprecated + // + // The `authentication_algorithm` must be `disabled` if and only if + // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or + // `aes256gcm16`. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime" validate:"required"` + + // The name for this IPsec policy. The name is unique across all IPsec policies in the region. + Name *string `json:"name" validate:"required"` + + // Perfect Forward Secrecy + // + // Groups `group_2` and `group_5` have been deprecated. + Pfs *string `json:"pfs" validate:"required"` + + // The resource group for this IPsec policy. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The transform protocol used. Only `esp` is supported. + TransformProtocol *string `json:"transform_protocol" validate:"required"` +} + +// Constants associated with the IPsecPolicy.AuthenticationAlgorithm property. +// The authentication algorithm +// +// # The `md5` and `sha1` algorithms have been deprecated +// +// Must be `disabled` if and only if the `encryption_algorithm` is +// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. +const ( + IPsecPolicyAuthenticationAlgorithmDisabledConst = "disabled" + IPsecPolicyAuthenticationAlgorithmMd5Const = "md5" + IPsecPolicyAuthenticationAlgorithmSha1Const = "sha1" + IPsecPolicyAuthenticationAlgorithmSha256Const = "sha256" + IPsecPolicyAuthenticationAlgorithmSha384Const = "sha384" + IPsecPolicyAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IPsecPolicy.EncapsulationMode property. +// The encapsulation mode used. Only `tunnel` is supported. +const ( + IPsecPolicyEncapsulationModeTunnelConst = "tunnel" +) + +// Constants associated with the IPsecPolicy.EncryptionAlgorithm property. +// The encryption algorithm +// +// The `triple_des` algorithm has been deprecated +// +// The `authentication_algorithm` must be `disabled` if and only if +// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or +// `aes256gcm16`. +const ( + IPsecPolicyEncryptionAlgorithmAes128Const = "aes128" + IPsecPolicyEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" + IPsecPolicyEncryptionAlgorithmAes192Const = "aes192" + IPsecPolicyEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" + IPsecPolicyEncryptionAlgorithmAes256Const = "aes256" + IPsecPolicyEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" + IPsecPolicyEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// Constants associated with the IPsecPolicy.Pfs property. +// Perfect Forward Secrecy +// +// Groups `group_2` and `group_5` have been deprecated. +const ( + IPsecPolicyPfsDisabledConst = "disabled" + IPsecPolicyPfsGroup14Const = "group_14" + IPsecPolicyPfsGroup15Const = "group_15" + IPsecPolicyPfsGroup16Const = "group_16" + IPsecPolicyPfsGroup17Const = "group_17" + IPsecPolicyPfsGroup18Const = "group_18" + IPsecPolicyPfsGroup19Const = "group_19" + IPsecPolicyPfsGroup2Const = "group_2" + IPsecPolicyPfsGroup20Const = "group_20" + IPsecPolicyPfsGroup21Const = "group_21" + IPsecPolicyPfsGroup22Const = "group_22" + IPsecPolicyPfsGroup23Const = "group_23" + IPsecPolicyPfsGroup24Const = "group_24" + IPsecPolicyPfsGroup31Const = "group_31" + IPsecPolicyPfsGroup5Const = "group_5" +) + +// Constants associated with the IPsecPolicy.ResourceType property. +// The resource type. +const ( + IPsecPolicyResourceTypeIpsecPolicyConst = "ipsec_policy" +) + +// Constants associated with the IPsecPolicy.TransformProtocol property. +// The transform protocol used. Only `esp` is supported. +const ( + IPsecPolicyTransformProtocolEspConst = "esp" +) + +// UnmarshalIPsecPolicy unmarshals an instance of IPsecPolicy from the specified map of raw messages. +func UnmarshalIPsecPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicy) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encapsulation_mode", &obj.EncapsulationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pfs", &obj.Pfs) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "transform_protocol", &obj.TransformProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyCollection : IPsecPolicyCollection struct +type IPsecPolicyCollection struct { + // A link to the first page of resources. + First *IPsecPolicyCollectionFirst `json:"first" validate:"required"` + + // Collection of IPsec policies. + IpsecPolicies []IPsecPolicy `json:"ipsec_policies" 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 *IPsecPolicyCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policies", &obj.IpsecPolicies, UnmarshalIPsecPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIPsecPolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *IPsecPolicyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyPatch : IPsecPolicyPatch struct +type IPsecPolicyPatch struct { + // The authentication algorithm + // + // Must be `disabled` if and only if the `encryption_algorithm` is + // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. + AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` + + // The encryption algorithm + // + // The `authentication_algorithm` must be `disabled` if and only if + // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or + // `aes256gcm16`. + EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime,omitempty"` + + // The name for this IPsec policy. The name must not be used by another IPsec policy in the region. + Name *string `json:"name,omitempty"` + + // Perfect Forward Secrecy. + Pfs *string `json:"pfs,omitempty"` +} + +// Constants associated with the IPsecPolicyPatch.AuthenticationAlgorithm property. +// The authentication algorithm +// +// Must be `disabled` if and only if the `encryption_algorithm` is +// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. +const ( + IPsecPolicyPatchAuthenticationAlgorithmDisabledConst = "disabled" + IPsecPolicyPatchAuthenticationAlgorithmSha256Const = "sha256" + IPsecPolicyPatchAuthenticationAlgorithmSha384Const = "sha384" + IPsecPolicyPatchAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IPsecPolicyPatch.EncryptionAlgorithm property. +// The encryption algorithm +// +// The `authentication_algorithm` must be `disabled` if and only if +// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or +// `aes256gcm16`. +const ( + IPsecPolicyPatchEncryptionAlgorithmAes128Const = "aes128" + IPsecPolicyPatchEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" + IPsecPolicyPatchEncryptionAlgorithmAes192Const = "aes192" + IPsecPolicyPatchEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" + IPsecPolicyPatchEncryptionAlgorithmAes256Const = "aes256" + IPsecPolicyPatchEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" +) + +// Constants associated with the IPsecPolicyPatch.Pfs property. +// Perfect Forward Secrecy. +const ( + IPsecPolicyPatchPfsDisabledConst = "disabled" + IPsecPolicyPatchPfsGroup14Const = "group_14" + IPsecPolicyPatchPfsGroup15Const = "group_15" + IPsecPolicyPatchPfsGroup16Const = "group_16" + IPsecPolicyPatchPfsGroup17Const = "group_17" + IPsecPolicyPatchPfsGroup18Const = "group_18" + IPsecPolicyPatchPfsGroup19Const = "group_19" + IPsecPolicyPatchPfsGroup20Const = "group_20" + IPsecPolicyPatchPfsGroup21Const = "group_21" + IPsecPolicyPatchPfsGroup22Const = "group_22" + IPsecPolicyPatchPfsGroup23Const = "group_23" + IPsecPolicyPatchPfsGroup24Const = "group_24" + IPsecPolicyPatchPfsGroup31Const = "group_31" +) + +// UnmarshalIPsecPolicyPatch unmarshals an instance of IPsecPolicyPatch from the specified map of raw messages. +func UnmarshalIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyPatch) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pfs", &obj.Pfs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// IPsecPolicyReference : IPsecPolicyReference struct +type IPsecPolicyReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *IPsecPolicyReferenceDeleted `json:"deleted,omitempty"` + + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` + + // The name for this IPsec policy. The name is unique across all IPsec policies in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the IPsecPolicyReference.ResourceType property. +// The resource type. +const ( + IPsecPolicyReferenceResourceTypeIpsecPolicyConst = "ipsec_policy" +) + +// UnmarshalIPsecPolicyReference unmarshals an instance of IPsecPolicyReference from the specified map of raw messages. +func UnmarshalIPsecPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIPsecPolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type IPsecPolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalIPsecPolicyReferenceDeleted unmarshals an instance of IPsecPolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalIPsecPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type IkePolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalIkePolicyReferenceDeleted unmarshals an instance of IkePolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalIkePolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Image : Image struct +type Image struct { + CatalogOffering *ImageCatalogOffering `json:"catalog_offering" validate:"required"` + + // The date and time that the image was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this image. + CRN *string `json:"crn" validate:"required"` + + // The deprecation date and time (UTC) for this image. + // + // If absent, no deprecation date and time has been set. + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + + // The type of encryption used on the image. + Encryption *string `json:"encryption" validate:"required"` + + // The key that will be used to encrypt volumes created from this image (unless an + // alternate `encryption_key` is specified at volume creation). + // + // This property will be present for images with an `encryption` type of `user_managed`. + EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` + + // Details for the stored image file. + File *ImageFile `json:"file" validate:"required"` + + // The URL for this image. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this image. + ID *string `json:"id" validate:"required"` + + // The minimum size (in gigabytes) of a volume onto which this image may be provisioned. + // + // This property may be absent if the image has a `status` of `pending` or `failed`. + MinimumProvisionedSize *int64 `json:"minimum_provisioned_size,omitempty"` + + // The name for this image. The name is unique across all images in the region. + Name *string `json:"name" validate:"required"` + + // The obsolescence date and time (UTC) for this image. + // + // If absent, no obsolescence date and time has been set. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` + + // The operating system included in this image. + OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` + + // The resource group for this image. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The volume used to create this image (this may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + // If absent, this image was not created from a volume. + SourceVolume *VolumeReference `json:"source_volume,omitempty"` + + // The status of this image + // - available: image can be used (provisionable) + // - deleting: image is being deleted, and can no longer be used to provision new + // resources + // - deprecated: image is administratively slated to become `obsolete` + // - failed: image is corrupt or did not pass validation + // - obsolete: image administratively set to not be used for new resources + // - pending: image is being imported and is not yet `available` + // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any): + // - `encrypted_data_key_invalid`: image cannot be decrypted with the specified + // `encryption_key` + // - `encryption_key_deleted`: image unusable because its `encryption_key` was deleted + // - `encryption_key_disabled`: image unusable until its `encryption_key` is re-enabled + // - `image_data_corrupted`: image data is corrupt, or is not in the specified format + // - `image_provisioned_size_unsupported`: image requires a boot volume size greater + // than the maximum supported value + // - `image_request_in_progress`: image operation is in progress (such as an import from + // Cloud Object Storage) + // - `image_request_queued`: image request has been accepted but the requested + // operation has not started + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []ImageStatusReason `json:"status_reasons" validate:"required"` + + // The visibility of this image. + // - `private`: Visible only to this account + // - `public`: Visible to all accounts. + Visibility *string `json:"visibility" validate:"required"` +} + +// Constants associated with the Image.Encryption property. +// The type of encryption used on the image. +const ( + ImageEncryptionNoneConst = "none" + ImageEncryptionUserManagedConst = "user_managed" +) + +// Constants associated with the Image.ResourceType property. +// The resource type. +const ( + ImageResourceTypeImageConst = "image" +) + +// Constants associated with the Image.Status property. +// The status of this image +// - available: image can be used (provisionable) +// - deleting: image is being deleted, and can no longer be used to provision new +// resources +// - deprecated: image is administratively slated to become `obsolete` +// - failed: image is corrupt or did not pass validation +// - obsolete: image administratively set to not be used for new resources +// - pending: image is being imported and is not yet `available` +// - unusable: image cannot be used (see `status_reasons[]` for possible remediation) +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the +// unexpected property value was encountered. +const ( + ImageStatusAvailableConst = "available" + ImageStatusDeletingConst = "deleting" + ImageStatusDeprecatedConst = "deprecated" + ImageStatusFailedConst = "failed" + ImageStatusObsoleteConst = "obsolete" + ImageStatusPendingConst = "pending" + ImageStatusUnusableConst = "unusable" +) + +// Constants associated with the Image.Visibility property. +// The visibility of this image. +// - `private`: Visible only to this account +// - `public`: Visible to all accounts. +const ( + ImageVisibilityPrivateConst = "private" + ImageVisibilityPublicConst = "public" +) + +// UnmarshalImage unmarshals an instance of Image from the specified map of raw messages. +func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Image) + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalImageCatalogOffering) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "minimum_provisioned_size", &obj.MinimumProvisionedSize) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalImageStatusReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "visibility", &obj.Visibility) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageCatalogOffering : ImageCatalogOffering struct +type ImageCatalogOffering struct { + // Indicates whether this image is managed as part of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. If an image is managed, + // accounts in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise) with access to that catalog can + // specify the image's catalog offering version CRN to provision virtual server instances using the image. + Managed *bool `json:"managed" validate:"required"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering version associated with this image. + // + // If absent, this image is not associated with a cloud catalog offering. + Version *CatalogOfferingVersionReference `json:"version,omitempty"` +} + +// UnmarshalImageCatalogOffering unmarshals an instance of ImageCatalogOffering from the specified map of raw messages. +func UnmarshalImageCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageCatalogOffering) + err = core.UnmarshalPrimitive(m, "managed", &obj.Managed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageCollection : ImageCollection struct +type ImageCollection struct { + // A link to the first page of resources. + First *ImageCollectionFirst `json:"first" validate:"required"` + + // Collection of images. + Images []Image `json:"images" 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 *ImageCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "images", &obj.Images, UnmarshalImage) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalImageCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ImageCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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. + // + // If absent, the export job has not yet completed. + CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` + + // The date and time that the image export job was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // A base64-encoded, encrypted representation of the key that was used to encrypt the data for the exported image. This + // key can be unwrapped with the image's `encryption_key` root key using either Key Protect or Hyper Protect Crypto + // Services. + // + // If absent, the export job is for an unencrypted image. + EncryptedDataKey *[]byte `json:"encrypted_data_key,omitempty"` + + // The format of the exported image. + Format *string `json:"format" validate:"required"` + + // The URL for this image export job. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this image export job. + ID *string `json:"id" validate:"required"` + + // The name for this image export job. The name must not be used by another export job for the image. Changing the name + // will not affect the exported image name, + // `storage_object.name`, or `storage_href` values. + Name *string `json:"name" validate:"required"` + + // The type of resource referenced. + ResourceType *string `json:"resource_type" validate:"required"` + + // The date and time that the image export job started running. + // + // If absent, the export job has not yet started. + StartedAt *strfmt.DateTime `json:"started_at,omitempty"` + + // The status of this image export job: + // - `deleting`: Export job is being deleted + // - `failed`: Export job could not be completed successfully + // - `queued`: Export job is queued + // - `running`: Export job is in progress + // - `succeeded`: Export job was completed successfully + // + // The exported image object is automatically deleted for `failed` jobs. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []ImageExportJobStatusReason `json:"status_reasons" validate:"required"` + + // The Cloud Object Storage bucket of the exported image object. + StorageBucket *CloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` + + // The Cloud Object Storage location of the exported image object. The object at this location will not exist until the + // job completes successfully. The exported image object is not managed by the IBM VPC service, and may be removed or + // replaced with a different object by any user or service with IAM authorization to the storage bucket. + StorageHref *string `json:"storage_href" validate:"required"` + + // The Cloud Object Storage object for the exported image. This object will not exist until + // the job completes successfully. The exported image object is not managed by the IBM VPC + // service, and may be removed or replaced with a different object by any user or service + // with IAM authorization to the storage bucket. + StorageObject *CloudObjectStorageObjectReference `json:"storage_object" validate:"required"` +} + +// Constants associated with the ImageExportJob.Format property. +// The format of the exported image. +const ( + ImageExportJobFormatQcow2Const = "qcow2" + ImageExportJobFormatVhdConst = "vhd" +) + +// Constants associated with the ImageExportJob.ResourceType property. +// The type of resource referenced. +const ( + ImageExportJobResourceTypeImageExportJobConst = "image_export_job" +) + +// Constants associated with the ImageExportJob.Status property. +// The status of this image export job: +// - `deleting`: Export job is being deleted +// - `failed`: Export job could not be completed successfully +// - `queued`: Export job is queued +// - `running`: Export job is in progress +// - `succeeded`: Export job was completed successfully +// +// The exported image object is automatically deleted for `failed` jobs. +const ( + ImageExportJobStatusDeletingConst = "deleting" + ImageExportJobStatusFailedConst = "failed" + ImageExportJobStatusQueuedConst = "queued" + ImageExportJobStatusRunningConst = "running" + ImageExportJobStatusSucceededConst = "succeeded" +) + +// UnmarshalImageExportJob unmarshals an instance of ImageExportJob from the specified map of raw messages. +func UnmarshalImageExportJob(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageExportJob) + err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "format", &obj.Format) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalImageExportJobStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalCloudObjectStorageBucketReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "storage_href", &obj.StorageHref) + if err != nil { + return + } + err = core.UnmarshalModel(m, "storage_object", &obj.StorageObject, UnmarshalCloudObjectStorageObjectReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageExportJobPatch : ImageExportJobPatch struct +type ImageExportJobPatch struct { + // The name for this image export job. The name must not be used by another export job for the image. Changing the name + // will not affect the exported image name, + // `storage_object.name`, or `storage_href` values. + Name *string `json:"name,omitempty"` +} + +// UnmarshalImageExportJobPatch unmarshals an instance of ImageExportJobPatch from the specified map of raw messages. +func UnmarshalImageExportJobPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageExportJobPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// ImageExportJobStatusReason : ImageExportJobStatusReason struct +type ImageExportJobStatusReason struct { + // A snake case string succinctly identifying the status reason. + 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 ImageExportJobStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + ImageExportJobStatusReasonCodeCannotAccessStorageBucketConst = "cannot_access_storage_bucket" + ImageExportJobStatusReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalImageExportJobStatusReason unmarshals an instance of ImageExportJobStatusReason from the specified map of raw messages. +func UnmarshalImageExportJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageExportJobStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageExportJobUnpaginatedCollection : ImageExportJobUnpaginatedCollection struct +type ImageExportJobUnpaginatedCollection struct { + // Collection of image export jobs. + ExportJobs []ImageExportJob `json:"export_jobs" validate:"required"` +} + +// UnmarshalImageExportJobUnpaginatedCollection unmarshals an instance of ImageExportJobUnpaginatedCollection from the specified map of raw messages. +func UnmarshalImageExportJobUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageExportJobUnpaginatedCollection) + err = core.UnmarshalModel(m, "export_jobs", &obj.ExportJobs, UnmarshalImageExportJob) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageFile : ImageFile struct +type ImageFile struct { + // Checksums for this image file. + // + // This property may be absent if the associated image has a `status` of `pending` or + // `failed`. + Checksums *ImageFileChecksums `json:"checksums,omitempty"` + + // The size of the stored image file rounded up to the next gigabyte. + // + // This property may be absent if the associated image has a `status` of `pending` or + // `failed`. + Size *int64 `json:"size,omitempty"` +} + +// UnmarshalImageFile unmarshals an instance of ImageFile from the specified map of raw messages. +func UnmarshalImageFile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageFile) + err = core.UnmarshalModel(m, "checksums", &obj.Checksums, UnmarshalImageFileChecksums) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageFileChecksums : ImageFileChecksums struct +type ImageFileChecksums struct { + // The SHA256 fingerprint of the image file. + Sha256 *string `json:"sha256,omitempty"` +} + +// UnmarshalImageFileChecksums unmarshals an instance of ImageFileChecksums from the specified map of raw messages. +func UnmarshalImageFileChecksums(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageFileChecksums) + err = core.UnmarshalPrimitive(m, "sha256", &obj.Sha256) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageFilePrototype : ImageFilePrototype struct +type ImageFilePrototype struct { + // The Cloud Object Storage location of the image file. + // + // The image file format is specified by the file's extension, which must be either + // `qcow2` or `vhd`. + Href *string `json:"href" validate:"required"` +} + +// NewImageFilePrototype : Instantiate ImageFilePrototype (Generic Model Constructor) +func (*VpcV1) NewImageFilePrototype(href string) (_model *ImageFilePrototype, err error) { + _model = &ImageFilePrototype{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalImageFilePrototype unmarshals an instance of ImageFilePrototype from the specified map of raw messages. +func UnmarshalImageFilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageFilePrototype) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentity : Identifies an image by a unique property. +// Models which "extend" this model: +// - ImageIdentityByID +// - ImageIdentityByCRN +// - ImageIdentityByHref +type ImageIdentity struct { + // The unique identifier for this image. + ID *string `json:"id,omitempty"` + + // The CRN for this image. + CRN *string `json:"crn,omitempty"` + + // The URL for this image. + Href *string `json:"href,omitempty"` +} + +func (*ImageIdentity) isaImageIdentity() bool { + return true +} + +type ImageIdentityIntf interface { + isaImageIdentity() bool +} + +// UnmarshalImageIdentity unmarshals an instance of ImageIdentity from the specified map of raw messages. +func UnmarshalImageIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImagePatch : ImagePatch struct +type ImagePatch struct { + // The deprecation date and time to set for this image. + // + // This cannot be set if the image has a `status` of `failed` or `deleting`, or if + // `catalog_offering.managed` is `true`. + // + // The date and time must not be in the past, and must be earlier than `obsolescence_at` + // (if `obsolescence_at` is set). Additionally, if the image status is currently + // `deprecated`, the value cannot be changed (but may be removed). + // + // Specify `null` to remove an existing deprecation date and time. If the image status is currently `deprecated`, it + // will become `available`. + // + // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will + // transition to `deprecated` upon its successful creation (or + // `obsolete` if the obsolescence date and time was also reached). + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are + // reserved for system-provided images, and are not allowed. + Name *string `json:"name,omitempty"` + + // The obsolescence date and time to set for this image. + // + // This cannot be set if the image has a `status` of `failed` or `deleting`, or if + // `catalog_offering.managed` is `true`. + // + // The date and time must not be in the past, and must be later than `deprecation_at` (if + // `deprecation_at` is set). Additionally, if the image status is currently `obsolete`, the value cannot be changed + // (but may be removed). + // + // Specify `null` to remove an existing obsolescence date and time. If the image status is currently `obsolete`, it + // will become `deprecated` if `deprecation_at` is in the past. Otherwise, it will become `available`. + // + // If the obsolescence date and time is reached while the image has a status of `pending`, the image's status will + // transition to `obsolete` upon its successful creation. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` +} + +// UnmarshalImagePatch unmarshals an instance of ImagePatch from the specified map of raw messages. +func UnmarshalImagePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePatch) + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// ImagePrototype : ImagePrototype struct +// Models which "extend" this model: +// - ImagePrototypeImageByFile +// - ImagePrototypeImageBySourceVolume +type ImagePrototype struct { + // The deprecation date and time to set for this image. + // + // The date and time must not be in the past, and must be earlier than `obsolescence_at` + // (if `obsolescence_at` is set). + // + // If unspecified, no deprecation date and time will be set. + // + // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will + // transition to `deprecated` upon its successful creation (or + // `obsolete` if the obsolescence date and time was also reached). + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are + // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The obsolescence date and time to set for this image. + // + // The date and time must not be in the past, and must be later than `deprecation_at` (if + // `deprecation_at` is set). + // + // If unspecified, no obsolescence date and time will be set. + // + // If the obsolescence date and time is reached while the image has a status of + // `pending`, the image's status will transition to `obsolete` upon its successful creation. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,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"` + + // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. + // + // That representation is created by wrapping the key's value with the `encryption_key` root key (which must also be + // specified), using either [Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the + // [Hyper Protect Crypto Services](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). + // + // If unspecified, the imported image is treated as unencrypted. + EncryptedDataKey *string `json:"encrypted_data_key,omitempty"` + + // The root key that was used to wrap the data key (which is ultimately represented as + // `encrypted_data_key`). Additionally, the root key will be used to encrypt volumes + // created from this image (unless an alternate `encryption_key` is specified at volume + // creation). + // + // If unspecified, the imported image is treated as unencrypted. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The file from which to create the image. + File *ImageFilePrototype `json:"file,omitempty"` + + // The [supported operating + // system](https://cloud.ibm.com/apidocs/vpc#list-operating-systems) included in this + // image. + OperatingSystem OperatingSystemIdentityIntf `json:"operating_system,omitempty"` + + // The volume from which to create the image. The specified volume must: + // - Have an `operating_system`, which will be used to populate this image's + // operating system information. + // - Not be `active` or `busy`. + // + // During image creation, the specified volume may briefly become `busy`. + SourceVolume VolumeIdentityIntf `json:"source_volume,omitempty"` +} + +func (*ImagePrototype) isaImagePrototype() bool { + return true +} + +type ImagePrototypeIntf interface { + isaImagePrototype() bool +} + +// UnmarshalImagePrototype unmarshals an instance of ImagePrototype from the specified map of raw messages. +func UnmarshalImagePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePrototype) + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageReference : ImageReference struct +type ImageReference struct { + // The CRN for this image. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ImageReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this image. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this image. + ID *string `json:"id" validate:"required"` + + // The name for this image. The name is unique across all images in the region. + 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 *ImageRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ImageReference.ResourceType property. +// The resource type. +const ( + ImageReferenceResourceTypeImageConst = "image" +) + +// UnmarshalImageReference unmarshals an instance of ImageReference from the specified map of raw messages. +func UnmarshalImageReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalImageReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalImageRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type ImageReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalImageReferenceDeleted unmarshals an instance of ImageReferenceDeleted from the specified map of raw messages. +func UnmarshalImageReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type ImageRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // account, and identifies the owning account. + Account *AccountReference `json:"account,omitempty"` + + // If present, this property indicates that the referenced resource is remote to this + // region, and identifies the native region. + Region *RegionReference `json:"region,omitempty"` +} + +// UnmarshalImageRemote unmarshals an instance of ImageRemote from the specified map of raw messages. +func UnmarshalImageRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageRemote) + err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageStatusReason : ImageStatusReason struct +type ImageStatusReason struct { + // A snake case string succinctly identifying the status reason. + 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 ImageStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + ImageStatusReasonCodeEncryptedDataKeyInvalidConst = "encrypted_data_key_invalid" + ImageStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" + ImageStatusReasonCodeEncryptionKeyDisabledConst = "encryption_key_disabled" + ImageStatusReasonCodeImageDataCorruptedConst = "image_data_corrupted" + ImageStatusReasonCodeImageProvisionedSizeUnsupportedConst = "image_provisioned_size_unsupported" + ImageStatusReasonCodeImageRequestInProgressConst = "image_request_in_progress" + ImageStatusReasonCodeImageRequestQueuedConst = "image_request_queued" +) + +// UnmarshalImageStatusReason unmarshals an instance of ImageStatusReason from the specified map of raw messages. +func UnmarshalImageStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Instance : Instance struct +type Instance struct { + // The availability policy for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicy `json:"availability_policy" validate:"required"` + + // The total bandwidth (in megabits per second) shared across the instance network attachments or instance network + // interfaces and storage volumes of the virtual server instance. + Bandwidth *int64 `json:"bandwidth" validate:"required"` + + // Boot volume attachment. + BootVolumeAttachment *VolumeAttachmentReferenceInstanceContext `json:"boot_volume_attachment" validate:"required"` + + // If present, this virtual server instance was provisioned from a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user). + CatalogOffering *InstanceCatalogOffering `json:"catalog_offering,omitempty"` + + // The date and time that the virtual server instance was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, the dedicated host this virtual server instance has been placed on. + DedicatedHost *DedicatedHostReference `json:"dedicated_host,omitempty"` + + // The instance disks for this virtual server instance. + Disks []InstanceDisk `json:"disks" validate:"required"` + + // The virtual server instance GPU configuration. + Gpu *InstanceGpu `json:"gpu,omitempty"` + + // The reasons for the current instance `health_state` (if any): + // - `reservation_capacity_unavailable`: The reservation affinity pool has no + // available capacity. + // - `reservation_deleted`: The reservation affinity pool has a deleted reservation. + // - `reservation_expired`: The reservation affinity pool has an expired reservation. + // - `reservation_failed`: The reservation affinity pool has a failed reservation. + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []InstanceHealthReason `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 virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The image the virtual server instance was provisioned from. + Image *ImageReference `json:"image,omitempty"` + + // The reasons for the current `lifecycle_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []InstanceLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the virtual server instance. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The amount of memory, truncated to whole gibibytes. + Memory *int64 `json:"memory" validate:"required"` + + // The metadata service configuration. + MetadataService *InstanceMetadataService `json:"metadata_service" validate:"required"` + + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. + Name *string `json:"name" validate:"required"` + + // The network attachments for this virtual server instance, including the primary network attachment. + NetworkAttachments []InstanceNetworkAttachmentReference `json:"network_attachments" validate:"required"` + + // The network interfaces for this instance, including the primary network interface. + // + // If this instance 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 []NetworkInterfaceInstanceContextReference `json:"network_interfaces" validate:"required"` + + // The number of NUMA nodes this virtual server instance is provisioned on. + // + // This property will be absent if the instance's `status` is not `running`. + NumaCount *int64 `json:"numa_count,omitempty"` + + // The placement restrictions for the virtual server instance. + PlacementTarget InstancePlacementTargetIntf `json:"placement_target,omitempty"` + + // The primary network attachment for this virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` + + // The primary network interface for this virtual server instance. + // + // If this instance 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 *NetworkInterfaceInstanceContextReference `json:"primary_network_interface" validate:"required"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this virtual + // server instance. + Profile *InstanceProfileReference `json:"profile" validate:"required"` + + // The reservation used by this virtual server instance. + // + // If absent, no reservation is in use. + Reservation *ReservationReference `json:"reservation,omitempty"` + + ReservationAffinity *InstanceReservationAffinity `json:"reservation_affinity" validate:"required"` + + // The resource group for this instance. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether the state of the virtual server instance permits a start request. + Startable *bool `json:"startable" validate:"required"` + + // The status of the virtual server instance. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the instance on which the unexpected + // property value was encountered. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []InstanceStatusReason `json:"status_reasons" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance network attachments or instance + // network interfaces. + TotalNetworkBandwidth *int64 `json:"total_network_bandwidth" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth" validate:"required"` + + // The virtual server instance VCPU configuration. + Vcpu *InstanceVcpu `json:"vcpu" validate:"required"` + + // The volume attachments for this virtual server instance, including the boot volume attachment. + VolumeAttachments []VolumeAttachmentReferenceInstanceContext `json:"volume_attachments" validate:"required"` + + // The VPC this virtual server instance resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this virtual server instance resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Instance.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 ( + InstanceHealthStateDegradedConst = "degraded" + InstanceHealthStateFaultedConst = "faulted" + InstanceHealthStateInapplicableConst = "inapplicable" + InstanceHealthStateOkConst = "ok" +) + +// Constants associated with the Instance.LifecycleState property. +// The lifecycle state of the virtual server instance. +const ( + InstanceLifecycleStateDeletingConst = "deleting" + InstanceLifecycleStateFailedConst = "failed" + InstanceLifecycleStatePendingConst = "pending" + InstanceLifecycleStateStableConst = "stable" + InstanceLifecycleStateSuspendedConst = "suspended" + InstanceLifecycleStateUpdatingConst = "updating" + InstanceLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Instance.ResourceType property. +// The resource type. +const ( + InstanceResourceTypeInstanceConst = "instance" +) + +// Constants associated with the Instance.Status property. +// The status of the virtual server instance. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the instance on which the unexpected +// property value was encountered. +const ( + InstanceStatusDeletingConst = "deleting" + InstanceStatusFailedConst = "failed" + InstanceStatusPendingConst = "pending" + InstanceStatusRestartingConst = "restarting" + InstanceStatusRunningConst = "running" + InstanceStatusStartingConst = "starting" + InstanceStatusStoppedConst = "stopped" + InstanceStatusStoppingConst = "stopping" +) + +// UnmarshalInstance unmarshals an instance of Instance from the specified map of raw messages. +func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Instance) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentReferenceInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOffering) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dedicated_host", &obj.DedicatedHost, UnmarshalDedicatedHostReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu", &obj.Gpu, UnmarshalInstanceGpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalInstanceHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataService) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceInstanceContextReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "numa_count", &obj.NumaCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceInstanceContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation", &obj.Reservation, UnmarshalReservationReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "startable", &obj.Startable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalInstanceStatusReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_network_bandwidth", &obj.TotalNetworkBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalInstanceVcpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceAction : InstanceAction struct +type InstanceAction struct { + // The date and time that the action was completed. + // Deprecated: this field is deprecated and may be removed in a future release. + CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` + + // The date and time that the action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // 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"` + + // The URL for this instance action. + // Deprecated: this field is deprecated and may be removed in a future release. + Href *string `json:"href" validate:"required"` + + // The identifier for this instance action. + // Deprecated: this field is deprecated and may be removed in a future release. + ID *string `json:"id" validate:"required"` + + // The date and time that the action was started. + // Deprecated: this field is deprecated and may be removed in a future release. + StartedAt *strfmt.DateTime `json:"started_at,omitempty"` + + // The current status of this action. + // Deprecated: this field is deprecated and may be removed in a future release. + Status *string `json:"status" validate:"required"` + + // The type of action. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceAction.Status property. +// The current status of this action. +const ( + InstanceActionStatusCompletedConst = "completed" + InstanceActionStatusFailedConst = "failed" + InstanceActionStatusPendingConst = "pending" + InstanceActionStatusRunningConst = "running" +) + +// Constants associated with the InstanceAction.Type property. +// The type of action. +const ( + InstanceActionTypeRebootConst = "reboot" + InstanceActionTypeStartConst = "start" + InstanceActionTypeStopConst = "stop" +) + +// UnmarshalInstanceAction unmarshals an instance of InstanceAction from the specified map of raw messages. +func UnmarshalInstanceAction(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceAction) + err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "force", &obj.Force) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceAvailabilityPolicy : InstanceAvailabilityPolicy struct +type InstanceAvailabilityPolicy struct { + // The action to perform if the compute host experiences a failure. + // - `restart`: Automatically restart the virtual server instance after host failure + // - `stop`: Leave the virtual server instance stopped after host failure + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the + // unexpected property value was encountered. + HostFailure *string `json:"host_failure" validate:"required"` +} + +// Constants associated with the InstanceAvailabilityPolicy.HostFailure property. +// The action to perform if the compute host experiences a failure. +// - `restart`: Automatically restart the virtual server instance after host failure +// - `stop`: Leave the virtual server instance stopped after host failure +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the +// unexpected property value was encountered. +const ( + InstanceAvailabilityPolicyHostFailureRestartConst = "restart" + InstanceAvailabilityPolicyHostFailureStopConst = "stop" +) + +// UnmarshalInstanceAvailabilityPolicy unmarshals an instance of InstanceAvailabilityPolicy from the specified map of raw messages. +func UnmarshalInstanceAvailabilityPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceAvailabilityPolicy) + err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceAvailabilityPolicyPatch : InstanceAvailabilityPolicyPatch struct +type InstanceAvailabilityPolicyPatch struct { + // The action to perform if the compute host experiences a failure. + // - `restart`: Automatically restart the virtual server instance after host failure + // - `stop`: Leave the virtual server instance stopped after host failure. + HostFailure *string `json:"host_failure,omitempty"` +} + +// Constants associated with the InstanceAvailabilityPolicyPatch.HostFailure property. +// The action to perform if the compute host experiences a failure. +// - `restart`: Automatically restart the virtual server instance after host failure +// - `stop`: Leave the virtual server instance stopped after host failure. +const ( + InstanceAvailabilityPolicyPatchHostFailureRestartConst = "restart" + InstanceAvailabilityPolicyPatchHostFailureStopConst = "stop" +) + +// UnmarshalInstanceAvailabilityPolicyPatch unmarshals an instance of InstanceAvailabilityPolicyPatch from the specified map of raw messages. +func UnmarshalInstanceAvailabilityPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceAvailabilityPolicyPatch) + err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceAvailabilityPolicyPrototype : InstanceAvailabilityPolicyPrototype struct +type InstanceAvailabilityPolicyPrototype struct { + // The action to perform if the compute host experiences a failure. + // - `restart`: Automatically restart the virtual server instance after host failure + // - `stop`: Leave the virtual server instance stopped after host failure. + HostFailure *string `json:"host_failure,omitempty"` +} + +// Constants associated with the InstanceAvailabilityPolicyPrototype.HostFailure property. +// The action to perform if the compute host experiences a failure. +// - `restart`: Automatically restart the virtual server instance after host failure +// - `stop`: Leave the virtual server instance stopped after host failure. +const ( + InstanceAvailabilityPolicyPrototypeHostFailureRestartConst = "restart" + InstanceAvailabilityPolicyPrototypeHostFailureStopConst = "stop" +) + +// UnmarshalInstanceAvailabilityPolicyPrototype unmarshals an instance of InstanceAvailabilityPolicyPrototype from the specified map of raw messages. +func UnmarshalInstanceAvailabilityPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceAvailabilityPolicyPrototype) + err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCatalogOffering : InstanceCatalogOffering struct +type InstanceCatalogOffering struct { + // The catalog offering version this virtual server instance was provisioned from. + // + // The catalog offering version is not managed by the IBM VPC service, and may no longer + // exist, or may refer to a different image CRN than the `image.crn` for this virtual + // server instance. However, all images associated with a catalog offering version will + // have the same checksum, and therefore will have the same data. + Version *CatalogOfferingVersionReference `json:"version" validate:"required"` +} + +// UnmarshalInstanceCatalogOffering unmarshals an instance of InstanceCatalogOffering from the specified map of raw messages. +func UnmarshalInstanceCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCatalogOffering) + err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCatalogOfferingPrototype : The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering or offering version to use +// when provisioning this virtual server instance. +// +// If an offering is specified, the latest version of that offering will be used. +// +// The specified offering or offering version may be in a different account in the same +// [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject to IAM policies. +// Models which "extend" this model: +// - InstanceCatalogOfferingPrototypeCatalogOfferingByOffering +// - InstanceCatalogOfferingPrototypeCatalogOfferingByVersion +type InstanceCatalogOfferingPrototype struct { + // Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering by a unique property. + Offering CatalogOfferingIdentityIntf `json:"offering,omitempty"` + + // Identifies a version of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a + // unique property. + Version CatalogOfferingVersionIdentityIntf `json:"version,omitempty"` +} + +func (*InstanceCatalogOfferingPrototype) isaInstanceCatalogOfferingPrototype() bool { + return true +} + +type InstanceCatalogOfferingPrototypeIntf interface { + isaInstanceCatalogOfferingPrototype() bool +} + +// UnmarshalInstanceCatalogOfferingPrototype unmarshals an instance of InstanceCatalogOfferingPrototype from the specified map of raw messages. +func UnmarshalInstanceCatalogOfferingPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCatalogOfferingPrototype) + err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) + if err != nil { + 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 *InstanceCollectionFirst `json:"first" validate:"required"` + + // Collection 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 *InstanceCollectionNext `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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstance) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + 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"` +} + +// 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) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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. + Href *string `json:"href" 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) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceConsoleAccessToken : The instance console access token information. +type InstanceConsoleAccessToken struct { + // A URL safe single-use token used to access the console WebSocket. + AccessToken *string `json:"access_token" validate:"required"` + + // The instance console type for which this token may be used. + ConsoleType *string `json:"console_type" validate:"required"` + + // The date and time that the access token was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The date and time that the access token will expire. + ExpiresAt *strfmt.DateTime `json:"expires_at" 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"` + + // The URL to access this instance console. + Href *string `json:"href" validate:"required"` +} + +// Constants associated with the InstanceConsoleAccessToken.ConsoleType property. +// The instance console type for which this token may be used. +const ( + InstanceConsoleAccessTokenConsoleTypeSerialConst = "serial" + InstanceConsoleAccessTokenConsoleTypeVncConst = "vnc" +) + +// UnmarshalInstanceConsoleAccessToken unmarshals an instance of InstanceConsoleAccessToken from the specified map of raw messages. +func UnmarshalInstanceConsoleAccessToken(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceConsoleAccessToken) + err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "force", &obj.Force) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDefaultTrustedProfilePrototype : InstanceDefaultTrustedProfilePrototype struct +type InstanceDefaultTrustedProfilePrototype struct { + // If set to `true`, the system will create a link to the specified `target` trusted profile during instance creation. + // Regardless of whether a link is created by the system or manually using the IAM Identity service, it will be + // automatically deleted when the instance is deleted. + AutoLink *bool `json:"auto_link,omitempty"` + + // The default IAM trusted profile to use for this virtual server instance. + Target TrustedProfileIdentityIntf `json:"target" validate:"required"` +} + +// NewInstanceDefaultTrustedProfilePrototype : Instantiate InstanceDefaultTrustedProfilePrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceDefaultTrustedProfilePrototype(target TrustedProfileIdentityIntf) (_model *InstanceDefaultTrustedProfilePrototype, err error) { + _model = &InstanceDefaultTrustedProfilePrototype{ + Target: target, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalInstanceDefaultTrustedProfilePrototype unmarshals an instance of InstanceDefaultTrustedProfilePrototype from the specified map of raw messages. +func UnmarshalInstanceDefaultTrustedProfilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDefaultTrustedProfilePrototype) + err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDisk : InstanceDisk struct +type InstanceDisk struct { + // The date and time that the disk was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance disk. + ID *string `json:"id" validate:"required"` + + // The disk interface used for attaching the disk. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The name for this instance disk. The name is unique across all disks on the instance. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *int64 `json:"size" validate:"required"` +} + +// Constants associated with the InstanceDisk.InterfaceType property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + InstanceDiskInterfaceTypeNvmeConst = "nvme" + InstanceDiskInterfaceTypeVirtioBlkConst = "virtio_blk" +) + +// Constants associated with the InstanceDisk.ResourceType property. +// The resource type. +const ( + InstanceDiskResourceTypeInstanceDiskConst = "instance_disk" +) + +// UnmarshalInstanceDisk unmarshals an instance of InstanceDisk from the specified map of raw messages. +func UnmarshalInstanceDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDisk) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDiskCollection : InstanceDiskCollection struct +type InstanceDiskCollection struct { + // Collection of the instance's disks. + Disks []InstanceDisk `json:"disks" validate:"required"` +} + +// UnmarshalInstanceDiskCollection unmarshals an instance of InstanceDiskCollection from the specified map of raw messages. +func UnmarshalInstanceDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskCollection) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDiskPatch : InstanceDiskPatch struct +type InstanceDiskPatch struct { + // The name for this instance disk. The name must not be used by another disk on the instance. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceDiskPatch unmarshals an instance of InstanceDiskPatch from the specified map of raw messages. +func UnmarshalInstanceDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceDiskReference : InstanceDiskReference struct +type InstanceDiskReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceDiskReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance disk. + ID *string `json:"id" validate:"required"` + + // The name for this instance disk. The name is unique across all disks on the instance. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstanceDiskReference.ResourceType property. +// The resource type. +const ( + InstanceDiskReferenceResourceTypeInstanceDiskConst = "instance_disk" +) + +// UnmarshalInstanceDiskReference unmarshals an instance of InstanceDiskReference from the specified map of raw messages. +func UnmarshalInstanceDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceDiskReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceDiskReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceDiskReferenceDeleted unmarshals an instance of InstanceDiskReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGpu : The virtual server instance GPU configuration. +type InstanceGpu struct { + // The number of GPUs assigned to the instance. + Count *int64 `json:"count" validate:"required"` + + // The GPU manufacturer. + Manufacturer *string `json:"manufacturer" validate:"required"` + + // The overall amount of GPU memory in GiB (gibibytes). + Memory *int64 `json:"memory" validate:"required"` + + // The GPU model. + Model *string `json:"model" validate:"required"` +} + +// UnmarshalInstanceGpu unmarshals an instance of InstanceGpu from the specified map of raw messages. +func UnmarshalInstanceGpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGpu) + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "model", &obj.Model) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroup : InstanceGroup struct +type InstanceGroup struct { + // The port used for new load balancer pool members created by this instance group. + // + // This property will be present if and only if `load_balancer_pool` is present. + ApplicationPort *int64 `json:"application_port,omitempty"` + + // The date and time that the instance group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance group. + CRN *string `json:"crn" validate:"required"` + + // The URL for this instance group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group. + ID *string `json:"id" validate:"required"` + + // The template used to create new instances for this group. + InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` + + // If present, the load balancer pool this instance group manages. A pool member will + // be created for each instance created by this group. + LoadBalancerPool *LoadBalancerPoolReference `json:"load_balancer_pool,omitempty"` + + // The managers for the instance group. + Managers []InstanceGroupManagerReference `json:"managers" validate:"required"` + + // The number of instances in the instance group. + MembershipCount *int64 `json:"membership_count" validate:"required"` + + // The name for this instance group. The name is unique across all instance groups in the region. + Name *string `json:"name" validate:"required"` + + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The status of the instance group + // - `deleting`: Group is being deleted + // - `healthy`: Group has `membership_count` instances + // - `scaling`: Instances in the group are being created or deleted to reach + // `membership_count` + // - `unhealthy`: Group is unable to reach `membership_count` instances. + Status *string `json:"status" validate:"required"` + + // The subnets to use when creating new instances. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The date and time that the instance group was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The VPC the instance group resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the InstanceGroup.Status property. +// The status of the instance group +// - `deleting`: Group is being deleted +// - `healthy`: Group has `membership_count` instances +// - `scaling`: Instances in the group are being created or deleted to reach +// `membership_count` +// - `unhealthy`: Group is unable to reach `membership_count` instances. +const ( + InstanceGroupStatusDeletingConst = "deleting" + InstanceGroupStatusHealthyConst = "healthy" + InstanceGroupStatusScalingConst = "scaling" + InstanceGroupStatusUnhealthyConst = "unhealthy" +) + +// UnmarshalInstanceGroup unmarshals an instance of InstanceGroup from the specified map of raw messages. +func UnmarshalInstanceGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroup) + err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManagerReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupCollection : InstanceGroupCollection struct +type InstanceGroupCollection struct { + // A link to the first page of resources. + First *InstanceGroupCollectionFirst `json:"first" validate:"required"` + + // Collection of instance groups. + InstanceGroups []InstanceGroup `json:"instance_groups" 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 *InstanceGroupCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_groups", &obj.InstanceGroups, UnmarshalInstanceGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *InstanceGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManager : InstanceGroupManager struct +// Models which "extend" this model: +// - InstanceGroupManagerAutoScale +// - InstanceGroupManagerScheduled +type InstanceGroupManager struct { + // The date and time that the instance group manager was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled" validate:"required"` + + // The name for this instance group manager. The name is unique across all managers for the instance group. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type,omitempty"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The policies of the instance group manager. + Policies []InstanceGroupManagerPolicyReference `json:"policies,omitempty"` + + // The actions of the instance group manager. + Actions []InstanceGroupManagerActionReference `json:"actions,omitempty"` +} + +// Constants associated with the InstanceGroupManager.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerManagerTypeAutoscaleConst = "autoscale" +) + +func (*InstanceGroupManager) isaInstanceGroupManager() bool { + return true +} + +type InstanceGroupManagerIntf interface { + isaInstanceGroupManager() bool +} + +// UnmarshalInstanceGroupManager unmarshals an instance of InstanceGroupManager from the specified map of raw messages. +func UnmarshalInstanceGroupManager(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManager) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerAction : InstanceGroupManagerAction struct +// Models which "extend" this model: +// - InstanceGroupManagerActionScheduledAction +type InstanceGroupManagerAction struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. 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`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the + // future. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` + + // The date and time that the instance group manager action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroup `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager,omitempty"` +} + +// Constants associated with the InstanceGroupManagerAction.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerAction.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionStatusActiveConst = "active" + InstanceGroupManagerActionStatusCompletedConst = "completed" + InstanceGroupManagerActionStatusFailedConst = "failed" + InstanceGroupManagerActionStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerAction.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerAction) isaInstanceGroupManagerAction() bool { + return true +} + +type InstanceGroupManagerActionIntf interface { + isaInstanceGroupManagerAction() bool +} + +// UnmarshalInstanceGroupManagerAction unmarshals an instance of InstanceGroupManagerAction from the specified map of raw messages. +func UnmarshalInstanceGroupManagerAction(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerAction) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionGroupPatch : InstanceGroupManagerActionGroupPatch struct +type InstanceGroupManagerActionGroupPatch struct { + // The desired number of instance group members at the scheduled time. + MembershipCount *int64 `json:"membership_count,omitempty"` +} + +// UnmarshalInstanceGroupManagerActionGroupPatch unmarshals an instance of InstanceGroupManagerActionGroupPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionGroupPatch) + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionManagerPatch : InstanceGroupManagerActionManagerPatch struct +type InstanceGroupManagerActionManagerPatch struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +// UnmarshalInstanceGroupManagerActionManagerPatch unmarshals an instance of InstanceGroupManagerActionManagerPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionManagerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionManagerPatch) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPatch : InstanceGroupManagerActionPatch struct +type InstanceGroupManagerActionPatch struct { + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + Group *InstanceGroupManagerActionGroupPatch `json:"group,omitempty"` + + Manager *InstanceGroupManagerActionManagerPatch `json:"manager,omitempty"` + + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` +} + +// UnmarshalInstanceGroupManagerActionPatch unmarshals an instance of InstanceGroupManagerActionPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPatch) + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerActionGroupPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerActionManagerPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceGroupManagerActionPrototype : InstanceGroupManagerActionPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerActionPrototypeScheduledActionPrototype +type InstanceGroupManagerActionPrototype struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` +} + +func (*InstanceGroupManagerActionPrototype) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +type InstanceGroupManagerActionPrototypeIntf interface { + isaInstanceGroupManagerActionPrototype() bool +} + +// UnmarshalInstanceGroupManagerActionPrototype unmarshals an instance of InstanceGroupManagerActionPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionReference : InstanceGroupManagerActionReference struct +type InstanceGroupManagerActionReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerActionReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerActionReference.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionReferenceResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// UnmarshalInstanceGroupManagerActionReference unmarshals an instance of InstanceGroupManagerActionReference from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerActionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceGroupManagerActionReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupManagerActionReferenceDeleted unmarshals an instance of InstanceGroupManagerActionReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionsCollection : InstanceGroupManagerActionsCollection struct +type InstanceGroupManagerActionsCollection struct { + // Collection of instance group manager actions. + Actions []InstanceGroupManagerActionIntf `json:"actions" validate:"required"` + + // A link to the first page of resources. + First *InstanceGroupManagerActionsCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceGroupManagerActionsCollection unmarshals an instance of InstanceGroupManagerActionsCollection from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionsCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionsCollection) + err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerAction) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerActionsCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerActionsCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *InstanceGroupManagerActionsCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of instance group managers. + Managers []InstanceGroupManagerIntf `json:"managers" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceGroupManagerCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManager) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *InstanceGroupManagerCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The name for this instance group manager. The name must not be used by another manager for the instance group. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceGroupManagerPatch unmarshals an instance of InstanceGroupManagerPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPatch) + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceGroupManagerPolicy : InstanceGroupManagerPolicy struct +// Models which "extend" this model: +// - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy +type InstanceGroupManagerPolicy struct { + // The date and time that the instance group manager policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager policy. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager policy. The name is unique across all policies for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager policy was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type,omitempty"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value,omitempty"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPolicy.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicy.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyPolicyTypeTargetConst = "target" +) + +func (*InstanceGroupManagerPolicy) isaInstanceGroupManagerPolicy() bool { + return true +} + +type InstanceGroupManagerPolicyIntf interface { + isaInstanceGroupManagerPolicy() bool +} + +// UnmarshalInstanceGroupManagerPolicy unmarshals an instance of InstanceGroupManagerPolicy from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicy) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyCollection : InstanceGroupManagerPolicyCollection struct +type InstanceGroupManagerPolicyCollection struct { + // A link to the first page of resources. + First *InstanceGroupManagerPolicyCollectionFirst `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"` + + // Collection of instance group manager policies. + Policies []InstanceGroupManagerPolicyIntf `json:"policies" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerPolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *InstanceGroupManagerPolicyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyPatch : InstanceGroupManagerPolicyPatch struct +type InstanceGroupManagerPolicyPatch struct { + // The type of metric to be evaluated. + MetricType *string `json:"metric_type,omitempty"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value,omitempty"` + + // The name for this instance group manager policy. The name must not be used by another policy for the instance group + // manager. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPolicyPatch.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyPatchMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyPatchMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyPatchMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyPatchMetricTypeNetworkOutConst = "network_out" +) + +// UnmarshalInstanceGroupManagerPolicyPatch unmarshals an instance of InstanceGroupManagerPolicyPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyPatch) + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceGroupManagerPolicyPrototype : InstanceGroupManagerPolicyPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype +type InstanceGroupManagerPolicyPrototype struct { + // The name for this instance group manager policy. The name must not be used by another policy for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type,omitempty"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value,omitempty"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPolicyPrototype.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyPrototypeMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyPrototypeMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyPrototypeMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyPrototypeMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicyPrototype.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyPrototypePolicyTypeTargetConst = "target" +) + +func (*InstanceGroupManagerPolicyPrototype) isaInstanceGroupManagerPolicyPrototype() bool { + return true +} + +type InstanceGroupManagerPolicyPrototypeIntf interface { + isaInstanceGroupManagerPolicyPrototype() bool +} + +// UnmarshalInstanceGroupManagerPolicyPrototype unmarshals an instance of InstanceGroupManagerPolicyPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyReference : InstanceGroupManagerPolicyReference struct +type InstanceGroupManagerPolicyReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerPolicyReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager policy. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager policy. The name is unique across all policies for the instance group + // manager. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceGroupManagerPolicyReference unmarshals an instance of InstanceGroupManagerPolicyReference from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerPolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceGroupManagerPolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupManagerPolicyReferenceDeleted unmarshals an instance of InstanceGroupManagerPolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPrototype : InstanceGroupManagerPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype +// - InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype +type InstanceGroupManagerPrototype struct { + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The name for this instance group manager. The name must not be used by another manager for the instance group. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type,omitempty"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPrototype.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerPrototypeManagerTypeAutoscaleConst = "autoscale" +) + +func (*InstanceGroupManagerPrototype) isaInstanceGroupManagerPrototype() bool { + return true +} + +type InstanceGroupManagerPrototypeIntf interface { + isaInstanceGroupManagerPrototype() bool +} + +// UnmarshalInstanceGroupManagerPrototype unmarshals an instance of InstanceGroupManagerPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPrototype) + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerReference : InstanceGroupManagerReference struct +type InstanceGroupManagerReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager. The name is unique across all managers for the instance group. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceGroupManagerReference unmarshals an instance of InstanceGroupManagerReference from the specified map of raw messages. +func UnmarshalInstanceGroupManagerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceGroupManagerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupManagerReferenceDeleted unmarshals an instance of InstanceGroupManagerReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupManagerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionGroup : InstanceGroupManagerScheduledActionGroup struct +type InstanceGroupManagerScheduledActionGroup struct { + // The desired number of instance group members at the scheduled time. + MembershipCount *int64 `json:"membership_count" validate:"required"` +} + +// UnmarshalInstanceGroupManagerScheduledActionGroup unmarshals an instance of InstanceGroupManagerScheduledActionGroup from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionGroup) + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionGroupPrototype : InstanceGroupManagerScheduledActionGroupPrototype struct +type InstanceGroupManagerScheduledActionGroupPrototype struct { + // The desired number of instance group members at the scheduled time. + MembershipCount *int64 `json:"membership_count" validate:"required"` +} + +// NewInstanceGroupManagerScheduledActionGroupPrototype : Instantiate InstanceGroupManagerScheduledActionGroupPrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerScheduledActionGroupPrototype(membershipCount int64) (_model *InstanceGroupManagerScheduledActionGroupPrototype, err error) { + _model = &InstanceGroupManagerScheduledActionGroupPrototype{ + MembershipCount: core.Int64Ptr(membershipCount), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalInstanceGroupManagerScheduledActionGroupPrototype unmarshals an instance of InstanceGroupManagerScheduledActionGroupPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionGroupPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionGroupPrototype) + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManager : InstanceGroupManagerScheduledActionManager struct +// Models which "extend" this model: +// - InstanceGroupManagerScheduledActionManagerAutoScale +type InstanceGroupManagerScheduledActionManager struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href,omitempty"` + + // The unique identifier for this instance group manager. + ID *string `json:"id,omitempty"` + + // The name for this instance group manager. The name is unique across all managers for the instance group. + Name *string `json:"name,omitempty"` + + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +func (*InstanceGroupManagerScheduledActionManager) isaInstanceGroupManagerScheduledActionManager() bool { + return true +} + +type InstanceGroupManagerScheduledActionManagerIntf interface { + isaInstanceGroupManagerScheduledActionManager() bool +} + +// UnmarshalInstanceGroupManagerScheduledActionManager unmarshals an instance of InstanceGroupManagerScheduledActionManager from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManager(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManager) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototype : InstanceGroupManagerScheduledActionManagerPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype +type InstanceGroupManagerScheduledActionManagerPrototype struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The unique identifier for this instance group manager. + ID *string `json:"id,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href,omitempty"` +} + +func (*InstanceGroupManagerScheduledActionManagerPrototype) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +type InstanceGroupManagerScheduledActionManagerPrototypeIntf interface { + isaInstanceGroupManagerScheduledActionManagerPrototype() bool +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototype unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototype) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembership : InstanceGroupMembership struct +type InstanceGroupMembership struct { + // The date and time that the instance group manager policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If set to true, when deleting the membership the instance will also be deleted. + DeleteInstanceOnMembershipDelete *bool `json:"delete_instance_on_membership_delete" validate:"required"` + + // The URL for this instance group membership. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group membership. + ID *string `json:"id" validate:"required"` + + Instance *InstanceReference `json:"instance" validate:"required"` + + InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` + + // The name for this instance group membership. The name is unique across all memberships for the instance group. + Name *string `json:"name" validate:"required"` + + PoolMember *LoadBalancerPoolMemberReference `json:"pool_member,omitempty"` + + // The status of the instance group membership + // - `deleting`: Membership is deleting dependent resources + // - `failed`: Membership was unable to maintain dependent resources + // - `healthy`: Membership is active and serving in the group + // - `pending`: Membership is waiting for dependent resources + // - `unhealthy`: Membership has unhealthy dependent resources. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group membership was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` +} + +// Constants associated with the InstanceGroupMembership.Status property. +// The status of the instance group membership +// - `deleting`: Membership is deleting dependent resources +// - `failed`: Membership was unable to maintain dependent resources +// - `healthy`: Membership is active and serving in the group +// - `pending`: Membership is waiting for dependent resources +// - `unhealthy`: Membership has unhealthy dependent resources. +const ( + InstanceGroupMembershipStatusDeletingConst = "deleting" + InstanceGroupMembershipStatusFailedConst = "failed" + InstanceGroupMembershipStatusHealthyConst = "healthy" + InstanceGroupMembershipStatusPendingConst = "pending" + InstanceGroupMembershipStatusUnhealthyConst = "unhealthy" +) + +// UnmarshalInstanceGroupMembership unmarshals an instance of InstanceGroupMembership from the specified map of raw messages. +func UnmarshalInstanceGroupMembership(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupMembership) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "delete_instance_on_membership_delete", &obj.DeleteInstanceOnMembershipDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalInstanceReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pool_member", &obj.PoolMember, UnmarshalLoadBalancerPoolMemberReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembershipCollection : InstanceGroupMembershipCollection struct +type InstanceGroupMembershipCollection struct { + // A link to the first page of resources. + First *InstanceGroupMembershipCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of instance group memberships. + Memberships []InstanceGroupMembership `json:"memberships" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceGroupMembershipCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memberships", &obj.Memberships, UnmarshalInstanceGroupMembership) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupMembershipCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *InstanceGroupMembershipCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembershipPatch : InstanceGroupMembershipPatch struct +type InstanceGroupMembershipPatch struct { + // The name for this instance group membership. The name must not be used by another membership for the instance group + // manager. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceGroupMembershipPatch unmarshals an instance of InstanceGroupMembershipPatch from the specified map of raw messages. +func UnmarshalInstanceGroupMembershipPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupMembershipPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceGroupPatch : To add or update load balancer specification for an instance group the `membership_count` must first be set to 0. +type InstanceGroupPatch struct { + // The port to use for new load balancer pool members created by this instance group. + // + // This property must be set if and only if `load_balancer_pool` has been set. + ApplicationPort *int64 `json:"application_port,omitempty"` + + // Instance template to use when creating new instances. + // + // Instance groups are not compatible with instance templates that specify `true` for + // `default_trusted_profile.auto_link`. + InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template,omitempty"` + + // The load balancer associated with `load_balancer_pool`. + // The load balancer must have `instance_groups_supported` set to `true`. + // + // This property must be set if and only if `load_balancer_pool` has been set. + LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` + + // If specified, this instance group will manage the load balancer pool. A pool member + // will be created for each instance created by this group. The specified load + // balancer pool must not be used by another instance group in the VPC. + // + // If set, `load_balancer` and `application_port` must also be set. + LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"` + + // The number of instances in the instance group. + MembershipCount *int64 `json:"membership_count,omitempty"` + + // The name for this instance group. The name must not be used by another instance group in the region. + Name *string `json:"name,omitempty"` + + // The subnets to use when creating new instances. + Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` +} + +// UnmarshalInstanceGroupPatch unmarshals an instance of InstanceGroupPatch from the specified map of raw messages. +func UnmarshalInstanceGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupPatch) + err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancer", &obj.LoadBalancer, UnmarshalLoadBalancerIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceGroupReference : InstanceGroupReference struct +type InstanceGroupReference struct { + // The CRN for this instance group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group. + ID *string `json:"id" validate:"required"` + + // The name for this instance group. The name is unique across all instance groups in the region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceGroupReference unmarshals an instance of InstanceGroupReference from the specified map of raw messages. +func UnmarshalInstanceGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupReferenceDeleted unmarshals an instance of InstanceGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceHealthReason : InstanceHealthReason struct +type InstanceHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the InstanceHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + InstanceHealthReasonCodeReservationCapacityUnavailableConst = "reservation_capacity_unavailable" + InstanceHealthReasonCodeReservationDeletedConst = "reservation_deleted" + InstanceHealthReasonCodeReservationExpiredConst = "reservation_expired" + InstanceHealthReasonCodeReservationFailedConst = "reservation_failed" +) + +// UnmarshalInstanceHealthReason unmarshals an instance of InstanceHealthReason from the specified map of raw messages. +func UnmarshalInstanceHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceInitialization : InstanceInitialization struct +type InstanceInitialization struct { + // The default trusted profile configuration specified at virtual server instance + // creation. If absent, no default trusted profile was specified. + DefaultTrustedProfile *InstanceInitializationDefaultTrustedProfile `json:"default_trusted_profile,omitempty"` + + // The public SSH keys used at instance initialization. + Keys []KeyReference `json:"keys" validate:"required"` + + Password *InstanceInitializationPassword `json:"password,omitempty"` +} + +// UnmarshalInstanceInitialization unmarshals an instance of InstanceInitialization from the specified map of raw messages. +func UnmarshalInstanceInitialization(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceInitialization) + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceInitializationDefaultTrustedProfile) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "password", &obj.Password, UnmarshalInstanceInitializationPassword) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceInitializationDefaultTrustedProfile : InstanceInitializationDefaultTrustedProfile struct +type InstanceInitializationDefaultTrustedProfile struct { + // If set to `true`, the system created a link to the specified `target` trusted profile during instance creation. + // Regardless of whether a link was created by the system or manually using the IAM Identity service, it will be + // automatically deleted when the instance is deleted. + AutoLink *bool `json:"auto_link" validate:"required"` + + // The default IAM trusted profile to use for this virtual server instance. + Target *TrustedProfileReference `json:"target" validate:"required"` +} + +// UnmarshalInstanceInitializationDefaultTrustedProfile unmarshals an instance of InstanceInitializationDefaultTrustedProfile from the specified map of raw messages. +func UnmarshalInstanceInitializationDefaultTrustedProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceInitializationDefaultTrustedProfile) + err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceInitializationPassword : InstanceInitializationPassword struct +type InstanceInitializationPassword struct { + // The administrator password at initialization, encrypted using `encryption_key`, and returned base64-encoded. + EncryptedPassword *[]byte `json:"encrypted_password" validate:"required"` + + // The public SSH key used to encrypt the administrator password. + EncryptionKey *KeyIdentityByFingerprint `json:"encryption_key" validate:"required"` +} + +// UnmarshalInstanceInitializationPassword unmarshals an instance of InstanceInitializationPassword from the specified map of raw messages. +func UnmarshalInstanceInitializationPassword(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceInitializationPassword) + err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyIdentityByFingerprint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceLifecycleReason : InstanceLifecycleReason struct +type InstanceLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 InstanceLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + InstanceLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalInstanceLifecycleReason unmarshals an instance of InstanceLifecycleReason from the specified map of raw messages. +func UnmarshalInstanceLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceMetadataService : The metadata service configuration. +type InstanceMetadataService struct { + // Indicates whether the metadata service endpoint is available to the virtual server instance. + Enabled *bool `json:"enabled" validate:"required"` + + // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is + // enabled. + // - `http`: HTTP protocol (unencrypted) + // - `https`: HTTP Secure protocol. + Protocol *string `json:"protocol" validate:"required"` + + // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata + // service is enabled. + ResponseHopLimit *int64 `json:"response_hop_limit" validate:"required"` +} + +// Constants associated with the InstanceMetadataService.Protocol property. +// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is +// enabled. +// - `http`: HTTP protocol (unencrypted) +// - `https`: HTTP Secure protocol. +const ( + InstanceMetadataServiceProtocolHTTPConst = "http" + InstanceMetadataServiceProtocolHTTPSConst = "https" +) + +// UnmarshalInstanceMetadataService unmarshals an instance of InstanceMetadataService from the specified map of raw messages. +func UnmarshalInstanceMetadataService(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceMetadataService) + err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceMetadataServicePatch : The metadata service configuration. +type InstanceMetadataServicePatch struct { + // Indicates whether the metadata service endpoint will be available to the virtual server instance. + Enabled *bool `json:"enabled,omitempty"` + + // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is + // enabled. + // - `http`: HTTP protocol (unencrypted) + // - `https`: HTTP Secure protocol. + Protocol *string `json:"protocol,omitempty"` + + // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata + // service is enabled. + ResponseHopLimit *int64 `json:"response_hop_limit,omitempty"` +} + +// Constants associated with the InstanceMetadataServicePatch.Protocol property. +// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is +// enabled. +// - `http`: HTTP protocol (unencrypted) +// - `https`: HTTP Secure protocol. +const ( + InstanceMetadataServicePatchProtocolHTTPConst = "http" + InstanceMetadataServicePatchProtocolHTTPSConst = "https" +) + +// UnmarshalInstanceMetadataServicePatch unmarshals an instance of InstanceMetadataServicePatch from the specified map of raw messages. +func UnmarshalInstanceMetadataServicePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceMetadataServicePatch) + err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceMetadataServicePrototype : The metadata service configuration. +type InstanceMetadataServicePrototype struct { + // Indicates whether the metadata service endpoint will be available to the virtual server instance. + Enabled *bool `json:"enabled,omitempty"` + + // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is + // enabled. + // - `http`: HTTP protocol (unencrypted) + // - `https`: HTTP Secure protocol. + Protocol *string `json:"protocol,omitempty"` + + // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata + // service is enabled. + ResponseHopLimit *int64 `json:"response_hop_limit,omitempty"` +} + +// Constants associated with the InstanceMetadataServicePrototype.Protocol property. +// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is +// enabled. +// - `http`: HTTP protocol (unencrypted) +// - `https`: HTTP Secure protocol. +const ( + InstanceMetadataServicePrototypeProtocolHTTPConst = "http" + InstanceMetadataServicePrototypeProtocolHTTPSConst = "https" +) + +// UnmarshalInstanceMetadataServicePrototype unmarshals an instance of InstanceMetadataServicePrototype from the specified map of raw messages. +func UnmarshalInstanceMetadataServicePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceMetadataServicePrototype) + err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachment : InstanceNetworkAttachment struct +type InstanceNetworkAttachment struct { + // The date and time that the instance network attachment was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the instance network attachment. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this instance network attachment. The name is unique across all network attachments for the instance. + Name *string `json:"name" validate:"required"` + + // The port speed for this instance network attachment in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + // The primary IP address of the virtual network interface for the instance 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 instance network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The instance network attachment type. + Type *string `json:"type" validate:"required"` + + // The virtual network interface for this instance network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` +} + +// Constants associated with the InstanceNetworkAttachment.LifecycleState property. +// The lifecycle state of the instance network attachment. +const ( + InstanceNetworkAttachmentLifecycleStateDeletingConst = "deleting" + InstanceNetworkAttachmentLifecycleStateFailedConst = "failed" + InstanceNetworkAttachmentLifecycleStatePendingConst = "pending" + InstanceNetworkAttachmentLifecycleStateStableConst = "stable" + InstanceNetworkAttachmentLifecycleStateSuspendedConst = "suspended" + InstanceNetworkAttachmentLifecycleStateUpdatingConst = "updating" + InstanceNetworkAttachmentLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the InstanceNetworkAttachment.ResourceType property. +// The resource type. +const ( + InstanceNetworkAttachmentResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" +) + +// Constants associated with the InstanceNetworkAttachment.Type property. +// The instance network attachment type. +const ( + InstanceNetworkAttachmentTypePrimaryConst = "primary" + InstanceNetworkAttachmentTypeSecondaryConst = "secondary" +) + +// UnmarshalInstanceNetworkAttachment unmarshals an instance of InstanceNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachment) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentCollection : InstanceNetworkAttachmentCollection struct +type InstanceNetworkAttachmentCollection struct { + // Collection of instance network attachments. + NetworkAttachments []InstanceNetworkAttachment `json:"network_attachments" validate:"required"` +} + +// UnmarshalInstanceNetworkAttachmentCollection unmarshals an instance of InstanceNetworkAttachmentCollection from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentCollection) + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachment) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPatch : InstanceNetworkAttachmentPatch struct +type InstanceNetworkAttachmentPatch struct { + // The name for this network attachment. The name must not be used by another network attachment for the instance. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceNetworkAttachmentPatch unmarshals an instance of InstanceNetworkAttachmentPatch from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceNetworkAttachmentPrototype : InstanceNetworkAttachmentPrototype struct +type InstanceNetworkAttachmentPrototype struct { + // The name for this network attachment. Names must be unique within the instance 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 instance 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, `enable_infrastructure_nat` must be + // `true`. + VirtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototype : Instantiate InstanceNetworkAttachmentPrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototype(virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) (_model *InstanceNetworkAttachmentPrototype, err error) { + _model = &InstanceNetworkAttachmentPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalInstanceNetworkAttachmentPrototype unmarshals an instance of InstanceNetworkAttachmentPrototype from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterface : A virtual network interface for the instance 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, `enable_infrastructure_nat` must be +// `true`. +// Models which "extend" this model: +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterface 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"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,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"` + + // 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"` + + // 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 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"` + + // The resource group to use for this virtual network interface. If unspecified, the + // virtual server instance's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,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"` +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface { + isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentReference : InstanceNetworkAttachmentReference struct +type InstanceNetworkAttachmentReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` + + // The name for this instance network attachment. The name is unique across all network attachments for the instance. + Name *string `json:"name" validate:"required"` + + // The primary IP address of the virtual network interface for the instance 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 instance network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the InstanceNetworkAttachmentReference.ResourceType property. +// The resource type. +const ( + InstanceNetworkAttachmentReferenceResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" +) + +// UnmarshalInstanceNetworkAttachmentReference unmarshals an instance of InstanceNetworkAttachmentReference from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceNetworkAttachmentReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceNetworkAttachmentReferenceDeleted unmarshals an instance of InstanceNetworkAttachmentReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePatch : InstancePatch struct +type InstancePatch struct { + // The availability policy for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPatch `json:"availability_policy,omitempty"` + + // The metadata service configuration. + MetadataService *InstanceMetadataServicePatch `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance in the + // region. Changing the name will not affect the system hostname. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. For the placement + // restrictions to be changed, the instance `status` must be `stopping` or `stopped`. + // + // 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. + // - 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`. + // - Have the same `vcpu.architecture`. + // - Support the number of network attachments or network interfaces the instance + // currently has. + Profile InstancePatchProfileIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPatch `json:"reservation_affinity,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` +} + +// UnmarshalInstancePatch unmarshals an instance of InstancePatch from the specified map of raw messages. +func UnmarshalInstancePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatch) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstancePatchProfile) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + 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. +// - 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`. +// - Have the same `vcpu.architecture`. +// - Support the number of network attachments or network interfaces the instance +// currently has. +// +// Models which "extend" this model: +// - InstancePatchProfileInstanceProfileIdentityByName +// - InstancePatchProfileInstanceProfileIdentityByHref +type InstancePatchProfile struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name,omitempty"` + + // The URL for this virtual server instance profile. + Href *string `json:"href,omitempty"` +} + +func (*InstancePatchProfile) isaInstancePatchProfile() bool { + return true +} + +type InstancePatchProfileIntf interface { + isaInstancePatchProfile() bool +} + +// UnmarshalInstancePatchProfile unmarshals an instance of InstancePatchProfile from the specified map of raw messages. +func UnmarshalInstancePatchProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatchProfile) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTarget : InstancePlacementTarget struct +// Models which "extend" this model: +// - InstancePlacementTargetDedicatedHostGroupReference +// - InstancePlacementTargetDedicatedHostReference +// - InstancePlacementTargetPlacementGroupReference +type InstancePlacementTarget struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href,omitempty"` + + // The unique identifier for this dedicated host group. + ID *string `json:"id,omitempty"` + + // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the InstancePlacementTarget.ResourceType property. +// The resource type. +const ( + InstancePlacementTargetResourceTypeDedicatedHostGroupConst = "dedicated_host_group" +) + +func (*InstancePlacementTarget) isaInstancePlacementTarget() bool { + return true +} + +type InstancePlacementTargetIntf interface { + isaInstancePlacementTarget() bool +} + +// UnmarshalInstancePlacementTarget unmarshals an instance of InstancePlacementTarget from the specified map of raw messages. +func UnmarshalInstancePlacementTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTarget) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatch : InstancePlacementTargetPatch struct +// Models which "extend" this model: +// - InstancePlacementTargetPatchDedicatedHostIdentity +// - InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatch struct { + // The unique identifier for this dedicated host. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPatch) isaInstancePlacementTargetPatch() bool { + return true +} + +type InstancePlacementTargetPatchIntf interface { + isaInstancePlacementTargetPatch() bool +} + +// UnmarshalInstancePlacementTargetPatch unmarshals an instance of InstancePlacementTargetPatch from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototype : InstancePlacementTargetPrototype struct +// Models which "extend" this model: +// - InstancePlacementTargetPrototypeDedicatedHostIdentity +// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +// - InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototype struct { + // The unique identifier for this dedicated host. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPrototype) isaInstancePlacementTargetPrototype() bool { + return true +} + +type InstancePlacementTargetPrototypeIntf interface { + isaInstancePlacementTargetPrototype() bool +} + +// UnmarshalInstancePlacementTargetPrototype unmarshals an instance of InstancePlacementTargetPrototype from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfile : InstanceProfile struct +type InstanceProfile struct { + Bandwidth InstanceProfileBandwidthIntf `json:"bandwidth" validate:"required"` + + // Collection of the instance profile's disks. + Disks []InstanceProfileDisk `json:"disks" validate:"required"` + + // The product family this virtual server instance profile belongs to. + Family *string `json:"family" validate:"required"` + + GpuCount InstanceProfileGpuIntf `json:"gpu_count,omitempty"` + + GpuManufacturer *InstanceProfileGpuManufacturer `json:"gpu_manufacturer,omitempty"` + + GpuMemory InstanceProfileGpuMemoryIntf `json:"gpu_memory,omitempty"` + + GpuModel *InstanceProfileGpuModel `json:"gpu_model,omitempty"` + + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` + + Memory InstanceProfileMemoryIntf `json:"memory" validate:"required"` + + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` + + NetworkAttachmentCount InstanceProfileNetworkAttachmentCountIntf `json:"network_attachment_count" validate:"required"` + + NetworkInterfaceCount InstanceProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` + + NumaCount InstanceProfileNumaCountIntf `json:"numa_count,omitempty"` + + OsArchitecture *InstanceProfileOsArchitecture `json:"os_architecture" validate:"required"` + + PortSpeed InstanceProfilePortSpeedIntf `json:"port_speed" validate:"required"` + + ReservationTerms *InstanceProfileReservationTerms `json:"reservation_terms" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance profile: + // - `previous`: This instance profile is an older revision, but remains provisionable and + // usable. + // - `current`: This profile is the latest revision. + // + // Note that revisions are indicated by the generation of an instance profile. Refer to the + // [profile naming conventions] + // (https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on how + // generations are defined within an instance profile. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + + TotalVolumeBandwidth InstanceProfileVolumeBandwidthIntf `json:"total_volume_bandwidth" validate:"required"` + + VcpuArchitecture *InstanceProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` + + VcpuCount InstanceProfileVcpuIntf `json:"vcpu_count" validate:"required"` + + VcpuManufacturer *InstanceProfileVcpuManufacturer `json:"vcpu_manufacturer" validate:"required"` +} + +// Constants associated with the InstanceProfile.ResourceType property. +// The resource type. +const ( + InstanceProfileResourceTypeInstanceProfileConst = "instance_profile" +) + +// Constants associated with the InstanceProfile.Status property. +// The status of the instance profile: +// - `previous`: This instance profile is an older revision, but remains provisionable and +// usable. +// - `current`: This profile is the latest revision. +// +// Note that revisions are indicated by the generation of an instance profile. Refer to the +// [profile naming conventions] +// (https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on how +// generations are defined within an instance profile. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the +// unexpected property value was encountered. +const ( + InstanceProfileStatusCurrentConst = "current" + InstanceProfileStatusPreviousConst = "previous" +) + +// UnmarshalInstanceProfile unmarshals an instance of InstanceProfile from the specified map of raw messages. +func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfile) + err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalInstanceProfileBandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceProfileDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu_count", &obj.GpuCount, UnmarshalInstanceProfileGpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu_manufacturer", &obj.GpuManufacturer, UnmarshalInstanceProfileGpuManufacturer) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu_memory", &obj.GpuMemory, UnmarshalInstanceProfileGpuMemory) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu_model", &obj.GpuModel, UnmarshalInstanceProfileGpuModel) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalInstanceProfileMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalInstanceProfileNetworkAttachmentCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalInstanceProfileNetworkInterfaceCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "numa_count", &obj.NumaCount, UnmarshalInstanceProfileNumaCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalInstanceProfileOsArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "port_speed", &obj.PortSpeed, UnmarshalInstanceProfilePortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_terms", &obj.ReservationTerms, UnmarshalInstanceProfileReservationTerms) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth, UnmarshalInstanceProfileVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalInstanceProfileVcpuArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalInstanceProfileVcpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalInstanceProfileVcpuManufacturer) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidth : InstanceProfileBandwidth struct +// Models which "extend" this model: +// - InstanceProfileBandwidthFixed +// - InstanceProfileBandwidthRange +// - InstanceProfileBandwidthEnum +// - InstanceProfileBandwidthDependent +type InstanceProfileBandwidth 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 InstanceProfileBandwidth.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthTypeFixedConst = "fixed" +) + +func (*InstanceProfileBandwidth) isaInstanceProfileBandwidth() bool { + return true +} + +type InstanceProfileBandwidthIntf interface { + isaInstanceProfileBandwidth() bool +} + +// UnmarshalInstanceProfileBandwidth unmarshals an instance of InstanceProfileBandwidth from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidth) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileCollection : InstanceProfileCollection struct +type InstanceProfileCollection struct { + // Collection of virtual server instance profiles. + Profiles []InstanceProfile `json:"profiles" validate:"required"` +} + +// UnmarshalInstanceProfileCollection unmarshals an instance of InstanceProfileCollection from the specified map of raw messages. +func UnmarshalInstanceProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileCollection) + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalInstanceProfile) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDisk : Disks provided by this profile. +type InstanceProfileDisk struct { + Quantity InstanceProfileDiskQuantityIntf `json:"quantity" validate:"required"` + + Size InstanceProfileDiskSizeIntf `json:"size" validate:"required"` + + SupportedInterfaceTypes *InstanceProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` +} + +// UnmarshalInstanceProfileDisk unmarshals an instance of InstanceProfileDisk from the specified map of raw messages. +func UnmarshalInstanceProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDisk) + err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalInstanceProfileDiskQuantity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalInstanceProfileDiskSize) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalInstanceProfileDiskSupportedInterfaces) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantity : InstanceProfileDiskQuantity struct +// Models which "extend" this model: +// - InstanceProfileDiskQuantityFixed +// - InstanceProfileDiskQuantityRange +// - InstanceProfileDiskQuantityEnum +// - InstanceProfileDiskQuantityDependent +type InstanceProfileDiskQuantity 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 InstanceProfileDiskQuantity.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskQuantity) isaInstanceProfileDiskQuantity() bool { + return true +} + +type InstanceProfileDiskQuantityIntf interface { + isaInstanceProfileDiskQuantity() bool +} + +// UnmarshalInstanceProfileDiskQuantity unmarshals an instance of InstanceProfileDiskQuantity from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSize : InstanceProfileDiskSize struct +// Models which "extend" this model: +// - InstanceProfileDiskSizeFixed +// - InstanceProfileDiskSizeRange +// - InstanceProfileDiskSizeEnum +// - InstanceProfileDiskSizeDependent +type InstanceProfileDiskSize 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 InstanceProfileDiskSize.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskSize) isaInstanceProfileDiskSize() bool { + return true +} + +type InstanceProfileDiskSizeIntf interface { + isaInstanceProfileDiskSize() bool +} + +// UnmarshalInstanceProfileDiskSize unmarshals an instance of InstanceProfileDiskSize from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSize) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSupportedInterfaces : InstanceProfileDiskSupportedInterfaces struct +type InstanceProfileDiskSupportedInterfaces struct { + // The disk interface used for attaching the disk. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + 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"` +} + +// Constants associated with the InstanceProfileDiskSupportedInterfaces.Default property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + InstanceProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" + InstanceProfileDiskSupportedInterfacesDefaultVirtioBlkConst = "virtio_blk" +) + +// Constants associated with the InstanceProfileDiskSupportedInterfaces.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSupportedInterfacesTypeEnumConst = "enum" +) + +// Constants associated with the InstanceProfileDiskSupportedInterfaces.Values property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + InstanceProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" + InstanceProfileDiskSupportedInterfacesValuesVirtioBlkConst = "virtio_blk" +) + +// UnmarshalInstanceProfileDiskSupportedInterfaces unmarshals an instance of InstanceProfileDiskSupportedInterfaces from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpu : InstanceProfileGpu struct +// Models which "extend" this model: +// - InstanceProfileGpuFixed +// - InstanceProfileGpuRange +// - InstanceProfileGpuEnum +// - InstanceProfileGpuDependent +type InstanceProfileGpu 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 InstanceProfileGpu.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuTypeFixedConst = "fixed" +) + +func (*InstanceProfileGpu) isaInstanceProfileGpu() bool { + return true +} + +type InstanceProfileGpuIntf interface { + isaInstanceProfileGpu() bool +} + +// UnmarshalInstanceProfileGpu unmarshals an instance of InstanceProfileGpu from the specified map of raw messages. +func UnmarshalInstanceProfileGpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpu) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuManufacturer : InstanceProfileGpuManufacturer struct +type InstanceProfileGpuManufacturer struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The possible GPU manufacturer(s) for an instance with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuManufacturer.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuManufacturerTypeEnumConst = "enum" +) + +// UnmarshalInstanceProfileGpuManufacturer unmarshals an instance of InstanceProfileGpuManufacturer from the specified map of raw messages. +func UnmarshalInstanceProfileGpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuManufacturer) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemory : InstanceProfileGpuMemory struct +// Models which "extend" this model: +// - InstanceProfileGpuMemoryFixed +// - InstanceProfileGpuMemoryRange +// - InstanceProfileGpuMemoryEnum +// - InstanceProfileGpuMemoryDependent +type InstanceProfileGpuMemory 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 InstanceProfileGpuMemory.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryTypeFixedConst = "fixed" +) + +func (*InstanceProfileGpuMemory) isaInstanceProfileGpuMemory() bool { + return true +} + +type InstanceProfileGpuMemoryIntf interface { + isaInstanceProfileGpuMemory() bool +} + +// UnmarshalInstanceProfileGpuMemory unmarshals an instance of InstanceProfileGpuMemory from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuModel : InstanceProfileGpuModel struct +type InstanceProfileGpuModel struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The possible GPU model(s) for an instance with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuModel.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuModelTypeEnumConst = "enum" +) + +// UnmarshalInstanceProfileGpuModel unmarshals an instance of InstanceProfileGpuModel from the specified map of raw messages. +func UnmarshalInstanceProfileGpuModel(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuModel) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileIdentity : Identifies an instance profile by a unique property. +// Models which "extend" this model: +// - InstanceProfileIdentityByName +// - InstanceProfileIdentityByHref +type InstanceProfileIdentity struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name,omitempty"` + + // The URL for this virtual server instance profile. + Href *string `json:"href,omitempty"` +} + +func (*InstanceProfileIdentity) isaInstanceProfileIdentity() bool { + return true +} + +type InstanceProfileIdentityIntf interface { + isaInstanceProfileIdentity() bool +} + +// UnmarshalInstanceProfileIdentity unmarshals an instance of InstanceProfileIdentity from the specified map of raw messages. +func UnmarshalInstanceProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemory : InstanceProfileMemory struct +// Models which "extend" this model: +// - InstanceProfileMemoryFixed +// - InstanceProfileMemoryRange +// - InstanceProfileMemoryEnum +// - InstanceProfileMemoryDependent +type InstanceProfileMemory 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 InstanceProfileMemory.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryTypeFixedConst = "fixed" +) + +func (*InstanceProfileMemory) isaInstanceProfileMemory() bool { + return true +} + +type InstanceProfileMemoryIntf interface { + isaInstanceProfileMemory() bool +} + +// UnmarshalInstanceProfileMemory unmarshals an instance of InstanceProfileMemory from the specified map of raw messages. +func UnmarshalInstanceProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNumaCount : InstanceProfileNumaCount struct +// Models which "extend" this model: +// - InstanceProfileNumaCountFixed +// - InstanceProfileNumaCountDependent +type InstanceProfileNumaCount struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` +} + +// Constants associated with the InstanceProfileNumaCount.Type property. +// The type for this profile field. +const ( + InstanceProfileNumaCountTypeFixedConst = "fixed" +) + +func (*InstanceProfileNumaCount) isaInstanceProfileNumaCount() bool { + return true +} + +type InstanceProfileNumaCountIntf interface { + isaInstanceProfileNumaCount() bool +} + +// UnmarshalInstanceProfileNumaCount unmarshals an instance of InstanceProfileNumaCount from the specified map of raw messages. +func UnmarshalInstanceProfileNumaCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNumaCount) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkAttachmentCount : InstanceProfileNetworkAttachmentCount struct +// Models which "extend" this model: +// - InstanceProfileNetworkAttachmentCountRange +// - InstanceProfileNetworkAttachmentCountDependent +type InstanceProfileNetworkAttachmentCount 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 InstanceProfileNetworkAttachmentCount.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkAttachmentCountTypeRangeConst = "range" +) + +func (*InstanceProfileNetworkAttachmentCount) isaInstanceProfileNetworkAttachmentCount() bool { + return true +} + +type InstanceProfileNetworkAttachmentCountIntf interface { + isaInstanceProfileNetworkAttachmentCount() bool +} + +// UnmarshalInstanceProfileNetworkAttachmentCount unmarshals an instance of InstanceProfileNetworkAttachmentCount from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkAttachmentCount) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkInterfaceCount : InstanceProfileNetworkInterfaceCount struct +// Models which "extend" this model: +// - InstanceProfileNetworkInterfaceCountRange +// - InstanceProfileNetworkInterfaceCountDependent +type InstanceProfileNetworkInterfaceCount 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 InstanceProfileNetworkInterfaceCount.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkInterfaceCountTypeRangeConst = "range" +) + +func (*InstanceProfileNetworkInterfaceCount) isaInstanceProfileNetworkInterfaceCount() bool { + return true +} + +type InstanceProfileNetworkInterfaceCountIntf interface { + isaInstanceProfileNetworkInterfaceCount() bool +} + +// UnmarshalInstanceProfileNetworkInterfaceCount unmarshals an instance of InstanceProfileNetworkInterfaceCount from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkInterfaceCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkInterfaceCount) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileOsArchitecture : InstanceProfileOsArchitecture struct +type InstanceProfileOsArchitecture struct { + // The default OS architecture for an instance 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 an instance with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileOsArchitecture.Type property. +// The type for this profile field. +const ( + InstanceProfileOsArchitectureTypeEnumConst = "enum" +) + +// UnmarshalInstanceProfileOsArchitecture unmarshals an instance of InstanceProfileOsArchitecture from the specified map of raw messages. +func UnmarshalInstanceProfileOsArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileOsArchitecture) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfilePortSpeed : InstanceProfilePortSpeed struct +// Models which "extend" this model: +// - InstanceProfilePortSpeedFixed +// - InstanceProfilePortSpeedDependent +type InstanceProfilePortSpeed struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` +} + +// Constants associated with the InstanceProfilePortSpeed.Type property. +// The type for this profile field. +const ( + InstanceProfilePortSpeedTypeFixedConst = "fixed" +) + +func (*InstanceProfilePortSpeed) isaInstanceProfilePortSpeed() bool { + return true +} + +type InstanceProfilePortSpeedIntf interface { + isaInstanceProfilePortSpeed() bool +} + +// UnmarshalInstanceProfilePortSpeed unmarshals an instance of InstanceProfilePortSpeed from the specified map of raw messages. +func UnmarshalInstanceProfilePortSpeed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfilePortSpeed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileReference : InstanceProfileReference struct +type InstanceProfileReference struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstanceProfileReference.ResourceType property. +// The resource type. +const ( + InstanceProfileReferenceResourceTypeInstanceProfileConst = "instance_profile" +) + +// UnmarshalInstanceProfileReference unmarshals an instance of InstanceProfileReference from the specified map of raw messages. +func UnmarshalInstanceProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileReservationTerms : InstanceProfileReservationTerms struct +type InstanceProfileReservationTerms struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported committed use terms for a reservation using this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileReservationTerms.Type property. +// The type for this profile field. +const ( + InstanceProfileReservationTermsTypeEnumConst = "enum" +) + +// Constants associated with the InstanceProfileReservationTerms.Values property. +const ( + InstanceProfileReservationTermsValuesOneYearConst = "one_year" + InstanceProfileReservationTermsValuesThreeYearConst = "three_year" +) + +// UnmarshalInstanceProfileReservationTerms unmarshals an instance of InstanceProfileReservationTerms from the specified map of raw messages. +func UnmarshalInstanceProfileReservationTerms(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileReservationTerms) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpu : InstanceProfileVcpu struct +// Models which "extend" this model: +// - InstanceProfileVcpuFixed +// - InstanceProfileVcpuRange +// - InstanceProfileVcpuEnum +// - InstanceProfileVcpuDependent +type InstanceProfileVcpu 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 InstanceProfileVcpu.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuTypeFixedConst = "fixed" +) + +func (*InstanceProfileVcpu) isaInstanceProfileVcpu() bool { + return true +} + +type InstanceProfileVcpuIntf interface { + isaInstanceProfileVcpu() bool +} + +// UnmarshalInstanceProfileVcpu unmarshals an instance of InstanceProfileVcpu from the specified map of raw messages. +func UnmarshalInstanceProfileVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpu) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuArchitecture : InstanceProfileVcpuArchitecture struct +type InstanceProfileVcpuArchitecture struct { + // The default VCPU architecture for an instance with this profile. + Default *string `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The VCPU architecture for an instance with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuArchitecture.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuArchitectureTypeFixedConst = "fixed" +) + +// UnmarshalInstanceProfileVcpuArchitecture unmarshals an instance of InstanceProfileVcpuArchitecture from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuArchitecture) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuManufacturer : InstanceProfileVcpuManufacturer struct +type InstanceProfileVcpuManufacturer struct { + // The default VCPU manufacturer for an instance with this profile. + Default *string `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The VCPU manufacturer for an instance with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuManufacturer.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuManufacturerTypeFixedConst = "fixed" +) + +// UnmarshalInstanceProfileVcpuManufacturer unmarshals an instance of InstanceProfileVcpuManufacturer from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuManufacturer) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidth : InstanceProfileVolumeBandwidth struct +// Models which "extend" this model: +// - InstanceProfileVolumeBandwidthFixed +// - InstanceProfileVolumeBandwidthRange +// - InstanceProfileVolumeBandwidthEnum +// - InstanceProfileVolumeBandwidthDependent +type InstanceProfileVolumeBandwidth 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 InstanceProfileVolumeBandwidth.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthTypeFixedConst = "fixed" +) + +func (*InstanceProfileVolumeBandwidth) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +type InstanceProfileVolumeBandwidthIntf interface { + isaInstanceProfileVolumeBandwidth() bool +} + +// UnmarshalInstanceProfileVolumeBandwidth unmarshals an instance of InstanceProfileVolumeBandwidth from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidth) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototype : InstancePrototype struct +// Models which "extend" this model: +// - InstancePrototypeInstanceByImage +// - InstancePrototypeInstanceByCatalogOffering +// - InstancePrototypeInstanceByVolume +// - InstancePrototypeInstanceBySourceSnapshot +// - InstancePrototypeInstanceBySourceTemplate +type InstancePrototype struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not + // subsequently managed. Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + // property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The metadata service configuration. + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this + // virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change + // in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,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 amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network + // attachments or instance network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` +} + +func (*InstancePrototype) isaInstancePrototype() bool { + return true +} + +type InstancePrototypeIntf interface { + isaInstancePrototype() bool +} + +// UnmarshalInstancePrototype unmarshals an instance of InstancePrototype from the specified map of raw messages. +func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceReference : InstanceReference struct +type InstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceReference unmarshals an instance of InstanceReference from the specified map of raw messages. +func UnmarshalInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceReferenceDeleted unmarshals an instance of InstanceReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceReservationAffinity : InstanceReservationAffinity struct +type InstanceReservationAffinity struct { + // The reservation affinity policy to use for this virtual server instance: + // - `disabled`: Reservations will not be used + // - `manual`: Reservations in `pool` are available for use. + Policy *string `json:"policy" validate:"required"` + + // The pool of reservations available for use by this virtual server instance. + Pool []ReservationReference `json:"pool" validate:"required"` +} + +// Constants associated with the InstanceReservationAffinity.Policy property. +// The reservation affinity policy to use for this virtual server instance: +// - `disabled`: Reservations will not be used +// - `manual`: Reservations in `pool` are available for use. +const ( + InstanceReservationAffinityPolicyDisabledConst = "disabled" + InstanceReservationAffinityPolicyManualConst = "manual" +) + +// UnmarshalInstanceReservationAffinity unmarshals an instance of InstanceReservationAffinity from the specified map of raw messages. +func UnmarshalInstanceReservationAffinity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceReservationAffinity) + err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceReservationAffinityPatch : InstanceReservationAffinityPatch struct +type InstanceReservationAffinityPatch struct { + // The reservation affinity policy to use for this virtual server instance: + // - `disabled`: Reservations will not be used + // - `manual`: Reservations in `pool` are available for use. + Policy *string `json:"policy,omitempty"` + + // The pool of reservations available for use by this virtual server instance, replacing the existing pool of + // reservations. + // + // Specified reservations must have a `status` of `active`, and have the same `profile` and + // `zone` as this virtual server instance. + // + // If `policy` is `manual`, a pool must be specified with at least one reservation. If + // `policy` is `disabled` and a pool is specified, it must be empty. + Pool []ReservationIdentityIntf `json:"pool,omitempty"` +} + +// Constants associated with the InstanceReservationAffinityPatch.Policy property. +// The reservation affinity policy to use for this virtual server instance: +// - `disabled`: Reservations will not be used +// - `manual`: Reservations in `pool` are available for use. +const ( + InstanceReservationAffinityPatchPolicyDisabledConst = "disabled" + InstanceReservationAffinityPatchPolicyManualConst = "manual" +) + +// UnmarshalInstanceReservationAffinityPatch unmarshals an instance of InstanceReservationAffinityPatch from the specified map of raw messages. +func UnmarshalInstanceReservationAffinityPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceReservationAffinityPatch) + err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceReservationAffinityPrototype : InstanceReservationAffinityPrototype struct +type InstanceReservationAffinityPrototype struct { + // The reservation affinity policy to use for this virtual server instance: + // - `disabled`: Reservations will not be used + // - `manual`: Reservations in `pool` will be available for use + // + // The policy will default to `manual` if `pool` is not empty, and `disabled` otherwise. + Policy *string `json:"policy,omitempty"` + + // The pool of reservations available for use by this virtual server instance. + // + // Specified reservations must have a `status` of `active`, and have the same `profile` and + // `zone` as this virtual server instance. + // + // If `policy` is `manual`, a pool must be specified with at least one reservation. If + // `policy` is `disabled` and a pool is specified, it must be empty. + Pool []ReservationIdentityIntf `json:"pool,omitempty"` +} + +// Constants associated with the InstanceReservationAffinityPrototype.Policy property. +// The reservation affinity policy to use for this virtual server instance: +// - `disabled`: Reservations will not be used +// - `manual`: Reservations in `pool` will be available for use +// +// The policy will default to `manual` if `pool` is not empty, and `disabled` otherwise. +const ( + InstanceReservationAffinityPrototypePolicyDisabledConst = "disabled" + InstanceReservationAffinityPrototypePolicyManualConst = "manual" +) + +// UnmarshalInstanceReservationAffinityPrototype unmarshals an instance of InstanceReservationAffinityPrototype from the specified map of raw messages. +func UnmarshalInstanceReservationAffinityPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceReservationAffinityPrototype) + err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceStatusReason : InstanceStatusReason struct +type InstanceStatusReason struct { + // A snake case string succinctly identifying the status reason. + 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 InstanceStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + InstanceStatusReasonCodeCannotStartConst = "cannot_start" + InstanceStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" + InstanceStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" + InstanceStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" + InstanceStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" + InstanceStatusReasonCodeCannotStartPlacementGroupConst = "cannot_start_placement_group" + InstanceStatusReasonCodeCannotStartReservationCapacityConst = "cannot_start_reservation_capacity" + InstanceStatusReasonCodeCannotStartReservationExpiredConst = "cannot_start_reservation_expired" + InstanceStatusReasonCodeCannotStartStorageConst = "cannot_start_storage" + InstanceStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" + InstanceStatusReasonCodeStoppedByHostFailureConst = "stopped_by_host_failure" + InstanceStatusReasonCodeStoppedForImageCreationConst = "stopped_for_image_creation" +) + +// UnmarshalInstanceStatusReason unmarshals an instance of InstanceStatusReason from the specified map of raw messages. +func UnmarshalInstanceStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplate : InstanceTemplate struct +// Models which "extend" this model: +// - InstanceTemplateInstanceByImageInstanceTemplateContext +// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext +// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext +type InstanceTemplate struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not + // subsequently managed. Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + // property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The metadata service configuration. + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this + // virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change + // in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network + // attachments or instance network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` +} + +func (*InstanceTemplate) isaInstanceTemplate() bool { + return true +} + +type InstanceTemplateIntf interface { + isaInstanceTemplate() bool +} + +// UnmarshalInstanceTemplate unmarshals an instance of InstanceTemplate from the specified map of raw messages. +func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplate) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateCollection : InstanceTemplateCollection struct +type InstanceTemplateCollection struct { + // A link to the first page of resources. + First *InstanceTemplateCollectionFirst `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"` + + // Collection of instance templates. + Templates []InstanceTemplateIntf `json:"templates" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceTemplateCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "templates", &obj.Templates, UnmarshalInstanceTemplate) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 { + 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 { + 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 +// - InstanceTemplateIdentityByHref +// - InstanceTemplateIdentityByCRN +type InstanceTemplateIdentity struct { + // The unique identifier for this instance template. + ID *string `json:"id,omitempty"` + + // The URL for this instance template. + Href *string `json:"href,omitempty"` + + // The CRN for this instance template. + CRN *string `json:"crn,omitempty"` +} + +func (*InstanceTemplateIdentity) isaInstanceTemplateIdentity() bool { + return true +} + +type InstanceTemplateIdentityIntf interface { + isaInstanceTemplateIdentity() bool +} + +// UnmarshalInstanceTemplateIdentity unmarshals an instance of InstanceTemplateIdentity from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceTemplatePatch unmarshals an instance of InstanceTemplatePatch from the specified map of raw messages. +func UnmarshalInstanceTemplatePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// InstanceTemplatePrototype : InstanceTemplatePrototype struct +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceTemplateByImage +// - InstanceTemplatePrototypeInstanceTemplateBySourceTemplate +// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot +// - InstanceTemplatePrototypeInstanceTemplateByCatalogOffering +type InstanceTemplatePrototype struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not + // subsequently managed. Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) + // property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The metadata service configuration. + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this + // virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change + // in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,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 amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network + // attachments or instance network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering version to use when provisioning this virtual server instance. + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account, subject to + // IAM policies. + // + // If specified, `image` must not be specified, and `source_template` must not have + // `image` specified. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` +} + +func (*InstanceTemplatePrototype) isaInstanceTemplatePrototype() bool { + return true +} + +type InstanceTemplatePrototypeIntf interface { + isaInstanceTemplatePrototype() bool +} + +// UnmarshalInstanceTemplatePrototype unmarshals an instance of InstanceTemplatePrototype from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototype) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateReference : InstanceTemplateReference struct +type InstanceTemplateReference struct { + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceTemplateReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceTemplateReference unmarshals an instance of InstanceTemplateReference from the specified map of raw messages. +func UnmarshalInstanceTemplateReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceTemplateReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type InstanceTemplateReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceTemplateReferenceDeleted unmarshals an instance of InstanceTemplateReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceTemplateReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceVcpu : The virtual server instance VCPU configuration. +type InstanceVcpu struct { + // The VCPU architecture. + Architecture *string `json:"architecture" validate:"required"` + + // The number of VCPUs assigned. + Count *int64 `json:"count" validate:"required"` + + // The VCPU manufacturer. + Manufacturer *string `json:"manufacturer" validate:"required"` +} + +// UnmarshalInstanceVcpu unmarshals an instance of InstanceVcpu from the specified map of raw messages. +func UnmarshalInstanceVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceVcpu) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Key : Key struct +type Key struct { + // The date and time that the key was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this key. + CRN *string `json:"crn" validate:"required"` + + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint" validate:"required"` + + // The URL for this key. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this key. + ID *string `json:"id" validate:"required"` + + // The length of this key (in bits). + Length *int64 `json:"length" validate:"required"` + + // The name for this key. The name must not be used by another key in the region. If unspecified, the name will be a + // hyphenated list of randomly-selected words. + Name *string `json:"name" validate:"required"` + + // The public SSH key, consisting of two space-separated fields: the algorithm name, and the base64-encoded key. + PublicKey *string `json:"public_key" validate:"required"` + + // The resource group for this key. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The crypto-system used by this key. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the Key.Type property. +// The crypto-system used by this key. +const ( + KeyTypeEd25519Const = "ed25519" + KeyTypeRsaConst = "rsa" +) + +// UnmarshalKey unmarshals an instance of Key from the specified map of raw messages. +func UnmarshalKey(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Key) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "length", &obj.Length) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "public_key", &obj.PublicKey) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyCollection : KeyCollection struct +type KeyCollection struct { + // A link to the first page of resources. + First *KeyCollectionFirst `json:"first" validate:"required"` + + // Collection of keys. + Keys []Key `json:"keys" 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 *KeyCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKey) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalKeyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *KeyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentity : Identifies a key by a unique property. +// Models which "extend" this model: +// - KeyIdentityByID +// - KeyIdentityByCRN +// - KeyIdentityByHref +// - KeyIdentityByFingerprint +type KeyIdentity struct { + // The unique identifier for this key. + ID *string `json:"id,omitempty"` + + // The CRN for this key. + CRN *string `json:"crn,omitempty"` + + // The URL for this key. + Href *string `json:"href,omitempty"` + + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint,omitempty"` +} + +func (*KeyIdentity) isaKeyIdentity() bool { + return true +} + +type KeyIdentityIntf interface { + isaKeyIdentity() bool +} + +// UnmarshalKeyIdentity unmarshals an instance of KeyIdentity from the specified map of raw messages. +func UnmarshalKeyIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyPatch : KeyPatch struct +type KeyPatch struct { + // The name for this key. The name must not be used by another key in the region. + Name *string `json:"name,omitempty"` +} + +// UnmarshalKeyPatch unmarshals an instance of KeyPatch from the specified map of raw messages. +func UnmarshalKeyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// KeyReference : KeyReference struct +type KeyReference struct { + // The CRN for this key. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *KeyReferenceDeleted `json:"deleted,omitempty"` + + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint" validate:"required"` + + // The URL for this key. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this key. + ID *string `json:"id" validate:"required"` + + // The name for this key. The name is unique across all keys in the region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalKeyReference unmarshals an instance of KeyReference from the specified map of raw messages. +func UnmarshalKeyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalKeyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type KeyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalKeyReferenceDeleted unmarshals an instance of KeyReferenceDeleted from the specified map of raw messages. +func UnmarshalKeyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LegacyCloudObjectStorageBucketIdentity : Identifies a Cloud Object Storage bucket by a unique property. +// Models which "extend" this model: +// - LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName +type LegacyCloudObjectStorageBucketIdentity struct { + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name,omitempty"` +} + +func (*LegacyCloudObjectStorageBucketIdentity) isaLegacyCloudObjectStorageBucketIdentity() bool { + return true +} + +type LegacyCloudObjectStorageBucketIdentityIntf interface { + isaLegacyCloudObjectStorageBucketIdentity() bool +} + +// UnmarshalLegacyCloudObjectStorageBucketIdentity unmarshals an instance of LegacyCloudObjectStorageBucketIdentity from the specified map of raw messages. +func UnmarshalLegacyCloudObjectStorageBucketIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LegacyCloudObjectStorageBucketIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LegacyCloudObjectStorageBucketReference : LegacyCloudObjectStorageBucketReference struct +type LegacyCloudObjectStorageBucketReference struct { + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalLegacyCloudObjectStorageBucketReference unmarshals an instance of LegacyCloudObjectStorageBucketReference from the specified map of raw messages. +func UnmarshalLegacyCloudObjectStorageBucketReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LegacyCloudObjectStorageBucketReference) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ListBackupPoliciesOptions : The ListBackupPolicies options. +type ListBackupPoliciesOptions 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"` + + // 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 + Headers map[string]string +} + +// NewListBackupPoliciesOptions : Instantiate ListBackupPoliciesOptions +func (*VpcV1) NewListBackupPoliciesOptions() *ListBackupPoliciesOptions { + return &ListBackupPoliciesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListBackupPoliciesOptions) SetStart(start string) *ListBackupPoliciesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBackupPoliciesOptions) SetLimit(limit int64) *ListBackupPoliciesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListBackupPoliciesOptions) SetResourceGroupID(resourceGroupID string) *ListBackupPoliciesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListBackupPoliciesOptions) SetName(name string) *ListBackupPoliciesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetTag : Allow user to set Tag +func (_options *ListBackupPoliciesOptions) SetTag(tag string) *ListBackupPoliciesOptions { + _options.Tag = core.StringPtr(tag) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBackupPoliciesOptions) SetHeaders(param map[string]string) *ListBackupPoliciesOptions { + options.Headers = param + return options +} + +// ListBackupPolicyJobsOptions : The ListBackupPolicyJobs options. +type ListBackupPolicyJobsOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // Filters the collection to backup policy jobs with a `status` property matching the specified value. + Status *string `json:"status,omitempty"` + + // Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified + // identifier. + BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` + + // 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"` + + // 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 backup policy jobs with a `source.id` property matching the specified identifier. + SourceID *string `json:"source.id,omitempty"` + + // Filters the collection to backup policy jobs with an item in the `target_snapshots` property with an `id` property + // matching the specified identifier. + TargetSnapshotsID *string `json:"target_snapshots[].id,omitempty"` + + // Filters the collection to backup policy jobs with an item in the `target_snapshots` property with a `crn` property + // matching the specified CRN. + TargetSnapshotsCRN *string `json:"target_snapshots[].crn,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListBackupPolicyJobsOptions.Status property. +// Filters the collection to backup policy jobs with a `status` property matching the specified value. +const ( + ListBackupPolicyJobsOptionsStatusFailedConst = "failed" + ListBackupPolicyJobsOptionsStatusRunningConst = "running" + ListBackupPolicyJobsOptionsStatusSucceededConst = "succeeded" +) + +// Constants associated with the ListBackupPolicyJobsOptions.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 ( + ListBackupPolicyJobsOptionsSortCreatedAtConst = "created_at" + ListBackupPolicyJobsOptionsSortNameConst = "name" +) + +// NewListBackupPolicyJobsOptions : Instantiate ListBackupPolicyJobsOptions +func (*VpcV1) NewListBackupPolicyJobsOptions(backupPolicyID string) *ListBackupPolicyJobsOptions { + return &ListBackupPolicyJobsOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *ListBackupPolicyJobsOptions) SetBackupPolicyID(backupPolicyID string) *ListBackupPolicyJobsOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetStatus : Allow user to set Status +func (_options *ListBackupPolicyJobsOptions) SetStatus(status string) *ListBackupPolicyJobsOptions { + _options.Status = core.StringPtr(status) + return _options +} + +// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID +func (_options *ListBackupPolicyJobsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListBackupPolicyJobsOptions { + _options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListBackupPolicyJobsOptions) SetStart(start string) *ListBackupPolicyJobsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBackupPolicyJobsOptions) SetLimit(limit int64) *ListBackupPolicyJobsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListBackupPolicyJobsOptions) SetSort(sort string) *ListBackupPolicyJobsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetSourceID : Allow user to set SourceID +func (_options *ListBackupPolicyJobsOptions) SetSourceID(sourceID string) *ListBackupPolicyJobsOptions { + _options.SourceID = core.StringPtr(sourceID) + return _options +} + +// SetTargetSnapshotsID : Allow user to set TargetSnapshotsID +func (_options *ListBackupPolicyJobsOptions) SetTargetSnapshotsID(targetSnapshotsID string) *ListBackupPolicyJobsOptions { + _options.TargetSnapshotsID = core.StringPtr(targetSnapshotsID) + return _options +} + +// SetTargetSnapshotsCRN : Allow user to set TargetSnapshotsCRN +func (_options *ListBackupPolicyJobsOptions) SetTargetSnapshotsCRN(targetSnapshotsCRN string) *ListBackupPolicyJobsOptions { + _options.TargetSnapshotsCRN = core.StringPtr(targetSnapshotsCRN) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBackupPolicyJobsOptions) SetHeaders(param map[string]string) *ListBackupPolicyJobsOptions { + options.Headers = param + return options +} + +// ListBackupPolicyPlansOptions : The ListBackupPolicyPlans options. +type ListBackupPolicyPlansOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // 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 + Headers map[string]string +} + +// NewListBackupPolicyPlansOptions : Instantiate ListBackupPolicyPlansOptions +func (*VpcV1) NewListBackupPolicyPlansOptions(backupPolicyID string) *ListBackupPolicyPlansOptions { + return &ListBackupPolicyPlansOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *ListBackupPolicyPlansOptions) SetBackupPolicyID(backupPolicyID string) *ListBackupPolicyPlansOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListBackupPolicyPlansOptions) SetName(name string) *ListBackupPolicyPlansOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBackupPolicyPlansOptions) SetHeaders(param map[string]string) *ListBackupPolicyPlansOptions { + options.Headers = param + return options +} + +// ListBareMetalServerDisksOptions : The ListBareMetalServerDisks options. +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 + Headers map[string]string +} + +// NewListBareMetalServerDisksOptions : Instantiate ListBareMetalServerDisksOptions +func (*VpcV1) NewListBareMetalServerDisksOptions(bareMetalServerID string) *ListBareMetalServerDisksOptions { + return &ListBareMetalServerDisksOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerDisksOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerDisksOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerDisksOptions) SetHeaders(param map[string]string) *ListBareMetalServerDisksOptions { + options.Headers = param + return options +} + +// ListBareMetalServerNetworkAttachmentsOptions : The ListBareMetalServerNetworkAttachments options. +type ListBareMetalServerNetworkAttachmentsOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_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 +} + +// NewListBareMetalServerNetworkAttachmentsOptions : Instantiate ListBareMetalServerNetworkAttachmentsOptions +func (*VpcV1) NewListBareMetalServerNetworkAttachmentsOptions(bareMetalServerID string) *ListBareMetalServerNetworkAttachmentsOptions { + return &ListBareMetalServerNetworkAttachmentsOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkAttachmentsOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetStart(start string) *ListBareMetalServerNetworkAttachmentsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetLimit(limit int64) *ListBareMetalServerNetworkAttachmentsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkAttachmentsOptions { + options.Headers = param + return options +} + +// ListBareMetalServerNetworkInterfaceFloatingIpsOptions : The ListBareMetalServerNetworkInterfaceFloatingIps options. +type ListBareMetalServerNetworkInterfaceFloatingIpsOptions 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="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBareMetalServerNetworkInterfaceFloatingIpsOptions : Instantiate ListBareMetalServerNetworkInterfaceFloatingIpsOptions +func (*VpcV1) NewListBareMetalServerNetworkInterfaceFloatingIpsOptions(bareMetalServerID string, networkInterfaceID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { + return &ListBareMetalServerNetworkInterfaceFloatingIpsOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { + options.Headers = param + return options +} + +// ListBareMetalServerNetworkInterfaceIpsOptions : The ListBareMetalServerNetworkInterfaceIps options. +type ListBareMetalServerNetworkInterfaceIpsOptions 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="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListBareMetalServerNetworkInterfaceIpsOptions : Instantiate ListBareMetalServerNetworkInterfaceIpsOptions +func (*VpcV1) NewListBareMetalServerNetworkInterfaceIpsOptions(bareMetalServerID string, networkInterfaceID string) *ListBareMetalServerNetworkInterfaceIpsOptions { + return &ListBareMetalServerNetworkInterfaceIpsOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerNetworkInterfaceIpsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfaceIpsOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *ListBareMetalServerNetworkInterfaceIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListBareMetalServerNetworkInterfaceIpsOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfaceIpsOptions { + options.Headers = param + return options +} + +// ListBareMetalServerNetworkInterfacesOptions : The ListBareMetalServerNetworkInterfaces options. +type ListBareMetalServerNetworkInterfacesOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_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 +} + +// NewListBareMetalServerNetworkInterfacesOptions : Instantiate ListBareMetalServerNetworkInterfacesOptions +func (*VpcV1) NewListBareMetalServerNetworkInterfacesOptions(bareMetalServerID string) *ListBareMetalServerNetworkInterfacesOptions { + return &ListBareMetalServerNetworkInterfacesOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *ListBareMetalServerNetworkInterfacesOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfacesOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListBareMetalServerNetworkInterfacesOptions) SetStart(start string) *ListBareMetalServerNetworkInterfacesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBareMetalServerNetworkInterfacesOptions) SetLimit(limit int64) *ListBareMetalServerNetworkInterfacesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfacesOptions { + options.Headers = param + return options +} + +// ListBareMetalServerProfilesOptions : The ListBareMetalServerProfiles options. +type ListBareMetalServerProfilesOptions 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 +} + +// NewListBareMetalServerProfilesOptions : Instantiate ListBareMetalServerProfilesOptions +func (*VpcV1) NewListBareMetalServerProfilesOptions() *ListBareMetalServerProfilesOptions { + return &ListBareMetalServerProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListBareMetalServerProfilesOptions) SetStart(start string) *ListBareMetalServerProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBareMetalServerProfilesOptions) SetLimit(limit int64) *ListBareMetalServerProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServerProfilesOptions) SetHeaders(param map[string]string) *ListBareMetalServerProfilesOptions { + options.Headers = param + return options +} + +// ListBareMetalServersOptions : The ListBareMetalServers options. +type ListBareMetalServersOptions 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"` + + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // 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 + Headers map[string]string +} + +// NewListBareMetalServersOptions : Instantiate ListBareMetalServersOptions +func (*VpcV1) NewListBareMetalServersOptions() *ListBareMetalServersOptions { + return &ListBareMetalServersOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListBareMetalServersOptions) SetStart(start string) *ListBareMetalServersOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListBareMetalServersOptions) SetLimit(limit int64) *ListBareMetalServersOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListBareMetalServersOptions) SetResourceGroupID(resourceGroupID string) *ListBareMetalServersOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListBareMetalServersOptions) SetName(name string) *ListBareMetalServersOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListBareMetalServersOptions) SetVPCID(vpcID string) *ListBareMetalServersOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListBareMetalServersOptions) SetVPCCRN(vpcCRN string) *ListBareMetalServersOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListBareMetalServersOptions) SetVPCName(vpcName string) *ListBareMetalServersOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListBareMetalServersOptions) SetHeaders(param map[string]string) *ListBareMetalServersOptions { + 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 + Headers map[string]string +} + +// NewListDedicatedHostDisksOptions : Instantiate ListDedicatedHostDisksOptions +func (*VpcV1) NewListDedicatedHostDisksOptions(dedicatedHostID string) *ListDedicatedHostDisksOptions { + return &ListDedicatedHostDisksOptions{ + DedicatedHostID: core.StringPtr(dedicatedHostID), + } +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (_options *ListDedicatedHostDisksOptions) SetDedicatedHostID(dedicatedHostID string) *ListDedicatedHostDisksOptions { + _options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostDisksOptions) SetHeaders(param map[string]string) *ListDedicatedHostDisksOptions { + options.Headers = param + return options +} + +// ListDedicatedHostGroupsOptions : The ListDedicatedHostGroups options. +type ListDedicatedHostGroupsOptions 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 `zone.name` property matching the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // 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 + Headers map[string]string +} + +// NewListDedicatedHostGroupsOptions : Instantiate ListDedicatedHostGroupsOptions +func (*VpcV1) NewListDedicatedHostGroupsOptions() *ListDedicatedHostGroupsOptions { + return &ListDedicatedHostGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListDedicatedHostGroupsOptions) SetStart(start string) *ListDedicatedHostGroupsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListDedicatedHostGroupsOptions) SetLimit(limit int64) *ListDedicatedHostGroupsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListDedicatedHostGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListDedicatedHostGroupsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *ListDedicatedHostGroupsOptions) SetZoneName(zoneName string) *ListDedicatedHostGroupsOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListDedicatedHostGroupsOptions) SetName(name string) *ListDedicatedHostGroupsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostGroupsOptions) SetHeaders(param map[string]string) *ListDedicatedHostGroupsOptions { + options.Headers = param + return options +} + +// ListDedicatedHostProfilesOptions : The ListDedicatedHostProfiles options. +type ListDedicatedHostProfilesOptions 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 +} + +// NewListDedicatedHostProfilesOptions : Instantiate ListDedicatedHostProfilesOptions +func (*VpcV1) NewListDedicatedHostProfilesOptions() *ListDedicatedHostProfilesOptions { + return &ListDedicatedHostProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListDedicatedHostProfilesOptions) SetStart(start string) *ListDedicatedHostProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListDedicatedHostProfilesOptions) SetLimit(limit int64) *ListDedicatedHostProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostProfilesOptions) SetHeaders(param map[string]string) *ListDedicatedHostProfilesOptions { + options.Headers = param + return options +} + +// ListDedicatedHostsOptions : The ListDedicatedHosts options. +type ListDedicatedHostsOptions struct { + // Filters the collection to dedicated hosts with a `group.id` property matching the specified identifier. + DedicatedHostGroupID *string `json:"dedicated_host_group.id,omitempty"` + + // 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 `zone.name` property matching the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // 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 + Headers map[string]string +} + +// NewListDedicatedHostsOptions : Instantiate ListDedicatedHostsOptions +func (*VpcV1) NewListDedicatedHostsOptions() *ListDedicatedHostsOptions { + return &ListDedicatedHostsOptions{} +} + +// SetDedicatedHostGroupID : Allow user to set DedicatedHostGroupID +func (_options *ListDedicatedHostsOptions) SetDedicatedHostGroupID(dedicatedHostGroupID string) *ListDedicatedHostsOptions { + _options.DedicatedHostGroupID = core.StringPtr(dedicatedHostGroupID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListDedicatedHostsOptions) SetStart(start string) *ListDedicatedHostsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListDedicatedHostsOptions) SetLimit(limit int64) *ListDedicatedHostsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListDedicatedHostsOptions) SetResourceGroupID(resourceGroupID string) *ListDedicatedHostsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *ListDedicatedHostsOptions) SetZoneName(zoneName string) *ListDedicatedHostsOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListDedicatedHostsOptions) SetName(name string) *ListDedicatedHostsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostsOptions) SetHeaders(param map[string]string) *ListDedicatedHostsOptions { + options.Headers = param + return options +} + +// ListEndpointGatewayIpsOptions : The ListEndpointGatewayIps options. +type ListEndpointGatewayIpsOptions struct { + // The endpoint gateway identifier. + EndpointGatewayID *string `json:"endpoint_gateway_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"` + + // 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 ListEndpointGatewayIpsOptions.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 ( + ListEndpointGatewayIpsOptionsSortAddressConst = "address" + ListEndpointGatewayIpsOptionsSortCreatedAtConst = "created_at" + ListEndpointGatewayIpsOptionsSortNameConst = "name" +) + +// NewListEndpointGatewayIpsOptions : Instantiate ListEndpointGatewayIpsOptions +func (*VpcV1) NewListEndpointGatewayIpsOptions(endpointGatewayID string) *ListEndpointGatewayIpsOptions { + return &ListEndpointGatewayIpsOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + } +} + +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (_options *ListEndpointGatewayIpsOptions) SetEndpointGatewayID(endpointGatewayID string) *ListEndpointGatewayIpsOptions { + _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListEndpointGatewayIpsOptions) SetStart(start string) *ListEndpointGatewayIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListEndpointGatewayIpsOptions) SetLimit(limit int64) *ListEndpointGatewayIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListEndpointGatewayIpsOptions) SetSort(sort string) *ListEndpointGatewayIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListEndpointGatewayIpsOptions) SetHeaders(param map[string]string) *ListEndpointGatewayIpsOptions { + options.Headers = param + return options +} + +// ListEndpointGatewaysOptions : The ListEndpointGateways options. +type ListEndpointGatewaysOptions struct { + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // 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 `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to endpoint gateways with an `allow_dns_resolution_binding` property matching the specified + // value. + AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListEndpointGatewaysOptions : Instantiate ListEndpointGatewaysOptions +func (*VpcV1) NewListEndpointGatewaysOptions() *ListEndpointGatewaysOptions { + return &ListEndpointGatewaysOptions{} +} + +// SetName : Allow user to set Name +func (_options *ListEndpointGatewaysOptions) SetName(name string) *ListEndpointGatewaysOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListEndpointGatewaysOptions) SetStart(start string) *ListEndpointGatewaysOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListEndpointGatewaysOptions) SetLimit(limit int64) *ListEndpointGatewaysOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListEndpointGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListEndpointGatewaysOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListEndpointGatewaysOptions) SetVPCID(vpcID string) *ListEndpointGatewaysOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListEndpointGatewaysOptions) SetVPCCRN(vpcCRN string) *ListEndpointGatewaysOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListEndpointGatewaysOptions) SetVPCName(vpcName string) *ListEndpointGatewaysOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetAllowDnsResolutionBinding : Allow user to set AllowDnsResolutionBinding +func (_options *ListEndpointGatewaysOptions) SetAllowDnsResolutionBinding(allowDnsResolutionBinding bool) *ListEndpointGatewaysOptions { + _options.AllowDnsResolutionBinding = core.BoolPtr(allowDnsResolutionBinding) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListEndpointGatewaysOptions) SetHeaders(param map[string]string) *ListEndpointGatewaysOptions { + options.Headers = param + return options +} + +// ListFloatingIpsOptions : The ListFloatingIps options. +type ListFloatingIpsOptions 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"` + + // 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 resources with a `target.id` property matching the specified identifier. + TargetID *string `json:"target.id,omitempty"` + + // Filters the collection to resources with a `target.crn` property matching the specified CRN. + TargetCRN *string `json:"target.crn,omitempty"` + + // Filters the collection to resources with a `target.name` property matching the exact specified name. + TargetName *string `json:"target.name,omitempty"` + + // 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 + Headers map[string]string +} + +// Constants associated with the ListFloatingIpsOptions.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 ( + ListFloatingIpsOptionsSortCreatedAtConst = "created_at" + ListFloatingIpsOptionsSortNameConst = "name" +) + +// NewListFloatingIpsOptions : Instantiate ListFloatingIpsOptions +func (*VpcV1) NewListFloatingIpsOptions() *ListFloatingIpsOptions { + return &ListFloatingIpsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListFloatingIpsOptions) SetStart(start string) *ListFloatingIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListFloatingIpsOptions) SetLimit(limit int64) *ListFloatingIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListFloatingIpsOptions) SetResourceGroupID(resourceGroupID string) *ListFloatingIpsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListFloatingIpsOptions) SetSort(sort string) *ListFloatingIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetTargetID : Allow user to set TargetID +func (_options *ListFloatingIpsOptions) SetTargetID(targetID string) *ListFloatingIpsOptions { + _options.TargetID = core.StringPtr(targetID) + return _options +} + +// SetTargetCRN : Allow user to set TargetCRN +func (_options *ListFloatingIpsOptions) SetTargetCRN(targetCRN string) *ListFloatingIpsOptions { + _options.TargetCRN = core.StringPtr(targetCRN) + return _options +} + +// SetTargetName : Allow user to set TargetName +func (_options *ListFloatingIpsOptions) SetTargetName(targetName string) *ListFloatingIpsOptions { + _options.TargetName = core.StringPtr(targetName) + return _options +} + +// SetTargetResourceType : Allow user to set TargetResourceType +func (_options *ListFloatingIpsOptions) SetTargetResourceType(targetResourceType string) *ListFloatingIpsOptions { + _options.TargetResourceType = core.StringPtr(targetResourceType) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListFloatingIpsOptions) SetHeaders(param map[string]string) *ListFloatingIpsOptions { + options.Headers = param + return options +} + +// ListFlowLogCollectorsOptions : The ListFlowLogCollectors options. +type ListFlowLogCollectorsOptions 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"` + + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to resources with a `target.id` property matching the specified identifier. + TargetID *string `json:"target.id,omitempty"` + + // 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 + Headers map[string]string +} + +// NewListFlowLogCollectorsOptions : Instantiate ListFlowLogCollectorsOptions +func (*VpcV1) NewListFlowLogCollectorsOptions() *ListFlowLogCollectorsOptions { + return &ListFlowLogCollectorsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListFlowLogCollectorsOptions) SetStart(start string) *ListFlowLogCollectorsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListFlowLogCollectorsOptions) SetLimit(limit int64) *ListFlowLogCollectorsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListFlowLogCollectorsOptions) SetResourceGroupID(resourceGroupID string) *ListFlowLogCollectorsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListFlowLogCollectorsOptions) SetName(name string) *ListFlowLogCollectorsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListFlowLogCollectorsOptions) SetVPCID(vpcID string) *ListFlowLogCollectorsOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListFlowLogCollectorsOptions) SetVPCCRN(vpcCRN string) *ListFlowLogCollectorsOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListFlowLogCollectorsOptions) SetVPCName(vpcName string) *ListFlowLogCollectorsOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetTargetID : Allow user to set TargetID +func (_options *ListFlowLogCollectorsOptions) SetTargetID(targetID string) *ListFlowLogCollectorsOptions { + _options.TargetID = core.StringPtr(targetID) + return _options +} + +// SetTargetResourceType : Allow user to set TargetResourceType +func (_options *ListFlowLogCollectorsOptions) SetTargetResourceType(targetResourceType string) *ListFlowLogCollectorsOptions { + _options.TargetResourceType = core.StringPtr(targetResourceType) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListFlowLogCollectorsOptions) SetHeaders(param map[string]string) *ListFlowLogCollectorsOptions { + options.Headers = param + return options +} + +// ListIkePoliciesOptions : The ListIkePolicies options. +type ListIkePoliciesOptions 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 +} + +// NewListIkePoliciesOptions : Instantiate ListIkePoliciesOptions +func (*VpcV1) NewListIkePoliciesOptions() *ListIkePoliciesOptions { + return &ListIkePoliciesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListIkePoliciesOptions) SetStart(start string) *ListIkePoliciesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListIkePoliciesOptions) SetLimit(limit int64) *ListIkePoliciesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIkePoliciesOptions) SetHeaders(param map[string]string) *ListIkePoliciesOptions { + options.Headers = param + return options +} + +// ListIkePolicyConnectionsOptions : The ListIkePolicyConnections options. +type ListIkePolicyConnectionsOptions struct { + // The IKE policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListIkePolicyConnectionsOptions : Instantiate ListIkePolicyConnectionsOptions +func (*VpcV1) NewListIkePolicyConnectionsOptions(id string) *ListIkePolicyConnectionsOptions { + return &ListIkePolicyConnectionsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListIkePolicyConnectionsOptions) SetID(id string) *ListIkePolicyConnectionsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIkePolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIkePolicyConnectionsOptions { + options.Headers = param + return options +} + +// ListImageExportJobsOptions : The ListImageExportJobs options. +type ListImageExportJobsOptions struct { + // The image identifier. + ImageID *string `json:"image_id" validate:"required,ne="` + + // 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 + Headers map[string]string +} + +// NewListImageExportJobsOptions : Instantiate ListImageExportJobsOptions +func (*VpcV1) NewListImageExportJobsOptions(imageID string) *ListImageExportJobsOptions { + return &ListImageExportJobsOptions{ + ImageID: core.StringPtr(imageID), + } +} + +// SetImageID : Allow user to set ImageID +func (_options *ListImageExportJobsOptions) SetImageID(imageID string) *ListImageExportJobsOptions { + _options.ImageID = core.StringPtr(imageID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListImageExportJobsOptions) SetName(name string) *ListImageExportJobsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListImageExportJobsOptions) SetHeaders(param map[string]string) *ListImageExportJobsOptions { + options.Headers = param + return options +} + +// ListImagesOptions : The ListImages options. +type ListImagesOptions 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"` + + // Filters the collection to images with a `status` property matching one of the specified comma-separated values. + Status []string `json:"status,omitempty"` + + // Filters the collection to images with a `visibility` property matching the specified value. + Visibility *string `json:"visibility,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListImagesOptions.Status property. +const ( + ListImagesOptionsStatusAvailableConst = "available" + ListImagesOptionsStatusDeletingConst = "deleting" + ListImagesOptionsStatusDeprecatedConst = "deprecated" + ListImagesOptionsStatusFailedConst = "failed" + ListImagesOptionsStatusObsoleteConst = "obsolete" + ListImagesOptionsStatusPendingConst = "pending" + ListImagesOptionsStatusUnusableConst = "unusable" +) + +// Constants associated with the ListImagesOptions.Visibility property. +// Filters the collection to images with a `visibility` property matching the specified value. +const ( + ListImagesOptionsVisibilityPrivateConst = "private" + ListImagesOptionsVisibilityPublicConst = "public" +) + +// NewListImagesOptions : Instantiate ListImagesOptions +func (*VpcV1) NewListImagesOptions() *ListImagesOptions { + return &ListImagesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListImagesOptions) SetStart(start string) *ListImagesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListImagesOptions) SetLimit(limit int64) *ListImagesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListImagesOptions) SetResourceGroupID(resourceGroupID string) *ListImagesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListImagesOptions) SetName(name string) *ListImagesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetStatus : Allow user to set Status +func (_options *ListImagesOptions) SetStatus(status []string) *ListImagesOptions { + _options.Status = status + return _options +} + +// SetVisibility : Allow user to set Visibility +func (_options *ListImagesOptions) SetVisibility(visibility string) *ListImagesOptions { + _options.Visibility = core.StringPtr(visibility) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListImagesOptions) SetHeaders(param map[string]string) *ListImagesOptions { + 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 + Headers map[string]string +} + +// NewListInstanceDisksOptions : Instantiate ListInstanceDisksOptions +func (*VpcV1) NewListInstanceDisksOptions(instanceID string) *ListInstanceDisksOptions { + return &ListInstanceDisksOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceDisksOptions) SetInstanceID(instanceID string) *ListInstanceDisksOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceDisksOptions) SetHeaders(param map[string]string) *ListInstanceDisksOptions { + options.Headers = param + return options +} + +// ListInstanceGroupManagerActionsOptions : The ListInstanceGroupManagerActions options. +type ListInstanceGroupManagerActionsOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_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 +} + +// NewListInstanceGroupManagerActionsOptions : Instantiate ListInstanceGroupManagerActionsOptions +func (*VpcV1) NewListInstanceGroupManagerActionsOptions(instanceGroupID string, instanceGroupManagerID string) *ListInstanceGroupManagerActionsOptions { + return &ListInstanceGroupManagerActionsOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *ListInstanceGroupManagerActionsOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagerActionsOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *ListInstanceGroupManagerActionsOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *ListInstanceGroupManagerActionsOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupManagerActionsOptions) SetStart(start string) *ListInstanceGroupManagerActionsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupManagerActionsOptions) SetLimit(limit int64) *ListInstanceGroupManagerActionsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupManagerActionsOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagerActionsOptions { + options.Headers = param + return options +} + +// ListInstanceGroupManagerPoliciesOptions : The ListInstanceGroupManagerPolicies options. +type ListInstanceGroupManagerPoliciesOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_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 +} + +// NewListInstanceGroupManagerPoliciesOptions : Instantiate ListInstanceGroupManagerPoliciesOptions +func (*VpcV1) NewListInstanceGroupManagerPoliciesOptions(instanceGroupID string, instanceGroupManagerID string) *ListInstanceGroupManagerPoliciesOptions { + return &ListInstanceGroupManagerPoliciesOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *ListInstanceGroupManagerPoliciesOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagerPoliciesOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *ListInstanceGroupManagerPoliciesOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *ListInstanceGroupManagerPoliciesOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupManagerPoliciesOptions) SetStart(start string) *ListInstanceGroupManagerPoliciesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupManagerPoliciesOptions) SetLimit(limit int64) *ListInstanceGroupManagerPoliciesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupManagerPoliciesOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagerPoliciesOptions { + options.Headers = param + return options +} + +// ListInstanceGroupManagersOptions : The ListInstanceGroupManagers options. +type ListInstanceGroupManagersOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_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 +} + +// NewListInstanceGroupManagersOptions : Instantiate ListInstanceGroupManagersOptions +func (*VpcV1) NewListInstanceGroupManagersOptions(instanceGroupID string) *ListInstanceGroupManagersOptions { + return &ListInstanceGroupManagersOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *ListInstanceGroupManagersOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagersOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupManagersOptions) SetStart(start string) *ListInstanceGroupManagersOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupManagersOptions) SetLimit(limit int64) *ListInstanceGroupManagersOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupManagersOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagersOptions { + options.Headers = param + return options +} + +// ListInstanceGroupMembershipsOptions : The ListInstanceGroupMemberships options. +type ListInstanceGroupMembershipsOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_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 +} + +// NewListInstanceGroupMembershipsOptions : Instantiate ListInstanceGroupMembershipsOptions +func (*VpcV1) NewListInstanceGroupMembershipsOptions(instanceGroupID string) *ListInstanceGroupMembershipsOptions { + return &ListInstanceGroupMembershipsOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *ListInstanceGroupMembershipsOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupMembershipsOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupMembershipsOptions) SetStart(start string) *ListInstanceGroupMembershipsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupMembershipsOptions) SetLimit(limit int64) *ListInstanceGroupMembershipsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupMembershipsOptions) SetHeaders(param map[string]string) *ListInstanceGroupMembershipsOptions { + options.Headers = param + return options +} + +// ListInstanceGroupsOptions : The ListInstanceGroups options. +type ListInstanceGroupsOptions 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 +} + +// NewListInstanceGroupsOptions : Instantiate ListInstanceGroupsOptions +func (*VpcV1) NewListInstanceGroupsOptions() *ListInstanceGroupsOptions { + return &ListInstanceGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceGroupsOptions) SetStart(start string) *ListInstanceGroupsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceGroupsOptions) SetLimit(limit int64) *ListInstanceGroupsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupsOptions) SetHeaders(param map[string]string) *ListInstanceGroupsOptions { + options.Headers = param + return options +} + +// ListInstanceNetworkAttachmentsOptions : The ListInstanceNetworkAttachments options. +type ListInstanceNetworkAttachmentsOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceNetworkAttachmentsOptions : Instantiate ListInstanceNetworkAttachmentsOptions +func (*VpcV1) NewListInstanceNetworkAttachmentsOptions(instanceID string) *ListInstanceNetworkAttachmentsOptions { + return &ListInstanceNetworkAttachmentsOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceNetworkAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkAttachmentsOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkAttachmentsOptions { + options.Headers = param + return options +} + +// ListInstanceNetworkInterfaceFloatingIpsOptions : The ListInstanceNetworkInterfaceFloatingIps options. +type ListInstanceNetworkInterfaceFloatingIpsOptions 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="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceNetworkInterfaceFloatingIpsOptions : Instantiate ListInstanceNetworkInterfaceFloatingIpsOptions +func (*VpcV1) NewListInstanceNetworkInterfaceFloatingIpsOptions(instanceID string, networkInterfaceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { + return &ListInstanceNetworkInterfaceFloatingIpsOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfaceFloatingIpsOptions { + options.Headers = param + return options +} + +// ListInstanceNetworkInterfaceIpsOptions : The ListInstanceNetworkInterfaceIps options. +type ListInstanceNetworkInterfaceIpsOptions 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="` + + // 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 +} + +// NewListInstanceNetworkInterfaceIpsOptions : Instantiate ListInstanceNetworkInterfaceIpsOptions +func (*VpcV1) NewListInstanceNetworkInterfaceIpsOptions(instanceID string, networkInterfaceID string) *ListInstanceNetworkInterfaceIpsOptions { + return &ListInstanceNetworkInterfaceIpsOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceNetworkInterfaceIpsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfaceIpsOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *ListInstanceNetworkInterfaceIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListInstanceNetworkInterfaceIpsOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListInstanceNetworkInterfaceIpsOptions) SetStart(start string) *ListInstanceNetworkInterfaceIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstanceNetworkInterfaceIpsOptions) SetLimit(limit int64) *ListInstanceNetworkInterfaceIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfaceIpsOptions { + options.Headers = param + return options +} + +// ListInstanceNetworkInterfacesOptions : The ListInstanceNetworkInterfaces options. +type ListInstanceNetworkInterfacesOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceNetworkInterfacesOptions : Instantiate ListInstanceNetworkInterfacesOptions +func (*VpcV1) NewListInstanceNetworkInterfacesOptions(instanceID string) *ListInstanceNetworkInterfacesOptions { + return &ListInstanceNetworkInterfacesOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceNetworkInterfacesOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfacesOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfacesOptions { + options.Headers = param + return options +} + +// ListInstanceProfilesOptions : The ListInstanceProfiles options. +type ListInstanceProfilesOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceProfilesOptions : Instantiate ListInstanceProfilesOptions +func (*VpcV1) NewListInstanceProfilesOptions() *ListInstanceProfilesOptions { + return &ListInstanceProfilesOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceProfilesOptions) SetHeaders(param map[string]string) *ListInstanceProfilesOptions { + options.Headers = param + return options +} + +// ListInstanceTemplatesOptions : The ListInstanceTemplates options. +type ListInstanceTemplatesOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceTemplatesOptions : Instantiate ListInstanceTemplatesOptions +func (*VpcV1) NewListInstanceTemplatesOptions() *ListInstanceTemplatesOptions { + return &ListInstanceTemplatesOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceTemplatesOptions) SetHeaders(param map[string]string) *ListInstanceTemplatesOptions { + options.Headers = param + return options +} + +// ListInstanceVolumeAttachmentsOptions : The ListInstanceVolumeAttachments options. +type ListInstanceVolumeAttachmentsOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceVolumeAttachmentsOptions : Instantiate ListInstanceVolumeAttachmentsOptions +func (*VpcV1) NewListInstanceVolumeAttachmentsOptions(instanceID string) *ListInstanceVolumeAttachmentsOptions { + return &ListInstanceVolumeAttachmentsOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *ListInstanceVolumeAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceVolumeAttachmentsOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceVolumeAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceVolumeAttachmentsOptions { + options.Headers = param + return options +} + +// ListInstancesOptions : The ListInstances options. +type ListInstancesOptions 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"` + + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to instances with a `dedicated_host.id` property matching the specified identifier. + DedicatedHostID *string `json:"dedicated_host.id,omitempty"` + + // Filters the collection to instances with a `dedicated_host.crn` property matching the specified CRN. + DedicatedHostCRN *string `json:"dedicated_host.crn,omitempty"` + + // Filters the collection to instances with a `dedicated_host.name` property matching the exact specified name. + DedicatedHostName *string `json:"dedicated_host.name,omitempty"` + + // Filters the collection to instances with a `placement_target.id` property matching the specified placement group + // identifier. + PlacementGroupID *string `json:"placement_group.id,omitempty"` + + // Filters the collection to instances with a `placement_target.crn` property matching the specified placement group + // CRN. + PlacementGroupCRN *string `json:"placement_group.crn,omitempty"` + + // Filters the collection to instances with a `placement_target.name` property matching the exact specified placement + // group name. + PlacementGroupName *string `json:"placement_group.name,omitempty"` + + // Filters the collection to instances with a `reservation.id` property matching the specified identifier. + ReservationID *string `json:"reservation.id,omitempty"` + + // Filters the collection to instances with a `reservation.crn` property matching the specified CRN. + ReservationCRN *string `json:"reservation.crn,omitempty"` + + // Filters the collection to resources with a `reservation.name` property matching the exact specified name. + ReservationName *string `json:"reservation.name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstancesOptions : Instantiate ListInstancesOptions +func (*VpcV1) NewListInstancesOptions() *ListInstancesOptions { + return &ListInstancesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListInstancesOptions) SetStart(start string) *ListInstancesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListInstancesOptions) SetLimit(limit int64) *ListInstancesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListInstancesOptions) SetResourceGroupID(resourceGroupID string) *ListInstancesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListInstancesOptions) SetName(name string) *ListInstancesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListInstancesOptions) SetVPCID(vpcID string) *ListInstancesOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListInstancesOptions) SetVPCCRN(vpcCRN string) *ListInstancesOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListInstancesOptions) SetVPCName(vpcName string) *ListInstancesOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (_options *ListInstancesOptions) SetDedicatedHostID(dedicatedHostID string) *ListInstancesOptions { + _options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return _options +} + +// SetDedicatedHostCRN : Allow user to set DedicatedHostCRN +func (_options *ListInstancesOptions) SetDedicatedHostCRN(dedicatedHostCRN string) *ListInstancesOptions { + _options.DedicatedHostCRN = core.StringPtr(dedicatedHostCRN) + return _options +} + +// SetDedicatedHostName : Allow user to set DedicatedHostName +func (_options *ListInstancesOptions) SetDedicatedHostName(dedicatedHostName string) *ListInstancesOptions { + _options.DedicatedHostName = core.StringPtr(dedicatedHostName) + return _options +} + +// SetPlacementGroupID : Allow user to set PlacementGroupID +func (_options *ListInstancesOptions) SetPlacementGroupID(placementGroupID string) *ListInstancesOptions { + _options.PlacementGroupID = core.StringPtr(placementGroupID) + return _options +} + +// SetPlacementGroupCRN : Allow user to set PlacementGroupCRN +func (_options *ListInstancesOptions) SetPlacementGroupCRN(placementGroupCRN string) *ListInstancesOptions { + _options.PlacementGroupCRN = core.StringPtr(placementGroupCRN) + return _options +} + +// SetPlacementGroupName : Allow user to set PlacementGroupName +func (_options *ListInstancesOptions) SetPlacementGroupName(placementGroupName string) *ListInstancesOptions { + _options.PlacementGroupName = core.StringPtr(placementGroupName) + return _options +} + +// SetReservationID : Allow user to set ReservationID +func (_options *ListInstancesOptions) SetReservationID(reservationID string) *ListInstancesOptions { + _options.ReservationID = core.StringPtr(reservationID) + return _options +} + +// SetReservationCRN : Allow user to set ReservationCRN +func (_options *ListInstancesOptions) SetReservationCRN(reservationCRN string) *ListInstancesOptions { + _options.ReservationCRN = core.StringPtr(reservationCRN) + return _options +} + +// SetReservationName : Allow user to set ReservationName +func (_options *ListInstancesOptions) SetReservationName(reservationName string) *ListInstancesOptions { + _options.ReservationName = core.StringPtr(reservationName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstancesOptions) SetHeaders(param map[string]string) *ListInstancesOptions { + options.Headers = param + return options +} + +// ListIpsecPoliciesOptions : The ListIpsecPolicies options. +type ListIpsecPoliciesOptions 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 +} + +// NewListIpsecPoliciesOptions : Instantiate ListIpsecPoliciesOptions +func (*VpcV1) NewListIpsecPoliciesOptions() *ListIpsecPoliciesOptions { + return &ListIpsecPoliciesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListIpsecPoliciesOptions) SetStart(start string) *ListIpsecPoliciesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListIpsecPoliciesOptions) SetLimit(limit int64) *ListIpsecPoliciesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIpsecPoliciesOptions) SetHeaders(param map[string]string) *ListIpsecPoliciesOptions { + options.Headers = param + return options +} + +// ListIpsecPolicyConnectionsOptions : The ListIpsecPolicyConnections options. +type ListIpsecPolicyConnectionsOptions struct { + // The IPsec policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListIpsecPolicyConnectionsOptions : Instantiate ListIpsecPolicyConnectionsOptions +func (*VpcV1) NewListIpsecPolicyConnectionsOptions(id string) *ListIpsecPolicyConnectionsOptions { + return &ListIpsecPolicyConnectionsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListIpsecPolicyConnectionsOptions) SetID(id string) *ListIpsecPolicyConnectionsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIpsecPolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIpsecPolicyConnectionsOptions { + options.Headers = param + return options +} + +// ListKeysOptions : The ListKeys options. +type ListKeysOptions 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 +} + +// NewListKeysOptions : Instantiate ListKeysOptions +func (*VpcV1) NewListKeysOptions() *ListKeysOptions { + return &ListKeysOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListKeysOptions) SetStart(start string) *ListKeysOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListKeysOptions) SetLimit(limit int64) *ListKeysOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListKeysOptions) SetHeaders(param map[string]string) *ListKeysOptions { + options.Headers = param + return options +} + +// ListLoadBalancerListenerPoliciesOptions : The ListLoadBalancerListenerPolicies options. +type ListLoadBalancerListenerPoliciesOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerListenerPoliciesOptions : Instantiate ListLoadBalancerListenerPoliciesOptions +func (*VpcV1) NewListLoadBalancerListenerPoliciesOptions(loadBalancerID string, listenerID string) *ListLoadBalancerListenerPoliciesOptions { + return &ListLoadBalancerListenerPoliciesOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerListenerPoliciesOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenerPoliciesOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *ListLoadBalancerListenerPoliciesOptions) SetListenerID(listenerID string) *ListLoadBalancerListenerPoliciesOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerListenerPoliciesOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenerPoliciesOptions { + options.Headers = param + return options +} + +// ListLoadBalancerListenerPolicyRulesOptions : The ListLoadBalancerListenerPolicyRules options. +type ListLoadBalancerListenerPolicyRulesOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerListenerPolicyRulesOptions : Instantiate ListLoadBalancerListenerPolicyRulesOptions +func (*VpcV1) NewListLoadBalancerListenerPolicyRulesOptions(loadBalancerID string, listenerID string, policyID string) *ListLoadBalancerListenerPolicyRulesOptions { + return &ListLoadBalancerListenerPolicyRulesOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenerPolicyRulesOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetListenerID(listenerID string) *ListLoadBalancerListenerPolicyRulesOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetPolicyID(policyID string) *ListLoadBalancerListenerPolicyRulesOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerListenerPolicyRulesOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenerPolicyRulesOptions { + options.Headers = param + return options +} + +// ListLoadBalancerListenersOptions : The ListLoadBalancerListeners options. +type ListLoadBalancerListenersOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerListenersOptions : Instantiate ListLoadBalancerListenersOptions +func (*VpcV1) NewListLoadBalancerListenersOptions(loadBalancerID string) *ListLoadBalancerListenersOptions { + return &ListLoadBalancerListenersOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerListenersOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenersOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerListenersOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenersOptions { + options.Headers = param + return options +} + +// ListLoadBalancerPoolMembersOptions : The ListLoadBalancerPoolMembers options. +type ListLoadBalancerPoolMembersOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerPoolMembersOptions : Instantiate ListLoadBalancerPoolMembersOptions +func (*VpcV1) NewListLoadBalancerPoolMembersOptions(loadBalancerID string, poolID string) *ListLoadBalancerPoolMembersOptions { + return &ListLoadBalancerPoolMembersOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerPoolMembersOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerPoolMembersOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *ListLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *ListLoadBalancerPoolMembersOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ListLoadBalancerPoolMembersOptions { + options.Headers = param + return options +} + +// ListLoadBalancerPoolsOptions : The ListLoadBalancerPools options. +type ListLoadBalancerPoolsOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerPoolsOptions : Instantiate ListLoadBalancerPoolsOptions +func (*VpcV1) NewListLoadBalancerPoolsOptions(loadBalancerID string) *ListLoadBalancerPoolsOptions { + return &ListLoadBalancerPoolsOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ListLoadBalancerPoolsOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerPoolsOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerPoolsOptions) SetHeaders(param map[string]string) *ListLoadBalancerPoolsOptions { + options.Headers = param + return options +} + +// ListLoadBalancerProfilesOptions : The ListLoadBalancerProfiles options. +type ListLoadBalancerProfilesOptions 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 +} + +// NewListLoadBalancerProfilesOptions : Instantiate ListLoadBalancerProfilesOptions +func (*VpcV1) NewListLoadBalancerProfilesOptions() *ListLoadBalancerProfilesOptions { + return &ListLoadBalancerProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListLoadBalancerProfilesOptions) SetStart(start string) *ListLoadBalancerProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListLoadBalancerProfilesOptions) SetLimit(limit int64) *ListLoadBalancerProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerProfilesOptions) SetHeaders(param map[string]string) *ListLoadBalancerProfilesOptions { + options.Headers = param + return options +} + +// ListLoadBalancersOptions : The ListLoadBalancers options. +type ListLoadBalancersOptions 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 +} + +// NewListLoadBalancersOptions : Instantiate ListLoadBalancersOptions +func (*VpcV1) NewListLoadBalancersOptions() *ListLoadBalancersOptions { + return &ListLoadBalancersOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListLoadBalancersOptions) SetStart(start string) *ListLoadBalancersOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListLoadBalancersOptions) SetLimit(limit int64) *ListLoadBalancersOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancersOptions) SetHeaders(param map[string]string) *ListLoadBalancersOptions { + options.Headers = param + return options +} + +// ListNetworkACLRulesOptions : The ListNetworkACLRules options. +type ListNetworkACLRulesOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_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 rules with a `direction` property matching the specified value. + Direction *string `json:"direction,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListNetworkACLRulesOptions.Direction property. +// Filters the collection to rules with a `direction` property matching the specified value. +const ( + ListNetworkACLRulesOptionsDirectionInboundConst = "inbound" + ListNetworkACLRulesOptionsDirectionOutboundConst = "outbound" +) + +// NewListNetworkACLRulesOptions : Instantiate ListNetworkACLRulesOptions +func (*VpcV1) NewListNetworkACLRulesOptions(networkACLID string) *ListNetworkACLRulesOptions { + return &ListNetworkACLRulesOptions{ + NetworkACLID: core.StringPtr(networkACLID), + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *ListNetworkACLRulesOptions) SetNetworkACLID(networkACLID string) *ListNetworkACLRulesOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListNetworkACLRulesOptions) SetStart(start string) *ListNetworkACLRulesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListNetworkACLRulesOptions) SetLimit(limit int64) *ListNetworkACLRulesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetDirection : Allow user to set Direction +func (_options *ListNetworkACLRulesOptions) SetDirection(direction string) *ListNetworkACLRulesOptions { + _options.Direction = core.StringPtr(direction) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListNetworkACLRulesOptions) SetHeaders(param map[string]string) *ListNetworkACLRulesOptions { + options.Headers = param + return options +} + +// ListNetworkAclsOptions : The ListNetworkAcls options. +type ListNetworkAclsOptions 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListNetworkAclsOptions : Instantiate ListNetworkAclsOptions +func (*VpcV1) NewListNetworkAclsOptions() *ListNetworkAclsOptions { + return &ListNetworkAclsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListNetworkAclsOptions) SetStart(start string) *ListNetworkAclsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListNetworkAclsOptions) SetLimit(limit int64) *ListNetworkAclsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListNetworkAclsOptions) SetResourceGroupID(resourceGroupID string) *ListNetworkAclsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListNetworkAclsOptions) SetHeaders(param map[string]string) *ListNetworkAclsOptions { + options.Headers = param + return options +} + +// ListNetworkInterfaceFloatingIpsOptions : The ListNetworkInterfaceFloatingIps options. +type ListNetworkInterfaceFloatingIpsOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_network_interface_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"` + + // 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 + // `-name` sorts the collection by the `name` 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 ListNetworkInterfaceFloatingIpsOptions.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 +// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` +// property in ascending order. +const ( + ListNetworkInterfaceFloatingIpsOptionsSortAddressConst = "address" + ListNetworkInterfaceFloatingIpsOptionsSortNameConst = "name" +) + +// NewListNetworkInterfaceFloatingIpsOptions : Instantiate ListNetworkInterfaceFloatingIpsOptions +func (*VpcV1) NewListNetworkInterfaceFloatingIpsOptions(virtualNetworkInterfaceID string) *ListNetworkInterfaceFloatingIpsOptions { + return &ListNetworkInterfaceFloatingIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *ListNetworkInterfaceFloatingIpsOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetStart(start string) *ListNetworkInterfaceFloatingIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetLimit(limit int64) *ListNetworkInterfaceFloatingIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListNetworkInterfaceFloatingIpsOptions) SetSort(sort string) *ListNetworkInterfaceFloatingIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListNetworkInterfaceFloatingIpsOptions { + options.Headers = param + return options +} + +// ListOperatingSystemsOptions : The ListOperatingSystems options. +type ListOperatingSystemsOptions 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 +} + +// NewListOperatingSystemsOptions : Instantiate ListOperatingSystemsOptions +func (*VpcV1) NewListOperatingSystemsOptions() *ListOperatingSystemsOptions { + return &ListOperatingSystemsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListOperatingSystemsOptions) SetStart(start string) *ListOperatingSystemsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListOperatingSystemsOptions) SetLimit(limit int64) *ListOperatingSystemsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListOperatingSystemsOptions) SetHeaders(param map[string]string) *ListOperatingSystemsOptions { + options.Headers = param + return options +} + +// ListPlacementGroupsOptions : The ListPlacementGroups options. +type ListPlacementGroupsOptions 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 +} + +// NewListPlacementGroupsOptions : Instantiate ListPlacementGroupsOptions +func (*VpcV1) NewListPlacementGroupsOptions() *ListPlacementGroupsOptions { + return &ListPlacementGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListPlacementGroupsOptions) SetStart(start string) *ListPlacementGroupsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListPlacementGroupsOptions) SetLimit(limit int64) *ListPlacementGroupsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListPlacementGroupsOptions) SetHeaders(param map[string]string) *ListPlacementGroupsOptions { + options.Headers = param + return options +} + +// ListPublicGatewaysOptions : The ListPublicGateways options. +type ListPublicGatewaysOptions 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListPublicGatewaysOptions : Instantiate ListPublicGatewaysOptions +func (*VpcV1) NewListPublicGatewaysOptions() *ListPublicGatewaysOptions { + return &ListPublicGatewaysOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListPublicGatewaysOptions) SetStart(start string) *ListPublicGatewaysOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListPublicGatewaysOptions) SetLimit(limit int64) *ListPublicGatewaysOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListPublicGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListPublicGatewaysOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListPublicGatewaysOptions) SetHeaders(param map[string]string) *ListPublicGatewaysOptions { + options.Headers = param + return options +} + +// ListRegionZonesOptions : The ListRegionZones options. +type ListRegionZonesOptions struct { + // The region name. + RegionName *string `json:"region_name" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListRegionZonesOptions : Instantiate ListRegionZonesOptions +func (*VpcV1) NewListRegionZonesOptions(regionName string) *ListRegionZonesOptions { + return &ListRegionZonesOptions{ + RegionName: core.StringPtr(regionName), + } +} + +// SetRegionName : Allow user to set RegionName +func (_options *ListRegionZonesOptions) SetRegionName(regionName string) *ListRegionZonesOptions { + _options.RegionName = core.StringPtr(regionName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListRegionZonesOptions) SetHeaders(param map[string]string) *ListRegionZonesOptions { + options.Headers = param + return options +} + +// ListRegionsOptions : The ListRegions options. +type ListRegionsOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListRegionsOptions : Instantiate ListRegionsOptions +func (*VpcV1) NewListRegionsOptions() *ListRegionsOptions { + return &ListRegionsOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListRegionsOptions) SetHeaders(param map[string]string) *ListRegionsOptions { + options.Headers = param + return options +} + +// ListReservationsOptions : The ListReservations options. +type ListReservationsOptions 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 `name` property matching the exact specified name. + Name *string `json:"name,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 `zone.name` property matching the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListReservationsOptions : Instantiate ListReservationsOptions +func (*VpcV1) NewListReservationsOptions() *ListReservationsOptions { + return &ListReservationsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListReservationsOptions) SetStart(start string) *ListReservationsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListReservationsOptions) SetLimit(limit int64) *ListReservationsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListReservationsOptions) SetName(name string) *ListReservationsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListReservationsOptions) SetResourceGroupID(resourceGroupID string) *ListReservationsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *ListReservationsOptions) SetZoneName(zoneName string) *ListReservationsOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListReservationsOptions) SetHeaders(param map[string]string) *ListReservationsOptions { + options.Headers = param + return options +} + +// ListSecurityGroupRulesOptions : The ListSecurityGroupRules options. +type ListSecurityGroupRulesOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSecurityGroupRulesOptions : Instantiate ListSecurityGroupRulesOptions +func (*VpcV1) NewListSecurityGroupRulesOptions(securityGroupID string) *ListSecurityGroupRulesOptions { + return &ListSecurityGroupRulesOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *ListSecurityGroupRulesOptions) SetSecurityGroupID(securityGroupID string) *ListSecurityGroupRulesOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSecurityGroupRulesOptions) SetHeaders(param map[string]string) *ListSecurityGroupRulesOptions { + options.Headers = param + return options +} + +// ListSecurityGroupTargetsOptions : The ListSecurityGroupTargets options. +type ListSecurityGroupTargetsOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_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 +} + +// NewListSecurityGroupTargetsOptions : Instantiate ListSecurityGroupTargetsOptions +func (*VpcV1) NewListSecurityGroupTargetsOptions(securityGroupID string) *ListSecurityGroupTargetsOptions { + return &ListSecurityGroupTargetsOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *ListSecurityGroupTargetsOptions) SetSecurityGroupID(securityGroupID string) *ListSecurityGroupTargetsOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListSecurityGroupTargetsOptions) SetStart(start string) *ListSecurityGroupTargetsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSecurityGroupTargetsOptions) SetLimit(limit int64) *ListSecurityGroupTargetsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSecurityGroupTargetsOptions) SetHeaders(param map[string]string) *ListSecurityGroupTargetsOptions { + options.Headers = param + return options +} + +// ListSecurityGroupsOptions : The ListSecurityGroups options. +type ListSecurityGroupsOptions 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 `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // 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 + Headers map[string]string +} + +// NewListSecurityGroupsOptions : Instantiate ListSecurityGroupsOptions +func (*VpcV1) NewListSecurityGroupsOptions() *ListSecurityGroupsOptions { + return &ListSecurityGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListSecurityGroupsOptions) SetStart(start string) *ListSecurityGroupsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSecurityGroupsOptions) SetLimit(limit int64) *ListSecurityGroupsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListSecurityGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListSecurityGroupsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListSecurityGroupsOptions) SetVPCID(vpcID string) *ListSecurityGroupsOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListSecurityGroupsOptions) SetVPCCRN(vpcCRN string) *ListSecurityGroupsOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListSecurityGroupsOptions) SetVPCName(vpcName string) *ListSecurityGroupsOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSecurityGroupsOptions) SetHeaders(param map[string]string) *ListSecurityGroupsOptions { + options.Headers = param + return options +} + +// ListShareMountTargetsOptions : The ListShareMountTargets options. +type ListShareMountTargetsOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // 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 +} + +// NewListShareMountTargetsOptions : Instantiate ListShareMountTargetsOptions +func (*VpcV1) NewListShareMountTargetsOptions(shareID string) *ListShareMountTargetsOptions { + return &ListShareMountTargetsOptions{ + ShareID: core.StringPtr(shareID), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *ListShareMountTargetsOptions) SetShareID(shareID string) *ListShareMountTargetsOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListShareMountTargetsOptions) SetName(name string) *ListShareMountTargetsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListShareMountTargetsOptions) SetStart(start string) *ListShareMountTargetsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListShareMountTargetsOptions) SetLimit(limit int64) *ListShareMountTargetsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListShareMountTargetsOptions) SetHeaders(param map[string]string) *ListShareMountTargetsOptions { + options.Headers = param + return options +} + +// ListShareProfilesOptions : The ListShareProfiles options. +type ListShareProfilesOptions 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"` + + // 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 ListShareProfilesOptions.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 ( + ListShareProfilesOptionsSortCreatedAtConst = "created_at" + ListShareProfilesOptionsSortNameConst = "name" +) + +// NewListShareProfilesOptions : Instantiate ListShareProfilesOptions +func (*VpcV1) NewListShareProfilesOptions() *ListShareProfilesOptions { + return &ListShareProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListShareProfilesOptions) SetStart(start string) *ListShareProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListShareProfilesOptions) SetLimit(limit int64) *ListShareProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListShareProfilesOptions) SetSort(sort string) *ListShareProfilesOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListShareProfilesOptions) SetHeaders(param map[string]string) *ListShareProfilesOptions { + options.Headers = param + return options +} + +// ListSharesOptions : The ListShares options. +type ListSharesOptions 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 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 + Headers map[string]string +} + +// Constants associated with the ListSharesOptions.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 ( + ListSharesOptionsSortCreatedAtConst = "created_at" + ListSharesOptionsSortNameConst = "name" +) + +// Constants associated with the ListSharesOptions.ReplicationRole property. +// Filters the collection to file shares with a `replication_role` property matching the specified value. +const ( + ListSharesOptionsReplicationRoleNoneConst = "none" + ListSharesOptionsReplicationRoleReplicaConst = "replica" + ListSharesOptionsReplicationRoleSourceConst = "source" +) + +// NewListSharesOptions : Instantiate ListSharesOptions +func (*VpcV1) NewListSharesOptions() *ListSharesOptions { + return &ListSharesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListSharesOptions) SetStart(start string) *ListSharesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSharesOptions) SetLimit(limit int64) *ListSharesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListSharesOptions) SetResourceGroupID(resourceGroupID string) *ListSharesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListSharesOptions) SetName(name string) *ListSharesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListSharesOptions) SetSort(sort string) *ListSharesOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetReplicationRole : Allow user to set ReplicationRole +func (_options *ListSharesOptions) SetReplicationRole(replicationRole string) *ListSharesOptions { + _options.ReplicationRole = core.StringPtr(replicationRole) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSharesOptions) SetHeaders(param map[string]string) *ListSharesOptions { + options.Headers = param + return options +} + +// ListSnapshotClonesOptions : The ListSnapshotClones options. +type ListSnapshotClonesOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSnapshotClonesOptions : Instantiate ListSnapshotClonesOptions +func (*VpcV1) NewListSnapshotClonesOptions(id string) *ListSnapshotClonesOptions { + return &ListSnapshotClonesOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListSnapshotClonesOptions) SetID(id string) *ListSnapshotClonesOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSnapshotClonesOptions) SetHeaders(param map[string]string) *ListSnapshotClonesOptions { + options.Headers = param + return options +} + +// ListSnapshotConsistencyGroupsOptions : The ListSnapshotConsistencyGroups options. +type ListSnapshotConsistencyGroupsOptions 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 backup policy jobs with a `backup_policy_plan.id` property matching the specified + // identifier. + BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListSnapshotConsistencyGroupsOptions.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 ( + ListSnapshotConsistencyGroupsOptionsSortCreatedAtConst = "created_at" + ListSnapshotConsistencyGroupsOptionsSortNameConst = "name" +) + +// NewListSnapshotConsistencyGroupsOptions : Instantiate ListSnapshotConsistencyGroupsOptions +func (*VpcV1) NewListSnapshotConsistencyGroupsOptions() *ListSnapshotConsistencyGroupsOptions { + return &ListSnapshotConsistencyGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListSnapshotConsistencyGroupsOptions) SetStart(start string) *ListSnapshotConsistencyGroupsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSnapshotConsistencyGroupsOptions) SetLimit(limit int64) *ListSnapshotConsistencyGroupsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListSnapshotConsistencyGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListSnapshotConsistencyGroupsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListSnapshotConsistencyGroupsOptions) SetName(name string) *ListSnapshotConsistencyGroupsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListSnapshotConsistencyGroupsOptions) SetSort(sort string) *ListSnapshotConsistencyGroupsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID +func (_options *ListSnapshotConsistencyGroupsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListSnapshotConsistencyGroupsOptions { + _options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSnapshotConsistencyGroupsOptions) SetHeaders(param map[string]string) *ListSnapshotConsistencyGroupsOptions { + options.Headers = param + return options +} + +// ListSnapshotsOptions : The ListSnapshots options. +type ListSnapshotsOptions 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 an item in the `tags` property matching the exact specified tag. + Tag *string `json:"tag,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"` + + // Filters the collection to resources with a `source_volume.id` property matching the specified identifier. + SourceVolumeID *string `json:"source_volume.id,omitempty"` + + // Filters the collection to resources with a `source_volume.crn` property matching the specified CRN. + SourceVolumeCRN *string `json:"source_volume.crn,omitempty"` + + // Filters the collection to resources with a `source_image.id` property matching the specified identifier. + // + // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no + // source image or any existent source image, respectively. + SourceImageID *string `json:"source_image.id,omitempty"` + + // Filters the collection to resources with a `source_image.crn` property matching the specified CRN. + // + // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no + // source image or any existent source image, respectively. + SourceImageCRN *string `json:"source_image.crn,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 backup policy jobs with a `backup_policy_plan.id` property matching the specified + // identifier. + BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` + + // Filters the collection to snapshots with an item in the `copies` property with an `id` property matching the + // specified identifier. + CopiesID *string `json:"copies[].id,omitempty"` + + // Filters the collection to snapshots with an item in the `copies` property with a `name` property matching the exact + // specified name. + CopiesName *string `json:"copies[].name,omitempty"` + + // Filters the collection to snapshots with an item in the `copies` property with an `id` property matching the + // specified CRN. + CopiesCRN *string `json:"copies[].crn,omitempty"` + + // Filters the collection to snapshots with an item in the `copies` property with a + // `remote.region.name` property matching the exact specified name. + CopiesRemoteRegionName *string `json:"copies[].remote.region.name,omitempty"` + + // Filters the collection to resources with a `source_snapshot.id` property matching the specified identifier. + SourceSnapshotID *string `json:"source_snapshot.id,omitempty"` + + // Filters the collection to resources with a `source_snapshot.remote.region.name` property matching the exact + // specified name. + SourceSnapshotRemoteRegionName *string `json:"source_snapshot.remote.region.name,omitempty"` + + // Filters the collection to resources with a `source_volume.remote.region.name` property matching the exact specified + // name. + SourceVolumeRemoteRegionName *string `json:"source_volume.remote.region.name,omitempty"` + + // Filters the collection to resources with a `source_image.remote.region.name` property matching the exact specified + // name. + SourceImageRemoteRegionName *string `json:"source_image.remote.region.name,omitempty"` + + // Filters the collection to snapshots with an item in the `clones` property with a `zone.name` property matching the + // exact specified name. + ClonesZoneName *string `json:"clones[].zone.name,omitempty"` + + // Filters the collection to resources with a `snapshot_consistency_group.id` property matching the specified + // identifier. + SnapshotConsistencyGroupID *string `json:"snapshot_consistency_group.id,omitempty"` + + // Filters the collection to resources with a `snapshot_consistency_group.crn` property matching the specified + // identifier. + SnapshotConsistencyGroupCRN *string `json:"snapshot_consistency_group.crn,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListSnapshotsOptions.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 ( + ListSnapshotsOptionsSortCreatedAtConst = "created_at" + ListSnapshotsOptionsSortNameConst = "name" +) + +// NewListSnapshotsOptions : Instantiate ListSnapshotsOptions +func (*VpcV1) NewListSnapshotsOptions() *ListSnapshotsOptions { + return &ListSnapshotsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListSnapshotsOptions) SetStart(start string) *ListSnapshotsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSnapshotsOptions) SetLimit(limit int64) *ListSnapshotsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetTag : Allow user to set Tag +func (_options *ListSnapshotsOptions) SetTag(tag string) *ListSnapshotsOptions { + _options.Tag = core.StringPtr(tag) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListSnapshotsOptions) SetResourceGroupID(resourceGroupID string) *ListSnapshotsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListSnapshotsOptions) SetName(name string) *ListSnapshotsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetSourceVolumeID : Allow user to set SourceVolumeID +func (_options *ListSnapshotsOptions) SetSourceVolumeID(sourceVolumeID string) *ListSnapshotsOptions { + _options.SourceVolumeID = core.StringPtr(sourceVolumeID) + return _options +} + +// SetSourceVolumeCRN : Allow user to set SourceVolumeCRN +func (_options *ListSnapshotsOptions) SetSourceVolumeCRN(sourceVolumeCRN string) *ListSnapshotsOptions { + _options.SourceVolumeCRN = core.StringPtr(sourceVolumeCRN) + return _options +} + +// SetSourceImageID : Allow user to set SourceImageID +func (_options *ListSnapshotsOptions) SetSourceImageID(sourceImageID string) *ListSnapshotsOptions { + _options.SourceImageID = core.StringPtr(sourceImageID) + return _options +} + +// SetSourceImageCRN : Allow user to set SourceImageCRN +func (_options *ListSnapshotsOptions) SetSourceImageCRN(sourceImageCRN string) *ListSnapshotsOptions { + _options.SourceImageCRN = core.StringPtr(sourceImageCRN) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListSnapshotsOptions) SetSort(sort string) *ListSnapshotsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID +func (_options *ListSnapshotsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListSnapshotsOptions { + _options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID) + return _options +} + +// SetCopiesID : Allow user to set CopiesID +func (_options *ListSnapshotsOptions) SetCopiesID(copiesID string) *ListSnapshotsOptions { + _options.CopiesID = core.StringPtr(copiesID) + return _options +} + +// SetCopiesName : Allow user to set CopiesName +func (_options *ListSnapshotsOptions) SetCopiesName(copiesName string) *ListSnapshotsOptions { + _options.CopiesName = core.StringPtr(copiesName) + return _options +} + +// SetCopiesCRN : Allow user to set CopiesCRN +func (_options *ListSnapshotsOptions) SetCopiesCRN(copiesCRN string) *ListSnapshotsOptions { + _options.CopiesCRN = core.StringPtr(copiesCRN) + return _options +} + +// SetCopiesRemoteRegionName : Allow user to set CopiesRemoteRegionName +func (_options *ListSnapshotsOptions) SetCopiesRemoteRegionName(copiesRemoteRegionName string) *ListSnapshotsOptions { + _options.CopiesRemoteRegionName = core.StringPtr(copiesRemoteRegionName) + return _options +} + +// SetSourceSnapshotID : Allow user to set SourceSnapshotID +func (_options *ListSnapshotsOptions) SetSourceSnapshotID(sourceSnapshotID string) *ListSnapshotsOptions { + _options.SourceSnapshotID = core.StringPtr(sourceSnapshotID) + return _options +} + +// SetSourceSnapshotRemoteRegionName : Allow user to set SourceSnapshotRemoteRegionName +func (_options *ListSnapshotsOptions) SetSourceSnapshotRemoteRegionName(sourceSnapshotRemoteRegionName string) *ListSnapshotsOptions { + _options.SourceSnapshotRemoteRegionName = core.StringPtr(sourceSnapshotRemoteRegionName) + return _options +} + +// SetSourceVolumeRemoteRegionName : Allow user to set SourceVolumeRemoteRegionName +func (_options *ListSnapshotsOptions) SetSourceVolumeRemoteRegionName(sourceVolumeRemoteRegionName string) *ListSnapshotsOptions { + _options.SourceVolumeRemoteRegionName = core.StringPtr(sourceVolumeRemoteRegionName) + return _options +} + +// SetSourceImageRemoteRegionName : Allow user to set SourceImageRemoteRegionName +func (_options *ListSnapshotsOptions) SetSourceImageRemoteRegionName(sourceImageRemoteRegionName string) *ListSnapshotsOptions { + _options.SourceImageRemoteRegionName = core.StringPtr(sourceImageRemoteRegionName) + return _options +} + +// SetClonesZoneName : Allow user to set ClonesZoneName +func (_options *ListSnapshotsOptions) SetClonesZoneName(clonesZoneName string) *ListSnapshotsOptions { + _options.ClonesZoneName = core.StringPtr(clonesZoneName) + return _options +} + +// SetSnapshotConsistencyGroupID : Allow user to set SnapshotConsistencyGroupID +func (_options *ListSnapshotsOptions) SetSnapshotConsistencyGroupID(snapshotConsistencyGroupID string) *ListSnapshotsOptions { + _options.SnapshotConsistencyGroupID = core.StringPtr(snapshotConsistencyGroupID) + return _options +} + +// SetSnapshotConsistencyGroupCRN : Allow user to set SnapshotConsistencyGroupCRN +func (_options *ListSnapshotsOptions) SetSnapshotConsistencyGroupCRN(snapshotConsistencyGroupCRN string) *ListSnapshotsOptions { + _options.SnapshotConsistencyGroupCRN = core.StringPtr(snapshotConsistencyGroupCRN) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSnapshotsOptions) SetHeaders(param map[string]string) *ListSnapshotsOptions { + options.Headers = param + return options +} + +// ListSubnetReservedIpsOptions : The ListSubnetReservedIps options. +type ListSubnetReservedIpsOptions struct { + // The subnet identifier. + SubnetID *string `json:"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"` + + // 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 resources with a `target.id` property matching the specified identifier. + TargetID *string `json:"target.id,omitempty"` + + // Filters the collection to resources with a `target.crn` property matching the specified CRN. + TargetCRN *string `json:"target.crn,omitempty"` + + // Filters the collection to resources with a `target.name` property matching the exact specified name. + TargetName *string `json:"target.name,omitempty"` + + // 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 + Headers map[string]string +} + +// Constants associated with the ListSubnetReservedIpsOptions.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 ( + ListSubnetReservedIpsOptionsSortAddressConst = "address" + ListSubnetReservedIpsOptionsSortCreatedAtConst = "created_at" + ListSubnetReservedIpsOptionsSortNameConst = "name" +) + +// NewListSubnetReservedIpsOptions : Instantiate ListSubnetReservedIpsOptions +func (*VpcV1) NewListSubnetReservedIpsOptions(subnetID string) *ListSubnetReservedIpsOptions { + return &ListSubnetReservedIpsOptions{ + SubnetID: core.StringPtr(subnetID), + } +} + +// SetSubnetID : Allow user to set SubnetID +func (_options *ListSubnetReservedIpsOptions) SetSubnetID(subnetID string) *ListSubnetReservedIpsOptions { + _options.SubnetID = core.StringPtr(subnetID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListSubnetReservedIpsOptions) SetStart(start string) *ListSubnetReservedIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSubnetReservedIpsOptions) SetLimit(limit int64) *ListSubnetReservedIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListSubnetReservedIpsOptions) SetSort(sort string) *ListSubnetReservedIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetTargetID : Allow user to set TargetID +func (_options *ListSubnetReservedIpsOptions) SetTargetID(targetID string) *ListSubnetReservedIpsOptions { + _options.TargetID = core.StringPtr(targetID) + return _options +} + +// SetTargetCRN : Allow user to set TargetCRN +func (_options *ListSubnetReservedIpsOptions) SetTargetCRN(targetCRN string) *ListSubnetReservedIpsOptions { + _options.TargetCRN = core.StringPtr(targetCRN) + return _options +} + +// SetTargetName : Allow user to set TargetName +func (_options *ListSubnetReservedIpsOptions) SetTargetName(targetName string) *ListSubnetReservedIpsOptions { + _options.TargetName = core.StringPtr(targetName) + return _options +} + +// SetTargetResourceType : Allow user to set TargetResourceType +func (_options *ListSubnetReservedIpsOptions) SetTargetResourceType(targetResourceType string) *ListSubnetReservedIpsOptions { + _options.TargetResourceType = core.StringPtr(targetResourceType) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSubnetReservedIpsOptions) SetHeaders(param map[string]string) *ListSubnetReservedIpsOptions { + options.Headers = param + return options +} + +// ListSubnetsOptions : The ListSubnets options. +type ListSubnetsOptions 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 `zone.name` property matching the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to subnets with a `routing_table.id` property matching the specified identifier. + RoutingTableID *string `json:"routing_table.id,omitempty"` + + // 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 + Headers map[string]string +} + +// NewListSubnetsOptions : Instantiate ListSubnetsOptions +func (*VpcV1) NewListSubnetsOptions() *ListSubnetsOptions { + return &ListSubnetsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListSubnetsOptions) SetStart(start string) *ListSubnetsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSubnetsOptions) SetLimit(limit int64) *ListSubnetsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListSubnetsOptions) SetResourceGroupID(resourceGroupID string) *ListSubnetsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *ListSubnetsOptions) SetZoneName(zoneName string) *ListSubnetsOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListSubnetsOptions) SetVPCID(vpcID string) *ListSubnetsOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListSubnetsOptions) SetVPCCRN(vpcCRN string) *ListSubnetsOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListSubnetsOptions) SetVPCName(vpcName string) *ListSubnetsOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *ListSubnetsOptions) SetRoutingTableID(routingTableID string) *ListSubnetsOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetRoutingTableName : Allow user to set RoutingTableName +func (_options *ListSubnetsOptions) SetRoutingTableName(routingTableName string) *ListSubnetsOptions { + _options.RoutingTableName = core.StringPtr(routingTableName) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSubnetsOptions) SetHeaders(param map[string]string) *ListSubnetsOptions { + options.Headers = param + return options +} + +// ListVirtualNetworkInterfaceIpsOptions : The ListVirtualNetworkInterfaceIps options. +type ListVirtualNetworkInterfaceIpsOptions struct { + // The virtual network interface identifier. + VirtualNetworkInterfaceID *string `json:"virtual_network_interface_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"` + + // 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 + // `-name` sorts the collection by the `name` 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 ListVirtualNetworkInterfaceIpsOptions.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 +// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` +// property in ascending order. +const ( + ListVirtualNetworkInterfaceIpsOptionsSortAddressConst = "address" + ListVirtualNetworkInterfaceIpsOptionsSortNameConst = "name" +) + +// NewListVirtualNetworkInterfaceIpsOptions : Instantiate ListVirtualNetworkInterfaceIpsOptions +func (*VpcV1) NewListVirtualNetworkInterfaceIpsOptions(virtualNetworkInterfaceID string) *ListVirtualNetworkInterfaceIpsOptions { + return &ListVirtualNetworkInterfaceIpsOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *ListVirtualNetworkInterfaceIpsOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetStart(start string) *ListVirtualNetworkInterfaceIpsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetLimit(limit int64) *ListVirtualNetworkInterfaceIpsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVirtualNetworkInterfaceIpsOptions) SetSort(sort string) *ListVirtualNetworkInterfaceIpsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVirtualNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListVirtualNetworkInterfaceIpsOptions { + options.Headers = param + return options +} + +// ListVirtualNetworkInterfacesOptions : The ListVirtualNetworkInterfaces options. +type ListVirtualNetworkInterfacesOptions 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVirtualNetworkInterfacesOptions : Instantiate ListVirtualNetworkInterfacesOptions +func (*VpcV1) NewListVirtualNetworkInterfacesOptions() *ListVirtualNetworkInterfacesOptions { + return &ListVirtualNetworkInterfacesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListVirtualNetworkInterfacesOptions) SetStart(start string) *ListVirtualNetworkInterfacesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVirtualNetworkInterfacesOptions) SetLimit(limit int64) *ListVirtualNetworkInterfacesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListVirtualNetworkInterfacesOptions) SetResourceGroupID(resourceGroupID string) *ListVirtualNetworkInterfacesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVirtualNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListVirtualNetworkInterfacesOptions { + options.Headers = param + return options +} + +// ListVolumeProfilesOptions : The ListVolumeProfiles options. +type ListVolumeProfilesOptions 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 +} + +// NewListVolumeProfilesOptions : Instantiate ListVolumeProfilesOptions +func (*VpcV1) NewListVolumeProfilesOptions() *ListVolumeProfilesOptions { + return &ListVolumeProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListVolumeProfilesOptions) SetStart(start string) *ListVolumeProfilesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVolumeProfilesOptions) SetLimit(limit int64) *ListVolumeProfilesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVolumeProfilesOptions) SetHeaders(param map[string]string) *ListVolumeProfilesOptions { + options.Headers = param + return options +} + +// ListVolumesOptions : The ListVolumes options. +type ListVolumesOptions 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 `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // Filters the collection to volumes with an `attachment_state` property matching the specified value. + AttachmentState *string `json:"attachment_state,omitempty"` + + // Filters the collection to resources with an `encryption` property matching the specified value. + Encryption *string `json:"encryption,omitempty"` + + // Filters the collection to resources with an `operating_system.family` property matching the specified operating + // system family. + // + // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no + // operating system or any operating system, respectively. + OperatingSystemFamily *string `json:"operating_system.family,omitempty"` + + // Filters the collection to resources with an `operating_system.architecture` property matching the specified + // operating system architecture. + // + // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no + // operating system or any operating system, respectively. + OperatingSystemArchitecture *string `json:"operating_system.architecture,omitempty"` + + // Filters the collection to resources with a `zone.name` property matching the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // 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 + Headers map[string]string +} + +// Constants associated with the ListVolumesOptions.AttachmentState property. +// Filters the collection to volumes with an `attachment_state` property matching the specified value. +const ( + ListVolumesOptionsAttachmentStateAttachedConst = "attached" + ListVolumesOptionsAttachmentStateUnattachedConst = "unattached" + ListVolumesOptionsAttachmentStateUnusableConst = "unusable" +) + +// Constants associated with the ListVolumesOptions.Encryption property. +// Filters the collection to resources with an `encryption` property matching the specified value. +const ( + ListVolumesOptionsEncryptionProviderManagedConst = "provider_managed" + ListVolumesOptionsEncryptionUserManagedConst = "user_managed" +) + +// NewListVolumesOptions : Instantiate ListVolumesOptions +func (*VpcV1) NewListVolumesOptions() *ListVolumesOptions { + return &ListVolumesOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListVolumesOptions) SetStart(start string) *ListVolumesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVolumesOptions) SetLimit(limit int64) *ListVolumesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListVolumesOptions) SetName(name string) *ListVolumesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetAttachmentState : Allow user to set AttachmentState +func (_options *ListVolumesOptions) SetAttachmentState(attachmentState string) *ListVolumesOptions { + _options.AttachmentState = core.StringPtr(attachmentState) + return _options +} + +// SetEncryption : Allow user to set Encryption +func (_options *ListVolumesOptions) SetEncryption(encryption string) *ListVolumesOptions { + _options.Encryption = core.StringPtr(encryption) + return _options +} + +// SetOperatingSystemFamily : Allow user to set OperatingSystemFamily +func (_options *ListVolumesOptions) SetOperatingSystemFamily(operatingSystemFamily string) *ListVolumesOptions { + _options.OperatingSystemFamily = core.StringPtr(operatingSystemFamily) + return _options +} + +// SetOperatingSystemArchitecture : Allow user to set OperatingSystemArchitecture +func (_options *ListVolumesOptions) SetOperatingSystemArchitecture(operatingSystemArchitecture string) *ListVolumesOptions { + _options.OperatingSystemArchitecture = core.StringPtr(operatingSystemArchitecture) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *ListVolumesOptions) SetZoneName(zoneName string) *ListVolumesOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetTag : Allow user to set Tag +func (_options *ListVolumesOptions) SetTag(tag string) *ListVolumesOptions { + _options.Tag = core.StringPtr(tag) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVolumesOptions) SetHeaders(param map[string]string) *ListVolumesOptions { + options.Headers = param + return options +} + +// ListVPCAddressPrefixesOptions : The ListVPCAddressPrefixes options. +type ListVPCAddressPrefixesOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_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 +} + +// NewListVPCAddressPrefixesOptions : Instantiate ListVPCAddressPrefixesOptions +func (*VpcV1) NewListVPCAddressPrefixesOptions(vpcID string) *ListVPCAddressPrefixesOptions { + return &ListVPCAddressPrefixesOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListVPCAddressPrefixesOptions) SetVPCID(vpcID string) *ListVPCAddressPrefixesOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPCAddressPrefixesOptions) SetStart(start string) *ListVPCAddressPrefixesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPCAddressPrefixesOptions) SetLimit(limit int64) *ListVPCAddressPrefixesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCAddressPrefixesOptions) SetHeaders(param map[string]string) *ListVPCAddressPrefixesOptions { + options.Headers = param + return options +} + +// ListVPCDnsResolutionBindingsOptions : The ListVPCDnsResolutionBindings options. +type ListVPCDnsResolutionBindingsOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // 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"` + + // 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"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // Filters the collection to resources with a `vpc.name` property matching the exact specified name. + VPCName *string `json:"vpc.name,omitempty"` + + // Filters the collection to resources with a `vpc.remote.account.id` property matching the specified account + // identifier. + AccountID *string `json:"account.id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPCDnsResolutionBindingsOptions.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 ( + ListVPCDnsResolutionBindingsOptionsSortCreatedAtConst = "created_at" + ListVPCDnsResolutionBindingsOptionsSortNameConst = "name" +) + +// NewListVPCDnsResolutionBindingsOptions : Instantiate ListVPCDnsResolutionBindingsOptions +func (*VpcV1) NewListVPCDnsResolutionBindingsOptions(vpcID string) *ListVPCDnsResolutionBindingsOptions { + return &ListVPCDnsResolutionBindingsOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCID(vpcID string) *ListVPCDnsResolutionBindingsOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPCDnsResolutionBindingsOptions) SetSort(sort string) *ListVPCDnsResolutionBindingsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPCDnsResolutionBindingsOptions) SetStart(start string) *ListVPCDnsResolutionBindingsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPCDnsResolutionBindingsOptions) SetLimit(limit int64) *ListVPCDnsResolutionBindingsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListVPCDnsResolutionBindingsOptions) SetName(name string) *ListVPCDnsResolutionBindingsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCCRN(vpcCRN string) *ListVPCDnsResolutionBindingsOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCName(vpcName string) *ListVPCDnsResolutionBindingsOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + +// SetAccountID : Allow user to set AccountID +func (_options *ListVPCDnsResolutionBindingsOptions) SetAccountID(accountID string) *ListVPCDnsResolutionBindingsOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCDnsResolutionBindingsOptions) SetHeaders(param map[string]string) *ListVPCDnsResolutionBindingsOptions { + options.Headers = param + return options +} + +// ListVPCRoutesOptions : The ListVPCRoutes options. +type ListVPCRoutesOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // Filters the collection to resources with a `zone.name` property matching the exact specified name. + ZoneName *string `json:"zone.name,omitempty"` + + // 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 +} + +// NewListVPCRoutesOptions : Instantiate ListVPCRoutesOptions +func (*VpcV1) NewListVPCRoutesOptions(vpcID string) *ListVPCRoutesOptions { + return &ListVPCRoutesOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListVPCRoutesOptions) SetVPCID(vpcID string) *ListVPCRoutesOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetZoneName : Allow user to set ZoneName +func (_options *ListVPCRoutesOptions) SetZoneName(zoneName string) *ListVPCRoutesOptions { + _options.ZoneName = core.StringPtr(zoneName) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPCRoutesOptions) SetStart(start string) *ListVPCRoutesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPCRoutesOptions) SetLimit(limit int64) *ListVPCRoutesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCRoutesOptions) SetHeaders(param map[string]string) *ListVPCRoutesOptions { + options.Headers = param + return options +} + +// ListVPCRoutingTableRoutesOptions : The ListVPCRoutingTableRoutes options. +type ListVPCRoutingTableRoutesOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `json:"routing_table_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 +} + +// NewListVPCRoutingTableRoutesOptions : Instantiate ListVPCRoutingTableRoutesOptions +func (*VpcV1) NewListVPCRoutingTableRoutesOptions(vpcID string, routingTableID string) *ListVPCRoutingTableRoutesOptions { + return &ListVPCRoutingTableRoutesOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListVPCRoutingTableRoutesOptions) SetVPCID(vpcID string) *ListVPCRoutingTableRoutesOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *ListVPCRoutingTableRoutesOptions) SetRoutingTableID(routingTableID string) *ListVPCRoutingTableRoutesOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPCRoutingTableRoutesOptions) SetStart(start string) *ListVPCRoutingTableRoutesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPCRoutingTableRoutesOptions) SetLimit(limit int64) *ListVPCRoutingTableRoutesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCRoutingTableRoutesOptions) SetHeaders(param map[string]string) *ListVPCRoutingTableRoutesOptions { + options.Headers = param + return options +} + +// ListVPCRoutingTablesOptions : The ListVPCRoutingTables options. +type ListVPCRoutingTablesOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_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 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 + Headers map[string]string +} + +// NewListVPCRoutingTablesOptions : Instantiate ListVPCRoutingTablesOptions +func (*VpcV1) NewListVPCRoutingTablesOptions(vpcID string) *ListVPCRoutingTablesOptions { + return &ListVPCRoutingTablesOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *ListVPCRoutingTablesOptions) SetVPCID(vpcID string) *ListVPCRoutingTablesOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPCRoutingTablesOptions) SetStart(start string) *ListVPCRoutingTablesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPCRoutingTablesOptions) SetLimit(limit int64) *ListVPCRoutingTablesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetIsDefault : Allow user to set IsDefault +func (_options *ListVPCRoutingTablesOptions) SetIsDefault(isDefault bool) *ListVPCRoutingTablesOptions { + _options.IsDefault = core.BoolPtr(isDefault) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCRoutingTablesOptions) SetHeaders(param map[string]string) *ListVPCRoutingTablesOptions { + options.Headers = param + return options +} + +// ListVpcsOptions : The ListVpcs options. +type ListVpcsOptions 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 VPCs with a `classic_access` property matching the specified value. + ClassicAccess *bool `json:"classic_access,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVpcsOptions : Instantiate ListVpcsOptions +func (*VpcV1) NewListVpcsOptions() *ListVpcsOptions { + return &ListVpcsOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListVpcsOptions) SetStart(start string) *ListVpcsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVpcsOptions) SetLimit(limit int64) *ListVpcsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListVpcsOptions) SetResourceGroupID(resourceGroupID string) *ListVpcsOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetClassicAccess : Allow user to set ClassicAccess +func (_options *ListVpcsOptions) SetClassicAccess(classicAccess bool) *ListVpcsOptions { + _options.ClassicAccess = core.BoolPtr(classicAccess) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVpcsOptions) SetHeaders(param map[string]string) *ListVpcsOptions { + options.Headers = param + return options +} + +// ListVPNGatewayConnectionsLocalCIDRsOptions : The ListVPNGatewayConnectionsLocalCIDRs options. +type ListVPNGatewayConnectionsLocalCIDRsOptions 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="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPNGatewayConnectionsLocalCIDRsOptions : Instantiate ListVPNGatewayConnectionsLocalCIDRsOptions +func (*VpcV1) NewListVPNGatewayConnectionsLocalCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionsLocalCIDRsOptions { + return &ListVPNGatewayConnectionsLocalCIDRsOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *ListVPNGatewayConnectionsLocalCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsLocalCIDRsOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *ListVPNGatewayConnectionsLocalCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionsLocalCIDRsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewayConnectionsLocalCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsLocalCIDRsOptions { + options.Headers = param + return options +} + +// ListVPNGatewayConnectionsOptions : The ListVPNGatewayConnections options. +type ListVPNGatewayConnectionsOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // 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 + Headers map[string]string +} + +// Constants associated with the ListVPNGatewayConnectionsOptions.Status property. +// Filters the collection to VPN gateway connections with a `status` property matching the specified value. +const ( + ListVPNGatewayConnectionsOptionsStatusDownConst = "down" + ListVPNGatewayConnectionsOptionsStatusUpConst = "up" +) + +// NewListVPNGatewayConnectionsOptions : Instantiate ListVPNGatewayConnectionsOptions +func (*VpcV1) NewListVPNGatewayConnectionsOptions(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { + return &ListVPNGatewayConnectionsOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *ListVPNGatewayConnectionsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetStatus : Allow user to set Status +func (_options *ListVPNGatewayConnectionsOptions) SetStatus(status string) *ListVPNGatewayConnectionsOptions { + _options.Status = core.StringPtr(status) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewayConnectionsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsOptions { + options.Headers = param + return options +} + +// ListVPNGatewayConnectionsPeerCIDRsOptions : The ListVPNGatewayConnectionsPeerCIDRs options. +type ListVPNGatewayConnectionsPeerCIDRsOptions 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="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPNGatewayConnectionsPeerCIDRsOptions : Instantiate ListVPNGatewayConnectionsPeerCIDRsOptions +func (*VpcV1) NewListVPNGatewayConnectionsPeerCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionsPeerCIDRsOptions { + return &ListVPNGatewayConnectionsPeerCIDRsOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *ListVPNGatewayConnectionsPeerCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsPeerCIDRsOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *ListVPNGatewayConnectionsPeerCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionsPeerCIDRsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewayConnectionsPeerCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsPeerCIDRsOptions { + options.Headers = param + return options +} + +// ListVPNGatewaysOptions : The ListVPNGateways options. +type ListVPNGatewaysOptions 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"` + + // 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 VPN gateways with a `mode` property matching the specified value. + Mode *string `json:"mode,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPNGatewaysOptions.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 ( + ListVPNGatewaysOptionsSortCreatedAtConst = "created_at" + ListVPNGatewaysOptionsSortNameConst = "name" +) + +// Constants associated with the ListVPNGatewaysOptions.Mode property. +// Filters the collection to VPN gateways with a `mode` property matching the specified value. +const ( + ListVPNGatewaysOptionsModePolicyConst = "policy" + ListVPNGatewaysOptionsModeRouteConst = "route" +) + +// NewListVPNGatewaysOptions : Instantiate ListVPNGatewaysOptions +func (*VpcV1) NewListVPNGatewaysOptions() *ListVPNGatewaysOptions { + return &ListVPNGatewaysOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListVPNGatewaysOptions) SetStart(start string) *ListVPNGatewaysOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNGatewaysOptions) SetLimit(limit int64) *ListVPNGatewaysOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListVPNGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListVPNGatewaysOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPNGatewaysOptions) SetSort(sort string) *ListVPNGatewaysOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetMode : Allow user to set Mode +func (_options *ListVPNGatewaysOptions) SetMode(mode string) *ListVPNGatewaysOptions { + _options.Mode = core.StringPtr(mode) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewaysOptions) SetHeaders(param map[string]string) *ListVPNGatewaysOptions { + options.Headers = param + return options +} + +// ListVPNServerClientsOptions : The ListVPNServerClients options. +type ListVPNServerClientsOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_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"` + + // 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. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPNServerClientsOptions.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. +const ( + ListVPNServerClientsOptionsSortCreatedAtConst = "created_at" +) + +// NewListVPNServerClientsOptions : Instantiate ListVPNServerClientsOptions +func (*VpcV1) NewListVPNServerClientsOptions(vpnServerID string) *ListVPNServerClientsOptions { + return &ListVPNServerClientsOptions{ + VPNServerID: core.StringPtr(vpnServerID), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *ListVPNServerClientsOptions) SetVPNServerID(vpnServerID string) *ListVPNServerClientsOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPNServerClientsOptions) SetStart(start string) *ListVPNServerClientsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNServerClientsOptions) SetLimit(limit int64) *ListVPNServerClientsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPNServerClientsOptions) SetSort(sort string) *ListVPNServerClientsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNServerClientsOptions) SetHeaders(param map[string]string) *ListVPNServerClientsOptions { + options.Headers = param + return options +} + +// ListVPNServerRoutesOptions : The ListVPNServerRoutes options. +type ListVPNServerRoutesOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_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"` + + // 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 ListVPNServerRoutesOptions.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 ( + ListVPNServerRoutesOptionsSortCreatedAtConst = "created_at" + ListVPNServerRoutesOptionsSortNameConst = "name" +) + +// NewListVPNServerRoutesOptions : Instantiate ListVPNServerRoutesOptions +func (*VpcV1) NewListVPNServerRoutesOptions(vpnServerID string) *ListVPNServerRoutesOptions { + return &ListVPNServerRoutesOptions{ + VPNServerID: core.StringPtr(vpnServerID), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *ListVPNServerRoutesOptions) SetVPNServerID(vpnServerID string) *ListVPNServerRoutesOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPNServerRoutesOptions) SetStart(start string) *ListVPNServerRoutesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNServerRoutesOptions) SetLimit(limit int64) *ListVPNServerRoutesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPNServerRoutesOptions) SetSort(sort string) *ListVPNServerRoutesOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNServerRoutesOptions) SetHeaders(param map[string]string) *ListVPNServerRoutesOptions { + options.Headers = param + return options +} + +// ListVPNServersOptions : The ListVPNServers options. +type ListVPNServersOptions struct { + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // 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"` + + // 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 ListVPNServersOptions.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 ( + ListVPNServersOptionsSortCreatedAtConst = "created_at" + ListVPNServersOptionsSortNameConst = "name" +) + +// NewListVPNServersOptions : Instantiate ListVPNServersOptions +func (*VpcV1) NewListVPNServersOptions() *ListVPNServersOptions { + return &ListVPNServersOptions{} +} + +// SetName : Allow user to set Name +func (_options *ListVPNServersOptions) SetName(name string) *ListVPNServersOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPNServersOptions) SetStart(start string) *ListVPNServersOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNServersOptions) SetLimit(limit int64) *ListVPNServersOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListVPNServersOptions) SetResourceGroupID(resourceGroupID string) *ListVPNServersOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPNServersOptions) SetSort(sort string) *ListVPNServersOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNServersOptions) SetHeaders(param map[string]string) *ListVPNServersOptions { + options.Headers = param + return options +} + +// LoadBalancer : LoadBalancer struct +type LoadBalancer struct { + // The date and time that this load balancer was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` + + // 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 `lb.appdomain.cloud`. + Dns *LoadBalancerDns `json:"dns,omitempty"` + + // Fully qualified domain name assigned to this load balancer. + Hostname *string `json:"hostname" validate:"required"` + + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` + + // Indicates whether this load balancer supports instance groups. + InstanceGroupsSupported *bool `json:"instance_groups_supported" validate:"required"` + + // The type of this load balancer, public or private. + IsPublic *bool `json:"is_public" validate:"required"` + + // The listeners of this load balancer. + Listeners []LoadBalancerListenerReference `json:"listeners" validate:"required"` + + // The logging configuration for this load balancer. + Logging *LoadBalancerLogging `json:"logging" validate:"required"` + + // The name for this load balancer. The name is unique across all load balancers in the VPC. + Name *string `json:"name" validate:"required"` + + // The operating status of this load balancer. + OperatingStatus *string `json:"operating_status" validate:"required"` + + // The pools of this load balancer. + Pools []LoadBalancerPoolReference `json:"pools" validate:"required"` + + // The private IP addresses assigned to this load balancer. + PrivateIps []LoadBalancerPrivateIpsItem `json:"private_ips" validate:"required"` + + // The profile for this load balancer. + Profile *LoadBalancerProfileReference `json:"profile" validate:"required"` + + // The provisioning status of this load balancer: + // + // - `active`: The load balancer is running. + // - `create_pending`: The load balancer is being created. + // - `delete_pending`: The load balancer is being deleted. + // - `maintenance_pending`: The load balancer is unavailable due to an internal + // error (contact IBM support). + // - `migrate_pending`: The load balancer is migrating to the requested configuration. + // Performance may be degraded. + // - `update_pending`: The load balancer is being updated + // to the requested configuration. + // + // The enumerated values for this property are expected to expand in the future. When + // processing this property, check for and log unknown values. Optionally halt + // processing and surface the error, or bypass the load balancer on which the + // unexpected property value was encountered. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The public IP addresses assigned to this load balancer. + // + // Applicable only for public load balancers. + PublicIps []IP `json:"public_ips" validate:"required"` + + // The resource group for this load balancer. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether route mode is enabled for this load balancer. + // + // At present, public load balancers are not supported with route mode enabled. + RouteMode *bool `json:"route_mode" validate:"required"` + + // The security groups targeting this load balancer. + // + // If empty, all inbound and outbound traffic is allowed. + // + // Applicable only for load balancers that support security groups. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // Indicates whether this load balancer supports security groups. + SecurityGroupsSupported *bool `json:"security_groups_supported" validate:"required"` + + // The subnets this load balancer is provisioned in. The load balancer's availability depends on the availability of + // the zones that the subnets reside in. + // + // All subnets will be in the same VPC. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // Indicates whether this load balancer supports UDP. + UDPSupported *bool `json:"udp_supported" validate:"required"` +} + +// Constants associated with the LoadBalancer.OperatingStatus property. +// The operating status of this load balancer. +const ( + LoadBalancerOperatingStatusOfflineConst = "offline" + LoadBalancerOperatingStatusOnlineConst = "online" +) + +// Constants associated with the LoadBalancer.ProvisioningStatus property. +// The provisioning status of this load balancer: +// +// - `active`: The load balancer is running. +// +// - `create_pending`: The load balancer is being created. +// +// - `delete_pending`: The load balancer is being deleted. +// +// - `maintenance_pending`: The load balancer is unavailable due to an internal +// error (contact IBM support). +// +// - `migrate_pending`: The load balancer is migrating to the requested configuration. +// Performance may be degraded. +// +// - `update_pending`: The load balancer is being updated +// to the requested configuration. +// +// The enumerated values for this property are expected to expand in the future. When +// processing this property, check for and log unknown values. Optionally halt +// processing and surface the error, or bypass the load balancer on which the +// unexpected property value was encountered. +const ( + LoadBalancerProvisioningStatusActiveConst = "active" + LoadBalancerProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerProvisioningStatusFailedConst = "failed" + LoadBalancerProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerProvisioningStatusMigratePendingConst = "migrate_pending" + LoadBalancerProvisioningStatusUpdatePendingConst = "update_pending" +) + +// Constants associated with the LoadBalancer.ResourceType property. +// The resource type. +const ( + LoadBalancerResourceTypeLoadBalancerConst = "load_balancer" +) + +// UnmarshalLoadBalancer unmarshals an instance of LoadBalancer from the specified map of raw messages. +func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancer) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalLoadBalancerDns) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instance_groups_supported", &obj.InstanceGroupsSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_public", &obj.IsPublic) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListenerReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLogging) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "operating_status", &obj.OperatingStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPoolReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalLoadBalancerPrivateIpsItem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalLoadBalancerProfileReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_ips", &obj.PublicIps, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_mode", &obj.RouteMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "security_groups_supported", &obj.SecurityGroupsSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "udp_supported", &obj.UDPSupported) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerCollection : LoadBalancerCollection struct +type LoadBalancerCollection struct { + // A link to the first page of resources. + First *LoadBalancerCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of load balancers. + LoadBalancers []LoadBalancer `json:"load_balancers" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *LoadBalancerCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancers", &obj.LoadBalancers, UnmarshalLoadBalancer) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *LoadBalancerCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 +// `lb.appdomain.cloud`. +type LoadBalancerDns struct { + // The DNS instance associated with this load balancer. + Instance *DnsInstanceReference `json:"instance" validate:"required"` + + // The DNS zone associated with this load balancer. + Zone *DnsZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalLoadBalancerDns unmarshals an instance of LoadBalancerDns from the specified map of raw messages. +func UnmarshalLoadBalancerDns(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerDns) + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerDnsPatch : The DNS configuration for this load balancer. +// +// Specify `null` to remove the existing DNS configuration, which will remove all DNS `A` records for this load balancer +// that had been added to `zone`, and add equivalent `A` records to the public DNS zone `lb.appdomain.cloud`. +type LoadBalancerDnsPatch struct { + // The DNS instance to associate with this load balancer. + // + // The specified instance may be in a different region or account, subject to IAM + // policies. + Instance DnsInstanceIdentityIntf `json:"instance,omitempty"` + + // The DNS zone to associate with this load balancer. + // + // The specified zone may be in a different region or account, subject to IAM policies. + Zone DnsZoneIdentityIntf `json:"zone,omitempty"` +} + +// UnmarshalLoadBalancerDnsPatch unmarshals an instance of LoadBalancerDnsPatch from the specified map of raw messages. +func UnmarshalLoadBalancerDnsPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerDnsPatch) + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 +// `lb.appdomain.cloud`. Otherwise, those DNS `A` records will be added to the specified `zone`. +type LoadBalancerDnsPrototype struct { + // The DNS instance to associate with this load balancer. + // + // The specified instance may be in a different region or account, subject to IAM + // policies. + Instance DnsInstanceIdentityIntf `json:"instance" validate:"required"` + + // The DNS zone to associate with this load balancer. + // + // The specified zone may be in a different region or account, subject to IAM policies. + Zone DnsZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewLoadBalancerDnsPrototype : Instantiate LoadBalancerDnsPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerDnsPrototype(instance DnsInstanceIdentityIntf, zone DnsZoneIdentityIntf) (_model *LoadBalancerDnsPrototype, err error) { + _model = &LoadBalancerDnsPrototype{ + Instance: instance, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerDnsPrototype unmarshals an instance of LoadBalancerDnsPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerDnsPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerDnsPrototype) + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentity : Identifies a load balancer by a unique property. +// Models which "extend" this model: +// - LoadBalancerIdentityByID +// - LoadBalancerIdentityByCRN +// - LoadBalancerIdentityByHref +type LoadBalancerIdentity struct { + // The unique identifier for this load balancer. + ID *string `json:"id,omitempty"` + + // The load balancer's CRN. + CRN *string `json:"crn,omitempty"` + + // The load balancer's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerIdentity) isaLoadBalancerIdentity() bool { + return true +} + +type LoadBalancerIdentityIntf interface { + isaLoadBalancerIdentity() bool +} + +// UnmarshalLoadBalancerIdentity unmarshals an instance of LoadBalancerIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 + // the `application` family (otherwise always `false`). Additional restrictions: + // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must + // match the `accept_proxy_protocol` value of the `https_redirect` listener. + // - If this listener is the target of another listener's `https_redirect`, its + // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. + AcceptProxyProtocol *bool `json:"accept_proxy_protocol" validate:"required"` + + // The certificate instance used for SSL termination. + // + // 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 date and time that this listener was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The default pool for this listener. If absent, this listener has no default pool. + DefaultPool *LoadBalancerPoolReference `json:"default_pool,omitempty"` + + // The listener's canonical URL. + Href *string `json:"href" validate:"required"` + + // If present, the target listener that requests are redirected to. + HTTPSRedirect *LoadBalancerListenerHTTPSRedirect `json:"https_redirect,omitempty"` + + // 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. + IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` + + // The policies for this listener. + Policies []LoadBalancerListenerPolicyReference `json:"policies,omitempty"` + + // The listener port number, or the inclusive lower bound of the port range. + Port *int64 `json:"port" validate:"required"` + + // The inclusive upper bound of the range of ports used by this listener. + // + // At present, only load balancers in the `network` family support more than one port per listener. + PortMax *int64 `json:"port_max" validate:"required"` + + // The inclusive lower bound of the range of ports used by this listener. + // + // At present, only load balancers in the `network` family support more than one port per listener. + PortMin *int64 `json:"port_min" validate:"required"` + + // The listener protocol. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the + // unexpected property value was encountered. + Protocol *string `json:"protocol" validate:"required"` + + // The provisioning status of this listener + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the + // unexpected property value was encountered. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` +} + +// Constants associated with the LoadBalancerListener.Protocol property. +// The listener protocol. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerProtocolHTTPConst = "http" + LoadBalancerListenerProtocolHTTPSConst = "https" + LoadBalancerListenerProtocolTCPConst = "tcp" + LoadBalancerListenerProtocolUDPConst = "udp" +) + +// Constants associated with the LoadBalancerListener.ProvisioningStatus property. +// The provisioning status of this listener +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerProvisioningStatusActiveConst = "active" + LoadBalancerListenerProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerProvisioningStatusFailedConst = "failed" + LoadBalancerListenerProvisioningStatusUpdatePendingConst = "update_pending" +) + +// UnmarshalLoadBalancerListener unmarshals an instance of LoadBalancerListener from the specified map of raw messages. +func UnmarshalLoadBalancerListener(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListener) + err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirect) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerCollection : LoadBalancerListenerCollection struct +type LoadBalancerListenerCollection struct { + // Collection of listeners. + Listeners []LoadBalancerListener `json:"listeners" validate:"required"` +} + +// UnmarshalLoadBalancerListenerCollection unmarshals an instance of LoadBalancerListenerCollection from the specified map of raw messages. +func UnmarshalLoadBalancerListenerCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerCollection) + err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListener) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerHTTPSRedirect : LoadBalancerListenerHTTPSRedirect struct +type LoadBalancerListenerHTTPSRedirect struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + Listener *LoadBalancerListenerReference `json:"listener" validate:"required"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +// UnmarshalLoadBalancerListenerHTTPSRedirect unmarshals an instance of LoadBalancerListenerHTTPSRedirect from the specified map of raw messages. +func UnmarshalLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerHTTPSRedirect) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerHTTPSRedirectPatch : LoadBalancerListenerHTTPSRedirectPatch struct +type LoadBalancerListenerHTTPSRedirectPatch struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +// UnmarshalLoadBalancerListenerHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerHTTPSRedirectPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerHTTPSRedirectPatch) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerHTTPSRedirectPrototype struct +type LoadBalancerListenerHTTPSRedirectPrototype struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener" validate:"required"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +// NewLoadBalancerListenerHTTPSRedirectPrototype : Instantiate LoadBalancerListenerHTTPSRedirectPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerHTTPSRedirectPrototype, err error) { + _model = &LoadBalancerListenerHTTPSRedirectPrototype{ + HTTPStatusCode: core.Int64Ptr(httpStatusCode), + Listener: listener, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerHTTPSRedirectPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerHTTPSRedirectPrototype) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerIdentity : Identifies a load balancer listener by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerIdentityByID +// - LoadBalancerListenerIdentityByHref +type LoadBalancerListenerIdentity struct { + // The unique identifier for this load balancer listener. + ID *string `json:"id,omitempty"` + + // The listener's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerIdentity) isaLoadBalancerListenerIdentity() bool { + return true +} + +type LoadBalancerListenerIdentityIntf interface { + isaLoadBalancerListenerIdentity() bool +} + +// UnmarshalLoadBalancerListenerIdentity unmarshals an instance of LoadBalancerListenerIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 + // the `application` family (otherwise always `false`). Additional restrictions: + // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must + // match the `accept_proxy_protocol` value of the `https_redirect` listener. + // - If this listener is the target of another listener's `https_redirect`, its + // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. + AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` + + // The certificate instance to use for SSL termination. The listener must have a + // `protocol` of `https`. + CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` + + // The connection limit of the listener. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` + + // The default pool for this listener. The specified pool must: + // + // - Belong to this load balancer + // - Have the same `protocol` as this listener, or have a compatible protocol. + // At present, the compatible protocols are `http` and `https`. + // - Not already be the `default_pool` for another listener + // + // Specify `null` to remove an existing default pool. + DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` + + // The target listener that requests will be redirected to. This listener must have a + // `protocol` of `http`, and the target listener must have a `protocol` of `https`. + // + // 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. + 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 + // have a unique `port` and `protocol` combination. + // + // Not supported for load balancers operating with route mode enabled. + Port *int64 `json:"port,omitempty"` + + // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `65535` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `1` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMin *int64 `json:"port_min,omitempty"` + + // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. + // + // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http` and + // `https`. + // + // Additional restrictions: + // - If `default_pool` is set, the protocol cannot be changed. + // - If `https_redirect` is set, the protocol must be `http`. + // - If another listener's `https_redirect` targets this listener, the protocol must be + // `https`. + Protocol *string `json:"protocol,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPatch.Protocol property. +// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. +// +// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http` and +// `https`. +// +// Additional restrictions: +// - If `default_pool` is set, the protocol cannot be changed. +// - If `https_redirect` is set, the protocol must be `http`. +// - If another listener's `https_redirect` targets this listener, the protocol must be +// `https`. +const ( + LoadBalancerListenerPatchProtocolHTTPConst = "http" + LoadBalancerListenerPatchProtocolHTTPSConst = "https" + LoadBalancerListenerPatchProtocolTCPConst = "tcp" + LoadBalancerListenerPatchProtocolUDPConst = "udp" +) + +// UnmarshalLoadBalancerListenerPatch unmarshals an instance of LoadBalancerListenerPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPatch) + err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// LoadBalancerListenerPolicy : LoadBalancerListenerPolicy struct +type LoadBalancerListenerPolicy struct { + // The policy action. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the + // unexpected property value was encountered. + Action *string `json:"action" validate:"required"` + + // The date and time that this policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The listener policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The policy's unique identifier. + ID *string `json:"id" validate:"required"` + + // The name for this load balancer listener policy. The name is unique across all policies for the load balancer + // listener. + Name *string `json:"name" validate:"required"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority" validate:"required"` + + // The provisioning status of this policy + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the + // unexpected property value was encountered. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The rules for this policy. + Rules []LoadBalancerListenerPolicyRuleReference `json:"rules" validate:"required"` + + // - If `action` is `forward`, the response is a `LoadBalancerPoolReference` + // - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL` + // - If `action` is `https_redirect`, the response is a `LoadBalancerListenerHTTPSRedirect`. + Target LoadBalancerListenerPolicyTargetIntf `json:"target,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPolicy.Action property. +// The policy action. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerPolicyActionForwardConst = "forward" + LoadBalancerListenerPolicyActionHTTPSRedirectConst = "https_redirect" + LoadBalancerListenerPolicyActionRedirectConst = "redirect" + LoadBalancerListenerPolicyActionRejectConst = "reject" +) + +// Constants associated with the LoadBalancerListenerPolicy.ProvisioningStatus property. +// The provisioning status of this policy +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerPolicyProvisioningStatusActiveConst = "active" + LoadBalancerListenerPolicyProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerPolicyProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerPolicyProvisioningStatusFailedConst = "failed" + LoadBalancerListenerPolicyProvisioningStatusUpdatePendingConst = "update_pending" +) + +// UnmarshalLoadBalancerListenerPolicy unmarshals an instance of LoadBalancerListenerPolicy from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicy) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRuleReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTarget) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyCollection : LoadBalancerListenerPolicyCollection struct +type LoadBalancerListenerPolicyCollection struct { + // Collection of policies. + Policies []LoadBalancerListenerPolicy `json:"policies" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyCollection unmarshals an instance of LoadBalancerListenerPolicyCollection from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyCollection) + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyPatch : LoadBalancerListenerPolicyPatch struct +type LoadBalancerListenerPolicyPatch struct { + // The name for this policy. The name must not be used by another policy for the load balancer listener. + Name *string `json:"name,omitempty"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority,omitempty"` + + // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. + // - If `action` is `https_redirect`, specify a + // `LoadBalancerListenerPolicyHTTPSRedirectPatch`. + Target LoadBalancerListenerPolicyTargetPatchIntf `json:"target,omitempty"` +} + +// UnmarshalLoadBalancerListenerPolicyPatch unmarshals an instance of LoadBalancerListenerPolicyPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// LoadBalancerListenerPolicyPrototype : LoadBalancerListenerPolicyPrototype struct +type LoadBalancerListenerPolicyPrototype struct { + // The policy action. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the + // unexpected property value was encountered. + Action *string `json:"action" validate:"required"` + + // The name for this policy. The name must not be used by another policy for the load balancer listener. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority" validate:"required"` + + // The rule prototype objects for this policy. + Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` + + // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. + // - If `action` is `https_redirect`, specify a + // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPolicyPrototype.Action property. +// The policy action. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerPolicyPrototypeActionForwardConst = "forward" + LoadBalancerListenerPolicyPrototypeActionHTTPSRedirectConst = "https_redirect" + LoadBalancerListenerPolicyPrototypeActionRedirectConst = "redirect" + LoadBalancerListenerPolicyPrototypeActionRejectConst = "reject" +) + +// NewLoadBalancerListenerPolicyPrototype : Instantiate LoadBalancerListenerPolicyPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyPrototype(action string, priority int64) (_model *LoadBalancerListenerPolicyPrototype, err error) { + _model = &LoadBalancerListenerPolicyPrototype{ + Action: core.StringPtr(action), + Priority: core.Int64Ptr(priority), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerPolicyPrototype unmarshals an instance of LoadBalancerListenerPolicyPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyReference : LoadBalancerListenerPolicyReference struct +type LoadBalancerListenerPolicyReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerListenerPolicyReferenceDeleted `json:"deleted,omitempty"` + + // The listener policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The policy's unique identifier. + ID *string `json:"id" validate:"required"` + + // The name for this load balancer listener policy. The name is unique across all policies for the load balancer + // listener. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyReference unmarshals an instance of LoadBalancerListenerPolicyReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerListenerPolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyReferenceDeleted unmarshals an instance of LoadBalancerListenerPolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRule : LoadBalancerListenerPolicyRule struct +type LoadBalancerListenerPolicyRule struct { + // The condition of the rule. + Condition *string `json:"condition" validate:"required"` + + // The date and time that this rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this property is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // The rule's canonical URL. + Href *string `json:"href" validate:"required"` + + // The rule's unique identifier. + ID *string `json:"id" validate:"required"` + + // The provisioning status of this rule + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the rule on which the + // unexpected property value was encountered. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type" validate:"required"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerListenerPolicyRule.Condition property. +// The condition of the rule. +const ( + LoadBalancerListenerPolicyRuleConditionContainsConst = "contains" + LoadBalancerListenerPolicyRuleConditionEqualsConst = "equals" + LoadBalancerListenerPolicyRuleConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the LoadBalancerListenerPolicyRule.ProvisioningStatus property. +// The provisioning status of this rule +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the rule on which the +// unexpected property value was encountered. +const ( + LoadBalancerListenerPolicyRuleProvisioningStatusActiveConst = "active" + LoadBalancerListenerPolicyRuleProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerPolicyRuleProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerPolicyRuleProvisioningStatusFailedConst = "failed" + LoadBalancerListenerPolicyRuleProvisioningStatusUpdatePendingConst = "update_pending" +) + +// Constants associated with the LoadBalancerListenerPolicyRule.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + LoadBalancerListenerPolicyRuleTypeBodyConst = "body" + LoadBalancerListenerPolicyRuleTypeHeaderConst = "header" + LoadBalancerListenerPolicyRuleTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRuleTypePathConst = "path" + LoadBalancerListenerPolicyRuleTypeQueryConst = "query" +) + +// UnmarshalLoadBalancerListenerPolicyRule unmarshals an instance of LoadBalancerListenerPolicyRule from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRule(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRule) + err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "field", &obj.Field) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRuleCollection : LoadBalancerListenerPolicyRuleCollection struct +type LoadBalancerListenerPolicyRuleCollection struct { + // Collection of rules. + Rules []LoadBalancerListenerPolicyRule `json:"rules" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyRuleCollection unmarshals an instance of LoadBalancerListenerPolicyRuleCollection from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRuleCollection) + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRulePatch : LoadBalancerListenerPolicyRulePatch struct +type LoadBalancerListenerPolicyRulePatch struct { + // The condition of the rule. + Condition *string `json:"condition,omitempty"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this property is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type,omitempty"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPolicyRulePatch.Condition property. +// The condition of the rule. +const ( + LoadBalancerListenerPolicyRulePatchConditionContainsConst = "contains" + LoadBalancerListenerPolicyRulePatchConditionEqualsConst = "equals" + LoadBalancerListenerPolicyRulePatchConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the LoadBalancerListenerPolicyRulePatch.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + LoadBalancerListenerPolicyRulePatchTypeBodyConst = "body" + LoadBalancerListenerPolicyRulePatchTypeHeaderConst = "header" + LoadBalancerListenerPolicyRulePatchTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRulePatchTypePathConst = "path" + LoadBalancerListenerPolicyRulePatchTypeQueryConst = "query" +) + +// UnmarshalLoadBalancerListenerPolicyRulePatch unmarshals an instance of LoadBalancerListenerPolicyRulePatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRulePatch) + err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "field", &obj.Field) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// LoadBalancerListenerPolicyRulePrototype : LoadBalancerListenerPolicyRulePrototype struct +type LoadBalancerListenerPolicyRulePrototype struct { + // The condition of the rule. + Condition *string `json:"condition" validate:"required"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this property is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type" validate:"required"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Condition property. +// The condition of the rule. +const ( + LoadBalancerListenerPolicyRulePrototypeConditionContainsConst = "contains" + LoadBalancerListenerPolicyRulePrototypeConditionEqualsConst = "equals" + LoadBalancerListenerPolicyRulePrototypeConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + LoadBalancerListenerPolicyRulePrototypeTypeBodyConst = "body" + LoadBalancerListenerPolicyRulePrototypeTypeHeaderConst = "header" + LoadBalancerListenerPolicyRulePrototypeTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRulePrototypeTypePathConst = "path" + LoadBalancerListenerPolicyRulePrototypeTypeQueryConst = "query" +) + +// NewLoadBalancerListenerPolicyRulePrototype : Instantiate LoadBalancerListenerPolicyRulePrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyRulePrototype(condition string, typeVar string, value string) (_model *LoadBalancerListenerPolicyRulePrototype, err error) { + _model = &LoadBalancerListenerPolicyRulePrototype{ + Condition: core.StringPtr(condition), + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerPolicyRulePrototype unmarshals an instance of LoadBalancerListenerPolicyRulePrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRulePrototype) + err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "field", &obj.Field) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRuleReference : LoadBalancerListenerPolicyRuleReference struct +type LoadBalancerListenerPolicyRuleReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerListenerPolicyRuleReferenceDeleted `json:"deleted,omitempty"` + + // The rule's canonical URL. + Href *string `json:"href" validate:"required"` + + // The rule's unique identifier. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyRuleReference unmarshals an instance of LoadBalancerListenerPolicyRuleReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRuleReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerListenerPolicyRuleReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted unmarshals an instance of LoadBalancerListenerPolicyRuleReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRuleReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTarget : - If `action` is `forward`, the response is a `LoadBalancerPoolReference` +// - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL` +// - If `action` is `https_redirect`, the response is a `LoadBalancerListenerHTTPSRedirect`. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetLoadBalancerPoolReference +// - LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL +// - LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect +type LoadBalancerListenerPolicyTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The name for this load balancer pool. The name is unique across all pools for the load balancer. + Name *string `json:"name,omitempty"` + + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` + + Listener *LoadBalancerListenerReference `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTarget) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +type LoadBalancerListenerPolicyTargetIntf interface { + isaLoadBalancerListenerPolicyTarget() bool +} + +// UnmarshalLoadBalancerListenerPolicyTarget unmarshals an instance of LoadBalancerListenerPolicyTarget from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatch : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. +// - If `action` is `https_redirect`, specify a +// `LoadBalancerListenerPolicyHTTPSRedirectPatch`. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch +type LoadBalancerListenerPolicyTargetPatch struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` + + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPatchIntf interface { + isaLoadBalancerListenerPolicyTargetPatch() bool +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototype : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. +// - If `action` is `https_redirect`, specify a +// `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype +type LoadBalancerListenerPolicyTargetPrototype struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` + + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPrototypeIntf interface { + isaLoadBalancerListenerPolicyTargetPrototype() bool +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPrototypeLoadBalancerContext : LoadBalancerListenerPrototypeLoadBalancerContext struct +type LoadBalancerListenerPrototypeLoadBalancerContext struct { + // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in + // the `application` family (otherwise always `false`). Additional restrictions: + // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must + // match the `accept_proxy_protocol` value of the `https_redirect` listener. + // - If this listener is the target of another listener's `https_redirect`, its + // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. + AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` + + // The certificate instance to use for SSL termination. The listener must have a + // `protocol` of `https`. + CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` + + // The connection limit of the listener. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` + + // The default pool for this listener. If specified, the pool must: + // - Belong to this load balancer. + // - Have the same `protocol` as this listener, or have a compatible protocol. + // At present, the compatible protocols are `http` and `https`. + // - Not already be the `default_pool` for another listener. + // + // If unspecified, this listener will be created with no default pool, but one may be + // subsequently set. + DefaultPool *LoadBalancerPoolIdentityByName `json:"default_pool,omitempty"` + + // The target listener that requests will be redirected to. This listener must have a + // `protocol` of `http`, and the target 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. + 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 + // have a unique `port` and `protocol` combination. + // + // Not supported for load balancers operating with route mode enabled. + Port *int64 `json:"port,omitempty"` + + // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `65535` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. + // + // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family + // support different values for `port_min` and + // `port_max`. When route mode is enabled, the value `1` must be specified. + // + // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the + // same protocol. + PortMin *int64 `json:"port_min,omitempty"` + + // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. + // + // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http` and + // `https`. + // + // Additional restrictions: + // - If `default_pool` is set, the pool's protocol must match, or be compatible with + // the listener's protocol. At present, the compatible protocols are `http` and + // `https`. + // - If `https_redirect` is set, the protocol must be `http`. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the LoadBalancerListenerPrototypeLoadBalancerContext.Protocol property. +// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. +// +// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http` and +// `https`. +// +// Additional restrictions: +// - If `default_pool` is set, the pool's protocol must match, or be compatible with +// the listener's protocol. At present, the compatible protocols are `http` and +// `https`. +// - If `https_redirect` is set, the protocol must be `http`. +const ( + LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPConst = "http" + LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPSConst = "https" + LoadBalancerListenerPrototypeLoadBalancerContextProtocolTCPConst = "tcp" + LoadBalancerListenerPrototypeLoadBalancerContextProtocolUDPConst = "udp" +) + +// NewLoadBalancerListenerPrototypeLoadBalancerContext : Instantiate LoadBalancerListenerPrototypeLoadBalancerContext (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPrototypeLoadBalancerContext(protocol string) (_model *LoadBalancerListenerPrototypeLoadBalancerContext, err error) { + _model = &LoadBalancerListenerPrototypeLoadBalancerContext{ + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext unmarshals an instance of LoadBalancerListenerPrototypeLoadBalancerContext from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPrototypeLoadBalancerContext) + err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentityByName) + if err != nil { + return + } + err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerReference : LoadBalancerListenerReference struct +type LoadBalancerListenerReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerListenerReferenceDeleted `json:"deleted,omitempty"` + + // The listener's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer listener. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalLoadBalancerListenerReference unmarshals an instance of LoadBalancerListenerReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerListenerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerListenerReferenceDeleted unmarshals an instance of LoadBalancerListenerReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerListenerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLogging : LoadBalancerLogging struct +type LoadBalancerLogging struct { + // The datapath logging configuration for this load balancer. + Datapath *LoadBalancerLoggingDatapath `json:"datapath" validate:"required"` +} + +// UnmarshalLoadBalancerLogging unmarshals an instance of LoadBalancerLogging from the specified map of raw messages. +func UnmarshalLoadBalancerLogging(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLogging) + err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLoggingDatapath : The datapath logging configuration for this load balancer. +type LoadBalancerLoggingDatapath struct { + // Indicates whether datapath logging is active for this load balancer. + Active *bool `json:"active" validate:"required"` +} + +// UnmarshalLoadBalancerLoggingDatapath unmarshals an instance of LoadBalancerLoggingDatapath from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingDatapath(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingDatapath) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLoggingDatapathPatch : The datapath logging configuration for this load balancer. +type LoadBalancerLoggingDatapathPatch struct { + // Indicates whether datapath logging will be active for this load balancer. + Active *bool `json:"active,omitempty"` +} + +// UnmarshalLoadBalancerLoggingDatapathPatch unmarshals an instance of LoadBalancerLoggingDatapathPatch from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingDatapathPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingDatapathPatch) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLoggingDatapathPrototype : The datapath logging configuration for this load balancer. +type LoadBalancerLoggingDatapathPrototype struct { + // Indicates whether datapath logging will be active for this load balancer. + Active *bool `json:"active,omitempty"` +} + +// UnmarshalLoadBalancerLoggingDatapathPrototype unmarshals an instance of LoadBalancerLoggingDatapathPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingDatapathPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingDatapathPrototype) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLoggingPatch : LoadBalancerLoggingPatch struct +type LoadBalancerLoggingPatch struct { + // The datapath logging configuration for this load balancer. + Datapath *LoadBalancerLoggingDatapathPatch `json:"datapath,omitempty"` +} + +// UnmarshalLoadBalancerLoggingPatch unmarshals an instance of LoadBalancerLoggingPatch from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingPatch) + err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLoggingPrototype : LoadBalancerLoggingPrototype struct +type LoadBalancerLoggingPrototype struct { + // The datapath logging configuration for this load balancer. + Datapath *LoadBalancerLoggingDatapathPrototype `json:"datapath,omitempty"` +} + +// UnmarshalLoadBalancerLoggingPrototype unmarshals an instance of LoadBalancerLoggingPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingPrototype) + err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPatch : LoadBalancerPatch struct +type LoadBalancerPatch struct { + // The DNS configuration for this load balancer. + // + // Specify `null` to remove the existing DNS configuration, which will remove all DNS `A` + // records for this load balancer that had been added to `zone`, and add equivalent `A` + // records to the public DNS zone `lb.appdomain.cloud`. + Dns *LoadBalancerDnsPatch `json:"dns,omitempty"` + + // The logging configuration to use for this load balancer. + // + // To activate logging, the load balancer profile must support the specified logging type. + Logging *LoadBalancerLoggingPatch `json:"logging,omitempty"` + + // The name for this load balancer. The name must not be used by another load balancer in the VPC. + Name *string `json:"name,omitempty"` + + // The subnets to provision this load balancer in. The load balancer's availability will depend on the availability of + // the zones that the subnets reside in. + // + // The specified subnets must be in the same VPC as the existing subnets, and will completely replace the existing + // subnets. + // + // The load balancer must be in the `application` family. + Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` +} + +// UnmarshalLoadBalancerPatch unmarshals an instance of LoadBalancerPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPatch) + err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalLoadBalancerDnsPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLoggingPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// LoadBalancerPool : LoadBalancerPool struct +type LoadBalancerPool struct { + // The load balancing algorithm. + Algorithm *string `json:"algorithm" validate:"required"` + + // The date and time that this pool was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitor `json:"health_monitor" validate:"required"` + + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` + + // The instance group that is managing this pool. + InstanceGroup *InstanceGroupReference `json:"instance_group,omitempty"` + + // The backend server members of the pool. + Members []LoadBalancerPoolMemberReference `json:"members,omitempty"` + + // The name for this load balancer pool. The name is unique across all pools for the load balancer. + Name *string `json:"name" validate:"required"` + + // The protocol for this load balancer pool. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the + // unexpected property value was encountered. + Protocol *string `json:"protocol" validate:"required"` + + // The provisioning status of this pool + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the + // unexpected property value was encountered. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol" validate:"required"` + + // The session persistence of this pool. + // + // The enumerated values for this property are expected to expand in the future. When + // processing this property, check for and log unknown values. Optionally halt + // processing and surface the error, or bypass the pool on which the unexpected + // property value was encountered. + SessionPersistence *LoadBalancerPoolSessionPersistence `json:"session_persistence,omitempty"` +} + +// Constants associated with the LoadBalancerPool.Algorithm property. +// The load balancing algorithm. +const ( + LoadBalancerPoolAlgorithmLeastConnectionsConst = "least_connections" + LoadBalancerPoolAlgorithmRoundRobinConst = "round_robin" + LoadBalancerPoolAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the LoadBalancerPool.Protocol property. +// The protocol for this load balancer pool. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the +// unexpected property value was encountered. +const ( + LoadBalancerPoolProtocolHTTPConst = "http" + LoadBalancerPoolProtocolHTTPSConst = "https" + LoadBalancerPoolProtocolTCPConst = "tcp" + LoadBalancerPoolProtocolUDPConst = "udp" +) + +// Constants associated with the LoadBalancerPool.ProvisioningStatus property. +// The provisioning status of this pool +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the +// unexpected property value was encountered. +const ( + LoadBalancerPoolProvisioningStatusActiveConst = "active" + LoadBalancerPoolProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerPoolProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerPoolProvisioningStatusFailedConst = "failed" + LoadBalancerPoolProvisioningStatusUpdatePendingConst = "update_pending" +) + +// Constants associated with the LoadBalancerPool.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + LoadBalancerPoolProxyProtocolDisabledConst = "disabled" + LoadBalancerPoolProxyProtocolV1Const = "v1" + LoadBalancerPoolProxyProtocolV2Const = "v2" +) + +// UnmarshalLoadBalancerPool unmarshals an instance of LoadBalancerPool from the specified map of raw messages. +func UnmarshalLoadBalancerPool(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPool) + err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitor) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_group", &obj.InstanceGroup, UnmarshalInstanceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistence) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolCollection : LoadBalancerPoolCollection struct +type LoadBalancerPoolCollection struct { + // Collection of pools. + Pools []LoadBalancerPool `json:"pools" validate:"required"` +} + +// UnmarshalLoadBalancerPoolCollection unmarshals an instance of LoadBalancerPoolCollection from the specified map of raw messages. +func UnmarshalLoadBalancerPoolCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolCollection) + err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPool) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolHealthMonitor : LoadBalancerPoolHealthMonitor struct +type LoadBalancerPoolHealthMonitor struct { + // The seconds to wait between health checks. + Delay *int64 `json:"delay" validate:"required"` + + // The health check max retries. + MaxRetries *int64 `json:"max_retries" validate:"required"` + + // The health check port. + // + // If present, this overrides the pool member port values. + Port *int64 `json:"port,omitempty"` + + // The seconds to wait for a response to a health check. + Timeout *int64 `json:"timeout" validate:"required"` + + // The protocol type to use for health checks. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which + // the unexpected property value was encountered. + Type *string `json:"type" validate:"required"` + + // The health check URL path. Applicable when `type` is `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"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitor.Type property. +// The protocol type to use for health checks. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which +// the unexpected property value was encountered. +const ( + LoadBalancerPoolHealthMonitorTypeHTTPConst = "http" + LoadBalancerPoolHealthMonitorTypeHTTPSConst = "https" + LoadBalancerPoolHealthMonitorTypeTCPConst = "tcp" +) + +// UnmarshalLoadBalancerPoolHealthMonitor unmarshals an instance of LoadBalancerPoolHealthMonitor from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitor(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitor) + err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolHealthMonitorPatch : LoadBalancerPoolHealthMonitorPatch struct +type LoadBalancerPoolHealthMonitorPatch struct { + // The seconds to wait between health checks. Must be greater than `timeout`. + Delay *int64 `json:"delay" validate:"required"` + + // The health check max retries. + MaxRetries *int64 `json:"max_retries" validate:"required"` + + // The health check port. + // + // If set, this overrides the pool member port values. + // + // Specify `null` to remove an existing health check port. + Port *int64 `json:"port,omitempty"` + + // The seconds to wait for a response to a health check. Must be less than `delay`. + Timeout *int64 `json:"timeout" validate:"required"` + + // The protocol type to use for health checks. + Type *string `json:"type" validate:"required"` + + // The health check URL path. Applicable when `type` is `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"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitorPatch.Type property. +// The protocol type to use for health checks. +const ( + LoadBalancerPoolHealthMonitorPatchTypeHTTPConst = "http" + LoadBalancerPoolHealthMonitorPatchTypeHTTPSConst = "https" + LoadBalancerPoolHealthMonitorPatchTypeTCPConst = "tcp" +) + +// NewLoadBalancerPoolHealthMonitorPatch : Instantiate LoadBalancerPoolHealthMonitorPatch (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolHealthMonitorPatch(delay int64, maxRetries int64, timeout int64, typeVar string) (_model *LoadBalancerPoolHealthMonitorPatch, err error) { + _model = &LoadBalancerPoolHealthMonitorPatch{ + Delay: core.Int64Ptr(delay), + MaxRetries: core.Int64Ptr(maxRetries), + Timeout: core.Int64Ptr(timeout), + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolHealthMonitorPatch unmarshals an instance of LoadBalancerPoolHealthMonitorPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitorPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitorPatch) + err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolHealthMonitorPrototype : LoadBalancerPoolHealthMonitorPrototype struct +type LoadBalancerPoolHealthMonitorPrototype struct { + // The seconds to wait between health checks. Must be greater than `timeout`. + Delay *int64 `json:"delay" validate:"required"` + + // The health check max retries. + MaxRetries *int64 `json:"max_retries" validate:"required"` + + // The health check port. + // + // If specified, this overrides the pool member port values. + Port *int64 `json:"port,omitempty"` + + // The seconds to wait for a response to a health check. Must be less than `delay`. + Timeout *int64 `json:"timeout" validate:"required"` + + // The protocol type to use for health checks. + Type *string `json:"type" validate:"required"` + + // The health check URL path. Applicable when `type` is `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"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitorPrototype.Type property. +// The protocol type to use for health checks. +const ( + LoadBalancerPoolHealthMonitorPrototypeTypeHTTPConst = "http" + LoadBalancerPoolHealthMonitorPrototypeTypeHTTPSConst = "https" + LoadBalancerPoolHealthMonitorPrototypeTypeTCPConst = "tcp" +) + +// NewLoadBalancerPoolHealthMonitorPrototype : Instantiate LoadBalancerPoolHealthMonitorPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolHealthMonitorPrototype(delay int64, maxRetries int64, timeout int64, typeVar string) (_model *LoadBalancerPoolHealthMonitorPrototype, err error) { + _model = &LoadBalancerPoolHealthMonitorPrototype{ + Delay: core.Int64Ptr(delay), + MaxRetries: core.Int64Ptr(maxRetries), + Timeout: core.Int64Ptr(timeout), + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolHealthMonitorPrototype unmarshals an instance of LoadBalancerPoolHealthMonitorPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitorPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitorPrototype) + err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. +// Models which "extend" this model: +// - LoadBalancerPoolIdentityByID +// - LoadBalancerPoolIdentityByHref +type LoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerPoolIdentity) isaLoadBalancerPoolIdentity() bool { + return true +} + +type LoadBalancerPoolIdentityIntf interface { + isaLoadBalancerPoolIdentity() bool +} + +// UnmarshalLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerPoolIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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. + Name *string `json:"name" validate:"required"` +} + +// NewLoadBalancerPoolIdentityByName : Instantiate LoadBalancerPoolIdentityByName (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityByName(name string) (_model *LoadBalancerPoolIdentityByName, err error) { + _model = &LoadBalancerPoolIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolIdentityByName unmarshals an instance of LoadBalancerPoolIdentityByName from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMember : LoadBalancerPoolMember struct +type LoadBalancerPoolMember struct { + // The date and time that this member was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // Health of the server member in the pool. + Health *string `json:"health" validate:"required"` + + // The member's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool member. + ID *string `json:"id" validate:"required"` + + // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a + // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive + // the traffic on the same port the listener received it on.) + // + // This port will also be used for health checks unless the `port` property of + // `health_monitor` property is specified. + Port *int64 `json:"port" validate:"required"` + + // The provisioning status of this member + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool member on which the + // unexpected property value was encountered. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. + Target LoadBalancerPoolMemberTargetIntf `json:"target" validate:"required"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` +} + +// Constants associated with the LoadBalancerPoolMember.Health property. +// Health of the server member in the pool. +const ( + LoadBalancerPoolMemberHealthFaultedConst = "faulted" + LoadBalancerPoolMemberHealthOkConst = "ok" + LoadBalancerPoolMemberHealthUnknownConst = "unknown" +) + +// Constants associated with the LoadBalancerPoolMember.ProvisioningStatus property. +// The provisioning status of this member +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool member on which the +// unexpected property value was encountered. +const ( + LoadBalancerPoolMemberProvisioningStatusActiveConst = "active" + LoadBalancerPoolMemberProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerPoolMemberProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerPoolMemberProvisioningStatusFailedConst = "failed" + LoadBalancerPoolMemberProvisioningStatusUpdatePendingConst = "update_pending" +) + +// UnmarshalLoadBalancerPoolMember unmarshals an instance of LoadBalancerPoolMember from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMember(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMember) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health", &obj.Health) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTarget) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberCollection : LoadBalancerPoolMemberCollection struct +type LoadBalancerPoolMemberCollection struct { + // Collection of members. + Members []LoadBalancerPoolMember `json:"members" validate:"required"` +} + +// UnmarshalLoadBalancerPoolMemberCollection unmarshals an instance of LoadBalancerPoolMemberCollection from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberCollection) + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberPatch : LoadBalancerPoolMemberPatch struct +type LoadBalancerPoolMemberPatch struct { + // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a + // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive + // the traffic on the same port the listener received it on.) + // + // This port will also be used for health checks unless the `port` property of + // `health_monitor` property is specified. + // + // The port must be unique across all members for all pools associated with this pool's listener. + Port *int64 `json:"port,omitempty"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. + Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target,omitempty"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` +} + +// UnmarshalLoadBalancerPoolMemberPatch unmarshals an instance of LoadBalancerPoolMemberPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberPatch) + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// LoadBalancerPoolMemberPrototype : LoadBalancerPoolMemberPrototype struct +type LoadBalancerPoolMemberPrototype struct { + // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a + // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive + // the traffic on the same port the listener received it on.) + // + // This port will also be used for health checks unless the `port` property of + // `health_monitor` property is specified. + // + // The port must be unique across all members for all pools associated with this pool's listener. + Port *int64 `json:"port" validate:"required"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. + Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` +} + +// NewLoadBalancerPoolMemberPrototype : Instantiate LoadBalancerPoolMemberPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberPrototype(port int64, target LoadBalancerPoolMemberTargetPrototypeIntf) (_model *LoadBalancerPoolMemberPrototype, err error) { + _model = &LoadBalancerPoolMemberPrototype{ + Port: core.Int64Ptr(port), + Target: target, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolMemberPrototype unmarshals an instance of LoadBalancerPoolMemberPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberPrototype) + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberReference : LoadBalancerPoolMemberReference struct +type LoadBalancerPoolMemberReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerPoolMemberReferenceDeleted `json:"deleted,omitempty"` + + // The member's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool member. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalLoadBalancerPoolMemberReference unmarshals an instance of LoadBalancerPoolMemberReference from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolMemberReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerPoolMemberReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerPoolMemberReferenceDeleted unmarshals an instance of LoadBalancerPoolMemberReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTarget : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in +// the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a +// zone the load balancer has a subnet in. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetInstanceReference +// - LoadBalancerPoolMemberTargetIP +type LoadBalancerPoolMemberTarget struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. + Name *string `json:"name,omitempty"` + + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` +} + +func (*LoadBalancerPoolMemberTarget) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +type LoadBalancerPoolMemberTargetIntf interface { + isaLoadBalancerPoolMemberTarget() bool +} + +// UnmarshalLoadBalancerPoolMemberTarget unmarshals an instance of LoadBalancerPoolMemberTarget from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTarget) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototype : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in +// the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a +// zone the load balancer has a subnet in. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +// - LoadBalancerPoolMemberTargetPrototypeIP +type LoadBalancerPoolMemberTargetPrototype struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` + + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` +} + +func (*LoadBalancerPoolMemberTargetPrototype) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +type LoadBalancerPoolMemberTargetPrototypeIntf interface { + isaLoadBalancerPoolMemberTargetPrototype() bool +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototype unmarshals an instance of LoadBalancerPoolMemberTargetPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolPatch : LoadBalancerPoolPatch struct +type LoadBalancerPoolPatch struct { + // The load balancing algorithm. + Algorithm *string `json:"algorithm,omitempty"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitorPatch `json:"health_monitor,omitempty"` + + // The name for this load balancer pool. The name must not be used by another pool for the load balancer. + Name *string `json:"name,omitempty"` + + // The protocol for this load balancer pool. + // + // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http` and + // `https`. + // + // If this pool is associated with a load balancer listener, the specified protocol must match, or be compatible with + // the listener's protocol. At present, the compatible protocols are `http` and `https`. + Protocol *string `json:"protocol,omitempty"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol,omitempty"` + + // The session persistence of this pool. + SessionPersistence *LoadBalancerPoolSessionPersistencePatch `json:"session_persistence,omitempty"` +} + +// Constants associated with the LoadBalancerPoolPatch.Algorithm property. +// The load balancing algorithm. +const ( + LoadBalancerPoolPatchAlgorithmLeastConnectionsConst = "least_connections" + LoadBalancerPoolPatchAlgorithmRoundRobinConst = "round_robin" + LoadBalancerPoolPatchAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the LoadBalancerPoolPatch.Protocol property. +// The protocol for this load balancer pool. +// +// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http` and +// `https`. +// +// If this pool is associated with a load balancer listener, the specified protocol must match, or be compatible with +// the listener's protocol. At present, the compatible protocols are `http` and `https`. +const ( + LoadBalancerPoolPatchProtocolHTTPConst = "http" + LoadBalancerPoolPatchProtocolHTTPSConst = "https" + LoadBalancerPoolPatchProtocolTCPConst = "tcp" + LoadBalancerPoolPatchProtocolUDPConst = "udp" +) + +// Constants associated with the LoadBalancerPoolPatch.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + LoadBalancerPoolPatchProxyProtocolDisabledConst = "disabled" + LoadBalancerPoolPatchProxyProtocolV1Const = "v1" + LoadBalancerPoolPatchProxyProtocolV2Const = "v2" +) + +// UnmarshalLoadBalancerPoolPatch unmarshals an instance of LoadBalancerPoolPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolPatch) + err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// LoadBalancerPoolPrototype : LoadBalancerPoolPrototype struct +type LoadBalancerPoolPrototype struct { + // The load balancing algorithm. + Algorithm *string `json:"algorithm" validate:"required"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitorPrototype `json:"health_monitor" validate:"required"` + + // The members for this load balancer pool. For load balancers in the `network` family, the same `port` and `target` + // tuple cannot be shared by a pool member of any other load balancer in the same VPC. + Members []LoadBalancerPoolMemberPrototype `json:"members,omitempty"` + + // The name for this load balancer pool. The name must not be used by another pool for the load balancer. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if + // `udp_supported` is `true`). Load balancers in the + // `application` family support `tcp`, `http`, and `https`. + Protocol *string `json:"protocol" validate:"required"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol,omitempty"` + + // The session persistence of this pool. + SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` +} + +// Constants associated with the LoadBalancerPoolPrototype.Algorithm property. +// The load balancing algorithm. +const ( + LoadBalancerPoolPrototypeAlgorithmLeastConnectionsConst = "least_connections" + LoadBalancerPoolPrototypeAlgorithmRoundRobinConst = "round_robin" + LoadBalancerPoolPrototypeAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the LoadBalancerPoolPrototype.Protocol property. +// The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if +// `udp_supported` is `true`). Load balancers in the +// `application` family support `tcp`, `http`, and `https`. +const ( + LoadBalancerPoolPrototypeProtocolHTTPConst = "http" + LoadBalancerPoolPrototypeProtocolHTTPSConst = "https" + LoadBalancerPoolPrototypeProtocolTCPConst = "tcp" + LoadBalancerPoolPrototypeProtocolUDPConst = "udp" +) + +// Constants associated with the LoadBalancerPoolPrototype.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + LoadBalancerPoolPrototypeProxyProtocolDisabledConst = "disabled" + LoadBalancerPoolPrototypeProxyProtocolV1Const = "v1" + LoadBalancerPoolPrototypeProxyProtocolV2Const = "v2" +) + +// NewLoadBalancerPoolPrototype : Instantiate LoadBalancerPoolPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolPrototype(algorithm string, healthMonitor *LoadBalancerPoolHealthMonitorPrototype, protocol string) (_model *LoadBalancerPoolPrototype, err error) { + _model = &LoadBalancerPoolPrototype{ + Algorithm: core.StringPtr(algorithm), + HealthMonitor: healthMonitor, + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolPrototype unmarshals an instance of LoadBalancerPoolPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolPrototype) + err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolReference : LoadBalancerPoolReference struct +type LoadBalancerPoolReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` + + // The name for this load balancer pool. The name is unique across all pools for the load balancer. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalLoadBalancerPoolReference unmarshals an instance of LoadBalancerPoolReference from the specified map of raw messages. +func UnmarshalLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerPoolReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerPoolReferenceDeleted unmarshals an instance of LoadBalancerPoolReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerPoolReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolSessionPersistence : LoadBalancerPoolSessionPersistence struct +type LoadBalancerPoolSessionPersistence struct { + // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not + // allowed. + CookieName *string `json:"cookie_name,omitempty"` + + // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` + // protocols. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerPoolSessionPersistence.Type property. +// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` +// protocols. +const ( + LoadBalancerPoolSessionPersistenceTypeAppCookieConst = "app_cookie" + LoadBalancerPoolSessionPersistenceTypeHTTPCookieConst = "http_cookie" + LoadBalancerPoolSessionPersistenceTypeSourceIPConst = "source_ip" +) + +// UnmarshalLoadBalancerPoolSessionPersistence unmarshals an instance of LoadBalancerPoolSessionPersistence from the specified map of raw messages. +func UnmarshalLoadBalancerPoolSessionPersistence(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolSessionPersistence) + err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolSessionPersistencePatch : The session persistence configuration. Specify `null` to remove any existing session persistence configuration. +type LoadBalancerPoolSessionPersistencePatch struct { + // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not + // allowed. + CookieName *string `json:"cookie_name,omitempty"` + + // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` + // protocols. + Type *string `json:"type,omitempty"` +} + +// Constants associated with the LoadBalancerPoolSessionPersistencePatch.Type property. +// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` +// protocols. +const ( + LoadBalancerPoolSessionPersistencePatchTypeAppCookieConst = "app_cookie" + LoadBalancerPoolSessionPersistencePatchTypeHTTPCookieConst = "http_cookie" + LoadBalancerPoolSessionPersistencePatchTypeSourceIPConst = "source_ip" +) + +// UnmarshalLoadBalancerPoolSessionPersistencePatch unmarshals an instance of LoadBalancerPoolSessionPersistencePatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolSessionPersistencePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolSessionPersistencePatch) + err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolSessionPersistencePrototype : LoadBalancerPoolSessionPersistencePrototype struct +type LoadBalancerPoolSessionPersistencePrototype struct { + // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not + // allowed. + CookieName *string `json:"cookie_name,omitempty"` + + // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` + // protocols. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerPoolSessionPersistencePrototype.Type property. +// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` +// protocols. +const ( + LoadBalancerPoolSessionPersistencePrototypeTypeAppCookieConst = "app_cookie" + LoadBalancerPoolSessionPersistencePrototypeTypeHTTPCookieConst = "http_cookie" + LoadBalancerPoolSessionPersistencePrototypeTypeSourceIPConst = "source_ip" +) + +// NewLoadBalancerPoolSessionPersistencePrototype : Instantiate LoadBalancerPoolSessionPersistencePrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolSessionPersistencePrototype(typeVar string) (_model *LoadBalancerPoolSessionPersistencePrototype, err error) { + _model = &LoadBalancerPoolSessionPersistencePrototype{ + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolSessionPersistencePrototype unmarshals an instance of LoadBalancerPoolSessionPersistencePrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolSessionPersistencePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolSessionPersistencePrototype) + err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPrivateIpsItem : LoadBalancerPrivateIpsItem struct +type LoadBalancerPrivateIpsItem struct { + // The IP address. + // + // If the address has not yet been selected, the value will be `0.0.0.0`. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` + + // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the LoadBalancerPrivateIpsItem.ResourceType property. +// The resource type. +const ( + LoadBalancerPrivateIpsItemResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" +) + +// UnmarshalLoadBalancerPrivateIpsItem unmarshals an instance of LoadBalancerPrivateIpsItem from the specified map of raw messages. +func UnmarshalLoadBalancerPrivateIpsItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPrivateIpsItem) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfile : LoadBalancerProfile struct +type LoadBalancerProfile struct { + // The product family this load balancer profile belongs to. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the + // unexpected property value was encountered. + Family *string `json:"family" validate:"required"` + + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` + + InstanceGroupsSupported LoadBalancerProfileInstanceGroupsSupportedIntf `json:"instance_groups_supported" validate:"required"` + + // Indicates which logging type(s) are supported for a load balancer with this profile. + LoggingSupported *LoadBalancerProfileLoggingSupported `json:"logging_supported" validate:"required"` + + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` + + RouteModeSupported LoadBalancerProfileRouteModeSupportedIntf `json:"route_mode_supported" validate:"required"` + + SecurityGroupsSupported LoadBalancerProfileSecurityGroupsSupportedIntf `json:"security_groups_supported" validate:"required"` + + UDPSupported LoadBalancerProfileUDPSupportedIntf `json:"udp_supported" validate:"required"` +} + +// Constants associated with the LoadBalancerProfile.Family property. +// The product family this load balancer profile belongs to. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the +// unexpected property value was encountered. +const ( + LoadBalancerProfileFamilyApplicationConst = "application" + LoadBalancerProfileFamilyNetworkConst = "network" +) + +// UnmarshalLoadBalancerProfile unmarshals an instance of LoadBalancerProfile from the specified map of raw messages. +func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfile) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_groups_supported", &obj.InstanceGroupsSupported, UnmarshalLoadBalancerProfileInstanceGroupsSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "logging_supported", &obj.LoggingSupported, UnmarshalLoadBalancerProfileLoggingSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "route_mode_supported", &obj.RouteModeSupported, UnmarshalLoadBalancerProfileRouteModeSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups_supported", &obj.SecurityGroupsSupported, UnmarshalLoadBalancerProfileSecurityGroupsSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "udp_supported", &obj.UDPSupported, UnmarshalLoadBalancerProfileUDPSupported) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileCollection : LoadBalancerProfileCollection struct +type LoadBalancerProfileCollection struct { + // A link to the first page of resources. + First *LoadBalancerProfileCollectionFirst `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"` + + // Collection of load balancer profiles. + Profiles []LoadBalancerProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalLoadBalancerProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *LoadBalancerProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 +// - LoadBalancerProfileIdentityByHref +type LoadBalancerProfileIdentity struct { + // The globally unique name for this load balancer profile. + Name *string `json:"name,omitempty"` + + // The URL for this load balancer profile. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerProfileIdentity) isaLoadBalancerProfileIdentity() bool { + return true +} + +type LoadBalancerProfileIdentityIntf interface { + isaLoadBalancerProfileIdentity() bool +} + +// UnmarshalLoadBalancerProfileIdentity unmarshals an instance of LoadBalancerProfileIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileInstanceGroupsSupported : LoadBalancerProfileInstanceGroupsSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileInstanceGroupsSupportedFixed +// - LoadBalancerProfileInstanceGroupsSupportedDependent +type LoadBalancerProfileInstanceGroupsSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileInstanceGroupsSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileInstanceGroupsSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileInstanceGroupsSupported) isaLoadBalancerProfileInstanceGroupsSupported() bool { + return true +} + +type LoadBalancerProfileInstanceGroupsSupportedIntf interface { + isaLoadBalancerProfileInstanceGroupsSupported() bool +} + +// UnmarshalLoadBalancerProfileInstanceGroupsSupported unmarshals an instance of LoadBalancerProfileInstanceGroupsSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileInstanceGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileInstanceGroupsSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileLoggingSupported : Indicates which logging type(s) are supported for a load balancer with this profile. +type LoadBalancerProfileLoggingSupported struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported logging type(s) for a load balancer with this profile. + Value []string `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileLoggingSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileLoggingSupportedTypeFixedConst = "fixed" +) + +// UnmarshalLoadBalancerProfileLoggingSupported unmarshals an instance of LoadBalancerProfileLoggingSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileLoggingSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileLoggingSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileReference : LoadBalancerProfileReference struct +type LoadBalancerProfileReference struct { + // The product family this load balancer profile belongs to. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the + // unexpected property value was encountered. + Family *string `json:"family" validate:"required"` + + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileReference.Family property. +// The product family this load balancer profile belongs to. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the +// unexpected property value was encountered. +const ( + LoadBalancerProfileReferenceFamilyApplicationConst = "application" + LoadBalancerProfileReferenceFamilyNetworkConst = "network" +) + +// UnmarshalLoadBalancerProfileReference unmarshals an instance of LoadBalancerProfileReference from the specified map of raw messages. +func UnmarshalLoadBalancerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileReference) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileRouteModeSupported : LoadBalancerProfileRouteModeSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileRouteModeSupportedFixed +// - LoadBalancerProfileRouteModeSupportedDependent +type LoadBalancerProfileRouteModeSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileRouteModeSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileRouteModeSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileRouteModeSupported) isaLoadBalancerProfileRouteModeSupported() bool { + return true +} + +type LoadBalancerProfileRouteModeSupportedIntf interface { + isaLoadBalancerProfileRouteModeSupported() bool +} + +// UnmarshalLoadBalancerProfileRouteModeSupported unmarshals an instance of LoadBalancerProfileRouteModeSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileRouteModeSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileRouteModeSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileSecurityGroupsSupported : LoadBalancerProfileSecurityGroupsSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileSecurityGroupsSupportedFixed +// - LoadBalancerProfileSecurityGroupsSupportedDependent +type LoadBalancerProfileSecurityGroupsSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileSecurityGroupsSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileSecurityGroupsSupported) isaLoadBalancerProfileSecurityGroupsSupported() bool { + return true +} + +type LoadBalancerProfileSecurityGroupsSupportedIntf interface { + isaLoadBalancerProfileSecurityGroupsSupported() bool +} + +// UnmarshalLoadBalancerProfileSecurityGroupsSupported unmarshals an instance of LoadBalancerProfileSecurityGroupsSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileUDPSupported : LoadBalancerProfileUDPSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileUDPSupportedFixed +// - LoadBalancerProfileUDPSupportedDependent +type LoadBalancerProfileUDPSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileUDPSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileUDPSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileUDPSupported) isaLoadBalancerProfileUDPSupported() bool { + return true +} + +type LoadBalancerProfileUDPSupportedIntf interface { + isaLoadBalancerProfileUDPSupported() bool +} + +// UnmarshalLoadBalancerProfileUDPSupported unmarshals an instance of LoadBalancerProfileUDPSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileUDPSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileUDPSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type LoadBalancerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerReferenceDeleted unmarshals an instance of LoadBalancerReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerStatistics : LoadBalancerStatistics struct +type LoadBalancerStatistics struct { + // Number of active connections of this load balancer. + ActiveConnections *int64 `json:"active_connections" validate:"required"` + + // Current connection rate (connections per second) of this load balancer. + ConnectionRate *float32 `json:"connection_rate" validate:"required"` + + // Total number of data processed (bytes) of this load balancer within current calendar month. + DataProcessedThisMonth *int64 `json:"data_processed_this_month" validate:"required"` + + // Current throughput (Mbps) of this load balancer. + Throughput *float32 `json:"throughput" validate:"required"` +} + +// UnmarshalLoadBalancerStatistics unmarshals an instance of LoadBalancerStatistics from the specified map of raw messages. +func UnmarshalLoadBalancerStatistics(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerStatistics) + err = core.UnmarshalPrimitive(m, "active_connections", &obj.ActiveConnections) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_rate", &obj.ConnectionRate) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "data_processed_this_month", &obj.DataProcessedThisMonth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "throughput", &obj.Throughput) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACL : NetworkACL struct +type NetworkACL struct { + // The date and time that the network ACL was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` + + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` + + // The name for this network ACL. The name is unique across all network ACLs for the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this network ACL. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The ordered rules for this network ACL. If no rules exist, all traffic will be denied. + Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` + + // The subnets to which this network ACL is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The VPC this network ACL resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalNetworkACL unmarshals an instance of NetworkACL from the specified map of raw messages. +func UnmarshalNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACL) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLCollection : NetworkACLCollection struct +type NetworkACLCollection struct { + // A link to the first page of resources. + First *NetworkACLCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of network ACLs. + NetworkAcls []NetworkACL `json:"network_acls" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *NetworkACLCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acls", &obj.NetworkAcls, UnmarshalNetworkACL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *NetworkACLCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 +// - NetworkACLIdentityByCRN +// - NetworkACLIdentityByHref +type NetworkACLIdentity struct { + // The unique identifier for this network ACL. + ID *string `json:"id,omitempty"` + + // The CRN for this network ACL. + CRN *string `json:"crn,omitempty"` + + // The URL for this network ACL. + Href *string `json:"href,omitempty"` +} + +func (*NetworkACLIdentity) isaNetworkACLIdentity() bool { + return true +} + +type NetworkACLIdentityIntf interface { + isaNetworkACLIdentity() bool +} + +// UnmarshalNetworkACLIdentity unmarshals an instance of NetworkACLIdentity from the specified map of raw messages. +func UnmarshalNetworkACLIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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. + Name *string `json:"name,omitempty"` +} + +// UnmarshalNetworkACLPatch unmarshals an instance of NetworkACLPatch from the specified map of raw messages. +func UnmarshalNetworkACLPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// NetworkACLPrototype : NetworkACLPrototype struct +// Models which "extend" this model: +// - NetworkACLPrototypeNetworkACLByRules +// - NetworkACLPrototypeNetworkACLBySourceNetworkACL +type NetworkACLPrototype struct { + // The name for this network ACL. The name must not be used by another network ACL for the VPC. 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"` + + // The VPC this network ACL will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, + // resulting in all traffic being denied. + Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` + + // Network ACL to copy rules from. + SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl,omitempty"` +} + +func (*NetworkACLPrototype) isaNetworkACLPrototype() bool { + return true +} + +type NetworkACLPrototypeIntf interface { + isaNetworkACLPrototype() bool +} + +// UnmarshalNetworkACLPrototype unmarshals an instance of NetworkACLPrototype from the specified map of raw messages. +func UnmarshalNetworkACLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLReference : NetworkACLReference struct +type NetworkACLReference struct { + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkACLReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` + + // The name for this network ACL. The name is unique across all network ACLs for the VPC. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalNetworkACLReference unmarshals an instance of NetworkACLReference from the specified map of raw messages. +func UnmarshalNetworkACLReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkACLReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkACLReferenceDeleted unmarshals an instance of NetworkACLReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkACLReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRule : NetworkACLRule struct +// Models which "extend" this model: +// - NetworkACLRuleNetworkACLRuleProtocolTcpudp +// - NetworkACLRuleNetworkACLRuleProtocolIcmp +// - NetworkACLRuleNetworkACLRuleProtocolAll +type NetworkACLRule struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRule.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleActionAllowConst = "allow" + NetworkACLRuleActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRule.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleDirectionInboundConst = "inbound" + NetworkACLRuleDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRule.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRule.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleProtocolAllConst = "all" + NetworkACLRuleProtocolIcmpConst = "icmp" + NetworkACLRuleProtocolTCPConst = "tcp" + NetworkACLRuleProtocolUDPConst = "udp" +) + +func (*NetworkACLRule) isaNetworkACLRule() bool { + return true +} + +type NetworkACLRuleIntf interface { + isaNetworkACLRule() bool +} + +// UnmarshalNetworkACLRule unmarshals an instance of NetworkACLRule from the specified map of raw messages. +func UnmarshalNetworkACLRule(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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRuleBeforePatch : The rule to move this rule immediately before. +// +// Specify `null` to move this rule after all existing rules. +// Models which "extend" this model: +// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID +// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref +type NetworkACLRuleBeforePatch struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id,omitempty"` + + // The URL for this network ACL rule. + Href *string `json:"href,omitempty"` +} + +func (*NetworkACLRuleBeforePatch) isaNetworkACLRuleBeforePatch() bool { + return true +} + +type NetworkACLRuleBeforePatchIntf interface { + isaNetworkACLRuleBeforePatch() bool +} + +// UnmarshalNetworkACLRuleBeforePatch unmarshals an instance of NetworkACLRuleBeforePatch from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePrototype : The rule to insert this rule immediately before. +// +// If unspecified, this rule will be inserted after all existing rules. +// Models which "extend" this model: +// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID +// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref +type NetworkACLRuleBeforePrototype struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id,omitempty"` + + // The URL for this network ACL rule. + Href *string `json:"href,omitempty"` +} + +func (*NetworkACLRuleBeforePrototype) isaNetworkACLRuleBeforePrototype() bool { + return true +} + +type NetworkACLRuleBeforePrototypeIntf interface { + isaNetworkACLRuleBeforePrototype() bool +} + +// UnmarshalNetworkACLRuleBeforePrototype unmarshals an instance of NetworkACLRuleBeforePrototype from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleCollection : NetworkACLRuleCollection struct +type NetworkACLRuleCollection struct { + // A link to the first page of resources. + First *NetworkACLRuleCollectionFirst `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"` + + // Ordered collection of network ACL rules. + Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLRuleCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *NetworkACLRuleCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItem : NetworkACLRuleItem struct +// Models which "extend" this model: +// - NetworkACLRuleItemNetworkACLRuleProtocolTcpudp +// - NetworkACLRuleItemNetworkACLRuleProtocolIcmp +// - NetworkACLRuleItemNetworkACLRuleProtocolAll +type NetworkACLRuleItem struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always + // refers to the next item in the collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRuleItem.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemActionAllowConst = "allow" + NetworkACLRuleItemActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItem.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemDirectionInboundConst = "inbound" + NetworkACLRuleItemDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItem.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItem.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemProtocolAllConst = "all" + NetworkACLRuleItemProtocolIcmpConst = "icmp" + NetworkACLRuleItemProtocolTCPConst = "tcp" + NetworkACLRuleItemProtocolUDPConst = "udp" +) + +func (*NetworkACLRuleItem) isaNetworkACLRuleItem() bool { + return true +} + +type NetworkACLRuleItemIntf interface { + isaNetworkACLRuleItem() bool +} + +// UnmarshalNetworkACLRuleItem unmarshals an instance of NetworkACLRuleItem from the specified map of raw messages. +func UnmarshalNetworkACLRuleItem(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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRulePatch : NetworkACLRulePatch struct +type NetworkACLRulePatch struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action,omitempty"` + + // The rule to move this rule immediately before. + // + // Specify `null` to move this rule after all existing rules. + Before NetworkACLRuleBeforePatchIntf `json:"before,omitempty"` + + // The ICMP traffic code to match. If set, `type` must also be set. + // + // Specify `null` to remove an existing ICMP traffic code. + Code *int64 `json:"code,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination,omitempty"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The direction of traffic to match. + Direction *string `json:"direction,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. + Name *string `json:"name,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic type to match. + // + // Specify `null` to remove an existing ICMP traffic type value. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePatch.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePatchActionAllowConst = "allow" + NetworkACLRulePatchActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePatch.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePatchDirectionInboundConst = "inbound" + NetworkACLRulePatchDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePatch.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePatchProtocolAllConst = "all" + NetworkACLRulePatchProtocolIcmpConst = "icmp" + NetworkACLRulePatchProtocolTCPConst = "tcp" + NetworkACLRulePatchProtocolUDPConst = "udp" +) + +// UnmarshalNetworkACLRulePatch unmarshals an instance of NetworkACLRulePatch from the specified map of raw messages. +func UnmarshalNetworkACLRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePatch) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// NetworkACLRulePrototype : NetworkACLRulePrototype struct +// Models which "extend" this model: +// - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype +// - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype +// - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype +type NetworkACLRulePrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule to insert this rule immediately before. + // + // If unspecified, this rule will be inserted after all existing rules. + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeProtocolAllConst = "all" + NetworkACLRulePrototypeProtocolIcmpConst = "icmp" + NetworkACLRulePrototypeProtocolTCPConst = "tcp" + NetworkACLRulePrototypeProtocolUDPConst = "udp" +) + +func (*NetworkACLRulePrototype) isaNetworkACLRulePrototype() bool { + return true +} + +type NetworkACLRulePrototypeIntf interface { + isaNetworkACLRulePrototype() bool +} + +// UnmarshalNetworkACLRulePrototype unmarshals an instance of NetworkACLRulePrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototype(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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRulePrototypeNetworkACLContext : NetworkACLRulePrototypeNetworkACLContext struct +// Models which "extend" this model: +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype +type NetworkACLRulePrototypeNetworkACLContext struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextProtocolAllConst = "all" + NetworkACLRulePrototypeNetworkACLContextProtocolIcmpConst = "icmp" + NetworkACLRulePrototypeNetworkACLContextProtocolTCPConst = "tcp" + NetworkACLRulePrototypeNetworkACLContextProtocolUDPConst = "udp" +) + +func (*NetworkACLRulePrototypeNetworkACLContext) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +type NetworkACLRulePrototypeNetworkACLContextIntf interface { + isaNetworkACLRulePrototypeNetworkACLContext() bool +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContext unmarshals an instance of NetworkACLRulePrototypeNetworkACLContext from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContext(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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRuleReference : NetworkACLRuleReference struct +type NetworkACLRuleReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkACLRuleReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalNetworkACLRuleReference unmarshals an instance of NetworkACLRuleReference from the specified map of raw messages. +func UnmarshalNetworkACLRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLRuleReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkACLRuleReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkACLRuleReferenceDeleted unmarshals an instance of NetworkACLRuleReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterface : NetworkInterface struct +type NetworkInterface struct { + // Indicates whether source IP spoofing is allowed on this instance network interface. + // + // If this instance 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 instance network interface was created. + // + // If this instance 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"` + + // The floating IPs associated with this instance network interface. + // + // If this instance 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 instance network interface. + // + // If this instance 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 instance network interface. + // + // If this instance 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 name for this instance network interface. + // + // If this instance 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 instance network interface port speed in Mbps. + // + // If this instance 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 instance network interface. + // + // If this instance 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 instance network interface. + // + // If this instance 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 instance network interface type. + // + // If this instance 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"` +} + +// Constants associated with the NetworkInterface.ResourceType property. +// The resource type. +const ( + NetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the NetworkInterface.Status property. +// The status of the instance network interface. +// +// If this instance 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 ( + NetworkInterfaceStatusAvailableConst = "available" + NetworkInterfaceStatusDeletingConst = "deleting" + NetworkInterfaceStatusFailedConst = "failed" + NetworkInterfaceStatusPendingConst = "pending" +) + +// Constants associated with the NetworkInterface.Type property. +// The instance network interface type. +// +// If this instance 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 ( + NetworkInterfaceTypePrimaryConst = "primary" + NetworkInterfaceTypeSecondaryConst = "secondary" +) + +// UnmarshalNetworkInterface unmarshals an instance of NetworkInterface from the specified map of raw messages. +func UnmarshalNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceBareMetalServerContextReference : NetworkInterfaceBareMetalServerContextReference struct +type NetworkInterfaceBareMetalServerContextReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceBareMetalServerContextReferenceDeleted `json:"deleted,omitempty"` + + // 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 name for this bare metal server network interface. + Name *string `json:"name" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the NetworkInterfaceBareMetalServerContextReference.ResourceType property. +// The resource type. +const ( + NetworkInterfaceBareMetalServerContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// UnmarshalNetworkInterfaceBareMetalServerContextReference unmarshals an instance of NetworkInterfaceBareMetalServerContextReference from the specified map of raw messages. +func UnmarshalNetworkInterfaceBareMetalServerContextReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceBareMetalServerContextReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceBareMetalServerContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceBareMetalServerContextReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted unmarshals an instance of NetworkInterfaceBareMetalServerContextReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceBareMetalServerContextReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototype : NetworkInterfaceIPPrototype struct +// Models which "extend" this model: +// - NetworkInterfaceIPPrototypeReservedIPIdentity +// - NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext +type NetworkInterfaceIPPrototype struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` + + // 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*NetworkInterfaceIPPrototype) isaNetworkInterfaceIPPrototype() bool { + return true +} + +type NetworkInterfaceIPPrototypeIntf interface { + isaNetworkInterfaceIPPrototype() bool +} + +// UnmarshalNetworkInterfaceIPPrototype unmarshals an instance of NetworkInterfaceIPPrototype from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceInstanceContextReference : NetworkInterfaceInstanceContextReference struct +type NetworkInterfaceInstanceContextReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceInstanceContextReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance network interface. + // + // If this instance 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 instance network interface. + // + // If this instance 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 name for this instance network interface. + Name *string `json:"name" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the NetworkInterfaceInstanceContextReference.ResourceType property. +// The resource type. +const ( + NetworkInterfaceInstanceContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// UnmarshalNetworkInterfaceInstanceContextReference unmarshals an instance of NetworkInterfaceInstanceContextReference from the specified map of raw messages. +func UnmarshalNetworkInterfaceInstanceContextReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceInstanceContextReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceInstanceContextReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceInstanceContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceInstanceContextReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceInstanceContextReferenceDeleted unmarshals an instance of NetworkInterfaceInstanceContextReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceInstanceContextReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfacePatch : NetworkInterfacePatch struct +type NetworkInterfacePatch struct { + // Indicates whether source IP spoofing is allowed on this instance network interface. + // + // If this instance 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 name for the instance network interface. The name must not be used by another network interface on the virtual + // server instance. + Name *string `json:"name,omitempty"` +} + +// UnmarshalNetworkInterfacePatch unmarshals an instance of NetworkInterfacePatch from the specified map of raw messages. +func UnmarshalNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// NetworkInterfacePrototype : NetworkInterfacePrototype struct +type NetworkInterfacePrototype struct { + // Indicates whether source IP spoofing is allowed on this instance network interface. + // + // If this instance 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 name for the instance network interface. The name must not be used by another network interface on the virtual + // server instance. 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 instance 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 instance 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 instance 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"` +} + +// NewNetworkInterfacePrototype : Instantiate NetworkInterfacePrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *NetworkInterfacePrototype, err error) { + _model = &NetworkInterfacePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalNetworkInterfacePrototype unmarshals an instance of NetworkInterfacePrototype from the specified map of raw messages. +func UnmarshalNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceReferenceDeleted unmarshals an instance of NetworkInterfaceReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type NetworkInterfaceReferenceTargetContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of NetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceUnpaginatedCollection : NetworkInterfaceUnpaginatedCollection struct +type NetworkInterfaceUnpaginatedCollection struct { + // Collection of instance network interfaces. + NetworkInterfaces []NetworkInterface `json:"network_interfaces" validate:"required"` +} + +// UnmarshalNetworkInterfaceUnpaginatedCollection unmarshals an instance of NetworkInterfaceUnpaginatedCollection from the specified map of raw messages. +func UnmarshalNetworkInterfaceUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceUnpaginatedCollection) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterface) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ObsoleteImageOptions : The ObsoleteImage options. +type ObsoleteImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewObsoleteImageOptions : Instantiate ObsoleteImageOptions +func (*VpcV1) NewObsoleteImageOptions(id string) *ObsoleteImageOptions { + return &ObsoleteImageOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ObsoleteImageOptions) SetID(id string) *ObsoleteImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ObsoleteImageOptions) SetHeaders(param map[string]string) *ObsoleteImageOptions { + options.Headers = param + return options +} + +// OperatingSystem : OperatingSystem struct +type OperatingSystem struct { + // The operating system architecture. + Architecture *string `json:"architecture" validate:"required"` + + // Images with this operating system can only be used on dedicated hosts or dedicated host groups. + DedicatedHostOnly *bool `json:"dedicated_host_only" validate:"required"` + + // A unique, display-friendly name for the operating system. + DisplayName *string `json:"display_name" validate:"required"` + + // The software family for this operating system. + Family *string `json:"family" validate:"required"` + + // The URL for this operating system. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this operating system. + Name *string `json:"name" validate:"required"` + + // The vendor of the operating system. + Vendor *string `json:"vendor" validate:"required"` + + // The major release version of this operating system. + Version *string `json:"version" validate:"required"` +} + +// UnmarshalOperatingSystem unmarshals an instance of OperatingSystem from the specified map of raw messages. +func UnmarshalOperatingSystem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystem) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dedicated_host_only", &obj.DedicatedHostOnly) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vendor", &obj.Vendor) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemCollection : OperatingSystemCollection struct +type OperatingSystemCollection struct { + // A link to the first page of resources. + First *OperatingSystemCollectionFirst `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"` + + // Collection of operating systems. + OperatingSystems []OperatingSystem `json:"operating_systems" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalOperatingSystemCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_systems", &obj.OperatingSystems, UnmarshalOperatingSystem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *OperatingSystemCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 +// - OperatingSystemIdentityByHref +type OperatingSystemIdentity struct { + // The globally unique name for this operating system. + Name *string `json:"name,omitempty"` + + // The URL for this operating system. + Href *string `json:"href,omitempty"` +} + +func (*OperatingSystemIdentity) isaOperatingSystemIdentity() bool { + return true +} + +type OperatingSystemIdentityIntf interface { + isaOperatingSystemIdentity() bool +} + +// UnmarshalOperatingSystemIdentity unmarshals an instance of OperatingSystemIdentity from the specified map of raw messages. +func UnmarshalOperatingSystemIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PlacementGroup : PlacementGroup struct +type PlacementGroup struct { + // The date and time that the placement group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this placement group. + CRN *string `json:"crn" validate:"required"` + + // The URL for this placement group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this placement group. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the placement group. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this placement group. The name is unique across all placement groups in the region. + Name *string `json:"name" validate:"required"` + + // The resource group for this placement group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The strategy for this placement group + // - `host_spread`: place on different compute hosts + // - `power_spread`: place on compute hosts that use different power sources + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the + // unexpected strategy was encountered. + Strategy *string `json:"strategy" validate:"required"` +} + +// Constants associated with the PlacementGroup.LifecycleState property. +// The lifecycle state of the placement group. +const ( + PlacementGroupLifecycleStateDeletingConst = "deleting" + PlacementGroupLifecycleStateFailedConst = "failed" + PlacementGroupLifecycleStatePendingConst = "pending" + PlacementGroupLifecycleStateStableConst = "stable" + PlacementGroupLifecycleStateSuspendedConst = "suspended" + PlacementGroupLifecycleStateUpdatingConst = "updating" + PlacementGroupLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the PlacementGroup.ResourceType property. +// The resource type. +const ( + PlacementGroupResourceTypePlacementGroupConst = "placement_group" +) + +// Constants associated with the PlacementGroup.Strategy property. +// The strategy for this placement group +// - `host_spread`: place on different compute hosts +// - `power_spread`: place on compute hosts that use different power sources +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the +// unexpected strategy was encountered. +const ( + PlacementGroupStrategyHostSpreadConst = "host_spread" + PlacementGroupStrategyPowerSpreadConst = "power_spread" +) + +// UnmarshalPlacementGroup unmarshals an instance of PlacementGroup from the specified map of raw messages. +func UnmarshalPlacementGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroup) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "strategy", &obj.Strategy) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PlacementGroupCollection : PlacementGroupCollection struct +type PlacementGroupCollection struct { + // A link to the first page of resources. + First *PlacementGroupCollectionFirst `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"` + + // Collection of placement groups. + PlacementGroups []PlacementGroup `json:"placement_groups" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPlacementGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_groups", &obj.PlacementGroups, UnmarshalPlacementGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *PlacementGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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. + Name *string `json:"name,omitempty"` +} + +// UnmarshalPlacementGroupPatch unmarshals an instance of PlacementGroupPatch from the specified map of raw messages. +func UnmarshalPlacementGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroupPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// PlacementGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type PlacementGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalPlacementGroupReferenceDeleted unmarshals an instance of PlacementGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalPlacementGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlacementGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGateway : PublicGateway struct +type PublicGateway struct { + // The date and time that the public gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` + + // The floating IP bound to this public gateway. + FloatingIP *PublicGatewayFloatingIP `json:"floating_ip" validate:"required"` + + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` + + // The name for this public gateway. The name is unique across all public gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this public gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of this public gateway. + Status *string `json:"status" validate:"required"` + + // The VPC this public gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this public gateway resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the PublicGateway.ResourceType property. +// The resource type. +const ( + PublicGatewayResourceTypePublicGatewayConst = "public_gateway" +) + +// Constants associated with the PublicGateway.Status property. +// The status of this public gateway. +const ( + PublicGatewayStatusAvailableConst = "available" + PublicGatewayStatusDeletingConst = "deleting" + PublicGatewayStatusFailedConst = "failed" + PublicGatewayStatusPendingConst = "pending" +) + +// UnmarshalPublicGateway unmarshals an instance of PublicGateway from the specified map of raw messages. +func UnmarshalPublicGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGateway) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ip", &obj.FloatingIP, UnmarshalPublicGatewayFloatingIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayCollection : PublicGatewayCollection struct +type PublicGatewayCollection struct { + // A link to the first page of resources. + First *PublicGatewayCollectionFirst `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"` + + // Collection of public gateways. + PublicGateways []PublicGateway `json:"public_gateways" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPublicGatewayCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateways", &obj.PublicGateways, UnmarshalPublicGateway) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *PublicGatewayCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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. + Address *string `json:"address" validate:"required"` + + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` + + // The name for this floating IP. The name is unique across all floating IPs in the region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalPublicGatewayFloatingIP unmarshals an instance of PublicGatewayFloatingIP from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototype : PublicGatewayFloatingIPPrototype struct +// Models which "extend" this model: +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentity +// - PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext +type PublicGatewayFloatingIPPrototype struct { + // The unique identifier for this floating IP. + ID *string `json:"id,omitempty"` + + // The CRN for this floating IP. + CRN *string `json:"crn,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href,omitempty"` + + // The globally unique IP address. + Address *string `json:"address,omitempty"` + + // The name for this floating IP. The name must not be used by another floating IP in the region. 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"` +} + +func (*PublicGatewayFloatingIPPrototype) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +type PublicGatewayFloatingIPPrototypeIntf interface { + isaPublicGatewayFloatingIPPrototype() bool +} + +// UnmarshalPublicGatewayFloatingIPPrototype unmarshals an instance of PublicGatewayFloatingIPPrototype from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentity : Identifies a public gateway by a unique property. +// Models which "extend" this model: +// - PublicGatewayIdentityPublicGatewayIdentityByID +// - PublicGatewayIdentityPublicGatewayIdentityByCRN +// - PublicGatewayIdentityPublicGatewayIdentityByHref +type PublicGatewayIdentity struct { + // The unique identifier for this public gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this public gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href,omitempty"` +} + +func (*PublicGatewayIdentity) isaPublicGatewayIdentity() bool { + return true +} + +type PublicGatewayIdentityIntf interface { + isaPublicGatewayIdentity() bool +} + +// UnmarshalPublicGatewayIdentity unmarshals an instance of PublicGatewayIdentity from the specified map of raw messages. +func UnmarshalPublicGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayPatch : PublicGatewayPatch struct +type PublicGatewayPatch struct { + // The name for this public gateway. The name must not be used by another public gateway in the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalPublicGatewayPatch unmarshals an instance of PublicGatewayPatch from the specified map of raw messages. +func UnmarshalPublicGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// PublicGatewayReference : PublicGatewayReference struct +type PublicGatewayReference struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` + + // The name for this public gateway. The name is unique across all public gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the PublicGatewayReference.ResourceType property. +// The resource type. +const ( + PublicGatewayReferenceResourceTypePublicGatewayConst = "public_gateway" +) + +// UnmarshalPublicGatewayReference unmarshals an instance of PublicGatewayReference from the specified map of raw messages. +func UnmarshalPublicGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPublicGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type PublicGatewayReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalPublicGatewayReferenceDeleted unmarshals an instance of PublicGatewayReferenceDeleted from the specified map of raw messages. +func UnmarshalPublicGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Region : Region struct +type Region struct { + // The API endpoint for this region. + Endpoint *string `json:"endpoint" validate:"required"` + + // The URL for this region. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this region. + Name *string `json:"name" validate:"required"` + + // The availability status of this region. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the Region.Status property. +// The availability status of this region. +const ( + RegionStatusAvailableConst = "available" + RegionStatusUnavailableConst = "unavailable" +) + +// UnmarshalRegion unmarshals an instance of Region from the specified map of raw messages. +func UnmarshalRegion(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Region) + err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionCollection : RegionCollection struct +type RegionCollection struct { + // Collection of regions. + Regions []Region `json:"regions" validate:"required"` +} + +// UnmarshalRegionCollection unmarshals an instance of RegionCollection from the specified map of raw messages. +func UnmarshalRegionCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionCollection) + err = core.UnmarshalModel(m, "regions", &obj.Regions, UnmarshalRegion) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionIdentity : Identifies a region by a unique property. +// Models which "extend" this model: +// - RegionIdentityByName +// - RegionIdentityByHref +type RegionIdentity struct { + // The globally unique name for this region. + Name *string `json:"name,omitempty"` + + // The URL for this region. + Href *string `json:"href,omitempty"` +} + +func (*RegionIdentity) isaRegionIdentity() bool { + return true +} + +type RegionIdentityIntf interface { + isaRegionIdentity() bool +} + +// UnmarshalRegionIdentity unmarshals an instance of RegionIdentity from the specified map of raw messages. +func UnmarshalRegionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionReference : RegionReference struct +type RegionReference struct { + // The URL for this region. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalRegionReference unmarshals an instance of RegionReference from the specified map of raw messages. +func UnmarshalRegionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RemoveBareMetalServerNetworkInterfaceFloatingIPOptions : The RemoveBareMetalServerNetworkInterfaceFloatingIP options. +type RemoveBareMetalServerNetworkInterfaceFloatingIPOptions 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 +} + +// NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate RemoveBareMetalServerNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + return &RemoveBareMetalServerNetworkInterfaceFloatingIPOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// RemoveEndpointGatewayIPOptions : The RemoveEndpointGatewayIP options. +type RemoveEndpointGatewayIPOptions 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 +} + +// NewRemoveEndpointGatewayIPOptions : Instantiate RemoveEndpointGatewayIPOptions +func (*VpcV1) NewRemoveEndpointGatewayIPOptions(endpointGatewayID string, id string) *RemoveEndpointGatewayIPOptions { + return &RemoveEndpointGatewayIPOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + ID: core.StringPtr(id), + } +} + +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (_options *RemoveEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *RemoveEndpointGatewayIPOptions { + _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveEndpointGatewayIPOptions) SetID(id string) *RemoveEndpointGatewayIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveEndpointGatewayIPOptions) SetHeaders(param map[string]string) *RemoveEndpointGatewayIPOptions { + options.Headers = param + return options +} + +// RemoveInstanceNetworkInterfaceFloatingIPOptions : The RemoveInstanceNetworkInterfaceFloatingIP options. +type RemoveInstanceNetworkInterfaceFloatingIPOptions 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 +} + +// NewRemoveInstanceNetworkInterfaceFloatingIPOptions : Instantiate RemoveInstanceNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewRemoveInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + return &RemoveInstanceNetworkInterfaceFloatingIPOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// RemoveNetworkInterfaceFloatingIPOptions : The RemoveNetworkInterfaceFloatingIP options. +type RemoveNetworkInterfaceFloatingIPOptions 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 +} + +// NewRemoveNetworkInterfaceFloatingIPOptions : Instantiate RemoveNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewRemoveNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *RemoveNetworkInterfaceFloatingIPOptions { + return &RemoveNetworkInterfaceFloatingIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *RemoveNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *RemoveNetworkInterfaceFloatingIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// RemoveVirtualNetworkInterfaceIPOptions : The RemoveVirtualNetworkInterfaceIP options. +type RemoveVirtualNetworkInterfaceIPOptions 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 +} + +// NewRemoveVirtualNetworkInterfaceIPOptions : Instantiate RemoveVirtualNetworkInterfaceIPOptions +func (*VpcV1) NewRemoveVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *RemoveVirtualNetworkInterfaceIPOptions { + return &RemoveVirtualNetworkInterfaceIPOptions{ + VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID +func (_options *RemoveVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *RemoveVirtualNetworkInterfaceIPOptions { + _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveVirtualNetworkInterfaceIPOptions) SetID(id string) *RemoveVirtualNetworkInterfaceIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *RemoveVirtualNetworkInterfaceIPOptions { + options.Headers = param + return options +} + +// RemoveVPNGatewayConnectionsLocalCIDROptions : The RemoveVPNGatewayConnectionsLocalCIDR options. +type RemoveVPNGatewayConnectionsLocalCIDROptions 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 +} + +// NewRemoveVPNGatewayConnectionsLocalCIDROptions : Instantiate RemoveVPNGatewayConnectionsLocalCIDROptions +func (*VpcV1) NewRemoveVPNGatewayConnectionsLocalCIDROptions(vpnGatewayID string, id string, cidr string) *RemoveVPNGatewayConnectionsLocalCIDROptions { + return &RemoveVPNGatewayConnectionsLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDR: core.StringPtr(cidr), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionsLocalCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionsLocalCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDR : Allow user to set CIDR +func (_options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetCIDR(cidr string) *RemoveVPNGatewayConnectionsLocalCIDROptions { + _options.CIDR = core.StringPtr(cidr) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionsLocalCIDROptions { + options.Headers = param + return options +} + +// RemoveVPNGatewayConnectionsPeerCIDROptions : The RemoveVPNGatewayConnectionsPeerCIDR options. +type RemoveVPNGatewayConnectionsPeerCIDROptions 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 +} + +// NewRemoveVPNGatewayConnectionsPeerCIDROptions : Instantiate RemoveVPNGatewayConnectionsPeerCIDROptions +func (*VpcV1) NewRemoveVPNGatewayConnectionsPeerCIDROptions(vpnGatewayID string, id string, cidr string) *RemoveVPNGatewayConnectionsPeerCIDROptions { + return &RemoveVPNGatewayConnectionsPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDR: core.StringPtr(cidr), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionsPeerCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionsPeerCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDR : Allow user to set CIDR +func (_options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetCIDR(cidr string) *RemoveVPNGatewayConnectionsPeerCIDROptions { + _options.CIDR = core.StringPtr(cidr) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionsPeerCIDROptions { + options.Headers = param + return options +} + +// ReplaceLoadBalancerPoolMembersOptions : The ReplaceLoadBalancerPoolMembers options. +type ReplaceLoadBalancerPoolMembersOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The member prototype objects for this pool. + Members []LoadBalancerPoolMemberPrototype `json:"members" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceLoadBalancerPoolMembersOptions : Instantiate ReplaceLoadBalancerPoolMembersOptions +func (*VpcV1) NewReplaceLoadBalancerPoolMembersOptions(loadBalancerID string, poolID string, members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { + return &ReplaceLoadBalancerPoolMembersOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + Members: members, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *ReplaceLoadBalancerPoolMembersOptions) SetLoadBalancerID(loadBalancerID string) *ReplaceLoadBalancerPoolMembersOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *ReplaceLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *ReplaceLoadBalancerPoolMembersOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetMembers : Allow user to set Members +func (_options *ReplaceLoadBalancerPoolMembersOptions) SetMembers(members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { + _options.Members = members + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ReplaceLoadBalancerPoolMembersOptions { + options.Headers = param + return options +} + +// ReplaceSubnetNetworkACLOptions : The ReplaceSubnetNetworkACL options. +type ReplaceSubnetNetworkACLOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The network ACL identity. + NetworkACLIdentity NetworkACLIdentityIntf `json:"NetworkACLIdentity" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceSubnetNetworkACLOptions : Instantiate ReplaceSubnetNetworkACLOptions +func (*VpcV1) NewReplaceSubnetNetworkACLOptions(id string, networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { + return &ReplaceSubnetNetworkACLOptions{ + ID: core.StringPtr(id), + NetworkACLIdentity: networkACLIdentity, + } +} + +// SetID : Allow user to set ID +func (_options *ReplaceSubnetNetworkACLOptions) SetID(id string) *ReplaceSubnetNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetNetworkACLIdentity : Allow user to set NetworkACLIdentity +func (_options *ReplaceSubnetNetworkACLOptions) SetNetworkACLIdentity(networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { + _options.NetworkACLIdentity = networkACLIdentity + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceSubnetNetworkACLOptions) SetHeaders(param map[string]string) *ReplaceSubnetNetworkACLOptions { + options.Headers = param + return options +} + +// ReplaceSubnetRoutingTableOptions : The ReplaceSubnetRoutingTable options. +type ReplaceSubnetRoutingTableOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The routing table identity. + RoutingTableIdentity RoutingTableIdentityIntf `json:"RoutingTableIdentity" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceSubnetRoutingTableOptions : Instantiate ReplaceSubnetRoutingTableOptions +func (*VpcV1) NewReplaceSubnetRoutingTableOptions(id string, routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { + return &ReplaceSubnetRoutingTableOptions{ + ID: core.StringPtr(id), + RoutingTableIdentity: routingTableIdentity, + } +} + +// SetID : Allow user to set ID +func (_options *ReplaceSubnetRoutingTableOptions) SetID(id string) *ReplaceSubnetRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRoutingTableIdentity : Allow user to set RoutingTableIdentity +func (_options *ReplaceSubnetRoutingTableOptions) SetRoutingTableIdentity(routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { + _options.RoutingTableIdentity = routingTableIdentity + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceSubnetRoutingTableOptions) SetHeaders(param map[string]string) *ReplaceSubnetRoutingTableOptions { + options.Headers = param + return options +} + +// Reservation : Reservation struct +type Reservation struct { + // The affinity policy to use for this reservation: + // - `restricted`: The reservation must be manually requested + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + AffinityPolicy *string `json:"affinity_policy" validate:"required"` + + // The capacity configuration for this reservation + // + // If absent, this reservation has no assigned capacity. + Capacity *ReservationCapacity `json:"capacity,omitempty"` + + // The committed use configuration for this reservation. + // + // If absent, this reservation has no commitment for use. + CommittedUse *ReservationCommittedUse `json:"committed_use,omitempty"` + + // The date and time that the reservation was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this reservation. + CRN *string `json:"crn" validate:"required"` + + // The URL for this reservation. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reservation. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of this reservation. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this reservation. The name is unique across all reservations in the region. + Name *string `json:"name" validate:"required"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this reservation. + Profile *ReservationProfile `json:"profile" validate:"required"` + + // The resource group for this reservation. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the reservation. + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []ReservationStatusReason `json:"status_reasons" validate:"required"` + + // The zone for this reservation. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Reservation.AffinityPolicy property. +// The affinity policy to use for this reservation: +// - `restricted`: The reservation must be manually requested +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ReservationAffinityPolicyRestrictedConst = "restricted" +) + +// Constants associated with the Reservation.LifecycleState property. +// The lifecycle state of this reservation. +const ( + ReservationLifecycleStateDeletingConst = "deleting" + ReservationLifecycleStateFailedConst = "failed" + ReservationLifecycleStatePendingConst = "pending" + ReservationLifecycleStateStableConst = "stable" + ReservationLifecycleStateSuspendedConst = "suspended" + ReservationLifecycleStateUpdatingConst = "updating" + ReservationLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Reservation.ResourceType property. +// The resource type. +const ( + ReservationResourceTypeReservationConst = "reservation" +) + +// Constants associated with the Reservation.Status property. +// The status of the reservation. +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ReservationStatusActivatingConst = "activating" + ReservationStatusActiveConst = "active" + ReservationStatusDeactivatingConst = "deactivating" + ReservationStatusExpiredConst = "expired" + ReservationStatusFailedConst = "failed" + ReservationStatusInactiveConst = "inactive" +) + +// UnmarshalReservation unmarshals an instance of Reservation from the specified map of raw messages. +func UnmarshalReservation(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Reservation) + err = core.UnmarshalPrimitive(m, "affinity_policy", &obj.AffinityPolicy) + if err != nil { + return + } + err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalReservationCapacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "committed_use", &obj.CommittedUse, UnmarshalReservationCommittedUse) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalReservationProfile) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalReservationStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationCapacity : The capacity configuration for this reservation +// +// If absent, this reservation has no assigned capacity. +type ReservationCapacity struct { + // The amount allocated to this capacity reservation. + Allocated *int64 `json:"allocated" validate:"required"` + + // The amount of this capacity reservation available for new attachments. + Available *int64 `json:"available" validate:"required"` + + // The status of the capacity reservation: + // - `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. + // - `unallocated`: The capacity reservation is not allocated for use + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + Status *string `json:"status" validate:"required"` + + // The total amount of this capacity reservation. + Total *int64 `json:"total" validate:"required"` + + // The amount of this capacity reservation used by existing attachments. + Used *int64 `json:"used" validate:"required"` +} + +// Constants associated with the ReservationCapacity.Status property. +// The status of the capacity reservation: +// - `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. +// - `unallocated`: The capacity reservation is not allocated for use +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ReservationCapacityStatusAllocatedConst = "allocated" + ReservationCapacityStatusAllocatingConst = "allocating" + ReservationCapacityStatusDegradedConst = "degraded" + ReservationCapacityStatusUnallocatedConst = "unallocated" +) + +// UnmarshalReservationCapacity unmarshals an instance of ReservationCapacity from the specified map of raw messages. +func UnmarshalReservationCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationCapacity) + err = core.UnmarshalPrimitive(m, "allocated", &obj.Allocated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "available", &obj.Available) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total", &obj.Total) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "used", &obj.Used) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationCapacityPatch : The capacity reservation configuration to use. +// +// The configuration can only be changed for reservations with a `status` of `inactive`. +type ReservationCapacityPatch struct { + // The total amount to use for this capacity reservation. + Total *int64 `json:"total,omitempty"` +} + +// UnmarshalReservationCapacityPatch unmarshals an instance of ReservationCapacityPatch from the specified map of raw messages. +func UnmarshalReservationCapacityPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationCapacityPatch) + err = core.UnmarshalPrimitive(m, "total", &obj.Total) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationCapacityPrototype : The capacity reservation configuration to use. +type ReservationCapacityPrototype struct { + // The total amount to use for this capacity reservation. + Total *int64 `json:"total" validate:"required"` +} + +// NewReservationCapacityPrototype : Instantiate ReservationCapacityPrototype (Generic Model Constructor) +func (*VpcV1) NewReservationCapacityPrototype(total int64) (_model *ReservationCapacityPrototype, err error) { + _model = &ReservationCapacityPrototype{ + Total: core.Int64Ptr(total), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalReservationCapacityPrototype unmarshals an instance of ReservationCapacityPrototype from the specified map of raw messages. +func UnmarshalReservationCapacityPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationCapacityPrototype) + err = core.UnmarshalPrimitive(m, "total", &obj.Total) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationCollection : ReservationCollection struct +type ReservationCollection struct { + // A link to the first page of resources. + First *ReservationCollectionFirst `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"` + + // Collection of reservations. + Reservations []Reservation `json:"reservations" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservationCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservations", &obj.Reservations, UnmarshalReservation) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ReservationCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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. + ExpirationAt *strfmt.DateTime `json:"expiration_at" validate:"required"` + + // The policy to apply when the committed use term expires: + // - `release`: Release any available capacity and let the reservation expire. + // - `renew`: Renew for another term, provided the term remains listed in the + // `reservation_terms` for the profile. Otherwise, let the reservation expire. + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + ExpirationPolicy *string `json:"expiration_policy" validate:"required"` + + // The term for this committed use reservation: + // - `one_year`: 1 year + // - `three_year`: 3 years + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + Term *string `json:"term" validate:"required"` +} + +// Constants associated with the ReservationCommittedUse.ExpirationPolicy property. +// The policy to apply when the committed use term expires: +// - `release`: Release any available capacity and let the reservation expire. +// - `renew`: Renew for another term, provided the term remains listed in the +// `reservation_terms` for the profile. Otherwise, let the reservation expire. +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ReservationCommittedUseExpirationPolicyReleaseConst = "release" + ReservationCommittedUseExpirationPolicyRenewConst = "renew" +) + +// UnmarshalReservationCommittedUse unmarshals an instance of ReservationCommittedUse from the specified map of raw messages. +func UnmarshalReservationCommittedUse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationCommittedUse) + err = core.UnmarshalPrimitive(m, "expiration_at", &obj.ExpirationAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "term", &obj.Term) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationCommittedUsePatch : ReservationCommittedUsePatch struct +type ReservationCommittedUsePatch struct { + // The policy to apply when the committed use term expires: + // - `release`: Release any available capacity and let the reservation expire. + // - `renew`: Renew for another term, provided the term remains listed in the + // `reservation_terms` for the profile. Otherwise, let the reservation expire. + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + ExpirationPolicy *string `json:"expiration_policy,omitempty"` + + // The term for this committed use reservation: + // - `one_year`: 1 year + // - `three_year`: 3 years + // + // The specified value must be listed in the `reservation_terms` in the profile for this reservation. The term can only + // be changed for a reservation with a `status` of + // `inactive`. + Term *string `json:"term,omitempty"` +} + +// Constants associated with the ReservationCommittedUsePatch.ExpirationPolicy property. +// The policy to apply when the committed use term expires: +// - `release`: Release any available capacity and let the reservation expire. +// - `renew`: Renew for another term, provided the term remains listed in the +// `reservation_terms` for the profile. Otherwise, let the reservation expire. +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ReservationCommittedUsePatchExpirationPolicyReleaseConst = "release" + ReservationCommittedUsePatchExpirationPolicyRenewConst = "renew" +) + +// UnmarshalReservationCommittedUsePatch unmarshals an instance of ReservationCommittedUsePatch from the specified map of raw messages. +func UnmarshalReservationCommittedUsePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationCommittedUsePatch) + err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "term", &obj.Term) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationCommittedUsePrototype : ReservationCommittedUsePrototype struct +type ReservationCommittedUsePrototype struct { + // The policy to apply when the committed use term expires: + // - `release`: Release any available capacity and let the reservation expire. + // - `renew`: Renew for another term, provided the term remains listed in the + // `reservation_terms` for the profile. Otherwise, let the reservation expire. + // + // The enumerated values for this property may expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + ExpirationPolicy *string `json:"expiration_policy,omitempty"` + + // The term for this committed use reservation: + // - `one_year`: 1 year + // - `three_year`: 3 years + // + // The specified value must be listed in the `reservation_terms` in the profile for this reservation. + Term *string `json:"term" validate:"required"` +} + +// Constants associated with the ReservationCommittedUsePrototype.ExpirationPolicy property. +// The policy to apply when the committed use term expires: +// - `release`: Release any available capacity and let the reservation expire. +// - `renew`: Renew for another term, provided the term remains listed in the +// `reservation_terms` for the profile. Otherwise, let the reservation expire. +// +// The enumerated values for this property may expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ReservationCommittedUsePrototypeExpirationPolicyReleaseConst = "release" + ReservationCommittedUsePrototypeExpirationPolicyRenewConst = "renew" +) + +// NewReservationCommittedUsePrototype : Instantiate ReservationCommittedUsePrototype (Generic Model Constructor) +func (*VpcV1) NewReservationCommittedUsePrototype(term string) (_model *ReservationCommittedUsePrototype, err error) { + _model = &ReservationCommittedUsePrototype{ + Term: core.StringPtr(term), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalReservationCommittedUsePrototype unmarshals an instance of ReservationCommittedUsePrototype from the specified map of raw messages. +func UnmarshalReservationCommittedUsePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationCommittedUsePrototype) + err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "term", &obj.Term) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationIdentity : Identifies a reservation by a unique property. +// Models which "extend" this model: +// - ReservationIdentityByID +// - ReservationIdentityByCRN +// - ReservationIdentityByHref +type ReservationIdentity struct { + // The unique identifier for this reservation. + ID *string `json:"id,omitempty"` + + // The CRN for this reservation. + CRN *string `json:"crn,omitempty"` + + // The URL for this reservation. + Href *string `json:"href,omitempty"` +} + +func (*ReservationIdentity) isaReservationIdentity() bool { + return true +} + +type ReservationIdentityIntf interface { + isaReservationIdentity() bool +} + +// UnmarshalReservationIdentity unmarshals an instance of ReservationIdentity from the specified map of raw messages. +func UnmarshalReservationIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationPatch : ReservationPatch struct +type ReservationPatch struct { + // The capacity reservation configuration to use. + // + // The configuration can only be changed for reservations with a `status` of `inactive`. + Capacity *ReservationCapacityPatch `json:"capacity,omitempty"` + + // The committed use configuration to use for this reservation. + CommittedUse *ReservationCommittedUsePatch `json:"committed_use,omitempty"` + + // The name for this reservation. The name must not be used by another reservation in the region. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this + // reservation. + // + // The profile can only be changed for a reservation with a `status` of `inactive`. + Profile *ReservationProfilePatch `json:"profile,omitempty"` +} + +// UnmarshalReservationPatch unmarshals an instance of ReservationPatch from the specified map of raw messages. +func UnmarshalReservationPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationPatch) + err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalReservationCapacityPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "committed_use", &obj.CommittedUse, UnmarshalReservationCommittedUsePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalReservationProfilePatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// ReservationProfile : The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this reservation. +type ReservationProfile struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservationProfile.ResourceType property. +// The resource type. +const ( + ReservationProfileResourceTypeInstanceProfileConst = "instance_profile" +) + +// UnmarshalReservationProfile unmarshals an instance of ReservationProfile from the specified map of raw messages. +func UnmarshalReservationProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationProfile) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationProfilePatch : The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this reservation. +// +// The profile can only be changed for a reservation with a `status` of `inactive`. +type ReservationProfilePatch struct { + // The globally unique name of the profile. + Name *string `json:"name,omitempty"` + + // The resource type of the profile. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the ReservationProfilePatch.ResourceType property. +// The resource type of the profile. +const ( + ReservationProfilePatchResourceTypeInstanceProfileConst = "instance_profile" +) + +// UnmarshalReservationProfilePatch unmarshals an instance of ReservationProfilePatch from the specified map of raw messages. +func UnmarshalReservationProfilePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationProfilePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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. + Name *string `json:"name" validate:"required"` + + // The resource type of the profile. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservationProfilePrototype.ResourceType property. +// The resource type of the profile. +const ( + ReservationProfilePrototypeResourceTypeInstanceProfileConst = "instance_profile" +) + +// NewReservationProfilePrototype : Instantiate ReservationProfilePrototype (Generic Model Constructor) +func (*VpcV1) NewReservationProfilePrototype(name string, resourceType string) (_model *ReservationProfilePrototype, err error) { + _model = &ReservationProfilePrototype{ + Name: core.StringPtr(name), + ResourceType: core.StringPtr(resourceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalReservationProfilePrototype unmarshals an instance of ReservationProfilePrototype from the specified map of raw messages. +func UnmarshalReservationProfilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationProfilePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationReference : ReservationReference struct +type ReservationReference struct { + // The CRN for this reservation. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ReservationReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this reservation. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reservation. + ID *string `json:"id" validate:"required"` + + // The name for this reservation. The name is unique across all reservations in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservationReference.ResourceType property. +// The resource type. +const ( + ReservationReferenceResourceTypeReservationConst = "reservation" +) + +// UnmarshalReservationReference unmarshals an instance of ReservationReference from the specified map of raw messages. +func UnmarshalReservationReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservationReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type ReservationReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalReservationReferenceDeleted unmarshals an instance of ReservationReferenceDeleted from the specified map of raw messages. +func UnmarshalReservationReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationStatusReason : ReservationStatusReason struct +type ReservationStatusReason struct { + // A snake case string succinctly identifying the status reason. + 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 ReservationStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + ReservationStatusReasonCodeCannotActivateNoCapacityAvailableConst = "cannot_activate_no_capacity_available" + ReservationStatusReasonCodeCannotRenewUnsupportedProfileTermConst = "cannot_renew_unsupported_profile_term" +) + +// UnmarshalReservationStatusReason unmarshals an instance of ReservationStatusReason from the specified map of raw messages. +func UnmarshalReservationStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIP : ReservedIP struct +type ReservedIP struct { + // The IP address. + // + // If the address has not yet been selected, the value will be `0.0.0.0`. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // Indicates whether this reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // The date and time that the reserved IP was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the reserved IP. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + Name *string `json:"name" validate:"required"` + + // The owner of the reserved IP. + Owner *string `json:"owner" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The target this reserved IP is bound to. + // + // If absent, this reserved IP is provider-owned or unbound. + Target ReservedIPTargetIntf `json:"target,omitempty"` +} + +// Constants associated with the ReservedIP.LifecycleState property. +// The lifecycle state of the reserved IP. +const ( + ReservedIPLifecycleStateDeletingConst = "deleting" + ReservedIPLifecycleStateFailedConst = "failed" + ReservedIPLifecycleStatePendingConst = "pending" + ReservedIPLifecycleStateStableConst = "stable" + ReservedIPLifecycleStateSuspendedConst = "suspended" + ReservedIPLifecycleStateUpdatingConst = "updating" + ReservedIPLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the ReservedIP.Owner property. +// The owner of the reserved IP. +const ( + ReservedIPOwnerProviderConst = "provider" + ReservedIPOwnerUserConst = "user" +) + +// Constants associated with the ReservedIP.ResourceType property. +// The resource type. +const ( + ReservedIPResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" +) + +// UnmarshalReservedIP unmarshals an instance of ReservedIP from the specified map of raw messages. +func UnmarshalReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "owner", &obj.Owner) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalReservedIPTarget) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollection : ReservedIPCollection struct +type ReservedIPCollection struct { + // A link to the first page of resources. + First *ReservedIPCollectionFirst `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"` + + // Collection of reserved IPs in this subnet. + ReservedIps []ReservedIP `json:"reserved_ips" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reserved_ips", &obj.ReservedIps, UnmarshalReservedIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ReservedIPCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// ReservedIPCollectionBareMetalServerNetworkInterfaceContext : ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct +type ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct { + // A link to the first page of resources. + First *ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst `json:"first" validate:"required"` + + // Collection of reserved IPs bound to a bare metal server network interface. + Ips []ReservedIP `json:"ips" 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 *ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 { + 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 { + 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"` + + // Collection of reserved IPs bound to an endpoint gateway. + Ips []ReservedIP `json:"ips" 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 *ReservedIPCollectionEndpointGatewayContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionEndpointGatewayContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ReservedIPCollectionEndpointGatewayContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 { + 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"` + + // Collection of reserved IPs bound to an instance network interface. + Ips []ReservedIP `json:"ips" 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 *ReservedIPCollectionInstanceNetworkInterfaceContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ReservedIPCollectionInstanceNetworkInterfaceContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 { + 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"` + + // Collection of reserved IPs bound to the virtual network interface specified by the identifier in the URL. + Ips []ReservedIPReference `json:"ips" 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 *ReservedIPCollectionVirtualNetworkInterfaceContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ReservedIPCollectionVirtualNetworkInterfaceContext) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 + // `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with + // `ibm-` are reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` +} + +// UnmarshalReservedIPPatch unmarshals an instance of ReservedIPPatch from the specified map of raw messages. +func UnmarshalReservedIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPPatch) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// ReservedIPReference : ReservedIPReference struct +type ReservedIPReference struct { + // The IP address. + // + // If the address has not yet been selected, the value will be `0.0.0.0`. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` + + // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPReference.ResourceType property. +// The resource type. +const ( + ReservedIPReferenceResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" +) + +// UnmarshalReservedIPReference unmarshals an instance of ReservedIPReference from the specified map of raw messages. +func UnmarshalReservedIPReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPReference) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type ReservedIPReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalReservedIPReferenceDeleted unmarshals an instance of ReservedIPReferenceDeleted from the specified map of raw messages. +func UnmarshalReservedIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTarget : The target this reserved IP is bound to. +// +// If absent, this reserved IP is provider-owned or unbound. +// Models which "extend" this model: +// - ReservedIPTargetEndpointGatewayReference +// - ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext +// - ReservedIPTargetNetworkInterfaceReferenceTargetContext +// - ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext +// - ReservedIPTargetLoadBalancerReference +// - ReservedIPTargetVPNGatewayReference +// - ReservedIPTargetVPNServerReference +// - ReservedIPTargetGenericResourceReference +type ReservedIPTarget struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the ReservedIPTarget.ResourceType property. +// The resource type. +const ( + ReservedIPTargetResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +func (*ReservedIPTarget) isaReservedIPTarget() bool { + return true +} + +type ReservedIPTargetIntf interface { + isaReservedIPTarget() bool +} + +// UnmarshalReservedIPTarget unmarshals an instance of ReservedIPTarget from the specified map of raw messages. +func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTarget) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototype : The target to bind this reserved IP to. The target must be in the same VPC. +// +// The following targets are supported: +// - An endpoint gateway not already bound to a reserved IP in the subnet's zone. +// - A virtual network interface. +// +// If unspecified, the reserved IP will be created unbound. +// Models which "extend" this model: +// - ReservedIPTargetPrototypeEndpointGatewayIdentity +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity +type ReservedIPTargetPrototype struct { + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` +} + +func (*ReservedIPTargetPrototype) isaReservedIPTargetPrototype() bool { + return true +} + +type ReservedIPTargetPrototypeIntf interface { + isaReservedIPTargetPrototype() bool +} + +// UnmarshalReservedIPTargetPrototype unmarshals an instance of ReservedIPTargetPrototype from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceFilter : Identifies one or more resources according to the specified filter property. +type ResourceFilter struct { + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// UnmarshalResourceFilter unmarshals an instance of ResourceFilter from the specified map of raw messages. +func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceFilter) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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: +// - ResourceGroupIdentityByID +type ResourceGroupIdentity struct { + // The unique identifier for this resource group. + ID *string `json:"id,omitempty"` +} + +func (*ResourceGroupIdentity) isaResourceGroupIdentity() bool { + return true +} + +type ResourceGroupIdentityIntf interface { + isaResourceGroupIdentity() bool +} + +// UnmarshalResourceGroupIdentity unmarshals an instance of ResourceGroupIdentity from the specified map of raw messages. +func UnmarshalResourceGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceGroupReference : ResourceGroupReference struct +type ResourceGroupReference struct { + // The URL for this resource group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this resource group. + ID *string `json:"id" validate:"required"` + + // The name for this resource group. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalResourceGroupReference unmarshals an instance of ResourceGroupReference from the specified map of raw messages. +func UnmarshalResourceGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RestartBareMetalServerOptions : The RestartBareMetalServer options. +type RestartBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRestartBareMetalServerOptions : Instantiate RestartBareMetalServerOptions +func (*VpcV1) NewRestartBareMetalServerOptions(id string) *RestartBareMetalServerOptions { + return &RestartBareMetalServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *RestartBareMetalServerOptions) SetID(id string) *RestartBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RestartBareMetalServerOptions) SetHeaders(param map[string]string) *RestartBareMetalServerOptions { + options.Headers = param + return options +} + +// Route : Route struct +type Route 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. + 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 are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + Origin *string `json:"origin,omitempty"` + + // 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 Route.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. +const ( + RouteActionDelegateConst = "delegate" + RouteActionDelegateVPCConst = "delegate_vpc" + RouteActionDeliverConst = "deliver" + RouteActionDropConst = "drop" +) + +// Constants associated with the Route.LifecycleState property. +// The lifecycle state of the route. +const ( + RouteLifecycleStateDeletingConst = "deleting" + RouteLifecycleStateFailedConst = "failed" + RouteLifecycleStatePendingConst = "pending" + RouteLifecycleStateStableConst = "stable" + RouteLifecycleStateSuspendedConst = "suspended" + RouteLifecycleStateUpdatingConst = "updating" + RouteLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Route.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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +const ( + RouteOriginServiceConst = "service" + RouteOriginUserConst = "user" +) + +// UnmarshalRoute unmarshals an instance of Route from the specified map of raw messages. +func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Route) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + 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 *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"` + + // Collection of routes. + 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 { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRoute) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + 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 { + 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 { + 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"` + + // Collection of routes. + 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 { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionVPCContextNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteCollectionVPCContextRoutesItem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 || start == nil { + return nil, err + } + 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 { + 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 { + 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. + 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 are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + Origin *string `json:"origin,omitempty"` + + // 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. +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 are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +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 { + return + } + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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. +// Models which "extend" this model: +// - RouteCreatorVPNGatewayReference +// - RouteCreatorVPNServerReference +type RouteCreator struct { + // The VPN gateway's CRN. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The VPN gateway's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id,omitempty"` + + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the RouteCreator.ResourceType property. +// The resource type. +const ( + RouteCreatorResourceTypeVPNGatewayConst = "vpn_gateway" +) + +func (*RouteCreator) isaRouteCreator() bool { + return true +} + +type RouteCreatorIntf interface { + isaRouteCreator() bool +} + +// UnmarshalRouteCreator unmarshals an instance of RouteCreator from the specified map of raw messages. +func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreator) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHop : RouteNextHop struct +// Models which "extend" this model: +// - RouteNextHopIP +// - RouteNextHopVPNGatewayConnectionReference +type RouteNextHop struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the RouteNextHop.ResourceType property. +// The resource type. +const ( + RouteNextHopResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +func (*RouteNextHop) isaRouteNextHop() bool { + return true +} + +type RouteNextHopIntf interface { + isaRouteNextHop() bool +} + +// UnmarshalRouteNextHop unmarshals an instance of RouteNextHop from the specified map of raw messages. +func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHop) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatch : If `action` is `deliver`, the next hop that packets will be delivered to. For other +// `action` values, specify `0.0.0.0` or remove it by specifying `null`. +// +// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has +// an `action` of `deliver` and `next_hop` is an IP address. +// Models which "extend" this model: +// - RouteNextHopPatchRouteNextHopIP +// - RouteNextHopPatchVPNGatewayConnectionIdentity +type RouteNextHopPatch struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RouteNextHopPatch) isaRouteNextHopPatch() bool { + return true +} + +type RouteNextHopPatchIntf interface { + isaRouteNextHopPatch() bool +} + +// UnmarshalRouteNextHopPatch unmarshals an instance of RouteNextHopPatch from the specified map of raw messages. +func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePatch : RoutePatch struct +type RoutePatch struct { + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // Since all routes in a routing table with the same `destination` and `zone` must have the same `advertise` value, + // this property can only be changed for routes with a unique + // `destination` and `zone` in the routing table. For more information, see [Advertising + // routes](https://cloud.ibm.com/docs/vpc?topic=vpc-about-custom-routes#rt-advertising-routes). + Advertise *bool `json:"advertise,omitempty"` + + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` + // are reserved for system-provided routes, and are not allowed. + Name *string `json:"name,omitempty"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For other + // `action` values, specify `0.0.0.0` or remove it by specifying `null`. + // + // At most two routes per `zone` in a table can have the same `destination` and `priority`, + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. + NextHop RouteNextHopPatchIntf `json:"next_hop,omitempty"` + + // 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,omitempty"` +} + +// UnmarshalRoutePatch unmarshals an instance of RoutePatch from the specified map of raw messages. +func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePatch) + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHopPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// RoutePrototype : RoutePrototype struct +type RoutePrototype 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. + Action *string `json:"action,omitempty"` + + // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` + // routing table property. + // + // All routes in a routing table with the same `destination` and `zone` must have the same + // `advertise` value. + Advertise *bool `json:"advertise,omitempty"` + + // The destination CIDR of the route. The host identifier in the CIDR must be zero. + // + // At most two routes per `zone` in a table can have the same `destination` and + // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. + Destination *string `json:"destination" validate:"required"` + + // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` + // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For other + // `action` values, it must be omitted or specified as `0.0.0.0`. + // + // At most two routes per `zone` in a table can have the same `destination` and `priority`, + // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. + NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + + // 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,omitempty"` + + // The zone to apply the route 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 ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// Constants associated with the RoutePrototype.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. +const ( + RoutePrototypeActionDelegateConst = "delegate" + RoutePrototypeActionDelegateVPCConst = "delegate_vpc" + RoutePrototypeActionDeliverConst = "deliver" + RoutePrototypeActionDropConst = "drop" +) + +// NewRoutePrototype : Instantiate RoutePrototype (Generic Model Constructor) +func (*VpcV1) NewRoutePrototype(destination string, zone ZoneIdentityIntf) (_model *RoutePrototype, err error) { + _model = &RoutePrototype{ + Destination: core.StringPtr(destination), + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalRoutePrototype unmarshals an instance of RoutePrototype from the specified map of raw messages. +func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRoutePrototypeNextHop) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHop : If `action` is `deliver`, the next hop that packets will be delivered to. For other +// `action` values, it must be omitted or specified as `0.0.0.0`. +// +// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has +// an `action` of `deliver` and `next_hop` is an IP address. +// Models which "extend" this model: +// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity +type RoutePrototypeNextHop struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RoutePrototypeNextHop) isaRoutePrototypeNextHop() bool { + return true +} + +type RoutePrototypeNextHopIntf interface { + isaRoutePrototypeNextHop() bool +} + +// UnmarshalRoutePrototypeNextHop unmarshals an instance of RoutePrototypeNextHop from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHop(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHop) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteReference : RouteReference struct +type RouteReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *RouteReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this route. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this route. + ID *string `json:"id" validate:"required"` + + // The name for this route. The name is unique across all routes in the routing table. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalRouteReference unmarshals an instance of RouteReference from the specified map of raw messages. +func UnmarshalRouteReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRouteReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type RouteReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalRouteReferenceDeleted unmarshals an instance of RouteReferenceDeleted from the specified map of raw messages. +func UnmarshalRouteReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTable : RoutingTable struct +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 `vpn_server` value is supported, but filter + // support is expected to expand 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 + // sources. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` + + // The date and time that this routing table was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this routing table. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` + + // Indicates whether this is the default routing table for this VPC. + IsDefault *bool `json:"is_default" validate:"required"` + + // The lifecycle state of the routing table. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this routing table. The name is unique across all routing tables for the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from the internet. + // + // Incoming traffic will be routed according to the routing table with two exceptions: + // - Traffic destined for IP addresses associated with public gateways will not be + // subject to routes in this routing table. + // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is + // an IP address in a subnet in the route's `zone` that is able to accept traffic. + // Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from from [Transit + // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this + // VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` + + // The routes for this routing table. + Routes []RouteReference `json:"routes" validate:"required"` + + // The subnets to which this routing table is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` +} + +// Constants associated with the RoutingTable.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + RoutingTableAdvertiseRoutesToDirectLinkConst = "direct_link" + RoutingTableAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + +// Constants associated with the RoutingTable.LifecycleState property. +// The lifecycle state of the routing table. +const ( + RoutingTableLifecycleStateDeletingConst = "deleting" + RoutingTableLifecycleStateFailedConst = "failed" + RoutingTableLifecycleStatePendingConst = "pending" + RoutingTableLifecycleStateStableConst = "stable" + RoutingTableLifecycleStateSuspendedConst = "suspended" + RoutingTableLifecycleStateUpdatingConst = "updating" + RoutingTableLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the RoutingTable.ResourceType property. +// The resource type. +const ( + RoutingTableResourceTypeRoutingTableConst = "routing_table" +) + +// UnmarshalRoutingTable unmarshals an instance of RoutingTable from the specified map of raw messages. +func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTable) + err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableCollection : RoutingTableCollection struct +type RoutingTableCollection struct { + // A link to the first page of resources. + First *RoutingTableCollectionFirst `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"` + + // Collection of routing tables. + RoutingTables []RoutingTable `json:"routing_tables" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRoutingTableCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_tables", &obj.RoutingTables, UnmarshalRoutingTable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *RoutingTableCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableIdentity : Identifies a routing table by a unique property. +// Models which "extend" this model: +// - RoutingTableIdentityByID +// - RoutingTableIdentityByHref +type RoutingTableIdentity struct { + // The unique identifier for this routing table. + ID *string `json:"id,omitempty"` + + // The URL for this routing table. + Href *string `json:"href,omitempty"` +} + +func (*RoutingTableIdentity) isaRoutingTableIdentity() bool { + return true +} + +type RoutingTableIdentityIntf interface { + isaRoutingTableIdentity() bool +} + +// UnmarshalRoutingTableIdentity unmarshals an instance of RoutingTableIdentity from the specified map of raw messages. +func UnmarshalRoutingTableIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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. + // + // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter + // support is expected to expand in the future. + 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 + // `advertise` enabled will be advertised to these sources. + AdvertiseRoutesTo []string `json:"advertise_routes_to,omitempty"` + + // The name for this routing table. The name must not be used by another routing table in the VPC. + Name *string `json:"name,omitempty"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to `true` selects this routing table, provided + // no other routing table in the VPC already has this property set to `true`, and no subnets are attached to this + // routing table. Updating to + // `false` deselects this routing table, provided `direct_link` is absent from + // `advertise_routes_to`. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` + + // Indicates whether this routing table is used to route traffic that originates from the internet. Updating to `true` + // selects this routing table, provided no other routing table in the VPC already has this property set to `true`. + // Updating to `false` deselects this routing table. + // + // Incoming traffic will be routed according to the routing table with two exceptions: + // - Traffic destined for IP addresses associated with public gateways will not be subject + // to routes in this routing table. + // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is an + // IP address in a subnet in the route's `zone` that is able to accept traffic. + // Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. Updating to + // `true` selects this routing table, provided no other routing table in the VPC already has this property set to + // `true`, and no subnets are attached to this routing table. Updating to `false` deselects this routing table, + // provided `transit_gateway` is absent from `advertise_routes_to`. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + // + // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled + // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing + // table. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` + + // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this + // VPC. Updating to `true` selects this routing table, provided no other routing table in the VPC already has this + // property set to `true`, and no subnets are attached to this routing table. Updating to `false` deselects this + // routing table. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is + // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway + // connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` +} + +// Constants associated with the RoutingTablePatch.AdvertiseRoutesTo property. +// An ingress source that routes can be advertised to: +// +// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) +// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). +const ( + RoutingTablePatchAdvertiseRoutesToDirectLinkConst = "direct_link" + RoutingTablePatchAdvertiseRoutesToTransitGatewayConst = "transit_gateway" +) + +// UnmarshalRoutingTablePatch unmarshals an instance of RoutingTablePatch from the specified map of raw messages. +func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTablePatch) + err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// RoutingTableReference : RoutingTableReference struct +type RoutingTableReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *RoutingTableReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this routing table. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` + + // The name for this routing table. The name is unique across all routing tables for the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RoutingTableReference.ResourceType property. +// The resource type. +const ( + RoutingTableReferenceResourceTypeRoutingTableConst = "routing_table" +) + +// UnmarshalRoutingTableReference unmarshals an instance of RoutingTableReference from the specified map of raw messages. +func UnmarshalRoutingTableReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRoutingTableReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type RoutingTableReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalRoutingTableReferenceDeleted unmarshals an instance of RoutingTableReferenceDeleted from the specified map of raw messages. +func UnmarshalRoutingTableReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroup : SecurityGroup struct +type SecurityGroup struct { + // The date and time that this security group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The name for this security group. The name is unique across all security groups for the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this security group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The rules for this security group. If no rules exist, all traffic will be denied. + Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` + + // The targets for this security group. + Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` + + // The VPC this security group resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalSecurityGroup unmarshals an instance of SecurityGroup from the specified map of raw messages. +func UnmarshalSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroup) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) + if err != nil { + return + } + err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupCollection : SecurityGroupCollection struct +type SecurityGroupCollection struct { + // A link to the first page of resources. + First *SecurityGroupCollectionFirst `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"` + + // Collection of security groups. + SecurityGroups []SecurityGroup `json:"security_groups" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *SecurityGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 +// - SecurityGroupIdentityByCRN +// - SecurityGroupIdentityByHref +type SecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupIdentity) isaSecurityGroupIdentity() bool { + return true +} + +type SecurityGroupIdentityIntf interface { + isaSecurityGroupIdentity() bool +} + +// UnmarshalSecurityGroupIdentity unmarshals an instance of SecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupPatch : SecurityGroupPatch struct +type SecurityGroupPatch struct { + // The name for this security group. The name must not be used by another security group for the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalSecurityGroupPatch unmarshals an instance of SecurityGroupPatch from the specified map of raw messages. +func UnmarshalSecurityGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// SecurityGroupReference : SecurityGroupReference struct +type SecurityGroupReference struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The name for this security group. The name is unique across all security groups for the VPC. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalSecurityGroupReference unmarshals an instance of SecurityGroupReference from the specified map of raw messages. +func UnmarshalSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type SecurityGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalSecurityGroupReferenceDeleted unmarshals an instance of SecurityGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalSecurityGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRule : SecurityGroupRule struct +// Models which "extend" this model: +// - SecurityGroupRuleSecurityGroupRuleProtocolAll +// - SecurityGroupRuleSecurityGroupRuleProtocolIcmp +// - SecurityGroupRuleSecurityGroupRuleProtocolTcpudp +type SecurityGroupRule struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The remote IP addresses or security groups from which this rule allows traffic (or to + // which, for outbound rules). A CIDR block of `0.0.0.0/0` allows traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The ICMP traffic code to allow. If absent, all codes are allowed. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to allow. If absent, all types are allowed. + Type *int64 `json:"type,omitempty"` + + // The inclusive upper bound of TCP/UDP destination port range. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + PortMin *int64 `json:"port_min,omitempty"` +} + +// Constants associated with the SecurityGroupRule.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleDirectionInboundConst = "inbound" + SecurityGroupRuleDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRule.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRule.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleProtocolAllConst = "all" + SecurityGroupRuleProtocolIcmpConst = "icmp" + SecurityGroupRuleProtocolTCPConst = "tcp" + SecurityGroupRuleProtocolUDPConst = "udp" +) + +func (*SecurityGroupRule) isaSecurityGroupRule() bool { + return true +} + +type SecurityGroupRuleIntf interface { + isaSecurityGroupRule() bool +} + +// UnmarshalSecurityGroupRule unmarshals an instance of SecurityGroupRule from the specified map of raw messages. +func UnmarshalSecurityGroupRule(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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// SecurityGroupRuleCollection : Collection of rules in a security group. +type SecurityGroupRuleCollection struct { + // Array of rules. + Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` +} + +// UnmarshalSecurityGroupRuleCollection unmarshals an instance of SecurityGroupRuleCollection from the specified map of raw messages. +func UnmarshalSecurityGroupRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleCollection) + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePatch : SecurityGroupRulePatch struct +type SecurityGroupRulePatch struct { + // The ICMP traffic code to allow. If set, `type` must also be set. + // + // Specify `null` to remove an existing ICMP traffic code. + Code *int64 `json:"code,omitempty"` + + // The direction of traffic to enforce. + Direction *string `json:"direction,omitempty"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The inclusive upper bound of the protocol destination port range. If set, `port_min` must also be set, and must not + // be larger. + // + // Specify `null` to remove an existing upper bound. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of the protocol destination port range. If set, `port_max` must also be set, and must not + // be smaller. + // + // Specify `null` to remove an existing lower bound. + PortMin *int64 `json:"port_min,omitempty"` + + // 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. A CIDR block of `0.0.0.0/0` will allow traffic from any source (or to + // any destination, for outbound rules). + Remote SecurityGroupRuleRemotePatchIntf `json:"remote,omitempty"` + + // The ICMP traffic type to allow. + // + // Specify `null` to remove an existing ICMP traffic type value. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the SecurityGroupRulePatch.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePatchDirectionInboundConst = "inbound" + SecurityGroupRulePatchDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePatch.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePatchIPVersionIpv4Const = "ipv4" +) + +// UnmarshalSecurityGroupRulePatch unmarshals an instance of SecurityGroupRulePatch from the specified map of raw messages. +func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePatch) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// SecurityGroupRulePrototype : SecurityGroupRulePrototype struct +// Models which "extend" this model: +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp +type SecurityGroupRulePrototype struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // 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. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The ICMP traffic code to allow. + // + // If specified, `type` must also be specified. If unspecified, all codes are allowed. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to allow. + // + // If unspecified, all types are allowed. + Type *int64 `json:"type,omitempty"` + + // The inclusive upper bound of TCP/UDP destination port range. + // + // If specified, `port_min` must also be specified, and must not be larger. If unspecified, + // `port_min` must also be unspecified, allowing traffic on all destination ports. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range + // + // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be + // unspecified, allowing traffic on all destination ports. + PortMin *int64 `json:"port_min,omitempty"` +} + +// Constants associated with the SecurityGroupRulePrototype.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePrototypeDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototype.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototype.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeProtocolAllConst = "all" + SecurityGroupRulePrototypeProtocolIcmpConst = "icmp" + SecurityGroupRulePrototypeProtocolTCPConst = "tcp" + SecurityGroupRulePrototypeProtocolUDPConst = "udp" +) + +func (*SecurityGroupRulePrototype) isaSecurityGroupRulePrototype() bool { + return true +} + +type SecurityGroupRulePrototypeIntf interface { + isaSecurityGroupRulePrototype() bool +} + +// 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) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// SecurityGroupRuleRemote : The remote IP addresses or security groups from which this rule allows traffic (or to which, for outbound rules). A +// CIDR block of `0.0.0.0/0` allows traffic from any source +// (or to any destination, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleRemoteIP +// - SecurityGroupRuleRemoteCIDR +// - SecurityGroupRuleRemoteSecurityGroupReference +type SecurityGroupRuleRemote struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The name for this security group. The name is unique across all security groups for the VPC. + Name *string `json:"name,omitempty"` +} + +func (*SecurityGroupRuleRemote) isaSecurityGroupRuleRemote() bool { + return true +} + +type SecurityGroupRuleRemoteIntf interface { + isaSecurityGroupRuleRemote() bool +} + +// UnmarshalSecurityGroupRuleRemote unmarshals an instance of SecurityGroupRuleRemote from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemote) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatch : 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. A CIDR block of `0.0.0.0/0` will allow traffic +// from any source (or to any destination, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleRemotePatchIP +// - SecurityGroupRuleRemotePatchCIDR +// - SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatch struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` + + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePatch) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +type SecurityGroupRuleRemotePatchIntf interface { + isaSecurityGroupRuleRemotePatch() bool +} + +// UnmarshalSecurityGroupRuleRemotePatch unmarshals an instance of SecurityGroupRuleRemotePatch from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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. +// +// If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source +// (or to any destination, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleRemotePrototypeIP +// - SecurityGroupRuleRemotePrototypeCIDR +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototype struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` + + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePrototype) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +type SecurityGroupRuleRemotePrototypeIntf interface { + isaSecurityGroupRuleRemotePrototype() bool +} + +// UnmarshalSecurityGroupRuleRemotePrototype unmarshals an instance of SecurityGroupRuleRemotePrototype from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototype) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetCollection : SecurityGroupTargetCollection struct +type SecurityGroupTargetCollection struct { + // A link to the first page of resources. + First *SecurityGroupTargetCollectionFirst `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"` + + // Collection of targets for this security group. + Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupTargetCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *SecurityGroupTargetCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReference : The resource types that can be security group targets are expected to expand in the future. When iterating over +// security group targets, do not assume that every target resource will be from a known set of resource types. +// Optionally halt processing and surface an error, or bypass resources of unrecognized types. +// Models which "extend" this model: +// - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext +// - SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext +// - SecurityGroupTargetReferenceLoadBalancerReference +// - SecurityGroupTargetReferenceEndpointGatewayReference +// - SecurityGroupTargetReferenceVPNServerReference +// - SecurityGroupTargetReferenceVirtualNetworkInterfaceReference +type SecurityGroupTargetReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this instance network interface. + // + // If this instance 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,omitempty"` + + // The unique identifier for this instance network interface. + // + // If this instance 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,omitempty"` + + // The name for this instance network interface. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The load balancer's CRN. + CRN *string `json:"crn,omitempty"` + + // The primary IP for this virtual network interface. + PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet,omitempty"` +} + +// Constants associated with the SecurityGroupTargetReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*SecurityGroupTargetReference) isaSecurityGroupTargetReference() bool { + return true +} + +type SecurityGroupTargetReferenceIntf interface { + isaSecurityGroupTargetReference() bool +} + +// UnmarshalSecurityGroupTargetReference unmarshals an instance of SecurityGroupTargetReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SetSubnetPublicGatewayOptions : The SetSubnetPublicGateway options. +type SetSubnetPublicGatewayOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The public gateway identity. + PublicGatewayIdentity PublicGatewayIdentityIntf `json:"PublicGatewayIdentity" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewSetSubnetPublicGatewayOptions : Instantiate SetSubnetPublicGatewayOptions +func (*VpcV1) NewSetSubnetPublicGatewayOptions(id string, publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { + return &SetSubnetPublicGatewayOptions{ + ID: core.StringPtr(id), + PublicGatewayIdentity: publicGatewayIdentity, + } +} + +// SetID : Allow user to set ID +func (_options *SetSubnetPublicGatewayOptions) SetID(id string) *SetSubnetPublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetPublicGatewayIdentity : Allow user to set PublicGatewayIdentity +func (_options *SetSubnetPublicGatewayOptions) SetPublicGatewayIdentity(publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { + _options.PublicGatewayIdentity = publicGatewayIdentity + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *SetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *SetSubnetPublicGatewayOptions { + options.Headers = param + return options +} + +// Share : Share struct +type Share struct { + // The access control mode for the share: + // + // - `security_group`: The security groups on the virtual network interface for a mount + // target control access to the mount target. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // + // The enumerated access control mode values for this property may expand in the future. When processing this property, + // check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which + // the unexpected access control mode was encountered. + AccessControlMode *string `json:"access_control_mode" validate:"required"` + + // The date and time that the file share is created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this file share. + CRN *string `json:"crn" validate:"required"` + + // The type of encryption used for this file share. + Encryption *string `json:"encryption" validate:"required"` + + // The key used to encrypt this file share. + // + // This property will be present if `encryption` is `user_managed`. + EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` + + // The URL for this file share. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this file share. + ID *string `json:"id" validate:"required"` + + // The maximum input/output operations per second (IOPS) for the file share. In addition, each client accessing the + // share will be restricted to 48,000 IOPS. + // + // The maximum IOPS for a share may increase in the future. + Iops *int64 `json:"iops" validate:"required"` + + // The latest job associated with this file share. + // + // This property will be absent if no jobs have been created for this file share. + LatestJob *ShareJob `json:"latest_job,omitempty"` + + // Information about the latest synchronization for this file share. + // + // This property will be present when the `replication_role` is `replica` and at least + // one replication sync has been completed. + LatestSync *ShareLatestSync `json:"latest_sync,omitempty"` + + // The lifecycle state of the file share. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The mount targets for the file share. + MountTargets []ShareMountTargetReference `json:"mount_targets" validate:"required"` + + // The name for this share. The name is unique across all shares in the region. + Name *string `json:"name" validate:"required"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) for + // this file share. + Profile *ShareProfileReference `json:"profile" validate:"required"` + + // The replica file share for this source file share. + // + // This property will be present when the `replication_role` is `source`. + ReplicaShare *ShareReference `json:"replica_share,omitempty"` + + // The cron specification for the file share replication schedule. + // + // This property will be present when the `replication_role` is `replica`. + ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` + + // The replication role of the file share. + // + // * `none`: This share is not participating in replication. + // * `replica`: This share is a replication target. + // * `source`: This share is a replication source. + ReplicationRole *string `json:"replication_role" validate:"required"` + + // The replication status of the file share. + // + // * `active`: This share is actively participating in replication, and the replica's data is up-to-date with the + // replication schedule. + // * `degraded`: This is share is participating in replication, but the replica's data has fallen behind the + // replication schedule. + // * `failover_pending`: This share is performing a replication failover. + // * `initializing`: This share is initializing replication. + // * `none`: This share is not participating in replication. + // * `split_pending`: This share is performing a replication split. + ReplicationStatus *string `json:"replication_status" validate:"required"` + + // The reasons for the current replication status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + ReplicationStatusReasons []ShareReplicationStatusReason `json:"replication_status_reasons" validate:"required"` + + // The resource group for this file share. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The size of the file share rounded up to the next gigabyte. + // + // The maximum size for a share may increase in the future. + Size *int64 `json:"size" validate:"required"` + + // The source file share for this replica file share. + // + // This property will be present when the `replication_role` is `replica`. + SourceShare *ShareReference `json:"source_share,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags" validate:"required"` + + // The zone this file share will reside in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Share.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a mount +// target control access to the mount target. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// +// The enumerated access control mode values for this property may expand in the future. When processing this property, +// check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which +// the unexpected access control mode was encountered. +const ( + ShareAccessControlModeSecurityGroupConst = "security_group" + ShareAccessControlModeVPCConst = "vpc" +) + +// Constants associated with the Share.Encryption property. +// The type of encryption used for this file share. +const ( + ShareEncryptionProviderManagedConst = "provider_managed" + ShareEncryptionUserManagedConst = "user_managed" +) + +// Constants associated with the Share.LifecycleState property. +// The lifecycle state of the file share. +const ( + ShareLifecycleStateDeletingConst = "deleting" + ShareLifecycleStateFailedConst = "failed" + ShareLifecycleStatePendingConst = "pending" + ShareLifecycleStateStableConst = "stable" + ShareLifecycleStateSuspendedConst = "suspended" + ShareLifecycleStateUpdatingConst = "updating" + ShareLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Share.ReplicationRole property. +// The replication role of the file share. +// +// * `none`: This share is not participating in replication. +// * `replica`: This share is a replication target. +// * `source`: This share is a replication source. +const ( + ShareReplicationRoleNoneConst = "none" + ShareReplicationRoleReplicaConst = "replica" + ShareReplicationRoleSourceConst = "source" +) + +// Constants associated with the Share.ReplicationStatus property. +// The replication status of the file share. +// +// * `active`: This share is actively participating in replication, and the replica's data is up-to-date with the +// replication schedule. +// * `degraded`: This is share is participating in replication, but the replica's data has fallen behind the replication +// schedule. +// * `failover_pending`: This share is performing a replication failover. +// * `initializing`: This share is initializing replication. +// * `none`: This share is not participating in replication. +// * `split_pending`: This share is performing a replication split. +const ( + ShareReplicationStatusActiveConst = "active" + ShareReplicationStatusDegradedConst = "degraded" + ShareReplicationStatusFailoverPendingConst = "failover_pending" + ShareReplicationStatusInitializingConst = "initializing" + ShareReplicationStatusNoneConst = "none" + ShareReplicationStatusSplitPendingConst = "split_pending" +) + +// Constants associated with the Share.ResourceType property. +// The resource type. +const ( + ShareResourceTypeShareConst = "share" +) + +// UnmarshalShare unmarshals an instance of Share from the specified map of raw messages. +func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Share) + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalModel(m, "latest_job", &obj.LatestJob, UnmarshalShareJob) + if err != nil { + return + } + err = core.UnmarshalModel(m, "latest_sync", &obj.LatestSync, UnmarshalShareLatestSync) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalShareReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_role", &obj.ReplicationRole) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_status", &obj.ReplicationStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "replication_status_reasons", &obj.ReplicationStatusReasons, UnmarshalShareReplicationStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareCollection : ShareCollection struct +type ShareCollection struct { + // A link to the first page of resources. + First *ShareCollectionFirst `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"` + + // Collection of file shares. + Shares []Share `json:"shares" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "shares", &obj.Shares, UnmarshalShare) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ShareCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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 +// - ShareIdentityByCRN +// - ShareIdentityByHref +type ShareIdentity struct { + // The unique identifier for this file share. + ID *string `json:"id,omitempty"` + + // The CRN for this file share. + CRN *string `json:"crn,omitempty"` + + // The URL for this file share. + Href *string `json:"href,omitempty"` +} + +func (*ShareIdentity) isaShareIdentity() bool { + return true +} + +type ShareIdentityIntf interface { + isaShareIdentity() bool +} + +// UnmarshalShareIdentity unmarshals an instance of ShareIdentity from the specified map of raw messages. +func UnmarshalShareIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareInitialOwner : ShareInitialOwner struct +type ShareInitialOwner struct { + // The initial group identifier for the file share. + Gid *int64 `json:"gid,omitempty"` + + // The initial user identifier for the file share. + Uid *int64 `json:"uid,omitempty"` +} + +// UnmarshalShareInitialOwner unmarshals an instance of ShareInitialOwner from the specified map of raw messages. +func UnmarshalShareInitialOwner(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareInitialOwner) + err = core.UnmarshalPrimitive(m, "gid", &obj.Gid) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uid", &obj.Uid) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareJob : ShareJob struct +type ShareJob struct { + // The status of the file share job. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the + // unexpected property value was encountered. + // + // * `cancelled`: This job has been cancelled. + // * `failed`: This job has failed. + // * `queued`: This job is queued. + // * `running`: This job is running. + // * `succeeded`: This job completed successfully. + Status *string `json:"status" validate:"required"` + + // The reasons for the file share job status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []ShareJobStatusReason `json:"status_reasons" validate:"required"` + + // The type of the file share job. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the + // unexpected property value was encountered. + // + // * `replication_failover`: This is a share replication failover job. + // * `replication_init`: This is a share replication is initialization job. + // * `replication_split`: This is a share replication split job. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the ShareJob.Status property. +// The status of the file share job. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the +// unexpected property value was encountered. +// +// * `cancelled`: This job has been cancelled. +// * `failed`: This job has failed. +// * `queued`: This job is queued. +// * `running`: This job is running. +// * `succeeded`: This job completed successfully. +const ( + ShareJobStatusCancelledConst = "cancelled" + ShareJobStatusFailedConst = "failed" + ShareJobStatusQueuedConst = "queued" + ShareJobStatusRunningConst = "running" + ShareJobStatusSucceededConst = "succeeded" +) + +// Constants associated with the ShareJob.Type property. +// The type of the file share job. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the +// unexpected property value was encountered. +// +// * `replication_failover`: This is a share replication failover job. +// * `replication_init`: This is a share replication is initialization job. +// * `replication_split`: This is a share replication split job. +const ( + ShareJobTypeReplicationFailoverConst = "replication_failover" + ShareJobTypeReplicationInitConst = "replication_init" + ShareJobTypeReplicationSplitConst = "replication_split" +) + +// UnmarshalShareJob unmarshals an instance of ShareJob from the specified map of raw messages. +func UnmarshalShareJob(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareJob) + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalShareJobStatusReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareJobStatusReason : ShareJobStatusReason struct +type ShareJobStatusReason struct { + // A snake case string succinctly identifying the status reason. + 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 ShareJobStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + ShareJobStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication" + ShareJobStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share" + ShareJobStatusReasonCodeCannotReachSourceShareConst = "cannot_reach_source_share" +) + +// UnmarshalShareJobStatusReason unmarshals an instance of ShareJobStatusReason from the specified map of raw messages. +func UnmarshalShareJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareJobStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareLatestSync : Information about the latest synchronization for this file share. +// +// This property will be present when the `replication_role` is `replica` and at least one replication sync has been +// completed. +type ShareLatestSync struct { + // The completed date and time of last synchronization between the replica share and its source. + CompletedAt *strfmt.DateTime `json:"completed_at" validate:"required"` + + // The data transferred (in bytes) in the last synchronization between the replica and its source. + DataTransferred *int64 `json:"data_transferred" validate:"required"` + + // The start date and time of last synchronization between the replica share and its source. + StartedAt *strfmt.DateTime `json:"started_at" validate:"required"` +} + +// UnmarshalShareLatestSync unmarshals an instance of ShareLatestSync from the specified map of raw messages. +func UnmarshalShareLatestSync(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareLatestSync) + err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "data_transferred", &obj.DataTransferred) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTarget : ShareMountTarget struct +type ShareMountTarget struct { + // The access control mode for the share: + // + // - `security_group`: The security groups on the virtual network interface for a mount + // target control access to the mount target. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // + // The enumerated access control mode values for this property may expand in the future. When processing this property, + // check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which + // the unexpected access control mode was encountered. + AccessControlMode *string `json:"access_control_mode" validate:"required"` + + // The date and time that the share mount target was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this share mount target. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this share mount target. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the mount target. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The mount path for the share. The server component of the mount path may be either an IP address or a fully + // qualified domain name. + // + // This property will be absent if the `lifecycle_state` of the mount target is + // 'pending', `failed`, or `deleting`. + // + // If the share's `access_control_mode` is: + // + // - `security_group`: The IP address used in the mount path is the `primary_ip` + // address of the virtual network interface for this share mount target. + // - `vpc`: The fully-qualified domain name used in the mount path is an address that + // resolves to the share mount target. + MountPath *string `json:"mount_path,omitempty"` + + // The name for this share mount target. The name is unique across all mount targets for the file share. + Name *string `json:"name" validate:"required"` + + // The primary IP address of the virtual network interface for the share mount target. + // + // Absent if `access_control_mode` is `vpc`. + PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The subnet of the virtual network interface for the share mount target. + // + // Absent if `access_control_mode` is `vpc`. + Subnet *SubnetReference `json:"subnet,omitempty"` + + // The transit encryption mode for this share mount target: + // - `none`: Not encrypted in transit + // - `user_managed`: Encrypted in transit using an instance identity certificate + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected + // property value was encountered. + TransitEncryption *string `json:"transit_encryption" validate:"required"` + + // The virtual network interface for this file share mount target. + // + // This property will be present when the `access_control_mode` is `security_group`. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface,omitempty"` + + // If `access_control_mode` is: + // + // - `security_group`: The VPC for the virtual network interface for this share mount + // target + // - `vpc`: The VPC in which clients can mount the file share using this share + // mount target. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the ShareMountTarget.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a mount +// target control access to the mount target. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// +// The enumerated access control mode values for this property may expand in the future. When processing this property, +// check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which +// the unexpected access control mode was encountered. +const ( + ShareMountTargetAccessControlModeSecurityGroupConst = "security_group" + ShareMountTargetAccessControlModeVPCConst = "vpc" +) + +// Constants associated with the ShareMountTarget.LifecycleState property. +// The lifecycle state of the mount target. +const ( + ShareMountTargetLifecycleStateDeletingConst = "deleting" + ShareMountTargetLifecycleStateFailedConst = "failed" + ShareMountTargetLifecycleStatePendingConst = "pending" + ShareMountTargetLifecycleStateStableConst = "stable" + ShareMountTargetLifecycleStateSuspendedConst = "suspended" + ShareMountTargetLifecycleStateUpdatingConst = "updating" + ShareMountTargetLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the ShareMountTarget.ResourceType property. +// The resource type. +const ( + ShareMountTargetResourceTypeShareMountTargetConst = "share_mount_target" +) + +// Constants associated with the ShareMountTarget.TransitEncryption property. +// The transit encryption mode for this share mount target: +// - `none`: Not encrypted in transit +// - `user_managed`: Encrypted in transit using an instance identity certificate +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected +// property value was encountered. +const ( + ShareMountTargetTransitEncryptionNoneConst = "none" + ShareMountTargetTransitEncryptionUserManagedConst = "user_managed" +) + +// UnmarshalShareMountTarget unmarshals an instance of ShareMountTarget from the specified map of raw messages. +func UnmarshalShareMountTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTarget) + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mount_path", &obj.MountPath) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetCollection : ShareMountTargetCollection struct +type ShareMountTargetCollection struct { + // A link to the first page of resources. + First *ShareMountTargetCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of share mount targets. + MountTargets []ShareMountTarget `json:"mount_targets" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *ShareMountTargetCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareMountTargetCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ShareMountTargetCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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. + Name *string `json:"name,omitempty"` +} + +// UnmarshalShareMountTargetPatch unmarshals an instance of ShareMountTargetPatch from the specified map of raw messages. +func UnmarshalShareMountTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// ShareMountTargetPrototype : ShareMountTargetPrototype struct +// Models which "extend" this model: +// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup +// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC +type ShareMountTargetPrototype struct { + // The name for this share mount target. The name must not be used by another mount target for the file share. + Name *string `json:"name,omitempty"` + + // The transit encryption mode to use for this share mount target: + // - `none`: Not encrypted in transit. + // - `user_managed`: Encrypted in transit using an instance identity certificate. The + // `access_control_mode` for the share must be `security_group`. + TransitEncryption *string `json:"transit_encryption,omitempty"` + + VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface,omitempty"` + + // Identifies a VPC by a unique property. + VPC VPCIdentityIntf `json:"vpc,omitempty"` +} + +// Constants associated with the ShareMountTargetPrototype.TransitEncryption property. +// The transit encryption mode to use for this share mount target: +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. The +// `access_control_mode` for the share must be `security_group`. +const ( + ShareMountTargetPrototypeTransitEncryptionNoneConst = "none" + ShareMountTargetPrototypeTransitEncryptionUserManagedConst = "user_managed" +) + +func (*ShareMountTargetPrototype) isaShareMountTargetPrototype() bool { + return true +} + +type ShareMountTargetPrototypeIntf interface { + isaShareMountTargetPrototype() bool +} + +// UnmarshalShareMountTargetPrototype unmarshals an instance of ShareMountTargetPrototype from the specified map of raw messages. +func UnmarshalShareMountTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetReference : ShareMountTargetReference struct +type ShareMountTargetReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this share mount target. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this share mount target. + ID *string `json:"id" validate:"required"` + + // The name for this share mount target. The name is unique across all mount targets for the file share. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ShareMountTargetReference.ResourceType property. +// The resource type. +const ( + ShareMountTargetReferenceResourceTypeShareMountTargetConst = "share_mount_target" +) + +// UnmarshalShareMountTargetReference unmarshals an instance of ShareMountTargetReference from the specified map of raw messages. +func UnmarshalShareMountTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type ShareMountTargetReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalShareMountTargetReferenceDeleted unmarshals an instance of ShareMountTargetReferenceDeleted from the specified map of raw messages. +func UnmarshalShareMountTargetReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetVirtualNetworkInterfacePrototype : ShareMountTargetVirtualNetworkInterfacePrototype struct +// Models which "extend" this model: +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity +type ShareMountTargetVirtualNetworkInterfacePrototype 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"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,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"` + + // 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"` + + // 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 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"` + + // The resource group to use for this virtual network interface. If unspecified, the + // share's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,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"` +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototype) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +type ShareMountTargetVirtualNetworkInterfacePrototypeIntf interface { + isaShareMountTargetVirtualNetworkInterfacePrototype() bool +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototype unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototype from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SharePatch : SharePatch struct +type SharePatch struct { + // The access control mode for the share: + // + // - `security_group`: The security groups on the virtual network interface for a + // mount target control access to the mount target. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // + // For this property to be changed, the share must have no mount targets and + // `replication_role` must be `none`. + AccessControlMode *string `json:"access_control_mode,omitempty"` + + // The maximum input/output operations per second (IOPS) for the file share. The value must be in the range supported + // by the share's size. + // + // For this property to be changed, the share `lifecycle_state` must be `stable` and + // `replication_role` must not be `replica`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this share. The name must not be used by another share in the region. + Name *string `json:"name,omitempty"` + + // The profile to use for this file share. + // + // The requested profile must be in the same `family`. + Profile ShareProfileIdentityIntf `json:"profile,omitempty"` + + // The cron specification for the file share replication schedule. + // + // Replication of a share can be scheduled to occur at most once per hour. + // + // For this property to be changed, the share `replication_role` must be `replica`. + ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` + + // The size of the file share rounded up to the next gigabyte. The value must not be less than the share's current + // size, and must not exceed the maximum supported by the share's profile and IOPS. + // + // For this property to be changed, the share `lifecycle_state` must be `stable` and + // `replication_role` must not be `replica`. + Size *int64 `json:"size,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` +} + +// Constants associated with the SharePatch.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a +// mount target control access to the mount target. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// +// For this property to be changed, the share must have no mount targets and +// `replication_role` must be `none`. +const ( + SharePatchAccessControlModeSecurityGroupConst = "security_group" + SharePatchAccessControlModeVPCConst = "vpc" +) + +// UnmarshalSharePatch unmarshals an instance of SharePatch from the specified map of raw messages. +func UnmarshalSharePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePatch) + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// ShareProfile : ShareProfile struct +type ShareProfile struct { + // The permitted capacity range (in gigabytes) for a share with this profile. + Capacity ShareProfileCapacityIntf `json:"capacity" validate:"required"` + + // The product family this share profile belongs to. + Family *string `json:"family" validate:"required"` + + // The URL for this share profile. + Href *string `json:"href" validate:"required"` + + // The permitted IOPS range for a share with this profile. + Iops ShareProfileIopsIntf `json:"iops" validate:"required"` + + // The globally unique name for this share profile. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ShareProfile.Family property. +// The product family this share profile belongs to. +const ( + ShareProfileFamilyDefinedPerformanceConst = "defined_performance" +) + +// Constants associated with the ShareProfile.ResourceType property. +// The resource type. +const ( + ShareProfileResourceTypeShareProfileConst = "share_profile" +) + +// UnmarshalShareProfile unmarshals an instance of ShareProfile from the specified map of raw messages. +func UnmarshalShareProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfile) + err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalShareProfileCapacity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "iops", &obj.Iops, UnmarshalShareProfileIops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileCapacity : ShareProfileCapacity struct +// Models which "extend" this model: +// - ShareProfileCapacityFixed +// - ShareProfileCapacityRange +// - ShareProfileCapacityEnum +// - ShareProfileCapacityDependentRange +type ShareProfileCapacity 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 ShareProfileCapacity.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityTypeFixedConst = "fixed" +) + +func (*ShareProfileCapacity) isaShareProfileCapacity() bool { + return true +} + +type ShareProfileCapacityIntf interface { + isaShareProfileCapacity() bool +} + +// UnmarshalShareProfileCapacity unmarshals an instance of ShareProfileCapacity from the specified map of raw messages. +func UnmarshalShareProfileCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCapacity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileCollection : ShareProfileCollection struct +type ShareProfileCollection struct { + // A link to the first page of resources. + First *ShareProfileCollectionFirst `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"` + + // Collection of share profiles. + Profiles []ShareProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalShareProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *ShareProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIops : ShareProfileIops struct +// Models which "extend" this model: +// - ShareProfileIopsFixed +// - ShareProfileIopsRange +// - ShareProfileIopsEnum +// - ShareProfileIopsDependentRange +type ShareProfileIops 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 ShareProfileIops.Type property. +// The type for this profile field. +const ( + ShareProfileIopsTypeFixedConst = "fixed" +) + +func (*ShareProfileIops) isaShareProfileIops() bool { + return true +} + +type ShareProfileIopsIntf interface { + isaShareProfileIops() bool +} + +// UnmarshalShareProfileIops unmarshals an instance of ShareProfileIops from the specified map of raw messages. +func UnmarshalShareProfileIops(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIops) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIdentity : Identifies a share profile by a unique property. +// Models which "extend" this model: +// - ShareProfileIdentityByName +// - ShareProfileIdentityByHref +type ShareProfileIdentity struct { + // The globally unique name for this share profile. + Name *string `json:"name,omitempty"` + + // The URL for this share profile. + Href *string `json:"href,omitempty"` +} + +func (*ShareProfileIdentity) isaShareProfileIdentity() bool { + return true +} + +type ShareProfileIdentityIntf interface { + isaShareProfileIdentity() bool +} + +// UnmarshalShareProfileIdentity unmarshals an instance of ShareProfileIdentity from the specified map of raw messages. +func UnmarshalShareProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileReference : ShareProfileReference struct +type ShareProfileReference struct { + // The URL for this share profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this share profile. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ShareProfileReference.ResourceType property. +// The resource type. +const ( + ShareProfileReferenceResourceTypeShareProfileConst = "share_profile" +) + +// UnmarshalShareProfileReference unmarshals an instance of ShareProfileReference from the specified map of raw messages. +func UnmarshalShareProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SharePrototype : SharePrototype struct +// Models which "extend" this model: +// - SharePrototypeShareBySize +// - SharePrototypeShareBySourceShare +type SharePrototype struct { + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each client accessing the share will be restricted to 48,000 IOPS. + Iops *int64 `json:"iops,omitempty"` + + // The mount targets for the file share. Each mount target must be in a unique VPC. + MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` + + // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be + // a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use + // for this file share. The profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` + + // Configuration for a replica file share to create and associate with this file share. If + // unspecified, a replica may be subsequently added by creating a new file share with a + // `source_share` referencing this file share. + ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this file share will reside in. + // + // For a replica share, this must be a different zone in the same region as the + // source share. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The access control mode for the share: + // + // - `security_group`: The security groups on the virtual network interface for a + // mount target control access to the mount target. Mount targets for this share + // require a virtual network interface. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // Mount targets for this share require a VPC. + AccessControlMode *string `json:"access_control_mode,omitempty"` + + // The root key to use to wrap the data encryption key for the share. + // + // If unspecified, the `encryption` type for the share will be `provider_managed`. + // + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The owner assigned to the file share at creation. Subsequent changes to the owner + // must be performed by a client that has mounted the file share. + InitialOwner *ShareInitialOwner `json:"initial_owner,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 size of the file share rounded up to the next gigabyte. + // + // The maximum size for a share may increase in the future. + Size *int64 `json:"size,omitempty"` + + // The cron specification for the file share replication schedule. + // + // Replication of a share can be scheduled to occur at most once per hour. + ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` + + // The source file share for this replica file share. The specified file share must not + // already have a replica, and must not be a replica. If source file share is specified + // by CRN, it may be in an [associated partner + // region](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-replication). + SourceShare ShareIdentityIntf `json:"source_share,omitempty"` +} + +// Constants associated with the SharePrototype.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a +// mount target control access to the mount target. Mount targets for this share +// require a virtual network interface. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// Mount targets for this share require a VPC. +const ( + SharePrototypeAccessControlModeSecurityGroupConst = "security_group" + SharePrototypeAccessControlModeVPCConst = "vpc" +) + +func (*SharePrototype) isaSharePrototype() bool { + return true +} + +type SharePrototypeIntf interface { + isaSharePrototype() bool +} + +// UnmarshalSharePrototype unmarshals an instance of SharePrototype from the specified map of raw messages. +func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePrototype) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SharePrototypeShareContext : Configuration for a replica file share to create and associate with this file share. If unspecified, a replica may be +// subsequently added by creating a new file share with a +// `source_share` referencing this file share. +type SharePrototypeShareContext struct { + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each client accessing the share will be restricted to 48,000 IOPS. + Iops *int64 `json:"iops,omitempty"` + + // The mount targets for this replica file share. Each mount target must be in a unique VPC. + // + // A replica's mount targets must be mounted read-only. + MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` + + // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be + // a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use + // for this file share. The profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` + + // The cron specification for the file share replication schedule. + // + // Replication of a share can be scheduled to occur at most once per hour. + ReplicationCronSpec *string `json:"replication_cron_spec" validate:"required"` + + // The resource group to use. If unspecified, the resource group from + // the source share will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this replica file share will reside in. + // + // Must be a different zone in the same region as the source share. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewSharePrototypeShareContext : Instantiate SharePrototypeShareContext (Generic Model Constructor) +func (*VpcV1) NewSharePrototypeShareContext(profile ShareProfileIdentityIntf, replicationCronSpec string, zone ZoneIdentityIntf) (_model *SharePrototypeShareContext, err error) { + _model = &SharePrototypeShareContext{ + Profile: profile, + ReplicationCronSpec: core.StringPtr(replicationCronSpec), + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalSharePrototypeShareContext unmarshals an instance of SharePrototypeShareContext from the specified map of raw messages. +func UnmarshalSharePrototypeShareContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePrototypeShareContext) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareReference : ShareReference struct +type ShareReference struct { + // The CRN for this file share. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ShareReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this file share. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this file share. + ID *string `json:"id" validate:"required"` + + // The name for this share. The name is unique across all shares in the region. + 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 *ShareRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ShareReference.ResourceType property. +// The resource type. +const ( + ShareReferenceResourceTypeShareConst = "share" +) + +// UnmarshalShareReference unmarshals an instance of ShareReference from the specified map of raw messages. +func UnmarshalShareReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalShareRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type ShareReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalShareReferenceDeleted unmarshals an instance of ShareReferenceDeleted from the specified map of raw messages. +func UnmarshalShareReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type ShareRemote 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"` +} + +// UnmarshalShareRemote unmarshals an instance of ShareRemote from the specified map of raw messages. +func UnmarshalShareRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareRemote) + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareReplicationStatusReason : ShareReplicationStatusReason struct +type ShareReplicationStatusReason struct { + // A snake case string succinctly identifying the status reason. + 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 ShareReplicationStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + ShareReplicationStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication" + ShareReplicationStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share" + ShareReplicationStatusReasonCodeCannotReachSourceShareConst = "cannot_reach_source_share" +) + +// UnmarshalShareReplicationStatusReason unmarshals an instance of ShareReplicationStatusReason from the specified map of raw messages. +func UnmarshalShareReplicationStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareReplicationStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Snapshot : Snapshot struct +type Snapshot struct { + // If present, the backup policy plan which created this snapshot. + BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan,omitempty"` + + // Indicates if a boot volume attachment can be created with a volume created from this snapshot. + Bootable *bool `json:"bootable" validate:"required"` + + // The date and time the data capture for this snapshot was completed. + // + // If absent, this snapshot's data has not yet been captured. Additionally, this property may be absent for snapshots + // created before 1 January 2022. + CapturedAt *strfmt.DateTime `json:"captured_at,omitempty"` + + // Clones for this snapshot. + Clones []SnapshotClone `json:"clones" validate:"required"` + + // The copies of this snapshot. + Copies []SnapshotCopiesItem `json:"copies" validate:"required"` + + // The date and time that this snapshot was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN of this snapshot. + CRN *string `json:"crn" validate:"required"` + + // Indicates whether this snapshot can be deleted. This value will always be `true`. + // Deprecated: this field is deprecated and may be removed in a future release. + Deletable *bool `json:"deletable" validate:"required"` + + // The type of encryption used on the source volume. + Encryption *string `json:"encryption" validate:"required"` + + // The root key used to wrap the data encryption key for the source volume. + // + // This property will be present for volumes with an `encryption` type of + // `user_managed`. + EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` + + // The URL for this snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this snapshot. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of this snapshot. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The minimum capacity of a volume created from this snapshot. When a snapshot is created, this will be set to the + // capacity of the `source_volume`. + MinimumCapacity *int64 `json:"minimum_capacity" validate:"required"` + + // The name for this snapshot. The name is unique across all snapshots in the region. + Name *string `json:"name" validate:"required"` + + // The operating system included in this snapshot. + OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` + + // The resource group for this snapshot. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) prefixed with `is.snapshot:` associated with + // this snapshot. + ServiceTags []string `json:"service_tags" validate:"required"` + + // The size of this snapshot rounded up to the next gigabyte. + Size *int64 `json:"size" validate:"required"` + + // If present, the snapshot consistency group which created this snapshot. + SnapshotConsistencyGroup *SnapshotConsistencyGroupReference `json:"snapshot_consistency_group,omitempty"` + + // If present, the image from which the data on this snapshot was most directly + // provisioned. + SourceImage *ImageReference `json:"source_image,omitempty"` + + // If present, the source snapshot this snapshot was created from. + SourceSnapshot *SnapshotSourceSnapshot `json:"source_snapshot,omitempty"` + + // The source volume this snapshot was created from (may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + SourceVolume *VolumeReference `json:"source_volume" validate:"required"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags" validate:"required"` +} + +// Constants associated with the Snapshot.Encryption property. +// The type of encryption used on the source volume. +const ( + SnapshotEncryptionProviderManagedConst = "provider_managed" + SnapshotEncryptionUserManagedConst = "user_managed" +) + +// Constants associated with the Snapshot.LifecycleState property. +// The lifecycle state of this snapshot. +const ( + SnapshotLifecycleStateDeletingConst = "deleting" + SnapshotLifecycleStateFailedConst = "failed" + SnapshotLifecycleStatePendingConst = "pending" + SnapshotLifecycleStateStableConst = "stable" + SnapshotLifecycleStateSuspendedConst = "suspended" + SnapshotLifecycleStateUpdatingConst = "updating" + SnapshotLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the Snapshot.ResourceType property. +// The resource type. +const ( + SnapshotResourceTypeSnapshotConst = "snapshot" +) + +// UnmarshalSnapshot unmarshals an instance of Snapshot from the specified map of raw messages. +func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Snapshot) + err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "bootable", &obj.Bootable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "captured_at", &obj.CapturedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) + if err != nil { + return + } + err = core.UnmarshalModel(m, "copies", &obj.Copies, UnmarshalSnapshotCopiesItem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deletable", &obj.Deletable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "minimum_capacity", &obj.MinimumCapacity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_tags", &obj.ServiceTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalModel(m, "snapshot_consistency_group", &obj.SnapshotConsistencyGroup, UnmarshalSnapshotConsistencyGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_image", &obj.SourceImage, UnmarshalImageReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotSourceSnapshot) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotClone : SnapshotClone struct +type SnapshotClone struct { + // Indicates whether this snapshot clone is available for use. + Available *bool `json:"available" validate:"required"` + + // The date and time that this snapshot clone was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The zone this snapshot clone resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalSnapshotClone unmarshals an instance of SnapshotClone from the specified map of raw messages. +func UnmarshalSnapshotClone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotClone) + err = core.UnmarshalPrimitive(m, "available", &obj.Available) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotCloneCollection : SnapshotCloneCollection struct +type SnapshotCloneCollection struct { + // Collection of snapshot clones. + Clones []SnapshotClone `json:"clones" validate:"required"` +} + +// UnmarshalSnapshotCloneCollection unmarshals an instance of SnapshotCloneCollection from the specified map of raw messages. +func UnmarshalSnapshotCloneCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotCloneCollection) + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotClonePrototype : SnapshotClonePrototype struct +type SnapshotClonePrototype struct { + // The zone this snapshot clone will reside in. Must be in the same region as the + // snapshot. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewSnapshotClonePrototype : Instantiate SnapshotClonePrototype (Generic Model Constructor) +func (*VpcV1) NewSnapshotClonePrototype(zone ZoneIdentityIntf) (_model *SnapshotClonePrototype, err error) { + _model = &SnapshotClonePrototype{ + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalSnapshotClonePrototype unmarshals an instance of SnapshotClonePrototype from the specified map of raw messages. +func UnmarshalSnapshotClonePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotClonePrototype) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotCollection : SnapshotCollection struct +type SnapshotCollection struct { + // A link to the first page of resources. + First *SnapshotCollectionFirst `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"` + + // Collection of snapshots. + Snapshots []Snapshot `json:"snapshots" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSnapshotCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshot) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *SnapshotCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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. + BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan,omitempty"` + + // The date and time that this snapshot consistency group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN of this snapshot consistency group. + CRN *string `json:"crn" validate:"required"` + + // Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. + DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete" validate:"required"` + + // The URL for this snapshot consistency group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this snapshot consistency group. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of this snapshot consistency group. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the + // region. + Name *string `json:"name" validate:"required"` + + // The resource group for this snapshot consistency group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot consistency + // group. Each tag is prefixed with + // [is.instance:](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-faqs). + ServiceTags []string `json:"service_tags" validate:"required"` + + // The member snapshots that are data-consistent with respect to captured time. (may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + Snapshots []SnapshotReference `json:"snapshots" validate:"required"` +} + +// Constants associated with the SnapshotConsistencyGroup.LifecycleState property. +// The lifecycle state of this snapshot consistency group. +const ( + SnapshotConsistencyGroupLifecycleStateDeletingConst = "deleting" + SnapshotConsistencyGroupLifecycleStateFailedConst = "failed" + SnapshotConsistencyGroupLifecycleStatePendingConst = "pending" + SnapshotConsistencyGroupLifecycleStateStableConst = "stable" + SnapshotConsistencyGroupLifecycleStateSuspendedConst = "suspended" + SnapshotConsistencyGroupLifecycleStateUpdatingConst = "updating" + SnapshotConsistencyGroupLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the SnapshotConsistencyGroup.ResourceType property. +// The resource type. +const ( + SnapshotConsistencyGroupResourceTypeSnapshotConsistencyGroupConst = "snapshot_consistency_group" +) + +// UnmarshalSnapshotConsistencyGroup unmarshals an instance of SnapshotConsistencyGroup from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroup) + err = core.UnmarshalModel(m, "backup_policy_plan", &obj.BackupPolicyPlan, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_tags", &obj.ServiceTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotConsistencyGroupCollection : SnapshotConsistencyGroupCollection struct +type SnapshotConsistencyGroupCollection struct { + // A link to the first page of resources. + First *SnapshotConsistencyGroupCollectionFirst `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"` + + // Collection of snapshot consistency groups. + SnapshotConsistencyGroups []SnapshotConsistencyGroup `json:"snapshot_consistency_groups" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSnapshotConsistencyGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "snapshot_consistency_groups", &obj.SnapshotConsistencyGroups, UnmarshalSnapshotConsistencyGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *SnapshotConsistencyGroupCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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. + DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete,omitempty"` + + // The name for this snapshot consistency group. The name must not be used by another snapshot consistency groups in + // the region. + Name *string `json:"name,omitempty"` +} + +// UnmarshalSnapshotConsistencyGroupPatch unmarshals an instance of SnapshotConsistencyGroupPatch from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroupPatch) + err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// SnapshotConsistencyGroupPrototype : SnapshotConsistencyGroupPrototype struct +// Models which "extend" this model: +// - SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots +type SnapshotConsistencyGroupPrototype struct { + // Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. + DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete,omitempty"` + + // The name for this snapshot consistency group. The name must be unique across all snapshot consistency groups in the + // region. + // + // 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"` + + // The data-consistent member snapshots to create. All snapshots must specify a + // `source_volume` attached to the same virtual server instance. + Snapshots []SnapshotPrototypeSnapshotConsistencyGroupContext `json:"snapshots,omitempty"` +} + +func (*SnapshotConsistencyGroupPrototype) isaSnapshotConsistencyGroupPrototype() bool { + return true +} + +type SnapshotConsistencyGroupPrototypeIntf interface { + isaSnapshotConsistencyGroupPrototype() bool +} + +// UnmarshalSnapshotConsistencyGroupPrototype unmarshals an instance of SnapshotConsistencyGroupPrototype from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroupPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroupPrototype) + err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotConsistencyGroupReference : SnapshotConsistencyGroupReference struct +type SnapshotConsistencyGroupReference struct { + // The CRN of this snapshot consistency group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SnapshotConsistencyGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this snapshot consistency group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this snapshot consistency group. + ID *string `json:"id" validate:"required"` + + // The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the + // region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SnapshotConsistencyGroupReference.ResourceType property. +// The resource type. +const ( + SnapshotConsistencyGroupReferenceResourceTypeSnapshotConsistencyGroupConst = "snapshot_consistency_group" +) + +// UnmarshalSnapshotConsistencyGroupReference unmarshals an instance of SnapshotConsistencyGroupReference from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotConsistencyGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotConsistencyGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type SnapshotConsistencyGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalSnapshotConsistencyGroupReferenceDeleted unmarshals an instance of SnapshotConsistencyGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotCopiesItem : SnapshotCopiesItem struct +type SnapshotCopiesItem struct { + // The CRN for the copied snapshot. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + + // The URL for the copied snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for the copied snapshot. + ID *string `json:"id" validate:"required"` + + // The name for the copied snapshot. + 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 *SnapshotRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SnapshotCopiesItem.ResourceType property. +// The resource type. +const ( + SnapshotCopiesItemResourceTypeSnapshotConst = "snapshot" +) + +// UnmarshalSnapshotCopiesItem unmarshals an instance of SnapshotCopiesItem from the specified map of raw messages. +func UnmarshalSnapshotCopiesItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotCopiesItem) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotIdentity : Identifies a snapshot by a unique property. +// Models which "extend" this model: +// - SnapshotIdentityByID +// - SnapshotIdentityByCRN +// - SnapshotIdentityByHref +type SnapshotIdentity struct { + // The unique identifier for this snapshot. + ID *string `json:"id,omitempty"` + + // The CRN of this snapshot. + CRN *string `json:"crn,omitempty"` + + // The URL for this snapshot. + Href *string `json:"href,omitempty"` +} + +func (*SnapshotIdentity) isaSnapshotIdentity() bool { + return true +} + +type SnapshotIdentityIntf interface { + isaSnapshotIdentity() bool +} + +// UnmarshalSnapshotIdentity unmarshals an instance of SnapshotIdentity from the specified map of raw messages. +func UnmarshalSnapshotIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotPatch : SnapshotPatch struct +type SnapshotPatch struct { + // The name for this snapshot. The name must not be used by another snapshot in the region. + Name *string `json:"name,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` +} + +// UnmarshalSnapshotPatch unmarshals an instance of SnapshotPatch from the specified map of raw messages. +func UnmarshalSnapshotPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// SnapshotPrototype : SnapshotPrototype struct +// Models which "extend" this model: +// - SnapshotPrototypeSnapshotBySourceVolume +// - SnapshotPrototypeSnapshotBySourceSnapshot +type SnapshotPrototype struct { + // Clones to create for this snapshot. + Clones []SnapshotClonePrototype `json:"clones,omitempty"` + + // The name for this snapshot. The name must not be used by another snapshot in the region. 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"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` + + // The volume to create this snapshot from. + SourceVolume VolumeIdentityIntf `json:"source_volume,omitempty"` + + // The root key to use to wrap the data encryption key for this snapshot. + // + // A key must be specified if and only if the source snapshot has an `encryption` type of + // `user_managed`. To maximize snapshot availability and sharing of snapshot data, specify + // a key in the same region as the new snapshot, and use the same encryption key for all + // snapshots using the same source volume. + // + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The source snapshot (in another region) to create this snapshot from. + // The specified snapshot must not already be the source of another snapshot in this + // region. + SourceSnapshot *SnapshotIdentityByCRN `json:"source_snapshot,omitempty"` +} + +func (*SnapshotPrototype) isaSnapshotPrototype() bool { + return true +} + +type SnapshotPrototypeIntf interface { + isaSnapshotPrototype() bool +} + +// UnmarshalSnapshotPrototype unmarshals an instance of SnapshotPrototype from the specified map of raw messages. +func UnmarshalSnapshotPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPrototype) + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotPrototypeSnapshotConsistencyGroupContext : SnapshotPrototypeSnapshotConsistencyGroupContext struct +type SnapshotPrototypeSnapshotConsistencyGroupContext struct { + // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The volume to create this snapshot from. + SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` +} + +// NewSnapshotPrototypeSnapshotConsistencyGroupContext : Instantiate SnapshotPrototypeSnapshotConsistencyGroupContext (Generic Model Constructor) +func (*VpcV1) NewSnapshotPrototypeSnapshotConsistencyGroupContext(sourceVolume VolumeIdentityIntf) (_model *SnapshotPrototypeSnapshotConsistencyGroupContext, err error) { + _model = &SnapshotPrototypeSnapshotConsistencyGroupContext{ + SourceVolume: sourceVolume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext unmarshals an instance of SnapshotPrototypeSnapshotConsistencyGroupContext from the specified map of raw messages. +func UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPrototypeSnapshotConsistencyGroupContext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotReference : SnapshotReference struct +type SnapshotReference struct { + // The CRN of this snapshot. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this snapshot. + ID *string `json:"id" validate:"required"` + + // The name for this snapshot. The name is unique across all snapshots in the region. + 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 *SnapshotRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SnapshotReference.ResourceType property. +// The resource type. +const ( + SnapshotReferenceResourceTypeSnapshotConst = "snapshot" +) + +// UnmarshalSnapshotReference unmarshals an instance of SnapshotReference from the specified map of raw messages. +func UnmarshalSnapshotReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type SnapshotReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalSnapshotReferenceDeleted unmarshals an instance of SnapshotReferenceDeleted from the specified map of raw messages. +func UnmarshalSnapshotReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type SnapshotRemote 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"` +} + +// UnmarshalSnapshotRemote unmarshals an instance of SnapshotRemote from the specified map of raw messages. +func UnmarshalSnapshotRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotRemote) + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotSourceSnapshot : If present, the source snapshot this snapshot was created from. +type SnapshotSourceSnapshot struct { + // The CRN of the source snapshot. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + + // The URL for the source snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for the source snapshot. + ID *string `json:"id" validate:"required"` + + // The name for the source snapshot. The name is unique across all snapshots in the source snapshot's native region. + 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 *SnapshotRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SnapshotSourceSnapshot.ResourceType property. +// The resource type. +const ( + SnapshotSourceSnapshotResourceTypeSnapshotConst = "snapshot" +) + +// UnmarshalSnapshotSourceSnapshot unmarshals an instance of SnapshotSourceSnapshot from the specified map of raw messages. +func UnmarshalSnapshotSourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotSourceSnapshot) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSnapshotRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// StartBareMetalServerOptions : The StartBareMetalServer options. +type StartBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewStartBareMetalServerOptions : Instantiate StartBareMetalServerOptions +func (*VpcV1) NewStartBareMetalServerOptions(id string) *StartBareMetalServerOptions { + return &StartBareMetalServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *StartBareMetalServerOptions) SetID(id string) *StartBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *StartBareMetalServerOptions) SetHeaders(param map[string]string) *StartBareMetalServerOptions { + options.Headers = param + return options +} + +// StopBareMetalServerOptions : The StopBareMetalServer options. +type StopBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // The type of stop operation: + // - `soft`: signal running operating system to quiesce and shutdown cleanly + // - `hard`: immediately stop the server. + Type *string `json:"type" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the StopBareMetalServerOptions.Type property. +// The type of stop operation: +// - `soft`: signal running operating system to quiesce and shutdown cleanly +// - `hard`: immediately stop the server. +const ( + StopBareMetalServerOptionsTypeHardConst = "hard" + StopBareMetalServerOptionsTypeSoftConst = "soft" +) + +// NewStopBareMetalServerOptions : Instantiate StopBareMetalServerOptions +func (*VpcV1) NewStopBareMetalServerOptions(id string, typeVar string) *StopBareMetalServerOptions { + return &StopBareMetalServerOptions{ + ID: core.StringPtr(id), + Type: core.StringPtr(typeVar), + } +} + +// SetID : Allow user to set ID +func (_options *StopBareMetalServerOptions) SetID(id string) *StopBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetType : Allow user to set Type +func (_options *StopBareMetalServerOptions) SetType(typeVar string) *StopBareMetalServerOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *StopBareMetalServerOptions) SetHeaders(param map[string]string) *StopBareMetalServerOptions { + options.Headers = param + return options +} + +// Subnet : Subnet struct +type Subnet struct { + // The number of IPv4 addresses in this 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 date and time that the subnet was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` + + // The URL for this subnet. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` + + // The IP version(s) supported by this subnet. + IPVersion *string `json:"ip_version" validate:"required"` + + // The IPv4 range of the subnet, expressed in CIDR format. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` + + // The name for this subnet. The name is unique across all subnets in the VPC. + Name *string `json:"name" validate:"required"` + + // The network ACL for this subnet. + NetworkACL *NetworkACLReference `json:"network_acl" validate:"required"` + + // The public gateway to use for internet-bound traffic for this subnet. + PublicGateway *PublicGatewayReference `json:"public_gateway,omitempty"` + + // The resource group for this subnet. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The routing table for this subnet. + RoutingTable *RoutingTableReference `json:"routing_table" validate:"required"` + + // The status of the subnet. + Status *string `json:"status" validate:"required"` + + // The total number of IPv4 addresses in this 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"` + + // The VPC this subnet resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this subnet resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Subnet.IPVersion property. +// The IP version(s) supported by this subnet. +const ( + SubnetIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the Subnet.ResourceType property. +// The resource type. +const ( + SubnetResourceTypeSubnetConst = "subnet" +) + +// Constants associated with the Subnet.Status property. +// The status of the subnet. +const ( + SubnetStatusAvailableConst = "available" + SubnetStatusDeletingConst = "deleting" + SubnetStatusFailedConst = "failed" + SubnetStatusPendingConst = "pending" +) + +// UnmarshalSubnet unmarshals an instance of Subnet from the specified map of raw messages. +func UnmarshalSubnet(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Subnet) + err = core.UnmarshalPrimitive(m, "available_ipv4_address_count", &obj.AvailableIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetCollection : SubnetCollection struct +type SubnetCollection struct { + // A link to the first page of resources. + First *SubnetCollectionFirst `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"` + + // Collection of subnets. + Subnets []Subnet `json:"subnets" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSubnetCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnet) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *SubnetCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentity : Identifies a subnet by a unique property. +// Models which "extend" this model: +// - SubnetIdentityByID +// - SubnetIdentityByCRN +// - SubnetIdentityByHref +type SubnetIdentity struct { + // The unique identifier for this subnet. + ID *string `json:"id,omitempty"` + + // The CRN for this subnet. + CRN *string `json:"crn,omitempty"` + + // The URL for this subnet. + Href *string `json:"href,omitempty"` +} + +func (*SubnetIdentity) isaSubnetIdentity() bool { + return true +} + +type SubnetIdentityIntf interface { + isaSubnetIdentity() bool +} + +// UnmarshalSubnetIdentity unmarshals an instance of SubnetIdentity from the specified map of raw messages. +func UnmarshalSubnetIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPatch : SubnetPatch struct +type SubnetPatch struct { + // The name for this subnet. The name must not be used by another subnet in the VPC. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to use for internet-bound traffic for this subnet. + PublicGateway SubnetPublicGatewayPatchIntf `json:"public_gateway,omitempty"` + + // The routing table to use for this subnet. The routing table properties + // `route_direct_link_ingress`, `route_internet_ingress`, + // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` +} + +// UnmarshalSubnetPatch unmarshals an instance of SubnetPatch from the specified map of raw messages. +func UnmarshalSubnetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalSubnetPublicGatewayPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// SubnetPrototype : SubnetPrototype struct +// Models which "extend" this model: +// - SubnetPrototypeSubnetByTotalCount +// - SubnetPrototypeSubnetByCIDR +type SubnetPrototype struct { + // The IP version(s) to support for this subnet. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a + // hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to use for internet-bound traffic for this subnet. If + // unspecified, the subnet will not be attached to a public gateway. + PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,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 routing table to use for this subnet. If unspecified, the default routing table + // for the VPC is used. The routing table properties `route_direct_link_ingress`, + // `route_internet_ingress`, `route_transit_gateway_ingress`, and + // `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` + + // The VPC the subnet will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The total number of IPv4 addresses required. Must be a power of 2. The VPC must have a default address prefix in the + // specified zone, and that prefix must have a free CIDR range with at least this number of addresses. + TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count,omitempty"` + + // The zone this subnet will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // The IPv4 range of the subnet, expressed in CIDR format. The prefix length of the subnet's CIDR must be between `/9` + // (8,388,608 addresses) and `/29` (8 addresses). The IPv4 range of the subnet's CIDR must fall within an existing + // address prefix in the VPC and must not overlap with any existing subnet. The subnet will be created in the zone of + // the address prefix that contains the IPv4 CIDR. If zone is specified, it must match the zone of the address prefix + // that contains the subnet's IPv4 CIDR. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block,omitempty"` +} + +// Constants associated with the SubnetPrototype.IPVersion property. +// The IP version(s) to support for this subnet. +const ( + SubnetPrototypeIPVersionIpv4Const = "ipv4" +) + +func (*SubnetPrototype) isaSubnetPrototype() bool { + return true +} + +type SubnetPrototypeIntf interface { + isaSubnetPrototype() bool +} + +// UnmarshalSubnetPrototype unmarshals an instance of SubnetPrototype from the specified map of raw messages. +func UnmarshalSubnetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPrototype) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPublicGatewayPatch : The public gateway to use for internet-bound traffic for this subnet. +// Models which "extend" this model: +// - SubnetPublicGatewayPatchPublicGatewayIdentityByID +// - SubnetPublicGatewayPatchPublicGatewayIdentityByCRN +// - SubnetPublicGatewayPatchPublicGatewayIdentityByHref +type SubnetPublicGatewayPatch struct { + // The unique identifier for this public gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this public gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href,omitempty"` +} + +func (*SubnetPublicGatewayPatch) isaSubnetPublicGatewayPatch() bool { + return true +} + +type SubnetPublicGatewayPatchIntf interface { + isaSubnetPublicGatewayPatch() bool +} + +// UnmarshalSubnetPublicGatewayPatch unmarshals an instance of SubnetPublicGatewayPatch from the specified map of raw messages. +func UnmarshalSubnetPublicGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPublicGatewayPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetReference : SubnetReference struct +type SubnetReference struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SubnetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this subnet. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` + + // The name for this subnet. The name is unique across all subnets in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SubnetReference.ResourceType property. +// The resource type. +const ( + SubnetReferenceResourceTypeSubnetConst = "subnet" +) + +// UnmarshalSubnetReference unmarshals an instance of SubnetReference from the specified map of raw messages. +func UnmarshalSubnetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSubnetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type SubnetReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalSubnetReferenceDeleted unmarshals an instance of SubnetReferenceDeleted from the specified map of raw messages. +func UnmarshalSubnetReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfileIdentity : Identifies a trusted profile by a unique property. +// Models which "extend" this model: +// - TrustedProfileIdentityTrustedProfileByID +// - TrustedProfileIdentityTrustedProfileByCRN +type TrustedProfileIdentity struct { + // The unique identifier for this trusted profile. + ID *string `json:"id,omitempty"` + + // The CRN for this trusted profile. + CRN *string `json:"crn,omitempty"` +} + +func (*TrustedProfileIdentity) isaTrustedProfileIdentity() bool { + return true +} + +type TrustedProfileIdentityIntf interface { + isaTrustedProfileIdentity() bool +} + +// UnmarshalTrustedProfileIdentity unmarshals an instance of TrustedProfileIdentity from the specified map of raw messages. +func UnmarshalTrustedProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TrustedProfileIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfileReference : TrustedProfileReference struct +type TrustedProfileReference struct { + // The CRN for this trusted profile. + CRN *string `json:"crn" validate:"required"` + + // The unique identifier for this trusted profile. + ID *string `json:"id" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the TrustedProfileReference.ResourceType property. +// The resource type. +const ( + TrustedProfileReferenceResourceTypeTrustedProfileConst = "trusted_profile" +) + +// UnmarshalTrustedProfileReference unmarshals an instance of TrustedProfileReference from the specified map of raw messages. +func UnmarshalTrustedProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TrustedProfileReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UnsetSubnetPublicGatewayOptions : The UnsetSubnetPublicGateway options. +type UnsetSubnetPublicGatewayOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUnsetSubnetPublicGatewayOptions : Instantiate UnsetSubnetPublicGatewayOptions +func (*VpcV1) NewUnsetSubnetPublicGatewayOptions(id string) *UnsetSubnetPublicGatewayOptions { + return &UnsetSubnetPublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *UnsetSubnetPublicGatewayOptions) SetID(id string) *UnsetSubnetPublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UnsetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *UnsetSubnetPublicGatewayOptions { + options.Headers = param + return options +} + +// UpdateBackupPolicyOptions : The UpdateBackupPolicy options. +type UpdateBackupPolicyOptions struct { + // The backup policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The backup policy patch. + BackupPolicyPatch map[string]interface{} `json:"BackupPolicy_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 +} + +// NewUpdateBackupPolicyOptions : Instantiate UpdateBackupPolicyOptions +func (*VpcV1) NewUpdateBackupPolicyOptions(id string, backupPolicyPatch map[string]interface{}) *UpdateBackupPolicyOptions { + return &UpdateBackupPolicyOptions{ + ID: core.StringPtr(id), + BackupPolicyPatch: backupPolicyPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateBackupPolicyOptions) SetID(id string) *UpdateBackupPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBackupPolicyPatch : Allow user to set BackupPolicyPatch +func (_options *UpdateBackupPolicyOptions) SetBackupPolicyPatch(backupPolicyPatch map[string]interface{}) *UpdateBackupPolicyOptions { + _options.BackupPolicyPatch = backupPolicyPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateBackupPolicyOptions) SetIfMatch(ifMatch string) *UpdateBackupPolicyOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBackupPolicyOptions) SetHeaders(param map[string]string) *UpdateBackupPolicyOptions { + options.Headers = param + return options +} + +// UpdateBackupPolicyPlanOptions : The UpdateBackupPolicyPlan options. +type UpdateBackupPolicyPlanOptions struct { + // The backup policy identifier. + BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` + + // The backup policy plan identifier. + ID *string `json:"id" validate:"required,ne="` + + // The backup policy plan patch. + BackupPolicyPlanPatch map[string]interface{} `json:"BackupPolicyPlan_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 +} + +// NewUpdateBackupPolicyPlanOptions : Instantiate UpdateBackupPolicyPlanOptions +func (*VpcV1) NewUpdateBackupPolicyPlanOptions(backupPolicyID string, id string, backupPolicyPlanPatch map[string]interface{}) *UpdateBackupPolicyPlanOptions { + return &UpdateBackupPolicyPlanOptions{ + BackupPolicyID: core.StringPtr(backupPolicyID), + ID: core.StringPtr(id), + BackupPolicyPlanPatch: backupPolicyPlanPatch, + } +} + +// SetBackupPolicyID : Allow user to set BackupPolicyID +func (_options *UpdateBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *UpdateBackupPolicyPlanOptions { + _options.BackupPolicyID = core.StringPtr(backupPolicyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateBackupPolicyPlanOptions) SetID(id string) *UpdateBackupPolicyPlanOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBackupPolicyPlanPatch : Allow user to set BackupPolicyPlanPatch +func (_options *UpdateBackupPolicyPlanOptions) SetBackupPolicyPlanPatch(backupPolicyPlanPatch map[string]interface{}) *UpdateBackupPolicyPlanOptions { + _options.BackupPolicyPlanPatch = backupPolicyPlanPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateBackupPolicyPlanOptions) SetIfMatch(ifMatch string) *UpdateBackupPolicyPlanOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *UpdateBackupPolicyPlanOptions { + options.Headers = param + return options +} + +// UpdateBareMetalServerDiskOptions : The UpdateBareMetalServerDisk options. +type UpdateBareMetalServerDiskOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // The bare metal server disk patch. + BareMetalServerDiskPatch map[string]interface{} `json:"BareMetalServerDisk_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateBareMetalServerDiskOptions : Instantiate UpdateBareMetalServerDiskOptions +func (*VpcV1) NewUpdateBareMetalServerDiskOptions(bareMetalServerID string, id string, bareMetalServerDiskPatch map[string]interface{}) *UpdateBareMetalServerDiskOptions { + return &UpdateBareMetalServerDiskOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + BareMetalServerDiskPatch: bareMetalServerDiskPatch, + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *UpdateBareMetalServerDiskOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerDiskOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateBareMetalServerDiskOptions) SetID(id string) *UpdateBareMetalServerDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBareMetalServerDiskPatch : Allow user to set BareMetalServerDiskPatch +func (_options *UpdateBareMetalServerDiskOptions) SetBareMetalServerDiskPatch(bareMetalServerDiskPatch map[string]interface{}) *UpdateBareMetalServerDiskOptions { + _options.BareMetalServerDiskPatch = bareMetalServerDiskPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBareMetalServerDiskOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerDiskOptions { + options.Headers = param + return options +} + +// UpdateBareMetalServerNetworkAttachmentOptions : The UpdateBareMetalServerNetworkAttachment options. +type UpdateBareMetalServerNetworkAttachmentOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // The bare metal server network attachment patch. + BareMetalServerNetworkAttachmentPatch map[string]interface{} `json:"BareMetalServerNetworkAttachment_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateBareMetalServerNetworkAttachmentOptions : Instantiate UpdateBareMetalServerNetworkAttachmentOptions +func (*VpcV1) NewUpdateBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string, bareMetalServerNetworkAttachmentPatch map[string]interface{}) *UpdateBareMetalServerNetworkAttachmentOptions { + return &UpdateBareMetalServerNetworkAttachmentOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + BareMetalServerNetworkAttachmentPatch: bareMetalServerNetworkAttachmentPatch, + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetID(id string) *UpdateBareMetalServerNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBareMetalServerNetworkAttachmentPatch : Allow user to set BareMetalServerNetworkAttachmentPatch +func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerNetworkAttachmentPatch(bareMetalServerNetworkAttachmentPatch map[string]interface{}) *UpdateBareMetalServerNetworkAttachmentOptions { + _options.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerNetworkAttachmentOptions { + options.Headers = param + return options +} + +// UpdateBareMetalServerNetworkInterfaceOptions : The UpdateBareMetalServerNetworkInterface options. +type UpdateBareMetalServerNetworkInterfaceOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The bare metal server network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // The bare metal server network interface patch. + BareMetalServerNetworkInterfacePatch map[string]interface{} `json:"BareMetalServerNetworkInterface_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateBareMetalServerNetworkInterfaceOptions : Instantiate UpdateBareMetalServerNetworkInterfaceOptions +func (*VpcV1) NewUpdateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string, bareMetalServerNetworkInterfacePatch map[string]interface{}) *UpdateBareMetalServerNetworkInterfaceOptions { + return &UpdateBareMetalServerNetworkInterfaceOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + ID: core.StringPtr(id), + BareMetalServerNetworkInterfacePatch: bareMetalServerNetworkInterfacePatch, + } +} + +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetID(id string) *UpdateBareMetalServerNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBareMetalServerNetworkInterfacePatch : Allow user to set BareMetalServerNetworkInterfacePatch +func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePatch(bareMetalServerNetworkInterfacePatch map[string]interface{}) *UpdateBareMetalServerNetworkInterfaceOptions { + _options.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerNetworkInterfaceOptions { + options.Headers = param + return options +} + +// UpdateBareMetalServerOptions : The UpdateBareMetalServer options. +type UpdateBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // The bare metal server patch. + BareMetalServerPatch map[string]interface{} `json:"BareMetalServer_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateBareMetalServerOptions : Instantiate UpdateBareMetalServerOptions +func (*VpcV1) NewUpdateBareMetalServerOptions(id string, bareMetalServerPatch map[string]interface{}) *UpdateBareMetalServerOptions { + return &UpdateBareMetalServerOptions{ + ID: core.StringPtr(id), + BareMetalServerPatch: bareMetalServerPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateBareMetalServerOptions) SetID(id string) *UpdateBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBareMetalServerPatch : Allow user to set BareMetalServerPatch +func (_options *UpdateBareMetalServerOptions) SetBareMetalServerPatch(bareMetalServerPatch map[string]interface{}) *UpdateBareMetalServerOptions { + _options.BareMetalServerPatch = bareMetalServerPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateBareMetalServerOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerOptions { + options.Headers = param + return options +} + +// UpdateDedicatedHostDiskOptions : The UpdateDedicatedHostDisk options. +type UpdateDedicatedHostDiskOptions struct { + // The dedicated host identifier. + DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="` + + // The dedicated host disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // The dedicated host disk patch. + DedicatedHostDiskPatch map[string]interface{} `json:"DedicatedHostDisk_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateDedicatedHostDiskOptions : Instantiate UpdateDedicatedHostDiskOptions +func (*VpcV1) NewUpdateDedicatedHostDiskOptions(dedicatedHostID string, id string, dedicatedHostDiskPatch map[string]interface{}) *UpdateDedicatedHostDiskOptions { + return &UpdateDedicatedHostDiskOptions{ + DedicatedHostID: core.StringPtr(dedicatedHostID), + ID: core.StringPtr(id), + DedicatedHostDiskPatch: dedicatedHostDiskPatch, + } +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (_options *UpdateDedicatedHostDiskOptions) SetDedicatedHostID(dedicatedHostID string) *UpdateDedicatedHostDiskOptions { + _options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateDedicatedHostDiskOptions) SetID(id string) *UpdateDedicatedHostDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetDedicatedHostDiskPatch : Allow user to set DedicatedHostDiskPatch +func (_options *UpdateDedicatedHostDiskOptions) SetDedicatedHostDiskPatch(dedicatedHostDiskPatch map[string]interface{}) *UpdateDedicatedHostDiskOptions { + _options.DedicatedHostDiskPatch = dedicatedHostDiskPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateDedicatedHostDiskOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostDiskOptions { + options.Headers = param + return options +} + +// UpdateDedicatedHostGroupOptions : The UpdateDedicatedHostGroup options. +type UpdateDedicatedHostGroupOptions struct { + // The dedicated host group identifier. + ID *string `json:"id" validate:"required,ne="` + + // The dedicated host group patch. + DedicatedHostGroupPatch map[string]interface{} `json:"DedicatedHostGroup_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateDedicatedHostGroupOptions : Instantiate UpdateDedicatedHostGroupOptions +func (*VpcV1) NewUpdateDedicatedHostGroupOptions(id string, dedicatedHostGroupPatch map[string]interface{}) *UpdateDedicatedHostGroupOptions { + return &UpdateDedicatedHostGroupOptions{ + ID: core.StringPtr(id), + DedicatedHostGroupPatch: dedicatedHostGroupPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateDedicatedHostGroupOptions) SetID(id string) *UpdateDedicatedHostGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetDedicatedHostGroupPatch : Allow user to set DedicatedHostGroupPatch +func (_options *UpdateDedicatedHostGroupOptions) SetDedicatedHostGroupPatch(dedicatedHostGroupPatch map[string]interface{}) *UpdateDedicatedHostGroupOptions { + _options.DedicatedHostGroupPatch = dedicatedHostGroupPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateDedicatedHostGroupOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// UpdateDedicatedHostOptions : The UpdateDedicatedHost options. +type UpdateDedicatedHostOptions struct { + // The dedicated host identifier. + ID *string `json:"id" validate:"required,ne="` + + // The dedicated host patch. + DedicatedHostPatch map[string]interface{} `json:"DedicatedHost_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateDedicatedHostOptions : Instantiate UpdateDedicatedHostOptions +func (*VpcV1) NewUpdateDedicatedHostOptions(id string, dedicatedHostPatch map[string]interface{}) *UpdateDedicatedHostOptions { + return &UpdateDedicatedHostOptions{ + ID: core.StringPtr(id), + DedicatedHostPatch: dedicatedHostPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateDedicatedHostOptions) SetID(id string) *UpdateDedicatedHostOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetDedicatedHostPatch : Allow user to set DedicatedHostPatch +func (_options *UpdateDedicatedHostOptions) SetDedicatedHostPatch(dedicatedHostPatch map[string]interface{}) *UpdateDedicatedHostOptions { + _options.DedicatedHostPatch = dedicatedHostPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateDedicatedHostOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostOptions { + options.Headers = param + return options +} + +// UpdateEndpointGatewayOptions : The UpdateEndpointGateway options. +type UpdateEndpointGatewayOptions struct { + // The endpoint gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // The endpoint gateway patch. + EndpointGatewayPatch map[string]interface{} `json:"EndpointGateway_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateEndpointGatewayOptions : Instantiate UpdateEndpointGatewayOptions +func (*VpcV1) NewUpdateEndpointGatewayOptions(id string, endpointGatewayPatch map[string]interface{}) *UpdateEndpointGatewayOptions { + return &UpdateEndpointGatewayOptions{ + ID: core.StringPtr(id), + EndpointGatewayPatch: endpointGatewayPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateEndpointGatewayOptions) SetID(id string) *UpdateEndpointGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetEndpointGatewayPatch : Allow user to set EndpointGatewayPatch +func (_options *UpdateEndpointGatewayOptions) SetEndpointGatewayPatch(endpointGatewayPatch map[string]interface{}) *UpdateEndpointGatewayOptions { + _options.EndpointGatewayPatch = endpointGatewayPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateEndpointGatewayOptions) SetHeaders(param map[string]string) *UpdateEndpointGatewayOptions { + options.Headers = param + return options +} + +// UpdateFloatingIPOptions : The UpdateFloatingIP options. +type UpdateFloatingIPOptions struct { + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // The floating IP patch. + FloatingIPPatch map[string]interface{} `json:"FloatingIP_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateFloatingIPOptions : Instantiate UpdateFloatingIPOptions +func (*VpcV1) NewUpdateFloatingIPOptions(id string, floatingIPPatch map[string]interface{}) *UpdateFloatingIPOptions { + return &UpdateFloatingIPOptions{ + ID: core.StringPtr(id), + FloatingIPPatch: floatingIPPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateFloatingIPOptions) SetID(id string) *UpdateFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetFloatingIPPatch : Allow user to set FloatingIPPatch +func (_options *UpdateFloatingIPOptions) SetFloatingIPPatch(floatingIPPatch map[string]interface{}) *UpdateFloatingIPOptions { + _options.FloatingIPPatch = floatingIPPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateFloatingIPOptions) SetHeaders(param map[string]string) *UpdateFloatingIPOptions { + options.Headers = param + return options +} + +// UpdateFlowLogCollectorOptions : The UpdateFlowLogCollector options. +type UpdateFlowLogCollectorOptions struct { + // The flow log collector identifier. + ID *string `json:"id" validate:"required,ne="` + + // The flow log collector patch. + FlowLogCollectorPatch map[string]interface{} `json:"FlowLogCollector_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateFlowLogCollectorOptions : Instantiate UpdateFlowLogCollectorOptions +func (*VpcV1) NewUpdateFlowLogCollectorOptions(id string, flowLogCollectorPatch map[string]interface{}) *UpdateFlowLogCollectorOptions { + return &UpdateFlowLogCollectorOptions{ + ID: core.StringPtr(id), + FlowLogCollectorPatch: flowLogCollectorPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateFlowLogCollectorOptions) SetID(id string) *UpdateFlowLogCollectorOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetFlowLogCollectorPatch : Allow user to set FlowLogCollectorPatch +func (_options *UpdateFlowLogCollectorOptions) SetFlowLogCollectorPatch(flowLogCollectorPatch map[string]interface{}) *UpdateFlowLogCollectorOptions { + _options.FlowLogCollectorPatch = flowLogCollectorPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateFlowLogCollectorOptions) SetHeaders(param map[string]string) *UpdateFlowLogCollectorOptions { + options.Headers = param + return options +} + +// UpdateIkePolicyOptions : The UpdateIkePolicy options. +type UpdateIkePolicyOptions struct { + // The IKE policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The IKE policy patch. + IkePolicyPatch map[string]interface{} `json:"IkePolicy_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateIkePolicyOptions : Instantiate UpdateIkePolicyOptions +func (*VpcV1) NewUpdateIkePolicyOptions(id string, ikePolicyPatch map[string]interface{}) *UpdateIkePolicyOptions { + return &UpdateIkePolicyOptions{ + ID: core.StringPtr(id), + IkePolicyPatch: ikePolicyPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateIkePolicyOptions) SetID(id string) *UpdateIkePolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIkePolicyPatch : Allow user to set IkePolicyPatch +func (_options *UpdateIkePolicyOptions) SetIkePolicyPatch(ikePolicyPatch map[string]interface{}) *UpdateIkePolicyOptions { + _options.IkePolicyPatch = ikePolicyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateIkePolicyOptions) SetHeaders(param map[string]string) *UpdateIkePolicyOptions { + options.Headers = param + return options +} + +// UpdateImageExportJobOptions : The UpdateImageExportJob options. +type UpdateImageExportJobOptions struct { + // The image identifier. + ImageID *string `json:"image_id" validate:"required,ne="` + + // The image export job identifier. + ID *string `json:"id" validate:"required,ne="` + + // The image export job patch. + ImageExportJobPatch map[string]interface{} `json:"ImageExportJob_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateImageExportJobOptions : Instantiate UpdateImageExportJobOptions +func (*VpcV1) NewUpdateImageExportJobOptions(imageID string, id string, imageExportJobPatch map[string]interface{}) *UpdateImageExportJobOptions { + return &UpdateImageExportJobOptions{ + ImageID: core.StringPtr(imageID), + ID: core.StringPtr(id), + ImageExportJobPatch: imageExportJobPatch, + } +} + +// SetImageID : Allow user to set ImageID +func (_options *UpdateImageExportJobOptions) SetImageID(imageID string) *UpdateImageExportJobOptions { + _options.ImageID = core.StringPtr(imageID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateImageExportJobOptions) SetID(id string) *UpdateImageExportJobOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetImageExportJobPatch : Allow user to set ImageExportJobPatch +func (_options *UpdateImageExportJobOptions) SetImageExportJobPatch(imageExportJobPatch map[string]interface{}) *UpdateImageExportJobOptions { + _options.ImageExportJobPatch = imageExportJobPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateImageExportJobOptions) SetHeaders(param map[string]string) *UpdateImageExportJobOptions { + options.Headers = param + return options +} + +// UpdateImageOptions : The UpdateImage options. +type UpdateImageOptions struct { + // The image identifier. + ID *string `json:"id" validate:"required,ne="` + + // The image patch. + ImagePatch map[string]interface{} `json:"Image_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateImageOptions : Instantiate UpdateImageOptions +func (*VpcV1) NewUpdateImageOptions(id string, imagePatch map[string]interface{}) *UpdateImageOptions { + return &UpdateImageOptions{ + ID: core.StringPtr(id), + ImagePatch: imagePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateImageOptions) SetID(id string) *UpdateImageOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetImagePatch : Allow user to set ImagePatch +func (_options *UpdateImageOptions) SetImagePatch(imagePatch map[string]interface{}) *UpdateImageOptions { + _options.ImagePatch = imagePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateImageOptions) SetHeaders(param map[string]string) *UpdateImageOptions { + options.Headers = param + return options +} + +// UpdateInstanceDiskOptions : The UpdateInstanceDisk options. +type UpdateInstanceDiskOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance disk identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance disk patch. + InstanceDiskPatch map[string]interface{} `json:"InstanceDisk_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceDiskOptions : Instantiate UpdateInstanceDiskOptions +func (*VpcV1) NewUpdateInstanceDiskOptions(instanceID string, id string, instanceDiskPatch map[string]interface{}) *UpdateInstanceDiskOptions { + return &UpdateInstanceDiskOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + InstanceDiskPatch: instanceDiskPatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *UpdateInstanceDiskOptions) SetInstanceID(instanceID string) *UpdateInstanceDiskOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceDiskOptions) SetID(id string) *UpdateInstanceDiskOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceDiskPatch : Allow user to set InstanceDiskPatch +func (_options *UpdateInstanceDiskOptions) SetInstanceDiskPatch(instanceDiskPatch map[string]interface{}) *UpdateInstanceDiskOptions { + _options.InstanceDiskPatch = instanceDiskPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceDiskOptions) SetHeaders(param map[string]string) *UpdateInstanceDiskOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupManagerActionOptions : The UpdateInstanceGroupManagerAction options. +type UpdateInstanceGroupManagerActionOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager action identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group manager action patch. + InstanceGroupManagerActionPatch map[string]interface{} `json:"InstanceGroupManagerAction_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupManagerActionOptions : Instantiate UpdateInstanceGroupManagerActionOptions +func (*VpcV1) NewUpdateInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string, instanceGroupManagerActionPatch map[string]interface{}) *UpdateInstanceGroupManagerActionOptions { + return &UpdateInstanceGroupManagerActionOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + InstanceGroupManagerActionPatch: instanceGroupManagerActionPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerActionOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *UpdateInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupManagerActionOptions) SetID(id string) *UpdateInstanceGroupManagerActionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupManagerActionPatch : Allow user to set InstanceGroupManagerActionPatch +func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupManagerActionPatch(instanceGroupManagerActionPatch map[string]interface{}) *UpdateInstanceGroupManagerActionOptions { + _options.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerActionOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupManagerOptions : The UpdateInstanceGroupManager options. +type UpdateInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group manager patch. + InstanceGroupManagerPatch map[string]interface{} `json:"InstanceGroupManager_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupManagerOptions : Instantiate UpdateInstanceGroupManagerOptions +func (*VpcV1) NewUpdateInstanceGroupManagerOptions(instanceGroupID string, id string, instanceGroupManagerPatch map[string]interface{}) *UpdateInstanceGroupManagerOptions { + return &UpdateInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + InstanceGroupManagerPatch: instanceGroupManagerPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *UpdateInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupManagerOptions) SetID(id string) *UpdateInstanceGroupManagerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupManagerPatch : Allow user to set InstanceGroupManagerPatch +func (_options *UpdateInstanceGroupManagerOptions) SetInstanceGroupManagerPatch(instanceGroupManagerPatch map[string]interface{}) *UpdateInstanceGroupManagerOptions { + _options.InstanceGroupManagerPatch = instanceGroupManagerPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupManagerOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupManagerPolicyOptions : The UpdateInstanceGroupManagerPolicy options. +type UpdateInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` + + // The instance group manager policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group manager policy patch. + InstanceGroupManagerPolicyPatch map[string]interface{} `json:"InstanceGroupManagerPolicy_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupManagerPolicyOptions : Instantiate UpdateInstanceGroupManagerPolicyOptions +func (*VpcV1) NewUpdateInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string, instanceGroupManagerPolicyPatch map[string]interface{}) *UpdateInstanceGroupManagerPolicyOptions { + return &UpdateInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + InstanceGroupManagerPolicyPatch: instanceGroupManagerPolicyPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *UpdateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupManagerPolicyOptions) SetID(id string) *UpdateInstanceGroupManagerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupManagerPolicyPatch : Allow user to set InstanceGroupManagerPolicyPatch +func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerPolicyPatch(instanceGroupManagerPolicyPatch map[string]interface{}) *UpdateInstanceGroupManagerPolicyOptions { + _options.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupMembershipOptions : The UpdateInstanceGroupMembership options. +type UpdateInstanceGroupMembershipOptions struct { + // The instance group identifier. + InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` + + // The instance group membership identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group membership patch. + InstanceGroupMembershipPatch map[string]interface{} `json:"InstanceGroupMembership_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupMembershipOptions : Instantiate UpdateInstanceGroupMembershipOptions +func (*VpcV1) NewUpdateInstanceGroupMembershipOptions(instanceGroupID string, id string, instanceGroupMembershipPatch map[string]interface{}) *UpdateInstanceGroupMembershipOptions { + return &UpdateInstanceGroupMembershipOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + InstanceGroupMembershipPatch: instanceGroupMembershipPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (_options *UpdateInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupMembershipOptions { + _options.InstanceGroupID = core.StringPtr(instanceGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupMembershipOptions) SetID(id string) *UpdateInstanceGroupMembershipOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupMembershipPatch : Allow user to set InstanceGroupMembershipPatch +func (_options *UpdateInstanceGroupMembershipOptions) SetInstanceGroupMembershipPatch(instanceGroupMembershipPatch map[string]interface{}) *UpdateInstanceGroupMembershipOptions { + _options.InstanceGroupMembershipPatch = instanceGroupMembershipPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupMembershipOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupOptions : The UpdateInstanceGroup options. +type UpdateInstanceGroupOptions struct { + // The instance group identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance group patch. + InstanceGroupPatch map[string]interface{} `json:"InstanceGroup_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupOptions : Instantiate UpdateInstanceGroupOptions +func (*VpcV1) NewUpdateInstanceGroupOptions(id string, instanceGroupPatch map[string]interface{}) *UpdateInstanceGroupOptions { + return &UpdateInstanceGroupOptions{ + ID: core.StringPtr(id), + InstanceGroupPatch: instanceGroupPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceGroupOptions) SetID(id string) *UpdateInstanceGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceGroupPatch : Allow user to set InstanceGroupPatch +func (_options *UpdateInstanceGroupOptions) SetInstanceGroupPatch(instanceGroupPatch map[string]interface{}) *UpdateInstanceGroupOptions { + _options.InstanceGroupPatch = instanceGroupPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupOptions { + options.Headers = param + return options +} + +// UpdateInstanceNetworkAttachmentOptions : The UpdateInstanceNetworkAttachment options. +type UpdateInstanceNetworkAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance network attachment patch. + InstanceNetworkAttachmentPatch map[string]interface{} `json:"InstanceNetworkAttachment_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceNetworkAttachmentOptions : Instantiate UpdateInstanceNetworkAttachmentOptions +func (*VpcV1) NewUpdateInstanceNetworkAttachmentOptions(instanceID string, id string, instanceNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceNetworkAttachmentOptions { + return &UpdateInstanceNetworkAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + InstanceNetworkAttachmentPatch: instanceNetworkAttachmentPatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *UpdateInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceNetworkAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceNetworkAttachmentOptions) SetID(id string) *UpdateInstanceNetworkAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceNetworkAttachmentPatch : Allow user to set InstanceNetworkAttachmentPatch +func (_options *UpdateInstanceNetworkAttachmentOptions) SetInstanceNetworkAttachmentPatch(instanceNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceNetworkAttachmentOptions { + _options.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceNetworkAttachmentOptions { + options.Headers = param + return options +} + +// UpdateInstanceNetworkInterfaceOptions : The UpdateInstanceNetworkInterface options. +type UpdateInstanceNetworkInterfaceOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The instance network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance network interface patch. + NetworkInterfacePatch map[string]interface{} `json:"NetworkInterface_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceNetworkInterfaceOptions : Instantiate UpdateInstanceNetworkInterfaceOptions +func (*VpcV1) NewUpdateInstanceNetworkInterfaceOptions(instanceID string, id string, networkInterfacePatch map[string]interface{}) *UpdateInstanceNetworkInterfaceOptions { + return &UpdateInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + NetworkInterfacePatch: networkInterfacePatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *UpdateInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *UpdateInstanceNetworkInterfaceOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceNetworkInterfaceOptions) SetID(id string) *UpdateInstanceNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetNetworkInterfacePatch : Allow user to set NetworkInterfacePatch +func (_options *UpdateInstanceNetworkInterfaceOptions) SetNetworkInterfacePatch(networkInterfacePatch map[string]interface{}) *UpdateInstanceNetworkInterfaceOptions { + _options.NetworkInterfacePatch = networkInterfacePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// UpdateInstanceOptions : The UpdateInstance options. +type UpdateInstanceOptions struct { + // The virtual server instance identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance patch. + InstancePatch map[string]interface{} `json:"Instance_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 +} + +// NewUpdateInstanceOptions : Instantiate UpdateInstanceOptions +func (*VpcV1) NewUpdateInstanceOptions(id string, instancePatch map[string]interface{}) *UpdateInstanceOptions { + return &UpdateInstanceOptions{ + ID: core.StringPtr(id), + InstancePatch: instancePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceOptions) SetID(id string) *UpdateInstanceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstancePatch : Allow user to set InstancePatch +func (_options *UpdateInstanceOptions) SetInstancePatch(instancePatch map[string]interface{}) *UpdateInstanceOptions { + _options.InstancePatch = instancePatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateInstanceOptions) SetIfMatch(ifMatch string) *UpdateInstanceOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceOptions) SetHeaders(param map[string]string) *UpdateInstanceOptions { + options.Headers = param + return options +} + +// UpdateInstanceTemplateOptions : The UpdateInstanceTemplate options. +type UpdateInstanceTemplateOptions struct { + // The instance template identifier. + ID *string `json:"id" validate:"required,ne="` + + // The instance template patch. + InstanceTemplatePatch map[string]interface{} `json:"InstanceTemplate_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceTemplateOptions : Instantiate UpdateInstanceTemplateOptions +func (*VpcV1) NewUpdateInstanceTemplateOptions(id string, instanceTemplatePatch map[string]interface{}) *UpdateInstanceTemplateOptions { + return &UpdateInstanceTemplateOptions{ + ID: core.StringPtr(id), + InstanceTemplatePatch: instanceTemplatePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceTemplateOptions) SetID(id string) *UpdateInstanceTemplateOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetInstanceTemplatePatch : Allow user to set InstanceTemplatePatch +func (_options *UpdateInstanceTemplateOptions) SetInstanceTemplatePatch(instanceTemplatePatch map[string]interface{}) *UpdateInstanceTemplateOptions { + _options.InstanceTemplatePatch = instanceTemplatePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceTemplateOptions) SetHeaders(param map[string]string) *UpdateInstanceTemplateOptions { + options.Headers = param + return options +} + +// UpdateInstanceVolumeAttachmentOptions : The UpdateInstanceVolumeAttachment options. +type UpdateInstanceVolumeAttachmentOptions struct { + // The virtual server instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` + + // The volume attachment identifier. + ID *string `json:"id" validate:"required,ne="` + + // The volume attachment patch. + VolumeAttachmentPatch map[string]interface{} `json:"VolumeAttachment_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceVolumeAttachmentOptions : Instantiate UpdateInstanceVolumeAttachmentOptions +func (*VpcV1) NewUpdateInstanceVolumeAttachmentOptions(instanceID string, id string, volumeAttachmentPatch map[string]interface{}) *UpdateInstanceVolumeAttachmentOptions { + return &UpdateInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + VolumeAttachmentPatch: volumeAttachmentPatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (_options *UpdateInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceVolumeAttachmentOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateInstanceVolumeAttachmentOptions) SetID(id string) *UpdateInstanceVolumeAttachmentOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVolumeAttachmentPatch : Allow user to set VolumeAttachmentPatch +func (_options *UpdateInstanceVolumeAttachmentOptions) SetVolumeAttachmentPatch(volumeAttachmentPatch map[string]interface{}) *UpdateInstanceVolumeAttachmentOptions { + _options.VolumeAttachmentPatch = volumeAttachmentPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// UpdateIpsecPolicyOptions : The UpdateIpsecPolicy options. +type UpdateIpsecPolicyOptions struct { + // The IPsec policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The IPsec policy patch. + IPsecPolicyPatch map[string]interface{} `json:"IPsecPolicy_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateIpsecPolicyOptions : Instantiate UpdateIpsecPolicyOptions +func (*VpcV1) NewUpdateIpsecPolicyOptions(id string, iPsecPolicyPatch map[string]interface{}) *UpdateIpsecPolicyOptions { + return &UpdateIpsecPolicyOptions{ + ID: core.StringPtr(id), + IPsecPolicyPatch: iPsecPolicyPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateIpsecPolicyOptions) SetID(id string) *UpdateIpsecPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIPsecPolicyPatch : Allow user to set IPsecPolicyPatch +func (_options *UpdateIpsecPolicyOptions) SetIPsecPolicyPatch(iPsecPolicyPatch map[string]interface{}) *UpdateIpsecPolicyOptions { + _options.IPsecPolicyPatch = iPsecPolicyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateIpsecPolicyOptions) SetHeaders(param map[string]string) *UpdateIpsecPolicyOptions { + options.Headers = param + return options +} + +// UpdateKeyOptions : The UpdateKey options. +type UpdateKeyOptions struct { + // The key identifier. + ID *string `json:"id" validate:"required,ne="` + + // The key patch. + KeyPatch map[string]interface{} `json:"Key_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateKeyOptions : Instantiate UpdateKeyOptions +func (*VpcV1) NewUpdateKeyOptions(id string, keyPatch map[string]interface{}) *UpdateKeyOptions { + return &UpdateKeyOptions{ + ID: core.StringPtr(id), + KeyPatch: keyPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateKeyOptions) SetID(id string) *UpdateKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetKeyPatch : Allow user to set KeyPatch +func (_options *UpdateKeyOptions) SetKeyPatch(keyPatch map[string]interface{}) *UpdateKeyOptions { + _options.KeyPatch = keyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateKeyOptions) SetHeaders(param map[string]string) *UpdateKeyOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerListenerOptions : The UpdateLoadBalancerListener options. +type UpdateLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ID *string `json:"id" validate:"required,ne="` + + // The load balancer listener patch. + LoadBalancerListenerPatch map[string]interface{} `json:"LoadBalancerListener_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerListenerOptions : Instantiate UpdateLoadBalancerListenerOptions +func (*VpcV1) NewUpdateLoadBalancerListenerOptions(loadBalancerID string, id string, loadBalancerListenerPatch map[string]interface{}) *UpdateLoadBalancerListenerOptions { + return &UpdateLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + LoadBalancerListenerPatch: loadBalancerListenerPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerListenerOptions) SetID(id string) *UpdateLoadBalancerListenerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerListenerPatch : Allow user to set LoadBalancerListenerPatch +func (_options *UpdateLoadBalancerListenerOptions) SetLoadBalancerListenerPatch(loadBalancerListenerPatch map[string]interface{}) *UpdateLoadBalancerListenerOptions { + _options.LoadBalancerListenerPatch = loadBalancerListenerPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerListenerOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerListenerPolicyOptions : The UpdateLoadBalancerListenerPolicy options. +type UpdateLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The listener policy patch. + LoadBalancerListenerPolicyPatch map[string]interface{} `json:"LoadBalancerListenerPolicy_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerListenerPolicyOptions : Instantiate UpdateLoadBalancerListenerPolicyOptions +func (*VpcV1) NewUpdateLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string, loadBalancerListenerPolicyPatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyOptions { + return &UpdateLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + ID: core.StringPtr(id), + LoadBalancerListenerPolicyPatch: loadBalancerListenerPolicyPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerPolicyOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *UpdateLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *UpdateLoadBalancerListenerPolicyOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerListenerPolicyOptions) SetID(id string) *UpdateLoadBalancerListenerPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerListenerPolicyPatch : Allow user to set LoadBalancerListenerPolicyPatch +func (_options *UpdateLoadBalancerListenerPolicyOptions) SetLoadBalancerListenerPolicyPatch(loadBalancerListenerPolicyPatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyOptions { + _options.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerListenerPolicyRuleOptions : The UpdateLoadBalancerListenerPolicyRule options. +type UpdateLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The listener identifier. + ListenerID *string `json:"listener_id" validate:"required,ne="` + + // The policy identifier. + PolicyID *string `json:"policy_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // The listener policy rule patch. + LoadBalancerListenerPolicyRulePatch map[string]interface{} `json:"LoadBalancerListenerPolicyRule_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerListenerPolicyRuleOptions : Instantiate UpdateLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewUpdateLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string, loadBalancerListenerPolicyRulePatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyRuleOptions { + return &UpdateLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + ID: core.StringPtr(id), + LoadBalancerListenerPolicyRulePatch: loadBalancerListenerPolicyRulePatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetListenerID : Allow user to set ListenerID +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.ListenerID = core.StringPtr(listenerID) + return _options +} + +// SetPolicyID : Allow user to set PolicyID +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.PolicyID = core.StringPtr(policyID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetID(id string) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerListenerPolicyRulePatch : Allow user to set LoadBalancerListenerPolicyRulePatch +func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerListenerPolicyRulePatch(loadBalancerListenerPolicyRulePatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyRuleOptions { + _options.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerOptions : The UpdateLoadBalancer options. +type UpdateLoadBalancerOptions struct { + // The load balancer identifier. + ID *string `json:"id" validate:"required,ne="` + + // The load balancer patch. + LoadBalancerPatch map[string]interface{} `json:"LoadBalancer_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 +} + +// NewUpdateLoadBalancerOptions : Instantiate UpdateLoadBalancerOptions +func (*VpcV1) NewUpdateLoadBalancerOptions(id string, loadBalancerPatch map[string]interface{}) *UpdateLoadBalancerOptions { + return &UpdateLoadBalancerOptions{ + ID: core.StringPtr(id), + LoadBalancerPatch: loadBalancerPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerOptions) SetID(id string) *UpdateLoadBalancerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerPatch : Allow user to set LoadBalancerPatch +func (_options *UpdateLoadBalancerOptions) SetLoadBalancerPatch(loadBalancerPatch map[string]interface{}) *UpdateLoadBalancerOptions { + _options.LoadBalancerPatch = loadBalancerPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateLoadBalancerOptions) SetIfMatch(ifMatch string) *UpdateLoadBalancerOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerPoolMemberOptions : The UpdateLoadBalancerPoolMember options. +type UpdateLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + PoolID *string `json:"pool_id" validate:"required,ne="` + + // The member identifier. + ID *string `json:"id" validate:"required,ne="` + + // The load balancer pool member patch. + LoadBalancerPoolMemberPatch map[string]interface{} `json:"LoadBalancerPoolMember_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerPoolMemberOptions : Instantiate UpdateLoadBalancerPoolMemberOptions +func (*VpcV1) NewUpdateLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string, loadBalancerPoolMemberPatch map[string]interface{}) *UpdateLoadBalancerPoolMemberOptions { + return &UpdateLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + ID: core.StringPtr(id), + LoadBalancerPoolMemberPatch: loadBalancerPoolMemberPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerPoolMemberOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetPoolID : Allow user to set PoolID +func (_options *UpdateLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *UpdateLoadBalancerPoolMemberOptions { + _options.PoolID = core.StringPtr(poolID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerPoolMemberOptions) SetID(id string) *UpdateLoadBalancerPoolMemberOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerPoolMemberPatch : Allow user to set LoadBalancerPoolMemberPatch +func (_options *UpdateLoadBalancerPoolMemberOptions) SetLoadBalancerPoolMemberPatch(loadBalancerPoolMemberPatch map[string]interface{}) *UpdateLoadBalancerPoolMemberOptions { + _options.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerPoolOptions : The UpdateLoadBalancerPool options. +type UpdateLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` + + // The pool identifier. + ID *string `json:"id" validate:"required,ne="` + + // The load balancer pool patch. + LoadBalancerPoolPatch map[string]interface{} `json:"LoadBalancerPool_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerPoolOptions : Instantiate UpdateLoadBalancerPoolOptions +func (*VpcV1) NewUpdateLoadBalancerPoolOptions(loadBalancerID string, id string, loadBalancerPoolPatch map[string]interface{}) *UpdateLoadBalancerPoolOptions { + return &UpdateLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + LoadBalancerPoolPatch: loadBalancerPoolPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (_options *UpdateLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerPoolOptions { + _options.LoadBalancerID = core.StringPtr(loadBalancerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateLoadBalancerPoolOptions) SetID(id string) *UpdateLoadBalancerPoolOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetLoadBalancerPoolPatch : Allow user to set LoadBalancerPoolPatch +func (_options *UpdateLoadBalancerPoolOptions) SetLoadBalancerPoolPatch(loadBalancerPoolPatch map[string]interface{}) *UpdateLoadBalancerPoolOptions { + _options.LoadBalancerPoolPatch = loadBalancerPoolPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerPoolOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// UpdateNetworkACLOptions : The UpdateNetworkACL options. +type UpdateNetworkACLOptions struct { + // The network ACL identifier. + ID *string `json:"id" validate:"required,ne="` + + // The network ACL patch. + NetworkACLPatch map[string]interface{} `json:"NetworkACL_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateNetworkACLOptions : Instantiate UpdateNetworkACLOptions +func (*VpcV1) NewUpdateNetworkACLOptions(id string, networkACLPatch map[string]interface{}) *UpdateNetworkACLOptions { + return &UpdateNetworkACLOptions{ + ID: core.StringPtr(id), + NetworkACLPatch: networkACLPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateNetworkACLOptions) SetID(id string) *UpdateNetworkACLOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetNetworkACLPatch : Allow user to set NetworkACLPatch +func (_options *UpdateNetworkACLOptions) SetNetworkACLPatch(networkACLPatch map[string]interface{}) *UpdateNetworkACLOptions { + _options.NetworkACLPatch = networkACLPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateNetworkACLOptions) SetHeaders(param map[string]string) *UpdateNetworkACLOptions { + options.Headers = param + return options +} + +// UpdateNetworkACLRuleOptions : The UpdateNetworkACLRule options. +type UpdateNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // The network ACL rule patch. + NetworkACLRulePatch map[string]interface{} `json:"NetworkACLRule_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateNetworkACLRuleOptions : Instantiate UpdateNetworkACLRuleOptions +func (*VpcV1) NewUpdateNetworkACLRuleOptions(networkACLID string, id string, networkACLRulePatch map[string]interface{}) *UpdateNetworkACLRuleOptions { + return &UpdateNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + ID: core.StringPtr(id), + NetworkACLRulePatch: networkACLRulePatch, + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (_options *UpdateNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *UpdateNetworkACLRuleOptions { + _options.NetworkACLID = core.StringPtr(networkACLID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateNetworkACLRuleOptions) SetID(id string) *UpdateNetworkACLRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetNetworkACLRulePatch : Allow user to set NetworkACLRulePatch +func (_options *UpdateNetworkACLRuleOptions) SetNetworkACLRulePatch(networkACLRulePatch map[string]interface{}) *UpdateNetworkACLRuleOptions { + _options.NetworkACLRulePatch = networkACLRulePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateNetworkACLRuleOptions) SetHeaders(param map[string]string) *UpdateNetworkACLRuleOptions { + options.Headers = param + return options +} + +// UpdatePlacementGroupOptions : The UpdatePlacementGroup options. +type UpdatePlacementGroupOptions struct { + // The placement group identifier. + ID *string `json:"id" validate:"required,ne="` + + // The placement group patch. + PlacementGroupPatch map[string]interface{} `json:"PlacementGroup_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdatePlacementGroupOptions : Instantiate UpdatePlacementGroupOptions +func (*VpcV1) NewUpdatePlacementGroupOptions(id string, placementGroupPatch map[string]interface{}) *UpdatePlacementGroupOptions { + return &UpdatePlacementGroupOptions{ + ID: core.StringPtr(id), + PlacementGroupPatch: placementGroupPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdatePlacementGroupOptions) SetID(id string) *UpdatePlacementGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetPlacementGroupPatch : Allow user to set PlacementGroupPatch +func (_options *UpdatePlacementGroupOptions) SetPlacementGroupPatch(placementGroupPatch map[string]interface{}) *UpdatePlacementGroupOptions { + _options.PlacementGroupPatch = placementGroupPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdatePlacementGroupOptions) SetHeaders(param map[string]string) *UpdatePlacementGroupOptions { + options.Headers = param + return options +} + +// UpdatePublicGatewayOptions : The UpdatePublicGateway options. +type UpdatePublicGatewayOptions struct { + // The public gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // The public gateway patch. + PublicGatewayPatch map[string]interface{} `json:"PublicGateway_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdatePublicGatewayOptions : Instantiate UpdatePublicGatewayOptions +func (*VpcV1) NewUpdatePublicGatewayOptions(id string, publicGatewayPatch map[string]interface{}) *UpdatePublicGatewayOptions { + return &UpdatePublicGatewayOptions{ + ID: core.StringPtr(id), + PublicGatewayPatch: publicGatewayPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdatePublicGatewayOptions) SetID(id string) *UpdatePublicGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetPublicGatewayPatch : Allow user to set PublicGatewayPatch +func (_options *UpdatePublicGatewayOptions) SetPublicGatewayPatch(publicGatewayPatch map[string]interface{}) *UpdatePublicGatewayOptions { + _options.PublicGatewayPatch = publicGatewayPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdatePublicGatewayOptions) SetHeaders(param map[string]string) *UpdatePublicGatewayOptions { + options.Headers = param + return options +} + +// UpdateReservationOptions : The UpdateReservation options. +type UpdateReservationOptions struct { + // The reservation identifier. + ID *string `json:"id" validate:"required,ne="` + + // The reservation patch. + ReservationPatch map[string]interface{} `json:"Reservation_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateReservationOptions : Instantiate UpdateReservationOptions +func (*VpcV1) NewUpdateReservationOptions(id string, reservationPatch map[string]interface{}) *UpdateReservationOptions { + return &UpdateReservationOptions{ + ID: core.StringPtr(id), + ReservationPatch: reservationPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateReservationOptions) SetID(id string) *UpdateReservationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetReservationPatch : Allow user to set ReservationPatch +func (_options *UpdateReservationOptions) SetReservationPatch(reservationPatch map[string]interface{}) *UpdateReservationOptions { + _options.ReservationPatch = reservationPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateReservationOptions) SetHeaders(param map[string]string) *UpdateReservationOptions { + options.Headers = param + return options +} + +// UpdateSecurityGroupOptions : The UpdateSecurityGroup options. +type UpdateSecurityGroupOptions struct { + // The security group identifier. + ID *string `json:"id" validate:"required,ne="` + + // The security group patch. + SecurityGroupPatch map[string]interface{} `json:"SecurityGroup_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSecurityGroupOptions : Instantiate UpdateSecurityGroupOptions +func (*VpcV1) NewUpdateSecurityGroupOptions(id string, securityGroupPatch map[string]interface{}) *UpdateSecurityGroupOptions { + return &UpdateSecurityGroupOptions{ + ID: core.StringPtr(id), + SecurityGroupPatch: securityGroupPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateSecurityGroupOptions) SetID(id string) *UpdateSecurityGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSecurityGroupPatch : Allow user to set SecurityGroupPatch +func (_options *UpdateSecurityGroupOptions) SetSecurityGroupPatch(securityGroupPatch map[string]interface{}) *UpdateSecurityGroupOptions { + _options.SecurityGroupPatch = securityGroupPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSecurityGroupOptions) SetHeaders(param map[string]string) *UpdateSecurityGroupOptions { + options.Headers = param + return options +} + +// UpdateSecurityGroupRuleOptions : The UpdateSecurityGroupRule options. +type UpdateSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` + + // The rule identifier. + ID *string `json:"id" validate:"required,ne="` + + // The security group rule patch. + SecurityGroupRulePatch map[string]interface{} `json:"SecurityGroupRule_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSecurityGroupRuleOptions : Instantiate UpdateSecurityGroupRuleOptions +func (*VpcV1) NewUpdateSecurityGroupRuleOptions(securityGroupID string, id string, securityGroupRulePatch map[string]interface{}) *UpdateSecurityGroupRuleOptions { + return &UpdateSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + SecurityGroupRulePatch: securityGroupRulePatch, + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (_options *UpdateSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *UpdateSecurityGroupRuleOptions { + _options.SecurityGroupID = core.StringPtr(securityGroupID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateSecurityGroupRuleOptions) SetID(id string) *UpdateSecurityGroupRuleOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSecurityGroupRulePatch : Allow user to set SecurityGroupRulePatch +func (_options *UpdateSecurityGroupRuleOptions) SetSecurityGroupRulePatch(securityGroupRulePatch map[string]interface{}) *UpdateSecurityGroupRuleOptions { + _options.SecurityGroupRulePatch = securityGroupRulePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSecurityGroupRuleOptions) SetHeaders(param map[string]string) *UpdateSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// UpdateShareMountTargetOptions : The UpdateShareMountTarget options. +type UpdateShareMountTargetOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share mount target identifier. + ID *string `json:"id" validate:"required,ne="` + + // The share mount target patch. + ShareMountTargetPatch map[string]interface{} `json:"ShareMountTarget_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateShareMountTargetOptions : Instantiate UpdateShareMountTargetOptions +func (*VpcV1) NewUpdateShareMountTargetOptions(shareID string, id string, shareMountTargetPatch map[string]interface{}) *UpdateShareMountTargetOptions { + return &UpdateShareMountTargetOptions{ + ShareID: core.StringPtr(shareID), + ID: core.StringPtr(id), + ShareMountTargetPatch: shareMountTargetPatch, + } +} + +// SetShareID : Allow user to set ShareID +func (_options *UpdateShareMountTargetOptions) SetShareID(shareID string) *UpdateShareMountTargetOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateShareMountTargetOptions) SetID(id string) *UpdateShareMountTargetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetShareMountTargetPatch : Allow user to set ShareMountTargetPatch +func (_options *UpdateShareMountTargetOptions) SetShareMountTargetPatch(shareMountTargetPatch map[string]interface{}) *UpdateShareMountTargetOptions { + _options.ShareMountTargetPatch = shareMountTargetPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateShareMountTargetOptions) SetHeaders(param map[string]string) *UpdateShareMountTargetOptions { + options.Headers = param + return options +} + +// UpdateShareOptions : The UpdateShare options. +type UpdateShareOptions struct { + // The file share identifier. + ID *string `json:"id" validate:"required,ne="` + + // The file share patch. + SharePatch map[string]interface{} `json:"Share_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 +} + +// NewUpdateShareOptions : Instantiate UpdateShareOptions +func (*VpcV1) NewUpdateShareOptions(id string, sharePatch map[string]interface{}) *UpdateShareOptions { + return &UpdateShareOptions{ + ID: core.StringPtr(id), + SharePatch: sharePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateShareOptions) SetID(id string) *UpdateShareOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSharePatch : Allow user to set SharePatch +func (_options *UpdateShareOptions) SetSharePatch(sharePatch map[string]interface{}) *UpdateShareOptions { + _options.SharePatch = sharePatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateShareOptions) SetIfMatch(ifMatch string) *UpdateShareOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateShareOptions) SetHeaders(param map[string]string) *UpdateShareOptions { + options.Headers = param + return options +} + +// UpdateSnapshotConsistencyGroupOptions : The UpdateSnapshotConsistencyGroup options. +type UpdateSnapshotConsistencyGroupOptions struct { + // The snapshot consistency group identifier. + ID *string `json:"id" validate:"required,ne="` + + // The snapshot consistency group patch. + SnapshotConsistencyGroupPatch map[string]interface{} `json:"SnapshotConsistencyGroup_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 +} + +// NewUpdateSnapshotConsistencyGroupOptions : Instantiate UpdateSnapshotConsistencyGroupOptions +func (*VpcV1) NewUpdateSnapshotConsistencyGroupOptions(id string, snapshotConsistencyGroupPatch map[string]interface{}) *UpdateSnapshotConsistencyGroupOptions { + return &UpdateSnapshotConsistencyGroupOptions{ + ID: core.StringPtr(id), + SnapshotConsistencyGroupPatch: snapshotConsistencyGroupPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateSnapshotConsistencyGroupOptions) SetID(id string) *UpdateSnapshotConsistencyGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSnapshotConsistencyGroupPatch : Allow user to set SnapshotConsistencyGroupPatch +func (_options *UpdateSnapshotConsistencyGroupOptions) SetSnapshotConsistencyGroupPatch(snapshotConsistencyGroupPatch map[string]interface{}) *UpdateSnapshotConsistencyGroupOptions { + _options.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateSnapshotConsistencyGroupOptions) SetIfMatch(ifMatch string) *UpdateSnapshotConsistencyGroupOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *UpdateSnapshotConsistencyGroupOptions { + options.Headers = param + return options +} + +// UpdateSnapshotOptions : The UpdateSnapshot options. +type UpdateSnapshotOptions struct { + // The snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // The snapshot patch. + SnapshotPatch map[string]interface{} `json:"Snapshot_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 +} + +// NewUpdateSnapshotOptions : Instantiate UpdateSnapshotOptions +func (*VpcV1) NewUpdateSnapshotOptions(id string, snapshotPatch map[string]interface{}) *UpdateSnapshotOptions { + return &UpdateSnapshotOptions{ + ID: core.StringPtr(id), + SnapshotPatch: snapshotPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateSnapshotOptions) SetID(id string) *UpdateSnapshotOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSnapshotPatch : Allow user to set SnapshotPatch +func (_options *UpdateSnapshotOptions) SetSnapshotPatch(snapshotPatch map[string]interface{}) *UpdateSnapshotOptions { + _options.SnapshotPatch = snapshotPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateSnapshotOptions) SetIfMatch(ifMatch string) *UpdateSnapshotOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSnapshotOptions) SetHeaders(param map[string]string) *UpdateSnapshotOptions { + options.Headers = param + return options +} + +// UpdateSubnetOptions : The UpdateSubnet options. +type UpdateSubnetOptions struct { + // The subnet identifier. + ID *string `json:"id" validate:"required,ne="` + + // The subnet patch. + SubnetPatch map[string]interface{} `json:"Subnet_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSubnetOptions : Instantiate UpdateSubnetOptions +func (*VpcV1) NewUpdateSubnetOptions(id string, subnetPatch map[string]interface{}) *UpdateSubnetOptions { + return &UpdateSubnetOptions{ + ID: core.StringPtr(id), + SubnetPatch: subnetPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateSubnetOptions) SetID(id string) *UpdateSubnetOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSubnetPatch : Allow user to set SubnetPatch +func (_options *UpdateSubnetOptions) SetSubnetPatch(subnetPatch map[string]interface{}) *UpdateSubnetOptions { + _options.SubnetPatch = subnetPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSubnetOptions) SetHeaders(param map[string]string) *UpdateSubnetOptions { + options.Headers = param + return options +} + +// UpdateSubnetReservedIPOptions : The UpdateSubnetReservedIP options. +type UpdateSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `json:"subnet_id" validate:"required,ne="` + + // The reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // The reserved IP patch. + ReservedIPPatch map[string]interface{} `json:"ReservedIP_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSubnetReservedIPOptions : Instantiate UpdateSubnetReservedIPOptions +func (*VpcV1) NewUpdateSubnetReservedIPOptions(subnetID string, id string, reservedIPPatch map[string]interface{}) *UpdateSubnetReservedIPOptions { + return &UpdateSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + ID: core.StringPtr(id), + ReservedIPPatch: reservedIPPatch, + } +} + +// SetSubnetID : Allow user to set SubnetID +func (_options *UpdateSubnetReservedIPOptions) SetSubnetID(subnetID string) *UpdateSubnetReservedIPOptions { + _options.SubnetID = core.StringPtr(subnetID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateSubnetReservedIPOptions) SetID(id string) *UpdateSubnetReservedIPOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetReservedIPPatch : Allow user to set ReservedIPPatch +func (_options *UpdateSubnetReservedIPOptions) SetReservedIPPatch(reservedIPPatch map[string]interface{}) *UpdateSubnetReservedIPOptions { + _options.ReservedIPPatch = reservedIPPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSubnetReservedIPOptions) SetHeaders(param map[string]string) *UpdateSubnetReservedIPOptions { + options.Headers = param + return options +} + +// UpdateVirtualNetworkInterfaceOptions : The UpdateVirtualNetworkInterface options. +type UpdateVirtualNetworkInterfaceOptions struct { + // The virtual network interface identifier. + ID *string `json:"id" validate:"required,ne="` + + // The virtual network interface patch. + VirtualNetworkInterfacePatch map[string]interface{} `json:"VirtualNetworkInterface_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVirtualNetworkInterfaceOptions : Instantiate UpdateVirtualNetworkInterfaceOptions +func (*VpcV1) NewUpdateVirtualNetworkInterfaceOptions(id string, virtualNetworkInterfacePatch map[string]interface{}) *UpdateVirtualNetworkInterfaceOptions { + return &UpdateVirtualNetworkInterfaceOptions{ + ID: core.StringPtr(id), + VirtualNetworkInterfacePatch: virtualNetworkInterfacePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVirtualNetworkInterfaceOptions) SetID(id string) *UpdateVirtualNetworkInterfaceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVirtualNetworkInterfacePatch : Allow user to set VirtualNetworkInterfacePatch +func (_options *UpdateVirtualNetworkInterfaceOptions) SetVirtualNetworkInterfacePatch(virtualNetworkInterfacePatch map[string]interface{}) *UpdateVirtualNetworkInterfaceOptions { + _options.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateVirtualNetworkInterfaceOptions { + options.Headers = param + return options +} + +// UpdateVolumeOptions : The UpdateVolume options. +type UpdateVolumeOptions struct { + // The volume identifier. + ID *string `json:"id" validate:"required,ne="` + + // The volume patch. + VolumePatch map[string]interface{} `json:"Volume_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 +} + +// NewUpdateVolumeOptions : Instantiate UpdateVolumeOptions +func (*VpcV1) NewUpdateVolumeOptions(id string, volumePatch map[string]interface{}) *UpdateVolumeOptions { + return &UpdateVolumeOptions{ + ID: core.StringPtr(id), + VolumePatch: volumePatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVolumeOptions) SetID(id string) *UpdateVolumeOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVolumePatch : Allow user to set VolumePatch +func (_options *UpdateVolumeOptions) SetVolumePatch(volumePatch map[string]interface{}) *UpdateVolumeOptions { + _options.VolumePatch = volumePatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVolumeOptions) SetIfMatch(ifMatch string) *UpdateVolumeOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVolumeOptions) SetHeaders(param map[string]string) *UpdateVolumeOptions { + options.Headers = param + return options +} + +// UpdateVPCAddressPrefixOptions : The UpdateVPCAddressPrefix options. +type UpdateVPCAddressPrefixOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The prefix identifier. + ID *string `json:"id" validate:"required,ne="` + + // The prefix patch. + AddressPrefixPatch map[string]interface{} `json:"AddressPrefix_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCAddressPrefixOptions : Instantiate UpdateVPCAddressPrefixOptions +func (*VpcV1) NewUpdateVPCAddressPrefixOptions(vpcID string, id string, addressPrefixPatch map[string]interface{}) *UpdateVPCAddressPrefixOptions { + return &UpdateVPCAddressPrefixOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + AddressPrefixPatch: addressPrefixPatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCAddressPrefixOptions) SetVPCID(vpcID string) *UpdateVPCAddressPrefixOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCAddressPrefixOptions) SetID(id string) *UpdateVPCAddressPrefixOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetAddressPrefixPatch : Allow user to set AddressPrefixPatch +func (_options *UpdateVPCAddressPrefixOptions) SetAddressPrefixPatch(addressPrefixPatch map[string]interface{}) *UpdateVPCAddressPrefixOptions { + _options.AddressPrefixPatch = addressPrefixPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCAddressPrefixOptions) SetHeaders(param map[string]string) *UpdateVPCAddressPrefixOptions { + options.Headers = param + return options +} + +// UpdateVPCDnsResolutionBindingOptions : The UpdateVPCDnsResolutionBinding options. +type UpdateVPCDnsResolutionBindingOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The DNS resolution binding identifier. + ID *string `json:"id" validate:"required,ne="` + + // The DNS resolution binding patch. + VpcdnsResolutionBindingPatch map[string]interface{} `json:"VpcdnsResolutionBinding_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCDnsResolutionBindingOptions : Instantiate UpdateVPCDnsResolutionBindingOptions +func (*VpcV1) NewUpdateVPCDnsResolutionBindingOptions(vpcID string, id string, vpcdnsResolutionBindingPatch map[string]interface{}) *UpdateVPCDnsResolutionBindingOptions { + return &UpdateVPCDnsResolutionBindingOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + VpcdnsResolutionBindingPatch: vpcdnsResolutionBindingPatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *UpdateVPCDnsResolutionBindingOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCDnsResolutionBindingOptions) SetID(id string) *UpdateVPCDnsResolutionBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVpcdnsResolutionBindingPatch : Allow user to set VpcdnsResolutionBindingPatch +func (_options *UpdateVPCDnsResolutionBindingOptions) SetVpcdnsResolutionBindingPatch(vpcdnsResolutionBindingPatch map[string]interface{}) *UpdateVPCDnsResolutionBindingOptions { + _options.VpcdnsResolutionBindingPatch = vpcdnsResolutionBindingPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *UpdateVPCDnsResolutionBindingOptions { + options.Headers = param + return options +} + +// UpdateVPCOptions : The UpdateVPC options. +type UpdateVPCOptions struct { + // The VPC identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPC patch. + VPCPatch map[string]interface{} `json:"VPC_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 +} + +// NewUpdateVPCOptions : Instantiate UpdateVPCOptions +func (*VpcV1) NewUpdateVPCOptions(id string, vpcPatch map[string]interface{}) *UpdateVPCOptions { + return &UpdateVPCOptions{ + ID: core.StringPtr(id), + VPCPatch: vpcPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCOptions) SetID(id string) *UpdateVPCOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPCPatch : Allow user to set VPCPatch +func (_options *UpdateVPCOptions) SetVPCPatch(vpcPatch map[string]interface{}) *UpdateVPCOptions { + _options.VPCPatch = vpcPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVPCOptions) SetIfMatch(ifMatch string) *UpdateVPCOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCOptions) SetHeaders(param map[string]string) *UpdateVPCOptions { + options.Headers = param + return options +} + +// UpdateVPCRouteOptions : The UpdateVPCRoute options. +type UpdateVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The route identifier. + ID *string `json:"id" validate:"required,ne="` + + // The route patch. + RoutePatch map[string]interface{} `json:"Route_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCRouteOptions : Instantiate UpdateVPCRouteOptions +func (*VpcV1) NewUpdateVPCRouteOptions(vpcID string, id string, routePatch map[string]interface{}) *UpdateVPCRouteOptions { + return &UpdateVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + RoutePatch: routePatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCRouteOptions) SetVPCID(vpcID string) *UpdateVPCRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCRouteOptions) SetID(id string) *UpdateVPCRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRoutePatch : Allow user to set RoutePatch +func (_options *UpdateVPCRouteOptions) SetRoutePatch(routePatch map[string]interface{}) *UpdateVPCRouteOptions { + _options.RoutePatch = routePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCRouteOptions) SetHeaders(param map[string]string) *UpdateVPCRouteOptions { + options.Headers = param + return options +} + +// UpdateVPCRoutingTableOptions : The UpdateVPCRoutingTable options. +type UpdateVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + ID *string `json:"id" validate:"required,ne="` + + // The routing table patch. + RoutingTablePatch map[string]interface{} `json:"RoutingTable_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 +} + +// NewUpdateVPCRoutingTableOptions : Instantiate UpdateVPCRoutingTableOptions +func (*VpcV1) NewUpdateVPCRoutingTableOptions(vpcID string, id string, routingTablePatch map[string]interface{}) *UpdateVPCRoutingTableOptions { + return &UpdateVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + RoutingTablePatch: routingTablePatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCRoutingTableOptions) SetVPCID(vpcID string) *UpdateVPCRoutingTableOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCRoutingTableOptions) SetID(id string) *UpdateVPCRoutingTableOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRoutingTablePatch : Allow user to set RoutingTablePatch +func (_options *UpdateVPCRoutingTableOptions) SetRoutingTablePatch(routingTablePatch map[string]interface{}) *UpdateVPCRoutingTableOptions { + _options.RoutingTablePatch = routingTablePatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVPCRoutingTableOptions) SetIfMatch(ifMatch string) *UpdateVPCRoutingTableOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCRoutingTableOptions) SetHeaders(param map[string]string) *UpdateVPCRoutingTableOptions { + options.Headers = param + return options +} + +// UpdateVPCRoutingTableRouteOptions : The UpdateVPCRoutingTableRoute options. +type UpdateVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `json:"vpc_id" validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` + + // The VPC routing table route identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPC route patch. + RoutePatch map[string]interface{} `json:"Route_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCRoutingTableRouteOptions : Instantiate UpdateVPCRoutingTableRouteOptions +func (*VpcV1) NewUpdateVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string, routePatch map[string]interface{}) *UpdateVPCRoutingTableRouteOptions { + return &UpdateVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + ID: core.StringPtr(id), + RoutePatch: routePatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (_options *UpdateVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *UpdateVPCRoutingTableRouteOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (_options *UpdateVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *UpdateVPCRoutingTableRouteOptions { + _options.RoutingTableID = core.StringPtr(routingTableID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPCRoutingTableRouteOptions) SetID(id string) *UpdateVPCRoutingTableRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRoutePatch : Allow user to set RoutePatch +func (_options *UpdateVPCRoutingTableRouteOptions) SetRoutePatch(routePatch map[string]interface{}) *UpdateVPCRoutingTableRouteOptions { + _options.RoutePatch = routePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *UpdateVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// UpdateVPNGatewayConnectionOptions : The UpdateVPNGatewayConnection options. +type UpdateVPNGatewayConnectionOptions 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 VPN gateway connection patch. + VPNGatewayConnectionPatch map[string]interface{} `json:"VPNGatewayConnection_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPNGatewayConnectionOptions : Instantiate UpdateVPNGatewayConnectionOptions +func (*VpcV1) NewUpdateVPNGatewayConnectionOptions(vpnGatewayID string, id string, vpnGatewayConnectionPatch map[string]interface{}) *UpdateVPNGatewayConnectionOptions { + return &UpdateVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + VPNGatewayConnectionPatch: vpnGatewayConnectionPatch, + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *UpdateVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *UpdateVPNGatewayConnectionOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPNGatewayConnectionOptions) SetID(id string) *UpdateVPNGatewayConnectionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPNGatewayConnectionPatch : Allow user to set VPNGatewayConnectionPatch +func (_options *UpdateVPNGatewayConnectionOptions) SetVPNGatewayConnectionPatch(vpnGatewayConnectionPatch map[string]interface{}) *UpdateVPNGatewayConnectionOptions { + _options.VPNGatewayConnectionPatch = vpnGatewayConnectionPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *UpdateVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// UpdateVPNGatewayOptions : The UpdateVPNGateway options. +type UpdateVPNGatewayOptions struct { + // The VPN gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPN gateway patch. + VPNGatewayPatch map[string]interface{} `json:"VPNGateway_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPNGatewayOptions : Instantiate UpdateVPNGatewayOptions +func (*VpcV1) NewUpdateVPNGatewayOptions(id string, vpnGatewayPatch map[string]interface{}) *UpdateVPNGatewayOptions { + return &UpdateVPNGatewayOptions{ + ID: core.StringPtr(id), + VPNGatewayPatch: vpnGatewayPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVPNGatewayOptions) SetID(id string) *UpdateVPNGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPNGatewayPatch : Allow user to set VPNGatewayPatch +func (_options *UpdateVPNGatewayOptions) SetVPNGatewayPatch(vpnGatewayPatch map[string]interface{}) *UpdateVPNGatewayOptions { + _options.VPNGatewayPatch = vpnGatewayPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNGatewayOptions) SetHeaders(param map[string]string) *UpdateVPNGatewayOptions { + options.Headers = param + return options +} + +// UpdateVPNServerOptions : The UpdateVPNServer options. +type UpdateVPNServerOptions struct { + // The VPN server identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPN server patch. + VPNServerPatch map[string]interface{} `json:"VPNServer_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 +} + +// NewUpdateVPNServerOptions : Instantiate UpdateVPNServerOptions +func (*VpcV1) NewUpdateVPNServerOptions(id string, vpnServerPatch map[string]interface{}) *UpdateVPNServerOptions { + return &UpdateVPNServerOptions{ + ID: core.StringPtr(id), + VPNServerPatch: vpnServerPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVPNServerOptions) SetID(id string) *UpdateVPNServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPNServerPatch : Allow user to set VPNServerPatch +func (_options *UpdateVPNServerOptions) SetVPNServerPatch(vpnServerPatch map[string]interface{}) *UpdateVPNServerOptions { + _options.VPNServerPatch = vpnServerPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVPNServerOptions) SetIfMatch(ifMatch string) *UpdateVPNServerOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNServerOptions) SetHeaders(param map[string]string) *UpdateVPNServerOptions { + options.Headers = param + return options +} + +// UpdateVPNServerRouteOptions : The UpdateVPNServerRoute options. +type UpdateVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN route identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPN route patch. + VPNServerRoutePatch map[string]interface{} `json:"VPNServerRoute_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPNServerRouteOptions : Instantiate UpdateVPNServerRouteOptions +func (*VpcV1) NewUpdateVPNServerRouteOptions(vpnServerID string, id string, vpnServerRoutePatch map[string]interface{}) *UpdateVPNServerRouteOptions { + return &UpdateVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + VPNServerRoutePatch: vpnServerRoutePatch, + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *UpdateVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *UpdateVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPNServerRouteOptions) SetID(id string) *UpdateVPNServerRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPNServerRoutePatch : Allow user to set VPNServerRoutePatch +func (_options *UpdateVPNServerRouteOptions) SetVPNServerRoutePatch(vpnServerRoutePatch map[string]interface{}) *UpdateVPNServerRouteOptions { + _options.VPNServerRoutePatch = vpnServerRoutePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNServerRouteOptions) SetHeaders(param map[string]string) *UpdateVPNServerRouteOptions { + options.Headers = param + return options +} + +// Vcpu : The VCPU configuration. +type Vcpu struct { + // The VCPU architecture. + Architecture *string `json:"architecture" validate:"required"` + + // The number of VCPUs assigned. + Count *int64 `json:"count" validate:"required"` + + // The VCPU manufacturer. + Manufacturer *string `json:"manufacturer" validate:"required"` +} + +// UnmarshalVcpu unmarshals an instance of Vcpu from the specified map of raw messages. +func UnmarshalVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Vcpu) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPC : VPC struct +type VPC struct { + // Indicates whether this VPC is connected to Classic Infrastructure. If true, this VPC's resources 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. + ClassicAccess *bool `json:"classic_access" validate:"required"` + + // The date and time that the VPC was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // The CSE ([Cloud Service Endpoint](https://cloud.ibm.com/docs/resources?topic=resources-service-endpoints)) source IP + // addresses for the VPC. The VPC will have one CSE source IP address per zone. + CseSourceIps []VpccseSourceIP `json:"cse_source_ips,omitempty"` + + // The default network ACL to use for subnets created in this VPC. + DefaultNetworkACL *NetworkACLReference `json:"default_network_acl" validate:"required"` + + // The default routing table to use for subnets created in this VPC. + DefaultRoutingTable *RoutingTableReference `json:"default_routing_table" validate:"required"` + + // The default security group for this VPC. Resources created in this VPC that allow + // a security group to be optionally specified will use this security group by + // default. + DefaultSecurityGroup *SecurityGroupReference `json:"default_security_group" validate:"required"` + + // The DNS configuration for this VPC. + Dns *Vpcdns `json:"dns" validate:"required"` + + // The reasons for the current `health_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPCHealthReason `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 VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The name for this VPC. The name is unique across all VPCs in the region. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPC. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of this VPC. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the VPC.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 ( + VPCHealthStateDegradedConst = "degraded" + VPCHealthStateFaultedConst = "faulted" + VPCHealthStateInapplicableConst = "inapplicable" + VPCHealthStateOkConst = "ok" +) + +// Constants associated with the VPC.ResourceType property. +// The resource type. +const ( + VPCResourceTypeVPCConst = "vpc" +) + +// Constants associated with the VPC.Status property. +// The status of this VPC. +const ( + VPCStatusAvailableConst = "available" + VPCStatusDeletingConst = "deleting" + VPCStatusFailedConst = "failed" + VPCStatusPendingConst = "pending" +) + +// UnmarshalVPC unmarshals an instance of VPC from the specified map of raw messages. +func UnmarshalVPC(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPC) + err = core.UnmarshalPrimitive(m, "classic_access", &obj.ClassicAccess) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cse_source_ips", &obj.CseSourceIps, UnmarshalVpccseSourceIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_network_acl", &obj.DefaultNetworkACL, UnmarshalNetworkACLReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_routing_table", &obj.DefaultRoutingTable, UnmarshalRoutingTableReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_security_group", &obj.DefaultSecurityGroup, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdns) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPCHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpccseSourceIP : VpccseSourceIP struct +type VpccseSourceIP struct { + // The cloud service endpoint source IP address for this zone. + IP *IP `json:"ip" validate:"required"` + + // The zone this cloud service endpoint source IP resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalVpccseSourceIP unmarshals an instance of VpccseSourceIP from the specified map of raw messages. +func UnmarshalVpccseSourceIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpccseSourceIP) + err = core.UnmarshalModel(m, "ip", &obj.IP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCCollection : VPCCollection struct +type VPCCollection struct { + // A link to the first page of resources. + First *VPCCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of VPCs. + Vpcs []VPC `json:"vpcs" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPCCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpcs", &obj.Vpcs, UnmarshalVPC) + if err != nil { + 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 *VPCCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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. + EnableHub *bool `json:"enable_hub" validate:"required"` + + // The number of DNS resolution bindings for this VPC. + ResolutionBindingCount *int64 `json:"resolution_binding_count" validate:"required"` + + // The DNS resolver configuration for the VPC. + Resolver VpcdnsResolverIntf `json:"resolver" validate:"required"` +} + +// UnmarshalVpcdns unmarshals an instance of Vpcdns from the specified map of raw messages. +func UnmarshalVpcdns(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Vpcdns) + err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resolution_binding_count", &obj.ResolutionBindingCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolver) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsPatch : The DNS configuration for this VPC. +type VpcdnsPatch struct { + // Indicates whether this VPC is enabled as a DNS name resolution hub. + // + // Updating the value to `true` requires `allow_dns_resolution_binding` to be `true` for all endpoint gateways residing + // in this VPC. + // + // Changing the value requires `dns.resolution_binding_count` to be zero. + EnableHub *bool `json:"enable_hub,omitempty"` + + Resolver *VpcdnsResolverPatch `json:"resolver,omitempty"` +} + +// UnmarshalVpcdnsPatch unmarshals an instance of VpcdnsPatch from the specified map of raw messages. +func UnmarshalVpcdnsPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsPatch) + err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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, +// and hosts on the internet. +type VpcdnsPrototype struct { + // Indicates whether this VPC is enabled as a DNS name resolution hub. + EnableHub *bool `json:"enable_hub,omitempty"` + + Resolver VpcdnsResolverPrototypeIntf `json:"resolver,omitempty"` +} + +// UnmarshalVpcdnsPrototype unmarshals an instance of VpcdnsPrototype from the specified map of raw messages. +func UnmarshalVpcdnsPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsPrototype) + err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolutionBinding : VpcdnsResolutionBinding struct +type VpcdnsResolutionBinding struct { + // The date and time that the DNS resolution binding was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The endpoint gateways that have `allow_dns_resolution_binding` set to `true` and reside in the VPC that has + // `dns.enable_hub` set to `false`. + // + // The endpoint gateways may be remote and therefore may not be directly retrievable. + EndpointGateways []EndpointGatewayReferenceRemote `json:"endpoint_gateways" validate:"required"` + + // The URL for this DNS resolution binding. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this DNS resolution binding. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the DNS resolution binding. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this DNS resolution binding. The name is unique across all DNS resolution bindings for the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The VPC bound to for DNS resolution. + // + // The VPC may be remote and therefore may not be directly retrievable. + VPC *VPCReferenceRemote `json:"vpc" validate:"required"` +} + +// Constants associated with the VpcdnsResolutionBinding.LifecycleState property. +// The lifecycle state of the DNS resolution binding. +const ( + VpcdnsResolutionBindingLifecycleStateDeletingConst = "deleting" + VpcdnsResolutionBindingLifecycleStateFailedConst = "failed" + VpcdnsResolutionBindingLifecycleStatePendingConst = "pending" + VpcdnsResolutionBindingLifecycleStateStableConst = "stable" + VpcdnsResolutionBindingLifecycleStateSuspendedConst = "suspended" + VpcdnsResolutionBindingLifecycleStateUpdatingConst = "updating" + VpcdnsResolutionBindingLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VpcdnsResolutionBinding.ResourceType property. +// The resource type. +const ( + VpcdnsResolutionBindingResourceTypeVPCDnsResolutionBindingConst = "vpc_dns_resolution_binding" +) + +// UnmarshalVpcdnsResolutionBinding unmarshals an instance of VpcdnsResolutionBinding from the specified map of raw messages. +func UnmarshalVpcdnsResolutionBinding(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolutionBinding) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGatewayReferenceRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceRemote) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolutionBindingCollection : VpcdnsResolutionBindingCollection struct +type VpcdnsResolutionBindingCollection struct { + // Collection of DNS resolution bindings for this VPC. + DnsResolutionBindings []VpcdnsResolutionBinding `json:"dns_resolution_bindings" validate:"required"` + + // A link to the first page of resources. + First *VpcdnsResolutionBindingCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalVpcdnsResolutionBindingCollection unmarshals an instance of VpcdnsResolutionBindingCollection from the specified map of raw messages. +func UnmarshalVpcdnsResolutionBindingCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolutionBindingCollection) + err = core.UnmarshalModel(m, "dns_resolution_bindings", &obj.DnsResolutionBindings, UnmarshalVpcdnsResolutionBinding) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVpcdnsResolutionBindingCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVpcdnsResolutionBindingCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *VpcdnsResolutionBindingCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// VpcdnsResolutionBindingPatch : VpcdnsResolutionBindingPatch struct +type VpcdnsResolutionBindingPatch struct { + // The name for this DNS resolution binding. The name must not be used by another DNS resolution binding for the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVpcdnsResolutionBindingPatch unmarshals an instance of VpcdnsResolutionBindingPatch from the specified map of raw messages. +func UnmarshalVpcdnsResolutionBindingPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolutionBindingPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VpcdnsResolver : VpcdnsResolver struct +// Models which "extend" this model: +// - VpcdnsResolverTypeDelegated +// - VpcdnsResolverTypeManual +// - VpcdnsResolverTypeSystem +type VpcdnsResolver struct { + // The DNS servers for this VPC. The servers are populated: + // + // - by the system when `dns.resolver.type` is `system` + // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + Servers []DnsServer `json:"servers" validate:"required"` + + // The type of the DNS resolver used for the VPC. + // + // - `delegated`: DNS server addresses are provided by the DNS resolver of the VPC + // specified in `dns.resolver.vpc`. + // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. + // - `system`: DNS server addresses are provided by the system. + Type *string `json:"type" validate:"required"` + + // The VPC whose DNS resolver provides the DNS server addresses for this VPC. + // + // The VPC may be remote and therefore may not be directly retrievable. + VPC *VPCReferenceDnsResolverContext `json:"vpc,omitempty"` + + // The manually specified DNS servers for this VPC. + // + // If the DNS servers have `zone_affinity`, the DHCP [Domain Name Server + // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list the DNS server with the + // affinity for that zone first, followed by the unique DNS servers from other zones. + // + // If the DNS servers do not have `zone_affinity`, the DHCP [Domain Name Server + // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS + // servers in the order specified. + ManualServers []DnsServer `json:"manual_servers,omitempty"` + + // The configuration of the system DNS resolver for this VPC. + // + // - `custom_resolver`: A custom DNS resolver is configured for this VPC. + // + // - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when + // the VPC has either or both of the following: + // + // - at least one endpoint gateway residing in it + // - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it + // + // - `default`: The provider default DNS resolvers are configured for this VPC. + // + // This system DNS resolver configuration is used when the VPC has: + // + // - no custom DNS resolver configured for it, and + // - no endpoint gateways residing in it, and + // - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. + Configuration *string `json:"configuration,omitempty"` +} + +// Constants associated with the VpcdnsResolver.Type property. +// The type of the DNS resolver used for the VPC. +// +// - `delegated`: DNS server addresses are provided by the DNS resolver of the VPC +// specified in `dns.resolver.vpc`. +// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. +// - `system`: DNS server addresses are provided by the system. +const ( + VpcdnsResolverTypeDelegatedConst = "delegated" + VpcdnsResolverTypeManualConst = "manual" + VpcdnsResolverTypeSystemConst = "system" +) + +// Constants associated with the VpcdnsResolver.Configuration property. +// The configuration of the system DNS resolver for this VPC. +// +// - `custom_resolver`: A custom DNS resolver is configured for this VPC. +// +// - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when +// the VPC has either or both of the following: +// +// - at least one endpoint gateway residing in it +// +// - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it +// +// - `default`: The provider default DNS resolvers are configured for this VPC. +// +// This system DNS resolver configuration is used when the VPC has: +// +// - no custom DNS resolver configured for it, and +// - no endpoint gateways residing in it, and +// - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. +const ( + VpcdnsResolverConfigurationCustomResolverConst = "custom_resolver" + VpcdnsResolverConfigurationDefaultConst = "default" + VpcdnsResolverConfigurationPrivateResolverConst = "private_resolver" +) + +func (*VpcdnsResolver) isaVpcdnsResolver() bool { + return true +} + +type VpcdnsResolverIntf interface { + isaVpcdnsResolver() bool +} + +// UnmarshalVpcdnsResolver unmarshals an instance of VpcdnsResolver from the specified map of raw messages. +func UnmarshalVpcdnsResolver(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolver) + err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverPatch : VpcdnsResolverPatch struct +type VpcdnsResolverPatch struct { + // The DNS servers to use for this VPC, replacing any existing servers. All the DNS servers must either: + // + // - have a unique `zone_affinity`, or + // - not have a `zone_affinity`. + // + // If `zone_affinity` is specified, exactly one DNS server must be specified for each zone in the region. The DHCP + // [Domain Name Server Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list this DNS + // server first, followed by unique DNS servers from other zones if available. + // + // If `zone_affinity` is not specified, the DHCP [Domain Name Server + // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS + // servers in the order specified. + // + // `dns.resolver.manual_servers` must be set if and only if `dns.resolver.type` is `manual`. + ManualServers []DnsServerPrototype `json:"manual_servers,omitempty"` + + // The type of the DNS resolver to use. + // + // - `delegated`: DNS server addresses will be provided by the resolver for the VPC + // specified in `dns.resolver.vpc`. Requires `dns.enable_hub` to be + // `false`. + // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. + // - `system`: DNS server addresses will be provided by the system and depend on the + // configuration. + // + // Updating from `manual` requires `dns.resolver.manual_servers` to be specified as + // `null`. + // + // Updating to `manual` requires `dns.resolver.manual_servers` to be specified and not empty. + // + // Updating from `delegated` requires `dns.resolver.vpc` to be specified as `null`. + Type *string `json:"type,omitempty"` + + // The VPC to provide DNS server addresses for this VPC. The specified VPC must be configured + // with a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) custom resolver and must be in + // one of this VPC's DNS resolution bindings. + // + // Specify `null` to remove an existing VPC. + // + // This property must be set if and only if `dns.resolver.type` is `delegated`. + VPC VpcdnsResolverVPCPatchIntf `json:"vpc,omitempty"` +} + +// Constants associated with the VpcdnsResolverPatch.Type property. +// The type of the DNS resolver to use. +// +// - `delegated`: DNS server addresses will be provided by the resolver for the VPC +// specified in `dns.resolver.vpc`. Requires `dns.enable_hub` to be +// `false`. +// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. +// - `system`: DNS server addresses will be provided by the system and depend on the +// configuration. +// +// Updating from `manual` requires `dns.resolver.manual_servers` to be specified as +// `null`. +// +// Updating to `manual` requires `dns.resolver.manual_servers` to be specified and not empty. +// +// Updating from `delegated` requires `dns.resolver.vpc` to be specified as `null`. +const ( + VpcdnsResolverPatchTypeDelegatedConst = "delegated" + VpcdnsResolverPatchTypeManualConst = "manual" + VpcdnsResolverPatchTypeSystemConst = "system" +) + +// UnmarshalVpcdnsResolverPatch unmarshals an instance of VpcdnsResolverPatch from the specified map of raw messages. +func UnmarshalVpcdnsResolverPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverPatch) + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVpcdnsResolverVPCPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverPrototype : VpcdnsResolverPrototype struct +// Models which "extend" this model: +// - VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype +// - VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype +type VpcdnsResolverPrototype struct { + // The type of the DNS resolver to use. + // + // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. + // - `system`: DNS server addresses will be provided by the system and depend on the + // configuration. + Type *string `json:"type,omitempty"` + + // The DNS servers to use for this VPC. All the DNS servers must either: + // + // - have a unique `zone_affinity`, or + // - not have a `zone_affinity`. + // + // If `zone_affinity` is specified, exactly one DNS server must be specified for each zone in the region. The DHCP + // [Domain Name Server Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list this DNS + // server first, followed by unique DNS servers from other zones if available. + // + // If `zone_affinity` is not specified, the DHCP [Domain Name Server + // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS + // servers in the order specified. + ManualServers []DnsServerPrototype `json:"manual_servers,omitempty"` +} + +// Constants associated with the VpcdnsResolverPrototype.Type property. +// The type of the DNS resolver to use. +// +// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. +// - `system`: DNS server addresses will be provided by the system and depend on the +// configuration. +const ( + VpcdnsResolverPrototypeTypeManualConst = "manual" + VpcdnsResolverPrototypeTypeSystemConst = "system" +) + +func (*VpcdnsResolverPrototype) isaVpcdnsResolverPrototype() bool { + return true +} + +type VpcdnsResolverPrototypeIntf interface { + isaVpcdnsResolverPrototype() bool +} + +// UnmarshalVpcdnsResolverPrototype unmarshals an instance of VpcdnsResolverPrototype from the specified map of raw messages. +func UnmarshalVpcdnsResolverPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverPrototype) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverVPCPatch : The VPC to provide DNS server addresses for this VPC. The specified VPC must be configured with a [DNS +// Services](https://cloud.ibm.com/docs/dns-svcs) custom resolver and must be in one of this VPC's DNS resolution +// bindings. +// +// Specify `null` to remove an existing VPC. +// +// This property must be set if and only if `dns.resolver.type` is `delegated`. +// Models which "extend" this model: +// - VpcdnsResolverVPCPatchVPCIdentityByID +// - VpcdnsResolverVPCPatchVPCIdentityByCRN +// - VpcdnsResolverVPCPatchVPCIdentityByHref +type VpcdnsResolverVPCPatch struct { + // The unique identifier for this VPC. + ID *string `json:"id,omitempty"` + + // The CRN for this VPC. + CRN *string `json:"crn,omitempty"` + + // The URL for this VPC. + Href *string `json:"href,omitempty"` +} + +func (*VpcdnsResolverVPCPatch) isaVpcdnsResolverVPCPatch() bool { + return true +} + +type VpcdnsResolverVPCPatchIntf interface { + isaVpcdnsResolverVPCPatch() bool +} + +// UnmarshalVpcdnsResolverVPCPatch unmarshals an instance of VpcdnsResolverVPCPatch from the specified map of raw messages. +func UnmarshalVpcdnsResolverVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverVPCPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCHealthReason : VPCHealthReason struct +type VPCHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the VPCHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + VPCHealthReasonCodeDnsResolutionBindingFailedConst = "dns_resolution_binding_failed" + VPCHealthReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalVPCHealthReason unmarshals an instance of VPCHealthReason from the specified map of raw messages. +func UnmarshalVPCHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentity : Identifies a VPC by a unique property. +// Models which "extend" this model: +// - VPCIdentityByID +// - VPCIdentityByCRN +// - VPCIdentityByHref +type VPCIdentity struct { + // The unique identifier for this VPC. + ID *string `json:"id,omitempty"` + + // The CRN for this VPC. + CRN *string `json:"crn,omitempty"` + + // The URL for this VPC. + Href *string `json:"href,omitempty"` +} + +func (*VPCIdentity) isaVPCIdentity() bool { + return true +} + +type VPCIdentityIntf interface { + isaVPCIdentity() bool +} + +// UnmarshalVPCIdentity unmarshals an instance of VPCIdentity from the specified map of raw messages. +func UnmarshalVPCIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCPatch : VPCPatch struct +type VPCPatch struct { + // The DNS configuration for this VPC. + Dns *VpcdnsPatch `json:"dns,omitempty"` + + // The name for this VPC. The name must not be used by another VPC in the region. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVPCPatch unmarshals an instance of VPCPatch from the specified map of raw messages. +func UnmarshalVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCPatch) + err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdnsPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VPCReference : VPCReference struct +type VPCReference struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The name for this VPC. The name is unique across all VPCs in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPCReference.ResourceType property. +// The resource type. +const ( + VPCReferenceResourceTypeVPCConst = "vpc" +) + +// UnmarshalVPCReference unmarshals an instance of VPCReference from the specified map of raw messages. +func UnmarshalVPCReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCReferenceDnsResolverContext : A VPC whose DNS resolver is delegated to provide DNS servers for this VPC. +// +// The VPC may be remote and therefore may not be directly retrievable. +type VPCReferenceDnsResolverContext struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPCReferenceDnsResolverContextDeleted `json:"deleted,omitempty"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The name for this VPC. The name is unique across all VPCs in the region. + 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 *VPCRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPCReferenceDnsResolverContext.ResourceType property. +// The resource type. +const ( + VPCReferenceDnsResolverContextResourceTypeVPCConst = "vpc" +) + +// UnmarshalVPCReferenceDnsResolverContext unmarshals an instance of VPCReferenceDnsResolverContext from the specified map of raw messages. +func UnmarshalVPCReferenceDnsResolverContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReferenceDnsResolverContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDnsResolverContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVPCRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPCReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPCReferenceDeleted unmarshals an instance of VPCReferenceDeleted from the specified map of raw messages. +func UnmarshalVPCReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCReferenceDnsResolverContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPCReferenceDnsResolverContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPCReferenceDnsResolverContextDeleted unmarshals an instance of VPCReferenceDnsResolverContextDeleted from the specified map of raw messages. +func UnmarshalVPCReferenceDnsResolverContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReferenceDnsResolverContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCReferenceRemote : VPCReferenceRemote struct +type VPCReferenceRemote struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The name for this VPC. The name is unique across all VPCs in the region. + 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 *VPCRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPCReferenceRemote.ResourceType property. +// The resource type. +const ( + VPCReferenceRemoteResourceTypeVPCConst = "vpc" +) + +// UnmarshalVPCReferenceRemote unmarshals an instance of VPCReferenceRemote from the specified map of raw messages. +func UnmarshalVPCReferenceRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReferenceRemote) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVPCRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type VPCRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // account, and identifies the owning account. + Account *AccountReference `json:"account,omitempty"` + + // If present, this property indicates that the referenced resource is remote to this + // region, and identifies the native region. + Region *RegionReference `json:"region,omitempty"` +} + +// UnmarshalVPCRemote unmarshals an instance of VPCRemote from the specified map of raw messages. +func UnmarshalVPCRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCRemote) + err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGateway : VPNGateway struct +// Models which "extend" this model: +// - VPNGatewayRouteMode +// - VPNGatewayPolicyMode +type VPNGateway struct { + // Connections for this VPN gateway. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // The reasons for the current VPN gateway health_state (if any): + // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (contact IBM support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPNGatewayHealthReason `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 VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // The reasons for the current VPN gateway lifecycle_state (if any): + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the VPN gateway. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPN gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The VPC this VPN gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGateway.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 ( + VPNGatewayHealthStateDegradedConst = "degraded" + VPNGatewayHealthStateFaultedConst = "faulted" + VPNGatewayHealthStateInapplicableConst = "inapplicable" + VPNGatewayHealthStateOkConst = "ok" +) + +// Constants associated with the VPNGateway.LifecycleState property. +// The lifecycle state of the VPN gateway. +const ( + VPNGatewayLifecycleStateDeletingConst = "deleting" + VPNGatewayLifecycleStateFailedConst = "failed" + VPNGatewayLifecycleStatePendingConst = "pending" + VPNGatewayLifecycleStateStableConst = "stable" + VPNGatewayLifecycleStateSuspendedConst = "suspended" + VPNGatewayLifecycleStateUpdatingConst = "updating" + VPNGatewayLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNGateway.ResourceType property. +// The resource type. +const ( + VPNGatewayResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGateway.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayModeRouteConst = "route" +) + +func (*VPNGateway) isaVPNGateway() bool { + return true +} + +type VPNGatewayIntf interface { + isaVPNGateway() bool +} + +// UnmarshalVPNGateway unmarshals an instance of VPNGateway from the specified map of raw messages. +func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGateway) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayCollection : VPNGatewayCollection struct +type VPNGatewayCollection struct { + // A link to the first page of resources. + First *VPNGatewayCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of VPN gateways. + VPNGateways []VPNGatewayIntf `json:"vpn_gateways" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNGatewayCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpn_gateways", &obj.VPNGateways, UnmarshalVPNGateway) + if err != nil { + 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 *VPNGatewayCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnection : VPNGatewayConnection struct +// Models which "extend" this model: +// - VPNGatewayConnectionStaticRouteMode +// - VPNGatewayConnectionPolicyMode +type VPNGatewayConnection struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The IKE policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // The IPsec policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` + + // The pre-shared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // The reasons for the current VPN gateway connection status (if any): + // - `cannot_authenticate_connection`: Failed to authenticate a connection because of + // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) + // - `internal_error`: Internal error (contact IBM support) + // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check + // the IKE policies on both sides of the VPN) + // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and + // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE + // V1 configuration) + // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE + // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) + // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable + // (check the IPsec policies on both sides of the VPN) + // - `peer_not_responding`: No response from peer (check network ACL configuration, peer + // availability, and on-premise firewall configuration) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + + Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local,omitempty"` + + Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer,omitempty"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` + + // The VPN tunnel configuration for this VPN gateway connection (in static route mode). + Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels,omitempty"` +} + +// Constants associated with the VPNGatewayConnection.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnection.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionEstablishModePeerOnlyConst = "peer_only" +) + +// Constants associated with the VPNGatewayConnection.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionModePolicyConst = "policy" + VPNGatewayConnectionModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnection.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnection.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionStatusDownConst = "down" + VPNGatewayConnectionStatusUpConst = "up" +) + +// Constants associated with the VPNGatewayConnection.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnection) isaVPNGatewayConnection() bool { + return true +} + +type VPNGatewayConnectionIntf interface { + isaVPNGatewayConnection() bool +} + +// UnmarshalVPNGatewayConnection unmarshals an instance of VPNGatewayConnection from the specified map of raw messages. +func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnection) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocal) + if err != nil { + return + } + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionCIDRs : VPNGatewayConnectionCIDRs struct +type VPNGatewayConnectionCIDRs struct { + // The CIDRs for this resource. + CIDRs []string `json:"cidrs" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionCIDRs unmarshals an instance of VPNGatewayConnectionCIDRs from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionCIDRs) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionCollection : Collection of VPN gateway connections in a VPN gateway. +type VPNGatewayConnectionCollection struct { + // Array of VPN gateway connections. + Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionCollection unmarshals an instance of VPNGatewayConnectionCollection from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionCollection) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDpd : The Dead Peer Detection settings. +type VPNGatewayConnectionDpd struct { + // Dead Peer Detection actions. + Action *string `json:"action" validate:"required"` + + // Dead Peer Detection interval in seconds. + Interval *int64 `json:"interval" validate:"required"` + + // Dead Peer Detection timeout in seconds. Must be at least the interval. + Timeout *int64 `json:"timeout" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionDpd.Action property. +// Dead Peer Detection actions. +const ( + VPNGatewayConnectionDpdActionClearConst = "clear" + VPNGatewayConnectionDpdActionHoldConst = "hold" + VPNGatewayConnectionDpdActionNoneConst = "none" + VPNGatewayConnectionDpdActionRestartConst = "restart" +) + +// UnmarshalVPNGatewayConnectionDpd unmarshals an instance of VPNGatewayConnectionDpd from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDpd(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDpd) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDpdPatch : The Dead Peer Detection settings. +type VPNGatewayConnectionDpdPatch struct { + // Dead Peer Detection actions. + Action *string `json:"action,omitempty"` + + // Dead Peer Detection interval in seconds. + Interval *int64 `json:"interval,omitempty"` + + // Dead Peer Detection timeout in seconds. Must be at least the interval. + Timeout *int64 `json:"timeout,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionDpdPatch.Action property. +// Dead Peer Detection actions. +const ( + VPNGatewayConnectionDpdPatchActionClearConst = "clear" + VPNGatewayConnectionDpdPatchActionHoldConst = "hold" + VPNGatewayConnectionDpdPatchActionNoneConst = "none" + VPNGatewayConnectionDpdPatchActionRestartConst = "restart" +) + +// UnmarshalVPNGatewayConnectionDpdPatch unmarshals an instance of VPNGatewayConnectionDpdPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDpdPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDpdPatch) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDpdPrototype : The Dead Peer Detection settings. +type VPNGatewayConnectionDpdPrototype struct { + // Dead Peer Detection actions. + Action *string `json:"action,omitempty"` + + // Dead Peer Detection interval in seconds. + Interval *int64 `json:"interval,omitempty"` + + // Dead Peer Detection timeout in seconds. Must be at least the interval. + Timeout *int64 `json:"timeout,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionDpdPrototype.Action property. +// Dead Peer Detection actions. +const ( + VPNGatewayConnectionDpdPrototypeActionClearConst = "clear" + VPNGatewayConnectionDpdPrototypeActionHoldConst = "hold" + VPNGatewayConnectionDpdPrototypeActionNoneConst = "none" + VPNGatewayConnectionDpdPrototypeActionRestartConst = "restart" +) + +// UnmarshalVPNGatewayConnectionDpdPrototype unmarshals an instance of VPNGatewayConnectionDpdPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDpdPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkeIdentity : VPNGatewayConnectionIkeIdentity struct +// Models which "extend" this model: +// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn +// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname +// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 +// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID +type VPNGatewayConnectionIkeIdentity struct { + // The IKE identity type. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + Type *string `json:"type" validate:"required"` + + // The IKE identity FQDN value. + Value *string `json:"value,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentity.Type property. +// The IKE identity type. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected +// property value was encountered. +const ( + VPNGatewayConnectionIkeIdentityTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityTypeKeyIDConst = "key_id" +) + +func (*VPNGatewayConnectionIkeIdentity) isaVPNGatewayConnectionIkeIdentity() bool { + return true +} + +type VPNGatewayConnectionIkeIdentityIntf interface { + isaVPNGatewayConnectionIkeIdentity() bool +} + +// UnmarshalVPNGatewayConnectionIkeIdentity unmarshals an instance of VPNGatewayConnectionIkeIdentity from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkeIdentityPrototype : VPNGatewayConnectionIkeIdentityPrototype struct +// Models which "extend" this model: +// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn +// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname +// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 +// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID +type VPNGatewayConnectionIkeIdentityPrototype struct { + // The IKE identity type. + Type *string `json:"type" validate:"required"` + + // The IKE identity FQDN value. + Value *string `json:"value,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityPrototype.Type property. +// The IKE identity type. +const ( + VPNGatewayConnectionIkeIdentityPrototypeTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityPrototypeTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityPrototypeTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityPrototypeTypeKeyIDConst = "key_id" +) + +func (*VPNGatewayConnectionIkeIdentityPrototype) isaVPNGatewayConnectionIkeIdentityPrototype() bool { + return true +} + +type VPNGatewayConnectionIkeIdentityPrototypeIntf interface { + isaVPNGatewayConnectionIkeIdentityPrototype() bool +} + +// UnmarshalVPNGatewayConnectionIkeIdentityPrototype unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityPrototype) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPatch : The IKE policy to use. Specify `null` to remove any existing policy, [resulting in +// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). +// Models which "extend" this model: +// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID +// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref +type VPNGatewayConnectionIkePolicyPatch struct { + // The unique identifier for this IKE policy. + ID *string `json:"id,omitempty"` + + // The IKE policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIkePolicyPatch) isaVPNGatewayConnectionIkePolicyPatch() bool { + return true +} + +type VPNGatewayConnectionIkePolicyPatchIntf interface { + isaVPNGatewayConnectionIkePolicyPatch() bool +} + +// UnmarshalVPNGatewayConnectionIkePolicyPatch unmarshals an instance of VPNGatewayConnectionIkePolicyPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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: +// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID +// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref +type VPNGatewayConnectionIkePolicyPrototype struct { + // The unique identifier for this IKE policy. + ID *string `json:"id,omitempty"` + + // The IKE policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIkePolicyPrototype) isaVPNGatewayConnectionIkePolicyPrototype() bool { + return true +} + +type VPNGatewayConnectionIkePolicyPrototypeIntf interface { + isaVPNGatewayConnectionIkePolicyPrototype() bool +} + +// UnmarshalVPNGatewayConnectionIkePolicyPrototype unmarshals an instance of VPNGatewayConnectionIkePolicyPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPatch : The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in +// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). +// Models which "extend" this model: +// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID +// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref +type VPNGatewayConnectionIPsecPolicyPatch struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id,omitempty"` + + // The IPsec policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIPsecPolicyPatch) isaVPNGatewayConnectionIPsecPolicyPatch() bool { + return true +} + +type VPNGatewayConnectionIPsecPolicyPatchIntf interface { + isaVPNGatewayConnectionIPsecPolicyPatch() bool +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPatch unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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: +// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID +// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref +type VPNGatewayConnectionIPsecPolicyPrototype struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id,omitempty"` + + // The IPsec policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIPsecPolicyPrototype) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { + return true +} + +type VPNGatewayConnectionIPsecPolicyPrototypeIntf interface { + isaVPNGatewayConnectionIPsecPolicyPrototype() bool +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPrototype unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPatch : VPNGatewayConnectionPatch struct +type VPNGatewayConnectionPatch struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpdPatch `json:"dead_peer_detection,omitempty"` + + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode,omitempty"` + + // The IKE policy to use. Specify `null` to remove any existing policy, [resulting in + // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy VPNGatewayConnectionIkePolicyPatchIntf `json:"ike_policy,omitempty"` + + // The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in + // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy VPNGatewayConnectionIPsecPolicyPatchIntf `json:"ipsec_policy,omitempty"` + + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. + Name *string `json:"name,omitempty"` + + Peer VPNGatewayConnectionPeerPatchIntf `json:"peer,omitempty"` + + // The pre-shared key. + Psk *string `json:"psk,omitempty"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPatch.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionPatchEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionPatchEstablishModePeerOnlyConst = "peer_only" +) + +// Constants associated with the VPNGatewayConnectionPatch.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPatchRoutingProtocolNoneConst = "none" +) + +// UnmarshalVPNGatewayConnectionPatch unmarshals an instance of VPNGatewayConnectionPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPatch) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionPeerPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VPNGatewayConnectionPeerPatch : VPNGatewayConnectionPeerPatch struct +// Models which "extend" this model: +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch +type VPNGatewayConnectionPeerPatch struct { + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionPeerPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} + +type VPNGatewayConnectionPeerPatchIntf interface { + isaVPNGatewayConnectionPeerPatch() bool +} + +// UnmarshalVPNGatewayConnectionPeerPatch unmarshals an instance of VPNGatewayConnectionPeerPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModeLocal : VPNGatewayConnectionPolicyModeLocal struct +type VPNGatewayConnectionPolicyModeLocal struct { + // The local CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The local IKE identities. + // + // A VPN gateway in policy mode consists of two members in active-standby mode. The local IKE identity applies to the + // active member. + IkeIdentities []VPNGatewayConnectionIkeIdentityIntf `json:"ike_identities" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionPolicyModeLocal unmarshals an instance of VPNGatewayConnectionPolicyModeLocal from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModeLocal(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModeLocal) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModeLocalPrototype : VPNGatewayConnectionPolicyModeLocalPrototype struct +type VPNGatewayConnectionPolicyModeLocalPrototype struct { + // The local CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The local IKE identities to use. + // + // A VPN gateway in policy mode consists of two members in active-standby mode. The specified identity will be applied + // to the active member. + // + // If unspecified, then `type` will be `ipv4_address` and `value` will be the public IP address of the VPN gateway. + IkeIdentities []VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identities,omitempty"` +} + +// NewVPNGatewayConnectionPolicyModeLocalPrototype : Instantiate VPNGatewayConnectionPolicyModeLocalPrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionPolicyModeLocalPrototype(cidrs []string) (_model *VPNGatewayConnectionPolicyModeLocalPrototype, err error) { + _model = &VPNGatewayConnectionPolicyModeLocalPrototype{ + CIDRs: cidrs, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVPNGatewayConnectionPolicyModeLocalPrototype unmarshals an instance of VPNGatewayConnectionPolicyModeLocalPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModeLocalPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModeLocalPrototype) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModePeer : VPNGatewayConnectionPolicyModePeer struct +// Models which "extend" this model: +// - VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress +// - VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn +type VPNGatewayConnectionPolicyModePeer struct { + // The peer CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPolicyModePeer.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionPolicyModePeerTypeAddressConst = "address" + VPNGatewayConnectionPolicyModePeerTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionPolicyModePeer) isaVPNGatewayConnectionPolicyModePeer() bool { + return true +} + +type VPNGatewayConnectionPolicyModePeerIntf interface { + isaVPNGatewayConnectionPolicyModePeer() bool +} + +// UnmarshalVPNGatewayConnectionPolicyModePeer unmarshals an instance of VPNGatewayConnectionPolicyModePeer from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModePeer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModePeer) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModePeerPrototype : VPNGatewayConnectionPolicyModePeerPrototype struct +// Models which "extend" this model: +// - VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress +// - VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn +type VPNGatewayConnectionPolicyModePeerPrototype struct { + // The peer CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and + // the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` + // will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionPolicyModePeerPrototype) isaVPNGatewayConnectionPolicyModePeerPrototype() bool { + return true +} + +type VPNGatewayConnectionPolicyModePeerPrototypeIntf interface { + isaVPNGatewayConnectionPolicyModePeerPrototype() bool +} + +// UnmarshalVPNGatewayConnectionPolicyModePeerPrototype unmarshals an instance of VPNGatewayConnectionPolicyModePeerPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModePeerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModePeerPrototype) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPrototype : VPNGatewayConnectionPrototype struct +// Models which "extend" this model: +// - VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype +// - VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype +type VPNGatewayConnectionPrototype struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode,omitempty"` + + // 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). + IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` + + // 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). + IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` + + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The pre-shared key. + Psk *string `json:"psk" validate:"required"` + + Local *VPNGatewayConnectionStaticRouteModeLocalPrototype `json:"local,omitempty"` + + Peer VPNGatewayConnectionStaticRouteModePeerPrototypeIntf `json:"peer,omitempty"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPrototype.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionPrototypeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionPrototypeEstablishModePeerOnlyConst = "peer_only" +) + +// Constants associated with the VPNGatewayConnectionPrototype.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPrototypeRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionPrototype) isaVPNGatewayConnectionPrototype() bool { + return true +} + +type VPNGatewayConnectionPrototypeIntf interface { + isaVPNGatewayConnectionPrototype() bool +} + +// UnmarshalVPNGatewayConnectionPrototype unmarshals an instance of VPNGatewayConnectionPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPrototype) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionReference : VPNGatewayConnectionReference struct +type VPNGatewayConnectionReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionReference.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// UnmarshalVPNGatewayConnectionReference unmarshals an instance of VPNGatewayConnectionReference from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPNGatewayConnectionReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionReferenceDeleted unmarshals an instance of VPNGatewayConnectionReferenceDeleted from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModeLocal : VPNGatewayConnectionStaticRouteModeLocal struct +type VPNGatewayConnectionStaticRouteModeLocal struct { + // The local IKE identities. + // + // A VPN gateway in static route mode consists of two members in active-active mode. The first identity applies to the + // first member, and the second identity applies to the second member. + IkeIdentities []VPNGatewayConnectionIkeIdentityIntf `json:"ike_identities" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionStaticRouteModeLocal unmarshals an instance of VPNGatewayConnectionStaticRouteModeLocal from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModeLocal(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModeLocal) + err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModeLocalPrototype : VPNGatewayConnectionStaticRouteModeLocalPrototype struct +type VPNGatewayConnectionStaticRouteModeLocalPrototype struct { + // The local IKE identities to use. + // + // A VPN gateway in static route mode consists of two members in active-active mode. The first specified identity will + // be applied to the first member, and the second specified identity will be applied to the second member. + // + // If unspecified, then `type` will be `ipv4_address` and `value` will be the public IP address of the member's VPN + // connection tunnel. + IkeIdentities []VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identities,omitempty"` +} + +// UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype unmarshals an instance of VPNGatewayConnectionStaticRouteModeLocalPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModeLocalPrototype) + err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModePeer : VPNGatewayConnectionStaticRouteModePeer struct +// Models which "extend" this model: +// - VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress +// - VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn +type VPNGatewayConnectionStaticRouteModePeer struct { + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionStaticRouteModePeer.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionStaticRouteModePeerTypeAddressConst = "address" + VPNGatewayConnectionStaticRouteModePeerTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionStaticRouteModePeer) isaVPNGatewayConnectionStaticRouteModePeer() bool { + return true +} + +type VPNGatewayConnectionStaticRouteModePeerIntf interface { + isaVPNGatewayConnectionStaticRouteModePeer() bool +} + +// UnmarshalVPNGatewayConnectionStaticRouteModePeer unmarshals an instance of VPNGatewayConnectionStaticRouteModePeer from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModePeer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModePeer) + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModePeerPrototype : VPNGatewayConnectionStaticRouteModePeerPrototype struct +// Models which "extend" this model: +// - VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress +// - VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn +type VPNGatewayConnectionStaticRouteModePeerPrototype struct { + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and + // the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` + // will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionStaticRouteModePeerPrototype) isaVPNGatewayConnectionStaticRouteModePeerPrototype() bool { + return true +} + +type VPNGatewayConnectionStaticRouteModePeerPrototypeIntf interface { + isaVPNGatewayConnectionStaticRouteModePeerPrototype() bool +} + +// UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModePeerPrototype) + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModeTunnel : VPNGatewayConnectionStaticRouteModeTunnel struct +type VPNGatewayConnectionStaticRouteModeTunnel struct { + // The IP address of the VPN gateway member in which the tunnel resides. + PublicIP *IP `json:"public_ip" validate:"required"` + + // The status of the VPN Tunnel. + Status *string `json:"status" validate:"required"` + + // The reasons for the current VPN gateway connection tunnels status (if any): + // - `cannot_authenticate_connection`: Failed to authenticate a connection because of + // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) + // - `internal_error`: Internal error (contact IBM support) + // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check + // the IKE policies on both sides of the VPN) + // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and + // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE + // V1 configuration) + // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE + // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) + // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable + // (check the IPsec policies on both sides of the VPN) + // - `peer_not_responding`: No response from peer (check network ACL configuration, peer + // availability, and on-premise firewall configuration) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []VPNGatewayConnectionTunnelStatusReason `json:"status_reasons" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionStaticRouteModeTunnel.Status property. +// The status of the VPN Tunnel. +const ( + VPNGatewayConnectionStaticRouteModeTunnelStatusDownConst = "down" + VPNGatewayConnectionStaticRouteModeTunnelStatusUpConst = "up" +) + +// UnmarshalVPNGatewayConnectionStaticRouteModeTunnel unmarshals an instance of VPNGatewayConnectionStaticRouteModeTunnel from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModeTunnel) + err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionTunnelStatusReason) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStatusReason : VPNGatewayConnectionStatusReason struct +type VPNGatewayConnectionStatusReason struct { + // A snake case string succinctly identifying the status reason. + Code *string `json:"code" validate:"required"` + + // An explanation of the reason for this VPN gateway connection's status. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + VPNGatewayConnectionStatusReasonCodeCannotAuthenticateConnectionConst = "cannot_authenticate_connection" + VPNGatewayConnectionStatusReasonCodeIkePolicyMismatchConst = "ike_policy_mismatch" + VPNGatewayConnectionStatusReasonCodeIkeV1IDLocalRemoteCIDRMismatchConst = "ike_v1_id_local_remote_cidr_mismatch" + VPNGatewayConnectionStatusReasonCodeIkeV2LocalRemoteCIDRMismatchConst = "ike_v2_local_remote_cidr_mismatch" + VPNGatewayConnectionStatusReasonCodeInternalErrorConst = "internal_error" + VPNGatewayConnectionStatusReasonCodeIpsecPolicyMismatchConst = "ipsec_policy_mismatch" + VPNGatewayConnectionStatusReasonCodePeerNotRespondingConst = "peer_not_responding" +) + +// UnmarshalVPNGatewayConnectionStatusReason unmarshals an instance of VPNGatewayConnectionStatusReason from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionTunnelStatusReason : VPNGatewayConnectionTunnelStatusReason struct +type VPNGatewayConnectionTunnelStatusReason struct { + // A snake case string succinctly identifying the status reason. + Code *string `json:"code" validate:"required"` + + // An explanation of the reason for this VPN gateway connection tunnel's status. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionTunnelStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + VPNGatewayConnectionTunnelStatusReasonCodeCannotAuthenticateConnectionConst = "cannot_authenticate_connection" + VPNGatewayConnectionTunnelStatusReasonCodeIkePolicyMismatchConst = "ike_policy_mismatch" + VPNGatewayConnectionTunnelStatusReasonCodeIkeV1IDLocalRemoteCIDRMismatchConst = "ike_v1_id_local_remote_cidr_mismatch" + VPNGatewayConnectionTunnelStatusReasonCodeIkeV2LocalRemoteCIDRMismatchConst = "ike_v2_local_remote_cidr_mismatch" + VPNGatewayConnectionTunnelStatusReasonCodeInternalErrorConst = "internal_error" + VPNGatewayConnectionTunnelStatusReasonCodeIpsecPolicyMismatchConst = "ipsec_policy_mismatch" + VPNGatewayConnectionTunnelStatusReasonCodePeerNotRespondingConst = "peer_not_responding" +) + +// UnmarshalVPNGatewayConnectionTunnelStatusReason unmarshals an instance of VPNGatewayConnectionTunnelStatusReason from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionTunnelStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionTunnelStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayHealthReason : VPNGatewayHealthReason struct +type VPNGatewayHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the VPNGatewayHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + VPNGatewayHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route" + VPNGatewayHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" + VPNGatewayHealthReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalVPNGatewayHealthReason unmarshals an instance of VPNGatewayHealthReason from the specified map of raw messages. +func UnmarshalVPNGatewayHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayLifecycleReason : VPNGatewayLifecycleReason struct +type VPNGatewayLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 VPNGatewayLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + VPNGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalVPNGatewayLifecycleReason unmarshals an instance of VPNGatewayLifecycleReason from the specified map of raw messages. +func UnmarshalVPNGatewayLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayMember : VPNGatewayMember struct +type VPNGatewayMember struct { + // The reasons for the current VPN gateway member health_state (if any): + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (contact IBM support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPNGatewayMemberHealthReason `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 reasons for the current VPN gateway member lifecycle_state (if any): + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []VPNGatewayMemberLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the VPN gateway member. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The reserved IP address assigned to the VPN gateway member. + // + // This property will be present only when the VPN gateway status is `available`. + PrivateIP *ReservedIPReference `json:"private_ip" validate:"required"` + + // The public IP address assigned to the VPN gateway member. + PublicIP *IP `json:"public_ip" validate:"required"` + + // The high availability role assigned to the VPN gateway member. + Role *string `json:"role" validate:"required"` +} + +// Constants associated with the VPNGatewayMember.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 ( + VPNGatewayMemberHealthStateDegradedConst = "degraded" + VPNGatewayMemberHealthStateFaultedConst = "faulted" + VPNGatewayMemberHealthStateInapplicableConst = "inapplicable" + VPNGatewayMemberHealthStateOkConst = "ok" +) + +// Constants associated with the VPNGatewayMember.LifecycleState property. +// The lifecycle state of the VPN gateway member. +const ( + VPNGatewayMemberLifecycleStateDeletingConst = "deleting" + VPNGatewayMemberLifecycleStateFailedConst = "failed" + VPNGatewayMemberLifecycleStatePendingConst = "pending" + VPNGatewayMemberLifecycleStateStableConst = "stable" + VPNGatewayMemberLifecycleStateSuspendedConst = "suspended" + VPNGatewayMemberLifecycleStateUpdatingConst = "updating" + VPNGatewayMemberLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNGatewayMember.Role property. +// The high availability role assigned to the VPN gateway member. +const ( + VPNGatewayMemberRoleActiveConst = "active" + VPNGatewayMemberRoleStandbyConst = "standby" +) + +// UnmarshalVPNGatewayMember unmarshals an instance of VPNGatewayMember from the specified map of raw messages. +func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayMember) + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayMemberHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayMemberLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalModel(m, "private_ip", &obj.PrivateIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "role", &obj.Role) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayMemberHealthReason : VPNGatewayMemberHealthReason struct +type VPNGatewayMemberHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the VPNGatewayMemberHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + VPNGatewayMemberHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" + VPNGatewayMemberHealthReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalVPNGatewayMemberHealthReason unmarshals an instance of VPNGatewayMemberHealthReason from the specified map of raw messages. +func UnmarshalVPNGatewayMemberHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayMemberHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayMemberLifecycleReason : VPNGatewayMemberLifecycleReason struct +type VPNGatewayMemberLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 VPNGatewayMemberLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + VPNGatewayMemberLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalVPNGatewayMemberLifecycleReason unmarshals an instance of VPNGatewayMemberLifecycleReason from the specified map of raw messages. +func UnmarshalVPNGatewayMemberLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayMemberLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPatch : VPNGatewayPatch struct +type VPNGatewayPatch struct { + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVPNGatewayPatch unmarshals an instance of VPNGatewayPatch from the specified map of raw messages. +func UnmarshalVPNGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VPNGatewayPrototype : VPNGatewayPrototype struct +// Models which "extend" this model: +// - VPNGatewayPrototypeVPNGatewayRouteModePrototype +// - VPNGatewayPrototypeVPNGatewayPolicyModePrototype +type VPNGatewayPrototype struct { + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. 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"` + + // Identifies a subnet by a unique property. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototype.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayPrototypeModeRouteConst = "route" +) + +func (*VPNGatewayPrototype) isaVPNGatewayPrototype() bool { + return true +} + +type VPNGatewayPrototypeIntf interface { + isaVPNGatewayPrototype() bool +} + +// UnmarshalVPNGatewayPrototype unmarshals an instance of VPNGatewayPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPNGatewayReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPNGatewayReferenceDeleted unmarshals an instance of VPNGatewayReferenceDeleted from the specified map of raw messages. +func UnmarshalVPNGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServer : VPNServer struct +type VPNServer struct { + // The certificate instance for this VPN server. + Certificate *CertificateInstanceReference `json:"certificate" validate:"required"` + + // The methods used to authenticate VPN clients to this VPN server. VPN clients must authenticate against all specified + // methods. + ClientAuthentication []VPNServerAuthenticationIntf `json:"client_authentication" validate:"required"` + + // Indicates whether disconnected VPN clients will be automatically deleted after + // `client_auto_delete_timeout` hours have passed. At present, this is always `true`, but may be modifiable in the + // future. + ClientAutoDelete *bool `json:"client_auto_delete" validate:"required"` + + // If `client_auto_delete` is `true`, the hours after which disconnected VPN clients will be automatically deleted. If + // the value is `0`, disconnected VPN clients will be deleted immediately. This value may be modifiable in the future. + ClientAutoDeleteTimeout *int64 `json:"client_auto_delete_timeout" validate:"required"` + + // The DNS server addresses that will be provided to VPN clients that are connected to this VPN server. + ClientDnsServerIps []IP `json:"client_dns_server_ips" validate:"required"` + + // The seconds a VPN client can be idle before this VPN server will disconnect it. If `0`, the server will not + // disconnect idle clients. + ClientIdleTimeout *int64 `json:"client_idle_timeout" validate:"required"` + + // The VPN client IPv4 address pool, expressed in CIDR format. + ClientIPPool *string `json:"client_ip_pool" validate:"required"` + + // The date and time that the VPN server was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + + // Indicates whether the split tunneling is enabled on this VPN server. + EnableSplitTunneling *bool `json:"enable_split_tunneling" validate:"required"` + + // The reasons for the current VPN server health_state (if any): + // - `cannot_access_client_certificate`: VPN server's client certificate is inaccessible + // (verify certificate exists and that IAM policies grant `VPN server for VPC` access + // to `Secrets Manager`) + // - `cannot_access_server_certificate`: VPN server's server certificate is inaccessible + // (verify certificate exists and that IAM policies grant `VPN server for VPC` access + // to `Secrets Manager`) + // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (contact IBM support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPNServerHealthReason `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"` + + // Fully qualified domain name assigned to this VPN server. + Hostname *string `json:"hostname" validate:"required"` + + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` + + // The reasons for the current VPN server lifecycle_state (if any): + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []VPNServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the VPN server. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this VPN server. The name is unique across all VPN servers in the VPC. + Name *string `json:"name" validate:"required"` + + // The port number used by this VPN server. + Port *int64 `json:"port" validate:"required"` + + // The reserved IPs bound to this VPN server. + PrivateIps []ReservedIPReference `json:"private_ips" validate:"required"` + + // The transport protocol used by this VPN server. + Protocol *string `json:"protocol" validate:"required"` + + // The resource group for this VPN server. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups targeting this VPN server. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The subnets this VPN server is provisioned in. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The VPC this VPN server resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the VPNServer.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 ( + VPNServerHealthStateDegradedConst = "degraded" + VPNServerHealthStateFaultedConst = "faulted" + VPNServerHealthStateInapplicableConst = "inapplicable" + VPNServerHealthStateOkConst = "ok" +) + +// Constants associated with the VPNServer.LifecycleState property. +// The lifecycle state of the VPN server. +const ( + VPNServerLifecycleStateDeletingConst = "deleting" + VPNServerLifecycleStateFailedConst = "failed" + VPNServerLifecycleStatePendingConst = "pending" + VPNServerLifecycleStateStableConst = "stable" + VPNServerLifecycleStateSuspendedConst = "suspended" + VPNServerLifecycleStateUpdatingConst = "updating" + VPNServerLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNServer.Protocol property. +// The transport protocol used by this VPN server. +const ( + VPNServerProtocolTCPConst = "tcp" + VPNServerProtocolUDPConst = "udp" +) + +// Constants associated with the VPNServer.ResourceType property. +// The resource type. +const ( + VPNServerResourceTypeVPNServerConst = "vpn_server" +) + +// UnmarshalVPNServer unmarshals an instance of VPNServer from the specified map of raw messages. +func UnmarshalVPNServer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServer) + err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthentication) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_auto_delete", &obj.ClientAutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_auto_delete_timeout", &obj.ClientAutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNServerHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNServerLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthentication : An authentication method for this VPN server. +// Models which "extend" this model: +// - VPNServerAuthenticationByUsername +// - VPNServerAuthenticationByCertificate +type VPNServerAuthentication struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider,omitempty"` + + // The certificate instance used for the VPN client certificate authority (CA). + ClientCa *CertificateInstanceReference `json:"client_ca,omitempty"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` +} + +// Constants associated with the VPNServerAuthentication.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationMethodCertificateConst = "certificate" + VPNServerAuthenticationMethodUsernameConst = "username" +) + +func (*VPNServerAuthentication) isaVPNServerAuthentication() bool { + return true +} + +type VPNServerAuthenticationIntf interface { + isaVPNServerAuthentication() bool +} + +// UnmarshalVPNServerAuthentication unmarshals an instance of VPNServerAuthentication from the specified map of raw messages. +func UnmarshalVPNServerAuthentication(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthentication) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationByUsernameIDProvider : The type of identity provider to be used by VPN client. +// Models which "extend" this model: +// - VPNServerAuthenticationByUsernameIDProviderByIam +type VPNServerAuthenticationByUsernameIDProvider struct { + // The type of identity provider to be used by the VPN client. + // - `iam`: IBM identity and access management + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + ProviderType *string `json:"provider_type,omitempty"` +} + +// Constants associated with the VPNServerAuthenticationByUsernameIDProvider.ProviderType property. +// The type of identity provider to be used by the VPN client. +// - `iam`: IBM identity and access management +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +const ( + VPNServerAuthenticationByUsernameIDProviderProviderTypeIamConst = "iam" +) + +func (*VPNServerAuthenticationByUsernameIDProvider) isaVPNServerAuthenticationByUsernameIDProvider() bool { + return true +} + +type VPNServerAuthenticationByUsernameIDProviderIntf interface { + isaVPNServerAuthenticationByUsernameIDProvider() bool +} + +// UnmarshalVPNServerAuthenticationByUsernameIDProvider unmarshals an instance of VPNServerAuthenticationByUsernameIDProvider from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByUsernameIDProvider(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByUsernameIDProvider) + err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationPrototype : An authentication method for this VPN server. +// Models which "extend" this model: +// - VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype +// - VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype +type VPNServerAuthenticationPrototype struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider,omitempty"` + + // The certificate instance to use for the VPN client certificate authority (CA). + ClientCa CertificateInstanceIdentityIntf `json:"client_ca,omitempty"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` +} + +// Constants associated with the VPNServerAuthenticationPrototype.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationPrototypeMethodCertificateConst = "certificate" + VPNServerAuthenticationPrototypeMethodUsernameConst = "username" +) + +func (*VPNServerAuthenticationPrototype) isaVPNServerAuthenticationPrototype() bool { + return true +} + +type VPNServerAuthenticationPrototypeIntf interface { + isaVPNServerAuthenticationPrototype() bool +} + +// UnmarshalVPNServerAuthenticationPrototype unmarshals an instance of VPNServerAuthenticationPrototype from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "method", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'method': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'method' not found in JSON object") + return + } + if discValue == "certificate" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) + } else if discValue == "username" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'method': %s", discValue) + } + return +} + +// VPNServerClient : VPNServerClient struct +type VPNServerClient struct { + // The IP address assigned to this VPN client from `client_ip_pool`. + ClientIP *IP `json:"client_ip" validate:"required"` + + // The common name of client certificate that the VPN client provided when connecting to the server. + // + // This property will be present only when the `certificate` client authentication method is enabled on the VPN server. + CommonName *string `json:"common_name,omitempty"` + + // The date and time that the VPN client was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The date and time that the VPN client was disconnected. + // + // This property will be present only when the client `status` is `disconnected`. + DisconnectedAt *strfmt.DateTime `json:"disconnected_at,omitempty"` + + // The URL for this VPN client. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN client. + ID *string `json:"id" validate:"required"` + + // The remote IP address of this VPN client. + RemoteIP *IP `json:"remote_ip" validate:"required"` + + // The remote port of this VPN client. + RemotePort *int64 `json:"remote_port" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the VPN client: + // - `connected`: the VPN client is `connected` to this VPN server. + // - `disconnected`: the VPN client is `disconnected` from this VPN server. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN client on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + + // The username that this VPN client provided when connecting to the VPN server. + // + // This property will be present only when the `username` client authentication method is enabled on the VPN server. + Username *string `json:"username,omitempty"` +} + +// Constants associated with the VPNServerClient.ResourceType property. +// The resource type. +const ( + VPNServerClientResourceTypeVPNServerClientConst = "vpn_server_client" +) + +// Constants associated with the VPNServerClient.Status property. +// The status of the VPN client: +// - `connected`: the VPN client is `connected` to this VPN server. +// - `disconnected`: the VPN client is `disconnected` from this VPN server. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN client on which the +// unexpected property value was encountered. +const ( + VPNServerClientStatusConnectedConst = "connected" + VPNServerClientStatusDisconnectedConst = "disconnected" +) + +// UnmarshalVPNServerClient unmarshals an instance of VPNServerClient from the specified map of raw messages. +func UnmarshalVPNServerClient(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerClient) + err = core.UnmarshalModel(m, "client_ip", &obj.ClientIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "common_name", &obj.CommonName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "disconnected_at", &obj.DisconnectedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote_ip", &obj.RemoteIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "remote_port", &obj.RemotePort) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "username", &obj.Username) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerClientCollection : VPNServerClientCollection struct +type VPNServerClientCollection struct { + // Collection of VPN clients. + Clients []VPNServerClient `json:"clients" validate:"required"` + + // A link to the first page of resources. + First *VPNServerClientCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalVPNServerClientCollection unmarshals an instance of VPNServerClientCollection from the specified map of raw messages. +func UnmarshalVPNServerClientCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerClientCollection) + err = core.UnmarshalModel(m, "clients", &obj.Clients, UnmarshalVPNServerClient) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerClientCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerClientCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *VPNServerClientCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + 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"` + + // 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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of VPN servers. + VPNServers []VPNServer `json:"vpn_servers" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpn_servers", &obj.VPNServers, UnmarshalVPNServer) + if err != nil { + 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 *VPNServerCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerHealthReason : VPNServerHealthReason struct +type VPNServerHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the VPNServerHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + VPNServerHealthReasonCodeCannotAccessClientCertificateConst = "cannot_access_client_certificate" + VPNServerHealthReasonCodeCannotAccessServerCertificateConst = "cannot_access_server_certificate" + VPNServerHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route" + VPNServerHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" + VPNServerHealthReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalVPNServerHealthReason unmarshals an instance of VPNServerHealthReason from the specified map of raw messages. +func UnmarshalVPNServerHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerLifecycleReason : VPNServerLifecycleReason struct +type VPNServerLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 VPNServerLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + VPNServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalVPNServerLifecycleReason unmarshals an instance of VPNServerLifecycleReason from the specified map of raw messages. +func UnmarshalVPNServerLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerPatch : VPNServerPatch struct +type VPNServerPatch struct { + // The certificate instance for this VPN server. + Certificate CertificateInstanceIdentityIntf `json:"certificate,omitempty"` + + // The authentication methods to use to authenticate VPN client on this VPN server + // (replacing any existing methods). + ClientAuthentication []VPNServerAuthenticationPrototypeIntf `json:"client_authentication,omitempty"` + + // The DNS server addresses that will be provided to VPN clients connected to this VPN server (replacing any existing + // addresses). + ClientDnsServerIps []IP `json:"client_dns_server_ips,omitempty"` + + // The seconds a VPN client can be idle before this VPN server will disconnect it. If `0`, the server will not + // disconnect idle clients. + ClientIdleTimeout *int64 `json:"client_idle_timeout,omitempty"` + + // The VPN client IPv4 address pool, expressed in CIDR format. The request must not overlap with any existing address + // prefixes in the VPC or any of the following reserved address ranges: + // - `127.0.0.0/8` (IPv4 loopback addresses) + // - `161.26.0.0/16` (IBM services) + // - `166.8.0.0/14` (Cloud Service Endpoints) + // - `169.254.0.0/16` (IPv4 link-local addresses) + // - `224.0.0.0/4` (IPv4 multicast addresses) + // + // The prefix length of the client IP address pool's CIDR must be between + // `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that contains twice the number of IP addresses + // that are required to enable the maximum number of concurrent connections is recommended. + ClientIPPool *string `json:"client_ip_pool,omitempty"` + + // Indicates whether the split tunneling is enabled on this VPN server. + EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"` + + // The name for this VPN server. The name must not be used by another VPN server in the VPC. + Name *string `json:"name,omitempty"` + + // The port number used by this VPN server. + Port *int64 `json:"port,omitempty"` + + // The transport protocol used by this VPN server. + Protocol *string `json:"protocol,omitempty"` + + // The subnets to provision this VPN server in (replacing the existing subnets). + Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` +} + +// Constants associated with the VPNServerPatch.Protocol property. +// The transport protocol used by this VPN server. +const ( + VPNServerPatchProtocolTCPConst = "tcp" + VPNServerPatchProtocolUDPConst = "udp" +) + +// UnmarshalVPNServerPatch unmarshals an instance of VPNServerPatch from the specified map of raw messages. +func UnmarshalVPNServerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerPatch) + err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthenticationPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VPNServerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VPNServerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPNServerReferenceDeleted unmarshals an instance of VPNServerReferenceDeleted from the specified map of raw messages. +func UnmarshalVPNServerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerRoute : VPNServerRoute struct +type VPNServerRoute struct { + // The action to perform with a packet matching the VPN route: + // - `translate`: translate the source IP address to one of the private IP addresses of the VPN server. + // - `deliver`: deliver the packet into the VPC. + // - `drop`: drop the packet + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the + // unexpected property value was encountered. + Action *string `json:"action" validate:"required"` + + // The date and time that the VPN route was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination for this VPN route in the VPN server. If an incoming packet does not match any destination, it will + // be dropped. + Destination *string `json:"destination" validate:"required"` + + // The reasons for the current VPN server route health_state (if any): + // - `internal_error`: Internal error (contact IBM support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPNServerRouteHealthReason `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 VPN route. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN route. + ID *string `json:"id" validate:"required"` + + // The reasons for the current VPN server route lifecycle_state (if any): + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []VPNServerRouteLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the VPN route. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name for this VPN route. The name is unique across all routes for a VPN server. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPNServerRoute.Action property. +// The action to perform with a packet matching the VPN route: +// - `translate`: translate the source IP address to one of the private IP addresses of the VPN server. +// - `deliver`: deliver the packet into the VPC. +// - `drop`: drop the packet +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the +// unexpected property value was encountered. +const ( + VPNServerRouteActionDeliverConst = "deliver" + VPNServerRouteActionDropConst = "drop" + VPNServerRouteActionTranslateConst = "translate" +) + +// Constants associated with the VPNServerRoute.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 ( + VPNServerRouteHealthStateDegradedConst = "degraded" + VPNServerRouteHealthStateFaultedConst = "faulted" + VPNServerRouteHealthStateInapplicableConst = "inapplicable" + VPNServerRouteHealthStateOkConst = "ok" +) + +// Constants associated with the VPNServerRoute.LifecycleState property. +// The lifecycle state of the VPN route. +const ( + VPNServerRouteLifecycleStateDeletingConst = "deleting" + VPNServerRouteLifecycleStateFailedConst = "failed" + VPNServerRouteLifecycleStatePendingConst = "pending" + VPNServerRouteLifecycleStateStableConst = "stable" + VPNServerRouteLifecycleStateSuspendedConst = "suspended" + VPNServerRouteLifecycleStateUpdatingConst = "updating" + VPNServerRouteLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNServerRoute.ResourceType property. +// The resource type. +const ( + VPNServerRouteResourceTypeVPNServerRouteConst = "vpn_server_route" +) + +// UnmarshalVPNServerRoute unmarshals an instance of VPNServerRoute from the specified map of raw messages. +func UnmarshalVPNServerRoute(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRoute) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNServerRouteHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNServerRouteLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerRouteCollection : VPNServerRouteCollection struct +type VPNServerRouteCollection struct { + // A link to the first page of resources. + First *VPNServerRouteCollectionFirst `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"` + + // Collection of VPN routes. + Routes []VPNServerRoute `json:"routes" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerRouteCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalVPNServerRoute) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *VPNServerRouteCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerRouteHealthReason : VPNServerRouteHealthReason struct +type VPNServerRouteHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the VPNServerRouteHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + VPNServerRouteHealthReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalVPNServerRouteHealthReason unmarshals an instance of VPNServerRouteHealthReason from the specified map of raw messages. +func UnmarshalVPNServerRouteHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRouteHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerRouteLifecycleReason : VPNServerRouteLifecycleReason struct +type VPNServerRouteLifecycleReason struct { + // A snake case string succinctly identifying the reason for this lifecycle state. + 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 VPNServerRouteLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + VPNServerRouteLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalVPNServerRouteLifecycleReason unmarshals an instance of VPNServerRouteLifecycleReason from the specified map of raw messages. +func UnmarshalVPNServerRouteLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRouteLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerRoutePatch : VPNServerRoutePatch struct +type VPNServerRoutePatch struct { + // The name for this VPN server route. The name must not be used by another route for the VPN server. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVPNServerRoutePatch unmarshals an instance of VPNServerRoutePatch from the specified map of raw messages. +func UnmarshalVPNServerRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRoutePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VirtualNetworkInterface : VirtualNetworkInterface struct +type VirtualNetworkInterface 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" validate:"required"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // The date and time that the virtual network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this virtual network interface. + CRN *string `json:"crn" 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 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" validate:"required"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The reserved IPs bound to this virtual network interface. + // + // May be empty when `lifecycle_state` is `pending`. + Ips []ReservedIPReference `json:"ips" validate:"required"` + + // The lifecycle state of the virtual network interface. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The MAC address of the virtual network interface. May be absent if `lifecycle_state` is `pending`. + MacAddress *string `json:"mac_address,omitempty"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The reserved IP for this virtual network interface. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource group for this virtual network interface. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups for this virtual network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The target of this virtual network interface. + // + // If absent, this virtual network interface is not attached to a target. + Target VirtualNetworkInterfaceTargetIntf `json:"target,omitempty"` + + // The VPC this virtual network interface resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this virtual network interface resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the VirtualNetworkInterface.LifecycleState property. +// The lifecycle state of the virtual network interface. +const ( + VirtualNetworkInterfaceLifecycleStateDeletingConst = "deleting" + VirtualNetworkInterfaceLifecycleStateFailedConst = "failed" + VirtualNetworkInterfaceLifecycleStatePendingConst = "pending" + VirtualNetworkInterfaceLifecycleStateStableConst = "stable" + VirtualNetworkInterfaceLifecycleStateSuspendedConst = "suspended" + VirtualNetworkInterfaceLifecycleStateUpdatingConst = "updating" + VirtualNetworkInterfaceLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VirtualNetworkInterface.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +// UnmarshalVirtualNetworkInterface unmarshals an instance of VirtualNetworkInterface from the specified map of raw messages. +func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalVirtualNetworkInterfaceTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceCollection : VirtualNetworkInterfaceCollection struct +type VirtualNetworkInterfaceCollection struct { + // A link to the first page of resources. + First *VirtualNetworkInterfaceCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of virtual network interfaces. + VirtualNetworkInterfaces []VirtualNetworkInterface `json:"virtual_network_interfaces" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVirtualNetworkInterfaceCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interfaces", &obj.VirtualNetworkInterfaces, UnmarshalVirtualNetworkInterface) + if err != nil { + 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 *VirtualNetworkInterfaceCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceIPPrototype : VirtualNetworkInterfaceIPPrototype struct +// Models which "extend" this model: +// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +// - VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPPrototype struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` + + // 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*VirtualNetworkInterfaceIPPrototype) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +type VirtualNetworkInterfaceIPPrototypeIntf interface { + isaVirtualNetworkInterfaceIPPrototype() bool +} + +// UnmarshalVirtualNetworkInterfaceIPPrototype unmarshals an instance of VirtualNetworkInterfaceIPPrototype from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePatch : VirtualNetworkInterfacePatch struct +type VirtualNetworkInterfacePatch struct { + // Indicates whether source IP spoofing is allowed on this interface. + // + // Must be `false` if `target` is a file share mount target. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. Must be `false` if the virtual network interface is unbound. + AutoDelete *bool `json:"auto_delete,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"` + + // The name for this virtual network interface. The name must not be used by another virtual network interface in the + // region. Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVirtualNetworkInterfacePatch unmarshals an instance of VirtualNetworkInterfacePatch from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VirtualNetworkInterfacePrimaryIPPrototype : VirtualNetworkInterfacePrimaryIPPrototype struct +// Models which "extend" this model: +// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext +// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext +type VirtualNetworkInterfacePrimaryIPPrototype struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` + + // 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*VirtualNetworkInterfacePrimaryIPPrototype) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +type VirtualNetworkInterfacePrimaryIPPrototypeIntf interface { + isaVirtualNetworkInterfacePrimaryIPPrototype() bool +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototype unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototype from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceReferenceAttachmentContext : VirtualNetworkInterfaceReferenceAttachmentContext struct +type VirtualNetworkInterfaceReferenceAttachmentContext struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VirtualNetworkInterfaceReferenceAttachmentContext.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceReferenceAttachmentContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +// UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext unmarshals an instance of VirtualNetworkInterfaceReferenceAttachmentContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceReferenceAttachmentContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VirtualNetworkInterfaceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVirtualNetworkInterfaceReferenceDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceDeleted from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceTarget : A virtual network interface target. +// +// The resource types that can be virtual network interface targets are expected to expand in the future. When iterating +// over virtual network interface targets, do not assume that every target resource will be from a known set of resource +// types. Optionally halt processing and surface an error, or bypass resources of unrecognized types. +// Models which "extend" this model: +// - VirtualNetworkInterfaceTargetShareMountTargetReference +// - VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext +// - VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext +type VirtualNetworkInterfaceTarget struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this share mount target. + Href *string `json:"href,omitempty"` + + // The unique identifier for this share mount target. + ID *string `json:"id,omitempty"` + + // The name for this share mount target. The name is unique across all mount targets for the file share. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the VirtualNetworkInterfaceTarget.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceTargetResourceTypeShareMountTargetConst = "share_mount_target" +) + +func (*VirtualNetworkInterfaceTarget) isaVirtualNetworkInterfaceTarget() bool { + return true +} + +type VirtualNetworkInterfaceTargetIntf interface { + isaVirtualNetworkInterfaceTarget() bool +} + +// UnmarshalVirtualNetworkInterfaceTarget unmarshals an instance of VirtualNetworkInterfaceTarget from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Volume : Volume struct +type Volume struct { + // Indicates whether a running virtual server instance has an attachment to this volume. + Active *bool `json:"active" validate:"required"` + + // The attachment state of the volume + // - `unattached`: Not attached to any virtual server instances + // - `attached`: Attached to a virtual server instance (even if the instance is stopped) + // - `unusable`: Not able to be attached to any virtual server instances. + AttachmentState *string `json:"attachment_state" validate:"required"` + + // The maximum bandwidth (in megabits per second) for the volume. + Bandwidth *int64 `json:"bandwidth" validate:"required"` + + // Indicates whether this volume is performing an operation that must be serialized. This must be `false` to perform an + // operation that is specified to require serialization. + Busy *bool `json:"busy" validate:"required"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity" validate:"required"` + + // The date and time that the volume was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` + + // The type of encryption used on the volume. + Encryption *string `json:"encryption" validate:"required"` + + // The root key used to wrap the data encryption key for the volume. + // + // This property will be present for volumes with an `encryption` type of + // `user_managed`. + EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` + + // The reasons for the current `health_state` (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VolumeHealthReason `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 volume. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` + + // The maximum I/O operations per second (IOPS) for this volume. + Iops *int64 `json:"iops" validate:"required"` + + // The name for this volume. The name is unique across all volumes in the region. + Name *string `json:"name" validate:"required"` + + // The operating system associated with this volume. If absent, this volume was not + // created from an image, or the image did not include an operating system. + OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) for + // this volume. + Profile *VolumeProfileReference `json:"profile" validate:"required"` + + // The resource group for this volume. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The image from which this volume was created (this may be + // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). + // If absent, this volume was not created from an image. + SourceImage *ImageReference `json:"source_image,omitempty"` + + // The snapshot from which this volume was cloned. + SourceSnapshot *SnapshotReference `json:"source_snapshot,omitempty"` + + // The status of the volume. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the volume on which the unexpected + // property value was encountered. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []VolumeStatusReason `json:"status_reasons" validate:"required"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags" validate:"required"` + + // The volume attachments for this volume. + VolumeAttachments []VolumeAttachmentReferenceVolumeContext `json:"volume_attachments" validate:"required"` + + // The zone this volume resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Volume.AttachmentState property. +// The attachment state of the volume +// - `unattached`: Not attached to any virtual server instances +// - `attached`: Attached to a virtual server instance (even if the instance is stopped) +// - `unusable`: Not able to be attached to any virtual server instances. +const ( + VolumeAttachmentStateAttachedConst = "attached" + VolumeAttachmentStateUnattachedConst = "unattached" + VolumeAttachmentStateUnusableConst = "unusable" +) + +// Constants associated with the Volume.Encryption property. +// The type of encryption used on the volume. +const ( + VolumeEncryptionProviderManagedConst = "provider_managed" + VolumeEncryptionUserManagedConst = "user_managed" +) + +// Constants associated with the Volume.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 ( + VolumeHealthStateDegradedConst = "degraded" + VolumeHealthStateFaultedConst = "faulted" + VolumeHealthStateInapplicableConst = "inapplicable" + VolumeHealthStateOkConst = "ok" +) + +// Constants associated with the Volume.ResourceType property. +// The resource type. +const ( + VolumeResourceTypeVolumeConst = "volume" +) + +// Constants associated with the Volume.Status property. +// The status of the volume. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the volume on which the unexpected +// property value was encountered. +const ( + VolumeStatusAvailableConst = "available" + VolumeStatusFailedConst = "failed" + VolumeStatusPendingConst = "pending" + VolumeStatusPendingDeletionConst = "pending_deletion" + VolumeStatusUnusableConst = "unusable" + VolumeStatusUpdatingConst = "updating" +) + +// UnmarshalVolume unmarshals an instance of Volume from the specified map of raw messages. +func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Volume) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "attachment_state", &obj.AttachmentState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "busy", &obj.Busy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVolumeHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_image", &obj.SourceImage, UnmarshalImageReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVolumeStatusReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachment : VolumeAttachment struct +type VolumeAttachment struct { + // The maximum bandwidth (in megabits per second) for the volume when attached to this instance. This may be lower than + // the volume bandwidth depending on the configuration of the instance. + Bandwidth *int64 `json:"bandwidth" validate:"required"` + + // The date and time that the volume was attached. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete" validate:"required"` + + // Information about how the volume is exposed to the instance operating system. + // + // This property may be absent if the volume attachment's `status` is not `attached`. + Device *VolumeAttachmentDevice `json:"device,omitempty"` + + // The URL for this volume attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume attachment. + ID *string `json:"id" validate:"required"` + + // The name for this volume attachment. The name is unique across all volume attachments on the instance. + Name *string `json:"name" validate:"required"` + + // The status of this volume attachment. + Status *string `json:"status" validate:"required"` + + // The type of volume attachment. + Type *string `json:"type" validate:"required"` + + // The attached volume. + // + // This property will be absent if the volume has not yet been provisioned. + Volume *VolumeReferenceVolumeAttachmentContext `json:"volume,omitempty"` +} + +// Constants associated with the VolumeAttachment.Status property. +// The status of this volume attachment. +const ( + VolumeAttachmentStatusAttachedConst = "attached" + VolumeAttachmentStatusAttachingConst = "attaching" + VolumeAttachmentStatusDeletingConst = "deleting" + VolumeAttachmentStatusDetachingConst = "detaching" +) + +// Constants associated with the VolumeAttachment.Type property. +// The type of volume attachment. +const ( + VolumeAttachmentTypeBootConst = "boot" + VolumeAttachmentTypeDataConst = "data" +) + +// UnmarshalVolumeAttachment unmarshals an instance of VolumeAttachment from the specified map of raw messages. +func UnmarshalVolumeAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachment) + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReferenceVolumeAttachmentContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentCollection : VolumeAttachmentCollection struct +type VolumeAttachmentCollection struct { + // Collection of volume attachments. + VolumeAttachments []VolumeAttachment `json:"volume_attachments" validate:"required"` +} + +// UnmarshalVolumeAttachmentCollection unmarshals an instance of VolumeAttachmentCollection from the specified map of raw messages. +func UnmarshalVolumeAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentCollection) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachment) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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"` +} + +// UnmarshalVolumeAttachmentDevice unmarshals an instance of VolumeAttachmentDevice from the specified map of raw messages. +func UnmarshalVolumeAttachmentDevice(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentDevice) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPatch : VolumeAttachmentPatch struct +type VolumeAttachmentPatch struct { + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVolumeAttachmentPatch unmarshals an instance of VolumeAttachmentPatch from the specified map of raw messages. +func UnmarshalVolumeAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPatch) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VolumeAttachmentPrototype : VolumeAttachmentPrototype struct +type VolumeAttachmentPrototype struct { + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // An existing volume to attach to the instance, or a prototype object for a new volume. + Volume VolumeAttachmentPrototypeVolumeIntf `json:"volume" validate:"required"` +} + +// NewVolumeAttachmentPrototype : Instantiate VolumeAttachmentPrototype (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototype(volume VolumeAttachmentPrototypeVolumeIntf) (_model *VolumeAttachmentPrototype, err error) { + _model = &VolumeAttachmentPrototype{ + Volume: volume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumeAttachmentPrototype unmarshals an instance of VolumeAttachmentPrototype from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototype) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeAttachmentPrototypeVolume) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeInstanceByImageContext : VolumeAttachmentPrototypeInstanceByImageContext struct +type VolumeAttachmentPrototypeInstanceByImageContext struct { + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // A prototype object for a new volume. + Volume *VolumePrototypeInstanceByImageContext `json:"volume" validate:"required"` +} + +// NewVolumeAttachmentPrototypeInstanceByImageContext : Instantiate VolumeAttachmentPrototypeInstanceByImageContext (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByImageContext(volume *VolumePrototypeInstanceByImageContext) (_model *VolumeAttachmentPrototypeInstanceByImageContext, err error) { + _model = &VolumeAttachmentPrototypeInstanceByImageContext{ + Volume: volume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumeAttachmentPrototypeInstanceByImageContext unmarshals an instance of VolumeAttachmentPrototypeInstanceByImageContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeInstanceByImageContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeInstanceByImageContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceByImageContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeInstanceBySourceSnapshotContext : VolumeAttachmentPrototypeInstanceBySourceSnapshotContext struct +type VolumeAttachmentPrototypeInstanceBySourceSnapshotContext struct { + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // A prototype object for a new volume from a snapshot. + Volume *VolumePrototypeInstanceBySourceSnapshotContext `json:"volume" validate:"required"` +} + +// NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext : Instantiate VolumeAttachmentPrototypeInstanceBySourceSnapshotContext (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(volume *VolumePrototypeInstanceBySourceSnapshotContext) (_model *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, err error) { + _model = &VolumeAttachmentPrototypeInstanceBySourceSnapshotContext{ + Volume: volume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext unmarshals an instance of VolumeAttachmentPrototypeInstanceBySourceSnapshotContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeInstanceByVolumeContext : VolumeAttachmentPrototypeInstanceByVolumeContext struct +type VolumeAttachmentPrototypeInstanceByVolumeContext struct { + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // An existing volume to attach. + Volume VolumeIdentityIntf `json:"volume" validate:"required"` +} + +// NewVolumeAttachmentPrototypeInstanceByVolumeContext : Instantiate VolumeAttachmentPrototypeInstanceByVolumeContext (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByVolumeContext(volume VolumeIdentityIntf) (_model *VolumeAttachmentPrototypeInstanceByVolumeContext, err error) { + _model = &VolumeAttachmentPrototypeInstanceByVolumeContext{ + Volume: volume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext unmarshals an instance of VolumeAttachmentPrototypeInstanceByVolumeContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeInstanceByVolumeContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolume : An existing volume to attach to the instance, or a prototype object for a new volume. +// Models which "extend" this model: +// - VolumeAttachmentPrototypeVolumeVolumeIdentity +// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext +type VolumeAttachmentPrototypeVolume struct { + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group to use for this volume. If unspecified, the instance's resource + // group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` +} + +func (*VolumeAttachmentPrototypeVolume) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +type VolumeAttachmentPrototypeVolumeIntf interface { + isaVolumeAttachmentPrototypeVolume() bool +} + +// UnmarshalVolumeAttachmentPrototypeVolume unmarshals an instance of VolumeAttachmentPrototypeVolume from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolume) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceInstanceContext : VolumeAttachmentReferenceInstanceContext struct +type VolumeAttachmentReferenceInstanceContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeAttachmentReferenceInstanceContextDeleted `json:"deleted,omitempty"` + + // Information about how the volume is exposed to the instance operating system. + // + // This property may be absent if the volume attachment's `status` is not `attached`. + Device *VolumeAttachmentDevice `json:"device,omitempty"` + + // The URL for this volume attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume attachment. + ID *string `json:"id" validate:"required"` + + // The name for this volume attachment. The name is unique across all volume attachments on the instance. + Name *string `json:"name" validate:"required"` + + // The attached volume. + // + // This property will be absent if the volume has not yet been provisioned. + Volume *VolumeReferenceVolumeAttachmentContext `json:"volume,omitempty"` +} + +// UnmarshalVolumeAttachmentReferenceInstanceContext unmarshals an instance of VolumeAttachmentReferenceInstanceContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceInstanceContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceInstanceContextDeleted) + if err != nil { + return + } + err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReferenceVolumeAttachmentContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceInstanceContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VolumeAttachmentReferenceInstanceContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeAttachmentReferenceInstanceContextDeleted unmarshals an instance of VolumeAttachmentReferenceInstanceContextDeleted from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceInstanceContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceInstanceContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceVolumeContext : VolumeAttachmentReferenceVolumeContext struct +type VolumeAttachmentReferenceVolumeContext struct { + // Indicates whether deleting the instance will also delete the attached volume. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeAttachmentReferenceVolumeContextDeleted `json:"deleted,omitempty"` + + // Information about how the volume is exposed to the instance operating system. + // + // This property may be absent if the volume attachment's `status` is not `attached`. + Device *VolumeAttachmentDevice `json:"device,omitempty"` + + // The URL for this volume attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume attachment. + ID *string `json:"id" validate:"required"` + + // The attached instance. + Instance *InstanceReference `json:"instance" validate:"required"` + + // The name for this volume attachment. The name is unique across all volume attachments on the instance. + Name *string `json:"name" validate:"required"` + + // The type of volume attachment. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VolumeAttachmentReferenceVolumeContext.Type property. +// The type of volume attachment. +const ( + VolumeAttachmentReferenceVolumeContextTypeBootConst = "boot" + VolumeAttachmentReferenceVolumeContextTypeDataConst = "data" +) + +// UnmarshalVolumeAttachmentReferenceVolumeContext unmarshals an instance of VolumeAttachmentReferenceVolumeContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceVolumeContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceVolumeContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceVolumeContextDeleted) + if err != nil { + return + } + err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceVolumeContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VolumeAttachmentReferenceVolumeContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeAttachmentReferenceVolumeContextDeleted unmarshals an instance of VolumeAttachmentReferenceVolumeContextDeleted from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceVolumeContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceVolumeContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeCollection : VolumeCollection struct +type VolumeCollection struct { + // A link to the first page of resources. + First *VolumeCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of volumes. + Volumes []Volume `json:"volumes" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVolumeCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volumes", &obj.Volumes, UnmarshalVolume) + if err != nil { + 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 *VolumeCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeHealthReason : VolumeHealthReason struct +type VolumeHealthReason struct { + // A snake case string succinctly identifying the reason 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"` +} + +// Constants associated with the VolumeHealthReason.Code property. +// A snake case string succinctly identifying the reason for this health state. +const ( + VolumeHealthReasonCodeInitializingFromSnapshotConst = "initializing_from_snapshot" +) + +// UnmarshalVolumeHealthReason unmarshals an instance of VolumeHealthReason from the specified map of raw messages. +func UnmarshalVolumeHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentity : Identifies a volume by a unique property. +// Models which "extend" this model: +// - VolumeIdentityByID +// - VolumeIdentityByCRN +// - VolumeIdentityByHref +type VolumeIdentity struct { + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` +} + +func (*VolumeIdentity) isaVolumeIdentity() bool { + return true +} + +type VolumeIdentityIntf interface { + isaVolumeIdentity() bool +} + +// UnmarshalVolumeIdentity unmarshals an instance of VolumeIdentity from the specified map of raw messages. +func UnmarshalVolumeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePatch : VolumePatch struct +type VolumePatch struct { + // The capacity to use for the volume (in gigabytes). The volume must be attached to a running virtual server instance, + // and the specified value must not be less than the current capacity. Additionally, if the volume is attached as a + // boot volume, the maximum value is 250 gigabytes. + // + // The minimum and maximum capacity limits for creating or updating volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. The volume must be attached as a data volume to a running virtual server instance. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. The requested profile must be in the same + // `family` as the current profile. The volume must be attached as a data volume to + // a running virtual server instance, and must have a `capacity` within the range + // supported by the specified profile. + Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` +} + +// UnmarshalVolumePatch unmarshals an instance of VolumePatch from the specified map of raw messages. +func UnmarshalVolumePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePatch) + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + return +} + +// VolumeProfile : VolumeProfile struct +type VolumeProfile struct { + // The product family this volume profile belongs to. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the volume profile on which the + // unexpected property value was encountered. + Family *string `json:"family" validate:"required"` + + // The URL for this volume profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this volume profile. + Name *string `json:"name" validate:"required"` +} + +// Constants associated with the VolumeProfile.Family property. +// The product family this volume profile belongs to. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the volume profile on which the +// unexpected property value was encountered. +const ( + VolumeProfileFamilyCustomConst = "custom" + VolumeProfileFamilyTieredConst = "tiered" +) + +// UnmarshalVolumeProfile unmarshals an instance of VolumeProfile from the specified map of raw messages. +func UnmarshalVolumeProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfile) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileCollection : VolumeProfileCollection struct +type VolumeProfileCollection struct { + // A link to the first page of resources. + First *VolumeProfileCollectionFirst `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"` + + // Collection of volume profiles. + Profiles []VolumeProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVolumeProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalVolumeProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + 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 *VolumeProfileCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileIdentity : Identifies a volume profile by a unique property. +// Models which "extend" this model: +// - VolumeProfileIdentityByName +// - VolumeProfileIdentityByHref +type VolumeProfileIdentity struct { + // The globally unique name for this volume profile. + Name *string `json:"name,omitempty"` + + // The URL for this volume profile. + Href *string `json:"href,omitempty"` +} + +func (*VolumeProfileIdentity) isaVolumeProfileIdentity() bool { + return true +} + +type VolumeProfileIdentityIntf interface { + isaVolumeProfileIdentity() bool +} + +// UnmarshalVolumeProfileIdentity unmarshals an instance of VolumeProfileIdentity from the specified map of raw messages. +func UnmarshalVolumeProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileReference : VolumeProfileReference struct +type VolumeProfileReference struct { + // The URL for this volume profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this volume profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalVolumeProfileReference unmarshals an instance of VolumeProfileReference from the specified map of raw messages. +func UnmarshalVolumeProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototype : VolumePrototype struct +// Models which "extend" this model: +// - VolumePrototypeVolumeByCapacity +// - VolumePrototypeVolumeBySourceSnapshot +type VolumePrototype struct { + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. + Profile VolumeProfileIdentityIntf `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"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this volume will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` +} + +func (*VolumePrototype) isaVolumePrototype() bool { + return true +} + +type VolumePrototypeIntf interface { + isaVolumePrototype() bool +} + +// UnmarshalVolumePrototype unmarshals an instance of VolumePrototype from the specified map of raw messages. +func UnmarshalVolumePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototype) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototypeInstanceByImageContext : VolumePrototypeInstanceByImageContext struct +type VolumePrototypeInstanceByImageContext struct { + // The capacity to use for the volume (in gigabytes). Must be at least the image's + // `minimum_provisioned_size`. The maximum value may increase in the future. + // + // If unspecified, the capacity will be the image's `minimum_provisioned_size`. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use for this volume. If unspecified, the instance's resource + // group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` +} + +// NewVolumePrototypeInstanceByImageContext : Instantiate VolumePrototypeInstanceByImageContext (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeInstanceByImageContext(profile VolumeProfileIdentityIntf) (_model *VolumePrototypeInstanceByImageContext, err error) { + _model = &VolumePrototypeInstanceByImageContext{ + Profile: profile, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumePrototypeInstanceByImageContext unmarshals an instance of VolumePrototypeInstanceByImageContext from the specified map of raw messages. +func UnmarshalVolumePrototypeInstanceByImageContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeInstanceByImageContext) + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototypeInstanceBySourceSnapshotContext : VolumePrototypeInstanceBySourceSnapshotContext struct +type VolumePrototypeInstanceBySourceSnapshotContext struct { + // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's + // `minimum_capacity`. The maximum value may increase in the future. + // + // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use for this volume. If unspecified, the instance's resource + // group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` +} + +// NewVolumePrototypeInstanceBySourceSnapshotContext : Instantiate VolumePrototypeInstanceBySourceSnapshotContext (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeInstanceBySourceSnapshotContext(profile VolumeProfileIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumePrototypeInstanceBySourceSnapshotContext, err error) { + _model = &VolumePrototypeInstanceBySourceSnapshotContext{ + Profile: profile, + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalVolumePrototypeInstanceBySourceSnapshotContext unmarshals an instance of VolumePrototypeInstanceBySourceSnapshotContext from the specified map of raw messages. +func UnmarshalVolumePrototypeInstanceBySourceSnapshotContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeInstanceBySourceSnapshotContext) + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeReference : VolumeReference struct +type VolumeReference struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this volume. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` + + // The name for this volume. The name is unique across all volumes in the region. + 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 *VolumeRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VolumeReference.ResourceType property. +// The resource type. +const ( + VolumeReferenceResourceTypeVolumeConst = "volume" +) + +// UnmarshalVolumeReference unmarshals an instance of VolumeReference from the specified map of raw messages. +func UnmarshalVolumeReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VolumeReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeReferenceDeleted unmarshals an instance of VolumeReferenceDeleted from the specified map of raw messages. +func UnmarshalVolumeReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeReferenceVolumeAttachmentContext : VolumeReferenceVolumeAttachmentContext struct +type VolumeReferenceVolumeAttachmentContext struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeReferenceVolumeAttachmentContextDeleted `json:"deleted,omitempty"` + + // The URL for this volume. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` + + // The name for this volume. The name is unique across all volumes in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VolumeReferenceVolumeAttachmentContext.ResourceType property. +// The resource type. +const ( + VolumeReferenceVolumeAttachmentContextResourceTypeVolumeConst = "volume" +) + +// UnmarshalVolumeReferenceVolumeAttachmentContext unmarshals an instance of VolumeReferenceVolumeAttachmentContext from the specified map of raw messages. +func UnmarshalVolumeReferenceVolumeAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeReferenceVolumeAttachmentContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceVolumeAttachmentContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeReferenceVolumeAttachmentContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type VolumeReferenceVolumeAttachmentContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeReferenceVolumeAttachmentContextDeleted unmarshals an instance of VolumeReferenceVolumeAttachmentContextDeleted from the specified map of raw messages. +func UnmarshalVolumeReferenceVolumeAttachmentContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeReferenceVolumeAttachmentContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type VolumeRemote 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"` +} + +// UnmarshalVolumeRemote unmarshals an instance of VolumeRemote from the specified map of raw messages. +func UnmarshalVolumeRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeRemote) + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeStatusReason : VolumeStatusReason struct +type VolumeStatusReason struct { + // A snake case string succinctly identifying the status reason. + 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 VolumeStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + VolumeStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" +) + +// UnmarshalVolumeStatusReason unmarshals an instance of VolumeStatusReason from the specified map of raw messages. +func UnmarshalVolumeStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 { + 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 { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Zone : Zone struct +type Zone struct { + // The URL for this zone. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this zone. + Name *string `json:"name" validate:"required"` + + // The region this zone resides in. + Region *RegionReference `json:"region" validate:"required"` + + // The availability status of this zone. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the Zone.Status property. +// The availability status of this zone. +const ( + ZoneStatusAvailableConst = "available" + ZoneStatusImpairedConst = "impaired" + ZoneStatusUnavailableConst = "unavailable" +) + +// UnmarshalZone unmarshals an instance of Zone from the specified map of raw messages. +func UnmarshalZone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Zone) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneCollection : ZoneCollection struct +type ZoneCollection struct { + // Collection of zones. + Zones []Zone `json:"zones" validate:"required"` +} + +// UnmarshalZoneCollection unmarshals an instance of ZoneCollection from the specified map of raw messages. +func UnmarshalZoneCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneCollection) + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZone) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneIdentity : Identifies a zone by a unique property. +// Models which "extend" this model: +// - ZoneIdentityByName +// - ZoneIdentityByHref +type ZoneIdentity struct { + // The globally unique name for this zone. + Name *string `json:"name,omitempty"` + + // The URL for this zone. + Href *string `json:"href,omitempty"` +} + +func (*ZoneIdentity) isaZoneIdentity() bool { + return true +} + +type ZoneIdentityIntf interface { + isaZoneIdentity() bool +} + +// UnmarshalZoneIdentity unmarshals an instance of ZoneIdentity from the specified map of raw messages. +func UnmarshalZoneIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneReference : ZoneReference struct +type ZoneReference struct { + // The URL for this zone. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this zone. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalZoneReference unmarshals an instance of ZoneReference from the specified map of raw messages. +func UnmarshalZoneReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyJobSourceInstanceReference : BackupPolicyJobSourceInstanceReference struct +// This model "extends" BackupPolicyJobSource +type BackupPolicyJobSourceInstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. + Name *string `json:"name" validate:"required"` +} + +func (*BackupPolicyJobSourceInstanceReference) isaBackupPolicyJobSource() bool { + return true +} + +// UnmarshalBackupPolicyJobSourceInstanceReference unmarshals an instance of BackupPolicyJobSourceInstanceReference from the specified map of raw messages. +func UnmarshalBackupPolicyJobSourceInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobSourceInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyJobSourceVolumeReference : BackupPolicyJobSourceVolumeReference struct +// This model "extends" BackupPolicyJobSource +type BackupPolicyJobSourceVolumeReference struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this volume. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` + + // The name for this volume. The name is unique across all volumes in the region. + 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 *VolumeRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyJobSourceVolumeReference.ResourceType property. +// The resource type. +const ( + BackupPolicyJobSourceVolumeReferenceResourceTypeVolumeConst = "volume" +) + +func (*BackupPolicyJobSourceVolumeReference) isaBackupPolicyJobSource() bool { + return true +} + +// UnmarshalBackupPolicyJobSourceVolumeReference unmarshals an instance of BackupPolicyJobSourceVolumeReference from the specified map of raw messages. +func UnmarshalBackupPolicyJobSourceVolumeReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobSourceVolumeReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalVolumeRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyMatchResourceTypeInstance : BackupPolicyMatchResourceTypeInstance struct +// This model "extends" BackupPolicy +type BackupPolicyMatchResourceTypeInstance 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). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + 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 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"` + + 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 in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + IncludedContent []string `json:"included_content" 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 in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + MatchResourceType *string `json:"match_resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyMatchResourceTypeInstance.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 ( + BackupPolicyMatchResourceTypeInstanceHealthStateDegradedConst = "degraded" + BackupPolicyMatchResourceTypeInstanceHealthStateFaultedConst = "faulted" + BackupPolicyMatchResourceTypeInstanceHealthStateInapplicableConst = "inapplicable" + BackupPolicyMatchResourceTypeInstanceHealthStateOkConst = "ok" +) + +// Constants associated with the BackupPolicyMatchResourceTypeInstance.LifecycleState property. +// The lifecycle state of the backup policy. +const ( + BackupPolicyMatchResourceTypeInstanceLifecycleStateDeletingConst = "deleting" + BackupPolicyMatchResourceTypeInstanceLifecycleStateFailedConst = "failed" + BackupPolicyMatchResourceTypeInstanceLifecycleStatePendingConst = "pending" + BackupPolicyMatchResourceTypeInstanceLifecycleStateStableConst = "stable" + BackupPolicyMatchResourceTypeInstanceLifecycleStateSuspendedConst = "suspended" + BackupPolicyMatchResourceTypeInstanceLifecycleStateUpdatingConst = "updating" + BackupPolicyMatchResourceTypeInstanceLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BackupPolicyMatchResourceTypeInstance.ResourceType property. +// The resource type. +const ( + BackupPolicyMatchResourceTypeInstanceResourceTypeBackupPolicyConst = "backup_policy" +) + +// Constants associated with the BackupPolicyMatchResourceTypeInstance.IncludedContent property. +// An item to include. +const ( + BackupPolicyMatchResourceTypeInstanceIncludedContentBootVolumeConst = "boot_volume" + BackupPolicyMatchResourceTypeInstanceIncludedContentDataVolumesConst = "data_volumes" +) + +// Constants associated with the BackupPolicyMatchResourceTypeInstance.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 in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected +// property value was encountered. +const ( + BackupPolicyMatchResourceTypeInstanceMatchResourceTypeInstanceConst = "instance" +) + +func (*BackupPolicyMatchResourceTypeInstance) isaBackupPolicy() bool { + return true +} + +// UnmarshalBackupPolicyMatchResourceTypeInstance unmarshals an instance of BackupPolicyMatchResourceTypeInstance from the specified map of raw messages. +func UnmarshalBackupPolicyMatchResourceTypeInstance(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyMatchResourceTypeInstance) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalBackupPolicyHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_job_completed_at", &obj.LastJobCompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScope) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyMatchResourceTypeVolume : BackupPolicyMatchResourceTypeVolume struct +// This model "extends" BackupPolicy +type BackupPolicyMatchResourceTypeVolume 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). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + 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 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"` + + Scope BackupPolicyScopeIntf `json:"scope" 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 in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + MatchResourceType *string `json:"match_resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyMatchResourceTypeVolume.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 ( + BackupPolicyMatchResourceTypeVolumeHealthStateDegradedConst = "degraded" + BackupPolicyMatchResourceTypeVolumeHealthStateFaultedConst = "faulted" + BackupPolicyMatchResourceTypeVolumeHealthStateInapplicableConst = "inapplicable" + BackupPolicyMatchResourceTypeVolumeHealthStateOkConst = "ok" +) + +// Constants associated with the BackupPolicyMatchResourceTypeVolume.LifecycleState property. +// The lifecycle state of the backup policy. +const ( + BackupPolicyMatchResourceTypeVolumeLifecycleStateDeletingConst = "deleting" + BackupPolicyMatchResourceTypeVolumeLifecycleStateFailedConst = "failed" + BackupPolicyMatchResourceTypeVolumeLifecycleStatePendingConst = "pending" + BackupPolicyMatchResourceTypeVolumeLifecycleStateStableConst = "stable" + BackupPolicyMatchResourceTypeVolumeLifecycleStateSuspendedConst = "suspended" + BackupPolicyMatchResourceTypeVolumeLifecycleStateUpdatingConst = "updating" + BackupPolicyMatchResourceTypeVolumeLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BackupPolicyMatchResourceTypeVolume.ResourceType property. +// The resource type. +const ( + BackupPolicyMatchResourceTypeVolumeResourceTypeBackupPolicyConst = "backup_policy" +) + +// Constants associated with the BackupPolicyMatchResourceTypeVolume.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 in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected +// property value was encountered. +const ( + BackupPolicyMatchResourceTypeVolumeMatchResourceTypeVolumeConst = "volume" +) + +func (*BackupPolicyMatchResourceTypeVolume) isaBackupPolicy() bool { + return true +} + +// UnmarshalBackupPolicyMatchResourceTypeVolume unmarshals an instance of BackupPolicyMatchResourceTypeVolume from the specified map of raw messages. +func UnmarshalBackupPolicyMatchResourceTypeVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyMatchResourceTypeVolume) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalBackupPolicyHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_job_completed_at", &obj.LastJobCompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScope) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype : BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype struct +// This model "extends" BackupPolicyPrototype +type BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype struct { + // 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"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + 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"` + + // 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"` +} + +// Constants associated with the BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype.IncludedContent property. +// An item to include. +const ( + BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototypeIncludedContentBootVolumeConst = "boot_volume" + BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototypeIncludedContentDataVolumesConst = "data_volumes" +) + +// Constants associated with the BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype.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 ( + BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototypeMatchResourceTypeInstanceConst = "instance" +) + +// NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype : Instantiate BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype(matchUserTags []string, matchResourceType string) (_model *BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype, err error) { + _model = &BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype{ + MatchUserTags: matchUserTags, + MatchResourceType: core.StringPtr(matchResourceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype) isaBackupPolicyPrototype() bool { + return true +} + +// UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype unmarshals an instance of BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype) + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScopePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype : BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype struct +// This model "extends" BackupPolicyPrototype +type BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype struct { + // 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"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Scope BackupPolicyScopePrototypeIntf `json:"scope,omitempty"` + + // 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"` +} + +// Constants associated with the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype.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 ( + BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototypeMatchResourceTypeVolumeConst = "volume" +) + +// NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype : Instantiate BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype(matchUserTags []string, matchResourceType string) (_model *BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype, err error) { + _model = &BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype{ + MatchUserTags: matchUserTags, + MatchResourceType: core.StringPtr(matchResourceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) isaBackupPolicyPrototype() bool { + return true +} + +// UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype unmarshals an instance of BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScopePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyScopePrototypeEnterpriseIdentity : Identifies an enterprise by a unique property. +// Models which "extend" this model: +// - BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN +// This model "extends" BackupPolicyScopePrototype +type BackupPolicyScopePrototypeEnterpriseIdentity struct { + // The CRN for this enterprise. + CRN *string `json:"crn,omitempty"` +} + +func (*BackupPolicyScopePrototypeEnterpriseIdentity) isaBackupPolicyScopePrototypeEnterpriseIdentity() bool { + return true +} + +type BackupPolicyScopePrototypeEnterpriseIdentityIntf interface { + BackupPolicyScopePrototypeIntf + isaBackupPolicyScopePrototypeEnterpriseIdentity() bool +} + +func (*BackupPolicyScopePrototypeEnterpriseIdentity) isaBackupPolicyScopePrototype() bool { + return true +} + +// UnmarshalBackupPolicyScopePrototypeEnterpriseIdentity unmarshals an instance of BackupPolicyScopePrototypeEnterpriseIdentity from the specified map of raw messages. +func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopePrototypeEnterpriseIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyScopeAccountReference : BackupPolicyScopeAccountReference struct +// This model "extends" BackupPolicyScope +type BackupPolicyScopeAccountReference 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 BackupPolicyScopeAccountReference.ResourceType property. +// The resource type. +const ( + BackupPolicyScopeAccountReferenceResourceTypeAccountConst = "account" +) + +func (*BackupPolicyScopeAccountReference) isaBackupPolicyScope() bool { + return true +} + +// UnmarshalBackupPolicyScopeAccountReference unmarshals an instance of BackupPolicyScopeAccountReference from the specified map of raw messages. +func UnmarshalBackupPolicyScopeAccountReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopeAccountReference) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyScopeEnterpriseReference : BackupPolicyScopeEnterpriseReference struct +// This model "extends" BackupPolicyScope +type BackupPolicyScopeEnterpriseReference struct { + // The CRN for this enterprise. + CRN *string `json:"crn" validate:"required"` + + // The unique identifier for this enterprise. + ID *string `json:"id" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyScopeEnterpriseReference.ResourceType property. +// The resource type. +const ( + BackupPolicyScopeEnterpriseReferenceResourceTypeEnterpriseConst = "enterprise" +) + +func (*BackupPolicyScopeEnterpriseReference) isaBackupPolicyScope() bool { + return true +} + +// UnmarshalBackupPolicyScopeEnterpriseReference unmarshals an instance of BackupPolicyScopeEnterpriseReference from the specified map of raw messages. +func UnmarshalBackupPolicyScopeEnterpriseReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopeEnterpriseReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerBootTargetBareMetalServerDiskReference : BareMetalServerBootTargetBareMetalServerDiskReference struct +// This model "extends" BareMetalServerBootTarget +type BareMetalServerBootTargetBareMetalServerDiskReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerDiskReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this bare metal server disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server disk. + ID *string `json:"id" 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"` +} + +// Constants associated with the BareMetalServerBootTargetBareMetalServerDiskReference.ResourceType property. +// The resource type. +const ( + BareMetalServerBootTargetBareMetalServerDiskReferenceResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" +) + +func (*BareMetalServerBootTargetBareMetalServerDiskReference) isaBareMetalServerBootTarget() bool { + return true +} + +// UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference unmarshals an instance of BareMetalServerBootTargetBareMetalServerDiskReference from the specified map of raw messages. +func UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerBootTargetBareMetalServerDiskReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount : BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct +// This model "extends" BareMetalServerInitializationUserAccount +type BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct { + // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. + EncryptedPassword *[]byte `json:"encrypted_password" validate:"required"` + + // The public SSH key used to encrypt the password. + EncryptionKey *KeyReference `json:"encryption_key" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The username for the account created at initialization. + Username *string `json:"username" validate:"required"` +} + +// Constants associated with the BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount.ResourceType property. +// The resource type. +const ( + BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccountResourceTypeHostUserAccountConst = "host_user_account" +) + +func (*BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) isaBareMetalServerInitializationUserAccount() bool { + return true +} + +// UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount unmarshals an instance of BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount from the specified map of raw messages. +func UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) + err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "username", &obj.Username) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentByPci : BareMetalServerNetworkAttachmentByPci struct +// This model "extends" BareMetalServerNetworkAttachment +type BareMetalServerNetworkAttachmentByPci 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 lifecycle state of the bare metal server network attachment. + LifecycleState *string `json:"lifecycle_state" 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 port speed for this bare metal server network attachment in Mbps. + PortSpeed *int64 `json:"port_speed" 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 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 bare metal server network attachment type. + Type *string `json:"type" validate:"required"` + + // The virtual network interface for this bare metal server network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` + + // The VLAN IDs allowed for `vlan` attachments using this PCI attachment. + AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` + + // - `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. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkAttachmentByPci.LifecycleState property. +// The lifecycle state of the bare metal server network attachment. +const ( + BareMetalServerNetworkAttachmentByPciLifecycleStateDeletingConst = "deleting" + BareMetalServerNetworkAttachmentByPciLifecycleStateFailedConst = "failed" + BareMetalServerNetworkAttachmentByPciLifecycleStatePendingConst = "pending" + BareMetalServerNetworkAttachmentByPciLifecycleStateStableConst = "stable" + BareMetalServerNetworkAttachmentByPciLifecycleStateSuspendedConst = "suspended" + BareMetalServerNetworkAttachmentByPciLifecycleStateUpdatingConst = "updating" + BareMetalServerNetworkAttachmentByPciLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BareMetalServerNetworkAttachmentByPci.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkAttachmentByPciResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" +) + +// Constants associated with the BareMetalServerNetworkAttachmentByPci.Type property. +// The bare metal server network attachment type. +const ( + BareMetalServerNetworkAttachmentByPciTypePrimaryConst = "primary" + BareMetalServerNetworkAttachmentByPciTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkAttachmentByPci.InterfaceType property. +// - `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. +const ( + BareMetalServerNetworkAttachmentByPciInterfaceTypePciConst = "pci" +) + +func (*BareMetalServerNetworkAttachmentByPci) isaBareMetalServerNetworkAttachment() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentByPci unmarshals an instance of BareMetalServerNetworkAttachmentByPci from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentByPci(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentByPci) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentByVlan : BareMetalServerNetworkAttachmentByVlan struct +// This model "extends" BareMetalServerNetworkAttachment +type BareMetalServerNetworkAttachmentByVlan 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 lifecycle state of the bare metal server network attachment. + LifecycleState *string `json:"lifecycle_state" 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 port speed for this bare metal server network attachment in Mbps. + PortSpeed *int64 `json:"port_speed" 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 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 bare metal server network attachment type. + Type *string `json:"type" validate:"required"` + + // The virtual network interface for this bare metal server network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" 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" validate:"required"` + + // - `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. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment. + Vlan *int64 `json:"vlan" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkAttachmentByVlan.LifecycleState property. +// The lifecycle state of the bare metal server network attachment. +const ( + BareMetalServerNetworkAttachmentByVlanLifecycleStateDeletingConst = "deleting" + BareMetalServerNetworkAttachmentByVlanLifecycleStateFailedConst = "failed" + BareMetalServerNetworkAttachmentByVlanLifecycleStatePendingConst = "pending" + BareMetalServerNetworkAttachmentByVlanLifecycleStateStableConst = "stable" + BareMetalServerNetworkAttachmentByVlanLifecycleStateSuspendedConst = "suspended" + BareMetalServerNetworkAttachmentByVlanLifecycleStateUpdatingConst = "updating" + BareMetalServerNetworkAttachmentByVlanLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BareMetalServerNetworkAttachmentByVlan.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkAttachmentByVlanResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" +) + +// Constants associated with the BareMetalServerNetworkAttachmentByVlan.Type property. +// The bare metal server network attachment type. +const ( + BareMetalServerNetworkAttachmentByVlanTypePrimaryConst = "primary" + BareMetalServerNetworkAttachmentByVlanTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkAttachmentByVlan.InterfaceType property. +// - `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. +const ( + BareMetalServerNetworkAttachmentByVlanInterfaceTypeVlanConst = "vlan" +) + +func (*BareMetalServerNetworkAttachmentByVlan) isaBareMetalServerNetworkAttachment() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentByVlan unmarshals an instance of BareMetalServerNetworkAttachmentByVlan from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentByVlan(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentByVlan) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity struct { + // 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"` +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityIntf interface { + BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf + isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext : The virtual network interface for this target. +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext 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"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,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"` + + // 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"` + + // 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 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"` + + // 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 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"` +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct +// This model "extends" BareMetalServerNetworkAttachmentPrototype +type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct { + // 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"` + + 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"` + + // - `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" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype.InterfaceType property. +// - `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 ( + BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototypeInterfaceTypePciConst = "pci" +) + +// NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype struct +// This model "extends" BareMetalServerNetworkAttachmentPrototype +type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype struct { + // 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"` + + VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" 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"` + + // - `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. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment. + Vlan *int64 `json:"vlan" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype.InterfaceType property. +// - `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. +const ( + BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototypeInterfaceTypeVlanConst = "vlan" +) + +// NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + InterfaceType: core.StringPtr(interfaceType), + Vlan: core.Int64Ptr(vlan), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfaceByHiperSocket : BareMetalServerNetworkInterfaceByHiperSocket struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByHiperSocket 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 MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. + // + // 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"` + + // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity + // within a `s390x` based system. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceByHiperSocketResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.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 ( + BareMetalServerNetworkInterfaceByHiperSocketStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByHiperSocketStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByHiperSocketStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByHiperSocketStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.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 ( + BareMetalServerNetworkInterfaceByHiperSocketTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByHiperSocketTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.InterfaceType property. +// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity +// within a `s390x` based system. +const ( + BareMetalServerNetworkInterfaceByHiperSocketInterfaceTypeHipersocketConst = "hipersocket" +) + +func (*BareMetalServerNetworkInterfaceByHiperSocket) isaBareMetalServerNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfaceByHiperSocket unmarshals an instance of BareMetalServerNetworkInterfaceByHiperSocket from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByHiperSocket) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfaceByPci : BareMetalServerNetworkInterfaceByPci struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByPci 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 MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. + // + // 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" validate:"required"` + + // - `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. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceByPciResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.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 ( + BareMetalServerNetworkInterfaceByPciStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByPciStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByPciStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByPciStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.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 ( + BareMetalServerNetworkInterfaceByPciTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByPciTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByPci.InterfaceType property. +// - `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. +const ( + BareMetalServerNetworkInterfaceByPciInterfaceTypePciConst = "pci" +) + +func (*BareMetalServerNetworkInterfaceByPci) isaBareMetalServerNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfaceByPci unmarshals an instance of BareMetalServerNetworkInterfaceByPci from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByPci) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfaceByVlan : BareMetalServerNetworkInterfaceByVlan struct +// This model "extends" BareMetalServerNetworkInterface +type BareMetalServerNetworkInterfaceByVlan 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 MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value + // will be an empty string. + // + // 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"` + + // 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" validate:"required"` + + // - `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. + InterfaceType *string `json:"interface_type" validate:"required"` + + // 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" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceByVlanResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.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 ( + BareMetalServerNetworkInterfaceByVlanStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceByVlanStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceByVlanStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceByVlanStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.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 ( + BareMetalServerNetworkInterfaceByVlanTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceByVlanTypeSecondaryConst = "secondary" +) + +// Constants associated with the BareMetalServerNetworkInterfaceByVlan.InterfaceType property. +// - `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. +const ( + BareMetalServerNetworkInterfaceByVlanInterfaceTypeVlanConst = "vlan" +) + +func (*BareMetalServerNetworkInterfaceByVlan) isaBareMetalServerNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfaceByVlan unmarshals an instance of BareMetalServerNetworkInterfaceByVlan from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceByVlan) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype 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 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"` + + // - `hipersocket`: a virtual network 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`. + InterfaceType *string `json:"interface_type" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype.InterfaceType property. +// - `hipersocket`: a virtual network 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`. +const ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototypeInterfaceTypeHipersocketConst = "hipersocket" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype 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 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"` + + // - `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" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype.InterfaceType property. +// - `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 ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototypeInterfaceTypePciConst = "pci" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct +// This model "extends" BareMetalServerNetworkInterfacePrototype +type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype 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 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"` + + // 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"` + + // - `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 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" validate:"required"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype.InterfaceType property. +// - `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 ( + BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototypeInterfaceTypeVlanConst = "vlan" +) + +// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(subnet SubnetIdentityIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype, err error) { + _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype{ + Subnet: subnet, + InterfaceType: core.StringPtr(interfaceType), + Vlan: core.Int64Ptr(vlan), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype : BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype struct +// This model "extends" BareMetalServerPrimaryNetworkAttachmentPrototype +type BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype struct { + // 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"` + + 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"` + + // - `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"` +} + +// Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype.InterfaceType property. +// - `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 ( + BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototypeInterfaceTypePciConst = "pci" +) + +// NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype : Instantiate BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) (_model *BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype, err error) { + _model = &BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype{ + VirtualNetworkInterface: virtualNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { + return true +} + +// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidthDependent : The total bandwidth shared across the bare metal server network attachments or bare metal server network interfaces +// of a bare metal server with this profile depends on its configuration. +// This model "extends" BareMetalServerProfileBandwidth +type BareMetalServerProfileBandwidthDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileBandwidthDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileBandwidthDependent) isaBareMetalServerProfileBandwidth() bool { + return true +} + +// UnmarshalBareMetalServerProfileBandwidthDependent unmarshals an instance of BareMetalServerProfileBandwidthDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidthDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the bare metal server network attachments +// or bare metal server network interfaces of a bare metal server with this profile. +// This model "extends" BareMetalServerProfileBandwidth +type BareMetalServerProfileBandwidthEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 BareMetalServerProfileBandwidthEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileBandwidthEnum) isaBareMetalServerProfileBandwidth() bool { + return true +} + +// UnmarshalBareMetalServerProfileBandwidthEnum unmarshals an instance of BareMetalServerProfileBandwidthEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidthEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the bare metal server network attachments or bare metal +// server network interfaces of a bare metal server with this profile. +// This model "extends" BareMetalServerProfileBandwidth +type BareMetalServerProfileBandwidthFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileBandwidthFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileBandwidthFixed) isaBareMetalServerProfileBandwidth() bool { + return true +} + +// UnmarshalBareMetalServerProfileBandwidthFixed unmarshals an instance of BareMetalServerProfileBandwidthFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidthFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network attachments or network +// interfaces of a bare metal server with this profile. +// This model "extends" BareMetalServerProfileBandwidth +type BareMetalServerProfileBandwidthRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileBandwidthRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileBandwidthRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileBandwidthRange) isaBareMetalServerProfileBandwidth() bool { + return true +} + +// UnmarshalBareMetalServerProfileBandwidthRange unmarshals an instance of BareMetalServerProfileBandwidthRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileBandwidthRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCountDependent : The CPU core count for a bare metal server with this profile depends on its configuration. +// This model "extends" BareMetalServerProfileCpuCoreCount +type BareMetalServerProfileCpuCoreCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuCoreCountDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuCoreCountDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileCpuCoreCountDependent) isaBareMetalServerProfileCpuCoreCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuCoreCountDependent unmarshals an instance of BareMetalServerProfileCpuCoreCountDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCountEnum : The permitted values for CPU cores for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuCoreCount +type BareMetalServerProfileCpuCoreCountEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 BareMetalServerProfileCpuCoreCountEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuCoreCountEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileCpuCoreCountEnum) isaBareMetalServerProfileCpuCoreCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuCoreCountEnum unmarshals an instance of BareMetalServerProfileCpuCoreCountEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCountEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCountEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCountFixed : The CPU core count for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuCoreCount +type BareMetalServerProfileCpuCoreCountFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuCoreCountFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuCoreCountFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileCpuCoreCountFixed) isaBareMetalServerProfileCpuCoreCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuCoreCountFixed unmarshals an instance of BareMetalServerProfileCpuCoreCountFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCountFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCountFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuCoreCountRange : The permitted range for the number of CPU cores for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuCoreCount +type BareMetalServerProfileCpuCoreCountRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuCoreCountRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuCoreCountRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileCpuCoreCountRange) isaBareMetalServerProfileCpuCoreCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuCoreCountRange unmarshals an instance of BareMetalServerProfileCpuCoreCountRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuCoreCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuCoreCountRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuSocketCountDependent : The CPU socket count for a bare metal server with this profile depends on its configuration. +// This model "extends" BareMetalServerProfileCpuSocketCount +type BareMetalServerProfileCpuSocketCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuSocketCountDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileCpuSocketCountDependent) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuSocketCountDependent unmarshals an instance of BareMetalServerProfileCpuSocketCountDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuSocketCountEnum : The permitted values for CPU sockets for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuSocketCount +type BareMetalServerProfileCpuSocketCountEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 BareMetalServerProfileCpuSocketCountEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileCpuSocketCountEnum) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuSocketCountEnum unmarshals an instance of BareMetalServerProfileCpuSocketCountEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCountEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCountEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuSocketCountFixed : The number of CPU sockets for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuSocketCount +type BareMetalServerProfileCpuSocketCountFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuSocketCountFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileCpuSocketCountFixed) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuSocketCountFixed unmarshals an instance of BareMetalServerProfileCpuSocketCountFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCountFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCountFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCpuSocketCountRange : The permitted range for the number of CPU sockets for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileCpuSocketCount +type BareMetalServerProfileCpuSocketCountRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileCpuSocketCountRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileCpuSocketCountRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileCpuSocketCountRange) isaBareMetalServerProfileCpuSocketCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileCpuSocketCountRange unmarshals an instance of BareMetalServerProfileCpuSocketCountRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileCpuSocketCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileCpuSocketCountRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskQuantityDependent : The number of disks of this configuration for a bare metal server with this profile depends on its bare metal server +// configuration. +// This model "extends" BareMetalServerProfileDiskQuantity +type BareMetalServerProfileDiskQuantityDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskQuantityDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileDiskQuantityDependent) isaBareMetalServerProfileDiskQuantity() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskQuantityDependent unmarshals an instance of BareMetalServerProfileDiskQuantityDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantityDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantityDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskQuantityEnum : The permitted the number of disks of this configuration for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileDiskQuantity +type BareMetalServerProfileDiskQuantityEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 BareMetalServerProfileDiskQuantityEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileDiskQuantityEnum) isaBareMetalServerProfileDiskQuantity() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskQuantityEnum unmarshals an instance of BareMetalServerProfileDiskQuantityEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantityEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantityEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskQuantityFixed : The number of disks of this configuration for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileDiskQuantity +type BareMetalServerProfileDiskQuantityFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskQuantityFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileDiskQuantityFixed) isaBareMetalServerProfileDiskQuantity() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskQuantityFixed unmarshals an instance of BareMetalServerProfileDiskQuantityFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantityFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantityFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskQuantityRange : The permitted range for the number of disks of this configuration for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileDiskQuantity +type BareMetalServerProfileDiskQuantityRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskQuantityRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileDiskQuantityRange) isaBareMetalServerProfileDiskQuantity() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskQuantityRange unmarshals an instance of BareMetalServerProfileDiskQuantityRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskQuantityRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskQuantityRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSizeDependent : The disk size in GB (gigabytes) of this configuration for a bare metal server with this profile depends on its bare +// metal server configuration. +// This model "extends" BareMetalServerProfileDiskSize +type BareMetalServerProfileDiskSizeDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskSizeDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileDiskSizeDependent) isaBareMetalServerProfileDiskSize() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskSizeDependent unmarshals an instance of BareMetalServerProfileDiskSizeDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSizeDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSizeDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSizeEnum : The permitted disk size in GB (gigabytes) of this configuration for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileDiskSize +type BareMetalServerProfileDiskSizeEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 BareMetalServerProfileDiskSizeEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileDiskSizeEnum) isaBareMetalServerProfileDiskSize() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskSizeEnum unmarshals an instance of BareMetalServerProfileDiskSizeEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSizeEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSizeEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSizeFixed : The size of the disk in GB (gigabytes). +// This model "extends" BareMetalServerProfileDiskSize +type BareMetalServerProfileDiskSizeFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskSizeFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileDiskSizeFixed) isaBareMetalServerProfileDiskSize() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskSizeFixed unmarshals an instance of BareMetalServerProfileDiskSizeFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSizeFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSizeFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileDiskSizeRange : The permitted range for the disk size of this configuration in GB (gigabytes) for a bare metal server with this +// profile. +// This model "extends" BareMetalServerProfileDiskSize +type BareMetalServerProfileDiskSizeRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileDiskSizeRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileDiskSizeRange) isaBareMetalServerProfileDiskSize() bool { + return true +} + +// UnmarshalBareMetalServerProfileDiskSizeRange unmarshals an instance of BareMetalServerProfileDiskSizeRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileDiskSizeRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileDiskSizeRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileIdentityByHref : BareMetalServerProfileIdentityByHref struct +// This model "extends" BareMetalServerProfileIdentity +type BareMetalServerProfileIdentityByHref struct { + // The URL for this bare metal server profile. + Href *string `json:"href" validate:"required"` +} + +// NewBareMetalServerProfileIdentityByHref : Instantiate BareMetalServerProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerProfileIdentityByHref(href string) (_model *BareMetalServerProfileIdentityByHref, err error) { + _model = &BareMetalServerProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerProfileIdentityByHref) isaBareMetalServerProfileIdentity() bool { + return true +} + +// UnmarshalBareMetalServerProfileIdentityByHref unmarshals an instance of BareMetalServerProfileIdentityByHref from the specified map of raw messages. +func UnmarshalBareMetalServerProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileIdentityByName : BareMetalServerProfileIdentityByName struct +// This model "extends" BareMetalServerProfileIdentity +type BareMetalServerProfileIdentityByName struct { + // The name for this bare metal server profile. + Name *string `json:"name" validate:"required"` +} + +// NewBareMetalServerProfileIdentityByName : Instantiate BareMetalServerProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerProfileIdentityByName(name string) (_model *BareMetalServerProfileIdentityByName, err error) { + _model = &BareMetalServerProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerProfileIdentityByName) isaBareMetalServerProfileIdentity() bool { + return true +} + +// UnmarshalBareMetalServerProfileIdentityByName unmarshals an instance of BareMetalServerProfileIdentityByName from the specified map of raw messages. +func UnmarshalBareMetalServerProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileMemoryDependent : The memory value for a bare metal server with this profile depends on its configuration. +// This model "extends" BareMetalServerProfileMemory +type BareMetalServerProfileMemoryDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileMemoryDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileMemoryDependent) isaBareMetalServerProfileMemory() bool { + return true +} + +// UnmarshalBareMetalServerProfileMemoryDependent unmarshals an instance of BareMetalServerProfileMemoryDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemoryDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileMemoryEnum : The permitted memory values (in gibibytes) for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileMemory +type BareMetalServerProfileMemoryEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 BareMetalServerProfileMemoryEnum.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryEnumTypeEnumConst = "enum" +) + +func (*BareMetalServerProfileMemoryEnum) isaBareMetalServerProfileMemory() bool { + return true +} + +// UnmarshalBareMetalServerProfileMemoryEnum unmarshals an instance of BareMetalServerProfileMemoryEnum from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemoryEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileMemoryFixed : The memory (in gibibytes) for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileMemory +type BareMetalServerProfileMemoryFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileMemoryFixed.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryFixedTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileMemoryFixed) isaBareMetalServerProfileMemory() bool { + return true +} + +// UnmarshalBareMetalServerProfileMemoryFixed unmarshals an instance of BareMetalServerProfileMemoryFixed from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemoryFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileMemoryRange : The permitted memory range (in gibibytes) for a bare metal server with this profile. +// This model "extends" BareMetalServerProfileMemory +type BareMetalServerProfileMemoryRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileMemoryRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileMemoryRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileMemoryRange) isaBareMetalServerProfileMemory() bool { + return true +} + +// UnmarshalBareMetalServerProfileMemoryRange unmarshals an instance of BareMetalServerProfileMemoryRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileMemoryRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileNetworkAttachmentCountDependent : The number of network attachments supported on a bare metal server with this profile is dependent on its +// configuration. +// This model "extends" BareMetalServerProfileNetworkAttachmentCount +type BareMetalServerProfileNetworkAttachmentCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileNetworkAttachmentCountDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkAttachmentCountDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileNetworkAttachmentCountDependent) isaBareMetalServerProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileNetworkAttachmentCountDependent unmarshals an instance of BareMetalServerProfileNetworkAttachmentCountDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkAttachmentCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkAttachmentCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileNetworkAttachmentCountRange : The number of network attachments supported on a bare metal server with this profile. +// This model "extends" BareMetalServerProfileNetworkAttachmentCount +type BareMetalServerProfileNetworkAttachmentCountRange 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" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileNetworkAttachmentCountRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkAttachmentCountRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileNetworkAttachmentCountRange) isaBareMetalServerProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileNetworkAttachmentCountRange unmarshals an instance of BareMetalServerProfileNetworkAttachmentCountRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkAttachmentCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkAttachmentCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileNetworkInterfaceCountDependent : The number of bare metal server network interfaces supported on a bare metal server with this profile is dependent on +// its configuration. +// This model "extends" BareMetalServerProfileNetworkInterfaceCount +type BareMetalServerProfileNetworkInterfaceCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileNetworkInterfaceCountDependent.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkInterfaceCountDependentTypeDependentConst = "dependent" +) + +func (*BareMetalServerProfileNetworkInterfaceCountDependent) isaBareMetalServerProfileNetworkInterfaceCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileNetworkInterfaceCountDependent unmarshals an instance of BareMetalServerProfileNetworkInterfaceCountDependent from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkInterfaceCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkInterfaceCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileNetworkInterfaceCountRange : The number of bare metal server network interfaces supported on a bare metal server with this profile. +// This model "extends" BareMetalServerProfileNetworkInterfaceCount +type BareMetalServerProfileNetworkInterfaceCountRange 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" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileNetworkInterfaceCountRange.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkInterfaceCountRangeTypeRangeConst = "range" +) + +func (*BareMetalServerProfileNetworkInterfaceCountRange) isaBareMetalServerProfileNetworkInterfaceCount() bool { + return true +} + +// UnmarshalBareMetalServerProfileNetworkInterfaceCountRange unmarshals an instance of BareMetalServerProfileNetworkInterfaceCountRange from the specified map of raw messages. +func UnmarshalBareMetalServerProfileNetworkInterfaceCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileNetworkInterfaceCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrototypeBareMetalServerByNetworkAttachment : BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct +// This model "extends" BareMetalServerPrototype +type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { + // 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"` + + 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" validate:"required"` +} + +// NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment : Instantiate BareMetalServerPrototypeBareMetalServerByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment(initialization *BareMetalServerInitializationPrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf) (_model *BareMetalServerPrototypeBareMetalServerByNetworkAttachment, err error) { + _model = &BareMetalServerPrototypeBareMetalServerByNetworkAttachment{ + Initialization: initialization, + Profile: profile, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrototypeBareMetalServerByNetworkAttachment) isaBareMetalServerPrototype() bool { + return true +} + +// UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment unmarshals an instance of BareMetalServerPrototypeBareMetalServerByNetworkAttachment from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrototypeBareMetalServerByNetworkInterface : BareMetalServerPrototypeBareMetalServerByNetworkInterface struct +// This model "extends" BareMetalServerPrototype +type BareMetalServerPrototypeBareMetalServerByNetworkInterface struct { + // 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"` + + 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 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" validate:"required"` +} + +// NewBareMetalServerPrototypeBareMetalServerByNetworkInterface : Instantiate BareMetalServerPrototypeBareMetalServerByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkInterface(initialization *BareMetalServerInitializationPrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype) (_model *BareMetalServerPrototypeBareMetalServerByNetworkInterface, err error) { + _model = &BareMetalServerPrototypeBareMetalServerByNetworkInterface{ + Initialization: initialization, + Profile: profile, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerPrototypeBareMetalServerByNetworkInterface) isaBareMetalServerPrototype() bool { + return true +} + +// UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface unmarshals an instance of BareMetalServerPrototypeBareMetalServerByNetworkInterface from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeBareMetalServerByNetworkInterface) + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogOfferingIdentityCatalogOfferingByCRN : CatalogOfferingIdentityCatalogOfferingByCRN struct +// This model "extends" CatalogOfferingIdentity +type CatalogOfferingIdentityCatalogOfferingByCRN struct { + // The CRN for this + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. + CRN *string `json:"crn" validate:"required"` +} + +// NewCatalogOfferingIdentityCatalogOfferingByCRN : Instantiate CatalogOfferingIdentityCatalogOfferingByCRN (Generic Model Constructor) +func (*VpcV1) NewCatalogOfferingIdentityCatalogOfferingByCRN(crn string) (_model *CatalogOfferingIdentityCatalogOfferingByCRN, err error) { + _model = &CatalogOfferingIdentityCatalogOfferingByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CatalogOfferingIdentityCatalogOfferingByCRN) isaCatalogOfferingIdentity() bool { + return true +} + +// UnmarshalCatalogOfferingIdentityCatalogOfferingByCRN unmarshals an instance of CatalogOfferingIdentityCatalogOfferingByCRN from the specified map of raw messages. +func UnmarshalCatalogOfferingIdentityCatalogOfferingByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingIdentityCatalogOfferingByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN : CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN struct +// This model "extends" CatalogOfferingVersionIdentity +type CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN 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"` +} + +// NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN : Instantiate CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN (Generic Model Constructor) +func (*VpcV1) NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(crn string) (_model *CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN, err error) { + _model = &CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN) isaCatalogOfferingVersionIdentity() bool { + return true +} + +// UnmarshalCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN unmarshals an instance of CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN from the specified map of raw messages. +func UnmarshalCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CertificateInstanceIdentityByCRN : CertificateInstanceIdentityByCRN struct +// This model "extends" CertificateInstanceIdentity +type CertificateInstanceIdentityByCRN struct { + // The CRN for this certificate instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewCertificateInstanceIdentityByCRN : Instantiate CertificateInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewCertificateInstanceIdentityByCRN(crn string) (_model *CertificateInstanceIdentityByCRN, err error) { + _model = &CertificateInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CertificateInstanceIdentityByCRN) isaCertificateInstanceIdentity() bool { + return true +} + +// UnmarshalCertificateInstanceIdentityByCRN unmarshals an instance of CertificateInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalCertificateInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CertificateInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CloudObjectStorageBucketIdentityByCRN : CloudObjectStorageBucketIdentityByCRN struct +// This model "extends" CloudObjectStorageBucketIdentity +type CloudObjectStorageBucketIdentityByCRN struct { + // The CRN of this Cloud Object Storage bucket. + CRN *string `json:"crn" validate:"required"` +} + +// NewCloudObjectStorageBucketIdentityByCRN : Instantiate CloudObjectStorageBucketIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewCloudObjectStorageBucketIdentityByCRN(crn string) (_model *CloudObjectStorageBucketIdentityByCRN, err error) { + _model = &CloudObjectStorageBucketIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CloudObjectStorageBucketIdentityByCRN) isaCloudObjectStorageBucketIdentity() bool { + return true +} + +// UnmarshalCloudObjectStorageBucketIdentityByCRN unmarshals an instance of CloudObjectStorageBucketIdentityByCRN from the specified map of raw messages. +func UnmarshalCloudObjectStorageBucketIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageBucketIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct +// This model "extends" CloudObjectStorageBucketIdentity +type CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct { + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name" validate:"required"` +} + +// NewCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : Instantiate CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName (Generic Model Constructor) +func (*VpcV1) NewCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(name string) (_model *CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName, err error) { + _model = &CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) isaCloudObjectStorageBucketIdentity() bool { + return true +} + +// UnmarshalCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName unmarshals an instance of CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName from the specified map of raw messages. +func UnmarshalCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsInstanceIdentityByCRN : DnsInstanceIdentityByCRN struct +// This model "extends" DnsInstanceIdentity +type DnsInstanceIdentityByCRN struct { + // The CRN for this DNS instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewDnsInstanceIdentityByCRN : Instantiate DnsInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewDnsInstanceIdentityByCRN(crn string) (_model *DnsInstanceIdentityByCRN, err error) { + _model = &DnsInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DnsInstanceIdentityByCRN) isaDnsInstanceIdentity() bool { + return true +} + +// UnmarshalDnsInstanceIdentityByCRN unmarshals an instance of DnsInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalDnsInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DnsZoneIdentityByID : DnsZoneIdentityByID struct +// This model "extends" DnsZoneIdentity +type DnsZoneIdentityByID struct { + ID *string `json:"id" validate:"required"` +} + +// NewDnsZoneIdentityByID : Instantiate DnsZoneIdentityByID (Generic Model Constructor) +func (*VpcV1) NewDnsZoneIdentityByID(id string) (_model *DnsZoneIdentityByID, err error) { + _model = &DnsZoneIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DnsZoneIdentityByID) isaDnsZoneIdentity() bool { + return true +} + +// UnmarshalDnsZoneIdentityByID unmarshals an instance of DnsZoneIdentityByID from the specified map of raw messages. +func UnmarshalDnsZoneIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsZoneIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupIdentityByCRN : DedicatedHostGroupIdentityByCRN struct +// This model "extends" DedicatedHostGroupIdentity +type DedicatedHostGroupIdentityByCRN struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` +} + +// NewDedicatedHostGroupIdentityByCRN : Instantiate DedicatedHostGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostGroupIdentityByCRN(crn string) (_model *DedicatedHostGroupIdentityByCRN, err error) { + _model = &DedicatedHostGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostGroupIdentityByCRN) isaDedicatedHostGroupIdentity() bool { + return true +} + +// UnmarshalDedicatedHostGroupIdentityByCRN unmarshals an instance of DedicatedHostGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupIdentityByHref : DedicatedHostGroupIdentityByHref struct +// This model "extends" DedicatedHostGroupIdentity +type DedicatedHostGroupIdentityByHref struct { + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` +} + +// NewDedicatedHostGroupIdentityByHref : Instantiate DedicatedHostGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostGroupIdentityByHref(href string) (_model *DedicatedHostGroupIdentityByHref, err error) { + _model = &DedicatedHostGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostGroupIdentityByHref) isaDedicatedHostGroupIdentity() bool { + return true +} + +// UnmarshalDedicatedHostGroupIdentityByHref unmarshals an instance of DedicatedHostGroupIdentityByHref from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupIdentityByID : DedicatedHostGroupIdentityByID struct +// This model "extends" DedicatedHostGroupIdentity +type DedicatedHostGroupIdentityByID struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` +} + +// NewDedicatedHostGroupIdentityByID : Instantiate DedicatedHostGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostGroupIdentityByID(id string) (_model *DedicatedHostGroupIdentityByID, err error) { + _model = &DedicatedHostGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostGroupIdentityByID) isaDedicatedHostGroupIdentity() bool { + return true +} + +// UnmarshalDedicatedHostGroupIdentityByID unmarshals an instance of DedicatedHostGroupIdentityByID from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileIdentityByHref : DedicatedHostProfileIdentityByHref struct +// This model "extends" DedicatedHostProfileIdentity +type DedicatedHostProfileIdentityByHref struct { + // The URL for this dedicated host profile. + Href *string `json:"href" validate:"required"` +} + +// NewDedicatedHostProfileIdentityByHref : Instantiate DedicatedHostProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostProfileIdentityByHref(href string) (_model *DedicatedHostProfileIdentityByHref, err error) { + _model = &DedicatedHostProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostProfileIdentityByHref) isaDedicatedHostProfileIdentity() bool { + return true +} + +// UnmarshalDedicatedHostProfileIdentityByHref unmarshals an instance of DedicatedHostProfileIdentityByHref from the specified map of raw messages. +func UnmarshalDedicatedHostProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileIdentityByName : DedicatedHostProfileIdentityByName struct +// This model "extends" DedicatedHostProfileIdentity +type DedicatedHostProfileIdentityByName struct { + // The globally unique name for this dedicated host profile. + Name *string `json:"name" validate:"required"` +} + +// NewDedicatedHostProfileIdentityByName : Instantiate DedicatedHostProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostProfileIdentityByName(name string) (_model *DedicatedHostProfileIdentityByName, err error) { + _model = &DedicatedHostProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostProfileIdentityByName) isaDedicatedHostProfileIdentity() bool { + return true +} + +// UnmarshalDedicatedHostProfileIdentityByName unmarshals an instance of DedicatedHostProfileIdentityByName from the specified map of raw messages. +func UnmarshalDedicatedHostProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryDependent : The memory value for a dedicated host with this profile depends on its configuration. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileMemoryDependent.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryDependentTypeDependentConst = "dependent" +) + +func (*DedicatedHostProfileMemoryDependent) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryDependent unmarshals an instance of DedicatedHostProfileMemoryDependent from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryEnum : The permitted memory values (in gibibytes) for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 DedicatedHostProfileMemoryEnum.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryEnumTypeEnumConst = "enum" +) + +func (*DedicatedHostProfileMemoryEnum) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryEnum unmarshals an instance of DedicatedHostProfileMemoryEnum from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryFixed : The memory (in gibibytes) for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileMemoryFixed.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryFixedTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileMemoryFixed) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryFixed unmarshals an instance of DedicatedHostProfileMemoryFixed from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryRange : The permitted memory range (in gibibytes) for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileMemoryRange.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryRangeTypeRangeConst = "range" +) + +func (*DedicatedHostProfileMemoryRange) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryRange unmarshals an instance of DedicatedHostProfileMemoryRange from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketDependent : The CPU socket count for a dedicated host with this profile depends on its configuration. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileSocketDependent.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketDependentTypeDependentConst = "dependent" +) + +func (*DedicatedHostProfileSocketDependent) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketDependent unmarshals an instance of DedicatedHostProfileSocketDependent from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketEnum : The permitted values for CPU socket count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 DedicatedHostProfileSocketEnum.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketEnumTypeEnumConst = "enum" +) + +func (*DedicatedHostProfileSocketEnum) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketEnum unmarshals an instance of DedicatedHostProfileSocketEnum from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketFixed : The CPU socket count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileSocketFixed.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketFixedTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileSocketFixed) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketFixed unmarshals an instance of DedicatedHostProfileSocketFixed from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketRange : The permitted range for CPU socket count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileSocketRange.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketRangeTypeRangeConst = "range" +) + +func (*DedicatedHostProfileSocketRange) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketRange unmarshals an instance of DedicatedHostProfileSocketRange from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuDependent : The VCPU count for a dedicated host with this profile depends on its configuration. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuDependent.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuDependentTypeDependentConst = "dependent" +) + +func (*DedicatedHostProfileVcpuDependent) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuDependent unmarshals an instance of DedicatedHostProfileVcpuDependent from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuEnum : The permitted values for VCPU count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 DedicatedHostProfileVcpuEnum.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuEnumTypeEnumConst = "enum" +) + +func (*DedicatedHostProfileVcpuEnum) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuEnum unmarshals an instance of DedicatedHostProfileVcpuEnum from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuFixed : The VCPU count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuFixed.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuFixedTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileVcpuFixed) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuFixed unmarshals an instance of DedicatedHostProfileVcpuFixed from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuRange : The permitted range for VCPU count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuRange.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuRangeTypeRangeConst = "range" +) + +func (*DedicatedHostProfileVcpuRange) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuRange unmarshals an instance of DedicatedHostProfileVcpuRange from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPrototypeDedicatedHostByGroup : DedicatedHostPrototypeDedicatedHostByGroup struct +// This model "extends" DedicatedHostPrototype +type DedicatedHostPrototypeDedicatedHostByGroup struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this dedicated host. + Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The dedicated host group for this dedicated host. + Group DedicatedHostGroupIdentityIntf `json:"group" validate:"required"` +} + +// NewDedicatedHostPrototypeDedicatedHostByGroup : Instantiate DedicatedHostPrototypeDedicatedHostByGroup (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByGroup(profile DedicatedHostProfileIdentityIntf, group DedicatedHostGroupIdentityIntf) (_model *DedicatedHostPrototypeDedicatedHostByGroup, err error) { + _model = &DedicatedHostPrototypeDedicatedHostByGroup{ + Profile: profile, + Group: group, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostPrototypeDedicatedHostByGroup) isaDedicatedHostPrototype() bool { + return true +} + +// UnmarshalDedicatedHostPrototypeDedicatedHostByGroup unmarshals an instance of DedicatedHostPrototypeDedicatedHostByGroup from the specified map of raw messages. +func UnmarshalDedicatedHostPrototypeDedicatedHostByGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPrototypeDedicatedHostByGroup) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPrototypeDedicatedHostByZone : DedicatedHostPrototypeDedicatedHostByZone struct +// This model "extends" DedicatedHostPrototype +type DedicatedHostPrototypeDedicatedHostByZone struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this dedicated host. + Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Group *DedicatedHostGroupPrototypeDedicatedHostByZoneContext `json:"group,omitempty"` + + // The zone this dedicated host will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewDedicatedHostPrototypeDedicatedHostByZone : Instantiate DedicatedHostPrototypeDedicatedHostByZone (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByZone(profile DedicatedHostProfileIdentityIntf, zone ZoneIdentityIntf) (_model *DedicatedHostPrototypeDedicatedHostByZone, err error) { + _model = &DedicatedHostPrototypeDedicatedHostByZone{ + Profile: profile, + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*DedicatedHostPrototypeDedicatedHostByZone) isaDedicatedHostPrototype() bool { + return true +} + +// UnmarshalDedicatedHostPrototypeDedicatedHostByZone unmarshals an instance of DedicatedHostPrototypeDedicatedHostByZone from the specified map of raw messages. +func UnmarshalDedicatedHostPrototypeDedicatedHostByZone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPrototypeDedicatedHostByZone) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EncryptionKeyIdentityByCRN : EncryptionKeyIdentityByCRN struct +// This model "extends" EncryptionKeyIdentity +type EncryptionKeyIdentityByCRN struct { + // The CRN of the [Key Protect Root + // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto + // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. + CRN *string `json:"crn" validate:"required"` +} + +// NewEncryptionKeyIdentityByCRN : Instantiate EncryptionKeyIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewEncryptionKeyIdentityByCRN(crn string) (_model *EncryptionKeyIdentityByCRN, err error) { + _model = &EncryptionKeyIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EncryptionKeyIdentityByCRN) isaEncryptionKeyIdentity() bool { + return true +} + +// UnmarshalEncryptionKeyIdentityByCRN unmarshals an instance of EncryptionKeyIdentityByCRN from the specified map of raw messages. +func UnmarshalEncryptionKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EncryptionKeyIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPIdentity : Identifies a reserved IP by a unique property. +// Models which "extend" this model: +// - EndpointGatewayReservedIPReservedIPIdentityByID +// - EndpointGatewayReservedIPReservedIPIdentityByHref +// This model "extends" EndpointGatewayReservedIP +type EndpointGatewayReservedIPReservedIPIdentity struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` +} + +func (*EndpointGatewayReservedIPReservedIPIdentity) isaEndpointGatewayReservedIPReservedIPIdentity() bool { + return true +} + +type EndpointGatewayReservedIPReservedIPIdentityIntf interface { + EndpointGatewayReservedIPIntf + isaEndpointGatewayReservedIPReservedIPIdentity() bool +} + +func (*EndpointGatewayReservedIPReservedIPIdentity) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPIdentity unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentity from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPPrototypeTargetContext : EndpointGatewayReservedIPReservedIPPrototypeTargetContext struct +// This model "extends" EndpointGatewayReservedIP +type EndpointGatewayReservedIPReservedIPPrototypeTargetContext 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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"` + + // The subnet in which to create this reserved IP. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` +} + +// NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext : Instantiate EndpointGatewayReservedIPReservedIPPrototypeTargetContext (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext(subnet SubnetIdentityIntf) (_model *EndpointGatewayReservedIPReservedIPPrototypeTargetContext, err error) { + _model = &EndpointGatewayReservedIPReservedIPPrototypeTargetContext{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayReservedIPReservedIPPrototypeTargetContext) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext unmarshals an instance of EndpointGatewayReservedIPReservedIPPrototypeTargetContext from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPPrototypeTargetContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderCloudServiceIdentity : EndpointGatewayTargetPrototypeProviderCloudServiceIdentity struct +// Models which "extend" this model: +// - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN +// This model "extends" EndpointGatewayTargetPrototype +type EndpointGatewayTargetPrototypeProviderCloudServiceIdentity struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn,omitempty"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderCloudServiceIdentity.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool { + return true +} + +type EndpointGatewayTargetPrototypeProviderCloudServiceIdentityIntf interface { + EndpointGatewayTargetPrototypeIntf + isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool +} + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity unmarshals an instance of EndpointGatewayTargetPrototypeProviderCloudServiceIdentity from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity : EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity struct +// Models which "extend" this model: +// - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName +// This model "extends" EndpointGatewayTargetPrototype +type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool { + return true +} + +type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityIntf interface { + EndpointGatewayTargetPrototypeIntf + isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool +} + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity unmarshals an instance of EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetProviderCloudServiceReference : EndpointGatewayTargetProviderCloudServiceReference struct +// This model "extends" EndpointGatewayTarget +type EndpointGatewayTargetProviderCloudServiceReference struct { + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn" validate:"required"` + + // The type of target. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetProviderCloudServiceReference.ResourceType property. +// The type of target. +const ( + EndpointGatewayTargetProviderCloudServiceReferenceResourceTypeProviderCloudServiceConst = "provider_cloud_service" +) + +func (*EndpointGatewayTargetProviderCloudServiceReference) isaEndpointGatewayTarget() bool { + return true +} + +// UnmarshalEndpointGatewayTargetProviderCloudServiceReference unmarshals an instance of EndpointGatewayTargetProviderCloudServiceReference from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetProviderCloudServiceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetProviderCloudServiceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetProviderInfrastructureServiceReference : The name of this provider infrastructure service. +// This model "extends" EndpointGatewayTarget +type EndpointGatewayTargetProviderInfrastructureServiceReference struct { + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name" validate:"required"` + + // The type of target. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetProviderInfrastructureServiceReference.ResourceType property. +// The type of target. +const ( + EndpointGatewayTargetProviderInfrastructureServiceReferenceResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetProviderInfrastructureServiceReference) isaEndpointGatewayTarget() bool { + return true +} + +// UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference unmarshals an instance of EndpointGatewayTargetProviderInfrastructureServiceReference from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetProviderInfrastructureServiceReference) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPPrototypeFloatingIPByTarget : FloatingIPPrototypeFloatingIPByTarget struct +// This model "extends" FloatingIPPrototype +type FloatingIPPrototypeFloatingIPByTarget struct { + // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // 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: + // + // - an instance network interface + // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` + // - a virtual network interface with `enable_infrastructure_nat` set to `true`. + Target FloatingIPTargetPrototypeIntf `json:"target" validate:"required"` +} + +// NewFloatingIPPrototypeFloatingIPByTarget : Instantiate FloatingIPPrototypeFloatingIPByTarget (Generic Model Constructor) +func (*VpcV1) NewFloatingIPPrototypeFloatingIPByTarget(target FloatingIPTargetPrototypeIntf) (_model *FloatingIPPrototypeFloatingIPByTarget, err error) { + _model = &FloatingIPPrototypeFloatingIPByTarget{ + Target: target, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPPrototypeFloatingIPByTarget) isaFloatingIPPrototype() bool { + return true +} + +// UnmarshalFloatingIPPrototypeFloatingIPByTarget unmarshals an instance of FloatingIPPrototypeFloatingIPByTarget from the specified map of raw messages. +func UnmarshalFloatingIPPrototypeFloatingIPByTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPrototypeFloatingIPByTarget) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPPrototypeFloatingIPByZone : FloatingIPPrototypeFloatingIPByZone struct +// This model "extends" FloatingIPPrototype +type FloatingIPPrototypeFloatingIPByZone struct { + // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The zone this floating IP will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewFloatingIPPrototypeFloatingIPByZone : Instantiate FloatingIPPrototypeFloatingIPByZone (Generic Model Constructor) +func (*VpcV1) NewFloatingIPPrototypeFloatingIPByZone(zone ZoneIdentityIntf) (_model *FloatingIPPrototypeFloatingIPByZone, err error) { + _model = &FloatingIPPrototypeFloatingIPByZone{ + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPPrototypeFloatingIPByZone) isaFloatingIPPrototype() bool { + return true +} + +// UnmarshalFloatingIPPrototypeFloatingIPByZone unmarshals an instance of FloatingIPPrototypeFloatingIPByZone from the specified map of raw messages. +func UnmarshalFloatingIPPrototypeFloatingIPByZone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPrototypeFloatingIPByZone) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity : Identifies a bare metal server network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID +// - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref +// This model "extends" FloatingIPTargetPatch +type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity struct { + // 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,omitempty"` + + // 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,omitempty"` +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPatchIntf + isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID +// - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref +// This model "extends" FloatingIPTargetPatch +type FloatingIPTargetPatchNetworkInterfaceIdentity struct { + // The unique identifier for this instance network interface. + // + // If this instance 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,omitempty"` + + // The URL for this instance network interface. + // + // If this instance 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,omitempty"` +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentity) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPatchNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPatchIntf + isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" FloatingIPTargetPatch +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentity struct { + // 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"` +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPatchIntf + isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity : Identifies a bare metal server network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID +// - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref +// This model "extends" FloatingIPTargetPrototype +type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity struct { + // 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,omitempty"` + + // 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,omitempty"` +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPrototypeIntf + isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID +// - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref +// This model "extends" FloatingIPTargetPrototype +type FloatingIPTargetPrototypeNetworkInterfaceIdentity struct { + // The unique identifier for this instance network interface. + // + // If this instance 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,omitempty"` + + // The URL for this instance network interface. + // + // If this instance 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,omitempty"` +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPrototypeNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPrototypeIntf + isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" FloatingIPTargetPrototype +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity struct { + // 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"` +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { + FloatingIPTargetPrototypeIntf + isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetBareMetalServerNetworkInterfaceReference : FloatingIPTargetBareMetalServerNetworkInterfaceReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetBareMetalServerNetworkInterfaceReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // 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 name for this bare metal server network interface. + Name *string `json:"name" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FloatingIPTargetBareMetalServerNetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetBareMetalServerNetworkInterfaceReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FloatingIPTargetBareMetalServerNetworkInterfaceReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference unmarshals an instance of FloatingIPTargetBareMetalServerNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetBareMetalServerNetworkInterfaceReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetNetworkInterfaceReference : FloatingIPTargetNetworkInterfaceReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetNetworkInterfaceReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance network interface. + // + // If this instance 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 instance network interface. + // + // If this instance 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 name for this instance network interface. + Name *string `json:"name" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FloatingIPTargetNetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetNetworkInterfaceReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FloatingIPTargetNetworkInterfaceReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetNetworkInterfaceReference unmarshals an instance of FloatingIPTargetNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetNetworkInterfaceReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPublicGatewayReference : FloatingIPTargetPublicGatewayReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetPublicGatewayReference struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` + + // The name for this public gateway. The name is unique across all public gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FloatingIPTargetPublicGatewayReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetPublicGatewayReferenceResourceTypePublicGatewayConst = "public_gateway" +) + +func (*FloatingIPTargetPublicGatewayReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetPublicGatewayReference unmarshals an instance of FloatingIPTargetPublicGatewayReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetPublicGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPublicGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPublicGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetVirtualNetworkInterfaceReference : FloatingIPTargetVirtualNetworkInterfaceReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetVirtualNetworkInterfaceReference struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VirtualNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The primary IP for this virtual network interface. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the FloatingIPTargetVirtualNetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetVirtualNetworkInterfaceReferenceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +func (*FloatingIPTargetVirtualNetworkInterfaceReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference unmarshals an instance of FloatingIPTargetVirtualNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetVirtualNetworkInterfaceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID +// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN +// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeInstanceIdentity struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentity) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeInstanceIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity : Identifies an instance network attachment by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID +// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity struct { + // The unique identifier for this instance network attachment. + ID *string `json:"id,omitempty"` + + // The URL for this instance network attachment. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID +// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity struct { + // The unique identifier for this instance network interface. + // + // If this instance 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,omitempty"` + + // The URL for this instance network interface. + // + // If this instance 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,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentity : Identifies a subnet by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID +// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN +// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeSubnetIdentity struct { + // The unique identifier for this subnet. + ID *string `json:"id,omitempty"` + + // The CRN for this subnet. + CRN *string `json:"crn,omitempty"` + + // The URL for this subnet. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentity) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeSubnetIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentity : Identifies a VPC by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID +// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN +// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeVPCIdentity struct { + // The unique identifier for this VPC. + ID *string `json:"id,omitempty"` + + // The CRN for this VPC. + CRN *string `json:"crn,omitempty"` + + // The URL for this VPC. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentity) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeVPCIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeVPCIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity struct { + // 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"` +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetInstanceNetworkAttachmentReference : FlowLogCollectorTargetInstanceNetworkAttachmentReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetInstanceNetworkAttachmentReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` + + // The name for this instance network attachment. The name is unique across all network attachments for the instance. + Name *string `json:"name" validate:"required"` + + // The primary IP address of the virtual network interface for the instance 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 instance network attachment. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetInstanceNetworkAttachmentReference.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetInstanceNetworkAttachmentReferenceResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" +) + +func (*FlowLogCollectorTargetInstanceNetworkAttachmentReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference unmarshals an instance of FlowLogCollectorTargetInstanceNetworkAttachmentReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetInstanceNetworkAttachmentReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetInstanceReference : FlowLogCollectorTargetInstanceReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetInstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. + Name *string `json:"name" validate:"required"` +} + +func (*FlowLogCollectorTargetInstanceReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetInstanceReference unmarshals an instance of FlowLogCollectorTargetInstanceReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext : FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this instance network interface. + // + // If this instance 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 instance network interface. + // + // If this instance 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 name for this instance network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetSubnetReference : FlowLogCollectorTargetSubnetReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetSubnetReference struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SubnetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this subnet. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` + + // The name for this subnet. The name is unique across all subnets in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetSubnetReference.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetSubnetReferenceResourceTypeSubnetConst = "subnet" +) + +func (*FlowLogCollectorTargetSubnetReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetSubnetReference unmarshals an instance of FlowLogCollectorTargetSubnetReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetSubnetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetSubnetReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSubnetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetVPCReference : FlowLogCollectorTargetVPCReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetVPCReference struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The name for this VPC. The name is unique across all VPCs in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetVPCReference.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetVPCReferenceResourceTypeVPCConst = "vpc" +) + +func (*FlowLogCollectorTargetVPCReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetVPCReference unmarshals an instance of FlowLogCollectorTargetVPCReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetVPCReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetVPCReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext : FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +func (*FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext unmarshals an instance of FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentityByCRN : ImageIdentityByCRN struct +// This model "extends" ImageIdentity +type ImageIdentityByCRN struct { + // The CRN for this image. + CRN *string `json:"crn" validate:"required"` +} + +// NewImageIdentityByCRN : Instantiate ImageIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewImageIdentityByCRN(crn string) (_model *ImageIdentityByCRN, err error) { + _model = &ImageIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImageIdentityByCRN) isaImageIdentity() bool { + return true +} + +// UnmarshalImageIdentityByCRN unmarshals an instance of ImageIdentityByCRN from the specified map of raw messages. +func UnmarshalImageIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentityByHref : ImageIdentityByHref struct +// This model "extends" ImageIdentity +type ImageIdentityByHref struct { + // The URL for this image. + Href *string `json:"href" validate:"required"` +} + +// NewImageIdentityByHref : Instantiate ImageIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewImageIdentityByHref(href string) (_model *ImageIdentityByHref, err error) { + _model = &ImageIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImageIdentityByHref) isaImageIdentity() bool { + return true +} + +// UnmarshalImageIdentityByHref unmarshals an instance of ImageIdentityByHref from the specified map of raw messages. +func UnmarshalImageIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentityByID : ImageIdentityByID struct +// This model "extends" ImageIdentity +type ImageIdentityByID struct { + // The unique identifier for this image. + ID *string `json:"id" validate:"required"` +} + +// NewImageIdentityByID : Instantiate ImageIdentityByID (Generic Model Constructor) +func (*VpcV1) NewImageIdentityByID(id string) (_model *ImageIdentityByID, err error) { + _model = &ImageIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImageIdentityByID) isaImageIdentity() bool { + return true +} + +// UnmarshalImageIdentityByID unmarshals an instance of ImageIdentityByID from the specified map of raw messages. +func UnmarshalImageIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImagePrototypeImageByFile : ImagePrototypeImageByFile struct +// This model "extends" ImagePrototype +type ImagePrototypeImageByFile struct { + // The deprecation date and time to set for this image. + // + // The date and time must not be in the past, and must be earlier than `obsolescence_at` + // (if `obsolescence_at` is set). + // + // If unspecified, no deprecation date and time will be set. + // + // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will + // transition to `deprecated` upon its successful creation (or + // `obsolete` if the obsolescence date and time was also reached). + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are + // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The obsolescence date and time to set for this image. + // + // The date and time must not be in the past, and must be later than `deprecation_at` (if + // `deprecation_at` is set). + // + // If unspecified, no obsolescence date and time will be set. + // + // If the obsolescence date and time is reached while the image has a status of + // `pending`, the image's status will transition to `obsolete` upon its successful creation. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. + // + // That representation is created by wrapping the key's value with the `encryption_key` root key (which must also be + // specified), using either [Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the + // [Hyper Protect Crypto Services](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). + // + // If unspecified, the imported image is treated as unencrypted. + EncryptedDataKey *string `json:"encrypted_data_key,omitempty"` + + // The root key that was used to wrap the data key (which is ultimately represented as + // `encrypted_data_key`). Additionally, the root key will be used to encrypt volumes + // created from this image (unless an alternate `encryption_key` is specified at volume + // creation). + // + // If unspecified, the imported image is treated as unencrypted. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The file from which to create the image. + File *ImageFilePrototype `json:"file" validate:"required"` + + // The [supported operating + // system](https://cloud.ibm.com/apidocs/vpc#list-operating-systems) included in this + // image. + OperatingSystem OperatingSystemIdentityIntf `json:"operating_system" validate:"required"` +} + +// NewImagePrototypeImageByFile : Instantiate ImagePrototypeImageByFile (Generic Model Constructor) +func (*VpcV1) NewImagePrototypeImageByFile(file *ImageFilePrototype, operatingSystem OperatingSystemIdentityIntf) (_model *ImagePrototypeImageByFile, err error) { + _model = &ImagePrototypeImageByFile{ + File: file, + OperatingSystem: operatingSystem, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImagePrototypeImageByFile) isaImagePrototype() bool { + return true +} + +// UnmarshalImagePrototypeImageByFile unmarshals an instance of ImagePrototypeImageByFile from the specified map of raw messages. +func UnmarshalImagePrototypeImageByFile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePrototypeImageByFile) + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImagePrototypeImageBySourceVolume : ImagePrototypeImageBySourceVolume struct +// This model "extends" ImagePrototype +type ImagePrototypeImageBySourceVolume struct { + // The deprecation date and time to set for this image. + // + // The date and time must not be in the past, and must be earlier than `obsolescence_at` + // (if `obsolescence_at` is set). + // + // If unspecified, no deprecation date and time will be set. + // + // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will + // transition to `deprecated` upon its successful creation (or + // `obsolete` if the obsolescence date and time was also reached). + DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` + + // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are + // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The obsolescence date and time to set for this image. + // + // The date and time must not be in the past, and must be later than `deprecation_at` (if + // `deprecation_at` is set). + // + // If unspecified, no obsolescence date and time will be set. + // + // If the obsolescence date and time is reached while the image has a status of + // `pending`, the image's status will transition to `obsolete` upon its successful creation. + ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The root key used to wrap the system-generated data encryption key for the image. + // + // If unspecified, the root key from `source_volume` will be used. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The volume from which to create the image. The specified volume must: + // - Have an `operating_system`, which will be used to populate this image's + // operating system information. + // - Not be `active` or `busy`. + // + // During image creation, the specified volume may briefly become `busy`. + SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` +} + +// NewImagePrototypeImageBySourceVolume : Instantiate ImagePrototypeImageBySourceVolume (Generic Model Constructor) +func (*VpcV1) NewImagePrototypeImageBySourceVolume(sourceVolume VolumeIdentityIntf) (_model *ImagePrototypeImageBySourceVolume, err error) { + _model = &ImagePrototypeImageBySourceVolume{ + SourceVolume: sourceVolume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ImagePrototypeImageBySourceVolume) isaImagePrototype() bool { + return true +} + +// UnmarshalImagePrototypeImageBySourceVolume unmarshals an instance of ImagePrototypeImageBySourceVolume from the specified map of raw messages. +func UnmarshalImagePrototypeImageBySourceVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePrototypeImageBySourceVolume) + err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "obsolescence_at", &obj.ObsolescenceAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCatalogOfferingPrototypeCatalogOfferingByOffering : InstanceCatalogOfferingPrototypeCatalogOfferingByOffering struct +// This model "extends" InstanceCatalogOfferingPrototype +type InstanceCatalogOfferingPrototypeCatalogOfferingByOffering struct { + // Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering by a unique property. + Offering CatalogOfferingIdentityIntf `json:"offering" validate:"required"` +} + +// NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering : Instantiate InstanceCatalogOfferingPrototypeCatalogOfferingByOffering (Generic Model Constructor) +func (*VpcV1) NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(offering CatalogOfferingIdentityIntf) (_model *InstanceCatalogOfferingPrototypeCatalogOfferingByOffering, err error) { + _model = &InstanceCatalogOfferingPrototypeCatalogOfferingByOffering{ + Offering: offering, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceCatalogOfferingPrototypeCatalogOfferingByOffering) isaInstanceCatalogOfferingPrototype() bool { + return true +} + +// UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering unmarshals an instance of InstanceCatalogOfferingPrototypeCatalogOfferingByOffering from the specified map of raw messages. +func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByOffering) + err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCatalogOfferingPrototypeCatalogOfferingByVersion : InstanceCatalogOfferingPrototypeCatalogOfferingByVersion struct +// This model "extends" InstanceCatalogOfferingPrototype +type InstanceCatalogOfferingPrototypeCatalogOfferingByVersion struct { + // Identifies a version of a + // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a + // unique property. + Version CatalogOfferingVersionIdentityIntf `json:"version" validate:"required"` +} + +// NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion : Instantiate InstanceCatalogOfferingPrototypeCatalogOfferingByVersion (Generic Model Constructor) +func (*VpcV1) NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(version CatalogOfferingVersionIdentityIntf) (_model *InstanceCatalogOfferingPrototypeCatalogOfferingByVersion, err error) { + _model = &InstanceCatalogOfferingPrototypeCatalogOfferingByVersion{ + Version: version, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceCatalogOfferingPrototypeCatalogOfferingByVersion) isaInstanceCatalogOfferingPrototype() bool { + return true +} + +// UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion unmarshals an instance of InstanceCatalogOfferingPrototypeCatalogOfferingByVersion from the specified map of raw messages. +func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByVersion) + err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototype : InstanceGroupManagerActionPrototypeScheduledActionPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec +// This model "extends" InstanceGroupManagerActionPrototype +type InstanceGroupManagerActionPrototypeScheduledActionPrototype struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototype) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf interface { + InstanceGroupManagerActionPrototypeIntf + isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototype) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototype unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionScheduledAction : InstanceGroupManagerActionScheduledAction struct +// Models which "extend" this model: +// - InstanceGroupManagerActionScheduledActionGroupTarget +// - InstanceGroupManagerActionScheduledActionManagerTarget +// This model "extends" InstanceGroupManagerAction +type InstanceGroupManagerActionScheduledAction struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. 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`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the + // future. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` + + // The date and time that the instance group manager action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type" validate:"required"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroup `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager,omitempty"` +} + +// Constants associated with the InstanceGroupManagerActionScheduledAction.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionScheduledActionResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerActionScheduledAction.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionScheduledActionStatusActiveConst = "active" + InstanceGroupManagerActionScheduledActionStatusCompletedConst = "completed" + InstanceGroupManagerActionScheduledActionStatusFailedConst = "failed" + InstanceGroupManagerActionScheduledActionStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionScheduledActionStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerActionScheduledAction.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionScheduledActionActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerActionScheduledAction) isaInstanceGroupManagerActionScheduledAction() bool { + return true +} + +type InstanceGroupManagerActionScheduledActionIntf interface { + InstanceGroupManagerActionIntf + isaInstanceGroupManagerActionScheduledAction() bool +} + +func (*InstanceGroupManagerActionScheduledAction) isaInstanceGroupManagerAction() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionScheduledAction unmarshals an instance of InstanceGroupManagerActionScheduledAction from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionScheduledAction(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionScheduledAction) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerAutoScale : InstanceGroupManagerAutoScale struct +// This model "extends" InstanceGroupManager +type InstanceGroupManagerAutoScale struct { + // The date and time that the instance group manager was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled" validate:"required"` + + // The name for this instance group manager. The name is unique across all managers for the instance group. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window" validate:"required"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown" validate:"required"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type" validate:"required"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count" validate:"required"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count" validate:"required"` + + // The policies of the instance group manager. + Policies []InstanceGroupManagerPolicyReference `json:"policies" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerAutoScale.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerAutoScaleManagerTypeAutoscaleConst = "autoscale" +) + +func (*InstanceGroupManagerAutoScale) isaInstanceGroupManager() bool { + return true +} + +// UnmarshalInstanceGroupManagerAutoScale unmarshals an instance of InstanceGroupManagerAutoScale from the specified map of raw messages. +func UnmarshalInstanceGroupManagerAutoScale(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerAutoScale) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype : InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype struct +// This model "extends" InstanceGroupManagerPolicyPrototype +type InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype struct { + // The name for this instance group manager policy. The name must not be used by another policy for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type" validate:"required"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value" validate:"required"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypePolicyTypeTargetConst = "target" +) + +// NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype : Instantiate InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype(metricType string, metricValue int64, policyType string) (_model *InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype, err error) { + _model = &InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype{ + MetricType: core.StringPtr(metricType), + MetricValue: core.Int64Ptr(metricValue), + PolicyType: core.StringPtr(policyType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) isaInstanceGroupManagerPolicyPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype unmarshals an instance of InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy : InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy struct +// This model "extends" InstanceGroupManagerPolicy +type InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy struct { + // The date and time that the instance group manager policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager policy. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager policy. The name is unique across all policies for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager policy was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type" validate:"required"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value" validate:"required"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyPolicyTypeTargetConst = "target" +) + +func (*InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy) isaInstanceGroupManagerPolicy() bool { + return true +} + +// UnmarshalInstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy unmarshals an instance of InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype : InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype struct +// This model "extends" InstanceGroupManagerPrototype +type InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype struct { + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The name for this instance group manager. The name must not be used by another manager for the instance group. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type" validate:"required"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count" validate:"required"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototypeManagerTypeAutoscaleConst = "autoscale" +) + +// NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype : Instantiate InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype(managerType string, maxMembershipCount int64) (_model *InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype, err error) { + _model = &InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype{ + ManagerType: core.StringPtr(managerType), + MaxMembershipCount: core.Int64Ptr(maxMembershipCount), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) isaInstanceGroupManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype unmarshals an instance of InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype : InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype struct +// This model "extends" InstanceGroupManagerPrototype +type InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype struct { + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The name for this instance group manager. The name must not be used by another manager for the instance group. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototypeManagerTypeScheduledConst = "scheduled" +) + +// NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype : Instantiate InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype(managerType string) (_model *InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype, err error) { + _model = &InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype{ + ManagerType: core.StringPtr(managerType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype) isaInstanceGroupManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype unmarshals an instance of InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype) + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduled : InstanceGroupManagerScheduled struct +// This model "extends" InstanceGroupManager +type InstanceGroupManagerScheduled struct { + // The date and time that the instance group manager was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // Indicates whether this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled" validate:"required"` + + // The name for this instance group manager. The name is unique across all managers for the instance group. + Name *string `json:"name" validate:"required"` + + // The date and time that the instance group manager was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The actions of the instance group manager. + Actions []InstanceGroupManagerActionReference `json:"actions" validate:"required"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerScheduled.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerScheduledManagerTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerScheduled) isaInstanceGroupManager() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduled unmarshals an instance of InstanceGroupManagerScheduled from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduled(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduled) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerAutoScale : InstanceGroupManagerScheduledActionManagerAutoScale struct +// This model "extends" InstanceGroupManagerScheduledActionManager +type InstanceGroupManagerScheduledActionManagerAutoScale struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager. The name is unique across all managers for the instance group. + Name *string `json:"name" validate:"required"` + + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +func (*InstanceGroupManagerScheduledActionManagerAutoScale) isaInstanceGroupManagerScheduledActionManager() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerAutoScale unmarshals an instance of InstanceGroupManagerScheduledActionManagerAutoScale from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerAutoScale(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerAutoScale) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype : The auto scale manager to update, and one or more properties to be updated. Either `id` or `href` must be specified, +// in addition to at least one of `min_membership_count` and +// `max_membership_count`. +// Models which "extend" this model: +// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID +// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref +// This model "extends" InstanceGroupManagerScheduledActionManagerPrototype +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The unique identifier for this instance group manager. + ID *string `json:"id,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href,omitempty"` +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { + return true +} + +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeIntf interface { + InstanceGroupManagerScheduledActionManagerPrototypeIntf + isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterface +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity struct { + // 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"` +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityIntf interface { + InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf + isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext : The virtual network interface for this target. +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterface +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext 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"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,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"` + + // 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"` + + // 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 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"` + + // The resource group to use for this virtual network interface. If unspecified, the + // virtual server instance's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,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"` +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePatchProfileInstanceProfileIdentityByHref : InstancePatchProfileInstanceProfileIdentityByHref struct +// This model "extends" InstancePatchProfile +type InstancePatchProfileInstanceProfileIdentityByHref struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePatchProfileInstanceProfileIdentityByHref : Instantiate InstancePatchProfileInstanceProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByHref(href string) (_model *InstancePatchProfileInstanceProfileIdentityByHref, err error) { + _model = &InstancePatchProfileInstanceProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePatchProfileInstanceProfileIdentityByHref) isaInstancePatchProfile() bool { + return true +} + +// UnmarshalInstancePatchProfileInstanceProfileIdentityByHref unmarshals an instance of InstancePatchProfileInstanceProfileIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePatchProfileInstanceProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatchProfileInstanceProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePatchProfileInstanceProfileIdentityByName : InstancePatchProfileInstanceProfileIdentityByName struct +// This model "extends" InstancePatchProfile +type InstancePatchProfileInstanceProfileIdentityByName struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` +} + +// NewInstancePatchProfileInstanceProfileIdentityByName : Instantiate InstancePatchProfileInstanceProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByName(name string) (_model *InstancePatchProfileInstanceProfileIdentityByName, err error) { + _model = &InstancePatchProfileInstanceProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePatchProfileInstanceProfileIdentityByName) isaInstancePatchProfile() bool { + return true +} + +// UnmarshalInstancePatchProfileInstanceProfileIdentityByName unmarshals an instance of InstancePatchProfileInstanceProfileIdentityByName from the specified map of raw messages. +func UnmarshalInstancePatchProfileInstanceProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatchProfileInstanceProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID +// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN +// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref +// This model "extends" InstancePlacementTargetPatch +type InstancePlacementTargetPatchDedicatedHostGroupIdentity struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host group. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentity) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +type InstancePlacementTargetPatchDedicatedHostGroupIdentityIntf interface { + InstancePlacementTargetPatchIntf + isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentity) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentity unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentity : Identifies a dedicated host by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID +// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN +// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref +// This model "extends" InstancePlacementTargetPatch +type InstancePlacementTargetPatchDedicatedHostIdentity struct { + // The unique identifier for this dedicated host. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentity) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +type InstancePlacementTargetPatchDedicatedHostIdentityIntf interface { + InstancePlacementTargetPatchIntf + isaInstancePlacementTargetPatchDedicatedHostIdentity() bool +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentity) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentity unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID +// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN +// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref +// This model "extends" InstancePlacementTargetPrototype +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentity struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host group. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityIntf interface { + InstancePlacementTargetPrototypeIntf + isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentity unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentity : Identifies a dedicated host by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID +// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN +// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref +// This model "extends" InstancePlacementTargetPrototype +type InstancePlacementTargetPrototypeDedicatedHostIdentity struct { + // The unique identifier for this dedicated host. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentity) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +type InstancePlacementTargetPrototypeDedicatedHostIdentityIntf interface { + InstancePlacementTargetPrototypeIntf + isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentity) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentity unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentity : Identifies a placement group by a unique property. +// Models which "extend" this model: +// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID +// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN +// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref +// This model "extends" InstancePlacementTargetPrototype +type InstancePlacementTargetPrototypePlacementGroupIdentity struct { + // The unique identifier for this placement group. + ID *string `json:"id,omitempty"` + + // The CRN for this placement group. + CRN *string `json:"crn,omitempty"` + + // The URL for this placement group. + Href *string `json:"href,omitempty"` +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentity) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +type InstancePlacementTargetPrototypePlacementGroupIdentityIntf interface { + InstancePlacementTargetPrototypeIntf + isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentity) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentity unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentity from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetDedicatedHostGroupReference : InstancePlacementTargetDedicatedHostGroupReference struct +// This model "extends" InstancePlacementTarget +type InstancePlacementTargetDedicatedHostGroupReference struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` + + // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstancePlacementTargetDedicatedHostGroupReference.ResourceType property. +// The resource type. +const ( + InstancePlacementTargetDedicatedHostGroupReferenceResourceTypeDedicatedHostGroupConst = "dedicated_host_group" +) + +func (*InstancePlacementTargetDedicatedHostGroupReference) isaInstancePlacementTarget() bool { + return true +} + +// UnmarshalInstancePlacementTargetDedicatedHostGroupReference unmarshals an instance of InstancePlacementTargetDedicatedHostGroupReference from the specified map of raw messages. +func UnmarshalInstancePlacementTargetDedicatedHostGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetDedicatedHostGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetDedicatedHostReference : InstancePlacementTargetDedicatedHostReference struct +// This model "extends" InstancePlacementTarget +type InstancePlacementTargetDedicatedHostReference struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *DedicatedHostReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` + + // The name for this dedicated host. The name is unique across all dedicated hosts in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstancePlacementTargetDedicatedHostReference.ResourceType property. +// The resource type. +const ( + InstancePlacementTargetDedicatedHostReferenceResourceTypeDedicatedHostConst = "dedicated_host" +) + +func (*InstancePlacementTargetDedicatedHostReference) isaInstancePlacementTarget() bool { + return true +} + +// UnmarshalInstancePlacementTargetDedicatedHostReference unmarshals an instance of InstancePlacementTargetDedicatedHostReference from the specified map of raw messages. +func UnmarshalInstancePlacementTargetDedicatedHostReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetDedicatedHostReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPlacementGroupReference : InstancePlacementTargetPlacementGroupReference struct +// This model "extends" InstancePlacementTarget +type InstancePlacementTargetPlacementGroupReference struct { + // The CRN for this placement group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *PlacementGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this placement group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this placement group. + ID *string `json:"id" validate:"required"` + + // The name for this placement group. The name is unique across all placement groups in the region. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstancePlacementTargetPlacementGroupReference.ResourceType property. +// The resource type. +const ( + InstancePlacementTargetPlacementGroupReferenceResourceTypePlacementGroupConst = "placement_group" +) + +func (*InstancePlacementTargetPlacementGroupReference) isaInstancePlacementTarget() bool { + return true +} + +// UnmarshalInstancePlacementTargetPlacementGroupReference unmarshals an instance of InstancePlacementTargetPlacementGroupReference from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPlacementGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPlacementGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPlacementGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthDependent : The total bandwidth shared across the network attachments or network interfaces and storage volumes of an instance +// with this profile depends on its configuration. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileBandwidthDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileBandwidthDependent) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthDependent unmarshals an instance of InstanceProfileBandwidthDependent from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network attachments or network +// interfaces and storage volumes of an instance with this profile. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileBandwidthEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileBandwidthEnum) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthEnum unmarshals an instance of InstanceProfileBandwidthEnum from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network attachments or network interfaces and storage +// volumes of an instance with this profile. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileBandwidthFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileBandwidthFixed) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthFixed unmarshals an instance of InstanceProfileBandwidthFixed from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network attachments or network +// interfaces and storage volumes of an instance with this profile. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileBandwidthRange.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthRangeTypeRangeConst = "range" +) + +func (*InstanceProfileBandwidthRange) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthRange unmarshals an instance of InstanceProfileBandwidthRange from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + 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 { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskQuantityDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileDiskQuantityDependent) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityDependent unmarshals an instance of InstanceProfileDiskQuantityDependent from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantityEnum : The permitted the number of disks of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskQuantity +type InstanceProfileDiskQuantityEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileDiskQuantityEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileDiskQuantityEnum) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityEnum unmarshals an instance of InstanceProfileDiskQuantityEnum from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantityFixed : The number of disks of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskQuantity +type InstanceProfileDiskQuantityFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskQuantityFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskQuantityFixed) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityFixed unmarshals an instance of InstanceProfileDiskQuantityFixed from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantityRange : The permitted range for the number of disks of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskQuantity +type InstanceProfileDiskQuantityRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskQuantityRange.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityRangeTypeRangeConst = "range" +) + +func (*InstanceProfileDiskQuantityRange) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityRange unmarshals an instance of InstanceProfileDiskQuantityRange from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeDependent : The disk size in GB (gigabytes) of this configuration for an instance with this profile depends on its instance +// configuration. +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSizeDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileDiskSizeDependent) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeDependent unmarshals an instance of InstanceProfileDiskSizeDependent from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeEnum : The permitted disk size in GB (gigabytes) of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileDiskSizeEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileDiskSizeEnum) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeEnum unmarshals an instance of InstanceProfileDiskSizeEnum from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeFixed : The size of the disk in GB (gigabytes). +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSizeFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskSizeFixed) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeFixed unmarshals an instance of InstanceProfileDiskSizeFixed from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeRange : The permitted range for the disk size of this configuration in GB (gigabytes) for an instance with this profile. +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSizeRange.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeRangeTypeRangeConst = "range" +) + +func (*InstanceProfileDiskSizeRange) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeRange unmarshals an instance of InstanceProfileDiskSizeRange from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuDependent : The GPU count for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileGpu +type InstanceProfileGpuDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileGpuDependent) isaInstanceProfileGpu() bool { + return true +} + +// UnmarshalInstanceProfileGpuDependent unmarshals an instance of InstanceProfileGpuDependent from the specified map of raw messages. +func UnmarshalInstanceProfileGpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuEnum : The permitted GPU count values for an instance with this profile. +// This model "extends" InstanceProfileGpu +type InstanceProfileGpuEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileGpuEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileGpuEnum) isaInstanceProfileGpu() bool { + return true +} + +// UnmarshalInstanceProfileGpuEnum unmarshals an instance of InstanceProfileGpuEnum from the specified map of raw messages. +func UnmarshalInstanceProfileGpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuFixed : The GPU count for an instance with this profile. +// This model "extends" InstanceProfileGpu +type InstanceProfileGpuFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileGpuFixed) isaInstanceProfileGpu() bool { + return true +} + +// UnmarshalInstanceProfileGpuFixed unmarshals an instance of InstanceProfileGpuFixed from the specified map of raw messages. +func UnmarshalInstanceProfileGpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemoryDependent : The overall GPU memory value for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileGpuMemory +type InstanceProfileGpuMemoryDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuMemoryDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileGpuMemoryDependent) isaInstanceProfileGpuMemory() bool { + return true +} + +// UnmarshalInstanceProfileGpuMemoryDependent unmarshals an instance of InstanceProfileGpuMemoryDependent from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemoryDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemoryEnum : The permitted overall GPU memory values in GiB (gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileGpuMemory +type InstanceProfileGpuMemoryEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileGpuMemoryEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileGpuMemoryEnum) isaInstanceProfileGpuMemory() bool { + return true +} + +// UnmarshalInstanceProfileGpuMemoryEnum unmarshals an instance of InstanceProfileGpuMemoryEnum from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemoryEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemoryFixed : The overall GPU memory in GiB (gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileGpuMemory +type InstanceProfileGpuMemoryFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuMemoryFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileGpuMemoryFixed) isaInstanceProfileGpuMemory() bool { + return true +} + +// UnmarshalInstanceProfileGpuMemoryFixed unmarshals an instance of InstanceProfileGpuMemoryFixed from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemoryFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuMemoryRange : The permitted overall GPU memory range in GiB (gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileGpuMemory +type InstanceProfileGpuMemoryRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuMemoryRange.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuMemoryRangeTypeRangeConst = "range" +) + +func (*InstanceProfileGpuMemoryRange) isaInstanceProfileGpuMemory() bool { + return true +} + +// UnmarshalInstanceProfileGpuMemoryRange unmarshals an instance of InstanceProfileGpuMemoryRange from the specified map of raw messages. +func UnmarshalInstanceProfileGpuMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuMemoryRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileGpuRange : The permitted GPU count range for an instance with this profile. +// This model "extends" InstanceProfileGpu +type InstanceProfileGpuRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileGpuRange.Type property. +// The type for this profile field. +const ( + InstanceProfileGpuRangeTypeRangeConst = "range" +) + +func (*InstanceProfileGpuRange) isaInstanceProfileGpu() bool { + return true +} + +// UnmarshalInstanceProfileGpuRange unmarshals an instance of InstanceProfileGpuRange from the specified map of raw messages. +func UnmarshalInstanceProfileGpuRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileGpuRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileIdentityByHref : InstanceProfileIdentityByHref struct +// This model "extends" InstanceProfileIdentity +type InstanceProfileIdentityByHref struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceProfileIdentityByHref : Instantiate InstanceProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceProfileIdentityByHref(href string) (_model *InstanceProfileIdentityByHref, err error) { + _model = &InstanceProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceProfileIdentityByHref) isaInstanceProfileIdentity() bool { + return true +} + +// UnmarshalInstanceProfileIdentityByHref unmarshals an instance of InstanceProfileIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileIdentityByName : InstanceProfileIdentityByName struct +// This model "extends" InstanceProfileIdentity +type InstanceProfileIdentityByName struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` +} + +// NewInstanceProfileIdentityByName : Instantiate InstanceProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewInstanceProfileIdentityByName(name string) (_model *InstanceProfileIdentityByName, err error) { + _model = &InstanceProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceProfileIdentityByName) isaInstanceProfileIdentity() bool { + return true +} + +// UnmarshalInstanceProfileIdentityByName unmarshals an instance of InstanceProfileIdentityByName from the specified map of raw messages. +func UnmarshalInstanceProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryDependent : The memory value for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileMemoryDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileMemoryDependent) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryDependent unmarshals an instance of InstanceProfileMemoryDependent from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryEnum : The permitted memory values (in gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileMemoryEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileMemoryEnum) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryEnum unmarshals an instance of InstanceProfileMemoryEnum from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryFixed : The memory (in gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileMemoryFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileMemoryFixed) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryFixed unmarshals an instance of InstanceProfileMemoryFixed from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryRange : The permitted memory range (in gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileMemoryRange.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryRangeTypeRangeConst = "range" +) + +func (*InstanceProfileMemoryRange) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryRange unmarshals an instance of InstanceProfileMemoryRange from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNumaCountDependent : The total number of NUMA nodes for an instance with this profile depends on its configuration and the capacity +// constraints within the zone. +// This model "extends" InstanceProfileNumaCount +type InstanceProfileNumaCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileNumaCountDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileNumaCountDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileNumaCountDependent) isaInstanceProfileNumaCount() bool { + return true +} + +// UnmarshalInstanceProfileNumaCountDependent unmarshals an instance of InstanceProfileNumaCountDependent from the specified map of raw messages. +func UnmarshalInstanceProfileNumaCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNumaCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNumaCountFixed : The total number of NUMA nodes for an instance with this profile. +// This model "extends" InstanceProfileNumaCount +type InstanceProfileNumaCountFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileNumaCountFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileNumaCountFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileNumaCountFixed) isaInstanceProfileNumaCount() bool { + return true +} + +// UnmarshalInstanceProfileNumaCountFixed unmarshals an instance of InstanceProfileNumaCountFixed from the specified map of raw messages. +func UnmarshalInstanceProfileNumaCountFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNumaCountFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkAttachmentCountDependent : The number of network attachments supported on an instance with this profile is dependent on its configuration. +// This model "extends" InstanceProfileNetworkAttachmentCount +type InstanceProfileNetworkAttachmentCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileNetworkAttachmentCountDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkAttachmentCountDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileNetworkAttachmentCountDependent) isaInstanceProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalInstanceProfileNetworkAttachmentCountDependent unmarshals an instance of InstanceProfileNetworkAttachmentCountDependent from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkAttachmentCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkAttachmentCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkAttachmentCountRange : The number of network attachments supported on an instance with this profile. +// This model "extends" InstanceProfileNetworkAttachmentCount +type InstanceProfileNetworkAttachmentCountRange 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" validate:"required"` +} + +// Constants associated with the InstanceProfileNetworkAttachmentCountRange.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkAttachmentCountRangeTypeRangeConst = "range" +) + +func (*InstanceProfileNetworkAttachmentCountRange) isaInstanceProfileNetworkAttachmentCount() bool { + return true +} + +// UnmarshalInstanceProfileNetworkAttachmentCountRange unmarshals an instance of InstanceProfileNetworkAttachmentCountRange from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkAttachmentCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkAttachmentCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkInterfaceCountDependent : The number of network interfaces supported on an instance with this profile is dependent on its configuration. +// This model "extends" InstanceProfileNetworkInterfaceCount +type InstanceProfileNetworkInterfaceCountDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileNetworkInterfaceCountDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkInterfaceCountDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileNetworkInterfaceCountDependent) isaInstanceProfileNetworkInterfaceCount() bool { + return true +} + +// UnmarshalInstanceProfileNetworkInterfaceCountDependent unmarshals an instance of InstanceProfileNetworkInterfaceCountDependent from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkInterfaceCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkInterfaceCountDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileNetworkInterfaceCountRange : The number of network interfaces supported on an instance with this profile. +// This model "extends" InstanceProfileNetworkInterfaceCount +type InstanceProfileNetworkInterfaceCountRange 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" validate:"required"` +} + +// Constants associated with the InstanceProfileNetworkInterfaceCountRange.Type property. +// The type for this profile field. +const ( + InstanceProfileNetworkInterfaceCountRangeTypeRangeConst = "range" +) + +func (*InstanceProfileNetworkInterfaceCountRange) isaInstanceProfileNetworkInterfaceCount() bool { + return true +} + +// UnmarshalInstanceProfileNetworkInterfaceCountRange unmarshals an instance of InstanceProfileNetworkInterfaceCountRange from the specified map of raw messages. +func UnmarshalInstanceProfileNetworkInterfaceCountRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileNetworkInterfaceCountRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfilePortSpeedDependent : The port speed of each network interface of an instance with this profile depends on its configuration. +// This model "extends" InstanceProfilePortSpeed +type InstanceProfilePortSpeedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfilePortSpeedDependent.Type property. +// The type for this profile field. +const ( + InstanceProfilePortSpeedDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfilePortSpeedDependent) isaInstanceProfilePortSpeed() bool { + return true +} + +// UnmarshalInstanceProfilePortSpeedDependent unmarshals an instance of InstanceProfilePortSpeedDependent from the specified map of raw messages. +func UnmarshalInstanceProfilePortSpeedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfilePortSpeedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfilePortSpeedFixed : The maximum speed (in megabits per second) of each network interface of an instance with this profile. +// This model "extends" InstanceProfilePortSpeed +type InstanceProfilePortSpeedFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfilePortSpeedFixed.Type property. +// The type for this profile field. +const ( + InstanceProfilePortSpeedFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfilePortSpeedFixed) isaInstanceProfilePortSpeed() bool { + return true +} + +// UnmarshalInstanceProfilePortSpeedFixed unmarshals an instance of InstanceProfilePortSpeedFixed from the specified map of raw messages. +func UnmarshalInstanceProfilePortSpeedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfilePortSpeedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuDependent : The VCPU count for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileVcpuDependent) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuDependent unmarshals an instance of InstanceProfileVcpuDependent from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuEnum : The permitted values for VCPU count for an instance with this profile. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileVcpuEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileVcpuEnum) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuEnum unmarshals an instance of InstanceProfileVcpuEnum from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuFixed : The VCPU count for an instance with this profile. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileVcpuFixed) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuFixed unmarshals an instance of InstanceProfileVcpuFixed from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuRange : The permitted range for VCPU count for an instance with this profile. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuRange.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuRangeTypeRangeConst = "range" +) + +func (*InstanceProfileVcpuRange) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuRange unmarshals an instance of InstanceProfileVcpuRange from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidthDependent : The storage bandwidth shared across the storage volumes of an instance with this profile depends on its +// configuration. +// This model "extends" InstanceProfileVolumeBandwidth +type InstanceProfileVolumeBandwidthDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVolumeBandwidthDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileVolumeBandwidthDependent) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileVolumeBandwidthDependent unmarshals an instance of InstanceProfileVolumeBandwidthDependent from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidthDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidthEnum : The permitted storage bandwidth values (in megabits per second) shared across the storage volumes of an instance with +// this profile. +// This model "extends" InstanceProfileVolumeBandwidth +type InstanceProfileVolumeBandwidthEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 InstanceProfileVolumeBandwidthEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileVolumeBandwidthEnum) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileVolumeBandwidthEnum unmarshals an instance of InstanceProfileVolumeBandwidthEnum from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidthEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidthFixed : The storage bandwidth (in megabits per second) shared across the storage volumes of an instance with this profile. +// This model "extends" InstanceProfileVolumeBandwidth +type InstanceProfileVolumeBandwidthFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileVolumeBandwidthFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileVolumeBandwidthFixed) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileVolumeBandwidthFixed unmarshals an instance of InstanceProfileVolumeBandwidthFixed from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidthFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVolumeBandwidthRange : The permitted storage bandwidth range (in megabits per second) shared across the storage volumes of an instance with +// this profile. +// This model "extends" InstanceProfileVolumeBandwidth +type InstanceProfileVolumeBandwidthRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVolumeBandwidthRange.Type property. +// The type for this profile field. +const ( + InstanceProfileVolumeBandwidthRangeTypeRangeConst = "range" +) + +func (*InstanceProfileVolumeBandwidthRange) isaInstanceProfileVolumeBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileVolumeBandwidthRange unmarshals an instance of InstanceProfileVolumeBandwidthRange from the specified map of raw messages. +func UnmarshalInstanceProfileVolumeBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVolumeBandwidthRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByCatalogOffering : Create an instance by using a catalog offering. +// Models which "extend" this model: +// - InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment +// - InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface +// This model "extends" InstancePrototype +type InstancePrototypeInstanceByCatalogOffering struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototypeInstanceByCatalogOffering() bool { + return true +} + +type InstancePrototypeInstanceByCatalogOfferingIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceByCatalogOffering() bool +} + +func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByCatalogOffering unmarshals an instance of InstancePrototypeInstanceByCatalogOffering from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByCatalogOffering) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByImage : Create an instance by using an image. +// Models which "extend" this model: +// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment +// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface +// This model "extends" InstancePrototype +type InstancePrototypeInstanceByImage struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstancePrototypeInstanceByImage) isaInstancePrototypeInstanceByImage() bool { + return true +} + +type InstancePrototypeInstanceByImageIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceByImage() bool +} + +func (*InstancePrototypeInstanceByImage) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByImage unmarshals an instance of InstancePrototypeInstanceByImage from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByImage) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceSnapshot : Create an instance by using a snapshot. +// Models which "extend" this model: +// - InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment +// - InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface +// This model "extends" InstancePrototype +type InstancePrototypeInstanceBySourceSnapshot struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototypeInstanceBySourceSnapshot() bool { + return true +} + +type InstancePrototypeInstanceBySourceSnapshotIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceBySourceSnapshot() bool +} + +func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceSnapshot unmarshals an instance of InstancePrototypeInstanceBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceSnapshot) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceTemplate : Create an instance by using an instance template. +// +// The `primary_network_attachment` and `network_attachments` properties may only be specified if +// `primary_network_attachment` is specified in the source template. +// +// The `primary_network_interface` and `network_interfaces` properties may only be specified if +// `primary_network_interface` is specified in the source template. +// This model "extends" InstancePrototype +type InstancePrototypeInstanceBySourceTemplate struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering version to use when provisioning this virtual server instance. + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account, subject to + // IAM policies. + // + // If specified, `image` must not be specified, and `source_template` must not have + // `image` specified. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// NewInstancePrototypeInstanceBySourceTemplate : Instantiate InstancePrototypeInstanceBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstancePrototypeInstanceBySourceTemplate, err error) { + _model = &InstancePrototypeInstanceBySourceTemplate{ + SourceTemplate: sourceTemplate, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceTemplate) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceTemplate unmarshals an instance of InstancePrototypeInstanceBySourceTemplate from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceTemplate) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByVolume : Create an instance by using a boot volume. +// Models which "extend" this model: +// - InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment +// - InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface +// This model "extends" InstancePrototype +type InstancePrototypeInstanceByVolume struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstancePrototypeInstanceByVolume) isaInstancePrototypeInstanceByVolume() bool { + return true +} + +type InstancePrototypeInstanceByVolumeIntf interface { + InstancePrototypeIntf + isaInstancePrototypeInstanceByVolume() bool +} + +func (*InstancePrototypeInstanceByVolume) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByVolume unmarshals an instance of InstancePrototypeInstanceByVolume from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByVolume) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByCRN : InstanceTemplateIdentityByCRN struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByCRN struct { + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstanceTemplateIdentityByCRN : Instantiate InstanceTemplateIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByCRN(crn string) (_model *InstanceTemplateIdentityByCRN, err error) { + _model = &InstanceTemplateIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByCRN) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByCRN unmarshals an instance of InstanceTemplateIdentityByCRN from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByHref : InstanceTemplateIdentityByHref struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByHref struct { + // The URL for this instance template. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceTemplateIdentityByHref : Instantiate InstanceTemplateIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByHref(href string) (_model *InstanceTemplateIdentityByHref, err error) { + _model = &InstanceTemplateIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByHref) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByHref unmarshals an instance of InstanceTemplateIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByID : InstanceTemplateIdentityByID struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByID struct { + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceTemplateIdentityByID : Instantiate InstanceTemplateIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByID(id string) (_model *InstanceTemplateIdentityByID, err error) { + _model = &InstanceTemplateIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByID) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByID unmarshals an instance of InstanceTemplateIdentityByID from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Create an instance template that creates instances by using a catalog offering. +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment +// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { + return true +} + +type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOffering from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image. +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment +// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceTemplateByImage struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { + return true +} + +type InstanceTemplatePrototypeInstanceTemplateByImageIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateByImage() bool +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImage from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImage) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Create an instance template that creates instances by using a snapshot. +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment +// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { + return true +} + +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotIntf interface { + InstanceTemplatePrototypeIntf + isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Create an instance template from an existing source instance template. +// +// The `primary_network_attachment` and `network_attachments` properties may only be specified if +// `primary_network_attachment` is specified in the source template. +// +// The `primary_network_interface` and `network_interfaces` properties may only be specified if +// `primary_network_interface` is specified in the source template. +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering version to use when provisioning this virtual server instance. + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account, subject to + // IAM policies. + // + // If specified, `image` must not be specified, and `source_template` must not have + // `image` specified. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The template to create this virtual server instance from. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceTemplate, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceTemplate{ + SourceTemplate: sourceTemplate, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceTemplate from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext : Create an instance by using a catalog offering. +// Models which "extend" this model: +// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering + // or offering version to use when provisioning this virtual server instance. + // + // If an offering is specified, the latest version of that offering will be used. + // + // The specified offering or offering version may be in a different account in the same + // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // to IAM policies. + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { + return true +} + +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByImageInstanceTemplateContext : Create an instance by using an image. +// Models which "extend" this model: +// - InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByImageInstanceTemplateContext struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { + return true +} + +type InstanceTemplateInstanceByImageInstanceTemplateContextIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool +} + +func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceTemplateContext) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext : Create an instance by using a snapshot. +// Models which "extend" this model: +// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment +// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` +} + +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { + return true +} + +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIntf interface { + InstanceTemplateIntf + isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool +} + +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByCRN : KeyIdentityByCRN struct +// This model "extends" KeyIdentity +type KeyIdentityByCRN struct { + // The CRN for this key. + CRN *string `json:"crn" validate:"required"` +} + +// NewKeyIdentityByCRN : Instantiate KeyIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByCRN(crn string) (_model *KeyIdentityByCRN, err error) { + _model = &KeyIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*KeyIdentityByCRN) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByCRN unmarshals an instance of KeyIdentityByCRN from the specified map of raw messages. +func UnmarshalKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByFingerprint : KeyIdentityByFingerprint struct +// This model "extends" KeyIdentity +type KeyIdentityByFingerprint struct { + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint" validate:"required"` +} + +// NewKeyIdentityByFingerprint : Instantiate KeyIdentityByFingerprint (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByFingerprint(fingerprint string) (_model *KeyIdentityByFingerprint, err error) { + _model = &KeyIdentityByFingerprint{ + Fingerprint: core.StringPtr(fingerprint), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*KeyIdentityByFingerprint) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByFingerprint unmarshals an instance of KeyIdentityByFingerprint from the specified map of raw messages. +func UnmarshalKeyIdentityByFingerprint(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByFingerprint) + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByHref : KeyIdentityByHref struct +// This model "extends" KeyIdentity +type KeyIdentityByHref struct { + // The URL for this key. + Href *string `json:"href" validate:"required"` +} + +// NewKeyIdentityByHref : Instantiate KeyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByHref(href string) (_model *KeyIdentityByHref, err error) { + _model = &KeyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*KeyIdentityByHref) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByHref unmarshals an instance of KeyIdentityByHref from the specified map of raw messages. +func UnmarshalKeyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByID : KeyIdentityByID struct +// This model "extends" KeyIdentity +type KeyIdentityByID struct { + // The unique identifier for this key. + ID *string `json:"id" validate:"required"` +} + +// NewKeyIdentityByID : Instantiate KeyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByID(id string) (_model *KeyIdentityByID, err error) { + _model = &KeyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*KeyIdentityByID) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByID unmarshals an instance of KeyIdentityByID from the specified map of raw messages. +func UnmarshalKeyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct +// This model "extends" LegacyCloudObjectStorageBucketIdentity +type LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct { + // The globally unique name of this Cloud Object Storage bucket. + Name *string `json:"name" validate:"required"` +} + +// NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : Instantiate LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName (Generic Model Constructor) +func (*VpcV1) NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(name string) (_model *LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName, err error) { + _model = &LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) isaLegacyCloudObjectStorageBucketIdentity() bool { + return true +} + +// UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName unmarshals an instance of LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName from the specified map of raw messages. +func UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentityByCRN : LoadBalancerIdentityByCRN struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByCRN struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewLoadBalancerIdentityByCRN : Instantiate LoadBalancerIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByCRN(crn string) (_model *LoadBalancerIdentityByCRN, err error) { + _model = &LoadBalancerIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerIdentityByCRN) isaLoadBalancerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerIdentityByCRN unmarshals an instance of LoadBalancerIdentityByCRN from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentityByHref : LoadBalancerIdentityByHref struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByHref struct { + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerIdentityByHref : Instantiate LoadBalancerIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByHref(href string) (_model *LoadBalancerIdentityByHref, err error) { + _model = &LoadBalancerIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerIdentityByHref) isaLoadBalancerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerIdentityByHref unmarshals an instance of LoadBalancerIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentityByID : LoadBalancerIdentityByID struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByID struct { + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerIdentityByID : Instantiate LoadBalancerIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByID(id string) (_model *LoadBalancerIdentityByID, err error) { + _model = &LoadBalancerIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerIdentityByID) isaLoadBalancerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerIdentityByID unmarshals an instance of LoadBalancerIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerIdentityByHref : LoadBalancerListenerIdentityByHref struct +// This model "extends" LoadBalancerListenerIdentity +type LoadBalancerListenerIdentityByHref struct { + // The listener's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerIdentityByHref : Instantiate LoadBalancerListenerIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerIdentityByHref(href string) (_model *LoadBalancerListenerIdentityByHref, err error) { + _model = &LoadBalancerListenerIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerIdentityByHref) isaLoadBalancerListenerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerListenerIdentityByHref unmarshals an instance of LoadBalancerListenerIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerIdentityByID : LoadBalancerListenerIdentityByID struct +// This model "extends" LoadBalancerListenerIdentity +type LoadBalancerListenerIdentityByID struct { + // The unique identifier for this load balancer listener. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerIdentityByID : Instantiate LoadBalancerListenerIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerIdentityByID(id string) (_model *LoadBalancerListenerIdentityByID, err error) { + _model = &LoadBalancerListenerIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerIdentityByID) isaLoadBalancerListenerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerListenerIdentityByID unmarshals an instance of LoadBalancerListenerIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityIntf interface { + LoadBalancerListenerPolicyTargetPatchIntf + isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // Identifies a load balancer listener by a unique property. + Listener LoadBalancerListenerIdentityIntf `json:"listener" validate:"required"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype{ + HTTPStatusCode: core.Int64Ptr(httpStatusCode), + Listener: listener, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // The redirect target URL. + URL *string `json:"url" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(httpStatusCode int64, url string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype{ + HTTPStatusCode: core.Int64Ptr(httpStatusCode), + URL: core.StringPtr(url), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityIntf interface { + LoadBalancerListenerPolicyTargetPrototypeIntf + isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect : LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + Listener *LoadBalancerListenerReference `json:"listener" validate:"required"` + + // The redirect relative target URI. + URI *string `json:"uri,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL : LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct { + // The HTTP status code for this redirect. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // The redirect target URL. + URL *string `json:"url" validate:"required"` +} + +func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetLoadBalancerPoolReference : LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` + + // The name for this load balancer pool. The name is unique across all pools for the load balancer. + Name *string `json:"name" validate:"required"` +} + +func (*LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerPoolReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerPoolIdentity +type LoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolIdentityByHref) isaLoadBalancerPoolIdentity() bool { + return true +} + +// UnmarshalLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentityByID : LoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerPoolIdentity +type LoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerPoolIdentityByID : Instantiate LoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolIdentityByID) isaLoadBalancerPoolIdentity() bool { + return true +} + +// UnmarshalLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeIP : LoadBalancerPoolMemberTargetPrototypeIP struct +// This model "extends" LoadBalancerPoolMemberTargetPrototype +type LoadBalancerPoolMemberTargetPrototypeIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeIP : Instantiate LoadBalancerPoolMemberTargetPrototypeIP (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeIP(address string) (_model *LoadBalancerPoolMemberTargetPrototypeIP, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeIP) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeIP unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeIP from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref +// This model "extends" LoadBalancerPoolMemberTargetPrototype +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentity struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityIntf interface { + LoadBalancerPoolMemberTargetPrototypeIntf + isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetIP : LoadBalancerPoolMemberTargetIP struct +// This model "extends" LoadBalancerPoolMemberTarget +type LoadBalancerPoolMemberTargetIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*LoadBalancerPoolMemberTargetIP) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetIP unmarshals an instance of LoadBalancerPoolMemberTargetIP from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetInstanceReference : LoadBalancerPoolMemberTargetInstanceReference struct +// This model "extends" LoadBalancerPoolMemberTarget +type LoadBalancerPoolMemberTargetInstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The name for this virtual server instance. The name is unique across all virtual server instances in the region. + Name *string `json:"name" validate:"required"` +} + +func (*LoadBalancerPoolMemberTargetInstanceReference) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetInstanceReference unmarshals an instance of LoadBalancerPoolMemberTargetInstanceReference from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileIdentityByHref : LoadBalancerProfileIdentityByHref struct +// This model "extends" LoadBalancerProfileIdentity +type LoadBalancerProfileIdentityByHref struct { + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerProfileIdentityByHref : Instantiate LoadBalancerProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerProfileIdentityByHref(href string) (_model *LoadBalancerProfileIdentityByHref, err error) { + _model = &LoadBalancerProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerProfileIdentityByHref) isaLoadBalancerProfileIdentity() bool { + return true +} + +// UnmarshalLoadBalancerProfileIdentityByHref unmarshals an instance of LoadBalancerProfileIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileIdentityByName : LoadBalancerProfileIdentityByName struct +// This model "extends" LoadBalancerProfileIdentity +type LoadBalancerProfileIdentityByName struct { + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` +} + +// NewLoadBalancerProfileIdentityByName : Instantiate LoadBalancerProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerProfileIdentityByName(name string) (_model *LoadBalancerProfileIdentityByName, err error) { + _model = &LoadBalancerProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerProfileIdentityByName) isaLoadBalancerProfileIdentity() bool { + return true +} + +// UnmarshalLoadBalancerProfileIdentityByName unmarshals an instance of LoadBalancerProfileIdentityByName from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileInstanceGroupsSupportedDependent : The instance groups support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileInstanceGroupsSupported +type LoadBalancerProfileInstanceGroupsSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileInstanceGroupsSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileInstanceGroupsSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileInstanceGroupsSupportedDependent) isaLoadBalancerProfileInstanceGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileInstanceGroupsSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileInstanceGroupsSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileInstanceGroupsSupportedFixed : The instance groups support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileInstanceGroupsSupported +type LoadBalancerProfileInstanceGroupsSupportedFixed 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 LoadBalancerProfileInstanceGroupsSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileInstanceGroupsSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileInstanceGroupsSupportedFixed) isaLoadBalancerProfileInstanceGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileInstanceGroupsSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileInstanceGroupsSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileRouteModeSupportedDependent : The route mode support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileRouteModeSupported +type LoadBalancerProfileRouteModeSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileRouteModeSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileRouteModeSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileRouteModeSupportedDependent) isaLoadBalancerProfileRouteModeSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileRouteModeSupportedDependent unmarshals an instance of LoadBalancerProfileRouteModeSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileRouteModeSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileRouteModeSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileRouteModeSupportedFixed : The route mode support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileRouteModeSupported +type LoadBalancerProfileRouteModeSupportedFixed 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 LoadBalancerProfileRouteModeSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileRouteModeSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileRouteModeSupportedFixed) isaLoadBalancerProfileRouteModeSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileRouteModeSupportedFixed unmarshals an instance of LoadBalancerProfileRouteModeSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileRouteModeSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileRouteModeSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileSecurityGroupsSupportedDependent : The security group support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileSecurityGroupsSupported +type LoadBalancerProfileSecurityGroupsSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileSecurityGroupsSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileSecurityGroupsSupportedDependent) isaLoadBalancerProfileSecurityGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileSecurityGroupsSupportedFixed : The security group support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileSecurityGroupsSupported +type LoadBalancerProfileSecurityGroupsSupportedFixed 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 LoadBalancerProfileSecurityGroupsSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileSecurityGroupsSupportedFixed) isaLoadBalancerProfileSecurityGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileUDPSupportedDependent : The UDP support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileUDPSupported +type LoadBalancerProfileUDPSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileUDPSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileUDPSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileUDPSupportedDependent) isaLoadBalancerProfileUDPSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileUDPSupportedDependent unmarshals an instance of LoadBalancerProfileUDPSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileUDPSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileUDPSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileUDPSupportedFixed : The UDP support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileUDPSupported +type LoadBalancerProfileUDPSupportedFixed 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 LoadBalancerProfileUDPSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileUDPSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileUDPSupportedFixed) isaLoadBalancerProfileUDPSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileUDPSupportedFixed unmarshals an instance of LoadBalancerProfileUDPSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileUDPSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileUDPSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLIdentityByCRN : NetworkACLIdentityByCRN struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByCRN struct { + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` +} + +// NewNetworkACLIdentityByCRN : Instantiate NetworkACLIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByCRN(crn string) (_model *NetworkACLIdentityByCRN, err error) { + _model = &NetworkACLIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLIdentityByCRN) isaNetworkACLIdentity() bool { + return true +} + +// UnmarshalNetworkACLIdentityByCRN unmarshals an instance of NetworkACLIdentityByCRN from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLIdentityByHref : NetworkACLIdentityByHref struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByHref struct { + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkACLIdentityByHref : Instantiate NetworkACLIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByHref(href string) (_model *NetworkACLIdentityByHref, err error) { + _model = &NetworkACLIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLIdentityByHref) isaNetworkACLIdentity() bool { + return true +} + +// UnmarshalNetworkACLIdentityByHref unmarshals an instance of NetworkACLIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLIdentityByID : NetworkACLIdentityByID struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByID struct { + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkACLIdentityByID : Instantiate NetworkACLIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByID(id string) (_model *NetworkACLIdentityByID, err error) { + _model = &NetworkACLIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLIdentityByID) isaNetworkACLIdentity() bool { + return true +} + +// UnmarshalNetworkACLIdentityByID unmarshals an instance of NetworkACLIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLPrototypeNetworkACLByRules : NetworkACLPrototypeNetworkACLByRules struct +// This model "extends" NetworkACLPrototype +type NetworkACLPrototypeNetworkACLByRules struct { + // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The VPC this network ACL will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, + // resulting in all traffic being denied. + Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` +} + +// NewNetworkACLPrototypeNetworkACLByRules : Instantiate NetworkACLPrototypeNetworkACLByRules (Generic Model Constructor) +func (*VpcV1) NewNetworkACLPrototypeNetworkACLByRules(vpc VPCIdentityIntf) (_model *NetworkACLPrototypeNetworkACLByRules, err error) { + _model = &NetworkACLPrototypeNetworkACLByRules{ + VPC: vpc, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLPrototypeNetworkACLByRules) isaNetworkACLPrototype() bool { + return true +} + +// UnmarshalNetworkACLPrototypeNetworkACLByRules unmarshals an instance of NetworkACLPrototypeNetworkACLByRules from the specified map of raw messages. +func UnmarshalNetworkACLPrototypeNetworkACLByRules(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototypeNetworkACLByRules) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLPrototypeNetworkACLBySourceNetworkACL : NetworkACLPrototypeNetworkACLBySourceNetworkACL struct +// This model "extends" NetworkACLPrototype +type NetworkACLPrototypeNetworkACLBySourceNetworkACL struct { + // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The VPC this network ACL will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // Network ACL to copy rules from. + SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl" validate:"required"` +} + +// NewNetworkACLPrototypeNetworkACLBySourceNetworkACL : Instantiate NetworkACLPrototypeNetworkACLBySourceNetworkACL (Generic Model Constructor) +func (*VpcV1) NewNetworkACLPrototypeNetworkACLBySourceNetworkACL(vpc VPCIdentityIntf, sourceNetworkACL NetworkACLIdentityIntf) (_model *NetworkACLPrototypeNetworkACLBySourceNetworkACL, err error) { + _model = &NetworkACLPrototypeNetworkACLBySourceNetworkACL{ + VPC: vpc, + SourceNetworkACL: sourceNetworkACL, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLPrototypeNetworkACLBySourceNetworkACL) isaNetworkACLPrototype() bool { + return true +} + +// UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL unmarshals an instance of NetworkACLPrototypeNetworkACLBySourceNetworkACL from the specified map of raw messages. +func UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototypeNetworkACLBySourceNetworkACL) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct +// This model "extends" NetworkACLRuleBeforePatch +type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct { + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(href string) (_model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref, err error) { + _model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePatch() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct +// This model "extends" NetworkACLRuleBeforePatch +type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(id string) (_model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID, err error) { + _model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePatch() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct +// This model "extends" NetworkACLRuleBeforePrototype +type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct { + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(href string) (_model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref, err error) { + _model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePrototype() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct +// This model "extends" NetworkACLRuleBeforePrototype +type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(id string) (_model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID, err error) { + _model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePrototype() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItemNetworkACLRuleProtocolAll : NetworkACLRuleItemNetworkACLRuleProtocolAll struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolAll struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolAllActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllProtocolAllConst = "all" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolAll) isaNetworkACLRuleItem() bool { + return true +} + +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolAll from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItemNetworkACLRuleProtocolIcmp : NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolIcmp) isaNetworkACLRuleItem() bool { + return true +} + +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItemNetworkACLRuleProtocolTcpudp : NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max" validate:"required"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min" validate:"required"` +} + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) isaNetworkACLRuleItem() bool { + return true +} + +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" +) + +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" +) + +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" +) + +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) isaNetworkACLRulePrototype() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to match. + // + // If specified, `type` must also be specified. If unspecified, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to match. + // + // If unspecified, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) isaNetworkACLRulePrototype() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype, err error) { + _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) isaNetworkACLRulePrototype() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleNetworkACLRuleProtocolAll : NetworkACLRuleNetworkACLRuleProtocolAll struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolAll struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolAllActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllProtocolAllConst = "all" +) + +func (*NetworkACLRuleNetworkACLRuleProtocolAll) isaNetworkACLRule() bool { + return true +} + +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolAll from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleNetworkACLRuleProtocolIcmp : NetworkACLRuleNetworkACLRuleProtocolIcmp struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolIcmp struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to match. + // + // If absent, all codes are matched. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to match. + // + // If absent, all types are matched. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolIcmpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +func (*NetworkACLRuleNetworkACLRuleProtocolIcmp) isaNetworkACLRule() bool { + return true +} + +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleNetworkACLRuleProtocolTcpudp : NetworkACLRuleNetworkACLRuleProtocolTcpudp struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolTcpudp struct { + // The action to perform for a packet matching the rule. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. + Destination *string `json:"destination" validate:"required"` + + // The direction of traffic to match. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The name for this network ACL rule. The name is unique across all rules for the network ACL. + Name *string `json:"name" validate:"required"` + + // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max" validate:"required"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min" validate:"required"` +} + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Action property. +// The action to perform for a packet matching the rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Direction property. +// The direction of traffic to match. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" + NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +func (*NetworkACLRuleNetworkACLRuleProtocolTcpudp) isaNetworkACLRule() bool { + return true +} + +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototypeReservedIPIdentity : Identifies a reserved IP by a unique property. +// Models which "extend" this model: +// - NetworkInterfaceIPPrototypeReservedIPIdentityByID +// - NetworkInterfaceIPPrototypeReservedIPIdentityByHref +// This model "extends" NetworkInterfaceIPPrototype +type NetworkInterfaceIPPrototypeReservedIPIdentity struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentity) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { + return true +} + +type NetworkInterfaceIPPrototypeReservedIPIdentityIntf interface { + NetworkInterfaceIPPrototypeIntf + isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentity) isaNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentity from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext : NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext struct +// This model "extends" NetworkInterfaceIPPrototype +type NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) isaNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemIdentityByHref : OperatingSystemIdentityByHref struct +// This model "extends" OperatingSystemIdentity +type OperatingSystemIdentityByHref struct { + // The URL for this operating system. + Href *string `json:"href" validate:"required"` +} + +// NewOperatingSystemIdentityByHref : Instantiate OperatingSystemIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewOperatingSystemIdentityByHref(href string) (_model *OperatingSystemIdentityByHref, err error) { + _model = &OperatingSystemIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*OperatingSystemIdentityByHref) isaOperatingSystemIdentity() bool { + return true +} + +// UnmarshalOperatingSystemIdentityByHref unmarshals an instance of OperatingSystemIdentityByHref from the specified map of raw messages. +func UnmarshalOperatingSystemIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemIdentityByName : OperatingSystemIdentityByName struct +// This model "extends" OperatingSystemIdentity +type OperatingSystemIdentityByName struct { + // The globally unique name for this operating system. + Name *string `json:"name" validate:"required"` +} + +// NewOperatingSystemIdentityByName : Instantiate OperatingSystemIdentityByName (Generic Model Constructor) +func (*VpcV1) NewOperatingSystemIdentityByName(name string) (_model *OperatingSystemIdentityByName, err error) { + _model = &OperatingSystemIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*OperatingSystemIdentityByName) isaOperatingSystemIdentity() bool { + return true +} + +// UnmarshalOperatingSystemIdentityByName unmarshals an instance of OperatingSystemIdentityByName from the specified map of raw messages. +func UnmarshalOperatingSystemIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentity : Identifies a floating IP by a unique property. +// Models which "extend" this model: +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress +// This model "extends" PublicGatewayFloatingIPPrototype +type PublicGatewayFloatingIPPrototypeFloatingIPIdentity struct { + // The unique identifier for this floating IP. + ID *string `json:"id,omitempty"` + + // The CRN for this floating IP. + CRN *string `json:"crn,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href,omitempty"` + + // The globally unique IP address. + Address *string `json:"address,omitempty"` +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityIntf interface { + PublicGatewayFloatingIPPrototypeIntf + isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentity from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext : PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct +// This model "extends" PublicGatewayFloatingIPPrototype +type PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct { + // The name for this floating IP. The name must not be used by another floating IP in the region. 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"` +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentityPublicGatewayIdentityByCRN : PublicGatewayIdentityPublicGatewayIdentityByCRN struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityPublicGatewayIdentityByCRN struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` +} + +// NewPublicGatewayIdentityPublicGatewayIdentityByCRN : Instantiate PublicGatewayIdentityPublicGatewayIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByCRN(crn string) (_model *PublicGatewayIdentityPublicGatewayIdentityByCRN, err error) { + _model = &PublicGatewayIdentityPublicGatewayIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayIdentityPublicGatewayIdentityByCRN) isaPublicGatewayIdentity() bool { + return true +} + +// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByCRN from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityPublicGatewayIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentityPublicGatewayIdentityByHref : PublicGatewayIdentityPublicGatewayIdentityByHref struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityPublicGatewayIdentityByHref struct { + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` +} + +// NewPublicGatewayIdentityPublicGatewayIdentityByHref : Instantiate PublicGatewayIdentityPublicGatewayIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByHref(href string) (_model *PublicGatewayIdentityPublicGatewayIdentityByHref, err error) { + _model = &PublicGatewayIdentityPublicGatewayIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayIdentityPublicGatewayIdentityByHref) isaPublicGatewayIdentity() bool { + return true +} + +// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByHref from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityPublicGatewayIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentityPublicGatewayIdentityByID : PublicGatewayIdentityPublicGatewayIdentityByID struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityPublicGatewayIdentityByID struct { + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` +} + +// NewPublicGatewayIdentityPublicGatewayIdentityByID : Instantiate PublicGatewayIdentityPublicGatewayIdentityByID (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByID(id string) (_model *PublicGatewayIdentityPublicGatewayIdentityByID, err error) { + _model = &PublicGatewayIdentityPublicGatewayIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayIdentityPublicGatewayIdentityByID) isaPublicGatewayIdentity() bool { + return true +} + +// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByID from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityPublicGatewayIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionIdentityByHref : RegionIdentityByHref struct +// This model "extends" RegionIdentity +type RegionIdentityByHref struct { + // The URL for this region. + Href *string `json:"href" validate:"required"` +} + +// NewRegionIdentityByHref : Instantiate RegionIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRegionIdentityByHref(href string) (_model *RegionIdentityByHref, err error) { + _model = &RegionIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RegionIdentityByHref) isaRegionIdentity() bool { + return true +} + +// UnmarshalRegionIdentityByHref unmarshals an instance of RegionIdentityByHref from the specified map of raw messages. +func UnmarshalRegionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionIdentityByName : RegionIdentityByName struct +// This model "extends" RegionIdentity +type RegionIdentityByName struct { + // The globally unique name for this region. + Name *string `json:"name" validate:"required"` +} + +// NewRegionIdentityByName : Instantiate RegionIdentityByName (Generic Model Constructor) +func (*VpcV1) NewRegionIdentityByName(name string) (_model *RegionIdentityByName, err error) { + _model = &RegionIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RegionIdentityByName) isaRegionIdentity() bool { + return true +} + +// UnmarshalRegionIdentityByName unmarshals an instance of RegionIdentityByName from the specified map of raw messages. +func UnmarshalRegionIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationIdentityByCRN : ReservationIdentityByCRN struct +// This model "extends" ReservationIdentity +type ReservationIdentityByCRN struct { + // The CRN for this reservation. + CRN *string `json:"crn" validate:"required"` +} + +// NewReservationIdentityByCRN : Instantiate ReservationIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewReservationIdentityByCRN(crn string) (_model *ReservationIdentityByCRN, err error) { + _model = &ReservationIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservationIdentityByCRN) isaReservationIdentity() bool { + return true +} + +// UnmarshalReservationIdentityByCRN unmarshals an instance of ReservationIdentityByCRN from the specified map of raw messages. +func UnmarshalReservationIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationIdentityByHref : ReservationIdentityByHref struct +// This model "extends" ReservationIdentity +type ReservationIdentityByHref struct { + // The URL for this reservation. + Href *string `json:"href" validate:"required"` +} + +// NewReservationIdentityByHref : Instantiate ReservationIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewReservationIdentityByHref(href string) (_model *ReservationIdentityByHref, err error) { + _model = &ReservationIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservationIdentityByHref) isaReservationIdentity() bool { + return true +} + +// UnmarshalReservationIdentityByHref unmarshals an instance of ReservationIdentityByHref from the specified map of raw messages. +func UnmarshalReservationIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservationIdentityByID : ReservationIdentityByID struct +// This model "extends" ReservationIdentity +type ReservationIdentityByID struct { + // The unique identifier for this reservation. + ID *string `json:"id" validate:"required"` +} + +// NewReservationIdentityByID : Instantiate ReservationIdentityByID (Generic Model Constructor) +func (*VpcV1) NewReservationIdentityByID(id string) (_model *ReservationIdentityByID, err error) { + _model = &ReservationIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservationIdentityByID) isaReservationIdentity() bool { + return true +} + +// UnmarshalReservationIdentityByID unmarshals an instance of ReservationIdentityByID from the specified map of raw messages. +func UnmarshalReservationIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentity : ReservedIPTargetPrototypeEndpointGatewayIdentity struct +// Models which "extend" this model: +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref +// This model "extends" ReservedIPTargetPrototype +type ReservedIPTargetPrototypeEndpointGatewayIdentity struct { + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +type ReservedIPTargetPrototypeEndpointGatewayIdentityIntf interface { + ReservedIPTargetPrototypeIntf + isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentity from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" ReservedIPTargetPrototype +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity struct { + // 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"` +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { + ReservedIPTargetPrototypeIntf + isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext : ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // 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 name for this bare metal server network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetEndpointGatewayReference : ReservedIPTargetEndpointGatewayReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetEndpointGatewayReference struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetEndpointGatewayReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +func (*ReservedIPTargetEndpointGatewayReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetEndpointGatewayReference unmarshals an instance of ReservedIPTargetEndpointGatewayReference from the specified map of raw messages. +func UnmarshalReservedIPTargetEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetEndpointGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetGenericResourceReference : Identifying information for a resource that is not native to the VPC API. +// This model "extends" ReservedIPTarget +type ReservedIPTargetGenericResourceReference struct { + // The CRN for the resource. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *GenericResourceReferenceDeleted `json:"deleted,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetGenericResourceReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetGenericResourceReferenceResourceTypeCloudResourceConst = "cloud_resource" +) + +func (*ReservedIPTargetGenericResourceReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetGenericResourceReference unmarshals an instance of ReservedIPTargetGenericResourceReference from the specified map of raw messages. +func UnmarshalReservedIPTargetGenericResourceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetGenericResourceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalGenericResourceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetLoadBalancerReference : ReservedIPTargetLoadBalancerReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetLoadBalancerReference struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` + + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` + + // The name for this load balancer. The name is unique across all load balancers in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetLoadBalancerReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" +) + +func (*ReservedIPTargetLoadBalancerReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetLoadBalancerReference unmarshals an instance of ReservedIPTargetLoadBalancerReference from the specified map of raw messages. +func UnmarshalReservedIPTargetLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetLoadBalancerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetNetworkInterfaceReferenceTargetContext : ReservedIPTargetNetworkInterfaceReferenceTargetContext struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this instance network interface. + // + // If this instance 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 instance network interface. + // + // If this instance 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 name for this instance network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + ReservedIPTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*ReservedIPTargetNetworkInterfaceReferenceTargetContext) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetVPNGatewayReference : ReservedIPTargetVPNGatewayReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetVPNGatewayReference struct { + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetVPNGatewayReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" +) + +func (*ReservedIPTargetVPNGatewayReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetVPNGatewayReference unmarshals an instance of ReservedIPTargetVPNGatewayReference from the specified map of raw messages. +func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetVPNGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetVPNServerReference : ReservedIPTargetVPNServerReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` + + // The name for this VPN server. The name is unique across all VPN servers in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetVPNServerReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" +) + +func (*ReservedIPTargetVPNServerReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetVPNServerReference unmarshals an instance of ReservedIPTargetVPNServerReference from the specified map of raw messages. +func UnmarshalReservedIPTargetVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext : ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext.ResourceType property. +// The resource type. +const ( + ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +func (*ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext unmarshals an instance of ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext from the specified map of raw messages. +func UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceGroupIdentityByID : ResourceGroupIdentityByID struct +// This model "extends" ResourceGroupIdentity +type ResourceGroupIdentityByID struct { + // The unique identifier for this resource group. + ID *string `json:"id" validate:"required"` +} + +// NewResourceGroupIdentityByID : Instantiate ResourceGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewResourceGroupIdentityByID(id string) (_model *ResourceGroupIdentityByID, err error) { + _model = &ResourceGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ResourceGroupIdentityByID) isaResourceGroupIdentity() bool { + return true +} + +// UnmarshalResourceGroupIdentityByID unmarshals an instance of ResourceGroupIdentityByID from the specified map of raw messages. +func UnmarshalResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCreatorVPNGatewayReference : RouteCreatorVPNGatewayReference struct +// This model "extends" RouteCreator +type RouteCreatorVPNGatewayReference struct { + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RouteCreatorVPNGatewayReference.ResourceType property. +// The resource type. +const ( + RouteCreatorVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" +) + +func (*RouteCreatorVPNGatewayReference) isaRouteCreator() bool { + return true +} + +// UnmarshalRouteCreatorVPNGatewayReference unmarshals an instance of RouteCreatorVPNGatewayReference from the specified map of raw messages. +func UnmarshalRouteCreatorVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreatorVPNGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCreatorVPNServerReference : RouteCreatorVPNServerReference struct +// This model "extends" RouteCreator +type RouteCreatorVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` + + // The name for this VPN server. The name is unique across all VPN servers in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RouteCreatorVPNServerReference.ResourceType property. +// The resource type. +const ( + RouteCreatorVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" +) + +func (*RouteCreatorVPNServerReference) isaRouteCreator() bool { + return true +} + +// UnmarshalRouteCreatorVPNServerReference unmarshals an instance of RouteCreatorVPNServerReference from the specified map of raw messages. +func UnmarshalRouteCreatorVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreatorVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopIP : RouteNextHopIP struct +// This model "extends" RouteNextHop +type RouteNextHopIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*RouteNextHopIP) isaRouteNextHop() bool { + return true +} + +// UnmarshalRouteNextHopIP unmarshals an instance of RouteNextHopIP from the specified map of raw messages. +func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchRouteNextHopIP : RouteNextHopPatchRouteNextHopIP struct +// Models which "extend" this model: +// - RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP +// - RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP +// This model "extends" RouteNextHopPatch +type RouteNextHopPatchRouteNextHopIP struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` +} + +func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatchRouteNextHopIP() bool { + return true +} + +type RouteNextHopPatchRouteNextHopIPIntf interface { + RouteNextHopPatchIntf + isaRouteNextHopPatchRouteNextHopIP() bool +} + +func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchRouteNextHopIP unmarshals an instance of RouteNextHopPatchRouteNextHopIP from the specified map of raw messages. +func UnmarshalRouteNextHopPatchRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchRouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. +// Models which "extend" this model: +// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID +// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref +// This model "extends" RouteNextHopPatch +type RouteNextHopPatchVPNGatewayConnectionIdentity struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentity) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { + return true +} + +type RouteNextHopPatchVPNGatewayConnectionIdentityIntf interface { + RouteNextHopPatchIntf + isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentity) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentity from the specified map of raw messages. +func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchVPNGatewayConnectionIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopVPNGatewayConnectionReference : RouteNextHopVPNGatewayConnectionReference struct +// This model "extends" RouteNextHop +type RouteNextHopVPNGatewayConnectionReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RouteNextHopVPNGatewayConnectionReference.ResourceType property. +// The resource type. +const ( + RouteNextHopVPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +func (*RouteNextHopVPNGatewayConnectionReference) isaRouteNextHop() bool { + return true +} + +// UnmarshalRouteNextHopVPNGatewayConnectionReference unmarshals an instance of RouteNextHopVPNGatewayConnectionReference from the specified map of raw messages. +func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopVPNGatewayConnectionReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct +// Models which "extend" this model: +// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP +// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP +// This model "extends" RoutePrototypeNextHop +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { + return true +} + +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPIntf interface { + RoutePrototypeNextHopIntf + isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. +// Models which "extend" this model: +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref +// This model "extends" RoutePrototypeNextHop +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityIntf interface { + RoutePrototypeNextHopIntf + isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableIdentityByHref : RoutingTableIdentityByHref struct +// This model "extends" RoutingTableIdentity +type RoutingTableIdentityByHref struct { + // The URL for this routing table. + Href *string `json:"href" validate:"required"` +} + +// NewRoutingTableIdentityByHref : Instantiate RoutingTableIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRoutingTableIdentityByHref(href string) (_model *RoutingTableIdentityByHref, err error) { + _model = &RoutingTableIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutingTableIdentityByHref) isaRoutingTableIdentity() bool { + return true +} + +// UnmarshalRoutingTableIdentityByHref unmarshals an instance of RoutingTableIdentityByHref from the specified map of raw messages. +func UnmarshalRoutingTableIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableIdentityByID : RoutingTableIdentityByID struct +// This model "extends" RoutingTableIdentity +type RoutingTableIdentityByID struct { + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` +} + +// NewRoutingTableIdentityByID : Instantiate RoutingTableIdentityByID (Generic Model Constructor) +func (*VpcV1) NewRoutingTableIdentityByID(id string) (_model *RoutingTableIdentityByID, err error) { + _model = &RoutingTableIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutingTableIdentityByID) isaRoutingTableIdentity() bool { + return true +} + +// UnmarshalRoutingTableIdentityByID unmarshals an instance of RoutingTableIdentityByID from the specified map of raw messages. +func UnmarshalRoutingTableIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupIdentityByCRN : SecurityGroupIdentityByCRN struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByCRN struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewSecurityGroupIdentityByCRN : Instantiate SecurityGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupIdentityByCRN, err error) { + _model = &SecurityGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupIdentityByCRN) isaSecurityGroupIdentity() bool { + return true +} + +// UnmarshalSecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupIdentityByHref : SecurityGroupIdentityByHref struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByHref struct { + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewSecurityGroupIdentityByHref : Instantiate SecurityGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByHref(href string) (_model *SecurityGroupIdentityByHref, err error) { + _model = &SecurityGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupIdentityByHref) isaSecurityGroupIdentity() bool { + return true +} + +// UnmarshalSecurityGroupIdentityByHref unmarshals an instance of SecurityGroupIdentityByHref from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupIdentityByID : SecurityGroupIdentityByID struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByID struct { + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` +} + +// NewSecurityGroupIdentityByID : Instantiate SecurityGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByID(id string) (_model *SecurityGroupIdentityByID, err error) { + _model = &SecurityGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupIdentityByID) isaSecurityGroupIdentity() bool { + return true +} + +// UnmarshalSecurityGroupIdentityByID unmarshals an instance of SecurityGroupIdentityByID from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // 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. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` +} + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllProtocolAllConst = "all" +) + +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll, err error) { + _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) isaSecurityGroupRulePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { + // The ICMP traffic code to allow. + // + // If specified, `type` must also be specified. If unspecified, all codes are allowed. + Code *int64 `json:"code,omitempty"` + + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // 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. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The ICMP traffic type to allow. + // + // If unspecified, all types are allowed. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp, err error) { + _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) isaSecurityGroupRulePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. +// +// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all destination ports are +// allowed for the protocol. When both have the same value, that single destination port is allowed. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The inclusive upper bound of TCP/UDP destination port range. + // + // If specified, `port_min` must also be specified, and must not be larger. If unspecified, + // `port_min` must also be unspecified, allowing traffic on all destination ports. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range + // + // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be + // unspecified, allowing traffic on all destination ports. + PortMin *int64 `json:"port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // 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. + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source + // (or to any destination, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` +} + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp, err error) { + _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRulePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchCIDR : SecurityGroupRuleRemotePatchCIDR struct +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchCIDR : Instantiate SecurityGroupRuleRemotePatchCIDR (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchCIDR(cidrBlock string) (_model *SecurityGroupRuleRemotePatchCIDR, err error) { + _model = &SecurityGroupRuleRemotePatchCIDR{ + CIDRBlock: core.StringPtr(cidrBlock), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchCIDR) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchCIDR unmarshals an instance of SecurityGroupRuleRemotePatchCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchIP : SecurityGroupRuleRemotePatchIP struct +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchIP : Instantiate SecurityGroupRuleRemotePatchIP (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchIP(address string) (_model *SecurityGroupRuleRemotePatchIP, err error) { + _model = &SecurityGroupRuleRemotePatchIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchIP) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchIP unmarshals an instance of SecurityGroupRuleRemotePatchIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentity : Identifies a security group by a unique property. +// Models which "extend" this model: +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchSecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +type SecurityGroupRuleRemotePatchSecurityGroupIdentityIntf interface { + SecurityGroupRuleRemotePatchIntf + isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeCIDR : SecurityGroupRuleRemotePrototypeCIDR struct +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeCIDR : Instantiate SecurityGroupRuleRemotePrototypeCIDR (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeCIDR(cidrBlock string) (_model *SecurityGroupRuleRemotePrototypeCIDR, err error) { + _model = &SecurityGroupRuleRemotePrototypeCIDR{ + CIDRBlock: core.StringPtr(cidrBlock), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeCIDR) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeCIDR unmarshals an instance of SecurityGroupRuleRemotePrototypeCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeIP : SecurityGroupRuleRemotePrototypeIP struct +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeIP : Instantiate SecurityGroupRuleRemotePrototypeIP (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeIP(address string) (_model *SecurityGroupRuleRemotePrototypeIP, err error) { + _model = &SecurityGroupRuleRemotePrototypeIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeIP) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeIP unmarshals an instance of SecurityGroupRuleRemotePrototypeIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentity : Identifies a security group by a unique property. +// Models which "extend" this model: +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentityIntf interface { + SecurityGroupRuleRemotePrototypeIntf + isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemoteCIDR : SecurityGroupRuleRemoteCIDR struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +func (*SecurityGroupRuleRemoteCIDR) isaSecurityGroupRuleRemote() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemoteCIDR unmarshals an instance of SecurityGroupRuleRemoteCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemoteIP : SecurityGroupRuleRemoteIP struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*SecurityGroupRuleRemoteIP) isaSecurityGroupRuleRemote() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemoteIP unmarshals an instance of SecurityGroupRuleRemoteIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemoteSecurityGroupReference : SecurityGroupRuleRemoteSecurityGroupReference struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteSecurityGroupReference struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The name for this security group. The name is unique across all security groups for the VPC. + Name *string `json:"name" validate:"required"` +} + +func (*SecurityGroupRuleRemoteSecurityGroupReference) isaSecurityGroupRuleRemote() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemoteSecurityGroupReference unmarshals an instance of SecurityGroupRuleRemoteSecurityGroupReference from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteSecurityGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` + + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllProtocolAllConst = "all" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolAll) isaSecurityGroupRule() bool { + return true +} + +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolAll from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` + + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The ICMP traffic code to allow. If absent, all codes are allowed. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to allow. If absent, all types are allowed. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolIcmp) isaSecurityGroupRule() bool { + return true +} + +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. +// +// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all destination ports are +// allowed for the protocol. When both have the same value, that single destination port is allowed. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { + // The direction of traffic to enforce. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they + // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // (network interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version" validate:"required"` + + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + PortMin *int64 `json:"port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Direction property. +// The direction of traffic to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they +// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// (network interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRule() bool { + return true +} + +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // 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 name for this bare metal server network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceEndpointGatewayReference : SecurityGroupTargetReferenceEndpointGatewayReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceEndpointGatewayReference struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceEndpointGatewayReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +func (*SecurityGroupTargetReferenceEndpointGatewayReference) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference unmarshals an instance of SecurityGroupTargetReferenceEndpointGatewayReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceEndpointGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceLoadBalancerReference : SecurityGroupTargetReferenceLoadBalancerReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceLoadBalancerReference struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` + + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` + + // The name for this load balancer. The name is unique across all load balancers in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceLoadBalancerReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" +) + +func (*SecurityGroupTargetReferenceLoadBalancerReference) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceLoadBalancerReference unmarshals an instance of SecurityGroupTargetReferenceLoadBalancerReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceLoadBalancerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this instance network interface. + // + // If this instance 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 instance network interface. + // + // If this instance 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 name for this instance network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceVPNServerReference : SecurityGroupTargetReferenceVPNServerReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` + + // The name for this VPN server. The name is unique across all VPN servers in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceVPNServerReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" +) + +func (*SecurityGroupTargetReferenceVPNServerReference) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceVPNServerReference unmarshals an instance of SecurityGroupTargetReferenceVPNServerReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceVirtualNetworkInterfaceReference : SecurityGroupTargetReferenceVirtualNetworkInterfaceReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceVirtualNetworkInterfaceReference struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *VirtualNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` + + // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. + Name *string `json:"name" validate:"required"` + + // The primary IP for this virtual network interface. + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceVirtualNetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceVirtualNetworkInterfaceReferenceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" +) + +func (*SecurityGroupTargetReferenceVirtualNetworkInterfaceReference) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceVirtualNetworkInterfaceReference unmarshals an instance of SecurityGroupTargetReferenceVirtualNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceVirtualNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceVirtualNetworkInterfaceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareIdentityByCRN : ShareIdentityByCRN struct +// This model "extends" ShareIdentity +type ShareIdentityByCRN struct { + // The CRN for this file share. + CRN *string `json:"crn" validate:"required"` +} + +// NewShareIdentityByCRN : Instantiate ShareIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewShareIdentityByCRN(crn string) (_model *ShareIdentityByCRN, err error) { + _model = &ShareIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareIdentityByCRN) isaShareIdentity() bool { + return true +} + +// UnmarshalShareIdentityByCRN unmarshals an instance of ShareIdentityByCRN from the specified map of raw messages. +func UnmarshalShareIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareIdentityByHref : ShareIdentityByHref struct +// This model "extends" ShareIdentity +type ShareIdentityByHref struct { + // The URL for this file share. + Href *string `json:"href" validate:"required"` +} + +// NewShareIdentityByHref : Instantiate ShareIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewShareIdentityByHref(href string) (_model *ShareIdentityByHref, err error) { + _model = &ShareIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareIdentityByHref) isaShareIdentity() bool { + return true +} + +// UnmarshalShareIdentityByHref unmarshals an instance of ShareIdentityByHref from the specified map of raw messages. +func UnmarshalShareIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareIdentityByID : ShareIdentityByID struct +// This model "extends" ShareIdentity +type ShareIdentityByID struct { + // The unique identifier for this file share. + ID *string `json:"id" validate:"required"` +} + +// NewShareIdentityByID : Instantiate ShareIdentityByID (Generic Model Constructor) +func (*VpcV1) NewShareIdentityByID(id string) (_model *ShareIdentityByID, err error) { + _model = &ShareIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareIdentityByID) isaShareIdentity() bool { + return true +} + +// UnmarshalShareIdentityByID unmarshals an instance of ShareIdentityByID from the specified map of raw messages. +func UnmarshalShareIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : The virtual network interface for this share mount target. The virtual network interface must: +// +// - be in the same `zone` as the share +// - have `allow_ip_spoofing` set to `false` +// - have `enable_infrastructure_nat` set to `true` +// - not be in the same VPC as an existing mount target for this share +// - not have `ips` other than the `primary_ip` address +// +// If an existing virtual network interface is specified, it must not have a floating IP bound to it, and it must not be +// the target of a flow log collector. +// +// Required if the share's `access_control_mode` is `security_group`. +// This model "extends" ShareMountTargetPrototype +type ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup struct { + // The name for this share mount target. The name must not be used by another mount target for the file share. + Name *string `json:"name,omitempty"` + + // The transit encryption mode to use for this share mount target: + // - `none`: Not encrypted in transit. + // - `user_managed`: Encrypted in transit using an instance identity certificate. The + // `access_control_mode` for the share must be `security_group`. + TransitEncryption *string `json:"transit_encryption,omitempty"` + + VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface" validate:"required"` +} + +// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup.TransitEncryption property. +// The transit encryption mode to use for this share mount target: +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. The +// `access_control_mode` for the share must be `security_group`. +const ( + ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionNoneConst = "none" + ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionUserManagedConst = "user_managed" +) + +// NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(virtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup, err error) { + _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup{ + VirtualNetworkInterface: virtualNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) isaShareMountTargetPrototype() bool { + return true +} + +// UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup unmarshals an instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup from the specified map of raw messages. +func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC : The VPC in which clients can mount the file share using this mount target. The VPC must not be used by another mount +// target for this share. +// +// Required if the share's `access_control_mode` is `vpc`. +// This model "extends" ShareMountTargetPrototype +type ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC struct { + // The name for this share mount target. The name must not be used by another mount target for the file share. + Name *string `json:"name,omitempty"` + + // The transit encryption mode to use for this share mount target: + // - `none`: Not encrypted in transit. + // - `user_managed`: Encrypted in transit using an instance identity certificate. The + // `access_control_mode` for the share must be `security_group`. + TransitEncryption *string `json:"transit_encryption,omitempty"` + + // Identifies a VPC by a unique property. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` +} + +// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC.TransitEncryption property. +// The transit encryption mode to use for this share mount target: +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. The +// `access_control_mode` for the share must be `security_group`. +const ( + ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionNoneConst = "none" + ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionUserManagedConst = "user_managed" +) + +// NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(vpc VPCIdentityIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC, err error) { + _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC{ + VPC: vpc, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC) isaShareMountTargetPrototype() bool { + return true +} + +// UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC unmarshals an instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC from the specified map of raw messages. +func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. +// Models which "extend" this model: +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref +// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototype +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity struct { + // 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"` +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityIntf interface { + ShareMountTargetVirtualNetworkInterfacePrototypeIntf + isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext : The virtual network interface for this target. +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototype +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext 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"` + + // Indicates whether this virtual network interface will be automatically deleted when + // `target` is deleted. + AutoDelete *bool `json:"auto_delete,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"` + + // 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"` + + // 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 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"` + + // The resource group to use for this virtual network interface. If unspecified, the + // share's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,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"` +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileCapacityDependentRange : The permitted total capacity (in gigabytes) of a share with this profile depends on its configuration. +// This model "extends" ShareProfileCapacity +type ShareProfileCapacityDependentRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the ShareProfileCapacityDependentRange.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityDependentRangeTypeDependentConst = "dependent" + ShareProfileCapacityDependentRangeTypeDependentRangeConst = "dependent_range" +) + +func (*ShareProfileCapacityDependentRange) isaShareProfileCapacity() bool { + return true +} + +// UnmarshalShareProfileCapacityDependentRange unmarshals an instance of ShareProfileCapacityDependentRange from the specified map of raw messages. +func UnmarshalShareProfileCapacityDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCapacityDependentRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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 *int64 `json:"default" validate:"required"` + + // 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 ShareProfileCapacityEnum.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityEnumTypeEnumConst = "enum" +) + +func (*ShareProfileCapacityEnum) isaShareProfileCapacity() bool { + return true +} + +// 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 { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileCapacityFixed : The permitted total capacity (in gigabytes) of a share with this profile is fixed. +// This model "extends" ShareProfileCapacity +type ShareProfileCapacityFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the ShareProfileCapacityFixed.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityFixedTypeFixedConst = "fixed" +) + +func (*ShareProfileCapacityFixed) isaShareProfileCapacity() bool { + return true +} + +// UnmarshalShareProfileCapacityFixed unmarshals an instance of ShareProfileCapacityFixed from the specified map of raw messages. +func UnmarshalShareProfileCapacityFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCapacityFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileCapacityRange : The permitted total capacity range (in gigabytes) of a share with this profile. +// This model "extends" ShareProfileCapacity +type ShareProfileCapacityRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the ShareProfileCapacityRange.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityRangeTypeRangeConst = "range" +) + +func (*ShareProfileCapacityRange) isaShareProfileCapacity() bool { + return true +} + +// UnmarshalShareProfileCapacityRange unmarshals an instance of ShareProfileCapacityRange from the specified map of raw messages. +func UnmarshalShareProfileCapacityRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCapacityRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIopsDependentRange : The permitted IOPS range of a share with this profile depends on its configuration. +// This model "extends" ShareProfileIops +type ShareProfileIopsDependentRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the ShareProfileIopsDependentRange.Type property. +// The type for this profile field. +const ( + ShareProfileIopsDependentRangeTypeDependentConst = "dependent" + ShareProfileIopsDependentRangeTypeDependentRangeConst = "dependent_range" +) + +func (*ShareProfileIopsDependentRange) isaShareProfileIops() bool { + return true +} + +// UnmarshalShareProfileIopsDependentRange unmarshals an instance of ShareProfileIopsDependentRange from the specified map of raw messages. +func UnmarshalShareProfileIopsDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIopsDependentRange) + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIopsEnum : The permitted IOPS values of a share with this profile. +// This model "extends" ShareProfileIops +type ShareProfileIopsEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 ShareProfileIopsEnum.Type property. +// The type for this profile field. +const ( + ShareProfileIopsEnumTypeEnumConst = "enum" +) + +func (*ShareProfileIopsEnum) isaShareProfileIops() bool { + return true +} + +// UnmarshalShareProfileIopsEnum unmarshals an instance of ShareProfileIopsEnum from the specified map of raw messages. +func UnmarshalShareProfileIopsEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIopsEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIopsFixed : The permitted IOPS of a share with this profile is fixed. +// This model "extends" ShareProfileIops +type ShareProfileIopsFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the ShareProfileIopsFixed.Type property. +// The type for this profile field. +const ( + ShareProfileIopsFixedTypeFixedConst = "fixed" +) + +func (*ShareProfileIopsFixed) isaShareProfileIops() bool { + return true +} + +// UnmarshalShareProfileIopsFixed unmarshals an instance of ShareProfileIopsFixed from the specified map of raw messages. +func UnmarshalShareProfileIopsFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIopsFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIopsRange : The permitted IOPS range of a share with this profile. +// This model "extends" ShareProfileIops +type ShareProfileIopsRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the ShareProfileIopsRange.Type property. +// The type for this profile field. +const ( + ShareProfileIopsRangeTypeRangeConst = "range" +) + +func (*ShareProfileIopsRange) isaShareProfileIops() bool { + return true +} + +// UnmarshalShareProfileIopsRange unmarshals an instance of ShareProfileIopsRange from the specified map of raw messages. +func UnmarshalShareProfileIopsRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIopsRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIdentityByHref : ShareProfileIdentityByHref struct +// This model "extends" ShareProfileIdentity +type ShareProfileIdentityByHref struct { + // The URL for this share profile. + Href *string `json:"href" validate:"required"` +} + +// NewShareProfileIdentityByHref : Instantiate ShareProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewShareProfileIdentityByHref(href string) (_model *ShareProfileIdentityByHref, err error) { + _model = &ShareProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareProfileIdentityByHref) isaShareProfileIdentity() bool { + return true +} + +// UnmarshalShareProfileIdentityByHref unmarshals an instance of ShareProfileIdentityByHref from the specified map of raw messages. +func UnmarshalShareProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareProfileIdentityByName : ShareProfileIdentityByName struct +// This model "extends" ShareProfileIdentity +type ShareProfileIdentityByName struct { + // The globally unique name for this share profile. + Name *string `json:"name" validate:"required"` +} + +// NewShareProfileIdentityByName : Instantiate ShareProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewShareProfileIdentityByName(name string) (_model *ShareProfileIdentityByName, err error) { + _model = &ShareProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareProfileIdentityByName) isaShareProfileIdentity() bool { + return true +} + +// UnmarshalShareProfileIdentityByName unmarshals an instance of ShareProfileIdentityByName from the specified map of raw messages. +func UnmarshalShareProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SharePrototypeShareBySize : Create a file share by size. +// This model "extends" SharePrototype +type SharePrototypeShareBySize struct { + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each client accessing the share will be restricted to 48,000 IOPS. + Iops *int64 `json:"iops,omitempty"` + + // The mount targets for the file share. Each mount target must be in a unique VPC. + MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` + + // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be + // a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use for this file share. The + // profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` + + ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this file share will reside in. + // + // For a replica share, this must be a different zone in the same region as the source share. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The access control mode for the share: + // + // - `security_group`: The security groups on the virtual network interface for a + // mount target control access to the mount target. Mount targets for this share + // require a virtual network interface. + // - `vpc`: All clients in the VPC for a mount target have access to the mount target. + // Mount targets for this share require a VPC. + AccessControlMode *string `json:"access_control_mode,omitempty"` + + // The root key to use to wrap the data encryption key for the share. + // + // If unspecified, the `encryption` type for the share will be `provider_managed`. + // + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The owner assigned to the file share at creation. Subsequent changes to the owner + // must be performed by a client that has mounted the file share. + InitialOwner *ShareInitialOwner `json:"initial_owner,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 size of the file share rounded up to the next gigabyte. + // + // The maximum size for a share may increase in the future. + Size *int64 `json:"size" validate:"required"` +} + +// Constants associated with the SharePrototypeShareBySize.AccessControlMode property. +// The access control mode for the share: +// +// - `security_group`: The security groups on the virtual network interface for a +// mount target control access to the mount target. Mount targets for this share +// require a virtual network interface. +// - `vpc`: All clients in the VPC for a mount target have access to the mount target. +// Mount targets for this share require a VPC. +const ( + SharePrototypeShareBySizeAccessControlModeSecurityGroupConst = "security_group" + SharePrototypeShareBySizeAccessControlModeVPCConst = "vpc" +) + +// NewSharePrototypeShareBySize : Instantiate SharePrototypeShareBySize (Generic Model Constructor) +func (*VpcV1) NewSharePrototypeShareBySize(profile ShareProfileIdentityIntf, zone ZoneIdentityIntf, size int64) (_model *SharePrototypeShareBySize, err error) { + _model = &SharePrototypeShareBySize{ + Profile: profile, + Zone: zone, + Size: core.Int64Ptr(size), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SharePrototypeShareBySize) isaSharePrototype() bool { + return true +} + +// UnmarshalSharePrototypeShareBySize unmarshals an instance of SharePrototypeShareBySize from the specified map of raw messages. +func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePrototypeShareBySize) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SharePrototypeShareBySourceShare : Create a replica file share for an existing file share. The values for `initial_owner`, +// `access_control_mode`, `encryption_key` and `size` will be inherited from `source_share`. +// This model "extends" SharePrototype +type SharePrototypeShareBySourceShare struct { + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each client accessing the share will be restricted to 48,000 IOPS. + Iops *int64 `json:"iops,omitempty"` + + // The mount targets for the file share. Each mount target must be in a unique VPC. + MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` + + // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be + // a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use for this file share. The + // profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` + + ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this file share will reside in. + // + // For a replica share, this must be a different zone in the same region as the source share. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The root key to use to wrap the data encryption key for the share. + // + // This property must be specified if the `source_share` is in a different region and has + // an `encryption` type of `user_managed`, and must not be specified otherwise (its value + // will be inherited from `source_share`). + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The cron specification for the file share replication schedule. + // + // Replication of a share can be scheduled to occur at most once per hour. + ReplicationCronSpec *string `json:"replication_cron_spec" validate:"required"` + + // The resource group to use. If unspecified, the resource group from + // the source share will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The source file share for this replica file share. The specified file share must not + // already have a replica, and must not be a replica. If source file share is specified + // by CRN, it may be in an [associated partner + // region](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-replication). + SourceShare ShareIdentityIntf `json:"source_share" validate:"required"` +} + +// NewSharePrototypeShareBySourceShare : Instantiate SharePrototypeShareBySourceShare (Generic Model Constructor) +func (*VpcV1) NewSharePrototypeShareBySourceShare(profile ShareProfileIdentityIntf, zone ZoneIdentityIntf, replicationCronSpec string, sourceShare ShareIdentityIntf) (_model *SharePrototypeShareBySourceShare, err error) { + _model = &SharePrototypeShareBySourceShare{ + Profile: profile, + Zone: zone, + ReplicationCronSpec: core.StringPtr(replicationCronSpec), + SourceShare: sourceShare, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SharePrototypeShareBySourceShare) isaSharePrototype() bool { + return true +} + +// UnmarshalSharePrototypeShareBySourceShare unmarshals an instance of SharePrototypeShareBySourceShare from the specified map of raw messages. +func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePrototypeShareBySourceShare) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots : SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots struct +// This model "extends" SnapshotConsistencyGroupPrototype +type SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots struct { + // Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. + DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete,omitempty"` + + // The name for this snapshot consistency group. The name must be unique across all snapshot consistency groups in the + // region. + // + // If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The data-consistent member snapshots to create. All snapshots must specify a + // `source_volume` attached to the same virtual server instance. + Snapshots []SnapshotPrototypeSnapshotConsistencyGroupContext `json:"snapshots" validate:"required"` +} + +// NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots : Instantiate SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots (Generic Model Constructor) +func (*VpcV1) NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots(snapshots []SnapshotPrototypeSnapshotConsistencyGroupContext) (_model *SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots, err error) { + _model = &SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots{ + Snapshots: snapshots, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) isaSnapshotConsistencyGroupPrototype() bool { + return true +} + +// UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots unmarshals an instance of SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots from the specified map of raw messages. +func UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) + err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotIdentityByCRN : SnapshotIdentityByCRN struct +// This model "extends" SnapshotIdentity +type SnapshotIdentityByCRN struct { + // The CRN of this snapshot. + CRN *string `json:"crn" validate:"required"` +} + +// NewSnapshotIdentityByCRN : Instantiate SnapshotIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSnapshotIdentityByCRN(crn string) (_model *SnapshotIdentityByCRN, err error) { + _model = &SnapshotIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotIdentityByCRN) isaSnapshotIdentity() bool { + return true +} + +// UnmarshalSnapshotIdentityByCRN unmarshals an instance of SnapshotIdentityByCRN from the specified map of raw messages. +func UnmarshalSnapshotIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotIdentityByHref : SnapshotIdentityByHref struct +// This model "extends" SnapshotIdentity +type SnapshotIdentityByHref struct { + // The URL for this snapshot. + Href *string `json:"href" validate:"required"` +} + +// NewSnapshotIdentityByHref : Instantiate SnapshotIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSnapshotIdentityByHref(href string) (_model *SnapshotIdentityByHref, err error) { + _model = &SnapshotIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotIdentityByHref) isaSnapshotIdentity() bool { + return true +} + +// UnmarshalSnapshotIdentityByHref unmarshals an instance of SnapshotIdentityByHref from the specified map of raw messages. +func UnmarshalSnapshotIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotIdentityByID : SnapshotIdentityByID struct +// This model "extends" SnapshotIdentity +type SnapshotIdentityByID struct { + // The unique identifier for this snapshot. + ID *string `json:"id" validate:"required"` +} + +// NewSnapshotIdentityByID : Instantiate SnapshotIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSnapshotIdentityByID(id string) (_model *SnapshotIdentityByID, err error) { + _model = &SnapshotIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotIdentityByID) isaSnapshotIdentity() bool { + return true +} + +// UnmarshalSnapshotIdentityByID unmarshals an instance of SnapshotIdentityByID from the specified map of raw messages. +func UnmarshalSnapshotIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotPrototypeSnapshotBySourceSnapshot : SnapshotPrototypeSnapshotBySourceSnapshot struct +// This model "extends" SnapshotPrototype +type SnapshotPrototypeSnapshotBySourceSnapshot struct { + // Clones to create for this snapshot. + Clones []SnapshotClonePrototype `json:"clones,omitempty"` + + // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` + + // The root key to use to wrap the data encryption key for this snapshot. + // + // A key must be specified if and only if the source snapshot has an `encryption` type of + // `user_managed`. To maximize snapshot availability and sharing of snapshot data, specify + // a key in the same region as the new snapshot, and use the same encryption key for all + // snapshots using the same source volume. + // + // The specified key may be in a different account, subject to IAM policies. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The source snapshot (in another region) to create this snapshot from. + // The specified snapshot must not already be the source of another snapshot in this + // region. + SourceSnapshot *SnapshotIdentityByCRN `json:"source_snapshot" validate:"required"` +} + +// NewSnapshotPrototypeSnapshotBySourceSnapshot : Instantiate SnapshotPrototypeSnapshotBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewSnapshotPrototypeSnapshotBySourceSnapshot(sourceSnapshot *SnapshotIdentityByCRN) (_model *SnapshotPrototypeSnapshotBySourceSnapshot, err error) { + _model = &SnapshotPrototypeSnapshotBySourceSnapshot{ + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotPrototypeSnapshotBySourceSnapshot) isaSnapshotPrototype() bool { + return true +} + +// UnmarshalSnapshotPrototypeSnapshotBySourceSnapshot unmarshals an instance of SnapshotPrototypeSnapshotBySourceSnapshot from the specified map of raw messages. +func UnmarshalSnapshotPrototypeSnapshotBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPrototypeSnapshotBySourceSnapshot) + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SnapshotPrototypeSnapshotBySourceVolume : SnapshotPrototypeSnapshotBySourceVolume struct +// This model "extends" SnapshotPrototype +type SnapshotPrototypeSnapshotBySourceVolume struct { + // Clones to create for this snapshot. + Clones []SnapshotClonePrototype `json:"clones,omitempty"` + + // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. + UserTags []string `json:"user_tags,omitempty"` + + // The volume to create this snapshot from. + SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` +} + +// NewSnapshotPrototypeSnapshotBySourceVolume : Instantiate SnapshotPrototypeSnapshotBySourceVolume (Generic Model Constructor) +func (*VpcV1) NewSnapshotPrototypeSnapshotBySourceVolume(sourceVolume VolumeIdentityIntf) (_model *SnapshotPrototypeSnapshotBySourceVolume, err error) { + _model = &SnapshotPrototypeSnapshotBySourceVolume{ + SourceVolume: sourceVolume, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SnapshotPrototypeSnapshotBySourceVolume) isaSnapshotPrototype() bool { + return true +} + +// UnmarshalSnapshotPrototypeSnapshotBySourceVolume unmarshals an instance of SnapshotPrototypeSnapshotBySourceVolume from the specified map of raw messages. +func UnmarshalSnapshotPrototypeSnapshotBySourceVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotPrototypeSnapshotBySourceVolume) + err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentityByCRN : SubnetIdentityByCRN struct +// This model "extends" SubnetIdentity +type SubnetIdentityByCRN struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` +} + +// NewSubnetIdentityByCRN : Instantiate SubnetIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSubnetIdentityByCRN(crn string) (_model *SubnetIdentityByCRN, err error) { + _model = &SubnetIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetIdentityByCRN) isaSubnetIdentity() bool { + return true +} + +// UnmarshalSubnetIdentityByCRN unmarshals an instance of SubnetIdentityByCRN from the specified map of raw messages. +func UnmarshalSubnetIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentityByHref : SubnetIdentityByHref struct +// This model "extends" SubnetIdentity +type SubnetIdentityByHref struct { + // The URL for this subnet. + Href *string `json:"href" validate:"required"` +} + +// NewSubnetIdentityByHref : Instantiate SubnetIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSubnetIdentityByHref(href string) (_model *SubnetIdentityByHref, err error) { + _model = &SubnetIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetIdentityByHref) isaSubnetIdentity() bool { + return true +} + +// UnmarshalSubnetIdentityByHref unmarshals an instance of SubnetIdentityByHref from the specified map of raw messages. +func UnmarshalSubnetIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentityByID : SubnetIdentityByID struct +// This model "extends" SubnetIdentity +type SubnetIdentityByID struct { + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` +} + +// NewSubnetIdentityByID : Instantiate SubnetIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSubnetIdentityByID(id string) (_model *SubnetIdentityByID, err error) { + _model = &SubnetIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetIdentityByID) isaSubnetIdentity() bool { + return true +} + +// UnmarshalSubnetIdentityByID unmarshals an instance of SubnetIdentityByID from the specified map of raw messages. +func UnmarshalSubnetIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPrototypeSubnetByCIDR : SubnetPrototypeSubnetByCIDR struct +// This model "extends" SubnetPrototype +type SubnetPrototypeSubnetByCIDR struct { + // The IP version(s) to support for this subnet. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a + // hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to use for internet-bound traffic for this subnet. If unspecified, the subnet will not be + // attached to a public gateway. + PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The routing table to use for this subnet. If unspecified, the default routing table for the VPC is used. The routing + // table properties `route_direct_link_ingress`, + // `route_internet_ingress`, `route_transit_gateway_ingress`, and + // `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` + + // The VPC the subnet will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The IPv4 range of the subnet, expressed in CIDR format. The prefix length of the subnet's CIDR must be between `/9` + // (8,388,608 addresses) and `/29` (8 addresses). The IPv4 range of the subnet's CIDR must fall within an existing + // address prefix in the VPC and must not overlap with any existing subnet. The subnet will be created in the zone of + // the address prefix that contains the IPv4 CIDR. If zone is specified, it must match the zone of the address prefix + // that contains the subnet's IPv4 CIDR. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` + + // The zone this subnet will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// Constants associated with the SubnetPrototypeSubnetByCIDR.IPVersion property. +// The IP version(s) to support for this subnet. +const ( + SubnetPrototypeSubnetByCIDRIPVersionIpv4Const = "ipv4" +) + +// NewSubnetPrototypeSubnetByCIDR : Instantiate SubnetPrototypeSubnetByCIDR (Generic Model Constructor) +func (*VpcV1) NewSubnetPrototypeSubnetByCIDR(vpc VPCIdentityIntf, ipv4CIDRBlock string) (_model *SubnetPrototypeSubnetByCIDR, err error) { + _model = &SubnetPrototypeSubnetByCIDR{ + VPC: vpc, + Ipv4CIDRBlock: core.StringPtr(ipv4CIDRBlock), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPrototypeSubnetByCIDR) isaSubnetPrototype() bool { + return true +} + +// UnmarshalSubnetPrototypeSubnetByCIDR unmarshals an instance of SubnetPrototypeSubnetByCIDR from the specified map of raw messages. +func UnmarshalSubnetPrototypeSubnetByCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPrototypeSubnetByCIDR) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPrototypeSubnetByTotalCount : SubnetPrototypeSubnetByTotalCount struct +// This model "extends" SubnetPrototype +type SubnetPrototypeSubnetByTotalCount struct { + // The IP version(s) to support for this subnet. + IPVersion *string `json:"ip_version,omitempty"` + + // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a + // hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to use for internet-bound traffic for this subnet. If unspecified, the subnet will not be + // attached to a public gateway. + PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The routing table to use for this subnet. If unspecified, the default routing table for the VPC is used. The routing + // table properties `route_direct_link_ingress`, + // `route_internet_ingress`, `route_transit_gateway_ingress`, and + // `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` + + // The VPC the subnet will reside in. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The total number of IPv4 addresses required. Must be a power of 2. The VPC must have a default address prefix in the + // specified zone, and that prefix must have a free CIDR range with at least this number of addresses. + TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count" validate:"required"` + + // The zone this subnet will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// Constants associated with the SubnetPrototypeSubnetByTotalCount.IPVersion property. +// The IP version(s) to support for this subnet. +const ( + SubnetPrototypeSubnetByTotalCountIPVersionIpv4Const = "ipv4" +) + +// NewSubnetPrototypeSubnetByTotalCount : Instantiate SubnetPrototypeSubnetByTotalCount (Generic Model Constructor) +func (*VpcV1) NewSubnetPrototypeSubnetByTotalCount(vpc VPCIdentityIntf, totalIpv4AddressCount int64, zone ZoneIdentityIntf) (_model *SubnetPrototypeSubnetByTotalCount, err error) { + _model = &SubnetPrototypeSubnetByTotalCount{ + VPC: vpc, + TotalIpv4AddressCount: core.Int64Ptr(totalIpv4AddressCount), + Zone: zone, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPrototypeSubnetByTotalCount) isaSubnetPrototype() bool { + return true +} + +// UnmarshalSubnetPrototypeSubnetByTotalCount unmarshals an instance of SubnetPrototypeSubnetByTotalCount from the specified map of raw messages. +func UnmarshalSubnetPrototypeSubnetByTotalCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPrototypeSubnetByTotalCount) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPublicGatewayPatchPublicGatewayIdentityByCRN : SubnetPublicGatewayPatchPublicGatewayIdentityByCRN struct +// This model "extends" SubnetPublicGatewayPatch +type SubnetPublicGatewayPatchPublicGatewayIdentityByCRN struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` +} + +// NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(crn string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByCRN, err error) { + _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPublicGatewayPatchPublicGatewayIdentityByCRN) isaSubnetPublicGatewayPatch() bool { + return true +} + +// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByCRN unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByCRN from the specified map of raw messages. +func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPublicGatewayPatchPublicGatewayIdentityByHref : SubnetPublicGatewayPatchPublicGatewayIdentityByHref struct +// This model "extends" SubnetPublicGatewayPatch +type SubnetPublicGatewayPatchPublicGatewayIdentityByHref struct { + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` +} + +// NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref(href string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByHref, err error) { + _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPublicGatewayPatchPublicGatewayIdentityByHref) isaSubnetPublicGatewayPatch() bool { + return true +} + +// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByHref unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByHref from the specified map of raw messages. +func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPublicGatewayPatchPublicGatewayIdentityByID : SubnetPublicGatewayPatchPublicGatewayIdentityByID struct +// This model "extends" SubnetPublicGatewayPatch +type SubnetPublicGatewayPatchPublicGatewayIdentityByID struct { + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` +} + +// NewSubnetPublicGatewayPatchPublicGatewayIdentityByID : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByID(id string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByID, err error) { + _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SubnetPublicGatewayPatchPublicGatewayIdentityByID) isaSubnetPublicGatewayPatch() bool { + return true +} + +// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByID unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByID from the specified map of raw messages. +func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfileIdentityTrustedProfileByCRN : TrustedProfileIdentityTrustedProfileByCRN struct +// This model "extends" TrustedProfileIdentity +type TrustedProfileIdentityTrustedProfileByCRN 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{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*TrustedProfileIdentityTrustedProfileByCRN) 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) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfileIdentityTrustedProfileByID : TrustedProfileIdentityTrustedProfileByID struct +// This model "extends" TrustedProfileIdentity +type TrustedProfileIdentityTrustedProfileByID 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{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*TrustedProfileIdentityTrustedProfileByID) 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) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype : Manually specify the DNS server addresses for this VPC. +// This model "extends" VpcdnsResolverPrototype +type VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype struct { + // The DNS servers to use for this VPC. All the DNS servers must either: + // + // - have a unique `zone_affinity`, or + // - not have a `zone_affinity`. + // + // If `zone_affinity` is specified, exactly one DNS server must be specified for each zone in the region. The DHCP + // [Domain Name Server Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list this DNS + // server first, followed by unique DNS servers from other zones if available. + // + // If `zone_affinity` is not specified, the DHCP [Domain Name Server + // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS + // servers in the order specified. + ManualServers []DnsServerPrototype `json:"manual_servers" validate:"required"` + + // The type of the DNS resolver to use. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype.Type property. +// The type of the DNS resolver to use. +const ( + VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototypeTypeManualConst = "manual" +) + +// NewVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype : Instantiate VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype (Generic Model Constructor) +func (*VpcV1) NewVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype(manualServers []DnsServerPrototype, typeVar string) (_model *VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype, err error) { + _model = &VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype{ + ManualServers: manualServers, + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype) isaVpcdnsResolverPrototype() bool { + return true +} + +// UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype unmarshals an instance of VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype from the specified map of raw messages. +func UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype) + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype : The system will provide DNS server addresses for this VPC. The system-provided DNS server addresses depend on whether +// any endpoint gateways reside in the VPC, and whether a +// [DNS Services](https://cloud.ibm.com/docs/dns-svcs) instance is configured for the VPC. +// This model "extends" VpcdnsResolverPrototype +type VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype struct { + // The type of the DNS resolver to use. + Type *string `json:"type,omitempty"` +} + +// Constants associated with the VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype.Type property. +// The type of the DNS resolver to use. +const ( + VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototypeTypeSystemConst = "system" +) + +func (*VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype) isaVpcdnsResolverPrototype() bool { + return true +} + +// UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype unmarshals an instance of VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype from the specified map of raw messages. +func UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverTypeDelegated : The DNS server addresses are delegated to the DNS resolver of another VPC. +// This model "extends" VpcdnsResolver +type VpcdnsResolverTypeDelegated struct { + // The DNS servers for this VPC. The servers are populated: + // + // - by the system when `dns.resolver.type` is `system` + // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + Servers []DnsServer `json:"servers" validate:"required"` + + // The type of the DNS resolver used for the VPC. + Type *string `json:"type" validate:"required"` + + // The VPC whose DNS resolver provides the DNS server addresses for this VPC. + // + // The VPC may be remote and therefore may not be directly retrievable. + VPC *VPCReferenceDnsResolverContext `json:"vpc" validate:"required"` +} + +// Constants associated with the VpcdnsResolverTypeDelegated.Type property. +// The type of the DNS resolver used for the VPC. +const ( + VpcdnsResolverTypeDelegatedTypeDelegatedConst = "delegated" +) + +func (*VpcdnsResolverTypeDelegated) isaVpcdnsResolver() bool { + return true +} + +// UnmarshalVpcdnsResolverTypeDelegated unmarshals an instance of VpcdnsResolverTypeDelegated from the specified map of raw messages. +func UnmarshalVpcdnsResolverTypeDelegated(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverTypeDelegated) + err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverTypeManual : The DNS server addresses are manually specified. +// This model "extends" VpcdnsResolver +type VpcdnsResolverTypeManual struct { + // The DNS servers for this VPC. The servers are populated: + // + // - by the system when `dns.resolver.type` is `system` + // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + Servers []DnsServer `json:"servers" validate:"required"` + + // The manually specified DNS servers for this VPC. + // + // If the DNS servers have `zone_affinity`, the DHCP [Domain Name Server + // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list the DNS server with the + // affinity for that zone first, followed by the unique DNS servers from other zones. + // + // If the DNS servers do not have `zone_affinity`, the DHCP [Domain Name Server + // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS + // servers in the order specified. + ManualServers []DnsServer `json:"manual_servers" validate:"required"` + + // The type of the DNS resolver used for the VPC. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VpcdnsResolverTypeManual.Type property. +// The type of the DNS resolver used for the VPC. +const ( + VpcdnsResolverTypeManualTypeManualConst = "manual" +) + +func (*VpcdnsResolverTypeManual) isaVpcdnsResolver() bool { + return true +} + +// UnmarshalVpcdnsResolverTypeManual unmarshals an instance of VpcdnsResolverTypeManual from the specified map of raw messages. +func UnmarshalVpcdnsResolverTypeManual(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverTypeManual) + err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverTypeSystem : The DNS server addresses are provided by the system and depend on the configuration. +// This model "extends" VpcdnsResolver +type VpcdnsResolverTypeSystem struct { + // The DNS servers for this VPC. The servers are populated: + // + // - by the system when `dns.resolver.type` is `system` + // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + Servers []DnsServer `json:"servers" validate:"required"` + + // The configuration of the system DNS resolver for this VPC. + // + // - `custom_resolver`: A custom DNS resolver is configured for this VPC. + // + // - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when + // the VPC has either or both of the following: + // + // - at least one endpoint gateway residing in it + // - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it + // + // - `default`: The provider default DNS resolvers are configured for this VPC. + // + // This system DNS resolver configuration is used when the VPC has: + // + // - no custom DNS resolver configured for it, and + // - no endpoint gateways residing in it, and + // - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. + Configuration *string `json:"configuration" validate:"required"` + + // The type of the DNS resolver used for the VPC. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VpcdnsResolverTypeSystem.Configuration property. +// The configuration of the system DNS resolver for this VPC. +// +// - `custom_resolver`: A custom DNS resolver is configured for this VPC. +// +// - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when +// the VPC has either or both of the following: +// +// - at least one endpoint gateway residing in it +// +// - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it +// +// - `default`: The provider default DNS resolvers are configured for this VPC. +// +// This system DNS resolver configuration is used when the VPC has: +// +// - no custom DNS resolver configured for it, and +// - no endpoint gateways residing in it, and +// - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. +const ( + VpcdnsResolverTypeSystemConfigurationCustomResolverConst = "custom_resolver" + VpcdnsResolverTypeSystemConfigurationDefaultConst = "default" + VpcdnsResolverTypeSystemConfigurationPrivateResolverConst = "private_resolver" +) + +// Constants associated with the VpcdnsResolverTypeSystem.Type property. +// The type of the DNS resolver used for the VPC. +const ( + VpcdnsResolverTypeSystemTypeSystemConst = "system" +) + +func (*VpcdnsResolverTypeSystem) isaVpcdnsResolver() bool { + return true +} + +// UnmarshalVpcdnsResolverTypeSystem unmarshals an instance of VpcdnsResolverTypeSystem from the specified map of raw messages. +func UnmarshalVpcdnsResolverTypeSystem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverTypeSystem) + err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverVPCPatchVPCIdentityByCRN : VpcdnsResolverVPCPatchVPCIdentityByCRN struct +// This model "extends" VpcdnsResolverVPCPatch +type VpcdnsResolverVPCPatchVPCIdentityByCRN struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` +} + +// NewVpcdnsResolverVPCPatchVPCIdentityByCRN : Instantiate VpcdnsResolverVPCPatchVPCIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByCRN(crn string) (_model *VpcdnsResolverVPCPatchVPCIdentityByCRN, err error) { + _model = &VpcdnsResolverVPCPatchVPCIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VpcdnsResolverVPCPatchVPCIdentityByCRN) isaVpcdnsResolverVPCPatch() bool { + return true +} + +// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByCRN unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByCRN from the specified map of raw messages. +func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverVPCPatchVPCIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverVPCPatchVPCIdentityByHref : VpcdnsResolverVPCPatchVPCIdentityByHref struct +// This model "extends" VpcdnsResolverVPCPatch +type VpcdnsResolverVPCPatchVPCIdentityByHref struct { + // The URL for this VPC. + Href *string `json:"href" validate:"required"` +} + +// NewVpcdnsResolverVPCPatchVPCIdentityByHref : Instantiate VpcdnsResolverVPCPatchVPCIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByHref(href string) (_model *VpcdnsResolverVPCPatchVPCIdentityByHref, err error) { + _model = &VpcdnsResolverVPCPatchVPCIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VpcdnsResolverVPCPatchVPCIdentityByHref) isaVpcdnsResolverVPCPatch() bool { + return true +} + +// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByHref unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByHref from the specified map of raw messages. +func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverVPCPatchVPCIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpcdnsResolverVPCPatchVPCIdentityByID : VpcdnsResolverVPCPatchVPCIdentityByID struct +// This model "extends" VpcdnsResolverVPCPatch +type VpcdnsResolverVPCPatchVPCIdentityByID struct { + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` +} + +// NewVpcdnsResolverVPCPatchVPCIdentityByID : Instantiate VpcdnsResolverVPCPatchVPCIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByID(id string) (_model *VpcdnsResolverVPCPatchVPCIdentityByID, err error) { + _model = &VpcdnsResolverVPCPatchVPCIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VpcdnsResolverVPCPatchVPCIdentityByID) isaVpcdnsResolverVPCPatch() bool { + return true +} + +// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByID unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByID from the specified map of raw messages. +func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolverVPCPatchVPCIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentityByCRN : VPCIdentityByCRN struct +// This model "extends" VPCIdentity +type VPCIdentityByCRN struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` +} + +// NewVPCIdentityByCRN : Instantiate VPCIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVPCIdentityByCRN(crn string) (_model *VPCIdentityByCRN, err error) { + _model = &VPCIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPCIdentityByCRN) isaVPCIdentity() bool { + return true +} + +// UnmarshalVPCIdentityByCRN unmarshals an instance of VPCIdentityByCRN from the specified map of raw messages. +func UnmarshalVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentityByHref : VPCIdentityByHref struct +// This model "extends" VPCIdentity +type VPCIdentityByHref struct { + // The URL for this VPC. + Href *string `json:"href" validate:"required"` +} + +// NewVPCIdentityByHref : Instantiate VPCIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPCIdentityByHref(href string) (_model *VPCIdentityByHref, err error) { + _model = &VPCIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPCIdentityByHref) isaVPCIdentity() bool { + return true +} + +// UnmarshalVPCIdentityByHref unmarshals an instance of VPCIdentityByHref from the specified map of raw messages. +func UnmarshalVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentityByID : VPCIdentityByID struct +// This model "extends" VPCIdentity +type VPCIdentityByID struct { + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` +} + +// NewVPCIdentityByID : Instantiate VPCIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPCIdentityByID(id string) (_model *VPCIdentityByID, err error) { + _model = &VPCIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPCIdentityByID) isaVPCIdentity() bool { + return true +} + +// UnmarshalVPCIdentityByID unmarshals an instance of VPCIdentityByID from the specified map of raw messages. +func UnmarshalVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn struct +// This model "extends" VPNGatewayConnectionIkeIdentityPrototype +type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn struct { + // The IKE identity type. + Type *string `json:"type" validate:"required"` + + // The IKE identity FQDN value. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn.Type property. +// The IKE identity type. +const ( + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdnTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdnTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdnTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdnTypeKeyIDConst = "key_id" +) + +// NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn : Instantiate VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn(typeVar string, value string) (_model *VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn, err error) { + _model = &VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn{ + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn) isaVPNGatewayConnectionIkeIdentityPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname struct +// This model "extends" VPNGatewayConnectionIkeIdentityPrototype +type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname struct { + // The IKE identity type. + Type *string `json:"type" validate:"required"` + + // The IKE identity hostname value. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname.Type property. +// The IKE identity type. +const ( + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostnameTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostnameTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostnameTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostnameTypeKeyIDConst = "key_id" +) + +// NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname : Instantiate VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname(typeVar string, value string) (_model *VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname, err error) { + _model = &VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname{ + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname) isaVPNGatewayConnectionIkeIdentityPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 struct +// This model "extends" VPNGatewayConnectionIkeIdentityPrototype +type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 struct { + // The IKE identity type. + Type *string `json:"type" validate:"required"` + + // The IKE identity IPv4 address value. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4.Type property. +// The IKE identity type. +const ( + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4TypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4TypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4TypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4TypeKeyIDConst = "key_id" +) + +// NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 : Instantiate VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4(typeVar string, value string) (_model *VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4, err error) { + _model = &VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4{ + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4) isaVPNGatewayConnectionIkeIdentityPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID struct +// This model "extends" VPNGatewayConnectionIkeIdentityPrototype +type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID struct { + // The IKE identity type. + Type *string `json:"type" validate:"required"` + + // The base64-encoded IKE identity key ID value. + Value *[]byte `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID.Type property. +// The IKE identity type. +const ( + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyIDTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyIDTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyIDTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyIDTypeKeyIDConst = "key_id" +) + +// NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID : Instantiate VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID(typeVar string, value []byte) (_model *VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID, err error) { + _model = &VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID{ + Type: core.StringPtr(typeVar), + Value: &value, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID) isaVPNGatewayConnectionIkeIdentityPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn : VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn struct +// This model "extends" VPNGatewayConnectionIkeIdentity +type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn struct { + // The IKE identity type. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + Type *string `json:"type" validate:"required"` + + // The IKE identity FQDN value. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn.Type property. +// The IKE identity type. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected +// property value was encountered. +const ( + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnTypeKeyIDConst = "key_id" +) + +func (*VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn) isaVPNGatewayConnectionIkeIdentity() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn unmarshals an instance of VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname : VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname struct +// This model "extends" VPNGatewayConnectionIkeIdentity +type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname struct { + // The IKE identity type. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + Type *string `json:"type" validate:"required"` + + // The IKE identity hostname value. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname.Type property. +// The IKE identity type. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected +// property value was encountered. +const ( + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameTypeKeyIDConst = "key_id" +) + +func (*VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname) isaVPNGatewayConnectionIkeIdentity() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname unmarshals an instance of VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 : VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 struct +// This model "extends" VPNGatewayConnectionIkeIdentity +type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 struct { + // The IKE identity type. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + Type *string `json:"type" validate:"required"` + + // The IKE identity IPv4 address value. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4.Type property. +// The IKE identity type. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected +// property value was encountered. +const ( + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4TypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4TypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4TypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4TypeKeyIDConst = "key_id" +) + +func (*VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4) isaVPNGatewayConnectionIkeIdentity() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 unmarshals an instance of VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID : VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID struct +// This model "extends" VPNGatewayConnectionIkeIdentity +type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID struct { + // The IKE identity type. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + Type *string `json:"type" validate:"required"` + + // The base64-encoded IKE identity key ID value. + Value *[]byte `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID.Type property. +// The IKE identity type. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected +// property value was encountered. +const ( + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDTypeKeyIDConst = "key_id" +) + +func (*VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID) isaVPNGatewayConnectionIkeIdentity() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID unmarshals an instance of VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref : VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref struct +// This model "extends" VPNGatewayConnectionIkePolicyPatch +type VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref struct { + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref : Instantiate VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref, err error) { + _model = &VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref) isaVPNGatewayConnectionIkePolicyPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID : VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID struct +// This model "extends" VPNGatewayConnectionIkePolicyPatch +type VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID struct { + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` +} + +// NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID : Instantiate VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(id string) (_model *VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID, err error) { + _model = &VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) isaVPNGatewayConnectionIkePolicyPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref : VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref struct +// This model "extends" VPNGatewayConnectionIkePolicyPrototype +type VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref struct { + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref : Instantiate VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref, err error) { + _model = &VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref) isaVPNGatewayConnectionIkePolicyPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID : VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID struct +// This model "extends" VPNGatewayConnectionIkePolicyPrototype +type VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID struct { + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` +} + +// NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID : Instantiate VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(id string) (_model *VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID, err error) { + _model = &VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) isaVPNGatewayConnectionIkePolicyPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref : VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref struct +// This model "extends" VPNGatewayConnectionIPsecPolicyPatch +type VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref struct { + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref : Instantiate VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref, err error) { + _model = &VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref) isaVPNGatewayConnectionIPsecPolicyPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID : VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID struct +// This model "extends" VPNGatewayConnectionIPsecPolicyPatch +type VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` +} + +// NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID : Instantiate VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(id string) (_model *VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID, err error) { + _model = &VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) isaVPNGatewayConnectionIPsecPolicyPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref : VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref struct +// This model "extends" VPNGatewayConnectionIPsecPolicyPrototype +type VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref struct { + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref : Instantiate VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref, err error) { + _model = &VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID : VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID struct +// This model "extends" VPNGatewayConnectionIPsecPolicyPrototype +type VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` +} + +// NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID : Instantiate VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(id string) (_model *VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID, err error) { + _model = &VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch : 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: +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch +// This model "extends" VPNGatewayConnectionPeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch struct { + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch() bool { + return true +} + +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchIntf interface { + VPNGatewayConnectionPeerPatchIntf + isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch() bool +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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: +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch +// This model "extends" VPNGatewayConnectionPeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch struct { + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch() bool { + return true +} + +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchIntf interface { + VPNGatewayConnectionPeerPatchIntf + isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch() bool +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyMode : VPNGatewayConnectionPolicyMode struct +// This model "extends" VPNGatewayConnection +type VPNGatewayConnectionPolicyMode struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The IKE policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // The IPsec policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` + + // The pre-shared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // The reasons for the current VPN gateway connection status (if any): + // - `cannot_authenticate_connection`: Failed to authenticate a connection because of + // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) + // - `internal_error`: Internal error (contact IBM support) + // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check + // the IKE policies on both sides of the VPN) + // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and + // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE + // V1 configuration) + // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE + // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) + // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable + // (check the IPsec policies on both sides of the VPN) + // - `peer_not_responding`: No response from peer (check network ACL configuration, peer + // availability, and on-premise firewall configuration) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + + Local *VPNGatewayConnectionPolicyModeLocal `json:"local" validate:"required"` + + Peer VPNGatewayConnectionPolicyModePeerIntf `json:"peer" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionPolicyMode.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionPolicyModeAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnectionPolicyMode.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionPolicyModeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionPolicyModeEstablishModePeerOnlyConst = "peer_only" +) + +// Constants associated with the VPNGatewayConnectionPolicyMode.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionPolicyModeModePolicyConst = "policy" + VPNGatewayConnectionPolicyModeModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnectionPolicyMode.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionPolicyModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnectionPolicyMode.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionPolicyModeStatusDownConst = "down" + VPNGatewayConnectionPolicyModeStatusUpConst = "up" +) + +func (*VPNGatewayConnectionPolicyMode) isaVPNGatewayConnection() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPolicyMode unmarshals an instance of VPNGatewayConnectionPolicyMode from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyMode) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionPolicyModeLocal) + if err != nil { + return + } + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionPolicyModePeer) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress struct +// This model "extends" VPNGatewayConnectionPolicyModePeerPrototype +type VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress struct { + // The peer CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address" validate:"required"` +} + +// NewVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress : Instantiate VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress(cidrs []string, address string) (_model *VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress, err error) { + _model = &VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress{ + CIDRs: cidrs, + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionPolicyModePeerPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct +// This model "extends" VPNGatewayConnectionPolicyModePeerPrototype +type VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct { + // The peer CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn" validate:"required"` +} + +// NewVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn : Instantiate VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn(cidrs []string, fqdn string) (_model *VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn, err error) { + _model = &VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn{ + CIDRs: cidrs, + Fqdn: core.StringPtr(fqdn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionPolicyModePeerPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress struct +// This model "extends" VPNGatewayConnectionPolicyModePeer +type VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress struct { + // The peer CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddressTypeAddressConst = "address" + VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddressTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionPolicyModePeer() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn struct +// This model "extends" VPNGatewayConnectionPolicyModePeer +type VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn struct { + // The peer CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdnTypeAddressConst = "address" + VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdnTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionPolicyModePeer() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct +// This model "extends" VPNGatewayConnectionPrototype +type VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode,omitempty"` + + IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` + + IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` + + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The pre-shared key. + Psk *string `json:"psk" validate:"required"` + + Local *VPNGatewayConnectionPolicyModeLocalPrototype `json:"local" validate:"required"` + + Peer VPNGatewayConnectionPolicyModePeerPrototypeIntf `json:"peer" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototypeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototypeEstablishModePeerOnlyConst = "peer_only" +) + +// NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(psk string, local *VPNGatewayConnectionPolicyModeLocalPrototype, peer VPNGatewayConnectionPolicyModePeerPrototypeIntf) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype, err error) { + _model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype{ + Psk: core.StringPtr(psk), + Local: local, + Peer: peer, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype) isaVPNGatewayConnectionPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype unmarshals an instance of VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionPolicyModeLocalPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionPolicyModePeerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype struct +// This model "extends" VPNGatewayConnectionPrototype +type VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode,omitempty"` + + IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` + + IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` + + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The pre-shared key. + Psk *string `json:"psk" validate:"required"` + + Local *VPNGatewayConnectionStaticRouteModeLocalPrototype `json:"local,omitempty"` + + Peer VPNGatewayConnectionStaticRouteModePeerPrototypeIntf `json:"peer" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototypeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototypeEstablishModePeerOnlyConst = "peer_only" +) + +// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototypeRoutingProtocolNoneConst = "none" +) + +// NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(psk string, peer VPNGatewayConnectionStaticRouteModePeerPrototypeIntf) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype, err error) { + _model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype{ + Psk: core.StringPtr(psk), + Peer: peer, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) isaVPNGatewayConnectionPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype unmarshals an instance of VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionStaticRouteMode struct +// This model "extends" VPNGatewayConnection +type VPNGatewayConnectionStaticRouteMode struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The IKE policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // The IPsec policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` + + // The pre-shared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // The reasons for the current VPN gateway connection status (if any): + // - `cannot_authenticate_connection`: Failed to authenticate a connection because of + // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) + // - `internal_error`: Internal error (contact IBM support) + // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check + // the IKE policies on both sides of the VPN) + // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and + // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE + // V1 configuration) + // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE + // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) + // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable + // (check the IPsec policies on both sides of the VPN) + // - `peer_not_responding`: No response from peer (check network ACL configuration, peer + // availability, and on-premise firewall configuration) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + + Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local" validate:"required"` + + Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol" validate:"required"` + + // The VPN tunnel configuration for this VPN gateway connection (in static route mode). + Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionStaticRouteModeAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionStaticRouteModeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionStaticRouteModeEstablishModePeerOnlyConst = "peer_only" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionStaticRouteModeModePolicyConst = "policy" + VPNGatewayConnectionStaticRouteModeModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionStaticRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionStaticRouteModeStatusDownConst = "down" + VPNGatewayConnectionStaticRouteModeStatusUpConst = "up" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionStaticRouteModeRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnection() bool { + return true +} + +// UnmarshalVPNGatewayConnectionStaticRouteMode unmarshals an instance of VPNGatewayConnectionStaticRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteMode) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocal) + if err != nil { + return + } + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress struct +// This model "extends" VPNGatewayConnectionStaticRouteModePeerPrototype +type VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress struct { + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address" validate:"required"` +} + +// NewVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress : Instantiate VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress(address string) (_model *VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress, err error) { + _model = &VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionStaticRouteModePeerPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress) + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct +// This model "extends" VPNGatewayConnectionStaticRouteModePeerPrototype +type VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct { + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn" validate:"required"` +} + +// NewVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn : Instantiate VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn(fqdn string) (_model *VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn, err error) { + _model = &VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn{ + Fqdn: core.StringPtr(fqdn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionStaticRouteModePeerPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn) + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress struct +// This model "extends" VPNGatewayConnectionStaticRouteModePeer +type VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress struct { + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddressTypeAddressConst = "address" + VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddressTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionStaticRouteModePeer() bool { + return true +} + +// UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress) + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn struct +// This model "extends" VPNGatewayConnectionStaticRouteModePeer +type VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn struct { + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdnTypeAddressConst = "address" + VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdnTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionStaticRouteModePeer() bool { + return true +} + +// UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn) + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPolicyMode : VPNGatewayPolicyMode struct +// This model "extends" VPNGateway +type VPNGatewayPolicyMode struct { + // Connections for this VPN gateway. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // The reasons for the current VPN gateway health_state (if any): + // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (contact IBM support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPNGatewayHealthReason `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 VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // The reasons for the current VPN gateway lifecycle_state (if any): + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the VPN gateway. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPN gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The VPC this VPN gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // Policy mode VPN gateway. + Mode *string `json:"mode" validate:"required"` +} + +// Constants associated with the VPNGatewayPolicyMode.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 ( + VPNGatewayPolicyModeHealthStateDegradedConst = "degraded" + VPNGatewayPolicyModeHealthStateFaultedConst = "faulted" + VPNGatewayPolicyModeHealthStateInapplicableConst = "inapplicable" + VPNGatewayPolicyModeHealthStateOkConst = "ok" +) + +// Constants associated with the VPNGatewayPolicyMode.LifecycleState property. +// The lifecycle state of the VPN gateway. +const ( + VPNGatewayPolicyModeLifecycleStateDeletingConst = "deleting" + VPNGatewayPolicyModeLifecycleStateFailedConst = "failed" + VPNGatewayPolicyModeLifecycleStatePendingConst = "pending" + VPNGatewayPolicyModeLifecycleStateStableConst = "stable" + VPNGatewayPolicyModeLifecycleStateSuspendedConst = "suspended" + VPNGatewayPolicyModeLifecycleStateUpdatingConst = "updating" + VPNGatewayPolicyModeLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNGatewayPolicyMode.ResourceType property. +// The resource type. +const ( + VPNGatewayPolicyModeResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGatewayPolicyMode.Mode property. +// Policy mode VPN gateway. +const ( + VPNGatewayPolicyModeModePolicyConst = "policy" +) + +func (*VPNGatewayPolicyMode) isaVPNGateway() bool { + return true +} + +// UnmarshalVPNGatewayPolicyMode unmarshals an instance of VPNGatewayPolicyMode from the specified map of raw messages. +func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPolicyMode) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPrototypeVPNGatewayPolicyModePrototype : VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct +// This model "extends" VPNGatewayPrototype +type VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct { + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Policy mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototypeVPNGatewayPolicyModePrototype.Mode property. +// Policy mode VPN gateway. +const ( + VPNGatewayPrototypeVPNGatewayPolicyModePrototypeModePolicyConst = "policy" +) + +// NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayPolicyModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayPolicyModePrototype, err error) { + _model = &VPNGatewayPrototypeVPNGatewayPolicyModePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayPrototypeVPNGatewayPolicyModePrototype) isaVPNGatewayPrototype() bool { + return true +} + +// UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayPolicyModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototypeVPNGatewayPolicyModePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPrototypeVPNGatewayRouteModePrototype : VPNGatewayPrototypeVPNGatewayRouteModePrototype struct +// This model "extends" VPNGatewayPrototype +type VPNGatewayPrototypeVPNGatewayRouteModePrototype struct { + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototypeVPNGatewayRouteModePrototype.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayPrototypeVPNGatewayRouteModePrototypeModeRouteConst = "route" +) + +// NewVPNGatewayPrototypeVPNGatewayRouteModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayRouteModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayRouteModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayRouteModePrototype, err error) { + _model = &VPNGatewayPrototypeVPNGatewayRouteModePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNGatewayPrototypeVPNGatewayRouteModePrototype) isaVPNGatewayPrototype() bool { + return true +} + +// UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayRouteModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototypeVPNGatewayRouteModePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayRouteMode : VPNGatewayRouteMode struct +// This model "extends" VPNGateway +type VPNGatewayRouteMode struct { + // Connections for this VPN gateway. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // The reasons for the current VPN gateway health_state (if any): + // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (contact IBM support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VPNGatewayHealthReason `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 VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // The reasons for the current VPN gateway lifecycle_state (if any): + // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM + // support) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the VPN gateway. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPN gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The VPC this VPN gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode" validate:"required"` +} + +// Constants associated with the VPNGatewayRouteMode.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 ( + VPNGatewayRouteModeHealthStateDegradedConst = "degraded" + VPNGatewayRouteModeHealthStateFaultedConst = "faulted" + VPNGatewayRouteModeHealthStateInapplicableConst = "inapplicable" + VPNGatewayRouteModeHealthStateOkConst = "ok" +) + +// Constants associated with the VPNGatewayRouteMode.LifecycleState property. +// The lifecycle state of the VPN gateway. +const ( + VPNGatewayRouteModeLifecycleStateDeletingConst = "deleting" + VPNGatewayRouteModeLifecycleStateFailedConst = "failed" + VPNGatewayRouteModeLifecycleStatePendingConst = "pending" + VPNGatewayRouteModeLifecycleStateStableConst = "stable" + VPNGatewayRouteModeLifecycleStateSuspendedConst = "suspended" + VPNGatewayRouteModeLifecycleStateUpdatingConst = "updating" + VPNGatewayRouteModeLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNGatewayRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayRouteModeResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGatewayRouteMode.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayRouteModeModeRouteConst = "route" +) + +func (*VPNGatewayRouteMode) isaVPNGateway() bool { + return true +} + +// UnmarshalVPNGatewayRouteMode unmarshals an instance of VPNGatewayRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayRouteMode) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationByCertificate : VPNServerAuthenticationByCertificate struct +// This model "extends" VPNServerAuthentication +type VPNServerAuthenticationByCertificate struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The certificate instance used for the VPN client certificate authority (CA). + ClientCa *CertificateInstanceReference `json:"client_ca" validate:"required"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` +} + +// Constants associated with the VPNServerAuthenticationByCertificate.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationByCertificateMethodCertificateConst = "certificate" + VPNServerAuthenticationByCertificateMethodUsernameConst = "username" +) + +func (*VPNServerAuthenticationByCertificate) isaVPNServerAuthentication() bool { + return true +} + +// UnmarshalVPNServerAuthenticationByCertificate unmarshals an instance of VPNServerAuthenticationByCertificate from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByCertificate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByCertificate) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationByUsername : VPNServerAuthenticationByUsername struct +// This model "extends" VPNServerAuthentication +type VPNServerAuthenticationByUsername struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider" validate:"required"` +} + +// Constants associated with the VPNServerAuthenticationByUsername.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationByUsernameMethodCertificateConst = "certificate" + VPNServerAuthenticationByUsernameMethodUsernameConst = "username" +) + +func (*VPNServerAuthenticationByUsername) isaVPNServerAuthentication() bool { + return true +} + +// UnmarshalVPNServerAuthenticationByUsername unmarshals an instance of VPNServerAuthenticationByUsername from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByUsername(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByUsername) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationByUsernameIDProviderByIam : VPNServerAuthenticationByUsernameIDProviderByIam struct +// This model "extends" VPNServerAuthenticationByUsernameIDProvider +type VPNServerAuthenticationByUsernameIDProviderByIam struct { + // The type of identity provider to be used by the VPN client. + // - `iam`: IBM identity and access management + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + ProviderType *string `json:"provider_type" validate:"required"` +} + +// Constants associated with the VPNServerAuthenticationByUsernameIDProviderByIam.ProviderType property. +// The type of identity provider to be used by the VPN client. +// - `iam`: IBM identity and access management +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +const ( + VPNServerAuthenticationByUsernameIDProviderByIamProviderTypeIamConst = "iam" +) + +// NewVPNServerAuthenticationByUsernameIDProviderByIam : Instantiate VPNServerAuthenticationByUsernameIDProviderByIam (Generic Model Constructor) +func (*VpcV1) NewVPNServerAuthenticationByUsernameIDProviderByIam(providerType string) (_model *VPNServerAuthenticationByUsernameIDProviderByIam, err error) { + _model = &VPNServerAuthenticationByUsernameIDProviderByIam{ + ProviderType: core.StringPtr(providerType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNServerAuthenticationByUsernameIDProviderByIam) isaVPNServerAuthenticationByUsernameIDProvider() bool { + return true +} + +// UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam unmarshals an instance of VPNServerAuthenticationByUsernameIDProviderByIam from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByUsernameIDProviderByIam) + err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype : VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype struct +// This model "extends" VPNServerAuthenticationPrototype +type VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The certificate instance to use for the VPN client certificate authority (CA). + ClientCa CertificateInstanceIdentityIntf `json:"client_ca" validate:"required"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` +} + +// Constants associated with the VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototypeMethodCertificateConst = "certificate" + VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototypeMethodUsernameConst = "username" +) + +// NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype : Instantiate VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(method string, clientCa CertificateInstanceIdentityIntf) (_model *VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype, err error) { + _model = &VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype{ + Method: core.StringPtr(method), + ClientCa: clientCa, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) isaVPNServerAuthenticationPrototype() bool { + return true +} + +// UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype unmarshals an instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype : VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype struct +// This model "extends" VPNServerAuthenticationPrototype +type VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider" validate:"required"` +} + +// Constants associated with the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototypeMethodCertificateConst = "certificate" + VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototypeMethodUsernameConst = "username" +) + +// NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype : Instantiate VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(method string, identityProvider VPNServerAuthenticationByUsernameIDProviderIntf) (_model *VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype, err error) { + _model = &VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype{ + Method: core.StringPtr(method), + IdentityProvider: identityProvider, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) isaVPNServerAuthenticationPrototype() bool { + return true +} + +// UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype unmarshals an instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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: +// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID +// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref +// This model "extends" VirtualNetworkInterfaceIPPrototype +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { + return true +} + +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextIntf interface { + VirtualNetworkInterfaceIPPrototypeIntf + isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext : The prototype for a new reserved IP. Must be in the primary IP's subnet. +// This model "extends" VirtualNetworkInterfaceIPPrototype +type VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext : Identifies a reserved IP by a unique property. Required if `subnet` is not specified. The reserved IP must be +// currently unbound. +// Models which "extend" this model: +// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID +// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref +// This model "extends" VirtualNetworkInterfacePrimaryIPPrototype +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` +} + +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { + return true +} + +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextIntf interface { + VirtualNetworkInterfacePrimaryIPPrototypeIntf + isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool +} + +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext : The prototype for a new reserved IP. Requires `subnet` to be specified. +// This model "extends" VirtualNetworkInterfacePrimaryIPPrototype +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext 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 reserved IP member will be automatically deleted when either + // `target` is deleted, or the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct +// This model "extends" VirtualNetworkInterfaceTarget +type VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { + // 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 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 resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" +) + +func (*VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext) isaVirtualNetworkInterfaceTarget() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext unmarshals an instance of VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct +// This model "extends" VirtualNetworkInterfaceTarget +type VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` + + // The name for this instance 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 VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" +) + +func (*VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) isaVirtualNetworkInterfaceTarget() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext unmarshals an instance of VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceTargetShareMountTargetReference : VirtualNetworkInterfaceTargetShareMountTargetReference struct +// This model "extends" VirtualNetworkInterfaceTarget +type VirtualNetworkInterfaceTargetShareMountTargetReference struct { + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this share mount target. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this share mount target. + ID *string `json:"id" validate:"required"` + + // The name for this share mount target. The name is unique across all mount targets for the file share. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VirtualNetworkInterfaceTargetShareMountTargetReference.ResourceType property. +// The resource type. +const ( + VirtualNetworkInterfaceTargetShareMountTargetReferenceResourceTypeShareMountTargetConst = "share_mount_target" +) + +func (*VirtualNetworkInterfaceTargetShareMountTargetReference) isaVirtualNetworkInterfaceTarget() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceTargetShareMountTargetReference unmarshals an instance of VirtualNetworkInterfaceTargetShareMountTargetReference from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceTargetShareMountTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceTargetShareMountTargetReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumeIdentity : Identifies a volume by a unique property. +// Models which "extend" this model: +// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID +// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN +// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref +// This model "extends" VolumeAttachmentPrototypeVolume +type VolumeAttachmentPrototypeVolumeVolumeIdentity struct { + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentity) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { + return true +} + +type VolumeAttachmentPrototypeVolumeVolumeIdentityIntf interface { + VolumeAttachmentPrototypeVolumeIntf + isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentity) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentity unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentity from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct +// Models which "extend" this model: +// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity +// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot +// This model "extends" VolumeAttachmentPrototypeVolume +type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to + // use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use for this volume. If unspecified, the instance's resource + // group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { + return true +} + +type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextIntf interface { + VolumeAttachmentPrototypeVolumeIntf + isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentityByCRN : VolumeIdentityByCRN struct +// This model "extends" VolumeIdentity +type VolumeIdentityByCRN struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` +} + +// NewVolumeIdentityByCRN : Instantiate VolumeIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVolumeIdentityByCRN(crn string) (_model *VolumeIdentityByCRN, err error) { + _model = &VolumeIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeIdentityByCRN) isaVolumeIdentity() bool { + return true +} + +// UnmarshalVolumeIdentityByCRN unmarshals an instance of VolumeIdentityByCRN from the specified map of raw messages. +func UnmarshalVolumeIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentityByHref : VolumeIdentityByHref struct +// This model "extends" VolumeIdentity +type VolumeIdentityByHref struct { + // The URL for this volume. + Href *string `json:"href" validate:"required"` +} + +// NewVolumeIdentityByHref : Instantiate VolumeIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVolumeIdentityByHref(href string) (_model *VolumeIdentityByHref, err error) { + _model = &VolumeIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeIdentityByHref) isaVolumeIdentity() bool { + return true +} + +// UnmarshalVolumeIdentityByHref unmarshals an instance of VolumeIdentityByHref from the specified map of raw messages. +func UnmarshalVolumeIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentityByID : VolumeIdentityByID struct +// This model "extends" VolumeIdentity +type VolumeIdentityByID struct { + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` +} + +// NewVolumeIdentityByID : Instantiate VolumeIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVolumeIdentityByID(id string) (_model *VolumeIdentityByID, err error) { + _model = &VolumeIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeIdentityByID) isaVolumeIdentity() bool { + return true +} + +// UnmarshalVolumeIdentityByID unmarshals an instance of VolumeIdentityByID from the specified map of raw messages. +func UnmarshalVolumeIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileIdentityByHref : VolumeProfileIdentityByHref struct +// This model "extends" VolumeProfileIdentity +type VolumeProfileIdentityByHref struct { + // The URL for this volume profile. + Href *string `json:"href" validate:"required"` +} + +// NewVolumeProfileIdentityByHref : Instantiate VolumeProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVolumeProfileIdentityByHref(href string) (_model *VolumeProfileIdentityByHref, err error) { + _model = &VolumeProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeProfileIdentityByHref) isaVolumeProfileIdentity() bool { + return true +} + +// UnmarshalVolumeProfileIdentityByHref unmarshals an instance of VolumeProfileIdentityByHref from the specified map of raw messages. +func UnmarshalVolumeProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileIdentityByName : VolumeProfileIdentityByName struct +// This model "extends" VolumeProfileIdentity +type VolumeProfileIdentityByName struct { + // The globally unique name for this volume profile. + Name *string `json:"name" validate:"required"` +} + +// NewVolumeProfileIdentityByName : Instantiate VolumeProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewVolumeProfileIdentityByName(name string) (_model *VolumeProfileIdentityByName, err error) { + _model = &VolumeProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeProfileIdentityByName) isaVolumeProfileIdentity() bool { + return true +} + +// UnmarshalVolumeProfileIdentityByName unmarshals an instance of VolumeProfileIdentityByName from the specified map of raw messages. +func UnmarshalVolumeProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototypeVolumeByCapacity : VolumePrototypeVolumeByCapacity struct +// This model "extends" VolumePrototype +type VolumePrototypeVolumeByCapacity struct { + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this volume will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity" validate:"required"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` +} + +// NewVolumePrototypeVolumeByCapacity : Instantiate VolumePrototypeVolumeByCapacity (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeVolumeByCapacity(profile VolumeProfileIdentityIntf, zone ZoneIdentityIntf, capacity int64) (_model *VolumePrototypeVolumeByCapacity, err error) { + _model = &VolumePrototypeVolumeByCapacity{ + Profile: profile, + Zone: zone, + Capacity: core.Int64Ptr(capacity), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumePrototypeVolumeByCapacity) isaVolumePrototype() bool { + return true +} + +// UnmarshalVolumePrototypeVolumeByCapacity unmarshals an instance of VolumePrototypeVolumeByCapacity from the specified map of raw messages. +func UnmarshalVolumePrototypeVolumeByCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeVolumeByCapacity) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototypeVolumeBySourceSnapshot : VolumePrototypeVolumeBySourceSnapshot struct +// This model "extends" VolumePrototype +type VolumePrototypeVolumeBySourceSnapshot struct { + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this volume will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's + // `minimum_capacity`. The maximum value may increase in the future. + // + // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` +} + +// NewVolumePrototypeVolumeBySourceSnapshot : Instantiate VolumePrototypeVolumeBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeVolumeBySourceSnapshot(profile VolumeProfileIdentityIntf, zone ZoneIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumePrototypeVolumeBySourceSnapshot, err error) { + _model = &VolumePrototypeVolumeBySourceSnapshot{ + Profile: profile, + Zone: zone, + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumePrototypeVolumeBySourceSnapshot) isaVolumePrototype() bool { + return true +} + +// UnmarshalVolumePrototypeVolumeBySourceSnapshot unmarshals an instance of VolumePrototypeVolumeBySourceSnapshot from the specified map of raw messages. +func UnmarshalVolumePrototypeVolumeBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeVolumeBySourceSnapshot) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneIdentityByHref : ZoneIdentityByHref struct +// This model "extends" ZoneIdentity +type ZoneIdentityByHref struct { + // The URL for this zone. + Href *string `json:"href" validate:"required"` +} + +// NewZoneIdentityByHref : Instantiate ZoneIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewZoneIdentityByHref(href string) (_model *ZoneIdentityByHref, err error) { + _model = &ZoneIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ZoneIdentityByHref) isaZoneIdentity() bool { + return true +} + +// UnmarshalZoneIdentityByHref unmarshals an instance of ZoneIdentityByHref from the specified map of raw messages. +func UnmarshalZoneIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneIdentityByName : ZoneIdentityByName struct +// This model "extends" ZoneIdentity +type ZoneIdentityByName struct { + // The globally unique name for this zone. + Name *string `json:"name" validate:"required"` +} + +// NewZoneIdentityByName : Instantiate ZoneIdentityByName (Generic Model Constructor) +func (*VpcV1) NewZoneIdentityByName(name string) (_model *ZoneIdentityByName, err error) { + _model = &ZoneIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ZoneIdentityByName) isaZoneIdentity() bool { + return true +} + +// UnmarshalZoneIdentityByName unmarshals an instance of ZoneIdentityByName from the specified map of raw messages. +func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN : BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN struct +// This model "extends" BackupPolicyScopePrototypeEnterpriseIdentity +type BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN struct { + // The CRN for this enterprise. + CRN *string `json:"crn" validate:"required"` +} + +// NewBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN : Instantiate BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN(crn string) (_model *BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN, err error) { + _model = &BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) isaBackupPolicyScopePrototypeEnterpriseIdentity() bool { + return true +} + +func (*BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) isaBackupPolicyScopePrototype() bool { + return true +} + +// UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN unmarshals an instance of BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN from the specified map of raw messages. +func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityByHref struct +// This model "extends" EndpointGatewayReservedIPReservedIPIdentity +type EndpointGatewayReservedIPReservedIPIdentityByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewEndpointGatewayReservedIPReservedIPIdentityByHref : Instantiate EndpointGatewayReservedIPReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityByHref(href string) (_model *EndpointGatewayReservedIPReservedIPIdentityByHref, err error) { + _model = &EndpointGatewayReservedIPReservedIPIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayReservedIPReservedIPIdentityByHref) isaEndpointGatewayReservedIPReservedIPIdentity() bool { + return true +} + +func (*EndpointGatewayReservedIPReservedIPIdentityByHref) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPIdentityByHref unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPIdentityByID : EndpointGatewayReservedIPReservedIPIdentityByID struct +// This model "extends" EndpointGatewayReservedIPReservedIPIdentity +type EndpointGatewayReservedIPReservedIPIdentityByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewEndpointGatewayReservedIPReservedIPIdentityByID : Instantiate EndpointGatewayReservedIPReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityByID(id string) (_model *EndpointGatewayReservedIPReservedIPIdentityByID, err error) { + _model = &EndpointGatewayReservedIPReservedIPIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayReservedIPReservedIPIdentityByID) isaEndpointGatewayReservedIPReservedIPIdentity() bool { + return true +} + +func (*EndpointGatewayReservedIPReservedIPIdentityByID) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPIdentityByID unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN : EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN struct +// This model "extends" EndpointGatewayTargetPrototypeProviderCloudServiceIdentity +type EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRNResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRNResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +// NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN : Instantiate EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(resourceType string, crn string) (_model *EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN, err error) { + _model = &EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN{ + ResourceType: core.StringPtr(resourceType), + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool { + return true +} + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN unmarshals an instance of EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName : The name of this provider infrastructure service. +// This model "extends" EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity +type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByNameResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByNameResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +// NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName : Instantiate EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(resourceType string, name string) (_model *EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName, err error) { + _model = &EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName{ + ResourceType: core.StringPtr(resourceType), + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool { + return true +} + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName unmarshals an instance of EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity +type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { + // 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"` +} + +// NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity +type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { + // 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"` +} + +// NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity +type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { + // The URL for this instance network interface. + // + // If this instance 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"` +} + +// NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity +type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { + // The unique identifier for this instance network interface. + // + // If this instance 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"` +} + +// NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity +type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { + return true +} + +// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity +type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { + // 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"` +} + +// NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity +type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { + // 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"` +} + +// NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity +type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { + // The URL for this instance network interface. + // + // If this instance 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"` +} + +// NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity +type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { + // The unique identifier for this instance network interface. + // + // If this instance 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"` +} + +// NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity +type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { + return true +} + +// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity +type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity +type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref struct { + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity +type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref : FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref struct { + // The URL for this instance network attachment. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID : FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity +type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID struct { + // The unique identifier for this instance network attachment. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID : Instantiate FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { + // The URL for this instance network interface. + // + // If this instance 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"` +} + +// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { + // The unique identifier for this instance network interface. + // + // If this instance 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"` +} + +// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity +type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN, err error) { + _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity +type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref struct { + // The URL for this subnet. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity +type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID struct { + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity +type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN, err error) { + _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity +type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref struct { + // The URL for this VPC. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity +type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID struct { + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec struct +// Models which "extend" this model: +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototype +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { + return true +} + +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecIntf interface { + InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf + isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt struct +// Models which "extend" this model: +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup +// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototype +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { + return true +} + +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtIntf interface { + InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf + isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionScheduledActionGroupTarget : InstanceGroupManagerActionScheduledActionGroupTarget struct +// This model "extends" InstanceGroupManagerActionScheduledAction +type InstanceGroupManagerActionScheduledActionGroupTarget struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. 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`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the + // future. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` + + // The date and time that the instance group manager action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type" validate:"required"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroup `json:"group" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetStatusActiveConst = "active" + InstanceGroupManagerActionScheduledActionGroupTargetStatusCompletedConst = "completed" + InstanceGroupManagerActionScheduledActionGroupTargetStatusFailedConst = "failed" + InstanceGroupManagerActionScheduledActionGroupTargetStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionScheduledActionGroupTargetStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionScheduledActionGroupTargetActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerActionScheduledAction() bool { + return true +} + +func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerAction() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionGroupTarget from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionScheduledActionGroupTarget) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionScheduledActionManagerTarget : InstanceGroupManagerActionScheduledActionManagerTarget struct +// This model "extends" InstanceGroupManagerActionScheduledAction +type InstanceGroupManagerActionScheduledActionManagerTarget struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. 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`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the + // future. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` + + // The date and time that the instance group manager action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance group manager action. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager action. + ID *string `json:"id" validate:"required"` + + // The name for this instance group manager action. The name is unique across all actions for the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the instance group action + // - `active`: Action is ready to be run + // - `completed`: Action was completed successfully + // - `failed`: Action could not be completed successfully + // - `incompatible`: Action parameters are not compatible with the group or manager + // - `omitted`: Action was not applied because this action's manager was disabled. + Status *string `json:"status" validate:"required"` + + // The date and time that the instance group manager action was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` + + // The type of action for the instance group. + ActionType *string `json:"action_type" validate:"required"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + // The date and time the scheduled action was last applied. If absent, the action has never been applied. + LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` + + // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run + // time. + NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ResourceType property. +// The resource type. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.Status property. +// The status of the instance group action +// - `active`: Action is ready to be run +// - `completed`: Action was completed successfully +// - `failed`: Action could not be completed successfully +// - `incompatible`: Action parameters are not compatible with the group or manager +// - `omitted`: Action was not applied because this action's manager was disabled. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetStatusActiveConst = "active" + InstanceGroupManagerActionScheduledActionManagerTargetStatusCompletedConst = "completed" + InstanceGroupManagerActionScheduledActionManagerTargetStatusFailedConst = "failed" + InstanceGroupManagerActionScheduledActionManagerTargetStatusIncompatibleConst = "incompatible" + InstanceGroupManagerActionScheduledActionManagerTargetStatusOmittedConst = "omitted" +) + +// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ActionType property. +// The type of action for the instance group. +const ( + InstanceGroupManagerActionScheduledActionManagerTargetActionTypeScheduledConst = "scheduled" +) + +func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerActionScheduledAction() bool { + return true +} + +func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerAction() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionManagerTarget from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionScheduledActionManagerTarget) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete_timeout", &obj.AutoDeleteTimeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct +// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(href string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref, err error) { + _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { + return true +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct +// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype +type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct { + // The desired maximum number of instance group members at the scheduled time. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The desired minimum number of instance group members at the scheduled time. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(id string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID, err error) { + _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { + return true +} + +func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID from the specified map of raw messages. +func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity +type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { + return true +} + +// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity +type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct { + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct +// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity +type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct { + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID, err error) { + _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatch() bool { + return true +} + +// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity +type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct { + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity +type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct { + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct { + // The CRN for this placement group. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct { + // The URL for this placement group. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct +// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity +type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct { + // The unique identifier for this placement group. + ID *string `json:"id" validate:"required"` +} + +// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID, err error) { + _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { + return true +} + +func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { + return true +} + +// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID from the specified map of raw messages. +func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceByCatalogOffering +type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstancePrototypeInstanceByCatalogOffering() bool { + return true +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceByCatalogOffering +type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstancePrototypeInstanceByCatalogOffering() bool { + return true +} + +func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment : InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceByImage +type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment{ + Image: image, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstancePrototypeInstanceByImage() bool { + return true +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface : InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceByImage +type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface{ + Image: image, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstancePrototypeInstanceByImage() bool { + return true +} + +func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceBySourceSnapshot +type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstancePrototypeInstanceBySourceSnapshot() bool { + return true +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceBySourceSnapshot +type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstancePrototypeInstanceBySourceSnapshot() bool { + return true +} + +func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment : InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment struct +// This model "extends" InstancePrototypeInstanceByVolume +type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment, err error) { + _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) isaInstancePrototypeInstanceByVolume() bool { + return true +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface : InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface struct +// This model "extends" InstancePrototypeInstanceByVolume +type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface, err error) { + _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) isaInstancePrototypeInstanceByVolume() bool { + return true +} + +func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering +type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering +type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface{ + CatalogOffering: catalogOffering, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage +type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment{ + Image: image, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage +type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface{ + Image: image, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkAttachment: primaryNetworkAttachment, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct +// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot +type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name must not be used by another instance template in the region. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface, err error) { + _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface{ + BootVolumeAttachment: bootVolumeAttachment, + Zone: zone, + PrimaryNetworkInterface: primaryNetworkInterface, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { + return true +} + +func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { + return true +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext +type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { + return true +} + +func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceByImageInstanceTemplateContext +type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { + return true +} + +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceByImageInstanceTemplateContext +type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { + return true +} + +func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct +// This model "extends" InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` +} + +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { + return true +} + +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct +// This model "extends" InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext +type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct { + // The availability policy to use for this virtual server instance. + AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` + + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The default trusted profile configuration to use for this virtual server instance + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the + // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator + // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. + // + // This property's value is used when provisioning the virtual server instance, but not subsequently managed. + // Accordingly, it is reflected as an [instance + // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` + + // The name for this instance template. The name is unique across all instance templates in the region. + Name *string `json:"name" validate:"required"` + + // The placement restrictions to use for the virtual server instance. + // + // If specified, `reservation_affinity.policy` must be `disabled`. + PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. + // + // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in + // this value will result in a corresponding decrease to + // `total_network_bandwidth`. + TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` + + // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server + // instance. + UserData *string `json:"user_data,omitempty"` + + // The additional volume attachments to create for the virtual server instance. + VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` + + // The VPC this virtual server instance will reside in. + // + // If specified, it must match the VPC for the subnets of the instance network attachments or instance network + // interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment to create for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` + + // The additional network attachments to create for the virtual server instance. + NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` + + // The primary network attachment to create for the virtual server instance. + PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The additional instance network interfaces to create. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The primary instance network interface to create. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` +} + +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { + return true +} + +func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) + err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref struct { + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(href string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(id string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID, err error) { + _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototypeReservedIPIdentityByHref : NetworkInterfaceIPPrototypeReservedIPIdentityByHref struct +// This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity +type NetworkInterfaceIPPrototypeReservedIPIdentityByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkInterfaceIPPrototypeReservedIPIdentityByHref : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityByHref(href string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityByHref, err error) { + _model = &NetworkInterfaceIPPrototypeReservedIPIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentityByHref) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { + return true +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentityByHref) isaNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByHref unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceIPPrototypeReservedIPIdentityByID : NetworkInterfaceIPPrototypeReservedIPIdentityByID struct +// This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity +type NetworkInterfaceIPPrototypeReservedIPIdentityByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkInterfaceIPPrototypeReservedIPIdentityByID : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityByID(id string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityByID, err error) { + _model = &NetworkInterfaceIPPrototypeReservedIPIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentityByID) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { + return true +} + +func (*NetworkInterfaceIPPrototypeReservedIPIdentityByID) isaNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByID unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress(address string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress, err error) { + _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN struct { + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN(crn string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN, err error) { + _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref struct { + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(href string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref, err error) { + _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID struct { + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(id string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID, err error) { + _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN struct +// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` +} + +// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN(crn string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN, err error) { + _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref struct +// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref struct { + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` +} + +// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref(href string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref, err error) { + _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID struct +// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID struct { + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` +} + +// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID(id string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID, err error) { + _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity +type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP : RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct +// This model "extends" RouteNextHopPatchRouteNextHopIP +type RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP : Instantiate RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(address string) (_model *RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP, err error) { + _model = &RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPatchRouteNextHopIP() bool { + return true +} + +func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP unmarshals an instance of RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP from the specified map of raw messages. +func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP : RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP struct +// This model "extends" RouteNextHopPatchRouteNextHopIP +type RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP struct { + // A unicast IP address, which must not be any of the following values: + // + // - `0.0.0.0` (the sentinel IP address) + // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) + // - `255.255.255.255` (the broadcast IP address) + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP : Instantiate RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(address string) (_model *RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP, err error) { + _model = &RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPatchRouteNextHopIP() bool { + return true +} + +func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP unmarshals an instance of RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP from the specified map of raw messages. +func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct +// This model "extends" RouteNextHopPatchVPNGatewayConnectionIdentity +type RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (_model *RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { + _model = &RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. +func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct +// This model "extends" RouteNextHopPatchVPNGatewayConnectionIdentity +type RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` +} + +// NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (_model *RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { + _model = &RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPatch() bool { + return true +} + +// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. +func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct +// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct { + // The sentinel IP address (`0.0.0.0`). + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { + return true +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP struct +// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP struct { + // A unicast IP address, which must not be any of the following values: + // + // - `0.0.0.0` (the sentinel IP address) + // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) + // - `255.255.255.255` (the broadcast IP address) + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { + return true +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct +// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct +// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` +} + +// NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRoutePrototypeNextHop() bool { + return true +} + +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct +// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN, err error) { + _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct +// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct { + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref(href string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref, err error) { + _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID struct +// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID struct { + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID(id string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID, err error) { + _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct +// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN, err error) { + _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref struct +// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref struct { + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref(href string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref, err error) { + _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID struct +// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID struct { + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID(id string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID, err error) { + _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { + // The CRN for this virtual network interface. + CRN *string `json:"crn" validate:"required"` +} + +// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { + _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { + // The URL for this virtual network interface. + Href *string `json:"href" validate:"required"` +} + +// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { + _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct +// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity +type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { + // The unique identifier for this virtual network interface. + ID *string `json:"id" validate:"required"` +} + +// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { + _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { + return true +} + +func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { + return true +} + +// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch struct +// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch struct { + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch() bool { + return true +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct +// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct { + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch() bool { + return true +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch) + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch struct +// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch struct { + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch() bool { + return true +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct +// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct { + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch() bool { + return true +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct +// This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref(href string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref, err error) { + _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { + return true +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID struct +// This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext +type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID(id string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID, err error) { + _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { + return true +} + +func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) isaVirtualNetworkInterfaceIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref struct +// This model "extends" VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref : Instantiate VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref(href string) (_model *VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref, err error) { + _model = &VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { + return true +} + +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID struct +// This model "extends" VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext +type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID : Instantiate VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID (Generic Model Constructor) +func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID(id string) (_model *VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID, err error) { + _model = &VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { + return true +} + +func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { + return true +} + +// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID from the specified map of raw messages. +func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity +type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN(crn string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity +type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref struct { + // The URL for this volume. + Href *string `json:"href" validate:"required"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref(href string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity +type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID struct { + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(id string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext +type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct { + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use for this volume. If unspecified, the instance's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or + // updating volumes may expand in the future. + Capacity *int64 `json:"capacity" validate:"required"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : Instantiate VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(profile VolumeProfileIdentityIntf, capacity int64) (_model *VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity{ + Profile: profile, + Capacity: core.Int64Ptr(capacity), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct +// This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext +type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct { + // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will + // be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use for this volume. If unspecified, the instance's resource group will be used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's + // `minimum_capacity`. The maximum value may increase in the future. + // + // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the `encryption` type for the volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` +} + +// NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : Instantiate VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(profile VolumeProfileIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot, err error) { + _model = &VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot{ + Profile: profile, + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { + return true +} + +func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) isaVolumeAttachmentPrototypeVolume() bool { + return true +} + +// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup struct +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group" validate:"required"` +} + +// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup(group *InstanceGroupManagerScheduledActionGroupPrototype) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup, err error) { + _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup{ + Group: group, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager struct +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min + // period. + CronSpec *string `json:"cron_spec,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager" validate:"required"` +} + +// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager(manager InstanceGroupManagerScheduledActionManagerPrototypeIntf) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager, err error) { + _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager{ + Manager: manager, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup struct +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group" validate:"required"` +} + +// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup(group *InstanceGroupManagerScheduledActionGroupPrototype) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup, err error) { + _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup{ + Group: group, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager struct +// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt +type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager struct { + // The name for this instance group manager action. The name must not be used by another action for the instance group + // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The date and time the scheduled action will run. + RunAt *strfmt.DateTime `json:"run_at,omitempty"` + + Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager" validate:"required"` +} + +// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager(manager InstanceGroupManagerScheduledActionManagerPrototypeIntf) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager, err error) { + _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager{ + Manager: manager, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { + return true +} + +func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager from the specified map of raw messages. +func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCAddressPrefixesPager can be used to simplify the use of the "ListVPCAddressPrefixes" method. +type VPCAddressPrefixesPager struct { + hasNext bool + options *ListVPCAddressPrefixesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCAddressPrefixesPager returns a new VPCAddressPrefixesPager instance. +func (vpc *VpcV1) NewVPCAddressPrefixesPager(options *ListVPCAddressPrefixesOptions) (pager *VPCAddressPrefixesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCAddressPrefixesOptions = *options + pager = &VPCAddressPrefixesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCAddressPrefixesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (page []AddressPrefix, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCAddressPrefixesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.AddressPrefixes + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (allItems []AddressPrefix, err error) { + for pager.HasNext() { + var nextPage []AddressPrefix + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCAddressPrefixesPager) GetNext() (page []AddressPrefix, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPCDnsResolutionBindingsPager can be used to simplify the use of the "ListVPCDnsResolutionBindings" method. +type VPCDnsResolutionBindingsPager struct { + hasNext bool + options *ListVPCDnsResolutionBindingsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCDnsResolutionBindingsPager returns a new VPCDnsResolutionBindingsPager instance. +func (vpc *VpcV1) NewVPCDnsResolutionBindingsPager(options *ListVPCDnsResolutionBindingsOptions) (pager *VPCDnsResolutionBindingsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCDnsResolutionBindingsOptions = *options + pager = &VPCDnsResolutionBindingsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCDnsResolutionBindingsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Context) (page []VpcdnsResolutionBinding, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCDnsResolutionBindingsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.DnsResolutionBindings + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Context) (allItems []VpcdnsResolutionBinding, err error) { + for pager.HasNext() { + var nextPage []VpcdnsResolutionBinding + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCDnsResolutionBindingsPager) GetNext() (page []VpcdnsResolutionBinding, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCDnsResolutionBindingsPager) GetAll() (allItems []VpcdnsResolutionBinding, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. +type VPCRoutesPager struct { + hasNext bool + options *ListVPCRoutesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCRoutesPager returns a new VPCRoutesPager instance. +func (vpc *VpcV1) NewVPCRoutesPager(options *ListVPCRoutesOptions) (pager *VPCRoutesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCRoutesOptions = *options + pager = &VPCRoutesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCRoutesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []RouteCollectionVPCContextRoutesItem, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCRoutesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Routes + + return +} + +// 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) { + for pager.HasNext() { + var nextPage []RouteCollectionVPCContextRoutesItem + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutesPager) GetNext() (page []RouteCollectionVPCContextRoutesItem, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutesPager) GetAll() (allItems []RouteCollectionVPCContextRoutesItem, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. +type VPCRoutingTableRoutesPager struct { + hasNext bool + options *ListVPCRoutingTableRoutesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCRoutingTableRoutesPager returns a new VPCRoutingTableRoutesPager instance. +func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRoutesOptions) (pager *VPCRoutingTableRoutesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCRoutingTableRoutesOptions = *options + pager = &VPCRoutingTableRoutesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCRoutingTableRoutesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) (page []Route, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCRoutingTableRoutesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Routes + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) (allItems []Route, err error) { + for pager.HasNext() { + var nextPage []Route + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutingTableRoutesPager) GetNext() (page []Route, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPCRoutingTablesPager can be used to simplify the use of the "ListVPCRoutingTables" method. +type VPCRoutingTablesPager struct { + hasNext bool + options *ListVPCRoutingTablesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPCRoutingTablesPager returns a new VPCRoutingTablesPager instance. +func (vpc *VpcV1) NewVPCRoutingTablesPager(options *ListVPCRoutingTablesOptions) (pager *VPCRoutingTablesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPCRoutingTablesOptions = *options + pager = &VPCRoutingTablesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPCRoutingTablesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPCRoutingTablesPager) GetNextWithContext(ctx context.Context) (page []RoutingTable, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPCRoutingTablesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.RoutingTables + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPCRoutingTablesPager) GetAllWithContext(ctx context.Context) (allItems []RoutingTable, err error) { + for pager.HasNext() { + var nextPage []RoutingTable + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutingTablesPager) GetNext() (page []RoutingTable, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPCRoutingTablesPager) GetAll() (allItems []RoutingTable, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VpcsPager can be used to simplify the use of the "ListVpcs" method. +type VpcsPager struct { + hasNext bool + options *ListVpcsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVpcsPager returns a new VpcsPager instance. +func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVpcsOptions = *options + pager = &VpcsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VpcsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVpcsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Vpcs + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, err error) { + for pager.HasNext() { + var nextPage []VPC + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VpcsPager) GetNext() (page []VPC, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VpcsPager) GetAll() (allItems []VPC, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. +type SubnetReservedIpsPager struct { + hasNext bool + options *ListSubnetReservedIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSubnetReservedIpsPager returns a new SubnetReservedIpsPager instance. +func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOptions) (pager *SubnetReservedIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSubnetReservedIpsOptions = *options + pager = &SubnetReservedIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SubnetReservedIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSubnetReservedIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { + for pager.HasNext() { + var nextPage []ReservedIP + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SubnetReservedIpsPager) GetNext() (page []ReservedIP, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SubnetsPager can be used to simplify the use of the "ListSubnets" method. +type SubnetsPager struct { + hasNext bool + options *ListSubnetsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSubnetsPager returns a new SubnetsPager instance. +func (vpc *VpcV1) NewSubnetsPager(options *ListSubnetsOptions) (pager *SubnetsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSubnetsOptions = *options + pager = &SubnetsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SubnetsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subnet, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSubnetsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Subnet, err error) { + for pager.HasNext() { + var nextPage []Subnet + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SubnetsPager) GetNext() (page []Subnet, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SubnetsPager) GetAll() (allItems []Subnet, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// ImagesPager can be used to simplify the use of the "ListImages" method. +type ImagesPager struct { + hasNext bool + options *ListImagesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewImagesPager returns a new ImagesPager instance. +func (vpc *VpcV1) NewImagesPager(options *ListImagesOptions) (pager *ImagesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListImagesOptions = *options + pager = &ImagesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ImagesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ImagesPager) GetNextWithContext(ctx context.Context) (page []Image, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListImagesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Images + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ImagesPager) GetAllWithContext(ctx context.Context) (allItems []Image, err error) { + for pager.HasNext() { + var nextPage []Image + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ImagesPager) GetNext() (page []Image, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ImagesPager) GetAll() (allItems []Image, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// OperatingSystemsPager can be used to simplify the use of the "ListOperatingSystems" method. +type OperatingSystemsPager struct { + hasNext bool + options *ListOperatingSystemsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewOperatingSystemsPager returns a new OperatingSystemsPager instance. +func (vpc *VpcV1) NewOperatingSystemsPager(options *ListOperatingSystemsOptions) (pager *OperatingSystemsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListOperatingSystemsOptions = *options + pager = &OperatingSystemsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *OperatingSystemsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *OperatingSystemsPager) GetNextWithContext(ctx context.Context) (page []OperatingSystem, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListOperatingSystemsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.OperatingSystems + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *OperatingSystemsPager) GetAllWithContext(ctx context.Context) (allItems []OperatingSystem, err error) { + for pager.HasNext() { + var nextPage []OperatingSystem + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *OperatingSystemsPager) GetNext() (page []OperatingSystem, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *OperatingSystemsPager) GetAll() (allItems []OperatingSystem, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// KeysPager can be used to simplify the use of the "ListKeys" method. +type KeysPager struct { + hasNext bool + options *ListKeysOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewKeysPager returns a new KeysPager instance. +func (vpc *VpcV1) NewKeysPager(options *ListKeysOptions) (pager *KeysPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListKeysOptions = *options + pager = &KeysPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *KeysPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *KeysPager) GetNextWithContext(ctx context.Context) (page []Key, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListKeysWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Keys + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *KeysPager) GetAllWithContext(ctx context.Context) (allItems []Key, err error) { + for pager.HasNext() { + var nextPage []Key + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *KeysPager) GetNext() (page []Key, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *KeysPager) GetAll() (allItems []Key, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "ListInstanceNetworkInterfaceIps" method. +type InstanceNetworkInterfaceIpsPager struct { + hasNext bool + options *ListInstanceNetworkInterfaceIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceNetworkInterfaceIpsPager returns a new InstanceNetworkInterfaceIpsPager instance. +func (vpc *VpcV1) NewInstanceNetworkInterfaceIpsPager(options *ListInstanceNetworkInterfaceIpsOptions) (pager *InstanceNetworkInterfaceIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceNetworkInterfaceIpsOptions = *options + pager = &InstanceNetworkInterfaceIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceNetworkInterfaceIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceNetworkInterfaceIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Ips + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { + for pager.HasNext() { + var nextPage []ReservedIP + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceNetworkInterfaceIpsPager) GetNext() (page []ReservedIP, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// InstancesPager can be used to simplify the use of the "ListInstances" method. +type InstancesPager struct { + hasNext bool + options *ListInstancesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstancesPager returns a new InstancesPager instance. +func (vpc *VpcV1) NewInstancesPager(options *ListInstancesOptions) (pager *InstancesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstancesOptions = *options + pager = &InstancesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstancesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstancesPager) GetNextWithContext(ctx context.Context) (page []Instance, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstancesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Instances + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstancesPager) GetAllWithContext(ctx context.Context) (allItems []Instance, err error) { + for pager.HasNext() { + var nextPage []Instance + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstancesPager) GetNext() (page []Instance, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstancesPager) GetAll() (allItems []Instance, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// InstanceGroupManagerActionsPager can be used to simplify the use of the "ListInstanceGroupManagerActions" method. +type InstanceGroupManagerActionsPager struct { + hasNext bool + options *ListInstanceGroupManagerActionsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupManagerActionsPager returns a new InstanceGroupManagerActionsPager instance. +func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroupManagerActionsOptions) (pager *InstanceGroupManagerActionsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupManagerActionsOptions = *options + pager = &InstanceGroupManagerActionsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupManagerActionsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerActionIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupManagerActionsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Actions + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerActionIntf, err error) { + for pager.HasNext() { + var nextPage []InstanceGroupManagerActionIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagerActionsPager) GetNext() (page []InstanceGroupManagerActionIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagerActionsPager) GetAll() (allItems []InstanceGroupManagerActionIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// InstanceGroupManagerPoliciesPager can be used to simplify the use of the "ListInstanceGroupManagerPolicies" method. +type InstanceGroupManagerPoliciesPager struct { + hasNext bool + options *ListInstanceGroupManagerPoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupManagerPoliciesPager returns a new InstanceGroupManagerPoliciesPager instance. +func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGroupManagerPoliciesOptions) (pager *InstanceGroupManagerPoliciesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupManagerPoliciesOptions = *options + pager = &InstanceGroupManagerPoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupManagerPoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerPolicyIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupManagerPoliciesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Policies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerPolicyIntf, err error) { + for pager.HasNext() { + var nextPage []InstanceGroupManagerPolicyIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagerPoliciesPager) GetNext() (page []InstanceGroupManagerPolicyIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGroupManagerPolicyIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// InstanceGroupManagersPager can be used to simplify the use of the "ListInstanceGroupManagers" method. +type InstanceGroupManagersPager struct { + hasNext bool + options *ListInstanceGroupManagersOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupManagersPager returns a new InstanceGroupManagersPager instance. +func (vpc *VpcV1) NewInstanceGroupManagersPager(options *ListInstanceGroupManagersOptions) (pager *InstanceGroupManagersPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupManagersOptions = *options + pager = &InstanceGroupManagersPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupManagersPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupManagersPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupManagersWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Managers + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupManagersPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerIntf, err error) { + for pager.HasNext() { + var nextPage []InstanceGroupManagerIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagersPager) GetNext() (page []InstanceGroupManagerIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManagerIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// InstanceGroupMembershipsPager can be used to simplify the use of the "ListInstanceGroupMemberships" method. +type InstanceGroupMembershipsPager struct { + hasNext bool + options *ListInstanceGroupMembershipsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupMembershipsPager returns a new InstanceGroupMembershipsPager instance. +func (vpc *VpcV1) NewInstanceGroupMembershipsPager(options *ListInstanceGroupMembershipsOptions) (pager *InstanceGroupMembershipsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupMembershipsOptions = *options + pager = &InstanceGroupMembershipsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupMembershipsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupMembership, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupMembershipsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Memberships + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupMembership, err error) { + for pager.HasNext() { + var nextPage []InstanceGroupMembership + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupMembershipsPager) GetNext() (page []InstanceGroupMembership, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMembership, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. +type InstanceGroupsPager struct { + hasNext bool + options *ListInstanceGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupsPager returns a new InstanceGroupsPager instance. +func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pager *InstanceGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListInstanceGroupsOptions = *options + pager = &InstanceGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.InstanceGroups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroup, err error) { + for pager.HasNext() { + var nextPage []InstanceGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupsPager) GetNext() (page []InstanceGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// ReservationsPager can be used to simplify the use of the "ListReservations" method. +type ReservationsPager struct { + hasNext bool + options *ListReservationsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewReservationsPager returns a new ReservationsPager instance. +func (vpc *VpcV1) NewReservationsPager(options *ListReservationsOptions) (pager *ReservationsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListReservationsOptions = *options + pager = &ReservationsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ReservationsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ReservationsPager) GetNextWithContext(ctx context.Context) (page []Reservation, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListReservationsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Reservations + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ReservationsPager) GetAllWithContext(ctx context.Context) (allItems []Reservation, err error) { + for pager.HasNext() { + var nextPage []Reservation + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ReservationsPager) GetNext() (page []Reservation, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ReservationsPager) GetAll() (allItems []Reservation, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// DedicatedHostGroupsPager can be used to simplify the use of the "ListDedicatedHostGroups" method. +type DedicatedHostGroupsPager struct { + hasNext bool + options *ListDedicatedHostGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewDedicatedHostGroupsPager returns a new DedicatedHostGroupsPager instance. +func (vpc *VpcV1) NewDedicatedHostGroupsPager(options *ListDedicatedHostGroupsOptions) (pager *DedicatedHostGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListDedicatedHostGroupsOptions = *options + pager = &DedicatedHostGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *DedicatedHostGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *DedicatedHostGroupsPager) GetNextWithContext(ctx context.Context) (page []DedicatedHostGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListDedicatedHostGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Groups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *DedicatedHostGroupsPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHostGroup, err error) { + for pager.HasNext() { + var nextPage []DedicatedHostGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostGroupsPager) GetNext() (page []DedicatedHostGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostGroupsPager) GetAll() (allItems []DedicatedHostGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// DedicatedHostProfilesPager can be used to simplify the use of the "ListDedicatedHostProfiles" method. +type DedicatedHostProfilesPager struct { + hasNext bool + options *ListDedicatedHostProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewDedicatedHostProfilesPager returns a new DedicatedHostProfilesPager instance. +func (vpc *VpcV1) NewDedicatedHostProfilesPager(options *ListDedicatedHostProfilesOptions) (pager *DedicatedHostProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListDedicatedHostProfilesOptions = *options + pager = &DedicatedHostProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *DedicatedHostProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *DedicatedHostProfilesPager) GetNextWithContext(ctx context.Context) (page []DedicatedHostProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListDedicatedHostProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 *DedicatedHostProfilesPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHostProfile, err error) { + for pager.HasNext() { + var nextPage []DedicatedHostProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostProfilesPager) GetNext() (page []DedicatedHostProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostProfilesPager) GetAll() (allItems []DedicatedHostProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// DedicatedHostsPager can be used to simplify the use of the "ListDedicatedHosts" method. +type DedicatedHostsPager struct { + hasNext bool + options *ListDedicatedHostsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewDedicatedHostsPager returns a new DedicatedHostsPager instance. +func (vpc *VpcV1) NewDedicatedHostsPager(options *ListDedicatedHostsOptions) (pager *DedicatedHostsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListDedicatedHostsOptions = *options + pager = &DedicatedHostsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *DedicatedHostsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *DedicatedHostsPager) GetNextWithContext(ctx context.Context) (page []DedicatedHost, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListDedicatedHostsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.DedicatedHosts + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *DedicatedHostsPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHost, err error) { + for pager.HasNext() { + var nextPage []DedicatedHost + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostsPager) GetNext() (page []DedicatedHost, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *DedicatedHostsPager) GetAll() (allItems []DedicatedHost, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. +type BackupPoliciesPager struct { + hasNext bool + options *ListBackupPoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBackupPoliciesPager returns a new BackupPoliciesPager instance. +func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pager *BackupPoliciesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBackupPoliciesOptions = *options + pager = &BackupPoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BackupPoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBackupPoliciesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.BackupPolicies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyIntf, err error) { + for pager.HasNext() { + var nextPage []BackupPolicyIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BackupPoliciesPager) GetNext() (page []BackupPolicyIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BackupPoliciesPager) GetAll() (allItems []BackupPolicyIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// BackupPolicyJobsPager can be used to simplify the use of the "ListBackupPolicyJobs" method. +type BackupPolicyJobsPager struct { + hasNext bool + options *ListBackupPolicyJobsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBackupPolicyJobsPager returns a new BackupPolicyJobsPager instance. +func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) (pager *BackupPolicyJobsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBackupPolicyJobsOptions = *options + pager = &BackupPolicyJobsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BackupPolicyJobsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyJob, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBackupPolicyJobsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Jobs + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyJob, err error) { + for pager.HasNext() { + var nextPage []BackupPolicyJob + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BackupPolicyJobsPager) GetNext() (page []BackupPolicyJob, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// PlacementGroupsPager can be used to simplify the use of the "ListPlacementGroups" method. +type PlacementGroupsPager struct { + hasNext bool + options *ListPlacementGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewPlacementGroupsPager returns a new PlacementGroupsPager instance. +func (vpc *VpcV1) NewPlacementGroupsPager(options *ListPlacementGroupsOptions) (pager *PlacementGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListPlacementGroupsOptions = *options + pager = &PlacementGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *PlacementGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *PlacementGroupsPager) GetNextWithContext(ctx context.Context) (page []PlacementGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListPlacementGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.PlacementGroups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *PlacementGroupsPager) GetAllWithContext(ctx context.Context) (allItems []PlacementGroup, err error) { + for pager.HasNext() { + var nextPage []PlacementGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *PlacementGroupsPager) GetNext() (page []PlacementGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *PlacementGroupsPager) GetAll() (allItems []PlacementGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. +type BareMetalServerNetworkAttachmentsPager struct { + hasNext bool + options *ListBareMetalServerNetworkAttachmentsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBareMetalServerNetworkAttachmentsOptions = *options + pager = &BareMetalServerNetworkAttachmentsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BareMetalServerNetworkAttachmentsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkAttachmentIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.NetworkAttachments + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { + for pager.HasNext() { + var nextPage []BareMetalServerNetworkAttachmentIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. +type BareMetalServerNetworkInterfacesPager struct { + hasNext bool + options *ListBareMetalServerNetworkInterfacesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBareMetalServerNetworkInterfacesOptions = *options + pager = &BareMetalServerNetworkInterfacesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BareMetalServerNetworkInterfacesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkInterfaceIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.NetworkInterfaces + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkInterfaceIntf, err error) { + for pager.HasNext() { + var nextPage []BareMetalServerNetworkInterfaceIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerNetworkInterfacesPager) GetNext() (page []BareMetalServerNetworkInterfaceIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. +type BareMetalServerProfilesPager struct { + hasNext bool + options *ListBareMetalServerProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. +func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBareMetalServerProfilesOptions = *options + pager = &BareMetalServerProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BareMetalServerProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBareMetalServerProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfile, err error) { + for pager.HasNext() { + var nextPage []BareMetalServerProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. +type BareMetalServersPager struct { + hasNext bool + options *ListBareMetalServersOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBareMetalServersPager returns a new BareMetalServersPager instance. +func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBareMetalServersOptions = *options + pager = &BareMetalServersPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BareMetalServersPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (page []BareMetalServer, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBareMetalServersWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.BareMetalServers + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServer, err error) { + for pager.HasNext() { + var nextPage []BareMetalServer + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServersPager) GetNext() (page []BareMetalServer, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VolumeProfilesPager can be used to simplify the use of the "ListVolumeProfiles" method. +type VolumeProfilesPager struct { + hasNext bool + options *ListVolumeProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVolumeProfilesPager returns a new VolumeProfilesPager instance. +func (vpc *VpcV1) NewVolumeProfilesPager(options *ListVolumeProfilesOptions) (pager *VolumeProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVolumeProfilesOptions = *options + pager = &VolumeProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VolumeProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VolumeProfilesPager) GetNextWithContext(ctx context.Context) (page []VolumeProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVolumeProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 *VolumeProfilesPager) GetAllWithContext(ctx context.Context) (allItems []VolumeProfile, err error) { + for pager.HasNext() { + var nextPage []VolumeProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VolumeProfilesPager) GetNext() (page []VolumeProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VolumeProfilesPager) GetAll() (allItems []VolumeProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VolumesPager can be used to simplify the use of the "ListVolumes" method. +type VolumesPager struct { + hasNext bool + options *ListVolumesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVolumesPager returns a new VolumesPager instance. +func (vpc *VpcV1) NewVolumesPager(options *ListVolumesOptions) (pager *VolumesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVolumesOptions = *options + pager = &VolumesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VolumesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VolumesPager) GetNextWithContext(ctx context.Context) (page []Volume, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVolumesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Volumes + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VolumesPager) GetAllWithContext(ctx context.Context) (allItems []Volume, err error) { + for pager.HasNext() { + var nextPage []Volume + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VolumesPager) GetNext() (page []Volume, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VolumesPager) GetAll() (allItems []Volume, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SnapshotConsistencyGroupsPager can be used to simplify the use of the "ListSnapshotConsistencyGroups" method. +type SnapshotConsistencyGroupsPager struct { + hasNext bool + options *ListSnapshotConsistencyGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSnapshotConsistencyGroupsPager returns a new SnapshotConsistencyGroupsPager instance. +func (vpc *VpcV1) NewSnapshotConsistencyGroupsPager(options *ListSnapshotConsistencyGroupsOptions) (pager *SnapshotConsistencyGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSnapshotConsistencyGroupsOptions = *options + pager = &SnapshotConsistencyGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SnapshotConsistencyGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SnapshotConsistencyGroupsPager) GetNextWithContext(ctx context.Context) (page []SnapshotConsistencyGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSnapshotConsistencyGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.SnapshotConsistencyGroups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SnapshotConsistencyGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SnapshotConsistencyGroup, err error) { + for pager.HasNext() { + var nextPage []SnapshotConsistencyGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SnapshotConsistencyGroupsPager) GetNext() (page []SnapshotConsistencyGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SnapshotConsistencyGroupsPager) GetAll() (allItems []SnapshotConsistencyGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SnapshotsPager can be used to simplify the use of the "ListSnapshots" method. +type SnapshotsPager struct { + hasNext bool + options *ListSnapshotsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSnapshotsPager returns a new SnapshotsPager instance. +func (vpc *VpcV1) NewSnapshotsPager(options *ListSnapshotsOptions) (pager *SnapshotsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSnapshotsOptions = *options + pager = &SnapshotsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SnapshotsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SnapshotsPager) GetNextWithContext(ctx context.Context) (page []Snapshot, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSnapshotsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Snapshots + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SnapshotsPager) GetAllWithContext(ctx context.Context) (allItems []Snapshot, err error) { + for pager.HasNext() { + var nextPage []Snapshot + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SnapshotsPager) GetNext() (page []Snapshot, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SnapshotsPager) GetAll() (allItems []Snapshot, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// ShareMountTargetsPager can be used to simplify the use of the "ListShareMountTargets" method. +type ShareMountTargetsPager struct { + hasNext bool + options *ListShareMountTargetsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewShareMountTargetsPager returns a new ShareMountTargetsPager instance. +func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOptions) (pager *ShareMountTargetsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListShareMountTargetsOptions = *options + pager = &ShareMountTargetsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ShareMountTargetsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (page []ShareMountTarget, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListShareMountTargetsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.MountTargets + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (allItems []ShareMountTarget, err error) { + for pager.HasNext() { + var nextPage []ShareMountTarget + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ShareMountTargetsPager) GetNext() (page []ShareMountTarget, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// ShareProfilesPager can be used to simplify the use of the "ListShareProfiles" method. +type ShareProfilesPager struct { + hasNext bool + options *ListShareProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewShareProfilesPager returns a new ShareProfilesPager instance. +func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (pager *ShareProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListShareProfilesOptions = *options + pager = &ShareProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ShareProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page []ShareProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListShareProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItems []ShareProfile, err error) { + for pager.HasNext() { + var nextPage []ShareProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ShareProfilesPager) GetNext() (page []ShareProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ShareProfilesPager) GetAll() (allItems []ShareProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SharesPager can be used to simplify the use of the "ListShares" method. +type SharesPager struct { + hasNext bool + options *ListSharesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSharesPager returns a new SharesPager instance. +func (vpc *VpcV1) NewSharesPager(options *ListSharesOptions) (pager *SharesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSharesOptions = *options + pager = &SharesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SharesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSharesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Shares + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Share, err error) { + for pager.HasNext() { + var nextPage []Share + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SharesPager) GetNext() (page []Share, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SharesPager) GetAll() (allItems []Share, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "ListNetworkInterfaceFloatingIps" method. +type NetworkInterfaceFloatingIpsPager struct { + hasNext bool + options *ListNetworkInterfaceFloatingIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewNetworkInterfaceFloatingIpsPager returns a new NetworkInterfaceFloatingIpsPager instance. +func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterfaceFloatingIpsOptions) (pager *NetworkInterfaceFloatingIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListNetworkInterfaceFloatingIpsOptions = *options + pager = &NetworkInterfaceFloatingIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *NetworkInterfaceFloatingIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIPReference, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListNetworkInterfaceFloatingIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.FloatingIps + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIPReference, err error) { + for pager.HasNext() { + var nextPage []FloatingIPReference + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *NetworkInterfaceFloatingIpsPager) GetNext() (page []FloatingIPReference, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *NetworkInterfaceFloatingIpsPager) GetAll() (allItems []FloatingIPReference, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "ListVirtualNetworkInterfaceIps" method. +type VirtualNetworkInterfaceIpsPager struct { + hasNext bool + options *ListVirtualNetworkInterfaceIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVirtualNetworkInterfaceIpsPager returns a new VirtualNetworkInterfaceIpsPager instance. +func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetworkInterfaceIpsOptions) (pager *VirtualNetworkInterfaceIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVirtualNetworkInterfaceIpsOptions = *options + pager = &VirtualNetworkInterfaceIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VirtualNetworkInterfaceIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIPReference, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVirtualNetworkInterfaceIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Ips + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIPReference, err error) { + for pager.HasNext() { + var nextPage []ReservedIPReference + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VirtualNetworkInterfaceIpsPager) GetNext() (page []ReservedIPReference, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPReference, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. +type VirtualNetworkInterfacesPager struct { + hasNext bool + options *ListVirtualNetworkInterfacesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. +func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVirtualNetworkInterfacesOptions = *options + pager = &VirtualNetworkInterfacesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VirtualNetworkInterfacesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []VirtualNetworkInterface, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVirtualNetworkInterfacesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.VirtualNetworkInterfaces + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []VirtualNetworkInterface, err error) { + for pager.HasNext() { + var nextPage []VirtualNetworkInterface + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VirtualNetworkInterfacesPager) GetNext() (page []VirtualNetworkInterface, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. +type PublicGatewaysPager struct { + hasNext bool + options *ListPublicGatewaysOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewPublicGatewaysPager returns a new PublicGatewaysPager instance. +func (vpc *VpcV1) NewPublicGatewaysPager(options *ListPublicGatewaysOptions) (pager *PublicGatewaysPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListPublicGatewaysOptions = *options + pager = &PublicGatewaysPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *PublicGatewaysPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page []PublicGateway, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListPublicGatewaysWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.PublicGateways + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []PublicGateway, err error) { + for pager.HasNext() { + var nextPage []PublicGateway + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *PublicGatewaysPager) GetNext() (page []PublicGateway, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *PublicGatewaysPager) GetAll() (allItems []PublicGateway, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. +type FloatingIpsPager struct { + hasNext bool + options *ListFloatingIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewFloatingIpsPager returns a new FloatingIpsPager instance. +func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *FloatingIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListFloatingIpsOptions = *options + pager = &FloatingIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *FloatingIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListFloatingIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.FloatingIps + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIP, err error) { + for pager.HasNext() { + var nextPage []FloatingIP + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *FloatingIpsPager) GetNext() (page []FloatingIP, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// NetworkACLRulesPager can be used to simplify the use of the "ListNetworkACLRules" method. +type NetworkACLRulesPager struct { + hasNext bool + options *ListNetworkACLRulesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewNetworkACLRulesPager returns a new NetworkACLRulesPager instance. +func (vpc *VpcV1) NewNetworkACLRulesPager(options *ListNetworkACLRulesOptions) (pager *NetworkACLRulesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListNetworkACLRulesOptions = *options + pager = &NetworkACLRulesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *NetworkACLRulesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *NetworkACLRulesPager) GetNextWithContext(ctx context.Context) (page []NetworkACLRuleItemIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListNetworkACLRulesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Rules + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACLRuleItemIntf, err error) { + for pager.HasNext() { + var nextPage []NetworkACLRuleItemIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *NetworkACLRulesPager) GetNext() (page []NetworkACLRuleItemIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. +type NetworkAclsPager struct { + hasNext bool + options *ListNetworkAclsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewNetworkAclsPager returns a new NetworkAclsPager instance. +func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *NetworkAclsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListNetworkAclsOptions = *options + pager = &NetworkAclsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *NetworkAclsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []NetworkACL, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListNetworkAclsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.NetworkAcls + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACL, err error) { + for pager.HasNext() { + var nextPage []NetworkACL + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *NetworkAclsPager) GetNext() (page []NetworkACL, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SecurityGroupTargetsPager can be used to simplify the use of the "ListSecurityGroupTargets" method. +type SecurityGroupTargetsPager struct { + hasNext bool + options *ListSecurityGroupTargetsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSecurityGroupTargetsPager returns a new SecurityGroupTargetsPager instance. +func (vpc *VpcV1) NewSecurityGroupTargetsPager(options *ListSecurityGroupTargetsOptions) (pager *SecurityGroupTargetsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSecurityGroupTargetsOptions = *options + pager = &SecurityGroupTargetsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SecurityGroupTargetsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroupTargetReferenceIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSecurityGroupTargetsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Targets + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroupTargetReferenceIntf, err error) { + for pager.HasNext() { + var nextPage []SecurityGroupTargetReferenceIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SecurityGroupTargetsPager) GetNext() (page []SecurityGroupTargetReferenceIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTargetReferenceIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. +type SecurityGroupsPager struct { + hasNext bool + options *ListSecurityGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSecurityGroupsPager returns a new SecurityGroupsPager instance. +func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pager *SecurityGroupsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListSecurityGroupsOptions = *options + pager = &SecurityGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SecurityGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSecurityGroupsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.SecurityGroups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroup, err error) { + for pager.HasNext() { + var nextPage []SecurityGroup + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SecurityGroupsPager) GetNext() (page []SecurityGroup, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// IkePoliciesPager can be used to simplify the use of the "ListIkePolicies" method. +type IkePoliciesPager struct { + hasNext bool + options *ListIkePoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewIkePoliciesPager returns a new IkePoliciesPager instance. +func (vpc *VpcV1) NewIkePoliciesPager(options *ListIkePoliciesOptions) (pager *IkePoliciesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListIkePoliciesOptions = *options + pager = &IkePoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *IkePoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *IkePoliciesPager) GetNextWithContext(ctx context.Context) (page []IkePolicy, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListIkePoliciesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.IkePolicies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *IkePoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IkePolicy, err error) { + for pager.HasNext() { + var nextPage []IkePolicy + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *IkePoliciesPager) GetNext() (page []IkePolicy, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *IkePoliciesPager) GetAll() (allItems []IkePolicy, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// IpsecPoliciesPager can be used to simplify the use of the "ListIpsecPolicies" method. +type IpsecPoliciesPager struct { + hasNext bool + options *ListIpsecPoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewIpsecPoliciesPager returns a new IpsecPoliciesPager instance. +func (vpc *VpcV1) NewIpsecPoliciesPager(options *ListIpsecPoliciesOptions) (pager *IpsecPoliciesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListIpsecPoliciesOptions = *options + pager = &IpsecPoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *IpsecPoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *IpsecPoliciesPager) GetNextWithContext(ctx context.Context) (page []IPsecPolicy, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListIpsecPoliciesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.IpsecPolicies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *IpsecPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IPsecPolicy, err error) { + for pager.HasNext() { + var nextPage []IPsecPolicy + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *IpsecPoliciesPager) GetNext() (page []IPsecPolicy, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *IpsecPoliciesPager) GetAll() (allItems []IPsecPolicy, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. +type VPNGatewaysPager struct { + hasNext bool + options *ListVPNGatewaysOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPNGatewaysPager returns a new VPNGatewaysPager instance. +func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *VPNGatewaysPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPNGatewaysOptions = *options + pager = &VPNGatewaysPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPNGatewaysPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPNGatewaysWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.VPNGateways + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayIntf, err error) { + for pager.HasNext() { + var nextPage []VPNGatewayIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPNGatewaysPager) GetNext() (page []VPNGatewayIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. +type VPNServerClientsPager struct { + hasNext bool + options *ListVPNServerClientsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPNServerClientsPager returns a new VPNServerClientsPager instance. +func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) (pager *VPNServerClientsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPNServerClientsOptions = *options + pager = &VPNServerClientsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPNServerClientsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (page []VPNServerClient, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPNServerClientsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Clients + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerClient, err error) { + for pager.HasNext() { + var nextPage []VPNServerClient + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPNServerClientsPager) GetNext() (page []VPNServerClient, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. +type VPNServerRoutesPager struct { + hasNext bool + options *ListVPNServerRoutesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPNServerRoutesPager returns a new VPNServerRoutesPager instance. +func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) (pager *VPNServerRoutesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPNServerRoutesOptions = *options + pager = &VPNServerRoutesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPNServerRoutesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page []VPNServerRoute, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPNServerRoutesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Routes + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerRoute, err error) { + for pager.HasNext() { + var nextPage []VPNServerRoute + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPNServerRoutesPager) GetNext() (page []VPNServerRoute, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// VPNServersPager can be used to simplify the use of the "ListVPNServers" method. +type VPNServersPager struct { + hasNext bool + options *ListVPNServersOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVPNServersPager returns a new VPNServersPager instance. +func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPNServersPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListVPNServersOptions = *options + pager = &VPNServersPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VPNServersPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VPNServer, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVPNServersWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.VPNServers + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems []VPNServer, err error) { + for pager.HasNext() { + var nextPage []VPNServer + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *VPNServersPager) GetNext() (page []VPNServer, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *VPNServersPager) GetAll() (allItems []VPNServer, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// LoadBalancerProfilesPager can be used to simplify the use of the "ListLoadBalancerProfiles" method. +type LoadBalancerProfilesPager struct { + hasNext bool + options *ListLoadBalancerProfilesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewLoadBalancerProfilesPager returns a new LoadBalancerProfilesPager instance. +func (vpc *VpcV1) NewLoadBalancerProfilesPager(options *ListLoadBalancerProfilesOptions) (pager *LoadBalancerProfilesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListLoadBalancerProfilesOptions = *options + pager = &LoadBalancerProfilesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *LoadBalancerProfilesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *LoadBalancerProfilesPager) GetNextWithContext(ctx context.Context) (page []LoadBalancerProfile, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListLoadBalancerProfilesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 *LoadBalancerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []LoadBalancerProfile, err error) { + for pager.HasNext() { + var nextPage []LoadBalancerProfile + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *LoadBalancerProfilesPager) GetNext() (page []LoadBalancerProfile, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *LoadBalancerProfilesPager) GetAll() (allItems []LoadBalancerProfile, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// LoadBalancersPager can be used to simplify the use of the "ListLoadBalancers" method. +type LoadBalancersPager struct { + hasNext bool + options *ListLoadBalancersOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewLoadBalancersPager returns a new LoadBalancersPager instance. +func (vpc *VpcV1) NewLoadBalancersPager(options *ListLoadBalancersOptions) (pager *LoadBalancersPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListLoadBalancersOptions = *options + pager = &LoadBalancersPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *LoadBalancersPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *LoadBalancersPager) GetNextWithContext(ctx context.Context) (page []LoadBalancer, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListLoadBalancersWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.LoadBalancers + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *LoadBalancersPager) GetAllWithContext(ctx context.Context) (allItems []LoadBalancer, err error) { + for pager.HasNext() { + var nextPage []LoadBalancer + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *LoadBalancersPager) GetNext() (page []LoadBalancer, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *LoadBalancersPager) GetAll() (allItems []LoadBalancer, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// EndpointGatewayIpsPager can be used to simplify the use of the "ListEndpointGatewayIps" method. +type EndpointGatewayIpsPager struct { + hasNext bool + options *ListEndpointGatewayIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewEndpointGatewayIpsPager returns a new EndpointGatewayIpsPager instance. +func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOptions) (pager *EndpointGatewayIpsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListEndpointGatewayIpsOptions = *options + pager = &EndpointGatewayIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *EndpointGatewayIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListEndpointGatewayIpsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Ips + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { + for pager.HasNext() { + var nextPage []ReservedIP + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *EndpointGatewayIpsPager) GetNext() (page []ReservedIP, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// EndpointGatewaysPager can be used to simplify the use of the "ListEndpointGateways" method. +type EndpointGatewaysPager struct { + hasNext bool + options *ListEndpointGatewaysOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewEndpointGatewaysPager returns a new EndpointGatewaysPager instance. +func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) (pager *EndpointGatewaysPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListEndpointGatewaysOptions = *options + pager = &EndpointGatewaysPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *EndpointGatewaysPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (page []EndpointGateway, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListEndpointGatewaysWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.EndpointGateways + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []EndpointGateway, err error) { + for pager.HasNext() { + var nextPage []EndpointGateway + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *EndpointGatewaysPager) GetNext() (page []EndpointGateway, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// FlowLogCollectorsPager can be used to simplify the use of the "ListFlowLogCollectors" method. +type FlowLogCollectorsPager struct { + hasNext bool + options *ListFlowLogCollectorsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewFlowLogCollectorsPager returns a new FlowLogCollectorsPager instance. +func (vpc *VpcV1) NewFlowLogCollectorsPager(options *ListFlowLogCollectorsOptions) (pager *FlowLogCollectorsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListFlowLogCollectorsOptions = *options + pager = &FlowLogCollectorsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *FlowLogCollectorsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *FlowLogCollectorsPager) GetNextWithContext(ctx context.Context) (page []FlowLogCollector, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListFlowLogCollectorsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.FlowLogCollectors + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *FlowLogCollectorsPager) GetAllWithContext(ctx context.Context) (allItems []FlowLogCollector, err error) { + for pager.HasNext() { + var nextPage []FlowLogCollector + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *FlowLogCollectorsPager) GetNext() (page []FlowLogCollector, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *FlowLogCollectorsPager) GetAll() (allItems []FlowLogCollector, err error) { + return pager.GetAllWithContext(context.Background()) +} diff --git a/go.mod b/go.mod index e0469de8ae..6cabcc588a 100644 --- a/go.mod +++ b/go.mod @@ -238,6 +238,8 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt // add sdk changes. replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 +replace github.com/IBM/vpc-go-sdk v0.48.0 => ./common/github.com/IBM/vpc-go-sdk + exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible diff --git a/ibm/service/iampolicy/resource_ibm_iam_user_policy_test.go b/ibm/service/iampolicy/resource_ibm_iam_user_policy_test.go index 91b62395a5..ce861ce2f4 100644 --- a/ibm/service/iampolicy/resource_ibm_iam_user_policy_test.go +++ b/ibm/service/iampolicy/resource_ibm_iam_user_policy_test.go @@ -226,7 +226,6 @@ func TestAccIBMIAMUserPolicy_With_Resource_Attributes_Without_Wildcard(t *testin }) } - func TestAccIBMIAMUserPolicy_account_management(t *testing.T) { var conf iampolicymanagementv1.V2PolicyTemplateMetaData name := fmt.Sprintf("terraform_%d", acctest.RandIntRange(10, 100)) @@ -848,7 +847,6 @@ func testAccCheckIBMIAMUserPolicyResourceAttributesWithoutWildcard() string { `, acc.IAMUser) } - func testAccCheckIBMIAMUserPolicyResourceAttributesUpdate() string { return fmt.Sprintf(` resource "ibm_iam_user_policy" "policy" { diff --git a/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go index 74a7efa3c0..6dc6c45c17 100644 --- a/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go +++ b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go @@ -543,7 +543,7 @@ func dataSourceIBMIsSnapshotConsistencyGroupResourceGroupReferenceToMap(model *v return modelMap, nil } -func dataSourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(model *vpcv1.SnapshotConsistencyGroupSnapshotsItem) (map[string]interface{}, error) { +func dataSourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(model *vpcv1.SnapshotReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["crn"] = model.CRN if model.Deleted != nil { From 021de53c1302c96fec03b1deb6cb0d45b9d2d5c4 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 6 Mar 2024 16:00:25 +0530 Subject: [PATCH 056/103] Update resource_ibm_is_snapshot_consistency_group.go --- .../vpc/resource_ibm_is_snapshot_consistency_group.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go b/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go index c73112fb3d..b7c38774e4 100644 --- a/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go +++ b/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go @@ -316,11 +316,11 @@ func resourceIBMIsSnapshotConsistencyGroupCreate(context context.Context, d *sch ID: &rg, } } - var snapshotConsistencyGroupPrototypeSnapshotsItemArray []vpcv1.SnapshotConsistencyGroupPrototypeSnapshotsItem + var snapshotConsistencyGroupPrototypeSnapshotsItemArray []vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext snapshotsArray := d.Get("snapshots").([]interface{}) for _, snapshot := range snapshotsArray { snapshotVal := snapshot.(map[string]interface{}) - snapshotConsistencyGroupPrototypeSnapshotsItem := &vpcv1.SnapshotConsistencyGroupPrototypeSnapshotsItem{} + snapshotConsistencyGroupPrototypeSnapshotsItem := &vpcv1.SnapshotPrototypeSnapshotConsistencyGroupContext{} volume := snapshotVal["source_volume"].(string) snapshotConsistencyGroupPrototypeSnapshotsItem.SourceVolume = &vpcv1.VolumeIdentity{ @@ -714,7 +714,7 @@ func resourceIBMIsSnapshotConsistencyGroupResourceGroupReferenceToMap(model *vpc return modelMap, nil } -func resourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(model *vpcv1.SnapshotConsistencyGroupSnapshotsItem) (map[string]interface{}, error) { +func resourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(model *vpcv1.SnapshotReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["crn"] = model.CRN if model.Deleted != nil { From 1fef14e00def5fb2e0d81552ca54e16e34fd943f Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 6 Mar 2024 17:10:35 +0530 Subject: [PATCH 057/103] vpn 113 changes --- ...ta_source_ibm_is_vpn_gateway_connection.go | 293 +++++++++++-- ...m_is_vpn_gateway_connection_local_cidrs.go | 71 +++ ...vpn_gateway_connection_local_cidrs_test.go | 40 ++ ...bm_is_vpn_gateway_connection_peer_cidrs.go | 70 +++ ..._vpn_gateway_connection_peer_cidrs_test.go | 40 ++ ...a_source_ibm_is_vpn_gateway_connections.go | 252 +++++++++-- ...resource_ibm_is_vpn_gateway_connections.go | 405 ++++++++++++++++-- .../d/is_vpn_gateway_connection.html.markdown | 19 + ...teway_connection_local_cidrs.html.markdown | 35 ++ ...ateway_connection_peer_cidrs.html.markdown | 35 ++ .../is_vpn_gateway_connections.html.markdown | 17 + .../r/is_vpn_gateway_connection.html.markdown | 17 + 12 files changed, 1195 insertions(+), 99 deletions(-) create mode 100644 ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_local_cidrs.go create mode 100644 ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_local_cidrs_test.go create mode 100644 ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_peer_cidrs.go create mode 100644 ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_peer_cidrs_test.go create mode 100644 website/docs/d/is_vpn_gateway_connection_local_cidrs.html.markdown create mode 100644 website/docs/d/is_vpn_gateway_connection_peer_cidrs.html.markdown diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go index d9fdca1993..38f60b39ca 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go @@ -185,11 +185,87 @@ func DataSourceIBMISVPNGatewayConnection() *schema.Resource { Computed: true, Description: "The user-defined name for this VPN gateway connection.", }, - "peer_address": { + + // new breaking changes + "establish_mode": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "The IP address of the peer VPN gateway.", + Description: "The establish mode of the VPN gateway connection:- `bidirectional`: Either side of the VPN gateway can initiate IKE protocol negotiations or rekeying processes.- `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway connection. Additionally, the peer is responsible for initiating the rekeying process after the connection is established. If rekeying does not occur, the VPN gateway connection will be brought down after its lifetime expires.", }, + "local": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ike_identities": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The local IKE identities.A VPN gateway in static route mode consists of two members in active-active mode. The first identity applies to the first member, and the second identity applies to the second member.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IKE identity type.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected property value was encountered.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IKE identity FQDN value.", + }, + }, + }, + }, + }, + }, + }, + "peer": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ike_identity": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The peer IKE identity.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IKE identity type.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected property value was encountered.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IKE identity FQDN value.", + }, + }, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Indicates whether `peer.address` or `peer.fqdn` is used.", + }, + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IP address of the peer VPN gateway for this connection.", + }, + "fqdn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The FQDN of the peer VPN gateway for this connection.", + }, + }, + }, + }, + // "peer_address": { + // Type: schema.TypeString, + // Computed: true, + // Description: "The IP address of the peer VPN gateway.", + // }, "psk": { Type: schema.TypeString, Computed: true, @@ -253,22 +329,22 @@ func DataSourceIBMISVPNGatewayConnection() *schema.Resource { }, }, }, - "local_cidrs": { - Type: schema.TypeList, - Computed: true, - Description: "The local CIDRs for this resource.", - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "peer_cidrs": { - Type: schema.TypeList, - Computed: true, - Description: "The peer CIDRs for this resource.", - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, + // "local_cidrs": { + // Type: schema.TypeList, + // Computed: true, + // Description: "The local CIDRs for this resource.", + // Elem: &schema.Schema{ + // Type: schema.TypeString, + // }, + // }, + // "peer_cidrs": { + // Type: schema.TypeList, + // Computed: true, + // Description: "The peer CIDRs for this resource.", + // Elem: &schema.Schema{ + // Type: schema.TypeString, + // }, + // }, }, } } @@ -394,9 +470,38 @@ func dataSourceIBMIsVPNGatewayConnectionRead(context context.Context, d *schema. if err = d.Set("name", vpnGatewayConnection.Name); err != nil { return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) } - if err = d.Set("peer_address", vpnGatewayConnection.PeerAddress); err != nil { - return diag.FromErr(fmt.Errorf("Error setting peer_address: %s", err)) + + // breaking changes + if err = d.Set("establish_mode", vpnGatewayConnection.EstablishMode); err != nil { + return diag.FromErr(fmt.Errorf("Error setting establish_mode: %s", err)) } + local := []map[string]interface{}{} + if vpnGatewayConnection.Local != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(vpnGatewayConnection.Local) + if err != nil { + return diag.FromErr(err) + } + local = append(local, modelMap) + } + if err = d.Set("local", local); err != nil { + return diag.FromErr(fmt.Errorf("Error setting local %s", err)) + } + + peer := []map[string]interface{}{} + if vpnGatewayConnection.Peer != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(vpnGatewayConnection.Peer) + if err != nil { + return diag.FromErr(err) + } + peer = append(peer, modelMap) + } + if err = d.Set("peer", peer); err != nil { + return diag.FromErr(fmt.Errorf("Error setting peer %s", err)) + } + + // if err = d.Set("peer_address", vpnGatewayConnection.PeerAddress); err != nil { + // return diag.FromErr(fmt.Errorf("Error setting peer_address: %s", err)) + // } if err = d.Set("psk", vpnGatewayConnection.Psk); err != nil { return diag.FromErr(fmt.Errorf("Error setting psk: %s", err)) } @@ -420,19 +525,19 @@ func dataSourceIBMIsVPNGatewayConnectionRead(context context.Context, d *schema. } } - if len(vpnGatewayConnection.LocalCIDRs) > 0 { - err = d.Set("local_cidrs", vpnGatewayConnection.LocalCIDRs) - if err != nil { - return diag.FromErr(fmt.Errorf("Error setting local CIDRs %s", err)) - } - } + // if len(vpnGatewayConnection.LocalCIDRs) > 0 { + // err = d.Set("local_cidrs", vpnGatewayConnection.LocalCIDRs) + // if err != nil { + // return diag.FromErr(fmt.Errorf("Error setting local CIDRs %s", err)) + // } + // } - if len(vpnGatewayConnection.PeerCIDRs) > 0 { - err = d.Set("peer_cidrs", vpnGatewayConnection.PeerCIDRs) - if err != nil { - return diag.FromErr(fmt.Errorf("Error setting Peer CIDRs %s", err)) - } - } + // if len(vpnGatewayConnection.PeerCIDRs) > 0 { + // err = d.Set("peer_cidrs", vpnGatewayConnection.PeerCIDRs) + // if err != nil { + // return diag.FromErr(fmt.Errorf("Error setting Peer CIDRs %s", err)) + // } + // } return nil } @@ -576,3 +681,127 @@ func dataSourceVPNGatewayConnectionTunnelsPublicIPToMap(publicIPItem vpcv1.IP) ( return publicIPMap } + +// helper methods + +func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStatusReasonToMap(model *vpcv1.VPNGatewayConnectionStatusReason) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["code"] = model.Code + modelMap["message"] = model.Message + if model.MoreInfo != nil { + modelMap["more_info"] = model.MoreInfo + } + return modelMap, nil +} + +func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(model *vpcv1.VPNGatewayConnectionStaticRouteModeLocal) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + ikeIdentities := []map[string]interface{}{} + for _, ikeIdentitiesItem := range model.IkeIdentities { + ikeIdentitiesItemMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(ikeIdentitiesItem) + if err != nil { + return modelMap, err + } + ikeIdentities = append(ikeIdentities, ikeIdentitiesItemMap) + } + modelMap["ike_identities"] = ikeIdentities + return modelMap, nil +} + +func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(model vpcv1.VPNGatewayConnectionIkeIdentityIntf) (map[string]interface{}, error) { + if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn); ok { + return dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnToMap(model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname); ok { + return dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameToMap(model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4); ok { + return dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4ToMap(model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID); ok { + return dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDToMap(model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentity); ok { + modelMap := make(map[string]interface{}) + model := model.(*vpcv1.VPNGatewayConnectionIkeIdentity) + modelMap["type"] = model.Type + if model.Value != nil { + modelMap["value"] = model.Value + } + return modelMap, nil + } else { + return nil, fmt.Errorf("Unrecognized vpcv1.VPNGatewayConnectionIkeIdentityIntf subtype encountered") + } +} + +func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnToMap(model *vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["type"] = model.Type + modelMap["value"] = model.Value + return modelMap, nil +} + +func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameToMap(model *vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["type"] = model.Type + modelMap["value"] = model.Value + return modelMap, nil +} + +func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4ToMap(model *vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["type"] = model.Type + modelMap["value"] = model.Value + return modelMap, nil +} +func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDToMap(model *vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["type"] = model.Type + modelMap["value"] = string(*model.Value) + return modelMap, nil +} + +func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(model vpcv1.VPNGatewayConnectionStaticRouteModePeerIntf) (map[string]interface{}, error) { + if _, ok := model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress); ok { + return dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddressToMap(model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn); ok { + return dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdnToMap(model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer); ok { + modelMap := make(map[string]interface{}) + model := model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer) + ikeIdentityMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(model.IkeIdentity) + if err != nil { + return modelMap, err + } + modelMap["ike_identity"] = []map[string]interface{}{ikeIdentityMap} + modelMap["type"] = model.Type + if model.Address != nil { + modelMap["address"] = model.Address + } + if model.Fqdn != nil { + modelMap["fqdn"] = model.Fqdn + } + return modelMap, nil + } else { + return nil, fmt.Errorf("Unrecognized vpcv1.VPNGatewayConnectionStaticRouteModePeerIntf subtype encountered") + } +} + +func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddressToMap(model *vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + ikeIdentityMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(model.IkeIdentity) + if err != nil { + return modelMap, err + } + modelMap["ike_identity"] = []map[string]interface{}{ikeIdentityMap} + modelMap["type"] = model.Type + modelMap["address"] = model.Address + return modelMap, nil +} +func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdnToMap(model *vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + ikeIdentityMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(model.IkeIdentity) + if err != nil { + return modelMap, err + } + modelMap["ike_identity"] = []map[string]interface{}{ikeIdentityMap} + modelMap["type"] = model.Type + modelMap["fqdn"] = model.Fqdn + return modelMap, nil +} diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_local_cidrs.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_local_cidrs.go new file mode 100644 index 0000000000..e2112c93b0 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_local_cidrs.go @@ -0,0 +1,71 @@ +// Copyright IBM Corp. 2024 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func DataSourceIBMIsVPNGatewayConnectionLocalCidrs() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIBMIsVPNGatewayConnectionLocalCidrsRead, + + Schema: map[string]*schema.Schema{ + "vpn_gateway": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The VPN gateway identifier.", + }, + "vpn_gateway_connection": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The VPN gateway connection identifier.", + }, + "cidrs": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The CIDRs for this resource.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + } +} + +func dataSourceIBMIsVPNGatewayConnectionLocalCidrsRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := meta.(conns.ClientSession).VpcV1API() + if err != nil { + return diag.FromErr(err) + } + + listVPNGatewayConnectionsLocalCidrsOptions := &vpcv1.ListVPNGatewayConnectionsLocalCIDRsOptions{} + + listVPNGatewayConnectionsLocalCidrsOptions.SetVPNGatewayID(d.Get("vpn_gateway").(string)) + listVPNGatewayConnectionsLocalCidrsOptions.SetID(d.Get("vpn_gateway_connection").(string)) + + vpnGatewayConnectionCidRs, response, err := vpcClient.ListVPNGatewayConnectionsLocalCIDRsWithContext(context, listVPNGatewayConnectionsLocalCidrsOptions) + if err != nil { + log.Printf("[DEBUG] ListVPNGatewayConnectionsLocalCidrsWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("ListVPNGatewayConnectionsLocalCidrsWithContext failed %s\n%s", err, response)) + } + d.SetId(dataSourceIBMIsVPNGatewayConnectionLocalCidrsID(d)) + d.Set("cidrs", vpnGatewayConnectionCidRs.CIDRs) + + return nil +} + +// dataSourceIBMIsVPNGatewayConnectionLocalCidrsID returns a reasonable ID for the list. +func dataSourceIBMIsVPNGatewayConnectionLocalCidrsID(d *schema.ResourceData) string { + return time.Now().UTC().String() +} diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_local_cidrs_test.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_local_cidrs_test.go new file mode 100644 index 0000000000..6d211336f5 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_local_cidrs_test.go @@ -0,0 +1,40 @@ +// Copyright IBM Corp. 2024 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIBMIsVPNGatewayConnectionLocalCidrsDataSourceBasic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVPNGatewayConnectionLocalCidrsDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection_local_cidrs.is_vpn_gateway_connection_cidrs_instance", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection_local_cidrs.is_vpn_gateway_connection_cidrs_instance", "vpn_gateway"), + resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection_local_cidrs.is_vpn_gateway_connection_cidrs_instance", "vpn_gateway_connection"), + resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection_local_cidrs.is_vpn_gateway_connection_cidrs_instance", "cidrs.#"), + ), + }, + }, + }) +} + +func testAccCheckIBMIsVPNGatewayConnectionLocalCidrsDataSourceConfigBasic() string { + return fmt.Sprintf(` + data "ibm_is_vpn_gateway_connection_local_cidrs" "is_vpn_gateway_connection_cidrs_instance" { + vpn_gateway = "vpn_gateway" + id = "id" + } + `) +} diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_peer_cidrs.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_peer_cidrs.go new file mode 100644 index 0000000000..31bf056ab7 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_peer_cidrs.go @@ -0,0 +1,70 @@ +// Copyright IBM Corp. 2024 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +func DataSourceIBMIsVPNGatewayConnectionPeerCidrs() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIBMIsVPNGatewayConnectionPeerCidrsRead, + + Schema: map[string]*schema.Schema{ + "vpn_gateway": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The VPN gateway identifier.", + }, + "vpn_gateway_connection": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The VPN gateway connection identifier.", + }, + "cidrs": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The CIDRs for this resource.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + } +} + +func dataSourceIBMIsVPNGatewayConnectionPeerCidrsRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + vpcClient, err := meta.(conns.ClientSession).VpcV1API() + if err != nil { + return diag.FromErr(err) + } + listVPNGatewayConnectionsPeerCidrsOptions := &vpcv1.ListVPNGatewayConnectionsPeerCIDRsOptions{} + + listVPNGatewayConnectionsPeerCidrsOptions.SetVPNGatewayID(d.Get("vpn_gateway").(string)) + listVPNGatewayConnectionsPeerCidrsOptions.SetID(d.Get("vpn_gateway_connection").(string)) + + vpnGatewayConnectionCidRs, response, err := vpcClient.ListVPNGatewayConnectionsPeerCIDRsWithContext(context, listVPNGatewayConnectionsPeerCidrsOptions) + if err != nil { + log.Printf("[DEBUG] ListVPNGatewayConnectionsPeerCidrsWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("ListVPNGatewayConnectionsPeerCidrsWithContext failed %s\n%s", err, response)) + } + d.SetId(dataSourceIBMIsVPNGatewayConnectionPeerCidrsID(d)) + d.Set("cidrs", vpnGatewayConnectionCidRs.CIDRs) + + return nil +} + +// dataSourceIBMIsVPNGatewayConnectionPeerCidrsID returns a reasonable ID for the list. +func dataSourceIBMIsVPNGatewayConnectionPeerCidrsID(d *schema.ResourceData) string { + return time.Now().UTC().String() +} diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_peer_cidrs_test.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_peer_cidrs_test.go new file mode 100644 index 0000000000..867c31fe73 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_peer_cidrs_test.go @@ -0,0 +1,40 @@ +// Copyright IBM Corp. 2024 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIBMIsVPNGatewayConnectionPeerCidrsDataSourceBasic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIBMIsVPNGatewayConnectionPeerCidrsDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection_peer_cidrs.is_vpn_gateway_connection_cidrs_instance", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection_peer_cidrs.is_vpn_gateway_connection_cidrs_instance", "vpn_gateway"), + resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection_peer_cidrs.is_vpn_gateway_connection_cidrs_instance", "vpn_gateway_connection"), + resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection_peer_cidrs.is_vpn_gateway_connection_cidrs_instance", "cidrs.#"), + ), + }, + }, + }) +} + +func testAccCheckIBMIsVPNGatewayConnectionPeerCidrsDataSourceConfigBasic() string { + return fmt.Sprintf(` + data "ibm_is_vpn_gateway_connection_peer_cidrs" "is_vpn_gateway_connection_cidrs_instance" { + vpn_gateway = "vpn_gateway" + id = "id" + } + `) +} diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go index d7f0ef16ca..1f1a616914 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go @@ -7,7 +7,6 @@ import ( "fmt" "time" - "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -97,10 +96,85 @@ func DataSourceIBMISVPNGatewayConnections() *schema.Resource { Computed: true, Description: "VPN Gateway connection name", }, - isVPNGatewayConnectionPeerAddress: { + // isVPNGatewayConnectionPeerAddress: { + // Type: schema.TypeString, + // Computed: true, + // Description: "VPN gateway connection peer address", + // }, + // new breaking change + "establish_mode": &schema.Schema{ Type: schema.TypeString, Computed: true, - Description: "VPN gateway connection peer address", + Description: "The establish mode of the VPN gateway connection:- `bidirectional`: Either side of the VPN gateway can initiate IKE protocol negotiations or rekeying processes.- `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway connection. Additionally, the peer is responsible for initiating the rekeying process after the connection is established. If rekeying does not occur, the VPN gateway connection will be brought down after its lifetime expires.", + }, + "local": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ike_identities": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The local IKE identities.A VPN gateway in static route mode consists of two members in active-active mode. The first identity applies to the first member, and the second identity applies to the second member.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IKE identity type.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected property value was encountered.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IKE identity FQDN value.", + }, + }, + }, + }, + }, + }, + }, + "peer": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ike_identity": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The peer IKE identity.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IKE identity type.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected property value was encountered.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IKE identity FQDN value.", + }, + }, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Indicates whether `peer.address` or `peer.fqdn` is used.", + }, + "address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The IP address of the peer VPN gateway for this connection.", + }, + "fqdn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The FQDN of the peer VPN gateway for this connection.", + }, + }, + }, }, isVPNGatewayConnectionResourcetype: { Type: schema.TypeString, @@ -158,21 +232,21 @@ func DataSourceIBMISVPNGatewayConnections() *schema.Resource { }, }, }, - isVPNGatewayConnectionLocalCIDRS: { - Type: schema.TypeSet, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, - Description: "VPN gateway connection local CIDRs", - }, + // isVPNGatewayConnectionLocalCIDRS: { + // Type: schema.TypeSet, + // Computed: true, + // Elem: &schema.Schema{Type: schema.TypeString}, + // Set: schema.HashString, + // Description: "VPN gateway connection local CIDRs", + // }, - isVPNGatewayConnectionPeerCIDRS: { - Type: schema.TypeSet, - Computed: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, - Description: "VPN gateway connection peer CIDRs", - }, + // isVPNGatewayConnectionPeerCIDRS: { + // Type: schema.TypeSet, + // Computed: true, + // Elem: &schema.Schema{Type: schema.TypeString}, + // Set: schema.HashString, + // Description: "VPN gateway connection peer CIDRs", + // }, }, }, }, @@ -208,21 +282,37 @@ func dataSourceIBMVPNGatewayConnectionsRead(d *schema.ResourceData, meta interfa gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = *data.DeadPeerDetection.Timeout gatewayconnection[isVPNGatewayConnectionID] = *data.ID + if data.Local != nil { + localMap, err := dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionStaticRouteModeLocalToMap(data.Local) + if err != nil { + return err + } + gatewayconnection["local"] = []map[string]interface{}{localMap} + } + if data.Peer != nil { + peerMap, err := dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionStaticRouteModePeerToMap(data.Peer) + if err != nil { + return err + } + gatewayconnection["peer"] = []map[string]interface{}{peerMap} + } + gatewayconnection["establish_mode"] = data.EstablishMode + if data.IkePolicy != nil { gatewayconnection[isVPNGatewayConnectionIKEPolicy] = *data.IkePolicy.ID } if data.IpsecPolicy != nil { gatewayconnection[isVPNGatewayConnectionIPSECPolicy] = *data.IpsecPolicy.ID } - if data.LocalCIDRs != nil { - gatewayconnection[isVPNGatewayConnectionLocalCIDRS] = flex.FlattenStringList(data.LocalCIDRs) - } - if data.PeerCIDRs != nil { - gatewayconnection[isVPNGatewayConnectionPeerCIDRS] = flex.FlattenStringList(data.PeerCIDRs) - } + // if data.LocalCIDRs != nil { + // gatewayconnection[isVPNGatewayConnectionLocalCIDRS] = flex.FlattenStringList(data.LocalCIDRs) + // } + // if data.PeerCIDRs != nil { + // gatewayconnection[isVPNGatewayConnectionPeerCIDRS] = flex.FlattenStringList(data.PeerCIDRs) + // } gatewayconnection[isVPNGatewayConnectionMode] = *data.Mode gatewayconnection[isVPNGatewayConnectionName] = *data.Name - gatewayconnection[isVPNGatewayConnectionPeerAddress] = *data.PeerAddress + // gatewayconnection[isVPNGatewayConnectionPeerAddress] = *data.PeerAddress gatewayconnection[isVPNGatewayConnectionResourcetype] = *data.ResourceType gatewayconnection[isVPNGatewayConnectionStatus] = *data.Status gatewayconnection[isVPNGatewayConnectionStatusreasons] = resourceVPNGatewayConnectionFlattenLifecycleReasons(data.StatusReasons) @@ -256,3 +346,117 @@ func dataSourceIBMVPNGatewayConnectionsRead(d *schema.ResourceData, meta interfa func dataSourceIBMVPNGatewayConnectionsID(d *schema.ResourceData) string { return time.Now().UTC().String() } + +func dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionStaticRouteModeLocalToMap(model *vpcv1.VPNGatewayConnectionStaticRouteModeLocal) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + ikeIdentities := []map[string]interface{}{} + for _, ikeIdentitiesItem := range model.IkeIdentities { + ikeIdentitiesItemMap, err := dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionIkeIdentityToMap(ikeIdentitiesItem) + if err != nil { + return modelMap, err + } + ikeIdentities = append(ikeIdentities, ikeIdentitiesItemMap) + } + modelMap["ike_identities"] = ikeIdentities + return modelMap, nil +} + +func dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionIkeIdentityToMap(model vpcv1.VPNGatewayConnectionIkeIdentityIntf) (map[string]interface{}, error) { + if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn); ok { + return dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnToMap(model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname); ok { + return dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameToMap(model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4); ok { + return dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4ToMap(model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID); ok { + return dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDToMap(model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentity); ok { + modelMap := make(map[string]interface{}) + model := model.(*vpcv1.VPNGatewayConnectionIkeIdentity) + modelMap["type"] = model.Type + if model.Value != nil { + modelMap["value"] = model.Value + } + return modelMap, nil + } else { + return nil, fmt.Errorf("Unrecognized vpcv1.VPNGatewayConnectionIkeIdentityIntf subtype encountered") + } +} + +func dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnToMap(model *vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["type"] = model.Type + modelMap["value"] = model.Value + return modelMap, nil +} + +func dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameToMap(model *vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["type"] = model.Type + modelMap["value"] = model.Value + return modelMap, nil +} + +func dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4ToMap(model *vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["type"] = model.Type + modelMap["value"] = model.Value + return modelMap, nil +} + +func dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDToMap(model *vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["type"] = model.Type + modelMap["value"] = string(*model.Value) + return modelMap, nil +} + +func dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionStaticRouteModePeerToMap(model vpcv1.VPNGatewayConnectionStaticRouteModePeerIntf) (map[string]interface{}, error) { + if _, ok := model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress); ok { + return dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddressToMap(model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn); ok { + return dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdnToMap(model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer); ok { + modelMap := make(map[string]interface{}) + model := model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer) + ikeIdentityMap, err := dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionIkeIdentityToMap(model.IkeIdentity) + if err != nil { + return modelMap, err + } + modelMap["ike_identity"] = []map[string]interface{}{ikeIdentityMap} + modelMap["type"] = model.Type + if model.Address != nil { + modelMap["address"] = model.Address + } + if model.Fqdn != nil { + modelMap["fqdn"] = model.Fqdn + } + return modelMap, nil + } else { + return nil, fmt.Errorf("Unrecognized vpcv1.VPNGatewayConnectionStaticRouteModePeerIntf subtype encountered") + } +} + +func dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddressToMap(model *vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + ikeIdentityMap, err := dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionIkeIdentityToMap(model.IkeIdentity) + if err != nil { + return modelMap, err + } + modelMap["ike_identity"] = []map[string]interface{}{ikeIdentityMap} + modelMap["type"] = model.Type + modelMap["address"] = model.Address + return modelMap, nil +} + +func dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdnToMap(model *vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + ikeIdentityMap, err := dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionIkeIdentityToMap(model.IkeIdentity) + if err != nil { + return modelMap, err + } + modelMap["ike_identity"] = []map[string]interface{}{ikeIdentityMap} + modelMap["type"] = model.Type + modelMap["fqdn"] = model.Fqdn + return modelMap, nil +} diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go index edd346cae6..25c863d274 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go @@ -10,6 +10,7 @@ import ( "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" + "github.com/IBM/go-sdk-core/v5/core" "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -70,13 +71,94 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { ForceNew: true, Description: "VPN Gateway info", }, - - isVPNGatewayConnectionPeerAddress: { - Type: schema.TypeString, - Required: true, - Description: "VPN gateway connection peer address", + // Deprecated + // isVPNGatewayConnectionPeerAddress: { + // Type: schema.TypeString, + // Required: true, + // Description: "VPN gateway connection peer address", + // }, + + // new breaking changes + "establish_mode": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Default: "bidirectional", + ValidateFunc: validate.InvokeValidator("ibm_is_vpn_gateway_connection", "establish_mode"), + Description: "The establish mode of the VPN gateway connection:- `bidirectional`: Either side of the VPN gateway can initiate IKE protocol negotiations or rekeying processes.- `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway connection. Additionally, the peer is responsible for initiating the rekeying process after the connection is established. If rekeying does not occur, the VPN gateway connection will be brought down after its lifetime expires.", + }, + "local": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ike_identities": &schema.Schema{ + Type: schema.TypeList, + Required: true, + Description: "The local IKE identities.A VPN gateway in static route mode consists of two members in active-active mode. The first identity applies to the first member, and the second identity applies to the second member.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The IKE identity type.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected property value was encountered.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The IKE identity FQDN value.", + }, + }, + }, + }, + }, + }, + }, + "peer": &schema.Schema{ + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ike_identity": &schema.Schema{ + Type: schema.TypeList, + MinItems: 1, + MaxItems: 1, + Required: true, + Description: "The peer IKE identity.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The IKE identity type.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected property value was encountered.", + }, + "value": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The IKE identity FQDN value.", + }, + }, + }, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Indicates whether `peer.address` or `peer.fqdn` is used.", + }, + "address": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The IP address of the peer VPN gateway for this connection.", + }, + "fqdn": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Description: "The FQDN of the peer VPN gateway for this connection.", + }, + }, + }, }, - isVPNGatewayConnectionPreSharedKey: { Type: schema.TypeString, Required: true, @@ -89,24 +171,24 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { Default: false, Description: "VPN gateway connection admin state", }, - - isVPNGatewayConnectionLocalCIDRS: { - Type: schema.TypeSet, - Optional: true, - ForceNew: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, - Description: "VPN gateway connection local CIDRs", - }, - - isVPNGatewayConnectionPeerCIDRS: { - Type: schema.TypeSet, - Optional: true, - ForceNew: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, - Description: "VPN gateway connection peer CIDRs", - }, + // deprecated + // isVPNGatewayConnectionLocalCIDRS: { + // Type: schema.TypeSet, + // Optional: true, + // ForceNew: true, + // Elem: &schema.Schema{Type: schema.TypeString}, + // Set: schema.HashString, + // Description: "VPN gateway connection local CIDRs", + // }, + // deprecated + // isVPNGatewayConnectionPeerCIDRS: { + // Type: schema.TypeSet, + // Optional: true, + // ForceNew: true, + // Elem: &schema.Schema{Type: schema.TypeString}, + // Set: schema.HashString, + // Description: "VPN gateway connection peer CIDRs", + // }, isVPNGatewayConnectionDeadPeerDetectionAction: { Type: schema.TypeString, @@ -243,7 +325,19 @@ func ResourceIBMISVPNGatewayConnectionValidator() *validate.ResourceValidator { Required: true, Regexp: `^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$`, MinValueLength: 1, - MaxValueLength: 63}) + MaxValueLength: 63, + }, + validate.ValidateSchema{ + Identifier: "establish_mode", + ValidateFunctionIdentifier: validate.ValidateAllowedStringValue, + Type: validate.TypeString, + Optional: true, + AllowedValues: "bidirectional, peer_only", + Regexp: `^[a-z][a-z0-9]*(_[a-z0-9]+)*$`, + MinValueLength: 1, + MaxValueLength: 128, + }, + ) validateSchema = append(validateSchema, validate.ValidateSchema{ @@ -316,7 +410,7 @@ func vpngwconCreate(d *schema.ResourceData, meta interface{}, name, gatewayID, p } vpnGatewayConnectionPrototypeModel := &vpcv1.VPNGatewayConnectionPrototype{ - PeerAddress: &peerAddress, + // PeerAddress: &peerAddress, Psk: &prephasedKey, AdminStateUp: &stateUp, DeadPeerDetection: &vpcv1.VPNGatewayConnectionDpdPrototype{ @@ -331,16 +425,35 @@ func vpngwconCreate(d *schema.ResourceData, meta interface{}, name, gatewayID, p VPNGatewayConnectionPrototype: vpnGatewayConnectionPrototypeModel, } - if _, ok := d.GetOk(isVPNGatewayConnectionLocalCIDRS); ok { - localCidrs := flex.ExpandStringList((d.Get(isVPNGatewayConnectionLocalCIDRS).(*schema.Set)).List()) - vpnGatewayConnectionPrototypeModel.LocalCIDRs = localCidrs - } - if _, ok := d.GetOk(isVPNGatewayConnectionPeerCIDRS); ok { - peerCidrs := flex.ExpandStringList((d.Get(isVPNGatewayConnectionPeerCIDRS).(*schema.Set)).List()) - vpnGatewayConnectionPrototypeModel.PeerCIDRs = peerCidrs - } + // if _, ok := d.GetOk(isVPNGatewayConnectionLocalCIDRS); ok { + // localCidrs := flex.ExpandStringList((d.Get(isVPNGatewayConnectionLocalCIDRS).(*schema.Set)).List()) + // vpnGatewayConnectionPrototypeModel.LocalCIDRs = localCidrs + // } + // if _, ok := d.GetOk(isVPNGatewayConnectionPeerCIDRS); ok { + // peerCidrs := flex.ExpandStringList((d.Get(isVPNGatewayConnectionPeerCIDRS).(*schema.Set)).List()) + // vpnGatewayConnectionPrototypeModel.PeerCIDRs = peerCidrs + // } var ikePolicyIdentity, ipsecPolicyIdentity string + // new breaking changes + if establishModeOk, ok := d.GetOk("establish_mode"); ok { + vpnGatewayConnectionPrototypeModel.EstablishMode = core.StringPtr(establishModeOk.(string)) + } + + if localOk, ok := d.GetOk("local"); ok && len(localOk.([]interface{})) > 0 { + LocalModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionStaticRouteModeLocalPrototype(localOk.([]interface{})[0].(map[string]interface{})) + if err != nil { + return err + } + vpnGatewayConnectionPrototypeModel.Local = LocalModel + } + if peerOk, ok := d.GetOk("peer"); ok && len(peerOk.([]interface{})) > 0 { + PeerModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionStaticRouteModePeerPrototype(peerOk.([]interface{})[0].(map[string]interface{})) + if err != nil { + return err + } + vpnGatewayConnectionPrototypeModel.Peer = PeerModel + } if ikePolicy, ok := d.GetOk(isVPNGatewayConnectionIKEPolicy); ok { ikePolicyIdentity = ikePolicy.(string) @@ -408,14 +521,39 @@ func vpngwconGet(d *schema.ResourceData, meta interface{}, gID, gConnID string) d.Set(isVPNGatewayConnectionName, *vpnGatewayConnection.Name) d.Set(isVPNGatewayConnectionVPNGateway, gID) d.Set(isVPNGatewayConnectionAdminStateup, *vpnGatewayConnection.AdminStateUp) - d.Set(isVPNGatewayConnectionPeerAddress, *vpnGatewayConnection.PeerAddress) + // d.Set(isVPNGatewayConnectionPeerAddress, *vpnGatewayConnection.PeerAddress) d.Set(isVPNGatewayConnectionPreSharedKey, *vpnGatewayConnection.Psk) - if vpnGatewayConnection.LocalCIDRs != nil { - d.Set(isVPNGatewayConnectionLocalCIDRS, flex.FlattenStringList(vpnGatewayConnection.LocalCIDRs)) + // if vpnGatewayConnection.LocalCIDRs != nil { + // d.Set(isVPNGatewayConnectionLocalCIDRS, flex.FlattenStringList(vpnGatewayConnection.LocalCIDRs)) + // } + // if vpnGatewayConnection.PeerCIDRs != nil { + // d.Set(isVPNGatewayConnectionPeerCIDRS, flex.FlattenStringList(vpnGatewayConnection.PeerCIDRs)) + // } + + // new breaking changes + if !core.IsNil(vpnGatewayConnection.EstablishMode) { + if err = d.Set("establish_mode", vpnGatewayConnection.EstablishMode); err != nil { + return fmt.Errorf("Error setting establish_mode: %s", err) + } } - if vpnGatewayConnection.PeerCIDRs != nil { - d.Set(isVPNGatewayConnectionPeerCIDRS, flex.FlattenStringList(vpnGatewayConnection.PeerCIDRs)) + if !core.IsNil(vpnGatewayConnection.Local) { + localMap, err := resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(vpnGatewayConnection.Local) + if err != nil { + return (err) + } + if err = d.Set("local", []map[string]interface{}{localMap}); err != nil { + return fmt.Errorf("Error setting local: %s", err) + } + } + if !core.IsNil(vpnGatewayConnection.Peer) { + peerMap, err := resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(vpnGatewayConnection.Peer) + if err != nil { + return (err) + } + if err = d.Set("peer", []map[string]interface{}{peerMap}); err != nil { + return fmt.Errorf("Error setting peer: %s", err) + } } if vpnGatewayConnection.IkePolicy != nil { d.Set(isVPNGatewayConnectionIKEPolicy, *vpnGatewayConnection.IkePolicy.ID) @@ -506,12 +644,24 @@ func vpngwconUpdate(d *schema.ResourceData, meta interface{}, gID, gConnID strin vpnGatewayConnectionPatchModel.Name = &name hasChanged = true } - - if d.HasChange(isVPNGatewayConnectionPeerAddress) { - peerAddress := d.Get(isVPNGatewayConnectionPeerAddress).(string) - vpnGatewayConnectionPatchModel.PeerAddress = &peerAddress + if d.HasChange("establish_mode") { + newEstablishMode := d.Get("establish_mode").(string) + vpnGatewayConnectionPatchModel.EstablishMode = &newEstablishMode + hasChanged = true + } + if d.HasChange("peer") { + peer, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionPeerPatch(d.Get("peer.0").(map[string]interface{})) + if err != nil { + return err + } + vpnGatewayConnectionPatchModel.Peer = peer hasChanged = true } + // if d.HasChange(isVPNGatewayConnectionPeerAddress) { + // peerAddress := d.Get(isVPNGatewayConnectionPeerAddress).(string) + // vpnGatewayConnectionPatchModel.PeerAddress = &peerAddress + // hasChanged = true + // } if d.HasChange(isVPNGatewayConnectionPreSharedKey) { psk := d.Get(isVPNGatewayConnectionPreSharedKey).(string) @@ -720,3 +870,172 @@ func resourceVPNGatewayConnectionFlattenLifecycleReasons(statusReasons []vpcv1.V } return statusReasonsList } + +// helper functions + +func resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionStaticRouteModeLocalPrototype(modelMap map[string]interface{}) (*vpcv1.VPNGatewayConnectionStaticRouteModeLocalPrototype, error) { + model := &vpcv1.VPNGatewayConnectionStaticRouteModeLocalPrototype{} + if modelMap["ike_identities"] != nil { + ikeIdentities := []vpcv1.VPNGatewayConnectionIkeIdentityPrototypeIntf{} + for _, ikeIdentitiesItem := range modelMap["ike_identities"].([]interface{}) { + ikeIdentitiesItemModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionIkeIdentityPrototype(ikeIdentitiesItem.(map[string]interface{})) + if err != nil { + return model, err + } + ikeIdentities = append(ikeIdentities, ikeIdentitiesItemModel) + } + model.IkeIdentities = ikeIdentities + } + return model, nil +} + +func resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionIkeIdentityPrototype(modelMap map[string]interface{}) (vpcv1.VPNGatewayConnectionIkeIdentityPrototypeIntf, error) { + model := &vpcv1.VPNGatewayConnectionIkeIdentityPrototype{} + model.Type = core.StringPtr(modelMap["type"].(string)) + if modelMap["value"] != nil && modelMap["value"].(string) != "" { + model.Value = core.StringPtr(modelMap["value"].(string)) + } + return model, nil +} + +func resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionStaticRouteModePeerPrototype(modelMap map[string]interface{}) (vpcv1.VPNGatewayConnectionStaticRouteModePeerPrototypeIntf, error) { + model := &vpcv1.VPNGatewayConnectionStaticRouteModePeerPrototype{} + if modelMap["ike_identity"] != nil && len(modelMap["ike_identity"].([]interface{})) > 0 { + IkeIdentityModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionIkeIdentityPrototype(modelMap["ike_identity"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.IkeIdentity = IkeIdentityModel + } + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["fqdn"] != nil && modelMap["fqdn"].(string) != "" { + model.Fqdn = core.StringPtr(modelMap["fqdn"].(string)) + } + return model, nil +} + +func resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionPeerPatch(modelMap map[string]interface{}) (vpcv1.VPNGatewayConnectionPeerPatchIntf, error) { + model := &vpcv1.VPNGatewayConnectionPeerPatch{} + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["fqdn"] != nil && modelMap["fqdn"].(string) != "" { + model.Fqdn = core.StringPtr(modelMap["fqdn"].(string)) + } + return model, nil +} +func resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(model *vpcv1.VPNGatewayConnectionStaticRouteModeLocal) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + ikeIdentities := []map[string]interface{}{} + for _, ikeIdentitiesItem := range model.IkeIdentities { + ikeIdentitiesItemMap, err := resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(ikeIdentitiesItem) + if err != nil { + return modelMap, err + } + ikeIdentities = append(ikeIdentities, ikeIdentitiesItemMap) + } + modelMap["ike_identities"] = ikeIdentities + return modelMap, nil +} + +func resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(model vpcv1.VPNGatewayConnectionIkeIdentityIntf) (map[string]interface{}, error) { + if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn); ok { + return resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnToMap(model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname); ok { + return resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameToMap(model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4); ok { + return resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4ToMap(model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID); ok { + return resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDToMap(model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentity); ok { + modelMap := make(map[string]interface{}) + model := model.(*vpcv1.VPNGatewayConnectionIkeIdentity) + modelMap["type"] = model.Type + if model.Value != nil { + modelMap["value"] = model.Value + } + return modelMap, nil + } else { + return nil, fmt.Errorf("Unrecognized vpcv1.VPNGatewayConnectionIkeIdentityIntf subtype encountered") + } +} + +func resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnToMap(model *vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["type"] = model.Type + modelMap["value"] = model.Value + return modelMap, nil +} + +func resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameToMap(model *vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["type"] = model.Type + modelMap["value"] = model.Value + return modelMap, nil +} + +func resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4ToMap(model *vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["type"] = model.Type + modelMap["value"] = model.Value + return modelMap, nil +} + +func resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDToMap(model *vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["type"] = model.Type + modelMap["value"] = string(*model.Value) + return modelMap, nil +} + +func resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(model vpcv1.VPNGatewayConnectionStaticRouteModePeerIntf) (map[string]interface{}, error) { + if _, ok := model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress); ok { + return resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddressToMap(model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn); ok { + return resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdnToMap(model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer); ok { + modelMap := make(map[string]interface{}) + model := model.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer) + ikeIdentityMap, err := resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(model.IkeIdentity) + if err != nil { + return modelMap, err + } + modelMap["ike_identity"] = []map[string]interface{}{ikeIdentityMap} + modelMap["type"] = model.Type + if model.Address != nil { + modelMap["address"] = model.Address + } + if model.Fqdn != nil { + modelMap["fqdn"] = model.Fqdn + } + return modelMap, nil + } else { + return nil, fmt.Errorf("Unrecognized vpcv1.VPNGatewayConnectionStaticRouteModePeerIntf subtype encountered") + } +} + +func resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddressToMap(model *vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + ikeIdentityMap, err := resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(model.IkeIdentity) + if err != nil { + return modelMap, err + } + modelMap["ike_identity"] = []map[string]interface{}{ikeIdentityMap} + modelMap["type"] = model.Type + modelMap["address"] = model.Address + return modelMap, nil +} + +func resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdnToMap(model *vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + ikeIdentityMap, err := resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(model.IkeIdentity) + if err != nil { + return modelMap, err + } + modelMap["ike_identity"] = []map[string]interface{}{ikeIdentityMap} + modelMap["type"] = model.Type + modelMap["fqdn"] = model.Fqdn + return modelMap, nil +} diff --git a/website/docs/d/is_vpn_gateway_connection.html.markdown b/website/docs/d/is_vpn_gateway_connection.html.markdown index afcd61392d..6efcd12834 100644 --- a/website/docs/d/is_vpn_gateway_connection.html.markdown +++ b/website/docs/d/is_vpn_gateway_connection.html.markdown @@ -59,6 +59,8 @@ In addition to all argument references listed, you can access the following attr - `interval` - (Integer) Dead Peer Detection interval in seconds. - `timeout` - (Integer) Dead Peer Detection timeout in seconds. Must be at least the interval. +- `establish_mode` - (String) The establish mode of the VPN gateway connection:- `bidirectional`: Either side of the VPN gateway can initiate IKE protocol negotiations or rekeying processes.- `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway connection. Additionally, the peer is responsible for initiating the rekeying process after the connection is established. If rekeying does not occur, the VPN gateway connection will be brought down after its lifetime expires. + - `href` - (String) The VPN connection's canonical URL. - `ike_policy` - (List) The IKE policy. If absent, [auto-negotiation isused](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). @@ -83,10 +85,27 @@ In addition to all argument references listed, you can access the following attr - `local_cidrs` - (List) The local CIDRs for this resource. +- `local` - (List) + Nested schema for **local**: + - `ike_identities` - (List) The local IKE identities.A VPN gateway in static route mode consists of two members in active-active mode. The first identity applies to the first member, and the second identity applies to the second member. + Nested schema for **ike_identities**: + - `type` - (String) The IKE identity type.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected property value was encountered. + - `value` - (String) The IKE identity FQDN value. + - `mode` - (String) The mode of the VPN gateway. - `name` - (String) The user-defined name for this VPN gateway connection. +- `peer` - (List) + Nested schema for **peer**: + - `address` - (String) The IP address of the peer VPN gateway for this connection. + - `fqdn` - (String) The FQDN of the peer VPN gateway for this connection. + - `ike_identity` - (List) The peer IKE identity. + Nested schema for **ike_identity**: + - `type` - (String) The IKE identity type.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected property value was encountered. + - `value` - (String) The IKE identity FQDN value. + - `type` - (String) Indicates whether `peer.address` or `peer.fqdn` is used. + - `peer_address` - (String) The IP address of the peer VPN gateway. - `peer_cidrs` - (List) The peer CIDRs for this resource. diff --git a/website/docs/d/is_vpn_gateway_connection_local_cidrs.html.markdown b/website/docs/d/is_vpn_gateway_connection_local_cidrs.html.markdown new file mode 100644 index 0000000000..bde4ea890e --- /dev/null +++ b/website/docs/d/is_vpn_gateway_connection_local_cidrs.html.markdown @@ -0,0 +1,35 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_is_vpn_gateway_connection_local_cidrs" +description: |- + Get information about VPNGatewayConnectionCIDRs +subcategory: "VPC infrastructure" +--- + +# ibm_is_vpn_gateway_connection_local_cidrs + +Provides a read-only data source to retrieve information about VPNGatewayConnectionCIDRs. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```terraform +data "ibm_is_vpn_gateway_connection_local_cidrs" "is_vpn_gateway_connection_cidrs" { + vpn_gateway_connection = "vpn_gateway_connection" + vpn_gateway = "vpn_gateway" +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +- `vpn_gateway_connection` - (Required, Forces new resource, String) The VPN gateway connection identifier. +- `vpn_gateway` - (Required, Forces new resource, String) The VPN gateway identifier. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +- `id` - The unique identifier of the VPNGatewayConnectionCIDRs. +- `cidrs` - (List) The CIDRs for this resource. + diff --git a/website/docs/d/is_vpn_gateway_connection_peer_cidrs.html.markdown b/website/docs/d/is_vpn_gateway_connection_peer_cidrs.html.markdown new file mode 100644 index 0000000000..43227e36e9 --- /dev/null +++ b/website/docs/d/is_vpn_gateway_connection_peer_cidrs.html.markdown @@ -0,0 +1,35 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_is_vpn_gateway_connection_peer_cidrs" +description: |- + Get information about VPNGatewayConnectionCIDRs +subcategory: "VPC infrastructure" +--- + +# ibm_is_vpn_gateway_connection_peer_cidrs + +Provides a read-only data source to retrieve information about VPNGatewayConnectionCIDRs. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```terraform +data "ibm_is_vpn_gateway_connection_peer_cidrs" "is_vpn_gateway_connection_cidrs" { + vpn_gateway_connection = "vpn_gateway_connection" + vpn_gateway = "vpn_gateway" +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +- `vpn_gateway_connection` - (Required, Forces new resource, String) The VPN gateway connection identifier. +- `vpn_gateway` - (Required, Forces new resource, String) The VPN gateway identifier. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +- `id` - The unique identifier of the VPNGatewayConnectionCIDRs. +- `cidrs` - (List) The CIDRs for this resource. + diff --git a/website/docs/d/is_vpn_gateway_connections.html.markdown b/website/docs/d/is_vpn_gateway_connections.html.markdown index 28e1187ca3..4c91768a47 100644 --- a/website/docs/d/is_vpn_gateway_connections.html.markdown +++ b/website/docs/d/is_vpn_gateway_connections.html.markdown @@ -43,13 +43,30 @@ In addition to all argument reference list, you can access the following attribu - `admin_state_up` - (String) The VPN gateway connection admin state. Default value is **true**. - `authentication_mode` - (String) The authentication mode. - `created_at`- (Timestamp) The date and time the VPN gateway connection was created. +- `establish_mode` - (String) The establish mode of the VPN gateway connection:- `bidirectional`: Either side of the VPN gateway can initiate IKE protocol negotiations or rekeying processes.- `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway connection. Additionally, the peer is responsible for initiating the rekeying process after the connection is established. If rekeying does not occur, the VPN gateway connection will be brought down after its lifetime expires. - `id` - (String) The ID of the VPN gateway connection. - `ike_policy` - (String) The VPN gateway connection IKE Policy. - `interval`- (String) Interval for dead peer detection. - `ipsec_policy` - (String) The IP security policy VPN gateway connection. +- `local` - (List) + Nested schema for **local**: + - `ike_identities` - (List) The local IKE identities.A VPN gateway in static route mode consists of two members in active-active mode. The first identity applies to the first member, and the second identity applies to the second member. + Nested schema for **ike_identities**: + - `type` - (String) The IKE identity type.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected property value was encountered. + - `value` - (String) The IKE identity FQDN value. - `local_cidrs` - (String) The VPN gateway connection local CIDRs. - `mode` - (String) The mode of the VPN gateway. - `name`- (String) The VPN gateway connection name. +- `peer` - (List) + Nested schema for **peer**: + - `address` - (String) The IP address of the peer VPN gateway for this connection. + - `fqdn` - (String) The FQDN of the peer VPN gateway for this connection. + - `ike_identity` - (List) The peer IKE identity. + Nested schema for **ike_identity**: + - `type` - (String) The IKE identity type.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected property value was encountered. + - `value` - (String) The IKE identity FQDN value. + - `type` - (String) Indicates whether `peer.address` or `peer.fqdn` is used. + - `peer_address` - (String) The VPN gateway connection peer address. - `peer_cidrs` - (String) The VPN gateway connection peer CIDRs. - `resource_type` - (String) The resource type. diff --git a/website/docs/r/is_vpn_gateway_connection.html.markdown b/website/docs/r/is_vpn_gateway_connection.html.markdown index dc50846d40..7e018672e9 100644 --- a/website/docs/r/is_vpn_gateway_connection.html.markdown +++ b/website/docs/r/is_vpn_gateway_connection.html.markdown @@ -92,11 +92,28 @@ Review the argument references that you can specify for your resource. - `action` - (Optional, String) Dead peer detection actions. Supported values are **restart**, **clear**, **hold**, or **none**. Default value is `restart`. - `admin_state_up` - (Optional, Bool) The VPN gateway connection status. Default value is **false**. If set to false, the VPN gateway connection is shut down. +- `establish_mode` - (Optional, String) The establish mode of the VPN gateway connection:- `bidirectional`: Either side of the VPN gateway can initiate IKE protocol negotiations or rekeying processes.- `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway connection. Additionally, the peer is responsible for initiating the rekeying process after the connection is established. If rekeying does not occur, the VPN gateway connection will be brought down after its lifetime expires. - `ike_policy` - (Optional, String) The ID of the IKE policy. Updating value from ID to `""` or making it `null` or removing it will remove the existing policy. - `interval` - (Optional, Integer) Dead peer detection interval in seconds. Default value is 2. - `ipsec_policy` - (Optional, String) The ID of the IPSec policy. Updating value from ID to `""` or making it `null` or removing it will remove the existing policy. +- `local` - (Optional, List) + Nested schema for **local**: + - `ike_identities` - (Required, List) The local IKE identities.A VPN gateway in static route mode consists of two members in active-active mode. The first identity applies to the first member, and the second identity applies to the second member. + Nested schema for **ike_identities**: + - `type` - (Required, String) The IKE identity type.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected property value was encountered. + - `value` - (Optional, String) The IKE identity FQDN value. - `local_cidrs` - (Optional, Forces new resource, List) List of local CIDRs for this resource. - `name` - (Required, String) The name of the VPN gateway connection. +- `peer` - (Optional, List) + Nested schema for **peer**: + - `address` - (Optional, String) The IP address of the peer VPN gateway for this connection. + - `fqdn` - (Optional, String) The FQDN of the peer VPN gateway for this connection. + - `ike_identity` - (Required, List) The peer IKE identity. + Nested schema for **ike_identity**: + - `type` - (Required, String) The IKE identity type.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected property value was encountered. + - `value` - (Optional, String) The IKE identity FQDN value. + - `type` - (Computed, String) Indicates whether `peer.address` or `peer.fqdn` is used. + - `peer_cidrs` - (Optional, Forces new resource, List) List of peer CIDRs for this resource. - `peer_address` - (Required, String) The IP address of the peer VPN gateway. - `preshared_key` - (Required, Forces new resource, String) The preshared key. From 38b7e55250d9e888e68e5c9c2d519272aed358f0 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 7 Mar 2024 11:10:25 +0530 Subject: [PATCH 058/103] Update resource_ibm_is_vpn_gateway_connections.go --- ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go index 25c863d274..43889a305b 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go @@ -124,7 +124,8 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { Type: schema.TypeList, MinItems: 1, MaxItems: 1, - Required: true, + Optional: true, + Computed: true, Description: "The peer IKE identity.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -370,7 +371,7 @@ func resourceIBMISVPNGatewayConnectionCreate(d *schema.ResourceData, meta interf log.Printf("[DEBUG] VPNGatewayConnection create") name := d.Get(isVPNGatewayConnectionName).(string) gatewayID := d.Get(isVPNGatewayConnectionVPNGateway).(string) - peerAddress := d.Get(isVPNGatewayConnectionPeerAddress).(string) + // peerAddress := d.Get(isVPNGatewayConnectionPeerAddress).(string) prephasedKey := d.Get(isVPNGatewayConnectionPreSharedKey).(string) stateUp := false @@ -396,7 +397,7 @@ func resourceIBMISVPNGatewayConnectionCreate(d *schema.ResourceData, meta interf action = "none" } - err := vpngwconCreate(d, meta, name, gatewayID, peerAddress, prephasedKey, action, interval, timeout, stateUp) + err := vpngwconCreate(d, meta, name, gatewayID, "peerAddress", prephasedKey, action, interval, timeout, stateUp) if err != nil { return err } From c09ce161ed4b672a33732d76e46bda9ed594b642 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 7 Mar 2024 12:23:27 +0530 Subject: [PATCH 059/103] some changes --- examples/ibm-is-ng/main.tf | 22 +++++- examples/ibm-is-ng/provider.tf | 4 +- ibm/provider/provider.go | 120 +++++++++++++++++---------------- 3 files changed, 82 insertions(+), 64 deletions(-) diff --git a/examples/ibm-is-ng/main.tf b/examples/ibm-is-ng/main.tf index 4f76a8a39b..5882720865 100644 --- a/examples/ibm-is-ng/main.tf +++ b/examples/ibm-is-ng/main.tf @@ -199,8 +199,9 @@ resource "ibm_is_vpn_gateway" "VPNGateway1" { subnet = ibm_is_subnet.subnet1.id } -resource "ibm_is_vpn_gateway_connection" "VPNGatewayConnection1" { - name = "vpnconn1" +// Deprecated: peer_address, local_cidrs, peer_cidrs +resource "ibm_is_vpn_gateway_connection" "VPNGatewayConnection1_deprecated" { + name = "vpnconn1-deprecated" vpn_gateway = ibm_is_vpn_gateway.VPNGateway1.id peer_address = ibm_is_vpn_gateway.VPNGateway1.public_ip_address preshared_key = "VPNDemoPassword" @@ -209,6 +210,21 @@ resource "ibm_is_vpn_gateway_connection" "VPNGatewayConnection1" { ipsec_policy = ibm_is_ipsec_policy.example.id } +resource "ibm_is_vpn_gateway_connection" "VPNGatewayConnection1" { + name = "vpnconn1" + vpn_gateway = ibm_is_vpn_gateway.VPNGateway1.id + peer_address = ibm_is_vpn_gateway.VPNGateway1.public_ip_address + preshared_key = "VPNDemoPassword" + peer { + address = ibm_is_vpn_gateway.testacc_VPNGateway1.public_ip_address != "0.0.0.0" ? ibm_is_vpn_gateway.testacc_VPNGateway1.public_ip_address : ibm_is_vpn_gateway.testacc_VPNGateway1.public_ip_address2 + peer_cidrs = [ibm_is_subnet.subnet2.ipv4_cidr_block] + } + local { + cidrs = [ibm_is_subnet.subnet1.ipv4_cidr_block] + } + ipsec_policy = ibm_is_ipsec_policy.example.id +} + resource "ibm_is_ssh_key" "sshkey" { name = "ssh1" public_key = file(var.ssh_public_key) @@ -1592,7 +1608,7 @@ resource "ibm_is_reservation" "example" { term = "one_year" } profile { - name = "ba2-2x8" + name = "ba2-2x8" resource_type = "instance_profile" } zone = "us-east-3" diff --git a/examples/ibm-is-ng/provider.tf b/examples/ibm-is-ng/provider.tf index 42d39ae11d..95cd367ef9 100644 --- a/examples/ibm-is-ng/provider.tf +++ b/examples/ibm-is-ng/provider.tf @@ -3,7 +3,7 @@ variable "ibmcloud_api_key" { } provider "ibm" { - ibmcloud_api_key = var.ibmcloud_api_key - region = "us-south" + ibmcloud_api_key = var.ibmcloud_api_key + region = "us-south" } diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index 5f111c505d..553f3a3984 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -509,65 +509,67 @@ func Provider() *schema.Provider { "ibm_is_virtual_network_interface_ip": vpc.DataSourceIBMIsVirtualNetworkInterfaceIP(), "ibm_is_virtual_network_interface_ips": vpc.DataSourceIBMIsVirtualNetworkInterfaceIPs(), - "ibm_is_share_mount_target": vpc.DataSourceIBMIsShareTarget(), - "ibm_is_share_mount_targets": vpc.DataSourceIBMIsShareTargets(), - "ibm_is_volume": vpc.DataSourceIBMISVolume(), - "ibm_is_volumes": vpc.DataSourceIBMIsVolumes(), - "ibm_is_volume_profile": vpc.DataSourceIBMISVolumeProfile(), - "ibm_is_volume_profiles": vpc.DataSourceIBMISVolumeProfiles(), - "ibm_is_vpc": vpc.DataSourceIBMISVPC(), - "ibm_is_vpc_dns_resolution_binding": vpc.DataSourceIBMIsVPCDnsResolutionBinding(), - "ibm_is_vpc_dns_resolution_bindings": vpc.DataSourceIBMIsVPCDnsResolutionBindings(), - "ibm_is_vpcs": vpc.DataSourceIBMISVPCs(), - "ibm_is_vpn_gateway": vpc.DataSourceIBMISVPNGateway(), - "ibm_is_vpn_gateways": vpc.DataSourceIBMISVPNGateways(), - "ibm_is_vpc_address_prefixes": vpc.DataSourceIbmIsVpcAddressPrefixes(), - "ibm_is_vpc_address_prefix": vpc.DataSourceIBMIsVPCAddressPrefix(), - "ibm_is_vpn_gateway_connection": vpc.DataSourceIBMISVPNGatewayConnection(), - "ibm_is_vpn_gateway_connections": vpc.DataSourceIBMISVPNGatewayConnections(), - "ibm_is_vpc_default_routing_table": vpc.DataSourceIBMISVPCDefaultRoutingTable(), - "ibm_is_vpc_routing_table": vpc.DataSourceIBMIBMIsVPCRoutingTable(), - "ibm_is_vpc_routing_tables": vpc.DataSourceIBMISVPCRoutingTables(), - "ibm_is_vpc_routing_table_route": vpc.DataSourceIBMIBMIsVPCRoutingTableRoute(), - "ibm_is_vpc_routing_table_routes": vpc.DataSourceIBMISVPCRoutingTableRoutes(), - "ibm_is_vpn_server": vpc.DataSourceIBMIsVPNServer(), - "ibm_is_vpn_servers": vpc.DataSourceIBMIsVPNServers(), - "ibm_is_vpn_server_client": vpc.DataSourceIBMIsVPNServerClient(), - "ibm_is_vpn_server_client_configuration": vpc.DataSourceIBMIsVPNServerClientConfiguration(), - "ibm_is_vpn_server_clients": vpc.DataSourceIBMIsVPNServerClients(), - "ibm_is_vpn_server_route": vpc.DataSourceIBMIsVPNServerRoute(), - "ibm_is_vpn_server_routes": vpc.DataSourceIBMIsVPNServerRoutes(), - "ibm_is_zone": vpc.DataSourceIBMISZone(), - "ibm_is_zones": vpc.DataSourceIBMISZones(), - "ibm_is_operating_system": vpc.DataSourceIBMISOperatingSystem(), - "ibm_is_operating_systems": vpc.DataSourceIBMISOperatingSystems(), - "ibm_is_network_acls": vpc.DataSourceIBMIsNetworkAcls(), - "ibm_is_network_acl": vpc.DataSourceIBMIsNetworkACL(), - "ibm_is_network_acl_rule": vpc.DataSourceIBMISNetworkACLRule(), - "ibm_is_network_acl_rules": vpc.DataSourceIBMISNetworkACLRules(), - "ibm_lbaas": classicinfrastructure.DataSourceIBMLbaas(), - "ibm_network_vlan": classicinfrastructure.DataSourceIBMNetworkVlan(), - "ibm_org": cloudfoundry.DataSourceIBMOrg(), - "ibm_org_quota": cloudfoundry.DataSourceIBMOrgQuota(), - "ibm_kms_instance_policies": kms.DataSourceIBMKmsInstancePolicies(), - "ibm_kp_key": kms.DataSourceIBMkey(), - "ibm_kms_key_rings": kms.DataSourceIBMKMSkeyRings(), - "ibm_kms_key_policies": kms.DataSourceIBMKMSkeyPolicies(), - "ibm_kms_keys": kms.DataSourceIBMKMSkeys(), - "ibm_kms_key": kms.DataSourceIBMKMSkey(), - "ibm_pn_application_chrome": pushnotification.DataSourceIBMPNApplicationChrome(), - "ibm_app_config_environment": appconfiguration.DataSourceIBMAppConfigEnvironment(), - "ibm_app_config_environments": appconfiguration.DataSourceIBMAppConfigEnvironments(), - "ibm_app_config_collection": appconfiguration.DataSourceIBMAppConfigCollection(), - "ibm_app_config_collections": appconfiguration.DataSourceIBMAppConfigCollections(), - "ibm_app_config_feature": appconfiguration.DataSourceIBMAppConfigFeature(), - "ibm_app_config_features": appconfiguration.DataSourceIBMAppConfigFeatures(), - "ibm_app_config_property": appconfiguration.DataSourceIBMAppConfigProperty(), - "ibm_app_config_properties": appconfiguration.DataSourceIBMAppConfigProperties(), - "ibm_app_config_segment": appconfiguration.DataSourceIBMAppConfigSegment(), - "ibm_app_config_segments": appconfiguration.DataSourceIBMAppConfigSegments(), - "ibm_app_config_snapshot": appconfiguration.DataSourceIBMAppConfigSnapshot(), - "ibm_app_config_snapshots": appconfiguration.DataSourceIBMAppConfigSnapshots(), + "ibm_is_share_mount_target": vpc.DataSourceIBMIsShareTarget(), + "ibm_is_share_mount_targets": vpc.DataSourceIBMIsShareTargets(), + "ibm_is_volume": vpc.DataSourceIBMISVolume(), + "ibm_is_volumes": vpc.DataSourceIBMIsVolumes(), + "ibm_is_volume_profile": vpc.DataSourceIBMISVolumeProfile(), + "ibm_is_volume_profiles": vpc.DataSourceIBMISVolumeProfiles(), + "ibm_is_vpc": vpc.DataSourceIBMISVPC(), + "ibm_is_vpc_dns_resolution_binding": vpc.DataSourceIBMIsVPCDnsResolutionBinding(), + "ibm_is_vpc_dns_resolution_bindings": vpc.DataSourceIBMIsVPCDnsResolutionBindings(), + "ibm_is_vpcs": vpc.DataSourceIBMISVPCs(), + "ibm_is_vpn_gateway": vpc.DataSourceIBMISVPNGateway(), + "ibm_is_vpn_gateways": vpc.DataSourceIBMISVPNGateways(), + "ibm_is_vpc_address_prefixes": vpc.DataSourceIbmIsVpcAddressPrefixes(), + "ibm_is_vpc_address_prefix": vpc.DataSourceIBMIsVPCAddressPrefix(), + "ibm_is_vpn_gateway_connection": vpc.DataSourceIBMISVPNGatewayConnection(), + "ibm_is_vpn_gateway_connections": vpc.DataSourceIBMISVPNGatewayConnections(), + "ibm_is_vpn_gateway_connection_local_cidrs": vpc.DataSourceIBMIsVPNGatewayConnectionLocalCidrs(), + "ibm_is_vpn_gateway_connection_peer_cidrs": vpc.DataSourceIBMIsVPNGatewayConnectionPeerCidrs(), + "ibm_is_vpc_default_routing_table": vpc.DataSourceIBMISVPCDefaultRoutingTable(), + "ibm_is_vpc_routing_table": vpc.DataSourceIBMIBMIsVPCRoutingTable(), + "ibm_is_vpc_routing_tables": vpc.DataSourceIBMISVPCRoutingTables(), + "ibm_is_vpc_routing_table_route": vpc.DataSourceIBMIBMIsVPCRoutingTableRoute(), + "ibm_is_vpc_routing_table_routes": vpc.DataSourceIBMISVPCRoutingTableRoutes(), + "ibm_is_vpn_server": vpc.DataSourceIBMIsVPNServer(), + "ibm_is_vpn_servers": vpc.DataSourceIBMIsVPNServers(), + "ibm_is_vpn_server_client": vpc.DataSourceIBMIsVPNServerClient(), + "ibm_is_vpn_server_client_configuration": vpc.DataSourceIBMIsVPNServerClientConfiguration(), + "ibm_is_vpn_server_clients": vpc.DataSourceIBMIsVPNServerClients(), + "ibm_is_vpn_server_route": vpc.DataSourceIBMIsVPNServerRoute(), + "ibm_is_vpn_server_routes": vpc.DataSourceIBMIsVPNServerRoutes(), + "ibm_is_zone": vpc.DataSourceIBMISZone(), + "ibm_is_zones": vpc.DataSourceIBMISZones(), + "ibm_is_operating_system": vpc.DataSourceIBMISOperatingSystem(), + "ibm_is_operating_systems": vpc.DataSourceIBMISOperatingSystems(), + "ibm_is_network_acls": vpc.DataSourceIBMIsNetworkAcls(), + "ibm_is_network_acl": vpc.DataSourceIBMIsNetworkACL(), + "ibm_is_network_acl_rule": vpc.DataSourceIBMISNetworkACLRule(), + "ibm_is_network_acl_rules": vpc.DataSourceIBMISNetworkACLRules(), + "ibm_lbaas": classicinfrastructure.DataSourceIBMLbaas(), + "ibm_network_vlan": classicinfrastructure.DataSourceIBMNetworkVlan(), + "ibm_org": cloudfoundry.DataSourceIBMOrg(), + "ibm_org_quota": cloudfoundry.DataSourceIBMOrgQuota(), + "ibm_kms_instance_policies": kms.DataSourceIBMKmsInstancePolicies(), + "ibm_kp_key": kms.DataSourceIBMkey(), + "ibm_kms_key_rings": kms.DataSourceIBMKMSkeyRings(), + "ibm_kms_key_policies": kms.DataSourceIBMKMSkeyPolicies(), + "ibm_kms_keys": kms.DataSourceIBMKMSkeys(), + "ibm_kms_key": kms.DataSourceIBMKMSkey(), + "ibm_pn_application_chrome": pushnotification.DataSourceIBMPNApplicationChrome(), + "ibm_app_config_environment": appconfiguration.DataSourceIBMAppConfigEnvironment(), + "ibm_app_config_environments": appconfiguration.DataSourceIBMAppConfigEnvironments(), + "ibm_app_config_collection": appconfiguration.DataSourceIBMAppConfigCollection(), + "ibm_app_config_collections": appconfiguration.DataSourceIBMAppConfigCollections(), + "ibm_app_config_feature": appconfiguration.DataSourceIBMAppConfigFeature(), + "ibm_app_config_features": appconfiguration.DataSourceIBMAppConfigFeatures(), + "ibm_app_config_property": appconfiguration.DataSourceIBMAppConfigProperty(), + "ibm_app_config_properties": appconfiguration.DataSourceIBMAppConfigProperties(), + "ibm_app_config_segment": appconfiguration.DataSourceIBMAppConfigSegment(), + "ibm_app_config_segments": appconfiguration.DataSourceIBMAppConfigSegments(), + "ibm_app_config_snapshot": appconfiguration.DataSourceIBMAppConfigSnapshot(), + "ibm_app_config_snapshots": appconfiguration.DataSourceIBMAppConfigSnapshots(), "ibm_resource_quota": resourcecontroller.DataSourceIBMResourceQuota(), "ibm_resource_group": resourcemanager.DataSourceIBMResourceGroup(), From bb59aaeabe07d100a4ffa0a5447fc13e914e6c56 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 8 Mar 2024 13:08:26 +0530 Subject: [PATCH 060/103] updated sdk --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 460 +++++++++++------- 1 file changed, 284 insertions(+), 176 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 1122c47ddc..e0606cfba6 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -35,15 +35,14 @@ import ( "github.com/go-openapi/strfmt" ) -// 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: 2023-12-05 - const ( YYYYMMDD = "2006-01-02" ) +// 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: 2023-12-05 type VpcV1 struct { Service *core.BaseService @@ -52,7 +51,7 @@ type VpcV1 struct { generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2024-03-06`. + // and `2024-03-08`. Version *string } @@ -69,7 +68,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2024-03-06`. + // and `2024-03-08`. Version *string } @@ -79493,7 +79492,7 @@ func UnmarshalVPNGatewayCollectionNext(m map[string]json.RawMessage, result inte // VPNGatewayConnection : VPNGatewayConnection struct // Models which "extend" this model: -// - VPNGatewayConnectionStaticRouteMode +// - VPNGatewayConnectionRouteMode // - VPNGatewayConnectionPolicyMode type VPNGatewayConnection struct { // If set to false, the VPN gateway connection is shut down. @@ -79633,84 +79632,24 @@ type VPNGatewayConnectionIntf interface { // UnmarshalVPNGatewayConnection unmarshals an instance of VPNGatewayConnection from the specified map of raw messages. func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnection) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) - if err != nil { - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocal) - if err != nil { - return - } - err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeer) + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "mode", &discValue) if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'mode': %s", err.Error()) return } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { + if discValue == "" { + err = fmt.Errorf("required discriminator property 'mode' not found in JSON object") return } - err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) - if err != nil { - return + if discValue == "policy" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionPolicyMode) + } else if discValue == "route" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteMode) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'mode': %s", discValue) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -107316,9 +107255,11 @@ func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePr return } -// VPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionStaticRouteMode struct +// VPNGatewayConnectionRouteMode : VPNGatewayConnectionRouteMode struct +// Models which "extend" this model: +// - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode // This model "extends" VPNGatewayConnection -type VPNGatewayConnectionStaticRouteMode struct { +type VPNGatewayConnectionRouteMode struct { // If set to false, the VPN gateway connection is shut down. AdminStateUp *bool `json:"admin_state_up" validate:"required"` @@ -107389,24 +107330,24 @@ type VPNGatewayConnectionStaticRouteMode struct { // unexpected reason code was encountered. StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` - Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local" validate:"required"` + Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local,omitempty"` - Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer" validate:"required"` + Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer,omitempty"` // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol" validate:"required"` + RoutingProtocol *string `json:"routing_protocol,omitempty"` // The VPN tunnel configuration for this VPN gateway connection (in static route mode). - Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels" validate:"required"` + Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels,omitempty"` } -// Constants associated with the VPNGatewayConnectionStaticRouteMode.AuthenticationMode property. +// Constants associated with the VPNGatewayConnectionRouteMode.AuthenticationMode property. // The authentication mode. Only `psk` is currently supported. const ( - VPNGatewayConnectionStaticRouteModeAuthenticationModePskConst = "psk" + VPNGatewayConnectionRouteModeAuthenticationModePskConst = "psk" ) -// Constants associated with the VPNGatewayConnectionStaticRouteMode.EstablishMode property. +// Constants associated with the VPNGatewayConnectionRouteMode.EstablishMode property. // The establish mode of the VPN gateway connection: // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol // negotiations or rekeying processes. @@ -107415,120 +107356,67 @@ const ( // after the connection is established. If rekeying does not occur, the VPN gateway // connection will be brought down after its lifetime expires. const ( - VPNGatewayConnectionStaticRouteModeEstablishModeBidirectionalConst = "bidirectional" - VPNGatewayConnectionStaticRouteModeEstablishModePeerOnlyConst = "peer_only" + VPNGatewayConnectionRouteModeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionRouteModeEstablishModePeerOnlyConst = "peer_only" ) -// Constants associated with the VPNGatewayConnectionStaticRouteMode.Mode property. +// Constants associated with the VPNGatewayConnectionRouteMode.Mode property. // The mode of the VPN gateway. const ( - VPNGatewayConnectionStaticRouteModeModePolicyConst = "policy" - VPNGatewayConnectionStaticRouteModeModeRouteConst = "route" + VPNGatewayConnectionRouteModeModePolicyConst = "policy" + VPNGatewayConnectionRouteModeModeRouteConst = "route" ) -// Constants associated with the VPNGatewayConnectionStaticRouteMode.ResourceType property. +// Constants associated with the VPNGatewayConnectionRouteMode.ResourceType property. // The resource type. const ( - VPNGatewayConnectionStaticRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" + VPNGatewayConnectionRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" ) -// Constants associated with the VPNGatewayConnectionStaticRouteMode.Status property. +// Constants associated with the VPNGatewayConnectionRouteMode.Status property. // The status of a VPN gateway connection. const ( - VPNGatewayConnectionStaticRouteModeStatusDownConst = "down" - VPNGatewayConnectionStaticRouteModeStatusUpConst = "up" + VPNGatewayConnectionRouteModeStatusDownConst = "down" + VPNGatewayConnectionRouteModeStatusUpConst = "up" ) -// Constants associated with the VPNGatewayConnectionStaticRouteMode.RoutingProtocol property. +// Constants associated with the VPNGatewayConnectionRouteMode.RoutingProtocol property. // Routing protocols are disabled for this VPN gateway connection. const ( - VPNGatewayConnectionStaticRouteModeRoutingProtocolNoneConst = "none" + VPNGatewayConnectionRouteModeRoutingProtocolNoneConst = "none" ) -func (*VPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnection() bool { +func (*VPNGatewayConnectionRouteMode) isaVPNGatewayConnectionRouteMode() bool { return true } -// UnmarshalVPNGatewayConnectionStaticRouteMode unmarshals an instance of VPNGatewayConnectionStaticRouteMode from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStaticRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStaticRouteMode) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) - if err != nil { - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocal) - if err != nil { - return - } - err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeer) +type VPNGatewayConnectionRouteModeIntf interface { + VPNGatewayConnectionIntf + isaVPNGatewayConnectionRouteMode() bool +} + +func (*VPNGatewayConnectionRouteMode) isaVPNGatewayConnection() bool { + return true +} + +// UnmarshalVPNGatewayConnectionRouteMode unmarshals an instance of VPNGatewayConnectionRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "routing_protocol", &discValue) if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'routing_protocol': %s", err.Error()) return } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { + if discValue == "" { + err = fmt.Errorf("required discriminator property 'routing_protocol' not found in JSON object") return } - err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) - if err != nil { - return + if discValue == "none" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'routing_protocol': %s", discValue) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -116876,6 +116764,226 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePe return } +// VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct +// This model "extends" VPNGatewayConnectionRouteMode +type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The IKE policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // The IPsec policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` + + // The pre-shared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // The reasons for the current VPN gateway connection status (if any): + // - `cannot_authenticate_connection`: Failed to authenticate a connection because of + // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) + // - `internal_error`: Internal error (contact IBM support) + // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check + // the IKE policies on both sides of the VPN) + // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and + // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE + // V1 configuration) + // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE + // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) + // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable + // (check the IPsec policies on both sides of the VPN) + // - `peer_not_responding`: No response from peer (check network ACL configuration, peer + // availability, and on-premise firewall configuration) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + + Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local" validate:"required"` + + Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol" validate:"required"` + + // The VPN tunnel configuration for this VPN gateway connection (in static route mode). + Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeEstablishModePeerOnlyConst = "peer_only" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeModePolicyConst = "policy" + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeStatusDownConst = "down" + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeStatusUpConst = "up" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnectionRouteMode() bool { + return true +} + +func (*VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnection() bool { + return true +} + +// UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode unmarshals an instance of VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocal) + if err != nil { + return + } + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct // This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct { From a55ea87c2e03bc42ff04c213e692c425e06c2469 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 8 Mar 2024 14:34:12 +0530 Subject: [PATCH 061/103] Added deprecation --- ...ta_source_ibm_is_vpn_gateway_connection.go | 520 +++++++++++++----- ...a_source_ibm_is_vpn_gateway_connections.go | 300 +++++++--- ...resource_ibm_is_vpn_gateway_connections.go | 231 ++++---- 3 files changed, 726 insertions(+), 325 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go index 38f60b39ca..7bda15c55d 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "log" + "reflect" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" @@ -261,11 +262,12 @@ func DataSourceIBMISVPNGatewayConnection() *schema.Resource { }, }, }, - // "peer_address": { - // Type: schema.TypeString, - // Computed: true, - // Description: "The IP address of the peer VPN gateway.", - // }, + "peer_address": { + Type: schema.TypeString, + Computed: true, + Description: "The IP address of the peer VPN gateway.", + Deprecated: "peer_address is deprecated, use peer instead", + }, "psk": { Type: schema.TypeString, Computed: true, @@ -329,22 +331,24 @@ func DataSourceIBMISVPNGatewayConnection() *schema.Resource { }, }, }, - // "local_cidrs": { - // Type: schema.TypeList, - // Computed: true, - // Description: "The local CIDRs for this resource.", - // Elem: &schema.Schema{ - // Type: schema.TypeString, - // }, - // }, - // "peer_cidrs": { - // Type: schema.TypeList, - // Computed: true, - // Description: "The peer CIDRs for this resource.", - // Elem: &schema.Schema{ - // Type: schema.TypeString, - // }, - // }, + "local_cidrs": { + Type: schema.TypeList, + Computed: true, + Description: "The local CIDRs for this resource.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Deprecated: "local_cidrs is deprecated, use local instead", + }, + "peer_cidrs": { + Type: schema.TypeList, + Computed: true, + Description: "The peer CIDRs for this resource.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Deprecated: "peer_cidrs is deprecated, use peer instead", + }, }, } } @@ -359,7 +363,7 @@ func dataSourceIBMIsVPNGatewayConnectionRead(context context.Context, d *schema. vpn_gateway_connection := d.Get("vpn_gateway_connection").(string) vpn_gateway_connection_name := d.Get("vpn_gateway_connection_name").(string) - vpnGatewayConnection := &vpcv1.VPNGatewayConnection{} + var vpnGatewayConnection vpcv1.VPNGatewayConnectionIntf if vpn_gateway_name != "" { listvpnGWOptions := vpcClient.NewListVPNGatewaysOptions() @@ -372,7 +376,7 @@ func dataSourceIBMIsVPNGatewayConnectionRead(context context.Context, d *schema. } availableVPNGateways, detail, err := vpcClient.ListVPNGatewaysWithContext(context, listvpnGWOptions) if err != nil || availableVPNGateways == nil { - return diag.FromErr(fmt.Errorf("Error reading list of VPN Gateways:%s\n%s", err, detail)) + return diag.FromErr(fmt.Errorf("[ERROR] Error reading list of VPN Gateways:%s\n%s", err, detail)) } start = flex.GetNext(availableVPNGateways.Next) allrecs = append(allrecs, availableVPNGateways.VPNGateways...) @@ -400,14 +404,14 @@ func dataSourceIBMIsVPNGatewayConnectionRead(context context.Context, d *schema. availableVPNGatewayConnections, detail, err := vpcClient.ListVPNGatewayConnections(listvpnGWConnectionOptions) if err != nil || availableVPNGatewayConnections == nil { - return diag.FromErr(fmt.Errorf("Error reading list of VPN Gateway Connections:%s\n%s", err, detail)) + return diag.FromErr(fmt.Errorf("[ERROR] Error reading list of VPN Gateway Connections:%s\n%s", err, detail)) } vpn_gateway_conn_found := false for _, connectionItem := range availableVPNGatewayConnections.Connections { connection := connectionItem.(*vpcv1.VPNGatewayConnection) if *connection.Name == vpn_gateway_connection_name { - vpnGatewayConnection = connection + vpnGatewayConnection = connectionItem vpn_gateway_conn_found = true break } @@ -426,118 +430,327 @@ func dataSourceIBMIsVPNGatewayConnectionRead(context context.Context, d *schema. log.Printf("[DEBUG] GetVPNGatewayConnectionWithContext failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("GetVPNGatewayConnectionWithContext failed %s\n%s", err, response)) } - vpnGatewayConnection = vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection) + vpnGatewayConnection = vpnGatewayConnectionIntf } - d.SetId(fmt.Sprintf("%s/%s", vpn_gateway_id, *vpnGatewayConnection.ID)) + setvpnGatewayConnectionIntfResourceData(d, vpn_gateway_id, vpnGatewayConnection) + return nil +} - if err = d.Set("admin_state_up", vpnGatewayConnection.AdminStateUp); err != nil { - return diag.FromErr(fmt.Errorf("Error setting admin_state_up: %s", err)) - } - if err = d.Set("authentication_mode", vpnGatewayConnection.AuthenticationMode); err != nil { - return diag.FromErr(fmt.Errorf("Error setting authentication_mode: %s", err)) - } - if err = d.Set("created_at", flex.DateTimeToString(vpnGatewayConnection.CreatedAt)); err != nil { - return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) - } +func setvpnGatewayConnectionIntfResourceData(d *schema.ResourceData, vpn_gateway_id string, vpnGatewayConnectionIntf vpcv1.VPNGatewayConnectionIntf) error { + var err error + switch reflect.TypeOf(vpnGatewayConnectionIntf).String() { + case "*vpcv1.VPNGatewayConnection": + { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection) + d.SetId(fmt.Sprintf("%s/%s", vpn_gateway_id, *vpnGatewayConnection.ID)) + if err = d.Set("admin_state_up", vpnGatewayConnection.AdminStateUp); err != nil { + return fmt.Errorf("[ERROR] Error setting admin_state_up: %s", err) + } + if err = d.Set("authentication_mode", vpnGatewayConnection.AuthenticationMode); err != nil { + return fmt.Errorf("[ERROR] Error setting authentication_mode: %s", err) + } + if err = d.Set("created_at", flex.DateTimeToString(vpnGatewayConnection.CreatedAt)); err != nil { + return fmt.Errorf("[ERROR] Error setting created_at: %s", err) + } - if vpnGatewayConnection.DeadPeerDetection != nil { - err = d.Set("dead_peer_detection", dataSourceVPNGatewayConnectionFlattenDeadPeerDetection(*vpnGatewayConnection.DeadPeerDetection)) - if err != nil { - return diag.FromErr(fmt.Errorf("Error setting dead_peer_detection %s", err)) - } - } - if err = d.Set("href", vpnGatewayConnection.Href); err != nil { - return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) - } + if vpnGatewayConnection.DeadPeerDetection != nil { + err = d.Set("dead_peer_detection", dataSourceVPNGatewayConnectionFlattenDeadPeerDetection(*vpnGatewayConnection.DeadPeerDetection)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting dead_peer_detection %s", err) + } + } + if err = d.Set("href", vpnGatewayConnection.Href); err != nil { + return fmt.Errorf("[ERROR] Error setting href: %s", err) + } - if vpnGatewayConnection.IkePolicy != nil { - err = d.Set("ike_policy", dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy)) - if err != nil { - return diag.FromErr(fmt.Errorf("Error setting ike_policy %s", err)) - } - } + if vpnGatewayConnection.IkePolicy != nil { + err = d.Set("ike_policy", dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ike_policy %s", err) + } + } - if vpnGatewayConnection.IpsecPolicy != nil { - err = d.Set("ipsec_policy", dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy)) - if err != nil { - return diag.FromErr(fmt.Errorf("Error setting ipsec_policy %s", err)) - } - } - if err = d.Set("mode", vpnGatewayConnection.Mode); err != nil { - return diag.FromErr(fmt.Errorf("Error setting mode: %s", err)) - } - if err = d.Set("name", vpnGatewayConnection.Name); err != nil { - return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) - } + if vpnGatewayConnection.IpsecPolicy != nil { + err = d.Set("ipsec_policy", dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ipsec_policy %s", err) + } + } + if err = d.Set("mode", vpnGatewayConnection.Mode); err != nil { + return fmt.Errorf("[ERROR] Error setting mode: %s", err) + } + if err = d.Set("name", vpnGatewayConnection.Name); err != nil { + return fmt.Errorf("[ERROR] Error setting name: %s", err) + } - // breaking changes - if err = d.Set("establish_mode", vpnGatewayConnection.EstablishMode); err != nil { - return diag.FromErr(fmt.Errorf("Error setting establish_mode: %s", err)) - } - local := []map[string]interface{}{} - if vpnGatewayConnection.Local != nil { - modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(vpnGatewayConnection.Local) - if err != nil { - return diag.FromErr(err) - } - local = append(local, modelMap) - } - if err = d.Set("local", local); err != nil { - return diag.FromErr(fmt.Errorf("Error setting local %s", err)) - } + // breaking changes + if err = d.Set("establish_mode", vpnGatewayConnection.EstablishMode); err != nil { + return fmt.Errorf("[ERROR] Error setting establish_mode: %s", err) + } + local := []map[string]interface{}{} + if vpnGatewayConnection.Local != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(vpnGatewayConnection.Local) + if err != nil { + return err + } + local = append(local, modelMap) + } + if err = d.Set("local", local); err != nil { + return fmt.Errorf("[ERROR] Error setting local %s", err) + } - peer := []map[string]interface{}{} - if vpnGatewayConnection.Peer != nil { - modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(vpnGatewayConnection.Peer) - if err != nil { - return diag.FromErr(err) + peer := []map[string]interface{}{} + if vpnGatewayConnection.Peer != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(vpnGatewayConnection.Peer) + if err != nil { + return err + } + peer = append(peer, modelMap) + } + if err = d.Set("peer", peer); err != nil { + return fmt.Errorf("[ERROR] Error setting peer %s", err) + } + // Deprecated + if vpnGatewayConnection.Peer != nil { + peer := vpnGatewayConnection.Peer.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer) + if err = d.Set("peer_address", peer.Address); err != nil { + return fmt.Errorf("[ERROR] Error setting peer_address: %s", err) + } + } + if err = d.Set("psk", vpnGatewayConnection.Psk); err != nil { + return fmt.Errorf("[ERROR] Error setting psk: %s", err) + } + if err = d.Set("resource_type", vpnGatewayConnection.ResourceType); err != nil { + return fmt.Errorf("[ERROR] Error setting resource_type: %s", err) + } + if err = d.Set("status", vpnGatewayConnection.Status); err != nil { + return fmt.Errorf("[ERROR] Error setting status: %s", err) + } + if err := d.Set("status_reasons", resourceVPNGatewayConnectionFlattenLifecycleReasons(vpnGatewayConnection.StatusReasons)); err != nil { + return fmt.Errorf("[ERROR] Error setting status_reasons: %s", err) + } + if err = d.Set("routing_protocol", vpnGatewayConnection.RoutingProtocol); err != nil { + return fmt.Errorf("[ERROR] Error setting routing_protocol: %s", err) + } + + if vpnGatewayConnection.Tunnels != nil { + err = d.Set("tunnels", dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting tunnels %s", err) + } + } } - peer = append(peer, modelMap) - } - if err = d.Set("peer", peer); err != nil { - return diag.FromErr(fmt.Errorf("Error setting peer %s", err)) - } + case "*vpcv1.VPNGatewayConnectionRouteMode": + { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode) + d.SetId(fmt.Sprintf("%s/%s", vpn_gateway_id, *vpnGatewayConnection.ID)) + if err = d.Set("admin_state_up", vpnGatewayConnection.AdminStateUp); err != nil { + return fmt.Errorf("[ERROR] Error setting admin_state_up: %s", err) + } + if err = d.Set("authentication_mode", vpnGatewayConnection.AuthenticationMode); err != nil { + return fmt.Errorf("[ERROR] Error setting authentication_mode: %s", err) + } + if err = d.Set("created_at", flex.DateTimeToString(vpnGatewayConnection.CreatedAt)); err != nil { + return fmt.Errorf("[ERROR] Error setting created_at: %s", err) + } - // if err = d.Set("peer_address", vpnGatewayConnection.PeerAddress); err != nil { - // return diag.FromErr(fmt.Errorf("Error setting peer_address: %s", err)) - // } - if err = d.Set("psk", vpnGatewayConnection.Psk); err != nil { - return diag.FromErr(fmt.Errorf("Error setting psk: %s", err)) - } - if err = d.Set("resource_type", vpnGatewayConnection.ResourceType); err != nil { - return diag.FromErr(fmt.Errorf("Error setting resource_type: %s", err)) - } - if err = d.Set("status", vpnGatewayConnection.Status); err != nil { - return diag.FromErr(fmt.Errorf("Error setting status: %s", err)) - } - if err := d.Set("status_reasons", resourceVPNGatewayConnectionFlattenLifecycleReasons(vpnGatewayConnection.StatusReasons)); err != nil { - return diag.FromErr(fmt.Errorf("[ERROR] Error setting status_reasons: %s", err)) - } - if err = d.Set("routing_protocol", vpnGatewayConnection.RoutingProtocol); err != nil { - return diag.FromErr(fmt.Errorf("Error setting routing_protocol: %s", err)) - } + if vpnGatewayConnection.DeadPeerDetection != nil { + err = d.Set("dead_peer_detection", dataSourceVPNGatewayConnectionFlattenDeadPeerDetection(*vpnGatewayConnection.DeadPeerDetection)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting dead_peer_detection %s", err) + } + } + if err = d.Set("href", vpnGatewayConnection.Href); err != nil { + return fmt.Errorf("[ERROR] Error setting href: %s", err) + } - if vpnGatewayConnection.Tunnels != nil { - err = d.Set("tunnels", dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels)) - if err != nil { - return diag.FromErr(fmt.Errorf("Error setting tunnels %s", err)) + if vpnGatewayConnection.IkePolicy != nil { + err = d.Set("ike_policy", dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ike_policy %s", err) + } + } + + if vpnGatewayConnection.IpsecPolicy != nil { + err = d.Set("ipsec_policy", dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ipsec_policy %s", err) + } + } + if err = d.Set("mode", vpnGatewayConnection.Mode); err != nil { + return fmt.Errorf("[ERROR] Error setting mode: %s", err) + } + if err = d.Set("name", vpnGatewayConnection.Name); err != nil { + return fmt.Errorf("[ERROR] Error setting name: %s", err) + } + + // breaking changes + if err = d.Set("establish_mode", vpnGatewayConnection.EstablishMode); err != nil { + return fmt.Errorf("[ERROR] Error setting establish_mode: %s", err) + } + local := []map[string]interface{}{} + if vpnGatewayConnection.Local != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(vpnGatewayConnection.Local) + if err != nil { + return err + } + local = append(local, modelMap) + } + if err = d.Set("local", local); err != nil { + return fmt.Errorf("[ERROR] Error setting local %s", err) + } + + peer := []map[string]interface{}{} + if vpnGatewayConnection.Peer != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(vpnGatewayConnection.Peer) + if err != nil { + return err + } + peer = append(peer, modelMap) + } + if err = d.Set("peer", peer); err != nil { + return fmt.Errorf("[ERROR] Error setting peer %s", err) + } + // Deprecated + if vpnGatewayConnection.Peer != nil { + peer := vpnGatewayConnection.Peer.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer) + if err = d.Set("peer_address", peer.Address); err != nil { + return fmt.Errorf("[ERROR] Error setting peer_address: %s", err) + } + } + if err = d.Set("psk", vpnGatewayConnection.Psk); err != nil { + return fmt.Errorf("[ERROR] Error setting psk: %s", err) + } + if err = d.Set("resource_type", vpnGatewayConnection.ResourceType); err != nil { + return fmt.Errorf("[ERROR] Error setting resource_type: %s", err) + } + if err = d.Set("status", vpnGatewayConnection.Status); err != nil { + return fmt.Errorf("[ERROR] Error setting status: %s", err) + } + if err := d.Set("status_reasons", resourceVPNGatewayConnectionFlattenLifecycleReasons(vpnGatewayConnection.StatusReasons)); err != nil { + return fmt.Errorf("[ERROR] Error setting status_reasons: %s", err) + } + if err = d.Set("routing_protocol", vpnGatewayConnection.RoutingProtocol); err != nil { + return fmt.Errorf("[ERROR] Error setting routing_protocol: %s", err) + } + + if vpnGatewayConnection.Tunnels != nil { + err = d.Set("tunnels", dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting tunnels %s", err) + } + } } - } + case "*vpcv1.VPNGatewayConnectionPolicyMode": + { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode) + d.SetId(fmt.Sprintf("%s/%s", vpn_gateway_id, *vpnGatewayConnection.ID)) + if err = d.Set("admin_state_up", vpnGatewayConnection.AdminStateUp); err != nil { + return fmt.Errorf("[ERROR] Error setting admin_state_up: %s", err) + } + if err = d.Set("authentication_mode", vpnGatewayConnection.AuthenticationMode); err != nil { + return fmt.Errorf("[ERROR] Error setting authentication_mode: %s", err) + } + if err = d.Set("created_at", flex.DateTimeToString(vpnGatewayConnection.CreatedAt)); err != nil { + return fmt.Errorf("[ERROR] Error setting created_at: %s", err) + } - // if len(vpnGatewayConnection.LocalCIDRs) > 0 { - // err = d.Set("local_cidrs", vpnGatewayConnection.LocalCIDRs) - // if err != nil { - // return diag.FromErr(fmt.Errorf("Error setting local CIDRs %s", err)) - // } - // } + if vpnGatewayConnection.DeadPeerDetection != nil { + err = d.Set("dead_peer_detection", dataSourceVPNGatewayConnectionFlattenDeadPeerDetection(*vpnGatewayConnection.DeadPeerDetection)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting dead_peer_detection %s", err) + } + } + if err = d.Set("href", vpnGatewayConnection.Href); err != nil { + return fmt.Errorf("[ERROR] Error setting href: %s", err) + } + + if vpnGatewayConnection.IkePolicy != nil { + err = d.Set("ike_policy", dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ike_policy %s", err) + } + } + + if vpnGatewayConnection.IpsecPolicy != nil { + err = d.Set("ipsec_policy", dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ipsec_policy %s", err) + } + } + if err = d.Set("mode", vpnGatewayConnection.Mode); err != nil { + return fmt.Errorf("[ERROR] Error setting mode: %s", err) + } + if err = d.Set("name", vpnGatewayConnection.Name); err != nil { + return fmt.Errorf("[ERROR] Error setting name: %s", err) + } - // if len(vpnGatewayConnection.PeerCIDRs) > 0 { - // err = d.Set("peer_cidrs", vpnGatewayConnection.PeerCIDRs) - // if err != nil { - // return diag.FromErr(fmt.Errorf("Error setting Peer CIDRs %s", err)) - // } - // } + // breaking changes + if err = d.Set("establish_mode", vpnGatewayConnection.EstablishMode); err != nil { + return fmt.Errorf("[ERROR] Error setting establish_mode: %s", err) + } + local := []map[string]interface{}{} + if vpnGatewayConnection.Local != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModeLocalToMap(vpnGatewayConnection.Local) + if err != nil { + return err + } + local = append(local, modelMap) + } + if err = d.Set("local", local); err != nil { + return fmt.Errorf("[ERROR] Error setting local %s", err) + } + + peer := []map[string]interface{}{} + if vpnGatewayConnection.Peer != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModePeerToMap(vpnGatewayConnection.Peer) + if err != nil { + return err + } + peer = append(peer, modelMap) + } + if err = d.Set("peer", peer); err != nil { + return fmt.Errorf("[ERROR] Error setting peer %s", err) + } + // Deprecated + if vpnGatewayConnection.Peer != nil { + peer := vpnGatewayConnection.Peer.(*vpcv1.VPNGatewayConnectionPolicyModePeer) + if err = d.Set("peer_address", peer.Address); err != nil { + return fmt.Errorf("[ERROR] Error setting peer_address: %s", err) + } + if len(peer.CIDRs) > 0 { + err = d.Set("peer_cidrs", peer.CIDRs) + if err != nil { + return fmt.Errorf("[ERROR] Error setting Peer CIDRs %s", err) + } + } + } + if err = d.Set("psk", vpnGatewayConnection.Psk); err != nil { + return fmt.Errorf("[ERROR] Error setting psk: %s", err) + } + if err = d.Set("resource_type", vpnGatewayConnection.ResourceType); err != nil { + return fmt.Errorf("[ERROR] Error setting resource_type: %s", err) + } + if err = d.Set("status", vpnGatewayConnection.Status); err != nil { + return fmt.Errorf("[ERROR] Error setting status: %s", err) + } + if err := d.Set("status_reasons", resourceVPNGatewayConnectionFlattenLifecycleReasons(vpnGatewayConnection.StatusReasons)); err != nil { + return fmt.Errorf("[ERROR] Error setting status_reasons: %s", err) + } + // Deprecated + if vpnGatewayConnection.Local != nil { + local := vpnGatewayConnection.Local + if len(local.CIDRs) > 0 { + err = d.Set("local_cidrs", local.CIDRs) + if err != nil { + return fmt.Errorf("[ERROR] Error setting local CIDRs %s", err) + } + } + } + + } + } return nil } @@ -707,6 +920,20 @@ func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocal modelMap["ike_identities"] = ikeIdentities return modelMap, nil } +func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModeLocalToMap(model *vpcv1.VPNGatewayConnectionPolicyModeLocal) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + ikeIdentities := []map[string]interface{}{} + for _, ikeIdentitiesItem := range model.IkeIdentities { + ikeIdentitiesItemMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(ikeIdentitiesItem) + if err != nil { + return modelMap, err + } + ikeIdentities = append(ikeIdentities, ikeIdentitiesItemMap) + } + modelMap["ike_identities"] = ikeIdentities + modelMap["cidrs"] = model.CIDRs + return modelMap, nil +} func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(model vpcv1.VPNGatewayConnectionIkeIdentityIntf) (map[string]interface{}, error) { if _, ok := model.(*vpcv1.VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn); ok { @@ -782,6 +1009,31 @@ func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerT return nil, fmt.Errorf("Unrecognized vpcv1.VPNGatewayConnectionStaticRouteModePeerIntf subtype encountered") } } +func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModePeerToMap(model vpcv1.VPNGatewayConnectionPolicyModePeerIntf) (map[string]interface{}, error) { + if _, ok := model.(*vpcv1.VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress); ok { + return dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddressToMap(model.(*vpcv1.VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn); ok { + return dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdnToMap(model.(*vpcv1.VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn)) + } else if _, ok := model.(*vpcv1.VPNGatewayConnectionPolicyModePeer); ok { + modelMap := make(map[string]interface{}) + model := model.(*vpcv1.VPNGatewayConnectionPolicyModePeer) + ikeIdentityMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(model.IkeIdentity) + if err != nil { + return modelMap, err + } + modelMap["ike_identity"] = []map[string]interface{}{ikeIdentityMap} + modelMap["type"] = model.Type + if model.Address != nil { + modelMap["address"] = model.Address + } + if model.Fqdn != nil { + modelMap["fqdn"] = model.Fqdn + } + return modelMap, nil + } else { + return nil, fmt.Errorf("Unrecognized vpcv1.VPNGatewayConnectionPolicyModePeerIntf subtype encountered") + } +} func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddressToMap(model *vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) @@ -794,6 +1046,17 @@ func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerV modelMap["address"] = model.Address return modelMap, nil } +func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddressToMap(model *vpcv1.VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + ikeIdentityMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(model.IkeIdentity) + if err != nil { + return modelMap, err + } + modelMap["ike_identity"] = []map[string]interface{}{ikeIdentityMap} + modelMap["type"] = model.Type + modelMap["address"] = model.Address + return modelMap, nil +} func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdnToMap(model *vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) ikeIdentityMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(model.IkeIdentity) @@ -805,3 +1068,14 @@ func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerV modelMap["fqdn"] = model.Fqdn return modelMap, nil } +func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdnToMap(model *vpcv1.VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + ikeIdentityMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionIkeIdentityToMap(model.IkeIdentity) + if err != nil { + return modelMap, err + } + modelMap["ike_identity"] = []map[string]interface{}{ikeIdentityMap} + modelMap["type"] = model.Type + modelMap["fqdn"] = model.Fqdn + return modelMap, nil +} diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go index 1f1a616914..75ab693473 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go @@ -5,8 +5,10 @@ package vpc import ( "fmt" + "reflect" "time" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -96,11 +98,12 @@ func DataSourceIBMISVPNGatewayConnections() *schema.Resource { Computed: true, Description: "VPN Gateway connection name", }, - // isVPNGatewayConnectionPeerAddress: { - // Type: schema.TypeString, - // Computed: true, - // Description: "VPN gateway connection peer address", - // }, + isVPNGatewayConnectionPeerAddress: { + Type: schema.TypeString, + Computed: true, + Description: "VPN gateway connection peer address", + Deprecated: "peer_address is deprecated, use peer instead", + }, // new breaking change "establish_mode": &schema.Schema{ Type: schema.TypeString, @@ -131,6 +134,13 @@ func DataSourceIBMISVPNGatewayConnections() *schema.Resource { }, }, }, + "cidrs": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "VPN gateway connection local CIDRs", + }, }, }, }, @@ -232,21 +242,23 @@ func DataSourceIBMISVPNGatewayConnections() *schema.Resource { }, }, }, - // isVPNGatewayConnectionLocalCIDRS: { - // Type: schema.TypeSet, - // Computed: true, - // Elem: &schema.Schema{Type: schema.TypeString}, - // Set: schema.HashString, - // Description: "VPN gateway connection local CIDRs", - // }, - - // isVPNGatewayConnectionPeerCIDRS: { - // Type: schema.TypeSet, - // Computed: true, - // Elem: &schema.Schema{Type: schema.TypeString}, - // Set: schema.HashString, - // Description: "VPN gateway connection peer CIDRs", - // }, + isVPNGatewayConnectionLocalCIDRS: { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "VPN gateway connection local CIDRs", + Deprecated: "local_cidrs is deprecated, use local instead", + }, + + isVPNGatewayConnectionPeerCIDRS: { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "VPN gateway connection peer CIDRs", + Deprecated: "peer_cidrs is deprecated, use peer instead", + }, }, }, }, @@ -272,74 +284,204 @@ func dataSourceIBMVPNGatewayConnectionsRead(d *schema.ResourceData, meta interfa } vpngatewayconnections := make([]map[string]interface{}, 0) for _, instance := range availableVPNGatewayConnections.Connections { - gatewayconnection := map[string]interface{}{} - data := instance.(*vpcv1.VPNGatewayConnection) - gatewayconnection[isVPNGatewayConnectionAdminAuthenticationmode] = *data.AuthenticationMode - gatewayconnection[isVPNGatewayConnectionCreatedat] = data.CreatedAt.String() - gatewayconnection[isVPNGatewayConnectionAdminStateup] = *data.AdminStateUp - gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = *data.DeadPeerDetection.Action - gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = *data.DeadPeerDetection.Interval - gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = *data.DeadPeerDetection.Timeout - gatewayconnection[isVPNGatewayConnectionID] = *data.ID - - if data.Local != nil { - localMap, err := dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionStaticRouteModeLocalToMap(data.Local) - if err != nil { - return err - } - gatewayconnection["local"] = []map[string]interface{}{localMap} + gatewayconnection, err := getvpnGatewayConnectionIntfData(instance) + if err != nil { + return err } - if data.Peer != nil { - peerMap, err := dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionStaticRouteModePeerToMap(data.Peer) - if err != nil { - return err + vpngatewayconnections = append(vpngatewayconnections, gatewayconnection) + } + + d.SetId(dataSourceIBMVPNGatewayConnectionsID(d)) + d.Set(isvpnGatewayConnections, vpngatewayconnections) + return nil +} + +func getvpnGatewayConnectionIntfData(vpnGatewayConnectionIntf vpcv1.VPNGatewayConnectionIntf) (map[string]interface{}, error) { + gatewayconnection := map[string]interface{}{} + switch reflect.TypeOf(vpnGatewayConnectionIntf).String() { + case "*vpcv1.VPNGatewayConnection": + { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection) + gatewayconnection["id"] = vpnGatewayConnection.ID + gatewayconnection["admin_state_up"] = vpnGatewayConnection.AdminStateUp + gatewayconnection["authentication_mode"] = vpnGatewayConnection.AuthenticationMode + gatewayconnection["created_at"] = flex.DateTimeToString(vpnGatewayConnection.CreatedAt) + + if vpnGatewayConnection.DeadPeerDetection != nil { + gatewayconnection["dead_peer_detection"] = dataSourceVPNGatewayConnectionFlattenDeadPeerDetection(*vpnGatewayConnection.DeadPeerDetection) } - gatewayconnection["peer"] = []map[string]interface{}{peerMap} - } - gatewayconnection["establish_mode"] = data.EstablishMode + gatewayconnection["href"] = vpnGatewayConnection.Href - if data.IkePolicy != nil { - gatewayconnection[isVPNGatewayConnectionIKEPolicy] = *data.IkePolicy.ID - } - if data.IpsecPolicy != nil { - gatewayconnection[isVPNGatewayConnectionIPSECPolicy] = *data.IpsecPolicy.ID + if vpnGatewayConnection.IkePolicy != nil { + gatewayconnection["ike_policy"] = dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy) + } + + if vpnGatewayConnection.IpsecPolicy != nil { + gatewayconnection["ipsec_policy"] = dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy) + } + gatewayconnection["mode"] = vpnGatewayConnection.Mode + gatewayconnection["name"] = vpnGatewayConnection.Name + + // breaking changes + gatewayconnection["establish_mode"] = vpnGatewayConnection.EstablishMode + local := []map[string]interface{}{} + if vpnGatewayConnection.Local != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(vpnGatewayConnection.Local) + if err != nil { + return gatewayconnection, err + } + local = append(local, modelMap) + } + gatewayconnection["local"] = local + + peer := []map[string]interface{}{} + if vpnGatewayConnection.Peer != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(vpnGatewayConnection.Peer) + if err != nil { + return gatewayconnection, err + } + peer = append(peer, modelMap) + } + gatewayconnection["peer"] = peer + // Deprecated + if vpnGatewayConnection.Peer != nil { + peer := vpnGatewayConnection.Peer.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer) + gatewayconnection["peer_address"] = peer.Address + } + gatewayconnection["psk"] = vpnGatewayConnection.Psk + gatewayconnection["resource_type"] = vpnGatewayConnection.ResourceType + gatewayconnection["status"] = vpnGatewayConnection.Status + gatewayconnection["status_reasons"] = resourceVPNGatewayConnectionFlattenLifecycleReasons(vpnGatewayConnection.StatusReasons) + gatewayconnection["routing_protocol"] = vpnGatewayConnection.RoutingProtocol + + if vpnGatewayConnection.Tunnels != nil { + gatewayconnection["tunnels"] = dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels) + } } - // if data.LocalCIDRs != nil { - // gatewayconnection[isVPNGatewayConnectionLocalCIDRS] = flex.FlattenStringList(data.LocalCIDRs) - // } - // if data.PeerCIDRs != nil { - // gatewayconnection[isVPNGatewayConnectionPeerCIDRS] = flex.FlattenStringList(data.PeerCIDRs) - // } - gatewayconnection[isVPNGatewayConnectionMode] = *data.Mode - gatewayconnection[isVPNGatewayConnectionName] = *data.Name - // gatewayconnection[isVPNGatewayConnectionPeerAddress] = *data.PeerAddress - gatewayconnection[isVPNGatewayConnectionResourcetype] = *data.ResourceType - gatewayconnection[isVPNGatewayConnectionStatus] = *data.Status - gatewayconnection[isVPNGatewayConnectionStatusreasons] = resourceVPNGatewayConnectionFlattenLifecycleReasons(data.StatusReasons) - //if data.Tunnels != nil { - if len(data.Tunnels) > 0 { - vpcTunnelsList := make([]map[string]interface{}, 0) - for _, vpcTunnel := range data.Tunnels { - currentTunnel := map[string]interface{}{} - if vpcTunnel.PublicIP != nil { - if vpcTunnel.PublicIP != nil { - currentTunnel["address"] = *vpcTunnel.PublicIP.Address - } - if vpcTunnel.Status != nil { - currentTunnel["status"] = *vpcTunnel.Status - } - vpcTunnelsList = append(vpcTunnelsList, currentTunnel) + case "*vpcv1.VPNGatewayConnectionRouteMode": + { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode) + gatewayconnection["id"] = vpnGatewayConnection.ID + gatewayconnection["admin_state_up"] = vpnGatewayConnection.AdminStateUp + gatewayconnection["authentication_mode"] = vpnGatewayConnection.AuthenticationMode + gatewayconnection["created_at"] = flex.DateTimeToString(vpnGatewayConnection.CreatedAt) + + if vpnGatewayConnection.DeadPeerDetection != nil { + gatewayconnection["dead_peer_detection"] = dataSourceVPNGatewayConnectionFlattenDeadPeerDetection(*vpnGatewayConnection.DeadPeerDetection) + } + gatewayconnection["href"] = vpnGatewayConnection.Href + if vpnGatewayConnection.IkePolicy != nil { + gatewayconnection["ike_policy"] = dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy) + } + + if vpnGatewayConnection.IpsecPolicy != nil { + gatewayconnection["ipsec_policy"] = dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy) + } + gatewayconnection["mode"] = vpnGatewayConnection.Mode + gatewayconnection["name"] = vpnGatewayConnection.Name + + // breaking changes + gatewayconnection["establish_mode"] = vpnGatewayConnection.EstablishMode + local := []map[string]interface{}{} + if vpnGatewayConnection.Local != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(vpnGatewayConnection.Local) + if err != nil { + return gatewayconnection, err } + local = append(local, modelMap) + } + gatewayconnection["local"] = local + + peer := []map[string]interface{}{} + if vpnGatewayConnection.Peer != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(vpnGatewayConnection.Peer) + if err != nil { + return gatewayconnection, err + } + peer = append(peer, modelMap) + } + gatewayconnection["peer"] = peer + // Deprecated + if vpnGatewayConnection.Peer != nil { + peer := vpnGatewayConnection.Peer.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer) + gatewayconnection["peer_address"] = peer.Address + } + gatewayconnection["psk"] = vpnGatewayConnection.Psk + gatewayconnection["resource_type"] = vpnGatewayConnection.ResourceType + gatewayconnection["status"] = vpnGatewayConnection.Status + gatewayconnection["status_reasons"] = resourceVPNGatewayConnectionFlattenLifecycleReasons(vpnGatewayConnection.StatusReasons) + gatewayconnection["routing_protocol"] = vpnGatewayConnection.RoutingProtocol + + if vpnGatewayConnection.Tunnels != nil { + gatewayconnection["tunnels"] = dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels) } - gatewayconnection[isVPNGatewayConnectionTunnels] = vpcTunnelsList } + case "*vpcv1.VPNGatewayConnectionPolicyMode": + { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode) + gatewayconnection["id"] = vpnGatewayConnection.ID + gatewayconnection["admin_state_up"] = vpnGatewayConnection.AdminStateUp + gatewayconnection["authentication_mode"] = vpnGatewayConnection.AuthenticationMode + gatewayconnection["created_at"] = flex.DateTimeToString(vpnGatewayConnection.CreatedAt) - vpngatewayconnections = append(vpngatewayconnections, gatewayconnection) - } + if vpnGatewayConnection.DeadPeerDetection != nil { + gatewayconnection["dead_peer_detection"] = dataSourceVPNGatewayConnectionFlattenDeadPeerDetection(*vpnGatewayConnection.DeadPeerDetection) + } + gatewayconnection["href"] = vpnGatewayConnection.Href + if vpnGatewayConnection.IkePolicy != nil { + gatewayconnection["ike_policy"] = dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy) + } - d.SetId(dataSourceIBMVPNGatewayConnectionsID(d)) - d.Set(isvpnGatewayConnections, vpngatewayconnections) - return nil + if vpnGatewayConnection.IpsecPolicy != nil { + gatewayconnection["ipsec_policy"] = dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy) + } + gatewayconnection["mode"] = vpnGatewayConnection.Mode + gatewayconnection["name"] = vpnGatewayConnection.Name + + // breaking changes + gatewayconnection["establish_mode"] = vpnGatewayConnection.EstablishMode + local := []map[string]interface{}{} + if vpnGatewayConnection.Local != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModeLocalToMap(vpnGatewayConnection.Local) + if err != nil { + return gatewayconnection, err + } + local = append(local, modelMap) + } + gatewayconnection["local"] = local + + peer := []map[string]interface{}{} + if vpnGatewayConnection.Peer != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModePeerToMap(vpnGatewayConnection.Peer) + if err != nil { + return gatewayconnection, err + } + peer = append(peer, modelMap) + } + gatewayconnection["peer"] = peer + // Deprecated + if vpnGatewayConnection.Peer != nil { + peer := vpnGatewayConnection.Peer.(*vpcv1.VPNGatewayConnectionPolicyModePeer) + gatewayconnection["peer_address"] = peer.Address + if len(peer.CIDRs) > 0 { + gatewayconnection["peer_cidrs"] = peer.CIDRs + } + } + gatewayconnection["psk"] = vpnGatewayConnection.Psk + gatewayconnection["resource_type"] = vpnGatewayConnection.ResourceType + gatewayconnection["status"] = vpnGatewayConnection.Status + gatewayconnection["status_reasons"] = resourceVPNGatewayConnectionFlattenLifecycleReasons(vpnGatewayConnection.StatusReasons) + // Deprecated + if vpnGatewayConnection.Local != nil { + local := vpnGatewayConnection.Local + if len(local.CIDRs) > 0 { + gatewayconnection["local_cidrs"] = local.CIDRs + } + } + + } + } + return gatewayconnection, nil } // dataSourceIBMVPNGatewaysID returns a reasonable ID list. diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go index 43889a305b..54964957b1 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go @@ -72,11 +72,12 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { Description: "VPN Gateway info", }, // Deprecated - // isVPNGatewayConnectionPeerAddress: { - // Type: schema.TypeString, - // Required: true, - // Description: "VPN gateway connection peer address", - // }, + isVPNGatewayConnectionPeerAddress: { + Type: schema.TypeString, + Required: true, + Description: "VPN gateway connection peer address", + Deprecated: "peer_address is deprecated, use peer instead", + }, // new breaking changes "establish_mode": &schema.Schema{ @@ -111,6 +112,14 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { }, }, }, + "cidrs": { + Type: schema.TypeSet, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "VPN gateway connection local CIDRs", + }, }, }, }, @@ -157,6 +166,14 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { Optional: true, Description: "The FQDN of the peer VPN gateway for this connection.", }, + "cidrs": { + Type: schema.TypeSet, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "VPN gateway connection peer CIDRs", + }, }, }, }, @@ -173,23 +190,25 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { Description: "VPN gateway connection admin state", }, // deprecated - // isVPNGatewayConnectionLocalCIDRS: { - // Type: schema.TypeSet, - // Optional: true, - // ForceNew: true, - // Elem: &schema.Schema{Type: schema.TypeString}, - // Set: schema.HashString, - // Description: "VPN gateway connection local CIDRs", - // }, + isVPNGatewayConnectionLocalCIDRS: { + Type: schema.TypeSet, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "VPN gateway connection local CIDRs", + Deprecated: "local_cidrs is deprecated, use local instead", + }, // deprecated - // isVPNGatewayConnectionPeerCIDRS: { - // Type: schema.TypeSet, - // Optional: true, - // ForceNew: true, - // Elem: &schema.Schema{Type: schema.TypeString}, - // Set: schema.HashString, - // Description: "VPN gateway connection peer CIDRs", - // }, + isVPNGatewayConnectionPeerCIDRS: { + Type: schema.TypeSet, + Optional: true, + ForceNew: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "VPN gateway connection peer CIDRs", + Deprecated: "peer_cidrs is deprecated, use peer instead", + }, isVPNGatewayConnectionDeadPeerDetectionAction: { Type: schema.TypeString, @@ -371,7 +390,7 @@ func resourceIBMISVPNGatewayConnectionCreate(d *schema.ResourceData, meta interf log.Printf("[DEBUG] VPNGatewayConnection create") name := d.Get(isVPNGatewayConnectionName).(string) gatewayID := d.Get(isVPNGatewayConnectionVPNGateway).(string) - // peerAddress := d.Get(isVPNGatewayConnectionPeerAddress).(string) + peerAddress := d.Get(isVPNGatewayConnectionPeerAddress).(string) prephasedKey := d.Get(isVPNGatewayConnectionPreSharedKey).(string) stateUp := false @@ -397,7 +416,7 @@ func resourceIBMISVPNGatewayConnectionCreate(d *schema.ResourceData, meta interf action = "none" } - err := vpngwconCreate(d, meta, name, gatewayID, "peerAddress", prephasedKey, action, interval, timeout, stateUp) + err := vpngwconCreate(d, meta, name, gatewayID, peerAddress, prephasedKey, action, interval, timeout, stateUp) if err != nil { return err } @@ -410,8 +429,7 @@ func vpngwconCreate(d *schema.ResourceData, meta interface{}, name, gatewayID, p return err } - vpnGatewayConnectionPrototypeModel := &vpcv1.VPNGatewayConnectionPrototype{ - // PeerAddress: &peerAddress, + vpnGatewayConnectionPrototypeModel := &vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype{ Psk: &prephasedKey, AdminStateUp: &stateUp, DeadPeerDetection: &vpcv1.VPNGatewayConnectionDpdPrototype{ @@ -426,15 +444,6 @@ func vpngwconCreate(d *schema.ResourceData, meta interface{}, name, gatewayID, p VPNGatewayConnectionPrototype: vpnGatewayConnectionPrototypeModel, } - // if _, ok := d.GetOk(isVPNGatewayConnectionLocalCIDRS); ok { - // localCidrs := flex.ExpandStringList((d.Get(isVPNGatewayConnectionLocalCIDRS).(*schema.Set)).List()) - // vpnGatewayConnectionPrototypeModel.LocalCIDRs = localCidrs - // } - // if _, ok := d.GetOk(isVPNGatewayConnectionPeerCIDRS); ok { - // peerCidrs := flex.ExpandStringList((d.Get(isVPNGatewayConnectionPeerCIDRS).(*schema.Set)).List()) - // vpnGatewayConnectionPrototypeModel.PeerCIDRs = peerCidrs - // } - var ikePolicyIdentity, ipsecPolicyIdentity string // new breaking changes if establishModeOk, ok := d.GetOk("establish_mode"); ok { @@ -442,18 +451,33 @@ func vpngwconCreate(d *schema.ResourceData, meta interface{}, name, gatewayID, p } if localOk, ok := d.GetOk("local"); ok && len(localOk.([]interface{})) > 0 { - LocalModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionStaticRouteModeLocalPrototype(localOk.([]interface{})[0].(map[string]interface{})) + LocalModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionPolicyModeLocalPrototype(localOk.([]interface{})[0].(map[string]interface{})) if err != nil { return err } vpnGatewayConnectionPrototypeModel.Local = LocalModel + } else if _, ok := d.GetOk(isVPNGatewayConnectionLocalCIDRS); ok { + localCidrs := flex.ExpandStringList((d.Get(isVPNGatewayConnectionLocalCIDRS).(*schema.Set)).List()) + model := &vpcv1.VPNGatewayConnectionPolicyModeLocalPrototype{} + model.CIDRs = localCidrs + vpnGatewayConnectionPrototypeModel.Local = model } if peerOk, ok := d.GetOk("peer"); ok && len(peerOk.([]interface{})) > 0 { - PeerModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionStaticRouteModePeerPrototype(peerOk.([]interface{})[0].(map[string]interface{})) + PeerModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionPolicyModePeerPrototype(peerOk.([]interface{})[0].(map[string]interface{})) if err != nil { return err } vpnGatewayConnectionPrototypeModel.Peer = PeerModel + } else if _, ok := d.GetOk(isVPNGatewayConnectionPeerCIDRS); ok || peerAddress != "" { + model := &vpcv1.VPNGatewayConnectionPolicyModePeerPrototype{} + if ok { + peerCidrs := flex.ExpandStringList((d.Get(isVPNGatewayConnectionPeerCIDRS).(*schema.Set)).List()) + model.CIDRs = peerCidrs + } + if peerAddress != "" { + model.Address = &peerAddress + } + vpnGatewayConnectionPrototypeModel.Peer = model } if ikePolicy, ok := d.GetOk(isVPNGatewayConnectionIKEPolicy); ok { @@ -518,88 +542,7 @@ func vpngwconGet(d *schema.ResourceData, meta interface{}, gID, gConnID string) return fmt.Errorf("[ERROR] Error Getting Vpn Gateway Connection (%s): %s\n%s", gConnID, err, response) } d.Set(isVPNGatewayConnection, gConnID) - vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection) - d.Set(isVPNGatewayConnectionName, *vpnGatewayConnection.Name) - d.Set(isVPNGatewayConnectionVPNGateway, gID) - d.Set(isVPNGatewayConnectionAdminStateup, *vpnGatewayConnection.AdminStateUp) - // d.Set(isVPNGatewayConnectionPeerAddress, *vpnGatewayConnection.PeerAddress) - d.Set(isVPNGatewayConnectionPreSharedKey, *vpnGatewayConnection.Psk) - - // if vpnGatewayConnection.LocalCIDRs != nil { - // d.Set(isVPNGatewayConnectionLocalCIDRS, flex.FlattenStringList(vpnGatewayConnection.LocalCIDRs)) - // } - // if vpnGatewayConnection.PeerCIDRs != nil { - // d.Set(isVPNGatewayConnectionPeerCIDRS, flex.FlattenStringList(vpnGatewayConnection.PeerCIDRs)) - // } - - // new breaking changes - if !core.IsNil(vpnGatewayConnection.EstablishMode) { - if err = d.Set("establish_mode", vpnGatewayConnection.EstablishMode); err != nil { - return fmt.Errorf("Error setting establish_mode: %s", err) - } - } - if !core.IsNil(vpnGatewayConnection.Local) { - localMap, err := resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(vpnGatewayConnection.Local) - if err != nil { - return (err) - } - if err = d.Set("local", []map[string]interface{}{localMap}); err != nil { - return fmt.Errorf("Error setting local: %s", err) - } - } - if !core.IsNil(vpnGatewayConnection.Peer) { - peerMap, err := resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(vpnGatewayConnection.Peer) - if err != nil { - return (err) - } - if err = d.Set("peer", []map[string]interface{}{peerMap}); err != nil { - return fmt.Errorf("Error setting peer: %s", err) - } - } - if vpnGatewayConnection.IkePolicy != nil { - d.Set(isVPNGatewayConnectionIKEPolicy, *vpnGatewayConnection.IkePolicy.ID) - } - if vpnGatewayConnection.IpsecPolicy != nil { - d.Set(isVPNGatewayConnectionIPSECPolicy, *vpnGatewayConnection.IpsecPolicy.ID) - } - if vpnGatewayConnection.AuthenticationMode != nil { - d.Set(isVPNGatewayConnectionAdminAuthenticationmode, *vpnGatewayConnection.AuthenticationMode) - } - if vpnGatewayConnection.Status != nil { - d.Set(isVPNGatewayConnectionStatus, *vpnGatewayConnection.Status) - } - if err := d.Set(isVPNGatewayConnectionStatusreasons, resourceVPNGatewayConnectionFlattenLifecycleReasons(vpnGatewayConnection.StatusReasons)); err != nil { - return fmt.Errorf("[ERROR] Error setting status_reasons: %s", err) - } - if vpnGatewayConnection.ResourceType != nil { - d.Set(isVPNGatewayConnectionResourcetype, *vpnGatewayConnection.ResourceType) - } - if vpnGatewayConnection.CreatedAt != nil { - d.Set(isVPNGatewayConnectionCreatedat, vpnGatewayConnection.CreatedAt.String()) - } - - if vpnGatewayConnection.Mode != nil { - d.Set(isVPNGatewayConnectionMode, *vpnGatewayConnection.Mode) - } - vpcTunnelsList := make([]map[string]interface{}, 0) - if vpnGatewayConnection.Tunnels != nil { - for _, vpcTunnel := range vpnGatewayConnection.Tunnels { - currentTunnel := map[string]interface{}{} - if vpcTunnel.PublicIP != nil { - publicIP := *vpcTunnel.PublicIP - currentTunnel["address"] = *publicIP.Address - } - if vpcTunnel.Status != nil { - currentTunnel["status"] = *vpcTunnel.Status - } - vpcTunnelsList = append(vpcTunnelsList, currentTunnel) - } - } - d.Set(isVPNGatewayConnectionTunnels, vpcTunnelsList) - - d.Set(isVPNGatewayConnectionDeadPeerDetectionAction, *vpnGatewayConnection.DeadPeerDetection.Action) - d.Set(isVPNGatewayConnectionDeadPeerDetectionInterval, *vpnGatewayConnection.DeadPeerDetection.Interval) - d.Set(isVPNGatewayConnectionDeadPeerDetectionTimeout, *vpnGatewayConnection.DeadPeerDetection.Timeout) + setvpnGatewayConnectionIntfResourceData(d, gID, vpnGatewayConnectionIntf) getVPNGatewayOptions := &vpcv1.GetVPNGatewayOptions{ ID: &gID, } @@ -658,11 +601,13 @@ func vpngwconUpdate(d *schema.ResourceData, meta interface{}, gID, gConnID strin vpnGatewayConnectionPatchModel.Peer = peer hasChanged = true } - // if d.HasChange(isVPNGatewayConnectionPeerAddress) { - // peerAddress := d.Get(isVPNGatewayConnectionPeerAddress).(string) - // vpnGatewayConnectionPatchModel.PeerAddress = &peerAddress - // hasChanged = true - // } + // Deprecated + if d.HasChange(isVPNGatewayConnectionPeerAddress) { + peerAddress := d.Get(isVPNGatewayConnectionPeerAddress).(string) + model := &vpcv1.VPNGatewayConnectionPeerPatch{} + model.Address = &peerAddress + hasChanged = true + } if d.HasChange(isVPNGatewayConnectionPreSharedKey) { psk := d.Get(isVPNGatewayConnectionPreSharedKey).(string) @@ -874,6 +819,25 @@ func resourceVPNGatewayConnectionFlattenLifecycleReasons(statusReasons []vpcv1.V // helper functions +func resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionPolicyModeLocalPrototype(modelMap map[string]interface{}) (*vpcv1.VPNGatewayConnectionPolicyModeLocalPrototype, error) { + model := &vpcv1.VPNGatewayConnectionPolicyModeLocalPrototype{} + if modelMap["ike_identities"] != nil { + ikeIdentities := []vpcv1.VPNGatewayConnectionIkeIdentityPrototypeIntf{} + for _, ikeIdentitiesItem := range modelMap["ike_identities"].([]interface{}) { + ikeIdentitiesItemModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionIkeIdentityPrototype(ikeIdentitiesItem.(map[string]interface{})) + if err != nil { + return model, err + } + ikeIdentities = append(ikeIdentities, ikeIdentitiesItemModel) + } + model.IkeIdentities = ikeIdentities + } + if modelMap["cidrs"] != nil && modelMap["cidrs"].(*schema.Set).Len() > 0 { + localCidrs := flex.ExpandStringList((modelMap["cidrs"].(*schema.Set)).List()) + model.CIDRs = localCidrs + } + return model, nil +} func resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionStaticRouteModeLocalPrototype(modelMap map[string]interface{}) (*vpcv1.VPNGatewayConnectionStaticRouteModeLocalPrototype, error) { model := &vpcv1.VPNGatewayConnectionStaticRouteModeLocalPrototype{} if modelMap["ike_identities"] != nil { @@ -899,6 +863,27 @@ func resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionIkeIdentityProtot return model, nil } +func resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionPolicyModePeerPrototype(modelMap map[string]interface{}) (vpcv1.VPNGatewayConnectionPolicyModePeerPrototypeIntf, error) { + model := &vpcv1.VPNGatewayConnectionPolicyModePeerPrototype{} + if modelMap["ike_identity"] != nil && len(modelMap["ike_identity"].([]interface{})) > 0 { + IkeIdentityModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionIkeIdentityPrototype(modelMap["ike_identity"].([]interface{})[0].(map[string]interface{})) + if err != nil { + return model, err + } + model.IkeIdentity = IkeIdentityModel + } + if modelMap["address"] != nil && modelMap["address"].(string) != "" { + model.Address = core.StringPtr(modelMap["address"].(string)) + } + if modelMap["fqdn"] != nil && modelMap["fqdn"].(string) != "" { + model.Fqdn = core.StringPtr(modelMap["fqdn"].(string)) + } + if modelMap["cidrs"] != nil && modelMap["cidrs"].(*schema.Set).Len() > 0 { + peerCidrs := flex.ExpandStringList((modelMap["cidrs"].(*schema.Set)).List()) + model.CIDRs = peerCidrs + } + return model, nil +} func resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionStaticRouteModePeerPrototype(modelMap map[string]interface{}) (vpcv1.VPNGatewayConnectionStaticRouteModePeerPrototypeIntf, error) { model := &vpcv1.VPNGatewayConnectionStaticRouteModePeerPrototype{} if modelMap["ike_identity"] != nil && len(modelMap["ike_identity"].([]interface{})) > 0 { From d3dbb79cae24c241c7f15805a1237063ef8b1411 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 8 Mar 2024 14:57:37 +0530 Subject: [PATCH 062/103] made changes to sdk --- common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 7 +++---- ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index e0606cfba6..613efa4920 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -107408,12 +107408,11 @@ func UnmarshalVPNGatewayConnectionRouteMode(m map[string]json.RawMessage, result err = fmt.Errorf("error unmarshalling discriminator property 'routing_protocol': %s", err.Error()) return } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'routing_protocol' not found in JSON object") - return - } + if discValue == "none" { err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) + } else if discValue == "" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) } else { err = fmt.Errorf("unrecognized value for discriminator property 'routing_protocol': %s", discValue) } diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go index 54964957b1..1c5da33105 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go @@ -74,7 +74,8 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { // Deprecated isVPNGatewayConnectionPeerAddress: { Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, Description: "VPN gateway connection peer address", Deprecated: "peer_address is deprecated, use peer instead", }, From 01883f821ce4a68e8e45307f84d9a4ff6fa15d8f Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 8 Mar 2024 15:04:42 +0530 Subject: [PATCH 063/103] Update resource_ibm_is_vpn_gateway_connections.go --- ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go index 1c5da33105..2862881a40 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go @@ -96,7 +96,7 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { Schema: map[string]*schema.Schema{ "ike_identities": &schema.Schema{ Type: schema.TypeList, - Required: true, + Optional: true, Description: "The local IKE identities.A VPN gateway in static route mode consists of two members in active-active mode. The first identity applies to the first member, and the second identity applies to the second member.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ From ad9cc50976c5db7af9a18b3e475ff940dc8eee68 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 8 Mar 2024 15:39:58 +0530 Subject: [PATCH 064/103] Update resource_ibm_is_vpn_gateway_connections.go --- ...resource_ibm_is_vpn_gateway_connections.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go index 2862881a40..0147382763 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go @@ -502,9 +502,22 @@ func vpngwconCreate(d *schema.ResourceData, meta interface{}, name, gatewayID, p if err != nil { return fmt.Errorf("[DEBUG] Create VPN Gateway Connection err %s\n%s", err, response) } - vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection) - d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) - log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) + if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection); ok { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection) + d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) + log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) + } else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode); ok { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode) + d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) + log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) + } else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode); ok { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode) + d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) + log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) + } else { + return (fmt.Errorf("Unrecognized vpcv1.vpnGatewayConnectionIntf subtype encountered")) + } + return nil } From 487cdc1cb08e8b21c47b3f45aba14c23088724d0 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 8 Mar 2024 15:47:20 +0530 Subject: [PATCH 065/103] Update resource_ibm_is_vpn_gateway_connections.go --- ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go index 0147382763..33d450b39d 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go @@ -514,6 +514,10 @@ func vpngwconCreate(d *schema.ResourceData, meta interface{}, name, gatewayID, p vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode) d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) + } else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode); ok { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) + d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) + log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) } else { return (fmt.Errorf("Unrecognized vpcv1.vpnGatewayConnectionIntf subtype encountered")) } From afb2e0a3dd8a2881aefc6d85dcfdd2f50d6a47dc Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 14 Mar 2024 11:02:32 +0530 Subject: [PATCH 066/103] Update is_vpn_gateway_connection.html.markdown --- website/docs/r/is_vpn_gateway_connection.html.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/docs/r/is_vpn_gateway_connection.html.markdown b/website/docs/r/is_vpn_gateway_connection.html.markdown index 7e018672e9..4c4eaf68e1 100644 --- a/website/docs/r/is_vpn_gateway_connection.html.markdown +++ b/website/docs/r/is_vpn_gateway_connection.html.markdown @@ -102,7 +102,7 @@ Review the argument references that you can specify for your resource. Nested schema for **ike_identities**: - `type` - (Required, String) The IKE identity type.The enumerated values for this property will expand in the future. When processing this property, check for and log unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected property value was encountered. - `value` - (Optional, String) The IKE identity FQDN value. -- `local_cidrs` - (Optional, Forces new resource, List) List of local CIDRs for this resource. +- `local_cidrs` - (Optional, DEPRECATED, Forces new resource, List) List of local CIDRs for this resource. - `name` - (Required, String) The name of the VPN gateway connection. - `peer` - (Optional, List) Nested schema for **peer**: @@ -114,8 +114,8 @@ Review the argument references that you can specify for your resource. - `value` - (Optional, String) The IKE identity FQDN value. - `type` - (Computed, String) Indicates whether `peer.address` or `peer.fqdn` is used. -- `peer_cidrs` - (Optional, Forces new resource, List) List of peer CIDRs for this resource. -- `peer_address` - (Required, String) The IP address of the peer VPN gateway. +- `peer_cidrs` - (Optional, DEPRECATED, Forces new resource, List) List of peer CIDRs for this resource. +- `peer_address` - (Optional, DEPRECATED, String) The IP address of the peer VPN gateway. - `preshared_key` - (Required, Forces new resource, String) The preshared key. - `timeout` - (Optional, Integer) Dead peer detection timeout in seconds. Default value is 10. - `vpn_gateway` - (Required, Forces new resource, String) The unique identifier of the VPN gateway. From 3c737fda5ad6459718e310381d7f3ea6f678c92d Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 20 Mar 2024 22:39:07 +0530 Subject: [PATCH 067/103] uodated sdk --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5baeef0372..507ad67f22 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/IBM/schematics-go-sdk v0.2.3 github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4 github.com/IBM/vpc-beta-go-sdk v0.6.0 - github.com/IBM/vpc-go-sdk v0.48.0 + github.com/IBM/vpc-go-sdk v0.49.0 github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5 github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 github.com/akamai/AkamaiOPEN-edgegrid-golang/v5 v5.0.0 diff --git a/go.sum b/go.sum index 373f2c44be..00f4841e0b 100644 --- a/go.sum +++ b/go.sum @@ -174,8 +174,8 @@ github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4 h1:xa9e+POVqaXxXHXkSMCOVAbKdUNEu github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4/go.mod h1:5gq8D8uWOIbqOm1uztay6lpOysgJaxxEsaVZLWGWb40= github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQyz4uc= github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA= -github.com/IBM/vpc-go-sdk v0.48.0 h1:4yeSxVX9mizsIW2F0rsVI47rZoNKBrZ1QK9RwwRas9Q= -github.com/IBM/vpc-go-sdk v0.48.0/go.mod h1:FDJpiokOmaYG2hNYDfqKVxUPe8mm/dPi3mdz8Zt4o/Q= +github.com/IBM/vpc-go-sdk v0.49.0 h1:D7z1n+y8o3Iu6hpZx9ahkUnOqvKb1Cb+FfYsw/cjXIo= +github.com/IBM/vpc-go-sdk v0.49.0/go.mod h1:iBg9UJY1y/XpkweyP6YH7G6guzKPV8BYDoBMTdPupH4= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= From 411cc63a2973d405c684ca1449eed6e6ae81b1a5 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 26 Mar 2024 19:29:02 +0530 Subject: [PATCH 068/103] 0.50.0 breaking changes --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 7734 +++++++++-------- go.sum | 15 +- .../vpc/resource_ibm_is_lb_listener.go | 2 +- .../vpc/resource_ibm_is_lb_listener_policy.go | 14 +- 4 files changed, 4289 insertions(+), 3476 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index bbd6337f00..1f60e8f5ed 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -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-01-24 +// API Version: 2024-03-26 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 `2023-12-05` - // and `2024-03-04`. + // and `2024-03-26`. Version *string } @@ -64,7 +64,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2024-03-04`. + // and `2024-03-26`. Version *string } @@ -122,7 +122,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2024-01-24") + options.Version = core.StringPtr("2024-03-19") } service = &VpcV1{ @@ -7105,12 +7105,15 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C // ListInstanceNetworkInterfaceIps : List the primary reserved IP for an instance network interface // This request lists the primary reserved IP for an instance network interface. +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) } // ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceIps") err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") if err != nil { return @@ -7175,12 +7178,15 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context // GetInstanceNetworkInterfaceIP : Retrieve the primary reserved IP // This request retrieves the primary reserved IP for an instance network interface. +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { return vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) } // GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceIP") err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") if err != nil { return @@ -10645,16 +10651,15 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi return } -// ListBackupPolicies : List all backup policies -// This request lists all backup policies in the region. Backup policies control which sources are selected for backup -// and include a set of backup policy plans that provide the backup schedules and deletion triggers. -func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) +// ListPlacementGroups : List all placement groups +// This request lists all placement groups in the region. +func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) } -// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter -func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") +// ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter +func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") if err != nil { return } @@ -10662,16 +10667,16 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) if err != nil { return } - for headerName, headerValue := range listBackupPoliciesOptions.Headers { + for headerName, headerValue := range listPlacementGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -10679,20 +10684,11 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBackupPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) - } - if listBackupPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) - } - if listBackupPoliciesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) - } - if listBackupPoliciesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) + if listPlacementGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) } - if listBackupPoliciesOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) + if listPlacementGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.Limit)) } request, err := builder.Build() @@ -10706,7 +10702,7 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) if err != nil { return } @@ -10716,20 +10712,19 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP return } -// CreateBackupPolicy : Create a backup policy -// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in -// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. -func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) +// CreatePlacementGroup : Create a placement group +// This request creates a new placement group. +func (vpc *VpcV1) CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + return vpc.CreatePlacementGroupWithContext(context.Background(), createPlacementGroupOptions) } -// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") +// CreatePlacementGroupWithContext is an alternate form of the CreatePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPlacementGroupOptions, "createPlacementGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") + err = core.ValidateStruct(createPlacementGroupOptions, "createPlacementGroupOptions") if err != nil { return } @@ -10737,16 +10732,16 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) if err != nil { return } - for headerName, headerValue := range createBackupPolicyOptions.Headers { + for headerName, headerValue := range createPlacementGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePlacementGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -10756,7 +10751,17 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createBackupPolicyOptions.BackupPolicyPrototype) + body := make(map[string]interface{}) + if createPlacementGroupOptions.Strategy != nil { + body["strategy"] = createPlacementGroupOptions.Strategy + } + if createPlacementGroupOptions.Name != nil { + body["name"] = createPlacementGroupOptions.Name + } + if createPlacementGroupOptions.ResourceGroup != nil { + body["resource_group"] = createPlacementGroupOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } @@ -10772,7 +10777,7 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) if err != nil { return } @@ -10782,129 +10787,92 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku return } -// ListBackupPolicyJobs : List all jobs for a backup policy -// This request retrieves all jobs for a backup policy. A backup job represents the execution of a backup policy plan -// for a resource matching the policy's criteria. -func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) +// DeletePlacementGroup : Delete a placement group +// This request deletes a placement group. This operation cannot be reversed. For this request to succeed, the placement +// group must not be associated with an instance. +func (vpc *VpcV1) DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeletePlacementGroupWithContext(context.Background(), deletePlacementGroupOptions) } -// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter -func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") +// DeletePlacementGroupWithContext is an alternate form of the DeletePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePlacementGroupOptions, "deletePlacementGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") + err = core.ValidateStruct(deletePlacementGroupOptions, "deletePlacementGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, + "id": *deletePlacementGroupOptions.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, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { + for headerName, headerValue := range deletePlacementGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePlacementGroup") 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 listBackupPolicyJobsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) - } - if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) - } - if listBackupPolicyJobsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) - } - if listBackupPolicyJobsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) - } - if listBackupPolicyJobsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) - } - if listBackupPolicyJobsOptions.SourceID != nil { - builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) - } - if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { - builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) - } - if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { - builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) - } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// GetBackupPolicyJob : Retrieve a backup policy job -// This request retrieves a single backup policy job specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - return vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) +// GetPlacementGroup : Retrieve a placement group +// This request retrieves a single placement group specified by identifier in the URL. +func (vpc *VpcV1) GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + return vpc.GetPlacementGroupWithContext(context.Background(), getPlacementGroupOptions) } -// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") +// GetPlacementGroupWithContext is an alternate form of the GetPlacementGroup method which supports a Context parameter +func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPlacementGroupOptions, "getPlacementGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") + err = core.ValidateStruct(getPlacementGroupOptions, "getPlacementGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, - "id": *getBackupPolicyJobOptions.ID, + "id": *getPlacementGroupOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBackupPolicyJobOptions.Headers { + for headerName, headerValue := range getPlacementGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPlacementGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -10924,7 +10892,7 @@ func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPo return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) if err != nil { return } @@ -10934,49 +10902,53 @@ func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPo return } -// ListBackupPolicyPlans : List all plans for a backup policy -// This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. -func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) +// UpdatePlacementGroup : Update a placement group +// This request updates a placement group with the information provided placement group patch. The placement group patch +// object is structured in the same way as a retrieved placement group and contains only the information to be updated. +func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + return vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) } -// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter -func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") +// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") + err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, + "id": *updatePlacementGroupOptions.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, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { + for headerName, headerValue := range updatePlacementGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") 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 listBackupPolicyPlansOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) + + _, err = builder.SetBodyContentJSON(updatePlacementGroupOptions.PlacementGroupPatch) + if err != nil { + return } request, err := builder.Build() @@ -10990,7 +10962,7 @@ func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBack return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) if err != nil { return } @@ -11000,84 +10972,46 @@ func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBack return } -// CreateBackupPolicyPlan : Create a plan for a backup policy -// This request creates a new backup policy plan from a backup policy plan prototype object. The prototype object is -// structured in the same way as a retrieved backup policy plan, and contains the information necessary to create the -// new backup policy plan. -// -// Backups created by this plan will use the resource group of the source being backed up. -// -// Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character -// suffix. -func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) +// ListBareMetalServerProfiles : List all bare metal server profiles +// This request lists all [bare metal server +// profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) available in the region. A bare metal +// server profile specifies the performance characteristics and pricing model for a bare metal server. +func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) } -// CreateBackupPolicyPlanWithContext is an alternate form of the CreateBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") +// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID, - } - - 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, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles`, nil) if err != nil { return } - for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") 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 createBackupPolicyPlanOptions.CronSpec != nil { - body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec - } - if createBackupPolicyPlanOptions.Active != nil { - body["active"] = createBackupPolicyPlanOptions.Active - } - if createBackupPolicyPlanOptions.AttachUserTags != nil { - body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags - } - if createBackupPolicyPlanOptions.ClonePolicy != nil { - body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy - } - if createBackupPolicyPlanOptions.CopyUserTags != nil { - body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags - } - if createBackupPolicyPlanOptions.DeletionTrigger != nil { - body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger - } - if createBackupPolicyPlanOptions.Name != nil { - body["name"] = createBackupPolicyPlanOptions.Name - } - if createBackupPolicyPlanOptions.RemoteRegionPolicies != nil { - body["remote_region_policies"] = createBackupPolicyPlanOptions.RemoteRegionPolicies + if listBareMetalServerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return + if listBareMetalServerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.Limit)) } request, err := builder.Build() @@ -11091,7 +11025,7 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) if err != nil { return } @@ -11101,53 +11035,44 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB return } -// DeleteBackupPolicyPlan : Delete a backup policy plan -// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by -// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with -// the plan will run to completion before the plan is deleted. -// -// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing -// completes, the backup policy plan will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) +// GetBareMetalServerProfile : Retrieve a bare metal server profile +// This request retrieves a single bare metal server profile specified by the name in the URL. +func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) } -// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") +// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") + err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") if err != nil { return } pathParamsMap := map[string]string{ - "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, - "id": *deleteBackupPolicyPlanOptions.ID, + "name": *getBareMetalServerProfileOptions.Name, } - 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, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles/{name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -11163,7 +11088,7 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) if err != nil { return } @@ -11173,41 +11098,32 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB return } -// GetBackupPolicyPlan : Retrieve a backup policy plan -// This request retrieves a single backup policy plan specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) +// ListBareMetalServers : List all bare metal servers +// This request lists all bare metal servers in the region. +func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) } -// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") +// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, - "id": *getBackupPolicyPlanOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) if err != nil { return } - for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range listBareMetalServersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11215,6 +11131,27 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) + } + if listBareMetalServersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) + } + if listBareMetalServersOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) + } + if listBareMetalServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) + } + if listBareMetalServersOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) + } + if listBareMetalServersOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) + } + if listBareMetalServersOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) + } request, err := builder.Build() if err != nil { @@ -11227,7 +11164,7 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) if err != nil { return } @@ -11237,55 +11174,48 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP return } -// UpdateBackupPolicyPlan : Update a backup policy plan -// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is -// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) +// CreateBareMetalServer : Create a bare metal server +// This request provisions a new bare metal server from a prototype object. The prototype object is structured in the +// same way as a retrieved bare metal server, and contains the information necessary to provision the new bare metal +// server. The bare metal server is automatically started. +func (vpc *VpcV1) CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerWithContext(context.Background(), createBareMetalServerOptions) } -// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") +// CreateBareMetalServerWithContext is an alternate form of the CreateBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerOptions, "createBareMetalServerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") + err = core.ValidateStruct(createBareMetalServerOptions, "createBareMetalServerOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, - "id": *updateBackupPolicyPlanOptions.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, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) if err != nil { return } - for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range createBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) - } + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) + _, err = builder.SetBodyContentJSON(createBareMetalServerOptions.BareMetalServerPrototype) if err != nil { return } @@ -11301,7 +11231,7 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) if err != nil { return } @@ -11311,54 +11241,64 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB return } -// DeleteBackupPolicy : Delete a backup policy -// This request deletes a backup policy. This operation cannot be reversed. -// -// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, -// the backup policy will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) +// CreateBareMetalServerConsoleAccessToken : Create a console access token for a bare metal server +// This request creates a new single-use console access token for a bare metal server. All console configuration is +// provided at token create time, and the token is subsequently used in the `access_token` query parameter for the +// WebSocket request. The access token is only valid for a short period of time, and a maximum of one token is valid +// for a given bare metal server at a time. +func (vpc *VpcV1) CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerConsoleAccessTokenWithContext(context.Background(), createBareMetalServerConsoleAccessTokenOptions) } -// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") +// CreateBareMetalServerConsoleAccessTokenWithContext is an alternate form of the CreateBareMetalServerConsoleAccessToken method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context.Context, createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") + err = core.ValidateStruct(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteBackupPolicyOptions.ID, + "bare_metal_server_id": *createBareMetalServerConsoleAccessTokenOptions.BareMetalServerID, } - 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, `/backup_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/console_access_token`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteBackupPolicyOptions.Headers { + for headerName, headerValue := range createBareMetalServerConsoleAccessTokenOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerConsoleAccessToken") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) - } + 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 createBareMetalServerConsoleAccessTokenOptions.ConsoleType != nil { + body["console_type"] = createBareMetalServerConsoleAccessTokenOptions.ConsoleType + } + if createBareMetalServerConsoleAccessTokenOptions.Force != nil { + body["force"] = createBareMetalServerConsoleAccessTokenOptions.Force + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -11370,7 +11310,7 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerConsoleAccessToken) if err != nil { return } @@ -11380,40 +11320,42 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku return } -// GetBackupPolicy : Retrieve a backup policy -// This request retrieves a single backup policy specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) +// ListBareMetalServerDisks : List all disks on a bare metal server +// This request lists all disks on a bare metal server. A disk is a block device that is locally attached to the +// physical server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk +// first. +func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) } -// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") +// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") + err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getBackupPolicyOptions.ID, + "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBackupPolicyOptions.Headers { + for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11433,7 +11375,7 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) if err != nil { return } @@ -11443,54 +11385,115 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic return } -// UpdateBackupPolicy : Update a backup policy -// This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch -// object is structured in the same way as a retrieved backup policy and contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) +// GetBareMetalServerDisk : Retrieve a bare metal server disk +// This request retrieves a single disk specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) } -// UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") +// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") + err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateBackupPolicyOptions.ID, + "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, + "id": *getBareMetalServerDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") + 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 { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateBareMetalServerDisk : Update a bare metal server disk +// This request updates the bare metal server disk with the information in a provided patch. +func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) +} + +// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, + "id": *updateBareMetalServerDiskOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateBackupPolicyOptions.Headers { + for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateBackupPolicyOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) + _, err = builder.SetBodyContentJSON(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) if err != nil { return } @@ -11506,7 +11509,7 @@ func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBacku return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) if err != nil { return } @@ -11516,32 +11519,47 @@ func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBacku return } -// ListPlacementGroups : List all placement groups -// This request lists all placement groups in the region. -func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) +// ListBareMetalServerNetworkAttachments : List all network attachments on a bare metal server +// This request lists all network attachments on a bare metal server. A bare metal server network attachment is an +// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network +// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to +// the bare metal server. +// +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) } -// ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter -func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") +// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listPlacementGroupsOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11549,11 +11567,11 @@ func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacem builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listPlacementGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) + if listBareMetalServerNetworkAttachmentsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) } - if listPlacementGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.Limit)) + if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) } request, err := builder.Build() @@ -11567,7 +11585,7 @@ func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacem return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) if err != nil { return } @@ -11577,36 +11595,42 @@ func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacem return } -// CreatePlacementGroup : Create a placement group -// This request creates a new placement group. -func (vpc *VpcV1) CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - return vpc.CreatePlacementGroupWithContext(context.Background(), createPlacementGroupOptions) +// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server +// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and +// contains the information necessary to create the new bare metal server network attachment. +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) } -// CreatePlacementGroupWithContext is an alternate form of the CreatePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createPlacementGroupOptions, "createPlacementGroupOptions cannot be nil") +// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createPlacementGroupOptions, "createPlacementGroupOptions") + err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createPlacementGroupOptions.Headers { + for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePlacementGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11616,17 +11640,7 @@ func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPla builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createPlacementGroupOptions.Strategy != nil { - body["strategy"] = createPlacementGroupOptions.Strategy - } - if createPlacementGroupOptions.Name != nil { - body["name"] = createPlacementGroupOptions.Name - } - if createPlacementGroupOptions.ResourceGroup != nil { - body["resource_group"] = createPlacementGroupOptions.ResourceGroup - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) if err != nil { return } @@ -11642,7 +11656,7 @@ func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPla return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { return } @@ -11652,41 +11666,44 @@ func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPla return } -// DeletePlacementGroup : Delete a placement group -// This request deletes a placement group. This operation cannot be reversed. For this request to succeed, the placement -// group must not be associated with an instance. -func (vpc *VpcV1) DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { - return vpc.DeletePlacementGroupWithContext(context.Background(), deletePlacementGroupOptions) +// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment +// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network attachment are implicitly disassociated. +// +// The bare metal server's primary network attachment cannot be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) } -// DeletePlacementGroupWithContext is an alternate form of the DeletePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deletePlacementGroupOptions, "deletePlacementGroupOptions cannot be nil") +// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deletePlacementGroupOptions, "deletePlacementGroupOptions") + err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deletePlacementGroupOptions.ID, + "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkAttachmentOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deletePlacementGroupOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePlacementGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11704,40 +11721,41 @@ func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePla return } -// GetPlacementGroup : Retrieve a placement group -// This request retrieves a single placement group specified by identifier in the URL. -func (vpc *VpcV1) GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - return vpc.GetPlacementGroupWithContext(context.Background(), getPlacementGroupOptions) +// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment +// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) } -// GetPlacementGroupWithContext is an alternate form of the GetPlacementGroup method which supports a Context parameter -func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPlacementGroupOptions, "getPlacementGroupOptions cannot be nil") +// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getPlacementGroupOptions, "getPlacementGroupOptions") + err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getPlacementGroupOptions.ID, + "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkAttachmentOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getPlacementGroupOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPlacementGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11757,7 +11775,7 @@ func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacement return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { return } @@ -11767,41 +11785,43 @@ func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacement return } -// UpdatePlacementGroup : Update a placement group -// This request updates a placement group with the information provided placement group patch. The placement group patch -// object is structured in the same way as a retrieved placement group and contains only the information to be updated. -func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - return vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) +// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment +// This request updates a bare metal server network attachment with the information provided in a bare metal server +// network attachment patch object. The bare metal server network attachment patch object is structured in the same way +// as a retrieved bare metal server network attachment and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) } -// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") +// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") + err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updatePlacementGroupOptions.ID, + "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkAttachmentOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updatePlacementGroupOptions.Headers { + for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11811,7 +11831,7 @@ func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePla builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updatePlacementGroupOptions.PlacementGroupPatch) + _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) if err != nil { return } @@ -11827,7 +11847,7 @@ func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePla return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { return } @@ -11837,34 +11857,47 @@ func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePla return } -// ListBareMetalServerProfiles : List all bare metal server profiles -// This request lists all [bare metal server -// profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) available in the region. A bare metal -// server profile specifies the performance characteristics and pricing model for a bare metal server. -func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) +// ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server +// This request lists all network interfaces on a bare metal server. A bare metal server network interface is an +// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network +// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to +// the bare metal server. +// +// If this bare metal server has network attachments, each returned 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. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) } -// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") +// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11872,11 +11905,11 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServerProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) + if listBareMetalServerNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) } - if listBareMetalServerProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.Limit)) + if listBareMetalServerNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Limit)) } request, err := builder.Build() @@ -11890,7 +11923,7 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) if err != nil { return } @@ -11900,48 +11933,62 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li return } -// GetBareMetalServerProfile : Retrieve a bare metal server profile -// This request retrieves a single bare metal server profile specified by the name in the URL. -func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) +// CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server +// This request creates a new bare metal server network interface from a bare metal server network interface prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network interface, and +// contains the information necessary to create the new bare metal server network interface. Any subnet in the bare +// metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. +// Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. +// +// 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, and new network interfaces are not allowed to be created. +func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) } -// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") +// CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") + err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "name": *getBareMetalServerProfileOptions.Name, + "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, } - 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, `/bare_metal_server/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { + for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") 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(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -11953,7 +12000,7 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { return } @@ -11963,128 +12010,111 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB return } -// ListBareMetalServers : List all bare metal servers -// This request lists all bare metal servers in the region. -func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) +// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface +// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server +// network interface is not allowed to be deleted. +// +// 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 is not allowed to be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) } -// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") +// DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBareMetalServersOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") 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 listBareMetalServersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) - } - if listBareMetalServersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) - } - if listBareMetalServersOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) - } - if listBareMetalServersOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) - } - if listBareMetalServersOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) - } - if listBareMetalServersOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) - } - if listBareMetalServersOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) - } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// CreateBareMetalServer : Create a bare metal server -// This request provisions a new bare metal server from a prototype object. The prototype object is structured in the -// same way as a retrieved bare metal server, and contains the information necessary to provision the new bare metal -// server. The bare metal server is automatically started. -func (vpc *VpcV1) CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerWithContext(context.Background(), createBareMetalServerOptions) +// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface +// This request retrieves a single bare metal server network interface specified by the identifier in the URL. +// +// If this bare metal server has network attachments, the retrieved 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. +func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) } -// CreateBareMetalServerWithContext is an alternate form of the CreateBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerOptions, "createBareMetalServerOptions cannot be nil") +// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createBareMetalServerOptions, "createBareMetalServerOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createBareMetalServerOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") 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(createBareMetalServerOptions.BareMetalServerPrototype) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -12096,7 +12126,7 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { return } @@ -12106,60 +12136,57 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa return } -// CreateBareMetalServerConsoleAccessToken : Create a console access token for a bare metal server -// This request creates a new single-use console access token for a bare metal server. All console configuration is -// provided at token create time, and the token is subsequently used in the `access_token` query parameter for the -// WebSocket request. The access token is only valid for a short period of time, and a maximum of one token is valid -// for a given bare metal server at a time. -func (vpc *VpcV1) CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerConsoleAccessTokenWithContext(context.Background(), createBareMetalServerConsoleAccessTokenOptions) +// UpdateBareMetalServerNetworkInterface : Update a bare metal server network interface +// This request updates a bare metal server network interface with the information provided in a bare metal server +// network interface patch object. The bare metal server network interface patch object is structured in the same way as +// a retrieved bare metal server network interface and needs to contain only the information to be updated. +// +// 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 is not allowed to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) } -// CreateBareMetalServerConsoleAccessTokenWithContext is an alternate form of the CreateBareMetalServerConsoleAccessToken method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context.Context, createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions cannot be nil") +// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions") + err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerConsoleAccessTokenOptions.BareMetalServerID, + "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkInterfaceOptions.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, `/bare_metal_servers/{bare_metal_server_id}/console_access_token`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createBareMetalServerConsoleAccessTokenOptions.Headers { + for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerConsoleAccessToken") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") 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 createBareMetalServerConsoleAccessTokenOptions.ConsoleType != nil { - body["console_type"] = createBareMetalServerConsoleAccessTokenOptions.ConsoleType - } - if createBareMetalServerConsoleAccessTokenOptions.Force != nil { - body["force"] = createBareMetalServerConsoleAccessTokenOptions.Force - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) if err != nil { return } @@ -12175,7 +12202,7 @@ func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerConsoleAccessToken) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { return } @@ -12185,42 +12212,41 @@ func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context return } -// ListBareMetalServerDisks : List all disks on a bare metal server -// This request lists all disks on a bare metal server. A disk is a block device that is locally attached to the -// physical server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk -// first. -func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) -} +// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a bare metal server network interface +// This request lists all floating IPs associated with a bare metal server network interface. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) +} -// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") +// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12240,7 +12266,7 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) if err != nil { return } @@ -12250,41 +12276,96 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB return } -// GetBareMetalServerDisk : Retrieve a bare metal server disk -// This request retrieves a single disk specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) +// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface +// This request disassociates the specified floating IP from the specified bare metal server network interface. +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) } -// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") +// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") + err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, - "id": *getBareMetalServerDiskOptions.ID, + "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") + 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 { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP if it is associated with the bare metal server network interface +// specified in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) +} + +// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12304,7 +12385,7 @@ func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBare return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { return } @@ -12314,55 +12395,58 @@ func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBare return } -// UpdateBareMetalServerDisk : Update a bare metal server disk -// This request updates the bare metal server disk with the information in a provided patch. -func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) +// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface +// This request associates the specified floating IP with the specified bare metal server network interface. If +// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` +// is `true`, this replaces any existing association. +// +// The existing floating IP must: +// - not be required by another resource, such as a public gateway +// - be in the same `zone` as the bare metal server +// +// A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) } -// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") +// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") + err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, - "id": *updateBareMetalServerDiskOptions.ID, + "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.ID, } - 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, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { + for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") 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(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -12374,7 +12458,7 @@ func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, upda return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { return } @@ -12384,47 +12468,44 @@ func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, upda return } -// ListBareMetalServerNetworkAttachments : List all network attachments on a bare metal server -// This request lists all network attachments on a bare metal server. A bare metal server network attachment is an -// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network -// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to -// the bare metal server. -// -// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. -// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property -// values. -func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) +// ListBareMetalServerNetworkInterfaceIps : List the primary reserved IP for a bare metal server network interface +// This request lists the primary reserved IP for a bare metal server network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { + return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) } -// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") +// ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListBareMetalServerNetworkInterfaceIps") + err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceIpsOptions.NetworkInterfaceID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkInterfaceIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12432,12 +12513,6 @@ func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.C builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServerNetworkAttachmentsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) - } - if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -12450,7 +12525,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.C return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext) if err != nil { return } @@ -12460,56 +12535,53 @@ func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.C return } -// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server -// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype -// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and -// contains the information necessary to create the new bare metal server network attachment. -func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) +// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for a bare metal server network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) } -// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") +// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP") + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceIPOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") 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(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -12521,7 +12593,7 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context. return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { return } @@ -12531,44 +12603,41 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context. return } -// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment -// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs -// associated with the bare metal server network attachment are implicitly disassociated. -// -// The bare metal server's primary network attachment cannot be deleted. -func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) +// DeleteBareMetalServer : Delete a bare metal server +// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the +// bare metal server network interfaces are implicitly disassociated. +func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) } -// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") +// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *deleteBareMetalServerNetworkAttachmentOptions.ID, + "id": *deleteBareMetalServerOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12586,41 +12655,40 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context. return } -// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment -// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) +// GetBareMetalServer : Retrieve a bare metal server +// This request retrieves a single bare metal server specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) } -// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") +// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *getBareMetalServerNetworkAttachmentOptions.ID, + "id": *getBareMetalServerOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range getBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12640,7 +12708,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Con return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) if err != nil { return } @@ -12650,43 +12718,41 @@ func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Con return } -// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment -// This request updates a bare metal server network attachment with the information provided in a bare metal server -// network attachment patch object. The bare metal server network attachment patch object is structured in the same way -// as a retrieved bare metal server network attachment and contains only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) +// UpdateBareMetalServer : Update a bare metal server +// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object +// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + return vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) } -// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") +// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *updateBareMetalServerNetworkAttachmentOptions.ID, + "id": *updateBareMetalServerOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range updateBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12696,7 +12762,7 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) + _, err = builder.SetBodyContentJSON(updateBareMetalServerOptions.BareMetalServerPatch) if err != nil { return } @@ -12712,7 +12778,7 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) if err != nil { return } @@ -12722,47 +12788,42 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. return } -// ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server -// This request lists all network interfaces on a bare metal server. A bare metal server network interface is an -// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network -// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to -// the bare metal server. -// -// If this bare metal server has network attachments, each returned 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. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) +// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server +// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and +// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be +// current. +func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + return vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) } -// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") +// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") + err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, + "id": *getBareMetalServerInitializationOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { + for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12770,12 +12831,6 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServerNetworkInterfacesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) - } - if listBareMetalServerNetworkInterfacesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -12788,7 +12843,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) if err != nil { return } @@ -12798,124 +12853,91 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co return } -// CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server -// This request creates a new bare metal server network interface from a bare metal server network interface prototype -// object. The prototype object is structured in the same way as a retrieved bare metal server network interface, and -// contains the information necessary to create the new bare metal server network interface. Any subnet in the bare -// metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. -// Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. -// -// 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, and new network interfaces are not allowed to be created. -func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) +// RestartBareMetalServer : Restart a bare metal server +// This request restarts a bare metal server. It will run immediately regardless of the state of the server. +func (vpc *VpcV1) RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.RestartBareMetalServerWithContext(context.Background(), restartBareMetalServerOptions) } -// CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") +// RestartBareMetalServerWithContext is an alternate form of the RestartBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(restartBareMetalServerOptions, "restartBareMetalServerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(restartBareMetalServerOptions, "restartBareMetalServerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *restartBareMetalServerOptions.ID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/restart`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range restartBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RestartBareMetalServer") 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(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface -// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs -// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server -// network interface is not allowed to be deleted. -// -// 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 is not allowed to be deleted. -func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) +// StartBareMetalServer : Start a bare metal server +// This request starts a bare metal server. It will run immediately provided the server is stopped. +func (vpc *VpcV1) StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.StartBareMetalServerWithContext(context.Background(), startBareMetalServerOptions) } -// DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") +// StartBareMetalServerWithContext is an alternate form of the StartBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(startBareMetalServerOptions, "startBareMetalServerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(startBareMetalServerOptions, "startBareMetalServerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *deleteBareMetalServerNetworkInterfaceOptions.ID, + "id": *startBareMetalServerOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/start`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range startBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StartBareMetalServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12933,127 +12955,107 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface -// This request retrieves a single bare metal server network interface specified by the identifier in the URL. -// -// If this bare metal server has network attachments, the retrieved 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. -func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) +// StopBareMetalServer : Stop a bare metal server +// This request stops a bare metal server. It will run immediately provided the server is running. Note: A soft stop may +// not complete as it relies on the operating system to perform the operation. +func (vpc *VpcV1) StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { + return vpc.StopBareMetalServerWithContext(context.Background(), stopBareMetalServerOptions) } -// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") +// StopBareMetalServerWithContext is an alternate form of the StopBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(stopBareMetalServerOptions, "stopBareMetalServerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(stopBareMetalServerOptions, "stopBareMetalServerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *getBareMetalServerNetworkInterfaceOptions.ID, + "id": *stopBareMetalServerOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/stop`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range stopBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StopBareMetalServer") 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)) - request, err := builder.Build() + body := make(map[string]interface{}) + if stopBareMetalServerOptions.Type != nil { + body["type"] = stopBareMetalServerOptions.Type + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + request, err := builder.Build() if err != nil { return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) - if err != nil { - return - } - response.Result = result - } - return -} + response, err = vpc.Service.Request(request, nil) -// UpdateBareMetalServerNetworkInterface : Update a bare metal server network interface -// This request updates a bare metal server network interface with the information provided in a bare metal server -// network interface patch object. The bare metal server network interface patch object is structured in the same way as -// a retrieved bare metal server network interface and needs to contain only the information to be updated. -// -// 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 is not allowed to be updated. -func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) + return } -// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") +// ListVolumeProfiles : List all volume profiles +// This request lists all [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available +// in the region. A volume profile specifies the performance characteristics and pricing model for a volume. +func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) +} + +// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter +func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *updateBareMetalServerNetworkInterfaceOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles`, nil) if err != nil { return } - for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range listVolumeProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") 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(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) - if err != nil { - return + if listVolumeProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) + } + if listVolumeProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) } request, err := builder.Build() @@ -13067,7 +13069,7 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) if err != nil { return } @@ -13077,41 +13079,40 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a bare metal server network interface -// This request lists all floating IPs associated with a bare metal server network interface. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) +// GetVolumeProfile : Retrieve a volume profile +// This request retrieves a single volume profile specified by the name in the URL. +func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + return vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) } -// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") +// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter +func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") + err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, - "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, + "name": *getVolumeProfileOptions.Name, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles/{name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { + for headerName, headerValue := range getVolumeProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13131,7 +13132,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) if err != nil { return } @@ -13141,104 +13142,134 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx return } -// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface -// This request disassociates the specified floating IP from the specified bare metal server network interface. -func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) +// ListVolumes : List all volumes +// This request lists all volumes in the region. Volumes are network-connected block storage devices that may be +// attached to one or more instances in the same region. +func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + return vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) } -// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") +// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter +func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) if err != nil { return } - for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listVolumesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") 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 listVolumesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) + } + if listVolumesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) + } + if listVolumesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) + } + if listVolumesOptions.AttachmentState != nil { + builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) + } + if listVolumesOptions.Encryption != nil { + builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) + } + if listVolumesOptions.OperatingSystemFamily != nil { + builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) + } + if listVolumesOptions.OperatingSystemArchitecture != nil { + builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) + } + if listVolumesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) + } + if listVolumesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) + } request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP if it is associated with the bare metal server network interface -// specified in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) +// CreateVolume : Create a volume +// This request creates a new volume from a volume prototype object. The prototype object is structured in the same way +// as a retrieved volume, and contains the information necessary to create the new volume. +func (vpc *VpcV1) CreateVolume(createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions) } -// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") +// CreateVolumeWithContext is an alternate form of the CreateVolume method which supports a Context parameter +func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVolumeOptions, "createVolumeOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) if err != nil { return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range createVolumeOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") 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(createVolumeOptions.VolumePrototype) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -13250,7 +13281,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) if err != nil { return } @@ -13260,54 +13291,47 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } -// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface -// This request associates the specified floating IP with the specified bare metal server network interface. If -// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` -// is `true`, this replaces any existing association. -// -// The existing floating IP must: -// - not be required by another resource, such as a public gateway -// - be in the same `zone` as the bare metal server -// -// A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) +// DeleteVolume : Delete a volume +// This request deletes a volume. This operation cannot be reversed. For this request to succeed, the volume must not be +// attached to any instances. +func (vpc *VpcV1) DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions) } -// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") +// DeleteVolumeWithContext is an alternate form of the DeleteVolume method which supports a Context parameter +func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVolumeOptions, "deleteVolumeOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + "id": *deleteVolumeOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range deleteVolumeOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") + if deleteVolumeOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVolumeOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -13317,57 +13341,45 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListBareMetalServerNetworkInterfaceIps : List the primary reserved IP for a bare metal server network interface -// This request lists the primary reserved IP for a bare metal server network interface. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) +// GetVolume : Retrieve a volume +// This request retrieves a single volume specified by the identifier in the URL. +func (vpc *VpcV1) GetVolume(getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.GetVolumeWithContext(context.Background(), getVolumeOptions) } -// ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") +// GetVolumeWithContext is an alternate form of the GetVolume method which supports a Context parameter +func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeOptions, "getVolumeOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions") + err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfaceIpsOptions.BareMetalServerID, - "network_interface_id": *listBareMetalServerNetworkInterfaceIpsOptions.NetworkInterfaceID, + "id": *getVolumeOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listBareMetalServerNetworkInterfaceIpsOptions.Headers { + for headerName, headerValue := range getVolumeOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13387,7 +13399,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) if err != nil { return } @@ -13397,50 +13409,58 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. return } -// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP -// This request retrieves the primary reserved IP for a bare metal server network interface. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) +// UpdateVolume : Update a volume +// This request updates a volume with the information in a provided volume patch. The volume patch object is structured +// in the same way as a retrieved volume and contains only the information to be updated. +func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) } -// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") +// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter +func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") + err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") if err != nil { return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceIPOptions.ID, + "id": *updateVolumeOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { + for headerName, headerValue := range updateVolumeOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVolumeOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -13452,7 +13472,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) if err != nil { return } @@ -13462,100 +13482,126 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co return } -// DeleteBareMetalServer : Delete a bare metal server -// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the -// bare metal server network interfaces are implicitly disassociated. -func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) +// ListSnapshotConsistencyGroups : List all snapshot consistency groups +// This request lists all snapshot consistency groups in the region. A snapshot consistency group is a collection of +// individual snapshots taken at the same time. +func (vpc *VpcV1) ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions) } -// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") +// ListSnapshotConsistencyGroupsWithContext is an alternate form of the ListSnapshotConsistencyGroups method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSnapshotConsistencyGroupsOptions, "listSnapshotConsistencyGroupsOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *deleteBareMetalServerOptions.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, `/bare_metal_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) if err != nil { return } - for headerName, headerValue := range deleteBareMetalServerOptions.Headers { + for headerName, headerValue := range listSnapshotConsistencyGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups") 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 listSnapshotConsistencyGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Start)) + } + if listSnapshotConsistencyGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Limit)) + } + if listSnapshotConsistencyGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.ResourceGroupID)) + } + if listSnapshotConsistencyGroupsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Name)) + } + if listSnapshotConsistencyGroupsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Sort)) + } + if listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID)) + } request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroupCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetBareMetalServer : Retrieve a bare metal server -// This request retrieves a single bare metal server specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) +// CreateSnapshotConsistencyGroup : Create a snapshot consistency group +// This request creates a new snapshot consistency group from a snapshot consistency group object. The prototype object +// is structured in the same way as a retrieved consistency group, and contains the information necessary to provision +// the new snapshot consistency group. +func (vpc *VpcV1) CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + return vpc.CreateSnapshotConsistencyGroupWithContext(context.Background(), createSnapshotConsistencyGroupOptions) } -// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") +// CreateSnapshotConsistencyGroupWithContext is an alternate form of the CreateSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") + err = core.ValidateStruct(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *getBareMetalServerOptions.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, `/bare_metal_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) if err != nil { return } - for headerName, headerValue := range getBareMetalServerOptions.Headers { + for headerName, headerValue := range createSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup") 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(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -13567,7 +13613,7 @@ func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMeta return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { return } @@ -13577,55 +13623,49 @@ func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMeta return } -// UpdateBareMetalServer : Update a bare metal server -// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object -// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) +// DeleteSnapshotConsistencyGroup : Delete a snapshot consistency group +// This request deletes snapshot consistency group. This operation cannot be reversed. If the +// `delete_snapshots_on_delete` property is `true`, all snapshots in the consistency group will also be deleted. +func (vpc *VpcV1) DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotConsistencyGroupWithContext(context.Background(), deleteSnapshotConsistencyGroupOptions) } -// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") +// DeleteSnapshotConsistencyGroupWithContext is an alternate form of the DeleteSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") + err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateBareMetalServerOptions.ID, + "id": *deleteSnapshotConsistencyGroupOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateBareMetalServerOptions.Headers { + for headerName, headerValue := range deleteSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotConsistencyGroup") 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(updateBareMetalServerOptions.BareMetalServerPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -13637,7 +13677,7 @@ func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBa return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { return } @@ -13647,42 +13687,40 @@ func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBa return } -// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server -// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and -// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be -// current. -func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) +// GetSnapshotConsistencyGroup : Retrieve a snapshot consistency group +// This request retrieves a single snapshot consistency group specified by the identifier in the URL. +func (vpc *VpcV1) GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + return vpc.GetSnapshotConsistencyGroupWithContext(context.Background(), getSnapshotConsistencyGroupOptions) } -// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") +// GetSnapshotConsistencyGroupWithContext is an alternate form of the GetSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") + err = core.ValidateStruct(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getBareMetalServerInitializationOptions.ID, + "id": *getSnapshotConsistencyGroupOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { + for headerName, headerValue := range getSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13702,7 +13740,7 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { return } @@ -13712,97 +13750,117 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex return } -// RestartBareMetalServer : Restart a bare metal server -// This request restarts a bare metal server. It will run immediately regardless of the state of the server. -func (vpc *VpcV1) RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.RestartBareMetalServerWithContext(context.Background(), restartBareMetalServerOptions) +// UpdateSnapshotConsistencyGroup : Update a snapshot consistency group +// This request updates a snapshot consistency group with the information in a provided snapshot consistency group +// patch. The snapshot consistency group patch object is structured in the same way as a retrieved snapshot consistency +// group and contains only the information to be updated. +func (vpc *VpcV1) UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateSnapshotConsistencyGroupWithContext(context.Background(), updateSnapshotConsistencyGroupOptions) } -// RestartBareMetalServerWithContext is an alternate form of the RestartBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(restartBareMetalServerOptions, "restartBareMetalServerOptions cannot be nil") +// UpdateSnapshotConsistencyGroupWithContext is an alternate form of the UpdateSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(restartBareMetalServerOptions, "restartBareMetalServerOptions") + err = core.ValidateStruct(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *restartBareMetalServerOptions.ID, + "id": *updateSnapshotConsistencyGroupOptions.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, `/bare_metal_servers/{id}/restart`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range restartBareMetalServerOptions.Headers { + for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RestartBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateSnapshotConsistencyGroupOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotConsistencyGroupOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() + _, err = builder.SetBodyContentJSON(updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch) if err != nil { return } - response, err = vpc.Service.Request(request, nil) + request, err := builder.Build() + if err != nil { + return + } - return -} + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + if err != nil { + return + } + response.Result = result + } -// StartBareMetalServer : Start a bare metal server -// This request starts a bare metal server. It will run immediately provided the server is stopped. -func (vpc *VpcV1) StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.StartBareMetalServerWithContext(context.Background(), startBareMetalServerOptions) + return } -// StartBareMetalServerWithContext is an alternate form of the StartBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(startBareMetalServerOptions, "startBareMetalServerOptions cannot be nil") +// DeleteSnapshots : Delete a filtered collection of snapshots +// This request deletes all snapshots created from a specific source volume. +func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) +} + +// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(startBareMetalServerOptions, "startBareMetalServerOptions") + err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *startBareMetalServerOptions.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, `/bare_metal_servers/{id}/start`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { return } - for headerName, headerValue := range startBareMetalServerOptions.Headers { + for headerName, headerValue := range deleteSnapshotsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StartBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) request, err := builder.Build() if err != nil { @@ -13814,56 +13872,105 @@ func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBare return } -// StopBareMetalServer : Stop a bare metal server -// This request stops a bare metal server. It will run immediately provided the server is running. Note: A soft stop may -// not complete as it relies on the operating system to perform the operation. -func (vpc *VpcV1) StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.StopBareMetalServerWithContext(context.Background(), stopBareMetalServerOptions) +// ListSnapshots : List all snapshots +// This request lists all snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is +// created. +func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + return vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) } -// StopBareMetalServerWithContext is an alternate form of the StopBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(stopBareMetalServerOptions, "stopBareMetalServerOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(stopBareMetalServerOptions, "stopBareMetalServerOptions") +// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *stopBareMetalServerOptions.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, `/bare_metal_servers/{id}/stop`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { return } - for headerName, headerValue := range stopBareMetalServerOptions.Headers { + for headerName, headerValue := range listSnapshotsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StopBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") 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 stopBareMetalServerOptions.Type != nil { - body["type"] = stopBareMetalServerOptions.Type + if listSnapshotsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return + if listSnapshotsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) + } + if listSnapshotsOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag)) + } + if listSnapshotsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID)) + } + if listSnapshotsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name)) + } + if listSnapshotsOptions.SourceVolumeID != nil { + builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID)) + } + if listSnapshotsOptions.SourceVolumeCRN != nil { + builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN)) + } + if listSnapshotsOptions.SourceImageID != nil { + builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID)) + } + if listSnapshotsOptions.SourceImageCRN != nil { + builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN)) + } + if listSnapshotsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort)) + } + if listSnapshotsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) + } + if listSnapshotsOptions.CopiesID != nil { + builder.AddQuery("copies[].id", fmt.Sprint(*listSnapshotsOptions.CopiesID)) + } + if listSnapshotsOptions.CopiesName != nil { + builder.AddQuery("copies[].name", fmt.Sprint(*listSnapshotsOptions.CopiesName)) + } + if listSnapshotsOptions.CopiesCRN != nil { + builder.AddQuery("copies[].crn", fmt.Sprint(*listSnapshotsOptions.CopiesCRN)) + } + if listSnapshotsOptions.CopiesRemoteRegionName != nil { + builder.AddQuery("copies[].remote.region.name", fmt.Sprint(*listSnapshotsOptions.CopiesRemoteRegionName)) + } + if listSnapshotsOptions.SourceSnapshotID != nil { + builder.AddQuery("source_snapshot.id", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotID)) + } + if listSnapshotsOptions.SourceSnapshotRemoteRegionName != nil { + builder.AddQuery("source_snapshot.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotRemoteRegionName)) + } + if listSnapshotsOptions.SourceVolumeRemoteRegionName != nil { + builder.AddQuery("source_volume.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceVolumeRemoteRegionName)) + } + if listSnapshotsOptions.SourceImageRemoteRegionName != nil { + builder.AddQuery("source_image.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceImageRemoteRegionName)) + } + if listSnapshotsOptions.ClonesZoneName != nil { + builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName)) + } + if listSnapshotsOptions.SnapshotConsistencyGroupID != nil { + builder.AddQuery("snapshot_consistency_group.id", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupID)) + } + if listSnapshotsOptions.SnapshotConsistencyGroupCRN != nil { + builder.AddQuery("snapshot_consistency_group.crn", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupCRN)) } request, err := builder.Build() @@ -13871,50 +13978,65 @@ func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMe return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) + if err != nil { + return + } + response.Result = result + } return } -// ListVolumeProfiles : List all volume profiles -// This request lists all [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available -// in the region. A volume profile specifies the performance characteristics and pricing model for a volume. -func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) +// CreateSnapshot : Create a snapshot +// This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same +// way as a retrieved snapshot, and contains the information necessary to provision the new snapshot. +func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + return vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) } -// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter -func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") +// CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") if err != nil { return } - 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, `/volume/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { return } - for headerName, headerValue := range listVolumeProfilesOptions.Headers { + for headerName, headerValue := range createSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") 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)) - if listVolumeProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) - } - if listVolumeProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) + + _, err = builder.SetBodyContentJSON(createSnapshotOptions.SnapshotPrototype) + if err != nil { + return } request, err := builder.Build() @@ -13928,7 +14050,7 @@ func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeP return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) if err != nil { return } @@ -13938,44 +14060,46 @@ func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeP return } -// GetVolumeProfile : Retrieve a volume profile -// This request retrieves a single volume profile specified by the name in the URL. -func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - return vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) +// DeleteSnapshot : Delete a snapshot +// This request deletes a snapshot. This operation cannot be reversed. +func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) } -// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter -func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") +// DeleteSnapshotWithContext is an alternate form of the DeleteSnapshot method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotOptions, "deleteSnapshotOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") + err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") if err != nil { return } pathParamsMap := map[string]string{ - "name": *getVolumeProfileOptions.Name, + "id": *deleteSnapshotOptions.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, `/volume/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVolumeProfileOptions.Headers { + for headerName, headerValue := range deleteSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") + if deleteSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -13985,49 +14109,45 @@ func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProf return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListVolumes : List all volumes -// This request lists all volumes in the region. Volumes are network-connected block storage devices that may be -// attached to one or more instances in the same region. -func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - return vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) +// GetSnapshot : Retrieve a snapshot +// This request retrieves a single snapshot specified by the identifier in the URL. +func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + return vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) } -// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter -func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") +// GetSnapshotWithContext is an alternate form of the GetSnapshot method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotOptions, "getSnapshotOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "id": *getSnapshotOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listVolumesOptions.Headers { + for headerName, headerValue := range getSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14035,33 +14155,6 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVolumesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) - } - if listVolumesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) - } - if listVolumesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) - } - if listVolumesOptions.AttachmentState != nil { - builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) - } - if listVolumesOptions.Encryption != nil { - builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) - } - if listVolumesOptions.OperatingSystemFamily != nil { - builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) - } - if listVolumesOptions.OperatingSystemArchitecture != nil { - builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) - } - if listVolumesOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) - } - if listVolumesOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) - } request, err := builder.Build() if err != nil { @@ -14074,7 +14167,7 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) if err != nil { return } @@ -14084,47 +14177,54 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions return } -// CreateVolume : Create a volume -// This request creates a new volume from a volume prototype object. The prototype object is structured in the same way -// as a retrieved volume, and contains the information necessary to create the new volume. -func (vpc *VpcV1) CreateVolume(createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - return vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions) +// UpdateSnapshot : Update a snapshot +// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group +// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. +func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + return vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) } -// CreateVolumeWithContext is an alternate form of the CreateVolume method which supports a Context parameter -func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVolumeOptions, "createVolumeOptions cannot be nil") +// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter +func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions") + err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *updateSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createVolumeOptions.Headers { + for headerName, headerValue := range updateSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") 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 updateSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createVolumeOptions.VolumePrototype) + _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) if err != nil { return } @@ -14140,7 +14240,7 @@ func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptio return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) if err != nil { return } @@ -14150,47 +14250,44 @@ func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptio return } -// DeleteVolume : Delete a volume -// This request deletes a volume. This operation cannot be reversed. For this request to succeed, the volume must not be -// attached to any instances. -func (vpc *VpcV1) DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions) +// ListSnapshotClones : List all clones for a snapshot +// This request lists all clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. +func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + return vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) } -// DeleteVolumeWithContext is an alternate form of the DeleteVolume method which supports a Context parameter -func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVolumeOptions, "deleteVolumeOptions cannot be nil") +// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions") + err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteVolumeOptions.ID, + "id": *listSnapshotClonesOptions.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, `/volumes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteVolumeOptions.Headers { + for headerName, headerValue := range listSnapshotClonesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteVolumeOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVolumeOptions.IfMatch)) - } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -14200,49 +14297,61 @@ func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptio return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetVolume : Retrieve a volume -// This request retrieves a single volume specified by the identifier in the URL. -func (vpc *VpcV1) GetVolume(getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - return vpc.GetVolumeWithContext(context.Background(), getVolumeOptions) +// DeleteSnapshotClone : Delete a snapshot clone +// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated +// from the snapshot. +func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) } -// GetVolumeWithContext is an alternate form of the GetVolume method which supports a Context parameter -func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVolumeOptions, "getVolumeOptions cannot be nil") +// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions") + err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getVolumeOptions.ID, + "id": *deleteSnapshotCloneOptions.ID, + "zone_name": *deleteSnapshotCloneOptions.ZoneName, } - 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, `/volumes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVolumeOptions.Headers { + for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") 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)) @@ -14252,74 +14361,54 @@ func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *Ge return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// UpdateVolume : Update a volume -// This request updates a volume with the information in a provided volume patch. The volume patch object is structured -// in the same way as a retrieved volume and contains only the information to be updated. -func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - return vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) +// GetSnapshotClone : Retrieve a snapshot clone +// This request retrieves a single clone specified by the snapshot identifier and zone name in the URL. +func (vpc *VpcV1) GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + return vpc.GetSnapshotCloneWithContext(context.Background(), getSnapshotCloneOptions) } -// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter -func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") +// GetSnapshotCloneWithContext is an alternate form of the GetSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotCloneOptions, "getSnapshotCloneOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") + err = core.ValidateStruct(getSnapshotCloneOptions, "getSnapshotCloneOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateVolumeOptions.ID, + "id": *getSnapshotCloneOptions.ID, + "zone_name": *getSnapshotCloneOptions.ZoneName, } - 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, `/volumes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateVolumeOptions.Headers { + for headerName, headerValue := range getSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVolumeOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -14331,7 +14420,7 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) if err != nil { return } @@ -14341,33 +14430,42 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio return } -// ListSnapshotConsistencyGroups : List all snapshot consistency groups -// This request lists all snapshot consistency groups in the region. A snapshot consistency group is a collection of -// individual snapshots taken at the same time. -func (vpc *VpcV1) ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions) +// CreateSnapshotClone : Create a clone for a snapshot +// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if +// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. +func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + return vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) } -// ListSnapshotConsistencyGroupsWithContext is an alternate form of the ListSnapshotConsistencyGroups method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSnapshotConsistencyGroupsOptions, "listSnapshotConsistencyGroupsOptions") +// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *createSnapshotCloneOptions.ID, + "zone_name": *createSnapshotCloneOptions.ZoneName, + } + + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listSnapshotConsistencyGroupsOptions.Headers { + for headerName, headerValue := range createSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14375,24 +14473,6 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSnapshotConsistencyGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Start)) - } - if listSnapshotConsistencyGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Limit)) - } - if listSnapshotConsistencyGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.ResourceGroupID)) - } - if listSnapshotConsistencyGroupsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Name)) - } - if listSnapshotConsistencyGroupsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Sort)) - } - if listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID)) - } request, err := builder.Build() if err != nil { @@ -14405,7 +14485,7 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) if err != nil { return } @@ -14415,50 +14495,49 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, return } -// CreateSnapshotConsistencyGroup : Create a snapshot consistency group -// This request creates a new snapshot consistency group from a snapshot consistency group object. The prototype object -// is structured in the same way as a retrieved consistency group, and contains the information necessary to provision -// the new snapshot consistency group. -func (vpc *VpcV1) CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - return vpc.CreateSnapshotConsistencyGroupWithContext(context.Background(), createSnapshotConsistencyGroupOptions) +// ListShareProfiles : List all file share profiles +// This request lists all [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) +// available in the region. A file share profile specifies the performance characteristics and pricing model for a file +// share. +func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) } -// CreateSnapshotConsistencyGroupWithContext is an alternate form of the CreateSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions") +// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter +func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") if err != nil { return } - 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, `/snapshot_consistency_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) if err != nil { return } - for headerName, headerValue := range createSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range listShareProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") 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(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) - if err != nil { - return + if listShareProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) + } + if listShareProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) + } + if listShareProfilesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) } request, err := builder.Build() @@ -14472,7 +14551,7 @@ func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) if err != nil { return } @@ -14482,41 +14561,40 @@ func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, return } -// DeleteSnapshotConsistencyGroup : Delete a snapshot consistency group -// This request deletes snapshot consistency group. This operation cannot be reversed. If the -// `delete_snapshots_on_delete` property is `true`, all snapshots in the consistency group will also be deleted. -func (vpc *VpcV1) DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotConsistencyGroupWithContext(context.Background(), deleteSnapshotConsistencyGroupOptions) +// GetShareProfile : Retrieve a file share profile +// This request retrieves a single file share profile specified by the name in the URL. +func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + return vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) } -// DeleteSnapshotConsistencyGroupWithContext is an alternate form of the DeleteSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions cannot be nil") +// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter +func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions") + err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteSnapshotConsistencyGroupOptions.ID, + "name": *getShareProfileOptions.Name, } - 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, `/snapshot_consistency_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range getShareProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14536,7 +14614,7 @@ func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) if err != nil { return } @@ -14546,40 +14624,32 @@ func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, return } -// GetSnapshotConsistencyGroup : Retrieve a snapshot consistency group -// This request retrieves a single snapshot consistency group specified by the identifier in the URL. -func (vpc *VpcV1) GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - return vpc.GetSnapshotConsistencyGroupWithContext(context.Background(), getSnapshotConsistencyGroupOptions) +// ListShares : List all file shares +// This request lists all file shares in the region. +func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + return vpc.ListSharesWithContext(context.Background(), listSharesOptions) } -// GetSnapshotConsistencyGroupWithContext is an alternate form of the GetSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions") +// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter +func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSharesOptions, "listSharesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *getSnapshotConsistencyGroupOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) if err != nil { return } - for headerName, headerValue := range getSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range listSharesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14587,6 +14657,24 @@ func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, ge builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSharesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) + } + if listSharesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) + } + if listSharesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) + } + if listSharesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) + } + if listSharesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) + } + if listSharesOptions.ReplicationRole != nil { + builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) + } request, err := builder.Build() if err != nil { @@ -14599,7 +14687,7 @@ func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, ge return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) if err != nil { return } @@ -14609,55 +14697,50 @@ func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, ge return } -// UpdateSnapshotConsistencyGroup : Update a snapshot consistency group -// This request updates a snapshot consistency group with the information in a provided snapshot consistency group -// patch. The snapshot consistency group patch object is structured in the same way as a retrieved snapshot consistency -// group and contains only the information to be updated. -func (vpc *VpcV1) UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - return vpc.UpdateSnapshotConsistencyGroupWithContext(context.Background(), updateSnapshotConsistencyGroupOptions) +// CreateShare : Create a file share +// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, +// a replica share, or both a source and replica share. +// +// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to +// provision the new file shares. +func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.CreateShareWithContext(context.Background(), createShareOptions) } -// UpdateSnapshotConsistencyGroupWithContext is an alternate form of the UpdateSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions cannot be nil") +// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter +func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions") + err = core.ValidateStruct(createShareOptions, "createShareOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *updateSnapshotConsistencyGroupOptions.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, `/snapshot_consistency_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) if err != nil { return } - for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range createShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSnapshotConsistencyGroupOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotConsistencyGroupOptions.IfMatch)) - } + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch) + _, err = builder.SetBodyContentJSON(createShareOptions.SharePrototype) if err != nil { return } @@ -14673,7 +14756,7 @@ func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { return } @@ -14683,81 +14766,112 @@ func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, return } -// DeleteSnapshots : Delete a filtered collection of snapshots -// This request deletes all snapshots created from a specific source volume. -func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) +// DeleteShare : Delete a file share +// This request deletes a share. This operation cannot be reversed. A share cannot be deleted if it: +// - has share mount targets +// - has a `lifecycle_state` of `updating` +// - has a replication operation in progress +// +// If the request is accepted, the share `lifecycle_state` will be set to `deleting`. Once deletion processing +// completes, it will no longer be retrievable. +func (vpc *VpcV1) DeleteShare(deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.DeleteShareWithContext(context.Background(), deleteShareOptions) } -// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") +// DeleteShareWithContext is an alternate form of the DeleteShare method which supports a Context parameter +func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareOptions, "deleteShareOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") + err = core.ValidateStruct(deleteShareOptions, "deleteShareOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "id": *deleteShareOptions.ID, + } + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteSnapshotsOptions.Headers { + for headerName, headerValue := range deleteShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + if deleteShareOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteShareOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + if err != nil { + return + } + response.Result = result + } return } -// ListSnapshots : List all snapshots -// This request lists all snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is -// created. -func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { - return vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) +// GetShare : Retrieve a file share +// This request retrieves a single file share specified by the identifier in the URL. +func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.GetShareWithContext(context.Background(), getShareOptions) } -// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") +// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter +func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getShareOptions, "getShareOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "id": *getShareOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listSnapshotsOptions.Headers { + for headerName, headerValue := range getShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14765,72 +14879,6 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSnapshotsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) - } - if listSnapshotsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) - } - if listSnapshotsOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag)) - } - if listSnapshotsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID)) - } - if listSnapshotsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name)) - } - if listSnapshotsOptions.SourceVolumeID != nil { - builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID)) - } - if listSnapshotsOptions.SourceVolumeCRN != nil { - builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN)) - } - if listSnapshotsOptions.SourceImageID != nil { - builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID)) - } - if listSnapshotsOptions.SourceImageCRN != nil { - builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN)) - } - if listSnapshotsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort)) - } - if listSnapshotsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) - } - if listSnapshotsOptions.CopiesID != nil { - builder.AddQuery("copies[].id", fmt.Sprint(*listSnapshotsOptions.CopiesID)) - } - if listSnapshotsOptions.CopiesName != nil { - builder.AddQuery("copies[].name", fmt.Sprint(*listSnapshotsOptions.CopiesName)) - } - if listSnapshotsOptions.CopiesCRN != nil { - builder.AddQuery("copies[].crn", fmt.Sprint(*listSnapshotsOptions.CopiesCRN)) - } - if listSnapshotsOptions.CopiesRemoteRegionName != nil { - builder.AddQuery("copies[].remote.region.name", fmt.Sprint(*listSnapshotsOptions.CopiesRemoteRegionName)) - } - if listSnapshotsOptions.SourceSnapshotID != nil { - builder.AddQuery("source_snapshot.id", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotID)) - } - if listSnapshotsOptions.SourceSnapshotRemoteRegionName != nil { - builder.AddQuery("source_snapshot.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotRemoteRegionName)) - } - if listSnapshotsOptions.SourceVolumeRemoteRegionName != nil { - builder.AddQuery("source_volume.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceVolumeRemoteRegionName)) - } - if listSnapshotsOptions.SourceImageRemoteRegionName != nil { - builder.AddQuery("source_image.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceImageRemoteRegionName)) - } - if listSnapshotsOptions.ClonesZoneName != nil { - builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName)) - } - if listSnapshotsOptions.SnapshotConsistencyGroupID != nil { - builder.AddQuery("snapshot_consistency_group.id", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupID)) - } - if listSnapshotsOptions.SnapshotConsistencyGroupCRN != nil { - builder.AddQuery("snapshot_consistency_group.crn", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupCRN)) - } request, err := builder.Build() if err != nil { @@ -14843,7 +14891,7 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { return } @@ -14853,47 +14901,54 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt return } -// CreateSnapshot : Create a snapshot -// This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same -// way as a retrieved snapshot, and contains the information necessary to provision the new snapshot. -func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - return vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) +// UpdateShare : Update a file share +// This request updates a share with the information in a provided share patch. The share patch object is structured in +// the same way as a retrieved share and contains only the information to be updated. +func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + return vpc.UpdateShareWithContext(context.Background(), updateShareOptions) } -// CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil") +// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter +func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") + err = core.ValidateStruct(updateShareOptions, "updateShareOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *updateShareOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createSnapshotOptions.Headers { + for headerName, headerValue := range updateShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") 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 updateShareOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateShareOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createSnapshotOptions.SnapshotPrototype) + _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) if err != nil { return } @@ -14909,7 +14964,7 @@ func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotO return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { return } @@ -14919,173 +14974,128 @@ func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotO return } -// DeleteSnapshot : Delete a snapshot -// This request deletes a snapshot. This operation cannot be reversed. -func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) +// FailoverShare : Failover to replica file share +// This request triggers a failover to the replica file share specified by the identifier in the URL. The failover +// cannot be started if a source share or the replica share has a `lifecycle_state` of `updating`, or has a replication +// operation in progress. +// +// If `fallback_policy` is specified as `split`, and the request is accepted but the failover operation cannot be +// performed, a split will be triggered. +func (vpc *VpcV1) FailoverShare(failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { + return vpc.FailoverShareWithContext(context.Background(), failoverShareOptions) } -// DeleteSnapshotWithContext is an alternate form of the DeleteSnapshot method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotOptions, "deleteSnapshotOptions cannot be nil") +// FailoverShareWithContext is an alternate form of the FailoverShare method which supports a Context parameter +func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(failoverShareOptions, "failoverShareOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") + err = core.ValidateStruct(failoverShareOptions, "failoverShareOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteSnapshotOptions.ID, + "share_id": *failoverShareOptions.ShareID, } - 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, `/snapshots/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/failover`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteSnapshotOptions.Headers { + for headerName, headerValue := range failoverShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteSnapshotOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch)) - } + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - - return -} - -// GetSnapshot : Retrieve a snapshot -// This request retrieves a single snapshot specified by the identifier in the URL. -func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - return vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) -} - -// GetSnapshotWithContext is an alternate form of the GetSnapshot method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotOptions, "getSnapshotOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") - if err != nil { - return + body := make(map[string]interface{}) + if failoverShareOptions.FallbackPolicy != nil { + body["fallback_policy"] = failoverShareOptions.FallbackPolicy } - - pathParamsMap := map[string]string{ - "id": *getSnapshotOptions.ID, + if failoverShareOptions.Timeout != nil { + body["timeout"] = failoverShareOptions.Timeout } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) + _, err = builder.SetBodyContentJSON(body) if err != nil { return } - for headerName, headerValue := range getSnapshotOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") - 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 { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// UpdateSnapshot : Update a snapshot -// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group -// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. -func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - return vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) +// ListShareMountTargets : List all mount targets for a file share +// This request retrieves all share mount targets for a file share. A share mount target is a network endpoint at which +// a file share may be mounted. The file share can be mounted by clients in the same VPC and zone after creating share +// mount targets. +// +// The share mount targets will be sorted by their `created_at` property values, with newest targets first. +func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + return vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) } -// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter -func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") +// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter +func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") + err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateSnapshotOptions.ID, + "share_id": *listShareMountTargetsOptions.ShareID, } - 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, `/snapshots/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateSnapshotOptions.Headers { + for headerName, headerValue := range listShareMountTargetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSnapshotOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) - if err != nil { - return + if listShareMountTargetsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) + } + if listShareMountTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) + } + if listShareMountTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) } request, err := builder.Build() @@ -15099,7 +15109,7 @@ func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotO return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) if err != nil { return } @@ -15109,48 +15119,57 @@ func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotO return } -// ListSnapshotClones : List all clones for a snapshot -// This request lists all clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. -func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - return vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) +// CreateShareMountTarget : Create a mount target for a file share +// This request creates a new share mount target from a share mount target prototype object. +// +// The prototype object is structured in the same way as a retrieved share mount target, and contains the information +// necessary to provision the new file share mount target. +func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) } -// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") +// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") + err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *listSnapshotClonesOptions.ID, + "share_id": *createShareMountTargetOptions.ShareID, } - 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, `/snapshots/{id}/clones`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listSnapshotClonesOptions.Headers { + for headerName, headerValue := range createShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") 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(createShareMountTargetOptions.ShareMountTargetPrototype) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -15162,7 +15181,7 @@ func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapsho return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { return } @@ -15172,45 +15191,48 @@ func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapsho return } -// DeleteSnapshotClone : Delete a snapshot clone -// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated -// from the snapshot. -func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) +// DeleteShareMountTarget : Delete a share mount target +// This request deletes a share mount target. This operation cannot be reversed. +// +// If the request is accepted, the share mount target `lifecycle_state` will be set to +// `deleting`. Once deletion processing completes, it will no longer be retrievable. +func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) } -// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") +// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") + err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteSnapshotCloneOptions.ID, - "zone_name": *deleteSnapshotCloneOptions.ZoneName, + "share_id": *deleteShareMountTargetOptions.ShareID, + "id": *deleteShareMountTargetOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { + for headerName, headerValue := range deleteShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") 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)) @@ -15220,46 +15242,57 @@ func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnap return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + if err != nil { + return + } + response.Result = result + } return } -// GetSnapshotClone : Retrieve a snapshot clone -// This request retrieves a single clone specified by the snapshot identifier and zone name in the URL. -func (vpc *VpcV1) GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - return vpc.GetSnapshotCloneWithContext(context.Background(), getSnapshotCloneOptions) +// GetShareMountTarget : Retrieve a share mount target +// This request retrieves a single share mount target specified by the identifier in the URL. +func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) } -// GetSnapshotCloneWithContext is an alternate form of the GetSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotCloneOptions, "getSnapshotCloneOptions cannot be nil") +// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getSnapshotCloneOptions, "getSnapshotCloneOptions") + err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getSnapshotCloneOptions.ID, - "zone_name": *getSnapshotCloneOptions.ZoneName, + "share_id": *getShareMountTargetOptions.ShareID, + "id": *getShareMountTargetOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getSnapshotCloneOptions.Headers { + for headerName, headerValue := range getShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15279,7 +15312,7 @@ func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCl return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { return } @@ -15289,50 +15322,57 @@ func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCl return } -// CreateSnapshotClone : Create a clone for a snapshot -// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if -// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. -func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - return vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) +// UpdateShareMountTarget : Update a share mount target +// This request updates a share mount target with the information provided in a share mount target patch object. The +// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + return vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) } -// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") +// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") + err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *createSnapshotCloneOptions.ID, - "zone_name": *createSnapshotCloneOptions.ZoneName, + "share_id": *updateShareMountTargetOptions.ShareID, + "id": *updateShareMountTargetOptions.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, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createSnapshotCloneOptions.Headers { + for headerName, headerValue := range updateShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") 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(updateShareMountTargetOptions.ShareMountTargetPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -15344,7 +15384,7 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { return } @@ -15354,106 +15394,96 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap return } -// ListShareProfiles : List all file share profiles -// This request lists all [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) -// available in the region. A file share profile specifies the performance characteristics and pricing model for a file -// share. -func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) +// DeleteShareSource : Split the source file share from a replica share +// This request removes the replication relationship between a source share and the replica share specified by the +// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a +// `lifecycle_state` of `updating`, or has a replication operation in progress. +// +// This operation cannot be reversed. +func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) } -// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter -func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") +// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter +func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "share_id": *deleteShareSourceOptions.ShareID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listShareProfilesOptions.Headers { + for headerName, headerValue := range deleteShareSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") 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 listShareProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) - } - if listShareProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) - } - if listShareProfilesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) - } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// GetShareProfile : Retrieve a file share profile -// This request retrieves a single file share profile specified by the name in the URL. -func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { - return vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) +// GetShareSource : Retrieve the source file share for a replica file share +// This request retrieves the source file share associated with the replica file share specified by the identifier in +// the URL. +func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { + return vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) } -// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter -func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") +// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter +func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") + err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") if err != nil { return } pathParamsMap := map[string]string{ - "name": *getShareProfileOptions.Name, + "share_id": *getShareSourceOptions.ShareID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getShareProfileOptions.Headers { + for headerName, headerValue := range getShareSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15473,7 +15503,7 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) if err != nil { return } @@ -15483,15 +15513,16 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil return } -// ListShares : List all file shares -// This request lists all file shares in the region. -func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { - return vpc.ListSharesWithContext(context.Background(), listSharesOptions) +// ListBackupPolicies : List all backup policies +// This request lists all backup policies in the region. Backup policies control which sources are selected for backup +// and include a set of backup policy plans that provide the backup schedules and deletion triggers. +func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) } -// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter -func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSharesOptions, "listSharesOptions") +// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter +func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") if err != nil { return } @@ -15499,16 +15530,16 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) if err != nil { return } - for headerName, headerValue := range listSharesOptions.Headers { + for headerName, headerValue := range listBackupPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15516,23 +15547,20 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSharesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) - } - if listSharesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) + if listBackupPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) } - if listSharesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) + if listBackupPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) } - if listSharesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) + if listBackupPoliciesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) } - if listSharesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) + if listBackupPoliciesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) } - if listSharesOptions.ReplicationRole != nil { - builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) + if listBackupPoliciesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) } request, err := builder.Build() @@ -15546,7 +15574,7 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) if err != nil { return } @@ -15556,23 +15584,20 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * return } -// CreateShare : Create a file share -// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, -// a replica share, or both a source and replica share. -// -// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to -// provision the new file shares. -func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.CreateShareWithContext(context.Background(), createShareOptions) +// CreateBackupPolicy : Create a backup policy +// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in +// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. +func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) } -// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter -func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") +// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createShareOptions, "createShareOptions") + err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") if err != nil { return } @@ -15580,16 +15605,16 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) if err != nil { return } - for headerName, headerValue := range createShareOptions.Headers { + for headerName, headerValue := range createBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15599,7 +15624,7 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createShareOptions.SharePrototype) + _, err = builder.SetBodyContentJSON(createBackupPolicyOptions.BackupPolicyPrototype) if err != nil { return } @@ -15615,7 +15640,7 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { return } @@ -15625,119 +15650,72 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions return } -// DeleteShare : Delete a file share -// This request deletes a share. This operation cannot be reversed. A share cannot be deleted if it: -// - has share mount targets -// - has a `lifecycle_state` of `updating` -// - has a replication operation in progress -// -// If the request is accepted, the share `lifecycle_state` will be set to `deleting`. Once deletion processing -// completes, it will no longer be retrievable. -func (vpc *VpcV1) DeleteShare(deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.DeleteShareWithContext(context.Background(), deleteShareOptions) +// ListBackupPolicyJobs : List all jobs for a backup policy +// This request retrieves all jobs for a backup policy. A backup job represents the execution of a backup policy plan +// for a resource matching the policy's criteria. +func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) } -// DeleteShareWithContext is an alternate form of the DeleteShare method which supports a Context parameter -func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareOptions, "deleteShareOptions cannot be nil") +// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteShareOptions, "deleteShareOptions") + err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteShareOptions.ID, + "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, } - 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, `/shares/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteShareOptions.Headers { + for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteShareOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteShareOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return + if listBackupPolicyJobsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) - if err != nil { - return - } - response.Result = result + if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) } - - return -} - -// GetShare : Retrieve a file share -// This request retrieves a single file share specified by the identifier in the URL. -func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.GetShareWithContext(context.Background(), getShareOptions) -} - -// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter -func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") - if err != nil { - return + if listBackupPolicyJobsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) } - err = core.ValidateStruct(getShareOptions, "getShareOptions") - if err != nil { - return + if listBackupPolicyJobsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) } - - pathParamsMap := map[string]string{ - "id": *getShareOptions.ID, + if listBackupPolicyJobsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) - if err != nil { - return + if listBackupPolicyJobsOptions.SourceID != nil { + builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) } - - for headerName, headerValue := range getShareOptions.Headers { - builder.AddHeader(headerName, headerValue) + if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { + builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) + if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { + builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) } - 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 { @@ -15750,7 +15728,7 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) if err != nil { return } @@ -15760,58 +15738,49 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS return } -// UpdateShare : Update a file share -// This request updates a share with the information in a provided share patch. The share patch object is structured in -// the same way as a retrieved share and contains only the information to be updated. -func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.UpdateShareWithContext(context.Background(), updateShareOptions) +// GetBackupPolicyJob : Retrieve a backup policy job +// This request retrieves a single backup policy job specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + return vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) } -// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter -func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") +// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateShareOptions, "updateShareOptions") + err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateShareOptions.ID, + "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, + "id": *getBackupPolicyJobOptions.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, `/shares/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateShareOptions.Headers { + for headerName, headerValue := range getBackupPolicyJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateShareOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateShareOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -15823,7 +15792,7 @@ func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) if err != nil { return } @@ -15833,128 +15802,150 @@ func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions return } -// FailoverShare : Failover to replica file share -// This request triggers a failover to the replica file share specified by the identifier in the URL. The failover -// cannot be started if a source share or the replica share has a `lifecycle_state` of `updating`, or has a replication -// operation in progress. -// -// If `fallback_policy` is specified as `split`, and the request is accepted but the failover operation cannot be -// performed, a split will be triggered. -func (vpc *VpcV1) FailoverShare(failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { - return vpc.FailoverShareWithContext(context.Background(), failoverShareOptions) +// ListBackupPolicyPlans : List all plans for a backup policy +// This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. +func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + return vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) } -// FailoverShareWithContext is an alternate form of the FailoverShare method which supports a Context parameter -func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(failoverShareOptions, "failoverShareOptions cannot be nil") +// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(failoverShareOptions, "failoverShareOptions") + err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") if err != nil { return } pathParamsMap := map[string]string{ - "share_id": *failoverShareOptions.ShareID, + "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, } - 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, `/shares/{share_id}/failover`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range failoverShareOptions.Headers { + for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") 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 failoverShareOptions.FallbackPolicy != nil { - body["fallback_policy"] = failoverShareOptions.FallbackPolicy - } - if failoverShareOptions.Timeout != nil { - body["timeout"] = failoverShareOptions.Timeout + if listBackupPolicyPlansOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) } - _, err = builder.SetBodyContentJSON(body) + + request, err := builder.Build() if err != nil { return } - request, err := builder.Build() + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) + if err != nil { + return + } + response.Result = result + } - response, err = vpc.Service.Request(request, nil) - return } -// ListShareMountTargets : List all mount targets for a file share -// This request retrieves all share mount targets for a file share. A share mount target is a network endpoint at which -// a file share may be mounted. The file share can be mounted by clients in the same VPC and zone after creating share -// mount targets. +// CreateBackupPolicyPlan : Create a plan for a backup policy +// This request creates a new backup policy plan from a backup policy plan prototype object. The prototype object is +// structured in the same way as a retrieved backup policy plan, and contains the information necessary to create the +// new backup policy plan. // -// The share mount targets will be sorted by their `created_at` property values, with newest targets first. -func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - return vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) +// Backups created by this plan will use the resource group of the source being backed up. +// +// Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character +// suffix. +func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) } -// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter -func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") +// CreateBackupPolicyPlanWithContext is an alternate form of the CreateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") + err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") if err != nil { return } pathParamsMap := map[string]string{ - "share_id": *listShareMountTargetsOptions.ShareID, + "backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID, } - 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, `/shares/{share_id}/mount_targets`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listShareMountTargetsOptions.Headers { + for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") 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)) - if listShareMountTargetsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) + + body := make(map[string]interface{}) + if createBackupPolicyPlanOptions.CronSpec != nil { + body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec } - if listShareMountTargetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) + if createBackupPolicyPlanOptions.Active != nil { + body["active"] = createBackupPolicyPlanOptions.Active } - if listShareMountTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) + if createBackupPolicyPlanOptions.AttachUserTags != nil { + body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags + } + if createBackupPolicyPlanOptions.ClonePolicy != nil { + body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy + } + if createBackupPolicyPlanOptions.CopyUserTags != nil { + body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags + } + if createBackupPolicyPlanOptions.DeletionTrigger != nil { + body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger + } + if createBackupPolicyPlanOptions.Name != nil { + body["name"] = createBackupPolicyPlanOptions.Name + } + if createBackupPolicyPlanOptions.RemoteRegionPolicies != nil { + body["remote_region_policies"] = createBackupPolicyPlanOptions.RemoteRegionPolicies + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return } request, err := builder.Build() @@ -15968,7 +15959,7 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { return } @@ -15978,57 +15969,57 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar return } -// CreateShareMountTarget : Create a mount target for a file share -// This request creates a new share mount target from a share mount target prototype object. +// DeleteBackupPolicyPlan : Delete a backup policy plan +// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by +// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with +// the plan will run to completion before the plan is deleted. // -// The prototype object is structured in the same way as a retrieved share mount target, and contains the information -// necessary to provision the new file share mount target. -func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) +// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing +// completes, the backup policy plan will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) } -// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") +// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") + err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") if err != nil { return } pathParamsMap := map[string]string{ - "share_id": *createShareMountTargetOptions.ShareID, + "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, + "id": *deleteBackupPolicyPlanOptions.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, `/shares/{share_id}/mount_targets`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createShareMountTargetOptions.Headers { + for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") + if deleteBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createShareMountTargetOptions.ShareMountTargetPrototype) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -16040,7 +16031,7 @@ func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createS return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { return } @@ -16050,44 +16041,41 @@ func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createS return } -// DeleteShareMountTarget : Delete a share mount target -// This request deletes a share mount target. This operation cannot be reversed. -// -// If the request is accepted, the share mount target `lifecycle_state` will be set to -// `deleting`. Once deletion processing completes, it will no longer be retrievable. -func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) +// GetBackupPolicyPlan : Retrieve a backup policy plan +// This request retrieves a single backup policy plan specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) } -// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") +// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") + err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") if err != nil { return } pathParamsMap := map[string]string{ - "share_id": *deleteShareMountTargetOptions.ShareID, - "id": *deleteShareMountTargetOptions.ID, + "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, + "id": *getBackupPolicyPlanOptions.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, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteShareMountTargetOptions.Headers { + for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16107,7 +16095,7 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { return } @@ -16117,49 +16105,59 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS return } -// GetShareMountTarget : Retrieve a share mount target -// This request retrieves a single share mount target specified by the identifier in the URL. -func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) +// UpdateBackupPolicyPlan : Update a backup policy plan +// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is +// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + return vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) } -// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") +// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") + err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") if err != nil { return } pathParamsMap := map[string]string{ - "share_id": *getShareMountTargetOptions.ShareID, - "id": *getShareMountTargetOptions.ID, + "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, + "id": *updateBackupPolicyPlanOptions.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, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getShareMountTargetOptions.Headers { + for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -16171,7 +16169,7 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { return } @@ -16181,57 +16179,54 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo return } -// UpdateShareMountTarget : Update a share mount target -// This request updates a share mount target with the information provided in a share mount target patch object. The -// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain -// only the information to be updated. -func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) +// DeleteBackupPolicy : Delete a backup policy +// This request deletes a backup policy. This operation cannot be reversed. +// +// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, +// the backup policy will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) } -// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") +// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") + err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "share_id": *updateShareMountTargetOptions.ShareID, - "id": *updateShareMountTargetOptions.ID, + "id": *deleteBackupPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateShareMountTargetOptions.Headers { + for headerName, headerValue := range deleteBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") + if deleteBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateShareMountTargetOptions.ShareMountTargetPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -16243,7 +16238,7 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { return } @@ -16253,47 +16248,44 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS return } -// DeleteShareSource : Split the source file share from a replica share -// This request removes the replication relationship between a source share and the replica share specified by the -// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a -// `lifecycle_state` of `updating`, or has a replication operation in progress. -// -// This operation cannot be reversed. -func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) +// GetBackupPolicy : Retrieve a backup policy +// This request retrieves a single backup policy specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) } -// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter -func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") +// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") + err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "share_id": *deleteShareSourceOptions.ShareID, + "id": *getBackupPolicyOptions.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, `/shares/{share_id}/source`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteShareSourceOptions.Headers { + for headerName, headerValue := range getBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") 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)) @@ -16303,54 +16295,74 @@ func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareS return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + return + } + response.Result = result + } return } -// GetShareSource : Retrieve the source file share for a replica file share -// This request retrieves the source file share associated with the replica file share specified by the identifier in -// the URL. -func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { - return vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) +// UpdateBackupPolicy : Update a backup policy +// This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch +// object is structured in the same way as a retrieved backup policy and contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) } -// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter -func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") +// UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") + err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "share_id": *getShareSourceOptions.ShareID, + "id": *updateBackupPolicyOptions.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, `/shares/{share_id}/source`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getShareSourceOptions.Headers { + for headerName, headerValue := range updateBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -16362,7 +16374,7 @@ func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceO return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { return } @@ -26539,19 +26551,15 @@ type BackupPolicy struct { CRN *string `json:"crn" validate:"required"` // The reasons for the current `health_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. HealthReasons []BackupPolicyHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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. @@ -26571,9 +26579,8 @@ type BackupPolicy struct { // 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 in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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 @@ -26599,20 +26606,19 @@ type BackupPolicy struct { // - `boot_volume`: Include the instance's boot volume. // - `data_volumes`: Include the instance's data volumes. // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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. +// 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" @@ -26636,9 +26642,8 @@ const ( // 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 in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected -// property value was encountered. +// 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" @@ -26830,7 +26835,7 @@ func UnmarshalBackupPolicyCollectionNext(m map[string]json.RawMessage, result in // BackupPolicyHealthReason : BackupPolicyHealthReason struct type BackupPolicyHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state. Code *string `json:"code" validate:"required"` // An explanation of the reason for this health state. @@ -26841,7 +26846,7 @@ type BackupPolicyHealthReason struct { } // Constants associated with the BackupPolicyHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state. const ( BackupPolicyHealthReasonCodeMissingServiceAuthorizationPoliciesConst = "missing_service_authorization_policies" ) @@ -26895,9 +26900,8 @@ type BackupPolicyJob struct { // The type of backup policy job. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the - // unexpected property value was encountered. + // 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. @@ -26909,16 +26913,11 @@ type BackupPolicyJob struct { // The status of the backup policy job. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the - // unexpected property value was encountered. + // 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). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []BackupPolicyJobStatusReason `json:"status_reasons" validate:"required"` // The snapshots operated on by this backup policy job (may be @@ -26929,9 +26928,8 @@ type BackupPolicyJob struct { // Constants associated with the BackupPolicyJob.JobType property. // The type of backup policy job. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the -// unexpected property value was encountered. +// 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" @@ -26946,9 +26944,8 @@ const ( // Constants associated with the BackupPolicyJob.Status property. // The status of the backup policy job. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the -// unexpected property value was encountered. +// 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" @@ -27187,11 +27184,14 @@ func UnmarshalBackupPolicyJobSource(m map[string]json.RawMessage, result interfa // BackupPolicyJobStatusReason : BackupPolicyJobStatusReason struct type BackupPolicyJobStatusReason struct { - // A snake case string succinctly identifying the status reason: + // A reason code for the status: // - `internal_error`: Internal error (contact IBM support) // - `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_busy`: The source volume has `busy` set (after multiple retries) + // + // 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. @@ -27202,11 +27202,14 @@ type BackupPolicyJobStatusReason struct { } // Constants associated with the BackupPolicyJobStatusReason.Code property. -// A snake case string succinctly identifying the status reason: +// A reason code for the status: // - `internal_error`: Internal error (contact IBM support) // - `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_busy`: The source volume has `busy` set (after multiple retries) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error" BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" @@ -27489,17 +27492,80 @@ func UnmarshalBackupPolicyPlanClonePolicyPrototype(m map[string]json.RawMessage, // BackupPolicyPlanCollection : BackupPolicyPlanCollection struct type BackupPolicyPlanCollection struct { + // A link to the first page of resources. + First *BackupPolicyPlanCollectionFirst `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 *BackupPolicyPlanCollectionNext `json:"next,omitempty"` + // Collection of backup policy plans. 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, UnmarshalBackupPolicyPlanCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyPlanCollectionNext) + if err != nil { + return + } err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlan) if err != nil { return } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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 { + return + } + 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) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -28080,7 +28146,10 @@ type BareMetalServer struct { // server network interfaces. Bandwidth *int64 `json:"bandwidth" validate:"required"` - // The possible resource types for this property are expected to expand in the future. + // 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. @@ -28107,10 +28176,6 @@ type BareMetalServer struct { ID *string `json:"id" validate:"required"` // The reasons for the current `lifecycle_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. LifecycleReasons []BareMetalServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the bare metal server. @@ -28157,10 +28222,6 @@ type BareMetalServer struct { Status *string `json:"status" validate:"required"` // The reasons for the current status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []BareMetalServerStatusReason `json:"status_reasons" validate:"required"` TrustedPlatformModule *BareMetalServerTrustedPlatformModule `json:"trusted_platform_module" validate:"required"` @@ -28311,7 +28372,10 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) return } -// BareMetalServerBootTarget : The possible resource types for this property are expected to expand in the future. +// 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 { @@ -28574,15 +28638,13 @@ type BareMetalServerDisk struct { // The unique identifier for this bare metal server disk. ID *string `json:"id" validate:"required"` - // The disk interface used for attaching the disk. - // + // The disk interface used for attaching the disk: // - `fcp`: Attached using Fiber Channel Protocol // - `sata`: Attached using Serial Advanced Technology Attachment // - `nvme`: Attached using Non-Volatile Memory Express // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // 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 name for this bare metal server disk. The name is unique across all disks on the bare metal server. @@ -28596,15 +28658,13 @@ type BareMetalServerDisk struct { } // Constants associated with the BareMetalServerDisk.InterfaceType property. -// The disk interface used for attaching the disk. -// +// The disk interface used for attaching the disk: // - `fcp`: Attached using Fiber Channel Protocol // - `sata`: Attached using Serial Advanced Technology Attachment // - `nvme`: Attached using Non-Volatile Memory Express // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( BareMetalServerDiskInterfaceTypeFcpConst = "fcp" BareMetalServerDiskInterfaceTypeNvmeConst = "nvme" @@ -28849,7 +28909,12 @@ func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMess // BareMetalServerLifecycleReason : BareMetalServerLifecycleReason struct type BareMetalServerLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. + // A reason code for this lifecycle state: + // - `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. @@ -28860,7 +28925,12 @@ type BareMetalServerLifecycleReason struct { } // Constants associated with the BareMetalServerLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. +// A reason code for this lifecycle state: +// - `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 ( BareMetalServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -28908,9 +28978,8 @@ type BareMetalServerNetworkAttachment struct { // array of `allowed_vlans`. // - Must use an IEEE 802.1Q tag. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // 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 lifecycle state of the bare metal server network attachment. @@ -28971,9 +29040,8 @@ type BareMetalServerNetworkAttachment struct { // array of `allowed_vlans`. // - Must use an IEEE 802.1Q tag. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// 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" @@ -29619,9 +29687,8 @@ type BareMetalServerNetworkInterface struct { // 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 are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // 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 @@ -29734,9 +29801,8 @@ type BareMetalServerNetworkInterface struct { // 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 are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// 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" @@ -31108,15 +31174,13 @@ func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, resul // BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct type BareMetalServerProfileDiskSupportedInterfaces struct { - // The disk interface used for attaching the disk. - // + // The disk interface used for attaching the disk: // - `fcp`: Attached using Fiber Channel Protocol // - `sata`: Attached using Serial Advanced Technology Attachment // - `nvme`: Attached using Non-Volatile Memory Express // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Default *string `json:"default" validate:"required"` // The type for this profile field. @@ -31127,15 +31191,13 @@ type BareMetalServerProfileDiskSupportedInterfaces struct { } // Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. -// The disk interface used for attaching the disk. -// +// The disk interface used for attaching the disk: // - `fcp`: Attached using Fiber Channel Protocol // - `sata`: Attached using Serial Advanced Technology Attachment // - `nvme`: Attached using Non-Volatile Memory Express // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( BareMetalServerProfileDiskSupportedInterfacesDefaultFcpConst = "fcp" BareMetalServerProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" @@ -31149,15 +31211,13 @@ const ( ) // Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Values property. -// The disk interface used for attaching the disk. -// +// The disk interface used for attaching the disk: // - `fcp`: Attached using Fiber Channel Protocol // - `sata`: Attached using Serial Advanced Technology Attachment // - `nvme`: Attached using Non-Volatile Memory Express // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// 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" @@ -31486,9 +31546,8 @@ const ( // - `disabled`: No TPM functionality // - `tpm_2`: TPM 2.0 // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// 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" @@ -31658,7 +31717,10 @@ type BareMetalServerStatusReason struct { // - `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_start_network`: An error occurred while allocating network resources + // + // 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. @@ -31674,7 +31736,10 @@ type BareMetalServerStatusReason struct { // - `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_start_network`: An error occurred while allocating network resources +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" @@ -31711,9 +31776,8 @@ type BareMetalServerTrustedPlatformModule struct { // - `disabled`: No TPM functionality // - `tpm_2`: TPM 2.0 // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // 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. @@ -31725,9 +31789,8 @@ type BareMetalServerTrustedPlatformModule struct { // - `disabled`: No TPM functionality // - `tpm_2`: TPM 2.0 // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// 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" @@ -31738,9 +31801,8 @@ const ( // - `disabled`: No TPM functionality // - `tpm_2`: TPM 2.0 // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// 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" @@ -33766,7 +33828,10 @@ type CreateLoadBalancerListenerOptions struct { // The connection limit of the listener. ConnectionLimit *int64 `json:"connection_limit,omitempty"` - // The default pool for this listener. If specified, the pool must: + // The default pool for this listener. If `https_redirect` is specified, the + // default pool will not be used. + // If specified, the pool must: + // // - Belong to this load balancer. // - Have the same `protocol` as this listener, or have a compatible protocol. // At present, the compatible protocols are `http` and `https`. @@ -33776,8 +33841,11 @@ type CreateLoadBalancerListenerOptions struct { // subsequently set. DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` - // The target listener that requests will be redirected to. This listener must have a - // `protocol` of `http`, and the target listener must have a `protocol` of `https`. + // The target listener that requests will be redirected to if none of the listener's + // `policies` match. + // + // If specified, this listener must have a `protocol` of `http`, and the target + // 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. @@ -33932,12 +34000,19 @@ type CreateLoadBalancerListenerPolicyOptions struct { // The policy action. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the - // unexpected property value was encountered. + // - `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` + // - `redirect`: Requests will be redirected to the specified `target.url` + // - `reject`: Requests will be rejected with a `403` status code + // + // 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"` - // Priority of the policy. Lower value indicates higher priority. + // Priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value + // indicates higher priority. Priority *int64 `json:"priority" validate:"required"` // The name for this policy. The name must not be used by another policy for the load balancer listener. If @@ -33948,9 +34023,9 @@ type CreateLoadBalancerListenerPolicyOptions struct { Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. // - If `action` is `https_redirect`, specify a - // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` // Allows users to set headers on API requests @@ -33960,9 +34035,15 @@ type CreateLoadBalancerListenerPolicyOptions struct { // Constants associated with the CreateLoadBalancerListenerPolicyOptions.Action property. // The policy action. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the -// unexpected property value was encountered. +// - `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` +// - `redirect`: Requests will be redirected to the specified `target.url` +// - `reject`: Requests will be rejected with a `403` status code +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( CreateLoadBalancerListenerPolicyOptionsActionForwardConst = "forward" CreateLoadBalancerListenerPolicyOptionsActionHTTPSRedirectConst = "https_redirect" @@ -34396,7 +34477,9 @@ type CreateLoadBalancerPoolOptions struct { // Supported by load balancers in the `application` family (otherwise always `disabled`). ProxyProtocol *string `json:"proxy_protocol,omitempty"` - // The session persistence of this pool. + // The session persistence of this pool. If unspecified, session persistence will be + // disabled, and traffic will be distributed across backend server members of the + // pool. SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` // Allows users to set headers on API requests @@ -34567,13 +34650,12 @@ func (options *CreateNetworkACLRuleOptions) SetHeaders(param map[string]string) // CreatePlacementGroupOptions : The CreatePlacementGroup options. type CreatePlacementGroupOptions struct { - // The strategy for this placement group + // The strategy for this placement group: // - `host_spread`: place on different compute hosts // - `power_spread`: place on compute hosts that use different power sources // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the - // unexpected strategy was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Strategy *string `json:"strategy" validate:"required"` // The name for this placement group. The name must not be used by another placement group in the region. If @@ -34589,13 +34671,12 @@ type CreatePlacementGroupOptions struct { } // Constants associated with the CreatePlacementGroupOptions.Strategy property. -// The strategy for this placement group +// The strategy for this placement group: // - `host_spread`: place on different compute hosts // - `power_spread`: place on compute hosts that use different power sources // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the -// unexpected strategy was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( CreatePlacementGroupOptionsStrategyHostSpreadConst = "host_spread" CreatePlacementGroupOptionsStrategyPowerSpreadConst = "power_spread" @@ -35704,9 +35785,6 @@ type CreateVPCRoutingTableOptions struct { VPCID *string `json:"vpc_id" validate:"required,ne="` // 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 `vpn_server` value is supported, but filter - // support is expected to expand in the future. 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 @@ -36217,14 +36295,10 @@ type CreateVPNServerRouteOptions struct { Destination *string `json:"destination" validate:"required"` // The action to perform with a packet matching the VPN route: - // - `translate`: translate the source IP address to one of the private IP addresses of the VPN server, then deliver - // the packet to target. + // - `translate`: translate the source IP address to one of the private IP addresses of + // the VPN server, then deliver the packet to target. // - `deliver`: deliver the packet to the target. - // - `drop`: drop the packet - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the - // unexpected property value was encountered. + // - `drop`: drop the packet. Action *string `json:"action,omitempty"` // The name for this VPN server route. The name must not be used by another route for the VPN server. If unspecified, @@ -36237,14 +36311,10 @@ type CreateVPNServerRouteOptions struct { // Constants associated with the CreateVPNServerRouteOptions.Action property. // The action to perform with a packet matching the VPN route: -// - `translate`: translate the source IP address to one of the private IP addresses of the VPN server, then deliver the -// packet to target. -// - `deliver`: deliver the packet to the target. -// - `drop`: drop the packet -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the -// unexpected property value was encountered. +// - `translate`: translate the source IP address to one of the private IP addresses of +// the VPN server, then deliver the packet to target. +// - `deliver`: deliver the packet to the target. +// - `drop`: drop the packet. const ( CreateVPNServerRouteOptionsActionDeliverConst = "deliver" CreateVPNServerRouteOptionsActionDropConst = "drop" @@ -36337,9 +36407,8 @@ func UnmarshalDnsInstanceReference(m map[string]json.RawMessage, result interfac type DnsServer struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` // If present, DHCP configuration for this zone will have this DNS server listed first. @@ -36365,9 +36434,8 @@ func UnmarshalDnsServer(m map[string]json.RawMessage, result interface{}) (err e type DnsServerPrototype struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` // DHCP configuration for the specified zone will have this DNS server listed first. @@ -36502,9 +36570,8 @@ type DedicatedHost struct { // The administrative state of the dedicated host. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the dedicated host on which - // the unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. State *string `json:"state" validate:"required"` // The instance profiles usable by instances placed on this dedicated host. @@ -36538,9 +36605,8 @@ const ( // Constants associated with the DedicatedHost.State property. // The administrative state of the dedicated host. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the dedicated host on which -// the unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( DedicatedHostStateAvailableConst = "available" DedicatedHostStateDegradedConst = "degraded" @@ -36758,9 +36824,8 @@ type DedicatedHostDisk struct { // The disk interface used for attaching the disk // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // 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 lifecycle state of this dedicated host disk. @@ -36785,9 +36850,8 @@ type DedicatedHostDisk struct { // Constants associated with the DedicatedHostDisk.InterfaceType property. // The disk interface used for attaching the disk // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( DedicatedHostDiskInterfaceTypeNvmeConst = "nvme" ) @@ -36813,9 +36877,8 @@ const ( // Constants associated with the DedicatedHostDisk.SupportedInstanceInterfaceTypes property. // The disk interface used for attaching the disk. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( DedicatedHostDiskSupportedInstanceInterfaceTypesNvmeConst = "nvme" DedicatedHostDiskSupportedInstanceInterfaceTypesVirtioBlkConst = "virtio_blk" @@ -37384,9 +37447,8 @@ type DedicatedHostProfile struct { // The product family this dedicated host profile belongs to // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // 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 URL for this dedicated host. @@ -37400,18 +37462,16 @@ type DedicatedHostProfile struct { SocketCount DedicatedHostProfileSocketIntf `json:"socket_count" validate:"required"` // The status of the dedicated host profile: - // - `previous`: This dedicated host profile is an older revision, but remains provisionable + // - `previous`: This dedicated host profile is an older revision, but remains provisionable // and usable. - // - `current`: This profile is the latest revision. + // - `current`: This dedicated host profile is the latest revision. // - // Note that revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming - // conventions] + // Revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming conventions] // (https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information on how // generations are defined within a dedicated host profile. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the - // unexpected property value was encountered. + // 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 instance profiles usable by instances placed on dedicated hosts with this profile. @@ -37427,9 +37487,8 @@ type DedicatedHostProfile struct { // Constants associated with the DedicatedHostProfile.Family property. // The product family this dedicated host profile belongs to // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( DedicatedHostProfileFamilyBalancedConst = "balanced" DedicatedHostProfileFamilyComputeConst = "compute" @@ -37438,18 +37497,16 @@ const ( // Constants associated with the DedicatedHostProfile.Status property. // The status of the dedicated host profile: -// - `previous`: This dedicated host profile is an older revision, but remains provisionable +// - `previous`: This dedicated host profile is an older revision, but remains provisionable // and usable. -// - `current`: This profile is the latest revision. +// - `current`: This dedicated host profile is the latest revision. // -// Note that revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming -// conventions] +// Revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming conventions] // (https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information on how // generations are defined within a dedicated host profile. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( DedicatedHostProfileStatusCurrentConst = "current" DedicatedHostProfileStatusPreviousConst = "previous" @@ -37645,9 +37702,8 @@ type DedicatedHostProfileDiskInterface struct { // The interface of the disk for a dedicated host with this profile // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Value *string `json:"value" validate:"required"` } @@ -37660,9 +37716,8 @@ const ( // Constants associated with the DedicatedHostProfileDiskInterface.Value property. // The interface of the disk for a dedicated host with this profile // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( DedicatedHostProfileDiskInterfaceValueNvmeConst = "nvme" ) @@ -37760,9 +37815,8 @@ const ( // Constants associated with the DedicatedHostProfileDiskSupportedInterfaces.Value property. // The disk interface used for attaching the disk. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( DedicatedHostProfileDiskSupportedInterfacesValueNvmeConst = "nvme" DedicatedHostProfileDiskSupportedInterfacesValueVirtioBlkConst = "virtio_blk" @@ -38366,9 +38420,8 @@ type DefaultRoutingTable struct { // The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these // sources. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` // The date and time that this routing table was created. @@ -40960,13 +41013,13 @@ type EndpointGateway struct { // The CRN for this endpoint gateway. CRN *string `json:"crn" validate:"required"` - // The health of this resource. + // 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. + // - `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 endpoint gateway. @@ -40978,8 +41031,7 @@ type EndpointGateway struct { // The reserved IPs bound to this endpoint gateway. Ips []ReservedIPReference `json:"ips" validate:"required"` - // The reasons for the current `lifecycle_state` (if any): - // - `dns_resolution_binding_pending`: the DNS resolution binding is being set up. + // The reasons for the current `lifecycle_state` (if any). LifecycleReasons []EndpointGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the endpoint gateway. @@ -41012,13 +41064,13 @@ type EndpointGateway struct { } // Constants associated with the EndpointGateway.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. +// 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 ( EndpointGatewayHealthStateDegradedConst = "degraded" EndpointGatewayHealthStateFaultedConst = "faulted" @@ -41213,7 +41265,11 @@ func UnmarshalEndpointGatewayCollectionNext(m map[string]json.RawMessage, result // EndpointGatewayLifecycleReason : EndpointGatewayLifecycleReason struct type EndpointGatewayLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. + // A reason code for this lifecycle state: + // - `dns_resolution_binding_pending`: the DNS resolution binding is being set up + // + // 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. @@ -41224,7 +41280,11 @@ type EndpointGatewayLifecycleReason struct { } // Constants associated with the EndpointGatewayLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. +// A reason code for this lifecycle state: +// - `dns_resolution_binding_pending`: the DNS resolution binding is being set up +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( EndpointGatewayLifecycleReasonCodeDnsResolutionBindingPendingConst = "dns_resolution_binding_pending" EndpointGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" @@ -46140,9 +46200,8 @@ func UnmarshalIkePolicyReference(m map[string]json.RawMessage, result interface{ type IP struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -46735,7 +46794,7 @@ type Image struct { // If absent, this image was not created from a volume. SourceVolume *VolumeReference `json:"source_volume,omitempty"` - // The status of this image + // The status of this image: // - available: image can be used (provisionable) // - deleting: image is being deleted, and can no longer be used to provision new // resources @@ -46745,27 +46804,10 @@ type Image struct { // - pending: image is being imported and is not yet `available` // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the - // unexpected property value was encountered. + // 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): - // - `encrypted_data_key_invalid`: image cannot be decrypted with the specified - // `encryption_key` - // - `encryption_key_deleted`: image unusable because its `encryption_key` was deleted - // - `encryption_key_disabled`: image unusable until its `encryption_key` is re-enabled - // - `image_data_corrupted`: image data is corrupt, or is not in the specified format - // - `image_provisioned_size_unsupported`: image requires a boot volume size greater - // than the maximum supported value - // - `image_request_in_progress`: image operation is in progress (such as an import from - // Cloud Object Storage) - // - `image_request_queued`: image request has been accepted but the requested - // operation has not started - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []ImageStatusReason `json:"status_reasons" validate:"required"` // The visibility of this image. @@ -46788,7 +46830,7 @@ const ( ) // Constants associated with the Image.Status property. -// The status of this image +// The status of this image: // - available: image can be used (provisionable) // - deleting: image is being deleted, and can no longer be used to provision new // resources @@ -46798,9 +46840,8 @@ const ( // - pending: image is being imported and is not yet `available` // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ImageStatusAvailableConst = "available" ImageStatusDeletingConst = "deleting" @@ -46907,9 +46948,8 @@ func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error type ImageCatalogOffering struct { // Indicates whether this image is managed as part of a // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. If an image is managed, - // accounts in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise) with access to that catalog can - // specify the image's catalog offering version CRN to provision virtual server instances using the image. + // accounts with access to that catalog can specify the image's catalog offering version CRN to provision virtual + // server instances using the image. Managed *bool `json:"managed" validate:"required"` // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) @@ -47076,10 +47116,6 @@ type ImageExportJob struct { Status *string `json:"status" validate:"required"` // The reasons for the current status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []ImageExportJobStatusReason `json:"status_reasons" validate:"required"` // The Cloud Object Storage bucket of the exported image object. @@ -47222,6 +47258,9 @@ func (imageExportJobPatch *ImageExportJobPatch) AsPatch() (_patch map[string]int // ImageExportJobStatusReason : ImageExportJobStatusReason struct type ImageExportJobStatusReason struct { // A snake case string succinctly identifying the status reason. + // + // 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. @@ -47233,6 +47272,9 @@ type ImageExportJobStatusReason struct { // Constants associated with the ImageExportJobStatusReason.Code property. // A snake case string succinctly identifying the status reason. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ImageExportJobStatusReasonCodeCannotAccessStorageBucketConst = "cannot_access_storage_bucket" ImageExportJobStatusReasonCodeInternalErrorConst = "internal_error" @@ -47698,7 +47740,21 @@ func UnmarshalImageRemote(m map[string]json.RawMessage, result interface{}) (err // ImageStatusReason : ImageStatusReason struct type ImageStatusReason struct { - // A snake case string succinctly identifying the status reason. + // A reason code for the status: + // - `encrypted_data_key_invalid`: image cannot be decrypted with the specified + // `encryption_key` + // - `encryption_key_deleted`: image unusable because its `encryption_key` was deleted + // - `encryption_key_disabled`: image unusable until its `encryption_key` is re-enabled + // - `image_data_corrupted`: image data is corrupt, or is not in the specified format + // - `image_provisioned_size_unsupported`: image requires a boot volume size greater + // than the maximum supported value + // - `image_request_in_progress`: image operation is in progress (such as an import from + // Cloud Object Storage) + // - `image_request_queued`: image request has been accepted but the requested + // operation has not started + // + // 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. @@ -47709,7 +47765,21 @@ type ImageStatusReason struct { } // Constants associated with the ImageStatusReason.Code property. -// A snake case string succinctly identifying the status reason. +// A reason code for the status: +// - `encrypted_data_key_invalid`: image cannot be decrypted with the specified +// `encryption_key` +// - `encryption_key_deleted`: image unusable because its `encryption_key` was deleted +// - `encryption_key_disabled`: image unusable until its `encryption_key` is re-enabled +// - `image_data_corrupted`: image data is corrupt, or is not in the specified format +// - `image_provisioned_size_unsupported`: image requires a boot volume size greater +// than the maximum supported value +// - `image_request_in_progress`: image operation is in progress (such as an import from +// Cloud Object Storage) +// - `image_request_queued`: image request has been accepted but the requested +// operation has not started +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ImageStatusReasonCodeEncryptedDataKeyInvalidConst = "encrypted_data_key_invalid" ImageStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" @@ -47770,25 +47840,16 @@ type Instance struct { // The virtual server instance GPU configuration. Gpu *InstanceGpu `json:"gpu,omitempty"` - // The reasons for the current instance `health_state` (if any): - // - `reservation_capacity_unavailable`: The reservation affinity pool has no - // available capacity. - // - `reservation_deleted`: The reservation affinity pool has a deleted reservation. - // - `reservation_expired`: The reservation affinity pool has an expired reservation. - // - `reservation_failed`: The reservation affinity pool has a failed reservation. - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `health_state` (if any). HealthReasons []InstanceHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 virtual server instance. @@ -47801,10 +47862,6 @@ type Instance struct { Image *ImageReference `json:"image,omitempty"` // The reasons for the current `lifecycle_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. LifecycleReasons []InstanceLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the virtual server instance. @@ -47870,16 +47927,11 @@ type Instance struct { // The status of the virtual server instance. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the instance on which the unexpected - // property value was encountered. + // 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). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []InstanceStatusReason `json:"status_reasons" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance network attachments or instance @@ -47905,13 +47957,13 @@ type Instance struct { } // Constants associated with the Instance.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. +// 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 ( InstanceHealthStateDegradedConst = "degraded" InstanceHealthStateFaultedConst = "faulted" @@ -47940,9 +47992,8 @@ const ( // Constants associated with the Instance.Status property. // The status of the virtual server instance. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the instance on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceStatusDeletingConst = "deleting" InstanceStatusFailedConst = "failed" @@ -48207,24 +48258,22 @@ func UnmarshalInstanceAction(m map[string]json.RawMessage, result interface{}) ( // InstanceAvailabilityPolicy : InstanceAvailabilityPolicy struct type InstanceAvailabilityPolicy struct { - // The action to perform if the compute host experiences a failure. + // The action to perform if the compute host experiences a failure: // - `restart`: Automatically restart the virtual server instance after host failure // - `stop`: Leave the virtual server instance stopped after host failure // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. HostFailure *string `json:"host_failure" validate:"required"` } // Constants associated with the InstanceAvailabilityPolicy.HostFailure property. -// The action to perform if the compute host experiences a failure. +// The action to perform if the compute host experiences a failure: // - `restart`: Automatically restart the virtual server instance after host failure // - `stop`: Leave the virtual server instance stopped after host failure // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceAvailabilityPolicyHostFailureRestartConst = "restart" InstanceAvailabilityPolicyHostFailureStopConst = "stop" @@ -48324,8 +48373,7 @@ func UnmarshalInstanceCatalogOffering(m map[string]json.RawMessage, result inter // // If an offering is specified, the latest version of that offering will be used. // -// The specified offering or offering version may be in a different account in the same -// [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject to IAM policies. +// The specified offering or offering version may be in a different account, subject to IAM policies. // Models which "extend" this model: // - InstanceCatalogOfferingPrototypeCatalogOfferingByOffering // - InstanceCatalogOfferingPrototypeCatalogOfferingByVersion @@ -48563,9 +48611,8 @@ type InstanceDisk struct { // The disk interface used for attaching the disk. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // 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 name for this instance disk. The name is unique across all disks on the instance. @@ -48581,9 +48628,8 @@ type InstanceDisk struct { // Constants associated with the InstanceDisk.InterfaceType property. // The disk interface used for attaching the disk. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceDiskInterfaceTypeNvmeConst = "nvme" InstanceDiskInterfaceTypeVirtioBlkConst = "virtio_blk" @@ -48804,6 +48850,12 @@ type InstanceGroup struct { // The template used to create new instances for this group. InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []InstanceGroupLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the instance group. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + // If present, the load balancer pool this instance group manages. A pool member will // be created for each instance created by this group. LoadBalancerPool *LoadBalancerPoolReference `json:"load_balancer_pool,omitempty"` @@ -48837,6 +48889,18 @@ type InstanceGroup struct { VPC *VPCReference `json:"vpc" validate:"required"` } +// Constants associated with the InstanceGroup.LifecycleState property. +// The lifecycle state of the instance group. +const ( + InstanceGroupLifecycleStateDeletingConst = "deleting" + InstanceGroupLifecycleStateFailedConst = "failed" + InstanceGroupLifecycleStatePendingConst = "pending" + InstanceGroupLifecycleStateStableConst = "stable" + InstanceGroupLifecycleStateSuspendedConst = "suspended" + InstanceGroupLifecycleStateUpdatingConst = "updating" + InstanceGroupLifecycleStateWaitingConst = "waiting" +) + // Constants associated with the InstanceGroup.Status property. // The status of the instance group // - `deleting`: Group is being deleted @@ -48878,6 +48942,14 @@ func UnmarshalInstanceGroup(m map[string]json.RawMessage, result interface{}) (e if err != nil { return } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceGroupLifecycleReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolReference) if err != nil { return @@ -49010,6 +49082,53 @@ func UnmarshalInstanceGroupCollectionNext(m map[string]json.RawMessage, result i return } +// InstanceGroupLifecycleReason : InstanceGroupLifecycleReason struct +type InstanceGroupLifecycleReason struct { + // A reason code for this lifecycle state: + // - `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 InstanceGroupLifecycleReason.Code property. +// A reason code for this lifecycle state: +// - `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 ( + InstanceGroupLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalInstanceGroupLifecycleReason unmarshals an instance of InstanceGroupLifecycleReason from the specified map of raw messages. +func UnmarshalInstanceGroupLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupLifecycleReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // InstanceGroupManager : InstanceGroupManager struct // Models which "extend" this model: // - InstanceGroupManagerAutoScale @@ -50767,7 +50886,15 @@ func UnmarshalInstanceGroupReferenceDeleted(m map[string]json.RawMessage, result // InstanceHealthReason : InstanceHealthReason struct type InstanceHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state: + // - `reservation_capacity_unavailable`: The reservation affinity pool has no + // available capacity. + // - `reservation_deleted`: The reservation affinity pool has a deleted reservation. + // - `reservation_expired`: The reservation affinity pool has an expired reservation. + // - `reservation_failed`: The reservation affinity pool has a failed reservation. + // + // 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 health state. @@ -50778,7 +50905,15 @@ type InstanceHealthReason struct { } // Constants associated with the InstanceHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state: +// - `reservation_capacity_unavailable`: The reservation affinity pool has no +// available capacity. +// - `reservation_deleted`: The reservation affinity pool has a deleted reservation. +// - `reservation_expired`: The reservation affinity pool has an expired reservation. +// - `reservation_failed`: The reservation affinity pool has a failed reservation. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceHealthReasonCodeReservationCapacityUnavailableConst = "reservation_capacity_unavailable" InstanceHealthReasonCodeReservationDeletedConst = "reservation_deleted" @@ -50888,7 +51023,12 @@ func UnmarshalInstanceInitializationPassword(m map[string]json.RawMessage, resul // InstanceLifecycleReason : InstanceLifecycleReason struct type InstanceLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. + // A reason code for this lifecycle state: + // - `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. @@ -50899,7 +51039,12 @@ type InstanceLifecycleReason struct { } // Constants associated with the InstanceLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. +// A reason code for this lifecycle state: +// - `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 ( InstanceLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -51809,18 +51954,16 @@ type InstanceProfile struct { ResourceType *string `json:"resource_type" validate:"required"` // The status of the instance profile: - // - `previous`: This instance profile is an older revision, but remains provisionable and + // - `previous`: This instance profile is an older revision, but remains provisionable and // usable. - // - `current`: This profile is the latest revision. + // - `current`: This profile is the latest revision. // - // Note that revisions are indicated by the generation of an instance profile. Refer to the - // [profile naming conventions] + // Revisions are indicated by the generation of an instance profile. Refer to the [profile naming conventions] // (https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on how // generations are defined within an instance profile. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the - // unexpected property value was encountered. + // 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"` TotalVolumeBandwidth InstanceProfileVolumeBandwidthIntf `json:"total_volume_bandwidth" validate:"required"` @@ -51844,14 +51987,12 @@ const ( // usable. // - `current`: This profile is the latest revision. // -// Note that revisions are indicated by the generation of an instance profile. Refer to the -// [profile naming conventions] +// Revisions are indicated by the generation of an instance profile. Refer to the [profile naming conventions] // (https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on how // generations are defined within an instance profile. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceProfileStatusCurrentConst = "current" InstanceProfileStatusPreviousConst = "previous" @@ -52235,9 +52376,8 @@ func UnmarshalInstanceProfileDiskSize(m map[string]json.RawMessage, result inter type InstanceProfileDiskSupportedInterfaces struct { // The disk interface used for attaching the disk. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Default *string `json:"default" validate:"required"` // The type for this profile field. @@ -52250,9 +52390,8 @@ type InstanceProfileDiskSupportedInterfaces struct { // Constants associated with the InstanceProfileDiskSupportedInterfaces.Default property. // The disk interface used for attaching the disk. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" InstanceProfileDiskSupportedInterfacesDefaultVirtioBlkConst = "virtio_blk" @@ -52267,9 +52406,8 @@ const ( // Constants associated with the InstanceProfileDiskSupportedInterfaces.Values property. // The disk interface used for attaching the disk. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" InstanceProfileDiskSupportedInterfacesValuesVirtioBlkConst = "virtio_blk" @@ -53245,8 +53383,7 @@ type InstancePrototype struct { // // If an offering is specified, the latest version of that offering will be used. // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // The specified offering or offering version may be in a different account, subject // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` @@ -53546,6 +53683,9 @@ func UnmarshalInstanceReservationAffinityPrototype(m map[string]json.RawMessage, // InstanceStatusReason : InstanceStatusReason struct type InstanceStatusReason struct { // A snake case string succinctly identifying the status reason. + // + // 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. @@ -53557,6 +53697,9 @@ type InstanceStatusReason struct { // Constants associated with the InstanceStatusReason.Code property. // A snake case string succinctly identifying the status reason. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceStatusReasonCodeCannotStartConst = "cannot_start" InstanceStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" @@ -53701,8 +53844,7 @@ type InstanceTemplate struct { // // If an offering is specified, the latest version of that offering will be used. // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // The specified offering or offering version may be in a different account, subject // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` } @@ -59309,7 +59451,6 @@ type LoadBalancer struct { Profile *LoadBalancerProfileReference `json:"profile" validate:"required"` // The provisioning status of this load balancer: - // // - `active`: The load balancer is running. // - `create_pending`: The load balancer is being created. // - `delete_pending`: The load balancer is being deleted. @@ -59320,10 +59461,8 @@ type LoadBalancer struct { // - `update_pending`: The load balancer is being updated // to the requested configuration. // - // The enumerated values for this property are expected to expand in the future. When - // processing this property, check for and log unknown values. Optionally halt - // processing and surface the error, or bypass the load balancer on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The public IP addresses assigned to this load balancer. @@ -59371,26 +59510,18 @@ const ( // Constants associated with the LoadBalancer.ProvisioningStatus property. // The provisioning status of this load balancer: -// // - `active`: The load balancer is running. -// // - `create_pending`: The load balancer is being created. -// // - `delete_pending`: The load balancer is being deleted. -// // - `maintenance_pending`: The load balancer is unavailable due to an internal // error (contact IBM support). -// // - `migrate_pending`: The load balancer is migrating to the requested configuration. // Performance may be degraded. -// // - `update_pending`: The load balancer is being updated // to the requested configuration. // -// The enumerated values for this property are expected to expand in the future. When -// processing this property, check for and log unknown values. Optionally halt -// processing and surface the error, or bypass the load balancer on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerProvisioningStatusActiveConst = "active" LoadBalancerProvisioningStatusCreatePendingConst = "create_pending" @@ -59768,12 +59899,15 @@ type LoadBalancerListener struct { CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // The default pool for this listener. If absent, this listener has no default pool. + // + // If `https_redirect` is set, the default pool will not be used. DefaultPool *LoadBalancerPoolReference `json:"default_pool,omitempty"` // The listener's canonical URL. Href *string `json:"href" validate:"required"` - // If present, the target listener that requests are redirected to. + // If present, the target listener that requests are redirected to if none of the + // listener's `policies` match. HTTPSRedirect *LoadBalancerListenerHTTPSRedirect `json:"https_redirect,omitempty"` // The unique identifier for this load balancer listener. @@ -59801,25 +59935,22 @@ type LoadBalancerListener struct { // The listener protocol. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Protocol *string `json:"protocol" validate:"required"` // The provisioning status of this listener // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` } // Constants associated with the LoadBalancerListener.Protocol property. // The listener protocol. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerListenerProtocolHTTPConst = "http" LoadBalancerListenerProtocolHTTPSConst = "https" @@ -59830,9 +59961,8 @@ const ( // Constants associated with the LoadBalancerListener.ProvisioningStatus property. // The provisioning status of this listener // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerListenerProvisioningStatusActiveConst = "active" LoadBalancerListenerProvisioningStatusCreatePendingConst = "create_pending" @@ -59925,6 +60055,49 @@ func UnmarshalLoadBalancerListenerCollection(m map[string]json.RawMessage, resul return } +// LoadBalancerListenerDefaultPoolPatch : The default pool for this listener. If `https_redirect` is set, the default pool will not be used. The specified pool +// must: +// +// - Belong to this load balancer +// - Have the same `protocol` as this listener, or have a compatible protocol. +// At present, the compatible protocols are `http` and `https`. +// - Not already be the `default_pool` for another listener +// +// Specify `null` to remove an existing default pool. +// Models which "extend" this model: +// - LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID +// - LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref +type LoadBalancerListenerDefaultPoolPatch struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerDefaultPoolPatch) isaLoadBalancerListenerDefaultPoolPatch() bool { + return true +} + +type LoadBalancerListenerDefaultPoolPatchIntf interface { + isaLoadBalancerListenerDefaultPoolPatch() bool +} + +// UnmarshalLoadBalancerListenerDefaultPoolPatch unmarshals an instance of LoadBalancerListenerDefaultPoolPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerDefaultPoolPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerDefaultPoolPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // LoadBalancerListenerHTTPSRedirect : LoadBalancerListenerHTTPSRedirect struct type LoadBalancerListenerHTTPSRedirect struct { // The HTTP status code for this redirect. @@ -60079,7 +60252,8 @@ type LoadBalancerListenerPatch struct { // The connection limit of the listener. ConnectionLimit *int64 `json:"connection_limit,omitempty"` - // The default pool for this listener. The specified pool must: + // The default pool for this listener. If `https_redirect` is set, the default pool will not + // be used. The specified pool must: // // - Belong to this load balancer // - Have the same `protocol` as this listener, or have a compatible protocol. @@ -60087,10 +60261,13 @@ type LoadBalancerListenerPatch struct { // - Not already be the `default_pool` for another listener // // Specify `null` to remove an existing default pool. - DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` + DefaultPool LoadBalancerListenerDefaultPoolPatchIntf `json:"default_pool,omitempty"` - // The target listener that requests will be redirected to. This listener must have a - // `protocol` of `http`, and the target listener must have a `protocol` of `https`. + // The target listener that requests will be redirected to if none of the listener's + // `policies` match. + // + // If specified, this listener must have a `protocol` of `http`, and the target listener + // must have a `protocol` of `https`. // // Specify `null` to remove any existing https redirect. HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPatch `json:"https_redirect,omitempty"` @@ -60172,7 +60349,7 @@ func UnmarshalLoadBalancerListenerPatch(m map[string]json.RawMessage, result int if err != nil { return } - err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentity) + err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerListenerDefaultPoolPatch) if err != nil { return } @@ -60218,9 +60395,15 @@ func (loadBalancerListenerPatch *LoadBalancerListenerPatch) AsPatch() (_patch ma type LoadBalancerListenerPolicy struct { // The policy action. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the - // unexpected property value was encountered. + // - `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` + // - `redirect`: Requests will be redirected to the specified `target.url` + // - `reject`: Requests will be rejected with a `403` status code + // + // 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"` // The date and time that this policy was created. @@ -60236,31 +60419,38 @@ type LoadBalancerListenerPolicy struct { // listener. Name *string `json:"name" validate:"required"` - // Priority of the policy. Lower value indicates higher priority. + // Priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value + // indicates higher priority. Priority *int64 `json:"priority" validate:"required"` // The provisioning status of this policy // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The rules for this policy. Rules []LoadBalancerListenerPolicyRuleReference `json:"rules" validate:"required"` // - If `action` is `forward`, the response is a `LoadBalancerPoolReference` - // - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL` - // - If `action` is `https_redirect`, the response is a `LoadBalancerListenerHTTPSRedirect`. + // - If `action` is `https_redirect`, the response is a + // `LoadBalancerListenerPolicyHTTPSRedirect` + // - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL`. Target LoadBalancerListenerPolicyTargetIntf `json:"target,omitempty"` } // Constants associated with the LoadBalancerListenerPolicy.Action property. // The policy action. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the -// unexpected property value was encountered. +// - `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` +// - `redirect`: Requests will be redirected to the specified `target.url` +// - `reject`: Requests will be rejected with a `403` status code +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerListenerPolicyActionForwardConst = "forward" LoadBalancerListenerPolicyActionHTTPSRedirectConst = "https_redirect" @@ -60271,9 +60461,8 @@ const ( // Constants associated with the LoadBalancerListenerPolicy.ProvisioningStatus property. // The provisioning status of this policy // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerListenerPolicyProvisioningStatusActiveConst = "active" LoadBalancerListenerPolicyProvisioningStatusCreatePendingConst = "create_pending" @@ -60347,13 +60536,14 @@ type LoadBalancerListenerPolicyPatch struct { // The name for this policy. The name must not be used by another policy for the load balancer listener. Name *string `json:"name,omitempty"` - // Priority of the policy. Lower value indicates higher priority. + // Priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value + // indicates higher priority. Priority *int64 `json:"priority,omitempty"` // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. // - If `action` is `https_redirect`, specify a - // `LoadBalancerListenerPolicyHTTPSRedirectPatch`. + // `LoadBalancerListenerPolicyHTTPSRedirectPatch`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. Target LoadBalancerListenerPolicyTargetPatchIntf `json:"target,omitempty"` } @@ -60390,34 +60580,47 @@ func (loadBalancerListenerPolicyPatch *LoadBalancerListenerPolicyPatch) AsPatch( type LoadBalancerListenerPolicyPrototype struct { // The policy action. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the - // unexpected property value was encountered. + // - `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` + // - `redirect`: Requests will be redirected to the specified `target.url` + // - `reject`: Requests will be rejected with a `403` status code + // + // 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"` // The name for this policy. The name must not be used by another policy for the load balancer listener. If // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // Priority of the policy. Lower value indicates higher priority. + // Priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value + // indicates higher priority. Priority *int64 `json:"priority" validate:"required"` // The rule prototype objects for this policy. Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. // - If `action` is `https_redirect`, specify a - // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` } // Constants associated with the LoadBalancerListenerPolicyPrototype.Action property. // The policy action. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the -// unexpected property value was encountered. +// - `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` +// - `redirect`: Requests will be redirected to the specified `target.url` +// - `reject`: Requests will be rejected with a `403` status code +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerListenerPolicyPrototypeActionForwardConst = "forward" LoadBalancerListenerPolicyPrototypeActionHTTPSRedirectConst = "https_redirect" @@ -60546,9 +60749,8 @@ type LoadBalancerListenerPolicyRule struct { // The provisioning status of this rule // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the rule on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The type of the rule. @@ -60573,9 +60775,8 @@ const ( // Constants associated with the LoadBalancerListenerPolicyRule.ProvisioningStatus property. // The provisioning status of this rule // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the rule on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerListenerPolicyRuleProvisioningStatusActiveConst = "active" LoadBalancerListenerPolicyRuleProvisioningStatusCreatePendingConst = "create_pending" @@ -60862,12 +61063,13 @@ func UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted(m map[string]json.R } // LoadBalancerListenerPolicyTarget : - If `action` is `forward`, the response is a `LoadBalancerPoolReference` -// - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL` -// - If `action` is `https_redirect`, the response is a `LoadBalancerListenerHTTPSRedirect`. +// - If `action` is `https_redirect`, the response is a +// `LoadBalancerListenerPolicyHTTPSRedirect` +// - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL`. // Models which "extend" this model: // - LoadBalancerListenerPolicyTargetLoadBalancerPoolReference +// - LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect // - LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL -// - LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect type LoadBalancerListenerPolicyTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. @@ -60885,13 +61087,13 @@ type LoadBalancerListenerPolicyTarget struct { // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - // The redirect target URL. - URL *string `json:"url,omitempty"` - Listener *LoadBalancerListenerReference `json:"listener,omitempty"` // The redirect relative target URI. URI *string `json:"uri,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` } func (*LoadBalancerListenerPolicyTarget) isaLoadBalancerListenerPolicyTarget() bool { @@ -60925,15 +61127,15 @@ func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, res if err != nil { return } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) if err != nil { return } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { return } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { return } @@ -60942,14 +61144,13 @@ func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, res } // LoadBalancerListenerPolicyTargetPatch : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. -// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. -// - If `action` is `https_redirect`, specify a -// `LoadBalancerListenerPolicyHTTPSRedirectPatch`. -// +// - If `action` is `https_redirect`, specify a +// `LoadBalancerListenerPolicyHTTPSRedirectPatch`. +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. // Models which "extend" this model: // - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch // - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch type LoadBalancerListenerPolicyTargetPatch struct { // The unique identifier for this load balancer pool. ID *string `json:"id,omitempty"` @@ -60960,14 +61161,14 @@ type LoadBalancerListenerPolicyTargetPatch struct { // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - // The redirect target URL. - URL *string `json:"url,omitempty"` - // Identifies a load balancer listener by a unique property. Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` // The redirect relative target URI. URI *string `json:"uri,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` } func (*LoadBalancerListenerPolicyTargetPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { @@ -60993,15 +61194,15 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage if err != nil { return } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { return } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { return } @@ -61010,14 +61211,13 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage } // LoadBalancerListenerPolicyTargetPrototype : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. -// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. -// - If `action` is `https_redirect`, specify a -// `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. -// +// - If `action` is `https_redirect`, specify a +// `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. // Models which "extend" this model: // - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype // - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype type LoadBalancerListenerPolicyTargetPrototype struct { // The unique identifier for this load balancer pool. ID *string `json:"id,omitempty"` @@ -61028,14 +61228,14 @@ type LoadBalancerListenerPolicyTargetPrototype struct { // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - // The redirect target URL. - URL *string `json:"url,omitempty"` - // Identifies a load balancer listener by a unique property. Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` // The redirect relative target URI. URI *string `json:"uri,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` } func (*LoadBalancerListenerPolicyTargetPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { @@ -61061,15 +61261,15 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototype(m map[string]json.RawMes if err != nil { return } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { return } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { return } @@ -61094,18 +61294,23 @@ type LoadBalancerListenerPrototypeLoadBalancerContext struct { // The connection limit of the listener. ConnectionLimit *int64 `json:"connection_limit,omitempty"` - // The default pool for this listener. If specified, the pool must: - // - Belong to this load balancer. - // - Have the same `protocol` as this listener, or have a compatible protocol. - // At present, the compatible protocols are `http` and `https`. - // - Not already be the `default_pool` for another listener. + // The default pool for this listener. If `https_redirect` is specified, + // the default pool will not be used. If specified, the pool must: + // + // - Belong to this load balancer. + // - Have the same `protocol` as this listener, or have a compatible protocol. + // At present, the compatible protocols are `http` and `https`. + // - Not already be the `default_pool` for another listener. // // If unspecified, this listener will be created with no default pool, but one may be // subsequently set. DefaultPool *LoadBalancerPoolIdentityByName `json:"default_pool,omitempty"` - // The target listener that requests will be redirected to. This listener must have a - // `protocol` of `http`, and the target listener must have a `protocol` of `https`. + // The target listener that requests will be redirected to if none of the listener's + // `policies` match. + // + // If specified, this listener must have a `protocol` of `http`, and the target + // 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. @@ -61466,16 +61671,14 @@ type LoadBalancerPool struct { // The protocol for this load balancer pool. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Protocol *string `json:"protocol" validate:"required"` // The provisioning status of this pool // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The PROXY protocol setting for this pool: @@ -61487,11 +61690,6 @@ type LoadBalancerPool struct { ProxyProtocol *string `json:"proxy_protocol" validate:"required"` // The session persistence of this pool. - // - // The enumerated values for this property are expected to expand in the future. When - // processing this property, check for and log unknown values. Optionally halt - // processing and surface the error, or bypass the pool on which the unexpected - // property value was encountered. SessionPersistence *LoadBalancerPoolSessionPersistence `json:"session_persistence,omitempty"` } @@ -61506,9 +61704,8 @@ const ( // Constants associated with the LoadBalancerPool.Protocol property. // The protocol for this load balancer pool. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerPoolProtocolHTTPConst = "http" LoadBalancerPoolProtocolHTTPSConst = "https" @@ -61519,9 +61716,8 @@ const ( // Constants associated with the LoadBalancerPool.ProvisioningStatus property. // The provisioning status of this pool // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerPoolProvisioningStatusActiveConst = "active" LoadBalancerPoolProvisioningStatusCreatePendingConst = "create_pending" @@ -61633,9 +61829,8 @@ type LoadBalancerPoolHealthMonitor struct { // The protocol type to use for health checks. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which - // the unexpected property value was encountered. + // 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 health check URL path. Applicable when `type` is `http` or `https`. @@ -61647,9 +61842,8 @@ type LoadBalancerPoolHealthMonitor struct { // Constants associated with the LoadBalancerPoolHealthMonitor.Type property. // The protocol type to use for health checks. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which -// the unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerPoolHealthMonitorTypeHTTPConst = "http" LoadBalancerPoolHealthMonitorTypeHTTPSConst = "https" @@ -61843,8 +62037,8 @@ func UnmarshalLoadBalancerPoolHealthMonitorPrototype(m map[string]json.RawMessag // LoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. // Models which "extend" this model: -// - LoadBalancerPoolIdentityByID -// - LoadBalancerPoolIdentityByHref +// - LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref type LoadBalancerPoolIdentity struct { // The unique identifier for this load balancer pool. ID *string `json:"id,omitempty"` @@ -61926,9 +62120,8 @@ type LoadBalancerPoolMember struct { // The provisioning status of this member // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool member on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The pool member target. Load balancers in the `network` family support virtual server @@ -61953,9 +62146,8 @@ const ( // Constants associated with the LoadBalancerPoolMember.ProvisioningStatus property. // The provisioning status of this member // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool member on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerPoolMemberProvisioningStatusActiveConst = "active" LoadBalancerPoolMemberProvisioningStatusCreatePendingConst = "create_pending" @@ -62199,9 +62391,8 @@ type LoadBalancerPoolMemberTarget struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` } @@ -62262,9 +62453,8 @@ type LoadBalancerPoolMemberTargetPrototype struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` } @@ -62439,7 +62629,9 @@ type LoadBalancerPoolPrototype struct { // Supported by load balancers in the `application` family (otherwise always `disabled`). ProxyProtocol *string `json:"proxy_protocol,omitempty"` - // The session persistence of this pool. + // The session persistence of this pool. If unspecified, session persistence will be + // disabled, and traffic will be distributed across backend server members of the + // pool. SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` } @@ -62586,12 +62778,18 @@ type LoadBalancerPoolSessionPersistence struct { // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` // protocols. + // + // 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"` } // Constants associated with the LoadBalancerPoolSessionPersistence.Type property. // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` // protocols. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerPoolSessionPersistenceTypeAppCookieConst = "app_cookie" LoadBalancerPoolSessionPersistenceTypeHTTPCookieConst = "http_cookie" @@ -62698,9 +62896,8 @@ type LoadBalancerPrivateIpsItem struct { // // If the address has not yet been selected, the value will be `0.0.0.0`. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` // If present, this property indicates the referenced resource has been deleted, and provides @@ -62761,9 +62958,8 @@ func UnmarshalLoadBalancerPrivateIpsItem(m map[string]json.RawMessage, result in type LoadBalancerProfile struct { // The product family this load balancer profile belongs to. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the - // unexpected property value was encountered. + // 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 URL for this load balancer profile. @@ -62787,9 +62983,8 @@ type LoadBalancerProfile struct { // Constants associated with the LoadBalancerProfile.Family property. // The product family this load balancer profile belongs to. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerProfileFamilyApplicationConst = "application" LoadBalancerProfileFamilyNetworkConst = "network" @@ -63036,9 +63231,8 @@ func UnmarshalLoadBalancerProfileLoggingSupported(m map[string]json.RawMessage, type LoadBalancerProfileReference struct { // The product family this load balancer profile belongs to. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the - // unexpected property value was encountered. + // 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 URL for this load balancer profile. @@ -63051,9 +63245,8 @@ type LoadBalancerProfileReference struct { // Constants associated with the LoadBalancerProfileReference.Family property. // The product family this load balancer profile belongs to. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerProfileReferenceFamilyApplicationConst = "application" LoadBalancerProfileReferenceFamilyNetworkConst = "network" @@ -65295,13 +65488,12 @@ type PlacementGroup struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The strategy for this placement group + // The strategy for this placement group: // - `host_spread`: place on different compute hosts // - `power_spread`: place on compute hosts that use different power sources // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the - // unexpected strategy was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Strategy *string `json:"strategy" validate:"required"` } @@ -65324,13 +65516,12 @@ const ( ) // Constants associated with the PlacementGroup.Strategy property. -// The strategy for this placement group +// The strategy for this placement group: // - `host_spread`: place on different compute hosts // - `power_spread`: place on compute hosts that use different power sources // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the -// unexpected strategy was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( PlacementGroupStrategyHostSpreadConst = "host_spread" PlacementGroupStrategyPowerSpreadConst = "power_spread" @@ -66551,9 +66742,8 @@ type Reservation struct { // The affinity policy to use for this reservation: // - `restricted`: The reservation must be manually requested // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AffinityPolicy *string `json:"affinity_policy" validate:"required"` // The capacity configuration for this reservation @@ -66595,16 +66785,11 @@ type Reservation struct { // The status of the reservation. // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // 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). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []ReservationStatusReason `json:"status_reasons" validate:"required"` // The zone for this reservation. @@ -66615,9 +66800,8 @@ type Reservation struct { // The affinity policy to use for this reservation: // - `restricted`: The reservation must be manually requested // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationAffinityPolicyRestrictedConst = "restricted" ) @@ -66643,9 +66827,8 @@ const ( // Constants associated with the Reservation.Status property. // The status of the reservation. // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationStatusActivatingConst = "activating" ReservationStatusActiveConst = "active" @@ -66740,9 +66923,8 @@ type ReservationCapacity struct { // See https://cloud.ibm.com/docs/vpc?topic=vpc-capacity-status for more information. // - `unallocated`: The capacity reservation is not allocated for use // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // 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 total amount of this capacity reservation. @@ -66761,9 +66943,8 @@ type ReservationCapacity struct { // See https://cloud.ibm.com/docs/vpc?topic=vpc-capacity-status for more information. // - `unallocated`: The capacity reservation is not allocated for use // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationCapacityStatusAllocatedConst = "allocated" ReservationCapacityStatusAllocatingConst = "allocating" @@ -66945,18 +67126,16 @@ type ReservationCommittedUse struct { // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ExpirationPolicy *string `json:"expiration_policy" validate:"required"` // The term for this committed use reservation: // - `one_year`: 1 year // - `three_year`: 3 years // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Term *string `json:"term" validate:"required"` } @@ -66966,9 +67145,8 @@ type ReservationCommittedUse struct { // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationCommittedUseExpirationPolicyReleaseConst = "release" ReservationCommittedUseExpirationPolicyRenewConst = "renew" @@ -67000,9 +67178,8 @@ type ReservationCommittedUsePatch struct { // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ExpirationPolicy *string `json:"expiration_policy,omitempty"` // The term for this committed use reservation: @@ -67021,9 +67198,8 @@ type ReservationCommittedUsePatch struct { // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationCommittedUsePatchExpirationPolicyReleaseConst = "release" ReservationCommittedUsePatchExpirationPolicyRenewConst = "renew" @@ -67051,9 +67227,8 @@ type ReservationCommittedUsePrototype struct { // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ExpirationPolicy *string `json:"expiration_policy,omitempty"` // The term for this committed use reservation: @@ -67070,9 +67245,8 @@ type ReservationCommittedUsePrototype struct { // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationCommittedUsePrototypeExpirationPolicyReleaseConst = "release" ReservationCommittedUsePrototypeExpirationPolicyRenewConst = "renew" @@ -67387,6 +67561,9 @@ func UnmarshalReservationReferenceDeleted(m map[string]json.RawMessage, result i // ReservationStatusReason : ReservationStatusReason struct type ReservationStatusReason struct { // A snake case string succinctly identifying the status reason. + // + // 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. @@ -67398,6 +67575,9 @@ type ReservationStatusReason struct { // Constants associated with the ReservationStatusReason.Code property. // A snake case string succinctly identifying the status reason. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationStatusReasonCodeCannotActivateNoCapacityAvailableConst = "cannot_activate_no_capacity_available" ReservationStatusReasonCodeCannotRenewUnsupportedProfileTermConst = "cannot_renew_unsupported_profile_term" @@ -67428,9 +67608,8 @@ type ReservedIP struct { // // If the address has not yet been selected, the value will be `0.0.0.0`. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` // Indicates whether this reserved IP member will be automatically deleted when either @@ -68026,9 +68205,8 @@ type ReservedIPReference struct { // // If the address has not yet been selected, the value will be `0.0.0.0`. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` // If present, this property indicates the referenced resource has been deleted, and provides @@ -68377,9 +68555,8 @@ type Route struct { // - `service`: route was directly created by a service // - `user`: route was directly created by a user // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Origin *string `json:"origin,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -68429,9 +68606,8 @@ const ( // - `service`: route was directly created by a service // - `user`: route was directly created by a user // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( RouteOriginServiceConst = "service" RouteOriginUserConst = "user" @@ -68724,9 +68900,8 @@ type RouteCollectionVPCContextRoutesItem struct { // - `service`: route was directly created by a service // - `user`: route was directly created by a user // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Origin *string `json:"origin,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -68776,9 +68951,8 @@ const ( // - `service`: route was directly created by a service // - `user`: route was directly created by a user // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. +// 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" @@ -68922,9 +69096,8 @@ func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (er type RouteNextHop struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` // If present, this property indicates the referenced resource has been deleted, and provides @@ -69000,9 +69173,8 @@ func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (er type RouteNextHopPatch struct { // The sentinel IP address (`0.0.0.0`). // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` // The unique identifier for this VPN gateway connection. @@ -69222,9 +69394,8 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( type RoutePrototypeNextHop struct { // The sentinel IP address (`0.0.0.0`). // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` // The unique identifier for this VPN gateway connection. @@ -69329,9 +69500,8 @@ type RoutingTable struct { // The ingress sources to advertise routes to. Routes in the table with `advertise` enabled will be advertised to these // sources. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` // The date and time that this routing table was created. @@ -69628,9 +69798,6 @@ type RoutingTablePatch struct { // (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. - // - // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter - // support is expected to expand in the future. 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 @@ -70133,11 +70300,18 @@ type SecurityGroupRule struct { // The unique identifier for this security group rule. ID *string `json:"id" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version" validate:"required"` + // The local IP address or range of local IP addresses to which this rule will allow inbound + // traffic (or from which, for outbound traffic). A CIDR block of `0.0.0.0/0` allows traffic + // to all local IP addresses (or from all local IP addresses, for outbound rules). + Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` + // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` @@ -70167,8 +70341,10 @@ const ( ) // Constants associated with the SecurityGroupRule.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRuleIPVersionIpv4Const = "ipv4" @@ -70235,6 +70411,139 @@ func UnmarshalSecurityGroupRuleCollection(m map[string]json.RawMessage, result i return } +// SecurityGroupRuleLocal : The local IP address or range of local IP addresses to which this rule will allow inbound traffic (or from which, for +// outbound traffic). A CIDR block of `0.0.0.0/0` allows traffic to all local IP addresses (or from all local IP +// addresses, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleLocalIP +// - SecurityGroupRuleLocalCIDR +type SecurityGroupRuleLocal struct { + // The IP address. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. + Address *string `json:"address,omitempty"` + + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. + CIDRBlock *string `json:"cidr_block,omitempty"` +} + +func (*SecurityGroupRuleLocal) isaSecurityGroupRuleLocal() bool { + return true +} + +type SecurityGroupRuleLocalIntf interface { + isaSecurityGroupRuleLocal() bool +} + +// UnmarshalSecurityGroupRuleLocal unmarshals an instance of SecurityGroupRuleLocal from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocal(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocal) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleLocalPatch : The local IP address or range of local IP addresses to which this rule will allow inbound traffic (or from which, for +// outbound traffic). Can be specified as an IP address or a CIDR block. +// +// Specify a CIDR block of `0.0.0.0/0` to allow traffic to all local IP addresses (or from all local IP addresses, for +// outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleLocalPatchIP +// - SecurityGroupRuleLocalPatchCIDR +type SecurityGroupRuleLocalPatch struct { + // The IP address. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. + Address *string `json:"address,omitempty"` + + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. + CIDRBlock *string `json:"cidr_block,omitempty"` +} + +func (*SecurityGroupRuleLocalPatch) isaSecurityGroupRuleLocalPatch() bool { + return true +} + +type SecurityGroupRuleLocalPatchIntf interface { + isaSecurityGroupRuleLocalPatch() bool +} + +// UnmarshalSecurityGroupRuleLocalPatch unmarshals an instance of SecurityGroupRuleLocalPatch from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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) +// +// If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP addresses (or from all +// local IP addresses, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleLocalPrototypeIP +// - SecurityGroupRuleLocalPrototypeCIDR +type SecurityGroupRuleLocalPrototype struct { + // The IP address. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. + Address *string `json:"address,omitempty"` + + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. + CIDRBlock *string `json:"cidr_block,omitempty"` +} + +func (*SecurityGroupRuleLocalPrototype) isaSecurityGroupRuleLocalPrototype() bool { + return true +} + +type SecurityGroupRuleLocalPrototypeIntf interface { + isaSecurityGroupRuleLocalPrototype() bool +} + +// UnmarshalSecurityGroupRuleLocalPrototype unmarshals an instance of SecurityGroupRuleLocalPrototype from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalPrototype) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SecurityGroupRulePatch : SecurityGroupRulePatch struct type SecurityGroupRulePatch struct { // The ICMP traffic code to allow. If set, `type` must also be set. @@ -70245,11 +70554,21 @@ type SecurityGroupRulePatch struct { // The direction of traffic to enforce. Direction *string `json:"direction,omitempty"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` + // The local IP address or range of local IP addresses to which this rule will allow inbound + // traffic (or from which, for outbound traffic). Can be specified as an IP address or a CIDR + // block. + // + // Specify a CIDR block of `0.0.0.0/0` to allow traffic to all local IP addresses (or from all + // local IP addresses, for outbound rules). + Local SecurityGroupRuleLocalPatchIntf `json:"local,omitempty"` + // The inclusive upper bound of the protocol destination port range. If set, `port_min` must also be set, and must not // be larger. // @@ -70282,8 +70601,10 @@ const ( ) // Constants associated with the SecurityGroupRulePatch.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRulePatchIPVersionIpv4Const = "ipv4" @@ -70304,6 +70625,10 @@ func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interf if err != nil { return } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPatch) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) if err != nil { return @@ -70343,11 +70668,20 @@ type SecurityGroupRulePrototype struct { // The direction of traffic to enforce. Direction *string `json:"direction" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` + // The local IP address or range of local IP addresses to which this rule will allow inbound + // traffic (or from which, for outbound traffic) + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP + // addresses (or from all local IP addresses, for outbound rules). + Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` + // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` @@ -70390,8 +70724,10 @@ const ( ) // Constants associated with the SecurityGroupRulePrototype.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRulePrototypeIPVersionIpv4Const = "ipv4" @@ -70451,14 +70787,14 @@ func UnmarshalSecurityGroupRulePrototype(m map[string]json.RawMessage, result in type SecurityGroupRuleRemote struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. CIDRBlock *string `json:"cidr_block,omitempty"` // The security group's CRN. @@ -70531,14 +70867,14 @@ func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result inter type SecurityGroupRuleRemotePatch struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. CIDRBlock *string `json:"cidr_block,omitempty"` // The unique identifier for this security group. @@ -70598,14 +70934,14 @@ func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result type SecurityGroupRuleRemotePrototype struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. CIDRBlock *string `json:"cidr_block,omitempty"` // The unique identifier for this security group. @@ -70745,9 +71081,10 @@ func UnmarshalSecurityGroupTargetCollectionNext(m map[string]json.RawMessage, re return } -// SecurityGroupTargetReference : The resource types that can be security group targets are expected to expand in the future. When iterating over -// security group targets, do not assume that every target resource will be from a known set of resource types. -// Optionally halt processing and surface an error, or bypass resources of unrecognized types. +// SecurityGroupTargetReference : A target of this security group. +// +// 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: // - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext // - SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext @@ -70890,9 +71227,8 @@ type Share struct { // target control access to the mount target. // - `vpc`: All clients in the VPC for a mount target have access to the mount target. // - // The enumerated access control mode values for this property may expand in the future. When processing this property, - // check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which - // the unexpected access control mode was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AccessControlMode *string `json:"access_control_mode" validate:"required"` // The date and time that the file share is created. @@ -70955,30 +71291,30 @@ type Share struct { // This property will be present when the `replication_role` is `replica`. ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` - // The replication role of the file share. + // The replication role of the file share: + // - `none`: This share is not participating in replication. + // - `replica`: This share is a replication target. + // - `source`: This share is a replication source. // - // * `none`: This share is not participating in replication. - // * `replica`: This share is a replication target. - // * `source`: This share is a replication source. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ReplicationRole *string `json:"replication_role" validate:"required"` - // The replication status of the file share. - // - // * `active`: This share is actively participating in replication, and the replica's data is up-to-date with the + // The replication status of the file share: + // - `active`: This share is actively participating in replication, and the replica's data is up-to-date with the // replication schedule. - // * `degraded`: This is share is participating in replication, but the replica's data has fallen behind the + // - `degraded`: This is share is participating in replication, but the replica's data has fallen behind the // replication schedule. - // * `failover_pending`: This share is performing a replication failover. - // * `initializing`: This share is initializing replication. - // * `none`: This share is not participating in replication. - // * `split_pending`: This share is performing a replication split. + // - `failover_pending`: This share is performing a replication failover. + // - `initializing`: This share is initializing replication. + // - `none`: This share is not participating in replication. + // - `split_pending`: This share is performing a replication split. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ReplicationStatus *string `json:"replication_status" validate:"required"` // The reasons for the current replication status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. ReplicationStatusReasons []ShareReplicationStatusReason `json:"replication_status_reasons" validate:"required"` // The resource group for this file share. @@ -71011,9 +71347,8 @@ type Share struct { // target control access to the mount target. // - `vpc`: All clients in the VPC for a mount target have access to the mount target. // -// The enumerated access control mode values for this property may expand in the future. When processing this property, -// check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which -// the unexpected access control mode was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareAccessControlModeSecurityGroupConst = "security_group" ShareAccessControlModeVPCConst = "vpc" @@ -71039,11 +71374,13 @@ const ( ) // Constants associated with the Share.ReplicationRole property. -// The replication role of the file share. +// The replication role of the file share: +// - `none`: This share is not participating in replication. +// - `replica`: This share is a replication target. +// - `source`: This share is a replication source. // -// * `none`: This share is not participating in replication. -// * `replica`: This share is a replication target. -// * `source`: This share is a replication source. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareReplicationRoleNoneConst = "none" ShareReplicationRoleReplicaConst = "replica" @@ -71051,16 +71388,18 @@ const ( ) // Constants associated with the Share.ReplicationStatus property. -// The replication status of the file share. -// -// * `active`: This share is actively participating in replication, and the replica's data is up-to-date with the +// The replication status of the file share: +// - `active`: This share is actively participating in replication, and the replica's data is up-to-date with the // replication schedule. -// * `degraded`: This is share is participating in replication, but the replica's data has fallen behind the replication +// - `degraded`: This is share is participating in replication, but the replica's data has fallen behind the replication // schedule. -// * `failover_pending`: This share is performing a replication failover. -// * `initializing`: This share is initializing replication. -// * `none`: This share is not participating in replication. -// * `split_pending`: This share is performing a replication split. +// - `failover_pending`: This share is performing a replication failover. +// - `initializing`: This share is initializing replication. +// - `none`: This share is not participating in replication. +// - `split_pending`: This share is performing a replication split. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareReplicationStatusActiveConst = "active" ShareReplicationStatusDegradedConst = "degraded" @@ -71344,50 +71683,40 @@ func UnmarshalShareInitialOwner(m map[string]json.RawMessage, result interface{} // ShareJob : ShareJob struct type ShareJob struct { - // The status of the file share job. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the - // unexpected property value was encountered. - // - // * `cancelled`: This job has been cancelled. - // * `failed`: This job has failed. - // * `queued`: This job is queued. - // * `running`: This job is running. - // * `succeeded`: This job completed successfully. + // The status of the file share job: + // - `cancelled`: This job has been cancelled. + // - `failed`: This job has failed. + // - `queued`: This job is queued. + // - `running`: This job is running. + // - `succeeded`: This job completed successfully. + // + // 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 file share job status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []ShareJobStatusReason `json:"status_reasons" validate:"required"` - // The type of the file share job. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the - // unexpected property value was encountered. + // The type of the file share job: + // - `replication_failover`: This is a share replication failover job. + // - `replication_init`: This is a share replication is initialization job. + // - `replication_split`: This is a share replication split job. // - // * `replication_failover`: This is a share replication failover job. - // * `replication_init`: This is a share replication is initialization job. - // * `replication_split`: This is a share replication split job. + // 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"` } // Constants associated with the ShareJob.Status property. -// The status of the file share job. +// The status of the file share job: +// - `cancelled`: This job has been cancelled. +// - `failed`: This job has failed. +// - `queued`: This job is queued. +// - `running`: This job is running. +// - `succeeded`: This job completed successfully. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the -// unexpected property value was encountered. -// -// * `cancelled`: This job has been cancelled. -// * `failed`: This job has failed. -// * `queued`: This job is queued. -// * `running`: This job is running. -// * `succeeded`: This job completed successfully. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareJobStatusCancelledConst = "cancelled" ShareJobStatusFailedConst = "failed" @@ -71397,15 +71726,13 @@ const ( ) // Constants associated with the ShareJob.Type property. -// The type of the file share job. -// -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the -// unexpected property value was encountered. +// The type of the file share job: +// - `replication_failover`: This is a share replication failover job. +// - `replication_init`: This is a share replication is initialization job. +// - `replication_split`: This is a share replication split job. // -// * `replication_failover`: This is a share replication failover job. -// * `replication_init`: This is a share replication is initialization job. -// * `replication_split`: This is a share replication split job. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareJobTypeReplicationFailoverConst = "replication_failover" ShareJobTypeReplicationInitConst = "replication_init" @@ -71434,6 +71761,9 @@ func UnmarshalShareJob(m map[string]json.RawMessage, result interface{}) (err er // ShareJobStatusReason : ShareJobStatusReason struct type ShareJobStatusReason struct { // A snake case string succinctly identifying the status reason. + // + // 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. @@ -71445,6 +71775,9 @@ type ShareJobStatusReason struct { // Constants associated with the ShareJobStatusReason.Code property. // A snake case string succinctly identifying the status reason. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareJobStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication" ShareJobStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share" @@ -71512,9 +71845,8 @@ type ShareMountTarget struct { // target control access to the mount target. // - `vpc`: All clients in the VPC for a mount target have access to the mount target. // - // The enumerated access control mode values for this property may expand in the future. When processing this property, - // check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which - // the unexpected access control mode was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AccessControlMode *string `json:"access_control_mode" validate:"required"` // The date and time that the share mount target was created. @@ -71563,9 +71895,8 @@ type ShareMountTarget struct { // - `none`: Not encrypted in transit // - `user_managed`: Encrypted in transit using an instance identity certificate // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. TransitEncryption *string `json:"transit_encryption" validate:"required"` // The virtual network interface for this file share mount target. @@ -71589,9 +71920,8 @@ type ShareMountTarget struct { // target control access to the mount target. // - `vpc`: All clients in the VPC for a mount target have access to the mount target. // -// The enumerated access control mode values for this property may expand in the future. When processing this property, -// check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which -// the unexpected access control mode was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareMountTargetAccessControlModeSecurityGroupConst = "security_group" ShareMountTargetAccessControlModeVPCConst = "vpc" @@ -71620,9 +71950,8 @@ const ( // - `none`: Not encrypted in transit // - `user_managed`: Encrypted in transit using an instance identity certificate // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareMountTargetTransitEncryptionNoneConst = "none" ShareMountTargetTransitEncryptionUserManagedConst = "user_managed" @@ -72921,6 +73250,9 @@ func UnmarshalShareRemote(m map[string]json.RawMessage, result interface{}) (err // ShareReplicationStatusReason : ShareReplicationStatusReason struct type ShareReplicationStatusReason struct { // A snake case string succinctly identifying the status reason. + // + // 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. @@ -72932,6 +73264,9 @@ type ShareReplicationStatusReason struct { // Constants associated with the ShareReplicationStatusReason.Code property. // A snake case string succinctly identifying the status reason. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareReplicationStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication" ShareReplicationStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share" @@ -77685,19 +78020,15 @@ type VPC struct { Dns *Vpcdns `json:"dns" validate:"required"` // The reasons for the current `health_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. HealthReasons []VPCHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 VPC. @@ -77720,13 +78051,13 @@ type VPC struct { } // Constants associated with the VPC.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. +// 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 ( VPCHealthStateDegradedConst = "degraded" VPCHealthStateFaultedConst = "faulted" @@ -78032,6 +78363,18 @@ type VpcdnsResolutionBinding struct { // The endpoint gateways may be remote and therefore may not be directly retrievable. EndpointGateways []EndpointGatewayReferenceRemote `json:"endpoint_gateways" validate:"required"` + // The reasons for the current `health_state` (if any). + HealthReasons []VpcdnsResolutionBindingHealthReason `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 DNS resolution binding. Href *string `json:"href" validate:"required"` @@ -78053,6 +78396,21 @@ type VpcdnsResolutionBinding struct { VPC *VPCReferenceRemote `json:"vpc" validate:"required"` } +// Constants associated with the VpcdnsResolutionBinding.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 ( + VpcdnsResolutionBindingHealthStateDegradedConst = "degraded" + VpcdnsResolutionBindingHealthStateFaultedConst = "faulted" + VpcdnsResolutionBindingHealthStateInapplicableConst = "inapplicable" + VpcdnsResolutionBindingHealthStateOkConst = "ok" +) + // Constants associated with the VpcdnsResolutionBinding.LifecycleState property. // The lifecycle state of the DNS resolution binding. const ( @@ -78082,6 +78440,14 @@ func UnmarshalVpcdnsResolutionBinding(m map[string]json.RawMessage, result inter if err != nil { return } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVpcdnsResolutionBindingHealthReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -78168,6 +78534,44 @@ func (resp *VpcdnsResolutionBindingCollection) GetNextStart() (*string, error) { return start, nil } +// VpcdnsResolutionBindingHealthReason : VpcdnsResolutionBindingHealthReason struct +type VpcdnsResolutionBindingHealthReason 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"` +} + +// Constants associated with the VpcdnsResolutionBindingHealthReason.Code property. +// A reason code for this health state. +const ( + VpcdnsResolutionBindingHealthReasonCodeDisconnectedFromBoundVPCConst = "disconnected_from_bound_vpc" + VpcdnsResolutionBindingHealthReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalVpcdnsResolutionBindingHealthReason unmarshals an instance of VpcdnsResolutionBindingHealthReason from the specified map of raw messages. +func UnmarshalVpcdnsResolutionBindingHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolutionBindingHealthReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VpcdnsResolutionBindingPatch : VpcdnsResolutionBindingPatch struct type VpcdnsResolutionBindingPatch struct { // The name for this DNS resolution binding. The name must not be used by another DNS resolution binding for the VPC. @@ -78523,7 +78927,7 @@ func UnmarshalVpcdnsResolverVPCPatch(m map[string]json.RawMessage, result interf // VPCHealthReason : VPCHealthReason struct type VPCHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state. Code *string `json:"code" validate:"required"` // An explanation of the reason for this health state. @@ -78534,7 +78938,7 @@ type VPCHealthReason struct { } // Constants associated with the VPCHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state. const ( VPCHealthReasonCodeDnsResolutionBindingFailedConst = "dns_resolution_binding_failed" VPCHealthReasonCodeInternalErrorConst = "internal_error" @@ -78900,24 +79304,16 @@ type VPNGateway struct { // The VPN gateway's CRN. CRN *string `json:"crn" validate:"required"` - // The reasons for the current VPN gateway health_state (if any): - // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `health_state` (if any). HealthReasons []VPNGatewayHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 VPN gateway's canonical URL. @@ -78926,13 +79322,7 @@ type VPNGateway struct { // The unique identifier for this VPN gateway. ID *string `json:"id" validate:"required"` - // The reasons for the current VPN gateway lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `lifecycle_state` (if any). LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the VPN gateway. @@ -78960,13 +79350,13 @@ type VPNGateway struct { } // Constants associated with the VPNGateway.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. +// 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 ( VPNGatewayHealthStateDegradedConst = "degraded" VPNGatewayHealthStateFaultedConst = "faulted" @@ -79171,7 +79561,7 @@ func UnmarshalVPNGatewayCollectionNext(m map[string]json.RawMessage, result inte // VPNGatewayConnection : VPNGatewayConnection struct // Models which "extend" this model: -// - VPNGatewayConnectionStaticRouteMode +// - VPNGatewayConnectionRouteMode // - VPNGatewayConnectionPolicyMode type VPNGatewayConnection struct { // If set to false, the VPN gateway connection is shut down. @@ -79218,25 +79608,7 @@ type VPNGatewayConnection struct { // The status of a VPN gateway connection. Status *string `json:"status" validate:"required"` - // The reasons for the current VPN gateway connection status (if any): - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current VPN gateway connection status (if any). StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` // Routing protocols are disabled for this VPN gateway connection. @@ -79294,84 +79666,24 @@ type VPNGatewayConnectionIntf interface { // UnmarshalVPNGatewayConnection unmarshals an instance of VPNGatewayConnection from the specified map of raw messages. func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnection) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - return - } - err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "mode", &discValue) if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'mode': %s", err.Error()) return } - err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) - if err != nil { + if discValue == "" { + err = fmt.Errorf("required discriminator property 'mode' not found in JSON object") return } - err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) - if err != nil { - return + if discValue == "policy" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionPolicyMode) + } else if discValue == "route" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteMode) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'mode': %s", discValue) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -79952,25 +80264,7 @@ type VPNGatewayConnectionStaticRouteModeTunnel struct { // The status of the VPN Tunnel. Status *string `json:"status" validate:"required"` - // The reasons for the current VPN gateway connection tunnels status (if any): - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current status (if any). StatusReasons []VPNGatewayConnectionTunnelStatusReason `json:"status_reasons" validate:"required"` } @@ -80003,6 +80297,9 @@ func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMes // VPNGatewayConnectionStatusReason : VPNGatewayConnectionStatusReason struct type VPNGatewayConnectionStatusReason struct { // A snake case string succinctly identifying the status reason. + // + // 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 VPN gateway connection's status. @@ -80014,6 +80311,9 @@ type VPNGatewayConnectionStatusReason struct { // Constants associated with the VPNGatewayConnectionStatusReason.Code property. // A snake case string succinctly identifying the status reason. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionStatusReasonCodeCannotAuthenticateConnectionConst = "cannot_authenticate_connection" VPNGatewayConnectionStatusReasonCodeIkePolicyMismatchConst = "ike_policy_mismatch" @@ -80045,7 +80345,24 @@ func UnmarshalVPNGatewayConnectionStatusReason(m map[string]json.RawMessage, res // VPNGatewayConnectionTunnelStatusReason : VPNGatewayConnectionTunnelStatusReason struct type VPNGatewayConnectionTunnelStatusReason struct { - // A snake case string succinctly identifying the status reason. + // A reason code for this status: + // - `cannot_authenticate_connection`: Failed to authenticate a connection because of + // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) + // - `internal_error`: Internal error (contact IBM support) + // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check + // the IKE policies on both sides of the VPN) + // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and + // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE + // V1 configuration) + // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE + // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) + // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable + // (check the IPsec policies on both sides of the VPN) + // - `peer_not_responding`: No response from peer (check network ACL configuration, peer + // availability, and on-premise firewall configuration) + // + // 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 VPN gateway connection tunnel's status. @@ -80056,7 +80373,24 @@ type VPNGatewayConnectionTunnelStatusReason struct { } // Constants associated with the VPNGatewayConnectionTunnelStatusReason.Code property. -// A snake case string succinctly identifying the status reason. +// A reason code for this status: +// - `cannot_authenticate_connection`: Failed to authenticate a connection because of +// mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) +// - `internal_error`: Internal error (contact IBM support) +// - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check +// the IKE policies on both sides of the VPN) +// - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and +// remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE +// V1 configuration) +// - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE +// V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) +// - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable +// (check the IPsec policies on both sides of the VPN) +// - `peer_not_responding`: No response from peer (check network ACL configuration, peer +// availability, and on-premise firewall configuration) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionTunnelStatusReasonCodeCannotAuthenticateConnectionConst = "cannot_authenticate_connection" VPNGatewayConnectionTunnelStatusReasonCodeIkePolicyMismatchConst = "ike_policy_mismatch" @@ -80088,7 +80422,14 @@ func UnmarshalVPNGatewayConnectionTunnelStatusReason(m map[string]json.RawMessag // VPNGatewayHealthReason : VPNGatewayHealthReason struct type VPNGatewayHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state: + // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (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 health state. @@ -80099,7 +80440,14 @@ type VPNGatewayHealthReason struct { } // Constants associated with the VPNGatewayHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state: +// - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) +// - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's +// subnet) +// - `internal_error`: Internal error (contact IBM support) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route" VPNGatewayHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" @@ -80127,7 +80475,12 @@ func UnmarshalVPNGatewayHealthReason(m map[string]json.RawMessage, result interf // VPNGatewayLifecycleReason : VPNGatewayLifecycleReason struct type VPNGatewayLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. + // A reason code for this lifecycle state: + // - `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. @@ -80138,7 +80491,12 @@ type VPNGatewayLifecycleReason struct { } // Constants associated with the VPNGatewayLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. +// A reason code for this lifecycle state: +// - `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 ( VPNGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -80164,32 +80522,19 @@ func UnmarshalVPNGatewayLifecycleReason(m map[string]json.RawMessage, result int // VPNGatewayMember : VPNGatewayMember struct type VPNGatewayMember struct { - // The reasons for the current VPN gateway member health_state (if any): - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `health_state` (if any). HealthReasons []VPNGatewayMemberHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 reasons for the current VPN gateway member lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `lifecycle_state` (if any). LifecycleReasons []VPNGatewayMemberLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the VPN gateway member. @@ -80208,13 +80553,13 @@ type VPNGatewayMember struct { } // Constants associated with the VPNGatewayMember.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. +// 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 ( VPNGatewayMemberHealthStateDegradedConst = "degraded" VPNGatewayMemberHealthStateFaultedConst = "faulted" @@ -80278,7 +80623,13 @@ func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) // VPNGatewayMemberHealthReason : VPNGatewayMemberHealthReason struct type VPNGatewayMemberHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state: + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (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 health state. @@ -80289,7 +80640,13 @@ type VPNGatewayMemberHealthReason struct { } // Constants associated with the VPNGatewayMemberHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state: +// - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's +// subnet) +// - `internal_error`: Internal error (contact IBM support) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayMemberHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" VPNGatewayMemberHealthReasonCodeInternalErrorConst = "internal_error" @@ -80316,7 +80673,12 @@ func UnmarshalVPNGatewayMemberHealthReason(m map[string]json.RawMessage, result // VPNGatewayMemberLifecycleReason : VPNGatewayMemberLifecycleReason struct type VPNGatewayMemberLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. + // A reason code for this lifecycle state: + // - `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. @@ -80327,7 +80689,12 @@ type VPNGatewayMemberLifecycleReason struct { } // Constants associated with the VPNGatewayMemberLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. +// A reason code for this lifecycle state: +// - `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 ( VPNGatewayMemberLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -80490,30 +80857,16 @@ type VPNServer struct { // Indicates whether the split tunneling is enabled on this VPN server. EnableSplitTunneling *bool `json:"enable_split_tunneling" validate:"required"` - // The reasons for the current VPN server health_state (if any): - // - `cannot_access_client_certificate`: VPN server's client certificate is inaccessible - // (verify certificate exists and that IAM policies grant `VPN server for VPC` access - // to `Secrets Manager`) - // - `cannot_access_server_certificate`: VPN server's server certificate is inaccessible - // (verify certificate exists and that IAM policies grant `VPN server for VPC` access - // to `Secrets Manager`) - // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `health_state` (if any). HealthReasons []VPNServerHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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"` // Fully qualified domain name assigned to this VPN server. @@ -80525,13 +80878,7 @@ type VPNServer struct { // The unique identifier for this VPN server. ID *string `json:"id" validate:"required"` - // The reasons for the current VPN server lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `lifecycle_state` (if any). LifecycleReasons []VPNServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the VPN server. @@ -80566,13 +80913,13 @@ type VPNServer struct { } // Constants associated with the VPNServer.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. +// 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 ( VPNServerHealthStateDegradedConst = "degraded" VPNServerHealthStateFaultedConst = "faulted" @@ -80776,22 +81123,20 @@ func UnmarshalVPNServerAuthentication(m map[string]json.RawMessage, result inter // Models which "extend" this model: // - VPNServerAuthenticationByUsernameIDProviderByIam type VPNServerAuthenticationByUsernameIDProvider struct { - // The type of identity provider to be used by the VPN client. + // The type of identity provider to be used by the VPN client: // - `iam`: IBM identity and access management // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProviderType *string `json:"provider_type,omitempty"` } // Constants associated with the VPNServerAuthenticationByUsernameIDProvider.ProviderType property. -// The type of identity provider to be used by the VPN client. +// The type of identity provider to be used by the VPN client: // - `iam`: IBM identity and access management // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerAuthenticationByUsernameIDProviderProviderTypeIamConst = "iam" ) @@ -80908,9 +81253,8 @@ type VPNServerClient struct { // - `connected`: the VPN client is `connected` to this VPN server. // - `disconnected`: the VPN client is `disconnected` from this VPN server. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN client on which the - // unexpected property value was encountered. + // 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 username that this VPN client provided when connecting to the VPN server. @@ -80930,9 +81274,8 @@ const ( // - `connected`: the VPN client is `connected` to this VPN server. // - `disconnected`: the VPN client is `disconnected` from this VPN server. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN client on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerClientStatusConnectedConst = "connected" VPNServerClientStatusDisconnectedConst = "disconnected" @@ -81175,7 +81518,20 @@ func UnmarshalVPNServerCollectionNext(m map[string]json.RawMessage, result inter // VPNServerHealthReason : VPNServerHealthReason struct type VPNServerHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state: + // - `cannot_access_client_certificate`: VPN server's client certificate is inaccessible + // (verify certificate exists and that IAM policies grant `VPN server for VPC` access + // to `Secrets Manager`) + // - `cannot_access_server_certificate`: VPN server's server certificate is inaccessible + // (verify certificate exists and that IAM policies grant `VPN server for VPC` access + // to `Secrets Manager`) + // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (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 health state. @@ -81186,7 +81542,20 @@ type VPNServerHealthReason struct { } // Constants associated with the VPNServerHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state: +// - `cannot_access_client_certificate`: VPN server's client certificate is inaccessible +// (verify certificate exists and that IAM policies grant `VPN server for VPC` access +// to `Secrets Manager`) +// - `cannot_access_server_certificate`: VPN server's server certificate is inaccessible +// (verify certificate exists and that IAM policies grant `VPN server for VPC` access +// to `Secrets Manager`) +// - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) +// - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's +// subnet) +// - `internal_error`: Internal error (contact IBM support) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerHealthReasonCodeCannotAccessClientCertificateConst = "cannot_access_client_certificate" VPNServerHealthReasonCodeCannotAccessServerCertificateConst = "cannot_access_server_certificate" @@ -81216,7 +81585,12 @@ func UnmarshalVPNServerHealthReason(m map[string]json.RawMessage, result interfa // VPNServerLifecycleReason : VPNServerLifecycleReason struct type VPNServerLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. + // A reason code for this lifecycle state: + // - `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. @@ -81227,7 +81601,12 @@ type VPNServerLifecycleReason struct { } // Constants associated with the VPNServerLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. +// A reason code for this lifecycle state: +// - `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 ( VPNServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -81382,13 +81761,13 @@ func UnmarshalVPNServerReferenceDeleted(m map[string]json.RawMessage, result int // VPNServerRoute : VPNServerRoute struct type VPNServerRoute struct { // The action to perform with a packet matching the VPN route: - // - `translate`: translate the source IP address to one of the private IP addresses of the VPN server. + // - `translate`: translate the source IP address to one of the private IP addresses of + // the VPN server, then deliver the packet to target. // - `deliver`: deliver the packet into the VPC. // - `drop`: drop the packet // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the - // unexpected property value was encountered. + // 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"` // The date and time that the VPN route was created. @@ -81398,21 +81777,16 @@ type VPNServerRoute struct { // be dropped. Destination *string `json:"destination" validate:"required"` - // The reasons for the current VPN server route health_state (if any): - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `health_state` (if any). HealthReasons []VPNServerRouteHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 VPN route. @@ -81421,13 +81795,7 @@ type VPNServerRoute struct { // The unique identifier for this VPN route. ID *string `json:"id" validate:"required"` - // The reasons for the current VPN server route lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `lifecycle_state` (if any). LifecycleReasons []VPNServerRouteLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the VPN route. @@ -81442,13 +81810,13 @@ type VPNServerRoute struct { // Constants associated with the VPNServerRoute.Action property. // The action to perform with a packet matching the VPN route: -// - `translate`: translate the source IP address to one of the private IP addresses of the VPN server. -// - `deliver`: deliver the packet into the VPC. -// - `drop`: drop the packet +// - `translate`: translate the source IP address to one of the private IP addresses of +// the VPN server, then deliver the packet to target. +// - `deliver`: deliver the packet into the VPC. +// - `drop`: drop the packet // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerRouteActionDeliverConst = "deliver" VPNServerRouteActionDropConst = "drop" @@ -81456,13 +81824,13 @@ const ( ) // Constants associated with the VPNServerRoute.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. +// 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 ( VPNServerRouteHealthStateDegradedConst = "degraded" VPNServerRouteHealthStateFaultedConst = "faulted" @@ -81633,7 +82001,11 @@ func UnmarshalVPNServerRouteCollectionNext(m map[string]json.RawMessage, result // VPNServerRouteHealthReason : VPNServerRouteHealthReason struct type VPNServerRouteHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state: + // - `internal_error`: Internal error (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 health state. @@ -81644,7 +82016,11 @@ type VPNServerRouteHealthReason struct { } // Constants associated with the VPNServerRouteHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state: +// - `internal_error`: Internal error (contact IBM support) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerRouteHealthReasonCodeInternalErrorConst = "internal_error" ) @@ -81670,7 +82046,12 @@ func UnmarshalVPNServerRouteHealthReason(m map[string]json.RawMessage, result in // VPNServerRouteLifecycleReason : VPNServerRouteLifecycleReason struct type VPNServerRouteLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. + // A reason code for this lifecycle state: + // - `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. @@ -81681,7 +82062,12 @@ type VPNServerRouteLifecycleReason struct { } // Constants associated with the VPNServerRouteLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. +// A reason code for this lifecycle state: +// - `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 ( VPNServerRouteLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -82254,9 +82640,8 @@ func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessa // VirtualNetworkInterfaceTarget : A virtual network interface target. // -// The resource types that can be virtual network interface targets are expected to expand in the future. When iterating -// over virtual network interface targets, do not assume that every target resource will be from a known set of resource -// types. Optionally halt processing and surface an error, or bypass resources of unrecognized types. +// 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: // - VirtualNetworkInterfaceTargetShareMountTargetReference // - VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext @@ -82338,8 +82723,10 @@ type Volume struct { // operation that is specified to require serialization. Busy *bool `json:"busy" validate:"required"` - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. + // The capacity to use for the volume (in gigabytes). + // + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity" validate:"required"` // The date and time that the volume was created. @@ -82358,19 +82745,15 @@ type Volume struct { EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` // The reasons for the current `health_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. HealthReasons []VolumeHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 volume. @@ -82409,16 +82792,11 @@ type Volume struct { // The status of the volume. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the volume on which the unexpected - // property value was encountered. + // 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). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []VolumeStatusReason `json:"status_reasons" validate:"required"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -82450,13 +82828,13 @@ const ( ) // Constants associated with the Volume.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. +// 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 ( VolumeHealthStateDegradedConst = "degraded" VolumeHealthStateFaultedConst = "faulted" @@ -82473,9 +82851,8 @@ const ( // Constants associated with the Volume.Status property. // The status of the volume. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the volume on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VolumeStatusAvailableConst = "available" VolumeStatusFailedConst = "failed" @@ -82962,8 +83339,10 @@ type VolumeAttachmentPrototypeVolume struct { // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. + // The capacity to use for the volume (in gigabytes). + // + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity,omitempty"` // The root key to use to wrap the data encryption key for the volume. @@ -83297,7 +83676,7 @@ func UnmarshalVolumeCollectionNext(m map[string]json.RawMessage, result interfac // VolumeHealthReason : VolumeHealthReason struct type VolumeHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state. Code *string `json:"code" validate:"required"` // An explanation of the reason for this health state. @@ -83308,7 +83687,7 @@ type VolumeHealthReason struct { } // Constants associated with the VolumeHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state. const ( VolumeHealthReasonCodeInitializingFromSnapshotConst = "initializing_from_snapshot" ) @@ -83381,7 +83760,8 @@ type VolumePatch struct { // and the specified value must not be less than the current capacity. Additionally, if the volume is attached as a // boot volume, the maximum value is 250 gigabytes. // - // The minimum and maximum capacity limits for creating or updating volumes may expand in the future. + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity,omitempty"` // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile @@ -83442,9 +83822,8 @@ func (volumePatch *VolumePatch) AsPatch() (_patch map[string]interface{}, err er type VolumeProfile struct { // The product family this volume profile belongs to. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the volume profile on which the - // unexpected property value was encountered. + // 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 URL for this volume profile. @@ -83457,9 +83836,8 @@ type VolumeProfile struct { // Constants associated with the VolumeProfile.Family property. // The product family this volume profile belongs to. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the volume profile on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VolumeProfileFamilyCustomConst = "custom" VolumeProfileFamilyTieredConst = "tiered" @@ -83662,8 +84040,10 @@ type VolumePrototype struct { // The zone this volume will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. + // The capacity to use for the volume (in gigabytes). + // + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity,omitempty"` // The root key to use to wrap the data encryption key for the volume. @@ -84072,6 +84452,9 @@ func UnmarshalVolumeRemote(m map[string]json.RawMessage, result interface{}) (er // VolumeStatusReason : VolumeStatusReason struct type VolumeStatusReason struct { // A snake case string succinctly identifying the status reason. + // + // 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. @@ -84083,6 +84466,9 @@ type VolumeStatusReason struct { // Constants associated with the VolumeStatusReason.Code property. // A snake case string succinctly identifying the status reason. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VolumeStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" ) @@ -84395,19 +84781,15 @@ type BackupPolicyMatchResourceTypeInstance struct { CRN *string `json:"crn" validate:"required"` // The reasons for the current `health_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. HealthReasons []BackupPolicyHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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. @@ -84446,28 +84828,26 @@ type BackupPolicyMatchResourceTypeInstance struct { // - `boot_volume`: Include the instance's boot volume. // - `data_volumes`: Include the instance's data volumes. // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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" 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 in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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"` } // Constants associated with the BackupPolicyMatchResourceTypeInstance.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. +// 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 ( BackupPolicyMatchResourceTypeInstanceHealthStateDegradedConst = "degraded" BackupPolicyMatchResourceTypeInstanceHealthStateFaultedConst = "faulted" @@ -84504,9 +84884,8 @@ const ( // 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 in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( BackupPolicyMatchResourceTypeInstanceMatchResourceTypeInstanceConst = "instance" ) @@ -84596,19 +84975,15 @@ type BackupPolicyMatchResourceTypeVolume struct { CRN *string `json:"crn" validate:"required"` // The reasons for the current `health_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. HealthReasons []BackupPolicyHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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. @@ -84646,20 +85021,19 @@ type BackupPolicyMatchResourceTypeVolume struct { // 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 in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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"` } // Constants associated with the BackupPolicyMatchResourceTypeVolume.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. +// 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 ( BackupPolicyMatchResourceTypeVolumeHealthStateDegradedConst = "degraded" BackupPolicyMatchResourceTypeVolumeHealthStateFaultedConst = "faulted" @@ -84689,9 +85063,8 @@ const ( // 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 in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( BackupPolicyMatchResourceTypeVolumeMatchResourceTypeVolumeConst = "volume" ) @@ -94502,8 +94875,7 @@ type InstancePrototypeInstanceByCatalogOffering struct { // // If an offering is specified, the latest version of that offering will be used. // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // The specified offering or offering version may be in a different account, subject // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` @@ -95571,8 +95943,7 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // // If an offering is specified, the latest version of that offering will be used. // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // The specified offering or offering version may be in a different account, subject // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` @@ -96368,8 +96739,7 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // // If an offering is specified, the latest version of that offering will be used. // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // The specified offering or offering version may be in a different account, subject // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` @@ -97183,6 +97553,68 @@ func UnmarshalLoadBalancerIdentityByID(m map[string]json.RawMessage, result inte return } +// LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref : LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerListenerDefaultPoolPatch +type LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerDefaultPoolPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID : LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerListenerDefaultPoolPatch +type LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID) isaLoadBalancerListenerDefaultPoolPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // LoadBalancerListenerIdentityByHref : LoadBalancerListenerIdentityByHref struct // This model "extends" LoadBalancerListenerIdentity type LoadBalancerListenerIdentityByHref struct { @@ -97245,9 +97677,9 @@ func UnmarshalLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, res return } -// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct +// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch struct // This model "extends" LoadBalancerListenerPolicyTargetPatch -type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct { +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch struct { // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code,omitempty"` @@ -97258,13 +97690,13 @@ type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch URI *string `json:"uri,omitempty"` } -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { return @@ -97312,8 +97744,8 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRed // LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. // Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref // This model "extends" LoadBalancerListenerPolicyTargetPatch type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity struct { // The unique identifier for this load balancer pool. @@ -97351,9 +97783,9 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity(m ma return } -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype struct // This model "extends" LoadBalancerListenerPolicyTargetPrototype -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct { +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype struct { // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` @@ -97364,9 +97796,9 @@ type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectP URI *string `json:"uri,omitempty"` } -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype{ +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype{ HTTPStatusCode: core.Int64Ptr(httpStatusCode), Listener: listener, } @@ -97374,13 +97806,13 @@ func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHT return } -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { return @@ -97438,8 +97870,8 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolic // LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. // Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref // This model "extends" LoadBalancerListenerPolicyTargetPrototype type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity struct { // The unique identifier for this load balancer pool. @@ -97477,9 +97909,9 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity( return } -// LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect : LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct +// LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect : LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect struct // This model "extends" LoadBalancerListenerPolicyTarget -type LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct { +type LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect struct { // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` @@ -97489,13 +97921,13 @@ type LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct { URI *string `json:"uri,omitempty"` } -func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) isaLoadBalancerListenerPolicyTarget() bool { +func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect) isaLoadBalancerListenerPolicyTarget() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { return @@ -97585,29 +98017,29 @@ func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference(m map[st return } -// LoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityByHref struct +// LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct // This model "extends" LoadBalancerPoolIdentity -type LoadBalancerPoolIdentityByHref struct { +type LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { // The pool's canonical URL. Href *string `json:"href" validate:"required"` } -// NewLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerPoolIdentityByHref{ +// NewLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*LoadBalancerPoolIdentityByHref) isaLoadBalancerPoolIdentity() bool { +func (*LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerPoolIdentity() bool { return true } -// UnmarshalLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolIdentityByHref) +// UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -97616,29 +98048,29 @@ func UnmarshalLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, resul return } -// LoadBalancerPoolIdentityByID : LoadBalancerPoolIdentityByID struct +// LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct // This model "extends" LoadBalancerPoolIdentity -type LoadBalancerPoolIdentityByID struct { +type LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { // The unique identifier for this load balancer pool. ID *string `json:"id" validate:"required"` } -// NewLoadBalancerPoolIdentityByID : Instantiate LoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerPoolIdentityByID{ +// NewLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*LoadBalancerPoolIdentityByID) isaLoadBalancerPoolIdentity() bool { +func (*LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerPoolIdentity() bool { return true } -// UnmarshalLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolIdentityByID) +// UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -97652,9 +98084,8 @@ func UnmarshalLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result type LoadBalancerPoolMemberTargetPrototypeIP struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -97736,9 +98167,8 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity(m map[string type LoadBalancerPoolMemberTargetIP struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -101215,9 +101645,8 @@ func UnmarshalRouteCreatorVPNServerReference(m map[string]json.RawMessage, resul type RouteNextHopIP struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -101244,9 +101673,8 @@ func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) ( type RouteNextHopPatchRouteNextHopIP struct { // The sentinel IP address (`0.0.0.0`). // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` } @@ -101380,9 +101808,8 @@ func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMes type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct { // The sentinel IP address (`0.0.0.0`). // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` } @@ -101606,17 +102033,212 @@ func UnmarshalSecurityGroupIdentityByID(m map[string]json.RawMessage, result int return } +// SecurityGroupRuleLocalPatchCIDR : SecurityGroupRuleLocalPatchCIDR struct +// This model "extends" SecurityGroupRuleLocalPatch +type SecurityGroupRuleLocalPatchCIDR struct { + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +// NewSecurityGroupRuleLocalPatchCIDR : Instantiate SecurityGroupRuleLocalPatchCIDR (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleLocalPatchCIDR(cidrBlock string) (_model *SecurityGroupRuleLocalPatchCIDR, err error) { + _model = &SecurityGroupRuleLocalPatchCIDR{ + CIDRBlock: core.StringPtr(cidrBlock), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleLocalPatchCIDR) isaSecurityGroupRuleLocalPatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleLocalPatchCIDR unmarshals an instance of SecurityGroupRuleLocalPatchCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalPatchCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalPatchCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleLocalPatchIP : SecurityGroupRuleLocalPatchIP struct +// This model "extends" SecurityGroupRuleLocalPatch +type SecurityGroupRuleLocalPatchIP struct { + // The IP address. + // + // 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"` +} + +// NewSecurityGroupRuleLocalPatchIP : Instantiate SecurityGroupRuleLocalPatchIP (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleLocalPatchIP(address string) (_model *SecurityGroupRuleLocalPatchIP, err error) { + _model = &SecurityGroupRuleLocalPatchIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleLocalPatchIP) isaSecurityGroupRuleLocalPatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleLocalPatchIP unmarshals an instance of SecurityGroupRuleLocalPatchIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalPatchIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalPatchIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleLocalPrototypeCIDR : SecurityGroupRuleLocalPrototypeCIDR struct +// This model "extends" SecurityGroupRuleLocalPrototype +type SecurityGroupRuleLocalPrototypeCIDR struct { + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +// NewSecurityGroupRuleLocalPrototypeCIDR : Instantiate SecurityGroupRuleLocalPrototypeCIDR (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleLocalPrototypeCIDR(cidrBlock string) (_model *SecurityGroupRuleLocalPrototypeCIDR, err error) { + _model = &SecurityGroupRuleLocalPrototypeCIDR{ + CIDRBlock: core.StringPtr(cidrBlock), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleLocalPrototypeCIDR) isaSecurityGroupRuleLocalPrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleLocalPrototypeCIDR unmarshals an instance of SecurityGroupRuleLocalPrototypeCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalPrototypeCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalPrototypeCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleLocalPrototypeIP : SecurityGroupRuleLocalPrototypeIP struct +// This model "extends" SecurityGroupRuleLocalPrototype +type SecurityGroupRuleLocalPrototypeIP struct { + // The IP address. + // + // 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"` +} + +// NewSecurityGroupRuleLocalPrototypeIP : Instantiate SecurityGroupRuleLocalPrototypeIP (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleLocalPrototypeIP(address string) (_model *SecurityGroupRuleLocalPrototypeIP, err error) { + _model = &SecurityGroupRuleLocalPrototypeIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*SecurityGroupRuleLocalPrototypeIP) isaSecurityGroupRuleLocalPrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleLocalPrototypeIP unmarshals an instance of SecurityGroupRuleLocalPrototypeIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalPrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalPrototypeIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleLocalCIDR : SecurityGroupRuleLocalCIDR struct +// This model "extends" SecurityGroupRuleLocal +type SecurityGroupRuleLocalCIDR struct { + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +func (*SecurityGroupRuleLocalCIDR) isaSecurityGroupRuleLocal() bool { + return true +} + +// UnmarshalSecurityGroupRuleLocalCIDR unmarshals an instance of SecurityGroupRuleLocalCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleLocalIP : SecurityGroupRuleLocalIP struct +// This model "extends" SecurityGroupRuleLocal +type SecurityGroupRuleLocalIP struct { + // The IP address. + // + // 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 (*SecurityGroupRuleLocalIP) isaSecurityGroupRuleLocal() bool { + return true +} + +// UnmarshalSecurityGroupRuleLocalIP unmarshals an instance of SecurityGroupRuleLocalIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. // This model "extends" SecurityGroupRulePrototype type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { // The direction of traffic to enforce. Direction *string `json:"direction" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` + // The local IP address or range of local IP addresses to which this rule will allow inbound + // traffic (or from which, for outbound traffic) + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP + // addresses (or from all local IP addresses, for outbound rules). + Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` + // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` @@ -101637,8 +102259,10 @@ const ( ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" @@ -101675,6 +102299,10 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[strin if err != nil { return } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPrototype) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return @@ -101698,11 +102326,20 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { // The direction of traffic to enforce. Direction *string `json:"direction" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` + // The local IP address or range of local IP addresses to which this rule will allow inbound + // traffic (or from which, for outbound traffic) + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP + // addresses (or from all local IP addresses, for outbound rules). + Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` + // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` @@ -101728,8 +102365,10 @@ const ( ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" @@ -101770,6 +102409,10 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[stri if err != nil { return } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPrototype) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return @@ -101795,11 +102438,20 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { // The direction of traffic to enforce. Direction *string `json:"direction" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` + // The local IP address or range of local IP addresses to which this rule will allow inbound + // traffic (or from which, for outbound traffic) + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP + // addresses (or from all local IP addresses, for outbound rules). + Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` + // The inclusive upper bound of TCP/UDP destination port range. // // If specified, `port_min` must also be specified, and must not be larger. If unspecified, @@ -101832,8 +102484,10 @@ const ( ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" @@ -101871,6 +102525,10 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[st if err != nil { return } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPrototype) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) if err != nil { return @@ -101894,9 +102552,10 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[st // SecurityGroupRuleRemotePatchCIDR : SecurityGroupRuleRemotePatchCIDR struct // This model "extends" SecurityGroupRuleRemotePatch type SecurityGroupRuleRemotePatchCIDR struct { - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. CIDRBlock *string `json:"cidr_block" validate:"required"` } @@ -101929,9 +102588,8 @@ func UnmarshalSecurityGroupRuleRemotePatchCIDR(m map[string]json.RawMessage, res type SecurityGroupRuleRemotePatchIP struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -102011,9 +102669,10 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity(m map[string]jso // SecurityGroupRuleRemotePrototypeCIDR : SecurityGroupRuleRemotePrototypeCIDR struct // This model "extends" SecurityGroupRuleRemotePrototype type SecurityGroupRuleRemotePrototypeCIDR struct { - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. CIDRBlock *string `json:"cidr_block" validate:"required"` } @@ -102046,9 +102705,8 @@ func UnmarshalSecurityGroupRuleRemotePrototypeCIDR(m map[string]json.RawMessage, type SecurityGroupRuleRemotePrototypeIP struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -102128,9 +102786,10 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity(m map[string // SecurityGroupRuleRemoteCIDR : SecurityGroupRuleRemoteCIDR struct // This model "extends" SecurityGroupRuleRemote type SecurityGroupRuleRemoteCIDR struct { - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. CIDRBlock *string `json:"cidr_block" validate:"required"` } @@ -102154,9 +102813,8 @@ func UnmarshalSecurityGroupRuleRemoteCIDR(m map[string]json.RawMessage, result i type SecurityGroupRuleRemoteIP struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -102238,11 +102896,15 @@ type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { // The unique identifier for this security group rule. ID *string `json:"id" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version" validate:"required"` + Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` // The protocol to enforce. @@ -102257,8 +102919,10 @@ const ( ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRuleSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" @@ -102293,6 +102957,10 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.Ra if err != nil { return } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) + if err != nil { + return + } err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) if err != nil { return @@ -102317,11 +102985,15 @@ type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { // The unique identifier for this security group rule. ID *string `json:"id" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version" validate:"required"` + Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` // The ICMP traffic code to allow. If absent, all codes are allowed. @@ -102342,8 +103014,10 @@ const ( ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRuleSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" @@ -102378,6 +103052,10 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.R if err != nil { return } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) + if err != nil { + return + } err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) if err != nil { return @@ -102413,11 +103091,15 @@ type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { // The unique identifier for this security group rule. ID *string `json:"id" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version" validate:"required"` + Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` // The inclusive upper bound of TCP/UDP destination port range. @@ -102438,8 +103120,10 @@ const ( ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRuleSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" @@ -102475,6 +103159,10 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json if err != nil { return } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) + if err != nil { + return + } err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) if err != nil { return @@ -105457,25 +106145,7 @@ type VPNGatewayConnectionPolicyMode struct { // The status of a VPN gateway connection. Status *string `json:"status" validate:"required"` - // The reasons for the current VPN gateway connection status (if any): - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current VPN gateway connection status (if any). StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` // The local CIDRs for this resource. @@ -105763,9 +106433,11 @@ func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePr return } -// VPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionStaticRouteMode struct +// VPNGatewayConnectionRouteMode : VPNGatewayConnectionRouteMode struct +// Models which "extend" this model: +// - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode // This model "extends" VPNGatewayConnection -type VPNGatewayConnectionStaticRouteMode struct { +type VPNGatewayConnectionRouteMode struct { // If set to false, the VPN gateway connection is shut down. AdminStateUp *bool `json:"admin_state_up" validate:"required"` @@ -105809,73 +106481,64 @@ type VPNGatewayConnectionStaticRouteMode struct { // The status of a VPN gateway connection. Status *string `json:"status" validate:"required"` - // The reasons for the current VPN gateway connection status (if any): - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current VPN gateway connection status (if any). StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol" validate:"required"` + RoutingProtocol *string `json:"routing_protocol,omitempty"` // The VPN tunnel configuration for this VPN gateway connection (in static route mode). - Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels" validate:"required"` + Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels,omitempty"` } -// Constants associated with the VPNGatewayConnectionStaticRouteMode.AuthenticationMode property. +// Constants associated with the VPNGatewayConnectionRouteMode.AuthenticationMode property. // The authentication mode. Only `psk` is currently supported. const ( - VPNGatewayConnectionStaticRouteModeAuthenticationModePskConst = "psk" + VPNGatewayConnectionRouteModeAuthenticationModePskConst = "psk" ) -// Constants associated with the VPNGatewayConnectionStaticRouteMode.Mode property. +// Constants associated with the VPNGatewayConnectionRouteMode.Mode property. // The mode of the VPN gateway. const ( - VPNGatewayConnectionStaticRouteModeModePolicyConst = "policy" - VPNGatewayConnectionStaticRouteModeModeRouteConst = "route" + VPNGatewayConnectionRouteModeModePolicyConst = "policy" + VPNGatewayConnectionRouteModeModeRouteConst = "route" ) -// Constants associated with the VPNGatewayConnectionStaticRouteMode.ResourceType property. +// Constants associated with the VPNGatewayConnectionRouteMode.ResourceType property. // The resource type. const ( - VPNGatewayConnectionStaticRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" + VPNGatewayConnectionRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" ) -// Constants associated with the VPNGatewayConnectionStaticRouteMode.Status property. +// Constants associated with the VPNGatewayConnectionRouteMode.Status property. // The status of a VPN gateway connection. const ( - VPNGatewayConnectionStaticRouteModeStatusDownConst = "down" - VPNGatewayConnectionStaticRouteModeStatusUpConst = "up" + VPNGatewayConnectionRouteModeStatusDownConst = "down" + VPNGatewayConnectionRouteModeStatusUpConst = "up" ) -// Constants associated with the VPNGatewayConnectionStaticRouteMode.RoutingProtocol property. +// Constants associated with the VPNGatewayConnectionRouteMode.RoutingProtocol property. // Routing protocols are disabled for this VPN gateway connection. const ( - VPNGatewayConnectionStaticRouteModeRoutingProtocolNoneConst = "none" + VPNGatewayConnectionRouteModeRoutingProtocolNoneConst = "none" ) -func (*VPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnection() bool { +func (*VPNGatewayConnectionRouteMode) isaVPNGatewayConnectionRouteMode() bool { + return true +} + +type VPNGatewayConnectionRouteModeIntf interface { + VPNGatewayConnectionIntf + isaVPNGatewayConnectionRouteMode() bool +} + +func (*VPNGatewayConnectionRouteMode) isaVPNGatewayConnection() bool { return true } -// UnmarshalVPNGatewayConnectionStaticRouteMode unmarshals an instance of VPNGatewayConnectionStaticRouteMode from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStaticRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStaticRouteMode) +// UnmarshalVPNGatewayConnectionRouteMode unmarshals an instance of VPNGatewayConnectionRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionRouteMode) err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { return @@ -105960,24 +106623,16 @@ type VPNGatewayPolicyMode struct { // The VPN gateway's CRN. CRN *string `json:"crn" validate:"required"` - // The reasons for the current VPN gateway health_state (if any): - // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `health_state` (if any). HealthReasons []VPNGatewayHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 VPN gateway's canonical URL. @@ -105986,13 +106641,7 @@ type VPNGatewayPolicyMode struct { // The unique identifier for this VPN gateway. ID *string `json:"id" validate:"required"` - // The reasons for the current VPN gateway lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `lifecycle_state` (if any). LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the VPN gateway. @@ -106020,13 +106669,13 @@ type VPNGatewayPolicyMode struct { } // Constants associated with the VPNGatewayPolicyMode.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. +// 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 ( VPNGatewayPolicyModeHealthStateDegradedConst = "degraded" VPNGatewayPolicyModeHealthStateFaultedConst = "faulted" @@ -106259,24 +106908,16 @@ type VPNGatewayRouteMode struct { // The VPN gateway's CRN. CRN *string `json:"crn" validate:"required"` - // The reasons for the current VPN gateway health_state (if any): - // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `health_state` (if any). HealthReasons []VPNGatewayHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 VPN gateway's canonical URL. @@ -106285,13 +106926,7 @@ type VPNGatewayRouteMode struct { // The unique identifier for this VPN gateway. ID *string `json:"id" validate:"required"` - // The reasons for the current VPN gateway lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `lifecycle_state` (if any). LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the VPN gateway. @@ -106319,13 +106954,13 @@ type VPNGatewayRouteMode struct { } // Constants associated with the VPNGatewayRouteMode.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. +// 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 ( VPNGatewayRouteModeHealthStateDegradedConst = "degraded" VPNGatewayRouteModeHealthStateFaultedConst = "faulted" @@ -106514,22 +107149,20 @@ func UnmarshalVPNServerAuthenticationByUsername(m map[string]json.RawMessage, re // VPNServerAuthenticationByUsernameIDProviderByIam : VPNServerAuthenticationByUsernameIDProviderByIam struct // This model "extends" VPNServerAuthenticationByUsernameIDProvider type VPNServerAuthenticationByUsernameIDProviderByIam struct { - // The type of identity provider to be used by the VPN client. + // The type of identity provider to be used by the VPN client: // - `iam`: IBM identity and access management // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProviderType *string `json:"provider_type" validate:"required"` } // Constants associated with the VPNServerAuthenticationByUsernameIDProviderByIam.ProviderType property. -// The type of identity provider to be used by the VPN client. +// The type of identity provider to be used by the VPN client: // - `iam`: IBM identity and access management // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerAuthenticationByUsernameIDProviderByIamProviderTypeIamConst = "iam" ) @@ -107053,8 +107686,10 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. + // The capacity to use for the volume (in gigabytes). + // + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity,omitempty"` // The root key to use to wrap the data encryption key for the volume. @@ -107295,8 +107930,10 @@ type VolumePrototypeVolumeByCapacity struct { // The zone this volume will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. + // The capacity to use for the volume (in gigabytes). + // + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity" validate:"required"` // The root key to use to wrap the data encryption key for the volume. @@ -113734,33 +114371,33 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns return } -// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct // This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { // The pool's canonical URL. Href *string `json:"href" validate:"required"` } -// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ +// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { return true } -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatch() bool { +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatch() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -113769,33 +114406,33 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadB return } -// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct // This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { // The unique identifier for this load balancer pool. ID *string `json:"id" validate:"required"` } -// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ +// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { return true } -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatch() bool { +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatch() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -113804,33 +114441,33 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadB return } -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct // This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { // The pool's canonical URL. Href *string `json:"href" validate:"required"` } -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { return true } -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototype() bool { +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototype() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -113839,33 +114476,33 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityL return } -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct // This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { // The unique identifier for this load balancer pool. ID *string `json:"id" validate:"required"` } -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { return true } -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototype() bool { +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototype() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -114404,9 +115041,8 @@ func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNet type RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct { // The sentinel IP address (`0.0.0.0`). // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -114447,9 +115083,8 @@ type RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP struct { // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) // - `255.255.255.255` (the broadcast IP address) // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -114556,9 +115191,8 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionI type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct { // The sentinel IP address (`0.0.0.0`). // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -114599,9 +115233,8 @@ type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototy // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) // - `255.255.255.255` (the broadcast IP address) // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -115018,6 +115651,177 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte return } +// VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct +// This model "extends" VPNGatewayConnectionRouteMode +type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The IKE policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // The IPsec policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The pre-shared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // The reasons for the current VPN gateway connection status (if any). + StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol" validate:"required"` + + // The VPN tunnel configuration for this VPN gateway connection (in static route mode). + Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeModePolicyConst = "policy" + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeStatusDownConst = "down" + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeStatusUpConst = "up" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnectionRouteMode() bool { + return true +} + +func (*VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnection() bool { + return true +} + +// UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode unmarshals an instance of VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct // This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct { @@ -115283,8 +116087,10 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototyp // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. + // The capacity to use for the volume (in gigabytes). + // + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity" validate:"required"` // The root key to use to wrap the data encryption key for the volume. @@ -117522,176 +118328,6 @@ func (pager *DedicatedHostsPager) GetAll() (allItems []DedicatedHost, err error) return pager.GetAllWithContext(context.Background()) } -// BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. -type BackupPoliciesPager struct { - hasNext bool - options *ListBackupPoliciesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewBackupPoliciesPager returns a new BackupPoliciesPager instance. -func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pager *BackupPoliciesPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListBackupPoliciesOptions = *options - pager = &BackupPoliciesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *BackupPoliciesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListBackupPoliciesWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.BackupPolicies - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyIntf, err error) { - for pager.HasNext() { - var nextPage []BackupPolicyIntf - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BackupPoliciesPager) GetNext() (page []BackupPolicyIntf, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *BackupPoliciesPager) GetAll() (allItems []BackupPolicyIntf, err error) { - return pager.GetAllWithContext(context.Background()) -} - -// BackupPolicyJobsPager can be used to simplify the use of the "ListBackupPolicyJobs" method. -type BackupPolicyJobsPager struct { - hasNext bool - options *ListBackupPolicyJobsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewBackupPolicyJobsPager returns a new BackupPolicyJobsPager instance. -func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) (pager *BackupPolicyJobsPager, err error) { - if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") - return - } - - var optionsCopy ListBackupPolicyJobsOptions = *options - pager = &BackupPolicyJobsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *BackupPolicyJobsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyJob, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListBackupPolicyJobsWithContext(ctx, pager.options) - if err != nil { - return - } - - var next *string - if result.Next != nil { - var start *string - start, err = core.GetQueryParam(result.Next.Href, "start") - if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) - return - } - next = start - } - pager.pageContext.next = next - pager.hasNext = (pager.pageContext.next != nil) - page = result.Jobs - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyJob, err error) { - for pager.HasNext() { - var nextPage []BackupPolicyJob - nextPage, err = pager.GetNextWithContext(ctx) - if err != nil { - return - } - allItems = append(allItems, nextPage...) - } - return -} - -// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BackupPolicyJobsPager) GetNext() (page []BackupPolicyJob, err error) { - return pager.GetNextWithContext(context.Background()) -} - -// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. -func (pager *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err error) { - return pager.GetAllWithContext(context.Background()) -} - // PlacementGroupsPager can be used to simplify the use of the "ListPlacementGroups" method. type PlacementGroupsPager struct { hasNext bool @@ -118712,6 +119348,176 @@ func (pager *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err return pager.GetAllWithContext(context.Background()) } +// BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. +type BackupPoliciesPager struct { + hasNext bool + options *ListBackupPoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBackupPoliciesPager returns a new BackupPoliciesPager instance. +func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pager *BackupPoliciesPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBackupPoliciesOptions = *options + pager = &BackupPoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BackupPoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBackupPoliciesWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.BackupPolicies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyIntf, err error) { + for pager.HasNext() { + var nextPage []BackupPolicyIntf + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BackupPoliciesPager) GetNext() (page []BackupPolicyIntf, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BackupPoliciesPager) GetAll() (allItems []BackupPolicyIntf, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// BackupPolicyJobsPager can be used to simplify the use of the "ListBackupPolicyJobs" method. +type BackupPolicyJobsPager struct { + hasNext bool + options *ListBackupPolicyJobsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBackupPolicyJobsPager returns a new BackupPolicyJobsPager instance. +func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) (pager *BackupPolicyJobsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } + + var optionsCopy ListBackupPolicyJobsOptions = *options + pager = &BackupPolicyJobsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BackupPolicyJobsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyJob, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBackupPolicyJobsWithContext(ctx, pager.options) + if err != nil { + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Jobs + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyJob, err error) { + for pager.HasNext() { + var nextPage []BackupPolicyJob + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *BackupPolicyJobsPager) GetNext() (page []BackupPolicyJob, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err error) { + return pager.GetAllWithContext(context.Background()) +} + // VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. type VirtualNetworkInterfacesPager struct { hasNext bool diff --git a/go.sum b/go.sum index 023d34bb27..d9240b0d18 100644 --- a/go.sum +++ b/go.sum @@ -116,8 +116,6 @@ github.com/IBM/appconfiguration-go-admin-sdk v0.3.0 h1:OqFxnDxro0JiRwHBKytCcseY2 github.com/IBM/appconfiguration-go-admin-sdk v0.3.0/go.mod h1:xPxAYhr/uywUIDEo/JqWbkUdTryPdzRdYBfUpA5IjoE= github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f h1:4c1kqY4GqmkQ+tO03rneDb74Tv7BhTj8jDiDB1p8mdM= github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f/go.mod h1:d22kTYY7RYBWcQlZpqrSdshpB/lJ16viWS5Sbjtlc8s= -github.com/IBM/cloud-databases-go-sdk v0.5.0 h1:Bie6MnT1jLchQmtKVA20HHETTPdlOR+i11P2kJ55viM= -github.com/IBM/cloud-databases-go-sdk v0.5.0/go.mod h1:nCIVfeZnhBYIiwByT959dFP4VWUeNLxomDYy63tTC6M= github.com/IBM/cloud-databases-go-sdk v0.6.0 h1:QK3eif7+kusgeuMB54Zw5nco/kDwsDg2sD/84/foDxo= github.com/IBM/cloud-databases-go-sdk v0.6.0/go.mod h1:nCIVfeZnhBYIiwByT959dFP4VWUeNLxomDYy63tTC6M= github.com/IBM/cloudant-go-sdk v0.0.43 h1:YxTy4RpAEezX32YIWnds76hrBREmO4u6IkBz1WylNuQ= @@ -143,6 +141,7 @@ github.com/IBM/go-sdk-core/v5 v5.7.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= +github.com/IBM/go-sdk-core/v5 v5.14.1/go.mod h1:MUvIr/1mgGh198ZXL+ByKz9Qs1JoEh80v/96x8jPXNY= github.com/IBM/go-sdk-core/v5 v5.16.1 h1:vAgOxRvaXD5AmgwR7dlstjT1JFE4BA4lPcGsEFZOKGs= github.com/IBM/go-sdk-core/v5 v5.16.1/go.mod h1:aojBkkq4HXkOYdn7YZ6ve8cjPWHdcB3tt8v0b9Cbac8= github.com/IBM/ibm-cos-sdk-go v1.10.1 h1:vQCsu61OHRVF2lL6ah+m3AmUlhnYGkI1qogukCEFULs= @@ -176,8 +175,6 @@ github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4 h1:xa9e+POVqaXxXHXkSMCOVAbKdUNEu github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4/go.mod h1:5gq8D8uWOIbqOm1uztay6lpOysgJaxxEsaVZLWGWb40= github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQyz4uc= github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA= -github.com/IBM/vpc-go-sdk v0.49.1 h1:VIkZ8iJMBHqBulUXcPtN0ifxsa0xwlBtaLslU2V9HsY= -github.com/IBM/vpc-go-sdk v0.49.1/go.mod h1:iBg9UJY1y/XpkweyP6YH7G6guzKPV8BYDoBMTdPupH4= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= @@ -442,6 +439,7 @@ github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3 github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= 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/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= @@ -553,6 +551,7 @@ github.com/go-openapi/strfmt v0.20.2/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicA github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= github.com/go-openapi/strfmt v0.21.2/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg= +github.com/go-openapi/strfmt v0.21.5/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg= github.com/go-openapi/strfmt v0.21.7/go.mod h1:adeGTkxE44sPyLk0JV235VQAO/ZXUr8KAzYjclFs3ew= github.com/go-openapi/strfmt v0.22.1 h1:5Ky8cybT4576C6Ffc+8gYji/wRXCo6Ozm8RaWjPI6jc= github.com/go-openapi/strfmt v0.22.1/go.mod h1:OfVoytIXJasDkkGvkb1Cceb3BPyMOwk1FgmyyEw7NYg= @@ -572,6 +571,7 @@ github.com/go-ozzo/ozzo-validation v3.6.0+incompatible h1:msy24VGS42fKO9K1vLz82/ github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es= github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew= 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.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= @@ -582,6 +582,7 @@ github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+ github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.13.0/go.mod h1:dwu7+CG8/CtBiJFZDz4e+5Upb6OLw04gtBYw0mcG/z4= github.com/go-playground/validator/v10 v10.18.0 h1:BvolUXjp4zuvkZ5YN5t7ebzbhlUtPsPm2S9NAZ5nl9U= github.com/go-playground/validator/v10 v10.18.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= @@ -842,6 +843,7 @@ github.com/hashicorp/go-retryablehttp v0.6.2/go.mod h1:gEx6HMUGxYYhJScX7W1Il64m6 github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-retryablehttp v0.7.2/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= @@ -1092,6 +1094,7 @@ github.com/kubernetes-csi/external-snapshotter/client/v4 v4.0.0/go.mod h1:YBCo4D github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/leodido/go-urn v1.2.3/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= 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/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -1267,6 +1270,7 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl github.com/onsi/gomega v1.18.0/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= @@ -1489,6 +1493,7 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= @@ -1890,6 +1895,7 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1931,6 +1937,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= diff --git a/ibm/service/vpc/resource_ibm_is_lb_listener.go b/ibm/service/vpc/resource_ibm_is_lb_listener.go index 84ee4ee34e..667c382d6c 100644 --- a/ibm/service/vpc/resource_ibm_is_lb_listener.go +++ b/ibm/service/vpc/resource_ibm_is_lb_listener.go @@ -619,7 +619,7 @@ func lbListenerUpdate(d *schema.ResourceData, meta interface{}, lbID, lbListener diag.FromErr(err) } defPool = lbpool - loadBalancerListenerPatchModel.DefaultPool = &vpcv1.LoadBalancerPoolIdentity{ + loadBalancerListenerPatchModel.DefaultPool = &vpcv1.LoadBalancerListenerDefaultPoolPatch{ ID: &defPool, } hasChanged = true diff --git a/ibm/service/vpc/resource_ibm_is_lb_listener_policy.go b/ibm/service/vpc/resource_ibm_is_lb_listener_policy.go index 03ee1638ad..5c5ba0da2f 100644 --- a/ibm/service/vpc/resource_ibm_is_lb_listener_policy.go +++ b/ibm/service/vpc/resource_ibm_is_lb_listener_policy.go @@ -500,7 +500,7 @@ func lbListenerPolicyCreate(d *schema.ResourceData, meta interface{}, lbID, list target = &urlPrototype } else if actionChk.(string) == "https_redirect" { - urlPrototype := vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype{} + urlPrototype := vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype{} if listenerSet { listener := listener.(string) @@ -838,7 +838,7 @@ func lbListenerPolicyUpdate(d *schema.ResourceData, meta interface{}, lbID, list } } else if d.Get(isLBListenerPolicyAction).(string) == "https_redirect" { - httpsRedirectPatch := vpcv1.LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch{} + httpsRedirectPatch := vpcv1.LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch{} targetChange := false if d.HasChange(isLBListenerPolicyHTTPSRedirectListener) { @@ -1121,8 +1121,8 @@ func lbListenerPolicyGet(d *schema.ResourceData, meta interface{}, lbID, listene } } } else if *(policy.Action) == "https_redirect" { - if reflect.TypeOf(policy.Target).String() == "*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect" { - target, ok := policy.Target.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) + if reflect.TypeOf(policy.Target).String() == "*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect" { + target, ok := policy.Target.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect) if ok { d.Set(isLBListenerPolicyHTTPSRedirectListener, target.Listener.ID) d.Set(isLBListenerPolicyHTTPSRedirectStatusCode, target.HTTPStatusCode) @@ -1180,8 +1180,8 @@ func resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetToMap(model vp return resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetLoadBalancerPoolReferenceToMap(model.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerPoolReference)) } else if _, ok := model.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL); ok { return resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURLToMap(model.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL)) - } else if _, ok := model.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect); ok { - return resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirectToMap(model.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect)) + } else if _, ok := model.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect); ok { + return resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirectToMap(model.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect)) } else if _, ok := model.(*vpcv1.LoadBalancerListenerPolicyTarget); ok { modelMap := make(map[string]interface{}) model := model.(*vpcv1.LoadBalancerListenerPolicyTarget) @@ -1271,7 +1271,7 @@ func resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetLoadBalancerLi return modelMap, nil } -func resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirectToMap(model *vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) (map[string]interface{}, error) { +func resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirectToMap(model *vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["http_status_code"] = flex.IntValue(model.HTTPStatusCode) listenerMap, err := resourceIBMIsLbListenerPolicyLoadBalancerListenerReferenceToMap(model.Listener) From 60e0299ef39e00abd12406ccc96fda40df0b8dcf Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 28 Mar 2024 12:11:23 +0530 Subject: [PATCH 069/103] test --- .../IBM/vpc-go-sdk/common/headers.go | 5 + common/github.com/IBM/vpc-go-sdk/go.mod | 11 +- common/github.com/IBM/vpc-go-sdk/go.sum | 253 +- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 13739 +++++++++++++++- go.sum | 7 +- 5 files changed, 13203 insertions(+), 812 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers.go b/common/github.com/IBM/vpc-go-sdk/common/headers.go index 62651e40c7..ec4e7f8c0e 100644 --- a/common/github.com/IBM/vpc-go-sdk/common/headers.go +++ b/common/github.com/IBM/vpc-go-sdk/common/headers.go @@ -4,6 +4,7 @@ import ( "fmt" "runtime" + "github.com/IBM/go-sdk-core/v5/core" "github.com/google/uuid" ) @@ -59,3 +60,7 @@ var systemInfo = fmt.Sprintf("(arch=%s; os=%s; go.version=%s)", runtime.GOARCH, func GetSystemInfo() string { return systemInfo } + +func GetComponentInfo() *core.ProblemComponent { + return core.NewProblemComponent("github.com/IBM/vpc-go-sdk", Version) +} diff --git a/common/github.com/IBM/vpc-go-sdk/go.mod b/common/github.com/IBM/vpc-go-sdk/go.mod index d1b5fdfdca..9f184baefc 100644 --- a/common/github.com/IBM/vpc-go-sdk/go.mod +++ b/common/github.com/IBM/vpc-go-sdk/go.mod @@ -3,15 +3,14 @@ module github.com/IBM/vpc-go-sdk go 1.16 require ( - github.com/IBM/go-sdk-core/v5 v5.14.1 - github.com/go-openapi/strfmt v0.21.3 - github.com/onsi/ginkgo v1.16.5 - github.com/onsi/gomega v1.20.0 - github.com/stretchr/testify v1.8.0 + github.com/IBM/go-sdk-core/v5 v5.16.0 + github.com/go-openapi/strfmt v0.22.1 + github.com/google/uuid v1.6.0 + github.com/stretchr/testify v1.8.4 ) retract ( v1.0.2 v1.0.1 v1.0.0 -) \ No newline at end of file +) diff --git a/common/github.com/IBM/vpc-go-sdk/go.sum b/common/github.com/IBM/vpc-go-sdk/go.sum index 13e2cacdc6..672e521233 100644 --- a/common/github.com/IBM/vpc-go-sdk/go.sum +++ b/common/github.com/IBM/vpc-go-sdk/go.sum @@ -1,143 +1,270 @@ -github.com/IBM/go-sdk-core/v5 v5.14.1 h1:WR1r0zz+gDW++xzZjF41r9ueY4JyjS2vgZjiYs8lO3c= -github.com/IBM/go-sdk-core/v5 v5.14.1/go.mod h1:MUvIr/1mgGh198ZXL+ByKz9Qs1JoEh80v/96x8jPXNY= -github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= -github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/IBM/go-sdk-core/v5 v5.16.0 h1:nbzHNBVi/kTAR+f7q0nJ8zyHs+jpRpPSNpX5EVAZOuU= +github.com/IBM/go-sdk-core/v5 v5.16.0/go.mod h1:tE4F9jLVspuWeXWwGHtAOfV6uRI8phe6x4DTsLrf2nc= +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/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 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/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/go-openapi/errors v0.19.8 h1:doM+tQdZbUm9gydV9yR+iQNmztbjj7I3sW4sIcAwIzc= -github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/strfmt v0.21.1 h1:G6s2t5V5kGCHLVbSdZ/6lI8Wm4OzoPFkc3/cjAsKQrM= -github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +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= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.18.0 h1:BvolUXjp4zuvkZ5YN5t7ebzbhlUtPsPm2S9NAZ5nl9U= +github.com/go-playground/validator/v10 v10.18.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/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o= +github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= 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= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= 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.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +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 v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4= -github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= +github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 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.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= -github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +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/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/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 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= 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= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M= -github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +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.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= +github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= +github.com/onsi/ginkgo/v2 v2.3.0/go.mod h1:Eew0uilEqZmIEZr8JrvYlvOM7Rr6xzTmMV8AyFNU9d0= +github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo= +github.com/onsi/ginkgo/v2 v2.5.0/go.mod h1:Luc4sArBICYCS8THh8v3i3i5CuSZO+RaQRaJoeNwomw= +github.com/onsi/ginkgo/v2 v2.7.0/go.mod h1:yjiuMwPokqY1XauOgju45q3sJt6VzQ/Fict1LFVcsAo= +github.com/onsi/ginkgo/v2 v2.8.1/go.mod h1:N1/NbDngAFcSLdyZ+/aYTYGSlq9qMCS/cNKGJjy+csc= +github.com/onsi/ginkgo/v2 v2.9.0/go.mod h1:4xkjoL/tZv4SMWeww56BU5kAt19mVB47gTWxmrTcxyk= +github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo= +github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= 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.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ= -github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= +github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= +github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= +github.com/onsi/gomega v1.24.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= +github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM= +github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= +github.com/onsi/gomega v1.27.1/go.mod h1:aHX5xOykVYzWOV4WqQy0sy8BQptgukenXpCXfadcIAw= +github.com/onsi/gomega v1.27.3/go.mod h1:5vG284IBtfDAmDyrK+eGyZmUgUlmi+Wngqo557cZ6Gw= +github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= +github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= +github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= -github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= -github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= -go.mongodb.org/mongo-driver v1.7.5 h1:ny3p0reEpgsR2cfA5cjgwFZg3Cv/ofFh/8jbhGtz9VI= -go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= +go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= +golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= +golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +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.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= +golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +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= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +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-20180628173108-788fd7840127/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/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v9 v9.31.0 h1:bmXmP2RSNtFES+bn4uYuHT7iJFJv7Vj+an+ZQdDaD1M= -gopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= 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= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo= -gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 1f60e8f5ed..ef19d404f5 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2022, 2023, 2024. + * (C) Copyright IBM Corp. 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.85.0-75c38f8f-20240206-210220 + * IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-23b7063d-20240313-161311 */ // 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-03-26 +// API Version: today 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 `2023-12-05` - // and `2024-03-26`. + // and `2024-03-20`. Version *string } @@ -64,7 +64,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2024-03-26`. + // and `2024-03-20`. Version *string } @@ -77,22 +77,26 @@ func NewVpcV1UsingExternalConfig(options *VpcV1Options) (vpc *VpcV1, err error) if options.Authenticator == nil { options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) if err != nil { + err = core.SDKErrorf(err, "", "env-auth-error", common.GetComponentInfo()) return } } vpc, err = NewVpcV1(options) + err = core.RepurposeSDKProblem(err, "new-client-error") if err != nil { return } err = vpc.Service.ConfigureService(options.ServiceName) if err != nil { + err = core.SDKErrorf(err, "", "client-config-error", common.GetComponentInfo()) return } if options.URL != "" { err = vpc.Service.SetServiceURL(options.URL) + err = core.RepurposeSDKProblem(err, "url-set-error") } return } @@ -106,17 +110,20 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { err = core.ValidateStruct(options, "options") if err != nil { + err = core.SDKErrorf(err, "", "invalid-global-options", common.GetComponentInfo()) return } baseService, err := core.NewBaseService(serviceOptions) if err != nil { + err = core.SDKErrorf(err, "", "new-base-error", common.GetComponentInfo()) return } if options.URL != "" { err = baseService.SetServiceURL(options.URL) if err != nil { + err = core.SDKErrorf(err, "", "set-url-error", common.GetComponentInfo()) return } } @@ -136,7 +143,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { // GetServiceURLForRegion returns the service URL to be used for the specified region func GetServiceURLForRegion(region string) (string, error) { - return "", fmt.Errorf("service does not support regional URLs") + return "", core.SDKErrorf(nil, "service does not support regional URLs", "no-regional-support", common.GetComponentInfo()) } // Clone makes a copy of "vpc" suitable for processing requests. @@ -151,7 +158,11 @@ func (vpc *VpcV1) Clone() *VpcV1 { // SetServiceURL sets the service URL func (vpc *VpcV1) SetServiceURL(url string) error { - return vpc.Service.SetServiceURL(url) + err := vpc.Service.SetServiceURL(url) + if err != nil { + err = core.SDKErrorf(err, "", "url-set-error", common.GetComponentInfo()) + } + return err } // GetServiceURL returns the service URL @@ -190,13 +201,16 @@ func (vpc *VpcV1) DisableRetries() { // isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC // can contain resources in multiple zones in a region. func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { - return vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) + result, response, err = vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVpcsWithContext is an alternate form of the ListVpcs method which supports a Context parameter func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listVpcsOptions, "listVpcsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -205,6 +219,7 @@ func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *List builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -235,17 +250,21 @@ func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *List 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_vpcs", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPCCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -258,13 +277,16 @@ func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *List // This request creates a new VPC from a VPC prototype object. The prototype object is structured in the same way as a // retrieved VPC, and contains the information necessary to create the new VPC. func (vpc *VpcV1) CreateVPC(createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - return vpc.CreateVPCWithContext(context.Background(), createVPCOptions) + result, response, err = vpc.CreateVPCWithContext(context.Background(), createVPCOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVPCWithContext is an alternate form of the CreateVPC method which supports a Context parameter func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { err = core.ValidateStruct(createVPCOptions, "createVPCOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -273,6 +295,7 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -308,22 +331,27 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr } _, 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_vpc", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -343,17 +371,21 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr // All security groups and network ACLs associated with the VPC are automatically deleted. All flow log collectors with // `auto_delete` set to `true` targeting the VPC or any resource in the VPC are automatically deleted. func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) + response, err = vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVPCWithContext is an alternate form of the DeleteVPC method which supports a Context parameter func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVPCOptions, "deleteVPCOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -366,6 +398,7 @@ func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *De builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -386,10 +419,16 @@ func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *De 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_vpc", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -397,17 +436,21 @@ func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *De // GetVPC : Retrieve a VPC // This request retrieves a single VPC specified by the identifier in the URL. func (vpc *VpcV1) GetVPC(getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - return vpc.GetVPCWithContext(context.Background(), getVPCOptions) + result, response, err = vpc.GetVPCWithContext(context.Background(), getVPCOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCWithContext is an alternate form of the GetVPC method which supports a Context parameter func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCOptions, "getVPCOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCOptions, "getVPCOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -420,6 +463,7 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -438,17 +482,21 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp 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_vpc", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -461,17 +509,21 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp // This request updates a VPC with the information provided in a VPC patch object. The patch object is structured in the // same way as a retrieved VPC and needs to contain only the information to be updated. func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) + result, response, err = vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVPCWithContext is an alternate form of the UpdateVPC method which supports a Context parameter func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateVPCOptions, "updateVPCOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -484,6 +536,7 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -506,22 +559,27 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) 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_vpc", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -534,17 +592,21 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up // This request retrieves the default network ACL for the VPC specified by the identifier in the URL. The default // network ACL is applied to any new subnets in the VPC which do not specify a network ACL. func (vpc *VpcV1) GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { - return vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) + result, response, err = vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCDefaultNetworkACLWithContext is an alternate form of the GetVPCDefaultNetworkACL method which supports a Context parameter func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -557,6 +619,7 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_network_acl`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -575,17 +638,21 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC 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_vpc_default_network_acl", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultNetworkACL) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -599,17 +666,21 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC // routing table is associated with any subnets in the VPC which have not been explicitly associated with another // routing table. func (vpc *VpcV1) GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { - return vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) + result, response, err = vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCDefaultRoutingTableWithContext is an alternate form of the GetVPCDefaultRoutingTable method which supports a Context parameter func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -622,6 +693,7 @@ func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getV builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_routing_table`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -640,17 +712,21 @@ func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getV 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_vpc_default_routing_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultRoutingTable) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -663,17 +739,21 @@ func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getV // This request retrieves the default security group for the VPC specified by the identifier in the URL. Resources // created in this VPC that allow a security group to be optionally specified will use this security group by default. func (vpc *VpcV1) GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { - return vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) + result, response, err = vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCDefaultSecurityGroupWithContext is an alternate form of the GetVPCDefaultSecurityGroup method which supports a Context parameter func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -686,6 +766,7 @@ func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, get builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_security_group`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -704,17 +785,21 @@ func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, get 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_vpc_default_security_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultSecurityGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -726,17 +811,21 @@ func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, get // ListVPCAddressPrefixes : List all address prefixes for a VPC // This request lists all address pool prefixes for a VPC. func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) + result, response, err = vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVPCAddressPrefixesWithContext is an alternate form of the ListVPCAddressPrefixes method which supports a Context parameter func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -749,6 +838,7 @@ func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPC builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -773,17 +863,21 @@ func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPC 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_vpc_address_prefixes", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefixCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -796,17 +890,21 @@ func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPC // This request creates a new prefix from a prefix prototype object. The prototype object is structured in the same way // as a retrieved prefix, and contains the information necessary to create the new prefix. func (vpc *VpcV1) CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - return vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) + result, response, err = vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVPCAddressPrefixWithContext is an alternate form of the CreateVPCAddressPrefix method which supports a Context parameter func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -819,6 +917,7 @@ func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createV builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -851,22 +950,27 @@ func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createV } _, 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_vpc_address_prefix", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -879,17 +983,21 @@ func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createV // This request deletes a prefix. This operation cannot be reversed. The request will fail if any subnets use addresses // from this prefix. func (vpc *VpcV1) DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) + response, err = vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVPCAddressPrefixWithContext is an alternate form of the DeleteVPCAddressPrefix method which supports a Context parameter func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -903,6 +1011,7 @@ func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteV builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -920,10 +1029,16 @@ func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteV 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_vpc_address_prefix", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -931,17 +1046,21 @@ func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteV // GetVPCAddressPrefix : Retrieve an address prefix // This request retrieves a single prefix specified by the identifier in the URL. func (vpc *VpcV1) GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - return vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) + result, response, err = vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCAddressPrefixWithContext is an alternate form of the GetVPCAddressPrefix method which supports a Context parameter func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -955,6 +1074,7 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -973,17 +1093,21 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr 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_vpc_address_prefix", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -996,17 +1120,21 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr // This request updates a prefix with the information in a provided prefix patch. The prefix patch object is structured // in the same way as a retrieved prefix and contains only the information to be updated. func (vpc *VpcV1) UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) + result, response, err = vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVPCAddressPrefixWithContext is an alternate form of the UpdateVPCAddressPrefix method which supports a Context parameter func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1020,6 +1148,7 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1039,22 +1168,27 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV _, err = builder.SetBodyContentJSON(updateVPCAddressPrefixOptions.AddressPrefixPatch) 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_vpc_address_prefix", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1081,17 +1215,21 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV // The bindings will be sorted by their `created_at` property values, with newest bindings first. Bindings with // identical `created_at` property values will in turn be sorted by ascending `name` property values. func (vpc *VpcV1) ListVPCDnsResolutionBindings(listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) + result, response, err = vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVPCDnsResolutionBindingsWithContext is an alternate form of the ListVPCDnsResolutionBindings method which supports a Context parameter func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1104,6 +1242,7 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1143,17 +1282,21 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l 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_vpc_dns_resolution_bindings", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBindingCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1172,17 +1315,21 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l // // See [About DNS sharing for VPE gateways](/docs/vpc?topic=vpc-hub-spoke-model) for more information. func (vpc *VpcV1) CreateVPCDnsResolutionBinding(createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - return vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) + result, response, err = vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVPCDnsResolutionBindingWithContext is an alternate form of the CreateVPCDnsResolutionBinding method which supports a Context parameter func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1195,6 +1342,7 @@ func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1221,22 +1369,27 @@ func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, } _, 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_vpc_dns_resolution_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1251,17 +1404,21 @@ func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, // For this request to succeed, the VPC specified by the identifier in the URL must not have // `dns.resolver.type` set to `delegated`. func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - return vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) + result, response, err = vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVPCDnsResolutionBindingWithContext is an alternate form of the DeleteVPCDnsResolutionBinding method which supports a Context parameter func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1275,6 +1432,7 @@ func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1293,17 +1451,21 @@ func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, 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_vpc_dns_resolution_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1315,17 +1477,21 @@ func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, // GetVPCDnsResolutionBinding : Retrieve a DNS resolution binding // This request retrieves a single DNS resolution binding specified by the identifier in the URL. func (vpc *VpcV1) GetVPCDnsResolutionBinding(getVPCDnsResolutionBindingOptions *GetVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - return vpc.GetVPCDnsResolutionBindingWithContext(context.Background(), getVPCDnsResolutionBindingOptions) + result, response, err = vpc.GetVPCDnsResolutionBindingWithContext(context.Background(), getVPCDnsResolutionBindingOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCDnsResolutionBindingWithContext is an alternate form of the GetVPCDnsResolutionBinding method which supports a Context parameter func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, getVPCDnsResolutionBindingOptions *GetVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1339,6 +1505,7 @@ func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, get builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1357,17 +1524,21 @@ func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, get 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_vpc_dns_resolution_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1381,17 +1552,21 @@ func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, get // DNS resolution binding patch object is structured in the same way as a retrieved DNS resolution binding and contains // only the information to be updated. func (vpc *VpcV1) UpdateVPCDnsResolutionBinding(updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) + result, response, err = vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVPCDnsResolutionBindingWithContext is an alternate form of the UpdateVPCDnsResolutionBinding method which supports a Context parameter func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1405,6 +1580,7 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1424,22 +1600,27 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, _, err = builder.SetBodyContentJSON(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) 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_vpc_dns_resolution_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1454,7 +1635,9 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, // destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { - return vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) + result, response, err = vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter @@ -1463,10 +1646,12 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt core.GetLogger().Warn("A deprecated operation has been invoked: ListVPCRoutes") err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1479,6 +1664,7 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1506,17 +1692,21 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt 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_vpc_routes", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollectionVPCContext) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1531,7 +1721,9 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt // if the new route will cause a loop. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) + result, response, err = vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter @@ -1540,10 +1732,12 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO core.GetLogger().Warn("A deprecated operation has been invoked: CreateVPCRoute") err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1556,6 +1750,7 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1597,22 +1792,27 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO } _, 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_vpc_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1625,7 +1825,9 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO // This request deletes a route. This operation cannot be reversed. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) + response, err = vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter @@ -1634,10 +1836,12 @@ func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteO core.GetLogger().Warn("A deprecated operation has been invoked: DeleteVPCRoute") err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1651,6 +1855,7 @@ func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1668,10 +1873,16 @@ func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteO 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_vpc_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -1680,7 +1891,9 @@ func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteO // This request retrieves a single route specified by the identifier in the URL. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) + result, response, err = vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter @@ -1689,10 +1902,12 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions core.GetLogger().Warn("A deprecated operation has been invoked: GetVPCRoute") err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1706,6 +1921,7 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1724,17 +1940,21 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions 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_vpc_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1748,7 +1968,9 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions // the same way as a retrieved route and contains only the information to be updated. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) + result, response, err = vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter @@ -1757,10 +1979,12 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO core.GetLogger().Warn("A deprecated operation has been invoked: UpdateVPCRoute") err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1774,6 +1998,7 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1793,22 +2018,27 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO _, err = builder.SetBodyContentJSON(updateVPCRouteOptions.RoutePatch) 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_vpc_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1823,17 +2053,21 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO // table. If multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, // delivery will be controlled by the system's built-in routes. func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) + result, response, err = vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVPCRoutingTablesWithContext is an alternate form of the ListVPCRoutingTables method which supports a Context parameter func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1846,6 +2080,7 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1873,17 +2108,21 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo 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_vpc_routing_tables", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTableCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1896,17 +2135,21 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo // This request creates a routing table from a routing table prototype object. The prototype object is structured in the // same way as a retrieved routing table, and contains the information necessary to create the new routing table. func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) + result, response, err = vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVPCRoutingTableWithContext is an alternate form of the CreateVPCRoutingTable method which supports a Context parameter func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createVPCRoutingTableOptions, "createVPCRoutingTableOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1919,6 +2162,7 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1963,22 +2207,27 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP } _, 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_vpc_routing_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1991,17 +2240,21 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP // This request deletes a routing table. A routing table cannot be deleted if it is associated with any subnets in the // VPC. Additionally, a VPC's default routing table cannot be deleted. This operation cannot be reversed. func (vpc *VpcV1) DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) + response, err = vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVPCRoutingTableWithContext is an alternate form of the DeleteVPCRoutingTable method which supports a Context parameter func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2015,6 +2268,7 @@ func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2035,10 +2289,16 @@ func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVP 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_vpc_routing_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -2046,17 +2306,21 @@ func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVP // GetVPCRoutingTable : Retrieve a VPC routing table // This request retrieves a single routing table specified by the identifier in the URL. func (vpc *VpcV1) GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) + result, response, err = vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCRoutingTableWithContext is an alternate form of the GetVPCRoutingTable method which supports a Context parameter func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCRoutingTableOptions, "getVPCRoutingTableOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2070,6 +2334,7 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2088,17 +2353,21 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti 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_vpc_routing_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2111,17 +2380,21 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti // This request updates a routing table with the information in a provided routing table patch. The patch object is // structured in the same way as a retrieved table and contains only the information to be updated. func (vpc *VpcV1) UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) + result, response, err = vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVPCRoutingTableWithContext is an alternate form of the UpdateVPCRoutingTable method which supports a Context parameter func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2135,6 +2408,7 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2157,22 +2431,27 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) 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_vpc_routing_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2188,17 +2467,21 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP // highest priority will be used. If two matching routes have the same destination and priority, traffic will be // distributed between them. If no routes match, delivery will be controlled by the system's built-in routes. func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) + result, response, err = vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVPCRoutingTableRoutesWithContext is an alternate form of the ListVPCRoutingTableRoutes method which supports a Context parameter func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2212,6 +2495,7 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2236,17 +2520,21 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list 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_vpc_routing_table_routes", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2259,17 +2547,21 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list // This request creates a new VPC route from a VPC route prototype object. The prototype object is structured in the // same way as a retrieved VPC route and contains the information necessary to create the route. func (vpc *VpcV1) CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) + result, response, err = vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVPCRoutingTableRouteWithContext is an alternate form of the CreateVPCRoutingTableRoute method which supports a Context parameter func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2283,6 +2575,7 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2324,22 +2617,27 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre } _, 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_vpc_routing_table_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2352,17 +2650,21 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre // This request deletes a VPC route. This operation cannot be reversed. Only VPC routes with an `origin` of `user` are // allowed to be deleted. func (vpc *VpcV1) DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) + response, err = vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVPCRoutingTableRouteWithContext is an alternate form of the DeleteVPCRoutingTableRoute method which supports a Context parameter func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2377,6 +2679,7 @@ func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, del builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2394,10 +2697,16 @@ func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, del 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_vpc_routing_table_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -2405,17 +2714,21 @@ func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, del // GetVPCRoutingTableRoute : Retrieve a VPC routing table route // This request retrieves a single VPC route specified by the identifier in the URL path. func (vpc *VpcV1) GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) + result, response, err = vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCRoutingTableRouteWithContext is an alternate form of the GetVPCRoutingTableRoute method which supports a Context parameter func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2430,6 +2743,7 @@ func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPC builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2448,17 +2762,21 @@ func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPC 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_vpc_routing_table_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2472,17 +2790,21 @@ func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPC // structured in the same way as a retrieved VPC route and needs to contain only the information to be updated. Only VPC // routes with an `origin` of `user` are allowed to be updated. func (vpc *VpcV1) UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCRoutingTableRouteWithContext(context.Background(), updateVPCRoutingTableRouteOptions) + result, response, err = vpc.UpdateVPCRoutingTableRouteWithContext(context.Background(), updateVPCRoutingTableRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVPCRoutingTableRouteWithContext is an alternate form of the UpdateVPCRoutingTableRoute method which supports a Context parameter func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2497,6 +2819,7 @@ func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, upd builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2516,22 +2839,27 @@ func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, upd _, err = builder.SetBodyContentJSON(updateVPCRoutingTableRouteOptions.RoutePatch) 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_vpc_routing_table_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2544,13 +2872,16 @@ func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, upd // This request lists all subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block // notation. Each subnet is within a particular zone and cannot span multiple zones or regions. func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { - return vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) + result, response, err = vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListSubnetsWithContext is an alternate form of the ListSubnets method which supports a Context parameter func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listSubnetsOptions, "listSubnetsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2559,6 +2890,7 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2604,17 +2936,21 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions 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_subnets", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnetCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2628,17 +2964,21 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions // as a retrieved subnet, and contains the information necessary to create the new subnet. For this request to succeed, // the prototype's CIDR block must not overlap with an existing subnet in the VPC. func (vpc *VpcV1) CreateSubnet(createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - return vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) + result, response, err = vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateSubnetWithContext is an alternate form of the CreateSubnet method which supports a Context parameter func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createSubnetOptions, "createSubnetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2647,6 +2987,7 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2666,22 +3007,27 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio _, err = builder.SetBodyContentJSON(createSubnetOptions.SubnetPrototype) 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_subnet", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2697,17 +3043,21 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio // gateways, or endpoint gateways. All flow log collectors with `auto_delete` set to `true` targeting the subnet or any // resource in the subnet are automatically deleted. func (vpc *VpcV1) DeleteSubnet(deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSubnetWithContext(context.Background(), deleteSubnetOptions) + response, err = vpc.DeleteSubnetWithContext(context.Background(), deleteSubnetOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteSubnetWithContext is an alternate form of the DeleteSubnet method which supports a Context parameter func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteSubnetOptions, "deleteSubnetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteSubnetOptions, "deleteSubnetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2720,6 +3070,7 @@ func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptio builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2737,10 +3088,16 @@ func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptio 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_subnet", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -2748,17 +3105,21 @@ func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptio // GetSubnet : Retrieve a subnet // This request retrieves a single subnet specified by the identifier in the URL. func (vpc *VpcV1) GetSubnet(getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - return vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) + result, response, err = vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetSubnetWithContext is an alternate form of the GetSubnet method which supports a Context parameter func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getSubnetOptions, "getSubnetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2771,6 +3132,7 @@ func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *Ge builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2789,17 +3151,21 @@ func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *Ge 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_subnet", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2812,17 +3178,21 @@ func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *Ge // This request updates a subnet with the information in a provided subnet patch. The subnet patch object is structured // in the same way as a retrieved subnet and contains only the information to be updated. func (vpc *VpcV1) UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - return vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) + result, response, err = vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateSubnetWithContext is an alternate form of the UpdateSubnet method which supports a Context parameter func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateSubnetOptions, "updateSubnetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2835,6 +3205,7 @@ func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptio builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2854,22 +3225,27 @@ func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptio _, err = builder.SetBodyContentJSON(updateSubnetOptions.SubnetPatch) 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_subnet", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2881,17 +3257,21 @@ func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptio // GetSubnetNetworkACL : Retrieve a subnet's attached network ACL // This request retrieves the network ACL attached to the subnet specified by the identifier in the URL. func (vpc *VpcV1) GetSubnetNetworkACL(getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - return vpc.GetSubnetNetworkACLWithContext(context.Background(), getSubnetNetworkACLOptions) + result, response, err = vpc.GetSubnetNetworkACLWithContext(context.Background(), getSubnetNetworkACLOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetSubnetNetworkACLWithContext is an alternate form of the GetSubnetNetworkACL method which supports a Context parameter func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2904,6 +3284,7 @@ func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetN builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2922,17 +3303,21 @@ func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetN 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_subnet_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 @@ -2944,17 +3329,21 @@ func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetN // ReplaceSubnetNetworkACL : Replace the network ACL for a subnet // This request replaces the existing network ACL for a subnet with the network ACL specified in the request body. func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - return vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) + result, response, err = vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ReplaceSubnetNetworkACLWithContext is an alternate form of the ReplaceSubnetNetworkACL method which supports a Context parameter func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2967,6 +3356,7 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2986,22 +3376,27 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac _, err = builder.SetBodyContentJSON(replaceSubnetNetworkACLOptions.NetworkACLIdentity) 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, "replace_subnet_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 @@ -3013,17 +3408,21 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac // UnsetSubnetPublicGateway : Detach a public gateway from a subnet // This request detaches the public gateway from the subnet specified by the subnet identifier in the URL. func (vpc *VpcV1) UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { - return vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) + response, err = vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UnsetSubnetPublicGatewayWithContext is an alternate form of the UnsetSubnetPublicGateway method which supports a Context parameter func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3036,6 +3435,7 @@ func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unset builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3053,10 +3453,16 @@ func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unset 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, "unset_subnet_public_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -3064,17 +3470,21 @@ func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unset // GetSubnetPublicGateway : Retrieve a subnet's attached public gateway // This request retrieves the public gateway attached to the subnet specified by the identifier in the URL. func (vpc *VpcV1) GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - return vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) + result, response, err = vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetSubnetPublicGatewayWithContext is an alternate form of the GetSubnetPublicGateway method which supports a Context parameter func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3087,6 +3497,7 @@ func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubn builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3105,17 +3516,21 @@ func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubn 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_subnet_public_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3128,17 +3543,21 @@ func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubn // This request attaches the public gateway, specified in the request body, to the subnet specified by the subnet // identifier in the URL. The public gateway must have the same VPC and zone as the subnet. func (vpc *VpcV1) SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - return vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) + result, response, err = vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) + err = core.RepurposeSDKProblem(err, "") + return } // SetSubnetPublicGatewayWithContext is an alternate form of the SetSubnetPublicGateway method which supports a Context parameter func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3151,6 +3570,7 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3170,22 +3590,27 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn _, err = builder.SetBodyContentJSON(setSubnetPublicGatewayOptions.PublicGatewayIdentity) 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, "set_subnet_public_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3197,17 +3622,21 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn // GetSubnetRoutingTable : Retrieve a subnet's attached routing table // This request retrieves the routing table attached to the subnet specified by the identifier in the URL. func (vpc *VpcV1) GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) + result, response, err = vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetSubnetRoutingTableWithContext is an alternate form of the GetSubnetRoutingTable method which supports a Context parameter func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3220,6 +3649,7 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3238,17 +3668,21 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne 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_subnet_routing_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3263,17 +3697,21 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne // For this request to succeed, the routing table `route_direct_link_ingress`, // `route_internet_ingress`, `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) + result, response, err = vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ReplaceSubnetRoutingTableWithContext is an alternate form of the ReplaceSubnetRoutingTable method which supports a Context parameter func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3286,6 +3724,7 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3305,22 +3744,27 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl _, err = builder.SetBodyContentJSON(replaceSubnetRoutingTableOptions.RoutingTableIdentity) 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, "replace_subnet_routing_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3333,17 +3777,21 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl // This request lists all reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet // which is not available for use. func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { - return vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) + result, response, err = vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListSubnetReservedIpsWithContext is an alternate form of the ListSubnetReservedIps method which supports a Context parameter func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3356,6 +3804,7 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3395,17 +3844,21 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn 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_subnet_reserved_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3418,17 +3871,21 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn // This request reserves an IP address in a subnet. If the provided prototype object includes an `address`, the address // must not already be reserved. func (vpc *VpcV1) CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) + result, response, err = vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateSubnetReservedIPWithContext is an alternate form of the CreateSubnetReservedIP method which supports a Context parameter func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createSubnetReservedIPOptions, "createSubnetReservedIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3441,6 +3898,7 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3473,22 +3931,27 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS } _, 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_subnet_reserved_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3504,17 +3967,21 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS // network interface, instance network interface or virtual network interface for which it is the primary IP. A // provider-owned reserved IP is not allowed to be deleted. func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) + response, err = vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteSubnetReservedIPWithContext is an alternate form of the DeleteSubnetReservedIP method which supports a Context parameter func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3528,6 +3995,7 @@ func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteS builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3545,10 +4013,16 @@ func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteS 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_subnet_reserved_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -3556,17 +4030,21 @@ func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteS // GetSubnetReservedIP : Retrieve a reserved IP // This request retrieves a single reserved IP specified by the identifier in the URL. func (vpc *VpcV1) GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) + result, response, err = vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetSubnetReservedIPWithContext is an alternate form of the GetSubnetReservedIP method which supports a Context parameter func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getSubnetReservedIPOptions, "getSubnetReservedIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3580,6 +4058,7 @@ func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetR builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3598,17 +4077,21 @@ func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetR 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_subnet_reserved_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3623,17 +4106,21 @@ func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetR // // A provider-owned reserved IP is not allowed to be updated. func (vpc *VpcV1) UpdateSubnetReservedIP(updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.UpdateSubnetReservedIPWithContext(context.Background(), updateSubnetReservedIPOptions) + result, response, err = vpc.UpdateSubnetReservedIPWithContext(context.Background(), updateSubnetReservedIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateSubnetReservedIPWithContext is an alternate form of the UpdateSubnetReservedIP method which supports a Context parameter func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3647,6 +4134,7 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3666,22 +4154,27 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS _, err = builder.SetBodyContentJSON(updateSubnetReservedIPOptions.ReservedIPPatch) 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_subnet_reserved_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3694,13 +4187,16 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS // This request lists all images available in the region. An image provides source data for a volume. Images are either // system-provided, or created from another source, such as importing from Cloud Object Storage. func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { - return vpc.ListImagesWithContext(context.Background(), listImagesOptions) + result, response, err = vpc.ListImagesWithContext(context.Background(), listImagesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListImagesWithContext is an alternate form of the ListImages method which supports a Context parameter func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listImagesOptions, "listImagesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3709,6 +4205,7 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3745,17 +4242,21 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * 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_images", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3770,17 +4271,21 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * // a URL to the image file on object storage must be specified. If an image is being created from an existing volume, // that volume must be specified. func (vpc *VpcV1) CreateImage(createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - return vpc.CreateImageWithContext(context.Background(), createImageOptions) + result, response, err = vpc.CreateImageWithContext(context.Background(), createImageOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateImageWithContext is an alternate form of the CreateImage method which supports a Context parameter func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createImageOptions, "createImageOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createImageOptions, "createImageOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3789,6 +4294,7 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3808,22 +4314,27 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions _, err = builder.SetBodyContentJSON(createImageOptions.ImagePrototype) 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_image", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3839,17 +4350,21 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions // - has a `status` of `pending` with a `status_reasons` code of `image_request_in_progress` // - has `catalog_offering.managed` set to `true`. func (vpc *VpcV1) DeleteImage(deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteImageWithContext(context.Background(), deleteImageOptions) + response, err = vpc.DeleteImageWithContext(context.Background(), deleteImageOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteImageWithContext is an alternate form of the DeleteImage method which supports a Context parameter func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteImageOptions, "deleteImageOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteImageOptions, "deleteImageOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3862,6 +4377,7 @@ func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3879,10 +4395,16 @@ func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions 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_image", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -3890,17 +4412,21 @@ func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions // GetImage : Retrieve an image // This request retrieves a single image specified by the identifier in the URL. func (vpc *VpcV1) GetImage(getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { - return vpc.GetImageWithContext(context.Background(), getImageOptions) + result, response, err = vpc.GetImageWithContext(context.Background(), getImageOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetImageWithContext is an alternate form of the GetImage method which supports a Context parameter func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getImageOptions, "getImageOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getImageOptions, "getImageOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3913,6 +4439,7 @@ func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetI builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3931,17 +4458,21 @@ func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetI 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_image", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3955,17 +4486,21 @@ func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetI // the same way as a retrieved image and contains only the information to be updated. A system-provided image is not // allowed to be updated. An image with a `status` of `deleting` cannot be updated. func (vpc *VpcV1) UpdateImage(updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - return vpc.UpdateImageWithContext(context.Background(), updateImageOptions) + result, response, err = vpc.UpdateImageWithContext(context.Background(), updateImageOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateImageWithContext is an alternate form of the UpdateImage method which supports a Context parameter func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateImageOptions, "updateImageOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateImageOptions, "updateImageOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3978,6 +4513,7 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3997,22 +4533,27 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions _, err = builder.SetBodyContentJSON(updateImageOptions.ImagePatch) 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_image", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4035,17 +4576,21 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions // // A system-provided image is not allowed to be deprecated. func (vpc *VpcV1) DeprecateImage(deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { - return vpc.DeprecateImageWithContext(context.Background(), deprecateImageOptions) + response, err = vpc.DeprecateImageWithContext(context.Background(), deprecateImageOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeprecateImageWithContext is an alternate form of the DeprecateImage method which supports a Context parameter func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deprecateImageOptions, "deprecateImageOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deprecateImageOptions, "deprecateImageOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4058,6 +4603,7 @@ func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/deprecate`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4075,10 +4621,16 @@ func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageO 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, "deprecate_image", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -4095,17 +4647,21 @@ func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageO // // A system-provided image is not allowed to be obsoleted. func (vpc *VpcV1) ObsoleteImage(obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { - return vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) + response, err = vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ObsoleteImageWithContext is an alternate form of the ObsoleteImage method which supports a Context parameter func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(obsoleteImageOptions, "obsoleteImageOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(obsoleteImageOptions, "obsoleteImageOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4118,6 +4674,7 @@ func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/obsolete`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4135,10 +4692,16 @@ func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOpt 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, "obsolete_image", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -4151,17 +4714,21 @@ func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOpt // `created_at` property values will in turn be sorted by ascending // `name` property values. func (vpc *VpcV1) ListImageExportJobs(listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListImageExportJobsWithContext(context.Background(), listImageExportJobsOptions) + result, response, err = vpc.ListImageExportJobsWithContext(context.Background(), listImageExportJobsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListImageExportJobsWithContext is an alternate form of the ListImageExportJobs method which supports a Context parameter func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listImageExportJobsOptions, "listImageExportJobsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listImageExportJobsOptions, "listImageExportJobsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4174,6 +4741,7 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4195,17 +4763,21 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE 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_image_export_jobs", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJobUnpaginatedCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4220,17 +4792,21 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE // `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains // the information necessary to create and queue the new image export job. func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - return vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) + result, response, err = vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateImageExportJobWithContext is an alternate form of the CreateImageExportJob method which supports a Context parameter func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createImageExportJobOptions, "createImageExportJobOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createImageExportJobOptions, "createImageExportJobOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4243,6 +4819,7 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4272,22 +4849,27 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma } _, 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_image_export_job", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4301,17 +4883,21 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma // will be canceled, and the incomplete exported image object deleted. If the job has completed, the exported image // object will not be deleted. func (vpc *VpcV1) DeleteImageExportJob(deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) + response, err = vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteImageExportJobWithContext is an alternate form of the DeleteImageExportJob method which supports a Context parameter func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteImageExportJobOptions, "deleteImageExportJobOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteImageExportJobOptions, "deleteImageExportJobOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4325,6 +4911,7 @@ func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteIma builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4342,10 +4929,16 @@ func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteIma 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_image_export_job", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -4353,17 +4946,21 @@ func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteIma // GetImageExportJob : Retrieve an image export job // This request retrieves a single image export job specified by the identifier in the URL. func (vpc *VpcV1) GetImageExportJob(getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - return vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) + result, response, err = vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetImageExportJobWithContext is an alternate form of the GetImageExportJob method which supports a Context parameter func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getImageExportJobOptions, "getImageExportJobOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getImageExportJobOptions, "getImageExportJobOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4377,6 +4974,7 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4395,17 +4993,21 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo 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_image_export_job", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4419,17 +5021,21 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo // job patch object is structured in the same way as a retrieved image export job and contains only the information to // be updated. func (vpc *VpcV1) UpdateImageExportJob(updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - return vpc.UpdateImageExportJobWithContext(context.Background(), updateImageExportJobOptions) + result, response, err = vpc.UpdateImageExportJobWithContext(context.Background(), updateImageExportJobOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateImageExportJobWithContext is an alternate form of the UpdateImageExportJob method which supports a Context parameter func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateImageExportJobOptions, "updateImageExportJobOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateImageExportJobOptions, "updateImageExportJobOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4443,6 +5049,7 @@ func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateIma builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4462,22 +5069,27 @@ func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateIma _, err = builder.SetBodyContentJSON(updateImageExportJobOptions.ImageExportJobPatch) 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_image_export_job", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4489,13 +5101,16 @@ func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateIma // ListOperatingSystems : List all operating systems // This request lists all operating systems in the region. func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { - return vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) + result, response, err = vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListOperatingSystemsWithContext is an alternate form of the ListOperatingSystems method which supports a Context parameter func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listOperatingSystemsOptions, "listOperatingSystemsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4504,6 +5119,7 @@ func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOpera builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4528,17 +5144,21 @@ func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOpera 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_operating_systems", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystemCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4550,17 +5170,21 @@ func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOpera // GetOperatingSystem : Retrieve an operating system // This request retrieves a single operating system specified by the name in the URL. func (vpc *VpcV1) GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { - return vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) + result, response, err = vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetOperatingSystemWithContext is an alternate form of the GetOperatingSystem method which supports a Context parameter func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getOperatingSystemOptions, "getOperatingSystemOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4573,6 +5197,7 @@ func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatin builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4591,17 +5216,21 @@ func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatin 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_operating_system", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystem) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4614,13 +5243,16 @@ func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatin // This request lists all keys in the region. A key contains a public SSH key which may be installed on instances when // they are created. Private keys are not stored. func (vpc *VpcV1) ListKeys(listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { - return vpc.ListKeysWithContext(context.Background(), listKeysOptions) + result, response, err = vpc.ListKeysWithContext(context.Background(), listKeysOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListKeysWithContext is an alternate form of the ListKeys method which supports a Context parameter func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listKeysOptions, "listKeysOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4629,6 +5261,7 @@ func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *List builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4653,17 +5286,21 @@ func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *List 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_keys", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKeyCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4677,17 +5314,21 @@ func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *List // as a retrieved key, and contains the information necessary to create the new key. The public key value must be // provided. func (vpc *VpcV1) CreateKey(createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - return vpc.CreateKeyWithContext(context.Background(), createKeyOptions) + result, response, err = vpc.CreateKeyWithContext(context.Background(), createKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateKeyWithContext is an alternate form of the CreateKey method which supports a Context parameter func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createKeyOptions, "createKeyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createKeyOptions, "createKeyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4696,6 +5337,7 @@ func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *Cr builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4728,22 +5370,27 @@ func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *Cr } _, 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_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4755,17 +5402,21 @@ func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *Cr // DeleteKey : Delete a key // This request deletes a key. This operation cannot be reversed. func (vpc *VpcV1) DeleteKey(deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteKeyWithContext(context.Background(), deleteKeyOptions) + response, err = vpc.DeleteKeyWithContext(context.Background(), deleteKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteKeyWithContext is an alternate form of the DeleteKey method which supports a Context parameter func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteKeyOptions, "deleteKeyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteKeyOptions, "deleteKeyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4778,6 +5429,7 @@ func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *De builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4795,10 +5447,16 @@ func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *De 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_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -4806,17 +5464,21 @@ func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *De // GetKey : Retrieve a key // This request retrieves a single key specified by the identifier in the URL. func (vpc *VpcV1) GetKey(getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - return vpc.GetKeyWithContext(context.Background(), getKeyOptions) + result, response, err = vpc.GetKeyWithContext(context.Background(), getKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetKeyWithContext is an alternate form of the GetKey method which supports a Context parameter func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getKeyOptions, "getKeyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getKeyOptions, "getKeyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4829,6 +5491,7 @@ func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOp builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4847,17 +5510,21 @@ func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOp 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_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4869,17 +5536,21 @@ func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOp // UpdateKey : Update a key // This request updates a key's name. func (vpc *VpcV1) UpdateKey(updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - return vpc.UpdateKeyWithContext(context.Background(), updateKeyOptions) + result, response, err = vpc.UpdateKeyWithContext(context.Background(), updateKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateKeyWithContext is an alternate form of the UpdateKey method which supports a Context parameter func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateKeyOptions, "updateKeyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateKeyOptions, "updateKeyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4892,6 +5563,7 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4911,22 +5583,27 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up _, err = builder.SetBodyContentJSON(updateKeyOptions.KeyPatch) 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_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4939,13 +5616,16 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up // This request lists provisionable [instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the // region. An instance profile specifies the performance characteristics and pricing model for an instance. func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) + result, response, err = vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceProfilesWithContext is an alternate form of the ListInstanceProfiles method which supports a Context parameter func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listInstanceProfilesOptions, "listInstanceProfilesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4954,6 +5634,7 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4972,17 +5653,21 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta 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_profiles", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfileCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4994,17 +5679,21 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta // GetInstanceProfile : Retrieve an instance profile // This request retrieves a single instance profile specified by the name in the URL. func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { - return vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) + result, response, err = vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceProfileWithContext is an alternate form of the GetInstanceProfile method which supports a Context parameter func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceProfileOptions, "getInstanceProfileOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5017,6 +5706,7 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5035,17 +5725,21 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance 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_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfile) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5057,13 +5751,16 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance // ListInstanceTemplates : List all instance templates // This request lists all instance templates in the region. func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) + result, response, err = vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceTemplatesWithContext is an alternate form of the ListInstanceTemplates method which supports a Context parameter func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listInstanceTemplatesOptions, "listInstanceTemplatesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5072,6 +5769,7 @@ func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInst builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5090,17 +5788,21 @@ func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInst 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_templates", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplateCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5116,17 +5818,21 @@ func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInst // If a `source_template` is specified in the prototype object, its contents are copied into the new template prior to // copying any other properties provided in the prototype object. func (vpc *VpcV1) CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceTemplateWithContext(context.Background(), createInstanceTemplateOptions) + result, response, err = vpc.CreateInstanceTemplateWithContext(context.Background(), createInstanceTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceTemplateWithContext is an alternate form of the CreateInstanceTemplate method which supports a Context parameter func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceTemplateOptions, "createInstanceTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceTemplateOptions, "createInstanceTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5135,6 +5841,7 @@ func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createI builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5154,22 +5861,27 @@ func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createI _, err = builder.SetBodyContentJSON(createInstanceTemplateOptions.InstanceTemplatePrototype) 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_instance_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5181,17 +5893,21 @@ func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createI // DeleteInstanceTemplate : Delete an instance template // This request deletes the instance template. This operation cannot be reversed. func (vpc *VpcV1) DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) + response, err = vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceTemplateWithContext is an alternate form of the DeleteInstanceTemplate method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5204,6 +5920,7 @@ func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteI builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5221,10 +5938,16 @@ func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteI 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_instance_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -5232,17 +5955,21 @@ func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteI // GetInstanceTemplate : Retrieve an instance template // This request retrieves a single instance template specified by the identifier in the URL. func (vpc *VpcV1) GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) + result, response, err = vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceTemplateWithContext is an alternate form of the GetInstanceTemplate method which supports a Context parameter func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceTemplateOptions, "getInstanceTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5255,6 +5982,7 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5273,17 +6001,21 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc 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_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5297,17 +6029,21 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc // template patch object is structured in the same way as a retrieved instance template and contains only the // information to be updated. func (vpc *VpcV1) UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) + result, response, err = vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceTemplateWithContext is an alternate form of the UpdateInstanceTemplate method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceTemplateOptions, "updateInstanceTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5320,6 +6056,7 @@ func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateI builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5339,22 +6076,27 @@ func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateI _, err = builder.SetBodyContentJSON(updateInstanceTemplateOptions.InstanceTemplatePatch) 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_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5366,13 +6108,16 @@ func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateI // ListInstances : List all instances // This request lists all instances in the region. func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) + result, response, err = vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstancesWithContext is an alternate form of the ListInstances method which supports a Context parameter func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listInstancesOptions, "listInstancesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5381,6 +6126,7 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5447,17 +6193,21 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt 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_instances", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5471,17 +6221,21 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt // same way as a retrieved instance, and contains the information necessary to provision the new instance. The instance // is automatically started. func (vpc *VpcV1) CreateInstance(createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) + result, response, err = vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceWithContext is an alternate form of the CreateInstance method which supports a Context parameter func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceOptions, "createInstanceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceOptions, "createInstanceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5490,6 +6244,7 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5509,22 +6264,27 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO _, err = builder.SetBodyContentJSON(createInstanceOptions.InstancePrototype) 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_instance", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5540,17 +6300,21 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO // `auto_delete` set to `true` targeting the instance, the instance network attachments, the instance network // interfaces, or the automatically deleted virtual network interfaces are automatically deleted. func (vpc *VpcV1) DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) + response, err = vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceWithContext is an alternate form of the DeleteInstance method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceOptions, "deleteInstanceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceOptions, "deleteInstanceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5563,6 +6327,7 @@ func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5583,10 +6348,16 @@ func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceO 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_instance", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -5594,17 +6365,21 @@ func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceO // GetInstance : Retrieve an instance // This request retrieves a single instance specified by the identifier in the URL. func (vpc *VpcV1) GetInstance(getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - return vpc.GetInstanceWithContext(context.Background(), getInstanceOptions) + result, response, err = vpc.GetInstanceWithContext(context.Background(), getInstanceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceWithContext is an alternate form of the GetInstance method which supports a Context parameter func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceOptions, "getInstanceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceOptions, "getInstanceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5617,6 +6392,7 @@ func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5635,17 +6411,21 @@ func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions 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", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5658,17 +6438,21 @@ func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions // This request updates an instance with the information in a provided instance patch. The instance patch object is // structured in the same way as a retrieved instance and contains only the information to be updated. func (vpc *VpcV1) UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) + result, response, err = vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceWithContext is an alternate form of the UpdateInstance method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceOptions, "updateInstanceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5681,6 +6465,7 @@ func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5703,22 +6488,27 @@ func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceO _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) 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", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5731,17 +6521,21 @@ func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceO // This request retrieves configuration used to initialize the instance, such as SSH keys and the Windows administrator // password. These can subsequently be changed on the instance and therefore may not be current. func (vpc *VpcV1) GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { - return vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) + result, response, err = vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceInitializationWithContext is an alternate form of the GetInstanceInitialization method which supports a Context parameter func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceInitializationOptions, "getInstanceInitializationOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceInitializationOptions, "getInstanceInitializationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5754,6 +6548,7 @@ func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getI builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}/initialization`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5772,17 +6567,21 @@ func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getI 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_initialization", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceInitialization) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5795,17 +6594,21 @@ func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getI // This request creates a new action which will be queued up to run as soon as any pending or running actions have // completed. func (vpc *VpcV1) CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) + result, response, err = vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceActionWithContext is an alternate form of the CreateInstanceAction method which supports a Context parameter func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceActionOptions, "createInstanceActionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceActionOptions, "createInstanceActionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5818,6 +6621,7 @@ func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createIns builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/actions`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5844,22 +6648,27 @@ func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createIns } _, 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_instance_action", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5874,17 +6683,21 @@ func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createIns // request. The access token is only valid for a short period of time, and a maximum of one token is valid for a given // instance at a time. func (vpc *VpcV1) CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) + result, response, err = vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceConsoleAccessTokenWithContext is an alternate form of the CreateInstanceConsoleAccessToken method which supports a Context parameter func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Context, createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5897,6 +6710,7 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/console_access_token`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5923,22 +6737,27 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex } _, 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_instance_console_access_token", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5952,17 +6771,21 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex // physical host and is also referred to as instance storage. By default, the listed disks are sorted by their // `created_at` property values, with the newest disk first. func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) + result, response, err = vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceDisksWithContext is an alternate form of the ListInstanceDisks method which supports a Context parameter func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceDisksOptions, "listInstanceDisksOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5975,6 +6798,7 @@ func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstance builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5993,17 +6817,21 @@ func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstance 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_disks", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6015,17 +6843,21 @@ func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstance // GetInstanceDisk : Retrieve an instance disk // This request retrieves a single instance disk specified by the identifier in the URL. func (vpc *VpcV1) GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - return vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) + result, response, err = vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceDiskWithContext is an alternate form of the GetInstanceDisk method which supports a Context parameter func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceDiskOptions, "getInstanceDiskOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6039,6 +6871,7 @@ func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDis builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6057,17 +6890,21 @@ func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDis 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_disk", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6079,17 +6916,21 @@ func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDis // UpdateInstanceDisk : Update an instance disk // This request updates the instance disk with the information in a provided patch. func (vpc *VpcV1) UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) + result, response, err = vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceDiskWithContext is an alternate form of the UpdateInstanceDisk method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceDiskOptions, "updateInstanceDiskOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6103,6 +6944,7 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6122,22 +6964,27 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta _, err = builder.SetBodyContentJSON(updateInstanceDiskOptions.InstanceDiskPatch) 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_disk", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6154,17 +7001,21 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta // Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property // values. func (vpc *VpcV1) ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) + result, response, err = vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceNetworkAttachmentsWithContext is an alternate form of the ListInstanceNetworkAttachments method which supports a Context parameter func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6177,6 +7028,7 @@ func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6195,17 +7047,21 @@ func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, 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_network_attachments", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachmentCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6219,17 +7075,21 @@ func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, // prototype object is structured in the same way as a retrieved instance network attachment, and contains the // information necessary to create the new instance network attachment. func (vpc *VpcV1) CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) + result, response, err = vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceNetworkAttachmentWithContext is an alternate form of the CreateInstanceNetworkAttachment method which supports a Context parameter func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context, createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6242,6 +7102,7 @@ func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6268,22 +7129,27 @@ func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context } _, 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_instance_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6298,17 +7164,21 @@ func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context // `true` targeting the instance network attachment are automatically deleted. The primary instance network attachment // is not allowed to be deleted. func (vpc *VpcV1) DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) + response, err = vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceNetworkAttachmentWithContext is an alternate form of the DeleteInstanceNetworkAttachment method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context, deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6322,6 +7192,7 @@ func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6339,10 +7210,16 @@ func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context 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_instance_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -6350,17 +7227,21 @@ func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context // GetInstanceNetworkAttachment : Retrieve an instance network attachment // This request retrieves a single instance network attachment specified by the identifier in the URL. func (vpc *VpcV1) GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) + result, response, err = vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceNetworkAttachmentWithContext is an alternate form of the GetInstanceNetworkAttachment method which supports a Context parameter func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6374,6 +7255,7 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6392,17 +7274,21 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g 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_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6416,17 +7302,21 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g // patch object. The instance network attachment patch object is structured in the same way as a retrieved instance // network attachment and needs to contain only the information to be updated. func (vpc *VpcV1) UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) + result, response, err = vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceNetworkAttachmentWithContext is an alternate form of the UpdateInstanceNetworkAttachment method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context, updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6440,6 +7330,7 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6459,22 +7350,27 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context _, err = builder.SetBodyContentJSON(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) 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_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6493,17 +7389,21 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context // 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. func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) + result, response, err = vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceNetworkInterfacesWithContext is an alternate form of the ListInstanceNetworkInterfaces method which supports a Context parameter func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6516,6 +7416,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6534,17 +7435,21 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, 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_network_interfaces", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceUnpaginatedCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6563,17 +7468,21 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, // 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 new network interfaces are not allowed to be created. func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) + result, response, err = vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceNetworkInterfaceWithContext is an alternate form of the CreateInstanceNetworkInterface method which supports a Context parameter func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6586,6 +7495,7 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6621,22 +7531,27 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, } _, 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_instance_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6655,17 +7570,21 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, // 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 is not allowed to be deleted. func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) + response, err = vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6679,6 +7598,7 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6696,10 +7616,16 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, 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_instance_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -6711,17 +7637,21 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, // [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. func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) + result, response, err = vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6735,6 +7665,7 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6753,17 +7684,21 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge 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_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6781,17 +7716,21 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge // 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 is not allowed to be updated. func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) + result, response, err = vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceNetworkInterfaceWithContext is an alternate form of the UpdateInstanceNetworkInterface method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6805,6 +7744,7 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6824,22 +7764,27 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, _, err = builder.SetBodyContentJSON(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) 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_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6851,17 +7796,21 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, // ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with an instance network interface // This request lists all floating IPs associated with an instance network interface. func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) + result, response, err = vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6875,6 +7824,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6893,17 +7843,21 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context 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_network_interface_floating_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6915,17 +7869,21 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context // RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from an instance network interface // This request disassociates the specified floating IP from the specified instance network interface. func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) + response, err = vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // RemoveInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveInstanceNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6940,6 +7898,7 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6957,10 +7916,16 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex 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, "remove_instance_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -6969,17 +7934,21 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex // This request retrieves a specified floating IP address if it is associated with the instance network interface and // instance specified in the URL. func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) + result, response, err = vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the GetInstanceNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6994,6 +7963,7 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7012,17 +7982,21 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C 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_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7041,17 +8015,21 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C // // A request body is not required, and if provided, is ignored. func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) + result, response, err = vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // AddInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the AddInstanceNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7066,6 +8044,7 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7084,17 +8063,21 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C 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, "add_instance_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7107,7 +8090,9 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C // This request lists the primary reserved IP for an instance network interface. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) + result, response, err = vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter @@ -7116,10 +8101,12 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceIps") err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7133,6 +8120,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7157,17 +8145,21 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context 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_network_interface_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7180,7 +8172,9 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context // This request retrieves the primary reserved IP for an instance network interface. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) + result, response, err = vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter @@ -7189,10 +8183,12 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceIP") err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7207,6 +8203,7 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7225,17 +8222,21 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, 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_network_interface_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7249,17 +8250,21 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, // instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one // volume. func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) + result, response, err = vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceVolumeAttachmentsWithContext is an alternate form of the ListInstanceVolumeAttachments method which supports a Context parameter func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7272,6 +8277,7 @@ func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7290,17 +8296,21 @@ func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, 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_volume_attachments", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachmentCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7315,17 +8325,21 @@ func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, // the same way as a retrieved volume attachment, and contains the information necessary to create the new volume // attachment. func (vpc *VpcV1) CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) + result, response, err = vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceVolumeAttachmentWithContext is an alternate form of the CreateInstanceVolumeAttachment method which supports a Context parameter func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7338,6 +8352,7 @@ func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7367,22 +8382,27 @@ func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, } _, 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_instance_volume_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7395,17 +8415,21 @@ func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, // This request deletes a volume attachment. This operation cannot be reversed, but a new volume attachment may // subsequently be created for the volume. For this request to succeed, the volume must not be busy. func (vpc *VpcV1) DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) + response, err = vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceVolumeAttachmentWithContext is an alternate form of the DeleteInstanceVolumeAttachment method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7419,6 +8443,7 @@ func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7436,10 +8461,16 @@ func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, 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_instance_volume_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -7447,17 +8478,21 @@ func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, // GetInstanceVolumeAttachment : Retrieve a volume attachment // This request retrieves a single volume attachment specified by the identifier in the URL. func (vpc *VpcV1) GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - return vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) + result, response, err = vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceVolumeAttachmentWithContext is an alternate form of the GetInstanceVolumeAttachment method which supports a Context parameter func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7471,6 +8506,7 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7489,17 +8525,21 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge 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_volume_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7513,17 +8553,21 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge // volume attachment patch object is structured in the same way as a retrieved volume attachment and needs to contain // only the information to be updated. func (vpc *VpcV1) UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) + result, response, err = vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceVolumeAttachmentWithContext is an alternate form of the UpdateInstanceVolumeAttachment method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7537,6 +8581,7 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7556,22 +8601,27 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, _, err = builder.SetBodyContentJSON(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) 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_volume_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7583,13 +8633,16 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, // ListInstanceGroups : List all instance groups // This request lists all instance groups in the region. func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) + result, response, err = vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceGroupsWithContext is an alternate form of the ListInstanceGroups method which supports a Context parameter func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listInstanceGroupsOptions, "listInstanceGroupsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7598,6 +8651,7 @@ func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanc builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7622,17 +8676,21 @@ func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanc 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_groups", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7644,17 +8702,21 @@ func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanc // CreateInstanceGroup : Create an instance group // This request creates a new instance group. func (vpc *VpcV1) CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupWithContext(context.Background(), createInstanceGroupOptions) + result, response, err = vpc.CreateInstanceGroupWithContext(context.Background(), createInstanceGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceGroupWithContext is an alternate form of the CreateInstanceGroup method which supports a Context parameter func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceGroupOptions, "createInstanceGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceGroupOptions, "createInstanceGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7663,6 +8725,7 @@ func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInst builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7707,22 +8770,27 @@ func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInst } _, 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_instance_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7735,17 +8803,21 @@ func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInst // This request deletes an instance group. This operation cannot be reversed. Any instances associated with the group // will be deleted. func (vpc *VpcV1) DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupWithContext(context.Background(), deleteInstanceGroupOptions) + response, err = vpc.DeleteInstanceGroupWithContext(context.Background(), deleteInstanceGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceGroupWithContext is an alternate form of the DeleteInstanceGroup method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceGroupOptions, "deleteInstanceGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceGroupOptions, "deleteInstanceGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7758,6 +8830,7 @@ func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInst builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7775,10 +8848,16 @@ func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInst 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_instance_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -7786,17 +8865,21 @@ func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInst // GetInstanceGroup : Retrieve an instance group // This request retrieves a single instance group specified by identifier in the URL. func (vpc *VpcV1) GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) + result, response, err = vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceGroupWithContext is an alternate form of the GetInstanceGroup method which supports a Context parameter func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceGroupOptions, "getInstanceGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceGroupOptions, "getInstanceGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7809,6 +8892,7 @@ func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGr builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7827,17 +8911,21 @@ func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGr 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_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7850,17 +8938,21 @@ func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGr // This request updates an instance group with the information provided instance group patch. The instance group patch // object is structured in the same way as a retrieved instance group and contains only the information to be updated. func (vpc *VpcV1) UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) + result, response, err = vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceGroupWithContext is an alternate form of the UpdateInstanceGroup method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceGroupOptions, "updateInstanceGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceGroupOptions, "updateInstanceGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7873,6 +8965,7 @@ func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInst builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7892,22 +8985,27 @@ func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInst _, err = builder.SetBodyContentJSON(updateInstanceGroupOptions.InstanceGroupPatch) 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_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7919,17 +9017,21 @@ func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInst // DeleteInstanceGroupLoadBalancer : Delete an instance group load balancer // This request unbinds the instance group from the load balancer pool, and deletes the load balancer pool members. func (vpc *VpcV1) DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) + response, err = vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceGroupLoadBalancerWithContext is an alternate form of the DeleteInstanceGroupLoadBalancer method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context, deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7942,6 +9044,7 @@ func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/load_balancer`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7959,10 +9062,16 @@ func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context 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_instance_group_load_balancer", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -7970,17 +9079,21 @@ func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context // ListInstanceGroupManagers : List all managers for an instance group // This request lists all managers for an instance group. func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) + result, response, err = vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceGroupManagersWithContext is an alternate form of the ListInstanceGroupManagers method which supports a Context parameter func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7993,6 +9106,7 @@ func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, list builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8017,17 +9131,21 @@ func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, list 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_group_managers", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8039,17 +9157,21 @@ func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, list // CreateInstanceGroupManager : Create a manager for an instance group // This request creates a new instance group manager. func (vpc *VpcV1) CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) + result, response, err = vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceGroupManagerWithContext is an alternate form of the CreateInstanceGroupManager method which supports a Context parameter func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8062,6 +9184,7 @@ func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, cre builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8081,22 +9204,27 @@ func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, cre _, err = builder.SetBodyContentJSON(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) 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_instance_group_manager", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8108,17 +9236,21 @@ func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, cre // DeleteInstanceGroupManager : Delete an instance group manager // This request deletes an instance group manager. This operation cannot be reversed. func (vpc *VpcV1) DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) + response, err = vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceGroupManagerWithContext is an alternate form of the DeleteInstanceGroupManager method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8132,6 +9264,7 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, del builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8149,10 +9282,16 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, del 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_instance_group_manager", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -8160,17 +9299,21 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, del // GetInstanceGroupManager : Retrieve an instance group manager // This request retrieves a single instance group manager specified by identifier in the URL. func (vpc *VpcV1) GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) + result, response, err = vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceGroupManagerWithContext is an alternate form of the GetInstanceGroupManager method which supports a Context parameter func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8184,6 +9327,7 @@ func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getIns builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8202,17 +9346,21 @@ func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getIns 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_group_manager", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8224,17 +9372,21 @@ func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getIns // UpdateInstanceGroupManager : Update an instance group manager // This request updates an instance group manager with the information provided instance group manager patch. func (vpc *VpcV1) UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) + result, response, err = vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceGroupManagerWithContext is an alternate form of the UpdateInstanceGroupManager method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8248,6 +9400,7 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, upd builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8267,22 +9420,27 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, upd _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) 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_group_manager", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8294,17 +9452,21 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, upd // ListInstanceGroupManagerActions : List all actions for an instance group manager // This request lists all instance group actions for an instance group manager. func (vpc *VpcV1) ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) + result, response, err = vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceGroupManagerActionsWithContext is an alternate form of the ListInstanceGroupManagerActions method which supports a Context parameter func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context, listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8318,6 +9480,7 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8342,17 +9505,21 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context 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_group_manager_actions", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerActionsCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8364,17 +9531,21 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context // CreateInstanceGroupManagerAction : Create an instance group manager action // This request creates a new instance group manager action. func (vpc *VpcV1) CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) + result, response, err = vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceGroupManagerActionWithContext is an alternate form of the CreateInstanceGroupManagerAction method which supports a Context parameter func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Context, createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8388,6 +9559,7 @@ func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8407,22 +9579,27 @@ func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Contex _, err = builder.SetBodyContentJSON(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) 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_instance_group_manager_action", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8434,17 +9611,21 @@ func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Contex // DeleteInstanceGroupManagerAction : Delete specified instance group manager action // This request deletes an instance group manager action. This operation cannot be reversed. func (vpc *VpcV1) DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) + response, err = vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceGroupManagerActionWithContext is an alternate form of the DeleteInstanceGroupManagerAction method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Context, deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8459,6 +9640,7 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8476,10 +9658,16 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Contex 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_instance_group_manager_action", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -8487,17 +9675,21 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Contex // GetInstanceGroupManagerAction : Retrieve specified instance group manager action // This request retrieves a single instance group manager action specified by identifier in the URL. func (vpc *VpcV1) GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupManagerActionWithContext(context.Background(), getInstanceGroupManagerActionOptions) + result, response, err = vpc.GetInstanceGroupManagerActionWithContext(context.Background(), getInstanceGroupManagerActionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceGroupManagerActionWithContext is an alternate form of the GetInstanceGroupManagerAction method which supports a Context parameter func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8512,6 +9704,7 @@ func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8530,17 +9723,21 @@ func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, 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_group_manager_action", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8552,17 +9749,21 @@ func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, // UpdateInstanceGroupManagerAction : Update specified instance group manager action // This request updates an instance group manager action. func (vpc *VpcV1) UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) + result, response, err = vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceGroupManagerActionWithContext is an alternate form of the UpdateInstanceGroupManagerAction method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Context, updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8577,6 +9778,7 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8596,22 +9798,27 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Contex _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) 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_group_manager_action", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8623,17 +9830,21 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Contex // ListInstanceGroupManagerPolicies : List all policies for an instance group manager // This request lists all policies for an instance group manager. func (vpc *VpcV1) ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) + result, response, err = vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceGroupManagerPoliciesWithContext is an alternate form of the ListInstanceGroupManagerPolicies method which supports a Context parameter func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Context, listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8647,6 +9858,7 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8671,17 +9883,21 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex 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_group_manager_policies", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicyCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8693,17 +9909,21 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex // CreateInstanceGroupManagerPolicy : Create a policy for an instance group manager // This request creates a new instance group manager policy. func (vpc *VpcV1) CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) + result, response, err = vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceGroupManagerPolicyWithContext is an alternate form of the CreateInstanceGroupManagerPolicy method which supports a Context parameter func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Context, createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8717,6 +9937,7 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8736,22 +9957,27 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) 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_instance_group_manager_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8763,17 +9989,21 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex // DeleteInstanceGroupManagerPolicy : Delete an instance group manager policy // This request deletes an instance group manager policy. This operation cannot be reversed. func (vpc *VpcV1) DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) + response, err = vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceGroupManagerPolicyWithContext is an alternate form of the DeleteInstanceGroupManagerPolicy method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Context, deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8788,6 +10018,7 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8805,10 +10036,16 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Contex 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_instance_group_manager_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -8816,17 +10053,21 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Contex // GetInstanceGroupManagerPolicy : Retrieve an instance group manager policy // This request retrieves a single instance group manager policy specified by identifier in the URL. func (vpc *VpcV1) GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) + result, response, err = vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceGroupManagerPolicyWithContext is an alternate form of the GetInstanceGroupManagerPolicy method which supports a Context parameter func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8841,6 +10082,7 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8859,17 +10101,21 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, 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_group_manager_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8881,17 +10127,21 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, // UpdateInstanceGroupManagerPolicy : Update an instance group manager policy // This request updates an instance group manager policy. func (vpc *VpcV1) UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) + result, response, err = vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceGroupManagerPolicyWithContext is an alternate form of the UpdateInstanceGroupManagerPolicy method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Context, updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8906,6 +10156,7 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8925,22 +10176,27 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) 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_group_manager_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8953,17 +10209,21 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex // This request deletes all memberships of an instance group. This operation cannot be reversed. reversed. Any // memberships that have `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) + response, err = vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceGroupMembershipsWithContext is an alternate form of the DeleteInstanceGroupMemberships method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8976,6 +10236,7 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8993,10 +10254,16 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, 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_instance_group_memberships", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -9004,17 +10271,21 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, // ListInstanceGroupMemberships : List all memberships for an instance group // This request lists all instance group memberships for an instance group. func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) + result, response, err = vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceGroupMembershipsWithContext is an alternate form of the ListInstanceGroupMemberships method which supports a Context parameter func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9027,6 +10298,7 @@ func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, l builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9051,17 +10323,21 @@ func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, l 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_group_memberships", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembershipCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9074,17 +10350,21 @@ func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, l // This request deletes a memberships of an instance group. This operation cannot be reversed. reversed. If the // membership has `delete_instance_on_membership_delete` set to `true`, the instance will also be deleted. func (vpc *VpcV1) DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) + response, err = vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceGroupMembershipWithContext is an alternate form of the DeleteInstanceGroupMembership method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9098,6 +10378,7 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9115,10 +10396,16 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, 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_instance_group_membership", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -9126,17 +10413,21 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, // GetInstanceGroupMembership : Retrieve an instance group membership // This request retrieves a single instance group membership specified by identifier in the URL. func (vpc *VpcV1) GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) + result, response, err = vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceGroupMembershipWithContext is an alternate form of the GetInstanceGroupMembership method which supports a Context parameter func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9150,6 +10441,7 @@ func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, get builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9168,17 +10460,21 @@ func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, get 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_group_membership", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9190,17 +10486,21 @@ func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, get // UpdateInstanceGroupMembership : Update an instance group membership // This request updates an instance group membership with the information provided instance group membership patch. func (vpc *VpcV1) UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupMembershipWithContext(context.Background(), updateInstanceGroupMembershipOptions) + result, response, err = vpc.UpdateInstanceGroupMembershipWithContext(context.Background(), updateInstanceGroupMembershipOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceGroupMembershipWithContext is an alternate form of the UpdateInstanceGroupMembership method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9214,6 +10514,7 @@ func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9233,22 +10534,27 @@ func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, _, err = builder.SetBodyContentJSON(updateInstanceGroupMembershipOptions.InstanceGroupMembershipPatch) 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_group_membership", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9264,13 +10570,16 @@ func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, // The reservations will be sorted by their `created_at` property values, with newest reservations first. Reservations // with identical `created_at` property values will in turn be sorted by ascending `name` property values. func (vpc *VpcV1) ListReservations(listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { - return vpc.ListReservationsWithContext(context.Background(), listReservationsOptions) + result, response, err = vpc.ListReservationsWithContext(context.Background(), listReservationsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListReservationsWithContext is an alternate form of the ListReservations method which supports a Context parameter func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listReservationsOptions, "listReservationsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9279,6 +10588,7 @@ func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservati builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9312,17 +10622,21 @@ func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservati 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_reservations", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservationCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9335,17 +10649,21 @@ func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservati // This request creates a new reservation from a reservation prototype object. The prototype object is structured in the // same way as a retrieved reservation, and contains the information necessary to create the new reservation. func (vpc *VpcV1) CreateReservation(createReservationOptions *CreateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - return vpc.CreateReservationWithContext(context.Background(), createReservationOptions) + result, response, err = vpc.CreateReservationWithContext(context.Background(), createReservationOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateReservationWithContext is an alternate form of the CreateReservation method which supports a Context parameter func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReservationOptions *CreateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createReservationOptions, "createReservationOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createReservationOptions, "createReservationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9354,6 +10672,7 @@ func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReserv builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9395,22 +10714,27 @@ func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReserv } _, 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_reservation", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9423,17 +10747,21 @@ func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReserv // This request deletes a reservation. This operation cannot be reversed. Reservations with a `status` of `active` are // not allowed to be deleted. func (vpc *VpcV1) DeleteReservation(deleteReservationOptions *DeleteReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - return vpc.DeleteReservationWithContext(context.Background(), deleteReservationOptions) + result, response, err = vpc.DeleteReservationWithContext(context.Background(), deleteReservationOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteReservationWithContext is an alternate form of the DeleteReservation method which supports a Context parameter func (vpc *VpcV1) DeleteReservationWithContext(ctx context.Context, deleteReservationOptions *DeleteReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteReservationOptions, "deleteReservationOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteReservationOptions, "deleteReservationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9446,6 +10774,7 @@ func (vpc *VpcV1) DeleteReservationWithContext(ctx context.Context, deleteReserv builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9464,17 +10793,21 @@ func (vpc *VpcV1) DeleteReservationWithContext(ctx context.Context, deleteReserv 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_reservation", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9486,17 +10819,21 @@ func (vpc *VpcV1) DeleteReservationWithContext(ctx context.Context, deleteReserv // GetReservation : Retrieve a reservation // This request retrieves a single reservation specified by identifier in the URL. func (vpc *VpcV1) GetReservation(getReservationOptions *GetReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - return vpc.GetReservationWithContext(context.Background(), getReservationOptions) + result, response, err = vpc.GetReservationWithContext(context.Background(), getReservationOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetReservationWithContext is an alternate form of the GetReservation method which supports a Context parameter func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationOptions *GetReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getReservationOptions, "getReservationOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getReservationOptions, "getReservationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9509,6 +10846,7 @@ func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9527,17 +10865,21 @@ func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationO 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_reservation", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9550,17 +10892,21 @@ func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationO // This request updates a reservation with the information provided in a reservation patch object. The patch object is // structured in the same way as a retrieved reservation and needs to contain only the information to be updated. func (vpc *VpcV1) UpdateReservation(updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - return vpc.UpdateReservationWithContext(context.Background(), updateReservationOptions) + result, response, err = vpc.UpdateReservationWithContext(context.Background(), updateReservationOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateReservationWithContext is an alternate form of the UpdateReservation method which supports a Context parameter func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateReservationOptions, "updateReservationOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateReservationOptions, "updateReservationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9573,6 +10919,7 @@ func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReserv builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9592,22 +10939,27 @@ func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReserv _, err = builder.SetBodyContentJSON(updateReservationOptions.ReservationPatch) 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_reservation", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9619,17 +10971,21 @@ func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReserv // ActivateReservation : Activate a reservation // This request activates a reservation. For this request to succeed, the reservation status must be `inactive`. func (vpc *VpcV1) ActivateReservation(activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { - return vpc.ActivateReservationWithContext(context.Background(), activateReservationOptions) + response, err = vpc.ActivateReservationWithContext(context.Background(), activateReservationOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ActivateReservationWithContext is an alternate form of the ActivateReservation method which supports a Context parameter func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(activateReservationOptions, "activateReservationOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(activateReservationOptions, "activateReservationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9642,6 +10998,7 @@ func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateRe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}/activate`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9659,10 +11016,16 @@ func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateRe 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, "activate_reservation", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -9671,13 +11034,16 @@ func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateRe // This request lists all dedicated host groups in the region. Host groups are a collection of dedicated hosts for // placement of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) + result, response, err = vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListDedicatedHostGroupsWithContext is an alternate form of the ListDedicatedHostGroups method which supports a Context parameter func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listDedicatedHostGroupsOptions, "listDedicatedHostGroupsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9686,6 +11052,7 @@ func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9719,17 +11086,21 @@ func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDe 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_dedicated_host_groups", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroupCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9741,17 +11112,21 @@ func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDe // CreateDedicatedHostGroup : Create a dedicated host group // This request creates a new dedicated host group. func (vpc *VpcV1) CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - return vpc.CreateDedicatedHostGroupWithContext(context.Background(), createDedicatedHostGroupOptions) + result, response, err = vpc.CreateDedicatedHostGroupWithContext(context.Background(), createDedicatedHostGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateDedicatedHostGroupWithContext is an alternate form of the CreateDedicatedHostGroup method which supports a Context parameter func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9760,6 +11135,7 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9795,22 +11171,27 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat } _, 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_dedicated_host_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9822,17 +11203,21 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat // DeleteDedicatedHostGroup : Delete a dedicated host group // This request deletes a dedicated host group. func (vpc *VpcV1) DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteDedicatedHostGroupWithContext(context.Background(), deleteDedicatedHostGroupOptions) + response, err = vpc.DeleteDedicatedHostGroupWithContext(context.Background(), deleteDedicatedHostGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteDedicatedHostGroupWithContext is an alternate form of the DeleteDedicatedHostGroup method which supports a Context parameter func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9845,6 +11230,7 @@ func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, delet builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9862,10 +11248,16 @@ func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, delet 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_dedicated_host_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -9873,17 +11265,21 @@ func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, delet // GetDedicatedHostGroup : Retrieve a dedicated host group // This request retrieves a single dedicated host group specified by the identifier in the URL. func (vpc *VpcV1) GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) + result, response, err = vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetDedicatedHostGroupWithContext is an alternate form of the GetDedicatedHostGroup method which supports a Context parameter func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9896,6 +11292,7 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9914,17 +11311,21 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic 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_dedicated_host_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9938,17 +11339,21 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic // dedicated host group patch object is structured in the same way as a retrieved dedicated host group and contains only // the information to be updated. func (vpc *VpcV1) UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - return vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) + result, response, err = vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateDedicatedHostGroupWithContext is an alternate form of the UpdateDedicatedHostGroup method which supports a Context parameter func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9961,6 +11366,7 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9980,22 +11386,27 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat _, err = builder.SetBodyContentJSON(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) 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_dedicated_host_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10008,13 +11419,16 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat // This request lists provisionable [dedicated host profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in // the region. A dedicated host profile specifies the hardware characteristics for a dedicated host. func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) + result, response, err = vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListDedicatedHostProfilesWithContext is an alternate form of the ListDedicatedHostProfiles method which supports a Context parameter func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listDedicatedHostProfilesOptions, "listDedicatedHostProfilesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10023,6 +11437,7 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10047,17 +11462,21 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list 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_dedicated_host_profiles", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfileCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10069,17 +11488,21 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list // GetDedicatedHostProfile : Retrieve a dedicated host profile // This request retrieves a single dedicated host profile specified by the name in the URL. func (vpc *VpcV1) GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostProfileWithContext(context.Background(), getDedicatedHostProfileOptions) + result, response, err = vpc.GetDedicatedHostProfileWithContext(context.Background(), getDedicatedHostProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetDedicatedHostProfileWithContext is an alternate form of the GetDedicatedHostProfile method which supports a Context parameter func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10092,6 +11515,7 @@ func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDed builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10110,17 +11534,21 @@ func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDed 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_dedicated_host_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfile) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10132,13 +11560,16 @@ func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDed // ListDedicatedHosts : List all dedicated hosts // This request lists all dedicated hosts in the region. func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) + result, response, err = vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListDedicatedHostsWithContext is an alternate form of the ListDedicatedHosts method which supports a Context parameter func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listDedicatedHostsOptions, "listDedicatedHostsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10147,6 +11578,7 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10183,17 +11615,21 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat 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_dedicated_hosts", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10205,17 +11641,21 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat // CreateDedicatedHost : Create a dedicated host // This request creates a new dedicated host. func (vpc *VpcV1) CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - return vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) + result, response, err = vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateDedicatedHostWithContext is an alternate form of the CreateDedicatedHost method which supports a Context parameter func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createDedicatedHostOptions, "createDedicatedHostOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10224,6 +11664,7 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10243,22 +11684,27 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi _, err = builder.SetBodyContentJSON(createDedicatedHostOptions.DedicatedHostPrototype) 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_dedicated_host", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10272,17 +11718,21 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi // compute node. By default, the listed disks are sorted by their // `created_at` property values, with the newest disk first. func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) + result, response, err = vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListDedicatedHostDisksWithContext is an alternate form of the ListDedicatedHostDisks method which supports a Context parameter func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10295,6 +11745,7 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10313,17 +11764,21 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed 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_dedicated_host_disks", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDiskCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10335,17 +11790,21 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed // GetDedicatedHostDisk : Retrieve a dedicated host disk // This request retrieves a single dedicated host disk specified by the identifier in the URL. func (vpc *VpcV1) GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) + result, response, err = vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetDedicatedHostDiskWithContext is an alternate form of the GetDedicatedHostDisk method which supports a Context parameter func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10359,6 +11818,7 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10377,17 +11837,21 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica 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_dedicated_host_disk", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10399,17 +11863,21 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica // UpdateDedicatedHostDisk : Update a dedicated host disk // This request updates the dedicated host disk with the information in a provided patch. func (vpc *VpcV1) UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - return vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) + result, response, err = vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateDedicatedHostDiskWithContext is an alternate form of the UpdateDedicatedHostDisk method which supports a Context parameter func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10423,6 +11891,7 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10442,22 +11911,27 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update _, err = builder.SetBodyContentJSON(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) 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_dedicated_host_disk", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10469,17 +11943,21 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update // DeleteDedicatedHost : Delete a dedicated host // This request deletes a dedicated host. func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) + response, err = vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteDedicatedHostWithContext is an alternate form of the DeleteDedicatedHost method which supports a Context parameter func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteDedicatedHostOptions, "deleteDedicatedHostOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10492,6 +11970,7 @@ func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedi builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10509,10 +11988,16 @@ func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedi 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_dedicated_host", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -10520,17 +12005,21 @@ func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedi // GetDedicatedHost : Retrieve a dedicated host // This request retrieves a single dedicated host specified by the identifiers in the URL. func (vpc *VpcV1) GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) + result, response, err = vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetDedicatedHostWithContext is an alternate form of the GetDedicatedHost method which supports a Context parameter func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getDedicatedHostOptions, "getDedicatedHostOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10543,6 +12032,7 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10561,17 +12051,21 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH 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_dedicated_host", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10585,17 +12079,21 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH // patch object is structured in the same way as a retrieved dedicated host and contains only the information to be // updated. func (vpc *VpcV1) UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - return vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) + result, response, err = vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateDedicatedHostWithContext is an alternate form of the UpdateDedicatedHost method which supports a Context parameter func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateDedicatedHostOptions, "updateDedicatedHostOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10608,6 +12106,7 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10627,22 +12126,27 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi _, err = builder.SetBodyContentJSON(updateDedicatedHostOptions.DedicatedHostPatch) 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_dedicated_host", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10654,13 +12158,16 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi // ListPlacementGroups : List all placement groups // This request lists all placement groups in the region. func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) + result, response, err = vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10669,6 +12176,7 @@ func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacem builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10693,17 +12201,21 @@ func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacem 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_placement_groups", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10715,17 +12227,21 @@ func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacem // CreatePlacementGroup : Create a placement group // This request creates a new placement group. func (vpc *VpcV1) CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - return vpc.CreatePlacementGroupWithContext(context.Background(), createPlacementGroupOptions) + result, response, err = vpc.CreatePlacementGroupWithContext(context.Background(), createPlacementGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreatePlacementGroupWithContext is an alternate form of the CreatePlacementGroup method which supports a Context parameter func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createPlacementGroupOptions, "createPlacementGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createPlacementGroupOptions, "createPlacementGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10734,6 +12250,7 @@ func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPla builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10763,22 +12280,27 @@ func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPla } _, 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_placement_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10791,17 +12313,21 @@ func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPla // This request deletes a placement group. This operation cannot be reversed. For this request to succeed, the placement // group must not be associated with an instance. func (vpc *VpcV1) DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { - return vpc.DeletePlacementGroupWithContext(context.Background(), deletePlacementGroupOptions) + response, err = vpc.DeletePlacementGroupWithContext(context.Background(), deletePlacementGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeletePlacementGroupWithContext is an alternate form of the DeletePlacementGroup method which supports a Context parameter func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deletePlacementGroupOptions, "deletePlacementGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deletePlacementGroupOptions, "deletePlacementGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10814,6 +12340,7 @@ func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePla builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10831,10 +12358,16 @@ func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePla 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_placement_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -10842,17 +12375,21 @@ func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePla // GetPlacementGroup : Retrieve a placement group // This request retrieves a single placement group specified by identifier in the URL. func (vpc *VpcV1) GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - return vpc.GetPlacementGroupWithContext(context.Background(), getPlacementGroupOptions) + result, response, err = vpc.GetPlacementGroupWithContext(context.Background(), getPlacementGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetPlacementGroupWithContext is an alternate form of the GetPlacementGroup method which supports a Context parameter func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getPlacementGroupOptions, "getPlacementGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getPlacementGroupOptions, "getPlacementGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10865,6 +12402,7 @@ func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacement builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10883,17 +12421,21 @@ func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacement 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_placement_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10906,17 +12448,21 @@ func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacement // This request updates a placement group with the information provided placement group patch. The placement group patch // object is structured in the same way as a retrieved placement group and contains only the information to be updated. func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - return vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) + result, response, err = vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10929,6 +12475,7 @@ func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePla builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10948,22 +12495,27 @@ func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePla _, err = builder.SetBodyContentJSON(updatePlacementGroupOptions.PlacementGroupPatch) 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_placement_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10977,13 +12529,16 @@ func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePla // profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) available in the region. A bare metal // server profile specifies the performance characteristics and pricing model for a bare metal server. func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) + result, response, err = vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10992,6 +12547,7 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11016,17 +12572,21 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li 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_bare_metal_server_profiles", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11038,17 +12598,21 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li // GetBareMetalServerProfile : Retrieve a bare metal server profile // This request retrieves a single bare metal server profile specified by the name in the URL. func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) + result, response, err = vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -11061,6 +12625,7 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11079,17 +12644,21 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB 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_bare_metal_server_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11101,13 +12670,16 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB // ListBareMetalServers : List all bare metal servers // This request lists all bare metal servers in the region. func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) + result, response, err = vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -11116,6 +12688,7 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11155,17 +12728,21 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM 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_bare_metal_servers", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11179,17 +12756,21 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM // same way as a retrieved bare metal server, and contains the information necessary to provision the new bare metal // server. The bare metal server is automatically started. func (vpc *VpcV1) CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerWithContext(context.Background(), createBareMetalServerOptions) + result, response, err = vpc.CreateBareMetalServerWithContext(context.Background(), createBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateBareMetalServerWithContext is an alternate form of the CreateBareMetalServer method which supports a Context parameter func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createBareMetalServerOptions, "createBareMetalServerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createBareMetalServerOptions, "createBareMetalServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -11198,6 +12779,7 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11217,22 +12799,27 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa _, err = builder.SetBodyContentJSON(createBareMetalServerOptions.BareMetalServerPrototype) 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_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11247,17 +12834,21 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa // WebSocket request. The access token is only valid for a short period of time, and a maximum of one token is valid // for a given bare metal server at a time. func (vpc *VpcV1) CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerConsoleAccessTokenWithContext(context.Background(), createBareMetalServerConsoleAccessTokenOptions) + result, response, err = vpc.CreateBareMetalServerConsoleAccessTokenWithContext(context.Background(), createBareMetalServerConsoleAccessTokenOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateBareMetalServerConsoleAccessTokenWithContext is an alternate form of the CreateBareMetalServerConsoleAccessToken method which supports a Context parameter func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context.Context, createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -11270,6 +12861,7 @@ func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/console_access_token`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11296,22 +12888,27 @@ func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context } _, 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_bare_metal_server_console_access_token", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerConsoleAccessToken) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11325,17 +12922,21 @@ func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context // physical server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk // first. func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) + result, response, err = vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -11348,6 +12949,7 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11366,17 +12968,21 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB 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_bare_metal_server_disks", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11388,17 +12994,21 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB // GetBareMetalServerDisk : Retrieve a bare metal server disk // This request retrieves a single disk specified by the identifier in the URL. func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) + result, response, err = vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -11412,6 +13022,7 @@ func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBare builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11430,17 +13041,21 @@ func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBare 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_bare_metal_server_disk", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11452,17 +13067,21 @@ func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBare // UpdateBareMetalServerDisk : Update a bare metal server disk // This request updates the bare metal server disk with the information in a provided patch. func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) + result, response, err = vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -11476,6 +13095,7 @@ func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, upda builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11495,22 +13115,27 @@ func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, upda _, err = builder.SetBodyContentJSON(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) 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_bare_metal_server_disk", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11529,17 +13154,21 @@ func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, upda // Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property // values. func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) + result, response, err = vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -11552,6 +13181,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.C builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11576,17 +13206,21 @@ func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.C 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_bare_metal_server_network_attachments", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11600,17 +13234,21 @@ func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.C // object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and // contains the information necessary to create the new bare metal server network attachment. func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) + result, response, err = vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -11623,6 +13261,7 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context. builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11642,22 +13281,27 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context. _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) 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_bare_metal_server_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11672,17 +13316,21 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context. // // The bare metal server's primary network attachment cannot be deleted. func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) + response, err = vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -11696,6 +13344,7 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context. builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11713,10 +13362,16 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context. 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_bare_metal_server_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -11724,17 +13379,21 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context. // GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment // This request retrieves a single bare metal server network attachment specified by the identifier in the URL. func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) + result, response, err = vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -11748,6 +13407,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Con builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11766,17 +13426,21 @@ func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Con 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_bare_metal_server_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11790,17 +13454,21 @@ func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Con // network attachment patch object. The bare metal server network attachment patch object is structured in the same way // as a retrieved bare metal server network attachment and contains only the information to be updated. func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) + result, response, err = vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -11814,6 +13482,7 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11833,22 +13502,27 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) 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_bare_metal_server_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11867,17 +13541,21 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. // 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. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) + result, response, err = vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -11890,6 +13568,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11914,17 +13593,21 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co 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_bare_metal_server_network_interfaces", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11944,17 +13627,21 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co // 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 new network interfaces are not allowed to be created. func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) + result, response, err = vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -11967,6 +13654,7 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -11986,22 +13674,27 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) 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_bare_metal_server_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12019,17 +13712,21 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C // 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 is not allowed to be deleted. func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) + response, err = vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12043,6 +13740,7 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12060,10 +13758,16 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C 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_bare_metal_server_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -12075,17 +13779,21 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C // 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. func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) + result, response, err = vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12099,6 +13807,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12117,17 +13826,21 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont 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_bare_metal_server_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12145,17 +13858,21 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont // 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 is not allowed to be updated. func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) + result, response, err = vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12169,6 +13886,7 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12188,22 +13906,27 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) 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_bare_metal_server_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12215,17 +13938,21 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C // ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a bare metal server network interface // This request lists all floating IPs associated with a bare metal server network interface. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) + result, response, err = vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12239,6 +13966,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12257,17 +13985,21 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx 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_bare_metal_server_network_interface_floating_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12279,17 +14011,21 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx // RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface // This request disassociates the specified floating IP from the specified bare metal server network interface. func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) + response, err = vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12304,6 +14040,7 @@ func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12321,10 +14058,16 @@ func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx 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, "remove_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -12333,17 +14076,21 @@ func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx // This request retrieves a specified floating IP if it is associated with the bare metal server network interface // specified in the URL. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) + result, response, err = vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12358,6 +14105,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12376,17 +14124,21 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co 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_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12406,17 +14158,21 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co // // A request body is not required, and if provided, is ignored. func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) + result, response, err = vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12431,6 +14187,7 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12449,17 +14206,21 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co 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, "add_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12472,7 +14233,9 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co // This request lists the primary reserved IP for a bare metal server network interface. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) + result, response, err = vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter @@ -12481,10 +14244,12 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. core.GetLogger().Warn("A deprecated operation has been invoked: ListBareMetalServerNetworkInterfaceIps") err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12498,6 +14263,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12516,17 +14282,21 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. 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_bare_metal_server_network_interface_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12539,7 +14309,9 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. // This request retrieves the primary reserved IP for a bare metal server network interface. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) + result, response, err = vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter @@ -12548,10 +14320,12 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP") err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12566,6 +14340,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12584,17 +14359,21 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co 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_bare_metal_server_network_interface_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12607,17 +14386,21 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co // This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the // bare metal server network interfaces are implicitly disassociated. func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) + response, err = vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12630,6 +14413,7 @@ func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBa builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12647,10 +14431,16 @@ func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBa 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_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -12658,17 +14448,21 @@ func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBa // GetBareMetalServer : Retrieve a bare metal server // This request retrieves a single bare metal server specified by the identifier in the URL. func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) + result, response, err = vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12681,6 +14475,7 @@ func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMeta builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12699,17 +14494,21 @@ func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMeta 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_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12722,17 +14521,21 @@ func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMeta // This request updates a bare metal server with the information in a provided patch. The bare metal server patch object // is structured in the same way as a retrieved bare metal server and contains only the information to be updated. func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) + result, response, err = vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12745,6 +14548,7 @@ func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBa builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12764,22 +14568,27 @@ func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBa _, err = builder.SetBodyContentJSON(updateBareMetalServerOptions.BareMetalServerPatch) 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_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12793,17 +14602,21 @@ func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBa // any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be // current. func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) + result, response, err = vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12816,6 +14629,7 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12834,17 +14648,21 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex 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_bare_metal_server_initialization", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12856,17 +14674,21 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex // RestartBareMetalServer : Restart a bare metal server // This request restarts a bare metal server. It will run immediately regardless of the state of the server. func (vpc *VpcV1) RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.RestartBareMetalServerWithContext(context.Background(), restartBareMetalServerOptions) + response, err = vpc.RestartBareMetalServerWithContext(context.Background(), restartBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // RestartBareMetalServerWithContext is an alternate form of the RestartBareMetalServer method which supports a Context parameter func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(restartBareMetalServerOptions, "restartBareMetalServerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(restartBareMetalServerOptions, "restartBareMetalServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12879,6 +14701,7 @@ func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restart builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/restart`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12896,10 +14719,16 @@ func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restart 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, "restart_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -12907,17 +14736,21 @@ func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restart // StartBareMetalServer : Start a bare metal server // This request starts a bare metal server. It will run immediately provided the server is stopped. func (vpc *VpcV1) StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.StartBareMetalServerWithContext(context.Background(), startBareMetalServerOptions) + response, err = vpc.StartBareMetalServerWithContext(context.Background(), startBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // StartBareMetalServerWithContext is an alternate form of the StartBareMetalServer method which supports a Context parameter func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(startBareMetalServerOptions, "startBareMetalServerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(startBareMetalServerOptions, "startBareMetalServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12930,6 +14763,7 @@ func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBare builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/start`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -12947,10 +14781,16 @@ func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBare 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, "start_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -12959,17 +14799,21 @@ func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBare // This request stops a bare metal server. It will run immediately provided the server is running. Note: A soft stop may // not complete as it relies on the operating system to perform the operation. func (vpc *VpcV1) StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.StopBareMetalServerWithContext(context.Background(), stopBareMetalServerOptions) + response, err = vpc.StopBareMetalServerWithContext(context.Background(), stopBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // StopBareMetalServerWithContext is an alternate form of the StopBareMetalServer method which supports a Context parameter func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(stopBareMetalServerOptions, "stopBareMetalServerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(stopBareMetalServerOptions, "stopBareMetalServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -12982,6 +14826,7 @@ func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/stop`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13004,15 +14849,22 @@ func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMe } _, 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, "stop_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -13021,13 +14873,16 @@ func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMe // This request lists all [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available // in the region. A volume profile specifies the performance characteristics and pricing model for a volume. func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) + result, response, err = vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -13036,6 +14891,7 @@ func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13060,17 +14916,21 @@ func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeP 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_volume_profiles", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13082,17 +14942,21 @@ func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeP // GetVolumeProfile : Retrieve a volume profile // This request retrieves a single volume profile specified by the name in the URL. func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - return vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) + result, response, err = vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -13105,6 +14969,7 @@ func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProf builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13123,17 +14988,21 @@ func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProf 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_volume_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13146,13 +15015,16 @@ func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProf // This request lists all volumes in the region. Volumes are network-connected block storage devices that may be // attached to one or more instances in the same region. func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - return vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) + result, response, err = vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -13161,6 +15033,7 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13206,17 +15079,21 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions 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_volumes", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13229,17 +15106,21 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions // This request creates a new volume from a volume prototype object. The prototype object is structured in the same way // as a retrieved volume, and contains the information necessary to create the new volume. func (vpc *VpcV1) CreateVolume(createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - return vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions) + result, response, err = vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVolumeWithContext is an alternate form of the CreateVolume method which supports a Context parameter func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createVolumeOptions, "createVolumeOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -13248,6 +15129,7 @@ func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptio builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13267,22 +15149,27 @@ func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptio _, err = builder.SetBodyContentJSON(createVolumeOptions.VolumePrototype) 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_volume", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13295,17 +15182,21 @@ func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptio // This request deletes a volume. This operation cannot be reversed. For this request to succeed, the volume must not be // attached to any instances. func (vpc *VpcV1) DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions) + response, err = vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVolumeWithContext is an alternate form of the DeleteVolume method which supports a Context parameter func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVolumeOptions, "deleteVolumeOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -13318,6 +15209,7 @@ func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptio builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13338,10 +15230,16 @@ func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptio 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_volume", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -13349,17 +15247,21 @@ func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptio // GetVolume : Retrieve a volume // This request retrieves a single volume specified by the identifier in the URL. func (vpc *VpcV1) GetVolume(getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - return vpc.GetVolumeWithContext(context.Background(), getVolumeOptions) + result, response, err = vpc.GetVolumeWithContext(context.Background(), getVolumeOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVolumeWithContext is an alternate form of the GetVolume method which supports a Context parameter func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVolumeOptions, "getVolumeOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -13372,6 +15274,7 @@ func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *Ge builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13390,17 +15293,21 @@ func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *Ge 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_volume", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13413,17 +15320,21 @@ func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *Ge // This request updates a volume with the information in a provided volume patch. The volume patch object is structured // in the same way as a retrieved volume and contains only the information to be updated. func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - return vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) + result, response, err = vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -13436,6 +15347,7 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13458,22 +15370,27 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) 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_volume", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13486,13 +15403,16 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio // This request lists all snapshot consistency groups in the region. A snapshot consistency group is a collection of // individual snapshots taken at the same time. func (vpc *VpcV1) ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions) + result, response, err = vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListSnapshotConsistencyGroupsWithContext is an alternate form of the ListSnapshotConsistencyGroups method which supports a Context parameter func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listSnapshotConsistencyGroupsOptions, "listSnapshotConsistencyGroupsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -13501,6 +15421,7 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13537,17 +15458,21 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, 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_snapshot_consistency_groups", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroupCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13561,17 +15486,21 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, // is structured in the same way as a retrieved consistency group, and contains the information necessary to provision // the new snapshot consistency group. func (vpc *VpcV1) CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - return vpc.CreateSnapshotConsistencyGroupWithContext(context.Background(), createSnapshotConsistencyGroupOptions) + result, response, err = vpc.CreateSnapshotConsistencyGroupWithContext(context.Background(), createSnapshotConsistencyGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateSnapshotConsistencyGroupWithContext is an alternate form of the CreateSnapshotConsistencyGroup method which supports a Context parameter func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -13580,6 +15509,7 @@ func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13599,22 +15529,27 @@ func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, _, err = builder.SetBodyContentJSON(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) 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_snapshot_consistency_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13627,17 +15562,21 @@ func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, // This request deletes snapshot consistency group. This operation cannot be reversed. If the // `delete_snapshots_on_delete` property is `true`, all snapshots in the consistency group will also be deleted. func (vpc *VpcV1) DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotConsistencyGroupWithContext(context.Background(), deleteSnapshotConsistencyGroupOptions) + result, response, err = vpc.DeleteSnapshotConsistencyGroupWithContext(context.Background(), deleteSnapshotConsistencyGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteSnapshotConsistencyGroupWithContext is an alternate form of the DeleteSnapshotConsistencyGroup method which supports a Context parameter func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -13650,6 +15589,7 @@ func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13668,17 +15608,21 @@ func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, 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_snapshot_consistency_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13690,17 +15634,21 @@ func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, // GetSnapshotConsistencyGroup : Retrieve a snapshot consistency group // This request retrieves a single snapshot consistency group specified by the identifier in the URL. func (vpc *VpcV1) GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - return vpc.GetSnapshotConsistencyGroupWithContext(context.Background(), getSnapshotConsistencyGroupOptions) + result, response, err = vpc.GetSnapshotConsistencyGroupWithContext(context.Background(), getSnapshotConsistencyGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetSnapshotConsistencyGroupWithContext is an alternate form of the GetSnapshotConsistencyGroup method which supports a Context parameter func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -13713,6 +15661,7 @@ func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, ge builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13731,17 +15680,21 @@ func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, ge 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_snapshot_consistency_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13755,17 +15708,21 @@ func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, ge // patch. The snapshot consistency group patch object is structured in the same way as a retrieved snapshot consistency // group and contains only the information to be updated. func (vpc *VpcV1) UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - return vpc.UpdateSnapshotConsistencyGroupWithContext(context.Background(), updateSnapshotConsistencyGroupOptions) + result, response, err = vpc.UpdateSnapshotConsistencyGroupWithContext(context.Background(), updateSnapshotConsistencyGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateSnapshotConsistencyGroupWithContext is an alternate form of the UpdateSnapshotConsistencyGroup method which supports a Context parameter func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -13778,6 +15735,7 @@ func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13800,22 +15758,27 @@ func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, _, err = builder.SetBodyContentJSON(updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch) 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_snapshot_consistency_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13827,17 +15790,21 @@ func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, // DeleteSnapshots : Delete a filtered collection of snapshots // This request deletes all snapshots created from a specific source volume. func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) + response, err = vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -13846,6 +15813,7 @@ func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshot builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13864,10 +15832,16 @@ func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshot 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_snapshots", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -13876,13 +15850,16 @@ func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshot // This request lists all snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is // created. func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { - return vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) + result, response, err = vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -13891,6 +15868,7 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -13975,17 +15953,21 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt 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_snapshots", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13998,17 +15980,21 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt // This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same // way as a retrieved snapshot, and contains the information necessary to provision the new snapshot. func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - return vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) + result, response, err = vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14017,6 +16003,7 @@ func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14036,22 +16023,27 @@ func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotO _, err = builder.SetBodyContentJSON(createSnapshotOptions.SnapshotPrototype) 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_snapshot", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14063,17 +16055,21 @@ func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotO // DeleteSnapshot : Delete a snapshot // This request deletes a snapshot. This operation cannot be reversed. func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) + response, err = vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteSnapshotWithContext is an alternate form of the DeleteSnapshot method which supports a Context parameter func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteSnapshotOptions, "deleteSnapshotOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14086,6 +16082,7 @@ func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14106,10 +16103,16 @@ func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotO 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_snapshot", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -14117,17 +16120,21 @@ func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotO // GetSnapshot : Retrieve a snapshot // This request retrieves a single snapshot specified by the identifier in the URL. func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - return vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) + result, response, err = vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetSnapshotWithContext is an alternate form of the GetSnapshot method which supports a Context parameter func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getSnapshotOptions, "getSnapshotOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14140,6 +16147,7 @@ func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14158,17 +16166,21 @@ func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions 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_snapshot", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14181,17 +16193,21 @@ func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions // This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group // patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - return vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) + result, response, err = vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14204,6 +16220,7 @@ func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14226,22 +16243,27 @@ func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotO _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) 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_snapshot", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14253,17 +16275,21 @@ func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotO // ListSnapshotClones : List all clones for a snapshot // This request lists all clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - return vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) + result, response, err = vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14276,6 +16302,7 @@ func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapsho builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14294,17 +16321,21 @@ func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapsho 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_snapshot_clones", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14317,17 +16348,21 @@ func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapsho // This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated // from the snapshot. func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) + response, err = vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14341,6 +16376,7 @@ func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnap builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14358,10 +16394,16 @@ func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnap 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_snapshot_clone", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -14369,17 +16411,21 @@ func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnap // GetSnapshotClone : Retrieve a snapshot clone // This request retrieves a single clone specified by the snapshot identifier and zone name in the URL. func (vpc *VpcV1) GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - return vpc.GetSnapshotCloneWithContext(context.Background(), getSnapshotCloneOptions) + result, response, err = vpc.GetSnapshotCloneWithContext(context.Background(), getSnapshotCloneOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetSnapshotCloneWithContext is an alternate form of the GetSnapshotClone method which supports a Context parameter func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getSnapshotCloneOptions, "getSnapshotCloneOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSnapshotCloneOptions, "getSnapshotCloneOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14393,6 +16439,7 @@ func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCl builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14411,17 +16458,21 @@ func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCl 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_snapshot_clone", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14434,17 +16485,21 @@ func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCl // This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if // provided, is ignored. If the snapshot already has a clone in the zone, it is returned. func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - return vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) + result, response, err = vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14458,6 +16513,7 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14476,17 +16532,21 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap 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_snapshot_clone", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14500,13 +16560,16 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap // available in the region. A file share profile specifies the performance characteristics and pricing model for a file // share. func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) + result, response, err = vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14515,6 +16578,7 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14542,17 +16606,21 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro 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_share_profiles", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14564,17 +16632,21 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro // GetShareProfile : Retrieve a file share profile // This request retrieves a single file share profile specified by the name in the URL. func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { - return vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) + result, response, err = vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14587,6 +16659,7 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14605,17 +16678,21 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil 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_share_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14627,13 +16704,16 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil // ListShares : List all file shares // This request lists all file shares in the region. func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { - return vpc.ListSharesWithContext(context.Background(), listSharesOptions) + result, response, err = vpc.ListSharesWithContext(context.Background(), listSharesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listSharesOptions, "listSharesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14642,6 +16722,7 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14678,17 +16759,21 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * 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_shares", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14704,17 +16789,21 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * // The prototype object is structured in the same way as a retrieved share, and contains the information necessary to // provision the new file shares. func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.CreateShareWithContext(context.Background(), createShareOptions) + result, response, err = vpc.CreateShareWithContext(context.Background(), createShareOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createShareOptions, "createShareOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14723,6 +16812,7 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14742,22 +16832,27 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions _, err = builder.SetBodyContentJSON(createShareOptions.SharePrototype) 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_share", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14775,17 +16870,21 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions // If the request is accepted, the share `lifecycle_state` will be set to `deleting`. Once deletion processing // completes, it will no longer be retrievable. func (vpc *VpcV1) DeleteShare(deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.DeleteShareWithContext(context.Background(), deleteShareOptions) + result, response, err = vpc.DeleteShareWithContext(context.Background(), deleteShareOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteShareWithContext is an alternate form of the DeleteShare method which supports a Context parameter func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteShareOptions, "deleteShareOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteShareOptions, "deleteShareOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14798,6 +16897,7 @@ func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14819,17 +16919,21 @@ func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions 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_share", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14841,17 +16945,21 @@ func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions // GetShare : Retrieve a file share // This request retrieves a single file share specified by the identifier in the URL. func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.GetShareWithContext(context.Background(), getShareOptions) + result, response, err = vpc.GetShareWithContext(context.Background(), getShareOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getShareOptions, "getShareOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14864,6 +16972,7 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14882,17 +16991,21 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS 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_share", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14905,17 +17018,21 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS // This request updates a share with the information in a provided share patch. The share patch object is structured in // the same way as a retrieved share and contains only the information to be updated. func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.UpdateShareWithContext(context.Background(), updateShareOptions) + result, response, err = vpc.UpdateShareWithContext(context.Background(), updateShareOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateShareOptions, "updateShareOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -14928,6 +17045,7 @@ func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -14950,22 +17068,27 @@ func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) 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_share", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14982,17 +17105,21 @@ func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions // If `fallback_policy` is specified as `split`, and the request is accepted but the failover operation cannot be // performed, a split will be triggered. func (vpc *VpcV1) FailoverShare(failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { - return vpc.FailoverShareWithContext(context.Background(), failoverShareOptions) + response, err = vpc.FailoverShareWithContext(context.Background(), failoverShareOptions) + err = core.RepurposeSDKProblem(err, "") + return } // FailoverShareWithContext is an alternate form of the FailoverShare method which supports a Context parameter func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(failoverShareOptions, "failoverShareOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(failoverShareOptions, "failoverShareOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -15005,6 +17132,7 @@ func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/failover`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -15030,15 +17158,22 @@ func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOpt } _, 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, "failover_share", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -15050,17 +17185,21 @@ func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOpt // // The share mount targets will be sorted by their `created_at` property values, with newest targets first. func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - return vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) + result, response, err = vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -15073,6 +17212,7 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -15100,17 +17240,21 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar 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_share_mount_targets", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15125,17 +17269,21 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar // The prototype object is structured in the same way as a retrieved share mount target, and contains the information // necessary to provision the new file share mount target. func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) + result, response, err = vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -15148,6 +17296,7 @@ func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createS builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -15167,22 +17316,27 @@ func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createS _, err = builder.SetBodyContentJSON(createShareMountTargetOptions.ShareMountTargetPrototype) 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_share_mount_target", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15197,17 +17351,21 @@ func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createS // If the request is accepted, the share mount target `lifecycle_state` will be set to // `deleting`. Once deletion processing completes, it will no longer be retrievable. func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) + result, response, err = vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -15221,6 +17379,7 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -15239,17 +17398,21 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS 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_share_mount_target", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15261,17 +17424,21 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS // GetShareMountTarget : Retrieve a share mount target // This request retrieves a single share mount target specified by the identifier in the URL. func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) + result, response, err = vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -15285,6 +17452,7 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -15303,17 +17471,21 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo 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_share_mount_target", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15327,17 +17499,21 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo // share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain // only the information to be updated. func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) + result, response, err = vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -15351,6 +17527,7 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -15370,22 +17547,27 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS _, err = builder.SetBodyContentJSON(updateShareMountTargetOptions.ShareMountTargetPatch) 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_share_mount_target", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15401,17 +17583,21 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS // // This operation cannot be reversed. func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) + response, err = vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -15424,6 +17610,7 @@ func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareS builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -15441,10 +17628,16 @@ func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareS 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_share_source", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -15453,17 +17646,21 @@ func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareS // This request retrieves the source file share associated with the replica file share specified by the identifier in // the URL. func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { - return vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) + result, response, err = vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -15476,6 +17673,7 @@ func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -15494,17 +17692,1003 @@ func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceO 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_share_source", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// ListBackupPolicies : List all backup policies +// This request lists all backup policies in the region. Backup policies control which sources are selected for backup +// and include a set of backup policy plans that provide the backup schedules and deletion triggers. +func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter +func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") + 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, `/backup_policies`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listBackupPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") + 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 listBackupPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) + } + if listBackupPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) + } + if listBackupPoliciesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) + } + if listBackupPoliciesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) + } + if listBackupPoliciesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) + } + + 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_backup_policies", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// CreateBackupPolicy : Create a backup policy +// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in +// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. +func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") + 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, `/backup_policies`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range createBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") + 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(createBackupPolicyOptions.BackupPolicyPrototype) + 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_backup_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// ListBackupPolicyJobs : List all jobs for a backup policy +// This request retrieves all jobs for a backup policy. A backup job represents the execution of a backup policy plan +// for a resource matching the policy's criteria. +func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") + 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 listBackupPolicyJobsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) + } + if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) + } + if listBackupPolicyJobsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) + } + if listBackupPolicyJobsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) + } + if listBackupPolicyJobsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) + } + if listBackupPolicyJobsOptions.SourceID != nil { + builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { + builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { + builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) + } + + 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_backup_policy_jobs", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// GetBackupPolicyJob : Retrieve a backup policy job +// This request retrieves a single backup policy job specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, + "id": *getBackupPolicyJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getBackupPolicyJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") + 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_backup_policy_job", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// ListBackupPolicyPlans : List all plans for a backup policy +// This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. +func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") + 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 listBackupPolicyPlansOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) + } + + 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_backup_policy_plans", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// CreateBackupPolicyPlan : Create a plan for a backup policy +// This request creates a new backup policy plan from a backup policy plan prototype object. The prototype object is +// structured in the same way as a retrieved backup policy plan, and contains the information necessary to create the +// new backup policy plan. +// +// Backups created by this plan will use the resource group of the source being backed up. +// +// Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character +// suffix. +func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// CreateBackupPolicyPlanWithContext is an alternate form of the CreateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") + 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 createBackupPolicyPlanOptions.CronSpec != nil { + body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec + } + if createBackupPolicyPlanOptions.Active != nil { + body["active"] = createBackupPolicyPlanOptions.Active + } + if createBackupPolicyPlanOptions.AttachUserTags != nil { + body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags + } + if createBackupPolicyPlanOptions.ClonePolicy != nil { + body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy + } + if createBackupPolicyPlanOptions.CopyUserTags != nil { + body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags + } + if createBackupPolicyPlanOptions.DeletionTrigger != nil { + body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger + } + if createBackupPolicyPlanOptions.Name != nil { + body["name"] = createBackupPolicyPlanOptions.Name + } + if createBackupPolicyPlanOptions.RemoteRegionPolicies != nil { + body["remote_region_policies"] = createBackupPolicyPlanOptions.RemoteRegionPolicies + } + _, 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_backup_policy_plan", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// DeleteBackupPolicyPlan : Delete a backup policy plan +// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by +// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with +// the plan will run to completion before the plan is deleted. +// +// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing +// completes, the backup policy plan will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, + "id": *deleteBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + if deleteBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) + } + + 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_backup_policy_plan", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// GetBackupPolicyPlan : Retrieve a backup policy plan +// This request retrieves a single backup policy plan specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, + "id": *getBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") + 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_backup_policy_plan", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// UpdateBackupPolicyPlan : Update a backup policy plan +// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is +// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, + "id": *updateBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) + 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_backup_policy_plan", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// DeleteBackupPolicy : Delete a backup policy +// This request deletes a backup policy. This operation cannot be reversed. +// +// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, +// the backup policy will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *deleteBackupPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deleteBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + if deleteBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) + } + + 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_backup_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// GetBackupPolicy : Retrieve a backup policy +// This request retrieves a single backup policy specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *getBackupPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") + 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_backup_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// UpdateBackupPolicy : Update a backup policy +// This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch +// object is structured in the same way as a retrieved backup policy and contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *updateBackupPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range updateBackupPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) + 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_backup_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16391,13 +19575,16 @@ func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBacku // available. Resources deployed within a single region also benefit from the low latency afforded by geographic // proximity. func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { - return vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) + result, response, err = vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16406,6 +19593,7 @@ func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16424,17 +19612,21 @@ func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions 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_regions", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16446,17 +19638,21 @@ func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions // GetRegion : Retrieve a region // This request retrieves a single region specified by the name in the URL. func (vpc *VpcV1) GetRegion(getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { - return vpc.GetRegionWithContext(context.Background(), getRegionOptions) + result, response, err = vpc.GetRegionWithContext(context.Background(), getRegionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetRegionWithContext is an alternate form of the GetRegion method which supports a Context parameter func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getRegionOptions, "getRegionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getRegionOptions, "getRegionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16469,6 +19665,7 @@ func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *Ge builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16487,17 +19684,21 @@ func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *Ge 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_region", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegion) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16510,17 +19711,21 @@ func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *Ge // This request lists all zones in a region. Zones represent logically-isolated data centers with high-bandwidth and // low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. func (vpc *VpcV1) ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { - return vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) + result, response, err = vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListRegionZonesWithContext is an alternate form of the ListRegionZones method which supports a Context parameter func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listRegionZonesOptions, "listRegionZonesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listRegionZonesOptions, "listRegionZonesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16533,6 +19738,7 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16551,17 +19757,21 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone 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_region_zones", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16573,17 +19783,21 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone // GetRegionZone : Retrieve a zone // This request retrieves a single zone specified by the region and zone names in the URL. func (vpc *VpcV1) GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { - return vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) + result, response, err = vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetRegionZoneWithContext is an alternate form of the GetRegionZone method which supports a Context parameter func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getRegionZoneOptions, "getRegionZoneOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16597,6 +19811,7 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16615,17 +19830,21 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt 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_region_zone", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16642,13 +19861,16 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt // interfaces first. Virtual network interfaces with identical // `created_at` property values will in turn be sorted by ascending `name` property values. func (vpc *VpcV1) ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - return vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) + result, response, err = vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVirtualNetworkInterfacesWithContext is an alternate form of the ListVirtualNetworkInterfaces method which supports a Context parameter func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listVirtualNetworkInterfacesOptions, "listVirtualNetworkInterfacesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16657,6 +19879,7 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16684,17 +19907,21 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l 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_virtual_network_interfaces", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterfaceCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16708,17 +19935,21 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l // object is structured in the same way as a retrieved virtual network interface, and contains the information necessary // to create the new virtual network interface. func (vpc *VpcV1) CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - return vpc.CreateVirtualNetworkInterfaceWithContext(context.Background(), createVirtualNetworkInterfaceOptions) + result, response, err = vpc.CreateVirtualNetworkInterfaceWithContext(context.Background(), createVirtualNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVirtualNetworkInterfaceWithContext is an alternate form of the CreateVirtualNetworkInterface method which supports a Context parameter func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16727,6 +19958,7 @@ func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16774,22 +20006,27 @@ func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, } _, 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_virtual_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16803,17 +20040,21 @@ func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, // virtual network interface must not be required by another resource, such as the primary network attachment for an // instance. func (vpc *VpcV1) DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) + response, err = vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVirtualNetworkInterfacesWithContext is an alternate form of the DeleteVirtualNetworkInterfaces method which supports a Context parameter func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16826,6 +20067,7 @@ func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16843,10 +20085,16 @@ func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, 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_virtual_network_interfaces", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -16854,17 +20102,21 @@ func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, // GetVirtualNetworkInterface : Retrieve a virtual network interface // This request retrieves a single virtual network interface specified by the identifier in the URL. func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - return vpc.GetVirtualNetworkInterfaceWithContext(context.Background(), getVirtualNetworkInterfaceOptions) + result, response, err = vpc.GetVirtualNetworkInterfaceWithContext(context.Background(), getVirtualNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVirtualNetworkInterfaceWithContext is an alternate form of the GetVirtualNetworkInterface method which supports a Context parameter func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16877,6 +20129,7 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, get builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16895,17 +20148,21 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, get 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_virtual_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16919,17 +20176,21 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, get // The virtual network interface patch object is structured in the same way as a retrieved virtual network interface and // contains only the information to be updated. func (vpc *VpcV1) UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - return vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) + result, response, err = vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVirtualNetworkInterfaceWithContext is an alternate form of the UpdateVirtualNetworkInterface method which supports a Context parameter func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16942,6 +20203,7 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16961,22 +20223,27 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, _, err = builder.SetBodyContentJSON(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) 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_virtual_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16988,17 +20255,21 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, // ListNetworkInterfaceFloatingIps : List all floating IPs associated with a virtual network interface // This request lists all floating IPs associated with a virtual network interface. func (vpc *VpcV1) ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) + result, response, err = vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListNetworkInterfaceFloatingIps method which supports a Context parameter func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17011,6 +20282,7 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17038,17 +20310,21 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context 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_network_interface_floating_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17060,17 +20336,21 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context // RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface // This request disassociates the specified floating IP from the specified virtual network interface. func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) + response, err = vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // RemoveNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17084,6 +20364,7 @@ func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17101,10 +20382,16 @@ func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Contex 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, "remove_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -17113,17 +20400,21 @@ func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Contex // This request retrieves a specified floating IP if it is associated with the virtual network interface specified in // the URL. func (vpc *VpcV1) GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - return vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) + result, response, err = vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17137,6 +20428,7 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17155,17 +20447,21 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, 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_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17192,17 +20488,21 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, // // A request body is not required, and if provided, is ignored. func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - return vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) + result, response, err = vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17216,6 +20516,7 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17234,17 +20535,21 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, 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, "add_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17256,17 +20561,21 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, // ListVirtualNetworkInterfaceIps : List all reserved IPs bound to a virtual network interface // This request lists all reserved IPs bound to a virtual network interface. func (vpc *VpcV1) ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) + result, response, err = vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVirtualNetworkInterfaceIpsWithContext is an alternate form of the ListVirtualNetworkInterfaceIps method which supports a Context parameter func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17279,6 +20588,7 @@ func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17306,17 +20616,21 @@ func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, 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_virtual_network_interface_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17331,17 +20645,21 @@ func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, // // The reserved IP for the `primary_ip` cannot be unbound. func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveVirtualNetworkInterfaceIPWithContext(context.Background(), removeVirtualNetworkInterfaceIPOptions) + response, err = vpc.RemoveVirtualNetworkInterfaceIPWithContext(context.Background(), removeVirtualNetworkInterfaceIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // RemoveVirtualNetworkInterfaceIPWithContext is an alternate form of the RemoveVirtualNetworkInterfaceIP method which supports a Context parameter func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context, removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17355,6 +20673,7 @@ func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17372,10 +20691,16 @@ func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context 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, "remove_virtual_network_interface_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -17384,17 +20709,21 @@ func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context // This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in // the URL. func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - return vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) + result, response, err = vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17408,6 +20737,7 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, g builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17426,17 +20756,21 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, g 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_virtual_network_interface_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17451,17 +20785,21 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, g // The reserved IP must currently be unbound and in the primary IP's subnet. The virtual network interface's `target` // must not currently be a file share mount target. func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - return vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) + result, response, err = vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // AddVirtualNetworkInterfaceIPWithContext is an alternate form of the AddVirtualNetworkInterfaceIP method which supports a Context parameter func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17475,6 +20813,7 @@ func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, a builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17493,17 +20832,21 @@ func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, a 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, "add_virtual_network_interface_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17517,13 +20860,16 @@ func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, 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) { - return vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) + result, response, err = vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17532,6 +20878,7 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17559,17 +20906,21 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG 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_public_gateways", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17586,17 +20937,21 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG // 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) { - return vpc.CreatePublicGatewayWithContext(context.Background(), createPublicGatewayOptions) + result, response, err = vpc.CreatePublicGatewayWithContext(context.Background(), createPublicGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17605,6 +20960,7 @@ func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPubl builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17640,22 +20996,27 @@ func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPubl } _, 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_public_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17669,17 +21030,21 @@ func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPubl // 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) { - return vpc.DeletePublicGatewayWithContext(context.Background(), deletePublicGatewayOptions) + response, err = vpc.DeletePublicGatewayWithContext(context.Background(), deletePublicGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deletePublicGatewayOptions, "deletePublicGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17692,6 +21057,7 @@ func (vpc *VpcV1) DeletePublicGatewayWithContext(ctx context.Context, deletePubl builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17709,10 +21075,16 @@ func (vpc *VpcV1) DeletePublicGatewayWithContext(ctx context.Context, deletePubl 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_public_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -17720,17 +21092,21 @@ func (vpc *VpcV1) DeletePublicGatewayWithContext(ctx context.Context, deletePubl // 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) { - return vpc.GetPublicGatewayWithContext(context.Background(), getPublicGatewayOptions) + result, response, err = vpc.GetPublicGatewayWithContext(context.Background(), getPublicGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getPublicGatewayOptions, "getPublicGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17743,6 +21119,7 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17761,17 +21138,21 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate 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_public_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17783,17 +21164,21 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate // 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) { - return vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) + result, response, err = vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17806,6 +21191,7 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17825,22 +21211,27 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) 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_public_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17853,13 +21244,16 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl // This request lists all 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) { - return vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) + result, response, err = vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17868,6 +21262,7 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17910,17 +21305,21 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp 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_floating_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17932,17 +21331,21 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp // 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) { - return vpc.CreateFloatingIPWithContext(context.Background(), createFloatingIPOptions) + result, response, err = vpc.CreateFloatingIPWithContext(context.Background(), createFloatingIPOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createFloatingIPOptions, "createFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17951,6 +21354,7 @@ func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatin builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17970,22 +21374,27 @@ func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatin _, 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()) return } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + 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, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17998,17 +21407,21 @@ func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatin // 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) { - return vpc.DeleteFloatingIPWithContext(context.Background(), deleteFloatingIPOptions) + response, err = vpc.DeleteFloatingIPWithContext(context.Background(), deleteFloatingIPOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteFloatingIPOptions, "deleteFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18021,6 +21434,7 @@ func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatin builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18038,10 +21452,16 @@ func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatin 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_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -18049,17 +21469,21 @@ func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatin // 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) { - return vpc.GetFloatingIPWithContext(context.Background(), getFloatingIPOptions) + result, response, err = vpc.GetFloatingIPWithContext(context.Background(), getFloatingIPOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getFloatingIPOptions, "getFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18072,6 +21496,7 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18090,17 +21515,21 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt 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_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18112,17 +21541,21 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt // 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) { - return vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) + result, response, err = vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18135,6 +21568,7 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18154,22 +21588,27 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin _, err = builder.SetBodyContentJSON(updateFloatingIPOptions.FloatingIPPatch) 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_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18183,13 +21622,16 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin // 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) { - return vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) + result, response, err = vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18198,6 +21640,7 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18225,17 +21668,21 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl 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_network_acls", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18249,17 +21696,21 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl // 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) { - return vpc.CreateNetworkACLWithContext(context.Background(), createNetworkACLOptions) + result, response, err = vpc.CreateNetworkACLWithContext(context.Background(), createNetworkACLOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18268,6 +21719,7 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18287,22 +21739,27 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork _, 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 } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + 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 @@ -18315,17 +21772,21 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork // 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) { - return vpc.DeleteNetworkACLWithContext(context.Background(), deleteNetworkACLOptions) + response, err = vpc.DeleteNetworkACLWithContext(context.Background(), deleteNetworkACLOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteNetworkACLOptions, "deleteNetworkACLOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18338,6 +21799,7 @@ func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetwork builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18355,10 +21817,16 @@ func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetwork 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_network_acl", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -18366,17 +21834,21 @@ func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetwork // 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) { - return vpc.GetNetworkACLWithContext(context.Background(), getNetworkACLOptions) + result, response, err = vpc.GetNetworkACLWithContext(context.Background(), getNetworkACLOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getNetworkACLOptions, "getNetworkACLOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18389,6 +21861,7 @@ func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18407,17 +21880,21 @@ func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOpt 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_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 @@ -18429,17 +21906,21 @@ func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOpt // 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) { - return vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) + result, response, err = vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) + 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") 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 } @@ -18452,6 +21933,7 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18471,22 +21953,27 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) 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_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 @@ -18499,17 +21986,21 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork // This request lists all 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) { - return vpc.ListNetworkACLRulesWithContext(context.Background(), listNetworkACLRulesOptions) + result, response, err = vpc.ListNetworkACLRulesWithContext(context.Background(), listNetworkACLRulesOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listNetworkACLRulesOptions, "listNetworkACLRulesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18522,6 +22013,7 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -18549,17 +22041,21 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor 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_network_acl_rules", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRuleCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18572,17 +22068,21 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor // 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) { - return vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) + result, response, err = vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18595,6 +22095,7 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -18614,22 +22115,27 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet _, 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 } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + 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 @@ -18641,17 +22147,21 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet // 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) { - return vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) + response, err = vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18665,6 +22175,7 @@ func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNet builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -18682,10 +22193,16 @@ func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNet 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_network_acl_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -18693,17 +22210,21 @@ func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNet // 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) { - return vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) + result, response, err = vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18717,6 +22238,7 @@ func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkAC builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -18735,17 +22257,21 @@ func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkAC 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_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 @@ -18758,17 +22284,21 @@ func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkAC // 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 information is not applicable to the rule's protocol. func (vpc *VpcV1) UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateNetworkACLRuleWithContext(context.Background(), updateNetworkACLRuleOptions) + result, response, err = vpc.UpdateNetworkACLRuleWithContext(context.Background(), updateNetworkACLRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18782,6 +22312,7 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -18801,22 +22332,27 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet _, err = builder.SetBodyContentJSON(updateNetworkACLRuleOptions.NetworkACLRulePatch) 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_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 @@ -18831,13 +22367,16 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet // 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) { - return vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) + result, response, err = vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18846,6 +22385,7 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18882,17 +22422,21 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit 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_security_groups", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18907,17 +22451,21 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit // 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) { - return vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions) + result, response, err = vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createSecurityGroupOptions, "createSecurityGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18926,6 +22474,7 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18958,22 +22507,27 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu } _, 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_security_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18986,17 +22540,21 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu // 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) { - return vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) + response, err = vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19009,6 +22567,7 @@ func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecu builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19026,10 +22585,16 @@ func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecu 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_security_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -19037,17 +22602,21 @@ func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecu // 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) { - return vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) + result, response, err = vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19060,6 +22629,7 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19078,17 +22648,21 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr 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_security_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19102,17 +22676,21 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr // 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) { - return vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) + result, response, err = vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19125,6 +22703,7 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19144,22 +22723,27 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu _, err = builder.SetBodyContentJSON(updateSecurityGroupOptions.SecurityGroupPatch) 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_security_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19173,17 +22757,21 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu // 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) { - return vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) + result, response, err = vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19196,6 +22784,7 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19214,17 +22803,21 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec 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_security_group_rules", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19241,17 +22834,21 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec // 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) { - return vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) + result, response, err = vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19264,6 +22861,7 @@ func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, create builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19283,22 +22881,27 @@ func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, create _, err = builder.SetBodyContentJSON(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) 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_security_group_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19311,17 +22914,21 @@ func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, create // 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) { - return vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) + response, err = vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19335,6 +22942,7 @@ func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, delete builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19352,10 +22960,16 @@ func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, delete 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_security_group_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -19363,17 +22977,21 @@ func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, delete // 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) { - return vpc.GetSecurityGroupRuleWithContext(context.Background(), getSecurityGroupRuleOptions) + result, response, err = vpc.GetSecurityGroupRuleWithContext(context.Background(), getSecurityGroupRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19387,6 +23005,7 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19405,17 +23024,21 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri 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_security_group_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19429,17 +23052,21 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri // object contains only the information to be updated. The request will fail if the information is not applicable to the // rule's protocol. func (vpc *VpcV1) UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) + result, response, err = vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19453,6 +23080,7 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19472,22 +23100,27 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update _, err = builder.SetBodyContentJSON(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) 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_security_group_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19500,17 +23133,21 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update // This request lists all 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) { - return vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) + result, response, err = vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19523,6 +23160,7 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19547,17 +23185,21 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS 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_security_group_targets", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19580,17 +23222,21 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS // 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) { - return vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) + response, err = vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19604,6 +23250,7 @@ func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19621,10 +23268,16 @@ func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Contex 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_security_group_target_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -19633,17 +23286,21 @@ func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Contex // 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) { - return vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) + result, response, err = vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19657,6 +23314,7 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19675,17 +23333,21 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu 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_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 @@ -19707,17 +23369,21 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu // 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) { - return vpc.CreateSecurityGroupTargetBindingWithContext(context.Background(), createSecurityGroupTargetBindingOptions) + 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(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19731,6 +23397,7 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19749,17 +23416,21 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex 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_security_group_target_binding", 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 @@ -19771,13 +23442,16 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex // ListIkePolicies : List all IKE policies // This request lists all IKE policies in the region. func (vpc *VpcV1) ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) + result, response, err = vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19786,6 +23460,7 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19810,17 +23485,21 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie 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_ike_policies", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19832,17 +23511,21 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie // 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) { - return vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) + result, response, err = vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19851,6 +23534,7 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19892,22 +23576,27 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic } _, 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_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 @@ -19920,17 +23609,21 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic // 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) { - return vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) + response, err = vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19943,6 +23636,7 @@ func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolic builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19960,10 +23654,16 @@ func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolic 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_ike_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -19971,17 +23671,21 @@ func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolic // 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) { - return vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) + result, response, err = vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19994,6 +23698,7 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20012,17 +23717,21 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio 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_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 @@ -20034,17 +23743,21 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio // 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) { - return vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) + result, response, err = vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20057,6 +23770,7 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20076,22 +23790,27 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic _, 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 } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + 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 @@ -20103,17 +23822,21 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic // ListIkePolicyConnections : List all VPN gateway connections that use a specified IKE policy // This request lists all VPN gateway connections that use a policy. func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) + result, response, err = vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) + 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 *VPNGatewayConnectionCollection, 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(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20126,6 +23849,7 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -20144,17 +23868,21 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI 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_ike_policy_connections", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -20166,13 +23894,16 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI // ListIpsecPolicies : List all IPsec policies // This request lists all IPsec policies in the region. func (vpc *VpcV1) ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) + result, response, err = vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20181,6 +23912,7 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20205,17 +23937,21 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol 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_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 @@ -20227,17 +23963,21 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol // 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) { - return vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) + result, response, err = vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20246,6 +23986,7 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20284,22 +24025,27 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP } _, 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_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 @@ -20312,17 +24058,21 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP // 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) { - return vpc.DeleteIpsecPolicyWithContext(context.Background(), deleteIpsecPolicyOptions) + response, err = vpc.DeleteIpsecPolicyWithContext(context.Background(), deleteIpsecPolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20335,6 +24085,7 @@ func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20352,10 +24103,16 @@ func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecP 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_ipsec_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -20363,17 +24120,21 @@ func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecP // 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) { - return vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) + result, response, err = vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) + 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") 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 } @@ -20386,6 +24147,7 @@ func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20404,17 +24166,21 @@ func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyO 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_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 @@ -20426,17 +24192,21 @@ func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyO // 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) { - return vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) + result, response, err = vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20449,6 +24219,7 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20468,22 +24239,27 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) 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_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 @@ -20495,17 +24271,21 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP // ListIpsecPolicyConnections : List all VPN gateway connections that use a specified IPsec policy // This request lists all VPN gateway connections that use a policy. func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) + result, response, err = vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) + 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 *VPNGatewayConnectionCollection, 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(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20518,6 +24298,7 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis 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 } @@ -20536,17 +24317,21 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis 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, UnmarshalVPNGatewayConnectionCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -20558,13 +24343,16 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis // ListVPNGateways : List all VPN gateways // This request lists all VPN gateways in the region. func (vpc *VpcV1) ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewaysWithContext(context.Background(), listVPNGatewaysOptions) + 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 } @@ -20573,6 +24361,7 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20606,17 +24395,21 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway 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_vpn_gateways", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -20628,17 +24421,21 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway // 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) { - return vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) + result, response, err = vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20647,6 +24444,7 @@ func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGate builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20666,22 +24464,27 @@ func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGate _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) 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_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 @@ -20695,17 +24498,21 @@ func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGate // 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) { - return vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) + response, err = vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20718,6 +24525,7 @@ func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGate builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20735,10 +24543,16 @@ func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGate 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_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -20746,17 +24560,21 @@ func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGate // 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) { - return vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) + result, response, err = vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20769,6 +24587,7 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20787,17 +24606,21 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt 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_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 @@ -20809,17 +24632,21 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt // 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) { - return vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) + result, response, err = vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20832,6 +24659,7 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20851,22 +24679,27 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate _, 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 } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + 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 @@ -20878,17 +24711,21 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate // ListVPNGatewayConnections : List all connections of a VPN gateway // This request lists all connections of a VPN gateway. func (vpc *VpcV1) ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) + result, response, err = vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20901,6 +24738,7 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -20922,17 +24760,21 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list 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_vpn_gateway_connections", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -20944,17 +24786,21 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list // 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) { - return vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) + result, response, err = vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20967,6 +24813,7 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -20986,22 +24833,27 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre _, 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) if err != nil { + 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 @@ -21014,17 +24866,21 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre // 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) { - return vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) + response, err = vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21038,6 +24894,7 @@ func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, del builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -21055,10 +24912,16 @@ func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, del 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_gateway_connection", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -21066,17 +24929,21 @@ func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, del // 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) { - return vpc.GetVPNGatewayConnectionWithContext(context.Background(), getVPNGatewayConnectionOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21090,6 +24957,7 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -21108,17 +24976,21 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN 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_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 @@ -21130,17 +25002,21 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN // 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) { - return vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) + result, response, err = vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21154,6 +25030,7 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -21173,22 +25050,27 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) 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_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 @@ -21202,17 +25084,21 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionLocalCIDRsOptions) + result, response, err = vpc.ListVPNGatewayConnectionLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionLocalCIDRsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVPNGatewayConnectionLocalCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionLocalCIDRs method which supports a Context parameter func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21226,6 +25112,7 @@ func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Cont builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -21244,17 +25131,21 @@ func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Cont 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_vpn_gateway_connection_local_cidrs", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionLocalCIDRs) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -21268,17 +25159,21 @@ func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Cont // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveVPNGatewayConnectionLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionLocalCIDROptions) + response, err = vpc.RemoveVPNGatewayConnectionLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionLocalCIDROptions) + err = core.RepurposeSDKProblem(err, "") + return } // RemoveVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionLocalCIDR method which supports a Context parameter func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21294,6 +25189,7 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Con builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21311,10 +25207,16 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Con 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, "remove_vpn_gateway_connection_local_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -21324,17 +25226,21 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Con // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.CheckVPNGatewayConnectionLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionLocalCIDROptions) + response, err = vpc.CheckVPNGatewayConnectionLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionLocalCIDROptions) + err = core.RepurposeSDKProblem(err, "") + return } // CheckVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionLocalCIDR method which supports a Context parameter func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21350,6 +25256,7 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Cont builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21367,10 +25274,16 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Cont 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, "check_vpn_gateway_connection_local_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -21381,17 +25294,21 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Cont // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.AddVPNGatewayConnectionLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionLocalCIDROptions) + response, err = vpc.AddVPNGatewayConnectionLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionLocalCIDROptions) + err = core.RepurposeSDKProblem(err, "") + return } // AddVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the AddVPNGatewayConnectionLocalCIDR method which supports a Context parameter func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21407,6 +25324,7 @@ func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21424,10 +25342,16 @@ func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Contex 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, "add_vpn_gateway_connection_local_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -21437,17 +25361,21 @@ func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Contex // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionPeerCIDRsOptions) + result, response, err = vpc.ListVPNGatewayConnectionPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionPeerCIDRsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVPNGatewayConnectionPeerCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionPeerCIDRs method which supports a Context parameter func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21461,6 +25389,7 @@ func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Conte builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -21479,17 +25408,21 @@ func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Conte 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_vpn_gateway_connection_peer_cidrs", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionPeerCIDRs) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -21503,17 +25436,21 @@ func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Conte // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveVPNGatewayConnectionPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionPeerCIDROptions) + response, err = vpc.RemoveVPNGatewayConnectionPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionPeerCIDROptions) + err = core.RepurposeSDKProblem(err, "") + return } // RemoveVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionPeerCIDR method which supports a Context parameter func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21529,6 +25466,7 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Cont builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21546,10 +25484,16 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Cont 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, "remove_vpn_gateway_connection_peer_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -21559,17 +25503,21 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Cont // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.CheckVPNGatewayConnectionPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionPeerCIDROptions) + response, err = vpc.CheckVPNGatewayConnectionPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionPeerCIDROptions) + err = core.RepurposeSDKProblem(err, "") + return } // CheckVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionPeerCIDR method which supports a Context parameter func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21585,6 +25533,7 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Conte builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21602,10 +25551,16 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Conte 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, "check_vpn_gateway_connection_peer_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -21616,17 +25571,21 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Conte // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.AddVPNGatewayConnectionPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionPeerCIDROptions) + response, err = vpc.AddVPNGatewayConnectionPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionPeerCIDROptions) + err = core.RepurposeSDKProblem(err, "") + return } // AddVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the AddVPNGatewayConnectionPeerCIDR method which supports a Context parameter func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21642,6 +25601,7 @@ func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21659,10 +25619,16 @@ func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context 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, "add_vpn_gateway_connection_peer_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -21670,13 +25636,16 @@ func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context // ListVPNServers : List all VPN servers // This request lists all VPN servers. func (vpc *VpcV1) ListVPNServers(listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) + result, response, err = vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21685,6 +25654,7 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21718,17 +25688,21 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO 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_vpn_servers", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -21740,17 +25714,21 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO // 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) { - return vpc.CreateVPNServerWithContext(context.Background(), createVPNServerOptions) + result, response, err = vpc.CreateVPNServerWithContext(context.Background(), createVPNServerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21759,6 +25737,7 @@ func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21815,22 +25794,27 @@ func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServe } _, 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_vpn_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -21842,17 +25826,21 @@ func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServe // 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) { - return vpc.DeleteVPNServerWithContext(context.Background(), deleteVPNServerOptions) + response, err = vpc.DeleteVPNServerWithContext(context.Background(), deleteVPNServerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21865,6 +25853,7 @@ func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21885,10 +25874,16 @@ func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServe 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", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -21896,17 +25891,21 @@ func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServe // 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) { - return vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) + result, response, err = vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21919,6 +25918,7 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21937,17 +25937,21 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio 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_vpn_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -21960,17 +25964,21 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio // This request updates the properties of an existing VPN server. Any property changes will cause all connected VPN // clients are disconnected from this VPN server except for the name change. func (vpc *VpcV1) UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - return vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) + result, response, err = vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21983,6 +25991,7 @@ func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -22005,22 +26014,27 @@ func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServe _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) 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_vpn_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22033,17 +26047,21 @@ func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServe // 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) { - return vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) + result, response, err = vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22056,6 +26074,7 @@ func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22074,10 +26093,16 @@ func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } response, err = vpc.Service.Request(request, &result) + if err != nil { + core.EnrichHTTPProblem(err, "get_vpn_server_client_configuration", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -22086,17 +26111,21 @@ func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context // This request retrieves all 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) { - return vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) + result, response, err = vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22109,6 +26138,7 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22136,17 +26166,21 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe 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_vpn_server_clients", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22160,17 +26194,21 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe // 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) { - return vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) + response, err = vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22184,6 +26222,7 @@ func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22201,10 +26240,16 @@ func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVP 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_client", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -22212,17 +26257,21 @@ func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVP // 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) { - return vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) + result, response, err = vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22236,6 +26285,7 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22254,17 +26304,21 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe 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_vpn_server_client", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22278,17 +26332,21 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe // 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) { - return vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) + response, err = vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22302,6 +26360,7 @@ func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnect builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22319,10 +26378,16 @@ func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnect 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, "disconnect_vpn_client", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -22332,17 +26397,21 @@ func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnect // 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) { - return vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) + result, response, err = vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22355,6 +26424,7 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22382,17 +26452,21 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer 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_vpn_server_routes", 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 @@ -22407,17 +26481,21 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer // route matching their specified destinations. All VPN routes must be unique within the VPN server. destination of the // packet. func (vpc *VpcV1) CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - return vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) + result, response, err = vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22430,6 +26508,7 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22459,22 +26538,27 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN } _, 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_vpn_server_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22486,17 +26570,21 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN // 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) { - return vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) + response, err = vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22510,6 +26598,7 @@ func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPN builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22527,10 +26616,16 @@ func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPN 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 } @@ -22538,17 +26633,21 @@ func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPN // 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) { - return vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions) + 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 } @@ -22562,6 +26661,7 @@ func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServer builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22580,17 +26680,21 @@ func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServer 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_vpn_server_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22603,17 +26707,21 @@ func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServer // 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) { - return vpc.UpdateVPNServerRouteWithContext(context.Background(), updateVPNServerRouteOptions) + result, response, err = vpc.UpdateVPNServerRouteWithContext(context.Background(), updateVPNServerRouteOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22627,6 +26735,7 @@ func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPN builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22646,22 +26755,27 @@ func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPN _, 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()) return } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + 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, UnmarshalVPNServerRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22674,13 +26788,16 @@ func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPN // This request lists all 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) { - return vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) + result, response, err = vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22689,6 +26806,7 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL 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 } @@ -22713,17 +26831,21 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL 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 @@ -22735,17 +26857,21 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL // 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) { - return vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) + 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(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22758,6 +26884,7 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22776,17 +26903,21 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad 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_profile", 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 @@ -22798,13 +26929,16 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad // ListLoadBalancers : List all load balancers // This request lists all load balancers in the region. func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) + result, response, err = vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22813,6 +26947,7 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -22837,17 +26972,21 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala 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 @@ -22859,17 +26998,21 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala // 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) { - return vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) + 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 } @@ -22878,6 +27021,7 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -22931,22 +27075,27 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB } _, 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", 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 @@ -22959,17 +27108,21 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB // 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) { - return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) + response, err = vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22982,6 +27135,7 @@ func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadB builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -23002,10 +27156,16 @@ func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadB 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_load_balancer", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -23013,17 +27173,21 @@ func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadB // 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) { - return vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) + result, response, err = vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23036,6 +27200,7 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -23054,17 +27219,21 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance 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", 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 @@ -23078,17 +27247,21 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance // 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) { - return vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) + result, response, err = vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23101,6 +27274,7 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -23123,22 +27297,27 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB _, 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) if err != nil { + 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, UnmarshalLoadBalancer) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -23150,17 +27329,21 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB // GetLoadBalancerStatistics : List all 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) { - return vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) + result, response, err = vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23173,6 +27356,7 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23191,17 +27375,21 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL 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 @@ -23213,17 +27401,21 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL // ListLoadBalancerListeners : List all listeners for a load balancer // This request lists all listeners for a load balancer. func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) + 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 } @@ -23236,6 +27428,7 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list 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 } @@ -23254,17 +27447,21 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list 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_listeners", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -23276,17 +27473,21 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list // 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) { - return vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) + result, response, err = vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23299,6 +27500,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre 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 } @@ -23352,22 +27554,27 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre } _, 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", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -23380,17 +27587,21 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre // 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) { - return vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) + response, err = vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23404,6 +27615,7 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, del builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23421,10 +27633,16 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, del 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_load_balancer_listener", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -23432,17 +27650,21 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, del // 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) { - return vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) + result, response, err = vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23456,6 +27678,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23474,17 +27697,21 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa 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_listener", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -23496,17 +27723,21 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa // 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) { - return vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) + result, response, err = vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23520,6 +27751,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23539,22 +27771,27 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) 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_load_balancer_listener", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -23567,17 +27804,21 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd // This request lists all 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) { - return vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) + result, response, err = vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) + 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") 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 } @@ -23591,6 +27832,7 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23609,17 +27851,21 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex 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_listener_policies", 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 @@ -23633,17 +27879,21 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex // 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) { - return vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) + result, response, err = vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23657,6 +27907,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23692,22 +27943,27 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex } _, 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", 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 @@ -23719,17 +27975,21 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex // 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) { - return vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) + response, err = vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23744,6 +28004,7 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23761,10 +28022,16 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Contex 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_load_balancer_listener_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -23772,17 +28039,21 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Contex // 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) { - return vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) + result, response, err = vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23797,6 +28068,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23815,17 +28087,21 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, 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_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 @@ -23838,17 +28114,21 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, // 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) { - return vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) + result, response, err = vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23863,6 +28143,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23882,22 +28163,27 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex _, 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) if err != nil { + 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, UnmarshalLoadBalancerListenerPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -23909,17 +28195,21 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex // ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy // This request lists all rules of a load balancer listener policy. func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) + result, response, err = vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23934,6 +28224,7 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con 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 } @@ -23952,17 +28243,21 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con 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_listener_policy_rules", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -23974,17 +28269,21 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con // 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) { - return vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) + result, response, err = vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23999,6 +28298,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co 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 } @@ -24031,22 +28331,27 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co } _, 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 @@ -24058,17 +28363,21 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co // 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) { - return vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) + 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 } @@ -24084,6 +28393,7 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Co 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) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -24101,10 +28411,16 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Co 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_load_balancer_listener_policy_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -24112,17 +28428,21 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Co // 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) { - return vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) + result, response, err = vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24138,6 +28458,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte 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) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -24156,17 +28477,21 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte 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_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 @@ -24178,17 +28503,21 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte // 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) { - return vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) + result, response, err = vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24204,6 +28533,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co 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) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -24223,22 +28553,27 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) 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_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 @@ -24250,17 +28585,21 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co // ListLoadBalancerPools : List all pools of a load balancer // This request lists all pools of a load balancer. func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) + result, response, err = vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) + 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") 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 } @@ -24273,6 +28612,7 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24291,17 +28631,21 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad 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_pools", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -24313,17 +28657,21 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad // 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) { - return vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) + result, response, err = vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24336,6 +28684,7 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24377,22 +28726,27 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL } _, 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_pool", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -24405,17 +28759,21 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL // 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) { - return vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) + response, err = vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24429,6 +28787,7 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteL builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24446,10 +28805,16 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteL 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_load_balancer_pool", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -24457,17 +28822,21 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteL // 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) { - return vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) + result, response, err = vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24481,6 +28850,7 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24499,17 +28869,21 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal 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_pool", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -24521,17 +28895,21 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal // 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) { - return vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) + result, response, err = vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24545,6 +28923,7 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24564,22 +28943,27 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) 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_load_balancer_pool", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -24591,17 +28975,21 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL // ListLoadBalancerPoolMembers : List all members of a load balancer pool // This request lists all members of a load balancer pool. func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) + result, response, err = vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) + 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") 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 } @@ -24615,6 +29003,7 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li 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 } @@ -24633,17 +29022,21 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li 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_pool_members", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -24655,17 +29048,21 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li // 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) { - return vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) + result, response, err = vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24679,6 +29076,7 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c 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 } @@ -24708,22 +29106,27 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c } _, 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_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 @@ -24736,17 +29139,21 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c // 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) { - return vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) + 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 } @@ -24760,6 +29167,7 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, 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 } @@ -24783,22 +29191,27 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, } _, 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, "replace_load_balancer_pool_members", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -24810,17 +29223,21 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, // 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) { - return vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) + response, err = vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24835,6 +29252,7 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, d builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24852,10 +29270,16 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, d 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_load_balancer_pool_member", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -24863,17 +29287,21 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, d // 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) { - return vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) + result, response, err = vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24888,6 +29316,7 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24906,17 +29335,21 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL 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_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 @@ -24928,17 +29361,21 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL // 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) { - return vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) + result, response, err = vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24953,6 +29390,7 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24972,22 +29410,27 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) 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_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 @@ -25000,13 +29443,16 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u // This request lists all 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) { - return vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) + result, response, err = vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25015,6 +29461,7 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -25057,17 +29504,21 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo 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_endpoint_gateways", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -25080,17 +29531,21 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo // 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) { - return vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) + result, response, err = vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25099,6 +29554,7 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -25140,22 +29596,27 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn } _, 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_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 @@ -25167,17 +29628,21 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn // ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway // This request lists all reserved IPs bound to an endpoint gateway. func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { - return vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) + result, response, err = vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25190,6 +29655,7 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25217,17 +29683,21 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd 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_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 @@ -25240,17 +29710,21 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd // 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) { - return vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) + response, err = vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25264,6 +29738,7 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25281,10 +29756,16 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove 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, "remove_endpoint_gateway_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -25292,17 +29773,21 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove // 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) { - return vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) + result, response, err = vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25316,6 +29801,7 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25334,17 +29820,21 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi 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_endpoint_gateway_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -25359,17 +29849,21 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi // - 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) { - return vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) + result, response, err = vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25383,6 +29877,7 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25401,17 +29896,21 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi 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, "add_endpoint_gateway_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -25426,17 +29925,21 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi // 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) { - return vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) + response, err = vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25449,6 +29952,7 @@ func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEn 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 } @@ -25466,10 +29970,16 @@ func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEn 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 } @@ -25477,17 +29987,21 @@ func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEn // 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) { - return vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) + 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 } @@ -25500,6 +30014,7 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint 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 } @@ -25518,17 +30033,21 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint 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_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 @@ -25540,17 +30059,21 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint // 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) { - return vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) + result, response, err = vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25563,6 +30086,7 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn 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 } @@ -25582,22 +30106,27 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn _, err = builder.SetBodyContentJSON(updateEndpointGatewayOptions.EndpointGatewayPatch) 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_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 @@ -25610,13 +30139,16 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn // This request lists all flow log collectors in the region. A flow log collector summarizes data sent over the instance // network interfaces and instance network attachments contained within its target. func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { - return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) + result, response, err = vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25625,6 +30157,7 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -25670,17 +30203,21 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow 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 @@ -25694,17 +30231,21 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow // 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) { - return vpc.CreateFlowLogCollectorWithContext(context.Background(), createFlowLogCollectorOptions) + 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 } @@ -25713,6 +30254,7 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -25748,22 +30290,27 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF } _, 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_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 @@ -25777,17 +30324,21 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF // // 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) { - return vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) + response, err = vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25800,6 +30351,7 @@ func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteF builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25817,10 +30369,16 @@ func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteF 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_flow_log_collector", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -25828,17 +30386,21 @@ func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteF // 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) { - return vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) + result, response, err = vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25851,6 +30413,7 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25869,17 +30432,21 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog 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_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 @@ -25893,17 +30460,21 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog // 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) { - return vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) + result, response, err = vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25916,6 +30487,7 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25935,22 +30507,27 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF _, 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 } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + 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 @@ -25958,6 +30535,9 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF return } +func getServiceComponentInfo() *core.ProblemComponent { + return core.NewProblemComponent(DefaultServiceName, "today") +} // AccountReference : AccountReference struct type AccountReference struct { @@ -25979,10 +30559,12 @@ func UnmarshalAccountReference(m map[string]json.RawMessage, result interface{}) 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)) @@ -26377,34 +30959,42 @@ func UnmarshalAddressPrefix(m map[string]json.RawMessage, result interface{}) (e 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)) @@ -26435,22 +31025,27 @@ func UnmarshalAddressPrefixCollection(m map[string]json.RawMessage, result inter 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, UnmarshalAddressPrefixCollectionFirst) 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, UnmarshalAddressPrefixCollectionNext) 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)) @@ -26463,8 +31058,11 @@ func (resp *AddressPrefixCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -26480,6 +31078,7 @@ func UnmarshalAddressPrefixCollectionFirst(m map[string]json.RawMessage, result obj := new(AddressPrefixCollectionFirst) 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)) @@ -26497,6 +31096,7 @@ func UnmarshalAddressPrefixCollectionNext(m map[string]json.RawMessage, result i obj := new(AddressPrefixCollectionNext) 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)) @@ -26519,10 +31119,12 @@ func UnmarshalAddressPrefixPatch(m map[string]json.RawMessage, result interface{ 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)) @@ -26536,6 +31138,9 @@ func (addressPrefixPatch *AddressPrefixPatch) AsPatch() (_patch map[string]inter if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -26675,66 +31280,82 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er 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)) @@ -26765,22 +31386,27 @@ func UnmarshalBackupPolicyCollection(m map[string]json.RawMessage, result interf 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, UnmarshalBackupPolicyCollectionFirst) 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, UnmarshalBackupPolicyCollectionNext) 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)) @@ -26793,8 +31419,11 @@ func (resp *BackupPolicyCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -26810,6 +31439,7 @@ func UnmarshalBackupPolicyCollectionFirst(m map[string]json.RawMessage, result i 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)) @@ -26827,6 +31457,7 @@ func UnmarshalBackupPolicyCollectionNext(m map[string]json.RawMessage, result in 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)) @@ -26856,14 +31487,17 @@ func UnmarshalBackupPolicyHealthReason(m map[string]json.RawMessage, result inte 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)) @@ -26957,54 +31591,67 @@ func UnmarshalBackupPolicyJob(m map[string]json.RawMessage, result interface{}) 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)) @@ -27035,22 +31682,27 @@ func UnmarshalBackupPolicyJobCollection(m map[string]json.RawMessage, result int 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) 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, UnmarshalBackupPolicyJobCollectionNext) 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)) @@ -27063,8 +31715,11 @@ func (resp *BackupPolicyJobCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -27080,6 +31735,7 @@ func UnmarshalBackupPolicyJobCollectionFirst(m map[string]json.RawMessage, resul obj := new(BackupPolicyJobCollectionFirst) 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)) @@ -27097,6 +31753,7 @@ func UnmarshalBackupPolicyJobCollectionNext(m map[string]json.RawMessage, result obj := new(BackupPolicyJobCollectionNext) 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)) @@ -27152,30 +31809,37 @@ func UnmarshalBackupPolicyJobSource(m map[string]json.RawMessage, result interfa 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, UnmarshalVolumeReferenceDeleted) 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)) @@ -27222,14 +31886,17 @@ func UnmarshalBackupPolicyJobStatusReason(m map[string]json.RawMessage, result i 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)) @@ -27263,14 +31930,17 @@ func UnmarshalBackupPolicyPatch(m map[string]json.RawMessage, result interface{} 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)) @@ -27284,6 +31954,9 @@ func (backupPolicyPatch *BackupPolicyPatch) AsPatch() (_patch map[string]interfa if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -27354,54 +32027,67 @@ func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) 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 } 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()) 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)) @@ -27422,10 +32108,12 @@ func UnmarshalBackupPolicyPlanClonePolicy(m map[string]json.RawMessage, result i 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)) @@ -27447,10 +32135,12 @@ func UnmarshalBackupPolicyPlanClonePolicyPatch(m map[string]json.RawMessage, res 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)) @@ -27472,6 +32162,9 @@ func (*VpcV1) NewBackupPolicyPlanClonePolicyPrototype(zones []ZoneIdentityIntf) Zones: zones, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -27480,10 +32173,12 @@ func UnmarshalBackupPolicyPlanClonePolicyPrototype(m map[string]json.RawMessage, 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)) @@ -27514,18 +32209,72 @@ func UnmarshalBackupPolicyPlanCollection(m map[string]json.RawMessage, result in obj := new(BackupPolicyPlanCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyPlanCollectionFirst) if err != nil { +<<<<<<< Updated upstream +======= + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) +>>>>>>> Stashed changes return } err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { +<<<<<<< Updated upstream +======= + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) +>>>>>>> Stashed changes return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyPlanCollectionNext) if err != nil { +<<<<<<< Updated upstream +======= + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) +>>>>>>> Stashed changes 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 +} + +// 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 + } + 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) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) @@ -27584,10 +32333,12 @@ func UnmarshalBackupPolicyPlanDeletionTrigger(m map[string]json.RawMessage, resu 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)) @@ -27608,10 +32359,12 @@ func UnmarshalBackupPolicyPlanDeletionTriggerPatch(m map[string]json.RawMessage, 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)) @@ -27632,10 +32385,12 @@ func UnmarshalBackupPolicyPlanDeletionTriggerPrototype(m map[string]json.RawMess 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)) @@ -27677,34 +32432,42 @@ func UnmarshalBackupPolicyPlanPatch(m map[string]json.RawMessage, result interfa 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)) @@ -27718,6 +32481,9 @@ func (backupPolicyPlanPatch *BackupPolicyPlanPatch) AsPatch() (_patch map[string if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -27757,6 +32523,9 @@ func (*VpcV1) NewBackupPolicyPlanPrototype(cronSpec string) (_model *BackupPolic CronSpec: core.StringPtr(cronSpec), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -27765,34 +32534,42 @@ func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result int 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, "", "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, UnmarshalBackupPolicyPlanDeletionTriggerPrototype) 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)) @@ -27833,26 +32610,32 @@ func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result int obj := new(BackupPolicyPlanReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBackupPolicyPlanReferenceDeleted) 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, UnmarshalBackupPolicyPlanRemote) 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)) @@ -27871,6 +32654,7 @@ func UnmarshalBackupPolicyPlanReferenceDeleted(m map[string]json.RawMessage, res obj := new(BackupPolicyPlanReferenceDeleted) 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)) @@ -27890,6 +32674,7 @@ func UnmarshalBackupPolicyPlanRemote(m map[string]json.RawMessage, result interf obj := new(BackupPolicyPlanRemote) 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)) @@ -27913,14 +32698,17 @@ func UnmarshalBackupPolicyPlanRemoteRegionPolicy(m map[string]json.RawMessage, r obj := new(BackupPolicyPlanRemoteRegionPolicy) 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, 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)) @@ -27948,6 +32736,9 @@ func (*VpcV1) NewBackupPolicyPlanRemoteRegionPolicyPrototype(region RegionIdenti Region: region, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -27956,14 +32747,17 @@ func UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype(m map[string]json.RawM 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)) @@ -28033,30 +32827,37 @@ func UnmarshalBackupPolicyPrototype(m map[string]json.RawMessage, result interfa obj := new(BackupPolicyPrototype) 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, 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)) @@ -28097,14 +32898,17 @@ func UnmarshalBackupPolicyScope(m map[string]json.RawMessage, result interface{} 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, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -28134,6 +32938,7 @@ func UnmarshalBackupPolicyScopePrototype(m map[string]json.RawMessage, result in 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)) @@ -28270,102 +33075,127 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) 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()) return } err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-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, UnmarshalBareMetalServerLifecycleReason) 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, "memory", &obj.Memory) if err != nil { + err = core.SDKErrorf(err, "", "memory-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, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentReference) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) if err != nil { + 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) 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.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, UnmarshalBareMetalServerStatusReason) if err != nil { + 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)) @@ -28415,22 +33245,27 @@ func UnmarshalBareMetalServerBootTarget(m map[string]json.RawMessage, result int obj := new(BareMetalServerBootTarget) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) 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)) @@ -28457,18 +33292,22 @@ func UnmarshalBareMetalServerCpu(m map[string]json.RawMessage, result interface{ 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)) @@ -28499,22 +33338,27 @@ func UnmarshalBareMetalServerCollection(m map[string]json.RawMessage, result int 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) 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, UnmarshalBareMetalServerCollectionNext) 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)) @@ -28527,8 +33371,11 @@ func (resp *BareMetalServerCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -28544,6 +33391,7 @@ func UnmarshalBareMetalServerCollectionFirst(m map[string]json.RawMessage, resul obj := new(BareMetalServerCollectionFirst) 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)) @@ -28561,6 +33409,7 @@ func UnmarshalBareMetalServerCollectionNext(m map[string]json.RawMessage, result obj := new(BareMetalServerCollectionNext) 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)) @@ -28601,26 +33450,32 @@ func UnmarshalBareMetalServerConsoleAccessToken(m map[string]json.RawMessage, re obj := new(BareMetalServerConsoleAccessToken) err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) if err != nil { + err = core.SDKErrorf(err, "", "access_token-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) if err != nil { + err = core.SDKErrorf(err, "", "console_type-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, "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)) @@ -28682,30 +33537,37 @@ func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface obj := new(BareMetalServerDisk) 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, "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.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -28723,6 +33585,7 @@ func UnmarshalBareMetalServerDiskCollection(m map[string]json.RawMessage, result obj := new(BareMetalServerDiskCollection) err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -28740,6 +33603,7 @@ func UnmarshalBareMetalServerDiskPatch(m map[string]json.RawMessage, result inte obj := new(BareMetalServerDiskPatch) 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)) @@ -28753,6 +33617,9 @@ func (bareMetalServerDiskPatch *BareMetalServerDiskPatch) AsPatch() (_patch map[ if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -28768,6 +33635,7 @@ func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, obj := new(BareMetalServerDiskReferenceDeleted) 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)) @@ -28792,14 +33660,17 @@ func UnmarshalBareMetalServerInitialization(m map[string]json.RawMessage, result obj := new(BareMetalServerInitialization) err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "user_accounts", &obj.UserAccounts, UnmarshalBareMetalServerInitializationUserAccount) if err != nil { + err = core.SDKErrorf(err, "", "user_accounts-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -28831,6 +33702,9 @@ func (*VpcV1) NewBareMetalServerInitializationPrototype(image ImageIdentityIntf, Keys: keys, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -28839,14 +33713,17 @@ func UnmarshalBareMetalServerInitializationPrototype(m map[string]json.RawMessag obj := new(BareMetalServerInitializationPrototype) err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + 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)) @@ -28889,18 +33766,22 @@ func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMess obj := new(BareMetalServerInitializationUserAccount) err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) if err != nil { + err = core.SDKErrorf(err, "", "encrypted_password-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) if err != nil { + err = core.SDKErrorf(err, "", "encryption_key-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, "username", &obj.Username) if err != nil { + err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -28940,14 +33821,17 @@ func UnmarshalBareMetalServerLifecycleReason(m map[string]json.RawMessage, resul obj := new(BareMetalServerLifecycleReason) 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)) @@ -29085,62 +33969,77 @@ func UnmarshalBareMetalServerNetworkAttachment(m map[string]json.RawMessage, res 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) if err != nil { + 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()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-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 } 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, "allow_to_float", &obj.AllowToFloat) if err != nil { + err = core.SDKErrorf(err, "", "allow_to_float-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) if err != nil { + err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -29171,22 +34070,27 @@ func UnmarshalBareMetalServerNetworkAttachmentCollection(m map[string]json.RawMe obj := new(BareMetalServerNetworkAttachmentCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerNetworkAttachmentCollectionFirst) 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, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkAttachmentCollectionNext) 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)) @@ -29199,8 +34103,11 @@ func (resp *BareMetalServerNetworkAttachmentCollection) GetNextStart() (*string, return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -29216,6 +34123,7 @@ func UnmarshalBareMetalServerNetworkAttachmentCollectionFirst(m map[string]json. obj := new(BareMetalServerNetworkAttachmentCollectionFirst) 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)) @@ -29233,6 +34141,7 @@ func UnmarshalBareMetalServerNetworkAttachmentCollectionNext(m map[string]json.R obj := new(BareMetalServerNetworkAttachmentCollectionNext) 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)) @@ -29255,10 +34164,12 @@ func UnmarshalBareMetalServerNetworkAttachmentPatch(m map[string]json.RawMessage 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) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -29272,6 +34183,9 @@ func (bareMetalServerNetworkAttachmentPatch *BareMetalServerNetworkAttachmentPat if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -29355,26 +34269,32 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototype(m map[string]json.RawMes obj := new(BareMetalServerNetworkAttachmentPrototype) 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, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-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, "allow_to_float", &obj.AllowToFloat) if err != nil { + err = core.SDKErrorf(err, "", "allow_to_float-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) if err != nil { + err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -29471,50 +34391,62 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface(m 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 } 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.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) 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()) 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)) @@ -29560,30 +34492,37 @@ func UnmarshalBareMetalServerNetworkAttachmentReference(m map[string]json.RawMes obj := new(BareMetalServerNetworkAttachmentReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -29602,6 +34541,7 @@ func UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted(m map[string]json obj := new(BareMetalServerNetworkAttachmentReferenceDeleted) 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)) @@ -29854,21 +34794,32 @@ func UnmarshalBareMetalServerNetworkInterface(m map[string]json.RawMessage, resu var discValue string err = core.UnmarshalPrimitive(m, "interface_type", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + 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 { - err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'interface_type': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -29897,22 +34848,27 @@ func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMes obj := new(BareMetalServerNetworkInterfaceCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerNetworkInterfaceCollectionFirst) 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, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) 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)) @@ -29925,8 +34881,11 @@ func (resp *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -29942,6 +34901,7 @@ func UnmarshalBareMetalServerNetworkInterfaceCollectionFirst(m map[string]json.R 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)) @@ -29959,6 +34919,7 @@ func UnmarshalBareMetalServerNetworkInterfaceCollectionNext(m map[string]json.Ra 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)) @@ -30005,18 +34966,22 @@ func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, obj := new(BareMetalServerNetworkInterfacePatch) 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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -30030,6 +34995,9 @@ func (bareMetalServerNetworkInterfacePatch *BareMetalServerNetworkInterfacePatch if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -30166,21 +35134,32 @@ func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMess var discValue string err = core.UnmarshalPrimitive(m, "interface_type", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + 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, 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 { - err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'interface_type': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -30197,6 +35176,7 @@ func UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted(m map[string]json. obj := new(BareMetalServerNetworkInterfaceReferenceDeleted) 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)) @@ -30215,6 +35195,7 @@ func UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted(m map obj := new(BareMetalServerNetworkInterfaceReferenceTargetContextDeleted) 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)) @@ -30242,14 +35223,17 @@ func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interfac obj := new(BareMetalServerPatch) err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-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, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) if err != nil { + err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -30263,6 +35247,9 @@ func (bareMetalServerPatch *BareMetalServerPatch) AsPatch() (_patch map[string]i if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -30320,18 +35307,22 @@ func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype(m map[string]json obj := new(BareMetalServerPrimaryNetworkAttachmentPrototype) 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, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -30426,6 +35417,9 @@ func (*VpcV1) NewBareMetalServerPrimaryNetworkInterfacePrototype(subnet SubnetId Subnet: subnet, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -30434,34 +35428,42 @@ func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json. 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)) @@ -30522,66 +35524,82 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf 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) if err != nil { + err = core.SDKErrorf(err, "", "family-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.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) if err != nil { + err = core.SDKErrorf(err, "", "memory-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, "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) if err != nil { + err = core.SDKErrorf(err, "", "os_architecture-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, "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) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interfaces_supported-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -30636,30 +35654,37 @@ func UnmarshalBareMetalServerProfileBandwidth(m map[string]json.RawMessage, resu 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) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -30689,14 +35714,17 @@ func UnmarshalBareMetalServerProfileCpuArchitecture(m map[string]json.RawMessage obj := new(BareMetalServerProfileCpuArchitecture) 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, "value", &obj.Value) if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -30751,30 +35779,37 @@ func UnmarshalBareMetalServerProfileCpuCoreCount(m map[string]json.RawMessage, r 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) if err != nil { + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -30829,30 +35864,37 @@ func UnmarshalBareMetalServerProfileCpuSocketCount(m map[string]json.RawMessage, 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) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -30883,22 +35925,27 @@ func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, res obj := new(BareMetalServerProfileCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerProfileCollectionFirst) 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, UnmarshalBareMetalServerProfileCollectionNext) 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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -30911,8 +35958,11 @@ func (resp *BareMetalServerProfileCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -30928,6 +35978,7 @@ func UnmarshalBareMetalServerProfileCollectionFirst(m map[string]json.RawMessage 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)) @@ -30945,6 +35996,7 @@ func UnmarshalBareMetalServerProfileCollectionNext(m map[string]json.RawMessage, 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)) @@ -30978,10 +36030,12 @@ func UnmarshalBareMetalServerProfileConsoleTypes(m map[string]json.RawMessage, r obj := new(BareMetalServerProfileConsoleTypes) 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)) @@ -31002,14 +36056,17 @@ func UnmarshalBareMetalServerProfileDisk(m map[string]json.RawMessage, result in obj := new(BareMetalServerProfileDisk) err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalBareMetalServerProfileDiskQuantity) if err != nil { + 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)) @@ -31064,30 +36121,37 @@ func UnmarshalBareMetalServerProfileDiskQuantity(m map[string]json.RawMessage, r 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) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31142,30 +36206,37 @@ func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, resul obj := new(BareMetalServerProfileDiskSize) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31229,14 +36300,17 @@ func UnmarshalBareMetalServerProfileDiskSupportedInterfaces(m map[string]json.Ra obj := new(BareMetalServerProfileDiskSupportedInterfaces) 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)) @@ -31268,10 +36342,12 @@ func UnmarshalBareMetalServerProfileIdentity(m map[string]json.RawMessage, resul 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)) @@ -31326,30 +36402,37 @@ func UnmarshalBareMetalServerProfileMemory(m map[string]json.RawMessage, result 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31390,14 +36473,17 @@ func UnmarshalBareMetalServerProfileNetworkAttachmentCount(m map[string]json.Raw obj := new(BareMetalServerProfileNetworkAttachmentCount) 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31438,14 +36524,17 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCount(m map[string]json.RawM 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31475,14 +36564,17 @@ func UnmarshalBareMetalServerProfileOsArchitecture(m map[string]json.RawMessage, obj := new(BareMetalServerProfileOsArchitecture) 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)) @@ -31512,14 +36604,17 @@ func UnmarshalBareMetalServerProfileReference(m map[string]json.RawMessage, resu obj := new(BareMetalServerProfileReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -31558,10 +36653,12 @@ func UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes(m map[st obj := new(BareMetalServerProfileSupportedTrustedPlatformModuleModes) 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)) @@ -31588,10 +36685,12 @@ func UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported(m map[stri 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)) @@ -31660,50 +36759,62 @@ func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result inte obj := new(BareMetalServerPrototype) err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) if err != nil { + err = core.SDKErrorf(err, "", "initialization-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, "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) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) if err != nil { + err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31753,14 +36864,17 @@ func UnmarshalBareMetalServerStatusReason(m map[string]json.RawMessage, result i obj := new(BareMetalServerStatusReason) 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)) @@ -31813,14 +36927,17 @@ func UnmarshalBareMetalServerTrustedPlatformModule(m map[string]json.RawMessage, 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) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) if err != nil { + err = core.SDKErrorf(err, "", "supported_modes-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31851,6 +36968,7 @@ func UnmarshalBareMetalServerTrustedPlatformModulePatch(m map[string]json.RawMes obj := new(BareMetalServerTrustedPlatformModulePatch) err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31877,6 +36995,7 @@ func UnmarshalBareMetalServerTrustedPlatformModulePrototype(m map[string]json.Ra obj := new(BareMetalServerTrustedPlatformModulePrototype) err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31906,6 +37025,7 @@ func UnmarshalCatalogOfferingIdentity(m map[string]json.RawMessage, result inter 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)) @@ -31935,6 +37055,7 @@ func UnmarshalCatalogOfferingVersionIdentity(m map[string]json.RawMessage, resul 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)) @@ -31953,6 +37074,7 @@ func UnmarshalCatalogOfferingVersionReference(m map[string]json.RawMessage, resu obj := new(CatalogOfferingVersionReference) 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)) @@ -31980,6 +37102,7 @@ func UnmarshalCertificateInstanceIdentity(m map[string]json.RawMessage, result i obj := new(CertificateInstanceIdentity) 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)) @@ -31997,6 +37120,7 @@ func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result obj := new(CertificateInstanceReference) 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)) @@ -32144,10 +37268,12 @@ func UnmarshalCloudObjectStorageBucketIdentity(m map[string]json.RawMessage, res obj := new(CloudObjectStorageBucketIdentity) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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)) @@ -32168,10 +37294,12 @@ func UnmarshalCloudObjectStorageBucketReference(m map[string]json.RawMessage, re obj := new(CloudObjectStorageBucketReference) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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)) @@ -32189,6 +37317,7 @@ func UnmarshalCloudObjectStorageObjectReference(m map[string]json.RawMessage, re obj := new(CloudObjectStorageObjectReference) 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)) @@ -34025,7 +39154,10 @@ type CreateLoadBalancerListenerPolicyOptions struct { // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. +<<<<<<< Updated upstream // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. +======= +>>>>>>> Stashed changes Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` // Allows users to set headers on API requests @@ -36380,6 +41512,7 @@ func UnmarshalDnsInstanceIdentity(m map[string]json.RawMessage, result interface obj := new(DnsInstanceIdentity) 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)) @@ -36397,6 +41530,7 @@ func UnmarshalDnsInstanceReference(m map[string]json.RawMessage, result interfac obj := new(DnsInstanceReference) 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)) @@ -36420,10 +41554,12 @@ func UnmarshalDnsServer(m map[string]json.RawMessage, result interface{}) (err e obj := new(DnsServer) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneReference) if err != nil { + err = core.SDKErrorf(err, "", "zone_affinity-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -36448,6 +41584,9 @@ func (*VpcV1) NewDnsServerPrototype(address string) (_model *DnsServerPrototype, Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -36456,10 +41595,12 @@ func UnmarshalDnsServerPrototype(m map[string]json.RawMessage, result interface{ obj := new(DnsServerPrototype) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone_affinity-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -36486,6 +41627,7 @@ func UnmarshalDnsZoneIdentity(m map[string]json.RawMessage, result interface{}) obj := new(DnsZoneIdentity) 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)) @@ -36502,6 +41644,7 @@ func UnmarshalDnsZoneReference(m map[string]json.RawMessage, result interface{}) obj := new(DnsZoneReference) 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)) @@ -36619,94 +41762,117 @@ func UnmarshalDedicatedHost(m map[string]json.RawMessage, result interface{}) (e obj := new(DedicatedHost) err = core.UnmarshalPrimitive(m, "available_memory", &obj.AvailableMemory) if err != nil { + err = core.SDKErrorf(err, "", "available_memory-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "available_vcpu", &obj.AvailableVcpu, UnmarshalVcpu) if err != nil { + err = core.SDKErrorf(err, "", "available_vcpu-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "group-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, "instance_placement_enabled", &obj.InstancePlacementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "instance_placement_enabled-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "instances-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, "memory", &obj.Memory) if err != nil { + err = core.SDKErrorf(err, "", "memory-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, "numa", &obj.Numa, UnmarshalDedicatedHostNuma) if err != nil { + err = core.SDKErrorf(err, "", "numa-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) if err != nil { + err = core.SDKErrorf(err, "", "provisionable-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.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) if err != nil { + err = core.SDKErrorf(err, "", "socket_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "state", &obj.State) if err != nil { + err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "supported_instance_profiles-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalVcpu) if err != nil { + err = core.SDKErrorf(err, "", "vcpu-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)) @@ -36737,22 +41903,27 @@ func UnmarshalDedicatedHostCollection(m map[string]json.RawMessage, result inter obj := new(DedicatedHostCollection) err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHost) if err != nil { + err = core.SDKErrorf(err, "", "dedicated_hosts-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostCollectionFirst) 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, UnmarshalDedicatedHostCollectionNext) 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)) @@ -36765,8 +41936,11 @@ func (resp *DedicatedHostCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -36782,6 +41956,7 @@ func UnmarshalDedicatedHostCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -36799,6 +41974,7 @@ func UnmarshalDedicatedHostCollectionNext(m map[string]json.RawMessage, result i 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)) @@ -36889,50 +42065,62 @@ func UnmarshalDedicatedHostDisk(m map[string]json.RawMessage, result interface{} obj := new(DedicatedHostDisk) err = core.UnmarshalPrimitive(m, "available", &obj.Available) if err != nil { + err = core.SDKErrorf(err, "", "available-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.UnmarshalModel(m, "instance_disks", &obj.InstanceDisks, UnmarshalInstanceDiskReference) if err != nil { + err = core.SDKErrorf(err, "", "instance_disks-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()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) if err != nil { + err = core.SDKErrorf(err, "", "provisionable-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, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes) if err != nil { + err = core.SDKErrorf(err, "", "supported_instance_interface_types-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -36950,6 +42138,7 @@ func UnmarshalDedicatedHostDiskCollection(m map[string]json.RawMessage, result i obj := new(DedicatedHostDiskCollection) err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -36967,6 +42156,7 @@ func UnmarshalDedicatedHostDiskPatch(m map[string]json.RawMessage, result interf obj := new(DedicatedHostDiskPatch) 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)) @@ -36980,6 +42170,9 @@ func (dedicatedHostDiskPatch *DedicatedHostDiskPatch) AsPatch() (_patch map[stri if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -37041,50 +42234,62 @@ func UnmarshalDedicatedHostGroup(m map[string]json.RawMessage, result interface{ obj := new(DedicatedHostGroup) err = core.UnmarshalPrimitive(m, "class", &obj.Class) if err != nil { + err = core.SDKErrorf(err, "", "class-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHostReference) if err != nil { + err = core.SDKErrorf(err, "", "dedicated_hosts-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-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, "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, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "supported_instance_profiles-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)) @@ -37115,22 +42320,27 @@ func UnmarshalDedicatedHostGroupCollection(m map[string]json.RawMessage, result obj := new(DedicatedHostGroupCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostGroupCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "groups", &obj.Groups, UnmarshalDedicatedHostGroup) if err != nil { + err = core.SDKErrorf(err, "", "groups-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, UnmarshalDedicatedHostGroupCollectionNext) 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)) @@ -37143,8 +42353,11 @@ func (resp *DedicatedHostGroupCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -37160,6 +42373,7 @@ func UnmarshalDedicatedHostGroupCollectionFirst(m map[string]json.RawMessage, re 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)) @@ -37177,6 +42391,7 @@ func UnmarshalDedicatedHostGroupCollectionNext(m map[string]json.RawMessage, res 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)) @@ -37212,14 +42427,17 @@ func UnmarshalDedicatedHostGroupIdentity(m map[string]json.RawMessage, result in obj := new(DedicatedHostGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37237,6 +42455,7 @@ func UnmarshalDedicatedHostGroupPatch(m map[string]json.RawMessage, result inter obj := new(DedicatedHostGroupPatch) 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)) @@ -37250,6 +42469,9 @@ func (dedicatedHostGroupPatch *DedicatedHostGroupPatch) AsPatch() (_patch map[st if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -37268,10 +42490,12 @@ func UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext(m map[string obj := new(DedicatedHostGroupPrototypeDedicatedHostByZoneContext) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37311,26 +42535,32 @@ func UnmarshalDedicatedHostGroupReference(m map[string]json.RawMessage, result i obj := new(DedicatedHostGroupReference) 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, UnmarshalDedicatedHostGroupReferenceDeleted) 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)) @@ -37349,6 +42579,7 @@ func UnmarshalDedicatedHostGroupReferenceDeleted(m map[string]json.RawMessage, r obj := new(DedicatedHostGroupReferenceDeleted) 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)) @@ -37369,10 +42600,12 @@ func UnmarshalDedicatedHostNuma(m map[string]json.RawMessage, result interface{} obj := new(DedicatedHostNuma) err = core.UnmarshalPrimitive(m, "count", &obj.Count) if err != nil { + err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "nodes", &obj.Nodes, UnmarshalDedicatedHostNumaNode) if err != nil { + err = core.SDKErrorf(err, "", "nodes-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37393,10 +42626,12 @@ func UnmarshalDedicatedHostNumaNode(m map[string]json.RawMessage, result interfa obj := new(DedicatedHostNumaNode) err = core.UnmarshalPrimitive(m, "available_vcpu", &obj.AvailableVcpu) if err != nil { + err = core.SDKErrorf(err, "", "available_vcpu-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "vcpu", &obj.Vcpu) if err != nil { + err = core.SDKErrorf(err, "", "vcpu-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37417,10 +42652,12 @@ func UnmarshalDedicatedHostPatch(m map[string]json.RawMessage, result interface{ obj := new(DedicatedHostPatch) err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "instance_placement_enabled-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)) @@ -37434,6 +42671,9 @@ func (dedicatedHostPatch *DedicatedHostPatch) AsPatch() (_patch map[string]inter if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -37517,50 +42757,62 @@ func UnmarshalDedicatedHostProfile(m map[string]json.RawMessage, result interfac obj := new(DedicatedHostProfile) err = core.UnmarshalPrimitive(m, "class", &obj.Class) if err != nil { + err = core.SDKErrorf(err, "", "class-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostProfileDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-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.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalDedicatedHostProfileMemory) if err != nil { + err = core.SDKErrorf(err, "", "memory-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, "socket_count", &obj.SocketCount, UnmarshalDedicatedHostProfileSocket) if err != nil { + err = core.SDKErrorf(err, "", "socket_count-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, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "supported_instance_profiles-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalDedicatedHostProfileVcpuArchitecture) if err != nil { + err = core.SDKErrorf(err, "", "vcpu_architecture-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalDedicatedHostProfileVcpu) if err != nil { + err = core.SDKErrorf(err, "", "vcpu_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalDedicatedHostProfileVcpuManufacturer) if err != nil { + err = core.SDKErrorf(err, "", "vcpu_manufacturer-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37591,22 +42843,27 @@ func UnmarshalDedicatedHostProfileCollection(m map[string]json.RawMessage, resul obj := new(DedicatedHostProfileCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostProfileCollectionFirst) 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, UnmarshalDedicatedHostProfileCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalDedicatedHostProfile) 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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37619,8 +42876,11 @@ func (resp *DedicatedHostProfileCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -37636,6 +42896,7 @@ func UnmarshalDedicatedHostProfileCollectionFirst(m map[string]json.RawMessage, 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)) @@ -37653,6 +42914,7 @@ func UnmarshalDedicatedHostProfileCollectionNext(m map[string]json.RawMessage, r 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)) @@ -37677,18 +42939,22 @@ func UnmarshalDedicatedHostProfileDisk(m map[string]json.RawMessage, result inte obj := new(DedicatedHostProfileDisk) err = core.UnmarshalModel(m, "interface_type", &obj.InterfaceType, UnmarshalDedicatedHostProfileDiskInterface) if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalDedicatedHostProfileDiskQuantity) if err != nil { + err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalDedicatedHostProfileDiskSize) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes, UnmarshalDedicatedHostProfileDiskSupportedInterfaces) if err != nil { + err = core.SDKErrorf(err, "", "supported_instance_interface_types-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37727,10 +42993,12 @@ func UnmarshalDedicatedHostProfileDiskInterface(m map[string]json.RawMessage, re obj := new(DedicatedHostProfileDiskInterface) 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)) @@ -37757,10 +43025,12 @@ func UnmarshalDedicatedHostProfileDiskQuantity(m map[string]json.RawMessage, res obj := new(DedicatedHostProfileDiskQuantity) 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)) @@ -37787,10 +43057,12 @@ func UnmarshalDedicatedHostProfileDiskSize(m map[string]json.RawMessage, result obj := new(DedicatedHostProfileDiskSize) 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)) @@ -37827,10 +43099,12 @@ func UnmarshalDedicatedHostProfileDiskSupportedInterfaces(m map[string]json.RawM obj := new(DedicatedHostProfileDiskSupportedInterfaces) 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)) @@ -37862,10 +43136,12 @@ func UnmarshalDedicatedHostProfileIdentity(m map[string]json.RawMessage, result obj := new(DedicatedHostProfileIdentity) 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)) @@ -37920,30 +43196,37 @@ func UnmarshalDedicatedHostProfileMemory(m map[string]json.RawMessage, result in obj := new(DedicatedHostProfileMemory) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37964,10 +43247,12 @@ func UnmarshalDedicatedHostProfileReference(m map[string]json.RawMessage, result obj := new(DedicatedHostProfileReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -38022,30 +43307,37 @@ func UnmarshalDedicatedHostProfileSocket(m map[string]json.RawMessage, result in obj := new(DedicatedHostProfileSocket) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -38100,30 +43392,37 @@ func UnmarshalDedicatedHostProfileVcpu(m map[string]json.RawMessage, result inte obj := new(DedicatedHostProfileVcpu) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -38150,10 +43449,12 @@ func UnmarshalDedicatedHostProfileVcpuArchitecture(m map[string]json.RawMessage, obj := new(DedicatedHostProfileVcpuArchitecture) 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)) @@ -38180,10 +43481,12 @@ func UnmarshalDedicatedHostProfileVcpuManufacturer(m map[string]json.RawMessage, obj := new(DedicatedHostProfileVcpuManufacturer) 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)) @@ -38230,26 +43533,32 @@ func UnmarshalDedicatedHostPrototype(m map[string]json.RawMessage, result interf obj := new(DedicatedHostPrototype) err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "instance_placement_enabled-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, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -38289,26 +43598,32 @@ func UnmarshalDedicatedHostReference(m map[string]json.RawMessage, result interf obj := new(DedicatedHostReference) 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, UnmarshalDedicatedHostReferenceDeleted) 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)) @@ -38327,6 +43642,7 @@ func UnmarshalDedicatedHostReferenceDeleted(m map[string]json.RawMessage, result obj := new(DedicatedHostReferenceDeleted) 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)) @@ -38371,38 +43687,47 @@ func UnmarshalDefaultNetworkACL(m map[string]json.RawMessage, result interface{} obj := new(DefaultNetworkACL) 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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -38525,62 +43850,77 @@ func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface obj := new(DefaultRoutingTable) err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) if err != nil { + err = core.SDKErrorf(err, "", "accept_routes_from-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) if err != nil { + err = core.SDKErrorf(err, "", "advertise_routes_to-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, "is_default", &obj.IsDefault) if err != nil { + err = core.SDKErrorf(err, "", "is_default-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, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_direct_link_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_internet_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_transit_gateway_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_vpc_zone_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) if err != nil { + err = core.SDKErrorf(err, "", "routes-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -38625,38 +43965,47 @@ func UnmarshalDefaultSecurityGroup(m map[string]json.RawMessage, result interfac obj := new(DefaultSecurityGroup) 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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) if err != nil { + err = core.SDKErrorf(err, "", "targets-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -40976,6 +46325,7 @@ func UnmarshalEncryptionKeyIdentity(m map[string]json.RawMessage, result interfa obj := new(EncryptionKeyIdentity) 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)) @@ -40995,6 +46345,7 @@ func UnmarshalEncryptionKeyReference(m map[string]json.RawMessage, result interf obj := new(EncryptionKeyReference) 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)) @@ -41101,70 +46452,87 @@ func UnmarshalEndpointGateway(m map[string]json.RawMessage, result interface{}) obj := new(EndpointGateway) err = core.UnmarshalPrimitive(m, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding) if err != nil { + err = core.SDKErrorf(err, "", "allow_dns_resolution_binding-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "ips-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalEndpointGatewayLifecycleReason) 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, "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, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "service_endpoint", &obj.ServiceEndpoint) if err != nil { + err = core.SDKErrorf(err, "", "service_endpoint-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "service_endpoints", &obj.ServiceEndpoints) if err != nil { + err = core.SDKErrorf(err, "", "service_endpoints-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalEndpointGatewayTarget) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -41195,22 +46563,27 @@ func UnmarshalEndpointGatewayCollection(m map[string]json.RawMessage, result int obj := new(EndpointGatewayCollection) err = core.UnmarshalModel(m, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGateway) if err != nil { + err = core.SDKErrorf(err, "", "endpoint_gateways-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalEndpointGatewayCollectionFirst) 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, UnmarshalEndpointGatewayCollectionNext) 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)) @@ -41223,8 +46596,11 @@ func (resp *EndpointGatewayCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -41240,6 +46616,7 @@ func UnmarshalEndpointGatewayCollectionFirst(m map[string]json.RawMessage, resul 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)) @@ -41257,6 +46634,7 @@ func UnmarshalEndpointGatewayCollectionNext(m map[string]json.RawMessage, result 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)) @@ -41295,14 +46673,17 @@ func UnmarshalEndpointGatewayLifecycleReason(m map[string]json.RawMessage, resul obj := new(EndpointGatewayLifecycleReason) 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)) @@ -41327,10 +46708,12 @@ func UnmarshalEndpointGatewayPatch(m map[string]json.RawMessage, result interfac obj := new(EndpointGatewayPatch) err = core.UnmarshalPrimitive(m, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding) if err != nil { + err = core.SDKErrorf(err, "", "allow_dns_resolution_binding-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)) @@ -41344,6 +46727,9 @@ func (endpointGatewayPatch *EndpointGatewayPatch) AsPatch() (_patch map[string]i if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -41359,6 +46745,7 @@ func UnmarshalEndpointGatewayReferenceDeleted(m map[string]json.RawMessage, resu obj := new(EndpointGatewayReferenceDeleted) 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)) @@ -41398,26 +46785,32 @@ func UnmarshalEndpointGatewayReferenceRemote(m map[string]json.RawMessage, resul obj := new(EndpointGatewayReferenceRemote) 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) 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, UnmarshalEndpointGatewayRemote) 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)) @@ -41441,10 +46834,12 @@ func UnmarshalEndpointGatewayRemote(m map[string]json.RawMessage, result interfa obj := new(EndpointGatewayRemote) err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) if err != nil { + err = core.SDKErrorf(err, "", "account-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)) @@ -41495,26 +46890,32 @@ func UnmarshalEndpointGatewayReservedIP(m map[string]json.RawMessage, result int obj := new(EndpointGatewayReservedIP) 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 } 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 } 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)) @@ -41556,14 +46957,17 @@ func UnmarshalEndpointGatewayTarget(m map[string]json.RawMessage, result interfa obj := new(EndpointGatewayTarget) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -41607,19 +47011,27 @@ func UnmarshalEndpointGatewayTargetPrototype(m map[string]json.RawMessage, resul var discValue string err = core.UnmarshalPrimitive(m, "resource_type", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'resource_type': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'resource_type': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'resource_type' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'resource_type' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "provider_cloud_service" { err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-EndpointGatewayTargetPrototypeProviderCloudServiceIdentity-error", common.GetComponentInfo()) + } } else if discValue == "provider_infrastructure_service" { err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'resource_type': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'resource_type': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -41736,42 +47148,52 @@ func UnmarshalFloatingIP(m map[string]json.RawMessage, result interface{}) (err obj := new(FloatingIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-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, "target", &obj.Target, UnmarshalFloatingIPTarget) if err != nil { + err = core.SDKErrorf(err, "", "target-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)) @@ -41802,22 +47224,27 @@ func UnmarshalFloatingIPCollection(m map[string]json.RawMessage, result interfac obj := new(FloatingIPCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFloatingIPCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "floating_ips-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, UnmarshalFloatingIPCollectionNext) 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)) @@ -41830,8 +47257,11 @@ func (resp *FloatingIPCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -41847,6 +47277,7 @@ func UnmarshalFloatingIPCollectionFirst(m map[string]json.RawMessage, result int 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)) @@ -41864,6 +47295,7 @@ func UnmarshalFloatingIPCollectionNext(m map[string]json.RawMessage, result inte 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)) @@ -41894,22 +47326,27 @@ func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext(m map[string]js obj := new(FloatingIPCollectionVirtualNetworkInterfaceContext) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) if err != nil { + err = core.SDKErrorf(err, "", "floating_ips-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, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext) 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)) @@ -41922,8 +47359,11 @@ func (resp *FloatingIPCollectionVirtualNetworkInterfaceContext) GetNextStart() ( return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -41939,6 +47379,7 @@ func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst(m map[stri 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)) @@ -41956,6 +47397,7 @@ func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext(m map[strin 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)) @@ -41986,10 +47428,12 @@ func UnmarshalFloatingIPPatch(m map[string]json.RawMessage, result interface{}) obj := new(FloatingIPPatch) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPatch) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -42003,6 +47447,9 @@ func (floatingIPPatch *FloatingIPPatch) AsPatch() (_patch map[string]interface{} if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -42046,18 +47493,22 @@ func UnmarshalFloatingIPPrototype(m map[string]json.RawMessage, result interface obj := new(FloatingIPPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -42091,26 +47542,32 @@ func UnmarshalFloatingIPReference(m map[string]json.RawMessage, result interface obj := new(FloatingIPReference) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-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, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -42129,6 +47586,7 @@ func UnmarshalFloatingIPReferenceDeleted(m map[string]json.RawMessage, result in obj := new(FloatingIPReferenceDeleted) 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)) @@ -42195,34 +47653,42 @@ func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) obj := new(FloatingIPTarget) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "resource_type-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -42276,14 +47742,17 @@ func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interfa obj := new(FloatingIPTargetPatch) 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 } 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)) @@ -42334,14 +47803,17 @@ func UnmarshalFloatingIPTargetPrototype(m map[string]json.RawMessage, result int obj := new(FloatingIPTargetPrototype) 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 } 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)) @@ -42359,6 +47831,7 @@ func UnmarshalFloatingIPUnpaginatedCollection(m map[string]json.RawMessage, resu obj := new(FloatingIPUnpaginatedCollection) err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "floating_ips-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -42443,50 +47916,62 @@ func UnmarshalFlowLogCollector(m map[string]json.RawMessage, result interface{}) obj := new(FlowLogCollector) err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { + err = core.SDKErrorf(err, "", "active-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, "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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalLegacyCloudObjectStorageBucketReference) if err != nil { + err = core.SDKErrorf(err, "", "storage_bucket-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFlowLogCollectorTarget) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -42517,22 +48002,27 @@ func UnmarshalFlowLogCollectorCollection(m map[string]json.RawMessage, result in obj := new(FlowLogCollectorCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFlowLogCollectorCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "flow_log_collectors", &obj.FlowLogCollectors, UnmarshalFlowLogCollector) if err != nil { + err = core.SDKErrorf(err, "", "flow_log_collectors-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, UnmarshalFlowLogCollectorCollectionNext) 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)) @@ -42545,8 +48035,11 @@ func (resp *FlowLogCollectorCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -42562,6 +48055,7 @@ func UnmarshalFlowLogCollectorCollectionFirst(m map[string]json.RawMessage, resu 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)) @@ -42579,6 +48073,7 @@ func UnmarshalFlowLogCollectorCollectionNext(m map[string]json.RawMessage, resul 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)) @@ -42600,10 +48095,12 @@ func UnmarshalFlowLogCollectorPatch(m map[string]json.RawMessage, result interfa obj := new(FlowLogCollectorPatch) err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { + err = core.SDKErrorf(err, "", "active-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)) @@ -42617,6 +48114,9 @@ func (flowLogCollectorPatch *FlowLogCollectorPatch) AsPatch() (_patch map[string if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -42702,34 +48202,42 @@ func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interf obj := new(FlowLogCollectorTarget) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) 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 } err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -42784,14 +48292,17 @@ func UnmarshalFlowLogCollectorTargetPrototype(m map[string]json.RawMessage, resu obj := new(FlowLogCollectorTargetPrototype) 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 } 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)) @@ -42810,6 +48321,7 @@ func UnmarshalGenericResourceReferenceDeleted(m map[string]json.RawMessage, resu obj := new(GenericResourceReferenceDeleted) 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)) @@ -45954,54 +51466,67 @@ func UnmarshalIkePolicy(m map[string]json.RawMessage, result interface{}) (err e obj := new(IkePolicy) err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) if err != nil { + err = core.SDKErrorf(err, "", "connections-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, "dh_group", &obj.DhGroup) if err != nil { + err = core.SDKErrorf(err, "", "dh_group-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "encryption_algorithm-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, "ike_version", &obj.IkeVersion) if err != nil { + err = core.SDKErrorf(err, "", "ike_version-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) if err != nil { + err = core.SDKErrorf(err, "", "key_lifetime-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, "negotiation_mode", &obj.NegotiationMode) if err != nil { + err = core.SDKErrorf(err, "", "negotiation_mode-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -46032,22 +51557,27 @@ func UnmarshalIkePolicyCollection(m map[string]json.RawMessage, result interface obj := new(IkePolicyCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIkePolicyCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_policies", &obj.IkePolicies, UnmarshalIkePolicy) if err != nil { + err = core.SDKErrorf(err, "", "ike_policies-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, UnmarshalIkePolicyCollectionNext) 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)) @@ -46060,8 +51590,11 @@ func (resp *IkePolicyCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -46108,26 +51641,32 @@ func UnmarshalIkePolicyPatch(m map[string]json.RawMessage, result interface{}) ( obj := new(IkePolicyPatch) err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup) if err != nil { + err = core.SDKErrorf(err, "", "dh_group-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "encryption_algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion) if err != nil { + err = core.SDKErrorf(err, "", "ike_version-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) if err != nil { + err = core.SDKErrorf(err, "", "key_lifetime-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)) @@ -46141,6 +51680,9 @@ func (ikePolicyPatch *IkePolicyPatch) AsPatch() (_patch map[string]interface{}, if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -46174,22 +51716,27 @@ func UnmarshalIkePolicyReference(m map[string]json.RawMessage, result interface{ obj := new(IkePolicyReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIkePolicyReferenceDeleted) 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)) @@ -46211,6 +51758,9 @@ func (*VpcV1) NewIP(address string) (_model *IP, err error) { Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -46219,6 +51769,7 @@ func UnmarshalIP(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(IP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -46359,54 +51910,67 @@ func UnmarshalIPsecPolicy(m map[string]json.RawMessage, result interface{}) (err obj := new(IPsecPolicy) err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) if err != nil { + err = core.SDKErrorf(err, "", "connections-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, "encapsulation_mode", &obj.EncapsulationMode) if err != nil { + err = core.SDKErrorf(err, "", "encapsulation_mode-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "encryption_algorithm-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, "key_lifetime", &obj.KeyLifetime) if err != nil { + err = core.SDKErrorf(err, "", "key_lifetime-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, "pfs", &obj.Pfs) if err != nil { + err = core.SDKErrorf(err, "", "pfs-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.UnmarshalPrimitive(m, "transform_protocol", &obj.TransformProtocol) if err != nil { + err = core.SDKErrorf(err, "", "transform_protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -46437,22 +52001,27 @@ func UnmarshalIPsecPolicyCollection(m map[string]json.RawMessage, result interfa obj := new(IPsecPolicyCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIPsecPolicyCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ipsec_policies", &obj.IpsecPolicies, UnmarshalIPsecPolicy) if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policies-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, UnmarshalIPsecPolicyCollectionNext) 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)) @@ -46465,8 +52034,11 @@ func (resp *IPsecPolicyCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -46482,6 +52054,7 @@ func UnmarshalIPsecPolicyCollectionFirst(m map[string]json.RawMessage, result in 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)) @@ -46499,6 +52072,7 @@ func UnmarshalIPsecPolicyCollectionNext(m map[string]json.RawMessage, result int 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)) @@ -46580,22 +52154,27 @@ func UnmarshalIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) obj := new(IPsecPolicyPatch) err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "encryption_algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) if err != nil { + err = core.SDKErrorf(err, "", "key_lifetime-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, "pfs", &obj.Pfs) if err != nil { + err = core.SDKErrorf(err, "", "pfs-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -46609,6 +52188,9 @@ func (iPsecPolicyPatch *IPsecPolicyPatch) AsPatch() (_patch map[string]interface if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -46642,22 +52224,27 @@ func UnmarshalIPsecPolicyReference(m map[string]json.RawMessage, result interfac obj := new(IPsecPolicyReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIPsecPolicyReferenceDeleted) 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)) @@ -46676,6 +52263,7 @@ func UnmarshalIPsecPolicyReferenceDeleted(m map[string]json.RawMessage, result i obj := new(IPsecPolicyReferenceDeleted) 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)) @@ -46693,6 +52281,7 @@ func UnmarshalIkePolicyCollectionFirst(m map[string]json.RawMessage, result inte 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)) @@ -46710,6 +52299,7 @@ func UnmarshalIkePolicyCollectionNext(m map[string]json.RawMessage, result inter 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)) @@ -46728,6 +52318,7 @@ func UnmarshalIkePolicyReferenceDeleted(m map[string]json.RawMessage, result int obj := new(IkePolicyReferenceDeleted) 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)) @@ -46866,78 +52457,97 @@ func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error obj := new(Image) err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalImageCatalogOffering) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) if err != nil { + err = core.SDKErrorf(err, "", "deprecation_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) if err != nil { + err = core.SDKErrorf(err, "", "encryption-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, "file", &obj.File, UnmarshalImageFile) if err != nil { + err = core.SDKErrorf(err, "", "file-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, "minimum_provisioned_size", &obj.MinimumProvisionedSize) if err != nil { + err = core.SDKErrorf(err, "", "minimum_provisioned_size-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, "obsolescence_at", &obj.ObsolescenceAt) if err != nil { + err = core.SDKErrorf(err, "", "obsolescence_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) if err != nil { + err = core.SDKErrorf(err, "", "operating_system-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, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) if err != nil { + err = core.SDKErrorf(err, "", "source_volume-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, UnmarshalImageStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "visibility", &obj.Visibility) if err != nil { + err = core.SDKErrorf(err, "", "visibility-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -46964,10 +52574,12 @@ func UnmarshalImageCatalogOffering(m map[string]json.RawMessage, result interfac obj := new(ImageCatalogOffering) err = core.UnmarshalPrimitive(m, "managed", &obj.Managed) if err != nil { + err = core.SDKErrorf(err, "", "managed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -46998,22 +52610,27 @@ func UnmarshalImageCollection(m map[string]json.RawMessage, result interface{}) obj := new(ImageCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalImageCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "images", &obj.Images, UnmarshalImage) if err != nil { + err = core.SDKErrorf(err, "", "images-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, UnmarshalImageCollectionNext) 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)) @@ -47026,8 +52643,11 @@ func (resp *ImageCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -47043,6 +52663,7 @@ func UnmarshalImageCollectionFirst(m map[string]json.RawMessage, result interfac 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)) @@ -47060,6 +52681,7 @@ func UnmarshalImageCollectionNext(m map[string]json.RawMessage, result interface 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)) @@ -47168,58 +52790,72 @@ func UnmarshalImageExportJob(m map[string]json.RawMessage, result interface{}) ( obj := new(ImageExportJob) 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, "encrypted_data_key", &obj.EncryptedDataKey) if err != nil { + err = core.SDKErrorf(err, "", "encrypted_data_key-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "format", &obj.Format) if err != nil { + err = core.SDKErrorf(err, "", "format-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 } err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) if err != nil { + err = core.SDKErrorf(err, "", "started_at-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, UnmarshalImageExportJobStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalCloudObjectStorageBucketReference) if err != nil { + err = core.SDKErrorf(err, "", "storage_bucket-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "storage_href", &obj.StorageHref) if err != nil { + err = core.SDKErrorf(err, "", "storage_href-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "storage_object", &obj.StorageObject, UnmarshalCloudObjectStorageObjectReference) if err != nil { + err = core.SDKErrorf(err, "", "storage_object-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47239,6 +52875,7 @@ func UnmarshalImageExportJobPatch(m map[string]json.RawMessage, result interface obj := new(ImageExportJobPatch) 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)) @@ -47252,6 +52889,9 @@ func (imageExportJobPatch *ImageExportJobPatch) AsPatch() (_patch map[string]int if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -47285,14 +52925,17 @@ func UnmarshalImageExportJobStatusReason(m map[string]json.RawMessage, result in obj := new(ImageExportJobStatusReason) 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)) @@ -47310,6 +52953,7 @@ func UnmarshalImageExportJobUnpaginatedCollection(m map[string]json.RawMessage, obj := new(ImageExportJobUnpaginatedCollection) err = core.UnmarshalModel(m, "export_jobs", &obj.ExportJobs, UnmarshalImageExportJob) if err != nil { + err = core.SDKErrorf(err, "", "export_jobs-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47336,10 +52980,12 @@ func UnmarshalImageFile(m map[string]json.RawMessage, result interface{}) (err e obj := new(ImageFile) err = core.UnmarshalModel(m, "checksums", &obj.Checksums, UnmarshalImageFileChecksums) if err != nil { + err = core.SDKErrorf(err, "", "checksums-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47357,6 +53003,7 @@ func UnmarshalImageFileChecksums(m map[string]json.RawMessage, result interface{ obj := new(ImageFileChecksums) err = core.UnmarshalPrimitive(m, "sha256", &obj.Sha256) if err != nil { + err = core.SDKErrorf(err, "", "sha256-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47378,6 +53025,9 @@ func (*VpcV1) NewImageFilePrototype(href string) (_model *ImageFilePrototype, er Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -47386,6 +53036,7 @@ func UnmarshalImageFilePrototype(m map[string]json.RawMessage, result interface{ obj := new(ImageFilePrototype) 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)) @@ -47421,14 +53072,17 @@ func UnmarshalImageIdentity(m map[string]json.RawMessage, result interface{}) (e obj := new(ImageIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47480,14 +53134,17 @@ func UnmarshalImagePatch(m map[string]json.RawMessage, result interface{}) (err obj := new(ImagePatch) err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) if err != nil { + err = core.SDKErrorf(err, "", "deprecation_at-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, "obsolescence_at", &obj.ObsolescenceAt) if err != nil { + err = core.SDKErrorf(err, "", "obsolescence_at-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47501,6 +53158,9 @@ func (imagePatch *ImagePatch) AsPatch() (_patch map[string]interface{}, err erro if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -47588,38 +53248,47 @@ func UnmarshalImagePrototype(m map[string]json.RawMessage, result interface{}) ( obj := new(ImagePrototype) err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) if err != nil { + err = core.SDKErrorf(err, "", "deprecation_at-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, "obsolescence_at", &obj.ObsolescenceAt) if err != nil { + err = core.SDKErrorf(err, "", "obsolescence_at-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.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) if err != nil { + err = core.SDKErrorf(err, "", "encrypted_data_key-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, "file", &obj.File, UnmarshalImageFilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "file-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) if err != nil { + err = core.SDKErrorf(err, "", "operating_system-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47663,30 +53332,37 @@ func UnmarshalImageReference(m map[string]json.RawMessage, result interface{}) ( obj := new(ImageReference) 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, UnmarshalImageReferenceDeleted) 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, UnmarshalImageRemote) 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)) @@ -47705,6 +53381,7 @@ func UnmarshalImageReferenceDeleted(m map[string]json.RawMessage, result interfa obj := new(ImageReferenceDeleted) 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)) @@ -47728,10 +53405,12 @@ func UnmarshalImageRemote(m map[string]json.RawMessage, result interface{}) (err obj := new(ImageRemote) err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) if err != nil { + err = core.SDKErrorf(err, "", "account-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)) @@ -47795,14 +53474,17 @@ func UnmarshalImageStatusReason(m map[string]json.RawMessage, result interface{} obj := new(ImageStatusReason) 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)) @@ -48010,158 +53692,197 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er obj := new(Instance) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicy) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentReferenceInstanceContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOffering) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "dedicated_host", &obj.DedicatedHost, UnmarshalDedicatedHostReference) if err != nil { + err = core.SDKErrorf(err, "", "dedicated_host-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "gpu", &obj.Gpu, UnmarshalInstanceGpu) if err != nil { + err = core.SDKErrorf(err, "", "gpu-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalInstanceHealthReason) 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.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceLifecycleReason) 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, "memory", &obj.Memory) if err != nil { + err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataService) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentReference) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceInstanceContextReference) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "numa_count", &obj.NumaCount) if err != nil { + err = core.SDKErrorf(err, "", "numa_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTarget) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentReference) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceInstanceContextReference) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation", &obj.Reservation, UnmarshalReservationReference) if err != nil { + err = core.SDKErrorf(err, "", "reservation-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinity) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "startable", &obj.Startable) if err != nil { + err = core.SDKErrorf(err, "", "startable-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, UnmarshalInstanceStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "total_network_bandwidth", &obj.TotalNetworkBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_network_bandwidth-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalInstanceVcpu) if err != nil { + err = core.SDKErrorf(err, "", "vcpu-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceInstanceContext) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-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)) @@ -48222,34 +53943,42 @@ func UnmarshalInstanceAction(m map[string]json.RawMessage, result interface{}) ( obj := new(InstanceAction) 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, "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 } err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) if err != nil { + err = core.SDKErrorf(err, "", "started_at-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.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)) @@ -48284,6 +54013,7 @@ func UnmarshalInstanceAvailabilityPolicy(m map[string]json.RawMessage, result in obj := new(InstanceAvailabilityPolicy) err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) if err != nil { + err = core.SDKErrorf(err, "", "host_failure-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48312,6 +54042,7 @@ func UnmarshalInstanceAvailabilityPolicyPatch(m map[string]json.RawMessage, resu obj := new(InstanceAvailabilityPolicyPatch) err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) if err != nil { + err = core.SDKErrorf(err, "", "host_failure-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48340,6 +54071,7 @@ func UnmarshalInstanceAvailabilityPolicyPrototype(m map[string]json.RawMessage, obj := new(InstanceAvailabilityPolicyPrototype) err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) if err != nil { + err = core.SDKErrorf(err, "", "host_failure-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48362,6 +54094,7 @@ func UnmarshalInstanceCatalogOffering(m map[string]json.RawMessage, result inter obj := new(InstanceCatalogOffering) err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48401,10 +54134,12 @@ func UnmarshalInstanceCatalogOfferingPrototype(m map[string]json.RawMessage, res obj := new(InstanceCatalogOfferingPrototype) err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) if err != nil { + err = core.SDKErrorf(err, "", "offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48435,22 +54170,27 @@ func UnmarshalInstanceCollection(m map[string]json.RawMessage, result interface{ obj := new(InstanceCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceCollectionFirst) 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, UnmarshalInstanceCollectionNext) 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)) @@ -48463,8 +54203,11 @@ func (resp *InstanceCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -48480,6 +54223,7 @@ func UnmarshalInstanceCollectionFirst(m map[string]json.RawMessage, result inter obj := new(InstanceCollectionFirst) 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)) @@ -48497,6 +54241,7 @@ func UnmarshalInstanceCollectionNext(m map[string]json.RawMessage, result interf obj := new(InstanceCollectionNext) 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)) @@ -48537,26 +54282,32 @@ func UnmarshalInstanceConsoleAccessToken(m map[string]json.RawMessage, result in obj := new(InstanceConsoleAccessToken) err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) if err != nil { + err = core.SDKErrorf(err, "", "access_token-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) if err != nil { + err = core.SDKErrorf(err, "", "console_type-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, "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)) @@ -48580,6 +54331,9 @@ func (*VpcV1) NewInstanceDefaultTrustedProfilePrototype(target TrustedProfileIde Target: target, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -48588,10 +54342,12 @@ func UnmarshalInstanceDefaultTrustedProfilePrototype(m map[string]json.RawMessag obj := new(InstanceDefaultTrustedProfilePrototype) err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink) if err != nil { + err = core.SDKErrorf(err, "", "auto_link-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48646,30 +54402,37 @@ func UnmarshalInstanceDisk(m map[string]json.RawMessage, result interface{}) (er obj := new(InstanceDisk) 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, "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.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48687,6 +54450,7 @@ func UnmarshalInstanceDiskCollection(m map[string]json.RawMessage, result interf obj := new(InstanceDiskCollection) err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48704,6 +54468,7 @@ func UnmarshalInstanceDiskPatch(m map[string]json.RawMessage, result interface{} obj := new(InstanceDiskPatch) 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)) @@ -48717,6 +54482,9 @@ func (instanceDiskPatch *InstanceDiskPatch) AsPatch() (_patch map[string]interfa if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -48750,22 +54518,27 @@ func UnmarshalInstanceDiskReference(m map[string]json.RawMessage, result interfa obj := new(InstanceDiskReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceDiskReferenceDeleted) 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)) @@ -48784,6 +54557,7 @@ func UnmarshalInstanceDiskReferenceDeleted(m map[string]json.RawMessage, result obj := new(InstanceDiskReferenceDeleted) 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)) @@ -48810,18 +54584,22 @@ func UnmarshalInstanceGpu(m map[string]json.RawMessage, result interface{}) (err obj := new(InstanceGpu) err = core.UnmarshalPrimitive(m, "count", &obj.Count) if err != nil { + err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) if err != nil { + err = core.SDKErrorf(err, "", "manufacturer-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) if err != nil { + err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "model", &obj.Model) if err != nil { + err = core.SDKErrorf(err, "", "model-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48851,6 +54629,13 @@ type InstanceGroup struct { InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` // The reasons for the current `lifecycle_state` (if any). +<<<<<<< Updated upstream +======= + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. +>>>>>>> Stashed changes LifecycleReasons []InstanceGroupLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the instance group. @@ -48920,26 +54705,42 @@ func UnmarshalInstanceGroup(m map[string]json.RawMessage, result interface{}) (e obj := new(InstanceGroup) err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) if err != nil { + err = core.SDKErrorf(err, "", "application_port-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) if err != nil { + err = core.SDKErrorf(err, "", "instance_template-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceGroupLifecycleReason) + 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceGroupLifecycleReason) @@ -48952,38 +54753,47 @@ func UnmarshalInstanceGroup(m map[string]json.RawMessage, result interface{}) (e } err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolReference) if err != nil { + err = core.SDKErrorf(err, "", "load_balancer_pool-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManagerReference) if err != nil { + err = core.SDKErrorf(err, "", "managers-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "membership_count-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-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, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49014,22 +54824,27 @@ func UnmarshalInstanceGroupCollection(m map[string]json.RawMessage, result inter obj := new(InstanceGroupCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "instance_groups", &obj.InstanceGroups, UnmarshalInstanceGroup) if err != nil { + err = core.SDKErrorf(err, "", "instance_groups-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, UnmarshalInstanceGroupCollectionNext) 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)) @@ -49042,8 +54857,11 @@ func (resp *InstanceGroupCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -49059,6 +54877,7 @@ func UnmarshalInstanceGroupCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -49076,6 +54895,47 @@ func UnmarshalInstanceGroupCollectionNext(m map[string]json.RawMessage, result i 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 snake case string succinctly identifying the reason for this lifecycle state. + 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 InstanceGroupLifecycleReason.Code property. +// A snake case string succinctly identifying the reason for this lifecycle state. +const ( + InstanceGroupLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalInstanceGroupLifecycleReason unmarshals an instance of InstanceGroupLifecycleReason from the specified map of raw messages. +func UnmarshalInstanceGroupLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupLifecycleReason) + 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)) @@ -49193,54 +55053,67 @@ func UnmarshalInstanceGroupManager(m map[string]json.RawMessage, result interfac obj := new(InstanceGroupManager) 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, "management_enabled", &obj.ManagementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "management_enabled-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, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) if err != nil { + err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) if err != nil { + err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) if err != nil { + err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) if err != nil { + err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference) if err != nil { + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49347,62 +55220,77 @@ func UnmarshalInstanceGroupManagerAction(m map[string]json.RawMessage, result in obj := new(InstanceGroupManagerAction) 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_timeout", &obj.AutoDeleteTimeout) if err != nil { + err = core.SDKErrorf(err, "", "auto_delete_timeout-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, "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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) if err != nil { + err = core.SDKErrorf(err, "", "action_type-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.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) if err != nil { + err = core.SDKErrorf(err, "", "last_applied_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) if err != nil { + err = core.SDKErrorf(err, "", "next_run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) if err != nil { + err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49420,6 +55308,7 @@ func UnmarshalInstanceGroupManagerActionGroupPatch(m map[string]json.RawMessage, obj := new(InstanceGroupManagerActionGroupPatch) err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49440,10 +55329,12 @@ func UnmarshalInstanceGroupManagerActionManagerPatch(m map[string]json.RawMessag obj := new(InstanceGroupManagerActionManagerPatch) err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49473,22 +55364,27 @@ func UnmarshalInstanceGroupManagerActionPatch(m map[string]json.RawMessage, resu obj := new(InstanceGroupManagerActionPatch) 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, "group", &obj.Group, UnmarshalInstanceGroupManagerActionGroupPatch) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerActionManagerPatch) if err != nil { + err = core.SDKErrorf(err, "", "manager-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, "run_at", &obj.RunAt) if err != nil { + err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49502,6 +55398,9 @@ func (instanceGroupManagerActionPatch *InstanceGroupManagerActionPatch) AsPatch( if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -49538,22 +55437,27 @@ func UnmarshalInstanceGroupManagerActionPrototype(m map[string]json.RawMessage, obj := new(InstanceGroupManagerActionPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) if err != nil { + err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manager-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49591,22 +55495,27 @@ func UnmarshalInstanceGroupManagerActionReference(m map[string]json.RawMessage, obj := new(InstanceGroupManagerActionReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerActionReferenceDeleted) 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)) @@ -49625,6 +55534,7 @@ func UnmarshalInstanceGroupManagerActionReferenceDeleted(m map[string]json.RawMe obj := new(InstanceGroupManagerActionReferenceDeleted) 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)) @@ -49655,22 +55565,27 @@ func UnmarshalInstanceGroupManagerActionsCollection(m map[string]json.RawMessage obj := new(InstanceGroupManagerActionsCollection) err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerAction) if err != nil { + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerActionsCollectionFirst) 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, UnmarshalInstanceGroupManagerActionsCollectionNext) 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)) @@ -49683,8 +55598,11 @@ func (resp *InstanceGroupManagerActionsCollection) GetNextStart() (*string, erro return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -49700,6 +55618,7 @@ func UnmarshalInstanceGroupManagerActionsCollectionFirst(m map[string]json.RawMe 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)) @@ -49717,6 +55636,7 @@ func UnmarshalInstanceGroupManagerActionsCollectionNext(m map[string]json.RawMes 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)) @@ -49747,22 +55667,27 @@ func UnmarshalInstanceGroupManagerCollection(m map[string]json.RawMessage, resul obj := new(InstanceGroupManagerCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerCollectionFirst) 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, "managers", &obj.Managers, UnmarshalInstanceGroupManager) if err != nil { + err = core.SDKErrorf(err, "", "managers-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerCollectionNext) 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)) @@ -49775,8 +55700,11 @@ func (resp *InstanceGroupManagerCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -49792,6 +55720,7 @@ func UnmarshalInstanceGroupManagerCollectionFirst(m map[string]json.RawMessage, 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)) @@ -49809,6 +55738,7 @@ func UnmarshalInstanceGroupManagerCollectionNext(m map[string]json.RawMessage, r 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)) @@ -49841,26 +55771,32 @@ func UnmarshalInstanceGroupManagerPatch(m map[string]json.RawMessage, result int obj := new(InstanceGroupManagerPatch) err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) if err != nil { + err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) if err != nil { + err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "management_enabled-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-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)) @@ -49874,6 +55810,9 @@ func (instanceGroupManagerPatch *InstanceGroupManagerPatch) AsPatch() (_patch ma if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -49935,34 +55874,42 @@ func UnmarshalInstanceGroupManagerPolicy(m map[string]json.RawMessage, result in obj := new(InstanceGroupManagerPolicy) 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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) if err != nil { + err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) if err != nil { + err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) if err != nil { + err = core.SDKErrorf(err, "", "policy_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49993,22 +55940,27 @@ func UnmarshalInstanceGroupManagerPolicyCollection(m map[string]json.RawMessage, obj := new(InstanceGroupManagerPolicyCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerPolicyCollectionFirst) 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, UnmarshalInstanceGroupManagerPolicyCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicy) if err != nil { + err = core.SDKErrorf(err, "", "policies-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)) @@ -50021,8 +55973,11 @@ func (resp *InstanceGroupManagerPolicyCollection) GetNextStart() (*string, error return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -50038,6 +55993,7 @@ func UnmarshalInstanceGroupManagerPolicyCollectionFirst(m map[string]json.RawMes 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)) @@ -50055,6 +56011,7 @@ func UnmarshalInstanceGroupManagerPolicyCollectionNext(m map[string]json.RawMess 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)) @@ -50088,14 +56045,17 @@ func UnmarshalInstanceGroupManagerPolicyPatch(m map[string]json.RawMessage, resu obj := new(InstanceGroupManagerPolicyPatch) err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) if err != nil { + err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) if err != nil { + err = core.SDKErrorf(err, "", "metric_value-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)) @@ -50109,6 +56069,9 @@ func (instanceGroupManagerPolicyPatch *InstanceGroupManagerPolicyPatch) AsPatch( if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -50158,18 +56121,22 @@ func UnmarshalInstanceGroupManagerPolicyPrototype(m map[string]json.RawMessage, obj := new(InstanceGroupManagerPolicyPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) if err != nil { + err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) if err != nil { + err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) if err != nil { + err = core.SDKErrorf(err, "", "policy_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50198,18 +56165,22 @@ func UnmarshalInstanceGroupManagerPolicyReference(m map[string]json.RawMessage, obj := new(InstanceGroupManagerPolicyReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerPolicyReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50228,6 +56199,7 @@ func UnmarshalInstanceGroupManagerPolicyReferenceDeleted(m map[string]json.RawMe obj := new(InstanceGroupManagerPolicyReferenceDeleted) 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)) @@ -50281,30 +56253,37 @@ func UnmarshalInstanceGroupManagerPrototype(m map[string]json.RawMessage, result obj := new(InstanceGroupManagerPrototype) err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "management_enabled-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, "aggregation_window", &obj.AggregationWindow) if err != nil { + err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) if err != nil { + err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) if err != nil { + err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50332,18 +56311,22 @@ func UnmarshalInstanceGroupManagerReference(m map[string]json.RawMessage, result obj := new(InstanceGroupManagerReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50362,6 +56345,7 @@ func UnmarshalInstanceGroupManagerReferenceDeleted(m map[string]json.RawMessage, obj := new(InstanceGroupManagerReferenceDeleted) 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)) @@ -50379,6 +56363,7 @@ func UnmarshalInstanceGroupManagerScheduledActionGroup(m map[string]json.RawMess obj := new(InstanceGroupManagerScheduledActionGroup) err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50397,6 +56382,9 @@ func (*VpcV1) NewInstanceGroupManagerScheduledActionGroupPrototype(membershipCou MembershipCount: core.Int64Ptr(membershipCount), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -50405,6 +56393,7 @@ func UnmarshalInstanceGroupManagerScheduledActionGroupPrototype(m map[string]jso obj := new(InstanceGroupManagerScheduledActionGroupPrototype) err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50448,26 +56437,32 @@ func UnmarshalInstanceGroupManagerScheduledActionManager(m map[string]json.RawMe obj := new(InstanceGroupManagerScheduledActionManager) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) 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, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50504,18 +56499,22 @@ func UnmarshalInstanceGroupManagerScheduledActionManagerPrototype(m map[string]j obj := new(InstanceGroupManagerScheduledActionManagerPrototype) err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50577,42 +56576,52 @@ func UnmarshalInstanceGroupMembership(m map[string]json.RawMessage, result inter obj := new(InstanceGroupMembership) 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, "delete_instance_on_membership_delete", &obj.DeleteInstanceOnMembershipDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_instance_on_membership_delete-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, "instance", &obj.Instance, UnmarshalInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) if err != nil { + err = core.SDKErrorf(err, "", "instance_template-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, "pool_member", &obj.PoolMember, UnmarshalLoadBalancerPoolMemberReference) if err != nil { + err = core.SDKErrorf(err, "", "pool_member-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.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50643,22 +56652,27 @@ func UnmarshalInstanceGroupMembershipCollection(m map[string]json.RawMessage, re obj := new(InstanceGroupMembershipCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupMembershipCollectionFirst) 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, "memberships", &obj.Memberships, UnmarshalInstanceGroupMembership) if err != nil { + err = core.SDKErrorf(err, "", "memberships-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupMembershipCollectionNext) 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)) @@ -50671,8 +56685,11 @@ func (resp *InstanceGroupMembershipCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -50688,6 +56705,7 @@ func UnmarshalInstanceGroupMembershipCollectionFirst(m map[string]json.RawMessag 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)) @@ -50705,6 +56723,7 @@ func UnmarshalInstanceGroupMembershipCollectionNext(m map[string]json.RawMessage 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)) @@ -50723,6 +56742,7 @@ func UnmarshalInstanceGroupMembershipPatch(m map[string]json.RawMessage, result obj := new(InstanceGroupMembershipPatch) 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)) @@ -50736,6 +56756,9 @@ func (instanceGroupMembershipPatch *InstanceGroupMembershipPatch) AsPatch() (_pa if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -50780,30 +56803,37 @@ func UnmarshalInstanceGroupPatch(m map[string]json.RawMessage, result interface{ obj := new(InstanceGroupPatch) err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) if err != nil { + err = core.SDKErrorf(err, "", "application_port-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateIdentity) if err != nil { + err = core.SDKErrorf(err, "", "instance_template-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "load_balancer", &obj.LoadBalancer, UnmarshalLoadBalancerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "load_balancer-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolIdentity) if err != nil { + err = core.SDKErrorf(err, "", "load_balancer_pool-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "membership_count-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, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50817,6 +56847,9 @@ func (instanceGroupPatch *InstanceGroupPatch) AsPatch() (_patch map[string]inter if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -50844,22 +56877,27 @@ func UnmarshalInstanceGroupReference(m map[string]json.RawMessage, result interf obj := new(InstanceGroupReference) 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, UnmarshalInstanceGroupReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50878,6 +56916,7 @@ func UnmarshalInstanceGroupReferenceDeleted(m map[string]json.RawMessage, result obj := new(InstanceGroupReferenceDeleted) 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)) @@ -50926,14 +56965,17 @@ func UnmarshalInstanceHealthReason(m map[string]json.RawMessage, result interfac obj := new(InstanceHealthReason) 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)) @@ -50957,14 +56999,17 @@ func UnmarshalInstanceInitialization(m map[string]json.RawMessage, result interf obj := new(InstanceInitialization) err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceInitializationDefaultTrustedProfile) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "password", &obj.Password, UnmarshalInstanceInitializationPassword) if err != nil { + err = core.SDKErrorf(err, "", "password-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50987,10 +57032,12 @@ func UnmarshalInstanceInitializationDefaultTrustedProfile(m map[string]json.RawM obj := new(InstanceInitializationDefaultTrustedProfile) err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink) if err != nil { + err = core.SDKErrorf(err, "", "auto_link-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51011,10 +57058,12 @@ func UnmarshalInstanceInitializationPassword(m map[string]json.RawMessage, resul obj := new(InstanceInitializationPassword) err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) if err != nil { + err = core.SDKErrorf(err, "", "encrypted_password-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyIdentityByFingerprint) if err != nil { + err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51054,14 +57103,17 @@ func UnmarshalInstanceLifecycleReason(m map[string]json.RawMessage, result inter obj := new(InstanceLifecycleReason) 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)) @@ -51099,14 +57151,17 @@ func UnmarshalInstanceMetadataService(m map[string]json.RawMessage, result inter obj := new(InstanceMetadataService) err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) if err != nil { + err = core.SDKErrorf(err, "", "enabled-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.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) if err != nil { + err = core.SDKErrorf(err, "", "response_hop_limit-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51144,14 +57199,17 @@ func UnmarshalInstanceMetadataServicePatch(m map[string]json.RawMessage, result obj := new(InstanceMetadataServicePatch) err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) if err != nil { + err = core.SDKErrorf(err, "", "enabled-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.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) if err != nil { + err = core.SDKErrorf(err, "", "response_hop_limit-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51189,14 +57247,17 @@ func UnmarshalInstanceMetadataServicePrototype(m map[string]json.RawMessage, res obj := new(InstanceMetadataServicePrototype) err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) if err != nil { + err = core.SDKErrorf(err, "", "enabled-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.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) if err != nil { + err = core.SDKErrorf(err, "", "response_hop_limit-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51270,46 +57331,57 @@ func UnmarshalInstanceNetworkAttachment(m map[string]json.RawMessage, result int obj := new(InstanceNetworkAttachment) 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, "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, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-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)) @@ -51327,6 +57399,7 @@ func UnmarshalInstanceNetworkAttachmentCollection(m map[string]json.RawMessage, obj := new(InstanceNetworkAttachmentCollection) err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51344,6 +57417,7 @@ func UnmarshalInstanceNetworkAttachmentPatch(m map[string]json.RawMessage, resul obj := new(InstanceNetworkAttachmentPatch) 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)) @@ -51357,6 +57431,9 @@ func (instanceNetworkAttachmentPatch *InstanceNetworkAttachmentPatch) AsPatch() if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -51381,6 +57458,9 @@ func (*VpcV1) NewInstanceNetworkAttachmentPrototype(virtualNetworkInterface Inst VirtualNetworkInterface: virtualNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -51389,10 +57469,12 @@ func UnmarshalInstanceNetworkAttachmentPrototype(m map[string]json.RawMessage, r obj := new(InstanceNetworkAttachmentPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51490,50 +57572,62 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface(m map[st obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) 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 } 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.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) 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()) 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)) @@ -51577,30 +57671,37 @@ func UnmarshalInstanceNetworkAttachmentReference(m map[string]json.RawMessage, r obj := new(InstanceNetworkAttachmentReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51619,6 +57720,7 @@ func UnmarshalInstanceNetworkAttachmentReferenceDeleted(m map[string]json.RawMes obj := new(InstanceNetworkAttachmentReferenceDeleted) 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)) @@ -51670,30 +57772,37 @@ func UnmarshalInstancePatch(m map[string]json.RawMessage, result interface{}) (e obj := new(InstancePatch) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPatch) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePatch) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPatch) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstancePatchProfile) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPatch) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51707,6 +57816,9 @@ func (instancePatch *InstancePatch) AsPatch() (_patch map[string]interface{}, er if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -51746,10 +57858,12 @@ func UnmarshalInstancePatchProfile(m map[string]json.RawMessage, result interfac obj := new(InstancePatchProfile) 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)) @@ -51801,26 +57915,32 @@ func UnmarshalInstancePlacementTarget(m map[string]json.RawMessage, result inter obj := new(InstancePlacementTarget) 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, UnmarshalDedicatedHostGroupReferenceDeleted) 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)) @@ -51855,14 +57975,17 @@ func UnmarshalInstancePlacementTargetPatch(m map[string]json.RawMessage, result obj := new(InstancePlacementTargetPatch) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51898,14 +58021,17 @@ func UnmarshalInstancePlacementTargetPrototype(m map[string]json.RawMessage, res obj := new(InstancePlacementTargetPrototype) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52003,90 +58129,112 @@ func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) obj := new(InstanceProfile) err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalInstanceProfileBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceProfileDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "gpu_count", &obj.GpuCount, UnmarshalInstanceProfileGpu) if err != nil { + err = core.SDKErrorf(err, "", "gpu_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "gpu_manufacturer", &obj.GpuManufacturer, UnmarshalInstanceProfileGpuManufacturer) if err != nil { + err = core.SDKErrorf(err, "", "gpu_manufacturer-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "gpu_memory", &obj.GpuMemory, UnmarshalInstanceProfileGpuMemory) if err != nil { + err = core.SDKErrorf(err, "", "gpu_memory-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "gpu_model", &obj.GpuModel, UnmarshalInstanceProfileGpuModel) if err != nil { + err = core.SDKErrorf(err, "", "gpu_model-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.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalInstanceProfileMemory) if err != nil { + err = core.SDKErrorf(err, "", "memory-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, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalInstanceProfileNetworkAttachmentCount) if err != nil { + err = core.SDKErrorf(err, "", "network_attachment_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalInstanceProfileNetworkInterfaceCount) if err != nil { + err = core.SDKErrorf(err, "", "network_interface_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "numa_count", &obj.NumaCount, UnmarshalInstanceProfileNumaCount) if err != nil { + err = core.SDKErrorf(err, "", "numa_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalInstanceProfileOsArchitecture) if err != nil { + err = core.SDKErrorf(err, "", "os_architecture-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "port_speed", &obj.PortSpeed, UnmarshalInstanceProfilePortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_terms", &obj.ReservationTerms, UnmarshalInstanceProfileReservationTerms) if err != nil { + err = core.SDKErrorf(err, "", "reservation_terms-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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-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()) return } err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalInstanceProfileVcpuArchitecture) if err != nil { + err = core.SDKErrorf(err, "", "vcpu_architecture-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalInstanceProfileVcpu) if err != nil { + err = core.SDKErrorf(err, "", "vcpu_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalInstanceProfileVcpuManufacturer) if err != nil { + err = core.SDKErrorf(err, "", "vcpu_manufacturer-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52141,30 +58289,37 @@ func UnmarshalInstanceProfileBandwidth(m map[string]json.RawMessage, result inte obj := new(InstanceProfileBandwidth) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52182,6 +58337,7 @@ func UnmarshalInstanceProfileCollection(m map[string]json.RawMessage, result int obj := new(InstanceProfileCollection) err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalInstanceProfile) if err != nil { + err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52202,14 +58358,17 @@ func UnmarshalInstanceProfileDisk(m map[string]json.RawMessage, result interface obj := new(InstanceProfileDisk) err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalInstanceProfileDiskQuantity) if err != nil { + err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalInstanceProfileDiskSize) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalInstanceProfileDiskSupportedInterfaces) if err != nil { + err = core.SDKErrorf(err, "", "supported_interface_types-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52264,30 +58423,37 @@ func UnmarshalInstanceProfileDiskQuantity(m map[string]json.RawMessage, result i obj := new(InstanceProfileDiskQuantity) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52342,30 +58508,37 @@ func UnmarshalInstanceProfileDiskSize(m map[string]json.RawMessage, result inter obj := new(InstanceProfileDiskSize) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52418,14 +58591,17 @@ func UnmarshalInstanceProfileDiskSupportedInterfaces(m map[string]json.RawMessag obj := new(InstanceProfileDiskSupportedInterfaces) 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)) @@ -52480,30 +58656,37 @@ func UnmarshalInstanceProfileGpu(m map[string]json.RawMessage, result interface{ obj := new(InstanceProfileGpu) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52530,10 +58713,12 @@ func UnmarshalInstanceProfileGpuManufacturer(m map[string]json.RawMessage, resul obj := new(InstanceProfileGpuManufacturer) 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)) @@ -52588,30 +58773,37 @@ func UnmarshalInstanceProfileGpuMemory(m map[string]json.RawMessage, result inte obj := new(InstanceProfileGpuMemory) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52638,10 +58830,12 @@ func UnmarshalInstanceProfileGpuModel(m map[string]json.RawMessage, result inter obj := new(InstanceProfileGpuModel) 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)) @@ -52673,10 +58867,12 @@ func UnmarshalInstanceProfileIdentity(m map[string]json.RawMessage, result inter obj := new(InstanceProfileIdentity) 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)) @@ -52731,30 +58927,37 @@ func UnmarshalInstanceProfileMemory(m map[string]json.RawMessage, result interfa obj := new(InstanceProfileMemory) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52792,10 +58995,12 @@ func UnmarshalInstanceProfileNumaCount(m map[string]json.RawMessage, result inte obj := new(InstanceProfileNumaCount) 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)) @@ -52836,14 +59041,17 @@ func UnmarshalInstanceProfileNetworkAttachmentCount(m map[string]json.RawMessage obj := new(InstanceProfileNetworkAttachmentCount) 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52884,14 +59092,17 @@ func UnmarshalInstanceProfileNetworkInterfaceCount(m map[string]json.RawMessage, obj := new(InstanceProfileNetworkInterfaceCount) 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52921,14 +59132,17 @@ func UnmarshalInstanceProfileOsArchitecture(m map[string]json.RawMessage, result obj := new(InstanceProfileOsArchitecture) 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)) @@ -52966,10 +59180,12 @@ func UnmarshalInstanceProfilePortSpeed(m map[string]json.RawMessage, result inte obj := new(InstanceProfilePortSpeed) 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)) @@ -52999,14 +59215,17 @@ func UnmarshalInstanceProfileReference(m map[string]json.RawMessage, result inte obj := new(InstanceProfileReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -53039,10 +59258,12 @@ func UnmarshalInstanceProfileReservationTerms(m map[string]json.RawMessage, resu obj := new(InstanceProfileReservationTerms) 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)) @@ -53097,30 +59318,37 @@ func UnmarshalInstanceProfileVcpu(m map[string]json.RawMessage, result interface obj := new(InstanceProfileVcpu) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53150,14 +59378,17 @@ func UnmarshalInstanceProfileVcpuArchitecture(m map[string]json.RawMessage, resu obj := new(InstanceProfileVcpuArchitecture) 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, "value", &obj.Value) if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53187,14 +59418,17 @@ func UnmarshalInstanceProfileVcpuManufacturer(m map[string]json.RawMessage, resu obj := new(InstanceProfileVcpuManufacturer) 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, "value", &obj.Value) if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53249,30 +59483,37 @@ func UnmarshalInstanceProfileVolumeBandwidth(m map[string]json.RawMessage, resul obj := new(InstanceProfileVolumeBandwidth) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53404,90 +59645,112 @@ func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{} obj := new(InstancePrototype) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_template-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53518,22 +59781,27 @@ func UnmarshalInstanceReference(m map[string]json.RawMessage, result interface{} obj := new(InstanceReference) 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, UnmarshalInstanceReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53552,6 +59820,7 @@ func UnmarshalInstanceReferenceDeleted(m map[string]json.RawMessage, result inte obj := new(InstanceReferenceDeleted) 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)) @@ -53583,10 +59852,12 @@ func UnmarshalInstanceReservationAffinity(m map[string]json.RawMessage, result i obj := new(InstanceReservationAffinity) err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) if err != nil { + err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationReference) if err != nil { + err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53625,10 +59896,12 @@ func UnmarshalInstanceReservationAffinityPatch(m map[string]json.RawMessage, res obj := new(InstanceReservationAffinityPatch) err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) if err != nil { + err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity) if err != nil { + err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53670,10 +59943,12 @@ func UnmarshalInstanceReservationAffinityPrototype(m map[string]json.RawMessage, obj := new(InstanceReservationAffinityPrototype) err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) if err != nil { + err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity) if err != nil { + err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53720,14 +59995,17 @@ func UnmarshalInstanceStatusReason(m map[string]json.RawMessage, result interfac obj := new(InstanceStatusReason) 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)) @@ -53862,102 +60140,127 @@ func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) obj := new(InstanceTemplate) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53988,22 +60291,27 @@ func UnmarshalInstanceTemplateCollection(m map[string]json.RawMessage, result in obj := new(InstanceTemplateCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceTemplateCollectionFirst) 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, UnmarshalInstanceTemplateCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "templates", &obj.Templates, UnmarshalInstanceTemplate) if err != nil { + err = core.SDKErrorf(err, "", "templates-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)) @@ -54021,6 +60329,7 @@ func UnmarshalInstanceTemplateCollectionFirst(m map[string]json.RawMessage, resu 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)) @@ -54038,6 +60347,7 @@ func UnmarshalInstanceTemplateCollectionNext(m map[string]json.RawMessage, resul 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)) @@ -54073,14 +60383,17 @@ func UnmarshalInstanceTemplateIdentity(m map[string]json.RawMessage, result inte obj := new(InstanceTemplateIdentity) 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 } 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)) @@ -54098,6 +60411,7 @@ func UnmarshalInstanceTemplatePatch(m map[string]json.RawMessage, result interfa obj := new(InstanceTemplatePatch) 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)) @@ -54111,6 +60425,9 @@ func (instanceTemplatePatch *InstanceTemplatePatch) AsPatch() (_patch map[string if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -54238,90 +60555,112 @@ func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result int obj := new(InstanceTemplatePrototype) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_template-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -54352,22 +60691,27 @@ func UnmarshalInstanceTemplateReference(m map[string]json.RawMessage, result int obj := new(InstanceTemplateReference) 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, UnmarshalInstanceTemplateReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -54386,6 +60730,7 @@ func UnmarshalInstanceTemplateReferenceDeleted(m map[string]json.RawMessage, res obj := new(InstanceTemplateReferenceDeleted) 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)) @@ -54409,14 +60754,17 @@ func UnmarshalInstanceVcpu(m map[string]json.RawMessage, result interface{}) (er obj := new(InstanceVcpu) err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) if err != nil { + err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "count", &obj.Count) if err != nil { + err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) if err != nil { + err = core.SDKErrorf(err, "", "manufacturer-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -54470,42 +60818,52 @@ func UnmarshalKey(m map[string]json.RawMessage, result interface{}) (err error) obj := new(Key) 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.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) if err != nil { + err = core.SDKErrorf(err, "", "fingerprint-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, "length", &obj.Length) if err != nil { + err = core.SDKErrorf(err, "", "length-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, "public_key", &obj.PublicKey) if err != nil { + err = core.SDKErrorf(err, "", "public_key-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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -54536,22 +60894,27 @@ func UnmarshalKeyCollection(m map[string]json.RawMessage, result interface{}) (e obj := new(KeyCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalKeyCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKey) if err != nil { + err = core.SDKErrorf(err, "", "keys-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, UnmarshalKeyCollectionNext) 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)) @@ -54564,8 +60927,11 @@ func (resp *KeyCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -54581,6 +60947,7 @@ func UnmarshalKeyCollectionFirst(m map[string]json.RawMessage, result interface{ 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)) @@ -54598,6 +60965,7 @@ func UnmarshalKeyCollectionNext(m map[string]json.RawMessage, result interface{} 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)) @@ -54638,18 +61006,22 @@ func UnmarshalKeyIdentity(m map[string]json.RawMessage, result interface{}) (err obj := new(KeyIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) if err != nil { + err = core.SDKErrorf(err, "", "fingerprint-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -54667,6 +61039,7 @@ func UnmarshalKeyPatch(m map[string]json.RawMessage, result interface{}) (err er obj := new(KeyPatch) 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)) @@ -54680,6 +61053,9 @@ func (keyPatch *KeyPatch) AsPatch() (_patch map[string]interface{}, err error) { if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -54711,26 +61087,32 @@ func UnmarshalKeyReference(m map[string]json.RawMessage, result interface{}) (er obj := new(KeyReference) 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, UnmarshalKeyReferenceDeleted) if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) if err != nil { + err = core.SDKErrorf(err, "", "fingerprint-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -54749,6 +61131,7 @@ func UnmarshalKeyReferenceDeleted(m map[string]json.RawMessage, result interface obj := new(KeyReferenceDeleted) 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)) @@ -54776,6 +61159,7 @@ func UnmarshalLegacyCloudObjectStorageBucketIdentity(m map[string]json.RawMessag obj := new(LegacyCloudObjectStorageBucketIdentity) 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)) @@ -54793,6 +61177,7 @@ func UnmarshalLegacyCloudObjectStorageBucketReference(m map[string]json.RawMessa obj := new(LegacyCloudObjectStorageBucketReference) 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)) @@ -59543,98 +65928,122 @@ func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (er obj := new(LoadBalancer) 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, "dns", &obj.Dns, UnmarshalLoadBalancerDns) if err != nil { + err = core.SDKErrorf(err, "", "dns-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) if err != nil { + err = core.SDKErrorf(err, "", "hostname-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, "instance_groups_supported", &obj.InstanceGroupsSupported) if err != nil { + err = core.SDKErrorf(err, "", "instance_groups_supported-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "is_public", &obj.IsPublic) if err != nil { + err = core.SDKErrorf(err, "", "is_public-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListenerReference) if err != nil { + err = core.SDKErrorf(err, "", "listeners-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLogging) if err != nil { + err = core.SDKErrorf(err, "", "logging-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, "operating_status", &obj.OperatingStatus) if err != nil { + err = core.SDKErrorf(err, "", "operating_status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPoolReference) if err != nil { + err = core.SDKErrorf(err, "", "pools-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalLoadBalancerPrivateIpsItem) if err != nil { + err = core.SDKErrorf(err, "", "private_ips-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalLoadBalancerProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) if err != nil { + err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_ips", &obj.PublicIps, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "public_ips-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.UnmarshalPrimitive(m, "route_mode", &obj.RouteMode) if err != nil { + err = core.SDKErrorf(err, "", "route_mode-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "security_groups_supported", &obj.SecurityGroupsSupported) if err != nil { + err = core.SDKErrorf(err, "", "security_groups_supported-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "udp_supported", &obj.UDPSupported) if err != nil { + err = core.SDKErrorf(err, "", "udp_supported-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -59665,22 +66074,27 @@ func UnmarshalLoadBalancerCollection(m map[string]json.RawMessage, result interf obj := new(LoadBalancerCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalLoadBalancerCollectionFirst) 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, "load_balancers", &obj.LoadBalancers, UnmarshalLoadBalancer) if err != nil { + err = core.SDKErrorf(err, "", "load_balancers-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerCollectionNext) 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)) @@ -59693,8 +66107,11 @@ func (resp *LoadBalancerCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -59710,6 +66127,7 @@ func UnmarshalLoadBalancerCollectionFirst(m map[string]json.RawMessage, result i 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)) @@ -59727,6 +66145,7 @@ func UnmarshalLoadBalancerCollectionNext(m map[string]json.RawMessage, result in 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)) @@ -59750,10 +66169,12 @@ func UnmarshalLoadBalancerDns(m map[string]json.RawMessage, result interface{}) obj := new(LoadBalancerDns) err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneReference) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -59782,10 +66203,12 @@ func UnmarshalLoadBalancerDnsPatch(m map[string]json.RawMessage, result interfac obj := new(LoadBalancerDnsPatch) err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity) if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -59816,6 +66239,9 @@ func (*VpcV1) NewLoadBalancerDnsPrototype(instance DnsInstanceIdentityIntf, zone Zone: zone, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -59824,10 +66250,12 @@ func UnmarshalLoadBalancerDnsPrototype(m map[string]json.RawMessage, result inte obj := new(LoadBalancerDnsPrototype) err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity) if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -59863,14 +66291,17 @@ func UnmarshalLoadBalancerIdentity(m map[string]json.RawMessage, result interfac obj := new(LoadBalancerIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -59976,62 +66407,77 @@ func UnmarshalLoadBalancerListener(m map[string]json.RawMessage, result interfac obj := new(LoadBalancerListener) err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) if err != nil { + err = core.SDKErrorf(err, "", "accept_proxy_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "certificate_instance-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) if err != nil { + err = core.SDKErrorf(err, "", "connection_limit-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, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolReference) if err != nil { + err = core.SDKErrorf(err, "", "default_pool-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.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirect) if err != nil { + err = core.SDKErrorf(err, "", "https_redirect-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, "idle_connection_timeout", &obj.IdleConnectionTimeout) if err != nil { + err = core.SDKErrorf(err, "", "idle_connection_timeout-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicyReference) if err != nil { + err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-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 } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) if err != nil { + err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60049,6 +66495,7 @@ func UnmarshalLoadBalancerListenerCollection(m map[string]json.RawMessage, resul obj := new(LoadBalancerListenerCollection) err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListener) if err != nil { + err = core.SDKErrorf(err, "", "listeners-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60114,14 +66561,17 @@ func UnmarshalLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, re obj := new(LoadBalancerListenerHTTPSRedirect) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60145,14 +66595,17 @@ func UnmarshalLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessag obj := new(LoadBalancerListenerHTTPSRedirectPatch) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60178,6 +66631,9 @@ func (*VpcV1) NewLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64 Listener: listener, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -60186,14 +66642,17 @@ func UnmarshalLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMe obj := new(LoadBalancerListenerHTTPSRedirectPrototype) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60225,10 +66684,12 @@ func UnmarshalLoadBalancerListenerIdentity(m map[string]json.RawMessage, result obj := new(LoadBalancerListenerIdentity) 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)) @@ -60339,42 +66800,52 @@ func UnmarshalLoadBalancerListenerPatch(m map[string]json.RawMessage, result int obj := new(LoadBalancerListenerPatch) err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) if err != nil { + err = core.SDKErrorf(err, "", "accept_proxy_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) if err != nil { + err = core.SDKErrorf(err, "", "certificate_instance-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) if err != nil { + err = core.SDKErrorf(err, "", "connection_limit-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerListenerDefaultPoolPatch) if err != nil { + err = core.SDKErrorf(err, "", "default_pool-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPatch) if err != nil { + err = core.SDKErrorf(err, "", "https_redirect-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) if err != nil { + err = core.SDKErrorf(err, "", "idle_connection_timeout-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-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 } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60388,6 +66859,9 @@ func (loadBalancerListenerPatch *LoadBalancerListenerPatch) AsPatch() (_patch ma if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -60476,38 +66950,47 @@ func UnmarshalLoadBalancerListenerPolicy(m map[string]json.RawMessage, result in obj := new(LoadBalancerListenerPolicy) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) if err != nil { + err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRuleReference) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTarget) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60525,6 +67008,7 @@ func UnmarshalLoadBalancerListenerPolicyCollection(m map[string]json.RawMessage, obj := new(LoadBalancerListenerPolicyCollection) err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicy) if err != nil { + err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60543,7 +67027,10 @@ type LoadBalancerListenerPolicyPatch struct { // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPatch`. +<<<<<<< Updated upstream // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. +======= +>>>>>>> Stashed changes Target LoadBalancerListenerPolicyTargetPatchIntf `json:"target,omitempty"` } @@ -60552,14 +67039,17 @@ func UnmarshalLoadBalancerListenerPolicyPatch(m map[string]json.RawMessage, resu obj := new(LoadBalancerListenerPolicyPatch) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPatch) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60573,6 +67063,9 @@ func (loadBalancerListenerPolicyPatch *LoadBalancerListenerPolicyPatch) AsPatch( if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -60605,7 +67098,10 @@ type LoadBalancerListenerPolicyPrototype struct { // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. +<<<<<<< Updated upstream // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. +======= +>>>>>>> Stashed changes Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` } @@ -60635,6 +67131,9 @@ func (*VpcV1) NewLoadBalancerListenerPolicyPrototype(action string, priority int Priority: core.Int64Ptr(priority), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -60643,22 +67142,27 @@ func UnmarshalLoadBalancerListenerPolicyPrototype(m map[string]json.RawMessage, obj := new(LoadBalancerListenerPolicyPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-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, "priority", &obj.Priority) if err != nil { + err = core.SDKErrorf(err, "", "priority-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRulePrototype) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60687,18 +67191,22 @@ func UnmarshalLoadBalancerListenerPolicyReference(m map[string]json.RawMessage, obj := new(LoadBalancerListenerPolicyReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60717,6 +67225,7 @@ func UnmarshalLoadBalancerListenerPolicyReferenceDeleted(m map[string]json.RawMe obj := new(LoadBalancerListenerPolicyReferenceDeleted) 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)) @@ -60802,34 +67311,42 @@ func UnmarshalLoadBalancerListenerPolicyRule(m map[string]json.RawMessage, resul obj := new(LoadBalancerListenerPolicyRule) err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) if err != nil { + err = core.SDKErrorf(err, "", "condition-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, "field", &obj.Field) if err != nil { + err = core.SDKErrorf(err, "", "field-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, "provisioning_status", &obj.ProvisioningStatus) if err != nil { + err = core.SDKErrorf(err, "", "provisioning_status-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, "value", &obj.Value) if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60847,6 +67364,7 @@ func UnmarshalLoadBalancerListenerPolicyRuleCollection(m map[string]json.RawMess obj := new(LoadBalancerListenerPolicyRuleCollection) err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60904,18 +67422,22 @@ func UnmarshalLoadBalancerListenerPolicyRulePatch(m map[string]json.RawMessage, obj := new(LoadBalancerListenerPolicyRulePatch) err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) if err != nil { + err = core.SDKErrorf(err, "", "condition-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "field", &obj.Field) if err != nil { + err = core.SDKErrorf(err, "", "field-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, "value", &obj.Value) if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60929,6 +67451,9 @@ func (loadBalancerListenerPolicyRulePatch *LoadBalancerListenerPolicyRulePatch) if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -60986,6 +67511,9 @@ func (*VpcV1) NewLoadBalancerListenerPolicyRulePrototype(condition string, typeV Value: core.StringPtr(value), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -60994,18 +67522,22 @@ func UnmarshalLoadBalancerListenerPolicyRulePrototype(m map[string]json.RawMessa obj := new(LoadBalancerListenerPolicyRulePrototype) err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) if err != nil { + err = core.SDKErrorf(err, "", "condition-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "field", &obj.Field) if err != nil { + err = core.SDKErrorf(err, "", "field-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, "value", &obj.Value) if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61030,14 +67562,17 @@ func UnmarshalLoadBalancerListenerPolicyRuleReference(m map[string]json.RawMessa obj := new(LoadBalancerListenerPolicyRuleReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61056,6 +67591,7 @@ func UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted(m map[string]json.R obj := new(LoadBalancerListenerPolicyRuleReferenceDeleted) 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)) @@ -61109,30 +67645,45 @@ func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, res obj := new(LoadBalancerListenerPolicyTarget) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) 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, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) + return + } +<<<<<<< Updated upstream +======= + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } +>>>>>>> Stashed changes err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "url", &obj.URL) @@ -61144,9 +67695,15 @@ func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, res } // LoadBalancerListenerPolicyTargetPatch : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. +<<<<<<< Updated upstream // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPatch`. // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. +======= +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. +// - If `action` is `https_redirect`, specify a +// `LoadBalancerListenerPolicyHTTPSRedirectPatch`. +>>>>>>> Stashed changes // Models which "extend" this model: // - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity // - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch @@ -61184,22 +67741,35 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage obj := new(LoadBalancerListenerPolicyTargetPatch) 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 } err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) + return + } +<<<<<<< Updated upstream +======= + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } +>>>>>>> Stashed changes err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "url", &obj.URL) @@ -61211,9 +67781,15 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage } // LoadBalancerListenerPolicyTargetPrototype : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. +<<<<<<< Updated upstream // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. +======= +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. +// - If `action` is `https_redirect`, specify a +// `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. +>>>>>>> Stashed changes // Models which "extend" this model: // - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity // - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype @@ -61251,22 +67827,35 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototype(m map[string]json.RawMes obj := new(LoadBalancerListenerPolicyTargetPrototype) 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 } err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } +<<<<<<< Updated upstream +======= + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) + return + } +>>>>>>> Stashed changes err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "url", &obj.URL) @@ -61381,6 +67970,9 @@ func (*VpcV1) NewLoadBalancerListenerPrototypeLoadBalancerContext(protocol strin Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -61389,42 +67981,52 @@ func UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext(m map[string]json obj := new(LoadBalancerListenerPrototypeLoadBalancerContext) err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) if err != nil { + err = core.SDKErrorf(err, "", "accept_proxy_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) if err != nil { + err = core.SDKErrorf(err, "", "certificate_instance-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) if err != nil { + err = core.SDKErrorf(err, "", "connection_limit-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentityByName) if err != nil { + err = core.SDKErrorf(err, "", "default_pool-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPrototype) if err != nil { + err = core.SDKErrorf(err, "", "https_redirect-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) if err != nil { + err = core.SDKErrorf(err, "", "idle_connection_timeout-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-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 } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61449,14 +68051,17 @@ func UnmarshalLoadBalancerListenerReference(m map[string]json.RawMessage, result obj := new(LoadBalancerListenerReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61475,6 +68080,7 @@ func UnmarshalLoadBalancerListenerReferenceDeleted(m map[string]json.RawMessage, obj := new(LoadBalancerListenerReferenceDeleted) 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)) @@ -61492,6 +68098,7 @@ func UnmarshalLoadBalancerLogging(m map[string]json.RawMessage, result interface obj := new(LoadBalancerLogging) err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapath) if err != nil { + err = core.SDKErrorf(err, "", "datapath-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61509,6 +68116,7 @@ func UnmarshalLoadBalancerLoggingDatapath(m map[string]json.RawMessage, result i obj := new(LoadBalancerLoggingDatapath) err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { + err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61526,6 +68134,7 @@ func UnmarshalLoadBalancerLoggingDatapathPatch(m map[string]json.RawMessage, res obj := new(LoadBalancerLoggingDatapathPatch) err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { + err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61543,6 +68152,7 @@ func UnmarshalLoadBalancerLoggingDatapathPrototype(m map[string]json.RawMessage, obj := new(LoadBalancerLoggingDatapathPrototype) err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { + err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61560,6 +68170,7 @@ func UnmarshalLoadBalancerLoggingPatch(m map[string]json.RawMessage, result inte obj := new(LoadBalancerLoggingPatch) err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPatch) if err != nil { + err = core.SDKErrorf(err, "", "datapath-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61577,6 +68188,7 @@ func UnmarshalLoadBalancerLoggingPrototype(m map[string]json.RawMessage, result obj := new(LoadBalancerLoggingPrototype) err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPrototype) if err != nil { + err = core.SDKErrorf(err, "", "datapath-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61615,18 +68227,22 @@ func UnmarshalLoadBalancerPatch(m map[string]json.RawMessage, result interface{} obj := new(LoadBalancerPatch) err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalLoadBalancerDnsPatch) if err != nil { + err = core.SDKErrorf(err, "", "dns-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLoggingPatch) if err != nil { + err = core.SDKErrorf(err, "", "logging-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, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61640,6 +68256,9 @@ func (loadBalancerPatch *LoadBalancerPatch) AsPatch() (_patch map[string]interfa if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -61744,50 +68363,62 @@ func UnmarshalLoadBalancerPool(m map[string]json.RawMessage, result interface{}) obj := new(LoadBalancerPool) err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) if err != nil { + err = core.SDKErrorf(err, "", "algorithm-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, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitor) if err != nil { + err = core.SDKErrorf(err, "", "health_monitor-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, "instance_group", &obj.InstanceGroup, UnmarshalInstanceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "instance_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberReference) if err != nil { + err = core.SDKErrorf(err, "", "members-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) if err != nil { + err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) if err != nil { + err = core.SDKErrorf(err, "", "proxy_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistence) if err != nil { + err = core.SDKErrorf(err, "", "session_persistence-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61805,6 +68436,7 @@ func UnmarshalLoadBalancerPoolCollection(m map[string]json.RawMessage, result in obj := new(LoadBalancerPoolCollection) err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPool) if err != nil { + err = core.SDKErrorf(err, "", "pools-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61855,26 +68487,32 @@ func UnmarshalLoadBalancerPoolHealthMonitor(m map[string]json.RawMessage, result obj := new(LoadBalancerPoolHealthMonitor) err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) if err != nil { + err = core.SDKErrorf(err, "", "delay-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) if err != nil { + err = core.SDKErrorf(err, "", "max_retries-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) if err != nil { + err = core.SDKErrorf(err, "", "timeout-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, "url_path", &obj.URLPath) if err != nil { + err = core.SDKErrorf(err, "", "url_path-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61925,6 +68563,9 @@ func (*VpcV1) NewLoadBalancerPoolHealthMonitorPatch(delay int64, maxRetries int6 Type: core.StringPtr(typeVar), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -61933,26 +68574,32 @@ func UnmarshalLoadBalancerPoolHealthMonitorPatch(m map[string]json.RawMessage, r obj := new(LoadBalancerPoolHealthMonitorPatch) err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) if err != nil { + err = core.SDKErrorf(err, "", "delay-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) if err != nil { + err = core.SDKErrorf(err, "", "max_retries-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) if err != nil { + err = core.SDKErrorf(err, "", "timeout-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, "url_path", &obj.URLPath) if err != nil { + err = core.SDKErrorf(err, "", "url_path-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62001,6 +68648,9 @@ func (*VpcV1) NewLoadBalancerPoolHealthMonitorPrototype(delay int64, maxRetries Type: core.StringPtr(typeVar), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -62009,26 +68659,32 @@ func UnmarshalLoadBalancerPoolHealthMonitorPrototype(m map[string]json.RawMessag obj := new(LoadBalancerPoolHealthMonitorPrototype) err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) if err != nil { + err = core.SDKErrorf(err, "", "delay-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) if err != nil { + err = core.SDKErrorf(err, "", "max_retries-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) if err != nil { + err = core.SDKErrorf(err, "", "timeout-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, "url_path", &obj.URLPath) if err != nil { + err = core.SDKErrorf(err, "", "url_path-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62060,10 +68716,12 @@ func UnmarshalLoadBalancerPoolIdentity(m map[string]json.RawMessage, result inte obj := new(LoadBalancerPoolIdentity) 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)) @@ -62082,6 +68740,9 @@ func (*VpcV1) NewLoadBalancerPoolIdentityByName(name string) (_model *LoadBalanc Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -62090,6 +68751,7 @@ func UnmarshalLoadBalancerPoolIdentityByName(m map[string]json.RawMessage, resul obj := new(LoadBalancerPoolIdentityByName) 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)) @@ -62161,34 +68823,42 @@ func UnmarshalLoadBalancerPoolMember(m map[string]json.RawMessage, result interf obj := new(LoadBalancerPoolMember) 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, "health", &obj.Health) if err != nil { + err = core.SDKErrorf(err, "", "health-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, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) if err != nil { + err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTarget) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) if err != nil { + err = core.SDKErrorf(err, "", "weight-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62206,6 +68876,7 @@ func UnmarshalLoadBalancerPoolMemberCollection(m map[string]json.RawMessage, res obj := new(LoadBalancerPoolMemberCollection) err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMember) if err != nil { + err = core.SDKErrorf(err, "", "members-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62240,14 +68911,17 @@ func UnmarshalLoadBalancerPoolMemberPatch(m map[string]json.RawMessage, result i obj := new(LoadBalancerPoolMemberPatch) err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) if err != nil { + err = core.SDKErrorf(err, "", "weight-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62261,6 +68935,9 @@ func (loadBalancerPoolMemberPatch *LoadBalancerPoolMemberPatch) AsPatch() (_patc if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -62294,6 +68971,9 @@ func (*VpcV1) NewLoadBalancerPoolMemberPrototype(port int64, target LoadBalancer Target: target, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -62302,14 +68982,17 @@ func UnmarshalLoadBalancerPoolMemberPrototype(m map[string]json.RawMessage, resu obj := new(LoadBalancerPoolMemberPrototype) err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) if err != nil { + err = core.SDKErrorf(err, "", "weight-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62334,14 +69017,17 @@ func UnmarshalLoadBalancerPoolMemberReference(m map[string]json.RawMessage, resu obj := new(LoadBalancerPoolMemberReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolMemberReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62360,6 +69046,7 @@ func UnmarshalLoadBalancerPoolMemberReferenceDeleted(m map[string]json.RawMessag obj := new(LoadBalancerPoolMemberReferenceDeleted) 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)) @@ -62409,26 +69096,32 @@ func UnmarshalLoadBalancerPoolMemberTarget(m map[string]json.RawMessage, result obj := new(LoadBalancerPoolMemberTarget) 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, UnmarshalInstanceReferenceDeleted) 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, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62471,18 +69164,22 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototype(m map[string]json.RawMessage obj := new(LoadBalancerPoolMemberTargetPrototype) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62564,26 +69261,32 @@ func UnmarshalLoadBalancerPoolPatch(m map[string]json.RawMessage, result interfa obj := new(LoadBalancerPoolPatch) err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) if err != nil { + err = core.SDKErrorf(err, "", "algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPatch) if err != nil { + err = core.SDKErrorf(err, "", "health_monitor-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) if err != nil { + err = core.SDKErrorf(err, "", "proxy_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePatch) if err != nil { + err = core.SDKErrorf(err, "", "session_persistence-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62597,6 +69300,9 @@ func (loadBalancerPoolPatch *LoadBalancerPoolPatch) AsPatch() (_patch map[string if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -62675,6 +69381,9 @@ func (*VpcV1) NewLoadBalancerPoolPrototype(algorithm string, healthMonitor *Load Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -62683,30 +69392,37 @@ func UnmarshalLoadBalancerPoolPrototype(m map[string]json.RawMessage, result int obj := new(LoadBalancerPoolPrototype) err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) if err != nil { + err = core.SDKErrorf(err, "", "algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPrototype) if err != nil { + err = core.SDKErrorf(err, "", "health_monitor-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberPrototype) if err != nil { + err = core.SDKErrorf(err, "", "members-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) if err != nil { + err = core.SDKErrorf(err, "", "proxy_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePrototype) if err != nil { + err = core.SDKErrorf(err, "", "session_persistence-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62734,18 +69450,22 @@ func UnmarshalLoadBalancerPoolReference(m map[string]json.RawMessage, result int obj := new(LoadBalancerPoolReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62764,6 +69484,7 @@ func UnmarshalLoadBalancerPoolReferenceDeleted(m map[string]json.RawMessage, res obj := new(LoadBalancerPoolReferenceDeleted) 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)) @@ -62779,8 +69500,14 @@ type LoadBalancerPoolSessionPersistence struct { // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` // protocols. // +<<<<<<< Updated upstream // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +======= + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the + // unexpected property value was encountered. +>>>>>>> Stashed changes Type *string `json:"type" validate:"required"` } @@ -62788,8 +69515,14 @@ type LoadBalancerPoolSessionPersistence struct { // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` // protocols. // +<<<<<<< Updated upstream // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +======= +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the +// unexpected property value was encountered. +>>>>>>> Stashed changes const ( LoadBalancerPoolSessionPersistenceTypeAppCookieConst = "app_cookie" LoadBalancerPoolSessionPersistenceTypeHTTPCookieConst = "http_cookie" @@ -62801,10 +69534,12 @@ func UnmarshalLoadBalancerPoolSessionPersistence(m map[string]json.RawMessage, r obj := new(LoadBalancerPoolSessionPersistence) err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) if err != nil { + err = core.SDKErrorf(err, "", "cookie_name-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)) @@ -62836,10 +69571,12 @@ func UnmarshalLoadBalancerPoolSessionPersistencePatch(m map[string]json.RawMessa obj := new(LoadBalancerPoolSessionPersistencePatch) err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) if err != nil { + err = core.SDKErrorf(err, "", "cookie_name-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)) @@ -62872,6 +69609,9 @@ func (*VpcV1) NewLoadBalancerPoolSessionPersistencePrototype(typeVar string) (_m Type: core.StringPtr(typeVar), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -62880,10 +69620,12 @@ func UnmarshalLoadBalancerPoolSessionPersistencePrototype(m map[string]json.RawM obj := new(LoadBalancerPoolSessionPersistencePrototype) err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) if err != nil { + err = core.SDKErrorf(err, "", "cookie_name-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)) @@ -62928,26 +69670,32 @@ func UnmarshalLoadBalancerPrivateIpsItem(m map[string]json.RawMessage, result in obj := new(LoadBalancerPrivateIpsItem) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) 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)) @@ -62995,34 +69743,42 @@ func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface obj := new(LoadBalancerProfile) err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-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.UnmarshalModel(m, "instance_groups_supported", &obj.InstanceGroupsSupported, UnmarshalLoadBalancerProfileInstanceGroupsSupported) if err != nil { + err = core.SDKErrorf(err, "", "instance_groups_supported-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "logging_supported", &obj.LoggingSupported, UnmarshalLoadBalancerProfileLoggingSupported) if err != nil { + err = core.SDKErrorf(err, "", "logging_supported-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, "route_mode_supported", &obj.RouteModeSupported, UnmarshalLoadBalancerProfileRouteModeSupported) if err != nil { + err = core.SDKErrorf(err, "", "route_mode_supported-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "security_groups_supported", &obj.SecurityGroupsSupported, UnmarshalLoadBalancerProfileSecurityGroupsSupported) if err != nil { + err = core.SDKErrorf(err, "", "security_groups_supported-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "udp_supported", &obj.UDPSupported, UnmarshalLoadBalancerProfileUDPSupported) if err != nil { + err = core.SDKErrorf(err, "", "udp_supported-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63053,22 +69809,27 @@ func UnmarshalLoadBalancerProfileCollection(m map[string]json.RawMessage, result obj := new(LoadBalancerProfileCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalLoadBalancerProfileCollectionFirst) 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, UnmarshalLoadBalancerProfileCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalLoadBalancerProfile) 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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63081,8 +69842,11 @@ func (resp *LoadBalancerProfileCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -63098,6 +69862,7 @@ func UnmarshalLoadBalancerProfileCollectionFirst(m map[string]json.RawMessage, r 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)) @@ -63115,6 +69880,7 @@ func UnmarshalLoadBalancerProfileCollectionNext(m map[string]json.RawMessage, re 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)) @@ -63146,10 +69912,12 @@ func UnmarshalLoadBalancerProfileIdentity(m map[string]json.RawMessage, result i obj := new(LoadBalancerProfileIdentity) 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)) @@ -63187,10 +69955,12 @@ func UnmarshalLoadBalancerProfileInstanceGroupsSupported(m map[string]json.RawMe obj := new(LoadBalancerProfileInstanceGroupsSupported) 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)) @@ -63217,10 +69987,12 @@ func UnmarshalLoadBalancerProfileLoggingSupported(m map[string]json.RawMessage, obj := new(LoadBalancerProfileLoggingSupported) 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)) @@ -63257,14 +70029,17 @@ func UnmarshalLoadBalancerProfileReference(m map[string]json.RawMessage, result obj := new(LoadBalancerProfileReference) err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63302,10 +70077,12 @@ func UnmarshalLoadBalancerProfileRouteModeSupported(m map[string]json.RawMessage obj := new(LoadBalancerProfileRouteModeSupported) 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)) @@ -63343,10 +70120,12 @@ func UnmarshalLoadBalancerProfileSecurityGroupsSupported(m map[string]json.RawMe obj := new(LoadBalancerProfileSecurityGroupsSupported) 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)) @@ -63384,10 +70163,12 @@ func UnmarshalLoadBalancerProfileUDPSupported(m map[string]json.RawMessage, resu obj := new(LoadBalancerProfileUDPSupported) 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)) @@ -63406,6 +70187,7 @@ func UnmarshalLoadBalancerReferenceDeleted(m map[string]json.RawMessage, result obj := new(LoadBalancerReferenceDeleted) 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)) @@ -63432,18 +70214,22 @@ func UnmarshalLoadBalancerStatistics(m map[string]json.RawMessage, result interf obj := new(LoadBalancerStatistics) err = core.UnmarshalPrimitive(m, "active_connections", &obj.ActiveConnections) if err != nil { + err = core.SDKErrorf(err, "", "active_connections-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "connection_rate", &obj.ConnectionRate) if err != nil { + err = core.SDKErrorf(err, "", "connection_rate-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "data_processed_this_month", &obj.DataProcessedThisMonth) if err != nil { + err = core.SDKErrorf(err, "", "data_processed_this_month-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "throughput", &obj.Throughput) if err != nil { + err = core.SDKErrorf(err, "", "throughput-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63485,38 +70271,47 @@ func UnmarshalNetworkACL(m map[string]json.RawMessage, result interface{}) (err obj := new(NetworkACL) 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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63547,22 +70342,27 @@ func UnmarshalNetworkACLCollection(m map[string]json.RawMessage, result interfac obj := new(NetworkACLCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalNetworkACLCollectionFirst) 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, "network_acls", &obj.NetworkAcls, UnmarshalNetworkACL) if err != nil { + err = core.SDKErrorf(err, "", "network_acls-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLCollectionNext) 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)) @@ -63575,8 +70375,11 @@ func (resp *NetworkACLCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -63592,6 +70395,7 @@ func UnmarshalNetworkACLCollectionFirst(m map[string]json.RawMessage, result int 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)) @@ -63609,6 +70413,7 @@ func UnmarshalNetworkACLCollectionNext(m map[string]json.RawMessage, result inte 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)) @@ -63644,14 +70449,17 @@ func UnmarshalNetworkACLIdentity(m map[string]json.RawMessage, result interface{ obj := new(NetworkACLIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63669,6 +70477,7 @@ func UnmarshalNetworkACLPatch(m map[string]json.RawMessage, result interface{}) obj := new(NetworkACLPatch) 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)) @@ -63682,6 +70491,9 @@ func (networkACLPatch *NetworkACLPatch) AsPatch() (_patch map[string]interface{} if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -63722,22 +70534,27 @@ func UnmarshalNetworkACLPrototype(m map[string]json.RawMessage, result interface obj := new(NetworkACLPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_network_acl-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63768,22 +70585,27 @@ func UnmarshalNetworkACLReference(m map[string]json.RawMessage, result interface obj := new(NetworkACLReference) 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, UnmarshalNetworkACLReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63802,6 +70624,7 @@ func UnmarshalNetworkACLReferenceDeleted(m map[string]json.RawMessage, result in obj := new(NetworkACLReferenceDeleted) 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)) @@ -63913,23 +70736,37 @@ func UnmarshalNetworkACLRule(m map[string]json.RawMessage, result interface{}) ( var discValue string err = core.UnmarshalPrimitive(m, "protocol", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "all" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolAll-error", common.GetComponentInfo()) + } } else if discValue == "icmp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolIcmp-error", common.GetComponentInfo()) + } } else if discValue == "tcp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo()) + } } else if discValue == "udp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -63961,10 +70798,12 @@ func UnmarshalNetworkACLRuleBeforePatch(m map[string]json.RawMessage, result int obj := new(NetworkACLRuleBeforePatch) 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)) @@ -63998,10 +70837,12 @@ func UnmarshalNetworkACLRuleBeforePrototype(m map[string]json.RawMessage, result obj := new(NetworkACLRuleBeforePrototype) 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)) @@ -64032,22 +70873,27 @@ func UnmarshalNetworkACLRuleCollection(m map[string]json.RawMessage, result inte obj := new(NetworkACLRuleCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalNetworkACLRuleCollectionFirst) 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, UnmarshalNetworkACLRuleCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) if err != nil { + err = core.SDKErrorf(err, "", "rules-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)) @@ -64060,8 +70906,11 @@ func (resp *NetworkACLRuleCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -64077,6 +70926,7 @@ func UnmarshalNetworkACLRuleCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -64094,6 +70944,7 @@ func UnmarshalNetworkACLRuleCollectionNext(m map[string]json.RawMessage, result 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)) @@ -64206,23 +71057,37 @@ func UnmarshalNetworkACLRuleItem(m map[string]json.RawMessage, result interface{ var discValue string err = core.UnmarshalPrimitive(m, "protocol", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "all" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolAll-error", common.GetComponentInfo()) + } } else if discValue == "icmp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolIcmp-error", common.GetComponentInfo()) + } } else if discValue == "tcp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo()) + } } else if discValue == "udp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -64303,54 +71168,67 @@ func UnmarshalNetworkACLRulePatch(m map[string]json.RawMessage, result interface obj := new(NetworkACLRulePatch) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePatch) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_min-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) if err != nil { + err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) if err != nil { + err = core.SDKErrorf(err, "", "source_port_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)) @@ -64364,6 +71242,9 @@ func (networkACLRulePatch *NetworkACLRulePatch) AsPatch() (_patch map[string]int if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -64466,23 +71347,37 @@ func UnmarshalNetworkACLRulePrototype(m map[string]json.RawMessage, result inter var discValue string err = core.UnmarshalPrimitive(m, "protocol", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "all" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype-error", common.GetComponentInfo()) + } } else if discValue == "icmp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype-error", common.GetComponentInfo()) + } } else if discValue == "tcp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype-error", common.GetComponentInfo()) + } } else if discValue == "udp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -64581,23 +71476,37 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContext(m map[string]json.RawMess var discValue string err = core.UnmarshalPrimitive(m, "protocol", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "all" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype-error", common.GetComponentInfo()) + } } else if discValue == "icmp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype-error", common.GetComponentInfo()) + } } else if discValue == "tcp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype-error", common.GetComponentInfo()) + } } else if discValue == "udp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -64623,18 +71532,22 @@ func UnmarshalNetworkACLRuleReference(m map[string]json.RawMessage, result inter obj := new(NetworkACLRuleReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLRuleReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -64653,6 +71566,7 @@ func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, resul obj := new(NetworkACLRuleReferenceDeleted) 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)) @@ -64783,54 +71697,67 @@ func UnmarshalNetworkInterface(m map[string]json.RawMessage, result interface{}) obj := new(NetworkInterface) 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, "created_at", &obj.CreatedAt) if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) if err != nil { + err = core.SDKErrorf(err, "", "floating_ips-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, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-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)) @@ -64881,30 +71808,37 @@ func UnmarshalNetworkInterfaceBareMetalServerContextReference(m map[string]json. obj := new(NetworkInterfaceBareMetalServerContextReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -64923,6 +71857,7 @@ func UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted(m map[strin obj := new(NetworkInterfaceBareMetalServerContextReferenceDeleted) 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)) @@ -64968,22 +71903,27 @@ func UnmarshalNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result i obj := new(NetworkInterfaceIPPrototype) 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 } 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)) @@ -65034,30 +71974,37 @@ func UnmarshalNetworkInterfaceInstanceContextReference(m map[string]json.RawMess obj := new(NetworkInterfaceInstanceContextReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceInstanceContextReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -65076,6 +72023,7 @@ func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json. obj := new(NetworkInterfaceInstanceContextReferenceDeleted) 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)) @@ -65102,10 +72050,12 @@ func UnmarshalNetworkInterfacePatch(m map[string]json.RawMessage, result interfa obj := new(NetworkInterfacePatch) 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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -65119,6 +72069,9 @@ func (networkInterfacePatch *NetworkInterfacePatch) AsPatch() (_patch map[string if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -65158,6 +72111,9 @@ func (*VpcV1) NewNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *N Subnet: subnet, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -65166,22 +72122,27 @@ func UnmarshalNetworkInterfacePrototype(m map[string]json.RawMessage, result int obj := new(NetworkInterfacePrototype) 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, "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)) @@ -65200,6 +72161,7 @@ func UnmarshalNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, res obj := new(NetworkInterfaceReferenceDeleted) 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)) @@ -65218,6 +72180,7 @@ func UnmarshalNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.Ra obj := new(NetworkInterfaceReferenceTargetContextDeleted) 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)) @@ -65235,6 +72198,7 @@ func UnmarshalNetworkInterfaceUnpaginatedCollection(m map[string]json.RawMessage obj := new(NetworkInterfaceUnpaginatedCollection) err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -65301,34 +72265,42 @@ func UnmarshalOperatingSystem(m map[string]json.RawMessage, result interface{}) obj := new(OperatingSystem) err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) if err != nil { + err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "dedicated_host_only", &obj.DedicatedHostOnly) if err != nil { + err = core.SDKErrorf(err, "", "dedicated_host_only-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) if err != nil { + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "vendor", &obj.Vendor) if err != nil { + err = core.SDKErrorf(err, "", "vendor-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "version", &obj.Version) if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -65359,22 +72331,27 @@ func UnmarshalOperatingSystemCollection(m map[string]json.RawMessage, result int obj := new(OperatingSystemCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalOperatingSystemCollectionFirst) 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, UnmarshalOperatingSystemCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "operating_systems", &obj.OperatingSystems, UnmarshalOperatingSystem) if err != nil { + err = core.SDKErrorf(err, "", "operating_systems-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)) @@ -65387,8 +72364,11 @@ func (resp *OperatingSystemCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -65404,6 +72384,7 @@ func UnmarshalOperatingSystemCollectionFirst(m map[string]json.RawMessage, resul 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)) @@ -65421,6 +72402,7 @@ func UnmarshalOperatingSystemCollectionNext(m map[string]json.RawMessage, result 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)) @@ -65452,10 +72434,12 @@ func UnmarshalOperatingSystemIdentity(m map[string]json.RawMessage, result inter obj := new(OperatingSystemIdentity) 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)) @@ -65532,38 +72516,47 @@ func UnmarshalPlacementGroup(m map[string]json.RawMessage, result interface{}) ( obj := new(PlacementGroup) 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.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, "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.UnmarshalPrimitive(m, "strategy", &obj.Strategy) if err != nil { + err = core.SDKErrorf(err, "", "strategy-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -65594,22 +72587,27 @@ func UnmarshalPlacementGroupCollection(m map[string]json.RawMessage, result inte obj := new(PlacementGroupCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPlacementGroupCollectionFirst) 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, UnmarshalPlacementGroupCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "placement_groups", &obj.PlacementGroups, UnmarshalPlacementGroup) if err != nil { + err = core.SDKErrorf(err, "", "placement_groups-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)) @@ -65622,8 +72620,11 @@ func (resp *PlacementGroupCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -65639,6 +72640,7 @@ func UnmarshalPlacementGroupCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -65656,6 +72658,7 @@ func UnmarshalPlacementGroupCollectionNext(m map[string]json.RawMessage, result 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)) @@ -65673,6 +72676,7 @@ func UnmarshalPlacementGroupPatch(m map[string]json.RawMessage, result interface obj := new(PlacementGroupPatch) 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)) @@ -65686,6 +72690,9 @@ func (placementGroupPatch *PlacementGroupPatch) AsPatch() (_patch map[string]int if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -65701,6 +72708,7 @@ func UnmarshalPlacementGroupReferenceDeleted(m map[string]json.RawMessage, resul obj := new(PlacementGroupReferenceDeleted) 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)) @@ -65763,46 +72771,57 @@ func UnmarshalPublicGateway(m map[string]json.RawMessage, result interface{}) (e obj := new(PublicGateway) 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, "floating_ip", &obj.FloatingIP, UnmarshalPublicGatewayFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "floating_ip-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, "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.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-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)) @@ -65833,22 +72852,27 @@ func UnmarshalPublicGatewayCollection(m map[string]json.RawMessage, result inter obj := new(PublicGatewayCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPublicGatewayCollectionFirst) 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, UnmarshalPublicGatewayCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_gateways", &obj.PublicGateways, UnmarshalPublicGateway) if err != nil { + err = core.SDKErrorf(err, "", "public_gateways-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)) @@ -65861,8 +72885,11 @@ func (resp *PublicGatewayCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -65878,6 +72905,7 @@ func UnmarshalPublicGatewayCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -65895,6 +72923,7 @@ func UnmarshalPublicGatewayCollectionNext(m map[string]json.RawMessage, result i 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)) @@ -65928,26 +72957,32 @@ func UnmarshalPublicGatewayFloatingIP(m map[string]json.RawMessage, result inter obj := new(PublicGatewayFloatingIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-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, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -65993,26 +73028,32 @@ func UnmarshalPublicGatewayFloatingIPPrototype(m map[string]json.RawMessage, res obj := new(PublicGatewayFloatingIPPrototype) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -66048,14 +73089,17 @@ func UnmarshalPublicGatewayIdentity(m map[string]json.RawMessage, result interfa obj := new(PublicGatewayIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -66073,6 +73117,7 @@ func UnmarshalPublicGatewayPatch(m map[string]json.RawMessage, result interface{ obj := new(PublicGatewayPatch) 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)) @@ -66086,6 +73131,9 @@ func (publicGatewayPatch *PublicGatewayPatch) AsPatch() (_patch map[string]inter if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -66122,26 +73170,32 @@ func UnmarshalPublicGatewayReference(m map[string]json.RawMessage, result interf obj := new(PublicGatewayReference) 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, UnmarshalPublicGatewayReferenceDeleted) 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)) @@ -66160,6 +73214,7 @@ func UnmarshalPublicGatewayReferenceDeleted(m map[string]json.RawMessage, result obj := new(PublicGatewayReferenceDeleted) 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)) @@ -66193,18 +73248,22 @@ func UnmarshalRegion(m map[string]json.RawMessage, result interface{}) (err erro obj := new(Region) err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) if err != nil { + err = core.SDKErrorf(err, "", "endpoint-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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -66222,6 +73281,7 @@ func UnmarshalRegionCollection(m map[string]json.RawMessage, result interface{}) obj := new(RegionCollection) err = core.UnmarshalModel(m, "regions", &obj.Regions, UnmarshalRegion) if err != nil { + err = core.SDKErrorf(err, "", "regions-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -66253,10 +73313,12 @@ func UnmarshalRegionIdentity(m map[string]json.RawMessage, result interface{}) ( obj := new(RegionIdentity) 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)) @@ -66277,10 +73339,12 @@ func UnmarshalRegionReference(m map[string]json.RawMessage, result interface{}) obj := new(RegionReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -66843,62 +73907,77 @@ func UnmarshalReservation(m map[string]json.RawMessage, result interface{}) (err obj := new(Reservation) err = core.UnmarshalPrimitive(m, "affinity_policy", &obj.AffinityPolicy) if err != nil { + err = core.SDKErrorf(err, "", "affinity_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalReservationCapacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "committed_use", &obj.CommittedUse, UnmarshalReservationCommittedUse) if err != nil { + err = core.SDKErrorf(err, "", "committed_use-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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, "profile", &obj.Profile, UnmarshalReservationProfile) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.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, UnmarshalReservationStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-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)) @@ -66957,22 +74036,27 @@ func UnmarshalReservationCapacity(m map[string]json.RawMessage, result interface obj := new(ReservationCapacity) err = core.UnmarshalPrimitive(m, "allocated", &obj.Allocated) if err != nil { + err = core.SDKErrorf(err, "", "allocated-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "available", &obj.Available) if err != nil { + err = core.SDKErrorf(err, "", "available-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.UnmarshalPrimitive(m, "total", &obj.Total) if err != nil { + err = core.SDKErrorf(err, "", "total-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "used", &obj.Used) if err != nil { + err = core.SDKErrorf(err, "", "used-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -66992,6 +74076,7 @@ func UnmarshalReservationCapacityPatch(m map[string]json.RawMessage, result inte obj := new(ReservationCapacityPatch) err = core.UnmarshalPrimitive(m, "total", &obj.Total) if err != nil { + err = core.SDKErrorf(err, "", "total-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67010,6 +74095,9 @@ func (*VpcV1) NewReservationCapacityPrototype(total int64) (_model *ReservationC Total: core.Int64Ptr(total), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -67018,6 +74106,7 @@ func UnmarshalReservationCapacityPrototype(m map[string]json.RawMessage, result obj := new(ReservationCapacityPrototype) err = core.UnmarshalPrimitive(m, "total", &obj.Total) if err != nil { + err = core.SDKErrorf(err, "", "total-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67048,22 +74137,27 @@ func UnmarshalReservationCollection(m map[string]json.RawMessage, result interfa obj := new(ReservationCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservationCollectionFirst) 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, UnmarshalReservationCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservations", &obj.Reservations, UnmarshalReservation) if err != nil { + err = core.SDKErrorf(err, "", "reservations-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)) @@ -67076,8 +74170,11 @@ func (resp *ReservationCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -67093,6 +74190,7 @@ func UnmarshalReservationCollectionFirst(m map[string]json.RawMessage, result in 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)) @@ -67110,6 +74208,7 @@ func UnmarshalReservationCollectionNext(m map[string]json.RawMessage, result int 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)) @@ -67157,14 +74256,17 @@ func UnmarshalReservationCommittedUse(m map[string]json.RawMessage, result inter obj := new(ReservationCommittedUse) err = core.UnmarshalPrimitive(m, "expiration_at", &obj.ExpirationAt) if err != nil { + err = core.SDKErrorf(err, "", "expiration_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) if err != nil { + err = core.SDKErrorf(err, "", "expiration_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "term", &obj.Term) if err != nil { + err = core.SDKErrorf(err, "", "term-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67210,10 +74312,12 @@ func UnmarshalReservationCommittedUsePatch(m map[string]json.RawMessage, result obj := new(ReservationCommittedUsePatch) err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) if err != nil { + err = core.SDKErrorf(err, "", "expiration_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "term", &obj.Term) if err != nil { + err = core.SDKErrorf(err, "", "term-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67258,6 +74362,9 @@ func (*VpcV1) NewReservationCommittedUsePrototype(term string) (_model *Reservat Term: core.StringPtr(term), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -67266,10 +74373,12 @@ func UnmarshalReservationCommittedUsePrototype(m map[string]json.RawMessage, res obj := new(ReservationCommittedUsePrototype) err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) if err != nil { + err = core.SDKErrorf(err, "", "expiration_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "term", &obj.Term) if err != nil { + err = core.SDKErrorf(err, "", "term-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67305,14 +74414,17 @@ func UnmarshalReservationIdentity(m map[string]json.RawMessage, result interface obj := new(ReservationIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67344,18 +74456,22 @@ func UnmarshalReservationPatch(m map[string]json.RawMessage, result interface{}) obj := new(ReservationPatch) err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalReservationCapacityPatch) if err != nil { + err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "committed_use", &obj.CommittedUse, UnmarshalReservationCommittedUsePatch) if err != nil { + err = core.SDKErrorf(err, "", "committed_use-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, "profile", &obj.Profile, UnmarshalReservationProfilePatch) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67369,6 +74485,9 @@ func (reservationPatch *ReservationPatch) AsPatch() (_patch map[string]interface if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -67395,14 +74514,17 @@ func UnmarshalReservationProfile(m map[string]json.RawMessage, result interface{ obj := new(ReservationProfile) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -67431,10 +74553,12 @@ func UnmarshalReservationProfilePatch(m map[string]json.RawMessage, result inter obj := new(ReservationProfilePatch) 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)) @@ -67463,6 +74587,9 @@ func (*VpcV1) NewReservationProfilePrototype(name string, resourceType string) ( ResourceType: core.StringPtr(resourceType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -67471,10 +74598,12 @@ func UnmarshalReservationProfilePrototype(m map[string]json.RawMessage, result i obj := new(ReservationProfilePrototype) 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)) @@ -67514,26 +74643,32 @@ func UnmarshalReservationReference(m map[string]json.RawMessage, result interfac obj := new(ReservationReference) 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, UnmarshalReservationReferenceDeleted) 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)) @@ -67552,6 +74687,7 @@ func UnmarshalReservationReferenceDeleted(m map[string]json.RawMessage, result i obj := new(ReservationReferenceDeleted) 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)) @@ -67588,14 +74724,17 @@ func UnmarshalReservationStatusReason(m map[string]json.RawMessage, result inter obj := new(ReservationStatusReason) 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)) @@ -67673,42 +74812,52 @@ func UnmarshalReservedIP(m map[string]json.RawMessage, result interface{}) (err obj := new(ReservedIP) 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, "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, "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, "owner", &obj.Owner) if err != nil { + err = core.SDKErrorf(err, "", "owner-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, "target", &obj.Target, UnmarshalReservedIPTarget) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67739,22 +74888,27 @@ func UnmarshalReservedIPCollection(m map[string]json.RawMessage, result interfac obj := new(ReservedIPCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionFirst) 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, UnmarshalReservedIPCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reserved_ips", &obj.ReservedIps, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "reserved_ips-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)) @@ -67767,8 +74921,11 @@ func (resp *ReservedIPCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -67797,22 +74954,27 @@ func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext(m map[s obj := new(ReservedIPCollectionBareMetalServerNetworkInterfaceContext) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "ips-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, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext) 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)) @@ -67830,6 +74992,7 @@ func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst(m 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)) @@ -67847,6 +75010,7 @@ func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext(m m 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)) @@ -67877,22 +75041,27 @@ func UnmarshalReservedIPCollectionEndpointGatewayContext(m map[string]json.RawMe obj := new(ReservedIPCollectionEndpointGatewayContext) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionEndpointGatewayContextFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "ips-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, UnmarshalReservedIPCollectionEndpointGatewayContextNext) 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)) @@ -67905,8 +75074,11 @@ func (resp *ReservedIPCollectionEndpointGatewayContext) GetNextStart() (*string, return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -67922,6 +75094,7 @@ func UnmarshalReservedIPCollectionEndpointGatewayContextFirst(m map[string]json. 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)) @@ -67939,6 +75112,7 @@ func UnmarshalReservedIPCollectionEndpointGatewayContextNext(m map[string]json.R 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)) @@ -67956,6 +75130,7 @@ func UnmarshalReservedIPCollectionFirst(m map[string]json.RawMessage, result int 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)) @@ -67986,22 +75161,27 @@ func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext(m map[string]j obj := new(ReservedIPCollectionInstanceNetworkInterfaceContext) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "ips-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, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext) 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)) @@ -68014,8 +75194,11 @@ func (resp *ReservedIPCollectionInstanceNetworkInterfaceContext) GetNextStart() return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -68031,6 +75214,7 @@ func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextFirst(m map[str 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)) @@ -68048,6 +75232,7 @@ func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext(m map[stri 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)) @@ -68065,6 +75250,7 @@ func UnmarshalReservedIPCollectionNext(m map[string]json.RawMessage, result inte 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)) @@ -68095,22 +75281,27 @@ func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext(m map[string]js obj := new(ReservedIPCollectionVirtualNetworkInterfaceContext) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "ips-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, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext) 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)) @@ -68123,8 +75314,11 @@ func (resp *ReservedIPCollectionVirtualNetworkInterfaceContext) GetNextStart() ( return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -68140,6 +75334,7 @@ func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst(m map[stri 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)) @@ -68157,6 +75352,7 @@ func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext(m map[strin 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)) @@ -68179,10 +75375,12 @@ func UnmarshalReservedIPPatch(m map[string]json.RawMessage, result interface{}) obj := new(ReservedIPPatch) 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)) @@ -68196,6 +75394,9 @@ func (reservedIPPatch *ReservedIPPatch) AsPatch() (_patch map[string]interface{} if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -68237,26 +75438,32 @@ func UnmarshalReservedIPReference(m map[string]json.RawMessage, result interface obj := new(ReservedIPReference) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) 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)) @@ -68275,6 +75482,7 @@ func UnmarshalReservedIPReferenceDeleted(m map[string]json.RawMessage, result in obj := new(ReservedIPReferenceDeleted) 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)) @@ -68333,26 +75541,32 @@ func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) obj := new(ReservedIPTarget) 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, UnmarshalEndpointGatewayReferenceDeleted) 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)) @@ -68393,14 +75607,17 @@ func UnmarshalReservedIPTargetPrototype(m map[string]json.RawMessage, result int obj := new(ReservedIPTargetPrototype) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -68418,6 +75635,7 @@ func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) ( obj := new(ResourceFilter) 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)) @@ -68446,6 +75664,7 @@ func UnmarshalResourceGroupIdentity(m map[string]json.RawMessage, result interfa obj := new(ResourceGroupIdentity) 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)) @@ -68469,14 +75688,17 @@ func UnmarshalResourceGroupReference(m map[string]json.RawMessage, result interf obj := new(ResourceGroupReference) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -68618,54 +75840,67 @@ func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error obj := new(Route) 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)) @@ -68696,22 +75931,27 @@ func UnmarshalRouteCollection(m map[string]json.RawMessage, result interface{}) 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)) @@ -68724,8 +75964,11 @@ func (resp *RouteCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -68741,6 +75984,7 @@ func UnmarshalRouteCollectionFirst(m map[string]json.RawMessage, result interfac 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)) @@ -68758,6 +76002,7 @@ func UnmarshalRouteCollectionNext(m map[string]json.RawMessage, result interface 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)) @@ -68788,22 +76033,27 @@ func UnmarshalRouteCollectionVPCContext(m map[string]json.RawMessage, result int 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)) @@ -68816,8 +76066,11 @@ func (resp *RouteCollectionVPCContext) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -68833,6 +76086,7 @@ func UnmarshalRouteCollectionVPCContextFirst(m map[string]json.RawMessage, resul 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)) @@ -68850,6 +76104,7 @@ func UnmarshalRouteCollectionVPCContextNext(m map[string]json.RawMessage, result 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)) @@ -68963,54 +76218,67 @@ func UnmarshalRouteCollectionVPCContextRoutesItem(m map[string]json.RawMessage, 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)) @@ -69063,26 +76331,32 @@ func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (er obj := new(RouteCreator) 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, UnmarshalVPNGatewayReferenceDeleted) 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)) @@ -69136,26 +76410,32 @@ func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (er obj := new(RouteNextHop) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) 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)) @@ -69197,14 +76477,17 @@ func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{} obj := new(RouteNextHopPatch) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -69246,18 +76529,22 @@ func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err obj := new(RoutePatch) err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) if err != nil { + err = core.SDKErrorf(err, "", "advertise-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, UnmarshalRouteNextHopPatch) if err != nil { + err = core.SDKErrorf(err, "", "next_hop-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) if err != nil { + err = core.SDKErrorf(err, "", "priority-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -69271,6 +76558,9 @@ func (routePatch *RoutePatch) AsPatch() (_patch map[string]interface{}, err erro if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -69345,6 +76635,9 @@ func (*VpcV1) NewRoutePrototype(destination string, zone ZoneIdentityIntf) (_mod Zone: zone, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -69353,30 +76646,37 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( obj := new(RoutePrototype) 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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-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, UnmarshalRoutePrototypeNextHop) if err != nil { + err = core.SDKErrorf(err, "", "next_hop-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, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -69418,14 +76718,17 @@ func UnmarshalRoutePrototypeNextHop(m map[string]json.RawMessage, result interfa obj := new(RoutePrototypeNextHop) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -69453,18 +76756,22 @@ func UnmarshalRouteReference(m map[string]json.RawMessage, result interface{}) ( obj := new(RouteReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRouteReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -69483,6 +76790,7 @@ func UnmarshalRouteReferenceDeleted(m map[string]json.RawMessage, result interfa obj := new(RouteReferenceDeleted) 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)) @@ -69603,62 +76911,77 @@ func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (er obj := new(RoutingTable) err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) if err != nil { + err = core.SDKErrorf(err, "", "accept_routes_from-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) if err != nil { + err = core.SDKErrorf(err, "", "advertise_routes_to-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, "is_default", &obj.IsDefault) if err != nil { + err = core.SDKErrorf(err, "", "is_default-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, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_direct_link_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_internet_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_transit_gateway_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_vpc_zone_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) if err != nil { + err = core.SDKErrorf(err, "", "routes-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -69689,22 +77012,27 @@ func UnmarshalRoutingTableCollection(m map[string]json.RawMessage, result interf obj := new(RoutingTableCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalRoutingTableCollectionFirst) 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, UnmarshalRoutingTableCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "routing_tables", &obj.RoutingTables, UnmarshalRoutingTable) if err != nil { + err = core.SDKErrorf(err, "", "routing_tables-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)) @@ -69717,8 +77045,11 @@ func (resp *RoutingTableCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -69734,6 +77065,7 @@ func UnmarshalRoutingTableCollectionFirst(m map[string]json.RawMessage, result i 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)) @@ -69751,6 +77083,7 @@ func UnmarshalRoutingTableCollectionNext(m map[string]json.RawMessage, result in 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)) @@ -69782,10 +77115,12 @@ func UnmarshalRoutingTableIdentity(m map[string]json.RawMessage, result interfac obj := new(RoutingTableIdentity) 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)) @@ -69876,30 +77211,37 @@ func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{} obj := new(RoutingTablePatch) err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) if err != nil { + err = core.SDKErrorf(err, "", "accept_routes_from-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) if err != nil { + err = core.SDKErrorf(err, "", "advertise_routes_to-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, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_direct_link_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_internet_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_transit_gateway_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_vpc_zone_ingress-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -69913,6 +77255,9 @@ func (routingTablePatch *RoutingTablePatch) AsPatch() (_patch map[string]interfa if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -69946,22 +77291,27 @@ func UnmarshalRoutingTableReference(m map[string]json.RawMessage, result interfa obj := new(RoutingTableReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRoutingTableReferenceDeleted) 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)) @@ -69980,6 +77330,7 @@ func UnmarshalRoutingTableReferenceDeleted(m map[string]json.RawMessage, result obj := new(RoutingTableReferenceDeleted) 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)) @@ -70021,38 +77372,47 @@ func UnmarshalSecurityGroup(m map[string]json.RawMessage, result interface{}) (e obj := new(SecurityGroup) 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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) if err != nil { + err = core.SDKErrorf(err, "", "targets-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -70083,22 +77443,27 @@ func UnmarshalSecurityGroupCollection(m map[string]json.RawMessage, result inter obj := new(SecurityGroupCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSecurityGroupCollectionFirst) 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, UnmarshalSecurityGroupCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroup) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-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)) @@ -70111,8 +77476,11 @@ func (resp *SecurityGroupCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -70128,6 +77496,7 @@ func UnmarshalSecurityGroupCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -70145,6 +77514,7 @@ func UnmarshalSecurityGroupCollectionNext(m map[string]json.RawMessage, result i 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)) @@ -70180,14 +77550,17 @@ func UnmarshalSecurityGroupIdentity(m map[string]json.RawMessage, result interfa obj := new(SecurityGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -70205,6 +77578,7 @@ func UnmarshalSecurityGroupPatch(m map[string]json.RawMessage, result interface{ obj := new(SecurityGroupPatch) 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)) @@ -70218,6 +77592,9 @@ func (securityGroupPatch *SecurityGroupPatch) AsPatch() (_patch map[string]inter if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -70245,22 +77622,27 @@ func UnmarshalSecurityGroupReference(m map[string]json.RawMessage, result interf obj := new(SecurityGroupReference) 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, UnmarshalSecurityGroupReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -70279,6 +77661,7 @@ func UnmarshalSecurityGroupReferenceDeleted(m map[string]json.RawMessage, result obj := new(SecurityGroupReferenceDeleted) 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)) @@ -70373,23 +77756,37 @@ func UnmarshalSecurityGroupRule(m map[string]json.RawMessage, result interface{} var discValue string err = core.UnmarshalPrimitive(m, "protocol", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "all" { err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolAll-error", common.GetComponentInfo()) + } } else if discValue == "icmp" { err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolIcmp-error", common.GetComponentInfo()) + } } else if discValue == "tcp" { err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolTcpudp-error", common.GetComponentInfo()) + } } else if discValue == "udp" { err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolTcpudp-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -70405,6 +77802,7 @@ func UnmarshalSecurityGroupRuleCollection(m map[string]json.RawMessage, result i obj := new(SecurityGroupRuleCollection) err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -70615,14 +78013,17 @@ func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interf obj := new(SecurityGroupRulePatch) err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPatch) @@ -70631,18 +78032,22 @@ func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interf } 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 } err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePatch) if err != nil { + err = core.SDKErrorf(err, "", "remote-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)) @@ -70656,6 +78061,9 @@ func (securityGroupRulePatch *SecurityGroupRulePatch) AsPatch() (_patch map[stri if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -70756,23 +78164,37 @@ func UnmarshalSecurityGroupRulePrototype(m map[string]json.RawMessage, result in var discValue string err = core.UnmarshalPrimitive(m, "protocol", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", 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 { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -70827,30 +78249,37 @@ func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result inter obj := new(SecurityGroupRuleRemote) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-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, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -70900,22 +78329,27 @@ func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result obj := new(SecurityGroupRuleRemotePatch) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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)) @@ -70967,22 +78401,27 @@ func UnmarshalSecurityGroupRuleRemotePrototype(m map[string]json.RawMessage, res obj := new(SecurityGroupRuleRemotePrototype) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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)) @@ -71013,22 +78452,27 @@ func UnmarshalSecurityGroupTargetCollection(m map[string]json.RawMessage, result obj := new(SecurityGroupTargetCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSecurityGroupTargetCollectionFirst) 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, UnmarshalSecurityGroupTargetCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) if err != nil { + err = core.SDKErrorf(err, "", "targets-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)) @@ -71041,8 +78485,11 @@ func (resp *SecurityGroupTargetCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -71058,6 +78505,7 @@ func UnmarshalSecurityGroupTargetCollectionFirst(m map[string]json.RawMessage, r 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)) @@ -71075,6 +78523,7 @@ func UnmarshalSecurityGroupTargetCollectionNext(m map[string]json.RawMessage, re 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)) @@ -71147,34 +78596,42 @@ func UnmarshalSecurityGroupTargetReference(m map[string]json.RawMessage, result obj := new(SecurityGroupTargetReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) 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 } err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -71420,102 +78877,127 @@ func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error obj := new(Share) err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { + err = core.SDKErrorf(err, "", "access_control_mode-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) if err != nil { + err = core.SDKErrorf(err, "", "encryption-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.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, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "latest_job", &obj.LatestJob, UnmarshalShareJob) if err != nil { + err = core.SDKErrorf(err, "", "latest_job-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "latest_sync", &obj.LatestSync, UnmarshalShareLatestSync) if err != nil { + err = core.SDKErrorf(err, "", "latest_sync-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.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetReference) if err != nil { + err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalShareReference) if err != nil { + err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { + err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "replication_role", &obj.ReplicationRole) if err != nil { + err = core.SDKErrorf(err, "", "replication_role-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "replication_status", &obj.ReplicationStatus) if err != nil { + err = core.SDKErrorf(err, "", "replication_status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "replication_status_reasons", &obj.ReplicationStatusReasons, UnmarshalShareReplicationStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "replication_status_reasons-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.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareReference) if err != nil { + err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-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)) @@ -71546,22 +79028,27 @@ func UnmarshalShareCollection(m map[string]json.RawMessage, result interface{}) obj := new(ShareCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareCollectionFirst) 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, UnmarshalShareCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "shares", &obj.Shares, UnmarshalShare) if err != nil { + err = core.SDKErrorf(err, "", "shares-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)) @@ -71574,8 +79061,11 @@ func (resp *ShareCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -71591,6 +79081,7 @@ func UnmarshalShareCollectionFirst(m map[string]json.RawMessage, result interfac 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)) @@ -71608,6 +79099,7 @@ func UnmarshalShareCollectionNext(m map[string]json.RawMessage, result interface 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)) @@ -71643,14 +79135,17 @@ func UnmarshalShareIdentity(m map[string]json.RawMessage, result interface{}) (e obj := new(ShareIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -71671,10 +79166,12 @@ func UnmarshalShareInitialOwner(m map[string]json.RawMessage, result interface{} obj := new(ShareInitialOwner) err = core.UnmarshalPrimitive(m, "gid", &obj.Gid) if err != nil { + err = core.SDKErrorf(err, "", "gid-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uid", &obj.Uid) if err != nil { + err = core.SDKErrorf(err, "", "uid-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -71744,14 +79241,17 @@ func UnmarshalShareJob(m map[string]json.RawMessage, result interface{}) (err er obj := new(ShareJob) 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, UnmarshalShareJobStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-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)) @@ -71789,14 +79289,17 @@ func UnmarshalShareJobStatusReason(m map[string]json.RawMessage, result interfac obj := new(ShareJobStatusReason) 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)) @@ -71823,14 +79326,17 @@ func UnmarshalShareLatestSync(m map[string]json.RawMessage, result interface{}) obj := new(ShareLatestSync) 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, "data_transferred", &obj.DataTransferred) if err != nil { + err = core.SDKErrorf(err, "", "data_transferred-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) if err != nil { + err = core.SDKErrorf(err, "", "started_at-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -71962,54 +79468,67 @@ func UnmarshalShareMountTarget(m map[string]json.RawMessage, result interface{}) obj := new(ShareMountTarget) err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { + err = core.SDKErrorf(err, "", "access_control_mode-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, "lifecycle_state", &obj.LifecycleState) if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mount_path", &obj.MountPath) if err != nil { + err = core.SDKErrorf(err, "", "mount_path-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) 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, "", "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.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) if err != nil { + err = core.SDKErrorf(err, "", "transit_encryption-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 } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -72040,22 +79559,27 @@ func UnmarshalShareMountTargetCollection(m map[string]json.RawMessage, result in obj := new(ShareMountTargetCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareMountTargetCollectionFirst) 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, "mount_targets", &obj.MountTargets, UnmarshalShareMountTarget) if err != nil { + err = core.SDKErrorf(err, "", "mount_targets-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareMountTargetCollectionNext) 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)) @@ -72068,8 +79592,11 @@ func (resp *ShareMountTargetCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -72085,6 +79612,7 @@ func UnmarshalShareMountTargetCollectionFirst(m map[string]json.RawMessage, resu 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)) @@ -72102,6 +79630,7 @@ func UnmarshalShareMountTargetCollectionNext(m map[string]json.RawMessage, resul 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)) @@ -72119,6 +79648,7 @@ func UnmarshalShareMountTargetPatch(m map[string]json.RawMessage, result interfa obj := new(ShareMountTargetPatch) 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)) @@ -72132,6 +79662,9 @@ func (shareMountTargetPatch *ShareMountTargetPatch) AsPatch() (_patch map[string if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -72178,18 +79711,22 @@ func UnmarshalShareMountTargetPrototype(m map[string]json.RawMessage, result int obj := new(ShareMountTargetPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) if err != nil { + err = core.SDKErrorf(err, "", "transit_encryption-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -72226,22 +79763,27 @@ func UnmarshalShareMountTargetReference(m map[string]json.RawMessage, result int obj := new(ShareMountTargetReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) 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)) @@ -72260,6 +79802,7 @@ func UnmarshalShareMountTargetReferenceDeleted(m map[string]json.RawMessage, res obj := new(ShareMountTargetReferenceDeleted) 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)) @@ -72353,50 +79896,62 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json obj := new(ShareMountTargetVirtualNetworkInterfacePrototype) 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 } 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.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) 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()) 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)) @@ -72467,30 +80022,37 @@ func UnmarshalSharePatch(m map[string]json.RawMessage, result interface{}) (err obj := new(SharePatch) err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { + err = core.SDKErrorf(err, "", "access_control_mode-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { + err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -72504,6 +80066,9 @@ func (sharePatch *SharePatch) AsPatch() (_patch map[string]interface{}, err erro if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -72545,26 +80110,32 @@ func UnmarshalShareProfile(m map[string]json.RawMessage, result interface{}) (er obj := new(ShareProfile) err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalShareProfileCapacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-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.UnmarshalModel(m, "iops", &obj.Iops, UnmarshalShareProfileIops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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)) @@ -72619,30 +80190,37 @@ func UnmarshalShareProfileCapacity(m map[string]json.RawMessage, result interfac obj := new(ShareProfileCapacity) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -72673,22 +80251,27 @@ func UnmarshalShareProfileCollection(m map[string]json.RawMessage, result interf obj := new(ShareProfileCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareProfileCollectionFirst) 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, UnmarshalShareProfileCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalShareProfile) 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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -72701,8 +80284,11 @@ func (resp *ShareProfileCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -72718,6 +80304,7 @@ func UnmarshalShareProfileCollectionFirst(m map[string]json.RawMessage, result i 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)) @@ -72735,6 +80322,7 @@ func UnmarshalShareProfileCollectionNext(m map[string]json.RawMessage, result in 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)) @@ -72789,30 +80377,37 @@ func UnmarshalShareProfileIops(m map[string]json.RawMessage, result interface{}) obj := new(ShareProfileIops) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -72844,10 +80439,12 @@ func UnmarshalShareProfileIdentity(m map[string]json.RawMessage, result interfac obj := new(ShareProfileIdentity) 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)) @@ -72877,14 +80474,17 @@ func UnmarshalShareProfileReference(m map[string]json.RawMessage, result interfa obj := new(ShareProfileReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -72994,58 +80594,72 @@ func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) ( obj := new(SharePrototype) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) if err != nil { + err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { + err = core.SDKErrorf(err, "", "access_control_mode-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, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) if err != nil { + err = core.SDKErrorf(err, "", "initial_owner-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.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { + err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73101,6 +80715,9 @@ func (*VpcV1) NewSharePrototypeShareContext(profile ShareProfileIdentityIntf, re Zone: zone, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -73109,34 +80726,42 @@ func UnmarshalSharePrototypeShareContext(m map[string]json.RawMessage, result in obj := new(SharePrototypeShareContext) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { + err = core.SDKErrorf(err, "", "replication_cron_spec-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73180,30 +80805,37 @@ func UnmarshalShareReference(m map[string]json.RawMessage, result interface{}) ( obj := new(ShareReference) 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, UnmarshalShareReferenceDeleted) 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, UnmarshalShareRemote) 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)) @@ -73222,6 +80854,7 @@ func UnmarshalShareReferenceDeleted(m map[string]json.RawMessage, result interfa obj := new(ShareReferenceDeleted) 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)) @@ -73241,6 +80874,7 @@ func UnmarshalShareRemote(m map[string]json.RawMessage, result interface{}) (err obj := new(ShareRemote) 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)) @@ -73278,14 +80912,17 @@ func UnmarshalShareReplicationStatusReason(m map[string]json.RawMessage, result obj := new(ShareReplicationStatusReason) 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)) @@ -73411,102 +81048,127 @@ func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err er obj := new(Snapshot) 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, "bootable", &obj.Bootable) if err != nil { + err = core.SDKErrorf(err, "", "bootable-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "captured_at", &obj.CapturedAt) if err != nil { + err = core.SDKErrorf(err, "", "captured_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) if err != nil { + err = core.SDKErrorf(err, "", "clones-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "copies", &obj.Copies, UnmarshalSnapshotCopiesItem) if err != nil { + err = core.SDKErrorf(err, "", "copies-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "deletable", &obj.Deletable) if err != nil { + err = core.SDKErrorf(err, "", "deletable-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) if err != nil { + err = core.SDKErrorf(err, "", "encryption-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.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, "minimum_capacity", &obj.MinimumCapacity) if err != nil { + err = core.SDKErrorf(err, "", "minimum_capacity-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, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) if err != nil { + err = core.SDKErrorf(err, "", "operating_system-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.UnmarshalPrimitive(m, "service_tags", &obj.ServiceTags) if err != nil { + err = core.SDKErrorf(err, "", "service_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "snapshot_consistency_group", &obj.SnapshotConsistencyGroup, UnmarshalSnapshotConsistencyGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "snapshot_consistency_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_image", &obj.SourceImage, UnmarshalImageReference) if err != nil { + err = core.SDKErrorf(err, "", "source_image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotSourceSnapshot) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) if err != nil { + err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73530,14 +81192,17 @@ func UnmarshalSnapshotClone(m map[string]json.RawMessage, result interface{}) (e obj := new(SnapshotClone) err = core.UnmarshalPrimitive(m, "available", &obj.Available) if err != nil { + err = core.SDKErrorf(err, "", "available-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, "zone", &obj.Zone, UnmarshalZoneReference) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73555,6 +81220,7 @@ func UnmarshalSnapshotCloneCollection(m map[string]json.RawMessage, result inter obj := new(SnapshotCloneCollection) err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) if err != nil { + err = core.SDKErrorf(err, "", "clones-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73574,6 +81240,9 @@ func (*VpcV1) NewSnapshotClonePrototype(zone ZoneIdentityIntf) (_model *Snapshot Zone: zone, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -73582,6 +81251,7 @@ func UnmarshalSnapshotClonePrototype(m map[string]json.RawMessage, result interf obj := new(SnapshotClonePrototype) err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73612,22 +81282,27 @@ func UnmarshalSnapshotCollection(m map[string]json.RawMessage, result interface{ obj := new(SnapshotCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSnapshotCollectionFirst) 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, UnmarshalSnapshotCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshot) if err != nil { + err = core.SDKErrorf(err, "", "snapshots-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)) @@ -73640,8 +81315,11 @@ func (resp *SnapshotCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -73657,6 +81335,7 @@ func UnmarshalSnapshotCollectionFirst(m map[string]json.RawMessage, result inter 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)) @@ -73674,6 +81353,7 @@ func UnmarshalSnapshotCollectionNext(m map[string]json.RawMessage, result interf 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)) @@ -73746,50 +81426,62 @@ func UnmarshalSnapshotConsistencyGroup(m map[string]json.RawMessage, result inte obj := new(SnapshotConsistencyGroup) 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, "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.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_snapshots_on_delete-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, "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.UnmarshalPrimitive(m, "service_tags", &obj.ServiceTags) if err != nil { + err = core.SDKErrorf(err, "", "service_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotReference) if err != nil { + err = core.SDKErrorf(err, "", "snapshots-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73820,22 +81512,27 @@ func UnmarshalSnapshotConsistencyGroupCollection(m map[string]json.RawMessage, r obj := new(SnapshotConsistencyGroupCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSnapshotConsistencyGroupCollectionFirst) 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, UnmarshalSnapshotConsistencyGroupCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "snapshot_consistency_groups", &obj.SnapshotConsistencyGroups, UnmarshalSnapshotConsistencyGroup) if err != nil { + err = core.SDKErrorf(err, "", "snapshot_consistency_groups-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)) @@ -73848,8 +81545,11 @@ func (resp *SnapshotConsistencyGroupCollection) GetNextStart() (*string, error) return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -73865,6 +81565,7 @@ func UnmarshalSnapshotConsistencyGroupCollectionFirst(m map[string]json.RawMessa 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)) @@ -73882,6 +81583,7 @@ func UnmarshalSnapshotConsistencyGroupCollectionNext(m map[string]json.RawMessag 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)) @@ -73903,10 +81605,12 @@ func UnmarshalSnapshotConsistencyGroupPatch(m map[string]json.RawMessage, result obj := new(SnapshotConsistencyGroupPatch) err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_snapshots_on_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)) @@ -73920,6 +81624,9 @@ func (snapshotConsistencyGroupPatch *SnapshotConsistencyGroupPatch) AsPatch() (_ if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -73958,18 +81665,22 @@ func UnmarshalSnapshotConsistencyGroupPrototype(m map[string]json.RawMessage, re obj := new(SnapshotConsistencyGroupPrototype) err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_snapshots_on_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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext) if err != nil { + err = core.SDKErrorf(err, "", "snapshots-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -74010,26 +81721,32 @@ func UnmarshalSnapshotConsistencyGroupReference(m map[string]json.RawMessage, re obj := new(SnapshotConsistencyGroupReference) 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, UnmarshalSnapshotConsistencyGroupReferenceDeleted) 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)) @@ -74048,6 +81765,7 @@ func UnmarshalSnapshotConsistencyGroupReferenceDeleted(m map[string]json.RawMess obj := new(SnapshotConsistencyGroupReferenceDeleted) 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)) @@ -74091,30 +81809,37 @@ func UnmarshalSnapshotCopiesItem(m map[string]json.RawMessage, result interface{ obj := new(SnapshotCopiesItem) 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, UnmarshalSnapshotReferenceDeleted) 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, UnmarshalSnapshotRemote) 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)) @@ -74150,14 +81875,17 @@ func UnmarshalSnapshotIdentity(m map[string]json.RawMessage, result interface{}) obj := new(SnapshotIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -74178,10 +81906,12 @@ func UnmarshalSnapshotPatch(m map[string]json.RawMessage, result interface{}) (e obj := new(SnapshotPatch) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -74195,6 +81925,9 @@ func (snapshotPatch *SnapshotPatch) AsPatch() (_patch map[string]interface{}, er if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -74249,30 +81982,37 @@ func UnmarshalSnapshotPrototype(m map[string]json.RawMessage, result interface{} obj := new(SnapshotPrototype) err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) if err != nil { + err = core.SDKErrorf(err, "", "clones-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_volume-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -74298,6 +82038,9 @@ func (*VpcV1) NewSnapshotPrototypeSnapshotConsistencyGroupContext(sourceVolume V SourceVolume: sourceVolume, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -74306,14 +82049,17 @@ func UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext(m map[string]json obj := new(SnapshotPrototypeSnapshotConsistencyGroupContext) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -74357,30 +82103,37 @@ func UnmarshalSnapshotReference(m map[string]json.RawMessage, result interface{} obj := new(SnapshotReference) 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, UnmarshalSnapshotReferenceDeleted) 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, UnmarshalSnapshotRemote) 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)) @@ -74399,6 +82152,7 @@ func UnmarshalSnapshotReferenceDeleted(m map[string]json.RawMessage, result inte obj := new(SnapshotReferenceDeleted) 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)) @@ -74418,6 +82172,7 @@ func UnmarshalSnapshotRemote(m map[string]json.RawMessage, result interface{}) ( obj := new(SnapshotRemote) 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)) @@ -74461,30 +82216,37 @@ func UnmarshalSnapshotSourceSnapshot(m map[string]json.RawMessage, result interf obj := new(SnapshotSourceSnapshot) 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, UnmarshalSnapshotReferenceDeleted) 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, UnmarshalSnapshotRemote) 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)) @@ -74652,70 +82414,87 @@ func UnmarshalSubnet(m map[string]json.RawMessage, result interface{}) (err erro obj := new(Subnet) err = core.UnmarshalPrimitive(m, "available_ipv4_address_count", &obj.AvailableIpv4AddressCount) if err != nil { + err = core.SDKErrorf(err, "", "available_ipv4_address_count-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-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 } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLReference) if err != nil { + err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayReference) if err != nil { + err = core.SDKErrorf(err, "", "public_gateway-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, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableReference) if err != nil { + err = core.SDKErrorf(err, "", "routing_table-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.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) if err != nil { + err = core.SDKErrorf(err, "", "total_ipv4_address_count-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)) @@ -74746,22 +82525,27 @@ func UnmarshalSubnetCollection(m map[string]json.RawMessage, result interface{}) obj := new(SubnetCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSubnetCollectionFirst) 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, UnmarshalSubnetCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnet) 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)) @@ -74774,8 +82558,11 @@ func (resp *SubnetCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -74791,6 +82578,7 @@ func UnmarshalSubnetCollectionFirst(m map[string]json.RawMessage, result interfa 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)) @@ -74808,6 +82596,7 @@ func UnmarshalSubnetCollectionNext(m map[string]json.RawMessage, result interfac 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)) @@ -74843,14 +82632,17 @@ func UnmarshalSubnetIdentity(m map[string]json.RawMessage, result interface{}) ( obj := new(SubnetIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -74879,18 +82671,22 @@ func UnmarshalSubnetPatch(m map[string]json.RawMessage, result interface{}) (err obj := new(SubnetPatch) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) if err != nil { + err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalSubnetPublicGatewayPatch) if err != nil { + err = core.SDKErrorf(err, "", "public_gateway-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) if err != nil { + err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -74904,6 +82700,9 @@ func (subnetPatch *SubnetPatch) AsPatch() (_patch map[string]interface{}, err er if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -74973,42 +82772,52 @@ func UnmarshalSubnetPrototype(m map[string]json.RawMessage, result interface{}) obj := new(SubnetPrototype) 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.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) if err != nil { + err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) if err != nil { + err = core.SDKErrorf(err, "", "public_gateway-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, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) if err != nil { + err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-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 } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-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)) @@ -75044,14 +82853,17 @@ func UnmarshalSubnetPublicGatewayPatch(m map[string]json.RawMessage, result inte obj := new(SubnetPublicGatewayPatch) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -75091,26 +82903,32 @@ func UnmarshalSubnetReference(m map[string]json.RawMessage, result interface{}) obj := new(SubnetReference) 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, UnmarshalSubnetReferenceDeleted) 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)) @@ -75129,6 +82947,7 @@ func UnmarshalSubnetReferenceDeleted(m map[string]json.RawMessage, result interf obj := new(SubnetReferenceDeleted) 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)) @@ -75160,10 +82979,12 @@ func UnmarshalTrustedProfileIdentity(m map[string]json.RawMessage, result interf obj := new(TrustedProfileIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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)) @@ -75193,14 +83014,17 @@ func UnmarshalTrustedProfileReference(m map[string]json.RawMessage, result inter obj := new(TrustedProfileReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -77974,14 +85798,17 @@ func UnmarshalVcpu(m map[string]json.RawMessage, result interface{}) (err error) obj := new(Vcpu) err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) if err != nil { + err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "count", &obj.Count) if err != nil { + err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) if err != nil { + err = core.SDKErrorf(err, "", "manufacturer-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78085,66 +85912,82 @@ func UnmarshalVPC(m map[string]json.RawMessage, result interface{}) (err error) obj := new(VPC) err = core.UnmarshalPrimitive(m, "classic_access", &obj.ClassicAccess) if err != nil { + err = core.SDKErrorf(err, "", "classic_access-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "cse_source_ips", &obj.CseSourceIps, UnmarshalVpccseSourceIP) if err != nil { + err = core.SDKErrorf(err, "", "cse_source_ips-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_network_acl", &obj.DefaultNetworkACL, UnmarshalNetworkACLReference) if err != nil { + err = core.SDKErrorf(err, "", "default_network_acl-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_routing_table", &obj.DefaultRoutingTable, UnmarshalRoutingTableReference) if err != nil { + err = core.SDKErrorf(err, "", "default_routing_table-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_security_group", &obj.DefaultSecurityGroup, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "default_security_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdns) if err != nil { + err = core.SDKErrorf(err, "", "dns-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPCHealthReason) 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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78165,10 +86008,12 @@ func UnmarshalVpccseSourceIP(m map[string]json.RawMessage, result interface{}) ( obj := new(VpccseSourceIP) err = core.UnmarshalModel(m, "ip", &obj.IP, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "ip-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)) @@ -78199,22 +86044,27 @@ func UnmarshalVPCCollection(m map[string]json.RawMessage, result interface{}) (e obj := new(VPCCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPCCollectionFirst) 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, UnmarshalVPCCollectionNext) 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 } err = core.UnmarshalModel(m, "vpcs", &obj.Vpcs, UnmarshalVPC) if err != nil { + err = core.SDKErrorf(err, "", "vpcs-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78227,8 +86077,11 @@ func (resp *VPCCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -78244,6 +86097,7 @@ func UnmarshalVPCCollectionFirst(m map[string]json.RawMessage, result interface{ 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)) @@ -78261,6 +86115,7 @@ func UnmarshalVPCCollectionNext(m map[string]json.RawMessage, result interface{} 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)) @@ -78284,14 +86139,17 @@ func UnmarshalVpcdns(m map[string]json.RawMessage, result interface{}) (err erro obj := new(Vpcdns) err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) if err != nil { + err = core.SDKErrorf(err, "", "enable_hub-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "resolution_binding_count", &obj.ResolutionBindingCount) if err != nil { + err = core.SDKErrorf(err, "", "resolution_binding_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolver) if err != nil { + err = core.SDKErrorf(err, "", "resolver-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78316,10 +86174,12 @@ func UnmarshalVpcdnsPatch(m map[string]json.RawMessage, result interface{}) (err obj := new(VpcdnsPatch) err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) if err != nil { + err = core.SDKErrorf(err, "", "enable_hub-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPatch) if err != nil { + err = core.SDKErrorf(err, "", "resolver-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78342,10 +86202,12 @@ func UnmarshalVpcdnsPrototype(m map[string]json.RawMessage, result interface{}) obj := new(VpcdnsPrototype) err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) if err != nil { + err = core.SDKErrorf(err, "", "enable_hub-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPrototype) if err != nil { + err = core.SDKErrorf(err, "", "resolver-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78364,6 +86226,7 @@ type VpcdnsResolutionBinding struct { EndpointGateways []EndpointGatewayReferenceRemote `json:"endpoint_gateways" validate:"required"` // The reasons for the current `health_state` (if any). +<<<<<<< Updated upstream HealthReasons []VpcdnsResolutionBindingHealthReason `json:"health_reasons" validate:"required"` // The health of this resource: @@ -78373,6 +86236,21 @@ type VpcdnsResolutionBinding struct { // - `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. +======= + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + HealthReasons []VpcdnsResolutionBindingHealthReason `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. +>>>>>>> Stashed changes HealthState *string `json:"health_state" validate:"required"` // The URL for this DNS resolution binding. @@ -78397,6 +86275,7 @@ type VpcdnsResolutionBinding struct { } // Constants associated with the VpcdnsResolutionBinding.HealthState property. +<<<<<<< Updated upstream // The health of this resource: // - `ok`: No abnormal behavior detected // - `degraded`: Experiencing compromised performance, capacity, or connectivity @@ -78404,6 +86283,15 @@ type VpcdnsResolutionBinding struct { // - `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. +======= +// 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. +>>>>>>> Stashed changes const ( VpcdnsResolutionBindingHealthStateDegradedConst = "degraded" VpcdnsResolutionBindingHealthStateFaultedConst = "faulted" @@ -78434,10 +86322,22 @@ func UnmarshalVpcdnsResolutionBinding(m map[string]json.RawMessage, result inter obj := new(VpcdnsResolutionBinding) 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, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGatewayReferenceRemote) if err != nil { + err = core.SDKErrorf(err, "", "endpoint_gateways-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVpcdnsResolutionBindingHealthReason) + 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.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVpcdnsResolutionBindingHealthReason) @@ -78450,26 +86350,32 @@ func UnmarshalVpcdnsResolutionBinding(m map[string]json.RawMessage, result inter } 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.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceRemote) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78500,22 +86406,27 @@ func UnmarshalVpcdnsResolutionBindingCollection(m map[string]json.RawMessage, re obj := new(VpcdnsResolutionBindingCollection) err = core.UnmarshalModel(m, "dns_resolution_bindings", &obj.DnsResolutionBindings, UnmarshalVpcdnsResolutionBinding) if err != nil { + err = core.SDKErrorf(err, "", "dns_resolution_bindings-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVpcdnsResolutionBindingCollectionFirst) 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, UnmarshalVpcdnsResolutionBindingCollectionNext) 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)) @@ -78528,15 +86439,22 @@ func (resp *VpcdnsResolutionBindingCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } // VpcdnsResolutionBindingHealthReason : VpcdnsResolutionBindingHealthReason struct type VpcdnsResolutionBindingHealthReason struct { +<<<<<<< Updated upstream // A reason code for this health state. +======= + // A snake case string succinctly identifying the reason for this health state. +>>>>>>> Stashed changes Code *string `json:"code" validate:"required"` // An explanation of the reason for this health state. @@ -78547,7 +86465,11 @@ type VpcdnsResolutionBindingHealthReason struct { } // Constants associated with the VpcdnsResolutionBindingHealthReason.Code property. +<<<<<<< Updated upstream // A reason code for this health state. +======= +// A snake case string succinctly identifying the reason for this health state. +>>>>>>> Stashed changes const ( VpcdnsResolutionBindingHealthReasonCodeDisconnectedFromBoundVPCConst = "disconnected_from_bound_vpc" VpcdnsResolutionBindingHealthReasonCodeInternalErrorConst = "internal_error" @@ -78558,14 +86480,26 @@ func UnmarshalVpcdnsResolutionBindingHealthReason(m map[string]json.RawMessage, obj := new(VpcdnsResolutionBindingHealthReason) err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { +<<<<<<< Updated upstream +======= + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) +>>>>>>> Stashed changes return } err = core.UnmarshalPrimitive(m, "message", &obj.Message) if err != nil { +<<<<<<< Updated upstream +======= + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) +>>>>>>> Stashed changes return } err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { +<<<<<<< Updated upstream +======= + err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) +>>>>>>> Stashed changes return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78583,6 +86517,7 @@ func UnmarshalVpcdnsResolutionBindingPatch(m map[string]json.RawMessage, result obj := new(VpcdnsResolutionBindingPatch) 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)) @@ -78596,6 +86531,9 @@ func (vpcdnsResolutionBindingPatch *VpcdnsResolutionBindingPatch) AsPatch() (_pa if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -78707,22 +86645,27 @@ func UnmarshalVpcdnsResolver(m map[string]json.RawMessage, result interface{}) ( obj := new(VpcdnsResolver) err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) if err != nil { + err = core.SDKErrorf(err, "", "servers-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.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer) if err != nil { + err = core.SDKErrorf(err, "", "manual_servers-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration) if err != nil { + err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78801,14 +86744,17 @@ func UnmarshalVpcdnsResolverPatch(m map[string]json.RawMessage, result interface obj := new(VpcdnsResolverPatch) err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manual_servers-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.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVpcdnsResolverVPCPatch) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78866,10 +86812,12 @@ func UnmarshalVpcdnsResolverPrototype(m map[string]json.RawMessage, result inter obj := new(VpcdnsResolverPrototype) err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manual_servers-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78911,14 +86859,17 @@ func UnmarshalVpcdnsResolverVPCPatch(m map[string]json.RawMessage, result interf obj := new(VpcdnsResolverVPCPatch) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78949,14 +86900,17 @@ func UnmarshalVPCHealthReason(m map[string]json.RawMessage, result interface{}) obj := new(VPCHealthReason) 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)) @@ -78992,14 +86946,17 @@ func UnmarshalVPCIdentity(m map[string]json.RawMessage, result interface{}) (err obj := new(VPCIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -79020,10 +86977,12 @@ func UnmarshalVPCPatch(m map[string]json.RawMessage, result interface{}) (err er obj := new(VPCPatch) err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdnsPatch) if err != nil { + err = core.SDKErrorf(err, "", "dns-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)) @@ -79037,6 +86996,9 @@ func (vpcPatch *VPCPatch) AsPatch() (_patch map[string]interface{}, err error) { if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -79073,26 +87035,32 @@ func UnmarshalVPCReference(m map[string]json.RawMessage, result interface{}) (er obj := new(VPCReference) 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, UnmarshalVPCReferenceDeleted) 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)) @@ -79138,30 +87106,37 @@ func UnmarshalVPCReferenceDnsResolverContext(m map[string]json.RawMessage, resul obj := new(VPCReferenceDnsResolverContext) 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, UnmarshalVPCReferenceDnsResolverContextDeleted) 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, UnmarshalVPCRemote) 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)) @@ -79180,6 +87155,7 @@ func UnmarshalVPCReferenceDeleted(m map[string]json.RawMessage, result interface obj := new(VPCReferenceDeleted) 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)) @@ -79198,6 +87174,7 @@ func UnmarshalVPCReferenceDnsResolverContextDeleted(m map[string]json.RawMessage obj := new(VPCReferenceDnsResolverContextDeleted) 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)) @@ -79237,26 +87214,32 @@ func UnmarshalVPCReferenceRemote(m map[string]json.RawMessage, result interface{ obj := new(VPCReferenceRemote) 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) 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, UnmarshalVPCRemote) 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)) @@ -79280,10 +87263,12 @@ func UnmarshalVPCRemote(m map[string]json.RawMessage, result interface{}) (err e obj := new(VPCRemote) err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) if err != nil { + err = core.SDKErrorf(err, "", "account-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)) @@ -79401,66 +87386,82 @@ func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err obj := new(VPNGateway) err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) if err != nil { + err = core.SDKErrorf(err, "", "connections-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) 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.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) if err != nil { + err = core.SDKErrorf(err, "", "members-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, "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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-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.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -79491,22 +87492,27 @@ func UnmarshalVPNGatewayCollection(m map[string]json.RawMessage, result interfac obj := new(VPNGatewayCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNGatewayCollectionFirst) 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, UnmarshalVPNGatewayCollectionNext) 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 } err = core.UnmarshalModel(m, "vpn_gateways", &obj.VPNGateways, UnmarshalVPNGateway) if err != nil { + err = core.SDKErrorf(err, "", "vpn_gateways-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -79519,8 +87525,11 @@ func (resp *VPNGatewayCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -79536,6 +87545,7 @@ func UnmarshalVPNGatewayCollectionFirst(m map[string]json.RawMessage, result int 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)) @@ -79553,6 +87563,7 @@ func UnmarshalVPNGatewayCollectionNext(m map[string]json.RawMessage, result inte 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)) @@ -79670,19 +87681,42 @@ func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interfac var discValue string err = core.UnmarshalPrimitive(m, "mode", &discValue) if err != nil { +<<<<<<< Updated upstream err = fmt.Errorf("error unmarshalling discriminator property 'mode': %s", err.Error()) return } if discValue == "" { err = fmt.Errorf("required discriminator property 'mode' not found in JSON object") +======= + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'mode': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) + return + } + if discValue == "" { + err = core.SDKErrorf(err, "required discriminator property 'mode' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) +>>>>>>> Stashed changes return } if discValue == "policy" { err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionPolicyMode) +<<<<<<< Updated upstream } else if discValue == "route" { err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteMode) } else { err = fmt.Errorf("unrecognized value for discriminator property 'mode': %s", discValue) +======= + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionPolicyMode-error", common.GetComponentInfo()) + } + } else if discValue == "route" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteMode) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionRouteMode-error", common.GetComponentInfo()) + } + } else { + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'mode': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) +>>>>>>> Stashed changes } return } @@ -79698,6 +87732,7 @@ func UnmarshalVPNGatewayConnectionCollection(m map[string]json.RawMessage, resul obj := new(VPNGatewayConnectionCollection) err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnection) if err != nil { + err = core.SDKErrorf(err, "", "connections-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -79730,14 +87765,17 @@ func UnmarshalVPNGatewayConnectionDpd(m map[string]json.RawMessage, result inter obj := new(VPNGatewayConnectionDpd) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) if err != nil { + err = core.SDKErrorf(err, "", "interval-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) if err != nil { + err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -79770,14 +87808,17 @@ func UnmarshalVPNGatewayConnectionDpdPatch(m map[string]json.RawMessage, result obj := new(VPNGatewayConnectionDpdPatch) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) if err != nil { + err = core.SDKErrorf(err, "", "interval-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) if err != nil { + err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -79810,14 +87851,17 @@ func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, res obj := new(VPNGatewayConnectionDpdPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) if err != nil { + err = core.SDKErrorf(err, "", "interval-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) if err != nil { + err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -79850,10 +87894,12 @@ func UnmarshalVPNGatewayConnectionIkePolicyPatch(m map[string]json.RawMessage, r obj := new(VPNGatewayConnectionIkePolicyPatch) 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)) @@ -79886,10 +87932,12 @@ func UnmarshalVPNGatewayConnectionIkePolicyPrototype(m map[string]json.RawMessag obj := new(VPNGatewayConnectionIkePolicyPrototype) 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)) @@ -79922,10 +87970,12 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPatch(m map[string]json.RawMessage, obj := new(VPNGatewayConnectionIPsecPolicyPatch) 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)) @@ -79958,10 +88008,12 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPrototype(m map[string]json.RawMess obj := new(VPNGatewayConnectionIPsecPolicyPrototype) 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)) @@ -79979,6 +88031,7 @@ func UnmarshalVPNGatewayConnectionLocalCIDRs(m map[string]json.RawMessage, resul obj := new(VPNGatewayConnectionLocalCIDRs) err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) if err != nil { + err = core.SDKErrorf(err, "", "local_cidrs-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80025,34 +88078,42 @@ func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result int obj := new(VPNGatewayConnectionPatch) err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPatch) if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch) if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPatch) if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-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, "peer_address", &obj.PeerAddress) if err != nil { + err = core.SDKErrorf(err, "", "peer_address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) if err != nil { + err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) if err != nil { + err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80066,6 +88127,9 @@ func (vpnGatewayConnectionPatch *VPNGatewayConnectionPatch) AsPatch() (_patch ma if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -80080,6 +88144,7 @@ func UnmarshalVPNGatewayConnectionPeerCIDRs(m map[string]json.RawMessage, result obj := new(VPNGatewayConnectionPeerCIDRs) err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) if err != nil { + err = core.SDKErrorf(err, "", "peer_cidrs-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80144,42 +88209,52 @@ func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result obj := new(VPNGatewayConnectionPrototype) err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-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, "peer_address", &obj.PeerAddress) if err != nil { + err = core.SDKErrorf(err, "", "peer_address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) if err != nil { + err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) if err != nil { + err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) if err != nil { + err = core.SDKErrorf(err, "", "local_cidrs-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) if err != nil { + err = core.SDKErrorf(err, "", "peer_cidrs-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80216,22 +88291,27 @@ func UnmarshalVPNGatewayConnectionReference(m map[string]json.RawMessage, result obj := new(VPNGatewayConnectionReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) 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)) @@ -80250,6 +88330,7 @@ func UnmarshalVPNGatewayConnectionReferenceDeleted(m map[string]json.RawMessage, obj := new(VPNGatewayConnectionReferenceDeleted) 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)) @@ -80280,14 +88361,17 @@ func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMes obj := new(VPNGatewayConnectionStaticRouteModeTunnel) err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "public_ip-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, UnmarshalVPNGatewayConnectionTunnelStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80329,14 +88413,17 @@ func UnmarshalVPNGatewayConnectionStatusReason(m map[string]json.RawMessage, res obj := new(VPNGatewayConnectionStatusReason) 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)) @@ -80406,14 +88493,17 @@ func UnmarshalVPNGatewayConnectionTunnelStatusReason(m map[string]json.RawMessag obj := new(VPNGatewayConnectionTunnelStatusReason) 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)) @@ -80459,14 +88549,17 @@ func UnmarshalVPNGatewayHealthReason(m map[string]json.RawMessage, result interf obj := new(VPNGatewayHealthReason) 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)) @@ -80506,14 +88599,17 @@ func UnmarshalVPNGatewayLifecycleReason(m map[string]json.RawMessage, result int obj := new(VPNGatewayLifecycleReason) 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)) @@ -80591,30 +88687,37 @@ func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) obj := new(VPNGatewayMember) err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayMemberHealthReason) 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayMemberLifecycleReason) 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.UnmarshalModel(m, "private_ip", &obj.PrivateIP, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "private_ip-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "public_ip-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "role", &obj.Role) if err != nil { + err = core.SDKErrorf(err, "", "role-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80657,14 +88760,17 @@ func UnmarshalVPNGatewayMemberHealthReason(m map[string]json.RawMessage, result obj := new(VPNGatewayMemberHealthReason) 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)) @@ -80704,14 +88810,17 @@ func UnmarshalVPNGatewayMemberLifecycleReason(m map[string]json.RawMessage, resu obj := new(VPNGatewayMemberLifecycleReason) 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)) @@ -80729,6 +88838,7 @@ func UnmarshalVPNGatewayPatch(m map[string]json.RawMessage, result interface{}) obj := new(VPNGatewayPatch) 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)) @@ -80742,6 +88852,9 @@ func (vpnGatewayPatch *VPNGatewayPatch) AsPatch() (_patch map[string]interface{} if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -80784,18 +88897,22 @@ func UnmarshalVPNGatewayPrototype(m map[string]json.RawMessage, result interface obj := new(VPNGatewayPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80814,6 +88931,7 @@ func UnmarshalVPNGatewayReferenceDeleted(m map[string]json.RawMessage, result in obj := new(VPNGatewayReferenceDeleted) 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)) @@ -80957,106 +89075,132 @@ func UnmarshalVPNServer(m map[string]json.RawMessage, result interface{}) (err e obj := new(VPNServer) err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "certificate-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthentication) if err != nil { + err = core.SDKErrorf(err, "", "client_authentication-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "client_auto_delete", &obj.ClientAutoDelete) if err != nil { + err = core.SDKErrorf(err, "", "client_auto_delete-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "client_auto_delete_timeout", &obj.ClientAutoDeleteTimeout) if err != nil { + err = core.SDKErrorf(err, "", "client_auto_delete_timeout-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "client_dns_server_ips-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) if err != nil { + err = core.SDKErrorf(err, "", "client_idle_timeout-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) if err != nil { + err = core.SDKErrorf(err, "", "client_ip_pool-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) if err != nil { + err = core.SDKErrorf(err, "", "enable_split_tunneling-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNServerHealthReason) 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, "hostname", &obj.Hostname) if err != nil { + err = core.SDKErrorf(err, "", "hostname-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, UnmarshalVPNServerLifecycleReason) 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, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "private_ips-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, "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, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -81101,18 +89245,22 @@ func UnmarshalVPNServerAuthentication(m map[string]json.RawMessage, result inter obj := new(VPNServerAuthentication) err = core.UnmarshalPrimitive(m, "method", &obj.Method) if err != nil { + err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) if err != nil { + err = core.SDKErrorf(err, "", "identity_provider-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "client_ca-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) if err != nil { + err = core.SDKErrorf(err, "", "crl-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -81154,6 +89302,7 @@ func UnmarshalVPNServerAuthenticationByUsernameIDProvider(m map[string]json.RawM obj := new(VPNServerAuthenticationByUsernameIDProvider) err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) if err != nil { + err = core.SDKErrorf(err, "", "provider_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -81199,19 +89348,27 @@ func UnmarshalVPNServerAuthenticationPrototype(m map[string]json.RawMessage, res var discValue string err = core.UnmarshalPrimitive(m, "method", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'method': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'method': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'method' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'method' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "certificate" { err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype-error", common.GetComponentInfo()) + } } else if discValue == "username" { err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'method': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'method': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -81286,46 +89443,57 @@ func UnmarshalVPNServerClient(m map[string]json.RawMessage, result interface{}) obj := new(VPNServerClient) err = core.UnmarshalModel(m, "client_ip", &obj.ClientIP, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "client_ip-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "common_name", &obj.CommonName) if err != nil { + err = core.SDKErrorf(err, "", "common_name-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, "disconnected_at", &obj.DisconnectedAt) if err != nil { + err = core.SDKErrorf(err, "", "disconnected_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.UnmarshalModel(m, "remote_ip", &obj.RemoteIP, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "remote_ip-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "remote_port", &obj.RemotePort) if err != nil { + err = core.SDKErrorf(err, "", "remote_port-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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-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)) @@ -81356,22 +89524,27 @@ func UnmarshalVPNServerClientCollection(m map[string]json.RawMessage, result int obj := new(VPNServerClientCollection) err = core.UnmarshalModel(m, "clients", &obj.Clients, UnmarshalVPNServerClient) if err != nil { + err = core.SDKErrorf(err, "", "clients-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerClientCollectionFirst) 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, UnmarshalVPNServerClientCollectionNext) 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)) @@ -81384,8 +89557,11 @@ func (resp *VPNServerClientCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -81401,6 +89577,7 @@ func UnmarshalVPNServerClientCollectionFirst(m map[string]json.RawMessage, resul 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)) @@ -81418,6 +89595,7 @@ func UnmarshalVPNServerClientCollectionNext(m map[string]json.RawMessage, result 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)) @@ -81448,22 +89626,27 @@ func UnmarshalVPNServerCollection(m map[string]json.RawMessage, result interface obj := new(VPNServerCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerCollectionFirst) 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, UnmarshalVPNServerCollectionNext) 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 } err = core.UnmarshalModel(m, "vpn_servers", &obj.VPNServers, UnmarshalVPNServer) if err != nil { + err = core.SDKErrorf(err, "", "vpn_servers-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -81476,8 +89659,11 @@ func (resp *VPNServerCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -81493,6 +89679,7 @@ func UnmarshalVPNServerCollectionFirst(m map[string]json.RawMessage, result inte 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)) @@ -81510,6 +89697,7 @@ func UnmarshalVPNServerCollectionNext(m map[string]json.RawMessage, result inter 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)) @@ -81569,14 +89757,17 @@ func UnmarshalVPNServerHealthReason(m map[string]json.RawMessage, result interfa obj := new(VPNServerHealthReason) 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)) @@ -81616,14 +89807,17 @@ func UnmarshalVPNServerLifecycleReason(m map[string]json.RawMessage, result inte obj := new(VPNServerLifecycleReason) 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)) @@ -81688,42 +89882,52 @@ func UnmarshalVPNServerPatch(m map[string]json.RawMessage, result interface{}) ( obj := new(VPNServerPatch) err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceIdentity) if err != nil { + err = core.SDKErrorf(err, "", "certificate-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthenticationPrototype) if err != nil { + err = core.SDKErrorf(err, "", "client_authentication-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "client_dns_server_ips-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) if err != nil { + err = core.SDKErrorf(err, "", "client_idle_timeout-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) if err != nil { + err = core.SDKErrorf(err, "", "client_ip_pool-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) if err != nil { + err = core.SDKErrorf(err, "", "enable_split_tunneling-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, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-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, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -81737,6 +89941,9 @@ func (vpnServerPatch *VPNServerPatch) AsPatch() (_patch map[string]interface{}, if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -81752,6 +89959,7 @@ func UnmarshalVPNServerReferenceDeleted(m map[string]json.RawMessage, result int obj := new(VPNServerReferenceDeleted) 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)) @@ -81861,46 +90069,57 @@ func UnmarshalVPNServerRoute(m map[string]json.RawMessage, result interface{}) ( obj := new(VPNServerRoute) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNServerRouteHealthReason) 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNServerRouteLifecycleReason) 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)) @@ -81931,22 +90150,27 @@ func UnmarshalVPNServerRouteCollection(m map[string]json.RawMessage, result inte obj := new(VPNServerRouteCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerRouteCollectionFirst) 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, UnmarshalVPNServerRouteCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalVPNServerRoute) 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)) @@ -81959,8 +90183,11 @@ func (resp *VPNServerRouteCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -81976,6 +90203,7 @@ func UnmarshalVPNServerRouteCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -81993,6 +90221,7 @@ func UnmarshalVPNServerRouteCollectionNext(m map[string]json.RawMessage, result 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)) @@ -82030,14 +90259,17 @@ func UnmarshalVPNServerRouteHealthReason(m map[string]json.RawMessage, result in obj := new(VPNServerRouteHealthReason) 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)) @@ -82077,14 +90309,17 @@ func UnmarshalVPNServerRouteLifecycleReason(m map[string]json.RawMessage, result obj := new(VPNServerRouteLifecycleReason) 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)) @@ -82102,6 +90337,7 @@ func UnmarshalVPNServerRoutePatch(m map[string]json.RawMessage, result interface obj := new(VPNServerRoutePatch) 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)) @@ -82115,6 +90351,9 @@ func (vpnServerRoutePatch *VPNServerRoutePatch) AsPatch() (_patch map[string]int if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -82216,78 +90455,97 @@ func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result inter obj := new(VirtualNetworkInterface) 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, "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.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, "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, "ips", &obj.Ips, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "ips-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 } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "primary_ip-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, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-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, "target", &obj.Target, UnmarshalVirtualNetworkInterfaceTarget) if err != nil { + err = core.SDKErrorf(err, "", "target-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)) @@ -82318,22 +90576,27 @@ func UnmarshalVirtualNetworkInterfaceCollection(m map[string]json.RawMessage, re obj := new(VirtualNetworkInterfaceCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVirtualNetworkInterfaceCollectionFirst) 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, UnmarshalVirtualNetworkInterfaceCollectionNext) 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 } err = core.UnmarshalModel(m, "virtual_network_interfaces", &obj.VirtualNetworkInterfaces, UnmarshalVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interfaces-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -82346,8 +90609,11 @@ func (resp *VirtualNetworkInterfaceCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -82363,6 +90629,7 @@ func UnmarshalVirtualNetworkInterfaceCollectionFirst(m map[string]json.RawMessag 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)) @@ -82380,6 +90647,7 @@ func UnmarshalVirtualNetworkInterfaceCollectionNext(m map[string]json.RawMessage 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)) @@ -82425,22 +90693,27 @@ func UnmarshalVirtualNetworkInterfaceIPPrototype(m map[string]json.RawMessage, r obj := new(VirtualNetworkInterfaceIPPrototype) 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 } 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)) @@ -82480,18 +90753,22 @@ func UnmarshalVirtualNetworkInterfacePatch(m map[string]json.RawMessage, result obj := new(VirtualNetworkInterfacePatch) 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.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)) @@ -82505,6 +90782,9 @@ func (virtualNetworkInterfacePatch *VirtualNetworkInterfacePatch) AsPatch() (_pa if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -82547,22 +90827,27 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototype(m map[string]json.RawMes obj := new(VirtualNetworkInterfacePrimaryIPPrototype) 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 } 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)) @@ -82598,22 +90883,27 @@ func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]jso obj := new(VirtualNetworkInterfaceReferenceAttachmentContext) 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) 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)) @@ -82632,6 +90922,7 @@ func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessa obj := new(VirtualNetworkInterfaceReferenceDeleted) 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)) @@ -82683,22 +90974,27 @@ func UnmarshalVirtualNetworkInterfaceTarget(m map[string]json.RawMessage, result obj := new(VirtualNetworkInterfaceTarget) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) 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)) @@ -82867,106 +91163,132 @@ func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err erro obj := new(Volume) err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { + err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "attachment_state", &obj.AttachmentState) if err != nil { + err = core.SDKErrorf(err, "", "attachment_state-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "busy", &obj.Busy) if err != nil { + err = core.SDKErrorf(err, "", "busy-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) if err != nil { + err = core.SDKErrorf(err, "", "encryption-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, "health_reasons", &obj.HealthReasons, UnmarshalVolumeHealthReason) 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, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) if err != nil { + err = core.SDKErrorf(err, "", "operating_system-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "profile-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, "source_image", &obj.SourceImage, UnmarshalImageReference) if err != nil { + err = core.SDKErrorf(err, "", "source_image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotReference) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-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, UnmarshalVolumeStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceVolumeContext) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-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)) @@ -83032,42 +91354,52 @@ func UnmarshalVolumeAttachment(m map[string]json.RawMessage, result interface{}) obj := new(VolumeAttachment) err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-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, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_volume_on_instance_delete-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) if err != nil { + err = core.SDKErrorf(err, "", "device-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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-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.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReferenceVolumeAttachmentContext) if err != nil { + err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83085,6 +91417,7 @@ func UnmarshalVolumeAttachmentCollection(m map[string]json.RawMessage, result in obj := new(VolumeAttachmentCollection) err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachment) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83102,6 +91435,7 @@ func UnmarshalVolumeAttachmentDevice(m map[string]json.RawMessage, result interf obj := new(VolumeAttachmentDevice) 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)) @@ -83122,10 +91456,12 @@ func UnmarshalVolumeAttachmentPatch(m map[string]json.RawMessage, result interfa obj := new(VolumeAttachmentPatch) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_volume_on_instance_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)) @@ -83139,6 +91475,9 @@ func (volumeAttachmentPatch *VolumeAttachmentPatch) AsPatch() (_patch map[string if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -83161,6 +91500,9 @@ func (*VpcV1) NewVolumeAttachmentPrototype(volume VolumeAttachmentPrototypeVolum Volume: volume, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -83169,14 +91511,17 @@ func UnmarshalVolumeAttachmentPrototype(m map[string]json.RawMessage, result int obj := new(VolumeAttachmentPrototype) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_volume_on_instance_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, "volume", &obj.Volume, UnmarshalVolumeAttachmentPrototypeVolume) if err != nil { + err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83202,6 +91547,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByImageContext(volume *VolumeP Volume: volume, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -83210,14 +91558,17 @@ func UnmarshalVolumeAttachmentPrototypeInstanceByImageContext(m map[string]json. obj := new(VolumeAttachmentPrototypeInstanceByImageContext) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_volume_on_instance_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, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83243,6 +91594,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(volume Volume: volume, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -83251,14 +91605,17 @@ func UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(m map[str obj := new(VolumeAttachmentPrototypeInstanceBySourceSnapshotContext) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_volume_on_instance_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, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83284,6 +91641,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByVolumeContext(volume VolumeI Volume: volume, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -83292,14 +91652,17 @@ func UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext(m map[string]json obj := new(VolumeAttachmentPrototypeInstanceByVolumeContext) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_volume_on_instance_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, "volume", &obj.Volume, UnmarshalVolumeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83367,46 +91730,57 @@ func UnmarshalVolumeAttachmentPrototypeVolume(m map[string]json.RawMessage, resu obj := new(VolumeAttachmentPrototypeVolume) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83444,26 +91818,32 @@ func UnmarshalVolumeAttachmentReferenceInstanceContext(m map[string]json.RawMess obj := new(VolumeAttachmentReferenceInstanceContext) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceInstanceContextDeleted) if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) if err != nil { + err = core.SDKErrorf(err, "", "device-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, "volume", &obj.Volume, UnmarshalVolumeReferenceVolumeAttachmentContext) if err != nil { + err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83482,6 +91862,7 @@ func UnmarshalVolumeAttachmentReferenceInstanceContextDeleted(m map[string]json. obj := new(VolumeAttachmentReferenceInstanceContextDeleted) 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)) @@ -83530,34 +91911,42 @@ func UnmarshalVolumeAttachmentReferenceVolumeContext(m map[string]json.RawMessag obj := new(VolumeAttachmentReferenceVolumeContext) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_volume_on_instance_delete-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceVolumeContextDeleted) if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) if err != nil { + err = core.SDKErrorf(err, "", "device-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, "instance", &obj.Instance, UnmarshalInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "instance-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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83576,6 +91965,7 @@ func UnmarshalVolumeAttachmentReferenceVolumeContextDeleted(m map[string]json.Ra obj := new(VolumeAttachmentReferenceVolumeContextDeleted) 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)) @@ -83606,22 +91996,27 @@ func UnmarshalVolumeCollection(m map[string]json.RawMessage, result interface{}) obj := new(VolumeCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVolumeCollectionFirst) 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, UnmarshalVolumeCollectionNext) 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 } err = core.UnmarshalModel(m, "volumes", &obj.Volumes, UnmarshalVolume) if err != nil { + err = core.SDKErrorf(err, "", "volumes-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83634,8 +92029,11 @@ func (resp *VolumeCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -83651,6 +92049,7 @@ func UnmarshalVolumeCollectionFirst(m map[string]json.RawMessage, result interfa 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)) @@ -83668,6 +92067,7 @@ func UnmarshalVolumeCollectionNext(m map[string]json.RawMessage, result interfac 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)) @@ -83697,14 +92097,17 @@ func UnmarshalVolumeHealthReason(m map[string]json.RawMessage, result interface{ obj := new(VolumeHealthReason) 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)) @@ -83740,14 +92143,17 @@ func UnmarshalVolumeIdentity(m map[string]json.RawMessage, result interface{}) ( obj := new(VolumeIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83786,22 +92192,27 @@ func UnmarshalVolumePatch(m map[string]json.RawMessage, result interface{}) (err obj := new(VolumePatch) err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83815,6 +92226,9 @@ func (volumePatch *VolumePatch) AsPatch() (_patch map[string]interface{}, err er if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -83848,14 +92262,17 @@ func UnmarshalVolumeProfile(m map[string]json.RawMessage, result interface{}) (e obj := new(VolumeProfile) err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83886,22 +92303,27 @@ func UnmarshalVolumeProfileCollection(m map[string]json.RawMessage, result inter obj := new(VolumeProfileCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVolumeProfileCollectionFirst) 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, UnmarshalVolumeProfileCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalVolumeProfile) 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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83914,8 +92336,11 @@ func (resp *VolumeProfileCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -83931,6 +92356,7 @@ func UnmarshalVolumeProfileCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -83948,6 +92374,7 @@ func UnmarshalVolumeProfileCollectionNext(m map[string]json.RawMessage, result i 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)) @@ -83979,10 +92406,12 @@ func UnmarshalVolumeProfileIdentity(m map[string]json.RawMessage, result interfa obj := new(VolumeProfileIdentity) 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)) @@ -84003,10 +92432,12 @@ func UnmarshalVolumeProfileReference(m map[string]json.RawMessage, result interf obj := new(VolumeProfileReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -84068,38 +92499,47 @@ func UnmarshalVolumePrototype(m map[string]json.RawMessage, result interface{}) obj := new(VolumePrototype) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84145,6 +92585,9 @@ func (*VpcV1) NewVolumePrototypeInstanceByImageContext(profile VolumeProfileIden Profile: profile, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -84153,30 +92596,37 @@ func UnmarshalVolumePrototypeInstanceByImageContext(m map[string]json.RawMessage obj := new(VolumePrototypeInstanceByImageContext) err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84226,6 +92676,9 @@ func (*VpcV1) NewVolumePrototypeInstanceBySourceSnapshotContext(profile VolumePr SourceSnapshot: sourceSnapshot, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -84234,34 +92687,42 @@ func UnmarshalVolumePrototypeInstanceBySourceSnapshotContext(m map[string]json.R obj := new(VolumePrototypeInstanceBySourceSnapshotContext) err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84305,30 +92766,37 @@ func UnmarshalVolumeReference(m map[string]json.RawMessage, result interface{}) obj := new(VolumeReference) 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, UnmarshalVolumeReferenceDeleted) 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)) @@ -84347,6 +92815,7 @@ func UnmarshalVolumeReferenceDeleted(m map[string]json.RawMessage, result interf obj := new(VolumeReferenceDeleted) 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)) @@ -84386,26 +92855,32 @@ func UnmarshalVolumeReferenceVolumeAttachmentContext(m map[string]json.RawMessag obj := new(VolumeReferenceVolumeAttachmentContext) 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, UnmarshalVolumeReferenceVolumeAttachmentContextDeleted) 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)) @@ -84424,6 +92899,7 @@ func UnmarshalVolumeReferenceVolumeAttachmentContextDeleted(m map[string]json.Ra obj := new(VolumeReferenceVolumeAttachmentContextDeleted) 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)) @@ -84443,6 +92919,7 @@ func UnmarshalVolumeRemote(m map[string]json.RawMessage, result interface{}) (er obj := new(VolumeRemote) 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)) @@ -84478,14 +92955,17 @@ func UnmarshalVolumeStatusReason(m map[string]json.RawMessage, result interface{ obj := new(VolumeStatusReason) 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)) @@ -84503,6 +92983,7 @@ func UnmarshalVpcdnsResolutionBindingCollectionFirst(m map[string]json.RawMessag 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)) @@ -84520,6 +93001,7 @@ func UnmarshalVpcdnsResolutionBindingCollectionNext(m map[string]json.RawMessage 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)) @@ -84554,18 +93036,22 @@ func UnmarshalZone(m map[string]json.RawMessage, result interface{}) (err error) obj := new(Zone) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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, "region", &obj.Region, UnmarshalRegionReference) if err != nil { + err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84583,6 +93069,7 @@ func UnmarshalZoneCollection(m map[string]json.RawMessage, result interface{}) ( obj := new(ZoneCollection) err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZone) if err != nil { + err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84614,10 +93101,12 @@ func UnmarshalZoneIdentity(m map[string]json.RawMessage, result interface{}) (er obj := new(ZoneIdentity) 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)) @@ -84638,10 +93127,12 @@ func UnmarshalZoneReference(m map[string]json.RawMessage, result interface{}) (e obj := new(ZoneReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -84677,22 +93168,27 @@ func UnmarshalBackupPolicyJobSourceInstanceReference(m map[string]json.RawMessag obj := new(BackupPolicyJobSourceInstanceReference) 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, UnmarshalInstanceReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84741,30 +93237,37 @@ func UnmarshalBackupPolicyJobSourceVolumeReference(m map[string]json.RawMessage, obj := new(BackupPolicyJobSourceVolumeReference) 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, UnmarshalVolumeReferenceDeleted) 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)) @@ -84899,66 +93402,82 @@ func UnmarshalBackupPolicyMatchResourceTypeInstance(m map[string]json.RawMessage obj := new(BackupPolicyMatchResourceTypeInstance) 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_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 } err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) if err != nil { + err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -85078,62 +93597,77 @@ func UnmarshalBackupPolicyMatchResourceTypeVolume(m map[string]json.RawMessage, obj := new(BackupPolicyMatchResourceTypeVolume) 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_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, "match_resource_type", &obj.MatchResourceType) if err != nil { + err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -85189,6 +93723,9 @@ func (*VpcV1) NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstanceProto MatchResourceType: core.StringPtr(matchResourceType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -85201,30 +93738,37 @@ func UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototyp obj := new(BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype) 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, 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 } err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) if err != nil { + err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -85268,6 +93812,9 @@ func (*VpcV1) NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototy MatchResourceType: core.StringPtr(matchResourceType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -85280,26 +93827,32 @@ func UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype( obj := new(BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) 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, 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, "match_resource_type", &obj.MatchResourceType) if err != nil { + err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -85333,6 +93886,7 @@ func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentity(m map[string]json.Raw obj := new(BackupPolicyScopePrototypeEnterpriseIdentity) 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)) @@ -85364,10 +93918,12 @@ func UnmarshalBackupPolicyScopeAccountReference(m map[string]json.RawMessage, re obj := new(BackupPolicyScopeAccountReference) 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)) @@ -85402,14 +93958,17 @@ func UnmarshalBackupPolicyScopeEnterpriseReference(m map[string]json.RawMessage, obj := new(BackupPolicyScopeEnterpriseReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -85451,22 +94010,27 @@ func UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference(m map[string obj := new(BareMetalServerBootTargetBareMetalServerDiskReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) 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)) @@ -85504,18 +94068,22 @@ func UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializat obj := new(BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) if err != nil { + err = core.SDKErrorf(err, "", "encrypted_password-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) if err != nil { + err = core.SDKErrorf(err, "", "encryption_key-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, "username", &obj.Username) if err != nil { + err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -85614,54 +94182,67 @@ func UnmarshalBareMetalServerNetworkAttachmentByPci(m map[string]json.RawMessage obj := new(BareMetalServerNetworkAttachmentByPci) 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, "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, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-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 } 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, "interface_type", &obj.InterfaceType) if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -85769,58 +94350,72 @@ func UnmarshalBareMetalServerNetworkAttachmentByVlan(m map[string]json.RawMessag obj := new(BareMetalServerNetworkAttachmentByVlan) 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, "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, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-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 } err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) if err != nil { + err = core.SDKErrorf(err, "", "allow_to_float-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, "vlan", &obj.Vlan) if err != nil { + err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -85862,14 +94457,17 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVi obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) 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 } 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)) @@ -85948,38 +94546,47 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVi obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) 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 } 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.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) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -86025,6 +94632,9 @@ func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetwork InterfaceType: core.StringPtr(interfaceType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -86037,18 +94647,22 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAtt obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-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, "interface_type", &obj.InterfaceType) if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -86102,6 +94716,9 @@ func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetwork Vlan: core.Int64Ptr(vlan), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -86114,22 +94731,27 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAtt obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) if err != nil { + err = core.SDKErrorf(err, "", "allow_to_float-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, "vlan", &obj.Vlan) if err != nil { + err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -86301,66 +94923,82 @@ func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.Raw obj := new(BareMetalServerNetworkInterfaceByHiperSocket) 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, "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) if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) if err != nil { + err = core.SDKErrorf(err, "", "floating_ips-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, "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 } err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-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, "interface_type", &obj.InterfaceType) if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -86546,70 +95184,87 @@ func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, obj := new(BareMetalServerNetworkInterfaceByPci) 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, "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) if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) if err != nil { + err = core.SDKErrorf(err, "", "floating_ips-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, "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 } err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-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, "allowed_vlans", &obj.AllowedVlans) if err != nil { + err = core.SDKErrorf(err, "", "allowed_vlans-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -86812,74 +95467,92 @@ func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage obj := new(BareMetalServerNetworkInterfaceByVlan) 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, "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) if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) if err != nil { + err = core.SDKErrorf(err, "", "floating_ips-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, "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 } err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-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, "allow_interface_to_float", &obj.AllowInterfaceToFloat) if err != nil { + err = core.SDKErrorf(err, "", "allow_interface_to_float-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, "vlan", &obj.Vlan) if err != nil { + err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -86953,6 +95626,9 @@ func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkI InterfaceType: core.StringPtr(interfaceType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -86965,30 +95641,37 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) 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, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-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 } err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -87071,6 +95754,9 @@ func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkI InterfaceType: core.StringPtr(interfaceType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -87083,34 +95769,42 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) 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, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-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 } 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, "interface_type", &obj.InterfaceType) if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -87216,6 +95910,9 @@ func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkI Vlan: core.Int64Ptr(vlan), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -87228,38 +95925,47 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) 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, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-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 } err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) if err != nil { + err = core.SDKErrorf(err, "", "allow_interface_to_float-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, "vlan", &obj.Vlan) if err != nil { + err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -87304,6 +96010,9 @@ func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServer VirtualNetworkInterface: virtualNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -87316,18 +96025,22 @@ func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPri obj := new(BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-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, "interface_type", &obj.InterfaceType) if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -87357,6 +96070,7 @@ func UnmarshalBareMetalServerProfileBandwidthDependent(m map[string]json.RawMess obj := new(BareMetalServerProfileBandwidthDependent) 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)) @@ -87392,14 +96106,17 @@ func UnmarshalBareMetalServerProfileBandwidthEnum(m map[string]json.RawMessage, obj := new(BareMetalServerProfileBandwidthEnum) 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)) @@ -87432,10 +96149,12 @@ func UnmarshalBareMetalServerProfileBandwidthFixed(m map[string]json.RawMessage, obj := new(BareMetalServerProfileBandwidthFixed) 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)) @@ -87477,22 +96196,27 @@ func UnmarshalBareMetalServerProfileBandwidthRange(m map[string]json.RawMessage, obj := new(BareMetalServerProfileBandwidthRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -87521,6 +96245,7 @@ func UnmarshalBareMetalServerProfileCpuCoreCountDependent(m map[string]json.RawM obj := new(BareMetalServerProfileCpuCoreCountDependent) 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)) @@ -87555,14 +96280,17 @@ func UnmarshalBareMetalServerProfileCpuCoreCountEnum(m map[string]json.RawMessag obj := new(BareMetalServerProfileCpuCoreCountEnum) 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)) @@ -87594,10 +96322,12 @@ func UnmarshalBareMetalServerProfileCpuCoreCountFixed(m map[string]json.RawMessa obj := new(BareMetalServerProfileCpuCoreCountFixed) 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)) @@ -87638,22 +96368,27 @@ func UnmarshalBareMetalServerProfileCpuCoreCountRange(m map[string]json.RawMessa obj := new(BareMetalServerProfileCpuCoreCountRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -87682,6 +96417,7 @@ func UnmarshalBareMetalServerProfileCpuSocketCountDependent(m map[string]json.Ra obj := new(BareMetalServerProfileCpuSocketCountDependent) 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)) @@ -87716,14 +96452,17 @@ func UnmarshalBareMetalServerProfileCpuSocketCountEnum(m map[string]json.RawMess obj := new(BareMetalServerProfileCpuSocketCountEnum) 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)) @@ -87755,10 +96494,12 @@ func UnmarshalBareMetalServerProfileCpuSocketCountFixed(m map[string]json.RawMes obj := new(BareMetalServerProfileCpuSocketCountFixed) 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)) @@ -87799,22 +96540,27 @@ func UnmarshalBareMetalServerProfileCpuSocketCountRange(m map[string]json.RawMes obj := new(BareMetalServerProfileCpuSocketCountRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -87844,6 +96590,7 @@ func UnmarshalBareMetalServerProfileDiskQuantityDependent(m map[string]json.RawM obj := new(BareMetalServerProfileDiskQuantityDependent) 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)) @@ -87878,14 +96625,17 @@ func UnmarshalBareMetalServerProfileDiskQuantityEnum(m map[string]json.RawMessag obj := new(BareMetalServerProfileDiskQuantityEnum) 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)) @@ -87917,10 +96667,12 @@ func UnmarshalBareMetalServerProfileDiskQuantityFixed(m map[string]json.RawMessa obj := new(BareMetalServerProfileDiskQuantityFixed) 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)) @@ -87961,22 +96713,27 @@ func UnmarshalBareMetalServerProfileDiskQuantityRange(m map[string]json.RawMessa obj := new(BareMetalServerProfileDiskQuantityRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88006,6 +96763,7 @@ func UnmarshalBareMetalServerProfileDiskSizeDependent(m map[string]json.RawMessa obj := new(BareMetalServerProfileDiskSizeDependent) 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)) @@ -88040,14 +96798,17 @@ func UnmarshalBareMetalServerProfileDiskSizeEnum(m map[string]json.RawMessage, r obj := new(BareMetalServerProfileDiskSizeEnum) 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)) @@ -88079,10 +96840,12 @@ func UnmarshalBareMetalServerProfileDiskSizeFixed(m map[string]json.RawMessage, obj := new(BareMetalServerProfileDiskSizeFixed) 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)) @@ -88124,22 +96887,27 @@ func UnmarshalBareMetalServerProfileDiskSizeRange(m map[string]json.RawMessage, obj := new(BareMetalServerProfileDiskSizeRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88159,6 +96927,9 @@ func (*VpcV1) NewBareMetalServerProfileIdentityByHref(href string) (_model *Bare Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88171,6 +96942,7 @@ func UnmarshalBareMetalServerProfileIdentityByHref(m map[string]json.RawMessage, obj := new(BareMetalServerProfileIdentityByHref) 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)) @@ -88190,6 +96962,9 @@ func (*VpcV1) NewBareMetalServerProfileIdentityByName(name string) (_model *Bare Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88202,6 +96977,7 @@ func UnmarshalBareMetalServerProfileIdentityByName(m map[string]json.RawMessage, obj := new(BareMetalServerProfileIdentityByName) 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)) @@ -88230,6 +97006,7 @@ func UnmarshalBareMetalServerProfileMemoryDependent(m map[string]json.RawMessage obj := new(BareMetalServerProfileMemoryDependent) 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)) @@ -88264,14 +97041,17 @@ func UnmarshalBareMetalServerProfileMemoryEnum(m map[string]json.RawMessage, res obj := new(BareMetalServerProfileMemoryEnum) 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)) @@ -88303,10 +97083,12 @@ func UnmarshalBareMetalServerProfileMemoryFixed(m map[string]json.RawMessage, re obj := new(BareMetalServerProfileMemoryFixed) 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)) @@ -88347,22 +97129,27 @@ func UnmarshalBareMetalServerProfileMemoryRange(m map[string]json.RawMessage, re obj := new(BareMetalServerProfileMemoryRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88392,6 +97179,7 @@ func UnmarshalBareMetalServerProfileNetworkAttachmentCountDependent(m map[string obj := new(BareMetalServerProfileNetworkAttachmentCountDependent) 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)) @@ -88426,14 +97214,17 @@ func UnmarshalBareMetalServerProfileNetworkAttachmentCountRange(m map[string]jso obj := new(BareMetalServerProfileNetworkAttachmentCountRange) 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88463,6 +97254,7 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCountDependent(m map[string] obj := new(BareMetalServerProfileNetworkInterfaceCountDependent) 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)) @@ -88497,14 +97289,17 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCountRange(m map[string]json obj := new(BareMetalServerProfileNetworkInterfaceCountRange) 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88559,6 +97354,9 @@ func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment(init PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88571,42 +97369,52 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[s obj := new(BareMetalServerPrototypeBareMetalServerByNetworkAttachment) err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) if err != nil { + err = core.SDKErrorf(err, "", "initialization-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, "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) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) if err != nil { + err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88661,6 +97469,9 @@ func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkInterface(initi PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88673,42 +97484,52 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface(m map[st obj := new(BareMetalServerPrototypeBareMetalServerByNetworkInterface) err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) if err != nil { + err = core.SDKErrorf(err, "", "initialization-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, "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) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) if err != nil { + err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88729,6 +97550,9 @@ func (*VpcV1) NewCatalogOfferingIdentityCatalogOfferingByCRN(crn string) (_model CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88741,6 +97565,7 @@ func UnmarshalCatalogOfferingIdentityCatalogOfferingByCRN(m map[string]json.RawM obj := new(CatalogOfferingIdentityCatalogOfferingByCRN) 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)) @@ -88761,6 +97586,9 @@ func (*VpcV1) NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(crn s CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88773,6 +97601,7 @@ func UnmarshalCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(m map[st obj := new(CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN) 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)) @@ -88792,6 +97621,9 @@ func (*VpcV1) NewCertificateInstanceIdentityByCRN(crn string) (_model *Certifica CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88804,6 +97636,7 @@ func UnmarshalCertificateInstanceIdentityByCRN(m map[string]json.RawMessage, res obj := new(CertificateInstanceIdentityByCRN) 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)) @@ -88823,6 +97656,9 @@ func (*VpcV1) NewCloudObjectStorageBucketIdentityByCRN(crn string) (_model *Clou CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88835,6 +97671,7 @@ func UnmarshalCloudObjectStorageBucketIdentityByCRN(m map[string]json.RawMessage obj := new(CloudObjectStorageBucketIdentityByCRN) 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)) @@ -88854,6 +97691,9 @@ func (*VpcV1) NewCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentit Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88866,6 +97706,7 @@ func UnmarshalCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityBy obj := new(CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) 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)) @@ -88885,6 +97726,9 @@ func (*VpcV1) NewDnsInstanceIdentityByCRN(crn string) (_model *DnsInstanceIdenti CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88897,6 +97741,7 @@ func UnmarshalDnsInstanceIdentityByCRN(m map[string]json.RawMessage, result inte obj := new(DnsInstanceIdentityByCRN) 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)) @@ -88915,6 +97760,9 @@ func (*VpcV1) NewDnsZoneIdentityByID(id string) (_model *DnsZoneIdentityByID, er ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88927,6 +97775,7 @@ func UnmarshalDnsZoneIdentityByID(m map[string]json.RawMessage, result interface obj := new(DnsZoneIdentityByID) 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)) @@ -88946,6 +97795,9 @@ func (*VpcV1) NewDedicatedHostGroupIdentityByCRN(crn string) (_model *DedicatedH CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88958,6 +97810,7 @@ func UnmarshalDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, resu obj := new(DedicatedHostGroupIdentityByCRN) 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)) @@ -88977,6 +97830,9 @@ func (*VpcV1) NewDedicatedHostGroupIdentityByHref(href string) (_model *Dedicate Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88989,6 +97845,7 @@ func UnmarshalDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, res obj := new(DedicatedHostGroupIdentityByHref) 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)) @@ -89008,6 +97865,9 @@ func (*VpcV1) NewDedicatedHostGroupIdentityByID(id string) (_model *DedicatedHos ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89020,6 +97880,7 @@ func UnmarshalDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, resul obj := new(DedicatedHostGroupIdentityByID) 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)) @@ -89039,6 +97900,9 @@ func (*VpcV1) NewDedicatedHostProfileIdentityByHref(href string) (_model *Dedica Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89051,6 +97915,7 @@ func UnmarshalDedicatedHostProfileIdentityByHref(m map[string]json.RawMessage, r obj := new(DedicatedHostProfileIdentityByHref) 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)) @@ -89070,6 +97935,9 @@ func (*VpcV1) NewDedicatedHostProfileIdentityByName(name string) (_model *Dedica Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89082,6 +97950,7 @@ func UnmarshalDedicatedHostProfileIdentityByName(m map[string]json.RawMessage, r obj := new(DedicatedHostProfileIdentityByName) 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)) @@ -89110,6 +97979,7 @@ func UnmarshalDedicatedHostProfileMemoryDependent(m map[string]json.RawMessage, obj := new(DedicatedHostProfileMemoryDependent) 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)) @@ -89144,14 +98014,17 @@ func UnmarshalDedicatedHostProfileMemoryEnum(m map[string]json.RawMessage, resul obj := new(DedicatedHostProfileMemoryEnum) 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)) @@ -89183,10 +98056,12 @@ func UnmarshalDedicatedHostProfileMemoryFixed(m map[string]json.RawMessage, resu obj := new(DedicatedHostProfileMemoryFixed) 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)) @@ -89227,22 +98102,27 @@ func UnmarshalDedicatedHostProfileMemoryRange(m map[string]json.RawMessage, resu obj := new(DedicatedHostProfileMemoryRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -89271,6 +98151,7 @@ func UnmarshalDedicatedHostProfileSocketDependent(m map[string]json.RawMessage, obj := new(DedicatedHostProfileSocketDependent) 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)) @@ -89305,14 +98186,17 @@ func UnmarshalDedicatedHostProfileSocketEnum(m map[string]json.RawMessage, resul obj := new(DedicatedHostProfileSocketEnum) 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)) @@ -89344,10 +98228,12 @@ func UnmarshalDedicatedHostProfileSocketFixed(m map[string]json.RawMessage, resu obj := new(DedicatedHostProfileSocketFixed) 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)) @@ -89388,22 +98274,27 @@ func UnmarshalDedicatedHostProfileSocketRange(m map[string]json.RawMessage, resu obj := new(DedicatedHostProfileSocketRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -89432,6 +98323,7 @@ func UnmarshalDedicatedHostProfileVcpuDependent(m map[string]json.RawMessage, re obj := new(DedicatedHostProfileVcpuDependent) 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)) @@ -89466,14 +98358,17 @@ func UnmarshalDedicatedHostProfileVcpuEnum(m map[string]json.RawMessage, result obj := new(DedicatedHostProfileVcpuEnum) 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)) @@ -89505,10 +98400,12 @@ func UnmarshalDedicatedHostProfileVcpuFixed(m map[string]json.RawMessage, result obj := new(DedicatedHostProfileVcpuFixed) 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)) @@ -89549,22 +98446,27 @@ func UnmarshalDedicatedHostProfileVcpuRange(m map[string]json.RawMessage, result obj := new(DedicatedHostProfileVcpuRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -89597,6 +98499,9 @@ func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByGroup(profile DedicatedHos Group: group, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89609,22 +98514,27 @@ func UnmarshalDedicatedHostPrototypeDedicatedHostByGroup(m map[string]json.RawMe obj := new(DedicatedHostPrototypeDedicatedHostByGroup) err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "instance_placement_enabled-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, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -89659,6 +98569,9 @@ func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByZone(profile DedicatedHost Zone: zone, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89671,26 +98584,32 @@ func UnmarshalDedicatedHostPrototypeDedicatedHostByZone(m map[string]json.RawMes obj := new(DedicatedHostPrototypeDedicatedHostByZone) err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "instance_placement_enabled-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, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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, "group", &obj.Group, UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -89712,6 +98631,9 @@ func (*VpcV1) NewEncryptionKeyIdentityByCRN(crn string) (_model *EncryptionKeyId CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89724,6 +98646,7 @@ func UnmarshalEncryptionKeyIdentityByCRN(m map[string]json.RawMessage, result in obj := new(EncryptionKeyIdentityByCRN) 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)) @@ -89761,10 +98684,12 @@ func UnmarshalEndpointGatewayReservedIPReservedIPIdentity(m map[string]json.RawM obj := new(EndpointGatewayReservedIPReservedIPIdentity) 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)) @@ -89798,6 +98723,9 @@ func (*VpcV1) NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext(subne Subnet: subnet, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89810,18 +98738,22 @@ func UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext(m map[st obj := new(EndpointGatewayReservedIPReservedIPPrototypeTargetContext) 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 } 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)) @@ -89865,10 +98797,12 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity(m map[s obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) 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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -89913,10 +98847,12 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentit obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) 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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -89948,10 +98884,12 @@ func UnmarshalEndpointGatewayTargetProviderCloudServiceReference(m map[string]js obj := new(EndpointGatewayTargetProviderCloudServiceReference) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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)) @@ -89984,10 +98922,12 @@ func UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference(m map[ obj := new(EndpointGatewayTargetProviderInfrastructureServiceReference) 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)) @@ -90020,6 +98960,9 @@ func (*VpcV1) NewFloatingIPPrototypeFloatingIPByTarget(target FloatingIPTargetPr Target: target, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -90032,14 +98975,17 @@ func UnmarshalFloatingIPPrototypeFloatingIPByTarget(m map[string]json.RawMessage obj := new(FloatingIPPrototypeFloatingIPByTarget) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90065,6 +99011,9 @@ func (*VpcV1) NewFloatingIPPrototypeFloatingIPByZone(zone ZoneIdentityIntf) (_mo Zone: zone, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -90077,14 +99026,17 @@ func UnmarshalFloatingIPPrototypeFloatingIPByZone(m map[string]json.RawMessage, obj := new(FloatingIPPrototypeFloatingIPByZone) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90131,10 +99083,12 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity(m map obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) 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)) @@ -90181,10 +99135,12 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity(m map[string]json.Ra obj := new(FloatingIPTargetPatchNetworkInterfaceIdentity) 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)) @@ -90226,14 +99182,17 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity(m map[string] obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) 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 } 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)) @@ -90280,10 +99239,12 @@ func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity(m obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) 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)) @@ -90330,10 +99291,12 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity(m map[string]jso obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentity) 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)) @@ -90375,14 +99338,17 @@ func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[str obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) 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 } 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)) @@ -90435,26 +99401,32 @@ func UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference(m map[str obj := new(FloatingIPTargetBareMetalServerNetworkInterfaceReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90507,26 +99479,32 @@ func UnmarshalFloatingIPTargetNetworkInterfaceReference(m map[string]json.RawMes obj := new(FloatingIPTargetNetworkInterfaceReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90571,26 +99549,32 @@ func UnmarshalFloatingIPTargetPublicGatewayReference(m map[string]json.RawMessag obj := new(FloatingIPTargetPublicGatewayReference) 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, UnmarshalPublicGatewayReferenceDeleted) 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)) @@ -90641,34 +99625,42 @@ func UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference(m map[string]json obj := new(FloatingIPTargetVirtualNetworkInterfaceReference) 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, UnmarshalVirtualNetworkInterfaceReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90710,14 +99702,17 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity(m map[string]json. obj := new(FlowLogCollectorTargetPrototypeInstanceIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90755,10 +99750,12 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity(m obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) 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)) @@ -90805,10 +99802,12 @@ func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity(m map[stri obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) 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)) @@ -90850,14 +99849,17 @@ func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentity(m map[string]json.Ra obj := new(FlowLogCollectorTargetPrototypeSubnetIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90899,14 +99901,17 @@ func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity(m map[string]json.RawMe obj := new(FlowLogCollectorTargetPrototypeVPCIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90948,14 +99953,17 @@ func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity(m m obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) 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 } 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)) @@ -91004,30 +100012,37 @@ func UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference(m map[str obj := new(FlowLogCollectorTargetInstanceNetworkAttachmentReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91063,22 +100078,27 @@ func UnmarshalFlowLogCollectorTargetInstanceReference(m map[string]json.RawMessa obj := new(FlowLogCollectorTargetInstanceReference) 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, UnmarshalInstanceReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91129,22 +100149,27 @@ func UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext(m map obj := new(FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) 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)) @@ -91189,26 +100214,32 @@ func UnmarshalFlowLogCollectorTargetSubnetReference(m map[string]json.RawMessage obj := new(FlowLogCollectorTargetSubnetReference) 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, UnmarshalSubnetReferenceDeleted) 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)) @@ -91253,26 +100284,32 @@ func UnmarshalFlowLogCollectorTargetVPCReference(m map[string]json.RawMessage, r obj := new(FlowLogCollectorTargetVPCReference) 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, UnmarshalVPCReferenceDeleted) 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)) @@ -91313,22 +100350,27 @@ func UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentCo obj := new(FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext) 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) 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)) @@ -91348,6 +100390,9 @@ func (*VpcV1) NewImageIdentityByCRN(crn string) (_model *ImageIdentityByCRN, err CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -91360,6 +100405,7 @@ func UnmarshalImageIdentityByCRN(m map[string]json.RawMessage, result interface{ obj := new(ImageIdentityByCRN) 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)) @@ -91379,6 +100425,9 @@ func (*VpcV1) NewImageIdentityByHref(href string) (_model *ImageIdentityByHref, Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -91391,6 +100440,7 @@ func UnmarshalImageIdentityByHref(m map[string]json.RawMessage, result interface obj := new(ImageIdentityByHref) 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)) @@ -91410,6 +100460,9 @@ func (*VpcV1) NewImageIdentityByID(id string) (_model *ImageIdentityByID, err er ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -91422,6 +100475,7 @@ func UnmarshalImageIdentityByID(m map[string]json.RawMessage, result interface{} obj := new(ImageIdentityByID) 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)) @@ -91494,6 +100548,9 @@ func (*VpcV1) NewImagePrototypeImageByFile(file *ImageFilePrototype, operatingSy OperatingSystem: operatingSystem, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -91506,34 +100563,42 @@ func UnmarshalImagePrototypeImageByFile(m map[string]json.RawMessage, result int obj := new(ImagePrototypeImageByFile) err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) if err != nil { + err = core.SDKErrorf(err, "", "deprecation_at-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, "obsolescence_at", &obj.ObsolescenceAt) if err != nil { + err = core.SDKErrorf(err, "", "obsolescence_at-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.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) if err != nil { + err = core.SDKErrorf(err, "", "encrypted_data_key-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, "file", &obj.File, UnmarshalImageFilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "file-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) if err != nil { + err = core.SDKErrorf(err, "", "operating_system-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91593,6 +100658,9 @@ func (*VpcV1) NewImagePrototypeImageBySourceVolume(sourceVolume VolumeIdentityIn SourceVolume: sourceVolume, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -91605,26 +100673,32 @@ func UnmarshalImagePrototypeImageBySourceVolume(m map[string]json.RawMessage, re obj := new(ImagePrototypeImageBySourceVolume) err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) if err != nil { + err = core.SDKErrorf(err, "", "deprecation_at-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, "obsolescence_at", &obj.ObsolescenceAt) if err != nil { + err = core.SDKErrorf(err, "", "obsolescence_at-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, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91645,6 +100719,9 @@ func (*VpcV1) NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(offer Offering: offering, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -91657,6 +100734,7 @@ func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(m map[st obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByOffering) err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) if err != nil { + err = core.SDKErrorf(err, "", "offering-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91678,6 +100756,9 @@ func (*VpcV1) NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(versio Version: version, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -91690,6 +100771,7 @@ func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(m map[str obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByVersion) err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91736,22 +100818,27 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototype(m map[ obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) if err != nil { + err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manager-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91865,62 +100952,77 @@ func UnmarshalInstanceGroupManagerActionScheduledAction(m map[string]json.RawMes obj := new(InstanceGroupManagerActionScheduledAction) 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_timeout", &obj.AutoDeleteTimeout) if err != nil { + err = core.SDKErrorf(err, "", "auto_delete_timeout-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, "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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) if err != nil { + err = core.SDKErrorf(err, "", "action_type-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.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) if err != nil { + err = core.SDKErrorf(err, "", "last_applied_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) if err != nil { + err = core.SDKErrorf(err, "", "next_run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) if err != nil { + err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91982,50 +101084,62 @@ func UnmarshalInstanceGroupManagerAutoScale(m map[string]json.RawMessage, result obj := new(InstanceGroupManagerAutoScale) 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, "management_enabled", &obj.ManagementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "management_enabled-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, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) if err != nil { + err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) if err != nil { + err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) if err != nil { + err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) if err != nil { + err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92072,6 +101186,9 @@ func (*VpcV1) NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPo PolicyType: core.StringPtr(policyType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -92084,18 +101201,22 @@ func UnmarshalInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolic obj := new(InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) if err != nil { + err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) if err != nil { + err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) if err != nil { + err = core.SDKErrorf(err, "", "policy_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92155,34 +101276,42 @@ func UnmarshalInstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy(m map[s obj := new(InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy) 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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) if err != nil { + err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) if err != nil { + err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) if err != nil { + err = core.SDKErrorf(err, "", "policy_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92228,6 +101357,9 @@ func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScaleProto MaxMembershipCount: core.Int64Ptr(maxMembershipCount), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -92240,30 +101372,37 @@ func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototyp obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "management_enabled-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, "aggregation_window", &obj.AggregationWindow) if err != nil { + err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) if err != nil { + err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) if err != nil { + err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92296,6 +101435,9 @@ func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledProto ManagerType: core.StringPtr(managerType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -92308,14 +101450,17 @@ func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototyp obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype) err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "management_enabled-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, "manager_type", &obj.ManagerType) if err != nil { + err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92365,34 +101510,42 @@ func UnmarshalInstanceGroupManagerScheduled(m map[string]json.RawMessage, result obj := new(InstanceGroupManagerScheduled) 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, "management_enabled", &obj.ManagementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "management_enabled-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, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference) if err != nil { + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) if err != nil { + err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92431,26 +101584,32 @@ func UnmarshalInstanceGroupManagerScheduledActionManagerAutoScale(m map[string]j obj := new(InstanceGroupManagerScheduledActionManagerAutoScale) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) 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, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92496,18 +101655,22 @@ func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScaleProtot obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92549,14 +101712,17 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNe obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) 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 } 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)) @@ -92635,38 +101801,47 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNe obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) 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 } 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.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) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92686,6 +101861,9 @@ func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByHref(href string) Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -92698,6 +101876,7 @@ func UnmarshalInstancePatchProfileInstanceProfileIdentityByHref(m map[string]jso obj := new(InstancePatchProfileInstanceProfileIdentityByHref) 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)) @@ -92717,6 +101896,9 @@ func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByName(name string) Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -92729,6 +101911,7 @@ func UnmarshalInstancePatchProfileInstanceProfileIdentityByName(m map[string]jso obj := new(InstancePatchProfileInstanceProfileIdentityByName) 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)) @@ -92770,14 +101953,17 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentity(m map[strin obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92819,14 +102005,17 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentity(m map[string]jso obj := new(InstancePlacementTargetPatchDedicatedHostIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92868,14 +102057,17 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentity(m map[s obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92917,14 +102109,17 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentity(m map[string obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92966,14 +102161,17 @@ func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentity(m map[strin obj := new(InstancePlacementTargetPrototypePlacementGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -93018,26 +102216,32 @@ func UnmarshalInstancePlacementTargetDedicatedHostGroupReference(m map[string]js obj := new(InstancePlacementTargetDedicatedHostGroupReference) 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, UnmarshalDedicatedHostGroupReferenceDeleted) 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)) @@ -93082,26 +102286,32 @@ func UnmarshalInstancePlacementTargetDedicatedHostReference(m map[string]json.Ra obj := new(InstancePlacementTargetDedicatedHostReference) 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, UnmarshalDedicatedHostReferenceDeleted) 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)) @@ -93146,26 +102356,32 @@ func UnmarshalInstancePlacementTargetPlacementGroupReference(m map[string]json.R obj := new(InstancePlacementTargetPlacementGroupReference) 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, UnmarshalPlacementGroupReferenceDeleted) 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)) @@ -93195,6 +102411,7 @@ func UnmarshalInstanceProfileBandwidthDependent(m map[string]json.RawMessage, re obj := new(InstanceProfileBandwidthDependent) 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)) @@ -93230,14 +102447,17 @@ func UnmarshalInstanceProfileBandwidthEnum(m map[string]json.RawMessage, result obj := new(InstanceProfileBandwidthEnum) 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)) @@ -93270,10 +102490,12 @@ func UnmarshalInstanceProfileBandwidthFixed(m map[string]json.RawMessage, result obj := new(InstanceProfileBandwidthFixed) 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)) @@ -93315,22 +102537,27 @@ func UnmarshalInstanceProfileBandwidthRange(m map[string]json.RawMessage, result obj := new(InstanceProfileBandwidthRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -93359,6 +102586,7 @@ func UnmarshalInstanceProfileDiskQuantityDependent(m map[string]json.RawMessage, obj := new(InstanceProfileDiskQuantityDependent) 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)) @@ -93393,14 +102621,17 @@ func UnmarshalInstanceProfileDiskQuantityEnum(m map[string]json.RawMessage, resu obj := new(InstanceProfileDiskQuantityEnum) 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)) @@ -93432,10 +102663,12 @@ func UnmarshalInstanceProfileDiskQuantityFixed(m map[string]json.RawMessage, res obj := new(InstanceProfileDiskQuantityFixed) 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)) @@ -93476,22 +102709,27 @@ func UnmarshalInstanceProfileDiskQuantityRange(m map[string]json.RawMessage, res obj := new(InstanceProfileDiskQuantityRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -93521,6 +102759,7 @@ func UnmarshalInstanceProfileDiskSizeDependent(m map[string]json.RawMessage, res obj := new(InstanceProfileDiskSizeDependent) 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)) @@ -93555,14 +102794,17 @@ func UnmarshalInstanceProfileDiskSizeEnum(m map[string]json.RawMessage, result i obj := new(InstanceProfileDiskSizeEnum) 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)) @@ -93594,10 +102836,12 @@ func UnmarshalInstanceProfileDiskSizeFixed(m map[string]json.RawMessage, result obj := new(InstanceProfileDiskSizeFixed) 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)) @@ -93638,22 +102882,27 @@ func UnmarshalInstanceProfileDiskSizeRange(m map[string]json.RawMessage, result obj := new(InstanceProfileDiskSizeRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -93682,6 +102931,7 @@ func UnmarshalInstanceProfileGpuDependent(m map[string]json.RawMessage, result i obj := new(InstanceProfileGpuDependent) 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)) @@ -93716,14 +102966,17 @@ func UnmarshalInstanceProfileGpuEnum(m map[string]json.RawMessage, result interf obj := new(InstanceProfileGpuEnum) 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)) @@ -93755,10 +103008,12 @@ func UnmarshalInstanceProfileGpuFixed(m map[string]json.RawMessage, result inter obj := new(InstanceProfileGpuFixed) 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)) @@ -93787,6 +103042,7 @@ func UnmarshalInstanceProfileGpuMemoryDependent(m map[string]json.RawMessage, re obj := new(InstanceProfileGpuMemoryDependent) 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)) @@ -93821,14 +103077,17 @@ func UnmarshalInstanceProfileGpuMemoryEnum(m map[string]json.RawMessage, result obj := new(InstanceProfileGpuMemoryEnum) 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)) @@ -93860,10 +103119,12 @@ func UnmarshalInstanceProfileGpuMemoryFixed(m map[string]json.RawMessage, result obj := new(InstanceProfileGpuMemoryFixed) 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)) @@ -93904,22 +103165,27 @@ func UnmarshalInstanceProfileGpuMemoryRange(m map[string]json.RawMessage, result obj := new(InstanceProfileGpuMemoryRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -93960,22 +103226,27 @@ func UnmarshalInstanceProfileGpuRange(m map[string]json.RawMessage, result inter obj := new(InstanceProfileGpuRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -93995,6 +103266,9 @@ func (*VpcV1) NewInstanceProfileIdentityByHref(href string) (_model *InstancePro Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -94007,6 +103281,7 @@ func UnmarshalInstanceProfileIdentityByHref(m map[string]json.RawMessage, result obj := new(InstanceProfileIdentityByHref) 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)) @@ -94026,6 +103301,9 @@ func (*VpcV1) NewInstanceProfileIdentityByName(name string) (_model *InstancePro Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -94038,6 +103316,7 @@ func UnmarshalInstanceProfileIdentityByName(m map[string]json.RawMessage, result obj := new(InstanceProfileIdentityByName) 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)) @@ -94066,6 +103345,7 @@ func UnmarshalInstanceProfileMemoryDependent(m map[string]json.RawMessage, resul obj := new(InstanceProfileMemoryDependent) 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)) @@ -94100,14 +103380,17 @@ func UnmarshalInstanceProfileMemoryEnum(m map[string]json.RawMessage, result int obj := new(InstanceProfileMemoryEnum) 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)) @@ -94139,10 +103422,12 @@ func UnmarshalInstanceProfileMemoryFixed(m map[string]json.RawMessage, result in obj := new(InstanceProfileMemoryFixed) 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)) @@ -94183,22 +103468,27 @@ func UnmarshalInstanceProfileMemoryRange(m map[string]json.RawMessage, result in obj := new(InstanceProfileMemoryRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -94228,6 +103518,7 @@ func UnmarshalInstanceProfileNumaCountDependent(m map[string]json.RawMessage, re obj := new(InstanceProfileNumaCountDependent) 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)) @@ -94259,10 +103550,12 @@ func UnmarshalInstanceProfileNumaCountFixed(m map[string]json.RawMessage, result obj := new(InstanceProfileNumaCountFixed) 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)) @@ -94291,6 +103584,7 @@ func UnmarshalInstanceProfileNetworkAttachmentCountDependent(m map[string]json.R obj := new(InstanceProfileNetworkAttachmentCountDependent) 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)) @@ -94325,14 +103619,17 @@ func UnmarshalInstanceProfileNetworkAttachmentCountRange(m map[string]json.RawMe obj := new(InstanceProfileNetworkAttachmentCountRange) 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -94361,6 +103658,7 @@ func UnmarshalInstanceProfileNetworkInterfaceCountDependent(m map[string]json.Ra obj := new(InstanceProfileNetworkInterfaceCountDependent) 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)) @@ -94395,14 +103693,17 @@ func UnmarshalInstanceProfileNetworkInterfaceCountRange(m map[string]json.RawMes obj := new(InstanceProfileNetworkInterfaceCountRange) 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -94431,6 +103732,7 @@ func UnmarshalInstanceProfilePortSpeedDependent(m map[string]json.RawMessage, re obj := new(InstanceProfilePortSpeedDependent) 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)) @@ -94462,10 +103764,12 @@ func UnmarshalInstanceProfilePortSpeedFixed(m map[string]json.RawMessage, result obj := new(InstanceProfilePortSpeedFixed) 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)) @@ -94494,6 +103798,7 @@ func UnmarshalInstanceProfileVcpuDependent(m map[string]json.RawMessage, result obj := new(InstanceProfileVcpuDependent) 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)) @@ -94528,14 +103833,17 @@ func UnmarshalInstanceProfileVcpuEnum(m map[string]json.RawMessage, result inter obj := new(InstanceProfileVcpuEnum) 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)) @@ -94567,10 +103875,12 @@ func UnmarshalInstanceProfileVcpuFixed(m map[string]json.RawMessage, result inte obj := new(InstanceProfileVcpuFixed) 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)) @@ -94611,22 +103921,27 @@ func UnmarshalInstanceProfileVcpuRange(m map[string]json.RawMessage, result inte obj := new(InstanceProfileVcpuRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -94656,6 +103971,7 @@ func UnmarshalInstanceProfileVolumeBandwidthDependent(m map[string]json.RawMessa obj := new(InstanceProfileVolumeBandwidthDependent) 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)) @@ -94691,14 +104007,17 @@ func UnmarshalInstanceProfileVolumeBandwidthEnum(m map[string]json.RawMessage, r obj := new(InstanceProfileVolumeBandwidthEnum) 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)) @@ -94730,10 +104049,12 @@ func UnmarshalInstanceProfileVolumeBandwidthFixed(m map[string]json.RawMessage, obj := new(InstanceProfileVolumeBandwidthFixed) 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)) @@ -94775,22 +104096,27 @@ func UnmarshalInstanceProfileVolumeBandwidthRange(m map[string]json.RawMessage, obj := new(InstanceProfileVolumeBandwidthRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -94913,82 +104239,102 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe obj := new(InstancePrototypeInstanceByCatalogOffering) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -95105,82 +104451,102 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res obj := new(InstancePrototypeInstanceByImage) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -95294,78 +104660,97 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes obj := new(InstancePrototypeInstanceBySourceSnapshot) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -95487,6 +104872,9 @@ func (*VpcV1) NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate Instan SourceTemplate: sourceTemplate, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -95499,90 +104887,112 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes obj := new(InstancePrototypeInstanceBySourceTemplate) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_template-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -95696,78 +105106,97 @@ func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, re obj := new(InstancePrototypeInstanceByVolume) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -95787,6 +105216,9 @@ func (*VpcV1) NewInstanceTemplateIdentityByCRN(crn string) (_model *InstanceTemp CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -95799,6 +105231,7 @@ func UnmarshalInstanceTemplateIdentityByCRN(m map[string]json.RawMessage, result obj := new(InstanceTemplateIdentityByCRN) 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)) @@ -95818,6 +105251,9 @@ func (*VpcV1) NewInstanceTemplateIdentityByHref(href string) (_model *InstanceTe Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -95830,6 +105266,7 @@ func UnmarshalInstanceTemplateIdentityByHref(m map[string]json.RawMessage, resul obj := new(InstanceTemplateIdentityByHref) 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)) @@ -95849,6 +105286,9 @@ func (*VpcV1) NewInstanceTemplateIdentityByID(id string) (_model *InstanceTempla ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -95861,6 +105301,7 @@ func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result obj := new(InstanceTemplateIdentityByID) 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)) @@ -95981,82 +105422,102 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -96171,82 +105632,102 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json obj := new(InstanceTemplatePrototypeInstanceTemplateByImage) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -96358,78 +105839,97 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -96549,6 +106049,9 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourc SourceTemplate: sourceTemplate, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -96561,90 +106064,112 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_template-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -96777,98 +106302,122 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -96995,98 +106544,122 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[strin obj := new(InstanceTemplateInstanceByImageInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -97210,94 +106783,117 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -97317,6 +106913,9 @@ func (*VpcV1) NewKeyIdentityByCRN(crn string) (_model *KeyIdentityByCRN, err err CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97329,6 +106928,7 @@ func UnmarshalKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) obj := new(KeyIdentityByCRN) 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)) @@ -97349,6 +106949,9 @@ func (*VpcV1) NewKeyIdentityByFingerprint(fingerprint string) (_model *KeyIdenti Fingerprint: core.StringPtr(fingerprint), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97361,6 +106964,7 @@ func UnmarshalKeyIdentityByFingerprint(m map[string]json.RawMessage, result inte obj := new(KeyIdentityByFingerprint) err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) if err != nil { + err = core.SDKErrorf(err, "", "fingerprint-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -97380,6 +106984,9 @@ func (*VpcV1) NewKeyIdentityByHref(href string) (_model *KeyIdentityByHref, err Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97392,6 +106999,7 @@ func UnmarshalKeyIdentityByHref(m map[string]json.RawMessage, result interface{} obj := new(KeyIdentityByHref) 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)) @@ -97411,6 +107019,9 @@ func (*VpcV1) NewKeyIdentityByID(id string) (_model *KeyIdentityByID, err error) ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97423,6 +107034,7 @@ func UnmarshalKeyIdentityByID(m map[string]json.RawMessage, result interface{}) obj := new(KeyIdentityByID) 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)) @@ -97442,6 +107054,9 @@ func (*VpcV1) NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketI Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97454,6 +107069,7 @@ func UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIden obj := new(LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) 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)) @@ -97473,6 +107089,9 @@ func (*VpcV1) NewLoadBalancerIdentityByCRN(crn string) (_model *LoadBalancerIden CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97485,6 +107104,7 @@ func UnmarshalLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result int obj := new(LoadBalancerIdentityByCRN) 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)) @@ -97504,6 +107124,9 @@ func (*VpcV1) NewLoadBalancerIdentityByHref(href string) (_model *LoadBalancerId Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97516,6 +107139,7 @@ func UnmarshalLoadBalancerIdentityByHref(m map[string]json.RawMessage, result in obj := new(LoadBalancerIdentityByHref) 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)) @@ -97535,6 +107159,9 @@ func (*VpcV1) NewLoadBalancerIdentityByID(id string) (_model *LoadBalancerIdenti ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97547,6 +107174,7 @@ func UnmarshalLoadBalancerIdentityByID(m map[string]json.RawMessage, result inte obj := new(LoadBalancerIdentityByID) 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)) @@ -97628,6 +107256,9 @@ func (*VpcV1) NewLoadBalancerListenerIdentityByHref(href string) (_model *LoadBa Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97640,6 +107271,7 @@ func UnmarshalLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, r obj := new(LoadBalancerListenerIdentityByHref) 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)) @@ -97659,6 +107291,9 @@ func (*VpcV1) NewLoadBalancerListenerIdentityByID(id string) (_model *LoadBalanc ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97671,6 +107306,7 @@ func UnmarshalLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, res obj := new(LoadBalancerListenerIdentityByID) 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)) @@ -97699,14 +107335,17 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTT obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -97732,10 +107371,12 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRed obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -97773,10 +107414,12 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity(m ma obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) 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)) @@ -97803,6 +107446,9 @@ func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPo Listener: listener, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97815,14 +107461,17 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolic obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -97846,6 +107495,9 @@ func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPo URL: core.StringPtr(url), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97858,10 +107510,12 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolic obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -97899,10 +107553,12 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity( obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) 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)) @@ -97930,14 +107586,17 @@ func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRed obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -97963,10 +107622,12 @@ func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirect obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -97999,18 +107660,22 @@ func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference(m map[st obj := new(LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98030,6 +107695,9 @@ func (*VpcV1) NewLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href str Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98042,6 +107710,7 @@ func UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[strin obj := new(LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) 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)) @@ -98061,6 +107730,9 @@ func (*VpcV1) NewLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98073,6 +107745,7 @@ func UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string] obj := new(LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) 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)) @@ -98095,6 +107768,9 @@ func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeIP(address string) (_model Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98107,6 +107783,7 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeIP(m map[string]json.RawMessa obj := new(LoadBalancerPoolMemberTargetPrototypeIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98148,14 +107825,17 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity(m map[string obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98181,6 +107861,7 @@ func UnmarshalLoadBalancerPoolMemberTargetIP(m map[string]json.RawMessage, resul obj := new(LoadBalancerPoolMemberTargetIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98216,22 +107897,27 @@ func UnmarshalLoadBalancerPoolMemberTargetInstanceReference(m map[string]json.Ra obj := new(LoadBalancerPoolMemberTargetInstanceReference) 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, UnmarshalInstanceReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98251,6 +107937,9 @@ func (*VpcV1) NewLoadBalancerProfileIdentityByHref(href string) (_model *LoadBal Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98263,6 +107952,7 @@ func UnmarshalLoadBalancerProfileIdentityByHref(m map[string]json.RawMessage, re obj := new(LoadBalancerProfileIdentityByHref) 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)) @@ -98282,6 +107972,9 @@ func (*VpcV1) NewLoadBalancerProfileIdentityByName(name string) (_model *LoadBal Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98294,6 +107987,7 @@ func UnmarshalLoadBalancerProfileIdentityByName(m map[string]json.RawMessage, re obj := new(LoadBalancerProfileIdentityByName) 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)) @@ -98322,6 +108016,7 @@ func UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent(m map[string]j obj := new(LoadBalancerProfileInstanceGroupsSupportedDependent) 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)) @@ -98353,10 +108048,12 @@ func UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed(m map[string]json. obj := new(LoadBalancerProfileInstanceGroupsSupportedFixed) 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)) @@ -98385,6 +108082,7 @@ func UnmarshalLoadBalancerProfileRouteModeSupportedDependent(m map[string]json.R obj := new(LoadBalancerProfileRouteModeSupportedDependent) 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)) @@ -98416,10 +108114,12 @@ func UnmarshalLoadBalancerProfileRouteModeSupportedFixed(m map[string]json.RawMe obj := new(LoadBalancerProfileRouteModeSupportedFixed) 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)) @@ -98448,6 +108148,7 @@ func UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent(m map[string]j obj := new(LoadBalancerProfileSecurityGroupsSupportedDependent) 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)) @@ -98479,10 +108180,12 @@ func UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed(m map[string]json. obj := new(LoadBalancerProfileSecurityGroupsSupportedFixed) 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)) @@ -98511,6 +108214,7 @@ func UnmarshalLoadBalancerProfileUDPSupportedDependent(m map[string]json.RawMess obj := new(LoadBalancerProfileUDPSupportedDependent) 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)) @@ -98542,10 +108246,12 @@ func UnmarshalLoadBalancerProfileUDPSupportedFixed(m map[string]json.RawMessage, obj := new(LoadBalancerProfileUDPSupportedFixed) 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)) @@ -98565,6 +108271,9 @@ func (*VpcV1) NewNetworkACLIdentityByCRN(crn string) (_model *NetworkACLIdentity CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98577,6 +108286,7 @@ func UnmarshalNetworkACLIdentityByCRN(m map[string]json.RawMessage, result inter obj := new(NetworkACLIdentityByCRN) 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)) @@ -98596,6 +108306,9 @@ func (*VpcV1) NewNetworkACLIdentityByHref(href string) (_model *NetworkACLIdenti Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98608,6 +108321,7 @@ func UnmarshalNetworkACLIdentityByHref(m map[string]json.RawMessage, result inte obj := new(NetworkACLIdentityByHref) 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)) @@ -98627,6 +108341,9 @@ func (*VpcV1) NewNetworkACLIdentityByID(id string) (_model *NetworkACLIdentityBy ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98639,6 +108356,7 @@ func UnmarshalNetworkACLIdentityByID(m map[string]json.RawMessage, result interf obj := new(NetworkACLIdentityByID) 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)) @@ -98668,6 +108386,9 @@ func (*VpcV1) NewNetworkACLPrototypeNetworkACLByRules(vpc VPCIdentityIntf) (_mod VPC: vpc, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98680,18 +108401,22 @@ func UnmarshalNetworkACLPrototypeNetworkACLByRules(m map[string]json.RawMessage, obj := new(NetworkACLPrototypeNetworkACLByRules) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98721,6 +108446,9 @@ func (*VpcV1) NewNetworkACLPrototypeNetworkACLBySourceNetworkACL(vpc VPCIdentity SourceNetworkACL: sourceNetworkACL, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98733,18 +108461,22 @@ func UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL(m map[string]json. obj := new(NetworkACLPrototypeNetworkACLBySourceNetworkACL) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_network_acl-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98764,6 +108496,9 @@ func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(href stri Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98776,6 +108511,7 @@ func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(m map[string obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) 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)) @@ -98795,6 +108531,9 @@ func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(id string) ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98807,6 +108546,7 @@ func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(m map[string]j obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) 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)) @@ -98826,6 +108566,9 @@ func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(href Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98838,6 +108581,7 @@ func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(m map[st obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) 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)) @@ -98857,6 +108601,9 @@ func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(id stri ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98869,6 +108616,7 @@ func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(m map[stri obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) 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)) @@ -98948,46 +108696,57 @@ func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll(m map[string]json.RawM obj := new(NetworkACLRuleItemNetworkACLRuleProtocolAll) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -99077,54 +108836,67 @@ func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp(m map[string]json.Raw obj := new(NetworkACLRuleItemNetworkACLRuleProtocolIcmp) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-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)) @@ -99217,62 +108989,77 @@ func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp(m map[string]json.R obj := new(NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_min-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.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) if err != nil { + err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) if err != nil { + err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -99341,6 +109128,9 @@ func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolA Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99353,30 +109143,37 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllP obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-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, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } 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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -99455,6 +109252,9 @@ func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolI Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99467,38 +109267,47 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-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, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } 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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-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)) @@ -99580,6 +109389,9 @@ func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolT Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99592,46 +109404,57 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpu obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-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, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } 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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_min-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.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) if err != nil { + err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) if err != nil { + err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -99702,6 +109525,9 @@ func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(actio Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99714,34 +109540,42 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(m map[st obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } 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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -99822,6 +109656,9 @@ func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(acti Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99834,42 +109671,52 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(m map[s obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } 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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-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)) @@ -99953,6 +109800,9 @@ func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(ac Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99965,50 +109815,62 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(m map obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } 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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_min-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.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) if err != nil { + err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) if err != nil { + err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -100087,46 +109949,57 @@ func UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll(m map[string]json.RawMessa obj := new(NetworkACLRuleNetworkACLRuleProtocolAll) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -100215,54 +110088,67 @@ func UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp(m map[string]json.RawMess obj := new(NetworkACLRuleNetworkACLRuleProtocolIcmp) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-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)) @@ -100354,62 +110240,77 @@ func UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp(m map[string]json.RawMe obj := new(NetworkACLRuleNetworkACLRuleProtocolTcpudp) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_min-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.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) if err != nil { + err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) if err != nil { + err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -100447,10 +110348,12 @@ func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity(m map[string]json.Ra obj := new(NetworkInterfaceIPPrototypeReservedIPIdentity) 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)) @@ -100484,14 +110387,17 @@ func UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceCont obj := new(NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) 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)) @@ -100511,6 +110417,9 @@ func (*VpcV1) NewOperatingSystemIdentityByHref(href string) (_model *OperatingSy Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100523,6 +110432,7 @@ func UnmarshalOperatingSystemIdentityByHref(m map[string]json.RawMessage, result obj := new(OperatingSystemIdentityByHref) 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)) @@ -100542,6 +110452,9 @@ func (*VpcV1) NewOperatingSystemIdentityByName(name string) (_model *OperatingSy Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100554,6 +110467,7 @@ func UnmarshalOperatingSystemIdentityByName(m map[string]json.RawMessage, result obj := new(OperatingSystemIdentityByName) 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)) @@ -100599,18 +110513,22 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity(m map[string]js obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -100638,10 +110556,12 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext(m obj := new(PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -100661,6 +110581,9 @@ func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByCRN(crn string) (_m CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100673,6 +110596,7 @@ func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN(m map[string]json. obj := new(PublicGatewayIdentityPublicGatewayIdentityByCRN) 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)) @@ -100692,6 +110616,9 @@ func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByHref(href string) ( Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100704,6 +110631,7 @@ func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref(m map[string]json obj := new(PublicGatewayIdentityPublicGatewayIdentityByHref) 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)) @@ -100723,6 +110651,9 @@ func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByID(id string) (_mod ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100735,6 +110666,7 @@ func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID(m map[string]json.R obj := new(PublicGatewayIdentityPublicGatewayIdentityByID) 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)) @@ -100754,6 +110686,9 @@ func (*VpcV1) NewRegionIdentityByHref(href string) (_model *RegionIdentityByHref Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100766,6 +110701,7 @@ func UnmarshalRegionIdentityByHref(m map[string]json.RawMessage, result interfac obj := new(RegionIdentityByHref) 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)) @@ -100785,6 +110721,9 @@ func (*VpcV1) NewRegionIdentityByName(name string) (_model *RegionIdentityByName Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100797,6 +110736,7 @@ func UnmarshalRegionIdentityByName(m map[string]json.RawMessage, result interfac obj := new(RegionIdentityByName) 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)) @@ -100816,6 +110756,9 @@ func (*VpcV1) NewReservationIdentityByCRN(crn string) (_model *ReservationIdenti CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100828,6 +110771,7 @@ func UnmarshalReservationIdentityByCRN(m map[string]json.RawMessage, result inte obj := new(ReservationIdentityByCRN) 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)) @@ -100847,6 +110791,9 @@ func (*VpcV1) NewReservationIdentityByHref(href string) (_model *ReservationIden Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100859,6 +110806,7 @@ func UnmarshalReservationIdentityByHref(m map[string]json.RawMessage, result int obj := new(ReservationIdentityByHref) 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)) @@ -100878,6 +110826,9 @@ func (*VpcV1) NewReservationIdentityByID(id string) (_model *ReservationIdentity ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100890,6 +110841,7 @@ func UnmarshalReservationIdentityByID(m map[string]json.RawMessage, result inter obj := new(ReservationIdentityByID) 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)) @@ -100931,14 +110883,17 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity(m map[string]json obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -100980,14 +110935,17 @@ func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[str obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) 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 } 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)) @@ -101038,22 +110996,27 @@ func UnmarshalReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetCont obj := new(ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) 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)) @@ -101098,26 +111061,32 @@ func UnmarshalReservedIPTargetEndpointGatewayReference(m map[string]json.RawMess obj := new(ReservedIPTargetEndpointGatewayReference) 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, UnmarshalEndpointGatewayReferenceDeleted) 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)) @@ -101153,14 +111122,17 @@ func UnmarshalReservedIPTargetGenericResourceReference(m map[string]json.RawMess obj := new(ReservedIPTargetGenericResourceReference) 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, UnmarshalGenericResourceReferenceDeleted) if err != nil { + err = core.SDKErrorf(err, "", "deleted-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)) @@ -101205,26 +111177,32 @@ func UnmarshalReservedIPTargetLoadBalancerReference(m map[string]json.RawMessage obj := new(ReservedIPTargetLoadBalancerReference) 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, UnmarshalLoadBalancerReferenceDeleted) 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)) @@ -101275,22 +111253,27 @@ func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[strin obj := new(ReservedIPTargetNetworkInterfaceReferenceTargetContext) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) 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)) @@ -101335,26 +111318,32 @@ func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, obj := new(ReservedIPTargetVPNGatewayReference) 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, UnmarshalVPNGatewayReferenceDeleted) 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)) @@ -101399,26 +111388,32 @@ func UnmarshalReservedIPTargetVPNServerReference(m map[string]json.RawMessage, r obj := new(ReservedIPTargetVPNServerReference) 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, UnmarshalVPNServerReferenceDeleted) 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)) @@ -101459,22 +111454,27 @@ func UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetCo obj := new(ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext) 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) 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)) @@ -101494,6 +111494,9 @@ func (*VpcV1) NewResourceGroupIdentityByID(id string) (_model *ResourceGroupIden ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -101506,6 +111509,7 @@ func UnmarshalResourceGroupIdentityByID(m map[string]json.RawMessage, result int obj := new(ResourceGroupIdentityByID) 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)) @@ -101550,26 +111554,32 @@ func UnmarshalRouteCreatorVPNGatewayReference(m map[string]json.RawMessage, resu obj := new(RouteCreatorVPNGatewayReference) 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, UnmarshalVPNGatewayReferenceDeleted) 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)) @@ -101614,26 +111624,32 @@ func UnmarshalRouteCreatorVPNServerReference(m map[string]json.RawMessage, resul obj := new(RouteCreatorVPNServerReference) 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, UnmarshalVPNServerReferenceDeleted) 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)) @@ -101659,6 +111675,7 @@ func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) ( obj := new(RouteNextHopIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -101696,6 +111713,7 @@ func UnmarshalRouteNextHopPatchRouteNextHopIP(m map[string]json.RawMessage, resu obj := new(RouteNextHopPatchRouteNextHopIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -101733,10 +111751,12 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity(m map[string]json.Ra obj := new(RouteNextHopPatchVPNGatewayConnectionIdentity) 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)) @@ -101778,22 +111798,27 @@ func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMes obj := new(RouteNextHopVPNGatewayConnectionReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) 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)) @@ -101831,6 +111856,7 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(m map[str obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -101868,10 +111894,12 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIden obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) 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)) @@ -101891,6 +111919,9 @@ func (*VpcV1) NewRoutingTableIdentityByHref(href string) (_model *RoutingTableId Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -101903,6 +111934,7 @@ func UnmarshalRoutingTableIdentityByHref(m map[string]json.RawMessage, result in obj := new(RoutingTableIdentityByHref) 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)) @@ -101922,6 +111954,9 @@ func (*VpcV1) NewRoutingTableIdentityByID(id string) (_model *RoutingTableIdenti ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -101934,6 +111969,7 @@ func UnmarshalRoutingTableIdentityByID(m map[string]json.RawMessage, result inte obj := new(RoutingTableIdentityByID) 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)) @@ -101953,6 +111989,9 @@ func (*VpcV1) NewSecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupId CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -101965,6 +112004,7 @@ func UnmarshalSecurityGroupIdentityByCRN(m map[string]json.RawMessage, result in obj := new(SecurityGroupIdentityByCRN) 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)) @@ -101984,6 +112024,9 @@ func (*VpcV1) NewSecurityGroupIdentityByHref(href string) (_model *SecurityGroup Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -101996,6 +112039,7 @@ func UnmarshalSecurityGroupIdentityByHref(m map[string]json.RawMessage, result i obj := new(SecurityGroupIdentityByHref) 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)) @@ -102015,6 +112059,9 @@ func (*VpcV1) NewSecurityGroupIdentityByID(id string) (_model *SecurityGroupIden ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102027,6 +112074,7 @@ func UnmarshalSecurityGroupIdentityByID(m map[string]json.RawMessage, result int obj := new(SecurityGroupIdentityByID) 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)) @@ -102281,6 +112329,9 @@ func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(directio Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102293,10 +112344,12 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[strin obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPrototype) @@ -102305,10 +112358,12 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[strin } 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102387,6 +112442,9 @@ func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(directi Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102399,14 +112457,17 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[stri obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPrototype) @@ -102415,14 +112476,17 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[stri } 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102507,6 +112571,9 @@ func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(direc Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102519,10 +112586,12 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[st obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPrototype) @@ -102531,18 +112600,22 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[st } 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 } 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102565,6 +112638,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePatchCIDR(cidrBlock string) (_model *Sec CIDRBlock: core.StringPtr(cidrBlock), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102577,6 +112653,7 @@ func UnmarshalSecurityGroupRuleRemotePatchCIDR(m map[string]json.RawMessage, res obj := new(SecurityGroupRuleRemotePatchCIDR) err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102599,6 +112676,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePatchIP(address string) (_model *Securit Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102611,6 +112691,7 @@ func UnmarshalSecurityGroupRuleRemotePatchIP(m map[string]json.RawMessage, resul obj := new(SecurityGroupRuleRemotePatchIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102652,14 +112733,17 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity(m map[string]jso obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102682,6 +112766,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePrototypeCIDR(cidrBlock string) (_model CIDRBlock: core.StringPtr(cidrBlock), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102694,6 +112781,7 @@ func UnmarshalSecurityGroupRuleRemotePrototypeCIDR(m map[string]json.RawMessage, obj := new(SecurityGroupRuleRemotePrototypeCIDR) err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102716,6 +112804,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePrototypeIP(address string) (_model *Sec Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102728,6 +112819,7 @@ func UnmarshalSecurityGroupRuleRemotePrototypeIP(m map[string]json.RawMessage, r obj := new(SecurityGroupRuleRemotePrototypeIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102769,14 +112861,17 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity(m map[string obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102802,6 +112897,7 @@ func UnmarshalSecurityGroupRuleRemoteCIDR(m map[string]json.RawMessage, result i obj := new(SecurityGroupRuleRemoteCIDR) err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102827,6 +112923,7 @@ func UnmarshalSecurityGroupRuleRemoteIP(m map[string]json.RawMessage, result int obj := new(SecurityGroupRuleRemoteIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102862,22 +112959,27 @@ func UnmarshalSecurityGroupRuleRemoteSecurityGroupReference(m map[string]json.Ra obj := new(SecurityGroupRuleRemoteSecurityGroupReference) 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, UnmarshalSecurityGroupReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102943,18 +113045,22 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.Ra obj := new(SecurityGroupRuleSecurityGroupRuleProtocolAll) err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) @@ -102963,10 +113069,12 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.Ra } err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) if err != nil { + err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -103038,18 +113146,22 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.R obj := new(SecurityGroupRuleSecurityGroupRuleProtocolIcmp) err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) @@ -103058,18 +113170,22 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.R } err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) 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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-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)) @@ -103145,18 +113261,22 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json obj := new(SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) @@ -103165,18 +113285,22 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json } err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) if err != nil { + err = core.SDKErrorf(err, "", "remote-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 } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -103227,22 +113351,27 @@ func UnmarshalSecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferen obj := new(SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) 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)) @@ -103287,26 +113416,32 @@ func UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference(m map[string] obj := new(SecurityGroupTargetReferenceEndpointGatewayReference) 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, UnmarshalEndpointGatewayReferenceDeleted) 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)) @@ -103351,26 +113486,32 @@ func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]jso obj := new(SecurityGroupTargetReferenceLoadBalancerReference) 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, UnmarshalLoadBalancerReferenceDeleted) 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)) @@ -103421,22 +113562,27 @@ func UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext obj := new(SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) 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)) @@ -103481,26 +113627,32 @@ func UnmarshalSecurityGroupTargetReferenceVPNServerReference(m map[string]json.R obj := new(SecurityGroupTargetReferenceVPNServerReference) 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, UnmarshalVPNServerReferenceDeleted) 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)) @@ -103551,34 +113703,42 @@ func UnmarshalSecurityGroupTargetReferenceVirtualNetworkInterfaceReference(m map obj := new(SecurityGroupTargetReferenceVirtualNetworkInterfaceReference) 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, UnmarshalVirtualNetworkInterfaceReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -103598,6 +113758,9 @@ func (*VpcV1) NewShareIdentityByCRN(crn string) (_model *ShareIdentityByCRN, err CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -103610,6 +113773,7 @@ func UnmarshalShareIdentityByCRN(m map[string]json.RawMessage, result interface{ obj := new(ShareIdentityByCRN) 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)) @@ -103629,6 +113793,9 @@ func (*VpcV1) NewShareIdentityByHref(href string) (_model *ShareIdentityByHref, Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -103641,6 +113808,7 @@ func UnmarshalShareIdentityByHref(m map[string]json.RawMessage, result interface obj := new(ShareIdentityByHref) 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)) @@ -103660,6 +113828,9 @@ func (*VpcV1) NewShareIdentityByID(id string) (_model *ShareIdentityByID, err er ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -103672,6 +113843,7 @@ func UnmarshalShareIdentityByID(m map[string]json.RawMessage, result interface{} obj := new(ShareIdentityByID) 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)) @@ -103720,6 +113892,9 @@ func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSec VirtualNetworkInterface: virtualNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -103732,14 +113907,17 @@ func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeSecuri obj := new(ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) if err != nil { + err = core.SDKErrorf(err, "", "transit_encryption-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -103781,6 +113959,9 @@ func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC VPC: vpc, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -103793,14 +113974,17 @@ func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(m obj := new(ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) if err != nil { + err = core.SDKErrorf(err, "", "transit_encryption-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -103842,14 +114026,17 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) 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 } 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)) @@ -103928,38 +114115,47 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) 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 } 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.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) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -103998,18 +114194,22 @@ func UnmarshalShareProfileCapacityDependentRange(m map[string]json.RawMessage, r obj := new(ShareProfileCapacityDependentRange) 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)) @@ -104044,14 +114244,17 @@ func UnmarshalShareProfileCapacityEnum(m map[string]json.RawMessage, result inte 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()) 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)) @@ -104083,10 +114286,12 @@ func UnmarshalShareProfileCapacityFixed(m map[string]json.RawMessage, result int obj := new(ShareProfileCapacityFixed) 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)) @@ -104127,22 +114332,27 @@ func UnmarshalShareProfileCapacityRange(m map[string]json.RawMessage, result int obj := new(ShareProfileCapacityRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -104181,18 +114391,22 @@ func UnmarshalShareProfileIopsDependentRange(m map[string]json.RawMessage, resul obj := new(ShareProfileIopsDependentRange) 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)) @@ -104227,14 +114441,17 @@ func UnmarshalShareProfileIopsEnum(m map[string]json.RawMessage, result interfac obj := new(ShareProfileIopsEnum) 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)) @@ -104266,10 +114483,12 @@ func UnmarshalShareProfileIopsFixed(m map[string]json.RawMessage, result interfa obj := new(ShareProfileIopsFixed) 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)) @@ -104310,22 +114529,27 @@ func UnmarshalShareProfileIopsRange(m map[string]json.RawMessage, result interfa obj := new(ShareProfileIopsRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -104345,6 +114569,9 @@ func (*VpcV1) NewShareProfileIdentityByHref(href string) (_model *ShareProfileId Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104357,6 +114584,7 @@ func UnmarshalShareProfileIdentityByHref(m map[string]json.RawMessage, result in obj := new(ShareProfileIdentityByHref) 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)) @@ -104376,6 +114604,9 @@ func (*VpcV1) NewShareProfileIdentityByName(name string) (_model *ShareProfileId Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104388,6 +114619,7 @@ func UnmarshalShareProfileIdentityByName(m map[string]json.RawMessage, result in obj := new(ShareProfileIdentityByName) 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)) @@ -104475,6 +114707,9 @@ func (*VpcV1) NewSharePrototypeShareBySize(profile ShareProfileIdentityIntf, zon Size: core.Int64Ptr(size), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104487,50 +114722,62 @@ func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result int obj := new(SharePrototypeShareBySize) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) if err != nil { + err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { + err = core.SDKErrorf(err, "", "access_control_mode-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, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) if err != nil { + err = core.SDKErrorf(err, "", "initial_owner-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.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -104600,6 +114847,9 @@ func (*VpcV1) NewSharePrototypeShareBySourceShare(profile ShareProfileIdentityIn SourceShare: sourceShare, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104612,46 +114862,57 @@ func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, res obj := new(SharePrototypeShareBySourceShare) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) if err != nil { + err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-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.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { + err = core.SDKErrorf(err, "", "replication_cron_spec-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, "source_share", &obj.SourceShare, UnmarshalShareIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -104683,6 +114944,9 @@ func (*VpcV1) NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnap Snapshots: snapshots, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104695,18 +114959,22 @@ func UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapsho obj := new(SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_snapshots_on_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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext) if err != nil { + err = core.SDKErrorf(err, "", "snapshots-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -104726,6 +114994,9 @@ func (*VpcV1) NewSnapshotIdentityByCRN(crn string) (_model *SnapshotIdentityByCR CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104738,6 +115009,7 @@ func UnmarshalSnapshotIdentityByCRN(m map[string]json.RawMessage, result interfa obj := new(SnapshotIdentityByCRN) 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)) @@ -104757,6 +115029,9 @@ func (*VpcV1) NewSnapshotIdentityByHref(href string) (_model *SnapshotIdentityBy Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104769,6 +115044,7 @@ func UnmarshalSnapshotIdentityByHref(m map[string]json.RawMessage, result interf obj := new(SnapshotIdentityByHref) 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)) @@ -104788,6 +115064,9 @@ func (*VpcV1) NewSnapshotIdentityByID(id string) (_model *SnapshotIdentityByID, ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104800,6 +115079,7 @@ func UnmarshalSnapshotIdentityByID(m map[string]json.RawMessage, result interfac obj := new(SnapshotIdentityByID) 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)) @@ -104843,6 +115123,9 @@ func (*VpcV1) NewSnapshotPrototypeSnapshotBySourceSnapshot(sourceSnapshot *Snaps SourceSnapshot: sourceSnapshot, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104855,26 +115138,32 @@ func UnmarshalSnapshotPrototypeSnapshotBySourceSnapshot(m map[string]json.RawMes obj := new(SnapshotPrototypeSnapshotBySourceSnapshot) err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) if err != nil { + err = core.SDKErrorf(err, "", "clones-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -104906,6 +115195,9 @@ func (*VpcV1) NewSnapshotPrototypeSnapshotBySourceVolume(sourceVolume VolumeIden SourceVolume: sourceVolume, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104918,22 +115210,27 @@ func UnmarshalSnapshotPrototypeSnapshotBySourceVolume(m map[string]json.RawMessa obj := new(SnapshotPrototypeSnapshotBySourceVolume) err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) if err != nil { + err = core.SDKErrorf(err, "", "clones-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -104953,6 +115250,9 @@ func (*VpcV1) NewSubnetIdentityByCRN(crn string) (_model *SubnetIdentityByCRN, e CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104965,6 +115265,7 @@ func UnmarshalSubnetIdentityByCRN(m map[string]json.RawMessage, result interface obj := new(SubnetIdentityByCRN) 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)) @@ -104984,6 +115285,9 @@ func (*VpcV1) NewSubnetIdentityByHref(href string) (_model *SubnetIdentityByHref Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104996,6 +115300,7 @@ func UnmarshalSubnetIdentityByHref(m map[string]json.RawMessage, result interfac obj := new(SubnetIdentityByHref) 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)) @@ -105015,6 +115320,9 @@ func (*VpcV1) NewSubnetIdentityByID(id string) (_model *SubnetIdentityByID, err ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105027,6 +115335,7 @@ func UnmarshalSubnetIdentityByID(m map[string]json.RawMessage, result interface{ obj := new(SubnetIdentityByID) 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)) @@ -105085,6 +115394,9 @@ func (*VpcV1) NewSubnetPrototypeSubnetByCIDR(vpc VPCIdentityIntf, ipv4CIDRBlock Ipv4CIDRBlock: core.StringPtr(ipv4CIDRBlock), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105097,38 +115409,47 @@ func UnmarshalSubnetPrototypeSubnetByCIDR(m map[string]json.RawMessage, result i obj := new(SubnetPrototypeSubnetByCIDR) 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.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) if err != nil { + err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) if err != nil { + err = core.SDKErrorf(err, "", "public_gateway-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, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) if err != nil { + err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-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 } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -105185,6 +115506,9 @@ func (*VpcV1) NewSubnetPrototypeSubnetByTotalCount(vpc VPCIdentityIntf, totalIpv Zone: zone, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105197,38 +115521,47 @@ func UnmarshalSubnetPrototypeSubnetByTotalCount(m map[string]json.RawMessage, re obj := new(SubnetPrototypeSubnetByTotalCount) 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.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) if err != nil { + err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) if err != nil { + err = core.SDKErrorf(err, "", "public_gateway-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, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) if err != nil { + err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-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 } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -105248,6 +115581,9 @@ func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(crn string) CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105260,6 +115596,7 @@ func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(m map[string]js obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByCRN) 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)) @@ -105279,6 +115616,9 @@ func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref(href string Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105291,6 +115631,7 @@ func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByHref(m map[string]j obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByHref) 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)) @@ -105310,6 +115651,9 @@ func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByID(id string) (_ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105322,6 +115666,7 @@ func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByID(m map[string]jso obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByID) 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)) @@ -105341,6 +115686,9 @@ func (*VpcV1) NewTrustedProfileIdentityTrustedProfileByCRN(crn string) (_model * CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105353,6 +115701,7 @@ func UnmarshalTrustedProfileIdentityTrustedProfileByCRN(m map[string]json.RawMes obj := new(TrustedProfileIdentityTrustedProfileByCRN) 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)) @@ -105372,6 +115721,9 @@ func (*VpcV1) NewTrustedProfileIdentityTrustedProfileByID(id string) (_model *Tr ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105384,6 +115736,7 @@ func UnmarshalTrustedProfileIdentityTrustedProfileByID(m map[string]json.RawMess obj := new(TrustedProfileIdentityTrustedProfileByID) 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)) @@ -105424,6 +115777,9 @@ func (*VpcV1) NewVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype(manual Type: core.StringPtr(typeVar), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105436,10 +115792,12 @@ func UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype(m map[str obj := new(VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype) err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manual_servers-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)) @@ -105470,6 +115828,7 @@ func UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype(m map[str obj := new(VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype) 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)) @@ -105510,14 +115869,17 @@ func UnmarshalVpcdnsResolverTypeDelegated(m map[string]json.RawMessage, result i obj := new(VpcdnsResolverTypeDelegated) err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) if err != nil { + err = core.SDKErrorf(err, "", "servers-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.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -105564,14 +115926,17 @@ func UnmarshalVpcdnsResolverTypeManual(m map[string]json.RawMessage, result inte obj := new(VpcdnsResolverTypeManual) err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) if err != nil { + err = core.SDKErrorf(err, "", "servers-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer) if err != nil { + err = core.SDKErrorf(err, "", "manual_servers-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)) @@ -105651,14 +116016,17 @@ func UnmarshalVpcdnsResolverTypeSystem(m map[string]json.RawMessage, result inte obj := new(VpcdnsResolverTypeSystem) err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) if err != nil { + err = core.SDKErrorf(err, "", "servers-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration) if err != nil { + err = core.SDKErrorf(err, "", "configuration-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)) @@ -105678,6 +116046,9 @@ func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByCRN(crn string) (_model *Vpc CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105690,6 +116061,7 @@ func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByCRN(m map[string]json.RawMessag obj := new(VpcdnsResolverVPCPatchVPCIdentityByCRN) 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)) @@ -105709,6 +116081,9 @@ func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByHref(href string) (_model *V Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105721,6 +116096,7 @@ func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByHref(m map[string]json.RawMessa obj := new(VpcdnsResolverVPCPatchVPCIdentityByHref) 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)) @@ -105740,6 +116116,9 @@ func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByID(id string) (_model *Vpcdn ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105752,6 +116131,7 @@ func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByID(m map[string]json.RawMessage obj := new(VpcdnsResolverVPCPatchVPCIdentityByID) 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)) @@ -105771,6 +116151,9 @@ func (*VpcV1) NewVPCIdentityByCRN(crn string) (_model *VPCIdentityByCRN, err err CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105783,6 +116166,7 @@ func UnmarshalVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) obj := new(VPCIdentityByCRN) 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)) @@ -105802,6 +116186,9 @@ func (*VpcV1) NewVPCIdentityByHref(href string) (_model *VPCIdentityByHref, err Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105814,6 +116201,7 @@ func UnmarshalVPCIdentityByHref(m map[string]json.RawMessage, result interface{} obj := new(VPCIdentityByHref) 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)) @@ -105833,6 +116221,9 @@ func (*VpcV1) NewVPCIdentityByID(id string) (_model *VPCIdentityByID, err error) ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105845,6 +116236,7 @@ func UnmarshalVPCIdentityByID(m map[string]json.RawMessage, result interface{}) obj := new(VPCIdentityByID) 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)) @@ -105864,6 +116256,9 @@ func (*VpcV1) NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(href Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105876,6 +116271,7 @@ func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(m map[st obj := new(VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref) 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)) @@ -105895,6 +116291,9 @@ func (*VpcV1) NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(id stri ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105907,6 +116306,7 @@ func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(m map[stri obj := new(VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) 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)) @@ -105926,6 +116326,9 @@ func (*VpcV1) NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(h Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105938,6 +116341,7 @@ func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(m ma obj := new(VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref) 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)) @@ -105957,6 +116361,9 @@ func (*VpcV1) NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(id ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105969,6 +116376,7 @@ func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(m map[ obj := new(VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) 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)) @@ -105988,6 +116396,9 @@ func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(h Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106000,6 +116411,7 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(m ma obj := new(VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref) 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)) @@ -106019,6 +116431,9 @@ func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(id ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106031,6 +116446,7 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(m map[ obj := new(VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) 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)) @@ -106050,6 +116466,9 @@ func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHr Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106062,6 +116481,7 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref( obj := new(VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref) 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)) @@ -106081,6 +116501,9 @@ func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106093,6 +116516,7 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(m obj := new(VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) 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)) @@ -106190,70 +116614,87 @@ func UnmarshalVPNGatewayConnectionPolicyMode(m map[string]json.RawMessage, resul obj := new(VPNGatewayConnectionPolicyMode) err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) if err != nil { + err = core.SDKErrorf(err, "", "authentication_mode-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, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-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, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-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, "peer_address", &obj.PeerAddress) if err != nil { + err = core.SDKErrorf(err, "", "peer_address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) if err != nil { + err = core.SDKErrorf(err, "", "psk-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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) if err != nil { + err = core.SDKErrorf(err, "", "local_cidrs-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) if err != nil { + err = core.SDKErrorf(err, "", "peer_cidrs-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -106298,6 +116739,9 @@ func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModeProt PeerCIDRs: peerCIDRs, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106310,38 +116754,47 @@ func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototy obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype) err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-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, "peer_address", &obj.PeerAddress) if err != nil { + err = core.SDKErrorf(err, "", "peer_address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) if err != nil { + err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) if err != nil { + err = core.SDKErrorf(err, "", "local_cidrs-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) if err != nil { + err = core.SDKErrorf(err, "", "peer_cidrs-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -106387,6 +116840,9 @@ func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteMod Psk: core.StringPtr(psk), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106399,34 +116855,42 @@ func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePr obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-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, "peer_address", &obj.PeerAddress) if err != nil { + err = core.SDKErrorf(err, "", "peer_address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) if err != nil { + err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) if err != nil { + err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -106538,76 +117002,32 @@ func (*VPNGatewayConnectionRouteMode) isaVPNGatewayConnection() bool { // UnmarshalVPNGatewayConnectionRouteMode unmarshals an instance of VPNGatewayConnectionRouteMode from the specified map of raw messages. func UnmarshalVPNGatewayConnectionRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { +<<<<<<< Updated upstream obj := new(VPNGatewayConnectionRouteMode) err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) +======= + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "routing_protocol", &discValue) +>>>>>>> Stashed changes if err != nil { + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'routing_protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { + if discValue == "" { + err = core.SDKErrorf(err, "required discriminator property 'routing_protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) - if err != nil { - return + if discValue == "none" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode-error", common.GetComponentInfo()) + } + } else { + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'routing_protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -106716,66 +117136,82 @@ func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interfac obj := new(VPNGatewayPolicyMode) err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) if err != nil { + err = core.SDKErrorf(err, "", "connections-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) 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.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) if err != nil { + err = core.SDKErrorf(err, "", "members-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, "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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-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.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -106809,6 +117245,9 @@ func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet SubnetI Subnet: subnet, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106821,18 +117260,22 @@ func UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype(m map[string]json obj := new(VPNGatewayPrototypeVPNGatewayPolicyModePrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -106866,6 +117309,9 @@ func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayRouteModePrototype(subnet SubnetId Subnet: subnet, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106878,18 +117324,22 @@ func UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype(m map[string]json. obj := new(VPNGatewayPrototypeVPNGatewayRouteModePrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107001,66 +117451,82 @@ func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface obj := new(VPNGatewayRouteMode) err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) if err != nil { + err = core.SDKErrorf(err, "", "connections-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) 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.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) if err != nil { + err = core.SDKErrorf(err, "", "members-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, "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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-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.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107096,14 +117562,17 @@ func UnmarshalVPNServerAuthenticationByCertificate(m map[string]json.RawMessage, obj := new(VPNServerAuthenticationByCertificate) err = core.UnmarshalPrimitive(m, "method", &obj.Method) if err != nil { + err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "client_ca-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) if err != nil { + err = core.SDKErrorf(err, "", "crl-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107136,10 +117605,12 @@ func UnmarshalVPNServerAuthenticationByUsername(m map[string]json.RawMessage, re obj := new(VPNServerAuthenticationByUsername) err = core.UnmarshalPrimitive(m, "method", &obj.Method) if err != nil { + err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) if err != nil { + err = core.SDKErrorf(err, "", "identity_provider-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107173,6 +117644,9 @@ func (*VpcV1) NewVPNServerAuthenticationByUsernameIDProviderByIam(providerType s ProviderType: core.StringPtr(providerType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107185,6 +117659,7 @@ func UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam(m map[string]json obj := new(VPNServerAuthenticationByUsernameIDProviderByIam) err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) if err != nil { + err = core.SDKErrorf(err, "", "provider_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107218,6 +117693,9 @@ func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertif ClientCa: clientCa, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107230,14 +117708,17 @@ func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertifica obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) err = core.UnmarshalPrimitive(m, "method", &obj.Method) if err != nil { + err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceIdentity) if err != nil { + err = core.SDKErrorf(err, "", "client_ca-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) if err != nil { + err = core.SDKErrorf(err, "", "crl-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107268,6 +117749,9 @@ func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUserna IdentityProvider: identityProvider, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107280,10 +117764,12 @@ func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernameP obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) err = core.UnmarshalPrimitive(m, "method", &obj.Method) if err != nil { + err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) if err != nil { + err = core.SDKErrorf(err, "", "identity_provider-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107322,10 +117808,12 @@ func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetwork obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) 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)) @@ -107359,14 +117847,17 @@ func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetwor obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) 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)) @@ -107405,10 +117896,12 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtual obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) 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)) @@ -107442,14 +117935,17 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtua obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) 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)) @@ -107488,18 +117984,22 @@ func UnmarshalVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentRefer obj := new(VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext) 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)) @@ -107537,18 +118037,22 @@ func UnmarshalVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVir obj := new(VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) 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)) @@ -107590,22 +118094,27 @@ func UnmarshalVirtualNetworkInterfaceTargetShareMountTargetReference(m map[strin obj := new(VirtualNetworkInterfaceTargetShareMountTargetReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) 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)) @@ -107647,14 +118156,17 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentity(m map[string]json.Ra obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107719,34 +118231,42 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext(m ma obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107766,6 +118286,9 @@ func (*VpcV1) NewVolumeIdentityByCRN(crn string) (_model *VolumeIdentityByCRN, e CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107778,6 +118301,7 @@ func UnmarshalVolumeIdentityByCRN(m map[string]json.RawMessage, result interface obj := new(VolumeIdentityByCRN) 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)) @@ -107797,6 +118321,9 @@ func (*VpcV1) NewVolumeIdentityByHref(href string) (_model *VolumeIdentityByHref Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107809,6 +118336,7 @@ func UnmarshalVolumeIdentityByHref(m map[string]json.RawMessage, result interfac obj := new(VolumeIdentityByHref) 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)) @@ -107828,6 +118356,9 @@ func (*VpcV1) NewVolumeIdentityByID(id string) (_model *VolumeIdentityByID, err ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107840,6 +118371,7 @@ func UnmarshalVolumeIdentityByID(m map[string]json.RawMessage, result interface{ obj := new(VolumeIdentityByID) 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)) @@ -107859,6 +118391,9 @@ func (*VpcV1) NewVolumeProfileIdentityByHref(href string) (_model *VolumeProfile Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107871,6 +118406,7 @@ func UnmarshalVolumeProfileIdentityByHref(m map[string]json.RawMessage, result i obj := new(VolumeProfileIdentityByHref) 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)) @@ -107890,6 +118426,9 @@ func (*VpcV1) NewVolumeProfileIdentityByName(name string) (_model *VolumeProfile Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107902,6 +118441,7 @@ func UnmarshalVolumeProfileIdentityByName(m map[string]json.RawMessage, result i obj := new(VolumeProfileIdentityByName) 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)) @@ -107950,6 +118490,9 @@ func (*VpcV1) NewVolumePrototypeVolumeByCapacity(profile VolumeProfileIdentityIn Capacity: core.Int64Ptr(capacity), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107962,34 +118505,42 @@ func UnmarshalVolumePrototypeVolumeByCapacity(m map[string]json.RawMessage, resu obj := new(VolumePrototypeVolumeByCapacity) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -108041,6 +118592,9 @@ func (*VpcV1) NewVolumePrototypeVolumeBySourceSnapshot(profile VolumeProfileIden SourceSnapshot: sourceSnapshot, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108053,38 +118607,47 @@ func UnmarshalVolumePrototypeVolumeBySourceSnapshot(m map[string]json.RawMessage obj := new(VolumePrototypeVolumeBySourceSnapshot) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -108104,6 +118667,9 @@ func (*VpcV1) NewZoneIdentityByHref(href string) (_model *ZoneIdentityByHref, er Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108116,6 +118682,7 @@ func UnmarshalZoneIdentityByHref(m map[string]json.RawMessage, result interface{ obj := new(ZoneIdentityByHref) 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)) @@ -108135,6 +118702,9 @@ func (*VpcV1) NewZoneIdentityByName(name string) (_model *ZoneIdentityByName, er Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108147,6 +118717,7 @@ func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{ obj := new(ZoneIdentityByName) 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)) @@ -108166,6 +118737,9 @@ func (*VpcV1) NewBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityB CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108182,6 +118756,7 @@ func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCR obj := new(BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) 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)) @@ -108201,6 +118776,9 @@ func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfac CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108217,6 +118795,7 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVi obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) 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)) @@ -108236,6 +118815,9 @@ func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfac Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108252,6 +118834,7 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVi obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) 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)) @@ -108271,6 +118854,9 @@ func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfac ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108287,6 +118873,7 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVi obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) 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)) @@ -108306,6 +118893,9 @@ func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityByHref(href string) Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108322,6 +118912,7 @@ func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByHref(m map[string]jso obj := new(EndpointGatewayReservedIPReservedIPIdentityByHref) 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)) @@ -108341,6 +118932,9 @@ func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityByID(id string) (_mo ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108357,6 +118951,7 @@ func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByID(m map[string]json. obj := new(EndpointGatewayReservedIPReservedIPIdentityByID) 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)) @@ -108387,6 +118982,9 @@ func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProvi CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108403,10 +119001,12 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProvider obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) 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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -108438,6 +119038,9 @@ func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIden Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108454,10 +119057,12 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentit obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) 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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -108481,6 +119086,9 @@ func (*VpcV1) NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBar Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108497,6 +119105,7 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMe obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) 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)) @@ -108521,6 +119130,9 @@ func (*VpcV1) NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBar ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108537,6 +119149,7 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMe obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) 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)) @@ -108560,6 +119173,9 @@ func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceId Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108576,6 +119192,7 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdent obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) 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)) @@ -108600,6 +119217,9 @@ func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceId ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108616,6 +119236,7 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdent obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) 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)) @@ -108635,6 +119256,9 @@ func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetw CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108651,6 +119275,7 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetwork obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) 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)) @@ -108670,6 +119295,9 @@ func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetw Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108686,6 +119314,7 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetwork obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) 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)) @@ -108705,6 +119334,9 @@ func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetw ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108721,6 +119353,7 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetwork obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) 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)) @@ -108744,6 +119377,9 @@ func (*VpcV1) NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentit Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108760,6 +119396,7 @@ func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBa obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) 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)) @@ -108784,6 +119421,9 @@ func (*VpcV1) NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentit ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108800,6 +119440,7 @@ func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBa obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) 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)) @@ -108823,6 +119464,9 @@ func (*VpcV1) NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfa Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108839,6 +119483,7 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceI obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) 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)) @@ -108863,6 +119508,9 @@ func (*VpcV1) NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfa ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108879,6 +119527,7 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceI obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) 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)) @@ -108898,6 +119547,9 @@ func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtual CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108914,6 +119566,7 @@ func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNet obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) 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)) @@ -108933,6 +119586,9 @@ func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtual Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108949,6 +119605,7 @@ func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNet obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) 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)) @@ -108968,6 +119625,9 @@ func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtual ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108984,6 +119644,7 @@ func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNet obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) 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)) @@ -109003,6 +119664,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentity CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109019,6 +119683,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByC obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) 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)) @@ -109038,6 +119703,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentity Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109054,6 +119722,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByH obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) 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)) @@ -109073,6 +119742,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentity ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109089,6 +119761,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByI obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) 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)) @@ -109108,6 +119781,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentit Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109124,6 +119800,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityIn obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) 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)) @@ -109143,6 +119820,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentit ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109159,6 +119839,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityIn obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) 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)) @@ -109182,6 +119863,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkI Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109198,6 +119882,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInte obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) 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)) @@ -109222,6 +119907,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkI ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109238,6 +119926,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInte obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) 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)) @@ -109257,6 +119946,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCR CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109273,6 +119965,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(m obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) 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)) @@ -109292,6 +119985,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHr Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109308,6 +120004,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref( obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) 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)) @@ -109327,6 +120024,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109343,6 +120043,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(m obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) 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)) @@ -109362,6 +120063,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(crn CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109378,6 +120082,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(m map[s obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) 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)) @@ -109397,6 +120102,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(hre Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109413,6 +120121,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(m map[ obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) 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)) @@ -109432,6 +120141,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(id st ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109448,6 +120160,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(m map[st obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) 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)) @@ -109467,6 +120180,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityV CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109483,6 +120199,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirt obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) 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)) @@ -109502,6 +120219,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityV Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109518,6 +120238,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirt obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) 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)) @@ -109537,6 +120258,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityV ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109553,6 +120277,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirt obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) 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)) @@ -109600,18 +120325,22 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronS obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -109658,18 +120387,22 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) if err != nil { + err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -109773,58 +120506,72 @@ func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string] obj := new(InstanceGroupManagerActionScheduledActionGroupTarget) 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_timeout", &obj.AutoDeleteTimeout) if err != nil { + err = core.SDKErrorf(err, "", "auto_delete_timeout-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, "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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) if err != nil { + err = core.SDKErrorf(err, "", "action_type-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.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) if err != nil { + err = core.SDKErrorf(err, "", "last_applied_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) if err != nil { + err = core.SDKErrorf(err, "", "next_run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -109928,58 +120675,72 @@ func UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget(m map[strin obj := new(InstanceGroupManagerActionScheduledActionManagerTarget) 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_timeout", &obj.AutoDeleteTimeout) if err != nil { + err = core.SDKErrorf(err, "", "auto_delete_timeout-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, "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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) if err != nil { + err = core.SDKErrorf(err, "", "action_type-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.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) if err != nil { + err = core.SDKErrorf(err, "", "last_applied_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) if err != nil { + err = core.SDKErrorf(err, "", "next_run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) if err != nil { + err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -110005,6 +120766,9 @@ func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePro Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110021,14 +120785,17 @@ func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScaleProtot obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-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)) @@ -110054,6 +120821,9 @@ func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePro ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110070,14 +120840,17 @@ func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScaleProtot obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } 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)) @@ -110097,6 +120870,9 @@ func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtua CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110113,6 +120889,7 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNe obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) 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)) @@ -110132,6 +120909,9 @@ func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtua Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110148,6 +120928,7 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNe obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) 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)) @@ -110167,6 +120948,9 @@ func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtua ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110183,6 +120967,7 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNe obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) 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)) @@ -110202,6 +120987,9 @@ func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicated CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110218,6 +121006,7 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHos obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) 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)) @@ -110237,6 +121026,9 @@ func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicated Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110253,6 +121045,7 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHos obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) 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)) @@ -110272,6 +121065,9 @@ func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicated ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110288,6 +121084,7 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHos obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) 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)) @@ -110307,6 +121104,9 @@ func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostI CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110323,6 +121123,7 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIden obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) 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)) @@ -110342,6 +121143,9 @@ func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostI Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110358,6 +121162,7 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIden obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) 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)) @@ -110377,6 +121182,9 @@ func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostI ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110393,6 +121201,7 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIden obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) 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)) @@ -110412,6 +121221,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedic CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110428,6 +121240,7 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicate obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) 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)) @@ -110447,6 +121260,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedic Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110463,6 +121279,7 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicate obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) 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)) @@ -110482,6 +121299,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedic ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110498,6 +121318,7 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicate obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) 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)) @@ -110517,6 +121338,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedH CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110533,6 +121357,7 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHost obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) 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)) @@ -110552,6 +121377,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedH Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110568,6 +121396,7 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHost obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) 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)) @@ -110587,6 +121416,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedH ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110603,6 +121435,7 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHost obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) 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)) @@ -110622,6 +121455,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacement CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110638,6 +121474,7 @@ func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGro obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) 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)) @@ -110657,6 +121494,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacement Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110673,6 +121513,7 @@ func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGro obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) 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)) @@ -110692,6 +121533,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacement ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110708,6 +121552,7 @@ func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGro obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) 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)) @@ -110804,6 +121649,9 @@ func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOffe PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110820,74 +121668,92 @@ func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferin obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -110984,6 +121850,9 @@ func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOffe PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111000,74 +121869,92 @@ func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferin obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -111165,6 +122052,9 @@ func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetwor PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111181,74 +122071,92 @@ func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAt obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -111346,6 +122254,9 @@ func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetwor PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111362,74 +122273,92 @@ func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkIn obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -111524,6 +122453,9 @@ func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapsh PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111540,70 +122472,87 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotI obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -111698,6 +122647,9 @@ func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapsh PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111714,70 +122666,87 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotI obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -111872,6 +122841,9 @@ func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetw PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111888,70 +122860,87 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112046,6 +123035,9 @@ func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetw PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112062,70 +123054,87 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112220,6 +123229,9 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInsta PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112236,74 +123248,92 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112398,6 +123428,9 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInsta PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112414,74 +123447,92 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112577,6 +123628,9 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplat PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112593,74 +123647,92 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112756,6 +123828,9 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplat PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112772,74 +123847,92 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112932,6 +124025,9 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstan PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112948,70 +124044,87 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -113104,6 +124217,9 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstan PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -113120,70 +124236,87 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -113295,90 +124428,112 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -113490,90 +124645,112 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -113686,90 +124863,112 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -113882,90 +125081,112 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -114078,90 +125299,112 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -114277,94 +125520,117 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -114384,6 +125650,9 @@ func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLo Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114400,6 +125669,7 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadB obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) 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)) @@ -114419,6 +125689,9 @@ func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLo ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114435,6 +125708,7 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadB obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) 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)) @@ -114454,6 +125728,9 @@ func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdenti Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114470,6 +125747,7 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityL obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) 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)) @@ -114489,6 +125767,9 @@ func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdenti ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114505,6 +125786,7 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityL obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) 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)) @@ -114524,6 +125806,9 @@ func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceId CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114540,6 +125825,7 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdent obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) 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)) @@ -114559,6 +125845,9 @@ func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceId Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114575,6 +125864,7 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdent obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) 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)) @@ -114594,6 +125884,9 @@ func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceId ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114610,6 +125903,7 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdent obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) 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)) @@ -114629,6 +125923,9 @@ func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityByHref(href string Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114645,6 +125942,7 @@ func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByHref(m map[string]j obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityByHref) 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)) @@ -114664,6 +125962,9 @@ func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityByID(id string) (_ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114680,6 +125981,7 @@ func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByID(m map[string]jso obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityByID) 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)) @@ -114699,6 +126001,9 @@ func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIde Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114715,6 +126020,7 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdenti obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -114734,6 +126040,9 @@ func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIde CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114750,6 +126059,7 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdenti obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) 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)) @@ -114769,6 +126079,9 @@ func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIde Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114785,6 +126098,7 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdenti obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) 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)) @@ -114804,6 +126118,9 @@ func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIde ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114820,6 +126137,7 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdenti obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) 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)) @@ -114839,6 +126157,9 @@ func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGateway CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114855,6 +126176,7 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIde obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) 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)) @@ -114874,6 +126196,9 @@ func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGateway Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114890,6 +126215,7 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIde obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) 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)) @@ -114909,6 +126235,9 @@ func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGateway ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114925,6 +126254,7 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIde obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) 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)) @@ -114944,6 +126274,9 @@ func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtual CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114960,6 +126293,7 @@ func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNet obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) 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)) @@ -114979,6 +126313,9 @@ func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtual Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114995,6 +126332,7 @@ func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNet obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) 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)) @@ -115014,6 +126352,9 @@ func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtual ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115030,6 +126371,7 @@ func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNet obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) 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)) @@ -115052,6 +126394,9 @@ func (*VpcV1) NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(address Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115068,6 +126413,7 @@ func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(m map[stri obj := new(RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -115094,6 +126440,9 @@ func (*VpcV1) NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(address Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115110,6 +126459,7 @@ func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(m map[strin obj := new(RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -115129,6 +126479,9 @@ func (*VpcV1) NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnecti Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115145,6 +126498,7 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionI obj := new(RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) 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)) @@ -115164,6 +126518,9 @@ func (*VpcV1) NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnecti ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115180,6 +126537,7 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionI obj := new(RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) 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)) @@ -115202,6 +126560,9 @@ func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNe Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115218,6 +126579,7 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextH obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -115244,6 +126606,9 @@ func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNe Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115260,6 +126625,7 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextH obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -115279,6 +126645,9 @@ func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionI Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115295,6 +126664,7 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIden obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) 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)) @@ -115314,6 +126684,9 @@ func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionI ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115330,6 +126703,7 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIden obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) 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)) @@ -115349,6 +126723,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupI CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115365,6 +126742,7 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIden obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) 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)) @@ -115384,6 +126762,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupI Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115400,6 +126781,7 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIden obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) 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)) @@ -115419,6 +126801,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupI ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115435,6 +126820,7 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIden obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) 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)) @@ -115454,6 +126840,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGr CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115470,6 +126859,7 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroup obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) 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)) @@ -115489,6 +126879,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGr Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115505,6 +126898,7 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroup obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) 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)) @@ -115524,6 +126918,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGr ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115540,6 +126937,7 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroup obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) 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)) @@ -115559,6 +126957,9 @@ func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkI CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115575,6 +126976,7 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) 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)) @@ -115594,6 +126996,9 @@ func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkI Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115610,6 +127015,7 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) 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)) @@ -115629,6 +127035,9 @@ func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkI ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115645,6 +127054,213 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) 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 +} + +// VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct +// This model "extends" VPNGatewayConnectionRouteMode +type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The IKE policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // The IPsec policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The pre-shared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // The reasons for the current VPN gateway connection status (if any): + // - `cannot_authenticate_connection`: Failed to authenticate a connection because of + // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) + // - `internal_error`: Internal error (contact IBM support) + // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check + // the IKE policies on both sides of the VPN) + // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and + // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE + // V1 configuration) + // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE + // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) + // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable + // (check the IPsec policies on both sides of the VPN) + // - `peer_not_responding`: No response from peer (check network ACL configuration, peer + // availability, and on-premise firewall configuration) + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol" validate:"required"` + + // The VPN tunnel configuration for this VPN gateway connection (in static route mode). + Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeModePolicyConst = "policy" + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeStatusDownConst = "down" + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeStatusUpConst = "up" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnectionRouteMode() bool { + return true +} + +func (*VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnection() bool { + return true +} + +// UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode unmarshals an instance of VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + err = core.SDKErrorf(err, "", "authentication_mode-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, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-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, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + err = core.SDKErrorf(err, "", "mode-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, "peer_address", &obj.PeerAddress) + if err != nil { + err = core.SDKErrorf(err, "", "peer_address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + err = core.SDKErrorf(err, "", "psk-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, "status", &obj.Status) + if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) + if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) + if err != nil { + err = core.SDKErrorf(err, "", "tunnels-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -115835,6 +127451,9 @@ func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetw Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115851,6 +127470,7 @@ func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetwork obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) 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)) @@ -115870,6 +127490,9 @@ func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetw ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115886,6 +127509,7 @@ func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetwork obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) 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)) @@ -115905,6 +127529,9 @@ func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirt Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115921,6 +127548,7 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtual obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) 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)) @@ -115940,6 +127568,9 @@ func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirt ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115956,6 +127587,7 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtual obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) 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)) @@ -115975,6 +127607,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCR CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115991,6 +127626,7 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN(m obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) 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)) @@ -116010,6 +127646,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHr Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116026,6 +127665,7 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref( obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) 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)) @@ -116045,6 +127685,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116061,6 +127704,7 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(m obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) 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)) @@ -116106,6 +127750,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVo Capacity: core.Int64Ptr(capacity), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116122,30 +127769,37 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolum obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116194,6 +127848,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVo SourceSnapshot: sourceSnapshot, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116210,34 +127867,42 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolum obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116264,6 +127929,9 @@ func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCr Group: group, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116284,14 +127952,17 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronS obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116318,6 +127989,9 @@ func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCr Manager: manager, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116338,14 +128012,17 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronS obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116371,6 +128048,9 @@ func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRu Group: group, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116391,14 +128071,17 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) if err != nil { + err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116424,6 +128107,9 @@ func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRu Manager: manager, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116444,14 +128130,17 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) if err != nil { + err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116471,7 +128160,7 @@ type VpcsPager struct { // NewVpcsPager returns a new VpcsPager instance. func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -116499,6 +128188,7 @@ func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err result, _, err := pager.client.ListVpcsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -116507,7 +128197,8 @@ func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -116526,6 +128217,7 @@ func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, var nextPage []VPC nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -116535,12 +128227,16 @@ func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VpcsPager) GetNext() (page []VPC, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VpcsPager) GetAll() (allItems []VPC, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPCAddressPrefixesPager can be used to simplify the use of the "ListVPCAddressPrefixes" method. @@ -116556,7 +128252,7 @@ type VPCAddressPrefixesPager struct { // NewVPCAddressPrefixesPager returns a new VPCAddressPrefixesPager instance. func (vpc *VpcV1) NewVPCAddressPrefixesPager(options *ListVPCAddressPrefixesOptions) (pager *VPCAddressPrefixesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -116584,6 +128280,7 @@ func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (p result, _, err := pager.client.ListVPCAddressPrefixesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -116592,7 +128289,8 @@ func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (p var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -116611,6 +128309,7 @@ func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (al var nextPage []AddressPrefix nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -116620,12 +128319,16 @@ func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (al // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPCAddressPrefixesPager) GetNext() (page []AddressPrefix, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPCDnsResolutionBindingsPager can be used to simplify the use of the "ListVPCDnsResolutionBindings" method. @@ -116641,7 +128344,7 @@ type VPCDnsResolutionBindingsPager struct { // NewVPCDnsResolutionBindingsPager returns a new VPCDnsResolutionBindingsPager instance. func (vpc *VpcV1) NewVPCDnsResolutionBindingsPager(options *ListVPCDnsResolutionBindingsOptions) (pager *VPCDnsResolutionBindingsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -116669,6 +128372,7 @@ func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Conte result, _, err := pager.client.ListVPCDnsResolutionBindingsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -116677,7 +128381,8 @@ func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Conte var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -116696,6 +128401,7 @@ func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Contex var nextPage []VpcdnsResolutionBinding nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -116705,12 +128411,16 @@ func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Contex // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPCDnsResolutionBindingsPager) GetNext() (page []VpcdnsResolutionBinding, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPCDnsResolutionBindingsPager) GetAll() (allItems []VpcdnsResolutionBinding, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. @@ -116726,7 +128436,7 @@ type VPCRoutesPager struct { // NewVPCRoutesPager returns a new VPCRoutesPager instance. func (vpc *VpcV1) NewVPCRoutesPager(options *ListVPCRoutesOptions) (pager *VPCRoutesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -116754,6 +128464,7 @@ func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []Rou result, _, err := pager.client.ListVPCRoutesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -116762,7 +128473,8 @@ func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []Rou var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -116781,6 +128493,7 @@ func (pager *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems [] var nextPage []RouteCollectionVPCContextRoutesItem nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -116790,12 +128503,16 @@ 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) { - return pager.GetNextWithContext(context.Background()) + 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) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPCRoutingTablesPager can be used to simplify the use of the "ListVPCRoutingTables" method. @@ -116811,7 +128528,7 @@ type VPCRoutingTablesPager struct { // NewVPCRoutingTablesPager returns a new VPCRoutingTablesPager instance. func (vpc *VpcV1) NewVPCRoutingTablesPager(options *ListVPCRoutingTablesOptions) (pager *VPCRoutingTablesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -116839,6 +128556,7 @@ func (pager *VPCRoutingTablesPager) GetNextWithContext(ctx context.Context) (pag result, _, err := pager.client.ListVPCRoutingTablesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -116847,7 +128565,8 @@ func (pager *VPCRoutingTablesPager) GetNextWithContext(ctx context.Context) (pag var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -116866,6 +128585,7 @@ func (pager *VPCRoutingTablesPager) GetAllWithContext(ctx context.Context) (allI var nextPage []RoutingTable nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -116875,12 +128595,16 @@ func (pager *VPCRoutingTablesPager) GetAllWithContext(ctx context.Context) (allI // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPCRoutingTablesPager) GetNext() (page []RoutingTable, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPCRoutingTablesPager) GetAll() (allItems []RoutingTable, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. @@ -116896,7 +128620,7 @@ type VPCRoutingTableRoutesPager struct { // NewVPCRoutingTableRoutesPager returns a new VPCRoutingTableRoutesPager instance. func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRoutesOptions) (pager *VPCRoutingTableRoutesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -116924,6 +128648,7 @@ func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) result, _, err := pager.client.ListVPCRoutingTableRoutesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -116932,7 +128657,8 @@ func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -116951,6 +128677,7 @@ func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) var nextPage []Route nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -116960,12 +128687,16 @@ func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPCRoutingTableRoutesPager) GetNext() (page []Route, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // SubnetsPager can be used to simplify the use of the "ListSubnets" method. @@ -116981,7 +128712,7 @@ type SubnetsPager struct { // NewSubnetsPager returns a new SubnetsPager instance. func (vpc *VpcV1) NewSubnetsPager(options *ListSubnetsOptions) (pager *SubnetsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117009,6 +128740,7 @@ func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subne result, _, err := pager.client.ListSubnetsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117017,7 +128749,8 @@ func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subne var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117036,6 +128769,7 @@ func (pager *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Su var nextPage []Subnet nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117045,12 +128779,16 @@ func (pager *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Su // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *SubnetsPager) GetNext() (page []Subnet, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *SubnetsPager) GetAll() (allItems []Subnet, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. @@ -117066,7 +128804,7 @@ type SubnetReservedIpsPager struct { // NewSubnetReservedIpsPager returns a new SubnetReservedIpsPager instance. func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOptions) (pager *SubnetReservedIpsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117094,6 +128832,7 @@ func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (pa result, _, err := pager.client.ListSubnetReservedIpsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117102,7 +128841,8 @@ func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (pa var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117121,6 +128861,7 @@ func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (all var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117130,12 +128871,16 @@ func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (all // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *SubnetReservedIpsPager) GetNext() (page []ReservedIP, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // ImagesPager can be used to simplify the use of the "ListImages" method. @@ -117151,7 +128896,7 @@ type ImagesPager struct { // NewImagesPager returns a new ImagesPager instance. func (vpc *VpcV1) NewImagesPager(options *ListImagesOptions) (pager *ImagesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117179,6 +128924,7 @@ func (pager *ImagesPager) GetNextWithContext(ctx context.Context) (page []Image, result, _, err := pager.client.ListImagesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117187,7 +128933,8 @@ func (pager *ImagesPager) GetNextWithContext(ctx context.Context) (page []Image, var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117206,6 +128953,7 @@ func (pager *ImagesPager) GetAllWithContext(ctx context.Context) (allItems []Ima var nextPage []Image nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117215,12 +128963,16 @@ func (pager *ImagesPager) GetAllWithContext(ctx context.Context) (allItems []Ima // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *ImagesPager) GetNext() (page []Image, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *ImagesPager) GetAll() (allItems []Image, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // OperatingSystemsPager can be used to simplify the use of the "ListOperatingSystems" method. @@ -117236,7 +128988,7 @@ type OperatingSystemsPager struct { // NewOperatingSystemsPager returns a new OperatingSystemsPager instance. func (vpc *VpcV1) NewOperatingSystemsPager(options *ListOperatingSystemsOptions) (pager *OperatingSystemsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117264,6 +129016,7 @@ func (pager *OperatingSystemsPager) GetNextWithContext(ctx context.Context) (pag result, _, err := pager.client.ListOperatingSystemsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117272,7 +129025,8 @@ func (pager *OperatingSystemsPager) GetNextWithContext(ctx context.Context) (pag var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117291,6 +129045,7 @@ func (pager *OperatingSystemsPager) GetAllWithContext(ctx context.Context) (allI var nextPage []OperatingSystem nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117300,12 +129055,16 @@ func (pager *OperatingSystemsPager) GetAllWithContext(ctx context.Context) (allI // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *OperatingSystemsPager) GetNext() (page []OperatingSystem, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *OperatingSystemsPager) GetAll() (allItems []OperatingSystem, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // KeysPager can be used to simplify the use of the "ListKeys" method. @@ -117321,7 +129080,7 @@ type KeysPager struct { // NewKeysPager returns a new KeysPager instance. func (vpc *VpcV1) NewKeysPager(options *ListKeysOptions) (pager *KeysPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117349,6 +129108,7 @@ func (pager *KeysPager) GetNextWithContext(ctx context.Context) (page []Key, err result, _, err := pager.client.ListKeysWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117357,7 +129117,8 @@ func (pager *KeysPager) GetNextWithContext(ctx context.Context) (page []Key, err var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117376,6 +129137,7 @@ func (pager *KeysPager) GetAllWithContext(ctx context.Context) (allItems []Key, var nextPage []Key nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117385,12 +129147,16 @@ func (pager *KeysPager) GetAllWithContext(ctx context.Context) (allItems []Key, // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *KeysPager) GetNext() (page []Key, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *KeysPager) GetAll() (allItems []Key, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // InstancesPager can be used to simplify the use of the "ListInstances" method. @@ -117406,7 +129172,7 @@ type InstancesPager struct { // NewInstancesPager returns a new InstancesPager instance. func (vpc *VpcV1) NewInstancesPager(options *ListInstancesOptions) (pager *InstancesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117434,6 +129200,7 @@ func (pager *InstancesPager) GetNextWithContext(ctx context.Context) (page []Ins result, _, err := pager.client.ListInstancesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117442,7 +129209,8 @@ func (pager *InstancesPager) GetNextWithContext(ctx context.Context) (page []Ins var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117461,6 +129229,7 @@ func (pager *InstancesPager) GetAllWithContext(ctx context.Context) (allItems [] var nextPage []Instance nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117470,12 +129239,16 @@ func (pager *InstancesPager) GetAllWithContext(ctx context.Context) (allItems [] // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *InstancesPager) GetNext() (page []Instance, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *InstancesPager) GetAll() (allItems []Instance, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "ListInstanceNetworkInterfaceIps" method. @@ -117491,7 +129264,7 @@ type InstanceNetworkInterfaceIpsPager struct { // NewInstanceNetworkInterfaceIpsPager returns a new InstanceNetworkInterfaceIpsPager instance. func (vpc *VpcV1) NewInstanceNetworkInterfaceIpsPager(options *ListInstanceNetworkInterfaceIpsOptions) (pager *InstanceNetworkInterfaceIpsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117519,6 +129292,7 @@ func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Co result, _, err := pager.client.ListInstanceNetworkInterfaceIpsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117527,7 +129301,8 @@ func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Co var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117546,6 +129321,7 @@ func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Con var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117555,12 +129331,16 @@ func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Con // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *InstanceNetworkInterfaceIpsPager) GetNext() (page []ReservedIP, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. @@ -117576,7 +129356,7 @@ type InstanceGroupsPager struct { // NewInstanceGroupsPager returns a new InstanceGroupsPager instance. func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pager *InstanceGroupsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117604,6 +129384,7 @@ func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page result, _, err := pager.client.ListInstanceGroupsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117612,7 +129393,8 @@ func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117631,6 +129413,7 @@ func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allIte var nextPage []InstanceGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117640,12 +129423,16 @@ func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allIte // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupsPager) GetNext() (page []InstanceGroup, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // InstanceGroupManagersPager can be used to simplify the use of the "ListInstanceGroupManagers" method. @@ -117661,7 +129448,7 @@ type InstanceGroupManagersPager struct { // NewInstanceGroupManagersPager returns a new InstanceGroupManagersPager instance. func (vpc *VpcV1) NewInstanceGroupManagersPager(options *ListInstanceGroupManagersOptions) (pager *InstanceGroupManagersPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117689,6 +129476,7 @@ func (pager *InstanceGroupManagersPager) GetNextWithContext(ctx context.Context) result, _, err := pager.client.ListInstanceGroupManagersWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117697,7 +129485,8 @@ func (pager *InstanceGroupManagersPager) GetNextWithContext(ctx context.Context) var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117716,6 +129505,7 @@ func (pager *InstanceGroupManagersPager) GetAllWithContext(ctx context.Context) var nextPage []InstanceGroupManagerIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117725,12 +129515,16 @@ func (pager *InstanceGroupManagersPager) GetAllWithContext(ctx context.Context) // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupManagersPager) GetNext() (page []InstanceGroupManagerIntf, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManagerIntf, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // InstanceGroupManagerActionsPager can be used to simplify the use of the "ListInstanceGroupManagerActions" method. @@ -117746,7 +129540,7 @@ type InstanceGroupManagerActionsPager struct { // NewInstanceGroupManagerActionsPager returns a new InstanceGroupManagerActionsPager instance. func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroupManagerActionsOptions) (pager *InstanceGroupManagerActionsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117774,6 +129568,7 @@ func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Co result, _, err := pager.client.ListInstanceGroupManagerActionsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117782,7 +129577,8 @@ func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Co var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117801,6 +129597,7 @@ func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Con var nextPage []InstanceGroupManagerActionIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117810,12 +129607,16 @@ func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Con // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupManagerActionsPager) GetNext() (page []InstanceGroupManagerActionIntf, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupManagerActionsPager) GetAll() (allItems []InstanceGroupManagerActionIntf, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // InstanceGroupManagerPoliciesPager can be used to simplify the use of the "ListInstanceGroupManagerPolicies" method. @@ -117831,7 +129632,7 @@ type InstanceGroupManagerPoliciesPager struct { // NewInstanceGroupManagerPoliciesPager returns a new InstanceGroupManagerPoliciesPager instance. func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGroupManagerPoliciesOptions) (pager *InstanceGroupManagerPoliciesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117859,6 +129660,7 @@ func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.C result, _, err := pager.client.ListInstanceGroupManagerPoliciesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117867,7 +129669,8 @@ func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.C var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117886,6 +129689,7 @@ func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Co var nextPage []InstanceGroupManagerPolicyIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117895,12 +129699,16 @@ func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Co // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupManagerPoliciesPager) GetNext() (page []InstanceGroupManagerPolicyIntf, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGroupManagerPolicyIntf, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // InstanceGroupMembershipsPager can be used to simplify the use of the "ListInstanceGroupMemberships" method. @@ -117916,7 +129724,7 @@ type InstanceGroupMembershipsPager struct { // NewInstanceGroupMembershipsPager returns a new InstanceGroupMembershipsPager instance. func (vpc *VpcV1) NewInstanceGroupMembershipsPager(options *ListInstanceGroupMembershipsOptions) (pager *InstanceGroupMembershipsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117944,6 +129752,7 @@ func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Conte result, _, err := pager.client.ListInstanceGroupMembershipsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117952,7 +129761,8 @@ func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Conte var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117971,6 +129781,7 @@ func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Contex var nextPage []InstanceGroupMembership nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117980,12 +129791,16 @@ func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Contex // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupMembershipsPager) GetNext() (page []InstanceGroupMembership, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMembership, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // ReservationsPager can be used to simplify the use of the "ListReservations" method. @@ -118001,7 +129816,7 @@ type ReservationsPager struct { // NewReservationsPager returns a new ReservationsPager instance. func (vpc *VpcV1) NewReservationsPager(options *ListReservationsOptions) (pager *ReservationsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118029,6 +129844,7 @@ func (pager *ReservationsPager) GetNextWithContext(ctx context.Context) (page [] result, _, err := pager.client.ListReservationsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118037,7 +129853,8 @@ func (pager *ReservationsPager) GetNextWithContext(ctx context.Context) (page [] var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118056,6 +129873,7 @@ func (pager *ReservationsPager) GetAllWithContext(ctx context.Context) (allItems var nextPage []Reservation nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118065,12 +129883,16 @@ func (pager *ReservationsPager) GetAllWithContext(ctx context.Context) (allItems // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *ReservationsPager) GetNext() (page []Reservation, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *ReservationsPager) GetAll() (allItems []Reservation, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // DedicatedHostGroupsPager can be used to simplify the use of the "ListDedicatedHostGroups" method. @@ -118086,7 +129908,7 @@ type DedicatedHostGroupsPager struct { // NewDedicatedHostGroupsPager returns a new DedicatedHostGroupsPager instance. func (vpc *VpcV1) NewDedicatedHostGroupsPager(options *ListDedicatedHostGroupsOptions) (pager *DedicatedHostGroupsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118114,6 +129936,7 @@ func (pager *DedicatedHostGroupsPager) GetNextWithContext(ctx context.Context) ( result, _, err := pager.client.ListDedicatedHostGroupsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118122,7 +129945,8 @@ func (pager *DedicatedHostGroupsPager) GetNextWithContext(ctx context.Context) ( var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118141,6 +129965,7 @@ func (pager *DedicatedHostGroupsPager) GetAllWithContext(ctx context.Context) (a var nextPage []DedicatedHostGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118150,12 +129975,16 @@ func (pager *DedicatedHostGroupsPager) GetAllWithContext(ctx context.Context) (a // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *DedicatedHostGroupsPager) GetNext() (page []DedicatedHostGroup, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *DedicatedHostGroupsPager) GetAll() (allItems []DedicatedHostGroup, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // DedicatedHostProfilesPager can be used to simplify the use of the "ListDedicatedHostProfiles" method. @@ -118171,7 +130000,7 @@ type DedicatedHostProfilesPager struct { // NewDedicatedHostProfilesPager returns a new DedicatedHostProfilesPager instance. func (vpc *VpcV1) NewDedicatedHostProfilesPager(options *ListDedicatedHostProfilesOptions) (pager *DedicatedHostProfilesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118199,6 +130028,7 @@ func (pager *DedicatedHostProfilesPager) GetNextWithContext(ctx context.Context) result, _, err := pager.client.ListDedicatedHostProfilesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118207,7 +130037,8 @@ func (pager *DedicatedHostProfilesPager) GetNextWithContext(ctx context.Context) var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118226,6 +130057,7 @@ func (pager *DedicatedHostProfilesPager) GetAllWithContext(ctx context.Context) var nextPage []DedicatedHostProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118235,12 +130067,16 @@ func (pager *DedicatedHostProfilesPager) GetAllWithContext(ctx context.Context) // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *DedicatedHostProfilesPager) GetNext() (page []DedicatedHostProfile, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *DedicatedHostProfilesPager) GetAll() (allItems []DedicatedHostProfile, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // DedicatedHostsPager can be used to simplify the use of the "ListDedicatedHosts" method. @@ -118256,7 +130092,7 @@ type DedicatedHostsPager struct { // NewDedicatedHostsPager returns a new DedicatedHostsPager instance. func (vpc *VpcV1) NewDedicatedHostsPager(options *ListDedicatedHostsOptions) (pager *DedicatedHostsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118284,6 +130120,7 @@ func (pager *DedicatedHostsPager) GetNextWithContext(ctx context.Context) (page result, _, err := pager.client.ListDedicatedHostsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118292,7 +130129,8 @@ func (pager *DedicatedHostsPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118311,6 +130149,7 @@ func (pager *DedicatedHostsPager) GetAllWithContext(ctx context.Context) (allIte var nextPage []DedicatedHost nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118320,12 +130159,20 @@ func (pager *DedicatedHostsPager) GetAllWithContext(ctx context.Context) (allIte // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *DedicatedHostsPager) GetNext() (page []DedicatedHost, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *DedicatedHostsPager) GetAll() (allItems []DedicatedHost, err error) { +<<<<<<< Updated upstream return pager.GetAllWithContext(context.Background()) +======= + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +>>>>>>> Stashed changes } // PlacementGroupsPager can be used to simplify the use of the "ListPlacementGroups" method. @@ -118341,7 +130188,7 @@ type PlacementGroupsPager struct { // NewPlacementGroupsPager returns a new PlacementGroupsPager instance. func (vpc *VpcV1) NewPlacementGroupsPager(options *ListPlacementGroupsOptions) (pager *PlacementGroupsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118369,6 +130216,7 @@ func (pager *PlacementGroupsPager) GetNextWithContext(ctx context.Context) (page result, _, err := pager.client.ListPlacementGroupsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118377,7 +130225,8 @@ func (pager *PlacementGroupsPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118396,6 +130245,7 @@ func (pager *PlacementGroupsPager) GetAllWithContext(ctx context.Context) (allIt var nextPage []PlacementGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118405,12 +130255,16 @@ func (pager *PlacementGroupsPager) GetAllWithContext(ctx context.Context) (allIt // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *PlacementGroupsPager) GetNext() (page []PlacementGroup, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *PlacementGroupsPager) GetAll() (allItems []PlacementGroup, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. @@ -118426,7 +130280,7 @@ type BareMetalServerProfilesPager struct { // NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118454,6 +130308,7 @@ func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Contex result, _, err := pager.client.ListBareMetalServerProfilesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118462,7 +130317,8 @@ func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Contex var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118481,6 +130337,7 @@ func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context var nextPage []BareMetalServerProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118490,12 +130347,16 @@ func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *BareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfile, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. @@ -118511,7 +130372,7 @@ type BareMetalServersPager struct { // NewBareMetalServersPager returns a new BareMetalServersPager instance. func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118539,6 +130400,7 @@ func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (pag result, _, err := pager.client.ListBareMetalServersWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118547,7 +130409,8 @@ func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (pag var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118566,6 +130429,7 @@ func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allI var nextPage []BareMetalServer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118575,12 +130439,16 @@ func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allI // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *BareMetalServersPager) GetNext() (page []BareMetalServer, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. @@ -118596,7 +130464,7 @@ type BareMetalServerNetworkAttachmentsPager struct { // NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118624,6 +130492,7 @@ func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx cont result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118632,7 +130501,8 @@ func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx cont var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118651,6 +130521,7 @@ func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx conte var nextPage []BareMetalServerNetworkAttachmentIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118660,12 +130531,16 @@ func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx conte // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. @@ -118681,7 +130556,7 @@ type BareMetalServerNetworkInterfacesPager struct { // NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118709,6 +130584,7 @@ func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx conte result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118717,7 +130593,8 @@ func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx conte var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118736,6 +130613,7 @@ func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx contex var nextPage []BareMetalServerNetworkInterfaceIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118745,12 +130623,16 @@ func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx contex // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *BareMetalServerNetworkInterfacesPager) GetNext() (page []BareMetalServerNetworkInterfaceIntf, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VolumeProfilesPager can be used to simplify the use of the "ListVolumeProfiles" method. @@ -118766,7 +130648,7 @@ type VolumeProfilesPager struct { // NewVolumeProfilesPager returns a new VolumeProfilesPager instance. func (vpc *VpcV1) NewVolumeProfilesPager(options *ListVolumeProfilesOptions) (pager *VolumeProfilesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118794,6 +130676,7 @@ func (pager *VolumeProfilesPager) GetNextWithContext(ctx context.Context) (page result, _, err := pager.client.ListVolumeProfilesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118802,7 +130685,8 @@ func (pager *VolumeProfilesPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118821,6 +130705,7 @@ func (pager *VolumeProfilesPager) GetAllWithContext(ctx context.Context) (allIte var nextPage []VolumeProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118830,12 +130715,16 @@ func (pager *VolumeProfilesPager) GetAllWithContext(ctx context.Context) (allIte // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VolumeProfilesPager) GetNext() (page []VolumeProfile, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VolumeProfilesPager) GetAll() (allItems []VolumeProfile, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VolumesPager can be used to simplify the use of the "ListVolumes" method. @@ -118851,7 +130740,7 @@ type VolumesPager struct { // NewVolumesPager returns a new VolumesPager instance. func (vpc *VpcV1) NewVolumesPager(options *ListVolumesOptions) (pager *VolumesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118879,6 +130768,7 @@ func (pager *VolumesPager) GetNextWithContext(ctx context.Context) (page []Volum result, _, err := pager.client.ListVolumesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118887,7 +130777,8 @@ func (pager *VolumesPager) GetNextWithContext(ctx context.Context) (page []Volum var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118906,6 +130797,7 @@ func (pager *VolumesPager) GetAllWithContext(ctx context.Context) (allItems []Vo var nextPage []Volume nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118915,12 +130807,16 @@ func (pager *VolumesPager) GetAllWithContext(ctx context.Context) (allItems []Vo // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VolumesPager) GetNext() (page []Volume, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VolumesPager) GetAll() (allItems []Volume, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // SnapshotConsistencyGroupsPager can be used to simplify the use of the "ListSnapshotConsistencyGroups" method. @@ -118936,7 +130832,7 @@ type SnapshotConsistencyGroupsPager struct { // NewSnapshotConsistencyGroupsPager returns a new SnapshotConsistencyGroupsPager instance. func (vpc *VpcV1) NewSnapshotConsistencyGroupsPager(options *ListSnapshotConsistencyGroupsOptions) (pager *SnapshotConsistencyGroupsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118964,6 +130860,7 @@ func (pager *SnapshotConsistencyGroupsPager) GetNextWithContext(ctx context.Cont result, _, err := pager.client.ListSnapshotConsistencyGroupsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118972,7 +130869,8 @@ func (pager *SnapshotConsistencyGroupsPager) GetNextWithContext(ctx context.Cont var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118991,6 +130889,7 @@ func (pager *SnapshotConsistencyGroupsPager) GetAllWithContext(ctx context.Conte var nextPage []SnapshotConsistencyGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119000,12 +130899,16 @@ func (pager *SnapshotConsistencyGroupsPager) GetAllWithContext(ctx context.Conte // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *SnapshotConsistencyGroupsPager) GetNext() (page []SnapshotConsistencyGroup, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *SnapshotConsistencyGroupsPager) GetAll() (allItems []SnapshotConsistencyGroup, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // SnapshotsPager can be used to simplify the use of the "ListSnapshots" method. @@ -119021,7 +130924,7 @@ type SnapshotsPager struct { // NewSnapshotsPager returns a new SnapshotsPager instance. func (vpc *VpcV1) NewSnapshotsPager(options *ListSnapshotsOptions) (pager *SnapshotsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119049,6 +130952,7 @@ func (pager *SnapshotsPager) GetNextWithContext(ctx context.Context) (page []Sna result, _, err := pager.client.ListSnapshotsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119057,7 +130961,8 @@ func (pager *SnapshotsPager) GetNextWithContext(ctx context.Context) (page []Sna var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119076,6 +130981,7 @@ func (pager *SnapshotsPager) GetAllWithContext(ctx context.Context) (allItems [] var nextPage []Snapshot nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119085,12 +130991,16 @@ func (pager *SnapshotsPager) GetAllWithContext(ctx context.Context) (allItems [] // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *SnapshotsPager) GetNext() (page []Snapshot, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *SnapshotsPager) GetAll() (allItems []Snapshot, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // ShareProfilesPager can be used to simplify the use of the "ListShareProfiles" method. @@ -119106,7 +131016,7 @@ type ShareProfilesPager struct { // NewShareProfilesPager returns a new ShareProfilesPager instance. func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (pager *ShareProfilesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119134,6 +131044,7 @@ func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page [ result, _, err := pager.client.ListShareProfilesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119142,7 +131053,8 @@ func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page [ var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119161,6 +131073,7 @@ func (pager *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItem var nextPage []ShareProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119170,12 +131083,16 @@ func (pager *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItem // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *ShareProfilesPager) GetNext() (page []ShareProfile, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *ShareProfilesPager) GetAll() (allItems []ShareProfile, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // SharesPager can be used to simplify the use of the "ListShares" method. @@ -119191,7 +131108,7 @@ type SharesPager struct { // NewSharesPager returns a new SharesPager instance. func (vpc *VpcV1) NewSharesPager(options *ListSharesOptions) (pager *SharesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119219,6 +131136,7 @@ func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, result, _, err := pager.client.ListSharesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119227,7 +131145,8 @@ func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119246,6 +131165,7 @@ func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Sha var nextPage []Share nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119255,12 +131175,16 @@ func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Sha // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *SharesPager) GetNext() (page []Share, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *SharesPager) GetAll() (allItems []Share, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // ShareMountTargetsPager can be used to simplify the use of the "ListShareMountTargets" method. @@ -119276,7 +131200,7 @@ type ShareMountTargetsPager struct { // NewShareMountTargetsPager returns a new ShareMountTargetsPager instance. func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOptions) (pager *ShareMountTargetsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119304,6 +131228,7 @@ func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (pa result, _, err := pager.client.ListShareMountTargetsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119312,7 +131237,8 @@ func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (pa var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119331,6 +131257,7 @@ func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (all var nextPage []ShareMountTarget nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119340,12 +131267,200 @@ func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (all // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *ShareMountTargetsPager) GetNext() (page []ShareMountTarget, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. +type BackupPoliciesPager struct { + hasNext bool + options *ListBackupPoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBackupPoliciesPager returns a new BackupPoliciesPager instance. +func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pager *BackupPoliciesPager, 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 ListBackupPoliciesOptions = *options + pager = &BackupPoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BackupPoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBackupPoliciesWithContext(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.BackupPolicies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyIntf, err error) { + for pager.HasNext() { + var nextPage []BackupPolicyIntf + 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 *BackupPoliciesPager) GetNext() (page []BackupPolicyIntf, 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 *BackupPoliciesPager) GetAll() (allItems []BackupPolicyIntf, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// BackupPolicyJobsPager can be used to simplify the use of the "ListBackupPolicyJobs" method. +type BackupPolicyJobsPager struct { + hasNext bool + options *ListBackupPolicyJobsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBackupPolicyJobsPager returns a new BackupPolicyJobsPager instance. +func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) (pager *BackupPolicyJobsPager, 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 ListBackupPolicyJobsOptions = *options + pager = &BackupPolicyJobsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BackupPolicyJobsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyJob, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBackupPolicyJobsWithContext(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.Jobs + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyJob, err error) { + for pager.HasNext() { + var nextPage []BackupPolicyJob + 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 *BackupPolicyJobsPager) GetNext() (page []BackupPolicyJob, 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 *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. @@ -119531,7 +131646,7 @@ type VirtualNetworkInterfacesPager struct { // NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119559,6 +131674,7 @@ func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Conte result, _, err := pager.client.ListVirtualNetworkInterfacesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119567,7 +131683,8 @@ func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Conte var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119586,6 +131703,7 @@ func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Contex var nextPage []VirtualNetworkInterface nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119595,12 +131713,16 @@ func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Contex // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VirtualNetworkInterfacesPager) GetNext() (page []VirtualNetworkInterface, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "ListNetworkInterfaceFloatingIps" method. @@ -119616,7 +131738,7 @@ type NetworkInterfaceFloatingIpsPager struct { // NewNetworkInterfaceFloatingIpsPager returns a new NetworkInterfaceFloatingIpsPager instance. func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterfaceFloatingIpsOptions) (pager *NetworkInterfaceFloatingIpsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119644,6 +131766,7 @@ func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Co result, _, err := pager.client.ListNetworkInterfaceFloatingIpsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119652,7 +131775,8 @@ func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Co var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119671,6 +131795,7 @@ func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Con var nextPage []FloatingIPReference nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119680,12 +131805,16 @@ func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Con // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *NetworkInterfaceFloatingIpsPager) GetNext() (page []FloatingIPReference, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *NetworkInterfaceFloatingIpsPager) GetAll() (allItems []FloatingIPReference, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "ListVirtualNetworkInterfaceIps" method. @@ -119701,7 +131830,7 @@ type VirtualNetworkInterfaceIpsPager struct { // NewVirtualNetworkInterfaceIpsPager returns a new VirtualNetworkInterfaceIpsPager instance. func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetworkInterfaceIpsOptions) (pager *VirtualNetworkInterfaceIpsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119729,6 +131858,7 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Con result, _, err := pager.client.ListVirtualNetworkInterfaceIpsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119737,7 +131867,8 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Con var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119756,6 +131887,7 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Cont var nextPage []ReservedIPReference nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119765,12 +131897,16 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Cont // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VirtualNetworkInterfaceIpsPager) GetNext() (page []ReservedIPReference, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPReference, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. @@ -119786,7 +131922,7 @@ type PublicGatewaysPager struct { // NewPublicGatewaysPager returns a new PublicGatewaysPager instance. func (vpc *VpcV1) NewPublicGatewaysPager(options *ListPublicGatewaysOptions) (pager *PublicGatewaysPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119814,6 +131950,7 @@ func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page result, _, err := pager.client.ListPublicGatewaysWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119822,7 +131959,8 @@ func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119841,6 +131979,7 @@ func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allIte var nextPage []PublicGateway nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119850,12 +131989,16 @@ func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allIte // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *PublicGatewaysPager) GetNext() (page []PublicGateway, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *PublicGatewaysPager) GetAll() (allItems []PublicGateway, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. @@ -119871,7 +132014,7 @@ type FloatingIpsPager struct { // NewFloatingIpsPager returns a new FloatingIpsPager instance. func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *FloatingIpsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119899,6 +132042,7 @@ func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []F result, _, err := pager.client.ListFloatingIpsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119907,7 +132051,8 @@ func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []F var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119926,6 +132071,7 @@ func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems var nextPage []FloatingIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119935,12 +132081,16 @@ func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *FloatingIpsPager) GetNext() (page []FloatingIP, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. @@ -119956,7 +132106,7 @@ type NetworkAclsPager struct { // NewNetworkAclsPager returns a new NetworkAclsPager instance. func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *NetworkAclsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119984,6 +132134,7 @@ func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []N result, _, err := pager.client.ListNetworkAclsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119992,7 +132143,8 @@ func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []N var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120011,6 +132163,7 @@ func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems var nextPage []NetworkACL nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120020,12 +132173,16 @@ func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *NetworkAclsPager) GetNext() (page []NetworkACL, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // NetworkACLRulesPager can be used to simplify the use of the "ListNetworkACLRules" method. @@ -120041,7 +132198,7 @@ type NetworkACLRulesPager struct { // NewNetworkACLRulesPager returns a new NetworkACLRulesPager instance. func (vpc *VpcV1) NewNetworkACLRulesPager(options *ListNetworkACLRulesOptions) (pager *NetworkACLRulesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120069,6 +132226,7 @@ func (pager *NetworkACLRulesPager) GetNextWithContext(ctx context.Context) (page result, _, err := pager.client.ListNetworkACLRulesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120077,7 +132235,8 @@ func (pager *NetworkACLRulesPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120096,6 +132255,7 @@ func (pager *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allIt var nextPage []NetworkACLRuleItemIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120105,12 +132265,16 @@ func (pager *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allIt // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *NetworkACLRulesPager) GetNext() (page []NetworkACLRuleItemIntf, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. @@ -120126,7 +132290,7 @@ type SecurityGroupsPager struct { // NewSecurityGroupsPager returns a new SecurityGroupsPager instance. func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pager *SecurityGroupsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120154,6 +132318,7 @@ func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page result, _, err := pager.client.ListSecurityGroupsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120162,7 +132327,8 @@ func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120181,6 +132347,7 @@ func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allIte var nextPage []SecurityGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120190,12 +132357,16 @@ func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allIte // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *SecurityGroupsPager) GetNext() (page []SecurityGroup, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // SecurityGroupTargetsPager can be used to simplify the use of the "ListSecurityGroupTargets" method. @@ -120211,7 +132382,7 @@ type SecurityGroupTargetsPager struct { // NewSecurityGroupTargetsPager returns a new SecurityGroupTargetsPager instance. func (vpc *VpcV1) NewSecurityGroupTargetsPager(options *ListSecurityGroupTargetsOptions) (pager *SecurityGroupTargetsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120239,6 +132410,7 @@ func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) result, _, err := pager.client.ListSecurityGroupTargetsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120247,7 +132419,8 @@ func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120266,6 +132439,7 @@ func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) ( var nextPage []SecurityGroupTargetReferenceIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120275,12 +132449,16 @@ func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) ( // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *SecurityGroupTargetsPager) GetNext() (page []SecurityGroupTargetReferenceIntf, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTargetReferenceIntf, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // IkePoliciesPager can be used to simplify the use of the "ListIkePolicies" method. @@ -120296,7 +132474,7 @@ type IkePoliciesPager struct { // NewIkePoliciesPager returns a new IkePoliciesPager instance. func (vpc *VpcV1) NewIkePoliciesPager(options *ListIkePoliciesOptions) (pager *IkePoliciesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120324,6 +132502,7 @@ func (pager *IkePoliciesPager) GetNextWithContext(ctx context.Context) (page []I result, _, err := pager.client.ListIkePoliciesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120332,7 +132511,8 @@ func (pager *IkePoliciesPager) GetNextWithContext(ctx context.Context) (page []I var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120351,6 +132531,7 @@ func (pager *IkePoliciesPager) GetAllWithContext(ctx context.Context) (allItems var nextPage []IkePolicy nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120360,12 +132541,16 @@ func (pager *IkePoliciesPager) GetAllWithContext(ctx context.Context) (allItems // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *IkePoliciesPager) GetNext() (page []IkePolicy, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *IkePoliciesPager) GetAll() (allItems []IkePolicy, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // IpsecPoliciesPager can be used to simplify the use of the "ListIpsecPolicies" method. @@ -120381,7 +132566,7 @@ type IpsecPoliciesPager struct { // NewIpsecPoliciesPager returns a new IpsecPoliciesPager instance. func (vpc *VpcV1) NewIpsecPoliciesPager(options *ListIpsecPoliciesOptions) (pager *IpsecPoliciesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120409,6 +132594,7 @@ func (pager *IpsecPoliciesPager) GetNextWithContext(ctx context.Context) (page [ result, _, err := pager.client.ListIpsecPoliciesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120417,7 +132603,8 @@ func (pager *IpsecPoliciesPager) GetNextWithContext(ctx context.Context) (page [ var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120436,6 +132623,7 @@ func (pager *IpsecPoliciesPager) GetAllWithContext(ctx context.Context) (allItem var nextPage []IPsecPolicy nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120445,12 +132633,16 @@ func (pager *IpsecPoliciesPager) GetAllWithContext(ctx context.Context) (allItem // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *IpsecPoliciesPager) GetNext() (page []IPsecPolicy, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *IpsecPoliciesPager) GetAll() (allItems []IPsecPolicy, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. @@ -120466,7 +132658,7 @@ type VPNGatewaysPager struct { // NewVPNGatewaysPager returns a new VPNGatewaysPager instance. func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *VPNGatewaysPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120494,6 +132686,7 @@ func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []V result, _, err := pager.client.ListVPNGatewaysWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120502,7 +132695,8 @@ func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []V var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120521,6 +132715,7 @@ func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems var nextPage []VPNGatewayIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120530,12 +132725,16 @@ func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPNGatewaysPager) GetNext() (page []VPNGatewayIntf, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPNServersPager can be used to simplify the use of the "ListVPNServers" method. @@ -120551,7 +132750,7 @@ type VPNServersPager struct { // NewVPNServersPager returns a new VPNServersPager instance. func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPNServersPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120579,6 +132778,7 @@ func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VP result, _, err := pager.client.ListVPNServersWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120587,7 +132787,8 @@ func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VP var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120606,6 +132807,7 @@ func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems [ var nextPage []VPNServer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120615,12 +132817,16 @@ func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems [ // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPNServersPager) GetNext() (page []VPNServer, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPNServersPager) GetAll() (allItems []VPNServer, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. @@ -120636,7 +132842,7 @@ type VPNServerClientsPager struct { // NewVPNServerClientsPager returns a new VPNServerClientsPager instance. func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) (pager *VPNServerClientsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120664,6 +132870,7 @@ func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (pag result, _, err := pager.client.ListVPNServerClientsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120672,7 +132879,8 @@ func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (pag var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120691,6 +132899,7 @@ func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allI var nextPage []VPNServerClient nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120700,12 +132909,16 @@ func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allI // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPNServerClientsPager) GetNext() (page []VPNServerClient, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. @@ -120721,7 +132934,7 @@ type VPNServerRoutesPager struct { // NewVPNServerRoutesPager returns a new VPNServerRoutesPager instance. func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) (pager *VPNServerRoutesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120749,6 +132962,7 @@ func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page result, _, err := pager.client.ListVPNServerRoutesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120757,7 +132971,8 @@ func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120776,6 +132991,7 @@ func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allIt var nextPage []VPNServerRoute nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120785,12 +133001,16 @@ func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allIt // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPNServerRoutesPager) GetNext() (page []VPNServerRoute, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // LoadBalancerProfilesPager can be used to simplify the use of the "ListLoadBalancerProfiles" method. @@ -120806,7 +133026,7 @@ type LoadBalancerProfilesPager struct { // NewLoadBalancerProfilesPager returns a new LoadBalancerProfilesPager instance. func (vpc *VpcV1) NewLoadBalancerProfilesPager(options *ListLoadBalancerProfilesOptions) (pager *LoadBalancerProfilesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120834,6 +133054,7 @@ func (pager *LoadBalancerProfilesPager) GetNextWithContext(ctx context.Context) result, _, err := pager.client.ListLoadBalancerProfilesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120842,7 +133063,8 @@ func (pager *LoadBalancerProfilesPager) GetNextWithContext(ctx context.Context) var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120861,6 +133083,7 @@ func (pager *LoadBalancerProfilesPager) GetAllWithContext(ctx context.Context) ( var nextPage []LoadBalancerProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120870,12 +133093,16 @@ func (pager *LoadBalancerProfilesPager) GetAllWithContext(ctx context.Context) ( // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *LoadBalancerProfilesPager) GetNext() (page []LoadBalancerProfile, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *LoadBalancerProfilesPager) GetAll() (allItems []LoadBalancerProfile, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // LoadBalancersPager can be used to simplify the use of the "ListLoadBalancers" method. @@ -120891,7 +133118,7 @@ type LoadBalancersPager struct { // NewLoadBalancersPager returns a new LoadBalancersPager instance. func (vpc *VpcV1) NewLoadBalancersPager(options *ListLoadBalancersOptions) (pager *LoadBalancersPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120919,6 +133146,7 @@ func (pager *LoadBalancersPager) GetNextWithContext(ctx context.Context) (page [ result, _, err := pager.client.ListLoadBalancersWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120927,7 +133155,8 @@ func (pager *LoadBalancersPager) GetNextWithContext(ctx context.Context) (page [ var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120946,6 +133175,7 @@ func (pager *LoadBalancersPager) GetAllWithContext(ctx context.Context) (allItem var nextPage []LoadBalancer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120955,12 +133185,16 @@ func (pager *LoadBalancersPager) GetAllWithContext(ctx context.Context) (allItem // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *LoadBalancersPager) GetNext() (page []LoadBalancer, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *LoadBalancersPager) GetAll() (allItems []LoadBalancer, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // EndpointGatewaysPager can be used to simplify the use of the "ListEndpointGateways" method. @@ -120976,7 +133210,7 @@ type EndpointGatewaysPager struct { // NewEndpointGatewaysPager returns a new EndpointGatewaysPager instance. func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) (pager *EndpointGatewaysPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121004,6 +133238,7 @@ func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (pag result, _, err := pager.client.ListEndpointGatewaysWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -121012,7 +133247,8 @@ func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (pag var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121031,6 +133267,7 @@ func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allI var nextPage []EndpointGateway nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121040,12 +133277,16 @@ func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allI // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *EndpointGatewaysPager) GetNext() (page []EndpointGateway, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // EndpointGatewayIpsPager can be used to simplify the use of the "ListEndpointGatewayIps" method. @@ -121061,7 +133302,7 @@ type EndpointGatewayIpsPager struct { // NewEndpointGatewayIpsPager returns a new EndpointGatewayIpsPager instance. func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOptions) (pager *EndpointGatewayIpsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121089,6 +133330,7 @@ func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (p result, _, err := pager.client.ListEndpointGatewayIpsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -121097,7 +133339,8 @@ func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (p var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121116,6 +133359,7 @@ func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (al var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121125,12 +133369,16 @@ func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (al // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *EndpointGatewayIpsPager) GetNext() (page []ReservedIP, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // FlowLogCollectorsPager can be used to simplify the use of the "ListFlowLogCollectors" method. @@ -121146,7 +133394,7 @@ type FlowLogCollectorsPager struct { // NewFlowLogCollectorsPager returns a new FlowLogCollectorsPager instance. func (vpc *VpcV1) NewFlowLogCollectorsPager(options *ListFlowLogCollectorsOptions) (pager *FlowLogCollectorsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121174,6 +133422,7 @@ func (pager *FlowLogCollectorsPager) GetNextWithContext(ctx context.Context) (pa result, _, err := pager.client.ListFlowLogCollectorsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -121182,7 +133431,8 @@ func (pager *FlowLogCollectorsPager) GetNextWithContext(ctx context.Context) (pa var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121201,6 +133451,7 @@ func (pager *FlowLogCollectorsPager) GetAllWithContext(ctx context.Context) (all var nextPage []FlowLogCollector nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121210,10 +133461,14 @@ func (pager *FlowLogCollectorsPager) GetAllWithContext(ctx context.Context) (all // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *FlowLogCollectorsPager) GetNext() (page []FlowLogCollector, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *FlowLogCollectorsPager) GetAll() (allItems []FlowLogCollector, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } diff --git a/go.sum b/go.sum index d9240b0d18..736584df38 100644 --- a/go.sum +++ b/go.sum @@ -141,7 +141,7 @@ github.com/IBM/go-sdk-core/v5 v5.7.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= -github.com/IBM/go-sdk-core/v5 v5.14.1/go.mod h1:MUvIr/1mgGh198ZXL+ByKz9Qs1JoEh80v/96x8jPXNY= +github.com/IBM/go-sdk-core/v5 v5.16.0/go.mod h1:tE4F9jLVspuWeXWwGHtAOfV6uRI8phe6x4DTsLrf2nc= github.com/IBM/go-sdk-core/v5 v5.16.1 h1:vAgOxRvaXD5AmgwR7dlstjT1JFE4BA4lPcGsEFZOKGs= github.com/IBM/go-sdk-core/v5 v5.16.1/go.mod h1:aojBkkq4HXkOYdn7YZ6ve8cjPWHdcB3tt8v0b9Cbac8= github.com/IBM/ibm-cos-sdk-go v1.10.1 h1:vQCsu61OHRVF2lL6ah+m3AmUlhnYGkI1qogukCEFULs= @@ -1529,8 +1529,10 @@ github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= @@ -1638,6 +1640,7 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1908,6 +1911,7 @@ golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -1924,6 +1928,7 @@ golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= From 963e68e28558159ab6895060ba4272b0ec66f9aa Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Mon, 1 Apr 2024 10:16:04 +0530 Subject: [PATCH 070/103] sdk update --- .../IBM/vpc-go-sdk/common/headers.go | 4 + common/github.com/IBM/vpc-go-sdk/go.mod | 11 +- common/github.com/IBM/vpc-go-sdk/go.sum | 251 +- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 20465 ++++++++++++---- go.mod | 2 +- go.sum | 15 +- 6 files changed, 16163 insertions(+), 4585 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers.go b/common/github.com/IBM/vpc-go-sdk/common/headers.go index 87cc2bfcd9..77e444c63d 100644 --- a/common/github.com/IBM/vpc-go-sdk/common/headers.go +++ b/common/github.com/IBM/vpc-go-sdk/common/headers.go @@ -4,6 +4,7 @@ import ( "fmt" "runtime" + "github.com/IBM/go-sdk-core/v5/core" "github.com/google/uuid" ) @@ -65,3 +66,6 @@ var systemInfo = fmt.Sprintf("(arch=%s; os=%s; go.version=%s)", runtime.GOARCH, func GetSystemInfo() string { return systemInfo } +func GetComponentInfo() *core.ProblemComponent { + return core.NewProblemComponent("github.com/IBM/vpc-go-sdk", Version) +} diff --git a/common/github.com/IBM/vpc-go-sdk/go.mod b/common/github.com/IBM/vpc-go-sdk/go.mod index 466fa3d20e..bfa516c360 100644 --- a/common/github.com/IBM/vpc-go-sdk/go.mod +++ b/common/github.com/IBM/vpc-go-sdk/go.mod @@ -3,15 +3,14 @@ module github.com/IBM/vpc-go-sdk go 1.16 require ( - github.com/IBM/go-sdk-core/v5 v5.12.1 - github.com/go-openapi/strfmt v0.21.3 - github.com/onsi/ginkgo v1.16.5 - github.com/onsi/gomega v1.20.0 - github.com/stretchr/testify v1.8.0 + github.com/IBM/go-sdk-core/v5 v5.16.2 + github.com/go-openapi/strfmt v0.22.1 + github.com/google/uuid v1.6.0 + github.com/stretchr/testify v1.8.4 ) retract ( v1.0.2 v1.0.1 v1.0.0 -) \ No newline at end of file +) diff --git a/common/github.com/IBM/vpc-go-sdk/go.sum b/common/github.com/IBM/vpc-go-sdk/go.sum index 88c822dd8e..2c486abdb2 100644 --- a/common/github.com/IBM/vpc-go-sdk/go.sum +++ b/common/github.com/IBM/vpc-go-sdk/go.sum @@ -1,143 +1,268 @@ -github.com/IBM/go-sdk-core/v5 v5.9.1 h1:06pXbD9Rgmqqe2HA5YAeQbB4eYRRFgIoOT+Kh3cp1zo= -github.com/IBM/go-sdk-core/v5 v5.9.1/go.mod h1:axE2JrRq79gIJTjKPBwV6gWHswvVptBjbcvvCPIxARM= -github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= -github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/IBM/go-sdk-core/v5 v5.16.2 h1:4psKDqjN6mPacgbaRjV/qcYtXlnAEISLJF/QQa7FQqo= +github.com/IBM/go-sdk-core/v5 v5.16.2/go.mod h1:aojBkkq4HXkOYdn7YZ6ve8cjPWHdcB3tt8v0b9Cbac8= +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/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 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/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/go-openapi/errors v0.19.8 h1:doM+tQdZbUm9gydV9yR+iQNmztbjj7I3sW4sIcAwIzc= -github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/strfmt v0.21.1 h1:G6s2t5V5kGCHLVbSdZ/6lI8Wm4OzoPFkc3/cjAsKQrM= -github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= +github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +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= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.18.0 h1:BvolUXjp4zuvkZ5YN5t7ebzbhlUtPsPm2S9NAZ5nl9U= +github.com/go-playground/validator/v10 v10.18.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/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= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= 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.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +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 v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4= -github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= +github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 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.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= -github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +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/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/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 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= 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= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M= -github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +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.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= +github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= +github.com/onsi/ginkgo/v2 v2.3.0/go.mod h1:Eew0uilEqZmIEZr8JrvYlvOM7Rr6xzTmMV8AyFNU9d0= +github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo= +github.com/onsi/ginkgo/v2 v2.5.0/go.mod h1:Luc4sArBICYCS8THh8v3i3i5CuSZO+RaQRaJoeNwomw= +github.com/onsi/ginkgo/v2 v2.7.0/go.mod h1:yjiuMwPokqY1XauOgju45q3sJt6VzQ/Fict1LFVcsAo= +github.com/onsi/ginkgo/v2 v2.8.1/go.mod h1:N1/NbDngAFcSLdyZ+/aYTYGSlq9qMCS/cNKGJjy+csc= +github.com/onsi/ginkgo/v2 v2.9.0/go.mod h1:4xkjoL/tZv4SMWeww56BU5kAt19mVB47gTWxmrTcxyk= +github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo= +github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= 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.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ= -github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= +github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= +github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= +github.com/onsi/gomega v1.24.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= +github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM= +github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= +github.com/onsi/gomega v1.27.1/go.mod h1:aHX5xOykVYzWOV4WqQy0sy8BQptgukenXpCXfadcIAw= +github.com/onsi/gomega v1.27.3/go.mod h1:5vG284IBtfDAmDyrK+eGyZmUgUlmi+Wngqo557cZ6Gw= +github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= +github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= +github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= -github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= -github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= -go.mongodb.org/mongo-driver v1.7.5 h1:ny3p0reEpgsR2cfA5cjgwFZg3Cv/ofFh/8jbhGtz9VI= -go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= +go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= +golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= +golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +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.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= +golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +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= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +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-20180628173108-788fd7840127/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/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v9 v9.31.0 h1:bmXmP2RSNtFES+bn4uYuHT7iJFJv7Vj+an+ZQdDaD1M= -gopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= 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= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo= -gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 613efa4920..cd780f0bb4 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.85.0-75c38f8f-20240206-210220 + * IBM OpenAPI SDK Code Generator Version: 3.87.0-91c7c775-20240320-213027 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -35,10 +35,6 @@ import ( "github.com/go-openapi/strfmt" ) -const ( - YYYYMMDD = "2006-01-02" -) - // 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. // @@ -51,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 `2023-12-05` - // and `2024-03-08`. + // and `2024-04-01`. Version *string } @@ -68,7 +64,7 @@ type VpcV1Options struct { Authenticator core.Authenticator // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2024-03-08`. + // and `2024-04-01`. Version *string } @@ -81,22 +77,26 @@ func NewVpcV1UsingExternalConfig(options *VpcV1Options) (vpc *VpcV1, err error) if options.Authenticator == nil { options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) if err != nil { + err = core.SDKErrorf(err, "", "env-auth-error", common.GetComponentInfo()) return } } vpc, err = NewVpcV1(options) + err = core.RepurposeSDKProblem(err, "new-client-error") if err != nil { return } err = vpc.Service.ConfigureService(options.ServiceName) if err != nil { + err = core.SDKErrorf(err, "", "client-config-error", common.GetComponentInfo()) return } if options.URL != "" { err = vpc.Service.SetServiceURL(options.URL) + err = core.RepurposeSDKProblem(err, "url-set-error") } return } @@ -110,24 +110,26 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { err = core.ValidateStruct(options, "options") if err != nil { + err = core.SDKErrorf(err, "", "invalid-global-options", common.GetComponentInfo()) return } baseService, err := core.NewBaseService(serviceOptions) if err != nil { + err = core.SDKErrorf(err, "", "new-base-error", common.GetComponentInfo()) return } if options.URL != "" { err = baseService.SetServiceURL(options.URL) if err != nil { + err = core.SDKErrorf(err, "", "set-url-error", common.GetComponentInfo()) return } } - now := time.Now().UTC() if options.Version == nil { - options.Version = core.StringPtr(now.Format(YYYYMMDD)) + options.Version = core.StringPtr("2024-04-01") } service = &VpcV1{ @@ -141,7 +143,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { // GetServiceURLForRegion returns the service URL to be used for the specified region func GetServiceURLForRegion(region string) (string, error) { - return "", fmt.Errorf("service does not support regional URLs") + return "", core.SDKErrorf(nil, "service does not support regional URLs", "no-regional-support", common.GetComponentInfo()) } // Clone makes a copy of "vpc" suitable for processing requests. @@ -156,7 +158,11 @@ func (vpc *VpcV1) Clone() *VpcV1 { // SetServiceURL sets the service URL func (vpc *VpcV1) SetServiceURL(url string) error { - return vpc.Service.SetServiceURL(url) + err := vpc.Service.SetServiceURL(url) + if err != nil { + err = core.SDKErrorf(err, "", "url-set-error", common.GetComponentInfo()) + } + return err } // GetServiceURL returns the service URL @@ -194,13 +200,16 @@ func (vpc *VpcV1) DisableRetries() { // This request creates a new VPC from a VPC prototype object. The prototype object is structured in the same way as a // retrieved VPC, and contains the information necessary to create the new VPC. func (vpc *VpcV1) CreateVPC(createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - return vpc.CreateVPCWithContext(context.Background(), createVPCOptions) + result, response, err = vpc.CreateVPCWithContext(context.Background(), createVPCOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVPCWithContext is an alternate form of the CreateVPC method which supports a Context parameter func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { err = core.ValidateStruct(createVPCOptions, "createVPCOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -209,6 +218,7 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -224,7 +234,6 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -245,22 +254,27 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr } _, 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_vpc", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -273,17 +287,21 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr // This request creates a new prefix from a prefix prototype object. The prototype object is structured in the same way // as a retrieved prefix, and contains the information necessary to create the new prefix. func (vpc *VpcV1) CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - return vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) + result, response, err = vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVPCAddressPrefixWithContext is an alternate form of the CreateVPCAddressPrefix method which supports a Context parameter func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -296,6 +314,7 @@ func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createV builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -311,7 +330,6 @@ func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createV builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -329,22 +347,27 @@ func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createV } _, 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_vpc_address_prefix", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -363,17 +386,21 @@ func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createV // // See [About DNS sharing for VPE gateways](/docs/vpc?topic=vpc-hub-spoke-model) for more information. func (vpc *VpcV1) CreateVPCDnsResolutionBinding(createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - return vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) + result, response, err = vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVPCDnsResolutionBindingWithContext is an alternate form of the CreateVPCDnsResolutionBinding method which supports a Context parameter func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -386,6 +413,7 @@ func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -401,7 +429,6 @@ func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -413,22 +440,27 @@ func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, } _, 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_vpc_dns_resolution_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -443,7 +475,9 @@ func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, // if the new route will cause a loop. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) + result, response, err = vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter @@ -452,10 +486,12 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO core.GetLogger().Warn("A deprecated operation has been invoked: CreateVPCRoute") err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -468,6 +504,7 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -483,7 +520,6 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -510,22 +546,27 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO } _, 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_vpc_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -538,17 +579,21 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO // This request creates a routing table from a routing table prototype object. The prototype object is structured in the // same way as a retrieved routing table, and contains the information necessary to create the new routing table. func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) + result, response, err = vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVPCRoutingTableWithContext is an alternate form of the CreateVPCRoutingTable method which supports a Context parameter func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createVPCRoutingTableOptions, "createVPCRoutingTableOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -561,6 +606,7 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -576,7 +622,6 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -606,22 +651,27 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP } _, 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_vpc_routing_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -634,17 +684,21 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP // This request creates a new VPC route from a VPC route prototype object. The prototype object is structured in the // same way as a retrieved VPC route and contains the information necessary to create the route. func (vpc *VpcV1) CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) + result, response, err = vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVPCRoutingTableRouteWithContext is an alternate form of the CreateVPCRoutingTableRoute method which supports a Context parameter func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -658,6 +712,7 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -673,7 +728,6 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -700,22 +754,27 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre } _, 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_vpc_routing_table_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -735,17 +794,21 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre // All security groups and network ACLs associated with the VPC are automatically deleted. All flow log collectors with // `auto_delete` set to `true` targeting the VPC or any resource in the VPC are automatically deleted. func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) + response, err = vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVPCWithContext is an alternate form of the DeleteVPC method which supports a Context parameter func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVPCOptions, "deleteVPCOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -758,6 +821,7 @@ func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *De builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -774,15 +838,20 @@ func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *De } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -791,17 +860,21 @@ func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *De // This request deletes a prefix. This operation cannot be reversed. The request will fail if any subnets use addresses // from this prefix. func (vpc *VpcV1) DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) + response, err = vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVPCAddressPrefixWithContext is an alternate form of the DeleteVPCAddressPrefix method which supports a Context parameter func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -815,6 +888,7 @@ func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteV builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -828,15 +902,20 @@ func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteV } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc_address_prefix", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -847,17 +926,21 @@ func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteV // For this request to succeed, the VPC specified by the identifier in the URL must not have // `dns.resolver.type` set to `delegated`. func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - return vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) + result, response, err = vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVPCDnsResolutionBindingWithContext is an alternate form of the DeleteVPCDnsResolutionBinding method which supports a Context parameter func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -871,6 +954,7 @@ func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -885,22 +969,25 @@ func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc_dns_resolution_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -913,7 +1000,9 @@ func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, // This request deletes a route. This operation cannot be reversed. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) + response, err = vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter @@ -922,10 +1011,12 @@ func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteO core.GetLogger().Warn("A deprecated operation has been invoked: DeleteVPCRoute") err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -939,6 +1030,7 @@ func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -952,15 +1044,20 @@ func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -969,17 +1066,21 @@ func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteO // This request deletes a routing table. A routing table cannot be deleted if it is associated with any subnets in the // VPC. Additionally, a VPC's default routing table cannot be deleted. This operation cannot be reversed. func (vpc *VpcV1) DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) + response, err = vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVPCRoutingTableWithContext is an alternate form of the DeleteVPCRoutingTable method which supports a Context parameter func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -993,6 +1094,7 @@ func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1009,15 +1111,20 @@ func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVP } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc_routing_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -1026,17 +1133,21 @@ func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVP // This request deletes a VPC route. This operation cannot be reversed. Only VPC routes with an `origin` of `user` are // allowed to be deleted. func (vpc *VpcV1) DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) + response, err = vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVPCRoutingTableRouteWithContext is an alternate form of the DeleteVPCRoutingTableRoute method which supports a Context parameter func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1051,6 +1162,7 @@ func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, del builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1064,15 +1176,20 @@ func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, del } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc_routing_table_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -1080,17 +1197,21 @@ func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, del // GetVPC : Retrieve a VPC // This request retrieves a single VPC specified by the identifier in the URL. func (vpc *VpcV1) GetVPC(getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - return vpc.GetVPCWithContext(context.Background(), getVPCOptions) + result, response, err = vpc.GetVPCWithContext(context.Background(), getVPCOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCWithContext is an alternate form of the GetVPC method which supports a Context parameter func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCOptions, "getVPCOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCOptions, "getVPCOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1103,6 +1224,7 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1117,22 +1239,25 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1144,17 +1269,21 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp // GetVPCAddressPrefix : Retrieve an address prefix // This request retrieves a single prefix specified by the identifier in the URL. func (vpc *VpcV1) GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - return vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) + result, response, err = vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCAddressPrefixWithContext is an alternate form of the GetVPCAddressPrefix method which supports a Context parameter func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1168,6 +1297,7 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1182,22 +1312,25 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc_address_prefix", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1210,17 +1343,21 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr // This request retrieves the default network ACL for the VPC specified by the identifier in the URL. The default // network ACL is applied to any new subnets in the VPC which do not specify a network ACL. func (vpc *VpcV1) GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { - return vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) + result, response, err = vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCDefaultNetworkACLWithContext is an alternate form of the GetVPCDefaultNetworkACL method which supports a Context parameter func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1233,6 +1370,7 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_network_acl`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1247,22 +1385,25 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc_default_network_acl", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultNetworkACL) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1276,17 +1417,21 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC // routing table is associated with any subnets in the VPC which have not been explicitly associated with another // routing table. func (vpc *VpcV1) GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { - return vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) + result, response, err = vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCDefaultRoutingTableWithContext is an alternate form of the GetVPCDefaultRoutingTable method which supports a Context parameter func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1299,6 +1444,7 @@ func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getV builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_routing_table`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1313,22 +1459,25 @@ func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getV builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc_default_routing_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultRoutingTable) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1341,17 +1490,21 @@ func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getV // This request retrieves the default security group for the VPC specified by the identifier in the URL. Resources // created in this VPC that allow a security group to be optionally specified will use this security group by default. func (vpc *VpcV1) GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { - return vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) + result, response, err = vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCDefaultSecurityGroupWithContext is an alternate form of the GetVPCDefaultSecurityGroup method which supports a Context parameter func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1364,6 +1517,7 @@ func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, get builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_security_group`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1378,22 +1532,25 @@ func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, get builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc_default_security_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultSecurityGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1405,17 +1562,21 @@ func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, get // GetVPCDnsResolutionBinding : Retrieve a DNS resolution binding // This request retrieves a single DNS resolution binding specified by the identifier in the URL. func (vpc *VpcV1) GetVPCDnsResolutionBinding(getVPCDnsResolutionBindingOptions *GetVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - return vpc.GetVPCDnsResolutionBindingWithContext(context.Background(), getVPCDnsResolutionBindingOptions) + result, response, err = vpc.GetVPCDnsResolutionBindingWithContext(context.Background(), getVPCDnsResolutionBindingOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCDnsResolutionBindingWithContext is an alternate form of the GetVPCDnsResolutionBinding method which supports a Context parameter func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, getVPCDnsResolutionBindingOptions *GetVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1429,6 +1590,7 @@ func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, get builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1443,22 +1605,25 @@ func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, get builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc_dns_resolution_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1471,7 +1636,9 @@ func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, get // This request retrieves a single route specified by the identifier in the URL. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) + result, response, err = vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter @@ -1480,10 +1647,12 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions core.GetLogger().Warn("A deprecated operation has been invoked: GetVPCRoute") err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1497,6 +1666,7 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1511,22 +1681,25 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1538,17 +1711,21 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions // GetVPCRoutingTable : Retrieve a VPC routing table // This request retrieves a single routing table specified by the identifier in the URL. func (vpc *VpcV1) GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) + result, response, err = vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCRoutingTableWithContext is an alternate form of the GetVPCRoutingTable method which supports a Context parameter func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCRoutingTableOptions, "getVPCRoutingTableOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1562,6 +1739,7 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1576,22 +1754,25 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc_routing_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1603,17 +1784,21 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti // GetVPCRoutingTableRoute : Retrieve a VPC routing table route // This request retrieves a single VPC route specified by the identifier in the URL path. func (vpc *VpcV1) GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) + result, response, err = vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVPCRoutingTableRouteWithContext is an alternate form of the GetVPCRoutingTableRoute method which supports a Context parameter func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1628,6 +1813,7 @@ func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPC builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1642,22 +1828,25 @@ func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPC builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpc_routing_table_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1669,17 +1858,21 @@ func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPC // ListVPCAddressPrefixes : List all address prefixes for a VPC // This request lists all address pool prefixes for a VPC. func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) + result, response, err = vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVPCAddressPrefixesWithContext is an alternate form of the ListVPCAddressPrefixes method which supports a Context parameter func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1692,6 +1885,7 @@ func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPC builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1706,7 +1900,6 @@ func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPC builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPCAddressPrefixesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) @@ -1717,17 +1910,21 @@ func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPC 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_vpc_address_prefixes", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefixCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1754,17 +1951,21 @@ func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPC // The bindings will be sorted by their `created_at` property values, with newest bindings first. Bindings with // identical `created_at` property values will in turn be sorted by ascending `name` property values. func (vpc *VpcV1) ListVPCDnsResolutionBindings(listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) + result, response, err = vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVPCDnsResolutionBindingsWithContext is an alternate form of the ListVPCDnsResolutionBindings method which supports a Context parameter func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1777,6 +1978,7 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1791,7 +1993,6 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPCDnsResolutionBindingsOptions.Sort != nil { builder.AddQuery("sort", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Sort)) @@ -1817,17 +2018,21 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l 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_vpc_dns_resolution_bindings", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBindingCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1842,7 +2047,9 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l // destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { - return vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) + result, response, err = vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter @@ -1851,10 +2058,12 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt core.GetLogger().Warn("A deprecated operation has been invoked: ListVPCRoutes") err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1867,6 +2076,7 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1881,7 +2091,6 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPCRoutesOptions.ZoneName != nil { builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) @@ -1895,17 +2104,21 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt 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_vpc_routes", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollectionVPCContext) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1921,17 +2134,21 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt // highest priority will be used. If two matching routes have the same destination and priority, traffic will be // distributed between them. If no routes match, delivery will be controlled by the system's built-in routes. func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) + result, response, err = vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVPCRoutingTableRoutesWithContext is an alternate form of the ListVPCRoutingTableRoutes method which supports a Context parameter func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -1945,6 +2162,7 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -1959,7 +2177,6 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPCRoutingTableRoutesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) @@ -1970,17 +2187,21 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list 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_vpc_routing_table_routes", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -1995,17 +2216,21 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list // table. If multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, // delivery will be controlled by the system's built-in routes. func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) + result, response, err = vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVPCRoutingTablesWithContext is an alternate form of the ListVPCRoutingTables method which supports a Context parameter func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2018,6 +2243,7 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2032,7 +2258,6 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPCRoutingTablesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) @@ -2046,17 +2271,21 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo 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_vpc_routing_tables", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTableCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2070,13 +2299,16 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo // isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC // can contain resources in multiple zones in a region. func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { - return vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) + result, response, err = vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVpcsWithContext is an alternate form of the ListVpcs method which supports a Context parameter func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listVpcsOptions, "listVpcsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2085,6 +2317,7 @@ func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *List builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2099,7 +2332,6 @@ func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *List builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVpcsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) @@ -2116,17 +2348,21 @@ func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *List 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_vpcs", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPCCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2139,17 +2375,21 @@ func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *List // This request updates a VPC with the information provided in a VPC patch object. The patch object is structured in the // same way as a retrieved VPC and needs to contain only the information to be updated. func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) + result, response, err = vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVPCWithContext is an alternate form of the UpdateVPC method which supports a Context parameter func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateVPCOptions, "updateVPCOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2162,6 +2402,7 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2180,27 +2421,31 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) 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_vpc", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2213,17 +2458,21 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up // This request updates a prefix with the information in a provided prefix patch. The prefix patch object is structured // in the same way as a retrieved prefix and contains only the information to be updated. func (vpc *VpcV1) UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) + result, response, err = vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVPCAddressPrefixWithContext is an alternate form of the UpdateVPCAddressPrefix method which supports a Context parameter func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2237,6 +2486,7 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2252,27 +2502,31 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPCAddressPrefixOptions.AddressPrefixPatch) 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_vpc_address_prefix", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2286,17 +2540,21 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV // DNS resolution binding patch object is structured in the same way as a retrieved DNS resolution binding and contains // only the information to be updated. func (vpc *VpcV1) UpdateVPCDnsResolutionBinding(updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) + result, response, err = vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVPCDnsResolutionBindingWithContext is an alternate form of the UpdateVPCDnsResolutionBinding method which supports a Context parameter func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2310,6 +2568,7 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2325,27 +2584,31 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) 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_vpc_dns_resolution_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2359,7 +2622,9 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, // the same way as a retrieved route and contains only the information to be updated. // Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) + result, response, err = vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter @@ -2368,10 +2633,12 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO core.GetLogger().Warn("A deprecated operation has been invoked: UpdateVPCRoute") err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2385,6 +2652,7 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2400,27 +2668,31 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPCRouteOptions.RoutePatch) 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_vpc_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2433,17 +2705,21 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO // This request updates a routing table with the information in a provided routing table patch. The patch object is // structured in the same way as a retrieved table and contains only the information to be updated. func (vpc *VpcV1) UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) + result, response, err = vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVPCRoutingTableWithContext is an alternate form of the UpdateVPCRoutingTable method which supports a Context parameter func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2457,6 +2733,7 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2475,27 +2752,31 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) 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_vpc_routing_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2509,17 +2790,21 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP // structured in the same way as a retrieved VPC route and needs to contain only the information to be updated. Only VPC // routes with an `origin` of `user` are allowed to be updated. func (vpc *VpcV1) UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - return vpc.UpdateVPCRoutingTableRouteWithContext(context.Background(), updateVPCRoutingTableRouteOptions) + result, response, err = vpc.UpdateVPCRoutingTableRouteWithContext(context.Background(), updateVPCRoutingTableRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVPCRoutingTableRouteWithContext is an alternate form of the UpdateVPCRoutingTableRoute method which supports a Context parameter func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2534,6 +2819,7 @@ func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, upd builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2549,27 +2835,31 @@ func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, upd builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPCRoutingTableRouteOptions.RoutePatch) 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_vpc_routing_table_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2583,17 +2873,21 @@ func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, upd // as a retrieved subnet, and contains the information necessary to create the new subnet. For this request to succeed, // the prototype's CIDR block must not overlap with an existing subnet in the VPC. func (vpc *VpcV1) CreateSubnet(createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - return vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) + result, response, err = vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateSubnetWithContext is an alternate form of the CreateSubnet method which supports a Context parameter func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createSubnetOptions, "createSubnetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2602,6 +2896,7 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2617,27 +2912,31 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createSubnetOptions.SubnetPrototype) 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_subnet", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2650,17 +2949,21 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio // This request reserves an IP address in a subnet. If the provided prototype object includes an `address`, the address // must not already be reserved. func (vpc *VpcV1) CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) + result, response, err = vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateSubnetReservedIPWithContext is an alternate form of the CreateSubnetReservedIP method which supports a Context parameter func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createSubnetReservedIPOptions, "createSubnetReservedIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2673,6 +2976,7 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2688,7 +2992,6 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -2706,22 +3009,27 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS } _, 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_subnet_reserved_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2737,17 +3045,21 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS // gateways, or endpoint gateways. All flow log collectors with `auto_delete` set to `true` targeting the subnet or any // resource in the subnet are automatically deleted. func (vpc *VpcV1) DeleteSubnet(deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSubnetWithContext(context.Background(), deleteSubnetOptions) + response, err = vpc.DeleteSubnetWithContext(context.Background(), deleteSubnetOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteSubnetWithContext is an alternate form of the DeleteSubnet method which supports a Context parameter func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteSubnetOptions, "deleteSubnetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteSubnetOptions, "deleteSubnetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2760,6 +3072,7 @@ func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptio builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2773,15 +3086,20 @@ func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptio } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_subnet", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -2793,17 +3111,21 @@ func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptio // network interface, instance network interface or virtual network interface for which it is the primary IP. A // provider-owned reserved IP is not allowed to be deleted. func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) + response, err = vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteSubnetReservedIPWithContext is an alternate form of the DeleteSubnetReservedIP method which supports a Context parameter func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2817,6 +3139,7 @@ func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteS builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2830,15 +3153,20 @@ func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteS } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_subnet_reserved_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -2846,17 +3174,21 @@ func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteS // GetSubnet : Retrieve a subnet // This request retrieves a single subnet specified by the identifier in the URL. func (vpc *VpcV1) GetSubnet(getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - return vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) + result, response, err = vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetSubnetWithContext is an alternate form of the GetSubnet method which supports a Context parameter func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getSubnetOptions, "getSubnetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2869,6 +3201,7 @@ func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *Ge builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2883,22 +3216,25 @@ func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *Ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_subnet", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -2910,17 +3246,21 @@ func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *Ge // GetSubnetNetworkACL : Retrieve a subnet's attached network ACL // This request retrieves the network ACL attached to the subnet specified by the identifier in the URL. func (vpc *VpcV1) GetSubnetNetworkACL(getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - return vpc.GetSubnetNetworkACLWithContext(context.Background(), getSubnetNetworkACLOptions) + result, response, err = vpc.GetSubnetNetworkACLWithContext(context.Background(), getSubnetNetworkACLOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetSubnetNetworkACLWithContext is an alternate form of the GetSubnetNetworkACL method which supports a Context parameter func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2933,6 +3273,7 @@ func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetN builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -2947,22 +3288,25 @@ func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetN builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_subnet_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 @@ -2974,17 +3318,21 @@ func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetN // GetSubnetPublicGateway : Retrieve a subnet's attached public gateway // This request retrieves the public gateway attached to the subnet specified by the identifier in the URL. func (vpc *VpcV1) GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - return vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) + result, response, err = vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetSubnetPublicGatewayWithContext is an alternate form of the GetSubnetPublicGateway method which supports a Context parameter func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -2997,6 +3345,7 @@ func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubn builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3011,22 +3360,25 @@ func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubn builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_subnet_public_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3038,17 +3390,21 @@ func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubn // GetSubnetReservedIP : Retrieve a reserved IP // This request retrieves a single reserved IP specified by the identifier in the URL. func (vpc *VpcV1) GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) + result, response, err = vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetSubnetReservedIPWithContext is an alternate form of the GetSubnetReservedIP method which supports a Context parameter func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getSubnetReservedIPOptions, "getSubnetReservedIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3062,6 +3418,7 @@ func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetR builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3076,22 +3433,25 @@ func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetR builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_subnet_reserved_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3103,17 +3463,21 @@ func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetR // GetSubnetRoutingTable : Retrieve a subnet's attached routing table // This request retrieves the routing table attached to the subnet specified by the identifier in the URL. func (vpc *VpcV1) GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) + result, response, err = vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetSubnetRoutingTableWithContext is an alternate form of the GetSubnetRoutingTable method which supports a Context parameter func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3126,6 +3490,7 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3140,22 +3505,25 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_subnet_routing_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3168,17 +3536,21 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne // This request lists all reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet // which is not available for use. func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { - return vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) + result, response, err = vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListSubnetReservedIpsWithContext is an alternate form of the ListSubnetReservedIps method which supports a Context parameter func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3191,6 +3563,7 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3205,7 +3578,6 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listSubnetReservedIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) @@ -3231,17 +3603,21 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn 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_subnet_reserved_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3254,13 +3630,16 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn // This request lists all subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block // notation. Each subnet is within a particular zone and cannot span multiple zones or regions. func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { - return vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) + result, response, err = vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListSubnetsWithContext is an alternate form of the ListSubnets method which supports a Context parameter func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listSubnetsOptions, "listSubnetsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3269,6 +3648,7 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3283,7 +3663,6 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listSubnetsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) @@ -3315,17 +3694,21 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions 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_subnets", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnetCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3337,17 +3720,21 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions // ReplaceSubnetNetworkACL : Replace the network ACL for a subnet // This request replaces the existing network ACL for a subnet with the network ACL specified in the request body. func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - return vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) + result, response, err = vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ReplaceSubnetNetworkACLWithContext is an alternate form of the ReplaceSubnetNetworkACL method which supports a Context parameter func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3360,6 +3747,7 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3375,27 +3763,31 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(replaceSubnetNetworkACLOptions.NetworkACLIdentity) 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, "replace_subnet_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 @@ -3410,17 +3802,21 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac // For this request to succeed, the routing table `route_direct_link_ingress`, // `route_internet_ingress`, `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - return vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) + result, response, err = vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ReplaceSubnetRoutingTableWithContext is an alternate form of the ReplaceSubnetRoutingTable method which supports a Context parameter func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3433,6 +3829,7 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3448,27 +3845,31 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(replaceSubnetRoutingTableOptions.RoutingTableIdentity) 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, "replace_subnet_routing_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3481,17 +3882,21 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl // This request attaches the public gateway, specified in the request body, to the subnet specified by the subnet // identifier in the URL. The public gateway must have the same VPC and zone as the subnet. func (vpc *VpcV1) SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - return vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) + result, response, err = vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) + err = core.RepurposeSDKProblem(err, "") + return } // SetSubnetPublicGatewayWithContext is an alternate form of the SetSubnetPublicGateway method which supports a Context parameter func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3504,6 +3909,7 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3519,27 +3925,31 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(setSubnetPublicGatewayOptions.PublicGatewayIdentity) 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, "set_subnet_public_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3551,17 +3961,21 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn // UnsetSubnetPublicGateway : Detach a public gateway from a subnet // This request detaches the public gateway from the subnet specified by the subnet identifier in the URL. func (vpc *VpcV1) UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { - return vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) + response, err = vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UnsetSubnetPublicGatewayWithContext is an alternate form of the UnsetSubnetPublicGateway method which supports a Context parameter func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3574,6 +3988,7 @@ func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unset builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3587,15 +4002,20 @@ func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unset } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "unset_subnet_public_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -3604,17 +4024,21 @@ func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unset // This request updates a subnet with the information in a provided subnet patch. The subnet patch object is structured // in the same way as a retrieved subnet and contains only the information to be updated. func (vpc *VpcV1) UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - return vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) + result, response, err = vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateSubnetWithContext is an alternate form of the UpdateSubnet method which supports a Context parameter func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateSubnetOptions, "updateSubnetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3627,6 +4051,7 @@ func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptio builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3642,27 +4067,31 @@ func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptio builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateSubnetOptions.SubnetPatch) 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_subnet", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3677,17 +4106,21 @@ func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptio // // A provider-owned reserved IP is not allowed to be updated. func (vpc *VpcV1) UpdateSubnetReservedIP(updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.UpdateSubnetReservedIPWithContext(context.Background(), updateSubnetReservedIPOptions) + result, response, err = vpc.UpdateSubnetReservedIPWithContext(context.Background(), updateSubnetReservedIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateSubnetReservedIPWithContext is an alternate form of the UpdateSubnetReservedIP method which supports a Context parameter func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3701,6 +4134,7 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3716,27 +4150,31 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateSubnetReservedIPOptions.ReservedIPPatch) 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_subnet_reserved_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3751,17 +4189,21 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS // a URL to the image file on object storage must be specified. If an image is being created from an existing volume, // that volume must be specified. func (vpc *VpcV1) CreateImage(createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - return vpc.CreateImageWithContext(context.Background(), createImageOptions) + result, response, err = vpc.CreateImageWithContext(context.Background(), createImageOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateImageWithContext is an alternate form of the CreateImage method which supports a Context parameter func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createImageOptions, "createImageOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createImageOptions, "createImageOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3770,6 +4212,7 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3785,27 +4228,31 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createImageOptions.ImagePrototype) 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_image", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3820,17 +4267,21 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions // `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains // the information necessary to create and queue the new image export job. func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - return vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) + result, response, err = vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateImageExportJobWithContext is an alternate form of the CreateImageExportJob method which supports a Context parameter func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createImageExportJobOptions, "createImageExportJobOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createImageExportJobOptions, "createImageExportJobOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3843,6 +4294,7 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3858,7 +4310,6 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -3873,22 +4324,27 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma } _, 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_image_export_job", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -3904,17 +4360,21 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma // - has a `status` of `pending` with a `status_reasons` code of `image_request_in_progress` // - has `catalog_offering.managed` set to `true`. func (vpc *VpcV1) DeleteImage(deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteImageWithContext(context.Background(), deleteImageOptions) + response, err = vpc.DeleteImageWithContext(context.Background(), deleteImageOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteImageWithContext is an alternate form of the DeleteImage method which supports a Context parameter func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteImageOptions, "deleteImageOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteImageOptions, "deleteImageOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3927,6 +4387,7 @@ func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3940,15 +4401,20 @@ func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_image", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -3958,17 +4424,21 @@ func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions // will be canceled, and the incomplete exported image object deleted. If the job has completed, the exported image // object will not be deleted. func (vpc *VpcV1) DeleteImageExportJob(deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) + response, err = vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteImageExportJobWithContext is an alternate form of the DeleteImageExportJob method which supports a Context parameter func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteImageExportJobOptions, "deleteImageExportJobOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteImageExportJobOptions, "deleteImageExportJobOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -3982,6 +4452,7 @@ func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteIma builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -3995,15 +4466,20 @@ func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteIma } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_image_export_job", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -4022,17 +4498,21 @@ func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteIma // // A system-provided image is not allowed to be deprecated. func (vpc *VpcV1) DeprecateImage(deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { - return vpc.DeprecateImageWithContext(context.Background(), deprecateImageOptions) + response, err = vpc.DeprecateImageWithContext(context.Background(), deprecateImageOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeprecateImageWithContext is an alternate form of the DeprecateImage method which supports a Context parameter func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deprecateImageOptions, "deprecateImageOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deprecateImageOptions, "deprecateImageOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4045,6 +4525,7 @@ func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/deprecate`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4058,15 +4539,20 @@ func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "deprecate_image", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -4074,17 +4560,21 @@ func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageO // GetImage : Retrieve an image // This request retrieves a single image specified by the identifier in the URL. func (vpc *VpcV1) GetImage(getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { - return vpc.GetImageWithContext(context.Background(), getImageOptions) + result, response, err = vpc.GetImageWithContext(context.Background(), getImageOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetImageWithContext is an alternate form of the GetImage method which supports a Context parameter func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getImageOptions, "getImageOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getImageOptions, "getImageOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4097,6 +4587,7 @@ func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetI builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4111,22 +4602,25 @@ func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetI builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_image", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4138,17 +4632,21 @@ func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetI // GetImageExportJob : Retrieve an image export job // This request retrieves a single image export job specified by the identifier in the URL. func (vpc *VpcV1) GetImageExportJob(getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - return vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) + result, response, err = vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetImageExportJobWithContext is an alternate form of the GetImageExportJob method which supports a Context parameter func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getImageExportJobOptions, "getImageExportJobOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getImageExportJobOptions, "getImageExportJobOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4162,6 +4660,7 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4176,22 +4675,25 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_image_export_job", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4203,17 +4705,21 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo // GetOperatingSystem : Retrieve an operating system // This request retrieves a single operating system specified by the name in the URL. func (vpc *VpcV1) GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { - return vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) + result, response, err = vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetOperatingSystemWithContext is an alternate form of the GetOperatingSystem method which supports a Context parameter func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getOperatingSystemOptions, "getOperatingSystemOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4226,6 +4732,7 @@ func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatin builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4240,22 +4747,25 @@ func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatin builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_operating_system", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystem) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4272,17 +4782,21 @@ func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatin // `created_at` property values will in turn be sorted by ascending // `name` property values. func (vpc *VpcV1) ListImageExportJobs(listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListImageExportJobsWithContext(context.Background(), listImageExportJobsOptions) + result, response, err = vpc.ListImageExportJobsWithContext(context.Background(), listImageExportJobsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListImageExportJobsWithContext is an alternate form of the ListImageExportJobs method which supports a Context parameter func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listImageExportJobsOptions, "listImageExportJobsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listImageExportJobsOptions, "listImageExportJobsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4295,6 +4809,7 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4309,7 +4824,6 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listImageExportJobsOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listImageExportJobsOptions.Name)) @@ -4317,17 +4831,21 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE 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_image_export_jobs", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJobUnpaginatedCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4340,13 +4858,16 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE // This request lists all images available in the region. An image provides source data for a volume. Images are either // system-provided, or created from another source, such as importing from Cloud Object Storage. func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { - return vpc.ListImagesWithContext(context.Background(), listImagesOptions) + result, response, err = vpc.ListImagesWithContext(context.Background(), listImagesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListImagesWithContext is an alternate form of the ListImages method which supports a Context parameter func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listImagesOptions, "listImagesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4355,6 +4876,7 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4369,7 +4891,6 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listImagesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) @@ -4392,17 +4913,21 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * 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_images", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4414,13 +4939,16 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * // ListOperatingSystems : List all operating systems // This request lists all operating systems in the region. func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { - return vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) + result, response, err = vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListOperatingSystemsWithContext is an alternate form of the ListOperatingSystems method which supports a Context parameter func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listOperatingSystemsOptions, "listOperatingSystemsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4429,6 +4957,7 @@ func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOpera builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4443,7 +4972,6 @@ func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOpera builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listOperatingSystemsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) @@ -4454,17 +4982,21 @@ func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOpera 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_operating_systems", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystemCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4485,17 +5017,21 @@ func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOpera // // A system-provided image is not allowed to be obsoleted. func (vpc *VpcV1) ObsoleteImage(obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { - return vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) + response, err = vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ObsoleteImageWithContext is an alternate form of the ObsoleteImage method which supports a Context parameter func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(obsoleteImageOptions, "obsoleteImageOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(obsoleteImageOptions, "obsoleteImageOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4508,6 +5044,7 @@ func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/obsolete`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4521,15 +5058,20 @@ func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOpt } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "obsolete_image", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -4539,17 +5081,21 @@ func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOpt // the same way as a retrieved image and contains only the information to be updated. A system-provided image is not // allowed to be updated. An image with a `status` of `deleting` cannot be updated. func (vpc *VpcV1) UpdateImage(updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - return vpc.UpdateImageWithContext(context.Background(), updateImageOptions) + result, response, err = vpc.UpdateImageWithContext(context.Background(), updateImageOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateImageWithContext is an alternate form of the UpdateImage method which supports a Context parameter func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateImageOptions, "updateImageOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateImageOptions, "updateImageOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4562,6 +5108,7 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4577,27 +5124,31 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateImageOptions.ImagePatch) 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_image", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4611,17 +5162,21 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions // job patch object is structured in the same way as a retrieved image export job and contains only the information to // be updated. func (vpc *VpcV1) UpdateImageExportJob(updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - return vpc.UpdateImageExportJobWithContext(context.Background(), updateImageExportJobOptions) + result, response, err = vpc.UpdateImageExportJobWithContext(context.Background(), updateImageExportJobOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateImageExportJobWithContext is an alternate form of the UpdateImageExportJob method which supports a Context parameter func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateImageExportJobOptions, "updateImageExportJobOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateImageExportJobOptions, "updateImageExportJobOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4635,6 +5190,7 @@ func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateIma builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4650,27 +5206,31 @@ func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateIma builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateImageExportJobOptions.ImageExportJobPatch) 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_image_export_job", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4684,17 +5244,21 @@ func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateIma // as a retrieved key, and contains the information necessary to create the new key. The public key value must be // provided. func (vpc *VpcV1) CreateKey(createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - return vpc.CreateKeyWithContext(context.Background(), createKeyOptions) + result, response, err = vpc.CreateKeyWithContext(context.Background(), createKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateKeyWithContext is an alternate form of the CreateKey method which supports a Context parameter func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createKeyOptions, "createKeyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createKeyOptions, "createKeyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4703,6 +5267,7 @@ func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *Cr builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4718,7 +5283,6 @@ func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *Cr builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -4736,22 +5300,27 @@ func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *Cr } _, 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_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4763,17 +5332,21 @@ func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *Cr // DeleteKey : Delete a key // This request deletes a key. This operation cannot be reversed. func (vpc *VpcV1) DeleteKey(deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteKeyWithContext(context.Background(), deleteKeyOptions) + response, err = vpc.DeleteKeyWithContext(context.Background(), deleteKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteKeyWithContext is an alternate form of the DeleteKey method which supports a Context parameter func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteKeyOptions, "deleteKeyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteKeyOptions, "deleteKeyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4786,6 +5359,7 @@ func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *De builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4799,15 +5373,20 @@ func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *De } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -4815,17 +5394,21 @@ func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *De // GetKey : Retrieve a key // This request retrieves a single key specified by the identifier in the URL. func (vpc *VpcV1) GetKey(getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - return vpc.GetKeyWithContext(context.Background(), getKeyOptions) + result, response, err = vpc.GetKeyWithContext(context.Background(), getKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetKeyWithContext is an alternate form of the GetKey method which supports a Context parameter func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getKeyOptions, "getKeyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getKeyOptions, "getKeyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4838,6 +5421,7 @@ func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOp builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4852,22 +5436,25 @@ func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOp builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4880,13 +5467,16 @@ func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOp // This request lists all keys in the region. A key contains a public SSH key which may be installed on instances when // they are created. Private keys are not stored. func (vpc *VpcV1) ListKeys(listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { - return vpc.ListKeysWithContext(context.Background(), listKeysOptions) + result, response, err = vpc.ListKeysWithContext(context.Background(), listKeysOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListKeysWithContext is an alternate form of the ListKeys method which supports a Context parameter func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listKeysOptions, "listKeysOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4895,6 +5485,7 @@ func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *List builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4909,7 +5500,6 @@ func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *List builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listKeysOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listKeysOptions.Start)) @@ -4920,17 +5510,21 @@ func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *List 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_keys", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKeyCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -4942,17 +5536,21 @@ func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *List // UpdateKey : Update a key // This request updates a key's name. func (vpc *VpcV1) UpdateKey(updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - return vpc.UpdateKeyWithContext(context.Background(), updateKeyOptions) + result, response, err = vpc.UpdateKeyWithContext(context.Background(), updateKeyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateKeyWithContext is an alternate form of the UpdateKey method which supports a Context parameter func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateKeyOptions, "updateKeyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateKeyOptions, "updateKeyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -4965,6 +5563,7 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -4980,27 +5579,31 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateKeyOptions.KeyPatch) 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_key", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5019,17 +5622,21 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up // // A request body is not required, and if provided, is ignored. func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) + result, response, err = vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // AddInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the AddInstanceNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5044,6 +5651,7 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5058,22 +5666,25 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "add_instance_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5087,17 +5698,21 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C // same way as a retrieved instance, and contains the information necessary to provision the new instance. The instance // is automatically started. func (vpc *VpcV1) CreateInstance(createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) + result, response, err = vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceWithContext is an alternate form of the CreateInstance method which supports a Context parameter func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceOptions, "createInstanceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceOptions, "createInstanceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5106,6 +5721,7 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5121,27 +5737,31 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createInstanceOptions.InstancePrototype) 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_instance", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5154,17 +5774,21 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO // This request creates a new action which will be queued up to run as soon as any pending or running actions have // completed. func (vpc *VpcV1) CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) + result, response, err = vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceActionWithContext is an alternate form of the CreateInstanceAction method which supports a Context parameter func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceActionOptions, "createInstanceActionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceActionOptions, "createInstanceActionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5177,6 +5801,7 @@ func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createIns builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/actions`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5192,7 +5817,6 @@ func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createIns builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -5204,22 +5828,27 @@ func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createIns } _, 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_instance_action", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5234,17 +5863,21 @@ func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createIns // request. The access token is only valid for a short period of time, and a maximum of one token is valid for a given // instance at a time. func (vpc *VpcV1) CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) + result, response, err = vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceConsoleAccessTokenWithContext is an alternate form of the CreateInstanceConsoleAccessToken method which supports a Context parameter func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Context, createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5257,6 +5890,7 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/console_access_token`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5272,7 +5906,6 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -5284,22 +5917,27 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex } _, 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_instance_console_access_token", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5313,17 +5951,21 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex // prototype object is structured in the same way as a retrieved instance network attachment, and contains the // information necessary to create the new instance network attachment. func (vpc *VpcV1) CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) + result, response, err = vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceNetworkAttachmentWithContext is an alternate form of the CreateInstanceNetworkAttachment method which supports a Context parameter func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context, createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5336,6 +5978,7 @@ func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5351,7 +5994,6 @@ func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -5363,22 +6005,27 @@ func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context } _, 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_instance_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5397,17 +6044,21 @@ func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context // 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 new network interfaces are not allowed to be created. func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) + result, response, err = vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceNetworkInterfaceWithContext is an alternate form of the CreateInstanceNetworkInterface method which supports a Context parameter func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5420,6 +6071,7 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5435,7 +6087,6 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -5456,22 +6107,27 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, } _, 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_instance_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5487,17 +6143,21 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, // If a `source_template` is specified in the prototype object, its contents are copied into the new template prior to // copying any other properties provided in the prototype object. func (vpc *VpcV1) CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceTemplateWithContext(context.Background(), createInstanceTemplateOptions) + result, response, err = vpc.CreateInstanceTemplateWithContext(context.Background(), createInstanceTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceTemplateWithContext is an alternate form of the CreateInstanceTemplate method which supports a Context parameter func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceTemplateOptions, "createInstanceTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceTemplateOptions, "createInstanceTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5506,6 +6166,7 @@ func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createI builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5521,27 +6182,31 @@ func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createI builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createInstanceTemplateOptions.InstanceTemplatePrototype) 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_instance_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5556,17 +6221,21 @@ func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createI // the same way as a retrieved volume attachment, and contains the information necessary to create the new volume // attachment. func (vpc *VpcV1) CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) + result, response, err = vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceVolumeAttachmentWithContext is an alternate form of the CreateInstanceVolumeAttachment method which supports a Context parameter func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5579,6 +6248,7 @@ func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5594,7 +6264,6 @@ func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -5609,22 +6278,27 @@ func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, } _, 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_instance_volume_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5640,17 +6314,21 @@ func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, // `auto_delete` set to `true` targeting the instance, the instance network attachments, the instance network // interfaces, or the automatically deleted virtual network interfaces are automatically deleted. func (vpc *VpcV1) DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) + response, err = vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceWithContext is an alternate form of the DeleteInstance method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceOptions, "deleteInstanceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceOptions, "deleteInstanceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5663,6 +6341,7 @@ func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5679,15 +6358,20 @@ func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_instance", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -5698,17 +6382,21 @@ func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceO // `true` targeting the instance network attachment are automatically deleted. The primary instance network attachment // is not allowed to be deleted. func (vpc *VpcV1) DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) + response, err = vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceNetworkAttachmentWithContext is an alternate form of the DeleteInstanceNetworkAttachment method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context, deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5722,6 +6410,7 @@ func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5735,15 +6424,20 @@ func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_instance_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -5758,17 +6452,21 @@ func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context // 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 is not allowed to be deleted. func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) + response, err = vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5782,6 +6480,7 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5795,15 +6494,20 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_instance_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -5811,17 +6515,21 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, // DeleteInstanceTemplate : Delete an instance template // This request deletes the instance template. This operation cannot be reversed. func (vpc *VpcV1) DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) + response, err = vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceTemplateWithContext is an alternate form of the DeleteInstanceTemplate method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5834,6 +6542,7 @@ func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteI builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5847,15 +6556,20 @@ func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteI } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_instance_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -5864,17 +6578,21 @@ func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteI // This request deletes a volume attachment. This operation cannot be reversed, but a new volume attachment may // subsequently be created for the volume. For this request to succeed, the volume must not be busy. func (vpc *VpcV1) DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) + response, err = vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceVolumeAttachmentWithContext is an alternate form of the DeleteInstanceVolumeAttachment method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5888,6 +6606,7 @@ func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5901,15 +6620,20 @@ func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_instance_volume_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -5917,17 +6641,21 @@ func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, // GetInstance : Retrieve an instance // This request retrieves a single instance specified by the identifier in the URL. func (vpc *VpcV1) GetInstance(getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - return vpc.GetInstanceWithContext(context.Background(), getInstanceOptions) + result, response, err = vpc.GetInstanceWithContext(context.Background(), getInstanceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceWithContext is an alternate form of the GetInstance method which supports a Context parameter func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceOptions, "getInstanceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceOptions, "getInstanceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -5940,6 +6668,7 @@ func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -5954,22 +6683,25 @@ func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -5981,17 +6713,21 @@ func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions // GetInstanceDisk : Retrieve an instance disk // This request retrieves a single instance disk specified by the identifier in the URL. func (vpc *VpcV1) GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - return vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) + result, response, err = vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceDiskWithContext is an alternate form of the GetInstanceDisk method which supports a Context parameter func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceDiskOptions, "getInstanceDiskOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6005,6 +6741,7 @@ func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDis builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6019,22 +6756,25 @@ func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDis builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_disk", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6047,17 +6787,21 @@ func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDis // This request retrieves configuration used to initialize the instance, such as SSH keys and the Windows administrator // password. These can subsequently be changed on the instance and therefore may not be current. func (vpc *VpcV1) GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { - return vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) + result, response, err = vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceInitializationWithContext is an alternate form of the GetInstanceInitialization method which supports a Context parameter func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceInitializationOptions, "getInstanceInitializationOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceInitializationOptions, "getInstanceInitializationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6070,6 +6814,7 @@ func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getI builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}/initialization`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6084,22 +6829,25 @@ func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getI builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_initialization", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceInitialization) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6111,17 +6859,21 @@ func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getI // GetInstanceNetworkAttachment : Retrieve an instance network attachment // This request retrieves a single instance network attachment specified by the identifier in the URL. func (vpc *VpcV1) GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) + result, response, err = vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceNetworkAttachmentWithContext is an alternate form of the GetInstanceNetworkAttachment method which supports a Context parameter func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6135,6 +6887,7 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6149,22 +6902,25 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6180,17 +6936,21 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g // [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. func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) + result, response, err = vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6204,6 +6964,7 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6218,22 +6979,25 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6246,17 +7010,21 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge // This request retrieves a specified floating IP address if it is associated with the instance network interface and // instance specified in the URL. func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) + result, response, err = vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the GetInstanceNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6271,6 +7039,7 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6285,22 +7054,25 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6311,18 +7083,25 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C // GetInstanceNetworkInterfaceIP : Retrieve the primary reserved IP // This request retrieves the primary reserved IP for an instance network interface. +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) + result, response, err = vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceIP") err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6337,6 +7116,7 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6351,22 +7131,25 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_network_interface_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6378,17 +7161,21 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, // GetInstanceProfile : Retrieve an instance profile // This request retrieves a single instance profile specified by the name in the URL. func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { - return vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) + result, response, err = vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceProfileWithContext is an alternate form of the GetInstanceProfile method which supports a Context parameter func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceProfileOptions, "getInstanceProfileOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6401,6 +7188,7 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6415,22 +7203,25 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfile) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6442,17 +7233,21 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance // GetInstanceTemplate : Retrieve an instance template // This request retrieves a single instance template specified by the identifier in the URL. func (vpc *VpcV1) GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) + result, response, err = vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceTemplateWithContext is an alternate form of the GetInstanceTemplate method which supports a Context parameter func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceTemplateOptions, "getInstanceTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6465,6 +7260,7 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6479,22 +7275,25 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6506,17 +7305,21 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc // GetInstanceVolumeAttachment : Retrieve a volume attachment // This request retrieves a single volume attachment specified by the identifier in the URL. func (vpc *VpcV1) GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - return vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) + result, response, err = vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceVolumeAttachmentWithContext is an alternate form of the GetInstanceVolumeAttachment method which supports a Context parameter func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6530,6 +7333,7 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6544,22 +7348,25 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_volume_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6573,17 +7380,21 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge // physical host and is also referred to as instance storage. By default, the listed disks are sorted by their // `created_at` property values, with the newest disk first. func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) + result, response, err = vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceDisksWithContext is an alternate form of the ListInstanceDisks method which supports a Context parameter func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceDisksOptions, "listInstanceDisksOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6596,6 +7407,7 @@ func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstance builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6610,22 +7422,25 @@ func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstance builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_instance_disks", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6642,17 +7457,21 @@ func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstance // Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property // values. func (vpc *VpcV1) ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) + result, response, err = vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceNetworkAttachmentsWithContext is an alternate form of the ListInstanceNetworkAttachments method which supports a Context parameter func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6665,6 +7484,7 @@ func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6679,22 +7499,25 @@ func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_instance_network_attachments", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachmentCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6706,17 +7529,21 @@ func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, // ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with an instance network interface // This request lists all floating IPs associated with an instance network interface. func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) + result, response, err = vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6730,6 +7557,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6744,22 +7572,25 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_instance_network_interface_floating_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6770,18 +7601,25 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context // ListInstanceNetworkInterfaceIps : List the primary reserved IP for an instance network interface // This request lists the primary reserved IP for an instance network interface. +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) + result, response, err = vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceIps") err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6795,6 +7633,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6809,7 +7648,6 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listInstanceNetworkInterfaceIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Start)) @@ -6820,17 +7658,21 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context 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_network_interface_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6849,17 +7691,21 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context // 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. func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) + result, response, err = vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceNetworkInterfacesWithContext is an alternate form of the ListInstanceNetworkInterfaces method which supports a Context parameter func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6872,6 +7718,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6886,22 +7733,25 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_instance_network_interfaces", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceUnpaginatedCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6914,13 +7764,16 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, // This request lists provisionable [instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the // region. An instance profile specifies the performance characteristics and pricing model for an instance. func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) + result, response, err = vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceProfilesWithContext is an alternate form of the ListInstanceProfiles method which supports a Context parameter func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listInstanceProfilesOptions, "listInstanceProfilesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6929,6 +7782,7 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6943,22 +7797,25 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_instance_profiles", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfileCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -6970,13 +7827,16 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta // ListInstanceTemplates : List all instance templates // This request lists all instance templates in the region. func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) + result, response, err = vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceTemplatesWithContext is an alternate form of the ListInstanceTemplates method which supports a Context parameter func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listInstanceTemplatesOptions, "listInstanceTemplatesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -6985,6 +7845,7 @@ func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInst builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -6999,22 +7860,25 @@ func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInst builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_instance_templates", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplateCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7028,17 +7892,21 @@ func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInst // instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one // volume. func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) + result, response, err = vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceVolumeAttachmentsWithContext is an alternate form of the ListInstanceVolumeAttachments method which supports a Context parameter func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7051,6 +7919,7 @@ func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7065,22 +7934,25 @@ func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_instance_volume_attachments", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachmentCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7092,13 +7964,16 @@ func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, // ListInstances : List all instances // This request lists all instances in the region. func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) + result, response, err = vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstancesWithContext is an alternate form of the ListInstances method which supports a Context parameter func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listInstancesOptions, "listInstancesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7107,6 +7982,7 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7121,7 +7997,6 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listInstancesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) @@ -7135,15 +8010,6 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt if listInstancesOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) } - if listInstancesOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) - } - if listInstancesOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) - } - if listInstancesOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) - } if listInstancesOptions.DedicatedHostID != nil { builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) } @@ -7171,20 +8037,33 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt if listInstancesOptions.ReservationName != nil { builder.AddQuery("reservation.name", fmt.Sprint(*listInstancesOptions.ReservationName)) } + if listInstancesOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) + } + if listInstancesOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) + } + if listInstancesOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) + } 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_instances", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7196,17 +8075,21 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt // RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from an instance network interface // This request disassociates the specified floating IP from the specified instance network interface. func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) + response, err = vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // RemoveInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveInstanceNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7221,6 +8104,7 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7234,15 +8118,20 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "remove_instance_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -7251,17 +8140,21 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex // This request updates an instance with the information in a provided instance patch. The instance patch object is // structured in the same way as a retrieved instance and contains only the information to be updated. func (vpc *VpcV1) UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) + result, response, err = vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceWithContext is an alternate form of the UpdateInstance method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceOptions, "updateInstanceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7274,6 +8167,7 @@ func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7292,27 +8186,31 @@ func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) 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", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7324,17 +8222,21 @@ func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceO // UpdateInstanceDisk : Update an instance disk // This request updates the instance disk with the information in a provided patch. func (vpc *VpcV1) UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) + result, response, err = vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceDiskWithContext is an alternate form of the UpdateInstanceDisk method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceDiskOptions, "updateInstanceDiskOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7348,6 +8250,7 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7363,27 +8266,31 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceDiskOptions.InstanceDiskPatch) 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_disk", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7397,17 +8304,21 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta // patch object. The instance network attachment patch object is structured in the same way as a retrieved instance // network attachment and needs to contain only the information to be updated. func (vpc *VpcV1) UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) + result, response, err = vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceNetworkAttachmentWithContext is an alternate form of the UpdateInstanceNetworkAttachment method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context, updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7421,6 +8332,7 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7436,27 +8348,31 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) 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_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7474,17 +8390,21 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context // 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 is not allowed to be updated. func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) + result, response, err = vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceNetworkInterfaceWithContext is an alternate form of the UpdateInstanceNetworkInterface method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7498,6 +8418,7 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7513,27 +8434,31 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) 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_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7547,17 +8472,21 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, // template patch object is structured in the same way as a retrieved instance template and contains only the // information to be updated. func (vpc *VpcV1) UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) + result, response, err = vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceTemplateWithContext is an alternate form of the UpdateInstanceTemplate method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceTemplateOptions, "updateInstanceTemplateOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7570,6 +8499,7 @@ func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateI builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7585,27 +8515,31 @@ func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateI builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceTemplateOptions.InstanceTemplatePatch) 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_template", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7619,17 +8553,21 @@ func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateI // volume attachment patch object is structured in the same way as a retrieved volume attachment and needs to contain // only the information to be updated. func (vpc *VpcV1) UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) + result, response, err = vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceVolumeAttachmentWithContext is an alternate form of the UpdateInstanceVolumeAttachment method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7643,6 +8581,7 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7658,27 +8597,31 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) 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_volume_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7690,17 +8633,21 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, // CreateInstanceGroup : Create an instance group // This request creates a new instance group. func (vpc *VpcV1) CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupWithContext(context.Background(), createInstanceGroupOptions) + result, response, err = vpc.CreateInstanceGroupWithContext(context.Background(), createInstanceGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceGroupWithContext is an alternate form of the CreateInstanceGroup method which supports a Context parameter func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceGroupOptions, "createInstanceGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceGroupOptions, "createInstanceGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7709,6 +8656,7 @@ func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInst builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7724,7 +8672,6 @@ func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInst builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -7754,22 +8701,27 @@ func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInst } _, 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_instance_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7781,17 +8733,21 @@ func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInst // CreateInstanceGroupManager : Create a manager for an instance group // This request creates a new instance group manager. func (vpc *VpcV1) CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) + result, response, err = vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceGroupManagerWithContext is an alternate form of the CreateInstanceGroupManager method which supports a Context parameter func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7804,6 +8760,7 @@ func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, cre builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7819,27 +8776,31 @@ func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, cre builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) 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_instance_group_manager", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7851,17 +8812,21 @@ func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, cre // CreateInstanceGroupManagerAction : Create an instance group manager action // This request creates a new instance group manager action. func (vpc *VpcV1) CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) + result, response, err = vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceGroupManagerActionWithContext is an alternate form of the CreateInstanceGroupManagerAction method which supports a Context parameter func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Context, createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7875,6 +8840,7 @@ func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7890,27 +8856,31 @@ func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) 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_instance_group_manager_action", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7922,17 +8892,21 @@ func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Contex // CreateInstanceGroupManagerPolicy : Create a policy for an instance group manager // This request creates a new instance group manager policy. func (vpc *VpcV1) CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) + result, response, err = vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateInstanceGroupManagerPolicyWithContext is an alternate form of the CreateInstanceGroupManagerPolicy method which supports a Context parameter func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Context, createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -7946,6 +8920,7 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -7961,27 +8936,31 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) 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_instance_group_manager_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -7994,17 +8973,21 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex // This request deletes an instance group. This operation cannot be reversed. Any instances associated with the group // will be deleted. func (vpc *VpcV1) DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupWithContext(context.Background(), deleteInstanceGroupOptions) + response, err = vpc.DeleteInstanceGroupWithContext(context.Background(), deleteInstanceGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceGroupWithContext is an alternate form of the DeleteInstanceGroup method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceGroupOptions, "deleteInstanceGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceGroupOptions, "deleteInstanceGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8017,6 +9000,7 @@ func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInst builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8030,15 +9014,20 @@ func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInst } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_instance_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -8046,17 +9035,21 @@ func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInst // DeleteInstanceGroupLoadBalancer : Delete an instance group load balancer // This request unbinds the instance group from the load balancer pool, and deletes the load balancer pool members. func (vpc *VpcV1) DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) + response, err = vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceGroupLoadBalancerWithContext is an alternate form of the DeleteInstanceGroupLoadBalancer method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context, deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8069,6 +9062,7 @@ func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/load_balancer`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8082,15 +9076,20 @@ func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_instance_group_load_balancer", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -8098,17 +9097,21 @@ func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context // DeleteInstanceGroupManager : Delete an instance group manager // This request deletes an instance group manager. This operation cannot be reversed. func (vpc *VpcV1) DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) + response, err = vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceGroupManagerWithContext is an alternate form of the DeleteInstanceGroupManager method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8122,6 +9125,7 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, del builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8135,15 +9139,20 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, del } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_instance_group_manager", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -8151,17 +9160,21 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, del // DeleteInstanceGroupManagerAction : Delete specified instance group manager action // This request deletes an instance group manager action. This operation cannot be reversed. func (vpc *VpcV1) DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) + response, err = vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceGroupManagerActionWithContext is an alternate form of the DeleteInstanceGroupManagerAction method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Context, deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8176,6 +9189,7 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8189,15 +9203,20 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_instance_group_manager_action", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -8205,17 +9224,21 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Contex // DeleteInstanceGroupManagerPolicy : Delete an instance group manager policy // This request deletes an instance group manager policy. This operation cannot be reversed. func (vpc *VpcV1) DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) + response, err = vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceGroupManagerPolicyWithContext is an alternate form of the DeleteInstanceGroupManagerPolicy method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Context, deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8230,6 +9253,7 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8243,15 +9267,20 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_instance_group_manager_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -8260,17 +9289,21 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Contex // This request deletes a memberships of an instance group. This operation cannot be reversed. reversed. If the // membership has `delete_instance_on_membership_delete` set to `true`, the instance will also be deleted. func (vpc *VpcV1) DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) + response, err = vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceGroupMembershipWithContext is an alternate form of the DeleteInstanceGroupMembership method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8284,6 +9317,7 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8297,15 +9331,20 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_instance_group_membership", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -8314,17 +9353,21 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, // This request deletes all memberships of an instance group. This operation cannot be reversed. reversed. Any // memberships that have `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) + response, err = vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteInstanceGroupMembershipsWithContext is an alternate form of the DeleteInstanceGroupMemberships method which supports a Context parameter func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8337,6 +9380,7 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8350,15 +9394,20 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_instance_group_memberships", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -8366,17 +9415,21 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, // GetInstanceGroup : Retrieve an instance group // This request retrieves a single instance group specified by identifier in the URL. func (vpc *VpcV1) GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) + result, response, err = vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceGroupWithContext is an alternate form of the GetInstanceGroup method which supports a Context parameter func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceGroupOptions, "getInstanceGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceGroupOptions, "getInstanceGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8389,6 +9442,7 @@ func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGr builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8403,22 +9457,25 @@ func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGr builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8430,17 +9487,21 @@ func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGr // GetInstanceGroupManager : Retrieve an instance group manager // This request retrieves a single instance group manager specified by identifier in the URL. func (vpc *VpcV1) GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) + result, response, err = vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceGroupManagerWithContext is an alternate form of the GetInstanceGroupManager method which supports a Context parameter func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8454,6 +9515,7 @@ func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getIns builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8468,22 +9530,25 @@ func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getIns builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_group_manager", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8495,17 +9560,21 @@ func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getIns // GetInstanceGroupManagerAction : Retrieve specified instance group manager action // This request retrieves a single instance group manager action specified by identifier in the URL. func (vpc *VpcV1) GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupManagerActionWithContext(context.Background(), getInstanceGroupManagerActionOptions) + result, response, err = vpc.GetInstanceGroupManagerActionWithContext(context.Background(), getInstanceGroupManagerActionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceGroupManagerActionWithContext is an alternate form of the GetInstanceGroupManagerAction method which supports a Context parameter func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8520,6 +9589,7 @@ func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8534,22 +9604,25 @@ func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_group_manager_action", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8561,17 +9634,21 @@ func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, // GetInstanceGroupManagerPolicy : Retrieve an instance group manager policy // This request retrieves a single instance group manager policy specified by identifier in the URL. func (vpc *VpcV1) GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) + result, response, err = vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceGroupManagerPolicyWithContext is an alternate form of the GetInstanceGroupManagerPolicy method which supports a Context parameter func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8586,6 +9663,7 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8600,22 +9678,25 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_group_manager_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8627,17 +9708,21 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, // GetInstanceGroupMembership : Retrieve an instance group membership // This request retrieves a single instance group membership specified by identifier in the URL. func (vpc *VpcV1) GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - return vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) + result, response, err = vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetInstanceGroupMembershipWithContext is an alternate form of the GetInstanceGroupMembership method which supports a Context parameter func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8651,6 +9736,7 @@ func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, get builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8665,22 +9751,25 @@ func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, get builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_group_membership", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8692,17 +9781,21 @@ func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, get // ListInstanceGroupManagerActions : List all actions for an instance group manager // This request lists all instance group actions for an instance group manager. func (vpc *VpcV1) ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) + result, response, err = vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceGroupManagerActionsWithContext is an alternate form of the ListInstanceGroupManagerActions method which supports a Context parameter func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context, listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8716,6 +9809,7 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8730,7 +9824,6 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listInstanceGroupManagerActionsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) @@ -8741,17 +9834,21 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context 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_group_manager_actions", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerActionsCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8763,17 +9860,21 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context // ListInstanceGroupManagerPolicies : List all policies for an instance group manager // This request lists all policies for an instance group manager. func (vpc *VpcV1) ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) + result, response, err = vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceGroupManagerPoliciesWithContext is an alternate form of the ListInstanceGroupManagerPolicies method which supports a Context parameter func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Context, listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8787,6 +9888,7 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8801,7 +9903,6 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listInstanceGroupManagerPoliciesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Start)) @@ -8812,17 +9913,21 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex 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_group_manager_policies", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicyCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8834,17 +9939,21 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex // ListInstanceGroupManagers : List all managers for an instance group // This request lists all managers for an instance group. func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) + result, response, err = vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceGroupManagersWithContext is an alternate form of the ListInstanceGroupManagers method which supports a Context parameter func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8857,6 +9966,7 @@ func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, list builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8871,7 +9981,6 @@ func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listInstanceGroupManagersOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) @@ -8882,17 +9991,21 @@ func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, list 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_group_managers", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8904,17 +10017,21 @@ func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, list // ListInstanceGroupMemberships : List all memberships for an instance group // This request lists all instance group memberships for an instance group. func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) + result, response, err = vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceGroupMembershipsWithContext is an alternate form of the ListInstanceGroupMemberships method which supports a Context parameter func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8927,6 +10044,7 @@ func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, l builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -8941,7 +10059,6 @@ func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, l builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listInstanceGroupMembershipsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) @@ -8952,17 +10069,21 @@ func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, l 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_group_memberships", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembershipCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -8974,13 +10095,16 @@ func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, l // ListInstanceGroups : List all instance groups // This request lists all instance groups in the region. func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) + result, response, err = vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListInstanceGroupsWithContext is an alternate form of the ListInstanceGroups method which supports a Context parameter func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listInstanceGroupsOptions, "listInstanceGroupsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -8989,6 +10113,7 @@ func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanc builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9003,7 +10128,6 @@ func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanc builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listInstanceGroupsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) @@ -9014,17 +10138,21 @@ func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanc 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_groups", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9037,17 +10165,21 @@ func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanc // This request updates an instance group with the information provided instance group patch. The instance group patch // object is structured in the same way as a retrieved instance group and contains only the information to be updated. func (vpc *VpcV1) UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) + result, response, err = vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceGroupWithContext is an alternate form of the UpdateInstanceGroup method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceGroupOptions, "updateInstanceGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceGroupOptions, "updateInstanceGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9060,6 +10192,7 @@ func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInst builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9075,27 +10208,31 @@ func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInst builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupOptions.InstanceGroupPatch) 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_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9107,17 +10244,21 @@ func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInst // UpdateInstanceGroupManager : Update an instance group manager // This request updates an instance group manager with the information provided instance group manager patch. func (vpc *VpcV1) UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) + result, response, err = vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceGroupManagerWithContext is an alternate form of the UpdateInstanceGroupManager method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9131,6 +10272,7 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, upd builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9146,27 +10288,31 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, upd builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) 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_group_manager", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9178,17 +10324,21 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, upd // UpdateInstanceGroupManagerAction : Update specified instance group manager action // This request updates an instance group manager action. func (vpc *VpcV1) UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) + result, response, err = vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceGroupManagerActionWithContext is an alternate form of the UpdateInstanceGroupManagerAction method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Context, updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9203,6 +10353,7 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9218,27 +10369,31 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) 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_group_manager_action", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9250,17 +10405,21 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Contex // UpdateInstanceGroupManagerPolicy : Update an instance group manager policy // This request updates an instance group manager policy. func (vpc *VpcV1) UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) + result, response, err = vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceGroupManagerPolicyWithContext is an alternate form of the UpdateInstanceGroupManagerPolicy method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Context, updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9275,6 +10434,7 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9290,27 +10450,31 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) 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_group_manager_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9322,17 +10486,21 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex // UpdateInstanceGroupMembership : Update an instance group membership // This request updates an instance group membership with the information provided instance group membership patch. func (vpc *VpcV1) UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - return vpc.UpdateInstanceGroupMembershipWithContext(context.Background(), updateInstanceGroupMembershipOptions) + result, response, err = vpc.UpdateInstanceGroupMembershipWithContext(context.Background(), updateInstanceGroupMembershipOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateInstanceGroupMembershipWithContext is an alternate form of the UpdateInstanceGroupMembership method which supports a Context parameter func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9346,6 +10514,7 @@ func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9361,27 +10530,31 @@ func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupMembershipOptions.InstanceGroupMembershipPatch) 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_group_membership", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9393,17 +10566,21 @@ func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, // ActivateReservation : Activate a reservation // This request activates a reservation. For this request to succeed, the reservation status must be `inactive`. func (vpc *VpcV1) ActivateReservation(activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { - return vpc.ActivateReservationWithContext(context.Background(), activateReservationOptions) + response, err = vpc.ActivateReservationWithContext(context.Background(), activateReservationOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ActivateReservationWithContext is an alternate form of the ActivateReservation method which supports a Context parameter func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(activateReservationOptions, "activateReservationOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(activateReservationOptions, "activateReservationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9416,6 +10593,7 @@ func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateRe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}/activate`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9429,15 +10607,20 @@ func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateRe } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "activate_reservation", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -9446,17 +10629,21 @@ func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateRe // This request creates a new reservation from a reservation prototype object. The prototype object is structured in the // same way as a retrieved reservation, and contains the information necessary to create the new reservation. func (vpc *VpcV1) CreateReservation(createReservationOptions *CreateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - return vpc.CreateReservationWithContext(context.Background(), createReservationOptions) + result, response, err = vpc.CreateReservationWithContext(context.Background(), createReservationOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateReservationWithContext is an alternate form of the CreateReservation method which supports a Context parameter func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReservationOptions *CreateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createReservationOptions, "createReservationOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createReservationOptions, "createReservationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9465,6 +10652,7 @@ func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReserv builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9480,7 +10668,6 @@ func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReserv builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -9507,22 +10694,27 @@ func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReserv } _, 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_reservation", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9535,17 +10727,21 @@ func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReserv // This request deletes a reservation. This operation cannot be reversed. Reservations with a `status` of `active` are // not allowed to be deleted. func (vpc *VpcV1) DeleteReservation(deleteReservationOptions *DeleteReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - return vpc.DeleteReservationWithContext(context.Background(), deleteReservationOptions) + result, response, err = vpc.DeleteReservationWithContext(context.Background(), deleteReservationOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteReservationWithContext is an alternate form of the DeleteReservation method which supports a Context parameter func (vpc *VpcV1) DeleteReservationWithContext(ctx context.Context, deleteReservationOptions *DeleteReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteReservationOptions, "deleteReservationOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteReservationOptions, "deleteReservationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9558,6 +10754,7 @@ func (vpc *VpcV1) DeleteReservationWithContext(ctx context.Context, deleteReserv builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9572,22 +10769,25 @@ func (vpc *VpcV1) DeleteReservationWithContext(ctx context.Context, deleteReserv builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_reservation", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9599,17 +10799,21 @@ func (vpc *VpcV1) DeleteReservationWithContext(ctx context.Context, deleteReserv // GetReservation : Retrieve a reservation // This request retrieves a single reservation specified by identifier in the URL. func (vpc *VpcV1) GetReservation(getReservationOptions *GetReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - return vpc.GetReservationWithContext(context.Background(), getReservationOptions) + result, response, err = vpc.GetReservationWithContext(context.Background(), getReservationOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetReservationWithContext is an alternate form of the GetReservation method which supports a Context parameter func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationOptions *GetReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getReservationOptions, "getReservationOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getReservationOptions, "getReservationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9622,6 +10826,7 @@ func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9636,22 +10841,25 @@ func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationO builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_reservation", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9667,13 +10875,16 @@ func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationO // The reservations will be sorted by their `created_at` property values, with newest reservations first. Reservations // with identical `created_at` property values will in turn be sorted by ascending `name` property values. func (vpc *VpcV1) ListReservations(listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { - return vpc.ListReservationsWithContext(context.Background(), listReservationsOptions) + result, response, err = vpc.ListReservationsWithContext(context.Background(), listReservationsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListReservationsWithContext is an alternate form of the ListReservations method which supports a Context parameter func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listReservationsOptions, "listReservationsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9682,6 +10893,7 @@ func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservati builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9696,7 +10908,6 @@ func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservati builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listReservationsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listReservationsOptions.Start)) @@ -9716,17 +10927,21 @@ func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservati 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_reservations", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservationCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9739,17 +10954,21 @@ func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservati // This request updates a reservation with the information provided in a reservation patch object. The patch object is // structured in the same way as a retrieved reservation and needs to contain only the information to be updated. func (vpc *VpcV1) UpdateReservation(updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - return vpc.UpdateReservationWithContext(context.Background(), updateReservationOptions) + result, response, err = vpc.UpdateReservationWithContext(context.Background(), updateReservationOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateReservationWithContext is an alternate form of the UpdateReservation method which supports a Context parameter func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateReservationOptions, "updateReservationOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateReservationOptions, "updateReservationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9762,6 +10981,7 @@ func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReserv builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9777,27 +10997,31 @@ func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReserv builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateReservationOptions.ReservationPatch) 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_reservation", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9809,17 +11033,21 @@ func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReserv // CreateDedicatedHost : Create a dedicated host // This request creates a new dedicated host. func (vpc *VpcV1) CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - return vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) + result, response, err = vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateDedicatedHostWithContext is an alternate form of the CreateDedicatedHost method which supports a Context parameter func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createDedicatedHostOptions, "createDedicatedHostOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9828,6 +11056,7 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9843,27 +11072,31 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createDedicatedHostOptions.DedicatedHostPrototype) 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_dedicated_host", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9875,17 +11108,21 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi // CreateDedicatedHostGroup : Create a dedicated host group // This request creates a new dedicated host group. func (vpc *VpcV1) CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - return vpc.CreateDedicatedHostGroupWithContext(context.Background(), createDedicatedHostGroupOptions) + result, response, err = vpc.CreateDedicatedHostGroupWithContext(context.Background(), createDedicatedHostGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateDedicatedHostGroupWithContext is an alternate form of the CreateDedicatedHostGroup method which supports a Context parameter func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9894,6 +11131,7 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9909,7 +11147,6 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -9930,22 +11167,27 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat } _, 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_dedicated_host_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -9957,17 +11199,21 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat // DeleteDedicatedHost : Delete a dedicated host // This request deletes a dedicated host. func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) + response, err = vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteDedicatedHostWithContext is an alternate form of the DeleteDedicatedHost method which supports a Context parameter func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteDedicatedHostOptions, "deleteDedicatedHostOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -9980,6 +11226,7 @@ func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedi builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -9993,15 +11240,20 @@ func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedi } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_dedicated_host", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -10009,17 +11261,21 @@ func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedi // DeleteDedicatedHostGroup : Delete a dedicated host group // This request deletes a dedicated host group. func (vpc *VpcV1) DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteDedicatedHostGroupWithContext(context.Background(), deleteDedicatedHostGroupOptions) + response, err = vpc.DeleteDedicatedHostGroupWithContext(context.Background(), deleteDedicatedHostGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteDedicatedHostGroupWithContext is an alternate form of the DeleteDedicatedHostGroup method which supports a Context parameter func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10032,6 +11288,7 @@ func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, delet builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10045,15 +11302,20 @@ func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, delet } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_dedicated_host_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -10061,17 +11323,21 @@ func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, delet // GetDedicatedHost : Retrieve a dedicated host // This request retrieves a single dedicated host specified by the identifiers in the URL. func (vpc *VpcV1) GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) + result, response, err = vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetDedicatedHostWithContext is an alternate form of the GetDedicatedHost method which supports a Context parameter func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getDedicatedHostOptions, "getDedicatedHostOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10084,6 +11350,7 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10098,22 +11365,25 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_dedicated_host", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10125,17 +11395,21 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH // GetDedicatedHostDisk : Retrieve a dedicated host disk // This request retrieves a single dedicated host disk specified by the identifier in the URL. func (vpc *VpcV1) GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) + result, response, err = vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetDedicatedHostDiskWithContext is an alternate form of the GetDedicatedHostDisk method which supports a Context parameter func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10149,6 +11423,7 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10163,22 +11438,25 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_dedicated_host_disk", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10190,17 +11468,21 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica // GetDedicatedHostGroup : Retrieve a dedicated host group // This request retrieves a single dedicated host group specified by the identifier in the URL. func (vpc *VpcV1) GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) + result, response, err = vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetDedicatedHostGroupWithContext is an alternate form of the GetDedicatedHostGroup method which supports a Context parameter func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10213,6 +11495,7 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10227,22 +11510,25 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_dedicated_host_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10254,17 +11540,21 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic // GetDedicatedHostProfile : Retrieve a dedicated host profile // This request retrieves a single dedicated host profile specified by the name in the URL. func (vpc *VpcV1) GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { - return vpc.GetDedicatedHostProfileWithContext(context.Background(), getDedicatedHostProfileOptions) + result, response, err = vpc.GetDedicatedHostProfileWithContext(context.Background(), getDedicatedHostProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetDedicatedHostProfileWithContext is an alternate form of the GetDedicatedHostProfile method which supports a Context parameter func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10277,6 +11567,7 @@ func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDed builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10291,22 +11582,25 @@ func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDed builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_dedicated_host_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfile) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10320,17 +11614,21 @@ func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDed // compute node. By default, the listed disks are sorted by their // `created_at` property values, with the newest disk first. func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) + result, response, err = vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListDedicatedHostDisksWithContext is an alternate form of the ListDedicatedHostDisks method which supports a Context parameter func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10343,6 +11641,7 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10357,22 +11656,25 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_dedicated_host_disks", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDiskCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10385,13 +11687,16 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed // This request lists all dedicated host groups in the region. Host groups are a collection of dedicated hosts for // placement of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) + result, response, err = vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListDedicatedHostGroupsWithContext is an alternate form of the ListDedicatedHostGroups method which supports a Context parameter func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listDedicatedHostGroupsOptions, "listDedicatedHostGroupsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10400,6 +11705,7 @@ func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10414,7 +11720,6 @@ func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDe builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listDedicatedHostGroupsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) @@ -10434,17 +11739,21 @@ func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDe 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_dedicated_host_groups", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroupCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10457,13 +11766,16 @@ func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDe // This request lists provisionable [dedicated host profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in // the region. A dedicated host profile specifies the hardware characteristics for a dedicated host. func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) + result, response, err = vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListDedicatedHostProfilesWithContext is an alternate form of the ListDedicatedHostProfiles method which supports a Context parameter func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listDedicatedHostProfilesOptions, "listDedicatedHostProfilesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10472,6 +11784,7 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10486,7 +11799,6 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listDedicatedHostProfilesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) @@ -10497,17 +11809,21 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list 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_dedicated_host_profiles", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfileCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10519,13 +11835,16 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list // ListDedicatedHosts : List all dedicated hosts // This request lists all dedicated hosts in the region. func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { - return vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) + result, response, err = vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListDedicatedHostsWithContext is an alternate form of the ListDedicatedHosts method which supports a Context parameter func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listDedicatedHostsOptions, "listDedicatedHostsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10534,6 +11853,7 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10548,7 +11868,6 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listDedicatedHostsOptions.DedicatedHostGroupID != nil { builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) @@ -10571,17 +11890,21 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat 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_dedicated_hosts", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10595,17 +11918,21 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat // patch object is structured in the same way as a retrieved dedicated host and contains only the information to be // updated. func (vpc *VpcV1) UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - return vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) + result, response, err = vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateDedicatedHostWithContext is an alternate form of the UpdateDedicatedHost method which supports a Context parameter func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateDedicatedHostOptions, "updateDedicatedHostOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10618,6 +11945,7 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10633,27 +11961,31 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateDedicatedHostOptions.DedicatedHostPatch) 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_dedicated_host", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10665,17 +11997,21 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi // UpdateDedicatedHostDisk : Update a dedicated host disk // This request updates the dedicated host disk with the information in a provided patch. func (vpc *VpcV1) UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - return vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) + result, response, err = vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateDedicatedHostDiskWithContext is an alternate form of the UpdateDedicatedHostDisk method which supports a Context parameter func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10689,6 +12025,7 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10704,27 +12041,31 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) 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_dedicated_host_disk", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10738,17 +12079,21 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update // dedicated host group patch object is structured in the same way as a retrieved dedicated host group and contains only // the information to be updated. func (vpc *VpcV1) UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - return vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) + result, response, err = vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateDedicatedHostGroupWithContext is an alternate form of the UpdateDedicatedHostGroup method which supports a Context parameter func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -10761,6 +12106,7 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -10776,27 +12122,31 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) 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_dedicated_host_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10805,37 +12155,41 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat return } -// CreateBackupPolicy : Create a backup policy -// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in -// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. -func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) +// CreatePlacementGroup : Create a placement group +// This request creates a new placement group. +func (vpc *VpcV1) CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreatePlacementGroupWithContext(context.Background(), createPlacementGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") +// CreatePlacementGroupWithContext is an alternate form of the CreatePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPlacementGroupOptions, "createPlacementGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") + err = core.ValidateStruct(createPlacementGroupOptions, "createPlacementGroupOptions") 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, `/backup_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBackupPolicyOptions.Headers { + for headerName, headerValue := range createPlacementGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePlacementGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -10843,27 +12197,41 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createBackupPolicyOptions.BackupPolicyPrototype) + body := make(map[string]interface{}) + if createPlacementGroupOptions.Strategy != nil { + body["strategy"] = createPlacementGroupOptions.Strategy + } + if createPlacementGroupOptions.Name != nil { + body["name"] = createPlacementGroupOptions.Name + } + if createPlacementGroupOptions.ResourceGroup != nil { + body["resource_group"] = createPlacementGroupOptions.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 } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "create_placement_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -10872,170 +12240,133 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku return } -// CreateBackupPolicyPlan : Create a plan for a backup policy -// This request creates a new backup policy plan from a backup policy plan prototype object. The prototype object is -// structured in the same way as a retrieved backup policy plan, and contains the information necessary to create the -// new backup policy plan. -// -// Backups created by this plan will use the resource group of the source being backed up. -// -// Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character -// suffix. -func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) +// DeletePlacementGroup : Delete a placement group +// This request deletes a placement group. This operation cannot be reversed. For this request to succeed, the placement +// group must not be associated with an instance. +func (vpc *VpcV1) DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeletePlacementGroupWithContext(context.Background(), deletePlacementGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// CreateBackupPolicyPlanWithContext is an alternate form of the CreateBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions cannot be nil") +// DeletePlacementGroupWithContext is an alternate form of the DeletePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePlacementGroupOptions, "deletePlacementGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") + err = core.ValidateStruct(deletePlacementGroupOptions, "deletePlacementGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID, + "id": *deletePlacementGroupOptions.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, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range deletePlacementGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePlacementGroup") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createBackupPolicyPlanOptions.CronSpec != nil { - body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec - } - if createBackupPolicyPlanOptions.Active != nil { - body["active"] = createBackupPolicyPlanOptions.Active - } - if createBackupPolicyPlanOptions.AttachUserTags != nil { - body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags - } - if createBackupPolicyPlanOptions.ClonePolicy != nil { - body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy - } - if createBackupPolicyPlanOptions.CopyUserTags != nil { - body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags - } - if createBackupPolicyPlanOptions.DeletionTrigger != nil { - body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger - } - if createBackupPolicyPlanOptions.Name != nil { - body["name"] = createBackupPolicyPlanOptions.Name - } - if createBackupPolicyPlanOptions.RemoteRegionPolicies != nil { - body["remote_region_policies"] = createBackupPolicyPlanOptions.RemoteRegionPolicies - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - 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, "delete_placement_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) - if err != nil { - return - } - response.Result = result - } return } -// DeleteBackupPolicy : Delete a backup policy -// This request deletes a backup policy. This operation cannot be reversed. -// -// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, -// the backup policy will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) +// GetPlacementGroup : Retrieve a placement group +// This request retrieves a single placement group specified by identifier in the URL. +func (vpc *VpcV1) GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetPlacementGroupWithContext(context.Background(), getPlacementGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") +// GetPlacementGroupWithContext is an alternate form of the GetPlacementGroup method which supports a Context parameter +func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPlacementGroupOptions, "getPlacementGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") + err = core.ValidateStruct(getPlacementGroupOptions, "getPlacementGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteBackupPolicyOptions.ID, + "id": *getPlacementGroupOptions.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, `/backup_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBackupPolicyOptions.Headers { + for headerName, headerValue := range getPlacementGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPlacementGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_placement_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11044,71 +12375,67 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku return } -// DeleteBackupPolicyPlan : Delete a backup policy plan -// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by -// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with -// the plan will run to completion before the plan is deleted. -// -// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing -// completes, the backup policy plan will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) +// ListPlacementGroups : List all placement groups +// This request lists all placement groups in the region. +func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") +// ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter +func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, - "id": *deleteBackupPolicyPlanOptions.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, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range listPlacementGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listPlacementGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) + } + if listPlacementGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.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_placement_groups", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11117,62 +12444,78 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB return } -// GetBackupPolicy : Retrieve a backup policy -// This request retrieves a single backup policy specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) +// UpdatePlacementGroup : Update a placement group +// This request updates a placement group with the information provided placement group patch. The placement group patch +// object is structured in the same way as a retrieved placement group and contains only the information to be updated. +func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") +// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") + err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getBackupPolicyOptions.ID, + "id": *updatePlacementGroupOptions.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, `/backup_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBackupPolicyOptions.Headers { + for headerName, headerValue := range updatePlacementGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updatePlacementGroupOptions.PlacementGroupPatch) + 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_placement_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11181,63 +12524,80 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic return } -// GetBackupPolicyJob : Retrieve a backup policy job -// This request retrieves a single backup policy job specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - return vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) +// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface +// This request associates the specified floating IP with the specified bare metal server network interface. If +// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` +// is `true`, this replaces any existing association. +// +// The existing floating IP must: +// - not be required by another resource, such as a public gateway +// - be in the same `zone` as the bare metal server +// +// A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") +// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") + err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, - "id": *getBackupPolicyJobOptions.ID, + "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.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, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBackupPolicyJobOptions.Headers { + for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "add_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11246,63 +12606,75 @@ func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPo return } -// GetBackupPolicyPlan : Retrieve a backup policy plan -// This request retrieves a single backup policy plan specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) +// CreateBareMetalServer : Create a bare metal server +// This request provisions a new bare metal server from a prototype object. The prototype object is structured in the +// same way as a retrieved bare metal server, and contains the information necessary to provision the new bare metal +// server. The bare metal server is automatically started. +func (vpc *VpcV1) CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateBareMetalServerWithContext(context.Background(), createBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") +// CreateBareMetalServerWithContext is an alternate form of the CreateBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerOptions, "createBareMetalServerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") + err = core.ValidateStruct(createBareMetalServerOptions, "createBareMetalServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, - "id": *getBackupPolicyPlanOptions.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, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range createBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServer") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(createBareMetalServerOptions.BareMetalServerPrototype) + 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_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11311,70 +12683,87 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP return } -// ListBackupPolicies : List all backup policies -// This request lists all backup policies in the region. Backup policies control which sources are selected for backup -// and include a set of backup policy plans that provide the backup schedules and deletion triggers. -func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) +// CreateBareMetalServerConsoleAccessToken : Create a console access token for a bare metal server +// This request creates a new single-use console access token for a bare metal server. All console configuration is +// provided at token create time, and the token is subsequently used in the `access_token` query parameter for the +// WebSocket request. The access token is only valid for a short period of time, and a maximum of one token is valid +// for a given bare metal server at a time. +func (vpc *VpcV1) CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateBareMetalServerConsoleAccessTokenWithContext(context.Background(), createBareMetalServerConsoleAccessTokenOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter -func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") +// CreateBareMetalServerConsoleAccessTokenWithContext is an alternate form of the CreateBareMetalServerConsoleAccessToken method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context.Context, createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "bare_metal_server_id": *createBareMetalServerConsoleAccessTokenOptions.BareMetalServerID, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/console_access_token`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBackupPoliciesOptions.Headers { + for headerName, headerValue := range createBareMetalServerConsoleAccessTokenOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerConsoleAccessToken") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBackupPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) - } - if listBackupPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) - } - if listBackupPoliciesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) + + body := make(map[string]interface{}) + if createBareMetalServerConsoleAccessTokenOptions.ConsoleType != nil { + body["console_type"] = createBareMetalServerConsoleAccessTokenOptions.ConsoleType } - if listBackupPoliciesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) + if createBareMetalServerConsoleAccessTokenOptions.Force != nil { + body["force"] = createBareMetalServerConsoleAccessTokenOptions.Force } - if listBackupPoliciesOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) + _, 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_bare_metal_server_console_access_token", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerConsoleAccessToken) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11383,87 +12772,79 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP return } -// ListBackupPolicyJobs : List all jobs for a backup policy -// This request retrieves all jobs for a backup policy. A backup job represents the execution of a backup policy plan -// for a resource matching the policy's criteria. -func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) +// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server +// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and +// contains the information necessary to create the new bare metal server network attachment. +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter -func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") +// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") + err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, + "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, } - 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, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { + for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBackupPolicyJobsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) - } - if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) - } - if listBackupPolicyJobsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) - } - if listBackupPolicyJobsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) - } - if listBackupPolicyJobsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) - } - if listBackupPolicyJobsOptions.SourceID != nil { - builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) - } - if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { - builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) - } - if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { - builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) + + _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) + 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_bare_metal_server_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11472,65 +12853,85 @@ func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBacku return } -// ListBackupPolicyPlans : List all plans for a backup policy -// This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. -func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) +// CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server +// This request creates a new bare metal server network interface from a bare metal server network interface prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network interface, and +// contains the information necessary to create the new bare metal server network interface. Any subnet in the bare +// metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. +// Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. +// +// 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, and new network interfaces are not allowed to be created. +func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter -func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") +// CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") + err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, + "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, } - 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, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { + for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBackupPolicyPlansOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) + + _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) + 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_bare_metal_server_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11539,340 +12940,341 @@ func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBack return } -// UpdateBackupPolicy : Update a backup policy -// This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch -// object is structured in the same way as a retrieved backup policy and contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) +// DeleteBareMetalServer : Delete a bare metal server +// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the +// bare metal server network interfaces are implicitly disassociated. +func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") +// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") + err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateBackupPolicyOptions.ID, + "id": *deleteBareMetalServerOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBackupPolicyOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateBackupPolicyOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) - if err != nil { - 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, "delete_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) - if err != nil { - return - } - response.Result = result - } return } -// UpdateBackupPolicyPlan : Update a backup policy plan -// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is -// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) +// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment +// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network attachment are implicitly disassociated. +// +// The bare metal server's primary network attachment cannot be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") +// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") + err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, - "id": *updateBackupPolicyPlanOptions.ID, + "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkAttachmentOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) - if err != nil { - 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, "delete_bare_metal_server_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) - if err != nil { - return - } - response.Result = result - } return } -// CreatePlacementGroup : Create a placement group -// This request creates a new placement group. -func (vpc *VpcV1) CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - return vpc.CreatePlacementGroupWithContext(context.Background(), createPlacementGroupOptions) +// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface +// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server +// network interface is not allowed to be deleted. +// +// 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 is not allowed to be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// CreatePlacementGroupWithContext is an alternate form of the CreatePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createPlacementGroupOptions, "createPlacementGroupOptions cannot be nil") +// DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createPlacementGroupOptions, "createPlacementGroupOptions") + err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createPlacementGroupOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePlacementGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createPlacementGroupOptions.Strategy != nil { - body["strategy"] = createPlacementGroupOptions.Strategy - } - if createPlacementGroupOptions.Name != nil { - body["name"] = createPlacementGroupOptions.Name - } - if createPlacementGroupOptions.ResourceGroup != nil { - body["resource_group"] = createPlacementGroupOptions.ResourceGroup - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - 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, "delete_bare_metal_server_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) - if err != nil { - return - } - response.Result = result - } return } -// DeletePlacementGroup : Delete a placement group -// This request deletes a placement group. This operation cannot be reversed. For this request to succeed, the placement -// group must not be associated with an instance. -func (vpc *VpcV1) DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { - return vpc.DeletePlacementGroupWithContext(context.Background(), deletePlacementGroupOptions) +// GetBareMetalServer : Retrieve a bare metal server +// This request retrieves a single bare metal server specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// DeletePlacementGroupWithContext is an alternate form of the DeletePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deletePlacementGroupOptions, "deletePlacementGroupOptions cannot be nil") +// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deletePlacementGroupOptions, "deletePlacementGroupOptions") + err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deletePlacementGroupOptions.ID, + "id": *getBareMetalServerOptions.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, `/placement_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deletePlacementGroupOptions.Headers { + for headerName, headerValue := range getBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePlacementGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "get_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetPlacementGroup : Retrieve a placement group -// This request retrieves a single placement group specified by identifier in the URL. -func (vpc *VpcV1) GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - return vpc.GetPlacementGroupWithContext(context.Background(), getPlacementGroupOptions) +// GetBareMetalServerDisk : Retrieve a bare metal server disk +// This request retrieves a single disk specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetPlacementGroupWithContext is an alternate form of the GetPlacementGroup method which supports a Context parameter -func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPlacementGroupOptions, "getPlacementGroupOptions cannot be nil") +// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getPlacementGroupOptions, "getPlacementGroupOptions") + err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getPlacementGroupOptions.ID, + "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, + "id": *getBareMetalServerDiskOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getPlacementGroupOptions.Headers { + for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPlacementGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_bare_metal_server_disk", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11881,60 +13283,72 @@ func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacement return } -// ListPlacementGroups : List all placement groups -// This request lists all placement groups in the region. -func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) +// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server +// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and +// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be +// current. +func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter -func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") +// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *getBareMetalServerInitializationOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listPlacementGroupsOptions.Headers { + for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listPlacementGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) - } - if listPlacementGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.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, "get_bare_metal_server_initialization", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -11943,69 +13357,71 @@ func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacem return } -// UpdatePlacementGroup : Update a placement group -// This request updates a placement group with the information provided placement group patch. The placement group patch -// object is structured in the same way as a retrieved placement group and contains only the information to be updated. -func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - return vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) +// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment +// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") +// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") + err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updatePlacementGroupOptions.ID, + "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkAttachmentOptions.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, `/placement_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updatePlacementGroupOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updatePlacementGroupOptions.PlacementGroupPatch) - if err != nil { - 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, "get_bare_metal_server_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12014,72 +13430,75 @@ func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePla return } -// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface -// This request associates the specified floating IP with the specified bare metal server network interface. If -// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` -// is `true`, this replaces any existing association. -// -// The existing floating IP must: -// - not be required by another resource, such as a public gateway -// - be in the same `zone` as the bare metal server +// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface +// This request retrieves a single bare metal server network interface specified by the identifier in the URL. // -// A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) +// If this bare metal server has network attachments, the retrieved 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. +func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") +// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkInterfaceOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_bare_metal_server_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, UnmarshalBareMetalServerNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12088,66 +13507,73 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } -// CreateBareMetalServer : Create a bare metal server -// This request provisions a new bare metal server from a prototype object. The prototype object is structured in the -// same way as a retrieved bare metal server, and contains the information necessary to provision the new bare metal -// server. The bare metal server is automatically started. -func (vpc *VpcV1) CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerWithContext(context.Background(), createBareMetalServerOptions) +// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP if it is associated with the bare metal server network interface +// specified in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// CreateBareMetalServerWithContext is an alternate form of the CreateBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerOptions, "createBareMetalServerOptions cannot be nil") +// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createBareMetalServerOptions, "createBareMetalServerOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBareMetalServerOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createBareMetalServerOptions.BareMetalServerPrototype) - if err != nil { - 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, "get_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12156,78 +13582,75 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa return } -// CreateBareMetalServerConsoleAccessToken : Create a console access token for a bare metal server -// This request creates a new single-use console access token for a bare metal server. All console configuration is -// provided at token create time, and the token is subsequently used in the `access_token` query parameter for the -// WebSocket request. The access token is only valid for a short period of time, and a maximum of one token is valid -// for a given bare metal server at a time. -func (vpc *VpcV1) CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerConsoleAccessTokenWithContext(context.Background(), createBareMetalServerConsoleAccessTokenOptions) +// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for a bare metal server network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// CreateBareMetalServerConsoleAccessTokenWithContext is an alternate form of the CreateBareMetalServerConsoleAccessToken method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context.Context, createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions cannot be nil") +// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP") + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerConsoleAccessTokenOptions.BareMetalServerID, + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceIPOptions.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, `/bare_metal_servers/{bare_metal_server_id}/console_access_token`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBareMetalServerConsoleAccessTokenOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerConsoleAccessToken") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createBareMetalServerConsoleAccessTokenOptions.ConsoleType != nil { - body["console_type"] = createBareMetalServerConsoleAccessTokenOptions.ConsoleType - } - if createBareMetalServerConsoleAccessTokenOptions.Force != nil { - body["force"] = createBareMetalServerConsoleAccessTokenOptions.Force - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - 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, "get_bare_metal_server_network_interface_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerConsoleAccessToken) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12236,70 +13659,70 @@ func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context return } -// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server -// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype -// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and -// contains the information necessary to create the new bare metal server network attachment. -func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) +// GetBareMetalServerProfile : Retrieve a bare metal server profile +// This request retrieves a single bare metal server profile specified by the name in the URL. +func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") +// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "name": *getBareMetalServerProfileOptions.Name, } - 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, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) - if err != nil { - 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, "get_bare_metal_server_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12308,76 +13731,72 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context. return } -// CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server -// This request creates a new bare metal server network interface from a bare metal server network interface prototype -// object. The prototype object is structured in the same way as a retrieved bare metal server network interface, and -// contains the information necessary to create the new bare metal server network interface. Any subnet in the bare -// metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. -// Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. -// -// 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, and new network interfaces are not allowed to be created. -func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) +// ListBareMetalServerDisks : List all disks on a bare metal server +// This request lists all disks on a bare metal server. A disk is a block device that is locally attached to the +// physical server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk +// first. +func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") +// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, } - 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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) - if err != nil { - 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, "list_bare_metal_server_disks", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12386,230 +13805,317 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// DeleteBareMetalServer : Delete a bare metal server -// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the -// bare metal server network interfaces are implicitly disassociated. -func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) +// ListBareMetalServerNetworkAttachments : List all network attachments on a bare metal server +// This request lists all network attachments on a bare metal server. A bare metal server network attachment is an +// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network +// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to +// the bare metal server. +// +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") +// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") + err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteBareMetalServerOptions.ID, + "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, } - 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, `/bare_metal_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBareMetalServerOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServerNetworkAttachmentsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) + } + if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) + } 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, "list_bare_metal_server_network_attachments", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment -// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs -// associated with the bare metal server network attachment are implicitly disassociated. -// -// The bare metal server's primary network attachment cannot be deleted. -func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) +// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a bare metal server network interface +// This request lists all floating IPs associated with a bare metal server network interface. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") +// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *deleteBareMetalServerNetworkAttachmentOptions.ID, + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, } - 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, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "list_bare_metal_server_network_interface_floating_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface -// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs -// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server -// network interface is not allowed to be deleted. -// -// 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 is not allowed to be deleted. -func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) +// ListBareMetalServerNetworkInterfaceIps : List the primary reserved IP for a bare metal server network interface +// This request lists the primary reserved IP for a bare metal server network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") +// ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListBareMetalServerNetworkInterfaceIps") + err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *deleteBareMetalServerNetworkInterfaceOptions.ID, + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceIpsOptions.NetworkInterfaceID, } - 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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkInterfaceIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "list_bare_metal_server_network_interface_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetBareMetalServer : Retrieve a bare metal server -// This request retrieves a single bare metal server specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) +// ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server +// This request lists all network interfaces on a bare metal server. A bare metal server network interface is an +// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network +// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to +// the bare metal server. +// +// If this bare metal server has network attachments, each returned 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. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") +// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") + err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getBareMetalServerOptions.ID, + "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServerNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) + } + if listBareMetalServerNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.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_bare_metal_server_network_interfaces", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12618,63 +14124,69 @@ func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMeta return } -// GetBareMetalServerDisk : Retrieve a bare metal server disk -// This request retrieves a single disk specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) +// ListBareMetalServerProfiles : List all bare metal server profiles +// This request lists all [bare metal server +// profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) available in the region. A bare metal +// server profile specifies the performance characteristics and pricing model for a bare metal server. +func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") +// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, - "id": *getBareMetalServerDiskOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { + for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) + } + if listBareMetalServerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.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_bare_metal_server_profiles", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12683,64 +14195,82 @@ func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBare return } -// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server -// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and -// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be -// current. -func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) +// ListBareMetalServers : List all bare metal servers +// This request lists all bare metal servers in the region. +func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") +// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *getBareMetalServerInitializationOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { + for headerName, headerValue := range listBareMetalServersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listBareMetalServersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) + } + if listBareMetalServersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) + } + if listBareMetalServersOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) + } + if listBareMetalServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) + } + if listBareMetalServersOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) + } + if listBareMetalServersOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) + } + if listBareMetalServersOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) + } 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_bare_metal_servers", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -12749,329 +14279,340 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex return } -// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment -// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) +// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface +// This request disassociates the specified floating IP from the specified bare metal server network interface. +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") +// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *getBareMetalServerNetworkAttachmentOptions.ID, + "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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) + response, err = vpc.Service.Request(request, nil) if err != nil { + core.EnrichHTTPProblem(err, "remove_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) - if err != nil { - return - } - response.Result = result - } return } -// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface -// This request retrieves a single bare metal server network interface specified by the identifier in the URL. -// -// If this bare metal server has network attachments, the retrieved 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. -func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) +// RestartBareMetalServer : Restart a bare metal server +// This request restarts a bare metal server. It will run immediately regardless of the state of the server. +func (vpc *VpcV1) RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RestartBareMetalServerWithContext(context.Background(), restartBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") +// RestartBareMetalServerWithContext is an alternate form of the RestartBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(restartBareMetalServerOptions, "restartBareMetalServerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(restartBareMetalServerOptions, "restartBareMetalServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *getBareMetalServerNetworkInterfaceOptions.ID, + "id": *restartBareMetalServerOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/restart`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range restartBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RestartBareMetalServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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) + response, err = vpc.Service.Request(request, nil) if err != nil { + core.EnrichHTTPProblem(err, "restart_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) - if err != nil { - return - } - response.Result = result - } return } -// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP if it is associated with the bare metal server network interface -// specified in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) +// StartBareMetalServer : Start a bare metal server +// This request starts a bare metal server. It will run immediately provided the server is stopped. +func (vpc *VpcV1) StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.StartBareMetalServerWithContext(context.Background(), startBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") +// StartBareMetalServerWithContext is an alternate form of the StartBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(startBareMetalServerOptions, "startBareMetalServerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(startBareMetalServerOptions, "startBareMetalServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + "id": *startBareMetalServerOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/start`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range startBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StartBareMetalServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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) + response, err = vpc.Service.Request(request, nil) if err != nil { + core.EnrichHTTPProblem(err, "start_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - return - } - response.Result = result - } return } -// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP -// This request retrieves the primary reserved IP for a bare metal server network interface. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) +// StopBareMetalServer : Stop a bare metal server +// This request stops a bare metal server. It will run immediately provided the server is running. Note: A soft stop may +// not complete as it relies on the operating system to perform the operation. +func (vpc *VpcV1) StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.StopBareMetalServerWithContext(context.Background(), stopBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") +// StopBareMetalServerWithContext is an alternate form of the StopBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(stopBareMetalServerOptions, "stopBareMetalServerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") + err = core.ValidateStruct(stopBareMetalServerOptions, "stopBareMetalServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceIPOptions.ID, + "id": *stopBareMetalServerOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/stop`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { + for headerName, headerValue := range stopBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StopBareMetalServer") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() + body := make(map[string]interface{}) + if stopBareMetalServerOptions.Type != nil { + body["type"] = stopBareMetalServerOptions.Type + } + _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - return - } - response.Result = result + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "stop_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return } return } -// GetBareMetalServerProfile : Retrieve a bare metal server profile -// This request retrieves a single bare metal server profile specified by the name in the URL. -func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) +// UpdateBareMetalServer : Update a bare metal server +// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object +// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") +// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") + err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getBareMetalServerProfileOptions.Name, + "id": *updateBareMetalServerOptions.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, `/bare_metal_server/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { + for headerName, headerValue := range updateBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateBareMetalServerOptions.BareMetalServerPatch) + 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_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13080,64 +14621,78 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB return } -// ListBareMetalServerDisks : List all disks on a bare metal server -// This request lists all disks on a bare metal server. A disk is a block device that is locally attached to the -// physical server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk -// first. -func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) +// UpdateBareMetalServerDisk : Update a bare metal server disk +// This request updates the bare metal server disk with the information in a provided patch. +func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") +// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") + err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, + "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, + "id": *updateBareMetalServerDiskOptions.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, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { + for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) + 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_bare_metal_server_disk", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13146,75 +14701,80 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB return } -// ListBareMetalServerNetworkAttachments : List all network attachments on a bare metal server -// This request lists all network attachments on a bare metal server. A bare metal server network attachment is an -// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network -// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to -// the bare metal server. -// -// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. -// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property -// values. -func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) +// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment +// This request updates a bare metal server network attachment with the information provided in a bare metal server +// network attachment patch object. The bare metal server network attachment patch object is structured in the same way +// as a retrieved bare metal server network attachment and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") +// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") + err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, + "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkAttachmentOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { + for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServerNetworkAttachmentsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) - } - if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) + 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_bare_metal_server_network_attachment", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13223,63 +14783,84 @@ func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.C return } -// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a bare metal server network interface -// This request lists all floating IPs associated with a bare metal server network interface. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) -} - -// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") +// UpdateBareMetalServerNetworkInterface : Update a bare metal server network interface +// This request updates a bare metal server network interface with the information provided in a bare metal server +// network interface patch object. The bare metal server network interface patch object is structured in the same way as +// a retrieved bare metal server network interface and needs to contain only the information to be updated. +// +// 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 is not allowed to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") + err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, - "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, + "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkInterfaceOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { + for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) + 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_bare_metal_server_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13288,63 +14869,212 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx return } -// ListBareMetalServerNetworkInterfaceIps : List the primary reserved IP for a bare metal server network interface -// This request lists the primary reserved IP for a bare metal server network interface. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) +// CreateVolume : Create a volume +// This request creates a new volume from a volume prototype object. The prototype object is structured in the same way +// as a retrieved volume, and contains the information necessary to create the new volume. +func (vpc *VpcV1) CreateVolume(createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") +// CreateVolumeWithContext is an alternate form of the CreateVolume method which supports a Context parameter +func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVolumeOptions, "createVolumeOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions") + err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions") + 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, `/volumes`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range createVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") + 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(createVolumeOptions.VolumePrototype) + 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_volume", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// DeleteVolume : Delete a volume +// This request deletes a volume. This operation cannot be reversed. For this request to succeed, the volume must not be +// attached to any instances. +func (vpc *VpcV1) DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// DeleteVolumeWithContext is an alternate form of the DeleteVolume method which supports a Context parameter +func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVolumeOptions, "deleteVolumeOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfaceIpsOptions.BareMetalServerID, - "network_interface_id": *listBareMetalServerNetworkInterfaceIpsOptions.NetworkInterfaceID, + "id": *deleteVolumeOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deleteVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteVolumeOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVolumeOptions.IfMatch)) + } + + 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_volume", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// GetVolume : Retrieve a volume +// This request retrieves a single volume specified by the identifier in the URL. +func (vpc *VpcV1) GetVolume(getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVolumeWithContext(context.Background(), getVolumeOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetVolumeWithContext is an alternate form of the GetVolume method which supports a Context parameter +func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeOptions, "getVolumeOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *getVolumeOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerNetworkInterfaceIpsOptions.Headers { + for headerName, headerValue := range getVolumeOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_volume", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13353,75 +15083,70 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. return } -// ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server -// This request lists all network interfaces on a bare metal server. A bare metal server network interface is an -// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network -// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to -// the bare metal server. -// -// If this bare metal server has network attachments, each returned 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. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) +// GetVolumeProfile : Retrieve a volume profile +// This request retrieves a single volume profile specified by the name in the URL. +func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") +// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter +func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") + err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, + "name": *getVolumeProfileOptions.Name, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { + for headerName, headerValue := range getVolumeProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServerNetworkInterfacesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) - } - if listBareMetalServerNetworkInterfacesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.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, "get_volume_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13430,62 +15155,68 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co return } -// ListBareMetalServerProfiles : List all bare metal server profiles -// This request lists all [bare metal server -// profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) available in the region. A bare metal -// server profile specifies the performance characteristics and pricing model for a bare metal server. -func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) +// ListVolumeProfiles : List all volume profiles +// This request lists all [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available +// in the region. A volume profile specifies the performance characteristics and pricing model for a volume. +func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") +// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter +func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") 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, `/bare_metal_server/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { + for headerName, headerValue := range listVolumeProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServerProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) + if listVolumeProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) } - if listBareMetalServerProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.Limit)) + if listVolumeProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.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_volume_profiles", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13494,75 +15225,89 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li return } -// ListBareMetalServers : List all bare metal servers -// This request lists all bare metal servers in the region. -func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) +// ListVolumes : List all volumes +// This request lists all volumes in the region. Volumes are network-connected block storage devices that may be +// attached to one or more instances in the same region. +func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") +// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter +func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") 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, `/bare_metal_servers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServersOptions.Headers { + for headerName, headerValue := range listVolumesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBareMetalServersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) + if listVolumesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) } - if listBareMetalServersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) + if listVolumesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) } - if listBareMetalServersOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) + if listVolumesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) } - if listBareMetalServersOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) + if listVolumesOptions.AttachmentState != nil { + builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) } - if listBareMetalServersOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) + if listVolumesOptions.Encryption != nil { + builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) } - if listBareMetalServersOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) + if listVolumesOptions.OperatingSystemFamily != nil { + builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) } - if listBareMetalServersOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) + if listVolumesOptions.OperatingSystemArchitecture != nil { + builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) + } + if listVolumesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) + } + if listVolumesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) } 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_volumes", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -13571,434 +15316,510 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM return } -// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface -// This request disassociates the specified floating IP from the specified bare metal server network interface. -func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) +// UpdateVolume : Update a volume +// This request updates a volume with the information in a provided volume patch. The volume patch object is structured +// in the same way as a retrieved volume and contains only the information to be updated. +func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") +// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter +func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + "id": *updateVolumeOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range updateVolumeOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVolumeOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) + 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, "update_volume", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// RestartBareMetalServer : Restart a bare metal server -// This request restarts a bare metal server. It will run immediately regardless of the state of the server. -func (vpc *VpcV1) RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.RestartBareMetalServerWithContext(context.Background(), restartBareMetalServerOptions) +// CreateSnapshot : Create a snapshot +// This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same +// way as a retrieved snapshot, and contains the information necessary to provision the new snapshot. +func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// RestartBareMetalServerWithContext is an alternate form of the RestartBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(restartBareMetalServerOptions, "restartBareMetalServerOptions cannot be nil") +// CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(restartBareMetalServerOptions, "restartBareMetalServerOptions") + err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *restartBareMetalServerOptions.ID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/restart`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range restartBareMetalServerOptions.Headers { + for headerName, headerValue := range createSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RestartBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(createSnapshotOptions.SnapshotPrototype) + 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, "create_snapshot", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// StartBareMetalServer : Start a bare metal server -// This request starts a bare metal server. It will run immediately provided the server is stopped. -func (vpc *VpcV1) StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.StartBareMetalServerWithContext(context.Background(), startBareMetalServerOptions) +// CreateSnapshotClone : Create a clone for a snapshot +// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if +// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. +func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// StartBareMetalServerWithContext is an alternate form of the StartBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(startBareMetalServerOptions, "startBareMetalServerOptions cannot be nil") +// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(startBareMetalServerOptions, "startBareMetalServerOptions") + err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *startBareMetalServerOptions.ID, + "id": *createSnapshotCloneOptions.ID, + "zone_name": *createSnapshotCloneOptions.ZoneName, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/start`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range startBareMetalServerOptions.Headers { + for headerName, headerValue := range createSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StartBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "create_snapshot_clone", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// StopBareMetalServer : Stop a bare metal server -// This request stops a bare metal server. It will run immediately provided the server is running. Note: A soft stop may -// not complete as it relies on the operating system to perform the operation. -func (vpc *VpcV1) StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { - return vpc.StopBareMetalServerWithContext(context.Background(), stopBareMetalServerOptions) +// CreateSnapshotConsistencyGroup : Create a snapshot consistency group +// This request creates a new snapshot consistency group from a snapshot consistency group object. The prototype object +// is structured in the same way as a retrieved consistency group, and contains the information necessary to provision +// the new snapshot consistency group. +func (vpc *VpcV1) CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSnapshotConsistencyGroupWithContext(context.Background(), createSnapshotConsistencyGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// StopBareMetalServerWithContext is an alternate form of the StopBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(stopBareMetalServerOptions, "stopBareMetalServerOptions cannot be nil") +// CreateSnapshotConsistencyGroupWithContext is an alternate form of the CreateSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(stopBareMetalServerOptions, "stopBareMetalServerOptions") + err = core.ValidateStruct(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *stopBareMetalServerOptions.ID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/stop`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range stopBareMetalServerOptions.Headers { + for headerName, headerValue := range createSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StopBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if stopBareMetalServerOptions.Type != nil { - body["type"] = stopBareMetalServerOptions.Type - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) 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, "create_snapshot_consistency_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UpdateBareMetalServer : Update a bare metal server -// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object -// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) +// DeleteSnapshot : Delete a snapshot +// This request deletes a snapshot. This operation cannot be reversed. +func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") +// DeleteSnapshotWithContext is an alternate form of the DeleteSnapshot method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotOptions, "deleteSnapshotOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") + err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateBareMetalServerOptions.ID, + "id": *deleteSnapshotOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBareMetalServerOptions.Headers { + for headerName, headerValue := range deleteSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") + if deleteSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateBareMetalServerOptions.BareMetalServerPatch) - if err != nil { - 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, "delete_snapshot", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) - if err != nil { - return - } - response.Result = result - } return } -// UpdateBareMetalServerDisk : Update a bare metal server disk -// This request updates the bare metal server disk with the information in a provided patch. -func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) +// DeleteSnapshotClone : Delete a snapshot clone +// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated +// from the snapshot. +func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") +// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") + err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, - "id": *updateBareMetalServerDiskOptions.ID, + "id": *deleteSnapshotCloneOptions.ID, + "zone_name": *deleteSnapshotCloneOptions.ZoneName, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { + for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) - if err != nil { - 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, "delete_snapshot_clone", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) - if err != nil { - return - } - response.Result = result - } return } -// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment -// This request updates a bare metal server network attachment with the information provided in a bare metal server -// network attachment patch object. The bare metal server network attachment patch object is structured in the same way -// as a retrieved bare metal server network attachment and contains only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) +// DeleteSnapshotConsistencyGroup : Delete a snapshot consistency group +// This request deletes snapshot consistency group. This operation cannot be reversed. If the +// `delete_snapshots_on_delete` property is `true`, all snapshots in the consistency group will also be deleted. +func (vpc *VpcV1) DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteSnapshotConsistencyGroupWithContext(context.Background(), deleteSnapshotConsistencyGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") +// DeleteSnapshotConsistencyGroupWithContext is an alternate form of the DeleteSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *updateBareMetalServerNetworkAttachmentOptions.ID, + "id": *deleteSnapshotConsistencyGroupOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range deleteSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotConsistencyGroup") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) - if err != nil { - 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, "delete_snapshot_consistency_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14007,142 +15828,129 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. return } -// UpdateBareMetalServerNetworkInterface : Update a bare metal server network interface -// This request updates a bare metal server network interface with the information provided in a bare metal server -// network interface patch object. The bare metal server network interface patch object is structured in the same way as -// a retrieved bare metal server network interface and needs to contain only the information to be updated. -// -// 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 is not allowed to be updated. -func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) +// DeleteSnapshots : Delete a filtered collection of snapshots +// This request deletes all snapshots created from a specific source volume. +func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") +// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *updateBareMetalServerNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range deleteSnapshotsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) - if err != nil { - return - } + builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) 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, "delete_snapshots", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) - if err != nil { - return - } - response.Result = result - } return } -// CreateVolume : Create a volume -// This request creates a new volume from a volume prototype object. The prototype object is structured in the same way -// as a retrieved volume, and contains the information necessary to create the new volume. -func (vpc *VpcV1) CreateVolume(createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - return vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions) +// GetSnapshot : Retrieve a snapshot +// This request retrieves a single snapshot specified by the identifier in the URL. +func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// CreateVolumeWithContext is an alternate form of the CreateVolume method which supports a Context parameter -func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVolumeOptions, "createVolumeOptions cannot be nil") +// GetSnapshotWithContext is an alternate form of the GetSnapshot method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotOptions, "getSnapshotOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions") + err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *getSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVolumeOptions.Headers { + for headerName, headerValue := range getSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createVolumeOptions.VolumePrototype) - if err != nil { - 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, "get_snapshot", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14151,118 +15959,143 @@ func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptio return } -// DeleteVolume : Delete a volume -// This request deletes a volume. This operation cannot be reversed. For this request to succeed, the volume must not be -// attached to any instances. -func (vpc *VpcV1) DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions) +// GetSnapshotClone : Retrieve a snapshot clone +// This request retrieves a single clone specified by the snapshot identifier and zone name in the URL. +func (vpc *VpcV1) GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSnapshotCloneWithContext(context.Background(), getSnapshotCloneOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// DeleteVolumeWithContext is an alternate form of the DeleteVolume method which supports a Context parameter -func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVolumeOptions, "deleteVolumeOptions cannot be nil") +// GetSnapshotCloneWithContext is an alternate form of the GetSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotCloneOptions, "getSnapshotCloneOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions") + err = core.ValidateStruct(getSnapshotCloneOptions, "getSnapshotCloneOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteVolumeOptions.ID, + "id": *getSnapshotCloneOptions.ID, + "zone_name": *getSnapshotCloneOptions.ZoneName, } - 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, `/volumes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVolumeOptions.Headers { + for headerName, headerValue := range getSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteVolumeOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVolumeOptions.IfMatch)) - } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "get_snapshot_clone", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetVolume : Retrieve a volume -// This request retrieves a single volume specified by the identifier in the URL. -func (vpc *VpcV1) GetVolume(getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - return vpc.GetVolumeWithContext(context.Background(), getVolumeOptions) +// GetSnapshotConsistencyGroup : Retrieve a snapshot consistency group +// This request retrieves a single snapshot consistency group specified by the identifier in the URL. +func (vpc *VpcV1) GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSnapshotConsistencyGroupWithContext(context.Background(), getSnapshotConsistencyGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetVolumeWithContext is an alternate form of the GetVolume method which supports a Context parameter -func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVolumeOptions, "getVolumeOptions cannot be nil") +// GetSnapshotConsistencyGroupWithContext is an alternate form of the GetSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions") + err = core.ValidateStruct(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVolumeOptions.ID, + "id": *getSnapshotConsistencyGroupOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVolumeOptions.Headers { + for headerName, headerValue := range getSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_snapshot_consistency_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14271,62 +16104,70 @@ func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *Ge return } -// GetVolumeProfile : Retrieve a volume profile -// This request retrieves a single volume profile specified by the name in the URL. -func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - return vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) +// ListSnapshotClones : List all clones for a snapshot +// This request lists all clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. +func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter -func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") +// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") + err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getVolumeProfileOptions.Name, + "id": *listSnapshotClonesOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVolumeProfileOptions.Headers { + for headerName, headerValue := range listSnapshotClonesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_snapshot_clones", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14335,61 +16176,80 @@ func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProf return } -// ListVolumeProfiles : List all volume profiles -// This request lists all [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available -// in the region. A volume profile specifies the performance characteristics and pricing model for a volume. -func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) +// ListSnapshotConsistencyGroups : List all snapshot consistency groups +// This request lists all snapshot consistency groups in the region. A snapshot consistency group is a collection of +// individual snapshots taken at the same time. +func (vpc *VpcV1) ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter -func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") +// ListSnapshotConsistencyGroupsWithContext is an alternate form of the ListSnapshotConsistencyGroups method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSnapshotConsistencyGroupsOptions, "listSnapshotConsistencyGroupsOptions") 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, `/volume/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVolumeProfilesOptions.Headers { + for headerName, headerValue := range listSnapshotConsistencyGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVolumeProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) + if listSnapshotConsistencyGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Start)) } - if listVolumeProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) + if listSnapshotConsistencyGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Limit)) + } + if listSnapshotConsistencyGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.ResourceGroupID)) + } + if listSnapshotConsistencyGroupsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Name)) + } + if listSnapshotConsistencyGroupsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Sort)) + } + if listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID)) } 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_snapshot_consistency_groups", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroupCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14398,82 +16258,128 @@ func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeP return } -// ListVolumes : List all volumes -// This request lists all volumes in the region. Volumes are network-connected block storage devices that may be -// attached to one or more instances in the same region. -func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - return vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) +// ListSnapshots : List all snapshots +// This request lists all snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is +// created. +func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter -func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") +// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") 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, `/volumes`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVolumesOptions.Headers { + for headerName, headerValue := range listSnapshotsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listVolumesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) + if listSnapshotsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) } - if listVolumesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) + if listSnapshotsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) } - if listVolumesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) + if listSnapshotsOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag)) } - if listVolumesOptions.AttachmentState != nil { - builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) + if listSnapshotsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID)) } - if listVolumesOptions.Encryption != nil { - builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) + if listSnapshotsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name)) } - if listVolumesOptions.OperatingSystemFamily != nil { - builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) + if listSnapshotsOptions.SourceVolumeID != nil { + builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID)) } - if listVolumesOptions.OperatingSystemArchitecture != nil { - builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) + if listSnapshotsOptions.SourceVolumeCRN != nil { + builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN)) } - if listVolumesOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) + if listSnapshotsOptions.SourceImageID != nil { + builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID)) } - if listVolumesOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) + if listSnapshotsOptions.SourceImageCRN != nil { + builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN)) + } + if listSnapshotsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort)) + } + if listSnapshotsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) + } + if listSnapshotsOptions.CopiesID != nil { + builder.AddQuery("copies[].id", fmt.Sprint(*listSnapshotsOptions.CopiesID)) + } + if listSnapshotsOptions.CopiesName != nil { + builder.AddQuery("copies[].name", fmt.Sprint(*listSnapshotsOptions.CopiesName)) + } + if listSnapshotsOptions.CopiesCRN != nil { + builder.AddQuery("copies[].crn", fmt.Sprint(*listSnapshotsOptions.CopiesCRN)) + } + if listSnapshotsOptions.CopiesRemoteRegionName != nil { + builder.AddQuery("copies[].remote.region.name", fmt.Sprint(*listSnapshotsOptions.CopiesRemoteRegionName)) + } + if listSnapshotsOptions.SourceSnapshotID != nil { + builder.AddQuery("source_snapshot.id", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotID)) + } + if listSnapshotsOptions.SourceSnapshotRemoteRegionName != nil { + builder.AddQuery("source_snapshot.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotRemoteRegionName)) + } + if listSnapshotsOptions.SourceVolumeRemoteRegionName != nil { + builder.AddQuery("source_volume.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceVolumeRemoteRegionName)) + } + if listSnapshotsOptions.SourceImageRemoteRegionName != nil { + builder.AddQuery("source_image.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceImageRemoteRegionName)) + } + if listSnapshotsOptions.ClonesZoneName != nil { + builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName)) + } + if listSnapshotsOptions.SnapshotConsistencyGroupID != nil { + builder.AddQuery("snapshot_consistency_group.id", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupID)) + } + if listSnapshotsOptions.SnapshotConsistencyGroupCRN != nil { + builder.AddQuery("snapshot_consistency_group.crn", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupCRN)) } 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_snapshots", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14482,72 +16388,81 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions return } -// UpdateVolume : Update a volume -// This request updates a volume with the information in a provided volume patch. The volume patch object is structured -// in the same way as a retrieved volume and contains only the information to be updated. -func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - return vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) +// UpdateSnapshot : Update a snapshot +// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group +// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. +func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter -func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") +// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter +func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") + err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVolumeOptions.ID, + "id": *updateSnapshotOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVolumeOptions.Headers { + for headerName, headerValue := range updateSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVolumeOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) + if updateSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch)) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) + _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) 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_snapshot", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14556,65 +16471,82 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio return } -// CreateSnapshot : Create a snapshot -// This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same -// way as a retrieved snapshot, and contains the information necessary to provision the new snapshot. -func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - return vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) +// UpdateSnapshotConsistencyGroup : Update a snapshot consistency group +// This request updates a snapshot consistency group with the information in a provided snapshot consistency group +// patch. The snapshot consistency group patch object is structured in the same way as a retrieved snapshot consistency +// group and contains only the information to be updated. +func (vpc *VpcV1) UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateSnapshotConsistencyGroupWithContext(context.Background(), updateSnapshotConsistencyGroupOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil") +// UpdateSnapshotConsistencyGroupWithContext is an alternate form of the UpdateSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") + err = core.ValidateStruct(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *updateSnapshotConsistencyGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSnapshotOptions.Headers { + for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup") 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 updateSnapshotConsistencyGroupOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotConsistencyGroupOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createSnapshotOptions.SnapshotPrototype) + _, err = builder.SetBodyContentJSON(updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch) 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_snapshot_consistency_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14623,64 +16555,77 @@ func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotO return } -// CreateSnapshotClone : Create a clone for a snapshot -// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if -// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. -func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - return vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) +// CreateShare : Create a file share +// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, +// a replica share, or both a source and replica share. +// +// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to +// provision the new file shares. +func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateShareWithContext(context.Background(), createShareOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") +// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter +func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") + err = core.ValidateStruct(createShareOptions, "createShareOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *createSnapshotCloneOptions.ID, - "zone_name": *createSnapshotCloneOptions.ZoneName, - } - - 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, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSnapshotCloneOptions.Headers { + for headerName, headerValue := range createShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(createShareOptions.SharePrototype) + 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_share", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14689,38 +16634,48 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap return } -// CreateSnapshotConsistencyGroup : Create a snapshot consistency group -// This request creates a new snapshot consistency group from a snapshot consistency group object. The prototype object -// is structured in the same way as a retrieved consistency group, and contains the information necessary to provision -// the new snapshot consistency group. -func (vpc *VpcV1) CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - return vpc.CreateSnapshotConsistencyGroupWithContext(context.Background(), createSnapshotConsistencyGroupOptions) +// CreateShareMountTarget : Create a mount target for a file share +// This request creates a new share mount target from a share mount target prototype object. +// +// The prototype object is structured in the same way as a retrieved share mount target, and contains the information +// necessary to provision the new file share mount target. +func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// CreateSnapshotConsistencyGroupWithContext is an alternate form of the CreateSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions cannot be nil") +// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions") + err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "share_id": *createShareMountTargetOptions.ShareID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range createShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14728,27 +16683,31 @@ func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) + _, err = builder.SetBodyContentJSON(createShareMountTargetOptions.ShareMountTargetPrototype) 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_share_mount_target", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14757,172 +16716,155 @@ func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, return } -// DeleteSnapshot : Delete a snapshot -// This request deletes a snapshot. This operation cannot be reversed. -func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) +// DeleteShare : Delete a file share +// This request deletes a share. This operation cannot be reversed. A share cannot be deleted if it: +// - has share mount targets +// - has a `lifecycle_state` of `updating` +// - has a replication operation in progress +// +// If the request is accepted, the share `lifecycle_state` will be set to `deleting`. Once deletion processing +// completes, it will no longer be retrievable. +func (vpc *VpcV1) DeleteShare(deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteShareWithContext(context.Background(), deleteShareOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// DeleteSnapshotWithContext is an alternate form of the DeleteSnapshot method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotOptions, "deleteSnapshotOptions cannot be nil") +// DeleteShareWithContext is an alternate form of the DeleteShare method which supports a Context parameter +func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareOptions, "deleteShareOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") + err = core.ValidateStruct(deleteShareOptions, "deleteShareOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteSnapshotOptions.ID, + "id": *deleteShareOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSnapshotOptions.Headers { + for headerName, headerValue := range deleteShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteSnapshotOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch)) + builder.AddHeader("Accept", "application/json") + if deleteShareOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteShareOptions.IfMatch)) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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) - - return -} - -// DeleteSnapshotClone : Delete a snapshot clone -// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated -// from the snapshot. -func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) -} - -// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "id": *deleteSnapshotCloneOptions.ID, - "zone_name": *deleteSnapshotCloneOptions.ZoneName, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "delete_share", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - - for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result } - response, err = vpc.Service.Request(request, nil) - return } -// DeleteSnapshotConsistencyGroup : Delete a snapshot consistency group -// This request deletes snapshot consistency group. This operation cannot be reversed. If the -// `delete_snapshots_on_delete` property is `true`, all snapshots in the consistency group will also be deleted. -func (vpc *VpcV1) DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotConsistencyGroupWithContext(context.Background(), deleteSnapshotConsistencyGroupOptions) +// DeleteShareMountTarget : Delete a share mount target +// This request deletes a share mount target. This operation cannot be reversed. +// +// If the request is accepted, the share mount target `lifecycle_state` will be set to +// `deleting`. Once deletion processing completes, it will no longer be retrievable. +func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// DeleteSnapshotConsistencyGroupWithContext is an alternate form of the DeleteSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions cannot be nil") +// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions") + err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteSnapshotConsistencyGroupOptions.ID, + "share_id": *deleteShareMountTargetOptions.ShareID, + "id": *deleteShareMountTargetOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range deleteShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_share_mount_target", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -14931,240 +16873,217 @@ func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, return } -// DeleteSnapshots : Delete a filtered collection of snapshots -// This request deletes all snapshots created from a specific source volume. -func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) -} - -// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") - if err != nil { - return - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) - if err != nil { - return - } - - for headerName, headerValue := range deleteSnapshotsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) - - request, err := builder.Build() - if err != nil { - return - } - - response, err = vpc.Service.Request(request, nil) - +// DeleteShareSource : Split the source file share from a replica share +// This request removes the replication relationship between a source share and the replica share specified by the +// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a +// `lifecycle_state` of `updating`, or has a replication operation in progress. +// +// This operation cannot be reversed. +func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) + err = core.RepurposeSDKProblem(err, "") return } -// GetSnapshot : Retrieve a snapshot -// This request retrieves a single snapshot specified by the identifier in the URL. -func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - return vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) -} - -// GetSnapshotWithContext is an alternate form of the GetSnapshot method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotOptions, "getSnapshotOptions cannot be nil") +// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter +func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") + err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSnapshotOptions.ID, + "share_id": *deleteShareSourceOptions.ShareID, } - 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, `/snapshots/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSnapshotOptions.Headers { + for headerName, headerValue := range deleteShareSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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) + response, err = vpc.Service.Request(request, nil) if err != nil { + core.EnrichHTTPProblem(err, "delete_share_source", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) - if err != nil { - return - } - response.Result = result - } return } -// GetSnapshotClone : Retrieve a snapshot clone -// This request retrieves a single clone specified by the snapshot identifier and zone name in the URL. -func (vpc *VpcV1) GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - return vpc.GetSnapshotCloneWithContext(context.Background(), getSnapshotCloneOptions) +// FailoverShare : Failover to replica file share +// This request triggers a failover to the replica file share specified by the identifier in the URL. The failover +// cannot be started if a source share or the replica share has a `lifecycle_state` of `updating`, or has a replication +// operation in progress. +// +// If `fallback_policy` is specified as `split`, and the request is accepted but the failover operation cannot be +// performed, a split will be triggered. +func (vpc *VpcV1) FailoverShare(failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.FailoverShareWithContext(context.Background(), failoverShareOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetSnapshotCloneWithContext is an alternate form of the GetSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotCloneOptions, "getSnapshotCloneOptions cannot be nil") +// FailoverShareWithContext is an alternate form of the FailoverShare method which supports a Context parameter +func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(failoverShareOptions, "failoverShareOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSnapshotCloneOptions, "getSnapshotCloneOptions") + err = core.ValidateStruct(failoverShareOptions, "failoverShareOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSnapshotCloneOptions.ID, - "zone_name": *getSnapshotCloneOptions.ZoneName, + "share_id": *failoverShareOptions.ShareID, } - 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, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/failover`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSnapshotCloneOptions.Headers { + for headerName, headerValue := range failoverShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - request, err := builder.Build() + body := make(map[string]interface{}) + if failoverShareOptions.FallbackPolicy != nil { + body["fallback_policy"] = failoverShareOptions.FallbackPolicy + } + if failoverShareOptions.Timeout != nil { + body["timeout"] = failoverShareOptions.Timeout + } + _, err = builder.SetBodyContentJSON(body) if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) + request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) - if err != nil { - return - } - response.Result = result + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "failover_share", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return } return } -// GetSnapshotConsistencyGroup : Retrieve a snapshot consistency group -// This request retrieves a single snapshot consistency group specified by the identifier in the URL. -func (vpc *VpcV1) GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - return vpc.GetSnapshotConsistencyGroupWithContext(context.Background(), getSnapshotConsistencyGroupOptions) +// GetShare : Retrieve a file share +// This request retrieves a single file share specified by the identifier in the URL. +func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareWithContext(context.Background(), getShareOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetSnapshotConsistencyGroupWithContext is an alternate form of the GetSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions cannot be nil") +// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter +func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions") + err = core.ValidateStruct(getShareOptions, "getShareOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSnapshotConsistencyGroupOptions.ID, + "id": *getShareOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range getShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_share", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15173,62 +17092,71 @@ func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, ge return } -// ListSnapshotClones : List all clones for a snapshot -// This request lists all clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. -func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - return vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) +// GetShareMountTarget : Retrieve a share mount target +// This request retrieves a single share mount target specified by the identifier in the URL. +func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") +// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") + err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *listSnapshotClonesOptions.ID, + "share_id": *getShareMountTargetOptions.ShareID, + "id": *getShareMountTargetOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSnapshotClonesOptions.Headers { + for headerName, headerValue := range getShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_share_mount_target", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15237,73 +17165,70 @@ func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapsho return } -// ListSnapshotConsistencyGroups : List all snapshot consistency groups -// This request lists all snapshot consistency groups in the region. A snapshot consistency group is a collection of -// individual snapshots taken at the same time. -func (vpc *VpcV1) ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { - return vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions) +// GetShareProfile : Retrieve a file share profile +// This request retrieves a single file share profile specified by the name in the URL. +func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListSnapshotConsistencyGroupsWithContext is an alternate form of the ListSnapshotConsistencyGroups method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSnapshotConsistencyGroupsOptions, "listSnapshotConsistencyGroupsOptions") +// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter +func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "name": *getShareProfileOptions.Name, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSnapshotConsistencyGroupsOptions.Headers { + for headerName, headerValue := range getShareProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSnapshotConsistencyGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Start)) - } - if listSnapshotConsistencyGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Limit)) - } - if listSnapshotConsistencyGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.ResourceGroupID)) - } - if listSnapshotConsistencyGroupsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Name)) - } - if listSnapshotConsistencyGroupsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Sort)) - } - if listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID)) - } 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_share_profile", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15312,121 +17237,71 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, return } -// ListSnapshots : List all snapshots -// This request lists all snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is -// created. -func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { - return vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) +// GetShareSource : Retrieve the source file share for a replica file share +// This request retrieves the source file share associated with the replica file share specified by the identifier in +// the URL. +func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") +// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter +func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "share_id": *getShareSourceOptions.ShareID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSnapshotsOptions.Headers { + for headerName, headerValue := range getShareSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSnapshotsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) - } - if listSnapshotsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) - } - if listSnapshotsOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag)) - } - if listSnapshotsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID)) - } - if listSnapshotsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name)) - } - if listSnapshotsOptions.SourceVolumeID != nil { - builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID)) - } - if listSnapshotsOptions.SourceVolumeCRN != nil { - builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN)) - } - if listSnapshotsOptions.SourceImageID != nil { - builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID)) - } - if listSnapshotsOptions.SourceImageCRN != nil { - builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN)) - } - if listSnapshotsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort)) - } - if listSnapshotsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) - } - if listSnapshotsOptions.CopiesID != nil { - builder.AddQuery("copies[].id", fmt.Sprint(*listSnapshotsOptions.CopiesID)) - } - if listSnapshotsOptions.CopiesName != nil { - builder.AddQuery("copies[].name", fmt.Sprint(*listSnapshotsOptions.CopiesName)) - } - if listSnapshotsOptions.CopiesCRN != nil { - builder.AddQuery("copies[].crn", fmt.Sprint(*listSnapshotsOptions.CopiesCRN)) - } - if listSnapshotsOptions.CopiesRemoteRegionName != nil { - builder.AddQuery("copies[].remote.region.name", fmt.Sprint(*listSnapshotsOptions.CopiesRemoteRegionName)) - } - if listSnapshotsOptions.SourceSnapshotID != nil { - builder.AddQuery("source_snapshot.id", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotID)) - } - if listSnapshotsOptions.SourceSnapshotRemoteRegionName != nil { - builder.AddQuery("source_snapshot.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotRemoteRegionName)) - } - if listSnapshotsOptions.SourceVolumeRemoteRegionName != nil { - builder.AddQuery("source_volume.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceVolumeRemoteRegionName)) - } - if listSnapshotsOptions.SourceImageRemoteRegionName != nil { - builder.AddQuery("source_image.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceImageRemoteRegionName)) - } - if listSnapshotsOptions.ClonesZoneName != nil { - builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName)) - } - if listSnapshotsOptions.SnapshotConsistencyGroupID != nil { - builder.AddQuery("snapshot_consistency_group.id", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupID)) - } - if listSnapshotsOptions.SnapshotConsistencyGroupCRN != nil { - builder.AddQuery("snapshot_consistency_group.crn", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupCRN)) - } 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_share_source", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15435,72 +17310,83 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt return } -// UpdateSnapshot : Update a snapshot -// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group -// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. -func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - return vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) +// ListShareMountTargets : List all mount targets for a file share +// This request retrieves all share mount targets for a file share. A share mount target is a network endpoint at which +// a file share may be mounted. The file share can be mounted by clients in the same VPC and zone after creating share +// mount targets. +// +// The share mount targets will be sorted by their `created_at` property values, with newest targets first. +func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter -func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") +// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter +func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") + err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateSnapshotOptions.ID, + "share_id": *listShareMountTargetsOptions.ShareID, } - 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, `/snapshots/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateSnapshotOptions.Headers { + for headerName, headerValue := range listShareMountTargetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSnapshotOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) - if err != nil { - return + if listShareMountTargetsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) + } + if listShareMountTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) + } + if listShareMountTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.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_share_mount_targets", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15509,73 +17395,72 @@ func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotO return } -// UpdateSnapshotConsistencyGroup : Update a snapshot consistency group -// This request updates a snapshot consistency group with the information in a provided snapshot consistency group -// patch. The snapshot consistency group patch object is structured in the same way as a retrieved snapshot consistency -// group and contains only the information to be updated. -func (vpc *VpcV1) UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - return vpc.UpdateSnapshotConsistencyGroupWithContext(context.Background(), updateSnapshotConsistencyGroupOptions) +// ListShareProfiles : List all file share profiles +// This request lists all [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) +// available in the region. A file share profile specifies the performance characteristics and pricing model for a file +// share. +func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// UpdateSnapshotConsistencyGroupWithContext is an alternate form of the UpdateSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions") +// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter +func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *updateSnapshotConsistencyGroupOptions.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, `/snapshot_consistency_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range listShareProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSnapshotConsistencyGroupOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotConsistencyGroupOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch) - if err != nil { - return + if listShareProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) + } + if listShareProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) + } + if listShareProfilesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) } 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_share_profiles", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15584,68 +17469,79 @@ func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, return } -// CreateShare : Create a file share -// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, -// a replica share, or both a source and replica share. -// -// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to -// provision the new file shares. -func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.CreateShareWithContext(context.Background(), createShareOptions) +// ListShares : List all file shares +// This request lists all file shares in the region. +func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSharesWithContext(context.Background(), listSharesOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter -func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(createShareOptions, "createShareOptions") +// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter +func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSharesOptions, "listSharesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/shares`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createShareOptions.Headers { + for headerName, headerValue := range listSharesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createShareOptions.SharePrototype) - if err != nil { - return + if listSharesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) + } + if listSharesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) + } + if listSharesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) + } + if listSharesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) + } + if listSharesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) + } + if listSharesOptions.ReplicationRole != nil { + builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) } 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_shares", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15654,71 +17550,81 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions return } -// CreateShareMountTarget : Create a mount target for a file share -// This request creates a new share mount target from a share mount target prototype object. -// -// The prototype object is structured in the same way as a retrieved share mount target, and contains the information -// necessary to provision the new file share mount target. -func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) +// UpdateShare : Update a file share +// This request updates a share with the information in a provided share patch. The share patch object is structured in +// the same way as a retrieved share and contains only the information to be updated. +func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateShareWithContext(context.Background(), updateShareOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") +// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter +func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") + err = core.ValidateStruct(updateShareOptions, "updateShareOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *createShareMountTargetOptions.ShareID, + "id": *updateShareOptions.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, `/shares/{share_id}/mount_targets`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createShareMountTargetOptions.Headers { + for headerName, headerValue := range updateShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") 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 updateShareOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateShareOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(createShareMountTargetOptions.ShareMountTargetPrototype) + _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) 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_share", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15727,71 +17633,80 @@ func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createS return } -// DeleteShare : Delete a file share -// This request deletes a share. This operation cannot be reversed. A share cannot be deleted if it: -// - has share mount targets -// - has a `lifecycle_state` of `updating` -// - has a replication operation in progress -// -// If the request is accepted, the share `lifecycle_state` will be set to `deleting`. Once deletion processing -// completes, it will no longer be retrievable. -func (vpc *VpcV1) DeleteShare(deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.DeleteShareWithContext(context.Background(), deleteShareOptions) +// UpdateShareMountTarget : Update a share mount target +// This request updates a share mount target with the information provided in a share mount target patch object. The +// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// DeleteShareWithContext is an alternate form of the DeleteShare method which supports a Context parameter -func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareOptions, "deleteShareOptions cannot be nil") +// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteShareOptions, "deleteShareOptions") + err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteShareOptions.ID, + "share_id": *updateShareMountTargetOptions.ShareID, + "id": *updateShareMountTargetOptions.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, `/shares/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteShareOptions.Headers { + for headerName, headerValue := range updateShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteShareOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteShareOptions.IfMatch)) - } + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateShareMountTargetOptions.ShareMountTargetPatch) + 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_share_mount_target", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15800,66 +17715,74 @@ func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions return } -// DeleteShareMountTarget : Delete a share mount target -// This request deletes a share mount target. This operation cannot be reversed. -// -// If the request is accepted, the share mount target `lifecycle_state` will be set to -// `deleting`. Once deletion processing completes, it will no longer be retrievable. -func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) +// CreateBackupPolicy : Create a backup policy +// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in +// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. +func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") +// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") + err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "share_id": *deleteShareMountTargetOptions.ShareID, - "id": *deleteShareMountTargetOptions.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, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteShareMountTargetOptions.Headers { + for headerName, headerValue := range createBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(createBackupPolicyOptions.BackupPolicyPrototype) + 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_backup_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -15868,188 +17791,268 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS return } -// DeleteShareSource : Split the source file share from a replica share -// This request removes the replication relationship between a source share and the replica share specified by the -// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a -// `lifecycle_state` of `updating`, or has a replication operation in progress. +// CreateBackupPolicyPlan : Create a plan for a backup policy +// This request creates a new backup policy plan from a backup policy plan prototype object. The prototype object is +// structured in the same way as a retrieved backup policy plan, and contains the information necessary to create the +// new backup policy plan. // -// This operation cannot be reversed. -func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) +// Backups created by this plan will use the resource group of the source being backed up. +// +// Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character +// suffix. +func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter -func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") +// CreateBackupPolicyPlanWithContext is an alternate form of the CreateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") + err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *deleteShareSourceOptions.ShareID, + "backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID, } - 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, `/shares/{share_id}/source`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteShareSourceOptions.Headers { + for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") 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("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createBackupPolicyPlanOptions.CronSpec != nil { + body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec + } + if createBackupPolicyPlanOptions.Active != nil { + body["active"] = createBackupPolicyPlanOptions.Active + } + if createBackupPolicyPlanOptions.AttachUserTags != nil { + body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags + } + if createBackupPolicyPlanOptions.ClonePolicy != nil { + body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy + } + if createBackupPolicyPlanOptions.CopyUserTags != nil { + body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags + } + if createBackupPolicyPlanOptions.DeletionTrigger != nil { + body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger + } + if createBackupPolicyPlanOptions.Name != nil { + body["name"] = createBackupPolicyPlanOptions.Name + } + if createBackupPolicyPlanOptions.RemoteRegionPolicies != nil { + body["remote_region_policies"] = createBackupPolicyPlanOptions.RemoteRegionPolicies + } + _, 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, "create_backup_policy_plan", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// FailoverShare : Failover to replica file share -// This request triggers a failover to the replica file share specified by the identifier in the URL. The failover -// cannot be started if a source share or the replica share has a `lifecycle_state` of `updating`, or has a replication -// operation in progress. +// DeleteBackupPolicy : Delete a backup policy +// This request deletes a backup policy. This operation cannot be reversed. // -// If `fallback_policy` is specified as `split`, and the request is accepted but the failover operation cannot be -// performed, a split will be triggered. -func (vpc *VpcV1) FailoverShare(failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { - return vpc.FailoverShareWithContext(context.Background(), failoverShareOptions) +// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, +// the backup policy will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// FailoverShareWithContext is an alternate form of the FailoverShare method which supports a Context parameter -func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(failoverShareOptions, "failoverShareOptions cannot be nil") +// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(failoverShareOptions, "failoverShareOptions") + err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *failoverShareOptions.ShareID, + "id": *deleteBackupPolicyOptions.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, `/shares/{share_id}/failover`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range failoverShareOptions.Headers { + for headerName, headerValue := range deleteBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Content-Type", "application/json") + builder.AddHeader("Accept", "application/json") + if deleteBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if failoverShareOptions.FallbackPolicy != nil { - body["fallback_policy"] = failoverShareOptions.FallbackPolicy - } - if failoverShareOptions.Timeout != nil { - body["timeout"] = failoverShareOptions.Timeout - } - _, err = builder.SetBodyContentJSON(body) + request, err := builder.Build() if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - request, err := builder.Build() + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + core.EnrichHTTPProblem(err, "delete_backup_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - - response, err = vpc.Service.Request(request, nil) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetShare : Retrieve a file share -// This request retrieves a single file share specified by the identifier in the URL. -func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.GetShareWithContext(context.Background(), getShareOptions) +// DeleteBackupPolicyPlan : Delete a backup policy plan +// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by +// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with +// the plan will run to completion before the plan is deleted. +// +// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing +// completes, the backup policy plan will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter -func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") +// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareOptions, "getShareOptions") + err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getShareOptions.ID, + "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, + "id": *deleteBackupPolicyPlanOptions.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, `/shares/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareOptions.Headers { + for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if deleteBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_backup_policy_plan", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16058,63 +18061,70 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS return } -// GetShareMountTarget : Retrieve a share mount target -// This request retrieves a single share mount target specified by the identifier in the URL. -func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) +// GetBackupPolicy : Retrieve a backup policy +// This request retrieves a single backup policy specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") +// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") + err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *getShareMountTargetOptions.ShareID, - "id": *getShareMountTargetOptions.ID, + "id": *getBackupPolicyOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareMountTargetOptions.Headers { + for headerName, headerValue := range getBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_backup_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16123,62 +18133,71 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo return } -// GetShareProfile : Retrieve a file share profile -// This request retrieves a single file share profile specified by the name in the URL. -func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { - return vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) +// GetBackupPolicyJob : Retrieve a backup policy job +// This request retrieves a single backup policy job specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter -func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") +// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") + err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getShareProfileOptions.Name, + "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, + "id": *getBackupPolicyJobOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareProfileOptions.Headers { + for headerName, headerValue := range getBackupPolicyJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_backup_policy_job", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16187,63 +18206,71 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil return } -// GetShareSource : Retrieve the source file share for a replica file share -// This request retrieves the source file share associated with the replica file share specified by the identifier in -// the URL. -func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { - return vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) +// GetBackupPolicyPlan : Retrieve a backup policy plan +// This request retrieves a single backup policy plan specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter -func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") +// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") + err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *getShareSourceOptions.ShareID, + "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, + "id": *getBackupPolicyPlanOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareSourceOptions.Headers { + for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_backup_policy_plan", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16252,75 +18279,77 @@ func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceO return } -// ListShareMountTargets : List all mount targets for a file share -// This request retrieves all share mount targets for a file share. A share mount target is a network endpoint at which -// a file share may be mounted. The file share can be mounted by clients in the same VPC and zone after creating share -// mount targets. -// -// The share mount targets will be sorted by their `created_at` property values, with newest targets first. -func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - return vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) +// ListBackupPolicies : List all backup policies +// This request lists all backup policies in the region. Backup policies control which sources are selected for backup +// and include a set of backup policy plans that provide the backup schedules and deletion triggers. +func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter -func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") +// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter +func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "share_id": *listShareMountTargetsOptions.ShareID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listShareMountTargetsOptions.Headers { + for headerName, headerValue := range listBackupPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listShareMountTargetsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) + if listBackupPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) } - if listShareMountTargetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) + if listBackupPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) } - if listShareMountTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) + if listBackupPoliciesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) + } + if listBackupPoliciesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) + } + if listBackupPoliciesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) } 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_backup_policies", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16329,65 +18358,95 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar return } -// ListShareProfiles : List all file share profiles -// This request lists all [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) -// available in the region. A file share profile specifies the performance characteristics and pricing model for a file -// share. -func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) +// ListBackupPolicyJobs : List all jobs for a backup policy +// This request retrieves all jobs for a backup policy. A backup job represents the execution of a backup policy plan +// for a resource matching the policy's criteria. +func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter -func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") +// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listShareProfilesOptions.Headers { + for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listShareProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) + if listBackupPolicyJobsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) } - if listShareProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) + if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) } - if listShareProfilesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) + if listBackupPolicyJobsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) + } + if listBackupPolicyJobsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) + } + if listBackupPolicyJobsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) + } + if listBackupPolicyJobsOptions.SourceID != nil { + builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { + builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { + builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) } 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_backup_policy_jobs", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16396,72 +18455,73 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro return } -// ListShares : List all file shares -// This request lists all file shares in the region. -func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { - return vpc.ListSharesWithContext(context.Background(), listSharesOptions) +// ListBackupPolicyPlans : List all plans for a backup policy +// This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. +func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter -func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSharesOptions, "listSharesOptions") +// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSharesOptions.Headers { + for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listSharesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) - } - if listSharesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) - } - if listSharesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) - } - if listSharesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) - } - if listSharesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) - } - if listSharesOptions.ReplicationRole != nil { - builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) + if listBackupPolicyPlansOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) } 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_backup_policy_plans", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16470,72 +18530,81 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * return } -// UpdateShare : Update a file share -// This request updates a share with the information in a provided share patch. The share patch object is structured in -// the same way as a retrieved share and contains only the information to be updated. -func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - return vpc.UpdateShareWithContext(context.Background(), updateShareOptions) +// UpdateBackupPolicy : Update a backup policy +// This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch +// object is structured in the same way as a retrieved backup policy and contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter -func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") +// UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateShareOptions, "updateShareOptions") + err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateShareOptions.ID, + "id": *updateBackupPolicyOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateShareOptions.Headers { + for headerName, headerValue := range updateBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateShareOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateShareOptions.IfMatch)) + if updateBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch)) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) + _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) 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_backup_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16544,71 +18613,82 @@ func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions return } -// UpdateShareMountTarget : Update a share mount target -// This request updates a share mount target with the information provided in a share mount target patch object. The -// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain -// only the information to be updated. -func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - return vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) +// UpdateBackupPolicyPlan : Update a backup policy plan +// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is +// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) + err = core.RepurposeSDKProblem(err, "") + return } -// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") +// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") + err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *updateShareMountTargetOptions.ShareID, - "id": *updateShareMountTargetOptions.ID, + "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, + "id": *updateBackupPolicyPlanOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateShareMountTargetOptions.Headers { + for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateShareMountTargetOptions.ShareMountTargetPatch) + _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) 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_backup_policy_plan", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16620,17 +18700,21 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS // GetRegion : Retrieve a region // This request retrieves a single region specified by the name in the URL. func (vpc *VpcV1) GetRegion(getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { - return vpc.GetRegionWithContext(context.Background(), getRegionOptions) + result, response, err = vpc.GetRegionWithContext(context.Background(), getRegionOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetRegionWithContext is an alternate form of the GetRegion method which supports a Context parameter func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getRegionOptions, "getRegionOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getRegionOptions, "getRegionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16643,6 +18727,7 @@ func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *Ge builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16657,22 +18742,25 @@ func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *Ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_region", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegion) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16684,17 +18772,21 @@ func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *Ge // GetRegionZone : Retrieve a zone // This request retrieves a single zone specified by the region and zone names in the URL. func (vpc *VpcV1) GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { - return vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) + result, response, err = vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetRegionZoneWithContext is an alternate form of the GetRegionZone method which supports a Context parameter func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getRegionZoneOptions, "getRegionZoneOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16708,6 +18800,7 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones/{name}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16722,22 +18815,25 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_region_zone", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16750,17 +18846,21 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt // This request lists all zones in a region. Zones represent logically-isolated data centers with high-bandwidth and // low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. func (vpc *VpcV1) ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { - return vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) + result, response, err = vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListRegionZonesWithContext is an alternate form of the ListRegionZones method which supports a Context parameter func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listRegionZonesOptions, "listRegionZonesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listRegionZonesOptions, "listRegionZonesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16773,6 +18873,7 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16787,22 +18888,25 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_region_zones", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16818,13 +18922,16 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone // available. Resources deployed within a single region also benefit from the low latency afforded by geographic // proximity. func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { - return vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) + result, response, err = vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16833,6 +18940,7 @@ func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16847,22 +18955,25 @@ func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_regions", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16889,17 +19000,21 @@ func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions // // A request body is not required, and if provided, is ignored. func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - return vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) + result, response, err = vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16913,6 +19028,7 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16927,22 +19043,25 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "add_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -16957,17 +19076,21 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, // The reserved IP must currently be unbound and in the primary IP's subnet. The virtual network interface's `target` // must not currently be a file share mount target. func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - return vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) + result, response, err = vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // AddVirtualNetworkInterfaceIPWithContext is an alternate form of the AddVirtualNetworkInterfaceIP method which supports a Context parameter func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -16981,6 +19104,7 @@ func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, a builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -16995,22 +19119,25 @@ func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, a builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "add_virtual_network_interface_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17024,17 +19151,21 @@ func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, a // object is structured in the same way as a retrieved virtual network interface, and contains the information necessary // to create the new virtual network interface. func (vpc *VpcV1) CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - return vpc.CreateVirtualNetworkInterfaceWithContext(context.Background(), createVirtualNetworkInterfaceOptions) + result, response, err = vpc.CreateVirtualNetworkInterfaceWithContext(context.Background(), createVirtualNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateVirtualNetworkInterfaceWithContext is an alternate form of the CreateVirtualNetworkInterface method which supports a Context parameter func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17043,6 +19174,7 @@ func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17058,7 +19190,6 @@ func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -17091,22 +19222,27 @@ func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, } _, 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_virtual_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17120,17 +19256,21 @@ func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, // virtual network interface must not be required by another resource, such as the primary network attachment for an // instance. func (vpc *VpcV1) DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) + response, err = vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteVirtualNetworkInterfacesWithContext is an alternate form of the DeleteVirtualNetworkInterfaces method which supports a Context parameter func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17143,6 +19283,7 @@ func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17156,15 +19297,20 @@ func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_virtual_network_interfaces", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -17173,17 +19319,21 @@ func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, // This request retrieves a specified floating IP if it is associated with the virtual network interface specified in // the URL. func (vpc *VpcV1) GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - return vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) + result, response, err = vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17197,6 +19347,7 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17211,22 +19362,25 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17238,17 +19392,21 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, // GetVirtualNetworkInterface : Retrieve a virtual network interface // This request retrieves a single virtual network interface specified by the identifier in the URL. func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - return vpc.GetVirtualNetworkInterfaceWithContext(context.Background(), getVirtualNetworkInterfaceOptions) + result, response, err = vpc.GetVirtualNetworkInterfaceWithContext(context.Background(), getVirtualNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVirtualNetworkInterfaceWithContext is an alternate form of the GetVirtualNetworkInterface method which supports a Context parameter func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17261,6 +19419,7 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, get builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17275,22 +19434,25 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, get builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_virtual_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17303,17 +19465,21 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, get // This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in // the URL. func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - return vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) + result, response, err = vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17327,6 +19493,7 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, g builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17341,22 +19508,25 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, g builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_virtual_network_interface_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17368,17 +19538,21 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, g // ListNetworkInterfaceFloatingIps : List all floating IPs associated with a virtual network interface // This request lists all floating IPs associated with a virtual network interface. func (vpc *VpcV1) ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) + result, response, err = vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListNetworkInterfaceFloatingIps method which supports a Context parameter func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17391,6 +19565,7 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17405,7 +19580,6 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listNetworkInterfaceFloatingIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start)) @@ -17419,17 +19593,21 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context 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_network_interface_floating_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17441,17 +19619,21 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context // ListVirtualNetworkInterfaceIps : List all reserved IPs bound to a virtual network interface // This request lists all reserved IPs bound to a virtual network interface. func (vpc *VpcV1) ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) + result, response, err = vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVirtualNetworkInterfaceIpsWithContext is an alternate form of the ListVirtualNetworkInterfaceIps method which supports a Context parameter func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17464,6 +19646,7 @@ func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17478,7 +19661,6 @@ func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVirtualNetworkInterfaceIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Start)) @@ -17492,17 +19674,21 @@ func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, 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_virtual_network_interface_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17519,13 +19705,16 @@ func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, // interfaces first. Virtual network interfaces with identical // `created_at` property values will in turn be sorted by ascending `name` property values. func (vpc *VpcV1) ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - return vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) + result, response, err = vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListVirtualNetworkInterfacesWithContext is an alternate form of the ListVirtualNetworkInterfaces method which supports a Context parameter func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listVirtualNetworkInterfacesOptions, "listVirtualNetworkInterfacesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17534,6 +19723,7 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17548,7 +19738,6 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVirtualNetworkInterfacesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) @@ -17562,17 +19751,21 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l 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_virtual_network_interfaces", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterfaceCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17584,17 +19777,21 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l // RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface // This request disassociates the specified floating IP from the specified virtual network interface. func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) + response, err = vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // RemoveNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveNetworkInterfaceFloatingIP method which supports a Context parameter func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17608,6 +19805,7 @@ func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17621,15 +19819,20 @@ func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "remove_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -17640,17 +19843,21 @@ func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Contex // // The reserved IP for the `primary_ip` cannot be unbound. func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveVirtualNetworkInterfaceIPWithContext(context.Background(), removeVirtualNetworkInterfaceIPOptions) + response, err = vpc.RemoveVirtualNetworkInterfaceIPWithContext(context.Background(), removeVirtualNetworkInterfaceIPOptions) + err = core.RepurposeSDKProblem(err, "") + return } // RemoveVirtualNetworkInterfaceIPWithContext is an alternate form of the RemoveVirtualNetworkInterfaceIP method which supports a Context parameter func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context, removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { err = core.ValidateNotNil(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17664,6 +19871,7 @@ func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17677,15 +19885,20 @@ func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "remove_virtual_network_interface_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -17695,17 +19908,21 @@ func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context // The virtual network interface patch object is structured in the same way as a retrieved virtual network interface and // contains only the information to be updated. func (vpc *VpcV1) UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - return vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) + result, response, err = vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateVirtualNetworkInterfaceWithContext is an alternate form of the UpdateVirtualNetworkInterface method which supports a Context parameter func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17718,6 +19935,7 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17733,27 +19951,31 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) 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_virtual_network_interface", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17770,17 +19992,21 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, // 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) { - return vpc.CreatePublicGatewayWithContext(context.Background(), createPublicGatewayOptions) + result, response, err = vpc.CreatePublicGatewayWithContext(context.Background(), createPublicGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17789,6 +20015,7 @@ func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPubl builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17804,7 +20031,6 @@ func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPubl builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -17825,22 +20051,27 @@ func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPubl } _, 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_public_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17854,17 +20085,21 @@ func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPubl // 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) { - return vpc.DeletePublicGatewayWithContext(context.Background(), deletePublicGatewayOptions) + response, err = vpc.DeletePublicGatewayWithContext(context.Background(), deletePublicGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deletePublicGatewayOptions, "deletePublicGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17877,6 +20112,7 @@ func (vpc *VpcV1) DeletePublicGatewayWithContext(ctx context.Context, deletePubl builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17890,15 +20126,20 @@ func (vpc *VpcV1) DeletePublicGatewayWithContext(ctx context.Context, deletePubl } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_public_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -17906,17 +20147,21 @@ func (vpc *VpcV1) DeletePublicGatewayWithContext(ctx context.Context, deletePubl // 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) { - return vpc.GetPublicGatewayWithContext(context.Background(), getPublicGatewayOptions) + result, response, err = vpc.GetPublicGatewayWithContext(context.Background(), getPublicGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getPublicGatewayOptions, "getPublicGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17929,6 +20174,7 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -17943,22 +20189,25 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_public_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -17972,13 +20221,16 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate // 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) { - return vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) + result, response, err = vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -17987,6 +20239,7 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18001,7 +20254,6 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listPublicGatewaysOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) @@ -18015,17 +20267,21 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG 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_public_gateways", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18037,17 +20293,21 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG // 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) { - return vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) + result, response, err = vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18060,6 +20320,7 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18075,27 +20336,31 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) 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_public_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18107,17 +20372,21 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl // 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) { - return vpc.CreateFloatingIPWithContext(context.Background(), createFloatingIPOptions) + result, response, err = vpc.CreateFloatingIPWithContext(context.Background(), createFloatingIPOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createFloatingIPOptions, "createFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18126,6 +20395,7 @@ func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatin builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18141,27 +20411,31 @@ func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatin builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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()) return } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + 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, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18174,17 +20448,21 @@ func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatin // 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) { - return vpc.DeleteFloatingIPWithContext(context.Background(), deleteFloatingIPOptions) + response, err = vpc.DeleteFloatingIPWithContext(context.Background(), deleteFloatingIPOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteFloatingIPOptions, "deleteFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18197,6 +20475,7 @@ func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatin builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18210,15 +20489,20 @@ func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatin } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -18226,17 +20510,21 @@ func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatin // 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) { - return vpc.GetFloatingIPWithContext(context.Background(), getFloatingIPOptions) + result, response, err = vpc.GetFloatingIPWithContext(context.Background(), getFloatingIPOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getFloatingIPOptions, "getFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18249,6 +20537,7 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18263,22 +20552,25 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18291,13 +20583,16 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt // This request lists all 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) { - return vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) + result, response, err = vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18306,6 +20601,7 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18320,7 +20616,6 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listFloatingIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listFloatingIpsOptions.Start)) @@ -18349,17 +20644,21 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp 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_floating_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18371,17 +20670,21 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp // 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) { - return vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) + result, response, err = vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18394,6 +20697,7 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18409,27 +20713,31 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateFloatingIPOptions.FloatingIPPatch) 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_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18443,17 +20751,21 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin // 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) { - return vpc.CreateNetworkACLWithContext(context.Background(), createNetworkACLOptions) + result, response, err = vpc.CreateNetworkACLWithContext(context.Background(), createNetworkACLOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18462,6 +20774,7 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18477,27 +20790,31 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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 } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + 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 @@ -18510,17 +20827,21 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork // 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) { - return vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) + result, response, err = vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18533,6 +20854,7 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -18548,27 +20870,31 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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 } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + 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 @@ -18581,17 +20907,21 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet // 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) { - return vpc.DeleteNetworkACLWithContext(context.Background(), deleteNetworkACLOptions) + response, err = vpc.DeleteNetworkACLWithContext(context.Background(), deleteNetworkACLOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteNetworkACLOptions, "deleteNetworkACLOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18604,6 +20934,7 @@ func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetwork builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18617,15 +20948,20 @@ func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetwork } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_network_acl", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -18633,17 +20969,21 @@ func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetwork // 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) { - return vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) + response, err = vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18657,6 +20997,7 @@ func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNet builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -18670,15 +21011,20 @@ func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNet } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_network_acl_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -18686,17 +21032,21 @@ func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNet // 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) { - return vpc.GetNetworkACLWithContext(context.Background(), getNetworkACLOptions) + result, response, err = vpc.GetNetworkACLWithContext(context.Background(), getNetworkACLOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getNetworkACLOptions, "getNetworkACLOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18709,6 +21059,7 @@ func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18723,22 +21074,25 @@ func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_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 @@ -18750,17 +21104,21 @@ func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOpt // 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) { - return vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) + result, response, err = vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18774,6 +21132,7 @@ func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkAC builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -18788,22 +21147,25 @@ func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkAC builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_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 @@ -18816,17 +21178,21 @@ func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkAC // This request lists all 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) { - return vpc.ListNetworkACLRulesWithContext(context.Background(), listNetworkACLRulesOptions) + result, response, err = vpc.ListNetworkACLRulesWithContext(context.Background(), listNetworkACLRulesOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listNetworkACLRulesOptions, "listNetworkACLRulesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18839,6 +21205,7 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -18853,7 +21220,6 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listNetworkACLRulesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listNetworkACLRulesOptions.Start)) @@ -18867,17 +21233,21 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor 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_network_acl_rules", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRuleCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18891,13 +21261,16 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor // 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) { - return vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) + result, response, err = vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18906,6 +21279,7 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18920,7 +21294,6 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listNetworkAclsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) @@ -18934,17 +21307,21 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl 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_network_acls", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18956,17 +21333,21 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl // 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) { - return vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) + result, response, err = vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) + 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") 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 } @@ -18979,6 +21360,7 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18994,27 +21376,31 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) 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_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 @@ -19027,17 +21413,21 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork // 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 information is not applicable to the rule's protocol. func (vpc *VpcV1) UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateNetworkACLRuleWithContext(context.Background(), updateNetworkACLRuleOptions) + result, response, err = vpc.UpdateNetworkACLRuleWithContext(context.Background(), updateNetworkACLRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19051,6 +21441,7 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19066,27 +21457,31 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateNetworkACLRuleOptions.NetworkACLRulePatch) 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_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 @@ -19101,17 +21496,21 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet // 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) { - return vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions) + result, response, err = vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createSecurityGroupOptions, "createSecurityGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19120,6 +21519,7 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19135,7 +21535,6 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -19153,22 +21552,27 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu } _, 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_security_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19185,17 +21589,21 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu // 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) { - return vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) + result, response, err = vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19208,6 +21616,7 @@ func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, create builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19223,27 +21632,31 @@ func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, create builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) 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_security_group_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19265,17 +21678,21 @@ func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, create // 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) { - return vpc.CreateSecurityGroupTargetBindingWithContext(context.Background(), createSecurityGroupTargetBindingOptions) + 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(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19289,6 +21706,7 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19303,22 +21721,25 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "create_security_group_target_binding", 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 @@ -19331,17 +21752,21 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex // 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) { - return vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) + response, err = vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19354,6 +21779,7 @@ func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecu builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19367,15 +21793,20 @@ func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecu } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_security_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -19384,17 +21815,21 @@ func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecu // 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) { - return vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) + response, err = vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19408,6 +21843,7 @@ func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, delete builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19421,15 +21857,20 @@ func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, delete } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_security_group_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -19448,17 +21889,21 @@ func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, delete // 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) { - return vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) + response, err = vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19472,6 +21917,7 @@ func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19485,15 +21931,20 @@ func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_security_group_target_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -19501,17 +21952,21 @@ func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Contex // 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) { - return vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) + result, response, err = vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19524,6 +21979,7 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19538,22 +21994,25 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_security_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19565,17 +22024,21 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr // 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) { - return vpc.GetSecurityGroupRuleWithContext(context.Background(), getSecurityGroupRuleOptions) + result, response, err = vpc.GetSecurityGroupRuleWithContext(context.Background(), getSecurityGroupRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19589,6 +22052,7 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19603,22 +22067,25 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_security_group_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19631,17 +22098,21 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri // 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) { - return vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) + result, response, err = vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19655,6 +22126,7 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19669,22 +22141,25 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_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 @@ -19698,17 +22173,21 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu // 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) { - return vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) + result, response, err = vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19721,6 +22200,7 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19735,22 +22215,25 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_security_group_rules", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19763,17 +22246,21 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec // This request lists all 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) { - return vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) + result, response, err = vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19786,6 +22273,7 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -19800,7 +22288,6 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listSecurityGroupTargetsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) @@ -19811,17 +22298,21 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS 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_security_group_targets", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19836,13 +22327,16 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS // 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) { - return vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) + result, response, err = vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19851,6 +22345,7 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19865,7 +22360,6 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listSecurityGroupsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSecurityGroupsOptions.Start)) @@ -19888,17 +22382,21 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit 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_security_groups", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19912,17 +22410,21 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit // 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) { - return vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) + result, response, err = vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19935,6 +22437,7 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19950,27 +22453,31 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateSecurityGroupOptions.SecurityGroupPatch) 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_security_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19984,17 +22491,21 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu // object contains only the information to be updated. The request will fail if the information is not applicable to the // rule's protocol. func (vpc *VpcV1) UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) + result, response, err = vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20008,6 +22519,7 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -20023,27 +22535,31 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) 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_security_group_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -20058,17 +22574,21 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) AddVPNGatewayConnectionsLocalCIDR(addVPNGatewayConnectionsLocalCIDROptions *AddVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.AddVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionsLocalCIDROptions) + response, err = vpc.AddVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionsLocalCIDROptions) + 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") 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 } @@ -20083,6 +22603,7 @@ func (vpc *VpcV1) AddVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Conte builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -20096,15 +22617,20 @@ func (vpc *VpcV1) AddVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Conte } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "add_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -20115,17 +22641,21 @@ func (vpc *VpcV1) AddVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Conte // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDR(addVPNGatewayConnectionsPeerCIDROptions *AddVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.AddVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionsPeerCIDROptions) + response, err = vpc.AddVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionsPeerCIDROptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20140,6 +22670,7 @@ func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -20153,15 +22684,20 @@ func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "add_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -20171,17 +22707,21 @@ func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Contex // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) CheckVPNGatewayConnectionsLocalCIDR(checkVPNGatewayConnectionsLocalCIDROptions *CheckVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.CheckVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionsLocalCIDROptions) + response, err = vpc.CheckVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionsLocalCIDROptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20196,6 +22736,7 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Con builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -20209,15 +22750,20 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Con } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "check_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -20227,17 +22773,21 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Con // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) CheckVPNGatewayConnectionsPeerCIDR(checkVPNGatewayConnectionsPeerCIDROptions *CheckVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.CheckVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionsPeerCIDROptions) + response, err = vpc.CheckVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionsPeerCIDROptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20252,6 +22802,7 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Cont builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -20265,15 +22816,20 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Cont } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "check_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -20281,17 +22837,21 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Cont // 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) { - return vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) + result, response, err = vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20300,6 +22860,7 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20315,7 +22876,6 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -20342,22 +22902,27 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic } _, 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_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 @@ -20369,17 +22934,21 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic // 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) { - return vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) + result, response, err = vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20388,6 +22957,7 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20403,7 +22973,6 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -20427,22 +22996,27 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP } _, 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_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 @@ -20454,17 +23028,21 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP // 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) { - return vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) + result, response, err = vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20473,6 +23051,7 @@ func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGate builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20488,27 +23067,31 @@ func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGate builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) 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_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 @@ -20520,17 +23103,21 @@ func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGate // 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) { - return vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) + result, response, err = vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20543,6 +23130,7 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -20558,27 +23146,31 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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) if err != nil { + 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 @@ -20591,17 +23183,21 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre // 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) { - return vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) + response, err = vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20614,6 +23210,7 @@ func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolic builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20627,15 +23224,20 @@ func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolic } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_ike_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -20644,17 +23246,21 @@ func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolic // 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) { - return vpc.DeleteIpsecPolicyWithContext(context.Background(), deleteIpsecPolicyOptions) + response, err = vpc.DeleteIpsecPolicyWithContext(context.Background(), deleteIpsecPolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20667,6 +23273,7 @@ func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20680,15 +23287,20 @@ func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecP } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_ipsec_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -20698,17 +23310,21 @@ func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecP // 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) { - return vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) + response, err = vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20721,6 +23337,7 @@ func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGate builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20734,15 +23351,20 @@ func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGate } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -20751,17 +23373,21 @@ func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGate // 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) { - return vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) + response, err = vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20775,6 +23401,7 @@ func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, del builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -20788,15 +23415,20 @@ func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, del } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_gateway_connection", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -20804,17 +23436,21 @@ func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, del // 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) { - return vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) + result, response, err = vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20827,6 +23463,7 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20841,22 +23478,25 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_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 @@ -20868,17 +23508,21 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio // 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) { - return vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) + result, response, err = vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) + 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") 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 } @@ -20891,6 +23535,7 @@ func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20905,22 +23550,25 @@ func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyO builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_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 @@ -20932,17 +23580,21 @@ func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyO // 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) { - return vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) + result, response, err = vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -20955,6 +23607,7 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -20969,22 +23622,25 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_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 @@ -20996,17 +23652,21 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt // 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) { - return vpc.GetVPNGatewayConnectionWithContext(context.Background(), getVPNGatewayConnectionOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21020,6 +23680,7 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -21034,22 +23695,25 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_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 @@ -21061,13 +23725,16 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN // ListIkePolicies : List all IKE policies // This request lists all IKE policies in the region. func (vpc *VpcV1) ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) + result, response, err = vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21076,6 +23743,7 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21090,7 +23758,6 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listIkePoliciesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listIkePoliciesOptions.Start)) @@ -21101,17 +23768,21 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie 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_ike_policies", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -21123,17 +23794,21 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie // ListIkePolicyConnections : List all VPN gateway connections that use a specified IKE policy // This request lists all VPN gateway connections that use a policy. func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) + result, response, err = vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) + 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 *VPNGatewayConnectionCollection, 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(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21146,6 +23821,7 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -21160,22 +23836,25 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_ike_policy_connections", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -21187,13 +23866,16 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI // ListIpsecPolicies : List all IPsec policies // This request lists all IPsec policies in the region. func (vpc *VpcV1) ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) + result, response, err = vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21202,6 +23884,7 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21216,7 +23899,6 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listIpsecPoliciesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listIpsecPoliciesOptions.Start)) @@ -21227,17 +23909,21 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol 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_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 @@ -21249,17 +23935,21 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol // ListIpsecPolicyConnections : List all VPN gateway connections that use a specified IPsec policy // This request lists all VPN gateway connections that use a policy. func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) + result, response, err = vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) + 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 *VPNGatewayConnectionCollection, 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(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21272,6 +23962,7 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis 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 } @@ -21286,22 +23977,25 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_ipsec_policy_connections", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -21313,17 +24007,21 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis // ListVPNGatewayConnections : List all connections of a VPN gateway // This request lists all connections of a VPN gateway. func (vpc *VpcV1) ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) + result, response, err = vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21336,6 +24034,7 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -21350,7 +24049,6 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPNGatewayConnectionsOptions.Status != nil { builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) @@ -21358,17 +24056,21 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list 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_vpn_gateway_connections", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -21382,17 +24084,21 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRs(listVPNGatewayConnectionsLocalCIDRsOptions *ListVPNGatewayConnectionsLocalCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionsLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionsLocalCIDRsOptions) + result, response, err = vpc.ListVPNGatewayConnectionsLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionsLocalCIDRsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21406,6 +24112,7 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRsWithContext(ctx context.Con builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -21420,22 +24127,25 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRsWithContext(ctx context.Con builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "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, UnmarshalVPNGatewayConnectionCIDRs) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -21449,17 +24159,21 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRsWithContext(ctx context.Con // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRs(listVPNGatewayConnectionsPeerCIDRsOptions *ListVPNGatewayConnectionsPeerCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewayConnectionsPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionsPeerCIDRsOptions) + result, response, err = vpc.ListVPNGatewayConnectionsPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionsPeerCIDRsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21473,6 +24187,7 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRsWithContext(ctx context.Cont builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -21487,22 +24202,25 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRsWithContext(ctx context.Cont builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "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, UnmarshalVPNGatewayConnectionCIDRs) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -21514,13 +24232,16 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRsWithContext(ctx context.Cont // ListVPNGateways : List all VPN gateways // This request lists all VPN gateways in the region. func (vpc *VpcV1) ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNGatewaysWithContext(context.Background(), listVPNGatewaysOptions) + 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 } @@ -21529,6 +24250,7 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21543,7 +24265,6 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPNGatewaysOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPNGatewaysOptions.Start)) @@ -21563,17 +24284,21 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway 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_vpn_gateways", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -21587,17 +24312,21 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDR(removeVPNGatewayConnectionsLocalCIDROptions *RemoveVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionsLocalCIDROptions) + response, err = vpc.RemoveVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionsLocalCIDROptions) + 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") 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 } @@ -21612,6 +24341,7 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Co builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -21625,15 +24355,20 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Co } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "remove_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -21643,17 +24378,21 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDRWithContext(ctx context.Co // // This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) RemoveVPNGatewayConnectionsPeerCIDR(removeVPNGatewayConnectionsPeerCIDROptions *RemoveVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionsPeerCIDROptions) + response, err = vpc.RemoveVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionsPeerCIDROptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21668,6 +24407,7 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Con builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -21681,15 +24421,20 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Con } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "remove_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -21697,17 +24442,21 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Con // 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) { - return vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) + result, response, err = vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21720,6 +24469,7 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21735,27 +24485,31 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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 } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + 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 @@ -21767,17 +24521,21 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic // 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) { - return vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) + result, response, err = vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21790,6 +24548,7 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21805,27 +24564,31 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) 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_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 @@ -21837,17 +24600,21 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP // 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) { - return vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) + result, response, err = vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21860,6 +24627,7 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -21875,27 +24643,31 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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 } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + 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 @@ -21907,17 +24679,21 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate // 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) { - return vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) + result, response, err = vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21931,6 +24707,7 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -21946,27 +24723,31 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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 } 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_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 @@ -21978,17 +24759,21 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd // 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) { - return vpc.CreateVPNServerWithContext(context.Background(), createVPNServerOptions) + result, response, err = vpc.CreateVPNServerWithContext(context.Background(), createVPNServerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -21997,6 +24782,7 @@ func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -22012,7 +24798,6 @@ func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServe builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -22054,22 +24839,27 @@ func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServe } _, 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_vpn_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22084,17 +24874,21 @@ func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServe // route matching their specified destinations. All VPN routes must be unique within the VPN server. destination of the // packet. func (vpc *VpcV1) CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { - return vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) + result, response, err = vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22107,6 +24901,7 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22122,7 +24917,6 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -22137,22 +24931,27 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN } _, 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_vpn_server_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22164,17 +24963,21 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN // 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) { - return vpc.DeleteVPNServerWithContext(context.Background(), deleteVPNServerOptions) + response, err = vpc.DeleteVPNServerWithContext(context.Background(), deleteVPNServerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22187,6 +24990,7 @@ func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -22203,15 +25007,20 @@ func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServe } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -22221,17 +25030,21 @@ func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServe // 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) { - return vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) + response, err = vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22245,6 +25058,7 @@ func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22258,15 +25072,20 @@ func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVP } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_client", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -22274,17 +25093,21 @@ func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVP // 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) { - return vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) + response, err = vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22298,6 +25121,7 @@ func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPN builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22311,15 +25135,20 @@ func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPN } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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 } @@ -22329,17 +25158,21 @@ func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPN // 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) { - return vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) + response, err = vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22353,6 +25186,7 @@ func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnect builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22366,15 +25200,20 @@ func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnect } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "disconnect_vpn_client", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -22382,17 +25221,21 @@ func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnect // 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) { - return vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) + result, response, err = vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22405,6 +25248,7 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -22419,22 +25263,25 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpn_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22446,17 +25293,21 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio // 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) { - return vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) + result, response, err = vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22470,6 +25321,7 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22484,22 +25336,25 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpn_server_client", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22512,17 +25367,21 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe // 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) { - return vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) + result, response, err = vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22535,6 +25394,7 @@ func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22549,15 +25409,20 @@ func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context builder.AddHeader("Accept", "text/plain") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, &result) + if err != nil { + core.EnrichHTTPProblem(err, "get_vpn_server_client_configuration", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -22565,17 +25430,21 @@ func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context // 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) { - return vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions) + 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 } @@ -22589,6 +25458,7 @@ func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServer builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22603,22 +25473,25 @@ func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServer builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_vpn_server_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22631,17 +25504,21 @@ func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServer // This request retrieves all 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) { - return vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) + result, response, err = vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22654,6 +25531,7 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22668,7 +25546,6 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPNServerClientsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPNServerClientsOptions.Start)) @@ -22682,17 +25559,21 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe 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_vpn_server_clients", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22706,17 +25587,21 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe // 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) { - return vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) + result, response, err = vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22729,6 +25614,7 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22743,7 +25629,6 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPNServerRoutesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPNServerRoutesOptions.Start)) @@ -22757,17 +25642,21 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer 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_vpn_server_routes", 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 @@ -22779,13 +25668,16 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer // ListVPNServers : List all VPN servers // This request lists all VPN servers. func (vpc *VpcV1) ListVPNServers(listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { - return vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) + result, response, err = vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22794,6 +25686,7 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -22808,7 +25701,6 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listVPNServersOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name)) @@ -22828,17 +25720,21 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO 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_vpn_servers", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22851,17 +25747,21 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO // This request updates the properties of an existing VPN server. Any property changes will cause all connected VPN // clients are disconnected from this VPN server except for the name change. func (vpc *VpcV1) UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { - return vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) + result, response, err = vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22874,6 +25774,7 @@ func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServe builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -22892,27 +25793,31 @@ func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServe } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) 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_vpn_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22925,17 +25830,21 @@ func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServe // 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) { - return vpc.UpdateVPNServerRouteWithContext(context.Background(), updateVPNServerRouteOptions) + result, response, err = vpc.UpdateVPNServerRouteWithContext(context.Background(), updateVPNServerRouteOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -22949,6 +25858,7 @@ func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPN builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -22964,27 +25874,31 @@ func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPN builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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()) return } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + 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, UnmarshalVPNServerRoute) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -22996,17 +25910,21 @@ func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPN // 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) { - return vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) + 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 } @@ -23015,6 +25933,7 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -23030,7 +25949,6 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -23069,22 +25987,27 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB } _, 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", 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 @@ -23096,17 +26019,21 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB // 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) { - return vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) + result, response, err = vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23119,6 +26046,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre 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 } @@ -23134,7 +26062,6 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -23173,22 +26100,27 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre } _, 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", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -23202,17 +26134,21 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre // 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) { - return vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) + result, response, err = vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23226,6 +26162,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23241,7 +26178,6 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -23262,22 +26198,27 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex } _, 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", 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 @@ -23289,17 +26230,21 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex // 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) { - return vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) + result, response, err = vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23314,6 +26259,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co 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 } @@ -23329,7 +26275,6 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -23347,22 +26292,27 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co } _, 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 @@ -23374,17 +26324,21 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co // 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) { - return vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) + result, response, err = vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23397,6 +26351,7 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23412,7 +26367,6 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -23439,22 +26393,27 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL } _, 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_pool", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -23466,17 +26425,21 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL // 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) { - return vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) + result, response, err = vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23490,6 +26453,7 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c 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 } @@ -23505,7 +26469,6 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -23520,22 +26483,27 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c } _, 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_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 @@ -23548,17 +26516,21 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c // 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) { - return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) + response, err = vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23571,6 +26543,7 @@ func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadB builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -23587,15 +26560,20 @@ func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadB } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_load_balancer", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -23604,17 +26582,21 @@ func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadB // 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) { - return vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) + response, err = vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23628,6 +26610,7 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, del builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23641,15 +26624,20 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, del } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_load_balancer_listener", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -23657,17 +26645,21 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, del // 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) { - return vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) + response, err = vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23682,6 +26674,7 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23695,15 +26688,20 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_load_balancer_listener_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -23711,17 +26709,21 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Contex // 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) { - return vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) + 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 } @@ -23737,6 +26739,7 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Co 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) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -23750,15 +26753,20 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Co } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_load_balancer_listener_policy_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -23767,17 +26775,21 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Co // 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) { - return vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) + response, err = vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23791,6 +26803,7 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteL builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23804,15 +26817,20 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteL } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_load_balancer_pool", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -23820,17 +26838,21 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteL // 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) { - return vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) + response, err = vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23845,6 +26867,7 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, d builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23858,15 +26881,20 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, d } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_load_balancer_pool_member", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -23874,17 +26902,21 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, d // 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) { - return vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) + result, response, err = vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23897,6 +26929,7 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -23911,22 +26944,25 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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", 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 @@ -23938,17 +26974,21 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance // 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) { - return vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) + result, response, err = vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -23962,6 +27002,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -23976,22 +27017,25 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_listener", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -24003,17 +27047,21 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa // 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) { - return vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) + result, response, err = vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24028,6 +27076,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24042,22 +27091,25 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_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 @@ -24069,17 +27121,21 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, // 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) { - return vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) + result, response, err = vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24095,6 +27151,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte 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) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -24109,22 +27166,25 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_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 @@ -24136,17 +27196,21 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte // 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) { - return vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) + result, response, err = vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24160,6 +27224,7 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24174,22 +27239,25 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_pool", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -24201,17 +27269,21 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal // 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) { - return vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) + result, response, err = vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24226,6 +27298,7 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24240,22 +27313,25 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_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 @@ -24267,17 +27343,21 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL // 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) { - return vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) + 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(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24290,6 +27370,7 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24304,22 +27385,25 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_profile", 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 @@ -24331,17 +27415,21 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad // GetLoadBalancerStatistics : List all 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) { - return vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) + result, response, err = vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24354,6 +27442,7 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24368,22 +27457,25 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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 @@ -24396,17 +27488,21 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL // This request lists all 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) { - return vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) + result, response, err = vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) + 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") 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 } @@ -24420,6 +27516,7 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24434,22 +27531,25 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_load_balancer_listener_policies", 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 @@ -24461,17 +27561,21 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex // ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy // This request lists all rules of a load balancer listener policy. func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) + result, response, err = vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24486,6 +27590,7 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con 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 } @@ -24500,22 +27605,25 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "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, UnmarshalLoadBalancerListenerPolicyRuleCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -24527,17 +27635,21 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con // ListLoadBalancerListeners : List all listeners for a load balancer // This request lists all listeners for a load balancer. func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) + 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 } @@ -24550,6 +27662,7 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list 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 } @@ -24564,22 +27677,25 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_load_balancer_listeners", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -24591,17 +27707,21 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list // ListLoadBalancerPoolMembers : List all members of a load balancer pool // This request lists all members of a load balancer pool. func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) + result, response, err = vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) + 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") 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 } @@ -24615,6 +27735,7 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li 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 } @@ -24629,22 +27750,25 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_load_balancer_pool_members", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -24656,17 +27780,21 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li // ListLoadBalancerPools : List all pools of a load balancer // This request lists all pools of a load balancer. func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) + result, response, err = vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) + 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") 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 } @@ -24679,6 +27807,7 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -24693,22 +27822,25 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "list_load_balancer_pools", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -24721,13 +27853,16 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad // This request lists all 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) { - return vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) + result, response, err = vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24736,6 +27871,7 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL 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 } @@ -24750,7 +27886,6 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listLoadBalancerProfilesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) @@ -24761,17 +27896,21 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL 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 @@ -24783,13 +27922,16 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL // ListLoadBalancers : List all load balancers // This request lists all load balancers in the region. func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) + result, response, err = vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24798,6 +27940,7 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -24812,7 +27955,6 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listLoadBalancersOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listLoadBalancersOptions.Start)) @@ -24823,17 +27965,21 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala 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 @@ -24846,17 +27992,21 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala // 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) { - return vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) + 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 } @@ -24870,6 +28020,7 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, 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 } @@ -24885,7 +28036,6 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -24894,22 +28044,27 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, } _, 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, "replace_load_balancer_pool_members", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -24923,17 +28078,21 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, // 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) { - return vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) + result, response, err = vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -24946,6 +28105,7 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -24964,27 +28124,31 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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) if err != nil { + 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, UnmarshalLoadBalancer) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -24996,17 +28160,21 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB // 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) { - return vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) + result, response, err = vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25020,6 +28188,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25035,27 +28204,31 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) 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_load_balancer_listener", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -25068,17 +28241,21 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd // 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) { - return vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) + result, response, err = vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25093,6 +28270,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25108,27 +28286,31 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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) if err != nil { + 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, UnmarshalLoadBalancerListenerPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -25140,17 +28322,21 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex // 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) { - return vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) + result, response, err = vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25166,6 +28352,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co 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) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -25181,27 +28368,31 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) 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_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 @@ -25213,17 +28404,21 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co // 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) { - return vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) + result, response, err = vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25237,6 +28432,7 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25252,27 +28448,31 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) 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_load_balancer_pool", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -25284,17 +28484,21 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL // 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) { - return vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) + result, response, err = vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25309,6 +28513,7 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25324,27 +28529,31 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) 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_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 @@ -25359,17 +28568,21 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u // - 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) { - return vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) + result, response, err = vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25383,6 +28596,7 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25397,22 +28611,25 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "add_endpoint_gateway_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -25425,17 +28642,21 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi // 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) { - return vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) + result, response, err = vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25444,6 +28665,7 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -25459,7 +28681,6 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -25486,22 +28707,27 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn } _, 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_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 @@ -25516,17 +28742,21 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn // 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) { - return vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) + response, err = vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25539,6 +28769,7 @@ func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEn 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 } @@ -25552,15 +28783,20 @@ func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEn } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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 } @@ -25568,17 +28804,21 @@ func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEn // 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) { - return vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) + 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 } @@ -25591,6 +28831,7 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint 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 } @@ -25605,22 +28846,25 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_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 @@ -25632,17 +28876,21 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint // 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) { - return vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) + result, response, err = vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25656,6 +28904,7 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25670,22 +28919,25 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_endpoint_gateway_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -25697,17 +28949,21 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi // ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway // This request lists all reserved IPs bound to an endpoint gateway. func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { - return vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) + result, response, err = vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25720,6 +28976,7 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25734,7 +28991,6 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listEndpointGatewayIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listEndpointGatewayIpsOptions.Start)) @@ -25748,17 +29004,21 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd 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_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 @@ -25771,13 +29031,16 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd // This request lists all 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) { - return vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) + result, response, err = vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25786,6 +29049,7 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -25800,7 +29064,6 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listEndpointGatewaysOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listEndpointGatewaysOptions.Name)) @@ -25829,17 +29092,21 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo 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_endpoint_gateways", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -25852,17 +29119,21 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo // 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) { - return vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) + response, err = vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25876,6 +29147,7 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -25889,15 +29161,20 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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, "remove_endpoint_gateway_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -25905,17 +29182,21 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove // 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) { - return vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) + result, response, err = vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -25928,6 +29209,7 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn 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 } @@ -25943,27 +29225,31 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) _, err = builder.SetBodyContentJSON(updateEndpointGatewayOptions.EndpointGatewayPatch) 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_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 @@ -25977,17 +29263,21 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn // 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) { - return vpc.CreateFlowLogCollectorWithContext(context.Background(), createFlowLogCollectorOptions) + 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 } @@ -25996,6 +29286,7 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -26011,7 +29302,6 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) @@ -26032,22 +29322,27 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF } _, 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_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 @@ -26061,17 +29356,21 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF // // 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) { - return vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) + response, err = vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -26084,6 +29383,7 @@ func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteF builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -26097,15 +29397,20 @@ func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteF } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_flow_log_collector", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } return } @@ -26113,17 +29418,21 @@ func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteF // 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) { - return vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) + result, response, err = vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -26136,6 +29445,7 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -26150,22 +29460,25 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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_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 @@ -26178,13 +29491,16 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog // This request lists all flow log collectors in the region. A flow log collector summarizes data sent over the instance // network interfaces and instance network attachments contained within its target. func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { - return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) + result, response, err = vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -26193,6 +29509,7 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -26207,7 +29524,6 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) if listFlowLogCollectorsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listFlowLogCollectorsOptions.Start)) @@ -26239,17 +29555,21 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow 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 @@ -26263,17 +29583,21 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow // 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) { - return vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) + result, response, err = vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) + 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") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -26286,6 +29610,7 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, 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 } @@ -26301,27 +29626,31 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("maturity", fmt.Sprint("development")) 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 } var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { + 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 @@ -26329,6 +29658,9 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF return } +func getServiceComponentInfo() *core.ProblemComponent { + return core.NewProblemComponent(DefaultServiceName, "2023-12-05") +} // AccountReference : AccountReference struct type AccountReference struct { @@ -26350,10 +29682,12 @@ func UnmarshalAccountReference(m map[string]json.RawMessage, result interface{}) 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)) @@ -26728,34 +30062,42 @@ func UnmarshalAddressPrefix(m map[string]json.RawMessage, result interface{}) (e 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)) @@ -26786,22 +30128,27 @@ func UnmarshalAddressPrefixCollection(m map[string]json.RawMessage, result inter 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, UnmarshalAddressPrefixCollectionFirst) 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, UnmarshalAddressPrefixCollectionNext) 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)) @@ -26814,8 +30161,11 @@ func (resp *AddressPrefixCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -26831,6 +30181,7 @@ func UnmarshalAddressPrefixCollectionFirst(m map[string]json.RawMessage, result obj := new(AddressPrefixCollectionFirst) 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)) @@ -26848,6 +30199,7 @@ func UnmarshalAddressPrefixCollectionNext(m map[string]json.RawMessage, result i obj := new(AddressPrefixCollectionNext) 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)) @@ -26870,10 +30222,12 @@ func UnmarshalAddressPrefixPatch(m map[string]json.RawMessage, result interface{ 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)) @@ -26887,6 +30241,9 @@ func (addressPrefixPatch *AddressPrefixPatch) AsPatch() (_patch map[string]inter if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -26902,19 +30259,15 @@ type BackupPolicy struct { CRN *string `json:"crn" validate:"required"` // The reasons for the current `health_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. HealthReasons []BackupPolicyHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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. @@ -26934,9 +30287,8 @@ type BackupPolicy struct { // 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 in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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 @@ -26962,20 +30314,19 @@ type BackupPolicy struct { // - `boot_volume`: Include the instance's boot volume. // - `data_volumes`: Include the instance's data volumes. // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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. +// 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" @@ -26999,9 +30350,8 @@ const ( // 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 in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected -// property value was encountered. +// 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" @@ -27033,66 +30383,82 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er 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)) @@ -27123,22 +30489,27 @@ func UnmarshalBackupPolicyCollection(m map[string]json.RawMessage, result interf 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, UnmarshalBackupPolicyCollectionFirst) 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, UnmarshalBackupPolicyCollectionNext) 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)) @@ -27151,8 +30522,11 @@ func (resp *BackupPolicyCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -27168,6 +30542,7 @@ func UnmarshalBackupPolicyCollectionFirst(m map[string]json.RawMessage, result i 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)) @@ -27185,6 +30560,7 @@ func UnmarshalBackupPolicyCollectionNext(m map[string]json.RawMessage, result in 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)) @@ -27193,7 +30569,7 @@ func UnmarshalBackupPolicyCollectionNext(m map[string]json.RawMessage, result in // BackupPolicyHealthReason : BackupPolicyHealthReason struct type BackupPolicyHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state. Code *string `json:"code" validate:"required"` // An explanation of the reason for this health state. @@ -27204,7 +30580,7 @@ type BackupPolicyHealthReason struct { } // Constants associated with the BackupPolicyHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state. const ( BackupPolicyHealthReasonCodeMissingServiceAuthorizationPoliciesConst = "missing_service_authorization_policies" ) @@ -27214,14 +30590,17 @@ func UnmarshalBackupPolicyHealthReason(m map[string]json.RawMessage, result inte 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)) @@ -27258,9 +30637,8 @@ type BackupPolicyJob struct { // The type of backup policy job. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the - // unexpected property value was encountered. + // 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. @@ -27272,16 +30650,11 @@ type BackupPolicyJob struct { // The status of the backup policy job. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the - // unexpected property value was encountered. + // 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). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []BackupPolicyJobStatusReason `json:"status_reasons" validate:"required"` // The snapshots operated on by this backup policy job (may be @@ -27292,9 +30665,8 @@ type BackupPolicyJob struct { // Constants associated with the BackupPolicyJob.JobType property. // The type of backup policy job. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the -// unexpected property value was encountered. +// 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" @@ -27309,9 +30681,8 @@ const ( // Constants associated with the BackupPolicyJob.Status property. // The status of the backup policy job. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy job on which the -// unexpected property value was encountered. +// 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" @@ -27323,54 +30694,67 @@ func UnmarshalBackupPolicyJob(m map[string]json.RawMessage, result interface{}) 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)) @@ -27401,22 +30785,27 @@ func UnmarshalBackupPolicyJobCollection(m map[string]json.RawMessage, result int 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) 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, UnmarshalBackupPolicyJobCollectionNext) 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)) @@ -27429,8 +30818,11 @@ func (resp *BackupPolicyJobCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -27446,6 +30838,7 @@ func UnmarshalBackupPolicyJobCollectionFirst(m map[string]json.RawMessage, resul obj := new(BackupPolicyJobCollectionFirst) 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)) @@ -27463,6 +30856,7 @@ func UnmarshalBackupPolicyJobCollectionNext(m map[string]json.RawMessage, result obj := new(BackupPolicyJobCollectionNext) 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)) @@ -27518,30 +30912,37 @@ func UnmarshalBackupPolicyJobSource(m map[string]json.RawMessage, result interfa 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, UnmarshalVolumeReferenceDeleted) 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)) @@ -27550,11 +30951,14 @@ func UnmarshalBackupPolicyJobSource(m map[string]json.RawMessage, result interfa // BackupPolicyJobStatusReason : BackupPolicyJobStatusReason struct type BackupPolicyJobStatusReason struct { - // A snake case string succinctly identifying the status reason: + // A reason code for the status: // - `internal_error`: Internal error (contact IBM support) // - `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_busy`: The source volume has `busy` set (after multiple retries) + // + // 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. @@ -27565,11 +30969,14 @@ type BackupPolicyJobStatusReason struct { } // Constants associated with the BackupPolicyJobStatusReason.Code property. -// A snake case string succinctly identifying the status reason: +// A reason code for the status: // - `internal_error`: Internal error (contact IBM support) // - `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_busy`: The source volume has `busy` set (after multiple retries) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error" BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" @@ -27582,14 +30989,17 @@ func UnmarshalBackupPolicyJobStatusReason(m map[string]json.RawMessage, result i 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)) @@ -27623,14 +31033,17 @@ func UnmarshalBackupPolicyPatch(m map[string]json.RawMessage, result interface{} 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)) @@ -27644,6 +31057,9 @@ func (backupPolicyPatch *BackupPolicyPatch) AsPatch() (_patch map[string]interfa if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -27714,54 +31130,67 @@ func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) 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 } 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()) 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)) @@ -27782,10 +31211,12 @@ func UnmarshalBackupPolicyPlanClonePolicy(m map[string]json.RawMessage, result i 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)) @@ -27807,10 +31238,12 @@ func UnmarshalBackupPolicyPlanClonePolicyPatch(m map[string]json.RawMessage, res 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)) @@ -27832,6 +31265,9 @@ func (*VpcV1) NewBackupPolicyPlanClonePolicyPrototype(zones []ZoneIdentityIntf) Zones: zones, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -27840,10 +31276,12 @@ func UnmarshalBackupPolicyPlanClonePolicyPrototype(m map[string]json.RawMessage, 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)) @@ -27852,15 +31290,85 @@ func UnmarshalBackupPolicyPlanClonePolicyPrototype(m map[string]json.RawMessage, // BackupPolicyPlanCollection : BackupPolicyPlanCollection struct type BackupPolicyPlanCollection struct { + // A link to the first page of resources. + First *BackupPolicyPlanCollectionFirst `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 *BackupPolicyPlanCollectionNext `json:"next,omitempty"` + // Collection of backup policy plans. 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, UnmarshalBackupPolicyPlanCollectionFirst) + 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, UnmarshalBackupPolicyPlanCollectionNext) + 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 +} + +// 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 + } + 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) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -27881,10 +31389,12 @@ func UnmarshalBackupPolicyPlanDeletionTrigger(m map[string]json.RawMessage, resu 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)) @@ -27905,10 +31415,12 @@ func UnmarshalBackupPolicyPlanDeletionTriggerPatch(m map[string]json.RawMessage, 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)) @@ -27929,10 +31441,12 @@ func UnmarshalBackupPolicyPlanDeletionTriggerPrototype(m map[string]json.RawMess 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)) @@ -27974,34 +31488,42 @@ func UnmarshalBackupPolicyPlanPatch(m map[string]json.RawMessage, result interfa 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)) @@ -28015,6 +31537,9 @@ func (backupPolicyPlanPatch *BackupPolicyPlanPatch) AsPatch() (_patch map[string if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -28054,6 +31579,9 @@ func (*VpcV1) NewBackupPolicyPlanPrototype(cronSpec string) (_model *BackupPolic CronSpec: core.StringPtr(cronSpec), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -28062,34 +31590,42 @@ func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result int 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, "", "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, UnmarshalBackupPolicyPlanDeletionTriggerPrototype) 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)) @@ -28130,26 +31666,32 @@ func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result int obj := new(BackupPolicyPlanReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBackupPolicyPlanReferenceDeleted) 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, UnmarshalBackupPolicyPlanRemote) 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)) @@ -28168,6 +31710,7 @@ func UnmarshalBackupPolicyPlanReferenceDeleted(m map[string]json.RawMessage, res obj := new(BackupPolicyPlanReferenceDeleted) 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)) @@ -28187,6 +31730,7 @@ func UnmarshalBackupPolicyPlanRemote(m map[string]json.RawMessage, result interf obj := new(BackupPolicyPlanRemote) 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)) @@ -28210,14 +31754,17 @@ func UnmarshalBackupPolicyPlanRemoteRegionPolicy(m map[string]json.RawMessage, r obj := new(BackupPolicyPlanRemoteRegionPolicy) 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, 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)) @@ -28245,6 +31792,9 @@ func (*VpcV1) NewBackupPolicyPlanRemoteRegionPolicyPrototype(region RegionIdenti Region: region, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -28253,14 +31803,17 @@ func UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype(m map[string]json.RawM 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)) @@ -28330,30 +31883,37 @@ func UnmarshalBackupPolicyPrototype(m map[string]json.RawMessage, result interfa obj := new(BackupPolicyPrototype) 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, 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)) @@ -28394,14 +31954,17 @@ func UnmarshalBackupPolicyScope(m map[string]json.RawMessage, result interface{} 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, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -28431,6 +31994,7 @@ func UnmarshalBackupPolicyScopePrototype(m map[string]json.RawMessage, result in 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)) @@ -28443,7 +32007,10 @@ type BareMetalServer struct { // server network interfaces. Bandwidth *int64 `json:"bandwidth" validate:"required"` - // The possible resource types for this property are expected to expand in the future. + // 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. @@ -28470,10 +32037,6 @@ type BareMetalServer struct { ID *string `json:"id" validate:"required"` // The reasons for the current `lifecycle_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. LifecycleReasons []BareMetalServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the bare metal server. @@ -28520,10 +32083,6 @@ type BareMetalServer struct { Status *string `json:"status" validate:"required"` // The reasons for the current status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []BareMetalServerStatusReason `json:"status_reasons" validate:"required"` TrustedPlatformModule *BareMetalServerTrustedPlatformModule `json:"trusted_platform_module" validate:"required"` @@ -28572,109 +32131,137 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) 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()) return } err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-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, UnmarshalBareMetalServerLifecycleReason) 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, "memory", &obj.Memory) if err != nil { + err = core.SDKErrorf(err, "", "memory-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, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentReference) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) if err != nil { + 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) 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.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, UnmarshalBareMetalServerStatusReason) if err != nil { + 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 } -// BareMetalServerBootTarget : The possible resource types for this property are expected to expand in the future. +// 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 { @@ -28714,22 +32301,27 @@ func UnmarshalBareMetalServerBootTarget(m map[string]json.RawMessage, result int obj := new(BareMetalServerBootTarget) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) 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)) @@ -28756,18 +32348,22 @@ func UnmarshalBareMetalServerCpu(m map[string]json.RawMessage, result interface{ 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)) @@ -28798,22 +32394,27 @@ func UnmarshalBareMetalServerCollection(m map[string]json.RawMessage, result int 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) 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, UnmarshalBareMetalServerCollectionNext) 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)) @@ -28826,8 +32427,11 @@ func (resp *BareMetalServerCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -28843,6 +32447,7 @@ func UnmarshalBareMetalServerCollectionFirst(m map[string]json.RawMessage, resul obj := new(BareMetalServerCollectionFirst) 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)) @@ -28860,6 +32465,7 @@ func UnmarshalBareMetalServerCollectionNext(m map[string]json.RawMessage, result obj := new(BareMetalServerCollectionNext) 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)) @@ -28900,26 +32506,32 @@ func UnmarshalBareMetalServerConsoleAccessToken(m map[string]json.RawMessage, re obj := new(BareMetalServerConsoleAccessToken) err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) if err != nil { + err = core.SDKErrorf(err, "", "access_token-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) if err != nil { + err = core.SDKErrorf(err, "", "console_type-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, "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)) @@ -28937,15 +32549,13 @@ type BareMetalServerDisk struct { // The unique identifier for this bare metal server disk. ID *string `json:"id" validate:"required"` - // The disk interface used for attaching the disk. - // + // The disk interface used for attaching the disk: // - `fcp`: Attached using Fiber Channel Protocol // - `sata`: Attached using Serial Advanced Technology Attachment // - `nvme`: Attached using Non-Volatile Memory Express // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // 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 name for this bare metal server disk. The name is unique across all disks on the bare metal server. @@ -28959,15 +32569,13 @@ type BareMetalServerDisk struct { } // Constants associated with the BareMetalServerDisk.InterfaceType property. -// The disk interface used for attaching the disk. -// +// The disk interface used for attaching the disk: // - `fcp`: Attached using Fiber Channel Protocol // - `sata`: Attached using Serial Advanced Technology Attachment // - `nvme`: Attached using Non-Volatile Memory Express // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( BareMetalServerDiskInterfaceTypeFcpConst = "fcp" BareMetalServerDiskInterfaceTypeNvmeConst = "nvme" @@ -28985,30 +32593,37 @@ func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface obj := new(BareMetalServerDisk) 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, "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.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -29026,6 +32641,7 @@ func UnmarshalBareMetalServerDiskCollection(m map[string]json.RawMessage, result obj := new(BareMetalServerDiskCollection) err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -29043,6 +32659,7 @@ func UnmarshalBareMetalServerDiskPatch(m map[string]json.RawMessage, result inte obj := new(BareMetalServerDiskPatch) 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)) @@ -29056,6 +32673,9 @@ func (bareMetalServerDiskPatch *BareMetalServerDiskPatch) AsPatch() (_patch map[ if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -29071,6 +32691,7 @@ func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, obj := new(BareMetalServerDiskReferenceDeleted) 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)) @@ -29095,14 +32716,17 @@ func UnmarshalBareMetalServerInitialization(m map[string]json.RawMessage, result obj := new(BareMetalServerInitialization) err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "user_accounts", &obj.UserAccounts, UnmarshalBareMetalServerInitializationUserAccount) if err != nil { + err = core.SDKErrorf(err, "", "user_accounts-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -29134,6 +32758,9 @@ func (*VpcV1) NewBareMetalServerInitializationPrototype(image ImageIdentityIntf, Keys: keys, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -29142,14 +32769,17 @@ func UnmarshalBareMetalServerInitializationPrototype(m map[string]json.RawMessag obj := new(BareMetalServerInitializationPrototype) err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + 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)) @@ -29192,18 +32822,22 @@ func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMess obj := new(BareMetalServerInitializationUserAccount) err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) if err != nil { + err = core.SDKErrorf(err, "", "encrypted_password-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) if err != nil { + err = core.SDKErrorf(err, "", "encryption_key-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, "username", &obj.Username) if err != nil { + err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -29212,7 +32846,13 @@ func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMess // BareMetalServerLifecycleReason : BareMetalServerLifecycleReason struct type BareMetalServerLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. + // 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. @@ -29223,8 +32863,15 @@ type BareMetalServerLifecycleReason struct { } // Constants associated with the BareMetalServerLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. +// 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 ( + BareMetalServerLifecycleReasonCodeInternalErrorConst = "internal_error" BareMetalServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -29233,14 +32880,17 @@ func UnmarshalBareMetalServerLifecycleReason(m map[string]json.RawMessage, resul obj := new(BareMetalServerLifecycleReason) 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)) @@ -29271,9 +32921,8 @@ type BareMetalServerNetworkAttachment struct { // array of `allowed_vlans`. // - Must use an IEEE 802.1Q tag. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // 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 lifecycle state of the bare metal server network attachment. @@ -29334,9 +32983,8 @@ type BareMetalServerNetworkAttachment struct { // array of `allowed_vlans`. // - Must use an IEEE 802.1Q tag. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// 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" @@ -29380,62 +33028,77 @@ func UnmarshalBareMetalServerNetworkAttachment(m map[string]json.RawMessage, res 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) if err != nil { + 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()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-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 } 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, "allow_to_float", &obj.AllowToFloat) if err != nil { + err = core.SDKErrorf(err, "", "allow_to_float-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) if err != nil { + err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -29466,22 +33129,27 @@ func UnmarshalBareMetalServerNetworkAttachmentCollection(m map[string]json.RawMe obj := new(BareMetalServerNetworkAttachmentCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerNetworkAttachmentCollectionFirst) 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, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkAttachmentCollectionNext) 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)) @@ -29494,8 +33162,11 @@ func (resp *BareMetalServerNetworkAttachmentCollection) GetNextStart() (*string, return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -29511,6 +33182,7 @@ func UnmarshalBareMetalServerNetworkAttachmentCollectionFirst(m map[string]json. obj := new(BareMetalServerNetworkAttachmentCollectionFirst) 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)) @@ -29528,6 +33200,7 @@ func UnmarshalBareMetalServerNetworkAttachmentCollectionNext(m map[string]json.R obj := new(BareMetalServerNetworkAttachmentCollectionNext) 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)) @@ -29550,10 +33223,12 @@ func UnmarshalBareMetalServerNetworkAttachmentPatch(m map[string]json.RawMessage 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) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -29567,6 +33242,9 @@ func (bareMetalServerNetworkAttachmentPatch *BareMetalServerNetworkAttachmentPat if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -29650,26 +33328,32 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototype(m map[string]json.RawMes obj := new(BareMetalServerNetworkAttachmentPrototype) 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, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-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, "allow_to_float", &obj.AllowToFloat) if err != nil { + err = core.SDKErrorf(err, "", "allow_to_float-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) if err != nil { + err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -29766,50 +33450,62 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface(m 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 } 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.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) 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()) 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)) @@ -29855,30 +33551,37 @@ func UnmarshalBareMetalServerNetworkAttachmentReference(m map[string]json.RawMes obj := new(BareMetalServerNetworkAttachmentReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -29897,6 +33600,7 @@ func UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted(m map[string]json obj := new(BareMetalServerNetworkAttachmentReferenceDeleted) 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)) @@ -29982,9 +33686,8 @@ type BareMetalServerNetworkInterface struct { // 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 are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // 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 @@ -30097,9 +33800,8 @@ type BareMetalServerNetworkInterface struct { // 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 are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// 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" @@ -30151,21 +33853,32 @@ func UnmarshalBareMetalServerNetworkInterface(m map[string]json.RawMessage, resu var discValue string err = core.UnmarshalPrimitive(m, "interface_type", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + 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 { - err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'interface_type': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -30194,22 +33907,27 @@ func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMes obj := new(BareMetalServerNetworkInterfaceCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerNetworkInterfaceCollectionFirst) 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, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) 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)) @@ -30222,8 +33940,11 @@ func (resp *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -30239,6 +33960,7 @@ func UnmarshalBareMetalServerNetworkInterfaceCollectionFirst(m map[string]json.R 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)) @@ -30256,6 +33978,7 @@ func UnmarshalBareMetalServerNetworkInterfaceCollectionNext(m map[string]json.Ra 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)) @@ -30302,18 +34025,22 @@ func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, obj := new(BareMetalServerNetworkInterfacePatch) 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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -30327,6 +34054,9 @@ func (bareMetalServerNetworkInterfacePatch *BareMetalServerNetworkInterfacePatch if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -30463,21 +34193,32 @@ func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMess var discValue string err = core.UnmarshalPrimitive(m, "interface_type", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + 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, 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 { - err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'interface_type': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -30494,6 +34235,7 @@ func UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted(m map[string]json. obj := new(BareMetalServerNetworkInterfaceReferenceDeleted) 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)) @@ -30512,6 +34254,7 @@ func UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted(m map obj := new(BareMetalServerNetworkInterfaceReferenceTargetContextDeleted) 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)) @@ -30539,14 +34282,17 @@ func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interfac obj := new(BareMetalServerPatch) err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-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, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) if err != nil { + err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -30560,6 +34306,9 @@ func (bareMetalServerPatch *BareMetalServerPatch) AsPatch() (_patch map[string]i if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -30617,18 +34366,22 @@ func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype(m map[string]json obj := new(BareMetalServerPrimaryNetworkAttachmentPrototype) 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, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -30723,6 +34476,9 @@ func (*VpcV1) NewBareMetalServerPrimaryNetworkInterfacePrototype(subnet SubnetId Subnet: subnet, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -30731,34 +34487,42 @@ func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json. 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)) @@ -30819,66 +34583,82 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf 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) if err != nil { + err = core.SDKErrorf(err, "", "family-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.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) if err != nil { + err = core.SDKErrorf(err, "", "memory-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, "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) if err != nil { + err = core.SDKErrorf(err, "", "os_architecture-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, "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) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interfaces_supported-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -30933,30 +34713,37 @@ func UnmarshalBareMetalServerProfileBandwidth(m map[string]json.RawMessage, resu 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) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -30986,14 +34773,17 @@ func UnmarshalBareMetalServerProfileCpuArchitecture(m map[string]json.RawMessage obj := new(BareMetalServerProfileCpuArchitecture) 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, "value", &obj.Value) if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31048,30 +34838,37 @@ func UnmarshalBareMetalServerProfileCpuCoreCount(m map[string]json.RawMessage, r 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) if err != nil { + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31126,30 +34923,37 @@ func UnmarshalBareMetalServerProfileCpuSocketCount(m map[string]json.RawMessage, 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) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31180,22 +34984,27 @@ func UnmarshalBareMetalServerProfileCollection(m map[string]json.RawMessage, res obj := new(BareMetalServerProfileCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerProfileCollectionFirst) 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, UnmarshalBareMetalServerProfileCollectionNext) 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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31208,8 +35017,11 @@ func (resp *BareMetalServerProfileCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -31225,6 +35037,7 @@ func UnmarshalBareMetalServerProfileCollectionFirst(m map[string]json.RawMessage 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)) @@ -31242,6 +35055,7 @@ func UnmarshalBareMetalServerProfileCollectionNext(m map[string]json.RawMessage, 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)) @@ -31275,10 +35089,12 @@ func UnmarshalBareMetalServerProfileConsoleTypes(m map[string]json.RawMessage, r obj := new(BareMetalServerProfileConsoleTypes) 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)) @@ -31299,14 +35115,17 @@ func UnmarshalBareMetalServerProfileDisk(m map[string]json.RawMessage, result in obj := new(BareMetalServerProfileDisk) err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalBareMetalServerProfileDiskQuantity) if err != nil { + 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)) @@ -31361,30 +35180,37 @@ func UnmarshalBareMetalServerProfileDiskQuantity(m map[string]json.RawMessage, r 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) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31439,30 +35265,37 @@ func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, resul obj := new(BareMetalServerProfileDiskSize) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31471,15 +35304,13 @@ func UnmarshalBareMetalServerProfileDiskSize(m map[string]json.RawMessage, resul // BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct type BareMetalServerProfileDiskSupportedInterfaces struct { - // The disk interface used for attaching the disk. - // + // The disk interface used for attaching the disk: // - `fcp`: Attached using Fiber Channel Protocol // - `sata`: Attached using Serial Advanced Technology Attachment // - `nvme`: Attached using Non-Volatile Memory Express // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Default *string `json:"default" validate:"required"` // The type for this profile field. @@ -31490,15 +35321,13 @@ type BareMetalServerProfileDiskSupportedInterfaces struct { } // Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. -// The disk interface used for attaching the disk. -// +// The disk interface used for attaching the disk: // - `fcp`: Attached using Fiber Channel Protocol // - `sata`: Attached using Serial Advanced Technology Attachment // - `nvme`: Attached using Non-Volatile Memory Express // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( BareMetalServerProfileDiskSupportedInterfacesDefaultFcpConst = "fcp" BareMetalServerProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" @@ -31512,15 +35341,13 @@ const ( ) // Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Values property. -// The disk interface used for attaching the disk. -// +// The disk interface used for attaching the disk: // - `fcp`: Attached using Fiber Channel Protocol // - `sata`: Attached using Serial Advanced Technology Attachment // - `nvme`: Attached using Non-Volatile Memory Express // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// 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" @@ -31532,14 +35359,17 @@ func UnmarshalBareMetalServerProfileDiskSupportedInterfaces(m map[string]json.Ra obj := new(BareMetalServerProfileDiskSupportedInterfaces) 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)) @@ -31571,10 +35401,12 @@ func UnmarshalBareMetalServerProfileIdentity(m map[string]json.RawMessage, resul 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)) @@ -31629,30 +35461,37 @@ func UnmarshalBareMetalServerProfileMemory(m map[string]json.RawMessage, result 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31693,14 +35532,17 @@ func UnmarshalBareMetalServerProfileNetworkAttachmentCount(m map[string]json.Raw obj := new(BareMetalServerProfileNetworkAttachmentCount) 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31741,14 +35583,17 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCount(m map[string]json.RawM 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -31778,14 +35623,17 @@ func UnmarshalBareMetalServerProfileOsArchitecture(m map[string]json.RawMessage, obj := new(BareMetalServerProfileOsArchitecture) 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)) @@ -31815,14 +35663,17 @@ func UnmarshalBareMetalServerProfileReference(m map[string]json.RawMessage, resu obj := new(BareMetalServerProfileReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -31849,9 +35700,8 @@ const ( // - `disabled`: No TPM functionality // - `tpm_2`: TPM 2.0 // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// 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" @@ -31862,10 +35712,12 @@ func UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes(m map[st obj := new(BareMetalServerProfileSupportedTrustedPlatformModuleModes) 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)) @@ -31892,10 +35744,12 @@ func UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported(m map[stri 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)) @@ -31933,7 +35787,7 @@ type BareMetalServerPrototype struct { // // 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"` + VPC BareMetalServerPrototypeVPCIntf `json:"vpc,omitempty"` // The zone this bare metal server will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -31964,50 +35818,111 @@ func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result inte obj := new(BareMetalServerPrototype) err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) if err != nil { + err = core.SDKErrorf(err, "", "initialization-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, "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) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) if err != nil { + err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalBareMetalServerPrototypeVPC) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrototypeVPC : 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. +// Models which "extend" this model: +// - BareMetalServerPrototypeVPCVPCIdentityByID +// - BareMetalServerPrototypeVPCVPCIdentityByCRN +// - BareMetalServerPrototypeVPCVPCIdentityByHref +type BareMetalServerPrototypeVPC struct { + // The unique identifier for this VPC. + ID *string `json:"id,omitempty"` + + // The CRN for this VPC. + CRN *string `json:"crn,omitempty"` + + // The URL for this VPC. + Href *string `json:"href,omitempty"` +} + +func (*BareMetalServerPrototypeVPC) isaBareMetalServerPrototypeVPC() bool { + return true +} + +type BareMetalServerPrototypeVPCIntf interface { + isaBareMetalServerPrototypeVPC() bool +} + +// UnmarshalBareMetalServerPrototypeVPC unmarshals an instance of BareMetalServerPrototypeVPC from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeVPC(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeVPC) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-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) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -32021,7 +35936,10 @@ type BareMetalServerStatusReason struct { // - `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_start_network`: An error occurred while allocating network resources + // + // 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. @@ -32037,7 +35955,10 @@ type BareMetalServerStatusReason struct { // - `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_start_network`: An error occurred while allocating network resources +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" @@ -32051,14 +35972,17 @@ func UnmarshalBareMetalServerStatusReason(m map[string]json.RawMessage, result i obj := new(BareMetalServerStatusReason) 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)) @@ -32074,9 +35998,8 @@ type BareMetalServerTrustedPlatformModule struct { // - `disabled`: No TPM functionality // - `tpm_2`: TPM 2.0 // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // 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. @@ -32088,9 +36011,8 @@ type BareMetalServerTrustedPlatformModule struct { // - `disabled`: No TPM functionality // - `tpm_2`: TPM 2.0 // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// 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" @@ -32101,9 +36023,8 @@ const ( // - `disabled`: No TPM functionality // - `tpm_2`: TPM 2.0 // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// 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" @@ -32114,14 +36035,17 @@ func UnmarshalBareMetalServerTrustedPlatformModule(m map[string]json.RawMessage, 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) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) if err != nil { + err = core.SDKErrorf(err, "", "supported_modes-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -32152,6 +36076,7 @@ func UnmarshalBareMetalServerTrustedPlatformModulePatch(m map[string]json.RawMes obj := new(BareMetalServerTrustedPlatformModulePatch) err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -32178,6 +36103,7 @@ func UnmarshalBareMetalServerTrustedPlatformModulePrototype(m map[string]json.Ra obj := new(BareMetalServerTrustedPlatformModulePrototype) err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -32207,6 +36133,7 @@ func UnmarshalCatalogOfferingIdentity(m map[string]json.RawMessage, result inter 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)) @@ -32236,6 +36163,7 @@ func UnmarshalCatalogOfferingVersionIdentity(m map[string]json.RawMessage, resul 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)) @@ -32254,6 +36182,7 @@ func UnmarshalCatalogOfferingVersionReference(m map[string]json.RawMessage, resu obj := new(CatalogOfferingVersionReference) 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)) @@ -32281,6 +36210,7 @@ func UnmarshalCertificateInstanceIdentity(m map[string]json.RawMessage, result i obj := new(CertificateInstanceIdentity) 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)) @@ -32298,6 +36228,7 @@ func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result obj := new(CertificateInstanceReference) 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)) @@ -32425,10 +36356,12 @@ func UnmarshalCloudObjectStorageBucketIdentity(m map[string]json.RawMessage, res obj := new(CloudObjectStorageBucketIdentity) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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)) @@ -32449,10 +36382,12 @@ func UnmarshalCloudObjectStorageBucketReference(m map[string]json.RawMessage, re obj := new(CloudObjectStorageBucketReference) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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)) @@ -32470,6 +36405,7 @@ func UnmarshalCloudObjectStorageObjectReference(m map[string]json.RawMessage, re obj := new(CloudObjectStorageObjectReference) 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)) @@ -34109,7 +38045,10 @@ type CreateLoadBalancerListenerOptions struct { // The connection limit of the listener. ConnectionLimit *int64 `json:"connection_limit,omitempty"` - // The default pool for this listener. If specified, the pool must: + // The default pool for this listener. If `https_redirect` is specified, the + // default pool will not be used. + // If specified, the pool must: + // // - Belong to this load balancer. // - Have the same `protocol` as this listener, or have a compatible protocol. // At present, the compatible protocols are `http` and `https`. @@ -34119,8 +38058,11 @@ type CreateLoadBalancerListenerOptions struct { // subsequently set. DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` - // The target listener that requests will be redirected to. This listener must have a - // `protocol` of `http`, and the target listener must have a `protocol` of `https`. + // The target listener that requests will be redirected to if none of the listener's + // `policies` match. + // + // If specified, this listener must have a `protocol` of `http`, and the target + // 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. @@ -34275,12 +38217,19 @@ type CreateLoadBalancerListenerPolicyOptions struct { // The policy action. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the - // unexpected property value was encountered. + // - `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` + // - `redirect`: Requests will be redirected to the specified `target.url` + // - `reject`: Requests will be rejected with a `403` status code + // + // 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"` - // Priority of the policy. Lower value indicates higher priority. + // Priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value + // indicates higher priority. Priority *int64 `json:"priority" validate:"required"` // The name for this policy. The name must not be used by another policy for the load balancer listener. If @@ -34291,9 +38240,9 @@ type CreateLoadBalancerListenerPolicyOptions struct { Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` // Allows users to set headers on API requests @@ -34303,9 +38252,15 @@ type CreateLoadBalancerListenerPolicyOptions struct { // Constants associated with the CreateLoadBalancerListenerPolicyOptions.Action property. // The policy action. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the -// unexpected property value was encountered. +// - `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` +// - `redirect`: Requests will be redirected to the specified `target.url` +// - `reject`: Requests will be rejected with a `403` status code +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( CreateLoadBalancerListenerPolicyOptionsActionForwardConst = "forward" CreateLoadBalancerListenerPolicyOptionsActionHTTPSRedirectConst = "https_redirect" @@ -34739,7 +38694,9 @@ type CreateLoadBalancerPoolOptions struct { // Supported by load balancers in the `application` family (otherwise always `disabled`). ProxyProtocol *string `json:"proxy_protocol,omitempty"` - // The session persistence of this pool. + // The session persistence of this pool. If unspecified, session persistence will be + // disabled, and traffic will be distributed across backend server members of the + // pool. SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` // Allows users to set headers on API requests @@ -34910,13 +38867,12 @@ func (options *CreateNetworkACLRuleOptions) SetHeaders(param map[string]string) // CreatePlacementGroupOptions : The CreatePlacementGroup options. type CreatePlacementGroupOptions struct { - // The strategy for this placement group + // The strategy for this placement group: // - `host_spread`: place on different compute hosts // - `power_spread`: place on compute hosts that use different power sources // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the - // unexpected strategy was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Strategy *string `json:"strategy" validate:"required"` // The name for this placement group. The name must not be used by another placement group in the region. If @@ -34932,13 +38888,12 @@ type CreatePlacementGroupOptions struct { } // Constants associated with the CreatePlacementGroupOptions.Strategy property. -// The strategy for this placement group +// The strategy for this placement group: // - `host_spread`: place on different compute hosts // - `power_spread`: place on compute hosts that use different power sources // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the -// unexpected strategy was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( CreatePlacementGroupOptionsStrategyHostSpreadConst = "host_spread" CreatePlacementGroupOptionsStrategyPowerSpreadConst = "power_spread" @@ -36047,9 +40002,6 @@ type CreateVPCRoutingTableOptions struct { VPCID *string `json:"vpc_id" validate:"required,ne="` // 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 `vpn_server` value is supported, but filter - // support is expected to expand in the future. 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 @@ -36560,14 +40512,10 @@ type CreateVPNServerRouteOptions struct { Destination *string `json:"destination" validate:"required"` // The action to perform with a packet matching the VPN route: - // - `translate`: translate the source IP address to one of the private IP addresses of the VPN server, then deliver - // the packet to target. + // - `translate`: translate the source IP address to one of the private IP addresses of + // the VPN server, then deliver the packet to target. // - `deliver`: deliver the packet to the target. - // - `drop`: drop the packet - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the - // unexpected property value was encountered. + // - `drop`: drop the packet. Action *string `json:"action,omitempty"` // The name for this VPN server route. The name must not be used by another route for the VPN server. If unspecified, @@ -36580,14 +40528,10 @@ type CreateVPNServerRouteOptions struct { // Constants associated with the CreateVPNServerRouteOptions.Action property. // The action to perform with a packet matching the VPN route: -// - `translate`: translate the source IP address to one of the private IP addresses of the VPN server, then deliver the -// packet to target. -// - `deliver`: deliver the packet to the target. -// - `drop`: drop the packet -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the -// unexpected property value was encountered. +// - `translate`: translate the source IP address to one of the private IP addresses of +// the VPN server, then deliver the packet to target. +// - `deliver`: deliver the packet to the target. +// - `drop`: drop the packet. const ( CreateVPNServerRouteOptionsActionDeliverConst = "deliver" CreateVPNServerRouteOptionsActionDropConst = "drop" @@ -36653,6 +40597,7 @@ func UnmarshalDnsInstanceIdentity(m map[string]json.RawMessage, result interface obj := new(DnsInstanceIdentity) 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)) @@ -36670,6 +40615,7 @@ func UnmarshalDnsInstanceReference(m map[string]json.RawMessage, result interfac obj := new(DnsInstanceReference) 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)) @@ -36680,9 +40626,8 @@ func UnmarshalDnsInstanceReference(m map[string]json.RawMessage, result interfac type DnsServer struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` // If present, DHCP configuration for this zone will have this DNS server listed first. @@ -36694,10 +40639,12 @@ func UnmarshalDnsServer(m map[string]json.RawMessage, result interface{}) (err e obj := new(DnsServer) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneReference) if err != nil { + err = core.SDKErrorf(err, "", "zone_affinity-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -36708,9 +40655,8 @@ func UnmarshalDnsServer(m map[string]json.RawMessage, result interface{}) (err e type DnsServerPrototype struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` // DHCP configuration for the specified zone will have this DNS server listed first. @@ -36723,6 +40669,9 @@ func (*VpcV1) NewDnsServerPrototype(address string) (_model *DnsServerPrototype, Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -36731,10 +40680,12 @@ func UnmarshalDnsServerPrototype(m map[string]json.RawMessage, result interface{ obj := new(DnsServerPrototype) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone_affinity-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -36761,6 +40712,7 @@ func UnmarshalDnsZoneIdentity(m map[string]json.RawMessage, result interface{}) obj := new(DnsZoneIdentity) 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)) @@ -36777,6 +40729,7 @@ func UnmarshalDnsZoneReference(m map[string]json.RawMessage, result interface{}) obj := new(DnsZoneReference) 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)) @@ -36845,9 +40798,8 @@ type DedicatedHost struct { // The administrative state of the dedicated host. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the dedicated host on which - // the unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. State *string `json:"state" validate:"required"` // The instance profiles usable by instances placed on this dedicated host. @@ -36881,9 +40833,8 @@ const ( // Constants associated with the DedicatedHost.State property. // The administrative state of the dedicated host. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the dedicated host on which -// the unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( DedicatedHostStateAvailableConst = "available" DedicatedHostStateDegradedConst = "degraded" @@ -36896,94 +40847,117 @@ func UnmarshalDedicatedHost(m map[string]json.RawMessage, result interface{}) (e obj := new(DedicatedHost) err = core.UnmarshalPrimitive(m, "available_memory", &obj.AvailableMemory) if err != nil { + err = core.SDKErrorf(err, "", "available_memory-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "available_vcpu", &obj.AvailableVcpu, UnmarshalVcpu) if err != nil { + err = core.SDKErrorf(err, "", "available_vcpu-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "group-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, "instance_placement_enabled", &obj.InstancePlacementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "instance_placement_enabled-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "instances-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, "memory", &obj.Memory) if err != nil { + err = core.SDKErrorf(err, "", "memory-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, "numa", &obj.Numa, UnmarshalDedicatedHostNuma) if err != nil { + err = core.SDKErrorf(err, "", "numa-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) if err != nil { + err = core.SDKErrorf(err, "", "provisionable-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.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) if err != nil { + err = core.SDKErrorf(err, "", "socket_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "state", &obj.State) if err != nil { + err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "supported_instance_profiles-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalVcpu) if err != nil { + err = core.SDKErrorf(err, "", "vcpu-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)) @@ -37014,22 +40988,27 @@ func UnmarshalDedicatedHostCollection(m map[string]json.RawMessage, result inter obj := new(DedicatedHostCollection) err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHost) if err != nil { + err = core.SDKErrorf(err, "", "dedicated_hosts-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostCollectionFirst) 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, UnmarshalDedicatedHostCollectionNext) 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)) @@ -37042,8 +41021,11 @@ func (resp *DedicatedHostCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -37059,6 +41041,7 @@ func UnmarshalDedicatedHostCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -37076,6 +41059,7 @@ func UnmarshalDedicatedHostCollectionNext(m map[string]json.RawMessage, result i 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)) @@ -37101,9 +41085,8 @@ type DedicatedHostDisk struct { // The disk interface used for attaching the disk // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // 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 lifecycle state of this dedicated host disk. @@ -37128,9 +41111,8 @@ type DedicatedHostDisk struct { // Constants associated with the DedicatedHostDisk.InterfaceType property. // The disk interface used for attaching the disk // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( DedicatedHostDiskInterfaceTypeNvmeConst = "nvme" ) @@ -37156,9 +41138,8 @@ const ( // Constants associated with the DedicatedHostDisk.SupportedInstanceInterfaceTypes property. // The disk interface used for attaching the disk. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( DedicatedHostDiskSupportedInstanceInterfaceTypesNvmeConst = "nvme" DedicatedHostDiskSupportedInstanceInterfaceTypesVirtioBlkConst = "virtio_blk" @@ -37169,50 +41150,62 @@ func UnmarshalDedicatedHostDisk(m map[string]json.RawMessage, result interface{} obj := new(DedicatedHostDisk) err = core.UnmarshalPrimitive(m, "available", &obj.Available) if err != nil { + err = core.SDKErrorf(err, "", "available-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.UnmarshalModel(m, "instance_disks", &obj.InstanceDisks, UnmarshalInstanceDiskReference) if err != nil { + err = core.SDKErrorf(err, "", "instance_disks-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()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) if err != nil { + err = core.SDKErrorf(err, "", "provisionable-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, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes) if err != nil { + err = core.SDKErrorf(err, "", "supported_instance_interface_types-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37230,6 +41223,7 @@ func UnmarshalDedicatedHostDiskCollection(m map[string]json.RawMessage, result i obj := new(DedicatedHostDiskCollection) err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37247,6 +41241,7 @@ func UnmarshalDedicatedHostDiskPatch(m map[string]json.RawMessage, result interf obj := new(DedicatedHostDiskPatch) 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)) @@ -37260,6 +41255,9 @@ func (dedicatedHostDiskPatch *DedicatedHostDiskPatch) AsPatch() (_patch map[stri if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -37321,50 +41319,62 @@ func UnmarshalDedicatedHostGroup(m map[string]json.RawMessage, result interface{ obj := new(DedicatedHostGroup) err = core.UnmarshalPrimitive(m, "class", &obj.Class) if err != nil { + err = core.SDKErrorf(err, "", "class-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHostReference) if err != nil { + err = core.SDKErrorf(err, "", "dedicated_hosts-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-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, "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, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "supported_instance_profiles-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)) @@ -37395,22 +41405,27 @@ func UnmarshalDedicatedHostGroupCollection(m map[string]json.RawMessage, result obj := new(DedicatedHostGroupCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostGroupCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "groups", &obj.Groups, UnmarshalDedicatedHostGroup) if err != nil { + err = core.SDKErrorf(err, "", "groups-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, UnmarshalDedicatedHostGroupCollectionNext) 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)) @@ -37423,8 +41438,11 @@ func (resp *DedicatedHostGroupCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -37440,6 +41458,7 @@ func UnmarshalDedicatedHostGroupCollectionFirst(m map[string]json.RawMessage, re 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)) @@ -37457,6 +41476,7 @@ func UnmarshalDedicatedHostGroupCollectionNext(m map[string]json.RawMessage, res 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)) @@ -37492,14 +41512,17 @@ func UnmarshalDedicatedHostGroupIdentity(m map[string]json.RawMessage, result in obj := new(DedicatedHostGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37517,6 +41540,7 @@ func UnmarshalDedicatedHostGroupPatch(m map[string]json.RawMessage, result inter obj := new(DedicatedHostGroupPatch) 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)) @@ -37530,6 +41554,9 @@ func (dedicatedHostGroupPatch *DedicatedHostGroupPatch) AsPatch() (_patch map[st if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -37548,10 +41575,12 @@ func UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext(m map[string obj := new(DedicatedHostGroupPrototypeDedicatedHostByZoneContext) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37591,26 +41620,32 @@ func UnmarshalDedicatedHostGroupReference(m map[string]json.RawMessage, result i obj := new(DedicatedHostGroupReference) 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, UnmarshalDedicatedHostGroupReferenceDeleted) 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)) @@ -37629,6 +41664,7 @@ func UnmarshalDedicatedHostGroupReferenceDeleted(m map[string]json.RawMessage, r obj := new(DedicatedHostGroupReferenceDeleted) 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)) @@ -37649,10 +41685,12 @@ func UnmarshalDedicatedHostNuma(m map[string]json.RawMessage, result interface{} obj := new(DedicatedHostNuma) err = core.UnmarshalPrimitive(m, "count", &obj.Count) if err != nil { + err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "nodes", &obj.Nodes, UnmarshalDedicatedHostNumaNode) if err != nil { + err = core.SDKErrorf(err, "", "nodes-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37673,10 +41711,12 @@ func UnmarshalDedicatedHostNumaNode(m map[string]json.RawMessage, result interfa obj := new(DedicatedHostNumaNode) err = core.UnmarshalPrimitive(m, "available_vcpu", &obj.AvailableVcpu) if err != nil { + err = core.SDKErrorf(err, "", "available_vcpu-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "vcpu", &obj.Vcpu) if err != nil { + err = core.SDKErrorf(err, "", "vcpu-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37697,10 +41737,12 @@ func UnmarshalDedicatedHostPatch(m map[string]json.RawMessage, result interface{ obj := new(DedicatedHostPatch) err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "instance_placement_enabled-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)) @@ -37714,6 +41756,9 @@ func (dedicatedHostPatch *DedicatedHostPatch) AsPatch() (_patch map[string]inter if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -37727,9 +41772,8 @@ type DedicatedHostProfile struct { // The product family this dedicated host profile belongs to // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // 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 URL for this dedicated host. @@ -37743,18 +41787,16 @@ type DedicatedHostProfile struct { SocketCount DedicatedHostProfileSocketIntf `json:"socket_count" validate:"required"` // The status of the dedicated host profile: - // - `previous`: This dedicated host profile is an older revision, but remains provisionable + // - `previous`: This dedicated host profile is an older revision, but remains provisionable // and usable. - // - `current`: This profile is the latest revision. + // - `current`: This dedicated host profile is the latest revision. // - // Note that revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming - // conventions] + // Revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming conventions] // (https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information on how // generations are defined within a dedicated host profile. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the - // unexpected property value was encountered. + // 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 instance profiles usable by instances placed on dedicated hosts with this profile. @@ -37770,9 +41812,8 @@ type DedicatedHostProfile struct { // Constants associated with the DedicatedHostProfile.Family property. // The product family this dedicated host profile belongs to // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( DedicatedHostProfileFamilyBalancedConst = "balanced" DedicatedHostProfileFamilyComputeConst = "compute" @@ -37781,18 +41822,16 @@ const ( // Constants associated with the DedicatedHostProfile.Status property. // The status of the dedicated host profile: -// - `previous`: This dedicated host profile is an older revision, but remains provisionable +// - `previous`: This dedicated host profile is an older revision, but remains provisionable // and usable. -// - `current`: This profile is the latest revision. +// - `current`: This dedicated host profile is the latest revision. // -// Note that revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming -// conventions] +// Revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming conventions] // (https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information on how // generations are defined within a dedicated host profile. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( DedicatedHostProfileStatusCurrentConst = "current" DedicatedHostProfileStatusPreviousConst = "previous" @@ -37803,50 +41842,62 @@ func UnmarshalDedicatedHostProfile(m map[string]json.RawMessage, result interfac obj := new(DedicatedHostProfile) err = core.UnmarshalPrimitive(m, "class", &obj.Class) if err != nil { + err = core.SDKErrorf(err, "", "class-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostProfileDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-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.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalDedicatedHostProfileMemory) if err != nil { + err = core.SDKErrorf(err, "", "memory-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, "socket_count", &obj.SocketCount, UnmarshalDedicatedHostProfileSocket) if err != nil { + err = core.SDKErrorf(err, "", "socket_count-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, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "supported_instance_profiles-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalDedicatedHostProfileVcpuArchitecture) if err != nil { + err = core.SDKErrorf(err, "", "vcpu_architecture-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalDedicatedHostProfileVcpu) if err != nil { + err = core.SDKErrorf(err, "", "vcpu_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalDedicatedHostProfileVcpuManufacturer) if err != nil { + err = core.SDKErrorf(err, "", "vcpu_manufacturer-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37877,22 +41928,27 @@ func UnmarshalDedicatedHostProfileCollection(m map[string]json.RawMessage, resul obj := new(DedicatedHostProfileCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostProfileCollectionFirst) 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, UnmarshalDedicatedHostProfileCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalDedicatedHostProfile) 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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37905,8 +41961,11 @@ func (resp *DedicatedHostProfileCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -37922,6 +41981,7 @@ func UnmarshalDedicatedHostProfileCollectionFirst(m map[string]json.RawMessage, 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)) @@ -37939,6 +41999,7 @@ func UnmarshalDedicatedHostProfileCollectionNext(m map[string]json.RawMessage, r 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)) @@ -37963,18 +42024,22 @@ func UnmarshalDedicatedHostProfileDisk(m map[string]json.RawMessage, result inte obj := new(DedicatedHostProfileDisk) err = core.UnmarshalModel(m, "interface_type", &obj.InterfaceType, UnmarshalDedicatedHostProfileDiskInterface) if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalDedicatedHostProfileDiskQuantity) if err != nil { + err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalDedicatedHostProfileDiskSize) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes, UnmarshalDedicatedHostProfileDiskSupportedInterfaces) if err != nil { + err = core.SDKErrorf(err, "", "supported_instance_interface_types-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -37988,9 +42053,8 @@ type DedicatedHostProfileDiskInterface struct { // The interface of the disk for a dedicated host with this profile // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Value *string `json:"value" validate:"required"` } @@ -38003,9 +42067,8 @@ const ( // Constants associated with the DedicatedHostProfileDiskInterface.Value property. // The interface of the disk for a dedicated host with this profile // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( DedicatedHostProfileDiskInterfaceValueNvmeConst = "nvme" ) @@ -38015,10 +42078,12 @@ func UnmarshalDedicatedHostProfileDiskInterface(m map[string]json.RawMessage, re obj := new(DedicatedHostProfileDiskInterface) 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)) @@ -38045,10 +42110,12 @@ func UnmarshalDedicatedHostProfileDiskQuantity(m map[string]json.RawMessage, res obj := new(DedicatedHostProfileDiskQuantity) 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)) @@ -38075,10 +42142,12 @@ func UnmarshalDedicatedHostProfileDiskSize(m map[string]json.RawMessage, result obj := new(DedicatedHostProfileDiskSize) 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)) @@ -38103,9 +42172,8 @@ const ( // Constants associated with the DedicatedHostProfileDiskSupportedInterfaces.Value property. // The disk interface used for attaching the disk. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( DedicatedHostProfileDiskSupportedInterfacesValueNvmeConst = "nvme" DedicatedHostProfileDiskSupportedInterfacesValueVirtioBlkConst = "virtio_blk" @@ -38116,10 +42184,12 @@ func UnmarshalDedicatedHostProfileDiskSupportedInterfaces(m map[string]json.RawM obj := new(DedicatedHostProfileDiskSupportedInterfaces) 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)) @@ -38151,10 +42221,12 @@ func UnmarshalDedicatedHostProfileIdentity(m map[string]json.RawMessage, result obj := new(DedicatedHostProfileIdentity) 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)) @@ -38209,30 +42281,37 @@ func UnmarshalDedicatedHostProfileMemory(m map[string]json.RawMessage, result in obj := new(DedicatedHostProfileMemory) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -38253,10 +42332,12 @@ func UnmarshalDedicatedHostProfileReference(m map[string]json.RawMessage, result obj := new(DedicatedHostProfileReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -38311,30 +42392,37 @@ func UnmarshalDedicatedHostProfileSocket(m map[string]json.RawMessage, result in obj := new(DedicatedHostProfileSocket) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -38389,30 +42477,37 @@ func UnmarshalDedicatedHostProfileVcpu(m map[string]json.RawMessage, result inte obj := new(DedicatedHostProfileVcpu) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -38439,10 +42534,12 @@ func UnmarshalDedicatedHostProfileVcpuArchitecture(m map[string]json.RawMessage, obj := new(DedicatedHostProfileVcpuArchitecture) 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)) @@ -38469,10 +42566,12 @@ func UnmarshalDedicatedHostProfileVcpuManufacturer(m map[string]json.RawMessage, obj := new(DedicatedHostProfileVcpuManufacturer) 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)) @@ -38519,26 +42618,32 @@ func UnmarshalDedicatedHostPrototype(m map[string]json.RawMessage, result interf obj := new(DedicatedHostPrototype) err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "instance_placement_enabled-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, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -38578,26 +42683,32 @@ func UnmarshalDedicatedHostReference(m map[string]json.RawMessage, result interf obj := new(DedicatedHostReference) 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, UnmarshalDedicatedHostReferenceDeleted) 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)) @@ -38616,6 +42727,7 @@ func UnmarshalDedicatedHostReferenceDeleted(m map[string]json.RawMessage, result obj := new(DedicatedHostReferenceDeleted) 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)) @@ -38660,38 +42772,47 @@ func UnmarshalDefaultNetworkACL(m map[string]json.RawMessage, result interface{} obj := new(DefaultNetworkACL) 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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -38702,16 +42823,15 @@ 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 `vpn_server` value is supported, but filter - // support is expected to expand in the future. + // 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. 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 // sources. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` // The date and time that this routing table was created. @@ -38815,62 +42935,77 @@ func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface obj := new(DefaultRoutingTable) err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) if err != nil { + err = core.SDKErrorf(err, "", "accept_routes_from-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) if err != nil { + err = core.SDKErrorf(err, "", "advertise_routes_to-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, "is_default", &obj.IsDefault) if err != nil { + err = core.SDKErrorf(err, "", "is_default-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, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_direct_link_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_internet_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_transit_gateway_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_vpc_zone_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) if err != nil { + err = core.SDKErrorf(err, "", "routes-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -38915,38 +43050,47 @@ func UnmarshalDefaultSecurityGroup(m map[string]json.RawMessage, result interfac obj := new(DefaultSecurityGroup) 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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) if err != nil { + err = core.SDKErrorf(err, "", "targets-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -41266,6 +45410,7 @@ func UnmarshalEncryptionKeyIdentity(m map[string]json.RawMessage, result interfa obj := new(EncryptionKeyIdentity) 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)) @@ -41285,6 +45430,7 @@ func UnmarshalEncryptionKeyReference(m map[string]json.RawMessage, result interf obj := new(EncryptionKeyReference) 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)) @@ -41303,13 +45449,13 @@ type EndpointGateway struct { // The CRN for this endpoint gateway. CRN *string `json:"crn" validate:"required"` - // The health of this resource. + // 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. + // - `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 endpoint gateway. @@ -41321,8 +45467,7 @@ type EndpointGateway struct { // The reserved IPs bound to this endpoint gateway. Ips []ReservedIPReference `json:"ips" validate:"required"` - // The reasons for the current `lifecycle_state` (if any): - // - `dns_resolution_binding_pending`: the DNS resolution binding is being set up. + // The reasons for the current `lifecycle_state` (if any). LifecycleReasons []EndpointGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the endpoint gateway. @@ -41355,13 +45500,13 @@ type EndpointGateway struct { } // Constants associated with the EndpointGateway.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. +// 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 ( EndpointGatewayHealthStateDegradedConst = "degraded" EndpointGatewayHealthStateFaultedConst = "faulted" @@ -41392,70 +45537,87 @@ func UnmarshalEndpointGateway(m map[string]json.RawMessage, result interface{}) obj := new(EndpointGateway) err = core.UnmarshalPrimitive(m, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding) if err != nil { + err = core.SDKErrorf(err, "", "allow_dns_resolution_binding-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "ips-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalEndpointGatewayLifecycleReason) 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, "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, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "service_endpoint", &obj.ServiceEndpoint) if err != nil { + err = core.SDKErrorf(err, "", "service_endpoint-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "service_endpoints", &obj.ServiceEndpoints) if err != nil { + err = core.SDKErrorf(err, "", "service_endpoints-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalEndpointGatewayTarget) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -41486,22 +45648,27 @@ func UnmarshalEndpointGatewayCollection(m map[string]json.RawMessage, result int obj := new(EndpointGatewayCollection) err = core.UnmarshalModel(m, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGateway) if err != nil { + err = core.SDKErrorf(err, "", "endpoint_gateways-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalEndpointGatewayCollectionFirst) 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, UnmarshalEndpointGatewayCollectionNext) 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)) @@ -41514,8 +45681,11 @@ func (resp *EndpointGatewayCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -41531,6 +45701,7 @@ func UnmarshalEndpointGatewayCollectionFirst(m map[string]json.RawMessage, resul 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)) @@ -41548,6 +45719,7 @@ func UnmarshalEndpointGatewayCollectionNext(m map[string]json.RawMessage, result 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)) @@ -41556,7 +45728,14 @@ func UnmarshalEndpointGatewayCollectionNext(m map[string]json.RawMessage, result // EndpointGatewayLifecycleReason : EndpointGatewayLifecycleReason struct type EndpointGatewayLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. + // A reason code for this lifecycle state: + // - `dns_resolution_binding_pending`: the DNS resolution binding is being set up + // - `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. @@ -41567,9 +45746,17 @@ type EndpointGatewayLifecycleReason struct { } // Constants associated with the EndpointGatewayLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. +// A reason code for this lifecycle state: +// - `dns_resolution_binding_pending`: the DNS resolution binding is being set up +// - `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 ( EndpointGatewayLifecycleReasonCodeDnsResolutionBindingPendingConst = "dns_resolution_binding_pending" + EndpointGatewayLifecycleReasonCodeInternalErrorConst = "internal_error" EndpointGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -41578,14 +45765,17 @@ func UnmarshalEndpointGatewayLifecycleReason(m map[string]json.RawMessage, resul obj := new(EndpointGatewayLifecycleReason) 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)) @@ -41610,10 +45800,12 @@ func UnmarshalEndpointGatewayPatch(m map[string]json.RawMessage, result interfac obj := new(EndpointGatewayPatch) err = core.UnmarshalPrimitive(m, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding) if err != nil { + err = core.SDKErrorf(err, "", "allow_dns_resolution_binding-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)) @@ -41627,6 +45819,9 @@ func (endpointGatewayPatch *EndpointGatewayPatch) AsPatch() (_patch map[string]i if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -41642,6 +45837,7 @@ func UnmarshalEndpointGatewayReferenceDeleted(m map[string]json.RawMessage, resu obj := new(EndpointGatewayReferenceDeleted) 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)) @@ -41681,26 +45877,32 @@ func UnmarshalEndpointGatewayReferenceRemote(m map[string]json.RawMessage, resul obj := new(EndpointGatewayReferenceRemote) 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) 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, UnmarshalEndpointGatewayRemote) 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)) @@ -41724,10 +45926,12 @@ func UnmarshalEndpointGatewayRemote(m map[string]json.RawMessage, result interfa obj := new(EndpointGatewayRemote) err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) if err != nil { + err = core.SDKErrorf(err, "", "account-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)) @@ -41778,26 +45982,32 @@ func UnmarshalEndpointGatewayReservedIP(m map[string]json.RawMessage, result int obj := new(EndpointGatewayReservedIP) 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 } 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 } 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)) @@ -41839,14 +46049,17 @@ func UnmarshalEndpointGatewayTarget(m map[string]json.RawMessage, result interfa obj := new(EndpointGatewayTarget) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -41890,19 +46103,27 @@ func UnmarshalEndpointGatewayTargetPrototype(m map[string]json.RawMessage, resul var discValue string err = core.UnmarshalPrimitive(m, "resource_type", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'resource_type': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'resource_type': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'resource_type' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'resource_type' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "provider_cloud_service" { err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-EndpointGatewayTargetPrototypeProviderCloudServiceIdentity-error", common.GetComponentInfo()) + } } else if discValue == "provider_infrastructure_service" { err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'resource_type': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'resource_type': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -42019,42 +46240,52 @@ func UnmarshalFloatingIP(m map[string]json.RawMessage, result interface{}) (err obj := new(FloatingIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-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, "target", &obj.Target, UnmarshalFloatingIPTarget) if err != nil { + err = core.SDKErrorf(err, "", "target-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)) @@ -42085,22 +46316,27 @@ func UnmarshalFloatingIPCollection(m map[string]json.RawMessage, result interfac obj := new(FloatingIPCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFloatingIPCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "floating_ips-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, UnmarshalFloatingIPCollectionNext) 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)) @@ -42113,8 +46349,11 @@ func (resp *FloatingIPCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -42130,6 +46369,7 @@ func UnmarshalFloatingIPCollectionFirst(m map[string]json.RawMessage, result int 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)) @@ -42147,6 +46387,7 @@ func UnmarshalFloatingIPCollectionNext(m map[string]json.RawMessage, result inte 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)) @@ -42177,22 +46418,27 @@ func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext(m map[string]js obj := new(FloatingIPCollectionVirtualNetworkInterfaceContext) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) if err != nil { + err = core.SDKErrorf(err, "", "floating_ips-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, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext) 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)) @@ -42205,8 +46451,11 @@ func (resp *FloatingIPCollectionVirtualNetworkInterfaceContext) GetNextStart() ( return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -42222,6 +46471,7 @@ func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextFirst(m map[stri 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)) @@ -42239,6 +46489,7 @@ func UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext(m map[strin 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)) @@ -42269,10 +46520,12 @@ func UnmarshalFloatingIPPatch(m map[string]json.RawMessage, result interface{}) obj := new(FloatingIPPatch) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPatch) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -42286,6 +46539,9 @@ func (floatingIPPatch *FloatingIPPatch) AsPatch() (_patch map[string]interface{} if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -42329,18 +46585,22 @@ func UnmarshalFloatingIPPrototype(m map[string]json.RawMessage, result interface obj := new(FloatingIPPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -42374,26 +46634,32 @@ func UnmarshalFloatingIPReference(m map[string]json.RawMessage, result interface obj := new(FloatingIPReference) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-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, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -42412,6 +46678,7 @@ func UnmarshalFloatingIPReferenceDeleted(m map[string]json.RawMessage, result in obj := new(FloatingIPReferenceDeleted) 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)) @@ -42478,34 +46745,42 @@ func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) obj := new(FloatingIPTarget) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "resource_type-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -42559,14 +46834,17 @@ func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interfa obj := new(FloatingIPTargetPatch) 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 } 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)) @@ -42617,14 +46895,17 @@ func UnmarshalFloatingIPTargetPrototype(m map[string]json.RawMessage, result int obj := new(FloatingIPTargetPrototype) 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 } 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)) @@ -42642,6 +46923,7 @@ func UnmarshalFloatingIPUnpaginatedCollection(m map[string]json.RawMessage, resu obj := new(FloatingIPUnpaginatedCollection) err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "floating_ips-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -42726,50 +47008,62 @@ func UnmarshalFlowLogCollector(m map[string]json.RawMessage, result interface{}) obj := new(FlowLogCollector) err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { + err = core.SDKErrorf(err, "", "active-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, "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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalLegacyCloudObjectStorageBucketReference) if err != nil { + err = core.SDKErrorf(err, "", "storage_bucket-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFlowLogCollectorTarget) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -42800,22 +47094,27 @@ func UnmarshalFlowLogCollectorCollection(m map[string]json.RawMessage, result in obj := new(FlowLogCollectorCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFlowLogCollectorCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "flow_log_collectors", &obj.FlowLogCollectors, UnmarshalFlowLogCollector) if err != nil { + err = core.SDKErrorf(err, "", "flow_log_collectors-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, UnmarshalFlowLogCollectorCollectionNext) 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)) @@ -42828,8 +47127,11 @@ func (resp *FlowLogCollectorCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -42845,6 +47147,7 @@ func UnmarshalFlowLogCollectorCollectionFirst(m map[string]json.RawMessage, resu 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)) @@ -42862,6 +47165,7 @@ func UnmarshalFlowLogCollectorCollectionNext(m map[string]json.RawMessage, resul 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)) @@ -42883,10 +47187,12 @@ func UnmarshalFlowLogCollectorPatch(m map[string]json.RawMessage, result interfa obj := new(FlowLogCollectorPatch) err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { + err = core.SDKErrorf(err, "", "active-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)) @@ -42900,6 +47206,9 @@ func (flowLogCollectorPatch *FlowLogCollectorPatch) AsPatch() (_patch map[string if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -42985,34 +47294,42 @@ func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interf obj := new(FlowLogCollectorTarget) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) 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 } err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -43067,14 +47384,17 @@ func UnmarshalFlowLogCollectorTargetPrototype(m map[string]json.RawMessage, resu obj := new(FlowLogCollectorTargetPrototype) 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 } 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)) @@ -43093,6 +47413,7 @@ func UnmarshalGenericResourceReferenceDeleted(m map[string]json.RawMessage, resu obj := new(GenericResourceReferenceDeleted) 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)) @@ -46237,54 +50558,67 @@ func UnmarshalIkePolicy(m map[string]json.RawMessage, result interface{}) (err e obj := new(IkePolicy) err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) if err != nil { + err = core.SDKErrorf(err, "", "connections-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, "dh_group", &obj.DhGroup) if err != nil { + err = core.SDKErrorf(err, "", "dh_group-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "encryption_algorithm-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, "ike_version", &obj.IkeVersion) if err != nil { + err = core.SDKErrorf(err, "", "ike_version-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) if err != nil { + err = core.SDKErrorf(err, "", "key_lifetime-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, "negotiation_mode", &obj.NegotiationMode) if err != nil { + err = core.SDKErrorf(err, "", "negotiation_mode-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -46315,22 +50649,27 @@ func UnmarshalIkePolicyCollection(m map[string]json.RawMessage, result interface obj := new(IkePolicyCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIkePolicyCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_policies", &obj.IkePolicies, UnmarshalIkePolicy) if err != nil { + err = core.SDKErrorf(err, "", "ike_policies-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, UnmarshalIkePolicyCollectionNext) 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)) @@ -46343,8 +50682,11 @@ func (resp *IkePolicyCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -46391,26 +50733,32 @@ func UnmarshalIkePolicyPatch(m map[string]json.RawMessage, result interface{}) ( obj := new(IkePolicyPatch) err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup) if err != nil { + err = core.SDKErrorf(err, "", "dh_group-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "encryption_algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion) if err != nil { + err = core.SDKErrorf(err, "", "ike_version-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) if err != nil { + err = core.SDKErrorf(err, "", "key_lifetime-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)) @@ -46424,6 +50772,9 @@ func (ikePolicyPatch *IkePolicyPatch) AsPatch() (_patch map[string]interface{}, if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -46457,22 +50808,27 @@ func UnmarshalIkePolicyReference(m map[string]json.RawMessage, result interface{ obj := new(IkePolicyReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIkePolicyReferenceDeleted) 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)) @@ -46483,9 +50839,8 @@ func UnmarshalIkePolicyReference(m map[string]json.RawMessage, result interface{ type IP struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -46495,6 +50850,9 @@ func (*VpcV1) NewIP(address string) (_model *IP, err error) { Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -46503,6 +50861,7 @@ func UnmarshalIP(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(IP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -46643,54 +51002,67 @@ func UnmarshalIPsecPolicy(m map[string]json.RawMessage, result interface{}) (err obj := new(IPsecPolicy) err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) if err != nil { + err = core.SDKErrorf(err, "", "connections-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, "encapsulation_mode", &obj.EncapsulationMode) if err != nil { + err = core.SDKErrorf(err, "", "encapsulation_mode-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "encryption_algorithm-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, "key_lifetime", &obj.KeyLifetime) if err != nil { + err = core.SDKErrorf(err, "", "key_lifetime-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, "pfs", &obj.Pfs) if err != nil { + err = core.SDKErrorf(err, "", "pfs-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.UnmarshalPrimitive(m, "transform_protocol", &obj.TransformProtocol) if err != nil { + err = core.SDKErrorf(err, "", "transform_protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -46721,22 +51093,27 @@ func UnmarshalIPsecPolicyCollection(m map[string]json.RawMessage, result interfa obj := new(IPsecPolicyCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIPsecPolicyCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ipsec_policies", &obj.IpsecPolicies, UnmarshalIPsecPolicy) if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policies-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, UnmarshalIPsecPolicyCollectionNext) 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)) @@ -46749,8 +51126,11 @@ func (resp *IPsecPolicyCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -46766,6 +51146,7 @@ func UnmarshalIPsecPolicyCollectionFirst(m map[string]json.RawMessage, result in 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)) @@ -46783,6 +51164,7 @@ func UnmarshalIPsecPolicyCollectionNext(m map[string]json.RawMessage, result int 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)) @@ -46864,22 +51246,27 @@ func UnmarshalIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) obj := new(IPsecPolicyPatch) err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) if err != nil { + err = core.SDKErrorf(err, "", "encryption_algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) if err != nil { + err = core.SDKErrorf(err, "", "key_lifetime-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, "pfs", &obj.Pfs) if err != nil { + err = core.SDKErrorf(err, "", "pfs-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -46893,6 +51280,9 @@ func (iPsecPolicyPatch *IPsecPolicyPatch) AsPatch() (_patch map[string]interface if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -46926,22 +51316,27 @@ func UnmarshalIPsecPolicyReference(m map[string]json.RawMessage, result interfac obj := new(IPsecPolicyReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIPsecPolicyReferenceDeleted) 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)) @@ -46960,6 +51355,7 @@ func UnmarshalIPsecPolicyReferenceDeleted(m map[string]json.RawMessage, result i obj := new(IPsecPolicyReferenceDeleted) 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)) @@ -46977,6 +51373,7 @@ func UnmarshalIkePolicyCollectionFirst(m map[string]json.RawMessage, result inte 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)) @@ -46994,6 +51391,7 @@ func UnmarshalIkePolicyCollectionNext(m map[string]json.RawMessage, result inter 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)) @@ -47012,6 +51410,7 @@ func UnmarshalIkePolicyReferenceDeleted(m map[string]json.RawMessage, result int obj := new(IkePolicyReferenceDeleted) 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)) @@ -47078,7 +51477,7 @@ type Image struct { // If absent, this image was not created from a volume. SourceVolume *VolumeReference `json:"source_volume,omitempty"` - // The status of this image + // The status of this image: // - available: image can be used (provisionable) // - deleting: image is being deleted, and can no longer be used to provision new // resources @@ -47088,27 +51487,10 @@ type Image struct { // - pending: image is being imported and is not yet `available` // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the - // unexpected property value was encountered. + // 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): - // - `encrypted_data_key_invalid`: image cannot be decrypted with the specified - // `encryption_key` - // - `encryption_key_deleted`: image unusable because its `encryption_key` was deleted - // - `encryption_key_disabled`: image unusable until its `encryption_key` is re-enabled - // - `image_data_corrupted`: image data is corrupt, or is not in the specified format - // - `image_provisioned_size_unsupported`: image requires a boot volume size greater - // than the maximum supported value - // - `image_request_in_progress`: image operation is in progress (such as an import from - // Cloud Object Storage) - // - `image_request_queued`: image request has been accepted but the requested - // operation has not started - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []ImageStatusReason `json:"status_reasons" validate:"required"` // The visibility of this image. @@ -47131,7 +51513,7 @@ const ( ) // Constants associated with the Image.Status property. -// The status of this image +// The status of this image: // - available: image can be used (provisionable) // - deleting: image is being deleted, and can no longer be used to provision new // resources @@ -47141,9 +51523,8 @@ const ( // - pending: image is being imported and is not yet `available` // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ImageStatusAvailableConst = "available" ImageStatusDeletingConst = "deleting" @@ -47168,78 +51549,97 @@ func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error obj := new(Image) err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalImageCatalogOffering) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) if err != nil { + err = core.SDKErrorf(err, "", "deprecation_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) if err != nil { + err = core.SDKErrorf(err, "", "encryption-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, "file", &obj.File, UnmarshalImageFile) if err != nil { + err = core.SDKErrorf(err, "", "file-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, "minimum_provisioned_size", &obj.MinimumProvisionedSize) if err != nil { + err = core.SDKErrorf(err, "", "minimum_provisioned_size-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, "obsolescence_at", &obj.ObsolescenceAt) if err != nil { + err = core.SDKErrorf(err, "", "obsolescence_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) if err != nil { + err = core.SDKErrorf(err, "", "operating_system-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, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) if err != nil { + err = core.SDKErrorf(err, "", "source_volume-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, UnmarshalImageStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "visibility", &obj.Visibility) if err != nil { + err = core.SDKErrorf(err, "", "visibility-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47250,9 +51650,8 @@ func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error type ImageCatalogOffering struct { // Indicates whether this image is managed as part of a // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. If an image is managed, - // accounts in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise) with access to that catalog can - // specify the image's catalog offering version CRN to provision virtual server instances using the image. + // accounts with access to that catalog can specify the image's catalog offering version CRN to provision virtual + // server instances using the image. Managed *bool `json:"managed" validate:"required"` // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) @@ -47267,10 +51666,12 @@ func UnmarshalImageCatalogOffering(m map[string]json.RawMessage, result interfac obj := new(ImageCatalogOffering) err = core.UnmarshalPrimitive(m, "managed", &obj.Managed) if err != nil { + err = core.SDKErrorf(err, "", "managed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47301,22 +51702,27 @@ func UnmarshalImageCollection(m map[string]json.RawMessage, result interface{}) obj := new(ImageCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalImageCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "images", &obj.Images, UnmarshalImage) if err != nil { + err = core.SDKErrorf(err, "", "images-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, UnmarshalImageCollectionNext) 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)) @@ -47329,8 +51735,11 @@ func (resp *ImageCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -47346,6 +51755,7 @@ func UnmarshalImageCollectionFirst(m map[string]json.RawMessage, result interfac 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)) @@ -47363,6 +51773,7 @@ func UnmarshalImageCollectionNext(m map[string]json.RawMessage, result interface 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)) @@ -47419,10 +51830,6 @@ type ImageExportJob struct { Status *string `json:"status" validate:"required"` // The reasons for the current status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []ImageExportJobStatusReason `json:"status_reasons" validate:"required"` // The Cloud Object Storage bucket of the exported image object. @@ -47475,58 +51882,72 @@ func UnmarshalImageExportJob(m map[string]json.RawMessage, result interface{}) ( obj := new(ImageExportJob) 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, "encrypted_data_key", &obj.EncryptedDataKey) if err != nil { + err = core.SDKErrorf(err, "", "encrypted_data_key-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "format", &obj.Format) if err != nil { + err = core.SDKErrorf(err, "", "format-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 } err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) if err != nil { + err = core.SDKErrorf(err, "", "started_at-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, UnmarshalImageExportJobStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalCloudObjectStorageBucketReference) if err != nil { + err = core.SDKErrorf(err, "", "storage_bucket-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "storage_href", &obj.StorageHref) if err != nil { + err = core.SDKErrorf(err, "", "storage_href-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "storage_object", &obj.StorageObject, UnmarshalCloudObjectStorageObjectReference) if err != nil { + err = core.SDKErrorf(err, "", "storage_object-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47546,6 +51967,7 @@ func UnmarshalImageExportJobPatch(m map[string]json.RawMessage, result interface obj := new(ImageExportJobPatch) 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)) @@ -47559,12 +51981,18 @@ func (imageExportJobPatch *ImageExportJobPatch) AsPatch() (_patch map[string]int if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } // ImageExportJobStatusReason : ImageExportJobStatusReason struct type ImageExportJobStatusReason struct { // A snake case string succinctly identifying the status reason. + // + // 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. @@ -47576,6 +52004,9 @@ type ImageExportJobStatusReason struct { // Constants associated with the ImageExportJobStatusReason.Code property. // A snake case string succinctly identifying the status reason. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ImageExportJobStatusReasonCodeCannotAccessStorageBucketConst = "cannot_access_storage_bucket" ImageExportJobStatusReasonCodeInternalErrorConst = "internal_error" @@ -47586,14 +52017,17 @@ func UnmarshalImageExportJobStatusReason(m map[string]json.RawMessage, result in obj := new(ImageExportJobStatusReason) 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)) @@ -47611,6 +52045,7 @@ func UnmarshalImageExportJobUnpaginatedCollection(m map[string]json.RawMessage, obj := new(ImageExportJobUnpaginatedCollection) err = core.UnmarshalModel(m, "export_jobs", &obj.ExportJobs, UnmarshalImageExportJob) if err != nil { + err = core.SDKErrorf(err, "", "export_jobs-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47637,10 +52072,12 @@ func UnmarshalImageFile(m map[string]json.RawMessage, result interface{}) (err e obj := new(ImageFile) err = core.UnmarshalModel(m, "checksums", &obj.Checksums, UnmarshalImageFileChecksums) if err != nil { + err = core.SDKErrorf(err, "", "checksums-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47658,6 +52095,7 @@ func UnmarshalImageFileChecksums(m map[string]json.RawMessage, result interface{ obj := new(ImageFileChecksums) err = core.UnmarshalPrimitive(m, "sha256", &obj.Sha256) if err != nil { + err = core.SDKErrorf(err, "", "sha256-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47679,6 +52117,9 @@ func (*VpcV1) NewImageFilePrototype(href string) (_model *ImageFilePrototype, er Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -47687,6 +52128,7 @@ func UnmarshalImageFilePrototype(m map[string]json.RawMessage, result interface{ obj := new(ImageFilePrototype) 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)) @@ -47722,14 +52164,17 @@ func UnmarshalImageIdentity(m map[string]json.RawMessage, result interface{}) (e obj := new(ImageIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47781,14 +52226,17 @@ func UnmarshalImagePatch(m map[string]json.RawMessage, result interface{}) (err obj := new(ImagePatch) err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) if err != nil { + err = core.SDKErrorf(err, "", "deprecation_at-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, "obsolescence_at", &obj.ObsolescenceAt) if err != nil { + err = core.SDKErrorf(err, "", "obsolescence_at-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47802,6 +52250,9 @@ func (imagePatch *ImagePatch) AsPatch() (_patch map[string]interface{}, err erro if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -47889,38 +52340,47 @@ func UnmarshalImagePrototype(m map[string]json.RawMessage, result interface{}) ( obj := new(ImagePrototype) err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) if err != nil { + err = core.SDKErrorf(err, "", "deprecation_at-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, "obsolescence_at", &obj.ObsolescenceAt) if err != nil { + err = core.SDKErrorf(err, "", "obsolescence_at-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.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) if err != nil { + err = core.SDKErrorf(err, "", "encrypted_data_key-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, "file", &obj.File, UnmarshalImageFilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "file-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) if err != nil { + err = core.SDKErrorf(err, "", "operating_system-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -47964,30 +52424,37 @@ func UnmarshalImageReference(m map[string]json.RawMessage, result interface{}) ( obj := new(ImageReference) 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, UnmarshalImageReferenceDeleted) 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, UnmarshalImageRemote) 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)) @@ -48006,6 +52473,7 @@ func UnmarshalImageReferenceDeleted(m map[string]json.RawMessage, result interfa obj := new(ImageReferenceDeleted) 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)) @@ -48029,10 +52497,12 @@ func UnmarshalImageRemote(m map[string]json.RawMessage, result interface{}) (err obj := new(ImageRemote) err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) if err != nil { + err = core.SDKErrorf(err, "", "account-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)) @@ -48041,7 +52511,21 @@ func UnmarshalImageRemote(m map[string]json.RawMessage, result interface{}) (err // ImageStatusReason : ImageStatusReason struct type ImageStatusReason struct { - // A snake case string succinctly identifying the status reason. + // A reason code for the status: + // - `encrypted_data_key_invalid`: image cannot be decrypted with the specified + // `encryption_key` + // - `encryption_key_deleted`: image unusable because its `encryption_key` was deleted + // - `encryption_key_disabled`: image unusable until its `encryption_key` is re-enabled + // - `image_data_corrupted`: image data is corrupt, or is not in the specified format + // - `image_provisioned_size_unsupported`: image requires a boot volume size greater + // than the maximum supported value + // - `image_request_in_progress`: image operation is in progress (such as an import from + // Cloud Object Storage) + // - `image_request_queued`: image request has been accepted but the requested + // operation has not started + // + // 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. @@ -48052,7 +52536,21 @@ type ImageStatusReason struct { } // Constants associated with the ImageStatusReason.Code property. -// A snake case string succinctly identifying the status reason. +// A reason code for the status: +// - `encrypted_data_key_invalid`: image cannot be decrypted with the specified +// `encryption_key` +// - `encryption_key_deleted`: image unusable because its `encryption_key` was deleted +// - `encryption_key_disabled`: image unusable until its `encryption_key` is re-enabled +// - `image_data_corrupted`: image data is corrupt, or is not in the specified format +// - `image_provisioned_size_unsupported`: image requires a boot volume size greater +// than the maximum supported value +// - `image_request_in_progress`: image operation is in progress (such as an import from +// Cloud Object Storage) +// - `image_request_queued`: image request has been accepted but the requested +// operation has not started +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ImageStatusReasonCodeEncryptedDataKeyInvalidConst = "encrypted_data_key_invalid" ImageStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" @@ -48068,14 +52566,17 @@ func UnmarshalImageStatusReason(m map[string]json.RawMessage, result interface{} obj := new(ImageStatusReason) 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)) @@ -48113,25 +52614,16 @@ type Instance struct { // The virtual server instance GPU configuration. Gpu *InstanceGpu `json:"gpu,omitempty"` - // The reasons for the current instance `health_state` (if any): - // - `reservation_capacity_unavailable`: The reservation affinity pool has no - // available capacity. - // - `reservation_deleted`: The reservation affinity pool has a deleted reservation. - // - `reservation_expired`: The reservation affinity pool has an expired reservation. - // - `reservation_failed`: The reservation affinity pool has a failed reservation. - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `health_state` (if any). HealthReasons []InstanceHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 virtual server instance. @@ -48144,10 +52636,6 @@ type Instance struct { Image *ImageReference `json:"image,omitempty"` // The reasons for the current `lifecycle_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. LifecycleReasons []InstanceLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the virtual server instance. @@ -48213,16 +52701,11 @@ type Instance struct { // The status of the virtual server instance. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the instance on which the unexpected - // property value was encountered. + // 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). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []InstanceStatusReason `json:"status_reasons" validate:"required"` // The amount of bandwidth (in megabits per second) allocated exclusively to instance network attachments or instance @@ -48248,13 +52731,13 @@ type Instance struct { } // Constants associated with the Instance.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. +// 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 ( InstanceHealthStateDegradedConst = "degraded" InstanceHealthStateFaultedConst = "faulted" @@ -48283,9 +52766,8 @@ const ( // Constants associated with the Instance.Status property. // The status of the virtual server instance. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the instance on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceStatusDeletingConst = "deleting" InstanceStatusFailedConst = "failed" @@ -48302,158 +52784,197 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er obj := new(Instance) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicy) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentReferenceInstanceContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOffering) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "dedicated_host", &obj.DedicatedHost, UnmarshalDedicatedHostReference) if err != nil { + err = core.SDKErrorf(err, "", "dedicated_host-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "gpu", &obj.Gpu, UnmarshalInstanceGpu) if err != nil { + err = core.SDKErrorf(err, "", "gpu-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalInstanceHealthReason) 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.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceLifecycleReason) 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, "memory", &obj.Memory) if err != nil { + err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataService) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentReference) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceInstanceContextReference) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "numa_count", &obj.NumaCount) if err != nil { + err = core.SDKErrorf(err, "", "numa_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTarget) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentReference) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceInstanceContextReference) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation", &obj.Reservation, UnmarshalReservationReference) if err != nil { + err = core.SDKErrorf(err, "", "reservation-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinity) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "startable", &obj.Startable) if err != nil { + err = core.SDKErrorf(err, "", "startable-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, UnmarshalInstanceStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "total_network_bandwidth", &obj.TotalNetworkBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_network_bandwidth-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalInstanceVcpu) if err != nil { + err = core.SDKErrorf(err, "", "vcpu-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceInstanceContext) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-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)) @@ -48514,34 +53035,42 @@ func UnmarshalInstanceAction(m map[string]json.RawMessage, result interface{}) ( obj := new(InstanceAction) 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, "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 } err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) if err != nil { + err = core.SDKErrorf(err, "", "started_at-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.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)) @@ -48550,24 +53079,22 @@ func UnmarshalInstanceAction(m map[string]json.RawMessage, result interface{}) ( // InstanceAvailabilityPolicy : InstanceAvailabilityPolicy struct type InstanceAvailabilityPolicy struct { - // The action to perform if the compute host experiences a failure. + // The action to perform if the compute host experiences a failure: // - `restart`: Automatically restart the virtual server instance after host failure // - `stop`: Leave the virtual server instance stopped after host failure // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. HostFailure *string `json:"host_failure" validate:"required"` } // Constants associated with the InstanceAvailabilityPolicy.HostFailure property. -// The action to perform if the compute host experiences a failure. +// The action to perform if the compute host experiences a failure: // - `restart`: Automatically restart the virtual server instance after host failure // - `stop`: Leave the virtual server instance stopped after host failure // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the instance on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceAvailabilityPolicyHostFailureRestartConst = "restart" InstanceAvailabilityPolicyHostFailureStopConst = "stop" @@ -48578,6 +53105,7 @@ func UnmarshalInstanceAvailabilityPolicy(m map[string]json.RawMessage, result in obj := new(InstanceAvailabilityPolicy) err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) if err != nil { + err = core.SDKErrorf(err, "", "host_failure-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48606,6 +53134,7 @@ func UnmarshalInstanceAvailabilityPolicyPatch(m map[string]json.RawMessage, resu obj := new(InstanceAvailabilityPolicyPatch) err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) if err != nil { + err = core.SDKErrorf(err, "", "host_failure-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48634,6 +53163,7 @@ func UnmarshalInstanceAvailabilityPolicyPrototype(m map[string]json.RawMessage, obj := new(InstanceAvailabilityPolicyPrototype) err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) if err != nil { + err = core.SDKErrorf(err, "", "host_failure-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48656,6 +53186,7 @@ func UnmarshalInstanceCatalogOffering(m map[string]json.RawMessage, result inter obj := new(InstanceCatalogOffering) err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48667,8 +53198,7 @@ func UnmarshalInstanceCatalogOffering(m map[string]json.RawMessage, result inter // // If an offering is specified, the latest version of that offering will be used. // -// The specified offering or offering version may be in a different account in the same -// [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject to IAM policies. +// The specified offering or offering version may be in a different account, subject to IAM policies. // Models which "extend" this model: // - InstanceCatalogOfferingPrototypeCatalogOfferingByOffering // - InstanceCatalogOfferingPrototypeCatalogOfferingByVersion @@ -48696,10 +53226,12 @@ func UnmarshalInstanceCatalogOfferingPrototype(m map[string]json.RawMessage, res obj := new(InstanceCatalogOfferingPrototype) err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) if err != nil { + err = core.SDKErrorf(err, "", "offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48730,22 +53262,27 @@ func UnmarshalInstanceCollection(m map[string]json.RawMessage, result interface{ obj := new(InstanceCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceCollectionFirst) 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, UnmarshalInstanceCollectionNext) 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)) @@ -48758,8 +53295,11 @@ func (resp *InstanceCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -48775,6 +53315,7 @@ func UnmarshalInstanceCollectionFirst(m map[string]json.RawMessage, result inter obj := new(InstanceCollectionFirst) 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)) @@ -48792,6 +53333,7 @@ func UnmarshalInstanceCollectionNext(m map[string]json.RawMessage, result interf obj := new(InstanceCollectionNext) 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)) @@ -48832,26 +53374,32 @@ func UnmarshalInstanceConsoleAccessToken(m map[string]json.RawMessage, result in obj := new(InstanceConsoleAccessToken) err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) if err != nil { + err = core.SDKErrorf(err, "", "access_token-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) if err != nil { + err = core.SDKErrorf(err, "", "console_type-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, "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)) @@ -48875,6 +53423,9 @@ func (*VpcV1) NewInstanceDefaultTrustedProfilePrototype(target TrustedProfileIde Target: target, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -48883,10 +53434,12 @@ func UnmarshalInstanceDefaultTrustedProfilePrototype(m map[string]json.RawMessag obj := new(InstanceDefaultTrustedProfilePrototype) err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink) if err != nil { + err = core.SDKErrorf(err, "", "auto_link-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48906,9 +53459,8 @@ type InstanceDisk struct { // The disk interface used for attaching the disk. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // 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 name for this instance disk. The name is unique across all disks on the instance. @@ -48924,9 +53476,8 @@ type InstanceDisk struct { // Constants associated with the InstanceDisk.InterfaceType property. // The disk interface used for attaching the disk. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceDiskInterfaceTypeNvmeConst = "nvme" InstanceDiskInterfaceTypeVirtioBlkConst = "virtio_blk" @@ -48943,30 +53494,37 @@ func UnmarshalInstanceDisk(m map[string]json.RawMessage, result interface{}) (er obj := new(InstanceDisk) 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, "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.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -48984,6 +53542,7 @@ func UnmarshalInstanceDiskCollection(m map[string]json.RawMessage, result interf obj := new(InstanceDiskCollection) err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49001,6 +53560,7 @@ func UnmarshalInstanceDiskPatch(m map[string]json.RawMessage, result interface{} obj := new(InstanceDiskPatch) 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)) @@ -49014,6 +53574,9 @@ func (instanceDiskPatch *InstanceDiskPatch) AsPatch() (_patch map[string]interfa if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -49047,22 +53610,27 @@ func UnmarshalInstanceDiskReference(m map[string]json.RawMessage, result interfa obj := new(InstanceDiskReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceDiskReferenceDeleted) 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)) @@ -49081,6 +53649,7 @@ func UnmarshalInstanceDiskReferenceDeleted(m map[string]json.RawMessage, result obj := new(InstanceDiskReferenceDeleted) 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)) @@ -49107,18 +53676,22 @@ func UnmarshalInstanceGpu(m map[string]json.RawMessage, result interface{}) (err obj := new(InstanceGpu) err = core.UnmarshalPrimitive(m, "count", &obj.Count) if err != nil { + err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) if err != nil { + err = core.SDKErrorf(err, "", "manufacturer-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) if err != nil { + err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "model", &obj.Model) if err != nil { + err = core.SDKErrorf(err, "", "model-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49147,6 +53720,12 @@ type InstanceGroup struct { // The template used to create new instances for this group. InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []InstanceGroupLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the instance group. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + // If present, the load balancer pool this instance group manages. A pool member will // be created for each instance created by this group. LoadBalancerPool *LoadBalancerPoolReference `json:"load_balancer_pool,omitempty"` @@ -49180,6 +53759,18 @@ type InstanceGroup struct { VPC *VPCReference `json:"vpc" validate:"required"` } +// Constants associated with the InstanceGroup.LifecycleState property. +// The lifecycle state of the instance group. +const ( + InstanceGroupLifecycleStateDeletingConst = "deleting" + InstanceGroupLifecycleStateFailedConst = "failed" + InstanceGroupLifecycleStatePendingConst = "pending" + InstanceGroupLifecycleStateStableConst = "stable" + InstanceGroupLifecycleStateSuspendedConst = "suspended" + InstanceGroupLifecycleStateUpdatingConst = "updating" + InstanceGroupLifecycleStateWaitingConst = "waiting" +) + // Constants associated with the InstanceGroup.Status property. // The status of the instance group // - `deleting`: Group is being deleted @@ -49199,62 +53790,87 @@ func UnmarshalInstanceGroup(m map[string]json.RawMessage, result interface{}) (e obj := new(InstanceGroup) err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) if err != nil { + err = core.SDKErrorf(err, "", "application_port-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) if err != nil { + err = core.SDKErrorf(err, "", "instance_template-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceGroupLifecycleReason) + 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.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolReference) if err != nil { + err = core.SDKErrorf(err, "", "load_balancer_pool-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManagerReference) if err != nil { + err = core.SDKErrorf(err, "", "managers-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "membership_count-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-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, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49285,22 +53901,27 @@ func UnmarshalInstanceGroupCollection(m map[string]json.RawMessage, result inter obj := new(InstanceGroupCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "instance_groups", &obj.InstanceGroups, UnmarshalInstanceGroup) if err != nil { + err = core.SDKErrorf(err, "", "instance_groups-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, UnmarshalInstanceGroupCollectionNext) 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)) @@ -49313,8 +53934,11 @@ func (resp *InstanceGroupCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -49330,6 +53954,7 @@ func UnmarshalInstanceGroupCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -49347,6 +53972,60 @@ func UnmarshalInstanceGroupCollectionNext(m map[string]json.RawMessage, result i 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: + // - `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 InstanceGroupLifecycleReason.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 ( + InstanceGroupLifecycleReasonCodeInternalErrorConst = "internal_error" + InstanceGroupLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalInstanceGroupLifecycleReason unmarshals an instance of InstanceGroupLifecycleReason from the specified map of raw messages. +func UnmarshalInstanceGroupLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupLifecycleReason) + 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)) @@ -49417,54 +54096,67 @@ func UnmarshalInstanceGroupManager(m map[string]json.RawMessage, result interfac obj := new(InstanceGroupManager) 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, "management_enabled", &obj.ManagementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "management_enabled-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, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) if err != nil { + err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) if err != nil { + err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) if err != nil { + err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) if err != nil { + err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference) if err != nil { + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49571,62 +54263,77 @@ func UnmarshalInstanceGroupManagerAction(m map[string]json.RawMessage, result in obj := new(InstanceGroupManagerAction) 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_timeout", &obj.AutoDeleteTimeout) if err != nil { + err = core.SDKErrorf(err, "", "auto_delete_timeout-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, "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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) if err != nil { + err = core.SDKErrorf(err, "", "action_type-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.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) if err != nil { + err = core.SDKErrorf(err, "", "last_applied_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) if err != nil { + err = core.SDKErrorf(err, "", "next_run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) if err != nil { + err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49644,6 +54351,7 @@ func UnmarshalInstanceGroupManagerActionGroupPatch(m map[string]json.RawMessage, obj := new(InstanceGroupManagerActionGroupPatch) err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49664,10 +54372,12 @@ func UnmarshalInstanceGroupManagerActionManagerPatch(m map[string]json.RawMessag obj := new(InstanceGroupManagerActionManagerPatch) err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49697,22 +54407,27 @@ func UnmarshalInstanceGroupManagerActionPatch(m map[string]json.RawMessage, resu obj := new(InstanceGroupManagerActionPatch) 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, "group", &obj.Group, UnmarshalInstanceGroupManagerActionGroupPatch) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerActionManagerPatch) if err != nil { + err = core.SDKErrorf(err, "", "manager-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, "run_at", &obj.RunAt) if err != nil { + err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49726,6 +54441,9 @@ func (instanceGroupManagerActionPatch *InstanceGroupManagerActionPatch) AsPatch( if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -49762,22 +54480,27 @@ func UnmarshalInstanceGroupManagerActionPrototype(m map[string]json.RawMessage, obj := new(InstanceGroupManagerActionPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) if err != nil { + err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manager-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -49815,22 +54538,27 @@ func UnmarshalInstanceGroupManagerActionReference(m map[string]json.RawMessage, obj := new(InstanceGroupManagerActionReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerActionReferenceDeleted) 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)) @@ -49849,6 +54577,7 @@ func UnmarshalInstanceGroupManagerActionReferenceDeleted(m map[string]json.RawMe obj := new(InstanceGroupManagerActionReferenceDeleted) 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)) @@ -49879,22 +54608,27 @@ func UnmarshalInstanceGroupManagerActionsCollection(m map[string]json.RawMessage obj := new(InstanceGroupManagerActionsCollection) err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerAction) if err != nil { + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerActionsCollectionFirst) 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, UnmarshalInstanceGroupManagerActionsCollectionNext) 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)) @@ -49907,8 +54641,11 @@ func (resp *InstanceGroupManagerActionsCollection) GetNextStart() (*string, erro return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -49924,6 +54661,7 @@ func UnmarshalInstanceGroupManagerActionsCollectionFirst(m map[string]json.RawMe 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)) @@ -49941,6 +54679,7 @@ func UnmarshalInstanceGroupManagerActionsCollectionNext(m map[string]json.RawMes 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)) @@ -49971,22 +54710,27 @@ func UnmarshalInstanceGroupManagerCollection(m map[string]json.RawMessage, resul obj := new(InstanceGroupManagerCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerCollectionFirst) 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, "managers", &obj.Managers, UnmarshalInstanceGroupManager) if err != nil { + err = core.SDKErrorf(err, "", "managers-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerCollectionNext) 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)) @@ -49999,8 +54743,11 @@ func (resp *InstanceGroupManagerCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -50016,6 +54763,7 @@ func UnmarshalInstanceGroupManagerCollectionFirst(m map[string]json.RawMessage, 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)) @@ -50033,6 +54781,7 @@ func UnmarshalInstanceGroupManagerCollectionNext(m map[string]json.RawMessage, r 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)) @@ -50065,26 +54814,32 @@ func UnmarshalInstanceGroupManagerPatch(m map[string]json.RawMessage, result int obj := new(InstanceGroupManagerPatch) err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) if err != nil { + err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) if err != nil { + err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "management_enabled-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-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)) @@ -50098,6 +54853,9 @@ func (instanceGroupManagerPatch *InstanceGroupManagerPatch) AsPatch() (_patch ma if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -50159,34 +54917,42 @@ func UnmarshalInstanceGroupManagerPolicy(m map[string]json.RawMessage, result in obj := new(InstanceGroupManagerPolicy) 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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) if err != nil { + err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) if err != nil { + err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) if err != nil { + err = core.SDKErrorf(err, "", "policy_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50217,22 +54983,27 @@ func UnmarshalInstanceGroupManagerPolicyCollection(m map[string]json.RawMessage, obj := new(InstanceGroupManagerPolicyCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerPolicyCollectionFirst) 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, UnmarshalInstanceGroupManagerPolicyCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicy) if err != nil { + err = core.SDKErrorf(err, "", "policies-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)) @@ -50245,8 +55016,11 @@ func (resp *InstanceGroupManagerPolicyCollection) GetNextStart() (*string, error return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -50262,6 +55036,7 @@ func UnmarshalInstanceGroupManagerPolicyCollectionFirst(m map[string]json.RawMes 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)) @@ -50279,6 +55054,7 @@ func UnmarshalInstanceGroupManagerPolicyCollectionNext(m map[string]json.RawMess 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)) @@ -50312,14 +55088,17 @@ func UnmarshalInstanceGroupManagerPolicyPatch(m map[string]json.RawMessage, resu obj := new(InstanceGroupManagerPolicyPatch) err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) if err != nil { + err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) if err != nil { + err = core.SDKErrorf(err, "", "metric_value-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)) @@ -50333,6 +55112,9 @@ func (instanceGroupManagerPolicyPatch *InstanceGroupManagerPolicyPatch) AsPatch( if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -50382,18 +55164,22 @@ func UnmarshalInstanceGroupManagerPolicyPrototype(m map[string]json.RawMessage, obj := new(InstanceGroupManagerPolicyPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) if err != nil { + err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) if err != nil { + err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) if err != nil { + err = core.SDKErrorf(err, "", "policy_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50422,18 +55208,22 @@ func UnmarshalInstanceGroupManagerPolicyReference(m map[string]json.RawMessage, obj := new(InstanceGroupManagerPolicyReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerPolicyReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50452,6 +55242,7 @@ func UnmarshalInstanceGroupManagerPolicyReferenceDeleted(m map[string]json.RawMe obj := new(InstanceGroupManagerPolicyReferenceDeleted) 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)) @@ -50505,30 +55296,37 @@ func UnmarshalInstanceGroupManagerPrototype(m map[string]json.RawMessage, result obj := new(InstanceGroupManagerPrototype) err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "management_enabled-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, "aggregation_window", &obj.AggregationWindow) if err != nil { + err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) if err != nil { + err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) if err != nil { + err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50556,18 +55354,22 @@ func UnmarshalInstanceGroupManagerReference(m map[string]json.RawMessage, result obj := new(InstanceGroupManagerReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50586,6 +55388,7 @@ func UnmarshalInstanceGroupManagerReferenceDeleted(m map[string]json.RawMessage, obj := new(InstanceGroupManagerReferenceDeleted) 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)) @@ -50603,6 +55406,7 @@ func UnmarshalInstanceGroupManagerScheduledActionGroup(m map[string]json.RawMess obj := new(InstanceGroupManagerScheduledActionGroup) err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50621,6 +55425,9 @@ func (*VpcV1) NewInstanceGroupManagerScheduledActionGroupPrototype(membershipCou MembershipCount: core.Int64Ptr(membershipCount), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -50629,6 +55436,7 @@ func UnmarshalInstanceGroupManagerScheduledActionGroupPrototype(m map[string]jso obj := new(InstanceGroupManagerScheduledActionGroupPrototype) err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50672,26 +55480,32 @@ func UnmarshalInstanceGroupManagerScheduledActionManager(m map[string]json.RawMe obj := new(InstanceGroupManagerScheduledActionManager) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) 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, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50728,18 +55542,22 @@ func UnmarshalInstanceGroupManagerScheduledActionManagerPrototype(m map[string]j obj := new(InstanceGroupManagerScheduledActionManagerPrototype) err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50801,42 +55619,52 @@ func UnmarshalInstanceGroupMembership(m map[string]json.RawMessage, result inter obj := new(InstanceGroupMembership) 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, "delete_instance_on_membership_delete", &obj.DeleteInstanceOnMembershipDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_instance_on_membership_delete-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, "instance", &obj.Instance, UnmarshalInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) if err != nil { + err = core.SDKErrorf(err, "", "instance_template-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, "pool_member", &obj.PoolMember, UnmarshalLoadBalancerPoolMemberReference) if err != nil { + err = core.SDKErrorf(err, "", "pool_member-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.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -50867,22 +55695,27 @@ func UnmarshalInstanceGroupMembershipCollection(m map[string]json.RawMessage, re obj := new(InstanceGroupMembershipCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupMembershipCollectionFirst) 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, "memberships", &obj.Memberships, UnmarshalInstanceGroupMembership) if err != nil { + err = core.SDKErrorf(err, "", "memberships-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupMembershipCollectionNext) 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)) @@ -50895,8 +55728,11 @@ func (resp *InstanceGroupMembershipCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -50912,6 +55748,7 @@ func UnmarshalInstanceGroupMembershipCollectionFirst(m map[string]json.RawMessag 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)) @@ -50929,6 +55766,7 @@ func UnmarshalInstanceGroupMembershipCollectionNext(m map[string]json.RawMessage 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)) @@ -50947,6 +55785,7 @@ func UnmarshalInstanceGroupMembershipPatch(m map[string]json.RawMessage, result obj := new(InstanceGroupMembershipPatch) 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)) @@ -50960,6 +55799,9 @@ func (instanceGroupMembershipPatch *InstanceGroupMembershipPatch) AsPatch() (_pa if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -51004,30 +55846,37 @@ func UnmarshalInstanceGroupPatch(m map[string]json.RawMessage, result interface{ obj := new(InstanceGroupPatch) err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) if err != nil { + err = core.SDKErrorf(err, "", "application_port-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateIdentity) if err != nil { + err = core.SDKErrorf(err, "", "instance_template-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "load_balancer", &obj.LoadBalancer, UnmarshalLoadBalancerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "load_balancer-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolIdentity) if err != nil { + err = core.SDKErrorf(err, "", "load_balancer_pool-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "membership_count-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, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51041,6 +55890,9 @@ func (instanceGroupPatch *InstanceGroupPatch) AsPatch() (_patch map[string]inter if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -51068,22 +55920,27 @@ func UnmarshalInstanceGroupReference(m map[string]json.RawMessage, result interf obj := new(InstanceGroupReference) 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, UnmarshalInstanceGroupReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51102,6 +55959,7 @@ func UnmarshalInstanceGroupReferenceDeleted(m map[string]json.RawMessage, result obj := new(InstanceGroupReferenceDeleted) 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)) @@ -51110,7 +55968,15 @@ func UnmarshalInstanceGroupReferenceDeleted(m map[string]json.RawMessage, result // InstanceHealthReason : InstanceHealthReason struct type InstanceHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state: + // - `reservation_capacity_unavailable`: The reservation affinity pool has no + // available capacity. + // - `reservation_deleted`: The reservation affinity pool has a deleted reservation. + // - `reservation_expired`: The reservation affinity pool has an expired reservation. + // - `reservation_failed`: The reservation affinity pool has a failed reservation. + // + // 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 health state. @@ -51121,7 +55987,15 @@ type InstanceHealthReason struct { } // Constants associated with the InstanceHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state: +// - `reservation_capacity_unavailable`: The reservation affinity pool has no +// available capacity. +// - `reservation_deleted`: The reservation affinity pool has a deleted reservation. +// - `reservation_expired`: The reservation affinity pool has an expired reservation. +// - `reservation_failed`: The reservation affinity pool has a failed reservation. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceHealthReasonCodeReservationCapacityUnavailableConst = "reservation_capacity_unavailable" InstanceHealthReasonCodeReservationDeletedConst = "reservation_deleted" @@ -51134,14 +56008,17 @@ func UnmarshalInstanceHealthReason(m map[string]json.RawMessage, result interfac obj := new(InstanceHealthReason) 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)) @@ -51165,14 +56042,17 @@ func UnmarshalInstanceInitialization(m map[string]json.RawMessage, result interf obj := new(InstanceInitialization) err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceInitializationDefaultTrustedProfile) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "password", &obj.Password, UnmarshalInstanceInitializationPassword) if err != nil { + err = core.SDKErrorf(err, "", "password-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51195,10 +56075,12 @@ func UnmarshalInstanceInitializationDefaultTrustedProfile(m map[string]json.RawM obj := new(InstanceInitializationDefaultTrustedProfile) err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink) if err != nil { + err = core.SDKErrorf(err, "", "auto_link-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51219,10 +56101,12 @@ func UnmarshalInstanceInitializationPassword(m map[string]json.RawMessage, resul obj := new(InstanceInitializationPassword) err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) if err != nil { + err = core.SDKErrorf(err, "", "encrypted_password-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyIdentityByFingerprint) if err != nil { + err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51231,7 +56115,13 @@ func UnmarshalInstanceInitializationPassword(m map[string]json.RawMessage, resul // InstanceLifecycleReason : InstanceLifecycleReason struct type InstanceLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. + // 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. @@ -51242,8 +56132,15 @@ type InstanceLifecycleReason struct { } // Constants associated with the InstanceLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. +// 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 ( + InstanceLifecycleReasonCodeInternalErrorConst = "internal_error" InstanceLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -51252,14 +56149,17 @@ func UnmarshalInstanceLifecycleReason(m map[string]json.RawMessage, result inter obj := new(InstanceLifecycleReason) 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)) @@ -51297,14 +56197,17 @@ func UnmarshalInstanceMetadataService(m map[string]json.RawMessage, result inter obj := new(InstanceMetadataService) err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) if err != nil { + err = core.SDKErrorf(err, "", "enabled-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.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) if err != nil { + err = core.SDKErrorf(err, "", "response_hop_limit-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51342,14 +56245,17 @@ func UnmarshalInstanceMetadataServicePatch(m map[string]json.RawMessage, result obj := new(InstanceMetadataServicePatch) err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) if err != nil { + err = core.SDKErrorf(err, "", "enabled-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.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) if err != nil { + err = core.SDKErrorf(err, "", "response_hop_limit-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51387,14 +56293,17 @@ func UnmarshalInstanceMetadataServicePrototype(m map[string]json.RawMessage, res obj := new(InstanceMetadataServicePrototype) err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) if err != nil { + err = core.SDKErrorf(err, "", "enabled-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.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) if err != nil { + err = core.SDKErrorf(err, "", "response_hop_limit-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51468,46 +56377,57 @@ func UnmarshalInstanceNetworkAttachment(m map[string]json.RawMessage, result int obj := new(InstanceNetworkAttachment) 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, "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, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-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)) @@ -51525,6 +56445,7 @@ func UnmarshalInstanceNetworkAttachmentCollection(m map[string]json.RawMessage, obj := new(InstanceNetworkAttachmentCollection) err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachment) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51542,6 +56463,7 @@ func UnmarshalInstanceNetworkAttachmentPatch(m map[string]json.RawMessage, resul obj := new(InstanceNetworkAttachmentPatch) 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)) @@ -51555,6 +56477,9 @@ func (instanceNetworkAttachmentPatch *InstanceNetworkAttachmentPatch) AsPatch() if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -51579,6 +56504,9 @@ func (*VpcV1) NewInstanceNetworkAttachmentPrototype(virtualNetworkInterface Inst VirtualNetworkInterface: virtualNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -51587,10 +56515,12 @@ func UnmarshalInstanceNetworkAttachmentPrototype(m map[string]json.RawMessage, r obj := new(InstanceNetworkAttachmentPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51688,50 +56618,62 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface(m map[st obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) 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 } 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.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) 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()) 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)) @@ -51775,30 +56717,37 @@ func UnmarshalInstanceNetworkAttachmentReference(m map[string]json.RawMessage, r obj := new(InstanceNetworkAttachmentReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51817,6 +56766,7 @@ func UnmarshalInstanceNetworkAttachmentReferenceDeleted(m map[string]json.RawMes obj := new(InstanceNetworkAttachmentReferenceDeleted) 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)) @@ -51868,30 +56818,37 @@ func UnmarshalInstancePatch(m map[string]json.RawMessage, result interface{}) (e obj := new(InstancePatch) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPatch) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePatch) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPatch) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstancePatchProfile) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPatch) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -51905,6 +56862,9 @@ func (instancePatch *InstancePatch) AsPatch() (_patch map[string]interface{}, er if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -51944,10 +56904,12 @@ func UnmarshalInstancePatchProfile(m map[string]json.RawMessage, result interfac obj := new(InstancePatchProfile) 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)) @@ -51999,26 +56961,32 @@ func UnmarshalInstancePlacementTarget(m map[string]json.RawMessage, result inter obj := new(InstancePlacementTarget) 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, UnmarshalDedicatedHostGroupReferenceDeleted) 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)) @@ -52053,14 +57021,17 @@ func UnmarshalInstancePlacementTargetPatch(m map[string]json.RawMessage, result obj := new(InstancePlacementTargetPatch) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52096,14 +57067,17 @@ func UnmarshalInstancePlacementTargetPrototype(m map[string]json.RawMessage, res obj := new(InstancePlacementTargetPrototype) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52152,18 +57126,16 @@ type InstanceProfile struct { ResourceType *string `json:"resource_type" validate:"required"` // The status of the instance profile: - // - `previous`: This instance profile is an older revision, but remains provisionable and + // - `previous`: This instance profile is an older revision, but remains provisionable and // usable. - // - `current`: This profile is the latest revision. + // - `current`: This profile is the latest revision. // - // Note that revisions are indicated by the generation of an instance profile. Refer to the - // [profile naming conventions] + // Revisions are indicated by the generation of an instance profile. Refer to the [profile naming conventions] // (https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on how // generations are defined within an instance profile. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the - // unexpected property value was encountered. + // 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"` TotalVolumeBandwidth InstanceProfileVolumeBandwidthIntf `json:"total_volume_bandwidth" validate:"required"` @@ -52187,14 +57159,12 @@ const ( // usable. // - `current`: This profile is the latest revision. // -// Note that revisions are indicated by the generation of an instance profile. Refer to the -// [profile naming conventions] +// Revisions are indicated by the generation of an instance profile. Refer to the [profile naming conventions] // (https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on how // generations are defined within an instance profile. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the profile on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceProfileStatusCurrentConst = "current" InstanceProfileStatusPreviousConst = "previous" @@ -52205,90 +57175,112 @@ func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) obj := new(InstanceProfile) err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalInstanceProfileBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceProfileDisk) if err != nil { + err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "gpu_count", &obj.GpuCount, UnmarshalInstanceProfileGpu) if err != nil { + err = core.SDKErrorf(err, "", "gpu_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "gpu_manufacturer", &obj.GpuManufacturer, UnmarshalInstanceProfileGpuManufacturer) if err != nil { + err = core.SDKErrorf(err, "", "gpu_manufacturer-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "gpu_memory", &obj.GpuMemory, UnmarshalInstanceProfileGpuMemory) if err != nil { + err = core.SDKErrorf(err, "", "gpu_memory-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "gpu_model", &obj.GpuModel, UnmarshalInstanceProfileGpuModel) if err != nil { + err = core.SDKErrorf(err, "", "gpu_model-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.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalInstanceProfileMemory) if err != nil { + err = core.SDKErrorf(err, "", "memory-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, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalInstanceProfileNetworkAttachmentCount) if err != nil { + err = core.SDKErrorf(err, "", "network_attachment_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalInstanceProfileNetworkInterfaceCount) if err != nil { + err = core.SDKErrorf(err, "", "network_interface_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "numa_count", &obj.NumaCount, UnmarshalInstanceProfileNumaCount) if err != nil { + err = core.SDKErrorf(err, "", "numa_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalInstanceProfileOsArchitecture) if err != nil { + err = core.SDKErrorf(err, "", "os_architecture-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "port_speed", &obj.PortSpeed, UnmarshalInstanceProfilePortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_terms", &obj.ReservationTerms, UnmarshalInstanceProfileReservationTerms) if err != nil { + err = core.SDKErrorf(err, "", "reservation_terms-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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-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()) return } err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalInstanceProfileVcpuArchitecture) if err != nil { + err = core.SDKErrorf(err, "", "vcpu_architecture-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalInstanceProfileVcpu) if err != nil { + err = core.SDKErrorf(err, "", "vcpu_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalInstanceProfileVcpuManufacturer) if err != nil { + err = core.SDKErrorf(err, "", "vcpu_manufacturer-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52343,30 +57335,37 @@ func UnmarshalInstanceProfileBandwidth(m map[string]json.RawMessage, result inte obj := new(InstanceProfileBandwidth) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52384,6 +57383,7 @@ func UnmarshalInstanceProfileCollection(m map[string]json.RawMessage, result int obj := new(InstanceProfileCollection) err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalInstanceProfile) if err != nil { + err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52404,14 +57404,17 @@ func UnmarshalInstanceProfileDisk(m map[string]json.RawMessage, result interface obj := new(InstanceProfileDisk) err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalInstanceProfileDiskQuantity) if err != nil { + err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalInstanceProfileDiskSize) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalInstanceProfileDiskSupportedInterfaces) if err != nil { + err = core.SDKErrorf(err, "", "supported_interface_types-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52466,30 +57469,37 @@ func UnmarshalInstanceProfileDiskQuantity(m map[string]json.RawMessage, result i obj := new(InstanceProfileDiskQuantity) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52544,30 +57554,37 @@ func UnmarshalInstanceProfileDiskSize(m map[string]json.RawMessage, result inter obj := new(InstanceProfileDiskSize) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52578,9 +57595,8 @@ func UnmarshalInstanceProfileDiskSize(m map[string]json.RawMessage, result inter type InstanceProfileDiskSupportedInterfaces struct { // The disk interface used for attaching the disk. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Default *string `json:"default" validate:"required"` // The type for this profile field. @@ -52593,9 +57609,8 @@ type InstanceProfileDiskSupportedInterfaces struct { // Constants associated with the InstanceProfileDiskSupportedInterfaces.Default property. // The disk interface used for attaching the disk. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" InstanceProfileDiskSupportedInterfacesDefaultVirtioBlkConst = "virtio_blk" @@ -52610,9 +57625,8 @@ const ( // Constants associated with the InstanceProfileDiskSupportedInterfaces.Values property. // The disk interface used for attaching the disk. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" InstanceProfileDiskSupportedInterfacesValuesVirtioBlkConst = "virtio_blk" @@ -52623,14 +57637,17 @@ func UnmarshalInstanceProfileDiskSupportedInterfaces(m map[string]json.RawMessag obj := new(InstanceProfileDiskSupportedInterfaces) 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)) @@ -52685,30 +57702,37 @@ func UnmarshalInstanceProfileGpu(m map[string]json.RawMessage, result interface{ obj := new(InstanceProfileGpu) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52735,10 +57759,12 @@ func UnmarshalInstanceProfileGpuManufacturer(m map[string]json.RawMessage, resul obj := new(InstanceProfileGpuManufacturer) 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)) @@ -52793,30 +57819,37 @@ func UnmarshalInstanceProfileGpuMemory(m map[string]json.RawMessage, result inte obj := new(InstanceProfileGpuMemory) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52843,10 +57876,12 @@ func UnmarshalInstanceProfileGpuModel(m map[string]json.RawMessage, result inter obj := new(InstanceProfileGpuModel) 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)) @@ -52878,10 +57913,12 @@ func UnmarshalInstanceProfileIdentity(m map[string]json.RawMessage, result inter obj := new(InstanceProfileIdentity) 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)) @@ -52936,30 +57973,37 @@ func UnmarshalInstanceProfileMemory(m map[string]json.RawMessage, result interfa obj := new(InstanceProfileMemory) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -52997,10 +58041,12 @@ func UnmarshalInstanceProfileNumaCount(m map[string]json.RawMessage, result inte obj := new(InstanceProfileNumaCount) 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)) @@ -53041,14 +58087,17 @@ func UnmarshalInstanceProfileNetworkAttachmentCount(m map[string]json.RawMessage obj := new(InstanceProfileNetworkAttachmentCount) 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53089,14 +58138,17 @@ func UnmarshalInstanceProfileNetworkInterfaceCount(m map[string]json.RawMessage, obj := new(InstanceProfileNetworkInterfaceCount) 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53126,14 +58178,17 @@ func UnmarshalInstanceProfileOsArchitecture(m map[string]json.RawMessage, result obj := new(InstanceProfileOsArchitecture) 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)) @@ -53171,10 +58226,12 @@ func UnmarshalInstanceProfilePortSpeed(m map[string]json.RawMessage, result inte obj := new(InstanceProfilePortSpeed) 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)) @@ -53204,14 +58261,17 @@ func UnmarshalInstanceProfileReference(m map[string]json.RawMessage, result inte obj := new(InstanceProfileReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -53244,10 +58304,12 @@ func UnmarshalInstanceProfileReservationTerms(m map[string]json.RawMessage, resu obj := new(InstanceProfileReservationTerms) 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)) @@ -53302,30 +58364,37 @@ func UnmarshalInstanceProfileVcpu(m map[string]json.RawMessage, result interface obj := new(InstanceProfileVcpu) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53355,14 +58424,17 @@ func UnmarshalInstanceProfileVcpuArchitecture(m map[string]json.RawMessage, resu obj := new(InstanceProfileVcpuArchitecture) 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, "value", &obj.Value) if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53392,14 +58464,17 @@ func UnmarshalInstanceProfileVcpuManufacturer(m map[string]json.RawMessage, resu obj := new(InstanceProfileVcpuManufacturer) 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, "value", &obj.Value) if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53454,30 +58529,37 @@ func UnmarshalInstanceProfileVolumeBandwidth(m map[string]json.RawMessage, resul obj := new(InstanceProfileVolumeBandwidth) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53588,8 +58670,7 @@ type InstancePrototype struct { // // If an offering is specified, the latest version of that offering will be used. // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // The specified offering or offering version may be in a different account, subject // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` @@ -53610,90 +58691,112 @@ func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{} obj := new(InstancePrototype) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_template-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53724,22 +58827,27 @@ func UnmarshalInstanceReference(m map[string]json.RawMessage, result interface{} obj := new(InstanceReference) 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, UnmarshalInstanceReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53758,6 +58866,7 @@ func UnmarshalInstanceReferenceDeleted(m map[string]json.RawMessage, result inte obj := new(InstanceReferenceDeleted) 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)) @@ -53789,10 +58898,12 @@ func UnmarshalInstanceReservationAffinity(m map[string]json.RawMessage, result i obj := new(InstanceReservationAffinity) err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) if err != nil { + err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationReference) if err != nil { + err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53831,10 +58942,12 @@ func UnmarshalInstanceReservationAffinityPatch(m map[string]json.RawMessage, res obj := new(InstanceReservationAffinityPatch) err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) if err != nil { + err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity) if err != nil { + err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53876,10 +58989,12 @@ func UnmarshalInstanceReservationAffinityPrototype(m map[string]json.RawMessage, obj := new(InstanceReservationAffinityPrototype) err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) if err != nil { + err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity) if err != nil { + err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -53889,6 +59004,9 @@ func UnmarshalInstanceReservationAffinityPrototype(m map[string]json.RawMessage, // InstanceStatusReason : InstanceStatusReason struct type InstanceStatusReason struct { // A snake case string succinctly identifying the status reason. + // + // 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. @@ -53900,6 +59018,9 @@ type InstanceStatusReason struct { // Constants associated with the InstanceStatusReason.Code property. // A snake case string succinctly identifying the status reason. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceStatusReasonCodeCannotStartConst = "cannot_start" InstanceStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" @@ -53920,14 +59041,17 @@ func UnmarshalInstanceStatusReason(m map[string]json.RawMessage, result interfac obj := new(InstanceStatusReason) 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)) @@ -54044,8 +59168,7 @@ type InstanceTemplate struct { // // If an offering is specified, the latest version of that offering will be used. // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // The specified offering or offering version may be in a different account, subject // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` } @@ -54063,102 +59186,127 @@ func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) obj := new(InstanceTemplate) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -54189,22 +59337,27 @@ func UnmarshalInstanceTemplateCollection(m map[string]json.RawMessage, result in obj := new(InstanceTemplateCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceTemplateCollectionFirst) 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, UnmarshalInstanceTemplateCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "templates", &obj.Templates, UnmarshalInstanceTemplate) if err != nil { + err = core.SDKErrorf(err, "", "templates-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)) @@ -54222,6 +59375,7 @@ func UnmarshalInstanceTemplateCollectionFirst(m map[string]json.RawMessage, resu 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)) @@ -54239,6 +59393,7 @@ func UnmarshalInstanceTemplateCollectionNext(m map[string]json.RawMessage, resul 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)) @@ -54274,14 +59429,17 @@ func UnmarshalInstanceTemplateIdentity(m map[string]json.RawMessage, result inte obj := new(InstanceTemplateIdentity) 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 } 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)) @@ -54299,6 +59457,7 @@ func UnmarshalInstanceTemplatePatch(m map[string]json.RawMessage, result interfa obj := new(InstanceTemplatePatch) 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)) @@ -54312,6 +59471,9 @@ func (instanceTemplatePatch *InstanceTemplatePatch) AsPatch() (_patch map[string if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -54439,90 +59601,112 @@ func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result int obj := new(InstanceTemplatePrototype) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_template-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -54553,22 +59737,27 @@ func UnmarshalInstanceTemplateReference(m map[string]json.RawMessage, result int obj := new(InstanceTemplateReference) 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, UnmarshalInstanceTemplateReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -54587,6 +59776,7 @@ func UnmarshalInstanceTemplateReferenceDeleted(m map[string]json.RawMessage, res obj := new(InstanceTemplateReferenceDeleted) 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)) @@ -54610,14 +59800,17 @@ func UnmarshalInstanceVcpu(m map[string]json.RawMessage, result interface{}) (er obj := new(InstanceVcpu) err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) if err != nil { + err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "count", &obj.Count) if err != nil { + err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) if err != nil { + err = core.SDKErrorf(err, "", "manufacturer-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -54671,42 +59864,52 @@ func UnmarshalKey(m map[string]json.RawMessage, result interface{}) (err error) obj := new(Key) 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.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) if err != nil { + err = core.SDKErrorf(err, "", "fingerprint-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, "length", &obj.Length) if err != nil { + err = core.SDKErrorf(err, "", "length-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, "public_key", &obj.PublicKey) if err != nil { + err = core.SDKErrorf(err, "", "public_key-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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -54737,22 +59940,27 @@ func UnmarshalKeyCollection(m map[string]json.RawMessage, result interface{}) (e obj := new(KeyCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalKeyCollectionFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKey) if err != nil { + err = core.SDKErrorf(err, "", "keys-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, UnmarshalKeyCollectionNext) 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)) @@ -54765,8 +59973,11 @@ func (resp *KeyCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -54782,6 +59993,7 @@ func UnmarshalKeyCollectionFirst(m map[string]json.RawMessage, result interface{ 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)) @@ -54799,6 +60011,7 @@ func UnmarshalKeyCollectionNext(m map[string]json.RawMessage, result interface{} 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)) @@ -54839,18 +60052,22 @@ func UnmarshalKeyIdentity(m map[string]json.RawMessage, result interface{}) (err obj := new(KeyIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) if err != nil { + err = core.SDKErrorf(err, "", "fingerprint-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -54868,6 +60085,7 @@ func UnmarshalKeyPatch(m map[string]json.RawMessage, result interface{}) (err er obj := new(KeyPatch) 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)) @@ -54881,6 +60099,9 @@ func (keyPatch *KeyPatch) AsPatch() (_patch map[string]interface{}, err error) { if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -54912,26 +60133,32 @@ func UnmarshalKeyReference(m map[string]json.RawMessage, result interface{}) (er obj := new(KeyReference) 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, UnmarshalKeyReferenceDeleted) if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) if err != nil { + err = core.SDKErrorf(err, "", "fingerprint-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -54950,6 +60177,7 @@ func UnmarshalKeyReferenceDeleted(m map[string]json.RawMessage, result interface obj := new(KeyReferenceDeleted) 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)) @@ -54977,6 +60205,7 @@ func UnmarshalLegacyCloudObjectStorageBucketIdentity(m map[string]json.RawMessag obj := new(LegacyCloudObjectStorageBucketIdentity) 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)) @@ -54994,6 +60223,7 @@ func UnmarshalLegacyCloudObjectStorageBucketReference(m map[string]json.RawMessa obj := new(LegacyCloudObjectStorageBucketReference) 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)) @@ -56767,45 +61997,45 @@ 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 resources with a `vpc.id` property matching the specified identifier. - VPCID *string `json:"vpc.id,omitempty"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // Filters the collection to resources with a `vpc.name` property matching the exact specified name. - VPCName *string `json:"vpc.name,omitempty"` - - // Filters the collection to instances with a `dedicated_host.id` property matching the specified identifier. + // Filters the collection to resources with a `dedicated_host.id` property matching the specified identifier. DedicatedHostID *string `json:"dedicated_host.id,omitempty"` - // Filters the collection to instances with a `dedicated_host.crn` property matching the specified CRN. + // Filters the collection to resources with a `dedicated_host.crn` property matching the specified CRN. DedicatedHostCRN *string `json:"dedicated_host.crn,omitempty"` - // Filters the collection to instances with a `dedicated_host.name` property matching the exact specified name. + // Filters the collection to resources with a `dedicated_host.name` property matching the exact specified name. DedicatedHostName *string `json:"dedicated_host.name,omitempty"` - // Filters the collection to instances with a `placement_target.id` property matching the specified placement group + // Filters the collection to resources with a `placement_target.id` property matching the specified placement group // identifier. PlacementGroupID *string `json:"placement_group.id,omitempty"` - // Filters the collection to instances with a `placement_target.crn` property matching the specified placement group + // Filters the collection to resources with a `placement_target.crn` property matching the specified placement group // CRN. PlacementGroupCRN *string `json:"placement_group.crn,omitempty"` - // Filters the collection to instances with a `placement_target.name` property matching the exact specified placement + // Filters the collection to resources with a `placement_target.name` property matching the exact specified placement // group name. PlacementGroupName *string `json:"placement_group.name,omitempty"` - // Filters the collection to instances with a `reservation.id` property matching the specified identifier. + // Filters the collection to resources with a `reservation.id` property matching the specified identifier. ReservationID *string `json:"reservation.id,omitempty"` - // Filters the collection to instances with a `reservation.crn` property matching the specified CRN. + // Filters the collection to resources with a `reservation.crn` property matching the specified CRN. ReservationCRN *string `json:"reservation.crn,omitempty"` // Filters the collection to resources with a `reservation.name` property matching the exact specified name. ReservationName *string `json:"reservation.name,omitempty"` + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // 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 Headers map[string]string } @@ -56839,24 +62069,6 @@ func (_options *ListInstancesOptions) SetName(name string) *ListInstancesOptions return _options } -// SetVPCID : Allow user to set VPCID -func (_options *ListInstancesOptions) SetVPCID(vpcID string) *ListInstancesOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListInstancesOptions) SetVPCCRN(vpcCRN string) *ListInstancesOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListInstancesOptions) SetVPCName(vpcName string) *ListInstancesOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - // SetDedicatedHostID : Allow user to set DedicatedHostID func (_options *ListInstancesOptions) SetDedicatedHostID(dedicatedHostID string) *ListInstancesOptions { _options.DedicatedHostID = core.StringPtr(dedicatedHostID) @@ -56911,6 +62123,24 @@ func (_options *ListInstancesOptions) SetReservationName(reservationName string) return _options } +// SetVPCID : Allow user to set VPCID +func (_options *ListInstancesOptions) SetVPCID(vpcID string) *ListInstancesOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListInstancesOptions) SetVPCCRN(vpcCRN string) *ListInstancesOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListInstancesOptions) SetVPCName(vpcName string) *ListInstancesOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListInstancesOptions) SetHeaders(param map[string]string) *ListInstancesOptions { options.Headers = param @@ -59652,7 +64882,6 @@ type LoadBalancer struct { Profile *LoadBalancerProfileReference `json:"profile" validate:"required"` // The provisioning status of this load balancer: - // // - `active`: The load balancer is running. // - `create_pending`: The load balancer is being created. // - `delete_pending`: The load balancer is being deleted. @@ -59663,10 +64892,8 @@ type LoadBalancer struct { // - `update_pending`: The load balancer is being updated // to the requested configuration. // - // The enumerated values for this property are expected to expand in the future. When - // processing this property, check for and log unknown values. Optionally halt - // processing and surface the error, or bypass the load balancer on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The public IP addresses assigned to this load balancer. @@ -59714,26 +64941,18 @@ const ( // Constants associated with the LoadBalancer.ProvisioningStatus property. // The provisioning status of this load balancer: -// // - `active`: The load balancer is running. -// // - `create_pending`: The load balancer is being created. -// // - `delete_pending`: The load balancer is being deleted. -// // - `maintenance_pending`: The load balancer is unavailable due to an internal // error (contact IBM support). -// // - `migrate_pending`: The load balancer is migrating to the requested configuration. // Performance may be degraded. -// // - `update_pending`: The load balancer is being updated // to the requested configuration. // -// The enumerated values for this property are expected to expand in the future. When -// processing this property, check for and log unknown values. Optionally halt -// processing and surface the error, or bypass the load balancer on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerProvisioningStatusActiveConst = "active" LoadBalancerProvisioningStatusCreatePendingConst = "create_pending" @@ -59755,98 +64974,122 @@ func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (er obj := new(LoadBalancer) 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, "dns", &obj.Dns, UnmarshalLoadBalancerDns) if err != nil { + err = core.SDKErrorf(err, "", "dns-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) if err != nil { + err = core.SDKErrorf(err, "", "hostname-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, "instance_groups_supported", &obj.InstanceGroupsSupported) if err != nil { + err = core.SDKErrorf(err, "", "instance_groups_supported-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "is_public", &obj.IsPublic) if err != nil { + err = core.SDKErrorf(err, "", "is_public-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListenerReference) if err != nil { + err = core.SDKErrorf(err, "", "listeners-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLogging) if err != nil { + err = core.SDKErrorf(err, "", "logging-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, "operating_status", &obj.OperatingStatus) if err != nil { + err = core.SDKErrorf(err, "", "operating_status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPoolReference) if err != nil { + err = core.SDKErrorf(err, "", "pools-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalLoadBalancerPrivateIpsItem) if err != nil { + err = core.SDKErrorf(err, "", "private_ips-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalLoadBalancerProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) if err != nil { + err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_ips", &obj.PublicIps, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "public_ips-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.UnmarshalPrimitive(m, "route_mode", &obj.RouteMode) if err != nil { + err = core.SDKErrorf(err, "", "route_mode-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "security_groups_supported", &obj.SecurityGroupsSupported) if err != nil { + err = core.SDKErrorf(err, "", "security_groups_supported-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "udp_supported", &obj.UDPSupported) if err != nil { + err = core.SDKErrorf(err, "", "udp_supported-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -59877,22 +65120,27 @@ func UnmarshalLoadBalancerCollection(m map[string]json.RawMessage, result interf obj := new(LoadBalancerCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalLoadBalancerCollectionFirst) 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, "load_balancers", &obj.LoadBalancers, UnmarshalLoadBalancer) if err != nil { + err = core.SDKErrorf(err, "", "load_balancers-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerCollectionNext) 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)) @@ -59905,8 +65153,11 @@ func (resp *LoadBalancerCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -59922,6 +65173,7 @@ func UnmarshalLoadBalancerCollectionFirst(m map[string]json.RawMessage, result i 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)) @@ -59939,6 +65191,7 @@ func UnmarshalLoadBalancerCollectionNext(m map[string]json.RawMessage, result in 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)) @@ -59962,10 +65215,12 @@ func UnmarshalLoadBalancerDns(m map[string]json.RawMessage, result interface{}) obj := new(LoadBalancerDns) err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneReference) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -59994,10 +65249,12 @@ func UnmarshalLoadBalancerDnsPatch(m map[string]json.RawMessage, result interfac obj := new(LoadBalancerDnsPatch) err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity) if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60028,6 +65285,9 @@ func (*VpcV1) NewLoadBalancerDnsPrototype(instance DnsInstanceIdentityIntf, zone Zone: zone, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -60036,10 +65296,12 @@ func UnmarshalLoadBalancerDnsPrototype(m map[string]json.RawMessage, result inte obj := new(LoadBalancerDnsPrototype) err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity) if err != nil { + err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60075,14 +65337,17 @@ func UnmarshalLoadBalancerIdentity(m map[string]json.RawMessage, result interfac obj := new(LoadBalancerIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60111,12 +65376,15 @@ type LoadBalancerListener struct { CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // The default pool for this listener. If absent, this listener has no default pool. + // + // If `https_redirect` is set, the default pool will not be used. DefaultPool *LoadBalancerPoolReference `json:"default_pool,omitempty"` // The listener's canonical URL. Href *string `json:"href" validate:"required"` - // If present, the target listener that requests are redirected to. + // If present, the target listener that requests are redirected to if none of the + // listener's `policies` match. HTTPSRedirect *LoadBalancerListenerHTTPSRedirect `json:"https_redirect,omitempty"` // The unique identifier for this load balancer listener. @@ -60144,25 +65412,22 @@ type LoadBalancerListener struct { // The listener protocol. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Protocol *string `json:"protocol" validate:"required"` // The provisioning status of this listener // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` } // Constants associated with the LoadBalancerListener.Protocol property. // The listener protocol. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerListenerProtocolHTTPConst = "http" LoadBalancerListenerProtocolHTTPSConst = "https" @@ -60173,9 +65438,8 @@ const ( // Constants associated with the LoadBalancerListener.ProvisioningStatus property. // The provisioning status of this listener // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the listener on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerListenerProvisioningStatusActiveConst = "active" LoadBalancerListenerProvisioningStatusCreatePendingConst = "create_pending" @@ -60189,62 +65453,77 @@ func UnmarshalLoadBalancerListener(m map[string]json.RawMessage, result interfac obj := new(LoadBalancerListener) err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) if err != nil { + err = core.SDKErrorf(err, "", "accept_proxy_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "certificate_instance-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) if err != nil { + err = core.SDKErrorf(err, "", "connection_limit-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, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolReference) if err != nil { + err = core.SDKErrorf(err, "", "default_pool-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.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirect) if err != nil { + err = core.SDKErrorf(err, "", "https_redirect-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, "idle_connection_timeout", &obj.IdleConnectionTimeout) if err != nil { + err = core.SDKErrorf(err, "", "idle_connection_timeout-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicyReference) if err != nil { + err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-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 } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) if err != nil { + err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60262,6 +65541,52 @@ func UnmarshalLoadBalancerListenerCollection(m map[string]json.RawMessage, resul obj := new(LoadBalancerListenerCollection) err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListener) if err != nil { + err = core.SDKErrorf(err, "", "listeners-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerDefaultPoolPatch : The default pool for this listener. If `https_redirect` is set, the default pool will not be used. The specified pool +// must: +// +// - Belong to this load balancer +// - Have the same `protocol` as this listener, or have a compatible protocol. +// At present, the compatible protocols are `http` and `https`. +// - Not already be the `default_pool` for another listener +// +// Specify `null` to remove an existing default pool. +// Models which "extend" this model: +// - LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID +// - LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref +type LoadBalancerListenerDefaultPoolPatch struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerDefaultPoolPatch) isaLoadBalancerListenerDefaultPoolPatch() bool { + return true +} + +type LoadBalancerListenerDefaultPoolPatchIntf interface { + isaLoadBalancerListenerDefaultPoolPatch() bool +} + +// UnmarshalLoadBalancerListenerDefaultPoolPatch unmarshals an instance of LoadBalancerListenerDefaultPoolPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerDefaultPoolPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerDefaultPoolPatch) + 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)) @@ -60284,14 +65609,17 @@ func UnmarshalLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, re obj := new(LoadBalancerListenerHTTPSRedirect) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60315,14 +65643,17 @@ func UnmarshalLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessag obj := new(LoadBalancerListenerHTTPSRedirectPatch) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60348,6 +65679,9 @@ func (*VpcV1) NewLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64 Listener: listener, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -60356,14 +65690,17 @@ func UnmarshalLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMe obj := new(LoadBalancerListenerHTTPSRedirectPrototype) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60395,10 +65732,12 @@ func UnmarshalLoadBalancerListenerIdentity(m map[string]json.RawMessage, result obj := new(LoadBalancerListenerIdentity) 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)) @@ -60422,7 +65761,8 @@ type LoadBalancerListenerPatch struct { // The connection limit of the listener. ConnectionLimit *int64 `json:"connection_limit,omitempty"` - // The default pool for this listener. The specified pool must: + // The default pool for this listener. If `https_redirect` is set, the default pool will not + // be used. The specified pool must: // // - Belong to this load balancer // - Have the same `protocol` as this listener, or have a compatible protocol. @@ -60430,10 +65770,13 @@ type LoadBalancerListenerPatch struct { // - Not already be the `default_pool` for another listener // // Specify `null` to remove an existing default pool. - DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` + DefaultPool LoadBalancerListenerDefaultPoolPatchIntf `json:"default_pool,omitempty"` - // The target listener that requests will be redirected to. This listener must have a - // `protocol` of `http`, and the target listener must have a `protocol` of `https`. + // The target listener that requests will be redirected to if none of the listener's + // `policies` match. + // + // If specified, this listener must have a `protocol` of `http`, and the target listener + // must have a `protocol` of `https`. // // Specify `null` to remove any existing https redirect. HTTPSRedirect *LoadBalancerListenerHTTPSRedirectPatch `json:"https_redirect,omitempty"` @@ -60505,42 +65848,52 @@ func UnmarshalLoadBalancerListenerPatch(m map[string]json.RawMessage, result int obj := new(LoadBalancerListenerPatch) err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) if err != nil { + err = core.SDKErrorf(err, "", "accept_proxy_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) if err != nil { + err = core.SDKErrorf(err, "", "certificate_instance-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) if err != nil { + err = core.SDKErrorf(err, "", "connection_limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentity) + err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerListenerDefaultPoolPatch) if err != nil { + err = core.SDKErrorf(err, "", "default_pool-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPatch) if err != nil { + err = core.SDKErrorf(err, "", "https_redirect-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) if err != nil { + err = core.SDKErrorf(err, "", "idle_connection_timeout-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-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 } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60554,6 +65907,9 @@ func (loadBalancerListenerPatch *LoadBalancerListenerPatch) AsPatch() (_patch ma if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -60561,9 +65917,15 @@ func (loadBalancerListenerPatch *LoadBalancerListenerPatch) AsPatch() (_patch ma type LoadBalancerListenerPolicy struct { // The policy action. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the - // unexpected property value was encountered. + // - `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` + // - `redirect`: Requests will be redirected to the specified `target.url` + // - `reject`: Requests will be rejected with a `403` status code + // + // 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"` // The date and time that this policy was created. @@ -60579,31 +65941,38 @@ type LoadBalancerListenerPolicy struct { // listener. Name *string `json:"name" validate:"required"` - // Priority of the policy. Lower value indicates higher priority. + // Priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value + // indicates higher priority. Priority *int64 `json:"priority" validate:"required"` // The provisioning status of this policy // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The rules for this policy. Rules []LoadBalancerListenerPolicyRuleReference `json:"rules" validate:"required"` // - If `action` is `forward`, the response is a `LoadBalancerPoolReference` - // - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL` - // - If `action` is `https_redirect`, the response is a `LoadBalancerListenerHTTPSRedirect`. + // - If `action` is `https_redirect`, the response is a + // `LoadBalancerListenerPolicyHTTPSRedirect` + // - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL`. Target LoadBalancerListenerPolicyTargetIntf `json:"target,omitempty"` } // Constants associated with the LoadBalancerListenerPolicy.Action property. // The policy action. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the -// unexpected property value was encountered. +// - `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` +// - `redirect`: Requests will be redirected to the specified `target.url` +// - `reject`: Requests will be rejected with a `403` status code +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerListenerPolicyActionForwardConst = "forward" LoadBalancerListenerPolicyActionHTTPSRedirectConst = "https_redirect" @@ -60614,9 +65983,8 @@ const ( // Constants associated with the LoadBalancerListenerPolicy.ProvisioningStatus property. // The provisioning status of this policy // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerListenerPolicyProvisioningStatusActiveConst = "active" LoadBalancerListenerPolicyProvisioningStatusCreatePendingConst = "create_pending" @@ -60630,38 +65998,47 @@ func UnmarshalLoadBalancerListenerPolicy(m map[string]json.RawMessage, result in obj := new(LoadBalancerListenerPolicy) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) if err != nil { + err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRuleReference) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTarget) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60679,6 +66056,7 @@ func UnmarshalLoadBalancerListenerPolicyCollection(m map[string]json.RawMessage, obj := new(LoadBalancerListenerPolicyCollection) err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicy) if err != nil { + err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60690,13 +66068,14 @@ type LoadBalancerListenerPolicyPatch struct { // The name for this policy. The name must not be used by another policy for the load balancer listener. Name *string `json:"name,omitempty"` - // Priority of the policy. Lower value indicates higher priority. + // Priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value + // indicates higher priority. Priority *int64 `json:"priority,omitempty"` // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPatch`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. Target LoadBalancerListenerPolicyTargetPatchIntf `json:"target,omitempty"` } @@ -60705,14 +66084,17 @@ func UnmarshalLoadBalancerListenerPolicyPatch(m map[string]json.RawMessage, resu obj := new(LoadBalancerListenerPolicyPatch) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPatch) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60726,6 +66108,9 @@ func (loadBalancerListenerPolicyPatch *LoadBalancerListenerPolicyPatch) AsPatch( if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -60733,34 +66118,47 @@ func (loadBalancerListenerPolicyPatch *LoadBalancerListenerPolicyPatch) AsPatch( type LoadBalancerListenerPolicyPrototype struct { // The policy action. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the - // unexpected property value was encountered. + // - `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` + // - `redirect`: Requests will be redirected to the specified `target.url` + // - `reject`: Requests will be rejected with a `403` status code + // + // 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"` // The name for this policy. The name must not be used by another policy for the load balancer listener. If // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // Priority of the policy. Lower value indicates higher priority. + // Priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value + // indicates higher priority. Priority *int64 `json:"priority" validate:"required"` // The rule prototype objects for this policy. Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. + // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` } // Constants associated with the LoadBalancerListenerPolicyPrototype.Action property. // The policy action. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the policy on which the -// unexpected property value was encountered. +// - `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` +// - `redirect`: Requests will be redirected to the specified `target.url` +// - `reject`: Requests will be rejected with a `403` status code +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerListenerPolicyPrototypeActionForwardConst = "forward" LoadBalancerListenerPolicyPrototypeActionHTTPSRedirectConst = "https_redirect" @@ -60775,6 +66173,9 @@ func (*VpcV1) NewLoadBalancerListenerPolicyPrototype(action string, priority int Priority: core.Int64Ptr(priority), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -60783,22 +66184,27 @@ func UnmarshalLoadBalancerListenerPolicyPrototype(m map[string]json.RawMessage, obj := new(LoadBalancerListenerPolicyPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-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, "priority", &obj.Priority) if err != nil { + err = core.SDKErrorf(err, "", "priority-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRulePrototype) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60827,18 +66233,22 @@ func UnmarshalLoadBalancerListenerPolicyReference(m map[string]json.RawMessage, obj := new(LoadBalancerListenerPolicyReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60857,6 +66267,7 @@ func UnmarshalLoadBalancerListenerPolicyReferenceDeleted(m map[string]json.RawMe obj := new(LoadBalancerListenerPolicyReferenceDeleted) 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)) @@ -60889,9 +66300,8 @@ type LoadBalancerListenerPolicyRule struct { // The provisioning status of this rule // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the rule on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The type of the rule. @@ -60916,9 +66326,8 @@ const ( // Constants associated with the LoadBalancerListenerPolicyRule.ProvisioningStatus property. // The provisioning status of this rule // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the rule on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerListenerPolicyRuleProvisioningStatusActiveConst = "active" LoadBalancerListenerPolicyRuleProvisioningStatusCreatePendingConst = "create_pending" @@ -60944,34 +66353,42 @@ func UnmarshalLoadBalancerListenerPolicyRule(m map[string]json.RawMessage, resul obj := new(LoadBalancerListenerPolicyRule) err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) if err != nil { + err = core.SDKErrorf(err, "", "condition-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, "field", &obj.Field) if err != nil { + err = core.SDKErrorf(err, "", "field-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, "provisioning_status", &obj.ProvisioningStatus) if err != nil { + err = core.SDKErrorf(err, "", "provisioning_status-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, "value", &obj.Value) if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -60989,6 +66406,7 @@ func UnmarshalLoadBalancerListenerPolicyRuleCollection(m map[string]json.RawMess obj := new(LoadBalancerListenerPolicyRuleCollection) err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61046,18 +66464,22 @@ func UnmarshalLoadBalancerListenerPolicyRulePatch(m map[string]json.RawMessage, obj := new(LoadBalancerListenerPolicyRulePatch) err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) if err != nil { + err = core.SDKErrorf(err, "", "condition-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "field", &obj.Field) if err != nil { + err = core.SDKErrorf(err, "", "field-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, "value", &obj.Value) if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61071,6 +66493,9 @@ func (loadBalancerListenerPolicyRulePatch *LoadBalancerListenerPolicyRulePatch) if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -61128,6 +66553,9 @@ func (*VpcV1) NewLoadBalancerListenerPolicyRulePrototype(condition string, typeV Value: core.StringPtr(value), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -61136,18 +66564,22 @@ func UnmarshalLoadBalancerListenerPolicyRulePrototype(m map[string]json.RawMessa obj := new(LoadBalancerListenerPolicyRulePrototype) err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) if err != nil { + err = core.SDKErrorf(err, "", "condition-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "field", &obj.Field) if err != nil { + err = core.SDKErrorf(err, "", "field-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, "value", &obj.Value) if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61172,14 +66604,17 @@ func UnmarshalLoadBalancerListenerPolicyRuleReference(m map[string]json.RawMessa obj := new(LoadBalancerListenerPolicyRuleReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61198,6 +66633,7 @@ func UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted(m map[string]json.R obj := new(LoadBalancerListenerPolicyRuleReferenceDeleted) 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)) @@ -61205,12 +66641,13 @@ func UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted(m map[string]json.R } // LoadBalancerListenerPolicyTarget : - If `action` is `forward`, the response is a `LoadBalancerPoolReference` -// - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL` -// - If `action` is `https_redirect`, the response is a `LoadBalancerListenerHTTPSRedirect`. +// - If `action` is `https_redirect`, the response is a +// `LoadBalancerListenerPolicyHTTPSRedirect` +// - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL`. // Models which "extend" this model: // - LoadBalancerListenerPolicyTargetLoadBalancerPoolReference +// - LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect // - LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL -// - LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect type LoadBalancerListenerPolicyTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. @@ -61228,13 +66665,13 @@ type LoadBalancerListenerPolicyTarget struct { // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - // The redirect target URL. - URL *string `json:"url,omitempty"` - Listener *LoadBalancerListenerReference `json:"listener,omitempty"` // The redirect relative target URI. URI *string `json:"uri,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` } func (*LoadBalancerListenerPolicyTarget) isaLoadBalancerListenerPolicyTarget() bool { @@ -61250,34 +66687,42 @@ func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, res obj := new(LoadBalancerListenerPolicyTarget) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) 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, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61285,13 +66730,13 @@ func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, res } // LoadBalancerListenerPolicyTargetPatch : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. -// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPatch`. +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. // Models which "extend" this model: // - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch // - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch type LoadBalancerListenerPolicyTargetPatch struct { // The unique identifier for this load balancer pool. ID *string `json:"id,omitempty"` @@ -61302,14 +66747,14 @@ type LoadBalancerListenerPolicyTargetPatch struct { // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - // The redirect target URL. - URL *string `json:"url,omitempty"` - // Identifies a load balancer listener by a unique property. Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` // The redirect relative target URI. URI *string `json:"uri,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` } func (*LoadBalancerListenerPolicyTargetPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { @@ -61325,26 +66770,32 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage obj := new(LoadBalancerListenerPolicyTargetPatch) 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 } err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61352,13 +66803,13 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage } // LoadBalancerListenerPolicyTargetPrototype : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. -// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. +// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. // Models which "extend" this model: // - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype // - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype type LoadBalancerListenerPolicyTargetPrototype struct { // The unique identifier for this load balancer pool. ID *string `json:"id,omitempty"` @@ -61369,14 +66820,14 @@ type LoadBalancerListenerPolicyTargetPrototype struct { // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - // The redirect target URL. - URL *string `json:"url,omitempty"` - // Identifies a load balancer listener by a unique property. Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` // The redirect relative target URI. URI *string `json:"uri,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` } func (*LoadBalancerListenerPolicyTargetPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { @@ -61392,26 +66843,32 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototype(m map[string]json.RawMes obj := new(LoadBalancerListenerPolicyTargetPrototype) 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 } err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) + err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) + err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) + err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61435,18 +66892,23 @@ type LoadBalancerListenerPrototypeLoadBalancerContext struct { // The connection limit of the listener. ConnectionLimit *int64 `json:"connection_limit,omitempty"` - // The default pool for this listener. If specified, the pool must: - // - Belong to this load balancer. - // - Have the same `protocol` as this listener, or have a compatible protocol. - // At present, the compatible protocols are `http` and `https`. - // - Not already be the `default_pool` for another listener. + // The default pool for this listener. If `https_redirect` is specified, + // the default pool will not be used. If specified, the pool must: + // + // - Belong to this load balancer. + // - Have the same `protocol` as this listener, or have a compatible protocol. + // At present, the compatible protocols are `http` and `https`. + // - Not already be the `default_pool` for another listener. // // If unspecified, this listener will be created with no default pool, but one may be // subsequently set. DefaultPool *LoadBalancerPoolIdentityByName `json:"default_pool,omitempty"` - // The target listener that requests will be redirected to. This listener must have a - // `protocol` of `http`, and the target listener must have a `protocol` of `https`. + // The target listener that requests will be redirected to if none of the listener's + // `policies` match. + // + // If specified, this listener must have a `protocol` of `http`, and the target + // 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. @@ -61517,6 +66979,9 @@ func (*VpcV1) NewLoadBalancerListenerPrototypeLoadBalancerContext(protocol strin Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -61525,42 +66990,52 @@ func UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext(m map[string]json obj := new(LoadBalancerListenerPrototypeLoadBalancerContext) err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) if err != nil { + err = core.SDKErrorf(err, "", "accept_proxy_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) if err != nil { + err = core.SDKErrorf(err, "", "certificate_instance-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) if err != nil { + err = core.SDKErrorf(err, "", "connection_limit-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentityByName) if err != nil { + err = core.SDKErrorf(err, "", "default_pool-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPrototype) if err != nil { + err = core.SDKErrorf(err, "", "https_redirect-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) if err != nil { + err = core.SDKErrorf(err, "", "idle_connection_timeout-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-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 } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61585,14 +67060,17 @@ func UnmarshalLoadBalancerListenerReference(m map[string]json.RawMessage, result obj := new(LoadBalancerListenerReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61611,6 +67089,7 @@ func UnmarshalLoadBalancerListenerReferenceDeleted(m map[string]json.RawMessage, obj := new(LoadBalancerListenerReferenceDeleted) 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)) @@ -61628,6 +67107,7 @@ func UnmarshalLoadBalancerLogging(m map[string]json.RawMessage, result interface obj := new(LoadBalancerLogging) err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapath) if err != nil { + err = core.SDKErrorf(err, "", "datapath-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61645,6 +67125,7 @@ func UnmarshalLoadBalancerLoggingDatapath(m map[string]json.RawMessage, result i obj := new(LoadBalancerLoggingDatapath) err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { + err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61662,6 +67143,7 @@ func UnmarshalLoadBalancerLoggingDatapathPatch(m map[string]json.RawMessage, res obj := new(LoadBalancerLoggingDatapathPatch) err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { + err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61679,6 +67161,7 @@ func UnmarshalLoadBalancerLoggingDatapathPrototype(m map[string]json.RawMessage, obj := new(LoadBalancerLoggingDatapathPrototype) err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { + err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61696,6 +67179,7 @@ func UnmarshalLoadBalancerLoggingPatch(m map[string]json.RawMessage, result inte obj := new(LoadBalancerLoggingPatch) err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPatch) if err != nil { + err = core.SDKErrorf(err, "", "datapath-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61713,6 +67197,7 @@ func UnmarshalLoadBalancerLoggingPrototype(m map[string]json.RawMessage, result obj := new(LoadBalancerLoggingPrototype) err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPrototype) if err != nil { + err = core.SDKErrorf(err, "", "datapath-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61751,18 +67236,22 @@ func UnmarshalLoadBalancerPatch(m map[string]json.RawMessage, result interface{} obj := new(LoadBalancerPatch) err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalLoadBalancerDnsPatch) if err != nil { + err = core.SDKErrorf(err, "", "dns-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLoggingPatch) if err != nil { + err = core.SDKErrorf(err, "", "logging-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, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61776,6 +67265,9 @@ func (loadBalancerPatch *LoadBalancerPatch) AsPatch() (_patch map[string]interfa if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -61807,16 +67299,14 @@ type LoadBalancerPool struct { // The protocol for this load balancer pool. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Protocol *string `json:"protocol" validate:"required"` // The provisioning status of this pool // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The PROXY protocol setting for this pool: @@ -61828,11 +67318,6 @@ type LoadBalancerPool struct { ProxyProtocol *string `json:"proxy_protocol" validate:"required"` // The session persistence of this pool. - // - // The enumerated values for this property are expected to expand in the future. When - // processing this property, check for and log unknown values. Optionally halt - // processing and surface the error, or bypass the pool on which the unexpected - // property value was encountered. SessionPersistence *LoadBalancerPoolSessionPersistence `json:"session_persistence,omitempty"` } @@ -61847,9 +67332,8 @@ const ( // Constants associated with the LoadBalancerPool.Protocol property. // The protocol for this load balancer pool. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerPoolProtocolHTTPConst = "http" LoadBalancerPoolProtocolHTTPSConst = "https" @@ -61860,9 +67344,8 @@ const ( // Constants associated with the LoadBalancerPool.ProvisioningStatus property. // The provisioning status of this pool // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerPoolProvisioningStatusActiveConst = "active" LoadBalancerPoolProvisioningStatusCreatePendingConst = "create_pending" @@ -61889,50 +67372,62 @@ func UnmarshalLoadBalancerPool(m map[string]json.RawMessage, result interface{}) obj := new(LoadBalancerPool) err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) if err != nil { + err = core.SDKErrorf(err, "", "algorithm-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, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitor) if err != nil { + err = core.SDKErrorf(err, "", "health_monitor-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, "instance_group", &obj.InstanceGroup, UnmarshalInstanceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "instance_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberReference) if err != nil { + err = core.SDKErrorf(err, "", "members-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) if err != nil { + err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) if err != nil { + err = core.SDKErrorf(err, "", "proxy_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistence) if err != nil { + err = core.SDKErrorf(err, "", "session_persistence-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61950,6 +67445,7 @@ func UnmarshalLoadBalancerPoolCollection(m map[string]json.RawMessage, result in obj := new(LoadBalancerPoolCollection) err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPool) if err != nil { + err = core.SDKErrorf(err, "", "pools-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -61974,9 +67470,8 @@ type LoadBalancerPoolHealthMonitor struct { // The protocol type to use for health checks. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which - // the unexpected property value was encountered. + // 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 health check URL path. Applicable when `type` is `http` or `https`. @@ -61988,9 +67483,8 @@ type LoadBalancerPoolHealthMonitor struct { // Constants associated with the LoadBalancerPoolHealthMonitor.Type property. // The protocol type to use for health checks. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which -// the unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerPoolHealthMonitorTypeHTTPConst = "http" LoadBalancerPoolHealthMonitorTypeHTTPSConst = "https" @@ -62002,26 +67496,32 @@ func UnmarshalLoadBalancerPoolHealthMonitor(m map[string]json.RawMessage, result obj := new(LoadBalancerPoolHealthMonitor) err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) if err != nil { + err = core.SDKErrorf(err, "", "delay-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) if err != nil { + err = core.SDKErrorf(err, "", "max_retries-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) if err != nil { + err = core.SDKErrorf(err, "", "timeout-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, "url_path", &obj.URLPath) if err != nil { + err = core.SDKErrorf(err, "", "url_path-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62072,6 +67572,9 @@ func (*VpcV1) NewLoadBalancerPoolHealthMonitorPatch(delay int64, maxRetries int6 Type: core.StringPtr(typeVar), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -62080,26 +67583,32 @@ func UnmarshalLoadBalancerPoolHealthMonitorPatch(m map[string]json.RawMessage, r obj := new(LoadBalancerPoolHealthMonitorPatch) err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) if err != nil { + err = core.SDKErrorf(err, "", "delay-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) if err != nil { + err = core.SDKErrorf(err, "", "max_retries-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) if err != nil { + err = core.SDKErrorf(err, "", "timeout-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, "url_path", &obj.URLPath) if err != nil { + err = core.SDKErrorf(err, "", "url_path-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62148,6 +67657,9 @@ func (*VpcV1) NewLoadBalancerPoolHealthMonitorPrototype(delay int64, maxRetries Type: core.StringPtr(typeVar), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -62156,26 +67668,32 @@ func UnmarshalLoadBalancerPoolHealthMonitorPrototype(m map[string]json.RawMessag obj := new(LoadBalancerPoolHealthMonitorPrototype) err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) if err != nil { + err = core.SDKErrorf(err, "", "delay-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) if err != nil { + err = core.SDKErrorf(err, "", "max_retries-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) if err != nil { + err = core.SDKErrorf(err, "", "timeout-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, "url_path", &obj.URLPath) if err != nil { + err = core.SDKErrorf(err, "", "url_path-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62184,8 +67702,8 @@ func UnmarshalLoadBalancerPoolHealthMonitorPrototype(m map[string]json.RawMessag // LoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. // Models which "extend" this model: -// - LoadBalancerPoolIdentityByID -// - LoadBalancerPoolIdentityByHref +// - LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref type LoadBalancerPoolIdentity struct { // The unique identifier for this load balancer pool. ID *string `json:"id,omitempty"` @@ -62207,10 +67725,12 @@ func UnmarshalLoadBalancerPoolIdentity(m map[string]json.RawMessage, result inte obj := new(LoadBalancerPoolIdentity) 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)) @@ -62229,6 +67749,9 @@ func (*VpcV1) NewLoadBalancerPoolIdentityByName(name string) (_model *LoadBalanc Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -62237,6 +67760,7 @@ func UnmarshalLoadBalancerPoolIdentityByName(m map[string]json.RawMessage, resul obj := new(LoadBalancerPoolIdentityByName) 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)) @@ -62267,9 +67791,8 @@ type LoadBalancerPoolMember struct { // The provisioning status of this member // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool member on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The pool member target. Load balancers in the `network` family support virtual server @@ -62294,9 +67817,8 @@ const ( // Constants associated with the LoadBalancerPoolMember.ProvisioningStatus property. // The provisioning status of this member // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool member on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerPoolMemberProvisioningStatusActiveConst = "active" LoadBalancerPoolMemberProvisioningStatusCreatePendingConst = "create_pending" @@ -62310,34 +67832,42 @@ func UnmarshalLoadBalancerPoolMember(m map[string]json.RawMessage, result interf obj := new(LoadBalancerPoolMember) 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, "health", &obj.Health) if err != nil { + err = core.SDKErrorf(err, "", "health-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, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) if err != nil { + err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTarget) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) if err != nil { + err = core.SDKErrorf(err, "", "weight-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62355,6 +67885,7 @@ func UnmarshalLoadBalancerPoolMemberCollection(m map[string]json.RawMessage, res obj := new(LoadBalancerPoolMemberCollection) err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMember) if err != nil { + err = core.SDKErrorf(err, "", "members-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62389,14 +67920,17 @@ func UnmarshalLoadBalancerPoolMemberPatch(m map[string]json.RawMessage, result i obj := new(LoadBalancerPoolMemberPatch) err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) if err != nil { + err = core.SDKErrorf(err, "", "weight-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62410,6 +67944,9 @@ func (loadBalancerPoolMemberPatch *LoadBalancerPoolMemberPatch) AsPatch() (_patc if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -62443,6 +67980,9 @@ func (*VpcV1) NewLoadBalancerPoolMemberPrototype(port int64, target LoadBalancer Target: target, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -62451,14 +67991,17 @@ func UnmarshalLoadBalancerPoolMemberPrototype(m map[string]json.RawMessage, resu obj := new(LoadBalancerPoolMemberPrototype) err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) if err != nil { + err = core.SDKErrorf(err, "", "weight-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62483,14 +68026,17 @@ func UnmarshalLoadBalancerPoolMemberReference(m map[string]json.RawMessage, resu obj := new(LoadBalancerPoolMemberReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolMemberReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62509,6 +68055,7 @@ func UnmarshalLoadBalancerPoolMemberReferenceDeleted(m map[string]json.RawMessag obj := new(LoadBalancerPoolMemberReferenceDeleted) 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)) @@ -62540,9 +68087,8 @@ type LoadBalancerPoolMemberTarget struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` } @@ -62559,26 +68105,32 @@ func UnmarshalLoadBalancerPoolMemberTarget(m map[string]json.RawMessage, result obj := new(LoadBalancerPoolMemberTarget) 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, UnmarshalInstanceReferenceDeleted) 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, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62603,9 +68155,8 @@ type LoadBalancerPoolMemberTargetPrototype struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` } @@ -62622,18 +68173,22 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototype(m map[string]json.RawMessage obj := new(LoadBalancerPoolMemberTargetPrototype) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62715,26 +68270,32 @@ func UnmarshalLoadBalancerPoolPatch(m map[string]json.RawMessage, result interfa obj := new(LoadBalancerPoolPatch) err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) if err != nil { + err = core.SDKErrorf(err, "", "algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPatch) if err != nil { + err = core.SDKErrorf(err, "", "health_monitor-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) if err != nil { + err = core.SDKErrorf(err, "", "proxy_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePatch) if err != nil { + err = core.SDKErrorf(err, "", "session_persistence-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62748,6 +68309,9 @@ func (loadBalancerPoolPatch *LoadBalancerPoolPatch) AsPatch() (_patch map[string if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -62780,7 +68344,9 @@ type LoadBalancerPoolPrototype struct { // Supported by load balancers in the `application` family (otherwise always `disabled`). ProxyProtocol *string `json:"proxy_protocol,omitempty"` - // The session persistence of this pool. + // The session persistence of this pool. If unspecified, session persistence will be + // disabled, and traffic will be distributed across backend server members of the + // pool. SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` } @@ -62824,6 +68390,9 @@ func (*VpcV1) NewLoadBalancerPoolPrototype(algorithm string, healthMonitor *Load Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -62832,30 +68401,37 @@ func UnmarshalLoadBalancerPoolPrototype(m map[string]json.RawMessage, result int obj := new(LoadBalancerPoolPrototype) err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) if err != nil { + err = core.SDKErrorf(err, "", "algorithm-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPrototype) if err != nil { + err = core.SDKErrorf(err, "", "health_monitor-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberPrototype) if err != nil { + err = core.SDKErrorf(err, "", "members-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) if err != nil { + err = core.SDKErrorf(err, "", "proxy_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePrototype) if err != nil { + err = core.SDKErrorf(err, "", "session_persistence-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62883,18 +68459,22 @@ func UnmarshalLoadBalancerPoolReference(m map[string]json.RawMessage, result int obj := new(LoadBalancerPoolReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -62913,6 +68493,7 @@ func UnmarshalLoadBalancerPoolReferenceDeleted(m map[string]json.RawMessage, res obj := new(LoadBalancerPoolReferenceDeleted) 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)) @@ -62927,12 +68508,18 @@ type LoadBalancerPoolSessionPersistence struct { // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` // protocols. + // + // 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"` } // Constants associated with the LoadBalancerPoolSessionPersistence.Type property. // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` // protocols. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerPoolSessionPersistenceTypeAppCookieConst = "app_cookie" LoadBalancerPoolSessionPersistenceTypeHTTPCookieConst = "http_cookie" @@ -62944,10 +68531,12 @@ func UnmarshalLoadBalancerPoolSessionPersistence(m map[string]json.RawMessage, r obj := new(LoadBalancerPoolSessionPersistence) err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) if err != nil { + err = core.SDKErrorf(err, "", "cookie_name-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)) @@ -62979,10 +68568,12 @@ func UnmarshalLoadBalancerPoolSessionPersistencePatch(m map[string]json.RawMessa obj := new(LoadBalancerPoolSessionPersistencePatch) err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) if err != nil { + err = core.SDKErrorf(err, "", "cookie_name-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)) @@ -63015,6 +68606,9 @@ func (*VpcV1) NewLoadBalancerPoolSessionPersistencePrototype(typeVar string) (_m Type: core.StringPtr(typeVar), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -63023,10 +68617,12 @@ func UnmarshalLoadBalancerPoolSessionPersistencePrototype(m map[string]json.RawM obj := new(LoadBalancerPoolSessionPersistencePrototype) err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) if err != nil { + err = core.SDKErrorf(err, "", "cookie_name-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)) @@ -63039,9 +68635,8 @@ type LoadBalancerPrivateIpsItem struct { // // If the address has not yet been selected, the value will be `0.0.0.0`. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` // If present, this property indicates the referenced resource has been deleted, and provides @@ -63072,26 +68667,32 @@ func UnmarshalLoadBalancerPrivateIpsItem(m map[string]json.RawMessage, result in obj := new(LoadBalancerPrivateIpsItem) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) 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)) @@ -63102,9 +68703,8 @@ func UnmarshalLoadBalancerPrivateIpsItem(m map[string]json.RawMessage, result in type LoadBalancerProfile struct { // The product family this load balancer profile belongs to. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the - // unexpected property value was encountered. + // 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 URL for this load balancer profile. @@ -63128,9 +68728,8 @@ type LoadBalancerProfile struct { // Constants associated with the LoadBalancerProfile.Family property. // The product family this load balancer profile belongs to. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerProfileFamilyApplicationConst = "application" LoadBalancerProfileFamilyNetworkConst = "network" @@ -63141,34 +68740,42 @@ func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface obj := new(LoadBalancerProfile) err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-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.UnmarshalModel(m, "instance_groups_supported", &obj.InstanceGroupsSupported, UnmarshalLoadBalancerProfileInstanceGroupsSupported) if err != nil { + err = core.SDKErrorf(err, "", "instance_groups_supported-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "logging_supported", &obj.LoggingSupported, UnmarshalLoadBalancerProfileLoggingSupported) if err != nil { + err = core.SDKErrorf(err, "", "logging_supported-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, "route_mode_supported", &obj.RouteModeSupported, UnmarshalLoadBalancerProfileRouteModeSupported) if err != nil { + err = core.SDKErrorf(err, "", "route_mode_supported-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "security_groups_supported", &obj.SecurityGroupsSupported, UnmarshalLoadBalancerProfileSecurityGroupsSupported) if err != nil { + err = core.SDKErrorf(err, "", "security_groups_supported-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "udp_supported", &obj.UDPSupported, UnmarshalLoadBalancerProfileUDPSupported) if err != nil { + err = core.SDKErrorf(err, "", "udp_supported-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63199,22 +68806,27 @@ func UnmarshalLoadBalancerProfileCollection(m map[string]json.RawMessage, result obj := new(LoadBalancerProfileCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalLoadBalancerProfileCollectionFirst) 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, UnmarshalLoadBalancerProfileCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalLoadBalancerProfile) 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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63227,8 +68839,11 @@ func (resp *LoadBalancerProfileCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -63244,6 +68859,7 @@ func UnmarshalLoadBalancerProfileCollectionFirst(m map[string]json.RawMessage, r 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)) @@ -63261,6 +68877,7 @@ func UnmarshalLoadBalancerProfileCollectionNext(m map[string]json.RawMessage, re 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)) @@ -63292,10 +68909,12 @@ func UnmarshalLoadBalancerProfileIdentity(m map[string]json.RawMessage, result i obj := new(LoadBalancerProfileIdentity) 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)) @@ -63333,10 +68952,12 @@ func UnmarshalLoadBalancerProfileInstanceGroupsSupported(m map[string]json.RawMe obj := new(LoadBalancerProfileInstanceGroupsSupported) 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)) @@ -63363,10 +68984,12 @@ func UnmarshalLoadBalancerProfileLoggingSupported(m map[string]json.RawMessage, obj := new(LoadBalancerProfileLoggingSupported) 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)) @@ -63377,9 +69000,8 @@ func UnmarshalLoadBalancerProfileLoggingSupported(m map[string]json.RawMessage, type LoadBalancerProfileReference struct { // The product family this load balancer profile belongs to. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the - // unexpected property value was encountered. + // 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 URL for this load balancer profile. @@ -63392,9 +69014,8 @@ type LoadBalancerProfileReference struct { // Constants associated with the LoadBalancerProfileReference.Family property. // The product family this load balancer profile belongs to. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the load balancer profile on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerProfileReferenceFamilyApplicationConst = "application" LoadBalancerProfileReferenceFamilyNetworkConst = "network" @@ -63405,14 +69026,17 @@ func UnmarshalLoadBalancerProfileReference(m map[string]json.RawMessage, result obj := new(LoadBalancerProfileReference) err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63450,10 +69074,12 @@ func UnmarshalLoadBalancerProfileRouteModeSupported(m map[string]json.RawMessage obj := new(LoadBalancerProfileRouteModeSupported) 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)) @@ -63491,10 +69117,12 @@ func UnmarshalLoadBalancerProfileSecurityGroupsSupported(m map[string]json.RawMe obj := new(LoadBalancerProfileSecurityGroupsSupported) 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)) @@ -63532,10 +69160,12 @@ func UnmarshalLoadBalancerProfileUDPSupported(m map[string]json.RawMessage, resu obj := new(LoadBalancerProfileUDPSupported) 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)) @@ -63554,6 +69184,7 @@ func UnmarshalLoadBalancerReferenceDeleted(m map[string]json.RawMessage, result obj := new(LoadBalancerReferenceDeleted) 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)) @@ -63580,18 +69211,22 @@ func UnmarshalLoadBalancerStatistics(m map[string]json.RawMessage, result interf obj := new(LoadBalancerStatistics) err = core.UnmarshalPrimitive(m, "active_connections", &obj.ActiveConnections) if err != nil { + err = core.SDKErrorf(err, "", "active_connections-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "connection_rate", &obj.ConnectionRate) if err != nil { + err = core.SDKErrorf(err, "", "connection_rate-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "data_processed_this_month", &obj.DataProcessedThisMonth) if err != nil { + err = core.SDKErrorf(err, "", "data_processed_this_month-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "throughput", &obj.Throughput) if err != nil { + err = core.SDKErrorf(err, "", "throughput-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63633,38 +69268,47 @@ func UnmarshalNetworkACL(m map[string]json.RawMessage, result interface{}) (err obj := new(NetworkACL) 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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63695,22 +69339,27 @@ func UnmarshalNetworkACLCollection(m map[string]json.RawMessage, result interfac obj := new(NetworkACLCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalNetworkACLCollectionFirst) 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, "network_acls", &obj.NetworkAcls, UnmarshalNetworkACL) if err != nil { + err = core.SDKErrorf(err, "", "network_acls-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLCollectionNext) 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)) @@ -63723,8 +69372,11 @@ func (resp *NetworkACLCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -63740,6 +69392,7 @@ func UnmarshalNetworkACLCollectionFirst(m map[string]json.RawMessage, result int 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)) @@ -63757,6 +69410,7 @@ func UnmarshalNetworkACLCollectionNext(m map[string]json.RawMessage, result inte 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)) @@ -63792,14 +69446,17 @@ func UnmarshalNetworkACLIdentity(m map[string]json.RawMessage, result interface{ obj := new(NetworkACLIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63817,6 +69474,7 @@ func UnmarshalNetworkACLPatch(m map[string]json.RawMessage, result interface{}) obj := new(NetworkACLPatch) 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)) @@ -63830,6 +69488,9 @@ func (networkACLPatch *NetworkACLPatch) AsPatch() (_patch map[string]interface{} if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -63870,22 +69531,27 @@ func UnmarshalNetworkACLPrototype(m map[string]json.RawMessage, result interface obj := new(NetworkACLPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_network_acl-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63916,22 +69582,27 @@ func UnmarshalNetworkACLReference(m map[string]json.RawMessage, result interface obj := new(NetworkACLReference) 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, UnmarshalNetworkACLReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -63950,6 +69621,7 @@ func UnmarshalNetworkACLReferenceDeleted(m map[string]json.RawMessage, result in obj := new(NetworkACLReferenceDeleted) 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)) @@ -64061,23 +69733,37 @@ func UnmarshalNetworkACLRule(m map[string]json.RawMessage, result interface{}) ( var discValue string err = core.UnmarshalPrimitive(m, "protocol", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "all" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolAll-error", common.GetComponentInfo()) + } } else if discValue == "icmp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolIcmp-error", common.GetComponentInfo()) + } } else if discValue == "tcp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo()) + } } else if discValue == "udp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -64109,10 +69795,12 @@ func UnmarshalNetworkACLRuleBeforePatch(m map[string]json.RawMessage, result int obj := new(NetworkACLRuleBeforePatch) 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)) @@ -64146,10 +69834,12 @@ func UnmarshalNetworkACLRuleBeforePrototype(m map[string]json.RawMessage, result obj := new(NetworkACLRuleBeforePrototype) 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)) @@ -64180,22 +69870,27 @@ func UnmarshalNetworkACLRuleCollection(m map[string]json.RawMessage, result inte obj := new(NetworkACLRuleCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalNetworkACLRuleCollectionFirst) 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, UnmarshalNetworkACLRuleCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) if err != nil { + err = core.SDKErrorf(err, "", "rules-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)) @@ -64208,8 +69903,11 @@ func (resp *NetworkACLRuleCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -64225,6 +69923,7 @@ func UnmarshalNetworkACLRuleCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -64242,6 +69941,7 @@ func UnmarshalNetworkACLRuleCollectionNext(m map[string]json.RawMessage, result 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)) @@ -64354,23 +70054,37 @@ func UnmarshalNetworkACLRuleItem(m map[string]json.RawMessage, result interface{ var discValue string err = core.UnmarshalPrimitive(m, "protocol", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "all" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolAll-error", common.GetComponentInfo()) + } } else if discValue == "icmp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolIcmp-error", common.GetComponentInfo()) + } } else if discValue == "tcp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo()) + } } else if discValue == "udp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -64451,54 +70165,67 @@ func UnmarshalNetworkACLRulePatch(m map[string]json.RawMessage, result interface obj := new(NetworkACLRulePatch) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePatch) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_min-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) if err != nil { + err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) if err != nil { + err = core.SDKErrorf(err, "", "source_port_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)) @@ -64512,6 +70239,9 @@ func (networkACLRulePatch *NetworkACLRulePatch) AsPatch() (_patch map[string]int if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -64614,23 +70344,37 @@ func UnmarshalNetworkACLRulePrototype(m map[string]json.RawMessage, result inter var discValue string err = core.UnmarshalPrimitive(m, "protocol", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "all" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype-error", common.GetComponentInfo()) + } } else if discValue == "icmp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype-error", common.GetComponentInfo()) + } } else if discValue == "tcp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype-error", common.GetComponentInfo()) + } } else if discValue == "udp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -64729,23 +70473,37 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContext(m map[string]json.RawMess var discValue string err = core.UnmarshalPrimitive(m, "protocol", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "all" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype-error", common.GetComponentInfo()) + } } else if discValue == "icmp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype-error", common.GetComponentInfo()) + } } else if discValue == "tcp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype-error", common.GetComponentInfo()) + } } else if discValue == "udp" { err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -64771,18 +70529,22 @@ func UnmarshalNetworkACLRuleReference(m map[string]json.RawMessage, result inter obj := new(NetworkACLRuleReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLRuleReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -64801,6 +70563,7 @@ func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, resul obj := new(NetworkACLRuleReferenceDeleted) 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)) @@ -64931,54 +70694,67 @@ func UnmarshalNetworkInterface(m map[string]json.RawMessage, result interface{}) obj := new(NetworkInterface) 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, "created_at", &obj.CreatedAt) if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) if err != nil { + err = core.SDKErrorf(err, "", "floating_ips-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, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-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)) @@ -65029,30 +70805,37 @@ func UnmarshalNetworkInterfaceBareMetalServerContextReference(m map[string]json. obj := new(NetworkInterfaceBareMetalServerContextReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -65071,6 +70854,7 @@ func UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted(m map[strin obj := new(NetworkInterfaceBareMetalServerContextReferenceDeleted) 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)) @@ -65116,22 +70900,27 @@ func UnmarshalNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result i obj := new(NetworkInterfaceIPPrototype) 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 } 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)) @@ -65182,30 +70971,37 @@ func UnmarshalNetworkInterfaceInstanceContextReference(m map[string]json.RawMess obj := new(NetworkInterfaceInstanceContextReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceInstanceContextReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -65224,6 +71020,7 @@ func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json. obj := new(NetworkInterfaceInstanceContextReferenceDeleted) 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)) @@ -65250,10 +71047,12 @@ func UnmarshalNetworkInterfacePatch(m map[string]json.RawMessage, result interfa obj := new(NetworkInterfacePatch) 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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -65267,6 +71066,9 @@ func (networkInterfacePatch *NetworkInterfacePatch) AsPatch() (_patch map[string if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -65306,6 +71108,9 @@ func (*VpcV1) NewNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *N Subnet: subnet, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -65314,22 +71119,27 @@ func UnmarshalNetworkInterfacePrototype(m map[string]json.RawMessage, result int obj := new(NetworkInterfacePrototype) 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, "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)) @@ -65348,6 +71158,7 @@ func UnmarshalNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, res obj := new(NetworkInterfaceReferenceDeleted) 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)) @@ -65366,6 +71177,7 @@ func UnmarshalNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.Ra obj := new(NetworkInterfaceReferenceTargetContextDeleted) 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)) @@ -65383,6 +71195,7 @@ func UnmarshalNetworkInterfaceUnpaginatedCollection(m map[string]json.RawMessage obj := new(NetworkInterfaceUnpaginatedCollection) err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -65449,34 +71262,42 @@ func UnmarshalOperatingSystem(m map[string]json.RawMessage, result interface{}) obj := new(OperatingSystem) err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) if err != nil { + err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "dedicated_host_only", &obj.DedicatedHostOnly) if err != nil { + err = core.SDKErrorf(err, "", "dedicated_host_only-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) if err != nil { + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "vendor", &obj.Vendor) if err != nil { + err = core.SDKErrorf(err, "", "vendor-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "version", &obj.Version) if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -65507,22 +71328,27 @@ func UnmarshalOperatingSystemCollection(m map[string]json.RawMessage, result int obj := new(OperatingSystemCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalOperatingSystemCollectionFirst) 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, UnmarshalOperatingSystemCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "operating_systems", &obj.OperatingSystems, UnmarshalOperatingSystem) if err != nil { + err = core.SDKErrorf(err, "", "operating_systems-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)) @@ -65535,8 +71361,11 @@ func (resp *OperatingSystemCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -65552,6 +71381,7 @@ func UnmarshalOperatingSystemCollectionFirst(m map[string]json.RawMessage, resul 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)) @@ -65569,6 +71399,7 @@ func UnmarshalOperatingSystemCollectionNext(m map[string]json.RawMessage, result 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)) @@ -65600,10 +71431,12 @@ func UnmarshalOperatingSystemIdentity(m map[string]json.RawMessage, result inter obj := new(OperatingSystemIdentity) 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)) @@ -65636,13 +71469,12 @@ type PlacementGroup struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The strategy for this placement group + // The strategy for this placement group: // - `host_spread`: place on different compute hosts // - `power_spread`: place on compute hosts that use different power sources // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the - // unexpected strategy was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Strategy *string `json:"strategy" validate:"required"` } @@ -65665,13 +71497,12 @@ const ( ) // Constants associated with the PlacementGroup.Strategy property. -// The strategy for this placement group +// The strategy for this placement group: // - `host_spread`: place on different compute hosts // - `power_spread`: place on compute hosts that use different power sources // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the placement group on which the -// unexpected strategy was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( PlacementGroupStrategyHostSpreadConst = "host_spread" PlacementGroupStrategyPowerSpreadConst = "power_spread" @@ -65682,38 +71513,47 @@ func UnmarshalPlacementGroup(m map[string]json.RawMessage, result interface{}) ( obj := new(PlacementGroup) 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.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, "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.UnmarshalPrimitive(m, "strategy", &obj.Strategy) if err != nil { + err = core.SDKErrorf(err, "", "strategy-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -65744,22 +71584,27 @@ func UnmarshalPlacementGroupCollection(m map[string]json.RawMessage, result inte obj := new(PlacementGroupCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPlacementGroupCollectionFirst) 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, UnmarshalPlacementGroupCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "placement_groups", &obj.PlacementGroups, UnmarshalPlacementGroup) if err != nil { + err = core.SDKErrorf(err, "", "placement_groups-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)) @@ -65772,8 +71617,11 @@ func (resp *PlacementGroupCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -65789,6 +71637,7 @@ func UnmarshalPlacementGroupCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -65806,6 +71655,7 @@ func UnmarshalPlacementGroupCollectionNext(m map[string]json.RawMessage, result 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)) @@ -65823,6 +71673,7 @@ func UnmarshalPlacementGroupPatch(m map[string]json.RawMessage, result interface obj := new(PlacementGroupPatch) 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)) @@ -65836,6 +71687,9 @@ func (placementGroupPatch *PlacementGroupPatch) AsPatch() (_patch map[string]int if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -65851,6 +71705,7 @@ func UnmarshalPlacementGroupReferenceDeleted(m map[string]json.RawMessage, resul obj := new(PlacementGroupReferenceDeleted) 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)) @@ -65913,46 +71768,57 @@ func UnmarshalPublicGateway(m map[string]json.RawMessage, result interface{}) (e obj := new(PublicGateway) 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, "floating_ip", &obj.FloatingIP, UnmarshalPublicGatewayFloatingIP) if err != nil { + err = core.SDKErrorf(err, "", "floating_ip-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, "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.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-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)) @@ -65983,22 +71849,27 @@ func UnmarshalPublicGatewayCollection(m map[string]json.RawMessage, result inter obj := new(PublicGatewayCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPublicGatewayCollectionFirst) 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, UnmarshalPublicGatewayCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_gateways", &obj.PublicGateways, UnmarshalPublicGateway) if err != nil { + err = core.SDKErrorf(err, "", "public_gateways-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)) @@ -66011,8 +71882,11 @@ func (resp *PublicGatewayCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -66028,6 +71902,7 @@ func UnmarshalPublicGatewayCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -66045,6 +71920,7 @@ func UnmarshalPublicGatewayCollectionNext(m map[string]json.RawMessage, result i 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)) @@ -66078,26 +71954,32 @@ func UnmarshalPublicGatewayFloatingIP(m map[string]json.RawMessage, result inter obj := new(PublicGatewayFloatingIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-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, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -66143,26 +72025,32 @@ func UnmarshalPublicGatewayFloatingIPPrototype(m map[string]json.RawMessage, res obj := new(PublicGatewayFloatingIPPrototype) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -66198,14 +72086,17 @@ func UnmarshalPublicGatewayIdentity(m map[string]json.RawMessage, result interfa obj := new(PublicGatewayIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -66223,6 +72114,7 @@ func UnmarshalPublicGatewayPatch(m map[string]json.RawMessage, result interface{ obj := new(PublicGatewayPatch) 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)) @@ -66236,6 +72128,9 @@ func (publicGatewayPatch *PublicGatewayPatch) AsPatch() (_patch map[string]inter if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -66272,26 +72167,32 @@ func UnmarshalPublicGatewayReference(m map[string]json.RawMessage, result interf obj := new(PublicGatewayReference) 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, UnmarshalPublicGatewayReferenceDeleted) 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)) @@ -66310,6 +72211,7 @@ func UnmarshalPublicGatewayReferenceDeleted(m map[string]json.RawMessage, result obj := new(PublicGatewayReferenceDeleted) 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)) @@ -66343,18 +72245,22 @@ func UnmarshalRegion(m map[string]json.RawMessage, result interface{}) (err erro obj := new(Region) err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) if err != nil { + err = core.SDKErrorf(err, "", "endpoint-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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -66372,6 +72278,7 @@ func UnmarshalRegionCollection(m map[string]json.RawMessage, result interface{}) obj := new(RegionCollection) err = core.UnmarshalModel(m, "regions", &obj.Regions, UnmarshalRegion) if err != nil { + err = core.SDKErrorf(err, "", "regions-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -66403,10 +72310,12 @@ func UnmarshalRegionIdentity(m map[string]json.RawMessage, result interface{}) ( obj := new(RegionIdentity) 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)) @@ -66427,10 +72336,12 @@ func UnmarshalRegionReference(m map[string]json.RawMessage, result interface{}) obj := new(RegionReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -66872,9 +72783,8 @@ type Reservation struct { // The affinity policy to use for this reservation: // - `restricted`: The reservation must be manually requested // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AffinityPolicy *string `json:"affinity_policy" validate:"required"` // The capacity configuration for this reservation @@ -66916,16 +72826,11 @@ type Reservation struct { // The status of the reservation. // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // 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). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []ReservationStatusReason `json:"status_reasons" validate:"required"` // The zone for this reservation. @@ -66936,9 +72841,8 @@ type Reservation struct { // The affinity policy to use for this reservation: // - `restricted`: The reservation must be manually requested // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationAffinityPolicyRestrictedConst = "restricted" ) @@ -66964,9 +72868,8 @@ const ( // Constants associated with the Reservation.Status property. // The status of the reservation. // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationStatusActivatingConst = "activating" ReservationStatusActiveConst = "active" @@ -66981,62 +72884,77 @@ func UnmarshalReservation(m map[string]json.RawMessage, result interface{}) (err obj := new(Reservation) err = core.UnmarshalPrimitive(m, "affinity_policy", &obj.AffinityPolicy) if err != nil { + err = core.SDKErrorf(err, "", "affinity_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalReservationCapacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "committed_use", &obj.CommittedUse, UnmarshalReservationCommittedUse) if err != nil { + err = core.SDKErrorf(err, "", "committed_use-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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, "profile", &obj.Profile, UnmarshalReservationProfile) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.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, UnmarshalReservationStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-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)) @@ -67061,9 +72979,8 @@ type ReservationCapacity struct { // See https://cloud.ibm.com/docs/vpc?topic=vpc-capacity-status for more information. // - `unallocated`: The capacity reservation is not allocated for use // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // 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 total amount of this capacity reservation. @@ -67082,9 +72999,8 @@ type ReservationCapacity struct { // See https://cloud.ibm.com/docs/vpc?topic=vpc-capacity-status for more information. // - `unallocated`: The capacity reservation is not allocated for use // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationCapacityStatusAllocatedConst = "allocated" ReservationCapacityStatusAllocatingConst = "allocating" @@ -67097,22 +73013,27 @@ func UnmarshalReservationCapacity(m map[string]json.RawMessage, result interface obj := new(ReservationCapacity) err = core.UnmarshalPrimitive(m, "allocated", &obj.Allocated) if err != nil { + err = core.SDKErrorf(err, "", "allocated-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "available", &obj.Available) if err != nil { + err = core.SDKErrorf(err, "", "available-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.UnmarshalPrimitive(m, "total", &obj.Total) if err != nil { + err = core.SDKErrorf(err, "", "total-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "used", &obj.Used) if err != nil { + err = core.SDKErrorf(err, "", "used-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67132,6 +73053,7 @@ func UnmarshalReservationCapacityPatch(m map[string]json.RawMessage, result inte obj := new(ReservationCapacityPatch) err = core.UnmarshalPrimitive(m, "total", &obj.Total) if err != nil { + err = core.SDKErrorf(err, "", "total-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67150,6 +73072,9 @@ func (*VpcV1) NewReservationCapacityPrototype(total int64) (_model *ReservationC Total: core.Int64Ptr(total), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -67158,6 +73083,7 @@ func UnmarshalReservationCapacityPrototype(m map[string]json.RawMessage, result obj := new(ReservationCapacityPrototype) err = core.UnmarshalPrimitive(m, "total", &obj.Total) if err != nil { + err = core.SDKErrorf(err, "", "total-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67188,22 +73114,27 @@ func UnmarshalReservationCollection(m map[string]json.RawMessage, result interfa obj := new(ReservationCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservationCollectionFirst) 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, UnmarshalReservationCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservations", &obj.Reservations, UnmarshalReservation) if err != nil { + err = core.SDKErrorf(err, "", "reservations-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)) @@ -67216,8 +73147,11 @@ func (resp *ReservationCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -67233,6 +73167,7 @@ func UnmarshalReservationCollectionFirst(m map[string]json.RawMessage, result in 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)) @@ -67250,6 +73185,7 @@ func UnmarshalReservationCollectionNext(m map[string]json.RawMessage, result int 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)) @@ -67266,18 +73202,16 @@ type ReservationCommittedUse struct { // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ExpirationPolicy *string `json:"expiration_policy" validate:"required"` // The term for this committed use reservation: // - `one_year`: 1 year // - `three_year`: 3 years // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Term *string `json:"term" validate:"required"` } @@ -67287,9 +73221,8 @@ type ReservationCommittedUse struct { // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationCommittedUseExpirationPolicyReleaseConst = "release" ReservationCommittedUseExpirationPolicyRenewConst = "renew" @@ -67300,14 +73233,17 @@ func UnmarshalReservationCommittedUse(m map[string]json.RawMessage, result inter obj := new(ReservationCommittedUse) err = core.UnmarshalPrimitive(m, "expiration_at", &obj.ExpirationAt) if err != nil { + err = core.SDKErrorf(err, "", "expiration_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) if err != nil { + err = core.SDKErrorf(err, "", "expiration_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "term", &obj.Term) if err != nil { + err = core.SDKErrorf(err, "", "term-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67321,9 +73257,8 @@ type ReservationCommittedUsePatch struct { // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ExpirationPolicy *string `json:"expiration_policy,omitempty"` // The term for this committed use reservation: @@ -67342,9 +73277,8 @@ type ReservationCommittedUsePatch struct { // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationCommittedUsePatchExpirationPolicyReleaseConst = "release" ReservationCommittedUsePatchExpirationPolicyRenewConst = "renew" @@ -67355,10 +73289,12 @@ func UnmarshalReservationCommittedUsePatch(m map[string]json.RawMessage, result obj := new(ReservationCommittedUsePatch) err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) if err != nil { + err = core.SDKErrorf(err, "", "expiration_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "term", &obj.Term) if err != nil { + err = core.SDKErrorf(err, "", "term-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67372,9 +73308,8 @@ type ReservationCommittedUsePrototype struct { // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ExpirationPolicy *string `json:"expiration_policy,omitempty"` // The term for this committed use reservation: @@ -67391,9 +73326,8 @@ type ReservationCommittedUsePrototype struct { // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. // -// The enumerated values for this property may expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationCommittedUsePrototypeExpirationPolicyReleaseConst = "release" ReservationCommittedUsePrototypeExpirationPolicyRenewConst = "renew" @@ -67405,6 +73339,9 @@ func (*VpcV1) NewReservationCommittedUsePrototype(term string) (_model *Reservat Term: core.StringPtr(term), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -67413,10 +73350,12 @@ func UnmarshalReservationCommittedUsePrototype(m map[string]json.RawMessage, res obj := new(ReservationCommittedUsePrototype) err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) if err != nil { + err = core.SDKErrorf(err, "", "expiration_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "term", &obj.Term) if err != nil { + err = core.SDKErrorf(err, "", "term-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67452,14 +73391,17 @@ func UnmarshalReservationIdentity(m map[string]json.RawMessage, result interface obj := new(ReservationIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67491,18 +73433,22 @@ func UnmarshalReservationPatch(m map[string]json.RawMessage, result interface{}) obj := new(ReservationPatch) err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalReservationCapacityPatch) if err != nil { + err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "committed_use", &obj.CommittedUse, UnmarshalReservationCommittedUsePatch) if err != nil { + err = core.SDKErrorf(err, "", "committed_use-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, "profile", &obj.Profile, UnmarshalReservationProfilePatch) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67516,6 +73462,9 @@ func (reservationPatch *ReservationPatch) AsPatch() (_patch map[string]interface if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -67542,14 +73491,17 @@ func UnmarshalReservationProfile(m map[string]json.RawMessage, result interface{ obj := new(ReservationProfile) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -67578,10 +73530,12 @@ func UnmarshalReservationProfilePatch(m map[string]json.RawMessage, result inter obj := new(ReservationProfilePatch) 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)) @@ -67610,6 +73564,9 @@ func (*VpcV1) NewReservationProfilePrototype(name string, resourceType string) ( ResourceType: core.StringPtr(resourceType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -67618,10 +73575,12 @@ func UnmarshalReservationProfilePrototype(m map[string]json.RawMessage, result i obj := new(ReservationProfilePrototype) 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)) @@ -67661,26 +73620,32 @@ func UnmarshalReservationReference(m map[string]json.RawMessage, result interfac obj := new(ReservationReference) 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, UnmarshalReservationReferenceDeleted) 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)) @@ -67699,6 +73664,7 @@ func UnmarshalReservationReferenceDeleted(m map[string]json.RawMessage, result i obj := new(ReservationReferenceDeleted) 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)) @@ -67708,6 +73674,9 @@ func UnmarshalReservationReferenceDeleted(m map[string]json.RawMessage, result i // ReservationStatusReason : ReservationStatusReason struct type ReservationStatusReason struct { // A snake case string succinctly identifying the status reason. + // + // 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. @@ -67719,6 +73688,9 @@ type ReservationStatusReason struct { // Constants associated with the ReservationStatusReason.Code property. // A snake case string succinctly identifying the status reason. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationStatusReasonCodeCannotActivateNoCapacityAvailableConst = "cannot_activate_no_capacity_available" ReservationStatusReasonCodeCannotRenewUnsupportedProfileTermConst = "cannot_renew_unsupported_profile_term" @@ -67729,14 +73701,17 @@ func UnmarshalReservationStatusReason(m map[string]json.RawMessage, result inter obj := new(ReservationStatusReason) 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)) @@ -67749,9 +73724,8 @@ type ReservedIP struct { // // If the address has not yet been selected, the value will be `0.0.0.0`. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` // Indicates whether this reserved IP member will be automatically deleted when either @@ -67815,42 +73789,52 @@ func UnmarshalReservedIP(m map[string]json.RawMessage, result interface{}) (err obj := new(ReservedIP) 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, "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, "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, "owner", &obj.Owner) if err != nil { + err = core.SDKErrorf(err, "", "owner-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, "target", &obj.Target, UnmarshalReservedIPTarget) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67881,22 +73865,27 @@ func UnmarshalReservedIPCollection(m map[string]json.RawMessage, result interfac obj := new(ReservedIPCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionFirst) 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, UnmarshalReservedIPCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reserved_ips", &obj.ReservedIps, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "reserved_ips-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)) @@ -67909,8 +73898,11 @@ func (resp *ReservedIPCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -67939,22 +73931,27 @@ func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext(m map[s obj := new(ReservedIPCollectionBareMetalServerNetworkInterfaceContext) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "ips-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, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext) 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)) @@ -67972,6 +73969,7 @@ func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst(m 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)) @@ -67989,6 +73987,7 @@ func UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext(m m 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)) @@ -68019,22 +74018,27 @@ func UnmarshalReservedIPCollectionEndpointGatewayContext(m map[string]json.RawMe obj := new(ReservedIPCollectionEndpointGatewayContext) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionEndpointGatewayContextFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "ips-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, UnmarshalReservedIPCollectionEndpointGatewayContextNext) 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)) @@ -68047,8 +74051,11 @@ func (resp *ReservedIPCollectionEndpointGatewayContext) GetNextStart() (*string, return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -68064,6 +74071,7 @@ func UnmarshalReservedIPCollectionEndpointGatewayContextFirst(m map[string]json. 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)) @@ -68081,6 +74089,7 @@ func UnmarshalReservedIPCollectionEndpointGatewayContextNext(m map[string]json.R 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)) @@ -68098,6 +74107,7 @@ func UnmarshalReservedIPCollectionFirst(m map[string]json.RawMessage, result int 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)) @@ -68128,22 +74138,27 @@ func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext(m map[string]j obj := new(ReservedIPCollectionInstanceNetworkInterfaceContext) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) if err != nil { + err = core.SDKErrorf(err, "", "ips-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, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext) 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)) @@ -68156,8 +74171,11 @@ func (resp *ReservedIPCollectionInstanceNetworkInterfaceContext) GetNextStart() return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -68173,6 +74191,7 @@ func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextFirst(m map[str 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)) @@ -68190,6 +74209,7 @@ func UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext(m map[stri 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)) @@ -68207,6 +74227,7 @@ func UnmarshalReservedIPCollectionNext(m map[string]json.RawMessage, result inte 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)) @@ -68237,22 +74258,27 @@ func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext(m map[string]js obj := new(ReservedIPCollectionVirtualNetworkInterfaceContext) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst) if err != nil { + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "ips-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, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext) 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)) @@ -68265,8 +74291,11 @@ func (resp *ReservedIPCollectionVirtualNetworkInterfaceContext) GetNextStart() ( return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -68282,6 +74311,7 @@ func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextFirst(m map[stri 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)) @@ -68299,6 +74329,7 @@ func UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext(m map[strin 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)) @@ -68321,10 +74352,12 @@ func UnmarshalReservedIPPatch(m map[string]json.RawMessage, result interface{}) obj := new(ReservedIPPatch) 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)) @@ -68338,6 +74371,9 @@ func (reservedIPPatch *ReservedIPPatch) AsPatch() (_patch map[string]interface{} if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -68347,9 +74383,8 @@ type ReservedIPReference struct { // // If the address has not yet been selected, the value will be `0.0.0.0`. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` // If present, this property indicates the referenced resource has been deleted, and provides @@ -68380,26 +74415,32 @@ func UnmarshalReservedIPReference(m map[string]json.RawMessage, result interface obj := new(ReservedIPReference) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) 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)) @@ -68418,6 +74459,7 @@ func UnmarshalReservedIPReferenceDeleted(m map[string]json.RawMessage, result in obj := new(ReservedIPReferenceDeleted) 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)) @@ -68476,26 +74518,32 @@ func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) obj := new(ReservedIPTarget) 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, UnmarshalEndpointGatewayReferenceDeleted) 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)) @@ -68536,14 +74584,17 @@ func UnmarshalReservedIPTargetPrototype(m map[string]json.RawMessage, result int obj := new(ReservedIPTargetPrototype) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -68561,6 +74612,7 @@ func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) ( obj := new(ResourceFilter) 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)) @@ -68589,6 +74641,7 @@ func UnmarshalResourceGroupIdentity(m map[string]json.RawMessage, result interfa obj := new(ResourceGroupIdentity) 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)) @@ -68612,14 +74665,17 @@ func UnmarshalResourceGroupReference(m map[string]json.RawMessage, result interf obj := new(ResourceGroupReference) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -68698,9 +74754,8 @@ type Route struct { // - `service`: route was directly created by a service // - `user`: route was directly created by a user // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Origin *string `json:"origin,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -68750,9 +74805,8 @@ const ( // - `service`: route was directly created by a service // - `user`: route was directly created by a user // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( RouteOriginServiceConst = "service" RouteOriginUserConst = "user" @@ -68763,54 +74817,67 @@ func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error obj := new(Route) 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)) @@ -68841,22 +74908,27 @@ func UnmarshalRouteCollection(m map[string]json.RawMessage, result interface{}) 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)) @@ -68869,8 +74941,11 @@ func (resp *RouteCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -68886,6 +74961,7 @@ func UnmarshalRouteCollectionFirst(m map[string]json.RawMessage, result interfac 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)) @@ -68903,6 +74979,7 @@ func UnmarshalRouteCollectionNext(m map[string]json.RawMessage, result interface 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)) @@ -68933,22 +75010,27 @@ func UnmarshalRouteCollectionVPCContext(m map[string]json.RawMessage, result int 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)) @@ -68961,8 +75043,11 @@ func (resp *RouteCollectionVPCContext) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -68978,6 +75063,7 @@ func UnmarshalRouteCollectionVPCContextFirst(m map[string]json.RawMessage, resul 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)) @@ -68995,6 +75081,7 @@ func UnmarshalRouteCollectionVPCContextNext(m map[string]json.RawMessage, result 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)) @@ -69045,9 +75132,8 @@ type RouteCollectionVPCContextRoutesItem struct { // - `service`: route was directly created by a service // - `user`: route was directly created by a user // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Origin *string `json:"origin,omitempty"` // The priority of this route. Smaller values have higher priority. @@ -69097,9 +75183,8 @@ const ( // - `service`: route was directly created by a service // - `user`: route was directly created by a user // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. +// 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" @@ -69110,54 +75195,67 @@ func UnmarshalRouteCollectionVPCContextRoutesItem(m map[string]json.RawMessage, 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)) @@ -69210,26 +75308,32 @@ func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (er obj := new(RouteCreator) 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, UnmarshalVPNGatewayReferenceDeleted) 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)) @@ -69243,9 +75347,8 @@ func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (er type RouteNextHop struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` // If present, this property indicates the referenced resource has been deleted, and provides @@ -69284,26 +75387,32 @@ func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (er obj := new(RouteNextHop) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) 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)) @@ -69321,9 +75430,8 @@ func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (er type RouteNextHopPatch struct { // The sentinel IP address (`0.0.0.0`). // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` // The unique identifier for this VPN gateway connection. @@ -69346,14 +75454,17 @@ func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{} obj := new(RouteNextHopPatch) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -69395,18 +75506,22 @@ func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err obj := new(RoutePatch) err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) if err != nil { + err = core.SDKErrorf(err, "", "advertise-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, UnmarshalRouteNextHopPatch) if err != nil { + err = core.SDKErrorf(err, "", "next_hop-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) if err != nil { + err = core.SDKErrorf(err, "", "priority-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -69420,6 +75535,9 @@ func (routePatch *RoutePatch) AsPatch() (_patch map[string]interface{}, err erro if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -69494,6 +75612,9 @@ func (*VpcV1) NewRoutePrototype(destination string, zone ZoneIdentityIntf) (_mod Zone: zone, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -69502,30 +75623,37 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( obj := new(RoutePrototype) 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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-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, UnmarshalRoutePrototypeNextHop) if err != nil { + err = core.SDKErrorf(err, "", "next_hop-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, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -69543,9 +75671,8 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( type RoutePrototypeNextHop struct { // The sentinel IP address (`0.0.0.0`). // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` // The unique identifier for this VPN gateway connection. @@ -69568,14 +75695,17 @@ func UnmarshalRoutePrototypeNextHop(m map[string]json.RawMessage, result interfa obj := new(RoutePrototypeNextHop) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -69603,18 +75733,22 @@ func UnmarshalRouteReference(m map[string]json.RawMessage, result interface{}) ( obj := new(RouteReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRouteReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -69633,6 +75767,7 @@ func UnmarshalRouteReferenceDeleted(m map[string]json.RawMessage, result interfa obj := new(RouteReferenceDeleted) 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)) @@ -69643,16 +75778,15 @@ func UnmarshalRouteReferenceDeleted(m map[string]json.RawMessage, result interfa 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 `vpn_server` value is supported, but filter - // support is expected to expand in the future. + // 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. 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 // sources. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` // The date and time that this routing table was created. @@ -69754,62 +75888,77 @@ func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (er obj := new(RoutingTable) err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) if err != nil { + err = core.SDKErrorf(err, "", "accept_routes_from-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) if err != nil { + err = core.SDKErrorf(err, "", "advertise_routes_to-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, "is_default", &obj.IsDefault) if err != nil { + err = core.SDKErrorf(err, "", "is_default-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, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_direct_link_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_internet_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_transit_gateway_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_vpc_zone_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) if err != nil { + err = core.SDKErrorf(err, "", "routes-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -69840,22 +75989,27 @@ func UnmarshalRoutingTableCollection(m map[string]json.RawMessage, result interf obj := new(RoutingTableCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalRoutingTableCollectionFirst) 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, UnmarshalRoutingTableCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "routing_tables", &obj.RoutingTables, UnmarshalRoutingTable) if err != nil { + err = core.SDKErrorf(err, "", "routing_tables-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)) @@ -69868,8 +76022,11 @@ func (resp *RoutingTableCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -69885,6 +76042,7 @@ func UnmarshalRoutingTableCollectionFirst(m map[string]json.RawMessage, result i 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)) @@ -69902,6 +76060,7 @@ func UnmarshalRoutingTableCollectionNext(m map[string]json.RawMessage, result in 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)) @@ -69933,10 +76092,12 @@ func UnmarshalRoutingTableIdentity(m map[string]json.RawMessage, result interfac obj := new(RoutingTableIdentity) 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)) @@ -69949,9 +76110,6 @@ type RoutingTablePatch struct { // (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. - // - // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter - // support is expected to expand in the future. 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 @@ -70030,30 +76188,37 @@ func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{} obj := new(RoutingTablePatch) err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) if err != nil { + err = core.SDKErrorf(err, "", "accept_routes_from-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) if err != nil { + err = core.SDKErrorf(err, "", "advertise_routes_to-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, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_direct_link_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_internet_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_transit_gateway_ingress-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) if err != nil { + err = core.SDKErrorf(err, "", "route_vpc_zone_ingress-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -70067,6 +76232,9 @@ func (routingTablePatch *RoutingTablePatch) AsPatch() (_patch map[string]interfa if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -70100,22 +76268,27 @@ func UnmarshalRoutingTableReference(m map[string]json.RawMessage, result interfa obj := new(RoutingTableReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRoutingTableReferenceDeleted) 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)) @@ -70134,6 +76307,7 @@ func UnmarshalRoutingTableReferenceDeleted(m map[string]json.RawMessage, result obj := new(RoutingTableReferenceDeleted) 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)) @@ -70175,38 +76349,47 @@ func UnmarshalSecurityGroup(m map[string]json.RawMessage, result interface{}) (e obj := new(SecurityGroup) 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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) if err != nil { + err = core.SDKErrorf(err, "", "targets-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -70237,22 +76420,27 @@ func UnmarshalSecurityGroupCollection(m map[string]json.RawMessage, result inter obj := new(SecurityGroupCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSecurityGroupCollectionFirst) 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, UnmarshalSecurityGroupCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroup) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-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)) @@ -70265,8 +76453,11 @@ func (resp *SecurityGroupCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -70282,6 +76473,7 @@ func UnmarshalSecurityGroupCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -70299,6 +76491,7 @@ func UnmarshalSecurityGroupCollectionNext(m map[string]json.RawMessage, result i 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)) @@ -70334,14 +76527,17 @@ func UnmarshalSecurityGroupIdentity(m map[string]json.RawMessage, result interfa obj := new(SecurityGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -70359,6 +76555,7 @@ func UnmarshalSecurityGroupPatch(m map[string]json.RawMessage, result interface{ obj := new(SecurityGroupPatch) 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)) @@ -70372,6 +76569,9 @@ func (securityGroupPatch *SecurityGroupPatch) AsPatch() (_patch map[string]inter if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -70399,22 +76599,27 @@ func UnmarshalSecurityGroupReference(m map[string]json.RawMessage, result interf obj := new(SecurityGroupReference) 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, UnmarshalSecurityGroupReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -70433,6 +76638,7 @@ func UnmarshalSecurityGroupReferenceDeleted(m map[string]json.RawMessage, result obj := new(SecurityGroupReferenceDeleted) 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)) @@ -70454,11 +76660,18 @@ type SecurityGroupRule struct { // The unique identifier for this security group rule. ID *string `json:"id" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version" validate:"required"` + // The local IP address or range of local IP addresses to which this rule will allow inbound + // traffic (or from which, for outbound traffic). A CIDR block of `0.0.0.0/0` allows traffic + // to all local IP addresses (or from all local IP addresses, for outbound rules). + Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` + // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` @@ -70488,8 +76701,10 @@ const ( ) // Constants associated with the SecurityGroupRule.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRuleIPVersionIpv4Const = "ipv4" @@ -70518,23 +76733,37 @@ func UnmarshalSecurityGroupRule(m map[string]json.RawMessage, result interface{} var discValue string err = core.UnmarshalPrimitive(m, "protocol", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "all" { err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolAll-error", common.GetComponentInfo()) + } } else if discValue == "icmp" { err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolIcmp-error", common.GetComponentInfo()) + } } else if discValue == "tcp" { err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolTcpudp-error", common.GetComponentInfo()) + } } else if discValue == "udp" { err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolTcpudp-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -70550,6 +76779,146 @@ func UnmarshalSecurityGroupRuleCollection(m map[string]json.RawMessage, result i obj := new(SecurityGroupRuleCollection) err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleLocal : The local IP address or range of local IP addresses to which this rule will allow inbound traffic (or from which, for +// outbound traffic). A CIDR block of `0.0.0.0/0` allows traffic to all local IP addresses (or from all local IP +// addresses, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleLocalIP +// - SecurityGroupRuleLocalCIDR +type SecurityGroupRuleLocal struct { + // The IP address. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. + Address *string `json:"address,omitempty"` + + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. + CIDRBlock *string `json:"cidr_block,omitempty"` +} + +func (*SecurityGroupRuleLocal) isaSecurityGroupRuleLocal() bool { + return true +} + +type SecurityGroupRuleLocalIntf interface { + isaSecurityGroupRuleLocal() bool +} + +// UnmarshalSecurityGroupRuleLocal unmarshals an instance of SecurityGroupRuleLocal from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocal(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocal) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleLocalPatch : The local IP address or range of local IP addresses to which this rule will allow inbound traffic (or from which, for +// outbound traffic). Can be specified as an IP address or a CIDR block. +// +// Specify a CIDR block of `0.0.0.0/0` to allow traffic to all local IP addresses (or from all local IP addresses, for +// outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleLocalPatchIP +// - SecurityGroupRuleLocalPatchCIDR +type SecurityGroupRuleLocalPatch struct { + // The IP address. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. + Address *string `json:"address,omitempty"` + + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. + CIDRBlock *string `json:"cidr_block,omitempty"` +} + +func (*SecurityGroupRuleLocalPatch) isaSecurityGroupRuleLocalPatch() bool { + return true +} + +type SecurityGroupRuleLocalPatchIntf interface { + isaSecurityGroupRuleLocalPatch() bool +} + +// UnmarshalSecurityGroupRuleLocalPatch unmarshals an instance of SecurityGroupRuleLocalPatch from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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) +// +// If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP addresses (or from all +// local IP addresses, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleLocalPrototypeIP +// - SecurityGroupRuleLocalPrototypeCIDR +type SecurityGroupRuleLocalPrototype struct { + // The IP address. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. + Address *string `json:"address,omitempty"` + + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. + CIDRBlock *string `json:"cidr_block,omitempty"` +} + +func (*SecurityGroupRuleLocalPrototype) isaSecurityGroupRuleLocalPrototype() bool { + return true +} + +type SecurityGroupRuleLocalPrototypeIntf interface { + isaSecurityGroupRuleLocalPrototype() bool +} + +// UnmarshalSecurityGroupRuleLocalPrototype unmarshals an instance of SecurityGroupRuleLocalPrototype from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalPrototype) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -70566,11 +76935,21 @@ type SecurityGroupRulePatch struct { // The direction of traffic to enforce. Direction *string `json:"direction,omitempty"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` + // The local IP address or range of local IP addresses to which this rule will allow inbound + // traffic (or from which, for outbound traffic). Can be specified as an IP address or a CIDR + // block. + // + // Specify a CIDR block of `0.0.0.0/0` to allow traffic to all local IP addresses (or from all + // local IP addresses, for outbound rules). + Local SecurityGroupRuleLocalPatchIntf `json:"local,omitempty"` + // The inclusive upper bound of the protocol destination port range. If set, `port_min` must also be set, and must not // be larger. // @@ -70603,8 +76982,10 @@ const ( ) // Constants associated with the SecurityGroupRulePatch.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRulePatchIPVersionIpv4Const = "ipv4" @@ -70615,30 +76996,42 @@ func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interf obj := new(SecurityGroupRulePatch) err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPatch) + if err != nil { + err = core.SDKErrorf(err, "", "local-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 } err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePatch) if err != nil { + err = core.SDKErrorf(err, "", "remote-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)) @@ -70652,6 +77045,9 @@ func (securityGroupRulePatch *SecurityGroupRulePatch) AsPatch() (_patch map[stri if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -70664,11 +77060,20 @@ type SecurityGroupRulePrototype struct { // The direction of traffic to enforce. Direction *string `json:"direction" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` + // The local IP address or range of local IP addresses to which this rule will allow inbound + // traffic (or from which, for outbound traffic) + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP + // addresses (or from all local IP addresses, for outbound rules). + Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` + // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` @@ -70711,8 +77116,10 @@ const ( ) // Constants associated with the SecurityGroupRulePrototype.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRulePrototypeIPVersionIpv4Const = "ipv4" @@ -70741,23 +77148,37 @@ func UnmarshalSecurityGroupRulePrototype(m map[string]json.RawMessage, result in var discValue string err = core.UnmarshalPrimitive(m, "protocol", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", 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 { - err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -70772,14 +77193,14 @@ func UnmarshalSecurityGroupRulePrototype(m map[string]json.RawMessage, result in type SecurityGroupRuleRemote struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. CIDRBlock *string `json:"cidr_block,omitempty"` // The security group's CRN. @@ -70812,30 +77233,37 @@ func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result inter obj := new(SecurityGroupRuleRemote) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-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, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -70852,14 +77280,14 @@ func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result inter type SecurityGroupRuleRemotePatch struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. CIDRBlock *string `json:"cidr_block,omitempty"` // The unique identifier for this security group. @@ -70885,22 +77313,27 @@ func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result obj := new(SecurityGroupRuleRemotePatch) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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)) @@ -70919,14 +77352,14 @@ func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result type SecurityGroupRuleRemotePrototype struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. CIDRBlock *string `json:"cidr_block,omitempty"` // The unique identifier for this security group. @@ -70952,22 +77385,27 @@ func UnmarshalSecurityGroupRuleRemotePrototype(m map[string]json.RawMessage, res obj := new(SecurityGroupRuleRemotePrototype) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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)) @@ -70998,22 +77436,27 @@ func UnmarshalSecurityGroupTargetCollection(m map[string]json.RawMessage, result obj := new(SecurityGroupTargetCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSecurityGroupTargetCollectionFirst) 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, UnmarshalSecurityGroupTargetCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) if err != nil { + err = core.SDKErrorf(err, "", "targets-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)) @@ -71026,8 +77469,11 @@ func (resp *SecurityGroupTargetCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -71043,6 +77489,7 @@ func UnmarshalSecurityGroupTargetCollectionFirst(m map[string]json.RawMessage, r 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)) @@ -71060,15 +77507,17 @@ func UnmarshalSecurityGroupTargetCollectionNext(m map[string]json.RawMessage, re 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 : The resource types that can be security group targets are expected to expand in the future. When iterating over -// security group targets, do not assume that every target resource will be from a known set of resource types. -// Optionally halt processing and surface an error, or bypass resources of unrecognized types. +// SecurityGroupTargetReference : A target of this security group. +// +// 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: // - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext // - SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext @@ -71131,34 +77580,42 @@ func UnmarshalSecurityGroupTargetReference(m map[string]json.RawMessage, result obj := new(SecurityGroupTargetReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) 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 } err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -71211,9 +77668,8 @@ type Share struct { // target control access to the mount target. // - `vpc`: All clients in the VPC for a mount target have access to the mount target. // - // The enumerated access control mode values for this property may expand in the future. When processing this property, - // check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which - // the unexpected access control mode was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AccessControlMode *string `json:"access_control_mode" validate:"required"` // The date and time that the file share is created. @@ -71276,30 +77732,30 @@ type Share struct { // This property will be present when the `replication_role` is `replica`. ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` - // The replication role of the file share. + // The replication role of the file share: + // - `none`: This share is not participating in replication. + // - `replica`: This share is a replication target. + // - `source`: This share is a replication source. // - // * `none`: This share is not participating in replication. - // * `replica`: This share is a replication target. - // * `source`: This share is a replication source. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ReplicationRole *string `json:"replication_role" validate:"required"` - // The replication status of the file share. - // - // * `active`: This share is actively participating in replication, and the replica's data is up-to-date with the + // The replication status of the file share: + // - `active`: This share is actively participating in replication, and the replica's data is up-to-date with the // replication schedule. - // * `degraded`: This is share is participating in replication, but the replica's data has fallen behind the + // - `degraded`: This is share is participating in replication, but the replica's data has fallen behind the // replication schedule. - // * `failover_pending`: This share is performing a replication failover. - // * `initializing`: This share is initializing replication. - // * `none`: This share is not participating in replication. - // * `split_pending`: This share is performing a replication split. + // - `failover_pending`: This share is performing a replication failover. + // - `initializing`: This share is initializing replication. + // - `none`: This share is not participating in replication. + // - `split_pending`: This share is performing a replication split. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ReplicationStatus *string `json:"replication_status" validate:"required"` // The reasons for the current replication status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. ReplicationStatusReasons []ShareReplicationStatusReason `json:"replication_status_reasons" validate:"required"` // The resource group for this file share. @@ -71332,9 +77788,8 @@ type Share struct { // target control access to the mount target. // - `vpc`: All clients in the VPC for a mount target have access to the mount target. // -// The enumerated access control mode values for this property may expand in the future. When processing this property, -// check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which -// the unexpected access control mode was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareAccessControlModeSecurityGroupConst = "security_group" ShareAccessControlModeVPCConst = "vpc" @@ -71360,11 +77815,13 @@ const ( ) // Constants associated with the Share.ReplicationRole property. -// The replication role of the file share. +// The replication role of the file share: +// - `none`: This share is not participating in replication. +// - `replica`: This share is a replication target. +// - `source`: This share is a replication source. // -// * `none`: This share is not participating in replication. -// * `replica`: This share is a replication target. -// * `source`: This share is a replication source. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareReplicationRoleNoneConst = "none" ShareReplicationRoleReplicaConst = "replica" @@ -71372,16 +77829,18 @@ const ( ) // Constants associated with the Share.ReplicationStatus property. -// The replication status of the file share. -// -// * `active`: This share is actively participating in replication, and the replica's data is up-to-date with the +// The replication status of the file share: +// - `active`: This share is actively participating in replication, and the replica's data is up-to-date with the // replication schedule. -// * `degraded`: This is share is participating in replication, but the replica's data has fallen behind the replication +// - `degraded`: This is share is participating in replication, but the replica's data has fallen behind the replication // schedule. -// * `failover_pending`: This share is performing a replication failover. -// * `initializing`: This share is initializing replication. -// * `none`: This share is not participating in replication. -// * `split_pending`: This share is performing a replication split. +// - `failover_pending`: This share is performing a replication failover. +// - `initializing`: This share is initializing replication. +// - `none`: This share is not participating in replication. +// - `split_pending`: This share is performing a replication split. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareReplicationStatusActiveConst = "active" ShareReplicationStatusDegradedConst = "degraded" @@ -71402,102 +77861,127 @@ func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error obj := new(Share) err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { + err = core.SDKErrorf(err, "", "access_control_mode-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) if err != nil { + err = core.SDKErrorf(err, "", "encryption-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.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, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "latest_job", &obj.LatestJob, UnmarshalShareJob) if err != nil { + err = core.SDKErrorf(err, "", "latest_job-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "latest_sync", &obj.LatestSync, UnmarshalShareLatestSync) if err != nil { + err = core.SDKErrorf(err, "", "latest_sync-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.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetReference) if err != nil { + err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalShareReference) if err != nil { + err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { + err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "replication_role", &obj.ReplicationRole) if err != nil { + err = core.SDKErrorf(err, "", "replication_role-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "replication_status", &obj.ReplicationStatus) if err != nil { + err = core.SDKErrorf(err, "", "replication_status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "replication_status_reasons", &obj.ReplicationStatusReasons, UnmarshalShareReplicationStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "replication_status_reasons-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.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareReference) if err != nil { + err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-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)) @@ -71528,22 +78012,27 @@ func UnmarshalShareCollection(m map[string]json.RawMessage, result interface{}) obj := new(ShareCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareCollectionFirst) 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, UnmarshalShareCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "shares", &obj.Shares, UnmarshalShare) if err != nil { + err = core.SDKErrorf(err, "", "shares-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)) @@ -71556,8 +78045,11 @@ func (resp *ShareCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -71573,6 +78065,7 @@ func UnmarshalShareCollectionFirst(m map[string]json.RawMessage, result interfac 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)) @@ -71590,6 +78083,7 @@ func UnmarshalShareCollectionNext(m map[string]json.RawMessage, result interface 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)) @@ -71625,14 +78119,17 @@ func UnmarshalShareIdentity(m map[string]json.RawMessage, result interface{}) (e obj := new(ShareIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -71653,10 +78150,12 @@ func UnmarshalShareInitialOwner(m map[string]json.RawMessage, result interface{} obj := new(ShareInitialOwner) err = core.UnmarshalPrimitive(m, "gid", &obj.Gid) if err != nil { + err = core.SDKErrorf(err, "", "gid-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uid", &obj.Uid) if err != nil { + err = core.SDKErrorf(err, "", "uid-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -71665,50 +78164,40 @@ func UnmarshalShareInitialOwner(m map[string]json.RawMessage, result interface{} // ShareJob : ShareJob struct type ShareJob struct { - // The status of the file share job. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the - // unexpected property value was encountered. - // - // * `cancelled`: This job has been cancelled. - // * `failed`: This job has failed. - // * `queued`: This job is queued. - // * `running`: This job is running. - // * `succeeded`: This job completed successfully. + // The status of the file share job: + // - `cancelled`: This job has been cancelled. + // - `failed`: This job has failed. + // - `queued`: This job is queued. + // - `running`: This job is running. + // - `succeeded`: This job completed successfully. + // + // 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 file share job status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []ShareJobStatusReason `json:"status_reasons" validate:"required"` - // The type of the file share job. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the - // unexpected property value was encountered. + // The type of the file share job: + // - `replication_failover`: This is a share replication failover job. + // - `replication_init`: This is a share replication is initialization job. + // - `replication_split`: This is a share replication split job. // - // * `replication_failover`: This is a share replication failover job. - // * `replication_init`: This is a share replication is initialization job. - // * `replication_split`: This is a share replication split job. + // 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"` } // Constants associated with the ShareJob.Status property. -// The status of the file share job. +// The status of the file share job: +// - `cancelled`: This job has been cancelled. +// - `failed`: This job has failed. +// - `queued`: This job is queued. +// - `running`: This job is running. +// - `succeeded`: This job completed successfully. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the -// unexpected property value was encountered. -// -// * `cancelled`: This job has been cancelled. -// * `failed`: This job has failed. -// * `queued`: This job is queued. -// * `running`: This job is running. -// * `succeeded`: This job completed successfully. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareJobStatusCancelledConst = "cancelled" ShareJobStatusFailedConst = "failed" @@ -71718,15 +78207,13 @@ const ( ) // Constants associated with the ShareJob.Type property. -// The type of the file share job. -// -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the file share job on which the -// unexpected property value was encountered. +// The type of the file share job: +// - `replication_failover`: This is a share replication failover job. +// - `replication_init`: This is a share replication is initialization job. +// - `replication_split`: This is a share replication split job. // -// * `replication_failover`: This is a share replication failover job. -// * `replication_init`: This is a share replication is initialization job. -// * `replication_split`: This is a share replication split job. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareJobTypeReplicationFailoverConst = "replication_failover" ShareJobTypeReplicationInitConst = "replication_init" @@ -71738,14 +78225,17 @@ func UnmarshalShareJob(m map[string]json.RawMessage, result interface{}) (err er obj := new(ShareJob) 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, UnmarshalShareJobStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-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)) @@ -71755,6 +78245,9 @@ func UnmarshalShareJob(m map[string]json.RawMessage, result interface{}) (err er // ShareJobStatusReason : ShareJobStatusReason struct type ShareJobStatusReason struct { // A snake case string succinctly identifying the status reason. + // + // 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. @@ -71766,6 +78259,9 @@ type ShareJobStatusReason struct { // Constants associated with the ShareJobStatusReason.Code property. // A snake case string succinctly identifying the status reason. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareJobStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication" ShareJobStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share" @@ -71777,14 +78273,17 @@ func UnmarshalShareJobStatusReason(m map[string]json.RawMessage, result interfac obj := new(ShareJobStatusReason) 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)) @@ -71811,14 +78310,17 @@ func UnmarshalShareLatestSync(m map[string]json.RawMessage, result interface{}) obj := new(ShareLatestSync) 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, "data_transferred", &obj.DataTransferred) if err != nil { + err = core.SDKErrorf(err, "", "data_transferred-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) if err != nil { + err = core.SDKErrorf(err, "", "started_at-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -71833,9 +78335,8 @@ type ShareMountTarget struct { // target control access to the mount target. // - `vpc`: All clients in the VPC for a mount target have access to the mount target. // - // The enumerated access control mode values for this property may expand in the future. When processing this property, - // check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which - // the unexpected access control mode was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AccessControlMode *string `json:"access_control_mode" validate:"required"` // The date and time that the share mount target was created. @@ -71884,9 +78385,8 @@ type ShareMountTarget struct { // - `none`: Not encrypted in transit // - `user_managed`: Encrypted in transit using an instance identity certificate // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected - // property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. TransitEncryption *string `json:"transit_encryption" validate:"required"` // The virtual network interface for this file share mount target. @@ -71910,9 +78410,8 @@ type ShareMountTarget struct { // target control access to the mount target. // - `vpc`: All clients in the VPC for a mount target have access to the mount target. // -// The enumerated access control mode values for this property may expand in the future. When processing this property, -// check for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which -// the unexpected access control mode was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareMountTargetAccessControlModeSecurityGroupConst = "security_group" ShareMountTargetAccessControlModeVPCConst = "vpc" @@ -71941,9 +78440,8 @@ const ( // - `none`: Not encrypted in transit // - `user_managed`: Encrypted in transit using an instance identity certificate // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the resource on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareMountTargetTransitEncryptionNoneConst = "none" ShareMountTargetTransitEncryptionUserManagedConst = "user_managed" @@ -71954,54 +78452,67 @@ func UnmarshalShareMountTarget(m map[string]json.RawMessage, result interface{}) obj := new(ShareMountTarget) err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { + err = core.SDKErrorf(err, "", "access_control_mode-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, "lifecycle_state", &obj.LifecycleState) if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mount_path", &obj.MountPath) if err != nil { + err = core.SDKErrorf(err, "", "mount_path-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) 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, "", "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.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) if err != nil { + err = core.SDKErrorf(err, "", "transit_encryption-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 } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -72032,22 +78543,27 @@ func UnmarshalShareMountTargetCollection(m map[string]json.RawMessage, result in obj := new(ShareMountTargetCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareMountTargetCollectionFirst) 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, "mount_targets", &obj.MountTargets, UnmarshalShareMountTarget) if err != nil { + err = core.SDKErrorf(err, "", "mount_targets-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareMountTargetCollectionNext) 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)) @@ -72060,8 +78576,11 @@ func (resp *ShareMountTargetCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -72077,6 +78596,7 @@ func UnmarshalShareMountTargetCollectionFirst(m map[string]json.RawMessage, resu 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)) @@ -72094,6 +78614,7 @@ func UnmarshalShareMountTargetCollectionNext(m map[string]json.RawMessage, resul 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)) @@ -72111,6 +78632,7 @@ func UnmarshalShareMountTargetPatch(m map[string]json.RawMessage, result interfa obj := new(ShareMountTargetPatch) 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)) @@ -72124,6 +78646,9 @@ func (shareMountTargetPatch *ShareMountTargetPatch) AsPatch() (_patch map[string if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -72170,18 +78695,22 @@ func UnmarshalShareMountTargetPrototype(m map[string]json.RawMessage, result int obj := new(ShareMountTargetPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) if err != nil { + err = core.SDKErrorf(err, "", "transit_encryption-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -72218,22 +78747,27 @@ func UnmarshalShareMountTargetReference(m map[string]json.RawMessage, result int obj := new(ShareMountTargetReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) 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)) @@ -72252,6 +78786,7 @@ func UnmarshalShareMountTargetReferenceDeleted(m map[string]json.RawMessage, res obj := new(ShareMountTargetReferenceDeleted) 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)) @@ -72345,50 +78880,62 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json obj := new(ShareMountTargetVirtualNetworkInterfacePrototype) 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 } 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.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) 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()) 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)) @@ -72459,30 +79006,37 @@ func UnmarshalSharePatch(m map[string]json.RawMessage, result interface{}) (err obj := new(SharePatch) err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { + err = core.SDKErrorf(err, "", "access_control_mode-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { + err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -72496,6 +79050,9 @@ func (sharePatch *SharePatch) AsPatch() (_patch map[string]interface{}, err erro if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -72537,26 +79094,32 @@ func UnmarshalShareProfile(m map[string]json.RawMessage, result interface{}) (er obj := new(ShareProfile) err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalShareProfileCapacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-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.UnmarshalModel(m, "iops", &obj.Iops, UnmarshalShareProfileIops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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)) @@ -72611,30 +79174,37 @@ func UnmarshalShareProfileCapacity(m map[string]json.RawMessage, result interfac obj := new(ShareProfileCapacity) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -72665,22 +79235,27 @@ func UnmarshalShareProfileCollection(m map[string]json.RawMessage, result interf obj := new(ShareProfileCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareProfileCollectionFirst) 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, UnmarshalShareProfileCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalShareProfile) 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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -72693,8 +79268,11 @@ func (resp *ShareProfileCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -72710,6 +79288,7 @@ func UnmarshalShareProfileCollectionFirst(m map[string]json.RawMessage, result i 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)) @@ -72727,6 +79306,7 @@ func UnmarshalShareProfileCollectionNext(m map[string]json.RawMessage, result in 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)) @@ -72781,30 +79361,37 @@ func UnmarshalShareProfileIops(m map[string]json.RawMessage, result interface{}) obj := new(ShareProfileIops) 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, "", "values-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -72836,10 +79423,12 @@ func UnmarshalShareProfileIdentity(m map[string]json.RawMessage, result interfac obj := new(ShareProfileIdentity) 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)) @@ -72869,14 +79458,17 @@ func UnmarshalShareProfileReference(m map[string]json.RawMessage, result interfa obj := new(ShareProfileReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -72986,58 +79578,72 @@ func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) ( obj := new(SharePrototype) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) if err != nil { + err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { + err = core.SDKErrorf(err, "", "access_control_mode-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, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) if err != nil { + err = core.SDKErrorf(err, "", "initial_owner-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.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { + err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73093,6 +79699,9 @@ func (*VpcV1) NewSharePrototypeShareContext(profile ShareProfileIdentityIntf, re Zone: zone, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -73101,34 +79710,42 @@ func UnmarshalSharePrototypeShareContext(m map[string]json.RawMessage, result in obj := new(SharePrototypeShareContext) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { + err = core.SDKErrorf(err, "", "replication_cron_spec-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73172,30 +79789,37 @@ func UnmarshalShareReference(m map[string]json.RawMessage, result interface{}) ( obj := new(ShareReference) 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, UnmarshalShareReferenceDeleted) 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, UnmarshalShareRemote) 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)) @@ -73214,6 +79838,7 @@ func UnmarshalShareReferenceDeleted(m map[string]json.RawMessage, result interfa obj := new(ShareReferenceDeleted) 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)) @@ -73233,6 +79858,7 @@ func UnmarshalShareRemote(m map[string]json.RawMessage, result interface{}) (err obj := new(ShareRemote) 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)) @@ -73242,6 +79868,9 @@ func UnmarshalShareRemote(m map[string]json.RawMessage, result interface{}) (err // ShareReplicationStatusReason : ShareReplicationStatusReason struct type ShareReplicationStatusReason struct { // A snake case string succinctly identifying the status reason. + // + // 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. @@ -73253,6 +79882,9 @@ type ShareReplicationStatusReason struct { // Constants associated with the ShareReplicationStatusReason.Code property. // A snake case string succinctly identifying the status reason. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareReplicationStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication" ShareReplicationStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share" @@ -73264,14 +79896,17 @@ func UnmarshalShareReplicationStatusReason(m map[string]json.RawMessage, result obj := new(ShareReplicationStatusReason) 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)) @@ -73397,102 +80032,127 @@ func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err er obj := new(Snapshot) 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, "bootable", &obj.Bootable) if err != nil { + err = core.SDKErrorf(err, "", "bootable-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "captured_at", &obj.CapturedAt) if err != nil { + err = core.SDKErrorf(err, "", "captured_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) if err != nil { + err = core.SDKErrorf(err, "", "clones-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "copies", &obj.Copies, UnmarshalSnapshotCopiesItem) if err != nil { + err = core.SDKErrorf(err, "", "copies-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "deletable", &obj.Deletable) if err != nil { + err = core.SDKErrorf(err, "", "deletable-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) if err != nil { + err = core.SDKErrorf(err, "", "encryption-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.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, "minimum_capacity", &obj.MinimumCapacity) if err != nil { + err = core.SDKErrorf(err, "", "minimum_capacity-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, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) if err != nil { + err = core.SDKErrorf(err, "", "operating_system-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.UnmarshalPrimitive(m, "service_tags", &obj.ServiceTags) if err != nil { + err = core.SDKErrorf(err, "", "service_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "snapshot_consistency_group", &obj.SnapshotConsistencyGroup, UnmarshalSnapshotConsistencyGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "snapshot_consistency_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_image", &obj.SourceImage, UnmarshalImageReference) if err != nil { + err = core.SDKErrorf(err, "", "source_image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotSourceSnapshot) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) if err != nil { + err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73516,14 +80176,17 @@ func UnmarshalSnapshotClone(m map[string]json.RawMessage, result interface{}) (e obj := new(SnapshotClone) err = core.UnmarshalPrimitive(m, "available", &obj.Available) if err != nil { + err = core.SDKErrorf(err, "", "available-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, "zone", &obj.Zone, UnmarshalZoneReference) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73541,6 +80204,7 @@ func UnmarshalSnapshotCloneCollection(m map[string]json.RawMessage, result inter obj := new(SnapshotCloneCollection) err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) if err != nil { + err = core.SDKErrorf(err, "", "clones-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73560,6 +80224,9 @@ func (*VpcV1) NewSnapshotClonePrototype(zone ZoneIdentityIntf) (_model *Snapshot Zone: zone, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -73568,6 +80235,7 @@ func UnmarshalSnapshotClonePrototype(m map[string]json.RawMessage, result interf obj := new(SnapshotClonePrototype) err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73598,22 +80266,27 @@ func UnmarshalSnapshotCollection(m map[string]json.RawMessage, result interface{ obj := new(SnapshotCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSnapshotCollectionFirst) 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, UnmarshalSnapshotCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshot) if err != nil { + err = core.SDKErrorf(err, "", "snapshots-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)) @@ -73626,8 +80299,11 @@ func (resp *SnapshotCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -73643,6 +80319,7 @@ func UnmarshalSnapshotCollectionFirst(m map[string]json.RawMessage, result inter 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)) @@ -73660,6 +80337,7 @@ func UnmarshalSnapshotCollectionNext(m map[string]json.RawMessage, result interf 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)) @@ -73732,50 +80410,62 @@ func UnmarshalSnapshotConsistencyGroup(m map[string]json.RawMessage, result inte obj := new(SnapshotConsistencyGroup) 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, "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.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_snapshots_on_delete-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, "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.UnmarshalPrimitive(m, "service_tags", &obj.ServiceTags) if err != nil { + err = core.SDKErrorf(err, "", "service_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotReference) if err != nil { + err = core.SDKErrorf(err, "", "snapshots-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73806,22 +80496,27 @@ func UnmarshalSnapshotConsistencyGroupCollection(m map[string]json.RawMessage, r obj := new(SnapshotConsistencyGroupCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSnapshotConsistencyGroupCollectionFirst) 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, UnmarshalSnapshotConsistencyGroupCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "snapshot_consistency_groups", &obj.SnapshotConsistencyGroups, UnmarshalSnapshotConsistencyGroup) if err != nil { + err = core.SDKErrorf(err, "", "snapshot_consistency_groups-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)) @@ -73834,8 +80529,11 @@ func (resp *SnapshotConsistencyGroupCollection) GetNextStart() (*string, error) return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -73851,6 +80549,7 @@ func UnmarshalSnapshotConsistencyGroupCollectionFirst(m map[string]json.RawMessa 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)) @@ -73868,6 +80567,7 @@ func UnmarshalSnapshotConsistencyGroupCollectionNext(m map[string]json.RawMessag 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)) @@ -73889,10 +80589,12 @@ func UnmarshalSnapshotConsistencyGroupPatch(m map[string]json.RawMessage, result obj := new(SnapshotConsistencyGroupPatch) err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_snapshots_on_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)) @@ -73906,6 +80608,9 @@ func (snapshotConsistencyGroupPatch *SnapshotConsistencyGroupPatch) AsPatch() (_ if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -73944,18 +80649,22 @@ func UnmarshalSnapshotConsistencyGroupPrototype(m map[string]json.RawMessage, re obj := new(SnapshotConsistencyGroupPrototype) err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_snapshots_on_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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext) if err != nil { + err = core.SDKErrorf(err, "", "snapshots-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -73996,26 +80705,32 @@ func UnmarshalSnapshotConsistencyGroupReference(m map[string]json.RawMessage, re obj := new(SnapshotConsistencyGroupReference) 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, UnmarshalSnapshotConsistencyGroupReferenceDeleted) 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)) @@ -74034,6 +80749,7 @@ func UnmarshalSnapshotConsistencyGroupReferenceDeleted(m map[string]json.RawMess obj := new(SnapshotConsistencyGroupReferenceDeleted) 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)) @@ -74077,30 +80793,37 @@ func UnmarshalSnapshotCopiesItem(m map[string]json.RawMessage, result interface{ obj := new(SnapshotCopiesItem) 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, UnmarshalSnapshotReferenceDeleted) 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, UnmarshalSnapshotRemote) 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)) @@ -74136,14 +80859,17 @@ func UnmarshalSnapshotIdentity(m map[string]json.RawMessage, result interface{}) obj := new(SnapshotIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -74164,10 +80890,12 @@ func UnmarshalSnapshotPatch(m map[string]json.RawMessage, result interface{}) (e obj := new(SnapshotPatch) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -74181,6 +80909,9 @@ func (snapshotPatch *SnapshotPatch) AsPatch() (_patch map[string]interface{}, er if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -74235,30 +80966,37 @@ func UnmarshalSnapshotPrototype(m map[string]json.RawMessage, result interface{} obj := new(SnapshotPrototype) err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) if err != nil { + err = core.SDKErrorf(err, "", "clones-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_volume-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -74284,6 +81022,9 @@ func (*VpcV1) NewSnapshotPrototypeSnapshotConsistencyGroupContext(sourceVolume V SourceVolume: sourceVolume, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -74292,14 +81033,17 @@ func UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext(m map[string]json obj := new(SnapshotPrototypeSnapshotConsistencyGroupContext) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -74343,30 +81087,37 @@ func UnmarshalSnapshotReference(m map[string]json.RawMessage, result interface{} obj := new(SnapshotReference) 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, UnmarshalSnapshotReferenceDeleted) 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, UnmarshalSnapshotRemote) 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)) @@ -74385,6 +81136,7 @@ func UnmarshalSnapshotReferenceDeleted(m map[string]json.RawMessage, result inte obj := new(SnapshotReferenceDeleted) 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)) @@ -74404,6 +81156,7 @@ func UnmarshalSnapshotRemote(m map[string]json.RawMessage, result interface{}) ( obj := new(SnapshotRemote) 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)) @@ -74447,30 +81200,37 @@ func UnmarshalSnapshotSourceSnapshot(m map[string]json.RawMessage, result interf obj := new(SnapshotSourceSnapshot) 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, UnmarshalSnapshotReferenceDeleted) 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, UnmarshalSnapshotRemote) 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)) @@ -74638,70 +81398,87 @@ func UnmarshalSubnet(m map[string]json.RawMessage, result interface{}) (err erro obj := new(Subnet) err = core.UnmarshalPrimitive(m, "available_ipv4_address_count", &obj.AvailableIpv4AddressCount) if err != nil { + err = core.SDKErrorf(err, "", "available_ipv4_address_count-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-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 } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLReference) if err != nil { + err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayReference) if err != nil { + err = core.SDKErrorf(err, "", "public_gateway-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, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableReference) if err != nil { + err = core.SDKErrorf(err, "", "routing_table-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.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) if err != nil { + err = core.SDKErrorf(err, "", "total_ipv4_address_count-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)) @@ -74732,22 +81509,27 @@ func UnmarshalSubnetCollection(m map[string]json.RawMessage, result interface{}) obj := new(SubnetCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSubnetCollectionFirst) 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, UnmarshalSubnetCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnet) 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)) @@ -74760,8 +81542,11 @@ func (resp *SubnetCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -74777,6 +81562,7 @@ func UnmarshalSubnetCollectionFirst(m map[string]json.RawMessage, result interfa 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)) @@ -74794,6 +81580,7 @@ func UnmarshalSubnetCollectionNext(m map[string]json.RawMessage, result interfac 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)) @@ -74829,14 +81616,17 @@ func UnmarshalSubnetIdentity(m map[string]json.RawMessage, result interface{}) ( obj := new(SubnetIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -74865,18 +81655,22 @@ func UnmarshalSubnetPatch(m map[string]json.RawMessage, result interface{}) (err obj := new(SubnetPatch) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) if err != nil { + err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalSubnetPublicGatewayPatch) if err != nil { + err = core.SDKErrorf(err, "", "public_gateway-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) if err != nil { + err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -74890,6 +81684,9 @@ func (subnetPatch *SubnetPatch) AsPatch() (_patch map[string]interface{}, err er if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -74959,42 +81756,52 @@ func UnmarshalSubnetPrototype(m map[string]json.RawMessage, result interface{}) obj := new(SubnetPrototype) 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.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) if err != nil { + err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) if err != nil { + err = core.SDKErrorf(err, "", "public_gateway-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, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) if err != nil { + err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-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 } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-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)) @@ -75030,14 +81837,17 @@ func UnmarshalSubnetPublicGatewayPatch(m map[string]json.RawMessage, result inte obj := new(SubnetPublicGatewayPatch) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -75077,26 +81887,32 @@ func UnmarshalSubnetReference(m map[string]json.RawMessage, result interface{}) obj := new(SubnetReference) 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, UnmarshalSubnetReferenceDeleted) 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)) @@ -75115,6 +81931,7 @@ func UnmarshalSubnetReferenceDeleted(m map[string]json.RawMessage, result interf obj := new(SubnetReferenceDeleted) 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)) @@ -75146,10 +81963,12 @@ func UnmarshalTrustedProfileIdentity(m map[string]json.RawMessage, result interf obj := new(TrustedProfileIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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)) @@ -75179,14 +81998,17 @@ func UnmarshalTrustedProfileReference(m map[string]json.RawMessage, result inter obj := new(TrustedProfileReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -77960,14 +84782,17 @@ func UnmarshalVcpu(m map[string]json.RawMessage, result interface{}) (err error) obj := new(Vcpu) err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) if err != nil { + err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "count", &obj.Count) if err != nil { + err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) if err != nil { + err = core.SDKErrorf(err, "", "manufacturer-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78006,19 +84831,15 @@ type VPC struct { Dns *Vpcdns `json:"dns" validate:"required"` // The reasons for the current `health_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. HealthReasons []VPCHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 VPC. @@ -78041,13 +84862,13 @@ type VPC struct { } // Constants associated with the VPC.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. +// 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 ( VPCHealthStateDegradedConst = "degraded" VPCHealthStateFaultedConst = "faulted" @@ -78075,66 +84896,82 @@ func UnmarshalVPC(m map[string]json.RawMessage, result interface{}) (err error) obj := new(VPC) err = core.UnmarshalPrimitive(m, "classic_access", &obj.ClassicAccess) if err != nil { + err = core.SDKErrorf(err, "", "classic_access-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "cse_source_ips", &obj.CseSourceIps, UnmarshalVpccseSourceIP) if err != nil { + err = core.SDKErrorf(err, "", "cse_source_ips-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_network_acl", &obj.DefaultNetworkACL, UnmarshalNetworkACLReference) if err != nil { + err = core.SDKErrorf(err, "", "default_network_acl-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_routing_table", &obj.DefaultRoutingTable, UnmarshalRoutingTableReference) if err != nil { + err = core.SDKErrorf(err, "", "default_routing_table-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_security_group", &obj.DefaultSecurityGroup, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "default_security_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdns) if err != nil { + err = core.SDKErrorf(err, "", "dns-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPCHealthReason) 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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78155,10 +84992,12 @@ func UnmarshalVpccseSourceIP(m map[string]json.RawMessage, result interface{}) ( obj := new(VpccseSourceIP) err = core.UnmarshalModel(m, "ip", &obj.IP, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "ip-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)) @@ -78189,22 +85028,27 @@ func UnmarshalVPCCollection(m map[string]json.RawMessage, result interface{}) (e obj := new(VPCCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPCCollectionFirst) 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, UnmarshalVPCCollectionNext) 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 } err = core.UnmarshalModel(m, "vpcs", &obj.Vpcs, UnmarshalVPC) if err != nil { + err = core.SDKErrorf(err, "", "vpcs-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78217,8 +85061,11 @@ func (resp *VPCCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -78234,6 +85081,7 @@ func UnmarshalVPCCollectionFirst(m map[string]json.RawMessage, result interface{ 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)) @@ -78251,6 +85099,7 @@ func UnmarshalVPCCollectionNext(m map[string]json.RawMessage, result interface{} 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)) @@ -78274,14 +85123,17 @@ func UnmarshalVpcdns(m map[string]json.RawMessage, result interface{}) (err erro obj := new(Vpcdns) err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) if err != nil { + err = core.SDKErrorf(err, "", "enable_hub-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "resolution_binding_count", &obj.ResolutionBindingCount) if err != nil { + err = core.SDKErrorf(err, "", "resolution_binding_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolver) if err != nil { + err = core.SDKErrorf(err, "", "resolver-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78306,10 +85158,12 @@ func UnmarshalVpcdnsPatch(m map[string]json.RawMessage, result interface{}) (err obj := new(VpcdnsPatch) err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) if err != nil { + err = core.SDKErrorf(err, "", "enable_hub-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPatch) if err != nil { + err = core.SDKErrorf(err, "", "resolver-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78332,10 +85186,12 @@ func UnmarshalVpcdnsPrototype(m map[string]json.RawMessage, result interface{}) obj := new(VpcdnsPrototype) err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) if err != nil { + err = core.SDKErrorf(err, "", "enable_hub-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPrototype) if err != nil { + err = core.SDKErrorf(err, "", "resolver-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78353,6 +85209,18 @@ type VpcdnsResolutionBinding struct { // The endpoint gateways may be remote and therefore may not be directly retrievable. EndpointGateways []EndpointGatewayReferenceRemote `json:"endpoint_gateways" validate:"required"` + // The reasons for the current `health_state` (if any). + HealthReasons []VpcdnsResolutionBindingHealthReason `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 DNS resolution binding. Href *string `json:"href" validate:"required"` @@ -78374,6 +85242,21 @@ type VpcdnsResolutionBinding struct { VPC *VPCReferenceRemote `json:"vpc" validate:"required"` } +// Constants associated with the VpcdnsResolutionBinding.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 ( + VpcdnsResolutionBindingHealthStateDegradedConst = "degraded" + VpcdnsResolutionBindingHealthStateFaultedConst = "faulted" + VpcdnsResolutionBindingHealthStateInapplicableConst = "inapplicable" + VpcdnsResolutionBindingHealthStateOkConst = "ok" +) + // Constants associated with the VpcdnsResolutionBinding.LifecycleState property. // The lifecycle state of the DNS resolution binding. const ( @@ -78397,34 +85280,52 @@ func UnmarshalVpcdnsResolutionBinding(m map[string]json.RawMessage, result inter obj := new(VpcdnsResolutionBinding) 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, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGatewayReferenceRemote) if err != nil { + err = core.SDKErrorf(err, "", "endpoint_gateways-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVpcdnsResolutionBindingHealthReason) + 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, "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.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceRemote) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78455,22 +85356,27 @@ func UnmarshalVpcdnsResolutionBindingCollection(m map[string]json.RawMessage, re obj := new(VpcdnsResolutionBindingCollection) err = core.UnmarshalModel(m, "dns_resolution_bindings", &obj.DnsResolutionBindings, UnmarshalVpcdnsResolutionBinding) if err != nil { + err = core.SDKErrorf(err, "", "dns_resolution_bindings-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVpcdnsResolutionBindingCollectionFirst) 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, UnmarshalVpcdnsResolutionBindingCollectionNext) 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)) @@ -78483,12 +85389,56 @@ func (resp *VpcdnsResolutionBindingCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } +// VpcdnsResolutionBindingHealthReason : VpcdnsResolutionBindingHealthReason struct +type VpcdnsResolutionBindingHealthReason 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"` +} + +// Constants associated with the VpcdnsResolutionBindingHealthReason.Code property. +// A reason code for this health state. +const ( + VpcdnsResolutionBindingHealthReasonCodeDisconnectedFromBoundVPCConst = "disconnected_from_bound_vpc" + VpcdnsResolutionBindingHealthReasonCodeInternalErrorConst = "internal_error" +) + +// UnmarshalVpcdnsResolutionBindingHealthReason unmarshals an instance of VpcdnsResolutionBindingHealthReason from the specified map of raw messages. +func UnmarshalVpcdnsResolutionBindingHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpcdnsResolutionBindingHealthReason) + 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 +} + // VpcdnsResolutionBindingPatch : VpcdnsResolutionBindingPatch struct type VpcdnsResolutionBindingPatch struct { // The name for this DNS resolution binding. The name must not be used by another DNS resolution binding for the VPC. @@ -78500,6 +85450,7 @@ func UnmarshalVpcdnsResolutionBindingPatch(m map[string]json.RawMessage, result obj := new(VpcdnsResolutionBindingPatch) 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)) @@ -78513,6 +85464,9 @@ func (vpcdnsResolutionBindingPatch *VpcdnsResolutionBindingPatch) AsPatch() (_pa if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -78624,22 +85578,27 @@ func UnmarshalVpcdnsResolver(m map[string]json.RawMessage, result interface{}) ( obj := new(VpcdnsResolver) err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) if err != nil { + err = core.SDKErrorf(err, "", "servers-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.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer) if err != nil { + err = core.SDKErrorf(err, "", "manual_servers-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration) if err != nil { + err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78718,14 +85677,17 @@ func UnmarshalVpcdnsResolverPatch(m map[string]json.RawMessage, result interface obj := new(VpcdnsResolverPatch) err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manual_servers-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.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVpcdnsResolverVPCPatch) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78783,10 +85745,12 @@ func UnmarshalVpcdnsResolverPrototype(m map[string]json.RawMessage, result inter obj := new(VpcdnsResolverPrototype) err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manual_servers-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78828,14 +85792,17 @@ func UnmarshalVpcdnsResolverVPCPatch(m map[string]json.RawMessage, result interf obj := new(VpcdnsResolverVPCPatch) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78844,7 +85811,7 @@ func UnmarshalVpcdnsResolverVPCPatch(m map[string]json.RawMessage, result interf // VPCHealthReason : VPCHealthReason struct type VPCHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state. Code *string `json:"code" validate:"required"` // An explanation of the reason for this health state. @@ -78855,7 +85822,7 @@ type VPCHealthReason struct { } // Constants associated with the VPCHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state. const ( VPCHealthReasonCodeDnsResolutionBindingFailedConst = "dns_resolution_binding_failed" VPCHealthReasonCodeInternalErrorConst = "internal_error" @@ -78866,14 +85833,17 @@ func UnmarshalVPCHealthReason(m map[string]json.RawMessage, result interface{}) obj := new(VPCHealthReason) 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)) @@ -78909,14 +85879,17 @@ func UnmarshalVPCIdentity(m map[string]json.RawMessage, result interface{}) (err obj := new(VPCIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78937,10 +85910,12 @@ func UnmarshalVPCPatch(m map[string]json.RawMessage, result interface{}) (err er obj := new(VPCPatch) err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdnsPatch) if err != nil { + err = core.SDKErrorf(err, "", "dns-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)) @@ -78954,6 +85929,9 @@ func (vpcPatch *VPCPatch) AsPatch() (_patch map[string]interface{}, err error) { if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -78990,26 +85968,32 @@ func UnmarshalVPCReference(m map[string]json.RawMessage, result interface{}) (er obj := new(VPCReference) 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, UnmarshalVPCReferenceDeleted) 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)) @@ -79055,30 +86039,37 @@ func UnmarshalVPCReferenceDnsResolverContext(m map[string]json.RawMessage, resul obj := new(VPCReferenceDnsResolverContext) 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, UnmarshalVPCReferenceDnsResolverContextDeleted) 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, UnmarshalVPCRemote) 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)) @@ -79097,6 +86088,7 @@ func UnmarshalVPCReferenceDeleted(m map[string]json.RawMessage, result interface obj := new(VPCReferenceDeleted) 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)) @@ -79115,6 +86107,7 @@ func UnmarshalVPCReferenceDnsResolverContextDeleted(m map[string]json.RawMessage obj := new(VPCReferenceDnsResolverContextDeleted) 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)) @@ -79154,26 +86147,32 @@ func UnmarshalVPCReferenceRemote(m map[string]json.RawMessage, result interface{ obj := new(VPCReferenceRemote) 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) 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, UnmarshalVPCRemote) 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)) @@ -79197,10 +86196,12 @@ func UnmarshalVPCRemote(m map[string]json.RawMessage, result interface{}) (err e obj := new(VPCRemote) err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) if err != nil { + err = core.SDKErrorf(err, "", "account-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)) @@ -79221,24 +86222,16 @@ type VPNGateway struct { // The VPN gateway's CRN. CRN *string `json:"crn" validate:"required"` - // The reasons for the current VPN gateway health_state (if any): - // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `health_state` (if any). HealthReasons []VPNGatewayHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 VPN gateway's canonical URL. @@ -79247,13 +86240,7 @@ type VPNGateway struct { // The unique identifier for this VPN gateway. ID *string `json:"id" validate:"required"` - // The reasons for the current VPN gateway lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `lifecycle_state` (if any). LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the VPN gateway. @@ -79281,13 +86268,13 @@ type VPNGateway struct { } // Constants associated with the VPNGateway.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. +// 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 ( VPNGatewayHealthStateDegradedConst = "degraded" VPNGatewayHealthStateFaultedConst = "faulted" @@ -79332,66 +86319,82 @@ func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err obj := new(VPNGateway) err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) if err != nil { + err = core.SDKErrorf(err, "", "connections-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) 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.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) if err != nil { + err = core.SDKErrorf(err, "", "members-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, "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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-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.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -79422,22 +86425,27 @@ func UnmarshalVPNGatewayCollection(m map[string]json.RawMessage, result interfac obj := new(VPNGatewayCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNGatewayCollectionFirst) 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, UnmarshalVPNGatewayCollectionNext) 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 } err = core.UnmarshalModel(m, "vpn_gateways", &obj.VPNGateways, UnmarshalVPNGateway) if err != nil { + err = core.SDKErrorf(err, "", "vpn_gateways-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -79450,8 +86458,11 @@ func (resp *VPNGatewayCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -79467,6 +86478,7 @@ func UnmarshalVPNGatewayCollectionFirst(m map[string]json.RawMessage, result int 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)) @@ -79484,6 +86496,7 @@ func UnmarshalVPNGatewayCollectionNext(m map[string]json.RawMessage, result inte 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)) @@ -79545,25 +86558,7 @@ type VPNGatewayConnection struct { // The status of a VPN gateway connection. Status *string `json:"status" validate:"required"` - // The reasons for the current VPN gateway connection status (if any): - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current VPN gateway connection status (if any). StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local,omitempty"` @@ -79636,19 +86631,27 @@ func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interfac var discValue string err = core.UnmarshalPrimitive(m, "mode", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'mode': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'mode': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'mode' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'mode' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "policy" { err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionPolicyMode) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionPolicyMode-error", common.GetComponentInfo()) + } } else if discValue == "route" { err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteMode) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionRouteMode-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'mode': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'mode': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -79664,6 +86667,7 @@ func UnmarshalVPNGatewayConnectionCIDRs(m map[string]json.RawMessage, result int obj := new(VPNGatewayConnectionCIDRs) err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -79681,6 +86685,7 @@ func UnmarshalVPNGatewayConnectionCollection(m map[string]json.RawMessage, resul obj := new(VPNGatewayConnectionCollection) err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnection) if err != nil { + err = core.SDKErrorf(err, "", "connections-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -79713,14 +86718,17 @@ func UnmarshalVPNGatewayConnectionDpd(m map[string]json.RawMessage, result inter obj := new(VPNGatewayConnectionDpd) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) if err != nil { + err = core.SDKErrorf(err, "", "interval-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) if err != nil { + err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -79753,14 +86761,17 @@ func UnmarshalVPNGatewayConnectionDpdPatch(m map[string]json.RawMessage, result obj := new(VPNGatewayConnectionDpdPatch) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) if err != nil { + err = core.SDKErrorf(err, "", "interval-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) if err != nil { + err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -79793,14 +86804,17 @@ func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, res obj := new(VPNGatewayConnectionDpdPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) if err != nil { + err = core.SDKErrorf(err, "", "interval-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) if err != nil { + err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -79816,9 +86830,8 @@ func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, res type VPNGatewayConnectionIkeIdentity struct { // The IKE identity type. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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 IKE identity FQDN value. @@ -79828,9 +86841,8 @@ type VPNGatewayConnectionIkeIdentity struct { // Constants associated with the VPNGatewayConnectionIkeIdentity.Type property. // The IKE identity type. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionIkeIdentityTypeFqdnConst = "fqdn" VPNGatewayConnectionIkeIdentityTypeHostnameConst = "hostname" @@ -79851,10 +86863,12 @@ func UnmarshalVPNGatewayConnectionIkeIdentity(m map[string]json.RawMessage, resu obj := new(VPNGatewayConnectionIkeIdentity) 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)) @@ -79897,10 +86911,12 @@ func UnmarshalVPNGatewayConnectionIkeIdentityPrototype(m map[string]json.RawMess obj := new(VPNGatewayConnectionIkeIdentityPrototype) 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)) @@ -79933,10 +86949,12 @@ func UnmarshalVPNGatewayConnectionIkePolicyPatch(m map[string]json.RawMessage, r obj := new(VPNGatewayConnectionIkePolicyPatch) 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)) @@ -79969,10 +86987,12 @@ func UnmarshalVPNGatewayConnectionIkePolicyPrototype(m map[string]json.RawMessag obj := new(VPNGatewayConnectionIkePolicyPrototype) 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)) @@ -80005,10 +87025,12 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPatch(m map[string]json.RawMessage, obj := new(VPNGatewayConnectionIPsecPolicyPatch) 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)) @@ -80041,10 +87063,12 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPrototype(m map[string]json.RawMess obj := new(VPNGatewayConnectionIPsecPolicyPrototype) 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)) @@ -80112,38 +87136,47 @@ func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result int obj := new(VPNGatewayConnectionPatch) err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPatch) if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) if err != nil { + err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch) if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPatch) if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-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, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionPeerPatch) if err != nil { + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) if err != nil { + err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) if err != nil { + err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80157,6 +87190,9 @@ func (vpnGatewayConnectionPatch *VPNGatewayConnectionPatch) AsPatch() (_patch ma if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -80185,10 +87221,12 @@ func UnmarshalVPNGatewayConnectionPeerPatch(m map[string]json.RawMessage, result obj := new(VPNGatewayConnectionPeerPatch) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80212,10 +87250,12 @@ func UnmarshalVPNGatewayConnectionPolicyModeLocal(m map[string]json.RawMessage, obj := new(VPNGatewayConnectionPolicyModeLocal) err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80242,6 +87282,9 @@ func (*VpcV1) NewVPNGatewayConnectionPolicyModeLocalPrototype(cidrs []string) (_ CIDRs: cidrs, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -80250,10 +87293,12 @@ func UnmarshalVPNGatewayConnectionPolicyModeLocalPrototype(m map[string]json.Raw obj := new(VPNGatewayConnectionPolicyModeLocalPrototype) err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80301,22 +87346,27 @@ func UnmarshalVPNGatewayConnectionPolicyModePeer(m map[string]json.RawMessage, r obj := new(VPNGatewayConnectionPolicyModePeer) err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80360,18 +87410,22 @@ func UnmarshalVPNGatewayConnectionPolicyModePeerPrototype(m map[string]json.RawM obj := new(VPNGatewayConnectionPolicyModePeerPrototype) err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80453,42 +87507,52 @@ func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result obj := new(VPNGatewayConnectionPrototype) err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) if err != nil { + err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-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, "psk", &obj.Psk) if err != nil { + err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype) if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) if err != nil { + err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80525,22 +87589,27 @@ func UnmarshalVPNGatewayConnectionReference(m map[string]json.RawMessage, result obj := new(VPNGatewayConnectionReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) 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)) @@ -80559,6 +87628,7 @@ func UnmarshalVPNGatewayConnectionReferenceDeleted(m map[string]json.RawMessage, obj := new(VPNGatewayConnectionReferenceDeleted) 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)) @@ -80579,6 +87649,7 @@ func UnmarshalVPNGatewayConnectionStaticRouteModeLocal(m map[string]json.RawMess obj := new(VPNGatewayConnectionStaticRouteModeLocal) err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80602,6 +87673,7 @@ func UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype(m map[string]jso obj := new(VPNGatewayConnectionStaticRouteModeLocalPrototype) err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80646,18 +87718,22 @@ func UnmarshalVPNGatewayConnectionStaticRouteModePeer(m map[string]json.RawMessa obj := new(VPNGatewayConnectionStaticRouteModePeer) err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80698,14 +87774,17 @@ func UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype(m map[string]json obj := new(VPNGatewayConnectionStaticRouteModePeerPrototype) err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80720,25 +87799,7 @@ type VPNGatewayConnectionStaticRouteModeTunnel struct { // The status of the VPN Tunnel. Status *string `json:"status" validate:"required"` - // The reasons for the current VPN gateway connection tunnels status (if any): - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current status (if any). StatusReasons []VPNGatewayConnectionTunnelStatusReason `json:"status_reasons" validate:"required"` } @@ -80754,14 +87815,17 @@ func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMes obj := new(VPNGatewayConnectionStaticRouteModeTunnel) err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "public_ip-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, UnmarshalVPNGatewayConnectionTunnelStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -80771,6 +87835,9 @@ func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMes // VPNGatewayConnectionStatusReason : VPNGatewayConnectionStatusReason struct type VPNGatewayConnectionStatusReason struct { // A snake case string succinctly identifying the status reason. + // + // 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 VPN gateway connection's status. @@ -80782,6 +87849,9 @@ type VPNGatewayConnectionStatusReason struct { // Constants associated with the VPNGatewayConnectionStatusReason.Code property. // A snake case string succinctly identifying the status reason. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionStatusReasonCodeCannotAuthenticateConnectionConst = "cannot_authenticate_connection" VPNGatewayConnectionStatusReasonCodeIkePolicyMismatchConst = "ike_policy_mismatch" @@ -80797,14 +87867,17 @@ func UnmarshalVPNGatewayConnectionStatusReason(m map[string]json.RawMessage, res obj := new(VPNGatewayConnectionStatusReason) 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)) @@ -80813,7 +87886,24 @@ func UnmarshalVPNGatewayConnectionStatusReason(m map[string]json.RawMessage, res // VPNGatewayConnectionTunnelStatusReason : VPNGatewayConnectionTunnelStatusReason struct type VPNGatewayConnectionTunnelStatusReason struct { - // A snake case string succinctly identifying the status reason. + // A reason code for this status: + // - `cannot_authenticate_connection`: Failed to authenticate a connection because of + // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) + // - `internal_error`: Internal error (contact IBM support) + // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check + // the IKE policies on both sides of the VPN) + // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and + // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE + // V1 configuration) + // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE + // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) + // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable + // (check the IPsec policies on both sides of the VPN) + // - `peer_not_responding`: No response from peer (check network ACL configuration, peer + // availability, and on-premise firewall configuration) + // + // 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 VPN gateway connection tunnel's status. @@ -80824,7 +87914,24 @@ type VPNGatewayConnectionTunnelStatusReason struct { } // Constants associated with the VPNGatewayConnectionTunnelStatusReason.Code property. -// A snake case string succinctly identifying the status reason. +// A reason code for this status: +// - `cannot_authenticate_connection`: Failed to authenticate a connection because of +// mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) +// - `internal_error`: Internal error (contact IBM support) +// - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check +// the IKE policies on both sides of the VPN) +// - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and +// remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE +// V1 configuration) +// - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE +// V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) +// - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable +// (check the IPsec policies on both sides of the VPN) +// - `peer_not_responding`: No response from peer (check network ACL configuration, peer +// availability, and on-premise firewall configuration) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionTunnelStatusReasonCodeCannotAuthenticateConnectionConst = "cannot_authenticate_connection" VPNGatewayConnectionTunnelStatusReasonCodeIkePolicyMismatchConst = "ike_policy_mismatch" @@ -80840,14 +87947,17 @@ func UnmarshalVPNGatewayConnectionTunnelStatusReason(m map[string]json.RawMessag obj := new(VPNGatewayConnectionTunnelStatusReason) 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)) @@ -80856,7 +87966,14 @@ func UnmarshalVPNGatewayConnectionTunnelStatusReason(m map[string]json.RawMessag // VPNGatewayHealthReason : VPNGatewayHealthReason struct type VPNGatewayHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state: + // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (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 health state. @@ -80867,7 +87984,14 @@ type VPNGatewayHealthReason struct { } // Constants associated with the VPNGatewayHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state: +// - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) +// - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's +// subnet) +// - `internal_error`: Internal error (contact IBM support) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route" VPNGatewayHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" @@ -80879,14 +88003,17 @@ func UnmarshalVPNGatewayHealthReason(m map[string]json.RawMessage, result interf obj := new(VPNGatewayHealthReason) 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)) @@ -80895,7 +88022,13 @@ func UnmarshalVPNGatewayHealthReason(m map[string]json.RawMessage, result interf // VPNGatewayLifecycleReason : VPNGatewayLifecycleReason struct type VPNGatewayLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. + // 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. @@ -80906,8 +88039,15 @@ type VPNGatewayLifecycleReason struct { } // Constants associated with the VPNGatewayLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. +// 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 ( + VPNGatewayLifecycleReasonCodeInternalErrorConst = "internal_error" VPNGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -80916,14 +88056,17 @@ func UnmarshalVPNGatewayLifecycleReason(m map[string]json.RawMessage, result int obj := new(VPNGatewayLifecycleReason) 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)) @@ -80932,32 +88075,19 @@ func UnmarshalVPNGatewayLifecycleReason(m map[string]json.RawMessage, result int // VPNGatewayMember : VPNGatewayMember struct type VPNGatewayMember struct { - // The reasons for the current VPN gateway member health_state (if any): - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `health_state` (if any). HealthReasons []VPNGatewayMemberHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 reasons for the current VPN gateway member lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `lifecycle_state` (if any). LifecycleReasons []VPNGatewayMemberLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the VPN gateway member. @@ -80976,13 +88106,13 @@ type VPNGatewayMember struct { } // Constants associated with the VPNGatewayMember.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. +// 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 ( VPNGatewayMemberHealthStateDegradedConst = "degraded" VPNGatewayMemberHealthStateFaultedConst = "faulted" @@ -81014,30 +88144,37 @@ func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) obj := new(VPNGatewayMember) err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayMemberHealthReason) 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayMemberLifecycleReason) 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.UnmarshalModel(m, "private_ip", &obj.PrivateIP, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "private_ip-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "public_ip-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "role", &obj.Role) if err != nil { + err = core.SDKErrorf(err, "", "role-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -81046,7 +88183,13 @@ func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) // VPNGatewayMemberHealthReason : VPNGatewayMemberHealthReason struct type VPNGatewayMemberHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state: + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (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 health state. @@ -81057,7 +88200,13 @@ type VPNGatewayMemberHealthReason struct { } // Constants associated with the VPNGatewayMemberHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state: +// - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's +// subnet) +// - `internal_error`: Internal error (contact IBM support) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayMemberHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" VPNGatewayMemberHealthReasonCodeInternalErrorConst = "internal_error" @@ -81068,14 +88217,17 @@ func UnmarshalVPNGatewayMemberHealthReason(m map[string]json.RawMessage, result obj := new(VPNGatewayMemberHealthReason) 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)) @@ -81084,7 +88236,13 @@ func UnmarshalVPNGatewayMemberHealthReason(m map[string]json.RawMessage, result // VPNGatewayMemberLifecycleReason : VPNGatewayMemberLifecycleReason struct type VPNGatewayMemberLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. + // 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. @@ -81095,8 +88253,15 @@ type VPNGatewayMemberLifecycleReason struct { } // Constants associated with the VPNGatewayMemberLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. +// 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 ( + VPNGatewayMemberLifecycleReasonCodeInternalErrorConst = "internal_error" VPNGatewayMemberLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -81105,14 +88270,17 @@ func UnmarshalVPNGatewayMemberLifecycleReason(m map[string]json.RawMessage, resu obj := new(VPNGatewayMemberLifecycleReason) 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)) @@ -81130,6 +88298,7 @@ func UnmarshalVPNGatewayPatch(m map[string]json.RawMessage, result interface{}) obj := new(VPNGatewayPatch) 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)) @@ -81143,6 +88312,9 @@ func (vpnGatewayPatch *VPNGatewayPatch) AsPatch() (_patch map[string]interface{} if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -81185,18 +88357,22 @@ func UnmarshalVPNGatewayPrototype(m map[string]json.RawMessage, result interface obj := new(VPNGatewayPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -81215,6 +88391,7 @@ func UnmarshalVPNGatewayReferenceDeleted(m map[string]json.RawMessage, result in obj := new(VPNGatewayReferenceDeleted) 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)) @@ -81258,30 +88435,16 @@ type VPNServer struct { // Indicates whether the split tunneling is enabled on this VPN server. EnableSplitTunneling *bool `json:"enable_split_tunneling" validate:"required"` - // The reasons for the current VPN server health_state (if any): - // - `cannot_access_client_certificate`: VPN server's client certificate is inaccessible - // (verify certificate exists and that IAM policies grant `VPN server for VPC` access - // to `Secrets Manager`) - // - `cannot_access_server_certificate`: VPN server's server certificate is inaccessible - // (verify certificate exists and that IAM policies grant `VPN server for VPC` access - // to `Secrets Manager`) - // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `health_state` (if any). HealthReasons []VPNServerHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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"` // Fully qualified domain name assigned to this VPN server. @@ -81293,13 +88456,7 @@ type VPNServer struct { // The unique identifier for this VPN server. ID *string `json:"id" validate:"required"` - // The reasons for the current VPN server lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `lifecycle_state` (if any). LifecycleReasons []VPNServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the VPN server. @@ -81334,13 +88491,13 @@ type VPNServer struct { } // Constants associated with the VPNServer.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. +// 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 ( VPNServerHealthStateDegradedConst = "degraded" VPNServerHealthStateFaultedConst = "faulted" @@ -81378,106 +88535,132 @@ func UnmarshalVPNServer(m map[string]json.RawMessage, result interface{}) (err e obj := new(VPNServer) err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "certificate-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthentication) if err != nil { + err = core.SDKErrorf(err, "", "client_authentication-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "client_auto_delete", &obj.ClientAutoDelete) if err != nil { + err = core.SDKErrorf(err, "", "client_auto_delete-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "client_auto_delete_timeout", &obj.ClientAutoDeleteTimeout) if err != nil { + err = core.SDKErrorf(err, "", "client_auto_delete_timeout-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "client_dns_server_ips-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) if err != nil { + err = core.SDKErrorf(err, "", "client_idle_timeout-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) if err != nil { + err = core.SDKErrorf(err, "", "client_ip_pool-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) if err != nil { + err = core.SDKErrorf(err, "", "enable_split_tunneling-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNServerHealthReason) 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, "hostname", &obj.Hostname) if err != nil { + err = core.SDKErrorf(err, "", "hostname-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, UnmarshalVPNServerLifecycleReason) 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, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "private_ips-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, "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, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -81522,18 +88705,22 @@ func UnmarshalVPNServerAuthentication(m map[string]json.RawMessage, result inter obj := new(VPNServerAuthentication) err = core.UnmarshalPrimitive(m, "method", &obj.Method) if err != nil { + err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) if err != nil { + err = core.SDKErrorf(err, "", "identity_provider-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "client_ca-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) if err != nil { + err = core.SDKErrorf(err, "", "crl-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -81544,22 +88731,20 @@ func UnmarshalVPNServerAuthentication(m map[string]json.RawMessage, result inter // Models which "extend" this model: // - VPNServerAuthenticationByUsernameIDProviderByIam type VPNServerAuthenticationByUsernameIDProvider struct { - // The type of identity provider to be used by the VPN client. + // The type of identity provider to be used by the VPN client: // - `iam`: IBM identity and access management // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProviderType *string `json:"provider_type,omitempty"` } // Constants associated with the VPNServerAuthenticationByUsernameIDProvider.ProviderType property. -// The type of identity provider to be used by the VPN client. +// The type of identity provider to be used by the VPN client: // - `iam`: IBM identity and access management // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerAuthenticationByUsernameIDProviderProviderTypeIamConst = "iam" ) @@ -81577,6 +88762,7 @@ func UnmarshalVPNServerAuthenticationByUsernameIDProvider(m map[string]json.RawM obj := new(VPNServerAuthenticationByUsernameIDProvider) err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) if err != nil { + err = core.SDKErrorf(err, "", "provider_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -81622,19 +88808,27 @@ func UnmarshalVPNServerAuthenticationPrototype(m map[string]json.RawMessage, res var discValue string err = core.UnmarshalPrimitive(m, "method", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'method': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'method': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { - err = fmt.Errorf("required discriminator property 'method' not found in JSON object") + err = core.SDKErrorf(err, "required discriminator property 'method' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } if discValue == "certificate" { err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype-error", common.GetComponentInfo()) + } } else if discValue == "username" { err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'method': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'method': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -81676,9 +88870,8 @@ type VPNServerClient struct { // - `connected`: the VPN client is `connected` to this VPN server. // - `disconnected`: the VPN client is `disconnected` from this VPN server. // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN client on which the - // unexpected property value was encountered. + // 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 username that this VPN client provided when connecting to the VPN server. @@ -81698,9 +88891,8 @@ const ( // - `connected`: the VPN client is `connected` to this VPN server. // - `disconnected`: the VPN client is `disconnected` from this VPN server. // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN client on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerClientStatusConnectedConst = "connected" VPNServerClientStatusDisconnectedConst = "disconnected" @@ -81711,46 +88903,57 @@ func UnmarshalVPNServerClient(m map[string]json.RawMessage, result interface{}) obj := new(VPNServerClient) err = core.UnmarshalModel(m, "client_ip", &obj.ClientIP, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "client_ip-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "common_name", &obj.CommonName) if err != nil { + err = core.SDKErrorf(err, "", "common_name-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, "disconnected_at", &obj.DisconnectedAt) if err != nil { + err = core.SDKErrorf(err, "", "disconnected_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.UnmarshalModel(m, "remote_ip", &obj.RemoteIP, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "remote_ip-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "remote_port", &obj.RemotePort) if err != nil { + err = core.SDKErrorf(err, "", "remote_port-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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-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)) @@ -81781,22 +88984,27 @@ func UnmarshalVPNServerClientCollection(m map[string]json.RawMessage, result int obj := new(VPNServerClientCollection) err = core.UnmarshalModel(m, "clients", &obj.Clients, UnmarshalVPNServerClient) if err != nil { + err = core.SDKErrorf(err, "", "clients-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerClientCollectionFirst) 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, UnmarshalVPNServerClientCollectionNext) 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)) @@ -81809,8 +89017,11 @@ func (resp *VPNServerClientCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -81826,6 +89037,7 @@ func UnmarshalVPNServerClientCollectionFirst(m map[string]json.RawMessage, resul 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)) @@ -81843,6 +89055,7 @@ func UnmarshalVPNServerClientCollectionNext(m map[string]json.RawMessage, result 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)) @@ -81873,22 +89086,27 @@ func UnmarshalVPNServerCollection(m map[string]json.RawMessage, result interface obj := new(VPNServerCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerCollectionFirst) 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, UnmarshalVPNServerCollectionNext) 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 } err = core.UnmarshalModel(m, "vpn_servers", &obj.VPNServers, UnmarshalVPNServer) if err != nil { + err = core.SDKErrorf(err, "", "vpn_servers-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -81901,8 +89119,11 @@ func (resp *VPNServerCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -81918,6 +89139,7 @@ func UnmarshalVPNServerCollectionFirst(m map[string]json.RawMessage, result inte 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)) @@ -81935,6 +89157,7 @@ func UnmarshalVPNServerCollectionNext(m map[string]json.RawMessage, result inter 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)) @@ -81943,7 +89166,20 @@ func UnmarshalVPNServerCollectionNext(m map[string]json.RawMessage, result inter // VPNServerHealthReason : VPNServerHealthReason struct type VPNServerHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state: + // - `cannot_access_client_certificate`: VPN server's client certificate is inaccessible + // (verify certificate exists and that IAM policies grant `VPN server for VPC` access + // to `Secrets Manager`) + // - `cannot_access_server_certificate`: VPN server's server certificate is inaccessible + // (verify certificate exists and that IAM policies grant `VPN server for VPC` access + // to `Secrets Manager`) + // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) + // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's + // subnet) + // - `internal_error`: Internal error (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 health state. @@ -81954,7 +89190,20 @@ type VPNServerHealthReason struct { } // Constants associated with the VPNServerHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state: +// - `cannot_access_client_certificate`: VPN server's client certificate is inaccessible +// (verify certificate exists and that IAM policies grant `VPN server for VPC` access +// to `Secrets Manager`) +// - `cannot_access_server_certificate`: VPN server's server certificate is inaccessible +// (verify certificate exists and that IAM policies grant `VPN server for VPC` access +// to `Secrets Manager`) +// - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) +// - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's +// subnet) +// - `internal_error`: Internal error (contact IBM support) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerHealthReasonCodeCannotAccessClientCertificateConst = "cannot_access_client_certificate" VPNServerHealthReasonCodeCannotAccessServerCertificateConst = "cannot_access_server_certificate" @@ -81968,14 +89217,17 @@ func UnmarshalVPNServerHealthReason(m map[string]json.RawMessage, result interfa obj := new(VPNServerHealthReason) 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)) @@ -81984,7 +89236,13 @@ func UnmarshalVPNServerHealthReason(m map[string]json.RawMessage, result interfa // VPNServerLifecycleReason : VPNServerLifecycleReason struct type VPNServerLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. + // 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. @@ -81995,8 +89253,15 @@ type VPNServerLifecycleReason struct { } // Constants associated with the VPNServerLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. +// 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 ( + VPNServerLifecycleReasonCodeInternalErrorConst = "internal_error" VPNServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -82005,14 +89270,17 @@ func UnmarshalVPNServerLifecycleReason(m map[string]json.RawMessage, result inte obj := new(VPNServerLifecycleReason) 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)) @@ -82077,42 +89345,52 @@ func UnmarshalVPNServerPatch(m map[string]json.RawMessage, result interface{}) ( obj := new(VPNServerPatch) err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceIdentity) if err != nil { + err = core.SDKErrorf(err, "", "certificate-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthenticationPrototype) if err != nil { + err = core.SDKErrorf(err, "", "client_authentication-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) if err != nil { + err = core.SDKErrorf(err, "", "client_dns_server_ips-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) if err != nil { + err = core.SDKErrorf(err, "", "client_idle_timeout-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) if err != nil { + err = core.SDKErrorf(err, "", "client_ip_pool-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) if err != nil { + err = core.SDKErrorf(err, "", "enable_split_tunneling-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, "port", &obj.Port) if err != nil { + err = core.SDKErrorf(err, "", "port-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, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) if err != nil { + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -82126,6 +89404,9 @@ func (vpnServerPatch *VPNServerPatch) AsPatch() (_patch map[string]interface{}, if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -82141,6 +89422,7 @@ func UnmarshalVPNServerReferenceDeleted(m map[string]json.RawMessage, result int obj := new(VPNServerReferenceDeleted) 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)) @@ -82150,13 +89432,13 @@ func UnmarshalVPNServerReferenceDeleted(m map[string]json.RawMessage, result int // VPNServerRoute : VPNServerRoute struct type VPNServerRoute struct { // The action to perform with a packet matching the VPN route: - // - `translate`: translate the source IP address to one of the private IP addresses of the VPN server. + // - `translate`: translate the source IP address to one of the private IP addresses of + // the VPN server, then deliver the packet to target. // - `deliver`: deliver the packet into the VPC. // - `drop`: drop the packet // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the - // unexpected property value was encountered. + // 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"` // The date and time that the VPN route was created. @@ -82166,21 +89448,16 @@ type VPNServerRoute struct { // be dropped. Destination *string `json:"destination" validate:"required"` - // The reasons for the current VPN server route health_state (if any): - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `health_state` (if any). HealthReasons []VPNServerRouteHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 VPN route. @@ -82189,13 +89466,7 @@ type VPNServerRoute struct { // The unique identifier for this VPN route. ID *string `json:"id" validate:"required"` - // The reasons for the current VPN server route lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `lifecycle_state` (if any). LifecycleReasons []VPNServerRouteLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the VPN route. @@ -82210,13 +89481,13 @@ type VPNServerRoute struct { // Constants associated with the VPNServerRoute.Action property. // The action to perform with a packet matching the VPN route: -// - `translate`: translate the source IP address to one of the private IP addresses of the VPN server. -// - `deliver`: deliver the packet into the VPC. -// - `drop`: drop the packet +// - `translate`: translate the source IP address to one of the private IP addresses of +// the VPN server, then deliver the packet to target. +// - `deliver`: deliver the packet into the VPC. +// - `drop`: drop the packet // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerRouteActionDeliverConst = "deliver" VPNServerRouteActionDropConst = "drop" @@ -82224,13 +89495,13 @@ const ( ) // Constants associated with the VPNServerRoute.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. +// 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 ( VPNServerRouteHealthStateDegradedConst = "degraded" VPNServerRouteHealthStateFaultedConst = "faulted" @@ -82261,46 +89532,57 @@ func UnmarshalVPNServerRoute(m map[string]json.RawMessage, result interface{}) ( obj := new(VPNServerRoute) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNServerRouteHealthReason) 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNServerRouteLifecycleReason) 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)) @@ -82331,22 +89613,27 @@ func UnmarshalVPNServerRouteCollection(m map[string]json.RawMessage, result inte obj := new(VPNServerRouteCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerRouteCollectionFirst) 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, UnmarshalVPNServerRouteCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalVPNServerRoute) 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)) @@ -82359,8 +89646,11 @@ func (resp *VPNServerRouteCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -82376,6 +89666,7 @@ func UnmarshalVPNServerRouteCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -82393,6 +89684,7 @@ func UnmarshalVPNServerRouteCollectionNext(m map[string]json.RawMessage, result 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)) @@ -82401,7 +89693,11 @@ func UnmarshalVPNServerRouteCollectionNext(m map[string]json.RawMessage, result // VPNServerRouteHealthReason : VPNServerRouteHealthReason struct type VPNServerRouteHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state: + // - `internal_error`: Internal error (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 health state. @@ -82412,7 +89708,11 @@ type VPNServerRouteHealthReason struct { } // Constants associated with the VPNServerRouteHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state: +// - `internal_error`: Internal error (contact IBM support) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerRouteHealthReasonCodeInternalErrorConst = "internal_error" ) @@ -82422,14 +89722,17 @@ func UnmarshalVPNServerRouteHealthReason(m map[string]json.RawMessage, result in obj := new(VPNServerRouteHealthReason) 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)) @@ -82438,7 +89741,13 @@ func UnmarshalVPNServerRouteHealthReason(m map[string]json.RawMessage, result in // VPNServerRouteLifecycleReason : VPNServerRouteLifecycleReason struct type VPNServerRouteLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. + // 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. @@ -82449,8 +89758,15 @@ type VPNServerRouteLifecycleReason struct { } // Constants associated with the VPNServerRouteLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. +// 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 ( + VPNServerRouteLifecycleReasonCodeInternalErrorConst = "internal_error" VPNServerRouteLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -82459,14 +89775,17 @@ func UnmarshalVPNServerRouteLifecycleReason(m map[string]json.RawMessage, result obj := new(VPNServerRouteLifecycleReason) 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)) @@ -82484,6 +89803,7 @@ func UnmarshalVPNServerRoutePatch(m map[string]json.RawMessage, result interface obj := new(VPNServerRoutePatch) 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)) @@ -82497,6 +89817,9 @@ func (vpnServerRoutePatch *VPNServerRoutePatch) AsPatch() (_patch map[string]int if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -82598,78 +89921,97 @@ func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result inter obj := new(VirtualNetworkInterface) 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, "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.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, "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, "ips", &obj.Ips, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "ips-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 } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) if err != nil { + err = core.SDKErrorf(err, "", "primary_ip-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, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-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, "target", &obj.Target, UnmarshalVirtualNetworkInterfaceTarget) if err != nil { + err = core.SDKErrorf(err, "", "target-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)) @@ -82700,22 +90042,27 @@ func UnmarshalVirtualNetworkInterfaceCollection(m map[string]json.RawMessage, re obj := new(VirtualNetworkInterfaceCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVirtualNetworkInterfaceCollectionFirst) 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, UnmarshalVirtualNetworkInterfaceCollectionNext) 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 } err = core.UnmarshalModel(m, "virtual_network_interfaces", &obj.VirtualNetworkInterfaces, UnmarshalVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interfaces-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -82728,8 +90075,11 @@ func (resp *VirtualNetworkInterfaceCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -82745,6 +90095,7 @@ func UnmarshalVirtualNetworkInterfaceCollectionFirst(m map[string]json.RawMessag 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)) @@ -82762,6 +90113,7 @@ func UnmarshalVirtualNetworkInterfaceCollectionNext(m map[string]json.RawMessage 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)) @@ -82807,22 +90159,27 @@ func UnmarshalVirtualNetworkInterfaceIPPrototype(m map[string]json.RawMessage, r obj := new(VirtualNetworkInterfaceIPPrototype) 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 } 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)) @@ -82862,18 +90219,22 @@ func UnmarshalVirtualNetworkInterfacePatch(m map[string]json.RawMessage, result obj := new(VirtualNetworkInterfacePatch) 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.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)) @@ -82887,6 +90248,9 @@ func (virtualNetworkInterfacePatch *VirtualNetworkInterfacePatch) AsPatch() (_pa if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -82929,22 +90293,27 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototype(m map[string]json.RawMes obj := new(VirtualNetworkInterfacePrimaryIPPrototype) 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 } 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)) @@ -82980,22 +90349,27 @@ func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]jso obj := new(VirtualNetworkInterfaceReferenceAttachmentContext) 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) 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)) @@ -83014,6 +90388,7 @@ func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessa obj := new(VirtualNetworkInterfaceReferenceDeleted) 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)) @@ -83022,9 +90397,8 @@ func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessa // VirtualNetworkInterfaceTarget : A virtual network interface target. // -// The resource types that can be virtual network interface targets are expected to expand in the future. When iterating -// over virtual network interface targets, do not assume that every target resource will be from a known set of resource -// types. Optionally halt processing and surface an error, or bypass resources of unrecognized types. +// 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: // - VirtualNetworkInterfaceTargetShareMountTargetReference // - VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext @@ -83066,22 +90440,27 @@ func UnmarshalVirtualNetworkInterfaceTarget(m map[string]json.RawMessage, result obj := new(VirtualNetworkInterfaceTarget) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) 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)) @@ -83106,8 +90485,10 @@ type Volume struct { // operation that is specified to require serialization. Busy *bool `json:"busy" validate:"required"` - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. + // The capacity to use for the volume (in gigabytes). + // + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity" validate:"required"` // The date and time that the volume was created. @@ -83126,19 +90507,15 @@ type Volume struct { EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` // The reasons for the current `health_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. HealthReasons []VolumeHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 volume. @@ -83177,16 +90554,11 @@ type Volume struct { // The status of the volume. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the volume on which the unexpected - // property value was encountered. + // 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). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. StatusReasons []VolumeStatusReason `json:"status_reasons" validate:"required"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -83218,13 +90590,13 @@ const ( ) // Constants associated with the Volume.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. +// 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 ( VolumeHealthStateDegradedConst = "degraded" VolumeHealthStateFaultedConst = "faulted" @@ -83241,9 +90613,8 @@ const ( // Constants associated with the Volume.Status property. // The status of the volume. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the volume on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VolumeStatusAvailableConst = "available" VolumeStatusFailedConst = "failed" @@ -83258,106 +90629,132 @@ func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err erro obj := new(Volume) err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { + err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "attachment_state", &obj.AttachmentState) if err != nil { + err = core.SDKErrorf(err, "", "attachment_state-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "busy", &obj.Busy) if err != nil { + err = core.SDKErrorf(err, "", "busy-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) if err != nil { + err = core.SDKErrorf(err, "", "encryption-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, "health_reasons", &obj.HealthReasons, UnmarshalVolumeHealthReason) 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, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) if err != nil { + err = core.SDKErrorf(err, "", "operating_system-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileReference) if err != nil { + err = core.SDKErrorf(err, "", "profile-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, "source_image", &obj.SourceImage, UnmarshalImageReference) if err != nil { + err = core.SDKErrorf(err, "", "source_image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotReference) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-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, UnmarshalVolumeStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceVolumeContext) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-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)) @@ -83423,42 +90820,52 @@ func UnmarshalVolumeAttachment(m map[string]json.RawMessage, result interface{}) obj := new(VolumeAttachment) err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-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, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_volume_on_instance_delete-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) if err != nil { + err = core.SDKErrorf(err, "", "device-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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-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.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReferenceVolumeAttachmentContext) if err != nil { + err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83476,6 +90883,7 @@ func UnmarshalVolumeAttachmentCollection(m map[string]json.RawMessage, result in obj := new(VolumeAttachmentCollection) err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachment) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83493,6 +90901,7 @@ func UnmarshalVolumeAttachmentDevice(m map[string]json.RawMessage, result interf obj := new(VolumeAttachmentDevice) 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)) @@ -83513,10 +90922,12 @@ func UnmarshalVolumeAttachmentPatch(m map[string]json.RawMessage, result interfa obj := new(VolumeAttachmentPatch) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_volume_on_instance_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)) @@ -83530,6 +90941,9 @@ func (volumeAttachmentPatch *VolumeAttachmentPatch) AsPatch() (_patch map[string if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -83552,6 +90966,9 @@ func (*VpcV1) NewVolumeAttachmentPrototype(volume VolumeAttachmentPrototypeVolum Volume: volume, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -83560,14 +90977,17 @@ func UnmarshalVolumeAttachmentPrototype(m map[string]json.RawMessage, result int obj := new(VolumeAttachmentPrototype) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_volume_on_instance_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, "volume", &obj.Volume, UnmarshalVolumeAttachmentPrototypeVolume) if err != nil { + err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83593,6 +91013,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByImageContext(volume *VolumeP Volume: volume, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -83601,14 +91024,17 @@ func UnmarshalVolumeAttachmentPrototypeInstanceByImageContext(m map[string]json. obj := new(VolumeAttachmentPrototypeInstanceByImageContext) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_volume_on_instance_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, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83634,6 +91060,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(volume Volume: volume, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -83642,14 +91071,17 @@ func UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(m map[str obj := new(VolumeAttachmentPrototypeInstanceBySourceSnapshotContext) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_volume_on_instance_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, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83675,6 +91107,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByVolumeContext(volume VolumeI Volume: volume, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -83683,14 +91118,17 @@ func UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext(m map[string]json obj := new(VolumeAttachmentPrototypeInstanceByVolumeContext) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_volume_on_instance_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, "volume", &obj.Volume, UnmarshalVolumeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83730,8 +91168,10 @@ type VolumeAttachmentPrototypeVolume struct { // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. + // The capacity to use for the volume (in gigabytes). + // + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity,omitempty"` // The root key to use to wrap the data encryption key for the volume. @@ -83756,46 +91196,57 @@ func UnmarshalVolumeAttachmentPrototypeVolume(m map[string]json.RawMessage, resu obj := new(VolumeAttachmentPrototypeVolume) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83833,26 +91284,32 @@ func UnmarshalVolumeAttachmentReferenceInstanceContext(m map[string]json.RawMess obj := new(VolumeAttachmentReferenceInstanceContext) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceInstanceContextDeleted) if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) if err != nil { + err = core.SDKErrorf(err, "", "device-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, "volume", &obj.Volume, UnmarshalVolumeReferenceVolumeAttachmentContext) if err != nil { + err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83871,6 +91328,7 @@ func UnmarshalVolumeAttachmentReferenceInstanceContextDeleted(m map[string]json. obj := new(VolumeAttachmentReferenceInstanceContextDeleted) 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)) @@ -83919,34 +91377,42 @@ func UnmarshalVolumeAttachmentReferenceVolumeContext(m map[string]json.RawMessag obj := new(VolumeAttachmentReferenceVolumeContext) err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_volume_on_instance_delete-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceVolumeContextDeleted) if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) if err != nil { + err = core.SDKErrorf(err, "", "device-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, "instance", &obj.Instance, UnmarshalInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "instance-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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -83965,6 +91431,7 @@ func UnmarshalVolumeAttachmentReferenceVolumeContextDeleted(m map[string]json.Ra obj := new(VolumeAttachmentReferenceVolumeContextDeleted) 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)) @@ -83995,22 +91462,27 @@ func UnmarshalVolumeCollection(m map[string]json.RawMessage, result interface{}) obj := new(VolumeCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVolumeCollectionFirst) 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, UnmarshalVolumeCollectionNext) 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 } err = core.UnmarshalModel(m, "volumes", &obj.Volumes, UnmarshalVolume) if err != nil { + err = core.SDKErrorf(err, "", "volumes-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84023,8 +91495,11 @@ func (resp *VolumeCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -84040,6 +91515,7 @@ func UnmarshalVolumeCollectionFirst(m map[string]json.RawMessage, result interfa 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)) @@ -84057,6 +91533,7 @@ func UnmarshalVolumeCollectionNext(m map[string]json.RawMessage, result interfac 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)) @@ -84065,7 +91542,7 @@ func UnmarshalVolumeCollectionNext(m map[string]json.RawMessage, result interfac // VolumeHealthReason : VolumeHealthReason struct type VolumeHealthReason struct { - // A snake case string succinctly identifying the reason for this health state. + // A reason code for this health state. Code *string `json:"code" validate:"required"` // An explanation of the reason for this health state. @@ -84076,7 +91553,7 @@ type VolumeHealthReason struct { } // Constants associated with the VolumeHealthReason.Code property. -// A snake case string succinctly identifying the reason for this health state. +// A reason code for this health state. const ( VolumeHealthReasonCodeInitializingFromSnapshotConst = "initializing_from_snapshot" ) @@ -84086,14 +91563,17 @@ func UnmarshalVolumeHealthReason(m map[string]json.RawMessage, result interface{ obj := new(VolumeHealthReason) 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)) @@ -84129,14 +91609,17 @@ func UnmarshalVolumeIdentity(m map[string]json.RawMessage, result interface{}) ( obj := new(VolumeIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84149,7 +91632,8 @@ type VolumePatch struct { // and the specified value must not be less than the current capacity. Additionally, if the volume is attached as a // boot volume, the maximum value is 250 gigabytes. // - // The minimum and maximum capacity limits for creating or updating volumes may expand in the future. + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity,omitempty"` // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile @@ -84174,22 +91658,27 @@ func UnmarshalVolumePatch(m map[string]json.RawMessage, result interface{}) (err obj := new(VolumePatch) err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84203,6 +91692,9 @@ func (volumePatch *VolumePatch) AsPatch() (_patch map[string]interface{}, err er if err == nil { err = json.Unmarshal(jsonData, &_patch) } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } return } @@ -84210,9 +91702,8 @@ func (volumePatch *VolumePatch) AsPatch() (_patch map[string]interface{}, err er type VolumeProfile struct { // The product family this volume profile belongs to. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the volume profile on which the - // unexpected property value was encountered. + // 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 URL for this volume profile. @@ -84225,9 +91716,8 @@ type VolumeProfile struct { // Constants associated with the VolumeProfile.Family property. // The product family this volume profile belongs to. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the volume profile on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VolumeProfileFamilyCustomConst = "custom" VolumeProfileFamilyTieredConst = "tiered" @@ -84238,14 +91728,17 @@ func UnmarshalVolumeProfile(m map[string]json.RawMessage, result interface{}) (e obj := new(VolumeProfile) err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { + err = core.SDKErrorf(err, "", "family-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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84276,22 +91769,27 @@ func UnmarshalVolumeProfileCollection(m map[string]json.RawMessage, result inter obj := new(VolumeProfileCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVolumeProfileCollectionFirst) 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, UnmarshalVolumeProfileCollectionNext) if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalVolumeProfile) 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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84304,8 +91802,11 @@ func (resp *VolumeProfileCollection) GetNextStart() (*string, error) { return nil, nil } start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { + 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 } @@ -84321,6 +91822,7 @@ func UnmarshalVolumeProfileCollectionFirst(m map[string]json.RawMessage, result 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)) @@ -84338,6 +91840,7 @@ func UnmarshalVolumeProfileCollectionNext(m map[string]json.RawMessage, result i 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)) @@ -84369,10 +91872,12 @@ func UnmarshalVolumeProfileIdentity(m map[string]json.RawMessage, result interfa obj := new(VolumeProfileIdentity) 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)) @@ -84393,10 +91898,12 @@ func UnmarshalVolumeProfileReference(m map[string]json.RawMessage, result interf obj := new(VolumeProfileReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -84430,8 +91937,10 @@ type VolumePrototype struct { // The zone this volume will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. + // The capacity to use for the volume (in gigabytes). + // + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity,omitempty"` // The root key to use to wrap the data encryption key for the volume. @@ -84456,38 +91965,47 @@ func UnmarshalVolumePrototype(m map[string]json.RawMessage, result interface{}) obj := new(VolumePrototype) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84533,6 +92051,9 @@ func (*VpcV1) NewVolumePrototypeInstanceByImageContext(profile VolumeProfileIden Profile: profile, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -84541,30 +92062,37 @@ func UnmarshalVolumePrototypeInstanceByImageContext(m map[string]json.RawMessage obj := new(VolumePrototypeInstanceByImageContext) err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84614,6 +92142,9 @@ func (*VpcV1) NewVolumePrototypeInstanceBySourceSnapshotContext(profile VolumePr SourceSnapshot: sourceSnapshot, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -84622,34 +92153,42 @@ func UnmarshalVolumePrototypeInstanceBySourceSnapshotContext(m map[string]json.R obj := new(VolumePrototypeInstanceBySourceSnapshotContext) err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84693,30 +92232,37 @@ func UnmarshalVolumeReference(m map[string]json.RawMessage, result interface{}) obj := new(VolumeReference) 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, UnmarshalVolumeReferenceDeleted) 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)) @@ -84735,6 +92281,7 @@ func UnmarshalVolumeReferenceDeleted(m map[string]json.RawMessage, result interf obj := new(VolumeReferenceDeleted) 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)) @@ -84774,26 +92321,32 @@ func UnmarshalVolumeReferenceVolumeAttachmentContext(m map[string]json.RawMessag obj := new(VolumeReferenceVolumeAttachmentContext) 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, UnmarshalVolumeReferenceVolumeAttachmentContextDeleted) 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)) @@ -84812,6 +92365,7 @@ func UnmarshalVolumeReferenceVolumeAttachmentContextDeleted(m map[string]json.Ra obj := new(VolumeReferenceVolumeAttachmentContextDeleted) 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)) @@ -84831,6 +92385,7 @@ func UnmarshalVolumeRemote(m map[string]json.RawMessage, result interface{}) (er obj := new(VolumeRemote) 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)) @@ -84840,6 +92395,9 @@ func UnmarshalVolumeRemote(m map[string]json.RawMessage, result interface{}) (er // VolumeStatusReason : VolumeStatusReason struct type VolumeStatusReason struct { // A snake case string succinctly identifying the status reason. + // + // 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. @@ -84851,6 +92409,9 @@ type VolumeStatusReason struct { // Constants associated with the VolumeStatusReason.Code property. // A snake case string succinctly identifying the status reason. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VolumeStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" ) @@ -84860,14 +92421,17 @@ func UnmarshalVolumeStatusReason(m map[string]json.RawMessage, result interface{ obj := new(VolumeStatusReason) 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)) @@ -84885,6 +92449,7 @@ func UnmarshalVpcdnsResolutionBindingCollectionFirst(m map[string]json.RawMessag 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)) @@ -84902,6 +92467,7 @@ func UnmarshalVpcdnsResolutionBindingCollectionNext(m map[string]json.RawMessage 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)) @@ -84936,18 +92502,22 @@ func UnmarshalZone(m map[string]json.RawMessage, result interface{}) (err error) obj := new(Zone) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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, "region", &obj.Region, UnmarshalRegionReference) if err != nil { + err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84965,6 +92535,7 @@ func UnmarshalZoneCollection(m map[string]json.RawMessage, result interface{}) ( obj := new(ZoneCollection) err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZone) if err != nil { + err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -84996,10 +92567,12 @@ func UnmarshalZoneIdentity(m map[string]json.RawMessage, result interface{}) (er obj := new(ZoneIdentity) 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)) @@ -85020,10 +92593,12 @@ func UnmarshalZoneReference(m map[string]json.RawMessage, result interface{}) (e obj := new(ZoneReference) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { + err = core.SDKErrorf(err, "", "href-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)) @@ -85059,22 +92634,27 @@ func UnmarshalBackupPolicyJobSourceInstanceReference(m map[string]json.RawMessag obj := new(BackupPolicyJobSourceInstanceReference) 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, UnmarshalInstanceReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -85123,30 +92703,37 @@ func UnmarshalBackupPolicyJobSourceVolumeReference(m map[string]json.RawMessage, obj := new(BackupPolicyJobSourceVolumeReference) 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, UnmarshalVolumeReferenceDeleted) 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)) @@ -85163,19 +92750,15 @@ type BackupPolicyMatchResourceTypeInstance struct { CRN *string `json:"crn" validate:"required"` // The reasons for the current `health_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. HealthReasons []BackupPolicyHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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. @@ -85214,28 +92797,26 @@ type BackupPolicyMatchResourceTypeInstance struct { // - `boot_volume`: Include the instance's boot volume. // - `data_volumes`: Include the instance's data volumes. // - // The enumerated values for this property may expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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" 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 in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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"` } // Constants associated with the BackupPolicyMatchResourceTypeInstance.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. +// 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 ( BackupPolicyMatchResourceTypeInstanceHealthStateDegradedConst = "degraded" BackupPolicyMatchResourceTypeInstanceHealthStateFaultedConst = "faulted" @@ -85272,9 +92853,8 @@ const ( // 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 in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( BackupPolicyMatchResourceTypeInstanceMatchResourceTypeInstanceConst = "instance" ) @@ -85288,66 +92868,82 @@ func UnmarshalBackupPolicyMatchResourceTypeInstance(m map[string]json.RawMessage obj := new(BackupPolicyMatchResourceTypeInstance) 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_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 } err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) if err != nil { + err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -85364,19 +92960,15 @@ type BackupPolicyMatchResourceTypeVolume struct { CRN *string `json:"crn" validate:"required"` // The reasons for the current `health_state` (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. HealthReasons []BackupPolicyHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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. @@ -85414,20 +93006,19 @@ type BackupPolicyMatchResourceTypeVolume struct { // 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 in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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"` } // Constants associated with the BackupPolicyMatchResourceTypeVolume.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. +// 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 ( BackupPolicyMatchResourceTypeVolumeHealthStateDegradedConst = "degraded" BackupPolicyMatchResourceTypeVolumeHealthStateFaultedConst = "faulted" @@ -85457,9 +93048,8 @@ const ( // 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 in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( BackupPolicyMatchResourceTypeVolumeMatchResourceTypeVolumeConst = "volume" ) @@ -85473,62 +93063,77 @@ func UnmarshalBackupPolicyMatchResourceTypeVolume(m map[string]json.RawMessage, obj := new(BackupPolicyMatchResourceTypeVolume) 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_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, "match_resource_type", &obj.MatchResourceType) if err != nil { + err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -85584,6 +93189,9 @@ func (*VpcV1) NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstanceProto MatchResourceType: core.StringPtr(matchResourceType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -85596,30 +93204,37 @@ func UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototyp obj := new(BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype) 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, 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 } err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) if err != nil { + err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -85663,6 +93278,9 @@ func (*VpcV1) NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototy MatchResourceType: core.StringPtr(matchResourceType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -85675,26 +93293,32 @@ func UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype( obj := new(BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) 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, 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, "match_resource_type", &obj.MatchResourceType) if err != nil { + err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -85728,6 +93352,7 @@ func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentity(m map[string]json.Raw obj := new(BackupPolicyScopePrototypeEnterpriseIdentity) 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)) @@ -85759,10 +93384,12 @@ func UnmarshalBackupPolicyScopeAccountReference(m map[string]json.RawMessage, re obj := new(BackupPolicyScopeAccountReference) 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)) @@ -85797,14 +93424,17 @@ func UnmarshalBackupPolicyScopeEnterpriseReference(m map[string]json.RawMessage, obj := new(BackupPolicyScopeEnterpriseReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -85846,22 +93476,27 @@ func UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference(m map[string obj := new(BareMetalServerBootTargetBareMetalServerDiskReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) 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)) @@ -85899,18 +93534,22 @@ func UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializat obj := new(BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) if err != nil { + err = core.SDKErrorf(err, "", "encrypted_password-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) if err != nil { + err = core.SDKErrorf(err, "", "encryption_key-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, "username", &obj.Username) if err != nil { + err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -86009,54 +93648,67 @@ func UnmarshalBareMetalServerNetworkAttachmentByPci(m map[string]json.RawMessage obj := new(BareMetalServerNetworkAttachmentByPci) 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, "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, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-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 } 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, "interface_type", &obj.InterfaceType) if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -86164,58 +93816,72 @@ func UnmarshalBareMetalServerNetworkAttachmentByVlan(m map[string]json.RawMessag obj := new(BareMetalServerNetworkAttachmentByVlan) 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, "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, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-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 } err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) if err != nil { + err = core.SDKErrorf(err, "", "allow_to_float-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, "vlan", &obj.Vlan) if err != nil { + err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -86257,14 +93923,17 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVi obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) 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 } 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)) @@ -86343,38 +94012,47 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVi obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) 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 } 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.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) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -86420,6 +94098,9 @@ func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetwork InterfaceType: core.StringPtr(interfaceType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -86432,18 +94113,22 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAtt obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-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, "interface_type", &obj.InterfaceType) if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -86497,6 +94182,9 @@ func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetwork Vlan: core.Int64Ptr(vlan), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -86509,22 +94197,27 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAtt obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) if err != nil { + err = core.SDKErrorf(err, "", "allow_to_float-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, "vlan", &obj.Vlan) if err != nil { + err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -86696,66 +94389,82 @@ func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.Raw obj := new(BareMetalServerNetworkInterfaceByHiperSocket) 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, "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) if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) if err != nil { + err = core.SDKErrorf(err, "", "floating_ips-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, "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 } err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-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, "interface_type", &obj.InterfaceType) if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -86941,70 +94650,87 @@ func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, obj := new(BareMetalServerNetworkInterfaceByPci) 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, "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) if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) if err != nil { + err = core.SDKErrorf(err, "", "floating_ips-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, "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 } err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-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, "allowed_vlans", &obj.AllowedVlans) if err != nil { + err = core.SDKErrorf(err, "", "allowed_vlans-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -87207,74 +94933,92 @@ func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage obj := new(BareMetalServerNetworkInterfaceByVlan) 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, "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) if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) if err != nil { + err = core.SDKErrorf(err, "", "floating_ips-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, "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 } err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) if err != nil { + err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) if err != nil { + err = core.SDKErrorf(err, "", "security_groups-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-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, "allow_interface_to_float", &obj.AllowInterfaceToFloat) if err != nil { + err = core.SDKErrorf(err, "", "allow_interface_to_float-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, "vlan", &obj.Vlan) if err != nil { + err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -87348,6 +95092,9 @@ func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkI InterfaceType: core.StringPtr(interfaceType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -87360,30 +95107,37 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) 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, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-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 } err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -87466,6 +95220,9 @@ func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkI InterfaceType: core.StringPtr(interfaceType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -87478,34 +95235,42 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) 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, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-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 } 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, "interface_type", &obj.InterfaceType) if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -87611,6 +95376,9 @@ func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkI Vlan: core.Int64Ptr(vlan), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -87623,38 +95391,47 @@ func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInte obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) 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, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) if err != nil { + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-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 } err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) if err != nil { + err = core.SDKErrorf(err, "", "allow_interface_to_float-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, "vlan", &obj.Vlan) if err != nil { + err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -87699,6 +95476,9 @@ func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServer VirtualNetworkInterface: virtualNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -87711,18 +95491,22 @@ func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPri obj := new(BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-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, "interface_type", &obj.InterfaceType) if err != nil { + err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -87752,6 +95536,7 @@ func UnmarshalBareMetalServerProfileBandwidthDependent(m map[string]json.RawMess obj := new(BareMetalServerProfileBandwidthDependent) 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)) @@ -87787,14 +95572,17 @@ func UnmarshalBareMetalServerProfileBandwidthEnum(m map[string]json.RawMessage, obj := new(BareMetalServerProfileBandwidthEnum) 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)) @@ -87827,10 +95615,12 @@ func UnmarshalBareMetalServerProfileBandwidthFixed(m map[string]json.RawMessage, obj := new(BareMetalServerProfileBandwidthFixed) 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)) @@ -87872,22 +95662,27 @@ func UnmarshalBareMetalServerProfileBandwidthRange(m map[string]json.RawMessage, obj := new(BareMetalServerProfileBandwidthRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -87916,6 +95711,7 @@ func UnmarshalBareMetalServerProfileCpuCoreCountDependent(m map[string]json.RawM obj := new(BareMetalServerProfileCpuCoreCountDependent) 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)) @@ -87950,14 +95746,17 @@ func UnmarshalBareMetalServerProfileCpuCoreCountEnum(m map[string]json.RawMessag obj := new(BareMetalServerProfileCpuCoreCountEnum) 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)) @@ -87989,10 +95788,12 @@ func UnmarshalBareMetalServerProfileCpuCoreCountFixed(m map[string]json.RawMessa obj := new(BareMetalServerProfileCpuCoreCountFixed) 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)) @@ -88033,22 +95834,27 @@ func UnmarshalBareMetalServerProfileCpuCoreCountRange(m map[string]json.RawMessa obj := new(BareMetalServerProfileCpuCoreCountRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88077,6 +95883,7 @@ func UnmarshalBareMetalServerProfileCpuSocketCountDependent(m map[string]json.Ra obj := new(BareMetalServerProfileCpuSocketCountDependent) 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)) @@ -88111,14 +95918,17 @@ func UnmarshalBareMetalServerProfileCpuSocketCountEnum(m map[string]json.RawMess obj := new(BareMetalServerProfileCpuSocketCountEnum) 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)) @@ -88150,10 +95960,12 @@ func UnmarshalBareMetalServerProfileCpuSocketCountFixed(m map[string]json.RawMes obj := new(BareMetalServerProfileCpuSocketCountFixed) 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)) @@ -88194,22 +96006,27 @@ func UnmarshalBareMetalServerProfileCpuSocketCountRange(m map[string]json.RawMes obj := new(BareMetalServerProfileCpuSocketCountRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88239,6 +96056,7 @@ func UnmarshalBareMetalServerProfileDiskQuantityDependent(m map[string]json.RawM obj := new(BareMetalServerProfileDiskQuantityDependent) 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)) @@ -88273,14 +96091,17 @@ func UnmarshalBareMetalServerProfileDiskQuantityEnum(m map[string]json.RawMessag obj := new(BareMetalServerProfileDiskQuantityEnum) 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)) @@ -88312,10 +96133,12 @@ func UnmarshalBareMetalServerProfileDiskQuantityFixed(m map[string]json.RawMessa obj := new(BareMetalServerProfileDiskQuantityFixed) 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)) @@ -88356,22 +96179,27 @@ func UnmarshalBareMetalServerProfileDiskQuantityRange(m map[string]json.RawMessa obj := new(BareMetalServerProfileDiskQuantityRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88401,6 +96229,7 @@ func UnmarshalBareMetalServerProfileDiskSizeDependent(m map[string]json.RawMessa obj := new(BareMetalServerProfileDiskSizeDependent) 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)) @@ -88435,14 +96264,17 @@ func UnmarshalBareMetalServerProfileDiskSizeEnum(m map[string]json.RawMessage, r obj := new(BareMetalServerProfileDiskSizeEnum) 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)) @@ -88474,10 +96306,12 @@ func UnmarshalBareMetalServerProfileDiskSizeFixed(m map[string]json.RawMessage, obj := new(BareMetalServerProfileDiskSizeFixed) 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)) @@ -88519,22 +96353,27 @@ func UnmarshalBareMetalServerProfileDiskSizeRange(m map[string]json.RawMessage, obj := new(BareMetalServerProfileDiskSizeRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88554,6 +96393,9 @@ func (*VpcV1) NewBareMetalServerProfileIdentityByHref(href string) (_model *Bare Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88566,6 +96408,7 @@ func UnmarshalBareMetalServerProfileIdentityByHref(m map[string]json.RawMessage, obj := new(BareMetalServerProfileIdentityByHref) 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)) @@ -88585,6 +96428,9 @@ func (*VpcV1) NewBareMetalServerProfileIdentityByName(name string) (_model *Bare Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88597,6 +96443,7 @@ func UnmarshalBareMetalServerProfileIdentityByName(m map[string]json.RawMessage, obj := new(BareMetalServerProfileIdentityByName) 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)) @@ -88625,6 +96472,7 @@ func UnmarshalBareMetalServerProfileMemoryDependent(m map[string]json.RawMessage obj := new(BareMetalServerProfileMemoryDependent) 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)) @@ -88659,14 +96507,17 @@ func UnmarshalBareMetalServerProfileMemoryEnum(m map[string]json.RawMessage, res obj := new(BareMetalServerProfileMemoryEnum) 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)) @@ -88698,10 +96549,12 @@ func UnmarshalBareMetalServerProfileMemoryFixed(m map[string]json.RawMessage, re obj := new(BareMetalServerProfileMemoryFixed) 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)) @@ -88742,22 +96595,27 @@ func UnmarshalBareMetalServerProfileMemoryRange(m map[string]json.RawMessage, re obj := new(BareMetalServerProfileMemoryRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88787,6 +96645,7 @@ func UnmarshalBareMetalServerProfileNetworkAttachmentCountDependent(m map[string obj := new(BareMetalServerProfileNetworkAttachmentCountDependent) 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)) @@ -88821,14 +96680,17 @@ func UnmarshalBareMetalServerProfileNetworkAttachmentCountRange(m map[string]jso obj := new(BareMetalServerProfileNetworkAttachmentCountRange) 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88858,6 +96720,7 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCountDependent(m map[string] obj := new(BareMetalServerProfileNetworkInterfaceCountDependent) 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)) @@ -88892,14 +96755,122 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCountRange(m map[string]json obj := new(BareMetalServerProfileNetworkInterfaceCountRange) 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerPrototypeVPCVPCIdentityByCRN : BareMetalServerPrototypeVPCVPCIdentityByCRN struct +// This model "extends" BareMetalServerPrototypeVPC +type BareMetalServerPrototypeVPCVPCIdentityByCRN struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` +} + +// NewBareMetalServerPrototypeVPCVPCIdentityByCRN : Instantiate BareMetalServerPrototypeVPCVPCIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrototypeVPCVPCIdentityByCRN(crn string) (_model *BareMetalServerPrototypeVPCVPCIdentityByCRN, err error) { + _model = &BareMetalServerPrototypeVPCVPCIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*BareMetalServerPrototypeVPCVPCIdentityByCRN) isaBareMetalServerPrototypeVPC() bool { + return true +} + +// UnmarshalBareMetalServerPrototypeVPCVPCIdentityByCRN unmarshals an instance of BareMetalServerPrototypeVPCVPCIdentityByCRN from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeVPCVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeVPCVPCIdentityByCRN) + 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 +} + +// BareMetalServerPrototypeVPCVPCIdentityByHref : BareMetalServerPrototypeVPCVPCIdentityByHref struct +// This model "extends" BareMetalServerPrototypeVPC +type BareMetalServerPrototypeVPCVPCIdentityByHref struct { + // The URL for this VPC. + Href *string `json:"href" validate:"required"` +} + +// NewBareMetalServerPrototypeVPCVPCIdentityByHref : Instantiate BareMetalServerPrototypeVPCVPCIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrototypeVPCVPCIdentityByHref(href string) (_model *BareMetalServerPrototypeVPCVPCIdentityByHref, err error) { + _model = &BareMetalServerPrototypeVPCVPCIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*BareMetalServerPrototypeVPCVPCIdentityByHref) isaBareMetalServerPrototypeVPC() bool { + return true +} + +// UnmarshalBareMetalServerPrototypeVPCVPCIdentityByHref unmarshals an instance of BareMetalServerPrototypeVPCVPCIdentityByHref from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeVPCVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeVPCVPCIdentityByHref) + 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 +} + +// BareMetalServerPrototypeVPCVPCIdentityByID : BareMetalServerPrototypeVPCVPCIdentityByID struct +// This model "extends" BareMetalServerPrototypeVPC +type BareMetalServerPrototypeVPCVPCIdentityByID struct { + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` +} + +// NewBareMetalServerPrototypeVPCVPCIdentityByID : Instantiate BareMetalServerPrototypeVPCVPCIdentityByID (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerPrototypeVPCVPCIdentityByID(id string) (_model *BareMetalServerPrototypeVPCVPCIdentityByID, err error) { + _model = &BareMetalServerPrototypeVPCVPCIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*BareMetalServerPrototypeVPCVPCIdentityByID) isaBareMetalServerPrototypeVPC() bool { + return true +} + +// UnmarshalBareMetalServerPrototypeVPCVPCIdentityByID unmarshals an instance of BareMetalServerPrototypeVPCVPCIdentityByID from the specified map of raw messages. +func UnmarshalBareMetalServerPrototypeVPCVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPrototypeVPCVPCIdentityByID) + 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)) @@ -88929,11 +96900,7 @@ type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { 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"` + VPC BareMetalServerPrototypeVPCIntf `json:"vpc,omitempty"` // The zone this bare metal server will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -88954,6 +96921,9 @@ func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment(init PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -88966,42 +96936,52 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[s obj := new(BareMetalServerPrototypeBareMetalServerByNetworkAttachment) err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) if err != nil { + err = core.SDKErrorf(err, "", "initialization-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, "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) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) if err != nil { + err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalBareMetalServerPrototypeVPC) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -89031,11 +97011,7 @@ type BareMetalServerPrototypeBareMetalServerByNetworkInterface struct { 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"` + VPC BareMetalServerPrototypeVPCIntf `json:"vpc,omitempty"` // The zone this bare metal server will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -89056,6 +97032,9 @@ func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkInterface(initi PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89068,42 +97047,52 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface(m map[st obj := new(BareMetalServerPrototypeBareMetalServerByNetworkInterface) err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) if err != nil { + err = core.SDKErrorf(err, "", "initialization-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, "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) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) if err != nil { + err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalBareMetalServerPrototypeVPC) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -89124,6 +97113,9 @@ func (*VpcV1) NewCatalogOfferingIdentityCatalogOfferingByCRN(crn string) (_model CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89136,6 +97128,7 @@ func UnmarshalCatalogOfferingIdentityCatalogOfferingByCRN(m map[string]json.RawM obj := new(CatalogOfferingIdentityCatalogOfferingByCRN) 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)) @@ -89156,6 +97149,9 @@ func (*VpcV1) NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(crn s CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89168,6 +97164,7 @@ func UnmarshalCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(m map[st obj := new(CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN) 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)) @@ -89187,6 +97184,9 @@ func (*VpcV1) NewCertificateInstanceIdentityByCRN(crn string) (_model *Certifica CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89199,6 +97199,7 @@ func UnmarshalCertificateInstanceIdentityByCRN(m map[string]json.RawMessage, res obj := new(CertificateInstanceIdentityByCRN) 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)) @@ -89218,6 +97219,9 @@ func (*VpcV1) NewCloudObjectStorageBucketIdentityByCRN(crn string) (_model *Clou CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89230,6 +97234,7 @@ func UnmarshalCloudObjectStorageBucketIdentityByCRN(m map[string]json.RawMessage obj := new(CloudObjectStorageBucketIdentityByCRN) 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)) @@ -89249,6 +97254,9 @@ func (*VpcV1) NewCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentit Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89261,6 +97269,7 @@ func UnmarshalCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityBy obj := new(CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) 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)) @@ -89280,6 +97289,9 @@ func (*VpcV1) NewDnsInstanceIdentityByCRN(crn string) (_model *DnsInstanceIdenti CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89292,6 +97304,7 @@ func UnmarshalDnsInstanceIdentityByCRN(m map[string]json.RawMessage, result inte obj := new(DnsInstanceIdentityByCRN) 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)) @@ -89310,6 +97323,9 @@ func (*VpcV1) NewDnsZoneIdentityByID(id string) (_model *DnsZoneIdentityByID, er ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89322,6 +97338,7 @@ func UnmarshalDnsZoneIdentityByID(m map[string]json.RawMessage, result interface obj := new(DnsZoneIdentityByID) 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)) @@ -89341,6 +97358,9 @@ func (*VpcV1) NewDedicatedHostGroupIdentityByCRN(crn string) (_model *DedicatedH CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89353,6 +97373,7 @@ func UnmarshalDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, resu obj := new(DedicatedHostGroupIdentityByCRN) 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)) @@ -89372,6 +97393,9 @@ func (*VpcV1) NewDedicatedHostGroupIdentityByHref(href string) (_model *Dedicate Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89384,6 +97408,7 @@ func UnmarshalDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, res obj := new(DedicatedHostGroupIdentityByHref) 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)) @@ -89403,6 +97428,9 @@ func (*VpcV1) NewDedicatedHostGroupIdentityByID(id string) (_model *DedicatedHos ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89415,6 +97443,7 @@ func UnmarshalDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, resul obj := new(DedicatedHostGroupIdentityByID) 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)) @@ -89434,6 +97463,9 @@ func (*VpcV1) NewDedicatedHostProfileIdentityByHref(href string) (_model *Dedica Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89446,6 +97478,7 @@ func UnmarshalDedicatedHostProfileIdentityByHref(m map[string]json.RawMessage, r obj := new(DedicatedHostProfileIdentityByHref) 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)) @@ -89465,6 +97498,9 @@ func (*VpcV1) NewDedicatedHostProfileIdentityByName(name string) (_model *Dedica Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -89477,6 +97513,7 @@ func UnmarshalDedicatedHostProfileIdentityByName(m map[string]json.RawMessage, r obj := new(DedicatedHostProfileIdentityByName) 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)) @@ -89505,6 +97542,7 @@ func UnmarshalDedicatedHostProfileMemoryDependent(m map[string]json.RawMessage, obj := new(DedicatedHostProfileMemoryDependent) 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)) @@ -89539,14 +97577,17 @@ func UnmarshalDedicatedHostProfileMemoryEnum(m map[string]json.RawMessage, resul obj := new(DedicatedHostProfileMemoryEnum) 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)) @@ -89578,10 +97619,12 @@ func UnmarshalDedicatedHostProfileMemoryFixed(m map[string]json.RawMessage, resu obj := new(DedicatedHostProfileMemoryFixed) 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)) @@ -89622,22 +97665,27 @@ func UnmarshalDedicatedHostProfileMemoryRange(m map[string]json.RawMessage, resu obj := new(DedicatedHostProfileMemoryRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -89666,6 +97714,7 @@ func UnmarshalDedicatedHostProfileSocketDependent(m map[string]json.RawMessage, obj := new(DedicatedHostProfileSocketDependent) 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)) @@ -89700,14 +97749,17 @@ func UnmarshalDedicatedHostProfileSocketEnum(m map[string]json.RawMessage, resul obj := new(DedicatedHostProfileSocketEnum) 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)) @@ -89739,10 +97791,12 @@ func UnmarshalDedicatedHostProfileSocketFixed(m map[string]json.RawMessage, resu obj := new(DedicatedHostProfileSocketFixed) 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)) @@ -89783,22 +97837,27 @@ func UnmarshalDedicatedHostProfileSocketRange(m map[string]json.RawMessage, resu obj := new(DedicatedHostProfileSocketRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -89827,6 +97886,7 @@ func UnmarshalDedicatedHostProfileVcpuDependent(m map[string]json.RawMessage, re obj := new(DedicatedHostProfileVcpuDependent) 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)) @@ -89861,14 +97921,17 @@ func UnmarshalDedicatedHostProfileVcpuEnum(m map[string]json.RawMessage, result obj := new(DedicatedHostProfileVcpuEnum) 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)) @@ -89900,10 +97963,12 @@ func UnmarshalDedicatedHostProfileVcpuFixed(m map[string]json.RawMessage, result obj := new(DedicatedHostProfileVcpuFixed) 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)) @@ -89944,22 +98009,27 @@ func UnmarshalDedicatedHostProfileVcpuRange(m map[string]json.RawMessage, result obj := new(DedicatedHostProfileVcpuRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -89992,6 +98062,9 @@ func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByGroup(profile DedicatedHos Group: group, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -90004,22 +98077,27 @@ func UnmarshalDedicatedHostPrototypeDedicatedHostByGroup(m map[string]json.RawMe obj := new(DedicatedHostPrototypeDedicatedHostByGroup) err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "instance_placement_enabled-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, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90054,6 +98132,9 @@ func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByZone(profile DedicatedHost Zone: zone, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -90066,26 +98147,32 @@ func UnmarshalDedicatedHostPrototypeDedicatedHostByZone(m map[string]json.RawMes obj := new(DedicatedHostPrototypeDedicatedHostByZone) err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "instance_placement_enabled-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, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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, "group", &obj.Group, UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90107,6 +98194,9 @@ func (*VpcV1) NewEncryptionKeyIdentityByCRN(crn string) (_model *EncryptionKeyId CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -90119,6 +98209,7 @@ func UnmarshalEncryptionKeyIdentityByCRN(m map[string]json.RawMessage, result in obj := new(EncryptionKeyIdentityByCRN) 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)) @@ -90156,10 +98247,12 @@ func UnmarshalEndpointGatewayReservedIPReservedIPIdentity(m map[string]json.RawM obj := new(EndpointGatewayReservedIPReservedIPIdentity) 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)) @@ -90193,6 +98286,9 @@ func (*VpcV1) NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext(subne Subnet: subnet, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -90205,18 +98301,22 @@ func UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext(m map[st obj := new(EndpointGatewayReservedIPReservedIPPrototypeTargetContext) 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 } 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)) @@ -90260,10 +98360,12 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity(m map[s obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) 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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90308,10 +98410,12 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentit obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) 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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90343,10 +98447,12 @@ func UnmarshalEndpointGatewayTargetProviderCloudServiceReference(m map[string]js obj := new(EndpointGatewayTargetProviderCloudServiceReference) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-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)) @@ -90379,10 +98485,12 @@ func UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference(m map[ obj := new(EndpointGatewayTargetProviderInfrastructureServiceReference) 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)) @@ -90415,6 +98523,9 @@ func (*VpcV1) NewFloatingIPPrototypeFloatingIPByTarget(target FloatingIPTargetPr Target: target, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -90427,14 +98538,17 @@ func UnmarshalFloatingIPPrototypeFloatingIPByTarget(m map[string]json.RawMessage obj := new(FloatingIPPrototypeFloatingIPByTarget) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90460,6 +98574,9 @@ func (*VpcV1) NewFloatingIPPrototypeFloatingIPByZone(zone ZoneIdentityIntf) (_mo Zone: zone, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -90472,14 +98589,17 @@ func UnmarshalFloatingIPPrototypeFloatingIPByZone(m map[string]json.RawMessage, obj := new(FloatingIPPrototypeFloatingIPByZone) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90526,10 +98646,12 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity(m map obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) 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)) @@ -90576,10 +98698,12 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity(m map[string]json.Ra obj := new(FloatingIPTargetPatchNetworkInterfaceIdentity) 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)) @@ -90621,14 +98745,17 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity(m map[string] obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) 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 } 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)) @@ -90675,10 +98802,12 @@ func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity(m obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) 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)) @@ -90725,10 +98854,12 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity(m map[string]jso obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentity) 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)) @@ -90770,14 +98901,17 @@ func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[str obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) 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 } 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)) @@ -90830,26 +98964,32 @@ func UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference(m map[str obj := new(FloatingIPTargetBareMetalServerNetworkInterfaceReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90902,26 +99042,32 @@ func UnmarshalFloatingIPTargetNetworkInterfaceReference(m map[string]json.RawMes obj := new(FloatingIPTargetNetworkInterfaceReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "resource_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -90966,26 +99112,32 @@ func UnmarshalFloatingIPTargetPublicGatewayReference(m map[string]json.RawMessag obj := new(FloatingIPTargetPublicGatewayReference) 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, UnmarshalPublicGatewayReferenceDeleted) 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)) @@ -91036,34 +99188,42 @@ func UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference(m map[string]json obj := new(FloatingIPTargetVirtualNetworkInterfaceReference) 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, UnmarshalVirtualNetworkInterfaceReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91105,14 +99265,17 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity(m map[string]json. obj := new(FlowLogCollectorTargetPrototypeInstanceIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91150,10 +99313,12 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity(m obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) 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)) @@ -91200,10 +99365,12 @@ func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity(m map[stri obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) 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)) @@ -91245,14 +99412,17 @@ func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentity(m map[string]json.Ra obj := new(FlowLogCollectorTargetPrototypeSubnetIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91294,14 +99464,17 @@ func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity(m map[string]json.RawMe obj := new(FlowLogCollectorTargetPrototypeVPCIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91343,14 +99516,17 @@ func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity(m m obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) 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 } 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)) @@ -91399,30 +99575,37 @@ func UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference(m map[str obj := new(FlowLogCollectorTargetInstanceNetworkAttachmentReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91458,22 +99641,27 @@ func UnmarshalFlowLogCollectorTargetInstanceReference(m map[string]json.RawMessa obj := new(FlowLogCollectorTargetInstanceReference) 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, UnmarshalInstanceReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91524,22 +99712,27 @@ func UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext(m map obj := new(FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) 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)) @@ -91584,26 +99777,32 @@ func UnmarshalFlowLogCollectorTargetSubnetReference(m map[string]json.RawMessage obj := new(FlowLogCollectorTargetSubnetReference) 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, UnmarshalSubnetReferenceDeleted) 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)) @@ -91648,26 +99847,32 @@ func UnmarshalFlowLogCollectorTargetVPCReference(m map[string]json.RawMessage, r obj := new(FlowLogCollectorTargetVPCReference) 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, UnmarshalVPCReferenceDeleted) 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)) @@ -91708,22 +99913,27 @@ func UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentCo obj := new(FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext) 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) 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)) @@ -91743,6 +99953,9 @@ func (*VpcV1) NewImageIdentityByCRN(crn string) (_model *ImageIdentityByCRN, err CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -91755,6 +99968,7 @@ func UnmarshalImageIdentityByCRN(m map[string]json.RawMessage, result interface{ obj := new(ImageIdentityByCRN) 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)) @@ -91774,6 +99988,9 @@ func (*VpcV1) NewImageIdentityByHref(href string) (_model *ImageIdentityByHref, Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -91786,6 +100003,7 @@ func UnmarshalImageIdentityByHref(m map[string]json.RawMessage, result interface obj := new(ImageIdentityByHref) 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)) @@ -91805,6 +100023,9 @@ func (*VpcV1) NewImageIdentityByID(id string) (_model *ImageIdentityByID, err er ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -91817,6 +100038,7 @@ func UnmarshalImageIdentityByID(m map[string]json.RawMessage, result interface{} obj := new(ImageIdentityByID) 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)) @@ -91889,6 +100111,9 @@ func (*VpcV1) NewImagePrototypeImageByFile(file *ImageFilePrototype, operatingSy OperatingSystem: operatingSystem, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -91901,34 +100126,42 @@ func UnmarshalImagePrototypeImageByFile(m map[string]json.RawMessage, result int obj := new(ImagePrototypeImageByFile) err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) if err != nil { + err = core.SDKErrorf(err, "", "deprecation_at-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, "obsolescence_at", &obj.ObsolescenceAt) if err != nil { + err = core.SDKErrorf(err, "", "obsolescence_at-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.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) if err != nil { + err = core.SDKErrorf(err, "", "encrypted_data_key-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, "file", &obj.File, UnmarshalImageFilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "file-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) if err != nil { + err = core.SDKErrorf(err, "", "operating_system-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -91988,6 +100221,9 @@ func (*VpcV1) NewImagePrototypeImageBySourceVolume(sourceVolume VolumeIdentityIn SourceVolume: sourceVolume, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -92000,26 +100236,32 @@ func UnmarshalImagePrototypeImageBySourceVolume(m map[string]json.RawMessage, re obj := new(ImagePrototypeImageBySourceVolume) err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) if err != nil { + err = core.SDKErrorf(err, "", "deprecation_at-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, "obsolescence_at", &obj.ObsolescenceAt) if err != nil { + err = core.SDKErrorf(err, "", "obsolescence_at-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, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92040,6 +100282,9 @@ func (*VpcV1) NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(offer Offering: offering, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -92052,6 +100297,7 @@ func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(m map[st obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByOffering) err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) if err != nil { + err = core.SDKErrorf(err, "", "offering-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92073,6 +100319,9 @@ func (*VpcV1) NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(versio Version: version, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -92085,6 +100334,7 @@ func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(m map[str obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByVersion) err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92131,22 +100381,27 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototype(m map[ obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) if err != nil { + err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manager-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92260,62 +100515,77 @@ func UnmarshalInstanceGroupManagerActionScheduledAction(m map[string]json.RawMes obj := new(InstanceGroupManagerActionScheduledAction) 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_timeout", &obj.AutoDeleteTimeout) if err != nil { + err = core.SDKErrorf(err, "", "auto_delete_timeout-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, "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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) if err != nil { + err = core.SDKErrorf(err, "", "action_type-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.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) if err != nil { + err = core.SDKErrorf(err, "", "last_applied_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) if err != nil { + err = core.SDKErrorf(err, "", "next_run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) if err != nil { + err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92377,50 +100647,62 @@ func UnmarshalInstanceGroupManagerAutoScale(m map[string]json.RawMessage, result obj := new(InstanceGroupManagerAutoScale) 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, "management_enabled", &obj.ManagementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "management_enabled-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, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) if err != nil { + err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) if err != nil { + err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) if err != nil { + err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) if err != nil { + err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92467,6 +100749,9 @@ func (*VpcV1) NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPo PolicyType: core.StringPtr(policyType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -92479,18 +100764,22 @@ func UnmarshalInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolic obj := new(InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) if err != nil { + err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) if err != nil { + err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) if err != nil { + err = core.SDKErrorf(err, "", "policy_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92550,34 +100839,42 @@ func UnmarshalInstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy(m map[s obj := new(InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy) 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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) if err != nil { + err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) if err != nil { + err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) if err != nil { + err = core.SDKErrorf(err, "", "policy_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92623,6 +100920,9 @@ func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScaleProto MaxMembershipCount: core.Int64Ptr(maxMembershipCount), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -92635,30 +100935,37 @@ func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototyp obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "management_enabled-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, "aggregation_window", &obj.AggregationWindow) if err != nil { + err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) if err != nil { + err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) if err != nil { + err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92691,6 +100998,9 @@ func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledProto ManagerType: core.StringPtr(managerType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -92703,14 +101013,17 @@ func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototyp obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype) err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "management_enabled-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, "manager_type", &obj.ManagerType) if err != nil { + err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92760,34 +101073,42 @@ func UnmarshalInstanceGroupManagerScheduled(m map[string]json.RawMessage, result obj := new(InstanceGroupManagerScheduled) 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, "management_enabled", &obj.ManagementEnabled) if err != nil { + err = core.SDKErrorf(err, "", "management_enabled-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, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference) if err != nil { + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) if err != nil { + err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92826,26 +101147,32 @@ func UnmarshalInstanceGroupManagerScheduledActionManagerAutoScale(m map[string]j obj := new(InstanceGroupManagerScheduledActionManagerAutoScale) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) 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, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92891,18 +101218,22 @@ func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScaleProtot obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -92944,14 +101275,17 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNe obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) 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 } 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)) @@ -93030,38 +101364,47 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNe obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) 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 } 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.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) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -93081,6 +101424,9 @@ func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByHref(href string) Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -93093,6 +101439,7 @@ func UnmarshalInstancePatchProfileInstanceProfileIdentityByHref(m map[string]jso obj := new(InstancePatchProfileInstanceProfileIdentityByHref) 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)) @@ -93112,6 +101459,9 @@ func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByName(name string) Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -93124,6 +101474,7 @@ func UnmarshalInstancePatchProfileInstanceProfileIdentityByName(m map[string]jso obj := new(InstancePatchProfileInstanceProfileIdentityByName) 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)) @@ -93165,14 +101516,17 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentity(m map[strin obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -93214,14 +101568,17 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentity(m map[string]jso obj := new(InstancePlacementTargetPatchDedicatedHostIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -93263,14 +101620,17 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentity(m map[s obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -93312,14 +101672,17 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentity(m map[string obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -93361,14 +101724,17 @@ func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentity(m map[strin obj := new(InstancePlacementTargetPrototypePlacementGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -93413,26 +101779,32 @@ func UnmarshalInstancePlacementTargetDedicatedHostGroupReference(m map[string]js obj := new(InstancePlacementTargetDedicatedHostGroupReference) 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, UnmarshalDedicatedHostGroupReferenceDeleted) 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)) @@ -93477,26 +101849,32 @@ func UnmarshalInstancePlacementTargetDedicatedHostReference(m map[string]json.Ra obj := new(InstancePlacementTargetDedicatedHostReference) 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, UnmarshalDedicatedHostReferenceDeleted) 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)) @@ -93541,26 +101919,32 @@ func UnmarshalInstancePlacementTargetPlacementGroupReference(m map[string]json.R obj := new(InstancePlacementTargetPlacementGroupReference) 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, UnmarshalPlacementGroupReferenceDeleted) 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)) @@ -93590,6 +101974,7 @@ func UnmarshalInstanceProfileBandwidthDependent(m map[string]json.RawMessage, re obj := new(InstanceProfileBandwidthDependent) 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)) @@ -93625,14 +102010,17 @@ func UnmarshalInstanceProfileBandwidthEnum(m map[string]json.RawMessage, result obj := new(InstanceProfileBandwidthEnum) 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)) @@ -93665,10 +102053,12 @@ func UnmarshalInstanceProfileBandwidthFixed(m map[string]json.RawMessage, result obj := new(InstanceProfileBandwidthFixed) 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)) @@ -93710,22 +102100,27 @@ func UnmarshalInstanceProfileBandwidthRange(m map[string]json.RawMessage, result obj := new(InstanceProfileBandwidthRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -93754,6 +102149,7 @@ func UnmarshalInstanceProfileDiskQuantityDependent(m map[string]json.RawMessage, obj := new(InstanceProfileDiskQuantityDependent) 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)) @@ -93788,14 +102184,17 @@ func UnmarshalInstanceProfileDiskQuantityEnum(m map[string]json.RawMessage, resu obj := new(InstanceProfileDiskQuantityEnum) 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)) @@ -93827,10 +102226,12 @@ func UnmarshalInstanceProfileDiskQuantityFixed(m map[string]json.RawMessage, res obj := new(InstanceProfileDiskQuantityFixed) 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)) @@ -93871,22 +102272,27 @@ func UnmarshalInstanceProfileDiskQuantityRange(m map[string]json.RawMessage, res obj := new(InstanceProfileDiskQuantityRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -93916,6 +102322,7 @@ func UnmarshalInstanceProfileDiskSizeDependent(m map[string]json.RawMessage, res obj := new(InstanceProfileDiskSizeDependent) 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)) @@ -93950,14 +102357,17 @@ func UnmarshalInstanceProfileDiskSizeEnum(m map[string]json.RawMessage, result i obj := new(InstanceProfileDiskSizeEnum) 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)) @@ -93989,10 +102399,12 @@ func UnmarshalInstanceProfileDiskSizeFixed(m map[string]json.RawMessage, result obj := new(InstanceProfileDiskSizeFixed) 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)) @@ -94033,22 +102445,27 @@ func UnmarshalInstanceProfileDiskSizeRange(m map[string]json.RawMessage, result obj := new(InstanceProfileDiskSizeRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -94077,6 +102494,7 @@ func UnmarshalInstanceProfileGpuDependent(m map[string]json.RawMessage, result i obj := new(InstanceProfileGpuDependent) 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)) @@ -94111,14 +102529,17 @@ func UnmarshalInstanceProfileGpuEnum(m map[string]json.RawMessage, result interf obj := new(InstanceProfileGpuEnum) 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)) @@ -94150,10 +102571,12 @@ func UnmarshalInstanceProfileGpuFixed(m map[string]json.RawMessage, result inter obj := new(InstanceProfileGpuFixed) 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)) @@ -94182,6 +102605,7 @@ func UnmarshalInstanceProfileGpuMemoryDependent(m map[string]json.RawMessage, re obj := new(InstanceProfileGpuMemoryDependent) 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)) @@ -94216,14 +102640,17 @@ func UnmarshalInstanceProfileGpuMemoryEnum(m map[string]json.RawMessage, result obj := new(InstanceProfileGpuMemoryEnum) 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)) @@ -94255,10 +102682,12 @@ func UnmarshalInstanceProfileGpuMemoryFixed(m map[string]json.RawMessage, result obj := new(InstanceProfileGpuMemoryFixed) 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)) @@ -94299,22 +102728,27 @@ func UnmarshalInstanceProfileGpuMemoryRange(m map[string]json.RawMessage, result obj := new(InstanceProfileGpuMemoryRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -94355,22 +102789,27 @@ func UnmarshalInstanceProfileGpuRange(m map[string]json.RawMessage, result inter obj := new(InstanceProfileGpuRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -94390,6 +102829,9 @@ func (*VpcV1) NewInstanceProfileIdentityByHref(href string) (_model *InstancePro Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -94402,6 +102844,7 @@ func UnmarshalInstanceProfileIdentityByHref(m map[string]json.RawMessage, result obj := new(InstanceProfileIdentityByHref) 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)) @@ -94421,6 +102864,9 @@ func (*VpcV1) NewInstanceProfileIdentityByName(name string) (_model *InstancePro Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -94433,6 +102879,7 @@ func UnmarshalInstanceProfileIdentityByName(m map[string]json.RawMessage, result obj := new(InstanceProfileIdentityByName) 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)) @@ -94461,6 +102908,7 @@ func UnmarshalInstanceProfileMemoryDependent(m map[string]json.RawMessage, resul obj := new(InstanceProfileMemoryDependent) 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)) @@ -94495,14 +102943,17 @@ func UnmarshalInstanceProfileMemoryEnum(m map[string]json.RawMessage, result int obj := new(InstanceProfileMemoryEnum) 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)) @@ -94534,10 +102985,12 @@ func UnmarshalInstanceProfileMemoryFixed(m map[string]json.RawMessage, result in obj := new(InstanceProfileMemoryFixed) 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)) @@ -94578,22 +103031,27 @@ func UnmarshalInstanceProfileMemoryRange(m map[string]json.RawMessage, result in obj := new(InstanceProfileMemoryRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -94623,6 +103081,7 @@ func UnmarshalInstanceProfileNumaCountDependent(m map[string]json.RawMessage, re obj := new(InstanceProfileNumaCountDependent) 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)) @@ -94654,10 +103113,12 @@ func UnmarshalInstanceProfileNumaCountFixed(m map[string]json.RawMessage, result obj := new(InstanceProfileNumaCountFixed) 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)) @@ -94686,6 +103147,7 @@ func UnmarshalInstanceProfileNetworkAttachmentCountDependent(m map[string]json.R obj := new(InstanceProfileNetworkAttachmentCountDependent) 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)) @@ -94720,14 +103182,17 @@ func UnmarshalInstanceProfileNetworkAttachmentCountRange(m map[string]json.RawMe obj := new(InstanceProfileNetworkAttachmentCountRange) 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -94756,6 +103221,7 @@ func UnmarshalInstanceProfileNetworkInterfaceCountDependent(m map[string]json.Ra obj := new(InstanceProfileNetworkInterfaceCountDependent) 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)) @@ -94790,14 +103256,17 @@ func UnmarshalInstanceProfileNetworkInterfaceCountRange(m map[string]json.RawMes obj := new(InstanceProfileNetworkInterfaceCountRange) 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) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -94826,6 +103295,7 @@ func UnmarshalInstanceProfilePortSpeedDependent(m map[string]json.RawMessage, re obj := new(InstanceProfilePortSpeedDependent) 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)) @@ -94857,10 +103327,12 @@ func UnmarshalInstanceProfilePortSpeedFixed(m map[string]json.RawMessage, result obj := new(InstanceProfilePortSpeedFixed) 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)) @@ -94889,6 +103361,7 @@ func UnmarshalInstanceProfileVcpuDependent(m map[string]json.RawMessage, result obj := new(InstanceProfileVcpuDependent) 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)) @@ -94923,14 +103396,17 @@ func UnmarshalInstanceProfileVcpuEnum(m map[string]json.RawMessage, result inter obj := new(InstanceProfileVcpuEnum) 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)) @@ -94962,10 +103438,12 @@ func UnmarshalInstanceProfileVcpuFixed(m map[string]json.RawMessage, result inte obj := new(InstanceProfileVcpuFixed) 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)) @@ -95006,22 +103484,27 @@ func UnmarshalInstanceProfileVcpuRange(m map[string]json.RawMessage, result inte obj := new(InstanceProfileVcpuRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -95051,6 +103534,7 @@ func UnmarshalInstanceProfileVolumeBandwidthDependent(m map[string]json.RawMessa obj := new(InstanceProfileVolumeBandwidthDependent) 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)) @@ -95086,14 +103570,17 @@ func UnmarshalInstanceProfileVolumeBandwidthEnum(m map[string]json.RawMessage, r obj := new(InstanceProfileVolumeBandwidthEnum) 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)) @@ -95125,10 +103612,12 @@ func UnmarshalInstanceProfileVolumeBandwidthFixed(m map[string]json.RawMessage, obj := new(InstanceProfileVolumeBandwidthFixed) 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)) @@ -95170,22 +103659,27 @@ func UnmarshalInstanceProfileVolumeBandwidthRange(m map[string]json.RawMessage, obj := new(InstanceProfileVolumeBandwidthRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -95270,8 +103764,7 @@ type InstancePrototypeInstanceByCatalogOffering struct { // // If an offering is specified, the latest version of that offering will be used. // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // The specified offering or offering version may be in a different account, subject // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` @@ -95309,82 +103802,102 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe obj := new(InstancePrototypeInstanceByCatalogOffering) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -95501,82 +104014,102 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res obj := new(InstancePrototypeInstanceByImage) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -95690,78 +104223,97 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes obj := new(InstancePrototypeInstanceBySourceSnapshot) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -95883,6 +104435,9 @@ func (*VpcV1) NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate Instan SourceTemplate: sourceTemplate, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -95895,90 +104450,112 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes obj := new(InstancePrototypeInstanceBySourceTemplate) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_template-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -96092,78 +104669,97 @@ func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, re obj := new(InstancePrototypeInstanceByVolume) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -96183,6 +104779,9 @@ func (*VpcV1) NewInstanceTemplateIdentityByCRN(crn string) (_model *InstanceTemp CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -96195,6 +104794,7 @@ func UnmarshalInstanceTemplateIdentityByCRN(m map[string]json.RawMessage, result obj := new(InstanceTemplateIdentityByCRN) 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)) @@ -96214,6 +104814,9 @@ func (*VpcV1) NewInstanceTemplateIdentityByHref(href string) (_model *InstanceTe Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -96226,6 +104829,7 @@ func UnmarshalInstanceTemplateIdentityByHref(m map[string]json.RawMessage, resul obj := new(InstanceTemplateIdentityByHref) 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)) @@ -96245,6 +104849,9 @@ func (*VpcV1) NewInstanceTemplateIdentityByID(id string) (_model *InstanceTempla ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -96257,6 +104864,7 @@ func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result obj := new(InstanceTemplateIdentityByID) 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)) @@ -96339,8 +104947,7 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // // If an offering is specified, the latest version of that offering will be used. // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // The specified offering or offering version may be in a different account, subject // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` @@ -96378,82 +104985,102 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -96568,82 +105195,102 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json obj := new(InstanceTemplatePrototypeInstanceTemplateByImage) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -96755,78 +105402,97 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -96946,6 +105612,9 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourc SourceTemplate: sourceTemplate, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -96958,90 +105627,112 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_template-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -97136,8 +105827,7 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // // If an offering is specified, the latest version of that offering will be used. // - // The specified offering or offering version may be in a different account in the same - // [enterprise](https://cloud.ibm.com/docs/account?topic=account-what-is-enterprise), subject + // The specified offering or offering version may be in a different account, subject // to IAM policies. CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` @@ -97175,98 +105865,122 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -97393,98 +106107,122 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[strin obj := new(InstanceTemplateInstanceByImageInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -97608,94 +106346,117 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -97715,6 +106476,9 @@ func (*VpcV1) NewKeyIdentityByCRN(crn string) (_model *KeyIdentityByCRN, err err CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97727,6 +106491,7 @@ func UnmarshalKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) obj := new(KeyIdentityByCRN) 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)) @@ -97747,6 +106512,9 @@ func (*VpcV1) NewKeyIdentityByFingerprint(fingerprint string) (_model *KeyIdenti Fingerprint: core.StringPtr(fingerprint), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97759,6 +106527,7 @@ func UnmarshalKeyIdentityByFingerprint(m map[string]json.RawMessage, result inte obj := new(KeyIdentityByFingerprint) err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) if err != nil { + err = core.SDKErrorf(err, "", "fingerprint-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -97778,6 +106547,9 @@ func (*VpcV1) NewKeyIdentityByHref(href string) (_model *KeyIdentityByHref, err Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97790,6 +106562,7 @@ func UnmarshalKeyIdentityByHref(m map[string]json.RawMessage, result interface{} obj := new(KeyIdentityByHref) 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)) @@ -97809,6 +106582,9 @@ func (*VpcV1) NewKeyIdentityByID(id string) (_model *KeyIdentityByID, err error) ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97821,6 +106597,7 @@ func UnmarshalKeyIdentityByID(m map[string]json.RawMessage, result interface{}) obj := new(KeyIdentityByID) 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)) @@ -97840,6 +106617,9 @@ func (*VpcV1) NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketI Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97852,6 +106632,7 @@ func UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIden obj := new(LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) 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)) @@ -97871,6 +106652,9 @@ func (*VpcV1) NewLoadBalancerIdentityByCRN(crn string) (_model *LoadBalancerIden CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97883,6 +106667,7 @@ func UnmarshalLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result int obj := new(LoadBalancerIdentityByCRN) 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)) @@ -97902,6 +106687,9 @@ func (*VpcV1) NewLoadBalancerIdentityByHref(href string) (_model *LoadBalancerId Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97914,6 +106702,7 @@ func UnmarshalLoadBalancerIdentityByHref(m map[string]json.RawMessage, result in obj := new(LoadBalancerIdentityByHref) 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)) @@ -97933,6 +106722,9 @@ func (*VpcV1) NewLoadBalancerIdentityByID(id string) (_model *LoadBalancerIdenti ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97945,6 +106737,77 @@ func UnmarshalLoadBalancerIdentityByID(m map[string]json.RawMessage, result inte obj := new(LoadBalancerIdentityByID) 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 +} + +// LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref : LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerListenerDefaultPoolPatch +type LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerDefaultPoolPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref) + 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 +} + +// LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID : LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerListenerDefaultPoolPatch +type LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID) isaLoadBalancerListenerDefaultPoolPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID) + 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)) @@ -97964,6 +106827,9 @@ func (*VpcV1) NewLoadBalancerListenerIdentityByHref(href string) (_model *LoadBa Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -97976,6 +106842,7 @@ func UnmarshalLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, r obj := new(LoadBalancerListenerIdentityByHref) 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)) @@ -97995,6 +106862,9 @@ func (*VpcV1) NewLoadBalancerListenerIdentityByID(id string) (_model *LoadBalanc ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98007,15 +106877,16 @@ func UnmarshalLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, res obj := new(LoadBalancerListenerIdentityByID) 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 } -// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct +// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch struct // This model "extends" LoadBalancerListenerPolicyTargetPatch -type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch struct { +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch struct { // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code,omitempty"` @@ -98026,23 +106897,26 @@ type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch URI *string `json:"uri,omitempty"` } -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch) +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98068,10 +106942,12 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRed obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98080,8 +106956,8 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRed // LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. // Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref // This model "extends" LoadBalancerListenerPolicyTargetPatch type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity struct { // The unique identifier for this load balancer pool. @@ -98109,19 +106985,21 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity(m ma obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) 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 } -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype struct // This model "extends" LoadBalancerListenerPolicyTargetPrototype -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype struct { +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype struct { // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` @@ -98132,33 +107010,39 @@ type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectP URI *string `json:"uri,omitempty"` } -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype{ +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype{ HTTPStatusCode: core.Int64Ptr(httpStatusCode), Listener: listener, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype) +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98182,6 +107066,9 @@ func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPo URL: core.StringPtr(url), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98194,10 +107081,12 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolic obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98206,8 +107095,8 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolic // LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. // Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref // This model "extends" LoadBalancerListenerPolicyTargetPrototype type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity struct { // The unique identifier for this load balancer pool. @@ -98235,19 +107124,21 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity( obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) 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 } -// LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect : LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct +// LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect : LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect struct // This model "extends" LoadBalancerListenerPolicyTarget -type LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct { +type LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect struct { // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` @@ -98257,23 +107148,26 @@ type LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect struct { URI *string `json:"uri,omitempty"` } -func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) isaLoadBalancerListenerPolicyTarget() bool { +func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect) isaLoadBalancerListenerPolicyTarget() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) if err != nil { + err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "uri", &obj.URI) if err != nil { + err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98299,10 +107193,12 @@ func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirect obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) if err != nil { + err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98335,80 +107231,92 @@ func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference(m map[st obj := new(LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// LoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityByHref struct +// LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct // This model "extends" LoadBalancerPoolIdentity -type LoadBalancerPoolIdentityByHref struct { +type LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { // The pool's canonical URL. Href *string `json:"href" validate:"required"` } -// NewLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerPoolIdentityByHref{ +// NewLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } -func (*LoadBalancerPoolIdentityByHref) isaLoadBalancerPoolIdentity() bool { +func (*LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerPoolIdentity() bool { return true } -// UnmarshalLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolIdentityByHref) +// UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) 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 } -// LoadBalancerPoolIdentityByID : LoadBalancerPoolIdentityByID struct +// LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct // This model "extends" LoadBalancerPoolIdentity -type LoadBalancerPoolIdentityByID struct { +type LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { // The unique identifier for this load balancer pool. ID *string `json:"id" validate:"required"` } -// NewLoadBalancerPoolIdentityByID : Instantiate LoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerPoolIdentityByID{ +// NewLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } -func (*LoadBalancerPoolIdentityByID) isaLoadBalancerPoolIdentity() bool { +func (*LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerPoolIdentity() bool { return true } -// UnmarshalLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolIdentityByID) +// UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) 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)) @@ -98420,9 +107328,8 @@ func UnmarshalLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result type LoadBalancerPoolMemberTargetPrototypeIP struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -98432,6 +107339,9 @@ func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeIP(address string) (_model Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98444,6 +107354,7 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeIP(m map[string]json.RawMessa obj := new(LoadBalancerPoolMemberTargetPrototypeIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98485,14 +107396,17 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity(m map[string obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98504,9 +107418,8 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity(m map[string type LoadBalancerPoolMemberTargetIP struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -98519,6 +107432,7 @@ func UnmarshalLoadBalancerPoolMemberTargetIP(m map[string]json.RawMessage, resul obj := new(LoadBalancerPoolMemberTargetIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98554,22 +107468,27 @@ func UnmarshalLoadBalancerPoolMemberTargetInstanceReference(m map[string]json.Ra obj := new(LoadBalancerPoolMemberTargetInstanceReference) 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, UnmarshalInstanceReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -98589,6 +107508,9 @@ func (*VpcV1) NewLoadBalancerProfileIdentityByHref(href string) (_model *LoadBal Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98601,6 +107523,7 @@ func UnmarshalLoadBalancerProfileIdentityByHref(m map[string]json.RawMessage, re obj := new(LoadBalancerProfileIdentityByHref) 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)) @@ -98620,6 +107543,9 @@ func (*VpcV1) NewLoadBalancerProfileIdentityByName(name string) (_model *LoadBal Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98632,6 +107558,7 @@ func UnmarshalLoadBalancerProfileIdentityByName(m map[string]json.RawMessage, re obj := new(LoadBalancerProfileIdentityByName) 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)) @@ -98660,6 +107587,7 @@ func UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent(m map[string]j obj := new(LoadBalancerProfileInstanceGroupsSupportedDependent) 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)) @@ -98691,10 +107619,12 @@ func UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed(m map[string]json. obj := new(LoadBalancerProfileInstanceGroupsSupportedFixed) 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)) @@ -98723,6 +107653,7 @@ func UnmarshalLoadBalancerProfileRouteModeSupportedDependent(m map[string]json.R obj := new(LoadBalancerProfileRouteModeSupportedDependent) 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)) @@ -98754,10 +107685,12 @@ func UnmarshalLoadBalancerProfileRouteModeSupportedFixed(m map[string]json.RawMe obj := new(LoadBalancerProfileRouteModeSupportedFixed) 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)) @@ -98786,6 +107719,7 @@ func UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent(m map[string]j obj := new(LoadBalancerProfileSecurityGroupsSupportedDependent) 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)) @@ -98817,10 +107751,12 @@ func UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed(m map[string]json. obj := new(LoadBalancerProfileSecurityGroupsSupportedFixed) 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)) @@ -98849,6 +107785,7 @@ func UnmarshalLoadBalancerProfileUDPSupportedDependent(m map[string]json.RawMess obj := new(LoadBalancerProfileUDPSupportedDependent) 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)) @@ -98880,10 +107817,12 @@ func UnmarshalLoadBalancerProfileUDPSupportedFixed(m map[string]json.RawMessage, obj := new(LoadBalancerProfileUDPSupportedFixed) 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)) @@ -98903,6 +107842,9 @@ func (*VpcV1) NewNetworkACLIdentityByCRN(crn string) (_model *NetworkACLIdentity CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98915,6 +107857,7 @@ func UnmarshalNetworkACLIdentityByCRN(m map[string]json.RawMessage, result inter obj := new(NetworkACLIdentityByCRN) 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)) @@ -98934,6 +107877,9 @@ func (*VpcV1) NewNetworkACLIdentityByHref(href string) (_model *NetworkACLIdenti Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98946,6 +107892,7 @@ func UnmarshalNetworkACLIdentityByHref(m map[string]json.RawMessage, result inte obj := new(NetworkACLIdentityByHref) 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)) @@ -98965,6 +107912,9 @@ func (*VpcV1) NewNetworkACLIdentityByID(id string) (_model *NetworkACLIdentityBy ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -98977,6 +107927,7 @@ func UnmarshalNetworkACLIdentityByID(m map[string]json.RawMessage, result interf obj := new(NetworkACLIdentityByID) 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)) @@ -99006,6 +107957,9 @@ func (*VpcV1) NewNetworkACLPrototypeNetworkACLByRules(vpc VPCIdentityIntf) (_mod VPC: vpc, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99018,18 +107972,22 @@ func UnmarshalNetworkACLPrototypeNetworkACLByRules(m map[string]json.RawMessage, obj := new(NetworkACLPrototypeNetworkACLByRules) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -99059,6 +108017,9 @@ func (*VpcV1) NewNetworkACLPrototypeNetworkACLBySourceNetworkACL(vpc VPCIdentity SourceNetworkACL: sourceNetworkACL, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99071,18 +108032,22 @@ func UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL(m map[string]json. obj := new(NetworkACLPrototypeNetworkACLBySourceNetworkACL) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_network_acl-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -99102,6 +108067,9 @@ func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(href stri Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99114,6 +108082,7 @@ func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(m map[string obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) 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)) @@ -99133,6 +108102,9 @@ func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(id string) ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99145,6 +108117,7 @@ func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(m map[string]j obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) 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)) @@ -99164,6 +108137,9 @@ func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(href Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99176,6 +108152,7 @@ func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(m map[st obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) 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)) @@ -99195,6 +108172,9 @@ func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(id stri ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99207,6 +108187,7 @@ func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(m map[stri obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) 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)) @@ -99286,46 +108267,57 @@ func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll(m map[string]json.RawM obj := new(NetworkACLRuleItemNetworkACLRuleProtocolAll) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -99415,54 +108407,67 @@ func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp(m map[string]json.Raw obj := new(NetworkACLRuleItemNetworkACLRuleProtocolIcmp) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-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)) @@ -99555,62 +108560,77 @@ func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp(m map[string]json.R obj := new(NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_min-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.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) if err != nil { + err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) if err != nil { + err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -99679,6 +108699,9 @@ func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolA Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99691,30 +108714,37 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllP obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-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, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } 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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -99793,6 +108823,9 @@ func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolI Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99805,38 +108838,47 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-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, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } 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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-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)) @@ -99918,6 +108960,9 @@ func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolT Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -99930,46 +108975,57 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpu obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-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, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } 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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_min-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.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) if err != nil { + err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) if err != nil { + err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -100040,6 +109096,9 @@ func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(actio Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100052,34 +109111,42 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(m map[st obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } 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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -100160,6 +109227,9 @@ func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(acti Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100172,42 +109242,52 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(m map[s obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } 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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-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)) @@ -100291,6 +109371,9 @@ func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(ac Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100303,50 +109386,62 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(m map obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } 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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_min-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.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) if err != nil { + err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) if err != nil { + err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -100425,46 +109520,57 @@ func UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll(m map[string]json.RawMessa obj := new(NetworkACLRuleNetworkACLRuleProtocolAll) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -100553,54 +109659,67 @@ func UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp(m map[string]json.RawMess obj := new(NetworkACLRuleNetworkACLRuleProtocolIcmp) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-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)) @@ -100692,62 +109811,77 @@ func UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp(m map[string]json.RawMe obj := new(NetworkACLRuleNetworkACLRuleProtocolTcpudp) err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) if err != nil { + err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) if err != nil { + err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) if err != nil { + err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) if err != nil { + err = core.SDKErrorf(err, "", "destination_port_min-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.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) if err != nil { + err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) if err != nil { + err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -100785,10 +109919,12 @@ func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity(m map[string]json.Ra obj := new(NetworkInterfaceIPPrototypeReservedIPIdentity) 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)) @@ -100822,14 +109958,17 @@ func UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceCont obj := new(NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) 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)) @@ -100849,6 +109988,9 @@ func (*VpcV1) NewOperatingSystemIdentityByHref(href string) (_model *OperatingSy Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100861,6 +110003,7 @@ func UnmarshalOperatingSystemIdentityByHref(m map[string]json.RawMessage, result obj := new(OperatingSystemIdentityByHref) 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)) @@ -100880,6 +110023,9 @@ func (*VpcV1) NewOperatingSystemIdentityByName(name string) (_model *OperatingSy Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -100892,6 +110038,7 @@ func UnmarshalOperatingSystemIdentityByName(m map[string]json.RawMessage, result obj := new(OperatingSystemIdentityByName) 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)) @@ -100937,18 +110084,22 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity(m map[string]js obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -100976,10 +110127,12 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext(m obj := new(PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -100999,6 +110152,9 @@ func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByCRN(crn string) (_m CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -101011,6 +110167,7 @@ func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN(m map[string]json. obj := new(PublicGatewayIdentityPublicGatewayIdentityByCRN) 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)) @@ -101030,6 +110187,9 @@ func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByHref(href string) ( Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -101042,6 +110202,7 @@ func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref(m map[string]json obj := new(PublicGatewayIdentityPublicGatewayIdentityByHref) 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)) @@ -101061,6 +110222,9 @@ func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByID(id string) (_mod ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -101073,6 +110237,7 @@ func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID(m map[string]json.R obj := new(PublicGatewayIdentityPublicGatewayIdentityByID) 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)) @@ -101092,6 +110257,9 @@ func (*VpcV1) NewRegionIdentityByHref(href string) (_model *RegionIdentityByHref Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -101104,6 +110272,7 @@ func UnmarshalRegionIdentityByHref(m map[string]json.RawMessage, result interfac obj := new(RegionIdentityByHref) 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)) @@ -101123,6 +110292,9 @@ func (*VpcV1) NewRegionIdentityByName(name string) (_model *RegionIdentityByName Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -101135,6 +110307,7 @@ func UnmarshalRegionIdentityByName(m map[string]json.RawMessage, result interfac obj := new(RegionIdentityByName) 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)) @@ -101154,6 +110327,9 @@ func (*VpcV1) NewReservationIdentityByCRN(crn string) (_model *ReservationIdenti CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -101166,6 +110342,7 @@ func UnmarshalReservationIdentityByCRN(m map[string]json.RawMessage, result inte obj := new(ReservationIdentityByCRN) 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)) @@ -101185,6 +110362,9 @@ func (*VpcV1) NewReservationIdentityByHref(href string) (_model *ReservationIden Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -101197,6 +110377,7 @@ func UnmarshalReservationIdentityByHref(m map[string]json.RawMessage, result int obj := new(ReservationIdentityByHref) 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)) @@ -101216,6 +110397,9 @@ func (*VpcV1) NewReservationIdentityByID(id string) (_model *ReservationIdentity ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -101228,6 +110412,7 @@ func UnmarshalReservationIdentityByID(m map[string]json.RawMessage, result inter obj := new(ReservationIdentityByID) 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)) @@ -101269,14 +110454,17 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity(m map[string]json obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -101318,14 +110506,17 @@ func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[str obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) 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 } 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)) @@ -101376,22 +110567,27 @@ func UnmarshalReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetCont obj := new(ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) 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)) @@ -101436,26 +110632,32 @@ func UnmarshalReservedIPTargetEndpointGatewayReference(m map[string]json.RawMess obj := new(ReservedIPTargetEndpointGatewayReference) 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, UnmarshalEndpointGatewayReferenceDeleted) 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)) @@ -101491,14 +110693,17 @@ func UnmarshalReservedIPTargetGenericResourceReference(m map[string]json.RawMess obj := new(ReservedIPTargetGenericResourceReference) 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, UnmarshalGenericResourceReferenceDeleted) if err != nil { + err = core.SDKErrorf(err, "", "deleted-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)) @@ -101543,26 +110748,32 @@ func UnmarshalReservedIPTargetLoadBalancerReference(m map[string]json.RawMessage obj := new(ReservedIPTargetLoadBalancerReference) 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, UnmarshalLoadBalancerReferenceDeleted) 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)) @@ -101613,22 +110824,27 @@ func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[strin obj := new(ReservedIPTargetNetworkInterfaceReferenceTargetContext) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) 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)) @@ -101673,26 +110889,32 @@ func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, obj := new(ReservedIPTargetVPNGatewayReference) 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, UnmarshalVPNGatewayReferenceDeleted) 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)) @@ -101737,26 +110959,32 @@ func UnmarshalReservedIPTargetVPNServerReference(m map[string]json.RawMessage, r obj := new(ReservedIPTargetVPNServerReference) 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, UnmarshalVPNServerReferenceDeleted) 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)) @@ -101797,22 +111025,27 @@ func UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetCo obj := new(ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext) 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) 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)) @@ -101832,6 +111065,9 @@ func (*VpcV1) NewResourceGroupIdentityByID(id string) (_model *ResourceGroupIden ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -101844,6 +111080,7 @@ func UnmarshalResourceGroupIdentityByID(m map[string]json.RawMessage, result int obj := new(ResourceGroupIdentityByID) 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)) @@ -101888,26 +111125,32 @@ func UnmarshalRouteCreatorVPNGatewayReference(m map[string]json.RawMessage, resu obj := new(RouteCreatorVPNGatewayReference) 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, UnmarshalVPNGatewayReferenceDeleted) 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)) @@ -101952,26 +111195,32 @@ func UnmarshalRouteCreatorVPNServerReference(m map[string]json.RawMessage, resul obj := new(RouteCreatorVPNServerReference) 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, UnmarshalVPNServerReferenceDeleted) 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)) @@ -101983,9 +111232,8 @@ func UnmarshalRouteCreatorVPNServerReference(m map[string]json.RawMessage, resul type RouteNextHopIP struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -101998,6 +111246,7 @@ func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) ( obj := new(RouteNextHopIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102012,9 +111261,8 @@ func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) ( type RouteNextHopPatchRouteNextHopIP struct { // The sentinel IP address (`0.0.0.0`). // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` } @@ -102036,6 +111284,7 @@ func UnmarshalRouteNextHopPatchRouteNextHopIP(m map[string]json.RawMessage, resu obj := new(RouteNextHopPatchRouteNextHopIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102073,10 +111322,12 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity(m map[string]json.Ra obj := new(RouteNextHopPatchVPNGatewayConnectionIdentity) 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)) @@ -102118,22 +111369,27 @@ func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMes obj := new(RouteNextHopVPNGatewayConnectionReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) 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)) @@ -102148,9 +111404,8 @@ func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMes type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct { // The sentinel IP address (`0.0.0.0`). // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in + // the future. Address *string `json:"address,omitempty"` } @@ -102172,6 +111427,7 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(m map[str obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102209,10 +111465,12 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIden obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) 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)) @@ -102232,6 +111490,9 @@ func (*VpcV1) NewRoutingTableIdentityByHref(href string) (_model *RoutingTableId Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102244,6 +111505,7 @@ func UnmarshalRoutingTableIdentityByHref(m map[string]json.RawMessage, result in obj := new(RoutingTableIdentityByHref) 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)) @@ -102263,6 +111525,9 @@ func (*VpcV1) NewRoutingTableIdentityByID(id string) (_model *RoutingTableIdenti ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102275,6 +111540,7 @@ func UnmarshalRoutingTableIdentityByID(m map[string]json.RawMessage, result inte obj := new(RoutingTableIdentityByID) 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)) @@ -102294,6 +111560,9 @@ func (*VpcV1) NewSecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupId CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102306,6 +111575,7 @@ func UnmarshalSecurityGroupIdentityByCRN(m map[string]json.RawMessage, result in obj := new(SecurityGroupIdentityByCRN) 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)) @@ -102325,6 +111595,9 @@ func (*VpcV1) NewSecurityGroupIdentityByHref(href string) (_model *SecurityGroup Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102337,6 +111610,7 @@ func UnmarshalSecurityGroupIdentityByHref(m map[string]json.RawMessage, result i obj := new(SecurityGroupIdentityByHref) 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)) @@ -102356,6 +111630,9 @@ func (*VpcV1) NewSecurityGroupIdentityByID(id string) (_model *SecurityGroupIden ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102368,6 +111645,211 @@ func UnmarshalSecurityGroupIdentityByID(m map[string]json.RawMessage, result int obj := new(SecurityGroupIdentityByID) 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 +} + +// SecurityGroupRuleLocalPatchCIDR : SecurityGroupRuleLocalPatchCIDR struct +// This model "extends" SecurityGroupRuleLocalPatch +type SecurityGroupRuleLocalPatchCIDR struct { + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +// NewSecurityGroupRuleLocalPatchCIDR : Instantiate SecurityGroupRuleLocalPatchCIDR (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleLocalPatchCIDR(cidrBlock string) (_model *SecurityGroupRuleLocalPatchCIDR, err error) { + _model = &SecurityGroupRuleLocalPatchCIDR{ + CIDRBlock: core.StringPtr(cidrBlock), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*SecurityGroupRuleLocalPatchCIDR) isaSecurityGroupRuleLocalPatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleLocalPatchCIDR unmarshals an instance of SecurityGroupRuleLocalPatchCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalPatchCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalPatchCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleLocalPatchIP : SecurityGroupRuleLocalPatchIP struct +// This model "extends" SecurityGroupRuleLocalPatch +type SecurityGroupRuleLocalPatchIP struct { + // The IP address. + // + // 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"` +} + +// NewSecurityGroupRuleLocalPatchIP : Instantiate SecurityGroupRuleLocalPatchIP (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleLocalPatchIP(address string) (_model *SecurityGroupRuleLocalPatchIP, err error) { + _model = &SecurityGroupRuleLocalPatchIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*SecurityGroupRuleLocalPatchIP) isaSecurityGroupRuleLocalPatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleLocalPatchIP unmarshals an instance of SecurityGroupRuleLocalPatchIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalPatchIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalPatchIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleLocalPrototypeCIDR : SecurityGroupRuleLocalPrototypeCIDR struct +// This model "extends" SecurityGroupRuleLocalPrototype +type SecurityGroupRuleLocalPrototypeCIDR struct { + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +// NewSecurityGroupRuleLocalPrototypeCIDR : Instantiate SecurityGroupRuleLocalPrototypeCIDR (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleLocalPrototypeCIDR(cidrBlock string) (_model *SecurityGroupRuleLocalPrototypeCIDR, err error) { + _model = &SecurityGroupRuleLocalPrototypeCIDR{ + CIDRBlock: core.StringPtr(cidrBlock), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*SecurityGroupRuleLocalPrototypeCIDR) isaSecurityGroupRuleLocalPrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleLocalPrototypeCIDR unmarshals an instance of SecurityGroupRuleLocalPrototypeCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalPrototypeCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalPrototypeCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleLocalPrototypeIP : SecurityGroupRuleLocalPrototypeIP struct +// This model "extends" SecurityGroupRuleLocalPrototype +type SecurityGroupRuleLocalPrototypeIP struct { + // The IP address. + // + // 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"` +} + +// NewSecurityGroupRuleLocalPrototypeIP : Instantiate SecurityGroupRuleLocalPrototypeIP (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleLocalPrototypeIP(address string) (_model *SecurityGroupRuleLocalPrototypeIP, err error) { + _model = &SecurityGroupRuleLocalPrototypeIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*SecurityGroupRuleLocalPrototypeIP) isaSecurityGroupRuleLocalPrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleLocalPrototypeIP unmarshals an instance of SecurityGroupRuleLocalPrototypeIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalPrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalPrototypeIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleLocalCIDR : SecurityGroupRuleLocalCIDR struct +// This model "extends" SecurityGroupRuleLocal +type SecurityGroupRuleLocalCIDR struct { + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +func (*SecurityGroupRuleLocalCIDR) isaSecurityGroupRuleLocal() bool { + return true +} + +// UnmarshalSecurityGroupRuleLocalCIDR unmarshals an instance of SecurityGroupRuleLocalCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleLocalIP : SecurityGroupRuleLocalIP struct +// This model "extends" SecurityGroupRuleLocal +type SecurityGroupRuleLocalIP struct { + // The IP address. + // + // 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 (*SecurityGroupRuleLocalIP) isaSecurityGroupRuleLocal() bool { + return true +} + +// UnmarshalSecurityGroupRuleLocalIP unmarshals an instance of SecurityGroupRuleLocalIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleLocalIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleLocalIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102380,11 +111862,20 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { // The direction of traffic to enforce. Direction *string `json:"direction" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` + // The local IP address or range of local IP addresses to which this rule will allow inbound + // traffic (or from which, for outbound traffic) + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP + // addresses (or from all local IP addresses, for outbound rules). + Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` + // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` @@ -102405,8 +111896,10 @@ const ( ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" @@ -102425,6 +111918,9 @@ func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(directio Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102437,18 +111933,27 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[strin obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) + return + } + 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102466,11 +111971,20 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { // The direction of traffic to enforce. Direction *string `json:"direction" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` + // The local IP address or range of local IP addresses to which this rule will allow inbound + // traffic (or from which, for outbound traffic) + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP + // addresses (or from all local IP addresses, for outbound rules). + Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` + // The protocol to enforce. Protocol *string `json:"protocol" validate:"required"` @@ -102496,8 +112010,10 @@ const ( ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" @@ -102516,6 +112032,9 @@ func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(directi Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102528,26 +112047,37 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[stri obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) + return + } + 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102563,11 +112093,20 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { // The direction of traffic to enforce. Direction *string `json:"direction" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version,omitempty"` + // The local IP address or range of local IP addresses to which this rule will allow inbound + // traffic (or from which, for outbound traffic) + // + // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP + // addresses (or from all local IP addresses, for outbound rules). + Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` + // The inclusive upper bound of TCP/UDP destination port range. // // If specified, `port_min` must also be specified, and must not be larger. If unspecified, @@ -102600,8 +112139,10 @@ const ( ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" @@ -102621,6 +112162,9 @@ func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(direc Protocol: core.StringPtr(protocol), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102633,26 +112177,37 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[st obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "local-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 } 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102662,9 +112217,10 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[st // SecurityGroupRuleRemotePatchCIDR : SecurityGroupRuleRemotePatchCIDR struct // This model "extends" SecurityGroupRuleRemotePatch type SecurityGroupRuleRemotePatchCIDR struct { - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. CIDRBlock *string `json:"cidr_block" validate:"required"` } @@ -102674,6 +112230,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePatchCIDR(cidrBlock string) (_model *Sec CIDRBlock: core.StringPtr(cidrBlock), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102686,6 +112245,7 @@ func UnmarshalSecurityGroupRuleRemotePatchCIDR(m map[string]json.RawMessage, res obj := new(SecurityGroupRuleRemotePatchCIDR) err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102697,9 +112257,8 @@ func UnmarshalSecurityGroupRuleRemotePatchCIDR(m map[string]json.RawMessage, res type SecurityGroupRuleRemotePatchIP struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -102709,6 +112268,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePatchIP(address string) (_model *Securit Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102721,6 +112283,7 @@ func UnmarshalSecurityGroupRuleRemotePatchIP(m map[string]json.RawMessage, resul obj := new(SecurityGroupRuleRemotePatchIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102762,14 +112325,17 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity(m map[string]jso obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102779,9 +112345,10 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity(m map[string]jso // SecurityGroupRuleRemotePrototypeCIDR : SecurityGroupRuleRemotePrototypeCIDR struct // This model "extends" SecurityGroupRuleRemotePrototype type SecurityGroupRuleRemotePrototypeCIDR struct { - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. CIDRBlock *string `json:"cidr_block" validate:"required"` } @@ -102791,6 +112358,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePrototypeCIDR(cidrBlock string) (_model CIDRBlock: core.StringPtr(cidrBlock), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102803,6 +112373,7 @@ func UnmarshalSecurityGroupRuleRemotePrototypeCIDR(m map[string]json.RawMessage, obj := new(SecurityGroupRuleRemotePrototypeCIDR) err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102814,9 +112385,8 @@ func UnmarshalSecurityGroupRuleRemotePrototypeCIDR(m map[string]json.RawMessage, type SecurityGroupRuleRemotePrototypeIP struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -102826,6 +112396,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePrototypeIP(address string) (_model *Sec Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -102838,6 +112411,7 @@ func UnmarshalSecurityGroupRuleRemotePrototypeIP(m map[string]json.RawMessage, r obj := new(SecurityGroupRuleRemotePrototypeIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102879,14 +112453,17 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity(m map[string obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102896,9 +112473,10 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity(m map[string // SecurityGroupRuleRemoteCIDR : SecurityGroupRuleRemoteCIDR struct // This model "extends" SecurityGroupRuleRemote type SecurityGroupRuleRemoteCIDR struct { - // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this - // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt - // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + // The CIDR block. + // + // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address + // blocks in the future. CIDRBlock *string `json:"cidr_block" validate:"required"` } @@ -102911,6 +112489,7 @@ func UnmarshalSecurityGroupRuleRemoteCIDR(m map[string]json.RawMessage, result i obj := new(SecurityGroupRuleRemoteCIDR) err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102922,9 +112501,8 @@ func UnmarshalSecurityGroupRuleRemoteCIDR(m map[string]json.RawMessage, result i type SecurityGroupRuleRemoteIP struct { // The IP address. // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -102937,6 +112515,7 @@ func UnmarshalSecurityGroupRuleRemoteIP(m map[string]json.RawMessage, result int obj := new(SecurityGroupRuleRemoteIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -102972,22 +112551,27 @@ func UnmarshalSecurityGroupRuleRemoteSecurityGroupReference(m map[string]json.Ra obj := new(SecurityGroupRuleRemoteSecurityGroupReference) 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, UnmarshalSecurityGroupReferenceDeleted) 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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -103006,11 +112590,15 @@ type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { // The unique identifier for this security group rule. ID *string `json:"id" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version" validate:"required"` + Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` // The protocol to enforce. @@ -103025,8 +112613,10 @@ const ( ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRuleSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" @@ -103047,26 +112637,37 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.Ra obj := new(SecurityGroupRuleSecurityGroupRuleProtocolAll) err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) + if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) if err != nil { + err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -103085,11 +112686,15 @@ type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { // The unique identifier for this security group rule. ID *string `json:"id" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version" validate:"required"` + Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` // The ICMP traffic code to allow. If absent, all codes are allowed. @@ -103110,8 +112715,10 @@ const ( ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRuleSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" @@ -103132,34 +112739,47 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.R obj := new(SecurityGroupRuleSecurityGroupRuleProtocolIcmp) err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) + if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) 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, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-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)) @@ -103181,11 +112801,15 @@ type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { // The unique identifier for this security group rule. ID *string `json:"id" validate:"required"` - // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they - // are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses + // The IP version to enforce. The format of `local.address`, `remote.address`, + // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. + // + // If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. IPVersion *string `json:"ip_version" validate:"required"` + Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` // The inclusive upper bound of TCP/UDP destination port range. @@ -103206,8 +112830,10 @@ const ( ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.IPVersion property. -// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this property, if they -// are used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses +// The IP version to enforce. The format of `local.address`, `remote.address`, +// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. +// +// If `remote` references a security group, then this rule only applies to IP addresses // (network interfaces) in that group matching this IP version. const ( SecurityGroupRuleSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" @@ -103229,34 +112855,47 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json obj := new(SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) if err != nil { + err = core.SDKErrorf(err, "", "direction-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, "ip_version", &obj.IPVersion) if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) + if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) if err != nil { + err = core.SDKErrorf(err, "", "remote-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 } err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { + err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -103307,22 +112946,27 @@ func UnmarshalSecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferen obj := new(SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) 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)) @@ -103367,26 +113011,32 @@ func UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference(m map[string] obj := new(SecurityGroupTargetReferenceEndpointGatewayReference) 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, UnmarshalEndpointGatewayReferenceDeleted) 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)) @@ -103431,26 +113081,32 @@ func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]jso obj := new(SecurityGroupTargetReferenceLoadBalancerReference) 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, UnmarshalLoadBalancerReferenceDeleted) 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)) @@ -103501,22 +113157,27 @@ func UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext obj := new(SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) 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)) @@ -103561,26 +113222,32 @@ func UnmarshalSecurityGroupTargetReferenceVPNServerReference(m map[string]json.R obj := new(SecurityGroupTargetReferenceVPNServerReference) 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, UnmarshalVPNServerReferenceDeleted) 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)) @@ -103631,34 +113298,42 @@ func UnmarshalSecurityGroupTargetReferenceVirtualNetworkInterfaceReference(m map obj := new(SecurityGroupTargetReferenceVirtualNetworkInterfaceReference) 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, UnmarshalVirtualNetworkInterfaceReferenceDeleted) 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) 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, "", "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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -103678,6 +113353,9 @@ func (*VpcV1) NewShareIdentityByCRN(crn string) (_model *ShareIdentityByCRN, err CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -103690,6 +113368,7 @@ func UnmarshalShareIdentityByCRN(m map[string]json.RawMessage, result interface{ obj := new(ShareIdentityByCRN) 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)) @@ -103709,6 +113388,9 @@ func (*VpcV1) NewShareIdentityByHref(href string) (_model *ShareIdentityByHref, Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -103721,6 +113403,7 @@ func UnmarshalShareIdentityByHref(m map[string]json.RawMessage, result interface obj := new(ShareIdentityByHref) 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)) @@ -103740,6 +113423,9 @@ func (*VpcV1) NewShareIdentityByID(id string) (_model *ShareIdentityByID, err er ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -103752,6 +113438,7 @@ func UnmarshalShareIdentityByID(m map[string]json.RawMessage, result interface{} obj := new(ShareIdentityByID) 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)) @@ -103800,6 +113487,9 @@ func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSec VirtualNetworkInterface: virtualNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -103812,14 +113502,17 @@ func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeSecuri obj := new(ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) if err != nil { + err = core.SDKErrorf(err, "", "transit_encryption-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -103861,6 +113554,9 @@ func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC VPC: vpc, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -103873,14 +113569,17 @@ func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(m obj := new(ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) if err != nil { + err = core.SDKErrorf(err, "", "transit_encryption-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -103922,14 +113621,17 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) 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 } 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)) @@ -104008,38 +113710,47 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) 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 } 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.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) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -104078,18 +113789,22 @@ func UnmarshalShareProfileCapacityDependentRange(m map[string]json.RawMessage, r obj := new(ShareProfileCapacityDependentRange) 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)) @@ -104124,14 +113839,17 @@ func UnmarshalShareProfileCapacityEnum(m map[string]json.RawMessage, result inte 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()) 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)) @@ -104163,10 +113881,12 @@ func UnmarshalShareProfileCapacityFixed(m map[string]json.RawMessage, result int obj := new(ShareProfileCapacityFixed) 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)) @@ -104207,22 +113927,27 @@ func UnmarshalShareProfileCapacityRange(m map[string]json.RawMessage, result int obj := new(ShareProfileCapacityRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -104261,18 +113986,22 @@ func UnmarshalShareProfileIopsDependentRange(m map[string]json.RawMessage, resul obj := new(ShareProfileIopsDependentRange) 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)) @@ -104307,14 +114036,17 @@ func UnmarshalShareProfileIopsEnum(m map[string]json.RawMessage, result interfac obj := new(ShareProfileIopsEnum) 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)) @@ -104346,10 +114078,12 @@ func UnmarshalShareProfileIopsFixed(m map[string]json.RawMessage, result interfa obj := new(ShareProfileIopsFixed) 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)) @@ -104390,22 +114124,27 @@ func UnmarshalShareProfileIopsRange(m map[string]json.RawMessage, result interfa obj := new(ShareProfileIopsRange) 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, "type", &obj.Type) if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -104425,6 +114164,9 @@ func (*VpcV1) NewShareProfileIdentityByHref(href string) (_model *ShareProfileId Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104437,6 +114179,7 @@ func UnmarshalShareProfileIdentityByHref(m map[string]json.RawMessage, result in obj := new(ShareProfileIdentityByHref) 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)) @@ -104456,6 +114199,9 @@ func (*VpcV1) NewShareProfileIdentityByName(name string) (_model *ShareProfileId Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104468,6 +114214,7 @@ func UnmarshalShareProfileIdentityByName(m map[string]json.RawMessage, result in obj := new(ShareProfileIdentityByName) 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)) @@ -104555,6 +114302,9 @@ func (*VpcV1) NewSharePrototypeShareBySize(profile ShareProfileIdentityIntf, zon Size: core.Int64Ptr(size), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104567,50 +114317,62 @@ func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result int obj := new(SharePrototypeShareBySize) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) if err != nil { + err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { + err = core.SDKErrorf(err, "", "access_control_mode-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, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) if err != nil { + err = core.SDKErrorf(err, "", "initial_owner-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.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -104680,6 +114442,9 @@ func (*VpcV1) NewSharePrototypeShareBySourceShare(profile ShareProfileIdentityIn SourceShare: sourceShare, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104692,46 +114457,57 @@ func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, res obj := new(SharePrototypeShareBySourceShare) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) if err != nil { + err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-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.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { + err = core.SDKErrorf(err, "", "replication_cron_spec-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, "source_share", &obj.SourceShare, UnmarshalShareIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -104763,6 +114539,9 @@ func (*VpcV1) NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnap Snapshots: snapshots, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104775,18 +114554,22 @@ func UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapsho obj := new(SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) if err != nil { + err = core.SDKErrorf(err, "", "delete_snapshots_on_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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext) if err != nil { + err = core.SDKErrorf(err, "", "snapshots-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -104806,6 +114589,9 @@ func (*VpcV1) NewSnapshotIdentityByCRN(crn string) (_model *SnapshotIdentityByCR CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104818,6 +114604,7 @@ func UnmarshalSnapshotIdentityByCRN(m map[string]json.RawMessage, result interfa obj := new(SnapshotIdentityByCRN) 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)) @@ -104837,6 +114624,9 @@ func (*VpcV1) NewSnapshotIdentityByHref(href string) (_model *SnapshotIdentityBy Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104849,6 +114639,7 @@ func UnmarshalSnapshotIdentityByHref(m map[string]json.RawMessage, result interf obj := new(SnapshotIdentityByHref) 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)) @@ -104868,6 +114659,9 @@ func (*VpcV1) NewSnapshotIdentityByID(id string) (_model *SnapshotIdentityByID, ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104880,6 +114674,7 @@ func UnmarshalSnapshotIdentityByID(m map[string]json.RawMessage, result interfac obj := new(SnapshotIdentityByID) 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)) @@ -104923,6 +114718,9 @@ func (*VpcV1) NewSnapshotPrototypeSnapshotBySourceSnapshot(sourceSnapshot *Snaps SourceSnapshot: sourceSnapshot, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104935,26 +114733,32 @@ func UnmarshalSnapshotPrototypeSnapshotBySourceSnapshot(m map[string]json.RawMes obj := new(SnapshotPrototypeSnapshotBySourceSnapshot) err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) if err != nil { + err = core.SDKErrorf(err, "", "clones-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -104986,6 +114790,9 @@ func (*VpcV1) NewSnapshotPrototypeSnapshotBySourceVolume(sourceVolume VolumeIden SourceVolume: sourceVolume, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -104998,22 +114805,27 @@ func UnmarshalSnapshotPrototypeSnapshotBySourceVolume(m map[string]json.RawMessa obj := new(SnapshotPrototypeSnapshotBySourceVolume) err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) if err != nil { + err = core.SDKErrorf(err, "", "clones-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -105033,6 +114845,9 @@ func (*VpcV1) NewSubnetIdentityByCRN(crn string) (_model *SubnetIdentityByCRN, e CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105045,6 +114860,7 @@ func UnmarshalSubnetIdentityByCRN(m map[string]json.RawMessage, result interface obj := new(SubnetIdentityByCRN) 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)) @@ -105064,6 +114880,9 @@ func (*VpcV1) NewSubnetIdentityByHref(href string) (_model *SubnetIdentityByHref Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105076,6 +114895,7 @@ func UnmarshalSubnetIdentityByHref(m map[string]json.RawMessage, result interfac obj := new(SubnetIdentityByHref) 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)) @@ -105095,6 +114915,9 @@ func (*VpcV1) NewSubnetIdentityByID(id string) (_model *SubnetIdentityByID, err ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105107,6 +114930,7 @@ func UnmarshalSubnetIdentityByID(m map[string]json.RawMessage, result interface{ obj := new(SubnetIdentityByID) 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)) @@ -105165,6 +114989,9 @@ func (*VpcV1) NewSubnetPrototypeSubnetByCIDR(vpc VPCIdentityIntf, ipv4CIDRBlock Ipv4CIDRBlock: core.StringPtr(ipv4CIDRBlock), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105177,38 +115004,47 @@ func UnmarshalSubnetPrototypeSubnetByCIDR(m map[string]json.RawMessage, result i obj := new(SubnetPrototypeSubnetByCIDR) 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.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) if err != nil { + err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) if err != nil { + err = core.SDKErrorf(err, "", "public_gateway-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, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) if err != nil { + err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-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 } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -105265,6 +115101,9 @@ func (*VpcV1) NewSubnetPrototypeSubnetByTotalCount(vpc VPCIdentityIntf, totalIpv Zone: zone, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105277,38 +115116,47 @@ func UnmarshalSubnetPrototypeSubnetByTotalCount(m map[string]json.RawMessage, re obj := new(SubnetPrototypeSubnetByTotalCount) 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.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) if err != nil { + err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) if err != nil { + err = core.SDKErrorf(err, "", "public_gateway-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, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) if err != nil { + err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-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 } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -105328,6 +115176,9 @@ func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(crn string) CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105340,6 +115191,7 @@ func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(m map[string]js obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByCRN) 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)) @@ -105359,6 +115211,9 @@ func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref(href string Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105371,6 +115226,7 @@ func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByHref(m map[string]j obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByHref) 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)) @@ -105390,6 +115246,9 @@ func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByID(id string) (_ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105402,6 +115261,7 @@ func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByID(m map[string]jso obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByID) 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)) @@ -105421,6 +115281,9 @@ func (*VpcV1) NewTrustedProfileIdentityTrustedProfileByCRN(crn string) (_model * CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105433,6 +115296,7 @@ func UnmarshalTrustedProfileIdentityTrustedProfileByCRN(m map[string]json.RawMes obj := new(TrustedProfileIdentityTrustedProfileByCRN) 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)) @@ -105452,6 +115316,9 @@ func (*VpcV1) NewTrustedProfileIdentityTrustedProfileByID(id string) (_model *Tr ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105464,6 +115331,7 @@ func UnmarshalTrustedProfileIdentityTrustedProfileByID(m map[string]json.RawMess obj := new(TrustedProfileIdentityTrustedProfileByID) 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)) @@ -105504,6 +115372,9 @@ func (*VpcV1) NewVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype(manual Type: core.StringPtr(typeVar), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105516,10 +115387,12 @@ func UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype(m map[str obj := new(VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype) err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manual_servers-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)) @@ -105550,6 +115423,7 @@ func UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype(m map[str obj := new(VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype) 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)) @@ -105590,14 +115464,17 @@ func UnmarshalVpcdnsResolverTypeDelegated(m map[string]json.RawMessage, result i obj := new(VpcdnsResolverTypeDelegated) err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) if err != nil { + err = core.SDKErrorf(err, "", "servers-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.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -105644,14 +115521,17 @@ func UnmarshalVpcdnsResolverTypeManual(m map[string]json.RawMessage, result inte obj := new(VpcdnsResolverTypeManual) err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) if err != nil { + err = core.SDKErrorf(err, "", "servers-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer) if err != nil { + err = core.SDKErrorf(err, "", "manual_servers-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)) @@ -105731,14 +115611,17 @@ func UnmarshalVpcdnsResolverTypeSystem(m map[string]json.RawMessage, result inte obj := new(VpcdnsResolverTypeSystem) err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) if err != nil { + err = core.SDKErrorf(err, "", "servers-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration) if err != nil { + err = core.SDKErrorf(err, "", "configuration-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)) @@ -105758,6 +115641,9 @@ func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByCRN(crn string) (_model *Vpc CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105770,6 +115656,7 @@ func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByCRN(m map[string]json.RawMessag obj := new(VpcdnsResolverVPCPatchVPCIdentityByCRN) 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)) @@ -105789,6 +115676,9 @@ func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByHref(href string) (_model *V Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105801,6 +115691,7 @@ func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByHref(m map[string]json.RawMessa obj := new(VpcdnsResolverVPCPatchVPCIdentityByHref) 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)) @@ -105820,6 +115711,9 @@ func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByID(id string) (_model *Vpcdn ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105832,6 +115726,7 @@ func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByID(m map[string]json.RawMessage obj := new(VpcdnsResolverVPCPatchVPCIdentityByID) 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)) @@ -105851,6 +115746,9 @@ func (*VpcV1) NewVPCIdentityByCRN(crn string) (_model *VPCIdentityByCRN, err err CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105863,6 +115761,7 @@ func UnmarshalVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) obj := new(VPCIdentityByCRN) 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)) @@ -105882,6 +115781,9 @@ func (*VpcV1) NewVPCIdentityByHref(href string) (_model *VPCIdentityByHref, err Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105894,6 +115796,7 @@ func UnmarshalVPCIdentityByHref(m map[string]json.RawMessage, result interface{} obj := new(VPCIdentityByHref) 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)) @@ -105913,6 +115816,9 @@ func (*VpcV1) NewVPCIdentityByID(id string) (_model *VPCIdentityByID, err error) ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105925,6 +115831,7 @@ func UnmarshalVPCIdentityByID(m map[string]json.RawMessage, result interface{}) obj := new(VPCIdentityByID) 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)) @@ -105957,6 +115864,9 @@ func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIke Value: core.StringPtr(value), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -105969,10 +115879,12 @@ func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIde obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn) 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)) @@ -106005,6 +115917,9 @@ func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIke Value: core.StringPtr(value), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106017,10 +115932,12 @@ func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIde obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname) 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)) @@ -106053,6 +115970,9 @@ func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIke Value: core.StringPtr(value), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106065,10 +115985,12 @@ func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIde obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4) 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)) @@ -106098,9 +116020,12 @@ const ( func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID(typeVar string, value []byte) (_model *VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID, err error) { _model = &VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID{ Type: core.StringPtr(typeVar), - Value: &value, + Value: core.ByteArrayPtr(value), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106113,10 +116038,12 @@ func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIde obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID) 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)) @@ -106128,9 +116055,8 @@ func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIde type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn struct { // The IKE identity type. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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 IKE identity FQDN value. @@ -106140,9 +116066,8 @@ type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn struct { // Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn.Type property. // The IKE identity type. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnTypeFqdnConst = "fqdn" VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnTypeHostnameConst = "hostname" @@ -106159,10 +116084,12 @@ func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn) 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)) @@ -106174,9 +116101,8 @@ func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname struct { // The IKE identity type. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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 IKE identity hostname value. @@ -106186,9 +116112,8 @@ type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname stru // Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname.Type property. // The IKE identity type. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameTypeFqdnConst = "fqdn" VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameTypeHostnameConst = "hostname" @@ -106205,10 +116130,12 @@ func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHost obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname) 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)) @@ -106220,9 +116147,8 @@ func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHost type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 struct { // The IKE identity type. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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 IKE identity IPv4 address value. @@ -106232,9 +116158,8 @@ type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 struct { // Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4.Type property. // The IKE identity type. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4TypeFqdnConst = "fqdn" VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4TypeHostnameConst = "hostname" @@ -106251,10 +116176,12 @@ func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4) 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)) @@ -106266,9 +116193,8 @@ func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID struct { // The IKE identity type. // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. + // 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 base64-encoded IKE identity key ID value. @@ -106278,9 +116204,8 @@ type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID struct // Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID.Type property. // The IKE identity type. // -// The enumerated values for this property will expand in the future. When processing this property, check for and log -// unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the unexpected -// property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDTypeFqdnConst = "fqdn" VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDTypeHostnameConst = "hostname" @@ -106297,10 +116222,12 @@ func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyI obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID) 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)) @@ -106320,6 +116247,9 @@ func (*VpcV1) NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(href Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106332,6 +116262,7 @@ func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(m map[st obj := new(VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref) 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)) @@ -106351,6 +116282,9 @@ func (*VpcV1) NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(id stri ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106363,6 +116297,7 @@ func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(m map[stri obj := new(VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) 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)) @@ -106382,6 +116317,9 @@ func (*VpcV1) NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(h Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106394,6 +116332,7 @@ func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(m ma obj := new(VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref) 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)) @@ -106413,6 +116352,9 @@ func (*VpcV1) NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(id ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106425,6 +116367,7 @@ func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(m map[ obj := new(VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) 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)) @@ -106444,6 +116387,9 @@ func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(h Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106456,6 +116402,7 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(m ma obj := new(VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref) 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)) @@ -106475,6 +116422,9 @@ func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(id ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106487,6 +116437,7 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(m map[ obj := new(VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) 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)) @@ -106506,6 +116457,9 @@ func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHr Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106518,6 +116472,7 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref( obj := new(VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref) 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)) @@ -106537,6 +116492,9 @@ func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106549,6 +116507,7 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(m obj := new(VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) 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)) @@ -106587,10 +116546,12 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPat obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -106629,10 +116590,12 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePe obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -106691,25 +116654,7 @@ type VPNGatewayConnectionPolicyMode struct { // The status of a VPN gateway connection. Status *string `json:"status" validate:"required"` - // The reasons for the current VPN gateway connection status (if any): - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current VPN gateway connection status (if any). StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` Local *VPNGatewayConnectionPolicyModeLocal `json:"local" validate:"required"` @@ -106765,70 +116710,87 @@ func UnmarshalVPNGatewayConnectionPolicyMode(m map[string]json.RawMessage, resul obj := new(VPNGatewayConnectionPolicyMode) err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) if err != nil { + err = core.SDKErrorf(err, "", "authentication_mode-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, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) if err != nil { + err = core.SDKErrorf(err, "", "establish_mode-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, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-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, "psk", &obj.Psk) if err != nil { + err = core.SDKErrorf(err, "", "psk-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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionPolicyModeLocal) if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionPolicyModePeer) if err != nil { + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -106859,6 +116821,9 @@ func (*VpcV1) NewVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnection Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106871,14 +116836,17 @@ func UnmarshalVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPee obj := new(VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress) err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -106909,6 +116877,9 @@ func (*VpcV1) NewVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnection Fqdn: core.StringPtr(fqdn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -106921,14 +116892,17 @@ func UnmarshalVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPee obj := new(VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn) err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -106967,18 +116941,22 @@ func UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddres obj := new(VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress) err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107017,18 +116995,22 @@ func UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn(m obj := new(VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn) err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "fqdn", &obj.Fqdn) if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107089,6 +117071,9 @@ func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModeProt Peer: peer, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107101,38 +117086,47 @@ func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototy obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype) err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) if err != nil { + err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-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, "psk", &obj.Psk) if err != nil { + err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionPolicyModeLocalPrototype) if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionPolicyModePeerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107201,6 +117195,9 @@ func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteMod Peer: peer, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107213,42 +117210,52 @@ func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePr obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) if err != nil { + err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-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, "psk", &obj.Psk) if err != nil { + err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype) if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) if err != nil { + err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107309,25 +117316,7 @@ type VPNGatewayConnectionRouteMode struct { // The status of a VPN gateway connection. Status *string `json:"status" validate:"required"` - // The reasons for the current VPN gateway connection status (if any): - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current VPN gateway connection status (if any). StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local,omitempty"` @@ -107405,16 +117394,22 @@ func UnmarshalVPNGatewayConnectionRouteMode(m map[string]json.RawMessage, result var discValue string err = core.UnmarshalPrimitive(m, "routing_protocol", &discValue) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'routing_protocol': %s", err.Error()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'routing_protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) + return + } + if discValue == "" { + err = core.SDKErrorf(err, "required discriminator property 'routing_protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } - if discValue == "none" { err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) - } else if discValue == "" { - err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode-error", common.GetComponentInfo()) + } } else { - err = fmt.Errorf("unrecognized value for discriminator property 'routing_protocol': %s", discValue) + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'routing_protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } return } @@ -107439,6 +117434,9 @@ func (*VpcV1) NewVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConne Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107451,10 +117449,12 @@ func UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnecti obj := new(VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress) err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107481,6 +117481,9 @@ func (*VpcV1) NewVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConne Fqdn: core.StringPtr(fqdn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107493,10 +117496,12 @@ func UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnecti obj := new(VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn) err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107532,14 +117537,17 @@ func UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByA obj := new(VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress) err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107575,14 +117583,17 @@ func UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByF obj := new(VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn) err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "fqdn", &obj.Fqdn) if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107601,24 +117612,16 @@ type VPNGatewayPolicyMode struct { // The VPN gateway's CRN. CRN *string `json:"crn" validate:"required"` - // The reasons for the current VPN gateway health_state (if any): - // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `health_state` (if any). HealthReasons []VPNGatewayHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 VPN gateway's canonical URL. @@ -107627,13 +117630,7 @@ type VPNGatewayPolicyMode struct { // The unique identifier for this VPN gateway. ID *string `json:"id" validate:"required"` - // The reasons for the current VPN gateway lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `lifecycle_state` (if any). LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the VPN gateway. @@ -107661,13 +117658,13 @@ type VPNGatewayPolicyMode struct { } // Constants associated with the VPNGatewayPolicyMode.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. +// 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 ( VPNGatewayPolicyModeHealthStateDegradedConst = "degraded" VPNGatewayPolicyModeHealthStateFaultedConst = "faulted" @@ -107708,66 +117705,82 @@ func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interfac obj := new(VPNGatewayPolicyMode) err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) if err != nil { + err = core.SDKErrorf(err, "", "connections-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) 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.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) if err != nil { + err = core.SDKErrorf(err, "", "members-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, "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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-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.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107801,6 +117814,9 @@ func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet SubnetI Subnet: subnet, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107813,18 +117829,22 @@ func UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype(m map[string]json obj := new(VPNGatewayPrototypeVPNGatewayPolicyModePrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107858,6 +117878,9 @@ func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayRouteModePrototype(subnet SubnetId Subnet: subnet, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107870,18 +117893,22 @@ func UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype(m map[string]json. obj := new(VPNGatewayPrototypeVPNGatewayRouteModePrototype) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -107900,24 +117927,16 @@ type VPNGatewayRouteMode struct { // The VPN gateway's CRN. CRN *string `json:"crn" validate:"required"` - // The reasons for the current VPN gateway health_state (if any): - // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (contact IBM support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `health_state` (if any). HealthReasons []VPNGatewayHealthReason `json:"health_reasons" validate:"required"` - // The health of this resource. + // 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. + // - `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 VPN gateway's canonical URL. @@ -107926,13 +117945,7 @@ type VPNGatewayRouteMode struct { // The unique identifier for this VPN gateway. ID *string `json:"id" validate:"required"` - // The reasons for the current VPN gateway lifecycle_state (if any): - // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM - // support) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current `lifecycle_state` (if any). LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the VPN gateway. @@ -107960,13 +117973,13 @@ type VPNGatewayRouteMode struct { } // Constants associated with the VPNGatewayRouteMode.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. +// 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 ( VPNGatewayRouteModeHealthStateDegradedConst = "degraded" VPNGatewayRouteModeHealthStateFaultedConst = "faulted" @@ -108007,66 +118020,82 @@ func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface obj := new(VPNGatewayRouteMode) err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) if err != nil { + err = core.SDKErrorf(err, "", "connections-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) 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.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) if err != nil { + err = core.SDKErrorf(err, "", "members-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, "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, "subnet", &obj.Subnet, UnmarshalSubnetReference) if err != nil { + err = core.SDKErrorf(err, "", "subnet-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.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -108102,14 +118131,17 @@ func UnmarshalVPNServerAuthenticationByCertificate(m map[string]json.RawMessage, obj := new(VPNServerAuthenticationByCertificate) err = core.UnmarshalPrimitive(m, "method", &obj.Method) if err != nil { + err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) if err != nil { + err = core.SDKErrorf(err, "", "client_ca-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) if err != nil { + err = core.SDKErrorf(err, "", "crl-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -108142,10 +118174,12 @@ func UnmarshalVPNServerAuthenticationByUsername(m map[string]json.RawMessage, re obj := new(VPNServerAuthenticationByUsername) err = core.UnmarshalPrimitive(m, "method", &obj.Method) if err != nil { + err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) if err != nil { + err = core.SDKErrorf(err, "", "identity_provider-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -108155,22 +118189,20 @@ func UnmarshalVPNServerAuthenticationByUsername(m map[string]json.RawMessage, re // VPNServerAuthenticationByUsernameIDProviderByIam : VPNServerAuthenticationByUsernameIDProviderByIam struct // This model "extends" VPNServerAuthenticationByUsernameIDProvider type VPNServerAuthenticationByUsernameIDProviderByIam struct { - // The type of identity provider to be used by the VPN client. + // The type of identity provider to be used by the VPN client: // - `iam`: IBM identity and access management // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the - // unexpected property value was encountered. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProviderType *string `json:"provider_type" validate:"required"` } // Constants associated with the VPNServerAuthenticationByUsernameIDProviderByIam.ProviderType property. -// The type of identity provider to be used by the VPN client. +// The type of identity provider to be used by the VPN client: // - `iam`: IBM identity and access management // -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the -// unexpected property value was encountered. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerAuthenticationByUsernameIDProviderByIamProviderTypeIamConst = "iam" ) @@ -108181,6 +118213,9 @@ func (*VpcV1) NewVPNServerAuthenticationByUsernameIDProviderByIam(providerType s ProviderType: core.StringPtr(providerType), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108193,6 +118228,7 @@ func UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam(m map[string]json obj := new(VPNServerAuthenticationByUsernameIDProviderByIam) err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) if err != nil { + err = core.SDKErrorf(err, "", "provider_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -108226,6 +118262,9 @@ func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertif ClientCa: clientCa, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108238,14 +118277,17 @@ func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertifica obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) err = core.UnmarshalPrimitive(m, "method", &obj.Method) if err != nil { + err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceIdentity) if err != nil { + err = core.SDKErrorf(err, "", "client_ca-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) if err != nil { + err = core.SDKErrorf(err, "", "crl-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -108276,6 +118318,9 @@ func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUserna IdentityProvider: identityProvider, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108288,10 +118333,12 @@ func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernameP obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) err = core.UnmarshalPrimitive(m, "method", &obj.Method) if err != nil { + err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) if err != nil { + err = core.SDKErrorf(err, "", "identity_provider-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -108330,10 +118377,12 @@ func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetwork obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) 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)) @@ -108367,14 +118416,17 @@ func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetwor obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) 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)) @@ -108413,10 +118465,12 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtual obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) 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)) @@ -108450,14 +118504,17 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtua obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) 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)) @@ -108496,18 +118553,22 @@ func UnmarshalVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentRefer obj := new(VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext) 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)) @@ -108545,18 +118606,22 @@ func UnmarshalVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVir obj := new(VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) 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)) @@ -108598,22 +118663,27 @@ func UnmarshalVirtualNetworkInterfaceTargetShareMountTargetReference(m map[strin obj := new(VirtualNetworkInterfaceTargetShareMountTargetReference) err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) 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)) @@ -108655,14 +118725,17 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentity(m map[string]json.Ra obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { + err = core.SDKErrorf(err, "", "id-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) if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -108694,8 +118767,10 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. + // The capacity to use for the volume (in gigabytes). + // + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity,omitempty"` // The root key to use to wrap the data encryption key for the volume. @@ -108725,34 +118800,42 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext(m ma obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -108772,6 +118855,9 @@ func (*VpcV1) NewVolumeIdentityByCRN(crn string) (_model *VolumeIdentityByCRN, e CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108784,6 +118870,7 @@ func UnmarshalVolumeIdentityByCRN(m map[string]json.RawMessage, result interface obj := new(VolumeIdentityByCRN) 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)) @@ -108803,6 +118890,9 @@ func (*VpcV1) NewVolumeIdentityByHref(href string) (_model *VolumeIdentityByHref Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108815,6 +118905,7 @@ func UnmarshalVolumeIdentityByHref(m map[string]json.RawMessage, result interfac obj := new(VolumeIdentityByHref) 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)) @@ -108834,6 +118925,9 @@ func (*VpcV1) NewVolumeIdentityByID(id string) (_model *VolumeIdentityByID, err ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108846,6 +118940,7 @@ func UnmarshalVolumeIdentityByID(m map[string]json.RawMessage, result interface{ obj := new(VolumeIdentityByID) 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)) @@ -108865,6 +118960,9 @@ func (*VpcV1) NewVolumeProfileIdentityByHref(href string) (_model *VolumeProfile Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108877,6 +118975,7 @@ func UnmarshalVolumeProfileIdentityByHref(m map[string]json.RawMessage, result i obj := new(VolumeProfileIdentityByHref) 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)) @@ -108896,6 +118995,9 @@ func (*VpcV1) NewVolumeProfileIdentityByName(name string) (_model *VolumeProfile Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108908,6 +119010,7 @@ func UnmarshalVolumeProfileIdentityByName(m map[string]json.RawMessage, result i obj := new(VolumeProfileIdentityByName) 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)) @@ -108936,8 +119039,10 @@ type VolumePrototypeVolumeByCapacity struct { // The zone this volume will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. + // The capacity to use for the volume (in gigabytes). + // + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity" validate:"required"` // The root key to use to wrap the data encryption key for the volume. @@ -108954,6 +119059,9 @@ func (*VpcV1) NewVolumePrototypeVolumeByCapacity(profile VolumeProfileIdentityIn Capacity: core.Int64Ptr(capacity), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -108966,34 +119074,42 @@ func UnmarshalVolumePrototypeVolumeByCapacity(m map[string]json.RawMessage, resu obj := new(VolumePrototypeVolumeByCapacity) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -109045,6 +119161,9 @@ func (*VpcV1) NewVolumePrototypeVolumeBySourceSnapshot(profile VolumeProfileIden SourceSnapshot: sourceSnapshot, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109057,38 +119176,47 @@ func UnmarshalVolumePrototypeVolumeBySourceSnapshot(m map[string]json.RawMessage obj := new(VolumePrototypeVolumeBySourceSnapshot) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -109108,6 +119236,9 @@ func (*VpcV1) NewZoneIdentityByHref(href string) (_model *ZoneIdentityByHref, er Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109120,6 +119251,7 @@ func UnmarshalZoneIdentityByHref(m map[string]json.RawMessage, result interface{ obj := new(ZoneIdentityByHref) 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)) @@ -109139,6 +119271,9 @@ func (*VpcV1) NewZoneIdentityByName(name string) (_model *ZoneIdentityByName, er Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109151,6 +119286,7 @@ func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{ obj := new(ZoneIdentityByName) 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)) @@ -109170,6 +119306,9 @@ func (*VpcV1) NewBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityB CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109186,6 +119325,7 @@ func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCR obj := new(BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) 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)) @@ -109205,6 +119345,9 @@ func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfac CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109221,6 +119364,7 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVi obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) 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)) @@ -109240,6 +119384,9 @@ func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfac Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109256,6 +119403,7 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVi obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) 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)) @@ -109275,6 +119423,9 @@ func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfac ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109291,6 +119442,7 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVi obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) 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)) @@ -109310,6 +119462,9 @@ func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityByHref(href string) Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109326,6 +119481,7 @@ func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByHref(m map[string]jso obj := new(EndpointGatewayReservedIPReservedIPIdentityByHref) 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)) @@ -109345,6 +119501,9 @@ func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityByID(id string) (_mo ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109361,6 +119520,7 @@ func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByID(m map[string]json. obj := new(EndpointGatewayReservedIPReservedIPIdentityByID) 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)) @@ -109391,6 +119551,9 @@ func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProvi CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109407,10 +119570,12 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProvider obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) 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()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -109442,6 +119607,9 @@ func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIden Name: core.StringPtr(name), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109458,10 +119626,12 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentit obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) 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, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -109485,6 +119655,9 @@ func (*VpcV1) NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBar Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109501,6 +119674,7 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMe obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) 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)) @@ -109525,6 +119699,9 @@ func (*VpcV1) NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBar ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109541,6 +119718,7 @@ func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMe obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) 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)) @@ -109564,6 +119742,9 @@ func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceId Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109580,6 +119761,7 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdent obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) 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)) @@ -109604,6 +119786,9 @@ func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceId ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109620,6 +119805,7 @@ func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdent obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) 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)) @@ -109639,6 +119825,9 @@ func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetw CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109655,6 +119844,7 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetwork obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) 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)) @@ -109674,6 +119864,9 @@ func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetw Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109690,6 +119883,7 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetwork obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) 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)) @@ -109709,6 +119903,9 @@ func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetw ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109725,6 +119922,7 @@ func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetwork obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) 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)) @@ -109748,6 +119946,9 @@ func (*VpcV1) NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentit Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109764,6 +119965,7 @@ func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBa obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) 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)) @@ -109788,6 +119990,9 @@ func (*VpcV1) NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentit ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109804,6 +120009,7 @@ func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBa obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) 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)) @@ -109827,6 +120033,9 @@ func (*VpcV1) NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfa Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109843,6 +120052,7 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceI obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) 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)) @@ -109867,6 +120077,9 @@ func (*VpcV1) NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfa ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109883,6 +120096,7 @@ func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceI obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) 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)) @@ -109902,6 +120116,9 @@ func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtual CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109918,6 +120135,7 @@ func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNet obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) 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)) @@ -109937,6 +120155,9 @@ func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtual Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109953,6 +120174,7 @@ func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNet obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) 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)) @@ -109972,6 +120194,9 @@ func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtual ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -109988,6 +120213,7 @@ func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNet obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) 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)) @@ -110007,6 +120233,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentity CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110023,6 +120252,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByC obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) 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)) @@ -110042,6 +120272,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentity Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110058,6 +120291,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByH obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) 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)) @@ -110077,6 +120311,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentity ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110093,6 +120330,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByI obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) 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)) @@ -110112,6 +120350,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentit Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110128,6 +120369,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityIn obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) 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)) @@ -110147,6 +120389,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentit ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110163,6 +120408,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityIn obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) 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)) @@ -110186,6 +120432,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkI Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110202,6 +120451,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInte obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) 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)) @@ -110226,6 +120476,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkI ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110242,6 +120495,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInte obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) 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)) @@ -110261,6 +120515,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCR CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110277,6 +120534,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(m obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) 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)) @@ -110296,6 +120554,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHr Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110312,6 +120573,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref( obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) 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)) @@ -110331,6 +120593,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110347,6 +120612,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(m obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) 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)) @@ -110366,6 +120632,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(crn CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110382,6 +120651,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(m map[s obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) 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)) @@ -110401,6 +120671,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(hre Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110417,6 +120690,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(m map[ obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) 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)) @@ -110436,6 +120710,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(id st ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110452,6 +120729,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(m map[st obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) 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)) @@ -110471,6 +120749,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityV CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110487,6 +120768,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirt obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) 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)) @@ -110506,6 +120788,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityV Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110522,6 +120807,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirt obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) 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)) @@ -110541,6 +120827,9 @@ func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityV ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -110557,6 +120846,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirt obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) 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)) @@ -110604,18 +120894,22 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronS obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -110662,18 +120956,22 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) if err != nil { + err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -110777,58 +121075,72 @@ func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string] obj := new(InstanceGroupManagerActionScheduledActionGroupTarget) 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_timeout", &obj.AutoDeleteTimeout) if err != nil { + err = core.SDKErrorf(err, "", "auto_delete_timeout-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, "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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) if err != nil { + err = core.SDKErrorf(err, "", "action_type-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.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) if err != nil { + err = core.SDKErrorf(err, "", "last_applied_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) if err != nil { + err = core.SDKErrorf(err, "", "next_run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -110932,58 +121244,72 @@ func UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget(m map[strin obj := new(InstanceGroupManagerActionScheduledActionManagerTarget) 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_timeout", &obj.AutoDeleteTimeout) if err != nil { + err = core.SDKErrorf(err, "", "auto_delete_timeout-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, "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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) if err != nil { + err = core.SDKErrorf(err, "", "action_type-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.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) if err != nil { + err = core.SDKErrorf(err, "", "last_applied_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) if err != nil { + err = core.SDKErrorf(err, "", "next_run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) if err != nil { + err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -111009,6 +121335,9 @@ func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePro Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111025,14 +121354,17 @@ func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScaleProtot obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-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)) @@ -111058,6 +121390,9 @@ func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePro ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111074,14 +121409,17 @@ func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScaleProtot obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) if err != nil { + err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) return } 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)) @@ -111101,6 +121439,9 @@ func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtua CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111117,6 +121458,7 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNe obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) 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)) @@ -111136,6 +121478,9 @@ func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtua Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111152,6 +121497,7 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNe obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) 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)) @@ -111171,6 +121517,9 @@ func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtua ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111187,6 +121536,7 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNe obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) 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)) @@ -111206,6 +121556,9 @@ func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicated CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111222,6 +121575,7 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHos obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) 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)) @@ -111241,6 +121595,9 @@ func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicated Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111257,6 +121614,7 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHos obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) 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)) @@ -111276,6 +121634,9 @@ func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicated ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111292,6 +121653,7 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHos obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) 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)) @@ -111311,6 +121673,9 @@ func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostI CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111327,6 +121692,7 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIden obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) 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)) @@ -111346,6 +121712,9 @@ func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostI Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111362,6 +121731,7 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIden obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) 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)) @@ -111381,6 +121751,9 @@ func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostI ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111397,6 +121770,7 @@ func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIden obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) 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)) @@ -111416,6 +121790,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedic CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111432,6 +121809,7 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicate obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) 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)) @@ -111451,6 +121829,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedic Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111467,6 +121848,7 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicate obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) 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)) @@ -111486,6 +121868,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedic ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111502,6 +121887,7 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicate obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) 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)) @@ -111521,6 +121907,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedH CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111537,6 +121926,7 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHost obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) 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)) @@ -111556,6 +121946,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedH Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111572,6 +121965,7 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHost obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) 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)) @@ -111591,6 +121985,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedH ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111607,6 +122004,7 @@ func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHost obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) 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)) @@ -111626,6 +122024,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacement CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111642,6 +122043,7 @@ func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGro obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) 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)) @@ -111661,6 +122063,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacement Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111677,6 +122082,7 @@ func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGro obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) 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)) @@ -111696,6 +122102,9 @@ func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacement ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111712,6 +122121,7 @@ func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGro obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) 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)) @@ -111808,6 +122218,9 @@ func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOffe PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -111824,74 +122237,92 @@ func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferin obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -111988,6 +122419,9 @@ func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOffe PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112004,74 +122438,92 @@ func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferin obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112169,6 +122621,9 @@ func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetwor PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112185,74 +122640,92 @@ func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAt obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112350,6 +122823,9 @@ func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetwor PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112366,74 +122842,92 @@ func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkIn obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112528,6 +123022,9 @@ func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapsh PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112544,70 +123041,87 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotI obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112702,6 +123216,9 @@ func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapsh PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112718,70 +123235,87 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotI obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112876,6 +123410,9 @@ func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetw PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112892,70 +123429,87 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -113050,6 +123604,9 @@ func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetw PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -113066,70 +123623,87 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -113224,6 +123798,9 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInsta PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -113240,74 +123817,92 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -113402,6 +123997,9 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInsta PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -113418,74 +124016,92 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -113581,6 +124197,9 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplat PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -113597,74 +124216,92 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -113760,6 +124397,9 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplat PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -113776,74 +124416,92 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -113936,6 +124594,9 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstan PrimaryNetworkAttachment: primaryNetworkAttachment, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -113952,70 +124613,87 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -114108,6 +124786,9 @@ func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstan PrimaryNetworkInterface: primaryNetworkInterface, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -114124,70 +124805,87 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -114299,90 +124997,112 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -114494,90 +125214,112 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -114690,90 +125432,112 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -114886,90 +125650,112 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) if err != nil { + err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -115082,90 +125868,112 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -115281,234 +126089,273 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) if err != nil { + err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { + err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { + err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) if err != nil { + err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) if err != nil { + err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) if err != nil { + err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 } err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) if err != nil { + err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct // This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { // The pool's canonical URL. Href *string `json:"href" validate:"required"` } -// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ +// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { return true } -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatch() bool { +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatch() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) 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 } -// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct // This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { // The unique identifier for this load balancer pool. ID *string `json:"id" validate:"required"` } -// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ +// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { return true } -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatch() bool { +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatch() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) 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 } -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct // This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { // The pool's canonical URL. Href *string `json:"href" validate:"required"` } -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { return true } -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototype() bool { +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototype() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) 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 } -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct // This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { // The unique identifier for this load balancer pool. ID *string `json:"id" validate:"required"` } -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { + _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { return true } -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototype() bool { +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototype() bool { return true } -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) 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)) @@ -115528,6 +126375,9 @@ func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceId CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115544,6 +126394,7 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdent obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) 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)) @@ -115563,6 +126414,9 @@ func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceId Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115579,6 +126433,7 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdent obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) 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)) @@ -115598,6 +126453,9 @@ func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceId ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115614,6 +126472,7 @@ func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdent obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) 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)) @@ -115633,6 +126492,9 @@ func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityByHref(href string Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115649,6 +126511,7 @@ func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByHref(m map[string]j obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityByHref) 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)) @@ -115668,6 +126531,9 @@ func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityByID(id string) (_ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115684,6 +126550,7 @@ func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByID(m map[string]jso obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityByID) 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)) @@ -115703,6 +126570,9 @@ func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIde Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115719,6 +126589,7 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdenti obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -115738,6 +126609,9 @@ func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIde CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115754,6 +126628,7 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdenti obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) 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)) @@ -115773,6 +126648,9 @@ func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIde Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115789,6 +126667,7 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdenti obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) 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)) @@ -115808,6 +126687,9 @@ func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIde ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115824,6 +126706,7 @@ func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdenti obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) 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)) @@ -115843,6 +126726,9 @@ func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGateway CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115859,6 +126745,7 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIde obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) 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)) @@ -115878,6 +126765,9 @@ func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGateway Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115894,6 +126784,7 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIde obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) 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)) @@ -115913,6 +126804,9 @@ func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGateway ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115929,6 +126823,7 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIde obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) 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)) @@ -115948,6 +126843,9 @@ func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtual CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115964,6 +126862,7 @@ func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNet obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) 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)) @@ -115983,6 +126882,9 @@ func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtual Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -115999,6 +126901,7 @@ func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNet obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) 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)) @@ -116018,6 +126921,9 @@ func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtual ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116034,6 +126940,7 @@ func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNet obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) 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)) @@ -116045,9 +126952,8 @@ func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNet type RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct { // The sentinel IP address (`0.0.0.0`). // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -116057,6 +126963,9 @@ func (*VpcV1) NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(address Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116073,6 +126982,7 @@ func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(m map[stri obj := new(RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116088,9 +126998,8 @@ type RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP struct { // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) // - `255.255.255.255` (the broadcast IP address) // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -116100,6 +127009,9 @@ func (*VpcV1) NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(address Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116116,6 +127028,7 @@ func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(m map[strin obj := new(RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116135,6 +127048,9 @@ func (*VpcV1) NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnecti Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116151,6 +127067,7 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionI obj := new(RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) 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)) @@ -116170,6 +127087,9 @@ func (*VpcV1) NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnecti ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116186,6 +127106,7 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionI obj := new(RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) 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)) @@ -116197,9 +127118,8 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionI type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct { // The sentinel IP address (`0.0.0.0`). // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -116209,6 +127129,9 @@ func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNe Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116225,6 +127148,7 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextH obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116240,9 +127164,8 @@ type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototy // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) // - `255.255.255.255` (the broadcast IP address) // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. + // 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"` } @@ -116252,6 +127175,9 @@ func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNe Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116268,6 +127194,7 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextH obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116287,6 +127214,9 @@ func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionI Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116303,6 +127233,7 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIden obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) 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)) @@ -116322,6 +127253,9 @@ func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionI ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116338,6 +127272,7 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIden obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) 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)) @@ -116357,6 +127292,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupI CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116373,6 +127311,7 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIden obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) 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)) @@ -116392,6 +127331,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupI Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116408,6 +127350,7 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIden obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) 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)) @@ -116427,6 +127370,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupI ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116443,6 +127389,7 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIden obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) 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)) @@ -116462,6 +127409,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGr CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116478,6 +127428,7 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroup obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) 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)) @@ -116497,6 +127448,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGr Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116513,6 +127467,7 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroup obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) 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)) @@ -116532,6 +127487,9 @@ func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGr ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116548,6 +127506,7 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroup obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) 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)) @@ -116567,6 +127526,9 @@ func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkI CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116583,6 +127545,7 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) 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)) @@ -116602,6 +127565,9 @@ func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkI Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116618,6 +127584,7 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) 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)) @@ -116637,6 +127604,9 @@ func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkI ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -116653,6 +127623,7 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) 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)) @@ -116679,6 +127650,7 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPat obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116705,6 +127677,7 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPat obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch) err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116731,6 +127704,7 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePe obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116757,6 +127731,7 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePe obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116815,25 +127790,7 @@ type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { // The status of a VPN gateway connection. Status *string `json:"status" validate:"required"` - // The reasons for the current VPN gateway connection status (if any): - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. + // The reasons for the current VPN gateway connection status (if any). StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local" validate:"required"` @@ -116905,78 +127862,97 @@ func UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode(m obj := new(VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) if err != nil { + err = core.SDKErrorf(err, "", "authentication_mode-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, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) if err != nil { + err = core.SDKErrorf(err, "", "establish_mode-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, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-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, "psk", &obj.Psk) if err != nil { + err = core.SDKErrorf(err, "", "psk-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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocal) if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeer) if err != nil { + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) if err != nil { + err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) if err != nil { + err = core.SDKErrorf(err, "", "tunnels-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116996,6 +127972,9 @@ func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetw Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -117012,6 +127991,7 @@ func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetwork obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) 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)) @@ -117031,6 +128011,9 @@ func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetw ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -117047,6 +128030,7 @@ func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetwork obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) 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)) @@ -117066,6 +128050,9 @@ func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirt Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -117082,6 +128069,7 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtual obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) 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)) @@ -117101,6 +128089,9 @@ func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirt ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -117117,6 +128108,7 @@ func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtual obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) 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)) @@ -117136,6 +128128,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCR CRN: core.StringPtr(crn), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -117152,6 +128147,7 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN(m obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) 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)) @@ -117171,6 +128167,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHr Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -117187,6 +128186,7 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref( obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) 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)) @@ -117206,6 +128206,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -117222,6 +128225,7 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(m obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) 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)) @@ -117248,8 +128252,10 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototyp // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` - // The capacity to use for the volume (in gigabytes). The specified minimum and maximum capacity values for creating or - // updating volumes may expand in the future. + // The capacity to use for the volume (in gigabytes). + // + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity" validate:"required"` // The root key to use to wrap the data encryption key for the volume. @@ -117265,6 +128271,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVo Capacity: core.Int64Ptr(capacity), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -117281,30 +128290,37 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolum obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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 } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -117353,6 +128369,9 @@ func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVo SourceSnapshot: sourceSnapshot, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -117369,34 +128388,42 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolum obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { + err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) if err != nil { + err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) if err != nil { + err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -117423,6 +128450,9 @@ func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCr Group: group, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -117443,14 +128473,17 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronS obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -117477,6 +128510,9 @@ func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCr Manager: manager, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -117497,14 +128533,17 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronS obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-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, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -117530,6 +128569,9 @@ func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRu Group: group, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -117550,14 +128592,17 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) if err != nil { + err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) if err != nil { + err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -117583,6 +128628,9 @@ func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRu Manager: manager, } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -117603,14 +128651,17 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) if err != nil { + err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) if err != nil { + err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -117630,7 +128681,7 @@ type VPCAddressPrefixesPager struct { // NewVPCAddressPrefixesPager returns a new VPCAddressPrefixesPager instance. func (vpc *VpcV1) NewVPCAddressPrefixesPager(options *ListVPCAddressPrefixesOptions) (pager *VPCAddressPrefixesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117658,6 +128709,7 @@ func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (p result, _, err := pager.client.ListVPCAddressPrefixesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117666,7 +128718,8 @@ func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (p var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117685,6 +128738,7 @@ func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (al var nextPage []AddressPrefix nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117694,12 +128748,16 @@ func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (al // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPCAddressPrefixesPager) GetNext() (page []AddressPrefix, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPCDnsResolutionBindingsPager can be used to simplify the use of the "ListVPCDnsResolutionBindings" method. @@ -117715,7 +128773,7 @@ type VPCDnsResolutionBindingsPager struct { // NewVPCDnsResolutionBindingsPager returns a new VPCDnsResolutionBindingsPager instance. func (vpc *VpcV1) NewVPCDnsResolutionBindingsPager(options *ListVPCDnsResolutionBindingsOptions) (pager *VPCDnsResolutionBindingsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117743,6 +128801,7 @@ func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Conte result, _, err := pager.client.ListVPCDnsResolutionBindingsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117751,7 +128810,8 @@ func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Conte var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117770,6 +128830,7 @@ func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Contex var nextPage []VpcdnsResolutionBinding nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117779,12 +128840,16 @@ func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Contex // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPCDnsResolutionBindingsPager) GetNext() (page []VpcdnsResolutionBinding, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPCDnsResolutionBindingsPager) GetAll() (allItems []VpcdnsResolutionBinding, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. @@ -117800,7 +128865,7 @@ type VPCRoutesPager struct { // NewVPCRoutesPager returns a new VPCRoutesPager instance. func (vpc *VpcV1) NewVPCRoutesPager(options *ListVPCRoutesOptions) (pager *VPCRoutesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117828,6 +128893,7 @@ func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []Rou result, _, err := pager.client.ListVPCRoutesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117836,7 +128902,8 @@ func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []Rou var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117855,6 +128922,7 @@ func (pager *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems [] var nextPage []RouteCollectionVPCContextRoutesItem nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117864,12 +128932,16 @@ 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) { - return pager.GetNextWithContext(context.Background()) + 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) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. @@ -117885,7 +128957,7 @@ type VPCRoutingTableRoutesPager struct { // NewVPCRoutingTableRoutesPager returns a new VPCRoutingTableRoutesPager instance. func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRoutesOptions) (pager *VPCRoutingTableRoutesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117913,6 +128985,7 @@ func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) result, _, err := pager.client.ListVPCRoutingTableRoutesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -117921,7 +128994,8 @@ func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -117940,6 +129014,7 @@ func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) var nextPage []Route nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -117949,12 +129024,16 @@ func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPCRoutingTableRoutesPager) GetNext() (page []Route, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPCRoutingTablesPager can be used to simplify the use of the "ListVPCRoutingTables" method. @@ -117970,7 +129049,7 @@ type VPCRoutingTablesPager struct { // NewVPCRoutingTablesPager returns a new VPCRoutingTablesPager instance. func (vpc *VpcV1) NewVPCRoutingTablesPager(options *ListVPCRoutingTablesOptions) (pager *VPCRoutingTablesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -117998,6 +129077,7 @@ func (pager *VPCRoutingTablesPager) GetNextWithContext(ctx context.Context) (pag result, _, err := pager.client.ListVPCRoutingTablesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118006,7 +129086,8 @@ func (pager *VPCRoutingTablesPager) GetNextWithContext(ctx context.Context) (pag var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118025,6 +129106,7 @@ func (pager *VPCRoutingTablesPager) GetAllWithContext(ctx context.Context) (allI var nextPage []RoutingTable nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118034,12 +129116,16 @@ func (pager *VPCRoutingTablesPager) GetAllWithContext(ctx context.Context) (allI // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPCRoutingTablesPager) GetNext() (page []RoutingTable, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPCRoutingTablesPager) GetAll() (allItems []RoutingTable, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VpcsPager can be used to simplify the use of the "ListVpcs" method. @@ -118055,7 +129141,7 @@ type VpcsPager struct { // NewVpcsPager returns a new VpcsPager instance. func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118083,6 +129169,7 @@ func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err result, _, err := pager.client.ListVpcsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118091,7 +129178,8 @@ func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118110,6 +129198,7 @@ func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, var nextPage []VPC nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118119,12 +129208,16 @@ func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VpcsPager) GetNext() (page []VPC, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VpcsPager) GetAll() (allItems []VPC, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. @@ -118140,7 +129233,7 @@ type SubnetReservedIpsPager struct { // NewSubnetReservedIpsPager returns a new SubnetReservedIpsPager instance. func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOptions) (pager *SubnetReservedIpsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118168,6 +129261,7 @@ func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (pa result, _, err := pager.client.ListSubnetReservedIpsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118176,7 +129270,8 @@ func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (pa var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118195,6 +129290,7 @@ func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (all var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118204,12 +129300,16 @@ func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (all // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *SubnetReservedIpsPager) GetNext() (page []ReservedIP, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // SubnetsPager can be used to simplify the use of the "ListSubnets" method. @@ -118225,7 +129325,7 @@ type SubnetsPager struct { // NewSubnetsPager returns a new SubnetsPager instance. func (vpc *VpcV1) NewSubnetsPager(options *ListSubnetsOptions) (pager *SubnetsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118253,6 +129353,7 @@ func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subne result, _, err := pager.client.ListSubnetsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118261,7 +129362,8 @@ func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subne var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118280,6 +129382,7 @@ func (pager *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Su var nextPage []Subnet nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118289,12 +129392,16 @@ func (pager *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Su // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *SubnetsPager) GetNext() (page []Subnet, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *SubnetsPager) GetAll() (allItems []Subnet, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // ImagesPager can be used to simplify the use of the "ListImages" method. @@ -118310,7 +129417,7 @@ type ImagesPager struct { // NewImagesPager returns a new ImagesPager instance. func (vpc *VpcV1) NewImagesPager(options *ListImagesOptions) (pager *ImagesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118338,6 +129445,7 @@ func (pager *ImagesPager) GetNextWithContext(ctx context.Context) (page []Image, result, _, err := pager.client.ListImagesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118346,7 +129454,8 @@ func (pager *ImagesPager) GetNextWithContext(ctx context.Context) (page []Image, var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118365,6 +129474,7 @@ func (pager *ImagesPager) GetAllWithContext(ctx context.Context) (allItems []Ima var nextPage []Image nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118374,12 +129484,16 @@ func (pager *ImagesPager) GetAllWithContext(ctx context.Context) (allItems []Ima // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *ImagesPager) GetNext() (page []Image, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *ImagesPager) GetAll() (allItems []Image, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // OperatingSystemsPager can be used to simplify the use of the "ListOperatingSystems" method. @@ -118395,7 +129509,7 @@ type OperatingSystemsPager struct { // NewOperatingSystemsPager returns a new OperatingSystemsPager instance. func (vpc *VpcV1) NewOperatingSystemsPager(options *ListOperatingSystemsOptions) (pager *OperatingSystemsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118423,6 +129537,7 @@ func (pager *OperatingSystemsPager) GetNextWithContext(ctx context.Context) (pag result, _, err := pager.client.ListOperatingSystemsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118431,7 +129546,8 @@ func (pager *OperatingSystemsPager) GetNextWithContext(ctx context.Context) (pag var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118450,6 +129566,7 @@ func (pager *OperatingSystemsPager) GetAllWithContext(ctx context.Context) (allI var nextPage []OperatingSystem nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118459,12 +129576,16 @@ func (pager *OperatingSystemsPager) GetAllWithContext(ctx context.Context) (allI // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *OperatingSystemsPager) GetNext() (page []OperatingSystem, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *OperatingSystemsPager) GetAll() (allItems []OperatingSystem, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // KeysPager can be used to simplify the use of the "ListKeys" method. @@ -118480,7 +129601,7 @@ type KeysPager struct { // NewKeysPager returns a new KeysPager instance. func (vpc *VpcV1) NewKeysPager(options *ListKeysOptions) (pager *KeysPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118508,6 +129629,7 @@ func (pager *KeysPager) GetNextWithContext(ctx context.Context) (page []Key, err result, _, err := pager.client.ListKeysWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118516,7 +129638,8 @@ func (pager *KeysPager) GetNextWithContext(ctx context.Context) (page []Key, err var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118535,6 +129658,7 @@ func (pager *KeysPager) GetAllWithContext(ctx context.Context) (allItems []Key, var nextPage []Key nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118544,12 +129668,16 @@ func (pager *KeysPager) GetAllWithContext(ctx context.Context) (allItems []Key, // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *KeysPager) GetNext() (page []Key, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *KeysPager) GetAll() (allItems []Key, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "ListInstanceNetworkInterfaceIps" method. @@ -118565,7 +129693,7 @@ type InstanceNetworkInterfaceIpsPager struct { // NewInstanceNetworkInterfaceIpsPager returns a new InstanceNetworkInterfaceIpsPager instance. func (vpc *VpcV1) NewInstanceNetworkInterfaceIpsPager(options *ListInstanceNetworkInterfaceIpsOptions) (pager *InstanceNetworkInterfaceIpsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118593,6 +129721,7 @@ func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Co result, _, err := pager.client.ListInstanceNetworkInterfaceIpsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118601,7 +129730,8 @@ func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Co var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118620,6 +129750,7 @@ func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Con var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118629,12 +129760,16 @@ func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Con // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *InstanceNetworkInterfaceIpsPager) GetNext() (page []ReservedIP, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // InstancesPager can be used to simplify the use of the "ListInstances" method. @@ -118650,7 +129785,7 @@ type InstancesPager struct { // NewInstancesPager returns a new InstancesPager instance. func (vpc *VpcV1) NewInstancesPager(options *ListInstancesOptions) (pager *InstancesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118678,6 +129813,7 @@ func (pager *InstancesPager) GetNextWithContext(ctx context.Context) (page []Ins result, _, err := pager.client.ListInstancesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118686,7 +129822,8 @@ func (pager *InstancesPager) GetNextWithContext(ctx context.Context) (page []Ins var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118705,6 +129842,7 @@ func (pager *InstancesPager) GetAllWithContext(ctx context.Context) (allItems [] var nextPage []Instance nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118714,12 +129852,16 @@ func (pager *InstancesPager) GetAllWithContext(ctx context.Context) (allItems [] // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *InstancesPager) GetNext() (page []Instance, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *InstancesPager) GetAll() (allItems []Instance, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // InstanceGroupManagerActionsPager can be used to simplify the use of the "ListInstanceGroupManagerActions" method. @@ -118735,7 +129877,7 @@ type InstanceGroupManagerActionsPager struct { // NewInstanceGroupManagerActionsPager returns a new InstanceGroupManagerActionsPager instance. func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroupManagerActionsOptions) (pager *InstanceGroupManagerActionsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118763,6 +129905,7 @@ func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Co result, _, err := pager.client.ListInstanceGroupManagerActionsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118771,7 +129914,8 @@ func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Co var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118790,6 +129934,7 @@ func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Con var nextPage []InstanceGroupManagerActionIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118799,12 +129944,16 @@ func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Con // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupManagerActionsPager) GetNext() (page []InstanceGroupManagerActionIntf, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupManagerActionsPager) GetAll() (allItems []InstanceGroupManagerActionIntf, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // InstanceGroupManagerPoliciesPager can be used to simplify the use of the "ListInstanceGroupManagerPolicies" method. @@ -118820,7 +129969,7 @@ type InstanceGroupManagerPoliciesPager struct { // NewInstanceGroupManagerPoliciesPager returns a new InstanceGroupManagerPoliciesPager instance. func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGroupManagerPoliciesOptions) (pager *InstanceGroupManagerPoliciesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118848,6 +129997,7 @@ func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.C result, _, err := pager.client.ListInstanceGroupManagerPoliciesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118856,7 +130006,8 @@ func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.C var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118875,6 +130026,7 @@ func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Co var nextPage []InstanceGroupManagerPolicyIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118884,12 +130036,16 @@ func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Co // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupManagerPoliciesPager) GetNext() (page []InstanceGroupManagerPolicyIntf, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGroupManagerPolicyIntf, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // InstanceGroupManagersPager can be used to simplify the use of the "ListInstanceGroupManagers" method. @@ -118905,7 +130061,7 @@ type InstanceGroupManagersPager struct { // NewInstanceGroupManagersPager returns a new InstanceGroupManagersPager instance. func (vpc *VpcV1) NewInstanceGroupManagersPager(options *ListInstanceGroupManagersOptions) (pager *InstanceGroupManagersPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -118933,6 +130089,7 @@ func (pager *InstanceGroupManagersPager) GetNextWithContext(ctx context.Context) result, _, err := pager.client.ListInstanceGroupManagersWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -118941,7 +130098,8 @@ func (pager *InstanceGroupManagersPager) GetNextWithContext(ctx context.Context) var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -118960,6 +130118,7 @@ func (pager *InstanceGroupManagersPager) GetAllWithContext(ctx context.Context) var nextPage []InstanceGroupManagerIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -118969,12 +130128,16 @@ func (pager *InstanceGroupManagersPager) GetAllWithContext(ctx context.Context) // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupManagersPager) GetNext() (page []InstanceGroupManagerIntf, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManagerIntf, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // InstanceGroupMembershipsPager can be used to simplify the use of the "ListInstanceGroupMemberships" method. @@ -118990,7 +130153,7 @@ type InstanceGroupMembershipsPager struct { // NewInstanceGroupMembershipsPager returns a new InstanceGroupMembershipsPager instance. func (vpc *VpcV1) NewInstanceGroupMembershipsPager(options *ListInstanceGroupMembershipsOptions) (pager *InstanceGroupMembershipsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119018,6 +130181,7 @@ func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Conte result, _, err := pager.client.ListInstanceGroupMembershipsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119026,7 +130190,8 @@ func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Conte var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119045,6 +130210,7 @@ func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Contex var nextPage []InstanceGroupMembership nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119054,12 +130220,16 @@ func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Contex // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupMembershipsPager) GetNext() (page []InstanceGroupMembership, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMembership, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. @@ -119075,7 +130245,7 @@ type InstanceGroupsPager struct { // NewInstanceGroupsPager returns a new InstanceGroupsPager instance. func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pager *InstanceGroupsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119103,6 +130273,7 @@ func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page result, _, err := pager.client.ListInstanceGroupsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119111,7 +130282,8 @@ func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119130,6 +130302,7 @@ func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allIte var nextPage []InstanceGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119139,12 +130312,16 @@ func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allIte // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupsPager) GetNext() (page []InstanceGroup, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // ReservationsPager can be used to simplify the use of the "ListReservations" method. @@ -119160,7 +130337,7 @@ type ReservationsPager struct { // NewReservationsPager returns a new ReservationsPager instance. func (vpc *VpcV1) NewReservationsPager(options *ListReservationsOptions) (pager *ReservationsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119188,6 +130365,7 @@ func (pager *ReservationsPager) GetNextWithContext(ctx context.Context) (page [] result, _, err := pager.client.ListReservationsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119196,7 +130374,8 @@ func (pager *ReservationsPager) GetNextWithContext(ctx context.Context) (page [] var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119215,6 +130394,7 @@ func (pager *ReservationsPager) GetAllWithContext(ctx context.Context) (allItems var nextPage []Reservation nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119224,12 +130404,16 @@ func (pager *ReservationsPager) GetAllWithContext(ctx context.Context) (allItems // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *ReservationsPager) GetNext() (page []Reservation, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *ReservationsPager) GetAll() (allItems []Reservation, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // DedicatedHostGroupsPager can be used to simplify the use of the "ListDedicatedHostGroups" method. @@ -119245,7 +130429,7 @@ type DedicatedHostGroupsPager struct { // NewDedicatedHostGroupsPager returns a new DedicatedHostGroupsPager instance. func (vpc *VpcV1) NewDedicatedHostGroupsPager(options *ListDedicatedHostGroupsOptions) (pager *DedicatedHostGroupsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119273,6 +130457,7 @@ func (pager *DedicatedHostGroupsPager) GetNextWithContext(ctx context.Context) ( result, _, err := pager.client.ListDedicatedHostGroupsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119281,7 +130466,8 @@ func (pager *DedicatedHostGroupsPager) GetNextWithContext(ctx context.Context) ( var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119300,6 +130486,7 @@ func (pager *DedicatedHostGroupsPager) GetAllWithContext(ctx context.Context) (a var nextPage []DedicatedHostGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119309,12 +130496,16 @@ func (pager *DedicatedHostGroupsPager) GetAllWithContext(ctx context.Context) (a // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *DedicatedHostGroupsPager) GetNext() (page []DedicatedHostGroup, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *DedicatedHostGroupsPager) GetAll() (allItems []DedicatedHostGroup, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // DedicatedHostProfilesPager can be used to simplify the use of the "ListDedicatedHostProfiles" method. @@ -119330,7 +130521,7 @@ type DedicatedHostProfilesPager struct { // NewDedicatedHostProfilesPager returns a new DedicatedHostProfilesPager instance. func (vpc *VpcV1) NewDedicatedHostProfilesPager(options *ListDedicatedHostProfilesOptions) (pager *DedicatedHostProfilesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119358,6 +130549,7 @@ func (pager *DedicatedHostProfilesPager) GetNextWithContext(ctx context.Context) result, _, err := pager.client.ListDedicatedHostProfilesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119366,7 +130558,8 @@ func (pager *DedicatedHostProfilesPager) GetNextWithContext(ctx context.Context) var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119385,6 +130578,7 @@ func (pager *DedicatedHostProfilesPager) GetAllWithContext(ctx context.Context) var nextPage []DedicatedHostProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119394,12 +130588,16 @@ func (pager *DedicatedHostProfilesPager) GetAllWithContext(ctx context.Context) // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *DedicatedHostProfilesPager) GetNext() (page []DedicatedHostProfile, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *DedicatedHostProfilesPager) GetAll() (allItems []DedicatedHostProfile, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // DedicatedHostsPager can be used to simplify the use of the "ListDedicatedHosts" method. @@ -119415,7 +130613,7 @@ type DedicatedHostsPager struct { // NewDedicatedHostsPager returns a new DedicatedHostsPager instance. func (vpc *VpcV1) NewDedicatedHostsPager(options *ListDedicatedHostsOptions) (pager *DedicatedHostsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -119443,6 +130641,7 @@ func (pager *DedicatedHostsPager) GetNextWithContext(ctx context.Context) (page result, _, err := pager.client.ListDedicatedHostsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119451,7 +130650,8 @@ func (pager *DedicatedHostsPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119470,6 +130670,7 @@ func (pager *DedicatedHostsPager) GetAllWithContext(ctx context.Context) (allIte var nextPage []DedicatedHost nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119479,33 +130680,37 @@ func (pager *DedicatedHostsPager) GetAllWithContext(ctx context.Context) (allIte // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *DedicatedHostsPager) GetNext() (page []DedicatedHost, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *DedicatedHostsPager) GetAll() (allItems []DedicatedHost, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. -type BackupPoliciesPager struct { +// PlacementGroupsPager can be used to simplify the use of the "ListPlacementGroups" method. +type PlacementGroupsPager struct { hasNext bool - options *ListBackupPoliciesOptions + options *ListPlacementGroupsOptions client *VpcV1 pageContext struct { next *string } } -// NewBackupPoliciesPager returns a new BackupPoliciesPager instance. -func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pager *BackupPoliciesPager, err error) { +// NewPlacementGroupsPager returns a new PlacementGroupsPager instance. +func (vpc *VpcV1) NewPlacementGroupsPager(options *ListPlacementGroupsOptions) (pager *PlacementGroupsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListBackupPoliciesOptions = *options - pager = &BackupPoliciesPager{ + var optionsCopy ListPlacementGroupsOptions = *options + pager = &PlacementGroupsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -119514,20 +130719,21 @@ func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BackupPoliciesPager) HasNext() bool { +func (pager *PlacementGroupsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyIntf, err error) { +func (pager *PlacementGroupsPager) GetNextWithContext(ctx context.Context) (page []PlacementGroup, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBackupPoliciesWithContext(ctx, pager.options) + result, _, err := pager.client.ListPlacementGroupsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119536,25 +130742,27 @@ func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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.BackupPolicies + page = result.PlacementGroups return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyIntf, err error) { +func (pager *PlacementGroupsPager) GetAllWithContext(ctx context.Context) (allItems []PlacementGroup, err error) { for pager.HasNext() { - var nextPage []BackupPolicyIntf + var nextPage []PlacementGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119563,34 +130771,38 @@ func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allIte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BackupPoliciesPager) GetNext() (page []BackupPolicyIntf, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *PlacementGroupsPager) GetNext() (page []PlacementGroup, 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 *BackupPoliciesPager) GetAll() (allItems []BackupPolicyIntf, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *PlacementGroupsPager) GetAll() (allItems []PlacementGroup, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// BackupPolicyJobsPager can be used to simplify the use of the "ListBackupPolicyJobs" method. -type BackupPolicyJobsPager struct { +// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. +type BareMetalServerNetworkAttachmentsPager struct { hasNext bool - options *ListBackupPolicyJobsOptions + options *ListBareMetalServerNetworkAttachmentsOptions client *VpcV1 pageContext struct { next *string } } -// NewBackupPolicyJobsPager returns a new BackupPolicyJobsPager instance. -func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) (pager *BackupPolicyJobsPager, err error) { +// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListBackupPolicyJobsOptions = *options - pager = &BackupPolicyJobsPager{ + var optionsCopy ListBareMetalServerNetworkAttachmentsOptions = *options + pager = &BareMetalServerNetworkAttachmentsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -119599,20 +130811,21 @@ func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BackupPolicyJobsPager) HasNext() bool { +func (pager *BareMetalServerNetworkAttachmentsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyJob, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkAttachmentIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBackupPolicyJobsWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119621,25 +130834,27 @@ func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (pag var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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.Jobs + page = result.NetworkAttachments return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyJob, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { for pager.HasNext() { - var nextPage []BackupPolicyJob + var nextPage []BareMetalServerNetworkAttachmentIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119648,34 +130863,38 @@ func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allI } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BackupPolicyJobsPager) GetNext() (page []BackupPolicyJob, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, 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 *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// PlacementGroupsPager can be used to simplify the use of the "ListPlacementGroups" method. -type PlacementGroupsPager struct { +// BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. +type BareMetalServerNetworkInterfacesPager struct { hasNext bool - options *ListPlacementGroupsOptions + options *ListBareMetalServerNetworkInterfacesOptions client *VpcV1 pageContext struct { next *string } } -// NewPlacementGroupsPager returns a new PlacementGroupsPager instance. -func (vpc *VpcV1) NewPlacementGroupsPager(options *ListPlacementGroupsOptions) (pager *PlacementGroupsPager, err error) { +// NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListPlacementGroupsOptions = *options - pager = &PlacementGroupsPager{ + var optionsCopy ListBareMetalServerNetworkInterfacesOptions = *options + pager = &BareMetalServerNetworkInterfacesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -119684,20 +130903,21 @@ func (vpc *VpcV1) NewPlacementGroupsPager(options *ListPlacementGroupsOptions) ( } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *PlacementGroupsPager) HasNext() bool { +func (pager *BareMetalServerNetworkInterfacesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *PlacementGroupsPager) GetNextWithContext(ctx context.Context) (page []PlacementGroup, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkInterfaceIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListPlacementGroupsWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119706,25 +130926,27 @@ func (pager *PlacementGroupsPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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.PlacementGroups + page = result.NetworkInterfaces return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *PlacementGroupsPager) GetAllWithContext(ctx context.Context) (allItems []PlacementGroup, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkInterfaceIntf, err error) { for pager.HasNext() { - var nextPage []PlacementGroup + var nextPage []BareMetalServerNetworkInterfaceIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119733,34 +130955,38 @@ func (pager *PlacementGroupsPager) GetAllWithContext(ctx context.Context) (allIt } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *PlacementGroupsPager) GetNext() (page []PlacementGroup, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *BareMetalServerNetworkInterfacesPager) GetNext() (page []BareMetalServerNetworkInterfaceIntf, 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 *PlacementGroupsPager) GetAll() (allItems []PlacementGroup, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. -type BareMetalServerNetworkAttachmentsPager struct { +// BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. +type BareMetalServerProfilesPager struct { hasNext bool - options *ListBareMetalServerNetworkAttachmentsOptions + options *ListBareMetalServerProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. -func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, err error) { +// NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. +func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListBareMetalServerNetworkAttachmentsOptions = *options - pager = &BareMetalServerNetworkAttachmentsPager{ + var optionsCopy ListBareMetalServerProfilesOptions = *options + pager = &BareMetalServerProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -119769,20 +130995,21 @@ func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMet } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerNetworkAttachmentsPager) HasNext() bool { +func (pager *BareMetalServerProfilesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfile, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerProfilesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119791,25 +131018,27 @@ func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx cont var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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.NetworkAttachments + page = result.Profiles return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfile, err error) { for pager.HasNext() { - var nextPage []BareMetalServerNetworkAttachmentIntf + var nextPage []BareMetalServerProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119818,34 +131047,38 @@ func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx conte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *BareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfile, 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 *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. -type BareMetalServerNetworkInterfacesPager struct { +// BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. +type BareMetalServersPager struct { hasNext bool - options *ListBareMetalServerNetworkInterfacesOptions + options *ListBareMetalServersOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. -func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, err error) { +// NewBareMetalServersPager returns a new BareMetalServersPager instance. +func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListBareMetalServerNetworkInterfacesOptions = *options - pager = &BareMetalServerNetworkInterfacesPager{ + var optionsCopy ListBareMetalServersOptions = *options + pager = &BareMetalServersPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -119854,20 +131087,21 @@ func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMeta } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerNetworkInterfacesPager) HasNext() bool { +func (pager *BareMetalServersPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (page []BareMetalServer, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServersWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119876,25 +131110,27 @@ func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx conte var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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.NetworkInterfaces + page = result.BareMetalServers return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServer, err error) { for pager.HasNext() { - var nextPage []BareMetalServerNetworkInterfaceIntf + var nextPage []BareMetalServer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119903,34 +131139,38 @@ func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx contex } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerNetworkInterfacesPager) GetNext() (page []BareMetalServerNetworkInterfaceIntf, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *BareMetalServersPager) GetNext() (page []BareMetalServer, 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 *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. -type BareMetalServerProfilesPager struct { +// VolumeProfilesPager can be used to simplify the use of the "ListVolumeProfiles" method. +type VolumeProfilesPager struct { hasNext bool - options *ListBareMetalServerProfilesOptions + options *ListVolumeProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. -func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, err error) { +// NewVolumeProfilesPager returns a new VolumeProfilesPager instance. +func (vpc *VpcV1) NewVolumeProfilesPager(options *ListVolumeProfilesOptions) (pager *VolumeProfilesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListBareMetalServerProfilesOptions = *options - pager = &BareMetalServerProfilesPager{ + var optionsCopy ListVolumeProfilesOptions = *options + pager = &VolumeProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -119939,20 +131179,21 @@ func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerPr } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerProfilesPager) HasNext() bool { +func (pager *VolumeProfilesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfile, err error) { +func (pager *VolumeProfilesPager) GetNextWithContext(ctx context.Context) (page []VolumeProfile, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServerProfilesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVolumeProfilesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -119961,7 +131202,8 @@ func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Contex var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -119975,11 +131217,12 @@ func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Contex // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfile, err error) { +func (pager *VolumeProfilesPager) GetAllWithContext(ctx context.Context) (allItems []VolumeProfile, err error) { for pager.HasNext() { - var nextPage []BareMetalServerProfile + var nextPage []VolumeProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -119988,34 +131231,38 @@ func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfile, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *VolumeProfilesPager) GetNext() (page []VolumeProfile, 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 *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *VolumeProfilesPager) GetAll() (allItems []VolumeProfile, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. -type BareMetalServersPager struct { +// VolumesPager can be used to simplify the use of the "ListVolumes" method. +type VolumesPager struct { hasNext bool - options *ListBareMetalServersOptions + options *ListVolumesOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServersPager returns a new BareMetalServersPager instance. -func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, err error) { +// NewVolumesPager returns a new VolumesPager instance. +func (vpc *VpcV1) NewVolumesPager(options *ListVolumesOptions) (pager *VolumesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListBareMetalServersOptions = *options - pager = &BareMetalServersPager{ + var optionsCopy ListVolumesOptions = *options + pager = &VolumesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -120024,20 +131271,21 @@ func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServersPager) HasNext() bool { +func (pager *VolumesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (page []BareMetalServer, err error) { +func (pager *VolumesPager) GetNextWithContext(ctx context.Context) (page []Volume, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServersWithContext(ctx, pager.options) + result, _, err := pager.client.ListVolumesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120046,25 +131294,27 @@ func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (pag var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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.BareMetalServers + page = result.Volumes return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServer, err error) { +func (pager *VolumesPager) GetAllWithContext(ctx context.Context) (allItems []Volume, err error) { for pager.HasNext() { - var nextPage []BareMetalServer + var nextPage []Volume nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120073,34 +131323,38 @@ func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allI } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServersPager) GetNext() (page []BareMetalServer, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *VolumesPager) GetNext() (page []Volume, 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 *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *VolumesPager) GetAll() (allItems []Volume, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// VolumeProfilesPager can be used to simplify the use of the "ListVolumeProfiles" method. -type VolumeProfilesPager struct { +// SnapshotConsistencyGroupsPager can be used to simplify the use of the "ListSnapshotConsistencyGroups" method. +type SnapshotConsistencyGroupsPager struct { hasNext bool - options *ListVolumeProfilesOptions + options *ListSnapshotConsistencyGroupsOptions client *VpcV1 pageContext struct { next *string } } -// NewVolumeProfilesPager returns a new VolumeProfilesPager instance. -func (vpc *VpcV1) NewVolumeProfilesPager(options *ListVolumeProfilesOptions) (pager *VolumeProfilesPager, err error) { +// NewSnapshotConsistencyGroupsPager returns a new SnapshotConsistencyGroupsPager instance. +func (vpc *VpcV1) NewSnapshotConsistencyGroupsPager(options *ListSnapshotConsistencyGroupsOptions) (pager *SnapshotConsistencyGroupsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListVolumeProfilesOptions = *options - pager = &VolumeProfilesPager{ + var optionsCopy ListSnapshotConsistencyGroupsOptions = *options + pager = &SnapshotConsistencyGroupsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -120109,20 +131363,21 @@ func (vpc *VpcV1) NewVolumeProfilesPager(options *ListVolumeProfilesOptions) (pa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VolumeProfilesPager) HasNext() bool { +func (pager *SnapshotConsistencyGroupsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VolumeProfilesPager) GetNextWithContext(ctx context.Context) (page []VolumeProfile, err error) { +func (pager *SnapshotConsistencyGroupsPager) GetNextWithContext(ctx context.Context) (page []SnapshotConsistencyGroup, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVolumeProfilesWithContext(ctx, pager.options) + result, _, err := pager.client.ListSnapshotConsistencyGroupsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120131,25 +131386,27 @@ func (pager *VolumeProfilesPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 + page = result.SnapshotConsistencyGroups return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VolumeProfilesPager) GetAllWithContext(ctx context.Context) (allItems []VolumeProfile, err error) { +func (pager *SnapshotConsistencyGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SnapshotConsistencyGroup, err error) { for pager.HasNext() { - var nextPage []VolumeProfile + var nextPage []SnapshotConsistencyGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120158,34 +131415,38 @@ func (pager *VolumeProfilesPager) GetAllWithContext(ctx context.Context) (allIte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VolumeProfilesPager) GetNext() (page []VolumeProfile, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *SnapshotConsistencyGroupsPager) GetNext() (page []SnapshotConsistencyGroup, 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 *VolumeProfilesPager) GetAll() (allItems []VolumeProfile, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *SnapshotConsistencyGroupsPager) GetAll() (allItems []SnapshotConsistencyGroup, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// VolumesPager can be used to simplify the use of the "ListVolumes" method. -type VolumesPager struct { +// SnapshotsPager can be used to simplify the use of the "ListSnapshots" method. +type SnapshotsPager struct { hasNext bool - options *ListVolumesOptions + options *ListSnapshotsOptions client *VpcV1 pageContext struct { next *string } } -// NewVolumesPager returns a new VolumesPager instance. -func (vpc *VpcV1) NewVolumesPager(options *ListVolumesOptions) (pager *VolumesPager, err error) { +// NewSnapshotsPager returns a new SnapshotsPager instance. +func (vpc *VpcV1) NewSnapshotsPager(options *ListSnapshotsOptions) (pager *SnapshotsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListVolumesOptions = *options - pager = &VolumesPager{ + var optionsCopy ListSnapshotsOptions = *options + pager = &SnapshotsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -120194,20 +131455,21 @@ func (vpc *VpcV1) NewVolumesPager(options *ListVolumesOptions) (pager *VolumesPa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VolumesPager) HasNext() bool { +func (pager *SnapshotsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VolumesPager) GetNextWithContext(ctx context.Context) (page []Volume, err error) { +func (pager *SnapshotsPager) GetNextWithContext(ctx context.Context) (page []Snapshot, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVolumesWithContext(ctx, pager.options) + result, _, err := pager.client.ListSnapshotsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120216,25 +131478,27 @@ func (pager *VolumesPager) GetNextWithContext(ctx context.Context) (page []Volum var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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.Volumes + page = result.Snapshots return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VolumesPager) GetAllWithContext(ctx context.Context) (allItems []Volume, err error) { +func (pager *SnapshotsPager) GetAllWithContext(ctx context.Context) (allItems []Snapshot, err error) { for pager.HasNext() { - var nextPage []Volume + var nextPage []Snapshot nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120243,34 +131507,38 @@ func (pager *VolumesPager) GetAllWithContext(ctx context.Context) (allItems []Vo } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VolumesPager) GetNext() (page []Volume, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *SnapshotsPager) GetNext() (page []Snapshot, 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 *VolumesPager) GetAll() (allItems []Volume, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *SnapshotsPager) GetAll() (allItems []Snapshot, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// SnapshotConsistencyGroupsPager can be used to simplify the use of the "ListSnapshotConsistencyGroups" method. -type SnapshotConsistencyGroupsPager struct { +// ShareMountTargetsPager can be used to simplify the use of the "ListShareMountTargets" method. +type ShareMountTargetsPager struct { hasNext bool - options *ListSnapshotConsistencyGroupsOptions + options *ListShareMountTargetsOptions client *VpcV1 pageContext struct { next *string } } -// NewSnapshotConsistencyGroupsPager returns a new SnapshotConsistencyGroupsPager instance. -func (vpc *VpcV1) NewSnapshotConsistencyGroupsPager(options *ListSnapshotConsistencyGroupsOptions) (pager *SnapshotConsistencyGroupsPager, err error) { +// NewShareMountTargetsPager returns a new ShareMountTargetsPager instance. +func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOptions) (pager *ShareMountTargetsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListSnapshotConsistencyGroupsOptions = *options - pager = &SnapshotConsistencyGroupsPager{ + var optionsCopy ListShareMountTargetsOptions = *options + pager = &ShareMountTargetsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -120279,20 +131547,21 @@ func (vpc *VpcV1) NewSnapshotConsistencyGroupsPager(options *ListSnapshotConsist } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *SnapshotConsistencyGroupsPager) HasNext() bool { +func (pager *ShareMountTargetsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *SnapshotConsistencyGroupsPager) GetNextWithContext(ctx context.Context) (page []SnapshotConsistencyGroup, err error) { +func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (page []ShareMountTarget, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListSnapshotConsistencyGroupsWithContext(ctx, pager.options) + result, _, err := pager.client.ListShareMountTargetsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120301,25 +131570,27 @@ func (pager *SnapshotConsistencyGroupsPager) GetNextWithContext(ctx context.Cont var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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.SnapshotConsistencyGroups + page = result.MountTargets return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *SnapshotConsistencyGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SnapshotConsistencyGroup, err error) { +func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (allItems []ShareMountTarget, err error) { for pager.HasNext() { - var nextPage []SnapshotConsistencyGroup + var nextPage []ShareMountTarget nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120328,34 +131599,38 @@ func (pager *SnapshotConsistencyGroupsPager) GetAllWithContext(ctx context.Conte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SnapshotConsistencyGroupsPager) GetNext() (page []SnapshotConsistencyGroup, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *ShareMountTargetsPager) GetNext() (page []ShareMountTarget, 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 *SnapshotConsistencyGroupsPager) GetAll() (allItems []SnapshotConsistencyGroup, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// SnapshotsPager can be used to simplify the use of the "ListSnapshots" method. -type SnapshotsPager struct { +// ShareProfilesPager can be used to simplify the use of the "ListShareProfiles" method. +type ShareProfilesPager struct { hasNext bool - options *ListSnapshotsOptions + options *ListShareProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewSnapshotsPager returns a new SnapshotsPager instance. -func (vpc *VpcV1) NewSnapshotsPager(options *ListSnapshotsOptions) (pager *SnapshotsPager, err error) { +// NewShareProfilesPager returns a new ShareProfilesPager instance. +func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (pager *ShareProfilesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListSnapshotsOptions = *options - pager = &SnapshotsPager{ + var optionsCopy ListShareProfilesOptions = *options + pager = &ShareProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -120364,20 +131639,21 @@ func (vpc *VpcV1) NewSnapshotsPager(options *ListSnapshotsOptions) (pager *Snaps } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *SnapshotsPager) HasNext() bool { +func (pager *ShareProfilesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *SnapshotsPager) GetNextWithContext(ctx context.Context) (page []Snapshot, err error) { +func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page []ShareProfile, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListSnapshotsWithContext(ctx, pager.options) + result, _, err := pager.client.ListShareProfilesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120386,25 +131662,27 @@ func (pager *SnapshotsPager) GetNextWithContext(ctx context.Context) (page []Sna var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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.Snapshots + page = result.Profiles return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *SnapshotsPager) GetAllWithContext(ctx context.Context) (allItems []Snapshot, err error) { +func (pager *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItems []ShareProfile, err error) { for pager.HasNext() { - var nextPage []Snapshot + var nextPage []ShareProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120413,34 +131691,38 @@ func (pager *SnapshotsPager) GetAllWithContext(ctx context.Context) (allItems [] } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SnapshotsPager) GetNext() (page []Snapshot, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *ShareProfilesPager) GetNext() (page []ShareProfile, 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 *SnapshotsPager) GetAll() (allItems []Snapshot, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *ShareProfilesPager) GetAll() (allItems []ShareProfile, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// ShareMountTargetsPager can be used to simplify the use of the "ListShareMountTargets" method. -type ShareMountTargetsPager struct { +// SharesPager can be used to simplify the use of the "ListShares" method. +type SharesPager struct { hasNext bool - options *ListShareMountTargetsOptions + options *ListSharesOptions client *VpcV1 pageContext struct { next *string } } -// NewShareMountTargetsPager returns a new ShareMountTargetsPager instance. -func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOptions) (pager *ShareMountTargetsPager, err error) { +// NewSharesPager returns a new SharesPager instance. +func (vpc *VpcV1) NewSharesPager(options *ListSharesOptions) (pager *SharesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListShareMountTargetsOptions = *options - pager = &ShareMountTargetsPager{ + var optionsCopy ListSharesOptions = *options + pager = &SharesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -120449,20 +131731,21 @@ func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOption } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *ShareMountTargetsPager) HasNext() bool { +func (pager *SharesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (page []ShareMountTarget, err error) { +func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListShareMountTargetsWithContext(ctx, pager.options) + result, _, err := pager.client.ListSharesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120471,25 +131754,27 @@ func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (pa var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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.MountTargets + page = result.Shares return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (allItems []ShareMountTarget, err error) { +func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Share, err error) { for pager.HasNext() { - var nextPage []ShareMountTarget + var nextPage []Share nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120498,34 +131783,38 @@ func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (all } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ShareMountTargetsPager) GetNext() (page []ShareMountTarget, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *SharesPager) GetNext() (page []Share, 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 *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *SharesPager) GetAll() (allItems []Share, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// ShareProfilesPager can be used to simplify the use of the "ListShareProfiles" method. -type ShareProfilesPager struct { +// BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. +type BackupPoliciesPager struct { hasNext bool - options *ListShareProfilesOptions + options *ListBackupPoliciesOptions client *VpcV1 pageContext struct { next *string } } -// NewShareProfilesPager returns a new ShareProfilesPager instance. -func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (pager *ShareProfilesPager, err error) { +// NewBackupPoliciesPager returns a new BackupPoliciesPager instance. +func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pager *BackupPoliciesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListShareProfilesOptions = *options - pager = &ShareProfilesPager{ + var optionsCopy ListBackupPoliciesOptions = *options + pager = &BackupPoliciesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -120534,20 +131823,21 @@ func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (page } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *ShareProfilesPager) HasNext() bool { +func (pager *BackupPoliciesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page []ShareProfile, err error) { +func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListShareProfilesWithContext(ctx, pager.options) + result, _, err := pager.client.ListBackupPoliciesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120556,25 +131846,27 @@ func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page [ var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 + page = result.BackupPolicies return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItems []ShareProfile, err error) { +func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyIntf, err error) { for pager.HasNext() { - var nextPage []ShareProfile + var nextPage []BackupPolicyIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120583,34 +131875,38 @@ func (pager *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItem } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ShareProfilesPager) GetNext() (page []ShareProfile, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *BackupPoliciesPager) GetNext() (page []BackupPolicyIntf, 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 *ShareProfilesPager) GetAll() (allItems []ShareProfile, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *BackupPoliciesPager) GetAll() (allItems []BackupPolicyIntf, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// SharesPager can be used to simplify the use of the "ListShares" method. -type SharesPager struct { +// BackupPolicyJobsPager can be used to simplify the use of the "ListBackupPolicyJobs" method. +type BackupPolicyJobsPager struct { hasNext bool - options *ListSharesOptions + options *ListBackupPolicyJobsOptions client *VpcV1 pageContext struct { next *string } } -// NewSharesPager returns a new SharesPager instance. -func (vpc *VpcV1) NewSharesPager(options *ListSharesOptions) (pager *SharesPager, err error) { +// NewBackupPolicyJobsPager returns a new BackupPolicyJobsPager instance. +func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) (pager *BackupPolicyJobsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListSharesOptions = *options - pager = &SharesPager{ + var optionsCopy ListBackupPolicyJobsOptions = *options + pager = &BackupPolicyJobsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -120619,20 +131915,21 @@ func (vpc *VpcV1) NewSharesPager(options *ListSharesOptions) (pager *SharesPager } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *SharesPager) HasNext() bool { +func (pager *BackupPolicyJobsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, err error) { +func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyJob, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListSharesWithContext(ctx, pager.options) + result, _, err := pager.client.ListBackupPolicyJobsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120641,25 +131938,27 @@ func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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.Shares + page = result.Jobs return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Share, err error) { +func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyJob, err error) { for pager.HasNext() { - var nextPage []Share + var nextPage []BackupPolicyJob nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120668,13 +131967,17 @@ func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Sha } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SharesPager) GetNext() (page []Share, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *BackupPolicyJobsPager) GetNext() (page []BackupPolicyJob, 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 *SharesPager) GetAll() (allItems []Share, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "ListNetworkInterfaceFloatingIps" method. @@ -120690,7 +131993,7 @@ type NetworkInterfaceFloatingIpsPager struct { // NewNetworkInterfaceFloatingIpsPager returns a new NetworkInterfaceFloatingIpsPager instance. func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterfaceFloatingIpsOptions) (pager *NetworkInterfaceFloatingIpsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120718,6 +132021,7 @@ func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Co result, _, err := pager.client.ListNetworkInterfaceFloatingIpsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120726,7 +132030,8 @@ func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Co var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120745,6 +132050,7 @@ func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Con var nextPage []FloatingIPReference nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120754,12 +132060,16 @@ func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Con // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *NetworkInterfaceFloatingIpsPager) GetNext() (page []FloatingIPReference, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *NetworkInterfaceFloatingIpsPager) GetAll() (allItems []FloatingIPReference, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "ListVirtualNetworkInterfaceIps" method. @@ -120775,7 +132085,7 @@ type VirtualNetworkInterfaceIpsPager struct { // NewVirtualNetworkInterfaceIpsPager returns a new VirtualNetworkInterfaceIpsPager instance. func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetworkInterfaceIpsOptions) (pager *VirtualNetworkInterfaceIpsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120803,6 +132113,7 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Con result, _, err := pager.client.ListVirtualNetworkInterfaceIpsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120811,7 +132122,8 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Con var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120830,6 +132142,7 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Cont var nextPage []ReservedIPReference nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120839,12 +132152,16 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Cont // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VirtualNetworkInterfaceIpsPager) GetNext() (page []ReservedIPReference, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPReference, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. @@ -120860,7 +132177,7 @@ type VirtualNetworkInterfacesPager struct { // NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120888,6 +132205,7 @@ func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Conte result, _, err := pager.client.ListVirtualNetworkInterfacesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120896,7 +132214,8 @@ func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Conte var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -120915,6 +132234,7 @@ func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Contex var nextPage []VirtualNetworkInterface nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -120924,12 +132244,16 @@ func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Contex // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VirtualNetworkInterfacesPager) GetNext() (page []VirtualNetworkInterface, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. @@ -120945,7 +132269,7 @@ type PublicGatewaysPager struct { // NewPublicGatewaysPager returns a new PublicGatewaysPager instance. func (vpc *VpcV1) NewPublicGatewaysPager(options *ListPublicGatewaysOptions) (pager *PublicGatewaysPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -120973,6 +132297,7 @@ func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page result, _, err := pager.client.ListPublicGatewaysWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -120981,7 +132306,8 @@ func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121000,6 +132326,7 @@ func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allIte var nextPage []PublicGateway nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121009,12 +132336,16 @@ func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allIte // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *PublicGatewaysPager) GetNext() (page []PublicGateway, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *PublicGatewaysPager) GetAll() (allItems []PublicGateway, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. @@ -121030,7 +132361,7 @@ type FloatingIpsPager struct { // NewFloatingIpsPager returns a new FloatingIpsPager instance. func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *FloatingIpsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121058,6 +132389,7 @@ func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []F result, _, err := pager.client.ListFloatingIpsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -121066,7 +132398,8 @@ func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []F var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121085,6 +132418,7 @@ func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems var nextPage []FloatingIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121094,12 +132428,16 @@ func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *FloatingIpsPager) GetNext() (page []FloatingIP, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // NetworkACLRulesPager can be used to simplify the use of the "ListNetworkACLRules" method. @@ -121115,7 +132453,7 @@ type NetworkACLRulesPager struct { // NewNetworkACLRulesPager returns a new NetworkACLRulesPager instance. func (vpc *VpcV1) NewNetworkACLRulesPager(options *ListNetworkACLRulesOptions) (pager *NetworkACLRulesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121143,6 +132481,7 @@ func (pager *NetworkACLRulesPager) GetNextWithContext(ctx context.Context) (page result, _, err := pager.client.ListNetworkACLRulesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -121151,7 +132490,8 @@ func (pager *NetworkACLRulesPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121170,6 +132510,7 @@ func (pager *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allIt var nextPage []NetworkACLRuleItemIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121179,12 +132520,16 @@ func (pager *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allIt // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *NetworkACLRulesPager) GetNext() (page []NetworkACLRuleItemIntf, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. @@ -121200,7 +132545,7 @@ type NetworkAclsPager struct { // NewNetworkAclsPager returns a new NetworkAclsPager instance. func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *NetworkAclsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121228,6 +132573,7 @@ func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []N result, _, err := pager.client.ListNetworkAclsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -121236,7 +132582,8 @@ func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []N var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121255,6 +132602,7 @@ func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems var nextPage []NetworkACL nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121264,12 +132612,16 @@ func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *NetworkAclsPager) GetNext() (page []NetworkACL, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // SecurityGroupTargetsPager can be used to simplify the use of the "ListSecurityGroupTargets" method. @@ -121285,7 +132637,7 @@ type SecurityGroupTargetsPager struct { // NewSecurityGroupTargetsPager returns a new SecurityGroupTargetsPager instance. func (vpc *VpcV1) NewSecurityGroupTargetsPager(options *ListSecurityGroupTargetsOptions) (pager *SecurityGroupTargetsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121313,6 +132665,7 @@ func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) result, _, err := pager.client.ListSecurityGroupTargetsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -121321,7 +132674,8 @@ func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121340,6 +132694,7 @@ func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) ( var nextPage []SecurityGroupTargetReferenceIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121349,12 +132704,16 @@ func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) ( // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *SecurityGroupTargetsPager) GetNext() (page []SecurityGroupTargetReferenceIntf, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTargetReferenceIntf, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. @@ -121370,7 +132729,7 @@ type SecurityGroupsPager struct { // NewSecurityGroupsPager returns a new SecurityGroupsPager instance. func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pager *SecurityGroupsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121398,6 +132757,7 @@ func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page result, _, err := pager.client.ListSecurityGroupsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -121406,7 +132766,8 @@ func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121425,6 +132786,7 @@ func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allIte var nextPage []SecurityGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121434,12 +132796,16 @@ func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allIte // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *SecurityGroupsPager) GetNext() (page []SecurityGroup, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // IkePoliciesPager can be used to simplify the use of the "ListIkePolicies" method. @@ -121455,7 +132821,7 @@ type IkePoliciesPager struct { // NewIkePoliciesPager returns a new IkePoliciesPager instance. func (vpc *VpcV1) NewIkePoliciesPager(options *ListIkePoliciesOptions) (pager *IkePoliciesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121483,6 +132849,7 @@ func (pager *IkePoliciesPager) GetNextWithContext(ctx context.Context) (page []I result, _, err := pager.client.ListIkePoliciesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -121491,7 +132858,8 @@ func (pager *IkePoliciesPager) GetNextWithContext(ctx context.Context) (page []I var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121510,6 +132878,7 @@ func (pager *IkePoliciesPager) GetAllWithContext(ctx context.Context) (allItems var nextPage []IkePolicy nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121519,12 +132888,16 @@ func (pager *IkePoliciesPager) GetAllWithContext(ctx context.Context) (allItems // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *IkePoliciesPager) GetNext() (page []IkePolicy, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *IkePoliciesPager) GetAll() (allItems []IkePolicy, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // IpsecPoliciesPager can be used to simplify the use of the "ListIpsecPolicies" method. @@ -121540,7 +132913,7 @@ type IpsecPoliciesPager struct { // NewIpsecPoliciesPager returns a new IpsecPoliciesPager instance. func (vpc *VpcV1) NewIpsecPoliciesPager(options *ListIpsecPoliciesOptions) (pager *IpsecPoliciesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121568,6 +132941,7 @@ func (pager *IpsecPoliciesPager) GetNextWithContext(ctx context.Context) (page [ result, _, err := pager.client.ListIpsecPoliciesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -121576,7 +132950,8 @@ func (pager *IpsecPoliciesPager) GetNextWithContext(ctx context.Context) (page [ var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121595,6 +132970,7 @@ func (pager *IpsecPoliciesPager) GetAllWithContext(ctx context.Context) (allItem var nextPage []IPsecPolicy nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121604,12 +132980,16 @@ func (pager *IpsecPoliciesPager) GetAllWithContext(ctx context.Context) (allItem // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *IpsecPoliciesPager) GetNext() (page []IPsecPolicy, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *IpsecPoliciesPager) GetAll() (allItems []IPsecPolicy, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. @@ -121625,7 +133005,7 @@ type VPNGatewaysPager struct { // NewVPNGatewaysPager returns a new VPNGatewaysPager instance. func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *VPNGatewaysPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121653,6 +133033,7 @@ func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []V result, _, err := pager.client.ListVPNGatewaysWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -121661,7 +133042,8 @@ func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []V var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121680,6 +133062,7 @@ func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems var nextPage []VPNGatewayIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121689,12 +133072,16 @@ func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPNGatewaysPager) GetNext() (page []VPNGatewayIntf, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. @@ -121710,7 +133097,7 @@ type VPNServerClientsPager struct { // NewVPNServerClientsPager returns a new VPNServerClientsPager instance. func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) (pager *VPNServerClientsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121738,6 +133125,7 @@ func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (pag result, _, err := pager.client.ListVPNServerClientsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -121746,7 +133134,8 @@ func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (pag var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121765,6 +133154,7 @@ func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allI var nextPage []VPNServerClient nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121774,12 +133164,16 @@ func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allI // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPNServerClientsPager) GetNext() (page []VPNServerClient, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. @@ -121795,7 +133189,7 @@ type VPNServerRoutesPager struct { // NewVPNServerRoutesPager returns a new VPNServerRoutesPager instance. func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) (pager *VPNServerRoutesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121823,6 +133217,7 @@ func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page result, _, err := pager.client.ListVPNServerRoutesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -121831,7 +133226,8 @@ func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121850,6 +133246,7 @@ func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allIt var nextPage []VPNServerRoute nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121859,12 +133256,16 @@ func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allIt // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPNServerRoutesPager) GetNext() (page []VPNServerRoute, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // VPNServersPager can be used to simplify the use of the "ListVPNServers" method. @@ -121880,7 +133281,7 @@ type VPNServersPager struct { // NewVPNServersPager returns a new VPNServersPager instance. func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPNServersPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121908,6 +133309,7 @@ func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VP result, _, err := pager.client.ListVPNServersWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -121916,7 +133318,8 @@ func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VP var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -121935,6 +133338,7 @@ func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems [ var nextPage []VPNServer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -121944,12 +133348,16 @@ func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems [ // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *VPNServersPager) GetNext() (page []VPNServer, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *VPNServersPager) GetAll() (allItems []VPNServer, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // LoadBalancerProfilesPager can be used to simplify the use of the "ListLoadBalancerProfiles" method. @@ -121965,7 +133373,7 @@ type LoadBalancerProfilesPager struct { // NewLoadBalancerProfilesPager returns a new LoadBalancerProfilesPager instance. func (vpc *VpcV1) NewLoadBalancerProfilesPager(options *ListLoadBalancerProfilesOptions) (pager *LoadBalancerProfilesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -121993,6 +133401,7 @@ func (pager *LoadBalancerProfilesPager) GetNextWithContext(ctx context.Context) result, _, err := pager.client.ListLoadBalancerProfilesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -122001,7 +133410,8 @@ func (pager *LoadBalancerProfilesPager) GetNextWithContext(ctx context.Context) var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -122020,6 +133430,7 @@ func (pager *LoadBalancerProfilesPager) GetAllWithContext(ctx context.Context) ( var nextPage []LoadBalancerProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -122029,12 +133440,16 @@ func (pager *LoadBalancerProfilesPager) GetAllWithContext(ctx context.Context) ( // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *LoadBalancerProfilesPager) GetNext() (page []LoadBalancerProfile, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *LoadBalancerProfilesPager) GetAll() (allItems []LoadBalancerProfile, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // LoadBalancersPager can be used to simplify the use of the "ListLoadBalancers" method. @@ -122050,7 +133465,7 @@ type LoadBalancersPager struct { // NewLoadBalancersPager returns a new LoadBalancersPager instance. func (vpc *VpcV1) NewLoadBalancersPager(options *ListLoadBalancersOptions) (pager *LoadBalancersPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -122078,6 +133493,7 @@ func (pager *LoadBalancersPager) GetNextWithContext(ctx context.Context) (page [ result, _, err := pager.client.ListLoadBalancersWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -122086,7 +133502,8 @@ func (pager *LoadBalancersPager) GetNextWithContext(ctx context.Context) (page [ var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -122105,6 +133522,7 @@ func (pager *LoadBalancersPager) GetAllWithContext(ctx context.Context) (allItem var nextPage []LoadBalancer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -122114,12 +133532,16 @@ func (pager *LoadBalancersPager) GetAllWithContext(ctx context.Context) (allItem // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *LoadBalancersPager) GetNext() (page []LoadBalancer, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *LoadBalancersPager) GetAll() (allItems []LoadBalancer, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // EndpointGatewayIpsPager can be used to simplify the use of the "ListEndpointGatewayIps" method. @@ -122135,7 +133557,7 @@ type EndpointGatewayIpsPager struct { // NewEndpointGatewayIpsPager returns a new EndpointGatewayIpsPager instance. func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOptions) (pager *EndpointGatewayIpsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -122163,6 +133585,7 @@ func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (p result, _, err := pager.client.ListEndpointGatewayIpsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -122171,7 +133594,8 @@ func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (p var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -122190,6 +133614,7 @@ func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (al var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -122199,12 +133624,16 @@ func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (al // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *EndpointGatewayIpsPager) GetNext() (page []ReservedIP, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // EndpointGatewaysPager can be used to simplify the use of the "ListEndpointGateways" method. @@ -122220,7 +133649,7 @@ type EndpointGatewaysPager struct { // NewEndpointGatewaysPager returns a new EndpointGatewaysPager instance. func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) (pager *EndpointGatewaysPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -122248,6 +133677,7 @@ func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (pag result, _, err := pager.client.ListEndpointGatewaysWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -122256,7 +133686,8 @@ func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (pag var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -122275,6 +133706,7 @@ func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allI var nextPage []EndpointGateway nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -122284,12 +133716,16 @@ func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allI // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *EndpointGatewaysPager) GetNext() (page []EndpointGateway, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // FlowLogCollectorsPager can be used to simplify the use of the "ListFlowLogCollectors" method. @@ -122305,7 +133741,7 @@ type FlowLogCollectorsPager struct { // NewFlowLogCollectorsPager returns a new FlowLogCollectorsPager instance. func (vpc *VpcV1) NewFlowLogCollectorsPager(options *ListFlowLogCollectorsOptions) (pager *FlowLogCollectorsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } @@ -122333,6 +133769,7 @@ func (pager *FlowLogCollectorsPager) GetNextWithContext(ctx context.Context) (pa result, _, err := pager.client.ListFlowLogCollectorsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -122341,7 +133778,8 @@ func (pager *FlowLogCollectorsPager) GetNextWithContext(ctx context.Context) (pa var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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 @@ -122360,6 +133798,7 @@ func (pager *FlowLogCollectorsPager) GetAllWithContext(ctx context.Context) (all var nextPage []FlowLogCollector nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -122369,10 +133808,14 @@ func (pager *FlowLogCollectorsPager) GetAllWithContext(ctx context.Context) (all // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. func (pager *FlowLogCollectorsPager) GetNext() (page []FlowLogCollector, err error) { - return pager.GetNextWithContext(context.Background()) + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *FlowLogCollectorsPager) GetAll() (allItems []FlowLogCollector, err error) { - return pager.GetAllWithContext(context.Background()) + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } diff --git a/go.mod b/go.mod index 6c9cfb6178..6d1054ab5b 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/IBM/event-notifications-go-admin-sdk v0.4.0 github.com/IBM/eventstreams-go-sdk v1.4.0 github.com/IBM/go-sdk-core/v3 v3.2.4 - github.com/IBM/go-sdk-core/v5 v5.15.3 + github.com/IBM/go-sdk-core/v5 v5.16.2 github.com/IBM/ibm-cos-sdk-go v1.10.0 github.com/IBM/ibm-cos-sdk-go-config v1.2.0 github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20211109141421-a4b61b05f7d1 diff --git a/go.sum b/go.sum index a3587f2f8c..ffa35d8cc5 100644 --- a/go.sum +++ b/go.sum @@ -140,8 +140,8 @@ github.com/IBM/go-sdk-core/v5 v5.7.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= -github.com/IBM/go-sdk-core/v5 v5.15.3 h1:yBSSYLuQSO9Ip+j3mONsTcymoYQyxarQ6rh3aU9cVt8= -github.com/IBM/go-sdk-core/v5 v5.15.3/go.mod h1:ee+AZaB15yUwZigJdRCwZZ3u7HIvEQzxNUdxVpnJHY8= +github.com/IBM/go-sdk-core/v5 v5.16.2 h1:4psKDqjN6mPacgbaRjV/qcYtXlnAEISLJF/QQa7FQqo= +github.com/IBM/go-sdk-core/v5 v5.16.2/go.mod h1:aojBkkq4HXkOYdn7YZ6ve8cjPWHdcB3tt8v0b9Cbac8= github.com/IBM/ibm-cos-sdk-go v1.3.1/go.mod h1:YLBAYobEA8bD27P7xpMwSQeNQu6W3DNBtBComXrRzRY= github.com/IBM/ibm-cos-sdk-go v1.10.0 h1:/2VIev2/jBei39OqU2+nSZQnoWJ+KtkiSAIDkqsd7uU= github.com/IBM/ibm-cos-sdk-go v1.10.0/go.mod h1:C8KRTRaoD3CWPPBOa6FCOpdh0ZMlUjKAAA4i3F+Q/sc= @@ -174,8 +174,6 @@ github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4 h1:xa9e+POVqaXxXHXkSMCOVAbKdUNEu github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4/go.mod h1:5gq8D8uWOIbqOm1uztay6lpOysgJaxxEsaVZLWGWb40= github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQyz4uc= github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA= -github.com/IBM/vpc-go-sdk v0.48.0 h1:4yeSxVX9mizsIW2F0rsVI47rZoNKBrZ1QK9RwwRas9Q= -github.com/IBM/vpc-go-sdk v0.48.0/go.mod h1:FDJpiokOmaYG2hNYDfqKVxUPe8mm/dPi3mdz8Zt4o/Q= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= @@ -440,6 +438,7 @@ github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3 github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= 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/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= @@ -570,6 +569,7 @@ github.com/go-ozzo/ozzo-validation v3.6.0+incompatible h1:msy24VGS42fKO9K1vLz82/ github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es= github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew= 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.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= @@ -1522,8 +1522,10 @@ github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= @@ -1631,6 +1633,7 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1888,6 +1891,7 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1900,6 +1904,7 @@ golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= @@ -1916,6 +1921,7 @@ golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1929,6 +1935,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= From ada59c02c969e135bf7854ae6d424f229c53c831 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Mon, 1 Apr 2024 10:26:32 +0530 Subject: [PATCH 071/103] sdk changes --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 174 ++---------------- .../vpc/resource_ibm_is_lb_listener.go | 2 +- .../vpc/resource_ibm_is_lb_listener_policy.go | 12 +- 3 files changed, 21 insertions(+), 167 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index cd780f0bb4..6b9d822e32 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -35787,7 +35787,7 @@ type BareMetalServerPrototype struct { // // 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 BareMetalServerPrototypeVPCIntf `json:"vpc,omitempty"` + VPC VPCIdentityIntf `json:"vpc,omitempty"` // The zone this bare metal server will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` @@ -35846,7 +35846,7 @@ func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result inte err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalBareMetalServerPrototypeVPC) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return @@ -35880,55 +35880,6 @@ func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result inte return } -// BareMetalServerPrototypeVPC : 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. -// Models which "extend" this model: -// - BareMetalServerPrototypeVPCVPCIdentityByID -// - BareMetalServerPrototypeVPCVPCIdentityByCRN -// - BareMetalServerPrototypeVPCVPCIdentityByHref -type BareMetalServerPrototypeVPC struct { - // The unique identifier for this VPC. - ID *string `json:"id,omitempty"` - - // The CRN for this VPC. - CRN *string `json:"crn,omitempty"` - - // The URL for this VPC. - Href *string `json:"href,omitempty"` -} - -func (*BareMetalServerPrototypeVPC) isaBareMetalServerPrototypeVPC() bool { - return true -} - -type BareMetalServerPrototypeVPCIntf interface { - isaBareMetalServerPrototypeVPC() bool -} - -// UnmarshalBareMetalServerPrototypeVPC unmarshals an instance of BareMetalServerPrototypeVPC from the specified map of raw messages. -func UnmarshalBareMetalServerPrototypeVPC(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrototypeVPC) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // BareMetalServerStatusReason : BareMetalServerStatusReason struct type BareMetalServerStatusReason struct { // The status reason code: @@ -96772,111 +96723,6 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCountRange(m map[string]json return } -// BareMetalServerPrototypeVPCVPCIdentityByCRN : BareMetalServerPrototypeVPCVPCIdentityByCRN struct -// This model "extends" BareMetalServerPrototypeVPC -type BareMetalServerPrototypeVPCVPCIdentityByCRN struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` -} - -// NewBareMetalServerPrototypeVPCVPCIdentityByCRN : Instantiate BareMetalServerPrototypeVPCVPCIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrototypeVPCVPCIdentityByCRN(crn string) (_model *BareMetalServerPrototypeVPCVPCIdentityByCRN, err error) { - _model = &BareMetalServerPrototypeVPCVPCIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerPrototypeVPCVPCIdentityByCRN) isaBareMetalServerPrototypeVPC() bool { - return true -} - -// UnmarshalBareMetalServerPrototypeVPCVPCIdentityByCRN unmarshals an instance of BareMetalServerPrototypeVPCVPCIdentityByCRN from the specified map of raw messages. -func UnmarshalBareMetalServerPrototypeVPCVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrototypeVPCVPCIdentityByCRN) - 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 -} - -// BareMetalServerPrototypeVPCVPCIdentityByHref : BareMetalServerPrototypeVPCVPCIdentityByHref struct -// This model "extends" BareMetalServerPrototypeVPC -type BareMetalServerPrototypeVPCVPCIdentityByHref struct { - // The URL for this VPC. - Href *string `json:"href" validate:"required"` -} - -// NewBareMetalServerPrototypeVPCVPCIdentityByHref : Instantiate BareMetalServerPrototypeVPCVPCIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrototypeVPCVPCIdentityByHref(href string) (_model *BareMetalServerPrototypeVPCVPCIdentityByHref, err error) { - _model = &BareMetalServerPrototypeVPCVPCIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerPrototypeVPCVPCIdentityByHref) isaBareMetalServerPrototypeVPC() bool { - return true -} - -// UnmarshalBareMetalServerPrototypeVPCVPCIdentityByHref unmarshals an instance of BareMetalServerPrototypeVPCVPCIdentityByHref from the specified map of raw messages. -func UnmarshalBareMetalServerPrototypeVPCVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrototypeVPCVPCIdentityByHref) - 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 -} - -// BareMetalServerPrototypeVPCVPCIdentityByID : BareMetalServerPrototypeVPCVPCIdentityByID struct -// This model "extends" BareMetalServerPrototypeVPC -type BareMetalServerPrototypeVPCVPCIdentityByID struct { - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` -} - -// NewBareMetalServerPrototypeVPCVPCIdentityByID : Instantiate BareMetalServerPrototypeVPCVPCIdentityByID (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrototypeVPCVPCIdentityByID(id string) (_model *BareMetalServerPrototypeVPCVPCIdentityByID, err error) { - _model = &BareMetalServerPrototypeVPCVPCIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerPrototypeVPCVPCIdentityByID) isaBareMetalServerPrototypeVPC() bool { - return true -} - -// UnmarshalBareMetalServerPrototypeVPCVPCIdentityByID unmarshals an instance of BareMetalServerPrototypeVPCVPCIdentityByID from the specified map of raw messages. -func UnmarshalBareMetalServerPrototypeVPCVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrototypeVPCVPCIdentityByID) - 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 -} - // BareMetalServerPrototypeBareMetalServerByNetworkAttachment : BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct // This model "extends" BareMetalServerPrototype type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { @@ -96900,7 +96746,11 @@ type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` - VPC BareMetalServerPrototypeVPCIntf `json:"vpc,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"` @@ -96964,7 +96814,7 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[s err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalBareMetalServerPrototypeVPC) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return @@ -97011,7 +96861,11 @@ type BareMetalServerPrototypeBareMetalServerByNetworkInterface struct { TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` - VPC BareMetalServerPrototypeVPCIntf `json:"vpc,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"` @@ -97075,7 +96929,7 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface(m map[st err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalBareMetalServerPrototypeVPC) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) if err != nil { err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return diff --git a/ibm/service/vpc/resource_ibm_is_lb_listener.go b/ibm/service/vpc/resource_ibm_is_lb_listener.go index 84ee4ee34e..667c382d6c 100644 --- a/ibm/service/vpc/resource_ibm_is_lb_listener.go +++ b/ibm/service/vpc/resource_ibm_is_lb_listener.go @@ -619,7 +619,7 @@ func lbListenerUpdate(d *schema.ResourceData, meta interface{}, lbID, lbListener diag.FromErr(err) } defPool = lbpool - loadBalancerListenerPatchModel.DefaultPool = &vpcv1.LoadBalancerPoolIdentity{ + loadBalancerListenerPatchModel.DefaultPool = &vpcv1.LoadBalancerListenerDefaultPoolPatch{ ID: &defPool, } hasChanged = true diff --git a/ibm/service/vpc/resource_ibm_is_lb_listener_policy.go b/ibm/service/vpc/resource_ibm_is_lb_listener_policy.go index 03ee1638ad..1c078c4e9b 100644 --- a/ibm/service/vpc/resource_ibm_is_lb_listener_policy.go +++ b/ibm/service/vpc/resource_ibm_is_lb_listener_policy.go @@ -500,7 +500,7 @@ func lbListenerPolicyCreate(d *schema.ResourceData, meta interface{}, lbID, list target = &urlPrototype } else if actionChk.(string) == "https_redirect" { - urlPrototype := vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerHTTPSRedirectPrototype{} + urlPrototype := vpcv1.LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype{} if listenerSet { listener := listener.(string) @@ -838,7 +838,7 @@ func lbListenerPolicyUpdate(d *schema.ResourceData, meta interface{}, lbID, list } } else if d.Get(isLBListenerPolicyAction).(string) == "https_redirect" { - httpsRedirectPatch := vpcv1.LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerHTTPSRedirectPatch{} + httpsRedirectPatch := vpcv1.LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch{} targetChange := false if d.HasChange(isLBListenerPolicyHTTPSRedirectListener) { @@ -1122,7 +1122,7 @@ func lbListenerPolicyGet(d *schema.ResourceData, meta interface{}, lbID, listene } } else if *(policy.Action) == "https_redirect" { if reflect.TypeOf(policy.Target).String() == "*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect" { - target, ok := policy.Target.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) + target, ok := policy.Target.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect) if ok { d.Set(isLBListenerPolicyHTTPSRedirectListener, target.Listener.ID) d.Set(isLBListenerPolicyHTTPSRedirectStatusCode, target.HTTPStatusCode) @@ -1180,8 +1180,8 @@ func resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetToMap(model vp return resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetLoadBalancerPoolReferenceToMap(model.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerPoolReference)) } else if _, ok := model.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL); ok { return resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURLToMap(model.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL)) - } else if _, ok := model.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect); ok { - return resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirectToMap(model.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect)) + } else if _, ok := model.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect); ok { + return resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirectToMap(model.(*vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect)) } else if _, ok := model.(*vpcv1.LoadBalancerListenerPolicyTarget); ok { modelMap := make(map[string]interface{}) model := model.(*vpcv1.LoadBalancerListenerPolicyTarget) @@ -1271,7 +1271,7 @@ func resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetLoadBalancerLi return modelMap, nil } -func resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirectToMap(model *vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirect) (map[string]interface{}, error) { +func resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetLoadBalancerListenerHTTPSRedirectToMap(model *vpcv1.LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["http_status_code"] = flex.IntValue(model.HTTPStatusCode) listenerMap, err := resourceIBMIsLbListenerPolicyLoadBalancerListenerReferenceToMap(model.Listener) From 4f32b5ae6bcde5f0e7828d2fa31ce3d611d63e09 Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Mon, 8 Apr 2024 14:10:27 +0530 Subject: [PATCH 072/103] set version to todays date in sdk --- common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 6b9d822e32..3a6e620f85 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -35,6 +35,10 @@ import ( "github.com/go-openapi/strfmt" ) +const ( + YYYYMMDD = "2006-01-02" +) + // 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. // @@ -128,8 +132,9 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } } + now := time.Now().UTC() if options.Version == nil { - options.Version = core.StringPtr("2024-04-01") + options.Version = core.StringPtr(now.Format(YYYYMMDD)) } service = &VpcV1{ From f594a92c408a06de1d5952a91cea91211cac348d Mon Sep 17 00:00:00 2001 From: Deepak Selvakumar <77007253+deepaksibm@users.noreply.github.com> Date: Fri, 12 Apr 2024 13:25:51 +0530 Subject: [PATCH 073/103] temporary fix for routing protocol in sdk. --- common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 3a6e620f85..b8a74ae5aa 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -86601,7 +86601,7 @@ func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interfac err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionPolicyMode-error", common.GetComponentInfo()) } } else if discValue == "route" { - err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteMode) + err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionRouteMode-error", common.GetComponentInfo()) } From 744f904d08ce63e8bc5072bbf756b7930f206b80 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 25 Apr 2024 13:29:57 +0530 Subject: [PATCH 074/103] error resolved --- go.mod | 35 ++++---- go.sum | 89 +++++++++---------- ...ta_source_ibm_is_vpn_gateway_connection.go | 2 +- 3 files changed, 60 insertions(+), 66 deletions(-) diff --git a/go.mod b/go.mod index 6d1054ab5b..3a0a243d0a 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,7 @@ require ( github.com/google/uuid v1.6.0 github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version v1.6.0 - github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 + github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 github.com/jinzhu/copier v0.3.2 github.com/minsikl/netscaler-nitro-go v0.0.0-20170827154432-5b14ce3643e3 github.com/mitchellh/go-homedir v1.1.0 @@ -73,7 +73,7 @@ require ( cloud.google.com/go/monitoring v1.13.0 // indirect github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 // indirect github.com/PromonLogicalis/asn1 v0.0.0-20190312173541-d60463189a56 // indirect - github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect + github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect github.com/agext/levenshtein v1.2.2 // indirect github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect github.com/apex/log v1.9.0 // indirect @@ -95,7 +95,7 @@ require ( github.com/eapache/queue v1.1.0 // indirect github.com/emicklei/go-restful/v3 v3.10.0 // indirect github.com/evanphx/json-patch/v5 v5.6.0 // indirect - github.com/fatih/color v1.15.0 // indirect + github.com/fatih/color v1.16.0 // indirect github.com/frankban/quicktest v1.14.3 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect @@ -128,22 +128,22 @@ require ( github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.5.1 // indirect + github.com/hashicorp/go-plugin v1.6.0 // indirect github.com/hashicorp/go-retryablehttp v0.7.5 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect github.com/hashicorp/go-sockaddr v1.0.2 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect - github.com/hashicorp/hc-install v0.6.1 // indirect + github.com/hashicorp/hc-install v0.6.3 // indirect github.com/hashicorp/hcl v1.0.1-vault-5 // indirect github.com/hashicorp/hcl/v2 v2.19.1 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/hashicorp/terraform-exec v0.19.0 // indirect - github.com/hashicorp/terraform-json v0.17.1 // indirect - github.com/hashicorp/terraform-plugin-go v0.19.0 // indirect + github.com/hashicorp/terraform-exec v0.20.0 // indirect + github.com/hashicorp/terraform-json v0.21.0 // indirect + github.com/hashicorp/terraform-plugin-go v0.22.0 // indirect github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect - github.com/hashicorp/terraform-registry-address v0.2.2 // indirect + github.com/hashicorp/terraform-registry-address v0.2.3 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/vault v1.13.7 // indirect github.com/hashicorp/vault/api v1.9.2 // indirect @@ -167,7 +167,7 @@ require ( github.com/libopenstorage/secrets v0.0.0-20220823020833-2ecadaf59d8a // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.18 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect @@ -199,26 +199,25 @@ require ( github.com/stretchr/objx v0.5.0 // indirect github.com/stretchr/testify v1.8.4 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect - github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect + github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - github.com/zclconf/go-cty v1.14.1 // indirect + github.com/zclconf/go-cty v1.14.2 // indirect go.mongodb.org/mongo-driver v1.14.0 // indirect go.opentelemetry.io/otel v1.14.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect go.uber.org/ratelimit v0.2.0 // indirect - golang.org/x/mod v0.14.0 // indirect + golang.org/x/mod v0.15.0 // indirect golang.org/x/net v0.21.0 // indirect - golang.org/x/oauth2 v0.7.0 // indirect - golang.org/x/sync v0.5.0 // indirect + golang.org/x/oauth2 v0.14.0 // indirect golang.org/x/sys v0.17.0 // indirect golang.org/x/term v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.16.0 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect - google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect - google.golang.org/grpc v1.57.1 // indirect + google.golang.org/appengine v1.6.8 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect + google.golang.org/grpc v1.61.1 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/go-playground/validator.v9 v9.31.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index ffa35d8cc5..7a36388a94 100644 --- a/go.sum +++ b/go.sum @@ -28,7 +28,7 @@ cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvf cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute v1.19.1 h1:am86mquDUgjGNWxiGn+5PGLbmgiWXlE/yNWpIpNvuXY= +cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= @@ -181,9 +181,9 @@ github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56/go.mod h1:Zb3OT4l0m github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= -github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= +github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= -github.com/Masterminds/sprig/v3 v3.2.1 h1:n6EPaDyLSvCEa3frruQvAiHuNp2dhBlMSmkEr+HuzGc= +github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= github.com/Microsoft/go-winio v0.4.13/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= @@ -193,8 +193,8 @@ github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8 github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PromonLogicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:zL3Ph7RCZadAPb7QV0gMIDmjuZHFawNhoPZ5erh6TRw= github.com/PromonLogicalis/asn1 v0.0.0-20190312173541-d60463189a56/go.mod h1:nE9BGpMlMfM9Z3U+P+mWtcHNDwHcGctalMx1VTkODAY= -github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= -github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= +github.com/ProtonMail/go-crypto v1.1.0-alpha.0 h1:nHGfwXmFvJrSR9xu8qL7BkO4DqTHXE9N5vPhgY2I+j0= +github.com/ProtonMail/go-crypto v1.1.0-alpha.0/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -208,7 +208,6 @@ github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWX github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= -github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= @@ -289,7 +288,6 @@ github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyX github.com/briankassouf/jose v0.9.2-0.20180619214549-d2569464773f/go.mod h1:HQhVmdUf7dBNwIIdBTivnCDxcf6IZY3/zrb+uKSJz6Y= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= -github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= @@ -312,7 +310,6 @@ github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6D github.com/circonus-labs/circonusllhist v0.1.3 h1:TJH+oke8D16535+jHExHj4nQvzlZrj7ug5D7I/orNUA= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= github.com/cloudfoundry-community/go-cfclient v0.0.0-20190201205600-f136f9222381/go.mod h1:e5+USP2j8Le2M0Jo3qKPFnNhuo1wueU4nWHCXBOfQ14= @@ -423,8 +420,8 @@ github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2Vvl github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +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/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= @@ -457,7 +454,7 @@ github.com/go-asn1-ber/asn1-ber v1.3.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkPro github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= -github.com/go-git/go-git/v5 v5.9.0 h1:cD9SFA7sHVRdJ7AYck1ZaAa/yeuBvGPxwXDL8cxrObY= +github.com/go-git/go-git/v5 v5.11.0 h1:XIZc1p+8YzypNr34itUfSvYJcv+eYdTnTvOZ2vD3cA4= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -830,8 +827,8 @@ github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9 github.com/hashicorp/go-plugin v1.0.0/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= github.com/hashicorp/go-plugin v1.4.3/go.mod h1:5fGEH17QVwTTcR0zV7yhDPLLmFX9YSZ38b18Udy6vYQ= -github.com/hashicorp/go-plugin v1.5.1 h1:oGm7cWBaYIp3lJpx1RUEfLWophprE2EV/KUeqBYo+6k= -github.com/hashicorp/go-plugin v1.5.1/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= +github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= +github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= github.com/hashicorp/go-raftchunking v0.6.3-0.20191002164813-7e9e8525653a h1:FmnBDwGwlTgugDGbVxwV8UavqSMACbGrUpfc98yFLR4= github.com/hashicorp/go-raftchunking v0.6.3-0.20191002164813-7e9e8525653a/go.mod h1:xbXnmKqX9/+RhPkJ4zrEx4738HacP72aaUPlT2RZ4sU= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= @@ -885,8 +882,8 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hc-install v0.6.1 h1:IGxShH7AVhPaSuSJpKtVi/EFORNjO+OYVJJrAtGG2mY= -github.com/hashicorp/hc-install v0.6.1/go.mod h1:0fW3jpg+wraYSnFDJ6Rlie3RvLf1bIqVIkzoon4KoVE= +github.com/hashicorp/hc-install v0.6.3 h1:yE/r1yJvWbtrJ0STwScgEnCanb0U9v7zp0Gbkmcoxqs= +github.com/hashicorp/hc-install v0.6.3/go.mod h1:KamGdbodYzlufbWh4r9NRo8y6GLHWZP2GBtdnms1Ln0= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31RPDgJM= github.com/hashicorp/hcl v1.0.1-vault-5/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= @@ -911,18 +908,18 @@ github.com/hashicorp/raft-snapshot v1.0.2-0.20190827162939-8117efcc5aab/go.mod h github.com/hashicorp/raft-snapshot v1.0.4 h1:EuDuayAJPdiDmVk1ygTDnG2zDzrs0/6/yBuma1IYSow= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.8.3/go.mod h1:UpNcs7fFbpKIyZaUuSW6EPiH+eZC7OuyFD+wc1oal+k= -github.com/hashicorp/terraform-exec v0.19.0 h1:FpqZ6n50Tk95mItTSS9BjeOVUb4eg81SpgVtZNNtFSM= -github.com/hashicorp/terraform-exec v0.19.0/go.mod h1:tbxUpe3JKruE9Cuf65mycSIT8KiNPZ0FkuTE3H4urQg= -github.com/hashicorp/terraform-json v0.17.1 h1:eMfvh/uWggKmY7Pmb3T85u86E2EQg6EQHgyRwf3RkyA= -github.com/hashicorp/terraform-json v0.17.1/go.mod h1:Huy6zt6euxaY9knPAFKjUITn8QxUFIe9VuSzb4zn/0o= -github.com/hashicorp/terraform-plugin-go v0.19.0 h1:BuZx/6Cp+lkmiG0cOBk6Zps0Cb2tmqQpDM3iAtnhDQU= -github.com/hashicorp/terraform-plugin-go v0.19.0/go.mod h1:EhRSkEPNoylLQntYsk5KrDHTZJh9HQoumZXbOGOXmec= +github.com/hashicorp/terraform-exec v0.20.0 h1:DIZnPsqzPGuUnq6cH8jWcPunBfY+C+M8JyYF3vpnuEo= +github.com/hashicorp/terraform-exec v0.20.0/go.mod h1:ckKGkJWbsNqFKV1itgMnE0hY9IYf1HoiekpuN0eWoDw= +github.com/hashicorp/terraform-json v0.21.0 h1:9NQxbLNqPbEMze+S6+YluEdXgJmhQykRyRNd+zTI05U= +github.com/hashicorp/terraform-json v0.21.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk= +github.com/hashicorp/terraform-plugin-go v0.22.0 h1:1OS1Jk5mO0f5hrziWJGXXIxBrMe2j/B8E+DVGw43Xmc= +github.com/hashicorp/terraform-plugin-go v0.22.0/go.mod h1:mPULV91VKss7sik6KFEcEu7HuTogMLLO/EvWCuFkRVE= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 h1:wcOKYwPI9IorAJEBLzgclh3xVolO7ZorYd6U1vnok14= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0/go.mod h1:qH/34G25Ugdj5FcM95cSoXzUgIbgfhVLXCcEcYaMwq8= -github.com/hashicorp/terraform-registry-address v0.2.2 h1:lPQBg403El8PPicg/qONZJDC6YlgCVbWDtNmmZKtBno= -github.com/hashicorp/terraform-registry-address v0.2.2/go.mod h1:LtwNbCihUoUZ3RYriyS2wF/lGPB6gF9ICLRtuDk7hSo= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= +github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= +github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/vault v1.4.2/go.mod h1:500fLOj7p92Ys4X265LizqF78MzmHJUf1jV1zNJt060= @@ -981,7 +978,7 @@ github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbg github.com/hokaccha/go-prettyjson v0.0.0-20170213120834-e6b9231a2b1c h1:vlXZsaTgJ55QZrAkOrpq0tsJmuuM4ky5OMZOvXnhvqE= github.com/hokaccha/go-prettyjson v0.0.0-20170213120834-e6b9231a2b1c/go.mod h1:pFlLw2CfqZiIBOx6BuCeRLCrfxBJipTY0nIOF/VbGcI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= +github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -1132,8 +1129,8 @@ github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOA github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= -github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +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/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-shellwords v1.0.5/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= @@ -1438,7 +1435,7 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM= +github.com/skeema/knownhosts v1.2.1 h1:SHWdIUa82uGZz+F+47k8SY4QhhI291cXCpopT1lK2AQ= github.com/smartystreets/assertions v0.0.0-20180725160413-e900ae048470/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= @@ -1513,8 +1510,8 @@ github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= -github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= +github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= +github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/vmware/govmomi v0.18.0 h1:f7QxSmP7meCtoAmiKZogvVbLInT+CZx6Px6K5rYsJZo= @@ -1544,8 +1541,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= -github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA= -github.com/zclconf/go-cty v1.14.1/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +github.com/zclconf/go-cty v1.14.2 h1:kTG7lqmBou0Zkx35r6HJHUQTvaRPr5bIAf3AoHS0izI= +github.com/zclconf/go-cty v1.14.2/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= @@ -1627,9 +1624,7 @@ golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= @@ -1680,8 +1675,8 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1778,8 +1773,8 @@ golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= -golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= +golang.org/x/oauth2 v0.14.0 h1:P0Vrf/2538nmC0H+pEQ3MNFRRnVR7RlqyVw+bvm26z0= +golang.org/x/oauth2 v0.14.0/go.mod h1:lAtNWgaWfL4cm7j2OV8TxGi9Qb7ECORx8DktCY74OwM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1797,7 +1792,6 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -2081,8 +2075,9 @@ google.golang.org/appengine v1.6.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= +google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181219182458-5a97ab628bfb/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= @@ -2131,10 +2126,10 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 h1:9NWlQfY2ePejTmfwUH1OWwmznFa+0kKcHGPDvcPza9M= -google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 h1:m8v1xLLLzMe1m5P+gCTF8nJB9epwZQUBERm20Oy1poQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= +google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= +google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 h1:JpwMPBpFN3uKhdaekDpiNlImDdkUAyiJ6ez/uxGaUSo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= @@ -2163,8 +2158,8 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= -google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg= -google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY= +google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go index 7bda15c55d..5459403b48 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go @@ -426,7 +426,7 @@ func dataSourceIBMIsVPNGatewayConnectionRead(context context.Context, d *schema. getVPNGatewayConnectionOptions.SetID(vpn_gateway_connection) vpnGatewayConnectionIntf, response, err := vpcClient.GetVPNGatewayConnectionWithContext(context, getVPNGatewayConnectionOptions) - if err != nil || vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection) == nil { + if err != nil || vpnGatewayConnectionIntf == nil { log.Printf("[DEBUG] GetVPNGatewayConnectionWithContext failed %s\n%s", err, response) return diag.FromErr(fmt.Errorf("GetVPNGatewayConnectionWithContext failed %s\n%s", err, response)) } From d7d77657861776d35c29023ffa9b9bce39fc12b7 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 25 Apr 2024 13:32:14 +0530 Subject: [PATCH 075/103] go mod changes reverted --- go.mod | 37 ++++++++++---------- go.sum | 91 ++++++++++++++++++++++++++---------------------- scripts/build.sh | 2 +- 3 files changed, 69 insertions(+), 61 deletions(-) diff --git a/go.mod b/go.mod index 3a0a243d0a..456ac55837 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,7 @@ require ( github.com/google/uuid v1.6.0 github.com/hashicorp/go-uuid v1.0.3 github.com/hashicorp/go-version v1.6.0 - github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 + github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 github.com/jinzhu/copier v0.3.2 github.com/minsikl/netscaler-nitro-go v0.0.0-20170827154432-5b14ce3643e3 github.com/mitchellh/go-homedir v1.1.0 @@ -73,7 +73,7 @@ require ( cloud.google.com/go/monitoring v1.13.0 // indirect github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 // indirect github.com/PromonLogicalis/asn1 v0.0.0-20190312173541-d60463189a56 // indirect - github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect + github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect github.com/agext/levenshtein v1.2.2 // indirect github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 // indirect github.com/apex/log v1.9.0 // indirect @@ -95,7 +95,7 @@ require ( github.com/eapache/queue v1.1.0 // indirect github.com/emicklei/go-restful/v3 v3.10.0 // indirect github.com/evanphx/json-patch/v5 v5.6.0 // indirect - github.com/fatih/color v1.16.0 // indirect + github.com/fatih/color v1.15.0 // indirect github.com/frankban/quicktest v1.14.3 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect @@ -128,22 +128,22 @@ require ( github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.6.0 // indirect + github.com/hashicorp/go-plugin v1.5.1 // indirect github.com/hashicorp/go-retryablehttp v0.7.5 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect github.com/hashicorp/go-sockaddr v1.0.2 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect - github.com/hashicorp/hc-install v0.6.3 // indirect + github.com/hashicorp/hc-install v0.6.1 // indirect github.com/hashicorp/hcl v1.0.1-vault-5 // indirect github.com/hashicorp/hcl/v2 v2.19.1 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/hashicorp/terraform-exec v0.20.0 // indirect - github.com/hashicorp/terraform-json v0.21.0 // indirect - github.com/hashicorp/terraform-plugin-go v0.22.0 // indirect + github.com/hashicorp/terraform-exec v0.19.0 // indirect + github.com/hashicorp/terraform-json v0.17.1 // indirect + github.com/hashicorp/terraform-plugin-go v0.19.0 // indirect github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect - github.com/hashicorp/terraform-registry-address v0.2.3 // indirect + github.com/hashicorp/terraform-registry-address v0.2.2 // indirect github.com/hashicorp/terraform-svchost v0.1.1 // indirect github.com/hashicorp/vault v1.13.7 // indirect github.com/hashicorp/vault/api v1.9.2 // indirect @@ -167,7 +167,7 @@ require ( github.com/libopenstorage/secrets v0.0.0-20220823020833-2ecadaf59d8a // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-isatty v0.0.18 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect @@ -199,25 +199,26 @@ require ( github.com/stretchr/objx v0.5.0 // indirect github.com/stretchr/testify v1.8.4 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect - github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect + github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - github.com/zclconf/go-cty v1.14.2 // indirect + github.com/zclconf/go-cty v1.14.1 // indirect go.mongodb.org/mongo-driver v1.14.0 // indirect go.opentelemetry.io/otel v1.14.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect go.uber.org/ratelimit v0.2.0 // indirect - golang.org/x/mod v0.15.0 // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.21.0 // indirect - golang.org/x/oauth2 v0.14.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/oauth2 v0.7.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.19.0 // indirect golang.org/x/term v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.16.0 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect - google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect - google.golang.org/grpc v1.61.1 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect + google.golang.org/grpc v1.57.1 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/go-playground/validator.v9 v9.31.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index 7a36388a94..ce4a1779e7 100644 --- a/go.sum +++ b/go.sum @@ -28,7 +28,7 @@ cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvf cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= +cloud.google.com/go/compute v1.19.1 h1:am86mquDUgjGNWxiGn+5PGLbmgiWXlE/yNWpIpNvuXY= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= @@ -181,9 +181,9 @@ github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56/go.mod h1:Zb3OT4l0m github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= -github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= +github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= -github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= +github.com/Masterminds/sprig/v3 v3.2.1 h1:n6EPaDyLSvCEa3frruQvAiHuNp2dhBlMSmkEr+HuzGc= github.com/Microsoft/go-winio v0.4.13/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= @@ -193,8 +193,8 @@ github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8 github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PromonLogicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:zL3Ph7RCZadAPb7QV0gMIDmjuZHFawNhoPZ5erh6TRw= github.com/PromonLogicalis/asn1 v0.0.0-20190312173541-d60463189a56/go.mod h1:nE9BGpMlMfM9Z3U+P+mWtcHNDwHcGctalMx1VTkODAY= -github.com/ProtonMail/go-crypto v1.1.0-alpha.0 h1:nHGfwXmFvJrSR9xu8qL7BkO4DqTHXE9N5vPhgY2I+j0= -github.com/ProtonMail/go-crypto v1.1.0-alpha.0/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 h1:kkhsdkhsCvIsutKu5zLMgWtgh9YxGCNAw8Ad8hjwfYg= +github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -208,6 +208,7 @@ github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWX github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= +github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= @@ -288,6 +289,7 @@ github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyX github.com/briankassouf/jose v0.9.2-0.20180619214549-d2569464773f/go.mod h1:HQhVmdUf7dBNwIIdBTivnCDxcf6IZY3/zrb+uKSJz6Y= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= @@ -310,6 +312,7 @@ github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6D github.com/circonus-labs/circonusllhist v0.1.3 h1:TJH+oke8D16535+jHExHj4nQvzlZrj7ug5D7I/orNUA= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= github.com/cloudfoundry-community/go-cfclient v0.0.0-20190201205600-f136f9222381/go.mod h1:e5+USP2j8Le2M0Jo3qKPFnNhuo1wueU4nWHCXBOfQ14= @@ -420,8 +423,8 @@ github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2Vvl github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -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/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= @@ -454,7 +457,7 @@ github.com/go-asn1-ber/asn1-ber v1.3.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkPro github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= -github.com/go-git/go-git/v5 v5.11.0 h1:XIZc1p+8YzypNr34itUfSvYJcv+eYdTnTvOZ2vD3cA4= +github.com/go-git/go-git/v5 v5.9.0 h1:cD9SFA7sHVRdJ7AYck1ZaAa/yeuBvGPxwXDL8cxrObY= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -827,8 +830,8 @@ github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9 github.com/hashicorp/go-plugin v1.0.0/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= github.com/hashicorp/go-plugin v1.4.3/go.mod h1:5fGEH17QVwTTcR0zV7yhDPLLmFX9YSZ38b18Udy6vYQ= -github.com/hashicorp/go-plugin v1.6.0 h1:wgd4KxHJTVGGqWBq4QPB1i5BZNEx9BR8+OFmHDmTk8A= -github.com/hashicorp/go-plugin v1.6.0/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI= +github.com/hashicorp/go-plugin v1.5.1 h1:oGm7cWBaYIp3lJpx1RUEfLWophprE2EV/KUeqBYo+6k= +github.com/hashicorp/go-plugin v1.5.1/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/hashicorp/go-raftchunking v0.6.3-0.20191002164813-7e9e8525653a h1:FmnBDwGwlTgugDGbVxwV8UavqSMACbGrUpfc98yFLR4= github.com/hashicorp/go-raftchunking v0.6.3-0.20191002164813-7e9e8525653a/go.mod h1:xbXnmKqX9/+RhPkJ4zrEx4738HacP72aaUPlT2RZ4sU= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= @@ -882,8 +885,8 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/hc-install v0.6.3 h1:yE/r1yJvWbtrJ0STwScgEnCanb0U9v7zp0Gbkmcoxqs= -github.com/hashicorp/hc-install v0.6.3/go.mod h1:KamGdbodYzlufbWh4r9NRo8y6GLHWZP2GBtdnms1Ln0= +github.com/hashicorp/hc-install v0.6.1 h1:IGxShH7AVhPaSuSJpKtVi/EFORNjO+OYVJJrAtGG2mY= +github.com/hashicorp/hc-install v0.6.1/go.mod h1:0fW3jpg+wraYSnFDJ6Rlie3RvLf1bIqVIkzoon4KoVE= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31RPDgJM= github.com/hashicorp/hcl v1.0.1-vault-5/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= @@ -908,18 +911,18 @@ github.com/hashicorp/raft-snapshot v1.0.2-0.20190827162939-8117efcc5aab/go.mod h github.com/hashicorp/raft-snapshot v1.0.4 h1:EuDuayAJPdiDmVk1ygTDnG2zDzrs0/6/yBuma1IYSow= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.8.3/go.mod h1:UpNcs7fFbpKIyZaUuSW6EPiH+eZC7OuyFD+wc1oal+k= -github.com/hashicorp/terraform-exec v0.20.0 h1:DIZnPsqzPGuUnq6cH8jWcPunBfY+C+M8JyYF3vpnuEo= -github.com/hashicorp/terraform-exec v0.20.0/go.mod h1:ckKGkJWbsNqFKV1itgMnE0hY9IYf1HoiekpuN0eWoDw= -github.com/hashicorp/terraform-json v0.21.0 h1:9NQxbLNqPbEMze+S6+YluEdXgJmhQykRyRNd+zTI05U= -github.com/hashicorp/terraform-json v0.21.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk= -github.com/hashicorp/terraform-plugin-go v0.22.0 h1:1OS1Jk5mO0f5hrziWJGXXIxBrMe2j/B8E+DVGw43Xmc= -github.com/hashicorp/terraform-plugin-go v0.22.0/go.mod h1:mPULV91VKss7sik6KFEcEu7HuTogMLLO/EvWCuFkRVE= +github.com/hashicorp/terraform-exec v0.19.0 h1:FpqZ6n50Tk95mItTSS9BjeOVUb4eg81SpgVtZNNtFSM= +github.com/hashicorp/terraform-exec v0.19.0/go.mod h1:tbxUpe3JKruE9Cuf65mycSIT8KiNPZ0FkuTE3H4urQg= +github.com/hashicorp/terraform-json v0.17.1 h1:eMfvh/uWggKmY7Pmb3T85u86E2EQg6EQHgyRwf3RkyA= +github.com/hashicorp/terraform-json v0.17.1/go.mod h1:Huy6zt6euxaY9knPAFKjUITn8QxUFIe9VuSzb4zn/0o= +github.com/hashicorp/terraform-plugin-go v0.19.0 h1:BuZx/6Cp+lkmiG0cOBk6Zps0Cb2tmqQpDM3iAtnhDQU= +github.com/hashicorp/terraform-plugin-go v0.19.0/go.mod h1:EhRSkEPNoylLQntYsk5KrDHTZJh9HQoumZXbOGOXmec= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= -github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= -github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 h1:wcOKYwPI9IorAJEBLzgclh3xVolO7ZorYd6U1vnok14= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0/go.mod h1:qH/34G25Ugdj5FcM95cSoXzUgIbgfhVLXCcEcYaMwq8= +github.com/hashicorp/terraform-registry-address v0.2.2 h1:lPQBg403El8PPicg/qONZJDC6YlgCVbWDtNmmZKtBno= +github.com/hashicorp/terraform-registry-address v0.2.2/go.mod h1:LtwNbCihUoUZ3RYriyS2wF/lGPB6gF9ICLRtuDk7hSo= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/vault v1.4.2/go.mod h1:500fLOj7p92Ys4X265LizqF78MzmHJUf1jV1zNJt060= @@ -978,7 +981,7 @@ github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbg github.com/hokaccha/go-prettyjson v0.0.0-20170213120834-e6b9231a2b1c h1:vlXZsaTgJ55QZrAkOrpq0tsJmuuM4ky5OMZOvXnhvqE= github.com/hokaccha/go-prettyjson v0.0.0-20170213120834-e6b9231a2b1c/go.mod h1:pFlLw2CfqZiIBOx6BuCeRLCrfxBJipTY0nIOF/VbGcI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= +github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -1129,8 +1132,8 @@ github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOA github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -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/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= +github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.8/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-shellwords v1.0.5/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= @@ -1435,7 +1438,7 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/skeema/knownhosts v1.2.1 h1:SHWdIUa82uGZz+F+47k8SY4QhhI291cXCpopT1lK2AQ= +github.com/skeema/knownhosts v1.2.0 h1:h9r9cf0+u7wSE+M183ZtMGgOJKiL96brpaz5ekfJCpM= github.com/smartystreets/assertions v0.0.0-20180725160413-e900ae048470/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= @@ -1510,8 +1513,8 @@ github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= -github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= +github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= +github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/vmware/govmomi v0.18.0 h1:f7QxSmP7meCtoAmiKZogvVbLInT+CZx6Px6K5rYsJZo= @@ -1541,8 +1544,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= -github.com/zclconf/go-cty v1.14.2 h1:kTG7lqmBou0Zkx35r6HJHUQTvaRPr5bIAf3AoHS0izI= -github.com/zclconf/go-cty v1.14.2/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +github.com/zclconf/go-cty v1.14.1 h1:t9fyA35fwjjUMcmL5hLER+e/rEPqrbCK1/OSE4SI9KA= +github.com/zclconf/go-cty v1.14.1/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= @@ -1624,7 +1627,9 @@ golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= @@ -1675,8 +1680,8 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1773,8 +1778,8 @@ golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.14.0 h1:P0Vrf/2538nmC0H+pEQ3MNFRRnVR7RlqyVw+bvm26z0= -golang.org/x/oauth2 v0.14.0/go.mod h1:lAtNWgaWfL4cm7j2OV8TxGi9Qb7ECORx8DktCY74OwM= +golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= +golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1792,6 +1797,7 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1901,6 +1907,8 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -2075,9 +2083,8 @@ google.golang.org/appengine v1.6.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181219182458-5a97ab628bfb/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= @@ -2126,10 +2133,10 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= -google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 h1:JpwMPBpFN3uKhdaekDpiNlImDdkUAyiJ6ez/uxGaUSo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= +google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 h1:9NWlQfY2ePejTmfwUH1OWwmznFa+0kKcHGPDvcPza9M= +google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 h1:m8v1xLLLzMe1m5P+gCTF8nJB9epwZQUBERm20Oy1poQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 h1:0nDDozoAU19Qb2HwhXadU8OcsiO/09cnTqhUtq2MEOM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= @@ -2158,8 +2165,8 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= -google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY= -google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg= +google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/scripts/build.sh b/scripts/build.sh index 2cbb3f93b6..d19ae2beb0 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -51,7 +51,7 @@ if [[ -n "${TF_RELEASE}" ]]; then fi # Build! -VERSION="1.62.0" +VERSION="1.64.0" echo "==> Building..." gox \ -os="${XC_OS}" \ From 6d15d7cb14039f80a52ad1611ef6372e4ada6901 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 14 May 2024 10:40:58 +0530 Subject: [PATCH 076/103] removed sdk --- .../IBM/vpc-go-sdk/.bumpversion.cfg | 13 - .../github.com/IBM/vpc-go-sdk/.gitattributes | 1 - common/github.com/IBM/vpc-go-sdk/.gitignore | 18 - common/github.com/IBM/vpc-go-sdk/.releaserc | 21 - common/github.com/IBM/vpc-go-sdk/.travis.yml | 39 - common/github.com/IBM/vpc-go-sdk/CHANGELOG.md | 96 - .../IBM/vpc-go-sdk/CODE_OF_CONDUCT.md | 76 - .../github.com/IBM/vpc-go-sdk/CONTRIBUTING.md | 14 - common/github.com/IBM/vpc-go-sdk/LICENSE | 201 - common/github.com/IBM/vpc-go-sdk/Makefile | 23 - common/github.com/IBM/vpc-go-sdk/README.md | 195 - .../IBM/vpc-go-sdk/common/headers.go | 71 - .../IBM/vpc-go-sdk/common/headers_test.go | 30 - .../IBM/vpc-go-sdk/common/version.go | 4 - common/github.com/IBM/vpc-go-sdk/go.mod | 16 - common/github.com/IBM/vpc-go-sdk/go.sum | 268 - .../IBM/vpc-go-sdk/package-lock.json | 828 - .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 133680 --------------- go.mod | 4 +- go.sum | 12 +- 20 files changed, 3 insertions(+), 135607 deletions(-) delete mode 100644 common/github.com/IBM/vpc-go-sdk/.bumpversion.cfg delete mode 100644 common/github.com/IBM/vpc-go-sdk/.gitattributes delete mode 100644 common/github.com/IBM/vpc-go-sdk/.gitignore delete mode 100644 common/github.com/IBM/vpc-go-sdk/.releaserc delete mode 100644 common/github.com/IBM/vpc-go-sdk/.travis.yml delete mode 100644 common/github.com/IBM/vpc-go-sdk/CHANGELOG.md delete mode 100644 common/github.com/IBM/vpc-go-sdk/CODE_OF_CONDUCT.md delete mode 100644 common/github.com/IBM/vpc-go-sdk/CONTRIBUTING.md delete mode 100644 common/github.com/IBM/vpc-go-sdk/LICENSE delete mode 100644 common/github.com/IBM/vpc-go-sdk/Makefile delete mode 100644 common/github.com/IBM/vpc-go-sdk/README.md delete mode 100644 common/github.com/IBM/vpc-go-sdk/common/headers.go delete mode 100644 common/github.com/IBM/vpc-go-sdk/common/headers_test.go delete mode 100644 common/github.com/IBM/vpc-go-sdk/common/version.go delete mode 100644 common/github.com/IBM/vpc-go-sdk/go.mod delete mode 100644 common/github.com/IBM/vpc-go-sdk/go.sum delete mode 100644 common/github.com/IBM/vpc-go-sdk/package-lock.json delete mode 100644 common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go diff --git a/common/github.com/IBM/vpc-go-sdk/.bumpversion.cfg b/common/github.com/IBM/vpc-go-sdk/.bumpversion.cfg deleted file mode 100644 index 75285ab0b2..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/.bumpversion.cfg +++ /dev/null @@ -1,13 +0,0 @@ -[bumpversion] -current_version = 0.6.0 -commit = True -message = Update version {current_version} -> {new_version} [skip ci] - -[bumpversion:file:common/version.go] -search = const Version = "{current_version}" -replace = const Version = "{new_version}" - -[bumpversion:file:README.md] -search = {current_version} -replace = {new_version} - diff --git a/common/github.com/IBM/vpc-go-sdk/.gitattributes b/common/github.com/IBM/vpc-go-sdk/.gitattributes deleted file mode 100644 index 3bfcae65ad..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.enc binary \ No newline at end of file diff --git a/common/github.com/IBM/vpc-go-sdk/.gitignore b/common/github.com/IBM/vpc-go-sdk/.gitignore deleted file mode 100644 index 2be5a24d4d..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -# OS stuff -.DS_Store - -# generator files -.openapi-generator-ignore -.openapi-generator/VERSION - -# credentials -.env -*.env - -# ignore vendor/ -vendor/ - -/.project -/.openapi-generator/ - -main/ \ No newline at end of file diff --git a/common/github.com/IBM/vpc-go-sdk/.releaserc b/common/github.com/IBM/vpc-go-sdk/.releaserc deleted file mode 100644 index a746388363..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/.releaserc +++ /dev/null @@ -1,21 +0,0 @@ -{ - "debug": true, - "plugins": [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - "@semantic-release/changelog", - [ - "@semantic-release/exec", - { - "prepareCmd": "bump2version --allow-dirty --current-version ${lastRelease.version} --new-version ${nextRelease.version} patch" - } - ], - [ - "@semantic-release/git", - { - "message": "chore(release): ${nextRelease.version} release notes [skip ci]\n\n${nextRelease.notes}" - } - ], - "@semantic-release/github" - ] -} diff --git a/common/github.com/IBM/vpc-go-sdk/.travis.yml b/common/github.com/IBM/vpc-go-sdk/.travis.yml deleted file mode 100644 index 464cdde97c..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -language: go - -dist: xenial - -notifications: - email: true - -go: -- 1.14.x - -env: - global: - - GO111MODULE=on - -before_install: -- sudo apt-get update -- sudo apt-get install python -- nvm install 12 -- npm install -g npm@6.x - -install: -- curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.37.1 - -script: -- make travis-ci - -# before_deploy: -# - pip install --user bump2version -# - npm install @semantic-release/changelog -# - npm install @semantic-release/exec -# - npm install @semantic-release/git -# - npm install @semantic-release/github - -# deploy: -# - provider: script -# script: npx semantic-release -# skip_cleanup: true -# on: -# branch: master diff --git a/common/github.com/IBM/vpc-go-sdk/CHANGELOG.md b/common/github.com/IBM/vpc-go-sdk/CHANGELOG.md deleted file mode 100644 index 37bf62185e..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/CHANGELOG.md +++ /dev/null @@ -1,96 +0,0 @@ -## [1.0.1](https://github.com/IBM/vpc-go-sdk/compare/v1.0.0...v1.0.1) (2021-04-07) - - -### Bug Fixes - -* **release:** Update SDKs to use API version 2021-03-30 ([#27](https://github.com/IBM/vpc-go-sdk/issues/27)) ([ba27a36](https://github.com/IBM/vpc-go-sdk/commit/ba27a36f743d07a1cae4fb45f83478adf4d33d79)) - -# [1.0.0](https://github.com/IBM/vpc-go-sdk/compare/v0.4.2...v1.0.0) (2021-03-16) - - -### Performance Improvements - -* **Instance-groups:** Update VPC SDK with API version 2021-03-09 ([#23](https://github.com/IBM/vpc-go-sdk/issues/23)) ([d6dc319](https://github.com/IBM/vpc-go-sdk/commit/d6dc319bb5aa19aff4fd89872198b6e573545110)) - - -### BREAKING CHANGES - -* **Instance-groups:** - Methods for Instance group manager is now producing InstanceGroupManagerIntf instead of InstanceGroupManager - -## [0.4.2](https://github.com/IBM/vpc-go-sdk/compare/v0.4.1...v0.4.2) (2021-03-02) - - -### Bug Fixes - -* **release:** Update SDKs to use API version 2021-02-09 ([#20](https://github.com/IBM/vpc-go-sdk/issues/20)) ([ae348ee](https://github.com/IBM/vpc-go-sdk/commit/ae348ee347f7405fac4ab4574392673a9194f6bd)) - -## [0.4.1](https://github.com/IBM/vpc-go-sdk/compare/v0.4.0...v0.4.1) (2021-01-18) - - -### Bug Fixes - -* **release:** Update SDKs to use API version 2020-01-12 ([#18](https://github.com/IBM/vpc-go-sdk/issues/18)) ([d8c2134](https://github.com/IBM/vpc-go-sdk/commit/d8c21345b1ed032484fbaf57456d4f476423b5fc)) - -# [0.4.0](https://github.com/IBM/vpc-go-sdk/compare/v0.3.1...v0.4.0) (2020-12-17) - - -### Features - -* **enhancement:** Update VPC service with API version 2020-12-15 ([#17](https://github.com/IBM/vpc-go-sdk/issues/17)) ([affcaed](https://github.com/IBM/vpc-go-sdk/commit/affcaed4e8f7e515148cb9aac82755ad2a3ea8ca)) - -## [0.3.1](https://github.com/IBM/vpc-go-sdk/compare/v0.3.0...v0.3.1) (2020-11-20) - - -### Bug Fixes - -* **SecurityGroup:** Update both VPC services fixing security group issue. ([#16](https://github.com/IBM/vpc-go-sdk/issues/16)) ([270decd](https://github.com/IBM/vpc-go-sdk/commit/270decd989abd0ed5b9cd101d6c7a2fcb9deecc2)) - -# [0.3.0](https://github.com/IBM/vpc-go-sdk/compare/v0.2.0...v0.3.0) (2020-11-20) - - -### Features - -* **SDK:** Update VPC Gen2 and Gen1 services with API version 2020-11-17 ([#15](https://github.com/IBM/vpc-go-sdk/issues/15)) ([6f97a1a](https://github.com/IBM/vpc-go-sdk/commit/6f97a1a643dce6d76f8ada9caecc49d864b656fa)) - -# [0.2.0](https://github.com/IBM/vpc-go-sdk/compare/v0.1.1...v0.2.0) (2020-10-16) - - -### Features - -* **version update:** Update both services with API version 2020-10-06 ([#14](https://github.com/IBM/vpc-go-sdk/issues/14)) ([179880c](https://github.com/IBM/vpc-go-sdk/commit/179880c4775e0d6e6a9e683546348b34e9f9b785)) - -## [0.1.1](https://github.com/IBM/vpc-go-sdk/compare/v0.1.0...v0.1.1) (2020-09-09) - - -### Bug Fixes - -* **NLB:** update NLB feature ([#13](https://github.com/IBM/vpc-go-sdk/issues/13)) ([99d207d](https://github.com/IBM/vpc-go-sdk/commit/99d207dba81fef5214be63864aa7a4b91af82c89)) - -# [0.1.0](https://github.com/IBM/vpc-go-sdk/compare/v0.0.3...v0.1.0) (2020-09-03) - - -### Features - -* **autoscale:** Add autoscale feature and NLB feature ([#12](https://github.com/IBM/vpc-go-sdk/issues/12)) ([0ee5ea1](https://github.com/IBM/vpc-go-sdk/commit/0ee5ea16247a6f94794674d0499c01e78857d6a4)) - -## [0.0.3](https://github.com/IBM/vpc-go-sdk/compare/v0.0.2...v0.0.3) (2020-08-06) - - -### Bug Fixes - -* **version:** Release SDK for API version 2020-07-28 ([#10](https://github.com/IBM/vpc-go-sdk/issues/10)) ([4550ccc](https://github.com/IBM/vpc-go-sdk/commit/4550cccb167443bad8857dc88fc097ad18061734)) - -## [0.0.2](https://github.com/IBM/vpc-go-sdk/compare/v0.0.1...v0.0.2) (2020-07-06) - - -### Bug Fixes - -* **doc:** Minor update to example code in the README ([#9](https://github.com/IBM/vpc-go-sdk/issues/9)) ([f3841fc](https://github.com/IBM/vpc-go-sdk/commit/f3841fcfbffab66d970ec966b558a48180f0651c)) - -## [0.0.1](https://github.com/IBM/vpc-go-sdk/compare/v0.0.0...v0.0.1) (2020-06-19) - - -### Bug Fixes - -* **go-sdk:** adding semantic release versioning ([#4](https://github.com/IBM/vpc-go-sdk/issues/4)) ([1d92ee5](https://github.com/IBM/vpc-go-sdk/commit/1d92ee5d6481c923382628e8dfc9b9de51cc7ddd)) -* **version:** Update version to enable semantic release ([#6](https://github.com/IBM/vpc-go-sdk/issues/6)) ([2699a61](https://github.com/IBM/vpc-go-sdk/commit/2699a615cd9fad5de60ef442c7512a8744c676a1)) diff --git a/common/github.com/IBM/vpc-go-sdk/CODE_OF_CONDUCT.md b/common/github.com/IBM/vpc-go-sdk/CODE_OF_CONDUCT.md deleted file mode 100644 index 7303c87870..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,76 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, sex characteristics, gender identity and expression, -level of experience, education, socio-economic status, nationality, personal -appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at phil_adams@us.ibm.com. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see -https://www.contributor-covenant.org/faq diff --git a/common/github.com/IBM/vpc-go-sdk/CONTRIBUTING.md b/common/github.com/IBM/vpc-go-sdk/CONTRIBUTING.md deleted file mode 100644 index fee9f665c1..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/CONTRIBUTING.md +++ /dev/null @@ -1,14 +0,0 @@ -# Questions -If you are having problems using the APIs or have a question about IBM Cloud services, -please ask a question at -[Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-cloud). - -# Issues -If you encounter an issue with the project, you are welcome to submit a -[bug report](https://github.com/IBM/vpc-go-sdk/issues). -Before that, please search for similar issues. It's possible that someone has already reported the problem. - -# General Information -For general guidance on contributing to this project, please see -[this link](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/CONTRIBUTING_go.md) - diff --git a/common/github.com/IBM/vpc-go-sdk/LICENSE b/common/github.com/IBM/vpc-go-sdk/LICENSE deleted file mode 100644 index 261eeb9e9f..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/common/github.com/IBM/vpc-go-sdk/Makefile b/common/github.com/IBM/vpc-go-sdk/Makefile deleted file mode 100644 index 81fb2e0b5a..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# Makefile - -all: build lint tidy - -travis-ci: build lint tidy test-unit - -build: - go build ./vpcv1 - -test-unit: - go test `go list ./... | grep vpcv1` -v -tags=unit - -test-integration: - go test `go list ./... | grep vpcv1` -v -tags=integration -skipForMockTesting -testCount - -test-examples: - go test `go list ./... | grep vpcv1` -v -tags=examples - -lint: - golangci-lint --timeout=2m run - -tidy: - go mod tidy diff --git a/common/github.com/IBM/vpc-go-sdk/README.md b/common/github.com/IBM/vpc-go-sdk/README.md deleted file mode 100644 index 495cea1a68..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/README.md +++ /dev/null @@ -1,195 +0,0 @@ -[![Build Status](https://travis-ci.com/IBM/vpc-go-sdk.svg?branch=master)](https://travis-ci.com/IBM/vpc-go-sdk) -[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -![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.16.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.16.0 from now on. Refrain from using commands like `go get -u ..` and `go get ..@latest` 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 - - - - -- [Overview](#overview) -- [Prerequisites](#prerequisites) -- [Installation](#installation) - + [`go get` command](#go-get-command) - + [Go modules](#go-modules) - + [`dep` dependency manager](#dep-dependency-manager) -- [Using the SDK](#using-the-sdk) -- [Setting up VPC service](#setting-up-vpc-service) -- [Questions](#questions) -- [Issues](#issues) -- [Open source @ IBM](#open-source--ibm) -- [Contributing](#contributing) -- [License](#license) - - - -## Overview - -The IBM Cloud VPC Go SDK allows developers to programmatically interact with the following IBM Cloud services: - -Service Name | Package name ---- | --- -[VPC](https://cloud.ibm.com/apidocs/vpc) | vpcv1 - -## Prerequisites - -[ibm-cloud-onboarding]: https://cloud.ibm.com/registration - -* An [IBM Cloud][ibm-cloud-onboarding] account. -* An IAM API key to allow the SDK to access your account. Create an apikey [here](https://cloud.ibm.com/iam/apikeys). -* Go version 1.12 or above. - -## Installation -There are a few different ways to download and install the VPC Go SDK services for use by your -Go application: - -#### `go get` command -Use this command to download and install the VPC Go SDK service to allow your Go application to -use it: - -``` -go get github.com/IBM/vpc-go-sdk@v0.14.0 -``` - - -#### Go modules -If your application is using Go modules, you can add a suitable import to your -Go application, like this: - - -```go -import ( - "github.com/IBM/vpc-go-sdk/vpcv1" -) -``` - -Then run `go mod tidy` to download and install the new dependency and update your Go application's -`go.mod` file. - - -#### `dep` dependency manager -If your application is using the `dep` dependency management tool, you can add a dependency -to your `Gopkg.toml` file. Here is an example: - -``` -[[constraint]] - name = "github.com/IBM/vpc-go-sdk/" - version = "0.16.0" -``` - -Then run `dep ensure`. - -## Using the SDK -For general SDK usage information, see the [IBM Cloud SDK Common README](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/README.md) - -## Setting up VPC service - -A quick example to get you up and running with VPC Go SDK service in Dallas (us-south) region. - -For other regions, see [API Endpoints for VPC](https://cloud.ibm.com/apidocs/vpc#api-endpoint) and update the `URL` variable accordingly. - - -Refer to the [VPC Release Notes](https://cloud.ibm.com/docs/vpc?topic=vpc-release-notes) to find out latest version release. - -```go -package main - -import ( - "log" - "os" - - "github.com/IBM/go-sdk-core/v4/core" - "github.com/IBM/vpc-go-sdk/vpcv1" -) - -func main() { - apiKey := os.Getenv("IBMCLOUD_API_KEY") - if apiKey == "" { - log.Fatal("No API key set") - } - - // Instantiate the service with an API key based IAM authenticator - vpcService, err := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - Authenticator: &core.IamAuthenticator{ - ApiKey: apiKey, - }, - }) - if err != nil { - log.Fatal("Error creating VPC Service.") - } - - // Retrieve the list of regions for your account. - regions, detailedResponse, err := vpcService.ListRegions(&vpcv1.ListRegionsOptions{}) - if err != nil { - log.Fatalf("Failed to list the regions: %v and the response is: %s", err, detailedResponse) - } - log.Printf("Regions: %#v", regions) - - // Retrieve the list of vpcs for your account. - vpcs, detailedResponse, err := vpcService.ListVpcs(&vpcv1.ListVpcsOptions{}) - if err != nil { - log.Fatalf("Failed to list vpcs: %v and the response is: %s", err, detailedResponse) - } - log.Printf("VPCs: %#v", vpcs) - - // Create an SSH key - sshKeyOptions := &vpcv1.CreateKeyOptions{ - Name: core.StringPtr("my-ssh-key"), - } - // Setters also exist to set fields are the struct has been created - sshKeyOptions.SetPublicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsnrSAe8eBi8mS576Z96UtYgUzDR9Sbw/s1ELxsa1KUK82JQ0Ejmz31N6sHyiT/l5533JgGL6rKamLFziMY2VX2bdyuF5YzyHhmapT+e21kuTatB50UsXzxlYEWpCmFdnd4LhwFn6AycJWOV0k3e0ePpVxgHc+pVfE89322cbmfuppeHxvxc+KSzQNYC59A+A2vhucbuWppyL3EIF4YgLwOr5iDISm1IR0+EEL3yJQIG4M2WKu526anI85QBcIWyFwQXOpdcX2eZRcd6WW2EgAM3fIOaezkm0CFrsz8rQ0MPYZI4BS2CWwg5d4Bj7SU2sjXz62gfQkQGTYWSqhizVb root@localhost") - key, detailedResponse, err := vpcService.CreateKey(sshKeyOptions) - if err != nil { - log.Fatalf("Failed to create the ssh key: %v and the response is: %s", err, detailedResponse) - } - log.Printf("SSH key: %s created with ID: %s", *key.Name, *key.ID) - - // Delete SSH key - detailedResponse, err = vpcService.DeleteKey(&vpcv1.DeleteKeyOptions{ - ID: key.ID, - }) - if err != nil { - log.Fatalf("Failed to delete the ssh key: %v and the response is: %s", err, detailedResponse) - } - - log.Printf("SSH key: %s deleted with ID: %s", *key.Name, *key.ID) -} -``` - -## Questions - -If you have difficulties using this SDK or you have a question about the IBM Cloud services, -ask a question at -[Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-cloud). - -## Issues -If you encounter an issue with the project, you are welcome to submit a -[bug report](/issues). -Before you create a new issue, search for similar issues. It's possible that someone has already reported the problem. - -## Open source @ IBM -Find more open source projects on the [IBM Github Page](http://ibm.github.io/). - -## Contributing -See [CONTRIBUTING](CONTRIBUTING.md). - -## License - -This SDK project is released under the Apache 2.0 license. -The license's full text can be found in [LICENSE](LICENSE). diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers.go b/common/github.com/IBM/vpc-go-sdk/common/headers.go deleted file mode 100644 index 77e444c63d..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/common/headers.go +++ /dev/null @@ -1,71 +0,0 @@ -package common - -import ( - "fmt" - "runtime" - - "github.com/IBM/go-sdk-core/v5/core" - "github.com/google/uuid" -) - -const ( - HEADER_NAME_USER_AGENT = "User-Agent" - - SDK_NAME = "vpc-go-sdk" - - X_CORRELATION_ID = "X-Correlation-Id" - - X_REQUEST_ID = "X-Request-Id" -) - -// GetSdkHeaders - returns the set of SDK-specific headers to be included in an outgoing request. -// -// This function is invoked by generated service methods (i.e. methods which implement the REST API operations -// defined within the API definition). The purpose of this function is to give the SDK implementor the opportunity -// to provide SDK-specific HTTP headers that will be sent with an outgoing REST API request. -// This function is invoked for each invocation of a generated service method, -// so the set of HTTP headers could be request-specific. -// As an optimization, if your SDK will be returning the same set of HTTP headers for each invocation of this -// function, it is recommended that you initialize the returned map just once (perhaps by using -// lazy initialization) and simply return it each time the function is invoked, instead of building it each time -// as in the example below. -// -// Parameters: -// -// serviceName - the name of the service as defined in the API definition (e.g. "MyService1") -// serviceVersion - the version of the service as defined in the API definition (e.g. "V1") -// operationId - the operationId as defined in the API definition (e.g. getContext) -// -// Returns: -// -// a Map which contains the set of headers to be included in the REST API request -func GetSdkHeaders(serviceName string, serviceVersion string, operationId string) map[string]string { - sdkHeaders := make(map[string]string) - - sdkHeaders[HEADER_NAME_USER_AGENT] = GetUserAgentInfo() - sdkHeaders[X_CORRELATION_ID] = GetNewXCorrelationID() - sdkHeaders[X_REQUEST_ID] = GetNewXRequestID() - - return sdkHeaders -} - -var UserAgent string = fmt.Sprintf("%s-%s %s", SDK_NAME, Version, GetSystemInfo()) - -func GetUserAgentInfo() string { - return UserAgent -} -func GetNewXCorrelationID() string { - return uuid.New().String() -} -func GetNewXRequestID() string { - return uuid.New().String() -} - -var systemInfo = fmt.Sprintf("(arch=%s; os=%s; go.version=%s)", runtime.GOARCH, runtime.GOOS, runtime.Version()) - -func GetSystemInfo() string { - return systemInfo -} -func GetComponentInfo() *core.ProblemComponent { - return core.NewProblemComponent("github.com/IBM/vpc-go-sdk", Version) -} diff --git a/common/github.com/IBM/vpc-go-sdk/common/headers_test.go b/common/github.com/IBM/vpc-go-sdk/common/headers_test.go deleted file mode 100644 index c8e610ed55..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/common/headers_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package common - -import ( - "strings" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestGetSystemInfo(t *testing.T) { - var sysinfo = GetSystemInfo() - assert.NotNil(t, sysinfo) - assert.True(t, strings.Contains(sysinfo, "arch=")) - assert.True(t, strings.Contains(sysinfo, "os=")) - assert.True(t, strings.Contains(sysinfo, "go.version=")) -} - -func TestGetSdkHeaders(t *testing.T) { - var headers = GetSdkHeaders("myService", "v123", "myOperation") - assert.NotNil(t, headers) - - var foundIt bool - - _, foundIt = headers[HEADER_NAME_USER_AGENT] - assert.True(t, foundIt) - _, foundIt = headers[X_CORRELATION_ID] - assert.True(t, foundIt) - _, foundIt = headers[X_REQUEST_ID] - assert.True(t, foundIt) -} diff --git a/common/github.com/IBM/vpc-go-sdk/common/version.go b/common/github.com/IBM/vpc-go-sdk/common/version.go deleted file mode 100644 index 623548bdac..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/common/version.go +++ /dev/null @@ -1,4 +0,0 @@ -package common - -// Version of the SDK -const Version = "0.6.0" diff --git a/common/github.com/IBM/vpc-go-sdk/go.mod b/common/github.com/IBM/vpc-go-sdk/go.mod deleted file mode 100644 index bfa516c360..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/go.mod +++ /dev/null @@ -1,16 +0,0 @@ -module github.com/IBM/vpc-go-sdk - -go 1.16 - -require ( - github.com/IBM/go-sdk-core/v5 v5.16.2 - github.com/go-openapi/strfmt v0.22.1 - github.com/google/uuid v1.6.0 - github.com/stretchr/testify v1.8.4 -) - -retract ( - v1.0.2 - v1.0.1 - v1.0.0 -) diff --git a/common/github.com/IBM/vpc-go-sdk/go.sum b/common/github.com/IBM/vpc-go-sdk/go.sum deleted file mode 100644 index 2c486abdb2..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/go.sum +++ /dev/null @@ -1,268 +0,0 @@ -github.com/IBM/go-sdk-core/v5 v5.16.2 h1:4psKDqjN6mPacgbaRjV/qcYtXlnAEISLJF/QQa7FQqo= -github.com/IBM/go-sdk-core/v5 v5.16.2/go.mod h1:aojBkkq4HXkOYdn7YZ6ve8cjPWHdcB3tt8v0b9Cbac8= -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/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -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/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= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -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.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -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= -github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.18.0 h1:BvolUXjp4zuvkZ5YN5t7ebzbhlUtPsPm2S9NAZ5nl9U= -github.com/go-playground/validator/v10 v10.18.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/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= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -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.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -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.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -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 v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= -github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= -github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -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/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= -github.com/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= -github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -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.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= -github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= -github.com/onsi/ginkgo/v2 v2.3.0/go.mod h1:Eew0uilEqZmIEZr8JrvYlvOM7Rr6xzTmMV8AyFNU9d0= -github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo= -github.com/onsi/ginkgo/v2 v2.5.0/go.mod h1:Luc4sArBICYCS8THh8v3i3i5CuSZO+RaQRaJoeNwomw= -github.com/onsi/ginkgo/v2 v2.7.0/go.mod h1:yjiuMwPokqY1XauOgju45q3sJt6VzQ/Fict1LFVcsAo= -github.com/onsi/ginkgo/v2 v2.8.1/go.mod h1:N1/NbDngAFcSLdyZ+/aYTYGSlq9qMCS/cNKGJjy+csc= -github.com/onsi/ginkgo/v2 v2.9.0/go.mod h1:4xkjoL/tZv4SMWeww56BU5kAt19mVB47gTWxmrTcxyk= -github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo= -github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= -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.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= -github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= -github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= -github.com/onsi/gomega v1.24.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= -github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM= -github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= -github.com/onsi/gomega v1.27.1/go.mod h1:aHX5xOykVYzWOV4WqQy0sy8BQptgukenXpCXfadcIAw= -github.com/onsi/gomega v1.27.3/go.mod h1:5vG284IBtfDAmDyrK+eGyZmUgUlmi+Wngqo557cZ6Gw= -github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= -github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= -github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= -github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= -go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= -golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= -golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= -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= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -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.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -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= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/common/github.com/IBM/vpc-go-sdk/package-lock.json b/common/github.com/IBM/vpc-go-sdk/package-lock.json deleted file mode 100644 index 20f48c59f1..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/package-lock.json +++ /dev/null @@ -1,828 +0,0 @@ -{ - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "@babel/code-frame": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.13.tgz", - "integrity": "sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g==", - "requires": { - "@babel/highlight": "^7.12.13" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.12.11", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz", - "integrity": "sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==" - }, - "@babel/highlight": { - "version": "7.13.10", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.13.10.tgz", - "integrity": "sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==", - "requires": { - "@babel/helper-validator-identifier": "^7.12.11", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - }, - "@nodelib/fs.scandir": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", - "integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", - "requires": { - "@nodelib/fs.stat": "2.0.4", - "run-parallel": "^1.1.9" - } - }, - "@nodelib/fs.stat": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", - "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==" - }, - "@nodelib/fs.walk": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", - "integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", - "requires": { - "@nodelib/fs.scandir": "2.1.4", - "fastq": "^1.6.0" - } - }, - "@octokit/auth-token": { - "version": "2.4.5", - "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz", - "integrity": "sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA==", - "requires": { - "@octokit/types": "^6.0.3" - } - }, - "@octokit/core": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.4.0.tgz", - "integrity": "sha512-6/vlKPP8NF17cgYXqucdshWqmMZGXkuvtcrWCgU5NOI0Pl2GjlmZyWgBMrU8zJ3v2MJlM6++CiB45VKYmhiWWg==", - "requires": { - "@octokit/auth-token": "^2.4.4", - "@octokit/graphql": "^4.5.8", - "@octokit/request": "^5.4.12", - "@octokit/request-error": "^2.0.5", - "@octokit/types": "^6.0.3", - "before-after-hook": "^2.2.0", - "universal-user-agent": "^6.0.0" - } - }, - "@octokit/endpoint": { - "version": "6.0.11", - "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.11.tgz", - "integrity": "sha512-fUIPpx+pZyoLW4GCs3yMnlj2LfoXTWDUVPTC4V3MUEKZm48W+XYpeWSZCv+vYF1ZABUm2CqnDVf1sFtIYrj7KQ==", - "requires": { - "@octokit/types": "^6.0.3", - "is-plain-object": "^5.0.0", - "universal-user-agent": "^6.0.0" - } - }, - "@octokit/graphql": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.6.1.tgz", - "integrity": "sha512-2lYlvf4YTDgZCTXTW4+OX+9WTLFtEUc6hGm4qM1nlZjzxj+arizM4aHWzBVBCxY9glh7GIs0WEuiSgbVzv8cmA==", - "requires": { - "@octokit/request": "^5.3.0", - "@octokit/types": "^6.0.3", - "universal-user-agent": "^6.0.0" - } - }, - "@octokit/openapi-types": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-6.0.0.tgz", - "integrity": "sha512-CnDdK7ivHkBtJYzWzZm7gEkanA7gKH6a09Eguz7flHw//GacPJLmkHA3f3N++MJmlxD1Fl+mB7B32EEpSCwztQ==" - }, - "@octokit/plugin-paginate-rest": { - "version": "2.13.3", - "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.13.3.tgz", - "integrity": "sha512-46lptzM9lTeSmIBt/sVP/FLSTPGx6DCzAdSX3PfeJ3mTf4h9sGC26WpaQzMEq/Z44cOcmx8VsOhO+uEgE3cjYg==", - "requires": { - "@octokit/types": "^6.11.0" - } - }, - "@octokit/plugin-request-log": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.3.tgz", - "integrity": "sha512-4RFU4li238jMJAzLgAwkBAw+4Loile5haQMQr+uhFq27BmyJXcXSKvoQKqh0agsZEiUlW6iSv3FAgvmGkur7OQ==" - }, - "@octokit/plugin-rest-endpoint-methods": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.0.0.tgz", - "integrity": "sha512-Jc7CLNUueIshXT+HWt6T+M0sySPjF32mSFQAK7UfAg8qGeRI6OM1GSBxDLwbXjkqy2NVdnqCedJcP1nC785JYg==", - "requires": { - "@octokit/types": "^6.13.0", - "deprecation": "^2.3.1" - } - }, - "@octokit/request": { - "version": "5.4.14", - "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.14.tgz", - "integrity": "sha512-VkmtacOIQp9daSnBmDI92xNIeLuSRDOIuplp/CJomkvzt7M18NXgG044Cx/LFKLgjKt9T2tZR6AtJayba9GTSA==", - "requires": { - "@octokit/endpoint": "^6.0.1", - "@octokit/request-error": "^2.0.0", - "@octokit/types": "^6.7.1", - "deprecation": "^2.0.0", - "is-plain-object": "^5.0.0", - "node-fetch": "^2.6.1", - "once": "^1.4.0", - "universal-user-agent": "^6.0.0" - } - }, - "@octokit/request-error": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.5.tgz", - "integrity": "sha512-T/2wcCFyM7SkXzNoyVNWjyVlUwBvW3igM3Btr/eKYiPmucXTtkxt2RBsf6gn3LTzaLSLTQtNmvg+dGsOxQrjZg==", - "requires": { - "@octokit/types": "^6.0.3", - "deprecation": "^2.0.0", - "once": "^1.4.0" - } - }, - "@octokit/rest": { - "version": "18.5.2", - "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.5.2.tgz", - "integrity": "sha512-Kz03XYfKS0yYdi61BkL9/aJ0pP2A/WK5vF/syhu9/kY30J8He3P68hv9GRpn8bULFx2K0A9MEErn4v3QEdbZcw==", - "requires": { - "@octokit/core": "^3.2.3", - "@octokit/plugin-paginate-rest": "^2.6.2", - "@octokit/plugin-request-log": "^1.0.2", - "@octokit/plugin-rest-endpoint-methods": "5.0.0" - } - }, - "@octokit/types": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.13.0.tgz", - "integrity": "sha512-W2J9qlVIU11jMwKHUp5/rbVUeErqelCsO5vW5PKNb7wAXQVUz87Rc+imjlEvpvbH8yUb+KHmv8NEjVZdsdpyxA==", - "requires": { - "@octokit/openapi-types": "^6.0.0" - } - }, - "@semantic-release/changelog": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@semantic-release/changelog/-/changelog-5.0.1.tgz", - "integrity": "sha512-unvqHo5jk4dvAf2nZ3aw4imrlwQ2I50eVVvq9D47Qc3R+keNqepx1vDYwkjF8guFXnOYaYcR28yrZWno1hFbiw==", - "requires": { - "@semantic-release/error": "^2.1.0", - "aggregate-error": "^3.0.0", - "fs-extra": "^9.0.0", - "lodash": "^4.17.4" - } - }, - "@semantic-release/error": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-2.2.0.tgz", - "integrity": "sha512-9Tj/qn+y2j+sjCI3Jd+qseGtHjOAeg7dU2/lVcqIQ9TV3QDaDXDYXcoOHU+7o2Hwh8L8ymL4gfuO7KxDs3q2zg==" - }, - "@semantic-release/exec": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@semantic-release/exec/-/exec-5.0.0.tgz", - "integrity": "sha512-t7LWXIvDJQbuGCy2WmMG51WyaGSLTvZBv9INvcI4S0kn+QjnnVVUMhcioIqhb0r3yqqarMzHVcABFug0q0OXjw==", - "requires": { - "@semantic-release/error": "^2.1.0", - "aggregate-error": "^3.0.0", - "debug": "^4.0.0", - "execa": "^4.0.0", - "lodash": "^4.17.4", - "parse-json": "^5.0.0" - } - }, - "@semantic-release/git": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/@semantic-release/git/-/git-9.0.0.tgz", - "integrity": "sha512-AZ4Zha5NAPAciIJH3ipzw/WU9qLAn8ENaoVAhD6srRPxTpTzuV3NhNh14rcAo8Paj9dO+5u4rTKcpetOBluYVw==", - "requires": { - "@semantic-release/error": "^2.1.0", - "aggregate-error": "^3.0.0", - "debug": "^4.0.0", - "dir-glob": "^3.0.0", - "execa": "^4.0.0", - "lodash": "^4.17.4", - "micromatch": "^4.0.0", - "p-reduce": "^2.0.0" - } - }, - "@semantic-release/github": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@semantic-release/github/-/github-7.2.1.tgz", - "integrity": "sha512-+gOhbaG4T3xJb6aTZu1/7KvCmYKRChkasdIyFWdaGaTWVeGpdl4o0zMviV1z3kRcgPOSXeqjHSQ6SOQAfHQiDw==", - "requires": { - "@octokit/rest": "^18.0.0", - "@semantic-release/error": "^2.2.0", - "aggregate-error": "^3.0.0", - "bottleneck": "^2.18.1", - "debug": "^4.0.0", - "dir-glob": "^3.0.0", - "fs-extra": "^9.0.0", - "globby": "^11.0.0", - "http-proxy-agent": "^4.0.0", - "https-proxy-agent": "^5.0.0", - "issue-parser": "^6.0.0", - "lodash": "^4.17.4", - "mime": "^2.4.3", - "p-filter": "^2.0.0", - "p-retry": "^4.0.0", - "url-join": "^4.0.0" - } - }, - "@tootallnate/once": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", - "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==" - }, - "@types/retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", - "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==" - }, - "agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "requires": { - "debug": "4" - } - }, - "aggregate-error": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", - "requires": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - } - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, - "array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==" - }, - "at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" - }, - "before-after-hook": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.1.tgz", - "integrity": "sha512-/6FKxSTWoJdbsLDF8tdIjaRiFXiE6UHsEHE3OPI/cwPURCVi1ukP0gmLn7XWEiFk5TcwQjjY5PWsU+j+tgXgmw==" - }, - "bottleneck": { - "version": "2.19.5", - "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", - "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==" - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "requires": { - "fill-range": "^7.0.1" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==" - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "requires": { - "ms": "2.1.2" - } - }, - "deprecation": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", - "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" - }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "requires": { - "path-type": "^4.0.0" - } - }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "requires": { - "once": "^1.4.0" - } - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" - }, - "execa": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", - "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", - "requires": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - } - }, - "fast-glob": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", - "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", - "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" - } - }, - "fastq": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", - "integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", - "requires": { - "reusify": "^1.0.4" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "requires": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "requires": { - "pump": "^3.0.0" - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "requires": { - "is-glob": "^4.0.1" - } - }, - "globby": { - "version": "11.0.3", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.3.tgz", - "integrity": "sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg==", - "requires": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", - "slash": "^3.0.0" - } - }, - "graceful-fs": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" - }, - "http-proxy-agent": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", - "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", - "requires": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" - } - }, - "https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "requires": { - "agent-base": "6", - "debug": "4" - } - }, - "human-signals": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", - "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==" - }, - "ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==" - }, - "indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==" - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" - }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" - }, - "is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==" - }, - "is-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" - }, - "issue-parser": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/issue-parser/-/issue-parser-6.0.0.tgz", - "integrity": "sha512-zKa/Dxq2lGsBIXQ7CUZWTHfvxPC2ej0KfO7fIPqLlHB9J2hJ7rGhZ5rilhuufylr4RXYPzJUeFjKxz305OsNlA==", - "requires": { - "lodash.capitalize": "^4.2.1", - "lodash.escaperegexp": "^4.1.2", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.uniqby": "^4.7.0" - } - }, - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" - }, - "jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^2.0.0" - } - }, - "lines-and-columns": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", - "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=" - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "lodash.capitalize": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz", - "integrity": "sha1-+CbJtOKoUR2E46yinbBeGk87cqk=" - }, - "lodash.escaperegexp": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", - "integrity": "sha1-ZHYsSGGAglGKw99Mz11YhtriA0c=" - }, - "lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" - }, - "lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" - }, - "lodash.uniqby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz", - "integrity": "sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI=" - }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" - }, - "merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" - }, - "micromatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", - "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.0.5" - } - }, - "mime": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", - "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==" - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" - }, - "npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "requires": { - "path-key": "^3.0.0" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "p-filter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-filter/-/p-filter-2.1.0.tgz", - "integrity": "sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==", - "requires": { - "p-map": "^2.0.0" - } - }, - "p-map": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", - "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==" - }, - "p-reduce": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-2.1.0.tgz", - "integrity": "sha512-2USApvnsutq8uoxZBGbbWM0JIYLiEMJ9RlaN7fAzVNb9OZN0SHjjTTfIcb667XynS5Y1VhwDJVDa72TnPzAYWw==" - }, - "p-retry": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.5.0.tgz", - "integrity": "sha512-5Hwh4aVQSu6BEP+w2zKlVXtFAaYQe1qWuVADSgoeVlLjwe/Q/AMSoRR4MDeaAfu8llT+YNbEijWu/YF3m6avkg==", - "requires": { - "@types/retry": "^0.12.0", - "retry": "^0.12.0" - } - }, - "parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "requires": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - } - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" - }, - "picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==" - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" - }, - "retry": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", - "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=" - }, - "reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" - }, - "run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "requires": { - "queue-microtask": "^1.2.2" - } - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" - }, - "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" - }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" - }, - "strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==" - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "requires": { - "has-flag": "^3.0.0" - } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "requires": { - "is-number": "^7.0.0" - } - }, - "universal-user-agent": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", - "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" - }, - "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" - }, - "url-join": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", - "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==" - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "requires": { - "isexe": "^2.0.0" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - } - } -} diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go deleted file mode 100644 index b8a74ae5aa..0000000000 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ /dev/null @@ -1,133680 +0,0 @@ -/** - * (C) Copyright IBM Corp. 2024. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * IBM OpenAPI SDK Code Generator Version: 3.87.0-91c7c775-20240320-213027 - */ - -// Package vpcv1 : Operations and models for the VpcV1 service -package vpcv1 - -import ( - "context" - "encoding/json" - "fmt" - "net/http" - "reflect" - "strings" - "time" - - "github.com/IBM/go-sdk-core/v5/core" - common "github.com/IBM/vpc-go-sdk/common" - "github.com/go-openapi/strfmt" -) - -const ( - YYYYMMDD = "2006-01-02" -) - -// 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: 2023-12-05 -type VpcV1 struct { - Service *core.BaseService - - // The infrastructure generation. For the API behavior documented here, specify - // `2`. - generation *int64 - - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2024-04-01`. - Version *string -} - -// DefaultServiceURL is the default URL to make service requests to. -const DefaultServiceURL = "https://us-south.iaas.cloud.ibm.com/v1" - -// DefaultServiceName is the default key used to find external configuration information. -const DefaultServiceName = "vpc" - -// VpcV1Options : Service options -type VpcV1Options struct { - ServiceName string - URL string - Authenticator core.Authenticator - - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2024-04-01`. - Version *string -} - -// NewVpcV1UsingExternalConfig : constructs an instance of VpcV1 with passed in options and external configuration. -func NewVpcV1UsingExternalConfig(options *VpcV1Options) (vpc *VpcV1, err error) { - if options.ServiceName == "" { - options.ServiceName = DefaultServiceName - } - - if options.Authenticator == nil { - options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) - if err != nil { - err = core.SDKErrorf(err, "", "env-auth-error", common.GetComponentInfo()) - return - } - } - - vpc, err = NewVpcV1(options) - err = core.RepurposeSDKProblem(err, "new-client-error") - if err != nil { - return - } - - err = vpc.Service.ConfigureService(options.ServiceName) - if err != nil { - err = core.SDKErrorf(err, "", "client-config-error", common.GetComponentInfo()) - return - } - - if options.URL != "" { - err = vpc.Service.SetServiceURL(options.URL) - err = core.RepurposeSDKProblem(err, "url-set-error") - } - return -} - -// NewVpcV1 : constructs an instance of VpcV1 with passed in options. -func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { - serviceOptions := &core.ServiceOptions{ - URL: DefaultServiceURL, - Authenticator: options.Authenticator, - } - - err = core.ValidateStruct(options, "options") - if err != nil { - err = core.SDKErrorf(err, "", "invalid-global-options", common.GetComponentInfo()) - return - } - - baseService, err := core.NewBaseService(serviceOptions) - if err != nil { - err = core.SDKErrorf(err, "", "new-base-error", common.GetComponentInfo()) - return - } - - if options.URL != "" { - err = baseService.SetServiceURL(options.URL) - if err != nil { - err = core.SDKErrorf(err, "", "set-url-error", common.GetComponentInfo()) - return - } - } - - now := time.Now().UTC() - if options.Version == nil { - options.Version = core.StringPtr(now.Format(YYYYMMDD)) - } - - service = &VpcV1{ - Service: baseService, - generation: core.Int64Ptr(2), - Version: options.Version, - } - - return -} - -// GetServiceURLForRegion returns the service URL to be used for the specified region -func GetServiceURLForRegion(region string) (string, error) { - return "", core.SDKErrorf(nil, "service does not support regional URLs", "no-regional-support", common.GetComponentInfo()) -} - -// Clone makes a copy of "vpc" suitable for processing requests. -func (vpc *VpcV1) Clone() *VpcV1 { - if core.IsNil(vpc) { - return nil - } - clone := *vpc - clone.Service = vpc.Service.Clone() - return &clone -} - -// SetServiceURL sets the service URL -func (vpc *VpcV1) SetServiceURL(url string) error { - err := vpc.Service.SetServiceURL(url) - if err != nil { - err = core.SDKErrorf(err, "", "url-set-error", common.GetComponentInfo()) - } - return err -} - -// GetServiceURL returns the service URL -func (vpc *VpcV1) GetServiceURL() string { - return vpc.Service.GetServiceURL() -} - -// SetDefaultHeaders sets HTTP headers to be sent in every request -func (vpc *VpcV1) SetDefaultHeaders(headers http.Header) { - vpc.Service.SetDefaultHeaders(headers) -} - -// SetEnableGzipCompression sets the service's EnableGzipCompression field -func (vpc *VpcV1) SetEnableGzipCompression(enableGzip bool) { - vpc.Service.SetEnableGzipCompression(enableGzip) -} - -// GetEnableGzipCompression returns the service's EnableGzipCompression field -func (vpc *VpcV1) GetEnableGzipCompression() bool { - return vpc.Service.GetEnableGzipCompression() -} - -// EnableRetries enables automatic retries for requests invoked for this service instance. -// If either parameter is specified as 0, then a default value is used instead. -func (vpc *VpcV1) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { - vpc.Service.EnableRetries(maxRetries, maxRetryInterval) -} - -// DisableRetries disables automatic retries for requests invoked for this service instance. -func (vpc *VpcV1) DisableRetries() { - vpc.Service.DisableRetries() -} - -// CreateVPC : Create a VPC -// This request creates a new VPC from a VPC prototype object. The prototype object is structured in the same way as a -// retrieved VPC, and contains the information necessary to create the new VPC. -func (vpc *VpcV1) CreateVPC(createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCWithContext(context.Background(), createVPCOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateVPCWithContext is an alternate form of the CreateVPC method which supports a Context parameter -func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(createVPCOptions, "createVPCOptions") - 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, `/vpcs`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createVPCOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPC") - 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 createVPCOptions.AddressPrefixManagement != nil { - body["address_prefix_management"] = createVPCOptions.AddressPrefixManagement - } - if createVPCOptions.ClassicAccess != nil { - body["classic_access"] = createVPCOptions.ClassicAccess - } - if createVPCOptions.Dns != nil { - body["dns"] = createVPCOptions.Dns - } - if createVPCOptions.Name != nil { - body["name"] = createVPCOptions.Name - } - if createVPCOptions.ResourceGroup != nil { - body["resource_group"] = createVPCOptions.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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - core.EnrichHTTPProblem(err, "create_vpc", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateVPCAddressPrefix : Create an address prefix for a VPC -// This request creates a new prefix from a prefix prototype object. The prototype object is structured in the same way -// as a retrieved prefix, and contains the information necessary to create the new prefix. -func (vpc *VpcV1) CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateVPCAddressPrefixWithContext is an alternate form of the CreateVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *createVPCAddressPrefixOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") - 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 createVPCAddressPrefixOptions.CIDR != nil { - body["cidr"] = createVPCAddressPrefixOptions.CIDR - } - if createVPCAddressPrefixOptions.Zone != nil { - body["zone"] = createVPCAddressPrefixOptions.Zone - } - if createVPCAddressPrefixOptions.IsDefault != nil { - body["is_default"] = createVPCAddressPrefixOptions.IsDefault - } - if createVPCAddressPrefixOptions.Name != nil { - body["name"] = createVPCAddressPrefixOptions.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_vpc_address_prefix", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateVPCDnsResolutionBinding : Create a DNS resolution binding -// This request creates a new DNS resolution binding from a DNS resolution binding prototype object. The prototype -// object is structured in the same way as a retrieved DNS resolution binding, and contains the information necessary to -// create the new DNS resolution binding. -// -// For this request to succeed, `dns.enable_hub` must be `false` for the VPC specified by the identifier in the URL, and -// the VPC must not already have a DNS resolution binding. -// -// See [About DNS sharing for VPE gateways](/docs/vpc?topic=vpc-hub-spoke-model) for more information. -func (vpc *VpcV1) CreateVPCDnsResolutionBinding(createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateVPCDnsResolutionBindingWithContext is an alternate form of the CreateVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *createVPCDnsResolutionBindingOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createVPCDnsResolutionBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCDnsResolutionBinding") - 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 createVPCDnsResolutionBindingOptions.VPC != nil { - body["vpc"] = createVPCDnsResolutionBindingOptions.VPC - } - if createVPCDnsResolutionBindingOptions.Name != nil { - body["name"] = createVPCDnsResolutionBindingOptions.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_vpc_dns_resolution_binding", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateVPCRoute : Create a route in a VPC's default routing table -// This request creates a new route in the VPC's default routing table. The route prototype object is structured in the -// same way as a retrieved route, and contains the information necessary to create the new route. The request will fail -// if the new route will cause a loop. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: CreateVPCRoute") - err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *createVPCRouteOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createVPCRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoute") - 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 createVPCRouteOptions.Destination != nil { - body["destination"] = createVPCRouteOptions.Destination - } - if createVPCRouteOptions.Zone != nil { - body["zone"] = createVPCRouteOptions.Zone - } - if createVPCRouteOptions.Action != nil { - body["action"] = createVPCRouteOptions.Action - } - if createVPCRouteOptions.Advertise != nil { - body["advertise"] = createVPCRouteOptions.Advertise - } - if createVPCRouteOptions.Name != nil { - body["name"] = createVPCRouteOptions.Name - } - if createVPCRouteOptions.NextHop != nil { - body["next_hop"] = createVPCRouteOptions.NextHop - } - if createVPCRouteOptions.Priority != nil { - body["priority"] = createVPCRouteOptions.Priority - } - _, 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_vpc_route", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateVPCRoutingTable : Create a routing table for a VPC -// This request creates a routing table from a routing table prototype object. The prototype object is structured in the -// same way as a retrieved routing table, and contains the information necessary to create the new routing table. -func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateVPCRoutingTableWithContext is an alternate form of the CreateVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCRoutingTableOptions, "createVPCRoutingTableOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *createVPCRoutingTableOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createVPCRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTable") - 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 createVPCRoutingTableOptions.AcceptRoutesFrom != nil { - body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom - } - if createVPCRoutingTableOptions.AdvertiseRoutesTo != nil { - body["advertise_routes_to"] = createVPCRoutingTableOptions.AdvertiseRoutesTo - } - if createVPCRoutingTableOptions.Name != nil { - body["name"] = createVPCRoutingTableOptions.Name - } - if createVPCRoutingTableOptions.RouteDirectLinkIngress != nil { - body["route_direct_link_ingress"] = createVPCRoutingTableOptions.RouteDirectLinkIngress - } - if createVPCRoutingTableOptions.RouteInternetIngress != nil { - body["route_internet_ingress"] = createVPCRoutingTableOptions.RouteInternetIngress - } - if createVPCRoutingTableOptions.RouteTransitGatewayIngress != nil { - body["route_transit_gateway_ingress"] = createVPCRoutingTableOptions.RouteTransitGatewayIngress - } - if createVPCRoutingTableOptions.RouteVPCZoneIngress != nil { - body["route_vpc_zone_ingress"] = createVPCRoutingTableOptions.RouteVPCZoneIngress - } - if createVPCRoutingTableOptions.Routes != nil { - body["routes"] = createVPCRoutingTableOptions.Routes - } - _, 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_vpc_routing_table", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateVPCRoutingTableRoute : Create a route in a VPC routing table -// This request creates a new VPC route from a VPC route prototype object. The prototype object is structured in the -// same way as a retrieved VPC route and contains the information necessary to create the route. -func (vpc *VpcV1) CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateVPCRoutingTableRouteWithContext is an alternate form of the CreateVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *createVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *createVPCRoutingTableRouteOptions.RoutingTableID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createVPCRoutingTableRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTableRoute") - 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 createVPCRoutingTableRouteOptions.Destination != nil { - body["destination"] = createVPCRoutingTableRouteOptions.Destination - } - if createVPCRoutingTableRouteOptions.Zone != nil { - body["zone"] = createVPCRoutingTableRouteOptions.Zone - } - if createVPCRoutingTableRouteOptions.Action != nil { - body["action"] = createVPCRoutingTableRouteOptions.Action - } - if createVPCRoutingTableRouteOptions.Advertise != nil { - body["advertise"] = createVPCRoutingTableRouteOptions.Advertise - } - if createVPCRoutingTableRouteOptions.Name != nil { - body["name"] = createVPCRoutingTableRouteOptions.Name - } - if createVPCRoutingTableRouteOptions.NextHop != nil { - body["next_hop"] = createVPCRoutingTableRouteOptions.NextHop - } - if createVPCRoutingTableRouteOptions.Priority != nil { - body["priority"] = createVPCRoutingTableRouteOptions.Priority - } - _, 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_vpc_routing_table_route", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteVPC : Delete a VPC -// This request deletes a VPC. This operation cannot be reversed. -// -// For this request to succeed: -// - Instances, subnets, public gateways, and endpoint gateways must not reside in this VPC -// - The VPC must not be providing DNS resolution for any other VPCs -// - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero -// -// All security groups and network ACLs associated with the VPC are automatically deleted. All flow log collectors with -// `auto_delete` set to `true` targeting the VPC or any resource in the VPC are automatically deleted. -func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteVPCWithContext is an alternate form of the DeleteVPC method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCOptions, "deleteVPCOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteVPCOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteVPCOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - if deleteVPCOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCOptions.IfMatch)) - } - - 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_vpc", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteVPCAddressPrefix : Delete an address prefix -// This request deletes a prefix. This operation cannot be reversed. The request will fail if any subnets use addresses -// from this prefix. -func (vpc *VpcV1) DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteVPCAddressPrefixWithContext is an alternate form of the DeleteVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCAddressPrefixOptions.VPCID, - "id": *deleteVPCAddressPrefixOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteVPCAddressPrefixOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") - 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_vpc_address_prefix", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteVPCDnsResolutionBinding : Delete a DNS resolution binding -// This request deletes a DNS resolution binding. This operation cannot be reversed. -// -// For this request to succeed, the VPC specified by the identifier in the URL must not have -// `dns.resolver.type` set to `delegated`. -func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteVPCDnsResolutionBindingWithContext is an alternate form of the DeleteVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCDnsResolutionBindingOptions.VPCID, - "id": *deleteVPCDnsResolutionBindingOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteVPCDnsResolutionBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCDnsResolutionBinding") - 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_vpc_dns_resolution_binding", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteVPCRoute : Delete a VPC route -// This request deletes a route. This operation cannot be reversed. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: DeleteVPCRoute") - err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRouteOptions.VPCID, - "id": *deleteVPCRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteVPCRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") - 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_vpc_route", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteVPCRoutingTable : Delete a VPC routing table -// This request deletes a routing table. A routing table cannot be deleted if it is associated with any subnets in the -// VPC. Additionally, a VPC's default routing table cannot be deleted. This operation cannot be reversed. -func (vpc *VpcV1) DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteVPCRoutingTableWithContext is an alternate form of the DeleteVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRoutingTableOptions.VPCID, - "id": *deleteVPCRoutingTableOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteVPCRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - if deleteVPCRoutingTableOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCRoutingTableOptions.IfMatch)) - } - - 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_vpc_routing_table", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteVPCRoutingTableRoute : Delete a VPC routing table route -// This request deletes a VPC route. This operation cannot be reversed. Only VPC routes with an `origin` of `user` are -// allowed to be deleted. -func (vpc *VpcV1) DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteVPCRoutingTableRouteWithContext is an alternate form of the DeleteVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *deleteVPCRoutingTableRouteOptions.RoutingTableID, - "id": *deleteVPCRoutingTableRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") - 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_vpc_routing_table_route", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetVPC : Retrieve a VPC -// This request retrieves a single VPC specified by the identifier in the URL. -func (vpc *VpcV1) GetVPC(getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCWithContext(context.Background(), getVPCOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVPCWithContext is an alternate form of the GetVPC method which supports a Context parameter -func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCOptions, "getVPCOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPCOptions, "getVPCOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getVPCOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVPCOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") - 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_vpc", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetVPCAddressPrefix : Retrieve an address prefix -// This request retrieves a single prefix specified by the identifier in the URL. -func (vpc *VpcV1) GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVPCAddressPrefixWithContext is an alternate form of the GetVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *getVPCAddressPrefixOptions.VPCID, - "id": *getVPCAddressPrefixOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") - 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_vpc_address_prefix", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetVPCDefaultNetworkACL : Retrieve a VPC's default network ACL -// This request retrieves the default network ACL for the VPC specified by the identifier in the URL. The default -// network ACL is applied to any new subnets in the VPC which do not specify a network ACL. -func (vpc *VpcV1) GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVPCDefaultNetworkACLWithContext is an alternate form of the GetVPCDefaultNetworkACL method which supports a Context parameter -func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getVPCDefaultNetworkACLOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_network_acl`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVPCDefaultNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") - 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_vpc_default_network_acl", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultNetworkACL) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetVPCDefaultRoutingTable : Retrieve a VPC's default routing table -// This request retrieves the default routing table for the VPC specified by the identifier in the URL. The default -// routing table is associated with any subnets in the VPC which have not been explicitly associated with another -// routing table. -func (vpc *VpcV1) GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVPCDefaultRoutingTableWithContext is an alternate form of the GetVPCDefaultRoutingTable method which supports a Context parameter -func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getVPCDefaultRoutingTableOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_routing_table`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") - 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_vpc_default_routing_table", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultRoutingTable) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetVPCDefaultSecurityGroup : Retrieve a VPC's default security group -// This request retrieves the default security group for the VPC specified by the identifier in the URL. Resources -// created in this VPC that allow a security group to be optionally specified will use this security group by default. -func (vpc *VpcV1) GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVPCDefaultSecurityGroupWithContext is an alternate form of the GetVPCDefaultSecurityGroup method which supports a Context parameter -func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getVPCDefaultSecurityGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_security_group`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVPCDefaultSecurityGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") - 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_vpc_default_security_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultSecurityGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetVPCDnsResolutionBinding : Retrieve a DNS resolution binding -// This request retrieves a single DNS resolution binding specified by the identifier in the URL. -func (vpc *VpcV1) GetVPCDnsResolutionBinding(getVPCDnsResolutionBindingOptions *GetVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCDnsResolutionBindingWithContext(context.Background(), getVPCDnsResolutionBindingOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVPCDnsResolutionBindingWithContext is an alternate form of the GetVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, getVPCDnsResolutionBindingOptions *GetVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPCDnsResolutionBindingOptions, "getVPCDnsResolutionBindingOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *getVPCDnsResolutionBindingOptions.VPCID, - "id": *getVPCDnsResolutionBindingOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVPCDnsResolutionBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDnsResolutionBinding") - 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_vpc_dns_resolution_binding", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetVPCRoute : Retrieve a VPC route -// This request retrieves a single route specified by the identifier in the URL. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetVPCRoute") - err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *getVPCRouteOptions.VPCID, - "id": *getVPCRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVPCRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") - 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_vpc_route", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetVPCRoutingTable : Retrieve a VPC routing table -// This request retrieves a single routing table specified by the identifier in the URL. -func (vpc *VpcV1) GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVPCRoutingTableWithContext is an alternate form of the GetVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCRoutingTableOptions, "getVPCRoutingTableOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *getVPCRoutingTableOptions.VPCID, - "id": *getVPCRoutingTableOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVPCRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") - 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_vpc_routing_table", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetVPCRoutingTableRoute : Retrieve a VPC routing table route -// This request retrieves a single VPC route specified by the identifier in the URL path. -func (vpc *VpcV1) GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVPCRoutingTableRouteWithContext is an alternate form of the GetVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *getVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *getVPCRoutingTableRouteOptions.RoutingTableID, - "id": *getVPCRoutingTableRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVPCRoutingTableRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") - 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_vpc_routing_table_route", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVPCAddressPrefixes : List all address prefixes for a VPC -// This request lists all address pool prefixes for a VPC. -func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListVPCAddressPrefixesWithContext is an alternate form of the ListVPCAddressPrefixes method which supports a Context parameter -func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *listVPCAddressPrefixesOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listVPCAddressPrefixesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") - 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 listVPCAddressPrefixesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) - } - if listVPCAddressPrefixesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCAddressPrefixesOptions.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_vpc_address_prefixes", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefixCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVPCDnsResolutionBindings : List all DNS resolution bindings for a VPC -// This request lists all DNS resolution bindings for a VPC. A DNS resolution binding represents an association with -// another VPC for centralizing DNS name resolution. -// -// If the VPC specified by the identifier in the URL is a DNS hub VPC (has `dns.enable_hub` set to `true`) then there is -// one binding for each VPC bound to the hub VPC. The endpoint gateways in the bound VPCs can allow (using -// `allow_dns_resolution_binding`) the hub VPC to centralize resolution of their DNS names. -// -// If the VPC specified by the identifier in the URL is not a DNS hub VPC, then there is at most one binding (to a hub -// VPC). The endpoint gateways in the VPC specified by the identifier in the URL can allow (using -// `allow_dns_resolution_binding`) its hub VPC to centralize resolution of their DNS names. -// -// To make use of centralized DNS resolution, a VPC bound to a DNS hub VPC must delegate DNS resolution to its hub VPC -// by setting `dns.resolver.type` to `delegate`. -// -// The bindings will be sorted by their `created_at` property values, with newest bindings first. Bindings with -// identical `created_at` property values will in turn be sorted by ascending `name` property values. -func (vpc *VpcV1) ListVPCDnsResolutionBindings(listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListVPCDnsResolutionBindingsWithContext is an alternate form of the ListVPCDnsResolutionBindings method which supports a Context parameter -func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *listVPCDnsResolutionBindingsOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listVPCDnsResolutionBindingsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCDnsResolutionBindings") - 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 listVPCDnsResolutionBindingsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Sort)) - } - if listVPCDnsResolutionBindingsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Start)) - } - if listVPCDnsResolutionBindingsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Limit)) - } - if listVPCDnsResolutionBindingsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Name)) - } - if listVPCDnsResolutionBindingsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCCRN)) - } - if listVPCDnsResolutionBindingsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCName)) - } - if listVPCDnsResolutionBindingsOptions.AccountID != nil { - builder.AddQuery("account.id", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.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_vpc_dns_resolution_bindings", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBindingCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVPCRoutes : List all routes in a VPC's default routing table -// This request lists all routes in the VPC's default routing table. Each route is zone-specific and directs any packets -// matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's -// destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListVPCRoutes") - err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutesOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listVPCRoutesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") - 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 listVPCRoutesOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) - } - if listVPCRoutesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutesOptions.Start)) - } - if listVPCRoutesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutesOptions.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_vpc_routes", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollectionVPCContext) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVPCRoutingTableRoutes : List all routes in a VPC routing table -// This request lists all routes in a VPC routing table. If subnets are associated with this routing table, delivery of -// packets sent on a subnet is performed according to the action of the most specific matching route in the table -// (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, the route with the -// highest priority will be used. If two matching routes have the same destination and priority, traffic will be -// distributed between them. If no routes match, delivery will be controlled by the system's built-in routes. -func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListVPCRoutingTableRoutesWithContext is an alternate form of the ListVPCRoutingTableRoutes method which supports a Context parameter -func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutingTableRoutesOptions.VPCID, - "routing_table_id": *listVPCRoutingTableRoutesOptions.RoutingTableID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listVPCRoutingTableRoutesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") - 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 listVPCRoutingTableRoutesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) - } - if listVPCRoutingTableRoutesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTableRoutesOptions.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_vpc_routing_table_routes", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVPCRoutingTables : List all routing tables for a VPC -// This request lists all routing tables for a VPC. Each subnet in a VPC is associated with a routing table, which -// controls delivery of packets sent on that subnet according to the action of the most specific matching route in the -// table. If multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, -// delivery will be controlled by the system's built-in routes. -func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListVPCRoutingTablesWithContext is an alternate form of the ListVPCRoutingTables method which supports a Context parameter -func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutingTablesOptions.VPCID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listVPCRoutingTablesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") - 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 listVPCRoutingTablesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) - } - if listVPCRoutingTablesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTablesOptions.Limit)) - } - if listVPCRoutingTablesOptions.IsDefault != nil { - builder.AddQuery("is_default", fmt.Sprint(*listVPCRoutingTablesOptions.IsDefault)) - } - - 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_vpc_routing_tables", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTableCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVpcs : List all VPCs -// This request lists all VPCs in the region. A VPC is a virtual network that belongs to an account and provides logical -// isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC -// can contain resources in multiple zones in a region. -func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListVpcsWithContext is an alternate form of the ListVpcs method which supports a Context parameter -func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVpcsOptions, "listVpcsOptions") - 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, `/vpcs`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listVpcsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") - 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 listVpcsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) - } - if listVpcsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVpcsOptions.Limit)) - } - if listVpcsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVpcsOptions.ResourceGroupID)) - } - if listVpcsOptions.ClassicAccess != nil { - builder.AddQuery("classic_access", fmt.Sprint(*listVpcsOptions.ClassicAccess)) - } - - 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_vpcs", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPCCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateVPC : Update a VPC -// This request updates a VPC with the information provided in a VPC patch object. The patch object is structured in the -// same way as a retrieved VPC and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateVPCWithContext is an alternate form of the UpdateVPC method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCOptions, "updateVPCOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateVPCOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateVPCOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPC") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVPCOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVPCOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) - 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_vpc", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateVPCAddressPrefix : Update an address prefix -// This request updates a prefix with the information in a provided prefix patch. The prefix patch object is structured -// in the same way as a retrieved prefix and contains only the information to be updated. -func (vpc *VpcV1) UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateVPCAddressPrefixWithContext is an alternate form of the UpdateVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *updateVPCAddressPrefixOptions.VPCID, - "id": *updateVPCAddressPrefixOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateVPCAddressPrefixOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCAddressPrefix") - 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(updateVPCAddressPrefixOptions.AddressPrefixPatch) - 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_vpc_address_prefix", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateVPCDnsResolutionBinding : Update a DNS resolution binding -// This request updates a DNS resolution binding with the information in a provided DNS resolution binding patch. The -// DNS resolution binding patch object is structured in the same way as a retrieved DNS resolution binding and contains -// only the information to be updated. -func (vpc *VpcV1) UpdateVPCDnsResolutionBinding(updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateVPCDnsResolutionBindingWithContext is an alternate form of the UpdateVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *updateVPCDnsResolutionBindingOptions.VPCID, - "id": *updateVPCDnsResolutionBindingOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateVPCDnsResolutionBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCDnsResolutionBinding") - 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(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) - 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_vpc_dns_resolution_binding", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateVPCRoute : Update a VPC route -// This request updates a route with the information in a provided route patch. The route patch object is structured in -// the same way as a retrieved route and contains only the information to be updated. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: UpdateVPCRoute") - err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *updateVPCRouteOptions.VPCID, - "id": *updateVPCRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateVPCRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoute") - 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(updateVPCRouteOptions.RoutePatch) - 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_vpc_route", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateVPCRoutingTable : Update a VPC routing table -// This request updates a routing table with the information in a provided routing table patch. The patch object is -// structured in the same way as a retrieved table and contains only the information to be updated. -func (vpc *VpcV1) UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateVPCRoutingTableWithContext is an alternate form of the UpdateVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *updateVPCRoutingTableOptions.VPCID, - "id": *updateVPCRoutingTableOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateVPCRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVPCRoutingTableOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVPCRoutingTableOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) - 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_vpc_routing_table", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateVPCRoutingTableRoute : Update a VPC routing table route -// This request updates a VPC route with the information provided in a route patch object. The patch object is -// structured in the same way as a retrieved VPC route and needs to contain only the information to be updated. Only VPC -// routes with an `origin` of `user` are allowed to be updated. -func (vpc *VpcV1) UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCRoutingTableRouteWithContext(context.Background(), updateVPCRoutingTableRouteOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateVPCRoutingTableRouteWithContext is an alternate form of the UpdateVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *updateVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *updateVPCRoutingTableRouteOptions.RoutingTableID, - "id": *updateVPCRoutingTableRouteOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateVPCRoutingTableRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTableRoute") - 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(updateVPCRoutingTableRouteOptions.RoutePatch) - 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_vpc_routing_table_route", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateSubnet : Create a subnet -// This request creates a new subnet from a subnet prototype object. The prototype object is structured in the same way -// as a retrieved subnet, and contains the information necessary to create the new subnet. For this request to succeed, -// the prototype's CIDR block must not overlap with an existing subnet in the VPC. -func (vpc *VpcV1) CreateSubnet(createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateSubnetWithContext is an alternate form of the CreateSubnet method which supports a Context parameter -func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSubnetOptions, "createSubnetOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") - 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, `/subnets`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createSubnetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") - 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(createSubnetOptions.SubnetPrototype) - 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_subnet", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateSubnetReservedIP : Reserve an IP in a subnet -// This request reserves an IP address in a subnet. If the provided prototype object includes an `address`, the address -// must not already be reserved. -func (vpc *VpcV1) CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateSubnetReservedIPWithContext is an alternate form of the CreateSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSubnetReservedIPOptions, "createSubnetReservedIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "subnet_id": *createSubnetReservedIPOptions.SubnetID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createSubnetReservedIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") - 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 createSubnetReservedIPOptions.Address != nil { - body["address"] = createSubnetReservedIPOptions.Address - } - if createSubnetReservedIPOptions.AutoDelete != nil { - body["auto_delete"] = createSubnetReservedIPOptions.AutoDelete - } - if createSubnetReservedIPOptions.Name != nil { - body["name"] = createSubnetReservedIPOptions.Name - } - if createSubnetReservedIPOptions.Target != nil { - body["target"] = createSubnetReservedIPOptions.Target - } - _, 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_subnet_reserved_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteSubnet : Delete a subnet -// This request deletes a subnet. This operation cannot be reversed. For this request to succeed, the subnet must not be -// referenced by any bare metal server network interfaces, instance network interfaces, virtual network interfaces, VPN -// gateways, or load balancers. A delete operation automatically detaches the subnet from any network ACLs, public -// gateways, or endpoint gateways. All flow log collectors with `auto_delete` set to `true` targeting the subnet or any -// resource in the subnet are automatically deleted. -func (vpc *VpcV1) DeleteSubnet(deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSubnetWithContext(context.Background(), deleteSubnetOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteSubnetWithContext is an alternate form of the DeleteSubnet method which supports a Context parameter -func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSubnetOptions, "deleteSubnetOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteSubnetOptions, "deleteSubnetOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteSubnetOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteSubnetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnet") - 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_subnet", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteSubnetReservedIP : Delete a reserved IP -// This request releases a reserved IP. This operation cannot be reversed. -// -// For this request to succeed, the reserved IP must not be required by another resource, such as a bare metal server -// network interface, instance network interface or virtual network interface for which it is the primary IP. A -// provider-owned reserved IP is not allowed to be deleted. -func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteSubnetReservedIPWithContext is an alternate form of the DeleteSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "subnet_id": *deleteSubnetReservedIPOptions.SubnetID, - "id": *deleteSubnetReservedIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") - 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_subnet_reserved_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetSubnet : Retrieve a subnet -// This request retrieves a single subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnet(getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetSubnetWithContext is an alternate form of the GetSubnet method which supports a Context parameter -func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetOptions, "getSubnetOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getSubnetOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getSubnetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") - 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_subnet", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetSubnetNetworkACL : Retrieve a subnet's attached network ACL -// This request retrieves the network ACL attached to the subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetNetworkACL(getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSubnetNetworkACLWithContext(context.Background(), getSubnetNetworkACLOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetSubnetNetworkACLWithContext is an alternate form of the GetSubnetNetworkACL method which supports a Context parameter -func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getSubnetNetworkACLOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getSubnetNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetNetworkACL") - 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_subnet_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 -} - -// GetSubnetPublicGateway : Retrieve a subnet's attached public gateway -// This request retrieves the public gateway attached to the subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetSubnetPublicGatewayWithContext is an alternate form of the GetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getSubnetPublicGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getSubnetPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") - 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_subnet_public_gateway", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetSubnetReservedIP : Retrieve a reserved IP -// This request retrieves a single reserved IP specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetSubnetReservedIPWithContext is an alternate form of the GetSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetReservedIPOptions, "getSubnetReservedIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "subnet_id": *getSubnetReservedIPOptions.SubnetID, - "id": *getSubnetReservedIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getSubnetReservedIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") - 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_subnet_reserved_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetSubnetRoutingTable : Retrieve a subnet's attached routing table -// This request retrieves the routing table attached to the subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetSubnetRoutingTableWithContext is an alternate form of the GetSubnetRoutingTable method which supports a Context parameter -func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getSubnetRoutingTableOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getSubnetRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") - 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_subnet_routing_table", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListSubnetReservedIps : List all reserved IPs in a subnet -// This request lists all reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet -// which is not available for use. -func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListSubnetReservedIpsWithContext is an alternate form of the ListSubnetReservedIps method which supports a Context parameter -func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "subnet_id": *listSubnetReservedIpsOptions.SubnetID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listSubnetReservedIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") - 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 listSubnetReservedIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) - } - if listSubnetReservedIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSubnetReservedIpsOptions.Limit)) - } - if listSubnetReservedIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSubnetReservedIpsOptions.Sort)) - } - if listSubnetReservedIpsOptions.TargetID != nil { - builder.AddQuery("target.id", fmt.Sprint(*listSubnetReservedIpsOptions.TargetID)) - } - if listSubnetReservedIpsOptions.TargetCRN != nil { - builder.AddQuery("target.crn", fmt.Sprint(*listSubnetReservedIpsOptions.TargetCRN)) - } - if listSubnetReservedIpsOptions.TargetName != nil { - builder.AddQuery("target.name", fmt.Sprint(*listSubnetReservedIpsOptions.TargetName)) - } - if listSubnetReservedIpsOptions.TargetResourceType != nil { - builder.AddQuery("target.resource_type", fmt.Sprint(*listSubnetReservedIpsOptions.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_subnet_reserved_ips", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListSubnets : List all subnets -// This request lists all subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block -// notation. Each subnet is within a particular zone and cannot span multiple zones or regions. -func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListSubnetsWithContext is an alternate form of the ListSubnets method which supports a Context parameter -func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSubnetsOptions, "listSubnetsOptions") - 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, `/subnets`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listSubnetsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") - 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 listSubnetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) - } - if listSubnetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSubnetsOptions.Limit)) - } - if listSubnetsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSubnetsOptions.ResourceGroupID)) - } - if listSubnetsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listSubnetsOptions.ZoneName)) - } - if listSubnetsOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listSubnetsOptions.VPCID)) - } - if listSubnetsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listSubnetsOptions.VPCCRN)) - } - if listSubnetsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listSubnetsOptions.VPCName)) - } - if listSubnetsOptions.RoutingTableID != nil { - builder.AddQuery("routing_table.id", fmt.Sprint(*listSubnetsOptions.RoutingTableID)) - } - if listSubnetsOptions.RoutingTableName != nil { - builder.AddQuery("routing_table.name", fmt.Sprint(*listSubnetsOptions.RoutingTableName)) - } - - 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_subnets", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnetCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ReplaceSubnetNetworkACL : Replace the network ACL for a subnet -// This request replaces the existing network ACL for a subnet with the network ACL specified in the request body. -func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - result, response, err = vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ReplaceSubnetNetworkACLWithContext is an alternate form of the ReplaceSubnetNetworkACL method which supports a Context parameter -func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *replaceSubnetNetworkACLOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range replaceSubnetNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") - 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(replaceSubnetNetworkACLOptions.NetworkACLIdentity) - 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, "replace_subnet_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 -} - -// ReplaceSubnetRoutingTable : Replace the routing table for a subnet -// This request replaces the existing routing table for a subnet with the routing table specified in the request body. -// -// For this request to succeed, the routing table `route_direct_link_ingress`, -// `route_internet_ingress`, `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. -func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ReplaceSubnetRoutingTableWithContext is an alternate form of the ReplaceSubnetRoutingTable method which supports a Context parameter -func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *replaceSubnetRoutingTableOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range replaceSubnetRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") - 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(replaceSubnetRoutingTableOptions.RoutingTableIdentity) - 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, "replace_subnet_routing_table", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// SetSubnetPublicGateway : Attach a public gateway to a subnet -// This request attaches the public gateway, specified in the request body, to the subnet specified by the subnet -// identifier in the URL. The public gateway must have the same VPC and zone as the subnet. -func (vpc *VpcV1) SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// SetSubnetPublicGatewayWithContext is an alternate form of the SetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *setSubnetPublicGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") - 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(setSubnetPublicGatewayOptions.PublicGatewayIdentity) - 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, "set_subnet_public_gateway", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UnsetSubnetPublicGateway : Detach a public gateway from a subnet -// This request detaches the public gateway from the subnet specified by the subnet identifier in the URL. -func (vpc *VpcV1) UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UnsetSubnetPublicGatewayWithContext is an alternate form of the UnsetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *unsetSubnetPublicGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") - 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, "unset_subnet_public_gateway", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// UpdateSubnet : Update a subnet -// This request updates a subnet with the information in a provided subnet patch. The subnet patch object is structured -// in the same way as a retrieved subnet and contains only the information to be updated. -func (vpc *VpcV1) UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateSubnetWithContext is an alternate form of the UpdateSubnet method which supports a Context parameter -func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSubnetOptions, "updateSubnetOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateSubnetOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateSubnetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") - 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(updateSubnetOptions.SubnetPatch) - 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_subnet", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateSubnetReservedIP : Update a reserved IP -// This request updates a reserved IP with the information in a provided reserved IP patch. The reserved IP patch object -// is structured in the same way as a retrieved reserved IP and contains only the information to be updated. -// -// A provider-owned reserved IP is not allowed to be updated. -func (vpc *VpcV1) UpdateSubnetReservedIP(updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateSubnetReservedIPWithContext(context.Background(), updateSubnetReservedIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateSubnetReservedIPWithContext is an alternate form of the UpdateSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "subnet_id": *updateSubnetReservedIPOptions.SubnetID, - "id": *updateSubnetReservedIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateSubnetReservedIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnetReservedIP") - 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(updateSubnetReservedIPOptions.ReservedIPPatch) - 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_subnet_reserved_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateImage : Create an image -// This request creates a new image from an image prototype object. The prototype object is structured in the same way -// as a retrieved image, and contains the information necessary to create the new image. If an image is being imported, -// a URL to the image file on object storage must be specified. If an image is being created from an existing volume, -// that volume must be specified. -func (vpc *VpcV1) CreateImage(createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateImageWithContext(context.Background(), createImageOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateImageWithContext is an alternate form of the CreateImage method which supports a Context parameter -func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createImageOptions, "createImageOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createImageOptions, "createImageOptions") - 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, `/images`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") - 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(createImageOptions.ImagePrototype) - 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_image", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateImageExportJob : Create an image export job -// This request creates and queues a new export job for the image specified in the URL using the image export job -// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, `obsolete`, or -// `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains -// the information necessary to create and queue the new image export job. -func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateImageExportJobWithContext is an alternate form of the CreateImageExportJob method which supports a Context parameter -func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createImageExportJobOptions, "createImageExportJobOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createImageExportJobOptions, "createImageExportJobOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "image_id": *createImageExportJobOptions.ImageID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createImageExportJobOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImageExportJob") - 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 createImageExportJobOptions.StorageBucket != nil { - body["storage_bucket"] = createImageExportJobOptions.StorageBucket - } - if createImageExportJobOptions.Format != nil { - body["format"] = createImageExportJobOptions.Format - } - if createImageExportJobOptions.Name != nil { - body["name"] = createImageExportJobOptions.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_image_export_job", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteImage : Delete an image -// This request deletes an image. Any active image export jobs will be completed first. This operation cannot be -// reversed. A system-provided image is not allowed to be deleted. Additionally, an image cannot be deleted if it: -// - has a `status` of `deleting` -// - has a `status` of `pending` with a `status_reasons` code of `image_request_in_progress` -// - has `catalog_offering.managed` set to `true`. -func (vpc *VpcV1) DeleteImage(deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteImageWithContext(context.Background(), deleteImageOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteImageWithContext is an alternate form of the DeleteImage method which supports a Context parameter -func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteImageOptions, "deleteImageOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteImageOptions, "deleteImageOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteImageOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImage") - 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_image", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteImageExportJob : Delete an image export job -// This request deletes an image export job. This operation cannot be reversed. If the job has not completed, the job -// will be canceled, and the incomplete exported image object deleted. If the job has completed, the exported image -// object will not be deleted. -func (vpc *VpcV1) DeleteImageExportJob(deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteImageExportJobWithContext is an alternate form of the DeleteImageExportJob method which supports a Context parameter -func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteImageExportJobOptions, "deleteImageExportJobOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteImageExportJobOptions, "deleteImageExportJobOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "image_id": *deleteImageExportJobOptions.ImageID, - "id": *deleteImageExportJobOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteImageExportJobOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImageExportJob") - 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_image_export_job", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeprecateImage : Deprecate an image -// This request deprecates an image, resulting in its `status` becoming `deprecated` and -// `deprecation_at` being set to the current date and time. -// -// The image must: -// - have a `status` of `available` -// - have `catalog_offering.managed` set to `false` -// - not have `deprecation_at` set -// -// The image must not have `deprecation_at` set, must have `catalog_offering.managed` set to -// `false`, and must have a `status` of `available`. -// -// A system-provided image is not allowed to be deprecated. -func (vpc *VpcV1) DeprecateImage(deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeprecateImageWithContext(context.Background(), deprecateImageOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeprecateImageWithContext is an alternate form of the DeprecateImage method which supports a Context parameter -func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageOptions *DeprecateImageOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deprecateImageOptions, "deprecateImageOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deprecateImageOptions, "deprecateImageOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deprecateImageOptions.ID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/deprecate`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deprecateImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeprecateImage") - 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, "deprecate_image", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetImage : Retrieve an image -// This request retrieves a single image specified by the identifier in the URL. -func (vpc *VpcV1) GetImage(getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetImageWithContext(context.Background(), getImageOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetImageWithContext is an alternate form of the GetImage method which supports a Context parameter -func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getImageOptions, "getImageOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getImageOptions, "getImageOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getImageOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") - 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_image", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetImageExportJob : Retrieve an image export job -// This request retrieves a single image export job specified by the identifier in the URL. -func (vpc *VpcV1) GetImageExportJob(getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetImageExportJobWithContext is an alternate form of the GetImageExportJob method which supports a Context parameter -func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getImageExportJobOptions, "getImageExportJobOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getImageExportJobOptions, "getImageExportJobOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "image_id": *getImageExportJobOptions.ImageID, - "id": *getImageExportJobOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getImageExportJobOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImageExportJob") - 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_image_export_job", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetOperatingSystem : Retrieve an operating system -// This request retrieves a single operating system specified by the name in the URL. -func (vpc *VpcV1) GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetOperatingSystemWithContext is an alternate form of the GetOperatingSystem method which supports a Context parameter -func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getOperatingSystemOptions, "getOperatingSystemOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "name": *getOperatingSystemOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems/{name}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getOperatingSystemOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetOperatingSystem") - 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_operating_system", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystem) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListImageExportJobs : List all image export jobs -// This request lists all export jobs for an image. Each job tracks the exporting of the image to another location, such -// as a bucket within cloud object storage. -// -// The jobs will be sorted by their `created_at` property values, with newest jobs first. Jobs with identical -// `created_at` property values will in turn be sorted by ascending -// `name` property values. -func (vpc *VpcV1) ListImageExportJobs(listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListImageExportJobsWithContext(context.Background(), listImageExportJobsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListImageExportJobsWithContext is an alternate form of the ListImageExportJobs method which supports a Context parameter -func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listImageExportJobsOptions, "listImageExportJobsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listImageExportJobsOptions, "listImageExportJobsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "image_id": *listImageExportJobsOptions.ImageID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listImageExportJobsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageExportJobs") - 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 listImageExportJobsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listImageExportJobsOptions.Name)) - } - - 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_image_export_jobs", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJobUnpaginatedCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListImages : List all images -// This request lists all images available in the region. An image provides source data for a volume. Images are either -// system-provided, or created from another source, such as importing from Cloud Object Storage. -func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListImagesWithContext(context.Background(), listImagesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListImagesWithContext is an alternate form of the ListImages method which supports a Context parameter -func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listImagesOptions, "listImagesOptions") - 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, `/images`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listImagesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") - 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 listImagesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) - } - if listImagesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listImagesOptions.Limit)) - } - if listImagesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listImagesOptions.ResourceGroupID)) - } - if listImagesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) - } - if listImagesOptions.Status != nil { - builder.AddQuery("status", strings.Join(listImagesOptions.Status, ",")) - } - if listImagesOptions.Visibility != nil { - builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) - } - - 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_images", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListOperatingSystems : List all operating systems -// This request lists all operating systems in the region. -func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListOperatingSystemsWithContext is an alternate form of the ListOperatingSystems method which supports a Context parameter -func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listOperatingSystemsOptions, "listOperatingSystemsOptions") - 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, `/operating_systems`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listOperatingSystemsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") - 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 listOperatingSystemsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) - } - if listOperatingSystemsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listOperatingSystemsOptions.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_operating_systems", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystemCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ObsoleteImage : Obsolete an image -// This request obsoletes an image, resulting in its `status` becoming `obsolete` and -// `obsolescence_at` being set to the current date and time. -// -// The image must: -// - have a `status` of `available` or `deprecated` -// - have `catalog_offering.managed` set to `false` -// - not have `deprecation_at` set in the future -// - not have `obsolescence_at` set -// -// A system-provided image is not allowed to be obsoleted. -func (vpc *VpcV1) ObsoleteImage(obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ObsoleteImageWithContext is an alternate form of the ObsoleteImage method which supports a Context parameter -func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(obsoleteImageOptions, "obsoleteImageOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(obsoleteImageOptions, "obsoleteImageOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *obsoleteImageOptions.ID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/obsolete`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range obsoleteImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ObsoleteImage") - 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, "obsolete_image", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// UpdateImage : Update an image -// This request updates an image with the information in a provided image patch. The image patch object is structured in -// the same way as a retrieved image and contains only the information to be updated. A system-provided image is not -// allowed to be updated. An image with a `status` of `deleting` cannot be updated. -func (vpc *VpcV1) UpdateImage(updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateImageWithContext(context.Background(), updateImageOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateImageWithContext is an alternate form of the UpdateImage method which supports a Context parameter -func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateImageOptions, "updateImageOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateImageOptions, "updateImageOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateImageOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImage") - 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(updateImageOptions.ImagePatch) - 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_image", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateImageExportJob : Update an image export job -// This request updates an image export job with the information in a provided image export job patch. The image export -// job patch object is structured in the same way as a retrieved image export job and contains only the information to -// be updated. -func (vpc *VpcV1) UpdateImageExportJob(updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateImageExportJobWithContext(context.Background(), updateImageExportJobOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateImageExportJobWithContext is an alternate form of the UpdateImageExportJob method which supports a Context parameter -func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateImageExportJobOptions, "updateImageExportJobOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateImageExportJobOptions, "updateImageExportJobOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "image_id": *updateImageExportJobOptions.ImageID, - "id": *updateImageExportJobOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateImageExportJobOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImageExportJob") - 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(updateImageExportJobOptions.ImageExportJobPatch) - 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_image_export_job", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateKey : Create a key -// This request creates a new SSH key from an key prototype object. The prototype object is structured in the same way -// as a retrieved key, and contains the information necessary to create the new key. The public key value must be -// provided. -func (vpc *VpcV1) CreateKey(createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateKeyWithContext(context.Background(), createKeyOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateKeyWithContext is an alternate form of the CreateKey method which supports a Context parameter -func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createKeyOptions, "createKeyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createKeyOptions, "createKeyOptions") - 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, `/keys`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createKeyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateKey") - 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 createKeyOptions.PublicKey != nil { - body["public_key"] = createKeyOptions.PublicKey - } - if createKeyOptions.Name != nil { - body["name"] = createKeyOptions.Name - } - if createKeyOptions.ResourceGroup != nil { - body["resource_group"] = createKeyOptions.ResourceGroup - } - if createKeyOptions.Type != nil { - body["type"] = createKeyOptions.Type - } - _, 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_key", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteKey : Delete a key -// This request deletes a key. This operation cannot be reversed. -func (vpc *VpcV1) DeleteKey(deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteKeyWithContext(context.Background(), deleteKeyOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteKeyWithContext is an alternate form of the DeleteKey method which supports a Context parameter -func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteKeyOptions, "deleteKeyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteKeyOptions, "deleteKeyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteKeyOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteKeyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteKey") - 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_key", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetKey : Retrieve a key -// This request retrieves a single key specified by the identifier in the URL. -func (vpc *VpcV1) GetKey(getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetKeyWithContext(context.Background(), getKeyOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetKeyWithContext is an alternate form of the GetKey method which supports a Context parameter -func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getKeyOptions, "getKeyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getKeyOptions, "getKeyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getKeyOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getKeyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetKey") - 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_key", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListKeys : List all keys -// This request lists all keys in the region. A key contains a public SSH key which may be installed on instances when -// they are created. Private keys are not stored. -func (vpc *VpcV1) ListKeys(listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListKeysWithContext(context.Background(), listKeysOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListKeysWithContext is an alternate form of the ListKeys method which supports a Context parameter -func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listKeysOptions, "listKeysOptions") - 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, `/keys`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listKeysOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListKeys") - 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 listKeysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listKeysOptions.Start)) - } - if listKeysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listKeysOptions.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_keys", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKeyCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateKey : Update a key -// This request updates a key's name. -func (vpc *VpcV1) UpdateKey(updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateKeyWithContext(context.Background(), updateKeyOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateKeyWithContext is an alternate form of the UpdateKey method which supports a Context parameter -func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateKeyOptions, "updateKeyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateKeyOptions, "updateKeyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateKeyOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateKeyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateKey") - 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(updateKeyOptions.KeyPatch) - 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_key", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with an instance network interface -// This request associates the specified floating IP with the specified instance network interface, replacing any -// existing association. -// -// The existing floating IP must: -// - not be required by another resource, such as a public gateway -// - be in the same `zone` as the instance -// -// A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// AddInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the AddInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *addInstanceNetworkInterfaceFloatingIPOptions.InstanceID, - "network_interface_id": *addInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *addInstanceNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range addInstanceNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddInstanceNetworkInterfaceFloatingIP") - 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, "add_instance_network_interface_floating_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateInstance : Create an instance -// This request provisions a new instance from an instance prototype object. The prototype object is structured in the -// same way as a retrieved instance, and contains the information necessary to provision the new instance. The instance -// is automatically started. -func (vpc *VpcV1) CreateInstance(createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateInstanceWithContext is an alternate form of the CreateInstance method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceOptions, "createInstanceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createInstanceOptions, "createInstanceOptions") - 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, `/instances`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createInstanceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstance") - 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(createInstanceOptions.InstancePrototype) - 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_instance", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateInstanceAction : Create an instance action -// This request creates a new action which will be queued up to run as soon as any pending or running actions have -// completed. -func (vpc *VpcV1) CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateInstanceActionWithContext is an alternate form of the CreateInstanceAction method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceActionOptions, "createInstanceActionOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createInstanceActionOptions, "createInstanceActionOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *createInstanceActionOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/actions`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createInstanceActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceAction") - 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 createInstanceActionOptions.Type != nil { - body["type"] = createInstanceActionOptions.Type - } - if createInstanceActionOptions.Force != nil { - body["force"] = createInstanceActionOptions.Force - } - _, 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_instance_action", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) - 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 -// request. The access token is only valid for a short period of time, and a maximum of one token is valid for a given -// instance at a time. -func (vpc *VpcV1) CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateInstanceConsoleAccessTokenWithContext is an alternate form of the CreateInstanceConsoleAccessToken method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Context, createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *createInstanceConsoleAccessTokenOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/console_access_token`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createInstanceConsoleAccessTokenOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceConsoleAccessToken") - 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 createInstanceConsoleAccessTokenOptions.ConsoleType != nil { - body["console_type"] = createInstanceConsoleAccessTokenOptions.ConsoleType - } - if createInstanceConsoleAccessTokenOptions.Force != nil { - body["force"] = createInstanceConsoleAccessTokenOptions.Force - } - _, 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_instance_console_access_token", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateInstanceNetworkAttachment : Create a network attachment on an instance -// This request creates a new instance network attachment from an instance network attachment prototype object. The -// prototype object is structured in the same way as a retrieved instance network attachment, and contains the -// information necessary to create the new instance network attachment. -func (vpc *VpcV1) CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateInstanceNetworkAttachmentWithContext is an alternate form of the CreateInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context, createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *createInstanceNetworkAttachmentOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createInstanceNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkAttachment") - 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 createInstanceNetworkAttachmentOptions.VirtualNetworkInterface != nil { - body["virtual_network_interface"] = createInstanceNetworkAttachmentOptions.VirtualNetworkInterface - } - if createInstanceNetworkAttachmentOptions.Name != nil { - body["name"] = createInstanceNetworkAttachmentOptions.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_instance_network_attachment", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateInstanceNetworkInterface : Create a network interface on an instance -// This request creates a new instance network interface from an instance network interface prototype object. The -// prototype object is structured in the same way as a retrieved instance network interface, and contains the -// information necessary to create the new instance network interface. Any subnet in the instance's VPC may be -// specified. Addresses on the instance network interface must be within the specified subnet's CIDR blocks. -// -// If this instance 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, and new network interfaces are not allowed to be created. -func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateInstanceNetworkInterfaceWithContext is an alternate form of the CreateInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *createInstanceNetworkInterfaceOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createInstanceNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkInterface") - 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 createInstanceNetworkInterfaceOptions.Subnet != nil { - body["subnet"] = createInstanceNetworkInterfaceOptions.Subnet - } - if createInstanceNetworkInterfaceOptions.AllowIPSpoofing != nil { - body["allow_ip_spoofing"] = createInstanceNetworkInterfaceOptions.AllowIPSpoofing - } - if createInstanceNetworkInterfaceOptions.Name != nil { - body["name"] = createInstanceNetworkInterfaceOptions.Name - } - if createInstanceNetworkInterfaceOptions.PrimaryIP != nil { - body["primary_ip"] = createInstanceNetworkInterfaceOptions.PrimaryIP - } - if createInstanceNetworkInterfaceOptions.SecurityGroups != nil { - body["security_groups"] = createInstanceNetworkInterfaceOptions.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()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - core.EnrichHTTPProblem(err, "create_instance_network_interface", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateInstanceTemplate : Create an instance template -// This request creates a new instance template. The prototype object is structured in the same way as a retrieved -// instance template, and contains the information necessary to provision a new instance from the template. -// -// If a `source_template` is specified in the prototype object, its contents are copied into the new template prior to -// copying any other properties provided in the prototype object. -func (vpc *VpcV1) CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceTemplateWithContext(context.Background(), createInstanceTemplateOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateInstanceTemplateWithContext is an alternate form of the CreateInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceTemplateOptions, "createInstanceTemplateOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createInstanceTemplateOptions, "createInstanceTemplateOptions") - 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, `/instance/templates`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createInstanceTemplateOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceTemplate") - 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(createInstanceTemplateOptions.InstanceTemplatePrototype) - 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_instance_template", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateInstanceVolumeAttachment : Create a volume attachment on an instance -// This request creates a new volume attachment from a volume attachment prototype object, connecting a volume to an -// instance. For this request to succeed, the specified volume must not be busy. The prototype object is structured in -// the same way as a retrieved volume attachment, and contains the information necessary to create the new volume -// attachment. -func (vpc *VpcV1) CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateInstanceVolumeAttachmentWithContext is an alternate form of the CreateInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *createInstanceVolumeAttachmentOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createInstanceVolumeAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceVolumeAttachment") - 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 createInstanceVolumeAttachmentOptions.Volume != nil { - body["volume"] = createInstanceVolumeAttachmentOptions.Volume - } - if createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete != nil { - body["delete_volume_on_instance_delete"] = createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete - } - if createInstanceVolumeAttachmentOptions.Name != nil { - body["name"] = createInstanceVolumeAttachmentOptions.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_instance_volume_attachment", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteInstance : Delete an instance -// This request deletes an instance. This operation cannot be reversed. Any floating IPs associated with instance -// network interfaces are implicitly disassociated. All virtual network interfaces with `auto_delete` set to `true` -// targeting instance network attachments on the instance are automatically deleted. All flow log collectors with -// `auto_delete` set to `true` targeting the instance, the instance network attachments, the instance network -// interfaces, or the automatically deleted virtual network interfaces are automatically deleted. -func (vpc *VpcV1) DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteInstanceWithContext is an alternate form of the DeleteInstance method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceOptions, "deleteInstanceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteInstanceOptions, "deleteInstanceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteInstanceOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteInstanceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstance") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - if deleteInstanceOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteInstanceOptions.IfMatch)) - } - - 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_instance", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteInstanceNetworkAttachment : Delete an instance network attachment -// This request deletes an instance network attachment. This operation cannot be reversed. Any floating IPs associated -// with the instance network attachment are implicitly disassociated. All flow log collectors with `auto_delete` set to -// `true` targeting the instance network attachment are automatically deleted. The primary instance network attachment -// is not allowed to be deleted. -func (vpc *VpcV1) DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteInstanceNetworkAttachmentWithContext is an alternate form of the DeleteInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context, deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceNetworkAttachmentOptions.InstanceID, - "id": *deleteInstanceNetworkAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") - 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_instance_network_attachment", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteInstanceNetworkInterface : Delete an instance network interface -// This request deletes an instance network interface. This operation cannot be reversed. Any floating IPs associated -// with the instance network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to -// `true` targeting the instance network interface are automatically deleted. The primary instance network interface is -// not allowed to be deleted. -// -// If this instance 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 is not allowed to be deleted. -func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceNetworkInterfaceOptions.InstanceID, - "id": *deleteInstanceNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") - 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_instance_network_interface", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteInstanceTemplate : Delete an instance template -// This request deletes the instance template. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteInstanceTemplateWithContext is an alternate form of the DeleteInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteInstanceTemplateOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteInstanceTemplateOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceTemplate") - 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_instance_template", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteInstanceVolumeAttachment : Delete a volume attachment -// This request deletes a volume attachment. This operation cannot be reversed, but a new volume attachment may -// subsequently be created for the volume. For this request to succeed, the volume must not be busy. -func (vpc *VpcV1) DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteInstanceVolumeAttachmentWithContext is an alternate form of the DeleteInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceVolumeAttachmentOptions.InstanceID, - "id": *deleteInstanceVolumeAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") - 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_instance_volume_attachment", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetInstance : Retrieve an instance -// This request retrieves a single instance specified by the identifier in the URL. -func (vpc *VpcV1) GetInstance(getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceWithContext(context.Background(), getInstanceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceWithContext is an alternate form of the GetInstance method which supports a Context parameter -func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceOptions, "getInstanceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceOptions, "getInstanceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getInstanceOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstance") - 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", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetInstanceDisk : Retrieve an instance disk -// This request retrieves a single instance disk specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceDiskWithContext is an alternate form of the GetInstanceDisk method which supports a Context parameter -func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceDiskOptions, "getInstanceDiskOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *getInstanceDiskOptions.InstanceID, - "id": *getInstanceDiskOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") - 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_disk", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetInstanceInitialization : Retrieve initialization configuration for an instance -// This request retrieves configuration used to initialize the instance, such as SSH keys and the Windows administrator -// password. These can subsequently be changed on the instance and therefore may not be current. -func (vpc *VpcV1) GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceInitializationWithContext is an alternate form of the GetInstanceInitialization method which supports a Context parameter -func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceInitializationOptions, "getInstanceInitializationOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceInitializationOptions, "getInstanceInitializationOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getInstanceInitializationOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}/initialization`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceInitializationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceInitialization") - 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_initialization", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceInitialization) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetInstanceNetworkAttachment : Retrieve an instance network attachment -// This request retrieves a single instance network attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceNetworkAttachmentWithContext is an alternate form of the GetInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkAttachmentOptions.InstanceID, - "id": *getInstanceNetworkAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") - 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_network_attachment", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetInstanceNetworkInterface : Retrieve an instance network interface -// This request retrieves a single instance network interface specified by the identifier in the URL. -// -// If this instance has network attachments, the retrieved 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. -func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceOptions.InstanceID, - "id": *getInstanceNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") - 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_network_interface", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP address if it is associated with the instance network interface and -// instance specified in the URL. -func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the GetInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceFloatingIPOptions.InstanceID, - "network_interface_id": *getInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *getInstanceNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") - 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_network_interface_floating_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetInstanceNetworkInterfaceIP : Retrieve the primary reserved IP -// This request retrieves the primary reserved IP for an instance network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceIP") - err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceIPOptions.InstanceID, - "network_interface_id": *getInstanceNetworkInterfaceIPOptions.NetworkInterfaceID, - "id": *getInstanceNetworkInterfaceIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceIP") - 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_network_interface_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetInstanceProfile : Retrieve an instance profile -// This request retrieves a single instance profile specified by the name in the URL. -func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceProfileWithContext is an alternate form of the GetInstanceProfile method which supports a Context parameter -func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceProfileOptions, "getInstanceProfileOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "name": *getInstanceProfileOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles/{name}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") - 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_profile", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfile) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetInstanceTemplate : Retrieve an instance template -// This request retrieves a single instance template specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceTemplateWithContext is an alternate form of the GetInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceTemplateOptions, "getInstanceTemplateOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getInstanceTemplateOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceTemplateOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") - 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_template", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetInstanceVolumeAttachment : Retrieve a volume attachment -// This request retrieves a single volume attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceVolumeAttachmentWithContext is an alternate form of the GetInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *getInstanceVolumeAttachmentOptions.InstanceID, - "id": *getInstanceVolumeAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceVolumeAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") - 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_volume_attachment", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstanceDisks : List all disks on an instance -// This request lists all disks on an instance. A disk is a block device that is locally attached to the instance's -// physical host and is also referred to as instance storage. By default, the listed disks are sorted by their -// `created_at` property values, with the newest disk first. -func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListInstanceDisksWithContext is an alternate form of the ListInstanceDisks method which supports a Context parameter -func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceDisksOptions, "listInstanceDisksOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *listInstanceDisksOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listInstanceDisksOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceDisks") - 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, "list_instance_disks", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstanceNetworkAttachments : List all network attachments on an instance -// This request lists all network attachments on an instance. A network attachment represents a device on the instance -// to which a virtual network interface is attached. -// -// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. -// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property -// values. -func (vpc *VpcV1) ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListInstanceNetworkAttachmentsWithContext is an alternate form of the ListInstanceNetworkAttachments method which supports a Context parameter -func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkAttachmentsOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listInstanceNetworkAttachmentsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") - 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, "list_instance_network_attachments", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachmentCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with an instance network interface -// This request lists all floating IPs associated with an instance network interface. -func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfaceFloatingIpsOptions.InstanceID, - "network_interface_id": *listInstanceNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listInstanceNetworkInterfaceFloatingIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") - 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, "list_instance_network_interface_floating_ips", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstanceNetworkInterfaceIps : List the primary reserved IP for an instance network interface -// This request lists the primary reserved IP for an instance network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceIps") - err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfaceIpsOptions.InstanceID, - "network_interface_id": *listInstanceNetworkInterfaceIpsOptions.NetworkInterfaceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listInstanceNetworkInterfaceIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceIps") - 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 listInstanceNetworkInterfaceIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Start)) - } - if listInstanceNetworkInterfaceIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.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_network_interface_ips", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstanceNetworkInterfaces : List all network interfaces on an instance -// This request lists all network interfaces on an instance. An instance network interface is an abstract representation -// of a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to -// any subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on -// the instance may also attach to the same subnet. -// -// If this instance has network attachments, each returned 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. -func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListInstanceNetworkInterfacesWithContext is an alternate form of the ListInstanceNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfacesOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listInstanceNetworkInterfacesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") - 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, "list_instance_network_interfaces", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceUnpaginatedCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstanceProfiles : List all instance profiles -// This request lists provisionable [instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the -// region. An instance profile specifies the performance characteristics and pricing model for an instance. -func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListInstanceProfilesWithContext is an alternate form of the ListInstanceProfiles method which supports a Context parameter -func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstanceProfilesOptions, "listInstanceProfilesOptions") - 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, `/instance/profiles`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listInstanceProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceProfiles") - 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, "list_instance_profiles", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfileCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstanceTemplates : List all instance templates -// This request lists all instance templates in the region. -func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListInstanceTemplatesWithContext is an alternate form of the ListInstanceTemplates method which supports a Context parameter -func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstanceTemplatesOptions, "listInstanceTemplatesOptions") - 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, `/instance/templates`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listInstanceTemplatesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") - 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, "list_instance_templates", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplateCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstanceVolumeAttachments : List all volumes attachments on an instance -// This request lists all volume attachments on an instance. A volume attachment connects a volume to an instance. Each -// instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one -// volume. -func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListInstanceVolumeAttachmentsWithContext is an alternate form of the ListInstanceVolumeAttachments method which supports a Context parameter -func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *listInstanceVolumeAttachmentsOptions.InstanceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") - 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, "list_instance_volume_attachments", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachmentCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstances : List all instances -// This request lists all instances in the region. -func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListInstancesWithContext is an alternate form of the ListInstances method which supports a Context parameter -func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstancesOptions, "listInstancesOptions") - 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, `/instances`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listInstancesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") - 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 listInstancesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) - } - if listInstancesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstancesOptions.Limit)) - } - if listInstancesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listInstancesOptions.ResourceGroupID)) - } - if listInstancesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) - } - if listInstancesOptions.DedicatedHostID != nil { - builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) - } - if listInstancesOptions.DedicatedHostCRN != nil { - builder.AddQuery("dedicated_host.crn", fmt.Sprint(*listInstancesOptions.DedicatedHostCRN)) - } - if listInstancesOptions.DedicatedHostName != nil { - builder.AddQuery("dedicated_host.name", fmt.Sprint(*listInstancesOptions.DedicatedHostName)) - } - if listInstancesOptions.PlacementGroupID != nil { - builder.AddQuery("placement_group.id", fmt.Sprint(*listInstancesOptions.PlacementGroupID)) - } - if listInstancesOptions.PlacementGroupCRN != nil { - builder.AddQuery("placement_group.crn", fmt.Sprint(*listInstancesOptions.PlacementGroupCRN)) - } - if listInstancesOptions.PlacementGroupName != nil { - builder.AddQuery("placement_group.name", fmt.Sprint(*listInstancesOptions.PlacementGroupName)) - } - if listInstancesOptions.ReservationID != nil { - builder.AddQuery("reservation.id", fmt.Sprint(*listInstancesOptions.ReservationID)) - } - if listInstancesOptions.ReservationCRN != nil { - builder.AddQuery("reservation.crn", fmt.Sprint(*listInstancesOptions.ReservationCRN)) - } - if listInstancesOptions.ReservationName != nil { - builder.AddQuery("reservation.name", fmt.Sprint(*listInstancesOptions.ReservationName)) - } - if listInstancesOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) - } - if listInstancesOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) - } - if listInstancesOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) - } - - 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_instances", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from an instance network interface -// This request disassociates the specified floating IP from the specified instance network interface. -func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// RemoveInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *removeInstanceNetworkInterfaceFloatingIPOptions.InstanceID, - "network_interface_id": *removeInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *removeInstanceNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range removeInstanceNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveInstanceNetworkInterfaceFloatingIP") - 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, "remove_instance_network_interface_floating_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// UpdateInstance : Update an instance -// This request updates an instance with the information in a provided instance patch. The instance patch object is -// structured in the same way as a retrieved instance and contains only the information to be updated. -func (vpc *VpcV1) UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateInstanceWithContext is an alternate form of the UpdateInstance method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceOptions, "updateInstanceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateInstanceOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateInstanceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateInstanceOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateInstanceOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) - 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", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateInstanceDisk : Update an instance disk -// This request updates the instance disk with the information in a provided patch. -func (vpc *VpcV1) UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateInstanceDiskWithContext is an alternate form of the UpdateInstanceDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceDiskOptions, "updateInstanceDiskOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *updateInstanceDiskOptions.InstanceID, - "id": *updateInstanceDiskOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateInstanceDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceDisk") - 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(updateInstanceDiskOptions.InstanceDiskPatch) - 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_disk", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateInstanceNetworkAttachment : Update an instance network attachment -// This request updates an instance network attachment with the information provided in an instance network interface -// patch object. The instance network attachment patch object is structured in the same way as a retrieved instance -// network attachment and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateInstanceNetworkAttachmentWithContext is an alternate form of the UpdateInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context, updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *updateInstanceNetworkAttachmentOptions.InstanceID, - "id": *updateInstanceNetworkAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkAttachment") - 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(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) - 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_network_attachment", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateInstanceNetworkInterface : Update an instance network interface -// This request updates an instance network interface with the information provided in an instance network interface -// patch object. The instance network interface patch object is structured in the same way as a retrieved instance -// network interface and needs to contain only the information to be updated. -// -// If this instance 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 is not allowed to be updated. -func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateInstanceNetworkInterfaceWithContext is an alternate form of the UpdateInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *updateInstanceNetworkInterfaceOptions.InstanceID, - "id": *updateInstanceNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateInstanceNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkInterface") - 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(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) - 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_network_interface", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateInstanceTemplate : Update an instance template -// This request updates an instance template with the information provided in the instance template patch. The instance -// template patch object is structured in the same way as a retrieved instance template and contains only the -// information to be updated. -func (vpc *VpcV1) UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateInstanceTemplateWithContext is an alternate form of the UpdateInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceTemplateOptions, "updateInstanceTemplateOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateInstanceTemplateOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateInstanceTemplateOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceTemplate") - 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(updateInstanceTemplateOptions.InstanceTemplatePatch) - 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_template", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateInstanceVolumeAttachment : Update a volume attachment -// This request updates a volume attachment with the information provided in a volume attachment patch object. The -// volume attachment patch object is structured in the same way as a retrieved volume attachment and needs to contain -// only the information to be updated. -func (vpc *VpcV1) UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateInstanceVolumeAttachmentWithContext is an alternate form of the UpdateInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_id": *updateInstanceVolumeAttachmentOptions.InstanceID, - "id": *updateInstanceVolumeAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateInstanceVolumeAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceVolumeAttachment") - 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(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) - 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_volume_attachment", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateInstanceGroup : Create an instance group -// This request creates a new instance group. -func (vpc *VpcV1) CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceGroupWithContext(context.Background(), createInstanceGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateInstanceGroupWithContext is an alternate form of the CreateInstanceGroup method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceGroupOptions, "createInstanceGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createInstanceGroupOptions, "createInstanceGroupOptions") - 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, `/instance_groups`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createInstanceGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroup") - 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 createInstanceGroupOptions.InstanceTemplate != nil { - body["instance_template"] = createInstanceGroupOptions.InstanceTemplate - } - if createInstanceGroupOptions.Subnets != nil { - body["subnets"] = createInstanceGroupOptions.Subnets - } - if createInstanceGroupOptions.ApplicationPort != nil { - body["application_port"] = createInstanceGroupOptions.ApplicationPort - } - if createInstanceGroupOptions.LoadBalancer != nil { - body["load_balancer"] = createInstanceGroupOptions.LoadBalancer - } - if createInstanceGroupOptions.LoadBalancerPool != nil { - body["load_balancer_pool"] = createInstanceGroupOptions.LoadBalancerPool - } - if createInstanceGroupOptions.MembershipCount != nil { - body["membership_count"] = createInstanceGroupOptions.MembershipCount - } - if createInstanceGroupOptions.Name != nil { - body["name"] = createInstanceGroupOptions.Name - } - if createInstanceGroupOptions.ResourceGroup != nil { - body["resource_group"] = createInstanceGroupOptions.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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - core.EnrichHTTPProblem(err, "create_instance_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateInstanceGroupManager : Create a manager for an instance group -// This request creates a new instance group manager. -func (vpc *VpcV1) CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateInstanceGroupManagerWithContext is an alternate form of the CreateInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerOptions.InstanceGroupID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createInstanceGroupManagerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManager") - 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(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) - 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_instance_group_manager", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateInstanceGroupManagerAction : Create an instance group manager action -// This request creates a new instance group manager action. -func (vpc *VpcV1) CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateInstanceGroupManagerActionWithContext is an alternate form of the CreateInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Context, createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *createInstanceGroupManagerActionOptions.InstanceGroupManagerID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createInstanceGroupManagerActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerAction") - 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(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) - 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_instance_group_manager_action", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateInstanceGroupManagerPolicy : Create a policy for an instance group manager -// This request creates a new instance group manager policy. -func (vpc *VpcV1) CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateInstanceGroupManagerPolicyWithContext is an alternate form of the CreateInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Context, createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createInstanceGroupManagerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") - 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(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) - 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_instance_group_manager_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteInstanceGroup : Delete an instance group -// This request deletes an instance group. This operation cannot be reversed. Any instances associated with the group -// will be deleted. -func (vpc *VpcV1) DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupWithContext(context.Background(), deleteInstanceGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteInstanceGroupWithContext is an alternate form of the DeleteInstanceGroup method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupOptions, "deleteInstanceGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteInstanceGroupOptions, "deleteInstanceGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteInstanceGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteInstanceGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroup") - 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_instance_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteInstanceGroupLoadBalancer : Delete an instance group load balancer -// This request unbinds the instance group from the load balancer pool, and deletes the load balancer pool members. -func (vpc *VpcV1) DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteInstanceGroupLoadBalancerWithContext is an alternate form of the DeleteInstanceGroupLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context, deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupLoadBalancerOptions.InstanceGroupID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/load_balancer`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteInstanceGroupLoadBalancerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") - 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_instance_group_load_balancer", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteInstanceGroupManager : Delete an instance group manager -// This request deletes an instance group manager. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteInstanceGroupManagerWithContext is an alternate form of the DeleteInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerOptions.InstanceGroupID, - "id": *deleteInstanceGroupManagerOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteInstanceGroupManagerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") - 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_instance_group_manager", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteInstanceGroupManagerAction : Delete specified instance group manager action -// This request deletes an instance group manager action. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteInstanceGroupManagerActionWithContext is an alternate form of the DeleteInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Context, deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *deleteInstanceGroupManagerActionOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteInstanceGroupManagerActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerAction") - 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_instance_group_manager_action", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteInstanceGroupManagerPolicy : Delete an instance group manager policy -// This request deletes an instance group manager policy. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteInstanceGroupManagerPolicyWithContext is an alternate form of the DeleteInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Context, deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *deleteInstanceGroupManagerPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteInstanceGroupManagerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") - 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_instance_group_manager_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteInstanceGroupMembership : Delete an instance group membership -// This request deletes a memberships of an instance group. This operation cannot be reversed. reversed. If the -// membership has `delete_instance_on_membership_delete` set to `true`, the instance will also be deleted. -func (vpc *VpcV1) DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteInstanceGroupMembershipWithContext is an alternate form of the DeleteInstanceGroupMembership method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupMembershipOptions.InstanceGroupID, - "id": *deleteInstanceGroupMembershipOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteInstanceGroupMembershipOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") - 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_instance_group_membership", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteInstanceGroupMemberships : Delete all memberships from an instance group -// This request deletes all memberships of an instance group. This operation cannot be reversed. reversed. Any -// memberships that have `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. -func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteInstanceGroupMembershipsWithContext is an alternate form of the DeleteInstanceGroupMemberships method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupMembershipsOptions.InstanceGroupID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteInstanceGroupMembershipsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") - 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_instance_group_memberships", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetInstanceGroup : Retrieve an instance group -// This request retrieves a single instance group specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceGroupWithContext is an alternate form of the GetInstanceGroup method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupOptions, "getInstanceGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceGroupOptions, "getInstanceGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getInstanceGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") - 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_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetInstanceGroupManager : Retrieve an instance group manager -// This request retrieves a single instance group manager specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceGroupManagerWithContext is an alternate form of the GetInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupManagerOptions.InstanceGroupID, - "id": *getInstanceGroupManagerOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceGroupManagerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") - 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_group_manager", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetInstanceGroupManagerAction : Retrieve specified instance group manager action -// This request retrieves a single instance group manager action specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupManagerAction(getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceGroupManagerActionWithContext(context.Background(), getInstanceGroupManagerActionOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceGroupManagerActionWithContext is an alternate form of the GetInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, getInstanceGroupManagerActionOptions *GetInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceGroupManagerActionOptions, "getInstanceGroupManagerActionOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *getInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *getInstanceGroupManagerActionOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceGroupManagerActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerAction") - 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_group_manager_action", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetInstanceGroupManagerPolicy : Retrieve an instance group manager policy -// This request retrieves a single instance group manager policy specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceGroupManagerPolicyWithContext is an alternate form of the GetInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *getInstanceGroupManagerPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceGroupManagerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") - 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_group_manager_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetInstanceGroupMembership : Retrieve an instance group membership -// This request retrieves a single instance group membership specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetInstanceGroupMembershipWithContext is an alternate form of the GetInstanceGroupMembership method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupMembershipOptions.InstanceGroupID, - "id": *getInstanceGroupMembershipOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getInstanceGroupMembershipOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") - 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_group_membership", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstanceGroupManagerActions : List all actions for an instance group manager -// This request lists all instance group actions for an instance group manager. -func (vpc *VpcV1) ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListInstanceGroupManagerActionsWithContext is an alternate form of the ListInstanceGroupManagerActions method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context, listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupManagerActionsOptions.InstanceGroupID, - "instance_group_manager_id": *listInstanceGroupManagerActionsOptions.InstanceGroupManagerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listInstanceGroupManagerActionsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerActions") - 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 listInstanceGroupManagerActionsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) - } - if listInstanceGroupManagerActionsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerActionsOptions.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_group_manager_actions", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerActionsCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstanceGroupManagerPolicies : List all policies for an instance group manager -// This request lists all policies for an instance group manager. -func (vpc *VpcV1) ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListInstanceGroupManagerPoliciesWithContext is an alternate form of the ListInstanceGroupManagerPolicies method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Context, listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupID, - "instance_group_manager_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupManagerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listInstanceGroupManagerPoliciesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerPolicies") - 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 listInstanceGroupManagerPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Start)) - } - if listInstanceGroupManagerPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.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_group_manager_policies", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicyCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstanceGroupManagers : List all managers for an instance group -// This request lists all managers for an instance group. -func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListInstanceGroupManagersWithContext is an alternate form of the ListInstanceGroupManagers method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupManagersOptions.InstanceGroupID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listInstanceGroupManagersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") - 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 listInstanceGroupManagersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) - } - if listInstanceGroupManagersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagersOptions.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_group_managers", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstanceGroupMemberships : List all memberships for an instance group -// This request lists all instance group memberships for an instance group. -func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListInstanceGroupMembershipsWithContext is an alternate form of the ListInstanceGroupMemberships method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupMembershipsOptions.InstanceGroupID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listInstanceGroupMembershipsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupMemberships") - 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 listInstanceGroupMembershipsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) - } - if listInstanceGroupMembershipsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupMembershipsOptions.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_group_memberships", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembershipCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstanceGroups : List all instance groups -// This request lists all instance groups in the region. -func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListInstanceGroupsWithContext is an alternate form of the ListInstanceGroups method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstanceGroupsOptions, "listInstanceGroupsOptions") - 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, `/instance_groups`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listInstanceGroupsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") - 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 listInstanceGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) - } - if listInstanceGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupsOptions.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_groups", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateInstanceGroup : Update an instance group -// This request updates an instance group with the information provided instance group patch. The instance group patch -// object is structured in the same way as a retrieved instance group and contains only the information to be updated. -func (vpc *VpcV1) UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateInstanceGroupWithContext is an alternate form of the UpdateInstanceGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupOptions, "updateInstanceGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateInstanceGroupOptions, "updateInstanceGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateInstanceGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateInstanceGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") - 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(updateInstanceGroupOptions.InstanceGroupPatch) - 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_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateInstanceGroupManager : Update an instance group manager -// This request updates an instance group manager with the information provided instance group manager patch. -func (vpc *VpcV1) UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateInstanceGroupManagerWithContext is an alternate form of the UpdateInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerOptions.InstanceGroupID, - "id": *updateInstanceGroupManagerOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateInstanceGroupManagerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManager") - 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(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) - 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_group_manager", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateInstanceGroupManagerAction : Update specified instance group manager action -// This request updates an instance group manager action. -func (vpc *VpcV1) UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateInstanceGroupManagerActionWithContext is an alternate form of the UpdateInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Context, updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *updateInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *updateInstanceGroupManagerActionOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateInstanceGroupManagerActionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerAction") - 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(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) - 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_group_manager_action", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateInstanceGroupManagerPolicy : Update an instance group manager policy -// This request updates an instance group manager policy. -func (vpc *VpcV1) UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateInstanceGroupManagerPolicyWithContext is an alternate form of the UpdateInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Context, updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *updateInstanceGroupManagerPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerPolicy") - 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(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) - 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_group_manager_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateInstanceGroupMembership : Update an instance group membership -// This request updates an instance group membership with the information provided instance group membership patch. -func (vpc *VpcV1) UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceGroupMembershipWithContext(context.Background(), updateInstanceGroupMembershipOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateInstanceGroupMembershipWithContext is an alternate form of the UpdateInstanceGroupMembership method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupMembershipOptions.InstanceGroupID, - "id": *updateInstanceGroupMembershipOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateInstanceGroupMembershipOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupMembership") - 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(updateInstanceGroupMembershipOptions.InstanceGroupMembershipPatch) - 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_group_membership", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ActivateReservation : Activate a reservation -// This request activates a reservation. For this request to succeed, the reservation status must be `inactive`. -func (vpc *VpcV1) ActivateReservation(activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.ActivateReservationWithContext(context.Background(), activateReservationOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ActivateReservationWithContext is an alternate form of the ActivateReservation method which supports a Context parameter -func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(activateReservationOptions, "activateReservationOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(activateReservationOptions, "activateReservationOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *activateReservationOptions.ID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}/activate`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range activateReservationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ActivateReservation") - 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, "activate_reservation", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// CreateReservation : Create a reservation -// This request creates a new reservation from a reservation prototype object. The prototype object is structured in the -// same way as a retrieved reservation, and contains the information necessary to create the new reservation. -func (vpc *VpcV1) CreateReservation(createReservationOptions *CreateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateReservationWithContext(context.Background(), createReservationOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateReservationWithContext is an alternate form of the CreateReservation method which supports a Context parameter -func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReservationOptions *CreateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createReservationOptions, "createReservationOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createReservationOptions, "createReservationOptions") - 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, `/reservations`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createReservationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateReservation") - 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 createReservationOptions.Capacity != nil { - body["capacity"] = createReservationOptions.Capacity - } - if createReservationOptions.CommittedUse != nil { - body["committed_use"] = createReservationOptions.CommittedUse - } - if createReservationOptions.Profile != nil { - body["profile"] = createReservationOptions.Profile - } - if createReservationOptions.Zone != nil { - body["zone"] = createReservationOptions.Zone - } - if createReservationOptions.AffinityPolicy != nil { - body["affinity_policy"] = createReservationOptions.AffinityPolicy - } - if createReservationOptions.Name != nil { - body["name"] = createReservationOptions.Name - } - if createReservationOptions.ResourceGroup != nil { - body["resource_group"] = createReservationOptions.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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - core.EnrichHTTPProblem(err, "create_reservation", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteReservation : Delete a reservation -// This request deletes a reservation. This operation cannot be reversed. Reservations with a `status` of `active` are -// not allowed to be deleted. -func (vpc *VpcV1) DeleteReservation(deleteReservationOptions *DeleteReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteReservationWithContext(context.Background(), deleteReservationOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteReservationWithContext is an alternate form of the DeleteReservation method which supports a Context parameter -func (vpc *VpcV1) DeleteReservationWithContext(ctx context.Context, deleteReservationOptions *DeleteReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteReservationOptions, "deleteReservationOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteReservationOptions, "deleteReservationOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteReservationOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteReservationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteReservation") - 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_reservation", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetReservation : Retrieve a reservation -// This request retrieves a single reservation specified by identifier in the URL. -func (vpc *VpcV1) GetReservation(getReservationOptions *GetReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetReservationWithContext(context.Background(), getReservationOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetReservationWithContext is an alternate form of the GetReservation method which supports a Context parameter -func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationOptions *GetReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getReservationOptions, "getReservationOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getReservationOptions, "getReservationOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getReservationOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getReservationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetReservation") - 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_reservation", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListReservations : List all reservations -// This request lists all reservations in the region. A reservation provides reserved capacity for a specified profile -// in a specified zone. A reservation can also include a long-term committed use discount. -// -// The reservations will be sorted by their `created_at` property values, with newest reservations first. Reservations -// with identical `created_at` property values will in turn be sorted by ascending `name` property values. -func (vpc *VpcV1) ListReservations(listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListReservationsWithContext(context.Background(), listReservationsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListReservationsWithContext is an alternate form of the ListReservations method which supports a Context parameter -func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listReservationsOptions, "listReservationsOptions") - 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, `/reservations`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listReservationsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListReservations") - 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 listReservationsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listReservationsOptions.Start)) - } - if listReservationsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listReservationsOptions.Limit)) - } - if listReservationsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listReservationsOptions.Name)) - } - if listReservationsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listReservationsOptions.ResourceGroupID)) - } - if listReservationsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listReservationsOptions.ZoneName)) - } - - 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_reservations", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservationCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateReservation : Update a reservation -// This request updates a reservation with the information provided in a reservation patch object. The patch object is -// structured in the same way as a retrieved reservation and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateReservation(updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateReservationWithContext(context.Background(), updateReservationOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateReservationWithContext is an alternate form of the UpdateReservation method which supports a Context parameter -func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateReservationOptions, "updateReservationOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateReservationOptions, "updateReservationOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateReservationOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateReservationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateReservation") - 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(updateReservationOptions.ReservationPatch) - 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_reservation", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateDedicatedHost : Create a dedicated host -// This request creates a new dedicated host. -func (vpc *VpcV1) CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateDedicatedHostWithContext is an alternate form of the CreateDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createDedicatedHostOptions, "createDedicatedHostOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") - 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, `/dedicated_hosts`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createDedicatedHostOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") - 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(createDedicatedHostOptions.DedicatedHostPrototype) - 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_dedicated_host", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateDedicatedHostGroup : Create a dedicated host group -// This request creates a new dedicated host group. -func (vpc *VpcV1) CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateDedicatedHostGroupWithContext(context.Background(), createDedicatedHostGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateDedicatedHostGroupWithContext is an alternate form of the CreateDedicatedHostGroup method which supports a Context parameter -func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions") - 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, `/dedicated_host/groups`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createDedicatedHostGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHostGroup") - 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 createDedicatedHostGroupOptions.Class != nil { - body["class"] = createDedicatedHostGroupOptions.Class - } - if createDedicatedHostGroupOptions.Family != nil { - body["family"] = createDedicatedHostGroupOptions.Family - } - if createDedicatedHostGroupOptions.Zone != nil { - body["zone"] = createDedicatedHostGroupOptions.Zone - } - if createDedicatedHostGroupOptions.Name != nil { - body["name"] = createDedicatedHostGroupOptions.Name - } - if createDedicatedHostGroupOptions.ResourceGroup != nil { - body["resource_group"] = createDedicatedHostGroupOptions.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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - core.EnrichHTTPProblem(err, "create_dedicated_host_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteDedicatedHost : Delete a dedicated host -// This request deletes a dedicated host. -func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteDedicatedHostWithContext is an alternate form of the DeleteDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteDedicatedHostOptions, "deleteDedicatedHostOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteDedicatedHostOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteDedicatedHostOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") - 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_dedicated_host", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteDedicatedHostGroup : Delete a dedicated host group -// This request deletes a dedicated host group. -func (vpc *VpcV1) DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteDedicatedHostGroupWithContext(context.Background(), deleteDedicatedHostGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteDedicatedHostGroupWithContext is an alternate form of the DeleteDedicatedHostGroup method which supports a Context parameter -func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteDedicatedHostGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteDedicatedHostGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHostGroup") - 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_dedicated_host_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetDedicatedHost : Retrieve a dedicated host -// This request retrieves a single dedicated host specified by the identifiers in the URL. -func (vpc *VpcV1) GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetDedicatedHostWithContext is an alternate form of the GetDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostOptions, "getDedicatedHostOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getDedicatedHostOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getDedicatedHostOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") - 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_dedicated_host", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetDedicatedHostDisk : Retrieve a dedicated host disk -// This request retrieves a single dedicated host disk specified by the identifier in the URL. -func (vpc *VpcV1) GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetDedicatedHostDiskWithContext is an alternate form of the GetDedicatedHostDisk method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "dedicated_host_id": *getDedicatedHostDiskOptions.DedicatedHostID, - "id": *getDedicatedHostDiskOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") - 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_dedicated_host_disk", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetDedicatedHostGroup : Retrieve a dedicated host group -// This request retrieves a single dedicated host group specified by the identifier in the URL. -func (vpc *VpcV1) GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetDedicatedHostGroupWithContext is an alternate form of the GetDedicatedHostGroup method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getDedicatedHostGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getDedicatedHostGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") - 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_dedicated_host_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetDedicatedHostProfile : Retrieve a dedicated host profile -// This request retrieves a single dedicated host profile specified by the name in the URL. -func (vpc *VpcV1) GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetDedicatedHostProfileWithContext(context.Background(), getDedicatedHostProfileOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetDedicatedHostProfileWithContext is an alternate form of the GetDedicatedHostProfile method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "name": *getDedicatedHostProfileOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles/{name}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getDedicatedHostProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostProfile") - 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_dedicated_host_profile", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfile) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListDedicatedHostDisks : List all disks on a dedicated host -// This request lists all disks on a dedicated host. A disk is a physical device that is locally attached to the -// compute node. By default, the listed disks are sorted by their -// `created_at` property values, with the newest disk first. -func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListDedicatedHostDisksWithContext is an alternate form of the ListDedicatedHostDisks method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "dedicated_host_id": *listDedicatedHostDisksOptions.DedicatedHostID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") - 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, "list_dedicated_host_disks", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDiskCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListDedicatedHostGroups : List all dedicated host groups -// This request lists all dedicated host groups in the region. Host groups are a collection of dedicated hosts for -// placement of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. -func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListDedicatedHostGroupsWithContext is an alternate form of the ListDedicatedHostGroups method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostGroupsOptions, "listDedicatedHostGroupsOptions") - 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, `/dedicated_host/groups`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") - 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 listDedicatedHostGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) - } - if listDedicatedHostGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostGroupsOptions.Limit)) - } - if listDedicatedHostGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostGroupsOptions.ResourceGroupID)) - } - if listDedicatedHostGroupsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostGroupsOptions.ZoneName)) - } - if listDedicatedHostGroupsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listDedicatedHostGroupsOptions.Name)) - } - - 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_dedicated_host_groups", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroupCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListDedicatedHostProfiles : List all dedicated host profiles -// This request lists provisionable [dedicated host profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in -// the region. A dedicated host profile specifies the hardware characteristics for a dedicated host. -func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListDedicatedHostProfilesWithContext is an alternate form of the ListDedicatedHostProfiles method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostProfilesOptions, "listDedicatedHostProfilesOptions") - 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, `/dedicated_host/profiles`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") - 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 listDedicatedHostProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) - } - if listDedicatedHostProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostProfilesOptions.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_dedicated_host_profiles", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfileCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListDedicatedHosts : List all dedicated hosts -// This request lists all dedicated hosts in the region. -func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListDedicatedHostsWithContext is an alternate form of the ListDedicatedHosts method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostsOptions, "listDedicatedHostsOptions") - 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, `/dedicated_hosts`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listDedicatedHostsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") - 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 listDedicatedHostsOptions.DedicatedHostGroupID != nil { - builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) - } - if listDedicatedHostsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostsOptions.Start)) - } - if listDedicatedHostsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostsOptions.Limit)) - } - if listDedicatedHostsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostsOptions.ResourceGroupID)) - } - if listDedicatedHostsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostsOptions.ZoneName)) - } - if listDedicatedHostsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listDedicatedHostsOptions.Name)) - } - - 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_dedicated_hosts", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateDedicatedHost : Update a dedicated host -// This request updates a dedicated host with the information in a provided dedicated host patch. The dedicated host -// patch object is structured in the same way as a retrieved dedicated host and contains only the information to be -// updated. -func (vpc *VpcV1) UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateDedicatedHostWithContext is an alternate form of the UpdateDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostOptions, "updateDedicatedHostOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateDedicatedHostOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateDedicatedHostOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") - 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(updateDedicatedHostOptions.DedicatedHostPatch) - 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_dedicated_host", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateDedicatedHostDisk : Update a dedicated host disk -// This request updates the dedicated host disk with the information in a provided patch. -func (vpc *VpcV1) UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateDedicatedHostDiskWithContext is an alternate form of the UpdateDedicatedHostDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "dedicated_host_id": *updateDedicatedHostDiskOptions.DedicatedHostID, - "id": *updateDedicatedHostDiskOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") - 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(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) - 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_dedicated_host_disk", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateDedicatedHostGroup : Update a dedicated host group -// This request updates a dedicated host group with the information in a provided dedicated host group patch. The -// dedicated host group patch object is structured in the same way as a retrieved dedicated host group and contains only -// the information to be updated. -func (vpc *VpcV1) UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateDedicatedHostGroupWithContext is an alternate form of the UpdateDedicatedHostGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateDedicatedHostGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") - 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(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) - 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_dedicated_host_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreatePlacementGroup : Create a placement group -// This request creates a new placement group. -func (vpc *VpcV1) CreatePlacementGroup(createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreatePlacementGroupWithContext(context.Background(), createPlacementGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreatePlacementGroupWithContext is an alternate form of the CreatePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPlacementGroupOptions *CreatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createPlacementGroupOptions, "createPlacementGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createPlacementGroupOptions, "createPlacementGroupOptions") - 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, `/placement_groups`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createPlacementGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePlacementGroup") - 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 createPlacementGroupOptions.Strategy != nil { - body["strategy"] = createPlacementGroupOptions.Strategy - } - if createPlacementGroupOptions.Name != nil { - body["name"] = createPlacementGroupOptions.Name - } - if createPlacementGroupOptions.ResourceGroup != nil { - body["resource_group"] = createPlacementGroupOptions.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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - core.EnrichHTTPProblem(err, "create_placement_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeletePlacementGroup : Delete a placement group -// This request deletes a placement group. This operation cannot be reversed. For this request to succeed, the placement -// group must not be associated with an instance. -func (vpc *VpcV1) DeletePlacementGroup(deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeletePlacementGroupWithContext(context.Background(), deletePlacementGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeletePlacementGroupWithContext is an alternate form of the DeletePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePlacementGroupOptions *DeletePlacementGroupOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deletePlacementGroupOptions, "deletePlacementGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deletePlacementGroupOptions, "deletePlacementGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deletePlacementGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deletePlacementGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePlacementGroup") - 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_placement_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetPlacementGroup : Retrieve a placement group -// This request retrieves a single placement group specified by identifier in the URL. -func (vpc *VpcV1) GetPlacementGroup(getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetPlacementGroupWithContext(context.Background(), getPlacementGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetPlacementGroupWithContext is an alternate form of the GetPlacementGroup method which supports a Context parameter -func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacementGroupOptions *GetPlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPlacementGroupOptions, "getPlacementGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getPlacementGroupOptions, "getPlacementGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getPlacementGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getPlacementGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPlacementGroup") - 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_placement_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListPlacementGroups : List all placement groups -// This request lists all placement groups in the region. -func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter -func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") - 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, `/placement_groups`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listPlacementGroupsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") - 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 listPlacementGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) - } - if listPlacementGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.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_placement_groups", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdatePlacementGroup : Update a placement group -// This request updates a placement group with the information provided placement group patch. The placement group patch -// object is structured in the same way as a retrieved placement group and contains only the information to be updated. -func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updatePlacementGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updatePlacementGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") - 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(updatePlacementGroupOptions.PlacementGroupPatch) - 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_placement_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface -// This request associates the specified floating IP with the specified bare metal server network interface. If -// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` -// is `true`, this replaces any existing association. -// -// The existing floating IP must: -// - not be required by another resource, such as a public gateway -// - be in the same `zone` as the bare metal server -// -// A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") - 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, "add_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateBareMetalServer : Create a bare metal server -// This request provisions a new bare metal server from a prototype object. The prototype object is structured in the -// same way as a retrieved bare metal server, and contains the information necessary to provision the new bare metal -// server. The bare metal server is automatically started. -func (vpc *VpcV1) CreateBareMetalServer(createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateBareMetalServerWithContext(context.Background(), createBareMetalServerOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateBareMetalServerWithContext is an alternate form of the CreateBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBareMetalServerOptions *CreateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerOptions, "createBareMetalServerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createBareMetalServerOptions, "createBareMetalServerOptions") - 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, `/bare_metal_servers`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServer") - 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(createBareMetalServerOptions.BareMetalServerPrototype) - 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_bare_metal_server", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateBareMetalServerConsoleAccessToken : Create a console access token for a bare metal server -// This request creates a new single-use console access token for a bare metal server. All console configuration is -// provided at token create time, and the token is subsequently used in the `access_token` query parameter for the -// WebSocket request. The access token is only valid for a short period of time, and a maximum of one token is valid -// for a given bare metal server at a time. -func (vpc *VpcV1) CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateBareMetalServerConsoleAccessTokenWithContext(context.Background(), createBareMetalServerConsoleAccessTokenOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateBareMetalServerConsoleAccessTokenWithContext is an alternate form of the CreateBareMetalServerConsoleAccessToken method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context.Context, createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createBareMetalServerConsoleAccessTokenOptions, "createBareMetalServerConsoleAccessTokenOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerConsoleAccessTokenOptions.BareMetalServerID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/console_access_token`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createBareMetalServerConsoleAccessTokenOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerConsoleAccessToken") - 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 createBareMetalServerConsoleAccessTokenOptions.ConsoleType != nil { - body["console_type"] = createBareMetalServerConsoleAccessTokenOptions.ConsoleType - } - if createBareMetalServerConsoleAccessTokenOptions.Force != nil { - body["force"] = createBareMetalServerConsoleAccessTokenOptions.Force - } - _, 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_bare_metal_server_console_access_token", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerConsoleAccessToken) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server -// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype -// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and -// contains the information necessary to create the new bare metal server network attachment. -func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") - 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(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) - 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_bare_metal_server_network_attachment", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server -// This request creates a new bare metal server network interface from a bare metal server network interface prototype -// object. The prototype object is structured in the same way as a retrieved bare metal server network interface, and -// contains the information necessary to create the new bare metal server network interface. Any subnet in the bare -// metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. -// Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. -// -// 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, and new network interfaces are not allowed to be created. -func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") - 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(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) - 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_bare_metal_server_network_interface", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteBareMetalServer : Delete a bare metal server -// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the -// bare metal server network interfaces are implicitly disassociated. -func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") - 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_bare_metal_server", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment -// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs -// associated with the bare metal server network attachment are implicitly disassociated. -// -// The bare metal server's primary network attachment cannot be deleted. -func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *deleteBareMetalServerNetworkAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") - 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_bare_metal_server_network_attachment", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface -// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs -// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server -// network interface is not allowed to be deleted. -// -// 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 is not allowed to be deleted. -func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *deleteBareMetalServerNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") - 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_bare_metal_server_network_interface", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetBareMetalServer : Retrieve a bare metal server -// This request retrieves a single bare metal server specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") - 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_bare_metal_server", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerDisk : Retrieve a bare metal server disk -// This request retrieves a single disk specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, - "id": *getBareMetalServerDiskOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") - 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_bare_metal_server_disk", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server -// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and -// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be -// current. -func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getBareMetalServerInitializationOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") - 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_bare_metal_server_initialization", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment -// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *getBareMetalServerNetworkAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") - 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_bare_metal_server_network_attachment", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface -// This request retrieves a single bare metal server network interface specified by the identifier in the URL. -// -// If this bare metal server has network attachments, the retrieved 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. -func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *getBareMetalServerNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") - 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_bare_metal_server_network_interface", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP if it is associated with the bare metal server network interface -// specified in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") - 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_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP -// This request retrieves the primary reserved IP for a bare metal server network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP") - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") - 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_bare_metal_server_network_interface_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerProfile : Retrieve a bare metal server profile -// This request retrieves a single bare metal server profile specified by the name in the URL. -func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "name": *getBareMetalServerProfileOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles/{name}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") - 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_bare_metal_server_profile", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBareMetalServerDisks : List all disks on a bare metal server -// This request lists all disks on a bare metal server. A disk is a block device that is locally attached to the -// physical server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk -// first. -func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") - 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, "list_bare_metal_server_disks", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBareMetalServerNetworkAttachments : List all network attachments on a bare metal server -// This request lists all network attachments on a bare metal server. A bare metal server network attachment is an -// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network -// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to -// the bare metal server. -// -// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. -// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property -// values. -func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") - 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 listBareMetalServerNetworkAttachmentsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) - } - if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.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_bare_metal_server_network_attachments", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a bare metal server network interface -// This request lists all floating IPs associated with a bare metal server network interface. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, - "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") - 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, "list_bare_metal_server_network_interface_floating_ips", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBareMetalServerNetworkInterfaceIps : List the primary reserved IP for a bare metal server network interface -// This request lists the primary reserved IP for a bare metal server network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionBareMetalServerNetworkInterfaceContext, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListBareMetalServerNetworkInterfaceIps") - err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfaceIpsOptions.BareMetalServerID, - "network_interface_id": *listBareMetalServerNetworkInterfaceIpsOptions.NetworkInterfaceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listBareMetalServerNetworkInterfaceIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceIps") - 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, "list_bare_metal_server_network_interface_ips", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContext) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server -// This request lists all network interfaces on a bare metal server. A bare metal server network interface is an -// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network -// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to -// the bare metal server. -// -// If this bare metal server has network attachments, each returned 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. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") - 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 listBareMetalServerNetworkInterfacesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) - } - if listBareMetalServerNetworkInterfacesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.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_bare_metal_server_network_interfaces", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBareMetalServerProfiles : List all bare metal server profiles -// This request lists all [bare metal server -// profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) available in the region. A bare metal -// server profile specifies the performance characteristics and pricing model for a bare metal server. -func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") - 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, `/bare_metal_server/profiles`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") - 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 listBareMetalServerProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) - } - if listBareMetalServerProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.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_bare_metal_server_profiles", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBareMetalServers : List all bare metal servers -// This request lists all bare metal servers in the region. -func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") - 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, `/bare_metal_servers`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listBareMetalServersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") - 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 listBareMetalServersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) - } - if listBareMetalServersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) - } - if listBareMetalServersOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) - } - if listBareMetalServersOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) - } - if listBareMetalServersOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) - } - if listBareMetalServersOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) - } - if listBareMetalServersOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) - } - - 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_bare_metal_servers", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface -// This request disassociates the specified floating IP from the specified bare metal server network interface. -func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") - 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, "remove_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// RestartBareMetalServer : Restart a bare metal server -// This request restarts a bare metal server. It will run immediately regardless of the state of the server. -func (vpc *VpcV1) RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RestartBareMetalServerWithContext(context.Background(), restartBareMetalServerOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// RestartBareMetalServerWithContext is an alternate form of the RestartBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(restartBareMetalServerOptions, "restartBareMetalServerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(restartBareMetalServerOptions, "restartBareMetalServerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *restartBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/restart`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range restartBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RestartBareMetalServer") - 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, "restart_bare_metal_server", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// StartBareMetalServer : Start a bare metal server -// This request starts a bare metal server. It will run immediately provided the server is stopped. -func (vpc *VpcV1) StartBareMetalServer(startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.StartBareMetalServerWithContext(context.Background(), startBareMetalServerOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// StartBareMetalServerWithContext is an alternate form of the StartBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBareMetalServerOptions *StartBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(startBareMetalServerOptions, "startBareMetalServerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(startBareMetalServerOptions, "startBareMetalServerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *startBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/start`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range startBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StartBareMetalServer") - 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, "start_bare_metal_server", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// StopBareMetalServer : Stop a bare metal server -// This request stops a bare metal server. It will run immediately provided the server is running. Note: A soft stop may -// not complete as it relies on the operating system to perform the operation. -func (vpc *VpcV1) StopBareMetalServer(stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.StopBareMetalServerWithContext(context.Background(), stopBareMetalServerOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// StopBareMetalServerWithContext is an alternate form of the StopBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMetalServerOptions *StopBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(stopBareMetalServerOptions, "stopBareMetalServerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(stopBareMetalServerOptions, "stopBareMetalServerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *stopBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/stop`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range stopBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "StopBareMetalServer") - 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 stopBareMetalServerOptions.Type != nil { - body["type"] = stopBareMetalServerOptions.Type - } - _, 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, "stop_bare_metal_server", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// UpdateBareMetalServer : Update a bare metal server -// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object -// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") - 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(updateBareMetalServerOptions.BareMetalServerPatch) - 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_bare_metal_server", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateBareMetalServerDisk : Update a bare metal server disk -// This request updates the bare metal server disk with the information in a provided patch. -func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, - "id": *updateBareMetalServerDiskOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") - 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(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) - 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_bare_metal_server_disk", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment -// This request updates a bare metal server network attachment with the information provided in a bare metal server -// network attachment patch object. The bare metal server network attachment patch object is structured in the same way -// as a retrieved bare metal server network attachment and contains only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *updateBareMetalServerNetworkAttachmentOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") - 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(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) - 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_bare_metal_server_network_attachment", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateBareMetalServerNetworkInterface : Update a bare metal server network interface -// This request updates a bare metal server network interface with the information provided in a bare metal server -// network interface patch object. The bare metal server network interface patch object is structured in the same way as -// a retrieved bare metal server network interface and needs to contain only the information to be updated. -// -// 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 is not allowed to be updated. -func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *updateBareMetalServerNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") - 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(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) - 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_bare_metal_server_network_interface", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateVolume : Create a volume -// This request creates a new volume from a volume prototype object. The prototype object is structured in the same way -// as a retrieved volume, and contains the information necessary to create the new volume. -func (vpc *VpcV1) CreateVolume(createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateVolumeWithContext is an alternate form of the CreateVolume method which supports a Context parameter -func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVolumeOptions, "createVolumeOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions") - 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, `/volumes`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createVolumeOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") - 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(createVolumeOptions.VolumePrototype) - 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_volume", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteVolume : Delete a volume -// This request deletes a volume. This operation cannot be reversed. For this request to succeed, the volume must not be -// attached to any instances. -func (vpc *VpcV1) DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteVolumeWithContext is an alternate form of the DeleteVolume method which supports a Context parameter -func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVolumeOptions, "deleteVolumeOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteVolumeOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteVolumeOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - if deleteVolumeOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVolumeOptions.IfMatch)) - } - - 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_volume", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetVolume : Retrieve a volume -// This request retrieves a single volume specified by the identifier in the URL. -func (vpc *VpcV1) GetVolume(getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVolumeWithContext(context.Background(), getVolumeOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVolumeWithContext is an alternate form of the GetVolume method which supports a Context parameter -func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVolumeOptions, "getVolumeOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getVolumeOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVolumeOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") - 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_volume", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetVolumeProfile : Retrieve a volume profile -// This request retrieves a single volume profile specified by the name in the URL. -func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter -func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "name": *getVolumeProfileOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles/{name}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVolumeProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") - 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_volume_profile", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVolumeProfiles : List all volume profiles -// This request lists all [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available -// in the region. A volume profile specifies the performance characteristics and pricing model for a volume. -func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter -func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") - 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, `/volume/profiles`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listVolumeProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") - 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 listVolumeProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) - } - if listVolumeProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.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_volume_profiles", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVolumes : List all volumes -// This request lists all volumes in the region. Volumes are network-connected block storage devices that may be -// attached to one or more instances in the same region. -func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter -func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") - 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, `/volumes`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listVolumesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") - 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 listVolumesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) - } - if listVolumesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) - } - if listVolumesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) - } - if listVolumesOptions.AttachmentState != nil { - builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) - } - if listVolumesOptions.Encryption != nil { - builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) - } - if listVolumesOptions.OperatingSystemFamily != nil { - builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) - } - if listVolumesOptions.OperatingSystemArchitecture != nil { - builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) - } - if listVolumesOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) - } - if listVolumesOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) - } - - 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_volumes", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateVolume : Update a volume -// This request updates a volume with the information in a provided volume patch. The volume patch object is structured -// in the same way as a retrieved volume and contains only the information to be updated. -func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter -func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateVolumeOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateVolumeOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVolumeOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) - 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_volume", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateSnapshot : Create a snapshot -// This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same -// way as a retrieved snapshot, and contains the information necessary to provision the new snapshot. -func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") - 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, `/snapshots`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createSnapshotOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") - 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(createSnapshotOptions.SnapshotPrototype) - 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_snapshot", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateSnapshotClone : Create a clone for a snapshot -// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if -// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. -func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *createSnapshotCloneOptions.ID, - "zone_name": *createSnapshotCloneOptions.ZoneName, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createSnapshotCloneOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") - 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, "create_snapshot_clone", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateSnapshotConsistencyGroup : Create a snapshot consistency group -// This request creates a new snapshot consistency group from a snapshot consistency group object. The prototype object -// is structured in the same way as a retrieved consistency group, and contains the information necessary to provision -// the new snapshot consistency group. -func (vpc *VpcV1) CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSnapshotConsistencyGroupWithContext(context.Background(), createSnapshotConsistencyGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateSnapshotConsistencyGroupWithContext is an alternate form of the CreateSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions") - 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, `/snapshot_consistency_groups`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createSnapshotConsistencyGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup") - 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(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) - 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_snapshot_consistency_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteSnapshot : Delete a snapshot -// This request deletes a snapshot. This operation cannot be reversed. -func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteSnapshotWithContext is an alternate form of the DeleteSnapshot method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotOptions, "deleteSnapshotOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteSnapshotOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteSnapshotOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - if deleteSnapshotOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch)) - } - - 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_snapshot", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteSnapshotClone : Delete a snapshot clone -// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated -// from the snapshot. -func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteSnapshotCloneOptions.ID, - "zone_name": *deleteSnapshotCloneOptions.ZoneName, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") - 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_snapshot_clone", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// DeleteSnapshotConsistencyGroup : Delete a snapshot consistency group -// This request deletes snapshot consistency group. This operation cannot be reversed. If the -// `delete_snapshots_on_delete` property is `true`, all snapshots in the consistency group will also be deleted. -func (vpc *VpcV1) DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteSnapshotConsistencyGroupWithContext(context.Background(), deleteSnapshotConsistencyGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteSnapshotConsistencyGroupWithContext is an alternate form of the DeleteSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteSnapshotConsistencyGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteSnapshotConsistencyGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotConsistencyGroup") - 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_snapshot_consistency_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteSnapshots : Delete a filtered collection of snapshots -// This request deletes all snapshots created from a specific source volume. -func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteSnapshotsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) - - 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_snapshots", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetSnapshot : Retrieve a snapshot -// This request retrieves a single snapshot specified by the identifier in the URL. -func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetSnapshotWithContext is an alternate form of the GetSnapshot method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotOptions, "getSnapshotOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getSnapshotOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getSnapshotOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") - 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_snapshot", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetSnapshotClone : Retrieve a snapshot clone -// This request retrieves a single clone specified by the snapshot identifier and zone name in the URL. -func (vpc *VpcV1) GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSnapshotCloneWithContext(context.Background(), getSnapshotCloneOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetSnapshotCloneWithContext is an alternate form of the GetSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotCloneOptions, "getSnapshotCloneOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getSnapshotCloneOptions, "getSnapshotCloneOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getSnapshotCloneOptions.ID, - "zone_name": *getSnapshotCloneOptions.ZoneName, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getSnapshotCloneOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone") - 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_snapshot_clone", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetSnapshotConsistencyGroup : Retrieve a snapshot consistency group -// This request retrieves a single snapshot consistency group specified by the identifier in the URL. -func (vpc *VpcV1) GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSnapshotConsistencyGroupWithContext(context.Background(), getSnapshotConsistencyGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetSnapshotConsistencyGroupWithContext is an alternate form of the GetSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getSnapshotConsistencyGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getSnapshotConsistencyGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup") - 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_snapshot_consistency_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListSnapshotClones : List all clones for a snapshot -// This request lists all clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. -func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *listSnapshotClonesOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listSnapshotClonesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") - 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, "list_snapshot_clones", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListSnapshotConsistencyGroups : List all snapshot consistency groups -// This request lists all snapshot consistency groups in the region. A snapshot consistency group is a collection of -// individual snapshots taken at the same time. -func (vpc *VpcV1) ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListSnapshotConsistencyGroupsWithContext is an alternate form of the ListSnapshotConsistencyGroups method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSnapshotConsistencyGroupsOptions, "listSnapshotConsistencyGroupsOptions") - 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, `/snapshot_consistency_groups`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listSnapshotConsistencyGroupsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups") - 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 listSnapshotConsistencyGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Start)) - } - if listSnapshotConsistencyGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Limit)) - } - if listSnapshotConsistencyGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.ResourceGroupID)) - } - if listSnapshotConsistencyGroupsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Name)) - } - if listSnapshotConsistencyGroupsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Sort)) - } - if listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID)) - } - - 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_snapshot_consistency_groups", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroupCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListSnapshots : List all snapshots -// This request lists all snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is -// created. -func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") - 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, `/snapshots`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listSnapshotsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") - 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 listSnapshotsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) - } - if listSnapshotsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) - } - if listSnapshotsOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag)) - } - if listSnapshotsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID)) - } - if listSnapshotsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name)) - } - if listSnapshotsOptions.SourceVolumeID != nil { - builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID)) - } - if listSnapshotsOptions.SourceVolumeCRN != nil { - builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN)) - } - if listSnapshotsOptions.SourceImageID != nil { - builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID)) - } - if listSnapshotsOptions.SourceImageCRN != nil { - builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN)) - } - if listSnapshotsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort)) - } - if listSnapshotsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) - } - if listSnapshotsOptions.CopiesID != nil { - builder.AddQuery("copies[].id", fmt.Sprint(*listSnapshotsOptions.CopiesID)) - } - if listSnapshotsOptions.CopiesName != nil { - builder.AddQuery("copies[].name", fmt.Sprint(*listSnapshotsOptions.CopiesName)) - } - if listSnapshotsOptions.CopiesCRN != nil { - builder.AddQuery("copies[].crn", fmt.Sprint(*listSnapshotsOptions.CopiesCRN)) - } - if listSnapshotsOptions.CopiesRemoteRegionName != nil { - builder.AddQuery("copies[].remote.region.name", fmt.Sprint(*listSnapshotsOptions.CopiesRemoteRegionName)) - } - if listSnapshotsOptions.SourceSnapshotID != nil { - builder.AddQuery("source_snapshot.id", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotID)) - } - if listSnapshotsOptions.SourceSnapshotRemoteRegionName != nil { - builder.AddQuery("source_snapshot.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotRemoteRegionName)) - } - if listSnapshotsOptions.SourceVolumeRemoteRegionName != nil { - builder.AddQuery("source_volume.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceVolumeRemoteRegionName)) - } - if listSnapshotsOptions.SourceImageRemoteRegionName != nil { - builder.AddQuery("source_image.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceImageRemoteRegionName)) - } - if listSnapshotsOptions.ClonesZoneName != nil { - builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName)) - } - if listSnapshotsOptions.SnapshotConsistencyGroupID != nil { - builder.AddQuery("snapshot_consistency_group.id", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupID)) - } - if listSnapshotsOptions.SnapshotConsistencyGroupCRN != nil { - builder.AddQuery("snapshot_consistency_group.crn", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupCRN)) - } - - 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_snapshots", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateSnapshot : Update a snapshot -// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group -// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. -func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter -func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateSnapshotOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateSnapshotOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSnapshotOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) - 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_snapshot", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateSnapshotConsistencyGroup : Update a snapshot consistency group -// This request updates a snapshot consistency group with the information in a provided snapshot consistency group -// patch. The snapshot consistency group patch object is structured in the same way as a retrieved snapshot consistency -// group and contains only the information to be updated. -func (vpc *VpcV1) UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateSnapshotConsistencyGroupWithContext(context.Background(), updateSnapshotConsistencyGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateSnapshotConsistencyGroupWithContext is an alternate form of the UpdateSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateSnapshotConsistencyGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSnapshotConsistencyGroupOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotConsistencyGroupOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch) - 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_snapshot_consistency_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateShare : Create a file share -// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, -// a replica share, or both a source and replica share. -// -// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to -// provision the new file shares. -func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateShareWithContext(context.Background(), createShareOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter -func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createShareOptions, "createShareOptions") - 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, `/shares`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createShareOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") - 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(createShareOptions.SharePrototype) - 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_share", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateShareMountTarget : Create a mount target for a file share -// This request creates a new share mount target from a share mount target prototype object. -// -// The prototype object is structured in the same way as a retrieved share mount target, and contains the information -// necessary to provision the new file share mount target. -func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "share_id": *createShareMountTargetOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createShareMountTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") - 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(createShareMountTargetOptions.ShareMountTargetPrototype) - 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_share_mount_target", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteShare : Delete a file share -// This request deletes a share. This operation cannot be reversed. A share cannot be deleted if it: -// - has share mount targets -// - has a `lifecycle_state` of `updating` -// - has a replication operation in progress -// -// If the request is accepted, the share `lifecycle_state` will be set to `deleting`. Once deletion processing -// completes, it will no longer be retrievable. -func (vpc *VpcV1) DeleteShare(deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteShareWithContext(context.Background(), deleteShareOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteShareWithContext is an alternate form of the DeleteShare method which supports a Context parameter -func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareOptions, "deleteShareOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteShareOptions, "deleteShareOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteShareOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteShareOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - if deleteShareOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteShareOptions.IfMatch)) - } - - 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_share", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteShareMountTarget : Delete a share mount target -// This request deletes a share mount target. This operation cannot be reversed. -// -// If the request is accepted, the share mount target `lifecycle_state` will be set to -// `deleting`. Once deletion processing completes, it will no longer be retrievable. -func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "share_id": *deleteShareMountTargetOptions.ShareID, - "id": *deleteShareMountTargetOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteShareMountTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") - 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_share_mount_target", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteShareSource : Split the source file share from a replica share -// This request removes the replication relationship between a source share and the replica share specified by the -// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a -// `lifecycle_state` of `updating`, or has a replication operation in progress. -// -// This operation cannot be reversed. -func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter -func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "share_id": *deleteShareSourceOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteShareSourceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") - 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_share_source", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// FailoverShare : Failover to replica file share -// This request triggers a failover to the replica file share specified by the identifier in the URL. The failover -// cannot be started if a source share or the replica share has a `lifecycle_state` of `updating`, or has a replication -// operation in progress. -// -// If `fallback_policy` is specified as `split`, and the request is accepted but the failover operation cannot be -// performed, a split will be triggered. -func (vpc *VpcV1) FailoverShare(failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.FailoverShareWithContext(context.Background(), failoverShareOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// FailoverShareWithContext is an alternate form of the FailoverShare method which supports a Context parameter -func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(failoverShareOptions, "failoverShareOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(failoverShareOptions, "failoverShareOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "share_id": *failoverShareOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/failover`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range failoverShareOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare") - 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 failoverShareOptions.FallbackPolicy != nil { - body["fallback_policy"] = failoverShareOptions.FallbackPolicy - } - if failoverShareOptions.Timeout != nil { - body["timeout"] = failoverShareOptions.Timeout - } - _, 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, "failover_share", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetShare : Retrieve a file share -// This request retrieves a single file share specified by the identifier in the URL. -func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareWithContext(context.Background(), getShareOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter -func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getShareOptions, "getShareOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getShareOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getShareOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") - 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_share", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetShareMountTarget : Retrieve a share mount target -// This request retrieves a single share mount target specified by the identifier in the URL. -func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "share_id": *getShareMountTargetOptions.ShareID, - "id": *getShareMountTargetOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getShareMountTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") - 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_share_mount_target", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetShareProfile : Retrieve a file share profile -// This request retrieves a single file share profile specified by the name in the URL. -func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter -func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "name": *getShareProfileOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getShareProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") - 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_share_profile", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetShareSource : Retrieve the source file share for a replica file share -// This request retrieves the source file share associated with the replica file share specified by the identifier in -// the URL. -func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter -func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "share_id": *getShareSourceOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getShareSourceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") - 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_share_source", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListShareMountTargets : List all mount targets for a file share -// This request retrieves all share mount targets for a file share. A share mount target is a network endpoint at which -// a file share may be mounted. The file share can be mounted by clients in the same VPC and zone after creating share -// mount targets. -// -// The share mount targets will be sorted by their `created_at` property values, with newest targets first. -func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter -func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "share_id": *listShareMountTargetsOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listShareMountTargetsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") - 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 listShareMountTargetsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) - } - if listShareMountTargetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) - } - if listShareMountTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.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_share_mount_targets", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListShareProfiles : List all file share profiles -// This request lists all [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) -// available in the region. A file share profile specifies the performance characteristics and pricing model for a file -// share. -func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter -func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") - 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, `/share/profiles`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listShareProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") - 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 listShareProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) - } - if listShareProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) - } - if listShareProfilesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) - } - - 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_share_profiles", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListShares : List all file shares -// This request lists all file shares in the region. -func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSharesWithContext(context.Background(), listSharesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter -func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSharesOptions, "listSharesOptions") - 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, `/shares`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listSharesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") - 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 listSharesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) - } - if listSharesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) - } - if listSharesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) - } - if listSharesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) - } - if listSharesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) - } - if listSharesOptions.ReplicationRole != nil { - builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) - } - - 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_shares", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateShare : Update a file share -// This request updates a share with the information in a provided share patch. The share patch object is structured in -// the same way as a retrieved share and contains only the information to be updated. -func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateShareWithContext(context.Background(), updateShareOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter -func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateShareOptions, "updateShareOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateShareOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateShareOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateShareOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateShareOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) - 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_share", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateShareMountTarget : Update a share mount target -// This request updates a share mount target with the information provided in a share mount target patch object. The -// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain -// only the information to be updated. -func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "share_id": *updateShareMountTargetOptions.ShareID, - "id": *updateShareMountTargetOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateShareMountTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") - 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(updateShareMountTargetOptions.ShareMountTargetPatch) - 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_share_mount_target", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateBackupPolicy : Create a backup policy -// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in -// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. -func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") - 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, `/backup_policies`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createBackupPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") - 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(createBackupPolicyOptions.BackupPolicyPrototype) - 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_backup_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateBackupPolicyPlan : Create a plan for a backup policy -// This request creates a new backup policy plan from a backup policy plan prototype object. The prototype object is -// structured in the same way as a retrieved backup policy plan, and contains the information necessary to create the -// new backup policy plan. -// -// Backups created by this plan will use the resource group of the source being backed up. -// -// Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character -// suffix. -func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateBackupPolicyPlanWithContext is an alternate form of the CreateBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") - 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 createBackupPolicyPlanOptions.CronSpec != nil { - body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec - } - if createBackupPolicyPlanOptions.Active != nil { - body["active"] = createBackupPolicyPlanOptions.Active - } - if createBackupPolicyPlanOptions.AttachUserTags != nil { - body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags - } - if createBackupPolicyPlanOptions.ClonePolicy != nil { - body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy - } - if createBackupPolicyPlanOptions.CopyUserTags != nil { - body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags - } - if createBackupPolicyPlanOptions.DeletionTrigger != nil { - body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger - } - if createBackupPolicyPlanOptions.Name != nil { - body["name"] = createBackupPolicyPlanOptions.Name - } - if createBackupPolicyPlanOptions.RemoteRegionPolicies != nil { - body["remote_region_policies"] = createBackupPolicyPlanOptions.RemoteRegionPolicies - } - _, 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_backup_policy_plan", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteBackupPolicy : Delete a backup policy -// This request deletes a backup policy. This operation cannot be reversed. -// -// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, -// the backup policy will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteBackupPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteBackupPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) - } - - 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_backup_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteBackupPolicyPlan : Delete a backup policy plan -// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by -// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with -// the plan will run to completion before the plan is deleted. -// -// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing -// completes, the backup policy plan will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, - "id": *deleteBackupPolicyPlanOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) - } - - 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_backup_policy_plan", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetBackupPolicy : Retrieve a backup policy -// This request retrieves a single backup policy specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getBackupPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getBackupPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") - 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_backup_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetBackupPolicyJob : Retrieve a backup policy job -// This request retrieves a single backup policy job specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, - "id": *getBackupPolicyJobOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getBackupPolicyJobOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") - 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_backup_policy_job", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetBackupPolicyPlan : Retrieve a backup policy plan -// This request retrieves a single backup policy plan specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, - "id": *getBackupPolicyPlanOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") - 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_backup_policy_plan", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBackupPolicies : List all backup policies -// This request lists all backup policies in the region. Backup policies control which sources are selected for backup -// and include a set of backup policy plans that provide the backup schedules and deletion triggers. -func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter -func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") - 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, `/backup_policies`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listBackupPoliciesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") - 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 listBackupPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) - } - if listBackupPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) - } - if listBackupPoliciesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) - } - if listBackupPoliciesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) - } - if listBackupPoliciesOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) - } - - 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_backup_policies", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBackupPolicyJobs : List all jobs for a backup policy -// This request retrieves all jobs for a backup policy. A backup job represents the execution of a backup policy plan -// for a resource matching the policy's criteria. -func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter -func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") - 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 listBackupPolicyJobsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) - } - if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) - } - if listBackupPolicyJobsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) - } - if listBackupPolicyJobsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) - } - if listBackupPolicyJobsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) - } - if listBackupPolicyJobsOptions.SourceID != nil { - builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) - } - if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { - builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) - } - if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { - builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) - } - - 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_backup_policy_jobs", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBackupPolicyPlans : List all plans for a backup policy -// This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. -func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter -func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") - 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 listBackupPolicyPlansOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) - } - - 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_backup_policy_plans", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateBackupPolicy : Update a backup policy -// This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch -// object is structured in the same way as a retrieved backup policy and contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateBackupPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateBackupPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateBackupPolicyOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) - 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_backup_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateBackupPolicyPlan : Update a backup policy plan -// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is -// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, - "id": *updateBackupPolicyPlanOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) - 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_backup_policy_plan", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetRegion : Retrieve a region -// This request retrieves a single region specified by the name in the URL. -func (vpc *VpcV1) GetRegion(getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetRegionWithContext(context.Background(), getRegionOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetRegionWithContext is an alternate form of the GetRegion method which supports a Context parameter -func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getRegionOptions, "getRegionOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getRegionOptions, "getRegionOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "name": *getRegionOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{name}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getRegionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegion") - 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_region", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegion) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetRegionZone : Retrieve a zone -// This request retrieves a single zone specified by the region and zone names in the URL. -func (vpc *VpcV1) GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetRegionZoneWithContext is an alternate form of the GetRegionZone method which supports a Context parameter -func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getRegionZoneOptions, "getRegionZoneOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "region_name": *getRegionZoneOptions.RegionName, - "name": *getRegionZoneOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones/{name}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getRegionZoneOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") - 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_region_zone", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListRegionZones : List all zones in a region -// This request lists all zones in a region. Zones represent logically-isolated data centers with high-bandwidth and -// low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. -func (vpc *VpcV1) ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListRegionZonesWithContext is an alternate form of the ListRegionZones method which supports a Context parameter -func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listRegionZonesOptions, "listRegionZonesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listRegionZonesOptions, "listRegionZonesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "region_name": *listRegionZonesOptions.RegionName, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listRegionZonesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegionZones") - 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, "list_region_zones", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListRegions : List all regions -// This request lists all regions. Each region is a separate geographic area that contains multiple isolated zones. -// Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones -// in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation -// available. Resources deployed within a single region also benefit from the low latency afforded by geographic -// proximity. -func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter -func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") - 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, `/regions`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listRegionsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") - 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, "list_regions", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// AddNetworkInterfaceFloatingIP : Add an association between a floating IP and a virtual network interface -// This request adds an association between the specified floating IP and the specified virtual network interface. -// -// If the virtual network interface has `enable_infrastructure_nat` set to `true`, no more than one floating IP can be -// associated, and network address translation is performed between the floating IP address and the virtual network -// interface's `primary_ip` address. -// -// If the virtual network interface has `enable_infrastructure_nat` set to `false`, packets are passed unchanged to/from -// the virtual network interface. -// -// The floating IP must: -// - be in the same `zone` as the virtual network interface -// - not currently be associated with another resource -// -// The virtual network interface's `target` must not currently be a file share mount target. -// -// A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *addNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *addNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") - 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, "add_network_interface_floating_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// AddVirtualNetworkInterfaceIP : Bind a reserved IP to a virtual network interface -// This request binds the specified reserved IP to the specified virtual network interface. -// -// The reserved IP must currently be unbound and in the primary IP's subnet. The virtual network interface's `target` -// must not currently be a file share mount target. -func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// AddVirtualNetworkInterfaceIPWithContext is an alternate form of the AddVirtualNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *addVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, - "id": *addVirtualNetworkInterfaceIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range addVirtualNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") - 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, "add_virtual_network_interface_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateVirtualNetworkInterface : Create a virtual network interface -// This request creates a new virtual network interface from a virtual network interface prototype object. The prototype -// object is structured in the same way as a retrieved virtual network interface, and contains the information necessary -// to create the new virtual network interface. -func (vpc *VpcV1) CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVirtualNetworkInterfaceWithContext(context.Background(), createVirtualNetworkInterfaceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateVirtualNetworkInterfaceWithContext is an alternate form of the CreateVirtualNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions") - 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, `/virtual_network_interfaces`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createVirtualNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVirtualNetworkInterface") - 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 createVirtualNetworkInterfaceOptions.AllowIPSpoofing != nil { - body["allow_ip_spoofing"] = createVirtualNetworkInterfaceOptions.AllowIPSpoofing - } - if createVirtualNetworkInterfaceOptions.AutoDelete != nil { - body["auto_delete"] = createVirtualNetworkInterfaceOptions.AutoDelete - } - if createVirtualNetworkInterfaceOptions.EnableInfrastructureNat != nil { - body["enable_infrastructure_nat"] = createVirtualNetworkInterfaceOptions.EnableInfrastructureNat - } - if createVirtualNetworkInterfaceOptions.Ips != nil { - body["ips"] = createVirtualNetworkInterfaceOptions.Ips - } - if createVirtualNetworkInterfaceOptions.Name != nil { - body["name"] = createVirtualNetworkInterfaceOptions.Name - } - if createVirtualNetworkInterfaceOptions.PrimaryIP != nil { - body["primary_ip"] = createVirtualNetworkInterfaceOptions.PrimaryIP - } - if createVirtualNetworkInterfaceOptions.ResourceGroup != nil { - body["resource_group"] = createVirtualNetworkInterfaceOptions.ResourceGroup - } - if createVirtualNetworkInterfaceOptions.SecurityGroups != nil { - body["security_groups"] = createVirtualNetworkInterfaceOptions.SecurityGroups - } - if createVirtualNetworkInterfaceOptions.Subnet != nil { - body["subnet"] = createVirtualNetworkInterfaceOptions.Subnet - } - _, 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_virtual_network_interface", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteVirtualNetworkInterfaces : Delete a virtual network interface -// This request deletes a virtual network interface. This operation cannot be reversed. For this request to succeed, the -// virtual network interface must not be required by another resource, such as the primary network attachment for an -// instance. -func (vpc *VpcV1) DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteVirtualNetworkInterfacesWithContext is an alternate form of the DeleteVirtualNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteVirtualNetworkInterfacesOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteVirtualNetworkInterfacesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVirtualNetworkInterfaces") - 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_virtual_network_interfaces", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP if it is associated with the virtual network interface specified in -// the URL. -func (vpc *VpcV1) GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *getNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *getNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") - 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_network_interface_floating_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetVirtualNetworkInterface : Retrieve a virtual network interface -// This request retrieves a single virtual network interface specified by the identifier in the URL. -func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVirtualNetworkInterfaceWithContext(context.Background(), getVirtualNetworkInterfaceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVirtualNetworkInterfaceWithContext is an alternate form of the GetVirtualNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getVirtualNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVirtualNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterface") - 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_virtual_network_interface", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// GetVirtualNetworkInterfaceIP : Retrieve bound reserved IP -// This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in -// the URL. -func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *getVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, - "id": *getVirtualNetworkInterfaceIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") - 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_virtual_network_interface_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListNetworkInterfaceFloatingIps : List all floating IPs associated with a virtual network interface -// This request lists all floating IPs associated with a virtual network interface. -func (vpc *VpcV1) ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *listNetworkInterfaceFloatingIpsOptions.VirtualNetworkInterfaceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listNetworkInterfaceFloatingIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkInterfaceFloatingIps") - 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 listNetworkInterfaceFloatingIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start)) - } - if listNetworkInterfaceFloatingIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Limit)) - } - if listNetworkInterfaceFloatingIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Sort)) - } - - 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_network_interface_floating_ips", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVirtualNetworkInterfaceIps : List all reserved IPs bound to a virtual network interface -// This request lists all reserved IPs bound to a virtual network interface. -func (vpc *VpcV1) ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListVirtualNetworkInterfaceIpsWithContext is an alternate form of the ListVirtualNetworkInterfaceIps method which supports a Context parameter -func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *listVirtualNetworkInterfaceIpsOptions.VirtualNetworkInterfaceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listVirtualNetworkInterfaceIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaceIps") - 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 listVirtualNetworkInterfaceIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Start)) - } - if listVirtualNetworkInterfaceIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Limit)) - } - if listVirtualNetworkInterfaceIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Sort)) - } - - 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_virtual_network_interface_ips", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVirtualNetworkInterfaces : List all virtual network interfaces -// This request lists all virtual network interfaces in the region. A virtual network interface is a logical abstraction -// of a virtual network interface in a subnet, and may be attached to a target resource. -// -// The virtual network interfaces will be sorted by their `created_at` property values, with newest virtual network -// interfaces first. Virtual network interfaces with identical -// `created_at` property values will in turn be sorted by ascending `name` property values. -func (vpc *VpcV1) ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListVirtualNetworkInterfacesWithContext is an alternate form of the ListVirtualNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVirtualNetworkInterfacesOptions, "listVirtualNetworkInterfacesOptions") - 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, `/virtual_network_interfaces`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces") - 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 listVirtualNetworkInterfacesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) - } - if listVirtualNetworkInterfacesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Limit)) - } - if listVirtualNetworkInterfacesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVirtualNetworkInterfacesOptions.ResourceGroupID)) - } - - 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_virtual_network_interfaces", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterfaceCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface -// This request disassociates the specified floating IP from the specified virtual network interface. -func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// RemoveNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *removeNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *removeNetworkInterfaceFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") - 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, "remove_network_interface_floating_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// RemoveVirtualNetworkInterfaceIP : Unbind a reserved IP from a virtual network interface -// This request unbinds the specified reserved IP from the specified virtual network interface. If the reserved IP has -// `auto_delete` set to `true`, the reserved IP will be deleted. -// -// The reserved IP for the `primary_ip` cannot be unbound. -func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveVirtualNetworkInterfaceIPWithContext(context.Background(), removeVirtualNetworkInterfaceIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// RemoveVirtualNetworkInterfaceIPWithContext is an alternate form of the RemoveVirtualNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context, removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *removeVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, - "id": *removeVirtualNetworkInterfaceIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range removeVirtualNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVirtualNetworkInterfaceIP") - 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, "remove_virtual_network_interface_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// UpdateVirtualNetworkInterface : Update a virtual network interface -// This request updates a virtual network interface with the information in a provided virtual network interface patch. -// The virtual network interface patch object is structured in the same way as a retrieved virtual network interface and -// contains only the information to be updated. -func (vpc *VpcV1) UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateVirtualNetworkInterfaceWithContext is an alternate form of the UpdateVirtualNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateVirtualNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateVirtualNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVirtualNetworkInterface") - 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(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) - 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_virtual_network_interface", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions") - 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, `/public_gateways`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") - 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 - } - if createPublicGatewayOptions.FloatingIP != nil { - body["floating_ip"] = createPublicGatewayOptions.FloatingIP - } - if createPublicGatewayOptions.Name != nil { - body["name"] = createPublicGatewayOptions.Name - } - if createPublicGatewayOptions.ResourceGroup != nil { - body["resource_group"] = createPublicGatewayOptions.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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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, UnmarshalPublicGateway) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deletePublicGatewayOptions, "deletePublicGatewayOptions") - 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 = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 deletePublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicGateway") - 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_public_gateway", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getPublicGatewayOptions, "getPublicGatewayOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getPublicGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 getPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicGateway") - 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_public_gateway", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListPublicGateways : List all public gateways -// This request lists all 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 -} - -// 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 - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 listPublicGatewaysOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") - 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 listPublicGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) - } - if listPublicGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) - } - if listPublicGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) - } - - 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_public_gateways", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updatePublicGatewayOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 updatePublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") - 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(updatePublicGatewayOptions.PublicGatewayPatch) - 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_public_gateway", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createFloatingIPOptions, "createFloatingIPOptions") - 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, `/floating_ips`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFloatingIP") - 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()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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, UnmarshalFloatingIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteFloatingIPOptions, "deleteFloatingIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 deleteFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFloatingIP") - 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_floating_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getFloatingIPOptions, "getFloatingIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 getFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFloatingIP") - 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_floating_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListFloatingIps : List all floating IPs -// This request lists all 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 -} - -// 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 - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 listFloatingIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") - 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 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 { - 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_floating_ips", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateFloatingIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 updateFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP") - 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(updateFloatingIPOptions.FloatingIPPatch) - 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_floating_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") - 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, `/network_acls`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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 -} - -// 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 -} - -// 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(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 createNetworkACLRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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 -} - -// 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 -} - -// 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(deleteNetworkACLOptions, "deleteNetworkACLOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteNetworkACLOptions.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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACL") - 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_network_acl", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") - 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_network_acl_rule", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getNetworkACLOptions, "getNetworkACLOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getNetworkACLOptions.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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACL") - 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_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 -} - -// 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 -} - -// 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(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getNetworkACLRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") - 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_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 -} - -// ListNetworkACLRules : List all rules for a network ACL -// This request lists all 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 -} - -// 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(listNetworkACLRulesOptions, "listNetworkACLRulesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - 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, `/network_acls/{network_acl_id}/rules`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listNetworkACLRulesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkACLRules") - 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 listNetworkACLRulesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listNetworkACLRulesOptions.Start)) - } - if listNetworkACLRulesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listNetworkACLRulesOptions.Limit)) - } - if listNetworkACLRulesOptions.Direction != nil { - builder.AddQuery("direction", fmt.Sprint(*listNetworkACLRulesOptions.Direction)) - } - - 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_network_acl_rules", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRuleCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListNetworkAcls : List all network ACLs -// This request lists all 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 -} - -// 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 - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 listNetworkAclsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") - 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 listNetworkAclsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) - } - 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() - 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_network_acls", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - 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 - } - - 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, `/network_acls/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateNetworkACLOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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)) - - _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) - 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_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 -} - -// 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 information is not applicable to 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 -} - -// 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(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateNetworkACLRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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)) - - _, err = builder.SetBodyContentJSON(updateNetworkACLRuleOptions.NetworkACLRulePatch) - 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_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 -} - -// 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 -} - -// 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(createSecurityGroupOptions, "createSecurityGroupOptions") - 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, `/security_groups`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createSecurityGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") - 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 createSecurityGroupOptions.VPC != nil { - body["vpc"] = createSecurityGroupOptions.VPC - } - if createSecurityGroupOptions.Name != nil { - body["name"] = createSecurityGroupOptions.Name - } - if createSecurityGroupOptions.ResourceGroup != nil { - body["resource_group"] = createSecurityGroupOptions.ResourceGroup - } - if createSecurityGroupOptions.Rules != nil { - body["rules"] = createSecurityGroupOptions.Rules - } - _, 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_security_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - 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, `/security_groups/{security_group_id}/rules`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") - 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(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) - 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_security_group_rule", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) - 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) - 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(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") - 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, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 createSecurityGroupTargetBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") - 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, "create_security_group_target_binding", 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 -} - -// 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 -} - -// 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(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteSecurityGroupOptions.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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteSecurityGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") - 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_security_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") - 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_security_group_rule", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") - 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 = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 deleteSecurityGroupTargetBindingOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") - 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_security_group_target_binding", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getSecurityGroupOptions.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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getSecurityGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") - 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_security_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") - 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_security_group_rule", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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)) - - 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_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 -} - -// ListSecurityGroupRules : List all rules in a security group -// This request lists all 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 -} - -// 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") - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") - 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, "list_security_group_rules", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListSecurityGroupTargets : List all targets associated with a security group -// This request lists all 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 -} - -// 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") - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets") - 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 listSecurityGroupTargetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) - } - if listSecurityGroupTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupTargetsOptions.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_security_group_targets", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListSecurityGroups : List all security groups -// This request lists all 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 -} - -// 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 - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 listSecurityGroupsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") - 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 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 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() - 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_security_groups", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateSecurityGroupOptions.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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateSecurityGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") - 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(updateSecurityGroupOptions.SecurityGroupPatch) - 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_security_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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 information is not applicable to 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 -} - -// 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(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") - 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(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) - 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_security_group_rule", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) - 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) - 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") - 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 - } - - 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, `/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 addVPNGatewayConnectionsLocalCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsLocalCIDR") - 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, "add_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions") - 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, - } - - 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}/peer/cidrs/{cidr}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range addVPNGatewayConnectionsPeerCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsPeerCIDR") - 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, "add_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range checkVPNGatewayConnectionsLocalCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsLocalCIDR") - 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, "check_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions") - 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 = 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range checkVPNGatewayConnectionsPeerCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsPeerCIDR") - 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, "check_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") - 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, `/ike_policies`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createIkePolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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, UnmarshalIkePolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") - 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, `/ipsec_policies`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createIpsecPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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 -} - -// 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 -} - -// 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(createVPNGatewayOptions, "createVPNGatewayOptions") - 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, `/vpn_gateways`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createVPNGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) - 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_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 -} - -// 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 -} - -// 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(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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_gateways/{vpn_gateway_id}/connections`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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 -} - -// 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 -} - -// 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(deleteIkePolicyOptions, "deleteIkePolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteIkePolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 deleteIkePolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") - 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_ike_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteIpsecPolicyOptions.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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteIpsecPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") - 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_ipsec_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteVPNGatewayOptions.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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteVPNGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") - 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_vpn_gateway", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") - 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, - } - - 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}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") - 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_vpn_gateway_connection", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getIkePolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 getIkePolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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)) - - 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_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 -} - -// 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 -} - -// 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, `/ipsec_policies/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getIpsecPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") - 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_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 -} - -// 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 -} - -// 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(getVPNGatewayOptions, "getVPNGatewayOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getVPNGatewayOptions.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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVPNGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") - 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_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 -} - -// 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection") - 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_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 -} - -// ListIkePolicies : List all IKE policies -// This request lists all 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 -} - -// 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 - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 listIkePoliciesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") - 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 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() - 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_ike_policies", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListIkePolicyConnections : List all VPN gateway connections that use a specified IKE policy -// This request lists all VPN gateway connections that use a policy. -func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) - 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 *VPNGatewayConnectionCollection, 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(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *listIkePolicyConnectionsOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 listIkePolicyConnectionsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") - 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, "list_ike_policy_connections", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListIpsecPolicies : List all IPsec policies -// This request lists all 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 -} - -// 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 - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 listIpsecPoliciesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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 { - 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_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 -} - -// ListIpsecPolicyConnections : List all VPN gateway connections that use a specified IPsec policy -// This request lists all VPN gateway connections that use a policy. -func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) - 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 *VPNGatewayConnectionCollection, 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(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") - 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)) - - 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, UnmarshalVPNGatewayConnectionCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVPNGatewayConnections : List all connections of a VPN gateway -// This request lists all 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 -} - -// 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(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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_gateways/{vpn_gateway_id}/connections`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") - 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 listVPNGatewayConnectionsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) - } - - 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_vpn_gateway_connections", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVPNGatewayConnectionsLocalCIDRs : List all local CIDRs for a VPN gateway connection -// This request lists all 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 -} - -// 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(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions") - 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 = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 listVPNGatewayConnectionsLocalCIDRsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsLocalCIDRs") - 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, "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, UnmarshalVPNGatewayConnectionCIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVPNGatewayConnectionsPeerCIDRs : List all peer CIDRs for a VPN gateway connection -// This request lists all 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 -} - -// 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(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listVPNGatewayConnectionsPeerCIDRsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsPeerCIDRs") - 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, "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, UnmarshalVPNGatewayConnectionCIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVPNGateways : List all VPN gateways -// This request lists all 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 - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 listVPNGatewaysOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") - 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 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 { - 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_vpn_gateways", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - 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 - } - - 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, `/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 removeVPNGatewayConnectionsLocalCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsLocalCIDR") - 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, "remove_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - 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 = 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range removeVPNGatewayConnectionsPeerCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsPeerCIDR") - 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, "remove_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateIkePolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 updateIkePolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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 -} - -// 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 -} - -// 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(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - 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, `/ipsec_policies/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateIpsecPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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/merge-patch+json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) - 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_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 -} - -// 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 -} - -// 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(updateVPNGatewayOptions, "updateVPNGatewayOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateVPNGatewayOptions.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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateVPNGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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 -} - -// 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 -} - -// 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") - 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 = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 updateVPNGatewayConnectionOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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)) - - _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) - 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_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 -} - -// 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 -} - -// 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(createVPNServerOptions, "createVPNServerOptions") - 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, `/vpn_servers`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createVPNServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") - 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 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) - 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_vpn_server", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) - 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. destination of the -// packet. -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 -} - -// 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(createVPNServerRouteOptions, "createVPNServerRouteOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createVPNServerRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") - 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()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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, UnmarshalVPNServerRoute) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteVPNServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 deleteVPNServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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)) - - 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", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions") - 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, - } - - 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}/clients/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteVPNServerClientOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") - 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_vpn_server_client", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") - 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, - } - - 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/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") - 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_vpn_server_route", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range disconnectVPNClientOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient") - 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, "disconnect_vpn_client", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVPNServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") - 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_vpn_server", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getVPNServerClientOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") - 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_vpn_server_client", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getVPNServerClientConfigurationOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 getVPNServerClientConfigurationOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") - 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)) - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) - return - } - - response, err = vpc.Service.Request(request, &result) - if err != nil { - core.EnrichHTTPProblem(err, "get_vpn_server_client_configuration", 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-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()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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, UnmarshalVPNServerRoute) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVPNServerClients : List all VPN clients for a VPN server -// This request retrieves all 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 -} - -// 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(listVPNServerClientsOptions, "listVPNServerClientsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpn_server_id": *listVPNServerClientsOptions.VPNServerID, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listVPNServerClientsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") - 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 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 { - 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_vpn_server_clients", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVPNServerRoutes : List all VPN routes for a VPN server -// This request lists all 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 -} - -// 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(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listVPNServerRoutesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") - 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 { - 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_vpn_server_routes", 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 -} - -// ListVPNServers : List all VPN servers -// This request lists all 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 -} - -// 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 - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 listVPNServersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") - 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 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 { - 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_vpn_servers", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateVPNServer : Update a VPN server -// This request updates the properties of an existing VPN server. Any property changes will cause all connected VPN -// clients are disconnected from this VPN server except for the name change. -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 -} - -// 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(updateVPNServerOptions, "updateVPNServerOptions") - 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 = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 updateVPNServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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(updateVPNServerOptions.VPNServerPatch) - 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_vpn_server", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateVPNServerRouteOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") - 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()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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, UnmarshalVPNServerRoute) - 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`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createLoadBalancerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") - 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.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()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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, UnmarshalLoadBalancer) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - 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": *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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") - 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 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 { - 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", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - 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, `/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 createLoadBalancerListenerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") - 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 createLoadBalancerListenerPolicyOptions.Target != nil { - body["target"] = createLoadBalancerListenerPolicyOptions.Target - } - _, 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", 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 -} - -// 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 -} - -// 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(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") - 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, - } - - 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 -} - -// 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 -} - -// 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(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, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") - 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 createLoadBalancerPoolOptions.Algorithm != nil { - body["algorithm"] = createLoadBalancerPoolOptions.Algorithm - } - if createLoadBalancerPoolOptions.HealthMonitor != nil { - body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor - } - if createLoadBalancerPoolOptions.Protocol != nil { - body["protocol"] = createLoadBalancerPoolOptions.Protocol - } - if createLoadBalancerPoolOptions.Members != nil { - body["members"] = createLoadBalancerPoolOptions.Members - } - 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 { - 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_pool", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - 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, `/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 createLoadBalancerPoolMemberOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") - 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()) - return - } - - 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 -} - -// 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 -} - -// 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(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteLoadBalancerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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)) - - 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_load_balancer", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - 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": *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}/listeners/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") - 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_load_balancer_listener", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") - 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_load_balancer_listener_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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, `/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 deleteLoadBalancerListenerPolicyRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") - 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_load_balancer_listener_policy_rule", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") - 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_load_balancer_pool", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") - 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_load_balancer_pool_member", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getLoadBalancerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") - 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_load_balancer", 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 -} - -// 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 -} - -// 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(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") - 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_load_balancer_listener", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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)) - - 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_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 -} - -// 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 -} - -// 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(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") - 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_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 -} - -// 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 -} - -// 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(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") - 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_load_balancer_pool", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") - 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_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 -} - -// 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(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "name": *getLoadBalancerProfileOptions.Name, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") - 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_load_balancer_profile", 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 -} - -// GetLoadBalancerStatistics : List all 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 -} - -// 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") - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") - 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_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 -} - -// ListLoadBalancerListenerPolicies : List all policies for a load balancer listener -// This request lists all 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 -} - -// 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, `/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 listLoadBalancerListenerPoliciesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") - 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, "list_load_balancer_listener_policies", 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 -} - -// ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy -// This request lists all 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 -} - -// 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(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") - 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, "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, UnmarshalLoadBalancerListenerPolicyRuleCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListLoadBalancerListeners : List all listeners for a load balancer -// This request lists all 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 - } - - pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, - } - - 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 - } - - for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") - 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, "list_load_balancer_listeners", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListLoadBalancerPoolMembers : List all members of a load balancer pool -// This request lists all 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 -} - -// 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, `/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 listLoadBalancerPoolMembersOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") - 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, "list_load_balancer_pool_members", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListLoadBalancerPools : List all pools of a load balancer -// This request lists all 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 -} - -// 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, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") - 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, "list_load_balancer_pools", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListLoadBalancerProfiles : List all load balancer profiles -// This request lists all 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 -} - -// 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 -} - -// ListLoadBalancers : List all load balancers -// This request lists all 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 -} - -// 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, "", "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_balancers`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - 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 -} - -// 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 { - 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, "replace_load_balancer_pool_members", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateLoadBalancerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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(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) - if err != nil { - 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, UnmarshalLoadBalancer) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - 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": *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}/listeners/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") - 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(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) - 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_load_balancer_listener", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") - 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, - } - - 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/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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, UnmarshalLoadBalancerListenerPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") - 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(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) - 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_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 -} - -// 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 -} - -// 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(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") - 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(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) - 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_load_balancer_pool", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") - 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(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) - 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_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 -} - -// 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") - 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, - } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 addEndpointGatewayIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") - 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, "add_endpoint_gateway_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") - 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, `/endpoint_gateways`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createEndpointGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") - 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 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 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 { - 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_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 -} - -// 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 -} - -// 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(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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, `/endpoint_gateways/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getEndpointGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") - 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_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 -} - -// 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 -} - -// 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(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") - 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_endpoint_gateway_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway -// This request lists all 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 -} - -// 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(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, - } - - 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`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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 { - 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_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 -} - -// ListEndpointGateways : List all endpoint gateways -// This request lists all 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 -} - -// 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 - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 listEndpointGatewaysOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") - 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 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.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 { - 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_endpoint_gateways", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") - 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, - } - - 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/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") - 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, "remove_endpoint_gateway_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateEndpointGatewayOptions.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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateEndpointGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") - 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(updateEndpointGatewayOptions.EndpointGatewayPatch) - 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_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 -} - -// 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, `/flow_log_collectors`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createFlowLogCollectorOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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 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 { - 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_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 -} - -// 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 -} - -// 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(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteFlowLogCollectorOptions.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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") - 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_flow_log_collector", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getFlowLogCollectorOptions.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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getFlowLogCollectorOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") - 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_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 -} - -// ListFlowLogCollectors : List all flow log collectors -// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over the instance -// network interfaces and instance network attachments contained within its target. -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 -} - -// 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, "", "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, `/flow_log_collectors`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - 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 -} - -// 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 -} - -// 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(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateFlowLogCollectorOptions.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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateFlowLogCollectorOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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 - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - 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, "2023-12-05") -} - -// 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 { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - 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 { - // Collection of address prefixes. - AddressPrefixes []AddressPrefix `json:"address_prefixes" validate:"required"` - - // A link to the first page of resources. - First *AddressPrefixCollectionFirst `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 *AddressPrefixCollectionNext `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, UnmarshalAddressPrefixCollectionFirst) - 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, UnmarshalAddressPrefixCollectionNext) - 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 -} - -// 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"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "href-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"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "href-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"` - - // 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) { - var jsonData []byte - jsonData, err = json.Marshal(addressPrefixPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - 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 { - // Collection of backup policies. - BackupPolicies []BackupPolicyIntf `json:"backup_policies" validate:"required"` - - // A link to the first page of resources. - First *BackupPolicyCollectionFirst `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"` - - // 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, UnmarshalBackupPolicyCollectionFirst) - 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, UnmarshalBackupPolicyCollectionNext) - 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 -} - -// 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 -} - -// 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"` -} - -// 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 -} - -// 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"` -} - -// 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 -} - -// 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. - 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"` -} - -// 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 -} - -// BackupPolicyJobCollection : BackupPolicyJobCollection struct -type BackupPolicyJobCollection struct { - // A link to the first page of resources. - First *BackupPolicyJobCollectionFirst `json:"first" validate:"required"` - - // Collection of backup policy jobs. - 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 *BackupPolicyJobCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" 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) - 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, UnmarshalBackupPolicyJobCollectionNext) - 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 *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 -} - -// 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"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - 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) - if err != nil { - err = core.SDKErrorf(err, "", "href-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)). -// 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 *VolumeReferenceDeleted `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"` -} - -// Constants associated with the BackupPolicyJobSource.ResourceType property. -// The resource type. -const ( - BackupPolicyJobSourceResourceTypeVolumeConst = "volume" -) - -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, UnmarshalVolumeReferenceDeleted) - 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_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) - // - // 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_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) -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error" - BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" - BackupPolicyJobStatusReasonCodeSnapshotVolumeLimitConst = "snapshot_volume_limit" - BackupPolicyJobStatusReasonCodeSourceVolumeBusyConst = "source_volume_busy" -) - -// 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) { - 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 -} - -// 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"` - - // 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 *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 lifecycle state of this backup policy plan. - LifecycleState *string `json:"lifecycle_state" 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 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"` -} - -// 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, "", "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) - 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()) - 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 -} - -// 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 *BackupPolicyPlanCollectionFirst `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 *BackupPolicyPlanCollectionNext `json:"next,omitempty"` - - // Collection of backup policy plans. - 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, UnmarshalBackupPolicyPlanCollectionFirst) - 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, UnmarshalBackupPolicyPlanCollectionNext) - 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 -} - -// 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 - } - 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) - if err != nil { - err = core.SDKErrorf(err, "", "href-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 -} - -// 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) { - 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 -} - -// 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, "", "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, UnmarshalBackupPolicyPlanDeletionTriggerPrototype) - 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 -} - -// BackupPolicyPlanReference : BackupPolicyPlanReference struct -type BackupPolicyPlanReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BackupPolicyPlanReferenceDeleted `json:"deleted,omitempty"` - - // 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 name for this backup policy plan. The name is unique across all plans in the backup policy. - 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 resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// 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, UnmarshalBackupPolicyPlanReferenceDeleted) - 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, UnmarshalBackupPolicyPlanRemote) - 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 -} - -// BackupPolicyPlanReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BackupPolicyPlanReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBackupPolicyPlanReferenceDeleted unmarshals an instance of BackupPolicyPlanReferenceDeleted from the specified map of raw messages. -func UnmarshalBackupPolicyPlanReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanReferenceDeleted) - 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 -} - -// 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, "", "region-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - 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"` - - // 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"` -} - -// 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, "", "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 -} - -// 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"` -} - -// 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, "", "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 -} - -// 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"` -} - -// 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, "", "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, 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 -} - -// 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, "", "resource_type-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) - 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 bare metal server. - CRN *string `json:"crn" 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"` - - // 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 bare metal server. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server. - ID *string `json:"id" validate:"required"` - - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []BareMetalServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the bare metal server. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // 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. - // - // 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 primary network attachment for this bare metal server. - PrimaryNetworkAttachment *BareMetalServerNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` - - // 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 [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 bare metal server. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the bare metal server. - 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 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. -// The resource type. -const ( - BareMetalServerResourceTypeBareMetalServerConst = "bare_metal_server" -) - -// Constants associated with the BareMetalServer.Status property. -// The status of the bare metal server. -const ( - BareMetalServerStatusDeletingConst = "deleting" - BareMetalServerStatusFailedConst = "failed" - BareMetalServerStatusMaintenanceConst = "maintenance" - BareMetalServerStatusPendingConst = "pending" - BareMetalServerStatusRestartingConst = "restarting" - BareMetalServerStatusRunningConst = "running" - BareMetalServerStatusStartingConst = "starting" - BareMetalServerStatusStoppedConst = "stopped" - BareMetalServerStatusStoppingConst = "stopping" -) - -// 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()) - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) - if err != nil { - err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) - if err != nil { - err = core.SDKErrorf(err, "", "enable_secure_boot-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, UnmarshalBareMetalServerLifecycleReason) - 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, "memory", &obj.Memory) - if err != nil { - err = core.SDKErrorf(err, "", "memory-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, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentReference) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) - if err != nil { - 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) - 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.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, UnmarshalBareMetalServerStatusReason) - if err != nil { - 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 -} - -// 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 *BareMetalServerDiskReferenceDeleted `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, UnmarshalBareMetalServerDiskReferenceDeleted) - 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 { - // Collection of bare metal servers. - BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` - - // A link to the first page of resources. - First *BareMetalServerCollectionFirst `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"` - - // 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) - 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, UnmarshalBareMetalServerCollectionNext) - 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 *BareMetalServerCollection) 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 -} - -// 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"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "href-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"` -} - -// 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) - 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"` - - // The bare metal server console type for which this token may be used. - ConsoleType *string `json:"console_type" validate:"required"` - - // The date and time that the access token was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The date and time that the access token will expire. - ExpiresAt *strfmt.DateTime `json:"expires_at" 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"` - - // The URL to access this bare metal server console. - Href *string `json:"href" validate:"required"` -} - -// Constants associated with the BareMetalServerConsoleAccessToken.ConsoleType property. -// The bare metal server console type for which this token may be used. -const ( - BareMetalServerConsoleAccessTokenConsoleTypeSerialConst = "serial" - BareMetalServerConsoleAccessTokenConsoleTypeVncConst = "vnc" -) - -// 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, "", "access_token-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) - if err != nil { - err = core.SDKErrorf(err, "", "console_type-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, "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 -} - -// 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 bare metal server disk. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server disk. - ID *string `json:"id" validate:"required"` - - // The disk interface used for attaching the disk: - // - `fcp`: Attached using Fiber Channel Protocol - // - `sata`: Attached using Serial Advanced Technology Attachment - // - `nvme`: Attached using 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 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 size of the disk in GB (gigabytes). - Size *int64 `json:"size" validate:"required"` -} - -// Constants associated with the BareMetalServerDisk.InterfaceType property. -// The disk interface used for attaching the disk: -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using 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 ( - BareMetalServerDiskInterfaceTypeFcpConst = "fcp" - BareMetalServerDiskInterfaceTypeNvmeConst = "nvme" - BareMetalServerDiskInterfaceTypeSataConst = "sata" -) - -// Constants associated with the BareMetalServerDisk.ResourceType property. -// The resource type. -const ( - BareMetalServerDiskResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" -) - -// 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()) - 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, "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.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerDiskCollection : BareMetalServerDiskCollection struct -type BareMetalServerDiskCollection struct { - // Collection of the bare metal server's disks. - 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, "", "disks-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. - 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, "", "name-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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// BareMetalServerDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerDiskReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerDiskReferenceDeleted unmarshals an instance of BareMetalServerDiskReferenceDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDiskReferenceDeleted) - 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 -} - -// 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, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) - if err != nil { - err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "user_accounts", &obj.UserAccounts, UnmarshalBareMetalServerInitializationUserAccount) - if err != nil { - err = core.SDKErrorf(err, "", "user_accounts-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"` - - // 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. - UserData *string `json:"user_data,omitempty"` -} - -// 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 -} - -// 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, "", "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 -} - -// 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"` - - // 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 BareMetalServerInitializationUserAccount.ResourceType property. -// The resource type. -const ( - BareMetalServerInitializationUserAccountResourceTypeHostUserAccountConst = "host_user_account" -) - -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) - if err != nil { - err = core.SDKErrorf(err, "", "encrypted_password-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) - if err != nil { - err = core.SDKErrorf(err, "", "encryption_key-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, "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"` - - // 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 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 ( - BareMetalServerLifecycleReasonCodeInternalErrorConst = "internal_error" - BareMetalServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// 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()) - 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 -} - -// 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"` - - // The lifecycle state of the bare metal server network attachment. - LifecycleState *string `json:"lifecycle_state" 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 port speed for this bare metal server network attachment in Mbps. - PortSpeed *int64 `json:"port_speed" 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 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 bare metal server network attachment type. - Type *string `json:"type" validate:"required"` - - // The virtual network interface for this bare metal server network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` - - // The VLAN IDs allowed 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"` -} - -// 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" -) - -// 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 ( - BareMetalServerNetworkAttachmentResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" -) - -// Constants associated with the BareMetalServerNetworkAttachment.Type property. -// The bare metal server network attachment type. -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, "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, "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()) - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "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.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-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 - } - 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, "allow_to_float", &obj.AllowToFloat) - if err != nil { - err = core.SDKErrorf(err, "", "allow_to_float-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) - if err != nil { - err = core.SDKErrorf(err, "", "vlan-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"` - - // Collection of bare metal server network attachments. - 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 *BareMetalServerNetworkAttachmentCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkAttachmentCollectionNext) - 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 *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 -} - -// 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"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "href-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"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "href-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"` - - // 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"` -} - -// 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) - 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 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// 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 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"` -} - -// 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 { - return true -} - -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, "", "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, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interface-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, "allow_to_float", &obj.AllowToFloat) - if err != nil { - err = core.SDKErrorf(err, "", "allow_to_float-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "vlan", &obj.Vlan) - if err != nil { - err = core.SDKErrorf(err, "", "vlan-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"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. - AutoDelete *bool `json:"auto_delete,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"` - - // 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"` - - // 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 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"` - - // 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 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"` -} - -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.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalVirtualNetworkInterfaceIPPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ips-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, UnmarshalVirtualNetworkInterfacePrimaryIPPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_ip-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) - 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()) - 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 -} - -// BareMetalServerNetworkAttachmentReference : BareMetalServerNetworkAttachmentReference struct -type BareMetalServerNetworkAttachmentReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BareMetalServerNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` - - // 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 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 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"` -} - -// Constants associated with the BareMetalServerNetworkAttachmentReference.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkAttachmentReferenceResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" -) - -// 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, UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted) - 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerNetworkAttachmentReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted unmarshals an instance of BareMetalServerNetworkAttachmentReferenceDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentReferenceDeleted) - 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 -} - -// 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 an empty string. - // - // 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) - 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()) - return - } - 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 -} - -// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct -type BareMetalServerNetworkInterfaceCollection struct { - // A link to the first page of resources. - First *BareMetalServerNetworkInterfaceCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // Collection of bare metal server network interfaces. - 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"` - - // 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) - 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, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) - 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 *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 -} - -// 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 -} - -// 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"` - - // 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"` -} - -// 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, "", "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, "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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - 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) - 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()) - return - } - 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, 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()) - } - return -} - -// BareMetalServerNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerNetworkInterfaceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceReferenceDeleted) - 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 -} - -// BareMetalServerNetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerNetworkInterfaceReferenceTargetContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceReferenceTargetContextDeleted) - 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 -} - -// BareMetalServerPatch : BareMetalServerPatch struct -type BareMetalServerPatch struct { - // 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, "enable_secure_boot", &obj.EnableSecureBoot) - if err != nil { - err = core.SDKErrorf(err, "", "enable_secure_boot-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, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) - if err != nil { - err = core.SDKErrorf(err, "", "trusted_platform_module-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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// 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. - // - // 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 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 ( - BareMetalServerPrimaryNetworkAttachmentPrototypeInterfaceTypePciConst = "pci" -) - -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) - 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, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interface-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 - } - 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"` - - // 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`. - InterfaceType *string `json:"interface_type,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 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"` -} - -// 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" -) - -// 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 -} - -// 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 -} - -// 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"` - - // Collection of the bare metal server profile's disks. - Disks []BareMetalServerProfileDisk `json:"disks" validate:"required"` - - // The product family this bare metal server profile belongs to. - Family *string `json:"family" validate:"required"` - - // The URL for this bare metal server profile. - Href *string `json:"href" validate:"required"` - - Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` - - // The name for this bare metal server profile. - 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 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"` -} - -// Constants associated with the BareMetalServerProfile.ResourceType property. -// The resource type. -const ( - BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" -) - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "family-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.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) - if err != nil { - err = core.SDKErrorf(err, "", "memory-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, "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) - if err != nil { - err = core.SDKErrorf(err, "", "os_architecture-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, "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) - if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interfaces_supported-error", common.GetComponentInfo()) - return - } - 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, "", "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, "", "values-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"` - - // 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, "", "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, "value", &obj.Value) - if err != nil { - err = core.SDKErrorf(err, "", "value-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 -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "values-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"` - - // 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 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, "", "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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct -type BareMetalServerProfileCollection struct { - // A link to the first page of resources. - First *BareMetalServerProfileCollectionFirst `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"` - - // Collection 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"` -} - -// 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) - 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, UnmarshalBareMetalServerProfileCollectionNext) - 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()) - 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 *BareMetalServerProfileCollection) 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 -} - -// 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 -} - -// 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"` -} - -// 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 -} - -// 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"` -} - -// 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, "", "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 -} - -// 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"` -} - -// 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, "", "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 -} - -// 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"` - - // 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 BareMetalServerProfileDiskQuantity.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" -) - -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) - 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, "", "values-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"` - - // 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 BareMetalServerProfileDiskSize.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { - return true -} - -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, "", "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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct -type BareMetalServerProfileDiskSupportedInterfaces struct { - // The disk interface used for attaching the disk: - // - `fcp`: Attached using Fiber Channel Protocol - // - `sata`: Attached using Serial Advanced Technology Attachment - // - `nvme`: Attached using Non-Volatile Memory Express - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - 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"` -} - -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. -// The disk interface used for attaching the disk: -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using 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 ( - 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 interface used for attaching the disk: -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using 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, "", "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 -} - -// 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"` -} - -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 -} - -// 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, "", "values-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"` - - // The type for this profile field. - Type *string `json:"type,omitempty"` -} - -// Constants associated with the BareMetalServerProfileNetworkAttachmentCount.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileNetworkAttachmentCountTypeRangeConst = "range" -) - -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, "", "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 -} - -// 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 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 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, "", "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 -} - -// 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) - 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 -} - -// BareMetalServerProfileReference : BareMetalServerProfileReference struct -type BareMetalServerProfileReference struct { - // The URL for this bare metal server profile. - Href *string `json:"href" 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"` -} - -// Constants associated with the BareMetalServerProfileReference.ResourceType property. -// The resource type. -const ( - BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" -) - -// 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, "", "href-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 -} - -// BareMetalServerProfileSupportedTrustedPlatformModuleModes : The supported trusted platform module modes for this bare metal server profile. -type BareMetalServerProfileSupportedTrustedPlatformModuleModes struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The supported trusted platform module modes. - Values []string `json:"values" validate:"required"` -} - -// 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 ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" -) - -// 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, "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 -} - -// 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) - 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 -} - -// BareMetalServerPrototype : BareMetalServerPrototype struct -// Models which "extend" this model: -// - BareMetalServerPrototypeBareMetalServerByNetworkAttachment -// - BareMetalServerPrototypeBareMetalServerByNetworkInterface -type BareMetalServerPrototype struct { - // 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, "enable_secure_boot", &obj.EnableSecureBoot) - if err != nil { - err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "initialization-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, "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) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-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 - // - // 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 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 -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" - BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" - BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" - BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" - BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" -) - -// 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, "", "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 -} - -// 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.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) - if err != nil { - err = core.SDKErrorf(err, "", "supported_modes-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 - } - 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`. - 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`. -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 - } - 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"` -} - -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, "", "crn-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) - if err != nil { - err = core.SDKErrorf(err, "", "crn-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) - if err != nil { - err = core.SDKErrorf(err, "", "crn-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) - if err != nil { - err = core.SDKErrorf(err, "", "crn-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 -} - -// 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 of this Cloud Object Storage bucket. - CRN *string `json:"crn,omitempty"` -} - -func (*CloudObjectStorageBucketIdentity) isaCloudObjectStorageBucketIdentity() bool { - return true -} - -type CloudObjectStorageBucketIdentityIntf interface { - isaCloudObjectStorageBucketIdentity() 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) - if err != nil { - err = core.SDKErrorf(err, "", "name-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 -} - -// 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, "", "crn-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 -} - -// 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, "", "name-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CreateBackupPolicyOptions : The CreateBackupPolicy options. -type CreateBackupPolicyOptions struct { - // The backup policy prototype object. - BackupPolicyPrototype BackupPolicyPrototypeIntf `json:"BackupPolicyPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateBackupPolicyOptions : Instantiate CreateBackupPolicyOptions -func (*VpcV1) NewCreateBackupPolicyOptions(backupPolicyPrototype BackupPolicyPrototypeIntf) *CreateBackupPolicyOptions { - return &CreateBackupPolicyOptions{ - BackupPolicyPrototype: backupPolicyPrototype, - } -} - -// SetBackupPolicyPrototype : Allow user to set BackupPolicyPrototype -func (_options *CreateBackupPolicyOptions) SetBackupPolicyPrototype(backupPolicyPrototype BackupPolicyPrototypeIntf) *CreateBackupPolicyOptions { - _options.BackupPolicyPrototype = backupPolicyPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateBackupPolicyOptions) SetHeaders(param map[string]string) *CreateBackupPolicyOptions { - options.Headers = param - return options -} - -// CreateBackupPolicyPlanOptions : The CreateBackupPolicyPlan options. -type CreateBackupPolicyPlanOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - - // 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"` - - // 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"` - - 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"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateBackupPolicyPlanOptions : Instantiate CreateBackupPolicyPlanOptions -func (*VpcV1) NewCreateBackupPolicyPlanOptions(backupPolicyID string, cronSpec string) *CreateBackupPolicyPlanOptions { - return &CreateBackupPolicyPlanOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - CronSpec: core.StringPtr(cronSpec), - } -} - -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *CreateBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *CreateBackupPolicyPlanOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options -} - -// SetCronSpec : Allow user to set CronSpec -func (_options *CreateBackupPolicyPlanOptions) SetCronSpec(cronSpec string) *CreateBackupPolicyPlanOptions { - _options.CronSpec = core.StringPtr(cronSpec) - return _options -} - -// SetActive : Allow user to set Active -func (_options *CreateBackupPolicyPlanOptions) SetActive(active bool) *CreateBackupPolicyPlanOptions { - _options.Active = core.BoolPtr(active) - return _options -} - -// SetAttachUserTags : Allow user to set AttachUserTags -func (_options *CreateBackupPolicyPlanOptions) SetAttachUserTags(attachUserTags []string) *CreateBackupPolicyPlanOptions { - _options.AttachUserTags = attachUserTags - return _options -} - -// SetClonePolicy : Allow user to set ClonePolicy -func (_options *CreateBackupPolicyPlanOptions) SetClonePolicy(clonePolicy *BackupPolicyPlanClonePolicyPrototype) *CreateBackupPolicyPlanOptions { - _options.ClonePolicy = clonePolicy - return _options -} - -// SetCopyUserTags : Allow user to set CopyUserTags -func (_options *CreateBackupPolicyPlanOptions) SetCopyUserTags(copyUserTags bool) *CreateBackupPolicyPlanOptions { - _options.CopyUserTags = core.BoolPtr(copyUserTags) - return _options -} - -// SetDeletionTrigger : Allow user to set DeletionTrigger -func (_options *CreateBackupPolicyPlanOptions) SetDeletionTrigger(deletionTrigger *BackupPolicyPlanDeletionTriggerPrototype) *CreateBackupPolicyPlanOptions { - _options.DeletionTrigger = deletionTrigger - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateBackupPolicyPlanOptions) SetName(name string) *CreateBackupPolicyPlanOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetRemoteRegionPolicies : Allow user to set RemoteRegionPolicies -func (_options *CreateBackupPolicyPlanOptions) SetRemoteRegionPolicies(remoteRegionPolicies []BackupPolicyPlanRemoteRegionPolicyPrototype) *CreateBackupPolicyPlanOptions { - _options.RemoteRegionPolicies = remoteRegionPolicies - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *CreateBackupPolicyPlanOptions { - options.Headers = param - return options -} - -// CreateBareMetalServerConsoleAccessTokenOptions : The CreateBareMetalServerConsoleAccessToken options. -type CreateBareMetalServerConsoleAccessTokenOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server console type for which this token may be used - // - // Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`. - ConsoleType *string `json:"console_type" 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,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateBareMetalServerConsoleAccessTokenOptions.ConsoleType property. -// The bare metal server console type for which this token may be used -// -// Must be `serial` for bare metal servers with a `cpu.architecture` of `s390x`. -const ( - CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeSerialConst = "serial" - CreateBareMetalServerConsoleAccessTokenOptionsConsoleTypeVncConst = "vnc" -) - -// NewCreateBareMetalServerConsoleAccessTokenOptions : Instantiate CreateBareMetalServerConsoleAccessTokenOptions -func (*VpcV1) NewCreateBareMetalServerConsoleAccessTokenOptions(bareMetalServerID string, consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions { - return &CreateBareMetalServerConsoleAccessTokenOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ConsoleType: core.StringPtr(consoleType), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerConsoleAccessTokenOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetConsoleType : Allow user to set ConsoleType -func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetConsoleType(consoleType string) *CreateBareMetalServerConsoleAccessTokenOptions { - _options.ConsoleType = core.StringPtr(consoleType) - return _options -} - -// SetForce : Allow user to set Force -func (_options *CreateBareMetalServerConsoleAccessTokenOptions) SetForce(force bool) *CreateBareMetalServerConsoleAccessTokenOptions { - _options.Force = core.BoolPtr(force) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateBareMetalServerConsoleAccessTokenOptions) SetHeaders(param map[string]string) *CreateBareMetalServerConsoleAccessTokenOptions { - options.Headers = param - return options -} - -// CreateBareMetalServerNetworkAttachmentOptions : The CreateBareMetalServerNetworkAttachment options. -type CreateBareMetalServerNetworkAttachmentOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network attachment prototype object. - BareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf `json:"BareMetalServerNetworkAttachmentPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateBareMetalServerNetworkAttachmentOptions : Instantiate CreateBareMetalServerNetworkAttachmentOptions -func (*VpcV1) NewCreateBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, bareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf) *CreateBareMetalServerNetworkAttachmentOptions { - return &CreateBareMetalServerNetworkAttachmentOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - BareMetalServerNetworkAttachmentPrototype: bareMetalServerNetworkAttachmentPrototype, - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *CreateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkAttachmentOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetBareMetalServerNetworkAttachmentPrototype : Allow user to set BareMetalServerNetworkAttachmentPrototype -func (_options *CreateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerNetworkAttachmentPrototype(bareMetalServerNetworkAttachmentPrototype BareMetalServerNetworkAttachmentPrototypeIntf) *CreateBareMetalServerNetworkAttachmentOptions { - _options.BareMetalServerNetworkAttachmentPrototype = bareMetalServerNetworkAttachmentPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkAttachmentOptions { - options.Headers = param - return options -} - -// CreateBareMetalServerNetworkInterfaceOptions : The CreateBareMetalServerNetworkInterface options. -type CreateBareMetalServerNetworkInterfaceOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network interface prototype object. - BareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf `json:"BareMetalServerNetworkInterfacePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateBareMetalServerNetworkInterfaceOptions : Instantiate CreateBareMetalServerNetworkInterfaceOptions -func (*VpcV1) NewCreateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { - return &CreateBareMetalServerNetworkInterfaceOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - BareMetalServerNetworkInterfacePrototype: bareMetalServerNetworkInterfacePrototype, - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *CreateBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetBareMetalServerNetworkInterfacePrototype : Allow user to set BareMetalServerNetworkInterfacePrototype -func (_options *CreateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePrototype(bareMetalServerNetworkInterfacePrototype BareMetalServerNetworkInterfacePrototypeIntf) *CreateBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerNetworkInterfacePrototype = bareMetalServerNetworkInterfacePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateBareMetalServerNetworkInterfaceOptions { - options.Headers = param - return options -} - -// CreateBareMetalServerOptions : The CreateBareMetalServer options. -type CreateBareMetalServerOptions struct { - // The bare metal server prototype object. - BareMetalServerPrototype BareMetalServerPrototypeIntf `json:"BareMetalServerPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateBareMetalServerOptions : Instantiate CreateBareMetalServerOptions -func (*VpcV1) NewCreateBareMetalServerOptions(bareMetalServerPrototype BareMetalServerPrototypeIntf) *CreateBareMetalServerOptions { - return &CreateBareMetalServerOptions{ - BareMetalServerPrototype: bareMetalServerPrototype, - } -} - -// SetBareMetalServerPrototype : Allow user to set BareMetalServerPrototype -func (_options *CreateBareMetalServerOptions) SetBareMetalServerPrototype(bareMetalServerPrototype BareMetalServerPrototypeIntf) *CreateBareMetalServerOptions { - _options.BareMetalServerPrototype = bareMetalServerPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateBareMetalServerOptions) SetHeaders(param map[string]string) *CreateBareMetalServerOptions { - options.Headers = param - return options -} - -// CreateDedicatedHostGroupOptions : The CreateDedicatedHostGroup options. -type CreateDedicatedHostGroupOptions struct { - // The dedicated host profile class for hosts in this group. - Class *string `json:"class" validate:"required"` - - // The dedicated host profile family for hosts in this group. - Family *string `json:"family" validate:"required"` - - // The zone this dedicated host group will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. 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"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateDedicatedHostGroupOptions.Family property. -// The dedicated host profile family for hosts in this group. -const ( - CreateDedicatedHostGroupOptionsFamilyBalancedConst = "balanced" - CreateDedicatedHostGroupOptionsFamilyComputeConst = "compute" - CreateDedicatedHostGroupOptionsFamilyMemoryConst = "memory" -) - -// NewCreateDedicatedHostGroupOptions : Instantiate CreateDedicatedHostGroupOptions -func (*VpcV1) NewCreateDedicatedHostGroupOptions(class string, family string, zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions { - return &CreateDedicatedHostGroupOptions{ - Class: core.StringPtr(class), - Family: core.StringPtr(family), - Zone: zone, - } -} - -// SetClass : Allow user to set Class -func (_options *CreateDedicatedHostGroupOptions) SetClass(class string) *CreateDedicatedHostGroupOptions { - _options.Class = core.StringPtr(class) - return _options -} - -// SetFamily : Allow user to set Family -func (_options *CreateDedicatedHostGroupOptions) SetFamily(family string) *CreateDedicatedHostGroupOptions { - _options.Family = core.StringPtr(family) - return _options -} - -// SetZone : Allow user to set Zone -func (_options *CreateDedicatedHostGroupOptions) SetZone(zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions { - _options.Zone = zone - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateDedicatedHostGroupOptions) SetName(name string) *CreateDedicatedHostGroupOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateDedicatedHostGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateDedicatedHostGroupOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateDedicatedHostGroupOptions) SetHeaders(param map[string]string) *CreateDedicatedHostGroupOptions { - options.Headers = param - return options -} - -// CreateDedicatedHostOptions : The CreateDedicatedHost options. -type CreateDedicatedHostOptions struct { - // The dedicated host prototype object. - DedicatedHostPrototype DedicatedHostPrototypeIntf `json:"DedicatedHostPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateDedicatedHostOptions : Instantiate CreateDedicatedHostOptions -func (*VpcV1) NewCreateDedicatedHostOptions(dedicatedHostPrototype DedicatedHostPrototypeIntf) *CreateDedicatedHostOptions { - return &CreateDedicatedHostOptions{ - DedicatedHostPrototype: dedicatedHostPrototype, - } -} - -// SetDedicatedHostPrototype : Allow user to set DedicatedHostPrototype -func (_options *CreateDedicatedHostOptions) SetDedicatedHostPrototype(dedicatedHostPrototype DedicatedHostPrototypeIntf) *CreateDedicatedHostOptions { - _options.DedicatedHostPrototype = dedicatedHostPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateDedicatedHostOptions) SetHeaders(param map[string]string) *CreateDedicatedHostOptions { - options.Headers = param - return options -} - -// CreateEndpointGatewayOptions : The CreateEndpointGateway options. -type CreateEndpointGatewayOptions struct { - // The target to use for this endpoint gateway. Must not already be the target of another - // endpoint gateway in the VPC. - Target EndpointGatewayTargetPrototypeIntf `json:"target" validate:"required"` - - // The VPC this endpoint gateway will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in - // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. - // - // Must be `true` if the VPC this endpoint gateway resides in has `dns.enable_hub` set to - // `true`. - AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` - - // The reserved IPs to bind to this endpoint gateway. At most one reserved IP per zone is allowed. - Ips []EndpointGatewayReservedIPIntf `json:"ips,omitempty"` - - // The name for this endpoint gateway. The name must not be used by another endpoint gateway in the VPC. 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"` - - // 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 - Headers map[string]string -} - -// NewCreateEndpointGatewayOptions : Instantiate CreateEndpointGatewayOptions -func (*VpcV1) NewCreateEndpointGatewayOptions(target EndpointGatewayTargetPrototypeIntf, vpc VPCIdentityIntf) *CreateEndpointGatewayOptions { - return &CreateEndpointGatewayOptions{ - Target: target, - VPC: vpc, - } -} - -// SetTarget : Allow user to set Target -func (_options *CreateEndpointGatewayOptions) SetTarget(target EndpointGatewayTargetPrototypeIntf) *CreateEndpointGatewayOptions { - _options.Target = target - return _options -} - -// SetVPC : Allow user to set VPC -func (_options *CreateEndpointGatewayOptions) SetVPC(vpc VPCIdentityIntf) *CreateEndpointGatewayOptions { - _options.VPC = vpc - return _options -} - -// SetAllowDnsResolutionBinding : Allow user to set AllowDnsResolutionBinding -func (_options *CreateEndpointGatewayOptions) SetAllowDnsResolutionBinding(allowDnsResolutionBinding bool) *CreateEndpointGatewayOptions { - _options.AllowDnsResolutionBinding = core.BoolPtr(allowDnsResolutionBinding) - return _options -} - -// SetIps : Allow user to set Ips -func (_options *CreateEndpointGatewayOptions) SetIps(ips []EndpointGatewayReservedIPIntf) *CreateEndpointGatewayOptions { - _options.Ips = ips - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateEndpointGatewayOptions) SetName(name string) *CreateEndpointGatewayOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateEndpointGatewayOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateEndpointGatewayOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetSecurityGroups : Allow user to set SecurityGroups -func (_options *CreateEndpointGatewayOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateEndpointGatewayOptions { - _options.SecurityGroups = securityGroups - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateEndpointGatewayOptions) SetHeaders(param map[string]string) *CreateEndpointGatewayOptions { - options.Headers = param - return options -} - -// CreateFloatingIPOptions : The CreateFloatingIP options. -type CreateFloatingIPOptions struct { - // The floating IP prototype object. - FloatingIPPrototype FloatingIPPrototypeIntf `json:"FloatingIPPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateFloatingIPOptions : Instantiate CreateFloatingIPOptions -func (*VpcV1) NewCreateFloatingIPOptions(floatingIPPrototype FloatingIPPrototypeIntf) *CreateFloatingIPOptions { - return &CreateFloatingIPOptions{ - FloatingIPPrototype: floatingIPPrototype, - } -} - -// SetFloatingIPPrototype : Allow user to set FloatingIPPrototype -func (_options *CreateFloatingIPOptions) SetFloatingIPPrototype(floatingIPPrototype FloatingIPPrototypeIntf) *CreateFloatingIPOptions { - _options.FloatingIPPrototype = floatingIPPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateFloatingIPOptions) SetHeaders(param map[string]string) *CreateFloatingIPOptions { - options.Headers = param - return options -} - -// CreateFlowLogCollectorOptions : The CreateFlowLogCollector options. -type CreateFlowLogCollectorOptions struct { - // The Cloud Object Storage bucket where the collected flows will be logged. - // The bucket must exist and an IAM service authorization must grant - // `IBM Cloud Flow Logs` resources of `VPC Infrastructure Services` writer - // access to the bucket. For more information, see [Creating a flow log - // collector](https://cloud.ibm.com/docs/vpc?topic=vpc-ordering-flow-log-collector). - StorageBucket LegacyCloudObjectStorageBucketIdentityIntf `json:"storage_bucket" validate:"required"` - - // The target this collector will collect flow logs for. - // - // If the target is an instance, subnet, or VPC, flow logs will not be collected for any - // instance network attachments, virtual network interfaces or instance network interfaces - // within the target that are themselves the target of a more specific flow log collector. - // - // The target must not be a virtual network interface that is attached to a bare metal server - // network attachment or to a file share mount target. - Target FlowLogCollectorTargetPrototypeIntf `json:"target" validate:"required"` - - // Indicates whether this collector will be active upon creation. - Active *bool `json:"active,omitempty"` - - // The name for this flow log collector. The name must not be used by another flow log collector in the VPC. 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"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateFlowLogCollectorOptions : Instantiate CreateFlowLogCollectorOptions -func (*VpcV1) NewCreateFlowLogCollectorOptions(storageBucket LegacyCloudObjectStorageBucketIdentityIntf, target FlowLogCollectorTargetPrototypeIntf) *CreateFlowLogCollectorOptions { - return &CreateFlowLogCollectorOptions{ - StorageBucket: storageBucket, - Target: target, - } -} - -// SetStorageBucket : Allow user to set StorageBucket -func (_options *CreateFlowLogCollectorOptions) SetStorageBucket(storageBucket LegacyCloudObjectStorageBucketIdentityIntf) *CreateFlowLogCollectorOptions { - _options.StorageBucket = storageBucket - return _options -} - -// SetTarget : Allow user to set Target -func (_options *CreateFlowLogCollectorOptions) SetTarget(target FlowLogCollectorTargetPrototypeIntf) *CreateFlowLogCollectorOptions { - _options.Target = target - return _options -} - -// SetActive : Allow user to set Active -func (_options *CreateFlowLogCollectorOptions) SetActive(active bool) *CreateFlowLogCollectorOptions { - _options.Active = core.BoolPtr(active) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateFlowLogCollectorOptions) SetName(name string) *CreateFlowLogCollectorOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateFlowLogCollectorOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateFlowLogCollectorOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateFlowLogCollectorOptions) SetHeaders(param map[string]string) *CreateFlowLogCollectorOptions { - options.Headers = param - return options -} - -// CreateIkePolicyOptions : The CreateIkePolicy options. -type CreateIkePolicyOptions struct { - // The authentication algorithm. - AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` - - // The Diffie-Hellman group. - DhGroup *int64 `json:"dh_group" validate:"required"` - - // The encryption algorithm. - EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` - - // The IKE protocol version. - IkeVersion *int64 `json:"ike_version" validate:"required"` - - // The key lifetime in seconds. - KeyLifetime *int64 `json:"key_lifetime,omitempty"` - - // The name for this IKE policy. The name must not be used by another IKE policies in the region. 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"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateIkePolicyOptions.AuthenticationAlgorithm property. -// The authentication algorithm. -const ( - CreateIkePolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" - CreateIkePolicyOptionsAuthenticationAlgorithmSha384Const = "sha384" - CreateIkePolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" -) - -// Constants associated with the CreateIkePolicyOptions.EncryptionAlgorithm property. -// The encryption algorithm. -const ( - CreateIkePolicyOptionsEncryptionAlgorithmAes128Const = "aes128" - CreateIkePolicyOptionsEncryptionAlgorithmAes192Const = "aes192" - CreateIkePolicyOptionsEncryptionAlgorithmAes256Const = "aes256" -) - -// NewCreateIkePolicyOptions : Instantiate CreateIkePolicyOptions -func (*VpcV1) NewCreateIkePolicyOptions(authenticationAlgorithm string, dhGroup int64, encryptionAlgorithm string, ikeVersion int64) *CreateIkePolicyOptions { - return &CreateIkePolicyOptions{ - AuthenticationAlgorithm: core.StringPtr(authenticationAlgorithm), - DhGroup: core.Int64Ptr(dhGroup), - EncryptionAlgorithm: core.StringPtr(encryptionAlgorithm), - IkeVersion: core.Int64Ptr(ikeVersion), - } -} - -// SetAuthenticationAlgorithm : Allow user to set AuthenticationAlgorithm -func (_options *CreateIkePolicyOptions) SetAuthenticationAlgorithm(authenticationAlgorithm string) *CreateIkePolicyOptions { - _options.AuthenticationAlgorithm = core.StringPtr(authenticationAlgorithm) - return _options -} - -// SetDhGroup : Allow user to set DhGroup -func (_options *CreateIkePolicyOptions) SetDhGroup(dhGroup int64) *CreateIkePolicyOptions { - _options.DhGroup = core.Int64Ptr(dhGroup) - return _options -} - -// SetEncryptionAlgorithm : Allow user to set EncryptionAlgorithm -func (_options *CreateIkePolicyOptions) SetEncryptionAlgorithm(encryptionAlgorithm string) *CreateIkePolicyOptions { - _options.EncryptionAlgorithm = core.StringPtr(encryptionAlgorithm) - return _options -} - -// SetIkeVersion : Allow user to set IkeVersion -func (_options *CreateIkePolicyOptions) SetIkeVersion(ikeVersion int64) *CreateIkePolicyOptions { - _options.IkeVersion = core.Int64Ptr(ikeVersion) - return _options -} - -// SetKeyLifetime : Allow user to set KeyLifetime -func (_options *CreateIkePolicyOptions) SetKeyLifetime(keyLifetime int64) *CreateIkePolicyOptions { - _options.KeyLifetime = core.Int64Ptr(keyLifetime) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateIkePolicyOptions) SetName(name string) *CreateIkePolicyOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateIkePolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateIkePolicyOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateIkePolicyOptions) SetHeaders(param map[string]string) *CreateIkePolicyOptions { - options.Headers = param - return options -} - -// CreateImageExportJobOptions : The CreateImageExportJob options. -type CreateImageExportJobOptions struct { - // The image identifier. - ImageID *string `json:"image_id" validate:"required,ne="` - - // The Cloud Object Storage bucket to export the image to. The bucket must exist and an IAM - // service authorization must grant `Image Service for VPC` of - // `VPC Infrastructure Services` writer access to the bucket. - StorageBucket CloudObjectStorageBucketIdentityIntf `json:"storage_bucket" validate:"required"` - - // The format to use for the exported image. If the image is encrypted, only `qcow2` is supported. - Format *string `json:"format,omitempty"` - - // The name for this image export job. The name must not be used by another export job for the image. If unspecified, - // the name will be a hyphenated list of randomly-selected words prefixed with the first 16 characters of the parent - // image name. - // - // The exported image object name in Cloud Object Storage (`storage_object.name` in the response) will be based on this - // name. The object name will be unique within the bucket. - Name *string `json:"name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateImageExportJobOptions.Format property. -// The format to use for the exported image. If the image is encrypted, only `qcow2` is supported. -const ( - CreateImageExportJobOptionsFormatQcow2Const = "qcow2" - CreateImageExportJobOptionsFormatVhdConst = "vhd" -) - -// NewCreateImageExportJobOptions : Instantiate CreateImageExportJobOptions -func (*VpcV1) NewCreateImageExportJobOptions(imageID string, storageBucket CloudObjectStorageBucketIdentityIntf) *CreateImageExportJobOptions { - return &CreateImageExportJobOptions{ - ImageID: core.StringPtr(imageID), - StorageBucket: storageBucket, - } -} - -// SetImageID : Allow user to set ImageID -func (_options *CreateImageExportJobOptions) SetImageID(imageID string) *CreateImageExportJobOptions { - _options.ImageID = core.StringPtr(imageID) - return _options -} - -// SetStorageBucket : Allow user to set StorageBucket -func (_options *CreateImageExportJobOptions) SetStorageBucket(storageBucket CloudObjectStorageBucketIdentityIntf) *CreateImageExportJobOptions { - _options.StorageBucket = storageBucket - return _options -} - -// SetFormat : Allow user to set Format -func (_options *CreateImageExportJobOptions) SetFormat(format string) *CreateImageExportJobOptions { - _options.Format = core.StringPtr(format) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateImageExportJobOptions) SetName(name string) *CreateImageExportJobOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateImageExportJobOptions) SetHeaders(param map[string]string) *CreateImageExportJobOptions { - options.Headers = param - return options -} - -// CreateImageOptions : The CreateImage options. -type CreateImageOptions struct { - // The image prototype object. - ImagePrototype ImagePrototypeIntf `json:"ImagePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateImageOptions : Instantiate CreateImageOptions -func (*VpcV1) NewCreateImageOptions(imagePrototype ImagePrototypeIntf) *CreateImageOptions { - return &CreateImageOptions{ - ImagePrototype: imagePrototype, - } -} - -// SetImagePrototype : Allow user to set ImagePrototype -func (_options *CreateImageOptions) SetImagePrototype(imagePrototype ImagePrototypeIntf) *CreateImageOptions { - _options.ImagePrototype = imagePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateImageOptions) SetHeaders(param map[string]string) *CreateImageOptions { - options.Headers = param - return options -} - -// CreateInstanceActionOptions : The CreateInstanceAction options. -type CreateInstanceActionOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The type of action. - Type *string `json:"type" validate:"required"` - - // 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 - Headers map[string]string -} - -// Constants associated with the CreateInstanceActionOptions.Type property. -// The type of action. -const ( - CreateInstanceActionOptionsTypeRebootConst = "reboot" - CreateInstanceActionOptionsTypeStartConst = "start" - CreateInstanceActionOptionsTypeStopConst = "stop" -) - -// NewCreateInstanceActionOptions : Instantiate CreateInstanceActionOptions -func (*VpcV1) NewCreateInstanceActionOptions(instanceID string, typeVar string) *CreateInstanceActionOptions { - return &CreateInstanceActionOptions{ - InstanceID: core.StringPtr(instanceID), - Type: core.StringPtr(typeVar), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *CreateInstanceActionOptions) SetInstanceID(instanceID string) *CreateInstanceActionOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetType : Allow user to set Type -func (_options *CreateInstanceActionOptions) SetType(typeVar string) *CreateInstanceActionOptions { - _options.Type = core.StringPtr(typeVar) - return _options -} - -// SetForce : Allow user to set Force -func (_options *CreateInstanceActionOptions) SetForce(force bool) *CreateInstanceActionOptions { - _options.Force = core.BoolPtr(force) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceActionOptions) SetHeaders(param map[string]string) *CreateInstanceActionOptions { - options.Headers = param - return options -} - -// CreateInstanceConsoleAccessTokenOptions : The CreateInstanceConsoleAccessToken options. -type CreateInstanceConsoleAccessTokenOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance console type for which this token may be used. - ConsoleType *string `json:"console_type" 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,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateInstanceConsoleAccessTokenOptions.ConsoleType property. -// The instance console type for which this token may be used. -const ( - CreateInstanceConsoleAccessTokenOptionsConsoleTypeSerialConst = "serial" - CreateInstanceConsoleAccessTokenOptionsConsoleTypeVncConst = "vnc" -) - -// NewCreateInstanceConsoleAccessTokenOptions : Instantiate CreateInstanceConsoleAccessTokenOptions -func (*VpcV1) NewCreateInstanceConsoleAccessTokenOptions(instanceID string, consoleType string) *CreateInstanceConsoleAccessTokenOptions { - return &CreateInstanceConsoleAccessTokenOptions{ - InstanceID: core.StringPtr(instanceID), - ConsoleType: core.StringPtr(consoleType), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *CreateInstanceConsoleAccessTokenOptions) SetInstanceID(instanceID string) *CreateInstanceConsoleAccessTokenOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetConsoleType : Allow user to set ConsoleType -func (_options *CreateInstanceConsoleAccessTokenOptions) SetConsoleType(consoleType string) *CreateInstanceConsoleAccessTokenOptions { - _options.ConsoleType = core.StringPtr(consoleType) - return _options -} - -// SetForce : Allow user to set Force -func (_options *CreateInstanceConsoleAccessTokenOptions) SetForce(force bool) *CreateInstanceConsoleAccessTokenOptions { - _options.Force = core.BoolPtr(force) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceConsoleAccessTokenOptions) SetHeaders(param map[string]string) *CreateInstanceConsoleAccessTokenOptions { - options.Headers = param - return options -} - -// CreateInstanceGroupManagerActionOptions : The CreateInstanceGroupManagerAction options. -type CreateInstanceGroupManagerActionOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // The instance group manager action prototype object. - InstanceGroupManagerActionPrototype InstanceGroupManagerActionPrototypeIntf `json:"InstanceGroupManagerActionPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateInstanceGroupManagerActionOptions : Instantiate CreateInstanceGroupManagerActionOptions -func (*VpcV1) NewCreateInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, instanceGroupManagerActionPrototype InstanceGroupManagerActionPrototypeIntf) *CreateInstanceGroupManagerActionOptions { - return &CreateInstanceGroupManagerActionOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - InstanceGroupManagerActionPrototype: instanceGroupManagerActionPrototype, - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *CreateInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *CreateInstanceGroupManagerActionOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *CreateInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *CreateInstanceGroupManagerActionOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetInstanceGroupManagerActionPrototype : Allow user to set InstanceGroupManagerActionPrototype -func (_options *CreateInstanceGroupManagerActionOptions) SetInstanceGroupManagerActionPrototype(instanceGroupManagerActionPrototype InstanceGroupManagerActionPrototypeIntf) *CreateInstanceGroupManagerActionOptions { - _options.InstanceGroupManagerActionPrototype = instanceGroupManagerActionPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *CreateInstanceGroupManagerActionOptions { - options.Headers = param - return options -} - -// CreateInstanceGroupManagerOptions : The CreateInstanceGroupManager options. -type CreateInstanceGroupManagerOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager prototype object. - InstanceGroupManagerPrototype InstanceGroupManagerPrototypeIntf `json:"InstanceGroupManagerPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateInstanceGroupManagerOptions : Instantiate CreateInstanceGroupManagerOptions -func (*VpcV1) NewCreateInstanceGroupManagerOptions(instanceGroupID string, instanceGroupManagerPrototype InstanceGroupManagerPrototypeIntf) *CreateInstanceGroupManagerOptions { - return &CreateInstanceGroupManagerOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerPrototype: instanceGroupManagerPrototype, - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *CreateInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *CreateInstanceGroupManagerOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerPrototype : Allow user to set InstanceGroupManagerPrototype -func (_options *CreateInstanceGroupManagerOptions) SetInstanceGroupManagerPrototype(instanceGroupManagerPrototype InstanceGroupManagerPrototypeIntf) *CreateInstanceGroupManagerOptions { - _options.InstanceGroupManagerPrototype = instanceGroupManagerPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceGroupManagerOptions) SetHeaders(param map[string]string) *CreateInstanceGroupManagerOptions { - options.Headers = param - return options -} - -// CreateInstanceGroupManagerPolicyOptions : The CreateInstanceGroupManagerPolicy options. -type CreateInstanceGroupManagerPolicyOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // The instance group manager policy prototype object. - InstanceGroupManagerPolicyPrototype InstanceGroupManagerPolicyPrototypeIntf `json:"InstanceGroupManagerPolicyPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateInstanceGroupManagerPolicyOptions : Instantiate CreateInstanceGroupManagerPolicyOptions -func (*VpcV1) NewCreateInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, instanceGroupManagerPolicyPrototype InstanceGroupManagerPolicyPrototypeIntf) *CreateInstanceGroupManagerPolicyOptions { - return &CreateInstanceGroupManagerPolicyOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - InstanceGroupManagerPolicyPrototype: instanceGroupManagerPolicyPrototype, - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *CreateInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *CreateInstanceGroupManagerPolicyOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *CreateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *CreateInstanceGroupManagerPolicyOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetInstanceGroupManagerPolicyPrototype : Allow user to set InstanceGroupManagerPolicyPrototype -func (_options *CreateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerPolicyPrototype(instanceGroupManagerPolicyPrototype InstanceGroupManagerPolicyPrototypeIntf) *CreateInstanceGroupManagerPolicyOptions { - _options.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *CreateInstanceGroupManagerPolicyOptions { - options.Headers = param - return options -} - -// CreateInstanceGroupOptions : The CreateInstanceGroup options. -type CreateInstanceGroupOptions struct { - // Instance template to use when creating new instances. - // - // Instance groups are not compatible with instance templates that specify `true` for - // `default_trusted_profile.auto_link`. - InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template" validate:"required"` - - // The subnets to use when creating new instances. - Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` - - // The port to use for new load balancer pool members created by this instance group. The load balancer pool member - // will receive load balancer traffic on this port, unless the load balancer listener is using a port range. (Traffic - // received on a listener using a port range will be sent to members using the same port the listener received it on.) - // - // This port will also be used for health checks unless the port property of - // `health_monitor` property is specified. - // - // This property must be specified if and only if `load_balancer_pool` has been specified. - ApplicationPort *int64 `json:"application_port,omitempty"` - - // The load balancer associated with the specified load balancer pool. - // Required if `load_balancer_pool` is specified. The load balancer must have - // `instance_groups_supported` set to `true`. - LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` - - // If specified, this instance group will manage the load balancer pool. A pool member - // will be created for each instance created by this group. The specified load - // balancer pool must not be used by another instance group in the VPC. - // - // If specified, `load_balancer` and `application_port` must also be specified. - LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"` - - // The number of instances in the instance group. - MembershipCount *int64 `json:"membership_count,omitempty"` - - // The name for this instance group. The name must not be used by another instance group in the region. 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"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateInstanceGroupOptions : Instantiate CreateInstanceGroupOptions -func (*VpcV1) NewCreateInstanceGroupOptions(instanceTemplate InstanceTemplateIdentityIntf, subnets []SubnetIdentityIntf) *CreateInstanceGroupOptions { - return &CreateInstanceGroupOptions{ - InstanceTemplate: instanceTemplate, - Subnets: subnets, - } -} - -// SetInstanceTemplate : Allow user to set InstanceTemplate -func (_options *CreateInstanceGroupOptions) SetInstanceTemplate(instanceTemplate InstanceTemplateIdentityIntf) *CreateInstanceGroupOptions { - _options.InstanceTemplate = instanceTemplate - return _options -} - -// SetSubnets : Allow user to set Subnets -func (_options *CreateInstanceGroupOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateInstanceGroupOptions { - _options.Subnets = subnets - return _options -} - -// SetApplicationPort : Allow user to set ApplicationPort -func (_options *CreateInstanceGroupOptions) SetApplicationPort(applicationPort int64) *CreateInstanceGroupOptions { - _options.ApplicationPort = core.Int64Ptr(applicationPort) - return _options -} - -// SetLoadBalancer : Allow user to set LoadBalancer -func (_options *CreateInstanceGroupOptions) SetLoadBalancer(loadBalancer LoadBalancerIdentityIntf) *CreateInstanceGroupOptions { - _options.LoadBalancer = loadBalancer - return _options -} - -// SetLoadBalancerPool : Allow user to set LoadBalancerPool -func (_options *CreateInstanceGroupOptions) SetLoadBalancerPool(loadBalancerPool LoadBalancerPoolIdentityIntf) *CreateInstanceGroupOptions { - _options.LoadBalancerPool = loadBalancerPool - return _options -} - -// SetMembershipCount : Allow user to set MembershipCount -func (_options *CreateInstanceGroupOptions) SetMembershipCount(membershipCount int64) *CreateInstanceGroupOptions { - _options.MembershipCount = core.Int64Ptr(membershipCount) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateInstanceGroupOptions) SetName(name string) *CreateInstanceGroupOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateInstanceGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateInstanceGroupOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceGroupOptions) SetHeaders(param map[string]string) *CreateInstanceGroupOptions { - options.Headers = param - return options -} - -// CreateInstanceNetworkAttachmentOptions : The CreateInstanceNetworkAttachment options. -type CreateInstanceNetworkAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // A virtual network interface for the instance 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, `enable_infrastructure_nat` must be - // `true`. - VirtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` - - // The name for this network attachment. Names must be unique within the instance the network attachment resides in. 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 -} - -// NewCreateInstanceNetworkAttachmentOptions : Instantiate CreateInstanceNetworkAttachmentOptions -func (*VpcV1) NewCreateInstanceNetworkAttachmentOptions(instanceID string, virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) *CreateInstanceNetworkAttachmentOptions { - return &CreateInstanceNetworkAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - VirtualNetworkInterface: virtualNetworkInterface, - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *CreateInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *CreateInstanceNetworkAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetVirtualNetworkInterface : Allow user to set VirtualNetworkInterface -func (_options *CreateInstanceNetworkAttachmentOptions) SetVirtualNetworkInterface(virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) *CreateInstanceNetworkAttachmentOptions { - _options.VirtualNetworkInterface = virtualNetworkInterface - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateInstanceNetworkAttachmentOptions) SetName(name string) *CreateInstanceNetworkAttachmentOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *CreateInstanceNetworkAttachmentOptions { - options.Headers = param - return options -} - -// CreateInstanceNetworkInterfaceOptions : The CreateInstanceNetworkInterface options. -type CreateInstanceNetworkInterfaceOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - - // Indicates whether source IP spoofing is allowed on this instance network interface. - // - // If this instance 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 name for the instance network interface. The name must not be used by another network interface on the virtual - // server instance. 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 instance 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 instance 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 instance network interface. If unspecified, the VPC's default security group is - // used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateInstanceNetworkInterfaceOptions : Instantiate CreateInstanceNetworkInterfaceOptions -func (*VpcV1) NewCreateInstanceNetworkInterfaceOptions(instanceID string, subnet SubnetIdentityIntf) *CreateInstanceNetworkInterfaceOptions { - return &CreateInstanceNetworkInterfaceOptions{ - InstanceID: core.StringPtr(instanceID), - Subnet: subnet, - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *CreateInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *CreateInstanceNetworkInterfaceOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetSubnet : Allow user to set Subnet -func (_options *CreateInstanceNetworkInterfaceOptions) SetSubnet(subnet SubnetIdentityIntf) *CreateInstanceNetworkInterfaceOptions { - _options.Subnet = subnet - return _options -} - -// SetAllowIPSpoofing : Allow user to set AllowIPSpoofing -func (_options *CreateInstanceNetworkInterfaceOptions) SetAllowIPSpoofing(allowIPSpoofing bool) *CreateInstanceNetworkInterfaceOptions { - _options.AllowIPSpoofing = core.BoolPtr(allowIPSpoofing) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateInstanceNetworkInterfaceOptions) SetName(name string) *CreateInstanceNetworkInterfaceOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetPrimaryIP : Allow user to set PrimaryIP -func (_options *CreateInstanceNetworkInterfaceOptions) SetPrimaryIP(primaryIP NetworkInterfaceIPPrototypeIntf) *CreateInstanceNetworkInterfaceOptions { - _options.PrimaryIP = primaryIP - return _options -} - -// SetSecurityGroups : Allow user to set SecurityGroups -func (_options *CreateInstanceNetworkInterfaceOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateInstanceNetworkInterfaceOptions { - _options.SecurityGroups = securityGroups - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateInstanceNetworkInterfaceOptions { - options.Headers = param - return options -} - -// CreateInstanceOptions : The CreateInstance options. -type CreateInstanceOptions struct { - // The instance prototype object. - InstancePrototype InstancePrototypeIntf `json:"InstancePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateInstanceOptions : Instantiate CreateInstanceOptions -func (*VpcV1) NewCreateInstanceOptions(instancePrototype InstancePrototypeIntf) *CreateInstanceOptions { - return &CreateInstanceOptions{ - InstancePrototype: instancePrototype, - } -} - -// SetInstancePrototype : Allow user to set InstancePrototype -func (_options *CreateInstanceOptions) SetInstancePrototype(instancePrototype InstancePrototypeIntf) *CreateInstanceOptions { - _options.InstancePrototype = instancePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceOptions) SetHeaders(param map[string]string) *CreateInstanceOptions { - options.Headers = param - return options -} - -// CreateInstanceTemplateOptions : The CreateInstanceTemplate options. -type CreateInstanceTemplateOptions struct { - // The instance template prototype object. - InstanceTemplatePrototype InstanceTemplatePrototypeIntf `json:"InstanceTemplatePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateInstanceTemplateOptions : Instantiate CreateInstanceTemplateOptions -func (*VpcV1) NewCreateInstanceTemplateOptions(instanceTemplatePrototype InstanceTemplatePrototypeIntf) *CreateInstanceTemplateOptions { - return &CreateInstanceTemplateOptions{ - InstanceTemplatePrototype: instanceTemplatePrototype, - } -} - -// SetInstanceTemplatePrototype : Allow user to set InstanceTemplatePrototype -func (_options *CreateInstanceTemplateOptions) SetInstanceTemplatePrototype(instanceTemplatePrototype InstanceTemplatePrototypeIntf) *CreateInstanceTemplateOptions { - _options.InstanceTemplatePrototype = instanceTemplatePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceTemplateOptions) SetHeaders(param map[string]string) *CreateInstanceTemplateOptions { - options.Headers = param - return options -} - -// CreateInstanceVolumeAttachmentOptions : The CreateInstanceVolumeAttachment options. -type CreateInstanceVolumeAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // An existing volume to attach to the instance, or a prototype object for a new volume. - Volume VolumeAttachmentPrototypeVolumeIntf `json:"volume" validate:"required"` - - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - - // The name for this volume attachment. The name must not be used by another volume attachment on the instance. 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 -} - -// NewCreateInstanceVolumeAttachmentOptions : Instantiate CreateInstanceVolumeAttachmentOptions -func (*VpcV1) NewCreateInstanceVolumeAttachmentOptions(instanceID string, volume VolumeAttachmentPrototypeVolumeIntf) *CreateInstanceVolumeAttachmentOptions { - return &CreateInstanceVolumeAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - Volume: volume, - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *CreateInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *CreateInstanceVolumeAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetVolume : Allow user to set Volume -func (_options *CreateInstanceVolumeAttachmentOptions) SetVolume(volume VolumeAttachmentPrototypeVolumeIntf) *CreateInstanceVolumeAttachmentOptions { - _options.Volume = volume - return _options -} - -// SetDeleteVolumeOnInstanceDelete : Allow user to set DeleteVolumeOnInstanceDelete -func (_options *CreateInstanceVolumeAttachmentOptions) SetDeleteVolumeOnInstanceDelete(deleteVolumeOnInstanceDelete bool) *CreateInstanceVolumeAttachmentOptions { - _options.DeleteVolumeOnInstanceDelete = core.BoolPtr(deleteVolumeOnInstanceDelete) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateInstanceVolumeAttachmentOptions) SetName(name string) *CreateInstanceVolumeAttachmentOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *CreateInstanceVolumeAttachmentOptions { - options.Headers = param - return options -} - -// CreateIpsecPolicyOptions : The CreateIpsecPolicy options. -type CreateIpsecPolicyOptions struct { - // The authentication algorithm - // - // Must be `disabled` if and only if the `encryption_algorithm` is - // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. - AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` - - // The encryption algorithm - // - // The `authentication_algorithm` must be `disabled` if and only if - // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or - // `aes256gcm16`. - EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` - - // Perfect Forward Secrecy. - Pfs *string `json:"pfs" validate:"required"` - - // The key lifetime in seconds. - KeyLifetime *int64 `json:"key_lifetime,omitempty"` - - // The name for this IPsec policy. The name must not be used by another IPsec policies in the region. 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"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateIpsecPolicyOptions.AuthenticationAlgorithm property. -// The authentication algorithm -// -// Must be `disabled` if and only if the `encryption_algorithm` is -// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. -const ( - CreateIpsecPolicyOptionsAuthenticationAlgorithmDisabledConst = "disabled" - CreateIpsecPolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" - CreateIpsecPolicyOptionsAuthenticationAlgorithmSha384Const = "sha384" - CreateIpsecPolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" -) - -// Constants associated with the CreateIpsecPolicyOptions.EncryptionAlgorithm property. -// The encryption algorithm -// -// The `authentication_algorithm` must be `disabled` if and only if -// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or -// `aes256gcm16`. -const ( - CreateIpsecPolicyOptionsEncryptionAlgorithmAes128Const = "aes128" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes192Const = "aes192" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes256Const = "aes256" - CreateIpsecPolicyOptionsEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" -) - -// Constants associated with the CreateIpsecPolicyOptions.Pfs property. -// Perfect Forward Secrecy. -const ( - CreateIpsecPolicyOptionsPfsDisabledConst = "disabled" - CreateIpsecPolicyOptionsPfsGroup14Const = "group_14" - CreateIpsecPolicyOptionsPfsGroup15Const = "group_15" - CreateIpsecPolicyOptionsPfsGroup16Const = "group_16" - CreateIpsecPolicyOptionsPfsGroup17Const = "group_17" - CreateIpsecPolicyOptionsPfsGroup18Const = "group_18" - CreateIpsecPolicyOptionsPfsGroup19Const = "group_19" - CreateIpsecPolicyOptionsPfsGroup20Const = "group_20" - CreateIpsecPolicyOptionsPfsGroup21Const = "group_21" - CreateIpsecPolicyOptionsPfsGroup22Const = "group_22" - CreateIpsecPolicyOptionsPfsGroup23Const = "group_23" - CreateIpsecPolicyOptionsPfsGroup24Const = "group_24" - CreateIpsecPolicyOptionsPfsGroup31Const = "group_31" -) - -// NewCreateIpsecPolicyOptions : Instantiate CreateIpsecPolicyOptions -func (*VpcV1) NewCreateIpsecPolicyOptions(authenticationAlgorithm string, encryptionAlgorithm string, pfs string) *CreateIpsecPolicyOptions { - return &CreateIpsecPolicyOptions{ - AuthenticationAlgorithm: core.StringPtr(authenticationAlgorithm), - EncryptionAlgorithm: core.StringPtr(encryptionAlgorithm), - Pfs: core.StringPtr(pfs), - } -} - -// SetAuthenticationAlgorithm : Allow user to set AuthenticationAlgorithm -func (_options *CreateIpsecPolicyOptions) SetAuthenticationAlgorithm(authenticationAlgorithm string) *CreateIpsecPolicyOptions { - _options.AuthenticationAlgorithm = core.StringPtr(authenticationAlgorithm) - return _options -} - -// SetEncryptionAlgorithm : Allow user to set EncryptionAlgorithm -func (_options *CreateIpsecPolicyOptions) SetEncryptionAlgorithm(encryptionAlgorithm string) *CreateIpsecPolicyOptions { - _options.EncryptionAlgorithm = core.StringPtr(encryptionAlgorithm) - return _options -} - -// SetPfs : Allow user to set Pfs -func (_options *CreateIpsecPolicyOptions) SetPfs(pfs string) *CreateIpsecPolicyOptions { - _options.Pfs = core.StringPtr(pfs) - return _options -} - -// SetKeyLifetime : Allow user to set KeyLifetime -func (_options *CreateIpsecPolicyOptions) SetKeyLifetime(keyLifetime int64) *CreateIpsecPolicyOptions { - _options.KeyLifetime = core.Int64Ptr(keyLifetime) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateIpsecPolicyOptions) SetName(name string) *CreateIpsecPolicyOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateIpsecPolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateIpsecPolicyOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateIpsecPolicyOptions) SetHeaders(param map[string]string) *CreateIpsecPolicyOptions { - options.Headers = param - return options -} - -// CreateKeyOptions : The CreateKey options. -type CreateKeyOptions struct { - // A unique public SSH key to import, in OpenSSH format (consisting of three space-separated fields: the algorithm - // name, base64-encoded key, and a comment). The algorithm and comment fields may be omitted, as only the key field is - // imported. - // - // Keys of type `rsa` may be 2048 or 4096 bits in length, however 4096 is recommended. Keys of type `ed25519` are 256 - // bits in length. - PublicKey *string `json:"public_key" validate:"required"` - - // The name for this key. The name must not be used by another key in the region. 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"` - - // The crypto-system used by this key. - Type *string `json:"type,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateKeyOptions.Type property. -// The crypto-system used by this key. -const ( - CreateKeyOptionsTypeEd25519Const = "ed25519" - CreateKeyOptionsTypeRsaConst = "rsa" -) - -// NewCreateKeyOptions : Instantiate CreateKeyOptions -func (*VpcV1) NewCreateKeyOptions(publicKey string) *CreateKeyOptions { - return &CreateKeyOptions{ - PublicKey: core.StringPtr(publicKey), - } -} - -// SetPublicKey : Allow user to set PublicKey -func (_options *CreateKeyOptions) SetPublicKey(publicKey string) *CreateKeyOptions { - _options.PublicKey = core.StringPtr(publicKey) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateKeyOptions) SetName(name string) *CreateKeyOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateKeyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateKeyOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetType : Allow user to set Type -func (_options *CreateKeyOptions) SetType(typeVar string) *CreateKeyOptions { - _options.Type = core.StringPtr(typeVar) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateKeyOptions) SetHeaders(param map[string]string) *CreateKeyOptions { - options.Headers = param - return options -} - -// CreateLoadBalancerListenerOptions : The CreateLoadBalancerListener options. -type CreateLoadBalancerListenerOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. - // - // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the - // `application` family support `tcp`, `http` and - // `https`. - // - // Additional restrictions: - // - If `default_pool` is set, the pool's protocol must match, or be compatible with - // the listener's protocol. At present, the compatible protocols are `http` and - // `https`. - // - If `https_redirect` is set, the protocol must be `http`. - Protocol *string `json:"protocol" validate:"required"` - - // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in - // the `application` family (otherwise always `false`). Additional restrictions: - // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must - // match the `accept_proxy_protocol` value of the `https_redirect` listener. - // - If this listener is the target of another listener's `https_redirect`, its - // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. - AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` - - // The certificate instance to use for SSL termination. The listener must have a - // `protocol` of `https`. - CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` - - // The connection limit of the listener. - ConnectionLimit *int64 `json:"connection_limit,omitempty"` - - // The default pool for this listener. If `https_redirect` is specified, the - // default pool will not be used. - // If specified, the pool must: - // - // - Belong to this load balancer. - // - Have the same `protocol` as this listener, or have a compatible protocol. - // At present, the compatible protocols are `http` and `https`. - // - Not already be the `default_pool` for another listener. - // - // If unspecified, this listener will be created with no default pool, but one may be - // subsequently set. - DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` - - // The target listener that requests will be redirected to if none of the listener's - // `policies` match. - // - // If specified, this listener must have a `protocol` of `http`, and the target - // 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. - IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` - - // The policy prototype objects for this listener. The load balancer must be in the - // `application` family. - Policies []LoadBalancerListenerPolicyPrototype `json:"policies,omitempty"` - - // The listener port number, or the inclusive lower bound of the port range. Each listener in the load balancer must - // have a unique `port` and `protocol` combination. - // - // Not supported for load balancers operating with route mode enabled. - Port *int64 `json:"port,omitempty"` - - // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. - // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `65535` must be specified. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. - // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `1` must be specified. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. - PortMin *int64 `json:"port_min,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateLoadBalancerListenerOptions.Protocol property. -// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. -// -// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the -// `application` family support `tcp`, `http` and -// `https`. -// -// Additional restrictions: -// - If `default_pool` is set, the pool's protocol must match, or be compatible with -// the listener's protocol. At present, the compatible protocols are `http` and -// `https`. -// - If `https_redirect` is set, the protocol must be `http`. -const ( - CreateLoadBalancerListenerOptionsProtocolHTTPConst = "http" - CreateLoadBalancerListenerOptionsProtocolHTTPSConst = "https" - CreateLoadBalancerListenerOptionsProtocolTCPConst = "tcp" - CreateLoadBalancerListenerOptionsProtocolUDPConst = "udp" -) - -// NewCreateLoadBalancerListenerOptions : Instantiate CreateLoadBalancerListenerOptions -func (*VpcV1) NewCreateLoadBalancerListenerOptions(loadBalancerID string, protocol string) *CreateLoadBalancerListenerOptions { - return &CreateLoadBalancerListenerOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - Protocol: core.StringPtr(protocol), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *CreateLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetProtocol : Allow user to set Protocol -func (_options *CreateLoadBalancerListenerOptions) SetProtocol(protocol string) *CreateLoadBalancerListenerOptions { - _options.Protocol = core.StringPtr(protocol) - return _options -} - -// SetAcceptProxyProtocol : Allow user to set AcceptProxyProtocol -func (_options *CreateLoadBalancerListenerOptions) SetAcceptProxyProtocol(acceptProxyProtocol bool) *CreateLoadBalancerListenerOptions { - _options.AcceptProxyProtocol = core.BoolPtr(acceptProxyProtocol) - return _options -} - -// SetCertificateInstance : Allow user to set CertificateInstance -func (_options *CreateLoadBalancerListenerOptions) SetCertificateInstance(certificateInstance CertificateInstanceIdentityIntf) *CreateLoadBalancerListenerOptions { - _options.CertificateInstance = certificateInstance - return _options -} - -// SetConnectionLimit : Allow user to set ConnectionLimit -func (_options *CreateLoadBalancerListenerOptions) SetConnectionLimit(connectionLimit int64) *CreateLoadBalancerListenerOptions { - _options.ConnectionLimit = core.Int64Ptr(connectionLimit) - return _options -} - -// SetDefaultPool : Allow user to set DefaultPool -func (_options *CreateLoadBalancerListenerOptions) SetDefaultPool(defaultPool LoadBalancerPoolIdentityIntf) *CreateLoadBalancerListenerOptions { - _options.DefaultPool = defaultPool - return _options -} - -// SetHTTPSRedirect : Allow user to set HTTPSRedirect -func (_options *CreateLoadBalancerListenerOptions) SetHTTPSRedirect(httpsRedirect *LoadBalancerListenerHTTPSRedirectPrototype) *CreateLoadBalancerListenerOptions { - _options.HTTPSRedirect = httpsRedirect - return _options -} - -// SetIdleConnectionTimeout : Allow user to set IdleConnectionTimeout -func (_options *CreateLoadBalancerListenerOptions) SetIdleConnectionTimeout(idleConnectionTimeout int64) *CreateLoadBalancerListenerOptions { - _options.IdleConnectionTimeout = core.Int64Ptr(idleConnectionTimeout) - return _options -} - -// SetPolicies : Allow user to set Policies -func (_options *CreateLoadBalancerListenerOptions) SetPolicies(policies []LoadBalancerListenerPolicyPrototype) *CreateLoadBalancerListenerOptions { - _options.Policies = policies - return _options -} - -// SetPort : Allow user to set Port -func (_options *CreateLoadBalancerListenerOptions) SetPort(port int64) *CreateLoadBalancerListenerOptions { - _options.Port = core.Int64Ptr(port) - return _options -} - -// SetPortMax : Allow user to set PortMax -func (_options *CreateLoadBalancerListenerOptions) SetPortMax(portMax int64) *CreateLoadBalancerListenerOptions { - _options.PortMax = core.Int64Ptr(portMax) - return _options -} - -// SetPortMin : Allow user to set PortMin -func (_options *CreateLoadBalancerListenerOptions) SetPortMin(portMin int64) *CreateLoadBalancerListenerOptions { - _options.PortMin = core.Int64Ptr(portMin) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateLoadBalancerListenerOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerOptions { - options.Headers = param - return options -} - -// CreateLoadBalancerListenerPolicyOptions : The CreateLoadBalancerListenerPolicy options. -type CreateLoadBalancerListenerPolicyOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // 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` - // - `redirect`: Requests will be redirected to the specified `target.url` - // - `reject`: Requests will be rejected with a `403` status code - // - // 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"` - - // Priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value - // indicates higher priority. - Priority *int64 `json:"priority" validate:"required"` - - // The name for this policy. The name must not be used by another policy for the load balancer listener. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // 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`. - Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` - - // 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` -// - `redirect`: Requests will be redirected to the specified `target.url` -// - `reject`: Requests will be rejected with a `403` status code -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - CreateLoadBalancerListenerPolicyOptionsActionForwardConst = "forward" - CreateLoadBalancerListenerPolicyOptionsActionHTTPSRedirectConst = "https_redirect" - CreateLoadBalancerListenerPolicyOptionsActionRedirectConst = "redirect" - CreateLoadBalancerListenerPolicyOptionsActionRejectConst = "reject" -) - -// NewCreateLoadBalancerListenerPolicyOptions : Instantiate CreateLoadBalancerListenerPolicyOptions -func (*VpcV1) NewCreateLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, action string, priority int64) *CreateLoadBalancerListenerPolicyOptions { - return &CreateLoadBalancerListenerPolicyOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - Action: core.StringPtr(action), - Priority: core.Int64Ptr(priority), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *CreateLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerPolicyOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *CreateLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *CreateLoadBalancerListenerPolicyOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetAction : Allow user to set Action -func (_options *CreateLoadBalancerListenerPolicyOptions) SetAction(action string) *CreateLoadBalancerListenerPolicyOptions { - _options.Action = core.StringPtr(action) - return _options -} - -// SetPriority : Allow user to set Priority -func (_options *CreateLoadBalancerListenerPolicyOptions) SetPriority(priority int64) *CreateLoadBalancerListenerPolicyOptions { - _options.Priority = core.Int64Ptr(priority) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateLoadBalancerListenerPolicyOptions) SetName(name string) *CreateLoadBalancerListenerPolicyOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetRules : Allow user to set Rules -func (_options *CreateLoadBalancerListenerPolicyOptions) SetRules(rules []LoadBalancerListenerPolicyRulePrototype) *CreateLoadBalancerListenerPolicyOptions { - _options.Rules = rules - return _options -} - -// SetTarget : Allow user to set Target -func (_options *CreateLoadBalancerListenerPolicyOptions) SetTarget(target LoadBalancerListenerPolicyTargetPrototypeIntf) *CreateLoadBalancerListenerPolicyOptions { - _options.Target = target - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerPolicyOptions { - options.Headers = param - return options -} - -// CreateLoadBalancerListenerPolicyRuleOptions : The CreateLoadBalancerListenerPolicyRule options. -type CreateLoadBalancerListenerPolicyRuleOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - PolicyID *string `json:"policy_id" validate:"required,ne="` - - // The condition of the rule. - Condition *string `json:"condition" validate:"required"` - - // The type of the rule. - // - // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. - Type *string `json:"type" validate:"required"` - - // Value to be matched for rule condition. - // - // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. - Value *string `json:"value" validate:"required"` - - // The field. This is applicable to `header`, `query`, and `body` rule types. - // - // If the rule type is `header`, this property is required. - // - // If the rule type is `query`, this is optional. If specified and the rule condition is not - // `matches_regex`, the value must be percent-encoded. - // - // If the rule type is `body`, this is optional. - Field *string `json:"field,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Condition property. -// The condition of the rule. -const ( - CreateLoadBalancerListenerPolicyRuleOptionsConditionContainsConst = "contains" - CreateLoadBalancerListenerPolicyRuleOptionsConditionEqualsConst = "equals" - CreateLoadBalancerListenerPolicyRuleOptionsConditionMatchesRegexConst = "matches_regex" -) - -// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Type property. -// The type of the rule. -// -// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. -const ( - CreateLoadBalancerListenerPolicyRuleOptionsTypeBodyConst = "body" - CreateLoadBalancerListenerPolicyRuleOptionsTypeHeaderConst = "header" - CreateLoadBalancerListenerPolicyRuleOptionsTypeHostnameConst = "hostname" - CreateLoadBalancerListenerPolicyRuleOptionsTypePathConst = "path" - CreateLoadBalancerListenerPolicyRuleOptionsTypeQueryConst = "query" -) - -// NewCreateLoadBalancerListenerPolicyRuleOptions : Instantiate CreateLoadBalancerListenerPolicyRuleOptions -func (*VpcV1) NewCreateLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, condition string, typeVar string, value string) *CreateLoadBalancerListenerPolicyRuleOptions { - return &CreateLoadBalancerListenerPolicyRuleOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - PolicyID: core.StringPtr(policyID), - Condition: core.StringPtr(condition), - Type: core.StringPtr(typeVar), - Value: core.StringPtr(value), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerPolicyRuleOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *CreateLoadBalancerListenerPolicyRuleOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetPolicyID : Allow user to set PolicyID -func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *CreateLoadBalancerListenerPolicyRuleOptions { - _options.PolicyID = core.StringPtr(policyID) - return _options -} - -// SetCondition : Allow user to set Condition -func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetCondition(condition string) *CreateLoadBalancerListenerPolicyRuleOptions { - _options.Condition = core.StringPtr(condition) - return _options -} - -// SetType : Allow user to set Type -func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetType(typeVar string) *CreateLoadBalancerListenerPolicyRuleOptions { - _options.Type = core.StringPtr(typeVar) - return _options -} - -// SetValue : Allow user to set Value -func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetValue(value string) *CreateLoadBalancerListenerPolicyRuleOptions { - _options.Value = core.StringPtr(value) - return _options -} - -// SetField : Allow user to set Field -func (_options *CreateLoadBalancerListenerPolicyRuleOptions) SetField(field string) *CreateLoadBalancerListenerPolicyRuleOptions { - _options.Field = core.StringPtr(field) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerPolicyRuleOptions { - options.Headers = param - return options -} - -// CreateLoadBalancerOptions : The CreateLoadBalancer options. -type CreateLoadBalancerOptions struct { - // Indicates whether this load balancer is public. - // - // At present, if route mode is enabled, the load balancer must not be public. - IsPublic *bool `json:"is_public" validate:"required"` - - // The subnets to provision this load balancer in. The subnets must be in the same VPC. The load balancer's - // availability will depend on the availability of the zones that the subnets reside in. - // - // Load balancers in the `network` family allow only one subnet to be specified. - Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` - - // 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 `lb.appdomain.cloud`. Otherwise, those DNS `A` records will be - // added to the specified `zone`. - Dns *LoadBalancerDnsPrototype `json:"dns,omitempty"` - - // The listeners of this load balancer. - Listeners []LoadBalancerListenerPrototypeLoadBalancerContext `json:"listeners,omitempty"` - - // The logging configuration to use for this load balancer. See [VPC Datapath - // Logging](https://cloud.ibm.com/docs/vpc?topic=vpc-datapath-logging) on the logging - // format, fields and permitted values. If unspecified, `datapath.active` will be `false`. - // - // To activate logging, the load balancer profile must support the specified logging type. - Logging *LoadBalancerLoggingPrototype `json:"logging,omitempty"` - - // The name for this load balancer. The name must not be used by another load balancer in the VPC. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The pools of this load balancer. - Pools []LoadBalancerPoolPrototype `json:"pools,omitempty"` - - // The profile to use for this load balancer. - // - // If unspecified, `application` will be used. - Profile LoadBalancerProfileIdentityIntf `json:"profile,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 whether route mode is enabled for this load balancer. - // - // At present, public load balancers are not supported with route mode enabled. - RouteMode *bool `json:"route_mode,omitempty"` - - // The security groups to use for this load balancer. If unspecified, the VPC's default security group is used. - // - // The load balancer profile must support security groups. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateLoadBalancerOptions : Instantiate CreateLoadBalancerOptions -func (*VpcV1) NewCreateLoadBalancerOptions(isPublic bool, subnets []SubnetIdentityIntf) *CreateLoadBalancerOptions { - return &CreateLoadBalancerOptions{ - IsPublic: core.BoolPtr(isPublic), - Subnets: subnets, - } -} - -// SetIsPublic : Allow user to set IsPublic -func (_options *CreateLoadBalancerOptions) SetIsPublic(isPublic bool) *CreateLoadBalancerOptions { - _options.IsPublic = core.BoolPtr(isPublic) - return _options -} - -// SetSubnets : Allow user to set Subnets -func (_options *CreateLoadBalancerOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateLoadBalancerOptions { - _options.Subnets = subnets - return _options -} - -// SetDns : Allow user to set Dns -func (_options *CreateLoadBalancerOptions) SetDns(dns *LoadBalancerDnsPrototype) *CreateLoadBalancerOptions { - _options.Dns = dns - return _options -} - -// SetListeners : Allow user to set Listeners -func (_options *CreateLoadBalancerOptions) SetListeners(listeners []LoadBalancerListenerPrototypeLoadBalancerContext) *CreateLoadBalancerOptions { - _options.Listeners = listeners - return _options -} - -// SetLogging : Allow user to set Logging -func (_options *CreateLoadBalancerOptions) SetLogging(logging *LoadBalancerLoggingPrototype) *CreateLoadBalancerOptions { - _options.Logging = logging - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateLoadBalancerOptions) SetName(name string) *CreateLoadBalancerOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetPools : Allow user to set Pools -func (_options *CreateLoadBalancerOptions) SetPools(pools []LoadBalancerPoolPrototype) *CreateLoadBalancerOptions { - _options.Pools = pools - return _options -} - -// SetProfile : Allow user to set Profile -func (_options *CreateLoadBalancerOptions) SetProfile(profile LoadBalancerProfileIdentityIntf) *CreateLoadBalancerOptions { - _options.Profile = profile - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateLoadBalancerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateLoadBalancerOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetRouteMode : Allow user to set RouteMode -func (_options *CreateLoadBalancerOptions) SetRouteMode(routeMode bool) *CreateLoadBalancerOptions { - _options.RouteMode = core.BoolPtr(routeMode) - return _options -} - -// SetSecurityGroups : Allow user to set SecurityGroups -func (_options *CreateLoadBalancerOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateLoadBalancerOptions { - _options.SecurityGroups = securityGroups - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateLoadBalancerOptions) SetHeaders(param map[string]string) *CreateLoadBalancerOptions { - options.Headers = param - return options -} - -// CreateLoadBalancerPoolMemberOptions : The CreateLoadBalancerPoolMember options. -type CreateLoadBalancerPoolMemberOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - PoolID *string `json:"pool_id" validate:"required,ne="` - - // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a - // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive - // the traffic on the same port the listener received it on.) - // - // This port will also be used for health checks unless the `port` property of - // `health_monitor` property is specified. - // - // The port must be unique across all members for all pools associated with this pool's listener. - Port *int64 `json:"port" validate:"required"` - - // The pool member target. Load balancers in the `network` family support virtual server - // instances. Load balancers in the `application` family support IP addresses. If the load - // balancer has route mode enabled, the member must be in a zone the load balancer has a - // subnet in. - Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` - - // Weight of the server member. Applicable only if the pool algorithm is - // `weighted_round_robin`. - Weight *int64 `json:"weight,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateLoadBalancerPoolMemberOptions : Instantiate CreateLoadBalancerPoolMemberOptions -func (*VpcV1) NewCreateLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, port int64, target LoadBalancerPoolMemberTargetPrototypeIntf) *CreateLoadBalancerPoolMemberOptions { - return &CreateLoadBalancerPoolMemberOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - PoolID: core.StringPtr(poolID), - Port: core.Int64Ptr(port), - Target: target, - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *CreateLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerPoolMemberOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetPoolID : Allow user to set PoolID -func (_options *CreateLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *CreateLoadBalancerPoolMemberOptions { - _options.PoolID = core.StringPtr(poolID) - return _options -} - -// SetPort : Allow user to set Port -func (_options *CreateLoadBalancerPoolMemberOptions) SetPort(port int64) *CreateLoadBalancerPoolMemberOptions { - _options.Port = core.Int64Ptr(port) - return _options -} - -// SetTarget : Allow user to set Target -func (_options *CreateLoadBalancerPoolMemberOptions) SetTarget(target LoadBalancerPoolMemberTargetPrototypeIntf) *CreateLoadBalancerPoolMemberOptions { - _options.Target = target - return _options -} - -// SetWeight : Allow user to set Weight -func (_options *CreateLoadBalancerPoolMemberOptions) SetWeight(weight int64) *CreateLoadBalancerPoolMemberOptions { - _options.Weight = core.Int64Ptr(weight) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *CreateLoadBalancerPoolMemberOptions { - options.Headers = param - return options -} - -// CreateLoadBalancerPoolOptions : The CreateLoadBalancerPool options. -type CreateLoadBalancerPoolOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The load balancing algorithm. - Algorithm *string `json:"algorithm" validate:"required"` - - // The health monitor of this pool. - HealthMonitor *LoadBalancerPoolHealthMonitorPrototype `json:"health_monitor" validate:"required"` - - // The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if - // `udp_supported` is `true`). Load balancers in the - // `application` family support `tcp`, `http`, and `https`. - Protocol *string `json:"protocol" validate:"required"` - - // The members for this load balancer pool. For load balancers in the `network` family, the same `port` and `target` - // tuple cannot be shared by a pool member of any other load balancer in the same VPC. - Members []LoadBalancerPoolMemberPrototype `json:"members,omitempty"` - - // The name for this load balancer pool. The name must not be used by another pool for the load balancer. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The PROXY protocol setting for this pool: - // - `v1`: Enabled with version 1 (human-readable header format) - // - `v2`: Enabled with version 2 (binary header format) - // - `disabled`: Disabled - // - // Supported by load balancers in the `application` family (otherwise always `disabled`). - ProxyProtocol *string `json:"proxy_protocol,omitempty"` - - // The session persistence of this pool. If unspecified, session persistence will be - // disabled, and traffic will be distributed across backend server members of the - // pool. - SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateLoadBalancerPoolOptions.Algorithm property. -// The load balancing algorithm. -const ( - CreateLoadBalancerPoolOptionsAlgorithmLeastConnectionsConst = "least_connections" - CreateLoadBalancerPoolOptionsAlgorithmRoundRobinConst = "round_robin" - CreateLoadBalancerPoolOptionsAlgorithmWeightedRoundRobinConst = "weighted_round_robin" -) - -// Constants associated with the CreateLoadBalancerPoolOptions.Protocol property. -// The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if -// `udp_supported` is `true`). Load balancers in the -// `application` family support `tcp`, `http`, and `https`. -const ( - CreateLoadBalancerPoolOptionsProtocolHTTPConst = "http" - CreateLoadBalancerPoolOptionsProtocolHTTPSConst = "https" - CreateLoadBalancerPoolOptionsProtocolTCPConst = "tcp" - CreateLoadBalancerPoolOptionsProtocolUDPConst = "udp" -) - -// Constants associated with the CreateLoadBalancerPoolOptions.ProxyProtocol property. -// The PROXY protocol setting for this pool: -// - `v1`: Enabled with version 1 (human-readable header format) -// - `v2`: Enabled with version 2 (binary header format) -// - `disabled`: Disabled -// -// Supported by load balancers in the `application` family (otherwise always `disabled`). -const ( - CreateLoadBalancerPoolOptionsProxyProtocolDisabledConst = "disabled" - CreateLoadBalancerPoolOptionsProxyProtocolV1Const = "v1" - CreateLoadBalancerPoolOptionsProxyProtocolV2Const = "v2" -) - -// NewCreateLoadBalancerPoolOptions : Instantiate CreateLoadBalancerPoolOptions -func (*VpcV1) NewCreateLoadBalancerPoolOptions(loadBalancerID string, algorithm string, healthMonitor *LoadBalancerPoolHealthMonitorPrototype, protocol string) *CreateLoadBalancerPoolOptions { - return &CreateLoadBalancerPoolOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - Algorithm: core.StringPtr(algorithm), - HealthMonitor: healthMonitor, - Protocol: core.StringPtr(protocol), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *CreateLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerPoolOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetAlgorithm : Allow user to set Algorithm -func (_options *CreateLoadBalancerPoolOptions) SetAlgorithm(algorithm string) *CreateLoadBalancerPoolOptions { - _options.Algorithm = core.StringPtr(algorithm) - return _options -} - -// SetHealthMonitor : Allow user to set HealthMonitor -func (_options *CreateLoadBalancerPoolOptions) SetHealthMonitor(healthMonitor *LoadBalancerPoolHealthMonitorPrototype) *CreateLoadBalancerPoolOptions { - _options.HealthMonitor = healthMonitor - return _options -} - -// SetProtocol : Allow user to set Protocol -func (_options *CreateLoadBalancerPoolOptions) SetProtocol(protocol string) *CreateLoadBalancerPoolOptions { - _options.Protocol = core.StringPtr(protocol) - return _options -} - -// SetMembers : Allow user to set Members -func (_options *CreateLoadBalancerPoolOptions) SetMembers(members []LoadBalancerPoolMemberPrototype) *CreateLoadBalancerPoolOptions { - _options.Members = members - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateLoadBalancerPoolOptions) SetName(name string) *CreateLoadBalancerPoolOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetProxyProtocol : Allow user to set ProxyProtocol -func (_options *CreateLoadBalancerPoolOptions) SetProxyProtocol(proxyProtocol string) *CreateLoadBalancerPoolOptions { - _options.ProxyProtocol = core.StringPtr(proxyProtocol) - return _options -} - -// SetSessionPersistence : Allow user to set SessionPersistence -func (_options *CreateLoadBalancerPoolOptions) SetSessionPersistence(sessionPersistence *LoadBalancerPoolSessionPersistencePrototype) *CreateLoadBalancerPoolOptions { - _options.SessionPersistence = sessionPersistence - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateLoadBalancerPoolOptions) SetHeaders(param map[string]string) *CreateLoadBalancerPoolOptions { - options.Headers = param - return options -} - -// CreateNetworkACLOptions : The CreateNetworkACL options. -type CreateNetworkACLOptions struct { - // The network ACL prototype object. - NetworkACLPrototype NetworkACLPrototypeIntf `json:"NetworkACLPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateNetworkACLOptions : Instantiate CreateNetworkACLOptions -func (*VpcV1) NewCreateNetworkACLOptions(networkACLPrototype NetworkACLPrototypeIntf) *CreateNetworkACLOptions { - return &CreateNetworkACLOptions{ - NetworkACLPrototype: networkACLPrototype, - } -} - -// SetNetworkACLPrototype : Allow user to set NetworkACLPrototype -func (_options *CreateNetworkACLOptions) SetNetworkACLPrototype(networkACLPrototype NetworkACLPrototypeIntf) *CreateNetworkACLOptions { - _options.NetworkACLPrototype = networkACLPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateNetworkACLOptions) SetHeaders(param map[string]string) *CreateNetworkACLOptions { - options.Headers = param - return options -} - -// CreateNetworkACLRuleOptions : The CreateNetworkACLRule options. -type CreateNetworkACLRuleOptions struct { - // The network ACL identifier. - NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` - - // The network ACL rule prototype object. - NetworkACLRulePrototype NetworkACLRulePrototypeIntf `json:"NetworkACLRulePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateNetworkACLRuleOptions : Instantiate CreateNetworkACLRuleOptions -func (*VpcV1) NewCreateNetworkACLRuleOptions(networkACLID string, networkACLRulePrototype NetworkACLRulePrototypeIntf) *CreateNetworkACLRuleOptions { - return &CreateNetworkACLRuleOptions{ - NetworkACLID: core.StringPtr(networkACLID), - NetworkACLRulePrototype: networkACLRulePrototype, - } -} - -// SetNetworkACLID : Allow user to set NetworkACLID -func (_options *CreateNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *CreateNetworkACLRuleOptions { - _options.NetworkACLID = core.StringPtr(networkACLID) - return _options -} - -// SetNetworkACLRulePrototype : Allow user to set NetworkACLRulePrototype -func (_options *CreateNetworkACLRuleOptions) SetNetworkACLRulePrototype(networkACLRulePrototype NetworkACLRulePrototypeIntf) *CreateNetworkACLRuleOptions { - _options.NetworkACLRulePrototype = networkACLRulePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateNetworkACLRuleOptions) SetHeaders(param map[string]string) *CreateNetworkACLRuleOptions { - options.Headers = param - return options -} - -// CreatePlacementGroupOptions : The CreatePlacementGroup options. -type CreatePlacementGroupOptions struct { - // The strategy for this placement group: - // - `host_spread`: place on different compute hosts - // - `power_spread`: place on compute hosts that use different power sources - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Strategy *string `json:"strategy" validate:"required"` - - // The name for this placement group. The name must not be used by another placement group in the region. 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"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreatePlacementGroupOptions.Strategy property. -// The strategy for this placement group: -// - `host_spread`: place on different compute hosts -// - `power_spread`: place on compute hosts that use different power sources -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - CreatePlacementGroupOptionsStrategyHostSpreadConst = "host_spread" - CreatePlacementGroupOptionsStrategyPowerSpreadConst = "power_spread" -) - -// NewCreatePlacementGroupOptions : Instantiate CreatePlacementGroupOptions -func (*VpcV1) NewCreatePlacementGroupOptions(strategy string) *CreatePlacementGroupOptions { - return &CreatePlacementGroupOptions{ - Strategy: core.StringPtr(strategy), - } -} - -// SetStrategy : Allow user to set Strategy -func (_options *CreatePlacementGroupOptions) SetStrategy(strategy string) *CreatePlacementGroupOptions { - _options.Strategy = core.StringPtr(strategy) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreatePlacementGroupOptions) SetName(name string) *CreatePlacementGroupOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreatePlacementGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePlacementGroupOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreatePlacementGroupOptions) SetHeaders(param map[string]string) *CreatePlacementGroupOptions { - options.Headers = param - return options -} - -// CreatePublicGatewayOptions : The CreatePublicGateway options. -type CreatePublicGatewayOptions struct { - // The VPC this public gateway will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The zone this public gateway will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - FloatingIP PublicGatewayFloatingIPPrototypeIntf `json:"floating_ip,omitempty"` - - // The name for this public gateway. The name must not be used by another public gateway in the VPC. 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"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreatePublicGatewayOptions : Instantiate CreatePublicGatewayOptions -func (*VpcV1) NewCreatePublicGatewayOptions(vpc VPCIdentityIntf, zone ZoneIdentityIntf) *CreatePublicGatewayOptions { - return &CreatePublicGatewayOptions{ - VPC: vpc, - Zone: zone, - } -} - -// SetVPC : Allow user to set VPC -func (_options *CreatePublicGatewayOptions) SetVPC(vpc VPCIdentityIntf) *CreatePublicGatewayOptions { - _options.VPC = vpc - return _options -} - -// SetZone : Allow user to set Zone -func (_options *CreatePublicGatewayOptions) SetZone(zone ZoneIdentityIntf) *CreatePublicGatewayOptions { - _options.Zone = zone - return _options -} - -// SetFloatingIP : Allow user to set FloatingIP -func (_options *CreatePublicGatewayOptions) SetFloatingIP(floatingIP PublicGatewayFloatingIPPrototypeIntf) *CreatePublicGatewayOptions { - _options.FloatingIP = floatingIP - return _options -} - -// SetName : Allow user to set Name -func (_options *CreatePublicGatewayOptions) SetName(name string) *CreatePublicGatewayOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreatePublicGatewayOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePublicGatewayOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreatePublicGatewayOptions) SetHeaders(param map[string]string) *CreatePublicGatewayOptions { - options.Headers = param - return options -} - -// CreateReservationOptions : The CreateReservation options. -type CreateReservationOptions struct { - // The capacity reservation configuration to use. - Capacity *ReservationCapacityPrototype `json:"capacity" validate:"required"` - - // The committed use configuration to use for this reservation. - CommittedUse *ReservationCommittedUsePrototype `json:"committed_use" validate:"required"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this - // reservation. - Profile *ReservationProfilePrototype `json:"profile" validate:"required"` - - // The zone to use for this reservation. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The affinity policy to use for this reservation: - // - `restricted`: The reservation must be manually requested. - AffinityPolicy *string `json:"affinity_policy,omitempty"` - - // The name for this reservation. The name must not be used by another reservation in the region. 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"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateReservationOptions.AffinityPolicy property. -// The affinity policy to use for this reservation: -// - `restricted`: The reservation must be manually requested. -const ( - CreateReservationOptionsAffinityPolicyRestrictedConst = "restricted" -) - -// NewCreateReservationOptions : Instantiate CreateReservationOptions -func (*VpcV1) NewCreateReservationOptions(capacity *ReservationCapacityPrototype, committedUse *ReservationCommittedUsePrototype, profile *ReservationProfilePrototype, zone ZoneIdentityIntf) *CreateReservationOptions { - return &CreateReservationOptions{ - Capacity: capacity, - CommittedUse: committedUse, - Profile: profile, - Zone: zone, - } -} - -// SetCapacity : Allow user to set Capacity -func (_options *CreateReservationOptions) SetCapacity(capacity *ReservationCapacityPrototype) *CreateReservationOptions { - _options.Capacity = capacity - return _options -} - -// SetCommittedUse : Allow user to set CommittedUse -func (_options *CreateReservationOptions) SetCommittedUse(committedUse *ReservationCommittedUsePrototype) *CreateReservationOptions { - _options.CommittedUse = committedUse - return _options -} - -// SetProfile : Allow user to set Profile -func (_options *CreateReservationOptions) SetProfile(profile *ReservationProfilePrototype) *CreateReservationOptions { - _options.Profile = profile - return _options -} - -// SetZone : Allow user to set Zone -func (_options *CreateReservationOptions) SetZone(zone ZoneIdentityIntf) *CreateReservationOptions { - _options.Zone = zone - return _options -} - -// SetAffinityPolicy : Allow user to set AffinityPolicy -func (_options *CreateReservationOptions) SetAffinityPolicy(affinityPolicy string) *CreateReservationOptions { - _options.AffinityPolicy = core.StringPtr(affinityPolicy) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateReservationOptions) SetName(name string) *CreateReservationOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateReservationOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateReservationOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateReservationOptions) SetHeaders(param map[string]string) *CreateReservationOptions { - options.Headers = param - return options -} - -// CreateSecurityGroupOptions : The CreateSecurityGroup options. -type CreateSecurityGroupOptions struct { - // The VPC this security group will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The name for this security group. The name must not be used by another security group for the VPC. 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"` - - // The prototype objects for rules to be created for this security group. If unspecified, no rules will be created, - // resulting in all traffic being denied. - Rules []SecurityGroupRulePrototypeIntf `json:"rules,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSecurityGroupOptions : Instantiate CreateSecurityGroupOptions -func (*VpcV1) NewCreateSecurityGroupOptions(vpc VPCIdentityIntf) *CreateSecurityGroupOptions { - return &CreateSecurityGroupOptions{ - VPC: vpc, - } -} - -// SetVPC : Allow user to set VPC -func (_options *CreateSecurityGroupOptions) SetVPC(vpc VPCIdentityIntf) *CreateSecurityGroupOptions { - _options.VPC = vpc - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateSecurityGroupOptions) SetName(name string) *CreateSecurityGroupOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateSecurityGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateSecurityGroupOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetRules : Allow user to set Rules -func (_options *CreateSecurityGroupOptions) SetRules(rules []SecurityGroupRulePrototypeIntf) *CreateSecurityGroupOptions { - _options.Rules = rules - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSecurityGroupOptions) SetHeaders(param map[string]string) *CreateSecurityGroupOptions { - options.Headers = param - return options -} - -// CreateSecurityGroupRuleOptions : The CreateSecurityGroupRule options. -type CreateSecurityGroupRuleOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // The properties of the security group rule to be created. - SecurityGroupRulePrototype SecurityGroupRulePrototypeIntf `json:"SecurityGroupRulePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSecurityGroupRuleOptions : Instantiate CreateSecurityGroupRuleOptions -func (*VpcV1) NewCreateSecurityGroupRuleOptions(securityGroupID string, securityGroupRulePrototype SecurityGroupRulePrototypeIntf) *CreateSecurityGroupRuleOptions { - return &CreateSecurityGroupRuleOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - SecurityGroupRulePrototype: securityGroupRulePrototype, - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *CreateSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *CreateSecurityGroupRuleOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetSecurityGroupRulePrototype : Allow user to set SecurityGroupRulePrototype -func (_options *CreateSecurityGroupRuleOptions) SetSecurityGroupRulePrototype(securityGroupRulePrototype SecurityGroupRulePrototypeIntf) *CreateSecurityGroupRuleOptions { - _options.SecurityGroupRulePrototype = securityGroupRulePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSecurityGroupRuleOptions) SetHeaders(param map[string]string) *CreateSecurityGroupRuleOptions { - options.Headers = param - return options -} - -// CreateSecurityGroupTargetBindingOptions : The CreateSecurityGroupTargetBinding options. -type CreateSecurityGroupTargetBindingOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // The security group target identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSecurityGroupTargetBindingOptions : Instantiate CreateSecurityGroupTargetBindingOptions -func (*VpcV1) NewCreateSecurityGroupTargetBindingOptions(securityGroupID string, id string) *CreateSecurityGroupTargetBindingOptions { - return &CreateSecurityGroupTargetBindingOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - ID: core.StringPtr(id), - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *CreateSecurityGroupTargetBindingOptions) SetSecurityGroupID(securityGroupID string) *CreateSecurityGroupTargetBindingOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *CreateSecurityGroupTargetBindingOptions) SetID(id string) *CreateSecurityGroupTargetBindingOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSecurityGroupTargetBindingOptions) SetHeaders(param map[string]string) *CreateSecurityGroupTargetBindingOptions { - options.Headers = param - return options -} - -// CreateShareMountTargetOptions : The CreateShareMountTarget options. -type CreateShareMountTargetOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // The share mount target prototype object. - ShareMountTargetPrototype ShareMountTargetPrototypeIntf `json:"ShareMountTargetPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateShareMountTargetOptions : Instantiate CreateShareMountTargetOptions -func (*VpcV1) NewCreateShareMountTargetOptions(shareID string, shareMountTargetPrototype ShareMountTargetPrototypeIntf) *CreateShareMountTargetOptions { - return &CreateShareMountTargetOptions{ - ShareID: core.StringPtr(shareID), - ShareMountTargetPrototype: shareMountTargetPrototype, - } -} - -// SetShareID : Allow user to set ShareID -func (_options *CreateShareMountTargetOptions) SetShareID(shareID string) *CreateShareMountTargetOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetShareMountTargetPrototype : Allow user to set ShareMountTargetPrototype -func (_options *CreateShareMountTargetOptions) SetShareMountTargetPrototype(shareMountTargetPrototype ShareMountTargetPrototypeIntf) *CreateShareMountTargetOptions { - _options.ShareMountTargetPrototype = shareMountTargetPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateShareMountTargetOptions) SetHeaders(param map[string]string) *CreateShareMountTargetOptions { - options.Headers = param - return options -} - -// CreateShareOptions : The CreateShare options. -type CreateShareOptions struct { - // The file share prototype object. - SharePrototype SharePrototypeIntf `json:"SharePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateShareOptions : Instantiate CreateShareOptions -func (*VpcV1) NewCreateShareOptions(sharePrototype SharePrototypeIntf) *CreateShareOptions { - return &CreateShareOptions{ - SharePrototype: sharePrototype, - } -} - -// SetSharePrototype : Allow user to set SharePrototype -func (_options *CreateShareOptions) SetSharePrototype(sharePrototype SharePrototypeIntf) *CreateShareOptions { - _options.SharePrototype = sharePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateShareOptions) SetHeaders(param map[string]string) *CreateShareOptions { - options.Headers = param - return options -} - -// CreateSnapshotCloneOptions : The CreateSnapshotClone options. -type CreateSnapshotCloneOptions struct { - // The snapshot identifier. - ID *string `json:"id" validate:"required,ne="` - - // The zone name. - ZoneName *string `json:"zone_name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSnapshotCloneOptions : Instantiate CreateSnapshotCloneOptions -func (*VpcV1) NewCreateSnapshotCloneOptions(id string, zoneName string) *CreateSnapshotCloneOptions { - return &CreateSnapshotCloneOptions{ - ID: core.StringPtr(id), - ZoneName: core.StringPtr(zoneName), - } -} - -// SetID : Allow user to set ID -func (_options *CreateSnapshotCloneOptions) SetID(id string) *CreateSnapshotCloneOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *CreateSnapshotCloneOptions) SetZoneName(zoneName string) *CreateSnapshotCloneOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSnapshotCloneOptions) SetHeaders(param map[string]string) *CreateSnapshotCloneOptions { - options.Headers = param - return options -} - -// CreateSnapshotConsistencyGroupOptions : The CreateSnapshotConsistencyGroup options. -type CreateSnapshotConsistencyGroupOptions struct { - // The snapshot consistency group prototype object. - SnapshotConsistencyGroupPrototype SnapshotConsistencyGroupPrototypeIntf `json:"SnapshotConsistencyGroupPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSnapshotConsistencyGroupOptions : Instantiate CreateSnapshotConsistencyGroupOptions -func (*VpcV1) NewCreateSnapshotConsistencyGroupOptions(snapshotConsistencyGroupPrototype SnapshotConsistencyGroupPrototypeIntf) *CreateSnapshotConsistencyGroupOptions { - return &CreateSnapshotConsistencyGroupOptions{ - SnapshotConsistencyGroupPrototype: snapshotConsistencyGroupPrototype, - } -} - -// SetSnapshotConsistencyGroupPrototype : Allow user to set SnapshotConsistencyGroupPrototype -func (_options *CreateSnapshotConsistencyGroupOptions) SetSnapshotConsistencyGroupPrototype(snapshotConsistencyGroupPrototype SnapshotConsistencyGroupPrototypeIntf) *CreateSnapshotConsistencyGroupOptions { - _options.SnapshotConsistencyGroupPrototype = snapshotConsistencyGroupPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *CreateSnapshotConsistencyGroupOptions { - options.Headers = param - return options -} - -// CreateSnapshotOptions : The CreateSnapshot options. -type CreateSnapshotOptions struct { - // The snapshot prototype object. - SnapshotPrototype SnapshotPrototypeIntf `json:"SnapshotPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSnapshotOptions : Instantiate CreateSnapshotOptions -func (*VpcV1) NewCreateSnapshotOptions(snapshotPrototype SnapshotPrototypeIntf) *CreateSnapshotOptions { - return &CreateSnapshotOptions{ - SnapshotPrototype: snapshotPrototype, - } -} - -// SetSnapshotPrototype : Allow user to set SnapshotPrototype -func (_options *CreateSnapshotOptions) SetSnapshotPrototype(snapshotPrototype SnapshotPrototypeIntf) *CreateSnapshotOptions { - _options.SnapshotPrototype = snapshotPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSnapshotOptions) SetHeaders(param map[string]string) *CreateSnapshotOptions { - options.Headers = param - return options -} - -// CreateSubnetOptions : The CreateSubnet options. -type CreateSubnetOptions struct { - // The subnet prototype object. - SubnetPrototype SubnetPrototypeIntf `json:"SubnetPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSubnetOptions : Instantiate CreateSubnetOptions -func (*VpcV1) NewCreateSubnetOptions(subnetPrototype SubnetPrototypeIntf) *CreateSubnetOptions { - return &CreateSubnetOptions{ - SubnetPrototype: subnetPrototype, - } -} - -// SetSubnetPrototype : Allow user to set SubnetPrototype -func (_options *CreateSubnetOptions) SetSubnetPrototype(subnetPrototype SubnetPrototypeIntf) *CreateSubnetOptions { - _options.SubnetPrototype = subnetPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSubnetOptions) SetHeaders(param map[string]string) *CreateSubnetOptions { - options.Headers = param - return options -} - -// CreateSubnetReservedIPOptions : The CreateSubnetReservedIP options. -type CreateSubnetReservedIPOptions struct { - // The subnet identifier. - SubnetID *string `json:"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"` - - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the 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"` - - // The target to bind this reserved IP to. The target must be in the same VPC. - // - // The following targets are supported: - // - An endpoint gateway not already bound to a reserved IP in the subnet's zone. - // - A virtual network interface. - // - // If unspecified, the reserved IP will be created unbound. - Target ReservedIPTargetPrototypeIntf `json:"target,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateSubnetReservedIPOptions : Instantiate CreateSubnetReservedIPOptions -func (*VpcV1) NewCreateSubnetReservedIPOptions(subnetID string) *CreateSubnetReservedIPOptions { - return &CreateSubnetReservedIPOptions{ - SubnetID: core.StringPtr(subnetID), - } -} - -// SetSubnetID : Allow user to set SubnetID -func (_options *CreateSubnetReservedIPOptions) SetSubnetID(subnetID string) *CreateSubnetReservedIPOptions { - _options.SubnetID = core.StringPtr(subnetID) - return _options -} - -// SetAddress : Allow user to set Address -func (_options *CreateSubnetReservedIPOptions) SetAddress(address string) *CreateSubnetReservedIPOptions { - _options.Address = core.StringPtr(address) - return _options -} - -// SetAutoDelete : Allow user to set AutoDelete -func (_options *CreateSubnetReservedIPOptions) SetAutoDelete(autoDelete bool) *CreateSubnetReservedIPOptions { - _options.AutoDelete = core.BoolPtr(autoDelete) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateSubnetReservedIPOptions) SetName(name string) *CreateSubnetReservedIPOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetTarget : Allow user to set Target -func (_options *CreateSubnetReservedIPOptions) SetTarget(target ReservedIPTargetPrototypeIntf) *CreateSubnetReservedIPOptions { - _options.Target = target - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSubnetReservedIPOptions) SetHeaders(param map[string]string) *CreateSubnetReservedIPOptions { - options.Headers = param - return options -} - -// CreateVirtualNetworkInterfaceOptions : The CreateVirtualNetworkInterface options. -type CreateVirtualNetworkInterfaceOptions 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"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. Must be `false` if the virtual network interface is unbound. - AutoDelete *bool `json:"auto_delete,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"` - - // 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"` - - // 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 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"` - - // 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 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"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateVirtualNetworkInterfaceOptions : Instantiate CreateVirtualNetworkInterfaceOptions -func (*VpcV1) NewCreateVirtualNetworkInterfaceOptions() *CreateVirtualNetworkInterfaceOptions { - return &CreateVirtualNetworkInterfaceOptions{} -} - -// SetAllowIPSpoofing : Allow user to set AllowIPSpoofing -func (_options *CreateVirtualNetworkInterfaceOptions) SetAllowIPSpoofing(allowIPSpoofing bool) *CreateVirtualNetworkInterfaceOptions { - _options.AllowIPSpoofing = core.BoolPtr(allowIPSpoofing) - return _options -} - -// SetAutoDelete : Allow user to set AutoDelete -func (_options *CreateVirtualNetworkInterfaceOptions) SetAutoDelete(autoDelete bool) *CreateVirtualNetworkInterfaceOptions { - _options.AutoDelete = core.BoolPtr(autoDelete) - return _options -} - -// SetEnableInfrastructureNat : Allow user to set EnableInfrastructureNat -func (_options *CreateVirtualNetworkInterfaceOptions) SetEnableInfrastructureNat(enableInfrastructureNat bool) *CreateVirtualNetworkInterfaceOptions { - _options.EnableInfrastructureNat = core.BoolPtr(enableInfrastructureNat) - return _options -} - -// SetIps : Allow user to set Ips -func (_options *CreateVirtualNetworkInterfaceOptions) SetIps(ips []VirtualNetworkInterfaceIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { - _options.Ips = ips - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVirtualNetworkInterfaceOptions) SetName(name string) *CreateVirtualNetworkInterfaceOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetPrimaryIP : Allow user to set PrimaryIP -func (_options *CreateVirtualNetworkInterfaceOptions) SetPrimaryIP(primaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf) *CreateVirtualNetworkInterfaceOptions { - _options.PrimaryIP = primaryIP - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateVirtualNetworkInterfaceOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVirtualNetworkInterfaceOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetSecurityGroups : Allow user to set SecurityGroups -func (_options *CreateVirtualNetworkInterfaceOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateVirtualNetworkInterfaceOptions { - _options.SecurityGroups = securityGroups - return _options -} - -// SetSubnet : Allow user to set Subnet -func (_options *CreateVirtualNetworkInterfaceOptions) SetSubnet(subnet SubnetIdentityIntf) *CreateVirtualNetworkInterfaceOptions { - _options.Subnet = subnet - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateVirtualNetworkInterfaceOptions { - options.Headers = param - return options -} - -// CreateVolumeOptions : The CreateVolume options. -type CreateVolumeOptions struct { - // The volume prototype object. - VolumePrototype VolumePrototypeIntf `json:"VolumePrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateVolumeOptions : Instantiate CreateVolumeOptions -func (*VpcV1) NewCreateVolumeOptions(volumePrototype VolumePrototypeIntf) *CreateVolumeOptions { - return &CreateVolumeOptions{ - VolumePrototype: volumePrototype, - } -} - -// SetVolumePrototype : Allow user to set VolumePrototype -func (_options *CreateVolumeOptions) SetVolumePrototype(volumePrototype VolumePrototypeIntf) *CreateVolumeOptions { - _options.VolumePrototype = volumePrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVolumeOptions) SetHeaders(param map[string]string) *CreateVolumeOptions { - options.Headers = param - return options -} - -// CreateVPCAddressPrefixOptions : The CreateVPCAddressPrefix options. -type CreateVPCAddressPrefixOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The IPv4 range of the address prefix, expressed in CIDR format. The range must not overlap with any existing address - // prefixes in the VPC or any of the following reserved address ranges: - // - // - `127.0.0.0/8` (IPv4 loopback addresses) - // - `161.26.0.0/16` (IBM services) - // - `166.8.0.0/14` (Cloud Service Endpoints) - // - `169.254.0.0/16` (IPv4 link-local addresses) - // - `224.0.0.0/4` (IPv4 multicast addresses) - // - // The prefix length of the address prefix's CIDR must be between `/9` (8,388,608 addresses) and `/29` (8 addresses). - CIDR *string `json:"cidr" validate:"required"` - - // The zone this address prefix will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // Indicates whether this will be the default address prefix for this zone in this VPC. If `true`, the VPC must not - // have a default address prefix for this zone. - 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. 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 -} - -// NewCreateVPCAddressPrefixOptions : Instantiate CreateVPCAddressPrefixOptions -func (*VpcV1) NewCreateVPCAddressPrefixOptions(vpcID string, cidr string, zone ZoneIdentityIntf) *CreateVPCAddressPrefixOptions { - return &CreateVPCAddressPrefixOptions{ - VPCID: core.StringPtr(vpcID), - CIDR: core.StringPtr(cidr), - Zone: zone, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *CreateVPCAddressPrefixOptions) SetVPCID(vpcID string) *CreateVPCAddressPrefixOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetCIDR : Allow user to set CIDR -func (_options *CreateVPCAddressPrefixOptions) SetCIDR(cidr string) *CreateVPCAddressPrefixOptions { - _options.CIDR = core.StringPtr(cidr) - return _options -} - -// SetZone : Allow user to set Zone -func (_options *CreateVPCAddressPrefixOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCAddressPrefixOptions { - _options.Zone = zone - return _options -} - -// SetIsDefault : Allow user to set IsDefault -func (_options *CreateVPCAddressPrefixOptions) SetIsDefault(isDefault bool) *CreateVPCAddressPrefixOptions { - _options.IsDefault = core.BoolPtr(isDefault) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPCAddressPrefixOptions) SetName(name string) *CreateVPCAddressPrefixOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPCAddressPrefixOptions) SetHeaders(param map[string]string) *CreateVPCAddressPrefixOptions { - options.Headers = param - return options -} - -// CreateVPCDnsResolutionBindingOptions : The CreateVPCDnsResolutionBinding options. -type CreateVPCDnsResolutionBindingOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // Another VPC to bind this VPC to for DNS resolution. The VPC must have - // `dns.enable_hub` set to `true`, and may be in a different account (subject to - // IAM policies). - // - // Additionally, the VPC specified in the URL (this VPC) must have `dns.enable_hub` - // set to `false` and a `dns.resolution_binding_count` of zero. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The name for this DNS resolution binding. The name must not be used by another DNS resolution binding for the VPC. - // 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 -} - -// NewCreateVPCDnsResolutionBindingOptions : Instantiate CreateVPCDnsResolutionBindingOptions -func (*VpcV1) NewCreateVPCDnsResolutionBindingOptions(vpcID string, vpc VPCIdentityIntf) *CreateVPCDnsResolutionBindingOptions { - return &CreateVPCDnsResolutionBindingOptions{ - VPCID: core.StringPtr(vpcID), - VPC: vpc, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *CreateVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *CreateVPCDnsResolutionBindingOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPC : Allow user to set VPC -func (_options *CreateVPCDnsResolutionBindingOptions) SetVPC(vpc VPCIdentityIntf) *CreateVPCDnsResolutionBindingOptions { - _options.VPC = vpc - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPCDnsResolutionBindingOptions) SetName(name string) *CreateVPCDnsResolutionBindingOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *CreateVPCDnsResolutionBindingOptions { - options.Headers = param - return options -} - -// CreateVPCOptions : The CreateVPC options. -type CreateVPCOptions struct { - // Indicates whether a [default address prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes) - // will be automatically created for each zone in this VPC. If `manual`, this VPC will be created with no default - // address prefixes. - // - // Since address prefixes are managed identically regardless of whether they were automatically created, the value is - // not preserved as a VPC property. - AddressPrefixManagement *string `json:"address_prefix_management,omitempty"` - - // 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. - ClassicAccess *bool `json:"classic_access,omitempty"` - - // The DNS configuration for this VPC. - // - // If unspecified, the system will assign DNS servers capable of resolving hosts and endpoint - // gateways within this VPC, and hosts on the internet. - Dns *VpcdnsPrototype `json:"dns,omitempty"` - - // The name for this VPC. The name must not be used by another VPC in the region. 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"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateVPCOptions.AddressPrefixManagement property. -// Indicates whether a [default address prefix](https://cloud.ibm.com/docs/vpc?topic=vpc-configuring-address-prefixes) -// will be automatically created for each zone in this VPC. If `manual`, this VPC will be created with no default -// address prefixes. -// -// Since address prefixes are managed identically regardless of whether they were automatically created, the value is -// not preserved as a VPC property. -const ( - CreateVPCOptionsAddressPrefixManagementAutoConst = "auto" - CreateVPCOptionsAddressPrefixManagementManualConst = "manual" -) - -// NewCreateVPCOptions : Instantiate CreateVPCOptions -func (*VpcV1) NewCreateVPCOptions() *CreateVPCOptions { - return &CreateVPCOptions{} -} - -// SetAddressPrefixManagement : Allow user to set AddressPrefixManagement -func (_options *CreateVPCOptions) SetAddressPrefixManagement(addressPrefixManagement string) *CreateVPCOptions { - _options.AddressPrefixManagement = core.StringPtr(addressPrefixManagement) - return _options -} - -// SetClassicAccess : Allow user to set ClassicAccess -func (_options *CreateVPCOptions) SetClassicAccess(classicAccess bool) *CreateVPCOptions { - _options.ClassicAccess = core.BoolPtr(classicAccess) - return _options -} - -// SetDns : Allow user to set Dns -func (_options *CreateVPCOptions) SetDns(dns *VpcdnsPrototype) *CreateVPCOptions { - _options.Dns = dns - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPCOptions) SetName(name string) *CreateVPCOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateVPCOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVPCOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPCOptions) SetHeaders(param map[string]string) *CreateVPCOptions { - options.Headers = param - return options -} - -// CreateVPCRouteOptions : The CreateVPCRoute options. -type CreateVPCRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The destination CIDR of the route. The host identifier in the CIDR must be zero. - // - // At most two routes per `zone` in a table can have the same `destination` and - // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. - Destination *string `json:"destination" validate:"required"` - - // The zone to apply the route 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 ZoneIdentityIntf `json:"zone" validate:"required"` - - // 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. - Action *string `json:"action,omitempty"` - - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - // - // All routes in a routing table with the same `destination` and `zone` must have the same - // `advertise` value. - Advertise *bool `json:"advertise,omitempty"` - - // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` - // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of - // randomly-selected words. - Name *string `json:"name,omitempty"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For other - // `action` values, it must be omitted or specified as `0.0.0.0`. - // - // At most two routes per `zone` in a table can have the same `destination` and `priority`, - // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. - NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` - - // 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,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateVPCRouteOptions.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. -const ( - CreateVPCRouteOptionsActionDelegateConst = "delegate" - CreateVPCRouteOptionsActionDelegateVPCConst = "delegate_vpc" - CreateVPCRouteOptionsActionDeliverConst = "deliver" - CreateVPCRouteOptionsActionDropConst = "drop" -) - -// NewCreateVPCRouteOptions : Instantiate CreateVPCRouteOptions -func (*VpcV1) NewCreateVPCRouteOptions(vpcID string, destination string, zone ZoneIdentityIntf) *CreateVPCRouteOptions { - return &CreateVPCRouteOptions{ - VPCID: core.StringPtr(vpcID), - Destination: core.StringPtr(destination), - Zone: zone, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *CreateVPCRouteOptions) SetVPCID(vpcID string) *CreateVPCRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetDestination : Allow user to set Destination -func (_options *CreateVPCRouteOptions) SetDestination(destination string) *CreateVPCRouteOptions { - _options.Destination = core.StringPtr(destination) - return _options -} - -// SetZone : Allow user to set Zone -func (_options *CreateVPCRouteOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCRouteOptions { - _options.Zone = zone - return _options -} - -// SetAction : Allow user to set Action -func (_options *CreateVPCRouteOptions) SetAction(action string) *CreateVPCRouteOptions { - _options.Action = core.StringPtr(action) - return _options -} - -// SetAdvertise : Allow user to set Advertise -func (_options *CreateVPCRouteOptions) SetAdvertise(advertise bool) *CreateVPCRouteOptions { - _options.Advertise = core.BoolPtr(advertise) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPCRouteOptions) SetName(name string) *CreateVPCRouteOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetNextHop : Allow user to set NextHop -func (_options *CreateVPCRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopIntf) *CreateVPCRouteOptions { - _options.NextHop = nextHop - return _options -} - -// SetPriority : Allow user to set Priority -func (_options *CreateVPCRouteOptions) SetPriority(priority int64) *CreateVPCRouteOptions { - _options.Priority = core.Int64Ptr(priority) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPCRouteOptions) SetHeaders(param map[string]string) *CreateVPCRouteOptions { - options.Headers = param - return options -} - -// CreateVPCRoutingTableOptions : The CreateVPCRoutingTable options. -type CreateVPCRoutingTableOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The filters specifying the resources that may create routes in this routing table. - 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 - // sources. - AdvertiseRoutesTo []string `json:"advertise_routes_to,omitempty"` - - // The name for this routing table. The name must not be used by another routing table in the VPC. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // If set to `true`, this routing table will be used to route traffic that originates from [Direct - // Link](https://cloud.ibm.com/docs/dl) to this VPC. The VPC must not already have a routing table with this property - // set to `true`. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - // - // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled - // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing - // table. - RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` - - // If set to `true`, this routing table will be used to route traffic that originates from the internet. For this to - // succeed, the VPC must not already have a routing table with this property set to `true`. - // - // Incoming traffic will be routed according to the routing table with two exceptions: - // - Traffic destined for IP addresses associated with public gateways will not be - // subject to routes in this routing table. - // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is - // an IP address in a subnet in the route's `zone` that is able to accept traffic. - // Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"` - - // If set to `true`, this routing table will be used to route traffic that originates from [Transit - // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. The VPC must not already have a routing table with - // this property set to `true`. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` - - // If set to `true`, this routing table will be used to route traffic that originates from subnets in other zones in - // this VPC. The VPC must not already have a routing table with this property set to `true`. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` - - // The prototype objects for routes to create for this routing table. If unspecified, the routing table will be created - // with no routes. - Routes []RoutePrototype `json:"routes,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateVPCRoutingTableOptions.AdvertiseRoutesTo property. -// An ingress source that routes can be advertised to: -// -// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) -// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). -const ( - CreateVPCRoutingTableOptionsAdvertiseRoutesToDirectLinkConst = "direct_link" - CreateVPCRoutingTableOptionsAdvertiseRoutesToTransitGatewayConst = "transit_gateway" -) - -// NewCreateVPCRoutingTableOptions : Instantiate CreateVPCRoutingTableOptions -func (*VpcV1) NewCreateVPCRoutingTableOptions(vpcID string) *CreateVPCRoutingTableOptions { - return &CreateVPCRoutingTableOptions{ - VPCID: core.StringPtr(vpcID), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *CreateVPCRoutingTableOptions) SetVPCID(vpcID string) *CreateVPCRoutingTableOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetAcceptRoutesFrom : Allow user to set AcceptRoutesFrom -func (_options *CreateVPCRoutingTableOptions) SetAcceptRoutesFrom(acceptRoutesFrom []ResourceFilter) *CreateVPCRoutingTableOptions { - _options.AcceptRoutesFrom = acceptRoutesFrom - return _options -} - -// SetAdvertiseRoutesTo : Allow user to set AdvertiseRoutesTo -func (_options *CreateVPCRoutingTableOptions) SetAdvertiseRoutesTo(advertiseRoutesTo []string) *CreateVPCRoutingTableOptions { - _options.AdvertiseRoutesTo = advertiseRoutesTo - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPCRoutingTableOptions) SetName(name string) *CreateVPCRoutingTableOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetRouteDirectLinkIngress : Allow user to set RouteDirectLinkIngress -func (_options *CreateVPCRoutingTableOptions) SetRouteDirectLinkIngress(routeDirectLinkIngress bool) *CreateVPCRoutingTableOptions { - _options.RouteDirectLinkIngress = core.BoolPtr(routeDirectLinkIngress) - return _options -} - -// SetRouteInternetIngress : Allow user to set RouteInternetIngress -func (_options *CreateVPCRoutingTableOptions) SetRouteInternetIngress(routeInternetIngress bool) *CreateVPCRoutingTableOptions { - _options.RouteInternetIngress = core.BoolPtr(routeInternetIngress) - return _options -} - -// SetRouteTransitGatewayIngress : Allow user to set RouteTransitGatewayIngress -func (_options *CreateVPCRoutingTableOptions) SetRouteTransitGatewayIngress(routeTransitGatewayIngress bool) *CreateVPCRoutingTableOptions { - _options.RouteTransitGatewayIngress = core.BoolPtr(routeTransitGatewayIngress) - return _options -} - -// SetRouteVPCZoneIngress : Allow user to set RouteVPCZoneIngress -func (_options *CreateVPCRoutingTableOptions) SetRouteVPCZoneIngress(routeVPCZoneIngress bool) *CreateVPCRoutingTableOptions { - _options.RouteVPCZoneIngress = core.BoolPtr(routeVPCZoneIngress) - return _options -} - -// SetRoutes : Allow user to set Routes -func (_options *CreateVPCRoutingTableOptions) SetRoutes(routes []RoutePrototype) *CreateVPCRoutingTableOptions { - _options.Routes = routes - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPCRoutingTableOptions) SetHeaders(param map[string]string) *CreateVPCRoutingTableOptions { - options.Headers = param - return options -} - -// CreateVPCRoutingTableRouteOptions : The CreateVPCRoutingTableRoute options. -type CreateVPCRoutingTableRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The routing table identifier. - RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` - - // The destination CIDR of the route. The host identifier in the CIDR must be zero. - // - // At most two routes per `zone` in a table can have the same `destination` and - // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. - Destination *string `json:"destination" validate:"required"` - - // The zone to apply the route 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 ZoneIdentityIntf `json:"zone" validate:"required"` - - // 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. - Action *string `json:"action,omitempty"` - - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - // - // All routes in a routing table with the same `destination` and `zone` must have the same - // `advertise` value. - Advertise *bool `json:"advertise,omitempty"` - - // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` - // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of - // randomly-selected words. - Name *string `json:"name,omitempty"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For other - // `action` values, it must be omitted or specified as `0.0.0.0`. - // - // At most two routes per `zone` in a table can have the same `destination` and `priority`, - // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. - NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` - - // 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,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the CreateVPCRoutingTableRouteOptions.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. -const ( - CreateVPCRoutingTableRouteOptionsActionDelegateConst = "delegate" - CreateVPCRoutingTableRouteOptionsActionDelegateVPCConst = "delegate_vpc" - CreateVPCRoutingTableRouteOptionsActionDeliverConst = "deliver" - CreateVPCRoutingTableRouteOptionsActionDropConst = "drop" -) - -// NewCreateVPCRoutingTableRouteOptions : Instantiate CreateVPCRoutingTableRouteOptions -func (*VpcV1) NewCreateVPCRoutingTableRouteOptions(vpcID string, routingTableID string, destination string, zone ZoneIdentityIntf) *CreateVPCRoutingTableRouteOptions { - return &CreateVPCRoutingTableRouteOptions{ - VPCID: core.StringPtr(vpcID), - RoutingTableID: core.StringPtr(routingTableID), - Destination: core.StringPtr(destination), - Zone: zone, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *CreateVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *CreateVPCRoutingTableRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetRoutingTableID : Allow user to set RoutingTableID -func (_options *CreateVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *CreateVPCRoutingTableRouteOptions { - _options.RoutingTableID = core.StringPtr(routingTableID) - return _options -} - -// SetDestination : Allow user to set Destination -func (_options *CreateVPCRoutingTableRouteOptions) SetDestination(destination string) *CreateVPCRoutingTableRouteOptions { - _options.Destination = core.StringPtr(destination) - return _options -} - -// SetZone : Allow user to set Zone -func (_options *CreateVPCRoutingTableRouteOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCRoutingTableRouteOptions { - _options.Zone = zone - return _options -} - -// SetAction : Allow user to set Action -func (_options *CreateVPCRoutingTableRouteOptions) SetAction(action string) *CreateVPCRoutingTableRouteOptions { - _options.Action = core.StringPtr(action) - return _options -} - -// SetAdvertise : Allow user to set Advertise -func (_options *CreateVPCRoutingTableRouteOptions) SetAdvertise(advertise bool) *CreateVPCRoutingTableRouteOptions { - _options.Advertise = core.BoolPtr(advertise) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPCRoutingTableRouteOptions) SetName(name string) *CreateVPCRoutingTableRouteOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetNextHop : Allow user to set NextHop -func (_options *CreateVPCRoutingTableRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopIntf) *CreateVPCRoutingTableRouteOptions { - _options.NextHop = nextHop - return _options -} - -// SetPriority : Allow user to set Priority -func (_options *CreateVPCRoutingTableRouteOptions) SetPriority(priority int64) *CreateVPCRoutingTableRouteOptions { - _options.Priority = core.Int64Ptr(priority) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *CreateVPCRoutingTableRouteOptions { - options.Headers = param - return options -} - -// CreateVPNGatewayConnectionOptions : The CreateVPNGatewayConnection options. -type CreateVPNGatewayConnectionOptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN gateway connection prototype object. - VPNGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf `json:"VPNGatewayConnectionPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateVPNGatewayConnectionOptions : Instantiate CreateVPNGatewayConnectionOptions -func (*VpcV1) NewCreateVPNGatewayConnectionOptions(vpnGatewayID string, vpnGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf) *CreateVPNGatewayConnectionOptions { - return &CreateVPNGatewayConnectionOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - VPNGatewayConnectionPrototype: vpnGatewayConnectionPrototype, - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *CreateVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *CreateVPNGatewayConnectionOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetVPNGatewayConnectionPrototype : Allow user to set VPNGatewayConnectionPrototype -func (_options *CreateVPNGatewayConnectionOptions) SetVPNGatewayConnectionPrototype(vpnGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf) *CreateVPNGatewayConnectionOptions { - _options.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *CreateVPNGatewayConnectionOptions { - options.Headers = param - return options -} - -// CreateVPNGatewayOptions : The CreateVPNGateway options. -type CreateVPNGatewayOptions struct { - // The VPN gateway prototype object. - VPNGatewayPrototype VPNGatewayPrototypeIntf `json:"VPNGatewayPrototype" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateVPNGatewayOptions : Instantiate CreateVPNGatewayOptions -func (*VpcV1) NewCreateVPNGatewayOptions(vpnGatewayPrototype VPNGatewayPrototypeIntf) *CreateVPNGatewayOptions { - return &CreateVPNGatewayOptions{ - VPNGatewayPrototype: vpnGatewayPrototype, - } -} - -// SetVPNGatewayPrototype : Allow user to set VPNGatewayPrototype -func (_options *CreateVPNGatewayOptions) SetVPNGatewayPrototype(vpnGatewayPrototype VPNGatewayPrototypeIntf) *CreateVPNGatewayOptions { - _options.VPNGatewayPrototype = vpnGatewayPrototype - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPNGatewayOptions) SetHeaders(param map[string]string) *CreateVPNGatewayOptions { - options.Headers = param - return options -} - -// CreateVPNServerOptions : The CreateVPNServer options. -type CreateVPNServerOptions struct { - // The certificate instance for this VPN server. - Certificate CertificateInstanceIdentityIntf `json:"certificate" validate:"required"` - - // The methods used to authenticate VPN clients to this VPN server. VPN clients must authenticate against all specified - // methods. - ClientAuthentication []VPNServerAuthenticationPrototypeIntf `json:"client_authentication" validate:"required"` - - // The VPN client IPv4 address pool, expressed in CIDR format. The request must not overlap with any existing address - // prefixes in the VPC or any of the following reserved address ranges: - // - `127.0.0.0/8` (IPv4 loopback addresses) - // - `161.26.0.0/16` (IBM services) - // - `166.8.0.0/14` (Cloud Service Endpoints) - // - `169.254.0.0/16` (IPv4 link-local addresses) - // - `224.0.0.0/4` (IPv4 multicast addresses) - // - // The prefix length of the client IP address pool's CIDR must be between - // `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that contains twice the number of IP addresses - // that are required to enable the maximum number of concurrent connections is recommended. - ClientIPPool *string `json:"client_ip_pool" validate:"required"` - - // The subnets to provision this VPN server in. Use subnets in different zones for high availability. - Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` - - // The DNS server addresses that will be provided to VPN clients connected to this VPN server. - ClientDnsServerIps []IP `json:"client_dns_server_ips,omitempty"` - - // The seconds a VPN client can be idle before this VPN server will disconnect it. Specify `0` to prevent the server - // from disconnecting idle clients. - ClientIdleTimeout *int64 `json:"client_idle_timeout,omitempty"` - - // Indicates whether the split tunneling is enabled on this VPN server. - EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"` - - // The name for this VPN server. The name must not be used by another VPN server in the VPC. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The port number to use for this VPN server. - Port *int64 `json:"port,omitempty"` - - // The transport protocol to use for this VPN server. - Protocol *string `json:"protocol,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 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 - Headers map[string]string -} - -// Constants associated with the CreateVPNServerOptions.Protocol property. -// The transport protocol to use for this VPN server. -const ( - CreateVPNServerOptionsProtocolTCPConst = "tcp" - CreateVPNServerOptionsProtocolUDPConst = "udp" -) - -// NewCreateVPNServerOptions : Instantiate CreateVPNServerOptions -func (*VpcV1) NewCreateVPNServerOptions(certificate CertificateInstanceIdentityIntf, clientAuthentication []VPNServerAuthenticationPrototypeIntf, clientIPPool string, subnets []SubnetIdentityIntf) *CreateVPNServerOptions { - return &CreateVPNServerOptions{ - Certificate: certificate, - ClientAuthentication: clientAuthentication, - ClientIPPool: core.StringPtr(clientIPPool), - Subnets: subnets, - } -} - -// SetCertificate : Allow user to set Certificate -func (_options *CreateVPNServerOptions) SetCertificate(certificate CertificateInstanceIdentityIntf) *CreateVPNServerOptions { - _options.Certificate = certificate - return _options -} - -// SetClientAuthentication : Allow user to set ClientAuthentication -func (_options *CreateVPNServerOptions) SetClientAuthentication(clientAuthentication []VPNServerAuthenticationPrototypeIntf) *CreateVPNServerOptions { - _options.ClientAuthentication = clientAuthentication - return _options -} - -// SetClientIPPool : Allow user to set ClientIPPool -func (_options *CreateVPNServerOptions) SetClientIPPool(clientIPPool string) *CreateVPNServerOptions { - _options.ClientIPPool = core.StringPtr(clientIPPool) - return _options -} - -// SetSubnets : Allow user to set Subnets -func (_options *CreateVPNServerOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateVPNServerOptions { - _options.Subnets = subnets - return _options -} - -// SetClientDnsServerIps : Allow user to set ClientDnsServerIps -func (_options *CreateVPNServerOptions) SetClientDnsServerIps(clientDnsServerIps []IP) *CreateVPNServerOptions { - _options.ClientDnsServerIps = clientDnsServerIps - return _options -} - -// SetClientIdleTimeout : Allow user to set ClientIdleTimeout -func (_options *CreateVPNServerOptions) SetClientIdleTimeout(clientIdleTimeout int64) *CreateVPNServerOptions { - _options.ClientIdleTimeout = core.Int64Ptr(clientIdleTimeout) - return _options -} - -// SetEnableSplitTunneling : Allow user to set EnableSplitTunneling -func (_options *CreateVPNServerOptions) SetEnableSplitTunneling(enableSplitTunneling bool) *CreateVPNServerOptions { - _options.EnableSplitTunneling = core.BoolPtr(enableSplitTunneling) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPNServerOptions) SetName(name string) *CreateVPNServerOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetPort : Allow user to set Port -func (_options *CreateVPNServerOptions) SetPort(port int64) *CreateVPNServerOptions { - _options.Port = core.Int64Ptr(port) - return _options -} - -// SetProtocol : Allow user to set Protocol -func (_options *CreateVPNServerOptions) SetProtocol(protocol string) *CreateVPNServerOptions { - _options.Protocol = core.StringPtr(protocol) - return _options -} - -// SetResourceGroup : Allow user to set ResourceGroup -func (_options *CreateVPNServerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVPNServerOptions { - _options.ResourceGroup = resourceGroup - return _options -} - -// SetSecurityGroups : Allow user to set SecurityGroups -func (_options *CreateVPNServerOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateVPNServerOptions { - _options.SecurityGroups = securityGroups - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPNServerOptions) SetHeaders(param map[string]string) *CreateVPNServerOptions { - options.Headers = param - return options -} - -// CreateVPNServerRouteOptions : The CreateVPNServerRoute options. -type CreateVPNServerRouteOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // The destination to use for this VPN route in the VPN server. Must be unique within the VPN server. If an incoming - // packet does not match any destination, it will be dropped. - Destination *string `json:"destination" validate:"required"` - - // The action to perform with a packet matching the VPN route: - // - `translate`: translate the source IP address to one of the private IP addresses of - // the VPN server, then deliver the packet to target. - // - `deliver`: deliver the packet to the target. - // - `drop`: drop the packet. - Action *string `json:"action,omitempty"` - - // The name for this VPN server route. The name must not be used by another route for the VPN server. 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 -} - -// Constants associated with the CreateVPNServerRouteOptions.Action property. -// The action to perform with a packet matching the VPN route: -// - `translate`: translate the source IP address to one of the private IP addresses of -// the VPN server, then deliver the packet to target. -// - `deliver`: deliver the packet to the target. -// - `drop`: drop the packet. -const ( - CreateVPNServerRouteOptionsActionDeliverConst = "deliver" - CreateVPNServerRouteOptionsActionDropConst = "drop" - CreateVPNServerRouteOptionsActionTranslateConst = "translate" -) - -// NewCreateVPNServerRouteOptions : Instantiate CreateVPNServerRouteOptions -func (*VpcV1) NewCreateVPNServerRouteOptions(vpnServerID string, destination string) *CreateVPNServerRouteOptions { - return &CreateVPNServerRouteOptions{ - VPNServerID: core.StringPtr(vpnServerID), - Destination: core.StringPtr(destination), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *CreateVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *CreateVPNServerRouteOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetDestination : Allow user to set Destination -func (_options *CreateVPNServerRouteOptions) SetDestination(destination string) *CreateVPNServerRouteOptions { - _options.Destination = core.StringPtr(destination) - return _options -} - -// SetAction : Allow user to set Action -func (_options *CreateVPNServerRouteOptions) SetAction(action string) *CreateVPNServerRouteOptions { - _options.Action = core.StringPtr(action) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateVPNServerRouteOptions) SetName(name string) *CreateVPNServerRouteOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPNServerRouteOptions) SetHeaders(param map[string]string) *CreateVPNServerRouteOptions { - options.Headers = param - return options -} - -// DnsInstanceIdentity : Identifies a DNS instance by a unique property. -// Models which "extend" this model: -// - DnsInstanceIdentityByCRN -type DnsInstanceIdentity struct { - // The CRN for this DNS instance. - CRN *string `json:"crn,omitempty"` -} - -func (*DnsInstanceIdentity) isaDnsInstanceIdentity() bool { - return true -} - -type DnsInstanceIdentityIntf interface { - isaDnsInstanceIdentity() bool -} - -// UnmarshalDnsInstanceIdentity unmarshals an instance of DnsInstanceIdentity from the specified map of raw messages. -func UnmarshalDnsInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsInstanceIdentity) - 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 -} - -// DnsInstanceReference : DnsInstanceReference struct -type DnsInstanceReference struct { - // The CRN for this DNS instance. - CRN *string `json:"crn" validate:"required"` -} - -// UnmarshalDnsInstanceReference unmarshals an instance of DnsInstanceReference from the specified map of raw messages. -func UnmarshalDnsInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsInstanceReference) - 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 -} - -// DnsServer : A DNS server. -type DnsServer struct { - // The IP address. - // - // 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"` - - // If present, DHCP configuration for this zone will have this DNS server listed first. - ZoneAffinity *ZoneReference `json:"zone_affinity,omitempty"` -} - -// UnmarshalDnsServer unmarshals an instance of DnsServer from the specified map of raw messages. -func UnmarshalDnsServer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsServer) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneReference) - if err != nil { - err = core.SDKErrorf(err, "", "zone_affinity-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DnsServerPrototype : DnsServerPrototype struct -type DnsServerPrototype struct { - // The IP address. - // - // 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"` - - // DHCP configuration for the specified zone will have this DNS server listed first. - ZoneAffinity ZoneIdentityIntf `json:"zone_affinity,omitempty"` -} - -// NewDnsServerPrototype : Instantiate DnsServerPrototype (Generic Model Constructor) -func (*VpcV1) NewDnsServerPrototype(address string) (_model *DnsServerPrototype, err error) { - _model = &DnsServerPrototype{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalDnsServerPrototype unmarshals an instance of DnsServerPrototype from the specified map of raw messages. -func UnmarshalDnsServerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsServerPrototype) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone_affinity", &obj.ZoneAffinity, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone_affinity-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DnsZoneIdentity : Identifies a DNS zone by a unique property. -// Models which "extend" this model: -// - DnsZoneIdentityByID -type DnsZoneIdentity struct { - ID *string `json:"id,omitempty"` -} - -func (*DnsZoneIdentity) isaDnsZoneIdentity() bool { - return true -} - -type DnsZoneIdentityIntf interface { - isaDnsZoneIdentity() bool -} - -// UnmarshalDnsZoneIdentity unmarshals an instance of DnsZoneIdentity from the specified map of raw messages. -func UnmarshalDnsZoneIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsZoneIdentity) - 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 -} - -// DnsZoneReference : DnsZoneReference struct -type DnsZoneReference struct { - ID *string `json:"id" validate:"required"` -} - -// UnmarshalDnsZoneReference unmarshals an instance of DnsZoneReference from the specified map of raw messages. -func UnmarshalDnsZoneReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsZoneReference) - 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 -} - -// DedicatedHost : DedicatedHost struct -type DedicatedHost struct { - // The amount of memory in gibibytes that is currently available for instances. - AvailableMemory *int64 `json:"available_memory" validate:"required"` - - // The available VCPU for the dedicated host. - AvailableVcpu *Vcpu `json:"available_vcpu" validate:"required"` - - // The date and time that the dedicated host was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this dedicated host. - CRN *string `json:"crn" validate:"required"` - - // Collection of the dedicated host's disks. - Disks []DedicatedHostDisk `json:"disks" validate:"required"` - - // The dedicated host group this dedicated host is in. - Group *DedicatedHostGroupReference `json:"group" validate:"required"` - - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this dedicated host. - ID *string `json:"id" validate:"required"` - - // If set to true, instances can be placed on this dedicated host. - InstancePlacementEnabled *bool `json:"instance_placement_enabled" validate:"required"` - - // The instances that are allocated to this dedicated host. - Instances []InstanceReference `json:"instances" validate:"required"` - - // The lifecycle state of the dedicated host. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The total amount of memory in gibibytes for this host. - Memory *int64 `json:"memory" validate:"required"` - - // The name for this dedicated host. The name is unique across all dedicated hosts in the region. - Name *string `json:"name" validate:"required"` - - // The dedicated host NUMA configuration. - Numa *DedicatedHostNuma `json:"numa" validate:"required"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) for this - // dedicated host. - Profile *DedicatedHostProfileReference `json:"profile" validate:"required"` - - // Indicates whether this dedicated host is available for instance creation. - Provisionable *bool `json:"provisionable" validate:"required"` - - // The resource group for this dedicated host. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The total number of sockets for this host. - SocketCount *int64 `json:"socket_count" validate:"required"` - - // The administrative state of the dedicated host. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - State *string `json:"state" validate:"required"` - - // The instance profiles usable by instances placed on this dedicated host. - SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` - - // The total VCPU of the dedicated host. - Vcpu *Vcpu `json:"vcpu" validate:"required"` - - // The zone this dedicated host resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the DedicatedHost.LifecycleState property. -// The lifecycle state of the dedicated host. -const ( - DedicatedHostLifecycleStateDeletingConst = "deleting" - DedicatedHostLifecycleStateFailedConst = "failed" - DedicatedHostLifecycleStatePendingConst = "pending" - DedicatedHostLifecycleStateStableConst = "stable" - DedicatedHostLifecycleStateSuspendedConst = "suspended" - DedicatedHostLifecycleStateUpdatingConst = "updating" - DedicatedHostLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the DedicatedHost.ResourceType property. -// The resource type. -const ( - DedicatedHostResourceTypeDedicatedHostConst = "dedicated_host" -) - -// Constants associated with the DedicatedHost.State property. -// The administrative state of the dedicated host. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - DedicatedHostStateAvailableConst = "available" - DedicatedHostStateDegradedConst = "degraded" - DedicatedHostStateMigratingConst = "migrating" - DedicatedHostStateUnavailableConst = "unavailable" -) - -// UnmarshalDedicatedHost unmarshals an instance of DedicatedHost from the specified map of raw messages. -func UnmarshalDedicatedHost(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHost) - err = core.UnmarshalPrimitive(m, "available_memory", &obj.AvailableMemory) - if err != nil { - err = core.SDKErrorf(err, "", "available_memory-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "available_vcpu", &obj.AvailableVcpu, UnmarshalVcpu) - if err != nil { - err = core.SDKErrorf(err, "", "available_vcpu-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) - if err != nil { - err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "group-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, "instance_placement_enabled", &obj.InstancePlacementEnabled) - if err != nil { - err = core.SDKErrorf(err, "", "instance_placement_enabled-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstanceReference) - if err != nil { - err = core.SDKErrorf(err, "", "instances-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, "memory", &obj.Memory) - if err != nil { - err = core.SDKErrorf(err, "", "memory-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, "numa", &obj.Numa, UnmarshalDedicatedHostNuma) - if err != nil { - err = core.SDKErrorf(err, "", "numa-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileReference) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) - if err != nil { - err = core.SDKErrorf(err, "", "provisionable-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.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) - if err != nil { - err = core.SDKErrorf(err, "", "socket_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "state", &obj.State) - if err != nil { - err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) - if err != nil { - err = core.SDKErrorf(err, "", "supported_instance_profiles-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalVcpu) - if err != nil { - err = core.SDKErrorf(err, "", "vcpu-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 -} - -// DedicatedHostCollection : DedicatedHostCollection struct -type DedicatedHostCollection struct { - // Collection of dedicated hosts. - DedicatedHosts []DedicatedHost `json:"dedicated_hosts" validate:"required"` - - // A link to the first page of resources. - First *DedicatedHostCollectionFirst `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"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalDedicatedHostCollection unmarshals an instance of DedicatedHostCollection from the specified map of raw messages. -func UnmarshalDedicatedHostCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostCollection) - err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHost) - if err != nil { - err = core.SDKErrorf(err, "", "dedicated_hosts-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostCollectionFirst) - 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, UnmarshalDedicatedHostCollectionNext) - 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 *DedicatedHostCollection) 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 -} - -// 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). - Available *int64 `json:"available" validate:"required"` - - // The date and time that the disk was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this disk. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this disk. - ID *string `json:"id" validate:"required"` - - // Instance disks that are on this dedicated host disk. - InstanceDisks []InstanceDiskReference `json:"instance_disks" validate:"required"` - - // The disk interface used for attaching the disk - // - // 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 lifecycle state of this dedicated host disk. - LifecycleState *string `json:"lifecycle_state,omitempty"` - - // The name for this dedicated host disk. The name is unique across all disks on the dedicated host. - Name *string `json:"name" validate:"required"` - - // Indicates whether this dedicated host disk is available for instance disk creation. - Provisionable *bool `json:"provisionable" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The size of the disk in GB (gigabytes). - Size *int64 `json:"size" validate:"required"` - - // The instance disk interfaces supported for this dedicated host disk. - SupportedInstanceInterfaceTypes []string `json:"supported_instance_interface_types" validate:"required"` -} - -// Constants associated with the DedicatedHostDisk.InterfaceType property. -// The disk interface used for attaching the disk -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - DedicatedHostDiskInterfaceTypeNvmeConst = "nvme" -) - -// Constants associated with the DedicatedHostDisk.LifecycleState property. -// The lifecycle state of this dedicated host disk. -const ( - DedicatedHostDiskLifecycleStateDeletingConst = "deleting" - DedicatedHostDiskLifecycleStateFailedConst = "failed" - DedicatedHostDiskLifecycleStatePendingConst = "pending" - DedicatedHostDiskLifecycleStateStableConst = "stable" - DedicatedHostDiskLifecycleStateSuspendedConst = "suspended" - DedicatedHostDiskLifecycleStateUpdatingConst = "updating" - DedicatedHostDiskLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the DedicatedHostDisk.ResourceType property. -// The resource type. -const ( - DedicatedHostDiskResourceTypeDedicatedHostDiskConst = "dedicated_host_disk" -) - -// Constants associated with the DedicatedHostDisk.SupportedInstanceInterfaceTypes property. -// The disk interface used for attaching the disk. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - DedicatedHostDiskSupportedInstanceInterfaceTypesNvmeConst = "nvme" - DedicatedHostDiskSupportedInstanceInterfaceTypesVirtioBlkConst = "virtio_blk" -) - -// UnmarshalDedicatedHostDisk unmarshals an instance of DedicatedHostDisk from the specified map of raw messages. -func UnmarshalDedicatedHostDisk(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostDisk) - err = core.UnmarshalPrimitive(m, "available", &obj.Available) - if err != nil { - err = core.SDKErrorf(err, "", "available-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.UnmarshalModel(m, "instance_disks", &obj.InstanceDisks, UnmarshalInstanceDiskReference) - if err != nil { - err = core.SDKErrorf(err, "", "instance_disks-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()) - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) - if err != nil { - err = core.SDKErrorf(err, "", "provisionable-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, "size", &obj.Size) - if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes) - if err != nil { - err = core.SDKErrorf(err, "", "supported_instance_interface_types-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostDiskCollection : DedicatedHostDiskCollection struct -type DedicatedHostDiskCollection struct { - // Collection of the dedicated host's disks. - Disks []DedicatedHostDisk `json:"disks" validate:"required"` -} - -// UnmarshalDedicatedHostDiskCollection unmarshals an instance of DedicatedHostDiskCollection from the specified map of raw messages. -func UnmarshalDedicatedHostDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostDiskCollection) - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) - if err != nil { - err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostDiskPatch : DedicatedHostDiskPatch struct -type DedicatedHostDiskPatch struct { - // The name for this dedicated host disk. The name must not be used by another disk on the dedicated host. - Name *string `json:"name,omitempty"` -} - -// UnmarshalDedicatedHostDiskPatch unmarshals an instance of DedicatedHostDiskPatch from the specified map of raw messages. -func UnmarshalDedicatedHostDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostDiskPatch) - 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 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()) - } - return -} - -// DedicatedHostGroup : DedicatedHostGroup struct -type DedicatedHostGroup struct { - // The dedicated host profile class for hosts in this group. - Class *string `json:"class" validate:"required"` - - // The date and time that the dedicated host group was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` - - // The dedicated hosts that are in this dedicated host group. - DedicatedHosts []DedicatedHostReference `json:"dedicated_hosts" validate:"required"` - - // The dedicated host profile family for hosts in this group. - Family *string `json:"family" validate:"required"` - - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` - - // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. - Name *string `json:"name" validate:"required"` - - // The resource group for this dedicated host group. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The instance profiles usable by instances placed on this dedicated host group. - SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` - - // The zone this dedicated host group resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the DedicatedHostGroup.Family property. -// The dedicated host profile family for hosts in this group. -const ( - DedicatedHostGroupFamilyBalancedConst = "balanced" - DedicatedHostGroupFamilyComputeConst = "compute" - DedicatedHostGroupFamilyMemoryConst = "memory" -) - -// Constants associated with the DedicatedHostGroup.ResourceType property. -// The resource type. -const ( - DedicatedHostGroupResourceTypeDedicatedHostGroupConst = "dedicated_host_group" -) - -// UnmarshalDedicatedHostGroup unmarshals an instance of DedicatedHostGroup from the specified map of raw messages. -func UnmarshalDedicatedHostGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroup) - err = core.UnmarshalPrimitive(m, "class", &obj.Class) - if err != nil { - err = core.SDKErrorf(err, "", "class-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHostReference) - if err != nil { - err = core.SDKErrorf(err, "", "dedicated_hosts-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - err = core.SDKErrorf(err, "", "family-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, "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, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) - if err != nil { - err = core.SDKErrorf(err, "", "supported_instance_profiles-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 -} - -// DedicatedHostGroupCollection : DedicatedHostGroupCollection struct -type DedicatedHostGroupCollection struct { - // A link to the first page of resources. - First *DedicatedHostGroupCollectionFirst `json:"first" validate:"required"` - - // Collection of dedicated host groups. - Groups []DedicatedHostGroup `json:"groups" 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 *DedicatedHostGroupCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "groups", &obj.Groups, UnmarshalDedicatedHostGroup) - if err != nil { - err = core.SDKErrorf(err, "", "groups-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, UnmarshalDedicatedHostGroupCollectionNext) - 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 *DedicatedHostGroupCollection) 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 -} - -// 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 -// - DedicatedHostGroupIdentityByCRN -// - DedicatedHostGroupIdentityByHref -type DedicatedHostGroupIdentity struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id,omitempty"` - - // The CRN for this dedicated host group. - CRN *string `json:"crn,omitempty"` - - // The URL for this dedicated host group. - Href *string `json:"href,omitempty"` -} - -func (*DedicatedHostGroupIdentity) isaDedicatedHostGroupIdentity() bool { - return true -} - -type DedicatedHostGroupIdentityIntf interface { - isaDedicatedHostGroupIdentity() bool -} - -// UnmarshalDedicatedHostGroupIdentity unmarshals an instance of DedicatedHostGroupIdentity from the specified map of raw messages. -func UnmarshalDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostGroupPatch : DedicatedHostGroupPatch struct -type DedicatedHostGroupPatch struct { - // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. - Name *string `json:"name,omitempty"` -} - -// UnmarshalDedicatedHostGroupPatch unmarshals an instance of DedicatedHostGroupPatch from the specified map of raw messages. -func UnmarshalDedicatedHostGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupPatch) - 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 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()) - } - return -} - -// DedicatedHostGroupPrototypeDedicatedHostByZoneContext : DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct -type DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct { - // The name for this dedicated host group. The name must not be used by another dedicated host group in the region. 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 host's resource group is used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` -} - -// UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext unmarshals an instance of DedicatedHostGroupPrototypeDedicatedHostByZoneContext from the specified map of raw messages. -func UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupPrototypeDedicatedHostByZoneContext) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostGroupReference : DedicatedHostGroupReference struct -type DedicatedHostGroupReference struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` - - // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the DedicatedHostGroupReference.ResourceType property. -// The resource type. -const ( - DedicatedHostGroupReferenceResourceTypeDedicatedHostGroupConst = "dedicated_host_group" -) - -// UnmarshalDedicatedHostGroupReference unmarshals an instance of DedicatedHostGroupReference from the specified map of raw messages. -func UnmarshalDedicatedHostGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupReference) - 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, UnmarshalDedicatedHostGroupReferenceDeleted) - 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 -} - -// DedicatedHostGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type DedicatedHostGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalDedicatedHostGroupReferenceDeleted unmarshals an instance of DedicatedHostGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalDedicatedHostGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupReferenceDeleted) - 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 -} - -// DedicatedHostNuma : The dedicated host NUMA configuration. -type DedicatedHostNuma struct { - // The total number of NUMA nodes for this dedicated host. - Count *int64 `json:"count" validate:"required"` - - // The NUMA nodes for this dedicated host. - Nodes []DedicatedHostNumaNode `json:"nodes" validate:"required"` -} - -// UnmarshalDedicatedHostNuma unmarshals an instance of DedicatedHostNuma from the specified map of raw messages. -func UnmarshalDedicatedHostNuma(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostNuma) - err = core.UnmarshalPrimitive(m, "count", &obj.Count) - if err != nil { - err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "nodes", &obj.Nodes, UnmarshalDedicatedHostNumaNode) - if err != nil { - err = core.SDKErrorf(err, "", "nodes-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostNumaNode : The dedicated host NUMA node configuration. -type DedicatedHostNumaNode struct { - // The available VCPU for this NUMA node. - AvailableVcpu *int64 `json:"available_vcpu" validate:"required"` - - // The total VCPU capacity for this NUMA node. - Vcpu *int64 `json:"vcpu" validate:"required"` -} - -// UnmarshalDedicatedHostNumaNode unmarshals an instance of DedicatedHostNumaNode from the specified map of raw messages. -func UnmarshalDedicatedHostNumaNode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostNumaNode) - err = core.UnmarshalPrimitive(m, "available_vcpu", &obj.AvailableVcpu) - if err != nil { - err = core.SDKErrorf(err, "", "available_vcpu-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "vcpu", &obj.Vcpu) - if err != nil { - err = core.SDKErrorf(err, "", "vcpu-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostPatch : DedicatedHostPatch struct -type DedicatedHostPatch struct { - // If set to true, instances can be placed on this dedicated host. - InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` - - // The name for this dedicated host. The name must not be used by another dedicated host in the region. - Name *string `json:"name,omitempty"` -} - -// UnmarshalDedicatedHostPatch unmarshals an instance of DedicatedHostPatch from the specified map of raw messages. -func UnmarshalDedicatedHostPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostPatch) - err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) - if err != nil { - err = core.SDKErrorf(err, "", "instance_placement_enabled-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 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// DedicatedHostProfile : DedicatedHostProfile struct -type DedicatedHostProfile struct { - // The product class this dedicated host profile belongs to. - Class *string `json:"class" validate:"required"` - - // Collection of the dedicated host profile's disks. - Disks []DedicatedHostProfileDisk `json:"disks" validate:"required"` - - // The product family this dedicated host 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 URL for this dedicated host. - Href *string `json:"href" validate:"required"` - - Memory DedicatedHostProfileMemoryIntf `json:"memory" validate:"required"` - - // The globally unique name for this dedicated host profile. - Name *string `json:"name" validate:"required"` - - SocketCount DedicatedHostProfileSocketIntf `json:"socket_count" validate:"required"` - - // The status of the dedicated host profile: - // - `previous`: This dedicated host profile is an older revision, but remains provisionable - // and usable. - // - `current`: This dedicated host profile is the latest revision. - // - // Revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming conventions] - // (https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information on how - // generations are defined within a dedicated host profile. - // - // 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 instance profiles usable by instances placed on dedicated hosts with this profile. - SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` - - VcpuArchitecture *DedicatedHostProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` - - VcpuCount DedicatedHostProfileVcpuIntf `json:"vcpu_count" validate:"required"` - - VcpuManufacturer *DedicatedHostProfileVcpuManufacturer `json:"vcpu_manufacturer" validate:"required"` -} - -// Constants associated with the DedicatedHostProfile.Family property. -// The product family this dedicated host profile belongs to -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - DedicatedHostProfileFamilyBalancedConst = "balanced" - DedicatedHostProfileFamilyComputeConst = "compute" - DedicatedHostProfileFamilyMemoryConst = "memory" -) - -// Constants associated with the DedicatedHostProfile.Status property. -// The status of the dedicated host profile: -// - `previous`: This dedicated host profile is an older revision, but remains provisionable -// and usable. -// - `current`: This dedicated host profile is the latest revision. -// -// Revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming conventions] -// (https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information on how -// generations are defined within a dedicated host profile. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - DedicatedHostProfileStatusCurrentConst = "current" - DedicatedHostProfileStatusPreviousConst = "previous" -) - -// UnmarshalDedicatedHostProfile unmarshals an instance of DedicatedHostProfile from the specified map of raw messages. -func UnmarshalDedicatedHostProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfile) - err = core.UnmarshalPrimitive(m, "class", &obj.Class) - if err != nil { - err = core.SDKErrorf(err, "", "class-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostProfileDisk) - if err != nil { - err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - err = core.SDKErrorf(err, "", "family-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.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalDedicatedHostProfileMemory) - if err != nil { - err = core.SDKErrorf(err, "", "memory-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, "socket_count", &obj.SocketCount, UnmarshalDedicatedHostProfileSocket) - if err != nil { - err = core.SDKErrorf(err, "", "socket_count-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, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) - if err != nil { - err = core.SDKErrorf(err, "", "supported_instance_profiles-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalDedicatedHostProfileVcpuArchitecture) - if err != nil { - err = core.SDKErrorf(err, "", "vcpu_architecture-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalDedicatedHostProfileVcpu) - if err != nil { - err = core.SDKErrorf(err, "", "vcpu_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalDedicatedHostProfileVcpuManufacturer) - if err != nil { - err = core.SDKErrorf(err, "", "vcpu_manufacturer-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileCollection : DedicatedHostProfileCollection struct -type DedicatedHostProfileCollection struct { - // A link to the first page of resources. - First *DedicatedHostProfileCollectionFirst `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"` - - // Collection of dedicated host profiles. - Profiles []DedicatedHostProfile `json:"profiles" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalDedicatedHostProfileCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalDedicatedHostProfile) - 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()) - 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 *DedicatedHostProfileCollection) 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 -} - -// 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"` - - // The number of disks of this type for a dedicated host with this profile. - Quantity *DedicatedHostProfileDiskQuantity `json:"quantity" validate:"required"` - - // The size of the disk in GB (gigabytes). - Size *DedicatedHostProfileDiskSize `json:"size" validate:"required"` - - SupportedInstanceInterfaceTypes *DedicatedHostProfileDiskSupportedInterfaces `json:"supported_instance_interface_types" validate:"required"` -} - -// UnmarshalDedicatedHostProfileDisk unmarshals an instance of DedicatedHostProfileDisk from the specified map of raw messages. -func UnmarshalDedicatedHostProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileDisk) - err = core.UnmarshalModel(m, "interface_type", &obj.InterfaceType, UnmarshalDedicatedHostProfileDiskInterface) - if err != nil { - err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalDedicatedHostProfileDiskQuantity) - if err != nil { - err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalDedicatedHostProfileDiskSize) - if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes, UnmarshalDedicatedHostProfileDiskSupportedInterfaces) - if err != nil { - err = core.SDKErrorf(err, "", "supported_instance_interface_types-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileDiskInterface : DedicatedHostProfileDiskInterface struct -type DedicatedHostProfileDiskInterface struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The interface of the disk for a dedicated host with this profile - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileDiskInterface.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileDiskInterfaceTypeFixedConst = "fixed" -) - -// Constants associated with the DedicatedHostProfileDiskInterface.Value property. -// The interface of the disk for a dedicated host with this profile -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - DedicatedHostProfileDiskInterfaceValueNvmeConst = "nvme" -) - -// UnmarshalDedicatedHostProfileDiskInterface unmarshals an instance of DedicatedHostProfileDiskInterface from the specified map of raw messages. -func UnmarshalDedicatedHostProfileDiskInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileDiskInterface) - 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 -} - -// DedicatedHostProfileDiskQuantity : The number of disks of this type for a dedicated host with this profile. -type DedicatedHostProfileDiskQuantity struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileDiskQuantity.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileDiskQuantityTypeFixedConst = "fixed" -) - -// UnmarshalDedicatedHostProfileDiskQuantity unmarshals an instance of DedicatedHostProfileDiskQuantity from the specified map of raw messages. -func UnmarshalDedicatedHostProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileDiskQuantity) - 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 -} - -// DedicatedHostProfileDiskSize : The size of the disk in GB (gigabytes). -type DedicatedHostProfileDiskSize struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The size of the disk in GB (gigabytes). - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileDiskSize.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileDiskSizeTypeFixedConst = "fixed" -) - -// UnmarshalDedicatedHostProfileDiskSize unmarshals an instance of DedicatedHostProfileDiskSize from the specified map of raw messages. -func UnmarshalDedicatedHostProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileDiskSize) - 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 -} - -// DedicatedHostProfileDiskSupportedInterfaces : DedicatedHostProfileDiskSupportedInterfaces struct -type DedicatedHostProfileDiskSupportedInterfaces struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The instance disk interfaces supported for a dedicated host with this profile. - Value []string `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileDiskSupportedInterfaces.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileDiskSupportedInterfacesTypeFixedConst = "fixed" -) - -// Constants associated with the DedicatedHostProfileDiskSupportedInterfaces.Value property. -// The disk interface used for attaching the disk. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - DedicatedHostProfileDiskSupportedInterfacesValueNvmeConst = "nvme" - DedicatedHostProfileDiskSupportedInterfacesValueVirtioBlkConst = "virtio_blk" -) - -// UnmarshalDedicatedHostProfileDiskSupportedInterfaces unmarshals an instance of DedicatedHostProfileDiskSupportedInterfaces from the specified map of raw messages. -func UnmarshalDedicatedHostProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileDiskSupportedInterfaces) - 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 -} - -// DedicatedHostProfileIdentity : Identifies a dedicated host profile by a unique property. -// Models which "extend" this model: -// - DedicatedHostProfileIdentityByName -// - DedicatedHostProfileIdentityByHref -type DedicatedHostProfileIdentity struct { - // The globally unique name for this dedicated host profile. - Name *string `json:"name,omitempty"` - - // The URL for this dedicated host profile. - Href *string `json:"href,omitempty"` -} - -func (*DedicatedHostProfileIdentity) isaDedicatedHostProfileIdentity() bool { - return true -} - -type DedicatedHostProfileIdentityIntf interface { - isaDedicatedHostProfileIdentity() bool -} - -// UnmarshalDedicatedHostProfileIdentity unmarshals an instance of DedicatedHostProfileIdentity from the specified map of raw messages. -func UnmarshalDedicatedHostProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileIdentity) - 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 -} - -// DedicatedHostProfileMemory : DedicatedHostProfileMemory struct -// Models which "extend" this model: -// - DedicatedHostProfileMemoryFixed -// - DedicatedHostProfileMemoryRange -// - DedicatedHostProfileMemoryEnum -// - DedicatedHostProfileMemoryDependent -type DedicatedHostProfileMemory 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 DedicatedHostProfileMemory.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileMemoryTypeFixedConst = "fixed" -) - -func (*DedicatedHostProfileMemory) isaDedicatedHostProfileMemory() bool { - return true -} - -type DedicatedHostProfileMemoryIntf interface { - isaDedicatedHostProfileMemory() bool -} - -// UnmarshalDedicatedHostProfileMemory unmarshals an instance of DedicatedHostProfileMemory from the specified map of raw messages. -func UnmarshalDedicatedHostProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileMemory) - 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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileReference : DedicatedHostProfileReference struct -type DedicatedHostProfileReference struct { - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this dedicated host profile. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalDedicatedHostProfileReference unmarshals an instance of DedicatedHostProfileReference from the specified map of raw messages. -func UnmarshalDedicatedHostProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-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 -} - -// DedicatedHostProfileSocket : DedicatedHostProfileSocket struct -// Models which "extend" this model: -// - DedicatedHostProfileSocketFixed -// - DedicatedHostProfileSocketRange -// - DedicatedHostProfileSocketEnum -// - DedicatedHostProfileSocketDependent -type DedicatedHostProfileSocket 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 DedicatedHostProfileSocket.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileSocketTypeFixedConst = "fixed" -) - -func (*DedicatedHostProfileSocket) isaDedicatedHostProfileSocket() bool { - return true -} - -type DedicatedHostProfileSocketIntf interface { - isaDedicatedHostProfileSocket() bool -} - -// UnmarshalDedicatedHostProfileSocket unmarshals an instance of DedicatedHostProfileSocket from the specified map of raw messages. -func UnmarshalDedicatedHostProfileSocket(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileSocket) - 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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileVcpu : DedicatedHostProfileVcpu struct -// Models which "extend" this model: -// - DedicatedHostProfileVcpuFixed -// - DedicatedHostProfileVcpuRange -// - DedicatedHostProfileVcpuEnum -// - DedicatedHostProfileVcpuDependent -type DedicatedHostProfileVcpu 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 DedicatedHostProfileVcpu.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileVcpuTypeFixedConst = "fixed" -) - -func (*DedicatedHostProfileVcpu) isaDedicatedHostProfileVcpu() bool { - return true -} - -type DedicatedHostProfileVcpuIntf interface { - isaDedicatedHostProfileVcpu() bool -} - -// UnmarshalDedicatedHostProfileVcpu unmarshals an instance of DedicatedHostProfileVcpu from the specified map of raw messages. -func UnmarshalDedicatedHostProfileVcpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileVcpu) - 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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileVcpuArchitecture : DedicatedHostProfileVcpuArchitecture struct -type DedicatedHostProfileVcpuArchitecture struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The VCPU architecture for a dedicated host with this profile. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileVcpuArchitecture.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileVcpuArchitectureTypeFixedConst = "fixed" -) - -// UnmarshalDedicatedHostProfileVcpuArchitecture unmarshals an instance of DedicatedHostProfileVcpuArchitecture from the specified map of raw messages. -func UnmarshalDedicatedHostProfileVcpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileVcpuArchitecture) - 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 -} - -// DedicatedHostProfileVcpuManufacturer : DedicatedHostProfileVcpuManufacturer struct -type DedicatedHostProfileVcpuManufacturer struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The VCPU manufacturer for a dedicated host with this profile. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileVcpuManufacturer.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileVcpuManufacturerTypeFixedConst = "fixed" -) - -// UnmarshalDedicatedHostProfileVcpuManufacturer unmarshals an instance of DedicatedHostProfileVcpuManufacturer from the specified map of raw messages. -func UnmarshalDedicatedHostProfileVcpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileVcpuManufacturer) - 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 -} - -// DedicatedHostPrototype : DedicatedHostPrototype struct -// Models which "extend" this model: -// - DedicatedHostPrototypeDedicatedHostByGroup -// - DedicatedHostPrototypeDedicatedHostByZone -type DedicatedHostPrototype struct { - // If set to true, instances can be placed on this dedicated host. - InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` - - // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this - // dedicated host. - Profile DedicatedHostProfileIdentityIntf `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"` - - // The dedicated host group for this dedicated host. - Group DedicatedHostGroupIdentityIntf `json:"group,omitempty"` - - // The zone this dedicated host will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` -} - -func (*DedicatedHostPrototype) isaDedicatedHostPrototype() bool { - return true -} - -type DedicatedHostPrototypeIntf interface { - isaDedicatedHostPrototype() bool -} - -// UnmarshalDedicatedHostPrototype unmarshals an instance of DedicatedHostPrototype from the specified map of raw messages. -func UnmarshalDedicatedHostPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostPrototype) - err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) - if err != nil { - err = core.SDKErrorf(err, "", "instance_placement_enabled-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, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-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, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostReference : DedicatedHostReference struct -type DedicatedHostReference struct { - // The CRN for this dedicated host. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *DedicatedHostReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this dedicated host. - ID *string `json:"id" validate:"required"` - - // The name for this dedicated host. The name is unique across all dedicated hosts in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the DedicatedHostReference.ResourceType property. -// The resource type. -const ( - DedicatedHostReferenceResourceTypeDedicatedHostConst = "dedicated_host" -) - -// UnmarshalDedicatedHostReference unmarshals an instance of DedicatedHostReference from the specified map of raw messages. -func UnmarshalDedicatedHostReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostReference) - 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, UnmarshalDedicatedHostReferenceDeleted) - 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 -} - -// DedicatedHostReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type DedicatedHostReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalDedicatedHostReferenceDeleted unmarshals an instance of DedicatedHostReferenceDeleted from the specified map of raw messages. -func UnmarshalDedicatedHostReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostReferenceDeleted) - 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 -} - -// DefaultNetworkACL : DefaultNetworkACL struct -type DefaultNetworkACL struct { - // The date and time that the network ACL was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this network ACL. - CRN *string `json:"crn" validate:"required"` - - // The URL for this network ACL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL. - ID *string `json:"id" validate:"required"` - - // The name of the default network ACL created for a VPC. The name will be a hyphenated list of randomly-selected words - // at creation, but may be changed. - Name *string `json:"name" validate:"required"` - - // The resource group for the default network ACL for a VPC. Set to the VPC's - // resource group at creation. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The ordered rules for the default network ACL for a VPC. Defaults to two rules which allow all inbound and outbound - // traffic, respectively. Rules for the default network ACL may be changed, added, or removed. - Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` - - // The subnets to which this network ACL is attached. - Subnets []SubnetReference `json:"subnets" validate:"required"` - - // The VPC this network ACL resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// UnmarshalDefaultNetworkACL unmarshals an instance of DefaultNetworkACL from the specified map of raw messages. -func UnmarshalDefaultNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DefaultNetworkACL) - 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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) - if err != nil { - err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DefaultRoutingTable : DefaultRoutingTable struct -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. - 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 - // sources. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` - - // The date and time that this routing table was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this routing table. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this routing table. - ID *string `json:"id" validate:"required"` - - // Indicates whether this is the default routing table for this VPC. - IsDefault *bool `json:"is_default" validate:"required"` - - // The lifecycle state of the routing table. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name of the default routing table created for this VPC. The name will be a hyphenated list of randomly-selected - // words at creation, but may be changed. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from - // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from the internet. - // - // Incoming traffic will be routed according to the routing table with two exceptions: - // - Traffic destined for IP addresses associated with public gateways will not be - // subject to routes in this routing table. - // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is - // an IP address in a subnet in the route's `zone` that is able to accept traffic. - // Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from from [Transit - // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this - // VPC. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` - - // The routes for the default routing table for this VPC. The table is created with no routes, but routes may be added, - // changed, or removed with a subsequent request. - Routes []RouteReference `json:"routes" validate:"required"` - - // The subnets to which this routing table is attached. - Subnets []SubnetReference `json:"subnets" validate:"required"` -} - -// Constants associated with the DefaultRoutingTable.AdvertiseRoutesTo property. -// An ingress source that routes can be advertised to: -// -// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) -// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). -const ( - DefaultRoutingTableAdvertiseRoutesToDirectLinkConst = "direct_link" - DefaultRoutingTableAdvertiseRoutesToTransitGatewayConst = "transit_gateway" -) - -// Constants associated with the DefaultRoutingTable.LifecycleState property. -// The lifecycle state of the routing table. -const ( - DefaultRoutingTableLifecycleStateDeletingConst = "deleting" - DefaultRoutingTableLifecycleStateFailedConst = "failed" - DefaultRoutingTableLifecycleStatePendingConst = "pending" - DefaultRoutingTableLifecycleStateStableConst = "stable" - DefaultRoutingTableLifecycleStateSuspendedConst = "suspended" - DefaultRoutingTableLifecycleStateUpdatingConst = "updating" - DefaultRoutingTableLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the DefaultRoutingTable.ResourceType property. -// The resource type. -const ( - DefaultRoutingTableResourceTypeRoutingTableConst = "routing_table" -) - -// UnmarshalDefaultRoutingTable unmarshals an instance of DefaultRoutingTable from the specified map of raw messages. -func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DefaultRoutingTable) - err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) - if err != nil { - err = core.SDKErrorf(err, "", "accept_routes_from-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) - if err != nil { - err = core.SDKErrorf(err, "", "advertise_routes_to-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, "is_default", &obj.IsDefault) - if err != nil { - err = core.SDKErrorf(err, "", "is_default-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, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) - if err != nil { - err = core.SDKErrorf(err, "", "route_direct_link_ingress-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) - if err != nil { - err = core.SDKErrorf(err, "", "route_internet_ingress-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) - if err != nil { - err = core.SDKErrorf(err, "", "route_transit_gateway_ingress-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) - if err != nil { - err = core.SDKErrorf(err, "", "route_vpc_zone_ingress-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) - if err != nil { - err = core.SDKErrorf(err, "", "routes-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DefaultSecurityGroup : DefaultSecurityGroup struct -type DefaultSecurityGroup struct { - // The date and time that this security group was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` - - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` - - // The name for the default security group for a VPC. The name will be a hyphenated list of randomly-selected words at - // creation, but may changed. - Name *string `json:"name" validate:"required"` - - // The resource group for this security group. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The rules for the default security group for a VPC. Defaults to allowing all outbound traffic, and allowing all - // inbound traffic from other interfaces in the VPC's default security group. Rules for the default security group may - // be changed, added or removed. - Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` - - // The targets for this security group. - Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` - - // The VPC this security group resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// UnmarshalDefaultSecurityGroup unmarshals an instance of DefaultSecurityGroup from the specified map of raw messages. -func UnmarshalDefaultSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DefaultSecurityGroup) - 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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) - if err != nil { - err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) - if err != nil { - err = core.SDKErrorf(err, "", "targets-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DeleteBackupPolicyOptions : The DeleteBackupPolicy options. -type DeleteBackupPolicyOptions struct { - // The backup policy 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 -} - -// NewDeleteBackupPolicyOptions : Instantiate DeleteBackupPolicyOptions -func (*VpcV1) NewDeleteBackupPolicyOptions(id string) *DeleteBackupPolicyOptions { - return &DeleteBackupPolicyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteBackupPolicyOptions) SetID(id string) *DeleteBackupPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteBackupPolicyOptions) SetIfMatch(ifMatch string) *DeleteBackupPolicyOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteBackupPolicyOptions) SetHeaders(param map[string]string) *DeleteBackupPolicyOptions { - options.Headers = param - return options -} - -// DeleteBackupPolicyPlanOptions : The DeleteBackupPolicyPlan options. -type DeleteBackupPolicyPlanOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - - // The backup policy plan 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 -} - -// NewDeleteBackupPolicyPlanOptions : Instantiate DeleteBackupPolicyPlanOptions -func (*VpcV1) NewDeleteBackupPolicyPlanOptions(backupPolicyID string, id string) *DeleteBackupPolicyPlanOptions { - return &DeleteBackupPolicyPlanOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - ID: core.StringPtr(id), - } -} - -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *DeleteBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *DeleteBackupPolicyPlanOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteBackupPolicyPlanOptions) SetID(id string) *DeleteBackupPolicyPlanOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteBackupPolicyPlanOptions) SetIfMatch(ifMatch string) *DeleteBackupPolicyPlanOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteBackupPolicyPlanOptions) SetHeaders(param map[string]string) *DeleteBackupPolicyPlanOptions { - options.Headers = param - return options -} - -// DeleteBareMetalServerNetworkAttachmentOptions : The DeleteBareMetalServerNetworkAttachment options. -type DeleteBareMetalServerNetworkAttachmentOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteBareMetalServerNetworkAttachmentOptions : Instantiate DeleteBareMetalServerNetworkAttachmentOptions -func (*VpcV1) NewDeleteBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string) *DeleteBareMetalServerNetworkAttachmentOptions { - return &DeleteBareMetalServerNetworkAttachmentOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *DeleteBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *DeleteBareMetalServerNetworkAttachmentOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteBareMetalServerNetworkAttachmentOptions) SetID(id string) *DeleteBareMetalServerNetworkAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerNetworkAttachmentOptions { - options.Headers = param - return options -} - -// DeleteBareMetalServerNetworkInterfaceOptions : The DeleteBareMetalServerNetworkInterface options. -type DeleteBareMetalServerNetworkInterfaceOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteBareMetalServerNetworkInterfaceOptions : Instantiate DeleteBareMetalServerNetworkInterfaceOptions -func (*VpcV1) NewDeleteBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string) *DeleteBareMetalServerNetworkInterfaceOptions { - return &DeleteBareMetalServerNetworkInterfaceOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *DeleteBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *DeleteBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteBareMetalServerNetworkInterfaceOptions) SetID(id string) *DeleteBareMetalServerNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerNetworkInterfaceOptions { - options.Headers = param - return options -} - -// DeleteBareMetalServerOptions : The DeleteBareMetalServer options. -type DeleteBareMetalServerOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteBareMetalServerOptions : Instantiate DeleteBareMetalServerOptions -func (*VpcV1) NewDeleteBareMetalServerOptions(id string) *DeleteBareMetalServerOptions { - return &DeleteBareMetalServerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteBareMetalServerOptions) SetID(id string) *DeleteBareMetalServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteBareMetalServerOptions) SetHeaders(param map[string]string) *DeleteBareMetalServerOptions { - 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 - Headers map[string]string -} - -// NewDeleteDedicatedHostGroupOptions : Instantiate DeleteDedicatedHostGroupOptions -func (*VpcV1) NewDeleteDedicatedHostGroupOptions(id string) *DeleteDedicatedHostGroupOptions { - return &DeleteDedicatedHostGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteDedicatedHostGroupOptions) SetID(id string) *DeleteDedicatedHostGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteDedicatedHostGroupOptions) SetHeaders(param map[string]string) *DeleteDedicatedHostGroupOptions { - options.Headers = param - return options -} - -// DeleteDedicatedHostOptions : The DeleteDedicatedHost options. -type DeleteDedicatedHostOptions struct { - // The dedicated host identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteDedicatedHostOptions : Instantiate DeleteDedicatedHostOptions -func (*VpcV1) NewDeleteDedicatedHostOptions(id string) *DeleteDedicatedHostOptions { - return &DeleteDedicatedHostOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteDedicatedHostOptions) SetID(id string) *DeleteDedicatedHostOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteDedicatedHostOptions) SetHeaders(param map[string]string) *DeleteDedicatedHostOptions { - options.Headers = param - return options -} - -// DeleteEndpointGatewayOptions : The DeleteEndpointGateway options. -type DeleteEndpointGatewayOptions struct { - // The endpoint gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteEndpointGatewayOptions : Instantiate DeleteEndpointGatewayOptions -func (*VpcV1) NewDeleteEndpointGatewayOptions(id string) *DeleteEndpointGatewayOptions { - return &DeleteEndpointGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteEndpointGatewayOptions) SetID(id string) *DeleteEndpointGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteEndpointGatewayOptions) SetHeaders(param map[string]string) *DeleteEndpointGatewayOptions { - options.Headers = param - return options -} - -// DeleteFloatingIPOptions : The DeleteFloatingIP options. -type DeleteFloatingIPOptions struct { - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteFloatingIPOptions : Instantiate DeleteFloatingIPOptions -func (*VpcV1) NewDeleteFloatingIPOptions(id string) *DeleteFloatingIPOptions { - return &DeleteFloatingIPOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteFloatingIPOptions) SetID(id string) *DeleteFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteFloatingIPOptions) SetHeaders(param map[string]string) *DeleteFloatingIPOptions { - options.Headers = param - return options -} - -// DeleteFlowLogCollectorOptions : The DeleteFlowLogCollector options. -type DeleteFlowLogCollectorOptions struct { - // The flow log collector identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteFlowLogCollectorOptions : Instantiate DeleteFlowLogCollectorOptions -func (*VpcV1) NewDeleteFlowLogCollectorOptions(id string) *DeleteFlowLogCollectorOptions { - return &DeleteFlowLogCollectorOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteFlowLogCollectorOptions) SetID(id string) *DeleteFlowLogCollectorOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteFlowLogCollectorOptions) SetHeaders(param map[string]string) *DeleteFlowLogCollectorOptions { - options.Headers = param - return options -} - -// DeleteIkePolicyOptions : The DeleteIkePolicy options. -type DeleteIkePolicyOptions struct { - // The IKE policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteIkePolicyOptions : Instantiate DeleteIkePolicyOptions -func (*VpcV1) NewDeleteIkePolicyOptions(id string) *DeleteIkePolicyOptions { - return &DeleteIkePolicyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteIkePolicyOptions) SetID(id string) *DeleteIkePolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteIkePolicyOptions) SetHeaders(param map[string]string) *DeleteIkePolicyOptions { - options.Headers = param - return options -} - -// DeleteImageExportJobOptions : The DeleteImageExportJob options. -type DeleteImageExportJobOptions struct { - // The image identifier. - ImageID *string `json:"image_id" validate:"required,ne="` - - // The image export job identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteImageExportJobOptions : Instantiate DeleteImageExportJobOptions -func (*VpcV1) NewDeleteImageExportJobOptions(imageID string, id string) *DeleteImageExportJobOptions { - return &DeleteImageExportJobOptions{ - ImageID: core.StringPtr(imageID), - ID: core.StringPtr(id), - } -} - -// SetImageID : Allow user to set ImageID -func (_options *DeleteImageExportJobOptions) SetImageID(imageID string) *DeleteImageExportJobOptions { - _options.ImageID = core.StringPtr(imageID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteImageExportJobOptions) SetID(id string) *DeleteImageExportJobOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteImageExportJobOptions) SetHeaders(param map[string]string) *DeleteImageExportJobOptions { - options.Headers = param - return options -} - -// DeleteImageOptions : The DeleteImage options. -type DeleteImageOptions struct { - // The image identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteImageOptions : Instantiate DeleteImageOptions -func (*VpcV1) NewDeleteImageOptions(id string) *DeleteImageOptions { - return &DeleteImageOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteImageOptions) SetID(id string) *DeleteImageOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteImageOptions) SetHeaders(param map[string]string) *DeleteImageOptions { - 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 - Headers map[string]string -} - -// NewDeleteInstanceGroupLoadBalancerOptions : Instantiate DeleteInstanceGroupLoadBalancerOptions -func (*VpcV1) NewDeleteInstanceGroupLoadBalancerOptions(instanceGroupID string) *DeleteInstanceGroupLoadBalancerOptions { - return &DeleteInstanceGroupLoadBalancerOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *DeleteInstanceGroupLoadBalancerOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupLoadBalancerOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceGroupLoadBalancerOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupLoadBalancerOptions { - options.Headers = param - return options -} - -// DeleteInstanceGroupManagerActionOptions : The DeleteInstanceGroupManagerAction options. -type DeleteInstanceGroupManagerActionOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // The instance group manager action identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceGroupManagerActionOptions : Instantiate DeleteInstanceGroupManagerActionOptions -func (*VpcV1) NewDeleteInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string) *DeleteInstanceGroupManagerActionOptions { - return &DeleteInstanceGroupManagerActionOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *DeleteInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerActionOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *DeleteInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *DeleteInstanceGroupManagerActionOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceGroupManagerActionOptions) SetID(id string) *DeleteInstanceGroupManagerActionOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerActionOptions { - options.Headers = param - return options -} - -// DeleteInstanceGroupManagerOptions : The DeleteInstanceGroupManager options. -type DeleteInstanceGroupManagerOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceGroupManagerOptions : Instantiate DeleteInstanceGroupManagerOptions -func (*VpcV1) NewDeleteInstanceGroupManagerOptions(instanceGroupID string, id string) *DeleteInstanceGroupManagerOptions { - return &DeleteInstanceGroupManagerOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *DeleteInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceGroupManagerOptions) SetID(id string) *DeleteInstanceGroupManagerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceGroupManagerOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerOptions { - options.Headers = param - return options -} - -// DeleteInstanceGroupManagerPolicyOptions : The DeleteInstanceGroupManagerPolicy options. -type DeleteInstanceGroupManagerPolicyOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // The instance group manager policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceGroupManagerPolicyOptions : Instantiate DeleteInstanceGroupManagerPolicyOptions -func (*VpcV1) NewDeleteInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string) *DeleteInstanceGroupManagerPolicyOptions { - return &DeleteInstanceGroupManagerPolicyOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *DeleteInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerPolicyOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *DeleteInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *DeleteInstanceGroupManagerPolicyOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceGroupManagerPolicyOptions) SetID(id string) *DeleteInstanceGroupManagerPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerPolicyOptions { - options.Headers = param - return options -} - -// DeleteInstanceGroupMembershipOptions : The DeleteInstanceGroupMembership options. -type DeleteInstanceGroupMembershipOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group membership identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceGroupMembershipOptions : Instantiate DeleteInstanceGroupMembershipOptions -func (*VpcV1) NewDeleteInstanceGroupMembershipOptions(instanceGroupID string, id string) *DeleteInstanceGroupMembershipOptions { - return &DeleteInstanceGroupMembershipOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *DeleteInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupMembershipOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceGroupMembershipOptions) SetID(id string) *DeleteInstanceGroupMembershipOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupMembershipOptions { - options.Headers = param - return options -} - -// DeleteInstanceGroupMembershipsOptions : The DeleteInstanceGroupMemberships options. -type DeleteInstanceGroupMembershipsOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceGroupMembershipsOptions : Instantiate DeleteInstanceGroupMembershipsOptions -func (*VpcV1) NewDeleteInstanceGroupMembershipsOptions(instanceGroupID string) *DeleteInstanceGroupMembershipsOptions { - return &DeleteInstanceGroupMembershipsOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *DeleteInstanceGroupMembershipsOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupMembershipsOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceGroupMembershipsOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupMembershipsOptions { - options.Headers = param - return options -} - -// DeleteInstanceGroupOptions : The DeleteInstanceGroup options. -type DeleteInstanceGroupOptions struct { - // The instance group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceGroupOptions : Instantiate DeleteInstanceGroupOptions -func (*VpcV1) NewDeleteInstanceGroupOptions(id string) *DeleteInstanceGroupOptions { - return &DeleteInstanceGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceGroupOptions) SetID(id string) *DeleteInstanceGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceGroupOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupOptions { - options.Headers = param - return options -} - -// DeleteInstanceNetworkAttachmentOptions : The DeleteInstanceNetworkAttachment options. -type DeleteInstanceNetworkAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceNetworkAttachmentOptions : Instantiate DeleteInstanceNetworkAttachmentOptions -func (*VpcV1) NewDeleteInstanceNetworkAttachmentOptions(instanceID string, id string) *DeleteInstanceNetworkAttachmentOptions { - return &DeleteInstanceNetworkAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *DeleteInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceNetworkAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceNetworkAttachmentOptions) SetID(id string) *DeleteInstanceNetworkAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceNetworkAttachmentOptions { - options.Headers = param - return options -} - -// DeleteInstanceNetworkInterfaceOptions : The DeleteInstanceNetworkInterface options. -type DeleteInstanceNetworkInterfaceOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceNetworkInterfaceOptions : Instantiate DeleteInstanceNetworkInterfaceOptions -func (*VpcV1) NewDeleteInstanceNetworkInterfaceOptions(instanceID string, id string) *DeleteInstanceNetworkInterfaceOptions { - return &DeleteInstanceNetworkInterfaceOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *DeleteInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *DeleteInstanceNetworkInterfaceOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceNetworkInterfaceOptions) SetID(id string) *DeleteInstanceNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *DeleteInstanceNetworkInterfaceOptions { - options.Headers = param - return options -} - -// DeleteInstanceOptions : The DeleteInstance options. -type DeleteInstanceOptions struct { - // The virtual server instance 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 -} - -// NewDeleteInstanceOptions : Instantiate DeleteInstanceOptions -func (*VpcV1) NewDeleteInstanceOptions(id string) *DeleteInstanceOptions { - return &DeleteInstanceOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceOptions) SetID(id string) *DeleteInstanceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteInstanceOptions) SetIfMatch(ifMatch string) *DeleteInstanceOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceOptions) SetHeaders(param map[string]string) *DeleteInstanceOptions { - options.Headers = param - return options -} - -// DeleteInstanceTemplateOptions : The DeleteInstanceTemplate options. -type DeleteInstanceTemplateOptions struct { - // The instance template identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceTemplateOptions : Instantiate DeleteInstanceTemplateOptions -func (*VpcV1) NewDeleteInstanceTemplateOptions(id string) *DeleteInstanceTemplateOptions { - return &DeleteInstanceTemplateOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceTemplateOptions) SetID(id string) *DeleteInstanceTemplateOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceTemplateOptions) SetHeaders(param map[string]string) *DeleteInstanceTemplateOptions { - options.Headers = param - return options -} - -// DeleteInstanceVolumeAttachmentOptions : The DeleteInstanceVolumeAttachment options. -type DeleteInstanceVolumeAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The volume attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteInstanceVolumeAttachmentOptions : Instantiate DeleteInstanceVolumeAttachmentOptions -func (*VpcV1) NewDeleteInstanceVolumeAttachmentOptions(instanceID string, id string) *DeleteInstanceVolumeAttachmentOptions { - return &DeleteInstanceVolumeAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *DeleteInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceVolumeAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteInstanceVolumeAttachmentOptions) SetID(id string) *DeleteInstanceVolumeAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceVolumeAttachmentOptions { - options.Headers = param - return options -} - -// DeleteIpsecPolicyOptions : The DeleteIpsecPolicy options. -type DeleteIpsecPolicyOptions struct { - // The IPsec policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteIpsecPolicyOptions : Instantiate DeleteIpsecPolicyOptions -func (*VpcV1) NewDeleteIpsecPolicyOptions(id string) *DeleteIpsecPolicyOptions { - return &DeleteIpsecPolicyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteIpsecPolicyOptions) SetID(id string) *DeleteIpsecPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteIpsecPolicyOptions) SetHeaders(param map[string]string) *DeleteIpsecPolicyOptions { - options.Headers = param - return options -} - -// DeleteKeyOptions : The DeleteKey options. -type DeleteKeyOptions struct { - // The key identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteKeyOptions : Instantiate DeleteKeyOptions -func (*VpcV1) NewDeleteKeyOptions(id string) *DeleteKeyOptions { - return &DeleteKeyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteKeyOptions) SetID(id string) *DeleteKeyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteKeyOptions) SetHeaders(param map[string]string) *DeleteKeyOptions { - options.Headers = param - return options -} - -// DeleteLoadBalancerListenerOptions : The DeleteLoadBalancerListener options. -type DeleteLoadBalancerListenerOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteLoadBalancerListenerOptions : Instantiate DeleteLoadBalancerListenerOptions -func (*VpcV1) NewDeleteLoadBalancerListenerOptions(loadBalancerID string, id string) *DeleteLoadBalancerListenerOptions { - return &DeleteLoadBalancerListenerOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *DeleteLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteLoadBalancerListenerOptions) SetID(id string) *DeleteLoadBalancerListenerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteLoadBalancerListenerOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerOptions { - options.Headers = param - return options -} - -// DeleteLoadBalancerListenerPolicyOptions : The DeleteLoadBalancerListenerPolicy options. -type DeleteLoadBalancerListenerPolicyOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteLoadBalancerListenerPolicyOptions : Instantiate DeleteLoadBalancerListenerPolicyOptions -func (*VpcV1) NewDeleteLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string) *DeleteLoadBalancerListenerPolicyOptions { - return &DeleteLoadBalancerListenerPolicyOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *DeleteLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerPolicyOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *DeleteLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *DeleteLoadBalancerListenerPolicyOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteLoadBalancerListenerPolicyOptions) SetID(id string) *DeleteLoadBalancerListenerPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerPolicyOptions { - options.Headers = param - return options -} - -// DeleteLoadBalancerListenerPolicyRuleOptions : The DeleteLoadBalancerListenerPolicyRule options. -type DeleteLoadBalancerListenerPolicyRuleOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - PolicyID *string `json:"policy_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteLoadBalancerListenerPolicyRuleOptions : Instantiate DeleteLoadBalancerListenerPolicyRuleOptions -func (*VpcV1) NewDeleteLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string) *DeleteLoadBalancerListenerPolicyRuleOptions { - return &DeleteLoadBalancerListenerPolicyRuleOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - PolicyID: core.StringPtr(policyID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerPolicyRuleOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *DeleteLoadBalancerListenerPolicyRuleOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetPolicyID : Allow user to set PolicyID -func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *DeleteLoadBalancerListenerPolicyRuleOptions { - _options.PolicyID = core.StringPtr(policyID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteLoadBalancerListenerPolicyRuleOptions) SetID(id string) *DeleteLoadBalancerListenerPolicyRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerPolicyRuleOptions { - options.Headers = param - return options -} - -// DeleteLoadBalancerOptions : The DeleteLoadBalancer options. -type DeleteLoadBalancerOptions struct { - // The load balancer 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 -} - -// NewDeleteLoadBalancerOptions : Instantiate DeleteLoadBalancerOptions -func (*VpcV1) NewDeleteLoadBalancerOptions(id string) *DeleteLoadBalancerOptions { - return &DeleteLoadBalancerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteLoadBalancerOptions) SetID(id string) *DeleteLoadBalancerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteLoadBalancerOptions) SetIfMatch(ifMatch string) *DeleteLoadBalancerOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteLoadBalancerOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerOptions { - options.Headers = param - return options -} - -// DeleteLoadBalancerPoolMemberOptions : The DeleteLoadBalancerPoolMember options. -type DeleteLoadBalancerPoolMemberOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - PoolID *string `json:"pool_id" validate:"required,ne="` - - // The member identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteLoadBalancerPoolMemberOptions : Instantiate DeleteLoadBalancerPoolMemberOptions -func (*VpcV1) NewDeleteLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string) *DeleteLoadBalancerPoolMemberOptions { - return &DeleteLoadBalancerPoolMemberOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - PoolID: core.StringPtr(poolID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *DeleteLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerPoolMemberOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetPoolID : Allow user to set PoolID -func (_options *DeleteLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *DeleteLoadBalancerPoolMemberOptions { - _options.PoolID = core.StringPtr(poolID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteLoadBalancerPoolMemberOptions) SetID(id string) *DeleteLoadBalancerPoolMemberOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerPoolMemberOptions { - options.Headers = param - return options -} - -// DeleteLoadBalancerPoolOptions : The DeleteLoadBalancerPool options. -type DeleteLoadBalancerPoolOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteLoadBalancerPoolOptions : Instantiate DeleteLoadBalancerPoolOptions -func (*VpcV1) NewDeleteLoadBalancerPoolOptions(loadBalancerID string, id string) *DeleteLoadBalancerPoolOptions { - return &DeleteLoadBalancerPoolOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *DeleteLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerPoolOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteLoadBalancerPoolOptions) SetID(id string) *DeleteLoadBalancerPoolOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteLoadBalancerPoolOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerPoolOptions { - options.Headers = param - return options -} - -// DeleteNetworkACLOptions : The DeleteNetworkACL options. -type DeleteNetworkACLOptions struct { - // The network ACL identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteNetworkACLOptions : Instantiate DeleteNetworkACLOptions -func (*VpcV1) NewDeleteNetworkACLOptions(id string) *DeleteNetworkACLOptions { - return &DeleteNetworkACLOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteNetworkACLOptions) SetID(id string) *DeleteNetworkACLOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteNetworkACLOptions) SetHeaders(param map[string]string) *DeleteNetworkACLOptions { - options.Headers = param - return options -} - -// DeleteNetworkACLRuleOptions : The DeleteNetworkACLRule options. -type DeleteNetworkACLRuleOptions struct { - // The network ACL identifier. - NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteNetworkACLRuleOptions : Instantiate DeleteNetworkACLRuleOptions -func (*VpcV1) NewDeleteNetworkACLRuleOptions(networkACLID string, id string) *DeleteNetworkACLRuleOptions { - return &DeleteNetworkACLRuleOptions{ - NetworkACLID: core.StringPtr(networkACLID), - ID: core.StringPtr(id), - } -} - -// SetNetworkACLID : Allow user to set NetworkACLID -func (_options *DeleteNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *DeleteNetworkACLRuleOptions { - _options.NetworkACLID = core.StringPtr(networkACLID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteNetworkACLRuleOptions) SetID(id string) *DeleteNetworkACLRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteNetworkACLRuleOptions) SetHeaders(param map[string]string) *DeleteNetworkACLRuleOptions { - options.Headers = param - return options -} - -// DeletePlacementGroupOptions : The DeletePlacementGroup options. -type DeletePlacementGroupOptions struct { - // The placement group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeletePlacementGroupOptions : Instantiate DeletePlacementGroupOptions -func (*VpcV1) NewDeletePlacementGroupOptions(id string) *DeletePlacementGroupOptions { - return &DeletePlacementGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeletePlacementGroupOptions) SetID(id string) *DeletePlacementGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeletePlacementGroupOptions) SetHeaders(param map[string]string) *DeletePlacementGroupOptions { - options.Headers = param - return options -} - -// DeletePublicGatewayOptions : The DeletePublicGateway options. -type DeletePublicGatewayOptions struct { - // The public gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeletePublicGatewayOptions : Instantiate DeletePublicGatewayOptions -func (*VpcV1) NewDeletePublicGatewayOptions(id string) *DeletePublicGatewayOptions { - return &DeletePublicGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeletePublicGatewayOptions) SetID(id string) *DeletePublicGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeletePublicGatewayOptions) SetHeaders(param map[string]string) *DeletePublicGatewayOptions { - options.Headers = param - return options -} - -// DeleteReservationOptions : The DeleteReservation options. -type DeleteReservationOptions struct { - // The reservation identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteReservationOptions : Instantiate DeleteReservationOptions -func (*VpcV1) NewDeleteReservationOptions(id string) *DeleteReservationOptions { - return &DeleteReservationOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteReservationOptions) SetID(id string) *DeleteReservationOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteReservationOptions) SetHeaders(param map[string]string) *DeleteReservationOptions { - options.Headers = param - return options -} - -// DeleteSecurityGroupOptions : The DeleteSecurityGroup options. -type DeleteSecurityGroupOptions struct { - // The security group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteSecurityGroupOptions : Instantiate DeleteSecurityGroupOptions -func (*VpcV1) NewDeleteSecurityGroupOptions(id string) *DeleteSecurityGroupOptions { - return &DeleteSecurityGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteSecurityGroupOptions) SetID(id string) *DeleteSecurityGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSecurityGroupOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupOptions { - options.Headers = param - return options -} - -// DeleteSecurityGroupRuleOptions : The DeleteSecurityGroupRule options. -type DeleteSecurityGroupRuleOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteSecurityGroupRuleOptions : Instantiate DeleteSecurityGroupRuleOptions -func (*VpcV1) NewDeleteSecurityGroupRuleOptions(securityGroupID string, id string) *DeleteSecurityGroupRuleOptions { - return &DeleteSecurityGroupRuleOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - ID: core.StringPtr(id), - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *DeleteSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *DeleteSecurityGroupRuleOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteSecurityGroupRuleOptions) SetID(id string) *DeleteSecurityGroupRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSecurityGroupRuleOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupRuleOptions { - options.Headers = param - return options -} - -// DeleteSecurityGroupTargetBindingOptions : The DeleteSecurityGroupTargetBinding options. -type DeleteSecurityGroupTargetBindingOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // The security group target identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteSecurityGroupTargetBindingOptions : Instantiate DeleteSecurityGroupTargetBindingOptions -func (*VpcV1) NewDeleteSecurityGroupTargetBindingOptions(securityGroupID string, id string) *DeleteSecurityGroupTargetBindingOptions { - return &DeleteSecurityGroupTargetBindingOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - ID: core.StringPtr(id), - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *DeleteSecurityGroupTargetBindingOptions) SetSecurityGroupID(securityGroupID string) *DeleteSecurityGroupTargetBindingOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteSecurityGroupTargetBindingOptions) SetID(id string) *DeleteSecurityGroupTargetBindingOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSecurityGroupTargetBindingOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupTargetBindingOptions { - options.Headers = param - return options -} - -// DeleteShareMountTargetOptions : The DeleteShareMountTarget options. -type DeleteShareMountTargetOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // The share mount target identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteShareMountTargetOptions : Instantiate DeleteShareMountTargetOptions -func (*VpcV1) NewDeleteShareMountTargetOptions(shareID string, id string) *DeleteShareMountTargetOptions { - return &DeleteShareMountTargetOptions{ - ShareID: core.StringPtr(shareID), - ID: core.StringPtr(id), - } -} - -// SetShareID : Allow user to set ShareID -func (_options *DeleteShareMountTargetOptions) SetShareID(shareID string) *DeleteShareMountTargetOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteShareMountTargetOptions) SetID(id string) *DeleteShareMountTargetOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteShareMountTargetOptions) SetHeaders(param map[string]string) *DeleteShareMountTargetOptions { - options.Headers = param - return options -} - -// DeleteShareOptions : The DeleteShare options. -type DeleteShareOptions struct { - // The file share 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 -} - -// NewDeleteShareOptions : Instantiate DeleteShareOptions -func (*VpcV1) NewDeleteShareOptions(id string) *DeleteShareOptions { - return &DeleteShareOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteShareOptions) SetID(id string) *DeleteShareOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteShareOptions) SetIfMatch(ifMatch string) *DeleteShareOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteShareOptions) SetHeaders(param map[string]string) *DeleteShareOptions { - options.Headers = param - return options -} - -// DeleteShareSourceOptions : The DeleteShareSource options. -type DeleteShareSourceOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteShareSourceOptions : Instantiate DeleteShareSourceOptions -func (*VpcV1) NewDeleteShareSourceOptions(shareID string) *DeleteShareSourceOptions { - return &DeleteShareSourceOptions{ - ShareID: core.StringPtr(shareID), - } -} - -// SetShareID : Allow user to set ShareID -func (_options *DeleteShareSourceOptions) SetShareID(shareID string) *DeleteShareSourceOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteShareSourceOptions) SetHeaders(param map[string]string) *DeleteShareSourceOptions { - options.Headers = param - return options -} - -// DeleteSnapshotCloneOptions : The DeleteSnapshotClone options. -type DeleteSnapshotCloneOptions struct { - // The snapshot identifier. - ID *string `json:"id" validate:"required,ne="` - - // The zone name. - ZoneName *string `json:"zone_name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteSnapshotCloneOptions : Instantiate DeleteSnapshotCloneOptions -func (*VpcV1) NewDeleteSnapshotCloneOptions(id string, zoneName string) *DeleteSnapshotCloneOptions { - return &DeleteSnapshotCloneOptions{ - ID: core.StringPtr(id), - ZoneName: core.StringPtr(zoneName), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteSnapshotCloneOptions) SetID(id string) *DeleteSnapshotCloneOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *DeleteSnapshotCloneOptions) SetZoneName(zoneName string) *DeleteSnapshotCloneOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSnapshotCloneOptions) SetHeaders(param map[string]string) *DeleteSnapshotCloneOptions { - options.Headers = param - return options -} - -// DeleteSnapshotConsistencyGroupOptions : The DeleteSnapshotConsistencyGroup options. -type DeleteSnapshotConsistencyGroupOptions struct { - // The snapshot consistency group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteSnapshotConsistencyGroupOptions : Instantiate DeleteSnapshotConsistencyGroupOptions -func (*VpcV1) NewDeleteSnapshotConsistencyGroupOptions(id string) *DeleteSnapshotConsistencyGroupOptions { - return &DeleteSnapshotConsistencyGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteSnapshotConsistencyGroupOptions) SetID(id string) *DeleteSnapshotConsistencyGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *DeleteSnapshotConsistencyGroupOptions { - options.Headers = param - return options -} - -// DeleteSnapshotOptions : The DeleteSnapshot options. -type DeleteSnapshotOptions struct { - // The snapshot 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 -} - -// NewDeleteSnapshotOptions : Instantiate DeleteSnapshotOptions -func (*VpcV1) NewDeleteSnapshotOptions(id string) *DeleteSnapshotOptions { - return &DeleteSnapshotOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteSnapshotOptions) SetID(id string) *DeleteSnapshotOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteSnapshotOptions) SetIfMatch(ifMatch string) *DeleteSnapshotOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSnapshotOptions) SetHeaders(param map[string]string) *DeleteSnapshotOptions { - options.Headers = param - return options -} - -// DeleteSnapshotsOptions : The DeleteSnapshots options. -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 - Headers map[string]string -} - -// NewDeleteSnapshotsOptions : Instantiate DeleteSnapshotsOptions -func (*VpcV1) NewDeleteSnapshotsOptions(sourceVolumeID string) *DeleteSnapshotsOptions { - return &DeleteSnapshotsOptions{ - SourceVolumeID: core.StringPtr(sourceVolumeID), - } -} - -// SetSourceVolumeID : Allow user to set SourceVolumeID -func (_options *DeleteSnapshotsOptions) SetSourceVolumeID(sourceVolumeID string) *DeleteSnapshotsOptions { - _options.SourceVolumeID = core.StringPtr(sourceVolumeID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSnapshotsOptions) SetHeaders(param map[string]string) *DeleteSnapshotsOptions { - options.Headers = param - return options -} - -// DeleteSubnetOptions : The DeleteSubnet options. -type DeleteSubnetOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteSubnetOptions : Instantiate DeleteSubnetOptions -func (*VpcV1) NewDeleteSubnetOptions(id string) *DeleteSubnetOptions { - return &DeleteSubnetOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteSubnetOptions) SetID(id string) *DeleteSubnetOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSubnetOptions) SetHeaders(param map[string]string) *DeleteSubnetOptions { - options.Headers = param - return options -} - -// DeleteSubnetReservedIPOptions : The DeleteSubnetReservedIP options. -type DeleteSubnetReservedIPOptions struct { - // The subnet identifier. - SubnetID *string `json:"subnet_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 -} - -// NewDeleteSubnetReservedIPOptions : Instantiate DeleteSubnetReservedIPOptions -func (*VpcV1) NewDeleteSubnetReservedIPOptions(subnetID string, id string) *DeleteSubnetReservedIPOptions { - return &DeleteSubnetReservedIPOptions{ - SubnetID: core.StringPtr(subnetID), - ID: core.StringPtr(id), - } -} - -// SetSubnetID : Allow user to set SubnetID -func (_options *DeleteSubnetReservedIPOptions) SetSubnetID(subnetID string) *DeleteSubnetReservedIPOptions { - _options.SubnetID = core.StringPtr(subnetID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteSubnetReservedIPOptions) SetID(id string) *DeleteSubnetReservedIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteSubnetReservedIPOptions) SetHeaders(param map[string]string) *DeleteSubnetReservedIPOptions { - options.Headers = param - return options -} - -// DeleteVirtualNetworkInterfacesOptions : The DeleteVirtualNetworkInterfaces options. -type DeleteVirtualNetworkInterfacesOptions struct { - // The virtual network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVirtualNetworkInterfacesOptions : Instantiate DeleteVirtualNetworkInterfacesOptions -func (*VpcV1) NewDeleteVirtualNetworkInterfacesOptions(id string) *DeleteVirtualNetworkInterfacesOptions { - return &DeleteVirtualNetworkInterfacesOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteVirtualNetworkInterfacesOptions) SetID(id string) *DeleteVirtualNetworkInterfacesOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVirtualNetworkInterfacesOptions) SetHeaders(param map[string]string) *DeleteVirtualNetworkInterfacesOptions { - options.Headers = param - return options -} - -// DeleteVolumeOptions : The DeleteVolume options. -type DeleteVolumeOptions struct { - // The volume 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 -} - -// NewDeleteVolumeOptions : Instantiate DeleteVolumeOptions -func (*VpcV1) NewDeleteVolumeOptions(id string) *DeleteVolumeOptions { - return &DeleteVolumeOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteVolumeOptions) SetID(id string) *DeleteVolumeOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteVolumeOptions) SetIfMatch(ifMatch string) *DeleteVolumeOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVolumeOptions) SetHeaders(param map[string]string) *DeleteVolumeOptions { - options.Headers = param - return options -} - -// DeleteVPCAddressPrefixOptions : The DeleteVPCAddressPrefix options. -type DeleteVPCAddressPrefixOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The prefix identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPCAddressPrefixOptions : Instantiate DeleteVPCAddressPrefixOptions -func (*VpcV1) NewDeleteVPCAddressPrefixOptions(vpcID string, id string) *DeleteVPCAddressPrefixOptions { - return &DeleteVPCAddressPrefixOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *DeleteVPCAddressPrefixOptions) SetVPCID(vpcID string) *DeleteVPCAddressPrefixOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPCAddressPrefixOptions) SetID(id string) *DeleteVPCAddressPrefixOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPCAddressPrefixOptions) SetHeaders(param map[string]string) *DeleteVPCAddressPrefixOptions { - options.Headers = param - return options -} - -// DeleteVPCDnsResolutionBindingOptions : The DeleteVPCDnsResolutionBinding options. -type DeleteVPCDnsResolutionBindingOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The DNS resolution binding identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPCDnsResolutionBindingOptions : Instantiate DeleteVPCDnsResolutionBindingOptions -func (*VpcV1) NewDeleteVPCDnsResolutionBindingOptions(vpcID string, id string) *DeleteVPCDnsResolutionBindingOptions { - return &DeleteVPCDnsResolutionBindingOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *DeleteVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *DeleteVPCDnsResolutionBindingOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPCDnsResolutionBindingOptions) SetID(id string) *DeleteVPCDnsResolutionBindingOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *DeleteVPCDnsResolutionBindingOptions { - options.Headers = param - return options -} - -// DeleteVPCOptions : The DeleteVPC options. -type DeleteVPCOptions struct { - // The VPC 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 -} - -// NewDeleteVPCOptions : Instantiate DeleteVPCOptions -func (*VpcV1) NewDeleteVPCOptions(id string) *DeleteVPCOptions { - return &DeleteVPCOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteVPCOptions) SetID(id string) *DeleteVPCOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteVPCOptions) SetIfMatch(ifMatch string) *DeleteVPCOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPCOptions) SetHeaders(param map[string]string) *DeleteVPCOptions { - options.Headers = param - return options -} - -// DeleteVPCRouteOptions : The DeleteVPCRoute options. -type DeleteVPCRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The route identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPCRouteOptions : Instantiate DeleteVPCRouteOptions -func (*VpcV1) NewDeleteVPCRouteOptions(vpcID string, id string) *DeleteVPCRouteOptions { - return &DeleteVPCRouteOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *DeleteVPCRouteOptions) SetVPCID(vpcID string) *DeleteVPCRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPCRouteOptions) SetID(id string) *DeleteVPCRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPCRouteOptions) SetHeaders(param map[string]string) *DeleteVPCRouteOptions { - options.Headers = param - return options -} - -// DeleteVPCRoutingTableOptions : The DeleteVPCRoutingTable options. -type DeleteVPCRoutingTableOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The routing table 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 -} - -// NewDeleteVPCRoutingTableOptions : Instantiate DeleteVPCRoutingTableOptions -func (*VpcV1) NewDeleteVPCRoutingTableOptions(vpcID string, id string) *DeleteVPCRoutingTableOptions { - return &DeleteVPCRoutingTableOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *DeleteVPCRoutingTableOptions) SetVPCID(vpcID string) *DeleteVPCRoutingTableOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPCRoutingTableOptions) SetID(id string) *DeleteVPCRoutingTableOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteVPCRoutingTableOptions) SetIfMatch(ifMatch string) *DeleteVPCRoutingTableOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPCRoutingTableOptions) SetHeaders(param map[string]string) *DeleteVPCRoutingTableOptions { - options.Headers = param - return options -} - -// DeleteVPCRoutingTableRouteOptions : The DeleteVPCRoutingTableRoute options. -type DeleteVPCRoutingTableRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The routing table identifier. - RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` - - // The VPC routing table route identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPCRoutingTableRouteOptions : Instantiate DeleteVPCRoutingTableRouteOptions -func (*VpcV1) NewDeleteVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string) *DeleteVPCRoutingTableRouteOptions { - return &DeleteVPCRoutingTableRouteOptions{ - VPCID: core.StringPtr(vpcID), - RoutingTableID: core.StringPtr(routingTableID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *DeleteVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *DeleteVPCRoutingTableRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetRoutingTableID : Allow user to set RoutingTableID -func (_options *DeleteVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *DeleteVPCRoutingTableRouteOptions { - _options.RoutingTableID = core.StringPtr(routingTableID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPCRoutingTableRouteOptions) SetID(id string) *DeleteVPCRoutingTableRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *DeleteVPCRoutingTableRouteOptions { - options.Headers = param - return options -} - -// DeleteVPNGatewayConnectionOptions : The DeleteVPNGatewayConnection options. -type DeleteVPNGatewayConnectionOptions 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="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPNGatewayConnectionOptions : Instantiate DeleteVPNGatewayConnectionOptions -func (*VpcV1) NewDeleteVPNGatewayConnectionOptions(vpnGatewayID string, id string) *DeleteVPNGatewayConnectionOptions { - return &DeleteVPNGatewayConnectionOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *DeleteVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *DeleteVPNGatewayConnectionOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPNGatewayConnectionOptions) SetID(id string) *DeleteVPNGatewayConnectionOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *DeleteVPNGatewayConnectionOptions { - options.Headers = param - return options -} - -// DeleteVPNGatewayOptions : The DeleteVPNGateway options. -type DeleteVPNGatewayOptions struct { - // The VPN gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPNGatewayOptions : Instantiate DeleteVPNGatewayOptions -func (*VpcV1) NewDeleteVPNGatewayOptions(id string) *DeleteVPNGatewayOptions { - return &DeleteVPNGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteVPNGatewayOptions) SetID(id string) *DeleteVPNGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPNGatewayOptions) SetHeaders(param map[string]string) *DeleteVPNGatewayOptions { - options.Headers = param - return options -} - -// DeleteVPNServerClientOptions : The DeleteVPNServerClient options. -type DeleteVPNServerClientOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // The VPN client identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPNServerClientOptions : Instantiate DeleteVPNServerClientOptions -func (*VpcV1) NewDeleteVPNServerClientOptions(vpnServerID string, id string) *DeleteVPNServerClientOptions { - return &DeleteVPNServerClientOptions{ - VPNServerID: core.StringPtr(vpnServerID), - ID: core.StringPtr(id), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *DeleteVPNServerClientOptions) SetVPNServerID(vpnServerID string) *DeleteVPNServerClientOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPNServerClientOptions) SetID(id string) *DeleteVPNServerClientOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPNServerClientOptions) SetHeaders(param map[string]string) *DeleteVPNServerClientOptions { - options.Headers = param - return options -} - -// DeleteVPNServerOptions : The DeleteVPNServer options. -type DeleteVPNServerOptions struct { - // The VPN server 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 -} - -// NewDeleteVPNServerOptions : Instantiate DeleteVPNServerOptions -func (*VpcV1) NewDeleteVPNServerOptions(id string) *DeleteVPNServerOptions { - return &DeleteVPNServerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeleteVPNServerOptions) SetID(id string) *DeleteVPNServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteVPNServerOptions) SetIfMatch(ifMatch string) *DeleteVPNServerOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPNServerOptions) SetHeaders(param map[string]string) *DeleteVPNServerOptions { - options.Headers = param - return options -} - -// DeleteVPNServerRouteOptions : The DeleteVPNServerRoute options. -type DeleteVPNServerRouteOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // The VPN route identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPNServerRouteOptions : Instantiate DeleteVPNServerRouteOptions -func (*VpcV1) NewDeleteVPNServerRouteOptions(vpnServerID string, id string) *DeleteVPNServerRouteOptions { - return &DeleteVPNServerRouteOptions{ - VPNServerID: core.StringPtr(vpnServerID), - ID: core.StringPtr(id), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *DeleteVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *DeleteVPNServerRouteOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPNServerRouteOptions) SetID(id string) *DeleteVPNServerRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPNServerRouteOptions) SetHeaders(param map[string]string) *DeleteVPNServerRouteOptions { - options.Headers = param - return options -} - -// DeprecateImageOptions : The DeprecateImage options. -type DeprecateImageOptions struct { - // The image identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeprecateImageOptions : Instantiate DeprecateImageOptions -func (*VpcV1) NewDeprecateImageOptions(id string) *DeprecateImageOptions { - return &DeprecateImageOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *DeprecateImageOptions) SetID(id string) *DeprecateImageOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeprecateImageOptions) SetHeaders(param map[string]string) *DeprecateImageOptions { - options.Headers = param - return options -} - -// DisconnectVPNClientOptions : The DisconnectVPNClient options. -type DisconnectVPNClientOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // The VPN client identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDisconnectVPNClientOptions : Instantiate DisconnectVPNClientOptions -func (*VpcV1) NewDisconnectVPNClientOptions(vpnServerID string, id string) *DisconnectVPNClientOptions { - return &DisconnectVPNClientOptions{ - VPNServerID: core.StringPtr(vpnServerID), - ID: core.StringPtr(id), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *DisconnectVPNClientOptions) SetVPNServerID(vpnServerID string) *DisconnectVPNClientOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DisconnectVPNClientOptions) SetID(id string) *DisconnectVPNClientOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DisconnectVPNClientOptions) SetHeaders(param map[string]string) *DisconnectVPNClientOptions { - options.Headers = param - return options -} - -// EncryptionKeyIdentity : Identifies an encryption key by a unique property. -// Models which "extend" this model: -// - EncryptionKeyIdentityByCRN -type EncryptionKeyIdentity struct { - // The CRN of the [Key Protect Root - // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto - // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. - CRN *string `json:"crn,omitempty"` -} - -func (*EncryptionKeyIdentity) isaEncryptionKeyIdentity() bool { - return true -} - -type EncryptionKeyIdentityIntf interface { - isaEncryptionKeyIdentity() bool -} - -// UnmarshalEncryptionKeyIdentity unmarshals an instance of EncryptionKeyIdentity from the specified map of raw messages. -func UnmarshalEncryptionKeyIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EncryptionKeyIdentity) - 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 -} - -// EncryptionKeyReference : EncryptionKeyReference struct -type EncryptionKeyReference struct { - // The CRN of the [Key Protect Root - // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto - // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. - CRN *string `json:"crn" validate:"required"` -} - -// UnmarshalEncryptionKeyReference unmarshals an instance of EncryptionKeyReference from the specified map of raw messages. -func UnmarshalEncryptionKeyReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EncryptionKeyReference) - 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 -} - -// EndpointGateway : EndpointGateway struct -type EndpointGateway struct { - // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in - // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. - AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding" validate:"required"` - - // The date and time that the endpoint gateway was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this endpoint gateway. - CRN *string `json:"crn" 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 endpoint gateway. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this endpoint gateway. - ID *string `json:"id" validate:"required"` - - // The reserved IPs bound to this endpoint gateway. - Ips []ReservedIPReference `json:"ips" validate:"required"` - - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []EndpointGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the endpoint gateway. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this endpoint gateway. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The security groups targeting this endpoint gateway. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The fully qualified domain name for the target service. - // Deprecated: this field is deprecated and may be removed in a future release. - ServiceEndpoint *string `json:"service_endpoint,omitempty"` - - // The fully qualified domain names for the target service. - ServiceEndpoints []string `json:"service_endpoints" validate:"required"` - - // The target for this endpoint gateway. - Target EndpointGatewayTargetIntf `json:"target" validate:"required"` - - // The VPC this endpoint gateway resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// Constants associated with the EndpointGateway.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 ( - EndpointGatewayHealthStateDegradedConst = "degraded" - EndpointGatewayHealthStateFaultedConst = "faulted" - EndpointGatewayHealthStateInapplicableConst = "inapplicable" - EndpointGatewayHealthStateOkConst = "ok" -) - -// Constants associated with the EndpointGateway.LifecycleState property. -// The lifecycle state of the endpoint gateway. -const ( - EndpointGatewayLifecycleStateDeletingConst = "deleting" - EndpointGatewayLifecycleStateFailedConst = "failed" - EndpointGatewayLifecycleStatePendingConst = "pending" - EndpointGatewayLifecycleStateStableConst = "stable" - EndpointGatewayLifecycleStateSuspendedConst = "suspended" - EndpointGatewayLifecycleStateUpdatingConst = "updating" - EndpointGatewayLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the EndpointGateway.ResourceType property. -// The resource type. -const ( - EndpointGatewayResourceTypeEndpointGatewayConst = "endpoint_gateway" -) - -// UnmarshalEndpointGateway unmarshals an instance of EndpointGateway from the specified map of raw messages. -func UnmarshalEndpointGateway(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGateway) - err = core.UnmarshalPrimitive(m, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding) - if err != nil { - err = core.SDKErrorf(err, "", "allow_dns_resolution_binding-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-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.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "ips-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalEndpointGatewayLifecycleReason) - 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, "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, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "service_endpoint", &obj.ServiceEndpoint) - if err != nil { - err = core.SDKErrorf(err, "", "service_endpoint-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "service_endpoints", &obj.ServiceEndpoints) - if err != nil { - err = core.SDKErrorf(err, "", "service_endpoints-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalEndpointGatewayTarget) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayCollection : EndpointGatewayCollection struct -type EndpointGatewayCollection struct { - // Collection of endpoint gateways. - EndpointGateways []EndpointGateway `json:"endpoint_gateways" validate:"required"` - - // A link to the first page of resources. - First *EndpointGatewayCollectionFirst `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"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalEndpointGatewayCollection unmarshals an instance of EndpointGatewayCollection from the specified map of raw messages. -func UnmarshalEndpointGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayCollection) - err = core.UnmarshalModel(m, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGateway) - if err != nil { - err = core.SDKErrorf(err, "", "endpoint_gateways-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalEndpointGatewayCollectionFirst) - 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, UnmarshalEndpointGatewayCollectionNext) - 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 *EndpointGatewayCollection) 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 -} - -// 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: - // - `dns_resolution_binding_pending`: the DNS resolution binding is being set up - // - `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 EndpointGatewayLifecycleReason.Code property. -// A reason code for this lifecycle state: -// - `dns_resolution_binding_pending`: the DNS resolution binding is being set up -// - `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 ( - EndpointGatewayLifecycleReasonCodeDnsResolutionBindingPendingConst = "dns_resolution_binding_pending" - EndpointGatewayLifecycleReasonCodeInternalErrorConst = "internal_error" - EndpointGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalEndpointGatewayLifecycleReason unmarshals an instance of EndpointGatewayLifecycleReason from the specified map of raw messages. -func UnmarshalEndpointGatewayLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayLifecycleReason) - 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 -} - -// EndpointGatewayPatch : EndpointGatewayPatch struct -type EndpointGatewayPatch struct { - // Indicates whether to allow DNS resolution for this endpoint gateway when the VPC this endpoint gateway resides in - // has a DNS resolution binding to a VPC with `dns.enable_hub` set to `true`. - // - // Must be `true` if the VPC this endpoint gateway resides in has `dns.enable_hub` set to - // `true`. - AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` - - // The name for this endpoint gateway. The name must not be used by another endpoint gateway in the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalEndpointGatewayPatch unmarshals an instance of EndpointGatewayPatch from the specified map of raw messages. -func UnmarshalEndpointGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayPatch) - err = core.UnmarshalPrimitive(m, "allow_dns_resolution_binding", &obj.AllowDnsResolutionBinding) - if err != nil { - err = core.SDKErrorf(err, "", "allow_dns_resolution_binding-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 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// EndpointGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type EndpointGatewayReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalEndpointGatewayReferenceDeleted unmarshals an instance of EndpointGatewayReferenceDeleted from the specified map of raw messages. -func UnmarshalEndpointGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReferenceDeleted) - 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 -} - -// EndpointGatewayReferenceRemote : EndpointGatewayReferenceRemote struct -type EndpointGatewayReferenceRemote struct { - // The CRN for this endpoint gateway. - CRN *string `json:"crn" validate:"required"` - - // The URL for this endpoint gateway. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this endpoint gateway. - ID *string `json:"id" validate:"required"` - - // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. - 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 *EndpointGatewayRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the EndpointGatewayReferenceRemote.ResourceType property. -// The resource type. -const ( - EndpointGatewayReferenceRemoteResourceTypeEndpointGatewayConst = "endpoint_gateway" -) - -// UnmarshalEndpointGatewayReferenceRemote unmarshals an instance of EndpointGatewayReferenceRemote from the specified map of raw messages. -func UnmarshalEndpointGatewayReferenceRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReferenceRemote) - 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) - 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, UnmarshalEndpointGatewayRemote) - 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 -} - -// EndpointGatewayRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not -// be directly retrievable. -type EndpointGatewayRemote struct { - // If present, this property indicates that the referenced resource is remote to this - // account, and identifies the owning account. - Account *AccountReference `json:"account,omitempty"` - - // If present, this property indicates that the referenced resource is remote to this - // region, and identifies the native region. - Region *RegionReference `json:"region,omitempty"` -} - -// UnmarshalEndpointGatewayRemote unmarshals an instance of EndpointGatewayRemote from the specified map of raw messages. -func UnmarshalEndpointGatewayRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayRemote) - err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) - if err != nil { - err = core.SDKErrorf(err, "", "account-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 -} - -// EndpointGatewayReservedIP : A reserved IP to bind to the endpoint gateway. This can be specified using an existing reserved IP, or a prototype -// object for a new reserved IP. The reserved IP will be bound to the endpoint gateway to function as a virtual private -// endpoint for the service. -// Models which "extend" this model: -// - EndpointGatewayReservedIPReservedIPIdentity -// - EndpointGatewayReservedIPReservedIPPrototypeTargetContext -type EndpointGatewayReservedIP struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` - - // 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 reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the 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"` - - // The subnet in which to create this reserved IP. - Subnet SubnetIdentityIntf `json:"subnet,omitempty"` -} - -func (*EndpointGatewayReservedIP) isaEndpointGatewayReservedIP() bool { - return true -} - -type EndpointGatewayReservedIPIntf interface { - isaEndpointGatewayReservedIP() bool -} - -// UnmarshalEndpointGatewayReservedIP unmarshals an instance of EndpointGatewayReservedIP from the specified map of raw messages. -func UnmarshalEndpointGatewayReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReservedIP) - 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 - } - 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 - } - 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 -} - -// EndpointGatewayTarget : The target for this endpoint gateway. -// Models which "extend" this model: -// - EndpointGatewayTargetProviderCloudServiceReference -// - EndpointGatewayTargetProviderInfrastructureServiceReference -type EndpointGatewayTarget struct { - // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. - CRN *string `json:"crn,omitempty"` - - // The type of target. - ResourceType *string `json:"resource_type,omitempty"` - - // The name of a provider infrastructure service. Must be: - // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. - Name *string `json:"name,omitempty"` -} - -// Constants associated with the EndpointGatewayTarget.ResourceType property. -// The type of target. -const ( - EndpointGatewayTargetResourceTypeProviderCloudServiceConst = "provider_cloud_service" -) - -func (*EndpointGatewayTarget) isaEndpointGatewayTarget() bool { - return true -} - -type EndpointGatewayTargetIntf interface { - isaEndpointGatewayTarget() bool -} - -// 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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-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, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayTargetPrototype : The target to use for this endpoint gateway. Must not already be the target of another endpoint gateway in the VPC. -// Models which "extend" this model: -// - EndpointGatewayTargetPrototypeProviderCloudServiceIdentity -// - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity -type EndpointGatewayTargetPrototype struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` - - // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. - CRN *string `json:"crn,omitempty"` - - // The name of a provider infrastructure service. Must be: - // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. - Name *string `json:"name,omitempty"` -} - -// Constants associated with the EndpointGatewayTargetPrototype.ResourceType property. -// The type of target for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -func (*EndpointGatewayTargetPrototype) isaEndpointGatewayTargetPrototype() bool { - return true -} - -type EndpointGatewayTargetPrototypeIntf interface { - isaEndpointGatewayTargetPrototype() bool -} - -// UnmarshalEndpointGatewayTargetPrototype unmarshals an instance of EndpointGatewayTargetPrototype from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "resource_type", &discValue) - if err != nil { - errMsg := fmt.Sprintf("error unmarshalling discriminator property 'resource_type': %s", err.Error()) - err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) - return - } - if discValue == "" { - err = core.SDKErrorf(err, "required discriminator property 'resource_type' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) - return - } - if discValue == "provider_cloud_service" { - err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-EndpointGatewayTargetPrototypeProviderCloudServiceIdentity-error", common.GetComponentInfo()) - } - } else if discValue == "provider_infrastructure_service" { - err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity-error", common.GetComponentInfo()) - } - } else { - errMsg := fmt.Sprintf("unrecognized value for discriminator property 'resource_type': %s", discValue) - err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) - } - return -} - -// FailoverShareOptions : The FailoverShare options. -type FailoverShareOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // The action to take if the failover request is accepted but cannot be performed or times out: - // - `fail`: Fail the operation, resulting in the replication relationship being unchanged. - // - `split`: Split the replica from its source, resulting in two individual read-write - // file shares. Because the final sync was not completed, the replica may be - // out-of-date. This occurs in disaster recovery scenarios where the source is known to - // be unreachable. - FallbackPolicy *string `json:"fallback_policy,omitempty"` - - // The failover timeout in seconds. - // - // If the timeout is reached, the `fallback_policy` will be triggered. - Timeout *int64 `json:"timeout,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the FailoverShareOptions.FallbackPolicy property. -// The action to take if the failover request is accepted but cannot be performed or times out: -// - `fail`: Fail the operation, resulting in the replication relationship being unchanged. -// - `split`: Split the replica from its source, resulting in two individual read-write -// file shares. Because the final sync was not completed, the replica may be -// out-of-date. This occurs in disaster recovery scenarios where the source is known to -// be unreachable. -const ( - FailoverShareOptionsFallbackPolicyFailConst = "fail" - FailoverShareOptionsFallbackPolicySplitConst = "split" -) - -// NewFailoverShareOptions : Instantiate FailoverShareOptions -func (*VpcV1) NewFailoverShareOptions(shareID string) *FailoverShareOptions { - return &FailoverShareOptions{ - ShareID: core.StringPtr(shareID), - } -} - -// SetShareID : Allow user to set ShareID -func (_options *FailoverShareOptions) SetShareID(shareID string) *FailoverShareOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetFallbackPolicy : Allow user to set FallbackPolicy -func (_options *FailoverShareOptions) SetFallbackPolicy(fallbackPolicy string) *FailoverShareOptions { - _options.FallbackPolicy = core.StringPtr(fallbackPolicy) - return _options -} - -// SetTimeout : Allow user to set Timeout -func (_options *FailoverShareOptions) SetTimeout(timeout int64) *FailoverShareOptions { - _options.Timeout = core.Int64Ptr(timeout) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *FailoverShareOptions) SetHeaders(param map[string]string) *FailoverShareOptions { - options.Headers = param - return options -} - -// FloatingIP : FloatingIP struct -type FloatingIP struct { - // The globally unique IP address. - Address *string `json:"address" validate:"required"` - - // The date and time that the floating IP was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this floating IP. - CRN *string `json:"crn" validate:"required"` - - // The URL for this floating IP. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this floating IP. - ID *string `json:"id" validate:"required"` - - // The name for this floating IP. The name is unique across all floating IPs in the region. - Name *string `json:"name" validate:"required"` - - // The resource group for this floating IP. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The status of the floating IP. - Status *string `json:"status" validate:"required"` - - // The target of this floating IP. - Target FloatingIPTargetIntf `json:"target,omitempty"` - - // The zone this floating IP resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the FloatingIP.Status property. -// The status of the floating IP. -const ( - FloatingIPStatusAvailableConst = "available" - FloatingIPStatusDeletingConst = "deleting" - FloatingIPStatusFailedConst = "failed" - FloatingIPStatusPendingConst = "pending" -) - -// UnmarshalFloatingIP unmarshals an instance of FloatingIP from the specified map of raw messages. -func UnmarshalFloatingIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-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, "target", &obj.Target, UnmarshalFloatingIPTarget) - if err != nil { - err = core.SDKErrorf(err, "", "target-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 -} - -// FloatingIPCollection : FloatingIPCollection struct -type FloatingIPCollection struct { - // A link to the first page of resources. - First *FloatingIPCollectionFirst `json:"first" validate:"required"` - - // Collection of floating IPs. - FloatingIps []FloatingIP `json:"floating_ips" 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 *FloatingIPCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) - if err != nil { - err = core.SDKErrorf(err, "", "floating_ips-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, UnmarshalFloatingIPCollectionNext) - 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 *FloatingIPCollection) 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 -} - -// 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"` - - // Collection of floating IPs bound to the virtual network interface specified by the identifier in the URL. - FloatingIps []FloatingIPReference `json:"floating_ips" 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 *FloatingIPCollectionVirtualNetworkInterfaceContextNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "floating_ips-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, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContextNext) - 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 *FloatingIPCollectionVirtualNetworkInterfaceContext) 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 -} - -// 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. - Name *string `json:"name,omitempty"` - - // The target resource to bind this floating IP to, replacing any existing binding. - // The floating IP must not be required by another resource, such as a public gateway. - // - // The target resource must not already have a floating IP bound to it if the target - // resource is: - // - // - an instance network interface - // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` - // - a virtual network interface with `enable_infrastructure_nat` set to `true` - // - // Specify `null` to remove an existing binding. - Target FloatingIPTargetPatchIntf `json:"target,omitempty"` -} - -// UnmarshalFloatingIPPatch unmarshals an instance of FloatingIPPatch from the specified map of raw messages. -func UnmarshalFloatingIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPatch) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// FloatingIPPrototype : FloatingIPPrototype struct -// Models which "extend" this model: -// - FloatingIPPrototypeFloatingIPByZone -// - FloatingIPPrototypeFloatingIPByTarget -type FloatingIPPrototype struct { - // The name for this floating IP. The name must not be used by another floating IP in the region. 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"` - - // The zone this floating IP will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` - - // 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: - // - // - an instance network interface - // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` - // - a virtual network interface with `enable_infrastructure_nat` set to `true`. - Target FloatingIPTargetPrototypeIntf `json:"target,omitempty"` -} - -func (*FloatingIPPrototype) isaFloatingIPPrototype() bool { - return true -} - -type FloatingIPPrototypeIntf interface { - isaFloatingIPPrototype() bool -} - -// UnmarshalFloatingIPPrototype unmarshals an instance of FloatingIPPrototype from the specified map of raw messages. -func UnmarshalFloatingIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPReference : FloatingIPReference struct -type FloatingIPReference struct { - // The globally unique IP address. - Address *string `json:"address" validate:"required"` - - // The CRN for this floating IP. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this floating IP. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this floating IP. - ID *string `json:"id" validate:"required"` - - // The name for this floating IP. The name is unique across all floating IPs in the region. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalFloatingIPReference unmarshals an instance of FloatingIPReference from the specified map of raw messages. -func UnmarshalFloatingIPReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPReference) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-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, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type FloatingIPReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalFloatingIPReferenceDeleted unmarshals an instance of FloatingIPReferenceDeleted from the specified map of raw messages. -func UnmarshalFloatingIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPReferenceDeleted) - 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 -} - -// FloatingIPTarget : The target of this floating IP. -// Models which "extend" this model: -// - FloatingIPTargetNetworkInterfaceReference -// - FloatingIPTargetBareMetalServerNetworkInterfaceReference -// - FloatingIPTargetPublicGatewayReference -// - FloatingIPTargetVirtualNetworkInterfaceReference -type FloatingIPTarget struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - // - // If this instance 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,omitempty"` - - // The unique identifier for this instance network interface. - // - // If this instance 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,omitempty"` - - // The name for this instance network interface. - Name *string `json:"name,omitempty"` - - PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` - - // The CRN for this public gateway. - CRN *string `json:"crn,omitempty"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet,omitempty"` -} - -// Constants associated with the FloatingIPTarget.ResourceType property. -// The resource type. -const ( - FloatingIPTargetResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*FloatingIPTarget) isaFloatingIPTarget() bool { - return true -} - -type FloatingIPTargetIntf interface { - isaFloatingIPTarget() bool -} - -// UnmarshalFloatingIPTarget unmarshals an instance of FloatingIPTarget from the specified map of raw messages. -func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) - 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "resource_type-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPatch : The target resource to bind this floating IP to, replacing any existing binding. The floating IP must not be required -// by another resource, such as a public gateway. -// -// The target resource must not already have a floating IP bound to it if the target resource is: -// -// - an instance network interface -// - a bare metal server network interface with `enable_infrastructure_nat` set to `true` -// - a virtual network interface with `enable_infrastructure_nat` set to `true` -// -// Specify `null` to remove an existing binding. -// Models which "extend" this model: -// - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity -// - FloatingIPTargetPatchNetworkInterfaceIdentity -// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentity -type FloatingIPTargetPatch struct { - // 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,omitempty"` - - // 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,omitempty"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn,omitempty"` -} - -func (*FloatingIPTargetPatch) isaFloatingIPTargetPatch() bool { - return true -} - -type FloatingIPTargetPatchIntf interface { - isaFloatingIPTargetPatch() bool -} - -// UnmarshalFloatingIPTargetPatch unmarshals an instance of FloatingIPTargetPatch from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatch) - 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 - } - 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 -} - -// 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: -// -// - an instance network interface -// - a bare metal server network interface with `enable_infrastructure_nat` set to `true` -// - a virtual network interface with `enable_infrastructure_nat` set to `true`. -// Models which "extend" this model: -// - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity -// - FloatingIPTargetPrototypeNetworkInterfaceIdentity -// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity -type FloatingIPTargetPrototype struct { - // 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,omitempty"` - - // 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,omitempty"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn,omitempty"` -} - -func (*FloatingIPTargetPrototype) isaFloatingIPTargetPrototype() bool { - return true -} - -type FloatingIPTargetPrototypeIntf interface { - isaFloatingIPTargetPrototype() bool -} - -// UnmarshalFloatingIPTargetPrototype unmarshals an instance of FloatingIPTargetPrototype from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototype) - 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 - } - 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 -} - -// FloatingIPUnpaginatedCollection : FloatingIPUnpaginatedCollection struct -type FloatingIPUnpaginatedCollection struct { - // Collection of floating IPs. - FloatingIps []FloatingIP `json:"floating_ips" validate:"required"` -} - -// UnmarshalFloatingIPUnpaginatedCollection unmarshals an instance of FloatingIPUnpaginatedCollection from the specified map of raw messages. -func UnmarshalFloatingIPUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPUnpaginatedCollection) - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) - if err != nil { - err = core.SDKErrorf(err, "", "floating_ips-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollector : FlowLogCollector struct -type FlowLogCollector struct { - // Indicates whether this collector is active. - Active *bool `json:"active" validate:"required"` - - // Indicates whether this flow log collector will be automatically deleted when `target` is deleted. At present, this - // is always `true`, but may be modifiable in the future. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // The date and time that the flow log collector was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this flow log collector. - CRN *string `json:"crn" validate:"required"` - - // The URL for this flow log collector. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this flow log collector. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the flow log collector. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this flow log collector. The name is unique across all flow log collectors in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this flow log collector. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The Cloud Object Storage bucket where the collected flows are logged. For more - // information, see [Viewing flow log - // objects](https://cloud.ibm.com/docs/vpc?topic=vpc-fl-analyze). - StorageBucket *LegacyCloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` - - // The target this collector is collecting flow logs for. - // - // - If the target is an instance network attachment, flow logs will be collected - // for that instance network attachment. - // - If the target is an instance network interface, flow logs will be collected - // for that instance network interface. - // - If the target is a virtual network interface, flow logs will be collected for the - // virtual network interface's `target` resource if the resource is an instance network - // attachment, unless the target resource is itself the target of a flow log collector. - // - If the target is a virtual server instance, flow logs will be collected - // for all network attachments or network interfaces on that instance. - // - If the target is a subnet, flow logs will be collected - // for all instance network interfaces and virtual network interfaces - // attached to that subnet. - // - If the target is a VPC, flow logs will be collected for all instance network - // interfaces and virtual network interfaces attached to all subnets within that VPC. - // - // If the target is an instance, subnet, or VPC, flow logs will not be collected - // for any instance network attachments or instance network interfaces within the target - // that are themselves the target of a more specific flow log collector. - Target FlowLogCollectorTargetIntf `json:"target" validate:"required"` - - // The VPC this flow log collector resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// Constants associated with the FlowLogCollector.LifecycleState property. -// The lifecycle state of the flow log collector. -const ( - FlowLogCollectorLifecycleStateDeletingConst = "deleting" - FlowLogCollectorLifecycleStateFailedConst = "failed" - FlowLogCollectorLifecycleStatePendingConst = "pending" - FlowLogCollectorLifecycleStateStableConst = "stable" - FlowLogCollectorLifecycleStateSuspendedConst = "suspended" - FlowLogCollectorLifecycleStateUpdatingConst = "updating" - FlowLogCollectorLifecycleStateWaitingConst = "waiting" -) - -// UnmarshalFlowLogCollector unmarshals an instance of FlowLogCollector from the specified map of raw messages. -func UnmarshalFlowLogCollector(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollector) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - err = core.SDKErrorf(err, "", "active-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, "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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalLegacyCloudObjectStorageBucketReference) - if err != nil { - err = core.SDKErrorf(err, "", "storage_bucket-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFlowLogCollectorTarget) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorCollection : FlowLogCollectorCollection struct -type FlowLogCollectorCollection struct { - // A link to the first page of resources. - First *FlowLogCollectorCollectionFirst `json:"first" validate:"required"` - - // Collection of flow log collectors. - FlowLogCollectors []FlowLogCollector `json:"flow_log_collectors" 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 *FlowLogCollectorCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "flow_log_collectors", &obj.FlowLogCollectors, UnmarshalFlowLogCollector) - if err != nil { - err = core.SDKErrorf(err, "", "flow_log_collectors-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, UnmarshalFlowLogCollectorCollectionNext) - 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 *FlowLogCollectorCollection) 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 -} - -// 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 - // activates the collector. - Active *bool `json:"active,omitempty"` - - // The name for this flow log collector. The name must not be used by another flow log collector in the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalFlowLogCollectorPatch unmarshals an instance of FlowLogCollectorPatch from the specified map of raw messages. -func UnmarshalFlowLogCollectorPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorPatch) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - err = core.SDKErrorf(err, "", "active-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 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// FlowLogCollectorTarget : The target this collector is collecting flow logs for. -// -// - If the target is an instance network attachment, flow logs will be collected -// for that instance network attachment. -// - If the target is an instance network interface, flow logs will be collected -// for that instance network interface. -// - If the target is a virtual network interface, flow logs will be collected for the -// virtual network interface's `target` resource if the resource is an instance network -// attachment, unless the target resource is itself the target of a flow log collector. -// - If the target is a virtual server instance, flow logs will be collected -// for all network attachments or network interfaces on that instance. -// - If the target is a subnet, flow logs will be collected -// for all instance network interfaces and virtual network interfaces -// attached to that subnet. -// - If the target is a VPC, flow logs will be collected for all instance network -// interfaces and virtual network interfaces attached to all subnets within that VPC. -// -// If the target is an instance, subnet, or VPC, flow logs will not be collected for any instance network attachments or -// instance network interfaces within the target that are themselves the target of a more specific flow log collector. -// Models which "extend" this model: -// - FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext -// - FlowLogCollectorTargetInstanceReference -// - FlowLogCollectorTargetSubnetReference -// - FlowLogCollectorTargetVPCReference -// - FlowLogCollectorTargetInstanceNetworkAttachmentReference -// - FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext -type FlowLogCollectorTarget struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - // - // If this instance 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,omitempty"` - - // The unique identifier for this instance network interface. - // - // If this instance 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,omitempty"` - - // The name for this instance network interface. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` - - // The CRN for this virtual server instance. - CRN *string `json:"crn,omitempty"` - - // The primary IP address of the virtual network interface for the instance network - // attachment. - PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` - - // The subnet of the virtual network interface for the instance network attachment. - Subnet *SubnetReference `json:"subnet,omitempty"` -} - -// Constants associated with the FlowLogCollectorTarget.ResourceType property. -// The resource type. -const ( - FlowLogCollectorTargetResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*FlowLogCollectorTarget) isaFlowLogCollectorTarget() bool { - return true -} - -type FlowLogCollectorTargetIntf interface { - isaFlowLogCollectorTarget() bool -} - -// UnmarshalFlowLogCollectorTarget unmarshals an instance of FlowLogCollectorTarget from the specified map of raw messages. -func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) - 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 - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototype : The target this collector will collect flow logs for. -// -// If the target is an instance, subnet, or VPC, flow logs will not be collected for any instance network attachments, -// virtual network interfaces or instance network interfaces within the target that are themselves the target of a more -// specific flow log collector. -// -// The target must not be a virtual network interface that is attached to a bare metal server network attachment or to a -// file share mount target. -// Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity -// - FlowLogCollectorTargetPrototypeInstanceIdentity -// - FlowLogCollectorTargetPrototypeSubnetIdentity -// - FlowLogCollectorTargetPrototypeVPCIdentity -// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity -// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity -type FlowLogCollectorTargetPrototype struct { - // The unique identifier for this instance network interface. - // - // If this instance 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,omitempty"` - - // The URL for this instance network interface. - // - // If this instance 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,omitempty"` - - // The CRN for this virtual server instance. - CRN *string `json:"crn,omitempty"` -} - -func (*FlowLogCollectorTargetPrototype) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -type FlowLogCollectorTargetPrototypeIntf interface { - isaFlowLogCollectorTargetPrototype() bool -} - -// UnmarshalFlowLogCollectorTargetPrototype unmarshals an instance of FlowLogCollectorTargetPrototype from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototype) - 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 - } - 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 -} - -// GenericResourceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type GenericResourceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalGenericResourceReferenceDeleted unmarshals an instance of GenericResourceReferenceDeleted from the specified map of raw messages. -func UnmarshalGenericResourceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(GenericResourceReferenceDeleted) - 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 -} - -// GetBackupPolicyJobOptions : The GetBackupPolicyJob options. -type GetBackupPolicyJobOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - - // The backup policy job identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBackupPolicyJobOptions : Instantiate GetBackupPolicyJobOptions -func (*VpcV1) NewGetBackupPolicyJobOptions(backupPolicyID string, id string) *GetBackupPolicyJobOptions { - return &GetBackupPolicyJobOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - ID: core.StringPtr(id), - } -} - -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *GetBackupPolicyJobOptions) SetBackupPolicyID(backupPolicyID string) *GetBackupPolicyJobOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBackupPolicyJobOptions) SetID(id string) *GetBackupPolicyJobOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBackupPolicyJobOptions) SetHeaders(param map[string]string) *GetBackupPolicyJobOptions { - options.Headers = param - return options -} - -// GetBackupPolicyOptions : The GetBackupPolicy options. -type GetBackupPolicyOptions struct { - // The backup policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBackupPolicyOptions : Instantiate GetBackupPolicyOptions -func (*VpcV1) NewGetBackupPolicyOptions(id string) *GetBackupPolicyOptions { - return &GetBackupPolicyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetBackupPolicyOptions) SetID(id string) *GetBackupPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBackupPolicyOptions) SetHeaders(param map[string]string) *GetBackupPolicyOptions { - options.Headers = param - return options -} - -// GetBackupPolicyPlanOptions : The GetBackupPolicyPlan options. -type GetBackupPolicyPlanOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - - // The backup policy plan identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBackupPolicyPlanOptions : Instantiate GetBackupPolicyPlanOptions -func (*VpcV1) NewGetBackupPolicyPlanOptions(backupPolicyID string, id string) *GetBackupPolicyPlanOptions { - return &GetBackupPolicyPlanOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - ID: core.StringPtr(id), - } -} - -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *GetBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *GetBackupPolicyPlanOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBackupPolicyPlanOptions) SetID(id string) *GetBackupPolicyPlanOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBackupPolicyPlanOptions) SetHeaders(param map[string]string) *GetBackupPolicyPlanOptions { - options.Headers = param - return options -} - -// GetBareMetalServerDiskOptions : The GetBareMetalServerDisk options. -type GetBareMetalServerDiskOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server disk identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerDiskOptions : Instantiate GetBareMetalServerDiskOptions -func (*VpcV1) NewGetBareMetalServerDiskOptions(bareMetalServerID string, id string) *GetBareMetalServerDiskOptions { - return &GetBareMetalServerDiskOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *GetBareMetalServerDiskOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerDiskOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerDiskOptions) SetID(id string) *GetBareMetalServerDiskOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerDiskOptions) SetHeaders(param map[string]string) *GetBareMetalServerDiskOptions { - options.Headers = param - return options -} - -// GetBareMetalServerInitializationOptions : The GetBareMetalServerInitialization options. -type GetBareMetalServerInitializationOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerInitializationOptions : Instantiate GetBareMetalServerInitializationOptions -func (*VpcV1) NewGetBareMetalServerInitializationOptions(id string) *GetBareMetalServerInitializationOptions { - return &GetBareMetalServerInitializationOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerInitializationOptions) SetID(id string) *GetBareMetalServerInitializationOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerInitializationOptions) SetHeaders(param map[string]string) *GetBareMetalServerInitializationOptions { - options.Headers = param - return options -} - -// GetBareMetalServerNetworkAttachmentOptions : The GetBareMetalServerNetworkAttachment options. -type GetBareMetalServerNetworkAttachmentOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerNetworkAttachmentOptions : Instantiate GetBareMetalServerNetworkAttachmentOptions -func (*VpcV1) NewGetBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string) *GetBareMetalServerNetworkAttachmentOptions { - return &GetBareMetalServerNetworkAttachmentOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *GetBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkAttachmentOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerNetworkAttachmentOptions) SetID(id string) *GetBareMetalServerNetworkAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkAttachmentOptions { - options.Headers = param - return options -} - -// GetBareMetalServerNetworkInterfaceFloatingIPOptions : The GetBareMetalServerNetworkInterfaceFloatingIP options. -type GetBareMetalServerNetworkInterfaceFloatingIPOptions 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 -} - -// NewGetBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate GetBareMetalServerNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewGetBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { - return &GetBareMetalServerNetworkInterfaceFloatingIPOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} - -// GetBareMetalServerNetworkInterfaceIPOptions : The GetBareMetalServerNetworkInterfaceIP options. -type GetBareMetalServerNetworkInterfaceIPOptions 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 reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerNetworkInterfaceIPOptions : Instantiate GetBareMetalServerNetworkInterfaceIPOptions -func (*VpcV1) NewGetBareMetalServerNetworkInterfaceIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *GetBareMetalServerNetworkInterfaceIPOptions { - return &GetBareMetalServerNetworkInterfaceIPOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceIPOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetBareMetalServerNetworkInterfaceIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceIPOptions { - options.Headers = param - return options -} - -// GetBareMetalServerNetworkInterfaceOptions : The GetBareMetalServerNetworkInterface options. -type GetBareMetalServerNetworkInterfaceOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerNetworkInterfaceOptions : Instantiate GetBareMetalServerNetworkInterfaceOptions -func (*VpcV1) NewGetBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string) *GetBareMetalServerNetworkInterfaceOptions { - return &GetBareMetalServerNetworkInterfaceOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *GetBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerNetworkInterfaceOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceOptions { - options.Headers = param - return options -} - -// GetBareMetalServerOptions : The GetBareMetalServer options. -type GetBareMetalServerOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerOptions : Instantiate GetBareMetalServerOptions -func (*VpcV1) NewGetBareMetalServerOptions(id string) *GetBareMetalServerOptions { - return &GetBareMetalServerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerOptions) SetID(id string) *GetBareMetalServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerOptions) SetHeaders(param map[string]string) *GetBareMetalServerOptions { - options.Headers = param - return options -} - -// GetBareMetalServerProfileOptions : The GetBareMetalServerProfile options. -type GetBareMetalServerProfileOptions struct { - // The bare metal server profile name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerProfileOptions : Instantiate GetBareMetalServerProfileOptions -func (*VpcV1) NewGetBareMetalServerProfileOptions(name string) *GetBareMetalServerProfileOptions { - return &GetBareMetalServerProfileOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetBareMetalServerProfileOptions) SetName(name string) *GetBareMetalServerProfileOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerProfileOptions) SetHeaders(param map[string]string) *GetBareMetalServerProfileOptions { - options.Headers = param - return options -} - -// GetDedicatedHostDiskOptions : The GetDedicatedHostDisk options. -type GetDedicatedHostDiskOptions struct { - // The dedicated host identifier. - DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="` - - // The dedicated host disk identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetDedicatedHostDiskOptions : Instantiate GetDedicatedHostDiskOptions -func (*VpcV1) NewGetDedicatedHostDiskOptions(dedicatedHostID string, id string) *GetDedicatedHostDiskOptions { - return &GetDedicatedHostDiskOptions{ - DedicatedHostID: core.StringPtr(dedicatedHostID), - ID: core.StringPtr(id), - } -} - -// SetDedicatedHostID : Allow user to set DedicatedHostID -func (_options *GetDedicatedHostDiskOptions) SetDedicatedHostID(dedicatedHostID string) *GetDedicatedHostDiskOptions { - _options.DedicatedHostID = core.StringPtr(dedicatedHostID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetDedicatedHostDiskOptions) SetID(id string) *GetDedicatedHostDiskOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetDedicatedHostDiskOptions) SetHeaders(param map[string]string) *GetDedicatedHostDiskOptions { - options.Headers = param - return options -} - -// GetDedicatedHostGroupOptions : The GetDedicatedHostGroup options. -type GetDedicatedHostGroupOptions struct { - // The dedicated host group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetDedicatedHostGroupOptions : Instantiate GetDedicatedHostGroupOptions -func (*VpcV1) NewGetDedicatedHostGroupOptions(id string) *GetDedicatedHostGroupOptions { - return &GetDedicatedHostGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetDedicatedHostGroupOptions) SetID(id string) *GetDedicatedHostGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetDedicatedHostGroupOptions) SetHeaders(param map[string]string) *GetDedicatedHostGroupOptions { - options.Headers = param - return options -} - -// GetDedicatedHostOptions : The GetDedicatedHost options. -type GetDedicatedHostOptions struct { - // The dedicated host identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetDedicatedHostOptions : Instantiate GetDedicatedHostOptions -func (*VpcV1) NewGetDedicatedHostOptions(id string) *GetDedicatedHostOptions { - return &GetDedicatedHostOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetDedicatedHostOptions) SetID(id string) *GetDedicatedHostOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetDedicatedHostOptions) SetHeaders(param map[string]string) *GetDedicatedHostOptions { - options.Headers = param - return options -} - -// GetDedicatedHostProfileOptions : The GetDedicatedHostProfile options. -type GetDedicatedHostProfileOptions struct { - // The dedicated host profile name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetDedicatedHostProfileOptions : Instantiate GetDedicatedHostProfileOptions -func (*VpcV1) NewGetDedicatedHostProfileOptions(name string) *GetDedicatedHostProfileOptions { - return &GetDedicatedHostProfileOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetDedicatedHostProfileOptions) SetName(name string) *GetDedicatedHostProfileOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetDedicatedHostProfileOptions) SetHeaders(param map[string]string) *GetDedicatedHostProfileOptions { - options.Headers = param - return options -} - -// GetEndpointGatewayIPOptions : The GetEndpointGatewayIP options. -type GetEndpointGatewayIPOptions 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 -} - -// NewGetEndpointGatewayIPOptions : Instantiate GetEndpointGatewayIPOptions -func (*VpcV1) NewGetEndpointGatewayIPOptions(endpointGatewayID string, id string) *GetEndpointGatewayIPOptions { - return &GetEndpointGatewayIPOptions{ - EndpointGatewayID: core.StringPtr(endpointGatewayID), - ID: core.StringPtr(id), - } -} - -// SetEndpointGatewayID : Allow user to set EndpointGatewayID -func (_options *GetEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *GetEndpointGatewayIPOptions { - _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetEndpointGatewayIPOptions) SetID(id string) *GetEndpointGatewayIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetEndpointGatewayIPOptions) SetHeaders(param map[string]string) *GetEndpointGatewayIPOptions { - options.Headers = param - return options -} - -// GetEndpointGatewayOptions : The GetEndpointGateway options. -type GetEndpointGatewayOptions struct { - // The endpoint gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetEndpointGatewayOptions : Instantiate GetEndpointGatewayOptions -func (*VpcV1) NewGetEndpointGatewayOptions(id string) *GetEndpointGatewayOptions { - return &GetEndpointGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetEndpointGatewayOptions) SetID(id string) *GetEndpointGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetEndpointGatewayOptions) SetHeaders(param map[string]string) *GetEndpointGatewayOptions { - options.Headers = param - return options -} - -// GetFloatingIPOptions : The GetFloatingIP options. -type GetFloatingIPOptions struct { - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetFloatingIPOptions : Instantiate GetFloatingIPOptions -func (*VpcV1) NewGetFloatingIPOptions(id string) *GetFloatingIPOptions { - return &GetFloatingIPOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetFloatingIPOptions) SetID(id string) *GetFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetFloatingIPOptions) SetHeaders(param map[string]string) *GetFloatingIPOptions { - options.Headers = param - return options -} - -// GetFlowLogCollectorOptions : The GetFlowLogCollector options. -type GetFlowLogCollectorOptions struct { - // The flow log collector identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetFlowLogCollectorOptions : Instantiate GetFlowLogCollectorOptions -func (*VpcV1) NewGetFlowLogCollectorOptions(id string) *GetFlowLogCollectorOptions { - return &GetFlowLogCollectorOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetFlowLogCollectorOptions) SetID(id string) *GetFlowLogCollectorOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetFlowLogCollectorOptions) SetHeaders(param map[string]string) *GetFlowLogCollectorOptions { - options.Headers = param - return options -} - -// GetIkePolicyOptions : The GetIkePolicy options. -type GetIkePolicyOptions struct { - // The IKE policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetIkePolicyOptions : Instantiate GetIkePolicyOptions -func (*VpcV1) NewGetIkePolicyOptions(id string) *GetIkePolicyOptions { - return &GetIkePolicyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetIkePolicyOptions) SetID(id string) *GetIkePolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetIkePolicyOptions) SetHeaders(param map[string]string) *GetIkePolicyOptions { - options.Headers = param - return options -} - -// GetImageExportJobOptions : The GetImageExportJob options. -type GetImageExportJobOptions struct { - // The image identifier. - ImageID *string `json:"image_id" validate:"required,ne="` - - // The image export job identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetImageExportJobOptions : Instantiate GetImageExportJobOptions -func (*VpcV1) NewGetImageExportJobOptions(imageID string, id string) *GetImageExportJobOptions { - return &GetImageExportJobOptions{ - ImageID: core.StringPtr(imageID), - ID: core.StringPtr(id), - } -} - -// SetImageID : Allow user to set ImageID -func (_options *GetImageExportJobOptions) SetImageID(imageID string) *GetImageExportJobOptions { - _options.ImageID = core.StringPtr(imageID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetImageExportJobOptions) SetID(id string) *GetImageExportJobOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetImageExportJobOptions) SetHeaders(param map[string]string) *GetImageExportJobOptions { - options.Headers = param - return options -} - -// GetImageOptions : The GetImage options. -type GetImageOptions struct { - // The image identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetImageOptions : Instantiate GetImageOptions -func (*VpcV1) NewGetImageOptions(id string) *GetImageOptions { - return &GetImageOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetImageOptions) SetID(id string) *GetImageOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetImageOptions) SetHeaders(param map[string]string) *GetImageOptions { - options.Headers = param - return options -} - -// GetInstanceDiskOptions : The GetInstanceDisk options. -type GetInstanceDiskOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance disk identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceDiskOptions : Instantiate GetInstanceDiskOptions -func (*VpcV1) NewGetInstanceDiskOptions(instanceID string, id string) *GetInstanceDiskOptions { - return &GetInstanceDiskOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *GetInstanceDiskOptions) SetInstanceID(instanceID string) *GetInstanceDiskOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceDiskOptions) SetID(id string) *GetInstanceDiskOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceDiskOptions) SetHeaders(param map[string]string) *GetInstanceDiskOptions { - options.Headers = param - return options -} - -// GetInstanceGroupManagerActionOptions : The GetInstanceGroupManagerAction options. -type GetInstanceGroupManagerActionOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // The instance group manager action identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceGroupManagerActionOptions : Instantiate GetInstanceGroupManagerActionOptions -func (*VpcV1) NewGetInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string) *GetInstanceGroupManagerActionOptions { - return &GetInstanceGroupManagerActionOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *GetInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerActionOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *GetInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *GetInstanceGroupManagerActionOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceGroupManagerActionOptions) SetID(id string) *GetInstanceGroupManagerActionOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerActionOptions { - options.Headers = param - return options -} - -// GetInstanceGroupManagerOptions : The GetInstanceGroupManager options. -type GetInstanceGroupManagerOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceGroupManagerOptions : Instantiate GetInstanceGroupManagerOptions -func (*VpcV1) NewGetInstanceGroupManagerOptions(instanceGroupID string, id string) *GetInstanceGroupManagerOptions { - return &GetInstanceGroupManagerOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *GetInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceGroupManagerOptions) SetID(id string) *GetInstanceGroupManagerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceGroupManagerOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerOptions { - options.Headers = param - return options -} - -// GetInstanceGroupManagerPolicyOptions : The GetInstanceGroupManagerPolicy options. -type GetInstanceGroupManagerPolicyOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // The instance group manager policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceGroupManagerPolicyOptions : Instantiate GetInstanceGroupManagerPolicyOptions -func (*VpcV1) NewGetInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string) *GetInstanceGroupManagerPolicyOptions { - return &GetInstanceGroupManagerPolicyOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *GetInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerPolicyOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *GetInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *GetInstanceGroupManagerPolicyOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceGroupManagerPolicyOptions) SetID(id string) *GetInstanceGroupManagerPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerPolicyOptions { - options.Headers = param - return options -} - -// GetInstanceGroupMembershipOptions : The GetInstanceGroupMembership options. -type GetInstanceGroupMembershipOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group membership identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceGroupMembershipOptions : Instantiate GetInstanceGroupMembershipOptions -func (*VpcV1) NewGetInstanceGroupMembershipOptions(instanceGroupID string, id string) *GetInstanceGroupMembershipOptions { - return &GetInstanceGroupMembershipOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - ID: core.StringPtr(id), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *GetInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupMembershipOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceGroupMembershipOptions) SetID(id string) *GetInstanceGroupMembershipOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *GetInstanceGroupMembershipOptions { - options.Headers = param - return options -} - -// GetInstanceGroupOptions : The GetInstanceGroup options. -type GetInstanceGroupOptions struct { - // The instance group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceGroupOptions : Instantiate GetInstanceGroupOptions -func (*VpcV1) NewGetInstanceGroupOptions(id string) *GetInstanceGroupOptions { - return &GetInstanceGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetInstanceGroupOptions) SetID(id string) *GetInstanceGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceGroupOptions) SetHeaders(param map[string]string) *GetInstanceGroupOptions { - options.Headers = param - return options -} - -// GetInstanceInitializationOptions : The GetInstanceInitialization options. -type GetInstanceInitializationOptions struct { - // The instance identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceInitializationOptions : Instantiate GetInstanceInitializationOptions -func (*VpcV1) NewGetInstanceInitializationOptions(id string) *GetInstanceInitializationOptions { - return &GetInstanceInitializationOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetInstanceInitializationOptions) SetID(id string) *GetInstanceInitializationOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceInitializationOptions) SetHeaders(param map[string]string) *GetInstanceInitializationOptions { - options.Headers = param - return options -} - -// GetInstanceNetworkAttachmentOptions : The GetInstanceNetworkAttachment options. -type GetInstanceNetworkAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceNetworkAttachmentOptions : Instantiate GetInstanceNetworkAttachmentOptions -func (*VpcV1) NewGetInstanceNetworkAttachmentOptions(instanceID string, id string) *GetInstanceNetworkAttachmentOptions { - return &GetInstanceNetworkAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *GetInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceNetworkAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceNetworkAttachmentOptions) SetID(id string) *GetInstanceNetworkAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceNetworkAttachmentOptions { - options.Headers = param - return options -} - -// GetInstanceNetworkInterfaceFloatingIPOptions : The GetInstanceNetworkInterfaceFloatingIP options. -type GetInstanceNetworkInterfaceFloatingIPOptions 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 -} - -// NewGetInstanceNetworkInterfaceFloatingIPOptions : Instantiate GetInstanceNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewGetInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *GetInstanceNetworkInterfaceFloatingIPOptions { - return &GetInstanceNetworkInterfaceFloatingIPOptions{ - InstanceID: core.StringPtr(instanceID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *GetInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceFloatingIPOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *GetInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetInstanceNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *GetInstanceNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} - -// GetInstanceNetworkInterfaceIPOptions : The GetInstanceNetworkInterfaceIP options. -type GetInstanceNetworkInterfaceIPOptions 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 reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceNetworkInterfaceIPOptions : Instantiate GetInstanceNetworkInterfaceIPOptions -func (*VpcV1) NewGetInstanceNetworkInterfaceIPOptions(instanceID string, networkInterfaceID string, id string) *GetInstanceNetworkInterfaceIPOptions { - return &GetInstanceNetworkInterfaceIPOptions{ - InstanceID: core.StringPtr(instanceID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *GetInstanceNetworkInterfaceIPOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceIPOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *GetInstanceNetworkInterfaceIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetInstanceNetworkInterfaceIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceNetworkInterfaceIPOptions) SetID(id string) *GetInstanceNetworkInterfaceIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceIPOptions { - options.Headers = param - return options -} - -// GetInstanceNetworkInterfaceOptions : The GetInstanceNetworkInterface options. -type GetInstanceNetworkInterfaceOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceNetworkInterfaceOptions : Instantiate GetInstanceNetworkInterfaceOptions -func (*VpcV1) NewGetInstanceNetworkInterfaceOptions(instanceID string, id string) *GetInstanceNetworkInterfaceOptions { - return &GetInstanceNetworkInterfaceOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *GetInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceNetworkInterfaceOptions) SetID(id string) *GetInstanceNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceOptions { - options.Headers = param - return options -} - -// GetInstanceOptions : The GetInstance options. -type GetInstanceOptions struct { - // The virtual server instance identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceOptions : Instantiate GetInstanceOptions -func (*VpcV1) NewGetInstanceOptions(id string) *GetInstanceOptions { - return &GetInstanceOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetInstanceOptions) SetID(id string) *GetInstanceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceOptions) SetHeaders(param map[string]string) *GetInstanceOptions { - options.Headers = param - return options -} - -// GetInstanceProfileOptions : The GetInstanceProfile options. -type GetInstanceProfileOptions struct { - // The instance profile name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceProfileOptions : Instantiate GetInstanceProfileOptions -func (*VpcV1) NewGetInstanceProfileOptions(name string) *GetInstanceProfileOptions { - return &GetInstanceProfileOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetInstanceProfileOptions) SetName(name string) *GetInstanceProfileOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceProfileOptions) SetHeaders(param map[string]string) *GetInstanceProfileOptions { - options.Headers = param - return options -} - -// GetInstanceTemplateOptions : The GetInstanceTemplate options. -type GetInstanceTemplateOptions struct { - // The instance template identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceTemplateOptions : Instantiate GetInstanceTemplateOptions -func (*VpcV1) NewGetInstanceTemplateOptions(id string) *GetInstanceTemplateOptions { - return &GetInstanceTemplateOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetInstanceTemplateOptions) SetID(id string) *GetInstanceTemplateOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceTemplateOptions) SetHeaders(param map[string]string) *GetInstanceTemplateOptions { - options.Headers = param - return options -} - -// GetInstanceVolumeAttachmentOptions : The GetInstanceVolumeAttachment options. -type GetInstanceVolumeAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The volume attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetInstanceVolumeAttachmentOptions : Instantiate GetInstanceVolumeAttachmentOptions -func (*VpcV1) NewGetInstanceVolumeAttachmentOptions(instanceID string, id string) *GetInstanceVolumeAttachmentOptions { - return &GetInstanceVolumeAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *GetInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceVolumeAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetInstanceVolumeAttachmentOptions) SetID(id string) *GetInstanceVolumeAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceVolumeAttachmentOptions { - options.Headers = param - return options -} - -// GetIpsecPolicyOptions : The GetIpsecPolicy options. -type GetIpsecPolicyOptions struct { - // The IPsec policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetIpsecPolicyOptions : Instantiate GetIpsecPolicyOptions -func (*VpcV1) NewGetIpsecPolicyOptions(id string) *GetIpsecPolicyOptions { - return &GetIpsecPolicyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetIpsecPolicyOptions) SetID(id string) *GetIpsecPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetIpsecPolicyOptions) SetHeaders(param map[string]string) *GetIpsecPolicyOptions { - options.Headers = param - return options -} - -// GetKeyOptions : The GetKey options. -type GetKeyOptions struct { - // The key identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetKeyOptions : Instantiate GetKeyOptions -func (*VpcV1) NewGetKeyOptions(id string) *GetKeyOptions { - return &GetKeyOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetKeyOptions) SetID(id string) *GetKeyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetKeyOptions) SetHeaders(param map[string]string) *GetKeyOptions { - options.Headers = param - return options -} - -// GetLoadBalancerListenerOptions : The GetLoadBalancerListener options. -type GetLoadBalancerListenerOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerListenerOptions : Instantiate GetLoadBalancerListenerOptions -func (*VpcV1) NewGetLoadBalancerListenerOptions(loadBalancerID string, id string) *GetLoadBalancerListenerOptions { - return &GetLoadBalancerListenerOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *GetLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetLoadBalancerListenerOptions) SetID(id string) *GetLoadBalancerListenerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerListenerOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerOptions { - options.Headers = param - return options -} - -// GetLoadBalancerListenerPolicyOptions : The GetLoadBalancerListenerPolicy options. -type GetLoadBalancerListenerPolicyOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerListenerPolicyOptions : Instantiate GetLoadBalancerListenerPolicyOptions -func (*VpcV1) NewGetLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string) *GetLoadBalancerListenerPolicyOptions { - return &GetLoadBalancerListenerPolicyOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *GetLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerPolicyOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *GetLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *GetLoadBalancerListenerPolicyOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetLoadBalancerListenerPolicyOptions) SetID(id string) *GetLoadBalancerListenerPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerPolicyOptions { - options.Headers = param - return options -} - -// GetLoadBalancerListenerPolicyRuleOptions : The GetLoadBalancerListenerPolicyRule options. -type GetLoadBalancerListenerPolicyRuleOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - PolicyID *string `json:"policy_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerListenerPolicyRuleOptions : Instantiate GetLoadBalancerListenerPolicyRuleOptions -func (*VpcV1) NewGetLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string) *GetLoadBalancerListenerPolicyRuleOptions { - return &GetLoadBalancerListenerPolicyRuleOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - PolicyID: core.StringPtr(policyID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerPolicyRuleOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *GetLoadBalancerListenerPolicyRuleOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetPolicyID : Allow user to set PolicyID -func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *GetLoadBalancerListenerPolicyRuleOptions { - _options.PolicyID = core.StringPtr(policyID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetLoadBalancerListenerPolicyRuleOptions) SetID(id string) *GetLoadBalancerListenerPolicyRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerPolicyRuleOptions { - options.Headers = param - return options -} - -// GetLoadBalancerOptions : The GetLoadBalancer options. -type GetLoadBalancerOptions struct { - // The load balancer identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerOptions : Instantiate GetLoadBalancerOptions -func (*VpcV1) NewGetLoadBalancerOptions(id string) *GetLoadBalancerOptions { - return &GetLoadBalancerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetLoadBalancerOptions) SetID(id string) *GetLoadBalancerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerOptions) SetHeaders(param map[string]string) *GetLoadBalancerOptions { - options.Headers = param - return options -} - -// GetLoadBalancerPoolMemberOptions : The GetLoadBalancerPoolMember options. -type GetLoadBalancerPoolMemberOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - PoolID *string `json:"pool_id" validate:"required,ne="` - - // The member identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerPoolMemberOptions : Instantiate GetLoadBalancerPoolMemberOptions -func (*VpcV1) NewGetLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string) *GetLoadBalancerPoolMemberOptions { - return &GetLoadBalancerPoolMemberOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - PoolID: core.StringPtr(poolID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *GetLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerPoolMemberOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetPoolID : Allow user to set PoolID -func (_options *GetLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *GetLoadBalancerPoolMemberOptions { - _options.PoolID = core.StringPtr(poolID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetLoadBalancerPoolMemberOptions) SetID(id string) *GetLoadBalancerPoolMemberOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *GetLoadBalancerPoolMemberOptions { - options.Headers = param - return options -} - -// GetLoadBalancerPoolOptions : The GetLoadBalancerPool options. -type GetLoadBalancerPoolOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerPoolOptions : Instantiate GetLoadBalancerPoolOptions -func (*VpcV1) NewGetLoadBalancerPoolOptions(loadBalancerID string, id string) *GetLoadBalancerPoolOptions { - return &GetLoadBalancerPoolOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ID: core.StringPtr(id), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *GetLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerPoolOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetLoadBalancerPoolOptions) SetID(id string) *GetLoadBalancerPoolOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerPoolOptions) SetHeaders(param map[string]string) *GetLoadBalancerPoolOptions { - options.Headers = param - return options -} - -// GetLoadBalancerProfileOptions : The GetLoadBalancerProfile options. -type GetLoadBalancerProfileOptions struct { - // The load balancer profile name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerProfileOptions : Instantiate GetLoadBalancerProfileOptions -func (*VpcV1) NewGetLoadBalancerProfileOptions(name string) *GetLoadBalancerProfileOptions { - return &GetLoadBalancerProfileOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetLoadBalancerProfileOptions) SetName(name string) *GetLoadBalancerProfileOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerProfileOptions) SetHeaders(param map[string]string) *GetLoadBalancerProfileOptions { - options.Headers = param - return options -} - -// GetLoadBalancerStatisticsOptions : The GetLoadBalancerStatistics options. -type GetLoadBalancerStatisticsOptions struct { - // The load balancer identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetLoadBalancerStatisticsOptions : Instantiate GetLoadBalancerStatisticsOptions -func (*VpcV1) NewGetLoadBalancerStatisticsOptions(id string) *GetLoadBalancerStatisticsOptions { - return &GetLoadBalancerStatisticsOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetLoadBalancerStatisticsOptions) SetID(id string) *GetLoadBalancerStatisticsOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetLoadBalancerStatisticsOptions) SetHeaders(param map[string]string) *GetLoadBalancerStatisticsOptions { - options.Headers = param - return options -} - -// GetNetworkACLOptions : The GetNetworkACL options. -type GetNetworkACLOptions struct { - // The network ACL identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetNetworkACLOptions : Instantiate GetNetworkACLOptions -func (*VpcV1) NewGetNetworkACLOptions(id string) *GetNetworkACLOptions { - return &GetNetworkACLOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetNetworkACLOptions) SetID(id string) *GetNetworkACLOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetNetworkACLOptions) SetHeaders(param map[string]string) *GetNetworkACLOptions { - options.Headers = param - return options -} - -// GetNetworkACLRuleOptions : The GetNetworkACLRule options. -type GetNetworkACLRuleOptions struct { - // The network ACL identifier. - NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetNetworkACLRuleOptions : Instantiate GetNetworkACLRuleOptions -func (*VpcV1) NewGetNetworkACLRuleOptions(networkACLID string, id string) *GetNetworkACLRuleOptions { - return &GetNetworkACLRuleOptions{ - NetworkACLID: core.StringPtr(networkACLID), - ID: core.StringPtr(id), - } -} - -// SetNetworkACLID : Allow user to set NetworkACLID -func (_options *GetNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *GetNetworkACLRuleOptions { - _options.NetworkACLID = core.StringPtr(networkACLID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetNetworkACLRuleOptions) SetID(id string) *GetNetworkACLRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetNetworkACLRuleOptions) SetHeaders(param map[string]string) *GetNetworkACLRuleOptions { - options.Headers = param - return options -} - -// GetNetworkInterfaceFloatingIPOptions : The GetNetworkInterfaceFloatingIP options. -type GetNetworkInterfaceFloatingIPOptions 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 -} - -// NewGetNetworkInterfaceFloatingIPOptions : Instantiate GetNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewGetNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *GetNetworkInterfaceFloatingIPOptions { - return &GetNetworkInterfaceFloatingIPOptions{ - VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID -func (_options *GetNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *GetNetworkInterfaceFloatingIPOptions { - _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetNetworkInterfaceFloatingIPOptions) SetID(id string) *GetNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} - -// GetOperatingSystemOptions : The GetOperatingSystem options. -type GetOperatingSystemOptions struct { - // The operating system name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetOperatingSystemOptions : Instantiate GetOperatingSystemOptions -func (*VpcV1) NewGetOperatingSystemOptions(name string) *GetOperatingSystemOptions { - return &GetOperatingSystemOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetOperatingSystemOptions) SetName(name string) *GetOperatingSystemOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetOperatingSystemOptions) SetHeaders(param map[string]string) *GetOperatingSystemOptions { - options.Headers = param - return options -} - -// GetPlacementGroupOptions : The GetPlacementGroup options. -type GetPlacementGroupOptions struct { - // The placement group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetPlacementGroupOptions : Instantiate GetPlacementGroupOptions -func (*VpcV1) NewGetPlacementGroupOptions(id string) *GetPlacementGroupOptions { - return &GetPlacementGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetPlacementGroupOptions) SetID(id string) *GetPlacementGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetPlacementGroupOptions) SetHeaders(param map[string]string) *GetPlacementGroupOptions { - options.Headers = param - return options -} - -// GetPublicGatewayOptions : The GetPublicGateway options. -type GetPublicGatewayOptions struct { - // The public gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetPublicGatewayOptions : Instantiate GetPublicGatewayOptions -func (*VpcV1) NewGetPublicGatewayOptions(id string) *GetPublicGatewayOptions { - return &GetPublicGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetPublicGatewayOptions) SetID(id string) *GetPublicGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetPublicGatewayOptions) SetHeaders(param map[string]string) *GetPublicGatewayOptions { - options.Headers = param - return options -} - -// GetRegionOptions : The GetRegion options. -type GetRegionOptions struct { - // The region name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetRegionOptions : Instantiate GetRegionOptions -func (*VpcV1) NewGetRegionOptions(name string) *GetRegionOptions { - return &GetRegionOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetRegionOptions) SetName(name string) *GetRegionOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetRegionOptions) SetHeaders(param map[string]string) *GetRegionOptions { - options.Headers = param - return options -} - -// GetRegionZoneOptions : The GetRegionZone options. -type GetRegionZoneOptions struct { - // The region name. - RegionName *string `json:"region_name" validate:"required,ne="` - - // The zone name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetRegionZoneOptions : Instantiate GetRegionZoneOptions -func (*VpcV1) NewGetRegionZoneOptions(regionName string, name string) *GetRegionZoneOptions { - return &GetRegionZoneOptions{ - RegionName: core.StringPtr(regionName), - Name: core.StringPtr(name), - } -} - -// SetRegionName : Allow user to set RegionName -func (_options *GetRegionZoneOptions) SetRegionName(regionName string) *GetRegionZoneOptions { - _options.RegionName = core.StringPtr(regionName) - return _options -} - -// SetName : Allow user to set Name -func (_options *GetRegionZoneOptions) SetName(name string) *GetRegionZoneOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetRegionZoneOptions) SetHeaders(param map[string]string) *GetRegionZoneOptions { - options.Headers = param - return options -} - -// GetReservationOptions : The GetReservation options. -type GetReservationOptions struct { - // The reservation identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetReservationOptions : Instantiate GetReservationOptions -func (*VpcV1) NewGetReservationOptions(id string) *GetReservationOptions { - return &GetReservationOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetReservationOptions) SetID(id string) *GetReservationOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetReservationOptions) SetHeaders(param map[string]string) *GetReservationOptions { - options.Headers = param - return options -} - -// GetSecurityGroupOptions : The GetSecurityGroup options. -type GetSecurityGroupOptions struct { - // The security group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSecurityGroupOptions : Instantiate GetSecurityGroupOptions -func (*VpcV1) NewGetSecurityGroupOptions(id string) *GetSecurityGroupOptions { - return &GetSecurityGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetSecurityGroupOptions) SetID(id string) *GetSecurityGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSecurityGroupOptions) SetHeaders(param map[string]string) *GetSecurityGroupOptions { - options.Headers = param - return options -} - -// GetSecurityGroupRuleOptions : The GetSecurityGroupRule options. -type GetSecurityGroupRuleOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSecurityGroupRuleOptions : Instantiate GetSecurityGroupRuleOptions -func (*VpcV1) NewGetSecurityGroupRuleOptions(securityGroupID string, id string) *GetSecurityGroupRuleOptions { - return &GetSecurityGroupRuleOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - ID: core.StringPtr(id), - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *GetSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *GetSecurityGroupRuleOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetSecurityGroupRuleOptions) SetID(id string) *GetSecurityGroupRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSecurityGroupRuleOptions) SetHeaders(param map[string]string) *GetSecurityGroupRuleOptions { - options.Headers = param - return options -} - -// GetSecurityGroupTargetOptions : The GetSecurityGroupTarget options. -type GetSecurityGroupTargetOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // The security group target identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSecurityGroupTargetOptions : Instantiate GetSecurityGroupTargetOptions -func (*VpcV1) NewGetSecurityGroupTargetOptions(securityGroupID string, id string) *GetSecurityGroupTargetOptions { - return &GetSecurityGroupTargetOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - ID: core.StringPtr(id), - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *GetSecurityGroupTargetOptions) SetSecurityGroupID(securityGroupID string) *GetSecurityGroupTargetOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetSecurityGroupTargetOptions) SetID(id string) *GetSecurityGroupTargetOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSecurityGroupTargetOptions) SetHeaders(param map[string]string) *GetSecurityGroupTargetOptions { - options.Headers = param - return options -} - -// GetShareMountTargetOptions : The GetShareMountTarget options. -type GetShareMountTargetOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // The share mount target identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetShareMountTargetOptions : Instantiate GetShareMountTargetOptions -func (*VpcV1) NewGetShareMountTargetOptions(shareID string, id string) *GetShareMountTargetOptions { - return &GetShareMountTargetOptions{ - ShareID: core.StringPtr(shareID), - ID: core.StringPtr(id), - } -} - -// SetShareID : Allow user to set ShareID -func (_options *GetShareMountTargetOptions) SetShareID(shareID string) *GetShareMountTargetOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetShareMountTargetOptions) SetID(id string) *GetShareMountTargetOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetShareMountTargetOptions) SetHeaders(param map[string]string) *GetShareMountTargetOptions { - options.Headers = param - return options -} - -// GetShareOptions : The GetShare options. -type GetShareOptions struct { - // The file share identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetShareOptions : Instantiate GetShareOptions -func (*VpcV1) NewGetShareOptions(id string) *GetShareOptions { - return &GetShareOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetShareOptions) SetID(id string) *GetShareOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetShareOptions) SetHeaders(param map[string]string) *GetShareOptions { - options.Headers = param - return options -} - -// GetShareProfileOptions : The GetShareProfile options. -type GetShareProfileOptions struct { - // The file share profile name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetShareProfileOptions : Instantiate GetShareProfileOptions -func (*VpcV1) NewGetShareProfileOptions(name string) *GetShareProfileOptions { - return &GetShareProfileOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetShareProfileOptions) SetName(name string) *GetShareProfileOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetShareProfileOptions) SetHeaders(param map[string]string) *GetShareProfileOptions { - options.Headers = param - return options -} - -// GetShareSourceOptions : The GetShareSource options. -type GetShareSourceOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetShareSourceOptions : Instantiate GetShareSourceOptions -func (*VpcV1) NewGetShareSourceOptions(shareID string) *GetShareSourceOptions { - return &GetShareSourceOptions{ - ShareID: core.StringPtr(shareID), - } -} - -// SetShareID : Allow user to set ShareID -func (_options *GetShareSourceOptions) SetShareID(shareID string) *GetShareSourceOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetShareSourceOptions) SetHeaders(param map[string]string) *GetShareSourceOptions { - options.Headers = param - return options -} - -// GetSnapshotCloneOptions : The GetSnapshotClone options. -type GetSnapshotCloneOptions struct { - // The snapshot identifier. - ID *string `json:"id" validate:"required,ne="` - - // The zone name. - ZoneName *string `json:"zone_name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSnapshotCloneOptions : Instantiate GetSnapshotCloneOptions -func (*VpcV1) NewGetSnapshotCloneOptions(id string, zoneName string) *GetSnapshotCloneOptions { - return &GetSnapshotCloneOptions{ - ID: core.StringPtr(id), - ZoneName: core.StringPtr(zoneName), - } -} - -// SetID : Allow user to set ID -func (_options *GetSnapshotCloneOptions) SetID(id string) *GetSnapshotCloneOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *GetSnapshotCloneOptions) SetZoneName(zoneName string) *GetSnapshotCloneOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSnapshotCloneOptions) SetHeaders(param map[string]string) *GetSnapshotCloneOptions { - options.Headers = param - return options -} - -// GetSnapshotConsistencyGroupOptions : The GetSnapshotConsistencyGroup options. -type GetSnapshotConsistencyGroupOptions struct { - // The snapshot consistency group identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSnapshotConsistencyGroupOptions : Instantiate GetSnapshotConsistencyGroupOptions -func (*VpcV1) NewGetSnapshotConsistencyGroupOptions(id string) *GetSnapshotConsistencyGroupOptions { - return &GetSnapshotConsistencyGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetSnapshotConsistencyGroupOptions) SetID(id string) *GetSnapshotConsistencyGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *GetSnapshotConsistencyGroupOptions { - options.Headers = param - return options -} - -// GetSnapshotOptions : The GetSnapshot options. -type GetSnapshotOptions struct { - // The snapshot identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSnapshotOptions : Instantiate GetSnapshotOptions -func (*VpcV1) NewGetSnapshotOptions(id string) *GetSnapshotOptions { - return &GetSnapshotOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetSnapshotOptions) SetID(id string) *GetSnapshotOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSnapshotOptions) SetHeaders(param map[string]string) *GetSnapshotOptions { - options.Headers = param - return options -} - -// GetSubnetNetworkACLOptions : The GetSubnetNetworkACL options. -type GetSubnetNetworkACLOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSubnetNetworkACLOptions : Instantiate GetSubnetNetworkACLOptions -func (*VpcV1) NewGetSubnetNetworkACLOptions(id string) *GetSubnetNetworkACLOptions { - return &GetSubnetNetworkACLOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetSubnetNetworkACLOptions) SetID(id string) *GetSubnetNetworkACLOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSubnetNetworkACLOptions) SetHeaders(param map[string]string) *GetSubnetNetworkACLOptions { - options.Headers = param - return options -} - -// GetSubnetOptions : The GetSubnet options. -type GetSubnetOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSubnetOptions : Instantiate GetSubnetOptions -func (*VpcV1) NewGetSubnetOptions(id string) *GetSubnetOptions { - return &GetSubnetOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetSubnetOptions) SetID(id string) *GetSubnetOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSubnetOptions) SetHeaders(param map[string]string) *GetSubnetOptions { - options.Headers = param - return options -} - -// GetSubnetPublicGatewayOptions : The GetSubnetPublicGateway options. -type GetSubnetPublicGatewayOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSubnetPublicGatewayOptions : Instantiate GetSubnetPublicGatewayOptions -func (*VpcV1) NewGetSubnetPublicGatewayOptions(id string) *GetSubnetPublicGatewayOptions { - return &GetSubnetPublicGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetSubnetPublicGatewayOptions) SetID(id string) *GetSubnetPublicGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *GetSubnetPublicGatewayOptions { - options.Headers = param - return options -} - -// GetSubnetReservedIPOptions : The GetSubnetReservedIP options. -type GetSubnetReservedIPOptions struct { - // The subnet identifier. - SubnetID *string `json:"subnet_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 -} - -// NewGetSubnetReservedIPOptions : Instantiate GetSubnetReservedIPOptions -func (*VpcV1) NewGetSubnetReservedIPOptions(subnetID string, id string) *GetSubnetReservedIPOptions { - return &GetSubnetReservedIPOptions{ - SubnetID: core.StringPtr(subnetID), - ID: core.StringPtr(id), - } -} - -// SetSubnetID : Allow user to set SubnetID -func (_options *GetSubnetReservedIPOptions) SetSubnetID(subnetID string) *GetSubnetReservedIPOptions { - _options.SubnetID = core.StringPtr(subnetID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetSubnetReservedIPOptions) SetID(id string) *GetSubnetReservedIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSubnetReservedIPOptions) SetHeaders(param map[string]string) *GetSubnetReservedIPOptions { - options.Headers = param - return options -} - -// GetSubnetRoutingTableOptions : The GetSubnetRoutingTable options. -type GetSubnetRoutingTableOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetSubnetRoutingTableOptions : Instantiate GetSubnetRoutingTableOptions -func (*VpcV1) NewGetSubnetRoutingTableOptions(id string) *GetSubnetRoutingTableOptions { - return &GetSubnetRoutingTableOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetSubnetRoutingTableOptions) SetID(id string) *GetSubnetRoutingTableOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetSubnetRoutingTableOptions) SetHeaders(param map[string]string) *GetSubnetRoutingTableOptions { - options.Headers = param - return options -} - -// GetVirtualNetworkInterfaceIPOptions : The GetVirtualNetworkInterfaceIP options. -type GetVirtualNetworkInterfaceIPOptions 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 -} - -// NewGetVirtualNetworkInterfaceIPOptions : Instantiate GetVirtualNetworkInterfaceIPOptions -func (*VpcV1) NewGetVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *GetVirtualNetworkInterfaceIPOptions { - return &GetVirtualNetworkInterfaceIPOptions{ - VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID -func (_options *GetVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *GetVirtualNetworkInterfaceIPOptions { - _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVirtualNetworkInterfaceIPOptions) SetID(id string) *GetVirtualNetworkInterfaceIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetVirtualNetworkInterfaceIPOptions { - options.Headers = param - return options -} - -// GetVirtualNetworkInterfaceOptions : The GetVirtualNetworkInterface options. -type GetVirtualNetworkInterfaceOptions struct { - // The virtual network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVirtualNetworkInterfaceOptions : Instantiate GetVirtualNetworkInterfaceOptions -func (*VpcV1) NewGetVirtualNetworkInterfaceOptions(id string) *GetVirtualNetworkInterfaceOptions { - return &GetVirtualNetworkInterfaceOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVirtualNetworkInterfaceOptions) SetID(id string) *GetVirtualNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetVirtualNetworkInterfaceOptions { - options.Headers = param - return options -} - -// GetVolumeOptions : The GetVolume options. -type GetVolumeOptions struct { - // The volume identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVolumeOptions : Instantiate GetVolumeOptions -func (*VpcV1) NewGetVolumeOptions(id string) *GetVolumeOptions { - return &GetVolumeOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVolumeOptions) SetID(id string) *GetVolumeOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVolumeOptions) SetHeaders(param map[string]string) *GetVolumeOptions { - options.Headers = param - return options -} - -// GetVolumeProfileOptions : The GetVolumeProfile options. -type GetVolumeProfileOptions struct { - // The volume profile name. - Name *string `json:"name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVolumeProfileOptions : Instantiate GetVolumeProfileOptions -func (*VpcV1) NewGetVolumeProfileOptions(name string) *GetVolumeProfileOptions { - return &GetVolumeProfileOptions{ - Name: core.StringPtr(name), - } -} - -// SetName : Allow user to set Name -func (_options *GetVolumeProfileOptions) SetName(name string) *GetVolumeProfileOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVolumeProfileOptions) SetHeaders(param map[string]string) *GetVolumeProfileOptions { - options.Headers = param - return options -} - -// GetVPCAddressPrefixOptions : The GetVPCAddressPrefix options. -type GetVPCAddressPrefixOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The prefix identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCAddressPrefixOptions : Instantiate GetVPCAddressPrefixOptions -func (*VpcV1) NewGetVPCAddressPrefixOptions(vpcID string, id string) *GetVPCAddressPrefixOptions { - return &GetVPCAddressPrefixOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *GetVPCAddressPrefixOptions) SetVPCID(vpcID string) *GetVPCAddressPrefixOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPCAddressPrefixOptions) SetID(id string) *GetVPCAddressPrefixOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCAddressPrefixOptions) SetHeaders(param map[string]string) *GetVPCAddressPrefixOptions { - options.Headers = param - return options -} - -// GetVPCDefaultNetworkACLOptions : The GetVPCDefaultNetworkACL options. -type GetVPCDefaultNetworkACLOptions struct { - // The VPC identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCDefaultNetworkACLOptions : Instantiate GetVPCDefaultNetworkACLOptions -func (*VpcV1) NewGetVPCDefaultNetworkACLOptions(id string) *GetVPCDefaultNetworkACLOptions { - return &GetVPCDefaultNetworkACLOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVPCDefaultNetworkACLOptions) SetID(id string) *GetVPCDefaultNetworkACLOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCDefaultNetworkACLOptions) SetHeaders(param map[string]string) *GetVPCDefaultNetworkACLOptions { - options.Headers = param - return options -} - -// GetVPCDefaultRoutingTableOptions : The GetVPCDefaultRoutingTable options. -type GetVPCDefaultRoutingTableOptions struct { - // The VPC identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCDefaultRoutingTableOptions : Instantiate GetVPCDefaultRoutingTableOptions -func (*VpcV1) NewGetVPCDefaultRoutingTableOptions(id string) *GetVPCDefaultRoutingTableOptions { - return &GetVPCDefaultRoutingTableOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVPCDefaultRoutingTableOptions) SetID(id string) *GetVPCDefaultRoutingTableOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCDefaultRoutingTableOptions) SetHeaders(param map[string]string) *GetVPCDefaultRoutingTableOptions { - options.Headers = param - return options -} - -// GetVPCDefaultSecurityGroupOptions : The GetVPCDefaultSecurityGroup options. -type GetVPCDefaultSecurityGroupOptions struct { - // The VPC identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCDefaultSecurityGroupOptions : Instantiate GetVPCDefaultSecurityGroupOptions -func (*VpcV1) NewGetVPCDefaultSecurityGroupOptions(id string) *GetVPCDefaultSecurityGroupOptions { - return &GetVPCDefaultSecurityGroupOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVPCDefaultSecurityGroupOptions) SetID(id string) *GetVPCDefaultSecurityGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCDefaultSecurityGroupOptions) SetHeaders(param map[string]string) *GetVPCDefaultSecurityGroupOptions { - options.Headers = param - return options -} - -// GetVPCDnsResolutionBindingOptions : The GetVPCDnsResolutionBinding options. -type GetVPCDnsResolutionBindingOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The DNS resolution binding identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCDnsResolutionBindingOptions : Instantiate GetVPCDnsResolutionBindingOptions -func (*VpcV1) NewGetVPCDnsResolutionBindingOptions(vpcID string, id string) *GetVPCDnsResolutionBindingOptions { - return &GetVPCDnsResolutionBindingOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *GetVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *GetVPCDnsResolutionBindingOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPCDnsResolutionBindingOptions) SetID(id string) *GetVPCDnsResolutionBindingOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *GetVPCDnsResolutionBindingOptions { - options.Headers = param - return options -} - -// GetVPCOptions : The GetVPC options. -type GetVPCOptions struct { - // The VPC identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCOptions : Instantiate GetVPCOptions -func (*VpcV1) NewGetVPCOptions(id string) *GetVPCOptions { - return &GetVPCOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVPCOptions) SetID(id string) *GetVPCOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCOptions) SetHeaders(param map[string]string) *GetVPCOptions { - options.Headers = param - return options -} - -// GetVPCRouteOptions : The GetVPCRoute options. -type GetVPCRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The route identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCRouteOptions : Instantiate GetVPCRouteOptions -func (*VpcV1) NewGetVPCRouteOptions(vpcID string, id string) *GetVPCRouteOptions { - return &GetVPCRouteOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *GetVPCRouteOptions) SetVPCID(vpcID string) *GetVPCRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPCRouteOptions) SetID(id string) *GetVPCRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCRouteOptions) SetHeaders(param map[string]string) *GetVPCRouteOptions { - options.Headers = param - return options -} - -// GetVPCRoutingTableOptions : The GetVPCRoutingTable options. -type GetVPCRoutingTableOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The routing table identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCRoutingTableOptions : Instantiate GetVPCRoutingTableOptions -func (*VpcV1) NewGetVPCRoutingTableOptions(vpcID string, id string) *GetVPCRoutingTableOptions { - return &GetVPCRoutingTableOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *GetVPCRoutingTableOptions) SetVPCID(vpcID string) *GetVPCRoutingTableOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPCRoutingTableOptions) SetID(id string) *GetVPCRoutingTableOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCRoutingTableOptions) SetHeaders(param map[string]string) *GetVPCRoutingTableOptions { - options.Headers = param - return options -} - -// GetVPCRoutingTableRouteOptions : The GetVPCRoutingTableRoute options. -type GetVPCRoutingTableRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The routing table identifier. - RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` - - // The VPC routing table route identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPCRoutingTableRouteOptions : Instantiate GetVPCRoutingTableRouteOptions -func (*VpcV1) NewGetVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string) *GetVPCRoutingTableRouteOptions { - return &GetVPCRoutingTableRouteOptions{ - VPCID: core.StringPtr(vpcID), - RoutingTableID: core.StringPtr(routingTableID), - ID: core.StringPtr(id), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *GetVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *GetVPCRoutingTableRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetRoutingTableID : Allow user to set RoutingTableID -func (_options *GetVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *GetVPCRoutingTableRouteOptions { - _options.RoutingTableID = core.StringPtr(routingTableID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPCRoutingTableRouteOptions) SetID(id string) *GetVPCRoutingTableRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *GetVPCRoutingTableRouteOptions { - options.Headers = param - return options -} - -// GetVPNGatewayConnectionOptions : The GetVPNGatewayConnection options. -type GetVPNGatewayConnectionOptions 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="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPNGatewayConnectionOptions : Instantiate GetVPNGatewayConnectionOptions -func (*VpcV1) NewGetVPNGatewayConnectionOptions(vpnGatewayID string, id string) *GetVPNGatewayConnectionOptions { - return &GetVPNGatewayConnectionOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *GetVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *GetVPNGatewayConnectionOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPNGatewayConnectionOptions) SetID(id string) *GetVPNGatewayConnectionOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *GetVPNGatewayConnectionOptions { - options.Headers = param - return options -} - -// GetVPNGatewayOptions : The GetVPNGateway options. -type GetVPNGatewayOptions struct { - // The VPN gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPNGatewayOptions : Instantiate GetVPNGatewayOptions -func (*VpcV1) NewGetVPNGatewayOptions(id string) *GetVPNGatewayOptions { - return &GetVPNGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVPNGatewayOptions) SetID(id string) *GetVPNGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPNGatewayOptions) SetHeaders(param map[string]string) *GetVPNGatewayOptions { - options.Headers = param - return options -} - -// GetVPNServerClientConfigurationOptions : The GetVPNServerClientConfiguration options. -type GetVPNServerClientConfigurationOptions struct { - // The VPN server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPNServerClientConfigurationOptions : Instantiate GetVPNServerClientConfigurationOptions -func (*VpcV1) NewGetVPNServerClientConfigurationOptions(id string) *GetVPNServerClientConfigurationOptions { - return &GetVPNServerClientConfigurationOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVPNServerClientConfigurationOptions) SetID(id string) *GetVPNServerClientConfigurationOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPNServerClientConfigurationOptions) SetHeaders(param map[string]string) *GetVPNServerClientConfigurationOptions { - options.Headers = param - return options -} - -// GetVPNServerClientOptions : The GetVPNServerClient options. -type GetVPNServerClientOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // The VPN client identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPNServerClientOptions : Instantiate GetVPNServerClientOptions -func (*VpcV1) NewGetVPNServerClientOptions(vpnServerID string, id string) *GetVPNServerClientOptions { - return &GetVPNServerClientOptions{ - VPNServerID: core.StringPtr(vpnServerID), - ID: core.StringPtr(id), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *GetVPNServerClientOptions) SetVPNServerID(vpnServerID string) *GetVPNServerClientOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPNServerClientOptions) SetID(id string) *GetVPNServerClientOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPNServerClientOptions) SetHeaders(param map[string]string) *GetVPNServerClientOptions { - options.Headers = param - return options -} - -// GetVPNServerOptions : The GetVPNServer options. -type GetVPNServerOptions struct { - // The VPN server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPNServerOptions : Instantiate GetVPNServerOptions -func (*VpcV1) NewGetVPNServerOptions(id string) *GetVPNServerOptions { - return &GetVPNServerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *GetVPNServerOptions) SetID(id string) *GetVPNServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPNServerOptions) SetHeaders(param map[string]string) *GetVPNServerOptions { - options.Headers = param - return options -} - -// GetVPNServerRouteOptions : The GetVPNServerRoute options. -type GetVPNServerRouteOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // The VPN route identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPNServerRouteOptions : Instantiate GetVPNServerRouteOptions -func (*VpcV1) NewGetVPNServerRouteOptions(vpnServerID string, id string) *GetVPNServerRouteOptions { - return &GetVPNServerRouteOptions{ - VPNServerID: core.StringPtr(vpnServerID), - ID: core.StringPtr(id), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *GetVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *GetVPNServerRouteOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPNServerRouteOptions) SetID(id string) *GetVPNServerRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPNServerRouteOptions) SetHeaders(param map[string]string) *GetVPNServerRouteOptions { - options.Headers = param - return options -} - -// IkePolicy : IkePolicy struct -type IkePolicy struct { - // The authentication algorithm - // - // The `md5` and `sha1` algorithms have been deprecated. - AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` - - // The VPN gateway connections that use this IKE policy. - Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` - - // The date and time that this IKE policy was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The Diffie-Hellman group - // - // Groups `2` and `5` have been deprecated. - DhGroup *int64 `json:"dh_group" validate:"required"` - - // The encryption algorithm - // - // The `triple_des` algorithm has been deprecated. - EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` - - // The IKE policy's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this IKE policy. - ID *string `json:"id" validate:"required"` - - // The IKE protocol version. - IkeVersion *int64 `json:"ike_version" validate:"required"` - - // The key lifetime in seconds. - KeyLifetime *int64 `json:"key_lifetime" validate:"required"` - - // The name for this IKE policy. The name is unique across all IKE policies in the region. - Name *string `json:"name" validate:"required"` - - // The IKE negotiation mode. Only `main` is supported. - NegotiationMode *string `json:"negotiation_mode" validate:"required"` - - // The resource group for this IKE policy. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the IkePolicy.AuthenticationAlgorithm property. -// The authentication algorithm -// -// The `md5` and `sha1` algorithms have been deprecated. -const ( - IkePolicyAuthenticationAlgorithmMd5Const = "md5" - IkePolicyAuthenticationAlgorithmSha1Const = "sha1" - IkePolicyAuthenticationAlgorithmSha256Const = "sha256" - IkePolicyAuthenticationAlgorithmSha384Const = "sha384" - IkePolicyAuthenticationAlgorithmSha512Const = "sha512" -) - -// Constants associated with the IkePolicy.EncryptionAlgorithm property. -// The encryption algorithm -// -// The `triple_des` algorithm has been deprecated. -const ( - IkePolicyEncryptionAlgorithmAes128Const = "aes128" - IkePolicyEncryptionAlgorithmAes192Const = "aes192" - IkePolicyEncryptionAlgorithmAes256Const = "aes256" - IkePolicyEncryptionAlgorithmTripleDesConst = "triple_des" -) - -// Constants associated with the IkePolicy.NegotiationMode property. -// The IKE negotiation mode. Only `main` is supported. -const ( - IkePolicyNegotiationModeMainConst = "main" -) - -// Constants associated with the IkePolicy.ResourceType property. -// The resource type. -const ( - IkePolicyResourceTypeIkePolicyConst = "ike_policy" -) - -// UnmarshalIkePolicy unmarshals an instance of IkePolicy from the specified map of raw messages. -func UnmarshalIkePolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicy) - err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) - if err != nil { - err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) - if err != nil { - err = core.SDKErrorf(err, "", "connections-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, "dh_group", &obj.DhGroup) - if err != nil { - err = core.SDKErrorf(err, "", "dh_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) - if err != nil { - err = core.SDKErrorf(err, "", "encryption_algorithm-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, "ike_version", &obj.IkeVersion) - if err != nil { - err = core.SDKErrorf(err, "", "ike_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) - if err != nil { - err = core.SDKErrorf(err, "", "key_lifetime-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, "negotiation_mode", &obj.NegotiationMode) - if err != nil { - err = core.SDKErrorf(err, "", "negotiation_mode-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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IkePolicyCollection : IkePolicyCollection struct -type IkePolicyCollection struct { - // A link to the first page of resources. - First *IkePolicyCollectionFirst `json:"first" validate:"required"` - - // Collection of IKE policies. - IkePolicies []IkePolicy `json:"ike_policies" 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 *IkePolicyCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_policies", &obj.IkePolicies, UnmarshalIkePolicy) - if err != nil { - err = core.SDKErrorf(err, "", "ike_policies-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, UnmarshalIkePolicyCollectionNext) - 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 *IkePolicyCollection) 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 -} - -// IkePolicyPatch : IkePolicyPatch struct -type IkePolicyPatch struct { - // The authentication algorithm. - AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` - - // The Diffie-Hellman group. - DhGroup *int64 `json:"dh_group,omitempty"` - - // The encryption algorithm. - EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` - - // The IKE protocol version. - IkeVersion *int64 `json:"ike_version,omitempty"` - - // The key lifetime in seconds. - KeyLifetime *int64 `json:"key_lifetime,omitempty"` - - // The name for this IKE policy. The name must not be used by another IKE policy in the region. - Name *string `json:"name,omitempty"` -} - -// Constants associated with the IkePolicyPatch.AuthenticationAlgorithm property. -// The authentication algorithm. -const ( - IkePolicyPatchAuthenticationAlgorithmSha256Const = "sha256" - IkePolicyPatchAuthenticationAlgorithmSha384Const = "sha384" - IkePolicyPatchAuthenticationAlgorithmSha512Const = "sha512" -) - -// Constants associated with the IkePolicyPatch.EncryptionAlgorithm property. -// The encryption algorithm. -const ( - IkePolicyPatchEncryptionAlgorithmAes128Const = "aes128" - IkePolicyPatchEncryptionAlgorithmAes192Const = "aes192" - IkePolicyPatchEncryptionAlgorithmAes256Const = "aes256" -) - -// UnmarshalIkePolicyPatch unmarshals an instance of IkePolicyPatch from the specified map of raw messages. -func UnmarshalIkePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicyPatch) - err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) - if err != nil { - err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup) - if err != nil { - err = core.SDKErrorf(err, "", "dh_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) - if err != nil { - err = core.SDKErrorf(err, "", "encryption_algorithm-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion) - if err != nil { - err = core.SDKErrorf(err, "", "ike_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) - if err != nil { - err = core.SDKErrorf(err, "", "key_lifetime-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 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// IkePolicyReference : IkePolicyReference struct -type IkePolicyReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *IkePolicyReferenceDeleted `json:"deleted,omitempty"` - - // The IKE policy's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this IKE policy. - ID *string `json:"id" validate:"required"` - - // The name for this IKE policy. The name is unique across all IKE policies in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the IkePolicyReference.ResourceType property. -// The resource type. -const ( - IkePolicyReferenceResourceTypeIkePolicyConst = "ike_policy" -) - -// UnmarshalIkePolicyReference unmarshals an instance of IkePolicyReference from the specified map of raw messages. -func UnmarshalIkePolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicyReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIkePolicyReferenceDeleted) - 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 -} - -// IP : IP struct -type IP struct { - // The IP address. - // - // 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"` -} - -// NewIP : Instantiate IP (Generic Model Constructor) -func (*VpcV1) NewIP(address string) (_model *IP, err error) { - _model = &IP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalIP unmarshals an instance of IP from the specified map of raw messages. -func UnmarshalIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IPsecPolicy : IPsecPolicy struct -type IPsecPolicy struct { - // The authentication algorithm - // - // The `md5` and `sha1` algorithms have been deprecated - // - // Must be `disabled` if and only if the `encryption_algorithm` is - // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. - AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` - - // The VPN gateway connections that use this IPsec policy. - Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` - - // The date and time that this IPsec policy was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The encapsulation mode used. Only `tunnel` is supported. - EncapsulationMode *string `json:"encapsulation_mode" validate:"required"` - - // The encryption algorithm - // - // The `triple_des` algorithm has been deprecated - // - // The `authentication_algorithm` must be `disabled` if and only if - // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or - // `aes256gcm16`. - EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` - - // The IPsec policy's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this IPsec policy. - ID *string `json:"id" validate:"required"` - - // The key lifetime in seconds. - KeyLifetime *int64 `json:"key_lifetime" validate:"required"` - - // The name for this IPsec policy. The name is unique across all IPsec policies in the region. - Name *string `json:"name" validate:"required"` - - // Perfect Forward Secrecy - // - // Groups `group_2` and `group_5` have been deprecated. - Pfs *string `json:"pfs" validate:"required"` - - // The resource group for this IPsec policy. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The transform protocol used. Only `esp` is supported. - TransformProtocol *string `json:"transform_protocol" validate:"required"` -} - -// Constants associated with the IPsecPolicy.AuthenticationAlgorithm property. -// The authentication algorithm -// -// # The `md5` and `sha1` algorithms have been deprecated -// -// Must be `disabled` if and only if the `encryption_algorithm` is -// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. -const ( - IPsecPolicyAuthenticationAlgorithmDisabledConst = "disabled" - IPsecPolicyAuthenticationAlgorithmMd5Const = "md5" - IPsecPolicyAuthenticationAlgorithmSha1Const = "sha1" - IPsecPolicyAuthenticationAlgorithmSha256Const = "sha256" - IPsecPolicyAuthenticationAlgorithmSha384Const = "sha384" - IPsecPolicyAuthenticationAlgorithmSha512Const = "sha512" -) - -// Constants associated with the IPsecPolicy.EncapsulationMode property. -// The encapsulation mode used. Only `tunnel` is supported. -const ( - IPsecPolicyEncapsulationModeTunnelConst = "tunnel" -) - -// Constants associated with the IPsecPolicy.EncryptionAlgorithm property. -// The encryption algorithm -// -// The `triple_des` algorithm has been deprecated -// -// The `authentication_algorithm` must be `disabled` if and only if -// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or -// `aes256gcm16`. -const ( - IPsecPolicyEncryptionAlgorithmAes128Const = "aes128" - IPsecPolicyEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" - IPsecPolicyEncryptionAlgorithmAes192Const = "aes192" - IPsecPolicyEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" - IPsecPolicyEncryptionAlgorithmAes256Const = "aes256" - IPsecPolicyEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" - IPsecPolicyEncryptionAlgorithmTripleDesConst = "triple_des" -) - -// Constants associated with the IPsecPolicy.Pfs property. -// Perfect Forward Secrecy -// -// Groups `group_2` and `group_5` have been deprecated. -const ( - IPsecPolicyPfsDisabledConst = "disabled" - IPsecPolicyPfsGroup14Const = "group_14" - IPsecPolicyPfsGroup15Const = "group_15" - IPsecPolicyPfsGroup16Const = "group_16" - IPsecPolicyPfsGroup17Const = "group_17" - IPsecPolicyPfsGroup18Const = "group_18" - IPsecPolicyPfsGroup19Const = "group_19" - IPsecPolicyPfsGroup2Const = "group_2" - IPsecPolicyPfsGroup20Const = "group_20" - IPsecPolicyPfsGroup21Const = "group_21" - IPsecPolicyPfsGroup22Const = "group_22" - IPsecPolicyPfsGroup23Const = "group_23" - IPsecPolicyPfsGroup24Const = "group_24" - IPsecPolicyPfsGroup31Const = "group_31" - IPsecPolicyPfsGroup5Const = "group_5" -) - -// Constants associated with the IPsecPolicy.ResourceType property. -// The resource type. -const ( - IPsecPolicyResourceTypeIpsecPolicyConst = "ipsec_policy" -) - -// Constants associated with the IPsecPolicy.TransformProtocol property. -// The transform protocol used. Only `esp` is supported. -const ( - IPsecPolicyTransformProtocolEspConst = "esp" -) - -// UnmarshalIPsecPolicy unmarshals an instance of IPsecPolicy from the specified map of raw messages. -func UnmarshalIPsecPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicy) - err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) - if err != nil { - err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) - if err != nil { - err = core.SDKErrorf(err, "", "connections-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, "encapsulation_mode", &obj.EncapsulationMode) - if err != nil { - err = core.SDKErrorf(err, "", "encapsulation_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) - if err != nil { - err = core.SDKErrorf(err, "", "encryption_algorithm-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, "key_lifetime", &obj.KeyLifetime) - if err != nil { - err = core.SDKErrorf(err, "", "key_lifetime-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, "pfs", &obj.Pfs) - if err != nil { - err = core.SDKErrorf(err, "", "pfs-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.UnmarshalPrimitive(m, "transform_protocol", &obj.TransformProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "transform_protocol-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IPsecPolicyCollection : IPsecPolicyCollection struct -type IPsecPolicyCollection struct { - // A link to the first page of resources. - First *IPsecPolicyCollectionFirst `json:"first" validate:"required"` - - // Collection of IPsec policies. - IpsecPolicies []IPsecPolicy `json:"ipsec_policies" 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 *IPsecPolicyCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ipsec_policies", &obj.IpsecPolicies, UnmarshalIPsecPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "ipsec_policies-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, UnmarshalIPsecPolicyCollectionNext) - 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 *IPsecPolicyCollection) 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 -} - -// 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 -} - -// IPsecPolicyPatch : IPsecPolicyPatch struct -type IPsecPolicyPatch struct { - // The authentication algorithm - // - // Must be `disabled` if and only if the `encryption_algorithm` is - // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. - AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` - - // The encryption algorithm - // - // The `authentication_algorithm` must be `disabled` if and only if - // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or - // `aes256gcm16`. - EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` - - // The key lifetime in seconds. - KeyLifetime *int64 `json:"key_lifetime,omitempty"` - - // The name for this IPsec policy. The name must not be used by another IPsec policy in the region. - Name *string `json:"name,omitempty"` - - // Perfect Forward Secrecy. - Pfs *string `json:"pfs,omitempty"` -} - -// Constants associated with the IPsecPolicyPatch.AuthenticationAlgorithm property. -// The authentication algorithm -// -// Must be `disabled` if and only if the `encryption_algorithm` is -// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. -const ( - IPsecPolicyPatchAuthenticationAlgorithmDisabledConst = "disabled" - IPsecPolicyPatchAuthenticationAlgorithmSha256Const = "sha256" - IPsecPolicyPatchAuthenticationAlgorithmSha384Const = "sha384" - IPsecPolicyPatchAuthenticationAlgorithmSha512Const = "sha512" -) - -// Constants associated with the IPsecPolicyPatch.EncryptionAlgorithm property. -// The encryption algorithm -// -// The `authentication_algorithm` must be `disabled` if and only if -// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or -// `aes256gcm16`. -const ( - IPsecPolicyPatchEncryptionAlgorithmAes128Const = "aes128" - IPsecPolicyPatchEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" - IPsecPolicyPatchEncryptionAlgorithmAes192Const = "aes192" - IPsecPolicyPatchEncryptionAlgorithmAes192gcm16Const = "aes192gcm16" - IPsecPolicyPatchEncryptionAlgorithmAes256Const = "aes256" - IPsecPolicyPatchEncryptionAlgorithmAes256gcm16Const = "aes256gcm16" -) - -// Constants associated with the IPsecPolicyPatch.Pfs property. -// Perfect Forward Secrecy. -const ( - IPsecPolicyPatchPfsDisabledConst = "disabled" - IPsecPolicyPatchPfsGroup14Const = "group_14" - IPsecPolicyPatchPfsGroup15Const = "group_15" - IPsecPolicyPatchPfsGroup16Const = "group_16" - IPsecPolicyPatchPfsGroup17Const = "group_17" - IPsecPolicyPatchPfsGroup18Const = "group_18" - IPsecPolicyPatchPfsGroup19Const = "group_19" - IPsecPolicyPatchPfsGroup20Const = "group_20" - IPsecPolicyPatchPfsGroup21Const = "group_21" - IPsecPolicyPatchPfsGroup22Const = "group_22" - IPsecPolicyPatchPfsGroup23Const = "group_23" - IPsecPolicyPatchPfsGroup24Const = "group_24" - IPsecPolicyPatchPfsGroup31Const = "group_31" -) - -// UnmarshalIPsecPolicyPatch unmarshals an instance of IPsecPolicyPatch from the specified map of raw messages. -func UnmarshalIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicyPatch) - err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) - if err != nil { - err = core.SDKErrorf(err, "", "authentication_algorithm-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) - if err != nil { - err = core.SDKErrorf(err, "", "encryption_algorithm-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) - if err != nil { - err = core.SDKErrorf(err, "", "key_lifetime-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, "pfs", &obj.Pfs) - if err != nil { - err = core.SDKErrorf(err, "", "pfs-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// IPsecPolicyReference : IPsecPolicyReference struct -type IPsecPolicyReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *IPsecPolicyReferenceDeleted `json:"deleted,omitempty"` - - // The IPsec policy's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this IPsec policy. - ID *string `json:"id" validate:"required"` - - // The name for this IPsec policy. The name is unique across all IPsec policies in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the IPsecPolicyReference.ResourceType property. -// The resource type. -const ( - IPsecPolicyReferenceResourceTypeIpsecPolicyConst = "ipsec_policy" -) - -// UnmarshalIPsecPolicyReference unmarshals an instance of IPsecPolicyReference from the specified map of raw messages. -func UnmarshalIPsecPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicyReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIPsecPolicyReferenceDeleted) - 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 -} - -// IPsecPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type IPsecPolicyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalIPsecPolicyReferenceDeleted unmarshals an instance of IPsecPolicyReferenceDeleted from the specified map of raw messages. -func UnmarshalIPsecPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicyReferenceDeleted) - 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 -} - -// 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 -} - -// IkePolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type IkePolicyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalIkePolicyReferenceDeleted unmarshals an instance of IkePolicyReferenceDeleted from the specified map of raw messages. -func UnmarshalIkePolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicyReferenceDeleted) - 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 -} - -// Image : Image struct -type Image struct { - CatalogOffering *ImageCatalogOffering `json:"catalog_offering" validate:"required"` - - // The date and time that the image was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this image. - CRN *string `json:"crn" validate:"required"` - - // The deprecation date and time (UTC) for this image. - // - // If absent, no deprecation date and time has been set. - DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` - - // The type of encryption used on the image. - Encryption *string `json:"encryption" validate:"required"` - - // The key that will be used to encrypt volumes created from this image (unless an - // alternate `encryption_key` is specified at volume creation). - // - // This property will be present for images with an `encryption` type of `user_managed`. - EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` - - // Details for the stored image file. - File *ImageFile `json:"file" validate:"required"` - - // The URL for this image. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this image. - ID *string `json:"id" validate:"required"` - - // The minimum size (in gigabytes) of a volume onto which this image may be provisioned. - // - // This property may be absent if the image has a `status` of `pending` or `failed`. - MinimumProvisionedSize *int64 `json:"minimum_provisioned_size,omitempty"` - - // The name for this image. The name is unique across all images in the region. - Name *string `json:"name" validate:"required"` - - // The obsolescence date and time (UTC) for this image. - // - // If absent, no obsolescence date and time has been set. - ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` - - // The operating system included in this image. - OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` - - // The resource group for this image. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The volume used to create this image (this may be - // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - // If absent, this image was not created from a volume. - SourceVolume *VolumeReference `json:"source_volume,omitempty"` - - // The status of this image: - // - available: image can be used (provisionable) - // - deleting: image is being deleted, and can no longer be used to provision new - // resources - // - deprecated: image is administratively slated to become `obsolete` - // - failed: image is corrupt or did not pass validation - // - obsolete: image administratively set to not be used for new resources - // - pending: image is being imported and is not yet `available` - // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) - // - // 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"` - - StatusReasons []ImageStatusReason `json:"status_reasons" validate:"required"` - - // The visibility of this image. - // - `private`: Visible only to this account - // - `public`: Visible to all accounts. - Visibility *string `json:"visibility" validate:"required"` -} - -// Constants associated with the Image.Encryption property. -// The type of encryption used on the image. -const ( - ImageEncryptionNoneConst = "none" - ImageEncryptionUserManagedConst = "user_managed" -) - -// Constants associated with the Image.ResourceType property. -// The resource type. -const ( - ImageResourceTypeImageConst = "image" -) - -// Constants associated with the Image.Status property. -// The status of this image: -// - available: image can be used (provisionable) -// - deleting: image is being deleted, and can no longer be used to provision new -// resources -// - deprecated: image is administratively slated to become `obsolete` -// - failed: image is corrupt or did not pass validation -// - obsolete: image administratively set to not be used for new resources -// - pending: image is being imported and is not yet `available` -// - unusable: image cannot be used (see `status_reasons[]` for possible remediation) -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ImageStatusAvailableConst = "available" - ImageStatusDeletingConst = "deleting" - ImageStatusDeprecatedConst = "deprecated" - ImageStatusFailedConst = "failed" - ImageStatusObsoleteConst = "obsolete" - ImageStatusPendingConst = "pending" - ImageStatusUnusableConst = "unusable" -) - -// Constants associated with the Image.Visibility property. -// The visibility of this image. -// - `private`: Visible only to this account -// - `public`: Visible to all accounts. -const ( - ImageVisibilityPrivateConst = "private" - ImageVisibilityPublicConst = "public" -) - -// UnmarshalImage unmarshals an instance of Image from the specified map of raw messages. -func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Image) - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalImageCatalogOffering) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) - if err != nil { - err = core.SDKErrorf(err, "", "deprecation_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) - if err != nil { - err = core.SDKErrorf(err, "", "encryption-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, "file", &obj.File, UnmarshalImageFile) - if err != nil { - err = core.SDKErrorf(err, "", "file-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, "minimum_provisioned_size", &obj.MinimumProvisionedSize) - if err != nil { - err = core.SDKErrorf(err, "", "minimum_provisioned_size-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, "obsolescence_at", &obj.ObsolescenceAt) - if err != nil { - err = core.SDKErrorf(err, "", "obsolescence_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) - if err != nil { - err = core.SDKErrorf(err, "", "operating_system-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, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) - if err != nil { - err = core.SDKErrorf(err, "", "source_volume-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, UnmarshalImageStatusReason) - if err != nil { - err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "visibility", &obj.Visibility) - if err != nil { - err = core.SDKErrorf(err, "", "visibility-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageCatalogOffering : ImageCatalogOffering struct -type ImageCatalogOffering struct { - // Indicates whether this image is managed as part of a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. If an image is managed, - // accounts with access to that catalog can specify the image's catalog offering version CRN to provision virtual - // server instances using the image. - Managed *bool `json:"managed" validate:"required"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering version associated with this image. - // - // If absent, this image is not associated with a cloud catalog offering. - Version *CatalogOfferingVersionReference `json:"version,omitempty"` -} - -// UnmarshalImageCatalogOffering unmarshals an instance of ImageCatalogOffering from the specified map of raw messages. -func UnmarshalImageCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageCatalogOffering) - err = core.UnmarshalPrimitive(m, "managed", &obj.Managed) - if err != nil { - err = core.SDKErrorf(err, "", "managed-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) - if err != nil { - err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageCollection : ImageCollection struct -type ImageCollection struct { - // A link to the first page of resources. - First *ImageCollectionFirst `json:"first" validate:"required"` - - // Collection of images. - Images []Image `json:"images" 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 *ImageCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "images", &obj.Images, UnmarshalImage) - if err != nil { - err = core.SDKErrorf(err, "", "images-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, UnmarshalImageCollectionNext) - 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 *ImageCollection) 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 -} - -// 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. - // - // If absent, the export job has not yet completed. - CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` - - // The date and time that the image export job was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // A base64-encoded, encrypted representation of the key that was used to encrypt the data for the exported image. This - // key can be unwrapped with the image's `encryption_key` root key using either Key Protect or Hyper Protect Crypto - // Services. - // - // If absent, the export job is for an unencrypted image. - EncryptedDataKey *[]byte `json:"encrypted_data_key,omitempty"` - - // The format of the exported image. - Format *string `json:"format" validate:"required"` - - // The URL for this image export job. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this image export job. - ID *string `json:"id" validate:"required"` - - // The name for this image export job. The name must not be used by another export job for the image. Changing the name - // will not affect the exported image name, - // `storage_object.name`, or `storage_href` values. - Name *string `json:"name" validate:"required"` - - // The type of resource referenced. - ResourceType *string `json:"resource_type" validate:"required"` - - // The date and time that the image export job started running. - // - // If absent, the export job has not yet started. - StartedAt *strfmt.DateTime `json:"started_at,omitempty"` - - // The status of this image export job: - // - `deleting`: Export job is being deleted - // - `failed`: Export job could not be completed successfully - // - `queued`: Export job is queued - // - `running`: Export job is in progress - // - `succeeded`: Export job was completed successfully - // - // The exported image object is automatically deleted for `failed` jobs. - Status *string `json:"status" validate:"required"` - - // The reasons for the current status (if any). - StatusReasons []ImageExportJobStatusReason `json:"status_reasons" validate:"required"` - - // The Cloud Object Storage bucket of the exported image object. - StorageBucket *CloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` - - // The Cloud Object Storage location of the exported image object. The object at this location will not exist until the - // job completes successfully. The exported image object is not managed by the IBM VPC service, and may be removed or - // replaced with a different object by any user or service with IAM authorization to the storage bucket. - StorageHref *string `json:"storage_href" validate:"required"` - - // The Cloud Object Storage object for the exported image. This object will not exist until - // the job completes successfully. The exported image object is not managed by the IBM VPC - // service, and may be removed or replaced with a different object by any user or service - // with IAM authorization to the storage bucket. - StorageObject *CloudObjectStorageObjectReference `json:"storage_object" validate:"required"` -} - -// Constants associated with the ImageExportJob.Format property. -// The format of the exported image. -const ( - ImageExportJobFormatQcow2Const = "qcow2" - ImageExportJobFormatVhdConst = "vhd" -) - -// Constants associated with the ImageExportJob.ResourceType property. -// The type of resource referenced. -const ( - ImageExportJobResourceTypeImageExportJobConst = "image_export_job" -) - -// Constants associated with the ImageExportJob.Status property. -// The status of this image export job: -// - `deleting`: Export job is being deleted -// - `failed`: Export job could not be completed successfully -// - `queued`: Export job is queued -// - `running`: Export job is in progress -// - `succeeded`: Export job was completed successfully -// -// The exported image object is automatically deleted for `failed` jobs. -const ( - ImageExportJobStatusDeletingConst = "deleting" - ImageExportJobStatusFailedConst = "failed" - ImageExportJobStatusQueuedConst = "queued" - ImageExportJobStatusRunningConst = "running" - ImageExportJobStatusSucceededConst = "succeeded" -) - -// UnmarshalImageExportJob unmarshals an instance of ImageExportJob from the specified map of raw messages. -func UnmarshalImageExportJob(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageExportJob) - 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, "encrypted_data_key", &obj.EncryptedDataKey) - if err != nil { - err = core.SDKErrorf(err, "", "encrypted_data_key-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "format", &obj.Format) - if err != nil { - err = core.SDKErrorf(err, "", "format-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 - } - err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) - if err != nil { - err = core.SDKErrorf(err, "", "started_at-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, UnmarshalImageExportJobStatusReason) - if err != nil { - err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalCloudObjectStorageBucketReference) - if err != nil { - err = core.SDKErrorf(err, "", "storage_bucket-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "storage_href", &obj.StorageHref) - if err != nil { - err = core.SDKErrorf(err, "", "storage_href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "storage_object", &obj.StorageObject, UnmarshalCloudObjectStorageObjectReference) - if err != nil { - err = core.SDKErrorf(err, "", "storage_object-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageExportJobPatch : ImageExportJobPatch struct -type ImageExportJobPatch struct { - // The name for this image export job. The name must not be used by another export job for the image. Changing the name - // will not affect the exported image name, - // `storage_object.name`, or `storage_href` values. - Name *string `json:"name,omitempty"` -} - -// UnmarshalImageExportJobPatch unmarshals an instance of ImageExportJobPatch from the specified map of raw messages. -func UnmarshalImageExportJobPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageExportJobPatch) - 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 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()) - } - return -} - -// ImageExportJobStatusReason : ImageExportJobStatusReason struct -type ImageExportJobStatusReason struct { - // A snake case string succinctly identifying the status reason. - // - // 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 ImageExportJobStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ImageExportJobStatusReasonCodeCannotAccessStorageBucketConst = "cannot_access_storage_bucket" - ImageExportJobStatusReasonCodeInternalErrorConst = "internal_error" -) - -// UnmarshalImageExportJobStatusReason unmarshals an instance of ImageExportJobStatusReason from the specified map of raw messages. -func UnmarshalImageExportJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageExportJobStatusReason) - 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 -} - -// ImageExportJobUnpaginatedCollection : ImageExportJobUnpaginatedCollection struct -type ImageExportJobUnpaginatedCollection struct { - // Collection of image export jobs. - ExportJobs []ImageExportJob `json:"export_jobs" validate:"required"` -} - -// UnmarshalImageExportJobUnpaginatedCollection unmarshals an instance of ImageExportJobUnpaginatedCollection from the specified map of raw messages. -func UnmarshalImageExportJobUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageExportJobUnpaginatedCollection) - err = core.UnmarshalModel(m, "export_jobs", &obj.ExportJobs, UnmarshalImageExportJob) - if err != nil { - err = core.SDKErrorf(err, "", "export_jobs-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageFile : ImageFile struct -type ImageFile struct { - // Checksums for this image file. - // - // This property may be absent if the associated image has a `status` of `pending` or - // `failed`. - Checksums *ImageFileChecksums `json:"checksums,omitempty"` - - // The size of the stored image file rounded up to the next gigabyte. - // - // This property may be absent if the associated image has a `status` of `pending` or - // `failed`. - Size *int64 `json:"size,omitempty"` -} - -// UnmarshalImageFile unmarshals an instance of ImageFile from the specified map of raw messages. -func UnmarshalImageFile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageFile) - err = core.UnmarshalModel(m, "checksums", &obj.Checksums, UnmarshalImageFileChecksums) - if err != nil { - err = core.SDKErrorf(err, "", "checksums-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageFileChecksums : ImageFileChecksums struct -type ImageFileChecksums struct { - // The SHA256 fingerprint of the image file. - Sha256 *string `json:"sha256,omitempty"` -} - -// UnmarshalImageFileChecksums unmarshals an instance of ImageFileChecksums from the specified map of raw messages. -func UnmarshalImageFileChecksums(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageFileChecksums) - err = core.UnmarshalPrimitive(m, "sha256", &obj.Sha256) - if err != nil { - err = core.SDKErrorf(err, "", "sha256-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageFilePrototype : ImageFilePrototype struct -type ImageFilePrototype struct { - // The Cloud Object Storage location of the image file. - // - // The image file format is specified by the file's extension, which must be either - // `qcow2` or `vhd`. - Href *string `json:"href" validate:"required"` -} - -// NewImageFilePrototype : Instantiate ImageFilePrototype (Generic Model Constructor) -func (*VpcV1) NewImageFilePrototype(href string) (_model *ImageFilePrototype, err error) { - _model = &ImageFilePrototype{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalImageFilePrototype unmarshals an instance of ImageFilePrototype from the specified map of raw messages. -func UnmarshalImageFilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageFilePrototype) - 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 -} - -// ImageIdentity : Identifies an image by a unique property. -// Models which "extend" this model: -// - ImageIdentityByID -// - ImageIdentityByCRN -// - ImageIdentityByHref -type ImageIdentity struct { - // The unique identifier for this image. - ID *string `json:"id,omitempty"` - - // The CRN for this image. - CRN *string `json:"crn,omitempty"` - - // The URL for this image. - Href *string `json:"href,omitempty"` -} - -func (*ImageIdentity) isaImageIdentity() bool { - return true -} - -type ImageIdentityIntf interface { - isaImageIdentity() bool -} - -// UnmarshalImageIdentity unmarshals an instance of ImageIdentity from the specified map of raw messages. -func UnmarshalImageIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImagePatch : ImagePatch struct -type ImagePatch struct { - // The deprecation date and time to set for this image. - // - // This cannot be set if the image has a `status` of `failed` or `deleting`, or if - // `catalog_offering.managed` is `true`. - // - // The date and time must not be in the past, and must be earlier than `obsolescence_at` - // (if `obsolescence_at` is set). Additionally, if the image status is currently - // `deprecated`, the value cannot be changed (but may be removed). - // - // Specify `null` to remove an existing deprecation date and time. If the image status is currently `deprecated`, it - // will become `available`. - // - // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will - // transition to `deprecated` upon its successful creation (or - // `obsolete` if the obsolescence date and time was also reached). - DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` - - // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are - // reserved for system-provided images, and are not allowed. - Name *string `json:"name,omitempty"` - - // The obsolescence date and time to set for this image. - // - // This cannot be set if the image has a `status` of `failed` or `deleting`, or if - // `catalog_offering.managed` is `true`. - // - // The date and time must not be in the past, and must be later than `deprecation_at` (if - // `deprecation_at` is set). Additionally, if the image status is currently `obsolete`, the value cannot be changed - // (but may be removed). - // - // Specify `null` to remove an existing obsolescence date and time. If the image status is currently `obsolete`, it - // will become `deprecated` if `deprecation_at` is in the past. Otherwise, it will become `available`. - // - // If the obsolescence date and time is reached while the image has a status of `pending`, the image's status will - // transition to `obsolete` upon its successful creation. - ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` -} - -// UnmarshalImagePatch unmarshals an instance of ImagePatch from the specified map of raw messages. -func UnmarshalImagePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImagePatch) - err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) - if err != nil { - err = core.SDKErrorf(err, "", "deprecation_at-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, "obsolescence_at", &obj.ObsolescenceAt) - if err != nil { - err = core.SDKErrorf(err, "", "obsolescence_at-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// ImagePrototype : ImagePrototype struct -// Models which "extend" this model: -// - ImagePrototypeImageByFile -// - ImagePrototypeImageBySourceVolume -type ImagePrototype struct { - // The deprecation date and time to set for this image. - // - // The date and time must not be in the past, and must be earlier than `obsolescence_at` - // (if `obsolescence_at` is set). - // - // If unspecified, no deprecation date and time will be set. - // - // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will - // transition to `deprecated` upon its successful creation (or - // `obsolete` if the obsolescence date and time was also reached). - DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` - - // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are - // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of - // randomly-selected words. - Name *string `json:"name,omitempty"` - - // The obsolescence date and time to set for this image. - // - // The date and time must not be in the past, and must be later than `deprecation_at` (if - // `deprecation_at` is set). - // - // If unspecified, no obsolescence date and time will be set. - // - // If the obsolescence date and time is reached while the image has a status of - // `pending`, the image's status will transition to `obsolete` upon its successful creation. - ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,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"` - - // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. - // - // That representation is created by wrapping the key's value with the `encryption_key` root key (which must also be - // specified), using either [Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the - // [Hyper Protect Crypto Services](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). - // - // If unspecified, the imported image is treated as unencrypted. - EncryptedDataKey *string `json:"encrypted_data_key,omitempty"` - - // The root key that was used to wrap the data key (which is ultimately represented as - // `encrypted_data_key`). Additionally, the root key will be used to encrypt volumes - // created from this image (unless an alternate `encryption_key` is specified at volume - // creation). - // - // If unspecified, the imported image is treated as unencrypted. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The file from which to create the image. - File *ImageFilePrototype `json:"file,omitempty"` - - // The [supported operating - // system](https://cloud.ibm.com/apidocs/vpc#list-operating-systems) included in this - // image. - OperatingSystem OperatingSystemIdentityIntf `json:"operating_system,omitempty"` - - // The volume from which to create the image. The specified volume must: - // - Have an `operating_system`, which will be used to populate this image's - // operating system information. - // - Not be `active` or `busy`. - // - // During image creation, the specified volume may briefly become `busy`. - SourceVolume VolumeIdentityIntf `json:"source_volume,omitempty"` -} - -func (*ImagePrototype) isaImagePrototype() bool { - return true -} - -type ImagePrototypeIntf interface { - isaImagePrototype() bool -} - -// UnmarshalImagePrototype unmarshals an instance of ImagePrototype from the specified map of raw messages. -func UnmarshalImagePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImagePrototype) - err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) - if err != nil { - err = core.SDKErrorf(err, "", "deprecation_at-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, "obsolescence_at", &obj.ObsolescenceAt) - if err != nil { - err = core.SDKErrorf(err, "", "obsolescence_at-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.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) - if err != nil { - err = core.SDKErrorf(err, "", "encrypted_data_key-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, "file", &obj.File, UnmarshalImageFilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "file-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "operating_system-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImageReference : ImageReference struct -type ImageReference struct { - // The CRN for this image. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ImageReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this image. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this image. - ID *string `json:"id" validate:"required"` - - // The name for this image. The name is unique across all images in the region. - 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 *ImageRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ImageReference.ResourceType property. -// The resource type. -const ( - ImageReferenceResourceTypeImageConst = "image" -) - -// UnmarshalImageReference unmarshals an instance of ImageReference from the specified map of raw messages. -func UnmarshalImageReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageReference) - 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, UnmarshalImageReferenceDeleted) - 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, UnmarshalImageRemote) - 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 -} - -// ImageReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ImageReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalImageReferenceDeleted unmarshals an instance of ImageReferenceDeleted from the specified map of raw messages. -func UnmarshalImageReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageReferenceDeleted) - 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 -} - -// ImageRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not -// be directly retrievable. -type ImageRemote struct { - // If present, this property indicates that the referenced resource is remote to this - // account, and identifies the owning account. - Account *AccountReference `json:"account,omitempty"` - - // If present, this property indicates that the referenced resource is remote to this - // region, and identifies the native region. - Region *RegionReference `json:"region,omitempty"` -} - -// UnmarshalImageRemote unmarshals an instance of ImageRemote from the specified map of raw messages. -func UnmarshalImageRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageRemote) - err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) - if err != nil { - err = core.SDKErrorf(err, "", "account-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 -} - -// ImageStatusReason : ImageStatusReason struct -type ImageStatusReason struct { - // A reason code for the status: - // - `encrypted_data_key_invalid`: image cannot be decrypted with the specified - // `encryption_key` - // - `encryption_key_deleted`: image unusable because its `encryption_key` was deleted - // - `encryption_key_disabled`: image unusable until its `encryption_key` is re-enabled - // - `image_data_corrupted`: image data is corrupt, or is not in the specified format - // - `image_provisioned_size_unsupported`: image requires a boot volume size greater - // than the maximum supported value - // - `image_request_in_progress`: image operation is in progress (such as an import from - // Cloud Object Storage) - // - `image_request_queued`: image request has been accepted but the requested - // operation has not started - // - // 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 ImageStatusReason.Code property. -// A reason code for the status: -// - `encrypted_data_key_invalid`: image cannot be decrypted with the specified -// `encryption_key` -// - `encryption_key_deleted`: image unusable because its `encryption_key` was deleted -// - `encryption_key_disabled`: image unusable until its `encryption_key` is re-enabled -// - `image_data_corrupted`: image data is corrupt, or is not in the specified format -// - `image_provisioned_size_unsupported`: image requires a boot volume size greater -// than the maximum supported value -// - `image_request_in_progress`: image operation is in progress (such as an import from -// Cloud Object Storage) -// - `image_request_queued`: image request has been accepted but the requested -// operation has not started -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ImageStatusReasonCodeEncryptedDataKeyInvalidConst = "encrypted_data_key_invalid" - ImageStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" - ImageStatusReasonCodeEncryptionKeyDisabledConst = "encryption_key_disabled" - ImageStatusReasonCodeImageDataCorruptedConst = "image_data_corrupted" - ImageStatusReasonCodeImageProvisionedSizeUnsupportedConst = "image_provisioned_size_unsupported" - ImageStatusReasonCodeImageRequestInProgressConst = "image_request_in_progress" - ImageStatusReasonCodeImageRequestQueuedConst = "image_request_queued" -) - -// UnmarshalImageStatusReason unmarshals an instance of ImageStatusReason from the specified map of raw messages. -func UnmarshalImageStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageStatusReason) - 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 -} - -// Instance : Instance struct -type Instance struct { - // The availability policy for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicy `json:"availability_policy" validate:"required"` - - // The total bandwidth (in megabits per second) shared across the instance network attachments or instance network - // interfaces and storage volumes of the virtual server instance. - Bandwidth *int64 `json:"bandwidth" validate:"required"` - - // Boot volume attachment. - BootVolumeAttachment *VolumeAttachmentReferenceInstanceContext `json:"boot_volume_attachment" validate:"required"` - - // If present, this virtual server instance was provisioned from a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user). - CatalogOffering *InstanceCatalogOffering `json:"catalog_offering,omitempty"` - - // The date and time that the virtual server instance was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this virtual server instance. - CRN *string `json:"crn" validate:"required"` - - // If present, the dedicated host this virtual server instance has been placed on. - DedicatedHost *DedicatedHostReference `json:"dedicated_host,omitempty"` - - // The instance disks for this virtual server instance. - Disks []InstanceDisk `json:"disks" validate:"required"` - - // The virtual server instance GPU configuration. - Gpu *InstanceGpu `json:"gpu,omitempty"` - - // The reasons for the current `health_state` (if any). - HealthReasons []InstanceHealthReason `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 virtual server instance. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual server instance. - ID *string `json:"id" validate:"required"` - - // The image the virtual server instance was provisioned from. - Image *ImageReference `json:"image,omitempty"` - - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []InstanceLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the virtual server instance. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The amount of memory, truncated to whole gibibytes. - Memory *int64 `json:"memory" validate:"required"` - - // The metadata service configuration. - MetadataService *InstanceMetadataService `json:"metadata_service" validate:"required"` - - // The name for this virtual server instance. The name is unique across all virtual server instances in the region. - Name *string `json:"name" validate:"required"` - - // The network attachments for this virtual server instance, including the primary network attachment. - NetworkAttachments []InstanceNetworkAttachmentReference `json:"network_attachments" validate:"required"` - - // The network interfaces for this instance, including the primary network interface. - // - // If this instance 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 []NetworkInterfaceInstanceContextReference `json:"network_interfaces" validate:"required"` - - // The number of NUMA nodes this virtual server instance is provisioned on. - // - // This property will be absent if the instance's `status` is not `running`. - NumaCount *int64 `json:"numa_count,omitempty"` - - // The placement restrictions for the virtual server instance. - PlacementTarget InstancePlacementTargetIntf `json:"placement_target,omitempty"` - - // The primary network attachment for this virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentReference `json:"primary_network_attachment,omitempty"` - - // The primary network interface for this virtual server instance. - // - // If this instance 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 *NetworkInterfaceInstanceContextReference `json:"primary_network_interface" validate:"required"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this virtual - // server instance. - Profile *InstanceProfileReference `json:"profile" validate:"required"` - - // The reservation used by this virtual server instance. - // - // If absent, no reservation is in use. - Reservation *ReservationReference `json:"reservation,omitempty"` - - ReservationAffinity *InstanceReservationAffinity `json:"reservation_affinity" validate:"required"` - - // The resource group for this instance. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // Indicates whether the state of the virtual server instance permits a start request. - Startable *bool `json:"startable" validate:"required"` - - // The status of the virtual server instance. - // - // 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 []InstanceStatusReason `json:"status_reasons" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance network attachments or instance - // network interfaces. - TotalNetworkBandwidth *int64 `json:"total_network_bandwidth" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth" validate:"required"` - - // The virtual server instance VCPU configuration. - Vcpu *InstanceVcpu `json:"vcpu" validate:"required"` - - // The volume attachments for this virtual server instance, including the boot volume attachment. - VolumeAttachments []VolumeAttachmentReferenceInstanceContext `json:"volume_attachments" validate:"required"` - - // The VPC this virtual server instance resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // The zone this virtual server instance resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the Instance.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 ( - InstanceHealthStateDegradedConst = "degraded" - InstanceHealthStateFaultedConst = "faulted" - InstanceHealthStateInapplicableConst = "inapplicable" - InstanceHealthStateOkConst = "ok" -) - -// Constants associated with the Instance.LifecycleState property. -// The lifecycle state of the virtual server instance. -const ( - InstanceLifecycleStateDeletingConst = "deleting" - InstanceLifecycleStateFailedConst = "failed" - InstanceLifecycleStatePendingConst = "pending" - InstanceLifecycleStateStableConst = "stable" - InstanceLifecycleStateSuspendedConst = "suspended" - InstanceLifecycleStateUpdatingConst = "updating" - InstanceLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the Instance.ResourceType property. -// The resource type. -const ( - InstanceResourceTypeInstanceConst = "instance" -) - -// Constants associated with the Instance.Status property. -// The status of the virtual server instance. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - InstanceStatusDeletingConst = "deleting" - InstanceStatusFailedConst = "failed" - InstanceStatusPendingConst = "pending" - InstanceStatusRestartingConst = "restarting" - InstanceStatusRunningConst = "running" - InstanceStatusStartingConst = "starting" - InstanceStatusStoppedConst = "stopped" - InstanceStatusStoppingConst = "stopping" -) - -// UnmarshalInstance unmarshals an instance of Instance from the specified map of raw messages. -func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Instance) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentReferenceInstanceContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOffering) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "dedicated_host", &obj.DedicatedHost, UnmarshalDedicatedHostReference) - if err != nil { - err = core.SDKErrorf(err, "", "dedicated_host-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) - if err != nil { - err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "gpu", &obj.Gpu, UnmarshalInstanceGpu) - if err != nil { - err = core.SDKErrorf(err, "", "gpu-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalInstanceHealthReason) - 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.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceLifecycleReason) - 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, "memory", &obj.Memory) - if err != nil { - err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataService) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentReference) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceInstanceContextReference) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "numa_count", &obj.NumaCount) - if err != nil { - err = core.SDKErrorf(err, "", "numa_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTarget) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentReference) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceInstanceContextReference) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileReference) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation", &obj.Reservation, UnmarshalReservationReference) - if err != nil { - err = core.SDKErrorf(err, "", "reservation-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinity) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "startable", &obj.Startable) - if err != nil { - err = core.SDKErrorf(err, "", "startable-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, UnmarshalInstanceStatusReason) - if err != nil { - err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "total_network_bandwidth", &obj.TotalNetworkBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_network_bandwidth-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalInstanceVcpu) - if err != nil { - err = core.SDKErrorf(err, "", "vcpu-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceInstanceContext) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-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 -} - -// InstanceAction : InstanceAction struct -type InstanceAction struct { - // The date and time that the action was completed. - // Deprecated: this field is deprecated and may be removed in a future release. - CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` - - // The date and time that the action was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // 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"` - - // The URL for this instance action. - // Deprecated: this field is deprecated and may be removed in a future release. - Href *string `json:"href" validate:"required"` - - // The identifier for this instance action. - // Deprecated: this field is deprecated and may be removed in a future release. - ID *string `json:"id" validate:"required"` - - // The date and time that the action was started. - // Deprecated: this field is deprecated and may be removed in a future release. - StartedAt *strfmt.DateTime `json:"started_at,omitempty"` - - // The current status of this action. - // Deprecated: this field is deprecated and may be removed in a future release. - Status *string `json:"status" validate:"required"` - - // The type of action. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceAction.Status property. -// The current status of this action. -const ( - InstanceActionStatusCompletedConst = "completed" - InstanceActionStatusFailedConst = "failed" - InstanceActionStatusPendingConst = "pending" - InstanceActionStatusRunningConst = "running" -) - -// Constants associated with the InstanceAction.Type property. -// The type of action. -const ( - InstanceActionTypeRebootConst = "reboot" - InstanceActionTypeStartConst = "start" - InstanceActionTypeStopConst = "stop" -) - -// UnmarshalInstanceAction unmarshals an instance of InstanceAction from the specified map of raw messages. -func UnmarshalInstanceAction(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceAction) - 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, "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 - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) - if err != nil { - err = core.SDKErrorf(err, "", "started_at-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.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 -} - -// InstanceAvailabilityPolicy : InstanceAvailabilityPolicy struct -type InstanceAvailabilityPolicy struct { - // The action to perform if the compute host experiences a failure: - // - `restart`: Automatically restart the virtual server instance after host failure - // - `stop`: Leave the virtual server instance stopped after host failure - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - HostFailure *string `json:"host_failure" validate:"required"` -} - -// Constants associated with the InstanceAvailabilityPolicy.HostFailure property. -// The action to perform if the compute host experiences a failure: -// - `restart`: Automatically restart the virtual server instance after host failure -// - `stop`: Leave the virtual server instance stopped after host failure -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - InstanceAvailabilityPolicyHostFailureRestartConst = "restart" - InstanceAvailabilityPolicyHostFailureStopConst = "stop" -) - -// UnmarshalInstanceAvailabilityPolicy unmarshals an instance of InstanceAvailabilityPolicy from the specified map of raw messages. -func UnmarshalInstanceAvailabilityPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceAvailabilityPolicy) - err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) - if err != nil { - err = core.SDKErrorf(err, "", "host_failure-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceAvailabilityPolicyPatch : InstanceAvailabilityPolicyPatch struct -type InstanceAvailabilityPolicyPatch struct { - // The action to perform if the compute host experiences a failure. - // - `restart`: Automatically restart the virtual server instance after host failure - // - `stop`: Leave the virtual server instance stopped after host failure. - HostFailure *string `json:"host_failure,omitempty"` -} - -// Constants associated with the InstanceAvailabilityPolicyPatch.HostFailure property. -// The action to perform if the compute host experiences a failure. -// - `restart`: Automatically restart the virtual server instance after host failure -// - `stop`: Leave the virtual server instance stopped after host failure. -const ( - InstanceAvailabilityPolicyPatchHostFailureRestartConst = "restart" - InstanceAvailabilityPolicyPatchHostFailureStopConst = "stop" -) - -// UnmarshalInstanceAvailabilityPolicyPatch unmarshals an instance of InstanceAvailabilityPolicyPatch from the specified map of raw messages. -func UnmarshalInstanceAvailabilityPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceAvailabilityPolicyPatch) - err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) - if err != nil { - err = core.SDKErrorf(err, "", "host_failure-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceAvailabilityPolicyPrototype : InstanceAvailabilityPolicyPrototype struct -type InstanceAvailabilityPolicyPrototype struct { - // The action to perform if the compute host experiences a failure. - // - `restart`: Automatically restart the virtual server instance after host failure - // - `stop`: Leave the virtual server instance stopped after host failure. - HostFailure *string `json:"host_failure,omitempty"` -} - -// Constants associated with the InstanceAvailabilityPolicyPrototype.HostFailure property. -// The action to perform if the compute host experiences a failure. -// - `restart`: Automatically restart the virtual server instance after host failure -// - `stop`: Leave the virtual server instance stopped after host failure. -const ( - InstanceAvailabilityPolicyPrototypeHostFailureRestartConst = "restart" - InstanceAvailabilityPolicyPrototypeHostFailureStopConst = "stop" -) - -// UnmarshalInstanceAvailabilityPolicyPrototype unmarshals an instance of InstanceAvailabilityPolicyPrototype from the specified map of raw messages. -func UnmarshalInstanceAvailabilityPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceAvailabilityPolicyPrototype) - err = core.UnmarshalPrimitive(m, "host_failure", &obj.HostFailure) - if err != nil { - err = core.SDKErrorf(err, "", "host_failure-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceCatalogOffering : InstanceCatalogOffering struct -type InstanceCatalogOffering struct { - // The catalog offering version this virtual server instance was provisioned from. - // - // The catalog offering version is not managed by the IBM VPC service, and may no longer - // exist, or may refer to a different image CRN than the `image.crn` for this virtual - // server instance. However, all images associated with a catalog offering version will - // have the same checksum, and therefore will have the same data. - Version *CatalogOfferingVersionReference `json:"version" validate:"required"` -} - -// UnmarshalInstanceCatalogOffering unmarshals an instance of InstanceCatalogOffering from the specified map of raw messages. -func UnmarshalInstanceCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceCatalogOffering) - err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) - if err != nil { - err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceCatalogOfferingPrototype : The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering or offering version to use -// when provisioning this virtual server instance. -// -// If an offering is specified, the latest version of that offering will be used. -// -// The specified offering or offering version may be in a different account, subject to IAM policies. -// Models which "extend" this model: -// - InstanceCatalogOfferingPrototypeCatalogOfferingByOffering -// - InstanceCatalogOfferingPrototypeCatalogOfferingByVersion -type InstanceCatalogOfferingPrototype struct { - // Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering by a unique property. - Offering CatalogOfferingIdentityIntf `json:"offering,omitempty"` - - // Identifies a version of a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a - // unique property. - Version CatalogOfferingVersionIdentityIntf `json:"version,omitempty"` -} - -func (*InstanceCatalogOfferingPrototype) isaInstanceCatalogOfferingPrototype() bool { - return true -} - -type InstanceCatalogOfferingPrototypeIntf interface { - isaInstanceCatalogOfferingPrototype() bool -} - -// UnmarshalInstanceCatalogOfferingPrototype unmarshals an instance of InstanceCatalogOfferingPrototype from the specified map of raw messages. -func UnmarshalInstanceCatalogOfferingPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceCatalogOfferingPrototype) - err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "offering-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "version-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 *InstanceCollectionFirst `json:"first" validate:"required"` - - // Collection 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 *InstanceCollectionNext `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) - 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, UnmarshalInstanceCollectionNext) - 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 -} - -// 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"` -} - -// 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) - 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 -} - -// 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. - Href *string `json:"href" 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) - 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 -} - -// InstanceConsoleAccessToken : The instance console access token information. -type InstanceConsoleAccessToken struct { - // A URL safe single-use token used to access the console WebSocket. - AccessToken *string `json:"access_token" validate:"required"` - - // The instance console type for which this token may be used. - ConsoleType *string `json:"console_type" validate:"required"` - - // The date and time that the access token was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The date and time that the access token will expire. - ExpiresAt *strfmt.DateTime `json:"expires_at" 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"` - - // The URL to access this instance console. - Href *string `json:"href" validate:"required"` -} - -// Constants associated with the InstanceConsoleAccessToken.ConsoleType property. -// The instance console type for which this token may be used. -const ( - InstanceConsoleAccessTokenConsoleTypeSerialConst = "serial" - InstanceConsoleAccessTokenConsoleTypeVncConst = "vnc" -) - -// UnmarshalInstanceConsoleAccessToken unmarshals an instance of InstanceConsoleAccessToken from the specified map of raw messages. -func UnmarshalInstanceConsoleAccessToken(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceConsoleAccessToken) - err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) - if err != nil { - err = core.SDKErrorf(err, "", "access_token-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) - if err != nil { - err = core.SDKErrorf(err, "", "console_type-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, "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 -} - -// InstanceDefaultTrustedProfilePrototype : InstanceDefaultTrustedProfilePrototype struct -type InstanceDefaultTrustedProfilePrototype struct { - // If set to `true`, the system will create a link to the specified `target` trusted profile during instance creation. - // Regardless of whether a link is created by the system or manually using the IAM Identity service, it will be - // automatically deleted when the instance is deleted. - AutoLink *bool `json:"auto_link,omitempty"` - - // The default IAM trusted profile to use for this virtual server instance. - Target TrustedProfileIdentityIntf `json:"target" validate:"required"` -} - -// NewInstanceDefaultTrustedProfilePrototype : Instantiate InstanceDefaultTrustedProfilePrototype (Generic Model Constructor) -func (*VpcV1) NewInstanceDefaultTrustedProfilePrototype(target TrustedProfileIdentityIntf) (_model *InstanceDefaultTrustedProfilePrototype, err error) { - _model = &InstanceDefaultTrustedProfilePrototype{ - Target: target, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalInstanceDefaultTrustedProfilePrototype unmarshals an instance of InstanceDefaultTrustedProfilePrototype from the specified map of raw messages. -func UnmarshalInstanceDefaultTrustedProfilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceDefaultTrustedProfilePrototype) - err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink) - if err != nil { - err = core.SDKErrorf(err, "", "auto_link-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceDisk : InstanceDisk struct -type InstanceDisk struct { - // The date and time that the disk was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance disk. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance disk. - ID *string `json:"id" validate:"required"` - - // The disk interface used for attaching the disk. - // - // 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 name for this instance disk. The name is unique across all disks on the instance. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The size of the disk in GB (gigabytes). - Size *int64 `json:"size" validate:"required"` -} - -// Constants associated with the InstanceDisk.InterfaceType property. -// The disk interface used for attaching the disk. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - InstanceDiskInterfaceTypeNvmeConst = "nvme" - InstanceDiskInterfaceTypeVirtioBlkConst = "virtio_blk" -) - -// Constants associated with the InstanceDisk.ResourceType property. -// The resource type. -const ( - InstanceDiskResourceTypeInstanceDiskConst = "instance_disk" -) - -// UnmarshalInstanceDisk unmarshals an instance of InstanceDisk from the specified map of raw messages. -func UnmarshalInstanceDisk(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceDisk) - 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, "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.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceDiskCollection : InstanceDiskCollection struct -type InstanceDiskCollection struct { - // Collection of the instance's disks. - Disks []InstanceDisk `json:"disks" validate:"required"` -} - -// UnmarshalInstanceDiskCollection unmarshals an instance of InstanceDiskCollection from the specified map of raw messages. -func UnmarshalInstanceDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceDiskCollection) - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) - if err != nil { - err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceDiskPatch : InstanceDiskPatch struct -type InstanceDiskPatch struct { - // The name for this instance disk. The name must not be used by another disk on the instance. - Name *string `json:"name,omitempty"` -} - -// UnmarshalInstanceDiskPatch unmarshals an instance of InstanceDiskPatch from the specified map of raw messages. -func UnmarshalInstanceDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceDiskPatch) - 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 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()) - } - return -} - -// InstanceDiskReference : InstanceDiskReference struct -type InstanceDiskReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceDiskReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance disk. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance disk. - ID *string `json:"id" validate:"required"` - - // The name for this instance disk. The name is unique across all disks on the instance. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the InstanceDiskReference.ResourceType property. -// The resource type. -const ( - InstanceDiskReferenceResourceTypeInstanceDiskConst = "instance_disk" -) - -// UnmarshalInstanceDiskReference unmarshals an instance of InstanceDiskReference from the specified map of raw messages. -func UnmarshalInstanceDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceDiskReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceDiskReferenceDeleted) - 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 -} - -// InstanceDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceDiskReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceDiskReferenceDeleted unmarshals an instance of InstanceDiskReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceDiskReferenceDeleted) - 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 -} - -// InstanceGpu : The virtual server instance GPU configuration. -type InstanceGpu struct { - // The number of GPUs assigned to the instance. - Count *int64 `json:"count" validate:"required"` - - // The GPU manufacturer. - Manufacturer *string `json:"manufacturer" validate:"required"` - - // The overall amount of GPU memory in GiB (gibibytes). - Memory *int64 `json:"memory" validate:"required"` - - // The GPU model. - Model *string `json:"model" validate:"required"` -} - -// UnmarshalInstanceGpu unmarshals an instance of InstanceGpu from the specified map of raw messages. -func UnmarshalInstanceGpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGpu) - err = core.UnmarshalPrimitive(m, "count", &obj.Count) - if err != nil { - err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) - if err != nil { - err = core.SDKErrorf(err, "", "manufacturer-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) - if err != nil { - err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "model", &obj.Model) - if err != nil { - err = core.SDKErrorf(err, "", "model-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroup : InstanceGroup struct -type InstanceGroup struct { - // The port used for new load balancer pool members created by this instance group. - // - // This property will be present if and only if `load_balancer_pool` is present. - ApplicationPort *int64 `json:"application_port,omitempty"` - - // The date and time that the instance group was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance group. - CRN *string `json:"crn" validate:"required"` - - // The URL for this instance group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group. - ID *string `json:"id" validate:"required"` - - // The template used to create new instances for this group. - InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` - - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []InstanceGroupLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the instance group. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // If present, the load balancer pool this instance group manages. A pool member will - // be created for each instance created by this group. - LoadBalancerPool *LoadBalancerPoolReference `json:"load_balancer_pool,omitempty"` - - // The managers for the instance group. - Managers []InstanceGroupManagerReference `json:"managers" validate:"required"` - - // The number of instances in the instance group. - MembershipCount *int64 `json:"membership_count" validate:"required"` - - // The name for this instance group. The name is unique across all instance groups in the region. - Name *string `json:"name" validate:"required"` - - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The status of the instance group - // - `deleting`: Group is being deleted - // - `healthy`: Group has `membership_count` instances - // - `scaling`: Instances in the group are being created or deleted to reach - // `membership_count` - // - `unhealthy`: Group is unable to reach `membership_count` instances. - Status *string `json:"status" validate:"required"` - - // The subnets to use when creating new instances. - Subnets []SubnetReference `json:"subnets" validate:"required"` - - // The date and time that the instance group was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The VPC the instance group resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// Constants associated with the InstanceGroup.LifecycleState property. -// The lifecycle state of the instance group. -const ( - InstanceGroupLifecycleStateDeletingConst = "deleting" - InstanceGroupLifecycleStateFailedConst = "failed" - InstanceGroupLifecycleStatePendingConst = "pending" - InstanceGroupLifecycleStateStableConst = "stable" - InstanceGroupLifecycleStateSuspendedConst = "suspended" - InstanceGroupLifecycleStateUpdatingConst = "updating" - InstanceGroupLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the InstanceGroup.Status property. -// The status of the instance group -// - `deleting`: Group is being deleted -// - `healthy`: Group has `membership_count` instances -// - `scaling`: Instances in the group are being created or deleted to reach -// `membership_count` -// - `unhealthy`: Group is unable to reach `membership_count` instances. -const ( - InstanceGroupStatusDeletingConst = "deleting" - InstanceGroupStatusHealthyConst = "healthy" - InstanceGroupStatusScalingConst = "scaling" - InstanceGroupStatusUnhealthyConst = "unhealthy" -) - -// UnmarshalInstanceGroup unmarshals an instance of InstanceGroup from the specified map of raw messages. -func UnmarshalInstanceGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroup) - err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) - if err != nil { - err = core.SDKErrorf(err, "", "application_port-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-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, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) - if err != nil { - err = core.SDKErrorf(err, "", "instance_template-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceGroupLifecycleReason) - 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.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolReference) - if err != nil { - err = core.SDKErrorf(err, "", "load_balancer_pool-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManagerReference) - if err != nil { - err = core.SDKErrorf(err, "", "managers-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "membership_count-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-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, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupCollection : InstanceGroupCollection struct -type InstanceGroupCollection struct { - // A link to the first page of resources. - First *InstanceGroupCollectionFirst `json:"first" validate:"required"` - - // Collection of instance groups. - InstanceGroups []InstanceGroup `json:"instance_groups" 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 *InstanceGroupCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "instance_groups", &obj.InstanceGroups, UnmarshalInstanceGroup) - if err != nil { - err = core.SDKErrorf(err, "", "instance_groups-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, UnmarshalInstanceGroupCollectionNext) - 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 *InstanceGroupCollection) 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 -} - -// 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: - // - `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 InstanceGroupLifecycleReason.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 ( - InstanceGroupLifecycleReasonCodeInternalErrorConst = "internal_error" - InstanceGroupLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalInstanceGroupLifecycleReason unmarshals an instance of InstanceGroupLifecycleReason from the specified map of raw messages. -func UnmarshalInstanceGroupLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupLifecycleReason) - 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 -} - -// InstanceGroupManager : InstanceGroupManager struct -// Models which "extend" this model: -// - InstanceGroupManagerAutoScale -// - InstanceGroupManagerScheduled -type InstanceGroupManager struct { - // The date and time that the instance group manager was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager. - ID *string `json:"id" validate:"required"` - - // Indicates whether this manager will control the instance group. - ManagementEnabled *bool `json:"management_enabled" validate:"required"` - - // The name for this instance group manager. The name is unique across all managers for the instance group. - Name *string `json:"name" validate:"required"` - - // The date and time that the instance group manager was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The time window in seconds to aggregate metrics prior to evaluation. - AggregationWindow *int64 `json:"aggregation_window,omitempty"` - - // The duration of time in seconds to pause further scale actions after scaling has taken place. - Cooldown *int64 `json:"cooldown,omitempty"` - - // The type of instance group manager. - ManagerType *string `json:"manager_type,omitempty"` - - // The maximum number of members in a managed instance group. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The minimum number of members in a managed instance group. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The policies of the instance group manager. - Policies []InstanceGroupManagerPolicyReference `json:"policies,omitempty"` - - // The actions of the instance group manager. - Actions []InstanceGroupManagerActionReference `json:"actions,omitempty"` -} - -// Constants associated with the InstanceGroupManager.ManagerType property. -// The type of instance group manager. -const ( - InstanceGroupManagerManagerTypeAutoscaleConst = "autoscale" -) - -func (*InstanceGroupManager) isaInstanceGroupManager() bool { - return true -} - -type InstanceGroupManagerIntf interface { - isaInstanceGroupManager() bool -} - -// UnmarshalInstanceGroupManager unmarshals an instance of InstanceGroupManager from the specified map of raw messages. -func UnmarshalInstanceGroupManager(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManager) - 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, "management_enabled", &obj.ManagementEnabled) - if err != nil { - err = core.SDKErrorf(err, "", "management_enabled-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, "updated_at", &obj.UpdatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) - if err != nil { - err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) - if err != nil { - err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) - if err != nil { - err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) - if err != nil { - err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference) - if err != nil { - err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerAction : InstanceGroupManagerAction struct -// Models which "extend" this model: -// - InstanceGroupManagerActionScheduledAction -type InstanceGroupManagerAction struct { - // Indicates whether this scheduled action will be automatically deleted after it has completed and - // `auto_delete_timeout` hours have passed. 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`, and this scheduled action has finished, the hours after which it will be automatically - // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the - // future. - AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` - - // The date and time that the instance group manager action was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager action. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager action. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager action. The name is unique across all actions for the instance group - // manager. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the instance group action - // - `active`: Action is ready to be run - // - `completed`: Action was completed successfully - // - `failed`: Action could not be completed successfully - // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. - Status *string `json:"status" validate:"required"` - - // The date and time that the instance group manager action was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The type of action for the instance group. - ActionType *string `json:"action_type,omitempty"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - // The date and time the scheduled action was last applied. If absent, the action has never been applied. - LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` - - // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run - // time. - NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroup `json:"group,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager,omitempty"` -} - -// Constants associated with the InstanceGroupManagerAction.ResourceType property. -// The resource type. -const ( - InstanceGroupManagerActionResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" -) - -// Constants associated with the InstanceGroupManagerAction.Status property. -// The status of the instance group action -// - `active`: Action is ready to be run -// - `completed`: Action was completed successfully -// - `failed`: Action could not be completed successfully -// - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. -const ( - InstanceGroupManagerActionStatusActiveConst = "active" - InstanceGroupManagerActionStatusCompletedConst = "completed" - InstanceGroupManagerActionStatusFailedConst = "failed" - InstanceGroupManagerActionStatusIncompatibleConst = "incompatible" - InstanceGroupManagerActionStatusOmittedConst = "omitted" -) - -// Constants associated with the InstanceGroupManagerAction.ActionType property. -// The type of action for the instance group. -const ( - InstanceGroupManagerActionActionTypeScheduledConst = "scheduled" -) - -func (*InstanceGroupManagerAction) isaInstanceGroupManagerAction() bool { - return true -} - -type InstanceGroupManagerActionIntf interface { - isaInstanceGroupManagerAction() bool -} - -// UnmarshalInstanceGroupManagerAction unmarshals an instance of InstanceGroupManagerAction from the specified map of raw messages. -func UnmarshalInstanceGroupManagerAction(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerAction) - 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_timeout", &obj.AutoDeleteTimeout) - if err != nil { - err = core.SDKErrorf(err, "", "auto_delete_timeout-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, "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, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) - if err != nil { - err = core.SDKErrorf(err, "", "action_type-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.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) - if err != nil { - err = core.SDKErrorf(err, "", "last_applied_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) - if err != nil { - err = core.SDKErrorf(err, "", "next_run_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) - if err != nil { - err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) - if err != nil { - err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionGroupPatch : InstanceGroupManagerActionGroupPatch struct -type InstanceGroupManagerActionGroupPatch struct { - // The desired number of instance group members at the scheduled time. - MembershipCount *int64 `json:"membership_count,omitempty"` -} - -// UnmarshalInstanceGroupManagerActionGroupPatch unmarshals an instance of InstanceGroupManagerActionGroupPatch from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionGroupPatch) - err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "membership_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionManagerPatch : InstanceGroupManagerActionManagerPatch struct -type InstanceGroupManagerActionManagerPatch struct { - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` -} - -// UnmarshalInstanceGroupManagerActionManagerPatch unmarshals an instance of InstanceGroupManagerActionManagerPatch from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionManagerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionManagerPatch) - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPatch : InstanceGroupManagerActionPatch struct -type InstanceGroupManagerActionPatch struct { - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - Group *InstanceGroupManagerActionGroupPatch `json:"group,omitempty"` - - Manager *InstanceGroupManagerActionManagerPatch `json:"manager,omitempty"` - - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. - Name *string `json:"name,omitempty"` - - // The date and time the scheduled action will run. - RunAt *strfmt.DateTime `json:"run_at,omitempty"` -} - -// UnmarshalInstanceGroupManagerActionPatch unmarshals an instance of InstanceGroupManagerActionPatch from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPatch) - 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, "group", &obj.Group, UnmarshalInstanceGroupManagerActionGroupPatch) - if err != nil { - err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerActionManagerPatch) - if err != nil { - err = core.SDKErrorf(err, "", "manager-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, "run_at", &obj.RunAt) - if err != nil { - err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// InstanceGroupManagerActionPrototype : InstanceGroupManagerActionPrototype struct -// Models which "extend" this model: -// - InstanceGroupManagerActionPrototypeScheduledActionPrototype -type InstanceGroupManagerActionPrototype struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The date and time the scheduled action will run. - RunAt *strfmt.DateTime `json:"run_at,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` -} - -func (*InstanceGroupManagerActionPrototype) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -type InstanceGroupManagerActionPrototypeIntf interface { - isaInstanceGroupManagerActionPrototype() bool -} - -// UnmarshalInstanceGroupManagerActionPrototype unmarshals an instance of InstanceGroupManagerActionPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) - if err != nil { - err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "manager-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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionReference : InstanceGroupManagerActionReference struct -type InstanceGroupManagerActionReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceGroupManagerActionReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance group manager action. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager action. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager action. The name is unique across all actions for the instance group - // manager. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerActionReference.ResourceType property. -// The resource type. -const ( - InstanceGroupManagerActionReferenceResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" -) - -// UnmarshalInstanceGroupManagerActionReference unmarshals an instance of InstanceGroupManagerActionReference from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerActionReferenceDeleted) - 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 -} - -// InstanceGroupManagerActionReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceGroupManagerActionReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceGroupManagerActionReferenceDeleted unmarshals an instance of InstanceGroupManagerActionReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionReferenceDeleted) - 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 -} - -// InstanceGroupManagerActionsCollection : InstanceGroupManagerActionsCollection struct -type InstanceGroupManagerActionsCollection struct { - // Collection of instance group manager actions. - Actions []InstanceGroupManagerActionIntf `json:"actions" validate:"required"` - - // A link to the first page of resources. - First *InstanceGroupManagerActionsCollectionFirst `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"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalInstanceGroupManagerActionsCollection unmarshals an instance of InstanceGroupManagerActionsCollection from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionsCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionsCollection) - err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerAction) - if err != nil { - err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerActionsCollectionFirst) - 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, UnmarshalInstanceGroupManagerActionsCollectionNext) - 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 *InstanceGroupManagerActionsCollection) 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 -} - -// 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"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // Collection of instance group managers. - Managers []InstanceGroupManagerIntf `json:"managers" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *InstanceGroupManagerCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, "managers", &obj.Managers, UnmarshalInstanceGroupManager) - if err != nil { - err = core.SDKErrorf(err, "", "managers-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerCollectionNext) - 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 *InstanceGroupManagerCollection) 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 -} - -// 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. - AggregationWindow *int64 `json:"aggregation_window,omitempty"` - - // The duration of time in seconds to pause further scale actions after scaling has taken place. - Cooldown *int64 `json:"cooldown,omitempty"` - - // Indicates whether this manager will control the instance group. - ManagementEnabled *bool `json:"management_enabled,omitempty"` - - // The maximum number of members in a managed instance group. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The minimum number of members in a managed instance group. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The name for this instance group manager. The name must not be used by another manager for the instance group. - Name *string `json:"name,omitempty"` -} - -// UnmarshalInstanceGroupManagerPatch unmarshals an instance of InstanceGroupManagerPatch from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPatch) - err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) - if err != nil { - err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) - if err != nil { - err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) - if err != nil { - err = core.SDKErrorf(err, "", "management_enabled-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "min_membership_count-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 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// InstanceGroupManagerPolicy : InstanceGroupManagerPolicy struct -// Models which "extend" this model: -// - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy -type InstanceGroupManagerPolicy struct { - // The date and time that the instance group manager policy was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager policy. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager policy. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager policy. The name is unique across all policies for the instance group - // manager. - Name *string `json:"name" validate:"required"` - - // The date and time that the instance group manager policy was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The type of metric to be evaluated. - MetricType *string `json:"metric_type,omitempty"` - - // The metric value to be evaluated. - MetricValue *int64 `json:"metric_value,omitempty"` - - // The type of policy for the instance group. - PolicyType *string `json:"policy_type,omitempty"` -} - -// Constants associated with the InstanceGroupManagerPolicy.MetricType property. -// The type of metric to be evaluated. -const ( - InstanceGroupManagerPolicyMetricTypeCpuConst = "cpu" - InstanceGroupManagerPolicyMetricTypeMemoryConst = "memory" - InstanceGroupManagerPolicyMetricTypeNetworkInConst = "network_in" - InstanceGroupManagerPolicyMetricTypeNetworkOutConst = "network_out" -) - -// Constants associated with the InstanceGroupManagerPolicy.PolicyType property. -// The type of policy for the instance group. -const ( - InstanceGroupManagerPolicyPolicyTypeTargetConst = "target" -) - -func (*InstanceGroupManagerPolicy) isaInstanceGroupManagerPolicy() bool { - return true -} - -type InstanceGroupManagerPolicyIntf interface { - isaInstanceGroupManagerPolicy() bool -} - -// UnmarshalInstanceGroupManagerPolicy unmarshals an instance of InstanceGroupManagerPolicy from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicy) - 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, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) - if err != nil { - err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) - if err != nil { - err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) - if err != nil { - err = core.SDKErrorf(err, "", "policy_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPolicyCollection : InstanceGroupManagerPolicyCollection struct -type InstanceGroupManagerPolicyCollection struct { - // A link to the first page of resources. - First *InstanceGroupManagerPolicyCollectionFirst `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"` - - // Collection of instance group manager policies. - Policies []InstanceGroupManagerPolicyIntf `json:"policies" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalInstanceGroupManagerPolicyCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "policies-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 *InstanceGroupManagerPolicyCollection) 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 -} - -// 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. - MetricType *string `json:"metric_type,omitempty"` - - // The metric value to be evaluated. - MetricValue *int64 `json:"metric_value,omitempty"` - - // The name for this instance group manager policy. The name must not be used by another policy for the instance group - // manager. - Name *string `json:"name,omitempty"` -} - -// Constants associated with the InstanceGroupManagerPolicyPatch.MetricType property. -// The type of metric to be evaluated. -const ( - InstanceGroupManagerPolicyPatchMetricTypeCpuConst = "cpu" - InstanceGroupManagerPolicyPatchMetricTypeMemoryConst = "memory" - InstanceGroupManagerPolicyPatchMetricTypeNetworkInConst = "network_in" - InstanceGroupManagerPolicyPatchMetricTypeNetworkOutConst = "network_out" -) - -// UnmarshalInstanceGroupManagerPolicyPatch unmarshals an instance of InstanceGroupManagerPolicyPatch from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyPatch) - err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) - if err != nil { - err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) - if err != nil { - err = core.SDKErrorf(err, "", "metric_value-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 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// InstanceGroupManagerPolicyPrototype : InstanceGroupManagerPolicyPrototype struct -// Models which "extend" this model: -// - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype -type InstanceGroupManagerPolicyPrototype struct { - // The name for this instance group manager policy. The name must not be used by another policy for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The type of metric to be evaluated. - MetricType *string `json:"metric_type,omitempty"` - - // The metric value to be evaluated. - MetricValue *int64 `json:"metric_value,omitempty"` - - // The type of policy for the instance group. - PolicyType *string `json:"policy_type,omitempty"` -} - -// Constants associated with the InstanceGroupManagerPolicyPrototype.MetricType property. -// The type of metric to be evaluated. -const ( - InstanceGroupManagerPolicyPrototypeMetricTypeCpuConst = "cpu" - InstanceGroupManagerPolicyPrototypeMetricTypeMemoryConst = "memory" - InstanceGroupManagerPolicyPrototypeMetricTypeNetworkInConst = "network_in" - InstanceGroupManagerPolicyPrototypeMetricTypeNetworkOutConst = "network_out" -) - -// Constants associated with the InstanceGroupManagerPolicyPrototype.PolicyType property. -// The type of policy for the instance group. -const ( - InstanceGroupManagerPolicyPrototypePolicyTypeTargetConst = "target" -) - -func (*InstanceGroupManagerPolicyPrototype) isaInstanceGroupManagerPolicyPrototype() bool { - return true -} - -type InstanceGroupManagerPolicyPrototypeIntf interface { - isaInstanceGroupManagerPolicyPrototype() bool -} - -// UnmarshalInstanceGroupManagerPolicyPrototype unmarshals an instance of InstanceGroupManagerPolicyPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) - if err != nil { - err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) - if err != nil { - err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) - if err != nil { - err = core.SDKErrorf(err, "", "policy_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPolicyReference : InstanceGroupManagerPolicyReference struct -type InstanceGroupManagerPolicyReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceGroupManagerPolicyReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance group manager policy. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager policy. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager policy. The name is unique across all policies for the instance group - // manager. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalInstanceGroupManagerPolicyReference unmarshals an instance of InstanceGroupManagerPolicyReference from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerPolicyReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceGroupManagerPolicyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceGroupManagerPolicyReferenceDeleted unmarshals an instance of InstanceGroupManagerPolicyReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyReferenceDeleted) - 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 -} - -// InstanceGroupManagerPrototype : InstanceGroupManagerPrototype struct -// Models which "extend" this model: -// - InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype -// - InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype -type InstanceGroupManagerPrototype struct { - // Indicates whether this manager will control the instance group. - ManagementEnabled *bool `json:"management_enabled,omitempty"` - - // The name for this instance group manager. The name must not be used by another manager for the instance group. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The time window in seconds to aggregate metrics prior to evaluation. - AggregationWindow *int64 `json:"aggregation_window,omitempty"` - - // The duration of time in seconds to pause further scale actions after scaling has taken place. - Cooldown *int64 `json:"cooldown,omitempty"` - - // The type of instance group manager. - ManagerType *string `json:"manager_type,omitempty"` - - // The maximum number of members in a managed instance group. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The minimum number of members in a managed instance group. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` -} - -// Constants associated with the InstanceGroupManagerPrototype.ManagerType property. -// The type of instance group manager. -const ( - InstanceGroupManagerPrototypeManagerTypeAutoscaleConst = "autoscale" -) - -func (*InstanceGroupManagerPrototype) isaInstanceGroupManagerPrototype() bool { - return true -} - -type InstanceGroupManagerPrototypeIntf interface { - isaInstanceGroupManagerPrototype() bool -} - -// UnmarshalInstanceGroupManagerPrototype unmarshals an instance of InstanceGroupManagerPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPrototype) - err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) - if err != nil { - err = core.SDKErrorf(err, "", "management_enabled-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, "aggregation_window", &obj.AggregationWindow) - if err != nil { - err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) - if err != nil { - err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) - if err != nil { - err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerReference : InstanceGroupManagerReference struct -type InstanceGroupManagerReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance group manager. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager. The name is unique across all managers for the instance group. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalInstanceGroupManagerReference unmarshals an instance of InstanceGroupManagerReference from the specified map of raw messages. -func UnmarshalInstanceGroupManagerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceGroupManagerReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceGroupManagerReferenceDeleted unmarshals an instance of InstanceGroupManagerReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceGroupManagerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerReferenceDeleted) - 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 -} - -// InstanceGroupManagerScheduledActionGroup : InstanceGroupManagerScheduledActionGroup struct -type InstanceGroupManagerScheduledActionGroup struct { - // The desired number of instance group members at the scheduled time. - MembershipCount *int64 `json:"membership_count" validate:"required"` -} - -// UnmarshalInstanceGroupManagerScheduledActionGroup unmarshals an instance of InstanceGroupManagerScheduledActionGroup from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionGroup) - err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "membership_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionGroupPrototype : InstanceGroupManagerScheduledActionGroupPrototype struct -type InstanceGroupManagerScheduledActionGroupPrototype struct { - // The desired number of instance group members at the scheduled time. - MembershipCount *int64 `json:"membership_count" validate:"required"` -} - -// NewInstanceGroupManagerScheduledActionGroupPrototype : Instantiate InstanceGroupManagerScheduledActionGroupPrototype (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerScheduledActionGroupPrototype(membershipCount int64) (_model *InstanceGroupManagerScheduledActionGroupPrototype, err error) { - _model = &InstanceGroupManagerScheduledActionGroupPrototype{ - MembershipCount: core.Int64Ptr(membershipCount), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalInstanceGroupManagerScheduledActionGroupPrototype unmarshals an instance of InstanceGroupManagerScheduledActionGroupPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionGroupPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionGroupPrototype) - err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "membership_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManager : InstanceGroupManagerScheduledActionManager struct -// Models which "extend" this model: -// - InstanceGroupManagerScheduledActionManagerAutoScale -type InstanceGroupManagerScheduledActionManager struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance group manager. - Href *string `json:"href,omitempty"` - - // The unique identifier for this instance group manager. - ID *string `json:"id,omitempty"` - - // The name for this instance group manager. The name is unique across all managers for the instance group. - Name *string `json:"name,omitempty"` - - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` -} - -func (*InstanceGroupManagerScheduledActionManager) isaInstanceGroupManagerScheduledActionManager() bool { - return true -} - -type InstanceGroupManagerScheduledActionManagerIntf interface { - isaInstanceGroupManagerScheduledActionManager() bool -} - -// UnmarshalInstanceGroupManagerScheduledActionManager unmarshals an instance of InstanceGroupManagerScheduledActionManager from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManager(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManager) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) - 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, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManagerPrototype : InstanceGroupManagerScheduledActionManagerPrototype struct -// Models which "extend" this model: -// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype -type InstanceGroupManagerScheduledActionManagerPrototype struct { - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The unique identifier for this instance group manager. - ID *string `json:"id,omitempty"` - - // The URL for this instance group manager. - Href *string `json:"href,omitempty"` -} - -func (*InstanceGroupManagerScheduledActionManagerPrototype) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { - return true -} - -type InstanceGroupManagerScheduledActionManagerPrototypeIntf interface { - isaInstanceGroupManagerScheduledActionManagerPrototype() bool -} - -// UnmarshalInstanceGroupManagerScheduledActionManagerPrototype unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManagerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManagerPrototype) - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "min_membership_count-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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupMembership : InstanceGroupMembership struct -type InstanceGroupMembership struct { - // The date and time that the instance group manager policy was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // If set to true, when deleting the membership the instance will also be deleted. - DeleteInstanceOnMembershipDelete *bool `json:"delete_instance_on_membership_delete" validate:"required"` - - // The URL for this instance group membership. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group membership. - ID *string `json:"id" validate:"required"` - - Instance *InstanceReference `json:"instance" validate:"required"` - - InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` - - // The name for this instance group membership. The name is unique across all memberships for the instance group. - Name *string `json:"name" validate:"required"` - - PoolMember *LoadBalancerPoolMemberReference `json:"pool_member,omitempty"` - - // The status of the instance group membership - // - `deleting`: Membership is deleting dependent resources - // - `failed`: Membership was unable to maintain dependent resources - // - `healthy`: Membership is active and serving in the group - // - `pending`: Membership is waiting for dependent resources - // - `unhealthy`: Membership has unhealthy dependent resources. - Status *string `json:"status" validate:"required"` - - // The date and time that the instance group membership was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` -} - -// Constants associated with the InstanceGroupMembership.Status property. -// The status of the instance group membership -// - `deleting`: Membership is deleting dependent resources -// - `failed`: Membership was unable to maintain dependent resources -// - `healthy`: Membership is active and serving in the group -// - `pending`: Membership is waiting for dependent resources -// - `unhealthy`: Membership has unhealthy dependent resources. -const ( - InstanceGroupMembershipStatusDeletingConst = "deleting" - InstanceGroupMembershipStatusFailedConst = "failed" - InstanceGroupMembershipStatusHealthyConst = "healthy" - InstanceGroupMembershipStatusPendingConst = "pending" - InstanceGroupMembershipStatusUnhealthyConst = "unhealthy" -) - -// UnmarshalInstanceGroupMembership unmarshals an instance of InstanceGroupMembership from the specified map of raw messages. -func UnmarshalInstanceGroupMembership(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupMembership) - 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, "delete_instance_on_membership_delete", &obj.DeleteInstanceOnMembershipDelete) - if err != nil { - err = core.SDKErrorf(err, "", "delete_instance_on_membership_delete-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, "instance", &obj.Instance, UnmarshalInstanceReference) - if err != nil { - err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) - if err != nil { - err = core.SDKErrorf(err, "", "instance_template-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, "pool_member", &obj.PoolMember, UnmarshalLoadBalancerPoolMemberReference) - if err != nil { - err = core.SDKErrorf(err, "", "pool_member-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.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupMembershipCollection : InstanceGroupMembershipCollection struct -type InstanceGroupMembershipCollection struct { - // A link to the first page of resources. - First *InstanceGroupMembershipCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // Collection of instance group memberships. - Memberships []InstanceGroupMembership `json:"memberships" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *InstanceGroupMembershipCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, "memberships", &obj.Memberships, UnmarshalInstanceGroupMembership) - if err != nil { - err = core.SDKErrorf(err, "", "memberships-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupMembershipCollectionNext) - 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 *InstanceGroupMembershipCollection) 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 -} - -// 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 { - // The name for this instance group membership. The name must not be used by another membership for the instance group - // manager. - Name *string `json:"name,omitempty"` -} - -// UnmarshalInstanceGroupMembershipPatch unmarshals an instance of InstanceGroupMembershipPatch from the specified map of raw messages. -func UnmarshalInstanceGroupMembershipPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupMembershipPatch) - 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 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// InstanceGroupPatch : To add or update load balancer specification for an instance group the `membership_count` must first be set to 0. -type InstanceGroupPatch struct { - // The port to use for new load balancer pool members created by this instance group. - // - // This property must be set if and only if `load_balancer_pool` has been set. - ApplicationPort *int64 `json:"application_port,omitempty"` - - // Instance template to use when creating new instances. - // - // Instance groups are not compatible with instance templates that specify `true` for - // `default_trusted_profile.auto_link`. - InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template,omitempty"` - - // The load balancer associated with `load_balancer_pool`. - // The load balancer must have `instance_groups_supported` set to `true`. - // - // This property must be set if and only if `load_balancer_pool` has been set. - LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` - - // If specified, this instance group will manage the load balancer pool. A pool member - // will be created for each instance created by this group. The specified load - // balancer pool must not be used by another instance group in the VPC. - // - // If set, `load_balancer` and `application_port` must also be set. - LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"` - - // The number of instances in the instance group. - MembershipCount *int64 `json:"membership_count,omitempty"` - - // The name for this instance group. The name must not be used by another instance group in the region. - Name *string `json:"name,omitempty"` - - // The subnets to use when creating new instances. - Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` -} - -// UnmarshalInstanceGroupPatch unmarshals an instance of InstanceGroupPatch from the specified map of raw messages. -func UnmarshalInstanceGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupPatch) - err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) - if err != nil { - err = core.SDKErrorf(err, "", "application_port-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "instance_template-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "load_balancer", &obj.LoadBalancer, UnmarshalLoadBalancerIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "load_balancer-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "load_balancer_pool-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "membership_count-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, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// InstanceGroupReference : InstanceGroupReference struct -type InstanceGroupReference struct { - // The CRN for this instance group. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceGroupReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group. - ID *string `json:"id" validate:"required"` - - // The name for this instance group. The name is unique across all instance groups in the region. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalInstanceGroupReference unmarshals an instance of InstanceGroupReference from the specified map of raw messages. -func UnmarshalInstanceGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupReference) - 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, UnmarshalInstanceGroupReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceGroupReferenceDeleted unmarshals an instance of InstanceGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupReferenceDeleted) - 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 -} - -// InstanceHealthReason : InstanceHealthReason struct -type InstanceHealthReason struct { - // A reason code for this health state: - // - `reservation_capacity_unavailable`: The reservation affinity pool has no - // available capacity. - // - `reservation_deleted`: The reservation affinity pool has a deleted reservation. - // - `reservation_expired`: The reservation affinity pool has an expired reservation. - // - `reservation_failed`: The reservation affinity pool has a failed reservation. - // - // 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 health state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this health state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the InstanceHealthReason.Code property. -// A reason code for this health state: -// - `reservation_capacity_unavailable`: The reservation affinity pool has no -// available capacity. -// - `reservation_deleted`: The reservation affinity pool has a deleted reservation. -// - `reservation_expired`: The reservation affinity pool has an expired reservation. -// - `reservation_failed`: The reservation affinity pool has a failed reservation. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - InstanceHealthReasonCodeReservationCapacityUnavailableConst = "reservation_capacity_unavailable" - InstanceHealthReasonCodeReservationDeletedConst = "reservation_deleted" - InstanceHealthReasonCodeReservationExpiredConst = "reservation_expired" - InstanceHealthReasonCodeReservationFailedConst = "reservation_failed" -) - -// UnmarshalInstanceHealthReason unmarshals an instance of InstanceHealthReason from the specified map of raw messages. -func UnmarshalInstanceHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceHealthReason) - 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 -} - -// InstanceInitialization : InstanceInitialization struct -type InstanceInitialization struct { - // The default trusted profile configuration specified at virtual server instance - // creation. If absent, no default trusted profile was specified. - DefaultTrustedProfile *InstanceInitializationDefaultTrustedProfile `json:"default_trusted_profile,omitempty"` - - // The public SSH keys used at instance initialization. - Keys []KeyReference `json:"keys" validate:"required"` - - Password *InstanceInitializationPassword `json:"password,omitempty"` -} - -// UnmarshalInstanceInitialization unmarshals an instance of InstanceInitialization from the specified map of raw messages. -func UnmarshalInstanceInitialization(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceInitialization) - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceInitializationDefaultTrustedProfile) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) - if err != nil { - err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "password", &obj.Password, UnmarshalInstanceInitializationPassword) - if err != nil { - err = core.SDKErrorf(err, "", "password-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceInitializationDefaultTrustedProfile : InstanceInitializationDefaultTrustedProfile struct -type InstanceInitializationDefaultTrustedProfile struct { - // If set to `true`, the system created a link to the specified `target` trusted profile during instance creation. - // Regardless of whether a link was created by the system or manually using the IAM Identity service, it will be - // automatically deleted when the instance is deleted. - AutoLink *bool `json:"auto_link" validate:"required"` - - // The default IAM trusted profile to use for this virtual server instance. - Target *TrustedProfileReference `json:"target" validate:"required"` -} - -// UnmarshalInstanceInitializationDefaultTrustedProfile unmarshals an instance of InstanceInitializationDefaultTrustedProfile from the specified map of raw messages. -func UnmarshalInstanceInitializationDefaultTrustedProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceInitializationDefaultTrustedProfile) - err = core.UnmarshalPrimitive(m, "auto_link", &obj.AutoLink) - if err != nil { - err = core.SDKErrorf(err, "", "auto_link-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalTrustedProfileReference) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceInitializationPassword : InstanceInitializationPassword struct -type InstanceInitializationPassword struct { - // The administrator password at initialization, encrypted using `encryption_key`, and returned base64-encoded. - EncryptedPassword *[]byte `json:"encrypted_password" validate:"required"` - - // The public SSH key used to encrypt the administrator password. - EncryptionKey *KeyIdentityByFingerprint `json:"encryption_key" validate:"required"` -} - -// UnmarshalInstanceInitializationPassword unmarshals an instance of InstanceInitializationPassword from the specified map of raw messages. -func UnmarshalInstanceInitializationPassword(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceInitializationPassword) - err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) - if err != nil { - err = core.SDKErrorf(err, "", "encrypted_password-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyIdentityByFingerprint) - if err != nil { - err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceLifecycleReason : InstanceLifecycleReason struct -type InstanceLifecycleReason 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 InstanceLifecycleReason.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 ( - InstanceLifecycleReasonCodeInternalErrorConst = "internal_error" - InstanceLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalInstanceLifecycleReason unmarshals an instance of InstanceLifecycleReason from the specified map of raw messages. -func UnmarshalInstanceLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceLifecycleReason) - 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 -} - -// InstanceMetadataService : The metadata service configuration. -type InstanceMetadataService struct { - // Indicates whether the metadata service endpoint is available to the virtual server instance. - Enabled *bool `json:"enabled" validate:"required"` - - // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is - // enabled. - // - `http`: HTTP protocol (unencrypted) - // - `https`: HTTP Secure protocol. - Protocol *string `json:"protocol" validate:"required"` - - // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata - // service is enabled. - ResponseHopLimit *int64 `json:"response_hop_limit" validate:"required"` -} - -// Constants associated with the InstanceMetadataService.Protocol property. -// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is -// enabled. -// - `http`: HTTP protocol (unencrypted) -// - `https`: HTTP Secure protocol. -const ( - InstanceMetadataServiceProtocolHTTPConst = "http" - InstanceMetadataServiceProtocolHTTPSConst = "https" -) - -// UnmarshalInstanceMetadataService unmarshals an instance of InstanceMetadataService from the specified map of raw messages. -func UnmarshalInstanceMetadataService(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceMetadataService) - err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) - if err != nil { - err = core.SDKErrorf(err, "", "enabled-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.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) - if err != nil { - err = core.SDKErrorf(err, "", "response_hop_limit-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceMetadataServicePatch : The metadata service configuration. -type InstanceMetadataServicePatch struct { - // Indicates whether the metadata service endpoint will be available to the virtual server instance. - Enabled *bool `json:"enabled,omitempty"` - - // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is - // enabled. - // - `http`: HTTP protocol (unencrypted) - // - `https`: HTTP Secure protocol. - Protocol *string `json:"protocol,omitempty"` - - // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata - // service is enabled. - ResponseHopLimit *int64 `json:"response_hop_limit,omitempty"` -} - -// Constants associated with the InstanceMetadataServicePatch.Protocol property. -// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is -// enabled. -// - `http`: HTTP protocol (unencrypted) -// - `https`: HTTP Secure protocol. -const ( - InstanceMetadataServicePatchProtocolHTTPConst = "http" - InstanceMetadataServicePatchProtocolHTTPSConst = "https" -) - -// UnmarshalInstanceMetadataServicePatch unmarshals an instance of InstanceMetadataServicePatch from the specified map of raw messages. -func UnmarshalInstanceMetadataServicePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceMetadataServicePatch) - err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) - if err != nil { - err = core.SDKErrorf(err, "", "enabled-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.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) - if err != nil { - err = core.SDKErrorf(err, "", "response_hop_limit-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceMetadataServicePrototype : The metadata service configuration. -type InstanceMetadataServicePrototype struct { - // Indicates whether the metadata service endpoint will be available to the virtual server instance. - Enabled *bool `json:"enabled,omitempty"` - - // The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is - // enabled. - // - `http`: HTTP protocol (unencrypted) - // - `https`: HTTP Secure protocol. - Protocol *string `json:"protocol,omitempty"` - - // The hop limit (IP time to live) for IP response packets from the metadata service. Applies only when the metadata - // service is enabled. - ResponseHopLimit *int64 `json:"response_hop_limit,omitempty"` -} - -// Constants associated with the InstanceMetadataServicePrototype.Protocol property. -// The communication protocol to use for the metadata service endpoint. Applies only when the metadata service is -// enabled. -// - `http`: HTTP protocol (unencrypted) -// - `https`: HTTP Secure protocol. -const ( - InstanceMetadataServicePrototypeProtocolHTTPConst = "http" - InstanceMetadataServicePrototypeProtocolHTTPSConst = "https" -) - -// UnmarshalInstanceMetadataServicePrototype unmarshals an instance of InstanceMetadataServicePrototype from the specified map of raw messages. -func UnmarshalInstanceMetadataServicePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceMetadataServicePrototype) - err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) - if err != nil { - err = core.SDKErrorf(err, "", "enabled-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.UnmarshalPrimitive(m, "response_hop_limit", &obj.ResponseHopLimit) - if err != nil { - err = core.SDKErrorf(err, "", "response_hop_limit-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachment : InstanceNetworkAttachment struct -type InstanceNetworkAttachment struct { - // The date and time that the instance network attachment was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance network attachment. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the instance network attachment. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this instance network attachment. The name is unique across all network attachments for the instance. - Name *string `json:"name" validate:"required"` - - // The port speed for this instance network attachment in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` - - // The primary IP address of the virtual network interface for the instance 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 instance network attachment. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The instance network attachment type. - Type *string `json:"type" validate:"required"` - - // The virtual network interface for this instance network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` -} - -// Constants associated with the InstanceNetworkAttachment.LifecycleState property. -// The lifecycle state of the instance network attachment. -const ( - InstanceNetworkAttachmentLifecycleStateDeletingConst = "deleting" - InstanceNetworkAttachmentLifecycleStateFailedConst = "failed" - InstanceNetworkAttachmentLifecycleStatePendingConst = "pending" - InstanceNetworkAttachmentLifecycleStateStableConst = "stable" - InstanceNetworkAttachmentLifecycleStateSuspendedConst = "suspended" - InstanceNetworkAttachmentLifecycleStateUpdatingConst = "updating" - InstanceNetworkAttachmentLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the InstanceNetworkAttachment.ResourceType property. -// The resource type. -const ( - InstanceNetworkAttachmentResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" -) - -// Constants associated with the InstanceNetworkAttachment.Type property. -// The instance network attachment type. -const ( - InstanceNetworkAttachmentTypePrimaryConst = "primary" - InstanceNetworkAttachmentTypeSecondaryConst = "secondary" -) - -// UnmarshalInstanceNetworkAttachment unmarshals an instance of InstanceNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachment) - 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, "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, "port_speed", &obj.PortSpeed) - if err != nil { - err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "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.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-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 -} - -// InstanceNetworkAttachmentCollection : InstanceNetworkAttachmentCollection struct -type InstanceNetworkAttachmentCollection struct { - // Collection of instance network attachments. - NetworkAttachments []InstanceNetworkAttachment `json:"network_attachments" validate:"required"` -} - -// UnmarshalInstanceNetworkAttachmentCollection unmarshals an instance of InstanceNetworkAttachmentCollection from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentCollection) - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachmentPatch : InstanceNetworkAttachmentPatch struct -type InstanceNetworkAttachmentPatch struct { - // The name for this network attachment. The name must not be used by another network attachment for the instance. - Name *string `json:"name,omitempty"` -} - -// UnmarshalInstanceNetworkAttachmentPatch unmarshals an instance of InstanceNetworkAttachmentPatch from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPatch) - 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 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()) - } - return -} - -// InstanceNetworkAttachmentPrototype : InstanceNetworkAttachmentPrototype struct -type InstanceNetworkAttachmentPrototype struct { - // The name for this network attachment. Names must be unique within the instance 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 instance 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, `enable_infrastructure_nat` must be - // `true`. - VirtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" validate:"required"` -} - -// NewInstanceNetworkAttachmentPrototype : Instantiate InstanceNetworkAttachmentPrototype (Generic Model Constructor) -func (*VpcV1) NewInstanceNetworkAttachmentPrototype(virtualNetworkInterface InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) (_model *InstanceNetworkAttachmentPrototype, err error) { - _model = &InstanceNetworkAttachmentPrototype{ - VirtualNetworkInterface: virtualNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalInstanceNetworkAttachmentPrototype unmarshals an instance of InstanceNetworkAttachmentPrototype from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachmentPrototypeVirtualNetworkInterface : A virtual network interface for the instance 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, `enable_infrastructure_nat` must be -// `true`. -// Models which "extend" this model: -// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext -// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterface 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"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. - AutoDelete *bool `json:"auto_delete,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"` - - // 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"` - - // 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 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"` - - // The resource group to use for this virtual network interface. If unspecified, the - // virtual server instance's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,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"` -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf interface { - isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool -} - -// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) - 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 - } - 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.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) - 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()) - 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 -} - -// InstanceNetworkAttachmentReference : InstanceNetworkAttachmentReference struct -type InstanceNetworkAttachmentReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance network attachment. - ID *string `json:"id" validate:"required"` - - // The name for this instance network attachment. The name is unique across all network attachments for the instance. - Name *string `json:"name" validate:"required"` - - // The primary IP address of the virtual network interface for the instance 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 instance network attachment. - Subnet *SubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the InstanceNetworkAttachmentReference.ResourceType property. -// The resource type. -const ( - InstanceNetworkAttachmentReferenceResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" -) - -// UnmarshalInstanceNetworkAttachmentReference unmarshals an instance of InstanceNetworkAttachmentReference from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) - 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachmentReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceNetworkAttachmentReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceNetworkAttachmentReferenceDeleted unmarshals an instance of InstanceNetworkAttachmentReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentReferenceDeleted) - 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 -} - -// InstancePatch : InstancePatch struct -type InstancePatch struct { - // The availability policy for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPatch `json:"availability_policy,omitempty"` - - // The metadata service configuration. - MetadataService *InstanceMetadataServicePatch `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance in the - // region. Changing the name will not affect the system hostname. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. For the placement - // restrictions to be changed, the instance `status` must be `stopping` or `stopped`. - // - // 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. - // - 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`. - // - Have the same `vcpu.architecture`. - // - Support the number of network attachments or network interfaces the instance - // currently has. - Profile InstancePatchProfileIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPatch `json:"reservation_affinity,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` -} - -// UnmarshalInstancePatch unmarshals an instance of InstancePatch from the specified map of raw messages. -func UnmarshalInstancePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePatch) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPatch) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePatch) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPatch) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstancePatchProfile) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPatch) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - 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. -// - 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`. -// - Have the same `vcpu.architecture`. -// - Support the number of network attachments or network interfaces the instance -// currently has. -// -// Models which "extend" this model: -// - InstancePatchProfileInstanceProfileIdentityByName -// - InstancePatchProfileInstanceProfileIdentityByHref -type InstancePatchProfile struct { - // The globally unique name for this virtual server instance profile. - Name *string `json:"name,omitempty"` - - // The URL for this virtual server instance profile. - Href *string `json:"href,omitempty"` -} - -func (*InstancePatchProfile) isaInstancePatchProfile() bool { - return true -} - -type InstancePatchProfileIntf interface { - isaInstancePatchProfile() bool -} - -// UnmarshalInstancePatchProfile unmarshals an instance of InstancePatchProfile from the specified map of raw messages. -func UnmarshalInstancePatchProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePatchProfile) - 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 -} - -// InstancePlacementTarget : InstancePlacementTarget struct -// Models which "extend" this model: -// - InstancePlacementTargetDedicatedHostGroupReference -// - InstancePlacementTargetDedicatedHostReference -// - InstancePlacementTargetPlacementGroupReference -type InstancePlacementTarget struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this dedicated host group. - Href *string `json:"href,omitempty"` - - // The unique identifier for this dedicated host group. - ID *string `json:"id,omitempty"` - - // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the InstancePlacementTarget.ResourceType property. -// The resource type. -const ( - InstancePlacementTargetResourceTypeDedicatedHostGroupConst = "dedicated_host_group" -) - -func (*InstancePlacementTarget) isaInstancePlacementTarget() bool { - return true -} - -type InstancePlacementTargetIntf interface { - isaInstancePlacementTarget() bool -} - -// UnmarshalInstancePlacementTarget unmarshals an instance of InstancePlacementTarget from the specified map of raw messages. -func UnmarshalInstancePlacementTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTarget) - 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, UnmarshalDedicatedHostGroupReferenceDeleted) - 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 -} - -// InstancePlacementTargetPatch : InstancePlacementTargetPatch struct -// Models which "extend" this model: -// - InstancePlacementTargetPatchDedicatedHostIdentity -// - InstancePlacementTargetPatchDedicatedHostGroupIdentity -type InstancePlacementTargetPatch struct { - // The unique identifier for this dedicated host. - ID *string `json:"id,omitempty"` - - // The CRN for this dedicated host. - CRN *string `json:"crn,omitempty"` - - // The URL for this dedicated host. - Href *string `json:"href,omitempty"` -} - -func (*InstancePlacementTargetPatch) isaInstancePlacementTargetPatch() bool { - return true -} - -type InstancePlacementTargetPatchIntf interface { - isaInstancePlacementTargetPatch() bool -} - -// UnmarshalInstancePlacementTargetPatch unmarshals an instance of InstancePlacementTargetPatch from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatch) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototype : InstancePlacementTargetPrototype struct -// Models which "extend" this model: -// - InstancePlacementTargetPrototypeDedicatedHostIdentity -// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentity -// - InstancePlacementTargetPrototypePlacementGroupIdentity -type InstancePlacementTargetPrototype struct { - // The unique identifier for this dedicated host. - ID *string `json:"id,omitempty"` - - // The CRN for this dedicated host. - CRN *string `json:"crn,omitempty"` - - // The URL for this dedicated host. - Href *string `json:"href,omitempty"` -} - -func (*InstancePlacementTargetPrototype) isaInstancePlacementTargetPrototype() bool { - return true -} - -type InstancePlacementTargetPrototypeIntf interface { - isaInstancePlacementTargetPrototype() bool -} - -// UnmarshalInstancePlacementTargetPrototype unmarshals an instance of InstancePlacementTargetPrototype from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfile : InstanceProfile struct -type InstanceProfile struct { - Bandwidth InstanceProfileBandwidthIntf `json:"bandwidth" validate:"required"` - - // Collection of the instance profile's disks. - Disks []InstanceProfileDisk `json:"disks" validate:"required"` - - // The product family this virtual server instance profile belongs to. - Family *string `json:"family" validate:"required"` - - GpuCount InstanceProfileGpuIntf `json:"gpu_count,omitempty"` - - GpuManufacturer *InstanceProfileGpuManufacturer `json:"gpu_manufacturer,omitempty"` - - GpuMemory InstanceProfileGpuMemoryIntf `json:"gpu_memory,omitempty"` - - GpuModel *InstanceProfileGpuModel `json:"gpu_model,omitempty"` - - // The URL for this virtual server instance profile. - Href *string `json:"href" validate:"required"` - - Memory InstanceProfileMemoryIntf `json:"memory" validate:"required"` - - // The globally unique name for this virtual server instance profile. - Name *string `json:"name" validate:"required"` - - NetworkAttachmentCount InstanceProfileNetworkAttachmentCountIntf `json:"network_attachment_count" validate:"required"` - - NetworkInterfaceCount InstanceProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` - - NumaCount InstanceProfileNumaCountIntf `json:"numa_count,omitempty"` - - OsArchitecture *InstanceProfileOsArchitecture `json:"os_architecture" validate:"required"` - - PortSpeed InstanceProfilePortSpeedIntf `json:"port_speed" validate:"required"` - - ReservationTerms *InstanceProfileReservationTerms `json:"reservation_terms" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the instance profile: - // - `previous`: This instance profile is an older revision, but remains provisionable and - // usable. - // - `current`: This profile is the latest revision. - // - // Revisions are indicated by the generation of an instance profile. Refer to the [profile naming conventions] - // (https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on how - // generations are defined within an instance profile. - // - // 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"` - - TotalVolumeBandwidth InstanceProfileVolumeBandwidthIntf `json:"total_volume_bandwidth" validate:"required"` - - VcpuArchitecture *InstanceProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` - - VcpuCount InstanceProfileVcpuIntf `json:"vcpu_count" validate:"required"` - - VcpuManufacturer *InstanceProfileVcpuManufacturer `json:"vcpu_manufacturer" validate:"required"` -} - -// Constants associated with the InstanceProfile.ResourceType property. -// The resource type. -const ( - InstanceProfileResourceTypeInstanceProfileConst = "instance_profile" -) - -// Constants associated with the InstanceProfile.Status property. -// The status of the instance profile: -// - `previous`: This instance profile is an older revision, but remains provisionable and -// usable. -// - `current`: This profile is the latest revision. -// -// Revisions are indicated by the generation of an instance profile. Refer to the [profile naming conventions] -// (https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on how -// generations are defined within an instance profile. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - InstanceProfileStatusCurrentConst = "current" - InstanceProfileStatusPreviousConst = "previous" -) - -// UnmarshalInstanceProfile unmarshals an instance of InstanceProfile from the specified map of raw messages. -func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfile) - err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalInstanceProfileBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceProfileDisk) - if err != nil { - err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "gpu_count", &obj.GpuCount, UnmarshalInstanceProfileGpu) - if err != nil { - err = core.SDKErrorf(err, "", "gpu_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "gpu_manufacturer", &obj.GpuManufacturer, UnmarshalInstanceProfileGpuManufacturer) - if err != nil { - err = core.SDKErrorf(err, "", "gpu_manufacturer-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "gpu_memory", &obj.GpuMemory, UnmarshalInstanceProfileGpuMemory) - if err != nil { - err = core.SDKErrorf(err, "", "gpu_memory-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "gpu_model", &obj.GpuModel, UnmarshalInstanceProfileGpuModel) - if err != nil { - err = core.SDKErrorf(err, "", "gpu_model-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.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalInstanceProfileMemory) - if err != nil { - err = core.SDKErrorf(err, "", "memory-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, "network_attachment_count", &obj.NetworkAttachmentCount, UnmarshalInstanceProfileNetworkAttachmentCount) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachment_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalInstanceProfileNetworkInterfaceCount) - if err != nil { - err = core.SDKErrorf(err, "", "network_interface_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "numa_count", &obj.NumaCount, UnmarshalInstanceProfileNumaCount) - if err != nil { - err = core.SDKErrorf(err, "", "numa_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalInstanceProfileOsArchitecture) - if err != nil { - err = core.SDKErrorf(err, "", "os_architecture-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "port_speed", &obj.PortSpeed, UnmarshalInstanceProfilePortSpeed) - if err != nil { - err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_terms", &obj.ReservationTerms, UnmarshalInstanceProfileReservationTerms) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_terms-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, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-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()) - return - } - err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalInstanceProfileVcpuArchitecture) - if err != nil { - err = core.SDKErrorf(err, "", "vcpu_architecture-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalInstanceProfileVcpu) - if err != nil { - err = core.SDKErrorf(err, "", "vcpu_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vcpu_manufacturer", &obj.VcpuManufacturer, UnmarshalInstanceProfileVcpuManufacturer) - if err != nil { - err = core.SDKErrorf(err, "", "vcpu_manufacturer-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileBandwidth : InstanceProfileBandwidth struct -// Models which "extend" this model: -// - InstanceProfileBandwidthFixed -// - InstanceProfileBandwidthRange -// - InstanceProfileBandwidthEnum -// - InstanceProfileBandwidthDependent -type InstanceProfileBandwidth 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 InstanceProfileBandwidth.Type property. -// The type for this profile field. -const ( - InstanceProfileBandwidthTypeFixedConst = "fixed" -) - -func (*InstanceProfileBandwidth) isaInstanceProfileBandwidth() bool { - return true -} - -type InstanceProfileBandwidthIntf interface { - isaInstanceProfileBandwidth() bool -} - -// UnmarshalInstanceProfileBandwidth unmarshals an instance of InstanceProfileBandwidth from the specified map of raw messages. -func UnmarshalInstanceProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileBandwidth) - 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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileCollection : InstanceProfileCollection struct -type InstanceProfileCollection struct { - // Collection of virtual server instance profiles. - Profiles []InstanceProfile `json:"profiles" validate:"required"` -} - -// UnmarshalInstanceProfileCollection unmarshals an instance of InstanceProfileCollection from the specified map of raw messages. -func UnmarshalInstanceProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileCollection) - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalInstanceProfile) - if err != nil { - err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDisk : Disks provided by this profile. -type InstanceProfileDisk struct { - Quantity InstanceProfileDiskQuantityIntf `json:"quantity" validate:"required"` - - Size InstanceProfileDiskSizeIntf `json:"size" validate:"required"` - - SupportedInterfaceTypes *InstanceProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` -} - -// UnmarshalInstanceProfileDisk unmarshals an instance of InstanceProfileDisk from the specified map of raw messages. -func UnmarshalInstanceProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDisk) - err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalInstanceProfileDiskQuantity) - if err != nil { - err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalInstanceProfileDiskSize) - if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalInstanceProfileDiskSupportedInterfaces) - if err != nil { - err = core.SDKErrorf(err, "", "supported_interface_types-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskQuantity : InstanceProfileDiskQuantity struct -// Models which "extend" this model: -// - InstanceProfileDiskQuantityFixed -// - InstanceProfileDiskQuantityRange -// - InstanceProfileDiskQuantityEnum -// - InstanceProfileDiskQuantityDependent -type InstanceProfileDiskQuantity 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 InstanceProfileDiskQuantity.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskQuantityTypeFixedConst = "fixed" -) - -func (*InstanceProfileDiskQuantity) isaInstanceProfileDiskQuantity() bool { - return true -} - -type InstanceProfileDiskQuantityIntf interface { - isaInstanceProfileDiskQuantity() bool -} - -// UnmarshalInstanceProfileDiskQuantity unmarshals an instance of InstanceProfileDiskQuantity from the specified map of raw messages. -func UnmarshalInstanceProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskQuantity) - 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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskSize : InstanceProfileDiskSize struct -// Models which "extend" this model: -// - InstanceProfileDiskSizeFixed -// - InstanceProfileDiskSizeRange -// - InstanceProfileDiskSizeEnum -// - InstanceProfileDiskSizeDependent -type InstanceProfileDiskSize 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 InstanceProfileDiskSize.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskSizeTypeFixedConst = "fixed" -) - -func (*InstanceProfileDiskSize) isaInstanceProfileDiskSize() bool { - return true -} - -type InstanceProfileDiskSizeIntf interface { - isaInstanceProfileDiskSize() bool -} - -// UnmarshalInstanceProfileDiskSize unmarshals an instance of InstanceProfileDiskSize from the specified map of raw messages. -func UnmarshalInstanceProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskSize) - 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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskSupportedInterfaces : InstanceProfileDiskSupportedInterfaces struct -type InstanceProfileDiskSupportedInterfaces struct { - // The disk interface used for attaching the disk. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - 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"` -} - -// Constants associated with the InstanceProfileDiskSupportedInterfaces.Default property. -// The disk interface used for attaching the disk. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - InstanceProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" - InstanceProfileDiskSupportedInterfacesDefaultVirtioBlkConst = "virtio_blk" -) - -// Constants associated with the InstanceProfileDiskSupportedInterfaces.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskSupportedInterfacesTypeEnumConst = "enum" -) - -// Constants associated with the InstanceProfileDiskSupportedInterfaces.Values property. -// The disk interface used for attaching the disk. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - InstanceProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" - InstanceProfileDiskSupportedInterfacesValuesVirtioBlkConst = "virtio_blk" -) - -// UnmarshalInstanceProfileDiskSupportedInterfaces unmarshals an instance of InstanceProfileDiskSupportedInterfaces from the specified map of raw messages. -func UnmarshalInstanceProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskSupportedInterfaces) - 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 -} - -// InstanceProfileGpu : InstanceProfileGpu struct -// Models which "extend" this model: -// - InstanceProfileGpuFixed -// - InstanceProfileGpuRange -// - InstanceProfileGpuEnum -// - InstanceProfileGpuDependent -type InstanceProfileGpu 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 InstanceProfileGpu.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuTypeFixedConst = "fixed" -) - -func (*InstanceProfileGpu) isaInstanceProfileGpu() bool { - return true -} - -type InstanceProfileGpuIntf interface { - isaInstanceProfileGpu() bool -} - -// UnmarshalInstanceProfileGpu unmarshals an instance of InstanceProfileGpu from the specified map of raw messages. -func UnmarshalInstanceProfileGpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpu) - 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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuManufacturer : InstanceProfileGpuManufacturer struct -type InstanceProfileGpuManufacturer struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The possible GPU manufacturer(s) for an instance with this profile. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuManufacturer.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuManufacturerTypeEnumConst = "enum" -) - -// UnmarshalInstanceProfileGpuManufacturer unmarshals an instance of InstanceProfileGpuManufacturer from the specified map of raw messages. -func UnmarshalInstanceProfileGpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuManufacturer) - 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 -} - -// InstanceProfileGpuMemory : InstanceProfileGpuMemory struct -// Models which "extend" this model: -// - InstanceProfileGpuMemoryFixed -// - InstanceProfileGpuMemoryRange -// - InstanceProfileGpuMemoryEnum -// - InstanceProfileGpuMemoryDependent -type InstanceProfileGpuMemory 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 InstanceProfileGpuMemory.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuMemoryTypeFixedConst = "fixed" -) - -func (*InstanceProfileGpuMemory) isaInstanceProfileGpuMemory() bool { - return true -} - -type InstanceProfileGpuMemoryIntf interface { - isaInstanceProfileGpuMemory() bool -} - -// UnmarshalInstanceProfileGpuMemory unmarshals an instance of InstanceProfileGpuMemory from the specified map of raw messages. -func UnmarshalInstanceProfileGpuMemory(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuMemory) - 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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuModel : InstanceProfileGpuModel struct -type InstanceProfileGpuModel struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The possible GPU model(s) for an instance with this profile. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuModel.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuModelTypeEnumConst = "enum" -) - -// UnmarshalInstanceProfileGpuModel unmarshals an instance of InstanceProfileGpuModel from the specified map of raw messages. -func UnmarshalInstanceProfileGpuModel(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuModel) - 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 -} - -// InstanceProfileIdentity : Identifies an instance profile by a unique property. -// Models which "extend" this model: -// - InstanceProfileIdentityByName -// - InstanceProfileIdentityByHref -type InstanceProfileIdentity struct { - // The globally unique name for this virtual server instance profile. - Name *string `json:"name,omitempty"` - - // The URL for this virtual server instance profile. - Href *string `json:"href,omitempty"` -} - -func (*InstanceProfileIdentity) isaInstanceProfileIdentity() bool { - return true -} - -type InstanceProfileIdentityIntf interface { - isaInstanceProfileIdentity() bool -} - -// UnmarshalInstanceProfileIdentity unmarshals an instance of InstanceProfileIdentity from the specified map of raw messages. -func UnmarshalInstanceProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileIdentity) - 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 -} - -// InstanceProfileMemory : InstanceProfileMemory struct -// Models which "extend" this model: -// - InstanceProfileMemoryFixed -// - InstanceProfileMemoryRange -// - InstanceProfileMemoryEnum -// - InstanceProfileMemoryDependent -type InstanceProfileMemory 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 InstanceProfileMemory.Type property. -// The type for this profile field. -const ( - InstanceProfileMemoryTypeFixedConst = "fixed" -) - -func (*InstanceProfileMemory) isaInstanceProfileMemory() bool { - return true -} - -type InstanceProfileMemoryIntf interface { - isaInstanceProfileMemory() bool -} - -// UnmarshalInstanceProfileMemory unmarshals an instance of InstanceProfileMemory from the specified map of raw messages. -func UnmarshalInstanceProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileMemory) - 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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileNumaCount : InstanceProfileNumaCount struct -// Models which "extend" this model: -// - InstanceProfileNumaCountFixed -// - InstanceProfileNumaCountDependent -type InstanceProfileNumaCount struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` -} - -// Constants associated with the InstanceProfileNumaCount.Type property. -// The type for this profile field. -const ( - InstanceProfileNumaCountTypeFixedConst = "fixed" -) - -func (*InstanceProfileNumaCount) isaInstanceProfileNumaCount() bool { - return true -} - -type InstanceProfileNumaCountIntf interface { - isaInstanceProfileNumaCount() bool -} - -// UnmarshalInstanceProfileNumaCount unmarshals an instance of InstanceProfileNumaCount from the specified map of raw messages. -func UnmarshalInstanceProfileNumaCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNumaCount) - 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 -} - -// InstanceProfileNetworkAttachmentCount : InstanceProfileNetworkAttachmentCount struct -// Models which "extend" this model: -// - InstanceProfileNetworkAttachmentCountRange -// - InstanceProfileNetworkAttachmentCountDependent -type InstanceProfileNetworkAttachmentCount 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 InstanceProfileNetworkAttachmentCount.Type property. -// The type for this profile field. -const ( - InstanceProfileNetworkAttachmentCountTypeRangeConst = "range" -) - -func (*InstanceProfileNetworkAttachmentCount) isaInstanceProfileNetworkAttachmentCount() bool { - return true -} - -type InstanceProfileNetworkAttachmentCountIntf interface { - isaInstanceProfileNetworkAttachmentCount() bool -} - -// UnmarshalInstanceProfileNetworkAttachmentCount unmarshals an instance of InstanceProfileNetworkAttachmentCount from the specified map of raw messages. -func UnmarshalInstanceProfileNetworkAttachmentCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNetworkAttachmentCount) - 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) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileNetworkInterfaceCount : InstanceProfileNetworkInterfaceCount struct -// Models which "extend" this model: -// - InstanceProfileNetworkInterfaceCountRange -// - InstanceProfileNetworkInterfaceCountDependent -type InstanceProfileNetworkInterfaceCount 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 InstanceProfileNetworkInterfaceCount.Type property. -// The type for this profile field. -const ( - InstanceProfileNetworkInterfaceCountTypeRangeConst = "range" -) - -func (*InstanceProfileNetworkInterfaceCount) isaInstanceProfileNetworkInterfaceCount() bool { - return true -} - -type InstanceProfileNetworkInterfaceCountIntf interface { - isaInstanceProfileNetworkInterfaceCount() bool -} - -// UnmarshalInstanceProfileNetworkInterfaceCount unmarshals an instance of InstanceProfileNetworkInterfaceCount from the specified map of raw messages. -func UnmarshalInstanceProfileNetworkInterfaceCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNetworkInterfaceCount) - 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) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileOsArchitecture : InstanceProfileOsArchitecture struct -type InstanceProfileOsArchitecture struct { - // The default OS architecture for an instance 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 an instance with this profile. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileOsArchitecture.Type property. -// The type for this profile field. -const ( - InstanceProfileOsArchitectureTypeEnumConst = "enum" -) - -// UnmarshalInstanceProfileOsArchitecture unmarshals an instance of InstanceProfileOsArchitecture from the specified map of raw messages. -func UnmarshalInstanceProfileOsArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileOsArchitecture) - 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 -} - -// InstanceProfilePortSpeed : InstanceProfilePortSpeed struct -// Models which "extend" this model: -// - InstanceProfilePortSpeedFixed -// - InstanceProfilePortSpeedDependent -type InstanceProfilePortSpeed struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *int64 `json:"value,omitempty"` -} - -// Constants associated with the InstanceProfilePortSpeed.Type property. -// The type for this profile field. -const ( - InstanceProfilePortSpeedTypeFixedConst = "fixed" -) - -func (*InstanceProfilePortSpeed) isaInstanceProfilePortSpeed() bool { - return true -} - -type InstanceProfilePortSpeedIntf interface { - isaInstanceProfilePortSpeed() bool -} - -// UnmarshalInstanceProfilePortSpeed unmarshals an instance of InstanceProfilePortSpeed from the specified map of raw messages. -func UnmarshalInstanceProfilePortSpeed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfilePortSpeed) - 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 -} - -// InstanceProfileReference : InstanceProfileReference struct -type InstanceProfileReference struct { - // The URL for this virtual server instance profile. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this virtual server instance profile. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the InstanceProfileReference.ResourceType property. -// The resource type. -const ( - InstanceProfileReferenceResourceTypeInstanceProfileConst = "instance_profile" -) - -// UnmarshalInstanceProfileReference unmarshals an instance of InstanceProfileReference from the specified map of raw messages. -func UnmarshalInstanceProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-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 -} - -// InstanceProfileReservationTerms : InstanceProfileReservationTerms struct -type InstanceProfileReservationTerms struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The supported committed use terms for a reservation using this profile. - Values []string `json:"values" validate:"required"` -} - -// Constants associated with the InstanceProfileReservationTerms.Type property. -// The type for this profile field. -const ( - InstanceProfileReservationTermsTypeEnumConst = "enum" -) - -// Constants associated with the InstanceProfileReservationTerms.Values property. -const ( - InstanceProfileReservationTermsValuesOneYearConst = "one_year" - InstanceProfileReservationTermsValuesThreeYearConst = "three_year" -) - -// UnmarshalInstanceProfileReservationTerms unmarshals an instance of InstanceProfileReservationTerms from the specified map of raw messages. -func UnmarshalInstanceProfileReservationTerms(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileReservationTerms) - 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 -} - -// InstanceProfileVcpu : InstanceProfileVcpu struct -// Models which "extend" this model: -// - InstanceProfileVcpuFixed -// - InstanceProfileVcpuRange -// - InstanceProfileVcpuEnum -// - InstanceProfileVcpuDependent -type InstanceProfileVcpu 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 InstanceProfileVcpu.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuTypeFixedConst = "fixed" -) - -func (*InstanceProfileVcpu) isaInstanceProfileVcpu() bool { - return true -} - -type InstanceProfileVcpuIntf interface { - isaInstanceProfileVcpu() bool -} - -// UnmarshalInstanceProfileVcpu unmarshals an instance of InstanceProfileVcpu from the specified map of raw messages. -func UnmarshalInstanceProfileVcpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpu) - 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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVcpuArchitecture : InstanceProfileVcpuArchitecture struct -type InstanceProfileVcpuArchitecture struct { - // The default VCPU architecture for an instance with this profile. - Default *string `json:"default,omitempty"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The VCPU architecture for an instance with this profile. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileVcpuArchitecture.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuArchitectureTypeFixedConst = "fixed" -) - -// UnmarshalInstanceProfileVcpuArchitecture unmarshals an instance of InstanceProfileVcpuArchitecture from the specified map of raw messages. -func UnmarshalInstanceProfileVcpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpuArchitecture) - 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, "value", &obj.Value) - if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVcpuManufacturer : InstanceProfileVcpuManufacturer struct -type InstanceProfileVcpuManufacturer struct { - // The default VCPU manufacturer for an instance with this profile. - Default *string `json:"default,omitempty"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The VCPU manufacturer for an instance with this profile. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileVcpuManufacturer.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuManufacturerTypeFixedConst = "fixed" -) - -// UnmarshalInstanceProfileVcpuManufacturer unmarshals an instance of InstanceProfileVcpuManufacturer from the specified map of raw messages. -func UnmarshalInstanceProfileVcpuManufacturer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpuManufacturer) - 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, "value", &obj.Value) - if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVolumeBandwidth : InstanceProfileVolumeBandwidth struct -// Models which "extend" this model: -// - InstanceProfileVolumeBandwidthFixed -// - InstanceProfileVolumeBandwidthRange -// - InstanceProfileVolumeBandwidthEnum -// - InstanceProfileVolumeBandwidthDependent -type InstanceProfileVolumeBandwidth 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 InstanceProfileVolumeBandwidth.Type property. -// The type for this profile field. -const ( - InstanceProfileVolumeBandwidthTypeFixedConst = "fixed" -) - -func (*InstanceProfileVolumeBandwidth) isaInstanceProfileVolumeBandwidth() bool { - return true -} - -type InstanceProfileVolumeBandwidthIntf interface { - isaInstanceProfileVolumeBandwidth() bool -} - -// UnmarshalInstanceProfileVolumeBandwidth unmarshals an instance of InstanceProfileVolumeBandwidth from the specified map of raw messages. -func UnmarshalInstanceProfileVolumeBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVolumeBandwidth) - 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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototype : InstancePrototype struct -// Models which "extend" this model: -// - InstancePrototypeInstanceByImage -// - InstancePrototypeInstanceByCatalogOffering -// - InstancePrototypeInstanceByVolume -// - InstancePrototypeInstanceBySourceSnapshot -// - InstancePrototypeInstanceBySourceTemplate -type InstancePrototype struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not - // subsequently managed. Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - // property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - // The metadata service configuration. - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this - // virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change - // in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,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 amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network - // attachments or instance network interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image,omitempty"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account, subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` - - // The template to create this virtual server instance from. - SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` -} - -func (*InstancePrototype) isaInstancePrototype() bool { - return true -} - -type InstancePrototypeIntf interface { - isaInstancePrototype() bool -} - -// UnmarshalInstancePrototype unmarshals an instance of InstancePrototype from the specified map of raw messages. -func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototype) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_template-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceReference : InstanceReference struct -type InstanceReference struct { - // The CRN for this virtual server instance. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual server instance. - ID *string `json:"id" validate:"required"` - - // The name for this virtual server instance. The name is unique across all virtual server instances in the region. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalInstanceReference unmarshals an instance of InstanceReference from the specified map of raw messages. -func UnmarshalInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceReference) - 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, UnmarshalInstanceReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceReferenceDeleted unmarshals an instance of InstanceReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceReferenceDeleted) - 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 -} - -// InstanceReservationAffinity : InstanceReservationAffinity struct -type InstanceReservationAffinity struct { - // The reservation affinity policy to use for this virtual server instance: - // - `disabled`: Reservations will not be used - // - `manual`: Reservations in `pool` are available for use. - Policy *string `json:"policy" validate:"required"` - - // The pool of reservations available for use by this virtual server instance. - Pool []ReservationReference `json:"pool" validate:"required"` -} - -// Constants associated with the InstanceReservationAffinity.Policy property. -// The reservation affinity policy to use for this virtual server instance: -// - `disabled`: Reservations will not be used -// - `manual`: Reservations in `pool` are available for use. -const ( - InstanceReservationAffinityPolicyDisabledConst = "disabled" - InstanceReservationAffinityPolicyManualConst = "manual" -) - -// UnmarshalInstanceReservationAffinity unmarshals an instance of InstanceReservationAffinity from the specified map of raw messages. -func UnmarshalInstanceReservationAffinity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceReservationAffinity) - err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) - if err != nil { - err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationReference) - if err != nil { - err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceReservationAffinityPatch : InstanceReservationAffinityPatch struct -type InstanceReservationAffinityPatch struct { - // The reservation affinity policy to use for this virtual server instance: - // - `disabled`: Reservations will not be used - // - `manual`: Reservations in `pool` are available for use. - Policy *string `json:"policy,omitempty"` - - // The pool of reservations available for use by this virtual server instance, replacing the existing pool of - // reservations. - // - // Specified reservations must have a `status` of `active`, and have the same `profile` and - // `zone` as this virtual server instance. - // - // If `policy` is `manual`, a pool must be specified with at least one reservation. If - // `policy` is `disabled` and a pool is specified, it must be empty. - Pool []ReservationIdentityIntf `json:"pool,omitempty"` -} - -// Constants associated with the InstanceReservationAffinityPatch.Policy property. -// The reservation affinity policy to use for this virtual server instance: -// - `disabled`: Reservations will not be used -// - `manual`: Reservations in `pool` are available for use. -const ( - InstanceReservationAffinityPatchPolicyDisabledConst = "disabled" - InstanceReservationAffinityPatchPolicyManualConst = "manual" -) - -// UnmarshalInstanceReservationAffinityPatch unmarshals an instance of InstanceReservationAffinityPatch from the specified map of raw messages. -func UnmarshalInstanceReservationAffinityPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceReservationAffinityPatch) - err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) - if err != nil { - err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceReservationAffinityPrototype : InstanceReservationAffinityPrototype struct -type InstanceReservationAffinityPrototype struct { - // The reservation affinity policy to use for this virtual server instance: - // - `disabled`: Reservations will not be used - // - `manual`: Reservations in `pool` will be available for use - // - // The policy will default to `manual` if `pool` is not empty, and `disabled` otherwise. - Policy *string `json:"policy,omitempty"` - - // The pool of reservations available for use by this virtual server instance. - // - // Specified reservations must have a `status` of `active`, and have the same `profile` and - // `zone` as this virtual server instance. - // - // If `policy` is `manual`, a pool must be specified with at least one reservation. If - // `policy` is `disabled` and a pool is specified, it must be empty. - Pool []ReservationIdentityIntf `json:"pool,omitempty"` -} - -// Constants associated with the InstanceReservationAffinityPrototype.Policy property. -// The reservation affinity policy to use for this virtual server instance: -// - `disabled`: Reservations will not be used -// - `manual`: Reservations in `pool` will be available for use -// -// The policy will default to `manual` if `pool` is not empty, and `disabled` otherwise. -const ( - InstanceReservationAffinityPrototypePolicyDisabledConst = "disabled" - InstanceReservationAffinityPrototypePolicyManualConst = "manual" -) - -// UnmarshalInstanceReservationAffinityPrototype unmarshals an instance of InstanceReservationAffinityPrototype from the specified map of raw messages. -func UnmarshalInstanceReservationAffinityPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceReservationAffinityPrototype) - err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) - if err != nil { - err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceStatusReason : InstanceStatusReason struct -type InstanceStatusReason struct { - // A snake case string succinctly identifying the status reason. - // - // 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 InstanceStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - InstanceStatusReasonCodeCannotStartConst = "cannot_start" - InstanceStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" - InstanceStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" - InstanceStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" - InstanceStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" - InstanceStatusReasonCodeCannotStartPlacementGroupConst = "cannot_start_placement_group" - InstanceStatusReasonCodeCannotStartReservationCapacityConst = "cannot_start_reservation_capacity" - InstanceStatusReasonCodeCannotStartReservationExpiredConst = "cannot_start_reservation_expired" - InstanceStatusReasonCodeCannotStartStorageConst = "cannot_start_storage" - InstanceStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" - InstanceStatusReasonCodeStoppedByHostFailureConst = "stopped_by_host_failure" - InstanceStatusReasonCodeStoppedForImageCreationConst = "stopped_for_image_creation" -) - -// UnmarshalInstanceStatusReason unmarshals an instance of InstanceStatusReason from the specified map of raw messages. -func UnmarshalInstanceStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceStatusReason) - 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 -} - -// InstanceTemplate : InstanceTemplate struct -// Models which "extend" this model: -// - InstanceTemplateInstanceByImageInstanceTemplateContext -// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext -// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext -type InstanceTemplate struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not - // subsequently managed. Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - // property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - // The metadata service configuration. - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this - // virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change - // in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network - // attachments or instance network interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image,omitempty"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account, subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` -} - -func (*InstanceTemplate) isaInstanceTemplate() bool { - return true -} - -type InstanceTemplateIntf interface { - isaInstanceTemplate() bool -} - -// UnmarshalInstanceTemplate unmarshals an instance of InstanceTemplate from the specified map of raw messages. -func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplate) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateCollection : InstanceTemplateCollection struct -type InstanceTemplateCollection struct { - // A link to the first page of resources. - First *InstanceTemplateCollectionFirst `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"` - - // Collection of instance templates. - Templates []InstanceTemplateIntf `json:"templates" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalInstanceTemplateCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "templates", &obj.Templates, UnmarshalInstanceTemplate) - if err != nil { - err = core.SDKErrorf(err, "", "templates-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 -} - -// 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 -// - InstanceTemplateIdentityByHref -// - InstanceTemplateIdentityByCRN -type InstanceTemplateIdentity struct { - // The unique identifier for this instance template. - ID *string `json:"id,omitempty"` - - // The URL for this instance template. - Href *string `json:"href,omitempty"` - - // The CRN for this instance template. - CRN *string `json:"crn,omitempty"` -} - -func (*InstanceTemplateIdentity) isaInstanceTemplateIdentity() bool { - return true -} - -type InstanceTemplateIdentityIntf interface { - isaInstanceTemplateIdentity() bool -} - -// UnmarshalInstanceTemplateIdentity unmarshals an instance of InstanceTemplateIdentity from the specified map of raw messages. -func UnmarshalInstanceTemplateIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateIdentity) - 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 - } - 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 -} - -// 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. - Name *string `json:"name,omitempty"` -} - -// UnmarshalInstanceTemplatePatch unmarshals an instance of InstanceTemplatePatch from the specified map of raw messages. -func UnmarshalInstanceTemplatePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePatch) - 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 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()) - } - return -} - -// InstanceTemplatePrototype : InstanceTemplatePrototype struct -// Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateByImage -// - InstanceTemplatePrototypeInstanceTemplateBySourceTemplate -// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot -// - InstanceTemplatePrototypeInstanceTemplateByCatalogOffering -type InstanceTemplatePrototype struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not - // subsequently managed. Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) - // property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - // The metadata service configuration. - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this - // virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change - // in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,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 amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network - // attachments or instance network interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image,omitempty"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering version to use when provisioning this virtual server instance. - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account, subject to - // IAM policies. - // - // If specified, `image` must not be specified, and `source_template` must not have - // `image` specified. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` - - // The template to create this virtual server instance from. - SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` -} - -func (*InstanceTemplatePrototype) isaInstanceTemplatePrototype() bool { - return true -} - -type InstanceTemplatePrototypeIntf interface { - isaInstanceTemplatePrototype() bool -} - -// UnmarshalInstanceTemplatePrototype unmarshals an instance of InstanceTemplatePrototype from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototype) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_template-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateReference : InstanceTemplateReference struct -type InstanceTemplateReference struct { - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceTemplateReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalInstanceTemplateReference unmarshals an instance of InstanceTemplateReference from the specified map of raw messages. -func UnmarshalInstanceTemplateReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateReference) - 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, UnmarshalInstanceTemplateReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceTemplateReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceTemplateReferenceDeleted unmarshals an instance of InstanceTemplateReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceTemplateReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateReferenceDeleted) - 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 -} - -// InstanceVcpu : The virtual server instance VCPU configuration. -type InstanceVcpu struct { - // The VCPU architecture. - Architecture *string `json:"architecture" validate:"required"` - - // The number of VCPUs assigned. - Count *int64 `json:"count" validate:"required"` - - // The VCPU manufacturer. - Manufacturer *string `json:"manufacturer" validate:"required"` -} - -// UnmarshalInstanceVcpu unmarshals an instance of InstanceVcpu from the specified map of raw messages. -func UnmarshalInstanceVcpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceVcpu) - err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) - if err != nil { - err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "count", &obj.Count) - if err != nil { - err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) - if err != nil { - err = core.SDKErrorf(err, "", "manufacturer-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Key : Key struct -type Key struct { - // The date and time that the key was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this key. - CRN *string `json:"crn" validate:"required"` - - // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always - // `SHA256`). - Fingerprint *string `json:"fingerprint" validate:"required"` - - // The URL for this key. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this key. - ID *string `json:"id" validate:"required"` - - // The length of this key (in bits). - Length *int64 `json:"length" validate:"required"` - - // The name for this key. The name must not be used by another key in the region. If unspecified, the name will be a - // hyphenated list of randomly-selected words. - Name *string `json:"name" validate:"required"` - - // The public SSH key, consisting of two space-separated fields: the algorithm name, and the base64-encoded key. - PublicKey *string `json:"public_key" validate:"required"` - - // The resource group for this key. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The crypto-system used by this key. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the Key.Type property. -// The crypto-system used by this key. -const ( - KeyTypeEd25519Const = "ed25519" - KeyTypeRsaConst = "rsa" -) - -// UnmarshalKey unmarshals an instance of Key from the specified map of raw messages. -func UnmarshalKey(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Key) - 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.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) - if err != nil { - err = core.SDKErrorf(err, "", "fingerprint-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, "length", &obj.Length) - if err != nil { - err = core.SDKErrorf(err, "", "length-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, "public_key", &obj.PublicKey) - if err != nil { - err = core.SDKErrorf(err, "", "public_key-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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyCollection : KeyCollection struct -type KeyCollection struct { - // A link to the first page of resources. - First *KeyCollectionFirst `json:"first" validate:"required"` - - // Collection of keys. - Keys []Key `json:"keys" 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 *KeyCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKey) - if err != nil { - err = core.SDKErrorf(err, "", "keys-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, UnmarshalKeyCollectionNext) - 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 *KeyCollection) 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 -} - -// 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 -// - KeyIdentityByCRN -// - KeyIdentityByHref -// - KeyIdentityByFingerprint -type KeyIdentity struct { - // The unique identifier for this key. - ID *string `json:"id,omitempty"` - - // The CRN for this key. - CRN *string `json:"crn,omitempty"` - - // The URL for this key. - Href *string `json:"href,omitempty"` - - // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always - // `SHA256`). - Fingerprint *string `json:"fingerprint,omitempty"` -} - -func (*KeyIdentity) isaKeyIdentity() bool { - return true -} - -type KeyIdentityIntf interface { - isaKeyIdentity() bool -} - -// UnmarshalKeyIdentity unmarshals an instance of KeyIdentity from the specified map of raw messages. -func UnmarshalKeyIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) - if err != nil { - err = core.SDKErrorf(err, "", "fingerprint-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyPatch : KeyPatch struct -type KeyPatch struct { - // The name for this key. The name must not be used by another key in the region. - Name *string `json:"name,omitempty"` -} - -// UnmarshalKeyPatch unmarshals an instance of KeyPatch from the specified map of raw messages. -func UnmarshalKeyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyPatch) - 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 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()) - } - return -} - -// KeyReference : KeyReference struct -type KeyReference struct { - // The CRN for this key. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *KeyReferenceDeleted `json:"deleted,omitempty"` - - // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always - // `SHA256`). - Fingerprint *string `json:"fingerprint" validate:"required"` - - // The URL for this key. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this key. - ID *string `json:"id" validate:"required"` - - // The name for this key. The name is unique across all keys in the region. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalKeyReference unmarshals an instance of KeyReference from the specified map of raw messages. -func UnmarshalKeyReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyReference) - 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, UnmarshalKeyReferenceDeleted) - if err != nil { - err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) - if err != nil { - err = core.SDKErrorf(err, "", "fingerprint-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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type KeyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalKeyReferenceDeleted unmarshals an instance of KeyReferenceDeleted from the specified map of raw messages. -func UnmarshalKeyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyReferenceDeleted) - 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 -} - -// LegacyCloudObjectStorageBucketIdentity : Identifies a Cloud Object Storage bucket by a unique property. -// Models which "extend" this model: -// - LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName -type LegacyCloudObjectStorageBucketIdentity struct { - // The globally unique name of this Cloud Object Storage bucket. - Name *string `json:"name,omitempty"` -} - -func (*LegacyCloudObjectStorageBucketIdentity) isaLegacyCloudObjectStorageBucketIdentity() bool { - return true -} - -type LegacyCloudObjectStorageBucketIdentityIntf interface { - isaLegacyCloudObjectStorageBucketIdentity() bool -} - -// UnmarshalLegacyCloudObjectStorageBucketIdentity unmarshals an instance of LegacyCloudObjectStorageBucketIdentity from the specified map of raw messages. -func UnmarshalLegacyCloudObjectStorageBucketIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LegacyCloudObjectStorageBucketIdentity) - 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 -} - -// LegacyCloudObjectStorageBucketReference : LegacyCloudObjectStorageBucketReference struct -type LegacyCloudObjectStorageBucketReference struct { - // The globally unique name of this Cloud Object Storage bucket. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalLegacyCloudObjectStorageBucketReference unmarshals an instance of LegacyCloudObjectStorageBucketReference from the specified map of raw messages. -func UnmarshalLegacyCloudObjectStorageBucketReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LegacyCloudObjectStorageBucketReference) - 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 -} - -// ListBackupPoliciesOptions : The ListBackupPolicies options. -type ListBackupPoliciesOptions 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"` - - // 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 - Headers map[string]string -} - -// NewListBackupPoliciesOptions : Instantiate ListBackupPoliciesOptions -func (*VpcV1) NewListBackupPoliciesOptions() *ListBackupPoliciesOptions { - return &ListBackupPoliciesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListBackupPoliciesOptions) SetStart(start string) *ListBackupPoliciesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListBackupPoliciesOptions) SetLimit(limit int64) *ListBackupPoliciesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListBackupPoliciesOptions) SetResourceGroupID(resourceGroupID string) *ListBackupPoliciesOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListBackupPoliciesOptions) SetName(name string) *ListBackupPoliciesOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetTag : Allow user to set Tag -func (_options *ListBackupPoliciesOptions) SetTag(tag string) *ListBackupPoliciesOptions { - _options.Tag = core.StringPtr(tag) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBackupPoliciesOptions) SetHeaders(param map[string]string) *ListBackupPoliciesOptions { - options.Headers = param - return options -} - -// ListBackupPolicyJobsOptions : The ListBackupPolicyJobs options. -type ListBackupPolicyJobsOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - - // Filters the collection to backup policy jobs with a `status` property matching the specified value. - Status *string `json:"status,omitempty"` - - // Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified - // identifier. - BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` - - // 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"` - - // 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 backup policy jobs with a `source.id` property matching the specified identifier. - SourceID *string `json:"source.id,omitempty"` - - // Filters the collection to backup policy jobs with an item in the `target_snapshots` property with an `id` property - // matching the specified identifier. - TargetSnapshotsID *string `json:"target_snapshots[].id,omitempty"` - - // Filters the collection to backup policy jobs with an item in the `target_snapshots` property with a `crn` property - // matching the specified CRN. - TargetSnapshotsCRN *string `json:"target_snapshots[].crn,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListBackupPolicyJobsOptions.Status property. -// Filters the collection to backup policy jobs with a `status` property matching the specified value. -const ( - ListBackupPolicyJobsOptionsStatusFailedConst = "failed" - ListBackupPolicyJobsOptionsStatusRunningConst = "running" - ListBackupPolicyJobsOptionsStatusSucceededConst = "succeeded" -) - -// Constants associated with the ListBackupPolicyJobsOptions.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 ( - ListBackupPolicyJobsOptionsSortCreatedAtConst = "created_at" - ListBackupPolicyJobsOptionsSortNameConst = "name" -) - -// NewListBackupPolicyJobsOptions : Instantiate ListBackupPolicyJobsOptions -func (*VpcV1) NewListBackupPolicyJobsOptions(backupPolicyID string) *ListBackupPolicyJobsOptions { - return &ListBackupPolicyJobsOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - } -} - -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *ListBackupPolicyJobsOptions) SetBackupPolicyID(backupPolicyID string) *ListBackupPolicyJobsOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options -} - -// SetStatus : Allow user to set Status -func (_options *ListBackupPolicyJobsOptions) SetStatus(status string) *ListBackupPolicyJobsOptions { - _options.Status = core.StringPtr(status) - return _options -} - -// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID -func (_options *ListBackupPolicyJobsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListBackupPolicyJobsOptions { - _options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListBackupPolicyJobsOptions) SetStart(start string) *ListBackupPolicyJobsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListBackupPolicyJobsOptions) SetLimit(limit int64) *ListBackupPolicyJobsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListBackupPolicyJobsOptions) SetSort(sort string) *ListBackupPolicyJobsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetSourceID : Allow user to set SourceID -func (_options *ListBackupPolicyJobsOptions) SetSourceID(sourceID string) *ListBackupPolicyJobsOptions { - _options.SourceID = core.StringPtr(sourceID) - return _options -} - -// SetTargetSnapshotsID : Allow user to set TargetSnapshotsID -func (_options *ListBackupPolicyJobsOptions) SetTargetSnapshotsID(targetSnapshotsID string) *ListBackupPolicyJobsOptions { - _options.TargetSnapshotsID = core.StringPtr(targetSnapshotsID) - return _options -} - -// SetTargetSnapshotsCRN : Allow user to set TargetSnapshotsCRN -func (_options *ListBackupPolicyJobsOptions) SetTargetSnapshotsCRN(targetSnapshotsCRN string) *ListBackupPolicyJobsOptions { - _options.TargetSnapshotsCRN = core.StringPtr(targetSnapshotsCRN) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBackupPolicyJobsOptions) SetHeaders(param map[string]string) *ListBackupPolicyJobsOptions { - options.Headers = param - return options -} - -// ListBackupPolicyPlansOptions : The ListBackupPolicyPlans options. -type ListBackupPolicyPlansOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - - // 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 - Headers map[string]string -} - -// NewListBackupPolicyPlansOptions : Instantiate ListBackupPolicyPlansOptions -func (*VpcV1) NewListBackupPolicyPlansOptions(backupPolicyID string) *ListBackupPolicyPlansOptions { - return &ListBackupPolicyPlansOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - } -} - -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *ListBackupPolicyPlansOptions) SetBackupPolicyID(backupPolicyID string) *ListBackupPolicyPlansOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListBackupPolicyPlansOptions) SetName(name string) *ListBackupPolicyPlansOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBackupPolicyPlansOptions) SetHeaders(param map[string]string) *ListBackupPolicyPlansOptions { - options.Headers = param - return options -} - -// ListBareMetalServerDisksOptions : The ListBareMetalServerDisks options. -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 - Headers map[string]string -} - -// NewListBareMetalServerDisksOptions : Instantiate ListBareMetalServerDisksOptions -func (*VpcV1) NewListBareMetalServerDisksOptions(bareMetalServerID string) *ListBareMetalServerDisksOptions { - return &ListBareMetalServerDisksOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *ListBareMetalServerDisksOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerDisksOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServerDisksOptions) SetHeaders(param map[string]string) *ListBareMetalServerDisksOptions { - options.Headers = param - return options -} - -// ListBareMetalServerNetworkAttachmentsOptions : The ListBareMetalServerNetworkAttachments options. -type ListBareMetalServerNetworkAttachmentsOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_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 -} - -// NewListBareMetalServerNetworkAttachmentsOptions : Instantiate ListBareMetalServerNetworkAttachmentsOptions -func (*VpcV1) NewListBareMetalServerNetworkAttachmentsOptions(bareMetalServerID string) *ListBareMetalServerNetworkAttachmentsOptions { - return &ListBareMetalServerNetworkAttachmentsOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkAttachmentsOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetStart(start string) *ListBareMetalServerNetworkAttachmentsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListBareMetalServerNetworkAttachmentsOptions) SetLimit(limit int64) *ListBareMetalServerNetworkAttachmentsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServerNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkAttachmentsOptions { - options.Headers = param - return options -} - -// ListBareMetalServerNetworkInterfaceFloatingIpsOptions : The ListBareMetalServerNetworkInterfaceFloatingIps options. -type ListBareMetalServerNetworkInterfaceFloatingIpsOptions 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="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListBareMetalServerNetworkInterfaceFloatingIpsOptions : Instantiate ListBareMetalServerNetworkInterfaceFloatingIpsOptions -func (*VpcV1) NewListBareMetalServerNetworkInterfaceFloatingIpsOptions(bareMetalServerID string, networkInterfaceID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { - return &ListBareMetalServerNetworkInterfaceFloatingIpsOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfaceFloatingIpsOptions { - options.Headers = param - return options -} - -// ListBareMetalServerNetworkInterfaceIpsOptions : The ListBareMetalServerNetworkInterfaceIps options. -type ListBareMetalServerNetworkInterfaceIpsOptions 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="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListBareMetalServerNetworkInterfaceIpsOptions : Instantiate ListBareMetalServerNetworkInterfaceIpsOptions -func (*VpcV1) NewListBareMetalServerNetworkInterfaceIpsOptions(bareMetalServerID string, networkInterfaceID string) *ListBareMetalServerNetworkInterfaceIpsOptions { - return &ListBareMetalServerNetworkInterfaceIpsOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *ListBareMetalServerNetworkInterfaceIpsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfaceIpsOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *ListBareMetalServerNetworkInterfaceIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListBareMetalServerNetworkInterfaceIpsOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServerNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfaceIpsOptions { - options.Headers = param - return options -} - -// ListBareMetalServerNetworkInterfacesOptions : The ListBareMetalServerNetworkInterfaces options. -type ListBareMetalServerNetworkInterfacesOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_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 -} - -// NewListBareMetalServerNetworkInterfacesOptions : Instantiate ListBareMetalServerNetworkInterfacesOptions -func (*VpcV1) NewListBareMetalServerNetworkInterfacesOptions(bareMetalServerID string) *ListBareMetalServerNetworkInterfacesOptions { - return &ListBareMetalServerNetworkInterfacesOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *ListBareMetalServerNetworkInterfacesOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfacesOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListBareMetalServerNetworkInterfacesOptions) SetStart(start string) *ListBareMetalServerNetworkInterfacesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListBareMetalServerNetworkInterfacesOptions) SetLimit(limit int64) *ListBareMetalServerNetworkInterfacesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServerNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfacesOptions { - options.Headers = param - return options -} - -// ListBareMetalServerProfilesOptions : The ListBareMetalServerProfiles options. -type ListBareMetalServerProfilesOptions 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 -} - -// NewListBareMetalServerProfilesOptions : Instantiate ListBareMetalServerProfilesOptions -func (*VpcV1) NewListBareMetalServerProfilesOptions() *ListBareMetalServerProfilesOptions { - return &ListBareMetalServerProfilesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListBareMetalServerProfilesOptions) SetStart(start string) *ListBareMetalServerProfilesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListBareMetalServerProfilesOptions) SetLimit(limit int64) *ListBareMetalServerProfilesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServerProfilesOptions) SetHeaders(param map[string]string) *ListBareMetalServerProfilesOptions { - options.Headers = param - return options -} - -// ListBareMetalServersOptions : The ListBareMetalServers options. -type ListBareMetalServersOptions 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"` - - // Filters the collection to resources with a `vpc.id` property matching the specified identifier. - VPCID *string `json:"vpc.id,omitempty"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // 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 - Headers map[string]string -} - -// NewListBareMetalServersOptions : Instantiate ListBareMetalServersOptions -func (*VpcV1) NewListBareMetalServersOptions() *ListBareMetalServersOptions { - return &ListBareMetalServersOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListBareMetalServersOptions) SetStart(start string) *ListBareMetalServersOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListBareMetalServersOptions) SetLimit(limit int64) *ListBareMetalServersOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListBareMetalServersOptions) SetResourceGroupID(resourceGroupID string) *ListBareMetalServersOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListBareMetalServersOptions) SetName(name string) *ListBareMetalServersOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListBareMetalServersOptions) SetVPCID(vpcID string) *ListBareMetalServersOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListBareMetalServersOptions) SetVPCCRN(vpcCRN string) *ListBareMetalServersOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListBareMetalServersOptions) SetVPCName(vpcName string) *ListBareMetalServersOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServersOptions) SetHeaders(param map[string]string) *ListBareMetalServersOptions { - 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 - Headers map[string]string -} - -// NewListDedicatedHostDisksOptions : Instantiate ListDedicatedHostDisksOptions -func (*VpcV1) NewListDedicatedHostDisksOptions(dedicatedHostID string) *ListDedicatedHostDisksOptions { - return &ListDedicatedHostDisksOptions{ - DedicatedHostID: core.StringPtr(dedicatedHostID), - } -} - -// SetDedicatedHostID : Allow user to set DedicatedHostID -func (_options *ListDedicatedHostDisksOptions) SetDedicatedHostID(dedicatedHostID string) *ListDedicatedHostDisksOptions { - _options.DedicatedHostID = core.StringPtr(dedicatedHostID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListDedicatedHostDisksOptions) SetHeaders(param map[string]string) *ListDedicatedHostDisksOptions { - options.Headers = param - return options -} - -// ListDedicatedHostGroupsOptions : The ListDedicatedHostGroups options. -type ListDedicatedHostGroupsOptions 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 `zone.name` property matching the exact specified name. - ZoneName *string `json:"zone.name,omitempty"` - - // 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 - Headers map[string]string -} - -// NewListDedicatedHostGroupsOptions : Instantiate ListDedicatedHostGroupsOptions -func (*VpcV1) NewListDedicatedHostGroupsOptions() *ListDedicatedHostGroupsOptions { - return &ListDedicatedHostGroupsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListDedicatedHostGroupsOptions) SetStart(start string) *ListDedicatedHostGroupsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListDedicatedHostGroupsOptions) SetLimit(limit int64) *ListDedicatedHostGroupsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListDedicatedHostGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListDedicatedHostGroupsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *ListDedicatedHostGroupsOptions) SetZoneName(zoneName string) *ListDedicatedHostGroupsOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListDedicatedHostGroupsOptions) SetName(name string) *ListDedicatedHostGroupsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListDedicatedHostGroupsOptions) SetHeaders(param map[string]string) *ListDedicatedHostGroupsOptions { - options.Headers = param - return options -} - -// ListDedicatedHostProfilesOptions : The ListDedicatedHostProfiles options. -type ListDedicatedHostProfilesOptions 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 -} - -// NewListDedicatedHostProfilesOptions : Instantiate ListDedicatedHostProfilesOptions -func (*VpcV1) NewListDedicatedHostProfilesOptions() *ListDedicatedHostProfilesOptions { - return &ListDedicatedHostProfilesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListDedicatedHostProfilesOptions) SetStart(start string) *ListDedicatedHostProfilesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListDedicatedHostProfilesOptions) SetLimit(limit int64) *ListDedicatedHostProfilesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListDedicatedHostProfilesOptions) SetHeaders(param map[string]string) *ListDedicatedHostProfilesOptions { - options.Headers = param - return options -} - -// ListDedicatedHostsOptions : The ListDedicatedHosts options. -type ListDedicatedHostsOptions struct { - // Filters the collection to dedicated hosts with a `group.id` property matching the specified identifier. - DedicatedHostGroupID *string `json:"dedicated_host_group.id,omitempty"` - - // 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 `zone.name` property matching the exact specified name. - ZoneName *string `json:"zone.name,omitempty"` - - // 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 - Headers map[string]string -} - -// NewListDedicatedHostsOptions : Instantiate ListDedicatedHostsOptions -func (*VpcV1) NewListDedicatedHostsOptions() *ListDedicatedHostsOptions { - return &ListDedicatedHostsOptions{} -} - -// SetDedicatedHostGroupID : Allow user to set DedicatedHostGroupID -func (_options *ListDedicatedHostsOptions) SetDedicatedHostGroupID(dedicatedHostGroupID string) *ListDedicatedHostsOptions { - _options.DedicatedHostGroupID = core.StringPtr(dedicatedHostGroupID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListDedicatedHostsOptions) SetStart(start string) *ListDedicatedHostsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListDedicatedHostsOptions) SetLimit(limit int64) *ListDedicatedHostsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListDedicatedHostsOptions) SetResourceGroupID(resourceGroupID string) *ListDedicatedHostsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *ListDedicatedHostsOptions) SetZoneName(zoneName string) *ListDedicatedHostsOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListDedicatedHostsOptions) SetName(name string) *ListDedicatedHostsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListDedicatedHostsOptions) SetHeaders(param map[string]string) *ListDedicatedHostsOptions { - options.Headers = param - return options -} - -// ListEndpointGatewayIpsOptions : The ListEndpointGatewayIps options. -type ListEndpointGatewayIpsOptions struct { - // The endpoint gateway identifier. - EndpointGatewayID *string `json:"endpoint_gateway_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"` - - // 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 ListEndpointGatewayIpsOptions.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 ( - ListEndpointGatewayIpsOptionsSortAddressConst = "address" - ListEndpointGatewayIpsOptionsSortCreatedAtConst = "created_at" - ListEndpointGatewayIpsOptionsSortNameConst = "name" -) - -// NewListEndpointGatewayIpsOptions : Instantiate ListEndpointGatewayIpsOptions -func (*VpcV1) NewListEndpointGatewayIpsOptions(endpointGatewayID string) *ListEndpointGatewayIpsOptions { - return &ListEndpointGatewayIpsOptions{ - EndpointGatewayID: core.StringPtr(endpointGatewayID), - } -} - -// SetEndpointGatewayID : Allow user to set EndpointGatewayID -func (_options *ListEndpointGatewayIpsOptions) SetEndpointGatewayID(endpointGatewayID string) *ListEndpointGatewayIpsOptions { - _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListEndpointGatewayIpsOptions) SetStart(start string) *ListEndpointGatewayIpsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListEndpointGatewayIpsOptions) SetLimit(limit int64) *ListEndpointGatewayIpsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListEndpointGatewayIpsOptions) SetSort(sort string) *ListEndpointGatewayIpsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListEndpointGatewayIpsOptions) SetHeaders(param map[string]string) *ListEndpointGatewayIpsOptions { - options.Headers = param - return options -} - -// ListEndpointGatewaysOptions : The ListEndpointGateways options. -type ListEndpointGatewaysOptions struct { - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // 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 `vpc.id` property matching the specified identifier. - VPCID *string `json:"vpc.id,omitempty"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // Filters the collection to resources with a `vpc.name` property matching the exact specified name. - VPCName *string `json:"vpc.name,omitempty"` - - // Filters the collection to endpoint gateways with an `allow_dns_resolution_binding` property matching the specified - // value. - AllowDnsResolutionBinding *bool `json:"allow_dns_resolution_binding,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListEndpointGatewaysOptions : Instantiate ListEndpointGatewaysOptions -func (*VpcV1) NewListEndpointGatewaysOptions() *ListEndpointGatewaysOptions { - return &ListEndpointGatewaysOptions{} -} - -// SetName : Allow user to set Name -func (_options *ListEndpointGatewaysOptions) SetName(name string) *ListEndpointGatewaysOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListEndpointGatewaysOptions) SetStart(start string) *ListEndpointGatewaysOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListEndpointGatewaysOptions) SetLimit(limit int64) *ListEndpointGatewaysOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListEndpointGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListEndpointGatewaysOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListEndpointGatewaysOptions) SetVPCID(vpcID string) *ListEndpointGatewaysOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListEndpointGatewaysOptions) SetVPCCRN(vpcCRN string) *ListEndpointGatewaysOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListEndpointGatewaysOptions) SetVPCName(vpcName string) *ListEndpointGatewaysOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - -// SetAllowDnsResolutionBinding : Allow user to set AllowDnsResolutionBinding -func (_options *ListEndpointGatewaysOptions) SetAllowDnsResolutionBinding(allowDnsResolutionBinding bool) *ListEndpointGatewaysOptions { - _options.AllowDnsResolutionBinding = core.BoolPtr(allowDnsResolutionBinding) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListEndpointGatewaysOptions) SetHeaders(param map[string]string) *ListEndpointGatewaysOptions { - options.Headers = param - return options -} - -// ListFloatingIpsOptions : The ListFloatingIps options. -type ListFloatingIpsOptions 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"` - - // 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 resources with a `target.id` property matching the specified identifier. - TargetID *string `json:"target.id,omitempty"` - - // Filters the collection to resources with a `target.crn` property matching the specified CRN. - TargetCRN *string `json:"target.crn,omitempty"` - - // Filters the collection to resources with a `target.name` property matching the exact specified name. - TargetName *string `json:"target.name,omitempty"` - - // 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 - Headers map[string]string -} - -// Constants associated with the ListFloatingIpsOptions.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 ( - ListFloatingIpsOptionsSortCreatedAtConst = "created_at" - ListFloatingIpsOptionsSortNameConst = "name" -) - -// NewListFloatingIpsOptions : Instantiate ListFloatingIpsOptions -func (*VpcV1) NewListFloatingIpsOptions() *ListFloatingIpsOptions { - return &ListFloatingIpsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListFloatingIpsOptions) SetStart(start string) *ListFloatingIpsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListFloatingIpsOptions) SetLimit(limit int64) *ListFloatingIpsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListFloatingIpsOptions) SetResourceGroupID(resourceGroupID string) *ListFloatingIpsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListFloatingIpsOptions) SetSort(sort string) *ListFloatingIpsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetTargetID : Allow user to set TargetID -func (_options *ListFloatingIpsOptions) SetTargetID(targetID string) *ListFloatingIpsOptions { - _options.TargetID = core.StringPtr(targetID) - return _options -} - -// SetTargetCRN : Allow user to set TargetCRN -func (_options *ListFloatingIpsOptions) SetTargetCRN(targetCRN string) *ListFloatingIpsOptions { - _options.TargetCRN = core.StringPtr(targetCRN) - return _options -} - -// SetTargetName : Allow user to set TargetName -func (_options *ListFloatingIpsOptions) SetTargetName(targetName string) *ListFloatingIpsOptions { - _options.TargetName = core.StringPtr(targetName) - return _options -} - -// SetTargetResourceType : Allow user to set TargetResourceType -func (_options *ListFloatingIpsOptions) SetTargetResourceType(targetResourceType string) *ListFloatingIpsOptions { - _options.TargetResourceType = core.StringPtr(targetResourceType) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListFloatingIpsOptions) SetHeaders(param map[string]string) *ListFloatingIpsOptions { - options.Headers = param - return options -} - -// ListFlowLogCollectorsOptions : The ListFlowLogCollectors options. -type ListFlowLogCollectorsOptions 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"` - - // Filters the collection to resources with a `vpc.id` property matching the specified identifier. - VPCID *string `json:"vpc.id,omitempty"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // Filters the collection to resources with a `vpc.name` property matching the exact specified name. - VPCName *string `json:"vpc.name,omitempty"` - - // Filters the collection to resources with a `target.id` property matching the specified identifier. - TargetID *string `json:"target.id,omitempty"` - - // 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 - Headers map[string]string -} - -// NewListFlowLogCollectorsOptions : Instantiate ListFlowLogCollectorsOptions -func (*VpcV1) NewListFlowLogCollectorsOptions() *ListFlowLogCollectorsOptions { - return &ListFlowLogCollectorsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListFlowLogCollectorsOptions) SetStart(start string) *ListFlowLogCollectorsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListFlowLogCollectorsOptions) SetLimit(limit int64) *ListFlowLogCollectorsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListFlowLogCollectorsOptions) SetResourceGroupID(resourceGroupID string) *ListFlowLogCollectorsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListFlowLogCollectorsOptions) SetName(name string) *ListFlowLogCollectorsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListFlowLogCollectorsOptions) SetVPCID(vpcID string) *ListFlowLogCollectorsOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListFlowLogCollectorsOptions) SetVPCCRN(vpcCRN string) *ListFlowLogCollectorsOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListFlowLogCollectorsOptions) SetVPCName(vpcName string) *ListFlowLogCollectorsOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - -// SetTargetID : Allow user to set TargetID -func (_options *ListFlowLogCollectorsOptions) SetTargetID(targetID string) *ListFlowLogCollectorsOptions { - _options.TargetID = core.StringPtr(targetID) - return _options -} - -// SetTargetResourceType : Allow user to set TargetResourceType -func (_options *ListFlowLogCollectorsOptions) SetTargetResourceType(targetResourceType string) *ListFlowLogCollectorsOptions { - _options.TargetResourceType = core.StringPtr(targetResourceType) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListFlowLogCollectorsOptions) SetHeaders(param map[string]string) *ListFlowLogCollectorsOptions { - options.Headers = param - return options -} - -// ListIkePoliciesOptions : The ListIkePolicies options. -type ListIkePoliciesOptions 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 -} - -// NewListIkePoliciesOptions : Instantiate ListIkePoliciesOptions -func (*VpcV1) NewListIkePoliciesOptions() *ListIkePoliciesOptions { - return &ListIkePoliciesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListIkePoliciesOptions) SetStart(start string) *ListIkePoliciesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListIkePoliciesOptions) SetLimit(limit int64) *ListIkePoliciesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListIkePoliciesOptions) SetHeaders(param map[string]string) *ListIkePoliciesOptions { - options.Headers = param - return options -} - -// ListIkePolicyConnectionsOptions : The ListIkePolicyConnections options. -type ListIkePolicyConnectionsOptions struct { - // The IKE policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListIkePolicyConnectionsOptions : Instantiate ListIkePolicyConnectionsOptions -func (*VpcV1) NewListIkePolicyConnectionsOptions(id string) *ListIkePolicyConnectionsOptions { - return &ListIkePolicyConnectionsOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *ListIkePolicyConnectionsOptions) SetID(id string) *ListIkePolicyConnectionsOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListIkePolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIkePolicyConnectionsOptions { - options.Headers = param - return options -} - -// ListImageExportJobsOptions : The ListImageExportJobs options. -type ListImageExportJobsOptions struct { - // The image identifier. - ImageID *string `json:"image_id" validate:"required,ne="` - - // 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 - Headers map[string]string -} - -// NewListImageExportJobsOptions : Instantiate ListImageExportJobsOptions -func (*VpcV1) NewListImageExportJobsOptions(imageID string) *ListImageExportJobsOptions { - return &ListImageExportJobsOptions{ - ImageID: core.StringPtr(imageID), - } -} - -// SetImageID : Allow user to set ImageID -func (_options *ListImageExportJobsOptions) SetImageID(imageID string) *ListImageExportJobsOptions { - _options.ImageID = core.StringPtr(imageID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListImageExportJobsOptions) SetName(name string) *ListImageExportJobsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListImageExportJobsOptions) SetHeaders(param map[string]string) *ListImageExportJobsOptions { - options.Headers = param - return options -} - -// ListImagesOptions : The ListImages options. -type ListImagesOptions 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"` - - // Filters the collection to images with a `status` property matching one of the specified comma-separated values. - Status []string `json:"status,omitempty"` - - // Filters the collection to images with a `visibility` property matching the specified value. - Visibility *string `json:"visibility,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListImagesOptions.Status property. -const ( - ListImagesOptionsStatusAvailableConst = "available" - ListImagesOptionsStatusDeletingConst = "deleting" - ListImagesOptionsStatusDeprecatedConst = "deprecated" - ListImagesOptionsStatusFailedConst = "failed" - ListImagesOptionsStatusObsoleteConst = "obsolete" - ListImagesOptionsStatusPendingConst = "pending" - ListImagesOptionsStatusUnusableConst = "unusable" -) - -// Constants associated with the ListImagesOptions.Visibility property. -// Filters the collection to images with a `visibility` property matching the specified value. -const ( - ListImagesOptionsVisibilityPrivateConst = "private" - ListImagesOptionsVisibilityPublicConst = "public" -) - -// NewListImagesOptions : Instantiate ListImagesOptions -func (*VpcV1) NewListImagesOptions() *ListImagesOptions { - return &ListImagesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListImagesOptions) SetStart(start string) *ListImagesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListImagesOptions) SetLimit(limit int64) *ListImagesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListImagesOptions) SetResourceGroupID(resourceGroupID string) *ListImagesOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListImagesOptions) SetName(name string) *ListImagesOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetStatus : Allow user to set Status -func (_options *ListImagesOptions) SetStatus(status []string) *ListImagesOptions { - _options.Status = status - return _options -} - -// SetVisibility : Allow user to set Visibility -func (_options *ListImagesOptions) SetVisibility(visibility string) *ListImagesOptions { - _options.Visibility = core.StringPtr(visibility) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListImagesOptions) SetHeaders(param map[string]string) *ListImagesOptions { - 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 - Headers map[string]string -} - -// NewListInstanceDisksOptions : Instantiate ListInstanceDisksOptions -func (*VpcV1) NewListInstanceDisksOptions(instanceID string) *ListInstanceDisksOptions { - return &ListInstanceDisksOptions{ - InstanceID: core.StringPtr(instanceID), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *ListInstanceDisksOptions) SetInstanceID(instanceID string) *ListInstanceDisksOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceDisksOptions) SetHeaders(param map[string]string) *ListInstanceDisksOptions { - options.Headers = param - return options -} - -// ListInstanceGroupManagerActionsOptions : The ListInstanceGroupManagerActions options. -type ListInstanceGroupManagerActionsOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_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 -} - -// NewListInstanceGroupManagerActionsOptions : Instantiate ListInstanceGroupManagerActionsOptions -func (*VpcV1) NewListInstanceGroupManagerActionsOptions(instanceGroupID string, instanceGroupManagerID string) *ListInstanceGroupManagerActionsOptions { - return &ListInstanceGroupManagerActionsOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *ListInstanceGroupManagerActionsOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagerActionsOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *ListInstanceGroupManagerActionsOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *ListInstanceGroupManagerActionsOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListInstanceGroupManagerActionsOptions) SetStart(start string) *ListInstanceGroupManagerActionsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListInstanceGroupManagerActionsOptions) SetLimit(limit int64) *ListInstanceGroupManagerActionsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceGroupManagerActionsOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagerActionsOptions { - options.Headers = param - return options -} - -// ListInstanceGroupManagerPoliciesOptions : The ListInstanceGroupManagerPolicies options. -type ListInstanceGroupManagerPoliciesOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_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 -} - -// NewListInstanceGroupManagerPoliciesOptions : Instantiate ListInstanceGroupManagerPoliciesOptions -func (*VpcV1) NewListInstanceGroupManagerPoliciesOptions(instanceGroupID string, instanceGroupManagerID string) *ListInstanceGroupManagerPoliciesOptions { - return &ListInstanceGroupManagerPoliciesOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *ListInstanceGroupManagerPoliciesOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagerPoliciesOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *ListInstanceGroupManagerPoliciesOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *ListInstanceGroupManagerPoliciesOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListInstanceGroupManagerPoliciesOptions) SetStart(start string) *ListInstanceGroupManagerPoliciesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListInstanceGroupManagerPoliciesOptions) SetLimit(limit int64) *ListInstanceGroupManagerPoliciesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceGroupManagerPoliciesOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagerPoliciesOptions { - options.Headers = param - return options -} - -// ListInstanceGroupManagersOptions : The ListInstanceGroupManagers options. -type ListInstanceGroupManagersOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_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 -} - -// NewListInstanceGroupManagersOptions : Instantiate ListInstanceGroupManagersOptions -func (*VpcV1) NewListInstanceGroupManagersOptions(instanceGroupID string) *ListInstanceGroupManagersOptions { - return &ListInstanceGroupManagersOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *ListInstanceGroupManagersOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagersOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListInstanceGroupManagersOptions) SetStart(start string) *ListInstanceGroupManagersOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListInstanceGroupManagersOptions) SetLimit(limit int64) *ListInstanceGroupManagersOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceGroupManagersOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagersOptions { - options.Headers = param - return options -} - -// ListInstanceGroupMembershipsOptions : The ListInstanceGroupMemberships options. -type ListInstanceGroupMembershipsOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_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 -} - -// NewListInstanceGroupMembershipsOptions : Instantiate ListInstanceGroupMembershipsOptions -func (*VpcV1) NewListInstanceGroupMembershipsOptions(instanceGroupID string) *ListInstanceGroupMembershipsOptions { - return &ListInstanceGroupMembershipsOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *ListInstanceGroupMembershipsOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupMembershipsOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListInstanceGroupMembershipsOptions) SetStart(start string) *ListInstanceGroupMembershipsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListInstanceGroupMembershipsOptions) SetLimit(limit int64) *ListInstanceGroupMembershipsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceGroupMembershipsOptions) SetHeaders(param map[string]string) *ListInstanceGroupMembershipsOptions { - options.Headers = param - return options -} - -// ListInstanceGroupsOptions : The ListInstanceGroups options. -type ListInstanceGroupsOptions 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 -} - -// NewListInstanceGroupsOptions : Instantiate ListInstanceGroupsOptions -func (*VpcV1) NewListInstanceGroupsOptions() *ListInstanceGroupsOptions { - return &ListInstanceGroupsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListInstanceGroupsOptions) SetStart(start string) *ListInstanceGroupsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListInstanceGroupsOptions) SetLimit(limit int64) *ListInstanceGroupsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceGroupsOptions) SetHeaders(param map[string]string) *ListInstanceGroupsOptions { - options.Headers = param - return options -} - -// ListInstanceNetworkAttachmentsOptions : The ListInstanceNetworkAttachments options. -type ListInstanceNetworkAttachmentsOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceNetworkAttachmentsOptions : Instantiate ListInstanceNetworkAttachmentsOptions -func (*VpcV1) NewListInstanceNetworkAttachmentsOptions(instanceID string) *ListInstanceNetworkAttachmentsOptions { - return &ListInstanceNetworkAttachmentsOptions{ - InstanceID: core.StringPtr(instanceID), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *ListInstanceNetworkAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkAttachmentsOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceNetworkAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkAttachmentsOptions { - options.Headers = param - return options -} - -// ListInstanceNetworkInterfaceFloatingIpsOptions : The ListInstanceNetworkInterfaceFloatingIps options. -type ListInstanceNetworkInterfaceFloatingIpsOptions 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="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceNetworkInterfaceFloatingIpsOptions : Instantiate ListInstanceNetworkInterfaceFloatingIpsOptions -func (*VpcV1) NewListInstanceNetworkInterfaceFloatingIpsOptions(instanceID string, networkInterfaceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { - return &ListInstanceNetworkInterfaceFloatingIpsOptions{ - InstanceID: core.StringPtr(instanceID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfaceFloatingIpsOptions { - options.Headers = param - return options -} - -// ListInstanceNetworkInterfaceIpsOptions : The ListInstanceNetworkInterfaceIps options. -type ListInstanceNetworkInterfaceIpsOptions 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="` - - // 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 -} - -// NewListInstanceNetworkInterfaceIpsOptions : Instantiate ListInstanceNetworkInterfaceIpsOptions -func (*VpcV1) NewListInstanceNetworkInterfaceIpsOptions(instanceID string, networkInterfaceID string) *ListInstanceNetworkInterfaceIpsOptions { - return &ListInstanceNetworkInterfaceIpsOptions{ - InstanceID: core.StringPtr(instanceID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *ListInstanceNetworkInterfaceIpsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfaceIpsOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *ListInstanceNetworkInterfaceIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListInstanceNetworkInterfaceIpsOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListInstanceNetworkInterfaceIpsOptions) SetStart(start string) *ListInstanceNetworkInterfaceIpsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListInstanceNetworkInterfaceIpsOptions) SetLimit(limit int64) *ListInstanceNetworkInterfaceIpsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfaceIpsOptions { - options.Headers = param - return options -} - -// ListInstanceNetworkInterfacesOptions : The ListInstanceNetworkInterfaces options. -type ListInstanceNetworkInterfacesOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceNetworkInterfacesOptions : Instantiate ListInstanceNetworkInterfacesOptions -func (*VpcV1) NewListInstanceNetworkInterfacesOptions(instanceID string) *ListInstanceNetworkInterfacesOptions { - return &ListInstanceNetworkInterfacesOptions{ - InstanceID: core.StringPtr(instanceID), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *ListInstanceNetworkInterfacesOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfacesOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfacesOptions { - options.Headers = param - return options -} - -// ListInstanceProfilesOptions : The ListInstanceProfiles options. -type ListInstanceProfilesOptions struct { - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceProfilesOptions : Instantiate ListInstanceProfilesOptions -func (*VpcV1) NewListInstanceProfilesOptions() *ListInstanceProfilesOptions { - return &ListInstanceProfilesOptions{} -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceProfilesOptions) SetHeaders(param map[string]string) *ListInstanceProfilesOptions { - options.Headers = param - return options -} - -// ListInstanceTemplatesOptions : The ListInstanceTemplates options. -type ListInstanceTemplatesOptions struct { - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceTemplatesOptions : Instantiate ListInstanceTemplatesOptions -func (*VpcV1) NewListInstanceTemplatesOptions() *ListInstanceTemplatesOptions { - return &ListInstanceTemplatesOptions{} -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceTemplatesOptions) SetHeaders(param map[string]string) *ListInstanceTemplatesOptions { - options.Headers = param - return options -} - -// ListInstanceVolumeAttachmentsOptions : The ListInstanceVolumeAttachments options. -type ListInstanceVolumeAttachmentsOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListInstanceVolumeAttachmentsOptions : Instantiate ListInstanceVolumeAttachmentsOptions -func (*VpcV1) NewListInstanceVolumeAttachmentsOptions(instanceID string) *ListInstanceVolumeAttachmentsOptions { - return &ListInstanceVolumeAttachmentsOptions{ - InstanceID: core.StringPtr(instanceID), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *ListInstanceVolumeAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceVolumeAttachmentsOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceVolumeAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceVolumeAttachmentsOptions { - options.Headers = param - return options -} - -// ListInstancesOptions : The ListInstances options. -type ListInstancesOptions 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"` - - // Filters the collection to resources with a `dedicated_host.id` property matching the specified identifier. - DedicatedHostID *string `json:"dedicated_host.id,omitempty"` - - // Filters the collection to resources with a `dedicated_host.crn` property matching the specified CRN. - DedicatedHostCRN *string `json:"dedicated_host.crn,omitempty"` - - // Filters the collection to resources with a `dedicated_host.name` property matching the exact specified name. - DedicatedHostName *string `json:"dedicated_host.name,omitempty"` - - // Filters the collection to resources with a `placement_target.id` property matching the specified placement group - // identifier. - PlacementGroupID *string `json:"placement_group.id,omitempty"` - - // Filters the collection to resources with a `placement_target.crn` property matching the specified placement group - // CRN. - PlacementGroupCRN *string `json:"placement_group.crn,omitempty"` - - // Filters the collection to resources with a `placement_target.name` property matching the exact specified placement - // group name. - PlacementGroupName *string `json:"placement_group.name,omitempty"` - - // Filters the collection to resources with a `reservation.id` property matching the specified identifier. - ReservationID *string `json:"reservation.id,omitempty"` - - // Filters the collection to resources with a `reservation.crn` property matching the specified CRN. - ReservationCRN *string `json:"reservation.crn,omitempty"` - - // Filters the collection to resources with a `reservation.name` property matching the exact specified name. - ReservationName *string `json:"reservation.name,omitempty"` - - // Filters the collection to resources with a `vpc.id` property matching the specified identifier. - VPCID *string `json:"vpc.id,omitempty"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // 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 - Headers map[string]string -} - -// NewListInstancesOptions : Instantiate ListInstancesOptions -func (*VpcV1) NewListInstancesOptions() *ListInstancesOptions { - return &ListInstancesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListInstancesOptions) SetStart(start string) *ListInstancesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListInstancesOptions) SetLimit(limit int64) *ListInstancesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListInstancesOptions) SetResourceGroupID(resourceGroupID string) *ListInstancesOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListInstancesOptions) SetName(name string) *ListInstancesOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetDedicatedHostID : Allow user to set DedicatedHostID -func (_options *ListInstancesOptions) SetDedicatedHostID(dedicatedHostID string) *ListInstancesOptions { - _options.DedicatedHostID = core.StringPtr(dedicatedHostID) - return _options -} - -// SetDedicatedHostCRN : Allow user to set DedicatedHostCRN -func (_options *ListInstancesOptions) SetDedicatedHostCRN(dedicatedHostCRN string) *ListInstancesOptions { - _options.DedicatedHostCRN = core.StringPtr(dedicatedHostCRN) - return _options -} - -// SetDedicatedHostName : Allow user to set DedicatedHostName -func (_options *ListInstancesOptions) SetDedicatedHostName(dedicatedHostName string) *ListInstancesOptions { - _options.DedicatedHostName = core.StringPtr(dedicatedHostName) - return _options -} - -// SetPlacementGroupID : Allow user to set PlacementGroupID -func (_options *ListInstancesOptions) SetPlacementGroupID(placementGroupID string) *ListInstancesOptions { - _options.PlacementGroupID = core.StringPtr(placementGroupID) - return _options -} - -// SetPlacementGroupCRN : Allow user to set PlacementGroupCRN -func (_options *ListInstancesOptions) SetPlacementGroupCRN(placementGroupCRN string) *ListInstancesOptions { - _options.PlacementGroupCRN = core.StringPtr(placementGroupCRN) - return _options -} - -// SetPlacementGroupName : Allow user to set PlacementGroupName -func (_options *ListInstancesOptions) SetPlacementGroupName(placementGroupName string) *ListInstancesOptions { - _options.PlacementGroupName = core.StringPtr(placementGroupName) - return _options -} - -// SetReservationID : Allow user to set ReservationID -func (_options *ListInstancesOptions) SetReservationID(reservationID string) *ListInstancesOptions { - _options.ReservationID = core.StringPtr(reservationID) - return _options -} - -// SetReservationCRN : Allow user to set ReservationCRN -func (_options *ListInstancesOptions) SetReservationCRN(reservationCRN string) *ListInstancesOptions { - _options.ReservationCRN = core.StringPtr(reservationCRN) - return _options -} - -// SetReservationName : Allow user to set ReservationName -func (_options *ListInstancesOptions) SetReservationName(reservationName string) *ListInstancesOptions { - _options.ReservationName = core.StringPtr(reservationName) - return _options -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListInstancesOptions) SetVPCID(vpcID string) *ListInstancesOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListInstancesOptions) SetVPCCRN(vpcCRN string) *ListInstancesOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListInstancesOptions) SetVPCName(vpcName string) *ListInstancesOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstancesOptions) SetHeaders(param map[string]string) *ListInstancesOptions { - options.Headers = param - return options -} - -// ListIpsecPoliciesOptions : The ListIpsecPolicies options. -type ListIpsecPoliciesOptions 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 -} - -// NewListIpsecPoliciesOptions : Instantiate ListIpsecPoliciesOptions -func (*VpcV1) NewListIpsecPoliciesOptions() *ListIpsecPoliciesOptions { - return &ListIpsecPoliciesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListIpsecPoliciesOptions) SetStart(start string) *ListIpsecPoliciesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListIpsecPoliciesOptions) SetLimit(limit int64) *ListIpsecPoliciesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListIpsecPoliciesOptions) SetHeaders(param map[string]string) *ListIpsecPoliciesOptions { - options.Headers = param - return options -} - -// ListIpsecPolicyConnectionsOptions : The ListIpsecPolicyConnections options. -type ListIpsecPolicyConnectionsOptions struct { - // The IPsec policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListIpsecPolicyConnectionsOptions : Instantiate ListIpsecPolicyConnectionsOptions -func (*VpcV1) NewListIpsecPolicyConnectionsOptions(id string) *ListIpsecPolicyConnectionsOptions { - return &ListIpsecPolicyConnectionsOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *ListIpsecPolicyConnectionsOptions) SetID(id string) *ListIpsecPolicyConnectionsOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListIpsecPolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIpsecPolicyConnectionsOptions { - options.Headers = param - return options -} - -// ListKeysOptions : The ListKeys options. -type ListKeysOptions 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 -} - -// NewListKeysOptions : Instantiate ListKeysOptions -func (*VpcV1) NewListKeysOptions() *ListKeysOptions { - return &ListKeysOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListKeysOptions) SetStart(start string) *ListKeysOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListKeysOptions) SetLimit(limit int64) *ListKeysOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListKeysOptions) SetHeaders(param map[string]string) *ListKeysOptions { - options.Headers = param - return options -} - -// ListLoadBalancerListenerPoliciesOptions : The ListLoadBalancerListenerPolicies options. -type ListLoadBalancerListenerPoliciesOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListLoadBalancerListenerPoliciesOptions : Instantiate ListLoadBalancerListenerPoliciesOptions -func (*VpcV1) NewListLoadBalancerListenerPoliciesOptions(loadBalancerID string, listenerID string) *ListLoadBalancerListenerPoliciesOptions { - return &ListLoadBalancerListenerPoliciesOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *ListLoadBalancerListenerPoliciesOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenerPoliciesOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *ListLoadBalancerListenerPoliciesOptions) SetListenerID(listenerID string) *ListLoadBalancerListenerPoliciesOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListLoadBalancerListenerPoliciesOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenerPoliciesOptions { - options.Headers = param - return options -} - -// ListLoadBalancerListenerPolicyRulesOptions : The ListLoadBalancerListenerPolicyRules options. -type ListLoadBalancerListenerPolicyRulesOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - PolicyID *string `json:"policy_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListLoadBalancerListenerPolicyRulesOptions : Instantiate ListLoadBalancerListenerPolicyRulesOptions -func (*VpcV1) NewListLoadBalancerListenerPolicyRulesOptions(loadBalancerID string, listenerID string, policyID string) *ListLoadBalancerListenerPolicyRulesOptions { - return &ListLoadBalancerListenerPolicyRulesOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - PolicyID: core.StringPtr(policyID), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenerPolicyRulesOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetListenerID(listenerID string) *ListLoadBalancerListenerPolicyRulesOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetPolicyID : Allow user to set PolicyID -func (_options *ListLoadBalancerListenerPolicyRulesOptions) SetPolicyID(policyID string) *ListLoadBalancerListenerPolicyRulesOptions { - _options.PolicyID = core.StringPtr(policyID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListLoadBalancerListenerPolicyRulesOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenerPolicyRulesOptions { - options.Headers = param - return options -} - -// ListLoadBalancerListenersOptions : The ListLoadBalancerListeners options. -type ListLoadBalancerListenersOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListLoadBalancerListenersOptions : Instantiate ListLoadBalancerListenersOptions -func (*VpcV1) NewListLoadBalancerListenersOptions(loadBalancerID string) *ListLoadBalancerListenersOptions { - return &ListLoadBalancerListenersOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *ListLoadBalancerListenersOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenersOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListLoadBalancerListenersOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenersOptions { - options.Headers = param - return options -} - -// ListLoadBalancerPoolMembersOptions : The ListLoadBalancerPoolMembers options. -type ListLoadBalancerPoolMembersOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - PoolID *string `json:"pool_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListLoadBalancerPoolMembersOptions : Instantiate ListLoadBalancerPoolMembersOptions -func (*VpcV1) NewListLoadBalancerPoolMembersOptions(loadBalancerID string, poolID string) *ListLoadBalancerPoolMembersOptions { - return &ListLoadBalancerPoolMembersOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - PoolID: core.StringPtr(poolID), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *ListLoadBalancerPoolMembersOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerPoolMembersOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetPoolID : Allow user to set PoolID -func (_options *ListLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *ListLoadBalancerPoolMembersOptions { - _options.PoolID = core.StringPtr(poolID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ListLoadBalancerPoolMembersOptions { - options.Headers = param - return options -} - -// ListLoadBalancerPoolsOptions : The ListLoadBalancerPools options. -type ListLoadBalancerPoolsOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListLoadBalancerPoolsOptions : Instantiate ListLoadBalancerPoolsOptions -func (*VpcV1) NewListLoadBalancerPoolsOptions(loadBalancerID string) *ListLoadBalancerPoolsOptions { - return &ListLoadBalancerPoolsOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *ListLoadBalancerPoolsOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerPoolsOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListLoadBalancerPoolsOptions) SetHeaders(param map[string]string) *ListLoadBalancerPoolsOptions { - options.Headers = param - return options -} - -// ListLoadBalancerProfilesOptions : The ListLoadBalancerProfiles options. -type ListLoadBalancerProfilesOptions 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 -} - -// NewListLoadBalancerProfilesOptions : Instantiate ListLoadBalancerProfilesOptions -func (*VpcV1) NewListLoadBalancerProfilesOptions() *ListLoadBalancerProfilesOptions { - return &ListLoadBalancerProfilesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListLoadBalancerProfilesOptions) SetStart(start string) *ListLoadBalancerProfilesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListLoadBalancerProfilesOptions) SetLimit(limit int64) *ListLoadBalancerProfilesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListLoadBalancerProfilesOptions) SetHeaders(param map[string]string) *ListLoadBalancerProfilesOptions { - options.Headers = param - return options -} - -// ListLoadBalancersOptions : The ListLoadBalancers options. -type ListLoadBalancersOptions 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 -} - -// NewListLoadBalancersOptions : Instantiate ListLoadBalancersOptions -func (*VpcV1) NewListLoadBalancersOptions() *ListLoadBalancersOptions { - return &ListLoadBalancersOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListLoadBalancersOptions) SetStart(start string) *ListLoadBalancersOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListLoadBalancersOptions) SetLimit(limit int64) *ListLoadBalancersOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListLoadBalancersOptions) SetHeaders(param map[string]string) *ListLoadBalancersOptions { - options.Headers = param - return options -} - -// ListNetworkACLRulesOptions : The ListNetworkACLRules options. -type ListNetworkACLRulesOptions struct { - // The network ACL identifier. - NetworkACLID *string `json:"network_acl_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 rules with a `direction` property matching the specified value. - Direction *string `json:"direction,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListNetworkACLRulesOptions.Direction property. -// Filters the collection to rules with a `direction` property matching the specified value. -const ( - ListNetworkACLRulesOptionsDirectionInboundConst = "inbound" - ListNetworkACLRulesOptionsDirectionOutboundConst = "outbound" -) - -// NewListNetworkACLRulesOptions : Instantiate ListNetworkACLRulesOptions -func (*VpcV1) NewListNetworkACLRulesOptions(networkACLID string) *ListNetworkACLRulesOptions { - return &ListNetworkACLRulesOptions{ - NetworkACLID: core.StringPtr(networkACLID), - } -} - -// SetNetworkACLID : Allow user to set NetworkACLID -func (_options *ListNetworkACLRulesOptions) SetNetworkACLID(networkACLID string) *ListNetworkACLRulesOptions { - _options.NetworkACLID = core.StringPtr(networkACLID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListNetworkACLRulesOptions) SetStart(start string) *ListNetworkACLRulesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListNetworkACLRulesOptions) SetLimit(limit int64) *ListNetworkACLRulesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetDirection : Allow user to set Direction -func (_options *ListNetworkACLRulesOptions) SetDirection(direction string) *ListNetworkACLRulesOptions { - _options.Direction = core.StringPtr(direction) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListNetworkACLRulesOptions) SetHeaders(param map[string]string) *ListNetworkACLRulesOptions { - options.Headers = param - return options -} - -// ListNetworkAclsOptions : The ListNetworkAcls options. -type ListNetworkAclsOptions 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"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListNetworkAclsOptions : Instantiate ListNetworkAclsOptions -func (*VpcV1) NewListNetworkAclsOptions() *ListNetworkAclsOptions { - return &ListNetworkAclsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListNetworkAclsOptions) SetStart(start string) *ListNetworkAclsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListNetworkAclsOptions) SetLimit(limit int64) *ListNetworkAclsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListNetworkAclsOptions) SetResourceGroupID(resourceGroupID string) *ListNetworkAclsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListNetworkAclsOptions) SetHeaders(param map[string]string) *ListNetworkAclsOptions { - options.Headers = param - return options -} - -// ListNetworkInterfaceFloatingIpsOptions : The ListNetworkInterfaceFloatingIps options. -type ListNetworkInterfaceFloatingIpsOptions struct { - // The virtual network interface identifier. - VirtualNetworkInterfaceID *string `json:"virtual_network_interface_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"` - - // 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 - // `-name` sorts the collection by the `name` 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 ListNetworkInterfaceFloatingIpsOptions.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 -// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` -// property in ascending order. -const ( - ListNetworkInterfaceFloatingIpsOptionsSortAddressConst = "address" - ListNetworkInterfaceFloatingIpsOptionsSortNameConst = "name" -) - -// NewListNetworkInterfaceFloatingIpsOptions : Instantiate ListNetworkInterfaceFloatingIpsOptions -func (*VpcV1) NewListNetworkInterfaceFloatingIpsOptions(virtualNetworkInterfaceID string) *ListNetworkInterfaceFloatingIpsOptions { - return &ListNetworkInterfaceFloatingIpsOptions{ - VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), - } -} - -// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID -func (_options *ListNetworkInterfaceFloatingIpsOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *ListNetworkInterfaceFloatingIpsOptions { - _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListNetworkInterfaceFloatingIpsOptions) SetStart(start string) *ListNetworkInterfaceFloatingIpsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListNetworkInterfaceFloatingIpsOptions) SetLimit(limit int64) *ListNetworkInterfaceFloatingIpsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListNetworkInterfaceFloatingIpsOptions) SetSort(sort string) *ListNetworkInterfaceFloatingIpsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListNetworkInterfaceFloatingIpsOptions { - options.Headers = param - return options -} - -// ListOperatingSystemsOptions : The ListOperatingSystems options. -type ListOperatingSystemsOptions 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 -} - -// NewListOperatingSystemsOptions : Instantiate ListOperatingSystemsOptions -func (*VpcV1) NewListOperatingSystemsOptions() *ListOperatingSystemsOptions { - return &ListOperatingSystemsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListOperatingSystemsOptions) SetStart(start string) *ListOperatingSystemsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListOperatingSystemsOptions) SetLimit(limit int64) *ListOperatingSystemsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListOperatingSystemsOptions) SetHeaders(param map[string]string) *ListOperatingSystemsOptions { - options.Headers = param - return options -} - -// ListPlacementGroupsOptions : The ListPlacementGroups options. -type ListPlacementGroupsOptions 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 -} - -// NewListPlacementGroupsOptions : Instantiate ListPlacementGroupsOptions -func (*VpcV1) NewListPlacementGroupsOptions() *ListPlacementGroupsOptions { - return &ListPlacementGroupsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListPlacementGroupsOptions) SetStart(start string) *ListPlacementGroupsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListPlacementGroupsOptions) SetLimit(limit int64) *ListPlacementGroupsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListPlacementGroupsOptions) SetHeaders(param map[string]string) *ListPlacementGroupsOptions { - options.Headers = param - return options -} - -// ListPublicGatewaysOptions : The ListPublicGateways options. -type ListPublicGatewaysOptions 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"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListPublicGatewaysOptions : Instantiate ListPublicGatewaysOptions -func (*VpcV1) NewListPublicGatewaysOptions() *ListPublicGatewaysOptions { - return &ListPublicGatewaysOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListPublicGatewaysOptions) SetStart(start string) *ListPublicGatewaysOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListPublicGatewaysOptions) SetLimit(limit int64) *ListPublicGatewaysOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListPublicGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListPublicGatewaysOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListPublicGatewaysOptions) SetHeaders(param map[string]string) *ListPublicGatewaysOptions { - options.Headers = param - return options -} - -// ListRegionZonesOptions : The ListRegionZones options. -type ListRegionZonesOptions struct { - // The region name. - RegionName *string `json:"region_name" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListRegionZonesOptions : Instantiate ListRegionZonesOptions -func (*VpcV1) NewListRegionZonesOptions(regionName string) *ListRegionZonesOptions { - return &ListRegionZonesOptions{ - RegionName: core.StringPtr(regionName), - } -} - -// SetRegionName : Allow user to set RegionName -func (_options *ListRegionZonesOptions) SetRegionName(regionName string) *ListRegionZonesOptions { - _options.RegionName = core.StringPtr(regionName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListRegionZonesOptions) SetHeaders(param map[string]string) *ListRegionZonesOptions { - options.Headers = param - return options -} - -// ListRegionsOptions : The ListRegions options. -type ListRegionsOptions struct { - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListRegionsOptions : Instantiate ListRegionsOptions -func (*VpcV1) NewListRegionsOptions() *ListRegionsOptions { - return &ListRegionsOptions{} -} - -// SetHeaders : Allow user to set Headers -func (options *ListRegionsOptions) SetHeaders(param map[string]string) *ListRegionsOptions { - options.Headers = param - return options -} - -// ListReservationsOptions : The ListReservations options. -type ListReservationsOptions 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 `name` property matching the exact specified name. - Name *string `json:"name,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 `zone.name` property matching the exact specified name. - ZoneName *string `json:"zone.name,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListReservationsOptions : Instantiate ListReservationsOptions -func (*VpcV1) NewListReservationsOptions() *ListReservationsOptions { - return &ListReservationsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListReservationsOptions) SetStart(start string) *ListReservationsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListReservationsOptions) SetLimit(limit int64) *ListReservationsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListReservationsOptions) SetName(name string) *ListReservationsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListReservationsOptions) SetResourceGroupID(resourceGroupID string) *ListReservationsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *ListReservationsOptions) SetZoneName(zoneName string) *ListReservationsOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListReservationsOptions) SetHeaders(param map[string]string) *ListReservationsOptions { - options.Headers = param - return options -} - -// ListSecurityGroupRulesOptions : The ListSecurityGroupRules options. -type ListSecurityGroupRulesOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListSecurityGroupRulesOptions : Instantiate ListSecurityGroupRulesOptions -func (*VpcV1) NewListSecurityGroupRulesOptions(securityGroupID string) *ListSecurityGroupRulesOptions { - return &ListSecurityGroupRulesOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *ListSecurityGroupRulesOptions) SetSecurityGroupID(securityGroupID string) *ListSecurityGroupRulesOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSecurityGroupRulesOptions) SetHeaders(param map[string]string) *ListSecurityGroupRulesOptions { - options.Headers = param - return options -} - -// ListSecurityGroupTargetsOptions : The ListSecurityGroupTargets options. -type ListSecurityGroupTargetsOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_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 -} - -// NewListSecurityGroupTargetsOptions : Instantiate ListSecurityGroupTargetsOptions -func (*VpcV1) NewListSecurityGroupTargetsOptions(securityGroupID string) *ListSecurityGroupTargetsOptions { - return &ListSecurityGroupTargetsOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *ListSecurityGroupTargetsOptions) SetSecurityGroupID(securityGroupID string) *ListSecurityGroupTargetsOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListSecurityGroupTargetsOptions) SetStart(start string) *ListSecurityGroupTargetsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListSecurityGroupTargetsOptions) SetLimit(limit int64) *ListSecurityGroupTargetsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSecurityGroupTargetsOptions) SetHeaders(param map[string]string) *ListSecurityGroupTargetsOptions { - options.Headers = param - return options -} - -// ListSecurityGroupsOptions : The ListSecurityGroups options. -type ListSecurityGroupsOptions 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 `vpc.id` property matching the specified identifier. - VPCID *string `json:"vpc.id,omitempty"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // 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 - Headers map[string]string -} - -// NewListSecurityGroupsOptions : Instantiate ListSecurityGroupsOptions -func (*VpcV1) NewListSecurityGroupsOptions() *ListSecurityGroupsOptions { - return &ListSecurityGroupsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListSecurityGroupsOptions) SetStart(start string) *ListSecurityGroupsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListSecurityGroupsOptions) SetLimit(limit int64) *ListSecurityGroupsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListSecurityGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListSecurityGroupsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListSecurityGroupsOptions) SetVPCID(vpcID string) *ListSecurityGroupsOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListSecurityGroupsOptions) SetVPCCRN(vpcCRN string) *ListSecurityGroupsOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListSecurityGroupsOptions) SetVPCName(vpcName string) *ListSecurityGroupsOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSecurityGroupsOptions) SetHeaders(param map[string]string) *ListSecurityGroupsOptions { - options.Headers = param - return options -} - -// ListShareMountTargetsOptions : The ListShareMountTargets options. -type ListShareMountTargetsOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // 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 -} - -// NewListShareMountTargetsOptions : Instantiate ListShareMountTargetsOptions -func (*VpcV1) NewListShareMountTargetsOptions(shareID string) *ListShareMountTargetsOptions { - return &ListShareMountTargetsOptions{ - ShareID: core.StringPtr(shareID), - } -} - -// SetShareID : Allow user to set ShareID -func (_options *ListShareMountTargetsOptions) SetShareID(shareID string) *ListShareMountTargetsOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListShareMountTargetsOptions) SetName(name string) *ListShareMountTargetsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListShareMountTargetsOptions) SetStart(start string) *ListShareMountTargetsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListShareMountTargetsOptions) SetLimit(limit int64) *ListShareMountTargetsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListShareMountTargetsOptions) SetHeaders(param map[string]string) *ListShareMountTargetsOptions { - options.Headers = param - return options -} - -// ListShareProfilesOptions : The ListShareProfiles options. -type ListShareProfilesOptions 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"` - - // 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 ListShareProfilesOptions.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 ( - ListShareProfilesOptionsSortCreatedAtConst = "created_at" - ListShareProfilesOptionsSortNameConst = "name" -) - -// NewListShareProfilesOptions : Instantiate ListShareProfilesOptions -func (*VpcV1) NewListShareProfilesOptions() *ListShareProfilesOptions { - return &ListShareProfilesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListShareProfilesOptions) SetStart(start string) *ListShareProfilesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListShareProfilesOptions) SetLimit(limit int64) *ListShareProfilesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListShareProfilesOptions) SetSort(sort string) *ListShareProfilesOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListShareProfilesOptions) SetHeaders(param map[string]string) *ListShareProfilesOptions { - options.Headers = param - return options -} - -// ListSharesOptions : The ListShares options. -type ListSharesOptions 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 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 - Headers map[string]string -} - -// Constants associated with the ListSharesOptions.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 ( - ListSharesOptionsSortCreatedAtConst = "created_at" - ListSharesOptionsSortNameConst = "name" -) - -// Constants associated with the ListSharesOptions.ReplicationRole property. -// Filters the collection to file shares with a `replication_role` property matching the specified value. -const ( - ListSharesOptionsReplicationRoleNoneConst = "none" - ListSharesOptionsReplicationRoleReplicaConst = "replica" - ListSharesOptionsReplicationRoleSourceConst = "source" -) - -// NewListSharesOptions : Instantiate ListSharesOptions -func (*VpcV1) NewListSharesOptions() *ListSharesOptions { - return &ListSharesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListSharesOptions) SetStart(start string) *ListSharesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListSharesOptions) SetLimit(limit int64) *ListSharesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListSharesOptions) SetResourceGroupID(resourceGroupID string) *ListSharesOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListSharesOptions) SetName(name string) *ListSharesOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListSharesOptions) SetSort(sort string) *ListSharesOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetReplicationRole : Allow user to set ReplicationRole -func (_options *ListSharesOptions) SetReplicationRole(replicationRole string) *ListSharesOptions { - _options.ReplicationRole = core.StringPtr(replicationRole) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSharesOptions) SetHeaders(param map[string]string) *ListSharesOptions { - options.Headers = param - return options -} - -// ListSnapshotClonesOptions : The ListSnapshotClones options. -type ListSnapshotClonesOptions struct { - // The snapshot identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListSnapshotClonesOptions : Instantiate ListSnapshotClonesOptions -func (*VpcV1) NewListSnapshotClonesOptions(id string) *ListSnapshotClonesOptions { - return &ListSnapshotClonesOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *ListSnapshotClonesOptions) SetID(id string) *ListSnapshotClonesOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSnapshotClonesOptions) SetHeaders(param map[string]string) *ListSnapshotClonesOptions { - options.Headers = param - return options -} - -// ListSnapshotConsistencyGroupsOptions : The ListSnapshotConsistencyGroups options. -type ListSnapshotConsistencyGroupsOptions 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 backup policy jobs with a `backup_policy_plan.id` property matching the specified - // identifier. - BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListSnapshotConsistencyGroupsOptions.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 ( - ListSnapshotConsistencyGroupsOptionsSortCreatedAtConst = "created_at" - ListSnapshotConsistencyGroupsOptionsSortNameConst = "name" -) - -// NewListSnapshotConsistencyGroupsOptions : Instantiate ListSnapshotConsistencyGroupsOptions -func (*VpcV1) NewListSnapshotConsistencyGroupsOptions() *ListSnapshotConsistencyGroupsOptions { - return &ListSnapshotConsistencyGroupsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListSnapshotConsistencyGroupsOptions) SetStart(start string) *ListSnapshotConsistencyGroupsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListSnapshotConsistencyGroupsOptions) SetLimit(limit int64) *ListSnapshotConsistencyGroupsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListSnapshotConsistencyGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListSnapshotConsistencyGroupsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListSnapshotConsistencyGroupsOptions) SetName(name string) *ListSnapshotConsistencyGroupsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListSnapshotConsistencyGroupsOptions) SetSort(sort string) *ListSnapshotConsistencyGroupsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID -func (_options *ListSnapshotConsistencyGroupsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListSnapshotConsistencyGroupsOptions { - _options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSnapshotConsistencyGroupsOptions) SetHeaders(param map[string]string) *ListSnapshotConsistencyGroupsOptions { - options.Headers = param - return options -} - -// ListSnapshotsOptions : The ListSnapshots options. -type ListSnapshotsOptions 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 an item in the `tags` property matching the exact specified tag. - Tag *string `json:"tag,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"` - - // Filters the collection to resources with a `source_volume.id` property matching the specified identifier. - SourceVolumeID *string `json:"source_volume.id,omitempty"` - - // Filters the collection to resources with a `source_volume.crn` property matching the specified CRN. - SourceVolumeCRN *string `json:"source_volume.crn,omitempty"` - - // Filters the collection to resources with a `source_image.id` property matching the specified identifier. - // - // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no - // source image or any existent source image, respectively. - SourceImageID *string `json:"source_image.id,omitempty"` - - // Filters the collection to resources with a `source_image.crn` property matching the specified CRN. - // - // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no - // source image or any existent source image, respectively. - SourceImageCRN *string `json:"source_image.crn,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 backup policy jobs with a `backup_policy_plan.id` property matching the specified - // identifier. - BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` - - // Filters the collection to snapshots with an item in the `copies` property with an `id` property matching the - // specified identifier. - CopiesID *string `json:"copies[].id,omitempty"` - - // Filters the collection to snapshots with an item in the `copies` property with a `name` property matching the exact - // specified name. - CopiesName *string `json:"copies[].name,omitempty"` - - // Filters the collection to snapshots with an item in the `copies` property with an `id` property matching the - // specified CRN. - CopiesCRN *string `json:"copies[].crn,omitempty"` - - // Filters the collection to snapshots with an item in the `copies` property with a - // `remote.region.name` property matching the exact specified name. - CopiesRemoteRegionName *string `json:"copies[].remote.region.name,omitempty"` - - // Filters the collection to resources with a `source_snapshot.id` property matching the specified identifier. - SourceSnapshotID *string `json:"source_snapshot.id,omitempty"` - - // Filters the collection to resources with a `source_snapshot.remote.region.name` property matching the exact - // specified name. - SourceSnapshotRemoteRegionName *string `json:"source_snapshot.remote.region.name,omitempty"` - - // Filters the collection to resources with a `source_volume.remote.region.name` property matching the exact specified - // name. - SourceVolumeRemoteRegionName *string `json:"source_volume.remote.region.name,omitempty"` - - // Filters the collection to resources with a `source_image.remote.region.name` property matching the exact specified - // name. - SourceImageRemoteRegionName *string `json:"source_image.remote.region.name,omitempty"` - - // Filters the collection to snapshots with an item in the `clones` property with a `zone.name` property matching the - // exact specified name. - ClonesZoneName *string `json:"clones[].zone.name,omitempty"` - - // Filters the collection to resources with a `snapshot_consistency_group.id` property matching the specified - // identifier. - SnapshotConsistencyGroupID *string `json:"snapshot_consistency_group.id,omitempty"` - - // Filters the collection to resources with a `snapshot_consistency_group.crn` property matching the specified - // identifier. - SnapshotConsistencyGroupCRN *string `json:"snapshot_consistency_group.crn,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListSnapshotsOptions.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 ( - ListSnapshotsOptionsSortCreatedAtConst = "created_at" - ListSnapshotsOptionsSortNameConst = "name" -) - -// NewListSnapshotsOptions : Instantiate ListSnapshotsOptions -func (*VpcV1) NewListSnapshotsOptions() *ListSnapshotsOptions { - return &ListSnapshotsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListSnapshotsOptions) SetStart(start string) *ListSnapshotsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListSnapshotsOptions) SetLimit(limit int64) *ListSnapshotsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetTag : Allow user to set Tag -func (_options *ListSnapshotsOptions) SetTag(tag string) *ListSnapshotsOptions { - _options.Tag = core.StringPtr(tag) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListSnapshotsOptions) SetResourceGroupID(resourceGroupID string) *ListSnapshotsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListSnapshotsOptions) SetName(name string) *ListSnapshotsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetSourceVolumeID : Allow user to set SourceVolumeID -func (_options *ListSnapshotsOptions) SetSourceVolumeID(sourceVolumeID string) *ListSnapshotsOptions { - _options.SourceVolumeID = core.StringPtr(sourceVolumeID) - return _options -} - -// SetSourceVolumeCRN : Allow user to set SourceVolumeCRN -func (_options *ListSnapshotsOptions) SetSourceVolumeCRN(sourceVolumeCRN string) *ListSnapshotsOptions { - _options.SourceVolumeCRN = core.StringPtr(sourceVolumeCRN) - return _options -} - -// SetSourceImageID : Allow user to set SourceImageID -func (_options *ListSnapshotsOptions) SetSourceImageID(sourceImageID string) *ListSnapshotsOptions { - _options.SourceImageID = core.StringPtr(sourceImageID) - return _options -} - -// SetSourceImageCRN : Allow user to set SourceImageCRN -func (_options *ListSnapshotsOptions) SetSourceImageCRN(sourceImageCRN string) *ListSnapshotsOptions { - _options.SourceImageCRN = core.StringPtr(sourceImageCRN) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListSnapshotsOptions) SetSort(sort string) *ListSnapshotsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID -func (_options *ListSnapshotsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListSnapshotsOptions { - _options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID) - return _options -} - -// SetCopiesID : Allow user to set CopiesID -func (_options *ListSnapshotsOptions) SetCopiesID(copiesID string) *ListSnapshotsOptions { - _options.CopiesID = core.StringPtr(copiesID) - return _options -} - -// SetCopiesName : Allow user to set CopiesName -func (_options *ListSnapshotsOptions) SetCopiesName(copiesName string) *ListSnapshotsOptions { - _options.CopiesName = core.StringPtr(copiesName) - return _options -} - -// SetCopiesCRN : Allow user to set CopiesCRN -func (_options *ListSnapshotsOptions) SetCopiesCRN(copiesCRN string) *ListSnapshotsOptions { - _options.CopiesCRN = core.StringPtr(copiesCRN) - return _options -} - -// SetCopiesRemoteRegionName : Allow user to set CopiesRemoteRegionName -func (_options *ListSnapshotsOptions) SetCopiesRemoteRegionName(copiesRemoteRegionName string) *ListSnapshotsOptions { - _options.CopiesRemoteRegionName = core.StringPtr(copiesRemoteRegionName) - return _options -} - -// SetSourceSnapshotID : Allow user to set SourceSnapshotID -func (_options *ListSnapshotsOptions) SetSourceSnapshotID(sourceSnapshotID string) *ListSnapshotsOptions { - _options.SourceSnapshotID = core.StringPtr(sourceSnapshotID) - return _options -} - -// SetSourceSnapshotRemoteRegionName : Allow user to set SourceSnapshotRemoteRegionName -func (_options *ListSnapshotsOptions) SetSourceSnapshotRemoteRegionName(sourceSnapshotRemoteRegionName string) *ListSnapshotsOptions { - _options.SourceSnapshotRemoteRegionName = core.StringPtr(sourceSnapshotRemoteRegionName) - return _options -} - -// SetSourceVolumeRemoteRegionName : Allow user to set SourceVolumeRemoteRegionName -func (_options *ListSnapshotsOptions) SetSourceVolumeRemoteRegionName(sourceVolumeRemoteRegionName string) *ListSnapshotsOptions { - _options.SourceVolumeRemoteRegionName = core.StringPtr(sourceVolumeRemoteRegionName) - return _options -} - -// SetSourceImageRemoteRegionName : Allow user to set SourceImageRemoteRegionName -func (_options *ListSnapshotsOptions) SetSourceImageRemoteRegionName(sourceImageRemoteRegionName string) *ListSnapshotsOptions { - _options.SourceImageRemoteRegionName = core.StringPtr(sourceImageRemoteRegionName) - return _options -} - -// SetClonesZoneName : Allow user to set ClonesZoneName -func (_options *ListSnapshotsOptions) SetClonesZoneName(clonesZoneName string) *ListSnapshotsOptions { - _options.ClonesZoneName = core.StringPtr(clonesZoneName) - return _options -} - -// SetSnapshotConsistencyGroupID : Allow user to set SnapshotConsistencyGroupID -func (_options *ListSnapshotsOptions) SetSnapshotConsistencyGroupID(snapshotConsistencyGroupID string) *ListSnapshotsOptions { - _options.SnapshotConsistencyGroupID = core.StringPtr(snapshotConsistencyGroupID) - return _options -} - -// SetSnapshotConsistencyGroupCRN : Allow user to set SnapshotConsistencyGroupCRN -func (_options *ListSnapshotsOptions) SetSnapshotConsistencyGroupCRN(snapshotConsistencyGroupCRN string) *ListSnapshotsOptions { - _options.SnapshotConsistencyGroupCRN = core.StringPtr(snapshotConsistencyGroupCRN) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSnapshotsOptions) SetHeaders(param map[string]string) *ListSnapshotsOptions { - options.Headers = param - return options -} - -// ListSubnetReservedIpsOptions : The ListSubnetReservedIps options. -type ListSubnetReservedIpsOptions struct { - // The subnet identifier. - SubnetID *string `json:"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"` - - // 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 resources with a `target.id` property matching the specified identifier. - TargetID *string `json:"target.id,omitempty"` - - // Filters the collection to resources with a `target.crn` property matching the specified CRN. - TargetCRN *string `json:"target.crn,omitempty"` - - // Filters the collection to resources with a `target.name` property matching the exact specified name. - TargetName *string `json:"target.name,omitempty"` - - // 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 - Headers map[string]string -} - -// Constants associated with the ListSubnetReservedIpsOptions.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 ( - ListSubnetReservedIpsOptionsSortAddressConst = "address" - ListSubnetReservedIpsOptionsSortCreatedAtConst = "created_at" - ListSubnetReservedIpsOptionsSortNameConst = "name" -) - -// NewListSubnetReservedIpsOptions : Instantiate ListSubnetReservedIpsOptions -func (*VpcV1) NewListSubnetReservedIpsOptions(subnetID string) *ListSubnetReservedIpsOptions { - return &ListSubnetReservedIpsOptions{ - SubnetID: core.StringPtr(subnetID), - } -} - -// SetSubnetID : Allow user to set SubnetID -func (_options *ListSubnetReservedIpsOptions) SetSubnetID(subnetID string) *ListSubnetReservedIpsOptions { - _options.SubnetID = core.StringPtr(subnetID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListSubnetReservedIpsOptions) SetStart(start string) *ListSubnetReservedIpsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListSubnetReservedIpsOptions) SetLimit(limit int64) *ListSubnetReservedIpsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListSubnetReservedIpsOptions) SetSort(sort string) *ListSubnetReservedIpsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetTargetID : Allow user to set TargetID -func (_options *ListSubnetReservedIpsOptions) SetTargetID(targetID string) *ListSubnetReservedIpsOptions { - _options.TargetID = core.StringPtr(targetID) - return _options -} - -// SetTargetCRN : Allow user to set TargetCRN -func (_options *ListSubnetReservedIpsOptions) SetTargetCRN(targetCRN string) *ListSubnetReservedIpsOptions { - _options.TargetCRN = core.StringPtr(targetCRN) - return _options -} - -// SetTargetName : Allow user to set TargetName -func (_options *ListSubnetReservedIpsOptions) SetTargetName(targetName string) *ListSubnetReservedIpsOptions { - _options.TargetName = core.StringPtr(targetName) - return _options -} - -// SetTargetResourceType : Allow user to set TargetResourceType -func (_options *ListSubnetReservedIpsOptions) SetTargetResourceType(targetResourceType string) *ListSubnetReservedIpsOptions { - _options.TargetResourceType = core.StringPtr(targetResourceType) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSubnetReservedIpsOptions) SetHeaders(param map[string]string) *ListSubnetReservedIpsOptions { - options.Headers = param - return options -} - -// ListSubnetsOptions : The ListSubnets options. -type ListSubnetsOptions 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 `zone.name` property matching the exact specified name. - ZoneName *string `json:"zone.name,omitempty"` - - // Filters the collection to resources with a `vpc.id` property matching the specified identifier. - VPCID *string `json:"vpc.id,omitempty"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // Filters the collection to resources with a `vpc.name` property matching the exact specified name. - VPCName *string `json:"vpc.name,omitempty"` - - // Filters the collection to subnets with a `routing_table.id` property matching the specified identifier. - RoutingTableID *string `json:"routing_table.id,omitempty"` - - // 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 - Headers map[string]string -} - -// NewListSubnetsOptions : Instantiate ListSubnetsOptions -func (*VpcV1) NewListSubnetsOptions() *ListSubnetsOptions { - return &ListSubnetsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListSubnetsOptions) SetStart(start string) *ListSubnetsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListSubnetsOptions) SetLimit(limit int64) *ListSubnetsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListSubnetsOptions) SetResourceGroupID(resourceGroupID string) *ListSubnetsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *ListSubnetsOptions) SetZoneName(zoneName string) *ListSubnetsOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListSubnetsOptions) SetVPCID(vpcID string) *ListSubnetsOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListSubnetsOptions) SetVPCCRN(vpcCRN string) *ListSubnetsOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListSubnetsOptions) SetVPCName(vpcName string) *ListSubnetsOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - -// SetRoutingTableID : Allow user to set RoutingTableID -func (_options *ListSubnetsOptions) SetRoutingTableID(routingTableID string) *ListSubnetsOptions { - _options.RoutingTableID = core.StringPtr(routingTableID) - return _options -} - -// SetRoutingTableName : Allow user to set RoutingTableName -func (_options *ListSubnetsOptions) SetRoutingTableName(routingTableName string) *ListSubnetsOptions { - _options.RoutingTableName = core.StringPtr(routingTableName) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListSubnetsOptions) SetHeaders(param map[string]string) *ListSubnetsOptions { - options.Headers = param - return options -} - -// ListVirtualNetworkInterfaceIpsOptions : The ListVirtualNetworkInterfaceIps options. -type ListVirtualNetworkInterfaceIpsOptions struct { - // The virtual network interface identifier. - VirtualNetworkInterfaceID *string `json:"virtual_network_interface_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"` - - // 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 - // `-name` sorts the collection by the `name` 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 ListVirtualNetworkInterfaceIpsOptions.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 -// `-name` sorts the collection by the `name` property in descending order, and the value `name` sorts it by the `name` -// property in ascending order. -const ( - ListVirtualNetworkInterfaceIpsOptionsSortAddressConst = "address" - ListVirtualNetworkInterfaceIpsOptionsSortNameConst = "name" -) - -// NewListVirtualNetworkInterfaceIpsOptions : Instantiate ListVirtualNetworkInterfaceIpsOptions -func (*VpcV1) NewListVirtualNetworkInterfaceIpsOptions(virtualNetworkInterfaceID string) *ListVirtualNetworkInterfaceIpsOptions { - return &ListVirtualNetworkInterfaceIpsOptions{ - VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), - } -} - -// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID -func (_options *ListVirtualNetworkInterfaceIpsOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *ListVirtualNetworkInterfaceIpsOptions { - _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListVirtualNetworkInterfaceIpsOptions) SetStart(start string) *ListVirtualNetworkInterfaceIpsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVirtualNetworkInterfaceIpsOptions) SetLimit(limit int64) *ListVirtualNetworkInterfaceIpsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListVirtualNetworkInterfaceIpsOptions) SetSort(sort string) *ListVirtualNetworkInterfaceIpsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVirtualNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListVirtualNetworkInterfaceIpsOptions { - options.Headers = param - return options -} - -// ListVirtualNetworkInterfacesOptions : The ListVirtualNetworkInterfaces options. -type ListVirtualNetworkInterfacesOptions 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"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListVirtualNetworkInterfacesOptions : Instantiate ListVirtualNetworkInterfacesOptions -func (*VpcV1) NewListVirtualNetworkInterfacesOptions() *ListVirtualNetworkInterfacesOptions { - return &ListVirtualNetworkInterfacesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListVirtualNetworkInterfacesOptions) SetStart(start string) *ListVirtualNetworkInterfacesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVirtualNetworkInterfacesOptions) SetLimit(limit int64) *ListVirtualNetworkInterfacesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListVirtualNetworkInterfacesOptions) SetResourceGroupID(resourceGroupID string) *ListVirtualNetworkInterfacesOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVirtualNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListVirtualNetworkInterfacesOptions { - options.Headers = param - return options -} - -// ListVolumeProfilesOptions : The ListVolumeProfiles options. -type ListVolumeProfilesOptions 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 -} - -// NewListVolumeProfilesOptions : Instantiate ListVolumeProfilesOptions -func (*VpcV1) NewListVolumeProfilesOptions() *ListVolumeProfilesOptions { - return &ListVolumeProfilesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListVolumeProfilesOptions) SetStart(start string) *ListVolumeProfilesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVolumeProfilesOptions) SetLimit(limit int64) *ListVolumeProfilesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVolumeProfilesOptions) SetHeaders(param map[string]string) *ListVolumeProfilesOptions { - options.Headers = param - return options -} - -// ListVolumesOptions : The ListVolumes options. -type ListVolumesOptions 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 `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // Filters the collection to volumes with an `attachment_state` property matching the specified value. - AttachmentState *string `json:"attachment_state,omitempty"` - - // Filters the collection to resources with an `encryption` property matching the specified value. - Encryption *string `json:"encryption,omitempty"` - - // Filters the collection to resources with an `operating_system.family` property matching the specified operating - // system family. - // - // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no - // operating system or any operating system, respectively. - OperatingSystemFamily *string `json:"operating_system.family,omitempty"` - - // Filters the collection to resources with an `operating_system.architecture` property matching the specified - // operating system architecture. - // - // This parameter also supports the values `null` and `not:null` which filter the collection to resources which have no - // operating system or any operating system, respectively. - OperatingSystemArchitecture *string `json:"operating_system.architecture,omitempty"` - - // Filters the collection to resources with a `zone.name` property matching the exact specified name. - ZoneName *string `json:"zone.name,omitempty"` - - // 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 - Headers map[string]string -} - -// Constants associated with the ListVolumesOptions.AttachmentState property. -// Filters the collection to volumes with an `attachment_state` property matching the specified value. -const ( - ListVolumesOptionsAttachmentStateAttachedConst = "attached" - ListVolumesOptionsAttachmentStateUnattachedConst = "unattached" - ListVolumesOptionsAttachmentStateUnusableConst = "unusable" -) - -// Constants associated with the ListVolumesOptions.Encryption property. -// Filters the collection to resources with an `encryption` property matching the specified value. -const ( - ListVolumesOptionsEncryptionProviderManagedConst = "provider_managed" - ListVolumesOptionsEncryptionUserManagedConst = "user_managed" -) - -// NewListVolumesOptions : Instantiate ListVolumesOptions -func (*VpcV1) NewListVolumesOptions() *ListVolumesOptions { - return &ListVolumesOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListVolumesOptions) SetStart(start string) *ListVolumesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVolumesOptions) SetLimit(limit int64) *ListVolumesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListVolumesOptions) SetName(name string) *ListVolumesOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetAttachmentState : Allow user to set AttachmentState -func (_options *ListVolumesOptions) SetAttachmentState(attachmentState string) *ListVolumesOptions { - _options.AttachmentState = core.StringPtr(attachmentState) - return _options -} - -// SetEncryption : Allow user to set Encryption -func (_options *ListVolumesOptions) SetEncryption(encryption string) *ListVolumesOptions { - _options.Encryption = core.StringPtr(encryption) - return _options -} - -// SetOperatingSystemFamily : Allow user to set OperatingSystemFamily -func (_options *ListVolumesOptions) SetOperatingSystemFamily(operatingSystemFamily string) *ListVolumesOptions { - _options.OperatingSystemFamily = core.StringPtr(operatingSystemFamily) - return _options -} - -// SetOperatingSystemArchitecture : Allow user to set OperatingSystemArchitecture -func (_options *ListVolumesOptions) SetOperatingSystemArchitecture(operatingSystemArchitecture string) *ListVolumesOptions { - _options.OperatingSystemArchitecture = core.StringPtr(operatingSystemArchitecture) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *ListVolumesOptions) SetZoneName(zoneName string) *ListVolumesOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetTag : Allow user to set Tag -func (_options *ListVolumesOptions) SetTag(tag string) *ListVolumesOptions { - _options.Tag = core.StringPtr(tag) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVolumesOptions) SetHeaders(param map[string]string) *ListVolumesOptions { - options.Headers = param - return options -} - -// ListVPCAddressPrefixesOptions : The ListVPCAddressPrefixes options. -type ListVPCAddressPrefixesOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_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 -} - -// NewListVPCAddressPrefixesOptions : Instantiate ListVPCAddressPrefixesOptions -func (*VpcV1) NewListVPCAddressPrefixesOptions(vpcID string) *ListVPCAddressPrefixesOptions { - return &ListVPCAddressPrefixesOptions{ - VPCID: core.StringPtr(vpcID), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListVPCAddressPrefixesOptions) SetVPCID(vpcID string) *ListVPCAddressPrefixesOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListVPCAddressPrefixesOptions) SetStart(start string) *ListVPCAddressPrefixesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVPCAddressPrefixesOptions) SetLimit(limit int64) *ListVPCAddressPrefixesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPCAddressPrefixesOptions) SetHeaders(param map[string]string) *ListVPCAddressPrefixesOptions { - options.Headers = param - return options -} - -// ListVPCDnsResolutionBindingsOptions : The ListVPCDnsResolutionBindings options. -type ListVPCDnsResolutionBindingsOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // 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"` - - // 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"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // Filters the collection to resources with a `vpc.name` property matching the exact specified name. - VPCName *string `json:"vpc.name,omitempty"` - - // Filters the collection to resources with a `vpc.remote.account.id` property matching the specified account - // identifier. - AccountID *string `json:"account.id,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListVPCDnsResolutionBindingsOptions.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 ( - ListVPCDnsResolutionBindingsOptionsSortCreatedAtConst = "created_at" - ListVPCDnsResolutionBindingsOptionsSortNameConst = "name" -) - -// NewListVPCDnsResolutionBindingsOptions : Instantiate ListVPCDnsResolutionBindingsOptions -func (*VpcV1) NewListVPCDnsResolutionBindingsOptions(vpcID string) *ListVPCDnsResolutionBindingsOptions { - return &ListVPCDnsResolutionBindingsOptions{ - VPCID: core.StringPtr(vpcID), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCID(vpcID string) *ListVPCDnsResolutionBindingsOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListVPCDnsResolutionBindingsOptions) SetSort(sort string) *ListVPCDnsResolutionBindingsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListVPCDnsResolutionBindingsOptions) SetStart(start string) *ListVPCDnsResolutionBindingsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVPCDnsResolutionBindingsOptions) SetLimit(limit int64) *ListVPCDnsResolutionBindingsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListVPCDnsResolutionBindingsOptions) SetName(name string) *ListVPCDnsResolutionBindingsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCCRN(vpcCRN string) *ListVPCDnsResolutionBindingsOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListVPCDnsResolutionBindingsOptions) SetVPCName(vpcName string) *ListVPCDnsResolutionBindingsOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - -// SetAccountID : Allow user to set AccountID -func (_options *ListVPCDnsResolutionBindingsOptions) SetAccountID(accountID string) *ListVPCDnsResolutionBindingsOptions { - _options.AccountID = core.StringPtr(accountID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPCDnsResolutionBindingsOptions) SetHeaders(param map[string]string) *ListVPCDnsResolutionBindingsOptions { - options.Headers = param - return options -} - -// ListVPCRoutesOptions : The ListVPCRoutes options. -type ListVPCRoutesOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // Filters the collection to resources with a `zone.name` property matching the exact specified name. - ZoneName *string `json:"zone.name,omitempty"` - - // 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 -} - -// NewListVPCRoutesOptions : Instantiate ListVPCRoutesOptions -func (*VpcV1) NewListVPCRoutesOptions(vpcID string) *ListVPCRoutesOptions { - return &ListVPCRoutesOptions{ - VPCID: core.StringPtr(vpcID), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListVPCRoutesOptions) SetVPCID(vpcID string) *ListVPCRoutesOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetZoneName : Allow user to set ZoneName -func (_options *ListVPCRoutesOptions) SetZoneName(zoneName string) *ListVPCRoutesOptions { - _options.ZoneName = core.StringPtr(zoneName) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListVPCRoutesOptions) SetStart(start string) *ListVPCRoutesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVPCRoutesOptions) SetLimit(limit int64) *ListVPCRoutesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPCRoutesOptions) SetHeaders(param map[string]string) *ListVPCRoutesOptions { - options.Headers = param - return options -} - -// ListVPCRoutingTableRoutesOptions : The ListVPCRoutingTableRoutes options. -type ListVPCRoutingTableRoutesOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The routing table identifier. - RoutingTableID *string `json:"routing_table_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 -} - -// NewListVPCRoutingTableRoutesOptions : Instantiate ListVPCRoutingTableRoutesOptions -func (*VpcV1) NewListVPCRoutingTableRoutesOptions(vpcID string, routingTableID string) *ListVPCRoutingTableRoutesOptions { - return &ListVPCRoutingTableRoutesOptions{ - VPCID: core.StringPtr(vpcID), - RoutingTableID: core.StringPtr(routingTableID), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListVPCRoutingTableRoutesOptions) SetVPCID(vpcID string) *ListVPCRoutingTableRoutesOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetRoutingTableID : Allow user to set RoutingTableID -func (_options *ListVPCRoutingTableRoutesOptions) SetRoutingTableID(routingTableID string) *ListVPCRoutingTableRoutesOptions { - _options.RoutingTableID = core.StringPtr(routingTableID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListVPCRoutingTableRoutesOptions) SetStart(start string) *ListVPCRoutingTableRoutesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVPCRoutingTableRoutesOptions) SetLimit(limit int64) *ListVPCRoutingTableRoutesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPCRoutingTableRoutesOptions) SetHeaders(param map[string]string) *ListVPCRoutingTableRoutesOptions { - options.Headers = param - return options -} - -// ListVPCRoutingTablesOptions : The ListVPCRoutingTables options. -type ListVPCRoutingTablesOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_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 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 - Headers map[string]string -} - -// NewListVPCRoutingTablesOptions : Instantiate ListVPCRoutingTablesOptions -func (*VpcV1) NewListVPCRoutingTablesOptions(vpcID string) *ListVPCRoutingTablesOptions { - return &ListVPCRoutingTablesOptions{ - VPCID: core.StringPtr(vpcID), - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *ListVPCRoutingTablesOptions) SetVPCID(vpcID string) *ListVPCRoutingTablesOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListVPCRoutingTablesOptions) SetStart(start string) *ListVPCRoutingTablesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVPCRoutingTablesOptions) SetLimit(limit int64) *ListVPCRoutingTablesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetIsDefault : Allow user to set IsDefault -func (_options *ListVPCRoutingTablesOptions) SetIsDefault(isDefault bool) *ListVPCRoutingTablesOptions { - _options.IsDefault = core.BoolPtr(isDefault) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPCRoutingTablesOptions) SetHeaders(param map[string]string) *ListVPCRoutingTablesOptions { - options.Headers = param - return options -} - -// ListVpcsOptions : The ListVpcs options. -type ListVpcsOptions 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 VPCs with a `classic_access` property matching the specified value. - ClassicAccess *bool `json:"classic_access,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListVpcsOptions : Instantiate ListVpcsOptions -func (*VpcV1) NewListVpcsOptions() *ListVpcsOptions { - return &ListVpcsOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListVpcsOptions) SetStart(start string) *ListVpcsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVpcsOptions) SetLimit(limit int64) *ListVpcsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListVpcsOptions) SetResourceGroupID(resourceGroupID string) *ListVpcsOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetClassicAccess : Allow user to set ClassicAccess -func (_options *ListVpcsOptions) SetClassicAccess(classicAccess bool) *ListVpcsOptions { - _options.ClassicAccess = core.BoolPtr(classicAccess) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVpcsOptions) SetHeaders(param map[string]string) *ListVpcsOptions { - options.Headers = param - return options -} - -// ListVPNGatewayConnectionsLocalCIDRsOptions : The ListVPNGatewayConnectionsLocalCIDRs options. -type ListVPNGatewayConnectionsLocalCIDRsOptions 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="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListVPNGatewayConnectionsLocalCIDRsOptions : Instantiate ListVPNGatewayConnectionsLocalCIDRsOptions -func (*VpcV1) NewListVPNGatewayConnectionsLocalCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionsLocalCIDRsOptions { - return &ListVPNGatewayConnectionsLocalCIDRsOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *ListVPNGatewayConnectionsLocalCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsLocalCIDRsOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *ListVPNGatewayConnectionsLocalCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionsLocalCIDRsOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNGatewayConnectionsLocalCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsLocalCIDRsOptions { - options.Headers = param - return options -} - -// ListVPNGatewayConnectionsOptions : The ListVPNGatewayConnections options. -type ListVPNGatewayConnectionsOptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // 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 - Headers map[string]string -} - -// Constants associated with the ListVPNGatewayConnectionsOptions.Status property. -// Filters the collection to VPN gateway connections with a `status` property matching the specified value. -const ( - ListVPNGatewayConnectionsOptionsStatusDownConst = "down" - ListVPNGatewayConnectionsOptionsStatusUpConst = "up" -) - -// NewListVPNGatewayConnectionsOptions : Instantiate ListVPNGatewayConnectionsOptions -func (*VpcV1) NewListVPNGatewayConnectionsOptions(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { - return &ListVPNGatewayConnectionsOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *ListVPNGatewayConnectionsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetStatus : Allow user to set Status -func (_options *ListVPNGatewayConnectionsOptions) SetStatus(status string) *ListVPNGatewayConnectionsOptions { - _options.Status = core.StringPtr(status) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNGatewayConnectionsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsOptions { - options.Headers = param - return options -} - -// ListVPNGatewayConnectionsPeerCIDRsOptions : The ListVPNGatewayConnectionsPeerCIDRs options. -type ListVPNGatewayConnectionsPeerCIDRsOptions 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="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListVPNGatewayConnectionsPeerCIDRsOptions : Instantiate ListVPNGatewayConnectionsPeerCIDRsOptions -func (*VpcV1) NewListVPNGatewayConnectionsPeerCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionsPeerCIDRsOptions { - return &ListVPNGatewayConnectionsPeerCIDRsOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *ListVPNGatewayConnectionsPeerCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsPeerCIDRsOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *ListVPNGatewayConnectionsPeerCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionsPeerCIDRsOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNGatewayConnectionsPeerCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsPeerCIDRsOptions { - options.Headers = param - return options -} - -// ListVPNGatewaysOptions : The ListVPNGateways options. -type ListVPNGatewaysOptions 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"` - - // 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 VPN gateways with a `mode` property matching the specified value. - Mode *string `json:"mode,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListVPNGatewaysOptions.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 ( - ListVPNGatewaysOptionsSortCreatedAtConst = "created_at" - ListVPNGatewaysOptionsSortNameConst = "name" -) - -// Constants associated with the ListVPNGatewaysOptions.Mode property. -// Filters the collection to VPN gateways with a `mode` property matching the specified value. -const ( - ListVPNGatewaysOptionsModePolicyConst = "policy" - ListVPNGatewaysOptionsModeRouteConst = "route" -) - -// NewListVPNGatewaysOptions : Instantiate ListVPNGatewaysOptions -func (*VpcV1) NewListVPNGatewaysOptions() *ListVPNGatewaysOptions { - return &ListVPNGatewaysOptions{} -} - -// SetStart : Allow user to set Start -func (_options *ListVPNGatewaysOptions) SetStart(start string) *ListVPNGatewaysOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVPNGatewaysOptions) SetLimit(limit int64) *ListVPNGatewaysOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListVPNGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListVPNGatewaysOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListVPNGatewaysOptions) SetSort(sort string) *ListVPNGatewaysOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetMode : Allow user to set Mode -func (_options *ListVPNGatewaysOptions) SetMode(mode string) *ListVPNGatewaysOptions { - _options.Mode = core.StringPtr(mode) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNGatewaysOptions) SetHeaders(param map[string]string) *ListVPNGatewaysOptions { - options.Headers = param - return options -} - -// ListVPNServerClientsOptions : The ListVPNServerClients options. -type ListVPNServerClientsOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_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"` - - // 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. - Sort *string `json:"sort,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the ListVPNServerClientsOptions.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. -const ( - ListVPNServerClientsOptionsSortCreatedAtConst = "created_at" -) - -// NewListVPNServerClientsOptions : Instantiate ListVPNServerClientsOptions -func (*VpcV1) NewListVPNServerClientsOptions(vpnServerID string) *ListVPNServerClientsOptions { - return &ListVPNServerClientsOptions{ - VPNServerID: core.StringPtr(vpnServerID), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *ListVPNServerClientsOptions) SetVPNServerID(vpnServerID string) *ListVPNServerClientsOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListVPNServerClientsOptions) SetStart(start string) *ListVPNServerClientsOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVPNServerClientsOptions) SetLimit(limit int64) *ListVPNServerClientsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListVPNServerClientsOptions) SetSort(sort string) *ListVPNServerClientsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNServerClientsOptions) SetHeaders(param map[string]string) *ListVPNServerClientsOptions { - options.Headers = param - return options -} - -// ListVPNServerRoutesOptions : The ListVPNServerRoutes options. -type ListVPNServerRoutesOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_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"` - - // 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 ListVPNServerRoutesOptions.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 ( - ListVPNServerRoutesOptionsSortCreatedAtConst = "created_at" - ListVPNServerRoutesOptionsSortNameConst = "name" -) - -// NewListVPNServerRoutesOptions : Instantiate ListVPNServerRoutesOptions -func (*VpcV1) NewListVPNServerRoutesOptions(vpnServerID string) *ListVPNServerRoutesOptions { - return &ListVPNServerRoutesOptions{ - VPNServerID: core.StringPtr(vpnServerID), - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *ListVPNServerRoutesOptions) SetVPNServerID(vpnServerID string) *ListVPNServerRoutesOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListVPNServerRoutesOptions) SetStart(start string) *ListVPNServerRoutesOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVPNServerRoutesOptions) SetLimit(limit int64) *ListVPNServerRoutesOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListVPNServerRoutesOptions) SetSort(sort string) *ListVPNServerRoutesOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNServerRoutesOptions) SetHeaders(param map[string]string) *ListVPNServerRoutesOptions { - options.Headers = param - return options -} - -// ListVPNServersOptions : The ListVPNServers options. -type ListVPNServersOptions struct { - // Filters the collection to resources with a `name` property matching the exact specified name. - Name *string `json:"name,omitempty"` - - // 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"` - - // 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 ListVPNServersOptions.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 ( - ListVPNServersOptionsSortCreatedAtConst = "created_at" - ListVPNServersOptionsSortNameConst = "name" -) - -// NewListVPNServersOptions : Instantiate ListVPNServersOptions -func (*VpcV1) NewListVPNServersOptions() *ListVPNServersOptions { - return &ListVPNServersOptions{} -} - -// SetName : Allow user to set Name -func (_options *ListVPNServersOptions) SetName(name string) *ListVPNServersOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetStart : Allow user to set Start -func (_options *ListVPNServersOptions) SetStart(start string) *ListVPNServersOptions { - _options.Start = core.StringPtr(start) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListVPNServersOptions) SetLimit(limit int64) *ListVPNServersOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ListVPNServersOptions) SetResourceGroupID(resourceGroupID string) *ListVPNServersOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListVPNServersOptions) SetSort(sort string) *ListVPNServersOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNServersOptions) SetHeaders(param map[string]string) *ListVPNServersOptions { - options.Headers = param - return options -} - -// LoadBalancer : LoadBalancer struct -type LoadBalancer struct { - // The date and time that this load balancer was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The load balancer's CRN. - CRN *string `json:"crn" validate:"required"` - - // 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 `lb.appdomain.cloud`. - Dns *LoadBalancerDns `json:"dns,omitempty"` - - // Fully qualified domain name assigned to this load balancer. - Hostname *string `json:"hostname" validate:"required"` - - // The load balancer's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer. - ID *string `json:"id" validate:"required"` - - // Indicates whether this load balancer supports instance groups. - InstanceGroupsSupported *bool `json:"instance_groups_supported" validate:"required"` - - // The type of this load balancer, public or private. - IsPublic *bool `json:"is_public" validate:"required"` - - // The listeners of this load balancer. - Listeners []LoadBalancerListenerReference `json:"listeners" validate:"required"` - - // The logging configuration for this load balancer. - Logging *LoadBalancerLogging `json:"logging" validate:"required"` - - // The name for this load balancer. The name is unique across all load balancers in the VPC. - Name *string `json:"name" validate:"required"` - - // The operating status of this load balancer. - OperatingStatus *string `json:"operating_status" validate:"required"` - - // The pools of this load balancer. - Pools []LoadBalancerPoolReference `json:"pools" validate:"required"` - - // The private IP addresses assigned to this load balancer. - PrivateIps []LoadBalancerPrivateIpsItem `json:"private_ips" validate:"required"` - - // The profile for this load balancer. - Profile *LoadBalancerProfileReference `json:"profile" validate:"required"` - - // The provisioning status of this load balancer: - // - `active`: The load balancer is running. - // - `create_pending`: The load balancer is being created. - // - `delete_pending`: The load balancer is being deleted. - // - `maintenance_pending`: The load balancer is unavailable due to an internal - // error (contact IBM support). - // - `migrate_pending`: The load balancer is migrating to the requested configuration. - // Performance may be degraded. - // - `update_pending`: The load balancer is being updated - // to the requested configuration. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - ProvisioningStatus *string `json:"provisioning_status" validate:"required"` - - // The public IP addresses assigned to this load balancer. - // - // Applicable only for public load balancers. - PublicIps []IP `json:"public_ips" validate:"required"` - - // The resource group for this load balancer. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // Indicates whether route mode is enabled for this load balancer. - // - // At present, public load balancers are not supported with route mode enabled. - RouteMode *bool `json:"route_mode" validate:"required"` - - // The security groups targeting this load balancer. - // - // If empty, all inbound and outbound traffic is allowed. - // - // Applicable only for load balancers that support security groups. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // Indicates whether this load balancer supports security groups. - SecurityGroupsSupported *bool `json:"security_groups_supported" validate:"required"` - - // The subnets this load balancer is provisioned in. The load balancer's availability depends on the availability of - // the zones that the subnets reside in. - // - // All subnets will be in the same VPC. - Subnets []SubnetReference `json:"subnets" validate:"required"` - - // Indicates whether this load balancer supports UDP. - UDPSupported *bool `json:"udp_supported" validate:"required"` -} - -// Constants associated with the LoadBalancer.OperatingStatus property. -// The operating status of this load balancer. -const ( - LoadBalancerOperatingStatusOfflineConst = "offline" - LoadBalancerOperatingStatusOnlineConst = "online" -) - -// Constants associated with the LoadBalancer.ProvisioningStatus property. -// The provisioning status of this load balancer: -// - `active`: The load balancer is running. -// - `create_pending`: The load balancer is being created. -// - `delete_pending`: The load balancer is being deleted. -// - `maintenance_pending`: The load balancer is unavailable due to an internal -// error (contact IBM support). -// - `migrate_pending`: The load balancer is migrating to the requested configuration. -// Performance may be degraded. -// - `update_pending`: The load balancer is being updated -// to the requested configuration. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerProvisioningStatusActiveConst = "active" - LoadBalancerProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerProvisioningStatusFailedConst = "failed" - LoadBalancerProvisioningStatusMaintenancePendingConst = "maintenance_pending" - LoadBalancerProvisioningStatusMigratePendingConst = "migrate_pending" - LoadBalancerProvisioningStatusUpdatePendingConst = "update_pending" -) - -// Constants associated with the LoadBalancer.ResourceType property. -// The resource type. -const ( - LoadBalancerResourceTypeLoadBalancerConst = "load_balancer" -) - -// UnmarshalLoadBalancer unmarshals an instance of LoadBalancer from the specified map of raw messages. -func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancer) - 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, "dns", &obj.Dns, UnmarshalLoadBalancerDns) - if err != nil { - err = core.SDKErrorf(err, "", "dns-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) - if err != nil { - err = core.SDKErrorf(err, "", "hostname-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, "instance_groups_supported", &obj.InstanceGroupsSupported) - if err != nil { - err = core.SDKErrorf(err, "", "instance_groups_supported-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "is_public", &obj.IsPublic) - if err != nil { - err = core.SDKErrorf(err, "", "is_public-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListenerReference) - if err != nil { - err = core.SDKErrorf(err, "", "listeners-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLogging) - if err != nil { - err = core.SDKErrorf(err, "", "logging-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, "operating_status", &obj.OperatingStatus) - if err != nil { - err = core.SDKErrorf(err, "", "operating_status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPoolReference) - if err != nil { - err = core.SDKErrorf(err, "", "pools-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalLoadBalancerPrivateIpsItem) - if err != nil { - err = core.SDKErrorf(err, "", "private_ips-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalLoadBalancerProfileReference) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) - if err != nil { - err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "public_ips", &obj.PublicIps, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "public_ips-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.UnmarshalPrimitive(m, "route_mode", &obj.RouteMode) - if err != nil { - err = core.SDKErrorf(err, "", "route_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "security_groups_supported", &obj.SecurityGroupsSupported) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups_supported-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "udp_supported", &obj.UDPSupported) - if err != nil { - err = core.SDKErrorf(err, "", "udp_supported-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerCollection : LoadBalancerCollection struct -type LoadBalancerCollection struct { - // A link to the first page of resources. - First *LoadBalancerCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // Collection of load balancers. - LoadBalancers []LoadBalancer `json:"load_balancers" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *LoadBalancerCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, "load_balancers", &obj.LoadBalancers, UnmarshalLoadBalancer) - if err != nil { - err = core.SDKErrorf(err, "", "load_balancers-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerCollectionNext) - 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 *LoadBalancerCollection) 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 -} - -// 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 -// `lb.appdomain.cloud`. -type LoadBalancerDns struct { - // The DNS instance associated with this load balancer. - Instance *DnsInstanceReference `json:"instance" validate:"required"` - - // The DNS zone associated with this load balancer. - Zone *DnsZoneReference `json:"zone" validate:"required"` -} - -// UnmarshalLoadBalancerDns unmarshals an instance of LoadBalancerDns from the specified map of raw messages. -func UnmarshalLoadBalancerDns(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerDns) - err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceReference) - if err != nil { - err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneReference) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerDnsPatch : The DNS configuration for this load balancer. -// -// Specify `null` to remove the existing DNS configuration, which will remove all DNS `A` records for this load balancer -// that had been added to `zone`, and add equivalent `A` records to the public DNS zone `lb.appdomain.cloud`. -type LoadBalancerDnsPatch struct { - // The DNS instance to associate with this load balancer. - // - // The specified instance may be in a different region or account, subject to IAM - // policies. - Instance DnsInstanceIdentityIntf `json:"instance,omitempty"` - - // The DNS zone to associate with this load balancer. - // - // The specified zone may be in a different region or account, subject to IAM policies. - Zone DnsZoneIdentityIntf `json:"zone,omitempty"` -} - -// UnmarshalLoadBalancerDnsPatch unmarshals an instance of LoadBalancerDnsPatch from the specified map of raw messages. -func UnmarshalLoadBalancerDnsPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerDnsPatch) - err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - 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 -// `lb.appdomain.cloud`. Otherwise, those DNS `A` records will be added to the specified `zone`. -type LoadBalancerDnsPrototype struct { - // The DNS instance to associate with this load balancer. - // - // The specified instance may be in a different region or account, subject to IAM - // policies. - Instance DnsInstanceIdentityIntf `json:"instance" validate:"required"` - - // The DNS zone to associate with this load balancer. - // - // The specified zone may be in a different region or account, subject to IAM policies. - Zone DnsZoneIdentityIntf `json:"zone" validate:"required"` -} - -// NewLoadBalancerDnsPrototype : Instantiate LoadBalancerDnsPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerDnsPrototype(instance DnsInstanceIdentityIntf, zone DnsZoneIdentityIntf) (_model *LoadBalancerDnsPrototype, err error) { - _model = &LoadBalancerDnsPrototype{ - Instance: instance, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalLoadBalancerDnsPrototype unmarshals an instance of LoadBalancerDnsPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerDnsPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerDnsPrototype) - err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalDnsZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerIdentity : Identifies a load balancer by a unique property. -// Models which "extend" this model: -// - LoadBalancerIdentityByID -// - LoadBalancerIdentityByCRN -// - LoadBalancerIdentityByHref -type LoadBalancerIdentity struct { - // The unique identifier for this load balancer. - ID *string `json:"id,omitempty"` - - // The load balancer's CRN. - CRN *string `json:"crn,omitempty"` - - // The load balancer's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerIdentity) isaLoadBalancerIdentity() bool { - return true -} - -type LoadBalancerIdentityIntf interface { - isaLoadBalancerIdentity() bool -} - -// UnmarshalLoadBalancerIdentity unmarshals an instance of LoadBalancerIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - 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 - // the `application` family (otherwise always `false`). Additional restrictions: - // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must - // match the `accept_proxy_protocol` value of the `https_redirect` listener. - // - If this listener is the target of another listener's `https_redirect`, its - // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. - AcceptProxyProtocol *bool `json:"accept_proxy_protocol" validate:"required"` - - // The certificate instance used for SSL termination. - // - // 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 date and time that this listener was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The default pool for this listener. If absent, this listener has no default pool. - // - // If `https_redirect` is set, the default pool will not be used. - DefaultPool *LoadBalancerPoolReference `json:"default_pool,omitempty"` - - // The listener's canonical URL. - Href *string `json:"href" validate:"required"` - - // If present, the target listener that requests are redirected to if none of the - // listener's `policies` match. - HTTPSRedirect *LoadBalancerListenerHTTPSRedirect `json:"https_redirect,omitempty"` - - // 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. - IdleConnectionTimeout *int64 `json:"idle_connection_timeout,omitempty"` - - // The policies for this listener. - Policies []LoadBalancerListenerPolicyReference `json:"policies,omitempty"` - - // The listener port number, or the inclusive lower bound of the port range. - Port *int64 `json:"port" validate:"required"` - - // The inclusive upper bound of the range of ports used by this listener. - // - // At present, only load balancers in the `network` family support more than one port per listener. - PortMax *int64 `json:"port_max" validate:"required"` - - // The inclusive lower bound of the range of ports used by this listener. - // - // At present, only load balancers in the `network` family support more than one port per listener. - PortMin *int64 `json:"port_min" validate:"required"` - - // The listener protocol. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Protocol *string `json:"protocol" validate:"required"` - - // The provisioning status of this listener - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - ProvisioningStatus *string `json:"provisioning_status" validate:"required"` -} - -// Constants associated with the LoadBalancerListener.Protocol property. -// The listener protocol. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerListenerProtocolHTTPConst = "http" - LoadBalancerListenerProtocolHTTPSConst = "https" - LoadBalancerListenerProtocolTCPConst = "tcp" - LoadBalancerListenerProtocolUDPConst = "udp" -) - -// Constants associated with the LoadBalancerListener.ProvisioningStatus property. -// The provisioning status of this listener -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerListenerProvisioningStatusActiveConst = "active" - LoadBalancerListenerProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerListenerProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerListenerProvisioningStatusFailedConst = "failed" - LoadBalancerListenerProvisioningStatusUpdatePendingConst = "update_pending" -) - -// UnmarshalLoadBalancerListener unmarshals an instance of LoadBalancerListener from the specified map of raw messages. -func UnmarshalLoadBalancerListener(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListener) - err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "accept_proxy_protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceReference) - if err != nil { - err = core.SDKErrorf(err, "", "certificate_instance-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) - if err != nil { - err = core.SDKErrorf(err, "", "connection_limit-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, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolReference) - if err != nil { - err = core.SDKErrorf(err, "", "default_pool-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.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirect) - if err != nil { - err = core.SDKErrorf(err, "", "https_redirect-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, "idle_connection_timeout", &obj.IdleConnectionTimeout) - if err != nil { - err = core.SDKErrorf(err, "", "idle_connection_timeout-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicyReference) - if err != nil { - err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-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 - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) - if err != nil { - err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerCollection : LoadBalancerListenerCollection struct -type LoadBalancerListenerCollection struct { - // Collection of listeners. - Listeners []LoadBalancerListener `json:"listeners" validate:"required"` -} - -// UnmarshalLoadBalancerListenerCollection unmarshals an instance of LoadBalancerListenerCollection from the specified map of raw messages. -func UnmarshalLoadBalancerListenerCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerCollection) - err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListener) - if err != nil { - err = core.SDKErrorf(err, "", "listeners-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerDefaultPoolPatch : The default pool for this listener. If `https_redirect` is set, the default pool will not be used. The specified pool -// must: -// -// - Belong to this load balancer -// - Have the same `protocol` as this listener, or have a compatible protocol. -// At present, the compatible protocols are `http` and `https`. -// - Not already be the `default_pool` for another listener -// -// Specify `null` to remove an existing default pool. -// Models which "extend" this model: -// - LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID -// - LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref -type LoadBalancerListenerDefaultPoolPatch struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerListenerDefaultPoolPatch) isaLoadBalancerListenerDefaultPoolPatch() bool { - return true -} - -type LoadBalancerListenerDefaultPoolPatchIntf interface { - isaLoadBalancerListenerDefaultPoolPatch() bool -} - -// UnmarshalLoadBalancerListenerDefaultPoolPatch unmarshals an instance of LoadBalancerListenerDefaultPoolPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerDefaultPoolPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerDefaultPoolPatch) - 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 -} - -// LoadBalancerListenerHTTPSRedirect : LoadBalancerListenerHTTPSRedirect struct -type LoadBalancerListenerHTTPSRedirect struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - Listener *LoadBalancerListenerReference `json:"listener" validate:"required"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -// UnmarshalLoadBalancerListenerHTTPSRedirect unmarshals an instance of LoadBalancerListenerHTTPSRedirect from the specified map of raw messages. -func UnmarshalLoadBalancerListenerHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerHTTPSRedirect) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) - if err != nil { - err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerHTTPSRedirectPatch : LoadBalancerListenerHTTPSRedirectPatch struct -type LoadBalancerListenerHTTPSRedirectPatch struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - // Identifies a load balancer listener by a unique property. - Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -// UnmarshalLoadBalancerListenerHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerHTTPSRedirectPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerHTTPSRedirectPatch) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerHTTPSRedirectPrototype : LoadBalancerListenerHTTPSRedirectPrototype struct -type LoadBalancerListenerHTTPSRedirectPrototype struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - // Identifies a load balancer listener by a unique property. - Listener LoadBalancerListenerIdentityIntf `json:"listener" validate:"required"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -// NewLoadBalancerListenerHTTPSRedirectPrototype : Instantiate LoadBalancerListenerHTTPSRedirectPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerHTTPSRedirectPrototype, err error) { - _model = &LoadBalancerListenerHTTPSRedirectPrototype{ - HTTPStatusCode: core.Int64Ptr(httpStatusCode), - Listener: listener, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalLoadBalancerListenerHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerHTTPSRedirectPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerHTTPSRedirectPrototype) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerIdentity : Identifies a load balancer listener by a unique property. -// Models which "extend" this model: -// - LoadBalancerListenerIdentityByID -// - LoadBalancerListenerIdentityByHref -type LoadBalancerListenerIdentity struct { - // The unique identifier for this load balancer listener. - ID *string `json:"id,omitempty"` - - // The listener's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerListenerIdentity) isaLoadBalancerListenerIdentity() bool { - return true -} - -type LoadBalancerListenerIdentityIntf interface { - isaLoadBalancerListenerIdentity() bool -} - -// UnmarshalLoadBalancerListenerIdentity unmarshals an instance of LoadBalancerListenerIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerListenerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerIdentity) - 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 -} - -// LoadBalancerListenerPatch : LoadBalancerListenerPatch struct -type LoadBalancerListenerPatch struct { - // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in - // the `application` family (otherwise always `false`). Additional restrictions: - // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must - // match the `accept_proxy_protocol` value of the `https_redirect` listener. - // - If this listener is the target of another listener's `https_redirect`, its - // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. - AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` - - // The certificate instance to use for SSL termination. The listener must have a - // `protocol` of `https`. - CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` - - // The connection limit of the listener. - ConnectionLimit *int64 `json:"connection_limit,omitempty"` - - // The default pool for this listener. If `https_redirect` is set, the default pool will not - // be used. The specified pool must: - // - // - Belong to this load balancer - // - Have the same `protocol` as this listener, or have a compatible protocol. - // At present, the compatible protocols are `http` and `https`. - // - Not already be the `default_pool` for another listener - // - // Specify `null` to remove an existing default pool. - DefaultPool LoadBalancerListenerDefaultPoolPatchIntf `json:"default_pool,omitempty"` - - // The target listener that requests will be redirected to if none of the listener's - // `policies` match. - // - // If specified, this listener must have a `protocol` of `http`, and the target listener - // must have a `protocol` of `https`. - // - // 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. - 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 - // have a unique `port` and `protocol` combination. - // - // Not supported for load balancers operating with route mode enabled. - Port *int64 `json:"port,omitempty"` - - // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. - // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `65535` must be specified. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. - // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `1` must be specified. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. - PortMin *int64 `json:"port_min,omitempty"` - - // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. - // - // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the - // `application` family support `tcp`, `http` and - // `https`. - // - // Additional restrictions: - // - If `default_pool` is set, the protocol cannot be changed. - // - If `https_redirect` is set, the protocol must be `http`. - // - If another listener's `https_redirect` targets this listener, the protocol must be - // `https`. - Protocol *string `json:"protocol,omitempty"` -} - -// Constants associated with the LoadBalancerListenerPatch.Protocol property. -// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. -// -// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the -// `application` family support `tcp`, `http` and -// `https`. -// -// Additional restrictions: -// - If `default_pool` is set, the protocol cannot be changed. -// - If `https_redirect` is set, the protocol must be `http`. -// - If another listener's `https_redirect` targets this listener, the protocol must be -// `https`. -const ( - LoadBalancerListenerPatchProtocolHTTPConst = "http" - LoadBalancerListenerPatchProtocolHTTPSConst = "https" - LoadBalancerListenerPatchProtocolTCPConst = "tcp" - LoadBalancerListenerPatchProtocolUDPConst = "udp" -) - -// UnmarshalLoadBalancerListenerPatch unmarshals an instance of LoadBalancerListenerPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPatch) - err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "accept_proxy_protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "certificate_instance-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) - if err != nil { - err = core.SDKErrorf(err, "", "connection_limit-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerListenerDefaultPoolPatch) - if err != nil { - err = core.SDKErrorf(err, "", "default_pool-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPatch) - if err != nil { - err = core.SDKErrorf(err, "", "https_redirect-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) - if err != nil { - err = core.SDKErrorf(err, "", "idle_connection_timeout-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-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 - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// LoadBalancerListenerPolicy : LoadBalancerListenerPolicy struct -type LoadBalancerListenerPolicy 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` - // - `redirect`: Requests will be redirected to the specified `target.url` - // - `reject`: Requests will be rejected with a `403` status code - // - // 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"` - - // The date and time that this policy was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The listener policy's canonical URL. - Href *string `json:"href" validate:"required"` - - // The policy's unique identifier. - ID *string `json:"id" validate:"required"` - - // The name for this load balancer listener policy. The name is unique across all policies for the load balancer - // listener. - Name *string `json:"name" validate:"required"` - - // Priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value - // indicates higher priority. - Priority *int64 `json:"priority" validate:"required"` - - // The provisioning status of this policy - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - ProvisioningStatus *string `json:"provisioning_status" validate:"required"` - - // The rules for this policy. - Rules []LoadBalancerListenerPolicyRuleReference `json:"rules" validate:"required"` - - // - If `action` is `forward`, the response is a `LoadBalancerPoolReference` - // - If `action` is `https_redirect`, the response is a - // `LoadBalancerListenerPolicyHTTPSRedirect` - // - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL`. - Target LoadBalancerListenerPolicyTargetIntf `json:"target,omitempty"` -} - -// Constants associated with the LoadBalancerListenerPolicy.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` -// - `redirect`: Requests will be redirected to the specified `target.url` -// - `reject`: Requests will be rejected with a `403` status code -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerListenerPolicyActionForwardConst = "forward" - LoadBalancerListenerPolicyActionHTTPSRedirectConst = "https_redirect" - LoadBalancerListenerPolicyActionRedirectConst = "redirect" - LoadBalancerListenerPolicyActionRejectConst = "reject" -) - -// Constants associated with the LoadBalancerListenerPolicy.ProvisioningStatus property. -// The provisioning status of this policy -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerListenerPolicyProvisioningStatusActiveConst = "active" - LoadBalancerListenerPolicyProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerListenerPolicyProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerListenerPolicyProvisioningStatusFailedConst = "failed" - LoadBalancerListenerPolicyProvisioningStatusUpdatePendingConst = "update_pending" -) - -// UnmarshalLoadBalancerListenerPolicy unmarshals an instance of LoadBalancerListenerPolicy from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicy) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-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, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) - if err != nil { - err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRuleReference) - if err != nil { - err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTarget) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyCollection : LoadBalancerListenerPolicyCollection struct -type LoadBalancerListenerPolicyCollection struct { - // Collection of policies. - Policies []LoadBalancerListenerPolicy `json:"policies" validate:"required"` -} - -// UnmarshalLoadBalancerListenerPolicyCollection unmarshals an instance of LoadBalancerListenerPolicyCollection from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyCollection) - err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyPatch : LoadBalancerListenerPolicyPatch struct -type LoadBalancerListenerPolicyPatch struct { - // The name for this policy. The name must not be used by another policy for the load balancer listener. - Name *string `json:"name,omitempty"` - - // Priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value - // indicates higher priority. - Priority *int64 `json:"priority,omitempty"` - - // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. - // - If `action` is `https_redirect`, specify a - // `LoadBalancerListenerPolicyHTTPSRedirectPatch`. - // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. - Target LoadBalancerListenerPolicyTargetPatchIntf `json:"target,omitempty"` -} - -// UnmarshalLoadBalancerListenerPolicyPatch unmarshals an instance of LoadBalancerListenerPolicyPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPatch) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// LoadBalancerListenerPolicyPrototype : LoadBalancerListenerPolicyPrototype struct -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` - // - `redirect`: Requests will be redirected to the specified `target.url` - // - `reject`: Requests will be rejected with a `403` status code - // - // 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"` - - // The name for this policy. The name must not be used by another policy for the load balancer listener. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // Priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value - // indicates higher priority. - Priority *int64 `json:"priority" validate:"required"` - - // 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`. - 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` -// - `redirect`: Requests will be redirected to the specified `target.url` -// - `reject`: Requests will be rejected with a `403` status code -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerListenerPolicyPrototypeActionForwardConst = "forward" - LoadBalancerListenerPolicyPrototypeActionHTTPSRedirectConst = "https_redirect" - LoadBalancerListenerPolicyPrototypeActionRedirectConst = "redirect" - LoadBalancerListenerPolicyPrototypeActionRejectConst = "reject" -) - -// NewLoadBalancerListenerPolicyPrototype : Instantiate LoadBalancerListenerPolicyPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyPrototype(action string, priority int64) (_model *LoadBalancerListenerPolicyPrototype, err error) { - _model = &LoadBalancerListenerPolicyPrototype{ - Action: core.StringPtr(action), - Priority: core.Int64Ptr(priority), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalLoadBalancerListenerPolicyPrototype unmarshals an instance of LoadBalancerListenerPolicyPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-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, "priority", &obj.Priority) - if err != nil { - err = core.SDKErrorf(err, "", "priority-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRulePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyReference : LoadBalancerListenerPolicyReference struct -type LoadBalancerListenerPolicyReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerListenerPolicyReferenceDeleted `json:"deleted,omitempty"` - - // The listener policy's canonical URL. - Href *string `json:"href" validate:"required"` - - // The policy's unique identifier. - ID *string `json:"id" validate:"required"` - - // The name for this load balancer listener policy. The name is unique across all policies for the load balancer - // listener. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalLoadBalancerListenerPolicyReference unmarshals an instance of LoadBalancerListenerPolicyReference from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerListenerPolicyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerListenerPolicyReferenceDeleted unmarshals an instance of LoadBalancerListenerPolicyReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyReferenceDeleted) - 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 -} - -// LoadBalancerListenerPolicyRule : LoadBalancerListenerPolicyRule struct -type LoadBalancerListenerPolicyRule struct { - // The condition of the rule. - Condition *string `json:"condition" validate:"required"` - - // The date and time that this rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The field. This is applicable to `header`, `query`, and `body` rule types. - // - // If the rule type is `header`, this property is required. - // - // If the rule type is `query`, this is optional. If specified and the rule condition is not - // `matches_regex`, the value must be percent-encoded. - // - // If the rule type is `body`, this is optional. - Field *string `json:"field,omitempty"` - - // The rule's canonical URL. - Href *string `json:"href" validate:"required"` - - // The rule's unique identifier. - ID *string `json:"id" validate:"required"` - - // The provisioning status of this rule - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - ProvisioningStatus *string `json:"provisioning_status" validate:"required"` - - // The type of the rule. - // - // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. - Type *string `json:"type" validate:"required"` - - // Value to be matched for rule condition. - // - // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the LoadBalancerListenerPolicyRule.Condition property. -// The condition of the rule. -const ( - LoadBalancerListenerPolicyRuleConditionContainsConst = "contains" - LoadBalancerListenerPolicyRuleConditionEqualsConst = "equals" - LoadBalancerListenerPolicyRuleConditionMatchesRegexConst = "matches_regex" -) - -// Constants associated with the LoadBalancerListenerPolicyRule.ProvisioningStatus property. -// The provisioning status of this rule -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerListenerPolicyRuleProvisioningStatusActiveConst = "active" - LoadBalancerListenerPolicyRuleProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerListenerPolicyRuleProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerListenerPolicyRuleProvisioningStatusFailedConst = "failed" - LoadBalancerListenerPolicyRuleProvisioningStatusUpdatePendingConst = "update_pending" -) - -// Constants associated with the LoadBalancerListenerPolicyRule.Type property. -// The type of the rule. -// -// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. -const ( - LoadBalancerListenerPolicyRuleTypeBodyConst = "body" - LoadBalancerListenerPolicyRuleTypeHeaderConst = "header" - LoadBalancerListenerPolicyRuleTypeHostnameConst = "hostname" - LoadBalancerListenerPolicyRuleTypePathConst = "path" - LoadBalancerListenerPolicyRuleTypeQueryConst = "query" -) - -// UnmarshalLoadBalancerListenerPolicyRule unmarshals an instance of LoadBalancerListenerPolicyRule from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyRule(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyRule) - err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) - if err != nil { - err = core.SDKErrorf(err, "", "condition-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, "field", &obj.Field) - if err != nil { - err = core.SDKErrorf(err, "", "field-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, "provisioning_status", &obj.ProvisioningStatus) - if err != nil { - err = core.SDKErrorf(err, "", "provisioning_status-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, "value", &obj.Value) - if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyRuleCollection : LoadBalancerListenerPolicyRuleCollection struct -type LoadBalancerListenerPolicyRuleCollection struct { - // Collection of rules. - Rules []LoadBalancerListenerPolicyRule `json:"rules" validate:"required"` -} - -// UnmarshalLoadBalancerListenerPolicyRuleCollection unmarshals an instance of LoadBalancerListenerPolicyRuleCollection from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyRuleCollection) - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRule) - if err != nil { - err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyRulePatch : LoadBalancerListenerPolicyRulePatch struct -type LoadBalancerListenerPolicyRulePatch struct { - // The condition of the rule. - Condition *string `json:"condition,omitempty"` - - // The field. This is applicable to `header`, `query`, and `body` rule types. - // - // If the rule type is `header`, this property is required. - // - // If the rule type is `query`, this is optional. If specified and the rule condition is not - // `matches_regex`, the value must be percent-encoded. - // - // If the rule type is `body`, this is optional. - Field *string `json:"field,omitempty"` - - // The type of the rule. - // - // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. - Type *string `json:"type,omitempty"` - - // Value to be matched for rule condition. - // - // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. - Value *string `json:"value,omitempty"` -} - -// Constants associated with the LoadBalancerListenerPolicyRulePatch.Condition property. -// The condition of the rule. -const ( - LoadBalancerListenerPolicyRulePatchConditionContainsConst = "contains" - LoadBalancerListenerPolicyRulePatchConditionEqualsConst = "equals" - LoadBalancerListenerPolicyRulePatchConditionMatchesRegexConst = "matches_regex" -) - -// Constants associated with the LoadBalancerListenerPolicyRulePatch.Type property. -// The type of the rule. -// -// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. -const ( - LoadBalancerListenerPolicyRulePatchTypeBodyConst = "body" - LoadBalancerListenerPolicyRulePatchTypeHeaderConst = "header" - LoadBalancerListenerPolicyRulePatchTypeHostnameConst = "hostname" - LoadBalancerListenerPolicyRulePatchTypePathConst = "path" - LoadBalancerListenerPolicyRulePatchTypeQueryConst = "query" -) - -// UnmarshalLoadBalancerListenerPolicyRulePatch unmarshals an instance of LoadBalancerListenerPolicyRulePatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyRulePatch) - err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) - if err != nil { - err = core.SDKErrorf(err, "", "condition-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "field", &obj.Field) - if err != nil { - err = core.SDKErrorf(err, "", "field-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, "value", &obj.Value) - if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// LoadBalancerListenerPolicyRulePrototype : LoadBalancerListenerPolicyRulePrototype struct -type LoadBalancerListenerPolicyRulePrototype struct { - // The condition of the rule. - Condition *string `json:"condition" validate:"required"` - - // The field. This is applicable to `header`, `query`, and `body` rule types. - // - // If the rule type is `header`, this property is required. - // - // If the rule type is `query`, this is optional. If specified and the rule condition is not - // `matches_regex`, the value must be percent-encoded. - // - // If the rule type is `body`, this is optional. - Field *string `json:"field,omitempty"` - - // The type of the rule. - // - // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. - Type *string `json:"type" validate:"required"` - - // Value to be matched for rule condition. - // - // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Condition property. -// The condition of the rule. -const ( - LoadBalancerListenerPolicyRulePrototypeConditionContainsConst = "contains" - LoadBalancerListenerPolicyRulePrototypeConditionEqualsConst = "equals" - LoadBalancerListenerPolicyRulePrototypeConditionMatchesRegexConst = "matches_regex" -) - -// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Type property. -// The type of the rule. -// -// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. -const ( - LoadBalancerListenerPolicyRulePrototypeTypeBodyConst = "body" - LoadBalancerListenerPolicyRulePrototypeTypeHeaderConst = "header" - LoadBalancerListenerPolicyRulePrototypeTypeHostnameConst = "hostname" - LoadBalancerListenerPolicyRulePrototypeTypePathConst = "path" - LoadBalancerListenerPolicyRulePrototypeTypeQueryConst = "query" -) - -// NewLoadBalancerListenerPolicyRulePrototype : Instantiate LoadBalancerListenerPolicyRulePrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyRulePrototype(condition string, typeVar string, value string) (_model *LoadBalancerListenerPolicyRulePrototype, err error) { - _model = &LoadBalancerListenerPolicyRulePrototype{ - Condition: core.StringPtr(condition), - Type: core.StringPtr(typeVar), - Value: core.StringPtr(value), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalLoadBalancerListenerPolicyRulePrototype unmarshals an instance of LoadBalancerListenerPolicyRulePrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyRulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyRulePrototype) - err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) - if err != nil { - err = core.SDKErrorf(err, "", "condition-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "field", &obj.Field) - if err != nil { - err = core.SDKErrorf(err, "", "field-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, "value", &obj.Value) - if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyRuleReference : LoadBalancerListenerPolicyRuleReference struct -type LoadBalancerListenerPolicyRuleReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerListenerPolicyRuleReferenceDeleted `json:"deleted,omitempty"` - - // The rule's canonical URL. - Href *string `json:"href" validate:"required"` - - // The rule's unique identifier. - ID *string `json:"id" validate:"required"` -} - -// UnmarshalLoadBalancerListenerPolicyRuleReference unmarshals an instance of LoadBalancerListenerPolicyRuleReference from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyRuleReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerListenerPolicyRuleReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted unmarshals an instance of LoadBalancerListenerPolicyRuleReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyRuleReferenceDeleted) - 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 -} - -// LoadBalancerListenerPolicyTarget : - If `action` is `forward`, the response is a `LoadBalancerPoolReference` -// - If `action` is `https_redirect`, the response is a -// `LoadBalancerListenerPolicyHTTPSRedirect` -// - If `action` is `redirect`, the response is a `LoadBalancerListenerPolicyRedirectURL`. -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetLoadBalancerPoolReference -// - LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect -// - LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL -type LoadBalancerListenerPolicyTarget struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` - - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The name for this load balancer pool. The name is unique across all pools for the load balancer. - Name *string `json:"name,omitempty"` - - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - Listener *LoadBalancerListenerReference `json:"listener,omitempty"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` - - // The redirect target URL. - URL *string `json:"url,omitempty"` -} - -func (*LoadBalancerListenerPolicyTarget) isaLoadBalancerListenerPolicyTarget() bool { - return true -} - -type LoadBalancerListenerPolicyTargetIntf interface { - isaLoadBalancerListenerPolicyTarget() bool -} - -// UnmarshalLoadBalancerListenerPolicyTarget unmarshals an instance of LoadBalancerListenerPolicyTarget from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) - 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, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) - if err != nil { - err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPatch : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. -// - If `action` is `https_redirect`, specify a -// `LoadBalancerListenerPolicyHTTPSRedirectPatch`. -// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch -type LoadBalancerListenerPolicyTargetPatch struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` - - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - // Identifies a load balancer listener by a unique property. - Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` - - // The redirect target URL. - URL *string `json:"url,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -type LoadBalancerListenerPolicyTargetPatchIntf interface { - isaLoadBalancerListenerPolicyTargetPatch() bool -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatch) - 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 - } - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPrototype : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. -// - If `action` is `https_redirect`, specify a -// `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. -// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype -type LoadBalancerListenerPolicyTargetPrototype struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` - - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - // Identifies a load balancer listener by a unique property. - Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` - - // The redirect target URL. - URL *string `json:"url,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -type LoadBalancerListenerPolicyTargetPrototypeIntf interface { - isaLoadBalancerListenerPolicyTargetPrototype() bool -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototype) - 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 - } - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPrototypeLoadBalancerContext : LoadBalancerListenerPrototypeLoadBalancerContext struct -type LoadBalancerListenerPrototypeLoadBalancerContext struct { - // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in - // the `application` family (otherwise always `false`). Additional restrictions: - // - If this listener has `https_redirect` specified, its `accept_proxy_protocol` value must - // match the `accept_proxy_protocol` value of the `https_redirect` listener. - // - If this listener is the target of another listener's `https_redirect`, its - // `accept_proxy_protocol` value must match that listener's `accept_proxy_protocol` value. - AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` - - // The certificate instance to use for SSL termination. The listener must have a - // `protocol` of `https`. - CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` - - // The connection limit of the listener. - ConnectionLimit *int64 `json:"connection_limit,omitempty"` - - // The default pool for this listener. If `https_redirect` is specified, - // the default pool will not be used. If specified, the pool must: - // - // - Belong to this load balancer. - // - Have the same `protocol` as this listener, or have a compatible protocol. - // At present, the compatible protocols are `http` and `https`. - // - Not already be the `default_pool` for another listener. - // - // If unspecified, this listener will be created with no default pool, but one may be - // subsequently set. - DefaultPool *LoadBalancerPoolIdentityByName `json:"default_pool,omitempty"` - - // The target listener that requests will be redirected to if none of the listener's - // `policies` match. - // - // If specified, this listener must have a `protocol` of `http`, and the target - // 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. - 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 - // have a unique `port` and `protocol` combination. - // - // Not supported for load balancers operating with route mode enabled. - Port *int64 `json:"port,omitempty"` - - // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. - // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `65535` must be specified. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. - // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `1` must be specified. - // - // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the - // same protocol. - PortMin *int64 `json:"port_min,omitempty"` - - // The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. - // - // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the - // `application` family support `tcp`, `http` and - // `https`. - // - // Additional restrictions: - // - If `default_pool` is set, the pool's protocol must match, or be compatible with - // the listener's protocol. At present, the compatible protocols are `http` and - // `https`. - // - If `https_redirect` is set, the protocol must be `http`. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the LoadBalancerListenerPrototypeLoadBalancerContext.Protocol property. -// The listener protocol. Each listener in the load balancer must have a unique `port` and `protocol` combination. -// -// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the -// `application` family support `tcp`, `http` and -// `https`. -// -// Additional restrictions: -// - If `default_pool` is set, the pool's protocol must match, or be compatible with -// the listener's protocol. At present, the compatible protocols are `http` and -// `https`. -// - If `https_redirect` is set, the protocol must be `http`. -const ( - LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPConst = "http" - LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPSConst = "https" - LoadBalancerListenerPrototypeLoadBalancerContextProtocolTCPConst = "tcp" - LoadBalancerListenerPrototypeLoadBalancerContextProtocolUDPConst = "udp" -) - -// NewLoadBalancerListenerPrototypeLoadBalancerContext : Instantiate LoadBalancerListenerPrototypeLoadBalancerContext (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPrototypeLoadBalancerContext(protocol string) (_model *LoadBalancerListenerPrototypeLoadBalancerContext, err error) { - _model = &LoadBalancerListenerPrototypeLoadBalancerContext{ - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext unmarshals an instance of LoadBalancerListenerPrototypeLoadBalancerContext from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPrototypeLoadBalancerContext) - err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "accept_proxy_protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "certificate_instance-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) - if err != nil { - err = core.SDKErrorf(err, "", "connection_limit-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentityByName) - if err != nil { - err = core.SDKErrorf(err, "", "default_pool-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "https_redirect", &obj.HTTPSRedirect, UnmarshalLoadBalancerListenerHTTPSRedirectPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "https_redirect-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "idle_connection_timeout", &obj.IdleConnectionTimeout) - if err != nil { - err = core.SDKErrorf(err, "", "idle_connection_timeout-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-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 - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerReference : LoadBalancerListenerReference struct -type LoadBalancerListenerReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerListenerReferenceDeleted `json:"deleted,omitempty"` - - // The listener's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer listener. - ID *string `json:"id" validate:"required"` -} - -// UnmarshalLoadBalancerListenerReference unmarshals an instance of LoadBalancerListenerReference from the specified map of raw messages. -func UnmarshalLoadBalancerListenerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerListenerReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerListenerReferenceDeleted unmarshals an instance of LoadBalancerListenerReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerListenerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerReferenceDeleted) - 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 -} - -// LoadBalancerLogging : LoadBalancerLogging struct -type LoadBalancerLogging struct { - // The datapath logging configuration for this load balancer. - Datapath *LoadBalancerLoggingDatapath `json:"datapath" validate:"required"` -} - -// UnmarshalLoadBalancerLogging unmarshals an instance of LoadBalancerLogging from the specified map of raw messages. -func UnmarshalLoadBalancerLogging(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerLogging) - err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapath) - if err != nil { - err = core.SDKErrorf(err, "", "datapath-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerLoggingDatapath : The datapath logging configuration for this load balancer. -type LoadBalancerLoggingDatapath struct { - // Indicates whether datapath logging is active for this load balancer. - Active *bool `json:"active" validate:"required"` -} - -// UnmarshalLoadBalancerLoggingDatapath unmarshals an instance of LoadBalancerLoggingDatapath from the specified map of raw messages. -func UnmarshalLoadBalancerLoggingDatapath(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerLoggingDatapath) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerLoggingDatapathPatch : The datapath logging configuration for this load balancer. -type LoadBalancerLoggingDatapathPatch struct { - // Indicates whether datapath logging will be active for this load balancer. - Active *bool `json:"active,omitempty"` -} - -// UnmarshalLoadBalancerLoggingDatapathPatch unmarshals an instance of LoadBalancerLoggingDatapathPatch from the specified map of raw messages. -func UnmarshalLoadBalancerLoggingDatapathPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerLoggingDatapathPatch) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerLoggingDatapathPrototype : The datapath logging configuration for this load balancer. -type LoadBalancerLoggingDatapathPrototype struct { - // Indicates whether datapath logging will be active for this load balancer. - Active *bool `json:"active,omitempty"` -} - -// UnmarshalLoadBalancerLoggingDatapathPrototype unmarshals an instance of LoadBalancerLoggingDatapathPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerLoggingDatapathPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerLoggingDatapathPrototype) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerLoggingPatch : LoadBalancerLoggingPatch struct -type LoadBalancerLoggingPatch struct { - // The datapath logging configuration for this load balancer. - Datapath *LoadBalancerLoggingDatapathPatch `json:"datapath,omitempty"` -} - -// UnmarshalLoadBalancerLoggingPatch unmarshals an instance of LoadBalancerLoggingPatch from the specified map of raw messages. -func UnmarshalLoadBalancerLoggingPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerLoggingPatch) - err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPatch) - if err != nil { - err = core.SDKErrorf(err, "", "datapath-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerLoggingPrototype : LoadBalancerLoggingPrototype struct -type LoadBalancerLoggingPrototype struct { - // The datapath logging configuration for this load balancer. - Datapath *LoadBalancerLoggingDatapathPrototype `json:"datapath,omitempty"` -} - -// UnmarshalLoadBalancerLoggingPrototype unmarshals an instance of LoadBalancerLoggingPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerLoggingPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerLoggingPrototype) - err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapathPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "datapath-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPatch : LoadBalancerPatch struct -type LoadBalancerPatch struct { - // The DNS configuration for this load balancer. - // - // Specify `null` to remove the existing DNS configuration, which will remove all DNS `A` - // records for this load balancer that had been added to `zone`, and add equivalent `A` - // records to the public DNS zone `lb.appdomain.cloud`. - Dns *LoadBalancerDnsPatch `json:"dns,omitempty"` - - // The logging configuration to use for this load balancer. - // - // To activate logging, the load balancer profile must support the specified logging type. - Logging *LoadBalancerLoggingPatch `json:"logging,omitempty"` - - // The name for this load balancer. The name must not be used by another load balancer in the VPC. - Name *string `json:"name,omitempty"` - - // The subnets to provision this load balancer in. The load balancer's availability will depend on the availability of - // the zones that the subnets reside in. - // - // The specified subnets must be in the same VPC as the existing subnets, and will completely replace the existing - // subnets. - // - // The load balancer must be in the `application` family. - Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` -} - -// UnmarshalLoadBalancerPatch unmarshals an instance of LoadBalancerPatch from the specified map of raw messages. -func UnmarshalLoadBalancerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPatch) - err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalLoadBalancerDnsPatch) - if err != nil { - err = core.SDKErrorf(err, "", "dns-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLoggingPatch) - if err != nil { - err = core.SDKErrorf(err, "", "logging-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, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// LoadBalancerPool : LoadBalancerPool struct -type LoadBalancerPool struct { - // The load balancing algorithm. - Algorithm *string `json:"algorithm" validate:"required"` - - // The date and time that this pool was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The health monitor of this pool. - HealthMonitor *LoadBalancerPoolHealthMonitor `json:"health_monitor" validate:"required"` - - // The pool's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` - - // The instance group that is managing this pool. - InstanceGroup *InstanceGroupReference `json:"instance_group,omitempty"` - - // The backend server members of the pool. - Members []LoadBalancerPoolMemberReference `json:"members,omitempty"` - - // The name for this load balancer pool. The name is unique across all pools for the load balancer. - Name *string `json:"name" validate:"required"` - - // The protocol for this load balancer pool. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Protocol *string `json:"protocol" validate:"required"` - - // The provisioning status of this pool - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - ProvisioningStatus *string `json:"provisioning_status" validate:"required"` - - // The PROXY protocol setting for this pool: - // - `v1`: Enabled with version 1 (human-readable header format) - // - `v2`: Enabled with version 2 (binary header format) - // - `disabled`: Disabled - // - // Supported by load balancers in the `application` family (otherwise always `disabled`). - ProxyProtocol *string `json:"proxy_protocol" validate:"required"` - - // The session persistence of this pool. - SessionPersistence *LoadBalancerPoolSessionPersistence `json:"session_persistence,omitempty"` -} - -// Constants associated with the LoadBalancerPool.Algorithm property. -// The load balancing algorithm. -const ( - LoadBalancerPoolAlgorithmLeastConnectionsConst = "least_connections" - LoadBalancerPoolAlgorithmRoundRobinConst = "round_robin" - LoadBalancerPoolAlgorithmWeightedRoundRobinConst = "weighted_round_robin" -) - -// Constants associated with the LoadBalancerPool.Protocol property. -// The protocol for this load balancer pool. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerPoolProtocolHTTPConst = "http" - LoadBalancerPoolProtocolHTTPSConst = "https" - LoadBalancerPoolProtocolTCPConst = "tcp" - LoadBalancerPoolProtocolUDPConst = "udp" -) - -// Constants associated with the LoadBalancerPool.ProvisioningStatus property. -// The provisioning status of this pool -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerPoolProvisioningStatusActiveConst = "active" - LoadBalancerPoolProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerPoolProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerPoolProvisioningStatusFailedConst = "failed" - LoadBalancerPoolProvisioningStatusUpdatePendingConst = "update_pending" -) - -// Constants associated with the LoadBalancerPool.ProxyProtocol property. -// The PROXY protocol setting for this pool: -// - `v1`: Enabled with version 1 (human-readable header format) -// - `v2`: Enabled with version 2 (binary header format) -// - `disabled`: Disabled -// -// Supported by load balancers in the `application` family (otherwise always `disabled`). -const ( - LoadBalancerPoolProxyProtocolDisabledConst = "disabled" - LoadBalancerPoolProxyProtocolV1Const = "v1" - LoadBalancerPoolProxyProtocolV2Const = "v2" -) - -// UnmarshalLoadBalancerPool unmarshals an instance of LoadBalancerPool from the specified map of raw messages. -func UnmarshalLoadBalancerPool(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPool) - err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) - if err != nil { - err = core.SDKErrorf(err, "", "algorithm-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, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitor) - if err != nil { - err = core.SDKErrorf(err, "", "health_monitor-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, "instance_group", &obj.InstanceGroup, UnmarshalInstanceGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "instance_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberReference) - if err != nil { - err = core.SDKErrorf(err, "", "members-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, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) - if err != nil { - err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "proxy_protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistence) - if err != nil { - err = core.SDKErrorf(err, "", "session_persistence-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolCollection : LoadBalancerPoolCollection struct -type LoadBalancerPoolCollection struct { - // Collection of pools. - Pools []LoadBalancerPool `json:"pools" validate:"required"` -} - -// UnmarshalLoadBalancerPoolCollection unmarshals an instance of LoadBalancerPoolCollection from the specified map of raw messages. -func UnmarshalLoadBalancerPoolCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolCollection) - err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPool) - if err != nil { - err = core.SDKErrorf(err, "", "pools-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolHealthMonitor : LoadBalancerPoolHealthMonitor struct -type LoadBalancerPoolHealthMonitor struct { - // The seconds to wait between health checks. - Delay *int64 `json:"delay" validate:"required"` - - // The health check max retries. - MaxRetries *int64 `json:"max_retries" validate:"required"` - - // The health check port. - // - // If present, this overrides the pool member port values. - Port *int64 `json:"port,omitempty"` - - // The seconds to wait for a response to a health check. - Timeout *int64 `json:"timeout" validate:"required"` - - // The protocol type to use for health checks. - // - // 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 health check URL path. Applicable when `type` is `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"` -} - -// Constants associated with the LoadBalancerPoolHealthMonitor.Type property. -// The protocol type to use for health checks. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerPoolHealthMonitorTypeHTTPConst = "http" - LoadBalancerPoolHealthMonitorTypeHTTPSConst = "https" - LoadBalancerPoolHealthMonitorTypeTCPConst = "tcp" -) - -// UnmarshalLoadBalancerPoolHealthMonitor unmarshals an instance of LoadBalancerPoolHealthMonitor from the specified map of raw messages. -func UnmarshalLoadBalancerPoolHealthMonitor(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolHealthMonitor) - err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) - if err != nil { - err = core.SDKErrorf(err, "", "delay-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) - if err != nil { - err = core.SDKErrorf(err, "", "max_retries-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) - if err != nil { - err = core.SDKErrorf(err, "", "timeout-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, "url_path", &obj.URLPath) - if err != nil { - err = core.SDKErrorf(err, "", "url_path-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolHealthMonitorPatch : LoadBalancerPoolHealthMonitorPatch struct -type LoadBalancerPoolHealthMonitorPatch struct { - // The seconds to wait between health checks. Must be greater than `timeout`. - Delay *int64 `json:"delay" validate:"required"` - - // The health check max retries. - MaxRetries *int64 `json:"max_retries" validate:"required"` - - // The health check port. - // - // If set, this overrides the pool member port values. - // - // Specify `null` to remove an existing health check port. - Port *int64 `json:"port,omitempty"` - - // The seconds to wait for a response to a health check. Must be less than `delay`. - Timeout *int64 `json:"timeout" validate:"required"` - - // The protocol type to use for health checks. - Type *string `json:"type" validate:"required"` - - // The health check URL path. Applicable when `type` is `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"` -} - -// Constants associated with the LoadBalancerPoolHealthMonitorPatch.Type property. -// The protocol type to use for health checks. -const ( - LoadBalancerPoolHealthMonitorPatchTypeHTTPConst = "http" - LoadBalancerPoolHealthMonitorPatchTypeHTTPSConst = "https" - LoadBalancerPoolHealthMonitorPatchTypeTCPConst = "tcp" -) - -// NewLoadBalancerPoolHealthMonitorPatch : Instantiate LoadBalancerPoolHealthMonitorPatch (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolHealthMonitorPatch(delay int64, maxRetries int64, timeout int64, typeVar string) (_model *LoadBalancerPoolHealthMonitorPatch, err error) { - _model = &LoadBalancerPoolHealthMonitorPatch{ - Delay: core.Int64Ptr(delay), - MaxRetries: core.Int64Ptr(maxRetries), - Timeout: core.Int64Ptr(timeout), - Type: core.StringPtr(typeVar), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalLoadBalancerPoolHealthMonitorPatch unmarshals an instance of LoadBalancerPoolHealthMonitorPatch from the specified map of raw messages. -func UnmarshalLoadBalancerPoolHealthMonitorPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolHealthMonitorPatch) - err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) - if err != nil { - err = core.SDKErrorf(err, "", "delay-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) - if err != nil { - err = core.SDKErrorf(err, "", "max_retries-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) - if err != nil { - err = core.SDKErrorf(err, "", "timeout-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, "url_path", &obj.URLPath) - if err != nil { - err = core.SDKErrorf(err, "", "url_path-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolHealthMonitorPrototype : LoadBalancerPoolHealthMonitorPrototype struct -type LoadBalancerPoolHealthMonitorPrototype struct { - // The seconds to wait between health checks. Must be greater than `timeout`. - Delay *int64 `json:"delay" validate:"required"` - - // The health check max retries. - MaxRetries *int64 `json:"max_retries" validate:"required"` - - // The health check port. - // - // If specified, this overrides the pool member port values. - Port *int64 `json:"port,omitempty"` - - // The seconds to wait for a response to a health check. Must be less than `delay`. - Timeout *int64 `json:"timeout" validate:"required"` - - // The protocol type to use for health checks. - Type *string `json:"type" validate:"required"` - - // The health check URL path. Applicable when `type` is `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"` -} - -// Constants associated with the LoadBalancerPoolHealthMonitorPrototype.Type property. -// The protocol type to use for health checks. -const ( - LoadBalancerPoolHealthMonitorPrototypeTypeHTTPConst = "http" - LoadBalancerPoolHealthMonitorPrototypeTypeHTTPSConst = "https" - LoadBalancerPoolHealthMonitorPrototypeTypeTCPConst = "tcp" -) - -// NewLoadBalancerPoolHealthMonitorPrototype : Instantiate LoadBalancerPoolHealthMonitorPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolHealthMonitorPrototype(delay int64, maxRetries int64, timeout int64, typeVar string) (_model *LoadBalancerPoolHealthMonitorPrototype, err error) { - _model = &LoadBalancerPoolHealthMonitorPrototype{ - Delay: core.Int64Ptr(delay), - MaxRetries: core.Int64Ptr(maxRetries), - Timeout: core.Int64Ptr(timeout), - Type: core.StringPtr(typeVar), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalLoadBalancerPoolHealthMonitorPrototype unmarshals an instance of LoadBalancerPoolHealthMonitorPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerPoolHealthMonitorPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolHealthMonitorPrototype) - err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) - if err != nil { - err = core.SDKErrorf(err, "", "delay-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) - if err != nil { - err = core.SDKErrorf(err, "", "max_retries-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) - if err != nil { - err = core.SDKErrorf(err, "", "timeout-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, "url_path", &obj.URLPath) - if err != nil { - err = core.SDKErrorf(err, "", "url_path-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. -// Models which "extend" this model: -// - LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID -// - LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref -type LoadBalancerPoolIdentity struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerPoolIdentity) isaLoadBalancerPoolIdentity() bool { - return true -} - -type LoadBalancerPoolIdentityIntf interface { - isaLoadBalancerPoolIdentity() bool -} - -// UnmarshalLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerPoolIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolIdentity) - 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 -} - -// LoadBalancerPoolIdentityByName : LoadBalancerPoolIdentityByName struct -type LoadBalancerPoolIdentityByName struct { - // The name for this load balancer pool. The name is unique across all pools for the load balancer. - Name *string `json:"name" validate:"required"` -} - -// NewLoadBalancerPoolIdentityByName : Instantiate LoadBalancerPoolIdentityByName (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolIdentityByName(name string) (_model *LoadBalancerPoolIdentityByName, err error) { - _model = &LoadBalancerPoolIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalLoadBalancerPoolIdentityByName unmarshals an instance of LoadBalancerPoolIdentityByName from the specified map of raw messages. -func UnmarshalLoadBalancerPoolIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolIdentityByName) - 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 -} - -// LoadBalancerPoolMember : LoadBalancerPoolMember struct -type LoadBalancerPoolMember struct { - // The date and time that this member was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // Health of the server member in the pool. - Health *string `json:"health" validate:"required"` - - // The member's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer pool member. - ID *string `json:"id" validate:"required"` - - // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a - // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive - // the traffic on the same port the listener received it on.) - // - // This port will also be used for health checks unless the `port` property of - // `health_monitor` property is specified. - Port *int64 `json:"port" validate:"required"` - - // The provisioning status of this member - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - ProvisioningStatus *string `json:"provisioning_status" validate:"required"` - - // The pool member target. Load balancers in the `network` family support virtual server - // instances. Load balancers in the `application` family support IP addresses. If the load - // balancer has route mode enabled, the member must be in a zone the load balancer has a - // subnet in. - Target LoadBalancerPoolMemberTargetIntf `json:"target" validate:"required"` - - // Weight of the server member. Applicable only if the pool algorithm is - // `weighted_round_robin`. - Weight *int64 `json:"weight,omitempty"` -} - -// Constants associated with the LoadBalancerPoolMember.Health property. -// Health of the server member in the pool. -const ( - LoadBalancerPoolMemberHealthFaultedConst = "faulted" - LoadBalancerPoolMemberHealthOkConst = "ok" - LoadBalancerPoolMemberHealthUnknownConst = "unknown" -) - -// Constants associated with the LoadBalancerPoolMember.ProvisioningStatus property. -// The provisioning status of this member -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerPoolMemberProvisioningStatusActiveConst = "active" - LoadBalancerPoolMemberProvisioningStatusCreatePendingConst = "create_pending" - LoadBalancerPoolMemberProvisioningStatusDeletePendingConst = "delete_pending" - LoadBalancerPoolMemberProvisioningStatusFailedConst = "failed" - LoadBalancerPoolMemberProvisioningStatusUpdatePendingConst = "update_pending" -) - -// UnmarshalLoadBalancerPoolMember unmarshals an instance of LoadBalancerPoolMember from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMember(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMember) - 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, "health", &obj.Health) - if err != nil { - err = core.SDKErrorf(err, "", "health-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, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) - if err != nil { - err = core.SDKErrorf(err, "", "provisioning_status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTarget) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) - if err != nil { - err = core.SDKErrorf(err, "", "weight-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberCollection : LoadBalancerPoolMemberCollection struct -type LoadBalancerPoolMemberCollection struct { - // Collection of members. - Members []LoadBalancerPoolMember `json:"members" validate:"required"` -} - -// UnmarshalLoadBalancerPoolMemberCollection unmarshals an instance of LoadBalancerPoolMemberCollection from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberCollection) - err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMember) - if err != nil { - err = core.SDKErrorf(err, "", "members-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberPatch : LoadBalancerPoolMemberPatch struct -type LoadBalancerPoolMemberPatch struct { - // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a - // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive - // the traffic on the same port the listener received it on.) - // - // This port will also be used for health checks unless the `port` property of - // `health_monitor` property is specified. - // - // The port must be unique across all members for all pools associated with this pool's listener. - Port *int64 `json:"port,omitempty"` - - // The pool member target. Load balancers in the `network` family support virtual server - // instances. Load balancers in the `application` family support IP addresses. If the load - // balancer has route mode enabled, the member must be in a zone the load balancer has a - // subnet in. - Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target,omitempty"` - - // Weight of the server member. Applicable only if the pool algorithm is - // `weighted_round_robin`. - Weight *int64 `json:"weight,omitempty"` -} - -// UnmarshalLoadBalancerPoolMemberPatch unmarshals an instance of LoadBalancerPoolMemberPatch from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberPatch) - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) - if err != nil { - err = core.SDKErrorf(err, "", "weight-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// LoadBalancerPoolMemberPrototype : LoadBalancerPoolMemberPrototype struct -type LoadBalancerPoolMemberPrototype struct { - // The port the member will receive load balancer traffic on. Applies only to load balancer traffic received on a - // listener with a single port. (If the traffic is received on a listener with a port range, the member will receive - // the traffic on the same port the listener received it on.) - // - // This port will also be used for health checks unless the `port` property of - // `health_monitor` property is specified. - // - // The port must be unique across all members for all pools associated with this pool's listener. - Port *int64 `json:"port" validate:"required"` - - // The pool member target. Load balancers in the `network` family support virtual server - // instances. Load balancers in the `application` family support IP addresses. If the load - // balancer has route mode enabled, the member must be in a zone the load balancer has a - // subnet in. - Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` - - // Weight of the server member. Applicable only if the pool algorithm is - // `weighted_round_robin`. - Weight *int64 `json:"weight,omitempty"` -} - -// NewLoadBalancerPoolMemberPrototype : Instantiate LoadBalancerPoolMemberPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolMemberPrototype(port int64, target LoadBalancerPoolMemberTargetPrototypeIntf) (_model *LoadBalancerPoolMemberPrototype, err error) { - _model = &LoadBalancerPoolMemberPrototype{ - Port: core.Int64Ptr(port), - Target: target, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalLoadBalancerPoolMemberPrototype unmarshals an instance of LoadBalancerPoolMemberPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberPrototype) - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) - if err != nil { - err = core.SDKErrorf(err, "", "weight-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberReference : LoadBalancerPoolMemberReference struct -type LoadBalancerPoolMemberReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerPoolMemberReferenceDeleted `json:"deleted,omitempty"` - - // The member's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer pool member. - ID *string `json:"id" validate:"required"` -} - -// UnmarshalLoadBalancerPoolMemberReference unmarshals an instance of LoadBalancerPoolMemberReference from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolMemberReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerPoolMemberReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerPoolMemberReferenceDeleted unmarshals an instance of LoadBalancerPoolMemberReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberReferenceDeleted) - 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 -} - -// LoadBalancerPoolMemberTarget : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in -// the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a -// zone the load balancer has a subnet in. -// Models which "extend" this model: -// - LoadBalancerPoolMemberTargetInstanceReference -// - LoadBalancerPoolMemberTargetIP -type LoadBalancerPoolMemberTarget struct { - // The CRN for this virtual server instance. - CRN *string `json:"crn,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href,omitempty"` - - // The unique identifier for this virtual server instance. - ID *string `json:"id,omitempty"` - - // The name for this virtual server instance. The name is unique across all virtual server instances in the region. - Name *string `json:"name,omitempty"` - - // The IP address. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in - // the future. - Address *string `json:"address,omitempty"` -} - -func (*LoadBalancerPoolMemberTarget) isaLoadBalancerPoolMemberTarget() bool { - return true -} - -type LoadBalancerPoolMemberTargetIntf interface { - isaLoadBalancerPoolMemberTarget() bool -} - -// UnmarshalLoadBalancerPoolMemberTarget unmarshals an instance of LoadBalancerPoolMemberTarget from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTarget) - 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, UnmarshalInstanceReferenceDeleted) - 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, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTargetPrototype : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in -// the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a -// zone the load balancer has a subnet in. -// Models which "extend" this model: -// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentity -// - LoadBalancerPoolMemberTargetPrototypeIP -type LoadBalancerPoolMemberTargetPrototype struct { - // The unique identifier for this virtual server instance. - ID *string `json:"id,omitempty"` - - // The CRN for this virtual server instance. - CRN *string `json:"crn,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href,omitempty"` - - // The IP address. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in - // the future. - Address *string `json:"address,omitempty"` -} - -func (*LoadBalancerPoolMemberTargetPrototype) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -type LoadBalancerPoolMemberTargetPrototypeIntf interface { - isaLoadBalancerPoolMemberTargetPrototype() bool -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototype unmarshals an instance of LoadBalancerPoolMemberTargetPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolPatch : LoadBalancerPoolPatch struct -type LoadBalancerPoolPatch struct { - // The load balancing algorithm. - Algorithm *string `json:"algorithm,omitempty"` - - // The health monitor of this pool. - HealthMonitor *LoadBalancerPoolHealthMonitorPatch `json:"health_monitor,omitempty"` - - // The name for this load balancer pool. The name must not be used by another pool for the load balancer. - Name *string `json:"name,omitempty"` - - // The protocol for this load balancer pool. - // - // Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the - // `application` family support `tcp`, `http` and - // `https`. - // - // If this pool is associated with a load balancer listener, the specified protocol must match, or be compatible with - // the listener's protocol. At present, the compatible protocols are `http` and `https`. - Protocol *string `json:"protocol,omitempty"` - - // The PROXY protocol setting for this pool: - // - `v1`: Enabled with version 1 (human-readable header format) - // - `v2`: Enabled with version 2 (binary header format) - // - `disabled`: Disabled - // - // Supported by load balancers in the `application` family (otherwise always `disabled`). - ProxyProtocol *string `json:"proxy_protocol,omitempty"` - - // The session persistence of this pool. - SessionPersistence *LoadBalancerPoolSessionPersistencePatch `json:"session_persistence,omitempty"` -} - -// Constants associated with the LoadBalancerPoolPatch.Algorithm property. -// The load balancing algorithm. -const ( - LoadBalancerPoolPatchAlgorithmLeastConnectionsConst = "least_connections" - LoadBalancerPoolPatchAlgorithmRoundRobinConst = "round_robin" - LoadBalancerPoolPatchAlgorithmWeightedRoundRobinConst = "weighted_round_robin" -) - -// Constants associated with the LoadBalancerPoolPatch.Protocol property. -// The protocol for this load balancer pool. -// -// Load balancers in the `network` family support `tcp` and `udp` (if `udp_supported` is `true`). Load balancers in the -// `application` family support `tcp`, `http` and -// `https`. -// -// If this pool is associated with a load balancer listener, the specified protocol must match, or be compatible with -// the listener's protocol. At present, the compatible protocols are `http` and `https`. -const ( - LoadBalancerPoolPatchProtocolHTTPConst = "http" - LoadBalancerPoolPatchProtocolHTTPSConst = "https" - LoadBalancerPoolPatchProtocolTCPConst = "tcp" - LoadBalancerPoolPatchProtocolUDPConst = "udp" -) - -// Constants associated with the LoadBalancerPoolPatch.ProxyProtocol property. -// The PROXY protocol setting for this pool: -// - `v1`: Enabled with version 1 (human-readable header format) -// - `v2`: Enabled with version 2 (binary header format) -// - `disabled`: Disabled -// -// Supported by load balancers in the `application` family (otherwise always `disabled`). -const ( - LoadBalancerPoolPatchProxyProtocolDisabledConst = "disabled" - LoadBalancerPoolPatchProxyProtocolV1Const = "v1" - LoadBalancerPoolPatchProxyProtocolV2Const = "v2" -) - -// UnmarshalLoadBalancerPoolPatch unmarshals an instance of LoadBalancerPoolPatch from the specified map of raw messages. -func UnmarshalLoadBalancerPoolPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolPatch) - err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) - if err != nil { - err = core.SDKErrorf(err, "", "algorithm-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPatch) - if err != nil { - err = core.SDKErrorf(err, "", "health_monitor-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, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "proxy_protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePatch) - if err != nil { - err = core.SDKErrorf(err, "", "session_persistence-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// LoadBalancerPoolPrototype : LoadBalancerPoolPrototype struct -type LoadBalancerPoolPrototype struct { - // The load balancing algorithm. - Algorithm *string `json:"algorithm" validate:"required"` - - // The health monitor of this pool. - HealthMonitor *LoadBalancerPoolHealthMonitorPrototype `json:"health_monitor" validate:"required"` - - // The members for this load balancer pool. For load balancers in the `network` family, the same `port` and `target` - // tuple cannot be shared by a pool member of any other load balancer in the same VPC. - Members []LoadBalancerPoolMemberPrototype `json:"members,omitempty"` - - // The name for this load balancer pool. The name must not be used by another pool for the load balancer. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if - // `udp_supported` is `true`). Load balancers in the - // `application` family support `tcp`, `http`, and `https`. - Protocol *string `json:"protocol" validate:"required"` - - // The PROXY protocol setting for this pool: - // - `v1`: Enabled with version 1 (human-readable header format) - // - `v2`: Enabled with version 2 (binary header format) - // - `disabled`: Disabled - // - // Supported by load balancers in the `application` family (otherwise always `disabled`). - ProxyProtocol *string `json:"proxy_protocol,omitempty"` - - // The session persistence of this pool. If unspecified, session persistence will be - // disabled, and traffic will be distributed across backend server members of the - // pool. - SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` -} - -// Constants associated with the LoadBalancerPoolPrototype.Algorithm property. -// The load balancing algorithm. -const ( - LoadBalancerPoolPrototypeAlgorithmLeastConnectionsConst = "least_connections" - LoadBalancerPoolPrototypeAlgorithmRoundRobinConst = "round_robin" - LoadBalancerPoolPrototypeAlgorithmWeightedRoundRobinConst = "weighted_round_robin" -) - -// Constants associated with the LoadBalancerPoolPrototype.Protocol property. -// The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp` and `udp` (if -// `udp_supported` is `true`). Load balancers in the -// `application` family support `tcp`, `http`, and `https`. -const ( - LoadBalancerPoolPrototypeProtocolHTTPConst = "http" - LoadBalancerPoolPrototypeProtocolHTTPSConst = "https" - LoadBalancerPoolPrototypeProtocolTCPConst = "tcp" - LoadBalancerPoolPrototypeProtocolUDPConst = "udp" -) - -// Constants associated with the LoadBalancerPoolPrototype.ProxyProtocol property. -// The PROXY protocol setting for this pool: -// - `v1`: Enabled with version 1 (human-readable header format) -// - `v2`: Enabled with version 2 (binary header format) -// - `disabled`: Disabled -// -// Supported by load balancers in the `application` family (otherwise always `disabled`). -const ( - LoadBalancerPoolPrototypeProxyProtocolDisabledConst = "disabled" - LoadBalancerPoolPrototypeProxyProtocolV1Const = "v1" - LoadBalancerPoolPrototypeProxyProtocolV2Const = "v2" -) - -// NewLoadBalancerPoolPrototype : Instantiate LoadBalancerPoolPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolPrototype(algorithm string, healthMonitor *LoadBalancerPoolHealthMonitorPrototype, protocol string) (_model *LoadBalancerPoolPrototype, err error) { - _model = &LoadBalancerPoolPrototype{ - Algorithm: core.StringPtr(algorithm), - HealthMonitor: healthMonitor, - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalLoadBalancerPoolPrototype unmarshals an instance of LoadBalancerPoolPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerPoolPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolPrototype) - err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) - if err != nil { - err = core.SDKErrorf(err, "", "algorithm-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "health_monitor-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "members-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, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "proxy_protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "session_persistence-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolReference : LoadBalancerPoolReference struct -type LoadBalancerPoolReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` - - // The name for this load balancer pool. The name is unique across all pools for the load balancer. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalLoadBalancerPoolReference unmarshals an instance of LoadBalancerPoolReference from the specified map of raw messages. -func UnmarshalLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerPoolReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerPoolReferenceDeleted unmarshals an instance of LoadBalancerPoolReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerPoolReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolReferenceDeleted) - 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 -} - -// LoadBalancerPoolSessionPersistence : LoadBalancerPoolSessionPersistence struct -type LoadBalancerPoolSessionPersistence struct { - // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not - // allowed. - CookieName *string `json:"cookie_name,omitempty"` - - // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` - // protocols. - // - // 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"` -} - -// Constants associated with the LoadBalancerPoolSessionPersistence.Type property. -// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` -// protocols. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerPoolSessionPersistenceTypeAppCookieConst = "app_cookie" - LoadBalancerPoolSessionPersistenceTypeHTTPCookieConst = "http_cookie" - LoadBalancerPoolSessionPersistenceTypeSourceIPConst = "source_ip" -) - -// UnmarshalLoadBalancerPoolSessionPersistence unmarshals an instance of LoadBalancerPoolSessionPersistence from the specified map of raw messages. -func UnmarshalLoadBalancerPoolSessionPersistence(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolSessionPersistence) - err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) - if err != nil { - err = core.SDKErrorf(err, "", "cookie_name-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 -} - -// LoadBalancerPoolSessionPersistencePatch : The session persistence configuration. Specify `null` to remove any existing session persistence configuration. -type LoadBalancerPoolSessionPersistencePatch struct { - // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not - // allowed. - CookieName *string `json:"cookie_name,omitempty"` - - // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` - // protocols. - Type *string `json:"type,omitempty"` -} - -// Constants associated with the LoadBalancerPoolSessionPersistencePatch.Type property. -// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` -// protocols. -const ( - LoadBalancerPoolSessionPersistencePatchTypeAppCookieConst = "app_cookie" - LoadBalancerPoolSessionPersistencePatchTypeHTTPCookieConst = "http_cookie" - LoadBalancerPoolSessionPersistencePatchTypeSourceIPConst = "source_ip" -) - -// UnmarshalLoadBalancerPoolSessionPersistencePatch unmarshals an instance of LoadBalancerPoolSessionPersistencePatch from the specified map of raw messages. -func UnmarshalLoadBalancerPoolSessionPersistencePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolSessionPersistencePatch) - err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) - if err != nil { - err = core.SDKErrorf(err, "", "cookie_name-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 -} - -// LoadBalancerPoolSessionPersistencePrototype : LoadBalancerPoolSessionPersistencePrototype struct -type LoadBalancerPoolSessionPersistencePrototype struct { - // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not - // allowed. - CookieName *string `json:"cookie_name,omitempty"` - - // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` - // protocols. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerPoolSessionPersistencePrototype.Type property. -// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` -// protocols. -const ( - LoadBalancerPoolSessionPersistencePrototypeTypeAppCookieConst = "app_cookie" - LoadBalancerPoolSessionPersistencePrototypeTypeHTTPCookieConst = "http_cookie" - LoadBalancerPoolSessionPersistencePrototypeTypeSourceIPConst = "source_ip" -) - -// NewLoadBalancerPoolSessionPersistencePrototype : Instantiate LoadBalancerPoolSessionPersistencePrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolSessionPersistencePrototype(typeVar string) (_model *LoadBalancerPoolSessionPersistencePrototype, err error) { - _model = &LoadBalancerPoolSessionPersistencePrototype{ - Type: core.StringPtr(typeVar), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalLoadBalancerPoolSessionPersistencePrototype unmarshals an instance of LoadBalancerPoolSessionPersistencePrototype from the specified map of raw messages. -func UnmarshalLoadBalancerPoolSessionPersistencePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolSessionPersistencePrototype) - err = core.UnmarshalPrimitive(m, "cookie_name", &obj.CookieName) - if err != nil { - err = core.SDKErrorf(err, "", "cookie_name-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 -} - -// LoadBalancerPrivateIpsItem : LoadBalancerPrivateIpsItem struct -type LoadBalancerPrivateIpsItem struct { - // The IP address. - // - // If the address has not yet been selected, 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"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` - - // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the LoadBalancerPrivateIpsItem.ResourceType property. -// The resource type. -const ( - LoadBalancerPrivateIpsItemResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" -) - -// UnmarshalLoadBalancerPrivateIpsItem unmarshals an instance of LoadBalancerPrivateIpsItem from the specified map of raw messages. -func UnmarshalLoadBalancerPrivateIpsItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPrivateIpsItem) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) - 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 -} - -// LoadBalancerProfile : LoadBalancerProfile struct -type LoadBalancerProfile struct { - // The product family this load balancer 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 URL for this load balancer profile. - Href *string `json:"href" validate:"required"` - - InstanceGroupsSupported LoadBalancerProfileInstanceGroupsSupportedIntf `json:"instance_groups_supported" validate:"required"` - - // Indicates which logging type(s) are supported for a load balancer with this profile. - LoggingSupported *LoadBalancerProfileLoggingSupported `json:"logging_supported" validate:"required"` - - // The globally unique name for this load balancer profile. - Name *string `json:"name" validate:"required"` - - RouteModeSupported LoadBalancerProfileRouteModeSupportedIntf `json:"route_mode_supported" validate:"required"` - - SecurityGroupsSupported LoadBalancerProfileSecurityGroupsSupportedIntf `json:"security_groups_supported" validate:"required"` - - UDPSupported LoadBalancerProfileUDPSupportedIntf `json:"udp_supported" validate:"required"` -} - -// Constants associated with the LoadBalancerProfile.Family property. -// The product family this load balancer profile belongs to. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerProfileFamilyApplicationConst = "application" - LoadBalancerProfileFamilyNetworkConst = "network" -) - -// UnmarshalLoadBalancerProfile unmarshals an instance of LoadBalancerProfile from the specified map of raw messages. -func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfile) - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - err = core.SDKErrorf(err, "", "family-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.UnmarshalModel(m, "instance_groups_supported", &obj.InstanceGroupsSupported, UnmarshalLoadBalancerProfileInstanceGroupsSupported) - if err != nil { - err = core.SDKErrorf(err, "", "instance_groups_supported-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "logging_supported", &obj.LoggingSupported, UnmarshalLoadBalancerProfileLoggingSupported) - if err != nil { - err = core.SDKErrorf(err, "", "logging_supported-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, "route_mode_supported", &obj.RouteModeSupported, UnmarshalLoadBalancerProfileRouteModeSupported) - if err != nil { - err = core.SDKErrorf(err, "", "route_mode_supported-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups_supported", &obj.SecurityGroupsSupported, UnmarshalLoadBalancerProfileSecurityGroupsSupported) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups_supported-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "udp_supported", &obj.UDPSupported, UnmarshalLoadBalancerProfileUDPSupported) - if err != nil { - err = core.SDKErrorf(err, "", "udp_supported-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileCollection : LoadBalancerProfileCollection struct -type LoadBalancerProfileCollection struct { - // A link to the first page of resources. - First *LoadBalancerProfileCollectionFirst `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"` - - // Collection of load balancer profiles. - Profiles []LoadBalancerProfile `json:"profiles" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalLoadBalancerProfileCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalLoadBalancerProfile) - 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()) - 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 *LoadBalancerProfileCollection) 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 -} - -// 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 -// - LoadBalancerProfileIdentityByHref -type LoadBalancerProfileIdentity struct { - // The globally unique name for this load balancer profile. - Name *string `json:"name,omitempty"` - - // The URL for this load balancer profile. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerProfileIdentity) isaLoadBalancerProfileIdentity() bool { - return true -} - -type LoadBalancerProfileIdentityIntf interface { - isaLoadBalancerProfileIdentity() bool -} - -// UnmarshalLoadBalancerProfileIdentity unmarshals an instance of LoadBalancerProfileIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileIdentity) - 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 -} - -// LoadBalancerProfileInstanceGroupsSupported : LoadBalancerProfileInstanceGroupsSupported struct -// Models which "extend" this model: -// - LoadBalancerProfileInstanceGroupsSupportedFixed -// - LoadBalancerProfileInstanceGroupsSupportedDependent -type LoadBalancerProfileInstanceGroupsSupported struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *bool `json:"value,omitempty"` -} - -// Constants associated with the LoadBalancerProfileInstanceGroupsSupported.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileInstanceGroupsSupportedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileInstanceGroupsSupported) isaLoadBalancerProfileInstanceGroupsSupported() bool { - return true -} - -type LoadBalancerProfileInstanceGroupsSupportedIntf interface { - isaLoadBalancerProfileInstanceGroupsSupported() bool -} - -// UnmarshalLoadBalancerProfileInstanceGroupsSupported unmarshals an instance of LoadBalancerProfileInstanceGroupsSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileInstanceGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileInstanceGroupsSupported) - 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 -} - -// LoadBalancerProfileLoggingSupported : Indicates which logging type(s) are supported for a load balancer with this profile. -type LoadBalancerProfileLoggingSupported struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The supported logging type(s) for a load balancer with this profile. - Value []string `json:"value" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileLoggingSupported.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileLoggingSupportedTypeFixedConst = "fixed" -) - -// UnmarshalLoadBalancerProfileLoggingSupported unmarshals an instance of LoadBalancerProfileLoggingSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileLoggingSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileLoggingSupported) - 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 -} - -// LoadBalancerProfileReference : LoadBalancerProfileReference struct -type LoadBalancerProfileReference struct { - // The product family this load balancer 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 URL for this load balancer profile. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this load balancer profile. - Name *string `json:"name" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileReference.Family property. -// The product family this load balancer profile belongs to. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - LoadBalancerProfileReferenceFamilyApplicationConst = "application" - LoadBalancerProfileReferenceFamilyNetworkConst = "network" -) - -// UnmarshalLoadBalancerProfileReference unmarshals an instance of LoadBalancerProfileReference from the specified map of raw messages. -func UnmarshalLoadBalancerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileReference) - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - err = core.SDKErrorf(err, "", "family-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, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileRouteModeSupported : LoadBalancerProfileRouteModeSupported struct -// Models which "extend" this model: -// - LoadBalancerProfileRouteModeSupportedFixed -// - LoadBalancerProfileRouteModeSupportedDependent -type LoadBalancerProfileRouteModeSupported struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *bool `json:"value,omitempty"` -} - -// Constants associated with the LoadBalancerProfileRouteModeSupported.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileRouteModeSupportedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileRouteModeSupported) isaLoadBalancerProfileRouteModeSupported() bool { - return true -} - -type LoadBalancerProfileRouteModeSupportedIntf interface { - isaLoadBalancerProfileRouteModeSupported() bool -} - -// UnmarshalLoadBalancerProfileRouteModeSupported unmarshals an instance of LoadBalancerProfileRouteModeSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileRouteModeSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileRouteModeSupported) - 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 -} - -// LoadBalancerProfileSecurityGroupsSupported : LoadBalancerProfileSecurityGroupsSupported struct -// Models which "extend" this model: -// - LoadBalancerProfileSecurityGroupsSupportedFixed -// - LoadBalancerProfileSecurityGroupsSupportedDependent -type LoadBalancerProfileSecurityGroupsSupported struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *bool `json:"value,omitempty"` -} - -// Constants associated with the LoadBalancerProfileSecurityGroupsSupported.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileSecurityGroupsSupportedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileSecurityGroupsSupported) isaLoadBalancerProfileSecurityGroupsSupported() bool { - return true -} - -type LoadBalancerProfileSecurityGroupsSupportedIntf interface { - isaLoadBalancerProfileSecurityGroupsSupported() bool -} - -// UnmarshalLoadBalancerProfileSecurityGroupsSupported unmarshals an instance of LoadBalancerProfileSecurityGroupsSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileSecurityGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileSecurityGroupsSupported) - 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 -} - -// LoadBalancerProfileUDPSupported : LoadBalancerProfileUDPSupported struct -// Models which "extend" this model: -// - LoadBalancerProfileUDPSupportedFixed -// - LoadBalancerProfileUDPSupportedDependent -type LoadBalancerProfileUDPSupported struct { - // The type for this profile field. - Type *string `json:"type,omitempty"` - - // The value for this profile field. - Value *bool `json:"value,omitempty"` -} - -// Constants associated with the LoadBalancerProfileUDPSupported.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileUDPSupportedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileUDPSupported) isaLoadBalancerProfileUDPSupported() bool { - return true -} - -type LoadBalancerProfileUDPSupportedIntf interface { - isaLoadBalancerProfileUDPSupported() bool -} - -// UnmarshalLoadBalancerProfileUDPSupported unmarshals an instance of LoadBalancerProfileUDPSupported from the specified map of raw messages. -func UnmarshalLoadBalancerProfileUDPSupported(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileUDPSupported) - 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 -} - -// LoadBalancerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerReferenceDeleted unmarshals an instance of LoadBalancerReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerReferenceDeleted) - 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 -} - -// LoadBalancerStatistics : LoadBalancerStatistics struct -type LoadBalancerStatistics struct { - // Number of active connections of this load balancer. - ActiveConnections *int64 `json:"active_connections" validate:"required"` - - // Current connection rate (connections per second) of this load balancer. - ConnectionRate *float32 `json:"connection_rate" validate:"required"` - - // Total number of data processed (bytes) of this load balancer within current calendar month. - DataProcessedThisMonth *int64 `json:"data_processed_this_month" validate:"required"` - - // Current throughput (Mbps) of this load balancer. - Throughput *float32 `json:"throughput" validate:"required"` -} - -// UnmarshalLoadBalancerStatistics unmarshals an instance of LoadBalancerStatistics from the specified map of raw messages. -func UnmarshalLoadBalancerStatistics(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerStatistics) - err = core.UnmarshalPrimitive(m, "active_connections", &obj.ActiveConnections) - if err != nil { - err = core.SDKErrorf(err, "", "active_connections-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "connection_rate", &obj.ConnectionRate) - if err != nil { - err = core.SDKErrorf(err, "", "connection_rate-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "data_processed_this_month", &obj.DataProcessedThisMonth) - if err != nil { - err = core.SDKErrorf(err, "", "data_processed_this_month-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "throughput", &obj.Throughput) - if err != nil { - err = core.SDKErrorf(err, "", "throughput-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACL : NetworkACL struct -type NetworkACL struct { - // The date and time that the network ACL was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this network ACL. - CRN *string `json:"crn" validate:"required"` - - // The URL for this network ACL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL. - ID *string `json:"id" validate:"required"` - - // The name for this network ACL. The name is unique across all network ACLs for the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this network ACL. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The ordered rules for this network ACL. If no rules exist, all traffic will be denied. - Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` - - // The subnets to which this network ACL is attached. - Subnets []SubnetReference `json:"subnets" validate:"required"` - - // The VPC this network ACL resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// UnmarshalNetworkACL unmarshals an instance of NetworkACL from the specified map of raw messages. -func UnmarshalNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACL) - 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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) - if err != nil { - err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLCollection : NetworkACLCollection struct -type NetworkACLCollection struct { - // A link to the first page of resources. - First *NetworkACLCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // Collection of network ACLs. - NetworkAcls []NetworkACL `json:"network_acls" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *NetworkACLCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, "network_acls", &obj.NetworkAcls, UnmarshalNetworkACL) - if err != nil { - err = core.SDKErrorf(err, "", "network_acls-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLCollectionNext) - 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 *NetworkACLCollection) 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 -} - -// 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 -// - NetworkACLIdentityByCRN -// - NetworkACLIdentityByHref -type NetworkACLIdentity struct { - // The unique identifier for this network ACL. - ID *string `json:"id,omitempty"` - - // The CRN for this network ACL. - CRN *string `json:"crn,omitempty"` - - // The URL for this network ACL. - Href *string `json:"href,omitempty"` -} - -func (*NetworkACLIdentity) isaNetworkACLIdentity() bool { - return true -} - -type NetworkACLIdentityIntf interface { - isaNetworkACLIdentity() bool -} - -// UnmarshalNetworkACLIdentity unmarshals an instance of NetworkACLIdentity from the specified map of raw messages. -func UnmarshalNetworkACLIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - 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. - Name *string `json:"name,omitempty"` -} - -// UnmarshalNetworkACLPatch unmarshals an instance of NetworkACLPatch from the specified map of raw messages. -func UnmarshalNetworkACLPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLPatch) - 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 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()) - } - return -} - -// NetworkACLPrototype : NetworkACLPrototype struct -// Models which "extend" this model: -// - NetworkACLPrototypeNetworkACLByRules -// - NetworkACLPrototypeNetworkACLBySourceNetworkACL -type NetworkACLPrototype struct { - // The name for this network ACL. The name must not be used by another network ACL for the VPC. 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"` - - // The VPC this network ACL will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, - // resulting in all traffic being denied. - Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` - - // Network ACL to copy rules from. - SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl,omitempty"` -} - -func (*NetworkACLPrototype) isaNetworkACLPrototype() bool { - return true -} - -type NetworkACLPrototypeIntf interface { - isaNetworkACLPrototype() bool -} - -// UnmarshalNetworkACLPrototype unmarshals an instance of NetworkACLPrototype from the specified map of raw messages. -func UnmarshalNetworkACLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) - if err != nil { - err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_network_acl-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLReference : NetworkACLReference struct -type NetworkACLReference struct { - // The CRN for this network ACL. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkACLReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this network ACL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL. - ID *string `json:"id" validate:"required"` - - // The name for this network ACL. The name is unique across all network ACLs for the VPC. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalNetworkACLReference unmarshals an instance of NetworkACLReference from the specified map of raw messages. -func UnmarshalNetworkACLReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLReference) - 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, UnmarshalNetworkACLReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkACLReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkACLReferenceDeleted unmarshals an instance of NetworkACLReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkACLReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLReferenceDeleted) - 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 -} - -// NetworkACLRule : NetworkACLRule struct -// Models which "extend" this model: -// - NetworkACLRuleNetworkACLRuleProtocolTcpudp -// - NetworkACLRuleNetworkACLRuleProtocolIcmp -// - NetworkACLRuleNetworkACLRuleProtocolAll -type NetworkACLRule struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` - - // The ICMP traffic code to match. - // - // If absent, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The ICMP traffic type to match. - // - // If absent, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRule.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleActionAllowConst = "allow" - NetworkACLRuleActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRule.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleDirectionInboundConst = "inbound" - NetworkACLRuleDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRule.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRule.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleProtocolAllConst = "all" - NetworkACLRuleProtocolIcmpConst = "icmp" - NetworkACLRuleProtocolTCPConst = "tcp" - NetworkACLRuleProtocolUDPConst = "udp" -) - -func (*NetworkACLRule) isaNetworkACLRule() bool { - return true -} - -type NetworkACLRuleIntf interface { - isaNetworkACLRule() bool -} - -// UnmarshalNetworkACLRule unmarshals an instance of NetworkACLRule from the specified map of raw messages. -func UnmarshalNetworkACLRule(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) - if err != nil { - errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) - err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) - return - } - if discValue == "" { - err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) - return - } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolAll-error", common.GetComponentInfo()) - } - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolIcmp-error", common.GetComponentInfo()) - } - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo()) - } - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo()) - } - } else { - errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) - err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) - } - return -} - -// NetworkACLRuleBeforePatch : The rule to move this rule immediately before. -// -// Specify `null` to move this rule after all existing rules. -// Models which "extend" this model: -// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID -// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref -type NetworkACLRuleBeforePatch struct { - // The unique identifier for this network ACL rule. - ID *string `json:"id,omitempty"` - - // The URL for this network ACL rule. - Href *string `json:"href,omitempty"` -} - -func (*NetworkACLRuleBeforePatch) isaNetworkACLRuleBeforePatch() bool { - return true -} - -type NetworkACLRuleBeforePatchIntf interface { - isaNetworkACLRuleBeforePatch() bool -} - -// UnmarshalNetworkACLRuleBeforePatch unmarshals an instance of NetworkACLRuleBeforePatch from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePatch) - 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 -} - -// NetworkACLRuleBeforePrototype : The rule to insert this rule immediately before. -// -// If unspecified, this rule will be inserted after all existing rules. -// Models which "extend" this model: -// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID -// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref -type NetworkACLRuleBeforePrototype struct { - // The unique identifier for this network ACL rule. - ID *string `json:"id,omitempty"` - - // The URL for this network ACL rule. - Href *string `json:"href,omitempty"` -} - -func (*NetworkACLRuleBeforePrototype) isaNetworkACLRuleBeforePrototype() bool { - return true -} - -type NetworkACLRuleBeforePrototypeIntf interface { - isaNetworkACLRuleBeforePrototype() bool -} - -// UnmarshalNetworkACLRuleBeforePrototype unmarshals an instance of NetworkACLRuleBeforePrototype from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePrototype) - 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 -} - -// NetworkACLRuleCollection : NetworkACLRuleCollection struct -type NetworkACLRuleCollection struct { - // A link to the first page of resources. - First *NetworkACLRuleCollectionFirst `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"` - - // Ordered collection of network ACL rules. - Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalNetworkACLRuleCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) - if err != nil { - err = core.SDKErrorf(err, "", "rules-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 *NetworkACLRuleCollection) 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 -} - -// 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 -// - NetworkACLRuleItemNetworkACLRuleProtocolIcmp -// - NetworkACLRuleItemNetworkACLRuleProtocolAll -type NetworkACLRuleItem struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. In a rule collection, this always - // refers to the next item in the collection. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` - - // The ICMP traffic code to match. - // - // If absent, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The ICMP traffic type to match. - // - // If absent, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRuleItem.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleItemActionAllowConst = "allow" - NetworkACLRuleItemActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleItem.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleItemDirectionInboundConst = "inbound" - NetworkACLRuleItemDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleItem.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleItemIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleItem.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleItemProtocolAllConst = "all" - NetworkACLRuleItemProtocolIcmpConst = "icmp" - NetworkACLRuleItemProtocolTCPConst = "tcp" - NetworkACLRuleItemProtocolUDPConst = "udp" -) - -func (*NetworkACLRuleItem) isaNetworkACLRuleItem() bool { - return true -} - -type NetworkACLRuleItemIntf interface { - isaNetworkACLRuleItem() bool -} - -// UnmarshalNetworkACLRuleItem unmarshals an instance of NetworkACLRuleItem from the specified map of raw messages. -func UnmarshalNetworkACLRuleItem(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) - if err != nil { - errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) - err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) - return - } - if discValue == "" { - err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) - return - } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolAll-error", common.GetComponentInfo()) - } - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolIcmp-error", common.GetComponentInfo()) - } - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo()) - } - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRuleItemNetworkACLRuleProtocolTcpudp-error", common.GetComponentInfo()) - } - } else { - errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) - err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) - } - return -} - -// NetworkACLRulePatch : NetworkACLRulePatch struct -type NetworkACLRulePatch struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action,omitempty"` - - // The rule to move this rule immediately before. - // - // Specify `null` to move this rule after all existing rules. - Before NetworkACLRuleBeforePatchIntf `json:"before,omitempty"` - - // The ICMP traffic code to match. If set, `type` must also be set. - // - // Specify `null` to remove an existing ICMP traffic code. - Code *int64 `json:"code,omitempty"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination,omitempty"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The direction of traffic to match. - Direction *string `json:"direction,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. - Name *string `json:"name,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source,omitempty"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` - - // The ICMP traffic type to match. - // - // Specify `null` to remove an existing ICMP traffic type value. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRulePatch.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePatchActionAllowConst = "allow" - NetworkACLRulePatchActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePatch.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePatchDirectionInboundConst = "inbound" - NetworkACLRulePatchDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePatch.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePatchProtocolAllConst = "all" - NetworkACLRulePatchProtocolIcmpConst = "icmp" - NetworkACLRulePatchProtocolTCPConst = "tcp" - NetworkACLRulePatchProtocolUDPConst = "udp" -) - -// UnmarshalNetworkACLRulePatch unmarshals an instance of NetworkACLRulePatch from the specified map of raw messages. -func UnmarshalNetworkACLRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePatch) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePatch) - if err != nil { - err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) - if err != nil { - err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) - if err != nil { - err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) - if err != nil { - err = core.SDKErrorf(err, "", "destination_port_min-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-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, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "source", &obj.Source) - if err != nil { - err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) - if err != nil { - err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) - if err != nil { - err = core.SDKErrorf(err, "", "source_port_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 -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// NetworkACLRulePrototype : NetworkACLRulePrototype struct -// Models which "extend" this model: -// - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype -// - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype -// - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype -type NetworkACLRulePrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule to insert this rule immediately before. - // - // If unspecified, this rule will be inserted after all existing rules. - Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` - - // The ICMP traffic code to match. - // - // If specified, `type` must also be specified. If unspecified, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The ICMP traffic type to match. - // - // If unspecified, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRulePrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeProtocolAllConst = "all" - NetworkACLRulePrototypeProtocolIcmpConst = "icmp" - NetworkACLRulePrototypeProtocolTCPConst = "tcp" - NetworkACLRulePrototypeProtocolUDPConst = "udp" -) - -func (*NetworkACLRulePrototype) isaNetworkACLRulePrototype() bool { - return true -} - -type NetworkACLRulePrototypeIntf interface { - isaNetworkACLRulePrototype() bool -} - -// UnmarshalNetworkACLRulePrototype unmarshals an instance of NetworkACLRulePrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototype(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) - if err != nil { - errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) - err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) - return - } - if discValue == "" { - err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) - return - } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype-error", common.GetComponentInfo()) - } - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype-error", common.GetComponentInfo()) - } - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype-error", common.GetComponentInfo()) - } - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype-error", common.GetComponentInfo()) - } - } else { - errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) - err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) - } - return -} - -// NetworkACLRulePrototypeNetworkACLContext : NetworkACLRulePrototypeNetworkACLContext struct -// Models which "extend" this model: -// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype -// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype -// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype -type NetworkACLRulePrototypeNetworkACLContext struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` - - // The ICMP traffic code to match. - // - // If specified, `type` must also be specified. If unspecified, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The ICMP traffic type to match. - // - // If unspecified, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLContextActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLContextActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLContextDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLContextDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLContextIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLContextProtocolAllConst = "all" - NetworkACLRulePrototypeNetworkACLContextProtocolIcmpConst = "icmp" - NetworkACLRulePrototypeNetworkACLContextProtocolTCPConst = "tcp" - NetworkACLRulePrototypeNetworkACLContextProtocolUDPConst = "udp" -) - -func (*NetworkACLRulePrototypeNetworkACLContext) isaNetworkACLRulePrototypeNetworkACLContext() bool { - return true -} - -type NetworkACLRulePrototypeNetworkACLContextIntf interface { - isaNetworkACLRulePrototypeNetworkACLContext() bool -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLContext unmarshals an instance of NetworkACLRulePrototypeNetworkACLContext from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLContext(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) - if err != nil { - errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) - err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) - return - } - if discValue == "" { - err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) - return - } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype-error", common.GetComponentInfo()) - } - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype-error", common.GetComponentInfo()) - } - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype-error", common.GetComponentInfo()) - } - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype-error", common.GetComponentInfo()) - } - } else { - errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) - err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) - } - return -} - -// NetworkACLRuleReference : NetworkACLRuleReference struct -type NetworkACLRuleReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkACLRuleReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalNetworkACLRuleReference unmarshals an instance of NetworkACLRuleReference from the specified map of raw messages. -func UnmarshalNetworkACLRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLRuleReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkACLRuleReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkACLRuleReferenceDeleted unmarshals an instance of NetworkACLRuleReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleReferenceDeleted) - 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 -} - -// NetworkInterface : NetworkInterface struct -type NetworkInterface struct { - // Indicates whether source IP spoofing is allowed on this instance network interface. - // - // If this instance 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 instance network interface was created. - // - // If this instance 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"` - - // The floating IPs associated with this instance network interface. - // - // If this instance 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 instance network interface. - // - // If this instance 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 instance network interface. - // - // If this instance 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 name for this instance network interface. - // - // If this instance 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 instance network interface port speed in Mbps. - // - // If this instance 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 instance network interface. - // - // If this instance 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 instance network interface. - // - // If this instance 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 instance network interface type. - // - // If this instance 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"` -} - -// Constants associated with the NetworkInterface.ResourceType property. -// The resource type. -const ( - NetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" -) - -// Constants associated with the NetworkInterface.Status property. -// The status of the instance network interface. -// -// If this instance 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 ( - NetworkInterfaceStatusAvailableConst = "available" - NetworkInterfaceStatusDeletingConst = "deleting" - NetworkInterfaceStatusFailedConst = "failed" - NetworkInterfaceStatusPendingConst = "pending" -) - -// Constants associated with the NetworkInterface.Type property. -// The instance network interface type. -// -// If this instance 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 ( - NetworkInterfaceTypePrimaryConst = "primary" - NetworkInterfaceTypeSecondaryConst = "secondary" -) - -// UnmarshalNetworkInterface unmarshals an instance of NetworkInterface from the specified map of raw messages. -func UnmarshalNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterface) - 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, "created_at", &obj.CreatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "floating_ips-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, "port_speed", &obj.PortSpeed) - if err != nil { - err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "resource_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-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 -} - -// NetworkInterfaceBareMetalServerContextReference : NetworkInterfaceBareMetalServerContextReference struct -type NetworkInterfaceBareMetalServerContextReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceBareMetalServerContextReferenceDeleted `json:"deleted,omitempty"` - - // 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 name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the NetworkInterfaceBareMetalServerContextReference.ResourceType property. -// The resource type. -const ( - NetworkInterfaceBareMetalServerContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" -) - -// UnmarshalNetworkInterfaceBareMetalServerContextReference unmarshals an instance of NetworkInterfaceBareMetalServerContextReference from the specified map of raw messages. -func UnmarshalNetworkInterfaceBareMetalServerContextReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceBareMetalServerContextReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted) - 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceBareMetalServerContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceBareMetalServerContextReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted unmarshals an instance of NetworkInterfaceBareMetalServerContextReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceBareMetalServerContextReferenceDeleted) - 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 -} - -// NetworkInterfaceIPPrototype : NetworkInterfaceIPPrototype struct -// Models which "extend" this model: -// - NetworkInterfaceIPPrototypeReservedIPIdentity -// - NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext -type NetworkInterfaceIPPrototype struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` - - // 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 reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*NetworkInterfaceIPPrototype) isaNetworkInterfaceIPPrototype() bool { - return true -} - -type NetworkInterfaceIPPrototypeIntf interface { - isaNetworkInterfaceIPPrototype() bool -} - -// UnmarshalNetworkInterfaceIPPrototype unmarshals an instance of NetworkInterfaceIPPrototype from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototype) - 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 - } - 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 -} - -// NetworkInterfaceInstanceContextReference : NetworkInterfaceInstanceContextReference struct -type NetworkInterfaceInstanceContextReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceInstanceContextReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - // - // If this instance 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 instance network interface. - // - // If this instance 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 name for this instance network interface. - Name *string `json:"name" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the NetworkInterfaceInstanceContextReference.ResourceType property. -// The resource type. -const ( - NetworkInterfaceInstanceContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" -) - -// UnmarshalNetworkInterfaceInstanceContextReference unmarshals an instance of NetworkInterfaceInstanceContextReference from the specified map of raw messages. -func UnmarshalNetworkInterfaceInstanceContextReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceInstanceContextReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceInstanceContextReferenceDeleted) - 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceInstanceContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceInstanceContextReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkInterfaceInstanceContextReferenceDeleted unmarshals an instance of NetworkInterfaceInstanceContextReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceInstanceContextReferenceDeleted) - 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 -} - -// NetworkInterfacePatch : NetworkInterfacePatch struct -type NetworkInterfacePatch struct { - // Indicates whether source IP spoofing is allowed on this instance network interface. - // - // If this instance 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 name for the instance network interface. The name must not be used by another network interface on the virtual - // server instance. - Name *string `json:"name,omitempty"` -} - -// UnmarshalNetworkInterfacePatch unmarshals an instance of NetworkInterfacePatch from the specified map of raw messages. -func UnmarshalNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfacePatch) - 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, "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 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// NetworkInterfacePrototype : NetworkInterfacePrototype struct -type NetworkInterfacePrototype struct { - // Indicates whether source IP spoofing is allowed on this instance network interface. - // - // If this instance 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 name for the instance network interface. The name must not be used by another network interface on the virtual - // server instance. 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 instance 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 instance 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 instance 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"` -} - -// NewNetworkInterfacePrototype : Instantiate NetworkInterfacePrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkInterfacePrototype(subnet SubnetIdentityIntf) (_model *NetworkInterfacePrototype, err error) { - _model = &NetworkInterfacePrototype{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalNetworkInterfacePrototype unmarshals an instance of NetworkInterfacePrototype from the specified map of raw messages. -func UnmarshalNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfacePrototype) - 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, "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 -} - -// NetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkInterfaceReferenceDeleted unmarshals an instance of NetworkInterfaceReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceReferenceDeleted) - 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 -} - -// NetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceReferenceTargetContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of NetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceReferenceTargetContextDeleted) - 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 -} - -// NetworkInterfaceUnpaginatedCollection : NetworkInterfaceUnpaginatedCollection struct -type NetworkInterfaceUnpaginatedCollection struct { - // Collection of instance network interfaces. - NetworkInterfaces []NetworkInterface `json:"network_interfaces" validate:"required"` -} - -// UnmarshalNetworkInterfaceUnpaginatedCollection unmarshals an instance of NetworkInterfaceUnpaginatedCollection from the specified map of raw messages. -func UnmarshalNetworkInterfaceUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceUnpaginatedCollection) - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ObsoleteImageOptions : The ObsoleteImage options. -type ObsoleteImageOptions struct { - // The image identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewObsoleteImageOptions : Instantiate ObsoleteImageOptions -func (*VpcV1) NewObsoleteImageOptions(id string) *ObsoleteImageOptions { - return &ObsoleteImageOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *ObsoleteImageOptions) SetID(id string) *ObsoleteImageOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ObsoleteImageOptions) SetHeaders(param map[string]string) *ObsoleteImageOptions { - options.Headers = param - return options -} - -// OperatingSystem : OperatingSystem struct -type OperatingSystem struct { - // The operating system architecture. - Architecture *string `json:"architecture" validate:"required"` - - // Images with this operating system can only be used on dedicated hosts or dedicated host groups. - DedicatedHostOnly *bool `json:"dedicated_host_only" validate:"required"` - - // A unique, display-friendly name for the operating system. - DisplayName *string `json:"display_name" validate:"required"` - - // The software family for this operating system. - Family *string `json:"family" validate:"required"` - - // The URL for this operating system. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this operating system. - Name *string `json:"name" validate:"required"` - - // The vendor of the operating system. - Vendor *string `json:"vendor" validate:"required"` - - // The major release version of this operating system. - Version *string `json:"version" validate:"required"` -} - -// UnmarshalOperatingSystem unmarshals an instance of OperatingSystem from the specified map of raw messages. -func UnmarshalOperatingSystem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystem) - err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) - if err != nil { - err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "dedicated_host_only", &obj.DedicatedHostOnly) - if err != nil { - err = core.SDKErrorf(err, "", "dedicated_host_only-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) - if err != nil { - err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - err = core.SDKErrorf(err, "", "family-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, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "vendor", &obj.Vendor) - if err != nil { - err = core.SDKErrorf(err, "", "vendor-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "version", &obj.Version) - if err != nil { - err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// OperatingSystemCollection : OperatingSystemCollection struct -type OperatingSystemCollection struct { - // A link to the first page of resources. - First *OperatingSystemCollectionFirst `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"` - - // Collection of operating systems. - OperatingSystems []OperatingSystem `json:"operating_systems" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalOperatingSystemCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "operating_systems", &obj.OperatingSystems, UnmarshalOperatingSystem) - if err != nil { - err = core.SDKErrorf(err, "", "operating_systems-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 *OperatingSystemCollection) 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 -} - -// 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 -// - OperatingSystemIdentityByHref -type OperatingSystemIdentity struct { - // The globally unique name for this operating system. - Name *string `json:"name,omitempty"` - - // The URL for this operating system. - Href *string `json:"href,omitempty"` -} - -func (*OperatingSystemIdentity) isaOperatingSystemIdentity() bool { - return true -} - -type OperatingSystemIdentityIntf interface { - isaOperatingSystemIdentity() bool -} - -// UnmarshalOperatingSystemIdentity unmarshals an instance of OperatingSystemIdentity from the specified map of raw messages. -func UnmarshalOperatingSystemIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemIdentity) - 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 -} - -// PlacementGroup : PlacementGroup struct -type PlacementGroup struct { - // The date and time that the placement group was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this placement group. - CRN *string `json:"crn" validate:"required"` - - // The URL for this placement group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this placement group. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the placement group. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this placement group. The name is unique across all placement groups in the region. - Name *string `json:"name" validate:"required"` - - // The resource group for this placement group. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The strategy for this placement group: - // - `host_spread`: place on different compute hosts - // - `power_spread`: place on compute hosts that use different power sources - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Strategy *string `json:"strategy" validate:"required"` -} - -// Constants associated with the PlacementGroup.LifecycleState property. -// The lifecycle state of the placement group. -const ( - PlacementGroupLifecycleStateDeletingConst = "deleting" - PlacementGroupLifecycleStateFailedConst = "failed" - PlacementGroupLifecycleStatePendingConst = "pending" - PlacementGroupLifecycleStateStableConst = "stable" - PlacementGroupLifecycleStateSuspendedConst = "suspended" - PlacementGroupLifecycleStateUpdatingConst = "updating" - PlacementGroupLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the PlacementGroup.ResourceType property. -// The resource type. -const ( - PlacementGroupResourceTypePlacementGroupConst = "placement_group" -) - -// Constants associated with the PlacementGroup.Strategy property. -// The strategy for this placement group: -// - `host_spread`: place on different compute hosts -// - `power_spread`: place on compute hosts that use different power sources -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - PlacementGroupStrategyHostSpreadConst = "host_spread" - PlacementGroupStrategyPowerSpreadConst = "power_spread" -) - -// UnmarshalPlacementGroup unmarshals an instance of PlacementGroup from the specified map of raw messages. -func UnmarshalPlacementGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroup) - 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.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, "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.UnmarshalPrimitive(m, "strategy", &obj.Strategy) - if err != nil { - err = core.SDKErrorf(err, "", "strategy-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PlacementGroupCollection : PlacementGroupCollection struct -type PlacementGroupCollection struct { - // A link to the first page of resources. - First *PlacementGroupCollectionFirst `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"` - - // Collection of placement groups. - PlacementGroups []PlacementGroup `json:"placement_groups" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalPlacementGroupCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "placement_groups", &obj.PlacementGroups, UnmarshalPlacementGroup) - if err != nil { - err = core.SDKErrorf(err, "", "placement_groups-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 *PlacementGroupCollection) 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 -} - -// 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. - Name *string `json:"name,omitempty"` -} - -// UnmarshalPlacementGroupPatch unmarshals an instance of PlacementGroupPatch from the specified map of raw messages. -func UnmarshalPlacementGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroupPatch) - 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 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()) - } - return -} - -// PlacementGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type PlacementGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalPlacementGroupReferenceDeleted unmarshals an instance of PlacementGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalPlacementGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroupReferenceDeleted) - 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 -} - -// PublicGateway : PublicGateway struct -type PublicGateway struct { - // The date and time that the public gateway was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this public gateway. - CRN *string `json:"crn" validate:"required"` - - // The floating IP bound to this public gateway. - FloatingIP *PublicGatewayFloatingIP `json:"floating_ip" validate:"required"` - - // The URL for this public gateway. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this public gateway. - ID *string `json:"id" validate:"required"` - - // The name for this public gateway. The name is unique across all public gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this public gateway. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of this public gateway. - Status *string `json:"status" validate:"required"` - - // The VPC this public gateway resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // The zone this public gateway resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the PublicGateway.ResourceType property. -// The resource type. -const ( - PublicGatewayResourceTypePublicGatewayConst = "public_gateway" -) - -// Constants associated with the PublicGateway.Status property. -// The status of this public gateway. -const ( - PublicGatewayStatusAvailableConst = "available" - PublicGatewayStatusDeletingConst = "deleting" - PublicGatewayStatusFailedConst = "failed" - PublicGatewayStatusPendingConst = "pending" -) - -// UnmarshalPublicGateway unmarshals an instance of PublicGateway from the specified map of raw messages. -func UnmarshalPublicGateway(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGateway) - 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, "floating_ip", &obj.FloatingIP, UnmarshalPublicGatewayFloatingIP) - if err != nil { - err = core.SDKErrorf(err, "", "floating_ip-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, "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.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-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 -} - -// PublicGatewayCollection : PublicGatewayCollection struct -type PublicGatewayCollection struct { - // A link to the first page of resources. - First *PublicGatewayCollectionFirst `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"` - - // Collection of public gateways. - PublicGateways []PublicGateway `json:"public_gateways" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalPublicGatewayCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "public_gateways", &obj.PublicGateways, UnmarshalPublicGateway) - if err != nil { - err = core.SDKErrorf(err, "", "public_gateways-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 *PublicGatewayCollection) 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 -} - -// 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. - Address *string `json:"address" validate:"required"` - - // The CRN for this floating IP. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this floating IP. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this floating IP. - ID *string `json:"id" validate:"required"` - - // The name for this floating IP. The name is unique across all floating IPs in the region. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalPublicGatewayFloatingIP unmarshals an instance of PublicGatewayFloatingIP from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-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, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayFloatingIPPrototype : PublicGatewayFloatingIPPrototype struct -// Models which "extend" this model: -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentity -// - PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext -type PublicGatewayFloatingIPPrototype struct { - // The unique identifier for this floating IP. - ID *string `json:"id,omitempty"` - - // The CRN for this floating IP. - CRN *string `json:"crn,omitempty"` - - // The URL for this floating IP. - Href *string `json:"href,omitempty"` - - // The globally unique IP address. - Address *string `json:"address,omitempty"` - - // The name for this floating IP. The name must not be used by another floating IP in the region. 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"` -} - -func (*PublicGatewayFloatingIPPrototype) isaPublicGatewayFloatingIPPrototype() bool { - return true -} - -type PublicGatewayFloatingIPPrototypeIntf interface { - isaPublicGatewayFloatingIPPrototype() bool -} - -// UnmarshalPublicGatewayFloatingIPPrototype unmarshals an instance of PublicGatewayFloatingIPPrototype from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayIdentity : Identifies a public gateway by a unique property. -// Models which "extend" this model: -// - PublicGatewayIdentityPublicGatewayIdentityByID -// - PublicGatewayIdentityPublicGatewayIdentityByCRN -// - PublicGatewayIdentityPublicGatewayIdentityByHref -type PublicGatewayIdentity struct { - // The unique identifier for this public gateway. - ID *string `json:"id,omitempty"` - - // The CRN for this public gateway. - CRN *string `json:"crn,omitempty"` - - // The URL for this public gateway. - Href *string `json:"href,omitempty"` -} - -func (*PublicGatewayIdentity) isaPublicGatewayIdentity() bool { - return true -} - -type PublicGatewayIdentityIntf interface { - isaPublicGatewayIdentity() bool -} - -// UnmarshalPublicGatewayIdentity unmarshals an instance of PublicGatewayIdentity from the specified map of raw messages. -func UnmarshalPublicGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayPatch : PublicGatewayPatch struct -type PublicGatewayPatch struct { - // The name for this public gateway. The name must not be used by another public gateway in the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalPublicGatewayPatch unmarshals an instance of PublicGatewayPatch from the specified map of raw messages. -func UnmarshalPublicGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayPatch) - 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 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()) - } - return -} - -// PublicGatewayReference : PublicGatewayReference struct -type PublicGatewayReference struct { - // The CRN for this public gateway. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this public gateway. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this public gateway. - ID *string `json:"id" validate:"required"` - - // The name for this public gateway. The name is unique across all public gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the PublicGatewayReference.ResourceType property. -// The resource type. -const ( - PublicGatewayReferenceResourceTypePublicGatewayConst = "public_gateway" -) - -// UnmarshalPublicGatewayReference unmarshals an instance of PublicGatewayReference from the specified map of raw messages. -func UnmarshalPublicGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayReference) - 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, UnmarshalPublicGatewayReferenceDeleted) - 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 -} - -// PublicGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type PublicGatewayReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalPublicGatewayReferenceDeleted unmarshals an instance of PublicGatewayReferenceDeleted from the specified map of raw messages. -func UnmarshalPublicGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayReferenceDeleted) - 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 -} - -// Region : Region struct -type Region struct { - // The API endpoint for this region. - Endpoint *string `json:"endpoint" validate:"required"` - - // The URL for this region. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this region. - Name *string `json:"name" validate:"required"` - - // The availability status of this region. - Status *string `json:"status" validate:"required"` -} - -// Constants associated with the Region.Status property. -// The availability status of this region. -const ( - RegionStatusAvailableConst = "available" - RegionStatusUnavailableConst = "unavailable" -) - -// UnmarshalRegion unmarshals an instance of Region from the specified map of raw messages. -func UnmarshalRegion(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Region) - err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) - if err != nil { - err = core.SDKErrorf(err, "", "endpoint-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, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RegionCollection : RegionCollection struct -type RegionCollection struct { - // Collection of regions. - Regions []Region `json:"regions" validate:"required"` -} - -// UnmarshalRegionCollection unmarshals an instance of RegionCollection from the specified map of raw messages. -func UnmarshalRegionCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionCollection) - err = core.UnmarshalModel(m, "regions", &obj.Regions, UnmarshalRegion) - if err != nil { - err = core.SDKErrorf(err, "", "regions-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RegionIdentity : Identifies a region by a unique property. -// Models which "extend" this model: -// - RegionIdentityByName -// - RegionIdentityByHref -type RegionIdentity struct { - // The globally unique name for this region. - Name *string `json:"name,omitempty"` - - // The URL for this region. - Href *string `json:"href,omitempty"` -} - -func (*RegionIdentity) isaRegionIdentity() bool { - return true -} - -type RegionIdentityIntf interface { - isaRegionIdentity() bool -} - -// UnmarshalRegionIdentity unmarshals an instance of RegionIdentity from the specified map of raw messages. -func UnmarshalRegionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionIdentity) - 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 -} - -// RegionReference : RegionReference struct -type RegionReference struct { - // The URL for this region. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this region. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalRegionReference unmarshals an instance of RegionReference from the specified map of raw messages. -func UnmarshalRegionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-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 -} - -// RemoveBareMetalServerNetworkInterfaceFloatingIPOptions : The RemoveBareMetalServerNetworkInterfaceFloatingIP options. -type RemoveBareMetalServerNetworkInterfaceFloatingIPOptions 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 -} - -// NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate RemoveBareMetalServerNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewRemoveBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { - return &RemoveBareMetalServerNetworkInterfaceFloatingIPOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} - -// RemoveEndpointGatewayIPOptions : The RemoveEndpointGatewayIP options. -type RemoveEndpointGatewayIPOptions 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 -} - -// NewRemoveEndpointGatewayIPOptions : Instantiate RemoveEndpointGatewayIPOptions -func (*VpcV1) NewRemoveEndpointGatewayIPOptions(endpointGatewayID string, id string) *RemoveEndpointGatewayIPOptions { - return &RemoveEndpointGatewayIPOptions{ - EndpointGatewayID: core.StringPtr(endpointGatewayID), - ID: core.StringPtr(id), - } -} - -// SetEndpointGatewayID : Allow user to set EndpointGatewayID -func (_options *RemoveEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *RemoveEndpointGatewayIPOptions { - _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *RemoveEndpointGatewayIPOptions) SetID(id string) *RemoveEndpointGatewayIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveEndpointGatewayIPOptions) SetHeaders(param map[string]string) *RemoveEndpointGatewayIPOptions { - options.Headers = param - return options -} - -// RemoveInstanceNetworkInterfaceFloatingIPOptions : The RemoveInstanceNetworkInterfaceFloatingIP options. -type RemoveInstanceNetworkInterfaceFloatingIPOptions 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 -} - -// NewRemoveInstanceNetworkInterfaceFloatingIPOptions : Instantiate RemoveInstanceNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewRemoveInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - return &RemoveInstanceNetworkInterfaceFloatingIPOptions{ - InstanceID: core.StringPtr(instanceID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} - -// RemoveNetworkInterfaceFloatingIPOptions : The RemoveNetworkInterfaceFloatingIP options. -type RemoveNetworkInterfaceFloatingIPOptions 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 -} - -// NewRemoveNetworkInterfaceFloatingIPOptions : Instantiate RemoveNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewRemoveNetworkInterfaceFloatingIPOptions(virtualNetworkInterfaceID string, id string) *RemoveNetworkInterfaceFloatingIPOptions { - return &RemoveNetworkInterfaceFloatingIPOptions{ - VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID -func (_options *RemoveNetworkInterfaceFloatingIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *RemoveNetworkInterfaceFloatingIPOptions { - _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *RemoveNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} - -// RemoveVirtualNetworkInterfaceIPOptions : The RemoveVirtualNetworkInterfaceIP options. -type RemoveVirtualNetworkInterfaceIPOptions 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 -} - -// NewRemoveVirtualNetworkInterfaceIPOptions : Instantiate RemoveVirtualNetworkInterfaceIPOptions -func (*VpcV1) NewRemoveVirtualNetworkInterfaceIPOptions(virtualNetworkInterfaceID string, id string) *RemoveVirtualNetworkInterfaceIPOptions { - return &RemoveVirtualNetworkInterfaceIPOptions{ - VirtualNetworkInterfaceID: core.StringPtr(virtualNetworkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetVirtualNetworkInterfaceID : Allow user to set VirtualNetworkInterfaceID -func (_options *RemoveVirtualNetworkInterfaceIPOptions) SetVirtualNetworkInterfaceID(virtualNetworkInterfaceID string) *RemoveVirtualNetworkInterfaceIPOptions { - _options.VirtualNetworkInterfaceID = core.StringPtr(virtualNetworkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *RemoveVirtualNetworkInterfaceIPOptions) SetID(id string) *RemoveVirtualNetworkInterfaceIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *RemoveVirtualNetworkInterfaceIPOptions { - options.Headers = param - return options -} - -// RemoveVPNGatewayConnectionsLocalCIDROptions : The RemoveVPNGatewayConnectionsLocalCIDR options. -type RemoveVPNGatewayConnectionsLocalCIDROptions 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 -} - -// NewRemoveVPNGatewayConnectionsLocalCIDROptions : Instantiate RemoveVPNGatewayConnectionsLocalCIDROptions -func (*VpcV1) NewRemoveVPNGatewayConnectionsLocalCIDROptions(vpnGatewayID string, id string, cidr string) *RemoveVPNGatewayConnectionsLocalCIDROptions { - return &RemoveVPNGatewayConnectionsLocalCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDR: core.StringPtr(cidr), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionsLocalCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionsLocalCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetCIDR : Allow user to set CIDR -func (_options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetCIDR(cidr string) *RemoveVPNGatewayConnectionsLocalCIDROptions { - _options.CIDR = core.StringPtr(cidr) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionsLocalCIDROptions { - options.Headers = param - return options -} - -// RemoveVPNGatewayConnectionsPeerCIDROptions : The RemoveVPNGatewayConnectionsPeerCIDR options. -type RemoveVPNGatewayConnectionsPeerCIDROptions 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 -} - -// NewRemoveVPNGatewayConnectionsPeerCIDROptions : Instantiate RemoveVPNGatewayConnectionsPeerCIDROptions -func (*VpcV1) NewRemoveVPNGatewayConnectionsPeerCIDROptions(vpnGatewayID string, id string, cidr string) *RemoveVPNGatewayConnectionsPeerCIDROptions { - return &RemoveVPNGatewayConnectionsPeerCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDR: core.StringPtr(cidr), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionsPeerCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionsPeerCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetCIDR : Allow user to set CIDR -func (_options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetCIDR(cidr string) *RemoveVPNGatewayConnectionsPeerCIDROptions { - _options.CIDR = core.StringPtr(cidr) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionsPeerCIDROptions { - options.Headers = param - return options -} - -// ReplaceLoadBalancerPoolMembersOptions : The ReplaceLoadBalancerPoolMembers options. -type ReplaceLoadBalancerPoolMembersOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - PoolID *string `json:"pool_id" validate:"required,ne="` - - // The member prototype objects for this pool. - Members []LoadBalancerPoolMemberPrototype `json:"members" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewReplaceLoadBalancerPoolMembersOptions : Instantiate ReplaceLoadBalancerPoolMembersOptions -func (*VpcV1) NewReplaceLoadBalancerPoolMembersOptions(loadBalancerID string, poolID string, members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { - return &ReplaceLoadBalancerPoolMembersOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - PoolID: core.StringPtr(poolID), - Members: members, - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *ReplaceLoadBalancerPoolMembersOptions) SetLoadBalancerID(loadBalancerID string) *ReplaceLoadBalancerPoolMembersOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetPoolID : Allow user to set PoolID -func (_options *ReplaceLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *ReplaceLoadBalancerPoolMembersOptions { - _options.PoolID = core.StringPtr(poolID) - return _options -} - -// SetMembers : Allow user to set Members -func (_options *ReplaceLoadBalancerPoolMembersOptions) SetMembers(members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { - _options.Members = members - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ReplaceLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ReplaceLoadBalancerPoolMembersOptions { - options.Headers = param - return options -} - -// ReplaceSubnetNetworkACLOptions : The ReplaceSubnetNetworkACL options. -type ReplaceSubnetNetworkACLOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // The network ACL identity. - NetworkACLIdentity NetworkACLIdentityIntf `json:"NetworkACLIdentity" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewReplaceSubnetNetworkACLOptions : Instantiate ReplaceSubnetNetworkACLOptions -func (*VpcV1) NewReplaceSubnetNetworkACLOptions(id string, networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { - return &ReplaceSubnetNetworkACLOptions{ - ID: core.StringPtr(id), - NetworkACLIdentity: networkACLIdentity, - } -} - -// SetID : Allow user to set ID -func (_options *ReplaceSubnetNetworkACLOptions) SetID(id string) *ReplaceSubnetNetworkACLOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetNetworkACLIdentity : Allow user to set NetworkACLIdentity -func (_options *ReplaceSubnetNetworkACLOptions) SetNetworkACLIdentity(networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { - _options.NetworkACLIdentity = networkACLIdentity - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ReplaceSubnetNetworkACLOptions) SetHeaders(param map[string]string) *ReplaceSubnetNetworkACLOptions { - options.Headers = param - return options -} - -// ReplaceSubnetRoutingTableOptions : The ReplaceSubnetRoutingTable options. -type ReplaceSubnetRoutingTableOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // The routing table identity. - RoutingTableIdentity RoutingTableIdentityIntf `json:"RoutingTableIdentity" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewReplaceSubnetRoutingTableOptions : Instantiate ReplaceSubnetRoutingTableOptions -func (*VpcV1) NewReplaceSubnetRoutingTableOptions(id string, routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { - return &ReplaceSubnetRoutingTableOptions{ - ID: core.StringPtr(id), - RoutingTableIdentity: routingTableIdentity, - } -} - -// SetID : Allow user to set ID -func (_options *ReplaceSubnetRoutingTableOptions) SetID(id string) *ReplaceSubnetRoutingTableOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetRoutingTableIdentity : Allow user to set RoutingTableIdentity -func (_options *ReplaceSubnetRoutingTableOptions) SetRoutingTableIdentity(routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { - _options.RoutingTableIdentity = routingTableIdentity - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ReplaceSubnetRoutingTableOptions) SetHeaders(param map[string]string) *ReplaceSubnetRoutingTableOptions { - options.Headers = param - return options -} - -// Reservation : Reservation struct -type Reservation struct { - // The affinity policy to use for this reservation: - // - `restricted`: The reservation must be manually requested - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - AffinityPolicy *string `json:"affinity_policy" validate:"required"` - - // The capacity configuration for this reservation - // - // If absent, this reservation has no assigned capacity. - Capacity *ReservationCapacity `json:"capacity,omitempty"` - - // The committed use configuration for this reservation. - // - // If absent, this reservation has no commitment for use. - CommittedUse *ReservationCommittedUse `json:"committed_use,omitempty"` - - // The date and time that the reservation was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this reservation. - CRN *string `json:"crn" validate:"required"` - - // The URL for this reservation. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this reservation. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of this reservation. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this reservation. The name is unique across all reservations in the region. - Name *string `json:"name" validate:"required"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this reservation. - Profile *ReservationProfile `json:"profile" validate:"required"` - - // The resource group for this reservation. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the reservation. - // - // 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 []ReservationStatusReason `json:"status_reasons" validate:"required"` - - // The zone for this reservation. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the Reservation.AffinityPolicy property. -// The affinity policy to use for this reservation: -// - `restricted`: The reservation must be manually requested -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ReservationAffinityPolicyRestrictedConst = "restricted" -) - -// Constants associated with the Reservation.LifecycleState property. -// The lifecycle state of this reservation. -const ( - ReservationLifecycleStateDeletingConst = "deleting" - ReservationLifecycleStateFailedConst = "failed" - ReservationLifecycleStatePendingConst = "pending" - ReservationLifecycleStateStableConst = "stable" - ReservationLifecycleStateSuspendedConst = "suspended" - ReservationLifecycleStateUpdatingConst = "updating" - ReservationLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the Reservation.ResourceType property. -// The resource type. -const ( - ReservationResourceTypeReservationConst = "reservation" -) - -// Constants associated with the Reservation.Status property. -// The status of the reservation. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ReservationStatusActivatingConst = "activating" - ReservationStatusActiveConst = "active" - ReservationStatusDeactivatingConst = "deactivating" - ReservationStatusExpiredConst = "expired" - ReservationStatusFailedConst = "failed" - ReservationStatusInactiveConst = "inactive" -) - -// UnmarshalReservation unmarshals an instance of Reservation from the specified map of raw messages. -func UnmarshalReservation(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Reservation) - err = core.UnmarshalPrimitive(m, "affinity_policy", &obj.AffinityPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "affinity_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalReservationCapacity) - if err != nil { - err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "committed_use", &obj.CommittedUse, UnmarshalReservationCommittedUse) - if err != nil { - err = core.SDKErrorf(err, "", "committed_use-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-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, "profile", &obj.Profile, UnmarshalReservationProfile) - if err != nil { - err = core.SDKErrorf(err, "", "profile-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.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, UnmarshalReservationStatusReason) - if err != nil { - err = core.SDKErrorf(err, "", "status_reasons-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 -} - -// ReservationCapacity : The capacity configuration for this reservation -// -// If absent, this reservation has no assigned capacity. -type ReservationCapacity struct { - // The amount allocated to this capacity reservation. - Allocated *int64 `json:"allocated" validate:"required"` - - // The amount of this capacity reservation available for new attachments. - Available *int64 `json:"available" validate:"required"` - - // The status of the capacity reservation: - // - `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. - // - `unallocated`: The capacity reservation is not allocated for use - // - // 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 total amount of this capacity reservation. - Total *int64 `json:"total" validate:"required"` - - // The amount of this capacity reservation used by existing attachments. - Used *int64 `json:"used" validate:"required"` -} - -// Constants associated with the ReservationCapacity.Status property. -// The status of the capacity reservation: -// - `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. -// - `unallocated`: The capacity reservation is not allocated for use -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ReservationCapacityStatusAllocatedConst = "allocated" - ReservationCapacityStatusAllocatingConst = "allocating" - ReservationCapacityStatusDegradedConst = "degraded" - ReservationCapacityStatusUnallocatedConst = "unallocated" -) - -// UnmarshalReservationCapacity unmarshals an instance of ReservationCapacity from the specified map of raw messages. -func UnmarshalReservationCapacity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationCapacity) - err = core.UnmarshalPrimitive(m, "allocated", &obj.Allocated) - if err != nil { - err = core.SDKErrorf(err, "", "allocated-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "available", &obj.Available) - if err != nil { - err = core.SDKErrorf(err, "", "available-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.UnmarshalPrimitive(m, "total", &obj.Total) - if err != nil { - err = core.SDKErrorf(err, "", "total-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "used", &obj.Used) - if err != nil { - err = core.SDKErrorf(err, "", "used-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservationCapacityPatch : The capacity reservation configuration to use. -// -// The configuration can only be changed for reservations with a `status` of `inactive`. -type ReservationCapacityPatch struct { - // The total amount to use for this capacity reservation. - Total *int64 `json:"total,omitempty"` -} - -// UnmarshalReservationCapacityPatch unmarshals an instance of ReservationCapacityPatch from the specified map of raw messages. -func UnmarshalReservationCapacityPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationCapacityPatch) - err = core.UnmarshalPrimitive(m, "total", &obj.Total) - if err != nil { - err = core.SDKErrorf(err, "", "total-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservationCapacityPrototype : The capacity reservation configuration to use. -type ReservationCapacityPrototype struct { - // The total amount to use for this capacity reservation. - Total *int64 `json:"total" validate:"required"` -} - -// NewReservationCapacityPrototype : Instantiate ReservationCapacityPrototype (Generic Model Constructor) -func (*VpcV1) NewReservationCapacityPrototype(total int64) (_model *ReservationCapacityPrototype, err error) { - _model = &ReservationCapacityPrototype{ - Total: core.Int64Ptr(total), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalReservationCapacityPrototype unmarshals an instance of ReservationCapacityPrototype from the specified map of raw messages. -func UnmarshalReservationCapacityPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationCapacityPrototype) - err = core.UnmarshalPrimitive(m, "total", &obj.Total) - if err != nil { - err = core.SDKErrorf(err, "", "total-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservationCollection : ReservationCollection struct -type ReservationCollection struct { - // A link to the first page of resources. - First *ReservationCollectionFirst `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"` - - // Collection of reservations. - Reservations []Reservation `json:"reservations" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalReservationCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservations", &obj.Reservations, UnmarshalReservation) - if err != nil { - err = core.SDKErrorf(err, "", "reservations-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 *ReservationCollection) 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 -} - -// 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. - ExpirationAt *strfmt.DateTime `json:"expiration_at" validate:"required"` - - // The policy to apply when the committed use term expires: - // - `release`: Release any available capacity and let the reservation expire. - // - `renew`: Renew for another term, provided the term remains listed in the - // `reservation_terms` for the profile. Otherwise, let the reservation expire. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - ExpirationPolicy *string `json:"expiration_policy" validate:"required"` - - // The term for this committed use reservation: - // - `one_year`: 1 year - // - `three_year`: 3 years - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Term *string `json:"term" validate:"required"` -} - -// Constants associated with the ReservationCommittedUse.ExpirationPolicy property. -// The policy to apply when the committed use term expires: -// - `release`: Release any available capacity and let the reservation expire. -// - `renew`: Renew for another term, provided the term remains listed in the -// `reservation_terms` for the profile. Otherwise, let the reservation expire. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ReservationCommittedUseExpirationPolicyReleaseConst = "release" - ReservationCommittedUseExpirationPolicyRenewConst = "renew" -) - -// UnmarshalReservationCommittedUse unmarshals an instance of ReservationCommittedUse from the specified map of raw messages. -func UnmarshalReservationCommittedUse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationCommittedUse) - err = core.UnmarshalPrimitive(m, "expiration_at", &obj.ExpirationAt) - if err != nil { - err = core.SDKErrorf(err, "", "expiration_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "expiration_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "term", &obj.Term) - if err != nil { - err = core.SDKErrorf(err, "", "term-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservationCommittedUsePatch : ReservationCommittedUsePatch struct -type ReservationCommittedUsePatch struct { - // The policy to apply when the committed use term expires: - // - `release`: Release any available capacity and let the reservation expire. - // - `renew`: Renew for another term, provided the term remains listed in the - // `reservation_terms` for the profile. Otherwise, let the reservation expire. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - ExpirationPolicy *string `json:"expiration_policy,omitempty"` - - // The term for this committed use reservation: - // - `one_year`: 1 year - // - `three_year`: 3 years - // - // The specified value must be listed in the `reservation_terms` in the profile for this reservation. The term can only - // be changed for a reservation with a `status` of - // `inactive`. - Term *string `json:"term,omitempty"` -} - -// Constants associated with the ReservationCommittedUsePatch.ExpirationPolicy property. -// The policy to apply when the committed use term expires: -// - `release`: Release any available capacity and let the reservation expire. -// - `renew`: Renew for another term, provided the term remains listed in the -// `reservation_terms` for the profile. Otherwise, let the reservation expire. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ReservationCommittedUsePatchExpirationPolicyReleaseConst = "release" - ReservationCommittedUsePatchExpirationPolicyRenewConst = "renew" -) - -// UnmarshalReservationCommittedUsePatch unmarshals an instance of ReservationCommittedUsePatch from the specified map of raw messages. -func UnmarshalReservationCommittedUsePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationCommittedUsePatch) - err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "expiration_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "term", &obj.Term) - if err != nil { - err = core.SDKErrorf(err, "", "term-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservationCommittedUsePrototype : ReservationCommittedUsePrototype struct -type ReservationCommittedUsePrototype struct { - // The policy to apply when the committed use term expires: - // - `release`: Release any available capacity and let the reservation expire. - // - `renew`: Renew for another term, provided the term remains listed in the - // `reservation_terms` for the profile. Otherwise, let the reservation expire. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - ExpirationPolicy *string `json:"expiration_policy,omitempty"` - - // The term for this committed use reservation: - // - `one_year`: 1 year - // - `three_year`: 3 years - // - // The specified value must be listed in the `reservation_terms` in the profile for this reservation. - Term *string `json:"term" validate:"required"` -} - -// Constants associated with the ReservationCommittedUsePrototype.ExpirationPolicy property. -// The policy to apply when the committed use term expires: -// - `release`: Release any available capacity and let the reservation expire. -// - `renew`: Renew for another term, provided the term remains listed in the -// `reservation_terms` for the profile. Otherwise, let the reservation expire. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ReservationCommittedUsePrototypeExpirationPolicyReleaseConst = "release" - ReservationCommittedUsePrototypeExpirationPolicyRenewConst = "renew" -) - -// NewReservationCommittedUsePrototype : Instantiate ReservationCommittedUsePrototype (Generic Model Constructor) -func (*VpcV1) NewReservationCommittedUsePrototype(term string) (_model *ReservationCommittedUsePrototype, err error) { - _model = &ReservationCommittedUsePrototype{ - Term: core.StringPtr(term), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalReservationCommittedUsePrototype unmarshals an instance of ReservationCommittedUsePrototype from the specified map of raw messages. -func UnmarshalReservationCommittedUsePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationCommittedUsePrototype) - err = core.UnmarshalPrimitive(m, "expiration_policy", &obj.ExpirationPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "expiration_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "term", &obj.Term) - if err != nil { - err = core.SDKErrorf(err, "", "term-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservationIdentity : Identifies a reservation by a unique property. -// Models which "extend" this model: -// - ReservationIdentityByID -// - ReservationIdentityByCRN -// - ReservationIdentityByHref -type ReservationIdentity struct { - // The unique identifier for this reservation. - ID *string `json:"id,omitempty"` - - // The CRN for this reservation. - CRN *string `json:"crn,omitempty"` - - // The URL for this reservation. - Href *string `json:"href,omitempty"` -} - -func (*ReservationIdentity) isaReservationIdentity() bool { - return true -} - -type ReservationIdentityIntf interface { - isaReservationIdentity() bool -} - -// UnmarshalReservationIdentity unmarshals an instance of ReservationIdentity from the specified map of raw messages. -func UnmarshalReservationIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservationPatch : ReservationPatch struct -type ReservationPatch struct { - // The capacity reservation configuration to use. - // - // The configuration can only be changed for reservations with a `status` of `inactive`. - Capacity *ReservationCapacityPatch `json:"capacity,omitempty"` - - // The committed use configuration to use for this reservation. - CommittedUse *ReservationCommittedUsePatch `json:"committed_use,omitempty"` - - // The name for this reservation. The name must not be used by another reservation in the region. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this - // reservation. - // - // The profile can only be changed for a reservation with a `status` of `inactive`. - Profile *ReservationProfilePatch `json:"profile,omitempty"` -} - -// UnmarshalReservationPatch unmarshals an instance of ReservationPatch from the specified map of raw messages. -func UnmarshalReservationPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationPatch) - err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalReservationCapacityPatch) - if err != nil { - err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "committed_use", &obj.CommittedUse, UnmarshalReservationCommittedUsePatch) - if err != nil { - err = core.SDKErrorf(err, "", "committed_use-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, "profile", &obj.Profile, UnmarshalReservationProfilePatch) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// ReservationProfile : The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this reservation. -type ReservationProfile struct { - // The URL for this virtual server instance profile. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this virtual server instance profile. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservationProfile.ResourceType property. -// The resource type. -const ( - ReservationProfileResourceTypeInstanceProfileConst = "instance_profile" -) - -// UnmarshalReservationProfile unmarshals an instance of ReservationProfile from the specified map of raw messages. -func UnmarshalReservationProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationProfile) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-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 -} - -// ReservationProfilePatch : The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this reservation. -// -// The profile can only be changed for a reservation with a `status` of `inactive`. -type ReservationProfilePatch struct { - // The globally unique name of the profile. - Name *string `json:"name,omitempty"` - - // The resource type of the profile. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the ReservationProfilePatch.ResourceType property. -// The resource type of the profile. -const ( - ReservationProfilePatchResourceTypeInstanceProfileConst = "instance_profile" -) - -// UnmarshalReservationProfilePatch unmarshals an instance of ReservationProfilePatch from the specified map of raw messages. -func UnmarshalReservationProfilePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationProfilePatch) - 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 -} - -// 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. - Name *string `json:"name" validate:"required"` - - // The resource type of the profile. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservationProfilePrototype.ResourceType property. -// The resource type of the profile. -const ( - ReservationProfilePrototypeResourceTypeInstanceProfileConst = "instance_profile" -) - -// NewReservationProfilePrototype : Instantiate ReservationProfilePrototype (Generic Model Constructor) -func (*VpcV1) NewReservationProfilePrototype(name string, resourceType string) (_model *ReservationProfilePrototype, err error) { - _model = &ReservationProfilePrototype{ - Name: core.StringPtr(name), - ResourceType: core.StringPtr(resourceType), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalReservationProfilePrototype unmarshals an instance of ReservationProfilePrototype from the specified map of raw messages. -func UnmarshalReservationProfilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationProfilePrototype) - 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 -} - -// ReservationReference : ReservationReference struct -type ReservationReference struct { - // The CRN for this reservation. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ReservationReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this reservation. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this reservation. - ID *string `json:"id" validate:"required"` - - // The name for this reservation. The name is unique across all reservations in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservationReference.ResourceType property. -// The resource type. -const ( - ReservationReferenceResourceTypeReservationConst = "reservation" -) - -// UnmarshalReservationReference unmarshals an instance of ReservationReference from the specified map of raw messages. -func UnmarshalReservationReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationReference) - 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, UnmarshalReservationReferenceDeleted) - 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 -} - -// ReservationReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ReservationReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalReservationReferenceDeleted unmarshals an instance of ReservationReferenceDeleted from the specified map of raw messages. -func UnmarshalReservationReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationReferenceDeleted) - 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 -} - -// ReservationStatusReason : ReservationStatusReason struct -type ReservationStatusReason struct { - // A snake case string succinctly identifying the status reason. - // - // 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 ReservationStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ReservationStatusReasonCodeCannotActivateNoCapacityAvailableConst = "cannot_activate_no_capacity_available" - ReservationStatusReasonCodeCannotRenewUnsupportedProfileTermConst = "cannot_renew_unsupported_profile_term" -) - -// UnmarshalReservationStatusReason unmarshals an instance of ReservationStatusReason from the specified map of raw messages. -func UnmarshalReservationStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationStatusReason) - 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 -} - -// ReservedIP : ReservedIP struct -type ReservedIP struct { - // The IP address. - // - // If the address has not yet been selected, 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"` - - // Indicates whether this reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // The date and time that the reserved IP was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the reserved IP. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - Name *string `json:"name" validate:"required"` - - // The owner of the reserved IP. - Owner *string `json:"owner" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The target this reserved IP is bound to. - // - // If absent, this reserved IP is provider-owned or unbound. - Target ReservedIPTargetIntf `json:"target,omitempty"` -} - -// Constants associated with the ReservedIP.LifecycleState property. -// The lifecycle state of the reserved IP. -const ( - ReservedIPLifecycleStateDeletingConst = "deleting" - ReservedIPLifecycleStateFailedConst = "failed" - ReservedIPLifecycleStatePendingConst = "pending" - ReservedIPLifecycleStateStableConst = "stable" - ReservedIPLifecycleStateSuspendedConst = "suspended" - ReservedIPLifecycleStateUpdatingConst = "updating" - ReservedIPLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the ReservedIP.Owner property. -// The owner of the reserved IP. -const ( - ReservedIPOwnerProviderConst = "provider" - ReservedIPOwnerUserConst = "user" -) - -// Constants associated with the ReservedIP.ResourceType property. -// The resource type. -const ( - ReservedIPResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" -) - -// UnmarshalReservedIP unmarshals an instance of ReservedIP from the specified map of raw messages. -func UnmarshalReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIP) - 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, "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, "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, "owner", &obj.Owner) - if err != nil { - err = core.SDKErrorf(err, "", "owner-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, "target", &obj.Target, UnmarshalReservedIPTarget) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPCollection : ReservedIPCollection struct -type ReservedIPCollection struct { - // A link to the first page of resources. - First *ReservedIPCollectionFirst `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"` - - // Collection of reserved IPs in this subnet. - ReservedIps []ReservedIP `json:"reserved_ips" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalReservedIPCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reserved_ips", &obj.ReservedIps, UnmarshalReservedIP) - if err != nil { - err = core.SDKErrorf(err, "", "reserved_ips-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 *ReservedIPCollection) 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 -} - -// ReservedIPCollectionBareMetalServerNetworkInterfaceContext : ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct -type ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct { - // A link to the first page of resources. - First *ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst `json:"first" validate:"required"` - - // Collection of reserved IPs bound to a bare metal server network interface. - Ips []ReservedIP `json:"ips" 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 *ReservedIPCollectionBareMetalServerNetworkInterfaceContextNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) - if err != nil { - err = core.SDKErrorf(err, "", "ips-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, UnmarshalReservedIPCollectionBareMetalServerNetworkInterfaceContextNext) - 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 -} - -// 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"` - - // Collection of reserved IPs bound to an endpoint gateway. - Ips []ReservedIP `json:"ips" 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 *ReservedIPCollectionEndpointGatewayContextNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) - if err != nil { - err = core.SDKErrorf(err, "", "ips-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, UnmarshalReservedIPCollectionEndpointGatewayContextNext) - 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 *ReservedIPCollectionEndpointGatewayContext) 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 -} - -// 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"` - - // Collection of reserved IPs bound to an instance network interface. - Ips []ReservedIP `json:"ips" 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 *ReservedIPCollectionInstanceNetworkInterfaceContextNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) - if err != nil { - err = core.SDKErrorf(err, "", "ips-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, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContextNext) - 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 *ReservedIPCollectionInstanceNetworkInterfaceContext) 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 -} - -// 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"` - - // Collection of reserved IPs bound to the virtual network interface specified by the identifier in the URL. - Ips []ReservedIPReference `json:"ips" 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 *ReservedIPCollectionVirtualNetworkInterfaceContextNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "ips-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, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContextNext) - 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 *ReservedIPCollectionVirtualNetworkInterfaceContext) 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 -} - -// 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 - // `target` is deleted, or the reserved IP is unbound. Must be `false` if the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the subnet. Names starting with - // `ibm-` are reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` -} - -// UnmarshalReservedIPPatch unmarshals an instance of ReservedIPPatch from the specified map of raw messages. -func UnmarshalReservedIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPPatch) - 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 -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// ReservedIPReference : ReservedIPReference struct -type ReservedIPReference struct { - // The IP address. - // - // If the address has not yet been selected, 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"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` - - // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPReference.ResourceType property. -// The resource type. -const ( - ReservedIPReferenceResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" -) - -// UnmarshalReservedIPReference unmarshals an instance of ReservedIPReference from the specified map of raw messages. -func UnmarshalReservedIPReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPReference) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) - 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 -} - -// ReservedIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ReservedIPReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalReservedIPReferenceDeleted unmarshals an instance of ReservedIPReferenceDeleted from the specified map of raw messages. -func UnmarshalReservedIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPReferenceDeleted) - 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 -} - -// ReservedIPTarget : The target this reserved IP is bound to. -// -// If absent, this reserved IP is provider-owned or unbound. -// Models which "extend" this model: -// - ReservedIPTargetEndpointGatewayReference -// - ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext -// - ReservedIPTargetNetworkInterfaceReferenceTargetContext -// - ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext -// - ReservedIPTargetLoadBalancerReference -// - ReservedIPTargetVPNGatewayReference -// - ReservedIPTargetVPNServerReference -// - ReservedIPTargetGenericResourceReference -type ReservedIPTarget struct { - // The CRN for this endpoint gateway. - CRN *string `json:"crn,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this endpoint gateway. - Href *string `json:"href,omitempty"` - - // The unique identifier for this endpoint gateway. - ID *string `json:"id,omitempty"` - - // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the ReservedIPTarget.ResourceType property. -// The resource type. -const ( - ReservedIPTargetResourceTypeEndpointGatewayConst = "endpoint_gateway" -) - -func (*ReservedIPTarget) isaReservedIPTarget() bool { - return true -} - -type ReservedIPTargetIntf interface { - isaReservedIPTarget() bool -} - -// UnmarshalReservedIPTarget unmarshals an instance of ReservedIPTarget from the specified map of raw messages. -func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTarget) - 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, UnmarshalEndpointGatewayReferenceDeleted) - 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 -} - -// ReservedIPTargetPrototype : The target to bind this reserved IP to. The target must be in the same VPC. -// -// The following targets are supported: -// - An endpoint gateway not already bound to a reserved IP in the subnet's zone. -// - A virtual network interface. -// -// If unspecified, the reserved IP will be created unbound. -// Models which "extend" this model: -// - ReservedIPTargetPrototypeEndpointGatewayIdentity -// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity -type ReservedIPTargetPrototype struct { - // The unique identifier for this endpoint gateway. - ID *string `json:"id,omitempty"` - - // The CRN for this endpoint gateway. - CRN *string `json:"crn,omitempty"` - - // The URL for this endpoint gateway. - Href *string `json:"href,omitempty"` -} - -func (*ReservedIPTargetPrototype) isaReservedIPTargetPrototype() bool { - return true -} - -type ReservedIPTargetPrototypeIntf interface { - isaReservedIPTargetPrototype() bool -} - -// UnmarshalReservedIPTargetPrototype unmarshals an instance of ReservedIPTargetPrototype from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ResourceFilter : Identifies one or more resources according to the specified filter property. -type ResourceFilter struct { - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// UnmarshalResourceFilter unmarshals an instance of ResourceFilter from the specified map of raw messages. -func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResourceFilter) - 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 -} - -// 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: -// - ResourceGroupIdentityByID -type ResourceGroupIdentity struct { - // The unique identifier for this resource group. - ID *string `json:"id,omitempty"` -} - -func (*ResourceGroupIdentity) isaResourceGroupIdentity() bool { - return true -} - -type ResourceGroupIdentityIntf interface { - isaResourceGroupIdentity() bool -} - -// UnmarshalResourceGroupIdentity unmarshals an instance of ResourceGroupIdentity from the specified map of raw messages. -func UnmarshalResourceGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResourceGroupIdentity) - 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 -} - -// ResourceGroupReference : ResourceGroupReference struct -type ResourceGroupReference struct { - // The URL for this resource group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this resource group. - ID *string `json:"id" validate:"required"` - - // The name for this resource group. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalResourceGroupReference unmarshals an instance of ResourceGroupReference from the specified map of raw messages. -func UnmarshalResourceGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResourceGroupReference) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RestartBareMetalServerOptions : The RestartBareMetalServer options. -type RestartBareMetalServerOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewRestartBareMetalServerOptions : Instantiate RestartBareMetalServerOptions -func (*VpcV1) NewRestartBareMetalServerOptions(id string) *RestartBareMetalServerOptions { - return &RestartBareMetalServerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *RestartBareMetalServerOptions) SetID(id string) *RestartBareMetalServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RestartBareMetalServerOptions) SetHeaders(param map[string]string) *RestartBareMetalServerOptions { - options.Headers = param - return options -} - -// Route : Route struct -type Route 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. - 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,omitempty"` - - // 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 Route.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. -const ( - RouteActionDelegateConst = "delegate" - RouteActionDelegateVPCConst = "delegate_vpc" - RouteActionDeliverConst = "deliver" - RouteActionDropConst = "drop" -) - -// Constants associated with the Route.LifecycleState property. -// The lifecycle state of the route. -const ( - RouteLifecycleStateDeletingConst = "deleting" - RouteLifecycleStateFailedConst = "failed" - RouteLifecycleStatePendingConst = "pending" - RouteLifecycleStateStableConst = "stable" - RouteLifecycleStateSuspendedConst = "suspended" - RouteLifecycleStateUpdatingConst = "updating" - RouteLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the Route.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 ( - RouteOriginServiceConst = "service" - RouteOriginUserConst = "user" -) - -// UnmarshalRoute unmarshals an instance of Route from the specified map of raw messages. -func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Route) - 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 *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"` - - // Collection of routes. - 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"` - - // Collection of routes. - 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. - 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,omitempty"` - - // 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. -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 -} - -// 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. -// Models which "extend" this model: -// - RouteCreatorVPNGatewayReference -// - RouteCreatorVPNServerReference -type RouteCreator struct { - // The VPN gateway's CRN. - CRN *string `json:"crn,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The VPN gateway's canonical URL. - Href *string `json:"href,omitempty"` - - // The unique identifier for this VPN gateway. - ID *string `json:"id,omitempty"` - - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the RouteCreator.ResourceType property. -// The resource type. -const ( - RouteCreatorResourceTypeVPNGatewayConst = "vpn_gateway" -) - -func (*RouteCreator) isaRouteCreator() bool { - return true -} - -type RouteCreatorIntf interface { - isaRouteCreator() bool -} - -// UnmarshalRouteCreator unmarshals an instance of RouteCreator from the specified map of raw messages. -func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCreator) - 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, UnmarshalVPNGatewayReferenceDeleted) - 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 -} - -// RouteNextHop : RouteNextHop struct -// Models which "extend" this model: -// - RouteNextHopIP -// - RouteNextHopVPNGatewayConnectionReference -type RouteNextHop struct { - // The IP address. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in - // the future. - Address *string `json:"address,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the RouteNextHop.ResourceType property. -// The resource type. -const ( - RouteNextHopResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -func (*RouteNextHop) isaRouteNextHop() bool { - return true -} - -type RouteNextHopIntf interface { - isaRouteNextHop() bool -} - -// UnmarshalRouteNextHop unmarshals an instance of RouteNextHop from the specified map of raw messages. -func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHop) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) - 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 -} - -// RouteNextHopPatch : If `action` is `deliver`, the next hop that packets will be delivered to. For other -// `action` values, specify `0.0.0.0` or remove it by specifying `null`. -// -// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has -// an `action` of `deliver` and `next_hop` is an IP address. -// Models which "extend" this model: -// - RouteNextHopPatchRouteNextHopIP -// - RouteNextHopPatchVPNGatewayConnectionIdentity -type RouteNextHopPatch struct { - // The sentinel IP address (`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,omitempty"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*RouteNextHopPatch) isaRouteNextHopPatch() bool { - return true -} - -type RouteNextHopPatchIntf interface { - isaRouteNextHopPatch() bool -} - -// UnmarshalRouteNextHopPatch unmarshals an instance of RouteNextHopPatch from the specified map of raw messages. -func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatch) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePatch : RoutePatch struct -type RoutePatch struct { - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - // - // Since all routes in a routing table with the same `destination` and `zone` must have the same `advertise` value, - // this property can only be changed for routes with a unique - // `destination` and `zone` in the routing table. For more information, see [Advertising - // routes](https://cloud.ibm.com/docs/vpc?topic=vpc-about-custom-routes#rt-advertising-routes). - Advertise *bool `json:"advertise,omitempty"` - - // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` - // are reserved for system-provided routes, and are not allowed. - Name *string `json:"name,omitempty"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For other - // `action` values, specify `0.0.0.0` or remove it by specifying `null`. - // - // At most two routes per `zone` in a table can have the same `destination` and `priority`, - // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. - NextHop RouteNextHopPatchIntf `json:"next_hop,omitempty"` - - // 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,omitempty"` -} - -// UnmarshalRoutePatch unmarshals an instance of RoutePatch from the specified map of raw messages. -func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePatch) - err = core.UnmarshalPrimitive(m, "advertise", &obj.Advertise) - if err != nil { - err = core.SDKErrorf(err, "", "advertise-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, UnmarshalRouteNextHopPatch) - if err != nil { - err = core.SDKErrorf(err, "", "next_hop-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) - if err != nil { - err = core.SDKErrorf(err, "", "priority-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// RoutePrototype : RoutePrototype struct -type RoutePrototype 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. - Action *string `json:"action,omitempty"` - - // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` - // routing table property. - // - // All routes in a routing table with the same `destination` and `zone` must have the same - // `advertise` value. - Advertise *bool `json:"advertise,omitempty"` - - // The destination CIDR of the route. The host identifier in the CIDR must be zero. - // - // At most two routes per `zone` in a table can have the same `destination` and - // `priority`, and only if both routes have an `action` of `deliver` and the `next_hop` is an IP address. - Destination *string `json:"destination" validate:"required"` - - // The name for this route. The name must not be used by another route in the routing table. Names starting with `ibm-` - // are reserved for system-provided routes, and are not allowed. If unspecified, the name will be a hyphenated list of - // randomly-selected words. - Name *string `json:"name,omitempty"` - - // If `action` is `deliver`, the next hop that packets will be delivered to. For other - // `action` values, it must be omitted or specified as `0.0.0.0`. - // - // At most two routes per `zone` in a table can have the same `destination` and `priority`, - // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. - NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` - - // 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,omitempty"` - - // The zone to apply the route 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 ZoneIdentityIntf `json:"zone" validate:"required"` -} - -// Constants associated with the RoutePrototype.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. -const ( - RoutePrototypeActionDelegateConst = "delegate" - RoutePrototypeActionDelegateVPCConst = "delegate_vpc" - RoutePrototypeActionDeliverConst = "deliver" - RoutePrototypeActionDropConst = "drop" -) - -// NewRoutePrototype : Instantiate RoutePrototype (Generic Model Constructor) -func (*VpcV1) NewRoutePrototype(destination string, zone ZoneIdentityIntf) (_model *RoutePrototype, err error) { - _model = &RoutePrototype{ - Destination: core.StringPtr(destination), - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalRoutePrototype unmarshals an instance of RoutePrototype from the specified map of raw messages. -func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototype) - 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, "destination", &obj.Destination) - if err != nil { - err = core.SDKErrorf(err, "", "destination-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, UnmarshalRoutePrototypeNextHop) - if err != nil { - err = core.SDKErrorf(err, "", "next_hop-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, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePrototypeNextHop : If `action` is `deliver`, the next hop that packets will be delivered to. For other -// `action` values, it must be omitted or specified as `0.0.0.0`. -// -// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has -// an `action` of `deliver` and `next_hop` is an IP address. -// Models which "extend" this model: -// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP -// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity -type RoutePrototypeNextHop struct { - // The sentinel IP address (`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,omitempty"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*RoutePrototypeNextHop) isaRoutePrototypeNextHop() bool { - return true -} - -type RoutePrototypeNextHopIntf interface { - isaRoutePrototypeNextHop() bool -} - -// UnmarshalRoutePrototypeNextHop unmarshals an instance of RoutePrototypeNextHop from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHop(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHop) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteReference : RouteReference struct -type RouteReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *RouteReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this route. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this route. - ID *string `json:"id" validate:"required"` - - // The name for this route. The name is unique across all routes in the routing table. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalRouteReference unmarshals an instance of RouteReference from the specified map of raw messages. -func UnmarshalRouteReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRouteReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type RouteReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalRouteReferenceDeleted unmarshals an instance of RouteReferenceDeleted from the specified map of raw messages. -func UnmarshalRouteReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteReferenceDeleted) - 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 -} - -// RoutingTable : RoutingTable struct -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. - 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 - // sources. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - AdvertiseRoutesTo []string `json:"advertise_routes_to" validate:"required"` - - // The date and time that this routing table was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this routing table. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this routing table. - ID *string `json:"id" validate:"required"` - - // Indicates whether this is the default routing table for this VPC. - IsDefault *bool `json:"is_default" validate:"required"` - - // The lifecycle state of the routing table. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this routing table. The name is unique across all routing tables for the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from - // [Direct Link](https://cloud.ibm.com/docs/dl) to this VPC. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from the internet. - // - // Incoming traffic will be routed according to the routing table with two exceptions: - // - Traffic destined for IP addresses associated with public gateways will not be - // subject to routes in this routing table. - // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is - // an IP address in a subnet in the route's `zone` that is able to accept traffic. - // Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteInternetIngress *bool `json:"route_internet_ingress" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from from [Transit - // Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` - - // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this - // VPC. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` - - // The routes for this routing table. - Routes []RouteReference `json:"routes" validate:"required"` - - // The subnets to which this routing table is attached. - Subnets []SubnetReference `json:"subnets" validate:"required"` -} - -// Constants associated with the RoutingTable.AdvertiseRoutesTo property. -// An ingress source that routes can be advertised to: -// -// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) -// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). -const ( - RoutingTableAdvertiseRoutesToDirectLinkConst = "direct_link" - RoutingTableAdvertiseRoutesToTransitGatewayConst = "transit_gateway" -) - -// Constants associated with the RoutingTable.LifecycleState property. -// The lifecycle state of the routing table. -const ( - RoutingTableLifecycleStateDeletingConst = "deleting" - RoutingTableLifecycleStateFailedConst = "failed" - RoutingTableLifecycleStatePendingConst = "pending" - RoutingTableLifecycleStateStableConst = "stable" - RoutingTableLifecycleStateSuspendedConst = "suspended" - RoutingTableLifecycleStateUpdatingConst = "updating" - RoutingTableLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the RoutingTable.ResourceType property. -// The resource type. -const ( - RoutingTableResourceTypeRoutingTableConst = "routing_table" -) - -// UnmarshalRoutingTable unmarshals an instance of RoutingTable from the specified map of raw messages. -func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTable) - err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) - if err != nil { - err = core.SDKErrorf(err, "", "accept_routes_from-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) - if err != nil { - err = core.SDKErrorf(err, "", "advertise_routes_to-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, "is_default", &obj.IsDefault) - if err != nil { - err = core.SDKErrorf(err, "", "is_default-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, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) - if err != nil { - err = core.SDKErrorf(err, "", "route_direct_link_ingress-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) - if err != nil { - err = core.SDKErrorf(err, "", "route_internet_ingress-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) - if err != nil { - err = core.SDKErrorf(err, "", "route_transit_gateway_ingress-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) - if err != nil { - err = core.SDKErrorf(err, "", "route_vpc_zone_ingress-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) - if err != nil { - err = core.SDKErrorf(err, "", "routes-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutingTableCollection : RoutingTableCollection struct -type RoutingTableCollection struct { - // A link to the first page of resources. - First *RoutingTableCollectionFirst `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"` - - // Collection of routing tables. - RoutingTables []RoutingTable `json:"routing_tables" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalRoutingTableCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "routing_tables", &obj.RoutingTables, UnmarshalRoutingTable) - if err != nil { - err = core.SDKErrorf(err, "", "routing_tables-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 *RoutingTableCollection) 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 -} - -// 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: -// - RoutingTableIdentityByID -// - RoutingTableIdentityByHref -type RoutingTableIdentity struct { - // The unique identifier for this routing table. - ID *string `json:"id,omitempty"` - - // The URL for this routing table. - Href *string `json:"href,omitempty"` -} - -func (*RoutingTableIdentity) isaRoutingTableIdentity() bool { - return true -} - -type RoutingTableIdentityIntf interface { - isaRoutingTableIdentity() bool -} - -// UnmarshalRoutingTableIdentity unmarshals an instance of RoutingTableIdentity from the specified map of raw messages. -func UnmarshalRoutingTableIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableIdentity) - 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 -} - -// 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. - 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 - // `advertise` enabled will be advertised to these sources. - AdvertiseRoutesTo []string `json:"advertise_routes_to,omitempty"` - - // The name for this routing table. The name must not be used by another routing table in the VPC. - Name *string `json:"name,omitempty"` - - // Indicates whether this routing table is used to route traffic that originates from - // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to `true` selects this routing table, provided - // no other routing table in the VPC already has this property set to `true`, and no subnets are attached to this - // routing table. Updating to - // `false` deselects this routing table, provided `direct_link` is absent from - // `advertise_routes_to`. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` - - // Indicates whether this routing table is used to route traffic that originates from the internet. Updating to `true` - // selects this routing table, provided no other routing table in the VPC already has this property set to `true`. - // Updating to `false` deselects this routing table. - // - // Incoming traffic will be routed according to the routing table with two exceptions: - // - Traffic destined for IP addresses associated with public gateways will not be subject - // to routes in this routing table. - // - Routes with an `action` of `deliver` are treated as `drop` unless the `next_hop` is an - // IP address in a subnet in the route's `zone` that is able to accept traffic. - // Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteInternetIngress *bool `json:"route_internet_ingress,omitempty"` - - // Indicates whether this routing table is used to route traffic that originates from - // [Transit Gateway](https://cloud.ibm.com/docs/transit-gateway) to this VPC. Updating to - // `true` selects this routing table, provided no other routing table in the VPC already has this property set to - // `true`, and no subnets are attached to this routing table. Updating to `false` deselects this routing table, - // provided `transit_gateway` is absent from `advertise_routes_to`. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - // - // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled - // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing - // table. - RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` - - // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this - // VPC. Updating to `true` selects this routing table, provided no other routing table in the VPC already has this - // property set to `true`, and no subnets are attached to this routing table. Updating to `false` deselects this - // routing table. - // - // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of - // `deliver` are treated as `drop` unless the `next_hop` is an IP address in a subnet in the route's `zone` that is - // able to accept traffic. Therefore, if an incoming packet matches a route with a `next_hop` of a VPN gateway - // connection, the packet will be dropped. - RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` -} - -// Constants associated with the RoutingTablePatch.AdvertiseRoutesTo property. -// An ingress source that routes can be advertised to: -// -// - `direct_link` (requires `route_direct_link_ingress` be set to `true`) -// - `transit_gateway` (requires `route_transit_gateway_ingress` be set to `true`). -const ( - RoutingTablePatchAdvertiseRoutesToDirectLinkConst = "direct_link" - RoutingTablePatchAdvertiseRoutesToTransitGatewayConst = "transit_gateway" -) - -// UnmarshalRoutingTablePatch unmarshals an instance of RoutingTablePatch from the specified map of raw messages. -func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTablePatch) - err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) - if err != nil { - err = core.SDKErrorf(err, "", "accept_routes_from-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "advertise_routes_to", &obj.AdvertiseRoutesTo) - if err != nil { - err = core.SDKErrorf(err, "", "advertise_routes_to-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, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) - if err != nil { - err = core.SDKErrorf(err, "", "route_direct_link_ingress-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "route_internet_ingress", &obj.RouteInternetIngress) - if err != nil { - err = core.SDKErrorf(err, "", "route_internet_ingress-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) - if err != nil { - err = core.SDKErrorf(err, "", "route_transit_gateway_ingress-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) - if err != nil { - err = core.SDKErrorf(err, "", "route_vpc_zone_ingress-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// RoutingTableReference : RoutingTableReference struct -type RoutingTableReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *RoutingTableReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this routing table. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this routing table. - ID *string `json:"id" validate:"required"` - - // The name for this routing table. The name is unique across all routing tables for the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the RoutingTableReference.ResourceType property. -// The resource type. -const ( - RoutingTableReferenceResourceTypeRoutingTableConst = "routing_table" -) - -// UnmarshalRoutingTableReference unmarshals an instance of RoutingTableReference from the specified map of raw messages. -func UnmarshalRoutingTableReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRoutingTableReferenceDeleted) - 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 -} - -// RoutingTableReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type RoutingTableReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalRoutingTableReferenceDeleted unmarshals an instance of RoutingTableReferenceDeleted from the specified map of raw messages. -func UnmarshalRoutingTableReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableReferenceDeleted) - 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 -} - -// SecurityGroup : SecurityGroup struct -type SecurityGroup struct { - // The date and time that this security group was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` - - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` - - // The name for this security group. The name is unique across all security groups for the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this security group. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The rules for this security group. If no rules exist, all traffic will be denied. - Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` - - // The targets for this security group. - Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` - - // The VPC this security group resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// UnmarshalSecurityGroup unmarshals an instance of SecurityGroup from the specified map of raw messages. -func UnmarshalSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroup) - 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.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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) - if err != nil { - err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) - if err != nil { - err = core.SDKErrorf(err, "", "targets-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupCollection : SecurityGroupCollection struct -type SecurityGroupCollection struct { - // A link to the first page of resources. - First *SecurityGroupCollectionFirst `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"` - - // Collection of security groups. - SecurityGroups []SecurityGroup `json:"security_groups" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalSecurityGroupCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroup) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-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 *SecurityGroupCollection) 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 -} - -// 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 -// - SecurityGroupIdentityByCRN -// - SecurityGroupIdentityByHref -type SecurityGroupIdentity struct { - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` - - // The security group's CRN. - CRN *string `json:"crn,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*SecurityGroupIdentity) isaSecurityGroupIdentity() bool { - return true -} - -type SecurityGroupIdentityIntf interface { - isaSecurityGroupIdentity() bool -} - -// UnmarshalSecurityGroupIdentity unmarshals an instance of SecurityGroupIdentity from the specified map of raw messages. -func UnmarshalSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupPatch : SecurityGroupPatch struct -type SecurityGroupPatch struct { - // The name for this security group. The name must not be used by another security group for the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalSecurityGroupPatch unmarshals an instance of SecurityGroupPatch from the specified map of raw messages. -func UnmarshalSecurityGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupPatch) - 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 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()) - } - return -} - -// SecurityGroupReference : SecurityGroupReference struct -type SecurityGroupReference struct { - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` - - // The name for this security group. The name is unique across all security groups for the VPC. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalSecurityGroupReference unmarshals an instance of SecurityGroupReference from the specified map of raw messages. -func UnmarshalSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupReference) - 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, UnmarshalSecurityGroupReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type SecurityGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalSecurityGroupReferenceDeleted unmarshals an instance of SecurityGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalSecurityGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupReferenceDeleted) - 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 -} - -// SecurityGroupRule : SecurityGroupRule struct -// Models which "extend" this model: -// - SecurityGroupRuleSecurityGroupRuleProtocolAll -// - SecurityGroupRuleSecurityGroupRuleProtocolIcmp -// - SecurityGroupRuleSecurityGroupRuleProtocolTcpudp -type SecurityGroupRule struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The URL for this security group rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group rule. - ID *string `json:"id" validate:"required"` - - // The IP version to enforce. The format of `local.address`, `remote.address`, - // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. - // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version" validate:"required"` - - // The local IP address or range of local IP addresses to which this rule will allow inbound - // traffic (or from which, for outbound traffic). A CIDR block of `0.0.0.0/0` allows traffic - // to all local IP addresses (or from all local IP addresses, for outbound rules). - Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The remote IP addresses or security groups from which this rule allows traffic (or to - // which, for outbound rules). A CIDR block of `0.0.0.0/0` allows traffic from any source - // (or to any destination, for outbound rules). - Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` - - // The ICMP traffic code to allow. If absent, all codes are allowed. - Code *int64 `json:"code,omitempty"` - - // The ICMP traffic type to allow. If absent, all types are allowed. - Type *int64 `json:"type,omitempty"` - - // The inclusive upper bound of TCP/UDP destination port range. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - PortMin *int64 `json:"port_min,omitempty"` -} - -// Constants associated with the SecurityGroupRule.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRuleDirectionInboundConst = "inbound" - SecurityGroupRuleDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRule.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, -// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. -// -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRuleIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRule.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRuleProtocolAllConst = "all" - SecurityGroupRuleProtocolIcmpConst = "icmp" - SecurityGroupRuleProtocolTCPConst = "tcp" - SecurityGroupRuleProtocolUDPConst = "udp" -) - -func (*SecurityGroupRule) isaSecurityGroupRule() bool { - return true -} - -type SecurityGroupRuleIntf interface { - isaSecurityGroupRule() bool -} - -// UnmarshalSecurityGroupRule unmarshals an instance of SecurityGroupRule from the specified map of raw messages. -func UnmarshalSecurityGroupRule(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) - if err != nil { - errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) - err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) - return - } - if discValue == "" { - err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) - return - } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolAll-error", common.GetComponentInfo()) - } - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolIcmp-error", common.GetComponentInfo()) - } - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolTcpudp-error", common.GetComponentInfo()) - } - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolTcpudp-error", common.GetComponentInfo()) - } - } else { - errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) - err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) - } - return -} - -// SecurityGroupRuleCollection : Collection of rules in a security group. -type SecurityGroupRuleCollection struct { - // Array of rules. - Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` -} - -// UnmarshalSecurityGroupRuleCollection unmarshals an instance of SecurityGroupRuleCollection from the specified map of raw messages. -func UnmarshalSecurityGroupRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleCollection) - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) - if err != nil { - err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleLocal : The local IP address or range of local IP addresses to which this rule will allow inbound traffic (or from which, for -// outbound traffic). A CIDR block of `0.0.0.0/0` allows traffic to all local IP addresses (or from all local IP -// addresses, for outbound rules). -// Models which "extend" this model: -// - SecurityGroupRuleLocalIP -// - SecurityGroupRuleLocalCIDR -type SecurityGroupRuleLocal struct { - // The IP address. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in - // the future. - Address *string `json:"address,omitempty"` - - // The CIDR block. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address - // blocks in the future. - CIDRBlock *string `json:"cidr_block,omitempty"` -} - -func (*SecurityGroupRuleLocal) isaSecurityGroupRuleLocal() bool { - return true -} - -type SecurityGroupRuleLocalIntf interface { - isaSecurityGroupRuleLocal() bool -} - -// UnmarshalSecurityGroupRuleLocal unmarshals an instance of SecurityGroupRuleLocal from the specified map of raw messages. -func UnmarshalSecurityGroupRuleLocal(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleLocal) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleLocalPatch : The local IP address or range of local IP addresses to which this rule will allow inbound traffic (or from which, for -// outbound traffic). Can be specified as an IP address or a CIDR block. -// -// Specify a CIDR block of `0.0.0.0/0` to allow traffic to all local IP addresses (or from all local IP addresses, for -// outbound rules). -// Models which "extend" this model: -// - SecurityGroupRuleLocalPatchIP -// - SecurityGroupRuleLocalPatchCIDR -type SecurityGroupRuleLocalPatch struct { - // The IP address. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in - // the future. - Address *string `json:"address,omitempty"` - - // The CIDR block. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address - // blocks in the future. - CIDRBlock *string `json:"cidr_block,omitempty"` -} - -func (*SecurityGroupRuleLocalPatch) isaSecurityGroupRuleLocalPatch() bool { - return true -} - -type SecurityGroupRuleLocalPatchIntf interface { - isaSecurityGroupRuleLocalPatch() bool -} - -// UnmarshalSecurityGroupRuleLocalPatch unmarshals an instance of SecurityGroupRuleLocalPatch from the specified map of raw messages. -func UnmarshalSecurityGroupRuleLocalPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleLocalPatch) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - 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) -// -// If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP addresses (or from all -// local IP addresses, for outbound rules). -// Models which "extend" this model: -// - SecurityGroupRuleLocalPrototypeIP -// - SecurityGroupRuleLocalPrototypeCIDR -type SecurityGroupRuleLocalPrototype struct { - // The IP address. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in - // the future. - Address *string `json:"address,omitempty"` - - // The CIDR block. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address - // blocks in the future. - CIDRBlock *string `json:"cidr_block,omitempty"` -} - -func (*SecurityGroupRuleLocalPrototype) isaSecurityGroupRuleLocalPrototype() bool { - return true -} - -type SecurityGroupRuleLocalPrototypeIntf interface { - isaSecurityGroupRuleLocalPrototype() bool -} - -// UnmarshalSecurityGroupRuleLocalPrototype unmarshals an instance of SecurityGroupRuleLocalPrototype from the specified map of raw messages. -func UnmarshalSecurityGroupRuleLocalPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleLocalPrototype) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRulePatch : SecurityGroupRulePatch struct -type SecurityGroupRulePatch struct { - // The ICMP traffic code to allow. If set, `type` must also be set. - // - // Specify `null` to remove an existing ICMP traffic code. - Code *int64 `json:"code,omitempty"` - - // The direction of traffic to enforce. - Direction *string `json:"direction,omitempty"` - - // The IP version to enforce. The format of `local.address`, `remote.address`, - // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. - // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` - - // The local IP address or range of local IP addresses to which this rule will allow inbound - // traffic (or from which, for outbound traffic). Can be specified as an IP address or a CIDR - // block. - // - // Specify a CIDR block of `0.0.0.0/0` to allow traffic to all local IP addresses (or from all - // local IP addresses, for outbound rules). - Local SecurityGroupRuleLocalPatchIntf `json:"local,omitempty"` - - // The inclusive upper bound of the protocol destination port range. If set, `port_min` must also be set, and must not - // be larger. - // - // Specify `null` to remove an existing upper bound. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of the protocol destination port range. If set, `port_max` must also be set, and must not - // be smaller. - // - // Specify `null` to remove an existing lower bound. - PortMin *int64 `json:"port_min,omitempty"` - - // 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. A CIDR block of `0.0.0.0/0` will allow traffic from any source (or to - // any destination, for outbound rules). - Remote SecurityGroupRuleRemotePatchIntf `json:"remote,omitempty"` - - // The ICMP traffic type to allow. - // - // Specify `null` to remove an existing ICMP traffic type value. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the SecurityGroupRulePatch.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRulePatchDirectionInboundConst = "inbound" - SecurityGroupRulePatchDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePatch.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, -// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. -// -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRulePatchIPVersionIpv4Const = "ipv4" -) - -// UnmarshalSecurityGroupRulePatch unmarshals an instance of SecurityGroupRulePatch from the specified map of raw messages. -func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRulePatch) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPatch) - if err != nil { - err = core.SDKErrorf(err, "", "local-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 - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePatch) - if err != nil { - err = core.SDKErrorf(err, "", "remote-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 -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// SecurityGroupRulePrototype : SecurityGroupRulePrototype struct -// Models which "extend" this model: -// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll -// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp -// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp -type SecurityGroupRulePrototype struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The IP version to enforce. The format of `local.address`, `remote.address`, - // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. - // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` - - // The local IP address or range of local IP addresses to which this rule will allow inbound - // traffic (or from which, for outbound traffic) - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP - // addresses (or from all local IP addresses, for outbound rules). - Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // 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. - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source - // (or to any destination, for outbound rules). - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` - - // The ICMP traffic code to allow. - // - // If specified, `type` must also be specified. If unspecified, all codes are allowed. - Code *int64 `json:"code,omitempty"` - - // The ICMP traffic type to allow. - // - // If unspecified, all types are allowed. - Type *int64 `json:"type,omitempty"` - - // The inclusive upper bound of TCP/UDP destination port range. - // - // If specified, `port_min` must also be specified, and must not be larger. If unspecified, - // `port_min` must also be unspecified, allowing traffic on all destination ports. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range - // - // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be - // unspecified, allowing traffic on all destination ports. - PortMin *int64 `json:"port_min,omitempty"` -} - -// Constants associated with the SecurityGroupRulePrototype.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRulePrototypeDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePrototype.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, -// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. -// -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRulePrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRulePrototype.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRulePrototypeProtocolAllConst = "all" - SecurityGroupRulePrototypeProtocolIcmpConst = "icmp" - SecurityGroupRulePrototypeProtocolTCPConst = "tcp" - SecurityGroupRulePrototypeProtocolUDPConst = "udp" -) - -func (*SecurityGroupRulePrototype) isaSecurityGroupRulePrototype() bool { - return true -} - -type SecurityGroupRulePrototypeIntf interface { - isaSecurityGroupRulePrototype() bool -} - -// 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) - if err != nil { - errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) - err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) - return - } - if discValue == "" { - err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", 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()) - } - return -} - -// SecurityGroupRuleRemote : The remote IP addresses or security groups from which this rule allows traffic (or to which, for outbound rules). A -// CIDR block of `0.0.0.0/0` allows traffic from any source -// (or to any destination, for outbound rules). -// Models which "extend" this model: -// - SecurityGroupRuleRemoteIP -// - SecurityGroupRuleRemoteCIDR -// - SecurityGroupRuleRemoteSecurityGroupReference -type SecurityGroupRuleRemote struct { - // The IP address. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in - // the future. - Address *string `json:"address,omitempty"` - - // The CIDR block. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address - // blocks in the future. - CIDRBlock *string `json:"cidr_block,omitempty"` - - // The security group's CRN. - CRN *string `json:"crn,omitempty"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href,omitempty"` - - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` - - // The name for this security group. The name is unique across all security groups for the VPC. - Name *string `json:"name,omitempty"` -} - -func (*SecurityGroupRuleRemote) isaSecurityGroupRuleRemote() bool { - return true -} - -type SecurityGroupRuleRemoteIntf interface { - isaSecurityGroupRuleRemote() bool -} - -// UnmarshalSecurityGroupRuleRemote unmarshals an instance of SecurityGroupRuleRemote from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemote) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - err = core.SDKErrorf(err, "", "cidr_block-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, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePatch : 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. A CIDR block of `0.0.0.0/0` will allow traffic -// from any source (or to any destination, for outbound rules). -// Models which "extend" this model: -// - SecurityGroupRuleRemotePatchIP -// - SecurityGroupRuleRemotePatchCIDR -// - SecurityGroupRuleRemotePatchSecurityGroupIdentity -type SecurityGroupRuleRemotePatch struct { - // The IP address. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in - // the future. - Address *string `json:"address,omitempty"` - - // The CIDR block. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address - // blocks in the future. - CIDRBlock *string `json:"cidr_block,omitempty"` - - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` - - // The security group's CRN. - CRN *string `json:"crn,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*SecurityGroupRuleRemotePatch) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -type SecurityGroupRuleRemotePatchIntf interface { - isaSecurityGroupRuleRemotePatch() bool -} - -// UnmarshalSecurityGroupRuleRemotePatch unmarshals an instance of SecurityGroupRuleRemotePatch from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatch) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - err = core.SDKErrorf(err, "", "cidr_block-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-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 -} - -// 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. -// -// If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source -// (or to any destination, for outbound rules). -// Models which "extend" this model: -// - SecurityGroupRuleRemotePrototypeIP -// - SecurityGroupRuleRemotePrototypeCIDR -// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentity -type SecurityGroupRuleRemotePrototype struct { - // The IP address. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in - // the future. - Address *string `json:"address,omitempty"` - - // The CIDR block. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address - // blocks in the future. - CIDRBlock *string `json:"cidr_block,omitempty"` - - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` - - // The security group's CRN. - CRN *string `json:"crn,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*SecurityGroupRuleRemotePrototype) isaSecurityGroupRuleRemotePrototype() bool { - return true -} - -type SecurityGroupRuleRemotePrototypeIntf interface { - isaSecurityGroupRuleRemotePrototype() bool -} - -// UnmarshalSecurityGroupRuleRemotePrototype unmarshals an instance of SecurityGroupRuleRemotePrototype from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototype) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - err = core.SDKErrorf(err, "", "cidr_block-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-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 -} - -// SecurityGroupTargetCollection : SecurityGroupTargetCollection struct -type SecurityGroupTargetCollection struct { - // A link to the first page of resources. - First *SecurityGroupTargetCollectionFirst `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"` - - // Collection of targets for this security group. - Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalSecurityGroupTargetCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) - if err != nil { - err = core.SDKErrorf(err, "", "targets-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 *SecurityGroupTargetCollection) 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 -} - -// 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 -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -// Models which "extend" this model: -// - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext -// - SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext -// - SecurityGroupTargetReferenceLoadBalancerReference -// - SecurityGroupTargetReferenceEndpointGatewayReference -// - SecurityGroupTargetReferenceVPNServerReference -// - SecurityGroupTargetReferenceVirtualNetworkInterfaceReference -type SecurityGroupTargetReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - // - // If this instance 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,omitempty"` - - // The unique identifier for this instance network interface. - // - // If this instance 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,omitempty"` - - // The name for this instance network interface. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` - - // The load balancer's CRN. - CRN *string `json:"crn,omitempty"` - - // The primary IP for this virtual network interface. - PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet,omitempty"` -} - -// Constants associated with the SecurityGroupTargetReference.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*SecurityGroupTargetReference) isaSecurityGroupTargetReference() bool { - return true -} - -type SecurityGroupTargetReferenceIntf interface { - isaSecurityGroupTargetReference() bool -} - -// UnmarshalSecurityGroupTargetReference unmarshals an instance of SecurityGroupTargetReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) - 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 - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SetSubnetPublicGatewayOptions : The SetSubnetPublicGateway options. -type SetSubnetPublicGatewayOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // The public gateway identity. - PublicGatewayIdentity PublicGatewayIdentityIntf `json:"PublicGatewayIdentity" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewSetSubnetPublicGatewayOptions : Instantiate SetSubnetPublicGatewayOptions -func (*VpcV1) NewSetSubnetPublicGatewayOptions(id string, publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { - return &SetSubnetPublicGatewayOptions{ - ID: core.StringPtr(id), - PublicGatewayIdentity: publicGatewayIdentity, - } -} - -// SetID : Allow user to set ID -func (_options *SetSubnetPublicGatewayOptions) SetID(id string) *SetSubnetPublicGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetPublicGatewayIdentity : Allow user to set PublicGatewayIdentity -func (_options *SetSubnetPublicGatewayOptions) SetPublicGatewayIdentity(publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { - _options.PublicGatewayIdentity = publicGatewayIdentity - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *SetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *SetSubnetPublicGatewayOptions { - options.Headers = param - return options -} - -// Share : Share struct -type Share struct { - // The access control mode for the share: - // - // - `security_group`: The security groups on the virtual network interface for a mount - // target control access to the mount target. - // - `vpc`: All clients in the VPC for a mount target have access to the mount target. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - AccessControlMode *string `json:"access_control_mode" validate:"required"` - - // The date and time that the file share is created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this file share. - CRN *string `json:"crn" validate:"required"` - - // The type of encryption used for this file share. - Encryption *string `json:"encryption" validate:"required"` - - // The key used to encrypt this file share. - // - // This property will be present if `encryption` is `user_managed`. - EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` - - // The URL for this file share. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this file share. - ID *string `json:"id" validate:"required"` - - // The maximum input/output operations per second (IOPS) for the file share. In addition, each client accessing the - // share will be restricted to 48,000 IOPS. - // - // The maximum IOPS for a share may increase in the future. - Iops *int64 `json:"iops" validate:"required"` - - // The latest job associated with this file share. - // - // This property will be absent if no jobs have been created for this file share. - LatestJob *ShareJob `json:"latest_job,omitempty"` - - // Information about the latest synchronization for this file share. - // - // This property will be present when the `replication_role` is `replica` and at least - // one replication sync has been completed. - LatestSync *ShareLatestSync `json:"latest_sync,omitempty"` - - // The lifecycle state of the file share. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The mount targets for the file share. - MountTargets []ShareMountTargetReference `json:"mount_targets" validate:"required"` - - // The name for this share. The name is unique across all shares in the region. - Name *string `json:"name" validate:"required"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) for - // this file share. - Profile *ShareProfileReference `json:"profile" validate:"required"` - - // The replica file share for this source file share. - // - // This property will be present when the `replication_role` is `source`. - ReplicaShare *ShareReference `json:"replica_share,omitempty"` - - // The cron specification for the file share replication schedule. - // - // This property will be present when the `replication_role` is `replica`. - ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` - - // The replication role of the file share: - // - `none`: This share is not participating in replication. - // - `replica`: This share is a replication target. - // - `source`: This share is a replication source. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - ReplicationRole *string `json:"replication_role" validate:"required"` - - // The replication status of the file share: - // - `active`: This share is actively participating in replication, and the replica's data is up-to-date with the - // replication schedule. - // - `degraded`: This is share is participating in replication, but the replica's data has fallen behind the - // replication schedule. - // - `failover_pending`: This share is performing a replication failover. - // - `initializing`: This share is initializing replication. - // - `none`: This share is not participating in replication. - // - `split_pending`: This share is performing a replication split. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - ReplicationStatus *string `json:"replication_status" validate:"required"` - - // The reasons for the current replication status (if any). - ReplicationStatusReasons []ShareReplicationStatusReason `json:"replication_status_reasons" validate:"required"` - - // The resource group for this file share. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The size of the file share rounded up to the next gigabyte. - // - // The maximum size for a share may increase in the future. - Size *int64 `json:"size" validate:"required"` - - // The source file share for this replica file share. - // - // This property will be present when the `replication_role` is `replica`. - SourceShare *ShareReference `json:"source_share,omitempty"` - - // Tags for this resource. - UserTags []string `json:"user_tags" validate:"required"` - - // The zone this file share will reside in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the Share.AccessControlMode property. -// The access control mode for the share: -// -// - `security_group`: The security groups on the virtual network interface for a mount -// target control access to the mount target. -// - `vpc`: All clients in the VPC for a mount target have access to the mount target. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ShareAccessControlModeSecurityGroupConst = "security_group" - ShareAccessControlModeVPCConst = "vpc" -) - -// Constants associated with the Share.Encryption property. -// The type of encryption used for this file share. -const ( - ShareEncryptionProviderManagedConst = "provider_managed" - ShareEncryptionUserManagedConst = "user_managed" -) - -// Constants associated with the Share.LifecycleState property. -// The lifecycle state of the file share. -const ( - ShareLifecycleStateDeletingConst = "deleting" - ShareLifecycleStateFailedConst = "failed" - ShareLifecycleStatePendingConst = "pending" - ShareLifecycleStateStableConst = "stable" - ShareLifecycleStateSuspendedConst = "suspended" - ShareLifecycleStateUpdatingConst = "updating" - ShareLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the Share.ReplicationRole property. -// The replication role of the file share: -// - `none`: This share is not participating in replication. -// - `replica`: This share is a replication target. -// - `source`: This share is a replication source. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ShareReplicationRoleNoneConst = "none" - ShareReplicationRoleReplicaConst = "replica" - ShareReplicationRoleSourceConst = "source" -) - -// Constants associated with the Share.ReplicationStatus property. -// The replication status of the file share: -// - `active`: This share is actively participating in replication, and the replica's data is up-to-date with the -// replication schedule. -// - `degraded`: This is share is participating in replication, but the replica's data has fallen behind the replication -// schedule. -// - `failover_pending`: This share is performing a replication failover. -// - `initializing`: This share is initializing replication. -// - `none`: This share is not participating in replication. -// - `split_pending`: This share is performing a replication split. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ShareReplicationStatusActiveConst = "active" - ShareReplicationStatusDegradedConst = "degraded" - ShareReplicationStatusFailoverPendingConst = "failover_pending" - ShareReplicationStatusInitializingConst = "initializing" - ShareReplicationStatusNoneConst = "none" - ShareReplicationStatusSplitPendingConst = "split_pending" -) - -// Constants associated with the Share.ResourceType property. -// The resource type. -const ( - ShareResourceTypeShareConst = "share" -) - -// UnmarshalShare unmarshals an instance of Share from the specified map of raw messages. -func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Share) - err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) - if err != nil { - err = core.SDKErrorf(err, "", "access_control_mode-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) - if err != nil { - err = core.SDKErrorf(err, "", "encryption-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.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, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "latest_job", &obj.LatestJob, UnmarshalShareJob) - if err != nil { - err = core.SDKErrorf(err, "", "latest_job-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "latest_sync", &obj.LatestSync, UnmarshalShareLatestSync) - if err != nil { - err = core.SDKErrorf(err, "", "latest_sync-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.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetReference) - if err != nil { - err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileReference) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalShareReference) - if err != nil { - err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) - if err != nil { - err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "replication_role", &obj.ReplicationRole) - if err != nil { - err = core.SDKErrorf(err, "", "replication_role-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "replication_status", &obj.ReplicationStatus) - if err != nil { - err = core.SDKErrorf(err, "", "replication_status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "replication_status_reasons", &obj.ReplicationStatusReasons, UnmarshalShareReplicationStatusReason) - if err != nil { - err = core.SDKErrorf(err, "", "replication_status_reasons-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.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareReference) - if err != nil { - err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-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 -} - -// ShareCollection : ShareCollection struct -type ShareCollection struct { - // A link to the first page of resources. - First *ShareCollectionFirst `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"` - - // Collection of file shares. - Shares []Share `json:"shares" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalShareCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "shares", &obj.Shares, UnmarshalShare) - if err != nil { - err = core.SDKErrorf(err, "", "shares-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 *ShareCollection) 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 -} - -// 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 -// - ShareIdentityByCRN -// - ShareIdentityByHref -type ShareIdentity struct { - // The unique identifier for this file share. - ID *string `json:"id,omitempty"` - - // The CRN for this file share. - CRN *string `json:"crn,omitempty"` - - // The URL for this file share. - Href *string `json:"href,omitempty"` -} - -func (*ShareIdentity) isaShareIdentity() bool { - return true -} - -type ShareIdentityIntf interface { - isaShareIdentity() bool -} - -// UnmarshalShareIdentity unmarshals an instance of ShareIdentity from the specified map of raw messages. -func UnmarshalShareIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareInitialOwner : ShareInitialOwner struct -type ShareInitialOwner struct { - // The initial group identifier for the file share. - Gid *int64 `json:"gid,omitempty"` - - // The initial user identifier for the file share. - Uid *int64 `json:"uid,omitempty"` -} - -// UnmarshalShareInitialOwner unmarshals an instance of ShareInitialOwner from the specified map of raw messages. -func UnmarshalShareInitialOwner(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareInitialOwner) - err = core.UnmarshalPrimitive(m, "gid", &obj.Gid) - if err != nil { - err = core.SDKErrorf(err, "", "gid-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "uid", &obj.Uid) - if err != nil { - err = core.SDKErrorf(err, "", "uid-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareJob : ShareJob struct -type ShareJob struct { - // The status of the file share job: - // - `cancelled`: This job has been cancelled. - // - `failed`: This job has failed. - // - `queued`: This job is queued. - // - `running`: This job is running. - // - `succeeded`: This job completed successfully. - // - // 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 file share job status (if any). - StatusReasons []ShareJobStatusReason `json:"status_reasons" validate:"required"` - - // The type of the file share job: - // - `replication_failover`: This is a share replication failover job. - // - `replication_init`: This is a share replication is initialization job. - // - `replication_split`: This is a share replication split job. - // - // 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"` -} - -// Constants associated with the ShareJob.Status property. -// The status of the file share job: -// - `cancelled`: This job has been cancelled. -// - `failed`: This job has failed. -// - `queued`: This job is queued. -// - `running`: This job is running. -// - `succeeded`: This job completed successfully. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ShareJobStatusCancelledConst = "cancelled" - ShareJobStatusFailedConst = "failed" - ShareJobStatusQueuedConst = "queued" - ShareJobStatusRunningConst = "running" - ShareJobStatusSucceededConst = "succeeded" -) - -// Constants associated with the ShareJob.Type property. -// The type of the file share job: -// - `replication_failover`: This is a share replication failover job. -// - `replication_init`: This is a share replication is initialization job. -// - `replication_split`: This is a share replication split job. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ShareJobTypeReplicationFailoverConst = "replication_failover" - ShareJobTypeReplicationInitConst = "replication_init" - ShareJobTypeReplicationSplitConst = "replication_split" -) - -// UnmarshalShareJob unmarshals an instance of ShareJob from the specified map of raw messages. -func UnmarshalShareJob(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareJob) - 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, UnmarshalShareJobStatusReason) - if err != nil { - err = core.SDKErrorf(err, "", "status_reasons-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 -} - -// ShareJobStatusReason : ShareJobStatusReason struct -type ShareJobStatusReason struct { - // A snake case string succinctly identifying the status reason. - // - // 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 ShareJobStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ShareJobStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication" - ShareJobStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share" - ShareJobStatusReasonCodeCannotReachSourceShareConst = "cannot_reach_source_share" -) - -// UnmarshalShareJobStatusReason unmarshals an instance of ShareJobStatusReason from the specified map of raw messages. -func UnmarshalShareJobStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareJobStatusReason) - 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 -} - -// ShareLatestSync : Information about the latest synchronization for this file share. -// -// This property will be present when the `replication_role` is `replica` and at least one replication sync has been -// completed. -type ShareLatestSync struct { - // The completed date and time of last synchronization between the replica share and its source. - CompletedAt *strfmt.DateTime `json:"completed_at" validate:"required"` - - // The data transferred (in bytes) in the last synchronization between the replica and its source. - DataTransferred *int64 `json:"data_transferred" validate:"required"` - - // The start date and time of last synchronization between the replica share and its source. - StartedAt *strfmt.DateTime `json:"started_at" validate:"required"` -} - -// UnmarshalShareLatestSync unmarshals an instance of ShareLatestSync from the specified map of raw messages. -func UnmarshalShareLatestSync(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareLatestSync) - 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, "data_transferred", &obj.DataTransferred) - if err != nil { - err = core.SDKErrorf(err, "", "data_transferred-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) - if err != nil { - err = core.SDKErrorf(err, "", "started_at-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTarget : ShareMountTarget struct -type ShareMountTarget struct { - // The access control mode for the share: - // - // - `security_group`: The security groups on the virtual network interface for a mount - // target control access to the mount target. - // - `vpc`: All clients in the VPC for a mount target have access to the mount target. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - AccessControlMode *string `json:"access_control_mode" validate:"required"` - - // The date and time that the share mount target was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this share mount target. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this share mount target. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the mount target. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The mount path for the share. The server component of the mount path may be either an IP address or a fully - // qualified domain name. - // - // This property will be absent if the `lifecycle_state` of the mount target is - // 'pending', `failed`, or `deleting`. - // - // If the share's `access_control_mode` is: - // - // - `security_group`: The IP address used in the mount path is the `primary_ip` - // address of the virtual network interface for this share mount target. - // - `vpc`: The fully-qualified domain name used in the mount path is an address that - // resolves to the share mount target. - MountPath *string `json:"mount_path,omitempty"` - - // The name for this share mount target. The name is unique across all mount targets for the file share. - Name *string `json:"name" validate:"required"` - - // The primary IP address of the virtual network interface for the share mount target. - // - // Absent if `access_control_mode` is `vpc`. - PrimaryIP *ReservedIPReference `json:"primary_ip,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The subnet of the virtual network interface for the share mount target. - // - // Absent if `access_control_mode` is `vpc`. - Subnet *SubnetReference `json:"subnet,omitempty"` - - // The transit encryption mode for this share mount target: - // - `none`: Not encrypted in transit - // - `user_managed`: Encrypted in transit using an instance identity certificate - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - TransitEncryption *string `json:"transit_encryption" validate:"required"` - - // The virtual network interface for this file share mount target. - // - // This property will be present when the `access_control_mode` is `security_group`. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface,omitempty"` - - // If `access_control_mode` is: - // - // - `security_group`: The VPC for the virtual network interface for this share mount - // target - // - `vpc`: The VPC in which clients can mount the file share using this share - // mount target. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// Constants associated with the ShareMountTarget.AccessControlMode property. -// The access control mode for the share: -// -// - `security_group`: The security groups on the virtual network interface for a mount -// target control access to the mount target. -// - `vpc`: All clients in the VPC for a mount target have access to the mount target. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ShareMountTargetAccessControlModeSecurityGroupConst = "security_group" - ShareMountTargetAccessControlModeVPCConst = "vpc" -) - -// Constants associated with the ShareMountTarget.LifecycleState property. -// The lifecycle state of the mount target. -const ( - ShareMountTargetLifecycleStateDeletingConst = "deleting" - ShareMountTargetLifecycleStateFailedConst = "failed" - ShareMountTargetLifecycleStatePendingConst = "pending" - ShareMountTargetLifecycleStateStableConst = "stable" - ShareMountTargetLifecycleStateSuspendedConst = "suspended" - ShareMountTargetLifecycleStateUpdatingConst = "updating" - ShareMountTargetLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the ShareMountTarget.ResourceType property. -// The resource type. -const ( - ShareMountTargetResourceTypeShareMountTargetConst = "share_mount_target" -) - -// Constants associated with the ShareMountTarget.TransitEncryption property. -// The transit encryption mode for this share mount target: -// - `none`: Not encrypted in transit -// - `user_managed`: Encrypted in transit using an instance identity certificate -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ShareMountTargetTransitEncryptionNoneConst = "none" - ShareMountTargetTransitEncryptionUserManagedConst = "user_managed" -) - -// UnmarshalShareMountTarget unmarshals an instance of ShareMountTarget from the specified map of raw messages. -func UnmarshalShareMountTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTarget) - err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) - if err != nil { - err = core.SDKErrorf(err, "", "access_control_mode-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, "lifecycle_state", &obj.LifecycleState) - if err != nil { - err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "mount_path", &obj.MountPath) - if err != nil { - err = core.SDKErrorf(err, "", "mount_path-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) - 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, "", "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.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) - if err != nil { - err = core.SDKErrorf(err, "", "transit_encryption-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 - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetCollection : ShareMountTargetCollection struct -type ShareMountTargetCollection struct { - // A link to the first page of resources. - First *ShareMountTargetCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // Collection of share mount targets. - MountTargets []ShareMountTarget `json:"mount_targets" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *ShareMountTargetCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, "mount_targets", &obj.MountTargets, UnmarshalShareMountTarget) - if err != nil { - err = core.SDKErrorf(err, "", "mount_targets-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalShareMountTargetCollectionNext) - 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 *ShareMountTargetCollection) 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 -} - -// 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. - Name *string `json:"name,omitempty"` -} - -// UnmarshalShareMountTargetPatch unmarshals an instance of ShareMountTargetPatch from the specified map of raw messages. -func UnmarshalShareMountTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetPatch) - 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 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()) - } - return -} - -// ShareMountTargetPrototype : ShareMountTargetPrototype struct -// Models which "extend" this model: -// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup -// - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC -type ShareMountTargetPrototype struct { - // The name for this share mount target. The name must not be used by another mount target for the file share. - Name *string `json:"name,omitempty"` - - // The transit encryption mode to use for this share mount target: - // - `none`: Not encrypted in transit. - // - `user_managed`: Encrypted in transit using an instance identity certificate. The - // `access_control_mode` for the share must be `security_group`. - TransitEncryption *string `json:"transit_encryption,omitempty"` - - VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface,omitempty"` - - // Identifies a VPC by a unique property. - VPC VPCIdentityIntf `json:"vpc,omitempty"` -} - -// Constants associated with the ShareMountTargetPrototype.TransitEncryption property. -// The transit encryption mode to use for this share mount target: -// - `none`: Not encrypted in transit. -// - `user_managed`: Encrypted in transit using an instance identity certificate. The -// `access_control_mode` for the share must be `security_group`. -const ( - ShareMountTargetPrototypeTransitEncryptionNoneConst = "none" - ShareMountTargetPrototypeTransitEncryptionUserManagedConst = "user_managed" -) - -func (*ShareMountTargetPrototype) isaShareMountTargetPrototype() bool { - return true -} - -type ShareMountTargetPrototypeIntf interface { - isaShareMountTargetPrototype() bool -} - -// UnmarshalShareMountTargetPrototype unmarshals an instance of ShareMountTargetPrototype from the specified map of raw messages. -func UnmarshalShareMountTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) - if err != nil { - err = core.SDKErrorf(err, "", "transit_encryption-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetReference : ShareMountTargetReference struct -type ShareMountTargetReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this share mount target. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this share mount target. - ID *string `json:"id" validate:"required"` - - // The name for this share mount target. The name is unique across all mount targets for the file share. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ShareMountTargetReference.ResourceType property. -// The resource type. -const ( - ShareMountTargetReferenceResourceTypeShareMountTargetConst = "share_mount_target" -) - -// UnmarshalShareMountTargetReference unmarshals an instance of ShareMountTargetReference from the specified map of raw messages. -func UnmarshalShareMountTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) - 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 -} - -// ShareMountTargetReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ShareMountTargetReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalShareMountTargetReferenceDeleted unmarshals an instance of ShareMountTargetReferenceDeleted from the specified map of raw messages. -func UnmarshalShareMountTargetReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetReferenceDeleted) - 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 -} - -// ShareMountTargetVirtualNetworkInterfacePrototype : ShareMountTargetVirtualNetworkInterfacePrototype struct -// Models which "extend" this model: -// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext -// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity -type ShareMountTargetVirtualNetworkInterfacePrototype 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"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. - AutoDelete *bool `json:"auto_delete,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"` - - // 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"` - - // 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 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"` - - // The resource group to use for this virtual network interface. If unspecified, the - // share's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,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"` -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototype) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { - return true -} - -type ShareMountTargetVirtualNetworkInterfacePrototypeIntf interface { - isaShareMountTargetVirtualNetworkInterfacePrototype() bool -} - -// UnmarshalShareMountTargetVirtualNetworkInterfacePrototype unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototype from the specified map of raw messages. -func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetVirtualNetworkInterfacePrototype) - 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 - } - 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.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) - 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()) - 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 -} - -// SharePatch : SharePatch struct -type SharePatch struct { - // The access control mode for the share: - // - // - `security_group`: The security groups on the virtual network interface for a - // mount target control access to the mount target. - // - `vpc`: All clients in the VPC for a mount target have access to the mount target. - // - // For this property to be changed, the share must have no mount targets and - // `replication_role` must be `none`. - AccessControlMode *string `json:"access_control_mode,omitempty"` - - // The maximum input/output operations per second (IOPS) for the file share. The value must be in the range supported - // by the share's size. - // - // For this property to be changed, the share `lifecycle_state` must be `stable` and - // `replication_role` must not be `replica`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this share. The name must not be used by another share in the region. - Name *string `json:"name,omitempty"` - - // The profile to use for this file share. - // - // The requested profile must be in the same `family`. - Profile ShareProfileIdentityIntf `json:"profile,omitempty"` - - // The cron specification for the file share replication schedule. - // - // Replication of a share can be scheduled to occur at most once per hour. - // - // For this property to be changed, the share `replication_role` must be `replica`. - ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` - - // The size of the file share rounded up to the next gigabyte. The value must not be less than the share's current - // size, and must not exceed the maximum supported by the share's profile and IOPS. - // - // For this property to be changed, the share `lifecycle_state` must be `stable` and - // `replication_role` must not be `replica`. - Size *int64 `json:"size,omitempty"` - - // Tags for this resource. - UserTags []string `json:"user_tags,omitempty"` -} - -// Constants associated with the SharePatch.AccessControlMode property. -// The access control mode for the share: -// -// - `security_group`: The security groups on the virtual network interface for a -// mount target control access to the mount target. -// - `vpc`: All clients in the VPC for a mount target have access to the mount target. -// -// For this property to be changed, the share must have no mount targets and -// `replication_role` must be `none`. -const ( - SharePatchAccessControlModeSecurityGroupConst = "security_group" - SharePatchAccessControlModeVPCConst = "vpc" -) - -// UnmarshalSharePatch unmarshals an instance of SharePatch from the specified map of raw messages. -func UnmarshalSharePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SharePatch) - err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) - if err != nil { - err = core.SDKErrorf(err, "", "access_control_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) - if err != nil { - err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// ShareProfile : ShareProfile struct -type ShareProfile struct { - // The permitted capacity range (in gigabytes) for a share with this profile. - Capacity ShareProfileCapacityIntf `json:"capacity" validate:"required"` - - // The product family this share profile belongs to. - Family *string `json:"family" validate:"required"` - - // The URL for this share profile. - Href *string `json:"href" validate:"required"` - - // The permitted IOPS range for a share with this profile. - Iops ShareProfileIopsIntf `json:"iops" validate:"required"` - - // The globally unique name for this share profile. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ShareProfile.Family property. -// The product family this share profile belongs to. -const ( - ShareProfileFamilyDefinedPerformanceConst = "defined_performance" -) - -// Constants associated with the ShareProfile.ResourceType property. -// The resource type. -const ( - ShareProfileResourceTypeShareProfileConst = "share_profile" -) - -// UnmarshalShareProfile unmarshals an instance of ShareProfile from the specified map of raw messages. -func UnmarshalShareProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfile) - err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalShareProfileCapacity) - if err != nil { - err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - err = core.SDKErrorf(err, "", "family-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.UnmarshalModel(m, "iops", &obj.Iops, UnmarshalShareProfileIops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-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 -} - -// ShareProfileCapacity : ShareProfileCapacity struct -// Models which "extend" this model: -// - ShareProfileCapacityFixed -// - ShareProfileCapacityRange -// - ShareProfileCapacityEnum -// - ShareProfileCapacityDependentRange -type ShareProfileCapacity 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 ShareProfileCapacity.Type property. -// The type for this profile field. -const ( - ShareProfileCapacityTypeFixedConst = "fixed" -) - -func (*ShareProfileCapacity) isaShareProfileCapacity() bool { - return true -} - -type ShareProfileCapacityIntf interface { - isaShareProfileCapacity() bool -} - -// UnmarshalShareProfileCapacity unmarshals an instance of ShareProfileCapacity from the specified map of raw messages. -func UnmarshalShareProfileCapacity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCapacity) - 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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileCollection : ShareProfileCollection struct -type ShareProfileCollection struct { - // A link to the first page of resources. - First *ShareProfileCollectionFirst `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"` - - // Collection of share profiles. - Profiles []ShareProfile `json:"profiles" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalShareProfileCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalShareProfile) - 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()) - 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 *ShareProfileCollection) 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 -} - -// 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 -// - ShareProfileIopsRange -// - ShareProfileIopsEnum -// - ShareProfileIopsDependentRange -type ShareProfileIops 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 ShareProfileIops.Type property. -// The type for this profile field. -const ( - ShareProfileIopsTypeFixedConst = "fixed" -) - -func (*ShareProfileIops) isaShareProfileIops() bool { - return true -} - -type ShareProfileIopsIntf interface { - isaShareProfileIops() bool -} - -// UnmarshalShareProfileIops unmarshals an instance of ShareProfileIops from the specified map of raw messages. -func UnmarshalShareProfileIops(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIops) - 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, "", "values-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileIdentity : Identifies a share profile by a unique property. -// Models which "extend" this model: -// - ShareProfileIdentityByName -// - ShareProfileIdentityByHref -type ShareProfileIdentity struct { - // The globally unique name for this share profile. - Name *string `json:"name,omitempty"` - - // The URL for this share profile. - Href *string `json:"href,omitempty"` -} - -func (*ShareProfileIdentity) isaShareProfileIdentity() bool { - return true -} - -type ShareProfileIdentityIntf interface { - isaShareProfileIdentity() bool -} - -// UnmarshalShareProfileIdentity unmarshals an instance of ShareProfileIdentity from the specified map of raw messages. -func UnmarshalShareProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIdentity) - 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 -} - -// ShareProfileReference : ShareProfileReference struct -type ShareProfileReference struct { - // The URL for this share profile. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this share profile. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ShareProfileReference.ResourceType property. -// The resource type. -const ( - ShareProfileReferenceResourceTypeShareProfileConst = "share_profile" -) - -// UnmarshalShareProfileReference unmarshals an instance of ShareProfileReference from the specified map of raw messages. -func UnmarshalShareProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-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 -} - -// SharePrototype : SharePrototype struct -// Models which "extend" this model: -// - SharePrototypeShareBySize -// - SharePrototypeShareBySourceShare -type SharePrototype struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the - // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. - // - // In addition, each client accessing the share will be restricted to 48,000 IOPS. - Iops *int64 `json:"iops,omitempty"` - - // The mount targets for the file share. Each mount target must be in a unique VPC. - MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` - - // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be - // a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use - // for this file share. The profile must support the share's specified IOPS and size. - Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - - // Configuration for a replica file share to create and associate with this file share. If - // unspecified, a replica may be subsequently added by creating a new file share with a - // `source_share` referencing this file share. - ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` - - // Tags for this resource. - UserTags []string `json:"user_tags,omitempty"` - - // The zone this file share will reside in. - // - // For a replica share, this must be a different zone in the same region as the - // source share. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The access control mode for the share: - // - // - `security_group`: The security groups on the virtual network interface for a - // mount target control access to the mount target. Mount targets for this share - // require a virtual network interface. - // - `vpc`: All clients in the VPC for a mount target have access to the mount target. - // Mount targets for this share require a VPC. - AccessControlMode *string `json:"access_control_mode,omitempty"` - - // The root key to use to wrap the data encryption key for the share. - // - // If unspecified, the `encryption` type for the share will be `provider_managed`. - // - // The specified key may be in a different account, subject to IAM policies. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The owner assigned to the file share at creation. Subsequent changes to the owner - // must be performed by a client that has mounted the file share. - InitialOwner *ShareInitialOwner `json:"initial_owner,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 size of the file share rounded up to the next gigabyte. - // - // The maximum size for a share may increase in the future. - Size *int64 `json:"size,omitempty"` - - // The cron specification for the file share replication schedule. - // - // Replication of a share can be scheduled to occur at most once per hour. - ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` - - // The source file share for this replica file share. The specified file share must not - // already have a replica, and must not be a replica. If source file share is specified - // by CRN, it may be in an [associated partner - // region](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-replication). - SourceShare ShareIdentityIntf `json:"source_share,omitempty"` -} - -// Constants associated with the SharePrototype.AccessControlMode property. -// The access control mode for the share: -// -// - `security_group`: The security groups on the virtual network interface for a -// mount target control access to the mount target. Mount targets for this share -// require a virtual network interface. -// - `vpc`: All clients in the VPC for a mount target have access to the mount target. -// Mount targets for this share require a VPC. -const ( - SharePrototypeAccessControlModeSecurityGroupConst = "security_group" - SharePrototypeAccessControlModeVPCConst = "vpc" -) - -func (*SharePrototype) isaSharePrototype() bool { - return true -} - -type SharePrototypeIntf interface { - isaSharePrototype() bool -} - -// UnmarshalSharePrototype unmarshals an instance of SharePrototype from the specified map of raw messages. -func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SharePrototype) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) - if err != nil { - err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) - if err != nil { - err = core.SDKErrorf(err, "", "access_control_mode-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, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) - if err != nil { - err = core.SDKErrorf(err, "", "initial_owner-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.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) - if err != nil { - err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SharePrototypeShareContext : Configuration for a replica file share to create and associate with this file share. If unspecified, a replica may be -// subsequently added by creating a new file share with a -// `source_share` referencing this file share. -type SharePrototypeShareContext struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the - // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. - // - // In addition, each client accessing the share will be restricted to 48,000 IOPS. - Iops *int64 `json:"iops,omitempty"` - - // The mount targets for this replica file share. Each mount target must be in a unique VPC. - // - // A replica's mount targets must be mounted read-only. - MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` - - // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be - // a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use - // for this file share. The profile must support the share's specified IOPS and size. - Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - - // The cron specification for the file share replication schedule. - // - // Replication of a share can be scheduled to occur at most once per hour. - ReplicationCronSpec *string `json:"replication_cron_spec" validate:"required"` - - // The resource group to use. If unspecified, the resource group from - // the source share will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // Tags for this resource. - UserTags []string `json:"user_tags,omitempty"` - - // The zone this replica file share will reside in. - // - // Must be a different zone in the same region as the source share. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` -} - -// NewSharePrototypeShareContext : Instantiate SharePrototypeShareContext (Generic Model Constructor) -func (*VpcV1) NewSharePrototypeShareContext(profile ShareProfileIdentityIntf, replicationCronSpec string, zone ZoneIdentityIntf) (_model *SharePrototypeShareContext, err error) { - _model = &SharePrototypeShareContext{ - Profile: profile, - ReplicationCronSpec: core.StringPtr(replicationCronSpec), - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalSharePrototypeShareContext unmarshals an instance of SharePrototypeShareContext from the specified map of raw messages. -func UnmarshalSharePrototypeShareContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SharePrototypeShareContext) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) - if err != nil { - err = core.SDKErrorf(err, "", "replication_cron_spec-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareReference : ShareReference struct -type ShareReference struct { - // The CRN for this file share. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ShareReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this file share. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this file share. - ID *string `json:"id" validate:"required"` - - // The name for this share. The name is unique across all shares in the region. - 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 *ShareRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ShareReference.ResourceType property. -// The resource type. -const ( - ShareReferenceResourceTypeShareConst = "share" -) - -// UnmarshalShareReference unmarshals an instance of ShareReference from the specified map of raw messages. -func UnmarshalShareReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareReference) - 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, UnmarshalShareReferenceDeleted) - 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, UnmarshalShareRemote) - 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 -} - -// ShareReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ShareReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalShareReferenceDeleted unmarshals an instance of ShareReferenceDeleted from the specified map of raw messages. -func UnmarshalShareReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareReferenceDeleted) - 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 -} - -// ShareRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not -// be directly retrievable. -type ShareRemote 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"` -} - -// UnmarshalShareRemote unmarshals an instance of ShareRemote from the specified map of raw messages. -func UnmarshalShareRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareRemote) - 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 -} - -// ShareReplicationStatusReason : ShareReplicationStatusReason struct -type ShareReplicationStatusReason struct { - // A snake case string succinctly identifying the status reason. - // - // 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 ShareReplicationStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - ShareReplicationStatusReasonCodeCannotInitializeReplicationConst = "cannot_initialize_replication" - ShareReplicationStatusReasonCodeCannotReachReplicaShareConst = "cannot_reach_replica_share" - ShareReplicationStatusReasonCodeCannotReachSourceShareConst = "cannot_reach_source_share" -) - -// UnmarshalShareReplicationStatusReason unmarshals an instance of ShareReplicationStatusReason from the specified map of raw messages. -func UnmarshalShareReplicationStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareReplicationStatusReason) - 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 -} - -// Snapshot : Snapshot struct -type Snapshot struct { - // If present, the backup policy plan which created this snapshot. - BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan,omitempty"` - - // Indicates if a boot volume attachment can be created with a volume created from this snapshot. - Bootable *bool `json:"bootable" validate:"required"` - - // The date and time the data capture for this snapshot was completed. - // - // If absent, this snapshot's data has not yet been captured. Additionally, this property may be absent for snapshots - // created before 1 January 2022. - CapturedAt *strfmt.DateTime `json:"captured_at,omitempty"` - - // Clones for this snapshot. - Clones []SnapshotClone `json:"clones" validate:"required"` - - // The copies of this snapshot. - Copies []SnapshotCopiesItem `json:"copies" validate:"required"` - - // The date and time that this snapshot was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN of this snapshot. - CRN *string `json:"crn" validate:"required"` - - // Indicates whether this snapshot can be deleted. This value will always be `true`. - // Deprecated: this field is deprecated and may be removed in a future release. - Deletable *bool `json:"deletable" validate:"required"` - - // The type of encryption used on the source volume. - Encryption *string `json:"encryption" validate:"required"` - - // The root key used to wrap the data encryption key for the source volume. - // - // This property will be present for volumes with an `encryption` type of - // `user_managed`. - EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` - - // The URL for this snapshot. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this snapshot. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of this snapshot. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The minimum capacity of a volume created from this snapshot. When a snapshot is created, this will be set to the - // capacity of the `source_volume`. - MinimumCapacity *int64 `json:"minimum_capacity" validate:"required"` - - // The name for this snapshot. The name is unique across all snapshots in the region. - Name *string `json:"name" validate:"required"` - - // The operating system included in this snapshot. - OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` - - // The resource group for this snapshot. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) prefixed with `is.snapshot:` associated with - // this snapshot. - ServiceTags []string `json:"service_tags" validate:"required"` - - // The size of this snapshot rounded up to the next gigabyte. - Size *int64 `json:"size" validate:"required"` - - // If present, the snapshot consistency group which created this snapshot. - SnapshotConsistencyGroup *SnapshotConsistencyGroupReference `json:"snapshot_consistency_group,omitempty"` - - // If present, the image from which the data on this snapshot was most directly - // provisioned. - SourceImage *ImageReference `json:"source_image,omitempty"` - - // If present, the source snapshot this snapshot was created from. - SourceSnapshot *SnapshotSourceSnapshot `json:"source_snapshot,omitempty"` - - // The source volume this snapshot was created from (may be - // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - SourceVolume *VolumeReference `json:"source_volume" validate:"required"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. - UserTags []string `json:"user_tags" validate:"required"` -} - -// Constants associated with the Snapshot.Encryption property. -// The type of encryption used on the source volume. -const ( - SnapshotEncryptionProviderManagedConst = "provider_managed" - SnapshotEncryptionUserManagedConst = "user_managed" -) - -// Constants associated with the Snapshot.LifecycleState property. -// The lifecycle state of this snapshot. -const ( - SnapshotLifecycleStateDeletingConst = "deleting" - SnapshotLifecycleStateFailedConst = "failed" - SnapshotLifecycleStatePendingConst = "pending" - SnapshotLifecycleStateStableConst = "stable" - SnapshotLifecycleStateSuspendedConst = "suspended" - SnapshotLifecycleStateUpdatingConst = "updating" - SnapshotLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the Snapshot.ResourceType property. -// The resource type. -const ( - SnapshotResourceTypeSnapshotConst = "snapshot" -) - -// UnmarshalSnapshot unmarshals an instance of Snapshot from the specified map of raw messages. -func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Snapshot) - 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, "bootable", &obj.Bootable) - if err != nil { - err = core.SDKErrorf(err, "", "bootable-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "captured_at", &obj.CapturedAt) - if err != nil { - err = core.SDKErrorf(err, "", "captured_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) - if err != nil { - err = core.SDKErrorf(err, "", "clones-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "copies", &obj.Copies, UnmarshalSnapshotCopiesItem) - if err != nil { - err = core.SDKErrorf(err, "", "copies-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "deletable", &obj.Deletable) - if err != nil { - err = core.SDKErrorf(err, "", "deletable-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) - if err != nil { - err = core.SDKErrorf(err, "", "encryption-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.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, "minimum_capacity", &obj.MinimumCapacity) - if err != nil { - err = core.SDKErrorf(err, "", "minimum_capacity-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, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) - if err != nil { - err = core.SDKErrorf(err, "", "operating_system-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.UnmarshalPrimitive(m, "service_tags", &obj.ServiceTags) - if err != nil { - err = core.SDKErrorf(err, "", "service_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "snapshot_consistency_group", &obj.SnapshotConsistencyGroup, UnmarshalSnapshotConsistencyGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "snapshot_consistency_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_image", &obj.SourceImage, UnmarshalImageReference) - if err != nil { - err = core.SDKErrorf(err, "", "source_image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotSourceSnapshot) - if err != nil { - err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeReference) - if err != nil { - err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotClone : SnapshotClone struct -type SnapshotClone struct { - // Indicates whether this snapshot clone is available for use. - Available *bool `json:"available" validate:"required"` - - // The date and time that this snapshot clone was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The zone this snapshot clone resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// UnmarshalSnapshotClone unmarshals an instance of SnapshotClone from the specified map of raw messages. -func UnmarshalSnapshotClone(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotClone) - err = core.UnmarshalPrimitive(m, "available", &obj.Available) - if err != nil { - err = core.SDKErrorf(err, "", "available-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, "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 -} - -// SnapshotCloneCollection : SnapshotCloneCollection struct -type SnapshotCloneCollection struct { - // Collection of snapshot clones. - Clones []SnapshotClone `json:"clones" validate:"required"` -} - -// UnmarshalSnapshotCloneCollection unmarshals an instance of SnapshotCloneCollection from the specified map of raw messages. -func UnmarshalSnapshotCloneCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotCloneCollection) - err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) - if err != nil { - err = core.SDKErrorf(err, "", "clones-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotClonePrototype : SnapshotClonePrototype struct -type SnapshotClonePrototype struct { - // The zone this snapshot clone will reside in. Must be in the same region as the - // snapshot. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` -} - -// NewSnapshotClonePrototype : Instantiate SnapshotClonePrototype (Generic Model Constructor) -func (*VpcV1) NewSnapshotClonePrototype(zone ZoneIdentityIntf) (_model *SnapshotClonePrototype, err error) { - _model = &SnapshotClonePrototype{ - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalSnapshotClonePrototype unmarshals an instance of SnapshotClonePrototype from the specified map of raw messages. -func UnmarshalSnapshotClonePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotClonePrototype) - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotCollection : SnapshotCollection struct -type SnapshotCollection struct { - // A link to the first page of resources. - First *SnapshotCollectionFirst `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"` - - // Collection of snapshots. - Snapshots []Snapshot `json:"snapshots" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalSnapshotCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshot) - if err != nil { - err = core.SDKErrorf(err, "", "snapshots-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 *SnapshotCollection) 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 -} - -// 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. - BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan,omitempty"` - - // The date and time that this snapshot consistency group was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN of this snapshot consistency group. - CRN *string `json:"crn" validate:"required"` - - // Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. - DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete" validate:"required"` - - // The URL for this snapshot consistency group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this snapshot consistency group. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of this snapshot consistency group. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the - // region. - Name *string `json:"name" validate:"required"` - - // The resource group for this snapshot consistency group. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The [service tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot consistency - // group. Each tag is prefixed with - // [is.instance:](https://cloud.ibm.com/docs/vpc?topic=vpc-snapshots-vpc-faqs). - ServiceTags []string `json:"service_tags" validate:"required"` - - // The member snapshots that are data-consistent with respect to captured time. (may be - // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - Snapshots []SnapshotReference `json:"snapshots" validate:"required"` -} - -// Constants associated with the SnapshotConsistencyGroup.LifecycleState property. -// The lifecycle state of this snapshot consistency group. -const ( - SnapshotConsistencyGroupLifecycleStateDeletingConst = "deleting" - SnapshotConsistencyGroupLifecycleStateFailedConst = "failed" - SnapshotConsistencyGroupLifecycleStatePendingConst = "pending" - SnapshotConsistencyGroupLifecycleStateStableConst = "stable" - SnapshotConsistencyGroupLifecycleStateSuspendedConst = "suspended" - SnapshotConsistencyGroupLifecycleStateUpdatingConst = "updating" - SnapshotConsistencyGroupLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the SnapshotConsistencyGroup.ResourceType property. -// The resource type. -const ( - SnapshotConsistencyGroupResourceTypeSnapshotConsistencyGroupConst = "snapshot_consistency_group" -) - -// UnmarshalSnapshotConsistencyGroup unmarshals an instance of SnapshotConsistencyGroup from the specified map of raw messages. -func UnmarshalSnapshotConsistencyGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotConsistencyGroup) - 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, "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.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) - if err != nil { - err = core.SDKErrorf(err, "", "delete_snapshots_on_delete-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, "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.UnmarshalPrimitive(m, "service_tags", &obj.ServiceTags) - if err != nil { - err = core.SDKErrorf(err, "", "service_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotReference) - if err != nil { - err = core.SDKErrorf(err, "", "snapshots-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotConsistencyGroupCollection : SnapshotConsistencyGroupCollection struct -type SnapshotConsistencyGroupCollection struct { - // A link to the first page of resources. - First *SnapshotConsistencyGroupCollectionFirst `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"` - - // Collection of snapshot consistency groups. - SnapshotConsistencyGroups []SnapshotConsistencyGroup `json:"snapshot_consistency_groups" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalSnapshotConsistencyGroupCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "snapshot_consistency_groups", &obj.SnapshotConsistencyGroups, UnmarshalSnapshotConsistencyGroup) - if err != nil { - err = core.SDKErrorf(err, "", "snapshot_consistency_groups-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 *SnapshotConsistencyGroupCollection) 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 -} - -// 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. - DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete,omitempty"` - - // The name for this snapshot consistency group. The name must not be used by another snapshot consistency groups in - // the region. - Name *string `json:"name,omitempty"` -} - -// UnmarshalSnapshotConsistencyGroupPatch unmarshals an instance of SnapshotConsistencyGroupPatch from the specified map of raw messages. -func UnmarshalSnapshotConsistencyGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotConsistencyGroupPatch) - err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) - if err != nil { - err = core.SDKErrorf(err, "", "delete_snapshots_on_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 -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// SnapshotConsistencyGroupPrototype : SnapshotConsistencyGroupPrototype struct -// Models which "extend" this model: -// - SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots -type SnapshotConsistencyGroupPrototype struct { - // Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. - DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete,omitempty"` - - // The name for this snapshot consistency group. The name must be unique across all snapshot consistency groups in the - // region. - // - // 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"` - - // The data-consistent member snapshots to create. All snapshots must specify a - // `source_volume` attached to the same virtual server instance. - Snapshots []SnapshotPrototypeSnapshotConsistencyGroupContext `json:"snapshots,omitempty"` -} - -func (*SnapshotConsistencyGroupPrototype) isaSnapshotConsistencyGroupPrototype() bool { - return true -} - -type SnapshotConsistencyGroupPrototypeIntf interface { - isaSnapshotConsistencyGroupPrototype() bool -} - -// UnmarshalSnapshotConsistencyGroupPrototype unmarshals an instance of SnapshotConsistencyGroupPrototype from the specified map of raw messages. -func UnmarshalSnapshotConsistencyGroupPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotConsistencyGroupPrototype) - err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) - if err != nil { - err = core.SDKErrorf(err, "", "delete_snapshots_on_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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext) - if err != nil { - err = core.SDKErrorf(err, "", "snapshots-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotConsistencyGroupReference : SnapshotConsistencyGroupReference struct -type SnapshotConsistencyGroupReference struct { - // The CRN of this snapshot consistency group. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SnapshotConsistencyGroupReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this snapshot consistency group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this snapshot consistency group. - ID *string `json:"id" validate:"required"` - - // The name for this snapshot consistency group. The name is unique across all snapshot consistency groups in the - // region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SnapshotConsistencyGroupReference.ResourceType property. -// The resource type. -const ( - SnapshotConsistencyGroupReferenceResourceTypeSnapshotConsistencyGroupConst = "snapshot_consistency_group" -) - -// UnmarshalSnapshotConsistencyGroupReference unmarshals an instance of SnapshotConsistencyGroupReference from the specified map of raw messages. -func UnmarshalSnapshotConsistencyGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotConsistencyGroupReference) - 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, UnmarshalSnapshotConsistencyGroupReferenceDeleted) - 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 -} - -// SnapshotConsistencyGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type SnapshotConsistencyGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalSnapshotConsistencyGroupReferenceDeleted unmarshals an instance of SnapshotConsistencyGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalSnapshotConsistencyGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotConsistencyGroupReferenceDeleted) - 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 -} - -// SnapshotCopiesItem : SnapshotCopiesItem struct -type SnapshotCopiesItem struct { - // The CRN for the copied snapshot. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` - - // The URL for the copied snapshot. - Href *string `json:"href" validate:"required"` - - // The unique identifier for the copied snapshot. - ID *string `json:"id" validate:"required"` - - // The name for the copied snapshot. - 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 *SnapshotRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SnapshotCopiesItem.ResourceType property. -// The resource type. -const ( - SnapshotCopiesItemResourceTypeSnapshotConst = "snapshot" -) - -// UnmarshalSnapshotCopiesItem unmarshals an instance of SnapshotCopiesItem from the specified map of raw messages. -func UnmarshalSnapshotCopiesItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotCopiesItem) - 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, UnmarshalSnapshotReferenceDeleted) - 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, UnmarshalSnapshotRemote) - 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 -} - -// SnapshotIdentity : Identifies a snapshot by a unique property. -// Models which "extend" this model: -// - SnapshotIdentityByID -// - SnapshotIdentityByCRN -// - SnapshotIdentityByHref -type SnapshotIdentity struct { - // The unique identifier for this snapshot. - ID *string `json:"id,omitempty"` - - // The CRN of this snapshot. - CRN *string `json:"crn,omitempty"` - - // The URL for this snapshot. - Href *string `json:"href,omitempty"` -} - -func (*SnapshotIdentity) isaSnapshotIdentity() bool { - return true -} - -type SnapshotIdentityIntf interface { - isaSnapshotIdentity() bool -} - -// UnmarshalSnapshotIdentity unmarshals an instance of SnapshotIdentity from the specified map of raw messages. -func UnmarshalSnapshotIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotPatch : SnapshotPatch struct -type SnapshotPatch struct { - // The name for this snapshot. The name must not be used by another snapshot in the region. - Name *string `json:"name,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. - UserTags []string `json:"user_tags,omitempty"` -} - -// UnmarshalSnapshotPatch unmarshals an instance of SnapshotPatch from the specified map of raw messages. -func UnmarshalSnapshotPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// SnapshotPrototype : SnapshotPrototype struct -// Models which "extend" this model: -// - SnapshotPrototypeSnapshotBySourceVolume -// - SnapshotPrototypeSnapshotBySourceSnapshot -type SnapshotPrototype struct { - // Clones to create for this snapshot. - Clones []SnapshotClonePrototype `json:"clones,omitempty"` - - // The name for this snapshot. The name must not be used by another snapshot in the region. 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"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. - UserTags []string `json:"user_tags,omitempty"` - - // The volume to create this snapshot from. - SourceVolume VolumeIdentityIntf `json:"source_volume,omitempty"` - - // The root key to use to wrap the data encryption key for this snapshot. - // - // A key must be specified if and only if the source snapshot has an `encryption` type of - // `user_managed`. To maximize snapshot availability and sharing of snapshot data, specify - // a key in the same region as the new snapshot, and use the same encryption key for all - // snapshots using the same source volume. - // - // The specified key may be in a different account, subject to IAM policies. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The source snapshot (in another region) to create this snapshot from. - // The specified snapshot must not already be the source of another snapshot in this - // region. - SourceSnapshot *SnapshotIdentityByCRN `json:"source_snapshot,omitempty"` -} - -func (*SnapshotPrototype) isaSnapshotPrototype() bool { - return true -} - -type SnapshotPrototypeIntf interface { - isaSnapshotPrototype() bool -} - -// UnmarshalSnapshotPrototype unmarshals an instance of SnapshotPrototype from the specified map of raw messages. -func UnmarshalSnapshotPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotPrototype) - err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "clones-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_volume-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) - if err != nil { - err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotPrototypeSnapshotConsistencyGroupContext : SnapshotPrototypeSnapshotConsistencyGroupContext struct -type SnapshotPrototypeSnapshotConsistencyGroupContext struct { - // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The volume to create this snapshot from. - SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. - UserTags []string `json:"user_tags,omitempty"` -} - -// NewSnapshotPrototypeSnapshotConsistencyGroupContext : Instantiate SnapshotPrototypeSnapshotConsistencyGroupContext (Generic Model Constructor) -func (*VpcV1) NewSnapshotPrototypeSnapshotConsistencyGroupContext(sourceVolume VolumeIdentityIntf) (_model *SnapshotPrototypeSnapshotConsistencyGroupContext, err error) { - _model = &SnapshotPrototypeSnapshotConsistencyGroupContext{ - SourceVolume: sourceVolume, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext unmarshals an instance of SnapshotPrototypeSnapshotConsistencyGroupContext from the specified map of raw messages. -func UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotPrototypeSnapshotConsistencyGroupContext) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotReference : SnapshotReference struct -type SnapshotReference struct { - // The CRN of this snapshot. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this snapshot. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this snapshot. - ID *string `json:"id" validate:"required"` - - // The name for this snapshot. The name is unique across all snapshots in the region. - 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 *SnapshotRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SnapshotReference.ResourceType property. -// The resource type. -const ( - SnapshotReferenceResourceTypeSnapshotConst = "snapshot" -) - -// UnmarshalSnapshotReference unmarshals an instance of SnapshotReference from the specified map of raw messages. -func UnmarshalSnapshotReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotReference) - 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, UnmarshalSnapshotReferenceDeleted) - 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, UnmarshalSnapshotRemote) - 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 -} - -// SnapshotReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type SnapshotReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalSnapshotReferenceDeleted unmarshals an instance of SnapshotReferenceDeleted from the specified map of raw messages. -func UnmarshalSnapshotReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotReferenceDeleted) - 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 -} - -// SnapshotRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not -// be directly retrievable. -type SnapshotRemote 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"` -} - -// UnmarshalSnapshotRemote unmarshals an instance of SnapshotRemote from the specified map of raw messages. -func UnmarshalSnapshotRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotRemote) - 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 -} - -// SnapshotSourceSnapshot : If present, the source snapshot this snapshot was created from. -type SnapshotSourceSnapshot struct { - // The CRN of the source snapshot. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` - - // The URL for the source snapshot. - Href *string `json:"href" validate:"required"` - - // The unique identifier for the source snapshot. - ID *string `json:"id" validate:"required"` - - // The name for the source snapshot. The name is unique across all snapshots in the source snapshot's native region. - 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 *SnapshotRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SnapshotSourceSnapshot.ResourceType property. -// The resource type. -const ( - SnapshotSourceSnapshotResourceTypeSnapshotConst = "snapshot" -) - -// UnmarshalSnapshotSourceSnapshot unmarshals an instance of SnapshotSourceSnapshot from the specified map of raw messages. -func UnmarshalSnapshotSourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotSourceSnapshot) - 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, UnmarshalSnapshotReferenceDeleted) - 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, UnmarshalSnapshotRemote) - 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 -} - -// StartBareMetalServerOptions : The StartBareMetalServer options. -type StartBareMetalServerOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewStartBareMetalServerOptions : Instantiate StartBareMetalServerOptions -func (*VpcV1) NewStartBareMetalServerOptions(id string) *StartBareMetalServerOptions { - return &StartBareMetalServerOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *StartBareMetalServerOptions) SetID(id string) *StartBareMetalServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *StartBareMetalServerOptions) SetHeaders(param map[string]string) *StartBareMetalServerOptions { - options.Headers = param - return options -} - -// StopBareMetalServerOptions : The StopBareMetalServer options. -type StopBareMetalServerOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // The type of stop operation: - // - `soft`: signal running operating system to quiesce and shutdown cleanly - // - `hard`: immediately stop the server. - Type *string `json:"type" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the StopBareMetalServerOptions.Type property. -// The type of stop operation: -// - `soft`: signal running operating system to quiesce and shutdown cleanly -// - `hard`: immediately stop the server. -const ( - StopBareMetalServerOptionsTypeHardConst = "hard" - StopBareMetalServerOptionsTypeSoftConst = "soft" -) - -// NewStopBareMetalServerOptions : Instantiate StopBareMetalServerOptions -func (*VpcV1) NewStopBareMetalServerOptions(id string, typeVar string) *StopBareMetalServerOptions { - return &StopBareMetalServerOptions{ - ID: core.StringPtr(id), - Type: core.StringPtr(typeVar), - } -} - -// SetID : Allow user to set ID -func (_options *StopBareMetalServerOptions) SetID(id string) *StopBareMetalServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetType : Allow user to set Type -func (_options *StopBareMetalServerOptions) SetType(typeVar string) *StopBareMetalServerOptions { - _options.Type = core.StringPtr(typeVar) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *StopBareMetalServerOptions) SetHeaders(param map[string]string) *StopBareMetalServerOptions { - options.Headers = param - return options -} - -// Subnet : Subnet struct -type Subnet struct { - // The number of IPv4 addresses in this 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 date and time that the subnet was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this subnet. - CRN *string `json:"crn" validate:"required"` - - // The URL for this subnet. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this subnet. - ID *string `json:"id" validate:"required"` - - // The IP version(s) supported by this subnet. - IPVersion *string `json:"ip_version" validate:"required"` - - // The IPv4 range of the subnet, expressed in CIDR format. - Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` - - // The name for this subnet. The name is unique across all subnets in the VPC. - Name *string `json:"name" validate:"required"` - - // The network ACL for this subnet. - NetworkACL *NetworkACLReference `json:"network_acl" validate:"required"` - - // The public gateway to use for internet-bound traffic for this subnet. - PublicGateway *PublicGatewayReference `json:"public_gateway,omitempty"` - - // The resource group for this subnet. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The routing table for this subnet. - RoutingTable *RoutingTableReference `json:"routing_table" validate:"required"` - - // The status of the subnet. - Status *string `json:"status" validate:"required"` - - // The total number of IPv4 addresses in this 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"` - - // The VPC this subnet resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // The zone this subnet resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the Subnet.IPVersion property. -// The IP version(s) supported by this subnet. -const ( - SubnetIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the Subnet.ResourceType property. -// The resource type. -const ( - SubnetResourceTypeSubnetConst = "subnet" -) - -// Constants associated with the Subnet.Status property. -// The status of the subnet. -const ( - SubnetStatusAvailableConst = "available" - SubnetStatusDeletingConst = "deleting" - SubnetStatusFailedConst = "failed" - SubnetStatusPendingConst = "pending" -) - -// UnmarshalSubnet unmarshals an instance of Subnet from the specified map of raw messages. -func UnmarshalSubnet(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Subnet) - err = core.UnmarshalPrimitive(m, "available_ipv4_address_count", &obj.AvailableIpv4AddressCount) - if err != nil { - err = core.SDKErrorf(err, "", "available_ipv4_address_count-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-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, "ip_version", &obj.IPVersion) - if err != nil { - err = core.SDKErrorf(err, "", "ip_version-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 - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLReference) - if err != nil { - err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayReference) - if err != nil { - err = core.SDKErrorf(err, "", "public_gateway-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, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableReference) - if err != nil { - err = core.SDKErrorf(err, "", "routing_table-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.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) - if err != nil { - err = core.SDKErrorf(err, "", "total_ipv4_address_count-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 -} - -// SubnetCollection : SubnetCollection struct -type SubnetCollection struct { - // A link to the first page of resources. - First *SubnetCollectionFirst `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"` - - // Collection of subnets. - Subnets []Subnet `json:"subnets" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalSubnetCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnet) - 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 -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *SubnetCollection) 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 -} - -// 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 -// - SubnetIdentityByCRN -// - SubnetIdentityByHref -type SubnetIdentity struct { - // The unique identifier for this subnet. - ID *string `json:"id,omitempty"` - - // The CRN for this subnet. - CRN *string `json:"crn,omitempty"` - - // The URL for this subnet. - Href *string `json:"href,omitempty"` -} - -func (*SubnetIdentity) isaSubnetIdentity() bool { - return true -} - -type SubnetIdentityIntf interface { - isaSubnetIdentity() bool -} - -// UnmarshalSubnetIdentity unmarshals an instance of SubnetIdentity from the specified map of raw messages. -func UnmarshalSubnetIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetPatch : SubnetPatch struct -type SubnetPatch struct { - // The name for this subnet. The name must not be used by another subnet in the VPC. - Name *string `json:"name,omitempty"` - - // The network ACL to use for this subnet. - NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` - - // The public gateway to use for internet-bound traffic for this subnet. - PublicGateway SubnetPublicGatewayPatchIntf `json:"public_gateway,omitempty"` - - // The routing table to use for this subnet. The routing table properties - // `route_direct_link_ingress`, `route_internet_ingress`, - // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. - RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` -} - -// UnmarshalSubnetPatch unmarshals an instance of SubnetPatch from the specified map of raw messages. -func UnmarshalSubnetPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalSubnetPublicGatewayPatch) - if err != nil { - err = core.SDKErrorf(err, "", "public_gateway-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// SubnetPrototype : SubnetPrototype struct -// Models which "extend" this model: -// - SubnetPrototypeSubnetByTotalCount -// - SubnetPrototypeSubnetByCIDR -type SubnetPrototype struct { - // The IP version(s) to support for this subnet. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a - // hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The network ACL to use for this subnet. - NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` - - // The public gateway to use for internet-bound traffic for this subnet. If - // unspecified, the subnet will not be attached to a public gateway. - PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,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 routing table to use for this subnet. If unspecified, the default routing table - // for the VPC is used. The routing table properties `route_direct_link_ingress`, - // `route_internet_ingress`, `route_transit_gateway_ingress`, and - // `route_vpc_zone_ingress` must be `false`. - RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` - - // The VPC the subnet will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The total number of IPv4 addresses required. Must be a power of 2. The VPC must have a default address prefix in the - // specified zone, and that prefix must have a free CIDR range with at least this number of addresses. - TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count,omitempty"` - - // The zone this subnet will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` - - // The IPv4 range of the subnet, expressed in CIDR format. The prefix length of the subnet's CIDR must be between `/9` - // (8,388,608 addresses) and `/29` (8 addresses). The IPv4 range of the subnet's CIDR must fall within an existing - // address prefix in the VPC and must not overlap with any existing subnet. The subnet will be created in the zone of - // the address prefix that contains the IPv4 CIDR. If zone is specified, it must match the zone of the address prefix - // that contains the subnet's IPv4 CIDR. - Ipv4CIDRBlock *string `json:"ipv4_cidr_block,omitempty"` -} - -// Constants associated with the SubnetPrototype.IPVersion property. -// The IP version(s) to support for this subnet. -const ( - SubnetPrototypeIPVersionIpv4Const = "ipv4" -) - -func (*SubnetPrototype) isaSubnetPrototype() bool { - return true -} - -type SubnetPrototypeIntf interface { - isaSubnetPrototype() bool -} - -// UnmarshalSubnetPrototype unmarshals an instance of SubnetPrototype from the specified map of raw messages. -func UnmarshalSubnetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPrototype) - 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.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "public_gateway-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, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-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 - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-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 -} - -// SubnetPublicGatewayPatch : The public gateway to use for internet-bound traffic for this subnet. -// Models which "extend" this model: -// - SubnetPublicGatewayPatchPublicGatewayIdentityByID -// - SubnetPublicGatewayPatchPublicGatewayIdentityByCRN -// - SubnetPublicGatewayPatchPublicGatewayIdentityByHref -type SubnetPublicGatewayPatch struct { - // The unique identifier for this public gateway. - ID *string `json:"id,omitempty"` - - // The CRN for this public gateway. - CRN *string `json:"crn,omitempty"` - - // The URL for this public gateway. - Href *string `json:"href,omitempty"` -} - -func (*SubnetPublicGatewayPatch) isaSubnetPublicGatewayPatch() bool { - return true -} - -type SubnetPublicGatewayPatchIntf interface { - isaSubnetPublicGatewayPatch() bool -} - -// UnmarshalSubnetPublicGatewayPatch unmarshals an instance of SubnetPublicGatewayPatch from the specified map of raw messages. -func UnmarshalSubnetPublicGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPublicGatewayPatch) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetReference : SubnetReference struct -type SubnetReference struct { - // The CRN for this subnet. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SubnetReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this subnet. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this subnet. - ID *string `json:"id" validate:"required"` - - // The name for this subnet. The name is unique across all subnets in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SubnetReference.ResourceType property. -// The resource type. -const ( - SubnetReferenceResourceTypeSubnetConst = "subnet" -) - -// UnmarshalSubnetReference unmarshals an instance of SubnetReference from the specified map of raw messages. -func UnmarshalSubnetReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetReference) - 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, UnmarshalSubnetReferenceDeleted) - 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 -} - -// SubnetReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type SubnetReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalSubnetReferenceDeleted unmarshals an instance of SubnetReferenceDeleted from the specified map of raw messages. -func UnmarshalSubnetReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetReferenceDeleted) - 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 -} - -// TrustedProfileIdentity : Identifies a trusted profile by a unique property. -// Models which "extend" this model: -// - TrustedProfileIdentityTrustedProfileByID -// - TrustedProfileIdentityTrustedProfileByCRN -type TrustedProfileIdentity struct { - // The unique identifier for this trusted profile. - ID *string `json:"id,omitempty"` - - // The CRN for this trusted profile. - CRN *string `json:"crn,omitempty"` -} - -func (*TrustedProfileIdentity) isaTrustedProfileIdentity() bool { - return true -} - -type TrustedProfileIdentityIntf interface { - isaTrustedProfileIdentity() bool -} - -// UnmarshalTrustedProfileIdentity unmarshals an instance of TrustedProfileIdentity from the specified map of raw messages. -func UnmarshalTrustedProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(TrustedProfileIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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 -} - -// TrustedProfileReference : TrustedProfileReference struct -type TrustedProfileReference struct { - // The CRN for this trusted profile. - CRN *string `json:"crn" validate:"required"` - - // The unique identifier for this trusted profile. - ID *string `json:"id" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the TrustedProfileReference.ResourceType property. -// The resource type. -const ( - TrustedProfileReferenceResourceTypeTrustedProfileConst = "trusted_profile" -) - -// UnmarshalTrustedProfileReference unmarshals an instance of TrustedProfileReference from the specified map of raw messages. -func UnmarshalTrustedProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(TrustedProfileReference) - 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, "", "resource_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// UnsetSubnetPublicGatewayOptions : The UnsetSubnetPublicGateway options. -type UnsetSubnetPublicGatewayOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUnsetSubnetPublicGatewayOptions : Instantiate UnsetSubnetPublicGatewayOptions -func (*VpcV1) NewUnsetSubnetPublicGatewayOptions(id string) *UnsetSubnetPublicGatewayOptions { - return &UnsetSubnetPublicGatewayOptions{ - ID: core.StringPtr(id), - } -} - -// SetID : Allow user to set ID -func (_options *UnsetSubnetPublicGatewayOptions) SetID(id string) *UnsetSubnetPublicGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UnsetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *UnsetSubnetPublicGatewayOptions { - options.Headers = param - return options -} - -// UpdateBackupPolicyOptions : The UpdateBackupPolicy options. -type UpdateBackupPolicyOptions struct { - // The backup policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // The backup policy patch. - BackupPolicyPatch map[string]interface{} `json:"BackupPolicy_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 -} - -// NewUpdateBackupPolicyOptions : Instantiate UpdateBackupPolicyOptions -func (*VpcV1) NewUpdateBackupPolicyOptions(id string, backupPolicyPatch map[string]interface{}) *UpdateBackupPolicyOptions { - return &UpdateBackupPolicyOptions{ - ID: core.StringPtr(id), - BackupPolicyPatch: backupPolicyPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateBackupPolicyOptions) SetID(id string) *UpdateBackupPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetBackupPolicyPatch : Allow user to set BackupPolicyPatch -func (_options *UpdateBackupPolicyOptions) SetBackupPolicyPatch(backupPolicyPatch map[string]interface{}) *UpdateBackupPolicyOptions { - _options.BackupPolicyPatch = backupPolicyPatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateBackupPolicyOptions) SetIfMatch(ifMatch string) *UpdateBackupPolicyOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateBackupPolicyOptions) SetHeaders(param map[string]string) *UpdateBackupPolicyOptions { - options.Headers = param - return options -} - -// UpdateBackupPolicyPlanOptions : The UpdateBackupPolicyPlan options. -type UpdateBackupPolicyPlanOptions struct { - // The backup policy identifier. - BackupPolicyID *string `json:"backup_policy_id" validate:"required,ne="` - - // The backup policy plan identifier. - ID *string `json:"id" validate:"required,ne="` - - // The backup policy plan patch. - BackupPolicyPlanPatch map[string]interface{} `json:"BackupPolicyPlan_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 -} - -// NewUpdateBackupPolicyPlanOptions : Instantiate UpdateBackupPolicyPlanOptions -func (*VpcV1) NewUpdateBackupPolicyPlanOptions(backupPolicyID string, id string, backupPolicyPlanPatch map[string]interface{}) *UpdateBackupPolicyPlanOptions { - return &UpdateBackupPolicyPlanOptions{ - BackupPolicyID: core.StringPtr(backupPolicyID), - ID: core.StringPtr(id), - BackupPolicyPlanPatch: backupPolicyPlanPatch, - } -} - -// SetBackupPolicyID : Allow user to set BackupPolicyID -func (_options *UpdateBackupPolicyPlanOptions) SetBackupPolicyID(backupPolicyID string) *UpdateBackupPolicyPlanOptions { - _options.BackupPolicyID = core.StringPtr(backupPolicyID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateBackupPolicyPlanOptions) SetID(id string) *UpdateBackupPolicyPlanOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetBackupPolicyPlanPatch : Allow user to set BackupPolicyPlanPatch -func (_options *UpdateBackupPolicyPlanOptions) SetBackupPolicyPlanPatch(backupPolicyPlanPatch map[string]interface{}) *UpdateBackupPolicyPlanOptions { - _options.BackupPolicyPlanPatch = backupPolicyPlanPatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateBackupPolicyPlanOptions) SetIfMatch(ifMatch string) *UpdateBackupPolicyPlanOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateBackupPolicyPlanOptions) SetHeaders(param map[string]string) *UpdateBackupPolicyPlanOptions { - options.Headers = param - return options -} - -// UpdateBareMetalServerDiskOptions : The UpdateBareMetalServerDisk options. -type UpdateBareMetalServerDiskOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server disk identifier. - ID *string `json:"id" validate:"required,ne="` - - // The bare metal server disk patch. - BareMetalServerDiskPatch map[string]interface{} `json:"BareMetalServerDisk_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateBareMetalServerDiskOptions : Instantiate UpdateBareMetalServerDiskOptions -func (*VpcV1) NewUpdateBareMetalServerDiskOptions(bareMetalServerID string, id string, bareMetalServerDiskPatch map[string]interface{}) *UpdateBareMetalServerDiskOptions { - return &UpdateBareMetalServerDiskOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - BareMetalServerDiskPatch: bareMetalServerDiskPatch, - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *UpdateBareMetalServerDiskOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerDiskOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateBareMetalServerDiskOptions) SetID(id string) *UpdateBareMetalServerDiskOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetBareMetalServerDiskPatch : Allow user to set BareMetalServerDiskPatch -func (_options *UpdateBareMetalServerDiskOptions) SetBareMetalServerDiskPatch(bareMetalServerDiskPatch map[string]interface{}) *UpdateBareMetalServerDiskOptions { - _options.BareMetalServerDiskPatch = bareMetalServerDiskPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateBareMetalServerDiskOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerDiskOptions { - options.Headers = param - return options -} - -// UpdateBareMetalServerNetworkAttachmentOptions : The UpdateBareMetalServerNetworkAttachment options. -type UpdateBareMetalServerNetworkAttachmentOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // The bare metal server network attachment patch. - BareMetalServerNetworkAttachmentPatch map[string]interface{} `json:"BareMetalServerNetworkAttachment_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateBareMetalServerNetworkAttachmentOptions : Instantiate UpdateBareMetalServerNetworkAttachmentOptions -func (*VpcV1) NewUpdateBareMetalServerNetworkAttachmentOptions(bareMetalServerID string, id string, bareMetalServerNetworkAttachmentPatch map[string]interface{}) *UpdateBareMetalServerNetworkAttachmentOptions { - return &UpdateBareMetalServerNetworkAttachmentOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - BareMetalServerNetworkAttachmentPatch: bareMetalServerNetworkAttachmentPatch, - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerNetworkAttachmentOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetID(id string) *UpdateBareMetalServerNetworkAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetBareMetalServerNetworkAttachmentPatch : Allow user to set BareMetalServerNetworkAttachmentPatch -func (_options *UpdateBareMetalServerNetworkAttachmentOptions) SetBareMetalServerNetworkAttachmentPatch(bareMetalServerNetworkAttachmentPatch map[string]interface{}) *UpdateBareMetalServerNetworkAttachmentOptions { - _options.BareMetalServerNetworkAttachmentPatch = bareMetalServerNetworkAttachmentPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateBareMetalServerNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerNetworkAttachmentOptions { - options.Headers = param - return options -} - -// UpdateBareMetalServerNetworkInterfaceOptions : The UpdateBareMetalServerNetworkInterface options. -type UpdateBareMetalServerNetworkInterfaceOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The bare metal server network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // The bare metal server network interface patch. - BareMetalServerNetworkInterfacePatch map[string]interface{} `json:"BareMetalServerNetworkInterface_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateBareMetalServerNetworkInterfaceOptions : Instantiate UpdateBareMetalServerNetworkInterfaceOptions -func (*VpcV1) NewUpdateBareMetalServerNetworkInterfaceOptions(bareMetalServerID string, id string, bareMetalServerNetworkInterfacePatch map[string]interface{}) *UpdateBareMetalServerNetworkInterfaceOptions { - return &UpdateBareMetalServerNetworkInterfaceOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - ID: core.StringPtr(id), - BareMetalServerNetworkInterfacePatch: bareMetalServerNetworkInterfacePatch, - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerID(bareMetalServerID string) *UpdateBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetID(id string) *UpdateBareMetalServerNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetBareMetalServerNetworkInterfacePatch : Allow user to set BareMetalServerNetworkInterfacePatch -func (_options *UpdateBareMetalServerNetworkInterfaceOptions) SetBareMetalServerNetworkInterfacePatch(bareMetalServerNetworkInterfacePatch map[string]interface{}) *UpdateBareMetalServerNetworkInterfaceOptions { - _options.BareMetalServerNetworkInterfacePatch = bareMetalServerNetworkInterfacePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateBareMetalServerNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerNetworkInterfaceOptions { - options.Headers = param - return options -} - -// UpdateBareMetalServerOptions : The UpdateBareMetalServer options. -type UpdateBareMetalServerOptions struct { - // The bare metal server identifier. - ID *string `json:"id" validate:"required,ne="` - - // The bare metal server patch. - BareMetalServerPatch map[string]interface{} `json:"BareMetalServer_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateBareMetalServerOptions : Instantiate UpdateBareMetalServerOptions -func (*VpcV1) NewUpdateBareMetalServerOptions(id string, bareMetalServerPatch map[string]interface{}) *UpdateBareMetalServerOptions { - return &UpdateBareMetalServerOptions{ - ID: core.StringPtr(id), - BareMetalServerPatch: bareMetalServerPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateBareMetalServerOptions) SetID(id string) *UpdateBareMetalServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetBareMetalServerPatch : Allow user to set BareMetalServerPatch -func (_options *UpdateBareMetalServerOptions) SetBareMetalServerPatch(bareMetalServerPatch map[string]interface{}) *UpdateBareMetalServerOptions { - _options.BareMetalServerPatch = bareMetalServerPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateBareMetalServerOptions) SetHeaders(param map[string]string) *UpdateBareMetalServerOptions { - options.Headers = param - return options -} - -// UpdateDedicatedHostDiskOptions : The UpdateDedicatedHostDisk options. -type UpdateDedicatedHostDiskOptions struct { - // The dedicated host identifier. - DedicatedHostID *string `json:"dedicated_host_id" validate:"required,ne="` - - // The dedicated host disk identifier. - ID *string `json:"id" validate:"required,ne="` - - // The dedicated host disk patch. - DedicatedHostDiskPatch map[string]interface{} `json:"DedicatedHostDisk_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateDedicatedHostDiskOptions : Instantiate UpdateDedicatedHostDiskOptions -func (*VpcV1) NewUpdateDedicatedHostDiskOptions(dedicatedHostID string, id string, dedicatedHostDiskPatch map[string]interface{}) *UpdateDedicatedHostDiskOptions { - return &UpdateDedicatedHostDiskOptions{ - DedicatedHostID: core.StringPtr(dedicatedHostID), - ID: core.StringPtr(id), - DedicatedHostDiskPatch: dedicatedHostDiskPatch, - } -} - -// SetDedicatedHostID : Allow user to set DedicatedHostID -func (_options *UpdateDedicatedHostDiskOptions) SetDedicatedHostID(dedicatedHostID string) *UpdateDedicatedHostDiskOptions { - _options.DedicatedHostID = core.StringPtr(dedicatedHostID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateDedicatedHostDiskOptions) SetID(id string) *UpdateDedicatedHostDiskOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetDedicatedHostDiskPatch : Allow user to set DedicatedHostDiskPatch -func (_options *UpdateDedicatedHostDiskOptions) SetDedicatedHostDiskPatch(dedicatedHostDiskPatch map[string]interface{}) *UpdateDedicatedHostDiskOptions { - _options.DedicatedHostDiskPatch = dedicatedHostDiskPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateDedicatedHostDiskOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostDiskOptions { - options.Headers = param - return options -} - -// UpdateDedicatedHostGroupOptions : The UpdateDedicatedHostGroup options. -type UpdateDedicatedHostGroupOptions struct { - // The dedicated host group identifier. - ID *string `json:"id" validate:"required,ne="` - - // The dedicated host group patch. - DedicatedHostGroupPatch map[string]interface{} `json:"DedicatedHostGroup_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateDedicatedHostGroupOptions : Instantiate UpdateDedicatedHostGroupOptions -func (*VpcV1) NewUpdateDedicatedHostGroupOptions(id string, dedicatedHostGroupPatch map[string]interface{}) *UpdateDedicatedHostGroupOptions { - return &UpdateDedicatedHostGroupOptions{ - ID: core.StringPtr(id), - DedicatedHostGroupPatch: dedicatedHostGroupPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateDedicatedHostGroupOptions) SetID(id string) *UpdateDedicatedHostGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetDedicatedHostGroupPatch : Allow user to set DedicatedHostGroupPatch -func (_options *UpdateDedicatedHostGroupOptions) SetDedicatedHostGroupPatch(dedicatedHostGroupPatch map[string]interface{}) *UpdateDedicatedHostGroupOptions { - _options.DedicatedHostGroupPatch = dedicatedHostGroupPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateDedicatedHostGroupOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostGroupOptions { - options.Headers = param - return options -} - -// UpdateDedicatedHostOptions : The UpdateDedicatedHost options. -type UpdateDedicatedHostOptions struct { - // The dedicated host identifier. - ID *string `json:"id" validate:"required,ne="` - - // The dedicated host patch. - DedicatedHostPatch map[string]interface{} `json:"DedicatedHost_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateDedicatedHostOptions : Instantiate UpdateDedicatedHostOptions -func (*VpcV1) NewUpdateDedicatedHostOptions(id string, dedicatedHostPatch map[string]interface{}) *UpdateDedicatedHostOptions { - return &UpdateDedicatedHostOptions{ - ID: core.StringPtr(id), - DedicatedHostPatch: dedicatedHostPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateDedicatedHostOptions) SetID(id string) *UpdateDedicatedHostOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetDedicatedHostPatch : Allow user to set DedicatedHostPatch -func (_options *UpdateDedicatedHostOptions) SetDedicatedHostPatch(dedicatedHostPatch map[string]interface{}) *UpdateDedicatedHostOptions { - _options.DedicatedHostPatch = dedicatedHostPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateDedicatedHostOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostOptions { - options.Headers = param - return options -} - -// UpdateEndpointGatewayOptions : The UpdateEndpointGateway options. -type UpdateEndpointGatewayOptions struct { - // The endpoint gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // The endpoint gateway patch. - EndpointGatewayPatch map[string]interface{} `json:"EndpointGateway_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateEndpointGatewayOptions : Instantiate UpdateEndpointGatewayOptions -func (*VpcV1) NewUpdateEndpointGatewayOptions(id string, endpointGatewayPatch map[string]interface{}) *UpdateEndpointGatewayOptions { - return &UpdateEndpointGatewayOptions{ - ID: core.StringPtr(id), - EndpointGatewayPatch: endpointGatewayPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateEndpointGatewayOptions) SetID(id string) *UpdateEndpointGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetEndpointGatewayPatch : Allow user to set EndpointGatewayPatch -func (_options *UpdateEndpointGatewayOptions) SetEndpointGatewayPatch(endpointGatewayPatch map[string]interface{}) *UpdateEndpointGatewayOptions { - _options.EndpointGatewayPatch = endpointGatewayPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateEndpointGatewayOptions) SetHeaders(param map[string]string) *UpdateEndpointGatewayOptions { - options.Headers = param - return options -} - -// UpdateFloatingIPOptions : The UpdateFloatingIP options. -type UpdateFloatingIPOptions struct { - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // The floating IP patch. - FloatingIPPatch map[string]interface{} `json:"FloatingIP_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateFloatingIPOptions : Instantiate UpdateFloatingIPOptions -func (*VpcV1) NewUpdateFloatingIPOptions(id string, floatingIPPatch map[string]interface{}) *UpdateFloatingIPOptions { - return &UpdateFloatingIPOptions{ - ID: core.StringPtr(id), - FloatingIPPatch: floatingIPPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateFloatingIPOptions) SetID(id string) *UpdateFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetFloatingIPPatch : Allow user to set FloatingIPPatch -func (_options *UpdateFloatingIPOptions) SetFloatingIPPatch(floatingIPPatch map[string]interface{}) *UpdateFloatingIPOptions { - _options.FloatingIPPatch = floatingIPPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateFloatingIPOptions) SetHeaders(param map[string]string) *UpdateFloatingIPOptions { - options.Headers = param - return options -} - -// UpdateFlowLogCollectorOptions : The UpdateFlowLogCollector options. -type UpdateFlowLogCollectorOptions struct { - // The flow log collector identifier. - ID *string `json:"id" validate:"required,ne="` - - // The flow log collector patch. - FlowLogCollectorPatch map[string]interface{} `json:"FlowLogCollector_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateFlowLogCollectorOptions : Instantiate UpdateFlowLogCollectorOptions -func (*VpcV1) NewUpdateFlowLogCollectorOptions(id string, flowLogCollectorPatch map[string]interface{}) *UpdateFlowLogCollectorOptions { - return &UpdateFlowLogCollectorOptions{ - ID: core.StringPtr(id), - FlowLogCollectorPatch: flowLogCollectorPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateFlowLogCollectorOptions) SetID(id string) *UpdateFlowLogCollectorOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetFlowLogCollectorPatch : Allow user to set FlowLogCollectorPatch -func (_options *UpdateFlowLogCollectorOptions) SetFlowLogCollectorPatch(flowLogCollectorPatch map[string]interface{}) *UpdateFlowLogCollectorOptions { - _options.FlowLogCollectorPatch = flowLogCollectorPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateFlowLogCollectorOptions) SetHeaders(param map[string]string) *UpdateFlowLogCollectorOptions { - options.Headers = param - return options -} - -// UpdateIkePolicyOptions : The UpdateIkePolicy options. -type UpdateIkePolicyOptions struct { - // The IKE policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // The IKE policy patch. - IkePolicyPatch map[string]interface{} `json:"IkePolicy_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateIkePolicyOptions : Instantiate UpdateIkePolicyOptions -func (*VpcV1) NewUpdateIkePolicyOptions(id string, ikePolicyPatch map[string]interface{}) *UpdateIkePolicyOptions { - return &UpdateIkePolicyOptions{ - ID: core.StringPtr(id), - IkePolicyPatch: ikePolicyPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateIkePolicyOptions) SetID(id string) *UpdateIkePolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIkePolicyPatch : Allow user to set IkePolicyPatch -func (_options *UpdateIkePolicyOptions) SetIkePolicyPatch(ikePolicyPatch map[string]interface{}) *UpdateIkePolicyOptions { - _options.IkePolicyPatch = ikePolicyPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateIkePolicyOptions) SetHeaders(param map[string]string) *UpdateIkePolicyOptions { - options.Headers = param - return options -} - -// UpdateImageExportJobOptions : The UpdateImageExportJob options. -type UpdateImageExportJobOptions struct { - // The image identifier. - ImageID *string `json:"image_id" validate:"required,ne="` - - // The image export job identifier. - ID *string `json:"id" validate:"required,ne="` - - // The image export job patch. - ImageExportJobPatch map[string]interface{} `json:"ImageExportJob_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateImageExportJobOptions : Instantiate UpdateImageExportJobOptions -func (*VpcV1) NewUpdateImageExportJobOptions(imageID string, id string, imageExportJobPatch map[string]interface{}) *UpdateImageExportJobOptions { - return &UpdateImageExportJobOptions{ - ImageID: core.StringPtr(imageID), - ID: core.StringPtr(id), - ImageExportJobPatch: imageExportJobPatch, - } -} - -// SetImageID : Allow user to set ImageID -func (_options *UpdateImageExportJobOptions) SetImageID(imageID string) *UpdateImageExportJobOptions { - _options.ImageID = core.StringPtr(imageID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateImageExportJobOptions) SetID(id string) *UpdateImageExportJobOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetImageExportJobPatch : Allow user to set ImageExportJobPatch -func (_options *UpdateImageExportJobOptions) SetImageExportJobPatch(imageExportJobPatch map[string]interface{}) *UpdateImageExportJobOptions { - _options.ImageExportJobPatch = imageExportJobPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateImageExportJobOptions) SetHeaders(param map[string]string) *UpdateImageExportJobOptions { - options.Headers = param - return options -} - -// UpdateImageOptions : The UpdateImage options. -type UpdateImageOptions struct { - // The image identifier. - ID *string `json:"id" validate:"required,ne="` - - // The image patch. - ImagePatch map[string]interface{} `json:"Image_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateImageOptions : Instantiate UpdateImageOptions -func (*VpcV1) NewUpdateImageOptions(id string, imagePatch map[string]interface{}) *UpdateImageOptions { - return &UpdateImageOptions{ - ID: core.StringPtr(id), - ImagePatch: imagePatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateImageOptions) SetID(id string) *UpdateImageOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetImagePatch : Allow user to set ImagePatch -func (_options *UpdateImageOptions) SetImagePatch(imagePatch map[string]interface{}) *UpdateImageOptions { - _options.ImagePatch = imagePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateImageOptions) SetHeaders(param map[string]string) *UpdateImageOptions { - options.Headers = param - return options -} - -// UpdateInstanceDiskOptions : The UpdateInstanceDisk options. -type UpdateInstanceDiskOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance disk identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance disk patch. - InstanceDiskPatch map[string]interface{} `json:"InstanceDisk_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceDiskOptions : Instantiate UpdateInstanceDiskOptions -func (*VpcV1) NewUpdateInstanceDiskOptions(instanceID string, id string, instanceDiskPatch map[string]interface{}) *UpdateInstanceDiskOptions { - return &UpdateInstanceDiskOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - InstanceDiskPatch: instanceDiskPatch, - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *UpdateInstanceDiskOptions) SetInstanceID(instanceID string) *UpdateInstanceDiskOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceDiskOptions) SetID(id string) *UpdateInstanceDiskOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceDiskPatch : Allow user to set InstanceDiskPatch -func (_options *UpdateInstanceDiskOptions) SetInstanceDiskPatch(instanceDiskPatch map[string]interface{}) *UpdateInstanceDiskOptions { - _options.InstanceDiskPatch = instanceDiskPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceDiskOptions) SetHeaders(param map[string]string) *UpdateInstanceDiskOptions { - options.Headers = param - return options -} - -// UpdateInstanceGroupManagerActionOptions : The UpdateInstanceGroupManagerAction options. -type UpdateInstanceGroupManagerActionOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // The instance group manager action identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance group manager action patch. - InstanceGroupManagerActionPatch map[string]interface{} `json:"InstanceGroupManagerAction_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceGroupManagerActionOptions : Instantiate UpdateInstanceGroupManagerActionOptions -func (*VpcV1) NewUpdateInstanceGroupManagerActionOptions(instanceGroupID string, instanceGroupManagerID string, id string, instanceGroupManagerActionPatch map[string]interface{}) *UpdateInstanceGroupManagerActionOptions { - return &UpdateInstanceGroupManagerActionOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - ID: core.StringPtr(id), - InstanceGroupManagerActionPatch: instanceGroupManagerActionPatch, - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerActionOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *UpdateInstanceGroupManagerActionOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceGroupManagerActionOptions) SetID(id string) *UpdateInstanceGroupManagerActionOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceGroupManagerActionPatch : Allow user to set InstanceGroupManagerActionPatch -func (_options *UpdateInstanceGroupManagerActionOptions) SetInstanceGroupManagerActionPatch(instanceGroupManagerActionPatch map[string]interface{}) *UpdateInstanceGroupManagerActionOptions { - _options.InstanceGroupManagerActionPatch = instanceGroupManagerActionPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceGroupManagerActionOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerActionOptions { - options.Headers = param - return options -} - -// UpdateInstanceGroupManagerOptions : The UpdateInstanceGroupManager options. -type UpdateInstanceGroupManagerOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance group manager patch. - InstanceGroupManagerPatch map[string]interface{} `json:"InstanceGroupManager_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceGroupManagerOptions : Instantiate UpdateInstanceGroupManagerOptions -func (*VpcV1) NewUpdateInstanceGroupManagerOptions(instanceGroupID string, id string, instanceGroupManagerPatch map[string]interface{}) *UpdateInstanceGroupManagerOptions { - return &UpdateInstanceGroupManagerOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - ID: core.StringPtr(id), - InstanceGroupManagerPatch: instanceGroupManagerPatch, - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *UpdateInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceGroupManagerOptions) SetID(id string) *UpdateInstanceGroupManagerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceGroupManagerPatch : Allow user to set InstanceGroupManagerPatch -func (_options *UpdateInstanceGroupManagerOptions) SetInstanceGroupManagerPatch(instanceGroupManagerPatch map[string]interface{}) *UpdateInstanceGroupManagerOptions { - _options.InstanceGroupManagerPatch = instanceGroupManagerPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceGroupManagerOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerOptions { - options.Headers = param - return options -} - -// UpdateInstanceGroupManagerPolicyOptions : The UpdateInstanceGroupManagerPolicy options. -type UpdateInstanceGroupManagerPolicyOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group manager identifier. - InstanceGroupManagerID *string `json:"instance_group_manager_id" validate:"required,ne="` - - // The instance group manager policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance group manager policy patch. - InstanceGroupManagerPolicyPatch map[string]interface{} `json:"InstanceGroupManagerPolicy_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceGroupManagerPolicyOptions : Instantiate UpdateInstanceGroupManagerPolicyOptions -func (*VpcV1) NewUpdateInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string, instanceGroupManagerPolicyPatch map[string]interface{}) *UpdateInstanceGroupManagerPolicyOptions { - return &UpdateInstanceGroupManagerPolicyOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), - ID: core.StringPtr(id), - InstanceGroupManagerPolicyPatch: instanceGroupManagerPolicyPatch, - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerPolicyOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID -func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *UpdateInstanceGroupManagerPolicyOptions { - _options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceGroupManagerPolicyOptions) SetID(id string) *UpdateInstanceGroupManagerPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceGroupManagerPolicyPatch : Allow user to set InstanceGroupManagerPolicyPatch -func (_options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerPolicyPatch(instanceGroupManagerPolicyPatch map[string]interface{}) *UpdateInstanceGroupManagerPolicyOptions { - _options.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerPolicyOptions { - options.Headers = param - return options -} - -// UpdateInstanceGroupMembershipOptions : The UpdateInstanceGroupMembership options. -type UpdateInstanceGroupMembershipOptions struct { - // The instance group identifier. - InstanceGroupID *string `json:"instance_group_id" validate:"required,ne="` - - // The instance group membership identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance group membership patch. - InstanceGroupMembershipPatch map[string]interface{} `json:"InstanceGroupMembership_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceGroupMembershipOptions : Instantiate UpdateInstanceGroupMembershipOptions -func (*VpcV1) NewUpdateInstanceGroupMembershipOptions(instanceGroupID string, id string, instanceGroupMembershipPatch map[string]interface{}) *UpdateInstanceGroupMembershipOptions { - return &UpdateInstanceGroupMembershipOptions{ - InstanceGroupID: core.StringPtr(instanceGroupID), - ID: core.StringPtr(id), - InstanceGroupMembershipPatch: instanceGroupMembershipPatch, - } -} - -// SetInstanceGroupID : Allow user to set InstanceGroupID -func (_options *UpdateInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupMembershipOptions { - _options.InstanceGroupID = core.StringPtr(instanceGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceGroupMembershipOptions) SetID(id string) *UpdateInstanceGroupMembershipOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceGroupMembershipPatch : Allow user to set InstanceGroupMembershipPatch -func (_options *UpdateInstanceGroupMembershipOptions) SetInstanceGroupMembershipPatch(instanceGroupMembershipPatch map[string]interface{}) *UpdateInstanceGroupMembershipOptions { - _options.InstanceGroupMembershipPatch = instanceGroupMembershipPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupMembershipOptions { - options.Headers = param - return options -} - -// UpdateInstanceGroupOptions : The UpdateInstanceGroup options. -type UpdateInstanceGroupOptions struct { - // The instance group identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance group patch. - InstanceGroupPatch map[string]interface{} `json:"InstanceGroup_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceGroupOptions : Instantiate UpdateInstanceGroupOptions -func (*VpcV1) NewUpdateInstanceGroupOptions(id string, instanceGroupPatch map[string]interface{}) *UpdateInstanceGroupOptions { - return &UpdateInstanceGroupOptions{ - ID: core.StringPtr(id), - InstanceGroupPatch: instanceGroupPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceGroupOptions) SetID(id string) *UpdateInstanceGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceGroupPatch : Allow user to set InstanceGroupPatch -func (_options *UpdateInstanceGroupOptions) SetInstanceGroupPatch(instanceGroupPatch map[string]interface{}) *UpdateInstanceGroupOptions { - _options.InstanceGroupPatch = instanceGroupPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceGroupOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupOptions { - options.Headers = param - return options -} - -// UpdateInstanceNetworkAttachmentOptions : The UpdateInstanceNetworkAttachment options. -type UpdateInstanceNetworkAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance network attachment patch. - InstanceNetworkAttachmentPatch map[string]interface{} `json:"InstanceNetworkAttachment_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceNetworkAttachmentOptions : Instantiate UpdateInstanceNetworkAttachmentOptions -func (*VpcV1) NewUpdateInstanceNetworkAttachmentOptions(instanceID string, id string, instanceNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceNetworkAttachmentOptions { - return &UpdateInstanceNetworkAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - InstanceNetworkAttachmentPatch: instanceNetworkAttachmentPatch, - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *UpdateInstanceNetworkAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceNetworkAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceNetworkAttachmentOptions) SetID(id string) *UpdateInstanceNetworkAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceNetworkAttachmentPatch : Allow user to set InstanceNetworkAttachmentPatch -func (_options *UpdateInstanceNetworkAttachmentOptions) SetInstanceNetworkAttachmentPatch(instanceNetworkAttachmentPatch map[string]interface{}) *UpdateInstanceNetworkAttachmentOptions { - _options.InstanceNetworkAttachmentPatch = instanceNetworkAttachmentPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceNetworkAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceNetworkAttachmentOptions { - options.Headers = param - return options -} - -// UpdateInstanceNetworkInterfaceOptions : The UpdateInstanceNetworkInterface options. -type UpdateInstanceNetworkInterfaceOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The instance network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance network interface patch. - NetworkInterfacePatch map[string]interface{} `json:"NetworkInterface_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceNetworkInterfaceOptions : Instantiate UpdateInstanceNetworkInterfaceOptions -func (*VpcV1) NewUpdateInstanceNetworkInterfaceOptions(instanceID string, id string, networkInterfacePatch map[string]interface{}) *UpdateInstanceNetworkInterfaceOptions { - return &UpdateInstanceNetworkInterfaceOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - NetworkInterfacePatch: networkInterfacePatch, - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *UpdateInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *UpdateInstanceNetworkInterfaceOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceNetworkInterfaceOptions) SetID(id string) *UpdateInstanceNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetNetworkInterfacePatch : Allow user to set NetworkInterfacePatch -func (_options *UpdateInstanceNetworkInterfaceOptions) SetNetworkInterfacePatch(networkInterfacePatch map[string]interface{}) *UpdateInstanceNetworkInterfaceOptions { - _options.NetworkInterfacePatch = networkInterfacePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateInstanceNetworkInterfaceOptions { - options.Headers = param - return options -} - -// UpdateInstanceOptions : The UpdateInstance options. -type UpdateInstanceOptions struct { - // The virtual server instance identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance patch. - InstancePatch map[string]interface{} `json:"Instance_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 -} - -// NewUpdateInstanceOptions : Instantiate UpdateInstanceOptions -func (*VpcV1) NewUpdateInstanceOptions(id string, instancePatch map[string]interface{}) *UpdateInstanceOptions { - return &UpdateInstanceOptions{ - ID: core.StringPtr(id), - InstancePatch: instancePatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceOptions) SetID(id string) *UpdateInstanceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstancePatch : Allow user to set InstancePatch -func (_options *UpdateInstanceOptions) SetInstancePatch(instancePatch map[string]interface{}) *UpdateInstanceOptions { - _options.InstancePatch = instancePatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateInstanceOptions) SetIfMatch(ifMatch string) *UpdateInstanceOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceOptions) SetHeaders(param map[string]string) *UpdateInstanceOptions { - options.Headers = param - return options -} - -// UpdateInstanceTemplateOptions : The UpdateInstanceTemplate options. -type UpdateInstanceTemplateOptions struct { - // The instance template identifier. - ID *string `json:"id" validate:"required,ne="` - - // The instance template patch. - InstanceTemplatePatch map[string]interface{} `json:"InstanceTemplate_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceTemplateOptions : Instantiate UpdateInstanceTemplateOptions -func (*VpcV1) NewUpdateInstanceTemplateOptions(id string, instanceTemplatePatch map[string]interface{}) *UpdateInstanceTemplateOptions { - return &UpdateInstanceTemplateOptions{ - ID: core.StringPtr(id), - InstanceTemplatePatch: instanceTemplatePatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceTemplateOptions) SetID(id string) *UpdateInstanceTemplateOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetInstanceTemplatePatch : Allow user to set InstanceTemplatePatch -func (_options *UpdateInstanceTemplateOptions) SetInstanceTemplatePatch(instanceTemplatePatch map[string]interface{}) *UpdateInstanceTemplateOptions { - _options.InstanceTemplatePatch = instanceTemplatePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceTemplateOptions) SetHeaders(param map[string]string) *UpdateInstanceTemplateOptions { - options.Headers = param - return options -} - -// UpdateInstanceVolumeAttachmentOptions : The UpdateInstanceVolumeAttachment options. -type UpdateInstanceVolumeAttachmentOptions struct { - // The virtual server instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` - - // The volume attachment identifier. - ID *string `json:"id" validate:"required,ne="` - - // The volume attachment patch. - VolumeAttachmentPatch map[string]interface{} `json:"VolumeAttachment_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateInstanceVolumeAttachmentOptions : Instantiate UpdateInstanceVolumeAttachmentOptions -func (*VpcV1) NewUpdateInstanceVolumeAttachmentOptions(instanceID string, id string, volumeAttachmentPatch map[string]interface{}) *UpdateInstanceVolumeAttachmentOptions { - return &UpdateInstanceVolumeAttachmentOptions{ - InstanceID: core.StringPtr(instanceID), - ID: core.StringPtr(id), - VolumeAttachmentPatch: volumeAttachmentPatch, - } -} - -// SetInstanceID : Allow user to set InstanceID -func (_options *UpdateInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceVolumeAttachmentOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateInstanceVolumeAttachmentOptions) SetID(id string) *UpdateInstanceVolumeAttachmentOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVolumeAttachmentPatch : Allow user to set VolumeAttachmentPatch -func (_options *UpdateInstanceVolumeAttachmentOptions) SetVolumeAttachmentPatch(volumeAttachmentPatch map[string]interface{}) *UpdateInstanceVolumeAttachmentOptions { - _options.VolumeAttachmentPatch = volumeAttachmentPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceVolumeAttachmentOptions { - options.Headers = param - return options -} - -// UpdateIpsecPolicyOptions : The UpdateIpsecPolicy options. -type UpdateIpsecPolicyOptions struct { - // The IPsec policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // The IPsec policy patch. - IPsecPolicyPatch map[string]interface{} `json:"IPsecPolicy_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateIpsecPolicyOptions : Instantiate UpdateIpsecPolicyOptions -func (*VpcV1) NewUpdateIpsecPolicyOptions(id string, iPsecPolicyPatch map[string]interface{}) *UpdateIpsecPolicyOptions { - return &UpdateIpsecPolicyOptions{ - ID: core.StringPtr(id), - IPsecPolicyPatch: iPsecPolicyPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateIpsecPolicyOptions) SetID(id string) *UpdateIpsecPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetIPsecPolicyPatch : Allow user to set IPsecPolicyPatch -func (_options *UpdateIpsecPolicyOptions) SetIPsecPolicyPatch(iPsecPolicyPatch map[string]interface{}) *UpdateIpsecPolicyOptions { - _options.IPsecPolicyPatch = iPsecPolicyPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateIpsecPolicyOptions) SetHeaders(param map[string]string) *UpdateIpsecPolicyOptions { - options.Headers = param - return options -} - -// UpdateKeyOptions : The UpdateKey options. -type UpdateKeyOptions struct { - // The key identifier. - ID *string `json:"id" validate:"required,ne="` - - // The key patch. - KeyPatch map[string]interface{} `json:"Key_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateKeyOptions : Instantiate UpdateKeyOptions -func (*VpcV1) NewUpdateKeyOptions(id string, keyPatch map[string]interface{}) *UpdateKeyOptions { - return &UpdateKeyOptions{ - ID: core.StringPtr(id), - KeyPatch: keyPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateKeyOptions) SetID(id string) *UpdateKeyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetKeyPatch : Allow user to set KeyPatch -func (_options *UpdateKeyOptions) SetKeyPatch(keyPatch map[string]interface{}) *UpdateKeyOptions { - _options.KeyPatch = keyPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateKeyOptions) SetHeaders(param map[string]string) *UpdateKeyOptions { - options.Headers = param - return options -} - -// UpdateLoadBalancerListenerOptions : The UpdateLoadBalancerListener options. -type UpdateLoadBalancerListenerOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ID *string `json:"id" validate:"required,ne="` - - // The load balancer listener patch. - LoadBalancerListenerPatch map[string]interface{} `json:"LoadBalancerListener_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateLoadBalancerListenerOptions : Instantiate UpdateLoadBalancerListenerOptions -func (*VpcV1) NewUpdateLoadBalancerListenerOptions(loadBalancerID string, id string, loadBalancerListenerPatch map[string]interface{}) *UpdateLoadBalancerListenerOptions { - return &UpdateLoadBalancerListenerOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ID: core.StringPtr(id), - LoadBalancerListenerPatch: loadBalancerListenerPatch, - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *UpdateLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateLoadBalancerListenerOptions) SetID(id string) *UpdateLoadBalancerListenerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetLoadBalancerListenerPatch : Allow user to set LoadBalancerListenerPatch -func (_options *UpdateLoadBalancerListenerOptions) SetLoadBalancerListenerPatch(loadBalancerListenerPatch map[string]interface{}) *UpdateLoadBalancerListenerOptions { - _options.LoadBalancerListenerPatch = loadBalancerListenerPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateLoadBalancerListenerOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerOptions { - options.Headers = param - return options -} - -// UpdateLoadBalancerListenerPolicyOptions : The UpdateLoadBalancerListenerPolicy options. -type UpdateLoadBalancerListenerPolicyOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - ID *string `json:"id" validate:"required,ne="` - - // The listener policy patch. - LoadBalancerListenerPolicyPatch map[string]interface{} `json:"LoadBalancerListenerPolicy_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateLoadBalancerListenerPolicyOptions : Instantiate UpdateLoadBalancerListenerPolicyOptions -func (*VpcV1) NewUpdateLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string, loadBalancerListenerPolicyPatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyOptions { - return &UpdateLoadBalancerListenerPolicyOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - ID: core.StringPtr(id), - LoadBalancerListenerPolicyPatch: loadBalancerListenerPolicyPatch, - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *UpdateLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerPolicyOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *UpdateLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *UpdateLoadBalancerListenerPolicyOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateLoadBalancerListenerPolicyOptions) SetID(id string) *UpdateLoadBalancerListenerPolicyOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetLoadBalancerListenerPolicyPatch : Allow user to set LoadBalancerListenerPolicyPatch -func (_options *UpdateLoadBalancerListenerPolicyOptions) SetLoadBalancerListenerPolicyPatch(loadBalancerListenerPolicyPatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyOptions { - _options.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerPolicyOptions { - options.Headers = param - return options -} - -// UpdateLoadBalancerListenerPolicyRuleOptions : The UpdateLoadBalancerListenerPolicyRule options. -type UpdateLoadBalancerListenerPolicyRuleOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The listener identifier. - ListenerID *string `json:"listener_id" validate:"required,ne="` - - // The policy identifier. - PolicyID *string `json:"policy_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // The listener policy rule patch. - LoadBalancerListenerPolicyRulePatch map[string]interface{} `json:"LoadBalancerListenerPolicyRule_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateLoadBalancerListenerPolicyRuleOptions : Instantiate UpdateLoadBalancerListenerPolicyRuleOptions -func (*VpcV1) NewUpdateLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string, loadBalancerListenerPolicyRulePatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyRuleOptions { - return &UpdateLoadBalancerListenerPolicyRuleOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ListenerID: core.StringPtr(listenerID), - PolicyID: core.StringPtr(policyID), - ID: core.StringPtr(id), - LoadBalancerListenerPolicyRulePatch: loadBalancerListenerPolicyRulePatch, - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerPolicyRuleOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetListenerID : Allow user to set ListenerID -func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *UpdateLoadBalancerListenerPolicyRuleOptions { - _options.ListenerID = core.StringPtr(listenerID) - return _options -} - -// SetPolicyID : Allow user to set PolicyID -func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *UpdateLoadBalancerListenerPolicyRuleOptions { - _options.PolicyID = core.StringPtr(policyID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetID(id string) *UpdateLoadBalancerListenerPolicyRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetLoadBalancerListenerPolicyRulePatch : Allow user to set LoadBalancerListenerPolicyRulePatch -func (_options *UpdateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerListenerPolicyRulePatch(loadBalancerListenerPolicyRulePatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyRuleOptions { - _options.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerPolicyRuleOptions { - options.Headers = param - return options -} - -// UpdateLoadBalancerOptions : The UpdateLoadBalancer options. -type UpdateLoadBalancerOptions struct { - // The load balancer identifier. - ID *string `json:"id" validate:"required,ne="` - - // The load balancer patch. - LoadBalancerPatch map[string]interface{} `json:"LoadBalancer_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 -} - -// NewUpdateLoadBalancerOptions : Instantiate UpdateLoadBalancerOptions -func (*VpcV1) NewUpdateLoadBalancerOptions(id string, loadBalancerPatch map[string]interface{}) *UpdateLoadBalancerOptions { - return &UpdateLoadBalancerOptions{ - ID: core.StringPtr(id), - LoadBalancerPatch: loadBalancerPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateLoadBalancerOptions) SetID(id string) *UpdateLoadBalancerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetLoadBalancerPatch : Allow user to set LoadBalancerPatch -func (_options *UpdateLoadBalancerOptions) SetLoadBalancerPatch(loadBalancerPatch map[string]interface{}) *UpdateLoadBalancerOptions { - _options.LoadBalancerPatch = loadBalancerPatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateLoadBalancerOptions) SetIfMatch(ifMatch string) *UpdateLoadBalancerOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateLoadBalancerOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerOptions { - options.Headers = param - return options -} - -// UpdateLoadBalancerPoolMemberOptions : The UpdateLoadBalancerPoolMember options. -type UpdateLoadBalancerPoolMemberOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - PoolID *string `json:"pool_id" validate:"required,ne="` - - // The member identifier. - ID *string `json:"id" validate:"required,ne="` - - // The load balancer pool member patch. - LoadBalancerPoolMemberPatch map[string]interface{} `json:"LoadBalancerPoolMember_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateLoadBalancerPoolMemberOptions : Instantiate UpdateLoadBalancerPoolMemberOptions -func (*VpcV1) NewUpdateLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string, loadBalancerPoolMemberPatch map[string]interface{}) *UpdateLoadBalancerPoolMemberOptions { - return &UpdateLoadBalancerPoolMemberOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - PoolID: core.StringPtr(poolID), - ID: core.StringPtr(id), - LoadBalancerPoolMemberPatch: loadBalancerPoolMemberPatch, - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *UpdateLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerPoolMemberOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetPoolID : Allow user to set PoolID -func (_options *UpdateLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *UpdateLoadBalancerPoolMemberOptions { - _options.PoolID = core.StringPtr(poolID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateLoadBalancerPoolMemberOptions) SetID(id string) *UpdateLoadBalancerPoolMemberOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetLoadBalancerPoolMemberPatch : Allow user to set LoadBalancerPoolMemberPatch -func (_options *UpdateLoadBalancerPoolMemberOptions) SetLoadBalancerPoolMemberPatch(loadBalancerPoolMemberPatch map[string]interface{}) *UpdateLoadBalancerPoolMemberOptions { - _options.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerPoolMemberOptions { - options.Headers = param - return options -} - -// UpdateLoadBalancerPoolOptions : The UpdateLoadBalancerPool options. -type UpdateLoadBalancerPoolOptions struct { - // The load balancer identifier. - LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - - // The pool identifier. - ID *string `json:"id" validate:"required,ne="` - - // The load balancer pool patch. - LoadBalancerPoolPatch map[string]interface{} `json:"LoadBalancerPool_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateLoadBalancerPoolOptions : Instantiate UpdateLoadBalancerPoolOptions -func (*VpcV1) NewUpdateLoadBalancerPoolOptions(loadBalancerID string, id string, loadBalancerPoolPatch map[string]interface{}) *UpdateLoadBalancerPoolOptions { - return &UpdateLoadBalancerPoolOptions{ - LoadBalancerID: core.StringPtr(loadBalancerID), - ID: core.StringPtr(id), - LoadBalancerPoolPatch: loadBalancerPoolPatch, - } -} - -// SetLoadBalancerID : Allow user to set LoadBalancerID -func (_options *UpdateLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerPoolOptions { - _options.LoadBalancerID = core.StringPtr(loadBalancerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateLoadBalancerPoolOptions) SetID(id string) *UpdateLoadBalancerPoolOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetLoadBalancerPoolPatch : Allow user to set LoadBalancerPoolPatch -func (_options *UpdateLoadBalancerPoolOptions) SetLoadBalancerPoolPatch(loadBalancerPoolPatch map[string]interface{}) *UpdateLoadBalancerPoolOptions { - _options.LoadBalancerPoolPatch = loadBalancerPoolPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateLoadBalancerPoolOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerPoolOptions { - options.Headers = param - return options -} - -// UpdateNetworkACLOptions : The UpdateNetworkACL options. -type UpdateNetworkACLOptions struct { - // The network ACL identifier. - ID *string `json:"id" validate:"required,ne="` - - // The network ACL patch. - NetworkACLPatch map[string]interface{} `json:"NetworkACL_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateNetworkACLOptions : Instantiate UpdateNetworkACLOptions -func (*VpcV1) NewUpdateNetworkACLOptions(id string, networkACLPatch map[string]interface{}) *UpdateNetworkACLOptions { - return &UpdateNetworkACLOptions{ - ID: core.StringPtr(id), - NetworkACLPatch: networkACLPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateNetworkACLOptions) SetID(id string) *UpdateNetworkACLOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetNetworkACLPatch : Allow user to set NetworkACLPatch -func (_options *UpdateNetworkACLOptions) SetNetworkACLPatch(networkACLPatch map[string]interface{}) *UpdateNetworkACLOptions { - _options.NetworkACLPatch = networkACLPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateNetworkACLOptions) SetHeaders(param map[string]string) *UpdateNetworkACLOptions { - options.Headers = param - return options -} - -// UpdateNetworkACLRuleOptions : The UpdateNetworkACLRule options. -type UpdateNetworkACLRuleOptions struct { - // The network ACL identifier. - NetworkACLID *string `json:"network_acl_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // The network ACL rule patch. - NetworkACLRulePatch map[string]interface{} `json:"NetworkACLRule_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateNetworkACLRuleOptions : Instantiate UpdateNetworkACLRuleOptions -func (*VpcV1) NewUpdateNetworkACLRuleOptions(networkACLID string, id string, networkACLRulePatch map[string]interface{}) *UpdateNetworkACLRuleOptions { - return &UpdateNetworkACLRuleOptions{ - NetworkACLID: core.StringPtr(networkACLID), - ID: core.StringPtr(id), - NetworkACLRulePatch: networkACLRulePatch, - } -} - -// SetNetworkACLID : Allow user to set NetworkACLID -func (_options *UpdateNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *UpdateNetworkACLRuleOptions { - _options.NetworkACLID = core.StringPtr(networkACLID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateNetworkACLRuleOptions) SetID(id string) *UpdateNetworkACLRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetNetworkACLRulePatch : Allow user to set NetworkACLRulePatch -func (_options *UpdateNetworkACLRuleOptions) SetNetworkACLRulePatch(networkACLRulePatch map[string]interface{}) *UpdateNetworkACLRuleOptions { - _options.NetworkACLRulePatch = networkACLRulePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateNetworkACLRuleOptions) SetHeaders(param map[string]string) *UpdateNetworkACLRuleOptions { - options.Headers = param - return options -} - -// UpdatePlacementGroupOptions : The UpdatePlacementGroup options. -type UpdatePlacementGroupOptions struct { - // The placement group identifier. - ID *string `json:"id" validate:"required,ne="` - - // The placement group patch. - PlacementGroupPatch map[string]interface{} `json:"PlacementGroup_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdatePlacementGroupOptions : Instantiate UpdatePlacementGroupOptions -func (*VpcV1) NewUpdatePlacementGroupOptions(id string, placementGroupPatch map[string]interface{}) *UpdatePlacementGroupOptions { - return &UpdatePlacementGroupOptions{ - ID: core.StringPtr(id), - PlacementGroupPatch: placementGroupPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdatePlacementGroupOptions) SetID(id string) *UpdatePlacementGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetPlacementGroupPatch : Allow user to set PlacementGroupPatch -func (_options *UpdatePlacementGroupOptions) SetPlacementGroupPatch(placementGroupPatch map[string]interface{}) *UpdatePlacementGroupOptions { - _options.PlacementGroupPatch = placementGroupPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdatePlacementGroupOptions) SetHeaders(param map[string]string) *UpdatePlacementGroupOptions { - options.Headers = param - return options -} - -// UpdatePublicGatewayOptions : The UpdatePublicGateway options. -type UpdatePublicGatewayOptions struct { - // The public gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // The public gateway patch. - PublicGatewayPatch map[string]interface{} `json:"PublicGateway_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdatePublicGatewayOptions : Instantiate UpdatePublicGatewayOptions -func (*VpcV1) NewUpdatePublicGatewayOptions(id string, publicGatewayPatch map[string]interface{}) *UpdatePublicGatewayOptions { - return &UpdatePublicGatewayOptions{ - ID: core.StringPtr(id), - PublicGatewayPatch: publicGatewayPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdatePublicGatewayOptions) SetID(id string) *UpdatePublicGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetPublicGatewayPatch : Allow user to set PublicGatewayPatch -func (_options *UpdatePublicGatewayOptions) SetPublicGatewayPatch(publicGatewayPatch map[string]interface{}) *UpdatePublicGatewayOptions { - _options.PublicGatewayPatch = publicGatewayPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdatePublicGatewayOptions) SetHeaders(param map[string]string) *UpdatePublicGatewayOptions { - options.Headers = param - return options -} - -// UpdateReservationOptions : The UpdateReservation options. -type UpdateReservationOptions struct { - // The reservation identifier. - ID *string `json:"id" validate:"required,ne="` - - // The reservation patch. - ReservationPatch map[string]interface{} `json:"Reservation_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateReservationOptions : Instantiate UpdateReservationOptions -func (*VpcV1) NewUpdateReservationOptions(id string, reservationPatch map[string]interface{}) *UpdateReservationOptions { - return &UpdateReservationOptions{ - ID: core.StringPtr(id), - ReservationPatch: reservationPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateReservationOptions) SetID(id string) *UpdateReservationOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetReservationPatch : Allow user to set ReservationPatch -func (_options *UpdateReservationOptions) SetReservationPatch(reservationPatch map[string]interface{}) *UpdateReservationOptions { - _options.ReservationPatch = reservationPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateReservationOptions) SetHeaders(param map[string]string) *UpdateReservationOptions { - options.Headers = param - return options -} - -// UpdateSecurityGroupOptions : The UpdateSecurityGroup options. -type UpdateSecurityGroupOptions struct { - // The security group identifier. - ID *string `json:"id" validate:"required,ne="` - - // The security group patch. - SecurityGroupPatch map[string]interface{} `json:"SecurityGroup_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateSecurityGroupOptions : Instantiate UpdateSecurityGroupOptions -func (*VpcV1) NewUpdateSecurityGroupOptions(id string, securityGroupPatch map[string]interface{}) *UpdateSecurityGroupOptions { - return &UpdateSecurityGroupOptions{ - ID: core.StringPtr(id), - SecurityGroupPatch: securityGroupPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateSecurityGroupOptions) SetID(id string) *UpdateSecurityGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetSecurityGroupPatch : Allow user to set SecurityGroupPatch -func (_options *UpdateSecurityGroupOptions) SetSecurityGroupPatch(securityGroupPatch map[string]interface{}) *UpdateSecurityGroupOptions { - _options.SecurityGroupPatch = securityGroupPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateSecurityGroupOptions) SetHeaders(param map[string]string) *UpdateSecurityGroupOptions { - options.Headers = param - return options -} - -// UpdateSecurityGroupRuleOptions : The UpdateSecurityGroupRule options. -type UpdateSecurityGroupRuleOptions struct { - // The security group identifier. - SecurityGroupID *string `json:"security_group_id" validate:"required,ne="` - - // The rule identifier. - ID *string `json:"id" validate:"required,ne="` - - // The security group rule patch. - SecurityGroupRulePatch map[string]interface{} `json:"SecurityGroupRule_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateSecurityGroupRuleOptions : Instantiate UpdateSecurityGroupRuleOptions -func (*VpcV1) NewUpdateSecurityGroupRuleOptions(securityGroupID string, id string, securityGroupRulePatch map[string]interface{}) *UpdateSecurityGroupRuleOptions { - return &UpdateSecurityGroupRuleOptions{ - SecurityGroupID: core.StringPtr(securityGroupID), - ID: core.StringPtr(id), - SecurityGroupRulePatch: securityGroupRulePatch, - } -} - -// SetSecurityGroupID : Allow user to set SecurityGroupID -func (_options *UpdateSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *UpdateSecurityGroupRuleOptions { - _options.SecurityGroupID = core.StringPtr(securityGroupID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateSecurityGroupRuleOptions) SetID(id string) *UpdateSecurityGroupRuleOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetSecurityGroupRulePatch : Allow user to set SecurityGroupRulePatch -func (_options *UpdateSecurityGroupRuleOptions) SetSecurityGroupRulePatch(securityGroupRulePatch map[string]interface{}) *UpdateSecurityGroupRuleOptions { - _options.SecurityGroupRulePatch = securityGroupRulePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateSecurityGroupRuleOptions) SetHeaders(param map[string]string) *UpdateSecurityGroupRuleOptions { - options.Headers = param - return options -} - -// UpdateShareMountTargetOptions : The UpdateShareMountTarget options. -type UpdateShareMountTargetOptions struct { - // The file share identifier. - ShareID *string `json:"share_id" validate:"required,ne="` - - // The share mount target identifier. - ID *string `json:"id" validate:"required,ne="` - - // The share mount target patch. - ShareMountTargetPatch map[string]interface{} `json:"ShareMountTarget_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateShareMountTargetOptions : Instantiate UpdateShareMountTargetOptions -func (*VpcV1) NewUpdateShareMountTargetOptions(shareID string, id string, shareMountTargetPatch map[string]interface{}) *UpdateShareMountTargetOptions { - return &UpdateShareMountTargetOptions{ - ShareID: core.StringPtr(shareID), - ID: core.StringPtr(id), - ShareMountTargetPatch: shareMountTargetPatch, - } -} - -// SetShareID : Allow user to set ShareID -func (_options *UpdateShareMountTargetOptions) SetShareID(shareID string) *UpdateShareMountTargetOptions { - _options.ShareID = core.StringPtr(shareID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateShareMountTargetOptions) SetID(id string) *UpdateShareMountTargetOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetShareMountTargetPatch : Allow user to set ShareMountTargetPatch -func (_options *UpdateShareMountTargetOptions) SetShareMountTargetPatch(shareMountTargetPatch map[string]interface{}) *UpdateShareMountTargetOptions { - _options.ShareMountTargetPatch = shareMountTargetPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateShareMountTargetOptions) SetHeaders(param map[string]string) *UpdateShareMountTargetOptions { - options.Headers = param - return options -} - -// UpdateShareOptions : The UpdateShare options. -type UpdateShareOptions struct { - // The file share identifier. - ID *string `json:"id" validate:"required,ne="` - - // The file share patch. - SharePatch map[string]interface{} `json:"Share_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 -} - -// NewUpdateShareOptions : Instantiate UpdateShareOptions -func (*VpcV1) NewUpdateShareOptions(id string, sharePatch map[string]interface{}) *UpdateShareOptions { - return &UpdateShareOptions{ - ID: core.StringPtr(id), - SharePatch: sharePatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateShareOptions) SetID(id string) *UpdateShareOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetSharePatch : Allow user to set SharePatch -func (_options *UpdateShareOptions) SetSharePatch(sharePatch map[string]interface{}) *UpdateShareOptions { - _options.SharePatch = sharePatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateShareOptions) SetIfMatch(ifMatch string) *UpdateShareOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateShareOptions) SetHeaders(param map[string]string) *UpdateShareOptions { - options.Headers = param - return options -} - -// UpdateSnapshotConsistencyGroupOptions : The UpdateSnapshotConsistencyGroup options. -type UpdateSnapshotConsistencyGroupOptions struct { - // The snapshot consistency group identifier. - ID *string `json:"id" validate:"required,ne="` - - // The snapshot consistency group patch. - SnapshotConsistencyGroupPatch map[string]interface{} `json:"SnapshotConsistencyGroup_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 -} - -// NewUpdateSnapshotConsistencyGroupOptions : Instantiate UpdateSnapshotConsistencyGroupOptions -func (*VpcV1) NewUpdateSnapshotConsistencyGroupOptions(id string, snapshotConsistencyGroupPatch map[string]interface{}) *UpdateSnapshotConsistencyGroupOptions { - return &UpdateSnapshotConsistencyGroupOptions{ - ID: core.StringPtr(id), - SnapshotConsistencyGroupPatch: snapshotConsistencyGroupPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateSnapshotConsistencyGroupOptions) SetID(id string) *UpdateSnapshotConsistencyGroupOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetSnapshotConsistencyGroupPatch : Allow user to set SnapshotConsistencyGroupPatch -func (_options *UpdateSnapshotConsistencyGroupOptions) SetSnapshotConsistencyGroupPatch(snapshotConsistencyGroupPatch map[string]interface{}) *UpdateSnapshotConsistencyGroupOptions { - _options.SnapshotConsistencyGroupPatch = snapshotConsistencyGroupPatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateSnapshotConsistencyGroupOptions) SetIfMatch(ifMatch string) *UpdateSnapshotConsistencyGroupOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateSnapshotConsistencyGroupOptions) SetHeaders(param map[string]string) *UpdateSnapshotConsistencyGroupOptions { - options.Headers = param - return options -} - -// UpdateSnapshotOptions : The UpdateSnapshot options. -type UpdateSnapshotOptions struct { - // The snapshot identifier. - ID *string `json:"id" validate:"required,ne="` - - // The snapshot patch. - SnapshotPatch map[string]interface{} `json:"Snapshot_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 -} - -// NewUpdateSnapshotOptions : Instantiate UpdateSnapshotOptions -func (*VpcV1) NewUpdateSnapshotOptions(id string, snapshotPatch map[string]interface{}) *UpdateSnapshotOptions { - return &UpdateSnapshotOptions{ - ID: core.StringPtr(id), - SnapshotPatch: snapshotPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateSnapshotOptions) SetID(id string) *UpdateSnapshotOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetSnapshotPatch : Allow user to set SnapshotPatch -func (_options *UpdateSnapshotOptions) SetSnapshotPatch(snapshotPatch map[string]interface{}) *UpdateSnapshotOptions { - _options.SnapshotPatch = snapshotPatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateSnapshotOptions) SetIfMatch(ifMatch string) *UpdateSnapshotOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateSnapshotOptions) SetHeaders(param map[string]string) *UpdateSnapshotOptions { - options.Headers = param - return options -} - -// UpdateSubnetOptions : The UpdateSubnet options. -type UpdateSubnetOptions struct { - // The subnet identifier. - ID *string `json:"id" validate:"required,ne="` - - // The subnet patch. - SubnetPatch map[string]interface{} `json:"Subnet_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateSubnetOptions : Instantiate UpdateSubnetOptions -func (*VpcV1) NewUpdateSubnetOptions(id string, subnetPatch map[string]interface{}) *UpdateSubnetOptions { - return &UpdateSubnetOptions{ - ID: core.StringPtr(id), - SubnetPatch: subnetPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateSubnetOptions) SetID(id string) *UpdateSubnetOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetSubnetPatch : Allow user to set SubnetPatch -func (_options *UpdateSubnetOptions) SetSubnetPatch(subnetPatch map[string]interface{}) *UpdateSubnetOptions { - _options.SubnetPatch = subnetPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateSubnetOptions) SetHeaders(param map[string]string) *UpdateSubnetOptions { - options.Headers = param - return options -} - -// UpdateSubnetReservedIPOptions : The UpdateSubnetReservedIP options. -type UpdateSubnetReservedIPOptions struct { - // The subnet identifier. - SubnetID *string `json:"subnet_id" validate:"required,ne="` - - // The reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // The reserved IP patch. - ReservedIPPatch map[string]interface{} `json:"ReservedIP_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateSubnetReservedIPOptions : Instantiate UpdateSubnetReservedIPOptions -func (*VpcV1) NewUpdateSubnetReservedIPOptions(subnetID string, id string, reservedIPPatch map[string]interface{}) *UpdateSubnetReservedIPOptions { - return &UpdateSubnetReservedIPOptions{ - SubnetID: core.StringPtr(subnetID), - ID: core.StringPtr(id), - ReservedIPPatch: reservedIPPatch, - } -} - -// SetSubnetID : Allow user to set SubnetID -func (_options *UpdateSubnetReservedIPOptions) SetSubnetID(subnetID string) *UpdateSubnetReservedIPOptions { - _options.SubnetID = core.StringPtr(subnetID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateSubnetReservedIPOptions) SetID(id string) *UpdateSubnetReservedIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetReservedIPPatch : Allow user to set ReservedIPPatch -func (_options *UpdateSubnetReservedIPOptions) SetReservedIPPatch(reservedIPPatch map[string]interface{}) *UpdateSubnetReservedIPOptions { - _options.ReservedIPPatch = reservedIPPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateSubnetReservedIPOptions) SetHeaders(param map[string]string) *UpdateSubnetReservedIPOptions { - options.Headers = param - return options -} - -// UpdateVirtualNetworkInterfaceOptions : The UpdateVirtualNetworkInterface options. -type UpdateVirtualNetworkInterfaceOptions struct { - // The virtual network interface identifier. - ID *string `json:"id" validate:"required,ne="` - - // The virtual network interface patch. - VirtualNetworkInterfacePatch map[string]interface{} `json:"VirtualNetworkInterface_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVirtualNetworkInterfaceOptions : Instantiate UpdateVirtualNetworkInterfaceOptions -func (*VpcV1) NewUpdateVirtualNetworkInterfaceOptions(id string, virtualNetworkInterfacePatch map[string]interface{}) *UpdateVirtualNetworkInterfaceOptions { - return &UpdateVirtualNetworkInterfaceOptions{ - ID: core.StringPtr(id), - VirtualNetworkInterfacePatch: virtualNetworkInterfacePatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateVirtualNetworkInterfaceOptions) SetID(id string) *UpdateVirtualNetworkInterfaceOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVirtualNetworkInterfacePatch : Allow user to set VirtualNetworkInterfacePatch -func (_options *UpdateVirtualNetworkInterfaceOptions) SetVirtualNetworkInterfacePatch(virtualNetworkInterfacePatch map[string]interface{}) *UpdateVirtualNetworkInterfaceOptions { - _options.VirtualNetworkInterfacePatch = virtualNetworkInterfacePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVirtualNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateVirtualNetworkInterfaceOptions { - options.Headers = param - return options -} - -// UpdateVolumeOptions : The UpdateVolume options. -type UpdateVolumeOptions struct { - // The volume identifier. - ID *string `json:"id" validate:"required,ne="` - - // The volume patch. - VolumePatch map[string]interface{} `json:"Volume_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 -} - -// NewUpdateVolumeOptions : Instantiate UpdateVolumeOptions -func (*VpcV1) NewUpdateVolumeOptions(id string, volumePatch map[string]interface{}) *UpdateVolumeOptions { - return &UpdateVolumeOptions{ - ID: core.StringPtr(id), - VolumePatch: volumePatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateVolumeOptions) SetID(id string) *UpdateVolumeOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVolumePatch : Allow user to set VolumePatch -func (_options *UpdateVolumeOptions) SetVolumePatch(volumePatch map[string]interface{}) *UpdateVolumeOptions { - _options.VolumePatch = volumePatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateVolumeOptions) SetIfMatch(ifMatch string) *UpdateVolumeOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVolumeOptions) SetHeaders(param map[string]string) *UpdateVolumeOptions { - options.Headers = param - return options -} - -// UpdateVPCAddressPrefixOptions : The UpdateVPCAddressPrefix options. -type UpdateVPCAddressPrefixOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The prefix identifier. - ID *string `json:"id" validate:"required,ne="` - - // The prefix patch. - AddressPrefixPatch map[string]interface{} `json:"AddressPrefix_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPCAddressPrefixOptions : Instantiate UpdateVPCAddressPrefixOptions -func (*VpcV1) NewUpdateVPCAddressPrefixOptions(vpcID string, id string, addressPrefixPatch map[string]interface{}) *UpdateVPCAddressPrefixOptions { - return &UpdateVPCAddressPrefixOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - AddressPrefixPatch: addressPrefixPatch, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *UpdateVPCAddressPrefixOptions) SetVPCID(vpcID string) *UpdateVPCAddressPrefixOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateVPCAddressPrefixOptions) SetID(id string) *UpdateVPCAddressPrefixOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetAddressPrefixPatch : Allow user to set AddressPrefixPatch -func (_options *UpdateVPCAddressPrefixOptions) SetAddressPrefixPatch(addressPrefixPatch map[string]interface{}) *UpdateVPCAddressPrefixOptions { - _options.AddressPrefixPatch = addressPrefixPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPCAddressPrefixOptions) SetHeaders(param map[string]string) *UpdateVPCAddressPrefixOptions { - options.Headers = param - return options -} - -// UpdateVPCDnsResolutionBindingOptions : The UpdateVPCDnsResolutionBinding options. -type UpdateVPCDnsResolutionBindingOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The DNS resolution binding identifier. - ID *string `json:"id" validate:"required,ne="` - - // The DNS resolution binding patch. - VpcdnsResolutionBindingPatch map[string]interface{} `json:"VpcdnsResolutionBinding_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPCDnsResolutionBindingOptions : Instantiate UpdateVPCDnsResolutionBindingOptions -func (*VpcV1) NewUpdateVPCDnsResolutionBindingOptions(vpcID string, id string, vpcdnsResolutionBindingPatch map[string]interface{}) *UpdateVPCDnsResolutionBindingOptions { - return &UpdateVPCDnsResolutionBindingOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - VpcdnsResolutionBindingPatch: vpcdnsResolutionBindingPatch, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *UpdateVPCDnsResolutionBindingOptions) SetVPCID(vpcID string) *UpdateVPCDnsResolutionBindingOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateVPCDnsResolutionBindingOptions) SetID(id string) *UpdateVPCDnsResolutionBindingOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVpcdnsResolutionBindingPatch : Allow user to set VpcdnsResolutionBindingPatch -func (_options *UpdateVPCDnsResolutionBindingOptions) SetVpcdnsResolutionBindingPatch(vpcdnsResolutionBindingPatch map[string]interface{}) *UpdateVPCDnsResolutionBindingOptions { - _options.VpcdnsResolutionBindingPatch = vpcdnsResolutionBindingPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPCDnsResolutionBindingOptions) SetHeaders(param map[string]string) *UpdateVPCDnsResolutionBindingOptions { - options.Headers = param - return options -} - -// UpdateVPCOptions : The UpdateVPC options. -type UpdateVPCOptions struct { - // The VPC identifier. - ID *string `json:"id" validate:"required,ne="` - - // The VPC patch. - VPCPatch map[string]interface{} `json:"VPC_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 -} - -// NewUpdateVPCOptions : Instantiate UpdateVPCOptions -func (*VpcV1) NewUpdateVPCOptions(id string, vpcPatch map[string]interface{}) *UpdateVPCOptions { - return &UpdateVPCOptions{ - ID: core.StringPtr(id), - VPCPatch: vpcPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateVPCOptions) SetID(id string) *UpdateVPCOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVPCPatch : Allow user to set VPCPatch -func (_options *UpdateVPCOptions) SetVPCPatch(vpcPatch map[string]interface{}) *UpdateVPCOptions { - _options.VPCPatch = vpcPatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateVPCOptions) SetIfMatch(ifMatch string) *UpdateVPCOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPCOptions) SetHeaders(param map[string]string) *UpdateVPCOptions { - options.Headers = param - return options -} - -// UpdateVPCRouteOptions : The UpdateVPCRoute options. -type UpdateVPCRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The route identifier. - ID *string `json:"id" validate:"required,ne="` - - // The route patch. - RoutePatch map[string]interface{} `json:"Route_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPCRouteOptions : Instantiate UpdateVPCRouteOptions -func (*VpcV1) NewUpdateVPCRouteOptions(vpcID string, id string, routePatch map[string]interface{}) *UpdateVPCRouteOptions { - return &UpdateVPCRouteOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - RoutePatch: routePatch, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *UpdateVPCRouteOptions) SetVPCID(vpcID string) *UpdateVPCRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateVPCRouteOptions) SetID(id string) *UpdateVPCRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetRoutePatch : Allow user to set RoutePatch -func (_options *UpdateVPCRouteOptions) SetRoutePatch(routePatch map[string]interface{}) *UpdateVPCRouteOptions { - _options.RoutePatch = routePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPCRouteOptions) SetHeaders(param map[string]string) *UpdateVPCRouteOptions { - options.Headers = param - return options -} - -// UpdateVPCRoutingTableOptions : The UpdateVPCRoutingTable options. -type UpdateVPCRoutingTableOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The routing table identifier. - ID *string `json:"id" validate:"required,ne="` - - // The routing table patch. - RoutingTablePatch map[string]interface{} `json:"RoutingTable_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 -} - -// NewUpdateVPCRoutingTableOptions : Instantiate UpdateVPCRoutingTableOptions -func (*VpcV1) NewUpdateVPCRoutingTableOptions(vpcID string, id string, routingTablePatch map[string]interface{}) *UpdateVPCRoutingTableOptions { - return &UpdateVPCRoutingTableOptions{ - VPCID: core.StringPtr(vpcID), - ID: core.StringPtr(id), - RoutingTablePatch: routingTablePatch, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *UpdateVPCRoutingTableOptions) SetVPCID(vpcID string) *UpdateVPCRoutingTableOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateVPCRoutingTableOptions) SetID(id string) *UpdateVPCRoutingTableOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetRoutingTablePatch : Allow user to set RoutingTablePatch -func (_options *UpdateVPCRoutingTableOptions) SetRoutingTablePatch(routingTablePatch map[string]interface{}) *UpdateVPCRoutingTableOptions { - _options.RoutingTablePatch = routingTablePatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateVPCRoutingTableOptions) SetIfMatch(ifMatch string) *UpdateVPCRoutingTableOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPCRoutingTableOptions) SetHeaders(param map[string]string) *UpdateVPCRoutingTableOptions { - options.Headers = param - return options -} - -// UpdateVPCRoutingTableRouteOptions : The UpdateVPCRoutingTableRoute options. -type UpdateVPCRoutingTableRouteOptions struct { - // The VPC identifier. - VPCID *string `json:"vpc_id" validate:"required,ne="` - - // The routing table identifier. - RoutingTableID *string `json:"routing_table_id" validate:"required,ne="` - - // The VPC routing table route identifier. - ID *string `json:"id" validate:"required,ne="` - - // The VPC route patch. - RoutePatch map[string]interface{} `json:"Route_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPCRoutingTableRouteOptions : Instantiate UpdateVPCRoutingTableRouteOptions -func (*VpcV1) NewUpdateVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string, routePatch map[string]interface{}) *UpdateVPCRoutingTableRouteOptions { - return &UpdateVPCRoutingTableRouteOptions{ - VPCID: core.StringPtr(vpcID), - RoutingTableID: core.StringPtr(routingTableID), - ID: core.StringPtr(id), - RoutePatch: routePatch, - } -} - -// SetVPCID : Allow user to set VPCID -func (_options *UpdateVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *UpdateVPCRoutingTableRouteOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetRoutingTableID : Allow user to set RoutingTableID -func (_options *UpdateVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *UpdateVPCRoutingTableRouteOptions { - _options.RoutingTableID = core.StringPtr(routingTableID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateVPCRoutingTableRouteOptions) SetID(id string) *UpdateVPCRoutingTableRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetRoutePatch : Allow user to set RoutePatch -func (_options *UpdateVPCRoutingTableRouteOptions) SetRoutePatch(routePatch map[string]interface{}) *UpdateVPCRoutingTableRouteOptions { - _options.RoutePatch = routePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *UpdateVPCRoutingTableRouteOptions { - options.Headers = param - return options -} - -// UpdateVPNGatewayConnectionOptions : The UpdateVPNGatewayConnection options. -type UpdateVPNGatewayConnectionOptions 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 VPN gateway connection patch. - VPNGatewayConnectionPatch map[string]interface{} `json:"VPNGatewayConnection_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPNGatewayConnectionOptions : Instantiate UpdateVPNGatewayConnectionOptions -func (*VpcV1) NewUpdateVPNGatewayConnectionOptions(vpnGatewayID string, id string, vpnGatewayConnectionPatch map[string]interface{}) *UpdateVPNGatewayConnectionOptions { - return &UpdateVPNGatewayConnectionOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - VPNGatewayConnectionPatch: vpnGatewayConnectionPatch, - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *UpdateVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *UpdateVPNGatewayConnectionOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateVPNGatewayConnectionOptions) SetID(id string) *UpdateVPNGatewayConnectionOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVPNGatewayConnectionPatch : Allow user to set VPNGatewayConnectionPatch -func (_options *UpdateVPNGatewayConnectionOptions) SetVPNGatewayConnectionPatch(vpnGatewayConnectionPatch map[string]interface{}) *UpdateVPNGatewayConnectionOptions { - _options.VPNGatewayConnectionPatch = vpnGatewayConnectionPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *UpdateVPNGatewayConnectionOptions { - options.Headers = param - return options -} - -// UpdateVPNGatewayOptions : The UpdateVPNGateway options. -type UpdateVPNGatewayOptions struct { - // The VPN gateway identifier. - ID *string `json:"id" validate:"required,ne="` - - // The VPN gateway patch. - VPNGatewayPatch map[string]interface{} `json:"VPNGateway_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPNGatewayOptions : Instantiate UpdateVPNGatewayOptions -func (*VpcV1) NewUpdateVPNGatewayOptions(id string, vpnGatewayPatch map[string]interface{}) *UpdateVPNGatewayOptions { - return &UpdateVPNGatewayOptions{ - ID: core.StringPtr(id), - VPNGatewayPatch: vpnGatewayPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateVPNGatewayOptions) SetID(id string) *UpdateVPNGatewayOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVPNGatewayPatch : Allow user to set VPNGatewayPatch -func (_options *UpdateVPNGatewayOptions) SetVPNGatewayPatch(vpnGatewayPatch map[string]interface{}) *UpdateVPNGatewayOptions { - _options.VPNGatewayPatch = vpnGatewayPatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPNGatewayOptions) SetHeaders(param map[string]string) *UpdateVPNGatewayOptions { - options.Headers = param - return options -} - -// UpdateVPNServerOptions : The UpdateVPNServer options. -type UpdateVPNServerOptions struct { - // The VPN server identifier. - ID *string `json:"id" validate:"required,ne="` - - // The VPN server patch. - VPNServerPatch map[string]interface{} `json:"VPNServer_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 -} - -// NewUpdateVPNServerOptions : Instantiate UpdateVPNServerOptions -func (*VpcV1) NewUpdateVPNServerOptions(id string, vpnServerPatch map[string]interface{}) *UpdateVPNServerOptions { - return &UpdateVPNServerOptions{ - ID: core.StringPtr(id), - VPNServerPatch: vpnServerPatch, - } -} - -// SetID : Allow user to set ID -func (_options *UpdateVPNServerOptions) SetID(id string) *UpdateVPNServerOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVPNServerPatch : Allow user to set VPNServerPatch -func (_options *UpdateVPNServerOptions) SetVPNServerPatch(vpnServerPatch map[string]interface{}) *UpdateVPNServerOptions { - _options.VPNServerPatch = vpnServerPatch - return _options -} - -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateVPNServerOptions) SetIfMatch(ifMatch string) *UpdateVPNServerOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPNServerOptions) SetHeaders(param map[string]string) *UpdateVPNServerOptions { - options.Headers = param - return options -} - -// UpdateVPNServerRouteOptions : The UpdateVPNServerRoute options. -type UpdateVPNServerRouteOptions struct { - // The VPN server identifier. - VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` - - // The VPN route identifier. - ID *string `json:"id" validate:"required,ne="` - - // The VPN route patch. - VPNServerRoutePatch map[string]interface{} `json:"VPNServerRoute_patch" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewUpdateVPNServerRouteOptions : Instantiate UpdateVPNServerRouteOptions -func (*VpcV1) NewUpdateVPNServerRouteOptions(vpnServerID string, id string, vpnServerRoutePatch map[string]interface{}) *UpdateVPNServerRouteOptions { - return &UpdateVPNServerRouteOptions{ - VPNServerID: core.StringPtr(vpnServerID), - ID: core.StringPtr(id), - VPNServerRoutePatch: vpnServerRoutePatch, - } -} - -// SetVPNServerID : Allow user to set VPNServerID -func (_options *UpdateVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *UpdateVPNServerRouteOptions { - _options.VPNServerID = core.StringPtr(vpnServerID) - return _options -} - -// SetID : Allow user to set ID -func (_options *UpdateVPNServerRouteOptions) SetID(id string) *UpdateVPNServerRouteOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetVPNServerRoutePatch : Allow user to set VPNServerRoutePatch -func (_options *UpdateVPNServerRouteOptions) SetVPNServerRoutePatch(vpnServerRoutePatch map[string]interface{}) *UpdateVPNServerRouteOptions { - _options.VPNServerRoutePatch = vpnServerRoutePatch - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *UpdateVPNServerRouteOptions) SetHeaders(param map[string]string) *UpdateVPNServerRouteOptions { - options.Headers = param - return options -} - -// Vcpu : The VCPU configuration. -type Vcpu struct { - // The VCPU architecture. - Architecture *string `json:"architecture" validate:"required"` - - // The number of VCPUs assigned. - Count *int64 `json:"count" validate:"required"` - - // The VCPU manufacturer. - Manufacturer *string `json:"manufacturer" validate:"required"` -} - -// UnmarshalVcpu unmarshals an instance of Vcpu from the specified map of raw messages. -func UnmarshalVcpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Vcpu) - err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) - if err != nil { - err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "count", &obj.Count) - if err != nil { - err = core.SDKErrorf(err, "", "count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) - if err != nil { - err = core.SDKErrorf(err, "", "manufacturer-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPC : VPC struct -type VPC struct { - // Indicates whether this VPC is connected to Classic Infrastructure. If true, this VPC's resources 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. - ClassicAccess *bool `json:"classic_access" validate:"required"` - - // The date and time that the VPC was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` - - // The CSE ([Cloud Service Endpoint](https://cloud.ibm.com/docs/resources?topic=resources-service-endpoints)) source IP - // addresses for the VPC. The VPC will have one CSE source IP address per zone. - CseSourceIps []VpccseSourceIP `json:"cse_source_ips,omitempty"` - - // The default network ACL to use for subnets created in this VPC. - DefaultNetworkACL *NetworkACLReference `json:"default_network_acl" validate:"required"` - - // The default routing table to use for subnets created in this VPC. - DefaultRoutingTable *RoutingTableReference `json:"default_routing_table" validate:"required"` - - // The default security group for this VPC. Resources created in this VPC that allow - // a security group to be optionally specified will use this security group by - // default. - DefaultSecurityGroup *SecurityGroupReference `json:"default_security_group" validate:"required"` - - // The DNS configuration for this VPC. - Dns *Vpcdns `json:"dns" validate:"required"` - - // The reasons for the current `health_state` (if any). - HealthReasons []VPCHealthReason `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 VPC. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` - - // The name for this VPC. The name is unique across all VPCs in the region. - Name *string `json:"name" validate:"required"` - - // The resource group for this VPC. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of this VPC. - Status *string `json:"status" validate:"required"` -} - -// Constants associated with the VPC.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 ( - VPCHealthStateDegradedConst = "degraded" - VPCHealthStateFaultedConst = "faulted" - VPCHealthStateInapplicableConst = "inapplicable" - VPCHealthStateOkConst = "ok" -) - -// Constants associated with the VPC.ResourceType property. -// The resource type. -const ( - VPCResourceTypeVPCConst = "vpc" -) - -// Constants associated with the VPC.Status property. -// The status of this VPC. -const ( - VPCStatusAvailableConst = "available" - VPCStatusDeletingConst = "deleting" - VPCStatusFailedConst = "failed" - VPCStatusPendingConst = "pending" -) - -// UnmarshalVPC unmarshals an instance of VPC from the specified map of raw messages. -func UnmarshalVPC(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPC) - err = core.UnmarshalPrimitive(m, "classic_access", &obj.ClassicAccess) - if err != nil { - err = core.SDKErrorf(err, "", "classic_access-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "cse_source_ips", &obj.CseSourceIps, UnmarshalVpccseSourceIP) - if err != nil { - err = core.SDKErrorf(err, "", "cse_source_ips-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_network_acl", &obj.DefaultNetworkACL, UnmarshalNetworkACLReference) - if err != nil { - err = core.SDKErrorf(err, "", "default_network_acl-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_routing_table", &obj.DefaultRoutingTable, UnmarshalRoutingTableReference) - if err != nil { - err = core.SDKErrorf(err, "", "default_routing_table-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_security_group", &obj.DefaultSecurityGroup, UnmarshalSecurityGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "default_security_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdns) - if err != nil { - err = core.SDKErrorf(err, "", "dns-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPCHealthReason) - 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, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpccseSourceIP : VpccseSourceIP struct -type VpccseSourceIP struct { - // The cloud service endpoint source IP address for this zone. - IP *IP `json:"ip" validate:"required"` - - // The zone this cloud service endpoint source IP resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// UnmarshalVpccseSourceIP unmarshals an instance of VpccseSourceIP from the specified map of raw messages. -func UnmarshalVpccseSourceIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpccseSourceIP) - err = core.UnmarshalModel(m, "ip", &obj.IP, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "ip-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 -} - -// VPCCollection : VPCCollection struct -type VPCCollection struct { - // A link to the first page of resources. - First *VPCCollectionFirst `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"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` - - // Collection of VPCs. - Vpcs []VPC `json:"vpcs" validate:"required"` -} - -// 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) - 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, UnmarshalVPCCollectionNext) - 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 - } - err = core.UnmarshalModel(m, "vpcs", &obj.Vpcs, UnmarshalVPC) - if err != nil { - err = core.SDKErrorf(err, "", "vpcs-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 *VPCCollection) 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 -} - -// 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. - EnableHub *bool `json:"enable_hub" validate:"required"` - - // The number of DNS resolution bindings for this VPC. - ResolutionBindingCount *int64 `json:"resolution_binding_count" validate:"required"` - - // The DNS resolver configuration for the VPC. - Resolver VpcdnsResolverIntf `json:"resolver" validate:"required"` -} - -// UnmarshalVpcdns unmarshals an instance of Vpcdns from the specified map of raw messages. -func UnmarshalVpcdns(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Vpcdns) - err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) - if err != nil { - err = core.SDKErrorf(err, "", "enable_hub-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "resolution_binding_count", &obj.ResolutionBindingCount) - if err != nil { - err = core.SDKErrorf(err, "", "resolution_binding_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolver) - if err != nil { - err = core.SDKErrorf(err, "", "resolver-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsPatch : The DNS configuration for this VPC. -type VpcdnsPatch struct { - // Indicates whether this VPC is enabled as a DNS name resolution hub. - // - // Updating the value to `true` requires `allow_dns_resolution_binding` to be `true` for all endpoint gateways residing - // in this VPC. - // - // Changing the value requires `dns.resolution_binding_count` to be zero. - EnableHub *bool `json:"enable_hub,omitempty"` - - Resolver *VpcdnsResolverPatch `json:"resolver,omitempty"` -} - -// UnmarshalVpcdnsPatch unmarshals an instance of VpcdnsPatch from the specified map of raw messages. -func UnmarshalVpcdnsPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsPatch) - err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) - if err != nil { - err = core.SDKErrorf(err, "", "enable_hub-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPatch) - if err != nil { - err = core.SDKErrorf(err, "", "resolver-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - 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, -// and hosts on the internet. -type VpcdnsPrototype struct { - // Indicates whether this VPC is enabled as a DNS name resolution hub. - EnableHub *bool `json:"enable_hub,omitempty"` - - Resolver VpcdnsResolverPrototypeIntf `json:"resolver,omitempty"` -} - -// UnmarshalVpcdnsPrototype unmarshals an instance of VpcdnsPrototype from the specified map of raw messages. -func UnmarshalVpcdnsPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsPrototype) - err = core.UnmarshalPrimitive(m, "enable_hub", &obj.EnableHub) - if err != nil { - err = core.SDKErrorf(err, "", "enable_hub-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "resolver", &obj.Resolver, UnmarshalVpcdnsResolverPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "resolver-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolutionBinding : VpcdnsResolutionBinding struct -type VpcdnsResolutionBinding struct { - // The date and time that the DNS resolution binding was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The endpoint gateways that have `allow_dns_resolution_binding` set to `true` and reside in the VPC that has - // `dns.enable_hub` set to `false`. - // - // The endpoint gateways may be remote and therefore may not be directly retrievable. - EndpointGateways []EndpointGatewayReferenceRemote `json:"endpoint_gateways" validate:"required"` - - // The reasons for the current `health_state` (if any). - HealthReasons []VpcdnsResolutionBindingHealthReason `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 DNS resolution binding. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this DNS resolution binding. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of the DNS resolution binding. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this DNS resolution binding. The name is unique across all DNS resolution bindings for the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The VPC bound to for DNS resolution. - // - // The VPC may be remote and therefore may not be directly retrievable. - VPC *VPCReferenceRemote `json:"vpc" validate:"required"` -} - -// Constants associated with the VpcdnsResolutionBinding.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 ( - VpcdnsResolutionBindingHealthStateDegradedConst = "degraded" - VpcdnsResolutionBindingHealthStateFaultedConst = "faulted" - VpcdnsResolutionBindingHealthStateInapplicableConst = "inapplicable" - VpcdnsResolutionBindingHealthStateOkConst = "ok" -) - -// Constants associated with the VpcdnsResolutionBinding.LifecycleState property. -// The lifecycle state of the DNS resolution binding. -const ( - VpcdnsResolutionBindingLifecycleStateDeletingConst = "deleting" - VpcdnsResolutionBindingLifecycleStateFailedConst = "failed" - VpcdnsResolutionBindingLifecycleStatePendingConst = "pending" - VpcdnsResolutionBindingLifecycleStateStableConst = "stable" - VpcdnsResolutionBindingLifecycleStateSuspendedConst = "suspended" - VpcdnsResolutionBindingLifecycleStateUpdatingConst = "updating" - VpcdnsResolutionBindingLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VpcdnsResolutionBinding.ResourceType property. -// The resource type. -const ( - VpcdnsResolutionBindingResourceTypeVPCDnsResolutionBindingConst = "vpc_dns_resolution_binding" -) - -// UnmarshalVpcdnsResolutionBinding unmarshals an instance of VpcdnsResolutionBinding from the specified map of raw messages. -func UnmarshalVpcdnsResolutionBinding(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolutionBinding) - 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, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGatewayReferenceRemote) - if err != nil { - err = core.SDKErrorf(err, "", "endpoint_gateways-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVpcdnsResolutionBindingHealthReason) - 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, "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.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceRemote) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolutionBindingCollection : VpcdnsResolutionBindingCollection struct -type VpcdnsResolutionBindingCollection struct { - // Collection of DNS resolution bindings for this VPC. - DnsResolutionBindings []VpcdnsResolutionBinding `json:"dns_resolution_bindings" validate:"required"` - - // A link to the first page of resources. - First *VpcdnsResolutionBindingCollectionFirst `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"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalVpcdnsResolutionBindingCollection unmarshals an instance of VpcdnsResolutionBindingCollection from the specified map of raw messages. -func UnmarshalVpcdnsResolutionBindingCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolutionBindingCollection) - err = core.UnmarshalModel(m, "dns_resolution_bindings", &obj.DnsResolutionBindings, UnmarshalVpcdnsResolutionBinding) - if err != nil { - err = core.SDKErrorf(err, "", "dns_resolution_bindings-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVpcdnsResolutionBindingCollectionFirst) - 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, UnmarshalVpcdnsResolutionBindingCollectionNext) - 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 *VpcdnsResolutionBindingCollection) 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 -} - -// VpcdnsResolutionBindingHealthReason : VpcdnsResolutionBindingHealthReason struct -type VpcdnsResolutionBindingHealthReason 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"` -} - -// Constants associated with the VpcdnsResolutionBindingHealthReason.Code property. -// A reason code for this health state. -const ( - VpcdnsResolutionBindingHealthReasonCodeDisconnectedFromBoundVPCConst = "disconnected_from_bound_vpc" - VpcdnsResolutionBindingHealthReasonCodeInternalErrorConst = "internal_error" -) - -// UnmarshalVpcdnsResolutionBindingHealthReason unmarshals an instance of VpcdnsResolutionBindingHealthReason from the specified map of raw messages. -func UnmarshalVpcdnsResolutionBindingHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolutionBindingHealthReason) - 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 -} - -// VpcdnsResolutionBindingPatch : VpcdnsResolutionBindingPatch struct -type VpcdnsResolutionBindingPatch struct { - // The name for this DNS resolution binding. The name must not be used by another DNS resolution binding for the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalVpcdnsResolutionBindingPatch unmarshals an instance of VpcdnsResolutionBindingPatch from the specified map of raw messages. -func UnmarshalVpcdnsResolutionBindingPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolutionBindingPatch) - 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 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()) - } - return -} - -// VpcdnsResolver : VpcdnsResolver struct -// Models which "extend" this model: -// - VpcdnsResolverTypeDelegated -// - VpcdnsResolverTypeManual -// - VpcdnsResolverTypeSystem -type VpcdnsResolver struct { - // The DNS servers for this VPC. The servers are populated: - // - // - by the system when `dns.resolver.type` is `system` - // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` - // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. - Servers []DnsServer `json:"servers" validate:"required"` - - // The type of the DNS resolver used for the VPC. - // - // - `delegated`: DNS server addresses are provided by the DNS resolver of the VPC - // specified in `dns.resolver.vpc`. - // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. - // - `system`: DNS server addresses are provided by the system. - Type *string `json:"type" validate:"required"` - - // The VPC whose DNS resolver provides the DNS server addresses for this VPC. - // - // The VPC may be remote and therefore may not be directly retrievable. - VPC *VPCReferenceDnsResolverContext `json:"vpc,omitempty"` - - // The manually specified DNS servers for this VPC. - // - // If the DNS servers have `zone_affinity`, the DHCP [Domain Name Server - // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list the DNS server with the - // affinity for that zone first, followed by the unique DNS servers from other zones. - // - // If the DNS servers do not have `zone_affinity`, the DHCP [Domain Name Server - // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS - // servers in the order specified. - ManualServers []DnsServer `json:"manual_servers,omitempty"` - - // The configuration of the system DNS resolver for this VPC. - // - // - `custom_resolver`: A custom DNS resolver is configured for this VPC. - // - // - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when - // the VPC has either or both of the following: - // - // - at least one endpoint gateway residing in it - // - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it - // - // - `default`: The provider default DNS resolvers are configured for this VPC. - // - // This system DNS resolver configuration is used when the VPC has: - // - // - no custom DNS resolver configured for it, and - // - no endpoint gateways residing in it, and - // - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. - Configuration *string `json:"configuration,omitempty"` -} - -// Constants associated with the VpcdnsResolver.Type property. -// The type of the DNS resolver used for the VPC. -// -// - `delegated`: DNS server addresses are provided by the DNS resolver of the VPC -// specified in `dns.resolver.vpc`. -// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. -// - `system`: DNS server addresses are provided by the system. -const ( - VpcdnsResolverTypeDelegatedConst = "delegated" - VpcdnsResolverTypeManualConst = "manual" - VpcdnsResolverTypeSystemConst = "system" -) - -// Constants associated with the VpcdnsResolver.Configuration property. -// The configuration of the system DNS resolver for this VPC. -// -// - `custom_resolver`: A custom DNS resolver is configured for this VPC. -// -// - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when -// the VPC has either or both of the following: -// -// - at least one endpoint gateway residing in it -// -// - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it -// -// - `default`: The provider default DNS resolvers are configured for this VPC. -// -// This system DNS resolver configuration is used when the VPC has: -// -// - no custom DNS resolver configured for it, and -// - no endpoint gateways residing in it, and -// - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. -const ( - VpcdnsResolverConfigurationCustomResolverConst = "custom_resolver" - VpcdnsResolverConfigurationDefaultConst = "default" - VpcdnsResolverConfigurationPrivateResolverConst = "private_resolver" -) - -func (*VpcdnsResolver) isaVpcdnsResolver() bool { - return true -} - -type VpcdnsResolverIntf interface { - isaVpcdnsResolver() bool -} - -// UnmarshalVpcdnsResolver unmarshals an instance of VpcdnsResolver from the specified map of raw messages. -func UnmarshalVpcdnsResolver(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolver) - err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) - if err != nil { - err = core.SDKErrorf(err, "", "servers-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.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer) - if err != nil { - err = core.SDKErrorf(err, "", "manual_servers-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration) - if err != nil { - err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverPatch : VpcdnsResolverPatch struct -type VpcdnsResolverPatch struct { - // The DNS servers to use for this VPC, replacing any existing servers. All the DNS servers must either: - // - // - have a unique `zone_affinity`, or - // - not have a `zone_affinity`. - // - // If `zone_affinity` is specified, exactly one DNS server must be specified for each zone in the region. The DHCP - // [Domain Name Server Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list this DNS - // server first, followed by unique DNS servers from other zones if available. - // - // If `zone_affinity` is not specified, the DHCP [Domain Name Server - // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS - // servers in the order specified. - // - // `dns.resolver.manual_servers` must be set if and only if `dns.resolver.type` is `manual`. - ManualServers []DnsServerPrototype `json:"manual_servers,omitempty"` - - // The type of the DNS resolver to use. - // - // - `delegated`: DNS server addresses will be provided by the resolver for the VPC - // specified in `dns.resolver.vpc`. Requires `dns.enable_hub` to be - // `false`. - // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. - // - `system`: DNS server addresses will be provided by the system and depend on the - // configuration. - // - // Updating from `manual` requires `dns.resolver.manual_servers` to be specified as - // `null`. - // - // Updating to `manual` requires `dns.resolver.manual_servers` to be specified and not empty. - // - // Updating from `delegated` requires `dns.resolver.vpc` to be specified as `null`. - Type *string `json:"type,omitempty"` - - // The VPC to provide DNS server addresses for this VPC. The specified VPC must be configured - // with a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) custom resolver and must be in - // one of this VPC's DNS resolution bindings. - // - // Specify `null` to remove an existing VPC. - // - // This property must be set if and only if `dns.resolver.type` is `delegated`. - VPC VpcdnsResolverVPCPatchIntf `json:"vpc,omitempty"` -} - -// Constants associated with the VpcdnsResolverPatch.Type property. -// The type of the DNS resolver to use. -// -// - `delegated`: DNS server addresses will be provided by the resolver for the VPC -// specified in `dns.resolver.vpc`. Requires `dns.enable_hub` to be -// `false`. -// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. -// - `system`: DNS server addresses will be provided by the system and depend on the -// configuration. -// -// Updating from `manual` requires `dns.resolver.manual_servers` to be specified as -// `null`. -// -// Updating to `manual` requires `dns.resolver.manual_servers` to be specified and not empty. -// -// Updating from `delegated` requires `dns.resolver.vpc` to be specified as `null`. -const ( - VpcdnsResolverPatchTypeDelegatedConst = "delegated" - VpcdnsResolverPatchTypeManualConst = "manual" - VpcdnsResolverPatchTypeSystemConst = "system" -) - -// UnmarshalVpcdnsResolverPatch unmarshals an instance of VpcdnsResolverPatch from the specified map of raw messages. -func UnmarshalVpcdnsResolverPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverPatch) - err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "manual_servers-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.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVpcdnsResolverVPCPatch) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverPrototype : VpcdnsResolverPrototype struct -// Models which "extend" this model: -// - VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype -// - VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype -type VpcdnsResolverPrototype struct { - // The type of the DNS resolver to use. - // - // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. - // - `system`: DNS server addresses will be provided by the system and depend on the - // configuration. - Type *string `json:"type,omitempty"` - - // The DNS servers to use for this VPC. All the DNS servers must either: - // - // - have a unique `zone_affinity`, or - // - not have a `zone_affinity`. - // - // If `zone_affinity` is specified, exactly one DNS server must be specified for each zone in the region. The DHCP - // [Domain Name Server Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list this DNS - // server first, followed by unique DNS servers from other zones if available. - // - // If `zone_affinity` is not specified, the DHCP [Domain Name Server - // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS - // servers in the order specified. - ManualServers []DnsServerPrototype `json:"manual_servers,omitempty"` -} - -// Constants associated with the VpcdnsResolverPrototype.Type property. -// The type of the DNS resolver to use. -// -// - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. -// - `system`: DNS server addresses will be provided by the system and depend on the -// configuration. -const ( - VpcdnsResolverPrototypeTypeManualConst = "manual" - VpcdnsResolverPrototypeTypeSystemConst = "system" -) - -func (*VpcdnsResolverPrototype) isaVpcdnsResolverPrototype() bool { - return true -} - -type VpcdnsResolverPrototypeIntf interface { - isaVpcdnsResolverPrototype() bool -} - -// UnmarshalVpcdnsResolverPrototype unmarshals an instance of VpcdnsResolverPrototype from the specified map of raw messages. -func UnmarshalVpcdnsResolverPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverPrototype) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "manual_servers-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverVPCPatch : The VPC to provide DNS server addresses for this VPC. The specified VPC must be configured with a [DNS -// Services](https://cloud.ibm.com/docs/dns-svcs) custom resolver and must be in one of this VPC's DNS resolution -// bindings. -// -// Specify `null` to remove an existing VPC. -// -// This property must be set if and only if `dns.resolver.type` is `delegated`. -// Models which "extend" this model: -// - VpcdnsResolverVPCPatchVPCIdentityByID -// - VpcdnsResolverVPCPatchVPCIdentityByCRN -// - VpcdnsResolverVPCPatchVPCIdentityByHref -type VpcdnsResolverVPCPatch struct { - // The unique identifier for this VPC. - ID *string `json:"id,omitempty"` - - // The CRN for this VPC. - CRN *string `json:"crn,omitempty"` - - // The URL for this VPC. - Href *string `json:"href,omitempty"` -} - -func (*VpcdnsResolverVPCPatch) isaVpcdnsResolverVPCPatch() bool { - return true -} - -type VpcdnsResolverVPCPatchIntf interface { - isaVpcdnsResolverVPCPatch() bool -} - -// UnmarshalVpcdnsResolverVPCPatch unmarshals an instance of VpcdnsResolverVPCPatch from the specified map of raw messages. -func UnmarshalVpcdnsResolverVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverVPCPatch) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCHealthReason : VPCHealthReason struct -type VPCHealthReason 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"` -} - -// Constants associated with the VPCHealthReason.Code property. -// A reason code for this health state. -const ( - VPCHealthReasonCodeDnsResolutionBindingFailedConst = "dns_resolution_binding_failed" - VPCHealthReasonCodeInternalErrorConst = "internal_error" -) - -// UnmarshalVPCHealthReason unmarshals an instance of VPCHealthReason from the specified map of raw messages. -func UnmarshalVPCHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCHealthReason) - 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 -} - -// VPCIdentity : Identifies a VPC by a unique property. -// Models which "extend" this model: -// - VPCIdentityByID -// - VPCIdentityByCRN -// - VPCIdentityByHref -type VPCIdentity struct { - // The unique identifier for this VPC. - ID *string `json:"id,omitempty"` - - // The CRN for this VPC. - CRN *string `json:"crn,omitempty"` - - // The URL for this VPC. - Href *string `json:"href,omitempty"` -} - -func (*VPCIdentity) isaVPCIdentity() bool { - return true -} - -type VPCIdentityIntf interface { - isaVPCIdentity() bool -} - -// UnmarshalVPCIdentity unmarshals an instance of VPCIdentity from the specified map of raw messages. -func UnmarshalVPCIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCPatch : VPCPatch struct -type VPCPatch struct { - // The DNS configuration for this VPC. - Dns *VpcdnsPatch `json:"dns,omitempty"` - - // The name for this VPC. The name must not be used by another VPC in the region. - Name *string `json:"name,omitempty"` -} - -// UnmarshalVPCPatch unmarshals an instance of VPCPatch from the specified map of raw messages. -func UnmarshalVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCPatch) - err = core.UnmarshalModel(m, "dns", &obj.Dns, UnmarshalVpcdnsPatch) - if err != nil { - err = core.SDKErrorf(err, "", "dns-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 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// VPCReference : VPCReference struct -type VPCReference struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this VPC. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` - - // The name for this VPC. The name is unique across all VPCs in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VPCReference.ResourceType property. -// The resource type. -const ( - VPCReferenceResourceTypeVPCConst = "vpc" -) - -// UnmarshalVPCReference unmarshals an instance of VPCReference from the specified map of raw messages. -func UnmarshalVPCReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCReference) - 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, UnmarshalVPCReferenceDeleted) - 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 -} - -// VPCReferenceDnsResolverContext : A VPC whose DNS resolver is delegated to provide DNS servers for this VPC. -// -// The VPC may be remote and therefore may not be directly retrievable. -type VPCReferenceDnsResolverContext struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPCReferenceDnsResolverContextDeleted `json:"deleted,omitempty"` - - // The URL for this VPC. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` - - // The name for this VPC. The name is unique across all VPCs in the region. - 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 *VPCRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VPCReferenceDnsResolverContext.ResourceType property. -// The resource type. -const ( - VPCReferenceDnsResolverContextResourceTypeVPCConst = "vpc" -) - -// UnmarshalVPCReferenceDnsResolverContext unmarshals an instance of VPCReferenceDnsResolverContext from the specified map of raw messages. -func UnmarshalVPCReferenceDnsResolverContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCReferenceDnsResolverContext) - 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, UnmarshalVPCReferenceDnsResolverContextDeleted) - 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, UnmarshalVPCRemote) - 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 -} - -// VPCReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPCReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPCReferenceDeleted unmarshals an instance of VPCReferenceDeleted from the specified map of raw messages. -func UnmarshalVPCReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCReferenceDeleted) - 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 -} - -// VPCReferenceDnsResolverContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPCReferenceDnsResolverContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPCReferenceDnsResolverContextDeleted unmarshals an instance of VPCReferenceDnsResolverContextDeleted from the specified map of raw messages. -func UnmarshalVPCReferenceDnsResolverContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCReferenceDnsResolverContextDeleted) - 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 -} - -// VPCReferenceRemote : VPCReferenceRemote struct -type VPCReferenceRemote struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` - - // The URL for this VPC. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` - - // The name for this VPC. The name is unique across all VPCs in the region. - 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 *VPCRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VPCReferenceRemote.ResourceType property. -// The resource type. -const ( - VPCReferenceRemoteResourceTypeVPCConst = "vpc" -) - -// UnmarshalVPCReferenceRemote unmarshals an instance of VPCReferenceRemote from the specified map of raw messages. -func UnmarshalVPCReferenceRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCReferenceRemote) - 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) - 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, UnmarshalVPCRemote) - 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 -} - -// VPCRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not -// be directly retrievable. -type VPCRemote struct { - // If present, this property indicates that the referenced resource is remote to this - // account, and identifies the owning account. - Account *AccountReference `json:"account,omitempty"` - - // If present, this property indicates that the referenced resource is remote to this - // region, and identifies the native region. - Region *RegionReference `json:"region,omitempty"` -} - -// UnmarshalVPCRemote unmarshals an instance of VPCRemote from the specified map of raw messages. -func UnmarshalVPCRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCRemote) - err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) - if err != nil { - err = core.SDKErrorf(err, "", "account-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 -} - -// VPNGateway : VPNGateway struct -// Models which "extend" this model: -// - VPNGatewayRouteMode -// - VPNGatewayPolicyMode -type VPNGateway struct { - // Connections for this VPN gateway. - Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` - - // The date and time that this VPN gateway was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` - - // The reasons for the current `health_state` (if any). - HealthReasons []VPNGatewayHealthReason `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 VPN gateway's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway. - ID *string `json:"id" validate:"required"` - - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the VPN gateway. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // Collection of VPN gateway members. - Members []VPNGatewayMember `json:"members" validate:"required"` - - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this VPN gateway. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The VPC this VPN gateway resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // Route mode VPN gateway. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the VPNGateway.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 ( - VPNGatewayHealthStateDegradedConst = "degraded" - VPNGatewayHealthStateFaultedConst = "faulted" - VPNGatewayHealthStateInapplicableConst = "inapplicable" - VPNGatewayHealthStateOkConst = "ok" -) - -// Constants associated with the VPNGateway.LifecycleState property. -// The lifecycle state of the VPN gateway. -const ( - VPNGatewayLifecycleStateDeletingConst = "deleting" - VPNGatewayLifecycleStateFailedConst = "failed" - VPNGatewayLifecycleStatePendingConst = "pending" - VPNGatewayLifecycleStateStableConst = "stable" - VPNGatewayLifecycleStateSuspendedConst = "suspended" - VPNGatewayLifecycleStateUpdatingConst = "updating" - VPNGatewayLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VPNGateway.ResourceType property. -// The resource type. -const ( - VPNGatewayResourceTypeVPNGatewayConst = "vpn_gateway" -) - -// Constants associated with the VPNGateway.Mode property. -// Route mode VPN gateway. -const ( - VPNGatewayModeRouteConst = "route" -) - -func (*VPNGateway) isaVPNGateway() bool { - return true -} - -type VPNGatewayIntf interface { - isaVPNGateway() bool -} - -// UnmarshalVPNGateway unmarshals an instance of VPNGateway from the specified map of raw messages. -func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGateway) - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) - if err != nil { - err = core.SDKErrorf(err, "", "connections-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) - 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) - 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.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) - if err != nil { - err = core.SDKErrorf(err, "", "members-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, "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, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-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.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayCollection : VPNGatewayCollection struct -type VPNGatewayCollection struct { - // A link to the first page of resources. - First *VPNGatewayCollectionFirst `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"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` - - // Collection of VPN gateways. - VPNGateways []VPNGatewayIntf `json:"vpn_gateways" validate:"required"` -} - -// 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) - 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, UnmarshalVPNGatewayCollectionNext) - 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 - } - err = core.UnmarshalModel(m, "vpn_gateways", &obj.VPNGateways, UnmarshalVPNGateway) - if err != nil { - err = core.SDKErrorf(err, "", "vpn_gateways-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 *VPNGatewayCollection) 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 -} - -// 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 -// - VPNGatewayConnectionPolicyMode -type VPNGatewayConnection struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up" validate:"required"` - - // The authentication mode. Only `psk` is currently supported. - AuthenticationMode *string `json:"authentication_mode" validate:"required"` - - // The date and time that this VPN gateway connection was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The Dead Peer Detection settings. - DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` - - // The establish mode of the VPN gateway connection: - // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol - // negotiations or rekeying processes. - // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway - // connection. Additionally, the peer is responsible for initiating the rekeying process - // after the connection is established. If rekeying does not occur, the VPN gateway - // connection will be brought down after its lifetime expires. - EstablishMode *string `json:"establish_mode" validate:"required"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The IKE policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` - - // The IPsec policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` - - // The mode of the VPN gateway. - Mode *string `json:"mode" validate:"required"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name" validate:"required"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of a VPN gateway connection. - Status *string `json:"status" validate:"required"` - - // The reasons for the current VPN gateway connection status (if any). - StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` - - Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local,omitempty"` - - Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer,omitempty"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` - - // The VPN tunnel configuration for this VPN gateway connection (in static route mode). - Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels,omitempty"` -} - -// Constants associated with the VPNGatewayConnection.AuthenticationMode property. -// The authentication mode. Only `psk` is currently supported. -const ( - VPNGatewayConnectionAuthenticationModePskConst = "psk" -) - -// Constants associated with the VPNGatewayConnection.EstablishMode property. -// The establish mode of the VPN gateway connection: -// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol -// negotiations or rekeying processes. -// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway -// connection. Additionally, the peer is responsible for initiating the rekeying process -// after the connection is established. If rekeying does not occur, the VPN gateway -// connection will be brought down after its lifetime expires. -const ( - VPNGatewayConnectionEstablishModeBidirectionalConst = "bidirectional" - VPNGatewayConnectionEstablishModePeerOnlyConst = "peer_only" -) - -// Constants associated with the VPNGatewayConnection.Mode property. -// The mode of the VPN gateway. -const ( - VPNGatewayConnectionModePolicyConst = "policy" - VPNGatewayConnectionModeRouteConst = "route" -) - -// Constants associated with the VPNGatewayConnection.ResourceType property. -// The resource type. -const ( - VPNGatewayConnectionResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -// Constants associated with the VPNGatewayConnection.Status property. -// The status of a VPN gateway connection. -const ( - VPNGatewayConnectionStatusDownConst = "down" - VPNGatewayConnectionStatusUpConst = "up" -) - -// Constants associated with the VPNGatewayConnection.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionRoutingProtocolNoneConst = "none" -) - -func (*VPNGatewayConnection) isaVPNGatewayConnection() bool { - return true -} - -type VPNGatewayConnectionIntf interface { - isaVPNGatewayConnection() bool -} - -// UnmarshalVPNGatewayConnection unmarshals an instance of VPNGatewayConnection from the specified map of raw messages. -func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "mode", &discValue) - if err != nil { - errMsg := fmt.Sprintf("error unmarshalling discriminator property 'mode': %s", err.Error()) - err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) - return - } - if discValue == "" { - err = core.SDKErrorf(err, "required discriminator property 'mode' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) - return - } - if discValue == "policy" { - err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionPolicyMode) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionPolicyMode-error", common.GetComponentInfo()) - } - } else if discValue == "route" { - err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionRouteMode-error", common.GetComponentInfo()) - } - } else { - errMsg := fmt.Sprintf("unrecognized value for discriminator property 'mode': %s", discValue) - err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) - } - return -} - -// VPNGatewayConnectionCIDRs : VPNGatewayConnectionCIDRs struct -type VPNGatewayConnectionCIDRs struct { - // The CIDRs for this resource. - CIDRs []string `json:"cidrs" validate:"required"` -} - -// UnmarshalVPNGatewayConnectionCIDRs unmarshals an instance of VPNGatewayConnectionCIDRs from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionCIDRs) - err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionCollection : Collection of VPN gateway connections in a VPN gateway. -type VPNGatewayConnectionCollection struct { - // Array of VPN gateway connections. - Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` -} - -// UnmarshalVPNGatewayConnectionCollection unmarshals an instance of VPNGatewayConnectionCollection from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionCollection) - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnection) - if err != nil { - err = core.SDKErrorf(err, "", "connections-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. - Action *string `json:"action" validate:"required"` - - // Dead Peer Detection interval in seconds. - Interval *int64 `json:"interval" validate:"required"` - - // Dead Peer Detection timeout in seconds. Must be at least the interval. - Timeout *int64 `json:"timeout" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionDpd.Action property. -// Dead Peer Detection actions. -const ( - VPNGatewayConnectionDpdActionClearConst = "clear" - VPNGatewayConnectionDpdActionHoldConst = "hold" - VPNGatewayConnectionDpdActionNoneConst = "none" - VPNGatewayConnectionDpdActionRestartConst = "restart" -) - -// UnmarshalVPNGatewayConnectionDpd unmarshals an instance of VPNGatewayConnectionDpd from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDpd(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDpd) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) - if err != nil { - err = core.SDKErrorf(err, "", "interval-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) - if err != nil { - err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionDpdPatch : The Dead Peer Detection settings. -type VPNGatewayConnectionDpdPatch struct { - // Dead Peer Detection actions. - Action *string `json:"action,omitempty"` - - // Dead Peer Detection interval in seconds. - Interval *int64 `json:"interval,omitempty"` - - // Dead Peer Detection timeout in seconds. Must be at least the interval. - Timeout *int64 `json:"timeout,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionDpdPatch.Action property. -// Dead Peer Detection actions. -const ( - VPNGatewayConnectionDpdPatchActionClearConst = "clear" - VPNGatewayConnectionDpdPatchActionHoldConst = "hold" - VPNGatewayConnectionDpdPatchActionNoneConst = "none" - VPNGatewayConnectionDpdPatchActionRestartConst = "restart" -) - -// UnmarshalVPNGatewayConnectionDpdPatch unmarshals an instance of VPNGatewayConnectionDpdPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDpdPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDpdPatch) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) - if err != nil { - err = core.SDKErrorf(err, "", "interval-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) - if err != nil { - err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionDpdPrototype : The Dead Peer Detection settings. -type VPNGatewayConnectionDpdPrototype struct { - // Dead Peer Detection actions. - Action *string `json:"action,omitempty"` - - // Dead Peer Detection interval in seconds. - Interval *int64 `json:"interval,omitempty"` - - // Dead Peer Detection timeout in seconds. Must be at least the interval. - Timeout *int64 `json:"timeout,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionDpdPrototype.Action property. -// Dead Peer Detection actions. -const ( - VPNGatewayConnectionDpdPrototypeActionClearConst = "clear" - VPNGatewayConnectionDpdPrototypeActionHoldConst = "hold" - VPNGatewayConnectionDpdPrototypeActionNoneConst = "none" - VPNGatewayConnectionDpdPrototypeActionRestartConst = "restart" -) - -// UnmarshalVPNGatewayConnectionDpdPrototype unmarshals an instance of VPNGatewayConnectionDpdPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDpdPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) - if err != nil { - err = core.SDKErrorf(err, "", "interval-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) - if err != nil { - err = core.SDKErrorf(err, "", "timeout-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionIkeIdentity : VPNGatewayConnectionIkeIdentity struct -// Models which "extend" this model: -// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn -// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname -// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 -// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID -type VPNGatewayConnectionIkeIdentity struct { - // The IKE identity type. - // - // 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 IKE identity FQDN value. - Value *string `json:"value,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionIkeIdentity.Type property. -// The IKE identity type. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VPNGatewayConnectionIkeIdentityTypeFqdnConst = "fqdn" - VPNGatewayConnectionIkeIdentityTypeHostnameConst = "hostname" - VPNGatewayConnectionIkeIdentityTypeIpv4AddressConst = "ipv4_address" - VPNGatewayConnectionIkeIdentityTypeKeyIDConst = "key_id" -) - -func (*VPNGatewayConnectionIkeIdentity) isaVPNGatewayConnectionIkeIdentity() bool { - return true -} - -type VPNGatewayConnectionIkeIdentityIntf interface { - isaVPNGatewayConnectionIkeIdentity() bool -} - -// UnmarshalVPNGatewayConnectionIkeIdentity unmarshals an instance of VPNGatewayConnectionIkeIdentity from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkeIdentity) - 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 -} - -// VPNGatewayConnectionIkeIdentityPrototype : VPNGatewayConnectionIkeIdentityPrototype struct -// Models which "extend" this model: -// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn -// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname -// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 -// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID -type VPNGatewayConnectionIkeIdentityPrototype struct { - // The IKE identity type. - Type *string `json:"type" validate:"required"` - - // The IKE identity FQDN value. - Value *string `json:"value,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionIkeIdentityPrototype.Type property. -// The IKE identity type. -const ( - VPNGatewayConnectionIkeIdentityPrototypeTypeFqdnConst = "fqdn" - VPNGatewayConnectionIkeIdentityPrototypeTypeHostnameConst = "hostname" - VPNGatewayConnectionIkeIdentityPrototypeTypeIpv4AddressConst = "ipv4_address" - VPNGatewayConnectionIkeIdentityPrototypeTypeKeyIDConst = "key_id" -) - -func (*VPNGatewayConnectionIkeIdentityPrototype) isaVPNGatewayConnectionIkeIdentityPrototype() bool { - return true -} - -type VPNGatewayConnectionIkeIdentityPrototypeIntf interface { - isaVPNGatewayConnectionIkeIdentityPrototype() bool -} - -// UnmarshalVPNGatewayConnectionIkeIdentityPrototype unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkeIdentityPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkeIdentityPrototype) - 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 -} - -// VPNGatewayConnectionIkePolicyPatch : The IKE policy to use. Specify `null` to remove any existing policy, [resulting in -// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). -// Models which "extend" this model: -// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID -// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref -type VPNGatewayConnectionIkePolicyPatch struct { - // The unique identifier for this IKE policy. - ID *string `json:"id,omitempty"` - - // The IKE policy's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*VPNGatewayConnectionIkePolicyPatch) isaVPNGatewayConnectionIkePolicyPatch() bool { - return true -} - -type VPNGatewayConnectionIkePolicyPatchIntf interface { - isaVPNGatewayConnectionIkePolicyPatch() bool -} - -// UnmarshalVPNGatewayConnectionIkePolicyPatch unmarshals an instance of VPNGatewayConnectionIkePolicyPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkePolicyPatch) - 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 -} - -// 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: -// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID -// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref -type VPNGatewayConnectionIkePolicyPrototype struct { - // The unique identifier for this IKE policy. - ID *string `json:"id,omitempty"` - - // The IKE policy's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*VPNGatewayConnectionIkePolicyPrototype) isaVPNGatewayConnectionIkePolicyPrototype() bool { - return true -} - -type VPNGatewayConnectionIkePolicyPrototypeIntf interface { - isaVPNGatewayConnectionIkePolicyPrototype() bool -} - -// UnmarshalVPNGatewayConnectionIkePolicyPrototype unmarshals an instance of VPNGatewayConnectionIkePolicyPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkePolicyPrototype) - 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 -} - -// VPNGatewayConnectionIPsecPolicyPatch : The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in -// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). -// Models which "extend" this model: -// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID -// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref -type VPNGatewayConnectionIPsecPolicyPatch struct { - // The unique identifier for this IPsec policy. - ID *string `json:"id,omitempty"` - - // The IPsec policy's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*VPNGatewayConnectionIPsecPolicyPatch) isaVPNGatewayConnectionIPsecPolicyPatch() bool { - return true -} - -type VPNGatewayConnectionIPsecPolicyPatchIntf interface { - isaVPNGatewayConnectionIPsecPolicyPatch() bool -} - -// UnmarshalVPNGatewayConnectionIPsecPolicyPatch unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIPsecPolicyPatch) - 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 -} - -// 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: -// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID -// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref -type VPNGatewayConnectionIPsecPolicyPrototype struct { - // The unique identifier for this IPsec policy. - ID *string `json:"id,omitempty"` - - // The IPsec policy's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*VPNGatewayConnectionIPsecPolicyPrototype) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { - return true -} - -type VPNGatewayConnectionIPsecPolicyPrototypeIntf interface { - isaVPNGatewayConnectionIPsecPolicyPrototype() bool -} - -// UnmarshalVPNGatewayConnectionIPsecPolicyPrototype unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIPsecPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIPsecPolicyPrototype) - 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 -} - -// VPNGatewayConnectionPatch : VPNGatewayConnectionPatch struct -type VPNGatewayConnectionPatch struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up,omitempty"` - - // The Dead Peer Detection settings. - DeadPeerDetection *VPNGatewayConnectionDpdPatch `json:"dead_peer_detection,omitempty"` - - // The establish mode of the VPN gateway connection: - // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol - // negotiations or rekeying processes. - // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway - // connection. Additionally, the peer is responsible for initiating the rekeying process - // after the connection is established. If rekeying does not occur, the VPN gateway - // connection will be brought down after its lifetime expires. - EstablishMode *string `json:"establish_mode,omitempty"` - - // The IKE policy to use. Specify `null` to remove any existing policy, [resulting in - // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy VPNGatewayConnectionIkePolicyPatchIntf `json:"ike_policy,omitempty"` - - // The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in - // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy VPNGatewayConnectionIPsecPolicyPatchIntf `json:"ipsec_policy,omitempty"` - - // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. - Name *string `json:"name,omitempty"` - - Peer VPNGatewayConnectionPeerPatchIntf `json:"peer,omitempty"` - - // The pre-shared key. - Psk *string `json:"psk,omitempty"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionPatch.EstablishMode property. -// The establish mode of the VPN gateway connection: -// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol -// negotiations or rekeying processes. -// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway -// connection. Additionally, the peer is responsible for initiating the rekeying process -// after the connection is established. If rekeying does not occur, the VPN gateway -// connection will be brought down after its lifetime expires. -const ( - VPNGatewayConnectionPatchEstablishModeBidirectionalConst = "bidirectional" - VPNGatewayConnectionPatchEstablishModePeerOnlyConst = "peer_only" -) - -// Constants associated with the VPNGatewayConnectionPatch.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionPatchRoutingProtocolNoneConst = "none" -) - -// UnmarshalVPNGatewayConnectionPatch unmarshals an instance of VPNGatewayConnectionPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPatch) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPatch) - if err != nil { - err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) - if err != nil { - err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch) - if err != nil { - err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPatch) - if err != nil { - err = core.SDKErrorf(err, "", "ipsec_policy-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, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionPeerPatch) - if err != nil { - err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// VPNGatewayConnectionPeerPatch : VPNGatewayConnectionPeerPatch struct -// Models which "extend" this model: -// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch -// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch -type VPNGatewayConnectionPeerPatch struct { - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address,omitempty"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn,omitempty"` -} - -func (*VPNGatewayConnectionPeerPatch) isaVPNGatewayConnectionPeerPatch() bool { - return true -} - -type VPNGatewayConnectionPeerPatchIntf interface { - isaVPNGatewayConnectionPeerPatch() bool -} - -// UnmarshalVPNGatewayConnectionPeerPatch unmarshals an instance of VPNGatewayConnectionPeerPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPeerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPeerPatch) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPolicyModeLocal : VPNGatewayConnectionPolicyModeLocal struct -type VPNGatewayConnectionPolicyModeLocal struct { - // The local CIDRs for this VPN gateway connection. - CIDRs []string `json:"cidrs" validate:"required"` - - // The local IKE identities. - // - // A VPN gateway in policy mode consists of two members in active-standby mode. The local IKE identity applies to the - // active member. - IkeIdentities []VPNGatewayConnectionIkeIdentityIntf `json:"ike_identities" validate:"required"` -} - -// UnmarshalVPNGatewayConnectionPolicyModeLocal unmarshals an instance of VPNGatewayConnectionPolicyModeLocal from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPolicyModeLocal(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPolicyModeLocal) - err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPolicyModeLocalPrototype : VPNGatewayConnectionPolicyModeLocalPrototype struct -type VPNGatewayConnectionPolicyModeLocalPrototype struct { - // The local CIDRs for this VPN gateway connection. - CIDRs []string `json:"cidrs" validate:"required"` - - // The local IKE identities to use. - // - // A VPN gateway in policy mode consists of two members in active-standby mode. The specified identity will be applied - // to the active member. - // - // If unspecified, then `type` will be `ipv4_address` and `value` will be the public IP address of the VPN gateway. - IkeIdentities []VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identities,omitempty"` -} - -// NewVPNGatewayConnectionPolicyModeLocalPrototype : Instantiate VPNGatewayConnectionPolicyModeLocalPrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionPolicyModeLocalPrototype(cidrs []string) (_model *VPNGatewayConnectionPolicyModeLocalPrototype, err error) { - _model = &VPNGatewayConnectionPolicyModeLocalPrototype{ - CIDRs: cidrs, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalVPNGatewayConnectionPolicyModeLocalPrototype unmarshals an instance of VPNGatewayConnectionPolicyModeLocalPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPolicyModeLocalPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPolicyModeLocalPrototype) - err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPolicyModePeer : VPNGatewayConnectionPolicyModePeer struct -// Models which "extend" this model: -// - VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress -// - VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn -type VPNGatewayConnectionPolicyModePeer struct { - // The peer CIDRs for this VPN gateway connection. - CIDRs []string `json:"cidrs" validate:"required"` - - // The peer IKE identity. - IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` - - // Indicates whether `peer.address` or `peer.fqdn` is used. - Type *string `json:"type" validate:"required"` - - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address,omitempty"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionPolicyModePeer.Type property. -// Indicates whether `peer.address` or `peer.fqdn` is used. -const ( - VPNGatewayConnectionPolicyModePeerTypeAddressConst = "address" - VPNGatewayConnectionPolicyModePeerTypeFqdnConst = "fqdn" -) - -func (*VPNGatewayConnectionPolicyModePeer) isaVPNGatewayConnectionPolicyModePeer() bool { - return true -} - -type VPNGatewayConnectionPolicyModePeerIntf interface { - isaVPNGatewayConnectionPolicyModePeer() bool -} - -// UnmarshalVPNGatewayConnectionPolicyModePeer unmarshals an instance of VPNGatewayConnectionPolicyModePeer from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPolicyModePeer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPolicyModePeer) - err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPolicyModePeerPrototype : VPNGatewayConnectionPolicyModePeerPrototype struct -// Models which "extend" this model: -// - VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress -// - VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn -type VPNGatewayConnectionPolicyModePeerPrototype struct { - // The peer CIDRs for this VPN gateway connection. - CIDRs []string `json:"cidrs" validate:"required"` - - // The peer IKE identity to use. - // - // If unspecified: - // - If `peer.address` is specified, the `type` will be `ipv4_address`, and - // the `value` will be `peer.address`. - // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` - // will be `peer.fqdn`. - IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` - - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address,omitempty"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn,omitempty"` -} - -func (*VPNGatewayConnectionPolicyModePeerPrototype) isaVPNGatewayConnectionPolicyModePeerPrototype() bool { - return true -} - -type VPNGatewayConnectionPolicyModePeerPrototypeIntf interface { - isaVPNGatewayConnectionPolicyModePeerPrototype() bool -} - -// UnmarshalVPNGatewayConnectionPolicyModePeerPrototype unmarshals an instance of VPNGatewayConnectionPolicyModePeerPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPolicyModePeerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPolicyModePeerPrototype) - err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPrototype : VPNGatewayConnectionPrototype struct -// Models which "extend" this model: -// - VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype -// - VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype -type VPNGatewayConnectionPrototype struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up,omitempty"` - - // The Dead Peer Detection settings. - DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` - - // The establish mode of the VPN gateway connection: - // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol - // negotiations or rekeying processes. - // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway - // connection. Additionally, the peer is responsible for initiating the rekeying process - // after the connection is established. If rekeying does not occur, the VPN gateway - // connection will be brought down after its lifetime expires. - EstablishMode *string `json:"establish_mode,omitempty"` - - // 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). - IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` - - // 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). - IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` - - // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - Local *VPNGatewayConnectionStaticRouteModeLocalPrototype `json:"local,omitempty"` - - Peer VPNGatewayConnectionStaticRouteModePeerPrototypeIntf `json:"peer,omitempty"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionPrototype.EstablishMode property. -// The establish mode of the VPN gateway connection: -// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol -// negotiations or rekeying processes. -// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway -// connection. Additionally, the peer is responsible for initiating the rekeying process -// after the connection is established. If rekeying does not occur, the VPN gateway -// connection will be brought down after its lifetime expires. -const ( - VPNGatewayConnectionPrototypeEstablishModeBidirectionalConst = "bidirectional" - VPNGatewayConnectionPrototypeEstablishModePeerOnlyConst = "peer_only" -) - -// Constants associated with the VPNGatewayConnectionPrototype.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionPrototypeRoutingProtocolNoneConst = "none" -) - -func (*VPNGatewayConnectionPrototype) isaVPNGatewayConnectionPrototype() bool { - return true -} - -type VPNGatewayConnectionPrototypeIntf interface { - isaVPNGatewayConnectionPrototype() bool -} - -// UnmarshalVPNGatewayConnectionPrototype unmarshals an instance of VPNGatewayConnectionPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPrototype) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) - if err != nil { - err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ipsec_policy-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, "psk", &obj.Psk) - if err != nil { - err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionReference : VPNGatewayConnectionReference struct -type VPNGatewayConnectionReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionReference.ResourceType property. -// The resource type. -const ( - VPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -// UnmarshalVPNGatewayConnectionReference unmarshals an instance of VPNGatewayConnectionReference from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) - 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 -} - -// VPNGatewayConnectionReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPNGatewayConnectionReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPNGatewayConnectionReferenceDeleted unmarshals an instance of VPNGatewayConnectionReferenceDeleted from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionReferenceDeleted) - 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 -} - -// VPNGatewayConnectionStaticRouteModeLocal : VPNGatewayConnectionStaticRouteModeLocal struct -type VPNGatewayConnectionStaticRouteModeLocal struct { - // The local IKE identities. - // - // A VPN gateway in static route mode consists of two members in active-active mode. The first identity applies to the - // first member, and the second identity applies to the second member. - IkeIdentities []VPNGatewayConnectionIkeIdentityIntf `json:"ike_identities" validate:"required"` -} - -// UnmarshalVPNGatewayConnectionStaticRouteModeLocal unmarshals an instance of VPNGatewayConnectionStaticRouteModeLocal from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStaticRouteModeLocal(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStaticRouteModeLocal) - err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionStaticRouteModeLocalPrototype : VPNGatewayConnectionStaticRouteModeLocalPrototype struct -type VPNGatewayConnectionStaticRouteModeLocalPrototype struct { - // The local IKE identities to use. - // - // A VPN gateway in static route mode consists of two members in active-active mode. The first specified identity will - // be applied to the first member, and the second specified identity will be applied to the second member. - // - // If unspecified, then `type` will be `ipv4_address` and `value` will be the public IP address of the member's VPN - // connection tunnel. - IkeIdentities []VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identities,omitempty"` -} - -// UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype unmarshals an instance of VPNGatewayConnectionStaticRouteModeLocalPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStaticRouteModeLocalPrototype) - err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionStaticRouteModePeer : VPNGatewayConnectionStaticRouteModePeer struct -// Models which "extend" this model: -// - VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress -// - VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn -type VPNGatewayConnectionStaticRouteModePeer struct { - // The peer IKE identity. - IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` - - // Indicates whether `peer.address` or `peer.fqdn` is used. - Type *string `json:"type" validate:"required"` - - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address,omitempty"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionStaticRouteModePeer.Type property. -// Indicates whether `peer.address` or `peer.fqdn` is used. -const ( - VPNGatewayConnectionStaticRouteModePeerTypeAddressConst = "address" - VPNGatewayConnectionStaticRouteModePeerTypeFqdnConst = "fqdn" -) - -func (*VPNGatewayConnectionStaticRouteModePeer) isaVPNGatewayConnectionStaticRouteModePeer() bool { - return true -} - -type VPNGatewayConnectionStaticRouteModePeerIntf interface { - isaVPNGatewayConnectionStaticRouteModePeer() bool -} - -// UnmarshalVPNGatewayConnectionStaticRouteModePeer unmarshals an instance of VPNGatewayConnectionStaticRouteModePeer from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStaticRouteModePeer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStaticRouteModePeer) - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionStaticRouteModePeerPrototype : VPNGatewayConnectionStaticRouteModePeerPrototype struct -// Models which "extend" this model: -// - VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress -// - VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn -type VPNGatewayConnectionStaticRouteModePeerPrototype struct { - // The peer IKE identity to use. - // - // If unspecified: - // - If `peer.address` is specified, the `type` will be `ipv4_address`, and - // the `value` will be `peer.address`. - // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` - // will be `peer.fqdn`. - IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` - - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address,omitempty"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn,omitempty"` -} - -func (*VPNGatewayConnectionStaticRouteModePeerPrototype) isaVPNGatewayConnectionStaticRouteModePeerPrototype() bool { - return true -} - -type VPNGatewayConnectionStaticRouteModePeerPrototypeIntf interface { - isaVPNGatewayConnectionStaticRouteModePeerPrototype() bool -} - -// UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStaticRouteModePeerPrototype) - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionStaticRouteModeTunnel : VPNGatewayConnectionStaticRouteModeTunnel struct -type VPNGatewayConnectionStaticRouteModeTunnel struct { - // The IP address of the VPN gateway member in which the tunnel resides. - PublicIP *IP `json:"public_ip" validate:"required"` - - // The status of the VPN Tunnel. - Status *string `json:"status" validate:"required"` - - // The reasons for the current status (if any). - StatusReasons []VPNGatewayConnectionTunnelStatusReason `json:"status_reasons" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionStaticRouteModeTunnel.Status property. -// The status of the VPN Tunnel. -const ( - VPNGatewayConnectionStaticRouteModeTunnelStatusDownConst = "down" - VPNGatewayConnectionStaticRouteModeTunnelStatusUpConst = "up" -) - -// UnmarshalVPNGatewayConnectionStaticRouteModeTunnel unmarshals an instance of VPNGatewayConnectionStaticRouteModeTunnel from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStaticRouteModeTunnel) - err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "public_ip-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, UnmarshalVPNGatewayConnectionTunnelStatusReason) - if err != nil { - err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionStatusReason : VPNGatewayConnectionStatusReason struct -type VPNGatewayConnectionStatusReason struct { - // A snake case string succinctly identifying the status reason. - // - // 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 VPN gateway connection's status. - Message *string `json:"message" validate:"required"` - - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VPNGatewayConnectionStatusReasonCodeCannotAuthenticateConnectionConst = "cannot_authenticate_connection" - VPNGatewayConnectionStatusReasonCodeIkePolicyMismatchConst = "ike_policy_mismatch" - VPNGatewayConnectionStatusReasonCodeIkeV1IDLocalRemoteCIDRMismatchConst = "ike_v1_id_local_remote_cidr_mismatch" - VPNGatewayConnectionStatusReasonCodeIkeV2LocalRemoteCIDRMismatchConst = "ike_v2_local_remote_cidr_mismatch" - VPNGatewayConnectionStatusReasonCodeInternalErrorConst = "internal_error" - VPNGatewayConnectionStatusReasonCodeIpsecPolicyMismatchConst = "ipsec_policy_mismatch" - VPNGatewayConnectionStatusReasonCodePeerNotRespondingConst = "peer_not_responding" -) - -// UnmarshalVPNGatewayConnectionStatusReason unmarshals an instance of VPNGatewayConnectionStatusReason from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStatusReason) - 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 -} - -// VPNGatewayConnectionTunnelStatusReason : VPNGatewayConnectionTunnelStatusReason struct -type VPNGatewayConnectionTunnelStatusReason struct { - // A reason code for this status: - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // 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 VPN gateway connection tunnel's status. - Message *string `json:"message" validate:"required"` - - // Link to documentation about this status reason. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionTunnelStatusReason.Code property. -// A reason code for this status: -// - `cannot_authenticate_connection`: Failed to authenticate a connection because of -// mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) -// - `internal_error`: Internal error (contact IBM support) -// - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check -// the IKE policies on both sides of the VPN) -// - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and -// remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE -// V1 configuration) -// - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE -// V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) -// - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable -// (check the IPsec policies on both sides of the VPN) -// - `peer_not_responding`: No response from peer (check network ACL configuration, peer -// availability, and on-premise firewall configuration) -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VPNGatewayConnectionTunnelStatusReasonCodeCannotAuthenticateConnectionConst = "cannot_authenticate_connection" - VPNGatewayConnectionTunnelStatusReasonCodeIkePolicyMismatchConst = "ike_policy_mismatch" - VPNGatewayConnectionTunnelStatusReasonCodeIkeV1IDLocalRemoteCIDRMismatchConst = "ike_v1_id_local_remote_cidr_mismatch" - VPNGatewayConnectionTunnelStatusReasonCodeIkeV2LocalRemoteCIDRMismatchConst = "ike_v2_local_remote_cidr_mismatch" - VPNGatewayConnectionTunnelStatusReasonCodeInternalErrorConst = "internal_error" - VPNGatewayConnectionTunnelStatusReasonCodeIpsecPolicyMismatchConst = "ipsec_policy_mismatch" - VPNGatewayConnectionTunnelStatusReasonCodePeerNotRespondingConst = "peer_not_responding" -) - -// UnmarshalVPNGatewayConnectionTunnelStatusReason unmarshals an instance of VPNGatewayConnectionTunnelStatusReason from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionTunnelStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionTunnelStatusReason) - 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 -} - -// VPNGatewayHealthReason : VPNGatewayHealthReason struct -type VPNGatewayHealthReason struct { - // A reason code for this health state: - // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (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 health state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this health state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNGatewayHealthReason.Code property. -// A reason code for this health state: -// - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) -// - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's -// subnet) -// - `internal_error`: Internal error (contact IBM support) -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VPNGatewayHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route" - VPNGatewayHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" - VPNGatewayHealthReasonCodeInternalErrorConst = "internal_error" -) - -// UnmarshalVPNGatewayHealthReason unmarshals an instance of VPNGatewayHealthReason from the specified map of raw messages. -func UnmarshalVPNGatewayHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayHealthReason) - 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 -} - -// VPNGatewayLifecycleReason : VPNGatewayLifecycleReason struct -type VPNGatewayLifecycleReason 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 VPNGatewayLifecycleReason.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 ( - VPNGatewayLifecycleReasonCodeInternalErrorConst = "internal_error" - VPNGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalVPNGatewayLifecycleReason unmarshals an instance of VPNGatewayLifecycleReason from the specified map of raw messages. -func UnmarshalVPNGatewayLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayLifecycleReason) - 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 -} - -// VPNGatewayMember : VPNGatewayMember struct -type VPNGatewayMember struct { - // The reasons for the current `health_state` (if any). - HealthReasons []VPNGatewayMemberHealthReason `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 reasons for the current `lifecycle_state` (if any). - LifecycleReasons []VPNGatewayMemberLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the VPN gateway member. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The reserved IP address assigned to the VPN gateway member. - // - // This property will be present only when the VPN gateway status is `available`. - PrivateIP *ReservedIPReference `json:"private_ip" validate:"required"` - - // The public IP address assigned to the VPN gateway member. - PublicIP *IP `json:"public_ip" validate:"required"` - - // The high availability role assigned to the VPN gateway member. - Role *string `json:"role" validate:"required"` -} - -// Constants associated with the VPNGatewayMember.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 ( - VPNGatewayMemberHealthStateDegradedConst = "degraded" - VPNGatewayMemberHealthStateFaultedConst = "faulted" - VPNGatewayMemberHealthStateInapplicableConst = "inapplicable" - VPNGatewayMemberHealthStateOkConst = "ok" -) - -// Constants associated with the VPNGatewayMember.LifecycleState property. -// The lifecycle state of the VPN gateway member. -const ( - VPNGatewayMemberLifecycleStateDeletingConst = "deleting" - VPNGatewayMemberLifecycleStateFailedConst = "failed" - VPNGatewayMemberLifecycleStatePendingConst = "pending" - VPNGatewayMemberLifecycleStateStableConst = "stable" - VPNGatewayMemberLifecycleStateSuspendedConst = "suspended" - VPNGatewayMemberLifecycleStateUpdatingConst = "updating" - VPNGatewayMemberLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VPNGatewayMember.Role property. -// The high availability role assigned to the VPN gateway member. -const ( - VPNGatewayMemberRoleActiveConst = "active" - VPNGatewayMemberRoleStandbyConst = "standby" -) - -// UnmarshalVPNGatewayMember unmarshals an instance of VPNGatewayMember from the specified map of raw messages. -func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayMember) - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayMemberHealthReason) - 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayMemberLifecycleReason) - 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.UnmarshalModel(m, "private_ip", &obj.PrivateIP, UnmarshalReservedIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "private_ip-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "public_ip-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "role", &obj.Role) - if err != nil { - err = core.SDKErrorf(err, "", "role-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayMemberHealthReason : VPNGatewayMemberHealthReason struct -type VPNGatewayMemberHealthReason struct { - // A reason code for this health state: - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (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 health state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this health state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNGatewayMemberHealthReason.Code property. -// A reason code for this health state: -// - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's -// subnet) -// - `internal_error`: Internal error (contact IBM support) -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VPNGatewayMemberHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" - VPNGatewayMemberHealthReasonCodeInternalErrorConst = "internal_error" -) - -// UnmarshalVPNGatewayMemberHealthReason unmarshals an instance of VPNGatewayMemberHealthReason from the specified map of raw messages. -func UnmarshalVPNGatewayMemberHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayMemberHealthReason) - 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 -} - -// VPNGatewayMemberLifecycleReason : VPNGatewayMemberLifecycleReason struct -type VPNGatewayMemberLifecycleReason 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 VPNGatewayMemberLifecycleReason.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 ( - VPNGatewayMemberLifecycleReasonCodeInternalErrorConst = "internal_error" - VPNGatewayMemberLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalVPNGatewayMemberLifecycleReason unmarshals an instance of VPNGatewayMemberLifecycleReason from the specified map of raw messages. -func UnmarshalVPNGatewayMemberLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayMemberLifecycleReason) - 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 -} - -// VPNGatewayPatch : VPNGatewayPatch struct -type VPNGatewayPatch struct { - // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalVPNGatewayPatch unmarshals an instance of VPNGatewayPatch from the specified map of raw messages. -func UnmarshalVPNGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPatch) - 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 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()) - } - return -} - -// VPNGatewayPrototype : VPNGatewayPrototype struct -// Models which "extend" this model: -// - VPNGatewayPrototypeVPNGatewayRouteModePrototype -// - VPNGatewayPrototypeVPNGatewayPolicyModePrototype -type VPNGatewayPrototype struct { - // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. 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"` - - // Identifies a subnet by a unique property. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - - // Route mode VPN gateway. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the VPNGatewayPrototype.Mode property. -// Route mode VPN gateway. -const ( - VPNGatewayPrototypeModeRouteConst = "route" -) - -func (*VPNGatewayPrototype) isaVPNGatewayPrototype() bool { - return true -} - -type VPNGatewayPrototypeIntf interface { - isaVPNGatewayPrototype() bool -} - -// UnmarshalVPNGatewayPrototype unmarshals an instance of VPNGatewayPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPNGatewayReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPNGatewayReferenceDeleted unmarshals an instance of VPNGatewayReferenceDeleted from the specified map of raw messages. -func UnmarshalVPNGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayReferenceDeleted) - 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 -} - -// VPNServer : VPNServer struct -type VPNServer struct { - // The certificate instance for this VPN server. - Certificate *CertificateInstanceReference `json:"certificate" validate:"required"` - - // The methods used to authenticate VPN clients to this VPN server. VPN clients must authenticate against all specified - // methods. - ClientAuthentication []VPNServerAuthenticationIntf `json:"client_authentication" validate:"required"` - - // Indicates whether disconnected VPN clients will be automatically deleted after - // `client_auto_delete_timeout` hours have passed. At present, this is always `true`, but may be modifiable in the - // future. - ClientAutoDelete *bool `json:"client_auto_delete" validate:"required"` - - // If `client_auto_delete` is `true`, the hours after which disconnected VPN clients will be automatically deleted. If - // the value is `0`, disconnected VPN clients will be deleted immediately. This value may be modifiable in the future. - ClientAutoDeleteTimeout *int64 `json:"client_auto_delete_timeout" validate:"required"` - - // The DNS server addresses that will be provided to VPN clients that are connected to this VPN server. - ClientDnsServerIps []IP `json:"client_dns_server_ips" validate:"required"` - - // The seconds a VPN client can be idle before this VPN server will disconnect it. If `0`, the server will not - // disconnect idle clients. - ClientIdleTimeout *int64 `json:"client_idle_timeout" validate:"required"` - - // The VPN client IPv4 address pool, expressed in CIDR format. - ClientIPPool *string `json:"client_ip_pool" validate:"required"` - - // The date and time that the VPN server was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this VPN server. - CRN *string `json:"crn" validate:"required"` - - // Indicates whether the split tunneling is enabled on this VPN server. - EnableSplitTunneling *bool `json:"enable_split_tunneling" validate:"required"` - - // The reasons for the current `health_state` (if any). - HealthReasons []VPNServerHealthReason `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"` - - // Fully qualified domain name assigned to this VPN server. - Hostname *string `json:"hostname" validate:"required"` - - // The URL for this VPN server. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN server. - ID *string `json:"id" validate:"required"` - - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []VPNServerLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the VPN server. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this VPN server. The name is unique across all VPN servers in the VPC. - Name *string `json:"name" validate:"required"` - - // The port number used by this VPN server. - Port *int64 `json:"port" validate:"required"` - - // The reserved IPs bound to this VPN server. - PrivateIps []ReservedIPReference `json:"private_ips" validate:"required"` - - // The transport protocol used by this VPN server. - Protocol *string `json:"protocol" validate:"required"` - - // The resource group for this VPN server. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The security groups targeting this VPN server. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The subnets this VPN server is provisioned in. - Subnets []SubnetReference `json:"subnets" validate:"required"` - - // The VPC this VPN server resides in. - VPC *VPCReference `json:"vpc" validate:"required"` -} - -// Constants associated with the VPNServer.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 ( - VPNServerHealthStateDegradedConst = "degraded" - VPNServerHealthStateFaultedConst = "faulted" - VPNServerHealthStateInapplicableConst = "inapplicable" - VPNServerHealthStateOkConst = "ok" -) - -// Constants associated with the VPNServer.LifecycleState property. -// The lifecycle state of the VPN server. -const ( - VPNServerLifecycleStateDeletingConst = "deleting" - VPNServerLifecycleStateFailedConst = "failed" - VPNServerLifecycleStatePendingConst = "pending" - VPNServerLifecycleStateStableConst = "stable" - VPNServerLifecycleStateSuspendedConst = "suspended" - VPNServerLifecycleStateUpdatingConst = "updating" - VPNServerLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VPNServer.Protocol property. -// The transport protocol used by this VPN server. -const ( - VPNServerProtocolTCPConst = "tcp" - VPNServerProtocolUDPConst = "udp" -) - -// Constants associated with the VPNServer.ResourceType property. -// The resource type. -const ( - VPNServerResourceTypeVPNServerConst = "vpn_server" -) - -// UnmarshalVPNServer unmarshals an instance of VPNServer from the specified map of raw messages. -func UnmarshalVPNServer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServer) - err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceReference) - if err != nil { - err = core.SDKErrorf(err, "", "certificate-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthentication) - if err != nil { - err = core.SDKErrorf(err, "", "client_authentication-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "client_auto_delete", &obj.ClientAutoDelete) - if err != nil { - err = core.SDKErrorf(err, "", "client_auto_delete-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "client_auto_delete_timeout", &obj.ClientAutoDeleteTimeout) - if err != nil { - err = core.SDKErrorf(err, "", "client_auto_delete_timeout-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "client_dns_server_ips-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) - if err != nil { - err = core.SDKErrorf(err, "", "client_idle_timeout-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) - if err != nil { - err = core.SDKErrorf(err, "", "client_ip_pool-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) - if err != nil { - err = core.SDKErrorf(err, "", "enable_split_tunneling-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNServerHealthReason) - 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, "hostname", &obj.Hostname) - if err != nil { - err = core.SDKErrorf(err, "", "hostname-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, UnmarshalVPNServerLifecycleReason) - 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, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalReservedIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "private_ips-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, "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, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthentication : An authentication method for this VPN server. -// Models which "extend" this model: -// - VPNServerAuthenticationByUsername -// - VPNServerAuthenticationByCertificate -type VPNServerAuthentication struct { - // The type of authentication. - Method *string `json:"method" validate:"required"` - - // The type of identity provider to be used by VPN client. - IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider,omitempty"` - - // The certificate instance used for the VPN client certificate authority (CA). - ClientCa *CertificateInstanceReference `json:"client_ca,omitempty"` - - // The certificate revocation list contents, encoded in PEM format. - Crl *string `json:"crl,omitempty"` -} - -// Constants associated with the VPNServerAuthentication.Method property. -// The type of authentication. -const ( - VPNServerAuthenticationMethodCertificateConst = "certificate" - VPNServerAuthenticationMethodUsernameConst = "username" -) - -func (*VPNServerAuthentication) isaVPNServerAuthentication() bool { - return true -} - -type VPNServerAuthenticationIntf interface { - isaVPNServerAuthentication() bool -} - -// UnmarshalVPNServerAuthentication unmarshals an instance of VPNServerAuthentication from the specified map of raw messages. -func UnmarshalVPNServerAuthentication(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerAuthentication) - err = core.UnmarshalPrimitive(m, "method", &obj.Method) - if err != nil { - err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) - if err != nil { - err = core.SDKErrorf(err, "", "identity_provider-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) - if err != nil { - err = core.SDKErrorf(err, "", "client_ca-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) - if err != nil { - err = core.SDKErrorf(err, "", "crl-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthenticationByUsernameIDProvider : The type of identity provider to be used by VPN client. -// Models which "extend" this model: -// - VPNServerAuthenticationByUsernameIDProviderByIam -type VPNServerAuthenticationByUsernameIDProvider struct { - // The type of identity provider to be used by the VPN client: - // - `iam`: IBM identity and access management - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - ProviderType *string `json:"provider_type,omitempty"` -} - -// Constants associated with the VPNServerAuthenticationByUsernameIDProvider.ProviderType property. -// The type of identity provider to be used by the VPN client: -// - `iam`: IBM identity and access management -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VPNServerAuthenticationByUsernameIDProviderProviderTypeIamConst = "iam" -) - -func (*VPNServerAuthenticationByUsernameIDProvider) isaVPNServerAuthenticationByUsernameIDProvider() bool { - return true -} - -type VPNServerAuthenticationByUsernameIDProviderIntf interface { - isaVPNServerAuthenticationByUsernameIDProvider() bool -} - -// UnmarshalVPNServerAuthenticationByUsernameIDProvider unmarshals an instance of VPNServerAuthenticationByUsernameIDProvider from the specified map of raw messages. -func UnmarshalVPNServerAuthenticationByUsernameIDProvider(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerAuthenticationByUsernameIDProvider) - err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) - if err != nil { - err = core.SDKErrorf(err, "", "provider_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthenticationPrototype : An authentication method for this VPN server. -// Models which "extend" this model: -// - VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype -// - VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype -type VPNServerAuthenticationPrototype struct { - // The type of authentication. - Method *string `json:"method" validate:"required"` - - // The type of identity provider to be used by VPN client. - IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider,omitempty"` - - // The certificate instance to use for the VPN client certificate authority (CA). - ClientCa CertificateInstanceIdentityIntf `json:"client_ca,omitempty"` - - // The certificate revocation list contents, encoded in PEM format. - Crl *string `json:"crl,omitempty"` -} - -// Constants associated with the VPNServerAuthenticationPrototype.Method property. -// The type of authentication. -const ( - VPNServerAuthenticationPrototypeMethodCertificateConst = "certificate" - VPNServerAuthenticationPrototypeMethodUsernameConst = "username" -) - -func (*VPNServerAuthenticationPrototype) isaVPNServerAuthenticationPrototype() bool { - return true -} - -type VPNServerAuthenticationPrototypeIntf interface { - isaVPNServerAuthenticationPrototype() bool -} - -// UnmarshalVPNServerAuthenticationPrototype unmarshals an instance of VPNServerAuthenticationPrototype from the specified map of raw messages. -func UnmarshalVPNServerAuthenticationPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "method", &discValue) - if err != nil { - errMsg := fmt.Sprintf("error unmarshalling discriminator property 'method': %s", err.Error()) - err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) - return - } - if discValue == "" { - err = core.SDKErrorf(err, "required discriminator property 'method' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) - return - } - if discValue == "certificate" { - err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype-error", common.GetComponentInfo()) - } - } else if discValue == "username" { - err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype-error", common.GetComponentInfo()) - } - } else { - errMsg := fmt.Sprintf("unrecognized value for discriminator property 'method': %s", discValue) - err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) - } - return -} - -// VPNServerClient : VPNServerClient struct -type VPNServerClient struct { - // The IP address assigned to this VPN client from `client_ip_pool`. - ClientIP *IP `json:"client_ip" validate:"required"` - - // The common name of client certificate that the VPN client provided when connecting to the server. - // - // This property will be present only when the `certificate` client authentication method is enabled on the VPN server. - CommonName *string `json:"common_name,omitempty"` - - // The date and time that the VPN client was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The date and time that the VPN client was disconnected. - // - // This property will be present only when the client `status` is `disconnected`. - DisconnectedAt *strfmt.DateTime `json:"disconnected_at,omitempty"` - - // The URL for this VPN client. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN client. - ID *string `json:"id" validate:"required"` - - // The remote IP address of this VPN client. - RemoteIP *IP `json:"remote_ip" validate:"required"` - - // The remote port of this VPN client. - RemotePort *int64 `json:"remote_port" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the VPN client: - // - `connected`: the VPN client is `connected` to this VPN server. - // - `disconnected`: the VPN client is `disconnected` from this VPN server. - // - // 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 username that this VPN client provided when connecting to the VPN server. - // - // This property will be present only when the `username` client authentication method is enabled on the VPN server. - Username *string `json:"username,omitempty"` -} - -// Constants associated with the VPNServerClient.ResourceType property. -// The resource type. -const ( - VPNServerClientResourceTypeVPNServerClientConst = "vpn_server_client" -) - -// Constants associated with the VPNServerClient.Status property. -// The status of the VPN client: -// - `connected`: the VPN client is `connected` to this VPN server. -// - `disconnected`: the VPN client is `disconnected` from this VPN server. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VPNServerClientStatusConnectedConst = "connected" - VPNServerClientStatusDisconnectedConst = "disconnected" -) - -// UnmarshalVPNServerClient unmarshals an instance of VPNServerClient from the specified map of raw messages. -func UnmarshalVPNServerClient(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerClient) - err = core.UnmarshalModel(m, "client_ip", &obj.ClientIP, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "client_ip-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "common_name", &obj.CommonName) - if err != nil { - err = core.SDKErrorf(err, "", "common_name-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, "disconnected_at", &obj.DisconnectedAt) - if err != nil { - err = core.SDKErrorf(err, "", "disconnected_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.UnmarshalModel(m, "remote_ip", &obj.RemoteIP, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "remote_ip-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "remote_port", &obj.RemotePort) - if err != nil { - err = core.SDKErrorf(err, "", "remote_port-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, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-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 -} - -// VPNServerClientCollection : VPNServerClientCollection struct -type VPNServerClientCollection struct { - // Collection of VPN clients. - Clients []VPNServerClient `json:"clients" validate:"required"` - - // A link to the first page of resources. - First *VPNServerClientCollectionFirst `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"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalVPNServerClientCollection unmarshals an instance of VPNServerClientCollection from the specified map of raw messages. -func UnmarshalVPNServerClientCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerClientCollection) - err = core.UnmarshalModel(m, "clients", &obj.Clients, UnmarshalVPNServerClient) - if err != nil { - err = core.SDKErrorf(err, "", "clients-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerClientCollectionFirst) - 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, UnmarshalVPNServerClientCollectionNext) - 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 *VPNServerClientCollection) 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 -} - -// 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"` - - // 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"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` - - // Collection of VPN servers. - VPNServers []VPNServer `json:"vpn_servers" validate:"required"` -} - -// 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) - 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, UnmarshalVPNServerCollectionNext) - 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 - } - err = core.UnmarshalModel(m, "vpn_servers", &obj.VPNServers, UnmarshalVPNServer) - if err != nil { - err = core.SDKErrorf(err, "", "vpn_servers-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 *VPNServerCollection) 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 -} - -// 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: - // - `cannot_access_client_certificate`: VPN server's client certificate is inaccessible - // (verify certificate exists and that IAM policies grant `VPN server for VPC` access - // to `Secrets Manager`) - // - `cannot_access_server_certificate`: VPN server's server certificate is inaccessible - // (verify certificate exists and that IAM policies grant `VPN server for VPC` access - // to `Secrets Manager`) - // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) - // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's - // subnet) - // - `internal_error`: Internal error (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 health state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this health state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNServerHealthReason.Code property. -// A reason code for this health state: -// - `cannot_access_client_certificate`: VPN server's client certificate is inaccessible -// (verify certificate exists and that IAM policies grant `VPN server for VPC` access -// to `Secrets Manager`) -// - `cannot_access_server_certificate`: VPN server's server certificate is inaccessible -// (verify certificate exists and that IAM policies grant `VPN server for VPC` access -// to `Secrets Manager`) -// - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) -// - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's -// subnet) -// - `internal_error`: Internal error (contact IBM support) -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VPNServerHealthReasonCodeCannotAccessClientCertificateConst = "cannot_access_client_certificate" - VPNServerHealthReasonCodeCannotAccessServerCertificateConst = "cannot_access_server_certificate" - VPNServerHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route" - VPNServerHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" - VPNServerHealthReasonCodeInternalErrorConst = "internal_error" -) - -// UnmarshalVPNServerHealthReason unmarshals an instance of VPNServerHealthReason from the specified map of raw messages. -func UnmarshalVPNServerHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerHealthReason) - 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 -} - -// VPNServerLifecycleReason : VPNServerLifecycleReason struct -type VPNServerLifecycleReason 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 VPNServerLifecycleReason.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 ( - VPNServerLifecycleReasonCodeInternalErrorConst = "internal_error" - VPNServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalVPNServerLifecycleReason unmarshals an instance of VPNServerLifecycleReason from the specified map of raw messages. -func UnmarshalVPNServerLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerLifecycleReason) - 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 -} - -// VPNServerPatch : VPNServerPatch struct -type VPNServerPatch struct { - // The certificate instance for this VPN server. - Certificate CertificateInstanceIdentityIntf `json:"certificate,omitempty"` - - // The authentication methods to use to authenticate VPN client on this VPN server - // (replacing any existing methods). - ClientAuthentication []VPNServerAuthenticationPrototypeIntf `json:"client_authentication,omitempty"` - - // The DNS server addresses that will be provided to VPN clients connected to this VPN server (replacing any existing - // addresses). - ClientDnsServerIps []IP `json:"client_dns_server_ips,omitempty"` - - // The seconds a VPN client can be idle before this VPN server will disconnect it. If `0`, the server will not - // disconnect idle clients. - ClientIdleTimeout *int64 `json:"client_idle_timeout,omitempty"` - - // The VPN client IPv4 address pool, expressed in CIDR format. The request must not overlap with any existing address - // prefixes in the VPC or any of the following reserved address ranges: - // - `127.0.0.0/8` (IPv4 loopback addresses) - // - `161.26.0.0/16` (IBM services) - // - `166.8.0.0/14` (Cloud Service Endpoints) - // - `169.254.0.0/16` (IPv4 link-local addresses) - // - `224.0.0.0/4` (IPv4 multicast addresses) - // - // The prefix length of the client IP address pool's CIDR must be between - // `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that contains twice the number of IP addresses - // that are required to enable the maximum number of concurrent connections is recommended. - ClientIPPool *string `json:"client_ip_pool,omitempty"` - - // Indicates whether the split tunneling is enabled on this VPN server. - EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"` - - // The name for this VPN server. The name must not be used by another VPN server in the VPC. - Name *string `json:"name,omitempty"` - - // The port number used by this VPN server. - Port *int64 `json:"port,omitempty"` - - // The transport protocol used by this VPN server. - Protocol *string `json:"protocol,omitempty"` - - // The subnets to provision this VPN server in (replacing the existing subnets). - Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` -} - -// Constants associated with the VPNServerPatch.Protocol property. -// The transport protocol used by this VPN server. -const ( - VPNServerPatchProtocolTCPConst = "tcp" - VPNServerPatchProtocolUDPConst = "udp" -) - -// UnmarshalVPNServerPatch unmarshals an instance of VPNServerPatch from the specified map of raw messages. -func UnmarshalVPNServerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerPatch) - err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "certificate-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthenticationPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "client_authentication-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "client_dns_server_ips-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) - if err != nil { - err = core.SDKErrorf(err, "", "client_idle_timeout-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) - if err != nil { - err = core.SDKErrorf(err, "", "client_ip_pool-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) - if err != nil { - err = core.SDKErrorf(err, "", "enable_split_tunneling-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, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-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, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// VPNServerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPNServerReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPNServerReferenceDeleted unmarshals an instance of VPNServerReferenceDeleted from the specified map of raw messages. -func UnmarshalVPNServerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerReferenceDeleted) - 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 -} - -// VPNServerRoute : VPNServerRoute struct -type VPNServerRoute struct { - // The action to perform with a packet matching the VPN route: - // - `translate`: translate the source IP address to one of the private IP addresses of - // the VPN server, then deliver the packet to target. - // - `deliver`: deliver the packet into the VPC. - // - `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"` - - // The date and time that the VPN route was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination for this VPN route in the VPN server. If an incoming packet does not match any destination, it will - // be dropped. - Destination *string `json:"destination" validate:"required"` - - // The reasons for the current `health_state` (if any). - HealthReasons []VPNServerRouteHealthReason `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 VPN route. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN route. - ID *string `json:"id" validate:"required"` - - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []VPNServerRouteLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the VPN route. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The name for this VPN route. The name is unique across all routes for a VPN server. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VPNServerRoute.Action property. -// The action to perform with a packet matching the VPN route: -// - `translate`: translate the source IP address to one of the private IP addresses of -// the VPN server, then deliver the packet to target. -// - `deliver`: deliver the packet into the VPC. -// - `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 ( - VPNServerRouteActionDeliverConst = "deliver" - VPNServerRouteActionDropConst = "drop" - VPNServerRouteActionTranslateConst = "translate" -) - -// Constants associated with the VPNServerRoute.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 ( - VPNServerRouteHealthStateDegradedConst = "degraded" - VPNServerRouteHealthStateFaultedConst = "faulted" - VPNServerRouteHealthStateInapplicableConst = "inapplicable" - VPNServerRouteHealthStateOkConst = "ok" -) - -// Constants associated with the VPNServerRoute.LifecycleState property. -// The lifecycle state of the VPN route. -const ( - VPNServerRouteLifecycleStateDeletingConst = "deleting" - VPNServerRouteLifecycleStateFailedConst = "failed" - VPNServerRouteLifecycleStatePendingConst = "pending" - VPNServerRouteLifecycleStateStableConst = "stable" - VPNServerRouteLifecycleStateSuspendedConst = "suspended" - VPNServerRouteLifecycleStateUpdatingConst = "updating" - VPNServerRouteLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VPNServerRoute.ResourceType property. -// The resource type. -const ( - VPNServerRouteResourceTypeVPNServerRouteConst = "vpn_server_route" -) - -// UnmarshalVPNServerRoute unmarshals an instance of VPNServerRoute from the specified map of raw messages. -func UnmarshalVPNServerRoute(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerRoute) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-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, "destination", &obj.Destination) - if err != nil { - err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNServerRouteHealthReason) - 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNServerRouteLifecycleReason) - 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 -} - -// VPNServerRouteCollection : VPNServerRouteCollection struct -type VPNServerRouteCollection struct { - // A link to the first page of resources. - First *VPNServerRouteCollectionFirst `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"` - - // Collection of VPN routes. - Routes []VPNServerRoute `json:"routes" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalVPNServerRouteCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalVPNServerRoute) - 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 *VPNServerRouteCollection) 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 -} - -// 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: - // - `internal_error`: Internal error (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 health state. - Message *string `json:"message" validate:"required"` - - // Link to documentation about the reason for this health state. - MoreInfo *string `json:"more_info,omitempty"` -} - -// Constants associated with the VPNServerRouteHealthReason.Code property. -// A reason code for this health state: -// - `internal_error`: Internal error (contact IBM support) -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VPNServerRouteHealthReasonCodeInternalErrorConst = "internal_error" -) - -// UnmarshalVPNServerRouteHealthReason unmarshals an instance of VPNServerRouteHealthReason from the specified map of raw messages. -func UnmarshalVPNServerRouteHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerRouteHealthReason) - 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 -} - -// VPNServerRouteLifecycleReason : VPNServerRouteLifecycleReason struct -type VPNServerRouteLifecycleReason 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 VPNServerRouteLifecycleReason.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 ( - VPNServerRouteLifecycleReasonCodeInternalErrorConst = "internal_error" - VPNServerRouteLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalVPNServerRouteLifecycleReason unmarshals an instance of VPNServerRouteLifecycleReason from the specified map of raw messages. -func UnmarshalVPNServerRouteLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerRouteLifecycleReason) - 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 -} - -// VPNServerRoutePatch : VPNServerRoutePatch struct -type VPNServerRoutePatch struct { - // The name for this VPN server route. The name must not be used by another route for the VPN server. - Name *string `json:"name,omitempty"` -} - -// UnmarshalVPNServerRoutePatch unmarshals an instance of VPNServerRoutePatch from the specified map of raw messages. -func UnmarshalVPNServerRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerRoutePatch) - 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 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()) - } - return -} - -// VirtualNetworkInterface : VirtualNetworkInterface struct -type VirtualNetworkInterface 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" validate:"required"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. - AutoDelete *bool `json:"auto_delete" validate:"required"` - - // The date and time that the virtual network interface was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this virtual network interface. - CRN *string `json:"crn" 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 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" validate:"required"` - - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` - - // The reserved IPs bound to this virtual network interface. - // - // May be empty when `lifecycle_state` is `pending`. - Ips []ReservedIPReference `json:"ips" validate:"required"` - - // The lifecycle state of the virtual network interface. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // The MAC address of the virtual network interface. May be absent if `lifecycle_state` is `pending`. - MacAddress *string `json:"mac_address,omitempty"` - - // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - Name *string `json:"name" validate:"required"` - - // The reserved IP for this virtual network interface. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource group for this virtual network interface. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The security groups for this virtual network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The target of this virtual network interface. - // - // If absent, this virtual network interface is not attached to a target. - Target VirtualNetworkInterfaceTargetIntf `json:"target,omitempty"` - - // The VPC this virtual network interface resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // The zone this virtual network interface resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the VirtualNetworkInterface.LifecycleState property. -// The lifecycle state of the virtual network interface. -const ( - VirtualNetworkInterfaceLifecycleStateDeletingConst = "deleting" - VirtualNetworkInterfaceLifecycleStateFailedConst = "failed" - VirtualNetworkInterfaceLifecycleStatePendingConst = "pending" - VirtualNetworkInterfaceLifecycleStateStableConst = "stable" - VirtualNetworkInterfaceLifecycleStateSuspendedConst = "suspended" - VirtualNetworkInterfaceLifecycleStateUpdatingConst = "updating" - VirtualNetworkInterfaceLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VirtualNetworkInterface.ResourceType property. -// The resource type. -const ( - VirtualNetworkInterfaceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" -) - -// UnmarshalVirtualNetworkInterface unmarshals an instance of VirtualNetworkInterface from the specified map of raw messages. -func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterface) - 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, "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.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, "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, "ips", &obj.Ips, UnmarshalReservedIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "ips-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 - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "primary_ip-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, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-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, "target", &obj.Target, UnmarshalVirtualNetworkInterfaceTarget) - if err != nil { - err = core.SDKErrorf(err, "", "target-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 -} - -// VirtualNetworkInterfaceCollection : VirtualNetworkInterfaceCollection struct -type VirtualNetworkInterfaceCollection struct { - // A link to the first page of resources. - First *VirtualNetworkInterfaceCollectionFirst `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"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` - - // Collection of virtual network interfaces. - VirtualNetworkInterfaces []VirtualNetworkInterface `json:"virtual_network_interfaces" validate:"required"` -} - -// 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) - 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, UnmarshalVirtualNetworkInterfaceCollectionNext) - 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 - } - err = core.UnmarshalModel(m, "virtual_network_interfaces", &obj.VirtualNetworkInterfaces, UnmarshalVirtualNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interfaces-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 *VirtualNetworkInterfaceCollection) 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 -} - -// 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 -// - VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext -type VirtualNetworkInterfaceIPPrototype struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` - - // 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 reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*VirtualNetworkInterfaceIPPrototype) isaVirtualNetworkInterfaceIPPrototype() bool { - return true -} - -type VirtualNetworkInterfaceIPPrototypeIntf interface { - isaVirtualNetworkInterfaceIPPrototype() bool -} - -// UnmarshalVirtualNetworkInterfaceIPPrototype unmarshals an instance of VirtualNetworkInterfaceIPPrototype from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPPrototype) - 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 - } - 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 -} - -// VirtualNetworkInterfacePatch : VirtualNetworkInterfacePatch struct -type VirtualNetworkInterfacePatch struct { - // Indicates whether source IP spoofing is allowed on this interface. - // - // Must be `false` if `target` is a file share mount target. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. Must be `false` if the virtual network interface is unbound. - AutoDelete *bool `json:"auto_delete,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"` - - // The name for this virtual network interface. The name must not be used by another virtual network interface in the - // region. Names beginning with `ibm-` are reserved for provider-owned resources, and are not allowed. - Name *string `json:"name,omitempty"` -} - -// UnmarshalVirtualNetworkInterfacePatch unmarshals an instance of VirtualNetworkInterfacePatch from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePatch) - 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.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 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// VirtualNetworkInterfacePrimaryIPPrototype : VirtualNetworkInterfacePrimaryIPPrototype struct -// Models which "extend" this model: -// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext -// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext -type VirtualNetworkInterfacePrimaryIPPrototype struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` - - // 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 reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*VirtualNetworkInterfacePrimaryIPPrototype) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { - return true -} - -type VirtualNetworkInterfacePrimaryIPPrototypeIntf interface { - isaVirtualNetworkInterfacePrimaryIPPrototype() bool -} - -// UnmarshalVirtualNetworkInterfacePrimaryIPPrototype unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototype from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPPrototype) - 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 - } - 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 -} - -// VirtualNetworkInterfaceReferenceAttachmentContext : VirtualNetworkInterfaceReferenceAttachmentContext struct -type VirtualNetworkInterfaceReferenceAttachmentContext struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` - - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` - - // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VirtualNetworkInterfaceReferenceAttachmentContext.ResourceType property. -// The resource type. -const ( - VirtualNetworkInterfaceReferenceAttachmentContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" -) - -// UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext unmarshals an instance of VirtualNetworkInterfaceReferenceAttachmentContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceReferenceAttachmentContext) - 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) - 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 -} - -// VirtualNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VirtualNetworkInterfaceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVirtualNetworkInterfaceReferenceDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceDeleted from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceReferenceDeleted) - 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 -} - -// VirtualNetworkInterfaceTarget : A virtual network interface 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: -// - VirtualNetworkInterfaceTargetShareMountTargetReference -// - VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext -// - VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext -type VirtualNetworkInterfaceTarget struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this share mount target. - Href *string `json:"href,omitempty"` - - // The unique identifier for this share mount target. - ID *string `json:"id,omitempty"` - - // The name for this share mount target. The name is unique across all mount targets for the file share. - Name *string `json:"name,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} - -// Constants associated with the VirtualNetworkInterfaceTarget.ResourceType property. -// The resource type. -const ( - VirtualNetworkInterfaceTargetResourceTypeShareMountTargetConst = "share_mount_target" -) - -func (*VirtualNetworkInterfaceTarget) isaVirtualNetworkInterfaceTarget() bool { - return true -} - -type VirtualNetworkInterfaceTargetIntf interface { - isaVirtualNetworkInterfaceTarget() bool -} - -// UnmarshalVirtualNetworkInterfaceTarget unmarshals an instance of VirtualNetworkInterfaceTarget from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) - 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 -} - -// Volume : Volume struct -type Volume struct { - // Indicates whether a running virtual server instance has an attachment to this volume. - Active *bool `json:"active" validate:"required"` - - // The attachment state of the volume - // - `unattached`: Not attached to any virtual server instances - // - `attached`: Attached to a virtual server instance (even if the instance is stopped) - // - `unusable`: Not able to be attached to any virtual server instances. - AttachmentState *string `json:"attachment_state" validate:"required"` - - // The maximum bandwidth (in megabits per second) for the volume. - Bandwidth *int64 `json:"bandwidth" validate:"required"` - - // Indicates whether this volume is performing an operation that must be serialized. This must be `false` to perform an - // operation that is specified to require serialization. - Busy *bool `json:"busy" validate:"required"` - - // The capacity to use for the volume (in gigabytes). - // - // The minimum and maximum limits for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Capacity *int64 `json:"capacity" validate:"required"` - - // The date and time that the volume was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this volume. - CRN *string `json:"crn" validate:"required"` - - // The type of encryption used on the volume. - Encryption *string `json:"encryption" validate:"required"` - - // The root key used to wrap the data encryption key for the volume. - // - // This property will be present for volumes with an `encryption` type of - // `user_managed`. - EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` - - // The reasons for the current `health_state` (if any). - HealthReasons []VolumeHealthReason `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 volume. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this volume. - ID *string `json:"id" validate:"required"` - - // The maximum I/O operations per second (IOPS) for this volume. - Iops *int64 `json:"iops" validate:"required"` - - // The name for this volume. The name is unique across all volumes in the region. - Name *string `json:"name" validate:"required"` - - // The operating system associated with this volume. If absent, this volume was not - // created from an image, or the image did not include an operating system. - OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) for - // this volume. - Profile *VolumeProfileReference `json:"profile" validate:"required"` - - // The resource group for this volume. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The image from which this volume was created (this may be - // [deleted](https://cloud.ibm.com/apidocs/vpc#deleted-resources)). - // If absent, this volume was not created from an image. - SourceImage *ImageReference `json:"source_image,omitempty"` - - // The snapshot from which this volume was cloned. - SourceSnapshot *SnapshotReference `json:"source_snapshot,omitempty"` - - // The status of the volume. - // - // 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 []VolumeStatusReason `json:"status_reasons" validate:"required"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags" validate:"required"` - - // The volume attachments for this volume. - VolumeAttachments []VolumeAttachmentReferenceVolumeContext `json:"volume_attachments" validate:"required"` - - // The zone this volume resides in. - Zone *ZoneReference `json:"zone" validate:"required"` -} - -// Constants associated with the Volume.AttachmentState property. -// The attachment state of the volume -// - `unattached`: Not attached to any virtual server instances -// - `attached`: Attached to a virtual server instance (even if the instance is stopped) -// - `unusable`: Not able to be attached to any virtual server instances. -const ( - VolumeAttachmentStateAttachedConst = "attached" - VolumeAttachmentStateUnattachedConst = "unattached" - VolumeAttachmentStateUnusableConst = "unusable" -) - -// Constants associated with the Volume.Encryption property. -// The type of encryption used on the volume. -const ( - VolumeEncryptionProviderManagedConst = "provider_managed" - VolumeEncryptionUserManagedConst = "user_managed" -) - -// Constants associated with the Volume.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 ( - VolumeHealthStateDegradedConst = "degraded" - VolumeHealthStateFaultedConst = "faulted" - VolumeHealthStateInapplicableConst = "inapplicable" - VolumeHealthStateOkConst = "ok" -) - -// Constants associated with the Volume.ResourceType property. -// The resource type. -const ( - VolumeResourceTypeVolumeConst = "volume" -) - -// Constants associated with the Volume.Status property. -// The status of the volume. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VolumeStatusAvailableConst = "available" - VolumeStatusFailedConst = "failed" - VolumeStatusPendingConst = "pending" - VolumeStatusPendingDeletionConst = "pending_deletion" - VolumeStatusUnusableConst = "unusable" - VolumeStatusUpdatingConst = "updating" -) - -// UnmarshalVolume unmarshals an instance of Volume from the specified map of raw messages. -func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Volume) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "attachment_state", &obj.AttachmentState) - if err != nil { - err = core.SDKErrorf(err, "", "attachment_state-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "busy", &obj.Busy) - if err != nil { - err = core.SDKErrorf(err, "", "busy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - err = core.SDKErrorf(err, "", "capacity-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) - if err != nil { - err = core.SDKErrorf(err, "", "encryption-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, "health_reasons", &obj.HealthReasons, UnmarshalVolumeHealthReason) - 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, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-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, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) - if err != nil { - err = core.SDKErrorf(err, "", "operating_system-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileReference) - if err != nil { - err = core.SDKErrorf(err, "", "profile-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, "source_image", &obj.SourceImage, UnmarshalImageReference) - if err != nil { - err = core.SDKErrorf(err, "", "source_image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotReference) - if err != nil { - err = core.SDKErrorf(err, "", "source_snapshot-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, UnmarshalVolumeStatusReason) - if err != nil { - err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceVolumeContext) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-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 -} - -// VolumeAttachment : VolumeAttachment struct -type VolumeAttachment struct { - // The maximum bandwidth (in megabits per second) for the volume when attached to this instance. This may be lower than - // the volume bandwidth depending on the configuration of the instance. - Bandwidth *int64 `json:"bandwidth" validate:"required"` - - // The date and time that the volume was attached. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete" validate:"required"` - - // Information about how the volume is exposed to the instance operating system. - // - // This property may be absent if the volume attachment's `status` is not `attached`. - Device *VolumeAttachmentDevice `json:"device,omitempty"` - - // The URL for this volume attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this volume attachment. - ID *string `json:"id" validate:"required"` - - // The name for this volume attachment. The name is unique across all volume attachments on the instance. - Name *string `json:"name" validate:"required"` - - // The status of this volume attachment. - Status *string `json:"status" validate:"required"` - - // The type of volume attachment. - Type *string `json:"type" validate:"required"` - - // The attached volume. - // - // This property will be absent if the volume has not yet been provisioned. - Volume *VolumeReferenceVolumeAttachmentContext `json:"volume,omitempty"` -} - -// Constants associated with the VolumeAttachment.Status property. -// The status of this volume attachment. -const ( - VolumeAttachmentStatusAttachedConst = "attached" - VolumeAttachmentStatusAttachingConst = "attaching" - VolumeAttachmentStatusDeletingConst = "deleting" - VolumeAttachmentStatusDetachingConst = "detaching" -) - -// Constants associated with the VolumeAttachment.Type property. -// The type of volume attachment. -const ( - VolumeAttachmentTypeBootConst = "boot" - VolumeAttachmentTypeDataConst = "data" -) - -// UnmarshalVolumeAttachment unmarshals an instance of VolumeAttachment from the specified map of raw messages. -func UnmarshalVolumeAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachment) - err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "bandwidth-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, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) - if err != nil { - err = core.SDKErrorf(err, "", "delete_volume_on_instance_delete-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) - if err != nil { - err = core.SDKErrorf(err, "", "device-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, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-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.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReferenceVolumeAttachmentContext) - if err != nil { - err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentCollection : VolumeAttachmentCollection struct -type VolumeAttachmentCollection struct { - // Collection of volume attachments. - VolumeAttachments []VolumeAttachment `json:"volume_attachments" validate:"required"` -} - -// UnmarshalVolumeAttachmentCollection unmarshals an instance of VolumeAttachmentCollection from the specified map of raw messages. -func UnmarshalVolumeAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentCollection) - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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"` -} - -// UnmarshalVolumeAttachmentDevice unmarshals an instance of VolumeAttachmentDevice from the specified map of raw messages. -func UnmarshalVolumeAttachmentDevice(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentDevice) - 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 -} - -// VolumeAttachmentPatch : VolumeAttachmentPatch struct -type VolumeAttachmentPatch struct { - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - - // The name for this volume attachment. The name must not be used by another volume attachment on the instance. - Name *string `json:"name,omitempty"` -} - -// UnmarshalVolumeAttachmentPatch unmarshals an instance of VolumeAttachmentPatch from the specified map of raw messages. -func UnmarshalVolumeAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPatch) - err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) - if err != nil { - err = core.SDKErrorf(err, "", "delete_volume_on_instance_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 -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// VolumeAttachmentPrototype : VolumeAttachmentPrototype struct -type VolumeAttachmentPrototype struct { - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - - // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // An existing volume to attach to the instance, or a prototype object for a new volume. - Volume VolumeAttachmentPrototypeVolumeIntf `json:"volume" validate:"required"` -} - -// NewVolumeAttachmentPrototype : Instantiate VolumeAttachmentPrototype (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototype(volume VolumeAttachmentPrototypeVolumeIntf) (_model *VolumeAttachmentPrototype, err error) { - _model = &VolumeAttachmentPrototype{ - Volume: volume, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalVolumeAttachmentPrototype unmarshals an instance of VolumeAttachmentPrototype from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototype) - err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) - if err != nil { - err = core.SDKErrorf(err, "", "delete_volume_on_instance_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, "volume", &obj.Volume, UnmarshalVolumeAttachmentPrototypeVolume) - if err != nil { - err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeInstanceByImageContext : VolumeAttachmentPrototypeInstanceByImageContext struct -type VolumeAttachmentPrototypeInstanceByImageContext struct { - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - - // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // A prototype object for a new volume. - Volume *VolumePrototypeInstanceByImageContext `json:"volume" validate:"required"` -} - -// NewVolumeAttachmentPrototypeInstanceByImageContext : Instantiate VolumeAttachmentPrototypeInstanceByImageContext (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByImageContext(volume *VolumePrototypeInstanceByImageContext) (_model *VolumeAttachmentPrototypeInstanceByImageContext, err error) { - _model = &VolumeAttachmentPrototypeInstanceByImageContext{ - Volume: volume, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalVolumeAttachmentPrototypeInstanceByImageContext unmarshals an instance of VolumeAttachmentPrototypeInstanceByImageContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeInstanceByImageContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeInstanceByImageContext) - err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) - if err != nil { - err = core.SDKErrorf(err, "", "delete_volume_on_instance_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, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeInstanceBySourceSnapshotContext : VolumeAttachmentPrototypeInstanceBySourceSnapshotContext struct -type VolumeAttachmentPrototypeInstanceBySourceSnapshotContext struct { - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - - // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // A prototype object for a new volume from a snapshot. - Volume *VolumePrototypeInstanceBySourceSnapshotContext `json:"volume" validate:"required"` -} - -// NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext : Instantiate VolumeAttachmentPrototypeInstanceBySourceSnapshotContext (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(volume *VolumePrototypeInstanceBySourceSnapshotContext) (_model *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, err error) { - _model = &VolumeAttachmentPrototypeInstanceBySourceSnapshotContext{ - Volume: volume, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext unmarshals an instance of VolumeAttachmentPrototypeInstanceBySourceSnapshotContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) - if err != nil { - err = core.SDKErrorf(err, "", "delete_volume_on_instance_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, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceBySourceSnapshotContext) - if err != nil { - err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeInstanceByVolumeContext : VolumeAttachmentPrototypeInstanceByVolumeContext struct -type VolumeAttachmentPrototypeInstanceByVolumeContext struct { - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` - - // The name for this volume attachment. The name must not be used by another volume attachment on the instance. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // An existing volume to attach. - Volume VolumeIdentityIntf `json:"volume" validate:"required"` -} - -// NewVolumeAttachmentPrototypeInstanceByVolumeContext : Instantiate VolumeAttachmentPrototypeInstanceByVolumeContext (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByVolumeContext(volume VolumeIdentityIntf) (_model *VolumeAttachmentPrototypeInstanceByVolumeContext, err error) { - _model = &VolumeAttachmentPrototypeInstanceByVolumeContext{ - Volume: volume, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext unmarshals an instance of VolumeAttachmentPrototypeInstanceByVolumeContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeInstanceByVolumeContext) - err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) - if err != nil { - err = core.SDKErrorf(err, "", "delete_volume_on_instance_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, "volume", &obj.Volume, UnmarshalVolumeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeVolume : An existing volume to attach to the instance, or a prototype object for a new volume. -// Models which "extend" this model: -// - VolumeAttachmentPrototypeVolumeVolumeIdentity -// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext -type VolumeAttachmentPrototypeVolume struct { - // The unique identifier for this volume. - ID *string `json:"id,omitempty"` - - // The CRN for this volume. - CRN *string `json:"crn,omitempty"` - - // The URL for this volume. - Href *string `json:"href,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to - // use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` - - // The resource group to use for this volume. If unspecified, the instance's resource - // group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The capacity to use for the volume (in gigabytes). - // - // The minimum and maximum limits for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` -} - -func (*VolumeAttachmentPrototypeVolume) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -type VolumeAttachmentPrototypeVolumeIntf interface { - isaVolumeAttachmentPrototypeVolume() bool -} - -// UnmarshalVolumeAttachmentPrototypeVolume unmarshals an instance of VolumeAttachmentPrototypeVolume from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolume(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolume) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentReferenceInstanceContext : VolumeAttachmentReferenceInstanceContext struct -type VolumeAttachmentReferenceInstanceContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VolumeAttachmentReferenceInstanceContextDeleted `json:"deleted,omitempty"` - - // Information about how the volume is exposed to the instance operating system. - // - // This property may be absent if the volume attachment's `status` is not `attached`. - Device *VolumeAttachmentDevice `json:"device,omitempty"` - - // The URL for this volume attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this volume attachment. - ID *string `json:"id" validate:"required"` - - // The name for this volume attachment. The name is unique across all volume attachments on the instance. - Name *string `json:"name" validate:"required"` - - // The attached volume. - // - // This property will be absent if the volume has not yet been provisioned. - Volume *VolumeReferenceVolumeAttachmentContext `json:"volume,omitempty"` -} - -// UnmarshalVolumeAttachmentReferenceInstanceContext unmarshals an instance of VolumeAttachmentReferenceInstanceContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentReferenceInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentReferenceInstanceContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceInstanceContextDeleted) - if err != nil { - err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) - if err != nil { - err = core.SDKErrorf(err, "", "device-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, "volume", &obj.Volume, UnmarshalVolumeReferenceVolumeAttachmentContext) - if err != nil { - err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentReferenceInstanceContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VolumeAttachmentReferenceInstanceContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVolumeAttachmentReferenceInstanceContextDeleted unmarshals an instance of VolumeAttachmentReferenceInstanceContextDeleted from the specified map of raw messages. -func UnmarshalVolumeAttachmentReferenceInstanceContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentReferenceInstanceContextDeleted) - 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 -} - -// VolumeAttachmentReferenceVolumeContext : VolumeAttachmentReferenceVolumeContext struct -type VolumeAttachmentReferenceVolumeContext struct { - // Indicates whether deleting the instance will also delete the attached volume. - DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VolumeAttachmentReferenceVolumeContextDeleted `json:"deleted,omitempty"` - - // Information about how the volume is exposed to the instance operating system. - // - // This property may be absent if the volume attachment's `status` is not `attached`. - Device *VolumeAttachmentDevice `json:"device,omitempty"` - - // The URL for this volume attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this volume attachment. - ID *string `json:"id" validate:"required"` - - // The attached instance. - Instance *InstanceReference `json:"instance" validate:"required"` - - // The name for this volume attachment. The name is unique across all volume attachments on the instance. - Name *string `json:"name" validate:"required"` - - // The type of volume attachment. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the VolumeAttachmentReferenceVolumeContext.Type property. -// The type of volume attachment. -const ( - VolumeAttachmentReferenceVolumeContextTypeBootConst = "boot" - VolumeAttachmentReferenceVolumeContextTypeDataConst = "data" -) - -// UnmarshalVolumeAttachmentReferenceVolumeContext unmarshals an instance of VolumeAttachmentReferenceVolumeContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentReferenceVolumeContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentReferenceVolumeContext) - err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) - if err != nil { - err = core.SDKErrorf(err, "", "delete_volume_on_instance_delete-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceVolumeContextDeleted) - if err != nil { - err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) - if err != nil { - err = core.SDKErrorf(err, "", "device-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, "instance", &obj.Instance, UnmarshalInstanceReference) - if err != nil { - err = core.SDKErrorf(err, "", "instance-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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentReferenceVolumeContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VolumeAttachmentReferenceVolumeContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVolumeAttachmentReferenceVolumeContextDeleted unmarshals an instance of VolumeAttachmentReferenceVolumeContextDeleted from the specified map of raw messages. -func UnmarshalVolumeAttachmentReferenceVolumeContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentReferenceVolumeContextDeleted) - 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 -} - -// VolumeCollection : VolumeCollection struct -type VolumeCollection struct { - // A link to the first page of resources. - First *VolumeCollectionFirst `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"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` - - // Collection of volumes. - Volumes []Volume `json:"volumes" validate:"required"` -} - -// 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) - 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, UnmarshalVolumeCollectionNext) - 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 - } - err = core.UnmarshalModel(m, "volumes", &obj.Volumes, UnmarshalVolume) - if err != nil { - err = core.SDKErrorf(err, "", "volumes-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 *VolumeCollection) 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 -} - -// 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. - 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"` -} - -// Constants associated with the VolumeHealthReason.Code property. -// A reason code for this health state. -const ( - VolumeHealthReasonCodeInitializingFromSnapshotConst = "initializing_from_snapshot" -) - -// UnmarshalVolumeHealthReason unmarshals an instance of VolumeHealthReason from the specified map of raw messages. -func UnmarshalVolumeHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeHealthReason) - 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 -} - -// VolumeIdentity : Identifies a volume by a unique property. -// Models which "extend" this model: -// - VolumeIdentityByID -// - VolumeIdentityByCRN -// - VolumeIdentityByHref -type VolumeIdentity struct { - // The unique identifier for this volume. - ID *string `json:"id,omitempty"` - - // The CRN for this volume. - CRN *string `json:"crn,omitempty"` - - // The URL for this volume. - Href *string `json:"href,omitempty"` -} - -func (*VolumeIdentity) isaVolumeIdentity() bool { - return true -} - -type VolumeIdentityIntf interface { - isaVolumeIdentity() bool -} - -// UnmarshalVolumeIdentity unmarshals an instance of VolumeIdentity from the specified map of raw messages. -func UnmarshalVolumeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumePatch : VolumePatch struct -type VolumePatch struct { - // The capacity to use for the volume (in gigabytes). The volume must be attached to a running virtual server instance, - // and the specified value must not be less than the current capacity. Additionally, if the volume is attached as a - // boot volume, the maximum value is 250 gigabytes. - // - // The minimum and maximum limits for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Capacity *int64 `json:"capacity,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. The volume must be attached as a data volume to a running virtual server instance. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. - Name *string `json:"name,omitempty"` - - // The profile to use for this volume. The requested profile must be in the same - // `family` as the current profile. The volume must be attached as a data volume to - // a running virtual server instance, and must have a `capacity` within the range - // supported by the specified profile. - Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` -} - -// UnmarshalVolumePatch unmarshals an instance of VolumePatch from the specified map of raw messages. -func UnmarshalVolumePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumePatch) - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) - } - return -} - -// VolumeProfile : VolumeProfile struct -type VolumeProfile struct { - // The product family this volume 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 URL for this volume profile. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this volume profile. - Name *string `json:"name" validate:"required"` -} - -// Constants associated with the VolumeProfile.Family property. -// The product family this volume profile belongs to. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VolumeProfileFamilyCustomConst = "custom" - VolumeProfileFamilyTieredConst = "tiered" -) - -// UnmarshalVolumeProfile unmarshals an instance of VolumeProfile from the specified map of raw messages. -func UnmarshalVolumeProfile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfile) - err = core.UnmarshalPrimitive(m, "family", &obj.Family) - if err != nil { - err = core.SDKErrorf(err, "", "family-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, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeProfileCollection : VolumeProfileCollection struct -type VolumeProfileCollection struct { - // A link to the first page of resources. - First *VolumeProfileCollectionFirst `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"` - - // Collection of volume profiles. - Profiles []VolumeProfile `json:"profiles" validate:"required"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// 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) - 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, UnmarshalVolumeProfileCollectionNext) - if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalVolumeProfile) - 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()) - 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 *VolumeProfileCollection) 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 -} - -// 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 -} - -// VolumeProfileIdentity : Identifies a volume profile by a unique property. -// Models which "extend" this model: -// - VolumeProfileIdentityByName -// - VolumeProfileIdentityByHref -type VolumeProfileIdentity struct { - // The globally unique name for this volume profile. - Name *string `json:"name,omitempty"` - - // The URL for this volume profile. - Href *string `json:"href,omitempty"` -} - -func (*VolumeProfileIdentity) isaVolumeProfileIdentity() bool { - return true -} - -type VolumeProfileIdentityIntf interface { - isaVolumeProfileIdentity() bool -} - -// UnmarshalVolumeProfileIdentity unmarshals an instance of VolumeProfileIdentity from the specified map of raw messages. -func UnmarshalVolumeProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileIdentity) - 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 -} - -// VolumeProfileReference : VolumeProfileReference struct -type VolumeProfileReference struct { - // The URL for this volume profile. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this volume profile. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalVolumeProfileReference unmarshals an instance of VolumeProfileReference from the specified map of raw messages. -func UnmarshalVolumeProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-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 -} - -// VolumePrototype : VolumePrototype struct -// Models which "extend" this model: -// - VolumePrototypeVolumeByCapacity -// - VolumePrototypeVolumeBySourceSnapshot -type VolumePrototype struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to - // use for this volume. - Profile VolumeProfileIdentityIntf `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"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The zone this volume will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The capacity to use for the volume (in gigabytes). - // - // The minimum and maximum limits for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` -} - -func (*VolumePrototype) isaVolumePrototype() bool { - return true -} - -type VolumePrototypeIntf interface { - isaVolumePrototype() bool -} - -// UnmarshalVolumePrototype unmarshals an instance of VolumePrototype from the specified map of raw messages. -func UnmarshalVolumePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumePrototype) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumePrototypeInstanceByImageContext : VolumePrototypeInstanceByImageContext struct -type VolumePrototypeInstanceByImageContext struct { - // The capacity to use for the volume (in gigabytes). Must be at least the image's - // `minimum_provisioned_size`. The maximum value may increase in the future. - // - // If unspecified, the capacity will be the image's `minimum_provisioned_size`. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to - // use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - // The resource group to use for this volume. If unspecified, the instance's resource - // group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` -} - -// NewVolumePrototypeInstanceByImageContext : Instantiate VolumePrototypeInstanceByImageContext (Generic Model Constructor) -func (*VpcV1) NewVolumePrototypeInstanceByImageContext(profile VolumeProfileIdentityIntf) (_model *VolumePrototypeInstanceByImageContext, err error) { - _model = &VolumePrototypeInstanceByImageContext{ - Profile: profile, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalVolumePrototypeInstanceByImageContext unmarshals an instance of VolumePrototypeInstanceByImageContext from the specified map of raw messages. -func UnmarshalVolumePrototypeInstanceByImageContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumePrototypeInstanceByImageContext) - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - err = core.SDKErrorf(err, "", "capacity-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.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumePrototypeInstanceBySourceSnapshotContext : VolumePrototypeInstanceBySourceSnapshotContext struct -type VolumePrototypeInstanceBySourceSnapshotContext struct { - // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's - // `minimum_capacity`. The maximum value may increase in the future. - // - // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to - // use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - // The resource group to use for this volume. If unspecified, the instance's resource - // group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` -} - -// NewVolumePrototypeInstanceBySourceSnapshotContext : Instantiate VolumePrototypeInstanceBySourceSnapshotContext (Generic Model Constructor) -func (*VpcV1) NewVolumePrototypeInstanceBySourceSnapshotContext(profile VolumeProfileIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumePrototypeInstanceBySourceSnapshotContext, err error) { - _model = &VolumePrototypeInstanceBySourceSnapshotContext{ - Profile: profile, - SourceSnapshot: sourceSnapshot, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalVolumePrototypeInstanceBySourceSnapshotContext unmarshals an instance of VolumePrototypeInstanceBySourceSnapshotContext from the specified map of raw messages. -func UnmarshalVolumePrototypeInstanceBySourceSnapshotContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumePrototypeInstanceBySourceSnapshotContext) - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - err = core.SDKErrorf(err, "", "capacity-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.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeReference : VolumeReference struct -type VolumeReference struct { - // The CRN for this volume. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this volume. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this volume. - ID *string `json:"id" validate:"required"` - - // The name for this volume. The name is unique across all volumes in the region. - 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 *VolumeRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VolumeReference.ResourceType property. -// The resource type. -const ( - VolumeReferenceResourceTypeVolumeConst = "volume" -) - -// UnmarshalVolumeReference unmarshals an instance of VolumeReference from the specified map of raw messages. -func UnmarshalVolumeReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeReference) - 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, UnmarshalVolumeReferenceDeleted) - 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 -} - -// VolumeReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VolumeReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVolumeReferenceDeleted unmarshals an instance of VolumeReferenceDeleted from the specified map of raw messages. -func UnmarshalVolumeReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeReferenceDeleted) - 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 -} - -// VolumeReferenceVolumeAttachmentContext : VolumeReferenceVolumeAttachmentContext struct -type VolumeReferenceVolumeAttachmentContext struct { - // The CRN for this volume. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VolumeReferenceVolumeAttachmentContextDeleted `json:"deleted,omitempty"` - - // The URL for this volume. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this volume. - ID *string `json:"id" validate:"required"` - - // The name for this volume. The name is unique across all volumes in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VolumeReferenceVolumeAttachmentContext.ResourceType property. -// The resource type. -const ( - VolumeReferenceVolumeAttachmentContextResourceTypeVolumeConst = "volume" -) - -// UnmarshalVolumeReferenceVolumeAttachmentContext unmarshals an instance of VolumeReferenceVolumeAttachmentContext from the specified map of raw messages. -func UnmarshalVolumeReferenceVolumeAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeReferenceVolumeAttachmentContext) - 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, UnmarshalVolumeReferenceVolumeAttachmentContextDeleted) - 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 -} - -// VolumeReferenceVolumeAttachmentContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VolumeReferenceVolumeAttachmentContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVolumeReferenceVolumeAttachmentContextDeleted unmarshals an instance of VolumeReferenceVolumeAttachmentContextDeleted from the specified map of raw messages. -func UnmarshalVolumeReferenceVolumeAttachmentContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeReferenceVolumeAttachmentContextDeleted) - 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 -} - -// VolumeRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not -// be directly retrievable. -type VolumeRemote 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"` -} - -// UnmarshalVolumeRemote unmarshals an instance of VolumeRemote from the specified map of raw messages. -func UnmarshalVolumeRemote(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeRemote) - 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 -} - -// VolumeStatusReason : VolumeStatusReason struct -type VolumeStatusReason struct { - // A snake case string succinctly identifying the status reason. - // - // 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 VolumeStatusReason.Code property. -// A snake case string succinctly identifying the status reason. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VolumeStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" -) - -// UnmarshalVolumeStatusReason unmarshals an instance of VolumeStatusReason from the specified map of raw messages. -func UnmarshalVolumeStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeStatusReason) - 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 -} - -// 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 URL for this zone. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this zone. - Name *string `json:"name" validate:"required"` - - // The region this zone resides in. - Region *RegionReference `json:"region" validate:"required"` - - // The availability status of this zone. - Status *string `json:"status" validate:"required"` -} - -// Constants associated with the Zone.Status property. -// The availability status of this zone. -const ( - ZoneStatusAvailableConst = "available" - ZoneStatusImpairedConst = "impaired" - ZoneStatusUnavailableConst = "unavailable" -) - -// UnmarshalZone unmarshals an instance of Zone from the specified map of raw messages. -func UnmarshalZone(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Zone) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-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, "region", &obj.Region, UnmarshalRegionReference) - if err != nil { - err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ZoneCollection : ZoneCollection struct -type ZoneCollection struct { - // Collection of zones. - Zones []Zone `json:"zones" validate:"required"` -} - -// UnmarshalZoneCollection unmarshals an instance of ZoneCollection from the specified map of raw messages. -func UnmarshalZoneCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ZoneCollection) - err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZone) - if err != nil { - err = core.SDKErrorf(err, "", "zones-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ZoneIdentity : Identifies a zone by a unique property. -// Models which "extend" this model: -// - ZoneIdentityByName -// - ZoneIdentityByHref -type ZoneIdentity struct { - // The globally unique name for this zone. - Name *string `json:"name,omitempty"` - - // The URL for this zone. - Href *string `json:"href,omitempty"` -} - -func (*ZoneIdentity) isaZoneIdentity() bool { - return true -} - -type ZoneIdentityIntf interface { - isaZoneIdentity() bool -} - -// UnmarshalZoneIdentity unmarshals an instance of ZoneIdentity from the specified map of raw messages. -func UnmarshalZoneIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ZoneIdentity) - 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 -} - -// ZoneReference : ZoneReference struct -type ZoneReference struct { - // The URL for this zone. - Href *string `json:"href" validate:"required"` - - // The globally unique name for this zone. - Name *string `json:"name" validate:"required"` -} - -// UnmarshalZoneReference unmarshals an instance of ZoneReference from the specified map of raw messages. -func UnmarshalZoneReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ZoneReference) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-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 -} - -// BackupPolicyJobSourceInstanceReference : BackupPolicyJobSourceInstanceReference struct -// This model "extends" BackupPolicyJobSource -type BackupPolicyJobSourceInstanceReference struct { - // The CRN for this virtual server instance. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual server instance. - ID *string `json:"id" validate:"required"` - - // The name for this virtual server instance. The name is unique across all virtual server instances in the region. - Name *string `json:"name" validate:"required"` -} - -func (*BackupPolicyJobSourceInstanceReference) isaBackupPolicyJobSource() bool { - return true -} - -// UnmarshalBackupPolicyJobSourceInstanceReference unmarshals an instance of BackupPolicyJobSourceInstanceReference from the specified map of raw messages. -func UnmarshalBackupPolicyJobSourceInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobSourceInstanceReference) - 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, UnmarshalInstanceReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyJobSourceVolumeReference : BackupPolicyJobSourceVolumeReference struct -// This model "extends" BackupPolicyJobSource -type BackupPolicyJobSourceVolumeReference struct { - // The CRN for this volume. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this volume. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this volume. - ID *string `json:"id" validate:"required"` - - // The name for this volume. The name is unique across all volumes in the region. - 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 *VolumeRemote `json:"remote,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the BackupPolicyJobSourceVolumeReference.ResourceType property. -// The resource type. -const ( - BackupPolicyJobSourceVolumeReferenceResourceTypeVolumeConst = "volume" -) - -func (*BackupPolicyJobSourceVolumeReference) isaBackupPolicyJobSource() bool { - return true -} - -// UnmarshalBackupPolicyJobSourceVolumeReference unmarshals an instance of BackupPolicyJobSourceVolumeReference from the specified map of raw messages. -func UnmarshalBackupPolicyJobSourceVolumeReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyJobSourceVolumeReference) - 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, UnmarshalVolumeReferenceDeleted) - 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 -} - -// BackupPolicyMatchResourceTypeInstance : BackupPolicyMatchResourceTypeInstance struct -// This model "extends" BackupPolicy -type BackupPolicyMatchResourceTypeInstance 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 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"` - - 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" 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"` -} - -// Constants associated with the BackupPolicyMatchResourceTypeInstance.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 ( - BackupPolicyMatchResourceTypeInstanceHealthStateDegradedConst = "degraded" - BackupPolicyMatchResourceTypeInstanceHealthStateFaultedConst = "faulted" - BackupPolicyMatchResourceTypeInstanceHealthStateInapplicableConst = "inapplicable" - BackupPolicyMatchResourceTypeInstanceHealthStateOkConst = "ok" -) - -// Constants associated with the BackupPolicyMatchResourceTypeInstance.LifecycleState property. -// The lifecycle state of the backup policy. -const ( - BackupPolicyMatchResourceTypeInstanceLifecycleStateDeletingConst = "deleting" - BackupPolicyMatchResourceTypeInstanceLifecycleStateFailedConst = "failed" - BackupPolicyMatchResourceTypeInstanceLifecycleStatePendingConst = "pending" - BackupPolicyMatchResourceTypeInstanceLifecycleStateStableConst = "stable" - BackupPolicyMatchResourceTypeInstanceLifecycleStateSuspendedConst = "suspended" - BackupPolicyMatchResourceTypeInstanceLifecycleStateUpdatingConst = "updating" - BackupPolicyMatchResourceTypeInstanceLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the BackupPolicyMatchResourceTypeInstance.ResourceType property. -// The resource type. -const ( - BackupPolicyMatchResourceTypeInstanceResourceTypeBackupPolicyConst = "backup_policy" -) - -// Constants associated with the BackupPolicyMatchResourceTypeInstance.IncludedContent property. -// An item to include. -const ( - BackupPolicyMatchResourceTypeInstanceIncludedContentBootVolumeConst = "boot_volume" - BackupPolicyMatchResourceTypeInstanceIncludedContentDataVolumesConst = "data_volumes" -) - -// Constants associated with the BackupPolicyMatchResourceTypeInstance.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 ( - BackupPolicyMatchResourceTypeInstanceMatchResourceTypeInstanceConst = "instance" -) - -func (*BackupPolicyMatchResourceTypeInstance) isaBackupPolicy() bool { - return true -} - -// UnmarshalBackupPolicyMatchResourceTypeInstance unmarshals an instance of BackupPolicyMatchResourceTypeInstance from the specified map of raw messages. -func UnmarshalBackupPolicyMatchResourceTypeInstance(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyMatchResourceTypeInstance) - 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_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 - } - err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) - if err != nil { - err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyMatchResourceTypeVolume : BackupPolicyMatchResourceTypeVolume struct -// This model "extends" BackupPolicy -type BackupPolicyMatchResourceTypeVolume 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 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"` - - Scope BackupPolicyScopeIntf `json:"scope" 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"` -} - -// Constants associated with the BackupPolicyMatchResourceTypeVolume.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 ( - BackupPolicyMatchResourceTypeVolumeHealthStateDegradedConst = "degraded" - BackupPolicyMatchResourceTypeVolumeHealthStateFaultedConst = "faulted" - BackupPolicyMatchResourceTypeVolumeHealthStateInapplicableConst = "inapplicable" - BackupPolicyMatchResourceTypeVolumeHealthStateOkConst = "ok" -) - -// Constants associated with the BackupPolicyMatchResourceTypeVolume.LifecycleState property. -// The lifecycle state of the backup policy. -const ( - BackupPolicyMatchResourceTypeVolumeLifecycleStateDeletingConst = "deleting" - BackupPolicyMatchResourceTypeVolumeLifecycleStateFailedConst = "failed" - BackupPolicyMatchResourceTypeVolumeLifecycleStatePendingConst = "pending" - BackupPolicyMatchResourceTypeVolumeLifecycleStateStableConst = "stable" - BackupPolicyMatchResourceTypeVolumeLifecycleStateSuspendedConst = "suspended" - BackupPolicyMatchResourceTypeVolumeLifecycleStateUpdatingConst = "updating" - BackupPolicyMatchResourceTypeVolumeLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the BackupPolicyMatchResourceTypeVolume.ResourceType property. -// The resource type. -const ( - BackupPolicyMatchResourceTypeVolumeResourceTypeBackupPolicyConst = "backup_policy" -) - -// Constants associated with the BackupPolicyMatchResourceTypeVolume.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 ( - BackupPolicyMatchResourceTypeVolumeMatchResourceTypeVolumeConst = "volume" -) - -func (*BackupPolicyMatchResourceTypeVolume) isaBackupPolicy() bool { - return true -} - -// UnmarshalBackupPolicyMatchResourceTypeVolume unmarshals an instance of BackupPolicyMatchResourceTypeVolume from the specified map of raw messages. -func UnmarshalBackupPolicyMatchResourceTypeVolume(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyMatchResourceTypeVolume) - 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_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, "match_resource_type", &obj.MatchResourceType) - if err != nil { - err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype : BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype struct -// This model "extends" BackupPolicyPrototype -type BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype struct { - // 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"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - 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"` - - // 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"` -} - -// Constants associated with the BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype.IncludedContent property. -// An item to include. -const ( - BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototypeIncludedContentBootVolumeConst = "boot_volume" - BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototypeIncludedContentDataVolumesConst = "data_volumes" -) - -// Constants associated with the BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype.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 ( - BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototypeMatchResourceTypeInstanceConst = "instance" -) - -// NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype : Instantiate BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype (Generic Model Constructor) -func (*VpcV1) NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype(matchUserTags []string, matchResourceType string) (_model *BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype, err error) { - _model = &BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype{ - MatchUserTags: matchUserTags, - MatchResourceType: core.StringPtr(matchResourceType), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype) isaBackupPolicyPrototype() bool { - return true -} - -// UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype unmarshals an instance of BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype) - 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, 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 - } - err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) - if err != nil { - err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype : BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype struct -// This model "extends" BackupPolicyPrototype -type BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype struct { - // 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"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - Scope BackupPolicyScopePrototypeIntf `json:"scope,omitempty"` - - // 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"` -} - -// Constants associated with the BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype.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 ( - BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototypeMatchResourceTypeVolumeConst = "volume" -) - -// NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype : Instantiate BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype (Generic Model Constructor) -func (*VpcV1) NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype(matchUserTags []string, matchResourceType string) (_model *BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype, err error) { - _model = &BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype{ - MatchUserTags: matchUserTags, - MatchResourceType: core.StringPtr(matchResourceType), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) isaBackupPolicyPrototype() bool { - return true -} - -// UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype unmarshals an instance of BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype) - 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, 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, "match_resource_type", &obj.MatchResourceType) - if err != nil { - err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BackupPolicyScopePrototypeEnterpriseIdentity : Identifies an enterprise by a unique property. -// Models which "extend" this model: -// - BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN -// This model "extends" BackupPolicyScopePrototype -type BackupPolicyScopePrototypeEnterpriseIdentity struct { - // The CRN for this enterprise. - CRN *string `json:"crn,omitempty"` -} - -func (*BackupPolicyScopePrototypeEnterpriseIdentity) isaBackupPolicyScopePrototypeEnterpriseIdentity() bool { - return true -} - -type BackupPolicyScopePrototypeEnterpriseIdentityIntf interface { - BackupPolicyScopePrototypeIntf - isaBackupPolicyScopePrototypeEnterpriseIdentity() bool -} - -func (*BackupPolicyScopePrototypeEnterpriseIdentity) isaBackupPolicyScopePrototype() bool { - return true -} - -// UnmarshalBackupPolicyScopePrototypeEnterpriseIdentity unmarshals an instance of BackupPolicyScopePrototypeEnterpriseIdentity from the specified map of raw messages. -func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyScopePrototypeEnterpriseIdentity) - 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 -} - -// BackupPolicyScopeAccountReference : BackupPolicyScopeAccountReference struct -// This model "extends" BackupPolicyScope -type BackupPolicyScopeAccountReference 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 BackupPolicyScopeAccountReference.ResourceType property. -// The resource type. -const ( - BackupPolicyScopeAccountReferenceResourceTypeAccountConst = "account" -) - -func (*BackupPolicyScopeAccountReference) isaBackupPolicyScope() bool { - return true -} - -// UnmarshalBackupPolicyScopeAccountReference unmarshals an instance of BackupPolicyScopeAccountReference from the specified map of raw messages. -func UnmarshalBackupPolicyScopeAccountReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyScopeAccountReference) - 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 -} - -// BackupPolicyScopeEnterpriseReference : BackupPolicyScopeEnterpriseReference struct -// This model "extends" BackupPolicyScope -type BackupPolicyScopeEnterpriseReference struct { - // The CRN for this enterprise. - CRN *string `json:"crn" validate:"required"` - - // The unique identifier for this enterprise. - ID *string `json:"id" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the BackupPolicyScopeEnterpriseReference.ResourceType property. -// The resource type. -const ( - BackupPolicyScopeEnterpriseReferenceResourceTypeEnterpriseConst = "enterprise" -) - -func (*BackupPolicyScopeEnterpriseReference) isaBackupPolicyScope() bool { - return true -} - -// UnmarshalBackupPolicyScopeEnterpriseReference unmarshals an instance of BackupPolicyScopeEnterpriseReference from the specified map of raw messages. -func UnmarshalBackupPolicyScopeEnterpriseReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyScopeEnterpriseReference) - 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, "", "resource_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerBootTargetBareMetalServerDiskReference : BareMetalServerBootTargetBareMetalServerDiskReference struct -// This model "extends" BareMetalServerBootTarget -type BareMetalServerBootTargetBareMetalServerDiskReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BareMetalServerDiskReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this bare metal server disk. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server disk. - ID *string `json:"id" 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"` -} - -// Constants associated with the BareMetalServerBootTargetBareMetalServerDiskReference.ResourceType property. -// The resource type. -const ( - BareMetalServerBootTargetBareMetalServerDiskReferenceResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" -) - -func (*BareMetalServerBootTargetBareMetalServerDiskReference) isaBareMetalServerBootTarget() bool { - return true -} - -// UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference unmarshals an instance of BareMetalServerBootTargetBareMetalServerDiskReference from the specified map of raw messages. -func UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerBootTargetBareMetalServerDiskReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) - 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 -} - -// BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount : BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct -// This model "extends" BareMetalServerInitializationUserAccount -type BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount struct { - // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. - EncryptedPassword *[]byte `json:"encrypted_password" validate:"required"` - - // The public SSH key used to encrypt the password. - EncryptionKey *KeyReference `json:"encryption_key" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The username for the account created at initialization. - Username *string `json:"username" validate:"required"` -} - -// Constants associated with the BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount.ResourceType property. -// The resource type. -const ( - BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccountResourceTypeHostUserAccountConst = "host_user_account" -) - -func (*BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) isaBareMetalServerInitializationUserAccount() bool { - return true -} - -// UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount unmarshals an instance of BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount from the specified map of raw messages. -func UnmarshalBareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount) - err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) - if err != nil { - err = core.SDKErrorf(err, "", "encrypted_password-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) - if err != nil { - err = core.SDKErrorf(err, "", "encryption_key-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, "username", &obj.Username) - if err != nil { - err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentByPci : BareMetalServerNetworkAttachmentByPci struct -// This model "extends" BareMetalServerNetworkAttachment -type BareMetalServerNetworkAttachmentByPci 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 lifecycle state of the bare metal server network attachment. - LifecycleState *string `json:"lifecycle_state" 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 port speed for this bare metal server network attachment in Mbps. - PortSpeed *int64 `json:"port_speed" 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 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 bare metal server network attachment type. - Type *string `json:"type" validate:"required"` - - // The virtual network interface for this bare metal server network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` - - // The VLAN IDs allowed for `vlan` attachments using this PCI attachment. - AllowedVlans []int64 `json:"allowed_vlans" validate:"required"` - - // - `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. - InterfaceType *string `json:"interface_type" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkAttachmentByPci.LifecycleState property. -// The lifecycle state of the bare metal server network attachment. -const ( - BareMetalServerNetworkAttachmentByPciLifecycleStateDeletingConst = "deleting" - BareMetalServerNetworkAttachmentByPciLifecycleStateFailedConst = "failed" - BareMetalServerNetworkAttachmentByPciLifecycleStatePendingConst = "pending" - BareMetalServerNetworkAttachmentByPciLifecycleStateStableConst = "stable" - BareMetalServerNetworkAttachmentByPciLifecycleStateSuspendedConst = "suspended" - BareMetalServerNetworkAttachmentByPciLifecycleStateUpdatingConst = "updating" - BareMetalServerNetworkAttachmentByPciLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByPci.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkAttachmentByPciResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByPci.Type property. -// The bare metal server network attachment type. -const ( - BareMetalServerNetworkAttachmentByPciTypePrimaryConst = "primary" - BareMetalServerNetworkAttachmentByPciTypeSecondaryConst = "secondary" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByPci.InterfaceType property. -// - `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. -const ( - BareMetalServerNetworkAttachmentByPciInterfaceTypePciConst = "pci" -) - -func (*BareMetalServerNetworkAttachmentByPci) isaBareMetalServerNetworkAttachment() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentByPci unmarshals an instance of BareMetalServerNetworkAttachmentByPci from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentByPci(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentByPci) - 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, "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, "port_speed", &obj.PortSpeed) - if err != nil { - err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "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.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-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 - } - 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, "interface_type", &obj.InterfaceType) - if err != nil { - err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentByVlan : BareMetalServerNetworkAttachmentByVlan struct -// This model "extends" BareMetalServerNetworkAttachment -type BareMetalServerNetworkAttachmentByVlan 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 lifecycle state of the bare metal server network attachment. - LifecycleState *string `json:"lifecycle_state" 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 port speed for this bare metal server network attachment in Mbps. - PortSpeed *int64 `json:"port_speed" 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 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 bare metal server network attachment type. - Type *string `json:"type" validate:"required"` - - // The virtual network interface for this bare metal server network attachment. - VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" 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" validate:"required"` - - // - `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. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment. - Vlan *int64 `json:"vlan" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkAttachmentByVlan.LifecycleState property. -// The lifecycle state of the bare metal server network attachment. -const ( - BareMetalServerNetworkAttachmentByVlanLifecycleStateDeletingConst = "deleting" - BareMetalServerNetworkAttachmentByVlanLifecycleStateFailedConst = "failed" - BareMetalServerNetworkAttachmentByVlanLifecycleStatePendingConst = "pending" - BareMetalServerNetworkAttachmentByVlanLifecycleStateStableConst = "stable" - BareMetalServerNetworkAttachmentByVlanLifecycleStateSuspendedConst = "suspended" - BareMetalServerNetworkAttachmentByVlanLifecycleStateUpdatingConst = "updating" - BareMetalServerNetworkAttachmentByVlanLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByVlan.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkAttachmentByVlanResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByVlan.Type property. -// The bare metal server network attachment type. -const ( - BareMetalServerNetworkAttachmentByVlanTypePrimaryConst = "primary" - BareMetalServerNetworkAttachmentByVlanTypeSecondaryConst = "secondary" -) - -// Constants associated with the BareMetalServerNetworkAttachmentByVlan.InterfaceType property. -// - `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. -const ( - BareMetalServerNetworkAttachmentByVlanInterfaceTypeVlanConst = "vlan" -) - -func (*BareMetalServerNetworkAttachmentByVlan) isaBareMetalServerNetworkAttachment() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentByVlan unmarshals an instance of BareMetalServerNetworkAttachmentByVlan from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentByVlan(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentByVlan) - 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, "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, "port_speed", &obj.PortSpeed) - if err != nil { - err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "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.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-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 - } - err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) - if err != nil { - err = core.SDKErrorf(err, "", "allow_to_float-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, "vlan", &obj.Vlan) - if err != nil { - err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity struct { - // 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"` -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityIntf interface { - BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf - isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) - 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 - } - 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 -} - -// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext : The virtual network interface for this target. -// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext 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"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. - AutoDelete *bool `json:"auto_delete,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"` - - // 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"` - - // 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 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"` - - // 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 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"` -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) - 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 - } - 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.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) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct -// This model "extends" BareMetalServerNetworkAttachmentPrototype -type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype struct { - // 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"` - - 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"` - - // - `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" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype.InterfaceType property. -// - `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 ( - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototypeInterfaceTypePciConst = "pci" -) - -// NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype, err error) { - _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype{ - VirtualNetworkInterface: virtualNetworkInterface, - InterfaceType: core.StringPtr(interfaceType), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByPciPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interface-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, "interface_type", &obj.InterfaceType) - if err != nil { - err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype struct -// This model "extends" BareMetalServerNetworkAttachmentPrototype -type BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype struct { - // 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"` - - VirtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf `json:"virtual_network_interface" 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"` - - // - `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. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The IEEE 802.1Q VLAN ID that must be used for all traffic on this attachment. - Vlan *int64 `json:"vlan" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype.InterfaceType property. -// - `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. -const ( - BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototypeInterfaceTypeVlanConst = "vlan" -) - -// NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype : Instantiate BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype, err error) { - _model = &BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype{ - VirtualNetworkInterface: virtualNetworkInterface, - InterfaceType: core.StringPtr(interfaceType), - Vlan: core.Int64Ptr(vlan), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) isaBareMetalServerNetworkAttachmentPrototype() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeBareMetalServerNetworkAttachmentByVlanPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "allow_to_float", &obj.AllowToFloat) - if err != nil { - err = core.SDKErrorf(err, "", "allow_to_float-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, "vlan", &obj.Vlan) - if err != nil { - err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfaceByHiperSocket : BareMetalServerNetworkInterfaceByHiperSocket struct -// This model "extends" BareMetalServerNetworkInterface -type BareMetalServerNetworkInterfaceByHiperSocket 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 MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value - // will be an empty string. - // - // 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"` - - // - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity - // within a `s390x` based system. - InterfaceType *string `json:"interface_type" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkInterfaceByHiperSocketResourceTypeNetworkInterfaceConst = "network_interface" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.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 ( - BareMetalServerNetworkInterfaceByHiperSocketStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceByHiperSocketStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceByHiperSocketStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceByHiperSocketStatusPendingConst = "pending" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.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 ( - BareMetalServerNetworkInterfaceByHiperSocketTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceByHiperSocketTypeSecondaryConst = "secondary" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByHiperSocket.InterfaceType property. -// - `hipersocket`: a virtual network device that provides high-speed TCP/IP connectivity -// within a `s390x` based system. -const ( - BareMetalServerNetworkInterfaceByHiperSocketInterfaceTypeHipersocketConst = "hipersocket" -) - -func (*BareMetalServerNetworkInterfaceByHiperSocket) isaBareMetalServerNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkInterfaceByHiperSocket unmarshals an instance of BareMetalServerNetworkInterfaceByHiperSocket from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceByHiperSocket(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceByHiperSocket) - 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, "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) - if err != nil { - err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "floating_ips-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, "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 - } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "resource_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-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, "interface_type", &obj.InterfaceType) - if err != nil { - err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfaceByPci : BareMetalServerNetworkInterfaceByPci struct -// This model "extends" BareMetalServerNetworkInterface -type BareMetalServerNetworkInterfaceByPci 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 MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value - // will be an empty string. - // - // 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" validate:"required"` - - // - `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. - InterfaceType *string `json:"interface_type" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkInterfaceByPci.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkInterfaceByPciResourceTypeNetworkInterfaceConst = "network_interface" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByPci.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 ( - BareMetalServerNetworkInterfaceByPciStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceByPciStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceByPciStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceByPciStatusPendingConst = "pending" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByPci.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 ( - BareMetalServerNetworkInterfaceByPciTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceByPciTypeSecondaryConst = "secondary" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByPci.InterfaceType property. -// - `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. -const ( - BareMetalServerNetworkInterfaceByPciInterfaceTypePciConst = "pci" -) - -func (*BareMetalServerNetworkInterfaceByPci) isaBareMetalServerNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkInterfaceByPci unmarshals an instance of BareMetalServerNetworkInterfaceByPci from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceByPci(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceByPci) - 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, "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) - if err != nil { - err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "floating_ips-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, "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 - } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "resource_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-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, "allowed_vlans", &obj.AllowedVlans) - if err != nil { - err = core.SDKErrorf(err, "", "allowed_vlans-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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfaceByVlan : BareMetalServerNetworkInterfaceByVlan struct -// This model "extends" BareMetalServerNetworkInterface -type BareMetalServerNetworkInterfaceByVlan 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 MAC address of this bare metal server network interface. If the MAC address has not yet been selected, the value - // will be an empty string. - // - // 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"` - - // 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" validate:"required"` - - // - `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. - InterfaceType *string `json:"interface_type" validate:"required"` - - // 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" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.ResourceType property. -// The resource type. -const ( - BareMetalServerNetworkInterfaceByVlanResourceTypeNetworkInterfaceConst = "network_interface" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.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 ( - BareMetalServerNetworkInterfaceByVlanStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceByVlanStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceByVlanStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceByVlanStatusPendingConst = "pending" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.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 ( - BareMetalServerNetworkInterfaceByVlanTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceByVlanTypeSecondaryConst = "secondary" -) - -// Constants associated with the BareMetalServerNetworkInterfaceByVlan.InterfaceType property. -// - `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. -const ( - BareMetalServerNetworkInterfaceByVlanInterfaceTypeVlanConst = "vlan" -) - -func (*BareMetalServerNetworkInterfaceByVlan) isaBareMetalServerNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkInterfaceByVlan unmarshals an instance of BareMetalServerNetworkInterfaceByVlan from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceByVlan(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceByVlan) - 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, "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) - if err != nil { - err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "floating_ips-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, "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 - } - err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) - if err != nil { - err = core.SDKErrorf(err, "", "port_speed-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "resource_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) - if err != nil { - err = core.SDKErrorf(err, "", "security_groups-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, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-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, "allow_interface_to_float", &obj.AllowInterfaceToFloat) - if err != nil { - err = core.SDKErrorf(err, "", "allow_interface_to_float-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, "vlan", &obj.Vlan) - if err != nil { - err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype struct -// This model "extends" BareMetalServerNetworkInterfacePrototype -type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype 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 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"` - - // - `hipersocket`: a virtual network 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`. - InterfaceType *string `json:"interface_type" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype.InterfaceType property. -// - `hipersocket`: a virtual network 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`. -const ( - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototypeInterfaceTypeHipersocketConst = "hipersocket" -) - -// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype, err error) { - _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype{ - Subnet: subnet, - InterfaceType: core.StringPtr(interfaceType), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByHiperSocketPrototype) - 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, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - err = core.SDKErrorf(err, "", "enable_infrastructure_nat-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 - } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) - if err != nil { - err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype struct -// This model "extends" BareMetalServerNetworkInterfacePrototype -type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype 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 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"` - - // - `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" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype.InterfaceType property. -// - `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 ( - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototypeInterfaceTypePciConst = "pci" -) - -// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(subnet SubnetIdentityIntf, interfaceType string) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype, err error) { - _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype{ - Subnet: subnet, - InterfaceType: core.StringPtr(interfaceType), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) - 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, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - err = core.SDKErrorf(err, "", "enable_infrastructure_nat-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 - } - 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, "interface_type", &obj.InterfaceType) - if err != nil { - err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype struct -// This model "extends" BareMetalServerNetworkInterfacePrototype -type BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype 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 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"` - - // 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"` - - // - `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 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" validate:"required"` -} - -// Constants associated with the BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype.InterfaceType property. -// - `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 ( - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototypeInterfaceTypeVlanConst = "vlan" -) - -// NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype : Instantiate BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(subnet SubnetIdentityIntf, interfaceType string, vlan int64) (_model *BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype, err error) { - _model = &BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype{ - Subnet: subnet, - InterfaceType: core.StringPtr(interfaceType), - Vlan: core.Int64Ptr(vlan), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) isaBareMetalServerNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) - 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, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) - if err != nil { - err = core.SDKErrorf(err, "", "enable_infrastructure_nat-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 - } - err = core.UnmarshalPrimitive(m, "allow_interface_to_float", &obj.AllowInterfaceToFloat) - if err != nil { - err = core.SDKErrorf(err, "", "allow_interface_to_float-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, "vlan", &obj.Vlan) - if err != nil { - err = core.SDKErrorf(err, "", "vlan-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype : BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype struct -// This model "extends" BareMetalServerPrimaryNetworkAttachmentPrototype -type BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype struct { - // 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"` - - 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"` - - // - `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"` -} - -// Constants associated with the BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype.InterfaceType property. -// - `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 ( - BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototypeInterfaceTypePciConst = "pci" -) - -// NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype : Instantiate BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype(virtualNetworkInterface BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf) (_model *BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype, err error) { - _model = &BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype{ - VirtualNetworkInterface: virtualNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) isaBareMetalServerPrimaryNetworkAttachmentPrototype() bool { - return true -} - -// UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype unmarshals an instance of BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrimaryNetworkAttachmentPrototypeBareMetalServerPrimaryNetworkAttachmentByPciPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interface-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, "interface_type", &obj.InterfaceType) - if err != nil { - err = core.SDKErrorf(err, "", "interface_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileBandwidthDependent : The total bandwidth shared across the bare metal server network attachments or bare metal server network interfaces -// of a bare metal server with this profile depends on its configuration. -// This model "extends" BareMetalServerProfileBandwidth -type BareMetalServerProfileBandwidthDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileBandwidthDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileBandwidthDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileBandwidthDependent) isaBareMetalServerProfileBandwidth() bool { - return true -} - -// UnmarshalBareMetalServerProfileBandwidthDependent unmarshals an instance of BareMetalServerProfileBandwidthDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileBandwidthDependent) - 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 -} - -// BareMetalServerProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the bare metal server network attachments -// or bare metal server network interfaces of a bare metal server with this profile. -// This model "extends" BareMetalServerProfileBandwidth -type BareMetalServerProfileBandwidthEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 BareMetalServerProfileBandwidthEnum.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileBandwidthEnumTypeEnumConst = "enum" -) - -func (*BareMetalServerProfileBandwidthEnum) isaBareMetalServerProfileBandwidth() bool { - return true -} - -// UnmarshalBareMetalServerProfileBandwidthEnum unmarshals an instance of BareMetalServerProfileBandwidthEnum from the specified map of raw messages. -func UnmarshalBareMetalServerProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileBandwidthEnum) - 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 -} - -// BareMetalServerProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the bare metal server network attachments or bare metal -// server network interfaces of a bare metal server with this profile. -// This model "extends" BareMetalServerProfileBandwidth -type BareMetalServerProfileBandwidthFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileBandwidthFixed.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileBandwidthFixedTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileBandwidthFixed) isaBareMetalServerProfileBandwidth() bool { - return true -} - -// UnmarshalBareMetalServerProfileBandwidthFixed unmarshals an instance of BareMetalServerProfileBandwidthFixed from the specified map of raw messages. -func UnmarshalBareMetalServerProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileBandwidthFixed) - 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 -} - -// BareMetalServerProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network attachments or network -// interfaces of a bare metal server with this profile. -// This model "extends" BareMetalServerProfileBandwidth -type BareMetalServerProfileBandwidthRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileBandwidthRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileBandwidthRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileBandwidthRange) isaBareMetalServerProfileBandwidth() bool { - return true -} - -// UnmarshalBareMetalServerProfileBandwidthRange unmarshals an instance of BareMetalServerProfileBandwidthRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileBandwidthRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCpuCoreCountDependent : The CPU core count for a bare metal server with this profile depends on its configuration. -// This model "extends" BareMetalServerProfileCpuCoreCount -type BareMetalServerProfileCpuCoreCountDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuCoreCountDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuCoreCountDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileCpuCoreCountDependent) isaBareMetalServerProfileCpuCoreCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuCoreCountDependent unmarshals an instance of BareMetalServerProfileCpuCoreCountDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuCoreCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuCoreCountDependent) - 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 -} - -// BareMetalServerProfileCpuCoreCountEnum : The permitted values for CPU cores for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileCpuCoreCount -type BareMetalServerProfileCpuCoreCountEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 BareMetalServerProfileCpuCoreCountEnum.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuCoreCountEnumTypeEnumConst = "enum" -) - -func (*BareMetalServerProfileCpuCoreCountEnum) isaBareMetalServerProfileCpuCoreCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuCoreCountEnum unmarshals an instance of BareMetalServerProfileCpuCoreCountEnum from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuCoreCountEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuCoreCountEnum) - 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 -} - -// BareMetalServerProfileCpuCoreCountFixed : The CPU core count for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileCpuCoreCount -type BareMetalServerProfileCpuCoreCountFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuCoreCountFixed.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuCoreCountFixedTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileCpuCoreCountFixed) isaBareMetalServerProfileCpuCoreCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuCoreCountFixed unmarshals an instance of BareMetalServerProfileCpuCoreCountFixed from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuCoreCountFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuCoreCountFixed) - 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 -} - -// BareMetalServerProfileCpuCoreCountRange : The permitted range for the number of CPU cores for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileCpuCoreCount -type BareMetalServerProfileCpuCoreCountRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuCoreCountRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuCoreCountRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileCpuCoreCountRange) isaBareMetalServerProfileCpuCoreCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuCoreCountRange unmarshals an instance of BareMetalServerProfileCpuCoreCountRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuCoreCountRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuCoreCountRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileCpuSocketCountDependent : The CPU socket count for a bare metal server with this profile depends on its configuration. -// This model "extends" BareMetalServerProfileCpuSocketCount -type BareMetalServerProfileCpuSocketCountDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuSocketCountDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuSocketCountDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileCpuSocketCountDependent) isaBareMetalServerProfileCpuSocketCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuSocketCountDependent unmarshals an instance of BareMetalServerProfileCpuSocketCountDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuSocketCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuSocketCountDependent) - 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 -} - -// BareMetalServerProfileCpuSocketCountEnum : The permitted values for CPU sockets for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileCpuSocketCount -type BareMetalServerProfileCpuSocketCountEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 BareMetalServerProfileCpuSocketCountEnum.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuSocketCountEnumTypeEnumConst = "enum" -) - -func (*BareMetalServerProfileCpuSocketCountEnum) isaBareMetalServerProfileCpuSocketCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuSocketCountEnum unmarshals an instance of BareMetalServerProfileCpuSocketCountEnum from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuSocketCountEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuSocketCountEnum) - 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 -} - -// BareMetalServerProfileCpuSocketCountFixed : The number of CPU sockets for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileCpuSocketCount -type BareMetalServerProfileCpuSocketCountFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuSocketCountFixed.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuSocketCountFixedTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileCpuSocketCountFixed) isaBareMetalServerProfileCpuSocketCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuSocketCountFixed unmarshals an instance of BareMetalServerProfileCpuSocketCountFixed from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuSocketCountFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuSocketCountFixed) - 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 -} - -// BareMetalServerProfileCpuSocketCountRange : The permitted range for the number of CPU sockets for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileCpuSocketCount -type BareMetalServerProfileCpuSocketCountRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileCpuSocketCountRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuSocketCountRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileCpuSocketCountRange) isaBareMetalServerProfileCpuSocketCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileCpuSocketCountRange unmarshals an instance of BareMetalServerProfileCpuSocketCountRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileCpuSocketCountRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileCpuSocketCountRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDiskQuantityDependent : The number of disks of this configuration for a bare metal server with this profile depends on its bare metal server -// configuration. -// This model "extends" BareMetalServerProfileDiskQuantity -type BareMetalServerProfileDiskQuantityDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskQuantityDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskQuantityDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileDiskQuantityDependent) isaBareMetalServerProfileDiskQuantity() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskQuantityDependent unmarshals an instance of BareMetalServerProfileDiskQuantityDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskQuantityDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskQuantityDependent) - 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 -} - -// BareMetalServerProfileDiskQuantityEnum : The permitted the number of disks of this configuration for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileDiskQuantity -type BareMetalServerProfileDiskQuantityEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 BareMetalServerProfileDiskQuantityEnum.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskQuantityEnumTypeEnumConst = "enum" -) - -func (*BareMetalServerProfileDiskQuantityEnum) isaBareMetalServerProfileDiskQuantity() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskQuantityEnum unmarshals an instance of BareMetalServerProfileDiskQuantityEnum from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskQuantityEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskQuantityEnum) - 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 -} - -// BareMetalServerProfileDiskQuantityFixed : The number of disks of this configuration for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileDiskQuantity -type BareMetalServerProfileDiskQuantityFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskQuantityFixed.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskQuantityFixedTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileDiskQuantityFixed) isaBareMetalServerProfileDiskQuantity() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskQuantityFixed unmarshals an instance of BareMetalServerProfileDiskQuantityFixed from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskQuantityFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskQuantityFixed) - 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 -} - -// BareMetalServerProfileDiskQuantityRange : The permitted range for the number of disks of this configuration for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileDiskQuantity -type BareMetalServerProfileDiskQuantityRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskQuantityRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskQuantityRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileDiskQuantityRange) isaBareMetalServerProfileDiskQuantity() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskQuantityRange unmarshals an instance of BareMetalServerProfileDiskQuantityRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskQuantityRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskQuantityRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileDiskSizeDependent : The disk size in GB (gigabytes) of this configuration for a bare metal server with this profile depends on its bare -// metal server configuration. -// This model "extends" BareMetalServerProfileDiskSize -type BareMetalServerProfileDiskSizeDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskSizeDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskSizeDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileDiskSizeDependent) isaBareMetalServerProfileDiskSize() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskSizeDependent unmarshals an instance of BareMetalServerProfileDiskSizeDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskSizeDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskSizeDependent) - 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 -} - -// BareMetalServerProfileDiskSizeEnum : The permitted disk size in GB (gigabytes) of this configuration for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileDiskSize -type BareMetalServerProfileDiskSizeEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 BareMetalServerProfileDiskSizeEnum.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskSizeEnumTypeEnumConst = "enum" -) - -func (*BareMetalServerProfileDiskSizeEnum) isaBareMetalServerProfileDiskSize() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskSizeEnum unmarshals an instance of BareMetalServerProfileDiskSizeEnum from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskSizeEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskSizeEnum) - 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 -} - -// BareMetalServerProfileDiskSizeFixed : The size of the disk in GB (gigabytes). -// This model "extends" BareMetalServerProfileDiskSize -type BareMetalServerProfileDiskSizeFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskSizeFixed.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskSizeFixedTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileDiskSizeFixed) isaBareMetalServerProfileDiskSize() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskSizeFixed unmarshals an instance of BareMetalServerProfileDiskSizeFixed from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskSizeFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskSizeFixed) - 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 -} - -// BareMetalServerProfileDiskSizeRange : The permitted range for the disk size of this configuration in GB (gigabytes) for a bare metal server with this -// profile. -// This model "extends" BareMetalServerProfileDiskSize -type BareMetalServerProfileDiskSizeRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileDiskSizeRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileDiskSizeRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileDiskSizeRange) isaBareMetalServerProfileDiskSize() bool { - return true -} - -// UnmarshalBareMetalServerProfileDiskSizeRange unmarshals an instance of BareMetalServerProfileDiskSizeRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileDiskSizeRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileDiskSizeRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileIdentityByHref : BareMetalServerProfileIdentityByHref struct -// This model "extends" BareMetalServerProfileIdentity -type BareMetalServerProfileIdentityByHref struct { - // The URL for this bare metal server profile. - Href *string `json:"href" validate:"required"` -} - -// NewBareMetalServerProfileIdentityByHref : Instantiate BareMetalServerProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerProfileIdentityByHref(href string) (_model *BareMetalServerProfileIdentityByHref, err error) { - _model = &BareMetalServerProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerProfileIdentityByHref) isaBareMetalServerProfileIdentity() bool { - return true -} - -// UnmarshalBareMetalServerProfileIdentityByHref unmarshals an instance of BareMetalServerProfileIdentityByHref from the specified map of raw messages. -func UnmarshalBareMetalServerProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileIdentityByHref) - 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 -} - -// BareMetalServerProfileIdentityByName : BareMetalServerProfileIdentityByName struct -// This model "extends" BareMetalServerProfileIdentity -type BareMetalServerProfileIdentityByName struct { - // The name for this bare metal server profile. - Name *string `json:"name" validate:"required"` -} - -// NewBareMetalServerProfileIdentityByName : Instantiate BareMetalServerProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerProfileIdentityByName(name string) (_model *BareMetalServerProfileIdentityByName, err error) { - _model = &BareMetalServerProfileIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerProfileIdentityByName) isaBareMetalServerProfileIdentity() bool { - return true -} - -// UnmarshalBareMetalServerProfileIdentityByName unmarshals an instance of BareMetalServerProfileIdentityByName from the specified map of raw messages. -func UnmarshalBareMetalServerProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileIdentityByName) - 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 -} - -// BareMetalServerProfileMemoryDependent : The memory value for a bare metal server with this profile depends on its configuration. -// This model "extends" BareMetalServerProfileMemory -type BareMetalServerProfileMemoryDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileMemoryDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileMemoryDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileMemoryDependent) isaBareMetalServerProfileMemory() bool { - return true -} - -// UnmarshalBareMetalServerProfileMemoryDependent unmarshals an instance of BareMetalServerProfileMemoryDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileMemoryDependent) - 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 -} - -// BareMetalServerProfileMemoryEnum : The permitted memory values (in gibibytes) for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileMemory -type BareMetalServerProfileMemoryEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 BareMetalServerProfileMemoryEnum.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileMemoryEnumTypeEnumConst = "enum" -) - -func (*BareMetalServerProfileMemoryEnum) isaBareMetalServerProfileMemory() bool { - return true -} - -// UnmarshalBareMetalServerProfileMemoryEnum unmarshals an instance of BareMetalServerProfileMemoryEnum from the specified map of raw messages. -func UnmarshalBareMetalServerProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileMemoryEnum) - 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 -} - -// BareMetalServerProfileMemoryFixed : The memory (in gibibytes) for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileMemory -type BareMetalServerProfileMemoryFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileMemoryFixed.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileMemoryFixedTypeFixedConst = "fixed" -) - -func (*BareMetalServerProfileMemoryFixed) isaBareMetalServerProfileMemory() bool { - return true -} - -// UnmarshalBareMetalServerProfileMemoryFixed unmarshals an instance of BareMetalServerProfileMemoryFixed from the specified map of raw messages. -func UnmarshalBareMetalServerProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileMemoryFixed) - 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 -} - -// BareMetalServerProfileMemoryRange : The permitted memory range (in gibibytes) for a bare metal server with this profile. -// This model "extends" BareMetalServerProfileMemory -type BareMetalServerProfileMemoryRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileMemoryRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileMemoryRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileMemoryRange) isaBareMetalServerProfileMemory() bool { - return true -} - -// UnmarshalBareMetalServerProfileMemoryRange unmarshals an instance of BareMetalServerProfileMemoryRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileMemoryRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileNetworkAttachmentCountDependent : The number of network attachments supported on a bare metal server with this profile is dependent on its -// configuration. -// This model "extends" BareMetalServerProfileNetworkAttachmentCount -type BareMetalServerProfileNetworkAttachmentCountDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileNetworkAttachmentCountDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileNetworkAttachmentCountDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileNetworkAttachmentCountDependent) isaBareMetalServerProfileNetworkAttachmentCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileNetworkAttachmentCountDependent unmarshals an instance of BareMetalServerProfileNetworkAttachmentCountDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileNetworkAttachmentCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileNetworkAttachmentCountDependent) - 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 -} - -// BareMetalServerProfileNetworkAttachmentCountRange : The number of network attachments supported on a bare metal server with this profile. -// This model "extends" BareMetalServerProfileNetworkAttachmentCount -type BareMetalServerProfileNetworkAttachmentCountRange 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" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileNetworkAttachmentCountRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileNetworkAttachmentCountRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileNetworkAttachmentCountRange) isaBareMetalServerProfileNetworkAttachmentCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileNetworkAttachmentCountRange unmarshals an instance of BareMetalServerProfileNetworkAttachmentCountRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileNetworkAttachmentCountRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileNetworkAttachmentCountRange) - 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) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerProfileNetworkInterfaceCountDependent : The number of bare metal server network interfaces supported on a bare metal server with this profile is dependent on -// its configuration. -// This model "extends" BareMetalServerProfileNetworkInterfaceCount -type BareMetalServerProfileNetworkInterfaceCountDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileNetworkInterfaceCountDependent.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileNetworkInterfaceCountDependentTypeDependentConst = "dependent" -) - -func (*BareMetalServerProfileNetworkInterfaceCountDependent) isaBareMetalServerProfileNetworkInterfaceCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileNetworkInterfaceCountDependent unmarshals an instance of BareMetalServerProfileNetworkInterfaceCountDependent from the specified map of raw messages. -func UnmarshalBareMetalServerProfileNetworkInterfaceCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileNetworkInterfaceCountDependent) - 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 -} - -// BareMetalServerProfileNetworkInterfaceCountRange : The number of bare metal server network interfaces supported on a bare metal server with this profile. -// This model "extends" BareMetalServerProfileNetworkInterfaceCount -type BareMetalServerProfileNetworkInterfaceCountRange 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" validate:"required"` -} - -// Constants associated with the BareMetalServerProfileNetworkInterfaceCountRange.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileNetworkInterfaceCountRangeTypeRangeConst = "range" -) - -func (*BareMetalServerProfileNetworkInterfaceCountRange) isaBareMetalServerProfileNetworkInterfaceCount() bool { - return true -} - -// UnmarshalBareMetalServerProfileNetworkInterfaceCountRange unmarshals an instance of BareMetalServerProfileNetworkInterfaceCountRange from the specified map of raw messages. -func UnmarshalBareMetalServerProfileNetworkInterfaceCountRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerProfileNetworkInterfaceCountRange) - 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) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPrototypeBareMetalServerByNetworkAttachment : BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct -// This model "extends" BareMetalServerPrototype -type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { - // 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"` - - 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" validate:"required"` -} - -// NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment : Instantiate BareMetalServerPrototypeBareMetalServerByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkAttachment(initialization *BareMetalServerInitializationPrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf) (_model *BareMetalServerPrototypeBareMetalServerByNetworkAttachment, err error) { - _model = &BareMetalServerPrototypeBareMetalServerByNetworkAttachment{ - Initialization: initialization, - Profile: profile, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerPrototypeBareMetalServerByNetworkAttachment) isaBareMetalServerPrototype() bool { - return true -} - -// UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment unmarshals an instance of BareMetalServerPrototypeBareMetalServerByNetworkAttachment from the specified map of raw messages. -func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrototypeBareMetalServerByNetworkAttachment) - err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) - if err != nil { - err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "initialization-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, "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) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerPrototypeBareMetalServerByNetworkInterface : BareMetalServerPrototypeBareMetalServerByNetworkInterface struct -// This model "extends" BareMetalServerPrototype -type BareMetalServerPrototypeBareMetalServerByNetworkInterface struct { - // 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"` - - 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 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" validate:"required"` -} - -// NewBareMetalServerPrototypeBareMetalServerByNetworkInterface : Instantiate BareMetalServerPrototypeBareMetalServerByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerPrototypeBareMetalServerByNetworkInterface(initialization *BareMetalServerInitializationPrototype, profile BareMetalServerProfileIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype) (_model *BareMetalServerPrototypeBareMetalServerByNetworkInterface, err error) { - _model = &BareMetalServerPrototypeBareMetalServerByNetworkInterface{ - Initialization: initialization, - Profile: profile, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerPrototypeBareMetalServerByNetworkInterface) isaBareMetalServerPrototype() bool { - return true -} - -// UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface unmarshals an instance of BareMetalServerPrototypeBareMetalServerByNetworkInterface from the specified map of raw messages. -func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPrototypeBareMetalServerByNetworkInterface) - err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) - if err != nil { - err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "initialization-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, "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) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CatalogOfferingIdentityCatalogOfferingByCRN : CatalogOfferingIdentityCatalogOfferingByCRN struct -// This model "extends" CatalogOfferingIdentity -type CatalogOfferingIdentityCatalogOfferingByCRN struct { - // The CRN for this - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering. - CRN *string `json:"crn" validate:"required"` -} - -// NewCatalogOfferingIdentityCatalogOfferingByCRN : Instantiate CatalogOfferingIdentityCatalogOfferingByCRN (Generic Model Constructor) -func (*VpcV1) NewCatalogOfferingIdentityCatalogOfferingByCRN(crn string) (_model *CatalogOfferingIdentityCatalogOfferingByCRN, err error) { - _model = &CatalogOfferingIdentityCatalogOfferingByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*CatalogOfferingIdentityCatalogOfferingByCRN) isaCatalogOfferingIdentity() bool { - return true -} - -// UnmarshalCatalogOfferingIdentityCatalogOfferingByCRN unmarshals an instance of CatalogOfferingIdentityCatalogOfferingByCRN from the specified map of raw messages. -func UnmarshalCatalogOfferingIdentityCatalogOfferingByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingIdentityCatalogOfferingByCRN) - 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 -} - -// CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN : CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN struct -// This model "extends" CatalogOfferingVersionIdentity -type CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN 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"` -} - -// NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN : Instantiate CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN (Generic Model Constructor) -func (*VpcV1) NewCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(crn string) (_model *CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN, err error) { - _model = &CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN) isaCatalogOfferingVersionIdentity() bool { - return true -} - -// UnmarshalCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN unmarshals an instance of CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN from the specified map of raw messages. -func UnmarshalCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingVersionIdentityCatalogOfferingVersionByCRN) - 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 -} - -// CertificateInstanceIdentityByCRN : CertificateInstanceIdentityByCRN struct -// This model "extends" CertificateInstanceIdentity -type CertificateInstanceIdentityByCRN struct { - // The CRN for this certificate instance. - CRN *string `json:"crn" validate:"required"` -} - -// NewCertificateInstanceIdentityByCRN : Instantiate CertificateInstanceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewCertificateInstanceIdentityByCRN(crn string) (_model *CertificateInstanceIdentityByCRN, err error) { - _model = &CertificateInstanceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*CertificateInstanceIdentityByCRN) isaCertificateInstanceIdentity() bool { - return true -} - -// UnmarshalCertificateInstanceIdentityByCRN unmarshals an instance of CertificateInstanceIdentityByCRN from the specified map of raw messages. -func UnmarshalCertificateInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CertificateInstanceIdentityByCRN) - 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 -} - -// CloudObjectStorageBucketIdentityByCRN : CloudObjectStorageBucketIdentityByCRN struct -// This model "extends" CloudObjectStorageBucketIdentity -type CloudObjectStorageBucketIdentityByCRN struct { - // The CRN of this Cloud Object Storage bucket. - CRN *string `json:"crn" validate:"required"` -} - -// NewCloudObjectStorageBucketIdentityByCRN : Instantiate CloudObjectStorageBucketIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewCloudObjectStorageBucketIdentityByCRN(crn string) (_model *CloudObjectStorageBucketIdentityByCRN, err error) { - _model = &CloudObjectStorageBucketIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*CloudObjectStorageBucketIdentityByCRN) isaCloudObjectStorageBucketIdentity() bool { - return true -} - -// UnmarshalCloudObjectStorageBucketIdentityByCRN unmarshals an instance of CloudObjectStorageBucketIdentityByCRN from the specified map of raw messages. -func UnmarshalCloudObjectStorageBucketIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CloudObjectStorageBucketIdentityByCRN) - 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 -} - -// CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct -// This model "extends" CloudObjectStorageBucketIdentity -type CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct { - // The globally unique name of this Cloud Object Storage bucket. - Name *string `json:"name" validate:"required"` -} - -// NewCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : Instantiate CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName (Generic Model Constructor) -func (*VpcV1) NewCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(name string) (_model *CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName, err error) { - _model = &CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) isaCloudObjectStorageBucketIdentity() bool { - return true -} - -// UnmarshalCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName unmarshals an instance of CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName from the specified map of raw messages. -func UnmarshalCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) - 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 -} - -// DnsInstanceIdentityByCRN : DnsInstanceIdentityByCRN struct -// This model "extends" DnsInstanceIdentity -type DnsInstanceIdentityByCRN struct { - // The CRN for this DNS instance. - CRN *string `json:"crn" validate:"required"` -} - -// NewDnsInstanceIdentityByCRN : Instantiate DnsInstanceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewDnsInstanceIdentityByCRN(crn string) (_model *DnsInstanceIdentityByCRN, err error) { - _model = &DnsInstanceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*DnsInstanceIdentityByCRN) isaDnsInstanceIdentity() bool { - return true -} - -// UnmarshalDnsInstanceIdentityByCRN unmarshals an instance of DnsInstanceIdentityByCRN from the specified map of raw messages. -func UnmarshalDnsInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsInstanceIdentityByCRN) - 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 -} - -// DnsZoneIdentityByID : DnsZoneIdentityByID struct -// This model "extends" DnsZoneIdentity -type DnsZoneIdentityByID struct { - ID *string `json:"id" validate:"required"` -} - -// NewDnsZoneIdentityByID : Instantiate DnsZoneIdentityByID (Generic Model Constructor) -func (*VpcV1) NewDnsZoneIdentityByID(id string) (_model *DnsZoneIdentityByID, err error) { - _model = &DnsZoneIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*DnsZoneIdentityByID) isaDnsZoneIdentity() bool { - return true -} - -// UnmarshalDnsZoneIdentityByID unmarshals an instance of DnsZoneIdentityByID from the specified map of raw messages. -func UnmarshalDnsZoneIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsZoneIdentityByID) - 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 -} - -// DedicatedHostGroupIdentityByCRN : DedicatedHostGroupIdentityByCRN struct -// This model "extends" DedicatedHostGroupIdentity -type DedicatedHostGroupIdentityByCRN struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` -} - -// NewDedicatedHostGroupIdentityByCRN : Instantiate DedicatedHostGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewDedicatedHostGroupIdentityByCRN(crn string) (_model *DedicatedHostGroupIdentityByCRN, err error) { - _model = &DedicatedHostGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*DedicatedHostGroupIdentityByCRN) isaDedicatedHostGroupIdentity() bool { - return true -} - -// UnmarshalDedicatedHostGroupIdentityByCRN unmarshals an instance of DedicatedHostGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupIdentityByCRN) - 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 -} - -// DedicatedHostGroupIdentityByHref : DedicatedHostGroupIdentityByHref struct -// This model "extends" DedicatedHostGroupIdentity -type DedicatedHostGroupIdentityByHref struct { - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` -} - -// NewDedicatedHostGroupIdentityByHref : Instantiate DedicatedHostGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewDedicatedHostGroupIdentityByHref(href string) (_model *DedicatedHostGroupIdentityByHref, err error) { - _model = &DedicatedHostGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*DedicatedHostGroupIdentityByHref) isaDedicatedHostGroupIdentity() bool { - return true -} - -// UnmarshalDedicatedHostGroupIdentityByHref unmarshals an instance of DedicatedHostGroupIdentityByHref from the specified map of raw messages. -func UnmarshalDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupIdentityByHref) - 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 -} - -// DedicatedHostGroupIdentityByID : DedicatedHostGroupIdentityByID struct -// This model "extends" DedicatedHostGroupIdentity -type DedicatedHostGroupIdentityByID struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` -} - -// NewDedicatedHostGroupIdentityByID : Instantiate DedicatedHostGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewDedicatedHostGroupIdentityByID(id string) (_model *DedicatedHostGroupIdentityByID, err error) { - _model = &DedicatedHostGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*DedicatedHostGroupIdentityByID) isaDedicatedHostGroupIdentity() bool { - return true -} - -// UnmarshalDedicatedHostGroupIdentityByID unmarshals an instance of DedicatedHostGroupIdentityByID from the specified map of raw messages. -func UnmarshalDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupIdentityByID) - 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 -} - -// DedicatedHostProfileIdentityByHref : DedicatedHostProfileIdentityByHref struct -// This model "extends" DedicatedHostProfileIdentity -type DedicatedHostProfileIdentityByHref struct { - // The URL for this dedicated host profile. - Href *string `json:"href" validate:"required"` -} - -// NewDedicatedHostProfileIdentityByHref : Instantiate DedicatedHostProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewDedicatedHostProfileIdentityByHref(href string) (_model *DedicatedHostProfileIdentityByHref, err error) { - _model = &DedicatedHostProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*DedicatedHostProfileIdentityByHref) isaDedicatedHostProfileIdentity() bool { - return true -} - -// UnmarshalDedicatedHostProfileIdentityByHref unmarshals an instance of DedicatedHostProfileIdentityByHref from the specified map of raw messages. -func UnmarshalDedicatedHostProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileIdentityByHref) - 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 -} - -// DedicatedHostProfileIdentityByName : DedicatedHostProfileIdentityByName struct -// This model "extends" DedicatedHostProfileIdentity -type DedicatedHostProfileIdentityByName struct { - // The globally unique name for this dedicated host profile. - Name *string `json:"name" validate:"required"` -} - -// NewDedicatedHostProfileIdentityByName : Instantiate DedicatedHostProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewDedicatedHostProfileIdentityByName(name string) (_model *DedicatedHostProfileIdentityByName, err error) { - _model = &DedicatedHostProfileIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*DedicatedHostProfileIdentityByName) isaDedicatedHostProfileIdentity() bool { - return true -} - -// UnmarshalDedicatedHostProfileIdentityByName unmarshals an instance of DedicatedHostProfileIdentityByName from the specified map of raw messages. -func UnmarshalDedicatedHostProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileIdentityByName) - 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 -} - -// DedicatedHostProfileMemoryDependent : The memory value for a dedicated host with this profile depends on its configuration. -// This model "extends" DedicatedHostProfileMemory -type DedicatedHostProfileMemoryDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileMemoryDependent.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileMemoryDependentTypeDependentConst = "dependent" -) - -func (*DedicatedHostProfileMemoryDependent) isaDedicatedHostProfileMemory() bool { - return true -} - -// UnmarshalDedicatedHostProfileMemoryDependent unmarshals an instance of DedicatedHostProfileMemoryDependent from the specified map of raw messages. -func UnmarshalDedicatedHostProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileMemoryDependent) - 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 -} - -// DedicatedHostProfileMemoryEnum : The permitted memory values (in gibibytes) for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileMemory -type DedicatedHostProfileMemoryEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 DedicatedHostProfileMemoryEnum.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileMemoryEnumTypeEnumConst = "enum" -) - -func (*DedicatedHostProfileMemoryEnum) isaDedicatedHostProfileMemory() bool { - return true -} - -// UnmarshalDedicatedHostProfileMemoryEnum unmarshals an instance of DedicatedHostProfileMemoryEnum from the specified map of raw messages. -func UnmarshalDedicatedHostProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileMemoryEnum) - 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 -} - -// DedicatedHostProfileMemoryFixed : The memory (in gibibytes) for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileMemory -type DedicatedHostProfileMemoryFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileMemoryFixed.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileMemoryFixedTypeFixedConst = "fixed" -) - -func (*DedicatedHostProfileMemoryFixed) isaDedicatedHostProfileMemory() bool { - return true -} - -// UnmarshalDedicatedHostProfileMemoryFixed unmarshals an instance of DedicatedHostProfileMemoryFixed from the specified map of raw messages. -func UnmarshalDedicatedHostProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileMemoryFixed) - 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 -} - -// DedicatedHostProfileMemoryRange : The permitted memory range (in gibibytes) for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileMemory -type DedicatedHostProfileMemoryRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileMemoryRange.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileMemoryRangeTypeRangeConst = "range" -) - -func (*DedicatedHostProfileMemoryRange) isaDedicatedHostProfileMemory() bool { - return true -} - -// UnmarshalDedicatedHostProfileMemoryRange unmarshals an instance of DedicatedHostProfileMemoryRange from the specified map of raw messages. -func UnmarshalDedicatedHostProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileMemoryRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileSocketDependent : The CPU socket count for a dedicated host with this profile depends on its configuration. -// This model "extends" DedicatedHostProfileSocket -type DedicatedHostProfileSocketDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileSocketDependent.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileSocketDependentTypeDependentConst = "dependent" -) - -func (*DedicatedHostProfileSocketDependent) isaDedicatedHostProfileSocket() bool { - return true -} - -// UnmarshalDedicatedHostProfileSocketDependent unmarshals an instance of DedicatedHostProfileSocketDependent from the specified map of raw messages. -func UnmarshalDedicatedHostProfileSocketDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileSocketDependent) - 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 -} - -// DedicatedHostProfileSocketEnum : The permitted values for CPU socket count for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileSocket -type DedicatedHostProfileSocketEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 DedicatedHostProfileSocketEnum.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileSocketEnumTypeEnumConst = "enum" -) - -func (*DedicatedHostProfileSocketEnum) isaDedicatedHostProfileSocket() bool { - return true -} - -// UnmarshalDedicatedHostProfileSocketEnum unmarshals an instance of DedicatedHostProfileSocketEnum from the specified map of raw messages. -func UnmarshalDedicatedHostProfileSocketEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileSocketEnum) - 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 -} - -// DedicatedHostProfileSocketFixed : The CPU socket count for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileSocket -type DedicatedHostProfileSocketFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileSocketFixed.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileSocketFixedTypeFixedConst = "fixed" -) - -func (*DedicatedHostProfileSocketFixed) isaDedicatedHostProfileSocket() bool { - return true -} - -// UnmarshalDedicatedHostProfileSocketFixed unmarshals an instance of DedicatedHostProfileSocketFixed from the specified map of raw messages. -func UnmarshalDedicatedHostProfileSocketFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileSocketFixed) - 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 -} - -// DedicatedHostProfileSocketRange : The permitted range for CPU socket count for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileSocket -type DedicatedHostProfileSocketRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileSocketRange.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileSocketRangeTypeRangeConst = "range" -) - -func (*DedicatedHostProfileSocketRange) isaDedicatedHostProfileSocket() bool { - return true -} - -// UnmarshalDedicatedHostProfileSocketRange unmarshals an instance of DedicatedHostProfileSocketRange from the specified map of raw messages. -func UnmarshalDedicatedHostProfileSocketRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileSocketRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostProfileVcpuDependent : The VCPU count for a dedicated host with this profile depends on its configuration. -// This model "extends" DedicatedHostProfileVcpu -type DedicatedHostProfileVcpuDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileVcpuDependent.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileVcpuDependentTypeDependentConst = "dependent" -) - -func (*DedicatedHostProfileVcpuDependent) isaDedicatedHostProfileVcpu() bool { - return true -} - -// UnmarshalDedicatedHostProfileVcpuDependent unmarshals an instance of DedicatedHostProfileVcpuDependent from the specified map of raw messages. -func UnmarshalDedicatedHostProfileVcpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileVcpuDependent) - 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 -} - -// DedicatedHostProfileVcpuEnum : The permitted values for VCPU count for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileVcpu -type DedicatedHostProfileVcpuEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 DedicatedHostProfileVcpuEnum.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileVcpuEnumTypeEnumConst = "enum" -) - -func (*DedicatedHostProfileVcpuEnum) isaDedicatedHostProfileVcpu() bool { - return true -} - -// UnmarshalDedicatedHostProfileVcpuEnum unmarshals an instance of DedicatedHostProfileVcpuEnum from the specified map of raw messages. -func UnmarshalDedicatedHostProfileVcpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileVcpuEnum) - 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 -} - -// DedicatedHostProfileVcpuFixed : The VCPU count for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileVcpu -type DedicatedHostProfileVcpuFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileVcpuFixed.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileVcpuFixedTypeFixedConst = "fixed" -) - -func (*DedicatedHostProfileVcpuFixed) isaDedicatedHostProfileVcpu() bool { - return true -} - -// UnmarshalDedicatedHostProfileVcpuFixed unmarshals an instance of DedicatedHostProfileVcpuFixed from the specified map of raw messages. -func UnmarshalDedicatedHostProfileVcpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileVcpuFixed) - 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 -} - -// DedicatedHostProfileVcpuRange : The permitted range for VCPU count for a dedicated host with this profile. -// This model "extends" DedicatedHostProfileVcpu -type DedicatedHostProfileVcpuRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the DedicatedHostProfileVcpuRange.Type property. -// The type for this profile field. -const ( - DedicatedHostProfileVcpuRangeTypeRangeConst = "range" -) - -func (*DedicatedHostProfileVcpuRange) isaDedicatedHostProfileVcpu() bool { - return true -} - -// UnmarshalDedicatedHostProfileVcpuRange unmarshals an instance of DedicatedHostProfileVcpuRange from the specified map of raw messages. -func UnmarshalDedicatedHostProfileVcpuRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostProfileVcpuRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostPrototypeDedicatedHostByGroup : DedicatedHostPrototypeDedicatedHostByGroup struct -// This model "extends" DedicatedHostPrototype -type DedicatedHostPrototypeDedicatedHostByGroup struct { - // If set to true, instances can be placed on this dedicated host. - InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` - - // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this dedicated host. - Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The dedicated host group for this dedicated host. - Group DedicatedHostGroupIdentityIntf `json:"group" validate:"required"` -} - -// NewDedicatedHostPrototypeDedicatedHostByGroup : Instantiate DedicatedHostPrototypeDedicatedHostByGroup (Generic Model Constructor) -func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByGroup(profile DedicatedHostProfileIdentityIntf, group DedicatedHostGroupIdentityIntf) (_model *DedicatedHostPrototypeDedicatedHostByGroup, err error) { - _model = &DedicatedHostPrototypeDedicatedHostByGroup{ - Profile: profile, - Group: group, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*DedicatedHostPrototypeDedicatedHostByGroup) isaDedicatedHostPrototype() bool { - return true -} - -// UnmarshalDedicatedHostPrototypeDedicatedHostByGroup unmarshals an instance of DedicatedHostPrototypeDedicatedHostByGroup from the specified map of raw messages. -func UnmarshalDedicatedHostPrototypeDedicatedHostByGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostPrototypeDedicatedHostByGroup) - err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) - if err != nil { - err = core.SDKErrorf(err, "", "instance_placement_enabled-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, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-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, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DedicatedHostPrototypeDedicatedHostByZone : DedicatedHostPrototypeDedicatedHostByZone struct -// This model "extends" DedicatedHostPrototype -type DedicatedHostPrototypeDedicatedHostByZone struct { - // If set to true, instances can be placed on this dedicated host. - InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` - - // The name for this dedicated host. The name must not be used by another dedicated host in the region. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) to use for this dedicated host. - Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - Group *DedicatedHostGroupPrototypeDedicatedHostByZoneContext `json:"group,omitempty"` - - // The zone this dedicated host will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` -} - -// NewDedicatedHostPrototypeDedicatedHostByZone : Instantiate DedicatedHostPrototypeDedicatedHostByZone (Generic Model Constructor) -func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByZone(profile DedicatedHostProfileIdentityIntf, zone ZoneIdentityIntf) (_model *DedicatedHostPrototypeDedicatedHostByZone, err error) { - _model = &DedicatedHostPrototypeDedicatedHostByZone{ - Profile: profile, - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*DedicatedHostPrototypeDedicatedHostByZone) isaDedicatedHostPrototype() bool { - return true -} - -// UnmarshalDedicatedHostPrototypeDedicatedHostByZone unmarshals an instance of DedicatedHostPrototypeDedicatedHostByZone from the specified map of raw messages. -func UnmarshalDedicatedHostPrototypeDedicatedHostByZone(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostPrototypeDedicatedHostByZone) - err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) - if err != nil { - err = core.SDKErrorf(err, "", "instance_placement_enabled-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, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-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, "group", &obj.Group, UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext) - if err != nil { - err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EncryptionKeyIdentityByCRN : EncryptionKeyIdentityByCRN struct -// This model "extends" EncryptionKeyIdentity -type EncryptionKeyIdentityByCRN struct { - // The CRN of the [Key Protect Root - // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto - // Services Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. - CRN *string `json:"crn" validate:"required"` -} - -// NewEncryptionKeyIdentityByCRN : Instantiate EncryptionKeyIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewEncryptionKeyIdentityByCRN(crn string) (_model *EncryptionKeyIdentityByCRN, err error) { - _model = &EncryptionKeyIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*EncryptionKeyIdentityByCRN) isaEncryptionKeyIdentity() bool { - return true -} - -// UnmarshalEncryptionKeyIdentityByCRN unmarshals an instance of EncryptionKeyIdentityByCRN from the specified map of raw messages. -func UnmarshalEncryptionKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EncryptionKeyIdentityByCRN) - 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 -} - -// EndpointGatewayReservedIPReservedIPIdentity : Identifies a reserved IP by a unique property. -// Models which "extend" this model: -// - EndpointGatewayReservedIPReservedIPIdentityByID -// - EndpointGatewayReservedIPReservedIPIdentityByHref -// This model "extends" EndpointGatewayReservedIP -type EndpointGatewayReservedIPReservedIPIdentity struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` -} - -func (*EndpointGatewayReservedIPReservedIPIdentity) isaEndpointGatewayReservedIPReservedIPIdentity() bool { - return true -} - -type EndpointGatewayReservedIPReservedIPIdentityIntf interface { - EndpointGatewayReservedIPIntf - isaEndpointGatewayReservedIPReservedIPIdentity() bool -} - -func (*EndpointGatewayReservedIPReservedIPIdentity) isaEndpointGatewayReservedIP() bool { - return true -} - -// UnmarshalEndpointGatewayReservedIPReservedIPIdentity unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentity from the specified map of raw messages. -func UnmarshalEndpointGatewayReservedIPReservedIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReservedIPReservedIPIdentity) - 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 -} - -// EndpointGatewayReservedIPReservedIPPrototypeTargetContext : EndpointGatewayReservedIPReservedIPPrototypeTargetContext struct -// This model "extends" EndpointGatewayReservedIP -type EndpointGatewayReservedIPReservedIPPrototypeTargetContext 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 reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the 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"` - - // The subnet in which to create this reserved IP. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` -} - -// NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext : Instantiate EndpointGatewayReservedIPReservedIPPrototypeTargetContext (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext(subnet SubnetIdentityIntf) (_model *EndpointGatewayReservedIPReservedIPPrototypeTargetContext, err error) { - _model = &EndpointGatewayReservedIPReservedIPPrototypeTargetContext{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*EndpointGatewayReservedIPReservedIPPrototypeTargetContext) isaEndpointGatewayReservedIP() bool { - return true -} - -// UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext unmarshals an instance of EndpointGatewayReservedIPReservedIPPrototypeTargetContext from the specified map of raw messages. -func UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReservedIPReservedIPPrototypeTargetContext) - 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 - } - 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 -} - -// EndpointGatewayTargetPrototypeProviderCloudServiceIdentity : EndpointGatewayTargetPrototypeProviderCloudServiceIdentity struct -// Models which "extend" this model: -// - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN -// This model "extends" EndpointGatewayTargetPrototype -type EndpointGatewayTargetPrototypeProviderCloudServiceIdentity struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` - - // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. - CRN *string `json:"crn,omitempty"` -} - -// Constants associated with the EndpointGatewayTargetPrototypeProviderCloudServiceIdentity.ResourceType property. -// The type of target for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool { - return true -} - -type EndpointGatewayTargetPrototypeProviderCloudServiceIdentityIntf interface { - EndpointGatewayTargetPrototypeIntf - isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool -} - -func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) isaEndpointGatewayTargetPrototype() bool { - return true -} - -// UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity unmarshals an instance of EndpointGatewayTargetPrototypeProviderCloudServiceIdentity from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) - 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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity : EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity struct -// Models which "extend" this model: -// - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName -// This model "extends" EndpointGatewayTargetPrototype -type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` - - // The name of a provider infrastructure service. Must be: - // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. - Name *string `json:"name,omitempty"` -} - -// Constants associated with the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity.ResourceType property. -// The type of target for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool { - return true -} - -type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityIntf interface { - EndpointGatewayTargetPrototypeIntf - isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool -} - -func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) isaEndpointGatewayTargetPrototype() bool { - return true -} - -// UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity unmarshals an instance of EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) - 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, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayTargetProviderCloudServiceReference : EndpointGatewayTargetProviderCloudServiceReference struct -// This model "extends" EndpointGatewayTarget -type EndpointGatewayTargetProviderCloudServiceReference struct { - // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. - CRN *string `json:"crn" validate:"required"` - - // The type of target. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the EndpointGatewayTargetProviderCloudServiceReference.ResourceType property. -// The type of target. -const ( - EndpointGatewayTargetProviderCloudServiceReferenceResourceTypeProviderCloudServiceConst = "provider_cloud_service" -) - -func (*EndpointGatewayTargetProviderCloudServiceReference) isaEndpointGatewayTarget() bool { - return true -} - -// UnmarshalEndpointGatewayTargetProviderCloudServiceReference unmarshals an instance of EndpointGatewayTargetProviderCloudServiceReference from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetProviderCloudServiceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetProviderCloudServiceReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-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 -} - -// EndpointGatewayTargetProviderInfrastructureServiceReference : The name of this provider infrastructure service. -// This model "extends" EndpointGatewayTarget -type EndpointGatewayTargetProviderInfrastructureServiceReference struct { - // The name of a provider infrastructure service. Must be: - // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. - Name *string `json:"name" validate:"required"` - - // The type of target. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the EndpointGatewayTargetProviderInfrastructureServiceReference.ResourceType property. -// The type of target. -const ( - EndpointGatewayTargetProviderInfrastructureServiceReferenceResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -func (*EndpointGatewayTargetProviderInfrastructureServiceReference) isaEndpointGatewayTarget() bool { - return true -} - -// UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference unmarshals an instance of EndpointGatewayTargetProviderInfrastructureServiceReference from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetProviderInfrastructureServiceReference) - 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 -} - -// FloatingIPPrototypeFloatingIPByTarget : FloatingIPPrototypeFloatingIPByTarget struct -// This model "extends" FloatingIPPrototype -type FloatingIPPrototypeFloatingIPByTarget struct { - // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // 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: - // - // - an instance network interface - // - a bare metal server network interface with `enable_infrastructure_nat` set to `true` - // - a virtual network interface with `enable_infrastructure_nat` set to `true`. - Target FloatingIPTargetPrototypeIntf `json:"target" validate:"required"` -} - -// NewFloatingIPPrototypeFloatingIPByTarget : Instantiate FloatingIPPrototypeFloatingIPByTarget (Generic Model Constructor) -func (*VpcV1) NewFloatingIPPrototypeFloatingIPByTarget(target FloatingIPTargetPrototypeIntf) (_model *FloatingIPPrototypeFloatingIPByTarget, err error) { - _model = &FloatingIPPrototypeFloatingIPByTarget{ - Target: target, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPPrototypeFloatingIPByTarget) isaFloatingIPPrototype() bool { - return true -} - -// UnmarshalFloatingIPPrototypeFloatingIPByTarget unmarshals an instance of FloatingIPPrototypeFloatingIPByTarget from the specified map of raw messages. -func UnmarshalFloatingIPPrototypeFloatingIPByTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPPrototypeFloatingIPByTarget) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "target", &obj.Target, UnmarshalFloatingIPTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPPrototypeFloatingIPByZone : FloatingIPPrototypeFloatingIPByZone struct -// This model "extends" FloatingIPPrototype -type FloatingIPPrototypeFloatingIPByZone struct { - // The name for this floating IP. The name must not be used by another floating IP in the region. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The zone this floating IP will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` -} - -// NewFloatingIPPrototypeFloatingIPByZone : Instantiate FloatingIPPrototypeFloatingIPByZone (Generic Model Constructor) -func (*VpcV1) NewFloatingIPPrototypeFloatingIPByZone(zone ZoneIdentityIntf) (_model *FloatingIPPrototypeFloatingIPByZone, err error) { - _model = &FloatingIPPrototypeFloatingIPByZone{ - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPPrototypeFloatingIPByZone) isaFloatingIPPrototype() bool { - return true -} - -// UnmarshalFloatingIPPrototypeFloatingIPByZone unmarshals an instance of FloatingIPPrototypeFloatingIPByZone from the specified map of raw messages. -func UnmarshalFloatingIPPrototypeFloatingIPByZone(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPPrototypeFloatingIPByZone) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity : Identifies a bare metal server network interface by a unique property. -// Models which "extend" this model: -// - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID -// - FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref -// This model "extends" FloatingIPTargetPatch -type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity struct { - // 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,omitempty"` - - // 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,omitempty"` -} - -func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { - return true -} - -type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityIntf interface { - FloatingIPTargetPatchIntf - isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool -} - -func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity) - 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 -} - -// FloatingIPTargetPatchNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. -// Models which "extend" this model: -// - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID -// - FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref -// This model "extends" FloatingIPTargetPatch -type FloatingIPTargetPatchNetworkInterfaceIdentity struct { - // The unique identifier for this instance network interface. - // - // If this instance 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,omitempty"` - - // The URL for this instance network interface. - // - // If this instance 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,omitempty"` -} - -func (*FloatingIPTargetPatchNetworkInterfaceIdentity) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { - return true -} - -type FloatingIPTargetPatchNetworkInterfaceIdentityIntf interface { - FloatingIPTargetPatchIntf - isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool -} - -func (*FloatingIPTargetPatchNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchNetworkInterfaceIdentity) - 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 -} - -// FloatingIPTargetPatchVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" FloatingIPTargetPatch -type FloatingIPTargetPatchVirtualNetworkInterfaceIdentity struct { - // 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"` -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { - return true -} - -type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityIntf interface { - FloatingIPTargetPatchIntf - isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentity) - 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 - } - 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 -} - -// FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity : Identifies a bare metal server network interface by a unique property. -// Models which "extend" this model: -// - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID -// - FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref -// This model "extends" FloatingIPTargetPrototype -type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity struct { - // 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,omitempty"` - - // 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,omitempty"` -} - -func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { - return true -} - -type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityIntf interface { - FloatingIPTargetPrototypeIntf - isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool -} - -func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity) - 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 -} - -// FloatingIPTargetPrototypeNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. -// Models which "extend" this model: -// - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID -// - FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref -// This model "extends" FloatingIPTargetPrototype -type FloatingIPTargetPrototypeNetworkInterfaceIdentity struct { - // The unique identifier for this instance network interface. - // - // If this instance 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,omitempty"` - - // The URL for this instance network interface. - // - // If this instance 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,omitempty"` -} - -func (*FloatingIPTargetPrototypeNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { - return true -} - -type FloatingIPTargetPrototypeNetworkInterfaceIdentityIntf interface { - FloatingIPTargetPrototypeIntf - isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool -} - -func (*FloatingIPTargetPrototypeNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentity) - 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 -} - -// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" FloatingIPTargetPrototype -type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity struct { - // 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"` -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { - FloatingIPTargetPrototypeIntf - isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity) - 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 - } - 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 -} - -// FloatingIPTargetBareMetalServerNetworkInterfaceReference : FloatingIPTargetBareMetalServerNetworkInterfaceReference struct -// This model "extends" FloatingIPTarget -type FloatingIPTargetBareMetalServerNetworkInterfaceReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BareMetalServerNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - - // 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 name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the FloatingIPTargetBareMetalServerNetworkInterfaceReference.ResourceType property. -// The resource type. -const ( - FloatingIPTargetBareMetalServerNetworkInterfaceReferenceResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*FloatingIPTargetBareMetalServerNetworkInterfaceReference) isaFloatingIPTarget() bool { - return true -} - -// UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference unmarshals an instance of FloatingIPTargetBareMetalServerNetworkInterfaceReference from the specified map of raw messages. -func UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetBareMetalServerNetworkInterfaceReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted) - 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "resource_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetNetworkInterfaceReference : FloatingIPTargetNetworkInterfaceReference struct -// This model "extends" FloatingIPTarget -type FloatingIPTargetNetworkInterfaceReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - // - // If this instance 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 instance network interface. - // - // If this instance 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 name for this instance network interface. - Name *string `json:"name" validate:"required"` - - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the FloatingIPTargetNetworkInterfaceReference.ResourceType property. -// The resource type. -const ( - FloatingIPTargetNetworkInterfaceReferenceResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*FloatingIPTargetNetworkInterfaceReference) isaFloatingIPTarget() bool { - return true -} - -// UnmarshalFloatingIPTargetNetworkInterfaceReference unmarshals an instance of FloatingIPTargetNetworkInterfaceReference from the specified map of raw messages. -func UnmarshalFloatingIPTargetNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetNetworkInterfaceReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) - 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "resource_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPublicGatewayReference : FloatingIPTargetPublicGatewayReference struct -// This model "extends" FloatingIPTarget -type FloatingIPTargetPublicGatewayReference struct { - // The CRN for this public gateway. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this public gateway. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this public gateway. - ID *string `json:"id" validate:"required"` - - // The name for this public gateway. The name is unique across all public gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the FloatingIPTargetPublicGatewayReference.ResourceType property. -// The resource type. -const ( - FloatingIPTargetPublicGatewayReferenceResourceTypePublicGatewayConst = "public_gateway" -) - -func (*FloatingIPTargetPublicGatewayReference) isaFloatingIPTarget() bool { - return true -} - -// UnmarshalFloatingIPTargetPublicGatewayReference unmarshals an instance of FloatingIPTargetPublicGatewayReference from the specified map of raw messages. -func UnmarshalFloatingIPTargetPublicGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPublicGatewayReference) - 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, UnmarshalPublicGatewayReferenceDeleted) - 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 -} - -// FloatingIPTargetVirtualNetworkInterfaceReference : FloatingIPTargetVirtualNetworkInterfaceReference struct -// This model "extends" FloatingIPTarget -type FloatingIPTargetVirtualNetworkInterfaceReference struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VirtualNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` - - // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - Name *string `json:"name" validate:"required"` - - // The primary IP for this virtual network interface. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the FloatingIPTargetVirtualNetworkInterfaceReference.ResourceType property. -// The resource type. -const ( - FloatingIPTargetVirtualNetworkInterfaceReferenceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" -) - -func (*FloatingIPTargetVirtualNetworkInterfaceReference) isaFloatingIPTarget() bool { - return true -} - -// UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference unmarshals an instance of FloatingIPTargetVirtualNetworkInterfaceReference from the specified map of raw messages. -func UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetVirtualNetworkInterfaceReference) - 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, UnmarshalVirtualNetworkInterfaceReferenceDeleted) - 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. -// Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID -// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN -// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref -// This model "extends" FlowLogCollectorTargetPrototype -type FlowLogCollectorTargetPrototypeInstanceIdentity struct { - // The unique identifier for this virtual server instance. - ID *string `json:"id,omitempty"` - - // The CRN for this virtual server instance. - CRN *string `json:"crn,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href,omitempty"` -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentity) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { - return true -} - -type FlowLogCollectorTargetPrototypeInstanceIdentityIntf interface { - FlowLogCollectorTargetPrototypeIntf - isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentity) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentity from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeInstanceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity : Identifies an instance network attachment by a unique property. -// Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID -// - FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref -// This model "extends" FlowLogCollectorTargetPrototype -type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity struct { - // The unique identifier for this instance network attachment. - ID *string `json:"id,omitempty"` - - // The URL for this instance network attachment. - Href *string `json:"href,omitempty"` -} - -func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { - return true -} - -type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityIntf interface { - FlowLogCollectorTargetPrototypeIntf - isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool -} - -func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity) - 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 -} - -// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity : Identifies an instance network interface by a unique property. -// Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID -// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref -// This model "extends" FlowLogCollectorTargetPrototype -type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity struct { - // The unique identifier for this instance network interface. - // - // If this instance 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,omitempty"` - - // The URL for this instance network interface. - // - // If this instance 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,omitempty"` -} - -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { - return true -} - -type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityIntf interface { - FlowLogCollectorTargetPrototypeIntf - isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool -} - -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) - 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 -} - -// FlowLogCollectorTargetPrototypeSubnetIdentity : Identifies a subnet by a unique property. -// Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID -// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN -// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref -// This model "extends" FlowLogCollectorTargetPrototype -type FlowLogCollectorTargetPrototypeSubnetIdentity struct { - // The unique identifier for this subnet. - ID *string `json:"id,omitempty"` - - // The CRN for this subnet. - CRN *string `json:"crn,omitempty"` - - // The URL for this subnet. - Href *string `json:"href,omitempty"` -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentity) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { - return true -} - -type FlowLogCollectorTargetPrototypeSubnetIdentityIntf interface { - FlowLogCollectorTargetPrototypeIntf - isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentity) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentity from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeSubnetIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeVPCIdentity : Identifies a VPC by a unique property. -// Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID -// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN -// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref -// This model "extends" FlowLogCollectorTargetPrototype -type FlowLogCollectorTargetPrototypeVPCIdentity struct { - // The unique identifier for this VPC. - ID *string `json:"id,omitempty"` - - // The CRN for this VPC. - CRN *string `json:"crn,omitempty"` - - // The URL for this VPC. - Href *string `json:"href,omitempty"` -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentity) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { - return true -} - -type FlowLogCollectorTargetPrototypeVPCIdentityIntf interface { - FlowLogCollectorTargetPrototypeIntf - isaFlowLogCollectorTargetPrototypeVPCIdentity() bool -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentity) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentity from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVPCIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" FlowLogCollectorTargetPrototype -type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity struct { - // 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"` -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { - FlowLogCollectorTargetPrototypeIntf - isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity) - 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 - } - 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 -} - -// FlowLogCollectorTargetInstanceNetworkAttachmentReference : FlowLogCollectorTargetInstanceNetworkAttachmentReference struct -// This model "extends" FlowLogCollectorTarget -type FlowLogCollectorTargetInstanceNetworkAttachmentReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance network attachment. - ID *string `json:"id" validate:"required"` - - // The name for this instance network attachment. The name is unique across all network attachments for the instance. - Name *string `json:"name" validate:"required"` - - // The primary IP address of the virtual network interface for the instance 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 instance network attachment. - Subnet *SubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the FlowLogCollectorTargetInstanceNetworkAttachmentReference.ResourceType property. -// The resource type. -const ( - FlowLogCollectorTargetInstanceNetworkAttachmentReferenceResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" -) - -func (*FlowLogCollectorTargetInstanceNetworkAttachmentReference) isaFlowLogCollectorTarget() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference unmarshals an instance of FlowLogCollectorTargetInstanceNetworkAttachmentReference from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetInstanceNetworkAttachmentReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) - 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetInstanceReference : FlowLogCollectorTargetInstanceReference struct -// This model "extends" FlowLogCollectorTarget -type FlowLogCollectorTargetInstanceReference struct { - // The CRN for this virtual server instance. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual server instance. - ID *string `json:"id" validate:"required"` - - // The name for this virtual server instance. The name is unique across all virtual server instances in the region. - Name *string `json:"name" validate:"required"` -} - -func (*FlowLogCollectorTargetInstanceReference) isaFlowLogCollectorTarget() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetInstanceReference unmarshals an instance of FlowLogCollectorTargetInstanceReference from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetInstanceReference) - 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, UnmarshalInstanceReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext : FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct -// This model "extends" FlowLogCollectorTarget -type FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - // - // If this instance 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 instance network interface. - // - // If this instance 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 name for this instance network interface. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext.ResourceType property. -// The resource type. -const ( - FlowLogCollectorTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) isaFlowLogCollectorTarget() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) - 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 -} - -// FlowLogCollectorTargetSubnetReference : FlowLogCollectorTargetSubnetReference struct -// This model "extends" FlowLogCollectorTarget -type FlowLogCollectorTargetSubnetReference struct { - // The CRN for this subnet. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SubnetReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this subnet. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this subnet. - ID *string `json:"id" validate:"required"` - - // The name for this subnet. The name is unique across all subnets in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the FlowLogCollectorTargetSubnetReference.ResourceType property. -// The resource type. -const ( - FlowLogCollectorTargetSubnetReferenceResourceTypeSubnetConst = "subnet" -) - -func (*FlowLogCollectorTargetSubnetReference) isaFlowLogCollectorTarget() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetSubnetReference unmarshals an instance of FlowLogCollectorTargetSubnetReference from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetSubnetReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetSubnetReference) - 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, UnmarshalSubnetReferenceDeleted) - 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 -} - -// FlowLogCollectorTargetVPCReference : FlowLogCollectorTargetVPCReference struct -// This model "extends" FlowLogCollectorTarget -type FlowLogCollectorTargetVPCReference struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this VPC. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` - - // The name for this VPC. The name is unique across all VPCs in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the FlowLogCollectorTargetVPCReference.ResourceType property. -// The resource type. -const ( - FlowLogCollectorTargetVPCReferenceResourceTypeVPCConst = "vpc" -) - -func (*FlowLogCollectorTargetVPCReference) isaFlowLogCollectorTarget() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetVPCReference unmarshals an instance of FlowLogCollectorTargetVPCReference from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetVPCReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetVPCReference) - 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, UnmarshalVPCReferenceDeleted) - 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 -} - -// FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext : FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext struct -// This model "extends" FlowLogCollectorTarget -type FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` - - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` - - // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext.ResourceType property. -// The resource type. -const ( - FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" -) - -func (*FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext) isaFlowLogCollectorTarget() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext unmarshals an instance of FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetVirtualNetworkInterfaceReferenceAttachmentContext) - 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) - 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 -} - -// ImageIdentityByCRN : ImageIdentityByCRN struct -// This model "extends" ImageIdentity -type ImageIdentityByCRN struct { - // The CRN for this image. - CRN *string `json:"crn" validate:"required"` -} - -// NewImageIdentityByCRN : Instantiate ImageIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewImageIdentityByCRN(crn string) (_model *ImageIdentityByCRN, err error) { - _model = &ImageIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ImageIdentityByCRN) isaImageIdentity() bool { - return true -} - -// UnmarshalImageIdentityByCRN unmarshals an instance of ImageIdentityByCRN from the specified map of raw messages. -func UnmarshalImageIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageIdentityByCRN) - 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 -} - -// ImageIdentityByHref : ImageIdentityByHref struct -// This model "extends" ImageIdentity -type ImageIdentityByHref struct { - // The URL for this image. - Href *string `json:"href" validate:"required"` -} - -// NewImageIdentityByHref : Instantiate ImageIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewImageIdentityByHref(href string) (_model *ImageIdentityByHref, err error) { - _model = &ImageIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ImageIdentityByHref) isaImageIdentity() bool { - return true -} - -// UnmarshalImageIdentityByHref unmarshals an instance of ImageIdentityByHref from the specified map of raw messages. -func UnmarshalImageIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageIdentityByHref) - 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 -} - -// ImageIdentityByID : ImageIdentityByID struct -// This model "extends" ImageIdentity -type ImageIdentityByID struct { - // The unique identifier for this image. - ID *string `json:"id" validate:"required"` -} - -// NewImageIdentityByID : Instantiate ImageIdentityByID (Generic Model Constructor) -func (*VpcV1) NewImageIdentityByID(id string) (_model *ImageIdentityByID, err error) { - _model = &ImageIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ImageIdentityByID) isaImageIdentity() bool { - return true -} - -// UnmarshalImageIdentityByID unmarshals an instance of ImageIdentityByID from the specified map of raw messages. -func UnmarshalImageIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageIdentityByID) - 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 -} - -// ImagePrototypeImageByFile : ImagePrototypeImageByFile struct -// This model "extends" ImagePrototype -type ImagePrototypeImageByFile struct { - // The deprecation date and time to set for this image. - // - // The date and time must not be in the past, and must be earlier than `obsolescence_at` - // (if `obsolescence_at` is set). - // - // If unspecified, no deprecation date and time will be set. - // - // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will - // transition to `deprecated` upon its successful creation (or - // `obsolete` if the obsolescence date and time was also reached). - DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` - - // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are - // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of - // randomly-selected words. - Name *string `json:"name,omitempty"` - - // The obsolescence date and time to set for this image. - // - // The date and time must not be in the past, and must be later than `deprecation_at` (if - // `deprecation_at` is set). - // - // If unspecified, no obsolescence date and time will be set. - // - // If the obsolescence date and time is reached while the image has a status of - // `pending`, the image's status will transition to `obsolete` upon its successful creation. - ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. - // - // That representation is created by wrapping the key's value with the `encryption_key` root key (which must also be - // specified), using either [Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the - // [Hyper Protect Crypto Services](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). - // - // If unspecified, the imported image is treated as unencrypted. - EncryptedDataKey *string `json:"encrypted_data_key,omitempty"` - - // The root key that was used to wrap the data key (which is ultimately represented as - // `encrypted_data_key`). Additionally, the root key will be used to encrypt volumes - // created from this image (unless an alternate `encryption_key` is specified at volume - // creation). - // - // If unspecified, the imported image is treated as unencrypted. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The file from which to create the image. - File *ImageFilePrototype `json:"file" validate:"required"` - - // The [supported operating - // system](https://cloud.ibm.com/apidocs/vpc#list-operating-systems) included in this - // image. - OperatingSystem OperatingSystemIdentityIntf `json:"operating_system" validate:"required"` -} - -// NewImagePrototypeImageByFile : Instantiate ImagePrototypeImageByFile (Generic Model Constructor) -func (*VpcV1) NewImagePrototypeImageByFile(file *ImageFilePrototype, operatingSystem OperatingSystemIdentityIntf) (_model *ImagePrototypeImageByFile, err error) { - _model = &ImagePrototypeImageByFile{ - File: file, - OperatingSystem: operatingSystem, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ImagePrototypeImageByFile) isaImagePrototype() bool { - return true -} - -// UnmarshalImagePrototypeImageByFile unmarshals an instance of ImagePrototypeImageByFile from the specified map of raw messages. -func UnmarshalImagePrototypeImageByFile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImagePrototypeImageByFile) - err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) - if err != nil { - err = core.SDKErrorf(err, "", "deprecation_at-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, "obsolescence_at", &obj.ObsolescenceAt) - if err != nil { - err = core.SDKErrorf(err, "", "obsolescence_at-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.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) - if err != nil { - err = core.SDKErrorf(err, "", "encrypted_data_key-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, "file", &obj.File, UnmarshalImageFilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "file-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "operating_system-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ImagePrototypeImageBySourceVolume : ImagePrototypeImageBySourceVolume struct -// This model "extends" ImagePrototype -type ImagePrototypeImageBySourceVolume struct { - // The deprecation date and time to set for this image. - // - // The date and time must not be in the past, and must be earlier than `obsolescence_at` - // (if `obsolescence_at` is set). - // - // If unspecified, no deprecation date and time will be set. - // - // If the deprecation date and time is reached while the image has a status of `pending`, the image's status will - // transition to `deprecated` upon its successful creation (or - // `obsolete` if the obsolescence date and time was also reached). - DeprecationAt *strfmt.DateTime `json:"deprecation_at,omitempty"` - - // The name for this image. The name must not be used by another image in the region. Names starting with `ibm-` are - // reserved for system-provided images, and are not allowed. If unspecified, the name will be a hyphenated list of - // randomly-selected words. - Name *string `json:"name,omitempty"` - - // The obsolescence date and time to set for this image. - // - // The date and time must not be in the past, and must be later than `deprecation_at` (if - // `deprecation_at` is set). - // - // If unspecified, no obsolescence date and time will be set. - // - // If the obsolescence date and time is reached while the image has a status of - // `pending`, the image's status will transition to `obsolete` upon its successful creation. - ObsolescenceAt *strfmt.DateTime `json:"obsolescence_at,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The root key used to wrap the system-generated data encryption key for the image. - // - // If unspecified, the root key from `source_volume` will be used. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The volume from which to create the image. The specified volume must: - // - Have an `operating_system`, which will be used to populate this image's - // operating system information. - // - Not be `active` or `busy`. - // - // During image creation, the specified volume may briefly become `busy`. - SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` -} - -// NewImagePrototypeImageBySourceVolume : Instantiate ImagePrototypeImageBySourceVolume (Generic Model Constructor) -func (*VpcV1) NewImagePrototypeImageBySourceVolume(sourceVolume VolumeIdentityIntf) (_model *ImagePrototypeImageBySourceVolume, err error) { - _model = &ImagePrototypeImageBySourceVolume{ - SourceVolume: sourceVolume, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ImagePrototypeImageBySourceVolume) isaImagePrototype() bool { - return true -} - -// UnmarshalImagePrototypeImageBySourceVolume unmarshals an instance of ImagePrototypeImageBySourceVolume from the specified map of raw messages. -func UnmarshalImagePrototypeImageBySourceVolume(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImagePrototypeImageBySourceVolume) - err = core.UnmarshalPrimitive(m, "deprecation_at", &obj.DeprecationAt) - if err != nil { - err = core.SDKErrorf(err, "", "deprecation_at-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, "obsolescence_at", &obj.ObsolescenceAt) - if err != nil { - err = core.SDKErrorf(err, "", "obsolescence_at-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, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceCatalogOfferingPrototypeCatalogOfferingByOffering : InstanceCatalogOfferingPrototypeCatalogOfferingByOffering struct -// This model "extends" InstanceCatalogOfferingPrototype -type InstanceCatalogOfferingPrototypeCatalogOfferingByOffering struct { - // Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering by a unique property. - Offering CatalogOfferingIdentityIntf `json:"offering" validate:"required"` -} - -// NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering : Instantiate InstanceCatalogOfferingPrototypeCatalogOfferingByOffering (Generic Model Constructor) -func (*VpcV1) NewInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(offering CatalogOfferingIdentityIntf) (_model *InstanceCatalogOfferingPrototypeCatalogOfferingByOffering, err error) { - _model = &InstanceCatalogOfferingPrototypeCatalogOfferingByOffering{ - Offering: offering, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceCatalogOfferingPrototypeCatalogOfferingByOffering) isaInstanceCatalogOfferingPrototype() bool { - return true -} - -// UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering unmarshals an instance of InstanceCatalogOfferingPrototypeCatalogOfferingByOffering from the specified map of raw messages. -func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByOffering) - err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "offering-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceCatalogOfferingPrototypeCatalogOfferingByVersion : InstanceCatalogOfferingPrototypeCatalogOfferingByVersion struct -// This model "extends" InstanceCatalogOfferingPrototype -type InstanceCatalogOfferingPrototypeCatalogOfferingByVersion struct { - // Identifies a version of a - // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a - // unique property. - Version CatalogOfferingVersionIdentityIntf `json:"version" validate:"required"` -} - -// NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion : Instantiate InstanceCatalogOfferingPrototypeCatalogOfferingByVersion (Generic Model Constructor) -func (*VpcV1) NewInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(version CatalogOfferingVersionIdentityIntf) (_model *InstanceCatalogOfferingPrototypeCatalogOfferingByVersion, err error) { - _model = &InstanceCatalogOfferingPrototypeCatalogOfferingByVersion{ - Version: version, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceCatalogOfferingPrototypeCatalogOfferingByVersion) isaInstanceCatalogOfferingPrototype() bool { - return true -} - -// UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion unmarshals an instance of InstanceCatalogOfferingPrototypeCatalogOfferingByVersion from the specified map of raw messages. -func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByVersion) - err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPrototypeScheduledActionPrototype : InstanceGroupManagerActionPrototypeScheduledActionPrototype struct -// Models which "extend" this model: -// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt -// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec -// This model "extends" InstanceGroupManagerActionPrototype -type InstanceGroupManagerActionPrototypeScheduledActionPrototype struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The date and time the scheduled action will run. - RunAt *strfmt.DateTime `json:"run_at,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototype) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { - return true -} - -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf interface { - InstanceGroupManagerActionPrototypeIntf - isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototype) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototype unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) - if err != nil { - err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "manager-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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionScheduledAction : InstanceGroupManagerActionScheduledAction struct -// Models which "extend" this model: -// - InstanceGroupManagerActionScheduledActionGroupTarget -// - InstanceGroupManagerActionScheduledActionManagerTarget -// This model "extends" InstanceGroupManagerAction -type InstanceGroupManagerActionScheduledAction struct { - // Indicates whether this scheduled action will be automatically deleted after it has completed and - // `auto_delete_timeout` hours have passed. 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`, and this scheduled action has finished, the hours after which it will be automatically - // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the - // future. - AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` - - // The date and time that the instance group manager action was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager action. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager action. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager action. The name is unique across all actions for the instance group - // manager. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the instance group action - // - `active`: Action is ready to be run - // - `completed`: Action was completed successfully - // - `failed`: Action could not be completed successfully - // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. - Status *string `json:"status" validate:"required"` - - // The date and time that the instance group manager action was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The type of action for the instance group. - ActionType *string `json:"action_type" validate:"required"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - // The date and time the scheduled action was last applied. If absent, the action has never been applied. - LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` - - // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run - // time. - NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroup `json:"group,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager,omitempty"` -} - -// Constants associated with the InstanceGroupManagerActionScheduledAction.ResourceType property. -// The resource type. -const ( - InstanceGroupManagerActionScheduledActionResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" -) - -// Constants associated with the InstanceGroupManagerActionScheduledAction.Status property. -// The status of the instance group action -// - `active`: Action is ready to be run -// - `completed`: Action was completed successfully -// - `failed`: Action could not be completed successfully -// - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. -const ( - InstanceGroupManagerActionScheduledActionStatusActiveConst = "active" - InstanceGroupManagerActionScheduledActionStatusCompletedConst = "completed" - InstanceGroupManagerActionScheduledActionStatusFailedConst = "failed" - InstanceGroupManagerActionScheduledActionStatusIncompatibleConst = "incompatible" - InstanceGroupManagerActionScheduledActionStatusOmittedConst = "omitted" -) - -// Constants associated with the InstanceGroupManagerActionScheduledAction.ActionType property. -// The type of action for the instance group. -const ( - InstanceGroupManagerActionScheduledActionActionTypeScheduledConst = "scheduled" -) - -func (*InstanceGroupManagerActionScheduledAction) isaInstanceGroupManagerActionScheduledAction() bool { - return true -} - -type InstanceGroupManagerActionScheduledActionIntf interface { - InstanceGroupManagerActionIntf - isaInstanceGroupManagerActionScheduledAction() bool -} - -func (*InstanceGroupManagerActionScheduledAction) isaInstanceGroupManagerAction() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionScheduledAction unmarshals an instance of InstanceGroupManagerActionScheduledAction from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionScheduledAction(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionScheduledAction) - 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_timeout", &obj.AutoDeleteTimeout) - if err != nil { - err = core.SDKErrorf(err, "", "auto_delete_timeout-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, "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, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) - if err != nil { - err = core.SDKErrorf(err, "", "action_type-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.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) - if err != nil { - err = core.SDKErrorf(err, "", "last_applied_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) - if err != nil { - err = core.SDKErrorf(err, "", "next_run_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) - if err != nil { - err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) - if err != nil { - err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerAutoScale : InstanceGroupManagerAutoScale struct -// This model "extends" InstanceGroupManager -type InstanceGroupManagerAutoScale struct { - // The date and time that the instance group manager was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager. - ID *string `json:"id" validate:"required"` - - // Indicates whether this manager will control the instance group. - ManagementEnabled *bool `json:"management_enabled" validate:"required"` - - // The name for this instance group manager. The name is unique across all managers for the instance group. - Name *string `json:"name" validate:"required"` - - // The date and time that the instance group manager was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The time window in seconds to aggregate metrics prior to evaluation. - AggregationWindow *int64 `json:"aggregation_window" validate:"required"` - - // The duration of time in seconds to pause further scale actions after scaling has taken place. - Cooldown *int64 `json:"cooldown" validate:"required"` - - // The type of instance group manager. - ManagerType *string `json:"manager_type" validate:"required"` - - // The maximum number of members in a managed instance group. - MaxMembershipCount *int64 `json:"max_membership_count" validate:"required"` - - // The minimum number of members in a managed instance group. - MinMembershipCount *int64 `json:"min_membership_count" validate:"required"` - - // The policies of the instance group manager. - Policies []InstanceGroupManagerPolicyReference `json:"policies" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerAutoScale.ManagerType property. -// The type of instance group manager. -const ( - InstanceGroupManagerAutoScaleManagerTypeAutoscaleConst = "autoscale" -) - -func (*InstanceGroupManagerAutoScale) isaInstanceGroupManager() bool { - return true -} - -// UnmarshalInstanceGroupManagerAutoScale unmarshals an instance of InstanceGroupManagerAutoScale from the specified map of raw messages. -func UnmarshalInstanceGroupManagerAutoScale(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerAutoScale) - 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, "management_enabled", &obj.ManagementEnabled) - if err != nil { - err = core.SDKErrorf(err, "", "management_enabled-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, "updated_at", &obj.UpdatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) - if err != nil { - err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) - if err != nil { - err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) - if err != nil { - err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) - if err != nil { - err = core.SDKErrorf(err, "", "policies-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype : InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype struct -// This model "extends" InstanceGroupManagerPolicyPrototype -type InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype struct { - // The name for this instance group manager policy. The name must not be used by another policy for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The type of metric to be evaluated. - MetricType *string `json:"metric_type" validate:"required"` - - // The metric value to be evaluated. - MetricValue *int64 `json:"metric_value" validate:"required"` - - // The type of policy for the instance group. - PolicyType *string `json:"policy_type" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype.MetricType property. -// The type of metric to be evaluated. -const ( - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeCpuConst = "cpu" - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeMemoryConst = "memory" - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeNetworkInConst = "network_in" - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeNetworkOutConst = "network_out" -) - -// Constants associated with the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype.PolicyType property. -// The type of policy for the instance group. -const ( - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypePolicyTypeTargetConst = "target" -) - -// NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype : Instantiate InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype(metricType string, metricValue int64, policyType string) (_model *InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype, err error) { - _model = &InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype{ - MetricType: core.StringPtr(metricType), - MetricValue: core.Int64Ptr(metricValue), - PolicyType: core.StringPtr(policyType), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) isaInstanceGroupManagerPolicyPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype unmarshals an instance of InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) - if err != nil { - err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) - if err != nil { - err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) - if err != nil { - err = core.SDKErrorf(err, "", "policy_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy : InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy struct -// This model "extends" InstanceGroupManagerPolicy -type InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy struct { - // The date and time that the instance group manager policy was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager policy. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager policy. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager policy. The name is unique across all policies for the instance group - // manager. - Name *string `json:"name" validate:"required"` - - // The date and time that the instance group manager policy was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The type of metric to be evaluated. - MetricType *string `json:"metric_type" validate:"required"` - - // The metric value to be evaluated. - MetricValue *int64 `json:"metric_value" validate:"required"` - - // The type of policy for the instance group. - PolicyType *string `json:"policy_type" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy.MetricType property. -// The type of metric to be evaluated. -const ( - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeCpuConst = "cpu" - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeMemoryConst = "memory" - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeNetworkInConst = "network_in" - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeNetworkOutConst = "network_out" -) - -// Constants associated with the InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy.PolicyType property. -// The type of policy for the instance group. -const ( - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyPolicyTypeTargetConst = "target" -) - -func (*InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy) isaInstanceGroupManagerPolicy() bool { - return true -} - -// UnmarshalInstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy unmarshals an instance of InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy) - 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, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) - if err != nil { - err = core.SDKErrorf(err, "", "metric_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) - if err != nil { - err = core.SDKErrorf(err, "", "metric_value-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) - if err != nil { - err = core.SDKErrorf(err, "", "policy_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype : InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype struct -// This model "extends" InstanceGroupManagerPrototype -type InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype struct { - // Indicates whether this manager will control the instance group. - ManagementEnabled *bool `json:"management_enabled,omitempty"` - - // The name for this instance group manager. The name must not be used by another manager for the instance group. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The time window in seconds to aggregate metrics prior to evaluation. - AggregationWindow *int64 `json:"aggregation_window,omitempty"` - - // The duration of time in seconds to pause further scale actions after scaling has taken place. - Cooldown *int64 `json:"cooldown,omitempty"` - - // The type of instance group manager. - ManagerType *string `json:"manager_type" validate:"required"` - - // The maximum number of members in a managed instance group. - MaxMembershipCount *int64 `json:"max_membership_count" validate:"required"` - - // The minimum number of members in a managed instance group. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` -} - -// Constants associated with the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype.ManagerType property. -// The type of instance group manager. -const ( - InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototypeManagerTypeAutoscaleConst = "autoscale" -) - -// NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype : Instantiate InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype(managerType string, maxMembershipCount int64) (_model *InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype, err error) { - _model = &InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype{ - ManagerType: core.StringPtr(managerType), - MaxMembershipCount: core.Int64Ptr(maxMembershipCount), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) isaInstanceGroupManagerPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype unmarshals an instance of InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) - err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) - if err != nil { - err = core.SDKErrorf(err, "", "management_enabled-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, "aggregation_window", &obj.AggregationWindow) - if err != nil { - err = core.SDKErrorf(err, "", "aggregation_window-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) - if err != nil { - err = core.SDKErrorf(err, "", "cooldown-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) - if err != nil { - err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype : InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype struct -// This model "extends" InstanceGroupManagerPrototype -type InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype struct { - // Indicates whether this manager will control the instance group. - ManagementEnabled *bool `json:"management_enabled,omitempty"` - - // The name for this instance group manager. The name must not be used by another manager for the instance group. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The type of instance group manager. - ManagerType *string `json:"manager_type" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype.ManagerType property. -// The type of instance group manager. -const ( - InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototypeManagerTypeScheduledConst = "scheduled" -) - -// NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype : Instantiate InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype(managerType string) (_model *InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype, err error) { - _model = &InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype{ - ManagerType: core.StringPtr(managerType), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype) isaInstanceGroupManagerPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype unmarshals an instance of InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerScheduledPrototype) - err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) - if err != nil { - err = core.SDKErrorf(err, "", "management_enabled-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, "manager_type", &obj.ManagerType) - if err != nil { - err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduled : InstanceGroupManagerScheduled struct -// This model "extends" InstanceGroupManager -type InstanceGroupManagerScheduled struct { - // The date and time that the instance group manager was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager. - ID *string `json:"id" validate:"required"` - - // Indicates whether this manager will control the instance group. - ManagementEnabled *bool `json:"management_enabled" validate:"required"` - - // The name for this instance group manager. The name is unique across all managers for the instance group. - Name *string `json:"name" validate:"required"` - - // The date and time that the instance group manager was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The actions of the instance group manager. - Actions []InstanceGroupManagerActionReference `json:"actions" validate:"required"` - - // The type of instance group manager. - ManagerType *string `json:"manager_type" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerScheduled.ManagerType property. -// The type of instance group manager. -const ( - InstanceGroupManagerScheduledManagerTypeScheduledConst = "scheduled" -) - -func (*InstanceGroupManagerScheduled) isaInstanceGroupManager() bool { - return true -} - -// UnmarshalInstanceGroupManagerScheduled unmarshals an instance of InstanceGroupManagerScheduled from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduled(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduled) - 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, "management_enabled", &obj.ManagementEnabled) - if err != nil { - err = core.SDKErrorf(err, "", "management_enabled-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, "updated_at", &obj.UpdatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "actions", &obj.Actions, UnmarshalInstanceGroupManagerActionReference) - if err != nil { - err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) - if err != nil { - err = core.SDKErrorf(err, "", "manager_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManagerAutoScale : InstanceGroupManagerScheduledActionManagerAutoScale struct -// This model "extends" InstanceGroupManagerScheduledActionManager -type InstanceGroupManagerScheduledActionManagerAutoScale struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this instance group manager. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager. The name is unique across all managers for the instance group. - Name *string `json:"name" validate:"required"` - - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` -} - -func (*InstanceGroupManagerScheduledActionManagerAutoScale) isaInstanceGroupManagerScheduledActionManager() bool { - return true -} - -// UnmarshalInstanceGroupManagerScheduledActionManagerAutoScale unmarshals an instance of InstanceGroupManagerScheduledActionManagerAutoScale from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManagerAutoScale(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManagerAutoScale) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) - 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, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype : The auto scale manager to update, and one or more properties to be updated. Either `id` or `href` must be specified, -// in addition to at least one of `min_membership_count` and -// `max_membership_count`. -// Models which "extend" this model: -// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID -// - InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref -// This model "extends" InstanceGroupManagerScheduledActionManagerPrototype -type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype struct { - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The unique identifier for this instance group manager. - ID *string `json:"id,omitempty"` - - // The URL for this instance group manager. - Href *string `json:"href,omitempty"` -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { - return true -} - -type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeIntf interface { - InstanceGroupManagerScheduledActionManagerPrototypeIntf - isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype) - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "min_membership_count-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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterface -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity struct { - // 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"` -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityIntf interface { - InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceIntf - isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity) - 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 - } - 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 -} - -// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext : The virtual network interface for this target. -// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterface -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext 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"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. - AutoDelete *bool `json:"auto_delete,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"` - - // 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"` - - // 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 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"` - - // The resource group to use for this virtual network interface. If unspecified, the - // virtual server instance's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,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"` -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) - 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 - } - 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.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) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePatchProfileInstanceProfileIdentityByHref : InstancePatchProfileInstanceProfileIdentityByHref struct -// This model "extends" InstancePatchProfile -type InstancePatchProfileInstanceProfileIdentityByHref struct { - // The URL for this virtual server instance profile. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePatchProfileInstanceProfileIdentityByHref : Instantiate InstancePatchProfileInstanceProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByHref(href string) (_model *InstancePatchProfileInstanceProfileIdentityByHref, err error) { - _model = &InstancePatchProfileInstanceProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePatchProfileInstanceProfileIdentityByHref) isaInstancePatchProfile() bool { - return true -} - -// UnmarshalInstancePatchProfileInstanceProfileIdentityByHref unmarshals an instance of InstancePatchProfileInstanceProfileIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePatchProfileInstanceProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePatchProfileInstanceProfileIdentityByHref) - 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 -} - -// InstancePatchProfileInstanceProfileIdentityByName : InstancePatchProfileInstanceProfileIdentityByName struct -// This model "extends" InstancePatchProfile -type InstancePatchProfileInstanceProfileIdentityByName struct { - // The globally unique name for this virtual server instance profile. - Name *string `json:"name" validate:"required"` -} - -// NewInstancePatchProfileInstanceProfileIdentityByName : Instantiate InstancePatchProfileInstanceProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByName(name string) (_model *InstancePatchProfileInstanceProfileIdentityByName, err error) { - _model = &InstancePatchProfileInstanceProfileIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePatchProfileInstanceProfileIdentityByName) isaInstancePatchProfile() bool { - return true -} - -// UnmarshalInstancePatchProfileInstanceProfileIdentityByName unmarshals an instance of InstancePatchProfileInstanceProfileIdentityByName from the specified map of raw messages. -func UnmarshalInstancePatchProfileInstanceProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePatchProfileInstanceProfileIdentityByName) - 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 -} - -// InstancePlacementTargetPatchDedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. -// Models which "extend" this model: -// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID -// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN -// - InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref -// This model "extends" InstancePlacementTargetPatch -type InstancePlacementTargetPatchDedicatedHostGroupIdentity struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id,omitempty"` - - // The CRN for this dedicated host group. - CRN *string `json:"crn,omitempty"` - - // The URL for this dedicated host group. - Href *string `json:"href,omitempty"` -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentity) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { - return true -} - -type InstancePlacementTargetPatchDedicatedHostGroupIdentityIntf interface { - InstancePlacementTargetPatchIntf - isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentity) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentity unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentity from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPatchDedicatedHostIdentity : Identifies a dedicated host by a unique property. -// Models which "extend" this model: -// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID -// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN -// - InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref -// This model "extends" InstancePlacementTargetPatch -type InstancePlacementTargetPatchDedicatedHostIdentity struct { - // The unique identifier for this dedicated host. - ID *string `json:"id,omitempty"` - - // The CRN for this dedicated host. - CRN *string `json:"crn,omitempty"` - - // The URL for this dedicated host. - Href *string `json:"href,omitempty"` -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentity) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { - return true -} - -type InstancePlacementTargetPatchDedicatedHostIdentityIntf interface { - InstancePlacementTargetPatchIntf - isaInstancePlacementTargetPatchDedicatedHostIdentity() bool -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentity) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentity unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentity from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. -// Models which "extend" this model: -// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID -// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN -// - InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref -// This model "extends" InstancePlacementTargetPrototype -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentity struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id,omitempty"` - - // The CRN for this dedicated host group. - CRN *string `json:"crn,omitempty"` - - // The URL for this dedicated host group. - Href *string `json:"href,omitempty"` -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { - return true -} - -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityIntf interface { - InstancePlacementTargetPrototypeIntf - isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentity unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentity from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypeDedicatedHostIdentity : Identifies a dedicated host by a unique property. -// Models which "extend" this model: -// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID -// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN -// - InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref -// This model "extends" InstancePlacementTargetPrototype -type InstancePlacementTargetPrototypeDedicatedHostIdentity struct { - // The unique identifier for this dedicated host. - ID *string `json:"id,omitempty"` - - // The CRN for this dedicated host. - CRN *string `json:"crn,omitempty"` - - // The URL for this dedicated host. - Href *string `json:"href,omitempty"` -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentity) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { - return true -} - -type InstancePlacementTargetPrototypeDedicatedHostIdentityIntf interface { - InstancePlacementTargetPrototypeIntf - isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentity) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentity unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentity from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetPrototypePlacementGroupIdentity : Identifies a placement group by a unique property. -// Models which "extend" this model: -// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID -// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN -// - InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref -// This model "extends" InstancePlacementTargetPrototype -type InstancePlacementTargetPrototypePlacementGroupIdentity struct { - // The unique identifier for this placement group. - ID *string `json:"id,omitempty"` - - // The CRN for this placement group. - CRN *string `json:"crn,omitempty"` - - // The URL for this placement group. - Href *string `json:"href,omitempty"` -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentity) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { - return true -} - -type InstancePlacementTargetPrototypePlacementGroupIdentityIntf interface { - InstancePlacementTargetPrototypeIntf - isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentity) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentity unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentity from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypePlacementGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePlacementTargetDedicatedHostGroupReference : InstancePlacementTargetDedicatedHostGroupReference struct -// This model "extends" InstancePlacementTarget -type InstancePlacementTargetDedicatedHostGroupReference struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` - - // The name for this dedicated host group. The name is unique across all dedicated host groups in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the InstancePlacementTargetDedicatedHostGroupReference.ResourceType property. -// The resource type. -const ( - InstancePlacementTargetDedicatedHostGroupReferenceResourceTypeDedicatedHostGroupConst = "dedicated_host_group" -) - -func (*InstancePlacementTargetDedicatedHostGroupReference) isaInstancePlacementTarget() bool { - return true -} - -// UnmarshalInstancePlacementTargetDedicatedHostGroupReference unmarshals an instance of InstancePlacementTargetDedicatedHostGroupReference from the specified map of raw messages. -func UnmarshalInstancePlacementTargetDedicatedHostGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetDedicatedHostGroupReference) - 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, UnmarshalDedicatedHostGroupReferenceDeleted) - 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 -} - -// InstancePlacementTargetDedicatedHostReference : InstancePlacementTargetDedicatedHostReference struct -// This model "extends" InstancePlacementTarget -type InstancePlacementTargetDedicatedHostReference struct { - // The CRN for this dedicated host. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *DedicatedHostReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this dedicated host. - ID *string `json:"id" validate:"required"` - - // The name for this dedicated host. The name is unique across all dedicated hosts in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the InstancePlacementTargetDedicatedHostReference.ResourceType property. -// The resource type. -const ( - InstancePlacementTargetDedicatedHostReferenceResourceTypeDedicatedHostConst = "dedicated_host" -) - -func (*InstancePlacementTargetDedicatedHostReference) isaInstancePlacementTarget() bool { - return true -} - -// UnmarshalInstancePlacementTargetDedicatedHostReference unmarshals an instance of InstancePlacementTargetDedicatedHostReference from the specified map of raw messages. -func UnmarshalInstancePlacementTargetDedicatedHostReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetDedicatedHostReference) - 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, UnmarshalDedicatedHostReferenceDeleted) - 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 -} - -// InstancePlacementTargetPlacementGroupReference : InstancePlacementTargetPlacementGroupReference struct -// This model "extends" InstancePlacementTarget -type InstancePlacementTargetPlacementGroupReference struct { - // The CRN for this placement group. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *PlacementGroupReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this placement group. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this placement group. - ID *string `json:"id" validate:"required"` - - // The name for this placement group. The name is unique across all placement groups in the region. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the InstancePlacementTargetPlacementGroupReference.ResourceType property. -// The resource type. -const ( - InstancePlacementTargetPlacementGroupReferenceResourceTypePlacementGroupConst = "placement_group" -) - -func (*InstancePlacementTargetPlacementGroupReference) isaInstancePlacementTarget() bool { - return true -} - -// UnmarshalInstancePlacementTargetPlacementGroupReference unmarshals an instance of InstancePlacementTargetPlacementGroupReference from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPlacementGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPlacementGroupReference) - 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, UnmarshalPlacementGroupReferenceDeleted) - 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 -} - -// InstanceProfileBandwidthDependent : The total bandwidth shared across the network attachments or network interfaces and storage volumes of an instance -// with this profile depends on its configuration. -// This model "extends" InstanceProfileBandwidth -type InstanceProfileBandwidthDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileBandwidthDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileBandwidthDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileBandwidthDependent) isaInstanceProfileBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileBandwidthDependent unmarshals an instance of InstanceProfileBandwidthDependent from the specified map of raw messages. -func UnmarshalInstanceProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileBandwidthDependent) - 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 -} - -// InstanceProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network attachments or network -// interfaces and storage volumes of an instance with this profile. -// This model "extends" InstanceProfileBandwidth -type InstanceProfileBandwidthEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 InstanceProfileBandwidthEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileBandwidthEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileBandwidthEnum) isaInstanceProfileBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileBandwidthEnum unmarshals an instance of InstanceProfileBandwidthEnum from the specified map of raw messages. -func UnmarshalInstanceProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileBandwidthEnum) - 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 -} - -// InstanceProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network attachments or network interfaces and storage -// volumes of an instance with this profile. -// This model "extends" InstanceProfileBandwidth -type InstanceProfileBandwidthFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileBandwidthFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileBandwidthFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileBandwidthFixed) isaInstanceProfileBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileBandwidthFixed unmarshals an instance of InstanceProfileBandwidthFixed from the specified map of raw messages. -func UnmarshalInstanceProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileBandwidthFixed) - 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 -} - -// InstanceProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network attachments or network -// interfaces and storage volumes of an instance with this profile. -// This model "extends" InstanceProfileBandwidth -type InstanceProfileBandwidthRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileBandwidthRange.Type property. -// The type for this profile field. -const ( - InstanceProfileBandwidthRangeTypeRangeConst = "range" -) - -func (*InstanceProfileBandwidthRange) isaInstanceProfileBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileBandwidthRange unmarshals an instance of InstanceProfileBandwidthRange from the specified map of raw messages. -func UnmarshalInstanceProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileBandwidthRange) - 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, "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 { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskQuantityDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskQuantityDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileDiskQuantityDependent) isaInstanceProfileDiskQuantity() bool { - return true -} - -// UnmarshalInstanceProfileDiskQuantityDependent unmarshals an instance of InstanceProfileDiskQuantityDependent from the specified map of raw messages. -func UnmarshalInstanceProfileDiskQuantityDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskQuantityDependent) - 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 -} - -// InstanceProfileDiskQuantityEnum : The permitted the number of disks of this configuration for an instance with this profile. -// This model "extends" InstanceProfileDiskQuantity -type InstanceProfileDiskQuantityEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 InstanceProfileDiskQuantityEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskQuantityEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileDiskQuantityEnum) isaInstanceProfileDiskQuantity() bool { - return true -} - -// UnmarshalInstanceProfileDiskQuantityEnum unmarshals an instance of InstanceProfileDiskQuantityEnum from the specified map of raw messages. -func UnmarshalInstanceProfileDiskQuantityEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskQuantityEnum) - 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 -} - -// InstanceProfileDiskQuantityFixed : The number of disks of this configuration for an instance with this profile. -// This model "extends" InstanceProfileDiskQuantity -type InstanceProfileDiskQuantityFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskQuantityFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskQuantityFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileDiskQuantityFixed) isaInstanceProfileDiskQuantity() bool { - return true -} - -// UnmarshalInstanceProfileDiskQuantityFixed unmarshals an instance of InstanceProfileDiskQuantityFixed from the specified map of raw messages. -func UnmarshalInstanceProfileDiskQuantityFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskQuantityFixed) - 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 -} - -// InstanceProfileDiskQuantityRange : The permitted range for the number of disks of this configuration for an instance with this profile. -// This model "extends" InstanceProfileDiskQuantity -type InstanceProfileDiskQuantityRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskQuantityRange.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskQuantityRangeTypeRangeConst = "range" -) - -func (*InstanceProfileDiskQuantityRange) isaInstanceProfileDiskQuantity() bool { - return true -} - -// UnmarshalInstanceProfileDiskQuantityRange unmarshals an instance of InstanceProfileDiskQuantityRange from the specified map of raw messages. -func UnmarshalInstanceProfileDiskQuantityRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskQuantityRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileDiskSizeDependent : The disk size in GB (gigabytes) of this configuration for an instance with this profile depends on its instance -// configuration. -// This model "extends" InstanceProfileDiskSize -type InstanceProfileDiskSizeDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskSizeDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskSizeDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileDiskSizeDependent) isaInstanceProfileDiskSize() bool { - return true -} - -// UnmarshalInstanceProfileDiskSizeDependent unmarshals an instance of InstanceProfileDiskSizeDependent from the specified map of raw messages. -func UnmarshalInstanceProfileDiskSizeDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskSizeDependent) - 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 -} - -// InstanceProfileDiskSizeEnum : The permitted disk size in GB (gigabytes) of this configuration for an instance with this profile. -// This model "extends" InstanceProfileDiskSize -type InstanceProfileDiskSizeEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 InstanceProfileDiskSizeEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskSizeEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileDiskSizeEnum) isaInstanceProfileDiskSize() bool { - return true -} - -// UnmarshalInstanceProfileDiskSizeEnum unmarshals an instance of InstanceProfileDiskSizeEnum from the specified map of raw messages. -func UnmarshalInstanceProfileDiskSizeEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskSizeEnum) - 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 -} - -// InstanceProfileDiskSizeFixed : The size of the disk in GB (gigabytes). -// This model "extends" InstanceProfileDiskSize -type InstanceProfileDiskSizeFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskSizeFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskSizeFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileDiskSizeFixed) isaInstanceProfileDiskSize() bool { - return true -} - -// UnmarshalInstanceProfileDiskSizeFixed unmarshals an instance of InstanceProfileDiskSizeFixed from the specified map of raw messages. -func UnmarshalInstanceProfileDiskSizeFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskSizeFixed) - 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 -} - -// InstanceProfileDiskSizeRange : The permitted range for the disk size of this configuration in GB (gigabytes) for an instance with this profile. -// This model "extends" InstanceProfileDiskSize -type InstanceProfileDiskSizeRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileDiskSizeRange.Type property. -// The type for this profile field. -const ( - InstanceProfileDiskSizeRangeTypeRangeConst = "range" -) - -func (*InstanceProfileDiskSizeRange) isaInstanceProfileDiskSize() bool { - return true -} - -// UnmarshalInstanceProfileDiskSizeRange unmarshals an instance of InstanceProfileDiskSizeRange from the specified map of raw messages. -func UnmarshalInstanceProfileDiskSizeRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileDiskSizeRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuDependent : The GPU count for an instance with this profile depends on its configuration. -// This model "extends" InstanceProfileGpu -type InstanceProfileGpuDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileGpuDependent) isaInstanceProfileGpu() bool { - return true -} - -// UnmarshalInstanceProfileGpuDependent unmarshals an instance of InstanceProfileGpuDependent from the specified map of raw messages. -func UnmarshalInstanceProfileGpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuDependent) - 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 -} - -// InstanceProfileGpuEnum : The permitted GPU count values for an instance with this profile. -// This model "extends" InstanceProfileGpu -type InstanceProfileGpuEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 InstanceProfileGpuEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileGpuEnum) isaInstanceProfileGpu() bool { - return true -} - -// UnmarshalInstanceProfileGpuEnum unmarshals an instance of InstanceProfileGpuEnum from the specified map of raw messages. -func UnmarshalInstanceProfileGpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuEnum) - 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 -} - -// InstanceProfileGpuFixed : The GPU count for an instance with this profile. -// This model "extends" InstanceProfileGpu -type InstanceProfileGpuFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileGpuFixed) isaInstanceProfileGpu() bool { - return true -} - -// UnmarshalInstanceProfileGpuFixed unmarshals an instance of InstanceProfileGpuFixed from the specified map of raw messages. -func UnmarshalInstanceProfileGpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuFixed) - 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 -} - -// InstanceProfileGpuMemoryDependent : The overall GPU memory value for an instance with this profile depends on its configuration. -// This model "extends" InstanceProfileGpuMemory -type InstanceProfileGpuMemoryDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuMemoryDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuMemoryDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileGpuMemoryDependent) isaInstanceProfileGpuMemory() bool { - return true -} - -// UnmarshalInstanceProfileGpuMemoryDependent unmarshals an instance of InstanceProfileGpuMemoryDependent from the specified map of raw messages. -func UnmarshalInstanceProfileGpuMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuMemoryDependent) - 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 -} - -// InstanceProfileGpuMemoryEnum : The permitted overall GPU memory values in GiB (gibibytes) for an instance with this profile. -// This model "extends" InstanceProfileGpuMemory -type InstanceProfileGpuMemoryEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 InstanceProfileGpuMemoryEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuMemoryEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileGpuMemoryEnum) isaInstanceProfileGpuMemory() bool { - return true -} - -// UnmarshalInstanceProfileGpuMemoryEnum unmarshals an instance of InstanceProfileGpuMemoryEnum from the specified map of raw messages. -func UnmarshalInstanceProfileGpuMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuMemoryEnum) - 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 -} - -// InstanceProfileGpuMemoryFixed : The overall GPU memory in GiB (gibibytes) for an instance with this profile. -// This model "extends" InstanceProfileGpuMemory -type InstanceProfileGpuMemoryFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuMemoryFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuMemoryFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileGpuMemoryFixed) isaInstanceProfileGpuMemory() bool { - return true -} - -// UnmarshalInstanceProfileGpuMemoryFixed unmarshals an instance of InstanceProfileGpuMemoryFixed from the specified map of raw messages. -func UnmarshalInstanceProfileGpuMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuMemoryFixed) - 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 -} - -// InstanceProfileGpuMemoryRange : The permitted overall GPU memory range in GiB (gibibytes) for an instance with this profile. -// This model "extends" InstanceProfileGpuMemory -type InstanceProfileGpuMemoryRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuMemoryRange.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuMemoryRangeTypeRangeConst = "range" -) - -func (*InstanceProfileGpuMemoryRange) isaInstanceProfileGpuMemory() bool { - return true -} - -// UnmarshalInstanceProfileGpuMemoryRange unmarshals an instance of InstanceProfileGpuMemoryRange from the specified map of raw messages. -func UnmarshalInstanceProfileGpuMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuMemoryRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileGpuRange : The permitted GPU count range for an instance with this profile. -// This model "extends" InstanceProfileGpu -type InstanceProfileGpuRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileGpuRange.Type property. -// The type for this profile field. -const ( - InstanceProfileGpuRangeTypeRangeConst = "range" -) - -func (*InstanceProfileGpuRange) isaInstanceProfileGpu() bool { - return true -} - -// UnmarshalInstanceProfileGpuRange unmarshals an instance of InstanceProfileGpuRange from the specified map of raw messages. -func UnmarshalInstanceProfileGpuRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileGpuRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileIdentityByHref : InstanceProfileIdentityByHref struct -// This model "extends" InstanceProfileIdentity -type InstanceProfileIdentityByHref struct { - // The URL for this virtual server instance profile. - Href *string `json:"href" validate:"required"` -} - -// NewInstanceProfileIdentityByHref : Instantiate InstanceProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstanceProfileIdentityByHref(href string) (_model *InstanceProfileIdentityByHref, err error) { - _model = &InstanceProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceProfileIdentityByHref) isaInstanceProfileIdentity() bool { - return true -} - -// UnmarshalInstanceProfileIdentityByHref unmarshals an instance of InstanceProfileIdentityByHref from the specified map of raw messages. -func UnmarshalInstanceProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileIdentityByHref) - 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 -} - -// InstanceProfileIdentityByName : InstanceProfileIdentityByName struct -// This model "extends" InstanceProfileIdentity -type InstanceProfileIdentityByName struct { - // The globally unique name for this virtual server instance profile. - Name *string `json:"name" validate:"required"` -} - -// NewInstanceProfileIdentityByName : Instantiate InstanceProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewInstanceProfileIdentityByName(name string) (_model *InstanceProfileIdentityByName, err error) { - _model = &InstanceProfileIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceProfileIdentityByName) isaInstanceProfileIdentity() bool { - return true -} - -// UnmarshalInstanceProfileIdentityByName unmarshals an instance of InstanceProfileIdentityByName from the specified map of raw messages. -func UnmarshalInstanceProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileIdentityByName) - 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 -} - -// InstanceProfileMemoryDependent : The memory value for an instance with this profile depends on its configuration. -// This model "extends" InstanceProfileMemory -type InstanceProfileMemoryDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileMemoryDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileMemoryDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileMemoryDependent) isaInstanceProfileMemory() bool { - return true -} - -// UnmarshalInstanceProfileMemoryDependent unmarshals an instance of InstanceProfileMemoryDependent from the specified map of raw messages. -func UnmarshalInstanceProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileMemoryDependent) - 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 -} - -// InstanceProfileMemoryEnum : The permitted memory values (in gibibytes) for an instance with this profile. -// This model "extends" InstanceProfileMemory -type InstanceProfileMemoryEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 InstanceProfileMemoryEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileMemoryEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileMemoryEnum) isaInstanceProfileMemory() bool { - return true -} - -// UnmarshalInstanceProfileMemoryEnum unmarshals an instance of InstanceProfileMemoryEnum from the specified map of raw messages. -func UnmarshalInstanceProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileMemoryEnum) - 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 -} - -// InstanceProfileMemoryFixed : The memory (in gibibytes) for an instance with this profile. -// This model "extends" InstanceProfileMemory -type InstanceProfileMemoryFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileMemoryFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileMemoryFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileMemoryFixed) isaInstanceProfileMemory() bool { - return true -} - -// UnmarshalInstanceProfileMemoryFixed unmarshals an instance of InstanceProfileMemoryFixed from the specified map of raw messages. -func UnmarshalInstanceProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileMemoryFixed) - 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 -} - -// InstanceProfileMemoryRange : The permitted memory range (in gibibytes) for an instance with this profile. -// This model "extends" InstanceProfileMemory -type InstanceProfileMemoryRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileMemoryRange.Type property. -// The type for this profile field. -const ( - InstanceProfileMemoryRangeTypeRangeConst = "range" -) - -func (*InstanceProfileMemoryRange) isaInstanceProfileMemory() bool { - return true -} - -// UnmarshalInstanceProfileMemoryRange unmarshals an instance of InstanceProfileMemoryRange from the specified map of raw messages. -func UnmarshalInstanceProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileMemoryRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileNumaCountDependent : The total number of NUMA nodes for an instance with this profile depends on its configuration and the capacity -// constraints within the zone. -// This model "extends" InstanceProfileNumaCount -type InstanceProfileNumaCountDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileNumaCountDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileNumaCountDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileNumaCountDependent) isaInstanceProfileNumaCount() bool { - return true -} - -// UnmarshalInstanceProfileNumaCountDependent unmarshals an instance of InstanceProfileNumaCountDependent from the specified map of raw messages. -func UnmarshalInstanceProfileNumaCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNumaCountDependent) - 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 -} - -// InstanceProfileNumaCountFixed : The total number of NUMA nodes for an instance with this profile. -// This model "extends" InstanceProfileNumaCount -type InstanceProfileNumaCountFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileNumaCountFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileNumaCountFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileNumaCountFixed) isaInstanceProfileNumaCount() bool { - return true -} - -// UnmarshalInstanceProfileNumaCountFixed unmarshals an instance of InstanceProfileNumaCountFixed from the specified map of raw messages. -func UnmarshalInstanceProfileNumaCountFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNumaCountFixed) - 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 -} - -// InstanceProfileNetworkAttachmentCountDependent : The number of network attachments supported on an instance with this profile is dependent on its configuration. -// This model "extends" InstanceProfileNetworkAttachmentCount -type InstanceProfileNetworkAttachmentCountDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileNetworkAttachmentCountDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileNetworkAttachmentCountDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileNetworkAttachmentCountDependent) isaInstanceProfileNetworkAttachmentCount() bool { - return true -} - -// UnmarshalInstanceProfileNetworkAttachmentCountDependent unmarshals an instance of InstanceProfileNetworkAttachmentCountDependent from the specified map of raw messages. -func UnmarshalInstanceProfileNetworkAttachmentCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNetworkAttachmentCountDependent) - 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 -} - -// InstanceProfileNetworkAttachmentCountRange : The number of network attachments supported on an instance with this profile. -// This model "extends" InstanceProfileNetworkAttachmentCount -type InstanceProfileNetworkAttachmentCountRange 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" validate:"required"` -} - -// Constants associated with the InstanceProfileNetworkAttachmentCountRange.Type property. -// The type for this profile field. -const ( - InstanceProfileNetworkAttachmentCountRangeTypeRangeConst = "range" -) - -func (*InstanceProfileNetworkAttachmentCountRange) isaInstanceProfileNetworkAttachmentCount() bool { - return true -} - -// UnmarshalInstanceProfileNetworkAttachmentCountRange unmarshals an instance of InstanceProfileNetworkAttachmentCountRange from the specified map of raw messages. -func UnmarshalInstanceProfileNetworkAttachmentCountRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNetworkAttachmentCountRange) - 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) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileNetworkInterfaceCountDependent : The number of network interfaces supported on an instance with this profile is dependent on its configuration. -// This model "extends" InstanceProfileNetworkInterfaceCount -type InstanceProfileNetworkInterfaceCountDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileNetworkInterfaceCountDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileNetworkInterfaceCountDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileNetworkInterfaceCountDependent) isaInstanceProfileNetworkInterfaceCount() bool { - return true -} - -// UnmarshalInstanceProfileNetworkInterfaceCountDependent unmarshals an instance of InstanceProfileNetworkInterfaceCountDependent from the specified map of raw messages. -func UnmarshalInstanceProfileNetworkInterfaceCountDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNetworkInterfaceCountDependent) - 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 -} - -// InstanceProfileNetworkInterfaceCountRange : The number of network interfaces supported on an instance with this profile. -// This model "extends" InstanceProfileNetworkInterfaceCount -type InstanceProfileNetworkInterfaceCountRange 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" validate:"required"` -} - -// Constants associated with the InstanceProfileNetworkInterfaceCountRange.Type property. -// The type for this profile field. -const ( - InstanceProfileNetworkInterfaceCountRangeTypeRangeConst = "range" -) - -func (*InstanceProfileNetworkInterfaceCountRange) isaInstanceProfileNetworkInterfaceCount() bool { - return true -} - -// UnmarshalInstanceProfileNetworkInterfaceCountRange unmarshals an instance of InstanceProfileNetworkInterfaceCountRange from the specified map of raw messages. -func UnmarshalInstanceProfileNetworkInterfaceCountRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileNetworkInterfaceCountRange) - 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) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfilePortSpeedDependent : The port speed of each network interface of an instance with this profile depends on its configuration. -// This model "extends" InstanceProfilePortSpeed -type InstanceProfilePortSpeedDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfilePortSpeedDependent.Type property. -// The type for this profile field. -const ( - InstanceProfilePortSpeedDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfilePortSpeedDependent) isaInstanceProfilePortSpeed() bool { - return true -} - -// UnmarshalInstanceProfilePortSpeedDependent unmarshals an instance of InstanceProfilePortSpeedDependent from the specified map of raw messages. -func UnmarshalInstanceProfilePortSpeedDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfilePortSpeedDependent) - 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 -} - -// InstanceProfilePortSpeedFixed : The maximum speed (in megabits per second) of each network interface of an instance with this profile. -// This model "extends" InstanceProfilePortSpeed -type InstanceProfilePortSpeedFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfilePortSpeedFixed.Type property. -// The type for this profile field. -const ( - InstanceProfilePortSpeedFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfilePortSpeedFixed) isaInstanceProfilePortSpeed() bool { - return true -} - -// UnmarshalInstanceProfilePortSpeedFixed unmarshals an instance of InstanceProfilePortSpeedFixed from the specified map of raw messages. -func UnmarshalInstanceProfilePortSpeedFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfilePortSpeedFixed) - 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 -} - -// InstanceProfileVcpuDependent : The VCPU count for an instance with this profile depends on its configuration. -// This model "extends" InstanceProfileVcpu -type InstanceProfileVcpuDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileVcpuDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileVcpuDependent) isaInstanceProfileVcpu() bool { - return true -} - -// UnmarshalInstanceProfileVcpuDependent unmarshals an instance of InstanceProfileVcpuDependent from the specified map of raw messages. -func UnmarshalInstanceProfileVcpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpuDependent) - 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 -} - -// InstanceProfileVcpuEnum : The permitted values for VCPU count for an instance with this profile. -// This model "extends" InstanceProfileVcpu -type InstanceProfileVcpuEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 InstanceProfileVcpuEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileVcpuEnum) isaInstanceProfileVcpu() bool { - return true -} - -// UnmarshalInstanceProfileVcpuEnum unmarshals an instance of InstanceProfileVcpuEnum from the specified map of raw messages. -func UnmarshalInstanceProfileVcpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpuEnum) - 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 -} - -// InstanceProfileVcpuFixed : The VCPU count for an instance with this profile. -// This model "extends" InstanceProfileVcpu -type InstanceProfileVcpuFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileVcpuFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileVcpuFixed) isaInstanceProfileVcpu() bool { - return true -} - -// UnmarshalInstanceProfileVcpuFixed unmarshals an instance of InstanceProfileVcpuFixed from the specified map of raw messages. -func UnmarshalInstanceProfileVcpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpuFixed) - 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 -} - -// InstanceProfileVcpuRange : The permitted range for VCPU count for an instance with this profile. -// This model "extends" InstanceProfileVcpu -type InstanceProfileVcpuRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileVcpuRange.Type property. -// The type for this profile field. -const ( - InstanceProfileVcpuRangeTypeRangeConst = "range" -) - -func (*InstanceProfileVcpuRange) isaInstanceProfileVcpu() bool { - return true -} - -// UnmarshalInstanceProfileVcpuRange unmarshals an instance of InstanceProfileVcpuRange from the specified map of raw messages. -func UnmarshalInstanceProfileVcpuRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVcpuRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceProfileVolumeBandwidthDependent : The storage bandwidth shared across the storage volumes of an instance with this profile depends on its -// configuration. -// This model "extends" InstanceProfileVolumeBandwidth -type InstanceProfileVolumeBandwidthDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileVolumeBandwidthDependent.Type property. -// The type for this profile field. -const ( - InstanceProfileVolumeBandwidthDependentTypeDependentConst = "dependent" -) - -func (*InstanceProfileVolumeBandwidthDependent) isaInstanceProfileVolumeBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileVolumeBandwidthDependent unmarshals an instance of InstanceProfileVolumeBandwidthDependent from the specified map of raw messages. -func UnmarshalInstanceProfileVolumeBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVolumeBandwidthDependent) - 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 -} - -// InstanceProfileVolumeBandwidthEnum : The permitted storage bandwidth values (in megabits per second) shared across the storage volumes of an instance with -// this profile. -// This model "extends" InstanceProfileVolumeBandwidth -type InstanceProfileVolumeBandwidthEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 InstanceProfileVolumeBandwidthEnum.Type property. -// The type for this profile field. -const ( - InstanceProfileVolumeBandwidthEnumTypeEnumConst = "enum" -) - -func (*InstanceProfileVolumeBandwidthEnum) isaInstanceProfileVolumeBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileVolumeBandwidthEnum unmarshals an instance of InstanceProfileVolumeBandwidthEnum from the specified map of raw messages. -func UnmarshalInstanceProfileVolumeBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVolumeBandwidthEnum) - 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 -} - -// InstanceProfileVolumeBandwidthFixed : The storage bandwidth (in megabits per second) shared across the storage volumes of an instance with this profile. -// This model "extends" InstanceProfileVolumeBandwidth -type InstanceProfileVolumeBandwidthFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the InstanceProfileVolumeBandwidthFixed.Type property. -// The type for this profile field. -const ( - InstanceProfileVolumeBandwidthFixedTypeFixedConst = "fixed" -) - -func (*InstanceProfileVolumeBandwidthFixed) isaInstanceProfileVolumeBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileVolumeBandwidthFixed unmarshals an instance of InstanceProfileVolumeBandwidthFixed from the specified map of raw messages. -func UnmarshalInstanceProfileVolumeBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVolumeBandwidthFixed) - 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 -} - -// InstanceProfileVolumeBandwidthRange : The permitted storage bandwidth range (in megabits per second) shared across the storage volumes of an instance with -// this profile. -// This model "extends" InstanceProfileVolumeBandwidth -type InstanceProfileVolumeBandwidthRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the InstanceProfileVolumeBandwidthRange.Type property. -// The type for this profile field. -const ( - InstanceProfileVolumeBandwidthRangeTypeRangeConst = "range" -) - -func (*InstanceProfileVolumeBandwidthRange) isaInstanceProfileVolumeBandwidth() bool { - return true -} - -// UnmarshalInstanceProfileVolumeBandwidthRange unmarshals an instance of InstanceProfileVolumeBandwidthRange from the specified map of raw messages. -func UnmarshalInstanceProfileVolumeBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceProfileVolumeBandwidthRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByCatalogOffering : Create an instance by using a catalog offering. -// Models which "extend" this model: -// - InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment -// - InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface -// This model "extends" InstancePrototype -type InstancePrototypeInstanceByCatalogOffering struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account, subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototypeInstanceByCatalogOffering() bool { - return true -} - -type InstancePrototypeInstanceByCatalogOfferingIntf interface { - InstancePrototypeIntf - isaInstancePrototypeInstanceByCatalogOffering() bool -} - -func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByCatalogOffering unmarshals an instance of InstancePrototypeInstanceByCatalogOffering from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByCatalogOffering) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByImage : Create an instance by using an image. -// Models which "extend" this model: -// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment -// - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface -// This model "extends" InstancePrototype -type InstancePrototypeInstanceByImage struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstancePrototypeInstanceByImage) isaInstancePrototypeInstanceByImage() bool { - return true -} - -type InstancePrototypeInstanceByImageIntf interface { - InstancePrototypeIntf - isaInstancePrototypeInstanceByImage() bool -} - -func (*InstancePrototypeInstanceByImage) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByImage unmarshals an instance of InstancePrototypeInstanceByImage from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByImage) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceBySourceSnapshot : Create an instance by using a snapshot. -// Models which "extend" this model: -// - InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment -// - InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface -// This model "extends" InstancePrototype -type InstancePrototypeInstanceBySourceSnapshot struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototypeInstanceBySourceSnapshot() bool { - return true -} - -type InstancePrototypeInstanceBySourceSnapshotIntf interface { - InstancePrototypeIntf - isaInstancePrototypeInstanceBySourceSnapshot() bool -} - -func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceBySourceSnapshot unmarshals an instance of InstancePrototypeInstanceBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceBySourceSnapshot) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceBySourceTemplate : Create an instance by using an instance template. -// -// The `primary_network_attachment` and `network_attachments` properties may only be specified if -// `primary_network_attachment` is specified in the source template. -// -// The `primary_network_interface` and `network_interfaces` properties may only be specified if -// `primary_network_interface` is specified in the source template. -// This model "extends" InstancePrototype -type InstancePrototypeInstanceBySourceTemplate struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering version to use when provisioning this virtual server instance. - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account, subject to - // IAM policies. - // - // If specified, `image` must not be specified, and `source_template` must not have - // `image` specified. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image,omitempty"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The template to create this virtual server instance from. - SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` -} - -// NewInstancePrototypeInstanceBySourceTemplate : Instantiate InstancePrototypeInstanceBySourceTemplate (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstancePrototypeInstanceBySourceTemplate, err error) { - _model = &InstancePrototypeInstanceBySourceTemplate{ - SourceTemplate: sourceTemplate, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePrototypeInstanceBySourceTemplate) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceBySourceTemplate unmarshals an instance of InstancePrototypeInstanceBySourceTemplate from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceBySourceTemplate) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_template-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByVolume : Create an instance by using a boot volume. -// Models which "extend" this model: -// - InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment -// - InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface -// This model "extends" InstancePrototype -type InstancePrototypeInstanceByVolume struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstancePrototypeInstanceByVolume) isaInstancePrototypeInstanceByVolume() bool { - return true -} - -type InstancePrototypeInstanceByVolumeIntf interface { - InstancePrototypeIntf - isaInstancePrototypeInstanceByVolume() bool -} - -func (*InstancePrototypeInstanceByVolume) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByVolume unmarshals an instance of InstancePrototypeInstanceByVolume from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByVolume) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateIdentityByCRN : InstanceTemplateIdentityByCRN struct -// This model "extends" InstanceTemplateIdentity -type InstanceTemplateIdentityByCRN struct { - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstanceTemplateIdentityByCRN : Instantiate InstanceTemplateIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplateIdentityByCRN(crn string) (_model *InstanceTemplateIdentityByCRN, err error) { - _model = &InstanceTemplateIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceTemplateIdentityByCRN) isaInstanceTemplateIdentity() bool { - return true -} - -// UnmarshalInstanceTemplateIdentityByCRN unmarshals an instance of InstanceTemplateIdentityByCRN from the specified map of raw messages. -func UnmarshalInstanceTemplateIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateIdentityByCRN) - 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 -} - -// InstanceTemplateIdentityByHref : InstanceTemplateIdentityByHref struct -// This model "extends" InstanceTemplateIdentity -type InstanceTemplateIdentityByHref struct { - // The URL for this instance template. - Href *string `json:"href" validate:"required"` -} - -// NewInstanceTemplateIdentityByHref : Instantiate InstanceTemplateIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplateIdentityByHref(href string) (_model *InstanceTemplateIdentityByHref, err error) { - _model = &InstanceTemplateIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceTemplateIdentityByHref) isaInstanceTemplateIdentity() bool { - return true -} - -// UnmarshalInstanceTemplateIdentityByHref unmarshals an instance of InstanceTemplateIdentityByHref from the specified map of raw messages. -func UnmarshalInstanceTemplateIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateIdentityByHref) - 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 -} - -// InstanceTemplateIdentityByID : InstanceTemplateIdentityByID struct -// This model "extends" InstanceTemplateIdentity -type InstanceTemplateIdentityByID struct { - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` -} - -// NewInstanceTemplateIdentityByID : Instantiate InstanceTemplateIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplateIdentityByID(id string) (_model *InstanceTemplateIdentityByID, err error) { - _model = &InstanceTemplateIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceTemplateIdentityByID) isaInstanceTemplateIdentity() bool { - return true -} - -// UnmarshalInstanceTemplateIdentityByID unmarshals an instance of InstanceTemplateIdentityByID from the specified map of raw messages. -func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateIdentityByID) - 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 -} - -// InstanceTemplatePrototypeInstanceTemplateByCatalogOffering : Create an instance template that creates instances by using a catalog offering. -// Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment -// - InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account, subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { - return true -} - -type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingIntf interface { - InstanceTemplatePrototypeIntf - isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOffering from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image. -// Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment -// - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateByImage struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { - return true -} - -type InstanceTemplatePrototypeInstanceTemplateByImageIntf interface { - InstanceTemplatePrototypeIntf - isaInstanceTemplatePrototypeInstanceTemplateByImage() bool -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImage from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateByImage) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot : Create an instance template that creates instances by using a snapshot. -// Models which "extend" this model: -// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment -// - InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { - return true -} - -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotIntf interface { - InstanceTemplatePrototypeIntf - isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Create an instance template from an existing source instance template. -// -// The `primary_network_attachment` and `network_attachments` properties may only be specified if -// `primary_network_attachment` is specified in the source template. -// -// The `primary_network_interface` and `network_interfaces` properties may only be specified if -// `primary_network_interface` is specified in the source template. -// This model "extends" InstanceTemplatePrototype -type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) - // offering version to use when provisioning this virtual server instance. - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account, subject to - // IAM policies. - // - // If specified, `image` must not be specified, and `source_template` must not have - // `image` specified. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image,omitempty"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` - - // The template to create this virtual server instance from. - SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceTemplate (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceTemplate, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceTemplate{ - SourceTemplate: sourceTemplate, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceTemplate from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceTemplate) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_template-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext : Create an instance by using a catalog offering. -// Models which "extend" this model: -// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment -// - InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering - // or offering version to use when provisioning this virtual server instance. - // - // If an offering is specified, the latest version of that offering will be used. - // - // The specified offering or offering version may be in a different account, subject - // to IAM policies. - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { - return true -} - -type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIntf interface { - InstanceTemplateIntf - isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool -} - -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceByImageInstanceTemplateContext : Create an instance by using an image. -// Models which "extend" this model: -// - InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment -// - InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceByImageInstanceTemplateContext struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { - return true -} - -type InstanceTemplateInstanceByImageInstanceTemplateContextIntf interface { - InstanceTemplateIntf - isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool -} - -func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContext from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImageInstanceTemplateContext) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext : Create an instance by using a snapshot. -// Models which "extend" this model: -// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment -// - InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface -// This model "extends" InstanceTemplate -type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} - -func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { - return true -} - -type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIntf interface { - InstanceTemplateIntf - isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool -} - -func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyIdentityByCRN : KeyIdentityByCRN struct -// This model "extends" KeyIdentity -type KeyIdentityByCRN struct { - // The CRN for this key. - CRN *string `json:"crn" validate:"required"` -} - -// NewKeyIdentityByCRN : Instantiate KeyIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewKeyIdentityByCRN(crn string) (_model *KeyIdentityByCRN, err error) { - _model = &KeyIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*KeyIdentityByCRN) isaKeyIdentity() bool { - return true -} - -// UnmarshalKeyIdentityByCRN unmarshals an instance of KeyIdentityByCRN from the specified map of raw messages. -func UnmarshalKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyIdentityByCRN) - 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 -} - -// KeyIdentityByFingerprint : KeyIdentityByFingerprint struct -// This model "extends" KeyIdentity -type KeyIdentityByFingerprint struct { - // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always - // `SHA256`). - Fingerprint *string `json:"fingerprint" validate:"required"` -} - -// NewKeyIdentityByFingerprint : Instantiate KeyIdentityByFingerprint (Generic Model Constructor) -func (*VpcV1) NewKeyIdentityByFingerprint(fingerprint string) (_model *KeyIdentityByFingerprint, err error) { - _model = &KeyIdentityByFingerprint{ - Fingerprint: core.StringPtr(fingerprint), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*KeyIdentityByFingerprint) isaKeyIdentity() bool { - return true -} - -// UnmarshalKeyIdentityByFingerprint unmarshals an instance of KeyIdentityByFingerprint from the specified map of raw messages. -func UnmarshalKeyIdentityByFingerprint(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyIdentityByFingerprint) - err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) - if err != nil { - err = core.SDKErrorf(err, "", "fingerprint-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// KeyIdentityByHref : KeyIdentityByHref struct -// This model "extends" KeyIdentity -type KeyIdentityByHref struct { - // The URL for this key. - Href *string `json:"href" validate:"required"` -} - -// NewKeyIdentityByHref : Instantiate KeyIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewKeyIdentityByHref(href string) (_model *KeyIdentityByHref, err error) { - _model = &KeyIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*KeyIdentityByHref) isaKeyIdentity() bool { - return true -} - -// UnmarshalKeyIdentityByHref unmarshals an instance of KeyIdentityByHref from the specified map of raw messages. -func UnmarshalKeyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyIdentityByHref) - 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 -} - -// KeyIdentityByID : KeyIdentityByID struct -// This model "extends" KeyIdentity -type KeyIdentityByID struct { - // The unique identifier for this key. - ID *string `json:"id" validate:"required"` -} - -// NewKeyIdentityByID : Instantiate KeyIdentityByID (Generic Model Constructor) -func (*VpcV1) NewKeyIdentityByID(id string) (_model *KeyIdentityByID, err error) { - _model = &KeyIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*KeyIdentityByID) isaKeyIdentity() bool { - return true -} - -// UnmarshalKeyIdentityByID unmarshals an instance of KeyIdentityByID from the specified map of raw messages. -func UnmarshalKeyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyIdentityByID) - 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 -} - -// LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct -// This model "extends" LegacyCloudObjectStorageBucketIdentity -type LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName struct { - // The globally unique name of this Cloud Object Storage bucket. - Name *string `json:"name" validate:"required"` -} - -// NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName : Instantiate LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName (Generic Model Constructor) -func (*VpcV1) NewLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(name string) (_model *LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName, err error) { - _model = &LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) isaLegacyCloudObjectStorageBucketIdentity() bool { - return true -} - -// UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName unmarshals an instance of LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName from the specified map of raw messages. -func UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName) - 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 -} - -// LoadBalancerIdentityByCRN : LoadBalancerIdentityByCRN struct -// This model "extends" LoadBalancerIdentity -type LoadBalancerIdentityByCRN struct { - // The load balancer's CRN. - CRN *string `json:"crn" validate:"required"` -} - -// NewLoadBalancerIdentityByCRN : Instantiate LoadBalancerIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerIdentityByCRN(crn string) (_model *LoadBalancerIdentityByCRN, err error) { - _model = &LoadBalancerIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerIdentityByCRN) isaLoadBalancerIdentity() bool { - return true -} - -// UnmarshalLoadBalancerIdentityByCRN unmarshals an instance of LoadBalancerIdentityByCRN from the specified map of raw messages. -func UnmarshalLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerIdentityByCRN) - 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 -} - -// LoadBalancerIdentityByHref : LoadBalancerIdentityByHref struct -// This model "extends" LoadBalancerIdentity -type LoadBalancerIdentityByHref struct { - // The load balancer's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerIdentityByHref : Instantiate LoadBalancerIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerIdentityByHref(href string) (_model *LoadBalancerIdentityByHref, err error) { - _model = &LoadBalancerIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerIdentityByHref) isaLoadBalancerIdentity() bool { - return true -} - -// UnmarshalLoadBalancerIdentityByHref unmarshals an instance of LoadBalancerIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerIdentityByHref) - 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 -} - -// LoadBalancerIdentityByID : LoadBalancerIdentityByID struct -// This model "extends" LoadBalancerIdentity -type LoadBalancerIdentityByID struct { - // The unique identifier for this load balancer. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerIdentityByID : Instantiate LoadBalancerIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerIdentityByID(id string) (_model *LoadBalancerIdentityByID, err error) { - _model = &LoadBalancerIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerIdentityByID) isaLoadBalancerIdentity() bool { - return true -} - -// UnmarshalLoadBalancerIdentityByID unmarshals an instance of LoadBalancerIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerIdentityByID) - 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 -} - -// LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref : LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref struct -// This model "extends" LoadBalancerListenerDefaultPoolPatch -type LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref struct { - // The pool's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerDefaultPoolPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref) - 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 -} - -// LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID : LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID struct -// This model "extends" LoadBalancerListenerDefaultPoolPatch -type LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID) isaLoadBalancerListenerDefaultPoolPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID) - 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 -} - -// LoadBalancerListenerIdentityByHref : LoadBalancerListenerIdentityByHref struct -// This model "extends" LoadBalancerListenerIdentity -type LoadBalancerListenerIdentityByHref struct { - // The listener's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerListenerIdentityByHref : Instantiate LoadBalancerListenerIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerIdentityByHref(href string) (_model *LoadBalancerListenerIdentityByHref, err error) { - _model = &LoadBalancerListenerIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerListenerIdentityByHref) isaLoadBalancerListenerIdentity() bool { - return true -} - -// UnmarshalLoadBalancerListenerIdentityByHref unmarshals an instance of LoadBalancerListenerIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerListenerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerIdentityByHref) - 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 -} - -// LoadBalancerListenerIdentityByID : LoadBalancerListenerIdentityByID struct -// This model "extends" LoadBalancerListenerIdentity -type LoadBalancerListenerIdentityByID struct { - // The unique identifier for this load balancer listener. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerListenerIdentityByID : Instantiate LoadBalancerListenerIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerIdentityByID(id string) (_model *LoadBalancerListenerIdentityByID, err error) { - _model = &LoadBalancerListenerIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerListenerIdentityByID) isaLoadBalancerListenerIdentity() bool { - return true -} - -// UnmarshalLoadBalancerListenerIdentityByID unmarshals an instance of LoadBalancerListenerIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerListenerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerIdentityByID) - 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 -} - -// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch struct -// This model "extends" LoadBalancerListenerPolicyTargetPatch -type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - // Identifies a load balancer listener by a unique property. - Listener LoadBalancerListenerIdentityIntf `json:"listener,omitempty"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct -// This model "extends" LoadBalancerListenerPolicyTargetPatch -type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - - // The redirect target URL. - URL *string `json:"url,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID -// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref -// This model "extends" LoadBalancerListenerPolicyTargetPatch -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { - return true -} - -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityIntf interface { - LoadBalancerListenerPolicyTargetPatchIntf - isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) - 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 -} - -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype struct -// This model "extends" LoadBalancerListenerPolicyTargetPrototype -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - // Identifies a load balancer listener by a unique property. - Listener LoadBalancerListenerIdentityIntf `json:"listener" validate:"required"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype(httpStatusCode int64, listener LoadBalancerListenerIdentityIntf) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype{ - HTTPStatusCode: core.Int64Ptr(httpStatusCode), - Listener: listener, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct -// This model "extends" LoadBalancerListenerPolicyTargetPrototype -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - // The redirect target URL. - URL *string `json:"url" validate:"required"` -} - -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(httpStatusCode int64, url string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype{ - HTTPStatusCode: core.Int64Ptr(httpStatusCode), - URL: core.StringPtr(url), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. -// Models which "extend" this model: -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID -// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref -// This model "extends" LoadBalancerListenerPolicyTargetPrototype -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { - return true -} - -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityIntf interface { - LoadBalancerListenerPolicyTargetPrototypeIntf - isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) - 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 -} - -// LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect : LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect struct -// This model "extends" LoadBalancerListenerPolicyTarget -type LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - Listener *LoadBalancerListenerReference `json:"listener" validate:"required"` - - // The redirect relative target URI. - URI *string `json:"uri,omitempty"` -} - -func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect) isaLoadBalancerListenerPolicyTarget() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyHTTPSRedirect) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) - if err != nil { - err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "uri", &obj.URI) - if err != nil { - err = core.SDKErrorf(err, "", "uri-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL : LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct -// This model "extends" LoadBalancerListenerPolicyTarget -type LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct { - // The HTTP status code for this redirect. - HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - - // The redirect target URL. - URL *string `json:"url" validate:"required"` -} - -func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) isaLoadBalancerListenerPolicyTarget() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) - err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) - if err != nil { - err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetLoadBalancerPoolReference : LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct -// This model "extends" LoadBalancerListenerPolicyTarget -type LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` - - // The pool's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` - - // The name for this load balancer pool. The name is unique across all pools for the load balancer. - Name *string `json:"name" validate:"required"` -} - -func (*LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) isaLoadBalancerListenerPolicyTarget() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerPoolReference from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct -// This model "extends" LoadBalancerPoolIdentity -type LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { - // The pool's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerPoolIdentity() bool { - return true -} - -// UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) - 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 -} - -// LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct -// This model "extends" LoadBalancerPoolIdentity -type LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerPoolIdentity() bool { - return true -} - -// UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - 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 -} - -// LoadBalancerPoolMemberTargetPrototypeIP : LoadBalancerPoolMemberTargetPrototypeIP struct -// This model "extends" LoadBalancerPoolMemberTargetPrototype -type LoadBalancerPoolMemberTargetPrototypeIP struct { - // The IP address. - // - // 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"` -} - -// NewLoadBalancerPoolMemberTargetPrototypeIP : Instantiate LoadBalancerPoolMemberTargetPrototypeIP (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeIP(address string) (_model *LoadBalancerPoolMemberTargetPrototypeIP, err error) { - _model = &LoadBalancerPoolMemberTargetPrototypeIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerPoolMemberTargetPrototypeIP) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototypeIP unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeIP from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. -// Models which "extend" this model: -// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID -// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN -// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref -// This model "extends" LoadBalancerPoolMemberTargetPrototype -type LoadBalancerPoolMemberTargetPrototypeInstanceIdentity struct { - // The unique identifier for this virtual server instance. - ID *string `json:"id,omitempty"` - - // The CRN for this virtual server instance. - CRN *string `json:"crn,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href,omitempty"` -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { - return true -} - -type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityIntf interface { - LoadBalancerPoolMemberTargetPrototypeIntf - isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentity from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTargetIP : LoadBalancerPoolMemberTargetIP struct -// This model "extends" LoadBalancerPoolMemberTarget -type LoadBalancerPoolMemberTargetIP struct { - // The IP address. - // - // 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 (*LoadBalancerPoolMemberTargetIP) isaLoadBalancerPoolMemberTarget() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetIP unmarshals an instance of LoadBalancerPoolMemberTargetIP from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerPoolMemberTargetInstanceReference : LoadBalancerPoolMemberTargetInstanceReference struct -// This model "extends" LoadBalancerPoolMemberTarget -type LoadBalancerPoolMemberTargetInstanceReference struct { - // The CRN for this virtual server instance. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this virtual server instance. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual server instance. - ID *string `json:"id" validate:"required"` - - // The name for this virtual server instance. The name is unique across all virtual server instances in the region. - Name *string `json:"name" validate:"required"` -} - -func (*LoadBalancerPoolMemberTargetInstanceReference) isaLoadBalancerPoolMemberTarget() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetInstanceReference unmarshals an instance of LoadBalancerPoolMemberTargetInstanceReference from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetInstanceReference) - 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, UnmarshalInstanceReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerProfileIdentityByHref : LoadBalancerProfileIdentityByHref struct -// This model "extends" LoadBalancerProfileIdentity -type LoadBalancerProfileIdentityByHref struct { - // The URL for this load balancer profile. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerProfileIdentityByHref : Instantiate LoadBalancerProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerProfileIdentityByHref(href string) (_model *LoadBalancerProfileIdentityByHref, err error) { - _model = &LoadBalancerProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerProfileIdentityByHref) isaLoadBalancerProfileIdentity() bool { - return true -} - -// UnmarshalLoadBalancerProfileIdentityByHref unmarshals an instance of LoadBalancerProfileIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileIdentityByHref) - 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 -} - -// LoadBalancerProfileIdentityByName : LoadBalancerProfileIdentityByName struct -// This model "extends" LoadBalancerProfileIdentity -type LoadBalancerProfileIdentityByName struct { - // The globally unique name for this load balancer profile. - Name *string `json:"name" validate:"required"` -} - -// NewLoadBalancerProfileIdentityByName : Instantiate LoadBalancerProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerProfileIdentityByName(name string) (_model *LoadBalancerProfileIdentityByName, err error) { - _model = &LoadBalancerProfileIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerProfileIdentityByName) isaLoadBalancerProfileIdentity() bool { - return true -} - -// UnmarshalLoadBalancerProfileIdentityByName unmarshals an instance of LoadBalancerProfileIdentityByName from the specified map of raw messages. -func UnmarshalLoadBalancerProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileIdentityByName) - 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 -} - -// LoadBalancerProfileInstanceGroupsSupportedDependent : The instance groups support for a load balancer with this profile depends on its configuration. -// This model "extends" LoadBalancerProfileInstanceGroupsSupported -type LoadBalancerProfileInstanceGroupsSupportedDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileInstanceGroupsSupportedDependent.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileInstanceGroupsSupportedDependentTypeDependentConst = "dependent" -) - -func (*LoadBalancerProfileInstanceGroupsSupportedDependent) isaLoadBalancerProfileInstanceGroupsSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileInstanceGroupsSupportedDependent from the specified map of raw messages. -func UnmarshalLoadBalancerProfileInstanceGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileInstanceGroupsSupportedDependent) - 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 -} - -// LoadBalancerProfileInstanceGroupsSupportedFixed : The instance groups support for a load balancer with this profile. -// This model "extends" LoadBalancerProfileInstanceGroupsSupported -type LoadBalancerProfileInstanceGroupsSupportedFixed 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 LoadBalancerProfileInstanceGroupsSupportedFixed.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileInstanceGroupsSupportedFixedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileInstanceGroupsSupportedFixed) isaLoadBalancerProfileInstanceGroupsSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileInstanceGroupsSupportedFixed from the specified map of raw messages. -func UnmarshalLoadBalancerProfileInstanceGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileInstanceGroupsSupportedFixed) - 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 -} - -// LoadBalancerProfileRouteModeSupportedDependent : The route mode support for a load balancer with this profile depends on its configuration. -// This model "extends" LoadBalancerProfileRouteModeSupported -type LoadBalancerProfileRouteModeSupportedDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileRouteModeSupportedDependent.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileRouteModeSupportedDependentTypeDependentConst = "dependent" -) - -func (*LoadBalancerProfileRouteModeSupportedDependent) isaLoadBalancerProfileRouteModeSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileRouteModeSupportedDependent unmarshals an instance of LoadBalancerProfileRouteModeSupportedDependent from the specified map of raw messages. -func UnmarshalLoadBalancerProfileRouteModeSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileRouteModeSupportedDependent) - 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 -} - -// LoadBalancerProfileRouteModeSupportedFixed : The route mode support for a load balancer with this profile. -// This model "extends" LoadBalancerProfileRouteModeSupported -type LoadBalancerProfileRouteModeSupportedFixed 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 LoadBalancerProfileRouteModeSupportedFixed.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileRouteModeSupportedFixedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileRouteModeSupportedFixed) isaLoadBalancerProfileRouteModeSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileRouteModeSupportedFixed unmarshals an instance of LoadBalancerProfileRouteModeSupportedFixed from the specified map of raw messages. -func UnmarshalLoadBalancerProfileRouteModeSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileRouteModeSupportedFixed) - 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 -} - -// LoadBalancerProfileSecurityGroupsSupportedDependent : The security group support for a load balancer with this profile depends on its configuration. -// This model "extends" LoadBalancerProfileSecurityGroupsSupported -type LoadBalancerProfileSecurityGroupsSupportedDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileSecurityGroupsSupportedDependent.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileSecurityGroupsSupportedDependentTypeDependentConst = "dependent" -) - -func (*LoadBalancerProfileSecurityGroupsSupportedDependent) isaLoadBalancerProfileSecurityGroupsSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedDependent from the specified map of raw messages. -func UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileSecurityGroupsSupportedDependent) - 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 -} - -// LoadBalancerProfileSecurityGroupsSupportedFixed : The security group support for a load balancer with this profile. -// This model "extends" LoadBalancerProfileSecurityGroupsSupported -type LoadBalancerProfileSecurityGroupsSupportedFixed 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 LoadBalancerProfileSecurityGroupsSupportedFixed.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileSecurityGroupsSupportedFixedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileSecurityGroupsSupportedFixed) isaLoadBalancerProfileSecurityGroupsSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedFixed from the specified map of raw messages. -func UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileSecurityGroupsSupportedFixed) - 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 -} - -// LoadBalancerProfileUDPSupportedDependent : The UDP support for a load balancer with this profile depends on its configuration. -// This model "extends" LoadBalancerProfileUDPSupported -type LoadBalancerProfileUDPSupportedDependent struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the LoadBalancerProfileUDPSupportedDependent.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileUDPSupportedDependentTypeDependentConst = "dependent" -) - -func (*LoadBalancerProfileUDPSupportedDependent) isaLoadBalancerProfileUDPSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileUDPSupportedDependent unmarshals an instance of LoadBalancerProfileUDPSupportedDependent from the specified map of raw messages. -func UnmarshalLoadBalancerProfileUDPSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileUDPSupportedDependent) - 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 -} - -// LoadBalancerProfileUDPSupportedFixed : The UDP support for a load balancer with this profile. -// This model "extends" LoadBalancerProfileUDPSupported -type LoadBalancerProfileUDPSupportedFixed 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 LoadBalancerProfileUDPSupportedFixed.Type property. -// The type for this profile field. -const ( - LoadBalancerProfileUDPSupportedFixedTypeFixedConst = "fixed" -) - -func (*LoadBalancerProfileUDPSupportedFixed) isaLoadBalancerProfileUDPSupported() bool { - return true -} - -// UnmarshalLoadBalancerProfileUDPSupportedFixed unmarshals an instance of LoadBalancerProfileUDPSupportedFixed from the specified map of raw messages. -func UnmarshalLoadBalancerProfileUDPSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerProfileUDPSupportedFixed) - 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 -} - -// NetworkACLIdentityByCRN : NetworkACLIdentityByCRN struct -// This model "extends" NetworkACLIdentity -type NetworkACLIdentityByCRN struct { - // The CRN for this network ACL. - CRN *string `json:"crn" validate:"required"` -} - -// NewNetworkACLIdentityByCRN : Instantiate NetworkACLIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewNetworkACLIdentityByCRN(crn string) (_model *NetworkACLIdentityByCRN, err error) { - _model = &NetworkACLIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLIdentityByCRN) isaNetworkACLIdentity() bool { - return true -} - -// UnmarshalNetworkACLIdentityByCRN unmarshals an instance of NetworkACLIdentityByCRN from the specified map of raw messages. -func UnmarshalNetworkACLIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLIdentityByCRN) - 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 -} - -// NetworkACLIdentityByHref : NetworkACLIdentityByHref struct -// This model "extends" NetworkACLIdentity -type NetworkACLIdentityByHref struct { - // The URL for this network ACL. - Href *string `json:"href" validate:"required"` -} - -// NewNetworkACLIdentityByHref : Instantiate NetworkACLIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewNetworkACLIdentityByHref(href string) (_model *NetworkACLIdentityByHref, err error) { - _model = &NetworkACLIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLIdentityByHref) isaNetworkACLIdentity() bool { - return true -} - -// UnmarshalNetworkACLIdentityByHref unmarshals an instance of NetworkACLIdentityByHref from the specified map of raw messages. -func UnmarshalNetworkACLIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLIdentityByHref) - 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 -} - -// NetworkACLIdentityByID : NetworkACLIdentityByID struct -// This model "extends" NetworkACLIdentity -type NetworkACLIdentityByID struct { - // The unique identifier for this network ACL. - ID *string `json:"id" validate:"required"` -} - -// NewNetworkACLIdentityByID : Instantiate NetworkACLIdentityByID (Generic Model Constructor) -func (*VpcV1) NewNetworkACLIdentityByID(id string) (_model *NetworkACLIdentityByID, err error) { - _model = &NetworkACLIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLIdentityByID) isaNetworkACLIdentity() bool { - return true -} - -// UnmarshalNetworkACLIdentityByID unmarshals an instance of NetworkACLIdentityByID from the specified map of raw messages. -func UnmarshalNetworkACLIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLIdentityByID) - 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 -} - -// NetworkACLPrototypeNetworkACLByRules : NetworkACLPrototypeNetworkACLByRules struct -// This model "extends" NetworkACLPrototype -type NetworkACLPrototypeNetworkACLByRules struct { - // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The VPC this network ACL will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The prototype objects for rules to create along with this network ACL. If unspecified, no rules will be created, - // resulting in all traffic being denied. - Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` -} - -// NewNetworkACLPrototypeNetworkACLByRules : Instantiate NetworkACLPrototypeNetworkACLByRules (Generic Model Constructor) -func (*VpcV1) NewNetworkACLPrototypeNetworkACLByRules(vpc VPCIdentityIntf) (_model *NetworkACLPrototypeNetworkACLByRules, err error) { - _model = &NetworkACLPrototypeNetworkACLByRules{ - VPC: vpc, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLPrototypeNetworkACLByRules) isaNetworkACLPrototype() bool { - return true -} - -// UnmarshalNetworkACLPrototypeNetworkACLByRules unmarshals an instance of NetworkACLPrototypeNetworkACLByRules from the specified map of raw messages. -func UnmarshalNetworkACLPrototypeNetworkACLByRules(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLPrototypeNetworkACLByRules) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) - if err != nil { - err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLPrototypeNetworkACLBySourceNetworkACL : NetworkACLPrototypeNetworkACLBySourceNetworkACL struct -// This model "extends" NetworkACLPrototype -type NetworkACLPrototypeNetworkACLBySourceNetworkACL struct { - // The name for this network ACL. The name must not be used by another network ACL for the VPC. If unspecified, the - // name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The VPC this network ACL will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // Network ACL to copy rules from. - SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl" validate:"required"` -} - -// NewNetworkACLPrototypeNetworkACLBySourceNetworkACL : Instantiate NetworkACLPrototypeNetworkACLBySourceNetworkACL (Generic Model Constructor) -func (*VpcV1) NewNetworkACLPrototypeNetworkACLBySourceNetworkACL(vpc VPCIdentityIntf, sourceNetworkACL NetworkACLIdentityIntf) (_model *NetworkACLPrototypeNetworkACLBySourceNetworkACL, err error) { - _model = &NetworkACLPrototypeNetworkACLBySourceNetworkACL{ - VPC: vpc, - SourceNetworkACL: sourceNetworkACL, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLPrototypeNetworkACLBySourceNetworkACL) isaNetworkACLPrototype() bool { - return true -} - -// UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL unmarshals an instance of NetworkACLPrototypeNetworkACLBySourceNetworkACL from the specified map of raw messages. -func UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLPrototypeNetworkACLBySourceNetworkACL) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_network_acl-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct -// This model "extends" NetworkACLRuleBeforePatch -type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct { - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` -} - -// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(href string) (_model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref, err error) { - _model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePatch() bool { - return true -} - -// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) - 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 -} - -// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct -// This model "extends" NetworkACLRuleBeforePatch -type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct { - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` -} - -// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(id string) (_model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID, err error) { - _model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePatch() bool { - return true -} - -// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) - 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 -} - -// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct -// This model "extends" NetworkACLRuleBeforePrototype -type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct { - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` -} - -// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(href string) (_model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref, err error) { - _model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePrototype() bool { - return true -} - -// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) - 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 -} - -// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct -// This model "extends" NetworkACLRuleBeforePrototype -type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct { - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` -} - -// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(id string) (_model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID, err error) { - _model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePrototype() bool { - return true -} - -// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID from the specified map of raw messages. -func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) - 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 -} - -// NetworkACLRuleItemNetworkACLRuleProtocolAll : NetworkACLRuleItemNetworkACLRuleProtocolAll struct -// This model "extends" NetworkACLRuleItem -type NetworkACLRuleItemNetworkACLRuleProtocolAll struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the - // collection. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolAllActionAllowConst = "allow" - NetworkACLRuleItemNetworkACLRuleProtocolAllActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" - NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolAllProtocolAllConst = "all" -) - -func (*NetworkACLRuleItemNetworkACLRuleProtocolAll) isaNetworkACLRuleItem() bool { - return true -} - -// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolAll from the specified map of raw messages. -func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleItemNetworkACLRuleProtocolAll) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) - if err != nil { - err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) - if err != nil { - err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) - if err != nil { - err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleItemNetworkACLRuleProtocolIcmp : NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct -// This model "extends" NetworkACLRuleItem -type NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the - // collection. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The ICMP traffic code to match. - // - // If absent, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The ICMP traffic type to match. - // - // If absent, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionAllowConst = "allow" - NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" - NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" -) - -func (*NetworkACLRuleItemNetworkACLRuleProtocolIcmp) isaNetworkACLRuleItem() bool { - return true -} - -// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolIcmp from the specified map of raw messages. -func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleItemNetworkACLRuleProtocolIcmp) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) - if err != nil { - err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) - if err != nil { - err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) - if err != nil { - err = core.SDKErrorf(err, "", "source-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, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-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 -} - -// NetworkACLRuleItemNetworkACLRuleProtocolTcpudp : NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct -// This model "extends" NetworkACLRuleItem -type NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the - // collection. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max" validate:"required"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min" validate:"required"` -} - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" - NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" -) - -func (*NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) isaNetworkACLRuleItem() bool { - return true -} - -// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolTcpudp from the specified map of raw messages. -func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) - if err != nil { - err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) - if err != nil { - err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) - if err != nil { - err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) - if err != nil { - err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) - if err != nil { - err = core.SDKErrorf(err, "", "destination_port_min-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.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) - if err != nil { - err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) - if err != nil { - err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype struct -// This model "extends" NetworkACLRulePrototypeNetworkACLContext -type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" -) - -// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { - return true -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-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, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) - return - } - 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, "source", &obj.Source) - if err != nil { - err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype struct -// This model "extends" NetworkACLRulePrototypeNetworkACLContext -type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The ICMP traffic code to match. - // - // If specified, `type` must also be specified. If unspecified, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The ICMP traffic type to match. - // - // If unspecified, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" -) - -// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { - return true -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-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, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) - return - } - 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, "source", &obj.Source) - if err != nil { - err = core.SDKErrorf(err, "", "source-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, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-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 -} - -// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype struct -// This model "extends" NetworkACLRulePrototypeNetworkACLContext -type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` -} - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" -) - -// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) isaNetworkACLRulePrototypeNetworkACLContext() bool { - return true -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-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, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) - return - } - 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, "source", &obj.Source) - if err != nil { - err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) - if err != nil { - err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) - if err != nil { - err = core.SDKErrorf(err, "", "destination_port_min-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.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) - if err != nil { - err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) - if err != nil { - err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct -// This model "extends" NetworkACLRulePrototype -type NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" -) - -// NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) isaNetworkACLRulePrototype() bool { - return true -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "before-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, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) - return - } - 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, "source", &obj.Source) - if err != nil { - err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct -// This model "extends" NetworkACLRulePrototype -type NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The ICMP traffic code to match. - // - // If specified, `type` must also be specified. If unspecified, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The ICMP traffic type to match. - // - // If unspecified, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" -) - -// NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) isaNetworkACLRulePrototype() bool { - return true -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "before-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, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) - return - } - 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, "source", &obj.Source) - if err != nil { - err = core.SDKErrorf(err, "", "source-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, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-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 -} - -// NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype : NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct -// This model "extends" NetworkACLRulePrototype -type NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this network ACL rule. The name must not be used by another rule for the network ACL. If unspecified, - // the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min,omitempty"` -} - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeActionAllowConst = "allow" - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionInboundConst = "inbound" - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" -) - -// NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype (Generic Model Constructor) -func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(action string, destination string, direction string, source string, protocol string) (_model *NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype, err error) { - _model = &NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype{ - Action: core.StringPtr(action), - Destination: core.StringPtr(destination), - Direction: core.StringPtr(direction), - Source: core.StringPtr(source), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) isaNetworkACLRulePrototype() bool { - return true -} - -// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype from the specified map of raw messages. -func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "before-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, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) - return - } - 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, "source", &obj.Source) - if err != nil { - err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) - if err != nil { - err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) - if err != nil { - err = core.SDKErrorf(err, "", "destination_port_min-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.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) - if err != nil { - err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) - if err != nil { - err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleNetworkACLRuleProtocolAll : NetworkACLRuleNetworkACLRuleProtocolAll struct -// This model "extends" NetworkACLRule -type NetworkACLRuleNetworkACLRuleProtocolAll struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolAllActionAllowConst = "allow" - NetworkACLRuleNetworkACLRuleProtocolAllActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" - NetworkACLRuleNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleNetworkACLRuleProtocolAllProtocolAllConst = "all" -) - -func (*NetworkACLRuleNetworkACLRuleProtocolAll) isaNetworkACLRule() bool { - return true -} - -// UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolAll from the specified map of raw messages. -func UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleNetworkACLRuleProtocolAll) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) - if err != nil { - err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) - if err != nil { - err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) - if err != nil { - err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkACLRuleNetworkACLRuleProtocolIcmp : NetworkACLRuleNetworkACLRuleProtocolIcmp struct -// This model "extends" NetworkACLRule -type NetworkACLRuleNetworkACLRuleProtocolIcmp struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The ICMP traffic code to match. - // - // If absent, all codes are matched. - Code *int64 `json:"code,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The ICMP traffic type to match. - // - // If absent, all types are matched. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolIcmpActionAllowConst = "allow" - NetworkACLRuleNetworkACLRuleProtocolIcmpActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" - NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" -) - -func (*NetworkACLRuleNetworkACLRuleProtocolIcmp) isaNetworkACLRule() bool { - return true -} - -// UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolIcmp from the specified map of raw messages. -func UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleNetworkACLRuleProtocolIcmp) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) - if err != nil { - err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) - if err != nil { - err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) - if err != nil { - err = core.SDKErrorf(err, "", "source-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, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-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 -} - -// NetworkACLRuleNetworkACLRuleProtocolTcpudp : NetworkACLRuleNetworkACLRuleProtocolTcpudp struct -// This model "extends" NetworkACLRule -type NetworkACLRuleNetworkACLRuleProtocolTcpudp struct { - // The action to perform for a packet matching the rule. - Action *string `json:"action" validate:"required"` - - // The rule that this rule is immediately before. If absent, this is the last rule. - Before *NetworkACLRuleReference `json:"before,omitempty"` - - // The date and time that the rule was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The destination IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all destination addresses. - Destination *string `json:"destination" validate:"required"` - - // The direction of traffic to match. - Direction *string `json:"direction" validate:"required"` - - // The URL for this network ACL rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this network ACL rule. - ID *string `json:"id" validate:"required"` - - // The IP version for this rule. - IPVersion *string `json:"ip_version" validate:"required"` - - // The name for this network ACL rule. The name is unique across all rules for the network ACL. - Name *string `json:"name" validate:"required"` - - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. - Source *string `json:"source" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - DestinationPortMax *int64 `json:"destination_port_max" validate:"required"` - - // The inclusive lower bound of TCP/UDP destination port range. - DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The inclusive upper bound of TCP/UDP source port range. - SourcePortMax *int64 `json:"source_port_max" validate:"required"` - - // The inclusive lower bound of TCP/UDP source port range. - SourcePortMin *int64 `json:"source_port_min" validate:"required"` -} - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Action property. -// The action to perform for a packet matching the rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" - NetworkACLRuleNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Direction property. -// The direction of traffic to match. -const ( - NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" - NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.IPVersion property. -// The IP version for this rule. -const ( - NetworkACLRuleNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. -const ( - NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" - NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" -) - -func (*NetworkACLRuleNetworkACLRuleProtocolTcpudp) isaNetworkACLRule() bool { - return true -} - -// UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolTcpudp from the specified map of raw messages. -func UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleNetworkACLRuleProtocolTcpudp) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) - if err != nil { - err = core.SDKErrorf(err, "", "before-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, "destination", &obj.Destination) - if err != nil { - err = core.SDKErrorf(err, "", "destination-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-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, "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, "source", &obj.Source) - if err != nil { - err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) - if err != nil { - err = core.SDKErrorf(err, "", "destination_port_max-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) - if err != nil { - err = core.SDKErrorf(err, "", "destination_port_min-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.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) - if err != nil { - err = core.SDKErrorf(err, "", "source_port_max-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) - if err != nil { - err = core.SDKErrorf(err, "", "source_port_min-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetworkInterfaceIPPrototypeReservedIPIdentity : Identifies a reserved IP by a unique property. -// Models which "extend" this model: -// - NetworkInterfaceIPPrototypeReservedIPIdentityByID -// - NetworkInterfaceIPPrototypeReservedIPIdentityByHref -// This model "extends" NetworkInterfaceIPPrototype -type NetworkInterfaceIPPrototypeReservedIPIdentity struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` -} - -func (*NetworkInterfaceIPPrototypeReservedIPIdentity) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { - return true -} - -type NetworkInterfaceIPPrototypeReservedIPIdentityIntf interface { - NetworkInterfaceIPPrototypeIntf - isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool -} - -func (*NetworkInterfaceIPPrototypeReservedIPIdentity) isaNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentity from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototypeReservedIPIdentity) - 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 -} - -// NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext : NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext struct -// This model "extends" NetworkInterfaceIPPrototype -type NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext 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 reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) isaNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototypeReservedIPPrototypeNetworkInterfaceContext) - 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 -} - -// OperatingSystemIdentityByHref : OperatingSystemIdentityByHref struct -// This model "extends" OperatingSystemIdentity -type OperatingSystemIdentityByHref struct { - // The URL for this operating system. - Href *string `json:"href" validate:"required"` -} - -// NewOperatingSystemIdentityByHref : Instantiate OperatingSystemIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewOperatingSystemIdentityByHref(href string) (_model *OperatingSystemIdentityByHref, err error) { - _model = &OperatingSystemIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*OperatingSystemIdentityByHref) isaOperatingSystemIdentity() bool { - return true -} - -// UnmarshalOperatingSystemIdentityByHref unmarshals an instance of OperatingSystemIdentityByHref from the specified map of raw messages. -func UnmarshalOperatingSystemIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemIdentityByHref) - 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 -} - -// OperatingSystemIdentityByName : OperatingSystemIdentityByName struct -// This model "extends" OperatingSystemIdentity -type OperatingSystemIdentityByName struct { - // The globally unique name for this operating system. - Name *string `json:"name" validate:"required"` -} - -// NewOperatingSystemIdentityByName : Instantiate OperatingSystemIdentityByName (Generic Model Constructor) -func (*VpcV1) NewOperatingSystemIdentityByName(name string) (_model *OperatingSystemIdentityByName, err error) { - _model = &OperatingSystemIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*OperatingSystemIdentityByName) isaOperatingSystemIdentity() bool { - return true -} - -// UnmarshalOperatingSystemIdentityByName unmarshals an instance of OperatingSystemIdentityByName from the specified map of raw messages. -func UnmarshalOperatingSystemIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatingSystemIdentityByName) - 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 -} - -// PublicGatewayFloatingIPPrototypeFloatingIPIdentity : Identifies a floating IP by a unique property. -// Models which "extend" this model: -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref -// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress -// This model "extends" PublicGatewayFloatingIPPrototype -type PublicGatewayFloatingIPPrototypeFloatingIPIdentity struct { - // The unique identifier for this floating IP. - ID *string `json:"id,omitempty"` - - // The CRN for this floating IP. - CRN *string `json:"crn,omitempty"` - - // The URL for this floating IP. - Href *string `json:"href,omitempty"` - - // The globally unique IP address. - Address *string `json:"address,omitempty"` -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { - return true -} - -type PublicGatewayFloatingIPPrototypeFloatingIPIdentityIntf interface { - PublicGatewayFloatingIPPrototypeIntf - isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototype() bool { - return true -} - -// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentity from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext : PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct -// This model "extends" PublicGatewayFloatingIPPrototype -type PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct { - // The name for this floating IP. The name must not be used by another floating IP in the region. 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"` -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) isaPublicGatewayFloatingIPPrototype() bool { - return true -} - -// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayIdentityPublicGatewayIdentityByCRN : PublicGatewayIdentityPublicGatewayIdentityByCRN struct -// This model "extends" PublicGatewayIdentity -type PublicGatewayIdentityPublicGatewayIdentityByCRN struct { - // The CRN for this public gateway. - CRN *string `json:"crn" validate:"required"` -} - -// NewPublicGatewayIdentityPublicGatewayIdentityByCRN : Instantiate PublicGatewayIdentityPublicGatewayIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByCRN(crn string) (_model *PublicGatewayIdentityPublicGatewayIdentityByCRN, err error) { - _model = &PublicGatewayIdentityPublicGatewayIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*PublicGatewayIdentityPublicGatewayIdentityByCRN) isaPublicGatewayIdentity() bool { - return true -} - -// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByCRN from the specified map of raw messages. -func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayIdentityPublicGatewayIdentityByCRN) - 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 -} - -// PublicGatewayIdentityPublicGatewayIdentityByHref : PublicGatewayIdentityPublicGatewayIdentityByHref struct -// This model "extends" PublicGatewayIdentity -type PublicGatewayIdentityPublicGatewayIdentityByHref struct { - // The URL for this public gateway. - Href *string `json:"href" validate:"required"` -} - -// NewPublicGatewayIdentityPublicGatewayIdentityByHref : Instantiate PublicGatewayIdentityPublicGatewayIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByHref(href string) (_model *PublicGatewayIdentityPublicGatewayIdentityByHref, err error) { - _model = &PublicGatewayIdentityPublicGatewayIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*PublicGatewayIdentityPublicGatewayIdentityByHref) isaPublicGatewayIdentity() bool { - return true -} - -// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByHref from the specified map of raw messages. -func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayIdentityPublicGatewayIdentityByHref) - 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 -} - -// PublicGatewayIdentityPublicGatewayIdentityByID : PublicGatewayIdentityPublicGatewayIdentityByID struct -// This model "extends" PublicGatewayIdentity -type PublicGatewayIdentityPublicGatewayIdentityByID struct { - // The unique identifier for this public gateway. - ID *string `json:"id" validate:"required"` -} - -// NewPublicGatewayIdentityPublicGatewayIdentityByID : Instantiate PublicGatewayIdentityPublicGatewayIdentityByID (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayIdentityPublicGatewayIdentityByID(id string) (_model *PublicGatewayIdentityPublicGatewayIdentityByID, err error) { - _model = &PublicGatewayIdentityPublicGatewayIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*PublicGatewayIdentityPublicGatewayIdentityByID) isaPublicGatewayIdentity() bool { - return true -} - -// UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID unmarshals an instance of PublicGatewayIdentityPublicGatewayIdentityByID from the specified map of raw messages. -func UnmarshalPublicGatewayIdentityPublicGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayIdentityPublicGatewayIdentityByID) - 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 -} - -// RegionIdentityByHref : RegionIdentityByHref struct -// This model "extends" RegionIdentity -type RegionIdentityByHref struct { - // The URL for this region. - Href *string `json:"href" validate:"required"` -} - -// NewRegionIdentityByHref : Instantiate RegionIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewRegionIdentityByHref(href string) (_model *RegionIdentityByHref, err error) { - _model = &RegionIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RegionIdentityByHref) isaRegionIdentity() bool { - return true -} - -// UnmarshalRegionIdentityByHref unmarshals an instance of RegionIdentityByHref from the specified map of raw messages. -func UnmarshalRegionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionIdentityByHref) - 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 -} - -// RegionIdentityByName : RegionIdentityByName struct -// This model "extends" RegionIdentity -type RegionIdentityByName struct { - // The globally unique name for this region. - Name *string `json:"name" validate:"required"` -} - -// NewRegionIdentityByName : Instantiate RegionIdentityByName (Generic Model Constructor) -func (*VpcV1) NewRegionIdentityByName(name string) (_model *RegionIdentityByName, err error) { - _model = &RegionIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RegionIdentityByName) isaRegionIdentity() bool { - return true -} - -// UnmarshalRegionIdentityByName unmarshals an instance of RegionIdentityByName from the specified map of raw messages. -func UnmarshalRegionIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegionIdentityByName) - 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 -} - -// ReservationIdentityByCRN : ReservationIdentityByCRN struct -// This model "extends" ReservationIdentity -type ReservationIdentityByCRN struct { - // The CRN for this reservation. - CRN *string `json:"crn" validate:"required"` -} - -// NewReservationIdentityByCRN : Instantiate ReservationIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewReservationIdentityByCRN(crn string) (_model *ReservationIdentityByCRN, err error) { - _model = &ReservationIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ReservationIdentityByCRN) isaReservationIdentity() bool { - return true -} - -// UnmarshalReservationIdentityByCRN unmarshals an instance of ReservationIdentityByCRN from the specified map of raw messages. -func UnmarshalReservationIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationIdentityByCRN) - 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 -} - -// ReservationIdentityByHref : ReservationIdentityByHref struct -// This model "extends" ReservationIdentity -type ReservationIdentityByHref struct { - // The URL for this reservation. - Href *string `json:"href" validate:"required"` -} - -// NewReservationIdentityByHref : Instantiate ReservationIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewReservationIdentityByHref(href string) (_model *ReservationIdentityByHref, err error) { - _model = &ReservationIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ReservationIdentityByHref) isaReservationIdentity() bool { - return true -} - -// UnmarshalReservationIdentityByHref unmarshals an instance of ReservationIdentityByHref from the specified map of raw messages. -func UnmarshalReservationIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationIdentityByHref) - 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 -} - -// ReservationIdentityByID : ReservationIdentityByID struct -// This model "extends" ReservationIdentity -type ReservationIdentityByID struct { - // The unique identifier for this reservation. - ID *string `json:"id" validate:"required"` -} - -// NewReservationIdentityByID : Instantiate ReservationIdentityByID (Generic Model Constructor) -func (*VpcV1) NewReservationIdentityByID(id string) (_model *ReservationIdentityByID, err error) { - _model = &ReservationIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ReservationIdentityByID) isaReservationIdentity() bool { - return true -} - -// UnmarshalReservationIdentityByID unmarshals an instance of ReservationIdentityByID from the specified map of raw messages. -func UnmarshalReservationIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationIdentityByID) - 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 -} - -// ReservedIPTargetPrototypeEndpointGatewayIdentity : ReservedIPTargetPrototypeEndpointGatewayIdentity struct -// Models which "extend" this model: -// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID -// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN -// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref -// This model "extends" ReservedIPTargetPrototype -type ReservedIPTargetPrototypeEndpointGatewayIdentity struct { - // The unique identifier for this endpoint gateway. - ID *string `json:"id,omitempty"` - - // The CRN for this endpoint gateway. - CRN *string `json:"crn,omitempty"` - - // The URL for this endpoint gateway. - Href *string `json:"href,omitempty"` -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { - return true -} - -type ReservedIPTargetPrototypeEndpointGatewayIdentityIntf interface { - ReservedIPTargetPrototypeIntf - isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentity from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" ReservedIPTargetPrototype -type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity struct { - // 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"` -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityIntf interface { - ReservedIPTargetPrototypeIntf - isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity) - 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 - } - 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 -} - -// ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext : ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // 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 name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext.ResourceType property. -// The resource type. -const ( - ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext from the specified map of raw messages. -func UnmarshalReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) - 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 -} - -// ReservedIPTargetEndpointGatewayReference : ReservedIPTargetEndpointGatewayReference struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetEndpointGatewayReference struct { - // The CRN for this endpoint gateway. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this endpoint gateway. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this endpoint gateway. - ID *string `json:"id" validate:"required"` - - // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetEndpointGatewayReference.ResourceType property. -// The resource type. -const ( - ReservedIPTargetEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" -) - -func (*ReservedIPTargetEndpointGatewayReference) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetEndpointGatewayReference unmarshals an instance of ReservedIPTargetEndpointGatewayReference from the specified map of raw messages. -func UnmarshalReservedIPTargetEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetEndpointGatewayReference) - 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, UnmarshalEndpointGatewayReferenceDeleted) - 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 -} - -// ReservedIPTargetGenericResourceReference : Identifying information for a resource that is not native to the VPC API. -// This model "extends" ReservedIPTarget -type ReservedIPTargetGenericResourceReference struct { - // The CRN for the resource. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *GenericResourceReferenceDeleted `json:"deleted,omitempty"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetGenericResourceReference.ResourceType property. -// The resource type. -const ( - ReservedIPTargetGenericResourceReferenceResourceTypeCloudResourceConst = "cloud_resource" -) - -func (*ReservedIPTargetGenericResourceReference) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetGenericResourceReference unmarshals an instance of ReservedIPTargetGenericResourceReference from the specified map of raw messages. -func UnmarshalReservedIPTargetGenericResourceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetGenericResourceReference) - 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, UnmarshalGenericResourceReferenceDeleted) - if err != nil { - err = core.SDKErrorf(err, "", "deleted-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 -} - -// ReservedIPTargetLoadBalancerReference : ReservedIPTargetLoadBalancerReference struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetLoadBalancerReference struct { - // The load balancer's CRN. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` - - // The load balancer's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer. - ID *string `json:"id" validate:"required"` - - // The name for this load balancer. The name is unique across all load balancers in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetLoadBalancerReference.ResourceType property. -// The resource type. -const ( - ReservedIPTargetLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" -) - -func (*ReservedIPTargetLoadBalancerReference) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetLoadBalancerReference unmarshals an instance of ReservedIPTargetLoadBalancerReference from the specified map of raw messages. -func UnmarshalReservedIPTargetLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetLoadBalancerReference) - 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, UnmarshalLoadBalancerReferenceDeleted) - 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 -} - -// ReservedIPTargetNetworkInterfaceReferenceTargetContext : ReservedIPTargetNetworkInterfaceReferenceTargetContext struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - // - // If this instance 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 instance network interface. - // - // If this instance 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 name for this instance network interface. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetNetworkInterfaceReferenceTargetContext.ResourceType property. -// The resource type. -const ( - ReservedIPTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*ReservedIPTargetNetworkInterfaceReferenceTargetContext) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. -func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) - 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 -} - -// ReservedIPTargetVPNGatewayReference : ReservedIPTargetVPNGatewayReference struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetVPNGatewayReference struct { - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The VPN gateway's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway. - ID *string `json:"id" validate:"required"` - - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetVPNGatewayReference.ResourceType property. -// The resource type. -const ( - ReservedIPTargetVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" -) - -func (*ReservedIPTargetVPNGatewayReference) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetVPNGatewayReference unmarshals an instance of ReservedIPTargetVPNGatewayReference from the specified map of raw messages. -func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetVPNGatewayReference) - 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, UnmarshalVPNGatewayReferenceDeleted) - 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 -} - -// ReservedIPTargetVPNServerReference : ReservedIPTargetVPNServerReference struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetVPNServerReference struct { - // The CRN for this VPN server. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this VPN server. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN server. - ID *string `json:"id" validate:"required"` - - // The name for this VPN server. The name is unique across all VPN servers in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetVPNServerReference.ResourceType property. -// The resource type. -const ( - ReservedIPTargetVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" -) - -func (*ReservedIPTargetVPNServerReference) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetVPNServerReference unmarshals an instance of ReservedIPTargetVPNServerReference from the specified map of raw messages. -func UnmarshalReservedIPTargetVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetVPNServerReference) - 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, UnmarshalVPNServerReferenceDeleted) - 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 -} - -// ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext : ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` - - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` - - // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext.ResourceType property. -// The resource type. -const ( - ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContextResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" -) - -func (*ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext) isaReservedIPTarget() bool { - return true -} - -// UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext unmarshals an instance of ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext from the specified map of raw messages. -func UnmarshalReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetVirtualNetworkInterfaceReferenceReservedIPTargetContext) - 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) - 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 -} - -// ResourceGroupIdentityByID : ResourceGroupIdentityByID struct -// This model "extends" ResourceGroupIdentity -type ResourceGroupIdentityByID struct { - // The unique identifier for this resource group. - ID *string `json:"id" validate:"required"` -} - -// NewResourceGroupIdentityByID : Instantiate ResourceGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewResourceGroupIdentityByID(id string) (_model *ResourceGroupIdentityByID, err error) { - _model = &ResourceGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ResourceGroupIdentityByID) isaResourceGroupIdentity() bool { - return true -} - -// UnmarshalResourceGroupIdentityByID unmarshals an instance of ResourceGroupIdentityByID from the specified map of raw messages. -func UnmarshalResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResourceGroupIdentityByID) - 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 -} - -// RouteCreatorVPNGatewayReference : RouteCreatorVPNGatewayReference struct -// This model "extends" RouteCreator -type RouteCreatorVPNGatewayReference struct { - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The VPN gateway's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway. - ID *string `json:"id" validate:"required"` - - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the RouteCreatorVPNGatewayReference.ResourceType property. -// The resource type. -const ( - RouteCreatorVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" -) - -func (*RouteCreatorVPNGatewayReference) isaRouteCreator() bool { - return true -} - -// UnmarshalRouteCreatorVPNGatewayReference unmarshals an instance of RouteCreatorVPNGatewayReference from the specified map of raw messages. -func UnmarshalRouteCreatorVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCreatorVPNGatewayReference) - 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, UnmarshalVPNGatewayReferenceDeleted) - 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 -} - -// RouteCreatorVPNServerReference : RouteCreatorVPNServerReference struct -// This model "extends" RouteCreator -type RouteCreatorVPNServerReference struct { - // The CRN for this VPN server. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this VPN server. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN server. - ID *string `json:"id" validate:"required"` - - // The name for this VPN server. The name is unique across all VPN servers in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the RouteCreatorVPNServerReference.ResourceType property. -// The resource type. -const ( - RouteCreatorVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" -) - -func (*RouteCreatorVPNServerReference) isaRouteCreator() bool { - return true -} - -// UnmarshalRouteCreatorVPNServerReference unmarshals an instance of RouteCreatorVPNServerReference from the specified map of raw messages. -func UnmarshalRouteCreatorVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteCreatorVPNServerReference) - 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, UnmarshalVPNServerReferenceDeleted) - 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 -} - -// RouteNextHopIP : RouteNextHopIP struct -// This model "extends" RouteNextHop -type RouteNextHopIP struct { - // The IP address. - // - // 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 (*RouteNextHopIP) isaRouteNextHop() bool { - return true -} - -// UnmarshalRouteNextHopIP unmarshals an instance of RouteNextHopIP from the specified map of raw messages. -func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopPatchRouteNextHopIP : RouteNextHopPatchRouteNextHopIP struct -// Models which "extend" this model: -// - RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP -// - RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP -// This model "extends" RouteNextHopPatch -type RouteNextHopPatchRouteNextHopIP struct { - // The sentinel IP address (`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,omitempty"` -} - -func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatchRouteNextHopIP() bool { - return true -} - -type RouteNextHopPatchRouteNextHopIPIntf interface { - RouteNextHopPatchIntf - isaRouteNextHopPatchRouteNextHopIP() bool -} - -func (*RouteNextHopPatchRouteNextHopIP) isaRouteNextHopPatch() bool { - return true -} - -// UnmarshalRouteNextHopPatchRouteNextHopIP unmarshals an instance of RouteNextHopPatchRouteNextHopIP from the specified map of raw messages. -func UnmarshalRouteNextHopPatchRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatchRouteNextHopIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopPatchVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. -// Models which "extend" this model: -// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID -// - RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref -// This model "extends" RouteNextHopPatch -type RouteNextHopPatchVPNGatewayConnectionIdentity struct { - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*RouteNextHopPatchVPNGatewayConnectionIdentity) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { - return true -} - -type RouteNextHopPatchVPNGatewayConnectionIdentityIntf interface { - RouteNextHopPatchIntf - isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool -} - -func (*RouteNextHopPatchVPNGatewayConnectionIdentity) isaRouteNextHopPatch() bool { - return true -} - -// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentity from the specified map of raw messages. -func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatchVPNGatewayConnectionIdentity) - 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 -} - -// RouteNextHopVPNGatewayConnectionReference : RouteNextHopVPNGatewayConnectionReference struct -// This model "extends" RouteNextHop -type RouteNextHopVPNGatewayConnectionReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the RouteNextHopVPNGatewayConnectionReference.ResourceType property. -// The resource type. -const ( - RouteNextHopVPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -func (*RouteNextHopVPNGatewayConnectionReference) isaRouteNextHop() bool { - return true -} - -// UnmarshalRouteNextHopVPNGatewayConnectionReference unmarshals an instance of RouteNextHopVPNGatewayConnectionReference from the specified map of raw messages. -func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopVPNGatewayConnectionReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) - 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 -} - -// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct -// Models which "extend" this model: -// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP -// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP -// This model "extends" RoutePrototypeNextHop -type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct { - // The sentinel IP address (`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,omitempty"` -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { - return true -} - -type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPIntf interface { - RoutePrototypeNextHopIntf - isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHop() bool { - return true -} - -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. -// Models which "extend" this model: -// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID -// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref -// This model "extends" RoutePrototypeNextHop -type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity struct { - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { - return true -} - -type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityIntf interface { - RoutePrototypeNextHopIntf - isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHop() bool { - return true -} - -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) - 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 -} - -// RoutingTableIdentityByHref : RoutingTableIdentityByHref struct -// This model "extends" RoutingTableIdentity -type RoutingTableIdentityByHref struct { - // The URL for this routing table. - Href *string `json:"href" validate:"required"` -} - -// NewRoutingTableIdentityByHref : Instantiate RoutingTableIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewRoutingTableIdentityByHref(href string) (_model *RoutingTableIdentityByHref, err error) { - _model = &RoutingTableIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RoutingTableIdentityByHref) isaRoutingTableIdentity() bool { - return true -} - -// UnmarshalRoutingTableIdentityByHref unmarshals an instance of RoutingTableIdentityByHref from the specified map of raw messages. -func UnmarshalRoutingTableIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableIdentityByHref) - 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 -} - -// RoutingTableIdentityByID : RoutingTableIdentityByID struct -// This model "extends" RoutingTableIdentity -type RoutingTableIdentityByID struct { - // The unique identifier for this routing table. - ID *string `json:"id" validate:"required"` -} - -// NewRoutingTableIdentityByID : Instantiate RoutingTableIdentityByID (Generic Model Constructor) -func (*VpcV1) NewRoutingTableIdentityByID(id string) (_model *RoutingTableIdentityByID, err error) { - _model = &RoutingTableIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RoutingTableIdentityByID) isaRoutingTableIdentity() bool { - return true -} - -// UnmarshalRoutingTableIdentityByID unmarshals an instance of RoutingTableIdentityByID from the specified map of raw messages. -func UnmarshalRoutingTableIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableIdentityByID) - 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 -} - -// SecurityGroupIdentityByCRN : SecurityGroupIdentityByCRN struct -// This model "extends" SecurityGroupIdentity -type SecurityGroupIdentityByCRN struct { - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` -} - -// NewSecurityGroupIdentityByCRN : Instantiate SecurityGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupIdentityByCRN, err error) { - _model = &SecurityGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupIdentityByCRN) isaSecurityGroupIdentity() bool { - return true -} - -// UnmarshalSecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalSecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupIdentityByCRN) - 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 -} - -// SecurityGroupIdentityByHref : SecurityGroupIdentityByHref struct -// This model "extends" SecurityGroupIdentity -type SecurityGroupIdentityByHref struct { - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewSecurityGroupIdentityByHref : Instantiate SecurityGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupIdentityByHref(href string) (_model *SecurityGroupIdentityByHref, err error) { - _model = &SecurityGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupIdentityByHref) isaSecurityGroupIdentity() bool { - return true -} - -// UnmarshalSecurityGroupIdentityByHref unmarshals an instance of SecurityGroupIdentityByHref from the specified map of raw messages. -func UnmarshalSecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupIdentityByHref) - 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 -} - -// SecurityGroupIdentityByID : SecurityGroupIdentityByID struct -// This model "extends" SecurityGroupIdentity -type SecurityGroupIdentityByID struct { - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` -} - -// NewSecurityGroupIdentityByID : Instantiate SecurityGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupIdentityByID(id string) (_model *SecurityGroupIdentityByID, err error) { - _model = &SecurityGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupIdentityByID) isaSecurityGroupIdentity() bool { - return true -} - -// UnmarshalSecurityGroupIdentityByID unmarshals an instance of SecurityGroupIdentityByID from the specified map of raw messages. -func UnmarshalSecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupIdentityByID) - 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 -} - -// SecurityGroupRuleLocalPatchCIDR : SecurityGroupRuleLocalPatchCIDR struct -// This model "extends" SecurityGroupRuleLocalPatch -type SecurityGroupRuleLocalPatchCIDR struct { - // The CIDR block. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address - // blocks in the future. - CIDRBlock *string `json:"cidr_block" validate:"required"` -} - -// NewSecurityGroupRuleLocalPatchCIDR : Instantiate SecurityGroupRuleLocalPatchCIDR (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleLocalPatchCIDR(cidrBlock string) (_model *SecurityGroupRuleLocalPatchCIDR, err error) { - _model = &SecurityGroupRuleLocalPatchCIDR{ - CIDRBlock: core.StringPtr(cidrBlock), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRuleLocalPatchCIDR) isaSecurityGroupRuleLocalPatch() bool { - return true -} - -// UnmarshalSecurityGroupRuleLocalPatchCIDR unmarshals an instance of SecurityGroupRuleLocalPatchCIDR from the specified map of raw messages. -func UnmarshalSecurityGroupRuleLocalPatchCIDR(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleLocalPatchCIDR) - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleLocalPatchIP : SecurityGroupRuleLocalPatchIP struct -// This model "extends" SecurityGroupRuleLocalPatch -type SecurityGroupRuleLocalPatchIP struct { - // The IP address. - // - // 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"` -} - -// NewSecurityGroupRuleLocalPatchIP : Instantiate SecurityGroupRuleLocalPatchIP (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleLocalPatchIP(address string) (_model *SecurityGroupRuleLocalPatchIP, err error) { - _model = &SecurityGroupRuleLocalPatchIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRuleLocalPatchIP) isaSecurityGroupRuleLocalPatch() bool { - return true -} - -// UnmarshalSecurityGroupRuleLocalPatchIP unmarshals an instance of SecurityGroupRuleLocalPatchIP from the specified map of raw messages. -func UnmarshalSecurityGroupRuleLocalPatchIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleLocalPatchIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleLocalPrototypeCIDR : SecurityGroupRuleLocalPrototypeCIDR struct -// This model "extends" SecurityGroupRuleLocalPrototype -type SecurityGroupRuleLocalPrototypeCIDR struct { - // The CIDR block. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address - // blocks in the future. - CIDRBlock *string `json:"cidr_block" validate:"required"` -} - -// NewSecurityGroupRuleLocalPrototypeCIDR : Instantiate SecurityGroupRuleLocalPrototypeCIDR (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleLocalPrototypeCIDR(cidrBlock string) (_model *SecurityGroupRuleLocalPrototypeCIDR, err error) { - _model = &SecurityGroupRuleLocalPrototypeCIDR{ - CIDRBlock: core.StringPtr(cidrBlock), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRuleLocalPrototypeCIDR) isaSecurityGroupRuleLocalPrototype() bool { - return true -} - -// UnmarshalSecurityGroupRuleLocalPrototypeCIDR unmarshals an instance of SecurityGroupRuleLocalPrototypeCIDR from the specified map of raw messages. -func UnmarshalSecurityGroupRuleLocalPrototypeCIDR(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleLocalPrototypeCIDR) - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleLocalPrototypeIP : SecurityGroupRuleLocalPrototypeIP struct -// This model "extends" SecurityGroupRuleLocalPrototype -type SecurityGroupRuleLocalPrototypeIP struct { - // The IP address. - // - // 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"` -} - -// NewSecurityGroupRuleLocalPrototypeIP : Instantiate SecurityGroupRuleLocalPrototypeIP (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleLocalPrototypeIP(address string) (_model *SecurityGroupRuleLocalPrototypeIP, err error) { - _model = &SecurityGroupRuleLocalPrototypeIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRuleLocalPrototypeIP) isaSecurityGroupRuleLocalPrototype() bool { - return true -} - -// UnmarshalSecurityGroupRuleLocalPrototypeIP unmarshals an instance of SecurityGroupRuleLocalPrototypeIP from the specified map of raw messages. -func UnmarshalSecurityGroupRuleLocalPrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleLocalPrototypeIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleLocalCIDR : SecurityGroupRuleLocalCIDR struct -// This model "extends" SecurityGroupRuleLocal -type SecurityGroupRuleLocalCIDR struct { - // The CIDR block. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address - // blocks in the future. - CIDRBlock *string `json:"cidr_block" validate:"required"` -} - -func (*SecurityGroupRuleLocalCIDR) isaSecurityGroupRuleLocal() bool { - return true -} - -// UnmarshalSecurityGroupRuleLocalCIDR unmarshals an instance of SecurityGroupRuleLocalCIDR from the specified map of raw messages. -func UnmarshalSecurityGroupRuleLocalCIDR(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleLocalCIDR) - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleLocalIP : SecurityGroupRuleLocalIP struct -// This model "extends" SecurityGroupRuleLocal -type SecurityGroupRuleLocalIP struct { - // The IP address. - // - // 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 (*SecurityGroupRuleLocalIP) isaSecurityGroupRuleLocal() bool { - return true -} - -// UnmarshalSecurityGroupRuleLocalIP unmarshals an instance of SecurityGroupRuleLocalIP from the specified map of raw messages. -func UnmarshalSecurityGroupRuleLocalIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleLocalIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. -// This model "extends" SecurityGroupRulePrototype -type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The IP version to enforce. The format of `local.address`, `remote.address`, - // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. - // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` - - // The local IP address or range of local IP addresses to which this rule will allow inbound - // traffic (or from which, for outbound traffic) - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP - // addresses (or from all local IP addresses, for outbound rules). - Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // 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. - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source - // (or to any destination, for outbound rules). - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` -} - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, -// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. -// -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllProtocolAllConst = "all" -) - -// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll, err error) { - _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll{ - Direction: core.StringPtr(direction), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) isaSecurityGroupRulePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll from the specified map of raw messages. -func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) - return - } - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. -// This model "extends" SecurityGroupRulePrototype -type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { - // The ICMP traffic code to allow. - // - // If specified, `type` must also be specified. If unspecified, all codes are allowed. - Code *int64 `json:"code,omitempty"` - - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The IP version to enforce. The format of `local.address`, `remote.address`, - // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. - // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` - - // The local IP address or range of local IP addresses to which this rule will allow inbound - // traffic (or from which, for outbound traffic) - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP - // addresses (or from all local IP addresses, for outbound rules). - Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // 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. - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source - // (or to any destination, for outbound rules). - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` - - // The ICMP traffic type to allow. - // - // If unspecified, all types are allowed. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, -// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. -// -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" -) - -// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp, err error) { - _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp{ - Direction: core.StringPtr(direction), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) isaSecurityGroupRulePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp from the specified map of raw messages. -func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) - return - } - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. -// -// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all destination ports are -// allowed for the protocol. When both have the same value, that single destination port is allowed. -// This model "extends" SecurityGroupRulePrototype -type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The IP version to enforce. The format of `local.address`, `remote.address`, - // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. - // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version,omitempty"` - - // The local IP address or range of local IP addresses to which this rule will allow inbound - // traffic (or from which, for outbound traffic) - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic to all local IP - // addresses (or from all local IP addresses, for outbound rules). - Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` - - // The inclusive upper bound of TCP/UDP destination port range. - // - // If specified, `port_min` must also be specified, and must not be larger. If unspecified, - // `port_min` must also be unspecified, allowing traffic on all destination ports. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range - // - // If specified, `port_max` must also be specified, and must not be smaller. If unspecified, `port_max` must also be - // unspecified, allowing traffic on all destination ports. - PortMin *int64 `json:"port_min,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // 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. - // - // If unspecified, a CIDR block of `0.0.0.0/0` will be used to allow traffic from any source - // (or to any destination, for outbound rules). - Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` -} - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, -// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. -// -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" -) - -// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(direction string, protocol string) (_model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp, err error) { - _model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp{ - Direction: core.StringPtr(direction), - Protocol: core.StringPtr(protocol), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRulePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. -func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) - if err != nil { - err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "local-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 - } - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePatchCIDR : SecurityGroupRuleRemotePatchCIDR struct -// This model "extends" SecurityGroupRuleRemotePatch -type SecurityGroupRuleRemotePatchCIDR struct { - // The CIDR block. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address - // blocks in the future. - CIDRBlock *string `json:"cidr_block" validate:"required"` -} - -// NewSecurityGroupRuleRemotePatchCIDR : Instantiate SecurityGroupRuleRemotePatchCIDR (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePatchCIDR(cidrBlock string) (_model *SecurityGroupRuleRemotePatchCIDR, err error) { - _model = &SecurityGroupRuleRemotePatchCIDR{ - CIDRBlock: core.StringPtr(cidrBlock), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRuleRemotePatchCIDR) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePatchCIDR unmarshals an instance of SecurityGroupRuleRemotePatchCIDR from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchCIDR(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchCIDR) - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePatchIP : SecurityGroupRuleRemotePatchIP struct -// This model "extends" SecurityGroupRuleRemotePatch -type SecurityGroupRuleRemotePatchIP struct { - // The IP address. - // - // 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"` -} - -// NewSecurityGroupRuleRemotePatchIP : Instantiate SecurityGroupRuleRemotePatchIP (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePatchIP(address string) (_model *SecurityGroupRuleRemotePatchIP, err error) { - _model = &SecurityGroupRuleRemotePatchIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRuleRemotePatchIP) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePatchIP unmarshals an instance of SecurityGroupRuleRemotePatchIP from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePatchSecurityGroupIdentity : Identifies a security group by a unique property. -// Models which "extend" this model: -// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID -// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN -// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref -// This model "extends" SecurityGroupRuleRemotePatch -type SecurityGroupRuleRemotePatchSecurityGroupIdentity struct { - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` - - // The security group's CRN. - CRN *string `json:"crn,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { - return true -} - -type SecurityGroupRuleRemotePatchSecurityGroupIdentityIntf interface { - SecurityGroupRuleRemotePatchIntf - isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentity from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePrototypeCIDR : SecurityGroupRuleRemotePrototypeCIDR struct -// This model "extends" SecurityGroupRuleRemotePrototype -type SecurityGroupRuleRemotePrototypeCIDR struct { - // The CIDR block. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address - // blocks in the future. - CIDRBlock *string `json:"cidr_block" validate:"required"` -} - -// NewSecurityGroupRuleRemotePrototypeCIDR : Instantiate SecurityGroupRuleRemotePrototypeCIDR (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePrototypeCIDR(cidrBlock string) (_model *SecurityGroupRuleRemotePrototypeCIDR, err error) { - _model = &SecurityGroupRuleRemotePrototypeCIDR{ - CIDRBlock: core.StringPtr(cidrBlock), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRuleRemotePrototypeCIDR) isaSecurityGroupRuleRemotePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePrototypeCIDR unmarshals an instance of SecurityGroupRuleRemotePrototypeCIDR from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeCIDR(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeCIDR) - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePrototypeIP : SecurityGroupRuleRemotePrototypeIP struct -// This model "extends" SecurityGroupRuleRemotePrototype -type SecurityGroupRuleRemotePrototypeIP struct { - // The IP address. - // - // 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"` -} - -// NewSecurityGroupRuleRemotePrototypeIP : Instantiate SecurityGroupRuleRemotePrototypeIP (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePrototypeIP(address string) (_model *SecurityGroupRuleRemotePrototypeIP, err error) { - _model = &SecurityGroupRuleRemotePrototypeIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRuleRemotePrototypeIP) isaSecurityGroupRuleRemotePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePrototypeIP unmarshals an instance of SecurityGroupRuleRemotePrototypeIP from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemotePrototypeSecurityGroupIdentity : Identifies a security group by a unique property. -// Models which "extend" this model: -// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID -// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN -// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref -// This model "extends" SecurityGroupRuleRemotePrototype -type SecurityGroupRuleRemotePrototypeSecurityGroupIdentity struct { - // The unique identifier for this security group. - ID *string `json:"id,omitempty"` - - // The security group's CRN. - CRN *string `json:"crn,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { - return true -} - -type SecurityGroupRuleRemotePrototypeSecurityGroupIdentityIntf interface { - SecurityGroupRuleRemotePrototypeIntf - isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentity from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemoteCIDR : SecurityGroupRuleRemoteCIDR struct -// This model "extends" SecurityGroupRuleRemote -type SecurityGroupRuleRemoteCIDR struct { - // The CIDR block. - // - // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 address - // blocks in the future. - CIDRBlock *string `json:"cidr_block" validate:"required"` -} - -func (*SecurityGroupRuleRemoteCIDR) isaSecurityGroupRuleRemote() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemoteCIDR unmarshals an instance of SecurityGroupRuleRemoteCIDR from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemoteCIDR(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemoteCIDR) - err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) - if err != nil { - err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemoteIP : SecurityGroupRuleRemoteIP struct -// This model "extends" SecurityGroupRuleRemote -type SecurityGroupRuleRemoteIP struct { - // The IP address. - // - // 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 (*SecurityGroupRuleRemoteIP) isaSecurityGroupRuleRemote() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemoteIP unmarshals an instance of SecurityGroupRuleRemoteIP from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemoteIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemoteIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleRemoteSecurityGroupReference : SecurityGroupRuleRemoteSecurityGroupReference struct -// This model "extends" SecurityGroupRuleRemote -type SecurityGroupRuleRemoteSecurityGroupReference struct { - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` - - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` - - // The name for this security group. The name is unique across all security groups for the VPC. - Name *string `json:"name" validate:"required"` -} - -func (*SecurityGroupRuleRemoteSecurityGroupReference) isaSecurityGroupRuleRemote() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemoteSecurityGroupReference unmarshals an instance of SecurityGroupRuleRemoteSecurityGroupReference from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemoteSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemoteSecurityGroupReference) - 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, UnmarshalSecurityGroupReferenceDeleted) - 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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. -// This model "extends" SecurityGroupRule -type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The URL for this security group rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group rule. - ID *string `json:"id" validate:"required"` - - // The IP version to enforce. The format of `local.address`, `remote.address`, - // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. - // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version" validate:"required"` - - Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` - - Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" - SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, -// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. -// -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolAllProtocolAllConst = "all" -) - -func (*SecurityGroupRuleSecurityGroupRuleProtocolAll) isaSecurityGroupRule() bool { - return true -} - -// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolAll from the specified map of raw messages. -func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleSecurityGroupRuleProtocolAll) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-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, "ip_version", &obj.IPVersion) - if err != nil { - err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) - if err != nil { - err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) - if err != nil { - err = core.SDKErrorf(err, "", "remote-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupRuleSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. -// This model "extends" SecurityGroupRule -type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The URL for this security group rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group rule. - ID *string `json:"id" validate:"required"` - - // The IP version to enforce. The format of `local.address`, `remote.address`, - // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. - // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version" validate:"required"` - - Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` - - Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` - - // The ICMP traffic code to allow. If absent, all codes are allowed. - Code *int64 `json:"code,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` - - // The ICMP traffic type to allow. If absent, all types are allowed. - Type *int64 `json:"type,omitempty"` -} - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" - SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, -// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. -// -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" -) - -func (*SecurityGroupRuleSecurityGroupRuleProtocolIcmp) isaSecurityGroupRule() bool { - return true -} - -// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolIcmp from the specified map of raw messages. -func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleSecurityGroupRuleProtocolIcmp) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-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, "ip_version", &obj.IPVersion) - if err != nil { - err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) - if err != nil { - err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) - 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, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-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 -} - -// SecurityGroupRuleSecurityGroupRuleProtocolTcpudp : A rule specifying the TCP or UDP traffic to allow. -// -// Either both `port_min` and `port_max` will be present, or neither. When neither is present, all destination ports are -// allowed for the protocol. When both have the same value, that single destination port is allowed. -// This model "extends" SecurityGroupRule -type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { - // The direction of traffic to enforce. - Direction *string `json:"direction" validate:"required"` - - // The URL for this security group rule. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this security group rule. - ID *string `json:"id" validate:"required"` - - // The IP version to enforce. The format of `local.address`, `remote.address`, - // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. - // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. - IPVersion *string `json:"ip_version" validate:"required"` - - Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` - - Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` - - // The inclusive upper bound of TCP/UDP destination port range. - PortMax *int64 `json:"port_max,omitempty"` - - // The inclusive lower bound of TCP/UDP destination port range. - PortMin *int64 `json:"port_min,omitempty"` - - // The protocol to enforce. - Protocol *string `json:"protocol" validate:"required"` -} - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Direction property. -// The direction of traffic to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, -// `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. -// -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" -) - -// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. -const ( - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" - SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" -) - -func (*SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRule() bool { - return true -} - -// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. -func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-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, "ip_version", &obj.IPVersion) - if err != nil { - err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) - if err != nil { - err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) - if err != nil { - err = core.SDKErrorf(err, "", "remote-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 - } - err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) - if err != nil { - err = core.SDKErrorf(err, "", "protocol-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // 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 name for this bare metal server network interface. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { - return true -} - -// UnmarshalSecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) - 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 -} - -// SecurityGroupTargetReferenceEndpointGatewayReference : SecurityGroupTargetReferenceEndpointGatewayReference struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceEndpointGatewayReference struct { - // The CRN for this endpoint gateway. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this endpoint gateway. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this endpoint gateway. - ID *string `json:"id" validate:"required"` - - // The name for this endpoint gateway. The name is unique across all endpoint gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SecurityGroupTargetReferenceEndpointGatewayReference.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" -) - -func (*SecurityGroupTargetReferenceEndpointGatewayReference) isaSecurityGroupTargetReference() bool { - return true -} - -// UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference unmarshals an instance of SecurityGroupTargetReferenceEndpointGatewayReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceEndpointGatewayReference) - 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, UnmarshalEndpointGatewayReferenceDeleted) - 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 -} - -// SecurityGroupTargetReferenceLoadBalancerReference : SecurityGroupTargetReferenceLoadBalancerReference struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceLoadBalancerReference struct { - // The load balancer's CRN. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` - - // The load balancer's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this load balancer. - ID *string `json:"id" validate:"required"` - - // The name for this load balancer. The name is unique across all load balancers in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SecurityGroupTargetReferenceLoadBalancerReference.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" -) - -func (*SecurityGroupTargetReferenceLoadBalancerReference) isaSecurityGroupTargetReference() bool { - return true -} - -// UnmarshalSecurityGroupTargetReferenceLoadBalancerReference unmarshals an instance of SecurityGroupTargetReferenceLoadBalancerReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceLoadBalancerReference) - 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, UnmarshalLoadBalancerReferenceDeleted) - 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 -} - -// SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - - // The URL for this instance network interface. - // - // If this instance 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 instance network interface. - // - // If this instance 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 name for this instance network interface. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" -) - -func (*SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { - return true -} - -// UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) - 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 -} - -// SecurityGroupTargetReferenceVPNServerReference : SecurityGroupTargetReferenceVPNServerReference struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceVPNServerReference struct { - // The CRN for this VPN server. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this VPN server. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN server. - ID *string `json:"id" validate:"required"` - - // The name for this VPN server. The name is unique across all VPN servers in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the SecurityGroupTargetReferenceVPNServerReference.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" -) - -func (*SecurityGroupTargetReferenceVPNServerReference) isaSecurityGroupTargetReference() bool { - return true -} - -// UnmarshalSecurityGroupTargetReferenceVPNServerReference unmarshals an instance of SecurityGroupTargetReferenceVPNServerReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceVPNServerReference) - 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, UnmarshalVPNServerReferenceDeleted) - 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 -} - -// SecurityGroupTargetReferenceVirtualNetworkInterfaceReference : SecurityGroupTargetReferenceVirtualNetworkInterfaceReference struct -// This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceVirtualNetworkInterfaceReference struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *VirtualNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` - - // The name for this virtual network interface. The name is unique across all virtual network interfaces in the VPC. - Name *string `json:"name" validate:"required"` - - // The primary IP for this virtual network interface. - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` -} - -// Constants associated with the SecurityGroupTargetReferenceVirtualNetworkInterfaceReference.ResourceType property. -// The resource type. -const ( - SecurityGroupTargetReferenceVirtualNetworkInterfaceReferenceResourceTypeVirtualNetworkInterfaceConst = "virtual_network_interface" -) - -func (*SecurityGroupTargetReferenceVirtualNetworkInterfaceReference) isaSecurityGroupTargetReference() bool { - return true -} - -// UnmarshalSecurityGroupTargetReferenceVirtualNetworkInterfaceReference unmarshals an instance of SecurityGroupTargetReferenceVirtualNetworkInterfaceReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceVirtualNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceVirtualNetworkInterfaceReference) - 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, UnmarshalVirtualNetworkInterfaceReferenceDeleted) - 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, "primary_ip", &obj.PrimaryIP, UnmarshalReservedIPReference) - 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, "", "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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareIdentityByCRN : ShareIdentityByCRN struct -// This model "extends" ShareIdentity -type ShareIdentityByCRN struct { - // The CRN for this file share. - CRN *string `json:"crn" validate:"required"` -} - -// NewShareIdentityByCRN : Instantiate ShareIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewShareIdentityByCRN(crn string) (_model *ShareIdentityByCRN, err error) { - _model = &ShareIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ShareIdentityByCRN) isaShareIdentity() bool { - return true -} - -// UnmarshalShareIdentityByCRN unmarshals an instance of ShareIdentityByCRN from the specified map of raw messages. -func UnmarshalShareIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareIdentityByCRN) - 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 -} - -// ShareIdentityByHref : ShareIdentityByHref struct -// This model "extends" ShareIdentity -type ShareIdentityByHref struct { - // The URL for this file share. - Href *string `json:"href" validate:"required"` -} - -// NewShareIdentityByHref : Instantiate ShareIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewShareIdentityByHref(href string) (_model *ShareIdentityByHref, err error) { - _model = &ShareIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ShareIdentityByHref) isaShareIdentity() bool { - return true -} - -// UnmarshalShareIdentityByHref unmarshals an instance of ShareIdentityByHref from the specified map of raw messages. -func UnmarshalShareIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareIdentityByHref) - 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 -} - -// ShareIdentityByID : ShareIdentityByID struct -// This model "extends" ShareIdentity -type ShareIdentityByID struct { - // The unique identifier for this file share. - ID *string `json:"id" validate:"required"` -} - -// NewShareIdentityByID : Instantiate ShareIdentityByID (Generic Model Constructor) -func (*VpcV1) NewShareIdentityByID(id string) (_model *ShareIdentityByID, err error) { - _model = &ShareIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ShareIdentityByID) isaShareIdentity() bool { - return true -} - -// UnmarshalShareIdentityByID unmarshals an instance of ShareIdentityByID from the specified map of raw messages. -func UnmarshalShareIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareIdentityByID) - 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 -} - -// ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : The virtual network interface for this share mount target. The virtual network interface must: -// -// - be in the same `zone` as the share -// - have `allow_ip_spoofing` set to `false` -// - have `enable_infrastructure_nat` set to `true` -// - not be in the same VPC as an existing mount target for this share -// - not have `ips` other than the `primary_ip` address -// -// If an existing virtual network interface is specified, it must not have a floating IP bound to it, and it must not be -// the target of a flow log collector. -// -// Required if the share's `access_control_mode` is `security_group`. -// This model "extends" ShareMountTargetPrototype -type ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup struct { - // The name for this share mount target. The name must not be used by another mount target for the file share. - Name *string `json:"name,omitempty"` - - // The transit encryption mode to use for this share mount target: - // - `none`: Not encrypted in transit. - // - `user_managed`: Encrypted in transit using an instance identity certificate. The - // `access_control_mode` for the share must be `security_group`. - TransitEncryption *string `json:"transit_encryption,omitempty"` - - VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface" validate:"required"` -} - -// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup.TransitEncryption property. -// The transit encryption mode to use for this share mount target: -// - `none`: Not encrypted in transit. -// - `user_managed`: Encrypted in transit using an instance identity certificate. The -// `access_control_mode` for the share must be `security_group`. -const ( - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionNoneConst = "none" - ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionUserManagedConst = "user_managed" -) - -// NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup (Generic Model Constructor) -func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(virtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup, err error) { - _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup{ - VirtualNetworkInterface: virtualNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) isaShareMountTargetPrototype() bool { - return true -} - -// UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup unmarshals an instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup from the specified map of raw messages. -func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) - if err != nil { - err = core.SDKErrorf(err, "", "transit_encryption-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "virtual_network_interface", &obj.VirtualNetworkInterface, UnmarshalShareMountTargetVirtualNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC : The VPC in which clients can mount the file share using this mount target. The VPC must not be used by another mount -// target for this share. -// -// Required if the share's `access_control_mode` is `vpc`. -// This model "extends" ShareMountTargetPrototype -type ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC struct { - // The name for this share mount target. The name must not be used by another mount target for the file share. - Name *string `json:"name,omitempty"` - - // The transit encryption mode to use for this share mount target: - // - `none`: Not encrypted in transit. - // - `user_managed`: Encrypted in transit using an instance identity certificate. The - // `access_control_mode` for the share must be `security_group`. - TransitEncryption *string `json:"transit_encryption,omitempty"` - - // Identifies a VPC by a unique property. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` -} - -// Constants associated with the ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC.TransitEncryption property. -// The transit encryption mode to use for this share mount target: -// - `none`: Not encrypted in transit. -// - `user_managed`: Encrypted in transit using an instance identity certificate. The -// `access_control_mode` for the share must be `security_group`. -const ( - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionNoneConst = "none" - ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionUserManagedConst = "user_managed" -) - -// NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC : Instantiate ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC (Generic Model Constructor) -func (*VpcV1) NewShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(vpc VPCIdentityIntf) (_model *ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC, err error) { - _model = &ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC{ - VPC: vpc, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC) isaShareMountTargetPrototype() bool { - return true -} - -// UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC unmarshals an instance of ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC from the specified map of raw messages. -func UnmarshalShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "transit_encryption", &obj.TransitEncryption) - if err != nil { - err = core.SDKErrorf(err, "", "transit_encryption-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity : Identifies a virtual network interface by a unique property. -// Models which "extend" this model: -// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID -// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref -// - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN -// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototype -type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity struct { - // 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"` -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityIntf interface { - ShareMountTargetVirtualNetworkInterfacePrototypeIntf - isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity from the specified map of raw messages. -func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity) - 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 - } - 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 -} - -// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext : The virtual network interface for this target. -// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototype -type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext 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"` - - // Indicates whether this virtual network interface will be automatically deleted when - // `target` is deleted. - AutoDelete *bool `json:"auto_delete,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"` - - // 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"` - - // 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 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"` - - // The resource group to use for this virtual network interface. If unspecified, the - // share's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,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"` -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext from the specified map of raw messages. -func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) - 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 - } - 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.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) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileCapacityDependentRange : The permitted total capacity (in gigabytes) of a share with this profile depends on its configuration. -// This model "extends" ShareProfileCapacity -type ShareProfileCapacityDependentRange struct { - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the ShareProfileCapacityDependentRange.Type property. -// The type for this profile field. -const ( - ShareProfileCapacityDependentRangeTypeDependentConst = "dependent" - ShareProfileCapacityDependentRangeTypeDependentRangeConst = "dependent_range" -) - -func (*ShareProfileCapacityDependentRange) isaShareProfileCapacity() bool { - return true -} - -// UnmarshalShareProfileCapacityDependentRange unmarshals an instance of ShareProfileCapacityDependentRange from the specified map of raw messages. -func UnmarshalShareProfileCapacityDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCapacityDependentRange) - 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 -} - -// 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 *int64 `json:"default" validate:"required"` - - // 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 ShareProfileCapacityEnum.Type property. -// The type for this profile field. -const ( - ShareProfileCapacityEnumTypeEnumConst = "enum" -) - -func (*ShareProfileCapacityEnum) isaShareProfileCapacity() bool { - return true -} - -// 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()) - 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 -} - -// ShareProfileCapacityFixed : The permitted total capacity (in gigabytes) of a share with this profile is fixed. -// This model "extends" ShareProfileCapacity -type ShareProfileCapacityFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the ShareProfileCapacityFixed.Type property. -// The type for this profile field. -const ( - ShareProfileCapacityFixedTypeFixedConst = "fixed" -) - -func (*ShareProfileCapacityFixed) isaShareProfileCapacity() bool { - return true -} - -// UnmarshalShareProfileCapacityFixed unmarshals an instance of ShareProfileCapacityFixed from the specified map of raw messages. -func UnmarshalShareProfileCapacityFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCapacityFixed) - 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 -} - -// ShareProfileCapacityRange : The permitted total capacity range (in gigabytes) of a share with this profile. -// This model "extends" ShareProfileCapacity -type ShareProfileCapacityRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the ShareProfileCapacityRange.Type property. -// The type for this profile field. -const ( - ShareProfileCapacityRangeTypeRangeConst = "range" -) - -func (*ShareProfileCapacityRange) isaShareProfileCapacity() bool { - return true -} - -// UnmarshalShareProfileCapacityRange unmarshals an instance of ShareProfileCapacityRange from the specified map of raw messages. -func UnmarshalShareProfileCapacityRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCapacityRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileIopsDependentRange : The permitted IOPS range of a share with this profile depends on its configuration. -// This model "extends" ShareProfileIops -type ShareProfileIopsDependentRange struct { - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the ShareProfileIopsDependentRange.Type property. -// The type for this profile field. -const ( - ShareProfileIopsDependentRangeTypeDependentConst = "dependent" - ShareProfileIopsDependentRangeTypeDependentRangeConst = "dependent_range" -) - -func (*ShareProfileIopsDependentRange) isaShareProfileIops() bool { - return true -} - -// UnmarshalShareProfileIopsDependentRange unmarshals an instance of ShareProfileIopsDependentRange from the specified map of raw messages. -func UnmarshalShareProfileIopsDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIopsDependentRange) - 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 -} - -// ShareProfileIopsEnum : The permitted IOPS values of a share with this profile. -// This model "extends" ShareProfileIops -type ShareProfileIopsEnum struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // 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 ShareProfileIopsEnum.Type property. -// The type for this profile field. -const ( - ShareProfileIopsEnumTypeEnumConst = "enum" -) - -func (*ShareProfileIopsEnum) isaShareProfileIops() bool { - return true -} - -// UnmarshalShareProfileIopsEnum unmarshals an instance of ShareProfileIopsEnum from the specified map of raw messages. -func UnmarshalShareProfileIopsEnum(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIopsEnum) - 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 -} - -// ShareProfileIopsFixed : The permitted IOPS of a share with this profile is fixed. -// This model "extends" ShareProfileIops -type ShareProfileIopsFixed struct { - // The type for this profile field. - Type *string `json:"type" validate:"required"` - - // The value for this profile field. - Value *int64 `json:"value" validate:"required"` -} - -// Constants associated with the ShareProfileIopsFixed.Type property. -// The type for this profile field. -const ( - ShareProfileIopsFixedTypeFixedConst = "fixed" -) - -func (*ShareProfileIopsFixed) isaShareProfileIops() bool { - return true -} - -// UnmarshalShareProfileIopsFixed unmarshals an instance of ShareProfileIopsFixed from the specified map of raw messages. -func UnmarshalShareProfileIopsFixed(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIopsFixed) - 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 -} - -// ShareProfileIopsRange : The permitted IOPS range of a share with this profile. -// This model "extends" ShareProfileIops -type ShareProfileIopsRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the ShareProfileIopsRange.Type property. -// The type for this profile field. -const ( - ShareProfileIopsRangeTypeRangeConst = "range" -) - -func (*ShareProfileIopsRange) isaShareProfileIops() bool { - return true -} - -// UnmarshalShareProfileIopsRange unmarshals an instance of ShareProfileIopsRange from the specified map of raw messages. -func UnmarshalShareProfileIopsRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIopsRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ShareProfileIdentityByHref : ShareProfileIdentityByHref struct -// This model "extends" ShareProfileIdentity -type ShareProfileIdentityByHref struct { - // The URL for this share profile. - Href *string `json:"href" validate:"required"` -} - -// NewShareProfileIdentityByHref : Instantiate ShareProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewShareProfileIdentityByHref(href string) (_model *ShareProfileIdentityByHref, err error) { - _model = &ShareProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ShareProfileIdentityByHref) isaShareProfileIdentity() bool { - return true -} - -// UnmarshalShareProfileIdentityByHref unmarshals an instance of ShareProfileIdentityByHref from the specified map of raw messages. -func UnmarshalShareProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIdentityByHref) - 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 -} - -// ShareProfileIdentityByName : ShareProfileIdentityByName struct -// This model "extends" ShareProfileIdentity -type ShareProfileIdentityByName struct { - // The globally unique name for this share profile. - Name *string `json:"name" validate:"required"` -} - -// NewShareProfileIdentityByName : Instantiate ShareProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewShareProfileIdentityByName(name string) (_model *ShareProfileIdentityByName, err error) { - _model = &ShareProfileIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ShareProfileIdentityByName) isaShareProfileIdentity() bool { - return true -} - -// UnmarshalShareProfileIdentityByName unmarshals an instance of ShareProfileIdentityByName from the specified map of raw messages. -func UnmarshalShareProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileIdentityByName) - 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 -} - -// SharePrototypeShareBySize : Create a file share by size. -// This model "extends" SharePrototype -type SharePrototypeShareBySize struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the - // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. - // - // In addition, each client accessing the share will be restricted to 48,000 IOPS. - Iops *int64 `json:"iops,omitempty"` - - // The mount targets for the file share. Each mount target must be in a unique VPC. - MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` - - // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be - // a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use for this file share. The - // profile must support the share's specified IOPS and size. - Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - - ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` - - // Tags for this resource. - UserTags []string `json:"user_tags,omitempty"` - - // The zone this file share will reside in. - // - // For a replica share, this must be a different zone in the same region as the source share. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The access control mode for the share: - // - // - `security_group`: The security groups on the virtual network interface for a - // mount target control access to the mount target. Mount targets for this share - // require a virtual network interface. - // - `vpc`: All clients in the VPC for a mount target have access to the mount target. - // Mount targets for this share require a VPC. - AccessControlMode *string `json:"access_control_mode,omitempty"` - - // The root key to use to wrap the data encryption key for the share. - // - // If unspecified, the `encryption` type for the share will be `provider_managed`. - // - // The specified key may be in a different account, subject to IAM policies. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The owner assigned to the file share at creation. Subsequent changes to the owner - // must be performed by a client that has mounted the file share. - InitialOwner *ShareInitialOwner `json:"initial_owner,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 size of the file share rounded up to the next gigabyte. - // - // The maximum size for a share may increase in the future. - Size *int64 `json:"size" validate:"required"` -} - -// Constants associated with the SharePrototypeShareBySize.AccessControlMode property. -// The access control mode for the share: -// -// - `security_group`: The security groups on the virtual network interface for a -// mount target control access to the mount target. Mount targets for this share -// require a virtual network interface. -// - `vpc`: All clients in the VPC for a mount target have access to the mount target. -// Mount targets for this share require a VPC. -const ( - SharePrototypeShareBySizeAccessControlModeSecurityGroupConst = "security_group" - SharePrototypeShareBySizeAccessControlModeVPCConst = "vpc" -) - -// NewSharePrototypeShareBySize : Instantiate SharePrototypeShareBySize (Generic Model Constructor) -func (*VpcV1) NewSharePrototypeShareBySize(profile ShareProfileIdentityIntf, zone ZoneIdentityIntf, size int64) (_model *SharePrototypeShareBySize, err error) { - _model = &SharePrototypeShareBySize{ - Profile: profile, - Zone: zone, - Size: core.Int64Ptr(size), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SharePrototypeShareBySize) isaSharePrototype() bool { - return true -} - -// UnmarshalSharePrototypeShareBySize unmarshals an instance of SharePrototypeShareBySize from the specified map of raw messages. -func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SharePrototypeShareBySize) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) - if err != nil { - err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) - if err != nil { - err = core.SDKErrorf(err, "", "access_control_mode-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, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) - if err != nil { - err = core.SDKErrorf(err, "", "initial_owner-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.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SharePrototypeShareBySourceShare : Create a replica file share for an existing file share. The values for `initial_owner`, -// `access_control_mode`, `encryption_key` and `size` will be inherited from `source_share`. -// This model "extends" SharePrototype -type SharePrototypeShareBySourceShare struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the - // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. - // - // In addition, each client accessing the share will be restricted to 48,000 IOPS. - Iops *int64 `json:"iops,omitempty"` - - // The mount targets for the file share. Each mount target must be in a unique VPC. - MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` - - // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be - // a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use for this file share. The - // profile must support the share's specified IOPS and size. - Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - - ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` - - // Tags for this resource. - UserTags []string `json:"user_tags,omitempty"` - - // The zone this file share will reside in. - // - // For a replica share, this must be a different zone in the same region as the source share. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The root key to use to wrap the data encryption key for the share. - // - // This property must be specified if the `source_share` is in a different region and has - // an `encryption` type of `user_managed`, and must not be specified otherwise (its value - // will be inherited from `source_share`). - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The cron specification for the file share replication schedule. - // - // Replication of a share can be scheduled to occur at most once per hour. - ReplicationCronSpec *string `json:"replication_cron_spec" validate:"required"` - - // The resource group to use. If unspecified, the resource group from - // the source share will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The source file share for this replica file share. The specified file share must not - // already have a replica, and must not be a replica. If source file share is specified - // by CRN, it may be in an [associated partner - // region](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-replication). - SourceShare ShareIdentityIntf `json:"source_share" validate:"required"` -} - -// NewSharePrototypeShareBySourceShare : Instantiate SharePrototypeShareBySourceShare (Generic Model Constructor) -func (*VpcV1) NewSharePrototypeShareBySourceShare(profile ShareProfileIdentityIntf, zone ZoneIdentityIntf, replicationCronSpec string, sourceShare ShareIdentityIntf) (_model *SharePrototypeShareBySourceShare, err error) { - _model = &SharePrototypeShareBySourceShare{ - Profile: profile, - Zone: zone, - ReplicationCronSpec: core.StringPtr(replicationCronSpec), - SourceShare: sourceShare, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SharePrototypeShareBySourceShare) isaSharePrototype() bool { - return true -} - -// UnmarshalSharePrototypeShareBySourceShare unmarshals an instance of SharePrototypeShareBySourceShare from the specified map of raw messages. -func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SharePrototypeShareBySourceShare) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "mount_targets-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, "profile", &obj.Profile, UnmarshalShareProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) - if err != nil { - err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-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.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) - if err != nil { - err = core.SDKErrorf(err, "", "replication_cron_spec-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, "source_share", &obj.SourceShare, UnmarshalShareIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots : SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots struct -// This model "extends" SnapshotConsistencyGroupPrototype -type SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots struct { - // Indicates whether deleting the snapshot consistency group will also delete the snapshots in the group. - DeleteSnapshotsOnDelete *bool `json:"delete_snapshots_on_delete,omitempty"` - - // The name for this snapshot consistency group. The name must be unique across all snapshot consistency groups in the - // region. - // - // If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The data-consistent member snapshots to create. All snapshots must specify a - // `source_volume` attached to the same virtual server instance. - Snapshots []SnapshotPrototypeSnapshotConsistencyGroupContext `json:"snapshots" validate:"required"` -} - -// NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots : Instantiate SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots (Generic Model Constructor) -func (*VpcV1) NewSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots(snapshots []SnapshotPrototypeSnapshotConsistencyGroupContext) (_model *SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots, err error) { - _model = &SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots{ - Snapshots: snapshots, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) isaSnapshotConsistencyGroupPrototype() bool { - return true -} - -// UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots unmarshals an instance of SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots from the specified map of raw messages. -func UnmarshalSnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotConsistencyGroupPrototypeSnapshotConsistencyGroupBySnapshots) - err = core.UnmarshalPrimitive(m, "delete_snapshots_on_delete", &obj.DeleteSnapshotsOnDelete) - if err != nil { - err = core.SDKErrorf(err, "", "delete_snapshots_on_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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "snapshots", &obj.Snapshots, UnmarshalSnapshotPrototypeSnapshotConsistencyGroupContext) - if err != nil { - err = core.SDKErrorf(err, "", "snapshots-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotIdentityByCRN : SnapshotIdentityByCRN struct -// This model "extends" SnapshotIdentity -type SnapshotIdentityByCRN struct { - // The CRN of this snapshot. - CRN *string `json:"crn" validate:"required"` -} - -// NewSnapshotIdentityByCRN : Instantiate SnapshotIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewSnapshotIdentityByCRN(crn string) (_model *SnapshotIdentityByCRN, err error) { - _model = &SnapshotIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SnapshotIdentityByCRN) isaSnapshotIdentity() bool { - return true -} - -// UnmarshalSnapshotIdentityByCRN unmarshals an instance of SnapshotIdentityByCRN from the specified map of raw messages. -func UnmarshalSnapshotIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotIdentityByCRN) - 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 -} - -// SnapshotIdentityByHref : SnapshotIdentityByHref struct -// This model "extends" SnapshotIdentity -type SnapshotIdentityByHref struct { - // The URL for this snapshot. - Href *string `json:"href" validate:"required"` -} - -// NewSnapshotIdentityByHref : Instantiate SnapshotIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewSnapshotIdentityByHref(href string) (_model *SnapshotIdentityByHref, err error) { - _model = &SnapshotIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SnapshotIdentityByHref) isaSnapshotIdentity() bool { - return true -} - -// UnmarshalSnapshotIdentityByHref unmarshals an instance of SnapshotIdentityByHref from the specified map of raw messages. -func UnmarshalSnapshotIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotIdentityByHref) - 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 -} - -// SnapshotIdentityByID : SnapshotIdentityByID struct -// This model "extends" SnapshotIdentity -type SnapshotIdentityByID struct { - // The unique identifier for this snapshot. - ID *string `json:"id" validate:"required"` -} - -// NewSnapshotIdentityByID : Instantiate SnapshotIdentityByID (Generic Model Constructor) -func (*VpcV1) NewSnapshotIdentityByID(id string) (_model *SnapshotIdentityByID, err error) { - _model = &SnapshotIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SnapshotIdentityByID) isaSnapshotIdentity() bool { - return true -} - -// UnmarshalSnapshotIdentityByID unmarshals an instance of SnapshotIdentityByID from the specified map of raw messages. -func UnmarshalSnapshotIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotIdentityByID) - 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 -} - -// SnapshotPrototypeSnapshotBySourceSnapshot : SnapshotPrototypeSnapshotBySourceSnapshot struct -// This model "extends" SnapshotPrototype -type SnapshotPrototypeSnapshotBySourceSnapshot struct { - // Clones to create for this snapshot. - Clones []SnapshotClonePrototype `json:"clones,omitempty"` - - // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. - UserTags []string `json:"user_tags,omitempty"` - - // The root key to use to wrap the data encryption key for this snapshot. - // - // A key must be specified if and only if the source snapshot has an `encryption` type of - // `user_managed`. To maximize snapshot availability and sharing of snapshot data, specify - // a key in the same region as the new snapshot, and use the same encryption key for all - // snapshots using the same source volume. - // - // The specified key may be in a different account, subject to IAM policies. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The source snapshot (in another region) to create this snapshot from. - // The specified snapshot must not already be the source of another snapshot in this - // region. - SourceSnapshot *SnapshotIdentityByCRN `json:"source_snapshot" validate:"required"` -} - -// NewSnapshotPrototypeSnapshotBySourceSnapshot : Instantiate SnapshotPrototypeSnapshotBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewSnapshotPrototypeSnapshotBySourceSnapshot(sourceSnapshot *SnapshotIdentityByCRN) (_model *SnapshotPrototypeSnapshotBySourceSnapshot, err error) { - _model = &SnapshotPrototypeSnapshotBySourceSnapshot{ - SourceSnapshot: sourceSnapshot, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SnapshotPrototypeSnapshotBySourceSnapshot) isaSnapshotPrototype() bool { - return true -} - -// UnmarshalSnapshotPrototypeSnapshotBySourceSnapshot unmarshals an instance of SnapshotPrototypeSnapshotBySourceSnapshot from the specified map of raw messages. -func UnmarshalSnapshotPrototypeSnapshotBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotPrototypeSnapshotBySourceSnapshot) - err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "clones-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentityByCRN) - if err != nil { - err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SnapshotPrototypeSnapshotBySourceVolume : SnapshotPrototypeSnapshotBySourceVolume struct -// This model "extends" SnapshotPrototype -type SnapshotPrototypeSnapshotBySourceVolume struct { - // Clones to create for this snapshot. - Clones []SnapshotClonePrototype `json:"clones,omitempty"` - - // The name for this snapshot. The name must not be used by another snapshot in the region. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this snapshot. - UserTags []string `json:"user_tags,omitempty"` - - // The volume to create this snapshot from. - SourceVolume VolumeIdentityIntf `json:"source_volume" validate:"required"` -} - -// NewSnapshotPrototypeSnapshotBySourceVolume : Instantiate SnapshotPrototypeSnapshotBySourceVolume (Generic Model Constructor) -func (*VpcV1) NewSnapshotPrototypeSnapshotBySourceVolume(sourceVolume VolumeIdentityIntf) (_model *SnapshotPrototypeSnapshotBySourceVolume, err error) { - _model = &SnapshotPrototypeSnapshotBySourceVolume{ - SourceVolume: sourceVolume, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SnapshotPrototypeSnapshotBySourceVolume) isaSnapshotPrototype() bool { - return true -} - -// UnmarshalSnapshotPrototypeSnapshotBySourceVolume unmarshals an instance of SnapshotPrototypeSnapshotBySourceVolume from the specified map of raw messages. -func UnmarshalSnapshotPrototypeSnapshotBySourceVolume(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotPrototypeSnapshotBySourceVolume) - err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClonePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "clones-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, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "source_volume", &obj.SourceVolume, UnmarshalVolumeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_volume-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetIdentityByCRN : SubnetIdentityByCRN struct -// This model "extends" SubnetIdentity -type SubnetIdentityByCRN struct { - // The CRN for this subnet. - CRN *string `json:"crn" validate:"required"` -} - -// NewSubnetIdentityByCRN : Instantiate SubnetIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewSubnetIdentityByCRN(crn string) (_model *SubnetIdentityByCRN, err error) { - _model = &SubnetIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SubnetIdentityByCRN) isaSubnetIdentity() bool { - return true -} - -// UnmarshalSubnetIdentityByCRN unmarshals an instance of SubnetIdentityByCRN from the specified map of raw messages. -func UnmarshalSubnetIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetIdentityByCRN) - 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 -} - -// SubnetIdentityByHref : SubnetIdentityByHref struct -// This model "extends" SubnetIdentity -type SubnetIdentityByHref struct { - // The URL for this subnet. - Href *string `json:"href" validate:"required"` -} - -// NewSubnetIdentityByHref : Instantiate SubnetIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewSubnetIdentityByHref(href string) (_model *SubnetIdentityByHref, err error) { - _model = &SubnetIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SubnetIdentityByHref) isaSubnetIdentity() bool { - return true -} - -// UnmarshalSubnetIdentityByHref unmarshals an instance of SubnetIdentityByHref from the specified map of raw messages. -func UnmarshalSubnetIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetIdentityByHref) - 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 -} - -// SubnetIdentityByID : SubnetIdentityByID struct -// This model "extends" SubnetIdentity -type SubnetIdentityByID struct { - // The unique identifier for this subnet. - ID *string `json:"id" validate:"required"` -} - -// NewSubnetIdentityByID : Instantiate SubnetIdentityByID (Generic Model Constructor) -func (*VpcV1) NewSubnetIdentityByID(id string) (_model *SubnetIdentityByID, err error) { - _model = &SubnetIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SubnetIdentityByID) isaSubnetIdentity() bool { - return true -} - -// UnmarshalSubnetIdentityByID unmarshals an instance of SubnetIdentityByID from the specified map of raw messages. -func UnmarshalSubnetIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetIdentityByID) - 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 -} - -// SubnetPrototypeSubnetByCIDR : SubnetPrototypeSubnetByCIDR struct -// This model "extends" SubnetPrototype -type SubnetPrototypeSubnetByCIDR struct { - // The IP version(s) to support for this subnet. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a - // hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The network ACL to use for this subnet. - NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` - - // The public gateway to use for internet-bound traffic for this subnet. If unspecified, the subnet will not be - // attached to a public gateway. - PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The routing table to use for this subnet. If unspecified, the default routing table for the VPC is used. The routing - // table properties `route_direct_link_ingress`, - // `route_internet_ingress`, `route_transit_gateway_ingress`, and - // `route_vpc_zone_ingress` must be `false`. - RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` - - // The VPC the subnet will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The IPv4 range of the subnet, expressed in CIDR format. The prefix length of the subnet's CIDR must be between `/9` - // (8,388,608 addresses) and `/29` (8 addresses). The IPv4 range of the subnet's CIDR must fall within an existing - // address prefix in the VPC and must not overlap with any existing subnet. The subnet will be created in the zone of - // the address prefix that contains the IPv4 CIDR. If zone is specified, it must match the zone of the address prefix - // that contains the subnet's IPv4 CIDR. - Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` - - // The zone this subnet will reside in. - Zone ZoneIdentityIntf `json:"zone,omitempty"` -} - -// Constants associated with the SubnetPrototypeSubnetByCIDR.IPVersion property. -// The IP version(s) to support for this subnet. -const ( - SubnetPrototypeSubnetByCIDRIPVersionIpv4Const = "ipv4" -) - -// NewSubnetPrototypeSubnetByCIDR : Instantiate SubnetPrototypeSubnetByCIDR (Generic Model Constructor) -func (*VpcV1) NewSubnetPrototypeSubnetByCIDR(vpc VPCIdentityIntf, ipv4CIDRBlock string) (_model *SubnetPrototypeSubnetByCIDR, err error) { - _model = &SubnetPrototypeSubnetByCIDR{ - VPC: vpc, - Ipv4CIDRBlock: core.StringPtr(ipv4CIDRBlock), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SubnetPrototypeSubnetByCIDR) isaSubnetPrototype() bool { - return true -} - -// UnmarshalSubnetPrototypeSubnetByCIDR unmarshals an instance of SubnetPrototypeSubnetByCIDR from the specified map of raw messages. -func UnmarshalSubnetPrototypeSubnetByCIDR(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPrototypeSubnetByCIDR) - 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.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "public_gateway-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, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-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 - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetPrototypeSubnetByTotalCount : SubnetPrototypeSubnetByTotalCount struct -// This model "extends" SubnetPrototype -type SubnetPrototypeSubnetByTotalCount struct { - // The IP version(s) to support for this subnet. - IPVersion *string `json:"ip_version,omitempty"` - - // The name for this subnet. The name must not be used by another subnet in the VPC. If unspecified, the name will be a - // hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The network ACL to use for this subnet. - NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` - - // The public gateway to use for internet-bound traffic for this subnet. If unspecified, the subnet will not be - // attached to a public gateway. - PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The routing table to use for this subnet. If unspecified, the default routing table for the VPC is used. The routing - // table properties `route_direct_link_ingress`, - // `route_internet_ingress`, `route_transit_gateway_ingress`, and - // `route_vpc_zone_ingress` must be `false`. - RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` - - // The VPC the subnet will reside in. - VPC VPCIdentityIntf `json:"vpc" validate:"required"` - - // The total number of IPv4 addresses required. Must be a power of 2. The VPC must have a default address prefix in the - // specified zone, and that prefix must have a free CIDR range with at least this number of addresses. - TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count" validate:"required"` - - // The zone this subnet will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` -} - -// Constants associated with the SubnetPrototypeSubnetByTotalCount.IPVersion property. -// The IP version(s) to support for this subnet. -const ( - SubnetPrototypeSubnetByTotalCountIPVersionIpv4Const = "ipv4" -) - -// NewSubnetPrototypeSubnetByTotalCount : Instantiate SubnetPrototypeSubnetByTotalCount (Generic Model Constructor) -func (*VpcV1) NewSubnetPrototypeSubnetByTotalCount(vpc VPCIdentityIntf, totalIpv4AddressCount int64, zone ZoneIdentityIntf) (_model *SubnetPrototypeSubnetByTotalCount, err error) { - _model = &SubnetPrototypeSubnetByTotalCount{ - VPC: vpc, - TotalIpv4AddressCount: core.Int64Ptr(totalIpv4AddressCount), - Zone: zone, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SubnetPrototypeSubnetByTotalCount) isaSubnetPrototype() bool { - return true -} - -// UnmarshalSubnetPrototypeSubnetByTotalCount unmarshals an instance of SubnetPrototypeSubnetByTotalCount from the specified map of raw messages. -func UnmarshalSubnetPrototypeSubnetByTotalCount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPrototypeSubnetByTotalCount) - 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.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "network_acl-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "public_gateway-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, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "routing_table-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-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 - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SubnetPublicGatewayPatchPublicGatewayIdentityByCRN : SubnetPublicGatewayPatchPublicGatewayIdentityByCRN struct -// This model "extends" SubnetPublicGatewayPatch -type SubnetPublicGatewayPatchPublicGatewayIdentityByCRN struct { - // The CRN for this public gateway. - CRN *string `json:"crn" validate:"required"` -} - -// NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(crn string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByCRN, err error) { - _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SubnetPublicGatewayPatchPublicGatewayIdentityByCRN) isaSubnetPublicGatewayPatch() bool { - return true -} - -// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByCRN unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByCRN from the specified map of raw messages. -func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByCRN) - 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 -} - -// SubnetPublicGatewayPatchPublicGatewayIdentityByHref : SubnetPublicGatewayPatchPublicGatewayIdentityByHref struct -// This model "extends" SubnetPublicGatewayPatch -type SubnetPublicGatewayPatchPublicGatewayIdentityByHref struct { - // The URL for this public gateway. - Href *string `json:"href" validate:"required"` -} - -// NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByHref(href string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByHref, err error) { - _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SubnetPublicGatewayPatchPublicGatewayIdentityByHref) isaSubnetPublicGatewayPatch() bool { - return true -} - -// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByHref unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByHref from the specified map of raw messages. -func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByHref) - 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 -} - -// SubnetPublicGatewayPatchPublicGatewayIdentityByID : SubnetPublicGatewayPatchPublicGatewayIdentityByID struct -// This model "extends" SubnetPublicGatewayPatch -type SubnetPublicGatewayPatchPublicGatewayIdentityByID struct { - // The unique identifier for this public gateway. - ID *string `json:"id" validate:"required"` -} - -// NewSubnetPublicGatewayPatchPublicGatewayIdentityByID : Instantiate SubnetPublicGatewayPatchPublicGatewayIdentityByID (Generic Model Constructor) -func (*VpcV1) NewSubnetPublicGatewayPatchPublicGatewayIdentityByID(id string) (_model *SubnetPublicGatewayPatchPublicGatewayIdentityByID, err error) { - _model = &SubnetPublicGatewayPatchPublicGatewayIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SubnetPublicGatewayPatchPublicGatewayIdentityByID) isaSubnetPublicGatewayPatch() bool { - return true -} - -// UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByID unmarshals an instance of SubnetPublicGatewayPatchPublicGatewayIdentityByID from the specified map of raw messages. -func UnmarshalSubnetPublicGatewayPatchPublicGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetPublicGatewayPatchPublicGatewayIdentityByID) - 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 -} - -// TrustedProfileIdentityTrustedProfileByCRN : TrustedProfileIdentityTrustedProfileByCRN struct -// This model "extends" TrustedProfileIdentity -type TrustedProfileIdentityTrustedProfileByCRN 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{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*TrustedProfileIdentityTrustedProfileByCRN) 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) - 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 -} - -// TrustedProfileIdentityTrustedProfileByID : TrustedProfileIdentityTrustedProfileByID struct -// This model "extends" TrustedProfileIdentity -type TrustedProfileIdentityTrustedProfileByID 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{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*TrustedProfileIdentityTrustedProfileByID) 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) - 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 -} - -// VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype : Manually specify the DNS server addresses for this VPC. -// This model "extends" VpcdnsResolverPrototype -type VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype struct { - // The DNS servers to use for this VPC. All the DNS servers must either: - // - // - have a unique `zone_affinity`, or - // - not have a `zone_affinity`. - // - // If `zone_affinity` is specified, exactly one DNS server must be specified for each zone in the region. The DHCP - // [Domain Name Server Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list this DNS - // server first, followed by unique DNS servers from other zones if available. - // - // If `zone_affinity` is not specified, the DHCP [Domain Name Server - // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS - // servers in the order specified. - ManualServers []DnsServerPrototype `json:"manual_servers" validate:"required"` - - // The type of the DNS resolver to use. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype.Type property. -// The type of the DNS resolver to use. -const ( - VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototypeTypeManualConst = "manual" -) - -// NewVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype : Instantiate VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype (Generic Model Constructor) -func (*VpcV1) NewVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype(manualServers []DnsServerPrototype, typeVar string) (_model *VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype, err error) { - _model = &VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype{ - ManualServers: manualServers, - Type: core.StringPtr(typeVar), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype) isaVpcdnsResolverPrototype() bool { - return true -} - -// UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype unmarshals an instance of VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype from the specified map of raw messages. -func UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverPrototypeVpcdnsResolverTypeManualPrototype) - err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServerPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "manual_servers-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 -} - -// VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype : The system will provide DNS server addresses for this VPC. The system-provided DNS server addresses depend on whether -// any endpoint gateways reside in the VPC, and whether a -// [DNS Services](https://cloud.ibm.com/docs/dns-svcs) instance is configured for the VPC. -// This model "extends" VpcdnsResolverPrototype -type VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype struct { - // The type of the DNS resolver to use. - Type *string `json:"type,omitempty"` -} - -// Constants associated with the VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype.Type property. -// The type of the DNS resolver to use. -const ( - VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototypeTypeSystemConst = "system" -) - -func (*VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype) isaVpcdnsResolverPrototype() bool { - return true -} - -// UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype unmarshals an instance of VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype from the specified map of raw messages. -func UnmarshalVpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverPrototypeVpcdnsResolverTypeSystemPrototype) - 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 -} - -// VpcdnsResolverTypeDelegated : The DNS server addresses are delegated to the DNS resolver of another VPC. -// This model "extends" VpcdnsResolver -type VpcdnsResolverTypeDelegated struct { - // The DNS servers for this VPC. The servers are populated: - // - // - by the system when `dns.resolver.type` is `system` - // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` - // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. - Servers []DnsServer `json:"servers" validate:"required"` - - // The type of the DNS resolver used for the VPC. - Type *string `json:"type" validate:"required"` - - // The VPC whose DNS resolver provides the DNS server addresses for this VPC. - // - // The VPC may be remote and therefore may not be directly retrievable. - VPC *VPCReferenceDnsResolverContext `json:"vpc" validate:"required"` -} - -// Constants associated with the VpcdnsResolverTypeDelegated.Type property. -// The type of the DNS resolver used for the VPC. -const ( - VpcdnsResolverTypeDelegatedTypeDelegatedConst = "delegated" -) - -func (*VpcdnsResolverTypeDelegated) isaVpcdnsResolver() bool { - return true -} - -// UnmarshalVpcdnsResolverTypeDelegated unmarshals an instance of VpcdnsResolverTypeDelegated from the specified map of raw messages. -func UnmarshalVpcdnsResolverTypeDelegated(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverTypeDelegated) - err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) - if err != nil { - err = core.SDKErrorf(err, "", "servers-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.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReferenceDnsResolverContext) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VpcdnsResolverTypeManual : The DNS server addresses are manually specified. -// This model "extends" VpcdnsResolver -type VpcdnsResolverTypeManual struct { - // The DNS servers for this VPC. The servers are populated: - // - // - by the system when `dns.resolver.type` is `system` - // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` - // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. - Servers []DnsServer `json:"servers" validate:"required"` - - // The manually specified DNS servers for this VPC. - // - // If the DNS servers have `zone_affinity`, the DHCP [Domain Name Server - // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for a zone will list the DNS server with the - // affinity for that zone first, followed by the unique DNS servers from other zones. - // - // If the DNS servers do not have `zone_affinity`, the DHCP [Domain Name Server - // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS - // servers in the order specified. - ManualServers []DnsServer `json:"manual_servers" validate:"required"` - - // The type of the DNS resolver used for the VPC. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the VpcdnsResolverTypeManual.Type property. -// The type of the DNS resolver used for the VPC. -const ( - VpcdnsResolverTypeManualTypeManualConst = "manual" -) - -func (*VpcdnsResolverTypeManual) isaVpcdnsResolver() bool { - return true -} - -// UnmarshalVpcdnsResolverTypeManual unmarshals an instance of VpcdnsResolverTypeManual from the specified map of raw messages. -func UnmarshalVpcdnsResolverTypeManual(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverTypeManual) - err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) - if err != nil { - err = core.SDKErrorf(err, "", "servers-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "manual_servers", &obj.ManualServers, UnmarshalDnsServer) - if err != nil { - err = core.SDKErrorf(err, "", "manual_servers-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 -} - -// VpcdnsResolverTypeSystem : The DNS server addresses are provided by the system and depend on the configuration. -// This model "extends" VpcdnsResolver -type VpcdnsResolverTypeSystem struct { - // The DNS servers for this VPC. The servers are populated: - // - // - by the system when `dns.resolver.type` is `system` - // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` - // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. - Servers []DnsServer `json:"servers" validate:"required"` - - // The configuration of the system DNS resolver for this VPC. - // - // - `custom_resolver`: A custom DNS resolver is configured for this VPC. - // - // - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when - // the VPC has either or both of the following: - // - // - at least one endpoint gateway residing in it - // - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it - // - // - `default`: The provider default DNS resolvers are configured for this VPC. - // - // This system DNS resolver configuration is used when the VPC has: - // - // - no custom DNS resolver configured for it, and - // - no endpoint gateways residing in it, and - // - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. - Configuration *string `json:"configuration" validate:"required"` - - // The type of the DNS resolver used for the VPC. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the VpcdnsResolverTypeSystem.Configuration property. -// The configuration of the system DNS resolver for this VPC. -// -// - `custom_resolver`: A custom DNS resolver is configured for this VPC. -// -// - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when -// the VPC has either or both of the following: -// -// - at least one endpoint gateway residing in it -// -// - a [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it -// -// - `default`: The provider default DNS resolvers are configured for this VPC. -// -// This system DNS resolver configuration is used when the VPC has: -// -// - no custom DNS resolver configured for it, and -// - no endpoint gateways residing in it, and -// - no [DNS Services](https://cloud.ibm.com/docs/dns-svcs) private zone configured for it. -const ( - VpcdnsResolverTypeSystemConfigurationCustomResolverConst = "custom_resolver" - VpcdnsResolverTypeSystemConfigurationDefaultConst = "default" - VpcdnsResolverTypeSystemConfigurationPrivateResolverConst = "private_resolver" -) - -// Constants associated with the VpcdnsResolverTypeSystem.Type property. -// The type of the DNS resolver used for the VPC. -const ( - VpcdnsResolverTypeSystemTypeSystemConst = "system" -) - -func (*VpcdnsResolverTypeSystem) isaVpcdnsResolver() bool { - return true -} - -// UnmarshalVpcdnsResolverTypeSystem unmarshals an instance of VpcdnsResolverTypeSystem from the specified map of raw messages. -func UnmarshalVpcdnsResolverTypeSystem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverTypeSystem) - err = core.UnmarshalModel(m, "servers", &obj.Servers, UnmarshalDnsServer) - if err != nil { - err = core.SDKErrorf(err, "", "servers-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "configuration", &obj.Configuration) - if err != nil { - err = core.SDKErrorf(err, "", "configuration-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 -} - -// VpcdnsResolverVPCPatchVPCIdentityByCRN : VpcdnsResolverVPCPatchVPCIdentityByCRN struct -// This model "extends" VpcdnsResolverVPCPatch -type VpcdnsResolverVPCPatchVPCIdentityByCRN struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` -} - -// NewVpcdnsResolverVPCPatchVPCIdentityByCRN : Instantiate VpcdnsResolverVPCPatchVPCIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByCRN(crn string) (_model *VpcdnsResolverVPCPatchVPCIdentityByCRN, err error) { - _model = &VpcdnsResolverVPCPatchVPCIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VpcdnsResolverVPCPatchVPCIdentityByCRN) isaVpcdnsResolverVPCPatch() bool { - return true -} - -// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByCRN unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByCRN from the specified map of raw messages. -func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverVPCPatchVPCIdentityByCRN) - 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 -} - -// VpcdnsResolverVPCPatchVPCIdentityByHref : VpcdnsResolverVPCPatchVPCIdentityByHref struct -// This model "extends" VpcdnsResolverVPCPatch -type VpcdnsResolverVPCPatchVPCIdentityByHref struct { - // The URL for this VPC. - Href *string `json:"href" validate:"required"` -} - -// NewVpcdnsResolverVPCPatchVPCIdentityByHref : Instantiate VpcdnsResolverVPCPatchVPCIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByHref(href string) (_model *VpcdnsResolverVPCPatchVPCIdentityByHref, err error) { - _model = &VpcdnsResolverVPCPatchVPCIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VpcdnsResolverVPCPatchVPCIdentityByHref) isaVpcdnsResolverVPCPatch() bool { - return true -} - -// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByHref unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByHref from the specified map of raw messages. -func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverVPCPatchVPCIdentityByHref) - 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 -} - -// VpcdnsResolverVPCPatchVPCIdentityByID : VpcdnsResolverVPCPatchVPCIdentityByID struct -// This model "extends" VpcdnsResolverVPCPatch -type VpcdnsResolverVPCPatchVPCIdentityByID struct { - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` -} - -// NewVpcdnsResolverVPCPatchVPCIdentityByID : Instantiate VpcdnsResolverVPCPatchVPCIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVpcdnsResolverVPCPatchVPCIdentityByID(id string) (_model *VpcdnsResolverVPCPatchVPCIdentityByID, err error) { - _model = &VpcdnsResolverVPCPatchVPCIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VpcdnsResolverVPCPatchVPCIdentityByID) isaVpcdnsResolverVPCPatch() bool { - return true -} - -// UnmarshalVpcdnsResolverVPCPatchVPCIdentityByID unmarshals an instance of VpcdnsResolverVPCPatchVPCIdentityByID from the specified map of raw messages. -func UnmarshalVpcdnsResolverVPCPatchVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpcdnsResolverVPCPatchVPCIdentityByID) - 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 -} - -// VPCIdentityByCRN : VPCIdentityByCRN struct -// This model "extends" VPCIdentity -type VPCIdentityByCRN struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` -} - -// NewVPCIdentityByCRN : Instantiate VPCIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewVPCIdentityByCRN(crn string) (_model *VPCIdentityByCRN, err error) { - _model = &VPCIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPCIdentityByCRN) isaVPCIdentity() bool { - return true -} - -// UnmarshalVPCIdentityByCRN unmarshals an instance of VPCIdentityByCRN from the specified map of raw messages. -func UnmarshalVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCIdentityByCRN) - 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 -} - -// VPCIdentityByHref : VPCIdentityByHref struct -// This model "extends" VPCIdentity -type VPCIdentityByHref struct { - // The URL for this VPC. - Href *string `json:"href" validate:"required"` -} - -// NewVPCIdentityByHref : Instantiate VPCIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVPCIdentityByHref(href string) (_model *VPCIdentityByHref, err error) { - _model = &VPCIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPCIdentityByHref) isaVPCIdentity() bool { - return true -} - -// UnmarshalVPCIdentityByHref unmarshals an instance of VPCIdentityByHref from the specified map of raw messages. -func UnmarshalVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCIdentityByHref) - 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 -} - -// VPCIdentityByID : VPCIdentityByID struct -// This model "extends" VPCIdentity -type VPCIdentityByID struct { - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` -} - -// NewVPCIdentityByID : Instantiate VPCIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVPCIdentityByID(id string) (_model *VPCIdentityByID, err error) { - _model = &VPCIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPCIdentityByID) isaVPCIdentity() bool { - return true -} - -// UnmarshalVPCIdentityByID unmarshals an instance of VPCIdentityByID from the specified map of raw messages. -func UnmarshalVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCIdentityByID) - 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 -} - -// VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn struct -// This model "extends" VPNGatewayConnectionIkeIdentityPrototype -type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn struct { - // The IKE identity type. - Type *string `json:"type" validate:"required"` - - // The IKE identity FQDN value. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn.Type property. -// The IKE identity type. -const ( - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdnTypeFqdnConst = "fqdn" - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdnTypeHostnameConst = "hostname" - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdnTypeIpv4AddressConst = "ipv4_address" - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdnTypeKeyIDConst = "key_id" -) - -// NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn : Instantiate VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn(typeVar string, value string) (_model *VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn, err error) { - _model = &VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn{ - Type: core.StringPtr(typeVar), - Value: core.StringPtr(value), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn) isaVPNGatewayConnectionIkeIdentityPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn) - 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 -} - -// VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname struct -// This model "extends" VPNGatewayConnectionIkeIdentityPrototype -type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname struct { - // The IKE identity type. - Type *string `json:"type" validate:"required"` - - // The IKE identity hostname value. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname.Type property. -// The IKE identity type. -const ( - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostnameTypeFqdnConst = "fqdn" - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostnameTypeHostnameConst = "hostname" - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostnameTypeIpv4AddressConst = "ipv4_address" - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostnameTypeKeyIDConst = "key_id" -) - -// NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname : Instantiate VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname(typeVar string, value string) (_model *VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname, err error) { - _model = &VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname{ - Type: core.StringPtr(typeVar), - Value: core.StringPtr(value), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname) isaVPNGatewayConnectionIkeIdentityPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname) - 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 -} - -// VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 struct -// This model "extends" VPNGatewayConnectionIkeIdentityPrototype -type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 struct { - // The IKE identity type. - Type *string `json:"type" validate:"required"` - - // The IKE identity IPv4 address value. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4.Type property. -// The IKE identity type. -const ( - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4TypeFqdnConst = "fqdn" - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4TypeHostnameConst = "hostname" - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4TypeIpv4AddressConst = "ipv4_address" - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4TypeKeyIDConst = "key_id" -) - -// NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 : Instantiate VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4(typeVar string, value string) (_model *VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4, err error) { - _model = &VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4{ - Type: core.StringPtr(typeVar), - Value: core.StringPtr(value), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4) isaVPNGatewayConnectionIkeIdentityPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4) - 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 -} - -// VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID struct -// This model "extends" VPNGatewayConnectionIkeIdentityPrototype -type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID struct { - // The IKE identity type. - Type *string `json:"type" validate:"required"` - - // The base64-encoded IKE identity key ID value. - Value *[]byte `json:"value" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID.Type property. -// The IKE identity type. -const ( - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyIDTypeFqdnConst = "fqdn" - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyIDTypeHostnameConst = "hostname" - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyIDTypeIpv4AddressConst = "ipv4_address" - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyIDTypeKeyIDConst = "key_id" -) - -// NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID : Instantiate VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID(typeVar string, value []byte) (_model *VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID, err error) { - _model = &VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID{ - Type: core.StringPtr(typeVar), - Value: core.ByteArrayPtr(value), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID) isaVPNGatewayConnectionIkeIdentityPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID) - 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 -} - -// VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn : VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn struct -// This model "extends" VPNGatewayConnectionIkeIdentity -type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn struct { - // The IKE identity type. - // - // 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 IKE identity FQDN value. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn.Type property. -// The IKE identity type. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnTypeFqdnConst = "fqdn" - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnTypeHostnameConst = "hostname" - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnTypeIpv4AddressConst = "ipv4_address" - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnTypeKeyIDConst = "key_id" -) - -func (*VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn) isaVPNGatewayConnectionIkeIdentity() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn unmarshals an instance of VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn) - 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 -} - -// VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname : VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname struct -// This model "extends" VPNGatewayConnectionIkeIdentity -type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname struct { - // The IKE identity type. - // - // 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 IKE identity hostname value. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname.Type property. -// The IKE identity type. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameTypeFqdnConst = "fqdn" - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameTypeHostnameConst = "hostname" - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameTypeIpv4AddressConst = "ipv4_address" - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameTypeKeyIDConst = "key_id" -) - -func (*VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname) isaVPNGatewayConnectionIkeIdentity() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname unmarshals an instance of VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname) - 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 -} - -// VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 : VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 struct -// This model "extends" VPNGatewayConnectionIkeIdentity -type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 struct { - // The IKE identity type. - // - // 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 IKE identity IPv4 address value. - Value *string `json:"value" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4.Type property. -// The IKE identity type. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4TypeFqdnConst = "fqdn" - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4TypeHostnameConst = "hostname" - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4TypeIpv4AddressConst = "ipv4_address" - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4TypeKeyIDConst = "key_id" -) - -func (*VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4) isaVPNGatewayConnectionIkeIdentity() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 unmarshals an instance of VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4) - 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 -} - -// VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID : VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID struct -// This model "extends" VPNGatewayConnectionIkeIdentity -type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID struct { - // The IKE identity type. - // - // 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 base64-encoded IKE identity key ID value. - Value *[]byte `json:"value" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID.Type property. -// The IKE identity type. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDTypeFqdnConst = "fqdn" - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDTypeHostnameConst = "hostname" - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDTypeIpv4AddressConst = "ipv4_address" - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDTypeKeyIDConst = "key_id" -) - -func (*VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID) isaVPNGatewayConnectionIkeIdentity() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID unmarshals an instance of VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID) - 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 -} - -// VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref : VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref struct -// This model "extends" VPNGatewayConnectionIkePolicyPatch -type VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref struct { - // The IKE policy's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref : Instantiate VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref, err error) { - _model = &VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref) isaVPNGatewayConnectionIkePolicyPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref) - 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 -} - -// VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID : VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID struct -// This model "extends" VPNGatewayConnectionIkePolicyPatch -type VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID struct { - // The unique identifier for this IKE policy. - ID *string `json:"id" validate:"required"` -} - -// NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID : Instantiate VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(id string) (_model *VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID, err error) { - _model = &VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) isaVPNGatewayConnectionIkePolicyPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID) - 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 -} - -// VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref : VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref struct -// This model "extends" VPNGatewayConnectionIkePolicyPrototype -type VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref struct { - // The IKE policy's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref : Instantiate VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref, err error) { - _model = &VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref) isaVPNGatewayConnectionIkePolicyPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref) - 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 -} - -// VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID : VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID struct -// This model "extends" VPNGatewayConnectionIkePolicyPrototype -type VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID struct { - // The unique identifier for this IKE policy. - ID *string `json:"id" validate:"required"` -} - -// NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID : Instantiate VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(id string) (_model *VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID, err error) { - _model = &VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) isaVPNGatewayConnectionIkePolicyPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID) - 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 -} - -// VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref : VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref struct -// This model "extends" VPNGatewayConnectionIPsecPolicyPatch -type VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref struct { - // The IPsec policy's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref : Instantiate VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref, err error) { - _model = &VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref) isaVPNGatewayConnectionIPsecPolicyPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref) - 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 -} - -// VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID : VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID struct -// This model "extends" VPNGatewayConnectionIPsecPolicyPatch -type VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID struct { - // The unique identifier for this IPsec policy. - ID *string `json:"id" validate:"required"` -} - -// NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID : Instantiate VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(id string) (_model *VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID, err error) { - _model = &VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) isaVPNGatewayConnectionIPsecPolicyPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID) - 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 -} - -// VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref : VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref struct -// This model "extends" VPNGatewayConnectionIPsecPolicyPrototype -type VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref struct { - // The IPsec policy's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref : Instantiate VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref(href string) (_model *VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref, err error) { - _model = &VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref) - 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 -} - -// VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID : VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID struct -// This model "extends" VPNGatewayConnectionIPsecPolicyPrototype -type VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID struct { - // The unique identifier for this IPsec policy. - ID *string `json:"id" validate:"required"` -} - -// NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID : Instantiate VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(id string) (_model *VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID, err error) { - _model = &VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID) - 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 -} - -// VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch : 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: -// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch -// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch -// This model "extends" VPNGatewayConnectionPeerPatch -type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch struct { - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address,omitempty"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn,omitempty"` -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch() bool { - return true -} - -type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchIntf interface { - VPNGatewayConnectionPeerPatchIntf - isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch() bool -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch) isaVPNGatewayConnectionPeerPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - 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: -// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch -// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch -// This model "extends" VPNGatewayConnectionPeerPatch -type VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch struct { - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address,omitempty"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn,omitempty"` -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch() bool { - return true -} - -type VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchIntf interface { - VPNGatewayConnectionPeerPatchIntf - isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch() bool -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch) isaVPNGatewayConnectionPeerPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPolicyMode : VPNGatewayConnectionPolicyMode struct -// This model "extends" VPNGatewayConnection -type VPNGatewayConnectionPolicyMode struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up" validate:"required"` - - // The authentication mode. Only `psk` is currently supported. - AuthenticationMode *string `json:"authentication_mode" validate:"required"` - - // The date and time that this VPN gateway connection was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` - - // The establish mode of the VPN gateway connection: - // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol - // negotiations or rekeying processes. - // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway - // connection. Additionally, the peer is responsible for initiating the rekeying process - // after the connection is established. If rekeying does not occur, the VPN gateway - // connection will be brought down after its lifetime expires. - EstablishMode *string `json:"establish_mode" validate:"required"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The IKE policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` - - // The IPsec policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` - - // The mode of the VPN gateway. - Mode *string `json:"mode" validate:"required"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name" validate:"required"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of a VPN gateway connection. - Status *string `json:"status" validate:"required"` - - // The reasons for the current VPN gateway connection status (if any). - StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` - - Local *VPNGatewayConnectionPolicyModeLocal `json:"local" validate:"required"` - - Peer VPNGatewayConnectionPolicyModePeerIntf `json:"peer" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionPolicyMode.AuthenticationMode property. -// The authentication mode. Only `psk` is currently supported. -const ( - VPNGatewayConnectionPolicyModeAuthenticationModePskConst = "psk" -) - -// Constants associated with the VPNGatewayConnectionPolicyMode.EstablishMode property. -// The establish mode of the VPN gateway connection: -// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol -// negotiations or rekeying processes. -// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway -// connection. Additionally, the peer is responsible for initiating the rekeying process -// after the connection is established. If rekeying does not occur, the VPN gateway -// connection will be brought down after its lifetime expires. -const ( - VPNGatewayConnectionPolicyModeEstablishModeBidirectionalConst = "bidirectional" - VPNGatewayConnectionPolicyModeEstablishModePeerOnlyConst = "peer_only" -) - -// Constants associated with the VPNGatewayConnectionPolicyMode.Mode property. -// The mode of the VPN gateway. -const ( - VPNGatewayConnectionPolicyModeModePolicyConst = "policy" - VPNGatewayConnectionPolicyModeModeRouteConst = "route" -) - -// Constants associated with the VPNGatewayConnectionPolicyMode.ResourceType property. -// The resource type. -const ( - VPNGatewayConnectionPolicyModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -// Constants associated with the VPNGatewayConnectionPolicyMode.Status property. -// The status of a VPN gateway connection. -const ( - VPNGatewayConnectionPolicyModeStatusDownConst = "down" - VPNGatewayConnectionPolicyModeStatusUpConst = "up" -) - -func (*VPNGatewayConnectionPolicyMode) isaVPNGatewayConnection() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPolicyMode unmarshals an instance of VPNGatewayConnectionPolicyMode from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPolicyMode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPolicyMode) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) - if err != nil { - err = core.SDKErrorf(err, "", "authentication_mode-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, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) - if err != nil { - err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) - if err != nil { - err = core.SDKErrorf(err, "", "establish_mode-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, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) - if err != nil { - err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) - if err != nil { - err = core.SDKErrorf(err, "", "ipsec_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-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, "psk", &obj.Psk) - if err != nil { - err = core.SDKErrorf(err, "", "psk-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, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) - if err != nil { - err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionPolicyModeLocal) - if err != nil { - err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionPolicyModePeer) - if err != nil { - err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress struct -// This model "extends" VPNGatewayConnectionPolicyModePeerPrototype -type VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress struct { - // The peer CIDRs for this VPN gateway connection. - CIDRs []string `json:"cidrs" validate:"required"` - - // The peer IKE identity to use. - // - // If unspecified: - // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. - // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. - IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` - - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address" validate:"required"` -} - -// NewVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress : Instantiate VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress(cidrs []string, address string) (_model *VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress, err error) { - _model = &VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress{ - CIDRs: cidrs, - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionPolicyModePeerPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress) - err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct -// This model "extends" VPNGatewayConnectionPolicyModePeerPrototype -type VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct { - // The peer CIDRs for this VPN gateway connection. - CIDRs []string `json:"cidrs" validate:"required"` - - // The peer IKE identity to use. - // - // If unspecified: - // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. - // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. - IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn" validate:"required"` -} - -// NewVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn : Instantiate VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn(cidrs []string, fqdn string) (_model *VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn, err error) { - _model = &VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn{ - CIDRs: cidrs, - Fqdn: core.StringPtr(fqdn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionPolicyModePeerPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn) - err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress struct -// This model "extends" VPNGatewayConnectionPolicyModePeer -type VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress struct { - // The peer CIDRs for this VPN gateway connection. - CIDRs []string `json:"cidrs" validate:"required"` - - // The peer IKE identity. - IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` - - // Indicates whether `peer.address` or `peer.fqdn` is used. - Type *string `json:"type" validate:"required"` - - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress.Type property. -// Indicates whether `peer.address` or `peer.fqdn` is used. -const ( - VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddressTypeAddressConst = "address" - VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddressTypeFqdnConst = "fqdn" -) - -func (*VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionPolicyModePeer() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress) - err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn struct -// This model "extends" VPNGatewayConnectionPolicyModePeer -type VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn struct { - // The peer CIDRs for this VPN gateway connection. - CIDRs []string `json:"cidrs" validate:"required"` - - // The peer IKE identity. - IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` - - // Indicates whether `peer.address` or `peer.fqdn` is used. - Type *string `json:"type" validate:"required"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn.Type property. -// Indicates whether `peer.address` or `peer.fqdn` is used. -const ( - VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdnTypeAddressConst = "address" - VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdnTypeFqdnConst = "fqdn" -) - -func (*VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionPolicyModePeer() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn) - err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-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, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct -// This model "extends" VPNGatewayConnectionPrototype -type VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up,omitempty"` - - DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` - - // The establish mode of the VPN gateway connection: - // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol - // negotiations or rekeying processes. - // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway - // connection. Additionally, the peer is responsible for initiating the rekeying process - // after the connection is established. If rekeying does not occur, the VPN gateway - // connection will be brought down after its lifetime expires. - EstablishMode *string `json:"establish_mode,omitempty"` - - IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` - - IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` - - // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - Local *VPNGatewayConnectionPolicyModeLocalPrototype `json:"local" validate:"required"` - - Peer VPNGatewayConnectionPolicyModePeerPrototypeIntf `json:"peer" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype.EstablishMode property. -// The establish mode of the VPN gateway connection: -// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol -// negotiations or rekeying processes. -// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway -// connection. Additionally, the peer is responsible for initiating the rekeying process -// after the connection is established. If rekeying does not occur, the VPN gateway -// connection will be brought down after its lifetime expires. -const ( - VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototypeEstablishModeBidirectionalConst = "bidirectional" - VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototypeEstablishModePeerOnlyConst = "peer_only" -) - -// NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(psk string, local *VPNGatewayConnectionPolicyModeLocalPrototype, peer VPNGatewayConnectionPolicyModePeerPrototypeIntf) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype, err error) { - _model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype{ - Psk: core.StringPtr(psk), - Local: local, - Peer: peer, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype) isaVPNGatewayConnectionPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype unmarshals an instance of VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) - if err != nil { - err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ipsec_policy-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, "psk", &obj.Psk) - if err != nil { - err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionPolicyModeLocalPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionPolicyModePeerPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype struct -// This model "extends" VPNGatewayConnectionPrototype -type VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up,omitempty"` - - DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` - - // The establish mode of the VPN gateway connection: - // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol - // negotiations or rekeying processes. - // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway - // connection. Additionally, the peer is responsible for initiating the rekeying process - // after the connection is established. If rekeying does not occur, the VPN gateway - // connection will be brought down after its lifetime expires. - EstablishMode *string `json:"establish_mode,omitempty"` - - IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` - - IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` - - // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - Local *VPNGatewayConnectionStaticRouteModeLocalPrototype `json:"local,omitempty"` - - Peer VPNGatewayConnectionStaticRouteModePeerPrototypeIntf `json:"peer" validate:"required"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype.EstablishMode property. -// The establish mode of the VPN gateway connection: -// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol -// negotiations or rekeying processes. -// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway -// connection. Additionally, the peer is responsible for initiating the rekeying process -// after the connection is established. If rekeying does not occur, the VPN gateway -// connection will be brought down after its lifetime expires. -const ( - VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototypeEstablishModeBidirectionalConst = "bidirectional" - VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototypeEstablishModePeerOnlyConst = "peer_only" -) - -// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototypeRoutingProtocolNoneConst = "none" -) - -// NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(psk string, peer VPNGatewayConnectionStaticRouteModePeerPrototypeIntf) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype, err error) { - _model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype{ - Psk: core.StringPtr(psk), - Peer: peer, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) isaVPNGatewayConnectionPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype unmarshals an instance of VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) - if err != nil { - err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ipsec_policy-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, "psk", &obj.Psk) - if err != nil { - err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionRouteMode : VPNGatewayConnectionRouteMode struct -// Models which "extend" this model: -// - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode -// This model "extends" VPNGatewayConnection -type VPNGatewayConnectionRouteMode struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up" validate:"required"` - - // The authentication mode. Only `psk` is currently supported. - AuthenticationMode *string `json:"authentication_mode" validate:"required"` - - // The date and time that this VPN gateway connection was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` - - // The establish mode of the VPN gateway connection: - // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol - // negotiations or rekeying processes. - // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway - // connection. Additionally, the peer is responsible for initiating the rekeying process - // after the connection is established. If rekeying does not occur, the VPN gateway - // connection will be brought down after its lifetime expires. - EstablishMode *string `json:"establish_mode" validate:"required"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The IKE policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` - - // The IPsec policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` - - // The mode of the VPN gateway. - Mode *string `json:"mode" validate:"required"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name" validate:"required"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of a VPN gateway connection. - Status *string `json:"status" validate:"required"` - - // The reasons for the current VPN gateway connection status (if any). - StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` - - Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local,omitempty"` - - Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer,omitempty"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` - - // The VPN tunnel configuration for this VPN gateway connection (in static route mode). - Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionRouteMode.AuthenticationMode property. -// The authentication mode. Only `psk` is currently supported. -const ( - VPNGatewayConnectionRouteModeAuthenticationModePskConst = "psk" -) - -// Constants associated with the VPNGatewayConnectionRouteMode.EstablishMode property. -// The establish mode of the VPN gateway connection: -// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol -// negotiations or rekeying processes. -// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway -// connection. Additionally, the peer is responsible for initiating the rekeying process -// after the connection is established. If rekeying does not occur, the VPN gateway -// connection will be brought down after its lifetime expires. -const ( - VPNGatewayConnectionRouteModeEstablishModeBidirectionalConst = "bidirectional" - VPNGatewayConnectionRouteModeEstablishModePeerOnlyConst = "peer_only" -) - -// Constants associated with the VPNGatewayConnectionRouteMode.Mode property. -// The mode of the VPN gateway. -const ( - VPNGatewayConnectionRouteModeModePolicyConst = "policy" - VPNGatewayConnectionRouteModeModeRouteConst = "route" -) - -// Constants associated with the VPNGatewayConnectionRouteMode.ResourceType property. -// The resource type. -const ( - VPNGatewayConnectionRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -// Constants associated with the VPNGatewayConnectionRouteMode.Status property. -// The status of a VPN gateway connection. -const ( - VPNGatewayConnectionRouteModeStatusDownConst = "down" - VPNGatewayConnectionRouteModeStatusUpConst = "up" -) - -// Constants associated with the VPNGatewayConnectionRouteMode.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionRouteModeRoutingProtocolNoneConst = "none" -) - -func (*VPNGatewayConnectionRouteMode) isaVPNGatewayConnectionRouteMode() bool { - return true -} - -type VPNGatewayConnectionRouteModeIntf interface { - VPNGatewayConnectionIntf - isaVPNGatewayConnectionRouteMode() bool -} - -func (*VPNGatewayConnectionRouteMode) isaVPNGatewayConnection() bool { - return true -} - -// UnmarshalVPNGatewayConnectionRouteMode unmarshals an instance of VPNGatewayConnectionRouteMode from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "routing_protocol", &discValue) - if err != nil { - errMsg := fmt.Sprintf("error unmarshalling discriminator property 'routing_protocol': %s", err.Error()) - err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) - return - } - if discValue == "" { - err = core.SDKErrorf(err, "required discriminator property 'routing_protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) - return - } - if discValue == "none" { - err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode-error", common.GetComponentInfo()) - } - } else { - errMsg := fmt.Sprintf("unrecognized value for discriminator property 'routing_protocol': %s", discValue) - err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) - } - return -} - -// VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress struct -// This model "extends" VPNGatewayConnectionStaticRouteModePeerPrototype -type VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress struct { - // The peer IKE identity to use. - // - // If unspecified: - // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. - // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. - IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` - - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address" validate:"required"` -} - -// NewVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress : Instantiate VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress(address string) (_model *VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress, err error) { - _model = &VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionStaticRouteModePeerPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress) - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct -// This model "extends" VPNGatewayConnectionStaticRouteModePeerPrototype -type VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct { - // The peer IKE identity to use. - // - // If unspecified: - // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. - // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. - IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn" validate:"required"` -} - -// NewVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn : Instantiate VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn(fqdn string) (_model *VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn, err error) { - _model = &VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn{ - Fqdn: core.StringPtr(fqdn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionStaticRouteModePeerPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn) - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress struct -// This model "extends" VPNGatewayConnectionStaticRouteModePeer -type VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress struct { - // The peer IKE identity. - IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` - - // Indicates whether `peer.address` or `peer.fqdn` is used. - Type *string `json:"type" validate:"required"` - - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress.Type property. -// Indicates whether `peer.address` or `peer.fqdn` is used. -const ( - VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddressTypeAddressConst = "address" - VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddressTypeFqdnConst = "fqdn" -) - -func (*VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionStaticRouteModePeer() bool { - return true -} - -// UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress) - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn struct -// This model "extends" VPNGatewayConnectionStaticRouteModePeer -type VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn struct { - // The peer IKE identity. - IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` - - // Indicates whether `peer.address` or `peer.fqdn` is used. - Type *string `json:"type" validate:"required"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn.Type property. -// Indicates whether `peer.address` or `peer.fqdn` is used. -const ( - VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdnTypeAddressConst = "address" - VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdnTypeFqdnConst = "fqdn" -) - -func (*VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionStaticRouteModePeer() bool { - return true -} - -// UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn) - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-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, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayPolicyMode : VPNGatewayPolicyMode struct -// This model "extends" VPNGateway -type VPNGatewayPolicyMode struct { - // Connections for this VPN gateway. - Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` - - // The date and time that this VPN gateway was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` - - // The reasons for the current `health_state` (if any). - HealthReasons []VPNGatewayHealthReason `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 VPN gateway's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway. - ID *string `json:"id" validate:"required"` - - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the VPN gateway. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // Collection of VPN gateway members. - Members []VPNGatewayMember `json:"members" validate:"required"` - - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this VPN gateway. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The VPC this VPN gateway resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // Policy mode VPN gateway. - Mode *string `json:"mode" validate:"required"` -} - -// Constants associated with the VPNGatewayPolicyMode.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 ( - VPNGatewayPolicyModeHealthStateDegradedConst = "degraded" - VPNGatewayPolicyModeHealthStateFaultedConst = "faulted" - VPNGatewayPolicyModeHealthStateInapplicableConst = "inapplicable" - VPNGatewayPolicyModeHealthStateOkConst = "ok" -) - -// Constants associated with the VPNGatewayPolicyMode.LifecycleState property. -// The lifecycle state of the VPN gateway. -const ( - VPNGatewayPolicyModeLifecycleStateDeletingConst = "deleting" - VPNGatewayPolicyModeLifecycleStateFailedConst = "failed" - VPNGatewayPolicyModeLifecycleStatePendingConst = "pending" - VPNGatewayPolicyModeLifecycleStateStableConst = "stable" - VPNGatewayPolicyModeLifecycleStateSuspendedConst = "suspended" - VPNGatewayPolicyModeLifecycleStateUpdatingConst = "updating" - VPNGatewayPolicyModeLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VPNGatewayPolicyMode.ResourceType property. -// The resource type. -const ( - VPNGatewayPolicyModeResourceTypeVPNGatewayConst = "vpn_gateway" -) - -// Constants associated with the VPNGatewayPolicyMode.Mode property. -// Policy mode VPN gateway. -const ( - VPNGatewayPolicyModeModePolicyConst = "policy" -) - -func (*VPNGatewayPolicyMode) isaVPNGateway() bool { - return true -} - -// UnmarshalVPNGatewayPolicyMode unmarshals an instance of VPNGatewayPolicyMode from the specified map of raw messages. -func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPolicyMode) - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) - if err != nil { - err = core.SDKErrorf(err, "", "connections-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) - 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) - 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.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) - if err != nil { - err = core.SDKErrorf(err, "", "members-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, "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, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-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.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayPrototypeVPNGatewayPolicyModePrototype : VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct -// This model "extends" VPNGatewayPrototype -type VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct { - // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - - // Policy mode VPN gateway. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the VPNGatewayPrototypeVPNGatewayPolicyModePrototype.Mode property. -// Policy mode VPN gateway. -const ( - VPNGatewayPrototypeVPNGatewayPolicyModePrototypeModePolicyConst = "policy" -) - -// NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayPolicyModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayPolicyModePrototype, err error) { - _model = &VPNGatewayPrototypeVPNGatewayPolicyModePrototype{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayPrototypeVPNGatewayPolicyModePrototype) isaVPNGatewayPrototype() bool { - return true -} - -// UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayPolicyModePrototype from the specified map of raw messages. -func UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPrototypeVPNGatewayPolicyModePrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayPrototypeVPNGatewayRouteModePrototype : VPNGatewayPrototypeVPNGatewayRouteModePrototype struct -// This model "extends" VPNGatewayPrototype -type VPNGatewayPrototypeVPNGatewayRouteModePrototype struct { - // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - - // Route mode VPN gateway. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the VPNGatewayPrototypeVPNGatewayRouteModePrototype.Mode property. -// Route mode VPN gateway. -const ( - VPNGatewayPrototypeVPNGatewayRouteModePrototypeModeRouteConst = "route" -) - -// NewVPNGatewayPrototypeVPNGatewayRouteModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayRouteModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayRouteModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayRouteModePrototype, err error) { - _model = &VPNGatewayPrototypeVPNGatewayRouteModePrototype{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayPrototypeVPNGatewayRouteModePrototype) isaVPNGatewayPrototype() bool { - return true -} - -// UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayRouteModePrototype from the specified map of raw messages. -func UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPrototypeVPNGatewayRouteModePrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayRouteMode : VPNGatewayRouteMode struct -// This model "extends" VPNGateway -type VPNGatewayRouteMode struct { - // Connections for this VPN gateway. - Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` - - // The date and time that this VPN gateway was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` - - // The reasons for the current `health_state` (if any). - HealthReasons []VPNGatewayHealthReason `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 VPN gateway's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway. - ID *string `json:"id" validate:"required"` - - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the VPN gateway. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // Collection of VPN gateway members. - Members []VPNGatewayMember `json:"members" validate:"required"` - - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this VPN gateway. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The VPC this VPN gateway resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // Route mode VPN gateway. - Mode *string `json:"mode" validate:"required"` -} - -// Constants associated with the VPNGatewayRouteMode.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 ( - VPNGatewayRouteModeHealthStateDegradedConst = "degraded" - VPNGatewayRouteModeHealthStateFaultedConst = "faulted" - VPNGatewayRouteModeHealthStateInapplicableConst = "inapplicable" - VPNGatewayRouteModeHealthStateOkConst = "ok" -) - -// Constants associated with the VPNGatewayRouteMode.LifecycleState property. -// The lifecycle state of the VPN gateway. -const ( - VPNGatewayRouteModeLifecycleStateDeletingConst = "deleting" - VPNGatewayRouteModeLifecycleStateFailedConst = "failed" - VPNGatewayRouteModeLifecycleStatePendingConst = "pending" - VPNGatewayRouteModeLifecycleStateStableConst = "stable" - VPNGatewayRouteModeLifecycleStateSuspendedConst = "suspended" - VPNGatewayRouteModeLifecycleStateUpdatingConst = "updating" - VPNGatewayRouteModeLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VPNGatewayRouteMode.ResourceType property. -// The resource type. -const ( - VPNGatewayRouteModeResourceTypeVPNGatewayConst = "vpn_gateway" -) - -// Constants associated with the VPNGatewayRouteMode.Mode property. -// Route mode VPN gateway. -const ( - VPNGatewayRouteModeModeRouteConst = "route" -) - -func (*VPNGatewayRouteMode) isaVPNGateway() bool { - return true -} - -// UnmarshalVPNGatewayRouteMode unmarshals an instance of VPNGatewayRouteMode from the specified map of raw messages. -func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayRouteMode) - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) - if err != nil { - err = core.SDKErrorf(err, "", "connections-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) - 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) - 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.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) - if err != nil { - err = core.SDKErrorf(err, "", "members-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, "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, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-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.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthenticationByCertificate : VPNServerAuthenticationByCertificate struct -// This model "extends" VPNServerAuthentication -type VPNServerAuthenticationByCertificate struct { - // The type of authentication. - Method *string `json:"method" validate:"required"` - - // The certificate instance used for the VPN client certificate authority (CA). - ClientCa *CertificateInstanceReference `json:"client_ca" validate:"required"` - - // The certificate revocation list contents, encoded in PEM format. - Crl *string `json:"crl,omitempty"` -} - -// Constants associated with the VPNServerAuthenticationByCertificate.Method property. -// The type of authentication. -const ( - VPNServerAuthenticationByCertificateMethodCertificateConst = "certificate" - VPNServerAuthenticationByCertificateMethodUsernameConst = "username" -) - -func (*VPNServerAuthenticationByCertificate) isaVPNServerAuthentication() bool { - return true -} - -// UnmarshalVPNServerAuthenticationByCertificate unmarshals an instance of VPNServerAuthenticationByCertificate from the specified map of raw messages. -func UnmarshalVPNServerAuthenticationByCertificate(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerAuthenticationByCertificate) - err = core.UnmarshalPrimitive(m, "method", &obj.Method) - if err != nil { - err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) - if err != nil { - err = core.SDKErrorf(err, "", "client_ca-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) - if err != nil { - err = core.SDKErrorf(err, "", "crl-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthenticationByUsername : VPNServerAuthenticationByUsername struct -// This model "extends" VPNServerAuthentication -type VPNServerAuthenticationByUsername struct { - // The type of authentication. - Method *string `json:"method" validate:"required"` - - // The type of identity provider to be used by VPN client. - IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider" validate:"required"` -} - -// Constants associated with the VPNServerAuthenticationByUsername.Method property. -// The type of authentication. -const ( - VPNServerAuthenticationByUsernameMethodCertificateConst = "certificate" - VPNServerAuthenticationByUsernameMethodUsernameConst = "username" -) - -func (*VPNServerAuthenticationByUsername) isaVPNServerAuthentication() bool { - return true -} - -// UnmarshalVPNServerAuthenticationByUsername unmarshals an instance of VPNServerAuthenticationByUsername from the specified map of raw messages. -func UnmarshalVPNServerAuthenticationByUsername(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerAuthenticationByUsername) - err = core.UnmarshalPrimitive(m, "method", &obj.Method) - if err != nil { - err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) - if err != nil { - err = core.SDKErrorf(err, "", "identity_provider-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthenticationByUsernameIDProviderByIam : VPNServerAuthenticationByUsernameIDProviderByIam struct -// This model "extends" VPNServerAuthenticationByUsernameIDProvider -type VPNServerAuthenticationByUsernameIDProviderByIam struct { - // The type of identity provider to be used by the VPN client: - // - `iam`: IBM identity and access management - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - ProviderType *string `json:"provider_type" validate:"required"` -} - -// Constants associated with the VPNServerAuthenticationByUsernameIDProviderByIam.ProviderType property. -// The type of identity provider to be used by the VPN client: -// - `iam`: IBM identity and access management -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -const ( - VPNServerAuthenticationByUsernameIDProviderByIamProviderTypeIamConst = "iam" -) - -// NewVPNServerAuthenticationByUsernameIDProviderByIam : Instantiate VPNServerAuthenticationByUsernameIDProviderByIam (Generic Model Constructor) -func (*VpcV1) NewVPNServerAuthenticationByUsernameIDProviderByIam(providerType string) (_model *VPNServerAuthenticationByUsernameIDProviderByIam, err error) { - _model = &VPNServerAuthenticationByUsernameIDProviderByIam{ - ProviderType: core.StringPtr(providerType), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNServerAuthenticationByUsernameIDProviderByIam) isaVPNServerAuthenticationByUsernameIDProvider() bool { - return true -} - -// UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam unmarshals an instance of VPNServerAuthenticationByUsernameIDProviderByIam from the specified map of raw messages. -func UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerAuthenticationByUsernameIDProviderByIam) - err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) - if err != nil { - err = core.SDKErrorf(err, "", "provider_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype : VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype struct -// This model "extends" VPNServerAuthenticationPrototype -type VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype struct { - // The type of authentication. - Method *string `json:"method" validate:"required"` - - // The certificate instance to use for the VPN client certificate authority (CA). - ClientCa CertificateInstanceIdentityIntf `json:"client_ca" validate:"required"` - - // The certificate revocation list contents, encoded in PEM format. - Crl *string `json:"crl,omitempty"` -} - -// Constants associated with the VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype.Method property. -// The type of authentication. -const ( - VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototypeMethodCertificateConst = "certificate" - VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototypeMethodUsernameConst = "username" -) - -// NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype : Instantiate VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(method string, clientCa CertificateInstanceIdentityIntf) (_model *VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype, err error) { - _model = &VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype{ - Method: core.StringPtr(method), - ClientCa: clientCa, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) isaVPNServerAuthenticationPrototype() bool { - return true -} - -// UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype unmarshals an instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype from the specified map of raw messages. -func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) - err = core.UnmarshalPrimitive(m, "method", &obj.Method) - if err != nil { - err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "client_ca-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) - if err != nil { - err = core.SDKErrorf(err, "", "crl-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype : VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype struct -// This model "extends" VPNServerAuthenticationPrototype -type VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype struct { - // The type of authentication. - Method *string `json:"method" validate:"required"` - - // The type of identity provider to be used by VPN client. - IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider" validate:"required"` -} - -// Constants associated with the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype.Method property. -// The type of authentication. -const ( - VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototypeMethodCertificateConst = "certificate" - VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototypeMethodUsernameConst = "username" -) - -// NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype : Instantiate VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(method string, identityProvider VPNServerAuthenticationByUsernameIDProviderIntf) (_model *VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype, err error) { - _model = &VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype{ - Method: core.StringPtr(method), - IdentityProvider: identityProvider, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) isaVPNServerAuthenticationPrototype() bool { - return true -} - -// UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype unmarshals an instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype from the specified map of raw messages. -func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) - err = core.UnmarshalPrimitive(m, "method", &obj.Method) - if err != nil { - err = core.SDKErrorf(err, "", "method-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) - if err != nil { - err = core.SDKErrorf(err, "", "identity_provider-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - 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: -// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID -// - VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref -// This model "extends" VirtualNetworkInterfaceIPPrototype -type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` -} - -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { - return true -} - -type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextIntf interface { - VirtualNetworkInterfaceIPPrototypeIntf - isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool -} - -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext) - 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 -} - -// VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext : The prototype for a new reserved IP. Must be in the primary IP's subnet. -// This model "extends" VirtualNetworkInterfaceIPPrototype -type VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext 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 reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) isaVirtualNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPPrototypeVirtualNetworkInterfaceIPsContext) - 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 -} - -// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext : Identifies a reserved IP by a unique property. Required if `subnet` is not specified. The reserved IP must be -// currently unbound. -// Models which "extend" this model: -// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID -// - VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref -// This model "extends" VirtualNetworkInterfacePrimaryIPPrototype -type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext struct { - // The unique identifier for this reserved IP. - ID *string `json:"id,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href,omitempty"` -} - -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { - return true -} - -type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextIntf interface { - VirtualNetworkInterfacePrimaryIPPrototypeIntf - isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool -} - -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext) - 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 -} - -// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext : The prototype for a new reserved IP. Requires `subnet` to be specified. -// This model "extends" VirtualNetworkInterfacePrimaryIPPrototype -type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext 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 reserved IP member will be automatically deleted when either - // `target` is deleted, or the reserved IP is unbound. - AutoDelete *bool `json:"auto_delete,omitempty"` - - // The name for this reserved IP. The name must not be used by another reserved IP in the 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 (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPPrototypeVirtualNetworkInterfacePrimaryIPContext) - 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 -} - -// VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct -// This model "extends" VirtualNetworkInterfaceTarget -type VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { - // 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 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 resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext.ResourceType property. -// The resource type. -const ( - VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContextResourceTypeBareMetalServerNetworkAttachmentConst = "bare_metal_server_network_attachment" -) - -func (*VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext) isaVirtualNetworkInterfaceTarget() bool { - return true -} - -// UnmarshalVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext unmarshals an instance of VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceTargetBareMetalServerNetworkAttachmentReferenceVirtualNetworkInterfaceContext) - 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 -} - -// VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext : VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct -// This model "extends" VirtualNetworkInterfaceTarget -type VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext struct { - // The URL for this instance network attachment. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance network attachment. - ID *string `json:"id" validate:"required"` - - // The name for this instance 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 VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext.ResourceType property. -// The resource type. -const ( - VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContextResourceTypeInstanceNetworkAttachmentConst = "instance_network_attachment" -) - -func (*VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) isaVirtualNetworkInterfaceTarget() bool { - return true -} - -// UnmarshalVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext unmarshals an instance of VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVirtualNetworkInterfaceContext) - 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 -} - -// VirtualNetworkInterfaceTargetShareMountTargetReference : VirtualNetworkInterfaceTargetShareMountTargetReference struct -// This model "extends" VirtualNetworkInterfaceTarget -type VirtualNetworkInterfaceTargetShareMountTargetReference struct { - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this share mount target. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this share mount target. - ID *string `json:"id" validate:"required"` - - // The name for this share mount target. The name is unique across all mount targets for the file share. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the VirtualNetworkInterfaceTargetShareMountTargetReference.ResourceType property. -// The resource type. -const ( - VirtualNetworkInterfaceTargetShareMountTargetReferenceResourceTypeShareMountTargetConst = "share_mount_target" -) - -func (*VirtualNetworkInterfaceTargetShareMountTargetReference) isaVirtualNetworkInterfaceTarget() bool { - return true -} - -// UnmarshalVirtualNetworkInterfaceTargetShareMountTargetReference unmarshals an instance of VirtualNetworkInterfaceTargetShareMountTargetReference from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceTargetShareMountTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceTargetShareMountTargetReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) - 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 -} - -// VolumeAttachmentPrototypeVolumeVolumeIdentity : Identifies a volume by a unique property. -// Models which "extend" this model: -// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID -// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN -// - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref -// This model "extends" VolumeAttachmentPrototypeVolume -type VolumeAttachmentPrototypeVolumeVolumeIdentity struct { - // The unique identifier for this volume. - ID *string `json:"id,omitempty"` - - // The CRN for this volume. - CRN *string `json:"crn,omitempty"` - - // The URL for this volume. - Href *string `json:"href,omitempty"` -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentity) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { - return true -} - -type VolumeAttachmentPrototypeVolumeVolumeIdentityIntf interface { - VolumeAttachmentPrototypeVolumeIntf - isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentity) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentity unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentity from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct -// Models which "extend" this model: -// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity -// - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot -// This model "extends" VolumeAttachmentPrototypeVolume -type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to - // use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - // The resource group to use for this volume. If unspecified, the instance's resource - // group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The capacity to use for the volume (in gigabytes). - // - // The minimum and maximum limits for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` -} - -func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { - return true -} - -type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextIntf interface { - VolumeAttachmentPrototypeVolumeIntf - isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool -} - -func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeIdentityByCRN : VolumeIdentityByCRN struct -// This model "extends" VolumeIdentity -type VolumeIdentityByCRN struct { - // The CRN for this volume. - CRN *string `json:"crn" validate:"required"` -} - -// NewVolumeIdentityByCRN : Instantiate VolumeIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewVolumeIdentityByCRN(crn string) (_model *VolumeIdentityByCRN, err error) { - _model = &VolumeIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VolumeIdentityByCRN) isaVolumeIdentity() bool { - return true -} - -// UnmarshalVolumeIdentityByCRN unmarshals an instance of VolumeIdentityByCRN from the specified map of raw messages. -func UnmarshalVolumeIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeIdentityByCRN) - 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 -} - -// VolumeIdentityByHref : VolumeIdentityByHref struct -// This model "extends" VolumeIdentity -type VolumeIdentityByHref struct { - // The URL for this volume. - Href *string `json:"href" validate:"required"` -} - -// NewVolumeIdentityByHref : Instantiate VolumeIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVolumeIdentityByHref(href string) (_model *VolumeIdentityByHref, err error) { - _model = &VolumeIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VolumeIdentityByHref) isaVolumeIdentity() bool { - return true -} - -// UnmarshalVolumeIdentityByHref unmarshals an instance of VolumeIdentityByHref from the specified map of raw messages. -func UnmarshalVolumeIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeIdentityByHref) - 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 -} - -// VolumeIdentityByID : VolumeIdentityByID struct -// This model "extends" VolumeIdentity -type VolumeIdentityByID struct { - // The unique identifier for this volume. - ID *string `json:"id" validate:"required"` -} - -// NewVolumeIdentityByID : Instantiate VolumeIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVolumeIdentityByID(id string) (_model *VolumeIdentityByID, err error) { - _model = &VolumeIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VolumeIdentityByID) isaVolumeIdentity() bool { - return true -} - -// UnmarshalVolumeIdentityByID unmarshals an instance of VolumeIdentityByID from the specified map of raw messages. -func UnmarshalVolumeIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeIdentityByID) - 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 -} - -// VolumeProfileIdentityByHref : VolumeProfileIdentityByHref struct -// This model "extends" VolumeProfileIdentity -type VolumeProfileIdentityByHref struct { - // The URL for this volume profile. - Href *string `json:"href" validate:"required"` -} - -// NewVolumeProfileIdentityByHref : Instantiate VolumeProfileIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVolumeProfileIdentityByHref(href string) (_model *VolumeProfileIdentityByHref, err error) { - _model = &VolumeProfileIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VolumeProfileIdentityByHref) isaVolumeProfileIdentity() bool { - return true -} - -// UnmarshalVolumeProfileIdentityByHref unmarshals an instance of VolumeProfileIdentityByHref from the specified map of raw messages. -func UnmarshalVolumeProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileIdentityByHref) - 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 -} - -// VolumeProfileIdentityByName : VolumeProfileIdentityByName struct -// This model "extends" VolumeProfileIdentity -type VolumeProfileIdentityByName struct { - // The globally unique name for this volume profile. - Name *string `json:"name" validate:"required"` -} - -// NewVolumeProfileIdentityByName : Instantiate VolumeProfileIdentityByName (Generic Model Constructor) -func (*VpcV1) NewVolumeProfileIdentityByName(name string) (_model *VolumeProfileIdentityByName, err error) { - _model = &VolumeProfileIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VolumeProfileIdentityByName) isaVolumeProfileIdentity() bool { - return true -} - -// UnmarshalVolumeProfileIdentityByName unmarshals an instance of VolumeProfileIdentityByName from the specified map of raw messages. -func UnmarshalVolumeProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeProfileIdentityByName) - 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 -} - -// VolumePrototypeVolumeByCapacity : VolumePrototypeVolumeByCapacity struct -// This model "extends" VolumePrototype -type VolumePrototypeVolumeByCapacity struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The zone this volume will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The capacity to use for the volume (in gigabytes). - // - // The minimum and maximum limits for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Capacity *int64 `json:"capacity" validate:"required"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` -} - -// NewVolumePrototypeVolumeByCapacity : Instantiate VolumePrototypeVolumeByCapacity (Generic Model Constructor) -func (*VpcV1) NewVolumePrototypeVolumeByCapacity(profile VolumeProfileIdentityIntf, zone ZoneIdentityIntf, capacity int64) (_model *VolumePrototypeVolumeByCapacity, err error) { - _model = &VolumePrototypeVolumeByCapacity{ - Profile: profile, - Zone: zone, - Capacity: core.Int64Ptr(capacity), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VolumePrototypeVolumeByCapacity) isaVolumePrototype() bool { - return true -} - -// UnmarshalVolumePrototypeVolumeByCapacity unmarshals an instance of VolumePrototypeVolumeByCapacity from the specified map of raw messages. -func UnmarshalVolumePrototypeVolumeByCapacity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumePrototypeVolumeByCapacity) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - err = core.SDKErrorf(err, "", "capacity-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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumePrototypeVolumeBySourceSnapshot : VolumePrototypeVolumeBySourceSnapshot struct -// This model "extends" VolumePrototype -type VolumePrototypeVolumeBySourceSnapshot struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The zone this volume will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's - // `minimum_capacity`. The maximum value may increase in the future. - // - // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` -} - -// NewVolumePrototypeVolumeBySourceSnapshot : Instantiate VolumePrototypeVolumeBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewVolumePrototypeVolumeBySourceSnapshot(profile VolumeProfileIdentityIntf, zone ZoneIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumePrototypeVolumeBySourceSnapshot, err error) { - _model = &VolumePrototypeVolumeBySourceSnapshot{ - Profile: profile, - Zone: zone, - SourceSnapshot: sourceSnapshot, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VolumePrototypeVolumeBySourceSnapshot) isaVolumePrototype() bool { - return true -} - -// UnmarshalVolumePrototypeVolumeBySourceSnapshot unmarshals an instance of VolumePrototypeVolumeBySourceSnapshot from the specified map of raw messages. -func UnmarshalVolumePrototypeVolumeBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumePrototypeVolumeBySourceSnapshot) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ZoneIdentityByHref : ZoneIdentityByHref struct -// This model "extends" ZoneIdentity -type ZoneIdentityByHref struct { - // The URL for this zone. - Href *string `json:"href" validate:"required"` -} - -// NewZoneIdentityByHref : Instantiate ZoneIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewZoneIdentityByHref(href string) (_model *ZoneIdentityByHref, err error) { - _model = &ZoneIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ZoneIdentityByHref) isaZoneIdentity() bool { - return true -} - -// UnmarshalZoneIdentityByHref unmarshals an instance of ZoneIdentityByHref from the specified map of raw messages. -func UnmarshalZoneIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ZoneIdentityByHref) - 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 -} - -// ZoneIdentityByName : ZoneIdentityByName struct -// This model "extends" ZoneIdentity -type ZoneIdentityByName struct { - // The globally unique name for this zone. - Name *string `json:"name" validate:"required"` -} - -// NewZoneIdentityByName : Instantiate ZoneIdentityByName (Generic Model Constructor) -func (*VpcV1) NewZoneIdentityByName(name string) (_model *ZoneIdentityByName, err error) { - _model = &ZoneIdentityByName{ - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ZoneIdentityByName) isaZoneIdentity() bool { - return true -} - -// UnmarshalZoneIdentityByName unmarshals an instance of ZoneIdentityByName from the specified map of raw messages. -func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ZoneIdentityByName) - 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 -} - -// BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN : BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN struct -// This model "extends" BackupPolicyScopePrototypeEnterpriseIdentity -type BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN struct { - // The CRN for this enterprise. - CRN *string `json:"crn" validate:"required"` -} - -// NewBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN : Instantiate BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN(crn string) (_model *BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN, err error) { - _model = &BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) isaBackupPolicyScopePrototypeEnterpriseIdentity() bool { - return true -} - -func (*BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) isaBackupPolicyScopePrototype() bool { - return true -} - -// UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN unmarshals an instance of BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN from the specified map of raw messages. -func UnmarshalBackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyScopePrototypeEnterpriseIdentityEnterpriseIdentityByCRN) - 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 -} - -// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - 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 -} - -// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - 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 -} - -// BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - 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 { - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` -} - -// NewEndpointGatewayReservedIPReservedIPIdentityByHref : Instantiate EndpointGatewayReservedIPReservedIPIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityByHref(href string) (_model *EndpointGatewayReservedIPReservedIPIdentityByHref, err error) { - _model = &EndpointGatewayReservedIPReservedIPIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*EndpointGatewayReservedIPReservedIPIdentityByHref) isaEndpointGatewayReservedIPReservedIPIdentity() bool { - return true -} - -func (*EndpointGatewayReservedIPReservedIPIdentityByHref) isaEndpointGatewayReservedIP() bool { - return true -} - -// UnmarshalEndpointGatewayReservedIPReservedIPIdentityByHref unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityByHref from the specified map of raw messages. -func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReservedIPReservedIPIdentityByHref) - 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 -} - -// EndpointGatewayReservedIPReservedIPIdentityByID : EndpointGatewayReservedIPReservedIPIdentityByID struct -// This model "extends" EndpointGatewayReservedIPReservedIPIdentity -type EndpointGatewayReservedIPReservedIPIdentityByID struct { - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` -} - -// NewEndpointGatewayReservedIPReservedIPIdentityByID : Instantiate EndpointGatewayReservedIPReservedIPIdentityByID (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityByID(id string) (_model *EndpointGatewayReservedIPReservedIPIdentityByID, err error) { - _model = &EndpointGatewayReservedIPReservedIPIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*EndpointGatewayReservedIPReservedIPIdentityByID) isaEndpointGatewayReservedIPReservedIPIdentity() bool { - return true -} - -func (*EndpointGatewayReservedIPReservedIPIdentityByID) isaEndpointGatewayReservedIP() bool { - return true -} - -// UnmarshalEndpointGatewayReservedIPReservedIPIdentityByID unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityByID from the specified map of raw messages. -func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReservedIPReservedIPIdentityByID) - 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 -} - -// EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN : EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN struct -// This model "extends" EndpointGatewayTargetPrototypeProviderCloudServiceIdentity -type EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` - - // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. - CRN *string `json:"crn" validate:"required"` -} - -// Constants associated with the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN.ResourceType property. -// The type of target for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRNResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRNResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -// NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN : Instantiate EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(resourceType string, crn string) (_model *EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN, err error) { - _model = &EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN{ - ResourceType: core.StringPtr(resourceType), - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool { - return true -} - -func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) isaEndpointGatewayTargetPrototype() bool { - return true -} - -// UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN unmarshals an instance of EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) - 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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName : The name of this provider infrastructure service. -// This model "extends" EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity -type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` - - // The name of a provider infrastructure service. Must be: - // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. - Name *string `json:"name" validate:"required"` -} - -// Constants associated with the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName.ResourceType property. -// The type of target for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByNameResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByNameResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -// NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName : Instantiate EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(resourceType string, name string) (_model *EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName, err error) { - _model = &EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName{ - ResourceType: core.StringPtr(resourceType), - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool { - return true -} - -func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) isaEndpointGatewayTargetPrototype() bool { - return true -} - -// UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName unmarshals an instance of EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) - 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, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct -// This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity -type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { - // 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"` -} - -// NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref, err error) { - _model = &FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) - 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 -} - -// FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct -// This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity -type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { - // 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"` -} - -// NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID, err error) { - _model = &FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) - 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 -} - -// FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct -// This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity -type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { - // The URL for this instance network interface. - // - // If this instance 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"` -} - -// NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { - _model = &FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) - 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 -} - -// FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct -// This model "extends" FloatingIPTargetPatchNetworkInterfaceIdentity -type FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { - // The unique identifier for this instance network interface. - // - // If this instance 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"` -} - -// NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { - _model = &FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - 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 -} - -// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity -type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - 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 -} - -// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity -type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - 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 -} - -// FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" FloatingIPTargetPatchVirtualNetworkInterfaceIdentity -type FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPatchVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPatch() bool { - return true -} - -// UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPatchVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - 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 -} - -// FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct -// This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity -type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { - // 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"` -} - -// NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref, err error) { - _model = &FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref) - 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 -} - -// FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct -// This model "extends" FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity -type FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID struct { - // 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"` -} - -// NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID, err error) { - _model = &FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByID) - 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 -} - -// FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct -// This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity -type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { - // The URL for this instance network interface. - // - // If this instance 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"` -} - -// NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { - _model = &FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) - 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 -} - -// FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct -// This model "extends" FloatingIPTargetPrototypeNetworkInterfaceIdentity -type FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { - // The unique identifier for this instance network interface. - // - // If this instance 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"` -} - -// NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { - _model = &FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - 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 -} - -// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity -type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - 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 -} - -// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity -type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - 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 -} - -// FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity -type FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFloatingIPTargetPrototype() bool { - return true -} - -// UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - 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 -} - -// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct -// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity -type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { - // The CRN for this virtual server instance. - CRN *string `json:"crn" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN, err error) { - _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) - 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 -} - -// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref struct -// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity -type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref struct { - // The URL for this virtual server instance. - Href *string `json:"href" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref, err error) { - _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) - 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 -} - -// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID struct -// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity -type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID struct { - // The unique identifier for this virtual server instance. - ID *string `json:"id" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID, err error) { - _model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) - 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 -} - -// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref : FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref struct -// This model "extends" FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity -type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref struct { - // The URL for this instance network attachment. - Href *string `json:"href" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref, err error) { - _model = &FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByHref) - 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 -} - -// FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID : FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID struct -// This model "extends" FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity -type FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID struct { - // The unique identifier for this instance network attachment. - ID *string `json:"id" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID : Instantiate FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID, err error) { - _model = &FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) isaFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeInstanceNetworkAttachmentIdentityInstanceNetworkAttachmentIdentityByID) - 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 -} - -// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct -// This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity -type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { - // The URL for this instance network interface. - // - // If this instance 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"` -} - -// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { - _model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) - 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 -} - -// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct -// This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity -type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { - // The unique identifier for this instance network interface. - // - // If this instance 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"` -} - -// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { - _model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityByID) - 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 -} - -// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN struct -// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity -type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN struct { - // The CRN for this subnet. - CRN *string `json:"crn" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN, err error) { - _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) - 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 -} - -// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref struct -// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity -type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref struct { - // The URL for this subnet. - Href *string `json:"href" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref, err error) { - _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) - 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 -} - -// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID struct -// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity -type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID struct { - // The unique identifier for this subnet. - ID *string `json:"id" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID, err error) { - _model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) - 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 -} - -// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN struct -// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity -type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN, err error) { - _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) - 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 -} - -// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref struct -// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity -type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref struct { - // The URL for this VPC. - Href *string `json:"href" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref, err error) { - _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) - 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 -} - -// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID struct -// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity -type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID struct { - // The unique identifier for this VPC. - ID *string `json:"id" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID, err error) { - _model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) - 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 -} - -// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity -type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - 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 -} - -// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity -type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - 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 -} - -// FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity -type FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { - return true -} - -// UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - 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 -// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager -// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototype -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { - return true -} - -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecIntf interface { - InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf - isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt struct -// Models which "extend" this model: -// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup -// - InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager -// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototype -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The date and time the scheduled action will run. - RunAt *strfmt.DateTime `json:"run_at,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager,omitempty"` -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { - return true -} - -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtIntf interface { - InstanceGroupManagerActionPrototypeScheduledActionPrototypeIntf - isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) - if err != nil { - err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionScheduledActionGroupTarget : InstanceGroupManagerActionScheduledActionGroupTarget struct -// This model "extends" InstanceGroupManagerActionScheduledAction -type InstanceGroupManagerActionScheduledActionGroupTarget struct { - // Indicates whether this scheduled action will be automatically deleted after it has completed and - // `auto_delete_timeout` hours have passed. 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`, and this scheduled action has finished, the hours after which it will be automatically - // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the - // future. - AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` - - // The date and time that the instance group manager action was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager action. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager action. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager action. The name is unique across all actions for the instance group - // manager. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the instance group action - // - `active`: Action is ready to be run - // - `completed`: Action was completed successfully - // - `failed`: Action could not be completed successfully - // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. - Status *string `json:"status" validate:"required"` - - // The date and time that the instance group manager action was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The type of action for the instance group. - ActionType *string `json:"action_type" validate:"required"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - // The date and time the scheduled action was last applied. If absent, the action has never been applied. - LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` - - // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run - // time. - NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroup `json:"group" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ResourceType property. -// The resource type. -const ( - InstanceGroupManagerActionScheduledActionGroupTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" -) - -// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.Status property. -// The status of the instance group action -// - `active`: Action is ready to be run -// - `completed`: Action was completed successfully -// - `failed`: Action could not be completed successfully -// - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. -const ( - InstanceGroupManagerActionScheduledActionGroupTargetStatusActiveConst = "active" - InstanceGroupManagerActionScheduledActionGroupTargetStatusCompletedConst = "completed" - InstanceGroupManagerActionScheduledActionGroupTargetStatusFailedConst = "failed" - InstanceGroupManagerActionScheduledActionGroupTargetStatusIncompatibleConst = "incompatible" - InstanceGroupManagerActionScheduledActionGroupTargetStatusOmittedConst = "omitted" -) - -// Constants associated with the InstanceGroupManagerActionScheduledActionGroupTarget.ActionType property. -// The type of action for the instance group. -const ( - InstanceGroupManagerActionScheduledActionGroupTargetActionTypeScheduledConst = "scheduled" -) - -func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerActionScheduledAction() bool { - return true -} - -func (*InstanceGroupManagerActionScheduledActionGroupTarget) isaInstanceGroupManagerAction() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionGroupTarget from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionScheduledActionGroupTarget) - 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_timeout", &obj.AutoDeleteTimeout) - if err != nil { - err = core.SDKErrorf(err, "", "auto_delete_timeout-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, "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, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) - if err != nil { - err = core.SDKErrorf(err, "", "action_type-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.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) - if err != nil { - err = core.SDKErrorf(err, "", "last_applied_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) - if err != nil { - err = core.SDKErrorf(err, "", "next_run_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroup) - if err != nil { - err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionScheduledActionManagerTarget : InstanceGroupManagerActionScheduledActionManagerTarget struct -// This model "extends" InstanceGroupManagerActionScheduledAction -type InstanceGroupManagerActionScheduledActionManagerTarget struct { - // Indicates whether this scheduled action will be automatically deleted after it has completed and - // `auto_delete_timeout` hours have passed. 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`, and this scheduled action has finished, the hours after which it will be automatically - // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the - // future. - AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` - - // The date and time that the instance group manager action was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this instance group manager action. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance group manager action. - ID *string `json:"id" validate:"required"` - - // The name for this instance group manager action. The name is unique across all actions for the instance group - // manager. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the instance group action - // - `active`: Action is ready to be run - // - `completed`: Action was completed successfully - // - `failed`: Action could not be completed successfully - // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. - Status *string `json:"status" validate:"required"` - - // The date and time that the instance group manager action was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - - // The type of action for the instance group. - ActionType *string `json:"action_type" validate:"required"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - // The date and time the scheduled action was last applied. If absent, the action has never been applied. - LastAppliedAt *strfmt.DateTime `json:"last_applied_at,omitempty"` - - // The date and time the scheduled action will next run. If absent, the system is currently calculating the next run - // time. - NextRunAt *strfmt.DateTime `json:"next_run_at,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerIntf `json:"manager" validate:"required"` -} - -// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ResourceType property. -// The resource type. -const ( - InstanceGroupManagerActionScheduledActionManagerTargetResourceTypeInstanceGroupManagerActionConst = "instance_group_manager_action" -) - -// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.Status property. -// The status of the instance group action -// - `active`: Action is ready to be run -// - `completed`: Action was completed successfully -// - `failed`: Action could not be completed successfully -// - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. -const ( - InstanceGroupManagerActionScheduledActionManagerTargetStatusActiveConst = "active" - InstanceGroupManagerActionScheduledActionManagerTargetStatusCompletedConst = "completed" - InstanceGroupManagerActionScheduledActionManagerTargetStatusFailedConst = "failed" - InstanceGroupManagerActionScheduledActionManagerTargetStatusIncompatibleConst = "incompatible" - InstanceGroupManagerActionScheduledActionManagerTargetStatusOmittedConst = "omitted" -) - -// Constants associated with the InstanceGroupManagerActionScheduledActionManagerTarget.ActionType property. -// The type of action for the instance group. -const ( - InstanceGroupManagerActionScheduledActionManagerTargetActionTypeScheduledConst = "scheduled" -) - -func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerActionScheduledAction() bool { - return true -} - -func (*InstanceGroupManagerActionScheduledActionManagerTarget) isaInstanceGroupManagerAction() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget unmarshals an instance of InstanceGroupManagerActionScheduledActionManagerTarget from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionScheduledActionManagerTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionScheduledActionManagerTarget) - 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_timeout", &obj.AutoDeleteTimeout) - if err != nil { - err = core.SDKErrorf(err, "", "auto_delete_timeout-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, "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, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "action_type", &obj.ActionType) - if err != nil { - err = core.SDKErrorf(err, "", "action_type-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.UnmarshalPrimitive(m, "last_applied_at", &obj.LastAppliedAt) - if err != nil { - err = core.SDKErrorf(err, "", "last_applied_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "next_run_at", &obj.NextRunAt) - if err != nil { - err = core.SDKErrorf(err, "", "next_run_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManager) - if err != nil { - err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct -// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype -type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref struct { - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The URL for this instance group manager. - Href *string `json:"href" validate:"required"` -} - -// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(href string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref, err error) { - _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { - return true -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByHref) - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "min_membership_count-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 -} - -// InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct -// This model "extends" InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype -type InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID struct { - // The desired maximum number of instance group members at the scheduled time. - MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` - - // The desired minimum number of instance group members at the scheduled time. - MinMembershipCount *int64 `json:"min_membership_count,omitempty"` - - // The unique identifier for this instance group manager. - ID *string `json:"id" validate:"required"` -} - -// NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID : Instantiate InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(id string) (_model *InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID, err error) { - _model = &InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototype() bool { - return true -} - -func (*InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) isaInstanceGroupManagerScheduledActionManagerPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID unmarshals an instance of InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID from the specified map of raw messages. -func UnmarshalInstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerScheduledActionManagerPrototypeAutoScalePrototypeByID) - err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "max_membership_count-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) - if err != nil { - err = core.SDKErrorf(err, "", "min_membership_count-error", common.GetComponentInfo()) - return - } - 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 -} - -// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - 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 -} - -// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - 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 -} - -// InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity -type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { - return true -} - -// UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - 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 -} - -// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity -type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) - 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 -} - -// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity -type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) - 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 -} - -// InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostGroupIdentity -type InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatchDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) - 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 -} - -// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity -type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN struct { - // The CRN for this dedicated host. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByCRN) - 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 -} - -// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity -type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref struct { - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByHref) - 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 -} - -// InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct -// This model "extends" InstancePlacementTargetPatchDedicatedHostIdentity -type InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID struct { - // The unique identifier for this dedicated host. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID, err error) { - _model = &InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatchDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPatch() bool { - return true -} - -// UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPatchDedicatedHostIdentityDedicatedHostIdentityByID) - 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 -} - -// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN struct { - // The CRN for this dedicated host group. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByCRN) - 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 -} - -// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref struct { - // The URL for this dedicated host group. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByHref) - 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 -} - -// InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostGroupIdentity -type InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID struct { - // The unique identifier for this dedicated host group. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostGroupIdentityDedicatedHostGroupIdentityByID) - 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 -} - -// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity -type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN struct { - // The CRN for this dedicated host. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByCRN) - 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 -} - -// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity -type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref struct { - // The URL for this dedicated host. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(href string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByHref) - 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 -} - -// InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct -// This model "extends" InstancePlacementTargetPrototypeDedicatedHostIdentity -type InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID struct { - // The unique identifier for this dedicated host. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID : Instantiate InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(id string) (_model *InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID, err error) { - _model = &InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototypeDedicatedHostIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID unmarshals an instance of InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypeDedicatedHostIdentityDedicatedHostIdentityByID) - 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 -} - -// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct -// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity -type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN struct { - // The CRN for this placement group. - CRN *string `json:"crn" validate:"required"` -} - -// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(crn string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN, err error) { - _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByCRN) - 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 -} - -// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct -// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity -type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref struct { - // The URL for this placement group. - Href *string `json:"href" validate:"required"` -} - -// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(href string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref, err error) { - _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByHref) - 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 -} - -// InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct -// This model "extends" InstancePlacementTargetPrototypePlacementGroupIdentity -type InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID struct { - // The unique identifier for this placement group. - ID *string `json:"id" validate:"required"` -} - -// NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID : Instantiate InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(id string) (_model *InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID, err error) { - _model = &InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototypePlacementGroupIdentity() bool { - return true -} - -func (*InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) isaInstancePlacementTargetPrototype() bool { - return true -} - -// UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID unmarshals an instance of InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID from the specified map of raw messages. -func UnmarshalInstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePlacementTargetPrototypePlacementGroupIdentityPlacementGroupIdentityByID) - 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 -} - -// InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct -// This model "extends" InstancePrototypeInstanceByCatalogOffering -type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -// NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment, err error) { - _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment{ - CatalogOffering: catalogOffering, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstancePrototypeInstanceByCatalogOffering() bool { - return true -} - -func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct -// This model "extends" InstancePrototypeInstanceByCatalogOffering -type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface, err error) { - _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface{ - CatalogOffering: catalogOffering, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstancePrototypeInstanceByCatalogOffering() bool { - return true -} - -func (*InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment : InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment struct -// This model "extends" InstancePrototypeInstanceByImage -type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -// NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment, err error) { - _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment{ - Image: image, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstancePrototypeInstanceByImage() bool { - return true -} - -func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface : InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface struct -// This model "extends" InstancePrototypeInstanceByImage -type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface, err error) { - _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface{ - Image: image, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstancePrototypeInstanceByImage() bool { - return true -} - -func (*InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct -// This model "extends" InstancePrototypeInstanceBySourceSnapshot -type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -// NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment, err error) { - _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstancePrototypeInstanceBySourceSnapshot() bool { - return true -} - -func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct -// This model "extends" InstancePrototypeInstanceBySourceSnapshot -type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface, err error) { - _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstancePrototypeInstanceBySourceSnapshot() bool { - return true -} - -func (*InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment : InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment struct -// This model "extends" InstancePrototypeInstanceByVolume -type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -// NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment, err error) { - _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) isaInstancePrototypeInstanceByVolume() bool { - return true -} - -func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment unmarshals an instance of InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface : InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface struct -// This model "extends" InstancePrototypeInstanceByVolume -type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this virtual server instance. The name must not be used by another virtual server instance 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 placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface, err error) { - _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) isaInstancePrototypeInstanceByVolume() bool { - return true -} - -func (*InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) isaInstancePrototype() bool { - return true -} - -// UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface unmarshals an instance of InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering -type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment{ - CatalogOffering: catalogOffering, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { - return true -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByCatalogOffering -type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface{ - CatalogOffering: catalogOffering, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { - return true -} - -func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage -type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment{ - Image: image, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { - return true -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateByImage -type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface{ - Image: image, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { - return true -} - -func (*InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkAttachment: primaryNetworkAttachment, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { - return true -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct -// This model "extends" InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot -type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name must not be used by another instance template in the region. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -// NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) -func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface, err error) { - _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface{ - BootVolumeAttachment: bootVolumeAttachment, - Zone: zone, - PrimaryNetworkInterface: primaryNetworkInterface, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { - return true -} - -func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) isaInstanceTemplatePrototype() bool { - return true -} - -// UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface unmarshals an instance of InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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.UnmarshalPrimitive(m, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext -type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { - return true -} - -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct -// This model "extends" InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext -type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { - return true -} - -func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalInstanceCatalogOfferingPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplateInstanceByImageInstanceTemplateContext -type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { - return true -} - -func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct -// This model "extends" InstanceTemplateInstanceByImageInstanceTemplateContext -type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` - - // The image to use when provisioning the virtual server instance. - Image ImageIdentityIntf `json:"image" validate:"required"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { - return true -} - -func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "image-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment : InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct -// This model "extends" InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext -type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` -} - -func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { - return true -} - -func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface : InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct -// This model "extends" InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext -type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface struct { - // The availability policy to use for this virtual server instance. - AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,omitempty"` - - // The date and time that the instance template was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this instance template. - CRN *string `json:"crn" validate:"required"` - - // The default trusted profile configuration to use for this virtual server instance - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` - - // The URL for this instance template. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this instance template. - ID *string `json:"id" validate:"required"` - - // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the - // virtual server instance 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, the keys of type `rsa` must be specified, and one will be selected to encrypt [the administrator - // password](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization). 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. - // - // This property's value is used when provisioning the virtual server instance, but not subsequently managed. - // Accordingly, it is reflected as an [instance - // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. - Keys []KeyIdentityIntf `json:"keys,omitempty"` - - MetadataService *InstanceMetadataServicePrototype `json:"metadata_service,omitempty"` - - // The name for this instance template. The name is unique across all instance templates in the region. - Name *string `json:"name" validate:"required"` - - // The placement restrictions to use for the virtual server instance. - // - // If specified, `reservation_affinity.policy` must be `disabled`. - PlacementTarget InstancePlacementTargetPrototypeIntf `json:"placement_target,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this virtual server instance. - // - // If unspecified, `bx2-2x8` will be used, but this default value is expected to change in the future. - Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` - - ReservationAffinity *InstanceReservationAffinityPrototype `json:"reservation_affinity,omitempty"` - - // The resource group for this instance template. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The amount of bandwidth (in megabits per second) allocated exclusively to instance storage volumes. An increase in - // this value will result in a corresponding decrease to - // `total_network_bandwidth`. - TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` - - // [User data](https://cloud.ibm.com/docs/vpc?topic=vpc-user-data) to make available when setting up the virtual server - // instance. - UserData *string `json:"user_data,omitempty"` - - // The additional volume attachments to create for the virtual server instance. - VolumeAttachments []VolumeAttachmentPrototype `json:"volume_attachments,omitempty"` - - // The VPC this virtual server instance will reside in. - // - // If specified, it must match the VPC for the subnets of the instance network attachments or instance network - // interfaces. - VPC VPCIdentityIntf `json:"vpc,omitempty"` - - // The boot volume attachment to create for the virtual server instance. - BootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext `json:"boot_volume_attachment" validate:"required"` - - // The additional network attachments to create for the virtual server instance. - NetworkAttachments []InstanceNetworkAttachmentPrototype `json:"network_attachments,omitempty"` - - // The primary network attachment to create for the virtual server instance. - PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment,omitempty"` - - // The zone this virtual server instance will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - - // The additional instance network interfaces to create. - NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` - - // The primary instance network interface to create. - PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` -} - -func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { - return true -} - -func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplate() bool { - return true -} - -// UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface unmarshals an instance of InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface from the specified map of raw messages. -func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) - err = core.UnmarshalModel(m, "availability_policy", &obj.AvailabilityPolicy, UnmarshalInstanceAvailabilityPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "availability_policy-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "default_trusted_profile-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, "keys", &obj.Keys, UnmarshalKeyIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "metadata_service-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, "placement_target", &obj.PlacementTarget, UnmarshalInstancePlacementTargetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "placement_target-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalInstanceReservationAffinityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "reservation_affinity-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, "total_volume_bandwidth", &obj.TotalVolumeBandwidth) - if err != nil { - err = core.SDKErrorf(err, "", "total_volume_bandwidth-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 - } - err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "volume_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceBySourceSnapshotContext) - if err != nil { - err = core.SDKErrorf(err, "", "boot_volume_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalInstanceNetworkAttachmentPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct -// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { - // The pool's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { - return true -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) - 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 -} - -// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct -// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { - return true -} - -func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatch() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - 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 -} - -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct -// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { - // The pool's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { - return true -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) - 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 -} - -// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct -// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity -type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { - // The unique identifier for this load balancer pool. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (_model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { - _model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { - return true -} - -func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) - 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 -} - -// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct -// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity -type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { - // The CRN for this virtual server instance. - CRN *string `json:"crn" validate:"required"` -} - -// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN, err error) { - _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { - return true -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) - 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 -} - -// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref struct -// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity -type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref struct { - // The URL for this virtual server instance. - Href *string `json:"href" validate:"required"` -} - -// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(href string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref, err error) { - _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { - return true -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) - 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 -} - -// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID struct -// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity -type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID struct { - // The unique identifier for this virtual server instance. - ID *string `json:"id" validate:"required"` -} - -// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(id string) (_model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID, err error) { - _model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { - return true -} - -func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) isaLoadBalancerPoolMemberTargetPrototype() bool { - return true -} - -// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) - 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 -} - -// NetworkInterfaceIPPrototypeReservedIPIdentityByHref : NetworkInterfaceIPPrototypeReservedIPIdentityByHref struct -// This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity -type NetworkInterfaceIPPrototypeReservedIPIdentityByHref struct { - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` -} - -// NewNetworkInterfaceIPPrototypeReservedIPIdentityByHref : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityByHref(href string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityByHref, err error) { - _model = &NetworkInterfaceIPPrototypeReservedIPIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkInterfaceIPPrototypeReservedIPIdentityByHref) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { - return true -} - -func (*NetworkInterfaceIPPrototypeReservedIPIdentityByHref) isaNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByHref unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityByHref from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityByHref) - 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 -} - -// NetworkInterfaceIPPrototypeReservedIPIdentityByID : NetworkInterfaceIPPrototypeReservedIPIdentityByID struct -// This model "extends" NetworkInterfaceIPPrototypeReservedIPIdentity -type NetworkInterfaceIPPrototypeReservedIPIdentityByID struct { - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` -} - -// NewNetworkInterfaceIPPrototypeReservedIPIdentityByID : Instantiate NetworkInterfaceIPPrototypeReservedIPIdentityByID (Generic Model Constructor) -func (*VpcV1) NewNetworkInterfaceIPPrototypeReservedIPIdentityByID(id string) (_model *NetworkInterfaceIPPrototypeReservedIPIdentityByID, err error) { - _model = &NetworkInterfaceIPPrototypeReservedIPIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*NetworkInterfaceIPPrototypeReservedIPIdentityByID) isaNetworkInterfaceIPPrototypeReservedIPIdentity() bool { - return true -} - -func (*NetworkInterfaceIPPrototypeReservedIPIdentityByID) isaNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByID unmarshals an instance of NetworkInterfaceIPPrototypeReservedIPIdentityByID from the specified map of raw messages. -func UnmarshalNetworkInterfaceIPPrototypeReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceIPPrototypeReservedIPIdentityByID) - 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 -} - -// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress struct -// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity -type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress struct { - // The globally unique IP address. - Address *string `json:"address" validate:"required"` -} - -// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress(address string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress, err error) { - _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { - return true -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) isaPublicGatewayFloatingIPPrototype() bool { - return true -} - -// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN struct -// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity -type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN struct { - // The CRN for this floating IP. - CRN *string `json:"crn" validate:"required"` -} - -// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN(crn string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN, err error) { - _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { - return true -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) isaPublicGatewayFloatingIPPrototype() bool { - return true -} - -// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) - 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 -} - -// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref struct -// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity -type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref struct { - // The URL for this floating IP. - Href *string `json:"href" validate:"required"` -} - -// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(href string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref, err error) { - _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { - return true -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) isaPublicGatewayFloatingIPPrototype() bool { - return true -} - -// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) - 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 -} - -// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID struct -// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity -type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID struct { - // The unique identifier for this floating IP. - ID *string `json:"id" validate:"required"` -} - -// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID (Generic Model Constructor) -func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(id string) (_model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID, err error) { - _model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { - return true -} - -func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) isaPublicGatewayFloatingIPPrototype() bool { - return true -} - -// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID from the specified map of raw messages. -func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) - 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 -} - -// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN struct -// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity -type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN struct { - // The CRN for this endpoint gateway. - CRN *string `json:"crn" validate:"required"` -} - -// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN(crn string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN, err error) { - _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { - return true -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) - 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 -} - -// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref struct -// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity -type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref struct { - // The URL for this endpoint gateway. - Href *string `json:"href" validate:"required"` -} - -// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref(href string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref, err error) { - _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { - return true -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) - 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 -} - -// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID struct -// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity -type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID struct { - // The unique identifier for this endpoint gateway. - ID *string `json:"id" validate:"required"` -} - -// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID (Generic Model Constructor) -func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID(id string) (_model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID, err error) { - _model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { - return true -} - -func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) - 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 -} - -// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity -type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - 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 -} - -// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity -type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - 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 -} - -// ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity -type ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaReservedIPTargetPrototype() bool { - return true -} - -// UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetPrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - 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 -} - -// RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP : RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct -// This model "extends" RouteNextHopPatchRouteNextHopIP -type RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP struct { - // The sentinel IP address (`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"` -} - -// NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP : Instantiate RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP (Generic Model Constructor) -func (*VpcV1) NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(address string) (_model *RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP, err error) { - _model = &RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPatchRouteNextHopIP() bool { - return true -} - -func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPatch() bool { - return true -} - -// UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP unmarshals an instance of RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP from the specified map of raw messages. -func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatchRouteNextHopIPRouteNextHopIPSentinelIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP : RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP struct -// This model "extends" RouteNextHopPatchRouteNextHopIP -type RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP struct { - // A unicast IP address, which must not be any of the following values: - // - // - `0.0.0.0` (the sentinel IP address) - // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) - // - `255.255.255.255` (the broadcast IP address) - // - // 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"` -} - -// NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP : Instantiate RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP (Generic Model Constructor) -func (*VpcV1) NewRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(address string) (_model *RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP, err error) { - _model = &RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPatchRouteNextHopIP() bool { - return true -} - -func (*RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPatch() bool { - return true -} - -// UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP unmarshals an instance of RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP from the specified map of raw messages. -func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct -// This model "extends" RouteNextHopPatchVPNGatewayConnectionIdentity -type RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (_model *RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { - _model = &RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { - return true -} - -func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPatch() bool { - return true -} - -// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. -func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) - 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 -} - -// RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct -// This model "extends" RouteNextHopPatchVPNGatewayConnectionIdentity -type RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` -} - -// NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) -func (*VpcV1) NewRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (_model *RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { - _model = &RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPatchVPNGatewayConnectionIdentity() bool { - return true -} - -func (*RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPatch() bool { - return true -} - -// UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. -func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) - 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 -} - -// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct -// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP -type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct { - // The sentinel IP address (`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"` -} - -// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP (Generic Model Constructor) -func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP, err error) { - _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { - return true -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRoutePrototypeNextHop() bool { - return true -} - -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP struct -// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP -type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP struct { - // A unicast IP address, which must not be any of the following values: - // - // - `0.0.0.0` (the sentinel IP address) - // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) - // - `255.255.255.255` (the broadcast IP address) - // - // 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"` -} - -// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP (Generic Model Constructor) -func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP, err error) { - _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { - return true -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRoutePrototypeNextHop() bool { - return true -} - -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct -// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity -type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { - _model = &RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { - return true -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRoutePrototypeNextHop() bool { - return true -} - -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) - 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 -} - -// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct -// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity -type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` -} - -// NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) -func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { - _model = &RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { - return true -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRoutePrototypeNextHop() bool { - return true -} - -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) - 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 -} - -// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct -// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity -type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct { - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` -} - -// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN, err error) { - _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { - return true -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) - 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 -} - -// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct -// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity -type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct { - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref(href string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref, err error) { - _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { - return true -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) - 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 -} - -// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID struct -// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity -type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID struct { - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` -} - -// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID(id string) (_model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID, err error) { - _model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { - return true -} - -func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePatch() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) - 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 -} - -// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct -// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity -type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct { - // The security group's CRN. - CRN *string `json:"crn" validate:"required"` -} - -// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN(crn string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN, err error) { - _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { - return true -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) - 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 -} - -// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref struct -// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity -type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref struct { - // The security group's canonical URL. - Href *string `json:"href" validate:"required"` -} - -// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref(href string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref, err error) { - _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { - return true -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) - 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 -} - -// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID struct -// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity -type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID struct { - // The unique identifier for this security group. - ID *string `json:"id" validate:"required"` -} - -// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID(id string) (_model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID, err error) { - _model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { - return true -} - -func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePrototype() bool { - return true -} - -// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID from the specified map of raw messages. -func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) - 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 -} - -// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct -// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity -type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN struct { - // The CRN for this virtual network interface. - CRN *string `json:"crn" validate:"required"` -} - -// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(crn string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN, err error) { - _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN from the specified map of raw messages. -func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByCRN) - 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 -} - -// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct -// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity -type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref struct { - // The URL for this virtual network interface. - Href *string `json:"href" validate:"required"` -} - -// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(href string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref, err error) { - _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref from the specified map of raw messages. -func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByHref) - 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 -} - -// ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct -// This model "extends" ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity -type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID struct { - // The unique identifier for this virtual network interface. - ID *string `json:"id" validate:"required"` -} - -// NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID : Instantiate ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID (Generic Model Constructor) -func (*VpcV1) NewShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(id string) (_model *ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID, err error) { - _model = &ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentity() bool { - return true -} - -func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { - return true -} - -// UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID unmarshals an instance of ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID from the specified map of raw messages. -func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceIdentityVirtualNetworkInterfaceIdentityByID) - 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 -} - -// VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch struct -// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch -type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch struct { - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address,omitempty"` -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch() bool { - return true -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct -// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch -type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct { - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn,omitempty"` -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch() bool { - return true -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch) - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch struct -// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch -type VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch struct { - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address,omitempty"` -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch() bool { - return true -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct -// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch -type VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct { - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn,omitempty"` -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch() bool { - return true -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct -// This model "extends" VPNGatewayConnectionRouteMode -type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up" validate:"required"` - - // The authentication mode. Only `psk` is currently supported. - AuthenticationMode *string `json:"authentication_mode" validate:"required"` - - // The date and time that this VPN gateway connection was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` - - // The establish mode of the VPN gateway connection: - // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol - // negotiations or rekeying processes. - // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway - // connection. Additionally, the peer is responsible for initiating the rekeying process - // after the connection is established. If rekeying does not occur, the VPN gateway - // connection will be brought down after its lifetime expires. - EstablishMode *string `json:"establish_mode" validate:"required"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The IKE policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` - - // The IPsec policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` - - // The mode of the VPN gateway. - Mode *string `json:"mode" validate:"required"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name" validate:"required"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of a VPN gateway connection. - Status *string `json:"status" validate:"required"` - - // The reasons for the current VPN gateway connection status (if any). - StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` - - Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local" validate:"required"` - - Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer" validate:"required"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol" validate:"required"` - - // The VPN tunnel configuration for this VPN gateway connection (in static route mode). - Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.AuthenticationMode property. -// The authentication mode. Only `psk` is currently supported. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeAuthenticationModePskConst = "psk" -) - -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.EstablishMode property. -// The establish mode of the VPN gateway connection: -// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol -// negotiations or rekeying processes. -// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway -// connection. Additionally, the peer is responsible for initiating the rekeying process -// after the connection is established. If rekeying does not occur, the VPN gateway -// connection will be brought down after its lifetime expires. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeEstablishModeBidirectionalConst = "bidirectional" - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeEstablishModePeerOnlyConst = "peer_only" -) - -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.Mode property. -// The mode of the VPN gateway. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeModePolicyConst = "policy" - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeModeRouteConst = "route" -) - -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.ResourceType property. -// The resource type. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.Status property. -// The status of a VPN gateway connection. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeStatusDownConst = "down" - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeStatusUpConst = "up" -) - -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeRoutingProtocolNoneConst = "none" -) - -func (*VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnectionRouteMode() bool { - return true -} - -func (*VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnection() bool { - return true -} - -// UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode unmarshals an instance of VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) - if err != nil { - err = core.SDKErrorf(err, "", "authentication_mode-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, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) - if err != nil { - err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) - if err != nil { - err = core.SDKErrorf(err, "", "establish_mode-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, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) - if err != nil { - err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) - if err != nil { - err = core.SDKErrorf(err, "", "ipsec_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-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, "psk", &obj.Psk) - if err != nil { - err = core.SDKErrorf(err, "", "psk-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, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) - if err != nil { - err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocal) - if err != nil { - err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeer) - if err != nil { - err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) - if err != nil { - err = core.SDKErrorf(err, "", "tunnels-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct -// This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext -type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref struct { - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` -} - -// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref(href string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref, err error) { - _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { - return true -} - -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) isaVirtualNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByHref) - 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 -} - -// VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID : VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID struct -// This model "extends" VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext -type VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID struct { - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` -} - -// NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID : Instantiate VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID(id string) (_model *VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID, err error) { - _model = &VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) isaVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContext() bool { - return true -} - -func (*VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) isaVirtualNetworkInterfaceIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID unmarshals an instance of VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceIPPrototypeReservedIPIdentityVirtualNetworkInterfaceIPsContextByID) - 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 -} - -// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref struct -// This model "extends" VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext -type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref struct { - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` -} - -// NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref : Instantiate VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref(href string) (_model *VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref, err error) { - _model = &VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { - return true -} - -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByHref) - 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 -} - -// VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID : VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID struct -// This model "extends" VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext -type VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID struct { - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` -} - -// NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID : Instantiate VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID (Generic Model Constructor) -func (*VpcV1) NewVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID(id string) (_model *VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID, err error) { - _model = &VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) isaVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContext() bool { - return true -} - -func (*VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) isaVirtualNetworkInterfacePrimaryIPPrototype() bool { - return true -} - -// UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID unmarshals an instance of VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfacePrimaryIPPrototypeReservedIPIdentityVirtualNetworkInterfacePrimaryIPContextByID) - 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 -} - -// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN struct -// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity -type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN struct { - // The CRN for this volume. - CRN *string `json:"crn" validate:"required"` -} - -// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN(crn string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN, err error) { - _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN{ - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { - return true -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByCRN) - 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 -} - -// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref struct -// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity -type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref struct { - // The URL for this volume. - Href *string `json:"href" validate:"required"` -} - -// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref(href string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref, err error) { - _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref{ - Href: core.StringPtr(href), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { - return true -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByHref) - 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 -} - -// VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID : VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID struct -// This model "extends" VolumeAttachmentPrototypeVolumeVolumeIdentity -type VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID struct { - // The unique identifier for this volume. - ID *string `json:"id" validate:"required"` -} - -// NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID : Instantiate VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(id string) (_model *VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID, err error) { - _model = &VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentPrototypeVolumeVolumeIdentity() bool { - return true -} - -func (*VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -// UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID) - 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 -} - -// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct -// This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext -type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - // The resource group to use for this volume. If unspecified, the instance's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The capacity to use for the volume (in gigabytes). - // - // The minimum and maximum limits for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Capacity *int64 `json:"capacity" validate:"required"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` -} - -// NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : Instantiate VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(profile VolumeProfileIdentityIntf, capacity int64) (_model *VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity, err error) { - _model = &VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity{ - Profile: profile, - Capacity: core.Int64Ptr(capacity), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { - return true -} - -func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - err = core.SDKErrorf(err, "", "capacity-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 - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct -// This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext -type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. - Iops *int64 `json:"iops,omitempty"` - - // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will - // be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) to use for this volume. - Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` - - // The resource group to use for this volume. If unspecified, the instance's resource group will be used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. - UserTags []string `json:"user_tags,omitempty"` - - // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's - // `minimum_capacity`. The maximum value may increase in the future. - // - // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. - Capacity *int64 `json:"capacity,omitempty"` - - // The root key to use to wrap the data encryption key for the volume. - // - // If unspecified, the `encryption` type for the volume will be `provider_managed`. - EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - - // The snapshot from which to clone the volume. - SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` -} - -// NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : Instantiate VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot (Generic Model Constructor) -func (*VpcV1) NewVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(profile VolumeProfileIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot, err error) { - _model = &VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot{ - Profile: profile, - SourceSnapshot: sourceSnapshot, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) isaVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext() bool { - return true -} - -func (*VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) isaVolumeAttachmentPrototypeVolume() bool { - return true -} - -// UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot unmarshals an instance of VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot from the specified map of raw messages. -func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) - if err != nil { - err = core.SDKErrorf(err, "", "iops-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, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-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.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) - if err != nil { - err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) - if err != nil { - err = core.SDKErrorf(err, "", "capacity-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, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup struct -// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group" validate:"required"` -} - -// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup(group *InstanceGroupManagerScheduledActionGroupPrototype) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup, err error) { - _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup{ - Group: group, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByGroup) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager struct -// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min - // period. - CronSpec *string `json:"cron_spec,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager" validate:"required"` -} - -// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager(manager InstanceGroupManagerScheduledActionManagerPrototypeIntf) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager, err error) { - _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager{ - Manager: manager, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpec() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByCronSpecByManager) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup struct -// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The date and time the scheduled action will run. - RunAt *strfmt.DateTime `json:"run_at,omitempty"` - - Group *InstanceGroupManagerScheduledActionGroupPrototype `json:"group" validate:"required"` -} - -// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup(group *InstanceGroupManagerScheduledActionGroupPrototype) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup, err error) { - _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup{ - Group: group, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByGroup) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) - if err != nil { - err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalInstanceGroupManagerScheduledActionGroupPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "group-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager : InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager struct -// This model "extends" InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt -type InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager struct { - // The name for this instance group manager action. The name must not be used by another action for the instance group - // manager. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The date and time the scheduled action will run. - RunAt *strfmt.DateTime `json:"run_at,omitempty"` - - Manager InstanceGroupManagerScheduledActionManagerPrototypeIntf `json:"manager" validate:"required"` -} - -// NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager : Instantiate InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager (Generic Model Constructor) -func (*VpcV1) NewInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager(manager InstanceGroupManagerScheduledActionManagerPrototypeIntf) (_model *InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager, err error) { - _model = &InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager{ - Manager: manager, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototypeScheduledActionPrototype() bool { - return true -} - -func (*InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) isaInstanceGroupManagerActionPrototype() bool { - return true -} - -// UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager unmarshals an instance of InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAtByManager) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "run_at", &obj.RunAt) - if err != nil { - err = core.SDKErrorf(err, "", "run_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "manager", &obj.Manager, UnmarshalInstanceGroupManagerScheduledActionManagerPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "manager-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCAddressPrefixesPager can be used to simplify the use of the "ListVPCAddressPrefixes" method. -type VPCAddressPrefixesPager struct { - hasNext bool - options *ListVPCAddressPrefixesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPCAddressPrefixesPager returns a new VPCAddressPrefixesPager instance. -func (vpc *VpcV1) NewVPCAddressPrefixesPager(options *ListVPCAddressPrefixesOptions) (pager *VPCAddressPrefixesPager, 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 ListVPCAddressPrefixesOptions = *options - pager = &VPCAddressPrefixesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCAddressPrefixesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (page []AddressPrefix, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPCAddressPrefixesWithContext(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.AddressPrefixes - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (allItems []AddressPrefix, err error) { - for pager.HasNext() { - var nextPage []AddressPrefix - 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 *VPCAddressPrefixesPager) GetNext() (page []AddressPrefix, 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 *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// VPCDnsResolutionBindingsPager can be used to simplify the use of the "ListVPCDnsResolutionBindings" method. -type VPCDnsResolutionBindingsPager struct { - hasNext bool - options *ListVPCDnsResolutionBindingsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPCDnsResolutionBindingsPager returns a new VPCDnsResolutionBindingsPager instance. -func (vpc *VpcV1) NewVPCDnsResolutionBindingsPager(options *ListVPCDnsResolutionBindingsOptions) (pager *VPCDnsResolutionBindingsPager, 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 ListVPCDnsResolutionBindingsOptions = *options - pager = &VPCDnsResolutionBindingsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCDnsResolutionBindingsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Context) (page []VpcdnsResolutionBinding, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPCDnsResolutionBindingsWithContext(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.DnsResolutionBindings - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Context) (allItems []VpcdnsResolutionBinding, err error) { - for pager.HasNext() { - var nextPage []VpcdnsResolutionBinding - 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 *VPCDnsResolutionBindingsPager) GetNext() (page []VpcdnsResolutionBinding, 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 *VPCDnsResolutionBindingsPager) GetAll() (allItems []VpcdnsResolutionBinding, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. -type VPCRoutesPager struct { - hasNext bool - options *ListVPCRoutesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPCRoutesPager returns a new VPCRoutesPager instance. -func (vpc *VpcV1) NewVPCRoutesPager(options *ListVPCRoutesOptions) (pager *VPCRoutesPager, 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 ListVPCRoutesOptions = *options - pager = &VPCRoutesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCRoutesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []RouteCollectionVPCContextRoutesItem, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPCRoutesWithContext(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.Routes - - return -} - -// 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) { - for pager.HasNext() { - var nextPage []RouteCollectionVPCContextRoutesItem - 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 *VPCRoutesPager) GetNext() (page []RouteCollectionVPCContextRoutesItem, 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) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. -type VPCRoutingTableRoutesPager struct { - hasNext bool - options *ListVPCRoutingTableRoutesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPCRoutingTableRoutesPager returns a new VPCRoutingTableRoutesPager instance. -func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRoutesOptions) (pager *VPCRoutingTableRoutesPager, 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 ListVPCRoutingTableRoutesOptions = *options - pager = &VPCRoutingTableRoutesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCRoutingTableRoutesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) (page []Route, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPCRoutingTableRoutesWithContext(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.Routes - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) (allItems []Route, err error) { - for pager.HasNext() { - var nextPage []Route - 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 *VPCRoutingTableRoutesPager) 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 *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// VPCRoutingTablesPager can be used to simplify the use of the "ListVPCRoutingTables" method. -type VPCRoutingTablesPager struct { - hasNext bool - options *ListVPCRoutingTablesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPCRoutingTablesPager returns a new VPCRoutingTablesPager instance. -func (vpc *VpcV1) NewVPCRoutingTablesPager(options *ListVPCRoutingTablesOptions) (pager *VPCRoutingTablesPager, 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 ListVPCRoutingTablesOptions = *options - pager = &VPCRoutingTablesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCRoutingTablesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCRoutingTablesPager) GetNextWithContext(ctx context.Context) (page []RoutingTable, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPCRoutingTablesWithContext(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.RoutingTables - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPCRoutingTablesPager) GetAllWithContext(ctx context.Context) (allItems []RoutingTable, err error) { - for pager.HasNext() { - var nextPage []RoutingTable - 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 *VPCRoutingTablesPager) GetNext() (page []RoutingTable, 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 *VPCRoutingTablesPager) GetAll() (allItems []RoutingTable, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// VpcsPager can be used to simplify the use of the "ListVpcs" method. -type VpcsPager struct { - hasNext bool - options *ListVpcsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVpcsPager returns a new VpcsPager instance. -func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, 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 ListVpcsOptions = *options - pager = &VpcsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VpcsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVpcsWithContext(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.Vpcs - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, err error) { - for pager.HasNext() { - var nextPage []VPC - 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 *VpcsPager) GetNext() (page []VPC, 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 *VpcsPager) GetAll() (allItems []VPC, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. -type SubnetReservedIpsPager struct { - hasNext bool - options *ListSubnetReservedIpsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSubnetReservedIpsPager returns a new SubnetReservedIpsPager instance. -func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOptions) (pager *SubnetReservedIpsPager, 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 ListSubnetReservedIpsOptions = *options - pager = &SubnetReservedIpsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SubnetReservedIpsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSubnetReservedIpsWithContext(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 *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { - for pager.HasNext() { - var nextPage []ReservedIP - 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 *SubnetReservedIpsPager) GetNext() (page []ReservedIP, 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 *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// SubnetsPager can be used to simplify the use of the "ListSubnets" method. -type SubnetsPager struct { - hasNext bool - options *ListSubnetsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSubnetsPager returns a new SubnetsPager instance. -func (vpc *VpcV1) NewSubnetsPager(options *ListSubnetsOptions) (pager *SubnetsPager, 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 ListSubnetsOptions = *options - pager = &SubnetsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SubnetsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subnet, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSubnetsWithContext(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 *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Subnet, err error) { - for pager.HasNext() { - var nextPage []Subnet - 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 *SubnetsPager) GetNext() (page []Subnet, 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 *SubnetsPager) GetAll() (allItems []Subnet, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ImagesPager can be used to simplify the use of the "ListImages" method. -type ImagesPager struct { - hasNext bool - options *ListImagesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewImagesPager returns a new ImagesPager instance. -func (vpc *VpcV1) NewImagesPager(options *ListImagesOptions) (pager *ImagesPager, 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 ListImagesOptions = *options - pager = &ImagesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *ImagesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *ImagesPager) GetNextWithContext(ctx context.Context) (page []Image, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListImagesWithContext(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.Images - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *ImagesPager) GetAllWithContext(ctx context.Context) (allItems []Image, err error) { - for pager.HasNext() { - var nextPage []Image - 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 *ImagesPager) GetNext() (page []Image, 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 *ImagesPager) GetAll() (allItems []Image, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// OperatingSystemsPager can be used to simplify the use of the "ListOperatingSystems" method. -type OperatingSystemsPager struct { - hasNext bool - options *ListOperatingSystemsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewOperatingSystemsPager returns a new OperatingSystemsPager instance. -func (vpc *VpcV1) NewOperatingSystemsPager(options *ListOperatingSystemsOptions) (pager *OperatingSystemsPager, 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 ListOperatingSystemsOptions = *options - pager = &OperatingSystemsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *OperatingSystemsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *OperatingSystemsPager) GetNextWithContext(ctx context.Context) (page []OperatingSystem, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListOperatingSystemsWithContext(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.OperatingSystems - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *OperatingSystemsPager) GetAllWithContext(ctx context.Context) (allItems []OperatingSystem, err error) { - for pager.HasNext() { - var nextPage []OperatingSystem - 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 *OperatingSystemsPager) GetNext() (page []OperatingSystem, 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 *OperatingSystemsPager) GetAll() (allItems []OperatingSystem, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// KeysPager can be used to simplify the use of the "ListKeys" method. -type KeysPager struct { - hasNext bool - options *ListKeysOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewKeysPager returns a new KeysPager instance. -func (vpc *VpcV1) NewKeysPager(options *ListKeysOptions) (pager *KeysPager, 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 ListKeysOptions = *options - pager = &KeysPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *KeysPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *KeysPager) GetNextWithContext(ctx context.Context) (page []Key, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListKeysWithContext(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.Keys - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *KeysPager) GetAllWithContext(ctx context.Context) (allItems []Key, err error) { - for pager.HasNext() { - var nextPage []Key - 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 *KeysPager) GetNext() (page []Key, 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 *KeysPager) GetAll() (allItems []Key, 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 - options *ListInstanceNetworkInterfaceIpsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstanceNetworkInterfaceIpsPager returns a new InstanceNetworkInterfaceIpsPager instance. -func (vpc *VpcV1) NewInstanceNetworkInterfaceIpsPager(options *ListInstanceNetworkInterfaceIpsOptions) (pager *InstanceNetworkInterfaceIpsPager, 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 ListInstanceNetworkInterfaceIpsOptions = *options - pager = &InstanceNetworkInterfaceIpsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceNetworkInterfaceIpsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstanceNetworkInterfaceIpsWithContext(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.Ips - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { - for pager.HasNext() { - var nextPage []ReservedIP - 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 *InstanceNetworkInterfaceIpsPager) GetNext() (page []ReservedIP, 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 *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// InstancesPager can be used to simplify the use of the "ListInstances" method. -type InstancesPager struct { - hasNext bool - options *ListInstancesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstancesPager returns a new InstancesPager instance. -func (vpc *VpcV1) NewInstancesPager(options *ListInstancesOptions) (pager *InstancesPager, 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 ListInstancesOptions = *options - pager = &InstancesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstancesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstancesPager) GetNextWithContext(ctx context.Context) (page []Instance, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstancesWithContext(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.Instances - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstancesPager) GetAllWithContext(ctx context.Context) (allItems []Instance, err error) { - for pager.HasNext() { - var nextPage []Instance - 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 *InstancesPager) GetNext() (page []Instance, 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 *InstancesPager) GetAll() (allItems []Instance, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// InstanceGroupManagerActionsPager can be used to simplify the use of the "ListInstanceGroupManagerActions" method. -type InstanceGroupManagerActionsPager struct { - hasNext bool - options *ListInstanceGroupManagerActionsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstanceGroupManagerActionsPager returns a new InstanceGroupManagerActionsPager instance. -func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroupManagerActionsOptions) (pager *InstanceGroupManagerActionsPager, 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 ListInstanceGroupManagerActionsOptions = *options - pager = &InstanceGroupManagerActionsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupManagerActionsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerActionIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstanceGroupManagerActionsWithContext(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.Actions - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerActionIntf, err error) { - for pager.HasNext() { - var nextPage []InstanceGroupManagerActionIntf - 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 *InstanceGroupManagerActionsPager) GetNext() (page []InstanceGroupManagerActionIntf, 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 *InstanceGroupManagerActionsPager) GetAll() (allItems []InstanceGroupManagerActionIntf, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// InstanceGroupManagerPoliciesPager can be used to simplify the use of the "ListInstanceGroupManagerPolicies" method. -type InstanceGroupManagerPoliciesPager struct { - hasNext bool - options *ListInstanceGroupManagerPoliciesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstanceGroupManagerPoliciesPager returns a new InstanceGroupManagerPoliciesPager instance. -func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGroupManagerPoliciesOptions) (pager *InstanceGroupManagerPoliciesPager, 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 ListInstanceGroupManagerPoliciesOptions = *options - pager = &InstanceGroupManagerPoliciesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupManagerPoliciesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerPolicyIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstanceGroupManagerPoliciesWithContext(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.Policies - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerPolicyIntf, err error) { - for pager.HasNext() { - var nextPage []InstanceGroupManagerPolicyIntf - 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 *InstanceGroupManagerPoliciesPager) GetNext() (page []InstanceGroupManagerPolicyIntf, 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 *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGroupManagerPolicyIntf, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// InstanceGroupManagersPager can be used to simplify the use of the "ListInstanceGroupManagers" method. -type InstanceGroupManagersPager struct { - hasNext bool - options *ListInstanceGroupManagersOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstanceGroupManagersPager returns a new InstanceGroupManagersPager instance. -func (vpc *VpcV1) NewInstanceGroupManagersPager(options *ListInstanceGroupManagersOptions) (pager *InstanceGroupManagersPager, 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 ListInstanceGroupManagersOptions = *options - pager = &InstanceGroupManagersPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupManagersPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupManagersPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstanceGroupManagersWithContext(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.Managers - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstanceGroupManagersPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerIntf, err error) { - for pager.HasNext() { - var nextPage []InstanceGroupManagerIntf - 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 *InstanceGroupManagersPager) GetNext() (page []InstanceGroupManagerIntf, 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 *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManagerIntf, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// InstanceGroupMembershipsPager can be used to simplify the use of the "ListInstanceGroupMemberships" method. -type InstanceGroupMembershipsPager struct { - hasNext bool - options *ListInstanceGroupMembershipsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstanceGroupMembershipsPager returns a new InstanceGroupMembershipsPager instance. -func (vpc *VpcV1) NewInstanceGroupMembershipsPager(options *ListInstanceGroupMembershipsOptions) (pager *InstanceGroupMembershipsPager, 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 ListInstanceGroupMembershipsOptions = *options - pager = &InstanceGroupMembershipsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupMembershipsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupMembership, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstanceGroupMembershipsWithContext(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.Memberships - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupMembership, err error) { - for pager.HasNext() { - var nextPage []InstanceGroupMembership - 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 *InstanceGroupMembershipsPager) GetNext() (page []InstanceGroupMembership, 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 *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMembership, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. -type InstanceGroupsPager struct { - hasNext bool - options *ListInstanceGroupsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstanceGroupsPager returns a new InstanceGroupsPager instance. -func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pager *InstanceGroupsPager, 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 ListInstanceGroupsOptions = *options - pager = &InstanceGroupsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroup, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstanceGroupsWithContext(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.InstanceGroups - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroup, err error) { - for pager.HasNext() { - var nextPage []InstanceGroup - 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 *InstanceGroupsPager) GetNext() (page []InstanceGroup, 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 *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ReservationsPager can be used to simplify the use of the "ListReservations" method. -type ReservationsPager struct { - hasNext bool - options *ListReservationsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewReservationsPager returns a new ReservationsPager instance. -func (vpc *VpcV1) NewReservationsPager(options *ListReservationsOptions) (pager *ReservationsPager, 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 ListReservationsOptions = *options - pager = &ReservationsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *ReservationsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *ReservationsPager) GetNextWithContext(ctx context.Context) (page []Reservation, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListReservationsWithContext(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.Reservations - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *ReservationsPager) GetAllWithContext(ctx context.Context) (allItems []Reservation, err error) { - for pager.HasNext() { - var nextPage []Reservation - 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 *ReservationsPager) GetNext() (page []Reservation, 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 *ReservationsPager) GetAll() (allItems []Reservation, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DedicatedHostGroupsPager can be used to simplify the use of the "ListDedicatedHostGroups" method. -type DedicatedHostGroupsPager struct { - hasNext bool - options *ListDedicatedHostGroupsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewDedicatedHostGroupsPager returns a new DedicatedHostGroupsPager instance. -func (vpc *VpcV1) NewDedicatedHostGroupsPager(options *ListDedicatedHostGroupsOptions) (pager *DedicatedHostGroupsPager, 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 ListDedicatedHostGroupsOptions = *options - pager = &DedicatedHostGroupsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *DedicatedHostGroupsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *DedicatedHostGroupsPager) GetNextWithContext(ctx context.Context) (page []DedicatedHostGroup, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListDedicatedHostGroupsWithContext(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.Groups - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *DedicatedHostGroupsPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHostGroup, err error) { - for pager.HasNext() { - var nextPage []DedicatedHostGroup - 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 *DedicatedHostGroupsPager) GetNext() (page []DedicatedHostGroup, 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 *DedicatedHostGroupsPager) GetAll() (allItems []DedicatedHostGroup, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DedicatedHostProfilesPager can be used to simplify the use of the "ListDedicatedHostProfiles" method. -type DedicatedHostProfilesPager struct { - hasNext bool - options *ListDedicatedHostProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewDedicatedHostProfilesPager returns a new DedicatedHostProfilesPager instance. -func (vpc *VpcV1) NewDedicatedHostProfilesPager(options *ListDedicatedHostProfilesOptions) (pager *DedicatedHostProfilesPager, 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 ListDedicatedHostProfilesOptions = *options - pager = &DedicatedHostProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *DedicatedHostProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *DedicatedHostProfilesPager) GetNextWithContext(ctx context.Context) (page []DedicatedHostProfile, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListDedicatedHostProfilesWithContext(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 *DedicatedHostProfilesPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHostProfile, err error) { - for pager.HasNext() { - var nextPage []DedicatedHostProfile - 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 *DedicatedHostProfilesPager) GetNext() (page []DedicatedHostProfile, 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 *DedicatedHostProfilesPager) GetAll() (allItems []DedicatedHostProfile, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DedicatedHostsPager can be used to simplify the use of the "ListDedicatedHosts" method. -type DedicatedHostsPager struct { - hasNext bool - options *ListDedicatedHostsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewDedicatedHostsPager returns a new DedicatedHostsPager instance. -func (vpc *VpcV1) NewDedicatedHostsPager(options *ListDedicatedHostsOptions) (pager *DedicatedHostsPager, 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 ListDedicatedHostsOptions = *options - pager = &DedicatedHostsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *DedicatedHostsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *DedicatedHostsPager) GetNextWithContext(ctx context.Context) (page []DedicatedHost, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListDedicatedHostsWithContext(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.DedicatedHosts - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *DedicatedHostsPager) GetAllWithContext(ctx context.Context) (allItems []DedicatedHost, err error) { - for pager.HasNext() { - var nextPage []DedicatedHost - 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 *DedicatedHostsPager) GetNext() (page []DedicatedHost, 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 *DedicatedHostsPager) GetAll() (allItems []DedicatedHost, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// PlacementGroupsPager can be used to simplify the use of the "ListPlacementGroups" method. -type PlacementGroupsPager struct { - hasNext bool - options *ListPlacementGroupsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewPlacementGroupsPager returns a new PlacementGroupsPager instance. -func (vpc *VpcV1) NewPlacementGroupsPager(options *ListPlacementGroupsOptions) (pager *PlacementGroupsPager, 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 ListPlacementGroupsOptions = *options - pager = &PlacementGroupsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *PlacementGroupsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *PlacementGroupsPager) GetNextWithContext(ctx context.Context) (page []PlacementGroup, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListPlacementGroupsWithContext(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.PlacementGroups - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *PlacementGroupsPager) GetAllWithContext(ctx context.Context) (allItems []PlacementGroup, err error) { - for pager.HasNext() { - var nextPage []PlacementGroup - 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 *PlacementGroupsPager) GetNext() (page []PlacementGroup, 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 *PlacementGroupsPager) GetAll() (allItems []PlacementGroup, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. -type BareMetalServerNetworkAttachmentsPager struct { - hasNext bool - options *ListBareMetalServerNetworkAttachmentsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. -func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, 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 ListBareMetalServerNetworkAttachmentsOptions = *options - pager = &BareMetalServerNetworkAttachmentsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerNetworkAttachmentsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkAttachmentIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(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.NetworkAttachments - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { - for pager.HasNext() { - var nextPage []BareMetalServerNetworkAttachmentIntf - 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 *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, 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 *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. -type BareMetalServerNetworkInterfacesPager struct { - hasNext bool - options *ListBareMetalServerNetworkInterfacesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. -func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, 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 ListBareMetalServerNetworkInterfacesOptions = *options - pager = &BareMetalServerNetworkInterfacesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerNetworkInterfacesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkInterfaceIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(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.NetworkInterfaces - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkInterfaceIntf, err error) { - for pager.HasNext() { - var nextPage []BareMetalServerNetworkInterfaceIntf - 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 *BareMetalServerNetworkInterfacesPager) GetNext() (page []BareMetalServerNetworkInterfaceIntf, 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 *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. -type BareMetalServerProfilesPager struct { - hasNext bool - options *ListBareMetalServerProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. -func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, 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 ListBareMetalServerProfilesOptions = *options - pager = &BareMetalServerProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfile, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListBareMetalServerProfilesWithContext(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 *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfile, err error) { - for pager.HasNext() { - var nextPage []BareMetalServerProfile - 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 *BareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfile, 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 *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. -type BareMetalServersPager struct { - hasNext bool - options *ListBareMetalServersOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewBareMetalServersPager returns a new BareMetalServersPager instance. -func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, 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 ListBareMetalServersOptions = *options - pager = &BareMetalServersPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServersPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (page []BareMetalServer, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListBareMetalServersWithContext(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.BareMetalServers - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServer, err error) { - for pager.HasNext() { - var nextPage []BareMetalServer - 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 *BareMetalServersPager) GetNext() (page []BareMetalServer, 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 *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// VolumeProfilesPager can be used to simplify the use of the "ListVolumeProfiles" method. -type VolumeProfilesPager struct { - hasNext bool - options *ListVolumeProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVolumeProfilesPager returns a new VolumeProfilesPager instance. -func (vpc *VpcV1) NewVolumeProfilesPager(options *ListVolumeProfilesOptions) (pager *VolumeProfilesPager, 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 ListVolumeProfilesOptions = *options - pager = &VolumeProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VolumeProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VolumeProfilesPager) GetNextWithContext(ctx context.Context) (page []VolumeProfile, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVolumeProfilesWithContext(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 *VolumeProfilesPager) GetAllWithContext(ctx context.Context) (allItems []VolumeProfile, err error) { - for pager.HasNext() { - var nextPage []VolumeProfile - 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 *VolumeProfilesPager) GetNext() (page []VolumeProfile, 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 *VolumeProfilesPager) GetAll() (allItems []VolumeProfile, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// VolumesPager can be used to simplify the use of the "ListVolumes" method. -type VolumesPager struct { - hasNext bool - options *ListVolumesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVolumesPager returns a new VolumesPager instance. -func (vpc *VpcV1) NewVolumesPager(options *ListVolumesOptions) (pager *VolumesPager, 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 ListVolumesOptions = *options - pager = &VolumesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VolumesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VolumesPager) GetNextWithContext(ctx context.Context) (page []Volume, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVolumesWithContext(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.Volumes - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VolumesPager) GetAllWithContext(ctx context.Context) (allItems []Volume, err error) { - for pager.HasNext() { - var nextPage []Volume - 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 *VolumesPager) GetNext() (page []Volume, 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 *VolumesPager) GetAll() (allItems []Volume, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// SnapshotConsistencyGroupsPager can be used to simplify the use of the "ListSnapshotConsistencyGroups" method. -type SnapshotConsistencyGroupsPager struct { - hasNext bool - options *ListSnapshotConsistencyGroupsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSnapshotConsistencyGroupsPager returns a new SnapshotConsistencyGroupsPager instance. -func (vpc *VpcV1) NewSnapshotConsistencyGroupsPager(options *ListSnapshotConsistencyGroupsOptions) (pager *SnapshotConsistencyGroupsPager, 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 ListSnapshotConsistencyGroupsOptions = *options - pager = &SnapshotConsistencyGroupsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SnapshotConsistencyGroupsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SnapshotConsistencyGroupsPager) GetNextWithContext(ctx context.Context) (page []SnapshotConsistencyGroup, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSnapshotConsistencyGroupsWithContext(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.SnapshotConsistencyGroups - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *SnapshotConsistencyGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SnapshotConsistencyGroup, err error) { - for pager.HasNext() { - var nextPage []SnapshotConsistencyGroup - 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 *SnapshotConsistencyGroupsPager) GetNext() (page []SnapshotConsistencyGroup, 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 *SnapshotConsistencyGroupsPager) GetAll() (allItems []SnapshotConsistencyGroup, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// SnapshotsPager can be used to simplify the use of the "ListSnapshots" method. -type SnapshotsPager struct { - hasNext bool - options *ListSnapshotsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSnapshotsPager returns a new SnapshotsPager instance. -func (vpc *VpcV1) NewSnapshotsPager(options *ListSnapshotsOptions) (pager *SnapshotsPager, 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 ListSnapshotsOptions = *options - pager = &SnapshotsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SnapshotsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SnapshotsPager) GetNextWithContext(ctx context.Context) (page []Snapshot, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSnapshotsWithContext(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.Snapshots - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *SnapshotsPager) GetAllWithContext(ctx context.Context) (allItems []Snapshot, err error) { - for pager.HasNext() { - var nextPage []Snapshot - 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 *SnapshotsPager) GetNext() (page []Snapshot, 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 *SnapshotsPager) GetAll() (allItems []Snapshot, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ShareMountTargetsPager can be used to simplify the use of the "ListShareMountTargets" method. -type ShareMountTargetsPager struct { - hasNext bool - options *ListShareMountTargetsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewShareMountTargetsPager returns a new ShareMountTargetsPager instance. -func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOptions) (pager *ShareMountTargetsPager, 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 ListShareMountTargetsOptions = *options - pager = &ShareMountTargetsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *ShareMountTargetsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (page []ShareMountTarget, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListShareMountTargetsWithContext(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.MountTargets - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (allItems []ShareMountTarget, err error) { - for pager.HasNext() { - var nextPage []ShareMountTarget - 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 *ShareMountTargetsPager) GetNext() (page []ShareMountTarget, 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 *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ShareProfilesPager can be used to simplify the use of the "ListShareProfiles" method. -type ShareProfilesPager struct { - hasNext bool - options *ListShareProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewShareProfilesPager returns a new ShareProfilesPager instance. -func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (pager *ShareProfilesPager, 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 ListShareProfilesOptions = *options - pager = &ShareProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *ShareProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page []ShareProfile, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListShareProfilesWithContext(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 *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItems []ShareProfile, err error) { - for pager.HasNext() { - var nextPage []ShareProfile - 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 *ShareProfilesPager) GetNext() (page []ShareProfile, 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 *ShareProfilesPager) GetAll() (allItems []ShareProfile, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// SharesPager can be used to simplify the use of the "ListShares" method. -type SharesPager struct { - hasNext bool - options *ListSharesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSharesPager returns a new SharesPager instance. -func (vpc *VpcV1) NewSharesPager(options *ListSharesOptions) (pager *SharesPager, 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 ListSharesOptions = *options - pager = &SharesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SharesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSharesWithContext(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.Shares - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Share, err error) { - for pager.HasNext() { - var nextPage []Share - 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 *SharesPager) GetNext() (page []Share, 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 *SharesPager) GetAll() (allItems []Share, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. -type BackupPoliciesPager struct { - hasNext bool - options *ListBackupPoliciesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewBackupPoliciesPager returns a new BackupPoliciesPager instance. -func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pager *BackupPoliciesPager, 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 ListBackupPoliciesOptions = *options - pager = &BackupPoliciesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *BackupPoliciesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListBackupPoliciesWithContext(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.BackupPolicies - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyIntf, err error) { - for pager.HasNext() { - var nextPage []BackupPolicyIntf - 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 *BackupPoliciesPager) GetNext() (page []BackupPolicyIntf, 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 *BackupPoliciesPager) GetAll() (allItems []BackupPolicyIntf, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// BackupPolicyJobsPager can be used to simplify the use of the "ListBackupPolicyJobs" method. -type BackupPolicyJobsPager struct { - hasNext bool - options *ListBackupPolicyJobsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewBackupPolicyJobsPager returns a new BackupPolicyJobsPager instance. -func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) (pager *BackupPolicyJobsPager, 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 ListBackupPolicyJobsOptions = *options - pager = &BackupPolicyJobsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *BackupPolicyJobsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyJob, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListBackupPolicyJobsWithContext(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.Jobs - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyJob, err error) { - for pager.HasNext() { - var nextPage []BackupPolicyJob - 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 *BackupPolicyJobsPager) GetNext() (page []BackupPolicyJob, 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 *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "ListNetworkInterfaceFloatingIps" method. -type NetworkInterfaceFloatingIpsPager struct { - hasNext bool - options *ListNetworkInterfaceFloatingIpsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewNetworkInterfaceFloatingIpsPager returns a new NetworkInterfaceFloatingIpsPager instance. -func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterfaceFloatingIpsOptions) (pager *NetworkInterfaceFloatingIpsPager, 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 ListNetworkInterfaceFloatingIpsOptions = *options - pager = &NetworkInterfaceFloatingIpsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *NetworkInterfaceFloatingIpsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIPReference, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListNetworkInterfaceFloatingIpsWithContext(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.FloatingIps - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIPReference, err error) { - for pager.HasNext() { - var nextPage []FloatingIPReference - 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 *NetworkInterfaceFloatingIpsPager) GetNext() (page []FloatingIPReference, 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 *NetworkInterfaceFloatingIpsPager) GetAll() (allItems []FloatingIPReference, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "ListVirtualNetworkInterfaceIps" method. -type VirtualNetworkInterfaceIpsPager struct { - hasNext bool - options *ListVirtualNetworkInterfaceIpsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVirtualNetworkInterfaceIpsPager returns a new VirtualNetworkInterfaceIpsPager instance. -func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetworkInterfaceIpsOptions) (pager *VirtualNetworkInterfaceIpsPager, 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 ListVirtualNetworkInterfaceIpsOptions = *options - pager = &VirtualNetworkInterfaceIpsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VirtualNetworkInterfaceIpsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIPReference, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVirtualNetworkInterfaceIpsWithContext(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.Ips - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIPReference, err error) { - for pager.HasNext() { - var nextPage []ReservedIPReference - 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 *VirtualNetworkInterfaceIpsPager) GetNext() (page []ReservedIPReference, 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 *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPReference, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. -type VirtualNetworkInterfacesPager struct { - hasNext bool - options *ListVirtualNetworkInterfacesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. -func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, 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 ListVirtualNetworkInterfacesOptions = *options - pager = &VirtualNetworkInterfacesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VirtualNetworkInterfacesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []VirtualNetworkInterface, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVirtualNetworkInterfacesWithContext(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.VirtualNetworkInterfaces - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []VirtualNetworkInterface, err error) { - for pager.HasNext() { - var nextPage []VirtualNetworkInterface - 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 *VirtualNetworkInterfacesPager) GetNext() (page []VirtualNetworkInterface, 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 *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, 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 - options *ListPublicGatewaysOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewPublicGatewaysPager returns a new PublicGatewaysPager instance. -func (vpc *VpcV1) NewPublicGatewaysPager(options *ListPublicGatewaysOptions) (pager *PublicGatewaysPager, 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 ListPublicGatewaysOptions = *options - pager = &PublicGatewaysPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *PublicGatewaysPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page []PublicGateway, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListPublicGatewaysWithContext(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.PublicGateways - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []PublicGateway, err error) { - for pager.HasNext() { - var nextPage []PublicGateway - 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 *PublicGatewaysPager) GetNext() (page []PublicGateway, 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 *PublicGatewaysPager) GetAll() (allItems []PublicGateway, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. -type FloatingIpsPager struct { - hasNext bool - options *ListFloatingIpsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewFloatingIpsPager returns a new FloatingIpsPager instance. -func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *FloatingIpsPager, 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 ListFloatingIpsOptions = *options - pager = &FloatingIpsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *FloatingIpsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIP, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListFloatingIpsWithContext(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.FloatingIps - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIP, err error) { - for pager.HasNext() { - var nextPage []FloatingIP - 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 *FloatingIpsPager) GetNext() (page []FloatingIP, 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 *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// NetworkACLRulesPager can be used to simplify the use of the "ListNetworkACLRules" method. -type NetworkACLRulesPager struct { - hasNext bool - options *ListNetworkACLRulesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewNetworkACLRulesPager returns a new NetworkACLRulesPager instance. -func (vpc *VpcV1) NewNetworkACLRulesPager(options *ListNetworkACLRulesOptions) (pager *NetworkACLRulesPager, 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 ListNetworkACLRulesOptions = *options - pager = &NetworkACLRulesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *NetworkACLRulesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *NetworkACLRulesPager) GetNextWithContext(ctx context.Context) (page []NetworkACLRuleItemIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListNetworkACLRulesWithContext(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.Rules - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACLRuleItemIntf, err error) { - for pager.HasNext() { - var nextPage []NetworkACLRuleItemIntf - 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 *NetworkACLRulesPager) GetNext() (page []NetworkACLRuleItemIntf, 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 *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. -type NetworkAclsPager struct { - hasNext bool - options *ListNetworkAclsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewNetworkAclsPager returns a new NetworkAclsPager instance. -func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *NetworkAclsPager, 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 ListNetworkAclsOptions = *options - pager = &NetworkAclsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *NetworkAclsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []NetworkACL, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListNetworkAclsWithContext(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.NetworkAcls - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACL, err error) { - for pager.HasNext() { - var nextPage []NetworkACL - 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 *NetworkAclsPager) GetNext() (page []NetworkACL, 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 *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// SecurityGroupTargetsPager can be used to simplify the use of the "ListSecurityGroupTargets" method. -type SecurityGroupTargetsPager struct { - hasNext bool - options *ListSecurityGroupTargetsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSecurityGroupTargetsPager returns a new SecurityGroupTargetsPager instance. -func (vpc *VpcV1) NewSecurityGroupTargetsPager(options *ListSecurityGroupTargetsOptions) (pager *SecurityGroupTargetsPager, 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 ListSecurityGroupTargetsOptions = *options - pager = &SecurityGroupTargetsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SecurityGroupTargetsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroupTargetReferenceIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSecurityGroupTargetsWithContext(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.Targets - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroupTargetReferenceIntf, err error) { - for pager.HasNext() { - var nextPage []SecurityGroupTargetReferenceIntf - 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 *SecurityGroupTargetsPager) GetNext() (page []SecurityGroupTargetReferenceIntf, 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 *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTargetReferenceIntf, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. -type SecurityGroupsPager struct { - hasNext bool - options *ListSecurityGroupsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSecurityGroupsPager returns a new SecurityGroupsPager instance. -func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pager *SecurityGroupsPager, 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 ListSecurityGroupsOptions = *options - pager = &SecurityGroupsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SecurityGroupsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroup, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSecurityGroupsWithContext(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.SecurityGroups - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroup, err error) { - for pager.HasNext() { - var nextPage []SecurityGroup - 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 *SecurityGroupsPager) GetNext() (page []SecurityGroup, 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 *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// IkePoliciesPager can be used to simplify the use of the "ListIkePolicies" method. -type IkePoliciesPager struct { - hasNext bool - options *ListIkePoliciesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewIkePoliciesPager returns a new IkePoliciesPager instance. -func (vpc *VpcV1) NewIkePoliciesPager(options *ListIkePoliciesOptions) (pager *IkePoliciesPager, 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 ListIkePoliciesOptions = *options - pager = &IkePoliciesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *IkePoliciesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *IkePoliciesPager) GetNextWithContext(ctx context.Context) (page []IkePolicy, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListIkePoliciesWithContext(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.IkePolicies - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *IkePoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IkePolicy, err error) { - for pager.HasNext() { - var nextPage []IkePolicy - 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 *IkePoliciesPager) GetNext() (page []IkePolicy, 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 *IkePoliciesPager) GetAll() (allItems []IkePolicy, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// IpsecPoliciesPager can be used to simplify the use of the "ListIpsecPolicies" method. -type IpsecPoliciesPager struct { - hasNext bool - options *ListIpsecPoliciesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewIpsecPoliciesPager returns a new IpsecPoliciesPager instance. -func (vpc *VpcV1) NewIpsecPoliciesPager(options *ListIpsecPoliciesOptions) (pager *IpsecPoliciesPager, 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 ListIpsecPoliciesOptions = *options - pager = &IpsecPoliciesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *IpsecPoliciesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *IpsecPoliciesPager) GetNextWithContext(ctx context.Context) (page []IPsecPolicy, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListIpsecPoliciesWithContext(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.IpsecPolicies - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *IpsecPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IPsecPolicy, err error) { - for pager.HasNext() { - var nextPage []IPsecPolicy - 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 *IpsecPoliciesPager) GetNext() (page []IPsecPolicy, 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 *IpsecPoliciesPager) GetAll() (allItems []IPsecPolicy, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. -type VPNGatewaysPager struct { - hasNext bool - options *ListVPNGatewaysOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPNGatewaysPager returns a new VPNGatewaysPager instance. -func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *VPNGatewaysPager, 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 ListVPNGatewaysOptions = *options - pager = &VPNGatewaysPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNGatewaysPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPNGatewaysWithContext(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.VPNGateways - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayIntf, err error) { - for pager.HasNext() { - var nextPage []VPNGatewayIntf - 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 *VPNGatewaysPager) GetNext() (page []VPNGatewayIntf, 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 *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. -type VPNServerClientsPager struct { - hasNext bool - options *ListVPNServerClientsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPNServerClientsPager returns a new VPNServerClientsPager instance. -func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) (pager *VPNServerClientsPager, 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 ListVPNServerClientsOptions = *options - pager = &VPNServerClientsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServerClientsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (page []VPNServerClient, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPNServerClientsWithContext(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.Clients - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerClient, err error) { - for pager.HasNext() { - var nextPage []VPNServerClient - 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 *VPNServerClientsPager) GetNext() (page []VPNServerClient, 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 *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. -type VPNServerRoutesPager struct { - hasNext bool - options *ListVPNServerRoutesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPNServerRoutesPager returns a new VPNServerRoutesPager instance. -func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) (pager *VPNServerRoutesPager, 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 ListVPNServerRoutesOptions = *options - pager = &VPNServerRoutesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServerRoutesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page []VPNServerRoute, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPNServerRoutesWithContext(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.Routes - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerRoute, err error) { - for pager.HasNext() { - var nextPage []VPNServerRoute - 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 *VPNServerRoutesPager) GetNext() (page []VPNServerRoute, 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 *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// VPNServersPager can be used to simplify the use of the "ListVPNServers" method. -type VPNServersPager struct { - hasNext bool - options *ListVPNServersOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPNServersPager returns a new VPNServersPager instance. -func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPNServersPager, 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 ListVPNServersOptions = *options - pager = &VPNServersPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServersPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VPNServer, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPNServersWithContext(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.VPNServers - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems []VPNServer, err error) { - for pager.HasNext() { - var nextPage []VPNServer - 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 *VPNServersPager) GetNext() (page []VPNServer, 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 *VPNServersPager) GetAll() (allItems []VPNServer, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// LoadBalancerProfilesPager can be used to simplify the use of the "ListLoadBalancerProfiles" method. -type LoadBalancerProfilesPager struct { - hasNext bool - options *ListLoadBalancerProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewLoadBalancerProfilesPager returns a new LoadBalancerProfilesPager instance. -func (vpc *VpcV1) NewLoadBalancerProfilesPager(options *ListLoadBalancerProfilesOptions) (pager *LoadBalancerProfilesPager, 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 ListLoadBalancerProfilesOptions = *options - pager = &LoadBalancerProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *LoadBalancerProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *LoadBalancerProfilesPager) GetNextWithContext(ctx context.Context) (page []LoadBalancerProfile, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListLoadBalancerProfilesWithContext(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 *LoadBalancerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []LoadBalancerProfile, err error) { - for pager.HasNext() { - var nextPage []LoadBalancerProfile - 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 *LoadBalancerProfilesPager) GetNext() (page []LoadBalancerProfile, 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 *LoadBalancerProfilesPager) GetAll() (allItems []LoadBalancerProfile, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// LoadBalancersPager can be used to simplify the use of the "ListLoadBalancers" method. -type LoadBalancersPager struct { - hasNext bool - options *ListLoadBalancersOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewLoadBalancersPager returns a new LoadBalancersPager instance. -func (vpc *VpcV1) NewLoadBalancersPager(options *ListLoadBalancersOptions) (pager *LoadBalancersPager, 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 ListLoadBalancersOptions = *options - pager = &LoadBalancersPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *LoadBalancersPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *LoadBalancersPager) GetNextWithContext(ctx context.Context) (page []LoadBalancer, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListLoadBalancersWithContext(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.LoadBalancers - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *LoadBalancersPager) GetAllWithContext(ctx context.Context) (allItems []LoadBalancer, err error) { - for pager.HasNext() { - var nextPage []LoadBalancer - 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 *LoadBalancersPager) GetNext() (page []LoadBalancer, 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 *LoadBalancersPager) GetAll() (allItems []LoadBalancer, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// EndpointGatewayIpsPager can be used to simplify the use of the "ListEndpointGatewayIps" method. -type EndpointGatewayIpsPager struct { - hasNext bool - options *ListEndpointGatewayIpsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewEndpointGatewayIpsPager returns a new EndpointGatewayIpsPager instance. -func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOptions) (pager *EndpointGatewayIpsPager, 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 ListEndpointGatewayIpsOptions = *options - pager = &EndpointGatewayIpsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *EndpointGatewayIpsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListEndpointGatewayIpsWithContext(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.Ips - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { - for pager.HasNext() { - var nextPage []ReservedIP - 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 *EndpointGatewayIpsPager) GetNext() (page []ReservedIP, 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 *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// EndpointGatewaysPager can be used to simplify the use of the "ListEndpointGateways" method. -type EndpointGatewaysPager struct { - hasNext bool - options *ListEndpointGatewaysOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewEndpointGatewaysPager returns a new EndpointGatewaysPager instance. -func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) (pager *EndpointGatewaysPager, 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 ListEndpointGatewaysOptions = *options - pager = &EndpointGatewaysPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *EndpointGatewaysPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (page []EndpointGateway, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListEndpointGatewaysWithContext(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.EndpointGateways - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []EndpointGateway, err error) { - for pager.HasNext() { - var nextPage []EndpointGateway - 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 *EndpointGatewaysPager) GetNext() (page []EndpointGateway, 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 *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// FlowLogCollectorsPager can be used to simplify the use of the "ListFlowLogCollectors" method. -type FlowLogCollectorsPager struct { - hasNext bool - options *ListFlowLogCollectorsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewFlowLogCollectorsPager returns a new FlowLogCollectorsPager instance. -func (vpc *VpcV1) NewFlowLogCollectorsPager(options *ListFlowLogCollectorsOptions) (pager *FlowLogCollectorsPager, 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 ListFlowLogCollectorsOptions = *options - pager = &FlowLogCollectorsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *FlowLogCollectorsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *FlowLogCollectorsPager) GetNextWithContext(ctx context.Context) (page []FlowLogCollector, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListFlowLogCollectorsWithContext(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.FlowLogCollectors - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *FlowLogCollectorsPager) GetAllWithContext(ctx context.Context) (allItems []FlowLogCollector, err error) { - for pager.HasNext() { - var nextPage []FlowLogCollector - 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 *FlowLogCollectorsPager) GetNext() (page []FlowLogCollector, 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 *FlowLogCollectorsPager) GetAll() (allItems []FlowLogCollector, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} diff --git a/go.mod b/go.mod index 456ac55837..f4f5fd0a31 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/IBM/schematics-go-sdk v0.2.3 github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4 github.com/IBM/vpc-beta-go-sdk v0.6.0 - github.com/IBM/vpc-go-sdk v0.48.0 + github.com/IBM/vpc-go-sdk v0.51.0 github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5 github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 github.com/akamai/AkamaiOPEN-edgegrid-golang/v5 v5.0.0 @@ -238,8 +238,6 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt // add sdk changes. replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.48.0 => ./common/github.com/IBM/vpc-go-sdk - exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible diff --git a/go.sum b/go.sum index ce4a1779e7..b641dd31f3 100644 --- a/go.sum +++ b/go.sum @@ -174,6 +174,8 @@ github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4 h1:xa9e+POVqaXxXHXkSMCOVAbKdUNEu github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4/go.mod h1:5gq8D8uWOIbqOm1uztay6lpOysgJaxxEsaVZLWGWb40= github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQyz4uc= github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA= +github.com/IBM/vpc-go-sdk v0.51.0 h1:JfeE/TnPm/NFU59UctiPzjxEhHtmBqXxG6zHH5eTI8I= +github.com/IBM/vpc-go-sdk v0.51.0/go.mod h1:3+zQ0dqiv46ALjRXXVrser+dCdAVXOHVwlYkCCX4bNU= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= @@ -438,7 +440,6 @@ github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3 github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= 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/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= @@ -569,7 +570,6 @@ github.com/go-ozzo/ozzo-validation v3.6.0+incompatible h1:msy24VGS42fKO9K1vLz82/ github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es= github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew= 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.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= @@ -1522,10 +1522,8 @@ github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= -github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= -github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= @@ -1633,7 +1631,6 @@ golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1891,7 +1888,6 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1904,8 +1900,6 @@ golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= @@ -1923,7 +1917,6 @@ golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1937,7 +1930,6 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= From 12b531eef24270ae1b79cb00749a45e1c0568139 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 14 May 2024 10:54:17 +0530 Subject: [PATCH 077/103] Update go.sum --- go.sum | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go.sum b/go.sum index 690586e69c..26d367531d 100644 --- a/go.sum +++ b/go.sum @@ -178,8 +178,8 @@ github.com/IBM/vmware-go-sdk v0.1.2 h1:5lKWFyInWz9e2hwGsoFTEoLa1jYkD30SReN0fQ10w github.com/IBM/vmware-go-sdk v0.1.2/go.mod h1:2UGPBJju3jiv5VKKBBm9a5L6bzF/aJdKOKAzJ7HaOjA= github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQyz4uc= github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA= -github.com/IBM/vpc-go-sdk v0.50.0 h1:+vnXYK0FXFXYqaS/5/X1XEqH0bbRotkzkerRk21ZEjE= -github.com/IBM/vpc-go-sdk v0.50.0/go.mod h1:iBg9UJY1y/XpkweyP6YH7G6guzKPV8BYDoBMTdPupH4= +github.com/IBM/vpc-go-sdk v0.51.0 h1:JfeE/TnPm/NFU59UctiPzjxEhHtmBqXxG6zHH5eTI8I= +github.com/IBM/vpc-go-sdk v0.51.0/go.mod h1:3+zQ0dqiv46ALjRXXVrser+dCdAVXOHVwlYkCCX4bNU= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= From 449c375304c1c49cf10e0bb1cf086fefe2e4098b Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 15 May 2024 10:13:50 +0530 Subject: [PATCH 078/103] Update data_source_ibm_is_vpn_gateway_connection.go --- ...ta_source_ibm_is_vpn_gateway_connection.go | 43 ++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go index 5459403b48..64f32cc6a0 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go @@ -409,12 +409,45 @@ func dataSourceIBMIsVPNGatewayConnectionRead(context context.Context, d *schema. vpn_gateway_conn_found := false for _, connectionItem := range availableVPNGatewayConnections.Connections { - connection := connectionItem.(*vpcv1.VPNGatewayConnection) - if *connection.Name == vpn_gateway_connection_name { - vpnGatewayConnection = connectionItem - vpn_gateway_conn_found = true - break + switch reflect.TypeOf(connectionItem).String() { + case "*vpcv1.VPNGatewayConnection": + { + connection := connectionItem.(*vpcv1.VPNGatewayConnection) + if *connection.Name == vpn_gateway_connection_name { + vpnGatewayConnection = connectionItem + vpn_gateway_conn_found = true + break + } + } + case "*vpcv1.VPNGatewayConnectionRouteMode": + { + connection := connectionItem.(*vpcv1.VPNGatewayConnectionRouteMode) + if *connection.Name == vpn_gateway_connection_name { + vpnGatewayConnection = connectionItem + vpn_gateway_conn_found = true + break + } + } + case "*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode": + { + connection := connectionItem.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) + if *connection.Name == vpn_gateway_connection_name { + vpnGatewayConnection = connectionItem + vpn_gateway_conn_found = true + break + } + } + case "*vpcv1.VPNGatewayConnectionPolicyMode": + { + connection := connectionItem.(*vpcv1.VPNGatewayConnectionPolicyMode) + if *connection.Name == vpn_gateway_connection_name { + vpnGatewayConnection = connectionItem + vpn_gateway_conn_found = true + break + } + } } + } if !vpn_gateway_conn_found { return diag.FromErr(fmt.Errorf("VPN gateway connection %s not found", vpn_gateway_connection_name)) From 48162528b4d0e75929c13ac4b2f0664de56eb600 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 15 May 2024 13:05:11 +0530 Subject: [PATCH 079/103] fixed datasource errors --- ...ta_source_ibm_is_vpn_gateway_connection.go | 128 ++++++++++++++++++ ...a_source_ibm_is_vpn_gateway_connections.go | 105 ++++++++++++-- 2 files changed, 222 insertions(+), 11 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go index 64f32cc6a0..aa7b52543e 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go @@ -5,6 +5,7 @@ package vpc import ( "context" + "encoding/json" "fmt" "log" "reflect" @@ -217,6 +218,14 @@ func DataSourceIBMISVPNGatewayConnection() *schema.Resource { }, }, }, + "cidrs": { + Type: schema.TypeList, + Computed: true, + Description: "The local CIDRs for this resource.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, }, }, }, @@ -259,6 +268,14 @@ func DataSourceIBMISVPNGatewayConnection() *schema.Resource { Computed: true, Description: "The FQDN of the peer VPN gateway for this connection.", }, + "cidrs": { + Type: schema.TypeList, + Computed: true, + Description: "The peer CIDRs for this resource.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, }, }, }, @@ -668,6 +685,107 @@ func setvpnGatewayConnectionIntfResourceData(d *schema.ResourceData, vpn_gateway return fmt.Errorf("[ERROR] Error setting routing_protocol: %s", err) } + if vpnGatewayConnection.Tunnels != nil { + err = d.Set("tunnels", dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting tunnels %s", err) + } + } + } + case "*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode": + { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) + d.SetId(fmt.Sprintf("%s/%s", vpn_gateway_id, *vpnGatewayConnection.ID)) + if err = d.Set("admin_state_up", vpnGatewayConnection.AdminStateUp); err != nil { + return fmt.Errorf("[ERROR] Error setting admin_state_up: %s", err) + } + if err = d.Set("authentication_mode", vpnGatewayConnection.AuthenticationMode); err != nil { + return fmt.Errorf("[ERROR] Error setting authentication_mode: %s", err) + } + if err = d.Set("created_at", flex.DateTimeToString(vpnGatewayConnection.CreatedAt)); err != nil { + return fmt.Errorf("[ERROR] Error setting created_at: %s", err) + } + + if vpnGatewayConnection.DeadPeerDetection != nil { + err = d.Set("dead_peer_detection", dataSourceVPNGatewayConnectionFlattenDeadPeerDetection(*vpnGatewayConnection.DeadPeerDetection)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting dead_peer_detection %s", err) + } + } + if err = d.Set("href", vpnGatewayConnection.Href); err != nil { + return fmt.Errorf("[ERROR] Error setting href: %s", err) + } + + if vpnGatewayConnection.IkePolicy != nil { + err = d.Set("ike_policy", dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ike_policy %s", err) + } + } + + if vpnGatewayConnection.IpsecPolicy != nil { + err = d.Set("ipsec_policy", dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ipsec_policy %s", err) + } + } + if err = d.Set("mode", vpnGatewayConnection.Mode); err != nil { + return fmt.Errorf("[ERROR] Error setting mode: %s", err) + } + if err = d.Set("name", vpnGatewayConnection.Name); err != nil { + return fmt.Errorf("[ERROR] Error setting name: %s", err) + } + + // breaking changes + if err = d.Set("establish_mode", vpnGatewayConnection.EstablishMode); err != nil { + return fmt.Errorf("[ERROR] Error setting establish_mode: %s", err) + } + local := []map[string]interface{}{} + if vpnGatewayConnection.Local != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(vpnGatewayConnection.Local) + if err != nil { + return err + } + local = append(local, modelMap) + } + if err = d.Set("local", local); err != nil { + return fmt.Errorf("[ERROR] Error setting local %s", err) + } + + peer := []map[string]interface{}{} + if vpnGatewayConnection.Peer != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(vpnGatewayConnection.Peer) + if err != nil { + return err + } + peer = append(peer, modelMap) + } + if err = d.Set("peer", peer); err != nil { + return fmt.Errorf("[ERROR] Error setting peer %s", err) + } + // Deprecated + if vpnGatewayConnection.Peer != nil { + peer := vpnGatewayConnection.Peer.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer) + if err = d.Set("peer_address", peer.Address); err != nil { + return fmt.Errorf("[ERROR] Error setting peer_address: %s", err) + } + } + if err = d.Set("psk", vpnGatewayConnection.Psk); err != nil { + return fmt.Errorf("[ERROR] Error setting psk: %s", err) + } + if err = d.Set("resource_type", vpnGatewayConnection.ResourceType); err != nil { + return fmt.Errorf("[ERROR] Error setting resource_type: %s", err) + } + if err = d.Set("status", vpnGatewayConnection.Status); err != nil { + return fmt.Errorf("[ERROR] Error setting status: %s", err) + } + if err := d.Set("status_reasons", resourceVPNGatewayConnectionFlattenLifecycleReasons(vpnGatewayConnection.StatusReasons)); err != nil { + return fmt.Errorf("[ERROR] Error setting status_reasons: %s", err) + } + if err = d.Set("routing_protocol", vpnGatewayConnection.RoutingProtocol); err != nil { + return fmt.Errorf("[ERROR] Error setting routing_protocol: %s", err) + } + if vpnGatewayConnection.Tunnels != nil { err = d.Set("tunnels", dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels)) if err != nil { @@ -1112,3 +1230,13 @@ func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModePeerVPNGat modelMap["fqdn"] = model.Fqdn return modelMap, nil } + +// PrettyPrint print pretty. +func PrettifyPrint(result interface{}) string { + output, err := json.MarshalIndent(result, "", " ") + + if err == nil { + return fmt.Sprintf("%v", string(output)) + } + return string(output) +} diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go index 75ab693473..b334753f48 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go @@ -135,10 +135,9 @@ func DataSourceIBMISVPNGatewayConnections() *schema.Resource { }, }, "cidrs": { - Type: schema.TypeSet, + Type: schema.TypeList, Computed: true, Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, Description: "VPN gateway connection local CIDRs", }, }, @@ -168,6 +167,14 @@ func DataSourceIBMISVPNGatewayConnections() *schema.Resource { }, }, }, + "cidrs": { + Type: schema.TypeList, + Computed: true, + Description: "The peer CIDRs for this resource.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, "type": &schema.Schema{ Type: schema.TypeString, Computed: true, @@ -186,6 +193,16 @@ func DataSourceIBMISVPNGatewayConnections() *schema.Resource { }, }, }, + "psk": { + Type: schema.TypeString, + Computed: true, + Description: "The preshared key.", + }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "The href of the vpn gateway connection.", + }, isVPNGatewayConnectionResourcetype: { Type: schema.TypeString, Computed: true, @@ -308,16 +325,18 @@ func getvpnGatewayConnectionIntfData(vpnGatewayConnectionIntf vpcv1.VPNGatewayCo gatewayconnection["created_at"] = flex.DateTimeToString(vpnGatewayConnection.CreatedAt) if vpnGatewayConnection.DeadPeerDetection != nil { - gatewayconnection["dead_peer_detection"] = dataSourceVPNGatewayConnectionFlattenDeadPeerDetection(*vpnGatewayConnection.DeadPeerDetection) + gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = vpnGatewayConnection.DeadPeerDetection.Action + gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = vpnGatewayConnection.DeadPeerDetection.Interval + gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = vpnGatewayConnection.DeadPeerDetection.Timeout } gatewayconnection["href"] = vpnGatewayConnection.Href if vpnGatewayConnection.IkePolicy != nil { - gatewayconnection["ike_policy"] = dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy) + gatewayconnection["ike_policy"] = vpnGatewayConnection.IkePolicy.ID } if vpnGatewayConnection.IpsecPolicy != nil { - gatewayconnection["ipsec_policy"] = dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy) + gatewayconnection["ipsec_policy"] = vpnGatewayConnection.IpsecPolicy.ID } gatewayconnection["mode"] = vpnGatewayConnection.Mode gatewayconnection["name"] = vpnGatewayConnection.Name @@ -367,15 +386,77 @@ func getvpnGatewayConnectionIntfData(vpnGatewayConnectionIntf vpcv1.VPNGatewayCo gatewayconnection["created_at"] = flex.DateTimeToString(vpnGatewayConnection.CreatedAt) if vpnGatewayConnection.DeadPeerDetection != nil { - gatewayconnection["dead_peer_detection"] = dataSourceVPNGatewayConnectionFlattenDeadPeerDetection(*vpnGatewayConnection.DeadPeerDetection) + gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = vpnGatewayConnection.DeadPeerDetection.Action + gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = vpnGatewayConnection.DeadPeerDetection.Interval + gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = vpnGatewayConnection.DeadPeerDetection.Timeout + } + gatewayconnection["href"] = vpnGatewayConnection.Href + if vpnGatewayConnection.IkePolicy != nil { + gatewayconnection["ike_policy"] = vpnGatewayConnection.IkePolicy.ID + } + + if vpnGatewayConnection.IpsecPolicy != nil { + gatewayconnection["ipsec_policy"] = vpnGatewayConnection.IpsecPolicy.ID + } + gatewayconnection["mode"] = vpnGatewayConnection.Mode + gatewayconnection["name"] = vpnGatewayConnection.Name + + // breaking changes + gatewayconnection["establish_mode"] = vpnGatewayConnection.EstablishMode + local := []map[string]interface{}{} + if vpnGatewayConnection.Local != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(vpnGatewayConnection.Local) + if err != nil { + return gatewayconnection, err + } + local = append(local, modelMap) + } + gatewayconnection["local"] = local + + peer := []map[string]interface{}{} + if vpnGatewayConnection.Peer != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(vpnGatewayConnection.Peer) + if err != nil { + return gatewayconnection, err + } + peer = append(peer, modelMap) + } + gatewayconnection["peer"] = peer + // Deprecated + if vpnGatewayConnection.Peer != nil { + peer := vpnGatewayConnection.Peer.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer) + gatewayconnection["peer_address"] = peer.Address + } + gatewayconnection["psk"] = vpnGatewayConnection.Psk + gatewayconnection["resource_type"] = vpnGatewayConnection.ResourceType + gatewayconnection["status"] = vpnGatewayConnection.Status + gatewayconnection["status_reasons"] = resourceVPNGatewayConnectionFlattenLifecycleReasons(vpnGatewayConnection.StatusReasons) + gatewayconnection["routing_protocol"] = vpnGatewayConnection.RoutingProtocol + + if vpnGatewayConnection.Tunnels != nil { + gatewayconnection["tunnels"] = dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels) + } + } + case "*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode": + { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) + gatewayconnection["id"] = vpnGatewayConnection.ID + gatewayconnection["admin_state_up"] = vpnGatewayConnection.AdminStateUp + gatewayconnection["authentication_mode"] = vpnGatewayConnection.AuthenticationMode + gatewayconnection["created_at"] = flex.DateTimeToString(vpnGatewayConnection.CreatedAt) + + if vpnGatewayConnection.DeadPeerDetection != nil { + gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = vpnGatewayConnection.DeadPeerDetection.Action + gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = vpnGatewayConnection.DeadPeerDetection.Interval + gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = vpnGatewayConnection.DeadPeerDetection.Timeout } gatewayconnection["href"] = vpnGatewayConnection.Href if vpnGatewayConnection.IkePolicy != nil { - gatewayconnection["ike_policy"] = dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy) + gatewayconnection["ike_policy"] = vpnGatewayConnection.IkePolicy.ID } if vpnGatewayConnection.IpsecPolicy != nil { - gatewayconnection["ipsec_policy"] = dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy) + gatewayconnection["ipsec_policy"] = vpnGatewayConnection.IpsecPolicy.ID } gatewayconnection["mode"] = vpnGatewayConnection.Mode gatewayconnection["name"] = vpnGatewayConnection.Name @@ -425,15 +506,17 @@ func getvpnGatewayConnectionIntfData(vpnGatewayConnectionIntf vpcv1.VPNGatewayCo gatewayconnection["created_at"] = flex.DateTimeToString(vpnGatewayConnection.CreatedAt) if vpnGatewayConnection.DeadPeerDetection != nil { - gatewayconnection["dead_peer_detection"] = dataSourceVPNGatewayConnectionFlattenDeadPeerDetection(*vpnGatewayConnection.DeadPeerDetection) + gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = vpnGatewayConnection.DeadPeerDetection.Action + gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = vpnGatewayConnection.DeadPeerDetection.Interval + gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = vpnGatewayConnection.DeadPeerDetection.Timeout } gatewayconnection["href"] = vpnGatewayConnection.Href if vpnGatewayConnection.IkePolicy != nil { - gatewayconnection["ike_policy"] = dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy) + gatewayconnection["ike_policy"] = vpnGatewayConnection.IkePolicy.ID } if vpnGatewayConnection.IpsecPolicy != nil { - gatewayconnection["ipsec_policy"] = dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy) + gatewayconnection["ipsec_policy"] = vpnGatewayConnection.IpsecPolicy.ID } gatewayconnection["mode"] = vpnGatewayConnection.Mode gatewayconnection["name"] = vpnGatewayConnection.Name From 2ffd72bfbffa2f01a1397b02e7caa8cc2548a9c8 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 15 May 2024 13:47:37 +0530 Subject: [PATCH 080/103] gateway fix --- ...ta_source_ibm_is_vpn_gateway_connection.go | 4 +- ...resource_ibm_is_vpn_gateway_connections.go | 422 +++++++++++++++++- 2 files changed, 423 insertions(+), 3 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go index aa7b52543e..6e9518b678 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go @@ -483,11 +483,11 @@ func dataSourceIBMIsVPNGatewayConnectionRead(context context.Context, d *schema. vpnGatewayConnection = vpnGatewayConnectionIntf } - setvpnGatewayConnectionIntfResourceData(d, vpn_gateway_id, vpnGatewayConnection) + setvpnGatewayConnectionIntfDatasourceData(d, vpn_gateway_id, vpnGatewayConnection) return nil } -func setvpnGatewayConnectionIntfResourceData(d *schema.ResourceData, vpn_gateway_id string, vpnGatewayConnectionIntf vpcv1.VPNGatewayConnectionIntf) error { +func setvpnGatewayConnectionIntfDatasourceData(d *schema.ResourceData, vpn_gateway_id string, vpnGatewayConnectionIntf vpcv1.VPNGatewayConnectionIntf) error { var err error switch reflect.TypeOf(vpnGatewayConnectionIntf).String() { case "*vpcv1.VPNGatewayConnection": diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go index 33d450b39d..e0cabf0ca1 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go @@ -6,6 +6,7 @@ package vpc import ( "fmt" "log" + "reflect" "time" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" @@ -71,6 +72,11 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { ForceNew: true, Description: "VPN Gateway info", }, + "href": { + Type: schema.TypeString, + Computed: true, + Description: "Href of the VPN Gateway connection", + }, // Deprecated isVPNGatewayConnectionPeerAddress: { Type: schema.TypeString, @@ -560,7 +566,7 @@ func vpngwconGet(d *schema.ResourceData, meta interface{}, gID, gConnID string) return fmt.Errorf("[ERROR] Error Getting Vpn Gateway Connection (%s): %s\n%s", gConnID, err, response) } d.Set(isVPNGatewayConnection, gConnID) - setvpnGatewayConnectionIntfResourceData(d, gID, vpnGatewayConnectionIntf) + setvpnGatewayConnectionIntfResource(d, gID, vpnGatewayConnectionIntf) getVPNGatewayOptions := &vpcv1.GetVPNGatewayOptions{ ID: &gID, } @@ -1043,3 +1049,417 @@ func resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerVPN modelMap["fqdn"] = model.Fqdn return modelMap, nil } + +func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id string, vpnGatewayConnectionIntf vpcv1.VPNGatewayConnectionIntf) error { + var err error + switch reflect.TypeOf(vpnGatewayConnectionIntf).String() { + case "*vpcv1.VPNGatewayConnection": + { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection) + d.SetId(fmt.Sprintf("%s/%s", vpn_gateway_id, *vpnGatewayConnection.ID)) + if err = d.Set("admin_state_up", vpnGatewayConnection.AdminStateUp); err != nil { + return fmt.Errorf("[ERROR] Error setting admin_state_up: %s", err) + } + if err = d.Set("authentication_mode", vpnGatewayConnection.AuthenticationMode); err != nil { + return fmt.Errorf("[ERROR] Error setting authentication_mode: %s", err) + } + if err = d.Set("created_at", flex.DateTimeToString(vpnGatewayConnection.CreatedAt)); err != nil { + return fmt.Errorf("[ERROR] Error setting created_at: %s", err) + } + + if vpnGatewayConnection.DeadPeerDetection != nil { + d.Set(isVPNGatewayConnectionDeadPeerDetectionAction, vpnGatewayConnection.DeadPeerDetection.Action) + d.Set(isVPNGatewayConnectionDeadPeerDetectionInterval, vpnGatewayConnection.DeadPeerDetection.Interval) + d.Set(isVPNGatewayConnectionDeadPeerDetectionTimeout, vpnGatewayConnection.DeadPeerDetection.Timeout) + } + if err = d.Set("href", vpnGatewayConnection.Href); err != nil { + return fmt.Errorf("[ERROR] Error setting href: %s", err) + } + + if vpnGatewayConnection.IkePolicy != nil { + err = d.Set("ike_policy", dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ike_policy %s", err) + } + } + + if vpnGatewayConnection.IpsecPolicy != nil { + err = d.Set("ipsec_policy", dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ipsec_policy %s", err) + } + } + if err = d.Set("mode", vpnGatewayConnection.Mode); err != nil { + return fmt.Errorf("[ERROR] Error setting mode: %s", err) + } + if err = d.Set("name", vpnGatewayConnection.Name); err != nil { + return fmt.Errorf("[ERROR] Error setting name: %s", err) + } + + // breaking changes + if err = d.Set("establish_mode", vpnGatewayConnection.EstablishMode); err != nil { + return fmt.Errorf("[ERROR] Error setting establish_mode: %s", err) + } + local := []map[string]interface{}{} + if vpnGatewayConnection.Local != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(vpnGatewayConnection.Local) + if err != nil { + return err + } + local = append(local, modelMap) + } + if err = d.Set("local", local); err != nil { + return fmt.Errorf("[ERROR] Error setting local %s", err) + } + + peer := []map[string]interface{}{} + if vpnGatewayConnection.Peer != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(vpnGatewayConnection.Peer) + if err != nil { + return err + } + peer = append(peer, modelMap) + } + if err = d.Set("peer", peer); err != nil { + return fmt.Errorf("[ERROR] Error setting peer %s", err) + } + // Deprecated + if vpnGatewayConnection.Peer != nil { + peer := vpnGatewayConnection.Peer.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer) + if err = d.Set("peer_address", peer.Address); err != nil { + return fmt.Errorf("[ERROR] Error setting peer_address: %s", err) + } + } + if err = d.Set("preshared_key", vpnGatewayConnection.Psk); err != nil { + return fmt.Errorf("[ERROR] Error setting psk: %s", err) + } + if err = d.Set("resource_type", vpnGatewayConnection.ResourceType); err != nil { + return fmt.Errorf("[ERROR] Error setting resource_type: %s", err) + } + if err = d.Set("status", vpnGatewayConnection.Status); err != nil { + return fmt.Errorf("[ERROR] Error setting status: %s", err) + } + if err := d.Set("status_reasons", resourceVPNGatewayConnectionFlattenLifecycleReasons(vpnGatewayConnection.StatusReasons)); err != nil { + return fmt.Errorf("[ERROR] Error setting status_reasons: %s", err) + } + if err = d.Set("routing_protocol", vpnGatewayConnection.RoutingProtocol); err != nil { + return fmt.Errorf("[ERROR] Error setting routing_protocol: %s", err) + } + + if vpnGatewayConnection.Tunnels != nil { + err = d.Set("tunnels", dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting tunnels %s", err) + } + } + } + case "*vpcv1.VPNGatewayConnectionRouteMode": + { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode) + d.SetId(fmt.Sprintf("%s/%s", vpn_gateway_id, *vpnGatewayConnection.ID)) + if err = d.Set("admin_state_up", vpnGatewayConnection.AdminStateUp); err != nil { + return fmt.Errorf("[ERROR] Error setting admin_state_up: %s", err) + } + if err = d.Set("authentication_mode", vpnGatewayConnection.AuthenticationMode); err != nil { + return fmt.Errorf("[ERROR] Error setting authentication_mode: %s", err) + } + if err = d.Set("created_at", flex.DateTimeToString(vpnGatewayConnection.CreatedAt)); err != nil { + return fmt.Errorf("[ERROR] Error setting created_at: %s", err) + } + + if vpnGatewayConnection.DeadPeerDetection != nil { + d.Set(isVPNGatewayConnectionDeadPeerDetectionAction, vpnGatewayConnection.DeadPeerDetection.Action) + d.Set(isVPNGatewayConnectionDeadPeerDetectionInterval, vpnGatewayConnection.DeadPeerDetection.Interval) + d.Set(isVPNGatewayConnectionDeadPeerDetectionTimeout, vpnGatewayConnection.DeadPeerDetection.Timeout) + } + if err = d.Set("href", vpnGatewayConnection.Href); err != nil { + return fmt.Errorf("[ERROR] Error setting href: %s", err) + } + + if vpnGatewayConnection.IkePolicy != nil { + err = d.Set("ike_policy", dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ike_policy %s", err) + } + } + + if vpnGatewayConnection.IpsecPolicy != nil { + err = d.Set("ipsec_policy", dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ipsec_policy %s", err) + } + } + if err = d.Set("mode", vpnGatewayConnection.Mode); err != nil { + return fmt.Errorf("[ERROR] Error setting mode: %s", err) + } + if err = d.Set("name", vpnGatewayConnection.Name); err != nil { + return fmt.Errorf("[ERROR] Error setting name: %s", err) + } + + // breaking changes + if err = d.Set("establish_mode", vpnGatewayConnection.EstablishMode); err != nil { + return fmt.Errorf("[ERROR] Error setting establish_mode: %s", err) + } + local := []map[string]interface{}{} + if vpnGatewayConnection.Local != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(vpnGatewayConnection.Local) + if err != nil { + return err + } + local = append(local, modelMap) + } + if err = d.Set("local", local); err != nil { + return fmt.Errorf("[ERROR] Error setting local %s", err) + } + + peer := []map[string]interface{}{} + if vpnGatewayConnection.Peer != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(vpnGatewayConnection.Peer) + if err != nil { + return err + } + peer = append(peer, modelMap) + } + if err = d.Set("peer", peer); err != nil { + return fmt.Errorf("[ERROR] Error setting peer %s", err) + } + // Deprecated + if vpnGatewayConnection.Peer != nil { + peer := vpnGatewayConnection.Peer.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer) + if err = d.Set("peer_address", peer.Address); err != nil { + return fmt.Errorf("[ERROR] Error setting peer_address: %s", err) + } + } + if err = d.Set("preshared_key", vpnGatewayConnection.Psk); err != nil { + return fmt.Errorf("[ERROR] Error setting psk: %s", err) + } + if err = d.Set("resource_type", vpnGatewayConnection.ResourceType); err != nil { + return fmt.Errorf("[ERROR] Error setting resource_type: %s", err) + } + if err = d.Set("status", vpnGatewayConnection.Status); err != nil { + return fmt.Errorf("[ERROR] Error setting status: %s", err) + } + if err := d.Set("status_reasons", resourceVPNGatewayConnectionFlattenLifecycleReasons(vpnGatewayConnection.StatusReasons)); err != nil { + return fmt.Errorf("[ERROR] Error setting status_reasons: %s", err) + } + if err = d.Set("routing_protocol", vpnGatewayConnection.RoutingProtocol); err != nil { + return fmt.Errorf("[ERROR] Error setting routing_protocol: %s", err) + } + + if vpnGatewayConnection.Tunnels != nil { + err = d.Set("tunnels", dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting tunnels %s", err) + } + } + } + case "*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode": + { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) + d.SetId(fmt.Sprintf("%s/%s", vpn_gateway_id, *vpnGatewayConnection.ID)) + if err = d.Set("admin_state_up", vpnGatewayConnection.AdminStateUp); err != nil { + return fmt.Errorf("[ERROR] Error setting admin_state_up: %s", err) + } + if err = d.Set("authentication_mode", vpnGatewayConnection.AuthenticationMode); err != nil { + return fmt.Errorf("[ERROR] Error setting authentication_mode: %s", err) + } + if err = d.Set("created_at", flex.DateTimeToString(vpnGatewayConnection.CreatedAt)); err != nil { + return fmt.Errorf("[ERROR] Error setting created_at: %s", err) + } + + if vpnGatewayConnection.DeadPeerDetection != nil { + d.Set(isVPNGatewayConnectionDeadPeerDetectionAction, vpnGatewayConnection.DeadPeerDetection.Action) + d.Set(isVPNGatewayConnectionDeadPeerDetectionInterval, vpnGatewayConnection.DeadPeerDetection.Interval) + d.Set(isVPNGatewayConnectionDeadPeerDetectionTimeout, vpnGatewayConnection.DeadPeerDetection.Timeout) + } + if err = d.Set("href", vpnGatewayConnection.Href); err != nil { + return fmt.Errorf("[ERROR] Error setting href: %s", err) + } + + if vpnGatewayConnection.IkePolicy != nil { + err = d.Set("ike_policy", dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ike_policy %s", err) + } + } + + if vpnGatewayConnection.IpsecPolicy != nil { + err = d.Set("ipsec_policy", dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ipsec_policy %s", err) + } + } + if err = d.Set("mode", vpnGatewayConnection.Mode); err != nil { + return fmt.Errorf("[ERROR] Error setting mode: %s", err) + } + if err = d.Set("name", vpnGatewayConnection.Name); err != nil { + return fmt.Errorf("[ERROR] Error setting name: %s", err) + } + + // breaking changes + if err = d.Set("establish_mode", vpnGatewayConnection.EstablishMode); err != nil { + return fmt.Errorf("[ERROR] Error setting establish_mode: %s", err) + } + local := []map[string]interface{}{} + if vpnGatewayConnection.Local != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModeLocalToMap(vpnGatewayConnection.Local) + if err != nil { + return err + } + local = append(local, modelMap) + } + if err = d.Set("local", local); err != nil { + return fmt.Errorf("[ERROR] Error setting local %s", err) + } + + peer := []map[string]interface{}{} + if vpnGatewayConnection.Peer != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerToMap(vpnGatewayConnection.Peer) + if err != nil { + return err + } + peer = append(peer, modelMap) + } + if err = d.Set("peer", peer); err != nil { + return fmt.Errorf("[ERROR] Error setting peer %s", err) + } + // Deprecated + if vpnGatewayConnection.Peer != nil { + peer := vpnGatewayConnection.Peer.(*vpcv1.VPNGatewayConnectionStaticRouteModePeer) + if err = d.Set("peer_address", peer.Address); err != nil { + return fmt.Errorf("[ERROR] Error setting peer_address: %s", err) + } + } + if err = d.Set("preshared_key", vpnGatewayConnection.Psk); err != nil { + return fmt.Errorf("[ERROR] Error setting psk: %s", err) + } + if err = d.Set("resource_type", vpnGatewayConnection.ResourceType); err != nil { + return fmt.Errorf("[ERROR] Error setting resource_type: %s", err) + } + if err = d.Set("status", vpnGatewayConnection.Status); err != nil { + return fmt.Errorf("[ERROR] Error setting status: %s", err) + } + if err := d.Set("status_reasons", resourceVPNGatewayConnectionFlattenLifecycleReasons(vpnGatewayConnection.StatusReasons)); err != nil { + return fmt.Errorf("[ERROR] Error setting status_reasons: %s", err) + } + if err = d.Set("routing_protocol", vpnGatewayConnection.RoutingProtocol); err != nil { + return fmt.Errorf("[ERROR] Error setting routing_protocol: %s", err) + } + + if vpnGatewayConnection.Tunnels != nil { + err = d.Set("tunnels", dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting tunnels %s", err) + } + } + } + case "*vpcv1.VPNGatewayConnectionPolicyMode": + { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode) + d.SetId(fmt.Sprintf("%s/%s", vpn_gateway_id, *vpnGatewayConnection.ID)) + if err = d.Set("admin_state_up", vpnGatewayConnection.AdminStateUp); err != nil { + return fmt.Errorf("[ERROR] Error setting admin_state_up: %s", err) + } + if err = d.Set("authentication_mode", vpnGatewayConnection.AuthenticationMode); err != nil { + return fmt.Errorf("[ERROR] Error setting authentication_mode: %s", err) + } + if err = d.Set("created_at", flex.DateTimeToString(vpnGatewayConnection.CreatedAt)); err != nil { + return fmt.Errorf("[ERROR] Error setting created_at: %s", err) + } + + if vpnGatewayConnection.DeadPeerDetection != nil { + d.Set(isVPNGatewayConnectionDeadPeerDetectionAction, vpnGatewayConnection.DeadPeerDetection.Action) + d.Set(isVPNGatewayConnectionDeadPeerDetectionInterval, vpnGatewayConnection.DeadPeerDetection.Interval) + d.Set(isVPNGatewayConnectionDeadPeerDetectionTimeout, vpnGatewayConnection.DeadPeerDetection.Timeout) + } + if err = d.Set("href", vpnGatewayConnection.Href); err != nil { + return fmt.Errorf("[ERROR] Error setting href: %s", err) + } + + if vpnGatewayConnection.IkePolicy != nil { + err = d.Set("ike_policy", dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ike_policy %s", err) + } + } + + if vpnGatewayConnection.IpsecPolicy != nil { + err = d.Set("ipsec_policy", dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy)) + if err != nil { + return fmt.Errorf("[ERROR] Error setting ipsec_policy %s", err) + } + } + if err = d.Set("mode", vpnGatewayConnection.Mode); err != nil { + return fmt.Errorf("[ERROR] Error setting mode: %s", err) + } + if err = d.Set("name", vpnGatewayConnection.Name); err != nil { + return fmt.Errorf("[ERROR] Error setting name: %s", err) + } + + // breaking changes + if err = d.Set("establish_mode", vpnGatewayConnection.EstablishMode); err != nil { + return fmt.Errorf("[ERROR] Error setting establish_mode: %s", err) + } + local := []map[string]interface{}{} + if vpnGatewayConnection.Local != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModeLocalToMap(vpnGatewayConnection.Local) + if err != nil { + return err + } + local = append(local, modelMap) + } + if err = d.Set("local", local); err != nil { + return fmt.Errorf("[ERROR] Error setting local %s", err) + } + + peer := []map[string]interface{}{} + if vpnGatewayConnection.Peer != nil { + modelMap, err := dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModePeerToMap(vpnGatewayConnection.Peer) + if err != nil { + return err + } + peer = append(peer, modelMap) + } + if err = d.Set("peer", peer); err != nil { + return fmt.Errorf("[ERROR] Error setting peer %s", err) + } + // Deprecated + if vpnGatewayConnection.Peer != nil { + peer := vpnGatewayConnection.Peer.(*vpcv1.VPNGatewayConnectionPolicyModePeer) + if err = d.Set("peer_address", peer.Address); err != nil { + return fmt.Errorf("[ERROR] Error setting peer_address: %s", err) + } + if len(peer.CIDRs) > 0 { + err = d.Set("peer_cidrs", peer.CIDRs) + if err != nil { + return fmt.Errorf("[ERROR] Error setting Peer CIDRs %s", err) + } + } + } + if err = d.Set("preshared_key", vpnGatewayConnection.Psk); err != nil { + return fmt.Errorf("[ERROR] Error setting psk: %s", err) + } + if err = d.Set("resource_type", vpnGatewayConnection.ResourceType); err != nil { + return fmt.Errorf("[ERROR] Error setting resource_type: %s", err) + } + if err = d.Set("status", vpnGatewayConnection.Status); err != nil { + return fmt.Errorf("[ERROR] Error setting status: %s", err) + } + if err := d.Set("status_reasons", resourceVPNGatewayConnectionFlattenLifecycleReasons(vpnGatewayConnection.StatusReasons)); err != nil { + return fmt.Errorf("[ERROR] Error setting status_reasons: %s", err) + } + // Deprecated + if vpnGatewayConnection.Local != nil { + local := vpnGatewayConnection.Local + if len(local.CIDRs) > 0 { + err = d.Set("local_cidrs", local.CIDRs) + if err != nil { + return fmt.Errorf("[ERROR] Error setting local CIDRs %s", err) + } + } + } + + } + } + return nil +} From 97aae0017238e789a08bf82eadc341a332c120a8 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 15 May 2024 14:18:42 +0530 Subject: [PATCH 081/103] Update resource_ibm_is_vpn_gateway_connections.go --- ...resource_ibm_is_vpn_gateway_connections.go | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go index e0cabf0ca1..4e46344817 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go @@ -98,11 +98,13 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { Type: schema.TypeList, MaxItems: 1, Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "ike_identities": &schema.Schema{ Type: schema.TypeList, Optional: true, + Computed: true, Description: "The local IKE identities.A VPN gateway in static route mode consists of two members in active-active mode. The first identity applies to the first member, and the second identity applies to the second member.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -114,6 +116,7 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { "value": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, Description: "The IKE identity FQDN value.", }, }, @@ -134,6 +137,7 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { Type: schema.TypeList, MaxItems: 1, Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "ike_identity": &schema.Schema{ @@ -166,11 +170,13 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { "address": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, Description: "The IP address of the peer VPN gateway for this connection.", }, "fqdn": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, Description: "The FQDN of the peer VPN gateway for this connection.", }, "cidrs": { @@ -198,23 +204,25 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { }, // deprecated isVPNGatewayConnectionLocalCIDRS: { - Type: schema.TypeSet, - Optional: true, - ForceNew: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, - Description: "VPN gateway connection local CIDRs", - Deprecated: "local_cidrs is deprecated, use local instead", + Type: schema.TypeSet, + Optional: true, + ForceNew: true, + ConflictsWith: []string{"local"}, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "VPN gateway connection local CIDRs", + Deprecated: "local_cidrs is deprecated, use local instead", }, // deprecated isVPNGatewayConnectionPeerCIDRS: { - Type: schema.TypeSet, - Optional: true, - ForceNew: true, - Elem: &schema.Schema{Type: schema.TypeString}, - Set: schema.HashString, - Description: "VPN gateway connection peer CIDRs", - Deprecated: "peer_cidrs is deprecated, use peer instead", + Type: schema.TypeSet, + Optional: true, + ForceNew: true, + ConflictsWith: []string{"peer"}, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Description: "VPN gateway connection peer CIDRs", + Deprecated: "peer_cidrs is deprecated, use peer instead", }, isVPNGatewayConnectionDeadPeerDetectionAction: { @@ -1420,6 +1428,8 @@ func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id } peer = append(peer, modelMap) } + tunnels := []map[string]interface{}{} + d.Set("tunnels", tunnels) if err = d.Set("peer", peer); err != nil { return fmt.Errorf("[ERROR] Error setting peer %s", err) } From 50ca95d6341622df9482a9daab573637596b459d Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 15 May 2024 14:38:43 +0530 Subject: [PATCH 082/103] Update resource_ibm_is_vpn_gateway_connections.go --- ...resource_ibm_is_vpn_gateway_connections.go | 42 +++++-------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go index 4e46344817..1f395fcd2a 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go @@ -1085,17 +1085,11 @@ func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id } if vpnGatewayConnection.IkePolicy != nil { - err = d.Set("ike_policy", dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy)) - if err != nil { - return fmt.Errorf("[ERROR] Error setting ike_policy %s", err) - } + d.Set("ike_policy", vpnGatewayConnection.IkePolicy.ID) } if vpnGatewayConnection.IpsecPolicy != nil { - err = d.Set("ipsec_policy", dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy)) - if err != nil { - return fmt.Errorf("[ERROR] Error setting ipsec_policy %s", err) - } + d.Set("ipsec_policy", vpnGatewayConnection.IpsecPolicy.ID) } if err = d.Set("mode", vpnGatewayConnection.Mode); err != nil { return fmt.Errorf("[ERROR] Error setting mode: %s", err) @@ -1185,17 +1179,11 @@ func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id } if vpnGatewayConnection.IkePolicy != nil { - err = d.Set("ike_policy", dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy)) - if err != nil { - return fmt.Errorf("[ERROR] Error setting ike_policy %s", err) - } + d.Set("ike_policy", vpnGatewayConnection.IkePolicy.ID) } if vpnGatewayConnection.IpsecPolicy != nil { - err = d.Set("ipsec_policy", dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy)) - if err != nil { - return fmt.Errorf("[ERROR] Error setting ipsec_policy %s", err) - } + d.Set("ipsec_policy", vpnGatewayConnection.IpsecPolicy.ID) } if err = d.Set("mode", vpnGatewayConnection.Mode); err != nil { return fmt.Errorf("[ERROR] Error setting mode: %s", err) @@ -1285,17 +1273,11 @@ func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id } if vpnGatewayConnection.IkePolicy != nil { - err = d.Set("ike_policy", dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy)) - if err != nil { - return fmt.Errorf("[ERROR] Error setting ike_policy %s", err) - } + d.Set("ike_policy", vpnGatewayConnection.IkePolicy.ID) } if vpnGatewayConnection.IpsecPolicy != nil { - err = d.Set("ipsec_policy", dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy)) - if err != nil { - return fmt.Errorf("[ERROR] Error setting ipsec_policy %s", err) - } + d.Set("ipsec_policy", vpnGatewayConnection.IpsecPolicy.ID) } if err = d.Set("mode", vpnGatewayConnection.Mode); err != nil { return fmt.Errorf("[ERROR] Error setting mode: %s", err) @@ -1385,17 +1367,13 @@ func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id } if vpnGatewayConnection.IkePolicy != nil { - err = d.Set("ike_policy", dataSourceVPNGatewayConnectionFlattenIkePolicy(*vpnGatewayConnection.IkePolicy)) - if err != nil { - return fmt.Errorf("[ERROR] Error setting ike_policy %s", err) - } + d.Set("ike_policy", vpnGatewayConnection.IkePolicy.ID) + } if vpnGatewayConnection.IpsecPolicy != nil { - err = d.Set("ipsec_policy", dataSourceVPNGatewayConnectionFlattenIpsecPolicy(*vpnGatewayConnection.IpsecPolicy)) - if err != nil { - return fmt.Errorf("[ERROR] Error setting ipsec_policy %s", err) - } + d.Set("ipsec_policy", vpnGatewayConnection.IpsecPolicy.ID) + } if err = d.Set("mode", vpnGatewayConnection.Mode); err != nil { return fmt.Errorf("[ERROR] Error setting mode: %s", err) From 3a0f48e245848702ceeaaac32ed23b0d914d758c Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 15 May 2024 14:46:59 +0530 Subject: [PATCH 083/103] Update resource_ibm_is_vpn_gateway_connections.go --- ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go index 1f395fcd2a..dd12458fbe 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go @@ -206,7 +206,7 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { isVPNGatewayConnectionLocalCIDRS: { Type: schema.TypeSet, Optional: true, - ForceNew: true, + Computed: true, ConflictsWith: []string{"local"}, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, @@ -217,7 +217,7 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { isVPNGatewayConnectionPeerCIDRS: { Type: schema.TypeSet, Optional: true, - ForceNew: true, + Computed: true, ConflictsWith: []string{"peer"}, Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, From 8b0e38cee0a66422f9d2502b972384b9aff1fe45 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 21 May 2024 10:39:33 +0530 Subject: [PATCH 084/103] Update provider.go --- ibm/provider/provider.go | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index dcbc5d6a13..a24ea078ef 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -522,22 +522,26 @@ func Provider() *schema.Provider { "ibm_is_virtual_network_interface_ip": vpc.DataSourceIBMIsVirtualNetworkInterfaceIP(), "ibm_is_virtual_network_interface_ips": vpc.DataSourceIBMIsVirtualNetworkInterfaceIPs(), - "ibm_is_share_mount_target": vpc.DataSourceIBMIsShareTarget(), - "ibm_is_share_mount_targets": vpc.DataSourceIBMIsShareTargets(), - "ibm_is_volume": vpc.DataSourceIBMISVolume(), - "ibm_is_volumes": vpc.DataSourceIBMIsVolumes(), - "ibm_is_volume_profile": vpc.DataSourceIBMISVolumeProfile(), - "ibm_is_volume_profiles": vpc.DataSourceIBMISVolumeProfiles(), - "ibm_is_vpc": vpc.DataSourceIBMISVPC(), - "ibm_is_vpc_dns_resolution_binding": vpc.DataSourceIBMIsVPCDnsResolutionBinding(), - "ibm_is_vpc_dns_resolution_bindings": vpc.DataSourceIBMIsVPCDnsResolutionBindings(), - "ibm_is_vpcs": vpc.DataSourceIBMISVPCs(), - "ibm_is_vpn_gateway": vpc.DataSourceIBMISVPNGateway(), - "ibm_is_vpn_gateways": vpc.DataSourceIBMISVPNGateways(), - "ibm_is_vpc_address_prefixes": vpc.DataSourceIbmIsVpcAddressPrefixes(), - "ibm_is_vpc_address_prefix": vpc.DataSourceIBMIsVPCAddressPrefix(), - "ibm_is_vpn_gateway_connection": vpc.DataSourceIBMISVPNGatewayConnection(), - "ibm_is_vpn_gateway_connections": vpc.DataSourceIBMISVPNGatewayConnections(), + "ibm_is_share_mount_target": vpc.DataSourceIBMIsShareTarget(), + "ibm_is_share_mount_targets": vpc.DataSourceIBMIsShareTargets(), + "ibm_is_volume": vpc.DataSourceIBMISVolume(), + "ibm_is_volumes": vpc.DataSourceIBMIsVolumes(), + "ibm_is_volume_profile": vpc.DataSourceIBMISVolumeProfile(), + "ibm_is_volume_profiles": vpc.DataSourceIBMISVolumeProfiles(), + "ibm_is_vpc": vpc.DataSourceIBMISVPC(), + "ibm_is_vpc_dns_resolution_binding": vpc.DataSourceIBMIsVPCDnsResolutionBinding(), + "ibm_is_vpc_dns_resolution_bindings": vpc.DataSourceIBMIsVPCDnsResolutionBindings(), + "ibm_is_vpcs": vpc.DataSourceIBMISVPCs(), + "ibm_is_vpn_gateway": vpc.DataSourceIBMISVPNGateway(), + "ibm_is_vpn_gateways": vpc.DataSourceIBMISVPNGateways(), + "ibm_is_vpc_address_prefixes": vpc.DataSourceIbmIsVpcAddressPrefixes(), + "ibm_is_vpc_address_prefix": vpc.DataSourceIBMIsVPCAddressPrefix(), + "ibm_is_vpn_gateway_connection": vpc.DataSourceIBMISVPNGatewayConnection(), + "ibm_is_vpn_gateway_connections": vpc.DataSourceIBMISVPNGatewayConnections(), + + "ibm_is_vpn_gateway_connection_local_cidrs": vpc.DataSourceIBMIsVPNGatewayConnectionLocalCidrs(), + "ibm_is_vpn_gateway_connection_peer_cidrs": vpc.DataSourceIBMIsVPNGatewayConnectionPeerCidrs(), + "ibm_is_vpc_default_routing_table": vpc.DataSourceIBMISVPCDefaultRoutingTable(), "ibm_is_vpc_routing_table": vpc.DataSourceIBMIBMIsVPCRoutingTable(), "ibm_is_vpc_routing_tables": vpc.DataSourceIBMISVPCRoutingTables(), From c77ce8f5cb1dbd12561ac71c066b1abac08b5bb8 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 21 May 2024 13:40:23 +0530 Subject: [PATCH 085/103] Update resource_ibm_is_vpn_gateway_connections.go --- ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go index dd12458fbe..1709436c72 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go @@ -1247,6 +1247,8 @@ func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id if err != nil { return fmt.Errorf("[ERROR] Error setting tunnels %s", err) } + } else { + d.Set("tunnels", []map[string]interface{}{}) } } case "*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode": @@ -1341,6 +1343,8 @@ func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id if err != nil { return fmt.Errorf("[ERROR] Error setting tunnels %s", err) } + } else { + d.Set("tunnels", []map[string]interface{}{}) } } case "*vpcv1.VPNGatewayConnectionPolicyMode": From e1ec21e30e1b56efbc9155c75265bb47d2aae369 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 22 May 2024 14:18:47 +0530 Subject: [PATCH 086/103] fixed error on setting --- ...ta_source_ibm_is_vpn_gateway_connection.go | 10 ------ ...a_source_ibm_is_vpn_gateway_connections.go | 31 +++++++++++++++++-- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go index 6e9518b678..d609c33708 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go @@ -1036,16 +1036,6 @@ func dataSourceVPNGatewayConnectionTunnelsToMap(tunnelsItem vpcv1.VPNGatewayConn return tunnelsMap } -func dataSourceVPNGatewayConnectionTunnelsPublicIPToMap(publicIPItem vpcv1.IP) (publicIPMap map[string]interface{}) { - publicIPMap = map[string]interface{}{} - - if publicIPItem.Address != nil { - publicIPMap["address"] = publicIPItem.Address - } - - return publicIPMap -} - // helper methods func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStatusReasonToMap(model *vpcv1.VPNGatewayConnectionStatusReason) (map[string]interface{}, error) { diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go index b334753f48..ca77dc9826 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go @@ -110,6 +110,11 @@ func DataSourceIBMISVPNGatewayConnections() *schema.Resource { Computed: true, Description: "The establish mode of the VPN gateway connection:- `bidirectional`: Either side of the VPN gateway can initiate IKE protocol negotiations or rekeying processes.- `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway connection. Additionally, the peer is responsible for initiating the rekeying process after the connection is established. If rekeying does not occur, the VPN gateway connection will be brought down after its lifetime expires.", }, + "routing_protocol": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "Routing protocols for this VPN gateway connection.", + }, "local": &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -374,7 +379,7 @@ func getvpnGatewayConnectionIntfData(vpnGatewayConnectionIntf vpcv1.VPNGatewayCo gatewayconnection["routing_protocol"] = vpnGatewayConnection.RoutingProtocol if vpnGatewayConnection.Tunnels != nil { - gatewayconnection["tunnels"] = dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels) + gatewayconnection["tunnels"] = dataSourceVPNGatewayConnectionsFlattenTunnels(vpnGatewayConnection.Tunnels) } } case "*vpcv1.VPNGatewayConnectionRouteMode": @@ -434,7 +439,7 @@ func getvpnGatewayConnectionIntfData(vpnGatewayConnectionIntf vpcv1.VPNGatewayCo gatewayconnection["routing_protocol"] = vpnGatewayConnection.RoutingProtocol if vpnGatewayConnection.Tunnels != nil { - gatewayconnection["tunnels"] = dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels) + gatewayconnection["tunnels"] = dataSourceVPNGatewayConnectionsFlattenTunnels(vpnGatewayConnection.Tunnels) } } case "*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode": @@ -494,7 +499,7 @@ func getvpnGatewayConnectionIntfData(vpnGatewayConnectionIntf vpcv1.VPNGatewayCo gatewayconnection["routing_protocol"] = vpnGatewayConnection.RoutingProtocol if vpnGatewayConnection.Tunnels != nil { - gatewayconnection["tunnels"] = dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels) + gatewayconnection["tunnels"] = dataSourceVPNGatewayConnectionsFlattenTunnels(vpnGatewayConnection.Tunnels) } } case "*vpcv1.VPNGatewayConnectionPolicyMode": @@ -685,3 +690,23 @@ func dataSourceIBMIsVPNGatewayConnectionsVPNGatewayConnectionStaticRouteModePeer modelMap["fqdn"] = model.Fqdn return modelMap, nil } +func dataSourceVPNGatewayConnectionsFlattenTunnels(result []vpcv1.VPNGatewayConnectionStaticRouteModeTunnel) (tunnels []map[string]interface{}) { + for _, tunnelsItem := range result { + tunnels = append(tunnels, dataSourceVPNGatewayConnectionsTunnelsToMap(tunnelsItem)) + } + + return tunnels +} + +func dataSourceVPNGatewayConnectionsTunnelsToMap(tunnelsItem vpcv1.VPNGatewayConnectionStaticRouteModeTunnel) (tunnelsMap map[string]interface{}) { + tunnelsMap = map[string]interface{}{} + + if tunnelsItem.PublicIP != nil { + tunnelsMap["address"] = tunnelsItem.PublicIP.Address + } + if tunnelsItem.Status != nil { + tunnelsMap["status"] = tunnelsItem.Status + } + + return tunnelsMap +} From 8ace53f3473add3fbfb69dd3e970e4a59f1f9d9e Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 30 May 2024 10:21:04 +0530 Subject: [PATCH 087/103] fixed cidrs issue --- .../vpc/data_source_ibm_is_vpn_gateway_connection.go | 9 +++++++++ .../vpc/resource_ibm_is_vpn_gateway_connections.go | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go index d609c33708..bfdbd90d82 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go @@ -1170,6 +1170,9 @@ func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModePeerToMap( if model.Fqdn != nil { modelMap["fqdn"] = model.Fqdn } + if model.CIDRs != nil { + modelMap["cidrs"] = model.CIDRs + } return modelMap, nil } else { return nil, fmt.Errorf("Unrecognized vpcv1.VPNGatewayConnectionPolicyModePeerIntf subtype encountered") @@ -1196,6 +1199,9 @@ func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModePeerVPNGat modelMap["ike_identity"] = []map[string]interface{}{ikeIdentityMap} modelMap["type"] = model.Type modelMap["address"] = model.Address + if model.CIDRs != nil { + modelMap["cidrs"] = model.CIDRs + } return modelMap, nil } func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdnToMap(model *vpcv1.VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn) (map[string]interface{}, error) { @@ -1218,6 +1224,9 @@ func dataSourceIBMIsVPNGatewayConnectionVPNGatewayConnectionPolicyModePeerVPNGat modelMap["ike_identity"] = []map[string]interface{}{ikeIdentityMap} modelMap["type"] = model.Type modelMap["fqdn"] = model.Fqdn + if model.CIDRs != nil { + modelMap["cidrs"] = model.CIDRs + } return modelMap, nil } diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go index 1709436c72..ac08f7c05a 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go @@ -1410,11 +1410,12 @@ func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id } peer = append(peer, modelMap) } - tunnels := []map[string]interface{}{} - d.Set("tunnels", tunnels) if err = d.Set("peer", peer); err != nil { return fmt.Errorf("[ERROR] Error setting peer %s", err) } + tunnels := []map[string]interface{}{} + d.Set("tunnels", tunnels) + // Deprecated if vpnGatewayConnection.Peer != nil { peer := vpnGatewayConnection.Peer.(*vpcv1.VPNGatewayConnectionPolicyModePeer) @@ -1453,5 +1454,6 @@ func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id } } + return nil } From 2a3bfb26be35ef790b818c43ddbeac1350bf99b4 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 30 May 2024 13:56:26 +0530 Subject: [PATCH 088/103] Update resource_ibm_is_vpn_gateway_connections.go --- ...resource_ibm_is_vpn_gateway_connections.go | 292 +++++++++++++----- 1 file changed, 210 insertions(+), 82 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go index ac08f7c05a..7d976ad95c 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connections.go @@ -311,6 +311,11 @@ func ResourceIBMISVPNGatewayConnection() *schema.Resource { Computed: true, Description: "The resource type", }, + "routing_protocol": { + Type: schema.TypeString, + Computed: true, + Description: "Routing protocols for this VPN gateway connection.", + }, isVPNGatewayConnectionCreatedat: { Type: schema.TypeString, @@ -443,97 +448,196 @@ func vpngwconCreate(d *schema.ResourceData, meta interface{}, name, gatewayID, p if err != nil { return err } - - vpnGatewayConnectionPrototypeModel := &vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype{ - Psk: &prephasedKey, - AdminStateUp: &stateUp, - DeadPeerDetection: &vpcv1.VPNGatewayConnectionDpdPrototype{ - Action: &action, - Interval: &interval, - Timeout: &timeout, - }, - Name: &name, - } - options := &vpcv1.CreateVPNGatewayConnectionOptions{ - VPNGatewayID: &gatewayID, - VPNGatewayConnectionPrototype: vpnGatewayConnectionPrototypeModel, + vpngateway, response, err := sess.GetVPNGateway(&vpcv1.GetVPNGatewayOptions{ + ID: &gatewayID, + }) + if err != nil { + if response != nil && response.StatusCode == 404 { + d.SetId("") + return nil + } + return fmt.Errorf("[ERROR] Error Getting Vpn Gateway (%s): %s\n%s", gatewayID, err, response) } + if *vpngateway.(*vpcv1.VPNGateway).Mode == "policy" { - var ikePolicyIdentity, ipsecPolicyIdentity string - // new breaking changes - if establishModeOk, ok := d.GetOk("establish_mode"); ok { - vpnGatewayConnectionPrototypeModel.EstablishMode = core.StringPtr(establishModeOk.(string)) - } + vpnGatewayConnectionPrototypeModel := &vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype{ + Psk: &prephasedKey, + AdminStateUp: &stateUp, + DeadPeerDetection: &vpcv1.VPNGatewayConnectionDpdPrototype{ + Action: &action, + Interval: &interval, + Timeout: &timeout, + }, + Name: &name, + } + options := &vpcv1.CreateVPNGatewayConnectionOptions{ + VPNGatewayID: &gatewayID, + VPNGatewayConnectionPrototype: vpnGatewayConnectionPrototypeModel, + } - if localOk, ok := d.GetOk("local"); ok && len(localOk.([]interface{})) > 0 { - LocalModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionPolicyModeLocalPrototype(localOk.([]interface{})[0].(map[string]interface{})) - if err != nil { - return err + var ikePolicyIdentity, ipsecPolicyIdentity string + // new breaking changes + if establishModeOk, ok := d.GetOk("establish_mode"); ok { + vpnGatewayConnectionPrototypeModel.EstablishMode = core.StringPtr(establishModeOk.(string)) } - vpnGatewayConnectionPrototypeModel.Local = LocalModel - } else if _, ok := d.GetOk(isVPNGatewayConnectionLocalCIDRS); ok { - localCidrs := flex.ExpandStringList((d.Get(isVPNGatewayConnectionLocalCIDRS).(*schema.Set)).List()) - model := &vpcv1.VPNGatewayConnectionPolicyModeLocalPrototype{} - model.CIDRs = localCidrs - vpnGatewayConnectionPrototypeModel.Local = model - } - if peerOk, ok := d.GetOk("peer"); ok && len(peerOk.([]interface{})) > 0 { - PeerModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionPolicyModePeerPrototype(peerOk.([]interface{})[0].(map[string]interface{})) + + if localOk, ok := d.GetOk("local"); ok && len(localOk.([]interface{})) > 0 { + log.Println("[INFO] inside local block") + LocalModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionPolicyModeLocalPrototype(localOk.([]interface{})[0].(map[string]interface{})) + if err != nil { + return err + } + vpnGatewayConnectionPrototypeModel.Local = LocalModel + } else if _, ok := d.GetOk(isVPNGatewayConnectionLocalCIDRS); ok { + log.Println("[INFO] inside local cidrs block") + localCidrs := flex.ExpandStringList((d.Get(isVPNGatewayConnectionLocalCIDRS).(*schema.Set)).List()) + model := &vpcv1.VPNGatewayConnectionPolicyModeLocalPrototype{} + model.CIDRs = localCidrs + vpnGatewayConnectionPrototypeModel.Local = model + } + if peerOk, ok := d.GetOk("peer"); ok && len(peerOk.([]interface{})) > 0 { + PeerModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionPolicyModePeerPrototype(peerOk.([]interface{})[0].(map[string]interface{})) + if err != nil { + return err + } + vpnGatewayConnectionPrototypeModel.Peer = PeerModel + } else if _, ok := d.GetOk(isVPNGatewayConnectionPeerCIDRS); ok || peerAddress != "" { + model := &vpcv1.VPNGatewayConnectionPolicyModePeerPrototype{} + if ok { + peerCidrs := flex.ExpandStringList((d.Get(isVPNGatewayConnectionPeerCIDRS).(*schema.Set)).List()) + model.CIDRs = peerCidrs + } + if peerAddress != "" { + model.Address = &peerAddress + } + vpnGatewayConnectionPrototypeModel.Peer = model + } + + if ikePolicy, ok := d.GetOk(isVPNGatewayConnectionIKEPolicy); ok { + ikePolicyIdentity = ikePolicy.(string) + vpnGatewayConnectionPrototypeModel.IkePolicy = &vpcv1.VPNGatewayConnectionIkePolicyPrototype{ + ID: &ikePolicyIdentity, + } + } else { + vpnGatewayConnectionPrototypeModel.IkePolicy = nil + } + if ipsecPolicy, ok := d.GetOk(isVPNGatewayConnectionIPSECPolicy); ok { + ipsecPolicyIdentity = ipsecPolicy.(string) + vpnGatewayConnectionPrototypeModel.IpsecPolicy = &vpcv1.VPNGatewayConnectionIPsecPolicyPrototype{ + ID: &ipsecPolicyIdentity, + } + } else { + vpnGatewayConnectionPrototypeModel.IpsecPolicy = nil + } + + vpnGatewayConnectionIntf, response, err := sess.CreateVPNGatewayConnection(options) if err != nil { - return err + return fmt.Errorf("[DEBUG] Create VPN Gateway Connection err %s\n%s", err, response) } - vpnGatewayConnectionPrototypeModel.Peer = PeerModel - } else if _, ok := d.GetOk(isVPNGatewayConnectionPeerCIDRS); ok || peerAddress != "" { - model := &vpcv1.VPNGatewayConnectionPolicyModePeerPrototype{} - if ok { - peerCidrs := flex.ExpandStringList((d.Get(isVPNGatewayConnectionPeerCIDRS).(*schema.Set)).List()) - model.CIDRs = peerCidrs + if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection); ok { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection) + d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) + log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) + } else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode); ok { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode) + d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) + log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) + } else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode); ok { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode) + d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) + log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) + } else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode); ok { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) + d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) + log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) + } else { + return (fmt.Errorf("Unrecognized vpcv1.vpnGatewayConnectionIntf subtype encountered")) } - if peerAddress != "" { - model.Address = &peerAddress + } else if *vpngateway.(*vpcv1.VPNGateway).Mode == "route" { + + vpnGatewayConnectionPrototypeModel := &vpcv1.VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype{ + Psk: &prephasedKey, + AdminStateUp: &stateUp, + DeadPeerDetection: &vpcv1.VPNGatewayConnectionDpdPrototype{ + Action: &action, + Interval: &interval, + Timeout: &timeout, + }, + Name: &name, + } + options := &vpcv1.CreateVPNGatewayConnectionOptions{ + VPNGatewayID: &gatewayID, + VPNGatewayConnectionPrototype: vpnGatewayConnectionPrototypeModel, } - vpnGatewayConnectionPrototypeModel.Peer = model - } - if ikePolicy, ok := d.GetOk(isVPNGatewayConnectionIKEPolicy); ok { - ikePolicyIdentity = ikePolicy.(string) - vpnGatewayConnectionPrototypeModel.IkePolicy = &vpcv1.VPNGatewayConnectionIkePolicyPrototype{ - ID: &ikePolicyIdentity, + var ikePolicyIdentity, ipsecPolicyIdentity string + // new breaking changes + if establishModeOk, ok := d.GetOk("establish_mode"); ok { + vpnGatewayConnectionPrototypeModel.EstablishMode = core.StringPtr(establishModeOk.(string)) } - } else { - vpnGatewayConnectionPrototypeModel.IkePolicy = nil - } - if ipsecPolicy, ok := d.GetOk(isVPNGatewayConnectionIPSECPolicy); ok { - ipsecPolicyIdentity = ipsecPolicy.(string) - vpnGatewayConnectionPrototypeModel.IpsecPolicy = &vpcv1.VPNGatewayConnectionIPsecPolicyPrototype{ - ID: &ipsecPolicyIdentity, + + if localOk, ok := d.GetOk("local"); ok && len(localOk.([]interface{})) > 0 { + log.Println("[INFO] inside local block") + LocalModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionStaticRouteModeLocalPrototype(localOk.([]interface{})[0].(map[string]interface{})) + if err != nil { + return err + } + vpnGatewayConnectionPrototypeModel.Local = LocalModel + } + if peerOk, ok := d.GetOk("peer"); ok && len(peerOk.([]interface{})) > 0 { + PeerModel, err := resourceIBMIsVPNGatewayConnectionMapToVPNGatewayConnectionStaticRouteModePeerPrototype(peerOk.([]interface{})[0].(map[string]interface{})) + if err != nil { + return err + } + vpnGatewayConnectionPrototypeModel.Peer = PeerModel + } else if peerAddress != "" { + model := &vpcv1.VPNGatewayConnectionStaticRouteModePeerPrototype{} + if peerAddress != "" { + model.Address = &peerAddress + } + vpnGatewayConnectionPrototypeModel.Peer = model } - } else { - vpnGatewayConnectionPrototypeModel.IpsecPolicy = nil - } - vpnGatewayConnectionIntf, response, err := sess.CreateVPNGatewayConnection(options) - if err != nil { - return fmt.Errorf("[DEBUG] Create VPN Gateway Connection err %s\n%s", err, response) - } - if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection); ok { - vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection) - d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) - log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) - } else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode); ok { - vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode) - d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) - log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) - } else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode); ok { - vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode) - d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) - log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) - } else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode); ok { - vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) - d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) - log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) - } else { - return (fmt.Errorf("Unrecognized vpcv1.vpnGatewayConnectionIntf subtype encountered")) + if ikePolicy, ok := d.GetOk(isVPNGatewayConnectionIKEPolicy); ok { + ikePolicyIdentity = ikePolicy.(string) + vpnGatewayConnectionPrototypeModel.IkePolicy = &vpcv1.VPNGatewayConnectionIkePolicyPrototype{ + ID: &ikePolicyIdentity, + } + } else { + vpnGatewayConnectionPrototypeModel.IkePolicy = nil + } + if ipsecPolicy, ok := d.GetOk(isVPNGatewayConnectionIPSECPolicy); ok { + ipsecPolicyIdentity = ipsecPolicy.(string) + vpnGatewayConnectionPrototypeModel.IpsecPolicy = &vpcv1.VPNGatewayConnectionIPsecPolicyPrototype{ + ID: &ipsecPolicyIdentity, + } + } else { + vpnGatewayConnectionPrototypeModel.IpsecPolicy = nil + } + + vpnGatewayConnectionIntf, response, err := sess.CreateVPNGatewayConnection(options) + if err != nil { + return fmt.Errorf("[DEBUG] Create VPN Gateway Connection err %s\n%s", err, response) + } + if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection); ok { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection) + d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) + log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) + } else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode); ok { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode) + d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) + log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) + } else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode); ok { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode) + d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) + log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) + } else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode); ok { + vpnGatewayConnection := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) + d.SetId(fmt.Sprintf("%s/%s", gatewayID, *vpnGatewayConnection.ID)) + log.Printf("[INFO] VPNGatewayConnection : %s/%s", gatewayID, *vpnGatewayConnection.ID) + } else { + return (fmt.Errorf("Unrecognized vpcv1.vpnGatewayConnectionIntf subtype encountered")) + } } return nil @@ -1060,6 +1164,7 @@ func resourceIBMIsVPNGatewayConnectionVPNGatewayConnectionStaticRouteModePeerVPN func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id string, vpnGatewayConnectionIntf vpcv1.VPNGatewayConnectionIntf) error { var err error + switch reflect.TypeOf(vpnGatewayConnectionIntf).String() { case "*vpcv1.VPNGatewayConnection": { @@ -1149,10 +1254,12 @@ func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id } if vpnGatewayConnection.Tunnels != nil { - err = d.Set("tunnels", dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels)) + err = d.Set("tunnels", resourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels)) if err != nil { return fmt.Errorf("[ERROR] Error setting tunnels %s", err) } + } else { + d.Set("tunnels", []map[string]interface{}{}) } } case "*vpcv1.VPNGatewayConnectionRouteMode": @@ -1243,7 +1350,7 @@ func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id } if vpnGatewayConnection.Tunnels != nil { - err = d.Set("tunnels", dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels)) + err = d.Set("tunnels", resourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels)) if err != nil { return fmt.Errorf("[ERROR] Error setting tunnels %s", err) } @@ -1339,7 +1446,7 @@ func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id } if vpnGatewayConnection.Tunnels != nil { - err = d.Set("tunnels", dataSourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels)) + err = d.Set("tunnels", resourceVPNGatewayConnectionFlattenTunnels(vpnGatewayConnection.Tunnels)) if err != nil { return fmt.Errorf("[ERROR] Error setting tunnels %s", err) } @@ -1457,3 +1564,24 @@ func setvpnGatewayConnectionIntfResource(d *schema.ResourceData, vpn_gateway_id return nil } + +func resourceVPNGatewayConnectionFlattenTunnels(result []vpcv1.VPNGatewayConnectionStaticRouteModeTunnel) (tunnels []map[string]interface{}) { + for _, tunnelsItem := range result { + tunnels = append(tunnels, resourceVPNGatewayConnectionTunnelsToMap(tunnelsItem)) + } + + return tunnels +} + +func resourceVPNGatewayConnectionTunnelsToMap(tunnelsItem vpcv1.VPNGatewayConnectionStaticRouteModeTunnel) (tunnelsMap map[string]interface{}) { + tunnelsMap = map[string]interface{}{} + + if tunnelsItem.PublicIP != nil { + tunnelsMap["address"] = tunnelsItem.PublicIP.Address + } + if tunnelsItem.Status != nil { + tunnelsMap["status"] = tunnelsItem.Status + } + + return tunnelsMap +} From 270276442c09edb1a83c484b0b5696e6e8628ffe Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 31 May 2024 10:51:53 +0530 Subject: [PATCH 089/103] Update resource_ibm_is_vpn_gateway_connection_test.go --- ...urce_ibm_is_vpn_gateway_connection_test.go | 138 +++++++++++++++++- 1 file changed, 135 insertions(+), 3 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connection_test.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connection_test.go index 0b47210c79..9d6fc377f6 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connection_test.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connection_test.go @@ -43,9 +43,29 @@ func TestAccIBMISVPNGatewayConnection_basic(t *testing.T) { resource.TestCheckResourceAttr( "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "name", name1), resource.TestCheckResourceAttrSet( - "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "gateway_connection"), - resource.TestCheckResourceAttrSet("ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "lifecycle_state"), - resource.TestCheckResourceAttrSet("ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "health_state"), + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "action"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "admin_state_up"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "authentication_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "created_at"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "establish_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "href"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "id"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "interval"), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "mode", "route"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "preshared_key"), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "resource_type", "vpn_gateway_connection"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "status"), ), }, { @@ -54,6 +74,30 @@ func TestAccIBMISVPNGatewayConnection_basic(t *testing.T) { testAccCheckIBMISVPNGatewayConnectionExists("ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", VPNGatewayConnection), resource.TestCheckResourceAttr( "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "name", updname2), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "action"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "admin_state_up"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "authentication_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "created_at"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "establish_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "href"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "id"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "interval"), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "mode", "policy"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "preshared_key"), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "resource_type", "vpn_gateway_connection"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "status"), ), }, }, @@ -86,6 +130,28 @@ func TestAccIBMISVPNGatewayConnection_route(t *testing.T) { "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "name", name1), resource.TestCheckResourceAttr( "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "mode", "route"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "action"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "admin_state_up"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "authentication_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "created_at"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "establish_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "href"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "id"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "interval"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "preshared_key"), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "resource_type", "vpn_gateway_connection"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "status"), ), }, { @@ -96,6 +162,28 @@ func TestAccIBMISVPNGatewayConnection_route(t *testing.T) { "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "name", updname2), resource.TestCheckResourceAttr( "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "mode", "route"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "action"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "admin_state_up"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "authentication_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "created_at"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "establish_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "href"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "id"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "interval"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "preshared_key"), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "resource_type", "vpn_gateway_connection"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "status"), ), }, }, @@ -128,10 +216,54 @@ func TestAccIBMISVPNGatewayConnection_multiple(t *testing.T) { "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "name", name1), resource.TestCheckResourceAttr( "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "mode", "policy"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "action"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "admin_state_up"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "authentication_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "created_at"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "establish_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "href"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "id"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "interval"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "preshared_key"), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "resource_type", "vpn_gateway_connection"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "status"), resource.TestCheckResourceAttr( "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "name", name2), resource.TestCheckResourceAttr( "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "mode", "route"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "action"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "admin_state_up"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "authentication_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "created_at"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "establish_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "href"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "id"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "interval"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "preshared_key"), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "resource_type", "vpn_gateway_connection"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "status"), ), }, }, From feaa6c4894f7b88c4ce59e1890d80a69b144276b Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 31 May 2024 11:03:27 +0530 Subject: [PATCH 090/103] Update resource_ibm_is_vpn_gateway_connection_test.go --- ...urce_ibm_is_vpn_gateway_connection_test.go | 254 ++++++++++++++++++ 1 file changed, 254 insertions(+) diff --git a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connection_test.go b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connection_test.go index 9d6fc377f6..217704e129 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_gateway_connection_test.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_gateway_connection_test.go @@ -269,6 +269,166 @@ func TestAccIBMISVPNGatewayConnection_multiple(t *testing.T) { }, }) } +func TestAccIBMISVPNGatewayConnection_advanced(t *testing.T) { + var VPNGatewayConnection string + var VPNGatewayConnection2 string + vpcname1 := fmt.Sprintf("tfvpngc-vpc-%d", acctest.RandIntRange(100, 200)) + subnetname1 := fmt.Sprintf("tfvpngc-subnet-%d", acctest.RandIntRange(100, 200)) + vpnname1 := fmt.Sprintf("tfvpngc-vpn-%d", acctest.RandIntRange(100, 200)) + name1 := fmt.Sprintf("tfvpngc-createname-%d", acctest.RandIntRange(100, 200)) + + vpcname2 := fmt.Sprintf("tfvpngc-vpc-%d", acctest.RandIntRange(100, 200)) + subnetname2 := fmt.Sprintf("tfvpngc-subnet-%d", acctest.RandIntRange(100, 200)) + vpnname2 := fmt.Sprintf("tfvpngc-vpn-%d", acctest.RandIntRange(100, 200)) + name2 := fmt.Sprintf("tfvpngc-createname-%d", acctest.RandIntRange(100, 200)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMISVPNGatewayConnectionDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMISVPNGatewayConnectionAdvanceConfig(vpcname1, subnetname1, vpnname1, name1, vpcname2, subnetname2, vpnname2, name2), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMISVPNGatewayConnectionExists("ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", VPNGatewayConnection), + testAccCheckIBMISVPNGatewayConnectionExists("ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", VPNGatewayConnection2), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "name", name1), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "mode", "policy"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "action"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "admin_state_up"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "authentication_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "created_at"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "establish_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "href"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "id"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "interval"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "preshared_key"), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "resource_type", "vpn_gateway_connection"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "status"), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "name", name2), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "mode", "route"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "action"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "admin_state_up"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "authentication_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "created_at"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "establish_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "href"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "id"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "interval"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "preshared_key"), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "resource_type", "vpn_gateway_connection"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "status"), + ), + }, + }, + }) +} +func TestAccIBMISVPNGatewayConnection_breakingchange(t *testing.T) { + var VPNGatewayConnection string + var VPNGatewayConnection2 string + vpcname1 := fmt.Sprintf("tfvpngc-vpc-%d", acctest.RandIntRange(100, 200)) + subnetname1 := fmt.Sprintf("tfvpngc-subnet-%d", acctest.RandIntRange(100, 200)) + vpnname1 := fmt.Sprintf("tfvpngc-vpn-%d", acctest.RandIntRange(100, 200)) + name1 := fmt.Sprintf("tfvpngc-createname-%d", acctest.RandIntRange(100, 200)) + + vpcname2 := fmt.Sprintf("tfvpngc-vpc-%d", acctest.RandIntRange(100, 200)) + subnetname2 := fmt.Sprintf("tfvpngc-subnet-%d", acctest.RandIntRange(100, 200)) + vpnname2 := fmt.Sprintf("tfvpngc-vpn-%d", acctest.RandIntRange(100, 200)) + name2 := fmt.Sprintf("tfvpngc-createname-%d", acctest.RandIntRange(100, 200)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMISVPNGatewayConnectionDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMISVPNGatewayConnectionBreakingChangeConfig(vpcname1, subnetname1, vpnname1, name1, vpcname2, subnetname2, vpnname2, name2), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMISVPNGatewayConnectionExists("ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", VPNGatewayConnection), + testAccCheckIBMISVPNGatewayConnectionExists("ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", VPNGatewayConnection2), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "name", name1), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "mode", "policy"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "action"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "admin_state_up"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "authentication_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "created_at"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "establish_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "href"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "id"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "interval"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "preshared_key"), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "resource_type", "vpn_gateway_connection"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection1", "status"), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "name", name2), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "mode", "route"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "action"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "admin_state_up"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "authentication_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "created_at"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "establish_mode"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "href"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "id"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "interval"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "preshared_key"), + resource.TestCheckResourceAttr( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "resource_type", "vpn_gateway_connection"), + resource.TestCheckResourceAttrSet( + "ibm_is_vpn_gateway_connection.testacc_VPNGatewayConnection2", "status"), + ), + }, + }, + }) +} func testAccCheckIBMISVPNGatewayConnectionDestroy(s *terraform.State) error { @@ -552,6 +712,100 @@ func testAccCheckIBMISVPNGatewayConnectionMultipleConfig(vpc1, subnet1, vpnname1 } `, vpc1, subnet1, acc.ISZoneName, vpnname1, name1, vpc2, subnet2, acc.ISZoneName, vpnname2, name2) +} +func testAccCheckIBMISVPNGatewayConnectionBreakingChangeConfig(vpc1, subnet1, vpnname1, name1, vpc2, subnet2, vpnname2, name2 string) string { + return fmt.Sprintf(` + resource "ibm_is_vpc" "testacc_vpc1" { + name = "%s" + } + resource "ibm_is_subnet" "testacc_subnet1" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc1.id + zone = "%s" + total_ipv4_address_count = 64 + } + resource "ibm_is_vpn_gateway" "testacc_VPNGateway1" { + name = "%s" + subnet = ibm_is_subnet.testacc_subnet1.id + mode = "policy" + } + resource "ibm_is_vpn_gateway_connection" "testacc_VPNGatewayConnection1" { + name = "%s" + vpn_gateway = ibm_is_vpn_gateway.testacc_VPNGateway1.id + peer_cidrs = [ibm_is_subnet.testacc_subnet1.ipv4_cidr_block] + peer_address = cidrhost(ibm_is_subnet.testacc_subnet1.ipv4_cidr_block, 14) + local_cidrs = [ibm_is_subnet.testacc_subnet1.ipv4_cidr_block] + preshared_key = "VPNDemoPassword" + } + resource "ibm_is_vpc" "testacc_vpc2" { + name = "%s" + } + resource "ibm_is_subnet" "testacc_subnet2" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc2.id + zone = "%s" + total_ipv4_address_count = 64 + } + resource "ibm_is_vpn_gateway" "testacc_VPNGateway2" { + name = "%s" + subnet = ibm_is_subnet.testacc_subnet2.id + mode = "route" + } + resource "ibm_is_vpn_gateway_connection" "testacc_VPNGatewayConnection2" { + name = "%s" + vpn_gateway = ibm_is_vpn_gateway.testacc_VPNGateway2.id + peer_address = cidrhost(ibm_is_subnet.testacc_subnet2.ipv4_cidr_block, 15) + preshared_key = "VPNDemoPassword" + } + `, vpc1, subnet1, acc.ISZoneName, vpnname1, name1, vpc2, subnet2, acc.ISZoneName, vpnname2, name2) + +} +func testAccCheckIBMISVPNGatewayConnectionAdvanceConfig(vpc1, subnet1, vpnname1, name1, vpc2, subnet2, vpnname2, name2 string) string { + return fmt.Sprintf(` + resource "ibm_is_vpc" "testacc_vpc1" { + name = "%s" + } + resource "ibm_is_subnet" "testacc_subnet1" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc1.id + zone = "%s" + total_ipv4_address_count = 64 + } + resource "ibm_is_vpn_gateway" "testacc_VPNGateway1" { + name = "%s" + subnet = ibm_is_subnet.testacc_subnet1.id + mode = "policy" + } + resource "ibm_is_vpn_gateway_connection" "testacc_VPNGatewayConnection1" { + name = "%s" + vpn_gateway = ibm_is_vpn_gateway.testacc_VPNGateway1.id + peer_cidrs = [ibm_is_subnet.testacc_subnet1.ipv4_cidr_block] + peer_address = cidrhost(ibm_is_subnet.testacc_subnet1.ipv4_cidr_block, 14) + local_cidrs = [ibm_is_subnet.testacc_subnet1.ipv4_cidr_block] + preshared_key = "VPNDemoPassword" + } + resource "ibm_is_vpc" "testacc_vpc2" { + name = "%s" + } + resource "ibm_is_subnet" "testacc_subnet2" { + name = "%s" + vpc = ibm_is_vpc.testacc_vpc2.id + zone = "%s" + total_ipv4_address_count = 64 + } + resource "ibm_is_vpn_gateway" "testacc_VPNGateway2" { + name = "%s" + subnet = ibm_is_subnet.testacc_subnet2.id + mode = "route" + } + resource "ibm_is_vpn_gateway_connection" "testacc_VPNGatewayConnection2" { + name = "%s" + vpn_gateway = ibm_is_vpn_gateway.testacc_VPNGateway2.id + peer_address = cidrhost(ibm_is_subnet.testacc_subnet2.ipv4_cidr_block, 15) + preshared_key = "VPNDemoPassword" + } + `, vpc1, subnet1, acc.ISZoneName, vpnname1, name1, vpc2, subnet2, acc.ISZoneName, vpnname2, name2) + } func testAccCheckIBMISVPNGatewayConnectionRouteUpdate(vpc1, subnet1, vpnname1, name1, vpc2, subnet2, vpnname2, name2 string) string { From 6b743a9735af6a9224289d9c7fa9e757735e96af Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 4 Jul 2024 20:04:45 +0530 Subject: [PATCH 091/103] updated sdk --- common/github.com/IBM/vpc-go-sdk/go.mod | 2 +- common/github.com/IBM/vpc-go-sdk/go.sum | 20 +- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 9644 ++++++++++++----- 3 files changed, 6837 insertions(+), 2829 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/go.mod b/common/github.com/IBM/vpc-go-sdk/go.mod index 9f184baefc..b0139bdc7d 100644 --- a/common/github.com/IBM/vpc-go-sdk/go.mod +++ b/common/github.com/IBM/vpc-go-sdk/go.mod @@ -3,7 +3,7 @@ module github.com/IBM/vpc-go-sdk go 1.16 require ( - github.com/IBM/go-sdk-core/v5 v5.16.0 + github.com/IBM/go-sdk-core/v5 v5.17.3 github.com/go-openapi/strfmt v0.22.1 github.com/google/uuid v1.6.0 github.com/stretchr/testify v1.8.4 diff --git a/common/github.com/IBM/vpc-go-sdk/go.sum b/common/github.com/IBM/vpc-go-sdk/go.sum index 672e521233..cf7eb71f63 100644 --- a/common/github.com/IBM/vpc-go-sdk/go.sum +++ b/common/github.com/IBM/vpc-go-sdk/go.sum @@ -1,5 +1,5 @@ -github.com/IBM/go-sdk-core/v5 v5.16.0 h1:nbzHNBVi/kTAR+f7q0nJ8zyHs+jpRpPSNpX5EVAZOuU= -github.com/IBM/go-sdk-core/v5 v5.16.0/go.mod h1:tE4F9jLVspuWeXWwGHtAOfV6uRI8phe6x4DTsLrf2nc= +github.com/IBM/go-sdk-core/v5 v5.17.3 h1:CZSVCKzhQc/hRQZOtuEmi9dlNtWMnxJvOsPtQKP7cZ4= +github.com/IBM/go-sdk-core/v5 v5.17.3/go.mod h1:GatGZpxlo1KaxiRN6E10/rNgWtUtx1hN/GoHSCaSPKA= 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/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -26,12 +26,10 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.18.0 h1:BvolUXjp4zuvkZ5YN5t7ebzbhlUtPsPm2S9NAZ5nl9U= -github.com/go-playground/validator/v10 v10.18.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4= +github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/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/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= -github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o= -github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= 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= @@ -138,8 +136,9 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -167,8 +166,9 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -204,8 +204,9 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -218,6 +219,7 @@ golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index ef19d404f5..212523acec 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2024. + * (C) Copyright IBM Corp. 2022, 2023, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-23b7063d-20240313-161311 + * IBM OpenAPI SDK Code Generator Version: 3.91.0-d9755c53-20240605-153412 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -38,16 +38,16 @@ 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: today +// API Version: 2024-04-30 type VpcV1 struct { Service *core.BaseService // The infrastructure generation. For the API behavior documented here, specify // `2`. - generation *int64 + Generation *int64 - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2024-03-20`. + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2024-04-30` + // and `2024-07-03`. Version *string } @@ -63,8 +63,12 @@ type VpcV1Options struct { URL string Authenticator core.Authenticator - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2023-12-05` - // and `2024-03-20`. + // The infrastructure generation. For the API behavior documented here, specify + // `2`. + 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-07-03`. Version *string } @@ -129,15 +133,19 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2024-03-19") + options.Version = core.StringPtr("2024-07-02") } service = &VpcV1{ Service: baseService, - generation: core.Int64Ptr(2), + Generation: options.Generation, Version: options.Version, } + if service.Generation == nil { + service.Generation = core.Int64Ptr(2) + } + return } @@ -196,8 +204,8 @@ func (vpc *VpcV1) DisableRetries() { vpc.Service.DisableRetries() } -// ListVpcs : List all VPCs -// This request lists all VPCs in the region. A VPC is a virtual network that belongs to an account and provides logical +// ListVpcs : List VPCs +// This request lists VPCs in the region. A VPC is a virtual network that belongs to an account and provides logical // isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC // can contain resources in multiple zones in a region. func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { @@ -234,7 +242,7 @@ func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *List builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listVpcsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) } @@ -311,7 +319,7 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createVPCOptions.AddressPrefixManagement != nil { @@ -415,7 +423,7 @@ func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *De } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -478,7 +486,7 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -555,7 +563,7 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) if err != nil { @@ -634,7 +642,7 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -708,7 +716,7 @@ func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getV builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -781,7 +789,7 @@ func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, get builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -808,8 +816,8 @@ func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, get return } -// ListVPCAddressPrefixes : List all address prefixes for a VPC -// This request lists all address pool prefixes for a VPC. +// ListVPCAddressPrefixes : List address prefixes for a VPC +// This request lists address pool prefixes for a VPC. func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) err = core.RepurposeSDKProblem(err, "") @@ -853,7 +861,7 @@ func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPC builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listVPCAddressPrefixesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) } @@ -933,7 +941,7 @@ func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createV builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createVPCAddressPrefixOptions.CIDR != nil { @@ -1025,7 +1033,7 @@ func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteV } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -1089,7 +1097,7 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -1164,7 +1172,7 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateVPCAddressPrefixOptions.AddressPrefixPatch) if err != nil { @@ -1197,9 +1205,9 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV return } -// ListVPCDnsResolutionBindings : List all DNS resolution bindings for a VPC -// This request lists all DNS resolution bindings for a VPC. A DNS resolution binding represents an association with -// another VPC for centralizing DNS name resolution. +// ListVPCDnsResolutionBindings : List DNS resolution bindings for a VPC +// This request lists DNS resolution bindings for a VPC. A DNS resolution binding represents an association with another +// VPC for centralizing DNS name resolution. // // If the VPC specified by the identifier in the URL is a DNS hub VPC (has `dns.enable_hub` set to `true`) then there is // one binding for each VPC bound to the hub VPC. The endpoint gateways in the bound VPCs can allow (using @@ -1257,7 +1265,7 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listVPCDnsResolutionBindingsOptions.Sort != nil { builder.AddQuery("sort", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Sort)) } @@ -1358,7 +1366,7 @@ func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createVPCDnsResolutionBindingOptions.VPC != nil { @@ -1447,7 +1455,7 @@ func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -1520,7 +1528,7 @@ func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, get builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -1596,7 +1604,7 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) if err != nil { @@ -1629,8 +1637,8 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, return } -// ListVPCRoutes : List all routes in a VPC's default routing table -// This request lists all routes in the VPC's default routing table. Each route is zone-specific and directs any packets +// ListVPCRoutes : List routes in a VPC's default routing table +// This request lists routes in the VPC's default routing table. Each route is zone-specific and directs any packets // matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's // destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. // Deprecated: this method is deprecated and may be removed in a future release. @@ -1679,7 +1687,7 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listVPCRoutesOptions.ZoneName != nil { builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) } @@ -1766,7 +1774,7 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createVPCRouteOptions.Destination != nil { @@ -1869,7 +1877,7 @@ func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -1936,7 +1944,7 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -2014,7 +2022,7 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateVPCRouteOptions.RoutePatch) if err != nil { @@ -2047,11 +2055,11 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO return } -// ListVPCRoutingTables : List all routing tables for a VPC -// This request lists all routing tables for a VPC. Each subnet in a VPC is associated with a routing table, which -// controls delivery of packets sent on that subnet according to the action of the most specific matching route in the -// table. If multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, -// delivery will be controlled by the system's built-in routes. +// ListVPCRoutingTables : List routing tables for a VPC +// This request lists routing tables for a VPC. Each subnet in a VPC is associated with a routing table, which controls +// delivery of packets sent on that subnet according to the action of the most specific matching route in the table. If +// multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, delivery will be +// controlled by the system's built-in routes. func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) err = core.RepurposeSDKProblem(err, "") @@ -2095,7 +2103,7 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listVPCRoutingTablesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) } @@ -2178,7 +2186,7 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createVPCRoutingTableOptions.AcceptRoutesFrom != nil { @@ -2285,7 +2293,7 @@ func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVP } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -2349,7 +2357,7 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -2427,7 +2435,7 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) if err != nil { @@ -2460,8 +2468,8 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP return } -// ListVPCRoutingTableRoutes : List all routes in a VPC routing table -// This request lists all routes in a VPC routing table. If subnets are associated with this routing table, delivery of +// ListVPCRoutingTableRoutes : List routes in a VPC routing table +// This request lists routes in a VPC routing table. If subnets are associated with this routing table, delivery of // packets sent on a subnet is performed according to the action of the most specific matching route in the table // (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, the route with the // highest priority will be used. If two matching routes have the same destination and priority, traffic will be @@ -2510,7 +2518,7 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listVPCRoutingTableRoutesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) } @@ -2591,7 +2599,7 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createVPCRoutingTableRouteOptions.Destination != nil { @@ -2693,7 +2701,7 @@ func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, del } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -2758,7 +2766,7 @@ func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPC builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -2835,7 +2843,7 @@ func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, upd builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateVPCRoutingTableRouteOptions.RoutePatch) if err != nil { @@ -2868,8 +2876,8 @@ func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, upd return } -// ListSubnets : List all subnets -// This request lists all subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block +// ListSubnets : List subnets +// This request lists subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block // notation. Each subnet is within a particular zone and cannot span multiple zones or regions. func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) @@ -2905,7 +2913,7 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listSubnetsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) } @@ -3003,7 +3011,7 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createSubnetOptions.SubnetPrototype) if err != nil { @@ -3084,7 +3092,7 @@ func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptio } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -3147,7 +3155,7 @@ func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *Ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -3221,7 +3229,7 @@ func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptio builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateSubnetOptions.SubnetPatch) if err != nil { @@ -3299,7 +3307,7 @@ func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetN builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -3372,7 +3380,7 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(replaceSubnetNetworkACLOptions.NetworkACLIdentity) if err != nil { @@ -3449,7 +3457,7 @@ func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unset } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -3512,7 +3520,7 @@ func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubn builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -3586,7 +3594,7 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(setSubnetPublicGatewayOptions.PublicGatewayIdentity) if err != nil { @@ -3664,7 +3672,7 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -3740,7 +3748,7 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(replaceSubnetRoutingTableOptions.RoutingTableIdentity) if err != nil { @@ -3773,9 +3781,9 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl return } -// ListSubnetReservedIps : List all reserved IPs in a subnet -// This request lists all reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet -// which is not available for use. +// ListSubnetReservedIps : List reserved IPs in a subnet +// This request lists reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet which +// is not available for use. func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) err = core.RepurposeSDKProblem(err, "") @@ -3819,7 +3827,7 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listSubnetReservedIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) } @@ -3914,7 +3922,7 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createSubnetReservedIPOptions.Address != nil { @@ -4009,7 +4017,7 @@ func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteS } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -4073,7 +4081,7 @@ func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetR builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -4150,7 +4158,7 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateSubnetReservedIPOptions.ReservedIPPatch) if err != nil { @@ -4183,8 +4191,8 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS return } -// ListImages : List all images -// This request lists all images available in the region. An image provides source data for a volume. Images are either +// ListImages : List images +// This request lists images available in the region. An image provides source data for a volume. Images are either // system-provided, or created from another source, such as importing from Cloud Object Storage. func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListImagesWithContext(context.Background(), listImagesOptions) @@ -4220,7 +4228,7 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listImagesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) } @@ -4239,6 +4247,9 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * if listImagesOptions.Visibility != nil { builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) } + if listImagesOptions.UserDataFormat != nil { + builder.AddQuery("user_data_format", strings.Join(listImagesOptions.UserDataFormat, ",")) + } request, err := builder.Build() if err != nil { @@ -4310,7 +4321,7 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createImageOptions.ImagePrototype) if err != nil { @@ -4391,7 +4402,7 @@ func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -4454,7 +4465,7 @@ func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetI builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -4529,7 +4540,7 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateImageOptions.ImagePatch) if err != nil { @@ -4617,7 +4628,7 @@ func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -4688,7 +4699,7 @@ func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOpt } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -4706,9 +4717,9 @@ func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOpt return } -// ListImageExportJobs : List all image export jobs -// This request lists all export jobs for an image. Each job tracks the exporting of the image to another location, such -// as a bucket within cloud object storage. +// ListImageExportJobs : List export jobs for an image +// This request lists export jobs for an image. Each job tracks the exporting of the image to another location, such as +// a bucket within cloud object storage. // // The jobs will be sorted by their `created_at` property values, with newest jobs first. Jobs with identical // `created_at` property values will in turn be sorted by ascending @@ -4756,7 +4767,7 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listImageExportJobsOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listImageExportJobsOptions.Name)) } @@ -4786,7 +4797,7 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE return } -// CreateImageExportJob : Create an image export job +// CreateImageExportJob : Create an export job for an image // This request creates and queues a new export job for the image specified in the URL using the image export job // prototype object. The image must be owned by the account and be in the `available`, `deprecated`, `obsolete`, or // `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains @@ -4835,7 +4846,7 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createImageExportJobOptions.StorageBucket != nil { @@ -4925,7 +4936,7 @@ func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteIma } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -4989,7 +5000,7 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -5065,7 +5076,7 @@ func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateIma builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateImageExportJobOptions.ImageExportJobPatch) if err != nil { @@ -5098,8 +5109,8 @@ func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateIma return } -// ListOperatingSystems : List all operating systems -// This request lists all operating systems in the region. +// ListOperatingSystems : List operating systems +// This request lists operating systems in the region. func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) err = core.RepurposeSDKProblem(err, "") @@ -5134,7 +5145,7 @@ func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOpera builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listOperatingSystemsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) } @@ -5212,7 +5223,7 @@ func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatin builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -5239,9 +5250,9 @@ func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatin return } -// ListKeys : List all keys -// This request lists all keys in the region. A key contains a public SSH key which may be installed on instances when -// they are created. Private keys are not stored. +// ListKeys : List keys +// This request lists keys in the region. A key contains a public SSH key which may be installed on instances when they +// are created. Private keys are not stored. func (vpc *VpcV1) ListKeys(listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListKeysWithContext(context.Background(), listKeysOptions) err = core.RepurposeSDKProblem(err, "") @@ -5276,7 +5287,7 @@ func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *List builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listKeysOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listKeysOptions.Start)) } @@ -5353,7 +5364,7 @@ func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *Cr builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createKeyOptions.PublicKey != nil { @@ -5443,7 +5454,7 @@ func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *De } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -5506,7 +5517,7 @@ func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOp builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -5579,7 +5590,7 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateKeyOptions.KeyPatch) if err != nil { @@ -5612,7 +5623,7 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up return } -// ListInstanceProfiles : List all instance profiles +// ListInstanceProfiles : List instance profiles // This request lists provisionable [instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the // region. An instance profile specifies the performance characteristics and pricing model for an instance. func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { @@ -5649,7 +5660,7 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -5721,7 +5732,7 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -5748,8 +5759,8 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance return } -// ListInstanceTemplates : List all instance templates -// This request lists all instance templates in the region. +// ListInstanceTemplates : List instance templates +// This request lists instance templates in the region. func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) err = core.RepurposeSDKProblem(err, "") @@ -5784,7 +5795,7 @@ func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInst builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -5857,7 +5868,7 @@ func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createI builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createInstanceTemplateOptions.InstanceTemplatePrototype) if err != nil { @@ -5934,7 +5945,7 @@ func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteI } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -5997,7 +6008,7 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -6072,7 +6083,7 @@ func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateI builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateInstanceTemplateOptions.InstanceTemplatePatch) if err != nil { @@ -6105,8 +6116,8 @@ func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateI return } -// ListInstances : List all instances -// This request lists all instances in the region. +// ListInstances : List instances +// This request lists instances in the region. func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) err = core.RepurposeSDKProblem(err, "") @@ -6141,7 +6152,7 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listInstancesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) } @@ -6154,15 +6165,6 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt if listInstancesOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) } - if listInstancesOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) - } - if listInstancesOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) - } - if listInstancesOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) - } if listInstancesOptions.DedicatedHostID != nil { builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) } @@ -6190,6 +6192,15 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt if listInstancesOptions.ReservationName != nil { builder.AddQuery("reservation.name", fmt.Sprint(*listInstancesOptions.ReservationName)) } + if listInstancesOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) + } + if listInstancesOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) + } + if listInstancesOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) + } request, err := builder.Build() if err != nil { @@ -6260,7 +6271,7 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createInstanceOptions.InstancePrototype) if err != nil { @@ -6344,7 +6355,7 @@ func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -6407,7 +6418,7 @@ func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -6484,7 +6495,7 @@ func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) if err != nil { @@ -6563,7 +6574,7 @@ func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getI builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -6637,7 +6648,7 @@ func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createIns builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createInstanceActionOptions.Type != nil { @@ -6726,7 +6737,7 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createInstanceConsoleAccessTokenOptions.ConsoleType != nil { @@ -6766,8 +6777,8 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex return } -// ListInstanceDisks : List all disks on an instance -// This request lists all disks on an instance. A disk is a block device that is locally attached to the instance's +// ListInstanceDisks : List disks on an instance +// This request lists disks on an instance. A disk is a block device that is locally attached to the instance's // physical host and is also referred to as instance storage. By default, the listed disks are sorted by their // `created_at` property values, with the newest disk first. func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { @@ -6813,7 +6824,7 @@ func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstance builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -6886,7 +6897,7 @@ func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDis builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -6960,7 +6971,7 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateInstanceDiskOptions.InstanceDiskPatch) if err != nil { @@ -6993,9 +7004,9 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta return } -// ListInstanceNetworkAttachments : List all network attachments on an instance -// This request lists all network attachments on an instance. A network attachment represents a device on the instance -// to which a virtual network interface is attached. +// ListInstanceNetworkAttachments : List network attachments on an instance +// This request lists network attachments on an instance. A network attachment represents a device on the instance to +// which a virtual network interface is attached. // // The network attachments will be sorted by their `created_at` property values, with newest network attachments first. // Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property @@ -7043,7 +7054,7 @@ func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -7118,7 +7129,7 @@ func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createInstanceNetworkAttachmentOptions.VirtualNetworkInterface != nil { @@ -7206,7 +7217,7 @@ func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -7270,7 +7281,7 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -7346,7 +7357,7 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) if err != nil { @@ -7379,11 +7390,11 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context return } -// ListInstanceNetworkInterfaces : List all network interfaces on an instance -// This request lists all network interfaces on an instance. An instance network interface is an abstract representation -// of a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to -// any subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on -// the instance may also attach to the same subnet. +// ListInstanceNetworkInterfaces : List network interfaces on an instance +// This request lists network interfaces on an instance. An instance network interface is an abstract representation of +// a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to any +// subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on the +// instance may also attach to the same subnet. // // If this instance has network attachments, each returned 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 @@ -7431,7 +7442,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -7511,7 +7522,7 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createInstanceNetworkInterfaceOptions.Subnet != nil { @@ -7612,7 +7623,7 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -7680,7 +7691,7 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -7760,7 +7771,7 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) if err != nil { @@ -7793,8 +7804,8 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, return } -// ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with an instance network interface -// This request lists all floating IPs associated with an instance network interface. +// ListInstanceNetworkInterfaceFloatingIps : List floating IPs associated with an instance network interface +// This request lists floating IPs associated with an instance network interface. func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) err = core.RepurposeSDKProblem(err, "") @@ -7839,7 +7850,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -7912,7 +7923,7 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -7978,7 +7989,7 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -8059,7 +8070,7 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -8135,7 +8146,7 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listInstanceNetworkInterfaceIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Start)) } @@ -8218,7 +8229,7 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -8245,8 +8256,8 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, return } -// ListInstanceVolumeAttachments : List all volumes attachments on an instance -// This request lists all volume attachments on an instance. A volume attachment connects a volume to an instance. Each +// ListInstanceVolumeAttachments : List volumes attachments on an instance +// This request lists volume attachments on an instance. A volume attachment connects a volume to an instance. Each // instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one // volume. func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { @@ -8292,7 +8303,7 @@ func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -8368,7 +8379,7 @@ func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createInstanceVolumeAttachmentOptions.Volume != nil { @@ -8457,7 +8468,7 @@ func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -8521,7 +8532,7 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -8597,7 +8608,7 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) if err != nil { @@ -8630,8 +8641,8 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, return } -// ListInstanceGroups : List all instance groups -// This request lists all instance groups in the region. +// ListInstanceGroups : List instance groups +// This request lists instance groups in the region. func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) err = core.RepurposeSDKProblem(err, "") @@ -8666,7 +8677,7 @@ func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanc builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listInstanceGroupsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) } @@ -8741,7 +8752,7 @@ func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInst builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createInstanceGroupOptions.InstanceTemplate != nil { @@ -8844,7 +8855,7 @@ func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInst } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -8907,7 +8918,7 @@ func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGr builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -8981,7 +8992,7 @@ func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInst builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupOptions.InstanceGroupPatch) if err != nil { @@ -9058,7 +9069,7 @@ func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -9076,8 +9087,8 @@ func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context return } -// ListInstanceGroupManagers : List all managers for an instance group -// This request lists all managers for an instance group. +// ListInstanceGroupManagers : List managers for an instance group +// This request lists managers for an instance group. func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) err = core.RepurposeSDKProblem(err, "") @@ -9121,7 +9132,7 @@ func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listInstanceGroupManagersOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) } @@ -9200,7 +9211,7 @@ func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, cre builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) if err != nil { @@ -9278,7 +9289,7 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, del } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -9342,7 +9353,7 @@ func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getIns builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -9416,7 +9427,7 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, upd builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) if err != nil { @@ -9449,8 +9460,8 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, upd return } -// ListInstanceGroupManagerActions : List all actions for an instance group manager -// This request lists all instance group actions for an instance group manager. +// ListInstanceGroupManagerActions : List actions for an instance group manager +// This request lists instance group actions for an instance group manager. func (vpc *VpcV1) ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) err = core.RepurposeSDKProblem(err, "") @@ -9495,7 +9506,7 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listInstanceGroupManagerActionsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) } @@ -9575,7 +9586,7 @@ func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) if err != nil { @@ -9654,7 +9665,7 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -9719,7 +9730,7 @@ func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -9794,7 +9805,7 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) if err != nil { @@ -9827,8 +9838,8 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Contex return } -// ListInstanceGroupManagerPolicies : List all policies for an instance group manager -// This request lists all policies for an instance group manager. +// ListInstanceGroupManagerPolicies : List policies for an instance group manager +// This request lists policies for an instance group manager. func (vpc *VpcV1) ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) err = core.RepurposeSDKProblem(err, "") @@ -9873,7 +9884,7 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listInstanceGroupManagerPoliciesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Start)) } @@ -9953,7 +9964,7 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) if err != nil { @@ -10032,7 +10043,7 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -10097,7 +10108,7 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -10172,7 +10183,7 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) if err != nil { @@ -10205,9 +10216,9 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex return } -// DeleteInstanceGroupMemberships : Delete all memberships from an instance group -// This request deletes all memberships of an instance group. This operation cannot be reversed. reversed. Any -// memberships that have `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. +// DeleteInstanceGroupMemberships : Delete memberships from an instance group +// This request deletes memberships of an instance group. This operation cannot be reversed. Memberships that have +// `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { response, err = vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) err = core.RepurposeSDKProblem(err, "") @@ -10250,7 +10261,7 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -10268,8 +10279,8 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, return } -// ListInstanceGroupMemberships : List all memberships for an instance group -// This request lists all instance group memberships for an instance group. +// ListInstanceGroupMemberships : List memberships for an instance group +// This request lists instance group memberships for an instance group. func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) err = core.RepurposeSDKProblem(err, "") @@ -10313,7 +10324,7 @@ func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, l builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listInstanceGroupMembershipsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) } @@ -10392,7 +10403,7 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -10456,7 +10467,7 @@ func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, get builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -10530,7 +10541,7 @@ func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateInstanceGroupMembershipOptions.InstanceGroupMembershipPatch) if err != nil { @@ -10563,9 +10574,9 @@ func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, return } -// ListReservations : List all reservations -// This request lists all reservations in the region. A reservation provides reserved capacity for a specified profile -// in a specified zone. A reservation can also include a long-term committed use discount. +// ListReservations : List reservations +// This request lists reservations in the region. A reservation provides reserved capacity for a specified profile in a +// specified zone. A reservation can also include a long-term committed use discount. // // The reservations will be sorted by their `created_at` property values, with newest reservations first. Reservations // with identical `created_at` property values will in turn be sorted by ascending `name` property values. @@ -10603,7 +10614,7 @@ func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservati builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listReservationsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listReservationsOptions.Start)) } @@ -10688,7 +10699,7 @@ func (vpc *VpcV1) CreateReservationWithContext(ctx context.Context, createReserv builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createReservationOptions.Capacity != nil { @@ -10789,7 +10800,7 @@ func (vpc *VpcV1) DeleteReservationWithContext(ctx context.Context, deleteReserv builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -10861,7 +10872,7 @@ func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationO builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -10935,7 +10946,7 @@ func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReserv builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateReservationOptions.ReservationPatch) if err != nil { @@ -11012,7 +11023,7 @@ func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateRe } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -11030,9 +11041,9 @@ func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateRe return } -// ListDedicatedHostGroups : List all dedicated host groups -// This request lists all dedicated host groups in the region. Host groups are a collection of dedicated hosts for -// placement of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. +// ListDedicatedHostGroups : List dedicated host groups +// This request lists dedicated host groups in the region. Host groups are a collection of dedicated hosts for placement +// of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) err = core.RepurposeSDKProblem(err, "") @@ -11067,7 +11078,7 @@ func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDe builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listDedicatedHostGroupsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) } @@ -11151,7 +11162,7 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createDedicatedHostGroupOptions.Class != nil { @@ -11244,7 +11255,7 @@ func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, delet } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -11307,7 +11318,7 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -11382,7 +11393,7 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) if err != nil { @@ -11415,7 +11426,7 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat return } -// ListDedicatedHostProfiles : List all dedicated host profiles +// ListDedicatedHostProfiles : List dedicated host profiles // This request lists provisionable [dedicated host profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in // the region. A dedicated host profile specifies the hardware characteristics for a dedicated host. func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { @@ -11452,7 +11463,7 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listDedicatedHostProfilesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) } @@ -11530,7 +11541,7 @@ func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDed builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -11557,8 +11568,8 @@ func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDed return } -// ListDedicatedHosts : List all dedicated hosts -// This request lists all dedicated hosts in the region. +// ListDedicatedHosts : List dedicated hosts +// This request lists dedicated hosts in the region. func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) err = core.RepurposeSDKProblem(err, "") @@ -11593,7 +11604,7 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listDedicatedHostsOptions.DedicatedHostGroupID != nil { builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) } @@ -11680,7 +11691,7 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createDedicatedHostOptions.DedicatedHostPrototype) if err != nil { @@ -11713,9 +11724,9 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi return } -// ListDedicatedHostDisks : List all disks on a dedicated host -// This request lists all disks on a dedicated host. A disk is a physical device that is locally attached to the -// compute node. By default, the listed disks are sorted by their +// ListDedicatedHostDisks : List disks on a dedicated host +// This request lists disks on a dedicated host. A disk is a physical device that is locally attached to the compute +// node. By default, the listed disks are sorted by their // `created_at` property values, with the newest disk first. func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) @@ -11760,7 +11771,7 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -11833,7 +11844,7 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -11907,7 +11918,7 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) if err != nil { @@ -11984,7 +11995,7 @@ func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedi } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -12047,7 +12058,7 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -12122,7 +12133,7 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateDedicatedHostOptions.DedicatedHostPatch) if err != nil { @@ -12155,8 +12166,8 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi return } -// ListPlacementGroups : List all placement groups -// This request lists all placement groups in the region. +// ListPlacementGroups : List placement groups +// This request lists placement groups in the region. func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) err = core.RepurposeSDKProblem(err, "") @@ -12191,7 +12202,7 @@ func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacem builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listPlacementGroupsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) } @@ -12266,7 +12277,7 @@ func (vpc *VpcV1) CreatePlacementGroupWithContext(ctx context.Context, createPla builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createPlacementGroupOptions.Strategy != nil { @@ -12354,7 +12365,7 @@ func (vpc *VpcV1) DeletePlacementGroupWithContext(ctx context.Context, deletePla } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -12417,7 +12428,7 @@ func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacement builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -12491,7 +12502,7 @@ func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePla builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updatePlacementGroupOptions.PlacementGroupPatch) if err != nil { @@ -12524,10 +12535,10 @@ func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePla return } -// ListBareMetalServerProfiles : List all bare metal server profiles -// This request lists all [bare metal server -// profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) available in the region. A bare metal -// server profile specifies the performance characteristics and pricing model for a bare metal server. +// ListBareMetalServerProfiles : List bare metal server profiles +// This request lists [bare metal server profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) +// available in the region. A bare metal server profile specifies the performance characteristics and pricing model for +// a bare metal server. func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) err = core.RepurposeSDKProblem(err, "") @@ -12562,7 +12573,7 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listBareMetalServerProfilesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) } @@ -12640,7 +12651,7 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -12667,8 +12678,8 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB return } -// ListBareMetalServers : List all bare metal servers -// This request lists all bare metal servers in the region. +// ListBareMetalServers : List bare metal servers +// This request lists bare metal servers in the region. func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) err = core.RepurposeSDKProblem(err, "") @@ -12703,7 +12714,7 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listBareMetalServersOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) } @@ -12795,7 +12806,7 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createBareMetalServerOptions.BareMetalServerPrototype) if err != nil { @@ -12832,7 +12843,8 @@ func (vpc *VpcV1) CreateBareMetalServerWithContext(ctx context.Context, createBa // This request creates a new single-use console access token for a bare metal server. All console configuration is // provided at token create time, and the token is subsequently used in the `access_token` query parameter for the // WebSocket request. The access token is only valid for a short period of time, and a maximum of one token is valid -// for a given bare metal server at a time. +// for a given bare metal server at a time. For this request to succeed, the server must have a `status` of `stopped`, +// `starting`, or `running`. func (vpc *VpcV1) CreateBareMetalServerConsoleAccessToken(createBareMetalServerConsoleAccessTokenOptions *CreateBareMetalServerConsoleAccessTokenOptions) (result *BareMetalServerConsoleAccessToken, response *core.DetailedResponse, err error) { result, response, err = vpc.CreateBareMetalServerConsoleAccessTokenWithContext(context.Background(), createBareMetalServerConsoleAccessTokenOptions) err = core.RepurposeSDKProblem(err, "") @@ -12877,7 +12889,7 @@ func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createBareMetalServerConsoleAccessTokenOptions.ConsoleType != nil { @@ -12917,10 +12929,9 @@ func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context return } -// ListBareMetalServerDisks : List all disks on a bare metal server -// This request lists all disks on a bare metal server. A disk is a block device that is locally attached to the -// physical server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk -// first. +// ListBareMetalServerDisks : List disks on a bare metal server +// This request lists disks on a bare metal server. A disk is a block device that is locally attached to the physical +// server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk first. func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) err = core.RepurposeSDKProblem(err, "") @@ -12964,7 +12975,7 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -13037,7 +13048,7 @@ func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBare builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -13111,7 +13122,7 @@ func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, upda builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) if err != nil { @@ -13144,11 +13155,11 @@ func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, upda return } -// ListBareMetalServerNetworkAttachments : List all network attachments on a bare metal server -// This request lists all network attachments on a bare metal server. A bare metal server network attachment is an -// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network -// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to -// the bare metal server. +// ListBareMetalServerNetworkAttachments : List network attachments on a bare metal server +// This request lists network attachments on a bare metal server. A bare metal server network attachment is an abstract +// representation of a network device and attaches a bare metal server to a single subnet. Each network interface on a +// bare metal server can attach to any subnet in the zone, including subnets that are already attached to the bare metal +// server. // // The network attachments will be sorted by their `created_at` property values, with newest network attachments first. // Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property @@ -13196,7 +13207,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.C builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listBareMetalServerNetworkAttachmentsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) } @@ -13277,7 +13288,7 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context. builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) if err != nil { @@ -13358,7 +13369,7 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context. } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -13422,7 +13433,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Con builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -13498,7 +13509,7 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) if err != nil { @@ -13531,11 +13542,11 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. return } -// ListBareMetalServerNetworkInterfaces : List all network interfaces on a bare metal server -// This request lists all network interfaces on a bare metal server. A bare metal server network interface is an -// abstract representation of a network device and attaches a bare metal server to a single subnet. Each network -// interface on a bare metal server can attach to any subnet in the zone, including subnets that are already attached to -// the bare metal server. +// ListBareMetalServerNetworkInterfaces : List network interfaces on a bare metal server +// This request lists network interfaces on a bare metal server. A bare metal server network interface is an abstract +// representation of a network device and attaches a bare metal server to a single subnet. Each network interface on a +// bare metal server can attach to any subnet in the zone, including subnets that are already attached to the bare metal +// server. // // If this bare metal server has network attachments, each returned 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 @@ -13583,7 +13594,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listBareMetalServerNetworkInterfacesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) } @@ -13670,7 +13681,7 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) if err != nil { @@ -13754,7 +13765,7 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.C } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -13822,7 +13833,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -13902,7 +13913,7 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) if err != nil { @@ -13935,8 +13946,8 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// ListBareMetalServerNetworkInterfaceFloatingIps : List all floating IPs associated with a bare metal server network interface -// This request lists all floating IPs associated with a bare metal server network interface. +// ListBareMetalServerNetworkInterfaceFloatingIps : List floating IPs associated with a bare metal server network interface +// This request lists floating IPs associated with a bare metal server network interface. func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) err = core.RepurposeSDKProblem(err, "") @@ -13981,7 +13992,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -14054,7 +14065,7 @@ func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -14120,7 +14131,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -14202,7 +14213,7 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -14278,7 +14289,7 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -14355,7 +14366,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -14427,7 +14438,7 @@ func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBa } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -14490,7 +14501,7 @@ func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMeta builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -14564,7 +14575,7 @@ func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBa builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateBareMetalServerOptions.BareMetalServerPatch) if err != nil { @@ -14644,7 +14655,7 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -14672,7 +14683,8 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex } // RestartBareMetalServer : Restart a bare metal server -// This request restarts a bare metal server. It will run immediately regardless of the state of the server. +// This request immediately restarts a bare metal server. For this request to succeed, the server must have a `status` +// of `running`. func (vpc *VpcV1) RestartBareMetalServer(restartBareMetalServerOptions *RestartBareMetalServerOptions) (response *core.DetailedResponse, err error) { response, err = vpc.RestartBareMetalServerWithContext(context.Background(), restartBareMetalServerOptions) err = core.RepurposeSDKProblem(err, "") @@ -14715,7 +14727,7 @@ func (vpc *VpcV1) RestartBareMetalServerWithContext(ctx context.Context, restart } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -14777,7 +14789,7 @@ func (vpc *VpcV1) StartBareMetalServerWithContext(ctx context.Context, startBare } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -14841,7 +14853,7 @@ func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMe builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if stopBareMetalServerOptions.Type != nil { @@ -14869,9 +14881,9 @@ func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMe return } -// ListVolumeProfiles : List all volume profiles -// This request lists all [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available -// in the region. A volume profile specifies the performance characteristics and pricing model for a volume. +// ListVolumeProfiles : List volume profiles +// This request lists [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available in +// the region. A volume profile specifies the performance characteristics and pricing model for a volume. func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) err = core.RepurposeSDKProblem(err, "") @@ -14906,7 +14918,7 @@ func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeP builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listVolumeProfilesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) } @@ -14984,7 +14996,7 @@ func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProf builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -15011,9 +15023,9 @@ func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProf return } -// ListVolumes : List all volumes -// This request lists all volumes in the region. Volumes are network-connected block storage devices that may be -// attached to one or more instances in the same region. +// ListVolumes : List volumes +// This request lists volumes in the region. Volumes are network-connected block storage devices that may be attached to +// one or more instances in the same region. func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) err = core.RepurposeSDKProblem(err, "") @@ -15048,7 +15060,7 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listVolumesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) } @@ -15145,7 +15157,7 @@ func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptio builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createVolumeOptions.VolumePrototype) if err != nil { @@ -15226,7 +15238,7 @@ func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptio } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -15289,7 +15301,7 @@ func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *Ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -15366,7 +15378,7 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) if err != nil { @@ -15399,8 +15411,8 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio return } -// ListSnapshotConsistencyGroups : List all snapshot consistency groups -// This request lists all snapshot consistency groups in the region. A snapshot consistency group is a collection of +// ListSnapshotConsistencyGroups : List snapshot consistency groups +// This request lists snapshot consistency groups in the region. A snapshot consistency group is a collection of // individual snapshots taken at the same time. func (vpc *VpcV1) ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions) @@ -15436,7 +15448,7 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listSnapshotConsistencyGroupsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Start)) } @@ -15525,7 +15537,7 @@ func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) if err != nil { @@ -15604,7 +15616,7 @@ func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -15676,7 +15688,7 @@ func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -15754,7 +15766,7 @@ func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch) if err != nil { @@ -15788,7 +15800,7 @@ func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, } // DeleteSnapshots : Delete a filtered collection of snapshots -// This request deletes all snapshots created from a specific source volume. +// This request deletes snapshots that match the specified filter. This operation cannot be reversed. func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { response, err = vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) err = core.RepurposeSDKProblem(err, "") @@ -15827,7 +15839,7 @@ func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshot } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) request, err := builder.Build() @@ -15846,8 +15858,8 @@ func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshot return } -// ListSnapshots : List all snapshots -// This request lists all snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is +// ListSnapshots : List snapshots +// This request lists snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is // created. func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) @@ -15883,7 +15895,7 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listSnapshotsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) } @@ -16019,7 +16031,7 @@ func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotO builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createSnapshotOptions.SnapshotPrototype) if err != nil { @@ -16099,7 +16111,7 @@ func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -16162,7 +16174,7 @@ func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -16239,7 +16251,7 @@ func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotO } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) if err != nil { @@ -16272,8 +16284,8 @@ func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotO return } -// ListSnapshotClones : List all clones for a snapshot -// This request lists all clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. +// ListSnapshotClones : List clones for a snapshot +// This request lists clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) err = core.RepurposeSDKProblem(err, "") @@ -16317,7 +16329,7 @@ func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapsho builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -16390,7 +16402,7 @@ func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnap } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -16454,7 +16466,7 @@ func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCl builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -16528,7 +16540,7 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -16555,10 +16567,9 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap return } -// ListShareProfiles : List all file share profiles -// This request lists all [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) -// available in the region. A file share profile specifies the performance characteristics and pricing model for a file -// share. +// ListShareProfiles : List file share profiles +// This request lists [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) available in +// the region. A file share profile specifies the performance characteristics and pricing model for a file share. func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) err = core.RepurposeSDKProblem(err, "") @@ -16593,7 +16604,7 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listShareProfilesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) } @@ -16674,7 +16685,7 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -16701,8 +16712,8 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil return } -// ListShares : List all file shares -// This request lists all file shares in the region. +// ListShares : List file shares +// This request lists file shares in the region. func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListSharesWithContext(context.Background(), listSharesOptions) err = core.RepurposeSDKProblem(err, "") @@ -16737,7 +16748,7 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listSharesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) } @@ -16828,7 +16839,7 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createShareOptions.SharePrototype) if err != nil { @@ -16915,7 +16926,7 @@ func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -16987,7 +16998,7 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -17064,7 +17075,7 @@ func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) if err != nil { @@ -17097,145 +17108,60 @@ func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions return } -// FailoverShare : Failover to replica file share -// This request triggers a failover to the replica file share specified by the identifier in the URL. The failover -// cannot be started if a source share or the replica share has a `lifecycle_state` of `updating`, or has a replication -// operation in progress. -// -// If `fallback_policy` is specified as `split`, and the request is accepted but the failover operation cannot be -// performed, a split will be triggered. -func (vpc *VpcV1) FailoverShare(failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.FailoverShareWithContext(context.Background(), failoverShareOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// FailoverShareWithContext is an alternate form of the FailoverShare method which supports a Context parameter -func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(failoverShareOptions, "failoverShareOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(failoverShareOptions, "failoverShareOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "share_id": *failoverShareOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/failover`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range failoverShareOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare") - 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 failoverShareOptions.FallbackPolicy != nil { - body["fallback_policy"] = failoverShareOptions.FallbackPolicy - } - if failoverShareOptions.Timeout != nil { - body["timeout"] = failoverShareOptions.Timeout - } - _, 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, "failover_share", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// ListShareMountTargets : List all mount targets for a file share -// This request retrieves all share mount targets for a file share. A share mount target is a network endpoint at which -// a file share may be mounted. The file share can be mounted by clients in the same VPC and zone after creating share -// mount targets. +// ListShareAccessorBindings : List accessor bindings for a share +// This request lists accessor bindings for a share. Each accessor binding identifies a resource (possibly in another +// account) with access to this file share's data. // -// The share mount targets will be sorted by their `created_at` property values, with newest targets first. -func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) +// The share accessor bindings will be sorted by their `created_at` property values, with newest bindings first. +func (vpc *VpcV1) ListShareAccessorBindings(listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) (result *ShareAccessorBindingCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListShareAccessorBindingsWithContext(context.Background(), listShareAccessorBindingsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter -func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") +// ListShareAccessorBindingsWithContext is an alternate form of the ListShareAccessorBindings method which supports a Context parameter +func (vpc *VpcV1) ListShareAccessorBindingsWithContext(ctx context.Context, listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) (result *ShareAccessorBindingCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") + err = core.ValidateStruct(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *listShareMountTargetsOptions.ShareID, + "id": *listShareAccessorBindingsOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}/accessor_bindings`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listShareMountTargetsOptions.Headers { + for headerName, headerValue := range listShareAccessorBindingsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareAccessorBindings") 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 listShareMountTargetsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listShareAccessorBindingsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareAccessorBindingsOptions.Start)) } - if listShareMountTargetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) - } - if listShareMountTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) + if listShareAccessorBindingsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareAccessorBindingsOptions.Limit)) } request, err := builder.Build() @@ -17247,12 +17173,12 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_share_mount_targets", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_share_accessor_bindings", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareAccessorBindingCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17263,138 +17189,52 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar return } -// CreateShareMountTarget : Create a mount target for a file share -// This request creates a new share mount target from a share mount target prototype object. -// -// The prototype object is structured in the same way as a retrieved share mount target, and contains the information -// necessary to provision the new file share mount target. -func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) +// DeleteShareAccessorBinding : Delete a share accessor binding +// This request deletes a share accessor binding. This operation cannot be reversed. +func (vpc *VpcV1) DeleteShareAccessorBinding(deleteShareAccessorBindingOptions *DeleteShareAccessorBindingOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteShareAccessorBindingWithContext(context.Background(), deleteShareAccessorBindingOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") +// DeleteShareAccessorBindingWithContext is an alternate form of the DeleteShareAccessorBinding method which supports a Context parameter +func (vpc *VpcV1) DeleteShareAccessorBindingWithContext(ctx context.Context, deleteShareAccessorBindingOptions *DeleteShareAccessorBindingOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareAccessorBindingOptions, "deleteShareAccessorBindingOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") + err = core.ValidateStruct(deleteShareAccessorBindingOptions, "deleteShareAccessorBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *createShareMountTargetOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createShareMountTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") - 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(createShareMountTargetOptions.ShareMountTargetPrototype) - 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_share_mount_target", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteShareMountTarget : Delete a share mount target -// This request deletes a share mount target. This operation cannot be reversed. -// -// If the request is accepted, the share mount target `lifecycle_state` will be set to -// `deleting`. Once deletion processing completes, it will no longer be retrievable. -func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "share_id": *deleteShareMountTargetOptions.ShareID, - "id": *deleteShareMountTargetOptions.ID, + "share_id": *deleteShareAccessorBindingOptions.ShareID, + "id": *deleteShareAccessorBindingOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/accessor_bindings/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteShareMountTargetOptions.Headers { + for headerName, headerValue := range deleteShareAccessorBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareAccessorBinding") 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)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -17402,72 +17242,63 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS 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, "delete_share_mount_target", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_share_accessor_binding", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetShareMountTarget : Retrieve a share mount target -// This request retrieves a single share mount target specified by the identifier in the URL. -func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) +// GetShareAccessorBinding : Retrieve a share accessor binding +// This request retrieves a single accessor binding specified by the identifier in the URL. +func (vpc *VpcV1) GetShareAccessorBinding(getShareAccessorBindingOptions *GetShareAccessorBindingOptions) (result *ShareAccessorBinding, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareAccessorBindingWithContext(context.Background(), getShareAccessorBindingOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") +// GetShareAccessorBindingWithContext is an alternate form of the GetShareAccessorBinding method which supports a Context parameter +func (vpc *VpcV1) GetShareAccessorBindingWithContext(ctx context.Context, getShareAccessorBindingOptions *GetShareAccessorBindingOptions) (result *ShareAccessorBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareAccessorBindingOptions, "getShareAccessorBindingOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") + err = core.ValidateStruct(getShareAccessorBindingOptions, "getShareAccessorBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *getShareMountTargetOptions.ShareID, - "id": *getShareMountTargetOptions.ID, + "share_id": *getShareAccessorBindingOptions.ShareID, + "id": *getShareAccessorBindingOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/accessor_bindings/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareMountTargetOptions.Headers { + for headerName, headerValue := range getShareAccessorBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareAccessorBinding") 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)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -17478,12 +17309,12 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_share_mount_target", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_share_accessor_binding", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareAccessorBinding) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17494,600 +17325,144 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo return } -// UpdateShareMountTarget : Update a share mount target -// This request updates a share mount target with the information provided in a share mount target patch object. The -// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain -// only the information to be updated. -func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "share_id": *updateShareMountTargetOptions.ShareID, - "id": *updateShareMountTargetOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateShareMountTargetOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") - 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(updateShareMountTargetOptions.ShareMountTargetPatch) - 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_share_mount_target", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// DeleteShareSource : Split the source file share from a replica share -// This request removes the replication relationship between a source share and the replica share specified by the -// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a -// `lifecycle_state` of `updating`, or has a replication operation in progress. +// FailoverShare : Failover to replica file share +// This request triggers a failover to the replica file share specified by the identifier in the URL. The failover +// cannot be started if a source share or the replica share has a `lifecycle_state` of `updating`, or has a replication +// operation in progress. // -// This operation cannot be reversed. -func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter -func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "share_id": *deleteShareSourceOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteShareSourceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") - 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_share_source", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetShareSource : Retrieve the source file share for a replica file share -// This request retrieves the source file share associated with the replica file share specified by the identifier in -// the URL. -func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) +// If `fallback_policy` is specified as `split`, and the request is accepted but the failover operation cannot be +// performed, a split will be triggered. +func (vpc *VpcV1) FailoverShare(failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.FailoverShareWithContext(context.Background(), failoverShareOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter -func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") +// FailoverShareWithContext is an alternate form of the FailoverShare method which supports a Context parameter +func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOptions *FailoverShareOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(failoverShareOptions, "failoverShareOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") + err = core.ValidateStruct(failoverShareOptions, "failoverShareOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *getShareSourceOptions.ShareID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getShareSourceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") - 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_share_source", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBackupPolicies : List all backup policies -// This request lists all backup policies in the region. Backup policies control which sources are selected for backup -// and include a set of backup policy plans that provide the backup schedules and deletion triggers. -func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter -func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") - 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, `/backup_policies`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listBackupPoliciesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") - 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 listBackupPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) - } - if listBackupPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) - } - if listBackupPoliciesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) - } - if listBackupPoliciesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) - } - if listBackupPoliciesOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) - } - - 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_backup_policies", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateBackupPolicy : Create a backup policy -// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in -// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. -func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return + "share_id": *failoverShareOptions.ShareID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/failover`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBackupPolicyOptions.Headers { + for headerName, headerValue := range failoverShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "FailoverShare") 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(createBackupPolicyOptions.BackupPolicyPrototype) - 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_backup_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBackupPolicyJobs : List all jobs for a backup policy -// This request retrieves all jobs for a backup policy. A backup job represents the execution of a backup policy plan -// for a resource matching the policy's criteria. -func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) -// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter -func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return + body := make(map[string]interface{}) + if failoverShareOptions.FallbackPolicy != nil { + body["fallback_policy"] = failoverShareOptions.FallbackPolicy } - - pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, + if failoverShareOptions.Timeout != nil { + body["timeout"] = failoverShareOptions.Timeout } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) + _, err = builder.SetBodyContentJSON(body) 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 listBackupPolicyJobsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") - 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 listBackupPolicyJobsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) - } - if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) - } - if listBackupPolicyJobsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) - } - if listBackupPolicyJobsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) - } - if listBackupPolicyJobsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) - } - if listBackupPolicyJobsOptions.SourceID != nil { - builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) - } - if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { - builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) - } - if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { - builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) - } - 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, "list_backup_policy_jobs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "failover_share", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetBackupPolicyJob : Retrieve a backup policy job -// This request retrieves a single backup policy job specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) +// ListShareMountTargets : List mount targets for a file share +// This request lists mount targets for a file share. A mount target is a network endpoint at which a file share may be +// mounted. The file share can be mounted by clients in the same VPC and zone after creating share mount targets. +// +// The share mount targets will be sorted by their `created_at` property values, with newest targets first. +func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") +// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter +func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") + err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, - "id": *getBackupPolicyJobOptions.ID, + "share_id": *listShareMountTargetsOptions.ShareID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBackupPolicyJobOptions.Headers { + for headerName, headerValue := range listShareMountTargetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") 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_backup_policy_job", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBackupPolicyPlans : List all plans for a backup policy -// This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. -func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter -func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { - builder.AddHeader(headerName, headerValue) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listShareMountTargetsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) + if listShareMountTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listBackupPolicyPlansOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) + if listShareMountTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) } request, err := builder.Build() @@ -18099,12 +17474,12 @@ func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBack var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_backup_policy_plans", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_share_mount_targets", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18115,52 +17490,48 @@ func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBack return } -// CreateBackupPolicyPlan : Create a plan for a backup policy -// This request creates a new backup policy plan from a backup policy plan prototype object. The prototype object is -// structured in the same way as a retrieved backup policy plan, and contains the information necessary to create the -// new backup policy plan. -// -// Backups created by this plan will use the resource group of the source being backed up. +// CreateShareMountTarget : Create a mount target for a file share +// This request creates a new share mount target from a share mount target prototype object. // -// Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character -// suffix. -func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) +// The prototype object is structured in the same way as a retrieved share mount target, and contains the information +// necessary to provision the new file share mount target. +func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateBackupPolicyPlanWithContext is an alternate form of the CreateBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions cannot be nil") +// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") + err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *createBackupPolicyPlanOptions.BackupPolicyID, + "share_id": *createShareMountTargetOptions.ShareID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range createShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -18168,34 +17539,9 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if createBackupPolicyPlanOptions.CronSpec != nil { - body["cron_spec"] = createBackupPolicyPlanOptions.CronSpec - } - if createBackupPolicyPlanOptions.Active != nil { - body["active"] = createBackupPolicyPlanOptions.Active - } - if createBackupPolicyPlanOptions.AttachUserTags != nil { - body["attach_user_tags"] = createBackupPolicyPlanOptions.AttachUserTags - } - if createBackupPolicyPlanOptions.ClonePolicy != nil { - body["clone_policy"] = createBackupPolicyPlanOptions.ClonePolicy - } - if createBackupPolicyPlanOptions.CopyUserTags != nil { - body["copy_user_tags"] = createBackupPolicyPlanOptions.CopyUserTags - } - if createBackupPolicyPlanOptions.DeletionTrigger != nil { - body["deletion_trigger"] = createBackupPolicyPlanOptions.DeletionTrigger - } - if createBackupPolicyPlanOptions.Name != nil { - body["name"] = createBackupPolicyPlanOptions.Name - } - if createBackupPolicyPlanOptions.RemoteRegionPolicies != nil { - body["remote_region_policies"] = createBackupPolicyPlanOptions.RemoteRegionPolicies - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(createShareMountTargetOptions.ShareMountTargetPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -18210,12 +17556,12 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_backup_policy_plan", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_share_mount_target", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18226,61 +17572,56 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB return } -// DeleteBackupPolicyPlan : Delete a backup policy plan -// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by -// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with -// the plan will run to completion before the plan is deleted. +// DeleteShareMountTarget : Delete a share mount target +// This request deletes a share mount target. This operation cannot be reversed. // -// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing -// completes, the backup policy plan will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) +// If the request is accepted, the share mount target `lifecycle_state` will be set to +// `deleting`. Once deletion processing completes, it will no longer be retrievable. +func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") +// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") + err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, - "id": *deleteBackupPolicyPlanOptions.ID, + "share_id": *deleteShareMountTargetOptions.ShareID, + "id": *deleteShareMountTargetOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range deleteShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -18291,12 +17632,12 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_backup_policy_plan", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_share_mount_target", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18307,53 +17648,53 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB return } -// GetBackupPolicyPlan : Retrieve a backup policy plan -// This request retrieves a single backup policy plan specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) +// GetShareMountTarget : Retrieve a share mount target +// This request retrieves a single share mount target specified by the identifier in the URL. +func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") +// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") + err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, - "id": *getBackupPolicyPlanOptions.ID, + "share_id": *getShareMountTargetOptions.ShareID, + "id": *getShareMountTargetOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range getShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") 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)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -18364,12 +17705,12 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_backup_policy_plan", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_share_mount_target", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18380,60 +17721,58 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP return } -// UpdateBackupPolicyPlan : Update a backup policy plan -// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is -// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) +// UpdateShareMountTarget : Update a share mount target +// This request updates a share mount target with the information provided in a share mount target patch object. The +// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") +// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") + err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, - "id": *updateBackupPolicyPlanOptions.ID, + "share_id": *updateShareMountTargetOptions.ShareID, + "id": *updateShareMountTargetOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range updateShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) + _, err = builder.SetBodyContentJSON(updateShareMountTargetOptions.ShareMountTargetPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -18448,12 +17787,12 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_backup_policy_plan", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_share_mount_target", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18464,58 +17803,55 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB return } -// DeleteBackupPolicy : Delete a backup policy -// This request deletes a backup policy. This operation cannot be reversed. +// DeleteShareSource : Split the source file share from a replica share +// This request removes the replication relationship between a source share and the replica share specified by the +// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a +// `lifecycle_state` of `updating`, or has a replication operation in progress. // -// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, -// the backup policy will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) +// This operation cannot be reversed. +func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") +// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter +func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") + err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteBackupPolicyOptions.ID, + "share_id": *deleteShareSourceOptions.ShareID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBackupPolicyOptions.Headers { + for headerName, headerValue := range deleteShareSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -18523,71 +17859,63 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku 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, "delete_backup_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_share_source", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetBackupPolicy : Retrieve a backup policy -// This request retrieves a single backup policy specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) +// GetShareSource : Retrieve the source file share for a replica file share +// This request retrieves the source file share associated with the replica file share specified by the identifier in +// the URL. +func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") +// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter +func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") + err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getBackupPolicyOptions.ID, + "share_id": *getShareSourceOptions.ShareID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBackupPolicyOptions.Headers { + for headerName, headerValue := range getShareSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") 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)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -18598,12 +17926,12 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_backup_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_share_source", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18614,100 +17942,20 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic return } -// UpdateBackupPolicy : Update a backup policy -// This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch -// object is structured in the same way as a retrieved backup policy and contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) +// ListBackupPolicies : List backup policies +// This request lists backup policies in the region. Backup policies control which sources are selected for backup and +// include a set of backup policy plans that provide the backup schedules and deletion triggers. +func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateBackupPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateBackupPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateBackupPolicyOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) - 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_backup_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBackupPolicies : List all backup policies -// This request lists all backup policies in the region. Backup policies control which sources are selected for backup -// and include a set of backup policy plans that provide the backup schedules and deletion triggers. -func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) -} - // ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18716,6 +17964,7 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18730,7 +17979,7 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listBackupPoliciesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) } @@ -18749,17 +17998,21 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP 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_backup_policies", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18772,17 +18025,21 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP // This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in // the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) + result, response, err = vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18791,6 +18048,7 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18806,26 +18064,31 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createBackupPolicyOptions.BackupPolicyPrototype) 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_backup_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18834,21 +18097,25 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku return } -// ListBackupPolicyJobs : List all jobs for a backup policy -// This request retrieves all jobs for a backup policy. A backup job represents the execution of a backup policy plan -// for a resource matching the policy's criteria. +// ListBackupPolicyJobs : List jobs for a backup policy +// This request retrieves jobs for a backup policy. A backup job represents the execution of a backup policy plan for a +// resource matching the policy's criteria. func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) + result, response, err = vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18861,6 +18128,7 @@ func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBacku builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18875,7 +18143,7 @@ func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBacku builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listBackupPolicyJobsOptions.Status != nil { builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) } @@ -18903,17 +18171,21 @@ func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBacku 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_backup_policy_jobs", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18925,17 +18197,21 @@ func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBacku // GetBackupPolicyJob : Retrieve a backup policy job // This request retrieves a single backup policy job specified by the identifier in the URL. func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - return vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) + result, response, err = vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -18949,6 +18225,7 @@ func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPo builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -18963,21 +18240,25 @@ func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPo builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + 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_backup_policy_job", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -18986,20 +18267,24 @@ func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPo return } -// ListBackupPolicyPlans : List all plans for a backup policy -// This request retrieves all plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. +// ListBackupPolicyPlans : List plans for a backup policy +// This request retrieves plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - return vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) + result, response, err = vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) + err = core.RepurposeSDKProblem(err, "") + return } // ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19012,6 +18297,7 @@ func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBack builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19026,24 +18312,28 @@ func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBack builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listBackupPolicyPlansOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) } 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_backup_policy_plans", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19062,17 +18352,21 @@ func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBack // Backups created by this plan will use the plan's name truncated to 46 characters, followed by a unique 16-character // suffix. func (vpc *VpcV1) CreateBackupPolicyPlan(createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) + result, response, err = vpc.CreateBackupPolicyPlanWithContext(context.Background(), createBackupPolicyPlanOptions) + err = core.RepurposeSDKProblem(err, "") + return } // CreateBackupPolicyPlanWithContext is an alternate form of the CreateBackupPolicyPlan method which supports a Context parameter func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createBackupPolicyPlanOptions *CreateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(createBackupPolicyPlanOptions, "createBackupPolicyPlanOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19085,6 +18379,7 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19100,7 +18395,7 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createBackupPolicyPlanOptions.CronSpec != nil { @@ -19129,22 +18424,27 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB } _, 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_backup_policy_plan", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19161,17 +18461,21 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB // If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing // completes, the backup policy plan will no longer be retrievable. func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) + result, response, err = vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19185,6 +18489,7 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19202,21 +18507,25 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + 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_backup_policy_plan", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19228,17 +18537,21 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB // GetBackupPolicyPlan : Retrieve a backup policy plan // This request retrieves a single backup policy plan specified by the identifier in the URL. func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) + result, response, err = vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19252,6 +18565,7 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19266,21 +18580,25 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + 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_backup_policy_plan", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19293,17 +18611,21 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP // This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is // structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - return vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) + result, response, err = vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19317,6 +18639,7 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19335,26 +18658,31 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) 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_backup_policy_plan", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19369,17 +18697,21 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB // If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, // the backup policy will no longer be retrievable. func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) + result, response, err = vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19392,6 +18724,7 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19409,21 +18742,25 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + 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_backup_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19435,17 +18772,21 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku // GetBackupPolicy : Retrieve a backup policy // This request retrieves a single backup policy specified by the identifier in the URL. func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) + result, response, err = vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19458,6 +18799,7 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19472,21 +18814,25 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + 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_backup_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19499,17 +18845,21 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic // This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch // object is structured in the same way as a retrieved backup policy and contains only the information to be updated. func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - return vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) + result, response, err = vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return } // UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } @@ -19522,6 +18872,7 @@ func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBacku builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } @@ -19540,26 +18891,31 @@ func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBacku } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) 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_backup_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return } response.Result = result @@ -19568,8 +18924,8 @@ func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBacku return } -// ListRegions : List all regions -// This request lists all regions. Each region is a separate geographic area that contains multiple isolated zones. +// ListRegions : List regions +// This request lists regions. Each region is a separate geographic area that contains multiple isolated zones. // Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones // in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation // available. Resources deployed within a single region also benefit from the low latency afforded by geographic @@ -19608,7 +18964,7 @@ func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -19680,7 +19036,7 @@ func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *Ge builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -19707,8 +19063,8 @@ func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *Ge return } -// ListRegionZones : List all zones in a region -// This request lists all zones in a region. Zones represent logically-isolated data centers with high-bandwidth and +// ListRegionZones : List zones in a region +// This request lists zones in a region. Zones represent logically-isolated data centers with high-bandwidth and // low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. func (vpc *VpcV1) ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) @@ -19753,7 +19109,7 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -19826,7 +19182,7 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -19853,9 +19209,9 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt return } -// ListVirtualNetworkInterfaces : List all virtual network interfaces -// This request lists all virtual network interfaces in the region. A virtual network interface is a logical abstraction -// of a virtual network interface in a subnet, and may be attached to a target resource. +// ListVirtualNetworkInterfaces : List virtual network interfaces +// This request lists virtual network interfaces in the region. A virtual network interface is a logical abstraction of +// a virtual network interface in a subnet, and may be attached to a target resource. // // The virtual network interfaces will be sorted by their `created_at` property values, with newest virtual network // interfaces first. Virtual network interfaces with identical @@ -19894,7 +19250,7 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listVirtualNetworkInterfacesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) } @@ -19974,7 +19330,7 @@ func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createVirtualNetworkInterfaceOptions.AllowIPSpoofing != nil { @@ -19995,6 +19351,9 @@ func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, if createVirtualNetworkInterfaceOptions.PrimaryIP != nil { body["primary_ip"] = createVirtualNetworkInterfaceOptions.PrimaryIP } + if createVirtualNetworkInterfaceOptions.ProtocolStateFilteringMode != nil { + body["protocol_state_filtering_mode"] = createVirtualNetworkInterfaceOptions.ProtocolStateFilteringMode + } if createVirtualNetworkInterfaceOptions.ResourceGroup != nil { body["resource_group"] = createVirtualNetworkInterfaceOptions.ResourceGroup } @@ -20081,7 +19440,7 @@ func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -20144,7 +19503,7 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, get builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -20219,7 +19578,7 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) if err != nil { @@ -20252,8 +19611,8 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, return } -// ListNetworkInterfaceFloatingIps : List all floating IPs associated with a virtual network interface -// This request lists all floating IPs associated with a virtual network interface. +// ListNetworkInterfaceFloatingIps : List floating IPs associated with a virtual network interface +// This request lists floating IPs associated with a virtual network interface. func (vpc *VpcV1) ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { result, response, err = vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) err = core.RepurposeSDKProblem(err, "") @@ -20297,7 +19656,7 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listNetworkInterfaceFloatingIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start)) } @@ -20378,7 +19737,7 @@ func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -20443,7 +19802,7 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -20531,7 +19890,7 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -20558,8 +19917,8 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, return } -// ListVirtualNetworkInterfaceIps : List all reserved IPs bound to a virtual network interface -// This request lists all reserved IPs bound to a virtual network interface. +// ListVirtualNetworkInterfaceIps : List reserved IPs bound to a virtual network interface +// This request lists reserved IPs bound to a virtual network interface. func (vpc *VpcV1) ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { result, response, err = vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) err = core.RepurposeSDKProblem(err, "") @@ -20603,7 +19962,7 @@ func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listVirtualNetworkInterfaceIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Start)) } @@ -20687,7 +20046,7 @@ func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -20752,7 +20111,7 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, g builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -20828,7 +20187,7 @@ func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, a builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -20855,10 +20214,10 @@ func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, a return } -// ListPublicGateways : List all public gateways -// This request lists all 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. +// 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, "") @@ -20893,7 +20252,7 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listPublicGatewaysOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) } @@ -20976,7 +20335,7 @@ func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPubl builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createPublicGatewayOptions.VPC != nil { @@ -21071,7 +20430,7 @@ func (vpc *VpcV1) DeletePublicGatewayWithContext(ctx context.Context, deletePubl } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -21134,7 +20493,7 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -21207,7 +20566,7 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) if err != nil { @@ -21240,9 +20599,9 @@ func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePubl return } -// ListFloatingIps : List all floating IPs -// This request lists all floating IPs in the region. Floating IPs allow inbound and outbound traffic from the Internet -// to an instance. +// 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, "") @@ -21277,7 +20636,7 @@ func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIp builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listFloatingIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listFloatingIpsOptions.Start)) } @@ -21370,7 +20729,7 @@ func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatin builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createFloatingIPOptions.FloatingIPPrototype) if err != nil { @@ -21448,7 +20807,7 @@ func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatin } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -21511,7 +20870,7 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -21584,7 +20943,7 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateFloatingIPOptions.FloatingIPPatch) if err != nil { @@ -21617,9 +20976,9 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin return } -// ListNetworkAcls : List all network ACLs -// This request lists all 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 +// 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) @@ -21655,7 +21014,7 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listNetworkAclsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) } @@ -21735,7 +21094,7 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createNetworkACLOptions.NetworkACLPrototype) if err != nil { @@ -21813,7 +21172,7 @@ func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetwork } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -21876,7 +21235,7 @@ func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -21949,7 +21308,7 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) if err != nil { @@ -21982,9 +21341,9 @@ func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetwork return } -// ListNetworkACLRules : List all rules for a network ACL -// This request lists all 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. +// 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, "") @@ -22028,7 +21387,7 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listNetworkACLRulesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listNetworkACLRulesOptions.Start)) } @@ -22111,7 +21470,7 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) if err != nil { @@ -22189,7 +21548,7 @@ func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNet } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -22253,7 +21612,7 @@ func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkAC builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -22328,7 +21687,7 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateNetworkACLRuleOptions.NetworkACLRulePatch) if err != nil { @@ -22361,8 +21720,8 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet return } -// ListSecurityGroups : List all security groups -// This request lists all security groups in the region. Security groups provide a way to apply IP filtering rules to +// 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. @@ -22400,7 +21759,7 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listSecurityGroupsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSecurityGroupsOptions.Start)) } @@ -22490,7 +21849,7 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createSecurityGroupOptions.VPC != nil { @@ -22581,7 +21940,7 @@ func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecu } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -22644,7 +22003,7 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -22719,7 +22078,7 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateSecurityGroupOptions.SecurityGroupPatch) if err != nil { @@ -22752,10 +22111,9 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu return } -// ListSecurityGroupRules : List all rules in a security group -// This request lists all 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. +// 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, "") @@ -22799,7 +22157,7 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -22877,7 +22235,7 @@ func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, create builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) if err != nil { @@ -22956,7 +22314,7 @@ func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, delete } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -23020,7 +22378,7 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -23096,7 +22454,7 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) if err != nil { @@ -23129,9 +22487,8 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update return } -// ListSecurityGroupTargets : List all targets associated with a security group -// This request lists all targets associated with a security group, to which the rules in the security group are -// applied. +// 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, "") @@ -23175,7 +22532,7 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listSecurityGroupTargetsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) } @@ -23264,7 +22621,7 @@ func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -23329,7 +22686,7 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -23412,7 +22769,7 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -23439,8 +22796,8 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex return } -// ListIkePolicies : List all IKE policies -// This request lists all IKE policies in the region. +// 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, "") @@ -23475,7 +22832,7 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listIkePoliciesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listIkePoliciesOptions.Start)) } @@ -23550,7 +22907,7 @@ func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolic builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createIkePolicyOptions.AuthenticationAlgorithm != nil { @@ -23650,7 +23007,7 @@ func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolic } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -23713,7 +23070,7 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -23786,7 +23143,7 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateIkePolicyOptions.IkePolicyPatch) if err != nil { @@ -23819,16 +23176,16 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic return } -// ListIkePolicyConnections : List all VPN gateway connections that use a specified IKE policy -// This request lists all VPN gateway connections that use a policy. -func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { +// 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 } // ListIkePolicyConnectionsWithContext is an alternate form of the ListIkePolicyConnections method which supports a Context parameter -func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { +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()) @@ -23864,7 +23221,13 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + 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 { @@ -23880,7 +23243,7 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyConnectionCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23891,8 +23254,8 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI return } -// ListIpsecPolicies : List all IPsec policies -// This request lists all IPsec policies in the region. +// 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, "") @@ -23927,7 +23290,7 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listIpsecPoliciesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listIpsecPoliciesOptions.Start)) } @@ -24002,7 +23365,7 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createIpsecPolicyOptions.AuthenticationAlgorithm != nil { @@ -24099,7 +23462,7 @@ func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecP } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -24162,7 +23525,7 @@ func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyO builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -24235,7 +23598,7 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) if err != nil { @@ -24268,16 +23631,16 @@ func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecP return } -// ListIpsecPolicyConnections : List all VPN gateway connections that use a specified IPsec policy -// This request lists all VPN gateway connections that use a policy. -func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { +// 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 } // ListIpsecPolicyConnectionsWithContext is an alternate form of the ListIpsecPolicyConnections method which supports a Context parameter -func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { +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()) @@ -24313,7 +23676,13 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + 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 { @@ -24329,7 +23698,7 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyConnectionCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24340,8 +23709,8 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis return } -// ListVPNGateways : List all VPN gateways -// This request lists all VPN gateways in the region. +// 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, "") @@ -24376,7 +23745,7 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listVPNGatewaysOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPNGatewaysOptions.Start)) } @@ -24460,7 +23829,7 @@ func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGate builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) if err != nil { @@ -24539,7 +23908,7 @@ func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGate } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -24602,7 +23971,7 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -24675,7 +24044,7 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateVPNGatewayOptions.VPNGatewayPatch) if err != nil { @@ -24708,8 +24077,8 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate return } -// ListVPNGatewayConnections : List all connections of a VPN gateway -// This request lists all connections of a VPN gateway. +// 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, "") @@ -24753,7 +24122,13 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + 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)) } @@ -24829,7 +24204,7 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(createVPNGatewayConnectionOptions.VPNGatewayConnectionPrototype) if err != nil { @@ -24908,7 +24283,7 @@ func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, del } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -24972,7 +24347,7 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -25046,7 +24421,7 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) if err != nil { @@ -25079,55 +24454,55 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd return } -// ListVPNGatewayConnectionLocalCIDRs : List all local CIDRs for a VPN gateway connection -// This request lists all local CIDRs for a VPN gateway connection. +// 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) ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPNGatewayConnectionLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionLocalCIDRsOptions) +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 } -// ListVPNGatewayConnectionLocalCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionLocalCIDRs method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions 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(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions") + err = core.ValidateStruct(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionLocalCIDRsOptions.VPNGatewayID, - "id": *listVPNGatewayConnectionLocalCIDRsOptions.ID, + "vpn_gateway_id": *listVPNGatewayConnectionsLocalCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionsLocalCIDRsOptions.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`, 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 listVPNGatewayConnectionLocalCIDRsOptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionsLocalCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionLocalCIDRs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsLocalCIDRs") 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)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -25138,12 +24513,12 @@ func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(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_connection_local_cidrs", 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, UnmarshalVPNGatewayConnectionLocalCIDRs) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCIDRs) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25154,56 +24529,55 @@ func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Cont return } -// RemoveVPNGatewayConnectionLocalCIDR : Remove a local CIDR from a VPN gateway connection +// 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) RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveVPNGatewayConnectionLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionLocalCIDROptions) +func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDR(removeVPNGatewayConnectionsLocalCIDROptions *RemoveVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RemoveVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionsLocalCIDROptions) err = core.RepurposeSDKProblem(err, "") return } -// RemoveVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionLocalCIDR method which supports a Context parameter -func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions cannot be nil") +// 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(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions") + err = core.ValidateStruct(removeVPNGatewayConnectionsLocalCIDROptions, "removeVPNGatewayConnectionsLocalCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *removeVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, - "id": *removeVPNGatewayConnectionLocalCIDROptions.ID, - "cidr_prefix": *removeVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, - "prefix_length": *removeVPNGatewayConnectionLocalCIDROptions.PrefixLength, + "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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, 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 removeVPNGatewayConnectionLocalCIDROptions.Headers { + for headerName, headerValue := range removeVPNGatewayConnectionsLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionLocalCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsLocalCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -25213,7 +24587,7 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Con response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "remove_vpn_gateway_connection_local_cidr", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "remove_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -25221,56 +24595,55 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Con return } -// CheckVPNGatewayConnectionLocalCIDR : Check if the specified local CIDR exists on a VPN gateway connection +// 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) CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.CheckVPNGatewayConnectionLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionLocalCIDROptions) +func (vpc *VpcV1) CheckVPNGatewayConnectionsLocalCIDR(checkVPNGatewayConnectionsLocalCIDROptions *CheckVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.CheckVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionsLocalCIDROptions) err = core.RepurposeSDKProblem(err, "") return } -// CheckVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionLocalCIDR method which supports a Context parameter -func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions 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(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions") + err = core.ValidateStruct(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *checkVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, - "id": *checkVPNGatewayConnectionLocalCIDROptions.ID, - "cidr_prefix": *checkVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, - "prefix_length": *checkVPNGatewayConnectionLocalCIDROptions.PrefixLength, + "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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, 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 checkVPNGatewayConnectionLocalCIDROptions.Headers { + for headerName, headerValue := range checkVPNGatewayConnectionsLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionLocalCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsLocalCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -25280,7 +24653,7 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Cont response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "check_vpn_gateway_connection_local_cidr", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "check_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -25288,57 +24661,56 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Cont return } -// AddVPNGatewayConnectionLocalCIDR : Set a local CIDR on a VPN gateway connection +// 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) AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.AddVPNGatewayConnectionLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionLocalCIDROptions) +func (vpc *VpcV1) AddVPNGatewayConnectionsLocalCIDR(addVPNGatewayConnectionsLocalCIDROptions *AddVPNGatewayConnectionsLocalCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.AddVPNGatewayConnectionsLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionsLocalCIDROptions) err = core.RepurposeSDKProblem(err, "") return } -// AddVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the AddVPNGatewayConnectionLocalCIDR method which supports a Context parameter -func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions cannot be nil") +// 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(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions") + err = core.ValidateStruct(addVPNGatewayConnectionsLocalCIDROptions, "addVPNGatewayConnectionsLocalCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *addVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, - "id": *addVPNGatewayConnectionLocalCIDROptions.ID, - "cidr_prefix": *addVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, - "prefix_length": *addVPNGatewayConnectionLocalCIDROptions.PrefixLength, + "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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, 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 addVPNGatewayConnectionLocalCIDROptions.Headers { + for headerName, headerValue := range addVPNGatewayConnectionsLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionLocalCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsLocalCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -25348,7 +24720,7 @@ func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Contex response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "add_vpn_gateway_connection_local_cidr", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -25356,55 +24728,55 @@ func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Contex return } -// ListVPNGatewayConnectionPeerCIDRs : List all peer CIDRs for a VPN gateway connection -// This request lists all peer CIDRs for a VPN gateway connection. +// 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) ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPNGatewayConnectionPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionPeerCIDRsOptions) +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 } -// ListVPNGatewayConnectionPeerCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionPeerCIDRs method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions 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(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions") + err = core.ValidateStruct(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionPeerCIDRsOptions.VPNGatewayID, - "id": *listVPNGatewayConnectionPeerCIDRsOptions.ID, + "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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs`, pathParamsMap) + _, 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 listVPNGatewayConnectionPeerCIDRsOptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionsPeerCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionPeerCIDRs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsPeerCIDRs") 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)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -25415,12 +24787,12 @@ func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Conte var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpn_gateway_connection_peer_cidrs", 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, UnmarshalVPNGatewayConnectionPeerCIDRs) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCIDRs) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25431,56 +24803,55 @@ func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Conte return } -// RemoveVPNGatewayConnectionPeerCIDR : Remove a peer CIDR from a VPN gateway connection +// 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) RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveVPNGatewayConnectionPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionPeerCIDROptions) +func (vpc *VpcV1) RemoveVPNGatewayConnectionsPeerCIDR(removeVPNGatewayConnectionsPeerCIDROptions *RemoveVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RemoveVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionsPeerCIDROptions) err = core.RepurposeSDKProblem(err, "") return } -// RemoveVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions 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(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions") + err = core.ValidateStruct(removeVPNGatewayConnectionsPeerCIDROptions, "removeVPNGatewayConnectionsPeerCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *removeVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, - "id": *removeVPNGatewayConnectionPeerCIDROptions.ID, - "cidr_prefix": *removeVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, - "prefix_length": *removeVPNGatewayConnectionPeerCIDROptions.PrefixLength, + "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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, 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 removeVPNGatewayConnectionPeerCIDROptions.Headers { + for headerName, headerValue := range removeVPNGatewayConnectionsPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionPeerCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsPeerCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -25490,7 +24861,7 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Cont response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "remove_vpn_gateway_connection_peer_cidr", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "remove_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -25498,56 +24869,55 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Cont return } -// CheckVPNGatewayConnectionPeerCIDR : Check if the specified peer CIDR exists on a VPN gateway connection +// 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) CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.CheckVPNGatewayConnectionPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionPeerCIDROptions) +func (vpc *VpcV1) CheckVPNGatewayConnectionsPeerCIDR(checkVPNGatewayConnectionsPeerCIDROptions *CheckVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.CheckVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionsPeerCIDROptions) err = core.RepurposeSDKProblem(err, "") return } -// CheckVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions 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(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions") + err = core.ValidateStruct(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *checkVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, - "id": *checkVPNGatewayConnectionPeerCIDROptions.ID, - "cidr_prefix": *checkVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, - "prefix_length": *checkVPNGatewayConnectionPeerCIDROptions.PrefixLength, + "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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, 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 checkVPNGatewayConnectionPeerCIDROptions.Headers { + for headerName, headerValue := range checkVPNGatewayConnectionsPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionPeerCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsPeerCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -25557,7 +24927,7 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Conte response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "check_vpn_gateway_connection_peer_cidr", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "check_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -25565,57 +24935,56 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Conte return } -// AddVPNGatewayConnectionPeerCIDR : Set a peer CIDR on a VPN gateway connection +// 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) AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.AddVPNGatewayConnectionPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionPeerCIDROptions) +func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDR(addVPNGatewayConnectionsPeerCIDROptions *AddVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.AddVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionsPeerCIDROptions) err = core.RepurposeSDKProblem(err, "") return } -// AddVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the AddVPNGatewayConnectionPeerCIDR method which supports a Context parameter -func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions 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(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions") + err = core.ValidateStruct(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *addVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, - "id": *addVPNGatewayConnectionPeerCIDROptions.ID, - "cidr_prefix": *addVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, - "prefix_length": *addVPNGatewayConnectionPeerCIDROptions.PrefixLength, + "vpn_gateway_id": *addVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionsPeerCIDROptions.ID, + "cidr": *addVPNGatewayConnectionsPeerCIDROptions.CIDR, } 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}/peer_cidrs/{cidr_prefix}/{prefix_length}`, 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 addVPNGatewayConnectionPeerCIDROptions.Headers { + for headerName, headerValue := range addVPNGatewayConnectionsPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionPeerCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsPeerCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -25625,7 +24994,7 @@ func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "add_vpn_gateway_connection_peer_cidr", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -25633,8 +25002,8 @@ func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context return } -// ListVPNServers : List all VPN servers -// This request lists all VPN servers. +// 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, "") @@ -25669,7 +25038,7 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listVPNServersOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name)) } @@ -25753,7 +25122,7 @@ func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServe builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createVPNServerOptions.Certificate != nil { @@ -25870,7 +25239,7 @@ func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServe } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -25933,7 +25302,7 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -25961,8 +25330,8 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio } // UpdateVPNServer : Update a VPN server -// This request updates the properties of an existing VPN server. Any property changes will cause all connected VPN -// clients are disconnected from this VPN server except for the name change. +// 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, "") @@ -26010,7 +25379,7 @@ func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServe } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) if err != nil { @@ -26089,7 +25458,7 @@ func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context builder.AddHeader("Accept", "text/plain") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -26107,8 +25476,8 @@ func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context return } -// ListVPNServerClients : List all VPN clients for a VPN server -// This request retrieves all connected VPN clients, and any disconnected VPN clients that the VPN server has not yet +// 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) @@ -26153,7 +25522,7 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listVPNServerClientsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPNServerClientsOptions.Start)) } @@ -26236,7 +25605,7 @@ func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVP } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -26300,7 +25669,7 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -26374,7 +25743,7 @@ func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnect } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -26392,9 +25761,9 @@ func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnect return } -// ListVPNServerRoutes : List all VPN routes for a VPN server -// This request lists all 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 +// 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) @@ -26439,7 +25808,7 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listVPNServerRoutesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listVPNServerRoutesOptions.Start)) } @@ -26478,8 +25847,7 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer // 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. destination of the -// packet. +// 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, "") @@ -26524,7 +25892,7 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createVPNServerRouteOptions.Destination != nil { @@ -26612,7 +25980,7 @@ func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPN } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -26676,7 +26044,7 @@ func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServer builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -26751,7 +26119,7 @@ func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPN builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateVPNServerRouteOptions.VPNServerRoutePatch) if err != nil { @@ -26784,9 +26152,9 @@ func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPN return } -// ListLoadBalancerProfiles : List all load balancer profiles -// This request lists all load balancer profiles available in the region. A load balancer profile specifies the -// performance characteristics and pricing model for a load balancer. +// 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, "") @@ -26821,7 +26189,7 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listLoadBalancerProfilesOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) } @@ -26899,7 +26267,7 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -26926,8 +26294,8 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad return } -// ListLoadBalancers : List all load balancers -// This request lists all load balancers in the region. +// 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, "") @@ -26962,7 +26330,7 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listLoadBalancersOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listLoadBalancersOptions.Start)) } @@ -27037,7 +26405,7 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createLoadBalancerOptions.IsPublic != nil { @@ -27152,7 +26520,7 @@ func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadB } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -27215,7 +26583,7 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -27293,7 +26661,7 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) if err != nil { @@ -27326,7 +26694,7 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB return } -// GetLoadBalancerStatistics : List all statistics of a load balancer +// 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) @@ -27371,7 +26739,7 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -27398,8 +26766,8 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL return } -// ListLoadBalancerListeners : List all listeners for a load balancer -// This request lists all listeners for a load balancer. +// 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, "") @@ -27443,7 +26811,7 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -27516,7 +26884,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createLoadBalancerListenerOptions.Protocol != nil { @@ -27629,7 +26997,7 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, del } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -27693,7 +27061,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -27767,7 +27135,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) if err != nil { @@ -27800,9 +27168,9 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd return } -// ListLoadBalancerListenerPolicies : List all policies for a load balancer listener -// This request lists all 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. +// 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, "") @@ -27847,7 +27215,7 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -27923,7 +27291,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createLoadBalancerListenerPolicyOptions.Action != nil { @@ -28018,7 +27386,7 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Contex } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -28083,7 +27451,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -28159,7 +27527,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) if err != nil { @@ -28192,8 +27560,8 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex return } -// ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy -// This request lists all rules of a load balancer listener policy. +// 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, "") @@ -28239,7 +27607,7 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -28314,7 +27682,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createLoadBalancerListenerPolicyRuleOptions.Condition != nil { @@ -28407,7 +27775,7 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Co } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -28473,7 +27841,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -28549,7 +27917,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) if err != nil { @@ -28582,8 +27950,8 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co return } -// ListLoadBalancerPools : List all pools of a load balancer -// This request lists all pools of a load balancer. +// 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, "") @@ -28627,7 +27995,7 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -28700,7 +28068,7 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createLoadBalancerPoolOptions.Algorithm != nil { @@ -28801,7 +28169,7 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteL } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -28865,7 +28233,7 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -28939,7 +28307,7 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) if err != nil { @@ -28972,8 +28340,8 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL return } -// ListLoadBalancerPoolMembers : List all members of a load balancer pool -// This request lists all members of a load balancer pool. +// 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, "") @@ -29018,7 +28386,7 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -29092,7 +28460,7 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createLoadBalancerPoolMemberOptions.Port != nil { @@ -29183,7 +28551,7 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if replaceLoadBalancerPoolMembersOptions.Members != nil { @@ -29266,7 +28634,7 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, d } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -29331,7 +28699,7 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -29406,7 +28774,7 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) if err != nil { @@ -29439,9 +28807,9 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u return } -// ListEndpointGateways : List all endpoint gateways -// This request lists all endpoint gateways in the region. An endpoint gateway maps one or more reserved IPs in a VPC to -// a target outside the VPC. +// 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, "") @@ -29476,7 +28844,7 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listEndpointGatewaysOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listEndpointGatewaysOptions.Name)) } @@ -29570,7 +28938,7 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createEndpointGatewayOptions.Target != nil { @@ -29625,8 +28993,8 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn return } -// ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway -// This request lists all reserved IPs bound to an endpoint gateway. +// 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, "") @@ -29670,7 +29038,7 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listEndpointGatewayIpsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listEndpointGatewayIpsOptions.Start)) } @@ -29752,7 +29120,7 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -29816,7 +29184,7 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -29892,7 +29260,7 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -29966,7 +29334,7 @@ func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEn } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -30029,7 +29397,7 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -30102,7 +29470,7 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateEndpointGatewayOptions.EndpointGatewayPatch) if err != nil { @@ -30135,8 +29503,8 @@ func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEn return } -// ListFlowLogCollectors : List all flow log collectors -// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over the instance +// ListFlowLogCollectors : List flow log collectors +// This request lists flow log collectors in the region. A flow log collector summarizes data sent over the instance // network interfaces and instance network attachments contained within its target. func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) @@ -30172,7 +29540,7 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) if listFlowLogCollectorsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listFlowLogCollectorsOptions.Start)) } @@ -30270,7 +29638,7 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) if createFlowLogCollectorOptions.StorageBucket != nil { @@ -30365,7 +29733,7 @@ func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteF } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -30428,7 +29796,7 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) request, err := builder.Build() if err != nil { @@ -30503,7 +29871,7 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) _, err = builder.SetBodyContentJSON(updateFlowLogCollectorOptions.FlowLogCollectorPatch) if err != nil { @@ -30536,7 +29904,7 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF return } func getServiceComponentInfo() *core.ProblemComponent { - return core.NewProblemComponent(DefaultServiceName, "today") + return core.NewProblemComponent(DefaultServiceName, "2024-04-30") } // AccountReference : AccountReference struct @@ -30809,118 +30177,98 @@ func (options *AddVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string] return options } -// AddVPNGatewayConnectionLocalCIDROptions : The AddVPNGatewayConnectionLocalCIDR options. -type AddVPNGatewayConnectionLocalCIDROptions struct { +// 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 address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" 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 } -// NewAddVPNGatewayConnectionLocalCIDROptions : Instantiate AddVPNGatewayConnectionLocalCIDROptions -func (*VpcV1) NewAddVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { - return &AddVPNGatewayConnectionLocalCIDROptions{ +// NewAddVPNGatewayConnectionsLocalCIDROptions : Instantiate AddVPNGatewayConnectionsLocalCIDROptions +func (*VpcV1) NewAddVPNGatewayConnectionsLocalCIDROptions(vpnGatewayID string, id string, cidr string) *AddVPNGatewayConnectionsLocalCIDROptions { + return &AddVPNGatewayConnectionsLocalCIDROptions{ VPNGatewayID: core.StringPtr(vpnGatewayID), ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), + CIDR: core.StringPtr(cidr), } } // SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionLocalCIDROptions { +func (_options *AddVPNGatewayConnectionsLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionsLocalCIDROptions { _options.VPNGatewayID = core.StringPtr(vpnGatewayID) return _options } // SetID : Allow user to set ID -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetID(id string) *AddVPNGatewayConnectionLocalCIDROptions { +func (_options *AddVPNGatewayConnectionsLocalCIDROptions) SetID(id string) *AddVPNGatewayConnectionsLocalCIDROptions { _options.ID = core.StringPtr(id) return _options } -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionLocalCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} - -// SetPrefixLength : Allow user to set PrefixLength -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) +// 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 *AddVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionLocalCIDROptions { +func (options *AddVPNGatewayConnectionsLocalCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionsLocalCIDROptions { options.Headers = param return options } -// AddVPNGatewayConnectionPeerCIDROptions : The AddVPNGatewayConnectionPeerCIDR options. -type AddVPNGatewayConnectionPeerCIDROptions struct { +// 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 address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" 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 } -// NewAddVPNGatewayConnectionPeerCIDROptions : Instantiate AddVPNGatewayConnectionPeerCIDROptions -func (*VpcV1) NewAddVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { - return &AddVPNGatewayConnectionPeerCIDROptions{ +// NewAddVPNGatewayConnectionsPeerCIDROptions : Instantiate AddVPNGatewayConnectionsPeerCIDROptions +func (*VpcV1) NewAddVPNGatewayConnectionsPeerCIDROptions(vpnGatewayID string, id string, cidr string) *AddVPNGatewayConnectionsPeerCIDROptions { + return &AddVPNGatewayConnectionsPeerCIDROptions{ VPNGatewayID: core.StringPtr(vpnGatewayID), ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), + CIDR: core.StringPtr(cidr), } } // SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionPeerCIDROptions { +func (_options *AddVPNGatewayConnectionsPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionsPeerCIDROptions { _options.VPNGatewayID = core.StringPtr(vpnGatewayID) return _options } // SetID : Allow user to set ID -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetID(id string) *AddVPNGatewayConnectionPeerCIDROptions { +func (_options *AddVPNGatewayConnectionsPeerCIDROptions) SetID(id string) *AddVPNGatewayConnectionsPeerCIDROptions { _options.ID = core.StringPtr(id) return _options } -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionPeerCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} - -// SetPrefixLength : Allow user to set PrefixLength -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) +// 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 *AddVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionPeerCIDROptions { +func (options *AddVPNGatewayConnectionsPeerCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionsPeerCIDROptions { options.Headers = param return options } @@ -32209,26 +31557,17 @@ func UnmarshalBackupPolicyPlanCollection(m map[string]json.RawMessage, result in obj := new(BackupPolicyPlanCollection) err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyPlanCollectionFirst) if err != nil { -<<<<<<< Updated upstream -======= err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) ->>>>>>> Stashed changes return } err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { -<<<<<<< Updated upstream -======= err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) ->>>>>>> Stashed changes return } err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyPlanCollectionNext) if err != nil { -<<<<<<< Updated upstream -======= err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) ->>>>>>> Stashed changes return } err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlan) @@ -32277,44 +31616,6 @@ func UnmarshalBackupPolicyPlanCollectionNext(m map[string]json.RawMessage, resul err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - 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 { - return - } - 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) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -33023,7 +32324,18 @@ type BareMetalServer struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The status of the bare metal server. + // 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 + // - `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"` // The reasons for the current status (if any). @@ -33057,7 +32369,18 @@ const ( ) // Constants associated with the BareMetalServer.Status property. -// The status of the bare metal server. +// 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 +// - `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" @@ -33067,7 +32390,6 @@ const ( BareMetalServerStatusRunningConst = "running" BareMetalServerStatusStartingConst = "starting" BareMetalServerStatusStoppedConst = "stopped" - BareMetalServerStatusStoppingConst = "stopping" ) // UnmarshalBareMetalServer unmarshals an instance of BareMetalServer from the specified map of raw messages. @@ -33692,6 +33014,8 @@ type BareMetalServerInitializationPrototype struct { 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"` } @@ -33791,6 +33115,7 @@ func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMess // 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) // @@ -33807,12 +33132,14 @@ type BareMetalServerLifecycleReason struct { // 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 ( + BareMetalServerLifecycleReasonCodeInternalErrorConst = "internal_error" BareMetalServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -34356,6 +33683,19 @@ type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface struct { // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,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 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"` @@ -34378,6 +33718,24 @@ type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface struct { 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 { return true } @@ -34419,6 +33777,11 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface(m 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()) @@ -35204,6 +34567,10 @@ func UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted(m map // 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. // @@ -35221,6 +34588,11 @@ type BareMetalServerPatch struct { // 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, "", "bandwidth-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) @@ -36623,6 +35995,9 @@ func UnmarshalBareMetalServerProfileReference(m map[string]json.RawMessage, resu // 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"` + // The type for this profile field. Type *string `json:"type" validate:"required"` @@ -36630,6 +36005,13 @@ type BareMetalServerProfileSupportedTrustedPlatformModuleModes struct { Values []string `json:"values" 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" +) + // Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Type property. // The type for this profile field. const ( @@ -36651,6 +36033,11 @@ const ( // 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) if err != nil { err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) @@ -36702,6 +36089,11 @@ func UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported(m map[stri // - 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"` @@ -36757,6 +36149,11 @@ type BareMetalServerPrototypeIntf interface { // 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, "", "bandwidth-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) @@ -36979,12 +36376,16 @@ func UnmarshalBareMetalServerTrustedPlatformModulePatch(m map[string]json.RawMes 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" @@ -37062,6 +36463,82 @@ func UnmarshalCatalogOfferingVersionIdentity(m map[string]json.RawMessage, resul return } +// 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"` +} + +func (*CatalogOfferingVersionPlanIdentity) isaCatalogOfferingVersionPlanIdentity() bool { + return true +} + +type CatalogOfferingVersionPlanIdentityIntf interface { + isaCatalogOfferingVersionPlanIdentity() bool +} + +// 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, "", "crn-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 *CatalogOfferingVersionPlanReferenceDeleted `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, "", "crn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalCatalogOfferingVersionPlanReferenceDeleted) + if err != nil { + err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogOfferingVersionPlanReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type CatalogOfferingVersionPlanReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalCatalogOfferingVersionPlanReferenceDeleted unmarshals an instance of CatalogOfferingVersionPlanReferenceDeleted from the specified map of raw messages. +func UnmarshalCatalogOfferingVersionPlanReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingVersionPlanReferenceDeleted) + 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 +} + // CatalogOfferingVersionReference : CatalogOfferingVersionReference struct type CatalogOfferingVersionReference struct { // The CRN for this version of a @@ -37127,118 +36604,98 @@ func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result return } -// CheckVPNGatewayConnectionLocalCIDROptions : The CheckVPNGatewayConnectionLocalCIDR options. -type CheckVPNGatewayConnectionLocalCIDROptions struct { +// 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 address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" 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 } -// NewCheckVPNGatewayConnectionLocalCIDROptions : Instantiate CheckVPNGatewayConnectionLocalCIDROptions -func (*VpcV1) NewCheckVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { - return &CheckVPNGatewayConnectionLocalCIDROptions{ +// NewCheckVPNGatewayConnectionsLocalCIDROptions : Instantiate CheckVPNGatewayConnectionsLocalCIDROptions +func (*VpcV1) NewCheckVPNGatewayConnectionsLocalCIDROptions(vpnGatewayID string, id string, cidr string) *CheckVPNGatewayConnectionsLocalCIDROptions { + return &CheckVPNGatewayConnectionsLocalCIDROptions{ VPNGatewayID: core.StringPtr(vpnGatewayID), ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), + CIDR: core.StringPtr(cidr), } } // SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionLocalCIDROptions { +func (_options *CheckVPNGatewayConnectionsLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionsLocalCIDROptions { _options.VPNGatewayID = core.StringPtr(vpnGatewayID) return _options } // SetID : Allow user to set ID -func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetID(id string) *CheckVPNGatewayConnectionLocalCIDROptions { +func (_options *CheckVPNGatewayConnectionsLocalCIDROptions) SetID(id string) *CheckVPNGatewayConnectionsLocalCIDROptions { _options.ID = core.StringPtr(id) return _options } -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *CheckVPNGatewayConnectionLocalCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} - -// SetPrefixLength : Allow user to set PrefixLength -func (_options *CheckVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) +// 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 *CheckVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionLocalCIDROptions { +func (options *CheckVPNGatewayConnectionsLocalCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionsLocalCIDROptions { options.Headers = param return options } -// CheckVPNGatewayConnectionPeerCIDROptions : The CheckVPNGatewayConnectionPeerCIDR options. -type CheckVPNGatewayConnectionPeerCIDROptions struct { +// 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 address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" 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 } -// NewCheckVPNGatewayConnectionPeerCIDROptions : Instantiate CheckVPNGatewayConnectionPeerCIDROptions -func (*VpcV1) NewCheckVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionPeerCIDROptions { - return &CheckVPNGatewayConnectionPeerCIDROptions{ +// NewCheckVPNGatewayConnectionsPeerCIDROptions : Instantiate CheckVPNGatewayConnectionsPeerCIDROptions +func (*VpcV1) NewCheckVPNGatewayConnectionsPeerCIDROptions(vpnGatewayID string, id string, cidr string) *CheckVPNGatewayConnectionsPeerCIDROptions { + return &CheckVPNGatewayConnectionsPeerCIDROptions{ VPNGatewayID: core.StringPtr(vpnGatewayID), ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), + CIDR: core.StringPtr(cidr), } } // SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionPeerCIDROptions { +func (_options *CheckVPNGatewayConnectionsPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionsPeerCIDROptions { _options.VPNGatewayID = core.StringPtr(vpnGatewayID) return _options } // SetID : Allow user to set ID -func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetID(id string) *CheckVPNGatewayConnectionPeerCIDROptions { +func (_options *CheckVPNGatewayConnectionsPeerCIDROptions) SetID(id string) *CheckVPNGatewayConnectionsPeerCIDROptions { _options.ID = core.StringPtr(id) return _options } -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *CheckVPNGatewayConnectionPeerCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} - -// SetPrefixLength : Allow user to set PrefixLength -func (_options *CheckVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *CheckVPNGatewayConnectionPeerCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) +// 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 *CheckVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionPeerCIDROptions { +func (options *CheckVPNGatewayConnectionsPeerCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionsPeerCIDROptions { options.Headers = param return options } @@ -39154,10 +38611,7 @@ type CreateLoadBalancerListenerPolicyOptions struct { // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. -<<<<<<< Updated upstream // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. -======= ->>>>>>> Stashed changes Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` // Allows users to set headers on API requests @@ -40453,6 +39907,19 @@ type CreateVirtualNetworkInterfaceOptions struct { // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,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 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"` @@ -40469,6 +39936,24 @@ type CreateVirtualNetworkInterfaceOptions struct { Headers map[string]string } +// Constants associated with the CreateVirtualNetworkInterfaceOptions.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 ( + CreateVirtualNetworkInterfaceOptionsProtocolStateFilteringModeAutoConst = "auto" + CreateVirtualNetworkInterfaceOptionsProtocolStateFilteringModeDisabledConst = "disabled" + CreateVirtualNetworkInterfaceOptionsProtocolStateFilteringModeEnabledConst = "enabled" +) + // NewCreateVirtualNetworkInterfaceOptions : Instantiate CreateVirtualNetworkInterfaceOptions func (*VpcV1) NewCreateVirtualNetworkInterfaceOptions() *CreateVirtualNetworkInterfaceOptions { return &CreateVirtualNetworkInterfaceOptions{} @@ -40510,6 +39995,12 @@ func (_options *CreateVirtualNetworkInterfaceOptions) SetPrimaryIP(primaryIP Vir return _options } +// SetProtocolStateFilteringMode : Allow user to set ProtocolStateFilteringMode +func (_options *CreateVirtualNetworkInterfaceOptions) SetProtocolStateFilteringMode(protocolStateFilteringMode string) *CreateVirtualNetworkInterfaceOptions { + _options.ProtocolStateFilteringMode = core.StringPtr(protocolStateFilteringMode) + return _options +} + // SetResourceGroup : Allow user to set ResourceGroup func (_options *CreateVirtualNetworkInterfaceOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVirtualNetworkInterfaceOptions { _options.ResourceGroup = resourceGroup @@ -41519,15 +41010,15 @@ func UnmarshalDnsInstanceIdentity(m map[string]json.RawMessage, result interface return } -// DnsInstanceReference : DnsInstanceReference struct -type DnsInstanceReference struct { +// DnsInstanceReferenceLoadBalancerDnsContext : DnsInstanceReferenceLoadBalancerDnsContext struct +type DnsInstanceReferenceLoadBalancerDnsContext struct { // The CRN for this DNS instance. CRN *string `json:"crn" validate:"required"` } -// UnmarshalDnsInstanceReference unmarshals an instance of DnsInstanceReference from the specified map of raw messages. -func UnmarshalDnsInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DnsInstanceReference) +// UnmarshalDnsInstanceReferenceLoadBalancerDnsContext unmarshals an instance of DnsInstanceReferenceLoadBalancerDnsContext from the specified map of raw messages. +func UnmarshalDnsInstanceReferenceLoadBalancerDnsContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DnsInstanceReferenceLoadBalancerDnsContext) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) @@ -43738,8 +43229,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 `vpn_server` value is supported, but filter - // support is expected to expand in the future. + // 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. 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 @@ -45446,6 +44937,44 @@ func (options *DeleteSecurityGroupTargetBindingOptions) SetHeaders(param map[str return options } +// DeleteShareAccessorBindingOptions : The DeleteShareAccessorBinding options. +type DeleteShareAccessorBindingOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The file share accessor binding identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteShareAccessorBindingOptions : Instantiate DeleteShareAccessorBindingOptions +func (*VpcV1) NewDeleteShareAccessorBindingOptions(shareID string, id string) *DeleteShareAccessorBindingOptions { + return &DeleteShareAccessorBindingOptions{ + ShareID: core.StringPtr(shareID), + ID: core.StringPtr(id), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *DeleteShareAccessorBindingOptions) SetShareID(shareID string) *DeleteShareAccessorBindingOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteShareAccessorBindingOptions) SetID(id string) *DeleteShareAccessorBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteShareAccessorBindingOptions) SetHeaders(param map[string]string) *DeleteShareAccessorBindingOptions { + options.Headers = param + return options +} + // DeleteShareMountTargetOptions : The DeleteShareMountTarget options. type DeleteShareMountTargetOptions struct { // The file share identifier. @@ -46645,6 +46174,9 @@ func UnmarshalEndpointGatewayCollectionNext(m map[string]json.RawMessage, result type EndpointGatewayLifecycleReason struct { // A reason code for this lifecycle state: // - `dns_resolution_binding_pending`: the DNS resolution binding is being set up + // - `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. @@ -46659,12 +46191,16 @@ type EndpointGatewayLifecycleReason struct { // Constants associated with the EndpointGatewayLifecycleReason.Code property. // A reason code for this lifecycle state: -// - `dns_resolution_binding_pending`: the DNS resolution binding is being set up +// - `dns_resolution_binding_pending`: the DNS resolution binding is being set up +// - `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 ( EndpointGatewayLifecycleReasonCodeDnsResolutionBindingPendingConst = "dns_resolution_binding_pending" + EndpointGatewayLifecycleReasonCodeInternalErrorConst = "internal_error" EndpointGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -50380,6 +49916,44 @@ func (options *GetSecurityGroupTargetOptions) SetHeaders(param map[string]string return options } +// GetShareAccessorBindingOptions : The GetShareAccessorBinding options. +type GetShareAccessorBindingOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The file share accessor binding identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetShareAccessorBindingOptions : Instantiate GetShareAccessorBindingOptions +func (*VpcV1) NewGetShareAccessorBindingOptions(shareID string, id string) *GetShareAccessorBindingOptions { + return &GetShareAccessorBindingOptions{ + ShareID: core.StringPtr(shareID), + ID: core.StringPtr(id), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *GetShareAccessorBindingOptions) SetShareID(shareID string) *GetShareAccessorBindingOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetShareAccessorBindingOptions) SetID(id string) *GetShareAccessorBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetShareAccessorBindingOptions) SetHeaders(param map[string]string) *GetShareAccessorBindingOptions { + options.Headers = param + return options +} + // GetShareMountTargetOptions : The GetShareMountTarget options. type GetShareMountTargetOptions struct { // The file share identifier. @@ -51599,6 +51173,72 @@ func (resp *IkePolicyCollection) GetNextStart() (*string, error) { return start, nil } +// IkePolicyConnectionCollection : IkePolicyConnectionCollection struct +type IkePolicyConnectionCollection struct { + // Collection of VPN gateway connections that use a specified IKE policy specified by the identifier in the URL. + Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` + + // A link to the first page of resources. + First *IkePolicyConnectionCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalIkePolicyConnectionCollection unmarshals an instance of IkePolicyConnectionCollection from the specified map of raw messages. +func UnmarshalIkePolicyConnectionCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyConnectionCollection) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnection) + if err != nil { + err = core.SDKErrorf(err, "", "connections-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIkePolicyConnectionCollectionFirst) + 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, UnmarshalIkePolicyConnectionCollectionNext) + 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 *IkePolicyConnectionCollection) 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 +} + // IkePolicyPatch : IkePolicyPatch struct type IkePolicyPatch struct { // The authentication algorithm. @@ -52079,6 +51719,108 @@ func UnmarshalIPsecPolicyCollectionNext(m map[string]json.RawMessage, result int return } +// IPsecPolicyConnectionCollection : IPsecPolicyConnectionCollection struct +type IPsecPolicyConnectionCollection struct { + // Collection of VPN gateway connections that use a specified 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"` + + // 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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalIPsecPolicyConnectionCollection unmarshals an instance of IPsecPolicyConnectionCollection from the specified map of raw messages. +func UnmarshalIPsecPolicyConnectionCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyConnectionCollection) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnection) + if err != nil { + err = core.SDKErrorf(err, "", "connections-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIPsecPolicyConnectionCollectionFirst) + 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, UnmarshalIPsecPolicyConnectionCollectionNext) + 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 *IPsecPolicyConnectionCollection) 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 +} + +// 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 @@ -52306,6 +52048,42 @@ func UnmarshalIkePolicyCollectionNext(m map[string]json.RawMessage, result inter 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 +} + // IkePolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary // information. type IkePolicyReferenceDeleted struct { @@ -52401,6 +52179,15 @@ type Image struct { StatusReasons []ImageStatusReason `json:"status_reasons" validate:"required"` + // The user data format for this image: + // - `cloud_init`: `user_data` will be interpreted according to the cloud-init standard + // - `esxi_kickstart`: `user_data` will be interpreted as a VMware ESXi installation script + // - `ipxe`: `user_data` will be interpreted as a single URL to an iPXE script or as the + // text of an iPXE script + // + // The value for this property is inherited from `operating_system.user_data_format`. + UserDataFormat *string `json:"user_data_format" validate:"required"` + // The visibility of this image. // - `private`: Visible only to this account // - `public`: Visible to all accounts. @@ -52443,6 +52230,20 @@ const ( ImageStatusUnusableConst = "unusable" ) +// Constants associated with the Image.UserDataFormat property. +// The user data format for this image: +// - `cloud_init`: `user_data` will be interpreted according to the cloud-init standard +// - `esxi_kickstart`: `user_data` will be interpreted as a VMware ESXi installation script +// - `ipxe`: `user_data` will be interpreted as a single URL to an iPXE script or as the +// text of an iPXE script +// +// The value for this property is inherited from `operating_system.user_data_format`. +const ( + ImageUserDataFormatCloudInitConst = "cloud_init" + ImageUserDataFormatEsxiKickstartConst = "esxi_kickstart" + ImageUserDataFormatIpxeConst = "ipxe" +) + // Constants associated with the Image.Visibility property. // The visibility of this image. // - `private`: Visible only to this account @@ -52545,6 +52346,11 @@ func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "user_data_format", &obj.UserDataFormat) + if err != nil { + err = core.SDKErrorf(err, "", "user_data_format-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "visibility", &obj.Visibility) if err != nil { err = core.SDKErrorf(err, "", "visibility-error", common.GetComponentInfo()) @@ -53507,6 +53313,9 @@ type Instance struct { // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user). CatalogOffering *InstanceCatalogOffering `json:"catalog_offering,omitempty"` + // The confidential compute mode for this virtual server instance. + ConfidentialComputeMode *string `json:"confidential_compute_mode" validate:"required"` + // The date and time that the virtual server instance was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -53519,6 +53328,9 @@ type Instance struct { // The instance disks for this virtual server instance. Disks []InstanceDisk `json:"disks" validate:"required"` + // Indicates whether secure boot is enabled for this virtual server instance. + EnableSecureBoot *bool `json:"enable_secure_boot" validate:"required"` + // The virtual server instance GPU configuration. Gpu *InstanceGpu `json:"gpu,omitempty"` @@ -53638,6 +53450,13 @@ type Instance struct { Zone *ZoneReference `json:"zone" validate:"required"` } +// Constants associated with the Instance.ConfidentialComputeMode property. +// The confidential compute mode for this virtual server instance. +const ( + InstanceConfidentialComputeModeDisabledConst = "disabled" + InstanceConfidentialComputeModeSgxConst = "sgx" +) + // Constants associated with the Instance.HealthState property. // The health of this resource: // - `ok`: No abnormal behavior detected @@ -53710,6 +53529,11 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er err = core.SDKErrorf(err, "", "catalog_offering-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()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -53730,6 +53554,11 @@ func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err er err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "gpu", &obj.Gpu, UnmarshalInstanceGpu) if err != nil { err = core.SDKErrorf(err, "", "gpu-error", common.GetComponentInfo()) @@ -54080,6 +53909,11 @@ func UnmarshalInstanceAvailabilityPolicyPrototype(m map[string]json.RawMessage, // InstanceCatalogOffering : InstanceCatalogOffering struct type InstanceCatalogOffering struct { + // The billing plan used for the catalog offering version. + // + // If absent, no billing plan is in use (free). + Plan *CatalogOfferingVersionPlanReference `json:"plan,omitempty"` + // The catalog offering version this virtual server instance was provisioned from. // // The catalog offering version is not managed by the IBM VPC service, and may no longer @@ -54092,6 +53926,11 @@ type InstanceCatalogOffering struct { // UnmarshalInstanceCatalogOffering unmarshals an instance of InstanceCatalogOffering from the specified map of raw messages. func UnmarshalInstanceCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceCatalogOffering) + err = core.UnmarshalModel(m, "plan", &obj.Plan, UnmarshalCatalogOfferingVersionPlanReference) + if err != nil { + err = core.SDKErrorf(err, "", "plan-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) if err != nil { err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) @@ -54111,6 +53950,11 @@ func UnmarshalInstanceCatalogOffering(m map[string]json.RawMessage, result inter // - InstanceCatalogOfferingPrototypeCatalogOfferingByOffering // - InstanceCatalogOfferingPrototypeCatalogOfferingByVersion type InstanceCatalogOfferingPrototype struct { + // The billing plan to use for the catalog offering version. If unspecified, no billing + // plan will be used (free). Must be specified for catalog offering versions that require + // a billing plan to be used. + Plan CatalogOfferingVersionPlanIdentityIntf `json:"plan,omitempty"` + // Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) // offering by a unique property. Offering CatalogOfferingIdentityIntf `json:"offering,omitempty"` @@ -54132,6 +53976,11 @@ type InstanceCatalogOfferingPrototypeIntf interface { // UnmarshalInstanceCatalogOfferingPrototype unmarshals an instance of InstanceCatalogOfferingPrototype from the specified map of raw messages. func UnmarshalInstanceCatalogOfferingPrototype(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceCatalogOfferingPrototype) + err = core.UnmarshalModel(m, "plan", &obj.Plan, UnmarshalCatalogOfferingVersionPlanIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "plan-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) if err != nil { err = core.SDKErrorf(err, "", "offering-error", common.GetComponentInfo()) @@ -54629,13 +54478,6 @@ type InstanceGroup struct { InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` // The reasons for the current `lifecycle_state` (if any). -<<<<<<< Updated upstream -======= - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. ->>>>>>> Stashed changes LifecycleReasons []InstanceGroupLifecycleReason `json:"lifecycle_reasons" validate:"required"` // The lifecycle state of the instance group. @@ -54743,14 +54585,6 @@ func UnmarshalInstanceGroup(m map[string]json.RawMessage, result interface{}) (e err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalInstanceGroupLifecycleReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return - } err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolReference) if err != nil { err = core.SDKErrorf(err, "", "load_balancer_pool-error", common.GetComponentInfo()) @@ -54902,49 +54736,10 @@ func UnmarshalInstanceGroupCollectionNext(m map[string]json.RawMessage, result i return } -// InstanceGroupLifecycleReason : InstanceGroupLifecycleReason struct -type InstanceGroupLifecycleReason struct { - // A snake case string succinctly identifying the reason for this lifecycle state. - 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 InstanceGroupLifecycleReason.Code property. -// A snake case string succinctly identifying the reason for this lifecycle state. -const ( - InstanceGroupLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" -) - -// UnmarshalInstanceGroupLifecycleReason unmarshals an instance of InstanceGroupLifecycleReason from the specified map of raw messages. -func UnmarshalInstanceGroupLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupLifecycleReason) - 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 -} - // InstanceGroupLifecycleReason : InstanceGroupLifecycleReason struct type InstanceGroupLifecycleReason 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) // @@ -54961,12 +54756,14 @@ type InstanceGroupLifecycleReason struct { // Constants associated with the InstanceGroupLifecycleReason.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 ( + InstanceGroupLifecycleReasonCodeInternalErrorConst = "internal_error" InstanceGroupLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -54975,14 +54772,17 @@ func UnmarshalInstanceGroupLifecycleReason(m map[string]json.RawMessage, result obj := new(InstanceGroupLifecycleReason) 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)) @@ -57073,6 +56873,12 @@ func UnmarshalInstanceInitializationPassword(m map[string]json.RawMessage, resul // InstanceLifecycleReason : InstanceLifecycleReason struct type InstanceLifecycleReason struct { // A reason code for this lifecycle state: + // - `failed_registration`: the instance's registration to Resource Controller has + // failed. Delete the instance and provision it again. If the problem persists, + // contact IBM Support. + // - `internal_error`: internal error (contact IBM support) + // - `pending_registration`: the instance's registration to Resource Controller is + // being processed. // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM // support) // @@ -57089,12 +56895,21 @@ type InstanceLifecycleReason struct { // Constants associated with the InstanceLifecycleReason.Code property. // A reason code for this lifecycle state: +// - `failed_registration`: the instance's registration to Resource Controller has +// failed. Delete the instance and provision it again. If the problem persists, +// contact IBM Support. +// - `internal_error`: internal error (contact IBM support) +// - `pending_registration`: the instance's registration to Resource Controller is +// being processed. // - `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 ( + InstanceLifecycleReasonCodeFailedRegistrationConst = "failed_registration" + InstanceLifecycleReasonCodeInternalErrorConst = "internal_error" + InstanceLifecycleReasonCodePendingRegistrationConst = "pending_registration" InstanceLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -57537,6 +57352,19 @@ type InstanceNetworkAttachmentPrototypeVirtualNetworkInterface struct { // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,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 resource group to use for this virtual network interface. If unspecified, the // virtual server instance's resource group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -57559,6 +57387,24 @@ type InstanceNetworkAttachmentPrototypeVirtualNetworkInterface struct { CRN *string `json:"crn,omitempty"` } +// Constants associated with the InstanceNetworkAttachmentPrototypeVirtualNetworkInterface.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 ( + InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeAutoConst = "auto" + InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeDisabledConst = "disabled" + InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceProtocolStateFilteringModeEnabledConst = "enabled" +) + func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterface) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { return true } @@ -57600,6 +57446,11 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface(m map[st 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()) @@ -57732,6 +57583,18 @@ type InstancePatch struct { // The availability policy for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPatch `json:"availability_policy,omitempty"` + // The confidential compute mode to use for this virtual server instance. + // + // For this property to be changed, the virtual server instance `status` must be + // `stopping` or `stopped`. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + + // Indicates whether secure boot is enabled for this virtual server instance. + // + // For this property to be changed, the virtual server instance `status` must be + // `stopping` or `stopped`. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The metadata service configuration. MetadataService *InstanceMetadataServicePatch `json:"metadata_service,omitempty"` @@ -57767,6 +57630,16 @@ type InstancePatch struct { TotalVolumeBandwidth *int64 `json:"total_volume_bandwidth,omitempty"` } +// Constants associated with the InstancePatch.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// For this property to be changed, the virtual server instance `status` must be +// `stopping` or `stopped`. +const ( + InstancePatchConfidentialComputeModeDisabledConst = "disabled" + InstancePatchConfidentialComputeModeSgxConst = "sgx" +) + // UnmarshalInstancePatch unmarshals an instance of InstancePatch from the specified map of raw messages. func UnmarshalInstancePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstancePatch) @@ -57775,6 +57648,16 @@ func UnmarshalInstancePatch(m map[string]json.RawMessage, result interface{}) (e err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "metadata_service", &obj.MetadataService, UnmarshalInstanceMetadataServicePatch) if err != nil { err = core.SDKErrorf(err, "", "metadata_service-error", common.GetComponentInfo()) @@ -58042,6 +57925,8 @@ func UnmarshalInstancePlacementTargetPrototype(m map[string]json.RawMessage, res type InstanceProfile struct { Bandwidth InstanceProfileBandwidthIntf `json:"bandwidth" validate:"required"` + ConfidentialComputeModes *InstanceProfileSupportedConfidentialComputeModes `json:"confidential_compute_modes" validate:"required"` + // Collection of the instance profile's disks. Disks []InstanceProfileDisk `json:"disks" validate:"required"` @@ -58079,6 +57964,8 @@ type InstanceProfile struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` + SecureBootModes *InstanceProfileSupportedSecureBootModes `json:"secure_boot_modes" validate:"required"` + // The status of the instance profile: // - `previous`: This instance profile is an older revision, but remains provisionable and // usable. @@ -58132,6 +58019,11 @@ func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "bandwidth-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()) + return + } err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceProfileDisk) if err != nil { err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) @@ -58212,6 +58104,11 @@ func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "secure_boot_modes", &obj.SecureBootModes, UnmarshalInstanceProfileSupportedSecureBootModes) + if err != nil { + err = core.SDKErrorf(err, "", "secure_boot_modes-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) @@ -59270,6 +59167,105 @@ func UnmarshalInstanceProfileReservationTerms(m map[string]json.RawMessage, resu return } +// InstanceProfileSupportedConfidentialComputeModes : InstanceProfileSupportedConfidentialComputeModes struct +type InstanceProfileSupportedConfidentialComputeModes struct { + // The default confidential compute mode for this profile. + Default *string `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported confidential compute modes. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileSupportedConfidentialComputeModes.Default property. +// The default confidential compute mode for this profile. +const ( + InstanceProfileSupportedConfidentialComputeModesDefaultDisabledConst = "disabled" + InstanceProfileSupportedConfidentialComputeModesDefaultSgxConst = "sgx" +) + +// Constants associated with the InstanceProfileSupportedConfidentialComputeModes.Type property. +// The type for this profile field. +const ( + InstanceProfileSupportedConfidentialComputeModesTypeEnumConst = "enum" +) + +// Constants associated with the InstanceProfileSupportedConfidentialComputeModes.Values property. +// The confidential compute modes: +// - `sgx`: Intel Software Guard Extensions +// - `disabled`: No confidential compute functionality +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + InstanceProfileSupportedConfidentialComputeModesValuesDisabledConst = "disabled" + InstanceProfileSupportedConfidentialComputeModesValuesSgxConst = "sgx" +) + +// UnmarshalInstanceProfileSupportedConfidentialComputeModes unmarshals an instance of InstanceProfileSupportedConfidentialComputeModes from the specified map of raw messages. +func UnmarshalInstanceProfileSupportedConfidentialComputeModes(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileSupportedConfidentialComputeModes) + 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 +} + +// InstanceProfileSupportedSecureBootModes : InstanceProfileSupportedSecureBootModes struct +type InstanceProfileSupportedSecureBootModes struct { + // The default secure boot mode for this profile. + Default *bool `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported `enable_secure_boot` values for an instance using this profile. + Values []bool `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileSupportedSecureBootModes.Type property. +// The type for this profile field. +const ( + InstanceProfileSupportedSecureBootModesTypeEnumConst = "enum" +) + +// UnmarshalInstanceProfileSupportedSecureBootModes unmarshals an instance of InstanceProfileSupportedSecureBootModes from the specified map of raw messages. +func UnmarshalInstanceProfileSupportedSecureBootModes(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileSupportedSecureBootModes) + 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 +} + // InstanceProfileVcpu : InstanceProfileVcpu struct // Models which "extend" this model: // - InstanceProfileVcpuFixed @@ -59531,6 +59527,11 @@ type InstancePrototype struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not @@ -59539,6 +59540,11 @@ type InstancePrototype struct { // property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -59632,6 +59638,15 @@ type InstancePrototype struct { SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` } +// Constants associated with the InstancePrototype.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstancePrototypeConfidentialComputeModeDisabledConst = "disabled" + InstancePrototypeConfidentialComputeModeSgxConst = "sgx" +) + func (*InstancePrototype) isaInstancePrototype() bool { return true } @@ -59648,11 +59663,21 @@ func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{} err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -59868,24 +59893,27 @@ func UnmarshalInstanceReservationAffinity(m map[string]json.RawMessage, result i type InstanceReservationAffinityPatch struct { // The reservation affinity policy to use for this virtual server instance: // - `disabled`: Reservations will not be used - // - `manual`: Reservations in `pool` are available for use. + // - `manual`: Reservations in `pool` will be available for use + // + // The policy must be `disabled` if `placement_target` is set. Policy *string `json:"policy,omitempty"` // The pool of reservations available for use by this virtual server instance, replacing the existing pool of // reservations. // - // Specified reservations must have a `status` of `active`, and have the same `profile` and - // `zone` as this virtual server instance. + // Specified reservations must have a `status` of `active`, and have the same + // `profile` and `zone` as this virtual server instance. // - // If `policy` is `manual`, a pool must be specified with at least one reservation. If - // `policy` is `disabled` and a pool is specified, it must be empty. + // If `policy` is `manual`, `pool` must have one reservation. If `policy` is `disabled`, `pool` must be empty. Pool []ReservationIdentityIntf `json:"pool,omitempty"` } // Constants associated with the InstanceReservationAffinityPatch.Policy property. // The reservation affinity policy to use for this virtual server instance: // - `disabled`: Reservations will not be used -// - `manual`: Reservations in `pool` are available for use. +// - `manual`: Reservations in `pool` will be available for use +// +// The policy must be `disabled` if `placement_target` is set. const ( InstanceReservationAffinityPatchPolicyDisabledConst = "disabled" InstanceReservationAffinityPatchPolicyManualConst = "manual" @@ -59919,8 +59947,8 @@ type InstanceReservationAffinityPrototype struct { // The pool of reservations available for use by this virtual server instance. // - // Specified reservations must have a `status` of `active`, and have the same `profile` and - // `zone` as this virtual server instance. + // Specified reservations must have a `status` of `active`, and have the same + // `profile` and `zone` as this virtual server instance. // // If `policy` is `manual`, a pool must be specified with at least one reservation. If // `policy` is `disabled` and a pool is specified, it must be empty. @@ -60021,6 +60049,11 @@ type InstanceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -60035,6 +60068,11 @@ type InstanceTemplate struct { // property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The URL for this instance template. Href *string `json:"href" validate:"required"` @@ -60127,6 +60165,15 @@ type InstanceTemplate struct { CatalogOffering InstanceCatalogOfferingPrototypeIntf `json:"catalog_offering,omitempty"` } +// Constants associated with the InstanceTemplate.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplateConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplateConfidentialComputeModeSgxConst = "sgx" +) + func (*InstanceTemplate) isaInstanceTemplate() bool { return true } @@ -60143,6 +60190,11 @@ func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -60158,6 +60210,11 @@ func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -60441,6 +60498,11 @@ type InstanceTemplatePrototype struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not @@ -60449,6 +60511,11 @@ type InstanceTemplatePrototype struct { // property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -60542,6 +60609,15 @@ type InstanceTemplatePrototype struct { SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` } +// Constants associated with the InstanceTemplatePrototype.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplatePrototypeConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplatePrototypeConfidentialComputeModeSgxConst = "sgx" +) + func (*InstanceTemplatePrototype) isaInstanceTemplatePrototype() bool { return true } @@ -60558,11 +60634,21 @@ func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -62307,6 +62393,12 @@ type ListIkePolicyConnectionsOptions struct { // The IKE policy identifier. ID *string `json:"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 } @@ -62324,6 +62416,18 @@ func (_options *ListIkePolicyConnectionsOptions) SetID(id string) *ListIkePolicy return _options } +// SetStart : Allow user to set Start +func (_options *ListIkePolicyConnectionsOptions) SetStart(start string) *ListIkePolicyConnectionsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListIkePolicyConnectionsOptions) SetLimit(limit int64) *ListIkePolicyConnectionsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListIkePolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIkePolicyConnectionsOptions { options.Headers = param @@ -62387,6 +62491,10 @@ type ListImagesOptions struct { // Filters the collection to images with a `visibility` property matching the specified value. Visibility *string `json:"visibility,omitempty"` + // Filters the collection to images with a `user_data_format` property matching one of the specified comma-separated + // values. + UserDataFormat []string `json:"user_data_format,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -62409,6 +62517,13 @@ const ( ListImagesOptionsVisibilityPublicConst = "public" ) +// Constants associated with the ListImagesOptions.UserDataFormat property. +const ( + ListImagesOptionsUserDataFormatCloudInitConst = "cloud_init" + ListImagesOptionsUserDataFormatEsxiKickstartConst = "esxi_kickstart" + ListImagesOptionsUserDataFormatIpxeConst = "ipxe" +) + // NewListImagesOptions : Instantiate ListImagesOptions func (*VpcV1) NewListImagesOptions() *ListImagesOptions { return &ListImagesOptions{} @@ -62450,6 +62565,12 @@ func (_options *ListImagesOptions) SetVisibility(visibility string) *ListImagesO return _options } +// SetUserDataFormat : Allow user to set UserDataFormat +func (_options *ListImagesOptions) SetUserDataFormat(userDataFormat []string) *ListImagesOptions { + _options.UserDataFormat = userDataFormat + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListImagesOptions) SetHeaders(param map[string]string) *ListImagesOptions { options.Headers = param @@ -62951,45 +63072,45 @@ 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 resources with a `vpc.id` property matching the specified identifier. - VPCID *string `json:"vpc.id,omitempty"` - - // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. - VPCCRN *string `json:"vpc.crn,omitempty"` - - // Filters the collection to resources with a `vpc.name` property matching the exact specified name. - VPCName *string `json:"vpc.name,omitempty"` - - // Filters the collection to instances with a `dedicated_host.id` property matching the specified identifier. + // Filters the collection to resources with a `dedicated_host.id` property matching the specified identifier. DedicatedHostID *string `json:"dedicated_host.id,omitempty"` - // Filters the collection to instances with a `dedicated_host.crn` property matching the specified CRN. + // Filters the collection to resources with a `dedicated_host.crn` property matching the specified CRN. DedicatedHostCRN *string `json:"dedicated_host.crn,omitempty"` - // Filters the collection to instances with a `dedicated_host.name` property matching the exact specified name. + // Filters the collection to resources with a `dedicated_host.name` property matching the exact specified name. DedicatedHostName *string `json:"dedicated_host.name,omitempty"` - // Filters the collection to instances with a `placement_target.id` property matching the specified placement group + // Filters the collection to resources with a `placement_target.id` property matching the specified placement group // identifier. PlacementGroupID *string `json:"placement_group.id,omitempty"` - // Filters the collection to instances with a `placement_target.crn` property matching the specified placement group + // Filters the collection to resources with a `placement_target.crn` property matching the specified placement group // CRN. PlacementGroupCRN *string `json:"placement_group.crn,omitempty"` - // Filters the collection to instances with a `placement_target.name` property matching the exact specified placement + // Filters the collection to resources with a `placement_target.name` property matching the exact specified placement // group name. PlacementGroupName *string `json:"placement_group.name,omitempty"` - // Filters the collection to instances with a `reservation.id` property matching the specified identifier. + // Filters the collection to resources with a `reservation.id` property matching the specified identifier. ReservationID *string `json:"reservation.id,omitempty"` - // Filters the collection to instances with a `reservation.crn` property matching the specified CRN. + // Filters the collection to resources with a `reservation.crn` property matching the specified identifier. ReservationCRN *string `json:"reservation.crn,omitempty"` - // Filters the collection to resources with a `reservation.name` property matching the exact specified name. + // Filters the collection to resources with a `reservation.name` property matching the specified identifier. ReservationName *string `json:"reservation.name,omitempty"` + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. + VPCID *string `json:"vpc.id,omitempty"` + + // Filters the collection to resources with a `vpc.crn` property matching the specified CRN. + VPCCRN *string `json:"vpc.crn,omitempty"` + + // 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 Headers map[string]string } @@ -63023,24 +63144,6 @@ func (_options *ListInstancesOptions) SetName(name string) *ListInstancesOptions return _options } -// SetVPCID : Allow user to set VPCID -func (_options *ListInstancesOptions) SetVPCID(vpcID string) *ListInstancesOptions { - _options.VPCID = core.StringPtr(vpcID) - return _options -} - -// SetVPCCRN : Allow user to set VPCCRN -func (_options *ListInstancesOptions) SetVPCCRN(vpcCRN string) *ListInstancesOptions { - _options.VPCCRN = core.StringPtr(vpcCRN) - return _options -} - -// SetVPCName : Allow user to set VPCName -func (_options *ListInstancesOptions) SetVPCName(vpcName string) *ListInstancesOptions { - _options.VPCName = core.StringPtr(vpcName) - return _options -} - // SetDedicatedHostID : Allow user to set DedicatedHostID func (_options *ListInstancesOptions) SetDedicatedHostID(dedicatedHostID string) *ListInstancesOptions { _options.DedicatedHostID = core.StringPtr(dedicatedHostID) @@ -63095,6 +63198,24 @@ func (_options *ListInstancesOptions) SetReservationName(reservationName string) return _options } +// SetVPCID : Allow user to set VPCID +func (_options *ListInstancesOptions) SetVPCID(vpcID string) *ListInstancesOptions { + _options.VPCID = core.StringPtr(vpcID) + return _options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (_options *ListInstancesOptions) SetVPCCRN(vpcCRN string) *ListInstancesOptions { + _options.VPCCRN = core.StringPtr(vpcCRN) + return _options +} + +// SetVPCName : Allow user to set VPCName +func (_options *ListInstancesOptions) SetVPCName(vpcName string) *ListInstancesOptions { + _options.VPCName = core.StringPtr(vpcName) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListInstancesOptions) SetHeaders(param map[string]string) *ListInstancesOptions { options.Headers = param @@ -63141,6 +63262,12 @@ type ListIpsecPolicyConnectionsOptions struct { // The IPsec policy identifier. ID *string `json:"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 } @@ -63158,6 +63285,18 @@ func (_options *ListIpsecPolicyConnectionsOptions) SetID(id string) *ListIpsecPo return _options } +// SetStart : Allow user to set Start +func (_options *ListIpsecPolicyConnectionsOptions) SetStart(start string) *ListIpsecPolicyConnectionsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListIpsecPolicyConnectionsOptions) SetLimit(limit int64) *ListIpsecPolicyConnectionsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + // SetHeaders : Allow user to set Headers func (options *ListIpsecPolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIpsecPolicyConnectionsOptions { options.Headers = param @@ -63990,6 +64129,52 @@ func (options *ListSecurityGroupsOptions) SetHeaders(param map[string]string) *L return options } +// ListShareAccessorBindingsOptions : The ListShareAccessorBindings options. +type ListShareAccessorBindingsOptions struct { + // The file share identifier. + ID *string `json:"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 +} + +// NewListShareAccessorBindingsOptions : Instantiate ListShareAccessorBindingsOptions +func (*VpcV1) NewListShareAccessorBindingsOptions(id string) *ListShareAccessorBindingsOptions { + return &ListShareAccessorBindingsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListShareAccessorBindingsOptions) SetID(id string) *ListShareAccessorBindingsOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListShareAccessorBindingsOptions) SetStart(start string) *ListShareAccessorBindingsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListShareAccessorBindingsOptions) SetLimit(limit int64) *ListShareAccessorBindingsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListShareAccessorBindingsOptions) SetHeaders(param map[string]string) *ListShareAccessorBindingsOptions { + options.Headers = param + return options +} + // ListShareMountTargetsOptions : The ListShareMountTargets options. type ListShareMountTargetsOptions struct { // The file share identifier. @@ -65381,8 +65566,8 @@ func (options *ListVpcsOptions) SetHeaders(param map[string]string) *ListVpcsOpt return options } -// ListVPNGatewayConnectionLocalCIDRsOptions : The ListVPNGatewayConnectionLocalCIDRs options. -type ListVPNGatewayConnectionLocalCIDRsOptions struct { +// ListVPNGatewayConnectionsLocalCIDRsOptions : The ListVPNGatewayConnectionsLocalCIDRs options. +type ListVPNGatewayConnectionsLocalCIDRsOptions struct { // The VPN gateway identifier. VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` @@ -65393,110 +65578,128 @@ type ListVPNGatewayConnectionLocalCIDRsOptions struct { Headers map[string]string } -// NewListVPNGatewayConnectionLocalCIDRsOptions : Instantiate ListVPNGatewayConnectionLocalCIDRsOptions -func (*VpcV1) NewListVPNGatewayConnectionLocalCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionLocalCIDRsOptions { - return &ListVPNGatewayConnectionLocalCIDRsOptions{ +// NewListVPNGatewayConnectionsLocalCIDRsOptions : Instantiate ListVPNGatewayConnectionsLocalCIDRsOptions +func (*VpcV1) NewListVPNGatewayConnectionsLocalCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionsLocalCIDRsOptions { + return &ListVPNGatewayConnectionsLocalCIDRsOptions{ VPNGatewayID: core.StringPtr(vpnGatewayID), ID: core.StringPtr(id), } } // SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *ListVPNGatewayConnectionLocalCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionLocalCIDRsOptions { +func (_options *ListVPNGatewayConnectionsLocalCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsLocalCIDRsOptions { _options.VPNGatewayID = core.StringPtr(vpnGatewayID) return _options } // SetID : Allow user to set ID -func (_options *ListVPNGatewayConnectionLocalCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionLocalCIDRsOptions { +func (_options *ListVPNGatewayConnectionsLocalCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionsLocalCIDRsOptions { _options.ID = core.StringPtr(id) return _options } // SetHeaders : Allow user to set Headers -func (options *ListVPNGatewayConnectionLocalCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionLocalCIDRsOptions { +func (options *ListVPNGatewayConnectionsLocalCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsLocalCIDRsOptions { options.Headers = param return options } -// ListVPNGatewayConnectionPeerCIDRsOptions : The ListVPNGatewayConnectionPeerCIDRs options. -type ListVPNGatewayConnectionPeerCIDRsOptions struct { +// ListVPNGatewayConnectionsOptions : The ListVPNGatewayConnections options. +type ListVPNGatewayConnectionsOptions 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="` + // 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 VPN gateway connections with a `status` property matching the specified value. + Status *string `json:"status,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewListVPNGatewayConnectionPeerCIDRsOptions : Instantiate ListVPNGatewayConnectionPeerCIDRsOptions -func (*VpcV1) NewListVPNGatewayConnectionPeerCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionPeerCIDRsOptions { - return &ListVPNGatewayConnectionPeerCIDRsOptions{ +// Constants associated with the ListVPNGatewayConnectionsOptions.Status property. +// Filters the collection to VPN gateway connections with a `status` property matching the specified value. +const ( + ListVPNGatewayConnectionsOptionsStatusDownConst = "down" + ListVPNGatewayConnectionsOptionsStatusUpConst = "up" +) + +// NewListVPNGatewayConnectionsOptions : Instantiate ListVPNGatewayConnectionsOptions +func (*VpcV1) NewListVPNGatewayConnectionsOptions(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { + return &ListVPNGatewayConnectionsOptions{ VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), } } // SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *ListVPNGatewayConnectionPeerCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionPeerCIDRsOptions { +func (_options *ListVPNGatewayConnectionsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { _options.VPNGatewayID = core.StringPtr(vpnGatewayID) return _options } -// SetID : Allow user to set ID -func (_options *ListVPNGatewayConnectionPeerCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionPeerCIDRsOptions { - _options.ID = core.StringPtr(id) +// SetStart : Allow user to set Start +func (_options *ListVPNGatewayConnectionsOptions) SetStart(start string) *ListVPNGatewayConnectionsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNGatewayConnectionsOptions) SetLimit(limit int64) *ListVPNGatewayConnectionsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetStatus : Allow user to set Status +func (_options *ListVPNGatewayConnectionsOptions) SetStatus(status string) *ListVPNGatewayConnectionsOptions { + _options.Status = core.StringPtr(status) return _options } // SetHeaders : Allow user to set Headers -func (options *ListVPNGatewayConnectionPeerCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionPeerCIDRsOptions { +func (options *ListVPNGatewayConnectionsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsOptions { options.Headers = param return options } -// ListVPNGatewayConnectionsOptions : The ListVPNGatewayConnections options. -type ListVPNGatewayConnectionsOptions struct { +// ListVPNGatewayConnectionsPeerCIDRsOptions : The ListVPNGatewayConnectionsPeerCIDRs options. +type ListVPNGatewayConnectionsPeerCIDRsOptions struct { // The VPN gateway identifier. VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - // Filters the collection to VPN gateway connections with a `status` property matching the specified value. - Status *string `json:"status,omitempty"` + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests Headers map[string]string } -// Constants associated with the ListVPNGatewayConnectionsOptions.Status property. -// Filters the collection to VPN gateway connections with a `status` property matching the specified value. -const ( - ListVPNGatewayConnectionsOptionsStatusDownConst = "down" - ListVPNGatewayConnectionsOptionsStatusUpConst = "up" -) - -// NewListVPNGatewayConnectionsOptions : Instantiate ListVPNGatewayConnectionsOptions -func (*VpcV1) NewListVPNGatewayConnectionsOptions(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { - return &ListVPNGatewayConnectionsOptions{ +// NewListVPNGatewayConnectionsPeerCIDRsOptions : Instantiate ListVPNGatewayConnectionsPeerCIDRsOptions +func (*VpcV1) NewListVPNGatewayConnectionsPeerCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionsPeerCIDRsOptions { + return &ListVPNGatewayConnectionsPeerCIDRsOptions{ VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), } } // SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *ListVPNGatewayConnectionsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { +func (_options *ListVPNGatewayConnectionsPeerCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsPeerCIDRsOptions { _options.VPNGatewayID = core.StringPtr(vpnGatewayID) return _options } -// SetStatus : Allow user to set Status -func (_options *ListVPNGatewayConnectionsOptions) SetStatus(status string) *ListVPNGatewayConnectionsOptions { - _options.Status = core.StringPtr(status) +// SetID : Allow user to set ID +func (_options *ListVPNGatewayConnectionsPeerCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionsPeerCIDRsOptions { + _options.ID = core.StringPtr(id) return _options } // SetHeaders : Allow user to set Headers -func (options *ListVPNGatewayConnectionsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsOptions { +func (options *ListVPNGatewayConnectionsPeerCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsPeerCIDRsOptions { options.Headers = param return options } @@ -66158,7 +66361,7 @@ func UnmarshalLoadBalancerCollectionNext(m map[string]json.RawMessage, result in // `lb.appdomain.cloud`. type LoadBalancerDns struct { // The DNS instance associated with this load balancer. - Instance *DnsInstanceReference `json:"instance" validate:"required"` + Instance *DnsInstanceReferenceLoadBalancerDnsContext `json:"instance" validate:"required"` // The DNS zone associated with this load balancer. Zone *DnsZoneReference `json:"zone" validate:"required"` @@ -66167,7 +66370,7 @@ type LoadBalancerDns struct { // UnmarshalLoadBalancerDns unmarshals an instance of LoadBalancerDns from the specified map of raw messages. func UnmarshalLoadBalancerDns(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerDns) - err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceReference) + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalDnsInstanceReferenceLoadBalancerDnsContext) if err != nil { err = core.SDKErrorf(err, "", "instance-error", common.GetComponentInfo()) return @@ -66535,10 +66738,12 @@ func UnmarshalLoadBalancerListenerDefaultPoolPatch(m map[string]json.RawMessage, obj := new(LoadBalancerListenerDefaultPoolPatch) 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)) @@ -67027,10 +67232,7 @@ type LoadBalancerListenerPolicyPatch struct { // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPatch`. -<<<<<<< Updated upstream // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. -======= ->>>>>>> Stashed changes Target LoadBalancerListenerPolicyTargetPatchIntf `json:"target,omitempty"` } @@ -67098,10 +67300,7 @@ type LoadBalancerListenerPolicyPrototype struct { // - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. -<<<<<<< Updated upstream // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. -======= ->>>>>>> Stashed changes Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` } @@ -67668,14 +67867,6 @@ func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, res err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } -<<<<<<< Updated upstream -======= - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) - return - } ->>>>>>> Stashed changes err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerReference) if err != nil { err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) @@ -67688,6 +67879,7 @@ func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, res } err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67695,15 +67887,9 @@ func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, res } // LoadBalancerListenerPolicyTargetPatch : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. -<<<<<<< Updated upstream // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPatch`. // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. -======= -// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPatch`. -// - If `action` is `https_redirect`, specify a -// `LoadBalancerListenerPolicyHTTPSRedirectPatch`. ->>>>>>> Stashed changes // Models which "extend" this model: // - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity // - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyHTTPSRedirectPatch @@ -67754,14 +67940,6 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } -<<<<<<< Updated upstream -======= - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) - return - } ->>>>>>> Stashed changes err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) @@ -67774,6 +67952,7 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage } err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -67781,15 +67960,9 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage } // LoadBalancerListenerPolicyTargetPrototype : - If `action` is `forward`, specify a `LoadBalancerPoolIdentity`. -<<<<<<< Updated upstream // - If `action` is `https_redirect`, specify a // `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. // - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. -======= -// - If `action` is `redirect`, specify a `LoadBalancerListenerPolicyRedirectURLPrototype`. -// - If `action` is `https_redirect`, specify a -// `LoadBalancerListenerPolicyHTTPSRedirectPrototype`. ->>>>>>> Stashed changes // Models which "extend" this model: // - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity // - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyHTTPSRedirectPrototype @@ -67840,14 +68013,6 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototype(m map[string]json.RawMes err = core.SDKErrorf(err, "", "http_status_code-error", common.GetComponentInfo()) return } -<<<<<<< Updated upstream -======= - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) - return - } ->>>>>>> Stashed changes err = core.UnmarshalModel(m, "listener", &obj.Listener, UnmarshalLoadBalancerListenerIdentity) if err != nil { err = core.SDKErrorf(err, "", "listener-error", common.GetComponentInfo()) @@ -67860,6 +68025,7 @@ func UnmarshalLoadBalancerListenerPolicyTargetPrototype(m map[string]json.RawMes } err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -68309,6 +68475,9 @@ type LoadBalancerPool struct { ProxyProtocol *string `json:"proxy_protocol" validate:"required"` // The session persistence of this pool. + // + // If absent, session persistence will be disabled, and traffic will be distributed + // across backend server members of the pool. SessionPersistence *LoadBalancerPoolSessionPersistence `json:"session_persistence,omitempty"` } @@ -69500,14 +69669,8 @@ type LoadBalancerPoolSessionPersistence struct { // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` // protocols. // -<<<<<<< Updated upstream // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -======= - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the - // unexpected property value was encountered. ->>>>>>> Stashed changes Type *string `json:"type" validate:"required"` } @@ -69515,14 +69678,8 @@ type LoadBalancerPoolSessionPersistence struct { // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` // protocols. // -<<<<<<< Updated upstream // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. -======= -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the -// unexpected property value was encountered. ->>>>>>> Stashed changes const ( LoadBalancerPoolSessionPersistenceTypeAppCookieConst = "app_cookie" LoadBalancerPoolSessionPersistenceTypeHTTPCookieConst = "http_cookie" @@ -72235,6 +72392,9 @@ func (options *ObsoleteImageOptions) SetHeaders(param map[string]string) *Obsole // OperatingSystem : OperatingSystem struct type OperatingSystem struct { + // Users may create new images with this operating system. + AllowUserImageCreation *bool `json:"allow_user_image_creation" validate:"required"` + // The operating system architecture. Architecture *string `json:"architecture" validate:"required"` @@ -72253,6 +72413,13 @@ type OperatingSystem struct { // The globally unique name for this operating system. Name *string `json:"name" validate:"required"` + // The user data format for this operating system: + // - `cloud_init`: `user_data` will be interpreted according to the cloud-init standard + // - `esxi_kickstart`: `user_data` will be interpreted as a VMware ESXi installation script + // - `ipxe`: `user_data` will be interpreted as a single URL to an iPXE script or as the + // text of an iPXE script. + UserDataFormat *string `json:"user_data_format" validate:"required"` + // The vendor of the operating system. Vendor *string `json:"vendor" validate:"required"` @@ -72260,9 +72427,26 @@ type OperatingSystem struct { Version *string `json:"version" validate:"required"` } +// Constants associated with the OperatingSystem.UserDataFormat property. +// The user data format for this operating system: +// - `cloud_init`: `user_data` will be interpreted according to the cloud-init standard +// - `esxi_kickstart`: `user_data` will be interpreted as a VMware ESXi installation script +// - `ipxe`: `user_data` will be interpreted as a single URL to an iPXE script or as the +// text of an iPXE script. +const ( + OperatingSystemUserDataFormatCloudInitConst = "cloud_init" + OperatingSystemUserDataFormatEsxiKickstartConst = "esxi_kickstart" + OperatingSystemUserDataFormatIpxeConst = "ipxe" +) + // UnmarshalOperatingSystem unmarshals an instance of OperatingSystem from the specified map of raw messages. func UnmarshalOperatingSystem(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(OperatingSystem) + err = core.UnmarshalPrimitive(m, "allow_user_image_creation", &obj.AllowUserImageCreation) + if err != nil { + err = core.SDKErrorf(err, "", "allow_user_image_creation-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) if err != nil { err = core.SDKErrorf(err, "", "architecture-error", common.GetComponentInfo()) @@ -72293,6 +72477,11 @@ func UnmarshalOperatingSystem(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "user_data_format", &obj.UserDataFormat) + if err != nil { + err = core.SDKErrorf(err, "", "user_data_format-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "vendor", &obj.Vendor) if err != nil { err = core.SDKErrorf(err, "", "vendor-error", common.GetComponentInfo()) @@ -73561,118 +73750,98 @@ func (options *RemoveVirtualNetworkInterfaceIPOptions) SetHeaders(param map[stri return options } -// RemoveVPNGatewayConnectionLocalCIDROptions : The RemoveVPNGatewayConnectionLocalCIDR options. -type RemoveVPNGatewayConnectionLocalCIDROptions struct { +// RemoveVPNGatewayConnectionsLocalCIDROptions : The RemoveVPNGatewayConnectionsLocalCIDR options. +type RemoveVPNGatewayConnectionsLocalCIDROptions 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 address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" 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 } -// NewRemoveVPNGatewayConnectionLocalCIDROptions : Instantiate RemoveVPNGatewayConnectionLocalCIDROptions -func (*VpcV1) NewRemoveVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *RemoveVPNGatewayConnectionLocalCIDROptions { - return &RemoveVPNGatewayConnectionLocalCIDROptions{ +// NewRemoveVPNGatewayConnectionsLocalCIDROptions : Instantiate RemoveVPNGatewayConnectionsLocalCIDROptions +func (*VpcV1) NewRemoveVPNGatewayConnectionsLocalCIDROptions(vpnGatewayID string, id string, cidr string) *RemoveVPNGatewayConnectionsLocalCIDROptions { + return &RemoveVPNGatewayConnectionsLocalCIDROptions{ VPNGatewayID: core.StringPtr(vpnGatewayID), ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), + CIDR: core.StringPtr(cidr), } } // SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionLocalCIDROptions { +func (_options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionsLocalCIDROptions { _options.VPNGatewayID = core.StringPtr(vpnGatewayID) return _options } // SetID : Allow user to set ID -func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionLocalCIDROptions { +func (_options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionsLocalCIDROptions { _options.ID = core.StringPtr(id) return _options } -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *RemoveVPNGatewayConnectionLocalCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} - -// SetPrefixLength : Allow user to set PrefixLength -func (_options *RemoveVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *RemoveVPNGatewayConnectionLocalCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) +// SetCIDR : Allow user to set CIDR +func (_options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetCIDR(cidr string) *RemoveVPNGatewayConnectionsLocalCIDROptions { + _options.CIDR = core.StringPtr(cidr) return _options } // SetHeaders : Allow user to set Headers -func (options *RemoveVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionLocalCIDROptions { +func (options *RemoveVPNGatewayConnectionsLocalCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionsLocalCIDROptions { options.Headers = param return options } -// RemoveVPNGatewayConnectionPeerCIDROptions : The RemoveVPNGatewayConnectionPeerCIDR options. -type RemoveVPNGatewayConnectionPeerCIDROptions struct { +// RemoveVPNGatewayConnectionsPeerCIDROptions : The RemoveVPNGatewayConnectionsPeerCIDR options. +type RemoveVPNGatewayConnectionsPeerCIDROptions 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 address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" 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 } -// NewRemoveVPNGatewayConnectionPeerCIDROptions : Instantiate RemoveVPNGatewayConnectionPeerCIDROptions -func (*VpcV1) NewRemoveVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *RemoveVPNGatewayConnectionPeerCIDROptions { - return &RemoveVPNGatewayConnectionPeerCIDROptions{ +// NewRemoveVPNGatewayConnectionsPeerCIDROptions : Instantiate RemoveVPNGatewayConnectionsPeerCIDROptions +func (*VpcV1) NewRemoveVPNGatewayConnectionsPeerCIDROptions(vpnGatewayID string, id string, cidr string) *RemoveVPNGatewayConnectionsPeerCIDROptions { + return &RemoveVPNGatewayConnectionsPeerCIDROptions{ VPNGatewayID: core.StringPtr(vpnGatewayID), ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), + CIDR: core.StringPtr(cidr), } } // SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionPeerCIDROptions { +func (_options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionsPeerCIDROptions { _options.VPNGatewayID = core.StringPtr(vpnGatewayID) return _options } // SetID : Allow user to set ID -func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionPeerCIDROptions { +func (_options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionsPeerCIDROptions { _options.ID = core.StringPtr(id) return _options } -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *RemoveVPNGatewayConnectionPeerCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} - -// SetPrefixLength : Allow user to set PrefixLength -func (_options *RemoveVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *RemoveVPNGatewayConnectionPeerCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) +// SetCIDR : Allow user to set CIDR +func (_options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetCIDR(cidr string) *RemoveVPNGatewayConnectionsPeerCIDROptions { + _options.CIDR = core.StringPtr(cidr) return _options } // SetHeaders : Allow user to set Headers -func (options *RemoveVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionPeerCIDROptions { +func (options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionsPeerCIDROptions { options.Headers = param return options } @@ -74446,8 +74615,6 @@ type ReservationPatch struct { // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this // reservation. - // - // The profile can only be changed for a reservation with a `status` of `inactive`. Profile *ReservationProfilePatch `json:"profile,omitempty"` } @@ -74532,8 +74699,6 @@ func UnmarshalReservationProfile(m map[string]json.RawMessage, result interface{ } // ReservationProfilePatch : The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this reservation. -// -// The profile can only be changed for a reservation with a `status` of `inactive`. type ReservationProfilePatch struct { // The globally unique name of the profile. Name *string `json:"name,omitempty"` @@ -76801,8 +76966,8 @@ func UnmarshalRouteReferenceDeleted(m map[string]json.RawMessage, result interfa 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 `vpn_server` value is supported, but filter - // support is expected to expand in the future. + // 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. 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 @@ -77842,10 +78007,12 @@ func UnmarshalSecurityGroupRuleLocal(m map[string]json.RawMessage, result interf obj := new(SecurityGroupRuleLocal) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -77887,10 +78054,12 @@ func UnmarshalSecurityGroupRuleLocalPatch(m map[string]json.RawMessage, result i obj := new(SecurityGroupRuleLocalPatch) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -77932,10 +78101,12 @@ func UnmarshalSecurityGroupRuleLocalPrototype(m map[string]json.RawMessage, resu obj := new(SecurityGroupRuleLocalPrototype) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -78028,6 +78199,7 @@ func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interf } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPatch) if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) @@ -78688,6 +78860,21 @@ type Share struct { // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AccessControlMode *string `json:"access_control_mode" validate:"required"` + // The accessor binding role of this file share: + // - `none`: This file share is not participating in access with another file share + // - `origin`: This file share is the origin for one or more file shares + // (which may be in other accounts) + // - `accessor`: This file share is providing access to another file share + // (which may be in another account). + AccessorBindingRole *string `json:"accessor_binding_role" validate:"required"` + + // The accessor bindings for this file share. Each accessor binding identifies a resource (possibly in another account) + // with access to this file share's data. + AccessorBindings []ShareAccessorBindingReference `json:"accessor_bindings" validate:"required"` + + // The transit encryption modes allowed for this share. + AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes" validate:"required"` + // The date and time that the file share is created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -78725,6 +78912,9 @@ type Share struct { // one replication sync has been completed. LatestSync *ShareLatestSync `json:"latest_sync,omitempty"` + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []ShareLifecycleReason `json:"lifecycle_reasons" validate:"required"` + // The lifecycle state of the file share. LifecycleState *string `json:"lifecycle_state" validate:"required"` @@ -78734,6 +78924,11 @@ type Share struct { // The name for this share. The name is unique across all shares in the region. Name *string `json:"name" validate:"required"` + // The origin share this accessor share is referring to. + // + // This property will be present when the `accessor_binding_role` is `accessor`. + OriginShare *ShareReference `json:"origin_share,omitempty"` + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) for // this file share. Profile *ShareProfileReference `json:"profile" validate:"required"` @@ -78811,6 +79006,31 @@ const ( ShareAccessControlModeVPCConst = "vpc" ) +// Constants associated with the Share.AccessorBindingRole property. +// The accessor binding role of this file share: +// - `none`: This file share is not participating in access with another file share +// - `origin`: This file share is the origin for one or more file shares +// (which may be in other accounts) +// - `accessor`: This file share is providing access to another file share +// (which may be in another account). +const ( + ShareAccessorBindingRoleAccessorConst = "accessor" + ShareAccessorBindingRoleNoneConst = "none" + ShareAccessorBindingRoleOriginConst = "origin" +) + +// Constants associated with the Share.AllowedTransitEncryptionModes property. +// An allowed transit encryption mode for this share. +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + ShareAllowedTransitEncryptionModesNoneConst = "none" + ShareAllowedTransitEncryptionModesUserManagedConst = "user_managed" +) + // Constants associated with the Share.Encryption property. // The type of encryption used for this file share. const ( @@ -78880,6 +79100,21 @@ func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error err = core.SDKErrorf(err, "", "access_control_mode-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "accessor_binding_role", &obj.AccessorBindingRole) + if err != nil { + err = core.SDKErrorf(err, "", "accessor_binding_role-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "accessor_bindings", &obj.AccessorBindings, UnmarshalShareAccessorBindingReference) + if err != nil { + err = core.SDKErrorf(err, "", "accessor_bindings-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "allowed_transit_encryption_modes", &obj.AllowedTransitEncryptionModes) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_transit_encryption_modes-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -78925,6 +79160,11 @@ func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error err = core.SDKErrorf(err, "", "latest_sync-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalShareLifecycleReason) + 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()) @@ -78940,6 +79180,11 @@ func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "origin_share", &obj.OriginShare, UnmarshalShareReference) + if err != nil { + err = core.SDKErrorf(err, "", "origin_share-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileReference) if err != nil { err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) @@ -79004,6 +79249,315 @@ func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error return } +// ShareAccessorBinding : ShareAccessorBinding struct +type ShareAccessorBinding struct { + // The accessor for this share accessor binding. + // + // The resources supported by this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Accessor ShareAccessorBindingAccessorIntf `json:"accessor" validate:"required"` + + // The date and time that the share accessor binding was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this share accessor binding. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this share accessor binding. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the file share accessor binding. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ShareAccessorBinding.LifecycleState property. +// The lifecycle state of the file share accessor binding. +const ( + ShareAccessorBindingLifecycleStateDeletingConst = "deleting" + ShareAccessorBindingLifecycleStateFailedConst = "failed" + ShareAccessorBindingLifecycleStatePendingConst = "pending" + ShareAccessorBindingLifecycleStateStableConst = "stable" + ShareAccessorBindingLifecycleStateSuspendedConst = "suspended" + ShareAccessorBindingLifecycleStateUpdatingConst = "updating" + ShareAccessorBindingLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the ShareAccessorBinding.ResourceType property. +// The resource type. +const ( + ShareAccessorBindingResourceTypeShareAccessorBindingConst = "share_accessor_binding" +) + +// UnmarshalShareAccessorBinding unmarshals an instance of ShareAccessorBinding from the specified map of raw messages. +func UnmarshalShareAccessorBinding(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareAccessorBinding) + err = core.UnmarshalModel(m, "accessor", &obj.Accessor, UnmarshalShareAccessorBindingAccessor) + if err != nil { + err = core.SDKErrorf(err, "", "accessor-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, "lifecycle_state", &obj.LifecycleState) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_state-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 +} + +// ShareAccessorBindingAccessor : The accessor for this share accessor binding. +// +// 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: +// - ShareAccessorBindingAccessorShareReference +// - ShareAccessorBindingAccessorWatsonxMachineLearningReference +type ShareAccessorBindingAccessor struct { + // The CRN for this file share. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ShareReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this file share. + Href *string `json:"href,omitempty"` + + // The unique identifier for this file share. + ID *string `json:"id,omitempty"` + + // The name for this share. The name is unique across all shares 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 *ShareRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the ShareAccessorBindingAccessor.ResourceType property. +// The resource type. +const ( + ShareAccessorBindingAccessorResourceTypeShareConst = "share" +) + +func (*ShareAccessorBindingAccessor) isaShareAccessorBindingAccessor() bool { + return true +} + +type ShareAccessorBindingAccessorIntf interface { + isaShareAccessorBindingAccessor() bool +} + +// UnmarshalShareAccessorBindingAccessor unmarshals an instance of ShareAccessorBindingAccessor from the specified map of raw messages. +func UnmarshalShareAccessorBindingAccessor(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareAccessorBindingAccessor) + 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, UnmarshalShareReferenceDeleted) + 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, UnmarshalShareRemote) + 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 +} + +// ShareAccessorBindingCollection : ShareAccessorBindingCollection struct +type ShareAccessorBindingCollection struct { + // Collection of share accessor bindings. + AccessorBindings []ShareAccessorBinding `json:"accessor_bindings" validate:"required"` + + // A link to the first page of resources. + First *ShareAccessorBindingCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalShareAccessorBindingCollection unmarshals an instance of ShareAccessorBindingCollection from the specified map of raw messages. +func UnmarshalShareAccessorBindingCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareAccessorBindingCollection) + err = core.UnmarshalModel(m, "accessor_bindings", &obj.AccessorBindings, UnmarshalShareAccessorBinding) + if err != nil { + err = core.SDKErrorf(err, "", "accessor_bindings-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalShareAccessorBindingCollectionFirst) + 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, UnmarshalShareAccessorBindingCollectionNext) + 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 *ShareAccessorBindingCollection) 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 +} + +// 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. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this share accessor binding. + ID *string `json:"id" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ShareAccessorBindingReference.ResourceType property. +// The resource type. +const ( + ShareAccessorBindingReferenceResourceTypeShareAccessorBindingConst = "share_accessor_binding" +) + +// UnmarshalShareAccessorBindingReference unmarshals an instance of ShareAccessorBindingReference from the specified map of raw messages. +func UnmarshalShareAccessorBindingReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareAccessorBindingReference) + 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, "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 +} + // ShareCollection : ShareCollection struct type ShareCollection struct { // A link to the first page of resources. @@ -79343,6 +79897,62 @@ func UnmarshalShareLatestSync(m map[string]json.RawMessage, result interface{}) return } +// ShareLifecycleReason : ShareLifecycleReason struct +type ShareLifecycleReason struct { + // A reason code for this lifecycle state: + // - `origin_share_access_revoked`: The resource has been revoked by the share owner + // - `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 ShareLifecycleReason.Code property. +// A reason code for this lifecycle state: +// - `origin_share_access_revoked`: The resource has been revoked by the share owner +// - `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 ( + ShareLifecycleReasonCodeInternalErrorConst = "internal_error" + ShareLifecycleReasonCodeOriginShareAccessRevokedConst = "origin_share_access_revoked" + ShareLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalShareLifecycleReason unmarshals an instance of ShareLifecycleReason from the specified map of raw messages. +func UnmarshalShareLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareLifecycleReason) + 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 +} + // ShareMountTarget : ShareMountTarget struct type ShareMountTarget struct { // The access control mode for the share: @@ -79680,6 +80290,9 @@ type ShareMountTargetPrototype struct { // - `none`: Not encrypted in transit. // - `user_managed`: Encrypted in transit using an instance identity certificate. The // `access_control_mode` for the share must be `security_group`. + // + // The specified value must be listed in the share's + // `allowed_transit_encryption_modes`. TransitEncryption *string `json:"transit_encryption,omitempty"` VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface,omitempty"` @@ -79693,6 +80306,9 @@ type ShareMountTargetPrototype struct { // - `none`: Not encrypted in transit. // - `user_managed`: Encrypted in transit using an instance identity certificate. The // `access_control_mode` for the share must be `security_group`. +// +// The specified value must be listed in the share's +// `allowed_transit_encryption_modes`. const ( ShareMountTargetPrototypeTransitEncryptionNoneConst = "none" ShareMountTargetPrototypeTransitEncryptionUserManagedConst = "user_managed" @@ -79861,6 +80477,19 @@ type ShareMountTargetVirtualNetworkInterfacePrototype struct { // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,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 resource group to use for this virtual network interface. If unspecified, the // share's resource group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -79883,6 +80512,24 @@ type ShareMountTargetVirtualNetworkInterfacePrototype struct { CRN *string `json:"crn,omitempty"` } +// Constants associated with the ShareMountTargetVirtualNetworkInterfacePrototype.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 ( + ShareMountTargetVirtualNetworkInterfacePrototypeProtocolStateFilteringModeAutoConst = "auto" + ShareMountTargetVirtualNetworkInterfacePrototypeProtocolStateFilteringModeDisabledConst = "disabled" + ShareMountTargetVirtualNetworkInterfacePrototypeProtocolStateFilteringModeEnabledConst = "enabled" +) + func (*ShareMountTargetVirtualNetworkInterfacePrototype) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { return true } @@ -79924,6 +80571,11 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototype(m map[string]json 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()) @@ -79966,15 +80618,20 @@ type SharePatch struct { // mount target control access to the mount target. // - `vpc`: All clients in the VPC for a mount target have access to the mount target. // - // For this property to be changed, the share must have no mount targets and - // `replication_role` must be `none`. + // For this property to be changed, the share must have no mount targets, + // `replication_role` must be `none` and `accessor_binding_role` must not be `accessor`. AccessControlMode *string `json:"access_control_mode,omitempty"` - // The maximum input/output operations per second (IOPS) for the file share. The value must be in the range supported - // by the share's size. + // The transit encryption modes to allow for this share. + // + // For this property to be updated, the `accessor_binding_role` must be `none`. + AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes,omitempty"` + + // The maximum input/output operations per second (IOPS) for the file share. In addition, each client accessing the + // share will be restricted to 48,000 IOPS. // - // For this property to be changed, the share `lifecycle_state` must be `stable` and - // `replication_role` must not be `replica`. + // The maximum IOPS for a share may increase in the future. For this property to be changed, the share + // `accessor_binding_role` must not be `accessor`. Iops *int64 `json:"iops,omitempty"` // The name for this share. The name must not be used by another share in the region. @@ -79995,8 +80652,10 @@ type SharePatch struct { // The size of the file share rounded up to the next gigabyte. The value must not be less than the share's current // size, and must not exceed the maximum supported by the share's profile and IOPS. // - // For this property to be changed, the share `lifecycle_state` must be `stable` and - // `replication_role` must not be `replica`. + // For this property to be changed: + // - The share `lifecycle_state` must be `stable` + // - The share `replication_role` must not be `replica` + // - The share `accessor_binding_role` must not be `accessor`. Size *int64 `json:"size,omitempty"` // Tags for this resource. @@ -80010,13 +80669,25 @@ type SharePatch struct { // mount target control access to the mount target. // - `vpc`: All clients in the VPC for a mount target have access to the mount target. // -// For this property to be changed, the share must have no mount targets and -// `replication_role` must be `none`. +// For this property to be changed, the share must have no mount targets, +// `replication_role` must be `none` and `accessor_binding_role` must not be `accessor`. const ( SharePatchAccessControlModeSecurityGroupConst = "security_group" SharePatchAccessControlModeVPCConst = "vpc" ) +// Constants associated with the SharePatch.AllowedTransitEncryptionModes property. +// An allowed transit encryption mode for this share. +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + SharePatchAllowedTransitEncryptionModesNoneConst = "none" + SharePatchAllowedTransitEncryptionModesUserManagedConst = "user_managed" +) + // UnmarshalSharePatch unmarshals an instance of SharePatch from the specified map of raw messages. func UnmarshalSharePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SharePatch) @@ -80025,6 +80696,11 @@ func UnmarshalSharePatch(m map[string]json.RawMessage, result interface{}) (err err = core.SDKErrorf(err, "", "access_control_mode-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "allowed_transit_encryption_modes", &obj.AllowedTransitEncryptionModes) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_transit_encryption_modes-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) @@ -80495,12 +81171,13 @@ func UnmarshalShareProfileReference(m map[string]json.RawMessage, result interfa // Models which "extend" this model: // - SharePrototypeShareBySize // - SharePrototypeShareBySourceShare +// - SharePrototypeShareByOriginShare type SharePrototype struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the - // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. - // - // In addition, each client accessing the share will be restricted to 48,000 IOPS. - Iops *int64 `json:"iops,omitempty"` + // The transit encryption modes to allow for this share. If unspecified: + // - If share mount targets are specified, and those share mount targets all specify a + // `transit_encryption` of `user_managed`, then only `user_managed` will be allowed. + // - Otherwise, all `transit_encryption` modes will be allowed. + AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes,omitempty"` // The mount targets for the file share. Each mount target must be in a unique VPC. MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` @@ -80509,10 +81186,6 @@ type SharePrototype struct { // a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use - // for this file share. The profile must support the share's specified IOPS and size. - Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - // Configuration for a replica file share to create and associate with this file share. If // unspecified, a replica may be subsequently added by creating a new file share with a // `source_share` referencing this file share. @@ -80521,12 +81194,6 @@ type SharePrototype struct { // Tags for this resource. UserTags []string `json:"user_tags,omitempty"` - // The zone this file share will reside in. - // - // For a replica share, this must be a different zone in the same region as the - // source share. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The access control mode for the share: // // - `security_group`: The security groups on the virtual network interface for a @@ -80547,6 +81214,16 @@ type SharePrototype struct { // must be performed by a client that has mounted the file share. InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each client accessing the share will be restricted to 48,000 IOPS. + Iops *int64 `json:"iops,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use + // for this file share. The profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `json:"profile,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"` @@ -80556,6 +81233,10 @@ type SharePrototype struct { // The maximum size for a share may increase in the future. Size *int64 `json:"size,omitempty"` + // The zone this file share will reside in. For a replica share, this must be a different + // zone in the same region as the source share. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + // The cron specification for the file share replication schedule. // // Replication of a share can be scheduled to occur at most once per hour. @@ -80566,8 +81247,27 @@ type SharePrototype struct { // by CRN, it may be in an [associated partner // region](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-replication). SourceShare ShareIdentityIntf `json:"source_share,omitempty"` + + // The origin share for the accessor share. The origin share must have an + // `access_control_mode` of `security_group`, and must not have an + // `accessor_binding_role` of `accessor`. + // + // The specified share may be in a different account, subject to IAM policies. + OriginShare ShareIdentityIntf `json:"origin_share,omitempty"` } +// Constants associated with the SharePrototype.AllowedTransitEncryptionModes property. +// An allowed transit encryption mode for this share. +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + SharePrototypeAllowedTransitEncryptionModesNoneConst = "none" + SharePrototypeAllowedTransitEncryptionModesUserManagedConst = "user_managed" +) + // Constants associated with the SharePrototype.AccessControlMode property. // The access control mode for the share: // @@ -80592,9 +81292,9 @@ type SharePrototypeIntf interface { // UnmarshalSharePrototype unmarshals an instance of SharePrototype from the specified map of raw messages. func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SharePrototype) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + err = core.UnmarshalPrimitive(m, "allowed_transit_encryption_modes", &obj.AllowedTransitEncryptionModes) if err != nil { - err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "allowed_transit_encryption_modes-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) @@ -80607,11 +81307,6 @@ func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) ( err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) if err != nil { err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) @@ -80622,11 +81317,6 @@ func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) ( err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { err = core.SDKErrorf(err, "", "access_control_mode-error", common.GetComponentInfo()) @@ -80642,6 +81332,16 @@ func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) ( err = core.SDKErrorf(err, "", "initial_owner-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "profile-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()) @@ -80652,6 +81352,11 @@ func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) ( err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) if err != nil { err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo()) @@ -80662,6 +81367,11 @@ func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) ( err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "origin_share", &obj.OriginShare, UnmarshalShareIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "origin_share-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -80670,6 +81380,12 @@ func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) ( // subsequently added by creating a new file share with a // `source_share` referencing this file share. type SharePrototypeShareContext struct { + // The transit encryption modes to allow for this share. If unspecified: + // - If share mount targets are specified, and those share mount targets all specify a + // `transit_encryption` of `user_managed`, then only `user_managed` will be allowed. + // - Otherwise, all `transit_encryption` modes will be allowed. + AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes,omitempty"` + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. // @@ -80707,6 +81423,18 @@ type SharePrototypeShareContext struct { Zone ZoneIdentityIntf `json:"zone" validate:"required"` } +// Constants associated with the SharePrototypeShareContext.AllowedTransitEncryptionModes property. +// An allowed transit encryption mode for this share. +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + SharePrototypeShareContextAllowedTransitEncryptionModesNoneConst = "none" + SharePrototypeShareContextAllowedTransitEncryptionModesUserManagedConst = "user_managed" +) + // NewSharePrototypeShareContext : Instantiate SharePrototypeShareContext (Generic Model Constructor) func (*VpcV1) NewSharePrototypeShareContext(profile ShareProfileIdentityIntf, replicationCronSpec string, zone ZoneIdentityIntf) (_model *SharePrototypeShareContext, err error) { _model = &SharePrototypeShareContext{ @@ -80724,6 +81452,11 @@ func (*VpcV1) NewSharePrototypeShareContext(profile ShareProfileIdentityIntf, re // UnmarshalSharePrototypeShareContext unmarshals an instance of SharePrototypeShareContext from the specified map of raw messages. func UnmarshalSharePrototypeShareContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SharePrototypeShareContext) + err = core.UnmarshalPrimitive(m, "allowed_transit_encryption_modes", &obj.AllowedTransitEncryptionModes) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_transit_encryption_modes-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) @@ -80864,6 +81597,10 @@ func UnmarshalShareReferenceDeleted(m map[string]json.RawMessage, result interfa // ShareRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not // be directly retrievable. type ShareRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // account, and identifies the owning account. + Account *AccountReference `json:"account,omitempty"` + // If present, this property indicates that the referenced resource is remote to this // region, and identifies the native region. Region *RegionReference `json:"region,omitempty"` @@ -80872,6 +81609,11 @@ type ShareRemote struct { // UnmarshalShareRemote unmarshals an instance of ShareRemote from the specified map of raw messages. func UnmarshalShareRemote(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ShareRemote) + err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) + if err != nil { + err = core.SDKErrorf(err, "", "account-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) if err != nil { err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) @@ -80943,6 +81685,14 @@ type Snapshot struct { // created before 1 January 2022. CapturedAt *strfmt.DateTime `json:"captured_at,omitempty"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering inherited from the snapshot's source. If a virtual server instance is + // provisioned with a `source_snapshot` specifying this snapshot, the virtual server + // instance will use this snapshot's catalog offering, including its pricing plan. + // + // If absent, this snapshot is not associated with a catalog offering. + CatalogOffering *SnapshotCatalogOffering `json:"catalog_offering,omitempty"` + // Clones for this snapshot. Clones []SnapshotClone `json:"clones" validate:"required"` @@ -81061,6 +81811,11 @@ func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err er err = core.SDKErrorf(err, "", "captured_at-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalSnapshotCatalogOffering) + if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "clones", &obj.Clones, UnmarshalSnapshotClone) if err != nil { err = core.SDKErrorf(err, "", "clones-error", common.GetComponentInfo()) @@ -81175,6 +81930,36 @@ func UnmarshalSnapshot(m map[string]json.RawMessage, result interface{}) (err er return } +// SnapshotCatalogOffering : SnapshotCatalogOffering struct +type SnapshotCatalogOffering struct { + // The billing plan associated with the catalog offering version. + // + // If absent, no billing plan is associated with the catalog offering version + // (free). + Plan *CatalogOfferingVersionPlanReference `json:"plan,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering version contained in this snapshot. + Version *CatalogOfferingVersionReference `json:"version" validate:"required"` +} + +// UnmarshalSnapshotCatalogOffering unmarshals an instance of SnapshotCatalogOffering from the specified map of raw messages. +func UnmarshalSnapshotCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SnapshotCatalogOffering) + err = core.UnmarshalModel(m, "plan", &obj.Plan, UnmarshalCatalogOfferingVersionPlanReference) + if err != nil { + err = core.SDKErrorf(err, "", "plan-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) + if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // SnapshotClone : SnapshotClone struct type SnapshotClone struct { // Indicates whether this snapshot clone is available for use. @@ -86226,7 +87011,6 @@ type VpcdnsResolutionBinding struct { EndpointGateways []EndpointGatewayReferenceRemote `json:"endpoint_gateways" validate:"required"` // The reasons for the current `health_state` (if any). -<<<<<<< Updated upstream HealthReasons []VpcdnsResolutionBindingHealthReason `json:"health_reasons" validate:"required"` // The health of this resource: @@ -86236,21 +87020,6 @@ type VpcdnsResolutionBinding struct { // - `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. -======= - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - HealthReasons []VpcdnsResolutionBindingHealthReason `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. ->>>>>>> Stashed changes HealthState *string `json:"health_state" validate:"required"` // The URL for this DNS resolution binding. @@ -86275,7 +87044,6 @@ type VpcdnsResolutionBinding struct { } // Constants associated with the VpcdnsResolutionBinding.HealthState property. -<<<<<<< Updated upstream // The health of this resource: // - `ok`: No abnormal behavior detected // - `degraded`: Experiencing compromised performance, capacity, or connectivity @@ -86283,15 +87051,6 @@ type VpcdnsResolutionBinding struct { // - `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. -======= -// 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. ->>>>>>> Stashed changes const ( VpcdnsResolutionBindingHealthStateDegradedConst = "degraded" VpcdnsResolutionBindingHealthStateFaultedConst = "faulted" @@ -86340,14 +87099,6 @@ func UnmarshalVpcdnsResolutionBinding(m map[string]json.RawMessage, result inter err = core.SDKErrorf(err, "", "health_state-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVpcdnsResolutionBindingHealthReason) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -86450,11 +87201,7 @@ func (resp *VpcdnsResolutionBindingCollection) GetNextStart() (*string, error) { // VpcdnsResolutionBindingHealthReason : VpcdnsResolutionBindingHealthReason struct type VpcdnsResolutionBindingHealthReason struct { -<<<<<<< Updated upstream // A reason code for this health state. -======= - // A snake case string succinctly identifying the reason for this health state. ->>>>>>> Stashed changes Code *string `json:"code" validate:"required"` // An explanation of the reason for this health state. @@ -86465,11 +87212,7 @@ type VpcdnsResolutionBindingHealthReason struct { } // Constants associated with the VpcdnsResolutionBindingHealthReason.Code property. -<<<<<<< Updated upstream // A reason code for this health state. -======= -// A snake case string succinctly identifying the reason for this health state. ->>>>>>> Stashed changes const ( VpcdnsResolutionBindingHealthReasonCodeDisconnectedFromBoundVPCConst = "disconnected_from_bound_vpc" VpcdnsResolutionBindingHealthReasonCodeInternalErrorConst = "internal_error" @@ -86480,26 +87223,17 @@ func UnmarshalVpcdnsResolutionBindingHealthReason(m map[string]json.RawMessage, obj := new(VpcdnsResolutionBindingHealthReason) err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { -<<<<<<< Updated upstream -======= err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) ->>>>>>> Stashed changes return } err = core.UnmarshalPrimitive(m, "message", &obj.Message) if err != nil { -<<<<<<< Updated upstream -======= err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) ->>>>>>> Stashed changes return } err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { -<<<<<<< Updated upstream -======= err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) ->>>>>>> Stashed changes return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -86547,7 +87281,10 @@ type VpcdnsResolver struct { // // - by the system when `dns.resolver.type` is `system` // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` - // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual` + // + // The maximum number of DNS servers is expected to + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Servers []DnsServer `json:"servers" validate:"required"` // The type of the DNS resolver used for the VPC. @@ -86556,6 +87293,9 @@ type VpcdnsResolver struct { // specified in `dns.resolver.vpc`. // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. // - `system`: DNS server addresses are provided by the system. + // + // The maximum number of DNS servers is expected to + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Type *string `json:"type" validate:"required"` // The VPC whose DNS resolver provides the DNS server addresses for this VPC. @@ -86572,6 +87312,9 @@ type VpcdnsResolver struct { // If the DNS servers do not have `zone_affinity`, the DHCP [Domain Name Server // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS // servers in the order specified. + // + // The maximum number of manual DNS servers is expected to + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ManualServers []DnsServer `json:"manual_servers,omitempty"` // The configuration of the system DNS resolver for this VPC. @@ -86601,6 +87344,9 @@ type VpcdnsResolver struct { // specified in `dns.resolver.vpc`. // - `manual`: DNS server addresses are specified in `dns.resolver.manual_servers`. // - `system`: DNS server addresses are provided by the system. +// +// The maximum number of DNS servers is expected to +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VpcdnsResolverTypeDelegatedConst = "delegated" VpcdnsResolverTypeManualConst = "manual" @@ -87587,6 +88333,15 @@ type VPNGatewayConnection struct { // The Dead Peer Detection settings. DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode" validate:"required"` + // The VPN connection's canonical URL. Href *string `json:"href" validate:"required"` @@ -87607,9 +88362,6 @@ type VPNGatewayConnection struct { // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. Name *string `json:"name" validate:"required"` - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` - // The pre-shared key. Psk *string `json:"psk" validate:"required"` @@ -87622,17 +88374,15 @@ type VPNGatewayConnection struct { // The reasons for the current VPN gateway connection status (if any). StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local,omitempty"` + + Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer,omitempty"` + // Routing protocols are disabled for this VPN gateway connection. RoutingProtocol *string `json:"routing_protocol,omitempty"` // The VPN tunnel configuration for this VPN gateway connection (in static route mode). Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels,omitempty"` - - // The local CIDRs for this resource. - LocalCIDRs []string `json:"local_cidrs,omitempty"` - - // The peer CIDRs for this resource. - PeerCIDRs []string `json:"peer_cidrs,omitempty"` } // Constants associated with the VPNGatewayConnection.AuthenticationMode property. @@ -87641,6 +88391,19 @@ const ( VPNGatewayConnectionAuthenticationModePskConst = "psk" ) +// Constants associated with the VPNGatewayConnection.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionEstablishModePeerOnlyConst = "peer_only" +) + // Constants associated with the VPNGatewayConnection.Mode property. // The mode of the VPN gateway. const ( @@ -87681,30 +88444,16 @@ func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interfac var discValue string err = core.UnmarshalPrimitive(m, "mode", &discValue) if err != nil { -<<<<<<< Updated upstream - err = fmt.Errorf("error unmarshalling discriminator property 'mode': %s", err.Error()) - return - } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'mode' not found in JSON object") -======= errMsg := fmt.Sprintf("error unmarshalling discriminator property 'mode': %s", err.Error()) err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } if discValue == "" { err = core.SDKErrorf(err, "required discriminator property 'mode' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) ->>>>>>> Stashed changes return } if discValue == "policy" { err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionPolicyMode) -<<<<<<< Updated upstream - } else if discValue == "route" { - err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteMode) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'mode': %s", discValue) -======= if err != nil { err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionPolicyMode-error", common.GetComponentInfo()) } @@ -87716,15 +88465,45 @@ func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interfac } else { errMsg := fmt.Sprintf("unrecognized value for discriminator property 'mode': %s", discValue) err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) ->>>>>>> Stashed changes } return } -// VPNGatewayConnectionCollection : Collection of VPN gateway connections in a VPN gateway. +// VPNGatewayConnectionCIDRs : VPNGatewayConnectionCIDRs struct +type VPNGatewayConnectionCIDRs struct { + // The CIDRs for this resource. + CIDRs []string `json:"cidrs" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionCIDRs unmarshals an instance of VPNGatewayConnectionCIDRs from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionCIDRs) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionCollection : VPNGatewayConnectionCollection struct type VPNGatewayConnectionCollection struct { - // Array of VPN gateway connections. + // Collection of VPN gateway connections in a VPN gateway. Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` + + // A link to the first page of resources. + First *VPNGatewayConnectionCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } // UnmarshalVPNGatewayConnectionCollection unmarshals an instance of VPNGatewayConnectionCollection from the specified map of raw messages. @@ -87735,6 +88514,77 @@ 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) + 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, UnmarshalVPNGatewayConnectionCollectionNext) + 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 *VPNGatewayConnectionCollection) 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 +} + +// 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 } @@ -87868,6 +88718,108 @@ func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, res return } +// VPNGatewayConnectionIkeIdentity : VPNGatewayConnectionIkeIdentity struct +// Models which "extend" this model: +// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn +// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname +// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 +// - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID +type VPNGatewayConnectionIkeIdentity struct { + // The IKE identity type. + // + // 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 IKE identity FQDN value. + Value *string `json:"value,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentity.Type property. +// The IKE identity type. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + VPNGatewayConnectionIkeIdentityTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityTypeKeyIDConst = "key_id" +) + +func (*VPNGatewayConnectionIkeIdentity) isaVPNGatewayConnectionIkeIdentity() bool { + return true +} + +type VPNGatewayConnectionIkeIdentityIntf interface { + isaVPNGatewayConnectionIkeIdentity() bool +} + +// UnmarshalVPNGatewayConnectionIkeIdentity unmarshals an instance of VPNGatewayConnectionIkeIdentity from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentity) + 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 +} + +// VPNGatewayConnectionIkeIdentityPrototype : VPNGatewayConnectionIkeIdentityPrototype struct +// Models which "extend" this model: +// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn +// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname +// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 +// - VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID +type VPNGatewayConnectionIkeIdentityPrototype struct { + // The IKE identity type. + Type *string `json:"type" validate:"required"` + + // The IKE identity FQDN value. + Value *string `json:"value,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityPrototype.Type property. +// The IKE identity type. +const ( + VPNGatewayConnectionIkeIdentityPrototypeTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityPrototypeTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityPrototypeTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityPrototypeTypeKeyIDConst = "key_id" +) + +func (*VPNGatewayConnectionIkeIdentityPrototype) isaVPNGatewayConnectionIkeIdentityPrototype() bool { + return true +} + +type VPNGatewayConnectionIkeIdentityPrototypeIntf interface { + isaVPNGatewayConnectionIkeIdentityPrototype() bool +} + +// UnmarshalVPNGatewayConnectionIkeIdentityPrototype unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityPrototype) + 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 +} + // VPNGatewayConnectionIkePolicyPatch : The IKE policy to use. Specify `null` to remove any existing policy, [resulting in // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). // Models which "extend" this model: @@ -88020,24 +88972,6 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPrototype(m map[string]json.RawMess return } -// VPNGatewayConnectionLocalCIDRs : VPNGatewayConnectionLocalCIDRs struct -type VPNGatewayConnectionLocalCIDRs struct { - // The local CIDRs for this resource. - LocalCIDRs []string `json:"local_cidrs" validate:"required"` -} - -// UnmarshalVPNGatewayConnectionLocalCIDRs unmarshals an instance of VPNGatewayConnectionLocalCIDRs from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionLocalCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionLocalCIDRs) - err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "local_cidrs-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VPNGatewayConnectionPatch : VPNGatewayConnectionPatch struct type VPNGatewayConnectionPatch struct { // If set to false, the VPN gateway connection is shut down. @@ -88046,6 +88980,15 @@ type VPNGatewayConnectionPatch struct { // The Dead Peer Detection settings. DeadPeerDetection *VPNGatewayConnectionDpdPatch `json:"dead_peer_detection,omitempty"` + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode,omitempty"` + // The IKE policy to use. Specify `null` to remove any existing policy, [resulting in // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). IkePolicy VPNGatewayConnectionIkePolicyPatchIntf `json:"ike_policy,omitempty"` @@ -88057,20 +89000,23 @@ type VPNGatewayConnectionPatch struct { // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. Name *string `json:"name,omitempty"` - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address,omitempty"` + Peer VPNGatewayConnectionPeerPatchIntf `json:"peer,omitempty"` // The pre-shared key. Psk *string `json:"psk,omitempty"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` } -// Constants associated with the VPNGatewayConnectionPatch.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. +// Constants associated with the VPNGatewayConnectionPatch.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. const ( - VPNGatewayConnectionPatchRoutingProtocolNoneConst = "none" + VPNGatewayConnectionPatchEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionPatchEstablishModePeerOnlyConst = "peer_only" ) // UnmarshalVPNGatewayConnectionPatch unmarshals an instance of VPNGatewayConnectionPatch from the specified map of raw messages. @@ -88086,6 +89032,11 @@ func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch) if err != nil { err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) @@ -88101,9 +89052,9 @@ func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionPeerPatch) if err != nil { - err = core.SDKErrorf(err, "", "peer_address-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) @@ -88111,11 +89062,6 @@ func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -88133,18 +89079,236 @@ func (vpnGatewayConnectionPatch *VPNGatewayConnectionPatch) AsPatch() (_patch ma return } -// VPNGatewayConnectionPeerCIDRs : VPNGatewayConnectionPeerCIDRs struct -type VPNGatewayConnectionPeerCIDRs struct { - // The peer CIDRs for this resource. - PeerCIDRs []string `json:"peer_cidrs" validate:"required"` +// VPNGatewayConnectionPeerPatch : VPNGatewayConnectionPeerPatch struct +// Models which "extend" this model: +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch +type VPNGatewayConnectionPeerPatch struct { + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionPeerPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} + +type VPNGatewayConnectionPeerPatchIntf interface { + isaVPNGatewayConnectionPeerPatch() bool +} + +// UnmarshalVPNGatewayConnectionPeerPatch unmarshals an instance of VPNGatewayConnectionPeerPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModeLocal : VPNGatewayConnectionPolicyModeLocal struct +type VPNGatewayConnectionPolicyModeLocal struct { + // The local CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The local IKE identities. + // + // A VPN gateway in policy mode consists of two members in active-standby mode. The local IKE identity applies to the + // active member. + IkeIdentities []VPNGatewayConnectionIkeIdentityIntf `json:"ike_identities" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionPolicyModeLocal unmarshals an instance of VPNGatewayConnectionPolicyModeLocal from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModeLocal(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModeLocal) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModeLocalPrototype : VPNGatewayConnectionPolicyModeLocalPrototype struct +type VPNGatewayConnectionPolicyModeLocalPrototype struct { + // The local CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The local IKE identities to use. + // + // A VPN gateway in policy mode consists of two members in active-standby mode. The specified identity will be applied + // to the active member. + // + // If unspecified, then `type` will be `ipv4_address` and `value` will be the public IP address of the VPN gateway. + IkeIdentities []VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identities,omitempty"` } -// UnmarshalVPNGatewayConnectionPeerCIDRs unmarshals an instance of VPNGatewayConnectionPeerCIDRs from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPeerCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPeerCIDRs) - err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) +// NewVPNGatewayConnectionPolicyModeLocalPrototype : Instantiate VPNGatewayConnectionPolicyModeLocalPrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionPolicyModeLocalPrototype(cidrs []string) (_model *VPNGatewayConnectionPolicyModeLocalPrototype, err error) { + _model = &VPNGatewayConnectionPolicyModeLocalPrototype{ + CIDRs: cidrs, + } + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "peer_cidrs-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalVPNGatewayConnectionPolicyModeLocalPrototype unmarshals an instance of VPNGatewayConnectionPolicyModeLocalPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModeLocalPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModeLocalPrototype) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModePeer : VPNGatewayConnectionPolicyModePeer struct +// Models which "extend" this model: +// - VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress +// - VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn +type VPNGatewayConnectionPolicyModePeer struct { + // The peer CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPolicyModePeer.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionPolicyModePeerTypeAddressConst = "address" + VPNGatewayConnectionPolicyModePeerTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionPolicyModePeer) isaVPNGatewayConnectionPolicyModePeer() bool { + return true +} + +type VPNGatewayConnectionPolicyModePeerIntf interface { + isaVPNGatewayConnectionPolicyModePeer() bool +} + +// UnmarshalVPNGatewayConnectionPolicyModePeer unmarshals an instance of VPNGatewayConnectionPolicyModePeer from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModePeer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModePeer) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModePeerPrototype : VPNGatewayConnectionPolicyModePeerPrototype struct +// Models which "extend" this model: +// - VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress +// - VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn +type VPNGatewayConnectionPolicyModePeerPrototype struct { + // The peer CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and + // the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` + // will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionPolicyModePeerPrototype) isaVPNGatewayConnectionPolicyModePeerPrototype() bool { + return true +} + +type VPNGatewayConnectionPolicyModePeerPrototypeIntf interface { + isaVPNGatewayConnectionPolicyModePeerPrototype() bool +} + +// UnmarshalVPNGatewayConnectionPolicyModePeerPrototype unmarshals an instance of VPNGatewayConnectionPolicyModePeerPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModePeerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModePeerPrototype) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88162,6 +89326,15 @@ type VPNGatewayConnectionPrototype struct { // The Dead Peer Detection settings. DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode,omitempty"` + // 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). IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` @@ -88174,22 +89347,30 @@ type VPNGatewayConnectionPrototype struct { // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` - // The pre-shared key. Psk *string `json:"psk" validate:"required"` - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` + Local *VPNGatewayConnectionStaticRouteModeLocalPrototype `json:"local,omitempty"` - // The local CIDRs for this resource. - LocalCIDRs []string `json:"local_cidrs,omitempty"` + Peer VPNGatewayConnectionStaticRouteModePeerPrototypeIntf `json:"peer,omitempty"` - // The peer CIDRs for this resource. - PeerCIDRs []string `json:"peer_cidrs,omitempty"` + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` } +// Constants associated with the VPNGatewayConnectionPrototype.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionPrototypeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionPrototypeEstablishModePeerOnlyConst = "peer_only" +) + // Constants associated with the VPNGatewayConnectionPrototype.RoutingProtocol property. // Routing protocols are disabled for this VPN gateway connection. const ( @@ -88217,6 +89398,11 @@ func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) if err != nil { err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) @@ -88232,29 +89418,24 @@ func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - err = core.SDKErrorf(err, "", "peer_address-error", common.GetComponentInfo()) - return - } err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) if err != nil { err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype) if err != nil { - err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype) if err != nil { - err = core.SDKErrorf(err, "", "local_cidrs-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) if err != nil { - err = core.SDKErrorf(err, "", "peer_cidrs-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -88337,6 +89518,162 @@ func UnmarshalVPNGatewayConnectionReferenceDeleted(m map[string]json.RawMessage, return } +// VPNGatewayConnectionStaticRouteModeLocal : VPNGatewayConnectionStaticRouteModeLocal struct +type VPNGatewayConnectionStaticRouteModeLocal struct { + // The local IKE identities. + // + // A VPN gateway in static route mode consists of two members in active-active mode. The first identity applies to the + // first member, and the second identity applies to the second member. + IkeIdentities []VPNGatewayConnectionIkeIdentityIntf `json:"ike_identities" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionStaticRouteModeLocal unmarshals an instance of VPNGatewayConnectionStaticRouteModeLocal from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModeLocal(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModeLocal) + err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModeLocalPrototype : VPNGatewayConnectionStaticRouteModeLocalPrototype struct +type VPNGatewayConnectionStaticRouteModeLocalPrototype struct { + // The local IKE identities to use. + // + // A VPN gateway in static route mode consists of two members in active-active mode. The first specified identity will + // be applied to the first member, and the second specified identity will be applied to the second member. + // + // If unspecified, then `type` will be `ipv4_address` and `value` will be the public IP address of the member's VPN + // connection tunnel. + IkeIdentities []VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identities,omitempty"` +} + +// UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype unmarshals an instance of VPNGatewayConnectionStaticRouteModeLocalPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModeLocalPrototype) + err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModePeer : VPNGatewayConnectionStaticRouteModePeer struct +// Models which "extend" this model: +// - VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress +// - VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn +type VPNGatewayConnectionStaticRouteModePeer struct { + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionStaticRouteModePeer.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionStaticRouteModePeerTypeAddressConst = "address" + VPNGatewayConnectionStaticRouteModePeerTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionStaticRouteModePeer) isaVPNGatewayConnectionStaticRouteModePeer() bool { + return true +} + +type VPNGatewayConnectionStaticRouteModePeerIntf interface { + isaVPNGatewayConnectionStaticRouteModePeer() bool +} + +// UnmarshalVPNGatewayConnectionStaticRouteModePeer unmarshals an instance of VPNGatewayConnectionStaticRouteModePeer from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModePeer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModePeer) + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModePeerPrototype : VPNGatewayConnectionStaticRouteModePeerPrototype struct +// Models which "extend" this model: +// - VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress +// - VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn +type VPNGatewayConnectionStaticRouteModePeerPrototype struct { + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and + // the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` + // will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionStaticRouteModePeerPrototype) isaVPNGatewayConnectionStaticRouteModePeerPrototype() bool { + return true +} + +type VPNGatewayConnectionStaticRouteModePeerPrototypeIntf interface { + isaVPNGatewayConnectionStaticRouteModePeerPrototype() bool +} + +// UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModePeerPrototype) + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNGatewayConnectionStaticRouteModeTunnel : VPNGatewayConnectionStaticRouteModeTunnel struct type VPNGatewayConnectionStaticRouteModeTunnel struct { // The IP address of the VPN gateway member in which the tunnel resides. @@ -88569,6 +89906,7 @@ func UnmarshalVPNGatewayHealthReason(m map[string]json.RawMessage, result interf // VPNGatewayLifecycleReason : VPNGatewayLifecycleReason struct type VPNGatewayLifecycleReason 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) // @@ -88585,12 +89923,14 @@ type VPNGatewayLifecycleReason struct { // Constants associated with the VPNGatewayLifecycleReason.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 ( + VPNGatewayLifecycleReasonCodeInternalErrorConst = "internal_error" VPNGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -88780,6 +90120,7 @@ func UnmarshalVPNGatewayMemberHealthReason(m map[string]json.RawMessage, result // VPNGatewayMemberLifecycleReason : VPNGatewayMemberLifecycleReason struct type VPNGatewayMemberLifecycleReason 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) // @@ -88796,12 +90137,14 @@ type VPNGatewayMemberLifecycleReason struct { // Constants associated with the VPNGatewayMemberLifecycleReason.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 ( + VPNGatewayMemberLifecycleReasonCodeInternalErrorConst = "internal_error" VPNGatewayMemberLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -89777,6 +91120,7 @@ func UnmarshalVPNServerHealthReason(m map[string]json.RawMessage, result interfa // VPNServerLifecycleReason : VPNServerLifecycleReason struct type VPNServerLifecycleReason 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) // @@ -89793,12 +91137,14 @@ type VPNServerLifecycleReason struct { // Constants associated with the VPNServerLifecycleReason.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 ( + VPNServerLifecycleReasonCodeInternalErrorConst = "internal_error" VPNServerLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -90279,6 +91625,7 @@ func UnmarshalVPNServerRouteHealthReason(m map[string]json.RawMessage, result in // VPNServerRouteLifecycleReason : VPNServerRouteLifecycleReason struct type VPNServerRouteLifecycleReason 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) // @@ -90295,12 +91642,14 @@ type VPNServerRouteLifecycleReason struct { // Constants associated with the VPNServerRouteLifecycleReason.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 ( + VPNServerRouteLifecycleReasonCodeInternalErrorConst = "internal_error" VPNServerRouteLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) @@ -90408,6 +91757,18 @@ type VirtualNetworkInterface struct { // The reserved IP for this virtual network interface. PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + // 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: + // + // - `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" validate:"required"` + // The resource group for this virtual network interface. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -90444,6 +91805,23 @@ const ( VirtualNetworkInterfaceLifecycleStateWaitingConst = "waiting" ) +// Constants associated with the VirtualNetworkInterface.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: +// +// - `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 ( + VirtualNetworkInterfaceProtocolStateFilteringModeAutoConst = "auto" + VirtualNetworkInterfaceProtocolStateFilteringModeDisabledConst = "disabled" + VirtualNetworkInterfaceProtocolStateFilteringModeEnabledConst = "enabled" +) + // Constants associated with the VirtualNetworkInterface.ResourceType property. // The resource type. const ( @@ -90513,6 +91891,11 @@ func UnmarshalVirtualNetworkInterface(m map[string]json.RawMessage, result inter 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, UnmarshalResourceGroupReference) if err != nil { err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) @@ -90746,8 +92129,37 @@ type VirtualNetworkInterfacePatch struct { // The name for this virtual network interface. The name must not be used by another virtual network interface in the // 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: + // + // - `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"` } +// 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: +// +// - `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 ( + VirtualNetworkInterfacePatchProtocolStateFilteringModeAutoConst = "auto" + VirtualNetworkInterfacePatchProtocolStateFilteringModeDisabledConst = "disabled" + VirtualNetworkInterfacePatchProtocolStateFilteringModeEnabledConst = "enabled" +) + // UnmarshalVirtualNetworkInterfacePatch unmarshals an instance of VirtualNetworkInterfacePatch from the specified map of raw messages. func UnmarshalVirtualNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VirtualNetworkInterfacePatch) @@ -90771,6 +92183,11 @@ func UnmarshalVirtualNetworkInterfacePatch(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "name-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 + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -91025,6 +92442,14 @@ type Volume struct { // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Capacity *int64 `json:"capacity" validate:"required"` + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering this volume was created from. If a virtual server instance is provisioned + // with a `boot_volume_attachment` specifying this volume, the virtual server instance + // will use this volume's catalog offering, including its pricing plan. + // + // If absent, this volume was not created from a catalog offering. + CatalogOffering *VolumeCatalogOffering `json:"catalog_offering,omitempty"` + // The date and time that the volume was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -91186,6 +92611,11 @@ func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err erro err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "catalog_offering", &obj.CatalogOffering, UnmarshalVolumeCatalogOffering) + if err != nil { + err = core.SDKErrorf(err, "", "catalog_offering-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -91972,6 +93402,36 @@ func UnmarshalVolumeAttachmentReferenceVolumeContextDeleted(m map[string]json.Ra return } +// VolumeCatalogOffering : VolumeCatalogOffering struct +type VolumeCatalogOffering struct { + // The billing plan associated with the catalog offering version. + // + // If absent, no billing plan is associated with the catalog offering version + // (free). + Plan *CatalogOfferingVersionPlanReference `json:"plan,omitempty"` + + // The [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) + // offering version this volume was created from. + Version *CatalogOfferingVersionReference `json:"version" validate:"required"` +} + +// UnmarshalVolumeCatalogOffering unmarshals an instance of VolumeCatalogOffering from the specified map of raw messages. +func UnmarshalVolumeCatalogOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeCatalogOffering) + err = core.UnmarshalModel(m, "plan", &obj.Plan, UnmarshalCatalogOfferingVersionPlanReference) + if err != nil { + err = core.SDKErrorf(err, "", "plan-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionReference) + if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VolumeCollection : VolumeCollection struct type VolumeCollection struct { // A link to the first page of resources. @@ -94524,6 +95984,19 @@ type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetw // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,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 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"` @@ -94537,6 +96010,24 @@ type BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetw Subnet SubnetIdentityIntf `json:"subnet,omitempty"` } +// Constants associated with the BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext.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 ( + BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextProtocolStateFilteringModeAutoConst = "auto" + BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextProtocolStateFilteringModeDisabledConst = "disabled" + BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContextProtocolStateFilteringModeEnabledConst = "enabled" +) + func (*BareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeBareMetalServerNetworkAttachmentContext) isaBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface() bool { return true } @@ -94574,6 +96065,11 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterfaceVi 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()) @@ -97309,6 +98805,11 @@ func UnmarshalBareMetalServerProfileNetworkInterfaceCountRange(m map[string]json // BareMetalServerPrototypeBareMetalServerByNetworkAttachment : BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct // This model "extends" BareMetalServerPrototype type BareMetalServerPrototypeBareMetalServerByNetworkAttachment 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"` @@ -97367,6 +98868,11 @@ func (*BareMetalServerPrototypeBareMetalServerByNetworkAttachment) isaBareMetalS // UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment unmarshals an instance of BareMetalServerPrototypeBareMetalServerByNetworkAttachment from the specified map of raw messages. func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(BareMetalServerPrototypeBareMetalServerByNetworkAttachment) + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) @@ -97424,6 +98930,11 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[s // BareMetalServerPrototypeBareMetalServerByNetworkInterface : BareMetalServerPrototypeBareMetalServerByNetworkInterface struct // This model "extends" BareMetalServerPrototype type BareMetalServerPrototypeBareMetalServerByNetworkInterface 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"` @@ -97482,6 +98993,11 @@ func (*BareMetalServerPrototypeBareMetalServerByNetworkInterface) isaBareMetalSe // UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface unmarshals an instance of BareMetalServerPrototypeBareMetalServerByNetworkInterface from the specified map of raw messages. func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(BareMetalServerPrototypeBareMetalServerByNetworkInterface) + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) if err != nil { err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) @@ -97608,6 +99124,42 @@ func UnmarshalCatalogOfferingVersionIdentityCatalogOfferingVersionByCRN(m map[st return } +// CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN : CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN struct +// This model "extends" CatalogOfferingVersionPlanIdentity +type CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN 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"` +} + +// NewCatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN : Instantiate CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN (Generic Model Constructor) +func (*VpcV1) NewCatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN(crn string) (_model *CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN, err error) { + _model = &CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN) isaCatalogOfferingVersionPlanIdentity() bool { + return true +} + +// UnmarshalCatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN unmarshals an instance of CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN from the specified map of raw messages. +func UnmarshalCatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogOfferingVersionPlanIdentityCatalogOfferingVersionPlanByCRN) + 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 +} + // CertificateInstanceIdentityByCRN : CertificateInstanceIdentityByCRN struct // This model "extends" CertificateInstanceIdentity type CertificateInstanceIdentityByCRN struct { @@ -100708,6 +102260,10 @@ func UnmarshalImagePrototypeImageBySourceVolume(m map[string]json.RawMessage, re // InstanceCatalogOfferingPrototypeCatalogOfferingByOffering : InstanceCatalogOfferingPrototypeCatalogOfferingByOffering struct // This model "extends" InstanceCatalogOfferingPrototype type InstanceCatalogOfferingPrototypeCatalogOfferingByOffering struct { + // The billing plan to use for the catalog offering version. If unspecified, no billing plan will be used (free). Must + // be specified for catalog offering versions that require a billing plan to be used. + Plan CatalogOfferingVersionPlanIdentityIntf `json:"plan,omitempty"` + // Identifies a [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) // offering by a unique property. Offering CatalogOfferingIdentityIntf `json:"offering" validate:"required"` @@ -100732,6 +102288,11 @@ func (*InstanceCatalogOfferingPrototypeCatalogOfferingByOffering) isaInstanceCat // UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering unmarshals an instance of InstanceCatalogOfferingPrototypeCatalogOfferingByOffering from the specified map of raw messages. func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByOffering) + err = core.UnmarshalModel(m, "plan", &obj.Plan, UnmarshalCatalogOfferingVersionPlanIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "plan-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "offering", &obj.Offering, UnmarshalCatalogOfferingIdentity) if err != nil { err = core.SDKErrorf(err, "", "offering-error", common.GetComponentInfo()) @@ -100744,6 +102305,10 @@ func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByOffering(m map[st // InstanceCatalogOfferingPrototypeCatalogOfferingByVersion : InstanceCatalogOfferingPrototypeCatalogOfferingByVersion struct // This model "extends" InstanceCatalogOfferingPrototype type InstanceCatalogOfferingPrototypeCatalogOfferingByVersion struct { + // The billing plan to use for the catalog offering version. If unspecified, no billing plan will be used (free). Must + // be specified for catalog offering versions that require a billing plan to be used. + Plan CatalogOfferingVersionPlanIdentityIntf `json:"plan,omitempty"` + // Identifies a version of a // [catalog](https://cloud.ibm.com/docs/account?topic=account-restrict-by-user) offering by a // unique property. @@ -100769,6 +102334,11 @@ func (*InstanceCatalogOfferingPrototypeCatalogOfferingByVersion) isaInstanceCata // UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion unmarshals an instance of InstanceCatalogOfferingPrototypeCatalogOfferingByVersion from the specified map of raw messages. func UnmarshalInstanceCatalogOfferingPrototypeCatalogOfferingByVersion(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceCatalogOfferingPrototypeCatalogOfferingByVersion) + err = core.UnmarshalModel(m, "plan", &obj.Plan, UnmarshalCatalogOfferingVersionPlanIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "plan-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "version", &obj.Version, UnmarshalCatalogOfferingVersionIdentity) if err != nil { err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) @@ -101779,6 +103349,19 @@ type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInte // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,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 resource group to use for this virtual network interface. If unspecified, the // virtual server instance's resource group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -101792,6 +103375,24 @@ type InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInte Subnet SubnetIdentityIntf `json:"subnet,omitempty"` } +// Constants associated with the InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext.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 ( + InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextProtocolStateFilteringModeAutoConst = "auto" + InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextProtocolStateFilteringModeDisabledConst = "disabled" + InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContextProtocolStateFilteringModeEnabledConst = "enabled" +) + func (*InstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNetworkInterfacePrototypeInstanceNetworkAttachmentContext) isaInstanceNetworkAttachmentPrototypeVirtualNetworkInterface() bool { return true } @@ -101829,6 +103430,11 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterfaceVirtualNe 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()) @@ -104132,6 +105738,11 @@ type InstancePrototypeInstanceByCatalogOffering struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -104139,6 +105750,11 @@ type InstancePrototypeInstanceByCatalogOffering struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -104221,6 +105837,15 @@ type InstancePrototypeInstanceByCatalogOffering struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } +// Constants associated with the InstancePrototypeInstanceByCatalogOffering.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstancePrototypeInstanceByCatalogOfferingConfidentialComputeModeDisabledConst = "disabled" + InstancePrototypeInstanceByCatalogOfferingConfidentialComputeModeSgxConst = "sgx" +) + func (*InstancePrototypeInstanceByCatalogOffering) isaInstancePrototypeInstanceByCatalogOffering() bool { return true } @@ -104242,11 +105867,21 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -104342,6 +105977,8 @@ func UnmarshalInstancePrototypeInstanceByCatalogOffering(m map[string]json.RawMe } // InstancePrototypeInstanceByImage : Create an instance by using an image. +// +// The image's `user_data_format` must be `cloud_init`. // Models which "extend" this model: // - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment // - InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface @@ -104350,6 +105987,11 @@ type InstancePrototypeInstanceByImage struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -104357,6 +105999,11 @@ type InstancePrototypeInstanceByImage struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -104433,6 +106080,15 @@ type InstancePrototypeInstanceByImage struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } +// Constants associated with the InstancePrototypeInstanceByImage.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstancePrototypeInstanceByImageConfidentialComputeModeDisabledConst = "disabled" + InstancePrototypeInstanceByImageConfidentialComputeModeSgxConst = "sgx" +) + func (*InstancePrototypeInstanceByImage) isaInstancePrototypeInstanceByImage() bool { return true } @@ -104454,11 +106110,21 @@ func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, res err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -104562,6 +106228,11 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -104569,6 +106240,11 @@ type InstancePrototypeInstanceBySourceSnapshot struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -104642,6 +106318,15 @@ type InstancePrototypeInstanceBySourceSnapshot struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } +// Constants associated with the InstancePrototypeInstanceBySourceSnapshot.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstancePrototypeInstanceBySourceSnapshotConfidentialComputeModeDisabledConst = "disabled" + InstancePrototypeInstanceBySourceSnapshotConfidentialComputeModeSgxConst = "sgx" +) + func (*InstancePrototypeInstanceBySourceSnapshot) isaInstancePrototypeInstanceBySourceSnapshot() bool { return true } @@ -104663,11 +106348,21 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshot(m map[string]json.RawMes err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -104769,6 +106464,11 @@ type InstancePrototypeInstanceBySourceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -104776,6 +106476,11 @@ type InstancePrototypeInstanceBySourceTemplate struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -104866,6 +106571,15 @@ type InstancePrototypeInstanceBySourceTemplate struct { Zone ZoneIdentityIntf `json:"zone,omitempty"` } +// Constants associated with the InstancePrototypeInstanceBySourceTemplate.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstancePrototypeInstanceBySourceTemplateConfidentialComputeModeDisabledConst = "disabled" + InstancePrototypeInstanceBySourceTemplateConfidentialComputeModeSgxConst = "sgx" +) + // NewInstancePrototypeInstanceBySourceTemplate : Instantiate InstancePrototypeInstanceBySourceTemplate (Generic Model Constructor) func (*VpcV1) NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstancePrototypeInstanceBySourceTemplate, err error) { _model = &InstancePrototypeInstanceBySourceTemplate{ @@ -104890,11 +106604,21 @@ func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMes err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -105008,6 +106732,11 @@ type InstancePrototypeInstanceByVolume struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -105015,6 +106744,11 @@ type InstancePrototypeInstanceByVolume struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -105088,6 +106822,15 @@ type InstancePrototypeInstanceByVolume struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } +// Constants associated with the InstancePrototypeInstanceByVolume.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstancePrototypeInstanceByVolumeConfidentialComputeModeDisabledConst = "disabled" + InstancePrototypeInstanceByVolumeConfidentialComputeModeSgxConst = "sgx" +) + func (*InstancePrototypeInstanceByVolume) isaInstancePrototypeInstanceByVolume() bool { return true } @@ -105109,11 +106852,21 @@ func UnmarshalInstancePrototypeInstanceByVolume(m map[string]json.RawMessage, re err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -105317,6 +107070,11 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -105324,6 +107082,11 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -105404,6 +107167,15 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOffering struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } +// Constants associated with the InstanceTemplatePrototypeInstanceTemplateByCatalogOffering.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingConfidentialComputeModeSgxConst = "sgx" +) + func (*InstanceTemplatePrototypeInstanceTemplateByCatalogOffering) isaInstanceTemplatePrototypeInstanceTemplateByCatalogOffering() bool { return true } @@ -105425,11 +107197,21 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -105525,6 +107307,8 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOffering(m map[s } // InstanceTemplatePrototypeInstanceTemplateByImage : Create an instance template that creates instances by using an image. +// +// The image's `user_data_format` must be `cloud_init`. // Models which "extend" this model: // - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment // - InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface @@ -105533,6 +107317,11 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -105540,6 +107329,11 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -105614,6 +107408,15 @@ type InstanceTemplatePrototypeInstanceTemplateByImage struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } +// Constants associated with the InstanceTemplatePrototypeInstanceTemplateByImage.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplatePrototypeInstanceTemplateByImageConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplatePrototypeInstanceTemplateByImageConfidentialComputeModeSgxConst = "sgx" +) + func (*InstanceTemplatePrototypeInstanceTemplateByImage) isaInstanceTemplatePrototypeInstanceTemplateByImage() bool { return true } @@ -105635,11 +107438,21 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImage(m map[string]json err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -105743,6 +107556,11 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -105750,6 +107568,11 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -105821,6 +107644,15 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } +// Constants associated with the InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotConfidentialComputeModeSgxConst = "sgx" +) + func (*InstanceTemplatePrototypeInstanceTemplateBySourceSnapshot) isaInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot() bool { return true } @@ -105842,11 +107674,21 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshot(m map[st err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -105948,6 +107790,11 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -105955,6 +107802,11 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -106043,6 +107895,15 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceTemplate struct { Zone ZoneIdentityIntf `json:"zone,omitempty"` } +// Constants associated with the InstanceTemplatePrototypeInstanceTemplateBySourceTemplate.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplatePrototypeInstanceTemplateBySourceTemplateConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplatePrototypeInstanceTemplateBySourceTemplateConfidentialComputeModeSgxConst = "sgx" +) + // NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceTemplate (Generic Model Constructor) func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceTemplate, err error) { _model = &InstanceTemplatePrototypeInstanceTemplateBySourceTemplate{ @@ -106067,11 +107928,21 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceTemplate(m map[st err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -106185,6 +108056,11 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -106198,6 +108074,11 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The URL for this instance template. Href *string `json:"href" validate:"required"` @@ -106284,6 +108165,15 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } +// Constants associated with the InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextConfidentialComputeModeSgxConst = "sgx" +) + func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { return true } @@ -106305,6 +108195,11 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -106320,6 +108215,11 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext(m err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -106433,6 +108333,11 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -106446,6 +108351,11 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The URL for this instance template. Href *string `json:"href" validate:"required"` @@ -106526,6 +108436,15 @@ type InstanceTemplateInstanceByImageInstanceTemplateContext struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } +// Constants associated with the InstanceTemplateInstanceByImageInstanceTemplateContext.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplateInstanceByImageInstanceTemplateContextConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplateInstanceByImageInstanceTemplateContextConfidentialComputeModeSgxConst = "sgx" +) + func (*InstanceTemplateInstanceByImageInstanceTemplateContext) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { return true } @@ -106547,6 +108466,11 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[strin err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -106562,6 +108486,11 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContext(m map[strin err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -106675,6 +108604,11 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -106688,6 +108622,11 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The URL for this instance template. Href *string `json:"href" validate:"required"` @@ -106765,6 +108704,15 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext struct { PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` } +// Constants associated with the InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextConfidentialComputeModeSgxConst = "sgx" +) + func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { return true } @@ -106786,6 +108734,11 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -106801,6 +108754,11 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext(m err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -107194,6 +109152,9 @@ func (*VpcV1) NewLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByH Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107206,6 +109167,7 @@ func UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref obj := new(LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref) 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)) @@ -107225,6 +109187,9 @@ func (*VpcV1) NewLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByI ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -107237,6 +109202,7 @@ func UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID(m obj := new(LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID) 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)) @@ -112097,6 +114063,9 @@ func (*VpcV1) NewSecurityGroupRuleLocalPatchCIDR(cidrBlock string) (_model *Secu CIDRBlock: core.StringPtr(cidrBlock), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112109,6 +114078,7 @@ func UnmarshalSecurityGroupRuleLocalPatchCIDR(m map[string]json.RawMessage, resu obj := new(SecurityGroupRuleLocalPatchCIDR) err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112131,6 +114101,9 @@ func (*VpcV1) NewSecurityGroupRuleLocalPatchIP(address string) (_model *Security Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112143,6 +114116,7 @@ func UnmarshalSecurityGroupRuleLocalPatchIP(m map[string]json.RawMessage, result obj := new(SecurityGroupRuleLocalPatchIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112165,6 +114139,9 @@ func (*VpcV1) NewSecurityGroupRuleLocalPrototypeCIDR(cidrBlock string) (_model * CIDRBlock: core.StringPtr(cidrBlock), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112177,6 +114154,7 @@ func UnmarshalSecurityGroupRuleLocalPrototypeCIDR(m map[string]json.RawMessage, obj := new(SecurityGroupRuleLocalPrototypeCIDR) err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112199,6 +114177,9 @@ func (*VpcV1) NewSecurityGroupRuleLocalPrototypeIP(address string) (_model *Secu Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } return } @@ -112211,6 +114192,7 @@ func UnmarshalSecurityGroupRuleLocalPrototypeIP(m map[string]json.RawMessage, re obj := new(SecurityGroupRuleLocalPrototypeIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112236,6 +114218,7 @@ func UnmarshalSecurityGroupRuleLocalCIDR(m map[string]json.RawMessage, result in obj := new(SecurityGroupRuleLocalCIDR) err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) if err != nil { + err = core.SDKErrorf(err, "", "cidr_block-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112261,6 +114244,7 @@ func UnmarshalSecurityGroupRuleLocalIP(m map[string]json.RawMessage, result inte obj := new(SecurityGroupRuleLocalIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -112354,6 +114338,7 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[strin } 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) @@ -112472,6 +114457,7 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[stri } 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) @@ -112596,6 +114582,7 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[st } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocalPrototype) if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) @@ -113065,6 +115052,7 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.Ra } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) @@ -113166,6 +115154,7 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.R } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) @@ -113281,6 +115270,7 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) @@ -113745,6 +115735,122 @@ func UnmarshalSecurityGroupTargetReferenceVirtualNetworkInterfaceReference(m map return } +// ShareAccessorBindingAccessorShareReference : ShareAccessorBindingAccessorShareReference struct +// This model "extends" ShareAccessorBindingAccessor +type ShareAccessorBindingAccessorShareReference struct { + // The CRN for this file share. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *ShareReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this file share. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this file share. + ID *string `json:"id" validate:"required"` + + // The name for this share. The name is unique across all shares in the region. + 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 *ShareRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ShareAccessorBindingAccessorShareReference.ResourceType property. +// The resource type. +const ( + ShareAccessorBindingAccessorShareReferenceResourceTypeShareConst = "share" +) + +func (*ShareAccessorBindingAccessorShareReference) isaShareAccessorBindingAccessor() bool { + return true +} + +// UnmarshalShareAccessorBindingAccessorShareReference unmarshals an instance of ShareAccessorBindingAccessorShareReference from the specified map of raw messages. +func UnmarshalShareAccessorBindingAccessorShareReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareAccessorBindingAccessorShareReference) + 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, UnmarshalShareReferenceDeleted) + 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, UnmarshalShareRemote) + 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 +} + +// ShareAccessorBindingAccessorWatsonxMachineLearningReference : ShareAccessorBindingAccessorWatsonxMachineLearningReference struct +// This model "extends" ShareAccessorBindingAccessor +type ShareAccessorBindingAccessorWatsonxMachineLearningReference struct { + // The CRN for the watsonx machine learning resource. + CRN *string `json:"crn" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ShareAccessorBindingAccessorWatsonxMachineLearningReference.ResourceType property. +// The resource type. +const ( + ShareAccessorBindingAccessorWatsonxMachineLearningReferenceResourceTypeWatsonxMachineLearningConst = "watsonx_machine_learning" +) + +func (*ShareAccessorBindingAccessorWatsonxMachineLearningReference) isaShareAccessorBindingAccessor() bool { + return true +} + +// UnmarshalShareAccessorBindingAccessorWatsonxMachineLearningReference unmarshals an instance of ShareAccessorBindingAccessorWatsonxMachineLearningReference from the specified map of raw messages. +func UnmarshalShareAccessorBindingAccessorWatsonxMachineLearningReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareAccessorBindingAccessorWatsonxMachineLearningReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + err = core.SDKErrorf(err, "", "crn-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 +} + // ShareIdentityByCRN : ShareIdentityByCRN struct // This model "extends" ShareIdentity type ShareIdentityByCRN struct { @@ -113855,6 +115961,7 @@ func UnmarshalShareIdentityByID(m map[string]json.RawMessage, result interface{} // - be in the same `zone` as the share // - have `allow_ip_spoofing` set to `false` // - have `enable_infrastructure_nat` set to `true` +// - have `protocol_state_filtering_mode` set to `auto` or `enabled` // - not be in the same VPC as an existing mount target for this share // - not have `ips` other than the `primary_ip` address // @@ -113871,6 +115978,9 @@ type ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup s // - `none`: Not encrypted in transit. // - `user_managed`: Encrypted in transit using an instance identity certificate. The // `access_control_mode` for the share must be `security_group`. + // + // The specified value must be listed in the share's + // `allowed_transit_encryption_modes`. TransitEncryption *string `json:"transit_encryption,omitempty"` VirtualNetworkInterface ShareMountTargetVirtualNetworkInterfacePrototypeIntf `json:"virtual_network_interface" validate:"required"` @@ -113881,6 +115991,9 @@ type ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroup s // - `none`: Not encrypted in transit. // - `user_managed`: Encrypted in transit using an instance identity certificate. The // `access_control_mode` for the share must be `security_group`. +// +// The specified value must be listed in the share's +// `allowed_transit_encryption_modes`. const ( ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionNoneConst = "none" ShareMountTargetPrototypeShareMountTargetByAccessControlModeSecurityGroupTransitEncryptionUserManagedConst = "user_managed" @@ -113937,6 +116050,9 @@ type ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC struct { // - `none`: Not encrypted in transit. // - `user_managed`: Encrypted in transit using an instance identity certificate. The // `access_control_mode` for the share must be `security_group`. + // + // The specified value must be listed in the share's + // `allowed_transit_encryption_modes`. TransitEncryption *string `json:"transit_encryption,omitempty"` // Identifies a VPC by a unique property. @@ -113948,6 +116064,9 @@ type ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPC struct { // - `none`: Not encrypted in transit. // - `user_managed`: Encrypted in transit using an instance identity certificate. The // `access_control_mode` for the share must be `security_group`. +// +// The specified value must be listed in the share's +// `allowed_transit_encryption_modes`. const ( ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionNoneConst = "none" ShareMountTargetPrototypeShareMountTargetByAccessControlModeVPCTransitEncryptionUserManagedConst = "user_managed" @@ -114093,6 +116212,19 @@ type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceProt // an available address on the subnet will be automatically selected and reserved. PrimaryIP VirtualNetworkInterfacePrimaryIPPrototypeIntf `json:"primary_ip,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 resource group to use for this virtual network interface. If unspecified, the // share's resource group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` @@ -114106,6 +116238,24 @@ type ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfaceProt Subnet SubnetIdentityIntf `json:"subnet,omitempty"` } +// Constants associated with the ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext.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 ( + ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContextProtocolStateFilteringModeAutoConst = "auto" + ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContextProtocolStateFilteringModeDisabledConst = "disabled" + ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContextProtocolStateFilteringModeEnabledConst = "enabled" +) + func (*ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext) isaShareMountTargetVirtualNetworkInterfacePrototype() bool { return true } @@ -114143,6 +116293,11 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte 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()) @@ -114626,14 +116781,15 @@ func UnmarshalShareProfileIdentityByName(m map[string]json.RawMessage, result in return } -// SharePrototypeShareBySize : Create a file share by size. +// 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 -type SharePrototypeShareBySize struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the - // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. - // - // In addition, each client accessing the share will be restricted to 48,000 IOPS. - Iops *int64 `json:"iops,omitempty"` +type SharePrototypeShareByOriginShare struct { + // The transit encryption modes to allow for this share. If unspecified: + // - If share mount targets are specified, and those share mount targets all specify a + // `transit_encryption` of `user_managed`, then only `user_managed` will be allowed. + // - Otherwise, all `transit_encryption` modes will be allowed. + AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes,omitempty"` // The mount targets for the file share. Each mount target must be in a unique VPC. MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` @@ -114642,19 +116798,104 @@ type SharePrototypeShareBySize struct { // a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use for this file share. The - // profile must support the share's specified IOPS and size. - Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` // Tags for this resource. UserTags []string `json:"user_tags,omitempty"` - // The zone this file share will reside in. + // The origin share for the accessor share. The origin share must have an + // `access_control_mode` of `security_group`, and must not have an + // `accessor_binding_role` of `accessor`. // - // For a replica share, this must be a different zone in the same region as the source share. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` + // The specified share may be in a different account, subject to IAM policies. + OriginShare ShareIdentityIntf `json:"origin_share" validate:"required"` +} + +// Constants associated with the SharePrototypeShareByOriginShare.AllowedTransitEncryptionModes property. +// An allowed transit encryption mode for this share. +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + SharePrototypeShareByOriginShareAllowedTransitEncryptionModesNoneConst = "none" + SharePrototypeShareByOriginShareAllowedTransitEncryptionModesUserManagedConst = "user_managed" +) + +// NewSharePrototypeShareByOriginShare : Instantiate SharePrototypeShareByOriginShare (Generic Model Constructor) +func (*VpcV1) NewSharePrototypeShareByOriginShare(originShare ShareIdentityIntf) (_model *SharePrototypeShareByOriginShare, err error) { + _model = &SharePrototypeShareByOriginShare{ + OriginShare: originShare, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*SharePrototypeShareByOriginShare) isaSharePrototype() bool { + return true +} + +// UnmarshalSharePrototypeShareByOriginShare unmarshals an instance of SharePrototypeShareByOriginShare from the specified map of raw messages. +func UnmarshalSharePrototypeShareByOriginShare(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePrototypeShareByOriginShare) + err = core.UnmarshalPrimitive(m, "allowed_transit_encryption_modes", &obj.AllowedTransitEncryptionModes) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_transit_encryption_modes-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "mount_targets-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, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) + if err != nil { + err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "origin_share", &obj.OriginShare, UnmarshalShareIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "origin_share-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SharePrototypeShareBySize : Create a file share by size. +// This model "extends" SharePrototype +type SharePrototypeShareBySize struct { + // The transit encryption modes to allow for this share. If unspecified: + // - If share mount targets are specified, and those share mount targets all specify a + // `transit_encryption` of `user_managed`, then only `user_managed` will be allowed. + // - Otherwise, all `transit_encryption` modes will be allowed. + AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes,omitempty"` + + // The mount targets for the file share. Each mount target must be in a unique VPC. + MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` + + // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be + // a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` // The access control mode for the share: // @@ -114676,6 +116917,16 @@ type SharePrototypeShareBySize struct { // must be performed by a client that has mounted the file share. InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each client accessing the share will be restricted to 48,000 IOPS. + Iops *int64 `json:"iops,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use + // for this file share. The profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `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"` @@ -114684,8 +116935,24 @@ type SharePrototypeShareBySize struct { // // The maximum size for a share may increase in the future. Size *int64 `json:"size" validate:"required"` + + // The zone this file share will reside in. For a replica share, this must be a different + // zone in the same region as the source share. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` } +// Constants associated with the SharePrototypeShareBySize.AllowedTransitEncryptionModes property. +// An allowed transit encryption mode for this share. +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + SharePrototypeShareBySizeAllowedTransitEncryptionModesNoneConst = "none" + SharePrototypeShareBySizeAllowedTransitEncryptionModesUserManagedConst = "user_managed" +) + // Constants associated with the SharePrototypeShareBySize.AccessControlMode property. // The access control mode for the share: // @@ -114700,11 +116967,11 @@ const ( ) // NewSharePrototypeShareBySize : Instantiate SharePrototypeShareBySize (Generic Model Constructor) -func (*VpcV1) NewSharePrototypeShareBySize(profile ShareProfileIdentityIntf, zone ZoneIdentityIntf, size int64) (_model *SharePrototypeShareBySize, err error) { +func (*VpcV1) NewSharePrototypeShareBySize(profile ShareProfileIdentityIntf, size int64, zone ZoneIdentityIntf) (_model *SharePrototypeShareBySize, err error) { _model = &SharePrototypeShareBySize{ Profile: profile, - Zone: zone, Size: core.Int64Ptr(size), + Zone: zone, } err = core.ValidateStruct(_model, "required parameters") if err != nil { @@ -114720,9 +116987,9 @@ func (*SharePrototypeShareBySize) isaSharePrototype() bool { // UnmarshalSharePrototypeShareBySize unmarshals an instance of SharePrototypeShareBySize from the specified map of raw messages. func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SharePrototypeShareBySize) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + err = core.UnmarshalPrimitive(m, "allowed_transit_encryption_modes", &obj.AllowedTransitEncryptionModes) if err != nil { - err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "allowed_transit_encryption_modes-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) @@ -114735,11 +117002,6 @@ func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) if err != nil { err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) @@ -114750,11 +117012,6 @@ func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) - return - } err = core.UnmarshalPrimitive(m, "access_control_mode", &obj.AccessControlMode) if err != nil { err = core.SDKErrorf(err, "", "access_control_mode-error", common.GetComponentInfo()) @@ -114770,6 +117027,16 @@ func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "initial_owner-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "profile-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()) @@ -114780,6 +117047,11 @@ func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -114788,11 +117060,11 @@ func UnmarshalSharePrototypeShareBySize(m map[string]json.RawMessage, result int // `access_control_mode`, `encryption_key` and `size` will be inherited from `source_share`. // This model "extends" SharePrototype type SharePrototypeShareBySourceShare struct { - // The maximum input/output operations per second (IOPS) for the file share. The share must be in the - // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. - // - // In addition, each client accessing the share will be restricted to 48,000 IOPS. - Iops *int64 `json:"iops,omitempty"` + // The transit encryption modes to allow for this share. If unspecified: + // - If share mount targets are specified, and those share mount targets all specify a + // `transit_encryption` of `user_managed`, then only `user_managed` will be allowed. + // - Otherwise, all `transit_encryption` modes will be allowed. + AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes,omitempty"` // The mount targets for the file share. Each mount target must be in a unique VPC. MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` @@ -114801,20 +117073,11 @@ type SharePrototypeShareBySourceShare struct { // a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use for this file share. The - // profile must support the share's specified IOPS and size. - Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` - ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` // Tags for this resource. UserTags []string `json:"user_tags,omitempty"` - // The zone this file share will reside in. - // - // For a replica share, this must be a different zone in the same region as the source share. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The root key to use to wrap the data encryption key for the share. // // This property must be specified if the `source_share` is in a different region and has @@ -114822,6 +117085,16 @@ type SharePrototypeShareBySourceShare struct { // will be inherited from `source_share`). EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each client accessing the share will be restricted to 48,000 IOPS. + Iops *int64 `json:"iops,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use + // for this file share. The profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `json:"profile" validate:"required"` + // The cron specification for the file share replication schedule. // // Replication of a share can be scheduled to occur at most once per hour. @@ -114836,15 +117109,31 @@ type SharePrototypeShareBySourceShare struct { // by CRN, it may be in an [associated partner // region](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-replication). SourceShare ShareIdentityIntf `json:"source_share" validate:"required"` + + // The zone this file share will reside in. For a replica share, this must be a different + // zone in the same region as the source share. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` } +// Constants associated with the SharePrototypeShareBySourceShare.AllowedTransitEncryptionModes property. +// An allowed transit encryption mode for this share. +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + SharePrototypeShareBySourceShareAllowedTransitEncryptionModesNoneConst = "none" + SharePrototypeShareBySourceShareAllowedTransitEncryptionModesUserManagedConst = "user_managed" +) + // NewSharePrototypeShareBySourceShare : Instantiate SharePrototypeShareBySourceShare (Generic Model Constructor) -func (*VpcV1) NewSharePrototypeShareBySourceShare(profile ShareProfileIdentityIntf, zone ZoneIdentityIntf, replicationCronSpec string, sourceShare ShareIdentityIntf) (_model *SharePrototypeShareBySourceShare, err error) { +func (*VpcV1) NewSharePrototypeShareBySourceShare(profile ShareProfileIdentityIntf, replicationCronSpec string, sourceShare ShareIdentityIntf, zone ZoneIdentityIntf) (_model *SharePrototypeShareBySourceShare, err error) { _model = &SharePrototypeShareBySourceShare{ Profile: profile, - Zone: zone, ReplicationCronSpec: core.StringPtr(replicationCronSpec), SourceShare: sourceShare, + Zone: zone, } err = core.ValidateStruct(_model, "required parameters") if err != nil { @@ -114860,9 +117149,9 @@ func (*SharePrototypeShareBySourceShare) isaSharePrototype() bool { // UnmarshalSharePrototypeShareBySourceShare unmarshals an instance of SharePrototypeShareBySourceShare from the specified map of raw messages. func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SharePrototypeShareBySourceShare) - err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + err = core.UnmarshalPrimitive(m, "allowed_transit_encryption_modes", &obj.AllowedTransitEncryptionModes) if err != nil { - err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "allowed_transit_encryption_modes-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) @@ -114875,11 +117164,6 @@ func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, res err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) - return - } err = core.UnmarshalModel(m, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) if err != nil { err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) @@ -114890,14 +117174,19 @@ func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, res err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) if err != nil { - err = core.SDKErrorf(err, "", "encryption_key-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) @@ -114915,6 +117204,11 @@ func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, res err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -115842,7 +118136,10 @@ type VpcdnsResolverTypeDelegated struct { // // - by the system when `dns.resolver.type` is `system` // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` - // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual` + // + // The maximum number of DNS servers is expected to + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Servers []DnsServer `json:"servers" validate:"required"` // The type of the DNS resolver used for the VPC. @@ -115893,7 +118190,10 @@ type VpcdnsResolverTypeManual struct { // // - by the system when `dns.resolver.type` is `system` // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` - // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual` + // + // The maximum number of DNS servers is expected to + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Servers []DnsServer `json:"servers" validate:"required"` // The manually specified DNS servers for this VPC. @@ -115905,6 +118205,9 @@ type VpcdnsResolverTypeManual struct { // If the DNS servers do not have `zone_affinity`, the DHCP [Domain Name Server // Option](https://datatracker.ietf.org/doc/html/rfc2132#section-3.8) for each zone will list all the manual DNS // servers in the order specified. + // + // The maximum number of manual DNS servers is expected to + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ManualServers []DnsServer `json:"manual_servers" validate:"required"` // The type of the DNS resolver used for the VPC. @@ -115950,7 +118253,10 @@ type VpcdnsResolverTypeSystem struct { // // - by the system when `dns.resolver.type` is `system` // - using the DNS servers in `dns.resolver.vpc` when `dns.resolver.type` is `delegated` - // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual`. + // - using `dns.resolver.manual_servers` when the `dns.resolver.type` is `manual` + // + // The maximum number of DNS servers is expected to + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Servers []DnsServer `json:"servers" validate:"required"` // The configuration of the system DNS resolver for this VPC. @@ -116243,6 +118549,402 @@ func UnmarshalVPCIdentityByID(m map[string]json.RawMessage, result interface{}) return } +// VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn struct +// This model "extends" VPNGatewayConnectionIkeIdentityPrototype +type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn struct { + // The IKE identity type. + Type *string `json:"type" validate:"required"` + + // The IKE identity FQDN value. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn.Type property. +// The IKE identity type. +const ( + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdnTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdnTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdnTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdnTypeKeyIDConst = "key_id" +) + +// NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn : Instantiate VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn(typeVar string, value string) (_model *VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn, err error) { + _model = &VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn{ + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn) isaVPNGatewayConnectionIkeIdentityPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn) + 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 +} + +// VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname struct +// This model "extends" VPNGatewayConnectionIkeIdentityPrototype +type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname struct { + // The IKE identity type. + Type *string `json:"type" validate:"required"` + + // The IKE identity hostname value. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname.Type property. +// The IKE identity type. +const ( + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostnameTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostnameTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostnameTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostnameTypeKeyIDConst = "key_id" +) + +// NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname : Instantiate VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname(typeVar string, value string) (_model *VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname, err error) { + _model = &VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname{ + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname) isaVPNGatewayConnectionIkeIdentityPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityHostname) + 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 +} + +// VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 struct +// This model "extends" VPNGatewayConnectionIkeIdentityPrototype +type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 struct { + // The IKE identity type. + Type *string `json:"type" validate:"required"` + + // The IKE identity IPv4 address value. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4.Type property. +// The IKE identity type. +const ( + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4TypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4TypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4TypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4TypeKeyIDConst = "key_id" +) + +// NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 : Instantiate VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4(typeVar string, value string) (_model *VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4, err error) { + _model = &VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4{ + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4) isaVPNGatewayConnectionIkeIdentityPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4 from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityIPv4) + 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 +} + +// VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID struct +// This model "extends" VPNGatewayConnectionIkeIdentityPrototype +type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID struct { + // The IKE identity type. + Type *string `json:"type" validate:"required"` + + // The base64-encoded IKE identity key ID value. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID.Type property. +// The IKE identity type. +const ( + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyIDTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyIDTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyIDTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyIDTypeKeyIDConst = "key_id" +) + +// NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID : Instantiate VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID(typeVar string, value string) (_model *VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID, err error) { + _model = &VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID{ + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID) isaVPNGatewayConnectionIkeIdentityPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID unmarshals an instance of VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityKeyID) + 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 +} + +// VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn : VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn struct +// This model "extends" VPNGatewayConnectionIkeIdentity +type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn struct { + // The IKE identity type. + // + // 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 IKE identity FQDN value. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn.Type property. +// The IKE identity type. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdnTypeKeyIDConst = "key_id" +) + +func (*VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn) isaVPNGatewayConnectionIkeIdentity() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn unmarshals an instance of VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn) + 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 +} + +// VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname : VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname struct +// This model "extends" VPNGatewayConnectionIkeIdentity +type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname struct { + // The IKE identity type. + // + // 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 IKE identity hostname value. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname.Type property. +// The IKE identity type. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostnameTypeKeyIDConst = "key_id" +) + +func (*VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname) isaVPNGatewayConnectionIkeIdentity() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname unmarshals an instance of VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityHostname) + 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 +} + +// VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 : VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 struct +// This model "extends" VPNGatewayConnectionIkeIdentity +type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 struct { + // The IKE identity type. + // + // 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 IKE identity IPv4 address value. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4.Type property. +// The IKE identity type. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4TypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4TypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4TypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4TypeKeyIDConst = "key_id" +) + +func (*VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4) isaVPNGatewayConnectionIkeIdentity() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 unmarshals an instance of VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4 from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityIPv4) + 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 +} + +// VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID : VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID struct +// This model "extends" VPNGatewayConnectionIkeIdentity +type VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID struct { + // The IKE identity type. + // + // 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 base64-encoded IKE identity key ID value. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID.Type property. +// The IKE identity type. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDTypeFqdnConst = "fqdn" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDTypeHostnameConst = "hostname" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDTypeIpv4AddressConst = "ipv4_address" + VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyIDTypeKeyIDConst = "key_id" +) + +func (*VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID) isaVPNGatewayConnectionIkeIdentity() bool { + return true +} + +// UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID unmarshals an instance of VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyID) + 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 +} + // VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref : VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref struct // This model "extends" VPNGatewayConnectionIkePolicyPatch type VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref struct { @@ -116523,6 +119225,94 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(m return } +// VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch : 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: +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch +// This model "extends" VPNGatewayConnectionPeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch struct { + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch() bool { + return true +} + +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchIntf interface { + VPNGatewayConnectionPeerPatchIntf + isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch() bool +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + 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: +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch +// This model "extends" VPNGatewayConnectionPeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch struct { + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch() bool { + return true +} + +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchIntf interface { + VPNGatewayConnectionPeerPatchIntf + isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch() bool +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNGatewayConnectionPolicyMode : VPNGatewayConnectionPolicyMode struct // This model "extends" VPNGatewayConnection type VPNGatewayConnectionPolicyMode struct { @@ -116537,6 +119327,15 @@ type VPNGatewayConnectionPolicyMode struct { DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode" validate:"required"` + // The VPN connection's canonical URL. Href *string `json:"href" validate:"required"` @@ -116557,9 +119356,6 @@ type VPNGatewayConnectionPolicyMode struct { // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. Name *string `json:"name" validate:"required"` - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` - // The pre-shared key. Psk *string `json:"psk" validate:"required"` @@ -116572,11 +119368,9 @@ type VPNGatewayConnectionPolicyMode struct { // The reasons for the current VPN gateway connection status (if any). StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` - // The local CIDRs for this resource. - LocalCIDRs []string `json:"local_cidrs" validate:"required"` + Local *VPNGatewayConnectionPolicyModeLocal `json:"local" validate:"required"` - // The peer CIDRs for this resource. - PeerCIDRs []string `json:"peer_cidrs" validate:"required"` + Peer VPNGatewayConnectionPolicyModePeerIntf `json:"peer" validate:"required"` } // Constants associated with the VPNGatewayConnectionPolicyMode.AuthenticationMode property. @@ -116585,6 +119379,19 @@ const ( VPNGatewayConnectionPolicyModeAuthenticationModePskConst = "psk" ) +// Constants associated with the VPNGatewayConnectionPolicyMode.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionPolicyModeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionPolicyModeEstablishModePeerOnlyConst = "peer_only" +) + // Constants associated with the VPNGatewayConnectionPolicyMode.Mode property. // The mode of the VPN gateway. const ( @@ -116632,6 +119439,11 @@ func UnmarshalVPNGatewayConnectionPolicyMode(m map[string]json.RawMessage, resul err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -116662,11 +119474,6 @@ func UnmarshalVPNGatewayConnectionPolicyMode(m map[string]json.RawMessage, resul err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - err = core.SDKErrorf(err, "", "peer_address-error", common.GetComponentInfo()) - return - } err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) if err != nil { err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) @@ -116687,14 +119494,234 @@ func UnmarshalVPNGatewayConnectionPolicyMode(m map[string]json.RawMessage, resul err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionPolicyModeLocal) + if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionPolicyModePeer) + if err != nil { + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress struct +// This model "extends" VPNGatewayConnectionPolicyModePeerPrototype +type VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress struct { + // The peer CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address" validate:"required"` +} + +// NewVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress : Instantiate VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress(cidrs []string, address string) (_model *VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress, err error) { + _model = &VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress{ + CIDRs: cidrs, + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionPolicyModePeerPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByAddress) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct +// This model "extends" VPNGatewayConnectionPolicyModePeerPrototype +type VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct { + // The peer CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn" validate:"required"` +} + +// NewVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn : Instantiate VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn(cidrs []string, fqdn string) (_model *VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn, err error) { + _model = &VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn{ + CIDRs: cidrs, + Fqdn: core.StringPtr(fqdn), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionPolicyModePeerPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModePeerPrototypeVPNGatewayConnectionPeerByFqdn) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) if err != nil { - err = core.SDKErrorf(err, "", "local_cidrs-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) if err != nil { - err = core.SDKErrorf(err, "", "peer_cidrs-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress struct +// This model "extends" VPNGatewayConnectionPolicyModePeer +type VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress struct { + // The peer CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddressTypeAddressConst = "address" + VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddressTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionPolicyModePeer() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByAddress) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn struct +// This model "extends" VPNGatewayConnectionPolicyModePeer +type VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn struct { + // The peer CIDRs for this VPN gateway connection. + CIDRs []string `json:"cidrs" validate:"required"` + + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdnTypeAddressConst = "address" + VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdnTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionPolicyModePeer() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn) + err = core.UnmarshalPrimitive(m, "cidrs", &obj.CIDRs) + if err != nil { + err = core.SDKErrorf(err, "", "cidrs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116709,6 +119736,15 @@ type VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode,omitempty"` + IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` @@ -116717,26 +119753,33 @@ type VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` - // The pre-shared key. Psk *string `json:"psk" validate:"required"` - // The local CIDRs for this resource. - LocalCIDRs []string `json:"local_cidrs" validate:"required"` + Local *VPNGatewayConnectionPolicyModeLocalPrototype `json:"local" validate:"required"` - // The peer CIDRs for this resource. - PeerCIDRs []string `json:"peer_cidrs" validate:"required"` + Peer VPNGatewayConnectionPolicyModePeerPrototypeIntf `json:"peer" validate:"required"` } +// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototypeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototypeEstablishModePeerOnlyConst = "peer_only" +) + // NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(peerAddress string, psk string, localCIDRs []string, peerCIDRs []string) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype, err error) { +func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(psk string, local *VPNGatewayConnectionPolicyModeLocalPrototype, peer VPNGatewayConnectionPolicyModePeerPrototypeIntf) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype, err error) { _model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype{ - PeerAddress: core.StringPtr(peerAddress), - Psk: core.StringPtr(psk), - LocalCIDRs: localCIDRs, - PeerCIDRs: peerCIDRs, + Psk: core.StringPtr(psk), + Local: local, + Peer: peer, } err = core.ValidateStruct(_model, "required parameters") if err != nil { @@ -116762,6 +119805,11 @@ func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototy err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) if err != nil { err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) @@ -116777,24 +119825,19 @@ func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototy err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - err = core.SDKErrorf(err, "", "peer_address-error", common.GetComponentInfo()) - return - } err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) if err != nil { err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionPolicyModeLocalPrototype) if err != nil { - err = core.SDKErrorf(err, "", "local_cidrs-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionPolicyModePeerPrototype) if err != nil { - err = core.SDKErrorf(err, "", "peer_cidrs-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -116809,6 +119852,15 @@ type VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype s DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode,omitempty"` + IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` @@ -116817,16 +119869,30 @@ type VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype s // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` - // The pre-shared key. Psk *string `json:"psk" validate:"required"` + Local *VPNGatewayConnectionStaticRouteModeLocalPrototype `json:"local,omitempty"` + + Peer VPNGatewayConnectionStaticRouteModePeerPrototypeIntf `json:"peer" validate:"required"` + // Routing protocols are disabled for this VPN gateway connection. RoutingProtocol *string `json:"routing_protocol,omitempty"` } +// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototypeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototypeEstablishModePeerOnlyConst = "peer_only" +) + // Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype.RoutingProtocol property. // Routing protocols are disabled for this VPN gateway connection. const ( @@ -116834,10 +119900,10 @@ const ( ) // NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(peerAddress string, psk string) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype, err error) { +func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(psk string, peer VPNGatewayConnectionStaticRouteModePeerPrototypeIntf) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype, err error) { _model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype{ - PeerAddress: core.StringPtr(peerAddress), - Psk: core.StringPtr(psk), + Psk: core.StringPtr(psk), + Peer: peer, } err = core.ValidateStruct(_model, "required parameters") if err != nil { @@ -116863,6 +119929,11 @@ func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePr err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) if err != nil { err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) @@ -116878,14 +119949,19 @@ func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePr err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype) if err != nil { - err = core.SDKErrorf(err, "", "peer_address-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototype) if err != nil { - err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) @@ -116913,6 +119989,15 @@ type VPNGatewayConnectionRouteMode struct { DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode" validate:"required"` + // The VPN connection's canonical URL. Href *string `json:"href" validate:"required"` @@ -116933,9 +120018,6 @@ type VPNGatewayConnectionRouteMode struct { // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. Name *string `json:"name" validate:"required"` - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` - // The pre-shared key. Psk *string `json:"psk" validate:"required"` @@ -116948,6 +120030,10 @@ type VPNGatewayConnectionRouteMode struct { // The reasons for the current VPN gateway connection status (if any). StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local,omitempty"` + + Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer,omitempty"` + // Routing protocols are disabled for this VPN gateway connection. RoutingProtocol *string `json:"routing_protocol,omitempty"` @@ -116961,6 +120047,19 @@ const ( VPNGatewayConnectionRouteModeAuthenticationModePskConst = "psk" ) +// Constants associated with the VPNGatewayConnectionRouteMode.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionRouteModeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionRouteModeEstablishModePeerOnlyConst = "peer_only" +) + // Constants associated with the VPNGatewayConnectionRouteMode.Mode property. // The mode of the VPN gateway. const ( @@ -117002,14 +120101,9 @@ func (*VPNGatewayConnectionRouteMode) isaVPNGatewayConnection() bool { // UnmarshalVPNGatewayConnectionRouteMode unmarshals an instance of VPNGatewayConnectionRouteMode from the specified map of raw messages. func UnmarshalVPNGatewayConnectionRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { -<<<<<<< Updated upstream - obj := new(VPNGatewayConnectionRouteMode) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) -======= // Retrieve discriminator value to determine correct "subclass". var discValue string err = core.UnmarshalPrimitive(m, "routing_protocol", &discValue) ->>>>>>> Stashed changes if err != nil { errMsg := fmt.Sprintf("error unmarshalling discriminator property 'routing_protocol': %s", err.Error()) err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) @@ -117031,6 +120125,192 @@ func UnmarshalVPNGatewayConnectionRouteMode(m map[string]json.RawMessage, result return } +// VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress struct +// This model "extends" VPNGatewayConnectionStaticRouteModePeerPrototype +type VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress struct { + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address" validate:"required"` +} + +// NewVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress : Instantiate VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress(address string) (_model *VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress, err error) { + _model = &VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionStaticRouteModePeerPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress) + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct +// This model "extends" VPNGatewayConnectionStaticRouteModePeerPrototype +type VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct { + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn" validate:"required"` +} + +// NewVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn : Instantiate VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn(fqdn string) (_model *VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn, err error) { + _model = &VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn{ + Fqdn: core.StringPtr(fqdn), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionStaticRouteModePeerPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn) + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress struct +// This model "extends" VPNGatewayConnectionStaticRouteModePeer +type VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress struct { + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddressTypeAddressConst = "address" + VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddressTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionStaticRouteModePeer() bool { + return true +} + +// UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByAddress) + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn struct +// This model "extends" VPNGatewayConnectionStaticRouteModePeer +type VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn struct { + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdnTypeAddressConst = "address" + VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdnTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionStaticRouteModePeer() bool { + return true +} + +// UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModePeerVPNGatewayConnectionPeerByFqdn) + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNGatewayPolicyMode : VPNGatewayPolicyMode struct // This model "extends" VPNGateway type VPNGatewayPolicyMode struct { @@ -121565,6 +124845,11 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -121572,6 +124857,11 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -121641,6 +124931,15 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } +// Constants associated with the InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachmentConfidentialComputeModeDisabledConst = "disabled" + InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachmentConfidentialComputeModeSgxConst = "sgx" +) + // NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment, err error) { _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkAttachment{ @@ -121671,11 +124970,21 @@ func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferin err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -121766,6 +125075,11 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -121773,6 +125087,11 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -121842,6 +125161,15 @@ type InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstance PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } +// Constants associated with the InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterfaceConfidentialComputeModeDisabledConst = "disabled" + InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterfaceConfidentialComputeModeSgxConst = "sgx" +) + // NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) func (*VpcV1) NewInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface, err error) { _model = &InstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferingInstanceByNetworkInterface{ @@ -121872,11 +125200,21 @@ func UnmarshalInstancePrototypeInstanceByCatalogOfferingInstanceByCatalogOfferin err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -121967,6 +125305,11 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -121974,6 +125317,11 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -122044,6 +125392,15 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } +// Constants associated with the InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachmentConfidentialComputeModeDisabledConst = "disabled" + InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachmentConfidentialComputeModeSgxConst = "sgx" +) + // NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment (Generic Model Constructor) func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment, err error) { _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAttachment{ @@ -122074,11 +125431,21 @@ func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkAt err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -122169,6 +125536,11 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface s // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -122176,6 +125548,11 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface s // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -122246,6 +125623,15 @@ type InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface s PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } +// Constants associated with the InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterfaceConfidentialComputeModeDisabledConst = "disabled" + InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterfaceConfidentialComputeModeSgxConst = "sgx" +) + // NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface (Generic Model Constructor) func (*VpcV1) NewInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface, err error) { _model = &InstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkInterface{ @@ -122276,11 +125662,21 @@ func UnmarshalInstancePrototypeInstanceByImageInstanceByImageInstanceByNetworkIn err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -122371,6 +125767,11 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -122378,6 +125779,11 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -122445,6 +125851,15 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } +// Constants associated with the InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachmentConfidentialComputeModeDisabledConst = "disabled" + InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachmentConfidentialComputeModeSgxConst = "sgx" +) + // NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment, err error) { _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkAttachment{ @@ -122475,11 +125890,21 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotI err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -122565,6 +125990,11 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -122572,6 +126002,11 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -122639,6 +126074,15 @@ type InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceBy PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } +// Constants associated with the InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterfaceConfidentialComputeModeDisabledConst = "disabled" + InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterfaceConfidentialComputeModeSgxConst = "sgx" +) + // NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) func (*VpcV1) NewInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface, err error) { _model = &InstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotInstanceByNetworkInterface{ @@ -122669,11 +126113,21 @@ func UnmarshalInstancePrototypeInstanceBySourceSnapshotInstanceBySourceSnapshotI err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -122759,6 +126213,11 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmen // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -122766,6 +126225,11 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmen // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -122833,6 +126297,15 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmen PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } +// Constants associated with the InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmentConfidentialComputeModeDisabledConst = "disabled" + InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachmentConfidentialComputeModeSgxConst = "sgx" +) + // NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment (Generic Model Constructor) func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment, err error) { _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkAttachment{ @@ -122863,11 +126336,21 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -122953,6 +126436,11 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -122960,6 +126448,11 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -123027,6 +126520,15 @@ type InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } +// Constants associated with the InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterfaceConfidentialComputeModeDisabledConst = "disabled" + InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterfaceConfidentialComputeModeSgxConst = "sgx" +) + // NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface : Instantiate InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface (Generic Model Constructor) func (*VpcV1) NewInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceByVolumeContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface, err error) { _model = &InstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetworkInterface{ @@ -123057,11 +126559,21 @@ func UnmarshalInstancePrototypeInstanceByVolumeInstanceByVolumeInstanceByNetwork err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -123147,6 +126659,11 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -123154,6 +126671,11 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -123221,6 +126743,15 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } +// Constants associated with the InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachmentConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachmentConfidentialComputeModeSgxConst = "sgx" +) + // NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment (Generic Model Constructor) func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment, err error) { _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkAttachment{ @@ -123251,11 +126782,21 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -123346,6 +126887,11 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -123353,6 +126899,11 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -123420,6 +126971,15 @@ type InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateB PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } +// Constants associated with the InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterfaceConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterfaceConfidentialComputeModeSgxConst = "sgx" +) + // NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface (Generic Model Constructor) func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface(catalogOffering InstanceCatalogOfferingPrototypeIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface, err error) { _model = &InstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstanceTemplateByCatalogOfferingInstanceByNetworkInterface{ @@ -123450,11 +127010,21 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByCatalogOfferingInstance err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -123545,6 +127115,11 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -123552,6 +127127,11 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -123620,6 +127200,15 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } +// Constants associated with the InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachmentConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachmentConfidentialComputeModeSgxConst = "sgx" +) + // NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment (Generic Model Constructor) func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment, err error) { _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkAttachment{ @@ -123650,11 +127239,21 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -123745,6 +127344,11 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -123752,6 +127356,11 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -123820,6 +127429,15 @@ type InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInst PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } +// Constants associated with the InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterfaceConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterfaceConfidentialComputeModeSgxConst = "sgx" +) + // NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface (Generic Model Constructor) func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface(image ImageIdentityIntf, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface, err error) { _model = &InstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateByImageInstanceByNetworkInterface{ @@ -123850,11 +127468,21 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateByImageInstanceTemplateBy err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -123945,6 +127573,11 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -123952,6 +127585,11 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -124017,6 +127655,15 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } +// Constants associated with the InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachmentConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachmentConfidentialComputeModeSgxConst = "sgx" +) + // NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment (Generic Model Constructor) func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkAttachment *InstanceNetworkAttachmentPrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment, err error) { _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkAttachment{ @@ -124047,11 +127694,21 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -124137,6 +127794,11 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The default trusted profile configuration to use for this virtual server instance // // This property's value is used when provisioning the virtual server instance, but not subsequently managed. @@ -124144,6 +127806,11 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The public SSH keys for the administrative user of the virtual server instance. Keys will be made available to the // virtual server instance as cloud-init vendor data. For cloud-init enabled images, these keys will also be added as // SSH authorized keys for the administrative user. @@ -124209,6 +127876,15 @@ type InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBy PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } +// Constants associated with the InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterfaceConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterfaceConfidentialComputeModeSgxConst = "sgx" +) + // NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface : Instantiate InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface (Generic Model Constructor) func (*VpcV1) NewInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface(bootVolumeAttachment *VolumeAttachmentPrototypeInstanceBySourceSnapshotContext, zone ZoneIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype) (_model *InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface, err error) { _model = &InstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceTemplateBySourceSnapshotInstanceByNetworkInterface{ @@ -124239,11 +127915,21 @@ func UnmarshalInstanceTemplatePrototypeInstanceTemplateBySourceSnapshotInstanceT err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalModel(m, "default_trusted_profile", &obj.DefaultTrustedProfile, UnmarshalInstanceDefaultTrustedProfilePrototype) if err != nil { err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) if err != nil { err = core.SDKErrorf(err, "", "keys-error", common.GetComponentInfo()) @@ -124329,6 +128015,11 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -124342,6 +128033,11 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The URL for this instance template. Href *string `json:"href" validate:"required"` @@ -124415,6 +128111,15 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } +// Constants associated with the InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachmentConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachmentConfidentialComputeModeSgxConst = "sgx" +) + func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { return true } @@ -124431,6 +128136,11 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -124446,6 +128156,11 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -124546,6 +128261,11 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -124559,6 +128279,11 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The URL for this instance template. Href *string `json:"href" validate:"required"` @@ -124632,6 +128357,15 @@ type InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByC PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } +// Constants associated with the InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterfaceConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterfaceConfidentialComputeModeSgxConst = "sgx" +) + func (*InstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextInstanceByCatalogOfferingInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContext() bool { return true } @@ -124648,6 +128382,11 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -124663,6 +128402,11 @@ func UnmarshalInstanceTemplateInstanceByCatalogOfferingInstanceTemplateContextIn err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -124763,6 +128507,11 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -124776,6 +128525,11 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The URL for this instance template. Href *string `json:"href" validate:"required"` @@ -124850,6 +128604,15 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } +// Constants associated with the InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachmentConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachmentConfidentialComputeModeSgxConst = "sgx" +) + func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { return true } @@ -124866,6 +128629,11 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -124881,6 +128649,11 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -124981,6 +128754,11 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -124994,6 +128772,11 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The URL for this instance template. Href *string `json:"href" validate:"required"` @@ -125068,6 +128851,15 @@ type InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstan PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } +// Constants associated with the InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterfaceConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterfaceConfidentialComputeModeSgxConst = "sgx" +) + func (*InstanceTemplateInstanceByImageInstanceTemplateContextInstanceByImageInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceByImageInstanceTemplateContext() bool { return true } @@ -125084,6 +128876,11 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -125099,6 +128896,11 @@ func UnmarshalInstanceTemplateInstanceByImageInstanceTemplateContextInstanceByIm err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -125199,6 +129001,11 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -125212,6 +129019,11 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The URL for this instance template. Href *string `json:"href" validate:"required"` @@ -125286,6 +129098,15 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo PrimaryNetworkAttachment *InstanceNetworkAttachmentPrototype `json:"primary_network_attachment" validate:"required"` } +// Constants associated with the InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachmentConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachmentConfidentialComputeModeSgxConst = "sgx" +) + func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkAttachment) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { return true } @@ -125302,6 +129123,11 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -125317,6 +129143,11 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -125417,6 +129248,11 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo // The availability policy to use for this virtual server instance. AvailabilityPolicy *InstanceAvailabilityPolicyPrototype `json:"availability_policy,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. + ConfidentialComputeMode *string `json:"confidential_compute_mode,omitempty"` + // The date and time that the instance template was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -125430,6 +129266,11 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo // initialization](https://cloud.ibm.com/apidocs/vpc#get-instance-initialization) property. DefaultTrustedProfile *InstanceDefaultTrustedProfilePrototype `json:"default_trusted_profile,omitempty"` + // Indicates whether secure boot is enabled for this virtual server instance. + // + // If unspecified, the default secure boot mode from the profile will be used. + EnableSecureBoot *bool `json:"enable_secure_boot,omitempty"` + // The URL for this instance template. Href *string `json:"href" validate:"required"` @@ -125507,6 +129348,15 @@ type InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySo PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` } +// Constants associated with the InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface.ConfidentialComputeMode property. +// The confidential compute mode to use for this virtual server instance. +// +// If unspecified, the default confidential compute mode from the profile will be used. +const ( + InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterfaceConfidentialComputeModeDisabledConst = "disabled" + InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterfaceConfidentialComputeModeSgxConst = "sgx" +) + func (*InstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextInstanceBySourceSnapshotInstanceTemplateContextInstanceByNetworkInterface) isaInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContext() bool { return true } @@ -125523,6 +129373,11 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns err = core.SDKErrorf(err, "", "availability_policy-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()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -125538,6 +129393,11 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns err = core.SDKErrorf(err, "", "default_trusted_profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -127061,206 +130921,108 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte return } -// VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct -// This model "extends" VPNGatewayConnectionRouteMode -type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up" validate:"required"` - - // The authentication mode. Only `psk` is currently supported. - AuthenticationMode *string `json:"authentication_mode" validate:"required"` - - // The date and time that this VPN gateway connection was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The IKE policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` - - // The IPsec policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` - - // The mode of the VPN gateway. - Mode *string `json:"mode" validate:"required"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name" validate:"required"` +// VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch struct +// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch struct { + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` +} - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch() bool { + return true +} - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The status of a VPN gateway connection. - Status *string `json:"status" validate:"required"` +// VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct +// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct { + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} - // The reasons for the current VPN gateway connection status (if any): - // - `cannot_authenticate_connection`: Failed to authenticate a connection because of - // mismatched IKE ID and PSK (check IKE ID and PSK in peer VPN configuration) - // - `internal_error`: Internal error (contact IBM support) - // - `ike_policy_mismatch`: None of the proposed IKE crypto suites was acceptable (check - // the IKE policies on both sides of the VPN) - // - `ike_v1_id_local_remote_cidr_mismatch`: Invalid IKE ID or mismatched local CIDRs and - // remote CIDRs in IKE V1 (check the IKE ID or the local CIDRs and remote CIDRs in IKE - // V1 configuration) - // - `ike_v2_local_remote_cidr_mismatch`: Mismatched local CIDRs and remote CIDRs in IKE - // V2 (check the local CIDRs and remote CIDRs in IKE V2 configuration) - // - `ipsec_policy_mismatch`: None of the proposed IPsec crypto suites was acceptable - // (check the IPsec policies on both sides of the VPN) - // - `peer_not_responding`: No response from peer (check network ACL configuration, peer - // availability, and on-premise firewall configuration) - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch() bool { + return true +} - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol" validate:"required"` +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} - // The VPN tunnel configuration for this VPN gateway connection (in static route mode). - Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels" validate:"required"` +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerFqdnPatch) + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.AuthenticationMode property. -// The authentication mode. Only `psk` is currently supported. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeAuthenticationModePskConst = "psk" -) +// VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch struct +// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch struct { + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` +} -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.Mode property. -// The mode of the VPN gateway. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeModePolicyConst = "policy" - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeModeRouteConst = "route" -) +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch() bool { + return true +} -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.ResourceType property. -// The resource type. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.Status property. -// The status of a VPN gateway connection. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeStatusDownConst = "down" - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeStatusUpConst = "up" -) +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeRoutingProtocolNoneConst = "none" -) +// VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct +// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct { + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} -func (*VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnectionRouteMode() bool { +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch() bool { return true } -func (*VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnection() bool { +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatch() bool { return true } -// UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode unmarshals an instance of VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) - if err != nil { - err = core.SDKErrorf(err, "", "authentication_mode-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, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) - if err != nil { - err = core.SDKErrorf(err, "", "dead_peer_detection-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, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) - if err != nil { - err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) - if err != nil { - err = core.SDKErrorf(err, "", "ipsec_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-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, "peer_address", &obj.PeerAddress) - if err != nil { - err = core.SDKErrorf(err, "", "peer_address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - err = core.SDKErrorf(err, "", "psk-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, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) - if err != nil { - err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionStaticRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) if err != nil { - err = core.SDKErrorf(err, "", "tunnels-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -127281,6 +131043,15 @@ type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode" validate:"required"` + // The VPN connection's canonical URL. Href *string `json:"href" validate:"required"` @@ -127301,9 +131072,6 @@ type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. Name *string `json:"name" validate:"required"` - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` - // The pre-shared key. Psk *string `json:"psk" validate:"required"` @@ -127316,6 +131084,10 @@ type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { // The reasons for the current VPN gateway connection status (if any). StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local" validate:"required"` + + Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer" validate:"required"` + // Routing protocols are disabled for this VPN gateway connection. RoutingProtocol *string `json:"routing_protocol" validate:"required"` @@ -127329,6 +131101,19 @@ const ( VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeAuthenticationModePskConst = "psk" ) +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeEstablishModePeerOnlyConst = "peer_only" +) + // Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.Mode property. // The mode of the VPN gateway. const ( @@ -127368,70 +131153,97 @@ func UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode(m obj := new(VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) if err != nil { + err = core.SDKErrorf(err, "", "authentication_mode-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, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + err = core.SDKErrorf(err, "", "establish_mode-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, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) if err != nil { + err = core.SDKErrorf(err, "", "psk-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, "status", &obj.Status) if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocal) + if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionStaticRouteModePeer) + if err != nil { + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) if err != nil { + err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) return } err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) if err != nil { + err = core.SDKErrorf(err, "", "tunnels-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -130166,13 +133978,9 @@ func (pager *DedicatedHostsPager) GetNext() (page []DedicatedHost, err error) { // GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. func (pager *DedicatedHostsPager) GetAll() (allItems []DedicatedHost, err error) { -<<<<<<< Updated upstream - return pager.GetAllWithContext(context.Background()) -======= allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return ->>>>>>> Stashed changes } // PlacementGroupsPager can be used to simplify the use of the "ListPlacementGroups" method. @@ -131187,6 +134995,98 @@ func (pager *SharesPager) GetAll() (allItems []Share, err error) { return } +// ShareAccessorBindingsPager can be used to simplify the use of the "ListShareAccessorBindings" method. +type ShareAccessorBindingsPager struct { + hasNext bool + options *ListShareAccessorBindingsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewShareAccessorBindingsPager returns a new ShareAccessorBindingsPager instance. +func (vpc *VpcV1) NewShareAccessorBindingsPager(options *ListShareAccessorBindingsOptions) (pager *ShareAccessorBindingsPager, 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 ListShareAccessorBindingsOptions = *options + pager = &ShareAccessorBindingsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ShareAccessorBindingsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ShareAccessorBindingsPager) GetNextWithContext(ctx context.Context) (page []ShareAccessorBinding, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListShareAccessorBindingsWithContext(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.AccessorBindings + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ShareAccessorBindingsPager) GetAllWithContext(ctx context.Context) (allItems []ShareAccessorBinding, err error) { + for pager.HasNext() { + var nextPage []ShareAccessorBinding + 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 *ShareAccessorBindingsPager) GetNext() (page []ShareAccessorBinding, 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 *ShareAccessorBindingsPager) GetAll() (allItems []ShareAccessorBinding, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + // ShareMountTargetsPager can be used to simplify the use of the "ListShareMountTargets" method. type ShareMountTargetsPager struct { hasNext bool @@ -131463,25 +135363,25 @@ func (pager *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err er return } -// BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. -type BackupPoliciesPager struct { +// VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. +type VirtualNetworkInterfacesPager struct { hasNext bool - options *ListBackupPoliciesOptions + options *ListVirtualNetworkInterfacesOptions client *VpcV1 pageContext struct { next *string } } -// NewBackupPoliciesPager returns a new BackupPoliciesPager instance. -func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pager *BackupPoliciesPager, err error) { +// NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. +func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListBackupPoliciesOptions = *options - pager = &BackupPoliciesPager{ + var optionsCopy ListVirtualNetworkInterfacesOptions = *options + pager = &VirtualNetworkInterfacesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -131490,20 +135390,21 @@ func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BackupPoliciesPager) HasNext() bool { +func (pager *VirtualNetworkInterfacesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyIntf, err error) { +func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []VirtualNetworkInterface, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBackupPoliciesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVirtualNetworkInterfacesWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -131512,25 +135413,27 @@ func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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.BackupPolicies + page = result.VirtualNetworkInterfaces return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyIntf, err error) { +func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []VirtualNetworkInterface, err error) { for pager.HasNext() { - var nextPage []BackupPolicyIntf + var nextPage []VirtualNetworkInterface nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -131539,34 +135442,38 @@ func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allIte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BackupPoliciesPager) GetNext() (page []BackupPolicyIntf, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *VirtualNetworkInterfacesPager) GetNext() (page []VirtualNetworkInterface, 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 *BackupPoliciesPager) GetAll() (allItems []BackupPolicyIntf, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// BackupPolicyJobsPager can be used to simplify the use of the "ListBackupPolicyJobs" method. -type BackupPolicyJobsPager struct { +// NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "ListNetworkInterfaceFloatingIps" method. +type NetworkInterfaceFloatingIpsPager struct { hasNext bool - options *ListBackupPolicyJobsOptions + options *ListNetworkInterfaceFloatingIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewBackupPolicyJobsPager returns a new BackupPolicyJobsPager instance. -func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) (pager *BackupPolicyJobsPager, err error) { +// NewNetworkInterfaceFloatingIpsPager returns a new NetworkInterfaceFloatingIpsPager instance. +func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterfaceFloatingIpsOptions) (pager *NetworkInterfaceFloatingIpsPager, err error) { if options.Start != nil && *options.Start != "" { - err = fmt.Errorf("the 'options.Start' field should not be set") + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return } - var optionsCopy ListBackupPolicyJobsOptions = *options - pager = &BackupPolicyJobsPager{ + var optionsCopy ListNetworkInterfaceFloatingIpsOptions = *options + pager = &NetworkInterfaceFloatingIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -131575,20 +135482,21 @@ func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BackupPolicyJobsPager) HasNext() bool { +func (pager *NetworkInterfaceFloatingIpsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyJob, err error) { +func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIPReference, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBackupPolicyJobsWithContext(ctx, pager.options) + result, _, err := pager.client.ListNetworkInterfaceFloatingIpsWithContext(ctx, pager.options) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } @@ -131597,25 +135505,27 @@ func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (pag var start *string start, err = core.GetQueryParam(result.Next.Href, "start") if err != nil { - err = fmt.Errorf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + 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.Jobs + page = result.FloatingIps return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyJob, err error) { +func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIPReference, err error) { for pager.HasNext() { - var nextPage []BackupPolicyJob + var nextPage []FloatingIPReference nextPage, err = pager.GetNextWithContext(ctx) if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") return } allItems = append(allItems, nextPage...) @@ -131624,34 +135534,38 @@ func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allI } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BackupPolicyJobsPager) GetNext() (page []BackupPolicyJob, err error) { - return pager.GetNextWithContext(context.Background()) +func (pager *NetworkInterfaceFloatingIpsPager) GetNext() (page []FloatingIPReference, 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 *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err error) { - return pager.GetAllWithContext(context.Background()) +func (pager *NetworkInterfaceFloatingIpsPager) GetAll() (allItems []FloatingIPReference, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return } -// VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. -type VirtualNetworkInterfacesPager struct { +// VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "ListVirtualNetworkInterfaceIps" method. +type VirtualNetworkInterfaceIpsPager struct { hasNext bool - options *ListVirtualNetworkInterfacesOptions + options *ListVirtualNetworkInterfaceIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. -func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, err error) { +// NewVirtualNetworkInterfaceIpsPager returns a new VirtualNetworkInterfaceIpsPager instance. +func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetworkInterfaceIpsOptions) (pager *VirtualNetworkInterfaceIpsPager, 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 ListVirtualNetworkInterfacesOptions = *options - pager = &VirtualNetworkInterfacesPager{ + var optionsCopy ListVirtualNetworkInterfaceIpsOptions = *options + pager = &VirtualNetworkInterfaceIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -131660,19 +135574,19 @@ func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkIn } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VirtualNetworkInterfacesPager) HasNext() bool { +func (pager *VirtualNetworkInterfaceIpsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []VirtualNetworkInterface, err error) { +func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIPReference, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVirtualNetworkInterfacesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVirtualNetworkInterfaceIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -131691,16 +135605,16 @@ func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.VirtualNetworkInterfaces + page = result.Ips return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []VirtualNetworkInterface, err error) { +func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIPReference, err error) { for pager.HasNext() { - var nextPage []VirtualNetworkInterface + var nextPage []ReservedIPReference nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -131712,38 +135626,38 @@ func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Contex } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VirtualNetworkInterfacesPager) GetNext() (page []VirtualNetworkInterface, err error) { +func (pager *VirtualNetworkInterfaceIpsPager) GetNext() (page []ReservedIPReference, 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 *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, err error) { +func (pager *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPReference, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "ListNetworkInterfaceFloatingIps" method. -type NetworkInterfaceFloatingIpsPager struct { +// PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. +type PublicGatewaysPager struct { hasNext bool - options *ListNetworkInterfaceFloatingIpsOptions + options *ListPublicGatewaysOptions client *VpcV1 pageContext struct { next *string } } -// NewNetworkInterfaceFloatingIpsPager returns a new NetworkInterfaceFloatingIpsPager instance. -func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterfaceFloatingIpsOptions) (pager *NetworkInterfaceFloatingIpsPager, err error) { +// NewPublicGatewaysPager returns a new PublicGatewaysPager instance. +func (vpc *VpcV1) NewPublicGatewaysPager(options *ListPublicGatewaysOptions) (pager *PublicGatewaysPager, 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 ListNetworkInterfaceFloatingIpsOptions = *options - pager = &NetworkInterfaceFloatingIpsPager{ + var optionsCopy ListPublicGatewaysOptions = *options + pager = &PublicGatewaysPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -131752,19 +135666,111 @@ func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterf } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *NetworkInterfaceFloatingIpsPager) HasNext() bool { +func (pager *PublicGatewaysPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIPReference, err error) { +func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page []PublicGateway, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListNetworkInterfaceFloatingIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListPublicGatewaysWithContext(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.PublicGateways + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []PublicGateway, err error) { + for pager.HasNext() { + var nextPage []PublicGateway + 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 *PublicGatewaysPager) GetNext() (page []PublicGateway, 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 *PublicGatewaysPager) GetAll() (allItems []PublicGateway, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. +type FloatingIpsPager struct { + hasNext bool + options *ListFloatingIpsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewFloatingIpsPager returns a new FloatingIpsPager instance. +func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *FloatingIpsPager, 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 ListFloatingIpsOptions = *options + pager = &FloatingIpsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *FloatingIpsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIP, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListFloatingIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -131790,9 +135796,9 @@ func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Co // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIPReference, err error) { +func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIP, err error) { for pager.HasNext() { - var nextPage []FloatingIPReference + var nextPage []FloatingIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -131804,38 +135810,38 @@ func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Con } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *NetworkInterfaceFloatingIpsPager) GetNext() (page []FloatingIPReference, err error) { +func (pager *FloatingIpsPager) GetNext() (page []FloatingIP, 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 *NetworkInterfaceFloatingIpsPager) GetAll() (allItems []FloatingIPReference, err error) { +func (pager *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "ListVirtualNetworkInterfaceIps" method. -type VirtualNetworkInterfaceIpsPager struct { +// NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. +type NetworkAclsPager struct { hasNext bool - options *ListVirtualNetworkInterfaceIpsOptions + options *ListNetworkAclsOptions client *VpcV1 pageContext struct { next *string } } -// NewVirtualNetworkInterfaceIpsPager returns a new VirtualNetworkInterfaceIpsPager instance. -func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetworkInterfaceIpsOptions) (pager *VirtualNetworkInterfaceIpsPager, err error) { +// NewNetworkAclsPager returns a new NetworkAclsPager instance. +func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *NetworkAclsPager, 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 ListVirtualNetworkInterfaceIpsOptions = *options - pager = &VirtualNetworkInterfaceIpsPager{ + var optionsCopy ListNetworkAclsOptions = *options + pager = &NetworkAclsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -131844,19 +135850,19 @@ func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetwork } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VirtualNetworkInterfaceIpsPager) HasNext() bool { +func (pager *NetworkAclsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIPReference, err error) { +func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []NetworkACL, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVirtualNetworkInterfaceIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListNetworkAclsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -131875,16 +135881,16 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Con } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Ips + page = result.NetworkAcls return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIPReference, err error) { +func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACL, err error) { for pager.HasNext() { - var nextPage []ReservedIPReference + var nextPage []NetworkACL nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -131896,38 +135902,38 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Cont } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VirtualNetworkInterfaceIpsPager) GetNext() (page []ReservedIPReference, err error) { +func (pager *NetworkAclsPager) GetNext() (page []NetworkACL, 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 *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPReference, err error) { +func (pager *NetworkAclsPager) GetAll() (allItems []NetworkACL, 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 { +// NetworkACLRulesPager can be used to simplify the use of the "ListNetworkACLRules" method. +type NetworkACLRulesPager struct { hasNext bool - options *ListPublicGatewaysOptions + options *ListNetworkACLRulesOptions client *VpcV1 pageContext struct { next *string } } -// NewPublicGatewaysPager returns a new PublicGatewaysPager instance. -func (vpc *VpcV1) NewPublicGatewaysPager(options *ListPublicGatewaysOptions) (pager *PublicGatewaysPager, err error) { +// NewNetworkACLRulesPager returns a new NetworkACLRulesPager instance. +func (vpc *VpcV1) NewNetworkACLRulesPager(options *ListNetworkACLRulesOptions) (pager *NetworkACLRulesPager, 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 ListPublicGatewaysOptions = *options - pager = &PublicGatewaysPager{ + var optionsCopy ListNetworkACLRulesOptions = *options + pager = &NetworkACLRulesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -131936,19 +135942,19 @@ func (vpc *VpcV1) NewPublicGatewaysPager(options *ListPublicGatewaysOptions) (pa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *PublicGatewaysPager) HasNext() bool { +func (pager *NetworkACLRulesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page []PublicGateway, err error) { +func (pager *NetworkACLRulesPager) GetNextWithContext(ctx context.Context) (page []NetworkACLRuleItemIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListPublicGatewaysWithContext(ctx, pager.options) + result, _, err := pager.client.ListNetworkACLRulesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -131967,16 +135973,16 @@ func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.PublicGateways + page = result.Rules return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []PublicGateway, err error) { +func (pager *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACLRuleItemIntf, err error) { for pager.HasNext() { - var nextPage []PublicGateway + var nextPage []NetworkACLRuleItemIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -131988,38 +135994,38 @@ func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allIte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *PublicGatewaysPager) GetNext() (page []PublicGateway, err error) { +func (pager *NetworkACLRulesPager) GetNext() (page []NetworkACLRuleItemIntf, 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 *PublicGatewaysPager) GetAll() (allItems []PublicGateway, err error) { +func (pager *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. -type FloatingIpsPager struct { +// SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. +type SecurityGroupsPager struct { hasNext bool - options *ListFloatingIpsOptions + options *ListSecurityGroupsOptions client *VpcV1 pageContext struct { next *string } } -// NewFloatingIpsPager returns a new FloatingIpsPager instance. -func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *FloatingIpsPager, err error) { +// NewSecurityGroupsPager returns a new SecurityGroupsPager instance. +func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pager *SecurityGroupsPager, 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 ListFloatingIpsOptions = *options - pager = &FloatingIpsPager{ + var optionsCopy ListSecurityGroupsOptions = *options + pager = &SecurityGroupsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132028,19 +136034,19 @@ func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *F } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *FloatingIpsPager) HasNext() bool { +func (pager *SecurityGroupsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIP, err error) { +func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroup, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListFloatingIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListSecurityGroupsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132059,16 +136065,16 @@ func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []F } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.FloatingIps + page = result.SecurityGroups return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIP, err error) { +func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroup, err error) { for pager.HasNext() { - var nextPage []FloatingIP + var nextPage []SecurityGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -132080,38 +136086,38 @@ func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *FloatingIpsPager) GetNext() (page []FloatingIP, err error) { +func (pager *SecurityGroupsPager) GetNext() (page []SecurityGroup, 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 *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { +func (pager *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. -type NetworkAclsPager struct { +// SecurityGroupTargetsPager can be used to simplify the use of the "ListSecurityGroupTargets" method. +type SecurityGroupTargetsPager struct { hasNext bool - options *ListNetworkAclsOptions + options *ListSecurityGroupTargetsOptions client *VpcV1 pageContext struct { next *string } } -// NewNetworkAclsPager returns a new NetworkAclsPager instance. -func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *NetworkAclsPager, err error) { +// NewSecurityGroupTargetsPager returns a new SecurityGroupTargetsPager instance. +func (vpc *VpcV1) NewSecurityGroupTargetsPager(options *ListSecurityGroupTargetsOptions) (pager *SecurityGroupTargetsPager, 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 ListNetworkAclsOptions = *options - pager = &NetworkAclsPager{ + var optionsCopy ListSecurityGroupTargetsOptions = *options + pager = &SecurityGroupTargetsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132120,19 +136126,19 @@ func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *N } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *NetworkAclsPager) HasNext() bool { +func (pager *SecurityGroupTargetsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []NetworkACL, err error) { +func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroupTargetReferenceIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListNetworkAclsWithContext(ctx, pager.options) + result, _, err := pager.client.ListSecurityGroupTargetsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132151,16 +136157,16 @@ func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []N } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.NetworkAcls + page = result.Targets return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACL, err error) { +func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroupTargetReferenceIntf, err error) { for pager.HasNext() { - var nextPage []NetworkACL + var nextPage []SecurityGroupTargetReferenceIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -132172,38 +136178,38 @@ func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *NetworkAclsPager) GetNext() (page []NetworkACL, err error) { +func (pager *SecurityGroupTargetsPager) GetNext() (page []SecurityGroupTargetReferenceIntf, 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 *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { +func (pager *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTargetReferenceIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// NetworkACLRulesPager can be used to simplify the use of the "ListNetworkACLRules" method. -type NetworkACLRulesPager struct { +// IkePoliciesPager can be used to simplify the use of the "ListIkePolicies" method. +type IkePoliciesPager struct { hasNext bool - options *ListNetworkACLRulesOptions + options *ListIkePoliciesOptions client *VpcV1 pageContext struct { next *string } } -// NewNetworkACLRulesPager returns a new NetworkACLRulesPager instance. -func (vpc *VpcV1) NewNetworkACLRulesPager(options *ListNetworkACLRulesOptions) (pager *NetworkACLRulesPager, err error) { +// NewIkePoliciesPager returns a new IkePoliciesPager instance. +func (vpc *VpcV1) NewIkePoliciesPager(options *ListIkePoliciesOptions) (pager *IkePoliciesPager, 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 ListNetworkACLRulesOptions = *options - pager = &NetworkACLRulesPager{ + var optionsCopy ListIkePoliciesOptions = *options + pager = &IkePoliciesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132212,19 +136218,19 @@ func (vpc *VpcV1) NewNetworkACLRulesPager(options *ListNetworkACLRulesOptions) ( } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *NetworkACLRulesPager) HasNext() bool { +func (pager *IkePoliciesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *NetworkACLRulesPager) GetNextWithContext(ctx context.Context) (page []NetworkACLRuleItemIntf, err error) { +func (pager *IkePoliciesPager) GetNextWithContext(ctx context.Context) (page []IkePolicy, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListNetworkACLRulesWithContext(ctx, pager.options) + result, _, err := pager.client.ListIkePoliciesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132243,16 +136249,16 @@ func (pager *NetworkACLRulesPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Rules + page = result.IkePolicies return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACLRuleItemIntf, err error) { +func (pager *IkePoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IkePolicy, err error) { for pager.HasNext() { - var nextPage []NetworkACLRuleItemIntf + var nextPage []IkePolicy nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -132264,38 +136270,38 @@ func (pager *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allIt } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *NetworkACLRulesPager) GetNext() (page []NetworkACLRuleItemIntf, err error) { +func (pager *IkePoliciesPager) GetNext() (page []IkePolicy, 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 *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, err error) { +func (pager *IkePoliciesPager) GetAll() (allItems []IkePolicy, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. -type SecurityGroupsPager struct { +// IkePolicyConnectionsPager can be used to simplify the use of the "ListIkePolicyConnections" method. +type IkePolicyConnectionsPager struct { hasNext bool - options *ListSecurityGroupsOptions + options *ListIkePolicyConnectionsOptions client *VpcV1 pageContext struct { next *string } } -// NewSecurityGroupsPager returns a new SecurityGroupsPager instance. -func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pager *SecurityGroupsPager, err error) { +// NewIkePolicyConnectionsPager returns a new IkePolicyConnectionsPager instance. +func (vpc *VpcV1) NewIkePolicyConnectionsPager(options *ListIkePolicyConnectionsOptions) (pager *IkePolicyConnectionsPager, 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 ListSecurityGroupsOptions = *options - pager = &SecurityGroupsPager{ + var optionsCopy ListIkePolicyConnectionsOptions = *options + pager = &IkePolicyConnectionsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132304,19 +136310,19 @@ func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *SecurityGroupsPager) HasNext() bool { +func (pager *IkePolicyConnectionsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroup, err error) { +func (pager *IkePolicyConnectionsPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayConnectionIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListSecurityGroupsWithContext(ctx, pager.options) + result, _, err := pager.client.ListIkePolicyConnectionsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132335,16 +136341,16 @@ func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.SecurityGroups + page = result.Connections return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroup, err error) { +func (pager *IkePolicyConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { for pager.HasNext() { - var nextPage []SecurityGroup + var nextPage []VPNGatewayConnectionIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -132356,38 +136362,38 @@ func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allIte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SecurityGroupsPager) GetNext() (page []SecurityGroup, err error) { +func (pager *IkePolicyConnectionsPager) GetNext() (page []VPNGatewayConnectionIntf, 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 *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) { +func (pager *IkePolicyConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// SecurityGroupTargetsPager can be used to simplify the use of the "ListSecurityGroupTargets" method. -type SecurityGroupTargetsPager struct { +// IpsecPoliciesPager can be used to simplify the use of the "ListIpsecPolicies" method. +type IpsecPoliciesPager struct { hasNext bool - options *ListSecurityGroupTargetsOptions + options *ListIpsecPoliciesOptions client *VpcV1 pageContext struct { next *string } } -// NewSecurityGroupTargetsPager returns a new SecurityGroupTargetsPager instance. -func (vpc *VpcV1) NewSecurityGroupTargetsPager(options *ListSecurityGroupTargetsOptions) (pager *SecurityGroupTargetsPager, err error) { +// NewIpsecPoliciesPager returns a new IpsecPoliciesPager instance. +func (vpc *VpcV1) NewIpsecPoliciesPager(options *ListIpsecPoliciesOptions) (pager *IpsecPoliciesPager, 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 ListSecurityGroupTargetsOptions = *options - pager = &SecurityGroupTargetsPager{ + var optionsCopy ListIpsecPoliciesOptions = *options + pager = &IpsecPoliciesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132396,19 +136402,19 @@ func (vpc *VpcV1) NewSecurityGroupTargetsPager(options *ListSecurityGroupTargets } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *SecurityGroupTargetsPager) HasNext() bool { +func (pager *IpsecPoliciesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroupTargetReferenceIntf, err error) { +func (pager *IpsecPoliciesPager) GetNextWithContext(ctx context.Context) (page []IPsecPolicy, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListSecurityGroupTargetsWithContext(ctx, pager.options) + result, _, err := pager.client.ListIpsecPoliciesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132427,16 +136433,16 @@ func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Targets + page = result.IpsecPolicies return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroupTargetReferenceIntf, err error) { +func (pager *IpsecPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IPsecPolicy, err error) { for pager.HasNext() { - var nextPage []SecurityGroupTargetReferenceIntf + var nextPage []IPsecPolicy nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -132448,38 +136454,38 @@ func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) ( } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SecurityGroupTargetsPager) GetNext() (page []SecurityGroupTargetReferenceIntf, err error) { +func (pager *IpsecPoliciesPager) GetNext() (page []IPsecPolicy, 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 *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTargetReferenceIntf, err error) { +func (pager *IpsecPoliciesPager) GetAll() (allItems []IPsecPolicy, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// IkePoliciesPager can be used to simplify the use of the "ListIkePolicies" method. -type IkePoliciesPager struct { +// IpsecPolicyConnectionsPager can be used to simplify the use of the "ListIpsecPolicyConnections" method. +type IpsecPolicyConnectionsPager struct { hasNext bool - options *ListIkePoliciesOptions + options *ListIpsecPolicyConnectionsOptions client *VpcV1 pageContext struct { next *string } } -// NewIkePoliciesPager returns a new IkePoliciesPager instance. -func (vpc *VpcV1) NewIkePoliciesPager(options *ListIkePoliciesOptions) (pager *IkePoliciesPager, err error) { +// NewIpsecPolicyConnectionsPager returns a new IpsecPolicyConnectionsPager instance. +func (vpc *VpcV1) NewIpsecPolicyConnectionsPager(options *ListIpsecPolicyConnectionsOptions) (pager *IpsecPolicyConnectionsPager, 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 ListIkePoliciesOptions = *options - pager = &IkePoliciesPager{ + var optionsCopy ListIpsecPolicyConnectionsOptions = *options + pager = &IpsecPolicyConnectionsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132488,19 +136494,19 @@ func (vpc *VpcV1) NewIkePoliciesPager(options *ListIkePoliciesOptions) (pager *I } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *IkePoliciesPager) HasNext() bool { +func (pager *IpsecPolicyConnectionsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *IkePoliciesPager) GetNextWithContext(ctx context.Context) (page []IkePolicy, err error) { +func (pager *IpsecPolicyConnectionsPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayConnectionIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListIkePoliciesWithContext(ctx, pager.options) + result, _, err := pager.client.ListIpsecPolicyConnectionsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132519,16 +136525,16 @@ func (pager *IkePoliciesPager) GetNextWithContext(ctx context.Context) (page []I } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.IkePolicies + page = result.Connections return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *IkePoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IkePolicy, err error) { +func (pager *IpsecPolicyConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { for pager.HasNext() { - var nextPage []IkePolicy + var nextPage []VPNGatewayConnectionIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -132540,38 +136546,38 @@ func (pager *IkePoliciesPager) GetAllWithContext(ctx context.Context) (allItems } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *IkePoliciesPager) GetNext() (page []IkePolicy, err error) { +func (pager *IpsecPolicyConnectionsPager) GetNext() (page []VPNGatewayConnectionIntf, 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 *IkePoliciesPager) GetAll() (allItems []IkePolicy, err error) { +func (pager *IpsecPolicyConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// IpsecPoliciesPager can be used to simplify the use of the "ListIpsecPolicies" method. -type IpsecPoliciesPager struct { +// VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. +type VPNGatewaysPager struct { hasNext bool - options *ListIpsecPoliciesOptions + options *ListVPNGatewaysOptions client *VpcV1 pageContext struct { next *string } } -// NewIpsecPoliciesPager returns a new IpsecPoliciesPager instance. -func (vpc *VpcV1) NewIpsecPoliciesPager(options *ListIpsecPoliciesOptions) (pager *IpsecPoliciesPager, err error) { +// NewVPNGatewaysPager returns a new VPNGatewaysPager instance. +func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *VPNGatewaysPager, 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 ListIpsecPoliciesOptions = *options - pager = &IpsecPoliciesPager{ + var optionsCopy ListVPNGatewaysOptions = *options + pager = &VPNGatewaysPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132580,19 +136586,19 @@ func (vpc *VpcV1) NewIpsecPoliciesPager(options *ListIpsecPoliciesOptions) (page } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *IpsecPoliciesPager) HasNext() bool { +func (pager *VPNGatewaysPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *IpsecPoliciesPager) GetNextWithContext(ctx context.Context) (page []IPsecPolicy, err error) { +func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListIpsecPoliciesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNGatewaysWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132611,16 +136617,16 @@ func (pager *IpsecPoliciesPager) GetNextWithContext(ctx context.Context) (page [ } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.IpsecPolicies + page = result.VPNGateways return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *IpsecPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []IPsecPolicy, err error) { +func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayIntf, err error) { for pager.HasNext() { - var nextPage []IPsecPolicy + var nextPage []VPNGatewayIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -132632,38 +136638,38 @@ func (pager *IpsecPoliciesPager) GetAllWithContext(ctx context.Context) (allItem } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *IpsecPoliciesPager) GetNext() (page []IPsecPolicy, err error) { +func (pager *VPNGatewaysPager) GetNext() (page []VPNGatewayIntf, 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 *IpsecPoliciesPager) GetAll() (allItems []IPsecPolicy, err error) { +func (pager *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. -type VPNGatewaysPager struct { +// VPNGatewayConnectionsPager can be used to simplify the use of the "ListVPNGatewayConnections" method. +type VPNGatewayConnectionsPager struct { hasNext bool - options *ListVPNGatewaysOptions + options *ListVPNGatewayConnectionsOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNGatewaysPager returns a new VPNGatewaysPager instance. -func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *VPNGatewaysPager, err error) { +// NewVPNGatewayConnectionsPager returns a new VPNGatewayConnectionsPager instance. +func (vpc *VpcV1) NewVPNGatewayConnectionsPager(options *ListVPNGatewayConnectionsOptions) (pager *VPNGatewayConnectionsPager, 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 ListVPNGatewaysOptions = *options - pager = &VPNGatewaysPager{ + var optionsCopy ListVPNGatewayConnectionsOptions = *options + pager = &VPNGatewayConnectionsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132672,19 +136678,19 @@ func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *V } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNGatewaysPager) HasNext() bool { +func (pager *VPNGatewayConnectionsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayIntf, err error) { +func (pager *VPNGatewayConnectionsPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayConnectionIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPNGatewaysWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNGatewayConnectionsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132703,16 +136709,16 @@ func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []V } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.VPNGateways + page = result.Connections return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayIntf, err error) { +func (pager *VPNGatewayConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { for pager.HasNext() { - var nextPage []VPNGatewayIntf + var nextPage []VPNGatewayConnectionIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -132724,14 +136730,14 @@ func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNGatewaysPager) GetNext() (page []VPNGatewayIntf, err error) { +func (pager *VPNGatewayConnectionsPager) GetNext() (page []VPNGatewayConnectionIntf, 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 *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { +func (pager *VPNGatewayConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return From c774fc44b9ed8098144169af4240940117359284 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 27 Aug 2024 09:56:46 +0530 Subject: [PATCH 092/103] Update vpc_v1.go --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 20835 +++++++++------- 1 file changed, 11778 insertions(+), 9057 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 212523acec..29d17994e3 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2022, 2023, 2024. + * (C) Copyright IBM Corp. 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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-07-03`. + // and `2024-08-27`. Version *string } @@ -204,25 +204,24 @@ func (vpc *VpcV1) DisableRetries() { vpc.Service.DisableRetries() } -// ListVpcs : List VPCs -// This request lists VPCs in the region. A VPC is a virtual network that belongs to an account and provides logical -// isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC -// can contain resources in multiple zones in a region. -func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) +// CreateVPC : Create a VPC +// This request creates a new VPC from a VPC prototype object. The prototype object is structured in the same way as a +// retrieved VPC, and contains the information necessary to create the new VPC. +func (vpc *VpcV1) CreateVPC(createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPCWithContext(context.Background(), createVPCOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVpcsWithContext is an alternate form of the ListVpcs method which supports a Context parameter -func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVpcsOptions, "listVpcsOptions") +// CreateVPCWithContext is an alternate form of the CreateVPC method which supports a Context parameter +func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(createVPCOptions, "createVPCOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/vpcs`, nil) @@ -231,29 +230,40 @@ func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *List return } - for headerName, headerValue := range listVpcsOptions.Headers { + for headerName, headerValue := range createVPCOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPC") 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)) - if listVpcsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) + + body := make(map[string]interface{}) + if createVPCOptions.AddressPrefixManagement != nil { + body["address_prefix_management"] = createVPCOptions.AddressPrefixManagement } - if listVpcsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVpcsOptions.Limit)) + if createVPCOptions.ClassicAccess != nil { + body["classic_access"] = createVPCOptions.ClassicAccess } - if listVpcsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVpcsOptions.ResourceGroupID)) + if createVPCOptions.Dns != nil { + body["dns"] = createVPCOptions.Dns } - if listVpcsOptions.ClassicAccess != nil { - builder.AddQuery("classic_access", fmt.Sprint(*listVpcsOptions.ClassicAccess)) + if createVPCOptions.Name != nil { + body["name"] = createVPCOptions.Name + } + if createVPCOptions.ResourceGroup != nil { + body["resource_group"] = createVPCOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -265,12 +275,12 @@ func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *List var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpcs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpc", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPCCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -281,37 +291,46 @@ func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *List return } -// CreateVPC : Create a VPC -// This request creates a new VPC from a VPC prototype object. The prototype object is structured in the same way as a -// retrieved VPC, and contains the information necessary to create the new VPC. -func (vpc *VpcV1) CreateVPC(createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCWithContext(context.Background(), createVPCOptions) +// CreateVPCAddressPrefix : Create an address prefix for a VPC +// This request creates a new prefix from a prefix prototype object. The prototype object is structured in the same way +// as a retrieved prefix, and contains the information necessary to create the new prefix. +func (vpc *VpcV1) CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPCWithContext is an alternate form of the CreateVPC method which supports a Context parameter -func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(createVPCOptions, "createVPCOptions") +// CreateVPCAddressPrefixWithContext is an alternate form of the CreateVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "vpc_id": *createVPCAddressPrefixOptions.VPCID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPCOptions.Headers { + for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPC") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -322,20 +341,17 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if createVPCOptions.AddressPrefixManagement != nil { - body["address_prefix_management"] = createVPCOptions.AddressPrefixManagement - } - if createVPCOptions.ClassicAccess != nil { - body["classic_access"] = createVPCOptions.ClassicAccess + if createVPCAddressPrefixOptions.CIDR != nil { + body["cidr"] = createVPCAddressPrefixOptions.CIDR } - if createVPCOptions.Dns != nil { - body["dns"] = createVPCOptions.Dns + if createVPCAddressPrefixOptions.Zone != nil { + body["zone"] = createVPCAddressPrefixOptions.Zone } - if createVPCOptions.Name != nil { - body["name"] = createVPCOptions.Name + if createVPCAddressPrefixOptions.IsDefault != nil { + body["is_default"] = createVPCAddressPrefixOptions.IsDefault } - if createVPCOptions.ResourceGroup != nil { - body["resource_group"] = createVPCOptions.ResourceGroup + if createVPCAddressPrefixOptions.Name != nil { + body["name"] = createVPCAddressPrefixOptions.Name } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -352,12 +368,12 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpc", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpc_address_prefix", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -368,126 +384,180 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr return } -// DeleteVPC : Delete a VPC -// This request deletes a VPC. This operation cannot be reversed. +// CreateVPCDnsResolutionBinding : Create a DNS resolution binding +// This request creates a new DNS resolution binding from a DNS resolution binding prototype object. The prototype +// object is structured in the same way as a retrieved DNS resolution binding, and contains the information necessary to +// create the new DNS resolution binding. // -// For this request to succeed: -// - Instances, subnets, public gateways, and endpoint gateways must not reside in this VPC -// - The VPC must not be providing DNS resolution for any other VPCs -// - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero +// For this request to succeed, `dns.enable_hub` must be `false` for the VPC specified by the identifier in the URL, and +// the VPC must not already have a DNS resolution binding. // -// All security groups and network ACLs associated with the VPC are automatically deleted. All flow log collectors with -// `auto_delete` set to `true` targeting the VPC or any resource in the VPC are automatically deleted. -func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) +// See [About DNS sharing for VPE gateways](/docs/vpc?topic=vpc-hub-spoke-model) for more information. +func (vpc *VpcV1) CreateVPCDnsResolutionBinding(createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPCWithContext is an alternate form of the DeleteVPC method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCOptions, "deleteVPCOptions cannot be nil") +// CreateVPCDnsResolutionBindingWithContext is an alternate form of the CreateVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") + err = core.ValidateStruct(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteVPCOptions.ID, + "vpc_id": *createVPCDnsResolutionBindingOptions.VPCID, } - 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, `/vpcs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPCOptions.Headers { + for headerName, headerValue := range createVPCDnsResolutionBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCDnsResolutionBinding") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteVPCOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCOptions.IfMatch)) - } + 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 createVPCDnsResolutionBindingOptions.VPC != nil { + body["vpc"] = createVPCDnsResolutionBindingOptions.VPC + } + if createVPCDnsResolutionBindingOptions.Name != nil { + body["name"] = createVPCDnsResolutionBindingOptions.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 } - 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_vpc", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpc_dns_resolution_binding", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetVPC : Retrieve a VPC -// This request retrieves a single VPC specified by the identifier in the URL. -func (vpc *VpcV1) GetVPC(getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCWithContext(context.Background(), getVPCOptions) +// CreateVPCRoute : Create a route in a VPC's default routing table +// This request creates a new route in the VPC's default routing table. The route prototype object is structured in the +// same way as a retrieved route, and contains the information necessary to create the new route. The request will fail +// if the new route will cause a loop. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCWithContext is an alternate form of the GetVPC method which supports a Context parameter -func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCOptions, "getVPCOptions cannot be nil") +// CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: CreateVPCRoute") + err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCOptions, "getVPCOptions") + err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPCOptions.ID, + "vpc_id": *createVPCRouteOptions.VPCID, } - 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, `/vpcs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCOptions.Headers { + for headerName, headerValue := range createVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoute") 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 createVPCRouteOptions.Destination != nil { + body["destination"] = createVPCRouteOptions.Destination + } + if createVPCRouteOptions.Zone != nil { + body["zone"] = createVPCRouteOptions.Zone + } + if createVPCRouteOptions.Action != nil { + body["action"] = createVPCRouteOptions.Action + } + if createVPCRouteOptions.Advertise != nil { + body["advertise"] = createVPCRouteOptions.Advertise + } + if createVPCRouteOptions.Name != nil { + body["name"] = createVPCRouteOptions.Name + } + if createVPCRouteOptions.NextHop != nil { + body["next_hop"] = createVPCRouteOptions.NextHop + } + if createVPCRouteOptions.Priority != nil { + body["priority"] = createVPCRouteOptions.Priority + } + _, 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()) @@ -497,12 +567,12 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpc", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpc_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -513,59 +583,81 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp return } -// UpdateVPC : Update a VPC -// This request updates a VPC with the information provided in a VPC patch object. The patch object is structured in the -// same way as a retrieved VPC and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) +// CreateVPCRoutingTable : Create a routing table for a VPC +// This request creates a routing table from a routing table prototype object. The prototype object is structured in the +// same way as a retrieved routing table, and contains the information necessary to create the new routing table. +func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVPCWithContext is an alternate form of the UpdateVPC method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCOptions, "updateVPCOptions cannot be nil") +// CreateVPCRoutingTableWithContext is an alternate form of the CreateVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRoutingTableOptions, "createVPCRoutingTableOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") + err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVPCOptions.ID, + "vpc_id": *createVPCRoutingTableOptions.VPCID, } - 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, `/vpcs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPCOptions.Headers { + for headerName, headerValue := range createVPCRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPC") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVPCOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVPCOptions.IfMatch)) - } + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) + body := make(map[string]interface{}) + if createVPCRoutingTableOptions.AcceptRoutesFrom != nil { + body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom + } + if createVPCRoutingTableOptions.AdvertiseRoutesTo != nil { + body["advertise_routes_to"] = createVPCRoutingTableOptions.AdvertiseRoutesTo + } + if createVPCRoutingTableOptions.Name != nil { + body["name"] = createVPCRoutingTableOptions.Name + } + if createVPCRoutingTableOptions.RouteDirectLinkIngress != nil { + body["route_direct_link_ingress"] = createVPCRoutingTableOptions.RouteDirectLinkIngress + } + if createVPCRoutingTableOptions.RouteInternetIngress != nil { + body["route_internet_ingress"] = createVPCRoutingTableOptions.RouteInternetIngress + } + if createVPCRoutingTableOptions.RouteTransitGatewayIngress != nil { + body["route_transit_gateway_ingress"] = createVPCRoutingTableOptions.RouteTransitGatewayIngress + } + if createVPCRoutingTableOptions.RouteVPCZoneIngress != nil { + body["route_vpc_zone_ingress"] = createVPCRoutingTableOptions.RouteVPCZoneIngress + } + if createVPCRoutingTableOptions.Routes != nil { + body["routes"] = createVPCRoutingTableOptions.Routes + } + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -580,12 +672,12 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_vpc", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpc_routing_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -596,54 +688,84 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up return } -// GetVPCDefaultNetworkACL : Retrieve a VPC's default network ACL -// This request retrieves the default network ACL for the VPC specified by the identifier in the URL. The default -// network ACL is applied to any new subnets in the VPC which do not specify a network ACL. -func (vpc *VpcV1) GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) +// CreateVPCRoutingTableRoute : Create a route in a VPC routing table +// This request creates a new VPC route from a VPC route prototype object. The prototype object is structured in the +// same way as a retrieved VPC route and contains the information necessary to create the route. +func (vpc *VpcV1) CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCDefaultNetworkACLWithContext is an alternate form of the GetVPCDefaultNetworkACL method which supports a Context parameter -func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions cannot be nil") +// CreateVPCRoutingTableRouteWithContext is an alternate form of the CreateVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") + err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPCDefaultNetworkACLOptions.ID, + "vpc_id": *createVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *createVPCRoutingTableRouteOptions.RoutingTableID, } - 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, `/vpcs/{id}/default_network_acl`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCDefaultNetworkACLOptions.Headers { + for headerName, headerValue := range createVPCRoutingTableRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTableRoute") 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 createVPCRoutingTableRouteOptions.Destination != nil { + body["destination"] = createVPCRoutingTableRouteOptions.Destination + } + if createVPCRoutingTableRouteOptions.Zone != nil { + body["zone"] = createVPCRoutingTableRouteOptions.Zone + } + if createVPCRoutingTableRouteOptions.Action != nil { + body["action"] = createVPCRoutingTableRouteOptions.Action + } + if createVPCRoutingTableRouteOptions.Advertise != nil { + body["advertise"] = createVPCRoutingTableRouteOptions.Advertise + } + if createVPCRoutingTableRouteOptions.Name != nil { + body["name"] = createVPCRoutingTableRouteOptions.Name + } + if createVPCRoutingTableRouteOptions.NextHop != nil { + body["next_hop"] = createVPCRoutingTableRouteOptions.NextHop + } + if createVPCRoutingTableRouteOptions.Priority != nil { + body["priority"] = createVPCRoutingTableRouteOptions.Priority + } + _, 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()) @@ -653,12 +775,12 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpc_default_network_acl", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpc_routing_table_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultNetworkACL) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -669,51 +791,59 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC return } -// GetVPCDefaultRoutingTable : Retrieve a VPC's default routing table -// This request retrieves the default routing table for the VPC specified by the identifier in the URL. The default -// routing table is associated with any subnets in the VPC which have not been explicitly associated with another -// routing table. -func (vpc *VpcV1) GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) +// DeleteVPC : Delete a VPC +// This request deletes a VPC. This operation cannot be reversed. +// +// For this request to succeed: +// - Instances, subnets, public gateways, and endpoint gateways must not reside in this VPC +// - The VPC must not be providing DNS resolution for any other VPCs +// - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero +// +// All security groups and network ACLs associated with the VPC are automatically deleted. All flow log collectors with +// `auto_delete` set to `true` targeting the VPC or any resource in the VPC are automatically deleted. +func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCDefaultRoutingTableWithContext is an alternate form of the GetVPCDefaultRoutingTable method which supports a Context parameter -func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions cannot be nil") +// DeleteVPCWithContext is an alternate form of the DeleteVPC method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCOptions, "deleteVPCOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") + err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPCDefaultRoutingTableOptions.ID, + "id": *deleteVPCOptions.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, `/vpcs/{id}/default_routing_table`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { + for headerName, headerValue := range deleteVPCOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") + if deleteVPCOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -724,69 +854,60 @@ func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getV 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_vpc_default_routing_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpc", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultRoutingTable) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetVPCDefaultSecurityGroup : Retrieve a VPC's default security group -// This request retrieves the default security group for the VPC specified by the identifier in the URL. Resources -// created in this VPC that allow a security group to be optionally specified will use this security group by default. -func (vpc *VpcV1) GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) +// DeleteVPCAddressPrefix : Delete an address prefix +// This request deletes a prefix. This operation cannot be reversed. The request will fail if any subnets use addresses +// from this prefix. +func (vpc *VpcV1) DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCDefaultSecurityGroupWithContext is an alternate form of the GetVPCDefaultSecurityGroup method which supports a Context parameter -func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions cannot be nil") +// DeleteVPCAddressPrefixWithContext is an alternate form of the DeleteVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") + err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPCDefaultSecurityGroupOptions.ID, + "vpc_id": *deleteVPCAddressPrefixOptions.VPCID, + "id": *deleteVPCAddressPrefixOptions.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, `/vpcs/{id}/default_security_group`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCDefaultSecurityGroupOptions.Headers { + for headerName, headerValue := range deleteVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") 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)) @@ -797,64 +918,59 @@ func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, get 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_vpc_default_security_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpc_address_prefix", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultSecurityGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListVPCAddressPrefixes : List address prefixes for a VPC -// This request lists address pool prefixes for a VPC. -func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) +// DeleteVPCDnsResolutionBinding : Delete a DNS resolution binding +// This request deletes a DNS resolution binding. This operation cannot be reversed. +// +// For this request to succeed, the VPC specified by the identifier in the URL must not have +// `dns.resolver.type` set to `delegated`. +func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPCAddressPrefixesWithContext is an alternate form of the ListVPCAddressPrefixes method which supports a Context parameter -func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions cannot be nil") +// DeleteVPCDnsResolutionBindingWithContext is an alternate form of the DeleteVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") + err = core.ValidateStruct(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCAddressPrefixesOptions.VPCID, + "vpc_id": *deleteVPCDnsResolutionBindingOptions.VPCID, + "id": *deleteVPCDnsResolutionBindingOptions.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, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPCAddressPrefixesOptions.Headers { + for headerName, headerValue := range deleteVPCDnsResolutionBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCDnsResolutionBinding") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -862,12 +978,6 @@ func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPC builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVPCAddressPrefixesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) - } - if listVPCAddressPrefixesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCAddressPrefixesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -878,12 +988,12 @@ func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPC var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpc_address_prefixes", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpc_dns_resolution_binding", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefixCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -894,140 +1004,181 @@ func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPC return } -// CreateVPCAddressPrefix : Create an address prefix for a VPC -// This request creates a new prefix from a prefix prototype object. The prototype object is structured in the same way -// as a retrieved prefix, and contains the information necessary to create the new prefix. -func (vpc *VpcV1) CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) +// DeleteVPCRoute : Delete a VPC route +// This request deletes a route. This operation cannot be reversed. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPCAddressPrefixWithContext is an alternate form of the CreateVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions cannot be nil") +// DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: DeleteVPCRoute") + err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") + err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCAddressPrefixOptions.VPCID, + "vpc_id": *deleteVPCRouteOptions.VPCID, + "id": *deleteVPCRouteOptions.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, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { + for headerName, headerValue := range deleteVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") 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 createVPCAddressPrefixOptions.CIDR != nil { - body["cidr"] = createVPCAddressPrefixOptions.CIDR + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - if createVPCAddressPrefixOptions.Zone != nil { - body["zone"] = createVPCAddressPrefixOptions.Zone + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_vpc_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return } - if createVPCAddressPrefixOptions.IsDefault != nil { - body["is_default"] = createVPCAddressPrefixOptions.IsDefault + + return +} + +// DeleteVPCRoutingTable : Delete a VPC routing table +// This request deletes a routing table. A routing table cannot be deleted if it is associated with any subnets in the +// VPC. Additionally, a VPC's default routing table cannot be deleted. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// DeleteVPCRoutingTableWithContext is an alternate form of the DeleteVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return } - if createVPCAddressPrefixOptions.Name != nil { - body["name"] = createVPCAddressPrefixOptions.Name + err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return } - _, err = builder.SetBodyContentJSON(body) + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRoutingTableOptions.VPCID, + "id": *deleteVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) 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 deleteVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteVPCRoutingTableOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCRoutingTableOptions.IfMatch)) + } + + 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) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "create_vpc_address_prefix", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpc_routing_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// DeleteVPCAddressPrefix : Delete an address prefix -// This request deletes a prefix. This operation cannot be reversed. The request will fail if any subnets use addresses -// from this prefix. -func (vpc *VpcV1) DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) +// DeleteVPCRoutingTableRoute : Delete a VPC routing table route +// This request deletes a VPC route. This operation cannot be reversed. Only VPC routes with an `origin` of `user` are +// allowed to be deleted. +func (vpc *VpcV1) DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPCAddressPrefixWithContext is an alternate form of the DeleteVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions cannot be nil") +// DeleteVPCRoutingTableRouteWithContext is an alternate form of the DeleteVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") + err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCAddressPrefixOptions.VPCID, - "id": *deleteVPCAddressPrefixOptions.ID, + "vpc_id": *deleteVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *deleteVPCRoutingTableRouteOptions.RoutingTableID, + "id": *deleteVPCRoutingTableRouteOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPCAddressPrefixOptions.Headers { + for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1043,7 +1194,7 @@ func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteV response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_vpc_address_prefix", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpc_routing_table_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -1051,46 +1202,45 @@ func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteV return } -// GetVPCAddressPrefix : Retrieve an address prefix -// This request retrieves a single prefix specified by the identifier in the URL. -func (vpc *VpcV1) GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) +// GetVPC : Retrieve a VPC +// This request retrieves a single VPC specified by the identifier in the URL. +func (vpc *VpcV1) GetVPC(getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCWithContext(context.Background(), getVPCOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCAddressPrefixWithContext is an alternate form of the GetVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions cannot be nil") +// GetVPCWithContext is an alternate form of the GetVPC method which supports a Context parameter +func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCOptions, "getVPCOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") + err = core.ValidateStruct(getVPCOptions, "getVPCOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *getVPCAddressPrefixOptions.VPCID, - "id": *getVPCAddressPrefixOptions.ID, + "id": *getVPCOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { + for headerName, headerValue := range getVPCOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1108,12 +1258,12 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpc_address_prefix", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1124,34 +1274,33 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr return } -// UpdateVPCAddressPrefix : Update an address prefix -// This request updates a prefix with the information in a provided prefix patch. The prefix patch object is structured -// in the same way as a retrieved prefix and contains only the information to be updated. -func (vpc *VpcV1) UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) +// GetVPCAddressPrefix : Retrieve an address prefix +// This request retrieves a single prefix specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVPCAddressPrefixWithContext is an alternate form of the UpdateVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions cannot be nil") +// GetVPCAddressPrefixWithContext is an alternate form of the GetVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") + err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCAddressPrefixOptions.VPCID, - "id": *updateVPCAddressPrefixOptions.ID, + "vpc_id": *getVPCAddressPrefixOptions.VPCID, + "id": *getVPCAddressPrefixOptions.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, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) @@ -1160,26 +1309,19 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV return } - for headerName, headerValue := range updateVPCAddressPrefixOptions.Headers { + for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCAddressPrefix") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") 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(updateVPCAddressPrefixOptions.AddressPrefixPatch) - 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()) @@ -1189,7 +1331,7 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_vpc_address_prefix", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc_address_prefix", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -1205,60 +1347,46 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV return } -// ListVPCDnsResolutionBindings : List DNS resolution bindings for a VPC -// This request lists DNS resolution bindings for a VPC. A DNS resolution binding represents an association with another -// VPC for centralizing DNS name resolution. -// -// If the VPC specified by the identifier in the URL is a DNS hub VPC (has `dns.enable_hub` set to `true`) then there is -// one binding for each VPC bound to the hub VPC. The endpoint gateways in the bound VPCs can allow (using -// `allow_dns_resolution_binding`) the hub VPC to centralize resolution of their DNS names. -// -// If the VPC specified by the identifier in the URL is not a DNS hub VPC, then there is at most one binding (to a hub -// VPC). The endpoint gateways in the VPC specified by the identifier in the URL can allow (using -// `allow_dns_resolution_binding`) its hub VPC to centralize resolution of their DNS names. -// -// To make use of centralized DNS resolution, a VPC bound to a DNS hub VPC must delegate DNS resolution to its hub VPC -// by setting `dns.resolver.type` to `delegate`. -// -// The bindings will be sorted by their `created_at` property values, with newest bindings first. Bindings with -// identical `created_at` property values will in turn be sorted by ascending `name` property values. -func (vpc *VpcV1) ListVPCDnsResolutionBindings(listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) +// GetVPCDefaultNetworkACL : Retrieve a VPC's default network ACL +// This request retrieves the default network ACL for the VPC specified by the identifier in the URL. The default +// network ACL is applied to any new subnets in the VPC which do not specify a network ACL. +func (vpc *VpcV1) GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPCDnsResolutionBindingsWithContext is an alternate form of the ListVPCDnsResolutionBindings method which supports a Context parameter -func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions cannot be nil") +// GetVPCDefaultNetworkACLWithContext is an alternate form of the GetVPCDefaultNetworkACL method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") + err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCDnsResolutionBindingsOptions.VPCID, + "id": *getVPCDefaultNetworkACLOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_network_acl`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPCDnsResolutionBindingsOptions.Headers { + for headerName, headerValue := range getVPCDefaultNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCDnsResolutionBindings") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1266,27 +1394,6 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVPCDnsResolutionBindingsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Sort)) - } - if listVPCDnsResolutionBindingsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Start)) - } - if listVPCDnsResolutionBindingsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Limit)) - } - if listVPCDnsResolutionBindingsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Name)) - } - if listVPCDnsResolutionBindingsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCCRN)) - } - if listVPCDnsResolutionBindingsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCName)) - } - if listVPCDnsResolutionBindingsOptions.AccountID != nil { - builder.AddQuery("account.id", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.AccountID)) - } request, err := builder.Build() if err != nil { @@ -1297,12 +1404,12 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpc_dns_resolution_bindings", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc_default_network_acl", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBindingCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1313,74 +1420,55 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l return } -// CreateVPCDnsResolutionBinding : Create a DNS resolution binding -// This request creates a new DNS resolution binding from a DNS resolution binding prototype object. The prototype -// object is structured in the same way as a retrieved DNS resolution binding, and contains the information necessary to -// create the new DNS resolution binding. -// -// For this request to succeed, `dns.enable_hub` must be `false` for the VPC specified by the identifier in the URL, and -// the VPC must not already have a DNS resolution binding. -// -// See [About DNS sharing for VPE gateways](/docs/vpc?topic=vpc-hub-spoke-model) for more information. -func (vpc *VpcV1) CreateVPCDnsResolutionBinding(createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) +// GetVPCDefaultRoutingTable : Retrieve a VPC's default routing table +// This request retrieves the default routing table for the VPC specified by the identifier in the URL. The default +// routing table is associated with any subnets in the VPC which have not been explicitly associated with another +// routing table. +func (vpc *VpcV1) GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPCDnsResolutionBindingWithContext is an alternate form of the CreateVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions cannot be nil") +// GetVPCDefaultRoutingTableWithContext is an alternate form of the GetVPCDefaultRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") + err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCDnsResolutionBindingOptions.VPCID, + "id": *getVPCDefaultRoutingTableOptions.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, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_routing_table`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPCDnsResolutionBindingOptions.Headers { + for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCDnsResolutionBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") 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 createVPCDnsResolutionBindingOptions.VPC != nil { - body["vpc"] = createVPCDnsResolutionBindingOptions.VPC - } - if createVPCDnsResolutionBindingOptions.Name != nil { - body["name"] = createVPCDnsResolutionBindingOptions.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()) @@ -1390,12 +1478,12 @@ func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpc_dns_resolution_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc_default_routing_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1406,49 +1494,46 @@ func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, return } -// DeleteVPCDnsResolutionBinding : Delete a DNS resolution binding -// This request deletes a DNS resolution binding. This operation cannot be reversed. -// -// For this request to succeed, the VPC specified by the identifier in the URL must not have -// `dns.resolver.type` set to `delegated`. -func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) +// GetVPCDefaultSecurityGroup : Retrieve a VPC's default security group +// This request retrieves the default security group for the VPC specified by the identifier in the URL. Resources +// created in this VPC that allow a security group to be optionally specified will use this security group by default. +func (vpc *VpcV1) GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPCDnsResolutionBindingWithContext is an alternate form of the DeleteVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions cannot be nil") +// GetVPCDefaultSecurityGroupWithContext is an alternate form of the GetVPCDefaultSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") + err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCDnsResolutionBindingOptions.VPCID, - "id": *deleteVPCDnsResolutionBindingOptions.ID, + "id": *getVPCDefaultSecurityGroupOptions.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, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_security_group`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPCDnsResolutionBindingOptions.Headers { + for headerName, headerValue := range getVPCDefaultSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCDnsResolutionBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1466,12 +1551,12 @@ func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_vpc_dns_resolution_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc_default_security_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultSecurityGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1555,63 +1640,57 @@ func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, get return } -// UpdateVPCDnsResolutionBinding : Update a DNS resolution binding -// This request updates a DNS resolution binding with the information in a provided DNS resolution binding patch. The -// DNS resolution binding patch object is structured in the same way as a retrieved DNS resolution binding and contains -// only the information to be updated. -func (vpc *VpcV1) UpdateVPCDnsResolutionBinding(updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) +// GetVPCRoute : Retrieve a VPC route +// This request retrieves a single route specified by the identifier in the URL. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVPCDnsResolutionBindingWithContext is an alternate form of the UpdateVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions cannot be nil") +// GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetVPCRoute") + err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") + err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCDnsResolutionBindingOptions.VPCID, - "id": *updateVPCDnsResolutionBindingOptions.ID, + "vpc_id": *getVPCRouteOptions.VPCID, + "id": *getVPCRouteOptions.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, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPCDnsResolutionBindingOptions.Headers { + for headerName, headerValue := range getVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCDnsResolutionBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") 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(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) - 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()) @@ -1621,12 +1700,12 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_vpc_dns_resolution_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1637,50 +1716,46 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, return } -// ListVPCRoutes : List routes in a VPC's default routing table -// This request lists routes in the VPC's default routing table. Each route is zone-specific and directs any packets -// matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's -// destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) +// GetVPCRoutingTable : Retrieve a VPC routing table +// This request retrieves a single routing table specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListVPCRoutes") - err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") +// GetVPCRoutingTableWithContext is an alternate form of the GetVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRoutingTableOptions, "getVPCRoutingTableOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") + err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutesOptions.VPCID, + "vpc_id": *getVPCRoutingTableOptions.VPCID, + "id": *getVPCRoutingTableOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPCRoutesOptions.Headers { + for headerName, headerValue := range getVPCRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1688,15 +1763,6 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVPCRoutesOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) - } - if listVPCRoutesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutesOptions.Start)) - } - if listVPCRoutesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -1707,12 +1773,12 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpc_routes", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc_routing_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollectionVPCContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1723,87 +1789,55 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt return } -// CreateVPCRoute : Create a route in a VPC's default routing table -// This request creates a new route in the VPC's default routing table. The route prototype object is structured in the -// same way as a retrieved route, and contains the information necessary to create the new route. The request will fail -// if the new route will cause a loop. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) +// GetVPCRoutingTableRoute : Retrieve a VPC routing table route +// This request retrieves a single VPC route specified by the identifier in the URL path. +func (vpc *VpcV1) GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: CreateVPCRoute") - err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") +// GetVPCRoutingTableRouteWithContext is an alternate form of the GetVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") + err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCRouteOptions.VPCID, + "vpc_id": *getVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *getVPCRoutingTableRouteOptions.RoutingTableID, + "id": *getVPCRoutingTableRouteOptions.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, `/vpcs/{vpc_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPCRouteOptions.Headers { + for headerName, headerValue := range getVPCRoutingTableRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") 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 createVPCRouteOptions.Destination != nil { - body["destination"] = createVPCRouteOptions.Destination - } - if createVPCRouteOptions.Zone != nil { - body["zone"] = createVPCRouteOptions.Zone - } - if createVPCRouteOptions.Action != nil { - body["action"] = createVPCRouteOptions.Action - } - if createVPCRouteOptions.Advertise != nil { - body["advertise"] = createVPCRouteOptions.Advertise - } - if createVPCRouteOptions.Name != nil { - body["name"] = createVPCRouteOptions.Name - } - if createVPCRouteOptions.NextHop != nil { - body["next_hop"] = createVPCRouteOptions.NextHop - } - if createVPCRouteOptions.Priority != nil { - body["priority"] = createVPCRouteOptions.Priority - } - _, 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()) @@ -1813,7 +1847,7 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpc_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc_routing_table_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -1829,55 +1863,58 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO return } -// DeleteVPCRoute : Delete a VPC route -// This request deletes a route. This operation cannot be reversed. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) +// ListVPCAddressPrefixes : List address prefixes for a VPC +// This request lists address pool prefixes for a VPC. +func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: DeleteVPCRoute") - err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") +// ListVPCAddressPrefixesWithContext is an alternate form of the ListVPCAddressPrefixes method which supports a Context parameter +func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") + err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRouteOptions.VPCID, - "id": *deleteVPCRouteOptions.ID, + "vpc_id": *listVPCAddressPrefixesOptions.VPCID, } - 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, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPCRouteOptions.Headers { + for headerName, headerValue := range listVPCAddressPrefixesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") 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 listVPCAddressPrefixesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) + } + if listVPCAddressPrefixesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCAddressPrefixesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -1885,59 +1922,79 @@ func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteO 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_vpc_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpc_address_prefixes", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefixCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetVPCRoute : Retrieve a VPC route -// This request retrieves a single route specified by the identifier in the URL. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) +// ListVPCDnsResolutionBindings : List DNS resolution bindings for a VPC +// This request lists DNS resolution bindings for a VPC. A DNS resolution binding represents an association with another +// VPC for centralizing DNS name resolution. +// +// If the VPC specified by the identifier in the URL is a DNS hub VPC (has `dns.enable_hub` set to `true`) then there is +// one binding for each VPC bound to the hub VPC. The endpoint gateways in the bound VPCs can allow (using +// `allow_dns_resolution_binding`) the hub VPC to centralize resolution of their DNS names. +// +// If the VPC specified by the identifier in the URL is not a DNS hub VPC, then there is at most one binding (to a hub +// VPC). The endpoint gateways in the VPC specified by the identifier in the URL can allow (using +// `allow_dns_resolution_binding`) its hub VPC to centralize resolution of their DNS names. +// +// To make use of centralized DNS resolution, a VPC bound to a DNS hub VPC must delegate DNS resolution to its hub VPC +// by setting `dns.resolver.type` to `delegate`. +// +// The bindings will be sorted by their `created_at` property values, with newest bindings first. Bindings with +// identical `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListVPCDnsResolutionBindings(listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetVPCRoute") - err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") +// ListVPCDnsResolutionBindingsWithContext is an alternate form of the ListVPCDnsResolutionBindings method which supports a Context parameter +func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") + err = core.ValidateStruct(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *getVPCRouteOptions.VPCID, - "id": *getVPCRouteOptions.ID, + "vpc_id": *listVPCDnsResolutionBindingsOptions.VPCID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCRouteOptions.Headers { + for headerName, headerValue := range listVPCDnsResolutionBindingsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCDnsResolutionBindings") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1945,6 +2002,27 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listVPCDnsResolutionBindingsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Sort)) + } + if listVPCDnsResolutionBindingsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Start)) + } + if listVPCDnsResolutionBindingsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Limit)) + } + if listVPCDnsResolutionBindingsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Name)) + } + if listVPCDnsResolutionBindingsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCCRN)) + } + if listVPCDnsResolutionBindingsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCName)) + } + if listVPCDnsResolutionBindingsOptions.AccountID != nil { + builder.AddQuery("account.id", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.AccountID)) + } request, err := builder.Build() if err != nil { @@ -1955,12 +2033,12 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpc_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpc_dns_resolution_bindings", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBindingCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1971,63 +2049,65 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions return } -// UpdateVPCRoute : Update a VPC route -// This request updates a route with the information in a provided route patch. The route patch object is structured in -// the same way as a retrieved route and contains only the information to be updated. +// ListVPCRoutes : List routes in a VPC's default routing table +// This request lists routes in the VPC's default routing table. Each route is zone-specific and directs any packets +// matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's +// destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. // Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) +func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter +// ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter // Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: UpdateVPCRoute") - err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") +func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListVPCRoutes") + err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") + err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCRouteOptions.VPCID, - "id": *updateVPCRouteOptions.ID, + "vpc_id": *listVPCRoutesOptions.VPCID, } - 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, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPCRouteOptions.Headers { + for headerName, headerValue := range listVPCRoutesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") 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(updateVPCRouteOptions.RoutePatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listVPCRoutesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) + } + if listVPCRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutesOptions.Start)) + } + if listVPCRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutesOptions.Limit)) } request, err := builder.Build() @@ -2039,12 +2119,12 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_vpc_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpc_routes", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollectionVPCContext) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2055,48 +2135,50 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO return } -// ListVPCRoutingTables : List routing tables for a VPC -// This request lists routing tables for a VPC. Each subnet in a VPC is associated with a routing table, which controls -// delivery of packets sent on that subnet according to the action of the most specific matching route in the table. If -// multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, delivery will be -// controlled by the system's built-in routes. -func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) +// ListVPCRoutingTableRoutes : List routes in a VPC routing table +// This request lists routes in a VPC routing table. If subnets are associated with this routing table, delivery of +// packets sent on a subnet is performed according to the action of the most specific matching route in the table +// (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, the route with the +// highest priority will be used. If two matching routes have the same destination and priority, traffic will be +// distributed between them. If no routes match, delivery will be controlled by the system's built-in routes. +func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPCRoutingTablesWithContext is an alternate form of the ListVPCRoutingTables method which supports a Context parameter -func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions cannot be nil") +// ListVPCRoutingTableRoutesWithContext is an alternate form of the ListVPCRoutingTableRoutes method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") + err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutingTablesOptions.VPCID, + "vpc_id": *listVPCRoutingTableRoutesOptions.VPCID, + "routing_table_id": *listVPCRoutingTableRoutesOptions.RoutingTableID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPCRoutingTablesOptions.Headers { + for headerName, headerValue := range listVPCRoutingTableRoutesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -2104,14 +2186,11 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVPCRoutingTablesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) - } - if listVPCRoutingTablesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTablesOptions.Limit)) + if listVPCRoutingTableRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) } - if listVPCRoutingTablesOptions.IsDefault != nil { - builder.AddQuery("is_default", fmt.Sprint(*listVPCRoutingTablesOptions.IsDefault)) + if listVPCRoutingTableRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Limit)) } request, err := builder.Build() @@ -2123,12 +2202,12 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpc_routing_tables", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpc_routing_table_routes", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTableCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2139,33 +2218,35 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo return } -// CreateVPCRoutingTable : Create a routing table for a VPC -// This request creates a routing table from a routing table prototype object. The prototype object is structured in the -// same way as a retrieved routing table, and contains the information necessary to create the new routing table. -func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) +// ListVPCRoutingTables : List routing tables for a VPC +// This request lists routing tables for a VPC. Each subnet in a VPC is associated with a routing table, which controls +// delivery of packets sent on that subnet according to the action of the most specific matching route in the table. If +// multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, delivery will be +// controlled by the system's built-in routes. +func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPCRoutingTableWithContext is an alternate form of the CreateVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCRoutingTableOptions, "createVPCRoutingTableOptions cannot be nil") +// ListVPCRoutingTablesWithContext is an alternate form of the ListVPCRoutingTables method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") + err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCRoutingTableOptions.VPCID, + "vpc_id": *listVPCRoutingTablesOptions.VPCID, } - 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, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) @@ -2174,49 +2255,26 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP return } - for headerName, headerValue := range createVPCRoutingTableOptions.Headers { + for headerName, headerValue := range listVPCRoutingTablesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") 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 createVPCRoutingTableOptions.AcceptRoutesFrom != nil { - body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom - } - if createVPCRoutingTableOptions.AdvertiseRoutesTo != nil { - body["advertise_routes_to"] = createVPCRoutingTableOptions.AdvertiseRoutesTo - } - if createVPCRoutingTableOptions.Name != nil { - body["name"] = createVPCRoutingTableOptions.Name - } - if createVPCRoutingTableOptions.RouteDirectLinkIngress != nil { - body["route_direct_link_ingress"] = createVPCRoutingTableOptions.RouteDirectLinkIngress - } - if createVPCRoutingTableOptions.RouteInternetIngress != nil { - body["route_internet_ingress"] = createVPCRoutingTableOptions.RouteInternetIngress - } - if createVPCRoutingTableOptions.RouteTransitGatewayIngress != nil { - body["route_transit_gateway_ingress"] = createVPCRoutingTableOptions.RouteTransitGatewayIngress - } - if createVPCRoutingTableOptions.RouteVPCZoneIngress != nil { - body["route_vpc_zone_ingress"] = createVPCRoutingTableOptions.RouteVPCZoneIngress + if listVPCRoutingTablesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) } - if createVPCRoutingTableOptions.Routes != nil { - body["routes"] = createVPCRoutingTableOptions.Routes + if listVPCRoutingTablesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTablesOptions.Limit)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listVPCRoutingTablesOptions.IsDefault != nil { + builder.AddQuery("is_default", fmt.Sprint(*listVPCRoutingTablesOptions.IsDefault)) } request, err := builder.Build() @@ -2228,12 +2286,12 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpc_routing_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpc_routing_tables", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTableCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2244,120 +2302,57 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP return } -// DeleteVPCRoutingTable : Delete a VPC routing table -// This request deletes a routing table. A routing table cannot be deleted if it is associated with any subnets in the -// VPC. Additionally, a VPC's default routing table cannot be deleted. This operation cannot be reversed. -func (vpc *VpcV1) DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) +// ListVpcs : List VPCs +// This request lists VPCs in the region. A VPC is a virtual network that belongs to an account and provides logical +// isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC +// can contain resources in multiple zones in a region. +func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPCRoutingTableWithContext is an alternate form of the DeleteVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") +// ListVpcsWithContext is an alternate form of the ListVpcs method which supports a Context parameter +func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVpcsOptions, "listVpcsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRoutingTableOptions.VPCID, - "id": *deleteVPCRoutingTableOptions.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, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPCRoutingTableOptions.Headers { + for headerName, headerValue := range listVpcsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteVPCRoutingTableOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCRoutingTableOptions.IfMatch)) - } + 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 - } - - response, err = vpc.Service.Request(request, nil) - if err != nil { - core.EnrichHTTPProblem(err, "delete_vpc_routing_table", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetVPCRoutingTable : Retrieve a VPC routing table -// This request retrieves a single routing table specified by the identifier in the URL. -func (vpc *VpcV1) GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetVPCRoutingTableWithContext is an alternate form of the GetVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCRoutingTableOptions, "getVPCRoutingTableOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpc_id": *getVPCRoutingTableOptions.VPCID, - "id": *getVPCRoutingTableOptions.ID, + if listVpcsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return + if listVpcsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVpcsOptions.Limit)) } - - for headerName, headerValue := range getVPCRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) + if listVpcsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVpcsOptions.ResourceGroupID)) } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) + if listVpcsOptions.ClassicAccess != nil { + builder.AddQuery("classic_access", fmt.Sprint(*listVpcsOptions.ClassicAccess)) } - 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 { @@ -2368,12 +2363,12 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpc_routing_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpcs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPCCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2384,60 +2379,59 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti return } -// UpdateVPCRoutingTable : Update a VPC routing table -// This request updates a routing table with the information in a provided routing table patch. The patch object is -// structured in the same way as a retrieved table and contains only the information to be updated. -func (vpc *VpcV1) UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) +// UpdateVPC : Update a VPC +// This request updates a VPC with the information provided in a VPC patch object. The patch object is structured in the +// same way as a retrieved VPC and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVPCRoutingTableWithContext is an alternate form of the UpdateVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions cannot be nil") +// UpdateVPCWithContext is an alternate form of the UpdateVPC method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCOptions, "updateVPCOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") + err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCRoutingTableOptions.VPCID, - "id": *updateVPCRoutingTableOptions.ID, + "id": *updateVPCOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPCRoutingTableOptions.Headers { + for headerName, headerValue := range updateVPCOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPC") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVPCRoutingTableOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVPCRoutingTableOptions.IfMatch)) + if updateVPCOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPCOptions.IfMatch)) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) + _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -2452,12 +2446,12 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_vpc_routing_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_vpc", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2468,62 +2462,60 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP return } -// ListVPCRoutingTableRoutes : List routes in a VPC routing table -// This request lists routes in a VPC routing table. If subnets are associated with this routing table, delivery of -// packets sent on a subnet is performed according to the action of the most specific matching route in the table -// (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, the route with the -// highest priority will be used. If two matching routes have the same destination and priority, traffic will be -// distributed between them. If no routes match, delivery will be controlled by the system's built-in routes. -func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) +// UpdateVPCAddressPrefix : Update an address prefix +// This request updates a prefix with the information in a provided prefix patch. The prefix patch object is structured +// in the same way as a retrieved prefix and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPCRoutingTableRoutesWithContext is an alternate form of the ListVPCRoutingTableRoutes method which supports a Context parameter -func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions cannot be nil") +// UpdateVPCAddressPrefixWithContext is an alternate form of the UpdateVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") + err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutingTableRoutesOptions.VPCID, - "routing_table_id": *listVPCRoutingTableRoutesOptions.RoutingTableID, + "vpc_id": *updateVPCAddressPrefixOptions.VPCID, + "id": *updateVPCAddressPrefixOptions.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, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPCRoutingTableRoutesOptions.Headers { + for headerName, headerValue := range updateVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCAddressPrefix") 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 listVPCRoutingTableRoutesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) - } - if listVPCRoutingTableRoutesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateVPCAddressPrefixOptions.AddressPrefixPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -2535,12 +2527,12 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpc_routing_table_routes", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_vpc_address_prefix", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2551,79 +2543,58 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list return } -// CreateVPCRoutingTableRoute : Create a route in a VPC routing table -// This request creates a new VPC route from a VPC route prototype object. The prototype object is structured in the -// same way as a retrieved VPC route and contains the information necessary to create the route. -func (vpc *VpcV1) CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) +// UpdateVPCDnsResolutionBinding : Update a DNS resolution binding +// This request updates a DNS resolution binding with the information in a provided DNS resolution binding patch. The +// DNS resolution binding patch object is structured in the same way as a retrieved DNS resolution binding and contains +// only the information to be updated. +func (vpc *VpcV1) UpdateVPCDnsResolutionBinding(updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPCRoutingTableRouteWithContext is an alternate form of the CreateVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions cannot be nil") +// UpdateVPCDnsResolutionBindingWithContext is an alternate form of the UpdateVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") + err = core.ValidateStruct(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *createVPCRoutingTableRouteOptions.RoutingTableID, + "vpc_id": *updateVPCDnsResolutionBindingOptions.VPCID, + "id": *updateVPCDnsResolutionBindingOptions.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, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPCRoutingTableRouteOptions.Headers { + for headerName, headerValue := range updateVPCDnsResolutionBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTableRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCDnsResolutionBinding") 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 createVPCRoutingTableRouteOptions.Destination != nil { - body["destination"] = createVPCRoutingTableRouteOptions.Destination - } - if createVPCRoutingTableRouteOptions.Zone != nil { - body["zone"] = createVPCRoutingTableRouteOptions.Zone - } - if createVPCRoutingTableRouteOptions.Action != nil { - body["action"] = createVPCRoutingTableRouteOptions.Action - } - if createVPCRoutingTableRouteOptions.Advertise != nil { - body["advertise"] = createVPCRoutingTableRouteOptions.Advertise - } - if createVPCRoutingTableRouteOptions.Name != nil { - body["name"] = createVPCRoutingTableRouteOptions.Name - } - if createVPCRoutingTableRouteOptions.NextHop != nil { - body["next_hop"] = createVPCRoutingTableRouteOptions.NextHop - } - if createVPCRoutingTableRouteOptions.Priority != nil { - body["priority"] = createVPCRoutingTableRouteOptions.Priority - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -2638,12 +2609,12 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpc_routing_table_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_vpc_dns_resolution_binding", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2654,120 +2625,149 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre return } -// DeleteVPCRoutingTableRoute : Delete a VPC routing table route -// This request deletes a VPC route. This operation cannot be reversed. Only VPC routes with an `origin` of `user` are -// allowed to be deleted. -func (vpc *VpcV1) DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) +// UpdateVPCRoute : Update a VPC route +// This request updates a route with the information in a provided route patch. The route patch object is structured in +// the same way as a retrieved route and contains only the information to be updated. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPCRoutingTableRouteWithContext is an alternate form of the DeleteVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions cannot be nil") +// UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: UpdateVPCRoute") + err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") + err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *deleteVPCRoutingTableRouteOptions.RoutingTableID, - "id": *deleteVPCRoutingTableRouteOptions.ID, + "vpc_id": *updateVPCRouteOptions.VPCID, + "id": *updateVPCRouteOptions.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, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { + for headerName, headerValue := range updateVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoute") 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(updateVPCRouteOptions.RoutePatch) + 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_vpc_routing_table_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_vpc_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetVPCRoutingTableRoute : Retrieve a VPC routing table route -// This request retrieves a single VPC route specified by the identifier in the URL path. -func (vpc *VpcV1) GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) +// UpdateVPCRoutingTable : Update a VPC routing table +// This request updates a routing table with the information in a provided routing table patch. The patch object is +// structured in the same way as a retrieved table and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCRoutingTableRouteWithContext is an alternate form of the GetVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions cannot be nil") +// UpdateVPCRoutingTableWithContext is an alternate form of the UpdateVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") + err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *getVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *getVPCRoutingTableRouteOptions.RoutingTableID, - "id": *getVPCRoutingTableRouteOptions.ID, + "vpc_id": *updateVPCRoutingTableOptions.VPCID, + "id": *updateVPCRoutingTableOptions.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, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCRoutingTableRouteOptions.Headers { + for headerName, headerValue := range updateVPCRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVPCRoutingTableOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPCRoutingTableOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) + 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()) @@ -2777,12 +2777,12 @@ func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPC var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpc_routing_table_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_vpc_routing_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2876,24 +2876,30 @@ func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, upd return } -// ListSubnets : List subnets -// This request lists subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block -// notation. Each subnet is within a particular zone and cannot span multiple zones or regions. -func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) +// CreateSubnet : Create a subnet +// This request creates a new subnet from a subnet prototype object. The prototype object is structured in the same way +// as a retrieved subnet, and contains the information necessary to create the new subnet. For this request to succeed, +// the prototype's CIDR block must not overlap with an existing subnet in the VPC. +func (vpc *VpcV1) CreateSubnet(createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSubnetsWithContext is an alternate form of the ListSubnets method which supports a Context parameter -func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSubnetsOptions, "listSubnetsOptions") +// CreateSubnetWithContext is an alternate form of the CreateSubnet method which supports a Context parameter +func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSubnetOptions, "createSubnetOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/subnets`, nil) @@ -2902,44 +2908,24 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions return } - for headerName, headerValue := range listSubnetsOptions.Headers { + for headerName, headerValue := range createSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") 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)) - if listSubnetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) - } - if listSubnetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSubnetsOptions.Limit)) - } - if listSubnetsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSubnetsOptions.ResourceGroupID)) - } - if listSubnetsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listSubnetsOptions.ZoneName)) - } - if listSubnetsOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listSubnetsOptions.VPCID)) - } - if listSubnetsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listSubnetsOptions.VPCCRN)) - } - if listSubnetsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listSubnetsOptions.VPCName)) - } - if listSubnetsOptions.RoutingTableID != nil { - builder.AddQuery("routing_table.id", fmt.Sprint(*listSubnetsOptions.RoutingTableID)) - } - if listSubnetsOptions.RoutingTableName != nil { - builder.AddQuery("routing_table.name", fmt.Sprint(*listSubnetsOptions.RoutingTableName)) + + _, err = builder.SetBodyContentJSON(createSubnetOptions.SubnetPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -2951,12 +2937,12 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_subnets", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_subnet", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnetCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2967,43 +2953,46 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions return } -// CreateSubnet : Create a subnet -// This request creates a new subnet from a subnet prototype object. The prototype object is structured in the same way -// as a retrieved subnet, and contains the information necessary to create the new subnet. For this request to succeed, -// the prototype's CIDR block must not overlap with an existing subnet in the VPC. -func (vpc *VpcV1) CreateSubnet(createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) +// CreateSubnetReservedIP : Reserve an IP in a subnet +// This request reserves an IP address in a subnet. If the provided prototype object includes an `address`, the address +// must not already be reserved. +func (vpc *VpcV1) CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSubnetWithContext is an alternate form of the CreateSubnet method which supports a Context parameter -func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSubnetOptions, "createSubnetOptions cannot be nil") +// CreateSubnetReservedIPWithContext is an alternate form of the CreateSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSubnetReservedIPOptions, "createSubnetReservedIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") + err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "subnet_id": *createSubnetReservedIPOptions.SubnetID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSubnetOptions.Headers { + for headerName, headerValue := range createSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3013,7 +3002,20 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createSubnetOptions.SubnetPrototype) + body := make(map[string]interface{}) + if createSubnetReservedIPOptions.Address != nil { + body["address"] = createSubnetReservedIPOptions.Address + } + if createSubnetReservedIPOptions.AutoDelete != nil { + body["auto_delete"] = createSubnetReservedIPOptions.AutoDelete + } + if createSubnetReservedIPOptions.Name != nil { + body["name"] = createSubnetReservedIPOptions.Name + } + if createSubnetReservedIPOptions.Target != nil { + body["target"] = createSubnetReservedIPOptions.Target + } + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -3028,12 +3030,12 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_subnet", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_subnet_reserved_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3110,49 +3112,53 @@ func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptio return } -// GetSubnet : Retrieve a subnet -// This request retrieves a single subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnet(getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) +// DeleteSubnetReservedIP : Delete a reserved IP +// This request releases a reserved IP. This operation cannot be reversed. +// +// For this request to succeed, the reserved IP must not be required by another resource, such as a bare metal server +// network interface, instance network interface or virtual network interface for which it is the primary IP. A +// provider-owned reserved IP is not allowed to be deleted. +func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSubnetWithContext is an alternate form of the GetSubnet method which supports a Context parameter -func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetOptions, "getSubnetOptions cannot be nil") +// DeleteSubnetReservedIPWithContext is an alternate form of the DeleteSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") + err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSubnetOptions.ID, + "subnet_id": *deleteSubnetReservedIPOptions.SubnetID, + "id": *deleteSubnetReservedIPOptions.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, `/subnets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSubnetOptions.Headers { + for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") 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)) @@ -3163,52 +3169,42 @@ func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *Ge 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_subnet", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_subnet_reserved_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// UpdateSubnet : Update a subnet -// This request updates a subnet with the information in a provided subnet patch. The subnet patch object is structured -// in the same way as a retrieved subnet and contains only the information to be updated. -func (vpc *VpcV1) UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) +// GetSubnet : Retrieve a subnet +// This request retrieves a single subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnet(getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateSubnetWithContext is an alternate form of the UpdateSubnet method which supports a Context parameter -func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSubnetOptions, "updateSubnetOptions cannot be nil") +// GetSubnetWithContext is an alternate form of the GetSubnet method which supports a Context parameter +func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetOptions, "getSubnetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") + err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateSubnetOptions.ID, + "id": *getSubnetOptions.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, `/subnets/{id}`, pathParamsMap) @@ -3217,26 +3213,19 @@ func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptio return } - for headerName, headerValue := range updateSubnetOptions.Headers { + for headerName, headerValue := range getSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") 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(updateSubnetOptions.SubnetPatch) - 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()) @@ -3246,7 +3235,7 @@ func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptio var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_subnet", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_subnet", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -3334,60 +3323,53 @@ func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetN return } -// ReplaceSubnetNetworkACL : Replace the network ACL for a subnet -// This request replaces the existing network ACL for a subnet with the network ACL specified in the request body. -func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - result, response, err = vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) +// GetSubnetPublicGateway : Retrieve a subnet's attached public gateway +// This request retrieves the public gateway attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// ReplaceSubnetNetworkACLWithContext is an alternate form of the ReplaceSubnetNetworkACL method which supports a Context parameter -func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions cannot be nil") +// GetSubnetPublicGatewayWithContext is an alternate form of the GetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") + err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *replaceSubnetNetworkACLOptions.ID, + "id": *getSubnetPublicGatewayOptions.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, `/subnets/{id}/network_acl`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range replaceSubnetNetworkACLOptions.Headers { + for headerName, headerValue := range getSubnetPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") 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(replaceSubnetNetworkACLOptions.NetworkACLIdentity) - 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()) @@ -3397,12 +3379,12 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "replace_subnet_network_acl", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_subnet_public_gateway", 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, UnmarshalPublicGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3413,48 +3395,50 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac return } -// UnsetSubnetPublicGateway : Detach a public gateway from a subnet -// This request detaches the public gateway from the subnet specified by the subnet identifier in the URL. -func (vpc *VpcV1) UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) +// GetSubnetReservedIP : Retrieve a reserved IP +// This request retrieves a single reserved IP specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// UnsetSubnetPublicGatewayWithContext is an alternate form of the UnsetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions cannot be nil") +// GetSubnetReservedIPWithContext is an alternate form of the GetSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetReservedIPOptions, "getSubnetReservedIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") + err = core.ValidateStruct(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *unsetSubnetPublicGatewayOptions.ID, + "subnet_id": *getSubnetReservedIPOptions.SubnetID, + "id": *getSubnetReservedIPOptions.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, `/subnets/{id}/public_gateway`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { + for headerName, headerValue := range getSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") 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)) @@ -3465,55 +3449,64 @@ func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unset 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, "unset_subnet_public_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_subnet_reserved_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetSubnetPublicGateway : Retrieve a subnet's attached public gateway -// This request retrieves the public gateway attached to the subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) +// GetSubnetRoutingTable : Retrieve a subnet's attached routing table +// This request retrieves the routing table attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSubnetPublicGatewayWithContext is an alternate form of the GetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions cannot be nil") +// GetSubnetRoutingTableWithContext is an alternate form of the GetSubnetRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") + err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSubnetPublicGatewayOptions.ID, + "id": *getSubnetRoutingTableOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSubnetPublicGatewayOptions.Headers { + for headerName, headerValue := range getSubnetRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3531,12 +3524,12 @@ func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubn var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_subnet_public_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_subnet_routing_table", 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, UnmarshalRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3547,59 +3540,73 @@ func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubn return } -// SetSubnetPublicGateway : Attach a public gateway to a subnet -// This request attaches the public gateway, specified in the request body, to the subnet specified by the subnet -// identifier in the URL. The public gateway must have the same VPC and zone as the subnet. -func (vpc *VpcV1) SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) +// ListSubnetReservedIps : List reserved IPs in a subnet +// This request lists reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet which +// is not available for use. +func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) err = core.RepurposeSDKProblem(err, "") return } -// SetSubnetPublicGatewayWithContext is an alternate form of the SetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions cannot be nil") +// ListSubnetReservedIpsWithContext is an alternate form of the ListSubnetReservedIps method which supports a Context parameter +func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") + err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *setSubnetPublicGatewayOptions.ID, + "subnet_id": *listSubnetReservedIpsOptions.SubnetID, } - 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, `/subnets/{id}/public_gateway`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { + for headerName, headerValue := range listSubnetReservedIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") 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(setSubnetPublicGatewayOptions.PublicGatewayIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listSubnetReservedIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) + } + if listSubnetReservedIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSubnetReservedIpsOptions.Limit)) + } + if listSubnetReservedIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSubnetReservedIpsOptions.Sort)) + } + if listSubnetReservedIpsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listSubnetReservedIpsOptions.TargetID)) + } + if listSubnetReservedIpsOptions.TargetCRN != nil { + builder.AddQuery("target.crn", fmt.Sprint(*listSubnetReservedIpsOptions.TargetCRN)) + } + if listSubnetReservedIpsOptions.TargetName != nil { + builder.AddQuery("target.name", fmt.Sprint(*listSubnetReservedIpsOptions.TargetName)) + } + if listSubnetReservedIpsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listSubnetReservedIpsOptions.TargetResourceType)) } request, err := builder.Build() @@ -3611,12 +3618,12 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "set_subnet_public_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_subnet_reserved_ips", 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, UnmarshalReservedIPCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3627,45 +3634,37 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn return } -// GetSubnetRoutingTable : Retrieve a subnet's attached routing table -// This request retrieves the routing table attached to the subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) +// ListSubnets : List subnets +// This request lists subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block +// notation. Each subnet is within a particular zone and cannot span multiple zones or regions. +func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSubnetRoutingTableWithContext is an alternate form of the GetSubnetRoutingTable method which supports a Context parameter -func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") +// ListSubnetsWithContext is an alternate form of the ListSubnets method which supports a Context parameter +func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSubnetsOptions, "listSubnetsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *getSubnetRoutingTableOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSubnetRoutingTableOptions.Headers { + for headerName, headerValue := range listSubnetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3673,22 +3672,49 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listSubnetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) + } + if listSubnetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSubnetsOptions.Limit)) + } + if listSubnetsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSubnetsOptions.ResourceGroupID)) + } + if listSubnetsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listSubnetsOptions.ZoneName)) + } + if listSubnetsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listSubnetsOptions.VPCID)) + } + if listSubnetsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listSubnetsOptions.VPCCRN)) + } + if listSubnetsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listSubnetsOptions.VPCName)) + } + if listSubnetsOptions.RoutingTableID != nil { + builder.AddQuery("routing_table.id", fmt.Sprint(*listSubnetsOptions.RoutingTableID)) + } + if listSubnetsOptions.RoutingTableName != nil { + builder.AddQuery("routing_table.name", fmt.Sprint(*listSubnetsOptions.RoutingTableName)) + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-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, "get_subnet_routing_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_subnets", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnetCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3699,48 +3725,45 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne return } -// ReplaceSubnetRoutingTable : Replace the routing table for a subnet -// This request replaces the existing routing table for a subnet with the routing table specified in the request body. -// -// For this request to succeed, the routing table `route_direct_link_ingress`, -// `route_internet_ingress`, `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. -func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) +// ReplaceSubnetNetworkACL : Replace the network ACL for a subnet +// This request replaces the existing network ACL for a subnet with the network ACL specified in the request body. +func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + result, response, err = vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) err = core.RepurposeSDKProblem(err, "") return } -// ReplaceSubnetRoutingTableWithContext is an alternate form of the ReplaceSubnetRoutingTable method which supports a Context parameter -func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions cannot be nil") +// ReplaceSubnetNetworkACLWithContext is an alternate form of the ReplaceSubnetNetworkACL method which supports a Context parameter +func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") + err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *replaceSubnetRoutingTableOptions.ID, + "id": *replaceSubnetNetworkACLOptions.ID, } builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range replaceSubnetRoutingTableOptions.Headers { + for headerName, headerValue := range replaceSubnetNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3750,7 +3773,7 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(replaceSubnetRoutingTableOptions.RoutingTableIdentity) + _, err = builder.SetBodyContentJSON(replaceSubnetNetworkACLOptions.NetworkACLIdentity) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -3765,12 +3788,12 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "replace_subnet_routing_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "replace_subnet_network_acl", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3781,73 +3804,61 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl return } -// ListSubnetReservedIps : List reserved IPs in a subnet -// This request lists reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet which -// is not available for use. -func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) +// ReplaceSubnetRoutingTable : Replace the routing table for a subnet +// This request replaces the existing routing table for a subnet with the routing table specified in the request body. +// +// For this request to succeed, the routing table `route_direct_link_ingress`, +// `route_internet_ingress`, `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. +func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + result, response, err = vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSubnetReservedIpsWithContext is an alternate form of the ListSubnetReservedIps method which supports a Context parameter -func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions cannot be nil") +// ReplaceSubnetRoutingTableWithContext is an alternate form of the ReplaceSubnetRoutingTable method which supports a Context parameter +func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") + err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "subnet_id": *listSubnetReservedIpsOptions.SubnetID, + "id": *replaceSubnetRoutingTableOptions.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, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSubnetReservedIpsOptions.Headers { + for headerName, headerValue := range replaceSubnetRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") 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)) - if listSubnetReservedIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) - } - if listSubnetReservedIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSubnetReservedIpsOptions.Limit)) - } - if listSubnetReservedIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSubnetReservedIpsOptions.Sort)) - } - if listSubnetReservedIpsOptions.TargetID != nil { - builder.AddQuery("target.id", fmt.Sprint(*listSubnetReservedIpsOptions.TargetID)) - } - if listSubnetReservedIpsOptions.TargetCRN != nil { - builder.AddQuery("target.crn", fmt.Sprint(*listSubnetReservedIpsOptions.TargetCRN)) - } - if listSubnetReservedIpsOptions.TargetName != nil { - builder.AddQuery("target.name", fmt.Sprint(*listSubnetReservedIpsOptions.TargetName)) - } - if listSubnetReservedIpsOptions.TargetResourceType != nil { - builder.AddQuery("target.resource_type", fmt.Sprint(*listSubnetReservedIpsOptions.TargetResourceType)) + + _, err = builder.SetBodyContentJSON(replaceSubnetRoutingTableOptions.RoutingTableIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -3859,12 +3870,12 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_subnet_reserved_ips", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "replace_subnet_routing_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3875,46 +3886,46 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn return } -// CreateSubnetReservedIP : Reserve an IP in a subnet -// This request reserves an IP address in a subnet. If the provided prototype object includes an `address`, the address -// must not already be reserved. -func (vpc *VpcV1) CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) +// SetSubnetPublicGateway : Attach a public gateway to a subnet +// This request attaches the public gateway, specified in the request body, to the subnet specified by the subnet +// identifier in the URL. The public gateway must have the same VPC and zone as the subnet. +func (vpc *VpcV1) SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + result, response, err = vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSubnetReservedIPWithContext is an alternate form of the CreateSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSubnetReservedIPOptions, "createSubnetReservedIPOptions cannot be nil") +// SetSubnetPublicGatewayWithContext is an alternate form of the SetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") + err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "subnet_id": *createSubnetReservedIPOptions.SubnetID, + "id": *setSubnetPublicGatewayOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSubnetReservedIPOptions.Headers { + for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3924,20 +3935,7 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if createSubnetReservedIPOptions.Address != nil { - body["address"] = createSubnetReservedIPOptions.Address - } - if createSubnetReservedIPOptions.AutoDelete != nil { - body["auto_delete"] = createSubnetReservedIPOptions.AutoDelete - } - if createSubnetReservedIPOptions.Name != nil { - body["name"] = createSubnetReservedIPOptions.Name - } - if createSubnetReservedIPOptions.Target != nil { - body["target"] = createSubnetReservedIPOptions.Target - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(setSubnetPublicGatewayOptions.PublicGatewayIdentity) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -3952,12 +3950,12 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_subnet_reserved_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "set_subnet_public_gateway", 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, UnmarshalPublicGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3968,50 +3966,45 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS return } -// DeleteSubnetReservedIP : Delete a reserved IP -// This request releases a reserved IP. This operation cannot be reversed. -// -// For this request to succeed, the reserved IP must not be required by another resource, such as a bare metal server -// network interface, instance network interface or virtual network interface for which it is the primary IP. A -// provider-owned reserved IP is not allowed to be deleted. -func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) +// UnsetSubnetPublicGateway : Detach a public gateway from a subnet +// This request detaches the public gateway from the subnet specified by the subnet identifier in the URL. +func (vpc *VpcV1) UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSubnetReservedIPWithContext is an alternate form of the DeleteSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions cannot be nil") +// UnsetSubnetPublicGatewayWithContext is an alternate form of the UnsetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") + err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "subnet_id": *deleteSubnetReservedIPOptions.SubnetID, - "id": *deleteSubnetReservedIPOptions.ID, + "id": *unsetSubnetPublicGatewayOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { + for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -4027,7 +4020,7 @@ func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteS response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_subnet_reserved_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "unset_subnet_public_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -4035,54 +4028,61 @@ func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteS return } -// GetSubnetReservedIP : Retrieve a reserved IP -// This request retrieves a single reserved IP specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) +// UpdateSubnet : Update a subnet +// This request updates a subnet with the information in a provided subnet patch. The subnet patch object is structured +// in the same way as a retrieved subnet and contains only the information to be updated. +func (vpc *VpcV1) UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSubnetReservedIPWithContext is an alternate form of the GetSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetReservedIPOptions, "getSubnetReservedIPOptions cannot be nil") +// UpdateSubnetWithContext is an alternate form of the UpdateSubnet method which supports a Context parameter +func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSubnetOptions, "updateSubnetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") + err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "subnet_id": *getSubnetReservedIPOptions.SubnetID, - "id": *getSubnetReservedIPOptions.ID, + "id": *updateSubnetOptions.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, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSubnetReservedIPOptions.Headers { + for headerName, headerValue := range updateSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") 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(updateSubnetOptions.SubnetPatch) + 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()) @@ -4092,12 +4092,12 @@ func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetR var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_subnet_reserved_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_subnet", 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, UnmarshalSubnet) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4191,24 +4191,31 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS return } -// ListImages : List images -// This request lists images available in the region. An image provides source data for a volume. Images are either -// system-provided, or created from another source, such as importing from Cloud Object Storage. -func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListImagesWithContext(context.Background(), listImagesOptions) +// CreateImage : Create an image +// This request creates a new image from an image prototype object. The prototype object is structured in the same way +// as a retrieved image, and contains the information necessary to create the new image. If an image is being imported, +// a URL to the image file on object storage must be specified. If an image is being created from an existing volume, +// that volume must be specified. +func (vpc *VpcV1) CreateImage(createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateImageWithContext(context.Background(), createImageOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListImagesWithContext is an alternate form of the ListImages method which supports a Context parameter -func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listImagesOptions, "listImagesOptions") +// CreateImageWithContext is an alternate form of the CreateImage method which supports a Context parameter +func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createImageOptions, "createImageOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createImageOptions, "createImageOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/images`, nil) @@ -4217,38 +4224,24 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * return } - for headerName, headerValue := range listImagesOptions.Headers { + for headerName, headerValue := range createImageOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") 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)) - if listImagesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) - } - if listImagesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listImagesOptions.Limit)) - } - if listImagesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listImagesOptions.ResourceGroupID)) - } - if listImagesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) - } - if listImagesOptions.Status != nil { - builder.AddQuery("status", strings.Join(listImagesOptions.Status, ",")) - } - if listImagesOptions.Visibility != nil { - builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) - } - if listImagesOptions.UserDataFormat != nil { - builder.AddQuery("user_data_format", strings.Join(listImagesOptions.UserDataFormat, ",")) + + _, err = builder.SetBodyContentJSON(createImageOptions.ImagePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -4260,12 +4253,12 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_images", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_image", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4276,44 +4269,48 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * return } -// CreateImage : Create an image -// This request creates a new image from an image prototype object. The prototype object is structured in the same way -// as a retrieved image, and contains the information necessary to create the new image. If an image is being imported, -// a URL to the image file on object storage must be specified. If an image is being created from an existing volume, -// that volume must be specified. -func (vpc *VpcV1) CreateImage(createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateImageWithContext(context.Background(), createImageOptions) +// CreateImageExportJob : Create an export job for an image +// This request creates and queues a new export job for the image specified in the URL using the image export job +// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, `obsolete`, or +// `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains +// the information necessary to create and queue the new image export job. +func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateImageWithContext is an alternate form of the CreateImage method which supports a Context parameter -func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createImageOptions, "createImageOptions cannot be nil") +// CreateImageExportJobWithContext is an alternate form of the CreateImageExportJob method which supports a Context parameter +func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createImageExportJobOptions, "createImageExportJobOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createImageOptions, "createImageOptions") + err = core.ValidateStruct(createImageExportJobOptions, "createImageExportJobOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "image_id": *createImageExportJobOptions.ImageID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createImageOptions.Headers { + for headerName, headerValue := range createImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImageExportJob") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -4323,7 +4320,17 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createImageOptions.ImagePrototype) + body := make(map[string]interface{}) + if createImageExportJobOptions.StorageBucket != nil { + body["storage_bucket"] = createImageExportJobOptions.StorageBucket + } + if createImageExportJobOptions.Format != nil { + body["format"] = createImageExportJobOptions.Format + } + if createImageExportJobOptions.Name != nil { + body["name"] = createImageExportJobOptions.Name + } + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -4338,12 +4345,12 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_image", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_image_export_job", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4420,155 +4427,67 @@ func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions return } -// GetImage : Retrieve an image -// This request retrieves a single image specified by the identifier in the URL. -func (vpc *VpcV1) GetImage(getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetImageWithContext(context.Background(), getImageOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetImageWithContext is an alternate form of the GetImage method which supports a Context parameter -func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getImageOptions, "getImageOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getImageOptions, "getImageOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getImageOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range getImageOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") - 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_image", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateImage : Update an image -// This request updates an image with the information in a provided image patch. The image patch object is structured in -// the same way as a retrieved image and contains only the information to be updated. A system-provided image is not -// allowed to be updated. An image with a `status` of `deleting` cannot be updated. -func (vpc *VpcV1) UpdateImage(updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateImageWithContext(context.Background(), updateImageOptions) +// DeleteImageExportJob : Delete an image export job +// This request deletes an image export job. This operation cannot be reversed. If the job has not completed, the job +// will be canceled, and the incomplete exported image object deleted. If the job has completed, the exported image +// object will not be deleted. +func (vpc *VpcV1) DeleteImageExportJob(deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateImageWithContext is an alternate form of the UpdateImage method which supports a Context parameter -func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateImageOptions, "updateImageOptions cannot be nil") +// DeleteImageExportJobWithContext is an alternate form of the DeleteImageExportJob method which supports a Context parameter +func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteImageExportJobOptions, "deleteImageExportJobOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateImageOptions, "updateImageOptions") + err = core.ValidateStruct(deleteImageExportJobOptions, "deleteImageExportJobOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateImageOptions.ID, + "image_id": *deleteImageExportJobOptions.ImageID, + "id": *deleteImageExportJobOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateImageOptions.Headers { + for headerName, headerValue := range deleteImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImage") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImageExportJob") 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(updateImageOptions.ImagePatch) - 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_image", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_image_export_job", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } @@ -4646,57 +4565,49 @@ func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageO return } -// ObsoleteImage : Obsolete an image -// This request obsoletes an image, resulting in its `status` becoming `obsolete` and -// `obsolescence_at` being set to the current date and time. -// -// The image must: -// - have a `status` of `available` or `deprecated` -// - have `catalog_offering.managed` set to `false` -// - not have `deprecation_at` set in the future -// - not have `obsolescence_at` set -// -// A system-provided image is not allowed to be obsoleted. -func (vpc *VpcV1) ObsoleteImage(obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) +// GetImage : Retrieve an image +// This request retrieves a single image specified by the identifier in the URL. +func (vpc *VpcV1) GetImage(getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetImageWithContext(context.Background(), getImageOptions) err = core.RepurposeSDKProblem(err, "") return } -// ObsoleteImageWithContext is an alternate form of the ObsoleteImage method which supports a Context parameter -func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(obsoleteImageOptions, "obsoleteImageOptions cannot be nil") +// GetImageWithContext is an alternate form of the GetImage method which supports a Context parameter +func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getImageOptions, "getImageOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(obsoleteImageOptions, "obsoleteImageOptions") + err = core.ValidateStruct(getImageOptions, "getImageOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *obsoleteImageOptions.ID, + "id": *getImageOptions.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, `/images/{id}/obsolete`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range obsoleteImageOptions.Headers { + for headerName, headerValue := range getImageOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ObsoleteImage") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") 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)) @@ -4707,60 +4618,65 @@ func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOpt 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, "obsolete_image", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_image", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// ListImageExportJobs : List export jobs for an image -// This request lists export jobs for an image. Each job tracks the exporting of the image to another location, such as -// a bucket within cloud object storage. -// -// The jobs will be sorted by their `created_at` property values, with newest jobs first. Jobs with identical -// `created_at` property values will in turn be sorted by ascending -// `name` property values. -func (vpc *VpcV1) ListImageExportJobs(listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListImageExportJobsWithContext(context.Background(), listImageExportJobsOptions) +// GetImageExportJob : Retrieve an image export job +// This request retrieves a single image export job specified by the identifier in the URL. +func (vpc *VpcV1) GetImageExportJob(getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListImageExportJobsWithContext is an alternate form of the ListImageExportJobs method which supports a Context parameter -func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listImageExportJobsOptions, "listImageExportJobsOptions cannot be nil") +// GetImageExportJobWithContext is an alternate form of the GetImageExportJob method which supports a Context parameter +func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getImageExportJobOptions, "getImageExportJobOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listImageExportJobsOptions, "listImageExportJobsOptions") + err = core.ValidateStruct(getImageExportJobOptions, "getImageExportJobOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "image_id": *listImageExportJobsOptions.ImageID, + "image_id": *getImageExportJobOptions.ImageID, + "id": *getImageExportJobOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listImageExportJobsOptions.Headers { + for headerName, headerValue := range getImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageExportJobs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImageExportJob") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -4768,9 +4684,6 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listImageExportJobsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listImageExportJobsOptions.Name)) - } request, err := builder.Build() if err != nil { @@ -4781,12 +4694,12 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_image_export_jobs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_image_export_job", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJobUnpaginatedCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4797,73 +4710,53 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE return } -// CreateImageExportJob : Create an export job for an image -// This request creates and queues a new export job for the image specified in the URL using the image export job -// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, `obsolete`, or -// `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains -// the information necessary to create and queue the new image export job. -func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) +// GetOperatingSystem : Retrieve an operating system +// This request retrieves a single operating system specified by the name in the URL. +func (vpc *VpcV1) GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateImageExportJobWithContext is an alternate form of the CreateImageExportJob method which supports a Context parameter -func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createImageExportJobOptions, "createImageExportJobOptions cannot be nil") +// GetOperatingSystemWithContext is an alternate form of the GetOperatingSystem method which supports a Context parameter +func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOperatingSystemOptions, "getOperatingSystemOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createImageExportJobOptions, "createImageExportJobOptions") + err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "image_id": *createImageExportJobOptions.ImageID, + "name": *getOperatingSystemOptions.Name, } - 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, `/images/{image_id}/export_jobs`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createImageExportJobOptions.Headers { + for headerName, headerValue := range getOperatingSystemOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImageExportJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetOperatingSystem") 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 createImageExportJobOptions.StorageBucket != nil { - body["storage_bucket"] = createImageExportJobOptions.StorageBucket - } - if createImageExportJobOptions.Format != nil { - body["format"] = createImageExportJobOptions.Format - } - if createImageExportJobOptions.Name != nil { - body["name"] = createImageExportJobOptions.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()) @@ -4873,12 +4766,12 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_image_export_job", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_operating_system", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystem) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4889,54 +4782,60 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma return } -// DeleteImageExportJob : Delete an image export job -// This request deletes an image export job. This operation cannot be reversed. If the job has not completed, the job -// will be canceled, and the incomplete exported image object deleted. If the job has completed, the exported image -// object will not be deleted. -func (vpc *VpcV1) DeleteImageExportJob(deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) +// ListImageExportJobs : List export jobs for an image +// This request lists export jobs for an image. Each job tracks the exporting of the image to another location, such as +// a bucket within cloud object storage. +// +// The jobs will be sorted by their `created_at` property values, with newest jobs first. Jobs with identical +// `created_at` property values will in turn be sorted by ascending +// `name` property values. +func (vpc *VpcV1) ListImageExportJobs(listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListImageExportJobsWithContext(context.Background(), listImageExportJobsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteImageExportJobWithContext is an alternate form of the DeleteImageExportJob method which supports a Context parameter -func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteImageExportJobOptions, "deleteImageExportJobOptions cannot be nil") +// ListImageExportJobsWithContext is an alternate form of the ListImageExportJobs method which supports a Context parameter +func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listImageExportJobsOptions, "listImageExportJobsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteImageExportJobOptions, "deleteImageExportJobOptions") + err = core.ValidateStruct(listImageExportJobsOptions, "listImageExportJobsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "image_id": *deleteImageExportJobOptions.ImageID, - "id": *deleteImageExportJobOptions.ID, + "image_id": *listImageExportJobsOptions.ImageID, } - 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, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteImageExportJobOptions.Headers { + for headerName, headerValue := range listImageExportJobsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImageExportJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageExportJobs") 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 listImageExportJobsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listImageExportJobsOptions.Name)) + } request, err := builder.Build() if err != nil { @@ -4944,56 +4843,56 @@ func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteIma 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_image_export_job", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_image_export_jobs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJobUnpaginatedCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetImageExportJob : Retrieve an image export job -// This request retrieves a single image export job specified by the identifier in the URL. -func (vpc *VpcV1) GetImageExportJob(getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) +// ListImages : List images +// This request lists images available in the region. An image provides source data for a volume. Images are either +// system-provided, or created from another source, such as importing from Cloud Object Storage. +func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListImagesWithContext(context.Background(), listImagesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetImageExportJobWithContext is an alternate form of the GetImageExportJob method which supports a Context parameter -func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getImageExportJobOptions, "getImageExportJobOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getImageExportJobOptions, "getImageExportJobOptions") +// ListImagesWithContext is an alternate form of the ListImages method which supports a Context parameter +func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listImagesOptions, "listImagesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "image_id": *getImageExportJobOptions.ImageID, - "id": *getImageExportJobOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getImageExportJobOptions.Headers { + for headerName, headerValue := range listImagesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImageExportJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -5001,6 +4900,27 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listImagesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) + } + if listImagesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listImagesOptions.Limit)) + } + if listImagesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listImagesOptions.ResourceGroupID)) + } + if listImagesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) + } + if listImagesOptions.Status != nil { + builder.AddQuery("status", strings.Join(listImagesOptions.Status, ",")) + } + if listImagesOptions.Visibility != nil { + builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) + } + if listImagesOptions.UserDataFormat != nil { + builder.AddQuery("user_data_format", strings.Join(listImagesOptions.UserDataFormat, ",")) + } request, err := builder.Build() if err != nil { @@ -5011,12 +4931,12 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_image_export_job", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_images", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5027,61 +4947,48 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo return } -// UpdateImageExportJob : Update an image export job -// This request updates an image export job with the information in a provided image export job patch. The image export -// job patch object is structured in the same way as a retrieved image export job and contains only the information to -// be updated. -func (vpc *VpcV1) UpdateImageExportJob(updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateImageExportJobWithContext(context.Background(), updateImageExportJobOptions) +// ListOperatingSystems : List operating systems +// This request lists operating systems in the region. +func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateImageExportJobWithContext is an alternate form of the UpdateImageExportJob method which supports a Context parameter -func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateImageExportJobOptions, "updateImageExportJobOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateImageExportJobOptions, "updateImageExportJobOptions") +// ListOperatingSystemsWithContext is an alternate form of the ListOperatingSystems method which supports a Context parameter +func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listOperatingSystemsOptions, "listOperatingSystemsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "image_id": *updateImageExportJobOptions.ImageID, - "id": *updateImageExportJobOptions.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, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateImageExportJobOptions.Headers { + for headerName, headerValue := range listOperatingSystemsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImageExportJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") 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(updateImageExportJobOptions.ImageExportJobPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listOperatingSystemsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) + } + if listOperatingSystemsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listOperatingSystemsOptions.Limit)) } request, err := builder.Build() @@ -5093,12 +5000,12 @@ func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateIma var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_image_export_job", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_operating_systems", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystemCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5109,49 +5016,60 @@ func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateIma return } -// ListOperatingSystems : List operating systems -// This request lists operating systems in the region. -func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) +// ObsoleteImage : Obsolete an image +// This request obsoletes an image, resulting in its `status` becoming `obsolete` and +// `obsolescence_at` being set to the current date and time. +// +// The image must: +// - have a `status` of `available` or `deprecated` +// - have `catalog_offering.managed` set to `false` +// - not have `deprecation_at` set in the future +// - not have `obsolescence_at` set +// +// A system-provided image is not allowed to be obsoleted. +func (vpc *VpcV1) ObsoleteImage(obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListOperatingSystemsWithContext is an alternate form of the ListOperatingSystems method which supports a Context parameter -func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listOperatingSystemsOptions, "listOperatingSystemsOptions") +// ObsoleteImageWithContext is an alternate form of the ObsoleteImage method which supports a Context parameter +func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(obsoleteImageOptions, "obsoleteImageOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(obsoleteImageOptions, "obsoleteImageOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *obsoleteImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/obsolete`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listOperatingSystemsOptions.Headers { + for headerName, headerValue := range obsoleteImageOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ObsoleteImage") 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 listOperatingSystemsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) - } - if listOperatingSystemsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listOperatingSystemsOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -5159,72 +5077,72 @@ func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOpera 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_operating_systems", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "obsolete_image", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystemCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetOperatingSystem : Retrieve an operating system -// This request retrieves a single operating system specified by the name in the URL. -func (vpc *VpcV1) GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) +// UpdateImage : Update an image +// This request updates an image with the information in a provided image patch. The image patch object is structured in +// the same way as a retrieved image and contains only the information to be updated. A system-provided image is not +// allowed to be updated. An image with a `status` of `deleting` cannot be updated. +func (vpc *VpcV1) UpdateImage(updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateImageWithContext(context.Background(), updateImageOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetOperatingSystemWithContext is an alternate form of the GetOperatingSystem method which supports a Context parameter -func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getOperatingSystemOptions, "getOperatingSystemOptions cannot be nil") +// UpdateImageWithContext is an alternate form of the UpdateImage method which supports a Context parameter +func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateImageOptions, "updateImageOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") + err = core.ValidateStruct(updateImageOptions, "updateImageOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getOperatingSystemOptions.Name, + "id": *updateImageOptions.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, `/operating_systems/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getOperatingSystemOptions.Headers { + for headerName, headerValue := range updateImageOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetOperatingSystem") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImage") 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(updateImageOptions.ImagePatch) + 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()) @@ -5234,12 +5152,12 @@ func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatin var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_operating_system", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_image", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystem) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5250,49 +5168,61 @@ func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatin return } -// ListKeys : List keys -// This request lists keys in the region. A key contains a public SSH key which may be installed on instances when they -// are created. Private keys are not stored. -func (vpc *VpcV1) ListKeys(listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListKeysWithContext(context.Background(), listKeysOptions) +// UpdateImageExportJob : Update an image export job +// This request updates an image export job with the information in a provided image export job patch. The image export +// job patch object is structured in the same way as a retrieved image export job and contains only the information to +// be updated. +func (vpc *VpcV1) UpdateImageExportJob(updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateImageExportJobWithContext(context.Background(), updateImageExportJobOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListKeysWithContext is an alternate form of the ListKeys method which supports a Context parameter -func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listKeysOptions, "listKeysOptions") +// UpdateImageExportJobWithContext is an alternate form of the UpdateImageExportJob method which supports a Context parameter +func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateImageExportJobOptions, "updateImageExportJobOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateImageExportJobOptions, "updateImageExportJobOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "image_id": *updateImageExportJobOptions.ImageID, + "id": *updateImageExportJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listKeysOptions.Headers { + for headerName, headerValue := range updateImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListKeys") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImageExportJob") 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 listKeysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listKeysOptions.Start)) - } - if listKeysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listKeysOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateImageExportJobOptions.ImageExportJobPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -5304,12 +5234,12 @@ func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *List var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_keys", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_image_export_job", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKeyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5544,6 +5474,76 @@ func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOp return } +// ListKeys : List keys +// This request lists keys in the region. A key contains a public SSH key which may be installed on instances when they +// are created. Private keys are not stored. +func (vpc *VpcV1) ListKeys(listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListKeysWithContext(context.Background(), listKeysOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ListKeysWithContext is an alternate form of the ListKeys method which supports a Context parameter +func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listKeysOptions, "listKeysOptions") + 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, `/keys`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listKeysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListKeys") + 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 listKeysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listKeysOptions.Start)) + } + if listKeysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listKeysOptions.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_keys", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKeyCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + // UpdateKey : Update a key // This request updates a key's name. func (vpc *VpcV1) UpdateKey(updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { @@ -5623,37 +5623,54 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up return } -// ListInstanceProfiles : List instance profiles -// This request lists provisionable [instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the -// region. An instance profile specifies the performance characteristics and pricing model for an instance. -func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) +// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with an instance network interface +// This request associates the specified floating IP with the specified instance network interface, replacing any +// existing association. +// +// The existing floating IP must: +// - not be required by another resource, such as a public gateway +// - be in the same `zone` as the instance +// +// A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceProfilesWithContext is an alternate form of the ListInstanceProfiles method which supports a Context parameter -func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstanceProfilesOptions, "listInstanceProfilesOptions") +// AddInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the AddInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "instance_id": *addInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *addInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addInstanceNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceProfilesOptions.Headers { + for headerName, headerValue := range addInstanceNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddInstanceNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -5671,12 +5688,12 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_profiles", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_instance_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5687,53 +5704,58 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta return } -// GetInstanceProfile : Retrieve an instance profile -// This request retrieves a single instance profile specified by the name in the URL. -func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) +// CreateInstance : Create an instance +// This request provisions a new instance from an instance prototype object. The prototype object is structured in the +// same way as a retrieved instance, and contains the information necessary to provision the new instance. The instance +// is automatically started. +func (vpc *VpcV1) CreateInstance(createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceProfileWithContext is an alternate form of the GetInstanceProfile method which supports a Context parameter -func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceProfileOptions, "getInstanceProfileOptions cannot be nil") +// CreateInstanceWithContext is an alternate form of the CreateInstance method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceOptions, "createInstanceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") + err = core.ValidateStruct(createInstanceOptions, "createInstanceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "name": *getInstanceProfileOptions.Name, - } - - 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, `/instance/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceProfileOptions.Headers { + for headerName, headerValue := range createInstanceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstance") 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(createInstanceOptions.InstancePrototype) + 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()) @@ -5743,12 +5765,12 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_profile", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5759,44 +5781,68 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance return } -// ListInstanceTemplates : List instance templates -// This request lists instance templates in the region. -func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) +// CreateInstanceAction : Create an instance action +// This request creates a new action which will be queued up to run as soon as any pending or running actions have +// completed. +func (vpc *VpcV1) CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceTemplatesWithContext is an alternate form of the ListInstanceTemplates method which supports a Context parameter -func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstanceTemplatesOptions, "listInstanceTemplatesOptions") +// CreateInstanceActionWithContext is an alternate form of the CreateInstanceAction method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceActionOptions, "createInstanceActionOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createInstanceActionOptions, "createInstanceActionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "instance_id": *createInstanceActionOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/actions`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceTemplatesOptions.Headers { + for headerName, headerValue := range createInstanceActionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceAction") 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 createInstanceActionOptions.Type != nil { + body["type"] = createInstanceActionOptions.Type + } + if createInstanceActionOptions.Force != nil { + body["force"] = createInstanceActionOptions.Force + } + _, 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()) @@ -5806,12 +5852,12 @@ func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInst var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_templates", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_action", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplateCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5822,45 +5868,48 @@ func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInst return } -// CreateInstanceTemplate : Create an instance template -// This request creates a new instance template. The prototype object is structured in the same way as a retrieved -// instance template, and contains the information necessary to provision a new instance from the template. -// -// If a `source_template` is specified in the prototype object, its contents are copied into the new template prior to -// copying any other properties provided in the prototype object. -func (vpc *VpcV1) CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceTemplateWithContext(context.Background(), createInstanceTemplateOptions) +// 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 +// request. The access token is only valid for a short period of time, and a maximum of one token is valid for a given +// instance at a time. +func (vpc *VpcV1) CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceTemplateWithContext is an alternate form of the CreateInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceTemplateOptions, "createInstanceTemplateOptions cannot be nil") +// CreateInstanceConsoleAccessTokenWithContext is an alternate form of the CreateInstanceConsoleAccessToken method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Context, createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceTemplateOptions, "createInstanceTemplateOptions") + err = core.ValidateStruct(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "instance_id": *createInstanceConsoleAccessTokenOptions.InstanceID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/console_access_token`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceTemplateOptions.Headers { + for headerName, headerValue := range createInstanceConsoleAccessTokenOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceTemplate") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceConsoleAccessToken") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -5870,7 +5919,14 @@ func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createI builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createInstanceTemplateOptions.InstanceTemplatePrototype) + body := make(map[string]interface{}) + if createInstanceConsoleAccessTokenOptions.ConsoleType != nil { + body["console_type"] = createInstanceConsoleAccessTokenOptions.ConsoleType + } + if createInstanceConsoleAccessTokenOptions.Force != nil { + body["force"] = createInstanceConsoleAccessTokenOptions.Force + } + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -5885,12 +5941,12 @@ func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createI var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_template", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_console_access_token", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5901,115 +5957,171 @@ func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createI return } -// DeleteInstanceTemplate : Delete an instance template -// This request deletes the instance template. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) +// CreateInstanceNetworkAttachment : Create a network attachment on an instance +// This request creates a new instance network attachment from an instance network attachment prototype object. The +// prototype object is structured in the same way as a retrieved instance network attachment, and contains the +// information necessary to create the new instance network attachment. +func (vpc *VpcV1) CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceTemplateWithContext is an alternate form of the DeleteInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions cannot be nil") +// CreateInstanceNetworkAttachmentWithContext is an alternate form of the CreateInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context, createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") + err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteInstanceTemplateOptions.ID, + "instance_id": *createInstanceNetworkAttachmentOptions.InstanceID, } - 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, `/instance/templates/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceTemplateOptions.Headers { + for headerName, headerValue := range createInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceTemplate") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkAttachment") 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 createInstanceNetworkAttachmentOptions.VirtualNetworkInterface != nil { + body["virtual_network_interface"] = createInstanceNetworkAttachmentOptions.VirtualNetworkInterface + } + if createInstanceNetworkAttachmentOptions.Name != nil { + body["name"] = createInstanceNetworkAttachmentOptions.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 } - 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_instance_template", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetInstanceTemplate : Retrieve an instance template -// This request retrieves a single instance template specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) +// CreateInstanceNetworkInterface : Create a network interface on an instance +// This request creates a new instance network interface from an instance network interface prototype object. The +// prototype object is structured in the same way as a retrieved instance network interface, and contains the +// information necessary to create the new instance network interface. Any subnet in the instance's VPC may be +// specified. Addresses on the instance network interface must be within the specified subnet's CIDR blocks. +// +// If this instance 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, and new network interfaces are not allowed to be created. +func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceTemplateWithContext is an alternate form of the GetInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceTemplateOptions, "getInstanceTemplateOptions cannot be nil") +// CreateInstanceNetworkInterfaceWithContext is an alternate form of the CreateInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") + err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getInstanceTemplateOptions.ID, + "instance_id": *createInstanceNetworkInterfaceOptions.InstanceID, } - 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, `/instance/templates/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceTemplateOptions.Headers { + for headerName, headerValue := range createInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkInterface") 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 createInstanceNetworkInterfaceOptions.Subnet != nil { + body["subnet"] = createInstanceNetworkInterfaceOptions.Subnet + } + if createInstanceNetworkInterfaceOptions.AllowIPSpoofing != nil { + body["allow_ip_spoofing"] = createInstanceNetworkInterfaceOptions.AllowIPSpoofing + } + if createInstanceNetworkInterfaceOptions.Name != nil { + body["name"] = createInstanceNetworkInterfaceOptions.Name + } + if createInstanceNetworkInterfaceOptions.PrimaryIP != nil { + body["primary_ip"] = createInstanceNetworkInterfaceOptions.PrimaryIP + } + if createInstanceNetworkInterfaceOptions.SecurityGroups != nil { + body["security_groups"] = createInstanceNetworkInterfaceOptions.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()) @@ -6019,12 +6131,12 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_template", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6035,57 +6147,55 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc return } -// UpdateInstanceTemplate : Update an instance template -// This request updates an instance template with the information provided in the instance template patch. The instance -// template patch object is structured in the same way as a retrieved instance template and contains only the -// information to be updated. -func (vpc *VpcV1) UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) +// CreateInstanceTemplate : Create an instance template +// This request creates a new instance template. The prototype object is structured in the same way as a retrieved +// instance template, and contains the information necessary to provision a new instance from the template. +// +// If a `source_template` is specified in the prototype object, its contents are copied into the new template prior to +// copying any other properties provided in the prototype object. +func (vpc *VpcV1) CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceTemplateWithContext(context.Background(), createInstanceTemplateOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceTemplateWithContext is an alternate form of the UpdateInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceTemplateOptions, "updateInstanceTemplateOptions cannot be nil") +// CreateInstanceTemplateWithContext is an alternate form of the CreateInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceTemplateOptions, "createInstanceTemplateOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") + err = core.ValidateStruct(createInstanceTemplateOptions, "createInstanceTemplateOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *updateInstanceTemplateOptions.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, `/instance/templates/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceTemplateOptions.Headers { + for headerName, headerValue := range createInstanceTemplateOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceTemplate") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceTemplate") 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(updateInstanceTemplateOptions.InstanceTemplatePatch) + _, err = builder.SetBodyContentJSON(createInstanceTemplateOptions.InstanceTemplatePrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -6100,7 +6210,7 @@ func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateI var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_template", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_template", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -6116,164 +6226,68 @@ func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateI return } -// ListInstances : List instances -// This request lists instances in the region. -func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) +// CreateInstanceVolumeAttachment : Create a volume attachment on an instance +// This request creates a new volume attachment from a volume attachment prototype object, connecting a volume to an +// instance. For this request to succeed, the specified volume must not be busy. The prototype object is structured in +// the same way as a retrieved volume attachment, and contains the information necessary to create the new volume +// attachment. +func (vpc *VpcV1) CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstancesWithContext is an alternate form of the ListInstances method which supports a Context parameter -func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstancesOptions, "listInstancesOptions") +// CreateInstanceVolumeAttachmentWithContext is an alternate form of the CreateInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "instance_id": *createInstanceVolumeAttachmentOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstancesOptions.Headers { + for headerName, headerValue := range createInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceVolumeAttachment") 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)) - if listInstancesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) + + body := make(map[string]interface{}) + if createInstanceVolumeAttachmentOptions.Volume != nil { + body["volume"] = createInstanceVolumeAttachmentOptions.Volume } - if listInstancesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstancesOptions.Limit)) + if createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete != nil { + body["delete_volume_on_instance_delete"] = createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete } - if listInstancesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listInstancesOptions.ResourceGroupID)) + if createInstanceVolumeAttachmentOptions.Name != nil { + body["name"] = createInstanceVolumeAttachmentOptions.Name } - if listInstancesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) - } - if listInstancesOptions.DedicatedHostID != nil { - builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) - } - if listInstancesOptions.DedicatedHostCRN != nil { - builder.AddQuery("dedicated_host.crn", fmt.Sprint(*listInstancesOptions.DedicatedHostCRN)) - } - if listInstancesOptions.DedicatedHostName != nil { - builder.AddQuery("dedicated_host.name", fmt.Sprint(*listInstancesOptions.DedicatedHostName)) - } - if listInstancesOptions.PlacementGroupID != nil { - builder.AddQuery("placement_group.id", fmt.Sprint(*listInstancesOptions.PlacementGroupID)) - } - if listInstancesOptions.PlacementGroupCRN != nil { - builder.AddQuery("placement_group.crn", fmt.Sprint(*listInstancesOptions.PlacementGroupCRN)) - } - if listInstancesOptions.PlacementGroupName != nil { - builder.AddQuery("placement_group.name", fmt.Sprint(*listInstancesOptions.PlacementGroupName)) - } - if listInstancesOptions.ReservationID != nil { - builder.AddQuery("reservation.id", fmt.Sprint(*listInstancesOptions.ReservationID)) - } - if listInstancesOptions.ReservationCRN != nil { - builder.AddQuery("reservation.crn", fmt.Sprint(*listInstancesOptions.ReservationCRN)) - } - if listInstancesOptions.ReservationName != nil { - builder.AddQuery("reservation.name", fmt.Sprint(*listInstancesOptions.ReservationName)) - } - if listInstancesOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) - } - if listInstancesOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) - } - if listInstancesOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) - } - - 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_instances", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreateInstance : Create an instance -// This request provisions a new instance from an instance prototype object. The prototype object is structured in the -// same way as a retrieved instance, and contains the information necessary to provision the new instance. The instance -// is automatically started. -func (vpc *VpcV1) CreateInstance(createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreateInstanceWithContext is an alternate form of the CreateInstance method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceOptions, "createInstanceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createInstanceOptions, "createInstanceOptions") - 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, `/instances`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createInstanceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstance") - 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(createInstanceOptions.InstancePrototype) + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -6288,12 +6302,12 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_volume_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6373,49 +6387,52 @@ func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceO return } -// GetInstance : Retrieve an instance -// This request retrieves a single instance specified by the identifier in the URL. -func (vpc *VpcV1) GetInstance(getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceWithContext(context.Background(), getInstanceOptions) +// DeleteInstanceNetworkAttachment : Delete an instance network attachment +// This request deletes an instance network attachment. This operation cannot be reversed. Any floating IPs associated +// with the instance network attachment are implicitly disassociated. All flow log collectors with `auto_delete` set to +// `true` targeting the instance network attachment are automatically deleted. The primary instance network attachment +// is not allowed to be deleted. +func (vpc *VpcV1) DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceWithContext is an alternate form of the GetInstance method which supports a Context parameter -func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceOptions, "getInstanceOptions cannot be nil") +// DeleteInstanceNetworkAttachmentWithContext is an alternate form of the DeleteInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context, deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceOptions, "getInstanceOptions") + err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getInstanceOptions.ID, + "instance_id": *deleteInstanceNetworkAttachmentOptions.InstanceID, + "id": *deleteInstanceNetworkAttachmentOptions.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, `/instances/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceOptions.Headers { + for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstance") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") 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)) @@ -6426,152 +6443,128 @@ func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions 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_instance", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// UpdateInstance : Update an instance -// This request updates an instance with the information in a provided instance patch. The instance patch object is -// structured in the same way as a retrieved instance and contains only the information to be updated. -func (vpc *VpcV1) UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) +// DeleteInstanceNetworkInterface : Delete an instance network interface +// This request deletes an instance network interface. This operation cannot be reversed. Any floating IPs associated +// with the instance network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to +// `true` targeting the instance network interface are automatically deleted. The primary instance network interface is +// not allowed to be deleted. +// +// If this instance 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 is not allowed to be deleted. +func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceWithContext is an alternate form of the UpdateInstance method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceOptions, "updateInstanceOptions cannot be nil") +// DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") + err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateInstanceOptions.ID, + "instance_id": *deleteInstanceNetworkInterfaceOptions.InstanceID, + "id": *deleteInstanceNetworkInterfaceOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceOptions.Headers { + for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateInstanceOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateInstanceOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) - 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_instance", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetInstanceInitialization : Retrieve initialization configuration for an instance -// This request retrieves configuration used to initialize the instance, such as SSH keys and the Windows administrator -// password. These can subsequently be changed on the instance and therefore may not be current. -func (vpc *VpcV1) GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) +// DeleteInstanceTemplate : Delete an instance template +// This request deletes the instance template. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceInitializationWithContext is an alternate form of the GetInstanceInitialization method which supports a Context parameter -func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceInitializationOptions, "getInstanceInitializationOptions cannot be nil") +// DeleteInstanceTemplateWithContext is an alternate form of the DeleteInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceInitializationOptions, "getInstanceInitializationOptions") + err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getInstanceInitializationOptions.ID, + "id": *deleteInstanceTemplateOptions.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, `/instances/{id}/initialization`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceInitializationOptions.Headers { + for headerName, headerValue := range deleteInstanceTemplateOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceInitialization") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceTemplate") 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)) @@ -6582,176 +6575,127 @@ func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getI 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_instance_initialization", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_template", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceInitialization) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateInstanceAction : Create an instance action -// This request creates a new action which will be queued up to run as soon as any pending or running actions have -// completed. -func (vpc *VpcV1) CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) +// DeleteInstanceVolumeAttachment : Delete a volume attachment +// This request deletes a volume attachment. This operation cannot be reversed, but a new volume attachment may +// subsequently be created for the volume. For this request to succeed, the volume must not be busy. +func (vpc *VpcV1) DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceActionWithContext is an alternate form of the CreateInstanceAction method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceActionOptions, "createInstanceActionOptions cannot be nil") +// DeleteInstanceVolumeAttachmentWithContext is an alternate form of the DeleteInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceActionOptions, "createInstanceActionOptions") + err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *createInstanceActionOptions.InstanceID, + "instance_id": *deleteInstanceVolumeAttachmentOptions.InstanceID, + "id": *deleteInstanceVolumeAttachmentOptions.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, `/instances/{instance_id}/actions`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceActionOptions.Headers { + for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceAction") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") 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 createInstanceActionOptions.Type != nil { - body["type"] = createInstanceActionOptions.Type - } - if createInstanceActionOptions.Force != nil { - body["force"] = createInstanceActionOptions.Force - } - _, 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) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_action", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_volume_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) - 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 -// request. The access token is only valid for a short period of time, and a maximum of one token is valid for a given -// instance at a time. -func (vpc *VpcV1) CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) +// GetInstance : Retrieve an instance +// This request retrieves a single instance specified by the identifier in the URL. +func (vpc *VpcV1) GetInstance(getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceWithContext(context.Background(), getInstanceOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceConsoleAccessTokenWithContext is an alternate form of the CreateInstanceConsoleAccessToken method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Context, createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions cannot be nil") +// GetInstanceWithContext is an alternate form of the GetInstance method which supports a Context parameter +func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceOptions, "getInstanceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") + err = core.ValidateStruct(getInstanceOptions, "getInstanceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *createInstanceConsoleAccessTokenOptions.InstanceID, + "id": *getInstanceOptions.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, `/instances/{instance_id}/console_access_token`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceConsoleAccessTokenOptions.Headers { + for headerName, headerValue := range getInstanceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceConsoleAccessToken") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstance") 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 createInstanceConsoleAccessTokenOptions.ConsoleType != nil { - body["console_type"] = createInstanceConsoleAccessTokenOptions.ConsoleType - } - if createInstanceConsoleAccessTokenOptions.Force != nil { - body["force"] = createInstanceConsoleAccessTokenOptions.Force - } - _, 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()) @@ -6761,12 +6705,12 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_console_access_token", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6777,47 +6721,46 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex return } -// ListInstanceDisks : List disks on an instance -// This request lists disks on an instance. A disk is a block device that is locally attached to the instance's -// physical host and is also referred to as instance storage. By default, the listed disks are sorted by their -// `created_at` property values, with the newest disk first. -func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) +// GetInstanceDisk : Retrieve an instance disk +// This request retrieves a single instance disk specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceDisksWithContext is an alternate form of the ListInstanceDisks method which supports a Context parameter -func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceDisksOptions, "listInstanceDisksOptions cannot be nil") +// GetInstanceDiskWithContext is an alternate form of the GetInstanceDisk method which supports a Context parameter +func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceDiskOptions, "getInstanceDiskOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") + err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceDisksOptions.InstanceID, + "instance_id": *getInstanceDiskOptions.InstanceID, + "id": *getInstanceDiskOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceDisksOptions.Headers { + for headerName, headerValue := range getInstanceDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceDisks") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -6835,12 +6778,12 @@ func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstance var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_disks", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_disk", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6851,46 +6794,46 @@ func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstance return } -// GetInstanceDisk : Retrieve an instance disk -// This request retrieves a single instance disk specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) +// GetInstanceInitialization : Retrieve initialization configuration for an instance +// This request retrieves configuration used to initialize the instance, such as SSH keys and the Windows administrator +// password. These can subsequently be changed on the instance and therefore may not be current. +func (vpc *VpcV1) GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceDiskWithContext is an alternate form of the GetInstanceDisk method which supports a Context parameter -func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceDiskOptions, "getInstanceDiskOptions cannot be nil") +// GetInstanceInitializationWithContext is an alternate form of the GetInstanceInitialization method which supports a Context parameter +func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceInitializationOptions, "getInstanceInitializationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") + err = core.ValidateStruct(getInstanceInitializationOptions, "getInstanceInitializationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceDiskOptions.InstanceID, - "id": *getInstanceDiskOptions.ID, + "id": *getInstanceInitializationOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}/initialization`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceDiskOptions.Headers { + for headerName, headerValue := range getInstanceInitializationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceInitialization") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -6908,12 +6851,12 @@ func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDis var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_disk", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_initialization", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceInitialization) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6924,61 +6867,54 @@ func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDis return } -// UpdateInstanceDisk : Update an instance disk -// This request updates the instance disk with the information in a provided patch. -func (vpc *VpcV1) UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) +// GetInstanceNetworkAttachment : Retrieve an instance network attachment +// This request retrieves a single instance network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceDiskWithContext is an alternate form of the UpdateInstanceDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceDiskOptions, "updateInstanceDiskOptions cannot be nil") +// GetInstanceNetworkAttachmentWithContext is an alternate form of the GetInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") + err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *updateInstanceDiskOptions.InstanceID, - "id": *updateInstanceDiskOptions.ID, + "instance_id": *getInstanceNetworkAttachmentOptions.InstanceID, + "id": *getInstanceNetworkAttachmentOptions.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, `/instances/{instance_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceDiskOptions.Headers { + for headerName, headerValue := range getInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") 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(updateInstanceDiskOptions.InstanceDiskPatch) - 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()) @@ -6988,12 +6924,12 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_disk", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7004,50 +6940,50 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta return } -// ListInstanceNetworkAttachments : List network attachments on an instance -// This request lists network attachments on an instance. A network attachment represents a device on the instance to -// which a virtual network interface is attached. +// GetInstanceNetworkInterface : Retrieve an instance network interface +// This request retrieves a single instance network interface specified by the identifier in the URL. // -// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. -// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property -// values. -func (vpc *VpcV1) ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) +// If this instance has network attachments, the retrieved 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. +func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceNetworkAttachmentsWithContext is an alternate form of the ListInstanceNetworkAttachments method which supports a Context parameter -func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions cannot be nil") +// GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") + err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkAttachmentsOptions.InstanceID, + "instance_id": *getInstanceNetworkInterfaceOptions.InstanceID, + "id": *getInstanceNetworkInterfaceOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceNetworkAttachmentsOptions.Headers { + for headerName, headerValue := range getInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -7065,12 +7001,12 @@ func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_network_attachments", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachmentCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7081,69 +7017,56 @@ func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, return } -// CreateInstanceNetworkAttachment : Create a network attachment on an instance -// This request creates a new instance network attachment from an instance network attachment prototype object. The -// prototype object is structured in the same way as a retrieved instance network attachment, and contains the -// information necessary to create the new instance network attachment. -func (vpc *VpcV1) CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) +// GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP address if it is associated with the instance network interface and +// instance specified in the URL. +func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceNetworkAttachmentWithContext is an alternate form of the CreateInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context, createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions cannot be nil") +// GetInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the GetInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *createInstanceNetworkAttachmentOptions.InstanceID, + "instance_id": *getInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *getInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getInstanceNetworkInterfaceFloatingIPOptions.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, `/instances/{instance_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceNetworkAttachmentOptions.Headers { + for headerName, headerValue := range getInstanceNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") 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 createInstanceNetworkAttachmentOptions.VirtualNetworkInterface != nil { - body["virtual_network_interface"] = createInstanceNetworkAttachmentOptions.VirtualNetworkInterface - } - if createInstanceNetworkAttachmentOptions.Name != nil { - body["name"] = createInstanceNetworkAttachmentOptions.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()) @@ -7153,12 +7076,12 @@ func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7169,52 +7092,54 @@ func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context return } -// DeleteInstanceNetworkAttachment : Delete an instance network attachment -// This request deletes an instance network attachment. This operation cannot be reversed. Any floating IPs associated -// with the instance network attachment are implicitly disassociated. All flow log collectors with `auto_delete` set to -// `true` targeting the instance network attachment are automatically deleted. The primary instance network attachment -// is not allowed to be deleted. -func (vpc *VpcV1) DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) +// GetInstanceNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for an instance network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceNetworkAttachmentWithContext is an alternate form of the DeleteInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context, deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions cannot be nil") +// GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceIP") + err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceNetworkAttachmentOptions.InstanceID, - "id": *deleteInstanceNetworkAttachmentOptions.ID, + "instance_id": *getInstanceNetworkInterfaceIPOptions.InstanceID, + "network_interface_id": *getInstanceNetworkInterfaceIPOptions.NetworkInterfaceID, + "id": *getInstanceNetworkInterfaceIPOptions.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, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { + for headerName, headerValue := range getInstanceNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceIP") 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)) @@ -7225,56 +7150,64 @@ func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context 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_instance_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_network_interface_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetInstanceNetworkAttachment : Retrieve an instance network attachment -// This request retrieves a single instance network attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) +// GetInstanceProfile : Retrieve an instance profile +// This request retrieves a single instance profile specified by the name in the URL. +func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceNetworkAttachmentWithContext is an alternate form of the GetInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions cannot be nil") +// GetInstanceProfileWithContext is an alternate form of the GetInstanceProfile method which supports a Context parameter +func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceProfileOptions, "getInstanceProfileOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkAttachmentOptions.InstanceID, - "id": *getInstanceNetworkAttachmentOptions.ID, + "name": *getInstanceProfileOptions.Name, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceNetworkAttachmentOptions.Headers { + for headerName, headerValue := range getInstanceProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -7292,12 +7225,12 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_profile", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7308,63 +7241,53 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g return } -// UpdateInstanceNetworkAttachment : Update an instance network attachment -// This request updates an instance network attachment with the information provided in an instance network interface -// patch object. The instance network attachment patch object is structured in the same way as a retrieved instance -// network attachment and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) +// GetInstanceTemplate : Retrieve an instance template +// This request retrieves a single instance template specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceNetworkAttachmentWithContext is an alternate form of the UpdateInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context, updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions cannot be nil") +// GetInstanceTemplateWithContext is an alternate form of the GetInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceTemplateOptions, "getInstanceTemplateOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *updateInstanceNetworkAttachmentOptions.InstanceID, - "id": *updateInstanceNetworkAttachmentOptions.ID, + "id": *getInstanceTemplateOptions.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, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { + for headerName, headerValue := range getInstanceTemplateOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") 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(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) - 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()) @@ -7374,12 +7297,12 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_template", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7390,52 +7313,46 @@ func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context return } -// ListInstanceNetworkInterfaces : List network interfaces on an instance -// This request lists network interfaces on an instance. An instance network interface is an abstract representation of -// a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to any -// subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on the -// instance may also attach to the same subnet. -// -// If this instance has network attachments, each returned 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. -func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) +// GetInstanceVolumeAttachment : Retrieve a volume attachment +// This request retrieves a single volume attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceNetworkInterfacesWithContext is an alternate form of the ListInstanceNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions cannot be nil") +// GetInstanceVolumeAttachmentWithContext is an alternate form of the GetInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") + err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfacesOptions.InstanceID, + "instance_id": *getInstanceVolumeAttachmentOptions.InstanceID, + "id": *getInstanceVolumeAttachmentOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceNetworkInterfacesOptions.Headers { + for headerName, headerValue := range getInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -7453,12 +7370,12 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_network_interfaces", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_volume_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceUnpaginatedCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7469,83 +7386,55 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, return } -// CreateInstanceNetworkInterface : Create a network interface on an instance -// This request creates a new instance network interface from an instance network interface prototype object. The -// prototype object is structured in the same way as a retrieved instance network interface, and contains the -// information necessary to create the new instance network interface. Any subnet in the instance's VPC may be -// specified. Addresses on the instance network interface must be within the specified subnet's CIDR blocks. -// -// If this instance 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, and new network interfaces are not allowed to be created. -func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) +// ListInstanceDisks : List disks on an instance +// This request lists disks on an instance. A disk is a block device that is locally attached to the instance's +// physical host and is also referred to as instance storage. By default, the listed disks are sorted by their +// `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceNetworkInterfaceWithContext is an alternate form of the CreateInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions cannot be nil") +// ListInstanceDisksWithContext is an alternate form of the ListInstanceDisks method which supports a Context parameter +func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceDisksOptions, "listInstanceDisksOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") + err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *createInstanceNetworkInterfaceOptions.InstanceID, + "instance_id": *listInstanceDisksOptions.InstanceID, } - 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, `/instances/{instance_id}/network_interfaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceNetworkInterfaceOptions.Headers { + for headerName, headerValue := range listInstanceDisksOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceDisks") 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 createInstanceNetworkInterfaceOptions.Subnet != nil { - body["subnet"] = createInstanceNetworkInterfaceOptions.Subnet - } - if createInstanceNetworkInterfaceOptions.AllowIPSpoofing != nil { - body["allow_ip_spoofing"] = createInstanceNetworkInterfaceOptions.AllowIPSpoofing - } - if createInstanceNetworkInterfaceOptions.Name != nil { - body["name"] = createInstanceNetworkInterfaceOptions.Name - } - if createInstanceNetworkInterfaceOptions.PrimaryIP != nil { - body["primary_ip"] = createInstanceNetworkInterfaceOptions.PrimaryIP - } - if createInstanceNetworkInterfaceOptions.SecurityGroups != nil { - body["security_groups"] = createInstanceNetworkInterfaceOptions.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()) @@ -7555,12 +7444,12 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_disks", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7571,56 +7460,54 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, return } -// DeleteInstanceNetworkInterface : Delete an instance network interface -// This request deletes an instance network interface. This operation cannot be reversed. Any floating IPs associated -// with the instance network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to -// `true` targeting the instance network interface are automatically deleted. The primary instance network interface is -// not allowed to be deleted. +// ListInstanceNetworkAttachments : List network attachments on an instance +// This request lists network attachments on an instance. A network attachment represents a device on the instance to +// which a virtual network interface is attached. // -// If this instance 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 is not allowed to be deleted. -func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") +// ListInstanceNetworkAttachmentsWithContext is an alternate form of the ListInstanceNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") + err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceNetworkInterfaceOptions.InstanceID, - "id": *deleteInstanceNetworkInterfaceOptions.ID, + "instance_id": *listInstanceNetworkAttachmentsOptions.InstanceID, } - 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, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { + for headerName, headerValue := range listInstanceNetworkAttachmentsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") 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)) @@ -7631,60 +7518,65 @@ func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, 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_instance_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_network_attachments", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachmentCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetInstanceNetworkInterface : Retrieve an instance network interface -// This request retrieves a single instance network interface specified by the identifier in the URL. -// -// If this instance has network attachments, the retrieved 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. -func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) +// ListInstanceNetworkInterfaceFloatingIps : List floating IPs associated with an instance network interface +// This request lists floating IPs associated with an instance network interface. +func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") +// ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") + err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceOptions.InstanceID, - "id": *getInstanceNetworkInterfaceOptions.ID, + "instance_id": *listInstanceNetworkInterfaceFloatingIpsOptions.InstanceID, + "network_interface_id": *listInstanceNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceNetworkInterfaceOptions.Headers { + for headerName, headerValue := range listInstanceNetworkInterfaceFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -7702,12 +7594,12 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_network_interface_floating_ips", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7718,65 +7610,61 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge return } -// UpdateInstanceNetworkInterface : Update an instance network interface -// This request updates an instance network interface with the information provided in an instance network interface -// patch object. The instance network interface patch object is structured in the same way as a retrieved instance -// network interface and needs to contain only the information to be updated. -// -// If this instance 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 is not allowed to be updated. -func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) +// ListInstanceNetworkInterfaceIps : List the primary reserved IP for an instance network interface +// This request lists the primary reserved IP for an instance network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceNetworkInterfaceWithContext is an alternate form of the UpdateInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions cannot be nil") +// ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceIps") + err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") + err = core.ValidateStruct(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *updateInstanceNetworkInterfaceOptions.InstanceID, - "id": *updateInstanceNetworkInterfaceOptions.ID, + "instance_id": *listInstanceNetworkInterfaceIpsOptions.InstanceID, + "network_interface_id": *listInstanceNetworkInterfaceIpsOptions.NetworkInterfaceID, } - 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, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceNetworkInterfaceOptions.Headers { + for headerName, headerValue := range listInstanceNetworkInterfaceIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceIps") 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(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listInstanceNetworkInterfaceIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Start)) + } + if listInstanceNetworkInterfaceIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Limit)) } request, err := builder.Build() @@ -7788,12 +7676,12 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_network_interface_ips", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7804,46 +7692,52 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, return } -// ListInstanceNetworkInterfaceFloatingIps : List floating IPs associated with an instance network interface -// This request lists floating IPs associated with an instance network interface. -func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) +// ListInstanceNetworkInterfaces : List network interfaces on an instance +// This request lists network interfaces on an instance. An instance network interface is an abstract representation of +// a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to any +// subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on the +// instance may also attach to the same subnet. +// +// If this instance has network attachments, each returned 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. +func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") +// ListInstanceNetworkInterfacesWithContext is an alternate form of the ListInstanceNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") + err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfaceFloatingIpsOptions.InstanceID, - "network_interface_id": *listInstanceNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, + "instance_id": *listInstanceNetworkInterfacesOptions.InstanceID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceNetworkInterfaceFloatingIpsOptions.Headers { + for headerName, headerValue := range listInstanceNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -7861,12 +7755,12 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_network_interface_floating_ips", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_network_interfaces", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceUnpaginatedCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7877,50 +7771,41 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context return } -// RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from an instance network interface -// This request disassociates the specified floating IP from the specified instance network interface. -func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) +// ListInstanceProfiles : List instance profiles +// This request lists provisionable [instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the +// region. An instance profile specifies the performance characteristics and pricing model for an instance. +func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) err = core.RepurposeSDKProblem(err, "") return } -// RemoveInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions") +// ListInstanceProfilesWithContext is an alternate form of the ListInstanceProfiles method which supports a Context parameter +func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceProfilesOptions, "listInstanceProfilesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "instance_id": *removeInstanceNetworkInterfaceFloatingIPOptions.InstanceID, - "network_interface_id": *removeInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *removeInstanceNetworkInterfaceFloatingIPOptions.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, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range removeInstanceNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listInstanceProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveInstanceNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceProfiles") 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)) @@ -7931,58 +7816,55 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex 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_instance_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_profiles", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfileCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP address if it is associated with the instance network interface and -// instance specified in the URL. -func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) +// ListInstanceTemplates : List instance templates +// This request lists instance templates in the region. +func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the GetInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") +// ListInstanceTemplatesWithContext is an alternate form of the ListInstanceTemplates method which supports a Context parameter +func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceTemplatesOptions, "listInstanceTemplatesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceFloatingIPOptions.InstanceID, - "network_interface_id": *getInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *getInstanceNetworkInterfaceFloatingIPOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listInstanceTemplatesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -8000,12 +7882,12 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_templates", 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, UnmarshalInstanceTemplateCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8016,54 +7898,47 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } -// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with an instance network interface -// This request associates the specified floating IP with the specified instance network interface, replacing any -// existing association. -// -// The existing floating IP must: -// - not be required by another resource, such as a public gateway -// - be in the same `zone` as the instance -// -// A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) +// ListInstanceVolumeAttachments : List volumes attachments on an instance +// This request lists volume attachments on an instance. A volume attachment connects a volume to an instance. Each +// instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one +// volume. +func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) err = core.RepurposeSDKProblem(err, "") return } -// AddInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the AddInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions cannot be nil") +// ListInstanceVolumeAttachmentsWithContext is an alternate form of the ListInstanceVolumeAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *addInstanceNetworkInterfaceFloatingIPOptions.InstanceID, - "network_interface_id": *addInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *addInstanceNetworkInterfaceFloatingIPOptions.ID, + "instance_id": *listInstanceVolumeAttachmentsOptions.InstanceID, } - 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, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range addInstanceNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddInstanceNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -8081,12 +7956,12 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "add_instance_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_volume_attachments", 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, UnmarshalVolumeAttachmentCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8097,49 +7972,36 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } -// ListInstanceNetworkInterfaceIps : List the primary reserved IP for an instance network interface -// This request lists the primary reserved IP for an instance network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) +// ListInstances : List instances +// This request lists instances in the region. +func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceIps") - err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") +// ListInstancesWithContext is an alternate form of the ListInstances method which supports a Context parameter +func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstancesOptions, "listInstancesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfaceIpsOptions.InstanceID, - "network_interface_id": *listInstanceNetworkInterfaceIpsOptions.NetworkInterfaceID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceNetworkInterfaceIpsOptions.Headers { + for headerName, headerValue := range listInstancesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -8147,11 +8009,53 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listInstanceNetworkInterfaceIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Start)) + if listInstancesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) } - if listInstanceNetworkInterfaceIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Limit)) + if listInstancesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstancesOptions.Limit)) + } + if listInstancesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listInstancesOptions.ResourceGroupID)) + } + if listInstancesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) + } + if listInstancesOptions.DedicatedHostID != nil { + builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) + } + if listInstancesOptions.DedicatedHostCRN != nil { + builder.AddQuery("dedicated_host.crn", fmt.Sprint(*listInstancesOptions.DedicatedHostCRN)) + } + if listInstancesOptions.DedicatedHostName != nil { + builder.AddQuery("dedicated_host.name", fmt.Sprint(*listInstancesOptions.DedicatedHostName)) + } + if listInstancesOptions.PlacementGroupID != nil { + builder.AddQuery("placement_group.id", fmt.Sprint(*listInstancesOptions.PlacementGroupID)) + } + if listInstancesOptions.PlacementGroupCRN != nil { + builder.AddQuery("placement_group.crn", fmt.Sprint(*listInstancesOptions.PlacementGroupCRN)) + } + if listInstancesOptions.PlacementGroupName != nil { + builder.AddQuery("placement_group.name", fmt.Sprint(*listInstancesOptions.PlacementGroupName)) + } + if listInstancesOptions.ReservationID != nil { + builder.AddQuery("reservation.id", fmt.Sprint(*listInstancesOptions.ReservationID)) + } + if listInstancesOptions.ReservationCRN != nil { + builder.AddQuery("reservation.crn", fmt.Sprint(*listInstancesOptions.ReservationCRN)) + } + if listInstancesOptions.ReservationName != nil { + builder.AddQuery("reservation.name", fmt.Sprint(*listInstancesOptions.ReservationName)) + } + if listInstancesOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) + } + if listInstancesOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) + } + if listInstancesOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) } request, err := builder.Build() @@ -8163,12 +8067,12 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_network_interface_ips", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instances", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8179,54 +8083,50 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context return } -// GetInstanceNetworkInterfaceIP : Retrieve the primary reserved IP -// This request retrieves the primary reserved IP for an instance network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) +// RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from an instance network interface +// This request disassociates the specified floating IP from the specified instance network interface. +func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceIP") - err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") +// RemoveInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions") + err = core.ValidateStruct(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceIPOptions.InstanceID, - "network_interface_id": *getInstanceNetworkInterfaceIPOptions.NetworkInterfaceID, - "id": *getInstanceNetworkInterfaceIPOptions.ID, + "instance_id": *removeInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *removeInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *removeInstanceNetworkInterfaceFloatingIPOptions.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, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceNetworkInterfaceIPOptions.Headers { + for headerName, headerValue := range removeInstanceNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveInstanceNetworkInterfaceFloatingIP") 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)) @@ -8237,74 +8137,74 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, 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_instance_network_interface_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "remove_instance_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListInstanceVolumeAttachments : List volumes attachments on an instance -// This request lists volume attachments on an instance. A volume attachment connects a volume to an instance. Each -// instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one -// volume. -func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) +// UpdateInstance : Update an instance +// This request updates an instance with the information in a provided instance patch. The instance patch object is +// structured in the same way as a retrieved instance and contains only the information to be updated. +func (vpc *VpcV1) UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceVolumeAttachmentsWithContext is an alternate form of the ListInstanceVolumeAttachments method which supports a Context parameter -func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions cannot be nil") +// UpdateInstanceWithContext is an alternate form of the UpdateInstance method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceOptions, "updateInstanceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") + err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceVolumeAttachmentsOptions.InstanceID, + "id": *updateInstanceOptions.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, `/instances/{instance_id}/volume_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { + for headerName, headerValue := range updateInstanceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateInstanceOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateInstanceOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) + 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()) @@ -8314,12 +8214,12 @@ func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_volume_attachments", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachmentCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8330,68 +8230,56 @@ func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, return } -// CreateInstanceVolumeAttachment : Create a volume attachment on an instance -// This request creates a new volume attachment from a volume attachment prototype object, connecting a volume to an -// instance. For this request to succeed, the specified volume must not be busy. The prototype object is structured in -// the same way as a retrieved volume attachment, and contains the information necessary to create the new volume -// attachment. -func (vpc *VpcV1) CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) +// UpdateInstanceDisk : Update an instance disk +// This request updates the instance disk with the information in a provided patch. +func (vpc *VpcV1) UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceVolumeAttachmentWithContext is an alternate form of the CreateInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions cannot be nil") +// UpdateInstanceDiskWithContext is an alternate form of the UpdateInstanceDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceDiskOptions, "updateInstanceDiskOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") + err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *createInstanceVolumeAttachmentOptions.InstanceID, + "instance_id": *updateInstanceDiskOptions.InstanceID, + "id": *updateInstanceDiskOptions.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, `/instances/{instance_id}/volume_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceVolumeAttachmentOptions.Headers { + for headerName, headerValue := range updateInstanceDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceVolumeAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceDisk") 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 createInstanceVolumeAttachmentOptions.Volume != nil { - body["volume"] = createInstanceVolumeAttachmentOptions.Volume - } - if createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete != nil { - body["delete_volume_on_instance_delete"] = createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete - } - if createInstanceVolumeAttachmentOptions.Name != nil { - body["name"] = createInstanceVolumeAttachmentOptions.Name - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateInstanceDiskOptions.InstanceDiskPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -8406,12 +8294,12 @@ func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_volume_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_disk", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8422,118 +8310,149 @@ func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, return } -// DeleteInstanceVolumeAttachment : Delete a volume attachment -// This request deletes a volume attachment. This operation cannot be reversed, but a new volume attachment may -// subsequently be created for the volume. For this request to succeed, the volume must not be busy. -func (vpc *VpcV1) DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) +// UpdateInstanceNetworkAttachment : Update an instance network attachment +// This request updates an instance network attachment with the information provided in an instance network interface +// patch object. The instance network attachment patch object is structured in the same way as a retrieved instance +// network attachment and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceVolumeAttachmentWithContext is an alternate form of the DeleteInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions cannot be nil") +// UpdateInstanceNetworkAttachmentWithContext is an alternate form of the UpdateInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context, updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") + err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceVolumeAttachmentOptions.InstanceID, - "id": *deleteInstanceVolumeAttachmentOptions.ID, + "instance_id": *updateInstanceNetworkAttachmentOptions.InstanceID, + "id": *updateInstanceNetworkAttachmentOptions.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, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { + for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkAttachment") 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(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) + 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_instance_volume_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetInstanceVolumeAttachment : Retrieve a volume attachment -// This request retrieves a single volume attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) +// UpdateInstanceNetworkInterface : Update an instance network interface +// This request updates an instance network interface with the information provided in an instance network interface +// patch object. The instance network interface patch object is structured in the same way as a retrieved instance +// network interface and needs to contain only the information to be updated. +// +// If this instance 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 is not allowed to be updated. +func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceVolumeAttachmentWithContext is an alternate form of the GetInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions cannot be nil") +// UpdateInstanceNetworkInterfaceWithContext is an alternate form of the UpdateInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") + err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceVolumeAttachmentOptions.InstanceID, - "id": *getInstanceVolumeAttachmentOptions.ID, + "instance_id": *updateInstanceNetworkInterfaceOptions.InstanceID, + "id": *updateInstanceNetworkInterfaceOptions.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, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceVolumeAttachmentOptions.Headers { + for headerName, headerValue := range updateInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkInterface") 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(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) + 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()) @@ -8543,12 +8462,12 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_volume_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8559,48 +8478,47 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge return } -// UpdateInstanceVolumeAttachment : Update a volume attachment -// This request updates a volume attachment with the information provided in a volume attachment patch object. The -// volume attachment patch object is structured in the same way as a retrieved volume attachment and needs to contain -// only the information to be updated. -func (vpc *VpcV1) UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) +// UpdateInstanceTemplate : Update an instance template +// This request updates an instance template with the information provided in the instance template patch. The instance +// template patch object is structured in the same way as a retrieved instance template and contains only the +// information to be updated. +func (vpc *VpcV1) UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceVolumeAttachmentWithContext is an alternate form of the UpdateInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions cannot be nil") +// UpdateInstanceTemplateWithContext is an alternate form of the UpdateInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceTemplateOptions, "updateInstanceTemplateOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") + err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *updateInstanceVolumeAttachmentOptions.InstanceID, - "id": *updateInstanceVolumeAttachmentOptions.ID, + "id": *updateInstanceTemplateOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceVolumeAttachmentOptions.Headers { + for headerName, headerValue := range updateInstanceTemplateOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceVolumeAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceTemplate") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -8610,7 +8528,7 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) + _, err = builder.SetBodyContentJSON(updateInstanceTemplateOptions.InstanceTemplatePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -8625,12 +8543,12 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_volume_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_template", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8641,48 +8559,61 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, return } -// ListInstanceGroups : List instance groups -// This request lists instance groups in the region. -func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) +// UpdateInstanceVolumeAttachment : Update a volume attachment +// This request updates a volume attachment with the information provided in a volume attachment patch object. The +// volume attachment patch object is structured in the same way as a retrieved volume attachment and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceGroupsWithContext is an alternate form of the ListInstanceGroups method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstanceGroupsOptions, "listInstanceGroupsOptions") +// UpdateInstanceVolumeAttachmentWithContext is an alternate form of the UpdateInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceVolumeAttachmentOptions.InstanceID, + "id": *updateInstanceVolumeAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceGroupsOptions.Headers { + for headerName, headerValue := range updateInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceVolumeAttachment") 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 listInstanceGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) - } - if listInstanceGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -8694,12 +8625,12 @@ func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanc var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_groups", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_volume_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8810,116 +8741,140 @@ func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInst return } -// DeleteInstanceGroup : Delete an instance group -// This request deletes an instance group. This operation cannot be reversed. Any instances associated with the group -// will be deleted. -func (vpc *VpcV1) DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupWithContext(context.Background(), deleteInstanceGroupOptions) +// CreateInstanceGroupManager : Create a manager for an instance group +// This request creates a new instance group manager. +func (vpc *VpcV1) CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceGroupWithContext is an alternate form of the DeleteInstanceGroup method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupOptions, "deleteInstanceGroupOptions cannot be nil") +// CreateInstanceGroupManagerWithContext is an alternate form of the CreateInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupOptions, "deleteInstanceGroupOptions") + err = core.ValidateStruct(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteInstanceGroupOptions.ID, + "instance_group_id": *createInstanceGroupManagerOptions.InstanceGroupID, } - 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, `/instance_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupOptions.Headers { + for headerName, headerValue := range createInstanceGroupManagerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManager") 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(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) + 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_instance_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_group_manager", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetInstanceGroup : Retrieve an instance group -// This request retrieves a single instance group specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) +// CreateInstanceGroupManagerAction : Create an instance group manager action +// This request creates a new instance group manager action. +func (vpc *VpcV1) CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceGroupWithContext is an alternate form of the GetInstanceGroup method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupOptions, "getInstanceGroupOptions cannot be nil") +// CreateInstanceGroupManagerActionWithContext is an alternate form of the CreateInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Context, createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceGroupOptions, "getInstanceGroupOptions") + err = core.ValidateStruct(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getInstanceGroupOptions.ID, + "instance_group_id": *createInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *createInstanceGroupManagerActionOptions.InstanceGroupManagerID, } - 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, `/instance_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceGroupOptions.Headers { + for headerName, headerValue := range createInstanceGroupManagerActionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerAction") 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(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) + 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()) @@ -8929,12 +8884,12 @@ func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGr var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_group_manager_action", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8945,56 +8900,56 @@ func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGr return } -// UpdateInstanceGroup : Update an instance group -// This request updates an instance group with the information provided instance group patch. The instance group patch -// object is structured in the same way as a retrieved instance group and contains only the information to be updated. -func (vpc *VpcV1) UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) +// CreateInstanceGroupManagerPolicy : Create a policy for an instance group manager +// This request creates a new instance group manager policy. +func (vpc *VpcV1) CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceGroupWithContext is an alternate form of the UpdateInstanceGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupOptions, "updateInstanceGroupOptions cannot be nil") +// CreateInstanceGroupManagerPolicyWithContext is an alternate form of the CreateInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Context, createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceGroupOptions, "updateInstanceGroupOptions") + err = core.ValidateStruct(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateInstanceGroupOptions.ID, + "instance_group_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, } - 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, `/instance_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceGroupOptions.Headers { + for headerName, headerValue := range createInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") 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(updateInstanceGroupOptions.InstanceGroupPatch) + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -9009,12 +8964,12 @@ func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInst var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_group_manager_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9025,45 +8980,46 @@ func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInst return } -// DeleteInstanceGroupLoadBalancer : Delete an instance group load balancer -// This request unbinds the instance group from the load balancer pool, and deletes the load balancer pool members. -func (vpc *VpcV1) DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) +// DeleteInstanceGroup : Delete an instance group +// This request deletes an instance group. This operation cannot be reversed. Any instances associated with the group +// will be deleted. +func (vpc *VpcV1) DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceGroupWithContext(context.Background(), deleteInstanceGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceGroupLoadBalancerWithContext is an alternate form of the DeleteInstanceGroupLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context, deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions cannot be nil") +// DeleteInstanceGroupWithContext is an alternate form of the DeleteInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupOptions, "deleteInstanceGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") + err = core.ValidateStruct(deleteInstanceGroupOptions, "deleteInstanceGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupLoadBalancerOptions.InstanceGroupID, + "id": *deleteInstanceGroupOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/load_balancer`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupLoadBalancerOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -9079,7 +9035,7 @@ func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_instance_group_load_balancer", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -9087,58 +9043,51 @@ func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context return } -// ListInstanceGroupManagers : List managers for an instance group -// This request lists managers for an instance group. -func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) +// DeleteInstanceGroupLoadBalancer : Delete an instance group load balancer +// This request unbinds the instance group from the load balancer pool, and deletes the load balancer pool members. +func (vpc *VpcV1) DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceGroupManagersWithContext is an alternate form of the ListInstanceGroupManagers method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions cannot be nil") +// DeleteInstanceGroupLoadBalancerWithContext is an alternate form of the DeleteInstanceGroupLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context, deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") + err = core.ValidateStruct(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupManagersOptions.InstanceGroupID, + "instance_group_id": *deleteInstanceGroupLoadBalancerOptions.InstanceGroupID, } - 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, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/load_balancer`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceGroupManagersOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") 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 listInstanceGroupManagersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) - } - if listInstanceGroupManagersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagersOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -9146,144 +9095,120 @@ func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, list 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_instance_group_managers", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group_load_balancer", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateInstanceGroupManager : Create a manager for an instance group -// This request creates a new instance group manager. -func (vpc *VpcV1) CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) +// DeleteInstanceGroupManager : Delete an instance group manager +// This request deletes an instance group manager. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceGroupManagerWithContext is an alternate form of the CreateInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions cannot be nil") +// DeleteInstanceGroupManagerWithContext is an alternate form of the DeleteInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") + err = core.ValidateStruct(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerOptions.InstanceGroupID, + "instance_group_id": *deleteInstanceGroupManagerOptions.InstanceGroupID, + "id": *deleteInstanceGroupManagerOptions.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, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceGroupManagerOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupManagerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManager") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") 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(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) - 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_instance_group_manager", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group_manager", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// DeleteInstanceGroupManager : Delete an instance group manager -// This request deletes an instance group manager. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) +// DeleteInstanceGroupManagerAction : Delete specified instance group manager action +// This request deletes an instance group manager action. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceGroupManagerWithContext is an alternate form of the DeleteInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions cannot be nil") +// DeleteInstanceGroupManagerActionWithContext is an alternate form of the DeleteInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Context, deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") + err = core.ValidateStruct(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerOptions.InstanceGroupID, - "id": *deleteInstanceGroupManagerOptions.ID, + "instance_group_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *deleteInstanceGroupManagerActionOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupManagerOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupManagerActionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerAction") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -9299,7 +9224,7 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, del response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_instance_group_manager", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group_manager_action", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -9307,50 +9232,50 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, del return } -// GetInstanceGroupManager : Retrieve an instance group manager -// This request retrieves a single instance group manager specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) +// DeleteInstanceGroupManagerPolicy : Delete an instance group manager policy +// This request deletes an instance group manager policy. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceGroupManagerWithContext is an alternate form of the GetInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions cannot be nil") +// DeleteInstanceGroupManagerPolicyWithContext is an alternate form of the DeleteInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Context, deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") + err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupManagerOptions.InstanceGroupID, - "id": *getInstanceGroupManagerOptions.ID, + "instance_group_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *deleteInstanceGroupManagerPolicyOptions.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, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceGroupManagerOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") 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)) @@ -9361,158 +9286,126 @@ func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getIns 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_instance_group_manager", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group_manager_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// UpdateInstanceGroupManager : Update an instance group manager -// This request updates an instance group manager with the information provided instance group manager patch. -func (vpc *VpcV1) UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) +// DeleteInstanceGroupMembership : Delete an instance group membership +// This request deletes a memberships of an instance group. This operation cannot be reversed. reversed. If the +// membership has `delete_instance_on_membership_delete` set to `true`, the instance will also be deleted. +func (vpc *VpcV1) DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceGroupManagerWithContext is an alternate form of the UpdateInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions cannot be nil") +// DeleteInstanceGroupMembershipWithContext is an alternate form of the DeleteInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") + err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerOptions.InstanceGroupID, - "id": *updateInstanceGroupManagerOptions.ID, + "instance_group_id": *deleteInstanceGroupMembershipOptions.InstanceGroupID, + "id": *deleteInstanceGroupMembershipOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceGroupManagerOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupMembershipOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManager") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") 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(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) - 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_instance_group_manager", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group_membership", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListInstanceGroupManagerActions : List actions for an instance group manager -// This request lists instance group actions for an instance group manager. -func (vpc *VpcV1) ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) +// DeleteInstanceGroupMemberships : Delete memberships from an instance group +// This request deletes memberships of an instance group. This operation cannot be reversed. Memberships that have +// `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. +func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceGroupManagerActionsWithContext is an alternate form of the ListInstanceGroupManagerActions method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context, listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions cannot be nil") +// DeleteInstanceGroupMembershipsWithContext is an alternate form of the DeleteInstanceGroupMemberships method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions") + err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupManagerActionsOptions.InstanceGroupID, - "instance_group_manager_id": *listInstanceGroupManagerActionsOptions.InstanceGroupManagerID, + "instance_group_id": *deleteInstanceGroupMembershipsOptions.InstanceGroupID, } - 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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceGroupManagerActionsOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupMembershipsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerActions") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") 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 listInstanceGroupManagerActionsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) - } - if listInstanceGroupManagerActionsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -9520,80 +9413,63 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context 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_instance_group_manager_actions", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group_memberships", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerActionsCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateInstanceGroupManagerAction : Create an instance group manager action -// This request creates a new instance group manager action. -func (vpc *VpcV1) CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) +// GetInstanceGroup : Retrieve an instance group +// This request retrieves a single instance group specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceGroupManagerActionWithContext is an alternate form of the CreateInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Context, createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions cannot be nil") +// GetInstanceGroupWithContext is an alternate form of the GetInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupOptions, "getInstanceGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions") + err = core.ValidateStruct(getInstanceGroupOptions, "getInstanceGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *createInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *getInstanceGroupOptions.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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceGroupManagerActionOptions.Headers { + for headerName, headerValue := range getInstanceGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerAction") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") 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(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) - 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()) @@ -9603,12 +9479,12 @@ func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_group_manager_action", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9619,50 +9495,50 @@ func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Contex return } -// DeleteInstanceGroupManagerAction : Delete specified instance group manager action -// This request deletes an instance group manager action. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) +// GetInstanceGroupManager : Retrieve an instance group manager +// This request retrieves a single instance group manager specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceGroupManagerActionWithContext is an alternate form of the DeleteInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Context, deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions cannot be nil") +// GetInstanceGroupManagerWithContext is an alternate form of the GetInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions") + err = core.ValidateStruct(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *deleteInstanceGroupManagerActionOptions.ID, + "instance_group_id": *getInstanceGroupManagerOptions.InstanceGroupID, + "id": *getInstanceGroupManagerOptions.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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupManagerActionOptions.Headers { + for headerName, headerValue := range getInstanceGroupManagerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerAction") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") 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)) @@ -9673,12 +9549,21 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Contex 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_instance_group_manager_action", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_group_manager", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } @@ -9757,62 +9642,55 @@ func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, return } -// UpdateInstanceGroupManagerAction : Update specified instance group manager action -// This request updates an instance group manager action. -func (vpc *VpcV1) UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) +// GetInstanceGroupManagerPolicy : Retrieve an instance group manager policy +// This request retrieves a single instance group manager policy specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceGroupManagerActionWithContext is an alternate form of the UpdateInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Context, updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions cannot be nil") +// GetInstanceGroupManagerPolicyWithContext is an alternate form of the GetInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions") + err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *updateInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *updateInstanceGroupManagerActionOptions.ID, + "instance_group_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *getInstanceGroupManagerPolicyOptions.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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceGroupManagerActionOptions.Headers { + for headerName, headerValue := range getInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerAction") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") 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(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) - 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()) @@ -9822,12 +9700,12 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_group_manager_action", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_group_manager_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9838,46 +9716,46 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Contex return } -// ListInstanceGroupManagerPolicies : List policies for an instance group manager -// This request lists policies for an instance group manager. -func (vpc *VpcV1) ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) +// GetInstanceGroupMembership : Retrieve an instance group membership +// This request retrieves a single instance group membership specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceGroupManagerPoliciesWithContext is an alternate form of the ListInstanceGroupManagerPolicies method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Context, listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions cannot be nil") +// GetInstanceGroupMembershipWithContext is an alternate form of the GetInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions") + err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupID, - "instance_group_manager_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupManagerID, + "instance_group_id": *getInstanceGroupMembershipOptions.InstanceGroupID, + "id": *getInstanceGroupMembershipOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceGroupManagerPoliciesOptions.Headers { + for headerName, headerValue := range getInstanceGroupMembershipOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerPolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -9885,12 +9763,6 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listInstanceGroupManagerPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Start)) - } - if listInstanceGroupManagerPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -9901,12 +9773,12 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_group_manager_policies", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_group_membership", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9917,59 +9789,58 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex return } -// CreateInstanceGroupManagerPolicy : Create a policy for an instance group manager -// This request creates a new instance group manager policy. -func (vpc *VpcV1) CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) +// ListInstanceGroupManagerActions : List actions for an instance group manager +// This request lists instance group actions for an instance group manager. +func (vpc *VpcV1) ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceGroupManagerPolicyWithContext is an alternate form of the CreateInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Context, createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions cannot be nil") +// ListInstanceGroupManagerActionsWithContext is an alternate form of the ListInstanceGroupManagerActions method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context, listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") + err = core.ValidateStruct(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "instance_group_id": *listInstanceGroupManagerActionsOptions.InstanceGroupID, + "instance_group_manager_id": *listInstanceGroupManagerActionsOptions.InstanceGroupManagerID, } - 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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceGroupManagerPolicyOptions.Headers { + for headerName, headerValue := range listInstanceGroupManagerActionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerActions") 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(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listInstanceGroupManagerActionsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) + } + if listInstanceGroupManagerActionsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Limit)) } request, err := builder.Build() @@ -9981,12 +9852,12 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_group_manager_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_group_manager_actions", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerActionsCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9997,53 +9868,59 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex return } -// DeleteInstanceGroupManagerPolicy : Delete an instance group manager policy -// This request deletes an instance group manager policy. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) +// ListInstanceGroupManagerPolicies : List policies for an instance group manager +// This request lists policies for an instance group manager. +func (vpc *VpcV1) ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceGroupManagerPolicyWithContext is an alternate form of the DeleteInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Context, deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions cannot be nil") +// ListInstanceGroupManagerPoliciesWithContext is an alternate form of the ListInstanceGroupManagerPolicies method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Context, listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") + err = core.ValidateStruct(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *deleteInstanceGroupManagerPolicyOptions.ID, + "instance_group_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupID, + "instance_group_manager_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupManagerID, } - 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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupManagerPolicyOptions.Headers { + for headerName, headerValue := range listInstanceGroupManagerPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerPolicies") 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 listInstanceGroupManagerPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Start)) + } + if listInstanceGroupManagerPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -10051,57 +9928,64 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Contex 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_instance_group_manager_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_group_manager_policies", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicyCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetInstanceGroupManagerPolicy : Retrieve an instance group manager policy -// This request retrieves a single instance group manager policy specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) +// ListInstanceGroupManagers : List managers for an instance group +// This request lists managers for an instance group. +func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceGroupManagerPolicyWithContext is an alternate form of the GetInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions cannot be nil") +// ListInstanceGroupManagersWithContext is an alternate form of the ListInstanceGroupManagers method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") + err = core.ValidateStruct(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *getInstanceGroupManagerPolicyOptions.ID, + "instance_group_id": *listInstanceGroupManagersOptions.InstanceGroupID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceGroupManagerPolicyOptions.Headers { + for headerName, headerValue := range listInstanceGroupManagersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -10109,6 +9993,12 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listInstanceGroupManagersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) + } + if listInstanceGroupManagersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagersOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -10119,12 +10009,12 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_group_manager_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_group_managers", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10135,62 +10025,128 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, return } -// UpdateInstanceGroupManagerPolicy : Update an instance group manager policy -// This request updates an instance group manager policy. -func (vpc *VpcV1) UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) +// ListInstanceGroupMemberships : List memberships for an instance group +// This request lists instance group memberships for an instance group. +func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceGroupManagerPolicyWithContext is an alternate form of the UpdateInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Context, updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions cannot be nil") +// ListInstanceGroupMembershipsWithContext is an alternate form of the ListInstanceGroupMemberships method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") + err = core.ValidateStruct(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *updateInstanceGroupManagerPolicyOptions.ID, + "instance_group_id": *listInstanceGroupMembershipsOptions.InstanceGroupID, } - 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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { + for headerName, headerValue := range listInstanceGroupMembershipsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupMemberships") 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 listInstanceGroupMembershipsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) + } + if listInstanceGroupMembershipsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupMembershipsOptions.Limit)) + } - _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) + request, err := builder.Build() if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + 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_group_memberships", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembershipCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// ListInstanceGroups : List instance groups +// This request lists instance groups in the region. +func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ListInstanceGroupsWithContext is an alternate form of the ListInstanceGroups method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceGroupsOptions, "listInstanceGroupsOptions") + 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, `/instance_groups`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listInstanceGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") + 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 listInstanceGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) + } + if listInstanceGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupsOptions.Limit)) + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -10200,12 +10156,12 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_group_manager_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_groups", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10216,120 +10172,139 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex return } -// DeleteInstanceGroupMemberships : Delete memberships from an instance group -// This request deletes memberships of an instance group. This operation cannot be reversed. Memberships that have -// `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. -func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) +// UpdateInstanceGroup : Update an instance group +// This request updates an instance group with the information provided instance group patch. The instance group patch +// object is structured in the same way as a retrieved instance group and contains only the information to be updated. +func (vpc *VpcV1) UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceGroupMembershipsWithContext is an alternate form of the DeleteInstanceGroupMemberships method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions cannot be nil") +// UpdateInstanceGroupWithContext is an alternate form of the UpdateInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupOptions, "updateInstanceGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") + err = core.ValidateStruct(updateInstanceGroupOptions, "updateInstanceGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupMembershipsOptions.InstanceGroupID, + "id": *updateInstanceGroupOptions.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, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupMembershipsOptions.Headers { + for headerName, headerValue := range updateInstanceGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") 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(updateInstanceGroupOptions.InstanceGroupPatch) + 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_instance_group_memberships", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// ListInstanceGroupMemberships : List memberships for an instance group -// This request lists instance group memberships for an instance group. -func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) +// UpdateInstanceGroupManager : Update an instance group manager +// This request updates an instance group manager with the information provided instance group manager patch. +func (vpc *VpcV1) UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceGroupMembershipsWithContext is an alternate form of the ListInstanceGroupMemberships method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions cannot be nil") +// UpdateInstanceGroupManagerWithContext is an alternate form of the UpdateInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") + err = core.ValidateStruct(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupMembershipsOptions.InstanceGroupID, + "instance_group_id": *updateInstanceGroupManagerOptions.InstanceGroupID, + "id": *updateInstanceGroupManagerOptions.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, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceGroupMembershipsOptions.Headers { + for headerName, headerValue := range updateInstanceGroupManagerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupMemberships") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManager") 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 listInstanceGroupMembershipsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) - } - if listInstanceGroupMembershipsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupMembershipsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -10341,12 +10316,12 @@ func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, l var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_group_memberships", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_group_manager", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembershipCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10357,118 +10332,143 @@ func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, l return } -// DeleteInstanceGroupMembership : Delete an instance group membership -// This request deletes a memberships of an instance group. This operation cannot be reversed. reversed. If the -// membership has `delete_instance_on_membership_delete` set to `true`, the instance will also be deleted. -func (vpc *VpcV1) DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) +// UpdateInstanceGroupManagerAction : Update specified instance group manager action +// This request updates an instance group manager action. +func (vpc *VpcV1) UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceGroupMembershipWithContext is an alternate form of the DeleteInstanceGroupMembership method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions cannot be nil") +// UpdateInstanceGroupManagerActionWithContext is an alternate form of the UpdateInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Context, updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") + err = core.ValidateStruct(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupMembershipOptions.InstanceGroupID, - "id": *deleteInstanceGroupMembershipOptions.ID, + "instance_group_id": *updateInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *updateInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *updateInstanceGroupManagerActionOptions.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, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupMembershipOptions.Headers { + for headerName, headerValue := range updateInstanceGroupManagerActionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerAction") 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(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) + 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_instance_group_membership", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_group_manager_action", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetInstanceGroupMembership : Retrieve an instance group membership -// This request retrieves a single instance group membership specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) +// UpdateInstanceGroupManagerPolicy : Update an instance group manager policy +// This request updates an instance group manager policy. +func (vpc *VpcV1) UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceGroupMembershipWithContext is an alternate form of the GetInstanceGroupMembership method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions cannot be nil") +// UpdateInstanceGroupManagerPolicyWithContext is an alternate form of the UpdateInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Context, updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") + err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupMembershipOptions.InstanceGroupID, - "id": *getInstanceGroupMembershipOptions.ID, + "instance_group_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *updateInstanceGroupManagerPolicyOptions.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, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceGroupMembershipOptions.Headers { + for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerPolicy") 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(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) + 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()) @@ -10478,12 +10478,12 @@ func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, get var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_group_membership", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_group_manager_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10574,62 +10574,51 @@ func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, return } -// ListReservations : List reservations -// This request lists reservations in the region. A reservation provides reserved capacity for a specified profile in a -// specified zone. A reservation can also include a long-term committed use discount. -// -// The reservations will be sorted by their `created_at` property values, with newest reservations first. Reservations -// with identical `created_at` property values will in turn be sorted by ascending `name` property values. -func (vpc *VpcV1) ListReservations(listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListReservationsWithContext(context.Background(), listReservationsOptions) +// ActivateReservation : Activate a reservation +// This request activates a reservation. For this request to succeed, the reservation status must be `inactive`. +func (vpc *VpcV1) ActivateReservation(activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.ActivateReservationWithContext(context.Background(), activateReservationOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListReservationsWithContext is an alternate form of the ListReservations method which supports a Context parameter -func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listReservationsOptions, "listReservationsOptions") +// ActivateReservationWithContext is an alternate form of the ActivateReservation method which supports a Context parameter +func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(activateReservationOptions, "activateReservationOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(activateReservationOptions, "activateReservationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *activateReservationOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}/activate`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listReservationsOptions.Headers { + for headerName, headerValue := range activateReservationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListReservations") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ActivateReservation") 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 listReservationsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listReservationsOptions.Start)) - } - if listReservationsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listReservationsOptions.Limit)) - } - if listReservationsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listReservationsOptions.Name)) - } - if listReservationsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listReservationsOptions.ResourceGroupID)) - } - if listReservationsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listReservationsOptions.ZoneName)) - } request, err := builder.Build() if err != nil { @@ -10637,21 +10626,12 @@ func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservati 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_reservations", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "activate_reservation", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservationCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } @@ -10899,59 +10879,61 @@ func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationO return } -// UpdateReservation : Update a reservation -// This request updates a reservation with the information provided in a reservation patch object. The patch object is -// structured in the same way as a retrieved reservation and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateReservation(updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateReservationWithContext(context.Background(), updateReservationOptions) +// ListReservations : List reservations +// This request lists reservations in the region. A reservation provides reserved capacity for a specified profile in a +// specified zone. A reservation can also include a long-term committed use discount. +// +// The reservations will be sorted by their `created_at` property values, with newest reservations first. Reservations +// with identical `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListReservations(listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListReservationsWithContext(context.Background(), listReservationsOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateReservationWithContext is an alternate form of the UpdateReservation method which supports a Context parameter -func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateReservationOptions, "updateReservationOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateReservationOptions, "updateReservationOptions") +// ListReservationsWithContext is an alternate form of the ListReservations method which supports a Context parameter +func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listReservationsOptions, "listReservationsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *updateReservationOptions.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, `/reservations/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateReservationOptions.Headers { + for headerName, headerValue := range listReservationsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateReservation") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListReservations") 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(updateReservationOptions.ReservationPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listReservationsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listReservationsOptions.Start)) + } + if listReservationsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listReservationsOptions.Limit)) + } + if listReservationsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listReservationsOptions.Name)) + } + if listReservationsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listReservationsOptions.ResourceGroupID)) + } + if listReservationsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listReservationsOptions.ZoneName)) } request, err := builder.Build() @@ -10963,12 +10945,12 @@ func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReserv var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_reservation", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_reservations", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservationCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10979,120 +10961,134 @@ func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReserv return } -// ActivateReservation : Activate a reservation -// This request activates a reservation. For this request to succeed, the reservation status must be `inactive`. -func (vpc *VpcV1) ActivateReservation(activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.ActivateReservationWithContext(context.Background(), activateReservationOptions) +// UpdateReservation : Update a reservation +// This request updates a reservation with the information provided in a reservation patch object. The patch object is +// structured in the same way as a retrieved reservation and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateReservation(updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateReservationWithContext(context.Background(), updateReservationOptions) err = core.RepurposeSDKProblem(err, "") return } -// ActivateReservationWithContext is an alternate form of the ActivateReservation method which supports a Context parameter -func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(activateReservationOptions, "activateReservationOptions cannot be nil") +// UpdateReservationWithContext is an alternate form of the UpdateReservation method which supports a Context parameter +func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateReservationOptions, "updateReservationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(activateReservationOptions, "activateReservationOptions") + err = core.ValidateStruct(updateReservationOptions, "updateReservationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *activateReservationOptions.ID, + "id": *updateReservationOptions.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, `/reservations/{id}/activate`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range activateReservationOptions.Headers { + for headerName, headerValue := range updateReservationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ActivateReservation") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateReservation") 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(updateReservationOptions.ReservationPatch) + 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, "activate_reservation", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_reservation", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// ListDedicatedHostGroups : List dedicated host groups -// This request lists dedicated host groups in the region. Host groups are a collection of dedicated hosts for placement -// of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. -func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) +// CreateDedicatedHost : Create a dedicated host +// This request creates a new dedicated host. +func (vpc *VpcV1) CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListDedicatedHostGroupsWithContext is an alternate form of the ListDedicatedHostGroups method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostGroupsOptions, "listDedicatedHostGroupsOptions") +// CreateDedicatedHostWithContext is an alternate form of the CreateDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createDedicatedHostOptions, "createDedicatedHostOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/dedicated_host/groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { + for headerName, headerValue := range createDedicatedHostOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") 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)) - if listDedicatedHostGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) - } - if listDedicatedHostGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostGroupsOptions.Limit)) - } - if listDedicatedHostGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostGroupsOptions.ResourceGroupID)) - } - if listDedicatedHostGroupsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostGroupsOptions.ZoneName)) - } - if listDedicatedHostGroupsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listDedicatedHostGroupsOptions.Name)) + + _, err = builder.SetBodyContentJSON(createDedicatedHostOptions.DedicatedHostPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -11104,12 +11100,12 @@ func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDe var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_dedicated_host_groups", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_dedicated_host", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11211,6 +11207,68 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat return } +// DeleteDedicatedHost : Delete a dedicated host +// This request deletes a dedicated host. +func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// DeleteDedicatedHostWithContext is an alternate form of the DeleteDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteDedicatedHostOptions, "deleteDedicatedHostOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *deleteDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deleteDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") + 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_dedicated_host", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + // DeleteDedicatedHostGroup : Delete a dedicated host group // This request deletes a dedicated host group. func (vpc *VpcV1) DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { @@ -11273,45 +11331,45 @@ func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, delet return } -// GetDedicatedHostGroup : Retrieve a dedicated host group -// This request retrieves a single dedicated host group specified by the identifier in the URL. -func (vpc *VpcV1) GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) +// GetDedicatedHost : Retrieve a dedicated host +// This request retrieves a single dedicated host specified by the identifiers in the URL. +func (vpc *VpcV1) GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetDedicatedHostGroupWithContext is an alternate form of the GetDedicatedHostGroup method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions cannot be nil") +// GetDedicatedHostWithContext is an alternate form of the GetDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostOptions, "getDedicatedHostOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") + err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getDedicatedHostGroupOptions.ID, + "id": *getDedicatedHostOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getDedicatedHostGroupOptions.Headers { + for headerName, headerValue := range getDedicatedHostOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11329,12 +11387,12 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_dedicated_host_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_dedicated_host", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11345,62 +11403,54 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic return } -// UpdateDedicatedHostGroup : Update a dedicated host group -// This request updates a dedicated host group with the information in a provided dedicated host group patch. The -// dedicated host group patch object is structured in the same way as a retrieved dedicated host group and contains only -// the information to be updated. -func (vpc *VpcV1) UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) +// GetDedicatedHostDisk : Retrieve a dedicated host disk +// This request retrieves a single dedicated host disk specified by the identifier in the URL. +func (vpc *VpcV1) GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateDedicatedHostGroupWithContext is an alternate form of the UpdateDedicatedHostGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions cannot be nil") +// GetDedicatedHostDiskWithContext is an alternate form of the GetDedicatedHostDisk method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") + err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateDedicatedHostGroupOptions.ID, + "dedicated_host_id": *getDedicatedHostDiskOptions.DedicatedHostID, + "id": *getDedicatedHostDiskOptions.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, `/dedicated_host/groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { + for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") 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(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) - 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()) @@ -11410,12 +11460,12 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_dedicated_host_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_dedicated_host_disk", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11426,37 +11476,45 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat return } -// ListDedicatedHostProfiles : List dedicated host profiles -// This request lists provisionable [dedicated host profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in -// the region. A dedicated host profile specifies the hardware characteristics for a dedicated host. -func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) +// GetDedicatedHostGroup : Retrieve a dedicated host group +// This request retrieves a single dedicated host group specified by the identifier in the URL. +func (vpc *VpcV1) GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListDedicatedHostProfilesWithContext is an alternate form of the ListDedicatedHostProfiles method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostProfilesOptions, "listDedicatedHostProfilesOptions") +// GetDedicatedHostGroupWithContext is an alternate form of the GetDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *getDedicatedHostGroupOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { + for headerName, headerValue := range getDedicatedHostGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11464,12 +11522,6 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listDedicatedHostProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) - } - if listDedicatedHostProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostProfilesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -11480,12 +11532,12 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_dedicated_host_profiles", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_dedicated_host_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11568,36 +11620,47 @@ func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDed return } -// ListDedicatedHosts : List dedicated hosts -// This request lists dedicated hosts in the region. -func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) +// ListDedicatedHostDisks : List disks on a dedicated host +// This request lists disks on a dedicated host. A disk is a physical device that is locally attached to the compute +// node. By default, the listed disks are sorted by their +// `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListDedicatedHostsWithContext is an alternate form of the ListDedicatedHosts method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostsOptions, "listDedicatedHostsOptions") +// ListDedicatedHostDisksWithContext is an alternate form of the ListDedicatedHostDisks method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "dedicated_host_id": *listDedicatedHostDisksOptions.DedicatedHostID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listDedicatedHostsOptions.Headers { + for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11605,24 +11668,6 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listDedicatedHostsOptions.DedicatedHostGroupID != nil { - builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) - } - if listDedicatedHostsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostsOptions.Start)) - } - if listDedicatedHostsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostsOptions.Limit)) - } - if listDedicatedHostsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostsOptions.ResourceGroupID)) - } - if listDedicatedHostsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostsOptions.ZoneName)) - } - if listDedicatedHostsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listDedicatedHostsOptions.Name)) - } request, err := builder.Build() if err != nil { @@ -11633,12 +11678,12 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_dedicated_hosts", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_dedicated_host_disks", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDiskCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11649,54 +11694,58 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat return } -// CreateDedicatedHost : Create a dedicated host -// This request creates a new dedicated host. -func (vpc *VpcV1) CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) +// ListDedicatedHostGroups : List dedicated host groups +// This request lists dedicated host groups in the region. Host groups are a collection of dedicated hosts for placement +// of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. +func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateDedicatedHostWithContext is an alternate form of the CreateDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createDedicatedHostOptions, "createDedicatedHostOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") +// ListDedicatedHostGroupsWithContext is an alternate form of the ListDedicatedHostGroups method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostGroupsOptions, "listDedicatedHostGroupsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/dedicated_hosts`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createDedicatedHostOptions.Headers { + for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") 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(createDedicatedHostOptions.DedicatedHostPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listDedicatedHostGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) + } + if listDedicatedHostGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostGroupsOptions.Limit)) + } + if listDedicatedHostGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostGroupsOptions.ResourceGroupID)) + } + if listDedicatedHostGroupsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostGroupsOptions.ZoneName)) + } + if listDedicatedHostGroupsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listDedicatedHostGroupsOptions.Name)) } request, err := builder.Build() @@ -11708,12 +11757,12 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_dedicated_host", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_dedicated_host_groups", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroupCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11724,47 +11773,37 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi return } -// ListDedicatedHostDisks : List disks on a dedicated host -// This request lists disks on a dedicated host. A disk is a physical device that is locally attached to the compute -// node. By default, the listed disks are sorted by their -// `created_at` property values, with the newest disk first. -func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) +// ListDedicatedHostProfiles : List dedicated host profiles +// This request lists provisionable [dedicated host profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in +// the region. A dedicated host profile specifies the hardware characteristics for a dedicated host. +func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListDedicatedHostDisksWithContext is an alternate form of the ListDedicatedHostDisks method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") +// ListDedicatedHostProfilesWithContext is an alternate form of the ListDedicatedHostProfiles method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostProfilesOptions, "listDedicatedHostProfilesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "dedicated_host_id": *listDedicatedHostDisksOptions.DedicatedHostID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { + for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11772,6 +11811,12 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listDedicatedHostProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) + } + if listDedicatedHostProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostProfilesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -11782,12 +11827,12 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_dedicated_host_disks", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_dedicated_host_profiles", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDiskCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11798,46 +11843,36 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed return } -// GetDedicatedHostDisk : Retrieve a dedicated host disk -// This request retrieves a single dedicated host disk specified by the identifier in the URL. -func (vpc *VpcV1) GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) +// ListDedicatedHosts : List dedicated hosts +// This request lists dedicated hosts in the region. +func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetDedicatedHostDiskWithContext is an alternate form of the GetDedicatedHostDisk method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") +// ListDedicatedHostsWithContext is an alternate form of the ListDedicatedHosts method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostsOptions, "listDedicatedHostsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "dedicated_host_id": *getDedicatedHostDiskOptions.DedicatedHostID, - "id": *getDedicatedHostDiskOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { + for headerName, headerValue := range listDedicatedHostsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11845,6 +11880,24 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listDedicatedHostsOptions.DedicatedHostGroupID != nil { + builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) + } + if listDedicatedHostsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostsOptions.Start)) + } + if listDedicatedHostsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostsOptions.Limit)) + } + if listDedicatedHostsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostsOptions.ResourceGroupID)) + } + if listDedicatedHostsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostsOptions.ZoneName)) + } + if listDedicatedHostsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listDedicatedHostsOptions.Name)) + } request, err := builder.Build() if err != nil { @@ -11855,12 +11908,12 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_dedicated_host_disk", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_dedicated_hosts", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11871,46 +11924,47 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica return } -// UpdateDedicatedHostDisk : Update a dedicated host disk -// This request updates the dedicated host disk with the information in a provided patch. -func (vpc *VpcV1) UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) +// UpdateDedicatedHost : Update a dedicated host +// This request updates a dedicated host with the information in a provided dedicated host patch. The dedicated host +// patch object is structured in the same way as a retrieved dedicated host and contains only the information to be +// updated. +func (vpc *VpcV1) UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateDedicatedHostDiskWithContext is an alternate form of the UpdateDedicatedHostDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions cannot be nil") +// UpdateDedicatedHostWithContext is an alternate form of the UpdateDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostOptions, "updateDedicatedHostOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") + err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "dedicated_host_id": *updateDedicatedHostDiskOptions.DedicatedHostID, - "id": *updateDedicatedHostDiskOptions.ID, + "id": *updateDedicatedHostOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { + for headerName, headerValue := range updateDedicatedHostOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11920,7 +11974,7 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) + _, err = builder.SetBodyContentJSON(updateDedicatedHostOptions.DedicatedHostPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -11935,12 +11989,12 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_dedicated_host_disk", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_dedicated_host", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11951,115 +12005,61 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update return } -// DeleteDedicatedHost : Delete a dedicated host -// This request deletes a dedicated host. -func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) +// UpdateDedicatedHostDisk : Update a dedicated host disk +// This request updates the dedicated host disk with the information in a provided patch. +func (vpc *VpcV1) UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteDedicatedHostWithContext is an alternate form of the DeleteDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteDedicatedHostOptions, "deleteDedicatedHostOptions cannot be nil") +// UpdateDedicatedHostDiskWithContext is an alternate form of the UpdateDedicatedHostDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") + err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteDedicatedHostOptions.ID, + "dedicated_host_id": *updateDedicatedHostDiskOptions.DedicatedHostID, + "id": *updateDedicatedHostDiskOptions.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, `/dedicated_hosts/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteDedicatedHostOptions.Headers { + for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") 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_dedicated_host", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetDedicatedHost : Retrieve a dedicated host -// This request retrieves a single dedicated host specified by the identifiers in the URL. -func (vpc *VpcV1) GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// GetDedicatedHostWithContext is an alternate form of the GetDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostOptions, "getDedicatedHostOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *getDedicatedHostOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + _, err = builder.SetBodyContentJSON(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) 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 getDedicatedHostOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") - 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()) @@ -12069,12 +12069,12 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_dedicated_host", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_dedicated_host_disk", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12085,47 +12085,47 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH return } -// UpdateDedicatedHost : Update a dedicated host -// This request updates a dedicated host with the information in a provided dedicated host patch. The dedicated host -// patch object is structured in the same way as a retrieved dedicated host and contains only the information to be -// updated. -func (vpc *VpcV1) UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) +// UpdateDedicatedHostGroup : Update a dedicated host group +// This request updates a dedicated host group with the information in a provided dedicated host group patch. The +// dedicated host group patch object is structured in the same way as a retrieved dedicated host group and contains only +// the information to be updated. +func (vpc *VpcV1) UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateDedicatedHostWithContext is an alternate form of the UpdateDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostOptions, "updateDedicatedHostOptions cannot be nil") +// UpdateDedicatedHostGroupWithContext is an alternate form of the UpdateDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") + err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateDedicatedHostOptions.ID, + "id": *updateDedicatedHostGroupOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateDedicatedHostOptions.Headers { + for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12135,7 +12135,7 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateDedicatedHostOptions.DedicatedHostPatch) + _, err = builder.SetBodyContentJSON(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -12150,81 +12150,12 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_dedicated_host", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListPlacementGroups : List placement groups -// This request lists placement groups in the region. -func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter -func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") - 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, `/placement_groups`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listPlacementGroupsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") - 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 listPlacementGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) - } - if listPlacementGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.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_placement_groups", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_dedicated_host_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12455,99 +12386,17 @@ func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacement return } -// UpdatePlacementGroup : Update a placement group -// This request updates a placement group with the information provided placement group patch. The placement group patch -// object is structured in the same way as a retrieved placement group and contains only the information to be updated. -func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updatePlacementGroupOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updatePlacementGroupOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") - 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(updatePlacementGroupOptions.PlacementGroupPatch) - 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_placement_group", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListBareMetalServerProfiles : List bare metal server profiles -// This request lists [bare metal server profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) -// available in the region. A bare metal server profile specifies the performance characteristics and pricing model for -// a bare metal server. -func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) +// ListPlacementGroups : List placement groups +// This request lists placement groups in the region. +func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") +// ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter +func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -12556,17 +12405,17 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { + for headerName, headerValue := range listPlacementGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12574,11 +12423,11 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listBareMetalServerProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) + if listPlacementGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) } - if listBareMetalServerProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.Limit)) + if listPlacementGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.Limit)) } request, err := builder.Build() @@ -12590,12 +12439,12 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_bare_metal_server_profiles", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_placement_groups", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12606,53 +12455,61 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li return } -// GetBareMetalServerProfile : Retrieve a bare metal server profile -// This request retrieves a single bare metal server profile specified by the name in the URL. -func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) +// UpdatePlacementGroup : Update a placement group +// This request updates a placement group with the information provided placement group patch. The placement group patch +// object is structured in the same way as a retrieved placement group and contains only the information to be updated. +func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") +// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") + err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getBareMetalServerProfileOptions.Name, + "id": *updatePlacementGroupOptions.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, `/bare_metal_server/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { + for headerName, headerValue := range updatePlacementGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") 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(updatePlacementGroupOptions.PlacementGroupPatch) + 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()) @@ -12662,12 +12519,12 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bare_metal_server_profile", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_placement_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12678,36 +12535,55 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB return } -// ListBareMetalServers : List bare metal servers -// This request lists bare metal servers in the region. -func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) +// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface +// This request associates the specified floating IP with the specified bare metal server network interface. If +// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` +// is `true`, this replaces any existing association. +// +// The existing floating IP must: +// - not be required by another resource, such as a public gateway +// - be in the same `zone` as the bare metal server +// +// A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") +// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServersOptions.Headers { + for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12715,27 +12591,6 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listBareMetalServersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) - } - if listBareMetalServersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) - } - if listBareMetalServersOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) - } - if listBareMetalServersOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) - } - if listBareMetalServersOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) - } - if listBareMetalServersOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) - } - if listBareMetalServersOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) - } request, err := builder.Build() if err != nil { @@ -12746,12 +12601,12 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_bare_metal_servers", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12929,54 +12784,62 @@ func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context return } -// ListBareMetalServerDisks : List disks on a bare metal server -// This request lists disks on a bare metal server. A disk is a block device that is locally attached to the physical -// server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk first. -func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) +// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server +// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and +// contains the information necessary to create the new bare metal server network attachment. +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") +// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") + err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, + "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, } - 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, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { + for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") 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(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) + 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()) @@ -12986,12 +12849,12 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_bare_metal_server_disks", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_bare_metal_server_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13002,54 +12865,68 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB return } -// GetBareMetalServerDisk : Retrieve a bare metal server disk -// This request retrieves a single disk specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) +// CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server +// This request creates a new bare metal server network interface from a bare metal server network interface prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network interface, and +// contains the information necessary to create the new bare metal server network interface. Any subnet in the bare +// metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. +// Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. +// +// 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, and new network interfaces are not allowed to be created. +func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") +// CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") + err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, - "id": *getBareMetalServerDiskOptions.ID, + "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, } - 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, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { + for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") 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(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) + 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()) @@ -13059,12 +12936,12 @@ func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBare var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bare_metal_server_disk", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_bare_metal_server_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13075,145 +12952,118 @@ func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBare return } -// UpdateBareMetalServerDisk : Update a bare metal server disk -// This request updates the bare metal server disk with the information in a provided patch. -func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) +// DeleteBareMetalServer : Delete a bare metal server +// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the +// bare metal server network interfaces are implicitly disassociated. +func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") +// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") + err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, - "id": *updateBareMetalServerDiskOptions.ID, + "id": *deleteBareMetalServerOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") 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(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) - 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_bare_metal_server_disk", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_bare_metal_server", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListBareMetalServerNetworkAttachments : List network attachments on a bare metal server -// This request lists network attachments on a bare metal server. A bare metal server network attachment is an abstract -// representation of a network device and attaches a bare metal server to a single subnet. Each network interface on a -// bare metal server can attach to any subnet in the zone, including subnets that are already attached to the bare metal -// server. +// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment +// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network attachment are implicitly disassociated. // -// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. -// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property -// values. -func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) +// The bare metal server's primary network attachment cannot be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") +// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") + err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, + "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkAttachmentOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") 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 listBareMetalServerNetworkAttachmentsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) - } - if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -13221,152 +13071,128 @@ func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.C 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_bare_metal_server_network_attachments", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_bare_metal_server_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server -// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype -// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and -// contains the information necessary to create the new bare metal server network attachment. -func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) +// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface +// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server +// network interface is not allowed to be deleted. +// +// 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 is not allowed to be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") +// DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkInterfaceOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") 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(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) - 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_bare_metal_server_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_bare_metal_server_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment -// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs -// associated with the bare metal server network attachment are implicitly disassociated. -// -// The bare metal server's primary network attachment cannot be deleted. -func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) +// GetBareMetalServer : Retrieve a bare metal server +// This request retrieves a single bare metal server specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") +// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *deleteBareMetalServerNetworkAttachmentOptions.ID, + "id": *getBareMetalServerOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range getBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") 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)) @@ -13377,56 +13203,65 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context. 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_bare_metal_server_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment -// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) +// GetBareMetalServerDisk : Retrieve a bare metal server disk +// This request retrieves a single disk specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") +// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *getBareMetalServerNetworkAttachmentOptions.ID, + "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, + "id": *getBareMetalServerDiskOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13444,12 +13279,12 @@ func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bare_metal_server_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server_disk", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13460,63 +13295,55 @@ func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Con return } -// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment -// This request updates a bare metal server network attachment with the information provided in a bare metal server -// network attachment patch object. The bare metal server network attachment patch object is structured in the same way -// as a retrieved bare metal server network attachment and contains only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) +// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server +// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and +// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be +// current. +func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") +// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *updateBareMetalServerNetworkAttachmentOptions.ID, + "id": *getBareMetalServerInitializationOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") 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(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) - 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()) @@ -13526,12 +13353,12 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_bare_metal_server_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server_initialization", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13542,52 +13369,46 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context. return } -// ListBareMetalServerNetworkInterfaces : List network interfaces on a bare metal server -// This request lists network interfaces on a bare metal server. A bare metal server network interface is an abstract -// representation of a network device and attaches a bare metal server to a single subnet. Each network interface on a -// bare metal server can attach to any subnet in the zone, including subnets that are already attached to the bare metal -// server. -// -// If this bare metal server has network attachments, each returned 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. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) +// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment +// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") +// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") + err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, + "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkAttachmentOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13595,12 +13416,6 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listBareMetalServerNetworkInterfacesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) - } - if listBareMetalServerNetworkInterfacesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -13611,12 +13426,12 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_bare_metal_server_network_interfaces", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13627,68 +13442,58 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co return } -// CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server -// This request creates a new bare metal server network interface from a bare metal server network interface prototype -// object. The prototype object is structured in the same way as a retrieved bare metal server network interface, and -// contains the information necessary to create the new bare metal server network interface. Any subnet in the bare -// metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. -// Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. +// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface +// This request retrieves a single bare metal server network interface specified by the identifier in the URL. // -// If this bare metal server has network attachments, each network interface is a [read-only +// If this bare metal server has network attachments, the retrieved 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 new network interfaces are not allowed to be created. -func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) +// attachment and its attached virtual network interface. +func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") +// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkInterfaceOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") 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(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) - 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()) @@ -13698,7 +13503,7 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_bare_metal_server_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -13714,119 +13519,48 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface -// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs -// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server -// network interface is not allowed to be deleted. -// -// 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 is not allowed to be deleted. -func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *deleteBareMetalServerNetworkInterfaceOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") - 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_bare_metal_server_network_interface", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - -// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface -// This request retrieves a single bare metal server network interface specified by the identifier in the URL. -// -// If this bare metal server has network attachments, the retrieved 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. -func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) +// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP if it is associated with the bare metal server network interface +// specified in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") +// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *getBareMetalServerNetworkInterfaceOptions.ID, + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13844,12 +13578,12 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bare_metal_server_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13860,67 +13594,58 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont return } -// UpdateBareMetalServerNetworkInterface : Update a bare metal server network interface -// This request updates a bare metal server network interface with the information provided in a bare metal server -// network interface patch object. The bare metal server network interface patch object is structured in the same way as -// a retrieved bare metal server network interface and needs to contain only the information to be updated. -// -// 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 is not allowed to be updated. -func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) +// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for a bare metal server network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") +// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP") + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *updateBareMetalServerNetworkInterfaceOptions.ID, + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceIPOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") 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(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) - 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()) @@ -13930,12 +13655,12 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_bare_metal_server_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server_network_interface_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13946,46 +13671,45 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// ListBareMetalServerNetworkInterfaceFloatingIps : List floating IPs associated with a bare metal server network interface -// This request lists floating IPs associated with a bare metal server network interface. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) +// GetBareMetalServerProfile : Retrieve a bare metal server profile +// This request retrieves a single bare metal server profile specified by the name in the URL. +func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") +// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") + err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, - "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, + "name": *getBareMetalServerProfileOptions.Name, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { + for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14003,12 +13727,12 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_bare_metal_server_network_interface_floating_ips", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server_profile", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14019,50 +13743,50 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx return } -// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface -// This request disassociates the specified floating IP from the specified bare metal server network interface. -func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) +// ListBareMetalServerDisks : List disks on a bare metal server +// This request lists disks on a bare metal server. A disk is a block device that is locally attached to the physical +// server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) err = core.RepurposeSDKProblem(err, "") return } -// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") +// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, } - 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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") 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)) @@ -14073,58 +13797,71 @@ func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx 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_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_bare_metal_server_disks", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP if it is associated with the bare metal server network interface -// specified in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) +// ListBareMetalServerNetworkAttachments : List network attachments on a bare metal server +// This request lists network attachments on a bare metal server. A bare metal server network attachment is an abstract +// representation of a network device and attaches a bare metal server to a single subnet. Each network interface on a +// bare metal server can attach to any subnet in the zone, including subnets that are already attached to the bare metal +// server. +// +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") +// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14132,6 +13869,12 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listBareMetalServerNetworkAttachmentsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) + } + if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -14142,12 +13885,12 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_bare_metal_server_network_attachments", 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, UnmarshalBareMetalServerNetworkAttachmentCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14158,55 +13901,46 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } -// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface -// This request associates the specified floating IP with the specified bare metal server network interface. If -// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` -// is `true`, this replaces any existing association. -// -// The existing floating IP must: -// - not be required by another resource, such as a public gateway -// - be in the same `zone` as the bare metal server -// -// A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) +// ListBareMetalServerNetworkInterfaceFloatingIps : List floating IPs associated with a bare metal server network interface +// This request lists floating IPs associated with a bare metal server network interface. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) err = core.RepurposeSDKProblem(err, "") return } -// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") +// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, } - 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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14224,12 +13958,12 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "add_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_bare_metal_server_network_interface_floating_ips", 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, UnmarshalFloatingIPUnpaginatedCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14316,50 +14050,52 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. return } -// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP -// This request retrieves the primary reserved IP for a bare metal server network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) +// ListBareMetalServerNetworkInterfaces : List network interfaces on a bare metal server +// This request lists network interfaces on a bare metal server. A bare metal server network interface is an abstract +// representation of a network device and attaches a bare metal server to a single subnet. Each network interface on a +// bare metal server can attach to any subnet in the zone, including subnets that are already attached to the bare metal +// server. +// +// If this bare metal server has network attachments, each returned 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. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP") - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") +// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") + err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceIPOptions.ID, + "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14367,6 +14103,12 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listBareMetalServerNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) + } + if listBareMetalServerNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -14377,12 +14119,12 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bare_metal_server_network_interface_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_bare_metal_server_network_interfaces", 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, UnmarshalBareMetalServerNetworkInterfaceCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14393,52 +14135,51 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co return } -// DeleteBareMetalServer : Delete a bare metal server -// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the -// bare metal server network interfaces are implicitly disassociated. -func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) +// ListBareMetalServerProfiles : List bare metal server profiles +// This request lists [bare metal server profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) +// available in the region. A bare metal server profile specifies the performance characteristics and pricing model for +// a bare metal server. +func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") +// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *deleteBareMetalServerOptions.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, `/bare_metal_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBareMetalServerOptions.Headers { + for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") 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 listBareMetalServerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) + } + if listBareMetalServerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -14446,55 +14187,55 @@ func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBa 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_bare_metal_server", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_bare_metal_server_profiles", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetBareMetalServer : Retrieve a bare metal server -// This request retrieves a single bare metal server specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) +// ListBareMetalServers : List bare metal servers +// This request lists bare metal servers in the region. +func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") +// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *getBareMetalServerOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerOptions.Headers { + for headerName, headerValue := range listBareMetalServersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14502,6 +14243,27 @@ func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMeta builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listBareMetalServersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) + } + if listBareMetalServersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) + } + if listBareMetalServersOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) + } + if listBareMetalServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) + } + if listBareMetalServersOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) + } + if listBareMetalServersOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) + } + if listBareMetalServersOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) + } request, err := builder.Build() if err != nil { @@ -14512,12 +14274,12 @@ func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMeta var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bare_metal_server", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_bare_metal_servers", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14528,114 +14290,97 @@ func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMeta return } -// UpdateBareMetalServer : Update a bare metal server -// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object -// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) +// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface +// This request disassociates the specified floating IP from the specified bare metal server network interface. +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") +// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") + err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateBareMetalServerOptions.ID, + "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBareMetalServerOptions.Headers { + for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") 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(updateBareMetalServerOptions.BareMetalServerPatch) - 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_bare_metal_server", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "remove_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server -// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and -// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be -// current. -func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) +// ReplaceBareMetalServerInitialization : Reinitialize a bare metal server +// This request reinitializes a bare metal server with the specified image and SSH keys. The server must be stopped. +// Upon successful reinitiatilization, the bare metal server will be started automatically. +func (vpc *VpcV1) ReplaceBareMetalServerInitialization(replaceBareMetalServerInitializationOptions *ReplaceBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + result, response, err = vpc.ReplaceBareMetalServerInitializationWithContext(context.Background(), replaceBareMetalServerInitializationOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") +// ReplaceBareMetalServerInitializationWithContext is an alternate form of the ReplaceBareMetalServerInitialization method which supports a Context parameter +func (vpc *VpcV1) ReplaceBareMetalServerInitializationWithContext(ctx context.Context, replaceBareMetalServerInitializationOptions *ReplaceBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceBareMetalServerInitializationOptions, "replaceBareMetalServerInitializationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") + err = core.ValidateStruct(replaceBareMetalServerInitializationOptions, "replaceBareMetalServerInitializationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getBareMetalServerInitializationOptions.ID, + "id": *replaceBareMetalServerInitializationOptions.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, `/bare_metal_servers/{id}/initialization`, pathParamsMap) @@ -14644,19 +14389,36 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex return } - for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { + for headerName, headerValue := range replaceBareMetalServerInitializationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceBareMetalServerInitialization") 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 replaceBareMetalServerInitializationOptions.Image != nil { + body["image"] = replaceBareMetalServerInitializationOptions.Image + } + if replaceBareMetalServerInitializationOptions.Keys != nil { + body["keys"] = replaceBareMetalServerInitializationOptions.Keys + } + if replaceBareMetalServerInitializationOptions.UserData != nil { + body["user_data"] = replaceBareMetalServerInitializationOptions.UserData + } + _, 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()) @@ -14666,7 +14428,7 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bare_metal_server_initialization", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "replace_bare_metal_server_initialization", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -14881,49 +14643,59 @@ func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMe return } -// ListVolumeProfiles : List volume profiles -// This request lists [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available in -// the region. A volume profile specifies the performance characteristics and pricing model for a volume. -func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) +// UpdateBareMetalServer : Update a bare metal server +// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object +// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter -func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") +// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *updateBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVolumeProfilesOptions.Headers { + for headerName, headerValue := range updateBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") 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 listVolumeProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) - } - if listVolumeProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerOptions.BareMetalServerPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -14935,12 +14707,12 @@ func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeP var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_volume_profiles", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_bare_metal_server", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14951,53 +14723,61 @@ func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeP return } -// GetVolumeProfile : Retrieve a volume profile -// This request retrieves a single volume profile specified by the name in the URL. -func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) +// UpdateBareMetalServerDisk : Update a bare metal server disk +// This request updates the bare metal server disk with the information in a provided patch. +func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter -func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") +// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") + err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getVolumeProfileOptions.Name, + "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, + "id": *updateBareMetalServerDiskOptions.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, `/volume/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVolumeProfileOptions.Headers { + for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") 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(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) + 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()) @@ -15007,12 +14787,12 @@ func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProf var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_volume_profile", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_bare_metal_server_disk", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15023,70 +14803,61 @@ func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProf return } -// ListVolumes : List volumes -// This request lists volumes in the region. Volumes are network-connected block storage devices that may be attached to -// one or more instances in the same region. -func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) +// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment +// This request updates a bare metal server network attachment with the information provided in a bare metal server +// network attachment patch object. The bare metal server network attachment patch object is structured in the same way +// as a retrieved bare metal server network attachment and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter -func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") +// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVolumesOptions.Headers { + for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") 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 listVolumesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) - } - if listVolumesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) - } - if listVolumesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) - } - if listVolumesOptions.AttachmentState != nil { - builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) - } - if listVolumesOptions.Encryption != nil { - builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) - } - if listVolumesOptions.OperatingSystemFamily != nil { - builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) - } - if listVolumesOptions.OperatingSystemArchitecture != nil { - builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) - } - if listVolumesOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) - } - if listVolumesOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -15098,12 +14869,12 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_volumes", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_bare_metal_server_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15114,52 +14885,62 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions return } -// CreateVolume : Create a volume -// This request creates a new volume from a volume prototype object. The prototype object is structured in the same way -// as a retrieved volume, and contains the information necessary to create the new volume. -func (vpc *VpcV1) CreateVolume(createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions) +// UpdateBareMetalServerNetworkInterface : Update a bare metal server network interface +// This request updates a bare metal server network interface with the information provided in a bare metal server +// network interface patch object. The bare metal server network interface patch object is structured in the same way as +// a retrieved bare metal server network interface and needs to contain only the information to be updated. +// +// 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 is not allowed to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVolumeWithContext is an alternate form of the CreateVolume method which supports a Context parameter -func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVolumeOptions, "createVolumeOptions cannot be nil") +// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions") + err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVolumeOptions.Headers { + for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") 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)) - _, err = builder.SetBodyContentJSON(createVolumeOptions.VolumePrototype) + _, err = builder.SetBodyContentJSON(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -15174,12 +14955,12 @@ func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptio var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_volume", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_bare_metal_server_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15190,56 +14971,63 @@ func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptio return } -// DeleteVolume : Delete a volume -// This request deletes a volume. This operation cannot be reversed. For this request to succeed, the volume must not be -// attached to any instances. -func (vpc *VpcV1) DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions) +// UpdateFirmwareForBareMetalServer : Update firmware for a bare metal server +// This request updates a bare metal server to the latest available firmware. The server must be stopped. +func (vpc *VpcV1) UpdateFirmwareForBareMetalServer(updateFirmwareForBareMetalServerOptions *UpdateFirmwareForBareMetalServerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.UpdateFirmwareForBareMetalServerWithContext(context.Background(), updateFirmwareForBareMetalServerOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVolumeWithContext is an alternate form of the DeleteVolume method which supports a Context parameter -func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVolumeOptions, "deleteVolumeOptions cannot be nil") +// UpdateFirmwareForBareMetalServerWithContext is an alternate form of the UpdateFirmwareForBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) UpdateFirmwareForBareMetalServerWithContext(ctx context.Context, updateFirmwareForBareMetalServerOptions *UpdateFirmwareForBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateFirmwareForBareMetalServerOptions, "updateFirmwareForBareMetalServerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions") + err = core.ValidateStruct(updateFirmwareForBareMetalServerOptions, "updateFirmwareForBareMetalServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteVolumeOptions.ID, + "id": *updateFirmwareForBareMetalServerOptions.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, `/volumes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/firmware/update`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVolumeOptions.Headers { + for headerName, headerValue := range updateFirmwareForBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFirmwareForBareMetalServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteVolumeOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVolumeOptions.IfMatch)) - } + 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 updateFirmwareForBareMetalServerOptions.AutoStart != nil { + body["auto_start"] = updateFirmwareForBareMetalServerOptions.AutoStart + } + _, 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()) @@ -15248,7 +15036,7 @@ func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptio response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_volume", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_firmware_for_bare_metal_server", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -15256,53 +15044,57 @@ func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptio return } -// GetVolume : Retrieve a volume -// This request retrieves a single volume specified by the identifier in the URL. -func (vpc *VpcV1) GetVolume(getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVolumeWithContext(context.Background(), getVolumeOptions) +// CreateVolume : Create a volume +// This request creates a new volume from a volume prototype object. The prototype object is structured in the same way +// as a retrieved volume, and contains the information necessary to create the new volume. +func (vpc *VpcV1) CreateVolume(createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVolumeWithContext is an alternate form of the GetVolume method which supports a Context parameter -func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVolumeOptions, "getVolumeOptions cannot be nil") +// CreateVolumeWithContext is an alternate form of the CreateVolume method which supports a Context parameter +func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVolumeOptions, "createVolumeOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions") + err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *getVolumeOptions.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, `/volumes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVolumeOptions.Headers { + for headerName, headerValue := range createVolumeOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") 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(createVolumeOptions.VolumePrototype) + 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()) @@ -15312,7 +15104,7 @@ func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *Ge var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_volume", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_volume", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -15328,33 +15120,33 @@ func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *Ge return } -// UpdateVolume : Update a volume -// This request updates a volume with the information in a provided volume patch. The volume patch object is structured -// in the same way as a retrieved volume and contains only the information to be updated. -func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) +// DeleteVolume : Delete a volume +// This request deletes a volume. This operation cannot be reversed. For this request to succeed, the volume must not be +// attached to any instances. +func (vpc *VpcV1) DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter -func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") +// DeleteVolumeWithContext is an alternate form of the DeleteVolume method which supports a Context parameter +func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVolumeOptions, "deleteVolumeOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") + err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVolumeOptions.ID, + "id": *deleteVolumeOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) @@ -15363,85 +15155,76 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio return } - for headerName, headerValue := range updateVolumeOptions.Headers { + for headerName, headerValue := range deleteVolumeOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVolumeOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) + if deleteVolumeOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVolumeOptions.IfMatch)) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) - 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_volume", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_volume", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListSnapshotConsistencyGroups : List snapshot consistency groups -// This request lists snapshot consistency groups in the region. A snapshot consistency group is a collection of -// individual snapshots taken at the same time. -func (vpc *VpcV1) ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions) +// GetVolume : Retrieve a volume +// This request retrieves a single volume specified by the identifier in the URL. +func (vpc *VpcV1) GetVolume(getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVolumeWithContext(context.Background(), getVolumeOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSnapshotConsistencyGroupsWithContext is an alternate form of the ListSnapshotConsistencyGroups method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSnapshotConsistencyGroupsOptions, "listSnapshotConsistencyGroupsOptions") +// GetVolumeWithContext is an alternate form of the GetVolume method which supports a Context parameter +func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeOptions, "getVolumeOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *getVolumeOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSnapshotConsistencyGroupsOptions.Headers { + for headerName, headerValue := range getVolumeOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15449,24 +15232,6 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listSnapshotConsistencyGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Start)) - } - if listSnapshotConsistencyGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Limit)) - } - if listSnapshotConsistencyGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.ResourceGroupID)) - } - if listSnapshotConsistencyGroupsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Name)) - } - if listSnapshotConsistencyGroupsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Sort)) - } - if listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID)) - } request, err := builder.Build() if err != nil { @@ -15477,12 +15242,12 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_snapshot_consistency_groups", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_volume", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15493,58 +15258,53 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, return } -// CreateSnapshotConsistencyGroup : Create a snapshot consistency group -// This request creates a new snapshot consistency group from a snapshot consistency group object. The prototype object -// is structured in the same way as a retrieved consistency group, and contains the information necessary to provision -// the new snapshot consistency group. -func (vpc *VpcV1) CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSnapshotConsistencyGroupWithContext(context.Background(), createSnapshotConsistencyGroupOptions) +// GetVolumeProfile : Retrieve a volume profile +// This request retrieves a single volume profile specified by the name in the URL. +func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSnapshotConsistencyGroupWithContext is an alternate form of the CreateSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions cannot be nil") +// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter +func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions") + err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "name": *getVolumeProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range getVolumeProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") 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(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) - 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()) @@ -15554,12 +15314,12 @@ func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_snapshot_consistency_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_volume_profile", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15570,46 +15330,37 @@ func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, return } -// DeleteSnapshotConsistencyGroup : Delete a snapshot consistency group -// This request deletes snapshot consistency group. This operation cannot be reversed. If the -// `delete_snapshots_on_delete` property is `true`, all snapshots in the consistency group will also be deleted. -func (vpc *VpcV1) DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteSnapshotConsistencyGroupWithContext(context.Background(), deleteSnapshotConsistencyGroupOptions) +// ListVolumeProfiles : List volume profiles +// This request lists [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available in +// the region. A volume profile specifies the performance characteristics and pricing model for a volume. +func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSnapshotConsistencyGroupWithContext is an alternate form of the DeleteSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions") +// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter +func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *deleteSnapshotConsistencyGroupOptions.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, `/snapshot_consistency_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range listVolumeProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15617,6 +15368,12 @@ func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listVolumeProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) + } + if listVolumeProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -15627,12 +15384,12 @@ func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_snapshot_consistency_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_volume_profiles", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15643,45 +15400,37 @@ func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, return } -// GetSnapshotConsistencyGroup : Retrieve a snapshot consistency group -// This request retrieves a single snapshot consistency group specified by the identifier in the URL. -func (vpc *VpcV1) GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSnapshotConsistencyGroupWithContext(context.Background(), getSnapshotConsistencyGroupOptions) +// ListVolumes : List volumes +// This request lists volumes in the region. Volumes are network-connected block storage devices that may be attached to +// one or more instances in the same region. +func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSnapshotConsistencyGroupWithContext is an alternate form of the GetSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions") +// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter +func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *getSnapshotConsistencyGroupOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range listVolumesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15689,6 +15438,33 @@ func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, ge builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listVolumesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) + } + if listVolumesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) + } + if listVolumesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) + } + if listVolumesOptions.AttachmentState != nil { + builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) + } + if listVolumesOptions.Encryption != nil { + builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) + } + if listVolumesOptions.OperatingSystemFamily != nil { + builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) + } + if listVolumesOptions.OperatingSystemArchitecture != nil { + builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) + } + if listVolumesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) + } + if listVolumesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) + } request, err := builder.Build() if err != nil { @@ -15699,12 +15475,12 @@ func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, ge var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_snapshot_consistency_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_volumes", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15715,60 +15491,59 @@ func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, ge return } -// UpdateSnapshotConsistencyGroup : Update a snapshot consistency group -// This request updates a snapshot consistency group with the information in a provided snapshot consistency group -// patch. The snapshot consistency group patch object is structured in the same way as a retrieved snapshot consistency -// group and contains only the information to be updated. -func (vpc *VpcV1) UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateSnapshotConsistencyGroupWithContext(context.Background(), updateSnapshotConsistencyGroupOptions) +// UpdateVolume : Update a volume +// This request updates a volume with the information in a provided volume patch. The volume patch object is structured +// in the same way as a retrieved volume and contains only the information to be updated. +func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateSnapshotConsistencyGroupWithContext is an alternate form of the UpdateSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions cannot be nil") +// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter +func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions") + err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateSnapshotConsistencyGroupOptions.ID, + "id": *updateVolumeOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range updateVolumeOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSnapshotConsistencyGroupOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotConsistencyGroupOptions.IfMatch)) + if updateVolumeOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch) + _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -15783,12 +15558,12 @@ func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_snapshot_consistency_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_volume", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15799,28 +15574,29 @@ func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, return } -// DeleteSnapshots : Delete a filtered collection of snapshots -// This request deletes snapshots that match the specified filter. This operation cannot be reversed. -func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) +// CreateSnapshot : Create a snapshot +// This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same +// way as a retrieved snapshot, and contains the information necessary to provision the new snapshot. +func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") +// CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") + err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/snapshots`, nil) @@ -15829,18 +15605,25 @@ func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshot return } - for headerName, headerValue := range deleteSnapshotsOptions.Headers { + for headerName, headerValue := range createSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") 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)) - builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) + + _, err = builder.SetBodyContentJSON(createSnapshotOptions.SnapshotPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } request, err := builder.Build() if err != nil { @@ -15848,47 +15631,66 @@ func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshot 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_snapshots", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_snapshot", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// ListSnapshots : List snapshots -// This request lists snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is -// created. -func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) +// CreateSnapshotClone : Create a clone for a snapshot +// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if +// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. +func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") +// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *createSnapshotCloneOptions.ID, + "zone_name": *createSnapshotCloneOptions.ZoneName, + } + + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSnapshotsOptions.Headers { + for headerName, headerValue := range createSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15896,72 +15698,6 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listSnapshotsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) - } - if listSnapshotsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) - } - if listSnapshotsOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag)) - } - if listSnapshotsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID)) - } - if listSnapshotsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name)) - } - if listSnapshotsOptions.SourceVolumeID != nil { - builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID)) - } - if listSnapshotsOptions.SourceVolumeCRN != nil { - builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN)) - } - if listSnapshotsOptions.SourceImageID != nil { - builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID)) - } - if listSnapshotsOptions.SourceImageCRN != nil { - builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN)) - } - if listSnapshotsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort)) - } - if listSnapshotsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) - } - if listSnapshotsOptions.CopiesID != nil { - builder.AddQuery("copies[].id", fmt.Sprint(*listSnapshotsOptions.CopiesID)) - } - if listSnapshotsOptions.CopiesName != nil { - builder.AddQuery("copies[].name", fmt.Sprint(*listSnapshotsOptions.CopiesName)) - } - if listSnapshotsOptions.CopiesCRN != nil { - builder.AddQuery("copies[].crn", fmt.Sprint(*listSnapshotsOptions.CopiesCRN)) - } - if listSnapshotsOptions.CopiesRemoteRegionName != nil { - builder.AddQuery("copies[].remote.region.name", fmt.Sprint(*listSnapshotsOptions.CopiesRemoteRegionName)) - } - if listSnapshotsOptions.SourceSnapshotID != nil { - builder.AddQuery("source_snapshot.id", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotID)) - } - if listSnapshotsOptions.SourceSnapshotRemoteRegionName != nil { - builder.AddQuery("source_snapshot.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotRemoteRegionName)) - } - if listSnapshotsOptions.SourceVolumeRemoteRegionName != nil { - builder.AddQuery("source_volume.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceVolumeRemoteRegionName)) - } - if listSnapshotsOptions.SourceImageRemoteRegionName != nil { - builder.AddQuery("source_image.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceImageRemoteRegionName)) - } - if listSnapshotsOptions.ClonesZoneName != nil { - builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName)) - } - if listSnapshotsOptions.SnapshotConsistencyGroupID != nil { - builder.AddQuery("snapshot_consistency_group.id", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupID)) - } - if listSnapshotsOptions.SnapshotConsistencyGroupCRN != nil { - builder.AddQuery("snapshot_consistency_group.crn", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupCRN)) - } request, err := builder.Build() if err != nil { @@ -15972,12 +15708,12 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_snapshots", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_snapshot_clone", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15988,23 +15724,24 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt return } -// CreateSnapshot : Create a snapshot -// This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same -// way as a retrieved snapshot, and contains the information necessary to provision the new snapshot. -func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) +// CreateSnapshotConsistencyGroup : Create a snapshot consistency group +// This request creates a new snapshot consistency group from a snapshot consistency group object. The prototype object +// is structured in the same way as a retrieved consistency group, and contains the information necessary to provision +// the new snapshot consistency group. +func (vpc *VpcV1) CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSnapshotConsistencyGroupWithContext(context.Background(), createSnapshotConsistencyGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil") +// CreateSnapshotConsistencyGroupWithContext is an alternate form of the CreateSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") + err = core.ValidateStruct(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -16013,17 +15750,17 @@ func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotO builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSnapshotOptions.Headers { + for headerName, headerValue := range createSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16033,7 +15770,7 @@ func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotO builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createSnapshotOptions.SnapshotPrototype) + _, err = builder.SetBodyContentJSON(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -16048,12 +15785,12 @@ func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_snapshot", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_snapshot_consistency_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16129,49 +15866,50 @@ func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotO return } -// GetSnapshot : Retrieve a snapshot -// This request retrieves a single snapshot specified by the identifier in the URL. -func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) +// DeleteSnapshotClone : Delete a snapshot clone +// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated +// from the snapshot. +func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSnapshotWithContext is an alternate form of the GetSnapshot method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotOptions, "getSnapshotOptions cannot be nil") +// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") + err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSnapshotOptions.ID, + "id": *deleteSnapshotCloneOptions.ID, + "zone_name": *deleteSnapshotCloneOptions.ZoneName, } - 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, `/snapshots/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSnapshotOptions.Headers { + for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") 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)) @@ -16182,83 +15920,64 @@ func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions 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_snapshot", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_snapshot_clone", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// UpdateSnapshot : Update a snapshot -// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group -// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. -func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) +// DeleteSnapshotConsistencyGroup : Delete a snapshot consistency group +// This request deletes snapshot consistency group. This operation cannot be reversed. If the +// `delete_snapshots_on_delete` property is `true`, all snapshots in the consistency group will also be deleted. +func (vpc *VpcV1) DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteSnapshotConsistencyGroupWithContext(context.Background(), deleteSnapshotConsistencyGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter -func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") +// DeleteSnapshotConsistencyGroupWithContext is an alternate form of the DeleteSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") + err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateSnapshotOptions.ID, + "id": *deleteSnapshotConsistencyGroupOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateSnapshotOptions.Headers { + for headerName, headerValue := range deleteSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotConsistencyGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSnapshotOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) - 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()) @@ -16268,12 +15987,12 @@ func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_snapshot", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_snapshot_consistency_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16284,52 +16003,48 @@ func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotO return } -// ListSnapshotClones : List clones for a snapshot -// This request lists clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. -func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) +// DeleteSnapshots : Delete a filtered collection of snapshots +// This request deletes snapshots that match the specified filter. This operation cannot be reversed. +func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") +// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") + err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *listSnapshotClonesOptions.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, `/snapshots/{id}/clones`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSnapshotClonesOptions.Headers { + for headerName, headerValue := range deleteSnapshotsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") 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)) + builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) request, err := builder.Build() if err != nil { @@ -16337,69 +16052,59 @@ func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapsho 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_snapshot_clones", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_snapshots", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// DeleteSnapshotClone : Delete a snapshot clone -// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated -// from the snapshot. -func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) +// GetSnapshot : Retrieve a snapshot +// This request retrieves a single snapshot specified by the identifier in the URL. +func (vpc *VpcV1) GetSnapshot(getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSnapshotWithContext(context.Background(), getSnapshotOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") +// GetSnapshotWithContext is an alternate form of the GetSnapshot method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions *GetSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotOptions, "getSnapshotOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") + err = core.ValidateStruct(getSnapshotOptions, "getSnapshotOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteSnapshotCloneOptions.ID, - "zone_name": *deleteSnapshotCloneOptions.ZoneName, + "id": *getSnapshotOptions.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, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { + for headerName, headerValue := range getSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshot") 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)) @@ -16410,12 +16115,21 @@ func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnap 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_snapshot_clone", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_snapshot", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } @@ -16493,47 +16207,45 @@ func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCl return } -// CreateSnapshotClone : Create a clone for a snapshot -// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if -// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. -func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) +// GetSnapshotConsistencyGroup : Retrieve a snapshot consistency group +// This request retrieves a single snapshot consistency group specified by the identifier in the URL. +func (vpc *VpcV1) GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSnapshotConsistencyGroupWithContext(context.Background(), getSnapshotConsistencyGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") +// GetSnapshotConsistencyGroupWithContext is an alternate form of the GetSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") + err = core.ValidateStruct(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *createSnapshotCloneOptions.ID, - "zone_name": *createSnapshotCloneOptions.ZoneName, + "id": *getSnapshotConsistencyGroupOptions.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, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSnapshotCloneOptions.Headers { + for headerName, headerValue := range getSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16551,12 +16263,12 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_snapshot_clone", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_snapshot_consistency_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16567,37 +16279,45 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap return } -// ListShareProfiles : List file share profiles -// This request lists [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) available in -// the region. A file share profile specifies the performance characteristics and pricing model for a file share. -func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) +// ListSnapshotClones : List clones for a snapshot +// This request lists clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. +func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter -func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") +// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *listSnapshotClonesOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listShareProfilesOptions.Headers { + for headerName, headerValue := range listSnapshotClonesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16605,15 +16325,6 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listShareProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) - } - if listShareProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) - } - if listShareProfilesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) - } request, err := builder.Build() if err != nil { @@ -16624,12 +16335,12 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_share_profiles", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_snapshot_clones", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16640,45 +16351,37 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro return } -// GetShareProfile : Retrieve a file share profile -// This request retrieves a single file share profile specified by the name in the URL. -func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) +// ListSnapshotConsistencyGroups : List snapshot consistency groups +// This request lists snapshot consistency groups in the region. A snapshot consistency group is a collection of +// individual snapshots taken at the same time. +func (vpc *VpcV1) ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter -func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") +// ListSnapshotConsistencyGroupsWithContext is an alternate form of the ListSnapshotConsistencyGroups method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSnapshotConsistencyGroupsOptions, "listSnapshotConsistencyGroupsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "name": *getShareProfileOptions.Name, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareProfileOptions.Headers { + for headerName, headerValue := range listSnapshotConsistencyGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16686,6 +16389,24 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listSnapshotConsistencyGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Start)) + } + if listSnapshotConsistencyGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Limit)) + } + if listSnapshotConsistencyGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.ResourceGroupID)) + } + if listSnapshotConsistencyGroupsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Name)) + } + if listSnapshotConsistencyGroupsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Sort)) + } + if listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID)) + } request, err := builder.Build() if err != nil { @@ -16696,12 +16417,12 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_share_profile", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_snapshot_consistency_groups", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroupCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16712,17 +16433,18 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil return } -// ListShares : List file shares -// This request lists file shares in the region. -func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSharesWithContext(context.Background(), listSharesOptions) +// ListSnapshots : List snapshots +// This request lists snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is +// created. +func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter -func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSharesOptions, "listSharesOptions") +// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -16731,17 +16453,17 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSharesOptions.Headers { + for headerName, headerValue := range listSnapshotsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16749,23 +16471,71 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listSharesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) + if listSnapshotsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) } - if listSharesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) + if listSnapshotsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) } - if listSharesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) + if listSnapshotsOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag)) } - if listSharesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) + if listSnapshotsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID)) } - if listSharesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) + if listSnapshotsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name)) } - if listSharesOptions.ReplicationRole != nil { - builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) + if listSnapshotsOptions.SourceVolumeID != nil { + builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID)) + } + if listSnapshotsOptions.SourceVolumeCRN != nil { + builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN)) + } + if listSnapshotsOptions.SourceImageID != nil { + builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID)) + } + if listSnapshotsOptions.SourceImageCRN != nil { + builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN)) + } + if listSnapshotsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort)) + } + if listSnapshotsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) + } + if listSnapshotsOptions.CopiesID != nil { + builder.AddQuery("copies[].id", fmt.Sprint(*listSnapshotsOptions.CopiesID)) + } + if listSnapshotsOptions.CopiesName != nil { + builder.AddQuery("copies[].name", fmt.Sprint(*listSnapshotsOptions.CopiesName)) + } + if listSnapshotsOptions.CopiesCRN != nil { + builder.AddQuery("copies[].crn", fmt.Sprint(*listSnapshotsOptions.CopiesCRN)) + } + if listSnapshotsOptions.CopiesRemoteRegionName != nil { + builder.AddQuery("copies[].remote.region.name", fmt.Sprint(*listSnapshotsOptions.CopiesRemoteRegionName)) + } + if listSnapshotsOptions.SourceSnapshotID != nil { + builder.AddQuery("source_snapshot.id", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotID)) + } + if listSnapshotsOptions.SourceSnapshotRemoteRegionName != nil { + builder.AddQuery("source_snapshot.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotRemoteRegionName)) + } + if listSnapshotsOptions.SourceVolumeRemoteRegionName != nil { + builder.AddQuery("source_volume.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceVolumeRemoteRegionName)) + } + if listSnapshotsOptions.SourceImageRemoteRegionName != nil { + builder.AddQuery("source_image.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceImageRemoteRegionName)) + } + if listSnapshotsOptions.ClonesZoneName != nil { + builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName)) + } + if listSnapshotsOptions.SnapshotConsistencyGroupID != nil { + builder.AddQuery("snapshot_consistency_group.id", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupID)) + } + if listSnapshotsOptions.SnapshotConsistencyGroupCRN != nil { + builder.AddQuery("snapshot_consistency_group.crn", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupCRN)) } request, err := builder.Build() @@ -16777,12 +16547,12 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_shares", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_snapshots", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16793,55 +16563,59 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * return } -// CreateShare : Create a file share -// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, -// a replica share, or both a source and replica share. -// -// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to -// provision the new file shares. -func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateShareWithContext(context.Background(), createShareOptions) +// UpdateSnapshot : Update a snapshot +// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group +// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. +func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter -func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") +// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter +func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createShareOptions, "createShareOptions") + err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *updateSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createShareOptions.Headers { + for headerName, headerValue := range updateSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") 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 updateSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createShareOptions.SharePrototype) + _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -16856,12 +16630,12 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_share", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_snapshot", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16872,62 +16646,65 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions return } -// DeleteShare : Delete a file share -// This request deletes a share. This operation cannot be reversed. A share cannot be deleted if it: -// - has share mount targets -// - has a `lifecycle_state` of `updating` -// - has a replication operation in progress -// -// If the request is accepted, the share `lifecycle_state` will be set to `deleting`. Once deletion processing -// completes, it will no longer be retrievable. -func (vpc *VpcV1) DeleteShare(deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteShareWithContext(context.Background(), deleteShareOptions) +// UpdateSnapshotConsistencyGroup : Update a snapshot consistency group +// This request updates a snapshot consistency group with the information in a provided snapshot consistency group +// patch. The snapshot consistency group patch object is structured in the same way as a retrieved snapshot consistency +// group and contains only the information to be updated. +func (vpc *VpcV1) UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateSnapshotConsistencyGroupWithContext(context.Background(), updateSnapshotConsistencyGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteShareWithContext is an alternate form of the DeleteShare method which supports a Context parameter -func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareOptions, "deleteShareOptions cannot be nil") +// UpdateSnapshotConsistencyGroupWithContext is an alternate form of the UpdateSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteShareOptions, "deleteShareOptions") + err = core.ValidateStruct(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteShareOptions.ID, + "id": *updateSnapshotConsistencyGroupOptions.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, `/shares/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteShareOptions.Headers { + for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteShareOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteShareOptions.IfMatch)) + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateSnapshotConsistencyGroupOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotConsistencyGroupOptions.IfMatch)) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch) + 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()) @@ -16937,12 +16714,12 @@ func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_share", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_snapshot_consistency_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16953,53 +16730,60 @@ func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions return } -// GetShare : Retrieve a file share -// This request retrieves a single file share specified by the identifier in the URL. -func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareWithContext(context.Background(), getShareOptions) +// CreateShare : Create a file share +// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, +// a replica share, or both a source and replica share. +// +// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to +// provision the new file shares. +func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateShareWithContext(context.Background(), createShareOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter -func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") +// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter +func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareOptions, "getShareOptions") + err = core.ValidateStruct(createShareOptions, "createShareOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *getShareOptions.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, `/shares/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareOptions.Headers { + for headerName, headerValue := range createShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") 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(createShareOptions.SharePrototype) + 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()) @@ -17009,7 +16793,7 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_share", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_share", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -17025,59 +16809,58 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS return } -// UpdateShare : Update a file share -// This request updates a share with the information in a provided share patch. The share patch object is structured in -// the same way as a retrieved share and contains only the information to be updated. -func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateShareWithContext(context.Background(), updateShareOptions) +// CreateShareMountTarget : Create a mount target for a file share +// This request creates a new share mount target from a share mount target prototype object. +// +// The prototype object is structured in the same way as a retrieved share mount target, and contains the information +// necessary to provision the new file share mount target. +func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter -func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") +// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateShareOptions, "updateShareOptions") + err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateShareOptions.ID, + "share_id": *createShareMountTargetOptions.ShareID, } - 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, `/shares/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateShareOptions.Headers { + for headerName, headerValue := range createShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateShareOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateShareOptions.IfMatch)) - } + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) + _, err = builder.SetBodyContentJSON(createShareMountTargetOptions.ShareMountTargetPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -17092,12 +16875,12 @@ func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_share", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_share_mount_target", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17108,61 +16891,61 @@ func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions return } -// ListShareAccessorBindings : List accessor bindings for a share -// This request lists accessor bindings for a share. Each accessor binding identifies a resource (possibly in another -// account) with access to this file share's data. +// DeleteShare : Delete a file share +// This request deletes a share. This operation cannot be reversed. A share cannot be deleted if it: +// - has share mount targets +// - has a `lifecycle_state` of `updating` +// - has a replication operation in progress // -// The share accessor bindings will be sorted by their `created_at` property values, with newest bindings first. -func (vpc *VpcV1) ListShareAccessorBindings(listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) (result *ShareAccessorBindingCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListShareAccessorBindingsWithContext(context.Background(), listShareAccessorBindingsOptions) +// If the request is accepted, the share `lifecycle_state` will be set to `deleting`. Once deletion processing +// completes, it will no longer be retrievable. +func (vpc *VpcV1) DeleteShare(deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteShareWithContext(context.Background(), deleteShareOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListShareAccessorBindingsWithContext is an alternate form of the ListShareAccessorBindings method which supports a Context parameter -func (vpc *VpcV1) ListShareAccessorBindingsWithContext(ctx context.Context, listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) (result *ShareAccessorBindingCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions cannot be nil") +// DeleteShareWithContext is an alternate form of the DeleteShare method which supports a Context parameter +func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions *DeleteShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareOptions, "deleteShareOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions") + err = core.ValidateStruct(deleteShareOptions, "deleteShareOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *listShareAccessorBindingsOptions.ID, + "id": *deleteShareOptions.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, `/shares/{id}/accessor_bindings`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listShareAccessorBindingsOptions.Headers { + for headerName, headerValue := range deleteShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareAccessorBindings") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShare") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if deleteShareOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteShareOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listShareAccessorBindingsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareAccessorBindingsOptions.Start)) - } - if listShareAccessorBindingsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareAccessorBindingsOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -17173,12 +16956,12 @@ func (vpc *VpcV1) ListShareAccessorBindingsWithContext(ctx context.Context, list var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_share_accessor_bindings", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_share", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareAccessorBindingCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17189,7 +16972,7 @@ func (vpc *VpcV1) ListShareAccessorBindingsWithContext(ctx context.Context, list return } -// DeleteShareAccessorBinding : Delete a share accessor binding +// DeleteShareAccessorBinding : Delete a file share accessor binding // This request deletes a share accessor binding. This operation cannot be reversed. func (vpc *VpcV1) DeleteShareAccessorBinding(deleteShareAccessorBindingOptions *DeleteShareAccessorBindingOptions) (response *core.DetailedResponse, err error) { response, err = vpc.DeleteShareAccessorBindingWithContext(context.Background(), deleteShareAccessorBindingOptions) @@ -17252,46 +17035,49 @@ func (vpc *VpcV1) DeleteShareAccessorBindingWithContext(ctx context.Context, del return } -// GetShareAccessorBinding : Retrieve a share accessor binding -// This request retrieves a single accessor binding specified by the identifier in the URL. -func (vpc *VpcV1) GetShareAccessorBinding(getShareAccessorBindingOptions *GetShareAccessorBindingOptions) (result *ShareAccessorBinding, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareAccessorBindingWithContext(context.Background(), getShareAccessorBindingOptions) +// DeleteShareMountTarget : Delete a file share mount target +// This request deletes a share mount target. This operation cannot be reversed. +// +// If the request is accepted, the share mount target `lifecycle_state` will be set to +// `deleting`. Once deletion processing completes, it will no longer be retrievable. +func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetShareAccessorBindingWithContext is an alternate form of the GetShareAccessorBinding method which supports a Context parameter -func (vpc *VpcV1) GetShareAccessorBindingWithContext(ctx context.Context, getShareAccessorBindingOptions *GetShareAccessorBindingOptions) (result *ShareAccessorBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareAccessorBindingOptions, "getShareAccessorBindingOptions cannot be nil") +// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareAccessorBindingOptions, "getShareAccessorBindingOptions") + err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *getShareAccessorBindingOptions.ShareID, - "id": *getShareAccessorBindingOptions.ID, + "share_id": *deleteShareMountTargetOptions.ShareID, + "id": *deleteShareMountTargetOptions.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, `/shares/{share_id}/accessor_bindings/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareAccessorBindingOptions.Headers { + for headerName, headerValue := range deleteShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareAccessorBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17309,12 +17095,12 @@ func (vpc *VpcV1) GetShareAccessorBindingWithContext(ctx context.Context, getSha var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_share_accessor_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_share_mount_target", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareAccessorBinding) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17325,6 +17111,72 @@ func (vpc *VpcV1) GetShareAccessorBindingWithContext(ctx context.Context, getSha return } +// DeleteShareSource : Split the source file share from a replica file share +// This request removes the replication relationship between a source share and the replica share specified by the +// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a +// `lifecycle_state` of `updating`, or has a replication operation in progress. +// +// This operation cannot be reversed. +func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter +func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "share_id": *deleteShareSourceOptions.ShareID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deleteShareSourceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") + 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_share_source", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + // FailoverShare : Failover to replica file share // This request triggers a failover to the replica file share specified by the identifier in the URL. The failover // cannot be started if a source share or the replica share has a `lifecycle_state` of `updating`, or has a replication @@ -17406,48 +17258,45 @@ func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOpt return } -// ListShareMountTargets : List mount targets for a file share -// This request lists mount targets for a file share. A mount target is a network endpoint at which a file share may be -// mounted. The file share can be mounted by clients in the same VPC and zone after creating share mount targets. -// -// The share mount targets will be sorted by their `created_at` property values, with newest targets first. -func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) +// GetShare : Retrieve a file share +// This request retrieves a single file share specified by the identifier in the URL. +func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareWithContext(context.Background(), getShareOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter -func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") +// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter +func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") + err = core.ValidateStruct(getShareOptions, "getShareOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *listShareMountTargetsOptions.ShareID, + "id": *getShareOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listShareMountTargetsOptions.Headers { + for headerName, headerValue := range getShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17455,15 +17304,6 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listShareMountTargetsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) - } - if listShareMountTargetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) - } - if listShareMountTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -17474,12 +17314,12 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_share_mount_targets", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_share", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17490,63 +17330,54 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar return } -// CreateShareMountTarget : Create a mount target for a file share -// This request creates a new share mount target from a share mount target prototype object. -// -// The prototype object is structured in the same way as a retrieved share mount target, and contains the information -// necessary to provision the new file share mount target. -func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) +// GetShareAccessorBinding : Retrieve a file share accessor binding +// This request retrieves a single accessor binding specified by the identifier in the URL. +func (vpc *VpcV1) GetShareAccessorBinding(getShareAccessorBindingOptions *GetShareAccessorBindingOptions) (result *ShareAccessorBinding, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareAccessorBindingWithContext(context.Background(), getShareAccessorBindingOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") +// GetShareAccessorBindingWithContext is an alternate form of the GetShareAccessorBinding method which supports a Context parameter +func (vpc *VpcV1) GetShareAccessorBindingWithContext(ctx context.Context, getShareAccessorBindingOptions *GetShareAccessorBindingOptions) (result *ShareAccessorBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareAccessorBindingOptions, "getShareAccessorBindingOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") + err = core.ValidateStruct(getShareAccessorBindingOptions, "getShareAccessorBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *createShareMountTargetOptions.ShareID, + "share_id": *getShareAccessorBindingOptions.ShareID, + "id": *getShareAccessorBindingOptions.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, `/shares/{share_id}/mount_targets`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/accessor_bindings/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createShareMountTargetOptions.Headers { + for headerName, headerValue := range getShareAccessorBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareAccessorBinding") 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(createShareMountTargetOptions.ShareMountTargetPrototype) - 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()) @@ -17556,12 +17387,12 @@ func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createS var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_share_mount_target", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_share_accessor_binding", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareAccessorBinding) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17572,36 +17403,33 @@ func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createS return } -// DeleteShareMountTarget : Delete a share mount target -// This request deletes a share mount target. This operation cannot be reversed. -// -// If the request is accepted, the share mount target `lifecycle_state` will be set to -// `deleting`. Once deletion processing completes, it will no longer be retrievable. -func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) +// GetShareMountTarget : Retrieve a file share mount target +// This request retrieves a single share mount target specified by the identifier in the URL. +func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") +// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") + err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *deleteShareMountTargetOptions.ShareID, - "id": *deleteShareMountTargetOptions.ID, + "share_id": *getShareMountTargetOptions.ShareID, + "id": *getShareMountTargetOptions.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, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) @@ -17610,11 +17438,11 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS return } - for headerName, headerValue := range deleteShareMountTargetOptions.Headers { + for headerName, headerValue := range getShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17632,7 +17460,7 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_share_mount_target", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_share_mount_target", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -17648,46 +17476,45 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS return } -// GetShareMountTarget : Retrieve a share mount target -// This request retrieves a single share mount target specified by the identifier in the URL. -func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) +// GetShareProfile : Retrieve a file share profile +// This request retrieves a single file share profile specified by the name in the URL. +func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") +// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter +func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") + err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *getShareMountTargetOptions.ShareID, - "id": *getShareMountTargetOptions.ID, + "name": *getShareProfileOptions.Name, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareMountTargetOptions.Headers { + for headerName, headerValue := range getShareProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17705,12 +17532,12 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_share_mount_target", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_share_profile", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17721,63 +17548,54 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo return } -// UpdateShareMountTarget : Update a share mount target -// This request updates a share mount target with the information provided in a share mount target patch object. The -// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain -// only the information to be updated. -func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) +// GetShareSource : Retrieve the source file share for a replica file share +// This request retrieves the source file share associated with the replica file share specified by the identifier in +// the URL. +func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") +// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter +func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") + err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *updateShareMountTargetOptions.ShareID, - "id": *updateShareMountTargetOptions.ID, + "share_id": *getShareSourceOptions.ShareID, } - 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, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateShareMountTargetOptions.Headers { + for headerName, headerValue := range getShareSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") 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(updateShareMountTargetOptions.ShareMountTargetPatch) - 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()) @@ -17787,12 +17605,12 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_share_mount_target", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_share_source", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17803,55 +17621,61 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS return } -// DeleteShareSource : Split the source file share from a replica share -// This request removes the replication relationship between a source share and the replica share specified by the -// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a -// `lifecycle_state` of `updating`, or has a replication operation in progress. +// ListShareAccessorBindings : List accessor bindings for a file share +// This request lists accessor bindings for a share. Each accessor binding identifies a resource (possibly in another +// account) with access to this file share's data. // -// This operation cannot be reversed. -func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) +// The share accessor bindings will be sorted by their `created_at` property values, with newest bindings first. +func (vpc *VpcV1) ListShareAccessorBindings(listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) (result *ShareAccessorBindingCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListShareAccessorBindingsWithContext(context.Background(), listShareAccessorBindingsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter -func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") +// ListShareAccessorBindingsWithContext is an alternate form of the ListShareAccessorBindings method which supports a Context parameter +func (vpc *VpcV1) ListShareAccessorBindingsWithContext(ctx context.Context, listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) (result *ShareAccessorBindingCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") + err = core.ValidateStruct(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *deleteShareSourceOptions.ShareID, + "id": *listShareAccessorBindingsOptions.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, `/shares/{share_id}/source`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}/accessor_bindings`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteShareSourceOptions.Headers { + for headerName, headerValue := range listShareAccessorBindingsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareAccessorBindings") 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 listShareAccessorBindingsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareAccessorBindingsOptions.Start)) + } + if listShareAccessorBindingsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareAccessorBindingsOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -17859,56 +17683,67 @@ func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareS 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_share_source", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_share_accessor_bindings", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareAccessorBindingCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetShareSource : Retrieve the source file share for a replica file share -// This request retrieves the source file share associated with the replica file share specified by the identifier in -// the URL. -func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) +// ListShareMountTargets : List mount targets for a file share +// This request lists mount targets for a file share. A mount target is a network endpoint at which a file share may be +// mounted. The file share can be mounted by clients in the same VPC and zone after creating share mount targets. +// +// The share mount targets will be sorted by their `created_at` property values, with newest targets first. +func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter -func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") +// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter +func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") + err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *getShareSourceOptions.ShareID, + "share_id": *listShareMountTargetsOptions.ShareID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareSourceOptions.Headers { + for headerName, headerValue := range listShareMountTargetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17916,6 +17751,15 @@ func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceO builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listShareMountTargetsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) + } + if listShareMountTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) + } + if listShareMountTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -17926,12 +17770,12 @@ func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_share_source", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_share_mount_targets", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17942,18 +17786,18 @@ func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceO return } -// ListBackupPolicies : List backup policies -// This request lists backup policies in the region. Backup policies control which sources are selected for backup and -// include a set of backup policy plans that provide the backup schedules and deletion triggers. -func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) +// ListShareProfiles : List file share profiles +// This request lists [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) available in +// the region. A file share profile specifies the performance characteristics and pricing model for a file share. +func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter -func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") +// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter +func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -17962,17 +17806,17 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBackupPoliciesOptions.Headers { + for headerName, headerValue := range listShareProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17980,20 +17824,14 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listBackupPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) - } - if listBackupPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) - } - if listBackupPoliciesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) + if listShareProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) } - if listBackupPoliciesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) + if listShareProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) } - if listBackupPoliciesOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) + if listShareProfilesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) } request, err := builder.Build() @@ -18005,12 +17843,12 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_backup_policies", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_share_profiles", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18021,55 +17859,60 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP return } -// CreateBackupPolicy : Create a backup policy -// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in -// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. -func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) +// ListShares : List file shares +// This request lists file shares in the region. +func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSharesWithContext(context.Background(), listSharesOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") +// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter +func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSharesOptions, "listSharesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/backup_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBackupPolicyOptions.Headers { + for headerName, headerValue := range listSharesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") 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(createBackupPolicyOptions.BackupPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listSharesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) + } + if listSharesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) + } + if listSharesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) + } + if listSharesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) + } + if listSharesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) + } + if listSharesOptions.ReplicationRole != nil { + builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) } request, err := builder.Build() @@ -18081,12 +17924,12 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_backup_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_shares", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18097,76 +17940,62 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku return } -// ListBackupPolicyJobs : List jobs for a backup policy -// This request retrieves jobs for a backup policy. A backup job represents the execution of a backup policy plan for a -// resource matching the policy's criteria. -func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) +// UpdateShare : Update a file share +// This request updates a share with the information in a provided share patch. The share patch object is structured in +// the same way as a retrieved share and contains only the information to be updated. +func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateShareWithContext(context.Background(), updateShareOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter -func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") +// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter +func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") + err = core.ValidateStruct(updateShareOptions, "updateShareOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, + "id": *updateShareOptions.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, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { + for headerName, headerValue := range updateShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateShareOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateShareOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listBackupPolicyJobsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) - } - if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) - } - if listBackupPolicyJobsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) - } - if listBackupPolicyJobsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) - } - if listBackupPolicyJobsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) - } - if listBackupPolicyJobsOptions.SourceID != nil { - builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) - } - if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { - builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) - } - if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { - builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) + + _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -18178,12 +18007,12 @@ func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBacku var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_backup_policy_jobs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_share", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18194,54 +18023,63 @@ func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBacku return } -// GetBackupPolicyJob : Retrieve a backup policy job -// This request retrieves a single backup policy job specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) +// UpdateShareMountTarget : Update a file share mount target +// This request updates a share mount target with the information provided in a share mount target patch object. The +// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") +// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") + err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, - "id": *getBackupPolicyJobOptions.ID, + "share_id": *updateShareMountTargetOptions.ShareID, + "id": *updateShareMountTargetOptions.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, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBackupPolicyJobOptions.Headers { + for headerName, headerValue := range updateShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") 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(updateShareMountTargetOptions.ShareMountTargetPatch) + 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()) @@ -18251,12 +18089,12 @@ func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPo var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_backup_policy_job", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_share_mount_target", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18267,54 +18105,55 @@ func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPo return } -// ListBackupPolicyPlans : List plans for a backup policy -// This request retrieves plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. -func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) +// CreateBackupPolicy : Create a backup policy +// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in +// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. +func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter -func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") +// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") + err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, - } - - 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, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { + for headerName, headerValue := range createBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") 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)) - if listBackupPolicyPlansOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) + + _, err = builder.SetBodyContentJSON(createBackupPolicyOptions.BackupPolicyPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -18326,12 +18165,12 @@ func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBack var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_backup_policy_plans", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_backup_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18453,57 +18292,54 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB return } -// DeleteBackupPolicyPlan : Delete a backup policy plan -// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by -// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with -// the plan will run to completion before the plan is deleted. +// DeleteBackupPolicy : Delete a backup policy +// This request deletes a backup policy. This operation cannot be reversed. // -// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing -// completes, the backup policy plan will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) +// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, +// the backup policy will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") +// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") + err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, - "id": *deleteBackupPolicyPlanOptions.ID, + "id": *deleteBackupPolicyOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range deleteBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) + if deleteBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) @@ -18518,12 +18354,12 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_backup_policy_plan", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_backup_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18534,33 +18370,38 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB return } -// GetBackupPolicyPlan : Retrieve a backup policy plan -// This request retrieves a single backup policy plan specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) +// DeleteBackupPolicyPlan : Delete a backup policy plan +// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by +// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with +// the plan will run to completion before the plan is deleted. +// +// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing +// completes, the backup policy plan will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") +// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") + err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, - "id": *getBackupPolicyPlanOptions.ID, + "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, + "id": *deleteBackupPolicyPlanOptions.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, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) @@ -18569,15 +18410,18 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP return } - for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if deleteBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -18591,7 +18435,7 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_backup_policy_plan", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_backup_policy_plan", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -18607,65 +18451,199 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP return } -// UpdateBackupPolicyPlan : Update a backup policy plan -// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is -// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) +// GetBackupPolicy : Retrieve a backup policy +// This request retrieves a single backup policy specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") +// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") + err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, - "id": *updateBackupPolicyPlanOptions.ID, + "id": *getBackupPolicyOptions.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, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range getBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) + + 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_backup_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// GetBackupPolicyJob : Retrieve a backup policy job +// This request retrieves a single backup policy job specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, + "id": *getBackupPolicyJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getBackupPolicyJobOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") + 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)) - _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) + request, err := builder.Build() if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + 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_backup_policy_job", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// GetBackupPolicyPlan : Retrieve a backup policy plan +// This request retrieves a single backup policy plan specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, + "id": *getBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") + 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()) @@ -18675,7 +18653,7 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_backup_policy_plan", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_backup_policy_plan", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -18691,58 +18669,156 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB return } -// DeleteBackupPolicy : Delete a backup policy -// This request deletes a backup policy. This operation cannot be reversed. -// -// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, -// the backup policy will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) +// ListBackupPolicies : List backup policies +// This request lists backup policies in the region. Backup policies control which sources are selected for backup and +// include a set of backup policy plans that provide the backup schedules and deletion triggers. +func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") +// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter +func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") + 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, `/backup_policies`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listBackupPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") + 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 listBackupPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) + } + if listBackupPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) + } + if listBackupPoliciesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) + } + if listBackupPoliciesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) + } + if listBackupPoliciesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) + } + + 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_backup_policies", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// ListBackupPolicyJobs : List jobs for a backup policy +// This request retrieves jobs for a backup policy. A backup job represents the execution of a backup policy plan for a +// resource matching the policy's criteria. +func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") + err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteBackupPolicyOptions.ID, + "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, } - 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, `/backup_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBackupPolicyOptions.Headers { + for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listBackupPolicyJobsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) + } + if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) + } + if listBackupPolicyJobsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) + } + if listBackupPolicyJobsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) + } + if listBackupPolicyJobsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) + } + if listBackupPolicyJobsOptions.SourceID != nil { + builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { + builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { + builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) + } request, err := builder.Build() if err != nil { @@ -18753,12 +18829,12 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_backup_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_backup_policy_jobs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18769,45 +18845,45 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku return } -// GetBackupPolicy : Retrieve a backup policy -// This request retrieves a single backup policy specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) +// ListBackupPolicyPlans : List plans for a backup policy +// This request retrieves plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. +func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") +// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") + err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getBackupPolicyOptions.ID, + "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBackupPolicyOptions.Headers { + for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -18815,6 +18891,9 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listBackupPolicyPlansOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) + } request, err := builder.Build() if err != nil { @@ -18825,12 +18904,12 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_backup_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_backup_policy_plans", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18924,48 +19003,65 @@ func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBacku return } -// ListRegions : List regions -// This request lists regions. Each region is a separate geographic area that contains multiple isolated zones. -// Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones -// in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation -// available. Resources deployed within a single region also benefit from the low latency afforded by geographic -// proximity. -func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) +// UpdateBackupPolicyPlan : Update a backup policy plan +// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is +// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter -func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") +// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, + "id": *updateBackupPolicyPlanOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listRegionsOptions.Headers { + for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) + 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()) @@ -18975,12 +19071,12 @@ func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_regions", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_backup_policy_plan", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19063,6 +19159,79 @@ func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *Ge return } +// GetRegionZone : Retrieve a zone +// This request retrieves a single zone specified by the region and zone names in the URL. +func (vpc *VpcV1) GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetRegionZoneWithContext is an alternate form of the GetRegionZone method which supports a Context parameter +func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getRegionZoneOptions, "getRegionZoneOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "region_name": *getRegionZoneOptions.RegionName, + "name": *getRegionZoneOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones/{name}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getRegionZoneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") + 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_region_zone", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + // ListRegionZones : List zones in a region // This request lists zones in a region. Zones represent logically-isolated data centers with high-bandwidth and // low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. @@ -19136,46 +19305,128 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone return } -// GetRegionZone : Retrieve a zone -// This request retrieves a single zone specified by the region and zone names in the URL. -func (vpc *VpcV1) GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) +// ListRegions : List regions +// This request lists regions. Each region is a separate geographic area that contains multiple isolated zones. +// Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones +// in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation +// available. Resources deployed within a single region also benefit from the low latency afforded by geographic +// proximity. +func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetRegionZoneWithContext is an alternate form of the GetRegionZone method which supports a Context parameter -func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getRegionZoneOptions, "getRegionZoneOptions cannot be nil") +// ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter +func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") + 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, `/regions`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listRegionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") + 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, "list_regions", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// AddNetworkInterfaceFloatingIP : Add an association between a floating IP and a virtual network interface +// This request adds an association between the specified floating IP and the specified virtual network interface. +// +// If the virtual network interface has `enable_infrastructure_nat` set to `true`, no more than one floating IP can be +// associated, and network address translation is performed between the floating IP address and the virtual network +// interface's `primary_ip` address. +// +// If the virtual network interface has `enable_infrastructure_nat` set to `false`, packets are passed unchanged to/from +// the virtual network interface. +// +// The floating IP must: +// - be in the same `zone` as the virtual network interface +// - not currently be associated with another resource +// +// The virtual network interface's `target` must not currently be a file share mount target. +// +// A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + result, response, err = vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions") + err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "region_name": *getRegionZoneOptions.RegionName, - "name": *getRegionZoneOptions.Name, + "virtual_network_interface_id": *addNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *addNetworkInterfaceFloatingIPOptions.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, `/regions/{region_name}/zones/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getRegionZoneOptions.Headers { + for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19193,12 +19444,12 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_region_zone", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19209,41 +19460,49 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt return } -// ListVirtualNetworkInterfaces : List virtual network interfaces -// This request lists virtual network interfaces in the region. A virtual network interface is a logical abstraction of -// a virtual network interface in a subnet, and may be attached to a target resource. +// AddVirtualNetworkInterfaceIP : Bind a reserved IP to a virtual network interface +// This request binds the specified reserved IP to the specified virtual network interface. // -// The virtual network interfaces will be sorted by their `created_at` property values, with newest virtual network -// interfaces first. Virtual network interfaces with identical -// `created_at` property values will in turn be sorted by ascending `name` property values. -func (vpc *VpcV1) ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) +// The reserved IP must currently be unbound and in the primary IP's subnet. The virtual network interface's `target` +// must not currently be a file share mount target. +func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + result, response, err = vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVirtualNetworkInterfacesWithContext is an alternate form of the ListVirtualNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVirtualNetworkInterfacesOptions, "listVirtualNetworkInterfacesOptions") +// AddVirtualNetworkInterfaceIPWithContext is an alternate form of the AddVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *addVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *addVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers { + for headerName, headerValue := range addVirtualNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19251,15 +19510,6 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVirtualNetworkInterfacesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) - } - if listVirtualNetworkInterfacesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Limit)) - } - if listVirtualNetworkInterfacesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVirtualNetworkInterfacesOptions.ResourceGroupID)) - } request, err := builder.Build() if err != nil { @@ -19270,12 +19520,12 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_virtual_network_interfaces", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_virtual_network_interface_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterfaceCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19398,14 +19648,14 @@ func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, // This request deletes a virtual network interface. This operation cannot be reversed. For this request to succeed, the // virtual network interface must not be required by another resource, such as the primary network attachment for an // instance. -func (vpc *VpcV1) DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) +func (vpc *VpcV1) DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) err = core.RepurposeSDKProblem(err, "") return } // DeleteVirtualNetworkInterfacesWithContext is an alternate form of the DeleteVirtualNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (response *core.DetailedResponse, err error) { +func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) @@ -19438,6 +19688,7 @@ func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, 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)) @@ -19448,55 +19699,66 @@ func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, 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_virtual_network_interfaces", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetVirtualNetworkInterface : Retrieve a virtual network interface -// This request retrieves a single virtual network interface specified by the identifier in the URL. -func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVirtualNetworkInterfaceWithContext(context.Background(), getVirtualNetworkInterfaceOptions) +// GetNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP if it is associated with the virtual network interface specified in +// the URL. +func (vpc *VpcV1) GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVirtualNetworkInterfaceWithContext is an alternate form of the GetVirtualNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions cannot be nil") +// GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions") + err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVirtualNetworkInterfaceOptions.ID, + "virtual_network_interface_id": *getNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *getNetworkInterfaceFloatingIPOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVirtualNetworkInterfaceOptions.Headers { + for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19514,12 +19776,12 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, get var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_virtual_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19530,34 +19792,32 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, get return } -// UpdateVirtualNetworkInterface : Update a virtual network interface -// This request updates a virtual network interface with the information in a provided virtual network interface patch. -// The virtual network interface patch object is structured in the same way as a retrieved virtual network interface and -// contains only the information to be updated. -func (vpc *VpcV1) UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) +// GetVirtualNetworkInterface : Retrieve a virtual network interface +// This request retrieves a single virtual network interface specified by the identifier in the URL. +func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVirtualNetworkInterfaceWithContext(context.Background(), getVirtualNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVirtualNetworkInterfaceWithContext is an alternate form of the UpdateVirtualNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions cannot be nil") +// GetVirtualNetworkInterfaceWithContext is an alternate form of the GetVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") + err = core.ValidateStruct(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVirtualNetworkInterfaceOptions.ID, + "id": *getVirtualNetworkInterfaceOptions.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, `/virtual_network_interfaces/{id}`, pathParamsMap) @@ -19566,26 +19826,19 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, return } - for headerName, headerValue := range updateVirtualNetworkInterfaceOptions.Headers { + for headerName, headerValue := range getVirtualNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVirtualNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterface") 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(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) - 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()) @@ -19595,7 +19848,7 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_virtual_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_virtual_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -19611,45 +19864,47 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, return } -// ListNetworkInterfaceFloatingIps : List floating IPs associated with a virtual network interface -// This request lists floating IPs associated with a virtual network interface. -func (vpc *VpcV1) ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) +// GetVirtualNetworkInterfaceIP : Retrieve bound reserved IP +// This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in +// the URL. +func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions cannot be nil") +// GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions") + err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *listNetworkInterfaceFloatingIpsOptions.VirtualNetworkInterfaceID, + "virtual_network_interface_id": *getVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *getVirtualNetworkInterfaceIPOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listNetworkInterfaceFloatingIpsOptions.Headers { + for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkInterfaceFloatingIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19657,15 +19912,6 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listNetworkInterfaceFloatingIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start)) - } - if listNetworkInterfaceFloatingIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Limit)) - } - if listNetworkInterfaceFloatingIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Sort)) - } request, err := builder.Build() if err != nil { @@ -19676,12 +19922,12 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_network_interface_floating_ips", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_virtual_network_interface_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19692,52 +19938,61 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context return } -// RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface -// This request disassociates the specified floating IP from the specified virtual network interface. -func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) +// ListNetworkInterfaceFloatingIps : List floating IPs associated with a virtual network interface +// This request lists floating IPs associated with a virtual network interface. +func (vpc *VpcV1) ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) err = core.RepurposeSDKProblem(err, "") return } -// RemoveNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions cannot be nil") +// ListNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *removeNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *removeNetworkInterfaceFloatingIPOptions.ID, + "virtual_network_interface_id": *listNetworkInterfaceFloatingIpsOptions.VirtualNetworkInterfaceID, } - 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, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listNetworkInterfaceFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkInterfaceFloatingIps") 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 listNetworkInterfaceFloatingIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start)) + } + if listNetworkInterfaceFloatingIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Limit)) + } + if listNetworkInterfaceFloatingIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Sort)) + } request, err := builder.Build() if err != nil { @@ -19745,57 +20000,64 @@ func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Contex 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_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_network_interface_floating_ips", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP if it is associated with the virtual network interface specified in -// the URL. -func (vpc *VpcV1) GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) +// ListVirtualNetworkInterfaceIps : List reserved IPs bound to a virtual network interface +// This request lists reserved IPs bound to a virtual network interface. +func (vpc *VpcV1) ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil") +// ListVirtualNetworkInterfaceIpsWithContext is an alternate form of the ListVirtualNetworkInterfaceIps method which supports a Context parameter +func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *getNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *getNetworkInterfaceFloatingIPOptions.ID, + "virtual_network_interface_id": *listVirtualNetworkInterfaceIpsOptions.VirtualNetworkInterfaceID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listVirtualNetworkInterfaceIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaceIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19803,6 +20065,15 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listVirtualNetworkInterfaceIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Start)) + } + if listVirtualNetworkInterfaceIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Limit)) + } + if listVirtualNetworkInterfaceIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Sort)) + } request, err := builder.Build() if err != nil { @@ -19813,12 +20084,12 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_virtual_network_interface_ips", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19829,61 +20100,41 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, return } -// AddNetworkInterfaceFloatingIP : Add an association between a floating IP and a virtual network interface -// This request adds an association between the specified floating IP and the specified virtual network interface. -// -// If the virtual network interface has `enable_infrastructure_nat` set to `true`, no more than one floating IP can be -// associated, and network address translation is performed between the floating IP address and the virtual network -// interface's `primary_ip` address. -// -// If the virtual network interface has `enable_infrastructure_nat` set to `false`, packets are passed unchanged to/from -// the virtual network interface. -// -// The floating IP must: -// - be in the same `zone` as the virtual network interface -// - not currently be associated with another resource -// -// The virtual network interface's `target` must not currently be a file share mount target. +// ListVirtualNetworkInterfaces : List virtual network interfaces +// This request lists virtual network interfaces in the region. A virtual network interface is a logical abstraction of +// a virtual network interface in a subnet, and may be attached to a target resource. // -// A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) +// The virtual network interfaces will be sorted by their `created_at` property values, with newest virtual network +// interfaces first. Virtual network interfaces with identical +// `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) err = core.RepurposeSDKProblem(err, "") return } -// AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") +// ListVirtualNetworkInterfacesWithContext is an alternate form of the ListVirtualNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVirtualNetworkInterfacesOptions, "listVirtualNetworkInterfacesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *addNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *addNetworkInterfaceFloatingIPOptions.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, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19891,6 +20142,15 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listVirtualNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) + } + if listVirtualNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Limit)) + } + if listVirtualNetworkInterfacesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVirtualNetworkInterfacesOptions.ResourceGroupID)) + } request, err := builder.Build() if err != nil { @@ -19901,12 +20161,12 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "add_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_virtual_network_interfaces", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterfaceCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19917,61 +20177,52 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, return } -// ListVirtualNetworkInterfaceIps : List reserved IPs bound to a virtual network interface -// This request lists reserved IPs bound to a virtual network interface. -func (vpc *VpcV1) ListVirtualNetworkInterfaceIps(listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVirtualNetworkInterfaceIpsWithContext(context.Background(), listVirtualNetworkInterfaceIpsOptions) +// RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface +// This request disassociates the specified floating IP from the specified virtual network interface. +func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVirtualNetworkInterfaceIpsWithContext is an alternate form of the ListVirtualNetworkInterfaceIps method which supports a Context parameter -func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, listVirtualNetworkInterfaceIpsOptions *ListVirtualNetworkInterfaceIpsOptions) (result *ReservedIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions cannot be nil") +// RemoveNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVirtualNetworkInterfaceIpsOptions, "listVirtualNetworkInterfaceIpsOptions") + err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *listVirtualNetworkInterfaceIpsOptions.VirtualNetworkInterfaceID, + "virtual_network_interface_id": *removeNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *removeNetworkInterfaceFloatingIPOptions.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, `/virtual_network_interfaces/{virtual_network_interface_id}/ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVirtualNetworkInterfaceIpsOptions.Headers { + for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaceIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") 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 listVirtualNetworkInterfaceIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Start)) - } - if listVirtualNetworkInterfaceIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Limit)) - } - if listVirtualNetworkInterfaceIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVirtualNetworkInterfaceIpsOptions.Sort)) - } request, err := builder.Build() if err != nil { @@ -19979,21 +20230,12 @@ func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, 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_virtual_network_interface_ips", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "remove_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionVirtualNetworkInterfaceContext) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } @@ -20064,55 +20306,62 @@ func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context return } -// GetVirtualNetworkInterfaceIP : Retrieve bound reserved IP -// This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in -// the URL. -func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) +// UpdateVirtualNetworkInterface : Update a virtual network interface +// This request updates a virtual network interface with the information in a provided virtual network interface patch. +// The virtual network interface patch object is structured in the same way as a retrieved virtual network interface and +// contains only the information to be updated. +func (vpc *VpcV1) UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil") +// UpdateVirtualNetworkInterfaceWithContext is an alternate form of the UpdateVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") + err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *getVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, - "id": *getVirtualNetworkInterfaceIPOptions.ID, + "id": *updateVirtualNetworkInterfaceOptions.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, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { + for headerName, headerValue := range updateVirtualNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVirtualNetworkInterface") 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(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) + 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()) @@ -20122,12 +20371,12 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, g var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_virtual_network_interface_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_virtual_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20138,208 +20387,58 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, g return } -// AddVirtualNetworkInterfaceIP : Bind a reserved IP to a virtual network interface -// This request binds the specified reserved IP to the specified virtual network interface. +// 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. // -// The reserved IP must currently be unbound and in the primary IP's subnet. The virtual network interface's `target` -// must not currently be a file share mount target. -func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) +// 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 } -// AddVirtualNetworkInterfaceIPWithContext is an alternate form of the AddVirtualNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions 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(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") + err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *addVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, - "id": *addVirtualNetworkInterfaceIPOptions.ID, - } - - 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, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + _, 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 addVirtualNetworkInterfaceIPOptions.Headers { + for headerName, headerValue := range createPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") 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)) - 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, "add_virtual_network_interface_ip", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - 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, `/public_gateways`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listPublicGatewaysOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") - 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 listPublicGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) - } - if listPublicGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) - } - if listPublicGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) - } - - 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_public_gateways", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions") - 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, `/public_gateways`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createPublicGatewayOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") - 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 + body := make(map[string]interface{}) + if createPublicGatewayOptions.VPC != nil { + body["vpc"] = createPublicGatewayOptions.VPC } if createPublicGatewayOptions.Zone != nil { body["zone"] = createPublicGatewayOptions.Zone @@ -20520,58 +20619,53 @@ 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) +// 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 } -// 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(updatePublicGatewayOptions, "updatePublicGatewayOptions") +// 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 } - pathParamsMap := map[string]string{ - "id": *updatePublicGatewayOptions.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, `/public_gateways/{id}`, pathParamsMap) + _, 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 updatePublicGatewayOptions.Headers { + for headerName, headerValue := range listPublicGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") 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(updatePublicGatewayOptions.PublicGatewayPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listPublicGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) + } + if listPublicGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) + } + if listPublicGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) } request, err := builder.Build() @@ -20583,12 +20677,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, "list_public_gateways", 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, UnmarshalPublicGatewayCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20599,67 +20693,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) +// 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 } -// 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") +// 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(updatePublicGatewayOptions, "updatePublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *updatePublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) 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, `/public_gateways/{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 updatePublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") 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 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)) + + _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -20671,12 +20756,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, "update_public_gateway", 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, UnmarshalPublicGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20897,6 +20982,94 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt 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) + 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") + 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, `/floating_ips`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") + 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 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 { + 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_floating_ips", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + 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) { @@ -20976,25 +21149,30 @@ 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) +// 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 } -// 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") +// 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(createNetworkACLOptions, "createNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/network_acls`, nil) @@ -21003,26 +21181,24 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl return } - for headerName, headerValue := range listNetworkAclsOptions.Headers { + for headerName, headerValue := range createNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") + 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)) - if listNetworkAclsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) - } - if listNetworkAclsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listNetworkAclsOptions.Limit)) - } - if listNetworkAclsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listNetworkAclsOptions.ResourceGroupID)) + + _, err = builder.SetBodyContentJSON(createNetworkACLOptions.NetworkACLPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -21034,12 +21210,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, "create_network_acl", 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, UnmarshalNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21050,43 +21226,46 @@ 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) +// 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 } -// 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") +// 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(createNetworkACLOptions, "createNetworkACLOptions") + err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, + } + 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, `/network_acls/{network_acl_id}/rules`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createNetworkACLOptions.Headers { + for headerName, headerValue := range createNetworkACLRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21096,7 +21275,7 @@ 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) + _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -21111,12 +21290,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_network_acl_rule", 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, UnmarshalNetworkACLRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21190,6 +21369,69 @@ func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetwork 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) + 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") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") + 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, + } + + 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) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") + 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_network_acl_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + 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) { @@ -21262,60 +21504,54 @@ 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) +// 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 } -// 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") +// 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(updateNetworkACLOptions, "updateNetworkACLOptions") + err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateNetworkACLOptions.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, `/network_acls/{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 updateNetworkACLOptions.Headers { + for headerName, headerValue := range getNetworkACLRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL") + 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(updateNetworkACLOptions.NetworkACLPatch) - 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()) @@ -21325,12 +21561,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, "get_network_acl_rule", 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, UnmarshalNetworkACLRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21423,59 +21659,53 @@ 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) +// 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 } -// 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(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") +// 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{ - "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, - } - - 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, `/network_acls/{network_acl_id}/rules`, 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 createNetworkACLRuleOptions.Headers { + for headerName, headerValue := range listNetworkAclsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") 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 + if listNetworkAclsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) + } + 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() @@ -21487,12 +21717,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, "list_network_acls", 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, UnmarshalNetworkACLCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21503,117 +21733,60 @@ 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) +// 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 } -// 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") +// 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(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") + err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions") 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": *updateNetworkACLOptions.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, `/network_acls/{network_acl_id}/rules/{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 deleteNetworkACLRuleOptions.Headers { + for headerName, headerValue := range updateNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") + 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)) - 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_network_acl_rule", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") - 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, - } - - 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.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) 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 getNetworkACLRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") - 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()) @@ -21623,12 +21796,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, "update_network_acl", 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, UnmarshalNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21720,26 +21893,31 @@ 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) +// 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 } -// 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") +// 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(createSecurityGroupOptions, "createSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/security_groups`, nil) @@ -21748,35 +21926,37 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit return } - for headerName, headerValue := range listSecurityGroupsOptions.Headers { + for headerName, headerValue := range createSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") 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)) - if listSecurityGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSecurityGroupsOptions.Start)) - } - if listSecurityGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupsOptions.Limit)) + + body := make(map[string]interface{}) + if createSecurityGroupOptions.VPC != nil { + body["vpc"] = createSecurityGroupOptions.VPC } - if listSecurityGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSecurityGroupsOptions.ResourceGroupID)) + if createSecurityGroupOptions.Name != nil { + body["name"] = createSecurityGroupOptions.Name } - if listSecurityGroupsOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listSecurityGroupsOptions.VPCID)) + if createSecurityGroupOptions.ResourceGroup != nil { + body["resource_group"] = createSecurityGroupOptions.ResourceGroup } - if listSecurityGroupsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listSecurityGroupsOptions.VPCCRN)) + if createSecurityGroupOptions.Rules != nil { + body["rules"] = createSecurityGroupOptions.Rules } - if listSecurityGroupsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listSecurityGroupsOptions.VPCName)) + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -21788,12 +21968,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, "create_security_group", 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, UnmarshalSecurityGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21804,44 +21984,50 @@ 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) +// 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 } -// 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") +// 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(createSecurityGroupOptions, "createSecurityGroupOptions") + 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, `/security_groups`, 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 createSecurityGroupOptions.Headers { + for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21851,20 +22037,7 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if createSecurityGroupOptions.VPC != nil { - body["vpc"] = createSecurityGroupOptions.VPC - } - if createSecurityGroupOptions.Name != nil { - body["name"] = createSecurityGroupOptions.Name - } - if createSecurityGroupOptions.ResourceGroup != nil { - body["resource_group"] = createSecurityGroupOptions.ResourceGroup - } - if createSecurityGroupOptions.Rules != nil { - body["rules"] = createSecurityGroupOptions.Rules - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -21879,12 +22052,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_security_group_rule", 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, UnmarshalSecurityGroupRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21895,49 +22068,60 @@ 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) +// 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 } -// 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") +// 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(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") + err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteSecurityGroupOptions.ID, + "security_group_id": *createSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *createSecurityGroupTargetBindingOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PUT) 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, `/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 deleteSecurityGroupOptions.Headers { + for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") 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)) @@ -21948,42 +22132,52 @@ func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecu 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", 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, UnmarshalSecurityGroupTargetReference) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(getSecurityGroupOptions, "getSecurityGroupOptions") + err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSecurityGroupOptions.ID, + "id": *deleteSecurityGroupOptions.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/{id}`, pathParamsMap) @@ -21992,15 +22186,14 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr return } - for headerName, headerValue := range getSecurityGroupOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") 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)) @@ -22011,150 +22204,134 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr 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", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_security_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(updateSecurityGroupOptions, "updateSecurityGroupOptions") + err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateSecurityGroupOptions.ID, + "security_group_id": *deleteSecurityGroupRuleOptions.SecurityGroupID, + "id": *deleteSecurityGroupRuleOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + 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, `/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 updateSecurityGroupOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") 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(updateSecurityGroupOptions.SecurityGroupPatch) - 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_security_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_security_group_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") + err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "security_group_id": *listSecurityGroupRulesOptions.SecurityGroupID, + "security_group_id": *deleteSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *deleteSecurityGroupTargetBindingOptions.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}/rules`, 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 listSecurityGroupRulesOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") 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)) @@ -22165,84 +22342,63 @@ func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSec 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_security_group_rules", 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, UnmarshalSecurityGroupRuleCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") + err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "security_group_id": *createSecurityGroupRuleOptions.SecurityGroupID, + "id": *getSecurityGroupOptions.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, `/security_groups/{security_group_id}/rules`, 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 createSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range getSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") 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(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) - 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()) @@ -22252,12 +22408,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, "get_security_group", 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, UnmarshalSecurityGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22268,34 +22424,33 @@ 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) +// 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 } -// 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") +// 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(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") + err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") 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, + "security_group_id": *getSecurityGroupRuleOptions.SecurityGroupID, + "id": *getSecurityGroupRuleOptions.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, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) @@ -22304,14 +22459,15 @@ func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, delete return } - for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") 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)) @@ -22322,56 +22478,66 @@ func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, delete 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_rule", 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, UnmarshalSecurityGroupRule) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") + err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") 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, + "security_group_id": *getSecurityGroupTargetOptions.SecurityGroupID, + "id": *getSecurityGroupTargetOptions.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, `/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 getSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22389,12 +22555,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_security_group_target", 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, UnmarshalSecurityGroupTargetReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22405,63 +22571,54 @@ 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 information is not applicable to 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) +// 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 } -// 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") +// 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(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") + err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") 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, + "security_group_id": *listSecurityGroupRulesOptions.SecurityGroupID, } - 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, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + _, 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 updateSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") 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(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) - 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()) @@ -22471,12 +22628,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, "list_security_group_rules", 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, UnmarshalSecurityGroupRuleCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22565,63 +22722,64 @@ 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) +// 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 } -// 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(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") +// 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 } - pathParamsMap := map[string]string{ - "security_group_id": *deleteSecurityGroupTargetBindingOptions.SecurityGroupID, - "id": *deleteSecurityGroupTargetBindingOptions.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, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + _, 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 deleteSecurityGroupTargetBindingOptions.Headers { + for headerName, headerValue := range listSecurityGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") 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 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 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() if err != nil { @@ -22629,65 +22787,81 @@ func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Contex 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, "list_security_groups", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) + 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) +// 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 } -// 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") +// 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(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") + err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") 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": *updateSecurityGroupOptions.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, `/security_groups/{security_group_id}/targets/{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 getSecurityGroupTargetOptions.Headers { + for headerName, headerValue := range updateSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") 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(updateSecurityGroupOptions.SecurityGroupPatch) + 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()) @@ -22697,12 +22871,12 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_security_group_target", 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, UnmarshalSecurityGroupTargetReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22713,64 +22887,63 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu 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) +// 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 information is not applicable to 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 } -// 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") +// 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(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") + err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") 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, + "security_group_id": *updateSecurityGroupRuleOptions.SecurityGroupID, + "id": *updateSecurityGroupRuleOptions.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, `/security_groups/{security_group_id}/targets/{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 createSecurityGroupTargetBindingOptions.Headers { + for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") 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(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) + 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()) @@ -22780,12 +22953,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, "update_security_group_rule", 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, UnmarshalSecurityGroupRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22796,49 +22969,55 @@ 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) +// AddVPNGatewayAdvertisedCIDR : Set an advertised CIDR on a VPN gateway +// This request adds the specified CIDR to the specified VPN gateway advertised CIDRs. 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 route mode VPN gateways. +func (vpc *VpcV1) AddVPNGatewayAdvertisedCIDR(addVPNGatewayAdvertisedCIDROptions *AddVPNGatewayAdvertisedCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.AddVPNGatewayAdvertisedCIDRWithContext(context.Background(), addVPNGatewayAdvertisedCIDROptions) 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") +// AddVPNGatewayAdvertisedCIDRWithContext is an alternate form of the AddVPNGatewayAdvertisedCIDR method which supports a Context parameter +func (vpc *VpcV1) AddVPNGatewayAdvertisedCIDRWithContext(ctx context.Context, addVPNGatewayAdvertisedCIDROptions *AddVPNGatewayAdvertisedCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVPNGatewayAdvertisedCIDROptions, "addVPNGatewayAdvertisedCIDROptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(addVPNGatewayAdvertisedCIDROptions, "addVPNGatewayAdvertisedCIDROptions") 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": *addVPNGatewayAdvertisedCIDROptions.VPNGatewayID, + "cidr": *addVPNGatewayAdvertisedCIDROptions.CIDR, + } + + builder := core.NewRequestBuilder(core.PUT) 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, `/vpn_gateways/{vpn_gateway_id}/advertised_cidrs/{cidr}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listIkePoliciesOptions.Headers { + for headerName, headerValue := range addVPNGatewayAdvertisedCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayAdvertisedCIDR") 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 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() if err != nil { @@ -22846,162 +23025,127 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie 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_ike_policies", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_vpn_gateway_advertised_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(createIkePolicyOptions, "createIkePolicyOptions") + err = core.ValidateStruct(addVPNGatewayConnectionsLocalCIDROptions, "addVPNGatewayConnectionsLocalCIDROptions") 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": *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, `/ike_policies`, 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 createIkePolicyOptions.Headers { + for headerName, headerValue := range addVPNGatewayConnectionsLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsLocalCIDR") 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()) 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_ike_policy", 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, UnmarshalIkePolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(deleteIkePolicyOptions, "deleteIkePolicyOptions") + err = core.ValidateStruct(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteIkePolicyOptions.ID, + "vpn_gateway_id": *addVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionsPeerCIDROptions.ID, + "cidr": *addVPNGatewayConnectionsPeerCIDROptions.CIDR, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PUT) 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, `/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 deleteIkePolicyOptions.Headers { + for headerName, headerValue := range addVPNGatewayConnectionsPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsPeerCIDR") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -23017,7 +23161,7 @@ func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolic response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_ike_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -23025,49 +23169,51 @@ func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolic 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) +// CheckVPNGatewayAdvertisedCIDR : Check if the specified advertised CIDR exists on a VPN gateway +// This request succeeds if an advertised CIDR exists on the specified VPN gateway, and fails otherwise. +// +// This request is only supported for route mode VPN gateways. +func (vpc *VpcV1) CheckVPNGatewayAdvertisedCIDR(checkVPNGatewayAdvertisedCIDROptions *CheckVPNGatewayAdvertisedCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.CheckVPNGatewayAdvertisedCIDRWithContext(context.Background(), checkVPNGatewayAdvertisedCIDROptions) 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") +// CheckVPNGatewayAdvertisedCIDRWithContext is an alternate form of the CheckVPNGatewayAdvertisedCIDR method which supports a Context parameter +func (vpc *VpcV1) CheckVPNGatewayAdvertisedCIDRWithContext(ctx context.Context, checkVPNGatewayAdvertisedCIDROptions *CheckVPNGatewayAdvertisedCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(checkVPNGatewayAdvertisedCIDROptions, "checkVPNGatewayAdvertisedCIDROptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") + err = core.ValidateStruct(checkVPNGatewayAdvertisedCIDROptions, "checkVPNGatewayAdvertisedCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getIkePolicyOptions.ID, + "vpn_gateway_id": *checkVPNGatewayAdvertisedCIDROptions.VPNGatewayID, + "cidr": *checkVPNGatewayAdvertisedCIDROptions.CIDR, } 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, `/vpn_gateways/{vpn_gateway_id}/advertised_cidrs/{cidr}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getIkePolicyOptions.Headers { + for headerName, headerValue := range checkVPNGatewayAdvertisedCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayAdvertisedCIDR") 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)) @@ -23078,156 +23224,131 @@ 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, "check_vpn_gateway_advertised_cidr", 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) +// 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 } -// 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") +// 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(updateIkePolicyOptions, "updateIkePolicyOptions") + err = core.ValidateStruct(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateIkePolicyOptions.ID, + "vpn_gateway_id": *checkVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID, + "id": *checkVPNGatewayConnectionsLocalCIDROptions.ID, + "cidr": *checkVPNGatewayConnectionsLocalCIDROptions.CIDR, } - 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, `/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 updateIkePolicyOptions.Headers { + for headerName, headerValue := range checkVPNGatewayConnectionsLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsLocalCIDR") 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 } - 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_ike_policy", 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, UnmarshalIkePolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") + err = core.ValidateStruct(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *listIkePolicyConnectionsOptions.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, `/ike_policies/{id}/connections`, 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 listIkePolicyConnectionsOptions.Headers { + for headerName, headerValue := range checkVPNGatewayConnectionsPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") + 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)) - 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 { @@ -23235,67 +23356,86 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI 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_ike_policy_connections", 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, UnmarshalIkePolicyConnectionCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(createIkePolicyOptions, "createIkePolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/ipsec_policies`, nil) + _, 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 listIpsecPoliciesOptions.Headers { + for headerName, headerValue := range createIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies") + 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)) - if listIpsecPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listIpsecPoliciesOptions.Start)) + + body := make(map[string]interface{}) + if createIkePolicyOptions.AuthenticationAlgorithm != nil { + body["authentication_algorithm"] = createIkePolicyOptions.AuthenticationAlgorithm } - if listIpsecPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listIpsecPoliciesOptions.Limit)) + 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() @@ -23307,12 +23447,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, "create_ike_policy", 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, UnmarshalIkePolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23417,116 +23557,56 @@ 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) +// 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 } -// 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") +// 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(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") + err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *deleteIpsecPolicyOptions.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, `/ipsec_policies/{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 deleteIpsecPolicyOptions.Headers { + for headerName, headerValue := range createVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") + 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/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_ipsec_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - 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, `/ipsec_policies/{id}`, pathParamsMap) + _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) 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 getIpsecPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") - 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()) @@ -23536,12 +23616,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, "create_vpn_gateway", 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, UnmarshalVPNGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23552,55 +23632,55 @@ 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) +// 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 } -// 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") +// 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(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") + err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateIpsecPolicyOptions.ID, + "vpn_gateway_id": *createVPNGatewayConnectionOptions.VPNGatewayID, } - 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, `/ipsec_policies/{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 updateIpsecPolicyOptions.Headers { + for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIpsecPolicy") + 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/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(updateIpsecPolicyOptions.IPsecPolicyPatch) + _, err = builder.SetBodyContentJSON(createVPNGatewayConnectionOptions.VPNGatewayConnectionPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -23615,12 +23695,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, "create_vpn_gateway_connection", 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, UnmarshalVPNGatewayConnection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23631,45 +23711,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) +// CreateVPNRouteReport : Generate a VPN route report +// Request route report generation. While report generation is in progress, additional requests to generate a report are +// ignored and return the current pending report. +func (vpc *VpcV1) CreateVPNRouteReport(createVPNRouteReportOptions *CreateVPNRouteReportOptions) (result *VPNRouteReport, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPNRouteReportWithContext(context.Background(), createVPNRouteReportOptions) 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") +// CreateVPNRouteReportWithContext is an alternate form of the CreateVPNRouteReport method which supports a Context parameter +func (vpc *VpcV1) CreateVPNRouteReportWithContext(ctx context.Context, createVPNRouteReportOptions *CreateVPNRouteReportOptions) (result *VPNRouteReport, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNRouteReportOptions, "createVPNRouteReportOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") + err = core.ValidateStruct(createVPNRouteReportOptions, "createVPNRouteReportOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *listIpsecPolicyConnectionsOptions.ID, + "vpn_gateway_id": *createVPNRouteReportOptions.VPNGatewayID, } - 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, `/ipsec_policies/{id}/connections`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/route_reports`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { + for headerName, headerValue := range createVPNRouteReportOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNRouteReport") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -23677,12 +23758,6 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis 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 { @@ -23693,12 +23768,12 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_ipsec_policy_connections", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpn_route_report", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyConnectionCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNRouteReport) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23709,58 +23784,52 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis 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) +// 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 } -// 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") +// 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(deleteIkePolicyOptions, "deleteIkePolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "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`, nil) + _, 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 listVPNGatewaysOptions.Headers { + for headerName, headerValue := range deleteIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") 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 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 { @@ -23768,96 +23837,75 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway 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_gateways", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_ike_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(createVPNGatewayOptions, "createVPNGatewayOptions") + err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *deleteIpsecPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) 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, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPNGatewayOptions.Headers { + for headerName, headerValue := range deleteIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") 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(createVPNGatewayOptions.VPNGatewayPrototype) - 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", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_ipsec_policy", 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 } @@ -23926,49 +23974,53 @@ 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) +// 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 } -// 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") +// 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(getVPNGatewayOptions, "getVPNGatewayOptions") + err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPNGatewayOptions.ID, + "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_gateways/{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 getVPNGatewayOptions.Headers { + for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") + if deleteVPNGatewayConnectionOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPNGatewayConnectionOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -23979,143 +24031,118 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt 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_vpn_gateway", 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, UnmarshalVPNGateway) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// DeleteVPNRouteReport : Delete a VPN route report +// This request deletes a VPN route report. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPNRouteReport(deleteVPNRouteReportOptions *DeleteVPNRouteReportOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPNRouteReportWithContext(context.Background(), deleteVPNRouteReportOptions) 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") +// DeleteVPNRouteReportWithContext is an alternate form of the DeleteVPNRouteReport method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNRouteReportWithContext(ctx context.Context, deleteVPNRouteReportOptions *DeleteVPNRouteReportOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNRouteReportOptions, "deleteVPNRouteReportOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") + err = core.ValidateStruct(deleteVPNRouteReportOptions, "deleteVPNRouteReportOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVPNGatewayOptions.ID, + "vpn_gateway_id": *deleteVPNRouteReportOptions.VPNGatewayID, + "id": *deleteVPNRouteReportOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + 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, `/vpn_gateways/{vpn_gateway_id}/route_reports/{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 deleteVPNRouteReportOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNRouteReport") 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 } - 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_vpn_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpn_route_report", 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 } -// 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) +// 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 } -// 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") +// 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(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") + 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": *listVPNGatewayConnectionsOptions.VPNGatewayID, + "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`, 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 listVPNGatewayConnectionsOptions.Headers { + for headerName, headerValue := range getIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24123,15 +24150,6 @@ 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 listVPNGatewayConnectionsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) - } request, err := builder.Build() if err != nil { @@ -24142,12 +24160,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, "get_ike_policy", 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, UnmarshalIkePolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24158,60 +24176,53 @@ 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) +// 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 } -// 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") +// 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(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") + err = core.ValidateStruct(getIpsecPolicyOptions, "getIpsecPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *createVPNGatewayConnectionOptions.VPNGatewayID, + "id": *getIpsecPolicyOptions.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_gateways/{vpn_gateway_id}/connections`, 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 createVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range getIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") 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()) @@ -24221,12 +24232,12 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpn_gateway_connection", 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, UnmarshalVPNGatewayConnection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24237,50 +24248,49 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre 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) +// 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 } -// 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") +// 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(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") + err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") 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, + "id": *getVPNGatewayOptions.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, `/vpn_gateways/{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 getVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") 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)) @@ -24291,12 +24301,21 @@ 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_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 } @@ -24374,61 +24393,54 @@ 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) +// GetVPNRouteReport : Retrieve a VPN route report +// Retrieve a route report. +func (vpc *VpcV1) GetVPNRouteReport(getVPNRouteReportOptions *GetVPNRouteReportOptions) (result *VPNRouteReport, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPNRouteReportWithContext(context.Background(), getVPNRouteReportOptions) 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") +// GetVPNRouteReportWithContext is an alternate form of the GetVPNRouteReport method which supports a Context parameter +func (vpc *VpcV1) GetVPNRouteReportWithContext(ctx context.Context, getVPNRouteReportOptions *GetVPNRouteReportOptions) (result *VPNRouteReport, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNRouteReportOptions, "getVPNRouteReportOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") + err = core.ValidateStruct(getVPNRouteReportOptions, "getVPNRouteReportOptions") 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, + "vpn_gateway_id": *getVPNRouteReportOptions.VPNGatewayID, + "id": *getVPNRouteReportOptions.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, `/vpn_gateways/{vpn_gateway_id}/route_reports/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range getVPNRouteReportOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNRouteReport") 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 - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -24438,12 +24450,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, "get_vpn_route_report", 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, UnmarshalVPNRouteReport) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24454,48 +24466,36 @@ 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) +// 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 } -// 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(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions") +// 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": *listVPNGatewayConnectionsLocalCIDRsOptions.VPNGatewayID, - "id": *listVPNGatewayConnectionsLocalCIDRsOptions.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`, 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 listIkePoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsLocalCIDRs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24503,6 +24503,12 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRsWithContext(ctx context.Con 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)) + } request, err := builder.Build() if err != nil { @@ -24513,12 +24519,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, "list_ike_policies", 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, UnmarshalIkePolicyCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24529,55 +24535,58 @@ 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) +// 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 } -// 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") +// 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(removeVPNGatewayConnectionsLocalCIDROptions, "removeVPNGatewayConnectionsLocalCIDROptions") + 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": *removeVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID, - "id": *removeVPNGatewayConnectionsLocalCIDROptions.ID, - "cidr": *removeVPNGatewayConnectionsLocalCIDROptions.CIDR, + "id": *listIkePolicyConnectionsOptions.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}/local/cidrs/{cidr}`, 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 removeVPNGatewayConnectionsLocalCIDROptions.Headers { + for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsLocalCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") 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 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 { @@ -24585,65 +24594,68 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionsLocalCIDRWithContext(ctx context.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, "remove_vpn_gateway_connections_local_cidr", 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, UnmarshalIkePolicyConnectionCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions") +// 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": *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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/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 checkVPNGatewayConnectionsLocalCIDROptions.Headers { + for headerName, headerValue := range listIpsecPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsLocalCIDR") + 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 { @@ -24651,125 +24663,144 @@ 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, "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 } -// 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) +// 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 } -// 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") +// 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(addVPNGatewayConnectionsLocalCIDROptions, "addVPNGatewayConnectionsLocalCIDROptions") + err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") 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": *listIpsecPolicyConnectionsOptions.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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}`, 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 addVPNGatewayConnectionsLocalCIDROptions.Headers { + for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsLocalCIDR") + 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 } - 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, "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 } -// ListVPNGatewayConnectionsPeerCIDRs : List peer CIDRs for a VPN gateway connection -// This request lists peer CIDRs for a VPN gateway connection. +// ListVPNGatewayAdvertisedCIDRs : List advertised CIDRs for a VPN gateway +// This request lists advertised CIDRs for a VPN gateway. // -// 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) +// This request is only supported for route mode VPN gateways. +func (vpc *VpcV1) ListVPNGatewayAdvertisedCIDRs(listVPNGatewayAdvertisedCIDRsOptions *ListVPNGatewayAdvertisedCIDRsOptions) (result *VPNGatewayAdvertisedCIDRCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPNGatewayAdvertisedCIDRsWithContext(context.Background(), listVPNGatewayAdvertisedCIDRsOptions) 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") +// ListVPNGatewayAdvertisedCIDRsWithContext is an alternate form of the ListVPNGatewayAdvertisedCIDRs method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayAdvertisedCIDRsWithContext(ctx context.Context, listVPNGatewayAdvertisedCIDRsOptions *ListVPNGatewayAdvertisedCIDRsOptions) (result *VPNGatewayAdvertisedCIDRCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayAdvertisedCIDRsOptions, "listVPNGatewayAdvertisedCIDRsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions") + err = core.ValidateStruct(listVPNGatewayAdvertisedCIDRsOptions, "listVPNGatewayAdvertisedCIDRsOptions") 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, + "vpn_gateway_id": *listVPNGatewayAdvertisedCIDRsOptions.VPNGatewayID, } 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, `/vpn_gateways/{vpn_gateway_id}/advertised_cidrs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPNGatewayConnectionsPeerCIDRsOptions.Headers { + for headerName, headerValue := range listVPNGatewayAdvertisedCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsPeerCIDRs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayAdvertisedCIDRs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24787,12 +24818,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_vpn_gateway_advertised_cidrs", 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, UnmarshalVPNGatewayAdvertisedCIDRCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24803,55 +24834,61 @@ 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) +// 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 } -// 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") +// 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(removeVPNGatewayConnectionsPeerCIDROptions, "removeVPNGatewayConnectionsPeerCIDROptions") + err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") 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, + "vpn_gateway_id": *listVPNGatewayConnectionsOptions.VPNGatewayID, } - 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, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range removeVPNGatewayConnectionsPeerCIDROptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsPeerCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") 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 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 { @@ -24859,62 +24896,71 @@ 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_vpn_gateway_connections", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + 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. +// 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) CheckVPNGatewayConnectionsPeerCIDR(checkVPNGatewayConnectionsPeerCIDROptions *CheckVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.CheckVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionsPeerCIDROptions) +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 } -// 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") +// 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(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions") + err = core.ValidateStruct(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions") 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, + "vpn_gateway_id": *listVPNGatewayConnectionsLocalCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionsLocalCIDRsOptions.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/{cidr}`, 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 checkVPNGatewayConnectionsPeerCIDROptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionsLocalCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsPeerCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsLocalCIDRs") 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)) @@ -24925,63 +24971,71 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Cont 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, "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, UnmarshalVPNGatewayConnectionCIDRs) + 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. +// 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) AddVPNGatewayConnectionsPeerCIDR(addVPNGatewayConnectionsPeerCIDROptions *AddVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.AddVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionsPeerCIDROptions) +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 } -// 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") +// 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(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions") + err = core.ValidateStruct(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions") 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, + "vpn_gateway_id": *listVPNGatewayConnectionsPeerCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionsPeerCIDRsOptions.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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer/cidrs/{cidr}`, pathParamsMap) + _, 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 addVPNGatewayConnectionsPeerCIDROptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionsPeerCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsPeerCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsPeerCIDRs") 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)) @@ -24992,27 +25046,36 @@ func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Contex 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_peer_cidr", 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, UnmarshalVPNGatewayConnectionCIDRs) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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 @@ -25021,17 +25084,17 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO 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, `/vpn_gateways`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPNServersOptions.Headers { + for headerName, headerValue := range listVPNGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -25039,20 +25102,20 @@ 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 listVPNGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNGatewaysOptions.Start)) } - if listVPNServersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNServersOptions.Start)) + if listVPNGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNGatewaysOptions.Limit)) } - if listVPNServersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNServersOptions.Limit)) + if listVPNGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNGatewaysOptions.ResourceGroupID)) } - if listVPNServersOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNServersOptions.ResourceGroupID)) + if listVPNGatewaysOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNGatewaysOptions.Sort)) } - if listVPNServersOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNServersOptions.Sort)) + if listVPNGatewaysOptions.Mode != nil { + builder.AddQuery("mode", fmt.Sprint(*listVPNGatewaysOptions.Mode)) } request, err := builder.Build() @@ -25064,12 +25127,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, "list_vpn_gateways", 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, UnmarshalVPNGatewayCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25080,88 +25143,324 @@ 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) +// ListVPNRouteReport : List route reports of a VPN gateway +// This request lists route reports of a VPN gateway. +func (vpc *VpcV1) ListVPNRouteReport(listVPNRouteReportOptions *ListVPNRouteReportOptions) (result *VPNRouteReportCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPNRouteReportWithContext(context.Background(), listVPNRouteReportOptions) 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") +// ListVPNRouteReportWithContext is an alternate form of the ListVPNRouteReport method which supports a Context parameter +func (vpc *VpcV1) ListVPNRouteReportWithContext(ctx context.Context, listVPNRouteReportOptions *ListVPNRouteReportOptions) (result *VPNRouteReportCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNRouteReportOptions, "listVPNRouteReportOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions") + err = core.ValidateStruct(listVPNRouteReportOptions, "listVPNRouteReportOptions") 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": *listVPNRouteReportOptions.VPNGatewayID, + } + + 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, `/vpn_gateways/{vpn_gateway_id}/route_reports`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPNServerOptions.Headers { + for headerName, headerValue := range listVPNRouteReportOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNRouteReport") 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 createVPNServerOptions.Certificate != nil { - body["certificate"] = createVPNServerOptions.Certificate + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - if createVPNServerOptions.ClientAuthentication != nil { - body["client_authentication"] = createVPNServerOptions.ClientAuthentication + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "list_vpn_route_report", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return } - if createVPNServerOptions.ClientIPPool != nil { - body["client_ip_pool"] = createVPNServerOptions.ClientIPPool + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNRouteReportCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result } - if createVPNServerOptions.Subnets != nil { - body["subnets"] = createVPNServerOptions.Subnets + + return +} + +// RemoveVPNGatewayAdvertisedCIDR : Remove an advertised CIDR from a VPN gateway +// This request removes a CIDR from a VPN gateway advertised CIDRs. +// +// This request is only supported for route mode VPN gateways. +func (vpc *VpcV1) RemoveVPNGatewayAdvertisedCIDR(removeVPNGatewayAdvertisedCIDROptions *RemoveVPNGatewayAdvertisedCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RemoveVPNGatewayAdvertisedCIDRWithContext(context.Background(), removeVPNGatewayAdvertisedCIDROptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// RemoveVPNGatewayAdvertisedCIDRWithContext is an alternate form of the RemoveVPNGatewayAdvertisedCIDR method which supports a Context parameter +func (vpc *VpcV1) RemoveVPNGatewayAdvertisedCIDRWithContext(ctx context.Context, removeVPNGatewayAdvertisedCIDROptions *RemoveVPNGatewayAdvertisedCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVPNGatewayAdvertisedCIDROptions, "removeVPNGatewayAdvertisedCIDROptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return } - if createVPNServerOptions.ClientDnsServerIps != nil { - body["client_dns_server_ips"] = createVPNServerOptions.ClientDnsServerIps + err = core.ValidateStruct(removeVPNGatewayAdvertisedCIDROptions, "removeVPNGatewayAdvertisedCIDROptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return } - if createVPNServerOptions.ClientIdleTimeout != nil { - body["client_idle_timeout"] = createVPNServerOptions.ClientIdleTimeout + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *removeVPNGatewayAdvertisedCIDROptions.VPNGatewayID, + "cidr": *removeVPNGatewayAdvertisedCIDROptions.CIDR, } - if createVPNServerOptions.EnableSplitTunneling != nil { - body["enable_split_tunneling"] = createVPNServerOptions.EnableSplitTunneling + + 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}/advertised_cidrs/{cidr}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return } - if createVPNServerOptions.Name != nil { - body["name"] = createVPNServerOptions.Name + + for headerName, headerValue := range removeVPNGatewayAdvertisedCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) } - if createVPNServerOptions.Port != nil { - body["port"] = createVPNServerOptions.Port + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayAdvertisedCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - if createVPNServerOptions.Protocol != nil { - body["protocol"] = createVPNServerOptions.Protocol + + 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 } - if createVPNServerOptions.ResourceGroup != nil { - body["resource_group"] = createVPNServerOptions.ResourceGroup + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "remove_vpn_gateway_advertised_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return } - if createVPNServerOptions.SecurityGroups != nil { - body["security_groups"] = createVPNServerOptions.SecurityGroups + + 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) + 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") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return } - _, err = builder.SetBodyContentJSON(body) + err = core.ValidateStruct(removeVPNGatewayConnectionsLocalCIDROptions, "removeVPNGatewayConnectionsLocalCIDROptions") + 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, + } + + 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) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range removeVPNGatewayConnectionsLocalCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsLocalCIDR") + 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, "remove_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + 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) + 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") + 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 = 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) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range removeVPNGatewayConnectionsPeerCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsPeerCIDR") + 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, "remove_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + 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) + 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") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *updateIkePolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, 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 updateIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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 @@ -25176,12 +25475,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_ike_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, UnmarshalIkePolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25192,118 +25491,139 @@ 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) +// 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 } -// 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") +// 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(deleteVPNServerOptions, "deleteVPNServerOptions") + err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteVPNServerOptions.ID, + "id": *updateIpsecPolicyOptions.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/{id}`, 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 deleteVPNServerOptions.Headers { + for headerName, headerValue := range updateIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIpsecPolicy") 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.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) + 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", 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, UnmarshalIPsecPolicy) + 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) +// 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 } -// 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") +// 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(getVPNServerOptions, "getVPNServerOptions") + err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPNServerOptions.ID, + "id": *updateVPNGatewayOptions.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, `/vpn_servers/{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 getVPNServerOptions.Headers { + for headerName, headerValue := range updateVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") + 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()) @@ -25313,12 +25633,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, "update_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 @@ -25329,59 +25649,59 @@ 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) +// 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 } -// 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") +// 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(updateVPNServerOptions, "updateVPNServerOptions") + err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVPNServerOptions.ID, + "vpn_gateway_id": *updateVPNGatewayConnectionOptions.VPNGatewayID, + "id": *updateVPNGatewayConnectionOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) 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/{vpn_gateway_id}/connections/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPNServerOptions.Headers { + for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServer") + 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") - if updateVPNServerOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVPNServerOptions.IfMatch)) + if updateVPNGatewayConnectionOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPNGatewayConnectionOptions.IfMatch)) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) + _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -25396,12 +25716,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, "update_vpn_gateway_connection", 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, UnmarshalVPNGatewayConnection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25412,125 +25732,182 @@ 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) +// 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 } -// 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") +// 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(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") + err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *getVPNServerClientConfigurationOptions.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_servers/{id}/client_configuration`, 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 getVPNServerClientConfigurationOptions.Headers { + for headerName, headerValue := range createVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "text/plain") + 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 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) + 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, &result) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpn_server_client_configuration", 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, UnmarshalVPNServer) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(listVPNServerClientsOptions, "listVPNServerClientsOptions") + err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_server_id": *listVPNServerClientsOptions.VPNServerID, + "vpn_server_id": *createVPNServerRouteOptions.VPNServerID, } - 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_servers/{vpn_server_id}/clients`, 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 listVPNServerClientsOptions.Headers { + for headerName, headerValue := range createVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") 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)) - if listVPNServerClientsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPNServerClientsOptions.Start)) + + body := make(map[string]interface{}) + if createVPNServerRouteOptions.Destination != nil { + body["destination"] = createVPNServerRouteOptions.Destination } - if listVPNServerClientsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNServerClientsOptions.Limit)) + if createVPNServerRouteOptions.Action != nil { + body["action"] = createVPNServerRouteOptions.Action } - if listVPNServerClientsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNServerClientsOptions.Sort)) + 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() @@ -25542,12 +25919,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, "create_vpn_server_route", 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, UnmarshalVPNServerRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25558,6 +25935,71 @@ func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNSe 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) + 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") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVPNServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, 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 deleteVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + + 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", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + 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 @@ -25623,50 +26065,49 @@ func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVP 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) +// 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 } -// 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") +// 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(getVPNServerClientOptions, "getVPNServerClientOptions") + err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") 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_server_id": *deleteVPNServerRouteOptions.VPNServerID, + "id": *deleteVPNServerRouteOptions.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}/clients/{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 getVPNServerClientOptions.Headers { + for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") 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)) @@ -25677,21 +26118,12 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe 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_vpn_server_client", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpn_server_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } @@ -25761,47 +26193,45 @@ func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnect 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) +// 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 } -// 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") +// 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(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") + err = core.ValidateStruct(getVPNServerOptions, "getVPNServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_server_id": *listVPNServerRoutesOptions.VPNServerID, + "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/{vpn_server_id}/routes`, 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 listVPNServerRoutesOptions.Headers { + for headerName, headerValue := range getVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -25809,15 +26239,6 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer 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 { @@ -25828,12 +26249,12 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpn_server_routes", 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, UnmarshalVPNServerRouteCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25844,72 +26265,54 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer 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) +// 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 } -// 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") +// 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(createVPNServerRouteOptions, "createVPNServerRouteOptions") + err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_server_id": *createVPNServerRouteOptions.VPNServerID, + "vpn_server_id": *getVPNServerClientOptions.VPNServerID, + "id": *getVPNServerClientOptions.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_servers/{vpn_server_id}/clients/{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 getVPNServerClientOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") 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()) @@ -25919,12 +26322,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_server_client", 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, UnmarshalVPNServerClient) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25935,49 +26338,50 @@ 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) +// 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 } -// 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") +// 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(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") + err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") 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, + "id": *getVPNServerClientConfigurationOptions.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/{vpn_server_id}/routes/{id}`, 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 deleteVPNServerRouteOptions.Headers { + for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") 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)) @@ -25988,9 +26392,9 @@ func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPN return } - response, err = vpc.Service.Request(request, nil) + response, err = vpc.Service.Request(request, &result) if err != nil { - core.EnrichHTTPProblem(err, "delete_vpn_server_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpn_server_client_configuration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -26071,62 +26475,146 @@ 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) +// 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 } -// 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") +// 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(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") + err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") 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_server_id": *listVPNServerClientsOptions.VPNServerID, } - 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_servers/{vpn_server_id}/clients`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPNServerRouteOptions.Headers { + for headerName, headerValue := range listVPNServerClientsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") + 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/merge-patch+json") 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)) + } - _, err = builder.SetBodyContentJSON(updateVPNServerRouteOptions.VPNServerRoutePatch) + request, err := builder.Build() if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + 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_vpn_server_clients", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) + 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) + 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") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "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, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listVPNServerRoutesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") + 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 { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -26136,12 +26624,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_server_routes", 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, UnmarshalVPNServerRouteCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26152,18 +26640,17 @@ 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) +// 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 } -// 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") +// 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 @@ -26172,17 +26659,17 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL builder := core.NewRequestBuilder(core.GET) 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_servers`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { + for headerName, headerValue := range listVPNServersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -26190,11 +26677,20 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL 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 listVPNServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name)) } - if listLoadBalancerProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerProfilesOptions.Limit)) + 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() @@ -26206,12 +26702,12 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_load_balancer_profiles", 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, UnmarshalLoadBalancerProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26222,53 +26718,64 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL 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) +// 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 } -// 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") +// 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(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") + err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getLoadBalancerProfileOptions.Name, + "id": *updateVPNServerOptions.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, `/load_balancer/profiles/{name}`, 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 getLoadBalancerProfileOptions.Headers { + for headerName, headerValue := range updateVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") + 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(updateVPNServerOptions.VPNServerPatch) + 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()) @@ -26278,12 +26785,12 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_load_balancer_profile", 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, UnmarshalLoadBalancerProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26294,48 +26801,60 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad 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) +// 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 } -// 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") +// 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(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "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`, nil) + _, 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 listLoadBalancersOptions.Headers { + for headerName, headerValue := range updateVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") 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 listLoadBalancersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listLoadBalancersOptions.Start)) - } - if listLoadBalancersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listLoadBalancersOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateVPNServerRouteOptions.VPNServerRoutePatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -26347,12 +26866,12 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_load_balancers", 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, UnmarshalLoadBalancerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26472,119 +26991,192 @@ 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) +// 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 } -// 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") +// 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(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") + err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteLoadBalancerOptions.ID, + "load_balancer_id": *createLoadBalancerListenerOptions.LoadBalancerID, } - 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, `/load_balancers/{id}`, 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 deleteLoadBalancerOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteLoadBalancerOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteLoadBalancerOptions.IfMatch)) - } + 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 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 { + 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_load_balancer", 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, UnmarshalLoadBalancerListener) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(getLoadBalancerOptions, "getLoadBalancerOptions") + err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getLoadBalancerOptions.ID, + "load_balancer_id": *createLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyOptions.ListenerID, } - 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, `/load_balancers/{id}`, pathParamsMap) + _, 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 getLoadBalancerOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") 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 createLoadBalancerListenerPolicyOptions.Target != nil { + body["target"] = createLoadBalancerListenerPolicyOptions.Target + } + _, 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()) @@ -26594,12 +27186,12 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_load_balancer", 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, UnmarshalLoadBalancer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26610,60 +27202,70 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance 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) +// 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 } -// 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") +// 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(updateLoadBalancerOptions, "updateLoadBalancerOptions") + err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateLoadBalancerOptions.ID, + "load_balancer_id": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, } - 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/{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 updateLoadBalancerOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer") + 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/merge-patch+json") - if updateLoadBalancerOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateLoadBalancerOptions.IfMatch)) - } + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) + 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 @@ -26678,12 +27280,12 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_load_balancer", getServiceComponentInfo()) + 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, UnmarshalLoadBalancer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26694,53 +27296,82 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB 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) +// 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 } -// 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") +// 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(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") + err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getLoadBalancerStatisticsOptions.ID, + "load_balancer_id": *createLoadBalancerPoolOptions.LoadBalancerID, } - 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, `/load_balancers/{id}/statistics`, pathParamsMap) + _, 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 getLoadBalancerStatisticsOptions.Headers { + for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") 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 createLoadBalancerPoolOptions.Algorithm != nil { + body["algorithm"] = createLoadBalancerPoolOptions.Algorithm + } + if createLoadBalancerPoolOptions.HealthMonitor != nil { + body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor + } + if createLoadBalancerPoolOptions.Protocol != nil { + body["protocol"] = createLoadBalancerPoolOptions.Protocol + } + if createLoadBalancerPoolOptions.Members != nil { + body["members"] = createLoadBalancerPoolOptions.Members + } + 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 { + 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()) @@ -26750,12 +27381,12 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(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_statistics", 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, UnmarshalLoadBalancerStatistics) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26766,53 +27397,71 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL 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) +// 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 } -// 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") +// 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(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") + 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": *listLoadBalancerListenersOptions.LoadBalancerID, + "load_balancer_id": *createLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, } - 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, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) + _, 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 listLoadBalancerListenersOptions.Headers { + for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") 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()) @@ -26822,176 +27471,386 @@ 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, "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 +} + +// 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 +} + +// 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(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "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/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deleteLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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)) + + 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_load_balancer", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + 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) + 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") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + 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": *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}/listeners/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") + 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_load_balancer_listener", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + 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) + 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") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") + 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, + } + + 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) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") + 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_load_balancer_listener_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + 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, `/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 deleteLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") + 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_load_balancer_listener_policy_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") + err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerOptions.LoadBalancerID, + "load_balancer_id": *deleteLoadBalancerPoolOptions.LoadBalancerID, + "id": *deleteLoadBalancerPoolOptions.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, `/load_balancers/{load_balancer_id}/listeners`, 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 createLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") 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 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 { - 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_load_balancer_listener", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_load_balancer_pool", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") + err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") 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, + "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, `/load_balancers/{load_balancer_id}/listeners/{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 deleteLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -27007,7 +27866,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_load_balancer_pool_member", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -27015,46 +27874,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) +// 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 } -// 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") +// 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(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") + 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": *getLoadBalancerListenerOptions.LoadBalancerID, - "id": *getLoadBalancerListenerOptions.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}/listeners/{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 getLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range getLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -27072,12 +27930,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_load_balancer", 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, UnmarshalLoadBalancer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27088,33 +27946,33 @@ 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) +// 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 } -// 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") +// 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(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") + 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": *updateLoadBalancerListenerOptions.LoadBalancerID, - "id": *updateLoadBalancerListenerOptions.ID, + "load_balancer_id": *getLoadBalancerListenerOptions.LoadBalancerID, + "id": *getLoadBalancerListenerOptions.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, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) @@ -27123,26 +27981,19 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd return } - for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") 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(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) - 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()) @@ -27152,7 +28003,7 @@ 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, "get_load_balancer_listener", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -27168,47 +28019,47 @@ 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) +// 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 } -// 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") +// 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(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") + err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") 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, + "load_balancer_id": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, + "id": *getLoadBalancerListenerPolicyOptions.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, `/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 listLoadBalancerListenerPoliciesOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -27226,12 +28077,12 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_load_balancer_listener_policies", 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, UnmarshalLoadBalancerListenerPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27242,79 +28093,56 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex 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) +// 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 } -// 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") +// 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(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") 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, + "load_balancer_id": *getLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *getLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *getLoadBalancerListenerPolicyRuleOptions.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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, 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 createLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") 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 createLoadBalancerListenerPolicyOptions.Target != nil { - body["target"] = createLoadBalancerListenerPolicyOptions.Target - } - _, 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()) @@ -27324,12 +28152,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, "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, UnmarshalLoadBalancerListenerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27340,50 +28168,50 @@ 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) +// 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 } -// 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") +// 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(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") 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, + "load_balancer_id": *getLoadBalancerPoolOptions.LoadBalancerID, + "id": *getLoadBalancerPoolOptions.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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{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 deleteLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") 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)) @@ -27394,57 +28222,66 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Contex 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_load_balancer_listener_policy", 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, UnmarshalLoadBalancerPool) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") 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, + "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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{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 getLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -27462,12 +28299,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_load_balancer_pool_member", 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, UnmarshalLoadBalancerPoolMember) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27478,63 +28315,53 @@ 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) +// 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 } -// 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") +// 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(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") + 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": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, - "id": *updateLoadBalancerListenerPolicyOptions.ID, + "name": *getLoadBalancerProfileOptions.Name, } - 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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, 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 updateLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") 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()) @@ -27544,12 +28371,12 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_load_balancer_listener_policy", 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, UnmarshalLoadBalancerListenerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27560,47 +28387,45 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex 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) +// 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 } -// 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") +// 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(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") + 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": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, - "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, - "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, + "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}/listeners/{listener_id}/policies/{policy_id}/rules`, 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 listLoadBalancerListenerPolicyRulesOptions.Headers { + for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -27618,12 +28443,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, "get_load_balancer_statistics", 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, UnmarshalLoadBalancerStatistics) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27634,75 +28459,55 @@ 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) +// 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 } -// 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") +// 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(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") + 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": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, + "load_balancer_id": *listLoadBalancerListenerPoliciesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPoliciesOptions.ListenerID, } - 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/{policy_id}/rules`, pathParamsMap) + _, 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 createLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") 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()) @@ -27712,12 +28517,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, "list_load_balancer_listener_policies", 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, UnmarshalLoadBalancerListenerPolicyCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27728,51 +28533,51 @@ 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) +// 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 } -// 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") +// 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(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") 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, + "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, + "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, } - 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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{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 deleteLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") 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)) @@ -27783,58 +28588,64 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.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_load_balancer_listener_policy_rule", 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, UnmarshalLoadBalancerListenerPolicyRuleCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") + 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": *getLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *getLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *getLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *getLoadBalancerListenerPolicyRuleOptions.ID, + "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, } 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, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -27852,12 +28663,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, "list_load_balancer_listeners", 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, UnmarshalLoadBalancerListenerCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27868,63 +28679,54 @@ 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) +// 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 } -// 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") +// 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(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") + 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": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *updateLoadBalancerListenerPolicyRuleOptions.ID, + "load_balancer_id": *listLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *listLoadBalancerPoolMembersOptions.PoolID, } - 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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + _, 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 updateLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") 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(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) - 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()) @@ -27934,12 +28736,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, "list_load_balancer_pool_members", 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, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28022,80 +28824,49 @@ 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) +// 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 } -// 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(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") +// 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 } - pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerPoolOptions.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`, pathParamsMap) + _, 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 createLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") 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 createLoadBalancerPoolOptions.Algorithm != nil { - body["algorithm"] = createLoadBalancerPoolOptions.Algorithm - } - if createLoadBalancerPoolOptions.HealthMonitor != nil { - body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor - } - if createLoadBalancerPoolOptions.Protocol != nil { - body["protocol"] = createLoadBalancerPoolOptions.Protocol - } - if createLoadBalancerPoolOptions.Members != nil { - body["members"] = createLoadBalancerPoolOptions.Members - } - 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 + if listLoadBalancerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listLoadBalancerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerProfilesOptions.Limit)) } request, err := builder.Build() @@ -28107,12 +28878,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, "list_load_balancer_profiles", 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, UnmarshalLoadBalancerProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28123,53 +28894,49 @@ 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) +// 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 } -// 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(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") +// 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, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerPoolOptions.LoadBalancerID, - "id": *deleteLoadBalancerPoolOptions.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, `/load_balancers/{load_balancer_id}/pools/{id}`, 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 deleteLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range listLoadBalancersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") + 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 { @@ -28177,64 +28944,85 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteL 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_load_balancer_pool", getServiceComponentInfo()) + 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 } -// 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) +// 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 } -// 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") +// 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(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") + 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": *getLoadBalancerPoolOptions.LoadBalancerID, - "id": *getLoadBalancerPoolOptions.ID, + "load_balancer_id": *replaceLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *replaceLoadBalancerPoolMembersOptions.PoolID, } - 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, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + _, 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 getLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") + 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 { + 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()) @@ -28244,12 +29032,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, "replace_load_balancer_pool_members", 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, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28260,56 +29048,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 @@ -28324,12 +29116,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 @@ -28340,54 +29132,61 @@ 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) +// 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 } -// 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") +// 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(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") + 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": *listLoadBalancerPoolMembersOptions.LoadBalancerID, - "pool_id": *listLoadBalancerPoolMembersOptions.PoolID, + "load_balancer_id": *updateLoadBalancerListenerOptions.LoadBalancerID, + "id": *updateLoadBalancerListenerOptions.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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, 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 listLoadBalancerPoolMembersOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") 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(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) + 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()) @@ -28397,12 +29196,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, "update_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 @@ -28413,66 +29212,58 @@ 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) +// 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 } -// 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") +// 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(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") 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": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, + "id": *updateLoadBalancerListenerPolicyOptions.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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, 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 createLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") + 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/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 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) + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -28487,12 +29278,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, "update_load_balancer_listener_policy", 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, UnmarshalLoadBalancerListenerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28503,61 +29294,58 @@ 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) +// 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 } -// 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") +// 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(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") + err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") 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": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *updateLoadBalancerListenerPolicyRuleOptions.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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, 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 replaceLoadBalancerPoolMembersOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") 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 replaceLoadBalancerPoolMembersOptions.Members != nil { - body["members"] = replaceLoadBalancerPoolMembersOptions.Members - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -28572,12 +29360,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, "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, UnmarshalLoadBalancerPoolMemberCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28588,119 +29376,61 @@ 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) +// 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 } -// 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") +// 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(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") 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": *updateLoadBalancerPoolOptions.LoadBalancerID, + "id": *updateLoadBalancerPoolOptions.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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{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 deleteLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") 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_load_balancer_pool_member", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") - 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, - } - - 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.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) 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 getLoadBalancerPoolMemberOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") - 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()) @@ -28710,12 +29440,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, "update_load_balancer_pool", 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, UnmarshalLoadBalancerPool) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28807,37 +29537,49 @@ 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) +// 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) 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") +// 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(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, + "id": *addEndpointGatewayIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) 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, `/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 listEndpointGatewaysOptions.Headers { + for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28845,30 +29587,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.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 { @@ -28879,12 +29597,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, "add_endpoint_gateway_ip", 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, UnmarshalReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28993,61 +29711,54 @@ 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) +// 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 } -// 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") +// 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(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") + err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, + "id": *deleteEndpointGatewayOptions.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, `/endpoint_gateways/{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 deleteEndpointGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") 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 { @@ -29055,69 +29766,59 @@ 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_endpoint_gateway", 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) +// 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 } -// 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") +// 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(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") + err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") 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, + "id": *getEndpointGatewayOptions.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, `/endpoint_gateways/{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 getEndpointGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") 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)) @@ -29128,12 +29829,21 @@ 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_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 } @@ -29211,49 +29921,45 @@ 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) +// 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 } -// 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") +// 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(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") + err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") 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, + "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, } - 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, `/endpoint_gateways/{endpoint_gateway_id}/ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { + for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -29261,6 +29967,15 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi 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 { @@ -29271,12 +29986,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_endpoint_gateway_ips", 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, UnmarshalReservedIPCollectionEndpointGatewayContext) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29287,54 +30002,68 @@ 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) +// 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 } -// 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(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") +// 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{ - "id": *deleteEndpointGatewayOptions.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/{id}`, 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 deleteEndpointGatewayOptions.Headers { + for headerName, headerValue := range listEndpointGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") 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 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.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 { @@ -29342,59 +30071,69 @@ func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEn 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_endpoint_gateway", 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, UnmarshalEndpointGatewayCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(getEndpointGatewayOptions, "getEndpointGatewayOptions") + err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getEndpointGatewayOptions.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, `/endpoint_gateways/{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 getEndpointGatewayOptions.Headers { + for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") + 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)) @@ -29405,21 +30144,12 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint 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_endpoint_gateway", 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, UnmarshalEndpointGateway) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } @@ -29503,97 +30233,6 @@ 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 summarizes data sent over the instance -// network interfaces and instance network attachments contained within its target. -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 -} - -// 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, "", "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, `/flow_log_collectors`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - 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 @@ -29823,6 +30462,99 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog 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) + 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") + 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, `/flow_log_collectors`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + 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 +} + // 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 @@ -30177,6 +30909,44 @@ func (options *AddVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string] return options } +// AddVPNGatewayAdvertisedCIDROptions : The AddVPNGatewayAdvertisedCIDR options. +type AddVPNGatewayAdvertisedCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_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 +} + +// NewAddVPNGatewayAdvertisedCIDROptions : Instantiate AddVPNGatewayAdvertisedCIDROptions +func (*VpcV1) NewAddVPNGatewayAdvertisedCIDROptions(vpnGatewayID string, cidr string) *AddVPNGatewayAdvertisedCIDROptions { + return &AddVPNGatewayAdvertisedCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + CIDR: core.StringPtr(cidr), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *AddVPNGatewayAdvertisedCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayAdvertisedCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetCIDR : Allow user to set CIDR +func (_options *AddVPNGatewayAdvertisedCIDROptions) SetCIDR(cidr string) *AddVPNGatewayAdvertisedCIDROptions { + _options.CIDR = core.StringPtr(cidr) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVPNGatewayAdvertisedCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayAdvertisedCIDROptions { + options.Headers = param + return options +} + // AddVPNGatewayConnectionsLocalCIDROptions : The AddVPNGatewayConnectionsLocalCIDR options. type AddVPNGatewayConnectionsLocalCIDROptions struct { // The VPN gateway identifier. @@ -32275,6 +33045,9 @@ type BareMetalServer struct { // boot. EnableSecureBoot *bool `json:"enable_secure_boot" validate:"required"` + // 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"` @@ -32329,6 +33102,7 @@ type BareMetalServer struct { // - `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 @@ -32374,6 +33148,7 @@ const ( // - `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 @@ -32382,14 +33157,15 @@ const ( // 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" - BareMetalServerStatusRestartingConst = "restarting" - BareMetalServerStatusRunningConst = "running" - BareMetalServerStatusStartingConst = "starting" - BareMetalServerStatusStoppedConst = "stopped" + BareMetalServerStatusDeletingConst = "deleting" + BareMetalServerStatusFailedConst = "failed" + BareMetalServerStatusMaintenanceConst = "maintenance" + BareMetalServerStatusPendingConst = "pending" + BareMetalServerStatusReinitializingConst = "reinitializing" + BareMetalServerStatusRestartingConst = "restarting" + BareMetalServerStatusRunningConst = "running" + BareMetalServerStatusStartingConst = "starting" + BareMetalServerStatusStoppedConst = "stopped" ) // UnmarshalBareMetalServer unmarshals an instance of BareMetalServer from the specified map of raw messages. @@ -32430,6 +33206,11 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) 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) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -32964,6 +33745,32 @@ func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, return } +// BareMetalServerFirmware : Firmware information for the bare metal server. +type BareMetalServerFirmware struct { + // The type of update available. + Update *string `json:"update" validate:"required"` +} + +// Constants associated with the BareMetalServerFirmware.Update property. +// The type of update available. +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, "", "update-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. @@ -33842,6 +34649,9 @@ type BareMetalServerNetworkAttachmentReference struct { // 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 BareMetalServerNetworkAttachmentReference.ResourceType property. @@ -33888,6 +34698,11 @@ func UnmarshalBareMetalServerNetworkAttachmentReference(m map[string]json.RawMes 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 } @@ -36226,6 +37041,7 @@ type BareMetalServerStatusReason struct { // - `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. @@ -36245,15 +37061,18 @@ type BareMetalServerStatusReason struct { // - `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. @@ -36604,6 +37423,44 @@ func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result return } +// CheckVPNGatewayAdvertisedCIDROptions : The CheckVPNGatewayAdvertisedCIDR options. +type CheckVPNGatewayAdvertisedCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_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 +} + +// NewCheckVPNGatewayAdvertisedCIDROptions : Instantiate CheckVPNGatewayAdvertisedCIDROptions +func (*VpcV1) NewCheckVPNGatewayAdvertisedCIDROptions(vpnGatewayID string, cidr string) *CheckVPNGatewayAdvertisedCIDROptions { + return &CheckVPNGatewayAdvertisedCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + CIDR: core.StringPtr(cidr), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *CheckVPNGatewayAdvertisedCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayAdvertisedCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetCIDR : Allow user to set CIDR +func (_options *CheckVPNGatewayAdvertisedCIDROptions) SetCIDR(cidr string) *CheckVPNGatewayAdvertisedCIDROptions { + _options.CIDR = core.StringPtr(cidr) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CheckVPNGatewayAdvertisedCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayAdvertisedCIDROptions { + options.Headers = param + return options +} + // CheckVPNGatewayConnectionsLocalCIDROptions : The CheckVPNGatewayConnectionsLocalCIDR options. type CheckVPNGatewayConnectionsLocalCIDROptions struct { // The VPN gateway identifier. @@ -40308,8 +41165,8 @@ type CreateVPCRouteOptions struct { // randomly-selected words. Name *string `json:"name,omitempty"` - // If `action` is `deliver`, the next hop that packets will be delivered to. For other - // `action` values, it must be omitted or specified as `0.0.0.0`. + // 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`. // // At most two routes per `zone` in a table can have the same `destination` and `priority`, // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. @@ -40590,8 +41447,8 @@ type CreateVPCRoutingTableRouteOptions struct { // randomly-selected words. Name *string `json:"name,omitempty"` - // If `action` is `deliver`, the next hop that packets will be delivered to. For other - // `action` values, it must be omitted or specified as `0.0.0.0`. + // 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`. // // At most two routes per `zone` in a table can have the same `destination` and `priority`, // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. @@ -40757,6 +41614,34 @@ func (options *CreateVPNGatewayOptions) SetHeaders(param map[string]string) *Cre return options } +// CreateVPNRouteReportOptions : The CreateVPNRouteReport options. +type CreateVPNRouteReportOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVPNRouteReportOptions : Instantiate CreateVPNRouteReportOptions +func (*VpcV1) NewCreateVPNRouteReportOptions(vpnGatewayID string) *CreateVPNRouteReportOptions { + return &CreateVPNRouteReportOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *CreateVPNRouteReportOptions) SetVPNGatewayID(vpnGatewayID string) *CreateVPNRouteReportOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNRouteReportOptions) SetHeaders(param map[string]string) *CreateVPNRouteReportOptions { + options.Headers = param + return options +} + // CreateVPNServerOptions : The CreateVPNServer options. type CreateVPNServerOptions struct { // The certificate instance for this VPN server. @@ -42197,9 +43082,9 @@ type DedicatedHostProfile struct { // and usable. // - `current`: This dedicated host profile is the latest revision. // - // Revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming conventions] - // (https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information on how - // generations are defined within a dedicated host profile. + // Revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming + // conventions](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information + // on how generations are defined within a dedicated host profile. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -42232,9 +43117,9 @@ const ( // and usable. // - `current`: This dedicated host profile is the latest revision. // -// Revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming conventions] -// (https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information on how -// generations are defined within a dedicated host profile. +// Revisions are indicated by the generation of a dedicated host profile. Refer to the [profile naming +// conventions](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles&interface=ui#profiles-naming-rule) for information +// on how generations are defined within a dedicated host profile. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -44980,7 +45865,7 @@ type DeleteShareMountTargetOptions struct { // The file share identifier. ShareID *string `json:"share_id" validate:"required,ne="` - // The share mount target identifier. + // The file share mount target identifier. ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests @@ -45594,6 +46479,9 @@ type DeleteVPNGatewayConnectionOptions struct { // The VPN gateway connection 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 } @@ -45618,6 +46506,12 @@ func (_options *DeleteVPNGatewayConnectionOptions) SetID(id string) *DeleteVPNGa return _options } +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteVPNGatewayConnectionOptions) SetIfMatch(ifMatch string) *DeleteVPNGatewayConnectionOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + // SetHeaders : Allow user to set Headers func (options *DeleteVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *DeleteVPNGatewayConnectionOptions { options.Headers = param @@ -45652,6 +46546,44 @@ func (options *DeleteVPNGatewayOptions) SetHeaders(param map[string]string) *Del return options } +// DeleteVPNRouteReportOptions : The DeleteVPNRouteReport options. +type DeleteVPNRouteReportOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN route report identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNRouteReportOptions : Instantiate DeleteVPNRouteReportOptions +func (*VpcV1) NewDeleteVPNRouteReportOptions(vpnGatewayID string, id string) *DeleteVPNRouteReportOptions { + return &DeleteVPNRouteReportOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *DeleteVPNRouteReportOptions) SetVPNGatewayID(vpnGatewayID string) *DeleteVPNRouteReportOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNRouteReportOptions) SetID(id string) *DeleteVPNRouteReportOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNRouteReportOptions) SetHeaders(param map[string]string) *DeleteVPNRouteReportOptions { + options.Headers = param + return options +} + // DeleteVPNServerClientOptions : The DeleteVPNServerClient options. type DeleteVPNServerClientOptions struct { // The VPN server identifier. @@ -47717,6 +48649,9 @@ type FlowLogCollectorTarget struct { // The subnet of the virtual network interface for the instance network attachment. Subnet *SubnetReference `json:"subnet,omitempty"` + + // The virtual network interface for this instance network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface,omitempty"` } // Constants associated with the FlowLogCollectorTarget.ResourceType property. @@ -47776,6 +48711,11 @@ func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interf 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 } @@ -49959,7 +50899,7 @@ type GetShareMountTargetOptions struct { // The file share identifier. ShareID *string `json:"share_id" validate:"required,ne="` - // The share mount target identifier. + // The file share mount target identifier. ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests @@ -50820,6 +51760,44 @@ func (options *GetVPNGatewayOptions) SetHeaders(param map[string]string) *GetVPN return options } +// GetVPNRouteReportOptions : The GetVPNRouteReport options. +type GetVPNRouteReportOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN route report identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNRouteReportOptions : Instantiate GetVPNRouteReportOptions +func (*VpcV1) NewGetVPNRouteReportOptions(vpnGatewayID string, id string) *GetVPNRouteReportOptions { + return &GetVPNRouteReportOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *GetVPNRouteReportOptions) SetVPNGatewayID(vpnGatewayID string) *GetVPNRouteReportOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPNRouteReportOptions) SetID(id string) *GetVPNRouteReportOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNRouteReportOptions) SetHeaders(param map[string]string) *GetVPNRouteReportOptions { + options.Headers = param + return options +} + // GetVPNServerClientConfigurationOptions : The GetVPNServerClientConfiguration options. type GetVPNServerClientConfigurationOptions struct { // The VPN server identifier. @@ -53362,6 +54340,9 @@ type Instance struct { LifecycleState *string `json:"lifecycle_state" validate:"required"` // The amount of memory, truncated to whole gibibytes. + // + // The maximum limit for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Memory *int64 `json:"memory" validate:"required"` // The metadata service configuration. @@ -57509,6 +58490,9 @@ type InstanceNetworkAttachmentReference struct { // The subnet of the virtual network interface for the instance network attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The virtual network interface for this instance network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` } // Constants associated with the InstanceNetworkAttachmentReference.ResourceType property. @@ -57555,6 +58539,11 @@ func UnmarshalInstanceNetworkAttachmentReference(m map[string]json.RawMessage, r 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 } @@ -57971,9 +58960,9 @@ type InstanceProfile struct { // usable. // - `current`: This profile is the latest revision. // - // Revisions are indicated by the generation of an instance profile. Refer to the [profile naming conventions] - // (https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on how - // generations are defined within an instance profile. + // Revisions are indicated by the generation of an instance profile. Refer to the [profile naming + // conventions](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on + // how generations are defined within an instance profile. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -58000,9 +58989,9 @@ const ( // usable. // - `current`: This profile is the latest revision. // -// Revisions are indicated by the generation of an instance profile. Refer to the [profile naming conventions] -// (https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on how -// generations are defined within an instance profile. +// Revisions are indicated by the generation of an instance profile. Refer to the [profile naming +// conventions](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles&interface=ui#profiles-naming-rule) for information on +// how generations are defined within an instance profile. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -65566,6 +66555,34 @@ func (options *ListVpcsOptions) SetHeaders(param map[string]string) *ListVpcsOpt return options } +// ListVPNGatewayAdvertisedCIDRsOptions : The ListVPNGatewayAdvertisedCIDRs options. +type ListVPNGatewayAdvertisedCIDRsOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPNGatewayAdvertisedCIDRsOptions : Instantiate ListVPNGatewayAdvertisedCIDRsOptions +func (*VpcV1) NewListVPNGatewayAdvertisedCIDRsOptions(vpnGatewayID string) *ListVPNGatewayAdvertisedCIDRsOptions { + return &ListVPNGatewayAdvertisedCIDRsOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *ListVPNGatewayAdvertisedCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayAdvertisedCIDRsOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewayAdvertisedCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayAdvertisedCIDRsOptions { + options.Headers = param + return options +} + // ListVPNGatewayConnectionsLocalCIDRsOptions : The ListVPNGatewayConnectionsLocalCIDRs options. type ListVPNGatewayConnectionsLocalCIDRsOptions struct { // The VPN gateway identifier. @@ -65784,6 +66801,34 @@ func (options *ListVPNGatewaysOptions) SetHeaders(param map[string]string) *List return options } +// ListVPNRouteReportOptions : The ListVPNRouteReport options. +type ListVPNRouteReportOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPNRouteReportOptions : Instantiate ListVPNRouteReportOptions +func (*VpcV1) NewListVPNRouteReportOptions(vpnGatewayID string) *ListVPNRouteReportOptions { + return &ListVPNRouteReportOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *ListVPNRouteReportOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNRouteReportOptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNRouteReportOptions) SetHeaders(param map[string]string) *ListVPNRouteReportOptions { + options.Headers = param + return options +} + // ListVPNServerClientsOptions : The ListVPNServerClients options. type ListVPNServerClientsOptions struct { // The VPN server identifier. @@ -67827,7 +68872,23 @@ type LoadBalancerListenerPolicyTarget struct { // The redirect relative target URI. URI *string `json:"uri,omitempty"` - // The redirect target URL. + // The redirect target URL. The URL supports [RFC 6570 level 1 + // expressions](https://datatracker.ietf.org/doc/html/rfc6570#section-1.2) for the following variables which expand to + // values from the originally requested URL (or the indicated defaults if the request did not include them): + // + // - `protocol` + // - `host` + // - `port` (default: `80` for HTTP requests, `443` for HTTPS requests) + // - `path` (default: '/') + // - `query` (default: '') + // + // The protocol, host, and port segments of the URL, must only contain at most one instance of the `protocol`, `host`, + // and `port` variables, respectively. The path and query segments of the URL may contain any combination of variables. + // If the substitution of `path` results in consecutive leading slashes, the leading slash from the substitution will + // be removed. Additional examples: + // - `https://{host}:8080/{port}/{host}/{path}` + // - `https://www.example.com` + // - `{protocol}://test.{host}:80/{path}`. URL *string `json:"url,omitempty"` } @@ -67910,7 +68971,23 @@ type LoadBalancerListenerPolicyTargetPatch struct { // The redirect relative target URI. URI *string `json:"uri,omitempty"` - // The redirect target URL. + // The redirect target URL. The URL supports [RFC 6570 level 1 + // expressions](https://datatracker.ietf.org/doc/html/rfc6570#section-1.2) for the following variables which expand to + // values from the originally requested URL (or the indicated defaults if the request did not include them): + // + // - `protocol` + // - `host` + // - `port` (default: `80` for HTTP requests, `443` for HTTPS requests) + // - `path` (default: '/') + // - `query` (default: '') + // + // The protocol, host, and port segments of the URL, must only contain at most one instance of the `protocol`, `host`, + // and `port` variables, respectively. The path and query segments of the URL may contain any combination of variables. + // If the substitution of `path` results in consecutive leading slashes, the leading slash from the substitution will + // be removed. Additional examples: + // - `https://{host}:8080/{port}/{host}/{path}` + // - `https://www.example.com` + // - `{protocol}://test.{host}:80/{path}`. URL *string `json:"url,omitempty"` } @@ -67983,7 +69060,23 @@ type LoadBalancerListenerPolicyTargetPrototype struct { // The redirect relative target URI. URI *string `json:"uri,omitempty"` - // The redirect target URL. + // The redirect target URL. The URL supports [RFC 6570 level 1 + // expressions](https://datatracker.ietf.org/doc/html/rfc6570#section-1.2) for the following variables which expand to + // values from the originally requested URL (or the indicated defaults if the request did not include them): + // + // - `protocol` + // - `host` + // - `port` (default: `80` for HTTP requests, `443` for HTTPS requests) + // - `path` (default: '/') + // - `query` (default: '') + // + // The protocol, host, and port segments of the URL, must only contain at most one instance of the `protocol`, `host`, + // and `port` variables, respectively. The path and query segments of the URL may contain any combination of variables. + // If the substitution of `path` results in consecutive leading slashes, the leading slash from the substitution will + // be removed. Additional examples: + // - `https://{host}:8080/{port}/{host}/{path}` + // - `https://www.example.com` + // - `{protocol}://test.{host}:80/{path}`. URL *string `json:"url,omitempty"` } @@ -73750,6 +74843,44 @@ func (options *RemoveVirtualNetworkInterfaceIPOptions) SetHeaders(param map[stri return options } +// RemoveVPNGatewayAdvertisedCIDROptions : The RemoveVPNGatewayAdvertisedCIDR options. +type RemoveVPNGatewayAdvertisedCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_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 +} + +// NewRemoveVPNGatewayAdvertisedCIDROptions : Instantiate RemoveVPNGatewayAdvertisedCIDROptions +func (*VpcV1) NewRemoveVPNGatewayAdvertisedCIDROptions(vpnGatewayID string, cidr string) *RemoveVPNGatewayAdvertisedCIDROptions { + return &RemoveVPNGatewayAdvertisedCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + CIDR: core.StringPtr(cidr), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *RemoveVPNGatewayAdvertisedCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayAdvertisedCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetCIDR : Allow user to set CIDR +func (_options *RemoveVPNGatewayAdvertisedCIDROptions) SetCIDR(cidr string) *RemoveVPNGatewayAdvertisedCIDROptions { + _options.CIDR = core.StringPtr(cidr) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveVPNGatewayAdvertisedCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayAdvertisedCIDROptions { + options.Headers = param + return options +} + // RemoveVPNGatewayConnectionsLocalCIDROptions : The RemoveVPNGatewayConnectionsLocalCIDR options. type RemoveVPNGatewayConnectionsLocalCIDROptions struct { // The VPN gateway identifier. @@ -73846,6 +74977,71 @@ func (options *RemoveVPNGatewayConnectionsPeerCIDROptions) SetHeaders(param map[ return options } +// ReplaceBareMetalServerInitializationOptions : The ReplaceBareMetalServerInitialization options. +type ReplaceBareMetalServerInitializationOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // The image to be used when provisioning the bare metal server. + Image ImageIdentityIntf `json:"image" 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceBareMetalServerInitializationOptions : Instantiate ReplaceBareMetalServerInitializationOptions +func (*VpcV1) NewReplaceBareMetalServerInitializationOptions(id string, image ImageIdentityIntf, keys []KeyIdentityIntf) *ReplaceBareMetalServerInitializationOptions { + return &ReplaceBareMetalServerInitializationOptions{ + ID: core.StringPtr(id), + Image: image, + Keys: keys, + } +} + +// SetID : Allow user to set ID +func (_options *ReplaceBareMetalServerInitializationOptions) SetID(id string) *ReplaceBareMetalServerInitializationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetImage : Allow user to set Image +func (_options *ReplaceBareMetalServerInitializationOptions) SetImage(image ImageIdentityIntf) *ReplaceBareMetalServerInitializationOptions { + _options.Image = image + return _options +} + +// SetKeys : Allow user to set Keys +func (_options *ReplaceBareMetalServerInitializationOptions) SetKeys(keys []KeyIdentityIntf) *ReplaceBareMetalServerInitializationOptions { + _options.Keys = keys + return _options +} + +// SetUserData : Allow user to set UserData +func (_options *ReplaceBareMetalServerInitializationOptions) SetUserData(userData string) *ReplaceBareMetalServerInitializationOptions { + _options.UserData = core.StringPtr(userData) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceBareMetalServerInitializationOptions) SetHeaders(param map[string]string) *ReplaceBareMetalServerInitializationOptions { + options.Headers = param + return options +} + // ReplaceLoadBalancerPoolMembersOptions : The ReplaceLoadBalancerPoolMembers options. type ReplaceLoadBalancerPoolMembersOptions struct { // The load balancer identifier. @@ -74387,7 +75583,9 @@ func UnmarshalReservationCollectionNext(m map[string]json.RawMessage, result int // ReservationCommittedUse : The committed use reservation configuration. type ReservationCommittedUse struct { // The expiration date and time for this committed use reservation. - ExpirationAt *strfmt.DateTime `json:"expiration_at" validate:"required"` + // + // This property will be absent if the reservation has a `status` of `inactive`. + ExpirationAt *strfmt.DateTime `json:"expiration_at,omitempty"` // The policy to apply when the committed use term expires: // - `release`: Release any available capacity and let the reservation expire. @@ -76607,8 +77805,9 @@ func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (er return } -// RouteNextHopPatch : If `action` is `deliver`, the next hop that packets will be delivered to. For other -// `action` values, specify `0.0.0.0` or remove it by specifying `null`. +// RouteNextHopPatch : If `action` is `deliver`, the next hop that packets will be delivered to (must not be +// `0.0.0.0`). For other `action` values, specify `0.0.0.0` or remove it by specifying +// `null`. // // At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has // an `action` of `deliver` and `next_hop` is an IP address. @@ -76674,8 +77873,9 @@ type RoutePatch struct { // are reserved for system-provided routes, and are not allowed. Name *string `json:"name,omitempty"` - // If `action` is `deliver`, the next hop that packets will be delivered to. For other - // `action` values, specify `0.0.0.0` or remove it by specifying `null`. + // If `action` is `deliver`, the next hop that packets will be delivered to (must not be + // `0.0.0.0`). For other `action` values, specify `0.0.0.0` or remove it by specifying + // `null`. // // At most two routes per `zone` in a table can have the same `destination` and `priority`, // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. @@ -76756,8 +77956,8 @@ type RoutePrototype struct { // randomly-selected words. Name *string `json:"name,omitempty"` - // If `action` is `deliver`, the next hop that packets will be delivered to. For other - // `action` values, it must be omitted or specified as `0.0.0.0`. + // 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`. // // At most two routes per `zone` in a table can have the same `destination` and `priority`, // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. @@ -76848,8 +78048,8 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( return } -// RoutePrototypeNextHop : If `action` is `deliver`, the next hop that packets will be delivered to. For other -// `action` values, it must be omitted or specified as `0.0.0.0`. +// RoutePrototypeNextHop : 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`. // // At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has // an `action` of `deliver` and `next_hop` is an IP address. @@ -84294,6 +85494,43 @@ func (options *UpdateEndpointGatewayOptions) SetHeaders(param map[string]string) return options } +// UpdateFirmwareForBareMetalServerOptions : The UpdateFirmwareForBareMetalServer options. +type UpdateFirmwareForBareMetalServerOptions struct { + // The bare metal server identifier. + ID *string `json:"id" validate:"required,ne="` + + // 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 + Headers map[string]string +} + +// NewUpdateFirmwareForBareMetalServerOptions : Instantiate UpdateFirmwareForBareMetalServerOptions +func (*VpcV1) NewUpdateFirmwareForBareMetalServerOptions(id string) *UpdateFirmwareForBareMetalServerOptions { + return &UpdateFirmwareForBareMetalServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *UpdateFirmwareForBareMetalServerOptions) SetID(id string) *UpdateFirmwareForBareMetalServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetAutoStart : Allow user to set AutoStart +func (_options *UpdateFirmwareForBareMetalServerOptions) SetAutoStart(autoStart bool) *UpdateFirmwareForBareMetalServerOptions { + _options.AutoStart = core.BoolPtr(autoStart) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateFirmwareForBareMetalServerOptions) SetHeaders(param map[string]string) *UpdateFirmwareForBareMetalServerOptions { + options.Headers = param + return options +} + // UpdateFloatingIPOptions : The UpdateFloatingIP options. type UpdateFloatingIPOptions struct { // The floating IP identifier. @@ -85717,7 +86954,7 @@ type UpdateShareMountTargetOptions struct { // The file share identifier. ShareID *string `json:"share_id" validate:"required,ne="` - // The share mount target identifier. + // The file share mount target identifier. ID *string `json:"id" validate:"required,ne="` // The share mount target patch. @@ -86395,6 +87632,10 @@ type UpdateVPNGatewayConnectionOptions struct { // The VPN gateway connection patch. VPNGatewayConnectionPatch map[string]interface{} `json:"VPNGatewayConnection_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 } @@ -86426,6 +87667,12 @@ func (_options *UpdateVPNGatewayConnectionOptions) SetVPNGatewayConnectionPatch( return _options } +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVPNGatewayConnectionOptions) SetIfMatch(ifMatch string) *UpdateVPNGatewayConnectionOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + // SetHeaders : Allow user to set Headers func (options *UpdateVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *UpdateVPNGatewayConnectionOptions { options.Headers = param @@ -88076,6 +89323,13 @@ type VPNGateway struct { // The VPC this VPN gateway resides in. VPC *VPCReference `json:"vpc" validate:"required"` + // The additional CIDRs advertised through any enabled routing protocol (for example, BGP). The routing protocol will + // advertise routes with these CIDRs and VPC prefixes as route destinations. + AdvertisedCIDRs []string `json:"advertised_cidrs,omitempty"` + + // The local autonomous system number (ASN) for this VPN gateway and its connections. + LocalAsn *int64 `json:"local_asn,omitempty"` + // Route mode VPN gateway. Mode *string `json:"mode,omitempty"` } @@ -88205,6 +89459,16 @@ func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "advertised_cidrs", &obj.AdvertisedCIDRs) + if err != nil { + err = core.SDKErrorf(err, "", "advertised_cidrs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "local_asn", &obj.LocalAsn) + if err != nil { + err = core.SDKErrorf(err, "", "local_asn-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) @@ -88214,6 +89478,94 @@ func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err return } +// VPNGatewayAdvertisedCIDRCollection : VPNGatewayAdvertisedCIDRCollection struct +type VPNGatewayAdvertisedCIDRCollection struct { + // The additional CIDRs advertised through any enabled routing protocol (for example, BGP). The routing protocol will + // advertise routes with these CIDRs and VPC prefixes as route destinations. + AdvertisedCIDRs []string `json:"advertised_cidrs" validate:"required"` + + // A link to the first page of resources. + First *VPNGatewayAdvertisedCIDRCollectionFirst `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 *VPNGatewayAdvertisedCIDRCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalVPNGatewayAdvertisedCIDRCollection unmarshals an instance of VPNGatewayAdvertisedCIDRCollection from the specified map of raw messages. +func UnmarshalVPNGatewayAdvertisedCIDRCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayAdvertisedCIDRCollection) + err = core.UnmarshalPrimitive(m, "advertised_cidrs", &obj.AdvertisedCIDRs) + if err != nil { + err = core.SDKErrorf(err, "", "advertised_cidrs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNGatewayAdvertisedCIDRCollectionFirst) + 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, UnmarshalVPNGatewayAdvertisedCIDRCollectionNext) + 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 +} + +// VPNGatewayAdvertisedCIDRCollectionFirst : A link to the first page of resources. +type VPNGatewayAdvertisedCIDRCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNGatewayAdvertisedCIDRCollectionFirst unmarshals an instance of VPNGatewayAdvertisedCIDRCollectionFirst from the specified map of raw messages. +func UnmarshalVPNGatewayAdvertisedCIDRCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayAdvertisedCIDRCollectionFirst) + 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 +} + +// VPNGatewayAdvertisedCIDRCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VPNGatewayAdvertisedCIDRCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNGatewayAdvertisedCIDRCollectionNext unmarshals an instance of VPNGatewayAdvertisedCIDRCollectionNext from the specified map of raw messages. +func UnmarshalVPNGatewayAdvertisedCIDRCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayAdvertisedCIDRCollectionNext) + 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 +} + // VPNGatewayCollection : VPNGatewayCollection struct type VPNGatewayCollection struct { // A link to the first page of resources. @@ -88718,6 +90070,254 @@ func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, res return } +// VPNGatewayConnectionDynamicRouteModeLocal : VPNGatewayConnectionDynamicRouteModeLocal struct +type VPNGatewayConnectionDynamicRouteModeLocal struct { + // The local IKE identities. + // + // A VPN gateway in dynamic route mode consists of two members in active-active mode. The first identity applies to the + // first member, and the second identity applies to the second member. + IkeIdentities []VPNGatewayConnectionIkeIdentityIntf `json:"ike_identities" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionDynamicRouteModeLocal unmarshals an instance of VPNGatewayConnectionDynamicRouteModeLocal from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDynamicRouteModeLocal(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDynamicRouteModeLocal) + err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDynamicRouteModeLocalPrototype : VPNGatewayConnectionDynamicRouteModeLocalPrototype struct +type VPNGatewayConnectionDynamicRouteModeLocalPrototype struct { + // The local IKE identities to use. + // + // A VPN gateway in dynamic route mode consists of two members in active-active mode. The first specified identity will + // be applied to the first member, and the second specified identity will be applied to the second member. + // + // If unspecified, then `type` will be `ipv4_address` and `value` will be the public IP address of the member's VPN + // connection tunnel. + IkeIdentities []VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identities,omitempty"` +} + +// UnmarshalVPNGatewayConnectionDynamicRouteModeLocalPrototype unmarshals an instance of VPNGatewayConnectionDynamicRouteModeLocalPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDynamicRouteModeLocalPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDynamicRouteModeLocalPrototype) + err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDynamicRouteModePeer : VPNGatewayConnectionDynamicRouteModePeer struct +// Models which "extend" this model: +// - VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress +// - VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn +type VPNGatewayConnectionDynamicRouteModePeer struct { + // The peer autonomous system number (ASN) for this VPN gateway connection. + Asn *int64 `json:"asn" validate:"required"` + + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionDynamicRouteModePeer.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionDynamicRouteModePeerTypeAddressConst = "address" + VPNGatewayConnectionDynamicRouteModePeerTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionDynamicRouteModePeer) isaVPNGatewayConnectionDynamicRouteModePeer() bool { + return true +} + +type VPNGatewayConnectionDynamicRouteModePeerIntf interface { + isaVPNGatewayConnectionDynamicRouteModePeer() bool +} + +// UnmarshalVPNGatewayConnectionDynamicRouteModePeer unmarshals an instance of VPNGatewayConnectionDynamicRouteModePeer from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDynamicRouteModePeer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDynamicRouteModePeer) + err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) + if err != nil { + err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDynamicRouteModePeerPrototype : VPNGatewayConnectionDynamicRouteModePeerPrototype struct +// Models which "extend" this model: +// - VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress +// - VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn +type VPNGatewayConnectionDynamicRouteModePeerPrototype struct { + // The peer autonomous system number (ASN) for this VPN gateway connection. + Asn *int64 `json:"asn" validate:"required"` + + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and + // the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` + // will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionDynamicRouteModePeerPrototype) isaVPNGatewayConnectionDynamicRouteModePeerPrototype() bool { + return true +} + +type VPNGatewayConnectionDynamicRouteModePeerPrototypeIntf interface { + isaVPNGatewayConnectionDynamicRouteModePeerPrototype() bool +} + +// UnmarshalVPNGatewayConnectionDynamicRouteModePeerPrototype unmarshals an instance of VPNGatewayConnectionDynamicRouteModePeerPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDynamicRouteModePeerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDynamicRouteModePeerPrototype) + err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) + if err != nil { + err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDynamicRouteModeTunnel : VPNGatewayConnectionDynamicRouteModeTunnel struct +type VPNGatewayConnectionDynamicRouteModeTunnel struct { + // The IP address of the neighbor on the virtual tunnel interface. + NeighborIP *IP `json:"neighbor_ip" validate:"required"` + + // BGP routing protocol state. + ProtocolState *string `json:"protocol_state,omitempty"` + + // The IP address of the VPN gateway member in which the tunnel resides. + PublicIP *IP `json:"public_ip" validate:"required"` + + // The status of the VPN Tunnel. + Status *string `json:"status" validate:"required"` + + // The reasons for the current status (if any). + StatusReasons []VPNGatewayConnectionTunnelStatusReason `json:"status_reasons" validate:"required"` + + // The IP address of the virtual tunnel interface. + TunnelInterfaceIP *IP `json:"tunnel_interface_ip" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionDynamicRouteModeTunnel.ProtocolState property. +// BGP routing protocol state. +const ( + VPNGatewayConnectionDynamicRouteModeTunnelProtocolStateActiveConst = "active" + VPNGatewayConnectionDynamicRouteModeTunnelProtocolStateConnectConst = "connect" + VPNGatewayConnectionDynamicRouteModeTunnelProtocolStateEstablishedConst = "established" + VPNGatewayConnectionDynamicRouteModeTunnelProtocolStateIdleConst = "idle" + VPNGatewayConnectionDynamicRouteModeTunnelProtocolStateOpenConfirmConst = "open_confirm" + VPNGatewayConnectionDynamicRouteModeTunnelProtocolStateOpenSentConst = "open_sent" +) + +// Constants associated with the VPNGatewayConnectionDynamicRouteModeTunnel.Status property. +// The status of the VPN Tunnel. +const ( + VPNGatewayConnectionDynamicRouteModeTunnelStatusDownConst = "down" + VPNGatewayConnectionDynamicRouteModeTunnelStatusUpConst = "up" +) + +// UnmarshalVPNGatewayConnectionDynamicRouteModeTunnel unmarshals an instance of VPNGatewayConnectionDynamicRouteModeTunnel from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDynamicRouteModeTunnel(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDynamicRouteModeTunnel) + err = core.UnmarshalModel(m, "neighbor_ip", &obj.NeighborIP, UnmarshalIP) + if err != nil { + err = core.SDKErrorf(err, "", "neighbor_ip-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "protocol_state", &obj.ProtocolState) + if err != nil { + err = core.SDKErrorf(err, "", "protocol_state-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) + if err != nil { + err = core.SDKErrorf(err, "", "public_ip-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, UnmarshalVPNGatewayConnectionTunnelStatusReason) + if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "tunnel_interface_ip", &obj.TunnelInterfaceIP, UnmarshalIP) + if err != nil { + err = core.SDKErrorf(err, "", "tunnel_interface_ip-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNGatewayConnectionIkeIdentity : VPNGatewayConnectionIkeIdentity struct // Models which "extend" this model: // - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn @@ -89004,6 +90604,16 @@ type VPNGatewayConnectionPatch struct { // The pre-shared key. Psk *string `json:"psk,omitempty"` + + // The routing protocol for this VPN gateway connection. For this property to be specified, `mode` must be `route`. + // + // - `none`: No routing protocol will be used. + // - `bgp`: The BGP routing protocol will be used. + RoutingProtocol *string `json:"routing_protocol,omitempty"` + + // The VPN tunnel configuration to use for this VPN gateway connection + // (in dynamic route mode). + Tunnels []VPNGatewayConnectionTunnel `json:"tunnels,omitempty"` } // Constants associated with the VPNGatewayConnectionPatch.EstablishMode property. @@ -89019,6 +90629,16 @@ const ( VPNGatewayConnectionPatchEstablishModePeerOnlyConst = "peer_only" ) +// Constants associated with the VPNGatewayConnectionPatch.RoutingProtocol property. +// The routing protocol for this VPN gateway connection. For this property to be specified, `mode` must be `route`. +// +// - `none`: No routing protocol will be used. +// - `bgp`: The BGP routing protocol will be used. +const ( + VPNGatewayConnectionPatchRoutingProtocolBgpConst = "bgp" + VPNGatewayConnectionPatchRoutingProtocolNoneConst = "none" +) + // UnmarshalVPNGatewayConnectionPatch unmarshals an instance of VPNGatewayConnectionPatch from the specified map of raw messages. func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VPNGatewayConnectionPatch) @@ -89062,6 +90682,16 @@ func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionTunnel) + if err != nil { + err = core.SDKErrorf(err, "", "tunnels-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -89083,12 +90713,16 @@ func (vpnGatewayConnectionPatch *VPNGatewayConnectionPatch) AsPatch() (_patch ma // Models which "extend" this model: // - VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch // - VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch type VPNGatewayConnectionPeerPatch struct { // The IP address of the peer VPN gateway for this connection. Address *string `json:"address,omitempty"` // The FQDN of the peer VPN gateway for this connection. Fqdn *string `json:"fqdn,omitempty"` + + // The peer autonomous system number (ASN) for this VPN gateway connection. + Asn *int64 `json:"asn,omitempty"` } func (*VPNGatewayConnectionPeerPatch) isaVPNGatewayConnectionPeerPatch() bool { @@ -89112,6 +90746,11 @@ func UnmarshalVPNGatewayConnectionPeerPatch(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) + if err != nil { + err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -89318,6 +90957,7 @@ func UnmarshalVPNGatewayConnectionPolicyModePeerPrototype(m map[string]json.RawM // VPNGatewayConnectionPrototype : VPNGatewayConnectionPrototype struct // Models which "extend" this model: // - VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype +// - VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype // - VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype type VPNGatewayConnectionPrototype struct { // If set to false, the VPN gateway connection is shut down. @@ -89356,6 +90996,10 @@ type VPNGatewayConnectionPrototype struct { // Routing protocols are disabled for this VPN gateway connection. RoutingProtocol *string `json:"routing_protocol,omitempty"` + + // The VPN tunnel configuration to use for this VPN gateway connection + // (in dynamic route mode). + Tunnels []VPNGatewayConnectionTunnelPrototype `json:"tunnels,omitempty"` } // Constants associated with the VPNGatewayConnectionPrototype.EstablishMode property. @@ -89438,6 +91082,11 @@ func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionTunnelPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "tunnels-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -89767,6 +91416,71 @@ func UnmarshalVPNGatewayConnectionStatusReason(m map[string]json.RawMessage, res return } +// VPNGatewayConnectionTunnel : VPNGatewayConnectionTunnel struct +type VPNGatewayConnectionTunnel struct { + // The IP address of the neighbor on the virtual tunnel interface. + NeighborIP *IP `json:"neighbor_ip,omitempty"` + + // The IP address of the virtual tunnel interface. + TunnelInterfaceIP *IP `json:"tunnel_interface_ip,omitempty"` +} + +// UnmarshalVPNGatewayConnectionTunnel unmarshals an instance of VPNGatewayConnectionTunnel from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionTunnel(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionTunnel) + err = core.UnmarshalModel(m, "neighbor_ip", &obj.NeighborIP, UnmarshalIP) + if err != nil { + err = core.SDKErrorf(err, "", "neighbor_ip-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "tunnel_interface_ip", &obj.TunnelInterfaceIP, UnmarshalIP) + if err != nil { + err = core.SDKErrorf(err, "", "tunnel_interface_ip-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionTunnelPrototype : VPNGatewayConnectionTunnelPrototype struct +type VPNGatewayConnectionTunnelPrototype struct { + // The IP address of the neighbor on the virtual tunnel interface. + NeighborIP *IP `json:"neighbor_ip" validate:"required"` + + // The IP address of the virtual tunnel interface. + TunnelInterfaceIP *IP `json:"tunnel_interface_ip" validate:"required"` +} + +// NewVPNGatewayConnectionTunnelPrototype : Instantiate VPNGatewayConnectionTunnelPrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionTunnelPrototype(neighborIP *IP, tunnelInterfaceIP *IP) (_model *VPNGatewayConnectionTunnelPrototype, err error) { + _model = &VPNGatewayConnectionTunnelPrototype{ + NeighborIP: neighborIP, + TunnelInterfaceIP: tunnelInterfaceIP, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalVPNGatewayConnectionTunnelPrototype unmarshals an instance of VPNGatewayConnectionTunnelPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionTunnelPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionTunnelPrototype) + err = core.UnmarshalModel(m, "neighbor_ip", &obj.NeighborIP, UnmarshalIP) + if err != nil { + err = core.SDKErrorf(err, "", "neighbor_ip-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "tunnel_interface_ip", &obj.TunnelInterfaceIP, UnmarshalIP) + if err != nil { + err = core.SDKErrorf(err, "", "tunnel_interface_ip-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNGatewayConnectionTunnelStatusReason : VPNGatewayConnectionTunnelStatusReason struct type VPNGatewayConnectionTunnelStatusReason struct { // A reason code for this status: @@ -89853,6 +91567,7 @@ type VPNGatewayHealthReason struct { // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's // subnet) + // - `transit_gateway_connection_down`: Connection to transit gateway is down // - `internal_error`: Internal error (contact IBM support) // // The enumerated values for this property may @@ -89871,14 +91586,16 @@ type VPNGatewayHealthReason struct { // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's // subnet) +// - `transit_gateway_connection_down`: Connection to transit gateway is down // - `internal_error`: Internal error (contact IBM support) // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - VPNGatewayHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route" - VPNGatewayHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" - VPNGatewayHealthReasonCodeInternalErrorConst = "internal_error" + VPNGatewayHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route" + VPNGatewayHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" + VPNGatewayHealthReasonCodeInternalErrorConst = "internal_error" + VPNGatewayHealthReasonCodeTransitGatewayConnectionDownConst = "transit_gateway_connection_down" ) // UnmarshalVPNGatewayHealthReason unmarshals an instance of VPNGatewayHealthReason from the specified map of raw messages. @@ -90172,6 +91889,9 @@ func UnmarshalVPNGatewayMemberLifecycleReason(m map[string]json.RawMessage, resu // VPNGatewayPatch : VPNGatewayPatch struct type VPNGatewayPatch struct { + // The local autonomous system number (ASN) for this VPN gateway and its connections. + LocalAsn *int64 `json:"local_asn,omitempty"` + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. Name *string `json:"name,omitempty"` } @@ -90179,6 +91899,11 @@ type VPNGatewayPatch struct { // UnmarshalVPNGatewayPatch unmarshals an instance of VPNGatewayPatch from the specified map of raw messages. func UnmarshalVPNGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VPNGatewayPatch) + err = core.UnmarshalPrimitive(m, "local_asn", &obj.LocalAsn) + if err != nil { + err = core.SDKErrorf(err, "", "local_asn-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) @@ -90217,6 +91942,13 @@ type VPNGatewayPrototype struct { // Identifies a subnet by a unique property. Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + // The additional CIDRs advertised through any enabled routing protocol (for example, BGP). The routing protocol will + // advertise routes with these CIDRs and VPC prefixes as route destinations. + AdvertisedCIDRs []string `json:"advertised_cidrs,omitempty"` + + // The local autonomous system number (ASN) for this VPN gateway and its connections. + LocalAsn *int64 `json:"local_asn,omitempty"` + // Route mode VPN gateway. Mode *string `json:"mode,omitempty"` } @@ -90253,6 +91985,16 @@ func UnmarshalVPNGatewayPrototype(m map[string]json.RawMessage, result interface err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "advertised_cidrs", &obj.AdvertisedCIDRs) + if err != nil { + err = core.SDKErrorf(err, "", "advertised_cidrs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "local_asn", &obj.LocalAsn) + if err != nil { + err = core.SDKErrorf(err, "", "local_asn-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) @@ -90281,6 +92023,186 @@ func UnmarshalVPNGatewayReferenceDeleted(m map[string]json.RawMessage, result in return } +// VPNRouteReport : VPNRouteReport struct +type VPNRouteReport struct { + // The date and time that this route report was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The unique identifier for this route report. + ID *string `json:"id" validate:"required"` + + // The routes of this report. + Routes []VPNRouteReportRoute `json:"routes" validate:"required"` + + // Route report status. The list of enumerated values for this property may expand in the future. Code and processes + // using this field must tolerate unexpected values. + // - `pending`: generic routing encapsulation tunnel attached + // - `complete`: generic routing encapsulation tunnel detached. + Status *string `json:"status" validate:"required"` + + // The date and time that this route report was updated. + UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` +} + +// Constants associated with the VPNRouteReport.Status property. +// Route report status. The list of enumerated values for this property may expand in the future. Code and processes +// using this field must tolerate unexpected values. +// - `pending`: generic routing encapsulation tunnel attached +// - `complete`: generic routing encapsulation tunnel detached. +const ( + VPNRouteReportStatusCompleteConst = "complete" + VPNRouteReportStatusPendingConst = "pending" +) + +// UnmarshalVPNRouteReport unmarshals an instance of VPNRouteReport from the specified map of raw messages. +func UnmarshalVPNRouteReport(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNRouteReport) + 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, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalVPNRouteReportRoute) + if err != nil { + err = core.SDKErrorf(err, "", "routes-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.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNRouteReportCollection : VPNRouteReportCollection struct +type VPNRouteReportCollection struct { + // Collection of VPN gateway route reports. + RouteReports []VPNRouteReport `json:"route_reports" validate:"required"` +} + +// UnmarshalVPNRouteReportCollection unmarshals an instance of VPNRouteReportCollection from the specified map of raw messages. +func UnmarshalVPNRouteReportCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNRouteReportCollection) + err = core.UnmarshalModel(m, "route_reports", &obj.RouteReports, UnmarshalVPNRouteReport) + if err != nil { + err = core.SDKErrorf(err, "", "route_reports-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNRouteReportRoute : VPNRouteReportRoute struct +type VPNRouteReportRoute struct { + // AS path numbers of this route. + AsPath []int64 `json:"as_path" validate:"required"` + + // Indicates whether this route is best path. + BestPath *bool `json:"best_path" validate:"required"` + + // Next hop list of this route. + NextHops []VPNRouteReportRouteNextHop `json:"next_hops" validate:"required"` + + // The peer of this route. + Peer *string `json:"peer" validate:"required"` + + // The destination of this route. + Prefix *string `json:"prefix" validate:"required"` + + // Indicates whether this route is valid. + Valid *bool `json:"valid" validate:"required"` + + // Weight of this route. + Weight *int64 `json:"weight" validate:"required"` +} + +// UnmarshalVPNRouteReportRoute unmarshals an instance of VPNRouteReportRoute from the specified map of raw messages. +func UnmarshalVPNRouteReportRoute(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNRouteReportRoute) + err = core.UnmarshalPrimitive(m, "as_path", &obj.AsPath) + if err != nil { + err = core.SDKErrorf(err, "", "as_path-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "best_path", &obj.BestPath) + if err != nil { + err = core.SDKErrorf(err, "", "best_path-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "next_hops", &obj.NextHops, UnmarshalVPNRouteReportRouteNextHop) + if err != nil { + err = core.SDKErrorf(err, "", "next_hops-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "peer", &obj.Peer) + if err != nil { + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "prefix", &obj.Prefix) + if err != nil { + err = core.SDKErrorf(err, "", "prefix-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "valid", &obj.Valid) + if err != nil { + err = core.SDKErrorf(err, "", "valid-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) + if err != nil { + err = core.SDKErrorf(err, "", "weight-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNRouteReportRouteNextHop : VPNRouteReportRouteNextHop struct +type VPNRouteReportRouteNextHop struct { + // A unicast IP address, which must not be any of the following values: + // + // - `0.0.0.0` (the sentinel IP address) + // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) + // - `255.255.255.255` (the broadcast IP address) + // + // 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 next hop is used for traffic forward. + Used *bool `json:"used" validate:"required"` +} + +// UnmarshalVPNRouteReportRouteNextHop unmarshals an instance of VPNRouteReportRouteNextHop from the specified map of raw messages. +func UnmarshalVPNRouteReportRouteNextHop(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNRouteReportRouteNextHop) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "used", &obj.Used) + if err != nil { + err = core.SDKErrorf(err, "", "used-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNServer : VPNServer struct type VPNServer struct { // The certificate instance for this VPN server. @@ -101547,6 +103469,9 @@ type FlowLogCollectorTargetInstanceNetworkAttachmentReference struct { // The subnet of the virtual network interface for the instance network attachment. Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The virtual network interface for this instance network attachment. + VirtualNetworkInterface *VirtualNetworkInterfaceReferenceAttachmentContext `json:"virtual_network_interface" validate:"required"` } // Constants associated with the FlowLogCollectorTargetInstanceNetworkAttachmentReference.ResourceType property. @@ -101597,6 +103522,11 @@ func UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference(m map[str 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 } @@ -109324,7 +111254,23 @@ type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLP // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code,omitempty"` - // The redirect target URL. + // The redirect target URL. The URL supports [RFC 6570 level 1 + // expressions](https://datatracker.ietf.org/doc/html/rfc6570#section-1.2) for the following variables which expand to + // values from the originally requested URL (or the indicated defaults if the request did not include them): + // + // - `protocol` + // - `host` + // - `port` (default: `80` for HTTP requests, `443` for HTTPS requests) + // - `path` (default: '/') + // - `query` (default: '') + // + // The protocol, host, and port segments of the URL, must only contain at most one instance of the `protocol`, `host`, + // and `port` variables, respectively. The path and query segments of the URL may contain any combination of variables. + // If the substitution of `path` results in consecutive leading slashes, the leading slash from the substitution will + // be removed. Additional examples: + // - `https://{host}:8080/{port}/{host}/{path}` + // - `https://www.example.com` + // - `{protocol}://test.{host}:80/{path}`. URL *string `json:"url,omitempty"` } @@ -109450,7 +111396,23 @@ type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirect // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - // The redirect target URL. + // The redirect target URL. The URL supports [RFC 6570 level 1 + // expressions](https://datatracker.ietf.org/doc/html/rfc6570#section-1.2) for the following variables which expand to + // values from the originally requested URL (or the indicated defaults if the request did not include them): + // + // - `protocol` + // - `host` + // - `port` (default: `80` for HTTP requests, `443` for HTTPS requests) + // - `path` (default: '/') + // - `query` (default: '') + // + // The protocol, host, and port segments of the URL, must only contain at most one instance of the `protocol`, `host`, + // and `port` variables, respectively. The path and query segments of the URL may contain any combination of variables. + // If the substitution of `path` results in consecutive leading slashes, the leading slash from the substitution will + // be removed. Additional examples: + // - `https://{host}:8080/{port}/{host}/{path}` + // - `https://www.example.com` + // - `{protocol}://test.{host}:80/{path}`. URL *string `json:"url" validate:"required"` } @@ -109575,7 +111537,23 @@ type LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struc // The HTTP status code for this redirect. HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` - // The redirect target URL. + // The redirect target URL. The URL supports [RFC 6570 level 1 + // expressions](https://datatracker.ietf.org/doc/html/rfc6570#section-1.2) for the following variables which expand to + // values from the originally requested URL (or the indicated defaults if the request did not include them): + // + // - `protocol` + // - `host` + // - `port` (default: `80` for HTTP requests, `443` for HTTPS requests) + // - `path` (default: '/') + // - `query` (default: '') + // + // The protocol, host, and port segments of the URL, must only contain at most one instance of the `protocol`, `host`, + // and `port` variables, respectively. The path and query segments of the URL may contain any combination of variables. + // If the substitution of `path` results in consecutive leading slashes, the leading slash from the substitution will + // be removed. Additional examples: + // - `https://{host}:8080/{port}/{host}/{path}` + // - `https://www.example.com` + // - `{protocol}://test.{host}:80/{path}`. URL *string `json:"url" validate:"required"` } @@ -118549,6 +120527,226 @@ func UnmarshalVPCIdentityByID(m map[string]json.RawMessage, result interface{}) return } +// VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress struct +// This model "extends" VPNGatewayConnectionDynamicRouteModePeerPrototype +type VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress struct { + // The peer autonomous system number (ASN) for this VPN gateway connection. + Asn *int64 `json:"asn" validate:"required"` + + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address" validate:"required"` +} + +// NewVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress : Instantiate VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress(asn int64, address string) (_model *VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress, err error) { + _model = &VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress{ + Asn: core.Int64Ptr(asn), + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionDynamicRouteModePeerPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress) + err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) + if err != nil { + err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct +// This model "extends" VPNGatewayConnectionDynamicRouteModePeerPrototype +type VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct { + // The peer autonomous system number (ASN) for this VPN gateway connection. + Asn *int64 `json:"asn" validate:"required"` + + // The peer IKE identity to use. + // + // If unspecified: + // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. + // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. + IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn" validate:"required"` +} + +// NewVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn : Instantiate VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn(asn int64, fqdn string) (_model *VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn, err error) { + _model = &VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn{ + Asn: core.Int64Ptr(asn), + Fqdn: core.StringPtr(fqdn), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionDynamicRouteModePeerPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn) + err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) + if err != nil { + err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress struct +// This model "extends" VPNGatewayConnectionDynamicRouteModePeer +type VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress struct { + // The peer autonomous system number (ASN) for this VPN gateway connection. + Asn *int64 `json:"asn" validate:"required"` + + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddressTypeAddressConst = "address" + VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddressTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionDynamicRouteModePeer() bool { + return true +} + +// UnmarshalVPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress) + err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) + if err != nil { + err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn struct +// This model "extends" VPNGatewayConnectionDynamicRouteModePeer +type VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn struct { + // The peer autonomous system number (ASN) for this VPN gateway connection. + Asn *int64 `json:"asn" validate:"required"` + + // The peer IKE identity. + IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` + + // Indicates whether `peer.address` or `peer.fqdn` is used. + Type *string `json:"type" validate:"required"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn.Type property. +// Indicates whether `peer.address` or `peer.fqdn` is used. +const ( + VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdnTypeAddressConst = "address" + VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdnTypeFqdnConst = "fqdn" +) + +func (*VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionDynamicRouteModePeer() bool { + return true +} + +// UnmarshalVPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn) + err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) + if err != nil { + err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "ike_identity-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, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn struct // This model "extends" VPNGatewayConnectionIkeIdentityPrototype type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn struct { @@ -119225,6 +121423,58 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(m return } +// VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch : 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: +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch +// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch +// This model "extends" VPNGatewayConnectionPeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch struct { + // The peer autonomous system number (ASN) for this VPN gateway connection. + Asn *int64 `json:"asn,omitempty"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch() bool { + return true +} + +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchIntf interface { + VPNGatewayConnectionPeerPatchIntf + isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch() bool +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch) + err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) + if err != nil { + err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch : 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: @@ -119728,6 +121978,146 @@ func UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn(m return } +// VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype struct +// This model "extends" VPNGatewayConnectionPrototype +type VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode,omitempty"` + + IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` + + IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` + + // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The pre-shared key. + Psk *string `json:"psk" validate:"required"` + + Local *VPNGatewayConnectionDynamicRouteModeLocalPrototype `json:"local,omitempty"` + + Peer VPNGatewayConnectionDynamicRouteModePeerPrototypeIntf `json:"peer" validate:"required"` + + // The enabled routing protocol for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol" validate:"required"` + + // The VPN tunnel configuration to use for this VPN gateway connection + // (in dynamic route mode). + Tunnels []VPNGatewayConnectionTunnelPrototype `json:"tunnels" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototypeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototypeEstablishModePeerOnlyConst = "peer_only" +) + +// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype.RoutingProtocol property. +// The enabled routing protocol for this VPN gateway connection. +const ( + VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototypeRoutingProtocolBgpConst = "bgp" +) + +// NewVPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype(psk string, peer VPNGatewayConnectionDynamicRouteModePeerPrototypeIntf, routingProtocol string, tunnels []VPNGatewayConnectionTunnelPrototype) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype, err error) { + _model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype{ + Psk: core.StringPtr(psk), + Peer: peer, + RoutingProtocol: core.StringPtr(routingProtocol), + Tunnels: tunnels, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype) isaVPNGatewayConnectionPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype unmarshals an instance of VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-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, "psk", &obj.Psk) + if err != nil { + err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionDynamicRouteModeLocalPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionDynamicRouteModePeerPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionTunnelPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "tunnels-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct // This model "extends" VPNGatewayConnectionPrototype type VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct { @@ -119976,6 +122366,7 @@ func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePr // VPNGatewayConnectionRouteMode : VPNGatewayConnectionRouteMode struct // Models which "extend" this model: // - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode +// - VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode // This model "extends" VPNGatewayConnection type VPNGatewayConnectionRouteMode struct { // If set to false, the VPN gateway connection is shut down. @@ -120113,7 +122504,12 @@ func UnmarshalVPNGatewayConnectionRouteMode(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "required discriminator property 'routing_protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } - if discValue == "none" { + if discValue == "bgp" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode-error", common.GetComponentInfo()) + } + } else if discValue == "none" { err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode-error", common.GetComponentInfo()) @@ -120489,319 +122885,353 @@ func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interfac err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayPrototypeVPNGatewayPolicyModePrototype : VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct -// This model "extends" VPNGatewayPrototype -type VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct { - // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - - // Policy mode VPN gateway. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the VPNGatewayPrototypeVPNGatewayPolicyModePrototype.Mode property. -// Policy mode VPN gateway. -const ( - VPNGatewayPrototypeVPNGatewayPolicyModePrototypeModePolicyConst = "policy" -) - -// NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayPolicyModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayPolicyModePrototype, err error) { - _model = &VPNGatewayPrototypeVPNGatewayPolicyModePrototype{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayPrototypeVPNGatewayPolicyModePrototype) isaVPNGatewayPrototype() bool { - return true -} - -// UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayPolicyModePrototype from the specified map of raw messages. -func UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPrototypeVPNGatewayPolicyModePrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayPrototypeVPNGatewayRouteModePrototype : VPNGatewayPrototypeVPNGatewayRouteModePrototype struct -// This model "extends" VPNGatewayPrototype -type VPNGatewayPrototypeVPNGatewayRouteModePrototype struct { - // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - - // Route mode VPN gateway. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the VPNGatewayPrototypeVPNGatewayRouteModePrototype.Mode property. -// Route mode VPN gateway. -const ( - VPNGatewayPrototypeVPNGatewayRouteModePrototypeModeRouteConst = "route" -) - -// NewVPNGatewayPrototypeVPNGatewayRouteModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayRouteModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayRouteModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayRouteModePrototype, err error) { - _model = &VPNGatewayPrototypeVPNGatewayRouteModePrototype{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPrototypeVPNGatewayPolicyModePrototype : VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct +// This model "extends" VPNGatewayPrototype +type VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct { + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Policy mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototypeVPNGatewayPolicyModePrototype.Mode property. +// Policy mode VPN gateway. +const ( + VPNGatewayPrototypeVPNGatewayPolicyModePrototypeModePolicyConst = "policy" +) + +// NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayPolicyModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayPolicyModePrototype, err error) { + _model = &VPNGatewayPrototypeVPNGatewayPolicyModePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayPrototypeVPNGatewayPolicyModePrototype) isaVPNGatewayPrototype() bool { + return true +} + +// UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayPolicyModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototypeVPNGatewayPolicyModePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPrototypeVPNGatewayRouteModePrototype : VPNGatewayPrototypeVPNGatewayRouteModePrototype struct +// This model "extends" VPNGatewayPrototype +type VPNGatewayPrototypeVPNGatewayRouteModePrototype struct { + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // The additional CIDRs advertised through any enabled routing protocol (for example, BGP). The routing protocol will + // advertise routes with these CIDRs and VPC prefixes as route destinations. + AdvertisedCIDRs []string `json:"advertised_cidrs,omitempty"` + + // The local autonomous system number (ASN) for this VPN gateway and its connections. + LocalAsn *int64 `json:"local_asn,omitempty"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototypeVPNGatewayRouteModePrototype.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayPrototypeVPNGatewayRouteModePrototypeModeRouteConst = "route" +) + +// NewVPNGatewayPrototypeVPNGatewayRouteModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayRouteModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayRouteModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayRouteModePrototype, err error) { + _model = &VPNGatewayPrototypeVPNGatewayRouteModePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayPrototypeVPNGatewayRouteModePrototype) isaVPNGatewayPrototype() bool { + return true +} + +// UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayRouteModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototypeVPNGatewayRouteModePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "advertised_cidrs", &obj.AdvertisedCIDRs) + if err != nil { + err = core.SDKErrorf(err, "", "advertised_cidrs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "local_asn", &obj.LocalAsn) + if err != nil { + err = core.SDKErrorf(err, "", "local_asn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayRouteMode : VPNGatewayRouteMode struct +// This model "extends" VPNGateway +type VPNGatewayRouteMode struct { + // Connections for this VPN gateway. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // The reasons for the current `health_state` (if any). + HealthReasons []VPNGatewayHealthReason `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 VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the VPN gateway. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPN gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The VPC this VPN gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The additional CIDRs advertised through any enabled routing protocol (for example, BGP). The routing protocol will + // advertise routes with these CIDRs and VPC prefixes as route destinations. + AdvertisedCIDRs []string `json:"advertised_cidrs" validate:"required"` + + // The local autonomous system number (ASN) for this VPN gateway and its connections. + LocalAsn *int64 `json:"local_asn" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode" validate:"required"` +} + +// Constants associated with the VPNGatewayRouteMode.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 ( + VPNGatewayRouteModeHealthStateDegradedConst = "degraded" + VPNGatewayRouteModeHealthStateFaultedConst = "faulted" + VPNGatewayRouteModeHealthStateInapplicableConst = "inapplicable" + VPNGatewayRouteModeHealthStateOkConst = "ok" +) + +// Constants associated with the VPNGatewayRouteMode.LifecycleState property. +// The lifecycle state of the VPN gateway. +const ( + VPNGatewayRouteModeLifecycleStateDeletingConst = "deleting" + VPNGatewayRouteModeLifecycleStateFailedConst = "failed" + VPNGatewayRouteModeLifecycleStatePendingConst = "pending" + VPNGatewayRouteModeLifecycleStateStableConst = "stable" + VPNGatewayRouteModeLifecycleStateSuspendedConst = "suspended" + VPNGatewayRouteModeLifecycleStateUpdatingConst = "updating" + VPNGatewayRouteModeLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNGatewayRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayRouteModeResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGatewayRouteMode.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayRouteModeModeRouteConst = "route" +) + +func (*VPNGatewayRouteMode) isaVPNGateway() bool { + return true +} + +// UnmarshalVPNGatewayRouteMode unmarshals an instance of VPNGatewayRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayRouteMode) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + err = core.SDKErrorf(err, "", "connections-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, "crn", &obj.CRN) + if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) + 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) + 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.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + err = core.SDKErrorf(err, "", "members-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, "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, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + err = core.SDKErrorf(err, "", "subnet-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.UnmarshalPrimitive(m, "advertised_cidrs", &obj.AdvertisedCIDRs) if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayPrototypeVPNGatewayRouteModePrototype) isaVPNGatewayPrototype() bool { - return true -} - -// UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayRouteModePrototype from the specified map of raw messages. -func UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPrototypeVPNGatewayRouteModePrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "advertised_cidrs-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalPrimitive(m, "local_asn", &obj.LocalAsn) if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayRouteMode : VPNGatewayRouteMode struct -// This model "extends" VPNGateway -type VPNGatewayRouteMode struct { - // Connections for this VPN gateway. - Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` - - // The date and time that this VPN gateway was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` - - // The reasons for the current `health_state` (if any). - HealthReasons []VPNGatewayHealthReason `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 VPN gateway's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway. - ID *string `json:"id" validate:"required"` - - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the VPN gateway. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // Collection of VPN gateway members. - Members []VPNGatewayMember `json:"members" validate:"required"` - - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this VPN gateway. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The VPC this VPN gateway resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // Route mode VPN gateway. - Mode *string `json:"mode" validate:"required"` -} - -// Constants associated with the VPNGatewayRouteMode.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 ( - VPNGatewayRouteModeHealthStateDegradedConst = "degraded" - VPNGatewayRouteModeHealthStateFaultedConst = "faulted" - VPNGatewayRouteModeHealthStateInapplicableConst = "inapplicable" - VPNGatewayRouteModeHealthStateOkConst = "ok" -) - -// Constants associated with the VPNGatewayRouteMode.LifecycleState property. -// The lifecycle state of the VPN gateway. -const ( - VPNGatewayRouteModeLifecycleStateDeletingConst = "deleting" - VPNGatewayRouteModeLifecycleStateFailedConst = "failed" - VPNGatewayRouteModeLifecycleStatePendingConst = "pending" - VPNGatewayRouteModeLifecycleStateStableConst = "stable" - VPNGatewayRouteModeLifecycleStateSuspendedConst = "suspended" - VPNGatewayRouteModeLifecycleStateUpdatingConst = "updating" - VPNGatewayRouteModeLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VPNGatewayRouteMode.ResourceType property. -// The resource type. -const ( - VPNGatewayRouteModeResourceTypeVPNGatewayConst = "vpn_gateway" -) - -// Constants associated with the VPNGatewayRouteMode.Mode property. -// Route mode VPN gateway. -const ( - VPNGatewayRouteModeModeRouteConst = "route" -) - -func (*VPNGatewayRouteMode) isaVPNGateway() bool { - return true -} - -// UnmarshalVPNGatewayRouteMode unmarshals an instance of VPNGatewayRouteMode from the specified map of raw messages. -func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayRouteMode) - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) - if err != nil { - err = core.SDKErrorf(err, "", "connections-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) - 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) - 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.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) - if err != nil { - err = core.SDKErrorf(err, "", "members-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, "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, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) - if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "local_asn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) @@ -130921,6 +133351,76 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte return } +// VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch struct +// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch struct { + // The peer autonomous system number (ASN) for this VPN gateway connection. + Asn *int64 `json:"asn,omitempty"` + + // The IP address of the peer VPN gateway for this connection. + Address *string `json:"address,omitempty"` +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch() bool { + return true +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) + err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) + if err != nil { + err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct +// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch +type VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct { + // The peer autonomous system number (ASN) for this VPN gateway connection. + Asn *int64 `json:"asn,omitempty"` + + // The FQDN of the peer VPN gateway for this connection. + Fqdn *string `json:"fqdn,omitempty"` +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch() bool { + return true +} + +func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) + err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) + if err != nil { + err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) + if err != nil { + err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch struct // This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch struct { @@ -131029,6 +133529,227 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePe return } +// VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode : VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode struct +// This model "extends" VPNGatewayConnectionRouteMode +type VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The establish mode of the VPN gateway connection: + // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol + // negotiations or rekeying processes. + // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway + // connection. Additionally, the peer is responsible for initiating the rekeying process + // after the connection is established. If rekeying does not occur, the VPN gateway + // connection will be brought down after its lifetime expires. + EstablishMode *string `json:"establish_mode" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The IKE policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // The IPsec policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. + Name *string `json:"name" validate:"required"` + + // The pre-shared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // The reasons for the current VPN gateway connection status (if any). + StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + + Local *VPNGatewayConnectionDynamicRouteModeLocal `json:"local" validate:"required"` + + Peer VPNGatewayConnectionDynamicRouteModePeerIntf `json:"peer" validate:"required"` + + // The enabled routing protocol for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol" validate:"required"` + + // The VPN tunnel configuration for this VPN gateway connection (in dynamic route mode). + Tunnels []VPNGatewayConnectionDynamicRouteModeTunnel `json:"tunnels" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode.EstablishMode property. +// The establish mode of the VPN gateway connection: +// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol +// negotiations or rekeying processes. +// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway +// connection. Additionally, the peer is responsible for initiating the rekeying process +// after the connection is established. If rekeying does not occur, the VPN gateway +// connection will be brought down after its lifetime expires. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeEstablishModeBidirectionalConst = "bidirectional" + VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeEstablishModePeerOnlyConst = "peer_only" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeModePolicyConst = "policy" + VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeStatusDownConst = "down" + VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeStatusUpConst = "up" +) + +// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode.RoutingProtocol property. +// The enabled routing protocol for this VPN gateway connection. +const ( + VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeRoutingProtocolBgpConst = "bgp" +) + +func (*VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode) isaVPNGatewayConnectionRouteMode() bool { + return true +} + +func (*VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode) isaVPNGatewayConnection() bool { + return true +} + +// UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode unmarshals an instance of VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + err = core.SDKErrorf(err, "", "authentication_mode-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, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) + if err != nil { + err = core.SDKErrorf(err, "", "establish_mode-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, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + err = core.SDKErrorf(err, "", "ipsec_policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + err = core.SDKErrorf(err, "", "mode-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, "psk", &obj.Psk) + if err != nil { + err = core.SDKErrorf(err, "", "psk-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, "status", &obj.Status) + if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) + if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionDynamicRouteModeLocal) + if err != nil { + err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionDynamicRouteModePeer) + if err != nil { + err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionDynamicRouteModeTunnel) + if err != nil { + err = core.SDKErrorf(err, "", "tunnels-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct // This model "extends" VPNGatewayConnectionRouteMode type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { @@ -131959,25 +134680,25 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt return } -// VpcsPager can be used to simplify the use of the "ListVpcs" method. -type VpcsPager struct { +// VPCAddressPrefixesPager can be used to simplify the use of the "ListVPCAddressPrefixes" method. +type VPCAddressPrefixesPager struct { hasNext bool - options *ListVpcsOptions + options *ListVPCAddressPrefixesOptions client *VpcV1 pageContext struct { next *string } } -// NewVpcsPager returns a new VpcsPager instance. -func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, err error) { +// NewVPCAddressPrefixesPager returns a new VPCAddressPrefixesPager instance. +func (vpc *VpcV1) NewVPCAddressPrefixesPager(options *ListVPCAddressPrefixesOptions) (pager *VPCAddressPrefixesPager, 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 ListVpcsOptions = *options - pager = &VpcsPager{ + var optionsCopy ListVPCAddressPrefixesOptions = *options + pager = &VPCAddressPrefixesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -131986,19 +134707,19 @@ func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, err } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VpcsPager) HasNext() bool { +func (pager *VPCAddressPrefixesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err error) { +func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (page []AddressPrefix, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVpcsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPCAddressPrefixesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132017,16 +134738,16 @@ func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Vpcs + page = result.AddressPrefixes return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, err error) { +func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (allItems []AddressPrefix, err error) { for pager.HasNext() { - var nextPage []VPC + var nextPage []AddressPrefix nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -132038,38 +134759,38 @@ func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VpcsPager) GetNext() (page []VPC, err error) { +func (pager *VPCAddressPrefixesPager) GetNext() (page []AddressPrefix, 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 *VpcsPager) GetAll() (allItems []VPC, err error) { +func (pager *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VPCAddressPrefixesPager can be used to simplify the use of the "ListVPCAddressPrefixes" method. -type VPCAddressPrefixesPager struct { +// VPCDnsResolutionBindingsPager can be used to simplify the use of the "ListVPCDnsResolutionBindings" method. +type VPCDnsResolutionBindingsPager struct { hasNext bool - options *ListVPCAddressPrefixesOptions + options *ListVPCDnsResolutionBindingsOptions client *VpcV1 pageContext struct { next *string } } -// NewVPCAddressPrefixesPager returns a new VPCAddressPrefixesPager instance. -func (vpc *VpcV1) NewVPCAddressPrefixesPager(options *ListVPCAddressPrefixesOptions) (pager *VPCAddressPrefixesPager, err error) { +// NewVPCDnsResolutionBindingsPager returns a new VPCDnsResolutionBindingsPager instance. +func (vpc *VpcV1) NewVPCDnsResolutionBindingsPager(options *ListVPCDnsResolutionBindingsOptions) (pager *VPCDnsResolutionBindingsPager, 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 ListVPCAddressPrefixesOptions = *options - pager = &VPCAddressPrefixesPager{ + var optionsCopy ListVPCDnsResolutionBindingsOptions = *options + pager = &VPCDnsResolutionBindingsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132078,19 +134799,19 @@ func (vpc *VpcV1) NewVPCAddressPrefixesPager(options *ListVPCAddressPrefixesOpti } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCAddressPrefixesPager) HasNext() bool { +func (pager *VPCDnsResolutionBindingsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (page []AddressPrefix, err error) { +func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Context) (page []VpcdnsResolutionBinding, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPCAddressPrefixesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPCDnsResolutionBindingsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132109,16 +134830,16 @@ func (pager *VPCAddressPrefixesPager) GetNextWithContext(ctx context.Context) (p } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.AddressPrefixes + page = result.DnsResolutionBindings return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (allItems []AddressPrefix, err error) { +func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Context) (allItems []VpcdnsResolutionBinding, err error) { for pager.HasNext() { - var nextPage []AddressPrefix + var nextPage []VpcdnsResolutionBinding nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -132130,38 +134851,38 @@ func (pager *VPCAddressPrefixesPager) GetAllWithContext(ctx context.Context) (al } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPCAddressPrefixesPager) GetNext() (page []AddressPrefix, err error) { +func (pager *VPCDnsResolutionBindingsPager) GetNext() (page []VpcdnsResolutionBinding, 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 *VPCAddressPrefixesPager) GetAll() (allItems []AddressPrefix, err error) { +func (pager *VPCDnsResolutionBindingsPager) GetAll() (allItems []VpcdnsResolutionBinding, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VPCDnsResolutionBindingsPager can be used to simplify the use of the "ListVPCDnsResolutionBindings" method. -type VPCDnsResolutionBindingsPager struct { +// VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. +type VPCRoutesPager struct { hasNext bool - options *ListVPCDnsResolutionBindingsOptions + options *ListVPCRoutesOptions client *VpcV1 pageContext struct { next *string } } -// NewVPCDnsResolutionBindingsPager returns a new VPCDnsResolutionBindingsPager instance. -func (vpc *VpcV1) NewVPCDnsResolutionBindingsPager(options *ListVPCDnsResolutionBindingsOptions) (pager *VPCDnsResolutionBindingsPager, err error) { +// NewVPCRoutesPager returns a new VPCRoutesPager instance. +func (vpc *VpcV1) NewVPCRoutesPager(options *ListVPCRoutesOptions) (pager *VPCRoutesPager, 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 ListVPCDnsResolutionBindingsOptions = *options - pager = &VPCDnsResolutionBindingsPager{ + var optionsCopy ListVPCRoutesOptions = *options + pager = &VPCRoutesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132170,19 +134891,19 @@ func (vpc *VpcV1) NewVPCDnsResolutionBindingsPager(options *ListVPCDnsResolution } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCDnsResolutionBindingsPager) HasNext() bool { +func (pager *VPCRoutesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Context) (page []VpcdnsResolutionBinding, err error) { +func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []RouteCollectionVPCContextRoutesItem, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPCDnsResolutionBindingsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPCRoutesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132201,16 +134922,16 @@ func (pager *VPCDnsResolutionBindingsPager) GetNextWithContext(ctx context.Conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.DnsResolutionBindings + page = result.Routes return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Context) (allItems []VpcdnsResolutionBinding, err error) { +func (pager *VPCRoutesPager) GetAllWithContext(ctx context.Context) (allItems []RouteCollectionVPCContextRoutesItem, err error) { for pager.HasNext() { - var nextPage []VpcdnsResolutionBinding + var nextPage []RouteCollectionVPCContextRoutesItem nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -132222,38 +134943,38 @@ func (pager *VPCDnsResolutionBindingsPager) GetAllWithContext(ctx context.Contex } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPCDnsResolutionBindingsPager) GetNext() (page []VpcdnsResolutionBinding, err error) { +func (pager *VPCRoutesPager) GetNext() (page []RouteCollectionVPCContextRoutesItem, 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 *VPCDnsResolutionBindingsPager) GetAll() (allItems []VpcdnsResolutionBinding, err error) { +func (pager *VPCRoutesPager) GetAll() (allItems []RouteCollectionVPCContextRoutesItem, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VPCRoutesPager can be used to simplify the use of the "ListVPCRoutes" method. -type VPCRoutesPager struct { +// VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. +type VPCRoutingTableRoutesPager struct { hasNext bool - options *ListVPCRoutesOptions + options *ListVPCRoutingTableRoutesOptions client *VpcV1 pageContext struct { next *string } } -// NewVPCRoutesPager returns a new VPCRoutesPager instance. -func (vpc *VpcV1) NewVPCRoutesPager(options *ListVPCRoutesOptions) (pager *VPCRoutesPager, err error) { +// NewVPCRoutingTableRoutesPager returns a new VPCRoutingTableRoutesPager instance. +func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRoutesOptions) (pager *VPCRoutingTableRoutesPager, 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 ListVPCRoutesOptions = *options - pager = &VPCRoutesPager{ + var optionsCopy ListVPCRoutingTableRoutesOptions = *options + pager = &VPCRoutingTableRoutesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132262,19 +134983,19 @@ func (vpc *VpcV1) NewVPCRoutesPager(options *ListVPCRoutesOptions) (pager *VPCRo } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCRoutesPager) HasNext() bool { +func (pager *VPCRoutingTableRoutesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCRoutesPager) GetNextWithContext(ctx context.Context) (page []RouteCollectionVPCContextRoutesItem, err error) { +func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) (page []Route, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPCRoutesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPCRoutingTableRoutesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132300,9 +135021,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 *VPCRoutingTableRoutesPager) 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") @@ -132314,14 +135035,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 *VPCRoutingTableRoutesPager) 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 *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -132419,25 +135140,25 @@ func (pager *VPCRoutingTablesPager) GetAll() (allItems []RoutingTable, err error return } -// VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. -type VPCRoutingTableRoutesPager struct { +// VpcsPager can be used to simplify the use of the "ListVpcs" method. +type VpcsPager struct { hasNext bool - options *ListVPCRoutingTableRoutesOptions + options *ListVpcsOptions client *VpcV1 pageContext struct { next *string } } -// NewVPCRoutingTableRoutesPager returns a new VPCRoutingTableRoutesPager instance. -func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRoutesOptions) (pager *VPCRoutingTableRoutesPager, err error) { +// NewVpcsPager returns a new VpcsPager instance. +func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, 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 ListVPCRoutingTableRoutesOptions = *options - pager = &VPCRoutingTableRoutesPager{ + var optionsCopy ListVpcsOptions = *options + pager = &VpcsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132446,19 +135167,19 @@ func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRout } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCRoutingTableRoutesPager) HasNext() bool { +func (pager *VpcsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) (page []Route, err error) { +func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPCRoutingTableRoutesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVpcsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132477,16 +135198,16 @@ func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Routes + page = result.Vpcs return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) (allItems []Route, err error) { +func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, err error) { for pager.HasNext() { - var nextPage []Route + var nextPage []VPC nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -132498,38 +135219,38 @@ func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPCRoutingTableRoutesPager) GetNext() (page []Route, err error) { +func (pager *VpcsPager) GetNext() (page []VPC, 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 *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) { +func (pager *VpcsPager) GetAll() (allItems []VPC, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// SubnetsPager can be used to simplify the use of the "ListSubnets" method. -type SubnetsPager struct { +// SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. +type SubnetReservedIpsPager struct { hasNext bool - options *ListSubnetsOptions + options *ListSubnetReservedIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewSubnetsPager returns a new SubnetsPager instance. -func (vpc *VpcV1) NewSubnetsPager(options *ListSubnetsOptions) (pager *SubnetsPager, err error) { +// NewSubnetReservedIpsPager returns a new SubnetReservedIpsPager instance. +func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOptions) (pager *SubnetReservedIpsPager, 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 ListSubnetsOptions = *options - pager = &SubnetsPager{ + var optionsCopy ListSubnetReservedIpsOptions = *options + pager = &SubnetReservedIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132538,19 +135259,19 @@ func (vpc *VpcV1) NewSubnetsPager(options *ListSubnetsOptions) (pager *SubnetsPa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *SubnetsPager) HasNext() bool { +func (pager *SubnetReservedIpsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subnet, err error) { +func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListSubnetsWithContext(ctx, pager.options) + result, _, err := pager.client.ListSubnetReservedIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132569,16 +135290,16 @@ func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subne } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Subnets + page = result.ReservedIps return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Subnet, err error) { +func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { for pager.HasNext() { - var nextPage []Subnet + var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -132590,38 +135311,38 @@ func (pager *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Su } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SubnetsPager) GetNext() (page []Subnet, err error) { +func (pager *SubnetReservedIpsPager) GetNext() (page []ReservedIP, 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 *SubnetsPager) GetAll() (allItems []Subnet, err error) { +func (pager *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. -type SubnetReservedIpsPager struct { +// SubnetsPager can be used to simplify the use of the "ListSubnets" method. +type SubnetsPager struct { hasNext bool - options *ListSubnetReservedIpsOptions + options *ListSubnetsOptions client *VpcV1 pageContext struct { next *string } } -// NewSubnetReservedIpsPager returns a new SubnetReservedIpsPager instance. -func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOptions) (pager *SubnetReservedIpsPager, err error) { +// NewSubnetsPager returns a new SubnetsPager instance. +func (vpc *VpcV1) NewSubnetsPager(options *ListSubnetsOptions) (pager *SubnetsPager, 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 ListSubnetReservedIpsOptions = *options - pager = &SubnetReservedIpsPager{ + var optionsCopy ListSubnetsOptions = *options + pager = &SubnetsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132630,19 +135351,19 @@ func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOption } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *SubnetReservedIpsPager) HasNext() bool { +func (pager *SubnetsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { +func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subnet, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListSubnetReservedIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListSubnetsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -132661,16 +135382,16 @@ func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (pa } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.ReservedIps + page = result.Subnets return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { +func (pager *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Subnet, err error) { for pager.HasNext() { - var nextPage []ReservedIP + var nextPage []Subnet nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -132682,14 +135403,14 @@ func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (all } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SubnetReservedIpsPager) GetNext() (page []ReservedIP, err error) { +func (pager *SubnetsPager) GetNext() (page []Subnet, 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 *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) { +func (pager *SubnetsPager) GetAll() (allItems []Subnet, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -132971,25 +135692,25 @@ func (pager *KeysPager) GetAll() (allItems []Key, err error) { return } -// InstancesPager can be used to simplify the use of the "ListInstances" method. -type InstancesPager struct { +// InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "ListInstanceNetworkInterfaceIps" method. +type InstanceNetworkInterfaceIpsPager struct { hasNext bool - options *ListInstancesOptions + options *ListInstanceNetworkInterfaceIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewInstancesPager returns a new InstancesPager instance. -func (vpc *VpcV1) NewInstancesPager(options *ListInstancesOptions) (pager *InstancesPager, err error) { +// NewInstanceNetworkInterfaceIpsPager returns a new InstanceNetworkInterfaceIpsPager instance. +func (vpc *VpcV1) NewInstanceNetworkInterfaceIpsPager(options *ListInstanceNetworkInterfaceIpsOptions) (pager *InstanceNetworkInterfaceIpsPager, 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 ListInstancesOptions = *options - pager = &InstancesPager{ + var optionsCopy ListInstanceNetworkInterfaceIpsOptions = *options + pager = &InstanceNetworkInterfaceIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -132998,19 +135719,19 @@ func (vpc *VpcV1) NewInstancesPager(options *ListInstancesOptions) (pager *Insta } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstancesPager) HasNext() bool { +func (pager *InstanceNetworkInterfaceIpsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstancesPager) GetNextWithContext(ctx context.Context) (page []Instance, err error) { +func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListInstancesWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceNetworkInterfaceIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -133029,16 +135750,16 @@ func (pager *InstancesPager) GetNextWithContext(ctx context.Context) (page []Ins } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Instances + page = result.Ips return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *InstancesPager) GetAllWithContext(ctx context.Context) (allItems []Instance, err error) { +func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { for pager.HasNext() { - var nextPage []Instance + var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -133050,38 +135771,38 @@ func (pager *InstancesPager) GetAllWithContext(ctx context.Context) (allItems [] } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstancesPager) GetNext() (page []Instance, err error) { +func (pager *InstanceNetworkInterfaceIpsPager) GetNext() (page []ReservedIP, 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 *InstancesPager) GetAll() (allItems []Instance, err error) { +func (pager *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, 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 { +// InstancesPager can be used to simplify the use of the "ListInstances" method. +type InstancesPager struct { hasNext bool - options *ListInstanceNetworkInterfaceIpsOptions + options *ListInstancesOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceNetworkInterfaceIpsPager returns a new InstanceNetworkInterfaceIpsPager instance. -func (vpc *VpcV1) NewInstanceNetworkInterfaceIpsPager(options *ListInstanceNetworkInterfaceIpsOptions) (pager *InstanceNetworkInterfaceIpsPager, err error) { +// NewInstancesPager returns a new InstancesPager instance. +func (vpc *VpcV1) NewInstancesPager(options *ListInstancesOptions) (pager *InstancesPager, 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 ListInstanceNetworkInterfaceIpsOptions = *options - pager = &InstanceNetworkInterfaceIpsPager{ + var optionsCopy ListInstancesOptions = *options + pager = &InstancesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -133090,19 +135811,19 @@ func (vpc *VpcV1) NewInstanceNetworkInterfaceIpsPager(options *ListInstanceNetwo } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceNetworkInterfaceIpsPager) HasNext() bool { +func (pager *InstancesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { +func (pager *InstancesPager) GetNextWithContext(ctx context.Context) (page []Instance, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListInstanceNetworkInterfaceIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstancesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -133121,16 +135842,16 @@ func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Co } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Ips + page = result.Instances return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { +func (pager *InstancesPager) GetAllWithContext(ctx context.Context) (allItems []Instance, err error) { for pager.HasNext() { - var nextPage []ReservedIP + var nextPage []Instance nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -133142,38 +135863,38 @@ func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Con } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceNetworkInterfaceIpsPager) GetNext() (page []ReservedIP, err error) { +func (pager *InstancesPager) GetNext() (page []Instance, 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 *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, err error) { +func (pager *InstancesPager) GetAll() (allItems []Instance, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. -type InstanceGroupsPager struct { +// InstanceGroupManagerActionsPager can be used to simplify the use of the "ListInstanceGroupManagerActions" method. +type InstanceGroupManagerActionsPager struct { hasNext bool - options *ListInstanceGroupsOptions + options *ListInstanceGroupManagerActionsOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupsPager returns a new InstanceGroupsPager instance. -func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pager *InstanceGroupsPager, err error) { +// NewInstanceGroupManagerActionsPager returns a new InstanceGroupManagerActionsPager instance. +func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroupManagerActionsOptions) (pager *InstanceGroupManagerActionsPager, 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 ListInstanceGroupsOptions = *options - pager = &InstanceGroupsPager{ + var optionsCopy ListInstanceGroupManagerActionsOptions = *options + pager = &InstanceGroupManagerActionsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -133182,19 +135903,19 @@ func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupsPager) HasNext() bool { +func (pager *InstanceGroupManagerActionsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroup, err error) { +func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerActionIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListInstanceGroupsWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceGroupManagerActionsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -133213,16 +135934,16 @@ func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.InstanceGroups + page = result.Actions return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroup, err error) { +func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerActionIntf, err error) { for pager.HasNext() { - var nextPage []InstanceGroup + var nextPage []InstanceGroupManagerActionIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -133234,38 +135955,38 @@ func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allIte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupsPager) GetNext() (page []InstanceGroup, err error) { +func (pager *InstanceGroupManagerActionsPager) GetNext() (page []InstanceGroupManagerActionIntf, 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 *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) { +func (pager *InstanceGroupManagerActionsPager) GetAll() (allItems []InstanceGroupManagerActionIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// InstanceGroupManagersPager can be used to simplify the use of the "ListInstanceGroupManagers" method. -type InstanceGroupManagersPager struct { +// InstanceGroupManagerPoliciesPager can be used to simplify the use of the "ListInstanceGroupManagerPolicies" method. +type InstanceGroupManagerPoliciesPager struct { hasNext bool - options *ListInstanceGroupManagersOptions + options *ListInstanceGroupManagerPoliciesOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupManagersPager returns a new InstanceGroupManagersPager instance. -func (vpc *VpcV1) NewInstanceGroupManagersPager(options *ListInstanceGroupManagersOptions) (pager *InstanceGroupManagersPager, err error) { +// NewInstanceGroupManagerPoliciesPager returns a new InstanceGroupManagerPoliciesPager instance. +func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGroupManagerPoliciesOptions) (pager *InstanceGroupManagerPoliciesPager, 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 ListInstanceGroupManagersOptions = *options - pager = &InstanceGroupManagersPager{ + var optionsCopy ListInstanceGroupManagerPoliciesOptions = *options + pager = &InstanceGroupManagerPoliciesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -133274,19 +135995,19 @@ func (vpc *VpcV1) NewInstanceGroupManagersPager(options *ListInstanceGroupManage } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupManagersPager) HasNext() bool { +func (pager *InstanceGroupManagerPoliciesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupManagersPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerIntf, err error) { +func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerPolicyIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListInstanceGroupManagersWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceGroupManagerPoliciesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -133305,16 +136026,16 @@ func (pager *InstanceGroupManagersPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Managers + page = result.Policies return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *InstanceGroupManagersPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerIntf, err error) { +func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerPolicyIntf, err error) { for pager.HasNext() { - var nextPage []InstanceGroupManagerIntf + var nextPage []InstanceGroupManagerPolicyIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -133326,38 +136047,38 @@ func (pager *InstanceGroupManagersPager) GetAllWithContext(ctx context.Context) } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagersPager) GetNext() (page []InstanceGroupManagerIntf, err error) { +func (pager *InstanceGroupManagerPoliciesPager) GetNext() (page []InstanceGroupManagerPolicyIntf, 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 *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManagerIntf, err error) { +func (pager *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGroupManagerPolicyIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// InstanceGroupManagerActionsPager can be used to simplify the use of the "ListInstanceGroupManagerActions" method. -type InstanceGroupManagerActionsPager struct { +// InstanceGroupManagersPager can be used to simplify the use of the "ListInstanceGroupManagers" method. +type InstanceGroupManagersPager struct { hasNext bool - options *ListInstanceGroupManagerActionsOptions + options *ListInstanceGroupManagersOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupManagerActionsPager returns a new InstanceGroupManagerActionsPager instance. -func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroupManagerActionsOptions) (pager *InstanceGroupManagerActionsPager, err error) { +// NewInstanceGroupManagersPager returns a new InstanceGroupManagersPager instance. +func (vpc *VpcV1) NewInstanceGroupManagersPager(options *ListInstanceGroupManagersOptions) (pager *InstanceGroupManagersPager, 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 ListInstanceGroupManagerActionsOptions = *options - pager = &InstanceGroupManagerActionsPager{ + var optionsCopy ListInstanceGroupManagersOptions = *options + pager = &InstanceGroupManagersPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -133366,19 +136087,19 @@ func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroup } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupManagerActionsPager) HasNext() bool { +func (pager *InstanceGroupManagersPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerActionIntf, err error) { +func (pager *InstanceGroupManagersPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListInstanceGroupManagerActionsWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceGroupManagersWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -133397,16 +136118,16 @@ func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Co } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Actions + page = result.Managers return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerActionIntf, err error) { +func (pager *InstanceGroupManagersPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerIntf, err error) { for pager.HasNext() { - var nextPage []InstanceGroupManagerActionIntf + var nextPage []InstanceGroupManagerIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -133418,38 +136139,38 @@ func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Con } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagerActionsPager) GetNext() (page []InstanceGroupManagerActionIntf, err error) { +func (pager *InstanceGroupManagersPager) GetNext() (page []InstanceGroupManagerIntf, 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 *InstanceGroupManagerActionsPager) GetAll() (allItems []InstanceGroupManagerActionIntf, err error) { +func (pager *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManagerIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// InstanceGroupManagerPoliciesPager can be used to simplify the use of the "ListInstanceGroupManagerPolicies" method. -type InstanceGroupManagerPoliciesPager struct { +// InstanceGroupMembershipsPager can be used to simplify the use of the "ListInstanceGroupMemberships" method. +type InstanceGroupMembershipsPager struct { hasNext bool - options *ListInstanceGroupManagerPoliciesOptions + options *ListInstanceGroupMembershipsOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupManagerPoliciesPager returns a new InstanceGroupManagerPoliciesPager instance. -func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGroupManagerPoliciesOptions) (pager *InstanceGroupManagerPoliciesPager, err error) { +// NewInstanceGroupMembershipsPager returns a new InstanceGroupMembershipsPager instance. +func (vpc *VpcV1) NewInstanceGroupMembershipsPager(options *ListInstanceGroupMembershipsOptions) (pager *InstanceGroupMembershipsPager, 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 ListInstanceGroupManagerPoliciesOptions = *options - pager = &InstanceGroupManagerPoliciesPager{ + var optionsCopy ListInstanceGroupMembershipsOptions = *options + pager = &InstanceGroupMembershipsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -133458,19 +136179,19 @@ func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGrou } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupManagerPoliciesPager) HasNext() bool { +func (pager *InstanceGroupMembershipsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerPolicyIntf, err error) { +func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupMembership, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListInstanceGroupManagerPoliciesWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceGroupMembershipsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -133489,16 +136210,16 @@ func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.C } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Policies + page = result.Memberships return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerPolicyIntf, err error) { +func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupMembership, err error) { for pager.HasNext() { - var nextPage []InstanceGroupManagerPolicyIntf + var nextPage []InstanceGroupMembership nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -133510,38 +136231,38 @@ func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Co } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagerPoliciesPager) GetNext() (page []InstanceGroupManagerPolicyIntf, err error) { +func (pager *InstanceGroupMembershipsPager) GetNext() (page []InstanceGroupMembership, 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 *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGroupManagerPolicyIntf, err error) { +func (pager *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMembership, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// InstanceGroupMembershipsPager can be used to simplify the use of the "ListInstanceGroupMemberships" method. -type InstanceGroupMembershipsPager struct { +// InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. +type InstanceGroupsPager struct { hasNext bool - options *ListInstanceGroupMembershipsOptions + options *ListInstanceGroupsOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupMembershipsPager returns a new InstanceGroupMembershipsPager instance. -func (vpc *VpcV1) NewInstanceGroupMembershipsPager(options *ListInstanceGroupMembershipsOptions) (pager *InstanceGroupMembershipsPager, err error) { +// NewInstanceGroupsPager returns a new InstanceGroupsPager instance. +func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pager *InstanceGroupsPager, 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 ListInstanceGroupMembershipsOptions = *options - pager = &InstanceGroupMembershipsPager{ + var optionsCopy ListInstanceGroupsOptions = *options + pager = &InstanceGroupsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -133550,19 +136271,19 @@ func (vpc *VpcV1) NewInstanceGroupMembershipsPager(options *ListInstanceGroupMem } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupMembershipsPager) HasNext() bool { +func (pager *InstanceGroupsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupMembership, err error) { +func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroup, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListInstanceGroupMembershipsWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceGroupsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -133581,16 +136302,16 @@ func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Memberships + page = result.InstanceGroups return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupMembership, err error) { +func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroup, err error) { for pager.HasNext() { - var nextPage []InstanceGroupMembership + var nextPage []InstanceGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -133602,14 +136323,14 @@ func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Contex } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupMembershipsPager) GetNext() (page []InstanceGroupMembership, err error) { +func (pager *InstanceGroupsPager) GetNext() (page []InstanceGroup, 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 *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMembership, err error) { +func (pager *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -134075,25 +136796,25 @@ func (pager *PlacementGroupsPager) GetAll() (allItems []PlacementGroup, err erro return } -// BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. -type BareMetalServerProfilesPager struct { +// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. +type BareMetalServerNetworkAttachmentsPager struct { hasNext bool - options *ListBareMetalServerProfilesOptions + options *ListBareMetalServerNetworkAttachmentsOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. -func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, err error) { +// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, 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 ListBareMetalServerProfilesOptions = *options - pager = &BareMetalServerProfilesPager{ + var optionsCopy ListBareMetalServerNetworkAttachmentsOptions = *options + pager = &BareMetalServerNetworkAttachmentsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -134102,19 +136823,19 @@ func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerPr } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerProfilesPager) HasNext() bool { +func (pager *BareMetalServerNetworkAttachmentsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfile, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkAttachmentIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServerProfilesWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -134133,16 +136854,16 @@ func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Contex } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Profiles + page = result.NetworkAttachments return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfile, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { for pager.HasNext() { - var nextPage []BareMetalServerProfile + var nextPage []BareMetalServerNetworkAttachmentIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -134154,38 +136875,38 @@ func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfile, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, 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 *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. -type BareMetalServersPager struct { +// BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. +type BareMetalServerNetworkInterfacesPager struct { hasNext bool - options *ListBareMetalServersOptions + options *ListBareMetalServerNetworkInterfacesOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServersPager returns a new BareMetalServersPager instance. -func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, err error) { +// NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, 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 ListBareMetalServersOptions = *options - pager = &BareMetalServersPager{ + var optionsCopy ListBareMetalServerNetworkInterfacesOptions = *options + pager = &BareMetalServerNetworkInterfacesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -134194,19 +136915,19 @@ func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServersPager) HasNext() bool { +func (pager *BareMetalServerNetworkInterfacesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (page []BareMetalServer, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkInterfaceIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServersWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -134225,16 +136946,16 @@ func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.BareMetalServers + page = result.NetworkInterfaces return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServer, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkInterfaceIntf, err error) { for pager.HasNext() { - var nextPage []BareMetalServer + var nextPage []BareMetalServerNetworkInterfaceIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -134246,38 +136967,38 @@ func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allI } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServersPager) GetNext() (page []BareMetalServer, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetNext() (page []BareMetalServerNetworkInterfaceIntf, 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 *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. -type BareMetalServerNetworkAttachmentsPager struct { +// BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. +type BareMetalServerProfilesPager struct { hasNext bool - options *ListBareMetalServerNetworkAttachmentsOptions + options *ListBareMetalServerProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. -func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, err error) { +// NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. +func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, 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 ListBareMetalServerNetworkAttachmentsOptions = *options - pager = &BareMetalServerNetworkAttachmentsPager{ + var optionsCopy ListBareMetalServerProfilesOptions = *options + pager = &BareMetalServerProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -134286,19 +137007,19 @@ func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMet } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerNetworkAttachmentsPager) HasNext() bool { +func (pager *BareMetalServerProfilesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfile, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerProfilesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -134317,16 +137038,16 @@ func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx cont } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.NetworkAttachments + page = result.Profiles return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfile, err error) { for pager.HasNext() { - var nextPage []BareMetalServerNetworkAttachmentIntf + var nextPage []BareMetalServerProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -134338,38 +137059,38 @@ func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx conte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *BareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfile, 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 *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. -type BareMetalServerNetworkInterfacesPager struct { +// BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. +type BareMetalServersPager struct { hasNext bool - options *ListBareMetalServerNetworkInterfacesOptions + options *ListBareMetalServersOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. -func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, err error) { +// NewBareMetalServersPager returns a new BareMetalServersPager instance. +func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, 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 ListBareMetalServerNetworkInterfacesOptions = *options - pager = &BareMetalServerNetworkInterfacesPager{ + var optionsCopy ListBareMetalServersOptions = *options + pager = &BareMetalServersPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -134378,19 +137099,19 @@ func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMeta } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerNetworkInterfacesPager) HasNext() bool { +func (pager *BareMetalServersPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (page []BareMetalServer, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServersWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -134409,16 +137130,16 @@ func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.NetworkInterfaces + page = result.BareMetalServers return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServer, err error) { for pager.HasNext() { - var nextPage []BareMetalServerNetworkInterfaceIntf + var nextPage []BareMetalServer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -134430,14 +137151,14 @@ func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx contex } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerNetworkInterfacesPager) GetNext() (page []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *BareMetalServersPager) GetNext() (page []BareMetalServer, 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 *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -134811,190 +137532,6 @@ func (pager *SnapshotsPager) GetAll() (allItems []Snapshot, err error) { return } -// ShareProfilesPager can be used to simplify the use of the "ListShareProfiles" method. -type ShareProfilesPager struct { - hasNext bool - options *ListShareProfilesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewShareProfilesPager returns a new ShareProfilesPager instance. -func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (pager *ShareProfilesPager, 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 ListShareProfilesOptions = *options - pager = &ShareProfilesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *ShareProfilesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page []ShareProfile, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListShareProfilesWithContext(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 *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItems []ShareProfile, err error) { - for pager.HasNext() { - var nextPage []ShareProfile - 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 *ShareProfilesPager) GetNext() (page []ShareProfile, 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 *ShareProfilesPager) GetAll() (allItems []ShareProfile, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - -// SharesPager can be used to simplify the use of the "ListShares" method. -type SharesPager struct { - hasNext bool - options *ListSharesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewSharesPager returns a new SharesPager instance. -func (vpc *VpcV1) NewSharesPager(options *ListSharesOptions) (pager *SharesPager, 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 ListSharesOptions = *options - pager = &SharesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *SharesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListSharesWithContext(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.Shares - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Share, err error) { - for pager.HasNext() { - var nextPage []Share - 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 *SharesPager) GetNext() (page []Share, 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 *SharesPager) GetAll() (allItems []Share, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - // ShareAccessorBindingsPager can be used to simplify the use of the "ListShareAccessorBindings" method. type ShareAccessorBindingsPager struct { hasNext bool @@ -135179,25 +137716,25 @@ func (pager *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err return } -// BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. -type BackupPoliciesPager struct { +// ShareProfilesPager can be used to simplify the use of the "ListShareProfiles" method. +type ShareProfilesPager struct { hasNext bool - options *ListBackupPoliciesOptions + options *ListShareProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewBackupPoliciesPager returns a new BackupPoliciesPager instance. -func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pager *BackupPoliciesPager, err error) { +// NewShareProfilesPager returns a new ShareProfilesPager instance. +func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (pager *ShareProfilesPager, 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 ListBackupPoliciesOptions = *options - pager = &BackupPoliciesPager{ + var optionsCopy ListShareProfilesOptions = *options + pager = &ShareProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -135206,19 +137743,19 @@ func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BackupPoliciesPager) HasNext() bool { +func (pager *ShareProfilesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyIntf, err error) { +func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page []ShareProfile, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBackupPoliciesWithContext(ctx, pager.options) + result, _, err := pager.client.ListShareProfilesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -135237,16 +137774,16 @@ func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.BackupPolicies + page = result.Profiles return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyIntf, err error) { +func (pager *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItems []ShareProfile, err error) { for pager.HasNext() { - var nextPage []BackupPolicyIntf + var nextPage []ShareProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -135258,38 +137795,38 @@ func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allIte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BackupPoliciesPager) GetNext() (page []BackupPolicyIntf, err error) { +func (pager *ShareProfilesPager) GetNext() (page []ShareProfile, 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 *BackupPoliciesPager) GetAll() (allItems []BackupPolicyIntf, err error) { +func (pager *ShareProfilesPager) GetAll() (allItems []ShareProfile, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// BackupPolicyJobsPager can be used to simplify the use of the "ListBackupPolicyJobs" method. -type BackupPolicyJobsPager struct { +// SharesPager can be used to simplify the use of the "ListShares" method. +type SharesPager struct { hasNext bool - options *ListBackupPolicyJobsOptions + options *ListSharesOptions client *VpcV1 pageContext struct { next *string } } -// NewBackupPolicyJobsPager returns a new BackupPolicyJobsPager instance. -func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) (pager *BackupPolicyJobsPager, err error) { +// NewSharesPager returns a new SharesPager instance. +func (vpc *VpcV1) NewSharesPager(options *ListSharesOptions) (pager *SharesPager, 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 ListBackupPolicyJobsOptions = *options - pager = &BackupPolicyJobsPager{ + var optionsCopy ListSharesOptions = *options + pager = &SharesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -135298,19 +137835,19 @@ func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BackupPolicyJobsPager) HasNext() bool { +func (pager *SharesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyJob, err error) { +func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBackupPolicyJobsWithContext(ctx, pager.options) + result, _, err := pager.client.ListSharesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -135329,16 +137866,16 @@ func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Jobs + page = result.Shares return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyJob, err error) { +func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Share, err error) { for pager.HasNext() { - var nextPage []BackupPolicyJob + var nextPage []Share nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -135350,38 +137887,38 @@ func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allI } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BackupPolicyJobsPager) GetNext() (page []BackupPolicyJob, err error) { +func (pager *SharesPager) GetNext() (page []Share, 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 *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err error) { +func (pager *SharesPager) GetAll() (allItems []Share, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. -type VirtualNetworkInterfacesPager struct { +// BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. +type BackupPoliciesPager struct { hasNext bool - options *ListVirtualNetworkInterfacesOptions + options *ListBackupPoliciesOptions client *VpcV1 pageContext struct { next *string } } -// NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. -func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, err error) { +// NewBackupPoliciesPager returns a new BackupPoliciesPager instance. +func (vpc *VpcV1) NewBackupPoliciesPager(options *ListBackupPoliciesOptions) (pager *BackupPoliciesPager, 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 ListVirtualNetworkInterfacesOptions = *options - pager = &VirtualNetworkInterfacesPager{ + var optionsCopy ListBackupPoliciesOptions = *options + pager = &BackupPoliciesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -135390,19 +137927,19 @@ func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkIn } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VirtualNetworkInterfacesPager) HasNext() bool { +func (pager *BackupPoliciesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []VirtualNetworkInterface, err error) { +func (pager *BackupPoliciesPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVirtualNetworkInterfacesWithContext(ctx, pager.options) + result, _, err := pager.client.ListBackupPoliciesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -135421,16 +137958,16 @@ func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.VirtualNetworkInterfaces + page = result.BackupPolicies return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []VirtualNetworkInterface, err error) { +func (pager *BackupPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyIntf, err error) { for pager.HasNext() { - var nextPage []VirtualNetworkInterface + var nextPage []BackupPolicyIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -135442,14 +137979,106 @@ func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Contex } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VirtualNetworkInterfacesPager) GetNext() (page []VirtualNetworkInterface, err error) { +func (pager *BackupPoliciesPager) GetNext() (page []BackupPolicyIntf, 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 *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, err error) { +func (pager *BackupPoliciesPager) GetAll() (allItems []BackupPolicyIntf, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// BackupPolicyJobsPager can be used to simplify the use of the "ListBackupPolicyJobs" method. +type BackupPolicyJobsPager struct { + hasNext bool + options *ListBackupPolicyJobsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewBackupPolicyJobsPager returns a new BackupPolicyJobsPager instance. +func (vpc *VpcV1) NewBackupPolicyJobsPager(options *ListBackupPolicyJobsOptions) (pager *BackupPolicyJobsPager, 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 ListBackupPolicyJobsOptions = *options + pager = &BackupPolicyJobsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *BackupPolicyJobsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *BackupPolicyJobsPager) GetNextWithContext(ctx context.Context) (page []BackupPolicyJob, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListBackupPolicyJobsWithContext(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.Jobs + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *BackupPolicyJobsPager) GetAllWithContext(ctx context.Context) (allItems []BackupPolicyJob, err error) { + for pager.HasNext() { + var nextPage []BackupPolicyJob + 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 *BackupPolicyJobsPager) GetNext() (page []BackupPolicyJob, 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 *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -135639,25 +138268,25 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPRef return } -// PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. -type PublicGatewaysPager struct { +// VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. +type VirtualNetworkInterfacesPager struct { hasNext bool - options *ListPublicGatewaysOptions + options *ListVirtualNetworkInterfacesOptions client *VpcV1 pageContext struct { next *string } } -// NewPublicGatewaysPager returns a new PublicGatewaysPager instance. -func (vpc *VpcV1) NewPublicGatewaysPager(options *ListPublicGatewaysOptions) (pager *PublicGatewaysPager, err error) { +// NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. +func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, 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 ListPublicGatewaysOptions = *options - pager = &PublicGatewaysPager{ + var optionsCopy ListVirtualNetworkInterfacesOptions = *options + pager = &VirtualNetworkInterfacesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -135666,19 +138295,19 @@ func (vpc *VpcV1) NewPublicGatewaysPager(options *ListPublicGatewaysOptions) (pa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *PublicGatewaysPager) HasNext() bool { +func (pager *VirtualNetworkInterfacesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page []PublicGateway, err error) { +func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []VirtualNetworkInterface, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListPublicGatewaysWithContext(ctx, pager.options) + result, _, err := pager.client.ListVirtualNetworkInterfacesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -135697,16 +138326,16 @@ func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.PublicGateways + page = result.VirtualNetworkInterfaces return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []PublicGateway, err error) { +func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []VirtualNetworkInterface, err error) { for pager.HasNext() { - var nextPage []PublicGateway + var nextPage []VirtualNetworkInterface nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -135718,38 +138347,38 @@ func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allIte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *PublicGatewaysPager) GetNext() (page []PublicGateway, err error) { +func (pager *VirtualNetworkInterfacesPager) GetNext() (page []VirtualNetworkInterface, 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 *PublicGatewaysPager) GetAll() (allItems []PublicGateway, err error) { +func (pager *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. -type FloatingIpsPager struct { +// PublicGatewaysPager can be used to simplify the use of the "ListPublicGateways" method. +type PublicGatewaysPager struct { hasNext bool - options *ListFloatingIpsOptions + options *ListPublicGatewaysOptions client *VpcV1 pageContext struct { next *string } } -// NewFloatingIpsPager returns a new FloatingIpsPager instance. -func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *FloatingIpsPager, err error) { +// NewPublicGatewaysPager returns a new PublicGatewaysPager instance. +func (vpc *VpcV1) NewPublicGatewaysPager(options *ListPublicGatewaysOptions) (pager *PublicGatewaysPager, 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 ListFloatingIpsOptions = *options - pager = &FloatingIpsPager{ + var optionsCopy ListPublicGatewaysOptions = *options + pager = &PublicGatewaysPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -135758,19 +138387,19 @@ func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *F } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *FloatingIpsPager) HasNext() bool { +func (pager *PublicGatewaysPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIP, err error) { +func (pager *PublicGatewaysPager) GetNextWithContext(ctx context.Context) (page []PublicGateway, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListFloatingIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListPublicGatewaysWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -135789,16 +138418,16 @@ func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []F } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.FloatingIps + page = result.PublicGateways return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIP, err error) { +func (pager *PublicGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []PublicGateway, err error) { for pager.HasNext() { - var nextPage []FloatingIP + var nextPage []PublicGateway nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -135810,38 +138439,38 @@ func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *FloatingIpsPager) GetNext() (page []FloatingIP, err error) { +func (pager *PublicGatewaysPager) GetNext() (page []PublicGateway, 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 *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { +func (pager *PublicGatewaysPager) GetAll() (allItems []PublicGateway, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. -type NetworkAclsPager struct { +// FloatingIpsPager can be used to simplify the use of the "ListFloatingIps" method. +type FloatingIpsPager struct { hasNext bool - options *ListNetworkAclsOptions + options *ListFloatingIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewNetworkAclsPager returns a new NetworkAclsPager instance. -func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *NetworkAclsPager, err error) { +// NewFloatingIpsPager returns a new FloatingIpsPager instance. +func (vpc *VpcV1) NewFloatingIpsPager(options *ListFloatingIpsOptions) (pager *FloatingIpsPager, 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 ListNetworkAclsOptions = *options - pager = &NetworkAclsPager{ + var optionsCopy ListFloatingIpsOptions = *options + pager = &FloatingIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -135850,19 +138479,19 @@ func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *N } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *NetworkAclsPager) HasNext() bool { +func (pager *FloatingIpsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []NetworkACL, err error) { +func (pager *FloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIP, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListNetworkAclsWithContext(ctx, pager.options) + result, _, err := pager.client.ListFloatingIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -135881,16 +138510,16 @@ func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []N } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.NetworkAcls + page = result.FloatingIps return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACL, err error) { +func (pager *FloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIP, err error) { for pager.HasNext() { - var nextPage []NetworkACL + var nextPage []FloatingIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -135902,14 +138531,14 @@ func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *NetworkAclsPager) GetNext() (page []NetworkACL, err error) { +func (pager *FloatingIpsPager) GetNext() (page []FloatingIP, 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 *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { +func (pager *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -136007,25 +138636,25 @@ func (pager *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, return } -// SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. -type SecurityGroupsPager struct { +// NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. +type NetworkAclsPager struct { hasNext bool - options *ListSecurityGroupsOptions + options *ListNetworkAclsOptions client *VpcV1 pageContext struct { next *string } } -// NewSecurityGroupsPager returns a new SecurityGroupsPager instance. -func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pager *SecurityGroupsPager, err error) { +// NewNetworkAclsPager returns a new NetworkAclsPager instance. +func (vpc *VpcV1) NewNetworkAclsPager(options *ListNetworkAclsOptions) (pager *NetworkAclsPager, 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 ListSecurityGroupsOptions = *options - pager = &SecurityGroupsPager{ + var optionsCopy ListNetworkAclsOptions = *options + pager = &NetworkAclsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -136034,19 +138663,19 @@ func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *SecurityGroupsPager) HasNext() bool { +func (pager *NetworkAclsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroup, err error) { +func (pager *NetworkAclsPager) GetNextWithContext(ctx context.Context) (page []NetworkACL, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListSecurityGroupsWithContext(ctx, pager.options) + result, _, err := pager.client.ListNetworkAclsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -136065,16 +138694,16 @@ func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.SecurityGroups + page = result.NetworkAcls return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroup, err error) { +func (pager *NetworkAclsPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACL, err error) { for pager.HasNext() { - var nextPage []SecurityGroup + var nextPage []NetworkACL nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -136086,14 +138715,14 @@ func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allIte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SecurityGroupsPager) GetNext() (page []SecurityGroup, err error) { +func (pager *NetworkAclsPager) GetNext() (page []NetworkACL, 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 *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) { +func (pager *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -136191,6 +138820,98 @@ func (pager *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTarget return } +// SecurityGroupsPager can be used to simplify the use of the "ListSecurityGroups" method. +type SecurityGroupsPager struct { + hasNext bool + options *ListSecurityGroupsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSecurityGroupsPager returns a new SecurityGroupsPager instance. +func (vpc *VpcV1) NewSecurityGroupsPager(options *ListSecurityGroupsOptions) (pager *SecurityGroupsPager, 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 ListSecurityGroupsOptions = *options + pager = &SecurityGroupsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SecurityGroupsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SecurityGroupsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroup, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSecurityGroupsWithContext(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.SecurityGroups + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SecurityGroupsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroup, err error) { + for pager.HasNext() { + var nextPage []SecurityGroup + 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 *SecurityGroupsPager) GetNext() (page []SecurityGroup, 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 *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + // IkePoliciesPager can be used to simplify the use of the "ListIkePolicies" method. type IkePoliciesPager struct { hasNext bool @@ -136559,25 +139280,25 @@ func (pager *IpsecPolicyConnectionsPager) GetAll() (allItems []VPNGatewayConnect return } -// VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. -type VPNGatewaysPager struct { +// VPNGatewayConnectionsPager can be used to simplify the use of the "ListVPNGatewayConnections" method. +type VPNGatewayConnectionsPager struct { hasNext bool - options *ListVPNGatewaysOptions + options *ListVPNGatewayConnectionsOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNGatewaysPager returns a new VPNGatewaysPager instance. -func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *VPNGatewaysPager, err error) { +// NewVPNGatewayConnectionsPager returns a new VPNGatewayConnectionsPager instance. +func (vpc *VpcV1) NewVPNGatewayConnectionsPager(options *ListVPNGatewayConnectionsOptions) (pager *VPNGatewayConnectionsPager, 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 ListVPNGatewaysOptions = *options - pager = &VPNGatewaysPager{ + var optionsCopy ListVPNGatewayConnectionsOptions = *options + pager = &VPNGatewayConnectionsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -136586,19 +139307,19 @@ func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *V } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNGatewaysPager) HasNext() bool { +func (pager *VPNGatewayConnectionsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayIntf, err error) { +func (pager *VPNGatewayConnectionsPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayConnectionIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPNGatewaysWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNGatewayConnectionsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -136617,16 +139338,16 @@ func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []V } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.VPNGateways + page = result.Connections return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayIntf, err error) { +func (pager *VPNGatewayConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { for pager.HasNext() { - var nextPage []VPNGatewayIntf + var nextPage []VPNGatewayConnectionIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -136638,38 +139359,38 @@ func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNGatewaysPager) GetNext() (page []VPNGatewayIntf, err error) { +func (pager *VPNGatewayConnectionsPager) GetNext() (page []VPNGatewayConnectionIntf, 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 *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { +func (pager *VPNGatewayConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VPNGatewayConnectionsPager can be used to simplify the use of the "ListVPNGatewayConnections" method. -type VPNGatewayConnectionsPager struct { +// VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. +type VPNGatewaysPager struct { hasNext bool - options *ListVPNGatewayConnectionsOptions + options *ListVPNGatewaysOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNGatewayConnectionsPager returns a new VPNGatewayConnectionsPager instance. -func (vpc *VpcV1) NewVPNGatewayConnectionsPager(options *ListVPNGatewayConnectionsOptions) (pager *VPNGatewayConnectionsPager, err error) { +// NewVPNGatewaysPager returns a new VPNGatewaysPager instance. +func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *VPNGatewaysPager, 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 ListVPNGatewayConnectionsOptions = *options - pager = &VPNGatewayConnectionsPager{ + var optionsCopy ListVPNGatewaysOptions = *options + pager = &VPNGatewaysPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -136678,19 +139399,19 @@ func (vpc *VpcV1) NewVPNGatewayConnectionsPager(options *ListVPNGatewayConnectio } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNGatewayConnectionsPager) HasNext() bool { +func (pager *VPNGatewaysPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNGatewayConnectionsPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayConnectionIntf, err error) { +func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPNGatewayConnectionsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNGatewaysWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -136709,16 +139430,16 @@ func (pager *VPNGatewayConnectionsPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Connections + page = result.VPNGateways return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPNGatewayConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { +func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayIntf, err error) { for pager.HasNext() { - var nextPage []VPNGatewayConnectionIntf + var nextPage []VPNGatewayIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -136730,38 +139451,38 @@ func (pager *VPNGatewayConnectionsPager) GetAllWithContext(ctx context.Context) } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNGatewayConnectionsPager) GetNext() (page []VPNGatewayConnectionIntf, err error) { +func (pager *VPNGatewaysPager) GetNext() (page []VPNGatewayIntf, 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 *VPNGatewayConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, err error) { +func (pager *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VPNServersPager can be used to simplify the use of the "ListVPNServers" method. -type VPNServersPager struct { +// VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. +type VPNServerClientsPager struct { hasNext bool - options *ListVPNServersOptions + options *ListVPNServerClientsOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNServersPager returns a new VPNServersPager instance. -func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPNServersPager, err error) { +// NewVPNServerClientsPager returns a new VPNServerClientsPager instance. +func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) (pager *VPNServerClientsPager, 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 ListVPNServersOptions = *options - pager = &VPNServersPager{ + var optionsCopy ListVPNServerClientsOptions = *options + pager = &VPNServerClientsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -136770,19 +139491,19 @@ func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPN } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServersPager) HasNext() bool { +func (pager *VPNServerClientsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VPNServer, err error) { +func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (page []VPNServerClient, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPNServersWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNServerClientsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -136801,16 +139522,16 @@ func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VP } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.VPNServers + page = result.Clients return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems []VPNServer, err error) { +func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerClient, err error) { for pager.HasNext() { - var nextPage []VPNServer + var nextPage []VPNServerClient nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -136822,38 +139543,38 @@ func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems [ } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNServersPager) GetNext() (page []VPNServer, err error) { +func (pager *VPNServerClientsPager) GetNext() (page []VPNServerClient, 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 *VPNServersPager) GetAll() (allItems []VPNServer, err error) { +func (pager *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. -type VPNServerClientsPager struct { +// VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. +type VPNServerRoutesPager struct { hasNext bool - options *ListVPNServerClientsOptions + options *ListVPNServerRoutesOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNServerClientsPager returns a new VPNServerClientsPager instance. -func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) (pager *VPNServerClientsPager, err error) { +// NewVPNServerRoutesPager returns a new VPNServerRoutesPager instance. +func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) (pager *VPNServerRoutesPager, 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 ListVPNServerClientsOptions = *options - pager = &VPNServerClientsPager{ + var optionsCopy ListVPNServerRoutesOptions = *options + pager = &VPNServerRoutesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -136862,19 +139583,19 @@ func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServerClientsPager) HasNext() bool { +func (pager *VPNServerRoutesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (page []VPNServerClient, err error) { +func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page []VPNServerRoute, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPNServerClientsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNServerRoutesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -136893,16 +139614,16 @@ func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Clients + page = result.Routes return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerClient, err error) { +func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerRoute, err error) { for pager.HasNext() { - var nextPage []VPNServerClient + var nextPage []VPNServerRoute nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -136914,38 +139635,38 @@ func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allI } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNServerClientsPager) GetNext() (page []VPNServerClient, err error) { +func (pager *VPNServerRoutesPager) GetNext() (page []VPNServerRoute, 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 *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { +func (pager *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. -type VPNServerRoutesPager struct { +// VPNServersPager can be used to simplify the use of the "ListVPNServers" method. +type VPNServersPager struct { hasNext bool - options *ListVPNServerRoutesOptions + options *ListVPNServersOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNServerRoutesPager returns a new VPNServerRoutesPager instance. -func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) (pager *VPNServerRoutesPager, err error) { +// NewVPNServersPager returns a new VPNServersPager instance. +func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPNServersPager, 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 ListVPNServerRoutesOptions = *options - pager = &VPNServerRoutesPager{ + var optionsCopy ListVPNServersOptions = *options + pager = &VPNServersPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -136954,19 +139675,19 @@ func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) ( } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServerRoutesPager) HasNext() bool { +func (pager *VPNServersPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page []VPNServerRoute, err error) { +func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VPNServer, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPNServerRoutesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNServersWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -136985,16 +139706,16 @@ func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Routes + page = result.VPNServers return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerRoute, err error) { +func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems []VPNServer, err error) { for pager.HasNext() { - var nextPage []VPNServerRoute + var nextPage []VPNServer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -137006,14 +139727,14 @@ func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allIt } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNServerRoutesPager) GetNext() (page []VPNServerRoute, err error) { +func (pager *VPNServersPager) GetNext() (page []VPNServer, 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 *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { +func (pager *VPNServersPager) GetAll() (allItems []VPNServer, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -137203,25 +139924,25 @@ func (pager *LoadBalancersPager) GetAll() (allItems []LoadBalancer, err error) { return } -// EndpointGatewaysPager can be used to simplify the use of the "ListEndpointGateways" method. -type EndpointGatewaysPager struct { +// EndpointGatewayIpsPager can be used to simplify the use of the "ListEndpointGatewayIps" method. +type EndpointGatewayIpsPager struct { hasNext bool - options *ListEndpointGatewaysOptions + options *ListEndpointGatewayIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewEndpointGatewaysPager returns a new EndpointGatewaysPager instance. -func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) (pager *EndpointGatewaysPager, err error) { +// NewEndpointGatewayIpsPager returns a new EndpointGatewayIpsPager instance. +func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOptions) (pager *EndpointGatewayIpsPager, 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 ListEndpointGatewaysOptions = *options - pager = &EndpointGatewaysPager{ + var optionsCopy ListEndpointGatewayIpsOptions = *options + pager = &EndpointGatewayIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -137230,19 +139951,19 @@ func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *EndpointGatewaysPager) HasNext() bool { +func (pager *EndpointGatewayIpsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (page []EndpointGateway, err error) { +func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListEndpointGatewaysWithContext(ctx, pager.options) + result, _, err := pager.client.ListEndpointGatewayIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -137261,16 +139982,16 @@ func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.EndpointGateways + page = result.Ips return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []EndpointGateway, err error) { +func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { for pager.HasNext() { - var nextPage []EndpointGateway + var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -137282,38 +140003,38 @@ func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allI } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *EndpointGatewaysPager) GetNext() (page []EndpointGateway, err error) { +func (pager *EndpointGatewayIpsPager) GetNext() (page []ReservedIP, 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 *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err error) { +func (pager *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// EndpointGatewayIpsPager can be used to simplify the use of the "ListEndpointGatewayIps" method. -type EndpointGatewayIpsPager struct { +// EndpointGatewaysPager can be used to simplify the use of the "ListEndpointGateways" method. +type EndpointGatewaysPager struct { hasNext bool - options *ListEndpointGatewayIpsOptions + options *ListEndpointGatewaysOptions client *VpcV1 pageContext struct { next *string } } -// NewEndpointGatewayIpsPager returns a new EndpointGatewayIpsPager instance. -func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOptions) (pager *EndpointGatewayIpsPager, err error) { +// NewEndpointGatewaysPager returns a new EndpointGatewaysPager instance. +func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) (pager *EndpointGatewaysPager, 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 ListEndpointGatewayIpsOptions = *options - pager = &EndpointGatewayIpsPager{ + var optionsCopy ListEndpointGatewaysOptions = *options + pager = &EndpointGatewaysPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -137322,19 +140043,19 @@ func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOpti } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *EndpointGatewayIpsPager) HasNext() bool { +func (pager *EndpointGatewaysPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { +func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (page []EndpointGateway, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListEndpointGatewayIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListEndpointGatewaysWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -137353,16 +140074,16 @@ func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (p } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Ips + page = result.EndpointGateways return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { +func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []EndpointGateway, err error) { for pager.HasNext() { - var nextPage []ReservedIP + var nextPage []EndpointGateway nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -137374,14 +140095,14 @@ func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (al } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *EndpointGatewayIpsPager) GetNext() (page []ReservedIP, err error) { +func (pager *EndpointGatewaysPager) GetNext() (page []EndpointGateway, 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 *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error) { +func (pager *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return From 15c6b56a93ac019888bc78890c2e1043c4e133b3 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Tue, 3 Sep 2024 11:06:51 +0530 Subject: [PATCH 093/103] sdk breaking changes --- go.mod | 2 +- .../vpc/data_source_ibm_is_backup_policies.go | 2 +- .../vpc/data_source_ibm_is_backup_policy.go | 2 +- .../vpc/data_source_ibm_is_backup_policy_job.go | 8 ++++---- .../vpc/data_source_ibm_is_backup_policy_jobs.go | 8 ++++---- .../vpc/data_source_ibm_is_bare_metal_server.go | 6 +++--- ..._ibm_is_bare_metal_server_network_attachment.go | 4 ++-- ...ibm_is_bare_metal_server_network_attachments.go | 4 ++-- .../vpc/data_source_ibm_is_dedicated_host.go | 6 +++--- .../vpc/data_source_ibm_is_dedicated_host_disk.go | 2 +- .../vpc/data_source_ibm_is_dedicated_host_disks.go | 2 +- .../vpc/data_source_ibm_is_dedicated_host_group.go | 2 +- .../data_source_ibm_is_dedicated_host_groups.go | 2 +- .../vpc/data_source_ibm_is_dedicated_hosts.go | 4 ++-- ibm/service/vpc/data_source_ibm_is_floating_ip.go | 4 ++-- ibm/service/vpc/data_source_ibm_is_floating_ips.go | 4 ++-- ibm/service/vpc/data_source_ibm_is_flow_log.go | 4 ++-- ibm/service/vpc/data_source_ibm_is_ike_policies.go | 2 +- ibm/service/vpc/data_source_ibm_is_ike_policy.go | 2 +- ibm/service/vpc/data_source_ibm_is_instance.go | 10 +++++----- .../vpc/data_source_ibm_is_instance_groups.go | 10 +++++----- ...ta_source_ibm_is_instance_network_attachment.go | 4 ++-- ...a_source_ibm_is_instance_network_attachments.go | 4 ++-- ...ata_source_ibm_is_instance_network_interface.go | 6 +++--- .../vpc/data_source_ibm_is_ipsec_policies.go | 2 +- ibm/service/vpc/data_source_ibm_is_ipsec_policy.go | 2 +- ibm/service/vpc/data_source_ibm_is_lb_listener.go | 6 +++--- .../vpc/data_source_ibm_is_lb_listener_policies.go | 6 +++--- .../vpc/data_source_ibm_is_lb_listener_policy.go | 6 +++--- ibm/service/vpc/data_source_ibm_is_lb_listeners.go | 6 +++--- ibm/service/vpc/data_source_ibm_is_lb_pool.go | 4 ++-- .../vpc/data_source_ibm_is_lb_pool_member.go | 2 +- .../vpc/data_source_ibm_is_lb_pool_members.go | 2 +- ibm/service/vpc/data_source_ibm_is_lb_pools.go | 4 ++-- ibm/service/vpc/data_source_ibm_is_network_acl.go | 6 +++--- ibm/service/vpc/data_source_ibm_is_network_acls.go | 6 +++--- .../vpc/data_source_ibm_is_security_group_rule.go | 2 +- .../vpc/data_source_ibm_is_security_group_rules.go | 2 +- .../vpc/data_source_ibm_is_security_groups.go | 8 ++++---- ibm/service/vpc/data_source_ibm_is_share.go | 6 +++--- .../data_source_ibm_is_share_accessor_binding.go | 2 +- ...ta_source_ibm_is_share_accessor_binding_test.go | 6 +++--- .../data_source_ibm_is_share_accessor_bindings.go | 2 +- ...a_source_ibm_is_share_accessor_bindings_test.go | 8 ++++---- .../vpc/data_source_ibm_is_share_mount_target.go | 6 +++--- ibm/service/vpc/data_source_ibm_is_snapshot.go | 2 +- ...ata_source_ibm_is_snapshot_consistency_group.go | 4 ++-- ibm/service/vpc/data_source_ibm_is_snapshots.go | 2 +- ibm/service/vpc/data_source_ibm_is_subnet.go | 2 +- .../vpc/data_source_ibm_is_subnet_reserved_ips.go | 14 +++++++------- ...data_source_ibm_is_virtual_network_interface.go | 10 +++++----- ibm/service/vpc/data_source_ibm_is_volume.go | 2 +- ibm/service/vpc/data_source_ibm_is_volumes.go | 8 ++++---- ibm/service/vpc/data_source_ibm_is_vpc.go | 2 +- .../vpc/data_source_ibm_is_vpc_routing_table.go | 4 ++-- .../data_source_ibm_is_vpc_routing_table_route.go | 2 +- .../data_source_ibm_is_vpc_routing_table_routes.go | 4 ++-- ibm/service/vpc/data_source_ibm_is_vpn_gateway.go | 6 +++--- .../data_source_ibm_is_vpn_gateway_connection.go | 4 ++-- ibm/service/vpc/data_source_ibm_is_vpn_gateways.go | 2 +- ibm/service/vpc/data_source_ibm_is_vpn_server.go | 8 ++++---- ibm/service/vpc/data_source_ibm_is_vpn_servers.go | 8 ++++---- .../vpc/resource_ibm_is_bare_metal_server.go | 4 ++-- ibm/service/vpc/resource_ibm_is_dedicated_host.go | 4 ++-- .../vpc/resource_ibm_is_dedicated_host_group.go | 2 +- ibm/service/vpc/resource_ibm_is_floating_ip.go | 4 ++-- ibm/service/vpc/resource_ibm_is_instance.go | 6 +++--- .../resource_ibm_is_instance_network_attachment.go | 4 ++-- .../resource_ibm_is_instance_network_interface.go | 2 +- ibm/service/vpc/resource_ibm_is_lb_listener.go | 2 +- .../vpc/resource_ibm_is_lb_listener_policy.go | 4 ++-- ibm/service/vpc/resource_ibm_is_share.go | 2 +- .../resource_ibm_is_snapshot_consistency_group.go | 4 ++-- .../resource_ibm_is_virtual_network_interface.go | 8 ++++---- ibm/service/vpc/resource_ibm_is_vpc.go | 2 +- .../vpc/resource_ibm_is_vpc_routing_table_route.go | 4 ++-- ibm/service/vpc/resource_ibm_is_vpn_server.go | 4 ++-- 77 files changed, 169 insertions(+), 169 deletions(-) diff --git a/go.mod b/go.mod index fb52070eae..f228fae472 100644 --- a/go.mod +++ b/go.mod @@ -239,7 +239,7 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt // add sdk changes. replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.51.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.57.0 => ./common/github.com/IBM/vpc-go-sdk exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policies.go b/ibm/service/vpc/data_source_ibm_is_backup_policies.go index 9e223abac2..b2681c4a83 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policies.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policies.go @@ -446,7 +446,7 @@ func dataSourceBackupPolicyCollectionBackupPoliciesPlansToMap(plansItem vpcv1.Ba return plansMap } -func dataSourceBackupPolicyCollectionPlansDeletedToMap(deletedItem vpcv1.BackupPolicyPlanReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceBackupPolicyCollectionPlansDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policy.go b/ibm/service/vpc/data_source_ibm_is_backup_policy.go index 62d152f0ce..8fda012d70 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policy.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policy.go @@ -422,7 +422,7 @@ func dataSourceBackupPolicyPlansToMap(plansItem vpcv1.BackupPolicyPlanReference) return plansMap } -func dataSourceBackupPolicyPlansDeletedToMap(deletedItem vpcv1.BackupPolicyPlanReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceBackupPolicyPlansDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policy_job.go b/ibm/service/vpc/data_source_ibm_is_backup_policy_job.go index a7aee98b28..0a2defd776 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policy_job.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policy_job.go @@ -447,7 +447,7 @@ func dataSourceBackupPolicyJobBackupPolicyPlanToMap(backupPolicyPlanItem vpcv1.B return backupPolicyPlanMap } -func dataSourceBackupPolicyJobBackupPolicyPlanDeletedToMap(deletedItem vpcv1.BackupPolicyPlanReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceBackupPolicyJobBackupPolicyPlanDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -537,7 +537,7 @@ func resourceIBMIsBackupPolicyPlanRemoteRegionReferenceToMap(model *vpcv1.Region return modelMap, nil } -func dataSourceBackupPolicyJobSourceVolumeDeletedToMap(deletedItem vpcv1.VolumeReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceBackupPolicyJobSourceVolumeDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -578,7 +578,7 @@ func dataSourceBackupPolicyJobSourceInstanceToMap(sourceVolumeItem vpcv1.BackupP return sourceVolumeMap } -func dataSourceBackupPolicyJobSourceInstanceDeletedToMap(deletedItem vpcv1.InstanceReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceBackupPolicyJobSourceInstanceDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -650,7 +650,7 @@ func dataSourceBackupPolicyJobTargetSnapshotToMap(targetSnapshotItem vpcv1.Snaps return targetSnapshotMap } -func dataSourceBackupPolicyJobTargetSnapshotDeletedToMap(deletedItem vpcv1.SnapshotReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceBackupPolicyJobTargetSnapshotDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go b/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go index 0377373cd2..d90df6531e 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go @@ -571,7 +571,7 @@ func dataSourceBackupPolicyJobCollectionJobsBackupPolicyPlanToMap(backupPolicyPl return backupPolicyPlanMap } -func dataSourceBackupPolicyJobCollectionBackupPolicyPlanDeletedToMap(deletedItem vpcv1.BackupPolicyPlanReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceBackupPolicyJobCollectionBackupPolicyPlanDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -639,7 +639,7 @@ func dataSourceBackupPolicyJobCollectionJobsSourceInstanceToMap(sourceVolumeItem return sourceVolumeMap } -func dataSourceBackupPolicyJobCollectionSourceVolumeDeletedToMap(deletedItem vpcv1.VolumeReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceBackupPolicyJobCollectionSourceVolumeDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -648,7 +648,7 @@ func dataSourceBackupPolicyJobCollectionSourceVolumeDeletedToMap(deletedItem vpc return deletedMap } -func dataSourceBackupPolicyJobCollectionSourceInstanceDeletedToMap(deletedItem vpcv1.InstanceReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceBackupPolicyJobCollectionSourceInstanceDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -702,7 +702,7 @@ func dataSourceBackupPolicyJobCollectionJobsTargetSnapshotToMap(targetSnapshotIt return targetSnapshotMap } -func dataSourceBackupPolicyJobCollectionTargetSnapshotDeletedToMap(deletedItem vpcv1.SnapshotReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceBackupPolicyJobCollectionTargetSnapshotDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_bare_metal_server.go b/ibm/service/vpc/data_source_ibm_is_bare_metal_server.go index 87bc367cfa..529ff295df 100644 --- a/ibm/service/vpc/data_source_ibm_is_bare_metal_server.go +++ b/ibm/service/vpc/data_source_ibm_is_bare_metal_server.go @@ -1205,7 +1205,7 @@ func dataSourceIBMIsBareMetalServerVirtualNetworkInterfaceReferenceAttachmentCon return modelMap, nil } -func dataSourceIBMIsBareMetalServerBareMetalServerNetworkAttachmentReferenceDeletedToMap(model *vpcv1.BareMetalServerNetworkAttachmentReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsBareMetalServerBareMetalServerNetworkAttachmentReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -1228,7 +1228,7 @@ func dataSourceIBMIsBareMetalServerReservedIPReferenceToMap(model *vpcv1.Reserve return modelMap, nil } -func dataSourceIBMIsBareMetalServerReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsBareMetalServerReservedIPReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -1251,7 +1251,7 @@ func dataSourceIBMIsBareMetalServerSubnetReferenceToMap(model *vpcv1.SubnetRefer return modelMap, nil } -func dataSourceIBMIsBareMetalServerSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsBareMetalServerSubnetReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/data_source_ibm_is_bare_metal_server_network_attachment.go b/ibm/service/vpc/data_source_ibm_is_bare_metal_server_network_attachment.go index 846656eb1e..a5ce63f9b8 100644 --- a/ibm/service/vpc/data_source_ibm_is_bare_metal_server_network_attachment.go +++ b/ibm/service/vpc/data_source_ibm_is_bare_metal_server_network_attachment.go @@ -346,7 +346,7 @@ func dataSourceIBMIsBareMetalServerNetworkAttachmentReservedIPReferenceToMap(mod return modelMap, nil } -func dataSourceIBMIsBareMetalServerNetworkAttachmentReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsBareMetalServerNetworkAttachmentReservedIPReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -369,7 +369,7 @@ func dataSourceIBMIsBareMetalServerNetworkAttachmentSubnetReferenceToMap(model * return modelMap, nil } -func dataSourceIBMIsBareMetalServerNetworkAttachmentSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsBareMetalServerNetworkAttachmentSubnetReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/data_source_ibm_is_bare_metal_server_network_attachments.go b/ibm/service/vpc/data_source_ibm_is_bare_metal_server_network_attachments.go index 074e7f8af8..ce3a6647a4 100644 --- a/ibm/service/vpc/data_source_ibm_is_bare_metal_server_network_attachments.go +++ b/ibm/service/vpc/data_source_ibm_is_bare_metal_server_network_attachments.go @@ -346,7 +346,7 @@ func dataSourceIBMIsBareMetalServerNetworkAttachmentsReservedIPReferenceToMap(mo return modelMap, nil } -func dataSourceIBMIsBareMetalServerNetworkAttachmentsReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsBareMetalServerNetworkAttachmentsReservedIPReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -369,7 +369,7 @@ func dataSourceIBMIsBareMetalServerNetworkAttachmentsSubnetReferenceToMap(model return modelMap, nil } -func dataSourceIBMIsBareMetalServerNetworkAttachmentsSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsBareMetalServerNetworkAttachmentsSubnetReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/data_source_ibm_is_dedicated_host.go b/ibm/service/vpc/data_source_ibm_is_dedicated_host.go index c224e1ddd3..beb0f4160c 100644 --- a/ibm/service/vpc/data_source_ibm_is_dedicated_host.go +++ b/ibm/service/vpc/data_source_ibm_is_dedicated_host.go @@ -587,7 +587,7 @@ func dataSourceDedicatedHostGroupToMap(groupItem vpcv1.DedicatedHostGroupReferen return groupMap } -func dataSourceDedicatedHostGroupDeletedToMap(deletedItem vpcv1.DedicatedHostGroupReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceDedicatedHostGroupDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -630,7 +630,7 @@ func dataSourceDedicatedHostInstancesToMap(instancesItem vpcv1.InstanceReference return instancesMap } -func dataSourceDedicatedHostInstancesDeletedToMap(deletedItem vpcv1.InstanceReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceDedicatedHostInstancesDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -816,7 +816,7 @@ func dataSourceDedicatedHostDisksInstanceDisksToMap(instanceDisksItem vpcv1.Inst return instanceDisksMap } -func dataSourceDedicatedHostInstanceDisksDeletedToMap(deletedItem vpcv1.InstanceDiskReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceDedicatedHostInstanceDisksDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_dedicated_host_disk.go b/ibm/service/vpc/data_source_ibm_is_dedicated_host_disk.go index def4fdae5d..1607b8c5e6 100644 --- a/ibm/service/vpc/data_source_ibm_is_dedicated_host_disk.go +++ b/ibm/service/vpc/data_source_ibm_is_dedicated_host_disk.go @@ -224,7 +224,7 @@ func dataSourceDedicatedHostDiskInstanceDisksToMap(instanceDisksItem vpcv1.Insta return instanceDisksMap } -func dataSourceDedicatedHostDiskInstanceDisksDeletedToMap(deletedItem vpcv1.InstanceDiskReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceDedicatedHostDiskInstanceDisksDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_dedicated_host_disks.go b/ibm/service/vpc/data_source_ibm_is_dedicated_host_disks.go index 756279b3eb..b740557a16 100644 --- a/ibm/service/vpc/data_source_ibm_is_dedicated_host_disks.go +++ b/ibm/service/vpc/data_source_ibm_is_dedicated_host_disks.go @@ -253,7 +253,7 @@ func dataSourceDedicatedHostDiskCollectionDisksInstanceDisksToMap(instanceDisksI return instanceDisksMap } -func dataSourceDedicatedHostDiskCollectionInstanceDisksDeletedToMap(deletedItem vpcv1.InstanceDiskReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceDedicatedHostDiskCollectionInstanceDisksDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_dedicated_host_group.go b/ibm/service/vpc/data_source_ibm_is_dedicated_host_group.go index d0ee6a88d8..1fd670bb0e 100644 --- a/ibm/service/vpc/data_source_ibm_is_dedicated_host_group.go +++ b/ibm/service/vpc/data_source_ibm_is_dedicated_host_group.go @@ -247,7 +247,7 @@ func dataSourceDedicatedHostGroupDedicatedHostsToMap(dedicatedHostsItem vpcv1.De return dedicatedHostsMap } -func dataSourceDedicatedHostGroupDedicatedHostsDeletedToMap(deletedItem vpcv1.DedicatedHostReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceDedicatedHostGroupDedicatedHostsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_dedicated_host_groups.go b/ibm/service/vpc/data_source_ibm_is_dedicated_host_groups.go index 59475a34da..3d91ec5abf 100644 --- a/ibm/service/vpc/data_source_ibm_is_dedicated_host_groups.go +++ b/ibm/service/vpc/data_source_ibm_is_dedicated_host_groups.go @@ -300,7 +300,7 @@ func dataSourceDedicatedHostGroupCollectionGroupsToMap(groupsItem vpcv1.Dedicate return groupsMap } -func dataSourceDedicatedHostGroupCollectionDedicatedHostsDeletedToMap(deletedItem vpcv1.DedicatedHostReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceDedicatedHostGroupCollectionDedicatedHostsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_dedicated_hosts.go b/ibm/service/vpc/data_source_ibm_is_dedicated_hosts.go index bf3d709b20..436ed7abb0 100644 --- a/ibm/service/vpc/data_source_ibm_is_dedicated_hosts.go +++ b/ibm/service/vpc/data_source_ibm_is_dedicated_hosts.go @@ -637,7 +637,7 @@ func dataSourceDedicatedHostCollectionDedicatedHostsGroupToMap(groupItem vpcv1.D return groupMap } -func dataSourceDedicatedHostCollectionGroupDeletedToMap(deletedItem vpcv1.DedicatedHostGroupReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceDedicatedHostCollectionGroupDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -647,7 +647,7 @@ func dataSourceDedicatedHostCollectionGroupDeletedToMap(deletedItem vpcv1.Dedica return deletedMap } -func dataSourceDedicatedHostCollectionInstancesDeletedToMap(deletedItem vpcv1.InstanceReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceDedicatedHostCollectionInstancesDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_floating_ip.go b/ibm/service/vpc/data_source_ibm_is_floating_ip.go index c682691637..7608641db8 100644 --- a/ibm/service/vpc/data_source_ibm_is_floating_ip.go +++ b/ibm/service/vpc/data_source_ibm_is_floating_ip.go @@ -379,7 +379,7 @@ func dataSourceFloatingIPCollectionFloatingIpTargetToMap(targetItemIntf vpcv1.Fl return targetId, targetMap } -func dataSourceFloatingIPTargetNicDeletedToMap(deletedItem vpcv1.NetworkInterfaceReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceFloatingIPTargetNicDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -388,7 +388,7 @@ func dataSourceFloatingIPTargetNicDeletedToMap(deletedItem vpcv1.NetworkInterfac return deletedMap } -func dataSourceFloatingIPTargetPgDeletedToMap(deletedItem vpcv1.PublicGatewayReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceFloatingIPTargetPgDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_floating_ips.go b/ibm/service/vpc/data_source_ibm_is_floating_ips.go index b37d86d3cd..f62b12ad16 100644 --- a/ibm/service/vpc/data_source_ibm_is_floating_ips.go +++ b/ibm/service/vpc/data_source_ibm_is_floating_ips.go @@ -502,7 +502,7 @@ func dataSourceFloatingIPCollectionFloatingIpsTargetToMap(targetItemIntf vpcv1.F return targetMap } -func dataSourceFloatingIPCollectionTargetNicDeletedToMap(deletedItem vpcv1.NetworkInterfaceReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceFloatingIPCollectionTargetNicDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -511,7 +511,7 @@ func dataSourceFloatingIPCollectionTargetNicDeletedToMap(deletedItem vpcv1.Netwo return deletedMap } -func dataSourceFloatingIPCollectionTargetPgDeletedToMap(deletedItem vpcv1.PublicGatewayReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceFloatingIPCollectionTargetPgDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_flow_log.go b/ibm/service/vpc/data_source_ibm_is_flow_log.go index a4e54e313d..5f469286c7 100644 --- a/ibm/service/vpc/data_source_ibm_is_flow_log.go +++ b/ibm/service/vpc/data_source_ibm_is_flow_log.go @@ -392,7 +392,7 @@ func dataSourceFlowLogCollectorTargetToMap(targetItem vpcv1.FlowLogCollectorTarg return targetMap } -func dataSourceFlowLogCollectorTargetDeletedToMap(deletedItem vpcv1.NetworkInterfaceReferenceTargetContextDeleted) (deletedMap map[string]interface{}) { +func dataSourceFlowLogCollectorTargetDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -435,7 +435,7 @@ func dataSourceFlowLogCollectorVPCToMap(vpcItem vpcv1.VPCReference) (vpcMap map[ return vpcMap } -func dataSourceFlowLogCollectorVPCDeletedToMap(deletedItem vpcv1.VPCReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceFlowLogCollectorVPCDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_ike_policies.go b/ibm/service/vpc/data_source_ibm_is_ike_policies.go index e14ff6c8e2..b2a351e03a 100644 --- a/ibm/service/vpc/data_source_ibm_is_ike_policies.go +++ b/ibm/service/vpc/data_source_ibm_is_ike_policies.go @@ -283,7 +283,7 @@ func dataSourceIkePolicyCollectionIkePoliciesConnectionsToMap(connectionsItem vp return connectionsMap } -func dataSourceIkePolicyCollectionConnectionsDeletedToMap(deletedItem vpcv1.VPNGatewayConnectionReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceIkePolicyCollectionConnectionsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_ike_policy.go b/ibm/service/vpc/data_source_ibm_is_ike_policy.go index 16580ea781..37ce857b16 100644 --- a/ibm/service/vpc/data_source_ibm_is_ike_policy.go +++ b/ibm/service/vpc/data_source_ibm_is_ike_policy.go @@ -284,7 +284,7 @@ func dataSourceIkePolicyConnectionsToMap(connectionsItem vpcv1.VPNGatewayConnect return connectionsMap } -func dataSourceIkePolicyConnectionsDeletedToMap(deletedItem vpcv1.VPNGatewayConnectionReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceIkePolicyConnectionsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_instance.go b/ibm/service/vpc/data_source_ibm_is_instance.go index d2148851a6..0e1aed9a50 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance.go +++ b/ibm/service/vpc/data_source_ibm_is_instance.go @@ -1193,7 +1193,7 @@ func DataSourceIBMISInstance() *schema.Resource { } } -func resourceIbmIsInstanceCatalogOfferingVersionPlanReferenceDeletedToMap(catalogOfferingVersionPlanReferenceDeleted vpcv1.CatalogOfferingVersionPlanReferenceDeleted) map[string]interface{} { +func resourceIbmIsInstanceCatalogOfferingVersionPlanReferenceDeletedToMap(catalogOfferingVersionPlanReferenceDeleted vpcv1.Deleted) map[string]interface{} { catalogOfferingVersionPlanReferenceDeletedMap := map[string]interface{}{} catalogOfferingVersionPlanReferenceDeletedMap["more_info"] = catalogOfferingVersionPlanReferenceDeleted.MoreInfo @@ -1701,7 +1701,7 @@ func instanceGetByName(d *schema.ResourceData, meta interface{}, name string) er } -func dataSourceInstanceReservationDeletedToMap(deletedItem vpcv1.ReservationReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceInstanceReservationDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -1832,7 +1832,7 @@ func dataSourceIBMIsInstanceVirtualNetworkInterfaceReferenceAttachmentContextToM modelMap["resource_type"] = model.ResourceType return modelMap, nil } -func dataSourceIBMIsInstanceInstanceNetworkAttachmentReferenceDeletedToMap(model *vpcv1.InstanceNetworkAttachmentReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsInstanceInstanceNetworkAttachmentReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -1869,13 +1869,13 @@ func dataSourceIBMIsInstanceSubnetReferenceToMap(model *vpcv1.SubnetReference) ( modelMap["resource_type"] = model.ResourceType return modelMap, nil } -func dataSourceIBMIsInstanceSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsInstanceSubnetReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil } -func dataSourceIBMIsInstanceReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsInstanceReservedIPReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/data_source_ibm_is_instance_groups.go b/ibm/service/vpc/data_source_ibm_is_instance_groups.go index 14c00d3d32..aa5c7106fd 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance_groups.go +++ b/ibm/service/vpc/data_source_ibm_is_instance_groups.go @@ -496,7 +496,7 @@ func DataSourceIBMIsInstanceGroupsInstanceTemplateReferenceToMap(model *vpcv1.In return modelMap, nil } -func DataSourceIBMIsInstanceGroupsInstanceTemplateReferenceDeletedToMap(model *vpcv1.InstanceTemplateReferenceDeleted) (map[string]interface{}, error) { +func DataSourceIBMIsInstanceGroupsInstanceTemplateReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -525,7 +525,7 @@ func DataSourceIBMIsInstanceGroupsLoadBalancerPoolReferenceToMap(model *vpcv1.Lo return modelMap, nil } -func DataSourceIBMIsInstanceGroupsLoadBalancerPoolReferenceDeletedToMap(model *vpcv1.LoadBalancerPoolReferenceDeleted) (map[string]interface{}, error) { +func DataSourceIBMIsInstanceGroupsLoadBalancerPoolReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -554,7 +554,7 @@ func DataSourceIBMIsInstanceGroupsInstanceGroupManagerReferenceToMap(model *vpcv return modelMap, nil } -func DataSourceIBMIsInstanceGroupsInstanceGroupManagerReferenceDeletedToMap(model *vpcv1.InstanceGroupManagerReferenceDeleted) (map[string]interface{}, error) { +func DataSourceIBMIsInstanceGroupsInstanceGroupManagerReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -603,7 +603,7 @@ func DataSourceIBMIsInstanceGroupsSubnetReferenceToMap(model *vpcv1.SubnetRefere return modelMap, nil } -func DataSourceIBMIsInstanceGroupsSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { +func DataSourceIBMIsInstanceGroupsSubnetReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -638,7 +638,7 @@ func DataSourceIBMIsInstanceGroupsVPCReferenceToMap(model *vpcv1.VPCReference) ( return modelMap, nil } -func DataSourceIBMIsInstanceGroupsVPCReferenceDeletedToMap(model *vpcv1.VPCReferenceDeleted) (map[string]interface{}, error) { +func DataSourceIBMIsInstanceGroupsVPCReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo diff --git a/ibm/service/vpc/data_source_ibm_is_instance_network_attachment.go b/ibm/service/vpc/data_source_ibm_is_instance_network_attachment.go index 3764651581..b63fce5671 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance_network_attachment.go +++ b/ibm/service/vpc/data_source_ibm_is_instance_network_attachment.go @@ -302,7 +302,7 @@ func dataSourceIBMIsInstanceNetworkAttachmentReservedIPReferenceToMap(model *vpc return modelMap, nil } -func dataSourceIBMIsInstanceNetworkAttachmentReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsInstanceNetworkAttachmentReservedIPReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -325,7 +325,7 @@ func dataSourceIBMIsInstanceNetworkAttachmentSubnetReferenceToMap(model *vpcv1.S return modelMap, nil } -func dataSourceIBMIsInstanceNetworkAttachmentSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsInstanceNetworkAttachmentSubnetReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/data_source_ibm_is_instance_network_attachments.go b/ibm/service/vpc/data_source_ibm_is_instance_network_attachments.go index d530da4e44..0b2b66ab98 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance_network_attachments.go +++ b/ibm/service/vpc/data_source_ibm_is_instance_network_attachments.go @@ -294,7 +294,7 @@ func dataSourceIBMIsInstanceNetworkAttachmentsReservedIPReferenceToMap(model *vp return modelMap, nil } -func dataSourceIBMIsInstanceNetworkAttachmentsReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsInstanceNetworkAttachmentsReservedIPReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -317,7 +317,7 @@ func dataSourceIBMIsInstanceNetworkAttachmentsSubnetReferenceToMap(model *vpcv1. return modelMap, nil } -func dataSourceIBMIsInstanceNetworkAttachmentsSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsInstanceNetworkAttachmentsSubnetReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/data_source_ibm_is_instance_network_interface.go b/ibm/service/vpc/data_source_ibm_is_instance_network_interface.go index bba64f8c06..e33f6c812f 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance_network_interface.go +++ b/ibm/service/vpc/data_source_ibm_is_instance_network_interface.go @@ -409,7 +409,7 @@ func dataSourceNetworkInterfaceFloatingIpsToMap(floatingIpsItem vpcv1.FloatingIP return floatingIpsMap } -func dataSourceNetworkInterfaceFloatingIpsDeletedToMap(deletedItem vpcv1.FloatingIPReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceNetworkInterfaceFloatingIpsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -452,7 +452,7 @@ func dataSourceNetworkInterfaceSecurityGroupsToMap(securityGroupsItem vpcv1.Secu return securityGroupsMap } -func dataSourceNetworkInterfaceSecurityGroupsDeletedToMap(deletedItem vpcv1.SecurityGroupReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceNetworkInterfaceSecurityGroupsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -495,7 +495,7 @@ func dataSourceNetworkInterfaceSubnetToMap(subnetItem vpcv1.SubnetReference) (su return subnetMap } -func dataSourceNetworkInterfaceSubnetDeletedToMap(deletedItem vpcv1.SubnetReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceNetworkInterfaceSubnetDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_ipsec_policies.go b/ibm/service/vpc/data_source_ibm_is_ipsec_policies.go index 37fee725c3..72cf4148f4 100644 --- a/ibm/service/vpc/data_source_ibm_is_ipsec_policies.go +++ b/ibm/service/vpc/data_source_ibm_is_ipsec_policies.go @@ -283,7 +283,7 @@ func dataSourceIPsecPolicyCollectionIpsecPoliciesConnectionsToMap(connectionsIte return connectionsMap } -func dataSourceIPsecPolicyCollectionConnectionsDeletedToMap(deletedItem vpcv1.VPNGatewayConnectionReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceIPsecPolicyCollectionConnectionsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_ipsec_policy.go b/ibm/service/vpc/data_source_ibm_is_ipsec_policy.go index b4a7a64bda..ce2c9e04cd 100644 --- a/ibm/service/vpc/data_source_ibm_is_ipsec_policy.go +++ b/ibm/service/vpc/data_source_ibm_is_ipsec_policy.go @@ -286,7 +286,7 @@ func dataSourceIPsecPolicyConnectionsToMap(connectionsItem vpcv1.VPNGatewayConne return connectionsMap } -func dataSourceIPsecPolicyConnectionsDeletedToMap(deletedItem vpcv1.VPNGatewayConnectionReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceIPsecPolicyConnectionsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_lb_listener.go b/ibm/service/vpc/data_source_ibm_is_lb_listener.go index cb8fd43cf1..c516c118d0 100644 --- a/ibm/service/vpc/data_source_ibm_is_lb_listener.go +++ b/ibm/service/vpc/data_source_ibm_is_lb_listener.go @@ -352,7 +352,7 @@ func dataSourceLoadBalancerListenerDefaultPoolToMap(defaultPoolItem vpcv1.LoadBa return defaultPoolMap } -func dataSourceLoadBalancerListenerDefaultPoolDeletedToMap(deletedItem vpcv1.LoadBalancerPoolReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerListenerDefaultPoolDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -408,7 +408,7 @@ func dataSourceLoadBalancerListenerHTTPSRedirectListenerToMap(listenerItem vpcv1 return listenerMap } -func dataSourceLoadBalancerListenerListenerDeletedToMap(deletedItem vpcv1.LoadBalancerListenerReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerListenerListenerDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -445,7 +445,7 @@ func dataSourceLoadBalancerListenerPoliciesToMap(policiesItem vpcv1.LoadBalancer return policiesMap } -func dataSourceLoadBalancerListenerPoliciesDeletedToMap(deletedItem vpcv1.LoadBalancerListenerPolicyReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerListenerPoliciesDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_lb_listener_policies.go b/ibm/service/vpc/data_source_ibm_is_lb_listener_policies.go index 4a3232fce1..363400096b 100644 --- a/ibm/service/vpc/data_source_ibm_is_lb_listener_policies.go +++ b/ibm/service/vpc/data_source_ibm_is_lb_listener_policies.go @@ -299,7 +299,7 @@ func dataSourceLoadBalancerListenerPolicyCollectionPoliciesRulesToMap(rulesItem return rulesMap } -func dataSourceLoadBalancerListenerPolicyCollectionRulesDeletedToMap(deletedItem vpcv1.LoadBalancerListenerPolicyRuleReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerListenerPolicyCollectionRulesDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -346,7 +346,7 @@ func dataSourceLoadBalancerListenerPolicyCollectionPoliciesTargetToMap(targetIte return targetMap } -func dataSourceLoadBalancerListenerPolicyCollectionTargetDeletedToMap(deletedItem vpcv1.LoadBalancerPoolReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerListenerPolicyCollectionTargetDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -375,7 +375,7 @@ func dataSourceLoadBalancerListenerPolicyCollectionTargetListenerToMap(listenerI return listenerMap } -func dataSourceLoadBalancerListenerPolicyCollectionListenerDeletedToMap(deletedItem vpcv1.LoadBalancerListenerReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerListenerPolicyCollectionListenerDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_lb_listener_policy.go b/ibm/service/vpc/data_source_ibm_is_lb_listener_policy.go index 9ebd0df2bb..90ba7066f6 100644 --- a/ibm/service/vpc/data_source_ibm_is_lb_listener_policy.go +++ b/ibm/service/vpc/data_source_ibm_is_lb_listener_policy.go @@ -270,7 +270,7 @@ func dataSourceLoadBalancerListenerPolicyRulesToMap(rulesItem vpcv1.LoadBalancer return rulesMap } -func dataSourceLoadBalancerListenerPolicyRulesDeletedToMap(deletedItem vpcv1.LoadBalancerListenerPolicyRuleReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerListenerPolicyRulesDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -325,7 +325,7 @@ func dataSourceLoadBalancerListenerPolicyTargetToMap(targetItem vpcv1.LoadBalanc return targetMap } -func dataSourceLoadBalancerListenerPolicyTargetDeletedToMap(deletedItem vpcv1.LoadBalancerPoolReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerListenerPolicyTargetDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -354,7 +354,7 @@ func dataSourceLoadBalancerListenerPolicyTargetListenerToMap(listenerItem vpcv1. return listenerMap } -func dataSourceLoadBalancerListenerPolicyListenerDeletedToMap(deletedItem vpcv1.LoadBalancerListenerReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerListenerPolicyListenerDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_lb_listeners.go b/ibm/service/vpc/data_source_ibm_is_lb_listeners.go index 97c569fc36..4bde6f70fa 100644 --- a/ibm/service/vpc/data_source_ibm_is_lb_listeners.go +++ b/ibm/service/vpc/data_source_ibm_is_lb_listeners.go @@ -368,7 +368,7 @@ func dataSourceLoadBalancerListenerCollectionListenersDefaultPoolToMap(defaultPo return defaultPoolMap } -func dataSourceLoadBalancerListenerCollectionDefaultPoolDeletedToMap(deletedItem vpcv1.LoadBalancerPoolReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerListenerCollectionDefaultPoolDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -416,7 +416,7 @@ func dataSourceLoadBalancerListenerCollectionHTTPSRedirectListenerToMap(listener return listenerMap } -func dataSourceLoadBalancerListenerCollectionListenerDeletedToMap(deletedItem vpcv1.LoadBalancerListenerReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerListenerCollectionListenerDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -445,7 +445,7 @@ func dataSourceLoadBalancerListenerCollectionListenersPoliciesToMap(policiesItem return policiesMap } -func dataSourceLoadBalancerListenerCollectionPoliciesDeletedToMap(deletedItem vpcv1.LoadBalancerListenerPolicyReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerListenerCollectionPoliciesDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_lb_pool.go b/ibm/service/vpc/data_source_ibm_is_lb_pool.go index 9e1c8870d2..c875c48d2c 100644 --- a/ibm/service/vpc/data_source_ibm_is_lb_pool.go +++ b/ibm/service/vpc/data_source_ibm_is_lb_pool.go @@ -377,7 +377,7 @@ func dataSourceLoadBalancerPoolInstanceGroupToMap(instanceGroupItem vpcv1.Instan return instanceGroupMap } -func dataSourceLoadBalancerPoolInstanceGroupDeletedToMap(deletedItem vpcv1.InstanceGroupReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerPoolInstanceGroupDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -414,7 +414,7 @@ func dataSourceLoadBalancerPoolMembersToMap(membersItem vpcv1.LoadBalancerPoolMe return membersMap } -func dataSourceLoadBalancerPoolMembersDeletedToMap(deletedItem vpcv1.LoadBalancerPoolMemberReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerPoolMembersDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_lb_pool_member.go b/ibm/service/vpc/data_source_ibm_is_lb_pool_member.go index 8ccd2550f2..78619eb6bf 100644 --- a/ibm/service/vpc/data_source_ibm_is_lb_pool_member.go +++ b/ibm/service/vpc/data_source_ibm_is_lb_pool_member.go @@ -202,7 +202,7 @@ func dataSourceLoadBalancerPoolMemberTargetToMap(targetItem vpcv1.LoadBalancerPo return targetMap } -func dataSourceLoadBalancerPoolMemberTargetDeletedToMap(deletedItem vpcv1.InstanceReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerPoolMemberTargetDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_lb_pool_members.go b/ibm/service/vpc/data_source_ibm_is_lb_pool_members.go index 8d07993be8..ee158afe1e 100644 --- a/ibm/service/vpc/data_source_ibm_is_lb_pool_members.go +++ b/ibm/service/vpc/data_source_ibm_is_lb_pool_members.go @@ -231,7 +231,7 @@ func dataSourceLoadBalancerPoolMemberCollectionMembersTargetToMap(targetItem vpc return targetMap } -func dataSourceLoadBalancerPoolMemberCollectionTargetDeletedToMap(deletedItem vpcv1.InstanceReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerPoolMemberCollectionTargetDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_lb_pools.go b/ibm/service/vpc/data_source_ibm_is_lb_pools.go index 7726246568..1a2595e169 100644 --- a/ibm/service/vpc/data_source_ibm_is_lb_pools.go +++ b/ibm/service/vpc/data_source_ibm_is_lb_pools.go @@ -362,7 +362,7 @@ func dataSourceLoadBalancerPoolCollectionPoolsInstanceGroupToMap(instanceGroupIt return instanceGroupMap } -func dataSourceLoadBalancerPoolCollectionInstanceGroupDeletedToMap(deletedItem vpcv1.InstanceGroupReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerPoolCollectionInstanceGroupDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -391,7 +391,7 @@ func dataSourceLoadBalancerPoolCollectionPoolsMembersToMap(membersItem vpcv1.Loa return membersMap } -func dataSourceLoadBalancerPoolCollectionMembersDeletedToMap(deletedItem vpcv1.LoadBalancerPoolMemberReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceLoadBalancerPoolCollectionMembersDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_network_acl.go b/ibm/service/vpc/data_source_ibm_is_network_acl.go index 36a52369b3..bfe70ea60f 100644 --- a/ibm/service/vpc/data_source_ibm_is_network_acl.go +++ b/ibm/service/vpc/data_source_ibm_is_network_acl.go @@ -623,7 +623,7 @@ func dataSourceNetworkACLRulesBeforeToMap(beforeItem vpcv1.NetworkACLRuleReferen return beforeMap } -func dataSourceNetworkACLBeforeDeletedToMap(deletedItem vpcv1.NetworkACLRuleReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceNetworkACLBeforeDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -666,7 +666,7 @@ func dataSourceNetworkACLSubnetsToMap(subnetsItem vpcv1.SubnetReference) (subnet return subnetsMap } -func dataSourceNetworkACLSubnetsDeletedToMap(deletedItem vpcv1.SubnetReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceNetworkACLSubnetsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -709,7 +709,7 @@ func dataSourceNetworkACLVPCToMap(vpcItem vpcv1.VPCReference) (vpcMap map[string return vpcMap } -func dataSourceNetworkACLVPCDeletedToMap(deletedItem vpcv1.VPCReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceNetworkACLVPCDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_network_acls.go b/ibm/service/vpc/data_source_ibm_is_network_acls.go index 5aa14ba041..7d89bcf894 100644 --- a/ibm/service/vpc/data_source_ibm_is_network_acls.go +++ b/ibm/service/vpc/data_source_ibm_is_network_acls.go @@ -502,7 +502,7 @@ func dataSourceNetworkACLCollectionRulesBeforeToMap(beforeItem vpcv1.NetworkACLR return beforeMap } -func dataSourceNetworkACLCollectionBeforeDeletedToMap(deletedItem vpcv1.NetworkACLRuleReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceNetworkACLCollectionBeforeDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -537,7 +537,7 @@ func dataSourceNetworkACLCollectionNetworkAclsSubnetsToMap(subnetsItem vpcv1.Sub return subnetsMap } -func dataSourceNetworkACLCollectionSubnetsDeletedToMap(deletedItem vpcv1.SubnetReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceNetworkACLCollectionSubnetsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -572,7 +572,7 @@ func dataSourceNetworkACLCollectionNetworkAclsVPCToMap(vpcItem vpcv1.VPCReferenc return vpcMap } -func dataSourceNetworkACLCollectionVPCDeletedToMap(deletedItem vpcv1.VPCReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceNetworkACLCollectionVPCDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_security_group_rule.go b/ibm/service/vpc/data_source_ibm_is_security_group_rule.go index 4226aec4ea..57c30352fc 100644 --- a/ibm/service/vpc/data_source_ibm_is_security_group_rule.go +++ b/ibm/service/vpc/data_source_ibm_is_security_group_rule.go @@ -356,7 +356,7 @@ func dataSourceSecurityGroupRuleLocalToMap(localItem *vpcv1.SecurityGroupRuleLoc return localMap } -func dataSourceSecurityGroupRuleRemoteDeletedToMap(deletedItem *vpcv1.SecurityGroupReferenceDeleted) (resultMap map[string]interface{}) { +func dataSourceSecurityGroupRuleRemoteDeletedToMap(deletedItem *vpcv1.Deleted) (resultMap map[string]interface{}) { resultMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_security_group_rules.go b/ibm/service/vpc/data_source_ibm_is_security_group_rules.go index 0917fd97e5..f99edd4f19 100644 --- a/ibm/service/vpc/data_source_ibm_is_security_group_rules.go +++ b/ibm/service/vpc/data_source_ibm_is_security_group_rules.go @@ -263,7 +263,7 @@ func dataSourceIBMIsSecurityGroupRulesID(d *schema.ResourceData) string { return time.Now().UTC().String() } -func dataSourceSecurityGroupRuleCollectionRemoteDeletedToMap(deletedItem *vpcv1.SecurityGroupReferenceDeleted) (resultMap map[string]interface{}) { +func dataSourceSecurityGroupRuleCollectionRemoteDeletedToMap(deletedItem *vpcv1.Deleted) (resultMap map[string]interface{}) { resultMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_security_groups.go b/ibm/service/vpc/data_source_ibm_is_security_groups.go index a24137927c..791c7fc43f 100644 --- a/ibm/service/vpc/data_source_ibm_is_security_groups.go +++ b/ibm/service/vpc/data_source_ibm_is_security_groups.go @@ -589,7 +589,7 @@ func dataSourceSecurityGroupCollectionSecurityGroupsRulesToMap(rulesItem vpcv1.S return resultMap } -func dataSourceSecurityGroupCollectionRemoteDeletedToMap(deletedItem *vpcv1.SecurityGroupReferenceDeleted) (resultMap map[string]interface{}) { +func dataSourceSecurityGroupCollectionRemoteDeletedToMap(deletedItem *vpcv1.Deleted) (resultMap map[string]interface{}) { resultMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -654,7 +654,7 @@ func dataSourceSecurityGroupCollectionSecurityGroupsTargetsToMap(targetsItem vpc return resultMap } -func dataSourceSecurityGroupCollectionTargetsDeletedToMap(deletedItem *vpcv1.NetworkInterfaceReferenceTargetContextDeleted) (resultMap map[string]interface{}) { +func dataSourceSecurityGroupCollectionTargetsDeletedToMap(deletedItem *vpcv1.Deleted) (resultMap map[string]interface{}) { resultMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -664,7 +664,7 @@ func dataSourceSecurityGroupCollectionTargetsDeletedToMap(deletedItem *vpcv1.Net return resultMap } -func dataSourceSecurityGroupCollectionTargetsDeleted2ToMap(deletedItem *vpcv1.LoadBalancerReferenceDeleted) (resultMap map[string]interface{}) { +func dataSourceSecurityGroupCollectionTargetsDeleted2ToMap(deletedItem *vpcv1.Deleted) (resultMap map[string]interface{}) { resultMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -699,7 +699,7 @@ func dataSourceSecurityGroupCollectionSecurityGroupsVPCToMap(vpcItem *vpcv1.VPCR return resultMap } -func dataSourceSecurityGroupCollectionVPCDeletedToMap(deletedItem *vpcv1.VPCReferenceDeleted) (resultMap map[string]interface{}) { +func dataSourceSecurityGroupCollectionVPCDeletedToMap(deletedItem *vpcv1.Deleted) (resultMap map[string]interface{}) { resultMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_share.go b/ibm/service/vpc/data_source_ibm_is_share.go index 48100560e9..6c321acb33 100644 --- a/ibm/service/vpc/data_source_ibm_is_share.go +++ b/ibm/service/vpc/data_source_ibm_is_share.go @@ -778,7 +778,7 @@ func dataSourceShareTargetsToMap(targetsItem vpcv1.ShareMountTargetReference) (t return targetsMap } -func dataSourceShareTargetsDeletedToMap(deletedItem vpcv1.ShareMountTargetReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceShareTargetsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -868,7 +868,7 @@ func dataSourceShareReplicaShareToMap(replicaShareItem vpcv1.ShareReference) (re return replicaShareMap } -func dataSourceShareReplicaShareDeletedToMap(deletedItem vpcv1.ShareReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceShareReplicaShareDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -938,7 +938,7 @@ func dataSourceShareSourceShareToMap(sourceShareItem vpcv1.ShareReference) (sour return sourceShareMap } -func dataSourceShareSourceShareDeletedToMap(deletedItem vpcv1.ShareReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceShareSourceShareDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_share_accessor_binding.go b/ibm/service/vpc/data_source_ibm_is_share_accessor_binding.go index 16432fa551..c4030f99c2 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_accessor_binding.go +++ b/ibm/service/vpc/data_source_ibm_is_share_accessor_binding.go @@ -251,7 +251,7 @@ func DataSourceIBMIsShareAccessorBindingShareAccessorBindingAccessorToMap(model } } -func DataSourceIBMIsShareAccessorBindingShareReferenceDeletedToMap(model *vpcv1.ShareReferenceDeleted) (map[string]interface{}, error) { +func DataSourceIBMIsShareAccessorBindingShareReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = *model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/data_source_ibm_is_share_accessor_binding_test.go b/ibm/service/vpc/data_source_ibm_is_share_accessor_binding_test.go index ffbadde4a5..70ffb32cbf 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_accessor_binding_test.go +++ b/ibm/service/vpc/data_source_ibm_is_share_accessor_binding_test.go @@ -89,7 +89,7 @@ func TestDataSourceIBMIsShareAccessorBindingShareAccessorBindingAccessorToMap(t assert.Equal(t, result, model) } - shareReferenceDeletedModel := new(vpcv1.ShareReferenceDeleted) + shareReferenceDeletedModel := new(vpcv1.Deleted) shareReferenceDeletedModel.MoreInfo = core.StringPtr("https://cloud.ibm.com/apidocs/vpc#deleted-resources") accountReferenceModel := new(vpcv1.AccountReference) @@ -126,7 +126,7 @@ func TestDataSourceIBMIsShareAccessorBindingShareReferenceDeletedToMap(t *testin assert.Equal(t, result, model) } - model := new(vpcv1.ShareReferenceDeleted) + model := new(vpcv1.Deleted) model.MoreInfo = core.StringPtr("https://cloud.ibm.com/apidocs/vpc#deleted-resources") result, err := vpc.DataSourceIBMIsShareAccessorBindingShareReferenceDeletedToMap(model) @@ -233,7 +233,7 @@ func TestDataSourceIBMIsShareAccessorBindingShareAccessorBindingAccessorShareRef assert.Equal(t, result, model) } - shareReferenceDeletedModel := new(vpcv1.ShareReferenceDeleted) + shareReferenceDeletedModel := new(vpcv1.Deleted) shareReferenceDeletedModel.MoreInfo = core.StringPtr("https://cloud.ibm.com/apidocs/vpc#deleted-resources") accountReferenceModel := new(vpcv1.AccountReference) diff --git a/ibm/service/vpc/data_source_ibm_is_share_accessor_bindings.go b/ibm/service/vpc/data_source_ibm_is_share_accessor_bindings.go index 8649fa6a09..4fefad2bd3 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_accessor_bindings.go +++ b/ibm/service/vpc/data_source_ibm_is_share_accessor_bindings.go @@ -274,7 +274,7 @@ func DataSourceIBMIsShareAccessorBindingsShareAccessorBindingAccessorToMap(model } } -func DataSourceIBMIsShareAccessorBindingsShareReferenceDeletedToMap(model *vpcv1.ShareReferenceDeleted) (map[string]interface{}, error) { +func DataSourceIBMIsShareAccessorBindingsShareReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = *model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/data_source_ibm_is_share_accessor_bindings_test.go b/ibm/service/vpc/data_source_ibm_is_share_accessor_bindings_test.go index f717e6b047..6af1a6f07d 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_accessor_bindings_test.go +++ b/ibm/service/vpc/data_source_ibm_is_share_accessor_bindings_test.go @@ -91,7 +91,7 @@ func TestDataSourceIBMIsShareAccessorBindingsShareAccessorBindingToMap(t *testin assert.Equal(t, result, model) } - shareReferenceDeletedModel := new(vpcv1.ShareReferenceDeleted) + shareReferenceDeletedModel := new(vpcv1.Deleted) shareReferenceDeletedModel.MoreInfo = core.StringPtr("https://cloud.ibm.com/apidocs/vpc#deleted-resources") accountReferenceModel := new(vpcv1.AccountReference) @@ -157,7 +157,7 @@ func TestDataSourceIBMIsShareAccessorBindingsShareAccessorBindingAccessorToMap(t assert.Equal(t, result, model) } - shareReferenceDeletedModel := new(vpcv1.ShareReferenceDeleted) + shareReferenceDeletedModel := new(vpcv1.Deleted) shareReferenceDeletedModel.MoreInfo = core.StringPtr("https://cloud.ibm.com/apidocs/vpc#deleted-resources") accountReferenceModel := new(vpcv1.AccountReference) @@ -194,7 +194,7 @@ func TestDataSourceIBMIsShareAccessorBindingsShareReferenceDeletedToMap(t *testi assert.Equal(t, result, model) } - model := new(vpcv1.ShareReferenceDeleted) + model := new(vpcv1.Deleted) model.MoreInfo = core.StringPtr("https://cloud.ibm.com/apidocs/vpc#deleted-resources") result, err := vpc.DataSourceIBMIsShareAccessorBindingsShareReferenceDeletedToMap(model) @@ -301,7 +301,7 @@ func TestDataSourceIBMIsShareAccessorBindingsShareAccessorBindingAccessorShareRe assert.Equal(t, result, model) } - shareReferenceDeletedModel := new(vpcv1.ShareReferenceDeleted) + shareReferenceDeletedModel := new(vpcv1.Deleted) shareReferenceDeletedModel.MoreInfo = core.StringPtr("https://cloud.ibm.com/apidocs/vpc#deleted-resources") accountReferenceModel := new(vpcv1.AccountReference) diff --git a/ibm/service/vpc/data_source_ibm_is_share_mount_target.go b/ibm/service/vpc/data_source_ibm_is_share_mount_target.go index 577f223188..8b2ec5dea9 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_mount_target.go +++ b/ibm/service/vpc/data_source_ibm_is_share_mount_target.go @@ -427,7 +427,7 @@ func dataSourceShareMountTargetVpcToMap(vpcItem vpcv1.VPCReference) (vpcMap map[ return vpcMap } -func dataSourceShareMountTargetVpcDeletedToMap(deletedItem vpcv1.VPCReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceShareMountTargetVpcDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -474,7 +474,7 @@ func dataSourceShareTargetPrimaryIPToMap(primaryIPItem vpcv1.ReservedIPReference return primaryIPMap } -func dataSourceShareTargetPrimaryIPDeletedToMap(deletedItem vpcv1.ReservedIPReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceShareTargetPrimaryIPDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -521,7 +521,7 @@ func dataSourceShareTargetSubnetToMap(subnetItem vpcv1.SubnetReference) (subnetM return subnetMap } -func dataSourceShareTargetSubnetDeletedToMap(deletedItem vpcv1.SubnetReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceShareTargetSubnetDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_snapshot.go b/ibm/service/vpc/data_source_ibm_is_snapshot.go index 3e82882fde..75a3ca6cdc 100644 --- a/ibm/service/vpc/data_source_ibm_is_snapshot.go +++ b/ibm/service/vpc/data_source_ibm_is_snapshot.go @@ -748,7 +748,7 @@ func snapshotGetByNameOrID(d *schema.ResourceData, meta interface{}, name, id st } } -func resourceIbmIsSnapshotCatalogOfferingVersionPlanReferenceDeletedToMap(catalogOfferingVersionPlanReferenceDeleted vpcv1.CatalogOfferingVersionPlanReferenceDeleted) map[string]interface{} { +func resourceIbmIsSnapshotCatalogOfferingVersionPlanReferenceDeletedToMap(catalogOfferingVersionPlanReferenceDeleted vpcv1.Deleted) map[string]interface{} { catalogOfferingVersionPlanReferenceDeletedMap := map[string]interface{}{} catalogOfferingVersionPlanReferenceDeletedMap["more_info"] = catalogOfferingVersionPlanReferenceDeleted.MoreInfo diff --git a/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go index 6dc6c45c17..9b193fb4b4 100644 --- a/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go +++ b/ibm/service/vpc/data_source_ibm_is_snapshot_consistency_group.go @@ -510,7 +510,7 @@ func dataSourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceToMap(model return modelMap, nil } -func dataSourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceDeletedToMap(model *vpcv1.BackupPolicyPlanReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -567,7 +567,7 @@ func dataSourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsIte return modelMap, nil } -func dataSourceIBMIsSnapshotConsistencyGroupSnapshotReferenceDeletedToMap(model *vpcv1.SnapshotReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsSnapshotConsistencyGroupSnapshotReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/data_source_ibm_is_snapshots.go b/ibm/service/vpc/data_source_ibm_is_snapshots.go index ef227c9250..4689bc75e1 100644 --- a/ibm/service/vpc/data_source_ibm_is_snapshots.go +++ b/ibm/service/vpc/data_source_ibm_is_snapshots.go @@ -802,7 +802,7 @@ func dataSourceIBMIsSnapshotsSnapshotCopiesItemToMap(model *vpcv1.SnapshotCopies return modelMap, nil } -func dataSourceIBMIsSnapshotsSnapshotRemoteReferenceDeletedToMap(model *vpcv1.SnapshotReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsSnapshotsSnapshotRemoteReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo diff --git a/ibm/service/vpc/data_source_ibm_is_subnet.go b/ibm/service/vpc/data_source_ibm_is_subnet.go index 92154b1759..57885ea49c 100644 --- a/ibm/service/vpc/data_source_ibm_is_subnet.go +++ b/ibm/service/vpc/data_source_ibm_is_subnet.go @@ -318,7 +318,7 @@ func subnetGetByNameOrID(d *schema.ResourceData, meta interface{}) error { return nil } -func dataSourcesubnetRoutingTableDeletedToMap(deletedItem vpcv1.RoutingTableReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourcesubnetRoutingTableDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ips.go b/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ips.go index 7777bb175d..6f85003c3e 100644 --- a/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ips.go +++ b/ibm/service/vpc/data_source_ibm_is_subnet_reserved_ips.go @@ -277,7 +277,7 @@ func dataSourceIBMIsReservedIPReservedIPTargetToMap(model vpcv1.ReservedIPTarget } } -func dataSourceIBMIsReservedIPEndpointGatewayReferenceDeletedToMap(model *vpcv1.EndpointGatewayReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsReservedIPEndpointGatewayReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -326,7 +326,7 @@ func dataSourceIBMIsReservedIPReservedIPTargetNetworkInterfaceReferenceTargetCon return modelMap, nil } -func dataSourceIBMIsReservedIPNetworkInterfaceReferenceTargetContextDeletedToMap(model *vpcv1.NetworkInterfaceReferenceTargetContextDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsReservedIPNetworkInterfaceReferenceTargetContextDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -348,7 +348,7 @@ func dataSourceIBMIsReservedIPReservedIPTargetBareMetalServerNetworkInterfaceRef return modelMap, nil } -func dataSourceIBMIsReservedIPBareMetalServerNetworkInterfaceReferenceTargetContextDeletedToMap(model *vpcv1.BareMetalServerNetworkInterfaceReferenceTargetContextDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsReservedIPBareMetalServerNetworkInterfaceReferenceTargetContextDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -371,7 +371,7 @@ func dataSourceIBMIsReservedIPReservedIPTargetLoadBalancerReferenceToMap(model * return modelMap, nil } -func dataSourceIBMIsReservedIPLoadBalancerReferenceDeletedToMap(model *vpcv1.LoadBalancerReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsReservedIPLoadBalancerReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -394,7 +394,7 @@ func dataSourceIBMIsReservedIPReservedIPTargetVPNGatewayReferenceToMap(model *vp return modelMap, nil } -func dataSourceIBMIsReservedIPVPNGatewayReferenceDeletedToMap(model *vpcv1.VPNGatewayReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsReservedIPVPNGatewayReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -417,7 +417,7 @@ func dataSourceIBMIsReservedIPReservedIPTargetVPNServerReferenceToMap(model *vpc return modelMap, nil } -func dataSourceIBMIsReservedIPVPNServerReferenceDeletedToMap(model *vpcv1.VPNServerReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsReservedIPVPNServerReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -437,7 +437,7 @@ func dataSourceIBMIsReservedIPReservedIPTargetGenericResourceReferenceToMap(mode return modelMap, nil } -func dataSourceIBMIsReservedIPGenericResourceReferenceDeletedToMap(model *vpcv1.GenericResourceReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsReservedIPGenericResourceReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go index ed62a65983..461876a103 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface.go @@ -630,7 +630,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(model *vpcv1 return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceReservedIPReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -676,7 +676,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceToMap(model *vp return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceDeletedToMap(model *vpcv1.SecurityGroupReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -711,7 +711,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceToMap(model *vpcv1.Sub return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceSubnetReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -750,7 +750,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetToMap(mo } } -func dataSourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model *vpcv1.ShareMountTargetReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -809,7 +809,7 @@ func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceToMap(model *vpcv1.VPCRef return modelMap, nil } -func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model *vpcv1.VPCReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo diff --git a/ibm/service/vpc/data_source_ibm_is_volume.go b/ibm/service/vpc/data_source_ibm_is_volume.go index 9994ed1797..95af9adeab 100644 --- a/ibm/service/vpc/data_source_ibm_is_volume.go +++ b/ibm/service/vpc/data_source_ibm_is_volume.go @@ -470,7 +470,7 @@ func volumeGet(d *schema.ResourceData, meta interface{}, name string) error { return nil } -func resourceIbmIsVolumeCatalogOfferingVersionPlanReferenceDeletedToMap(catalogOfferingVersionPlanReferenceDeleted vpcv1.CatalogOfferingVersionPlanReferenceDeleted) map[string]interface{} { +func resourceIbmIsVolumeCatalogOfferingVersionPlanReferenceDeletedToMap(catalogOfferingVersionPlanReferenceDeleted vpcv1.Deleted) map[string]interface{} { catalogOfferingVersionPlanReferenceDeletedMap := map[string]interface{}{} catalogOfferingVersionPlanReferenceDeletedMap["more_info"] = catalogOfferingVersionPlanReferenceDeleted.MoreInfo diff --git a/ibm/service/vpc/data_source_ibm_is_volumes.go b/ibm/service/vpc/data_source_ibm_is_volumes.go index aec47ddeed..8a8e449da4 100644 --- a/ibm/service/vpc/data_source_ibm_is_volumes.go +++ b/ibm/service/vpc/data_source_ibm_is_volumes.go @@ -952,7 +952,7 @@ func dataSourceVolumeCollectionVolumesSourceImageToMap(sourceImageItem vpcv1.Ima return sourceImageMap } -func dataSourceVolumeCollectionSourceImageDeletedToMap(deletedItem vpcv1.ImageReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVolumeCollectionSourceImageDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -990,7 +990,7 @@ func dataSourceVolumeCollectionVolumesSourceSnapshotToMap(sourceSnapshotItem vpc return sourceSnapshotMap } -func dataSourceVolumeCollectionSourceSnapshotDeletedToMap(deletedItem vpcv1.SnapshotReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVolumeCollectionSourceSnapshotDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -1072,7 +1072,7 @@ func dataSourceVolumeCollectionVolumesVolumeAttachmentsToMap(volumeAttachmentsIt return volumeAttachmentsMap } -func dataSourceVolumeCollectionVolumeAttachmentsDeletedToMap(deletedItem vpcv1.VolumeAttachmentReferenceVolumeContextDeleted) (deletedMap map[string]interface{}) { +func dataSourceVolumeCollectionVolumeAttachmentsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -1117,7 +1117,7 @@ func dataSourceVolumeCollectionVolumeAttachmentsInstanceToMap(instanceItem vpcv1 return instanceMap } -func dataSourceVolumeCollectionInstanceDeletedToMap(deletedItem vpcv1.InstanceReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVolumeCollectionInstanceDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_vpc.go b/ibm/service/vpc/data_source_ibm_is_vpc.go index 8122ec6f4a..1c8b8db382 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpc.go +++ b/ibm/service/vpc/data_source_ibm_is_vpc.go @@ -978,7 +978,7 @@ func dataSourceIBMIsVPCVPCReferenceDnsResolverContextToMap(model *vpcv1.VPCRefer return modelMap, nil } -func dataSourceIBMIsVPCVPCReferenceDnsResolverContextDeletedToMap(model *vpcv1.VPCReferenceDnsResolverContextDeleted) (map[string]interface{}, error) { +func dataSourceIBMIsVPCVPCReferenceDnsResolverContextDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/data_source_ibm_is_vpc_routing_table.go b/ibm/service/vpc/data_source_ibm_is_vpc_routing_table.go index d80be4197a..30bd93f954 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpc_routing_table.go +++ b/ibm/service/vpc/data_source_ibm_is_vpc_routing_table.go @@ -363,7 +363,7 @@ func dataSourceIBMIBMIsVPCRoutingTableRouteReferenceToMap(model *vpcv1.RouteRefe return modelMap, nil } -func dataSourceIBMIBMIsVPCRoutingTableRouteReferenceDeletedToMap(model *vpcv1.RouteReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIBMIsVPCRoutingTableRouteReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := map[string]interface{}{} if model.MoreInfo != nil { modelMap[rMoreInfo] = *model.MoreInfo @@ -395,7 +395,7 @@ func dataSourceIBMIBMIsVPCRoutingTableSubnetReferenceToMap(model *vpcv1.SubnetRe return modelMap, nil } -func dataSourceIBMIBMIsVPCRoutingTableSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIBMIsVPCRoutingTableSubnetReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := map[string]interface{}{} if model.MoreInfo != nil { modelMap[rMoreInfo] = *model.MoreInfo diff --git a/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_route.go b/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_route.go index da18a18571..0c487e86dd 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_route.go +++ b/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_route.go @@ -390,7 +390,7 @@ func dataSourceIBMIBMIsVPCRoutingTableRouteRouteNextHopToMap(model vpcv1.RouteNe } } -func dataSourceIBMIBMIsVPCRoutingTableRouteVPNGatewayConnectionReferenceDeletedToMap(model *vpcv1.VPNGatewayConnectionReferenceDeleted) (map[string]interface{}, error) { +func dataSourceIBMIBMIsVPCRoutingTableRouteVPNGatewayConnectionReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := map[string]interface{}{} if model.MoreInfo != nil { modelMap[rMoreInfo] = *model.MoreInfo diff --git a/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_routes.go b/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_routes.go index 6e723e5db6..b54e85b0ed 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_routes.go +++ b/ibm/service/vpc/data_source_ibm_is_vpc_routing_table_routes.go @@ -354,7 +354,7 @@ func DataSourceIBMIsRouteCreatorVPNServerReferenceToMap(model *vpcv1.RouteCreato return modelMap, nil } -func DataSourceIBMIsRouteVPNGatewayReferenceDeletedToMap(model *vpcv1.VPNGatewayReferenceDeleted) (map[string]interface{}, error) { +func DataSourceIBMIsRouteVPNGatewayReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo @@ -362,7 +362,7 @@ func DataSourceIBMIsRouteVPNGatewayReferenceDeletedToMap(model *vpcv1.VPNGateway return modelMap, nil } -func DataSourceIBMIsRouteVPNServerReferenceDeletedToMap(model *vpcv1.VPNServerReferenceDeleted) (map[string]interface{}, error) { +func DataSourceIBMIsRouteVPNServerReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = *model.MoreInfo diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway.go index 9fb96fd3c8..be0f4ce1e7 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateway.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway.go @@ -493,7 +493,7 @@ func dataSourceVPNGatewayConnectionsToMap(connectionsItem vpcv1.VPNGatewayConnec return connectionsMap } -func dataSourceVPNGatewayConnectionsDeletedToMap(deletedItem vpcv1.VPNGatewayConnectionReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVPNGatewayConnectionsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -584,7 +584,7 @@ func dataSourceVPNGatewaySubnetToMap(subnetItem vpcv1.SubnetReference) (subnetMa return subnetMap } -func dataSourceVPNGatewaySubnetDeletedToMap(deletedItem vpcv1.SubnetReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVPNGatewaySubnetDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -625,7 +625,7 @@ func dataSourceVPNGatewayVpcToMap(vpcItem vpcv1.VPCReference) (vpcsMap map[strin } -func dataSourceVPNGatewayVpcDeletedToMap(deletedItem vpcv1.VPCReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVPNGatewayVpcDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go index bfdbd90d82..d45844768a 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go @@ -962,7 +962,7 @@ func dataSourceVPNGatewayConnectionIkePolicyToMap(ikePolicyItem vpcv1.IkePolicyR return ikePolicyMap } -func dataSourceVPNGatewayConnectionIkePolicyDeletedToMap(deletedItem vpcv1.IkePolicyReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVPNGatewayConnectionIkePolicyDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -1005,7 +1005,7 @@ func dataSourceVPNGatewayConnectionIpsecPolicyToMap(ipsecPolicyItem vpcv1.IPsecP return ipsecPolicyMap } -func dataSourceVPNGatewayConnectionIpsecPolicyDeletedToMap(deletedItem vpcv1.IPsecPolicyReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVPNGatewayConnectionIpsecPolicyDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_gateways.go b/ibm/service/vpc/data_source_ibm_is_vpn_gateways.go index 89c8bdde9f..7f1eea5eb5 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_gateways.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_gateways.go @@ -359,7 +359,7 @@ func dataSourceVPNServerCollectionVPNGatewayVpcReferenceToMap(vpcsItem *vpcv1.VP return vpcsMap } -func dataSourceVPNGatewayCollectionVpcsDeletedToMap(deletedItem vpcv1.VPCReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVPNGatewayCollectionVpcsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_server.go b/ibm/service/vpc/data_source_ibm_is_vpn_server.go index 4595cb40ef..cb02d3091a 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_server.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_server.go @@ -707,7 +707,7 @@ func dataSourceVPNServerPrivateIpsToMap(privateIpsItem vpcv1.ReservedIPReference return privateIpsMap } -func dataSourceVPNServerPrivateIpsDeletedToMap(deletedItem vpcv1.ReservedIPReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVPNServerPrivateIpsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -774,7 +774,7 @@ func dataSourceVPNServerSecurityGroupsToMap(securityGroupsItem vpcv1.SecurityGro return securityGroupsMap } -func dataSourceVPNServerSecurityGroupsDeletedToMap(deletedItem vpcv1.SecurityGroupReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVPNServerSecurityGroupsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -817,7 +817,7 @@ func dataSourceVPNServerSubnetsToMap(subnetsItem vpcv1.SubnetReference) (subnets return subnetsMap } -func dataSourceVPNServerSubnetsDeletedToMap(deletedItem vpcv1.SubnetReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVPNServerSubnetsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -857,7 +857,7 @@ func dataSourceVPNServerVpcToMap(vpcItem vpcv1.VPCReference) (vpcsMap map[string return vpcsMap } -func dataSourceVPNServerVpcsDeletedToMap(deletedItem vpcv1.VPCReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVPNServerVpcsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_servers.go b/ibm/service/vpc/data_source_ibm_is_vpn_servers.go index 06a4e29d92..0ba98e781f 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_servers.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_servers.go @@ -733,7 +733,7 @@ func dataSourceVPNServerCollectionVPNServersPrivateIpsToMap(privateIpsItem vpcv1 return privateIpsMap } -func dataSourceVPNServerCollectionPrivateIpsDeletedToMap(deletedItem vpcv1.ReservedIPReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVPNServerCollectionPrivateIpsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -784,7 +784,7 @@ func dataSourceVPNServerCollectionVPNServersSecurityGroupsToMap(securityGroupsIt return securityGroupsMap } -func dataSourceVPNServerCollectionSecurityGroupsDeletedToMap(deletedItem vpcv1.SecurityGroupReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVPNServerCollectionSecurityGroupsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -822,7 +822,7 @@ func dataSourceVPNServerCollectionVPNServersSubnetsToMap(subnetsItem vpcv1.Subne return subnetsMap } -func dataSourceVPNServerCollectionSubnetsDeletedToMap(deletedItem vpcv1.SubnetReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVPNServerCollectionSubnetsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -861,7 +861,7 @@ func dataSourceVPNServerCollectionVPNServersVpcReferenceToMap(vpcsItem *vpcv1.VP return vpcsMap } -func dataSourceVPNServerCollectionVpcsDeletedToMap(deletedItem vpcv1.VPCReferenceDeleted) (deletedMap map[string]interface{}) { +func dataSourceVPNServerCollectionVpcsDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/resource_ibm_is_bare_metal_server.go b/ibm/service/vpc/resource_ibm_is_bare_metal_server.go index f0e3502abd..766496bdf0 100644 --- a/ibm/service/vpc/resource_ibm_is_bare_metal_server.go +++ b/ibm/service/vpc/resource_ibm_is_bare_metal_server.go @@ -4246,7 +4246,7 @@ func resourceIBMIsBareMetalServerBareMetalServerNetworkAttachmentReferenceToMap( return modelMap, nil } -func resourceIBMIsBareMetalServerBareMetalServerNetworkAttachmentReferenceDeletedToMap(model *vpcv1.BareMetalServerNetworkAttachmentReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsBareMetalServerBareMetalServerNetworkAttachmentReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -4269,7 +4269,7 @@ func resourceIBMIsBareMetalServerReservedIPReferenceToMap(model *vpcv1.ReservedI return modelMap, nil } -func resourceIBMIsBareMetalServerReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsBareMetalServerReservedIPReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/resource_ibm_is_dedicated_host.go b/ibm/service/vpc/resource_ibm_is_dedicated_host.go index 09d1fec740..5a94188c04 100644 --- a/ibm/service/vpc/resource_ibm_is_dedicated_host.go +++ b/ibm/service/vpc/resource_ibm_is_dedicated_host.go @@ -635,7 +635,7 @@ func resourceIbmIsDedicatedHostInstanceReferenceToMap(instanceReference vpcv1.In return instanceReferenceMap } -func resourceIbmIsDedicatedHostInstanceReferenceDeletedToMap(instanceReferenceDeleted vpcv1.InstanceReferenceDeleted) map[string]interface{} { +func resourceIbmIsDedicatedHostInstanceReferenceDeletedToMap(instanceReferenceDeleted vpcv1.Deleted) map[string]interface{} { instanceReferenceDeletedMap := map[string]interface{}{} instanceReferenceDeletedMap["more_info"] = instanceReferenceDeleted.MoreInfo @@ -866,7 +866,7 @@ func resourceIbmIsDedicatedHostInstanceDiskReferenceToMap(instanceDiskReference return instanceDiskReferenceMap } -func resourceIbmIsDedicatedHostInstanceDiskReferenceDeletedToMap(instanceDiskReferenceDeleted vpcv1.InstanceDiskReferenceDeleted) map[string]interface{} { +func resourceIbmIsDedicatedHostInstanceDiskReferenceDeletedToMap(instanceDiskReferenceDeleted vpcv1.Deleted) map[string]interface{} { instanceDiskReferenceDeletedMap := map[string]interface{}{} instanceDiskReferenceDeletedMap["more_info"] = instanceDiskReferenceDeleted.MoreInfo diff --git a/ibm/service/vpc/resource_ibm_is_dedicated_host_group.go b/ibm/service/vpc/resource_ibm_is_dedicated_host_group.go index 5c769a973e..bfb0974e44 100644 --- a/ibm/service/vpc/resource_ibm_is_dedicated_host_group.go +++ b/ibm/service/vpc/resource_ibm_is_dedicated_host_group.go @@ -366,7 +366,7 @@ func resourceIbmIsDedicatedHostGroupDedicatedHostReferenceToMap(dedicatedHostRef return dedicatedHostReferenceMap } -func resourceIbmIsDedicatedHostGroupDedicatedHostReferenceDeletedToMap(dedicatedHostReferenceDeleted vpcv1.DedicatedHostReferenceDeleted) map[string]interface{} { +func resourceIbmIsDedicatedHostGroupDedicatedHostReferenceDeletedToMap(dedicatedHostReferenceDeleted vpcv1.Deleted) map[string]interface{} { dedicatedHostReferenceDeletedMap := map[string]interface{}{} dedicatedHostReferenceDeletedMap["more_info"] = dedicatedHostReferenceDeleted.MoreInfo diff --git a/ibm/service/vpc/resource_ibm_is_floating_ip.go b/ibm/service/vpc/resource_ibm_is_floating_ip.go index cbed74338c..b4adf1f0d2 100644 --- a/ibm/service/vpc/resource_ibm_is_floating_ip.go +++ b/ibm/service/vpc/resource_ibm_is_floating_ip.go @@ -850,7 +850,7 @@ func floatingIPCollectionFloatingIpTargetToMap(targetItemIntf vpcv1.FloatingIPTa return targetId, targetMap } -func floatingIPTargetNicDeletedToMap(deletedItem vpcv1.NetworkInterfaceReferenceDeleted) (deletedMap map[string]interface{}) { +func floatingIPTargetNicDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { @@ -859,7 +859,7 @@ func floatingIPTargetNicDeletedToMap(deletedItem vpcv1.NetworkInterfaceReference return deletedMap } -func floatingIPTargetPgDeletedToMap(deletedItem vpcv1.PublicGatewayReferenceDeleted) (deletedMap map[string]interface{}) { +func floatingIPTargetPgDeletedToMap(deletedItem vpcv1.Deleted) (deletedMap map[string]interface{}) { deletedMap = map[string]interface{}{} if deletedItem.MoreInfo != nil { diff --git a/ibm/service/vpc/resource_ibm_is_instance.go b/ibm/service/vpc/resource_ibm_is_instance.go index 3260ddc76a..fe23b877e1 100644 --- a/ibm/service/vpc/resource_ibm_is_instance.go +++ b/ibm/service/vpc/resource_ibm_is_instance.go @@ -6325,7 +6325,7 @@ func resourceIbmIsInstanceReservationAffinityPoolToMap(reservationPool vpcv1.Res return resAffPoolMap } -func resourceIbmIsInstanceDedicatedHostGroupReferenceDeletedToMap(dedicatedHostGroupReferenceDeleted vpcv1.DedicatedHostGroupReferenceDeleted) map[string]interface{} { +func resourceIbmIsInstanceDedicatedHostGroupReferenceDeletedToMap(dedicatedHostGroupReferenceDeleted vpcv1.Deleted) map[string]interface{} { dedicatedHostGroupReferenceDeletedMap := map[string]interface{}{} dedicatedHostGroupReferenceDeletedMap["more_info"] = dedicatedHostGroupReferenceDeleted.MoreInfo @@ -6434,7 +6434,7 @@ func resourceIBMIsInstanceInstanceNetworkAttachmentReferenceToMap(model *vpcv1.I return modelMap, nil } -func resourceIBMIsInstanceInstanceNetworkAttachmentReferenceDeletedToMap(model *vpcv1.InstanceNetworkAttachmentReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsInstanceInstanceNetworkAttachmentReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -6460,7 +6460,7 @@ func resourceIBMIsInstanceReservedIPReferenceToMap(model *vpcv1.ReservedIPRefere return modelMap, nil } -func resourceIBMIsInstanceReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsInstanceReservedIPReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go b/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go index 5cfdcd1403..a0f76e2833 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go +++ b/ibm/service/vpc/resource_ibm_is_instance_network_attachment.go @@ -982,7 +982,7 @@ func resourceIBMIsInstanceNetworkAttachmentReservedIPReferenceToMap(model *vpcv1 return modelMap, nil } -func resourceIBMIsInstanceNetworkAttachmentReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsInstanceNetworkAttachmentReservedIPReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -1005,7 +1005,7 @@ func resourceIBMIsInstanceNetworkAttachmentSubnetReferenceToMap(model *vpcv1.Sub return modelMap, nil } -func resourceIBMIsInstanceNetworkAttachmentSubnetReferenceDeletedToMap(model *vpcv1.SubnetReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsInstanceNetworkAttachmentSubnetReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/resource_ibm_is_instance_network_interface.go b/ibm/service/vpc/resource_ibm_is_instance_network_interface.go index 053a474f82..a6fc8256af 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_network_interface.go +++ b/ibm/service/vpc/resource_ibm_is_instance_network_interface.go @@ -514,7 +514,7 @@ func resourceIBMIsInstanceNetworkInterfaceFloatingIPReferenceToMap(floatingIPRef return floatingIPReferenceMap } -func resourceIBMIsInstanceNetworkInterfaceFloatingIPReferenceDeletedToMap(floatingIPReferenceDeleted vpcv1.FloatingIPReferenceDeleted) map[string]interface{} { +func resourceIBMIsInstanceNetworkInterfaceFloatingIPReferenceDeletedToMap(floatingIPReferenceDeleted vpcv1.Deleted) map[string]interface{} { floatingIPReferenceDeletedMap := map[string]interface{}{} floatingIPReferenceDeletedMap["more_info"] = floatingIPReferenceDeleted.MoreInfo diff --git a/ibm/service/vpc/resource_ibm_is_lb_listener.go b/ibm/service/vpc/resource_ibm_is_lb_listener.go index 667c382d6c..889811dacd 100644 --- a/ibm/service/vpc/resource_ibm_is_lb_listener.go +++ b/ibm/service/vpc/resource_ibm_is_lb_listener.go @@ -939,7 +939,7 @@ func resourceIBMIsLbListenerLoadBalancerListenerReferenceToMap(model *vpcv1.Load modelMap["id"] = model.ID return modelMap, nil } -func resourceIBMIsLbListenerLoadBalancerListenerReferenceDeletedToMap(model *vpcv1.LoadBalancerListenerReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsLbListenerLoadBalancerListenerReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/resource_ibm_is_lb_listener_policy.go b/ibm/service/vpc/resource_ibm_is_lb_listener_policy.go index 5c5ba0da2f..8e11b8d777 100644 --- a/ibm/service/vpc/resource_ibm_is_lb_listener_policy.go +++ b/ibm/service/vpc/resource_ibm_is_lb_listener_policy.go @@ -1223,7 +1223,7 @@ func resourceIBMIsLbListenerPolicyLoadBalancerListenerPolicyTargetToMap(model vp } } -func resourceIBMIsLbListenerPolicyLoadBalancerPoolReferenceDeletedToMap(model *vpcv1.LoadBalancerPoolReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsLbListenerPolicyLoadBalancerPoolReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -1243,7 +1243,7 @@ func resourceIBMIsLbListenerPolicyLoadBalancerListenerReferenceToMap(model *vpcv return modelMap, nil } -func resourceIBMIsLbListenerPolicyLoadBalancerListenerReferenceDeletedToMap(model *vpcv1.LoadBalancerListenerReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsLbListenerPolicyLoadBalancerListenerReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/resource_ibm_is_share.go b/ibm/service/vpc/resource_ibm_is_share.go index e48458c171..1fee06602b 100644 --- a/ibm/service/vpc/resource_ibm_is_share.go +++ b/ibm/service/vpc/resource_ibm_is_share.go @@ -2204,7 +2204,7 @@ func ResourceIBMIsShareRegionReferenceToMap(model *vpcv1.RegionReference) map[st modelMap["name"] = *model.Name return modelMap } -func ResourceIBMIsShareShareReferenceDeletedToMap(model *vpcv1.ShareReferenceDeleted) map[string]interface{} { +func ResourceIBMIsShareShareReferenceDeletedToMap(model *vpcv1.Deleted) map[string]interface{} { modelMap := make(map[string]interface{}) modelMap["more_info"] = *model.MoreInfo return modelMap diff --git a/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go b/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go index b7c38774e4..432f3ac224 100644 --- a/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go +++ b/ibm/service/vpc/resource_ibm_is_snapshot_consistency_group.go @@ -746,7 +746,7 @@ func resourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemT return modelMap, nil } -func resourceIBMIsSnapshotConsistencyGroupSnapshotReferenceDeletedToMap(model *vpcv1.SnapshotReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsSnapshotConsistencyGroupSnapshotReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.MoreInfo != nil { modelMap["more_info"] = model.MoreInfo @@ -796,7 +796,7 @@ func resourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceToMap(model * return modelMap, nil } -func resourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceDeletedToMap(model *vpcv1.BackupPolicyPlanReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsSnapshotConsistencyGroupBackupPolicyPlanReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go index b860dd2180..afa651f220 100644 --- a/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go +++ b/ibm/service/vpc/resource_ibm_is_virtual_network_interface.go @@ -996,7 +996,7 @@ func resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceToMap(model *vpcv1.R return modelMap, nil } -func resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceDeletedToMap(model *vpcv1.ReservedIPReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsVirtualNetworkInterfaceReservedIPReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -1018,7 +1018,7 @@ func resourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceToMap(model *vpcv return modelMap, nil } -func resourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceDeletedToMap(model *vpcv1.SecurityGroupReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsVirtualNetworkInterfaceSecurityGroupReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -1059,7 +1059,7 @@ func resourceIBMIsVirtualNetworkInterfaceVirtualNetworkInterfaceTargetToMap(mode } } -func resourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model *vpcv1.ShareMountTargetReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsVirtualNetworkInterfaceShareMountTargetReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil @@ -1209,7 +1209,7 @@ func resourceIBMIsVirtualNetworkInterfaceVPCReferenceToMap(model *vpcv1.VPCRefer return modelMap, nil } -func resourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model *vpcv1.VPCReferenceDeleted) (map[string]interface{}, error) { +func resourceIBMIsVirtualNetworkInterfaceVPCReferenceDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/resource_ibm_is_vpc.go b/ibm/service/vpc/resource_ibm_is_vpc.go index da9104f86c..9123b356f1 100644 --- a/ibm/service/vpc/resource_ibm_is_vpc.go +++ b/ibm/service/vpc/resource_ibm_is_vpc.go @@ -1849,7 +1849,7 @@ func resourceIBMIsVPCVPCReferenceDnsResolverContextToMap(model *vpcv1.VPCReferen return modelMap, nil } -func resourceIBMIsVPCVPCReferenceDnsResolverContextDeletedToMap(model *vpcv1.VPCReferenceDnsResolverContextDeleted) (map[string]interface{}, error) { +func resourceIBMIsVPCVPCReferenceDnsResolverContextDeletedToMap(model *vpcv1.Deleted) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["more_info"] = model.MoreInfo return modelMap, nil diff --git a/ibm/service/vpc/resource_ibm_is_vpc_routing_table_route.go b/ibm/service/vpc/resource_ibm_is_vpc_routing_table_route.go index dd5c23d053..bb7b4319f3 100644 --- a/ibm/service/vpc/resource_ibm_is_vpc_routing_table_route.go +++ b/ibm/service/vpc/resource_ibm_is_vpc_routing_table_route.go @@ -231,12 +231,12 @@ func resourceIBMISVPCRoutingTableRouteCreate(d *schema.ResourceData, meta interf if add, ok := d.GetOk(rNextHop); ok { item := add.(string) if net.ParseIP(item) == nil { - nhConnectionID := &vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity{ + nhConnectionID := &vpcv1.RouteNextHopPrototype{ ID: core.StringPtr(item), } createVpcRoutingTableRouteOptions.SetNextHop(nhConnectionID) } else { - nh := &vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP{ + nh := &vpcv1.RouteNextHopPrototype{ Address: core.StringPtr(item), } createVpcRoutingTableRouteOptions.SetNextHop(nh) diff --git a/ibm/service/vpc/resource_ibm_is_vpn_server.go b/ibm/service/vpc/resource_ibm_is_vpn_server.go index fa0042b9af..5c6713d25a 100644 --- a/ibm/service/vpc/resource_ibm_is_vpn_server.go +++ b/ibm/service/vpc/resource_ibm_is_vpn_server.go @@ -791,7 +791,7 @@ func resourceIBMIsVPNServerReservedIPReferenceToMap(reservedIPReference vpcv1.Re return reservedIPReferenceMap } -func resourceIBMIsVPNServerReservedIPReferenceDeletedToMap(reservedIPReferenceDeleted vpcv1.ReservedIPReferenceDeleted) map[string]interface{} { +func resourceIBMIsVPNServerReservedIPReferenceDeletedToMap(reservedIPReferenceDeleted vpcv1.Deleted) map[string]interface{} { reservedIPReferenceDeletedMap := map[string]interface{}{} reservedIPReferenceDeletedMap["more_info"] = reservedIPReferenceDeleted.MoreInfo @@ -817,7 +817,7 @@ func resourceIBMIsVPNServerVPCReferenceToMap(vpcRef vpcv1.VPCReference) map[stri return vpcMap } -func resourceIBMIsVPNServerVPCReferenceDeletedToMap(vpcRefDeleted vpcv1.VPCReferenceDeleted) map[string]interface{} { +func resourceIBMIsVPNServerVPCReferenceDeletedToMap(vpcRefDeleted vpcv1.Deleted) map[string]interface{} { vpcRefDeletedMap := map[string]interface{}{} vpcRefDeletedMap["more_info"] = vpcRefDeleted.MoreInfo return vpcRefDeletedMap From 13e65c3c45b35d937ee5a9480107d79f145948a5 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 11 Sep 2024 12:02:01 +0530 Subject: [PATCH 094/103] Update vpc_v1.go --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 22844 +++++++--------- 1 file changed, 9738 insertions(+), 13106 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 29d17994e3..0f7d12d101 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2024. + * (C) Copyright IBM Corp. 2022, 2023, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.91.0-d9755c53-20240605-153412 + * IBM OpenAPI SDK Code Generator Version: 3.92.2-3f2a0533-20240712-183330 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -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-08-27`. + // and `2024-09-11`. Version *string } @@ -68,7 +68,7 @@ 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-07-03`. + // and `2024-09-11`. Version *string } @@ -133,9 +133,8 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2024-07-02") + options.Version = core.StringPtr("2024-09-10") } - service = &VpcV1{ Service: baseService, Generation: options.Generation, @@ -204,24 +203,25 @@ func (vpc *VpcV1) DisableRetries() { vpc.Service.DisableRetries() } -// CreateVPC : Create a VPC -// This request creates a new VPC from a VPC prototype object. The prototype object is structured in the same way as a -// retrieved VPC, and contains the information necessary to create the new VPC. -func (vpc *VpcV1) CreateVPC(createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCWithContext(context.Background(), createVPCOptions) +// ListVpcs : List VPCs +// This request lists VPCs in the region. A VPC is a virtual network that belongs to an account and provides logical +// isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC +// can contain resources in multiple zones in a region. +func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPCWithContext is an alternate form of the CreateVPC method which supports a Context parameter -func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(createVPCOptions, "createVPCOptions") +// ListVpcsWithContext is an alternate form of the ListVpcs method which supports a Context parameter +func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVpcsOptions, "listVpcsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/vpcs`, nil) @@ -230,40 +230,29 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr return } - for headerName, headerValue := range createVPCOptions.Headers { + for headerName, headerValue := range listVpcsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPC") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") 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 createVPCOptions.AddressPrefixManagement != nil { - body["address_prefix_management"] = createVPCOptions.AddressPrefixManagement - } - if createVPCOptions.ClassicAccess != nil { - body["classic_access"] = createVPCOptions.ClassicAccess - } - if createVPCOptions.Dns != nil { - body["dns"] = createVPCOptions.Dns + if listVpcsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) } - if createVPCOptions.Name != nil { - body["name"] = createVPCOptions.Name + if listVpcsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVpcsOptions.Limit)) } - if createVPCOptions.ResourceGroup != nil { - body["resource_group"] = createVPCOptions.ResourceGroup + if listVpcsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVpcsOptions.ResourceGroupID)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listVpcsOptions.ClassicAccess != nil { + builder.AddQuery("classic_access", fmt.Sprint(*listVpcsOptions.ClassicAccess)) } request, err := builder.Build() @@ -275,12 +264,12 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpc", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpcs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPCCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -291,46 +280,37 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr return } -// CreateVPCAddressPrefix : Create an address prefix for a VPC -// This request creates a new prefix from a prefix prototype object. The prototype object is structured in the same way -// as a retrieved prefix, and contains the information necessary to create the new prefix. -func (vpc *VpcV1) CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) +// CreateVPC : Create a VPC +// This request creates a new VPC from a VPC prototype object. The prototype object is structured in the same way as a +// retrieved VPC, and contains the information necessary to create the new VPC. +func (vpc *VpcV1) CreateVPC(createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPCWithContext(context.Background(), createVPCOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPCAddressPrefixWithContext is an alternate form of the CreateVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") +// CreateVPCWithContext is an alternate form of the CreateVPC method which supports a Context parameter +func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(createVPCOptions, "createVPCOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "vpc_id": *createVPCAddressPrefixOptions.VPCID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { + for headerName, headerValue := range createVPCOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPC") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -341,17 +321,20 @@ func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createV builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) body := make(map[string]interface{}) - if createVPCAddressPrefixOptions.CIDR != nil { - body["cidr"] = createVPCAddressPrefixOptions.CIDR + if createVPCOptions.AddressPrefixManagement != nil { + body["address_prefix_management"] = createVPCOptions.AddressPrefixManagement } - if createVPCAddressPrefixOptions.Zone != nil { - body["zone"] = createVPCAddressPrefixOptions.Zone + if createVPCOptions.ClassicAccess != nil { + body["classic_access"] = createVPCOptions.ClassicAccess } - if createVPCAddressPrefixOptions.IsDefault != nil { - body["is_default"] = createVPCAddressPrefixOptions.IsDefault + if createVPCOptions.Dns != nil { + body["dns"] = createVPCOptions.Dns } - if createVPCAddressPrefixOptions.Name != nil { - body["name"] = createVPCAddressPrefixOptions.Name + if createVPCOptions.Name != nil { + body["name"] = createVPCOptions.Name + } + if createVPCOptions.ResourceGroup != nil { + body["resource_group"] = createVPCOptions.ResourceGroup } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -368,12 +351,12 @@ func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createV var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpc_address_prefix", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpc", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -384,180 +367,126 @@ func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createV return } -// CreateVPCDnsResolutionBinding : Create a DNS resolution binding -// This request creates a new DNS resolution binding from a DNS resolution binding prototype object. The prototype -// object is structured in the same way as a retrieved DNS resolution binding, and contains the information necessary to -// create the new DNS resolution binding. +// DeleteVPC : Delete a VPC +// This request deletes a VPC. This operation cannot be reversed. // -// For this request to succeed, `dns.enable_hub` must be `false` for the VPC specified by the identifier in the URL, and -// the VPC must not already have a DNS resolution binding. +// For this request to succeed: +// - Instances, subnets, public gateways, and endpoint gateways must not reside in this VPC +// - The VPC must not be providing DNS resolution for any other VPCs +// - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero // -// See [About DNS sharing for VPE gateways](/docs/vpc?topic=vpc-hub-spoke-model) for more information. -func (vpc *VpcV1) CreateVPCDnsResolutionBinding(createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) +// All security groups and network ACLs associated with the VPC are automatically deleted. All flow log collectors with +// `auto_delete` set to `true` targeting the VPC or any resource in the VPC are automatically deleted. +func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPCDnsResolutionBindingWithContext is an alternate form of the CreateVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions cannot be nil") +// DeleteVPCWithContext is an alternate form of the DeleteVPC method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCOptions, "deleteVPCOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") + err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCDnsResolutionBindingOptions.VPCID, + "id": *deleteVPCOptions.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, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPCDnsResolutionBindingOptions.Headers { + for headerName, headerValue := range deleteVPCOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCDnsResolutionBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") + if deleteVPCOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if createVPCDnsResolutionBindingOptions.VPC != nil { - body["vpc"] = createVPCDnsResolutionBindingOptions.VPC - } - if createVPCDnsResolutionBindingOptions.Name != nil { - body["name"] = createVPCDnsResolutionBindingOptions.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) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "create_vpc_dns_resolution_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpc", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateVPCRoute : Create a route in a VPC's default routing table -// This request creates a new route in the VPC's default routing table. The route prototype object is structured in the -// same way as a retrieved route, and contains the information necessary to create the new route. The request will fail -// if the new route will cause a loop. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) +// GetVPC : Retrieve a VPC +// This request retrieves a single VPC specified by the identifier in the URL. +func (vpc *VpcV1) GetVPC(getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCWithContext(context.Background(), getVPCOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: CreateVPCRoute") - err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") +// GetVPCWithContext is an alternate form of the GetVPC method which supports a Context parameter +func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCOptions, "getVPCOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") + err = core.ValidateStruct(getVPCOptions, "getVPCOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCRouteOptions.VPCID, + "id": *getVPCOptions.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, `/vpcs/{vpc_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPCRouteOptions.Headers { + for headerName, headerValue := range getVPCOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") 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 createVPCRouteOptions.Destination != nil { - body["destination"] = createVPCRouteOptions.Destination - } - if createVPCRouteOptions.Zone != nil { - body["zone"] = createVPCRouteOptions.Zone - } - if createVPCRouteOptions.Action != nil { - body["action"] = createVPCRouteOptions.Action - } - if createVPCRouteOptions.Advertise != nil { - body["advertise"] = createVPCRouteOptions.Advertise - } - if createVPCRouteOptions.Name != nil { - body["name"] = createVPCRouteOptions.Name - } - if createVPCRouteOptions.NextHop != nil { - body["next_hop"] = createVPCRouteOptions.NextHop - } - if createVPCRouteOptions.Priority != nil { - body["priority"] = createVPCRouteOptions.Priority - } - _, 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()) @@ -567,12 +496,12 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpc_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -583,81 +512,59 @@ func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteO return } -// CreateVPCRoutingTable : Create a routing table for a VPC -// This request creates a routing table from a routing table prototype object. The prototype object is structured in the -// same way as a retrieved routing table, and contains the information necessary to create the new routing table. -func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) +// UpdateVPC : Update a VPC +// This request updates a VPC with the information provided in a VPC patch object. The patch object is structured in the +// same way as a retrieved VPC and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPCRoutingTableWithContext is an alternate form of the CreateVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCRoutingTableOptions, "createVPCRoutingTableOptions cannot be nil") +// UpdateVPCWithContext is an alternate form of the UpdateVPC method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCOptions, "updateVPCOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") + err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCRoutingTableOptions.VPCID, + "id": *updateVPCOptions.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, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPCRoutingTableOptions.Headers { + for headerName, headerValue := range updateVPCOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPC") 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 updateVPCOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPCOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if createVPCRoutingTableOptions.AcceptRoutesFrom != nil { - body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom - } - if createVPCRoutingTableOptions.AdvertiseRoutesTo != nil { - body["advertise_routes_to"] = createVPCRoutingTableOptions.AdvertiseRoutesTo - } - if createVPCRoutingTableOptions.Name != nil { - body["name"] = createVPCRoutingTableOptions.Name - } - if createVPCRoutingTableOptions.RouteDirectLinkIngress != nil { - body["route_direct_link_ingress"] = createVPCRoutingTableOptions.RouteDirectLinkIngress - } - if createVPCRoutingTableOptions.RouteInternetIngress != nil { - body["route_internet_ingress"] = createVPCRoutingTableOptions.RouteInternetIngress - } - if createVPCRoutingTableOptions.RouteTransitGatewayIngress != nil { - body["route_transit_gateway_ingress"] = createVPCRoutingTableOptions.RouteTransitGatewayIngress - } - if createVPCRoutingTableOptions.RouteVPCZoneIngress != nil { - body["route_vpc_zone_ingress"] = createVPCRoutingTableOptions.RouteVPCZoneIngress - } - if createVPCRoutingTableOptions.Routes != nil { - body["routes"] = createVPCRoutingTableOptions.Routes - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -672,12 +579,12 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpc_routing_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_vpc", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -688,84 +595,54 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP return } -// CreateVPCRoutingTableRoute : Create a route in a VPC routing table -// This request creates a new VPC route from a VPC route prototype object. The prototype object is structured in the -// same way as a retrieved VPC route and contains the information necessary to create the route. -func (vpc *VpcV1) CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) +// GetVPCDefaultNetworkACL : Retrieve a VPC's default network ACL +// This request retrieves the default network ACL for the VPC specified by the identifier in the URL. The default +// network ACL is applied to any new subnets in the VPC which do not specify a network ACL. +func (vpc *VpcV1) GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVPCRoutingTableRouteWithContext is an alternate form of the CreateVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions cannot be nil") +// GetVPCDefaultNetworkACLWithContext is an alternate form of the GetVPCDefaultNetworkACL method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") + err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *createVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *createVPCRoutingTableRouteOptions.RoutingTableID, + "id": *getVPCDefaultNetworkACLOptions.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, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_network_acl`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPCRoutingTableRouteOptions.Headers { + for headerName, headerValue := range getVPCDefaultNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTableRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") 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 createVPCRoutingTableRouteOptions.Destination != nil { - body["destination"] = createVPCRoutingTableRouteOptions.Destination - } - if createVPCRoutingTableRouteOptions.Zone != nil { - body["zone"] = createVPCRoutingTableRouteOptions.Zone - } - if createVPCRoutingTableRouteOptions.Action != nil { - body["action"] = createVPCRoutingTableRouteOptions.Action - } - if createVPCRoutingTableRouteOptions.Advertise != nil { - body["advertise"] = createVPCRoutingTableRouteOptions.Advertise - } - if createVPCRoutingTableRouteOptions.Name != nil { - body["name"] = createVPCRoutingTableRouteOptions.Name - } - if createVPCRoutingTableRouteOptions.NextHop != nil { - body["next_hop"] = createVPCRoutingTableRouteOptions.NextHop - } - if createVPCRoutingTableRouteOptions.Priority != nil { - body["priority"] = createVPCRoutingTableRouteOptions.Priority - } - _, 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()) @@ -775,12 +652,12 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpc_routing_table_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc_default_network_acl", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -791,59 +668,51 @@ func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, cre return } -// DeleteVPC : Delete a VPC -// This request deletes a VPC. This operation cannot be reversed. -// -// For this request to succeed: -// - Instances, subnets, public gateways, and endpoint gateways must not reside in this VPC -// - The VPC must not be providing DNS resolution for any other VPCs -// - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero -// -// All security groups and network ACLs associated with the VPC are automatically deleted. All flow log collectors with -// `auto_delete` set to `true` targeting the VPC or any resource in the VPC are automatically deleted. -func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) +// GetVPCDefaultRoutingTable : Retrieve a VPC's default routing table +// This request retrieves the default routing table for the VPC specified by the identifier in the URL. The default +// routing table is associated with any subnets in the VPC which have not been explicitly associated with another +// routing table. +func (vpc *VpcV1) GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPCWithContext is an alternate form of the DeleteVPC method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCOptions, "deleteVPCOptions cannot be nil") +// GetVPCDefaultRoutingTableWithContext is an alternate form of the GetVPCDefaultRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") + err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteVPCOptions.ID, + "id": *getVPCDefaultRoutingTableOptions.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, `/vpcs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_routing_table`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPCOptions.Headers { + for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteVPCOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCOptions.IfMatch)) - } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -854,60 +723,69 @@ func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *De 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_vpc", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc_default_routing_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultRoutingTable) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteVPCAddressPrefix : Delete an address prefix -// This request deletes a prefix. This operation cannot be reversed. The request will fail if any subnets use addresses -// from this prefix. -func (vpc *VpcV1) DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) +// GetVPCDefaultSecurityGroup : Retrieve a VPC's default security group +// This request retrieves the default security group for the VPC specified by the identifier in the URL. Resources +// created in this VPC that allow a security group to be optionally specified will use this security group by default. +func (vpc *VpcV1) GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPCAddressPrefixWithContext is an alternate form of the DeleteVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions cannot be nil") +// GetVPCDefaultSecurityGroupWithContext is an alternate form of the GetVPCDefaultSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") + err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCAddressPrefixOptions.VPCID, - "id": *deleteVPCAddressPrefixOptions.ID, + "id": *getVPCDefaultSecurityGroupOptions.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, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_security_group`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPCAddressPrefixOptions.Headers { + for headerName, headerValue := range getVPCDefaultSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") 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)) @@ -918,59 +796,64 @@ func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteV 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_vpc_address_prefix", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc_default_security_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultSecurityGroup) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteVPCDnsResolutionBinding : Delete a DNS resolution binding -// This request deletes a DNS resolution binding. This operation cannot be reversed. -// -// For this request to succeed, the VPC specified by the identifier in the URL must not have -// `dns.resolver.type` set to `delegated`. -func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) +// ListVPCAddressPrefixes : List address prefixes for a VPC +// This request lists address pool prefixes for a VPC. +func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPCDnsResolutionBindingWithContext is an alternate form of the DeleteVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions cannot be nil") +// ListVPCAddressPrefixesWithContext is an alternate form of the ListVPCAddressPrefixes method which supports a Context parameter +func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") + err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCDnsResolutionBindingOptions.VPCID, - "id": *deleteVPCDnsResolutionBindingOptions.ID, + "vpc_id": *listVPCAddressPrefixesOptions.VPCID, } - 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, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPCDnsResolutionBindingOptions.Headers { + for headerName, headerValue := range listVPCAddressPrefixesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCDnsResolutionBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -978,6 +861,12 @@ func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listVPCAddressPrefixesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) + } + if listVPCAddressPrefixesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCAddressPrefixesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -988,12 +877,12 @@ func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_vpc_dns_resolution_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpc_address_prefixes", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefixCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1004,181 +893,140 @@ func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, return } -// DeleteVPCRoute : Delete a VPC route -// This request deletes a route. This operation cannot be reversed. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) +// CreateVPCAddressPrefix : Create an address prefix for a VPC +// This request creates a new prefix from a prefix prototype object. The prototype object is structured in the same way +// as a retrieved prefix, and contains the information necessary to create the new prefix. +func (vpc *VpcV1) CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: DeleteVPCRoute") - err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") +// CreateVPCAddressPrefixWithContext is an alternate form of the CreateVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") + err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRouteOptions.VPCID, - "id": *deleteVPCRouteOptions.ID, + "vpc_id": *createVPCAddressPrefixOptions.VPCID, } - 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, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPCRouteOptions.Headers { + for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") 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)) - 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_vpc_route", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return + body := make(map[string]interface{}) + if createVPCAddressPrefixOptions.CIDR != nil { + body["cidr"] = createVPCAddressPrefixOptions.CIDR } - - return -} - -// DeleteVPCRoutingTable : Delete a VPC routing table -// This request deletes a routing table. A routing table cannot be deleted if it is associated with any subnets in the -// VPC. Additionally, a VPC's default routing table cannot be deleted. This operation cannot be reversed. -func (vpc *VpcV1) DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteVPCRoutingTableWithContext is an alternate form of the DeleteVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return + if createVPCAddressPrefixOptions.Zone != nil { + body["zone"] = createVPCAddressPrefixOptions.Zone } - err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return + if createVPCAddressPrefixOptions.IsDefault != nil { + body["is_default"] = createVPCAddressPrefixOptions.IsDefault } - - pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRoutingTableOptions.VPCID, - "id": *deleteVPCRoutingTableOptions.ID, + if createVPCAddressPrefixOptions.Name != nil { + body["name"] = createVPCAddressPrefixOptions.Name } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + _, err = builder.SetBodyContentJSON(body) 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 deleteVPCRoutingTableOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - if deleteVPCRoutingTableOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCRoutingTableOptions.IfMatch)) - } - - 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) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_vpc_routing_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpc_address_prefix", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteVPCRoutingTableRoute : Delete a VPC routing table route -// This request deletes a VPC route. This operation cannot be reversed. Only VPC routes with an `origin` of `user` are -// allowed to be deleted. -func (vpc *VpcV1) DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) +// DeleteVPCAddressPrefix : Delete an address prefix +// This request deletes a prefix. This operation cannot be reversed. The request will fail if any subnets use addresses +// from this prefix. +func (vpc *VpcV1) DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVPCRoutingTableRouteWithContext is an alternate form of the DeleteVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions cannot be nil") +// DeleteVPCAddressPrefixWithContext is an alternate form of the DeleteVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") + err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *deleteVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *deleteVPCRoutingTableRouteOptions.RoutingTableID, - "id": *deleteVPCRoutingTableRouteOptions.ID, + "vpc_id": *deleteVPCAddressPrefixOptions.VPCID, + "id": *deleteVPCAddressPrefixOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { + for headerName, headerValue := range deleteVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1194,7 +1042,7 @@ func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, del response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_vpc_routing_table_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpc_address_prefix", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -1202,45 +1050,46 @@ func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, del return } -// GetVPC : Retrieve a VPC -// This request retrieves a single VPC specified by the identifier in the URL. -func (vpc *VpcV1) GetVPC(getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCWithContext(context.Background(), getVPCOptions) +// GetVPCAddressPrefix : Retrieve an address prefix +// This request retrieves a single prefix specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCWithContext is an alternate form of the GetVPC method which supports a Context parameter -func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCOptions, "getVPCOptions cannot be nil") +// GetVPCAddressPrefixWithContext is an alternate form of the GetVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCOptions, "getVPCOptions") + err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPCOptions.ID, + "vpc_id": *getVPCAddressPrefixOptions.VPCID, + "id": *getVPCAddressPrefixOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCOptions.Headers { + for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1258,12 +1107,12 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpc", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc_address_prefix", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1274,33 +1123,34 @@ func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOp return } -// GetVPCAddressPrefix : Retrieve an address prefix -// This request retrieves a single prefix specified by the identifier in the URL. -func (vpc *VpcV1) GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) +// UpdateVPCAddressPrefix : Update an address prefix +// This request updates a prefix with the information in a provided prefix patch. The prefix patch object is structured +// in the same way as a retrieved prefix and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCAddressPrefixWithContext is an alternate form of the GetVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions cannot be nil") +// UpdateVPCAddressPrefixWithContext is an alternate form of the UpdateVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") + err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *getVPCAddressPrefixOptions.VPCID, - "id": *getVPCAddressPrefixOptions.ID, + "vpc_id": *updateVPCAddressPrefixOptions.VPCID, + "id": *updateVPCAddressPrefixOptions.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, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) @@ -1309,19 +1159,26 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr return } - for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { + for headerName, headerValue := range updateVPCAddressPrefixOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCAddressPrefix") 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(updateVPCAddressPrefixOptions.AddressPrefixPatch) + 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()) @@ -1331,7 +1188,7 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpc_address_prefix", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_vpc_address_prefix", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -1347,46 +1204,60 @@ func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddr return } -// GetVPCDefaultNetworkACL : Retrieve a VPC's default network ACL -// This request retrieves the default network ACL for the VPC specified by the identifier in the URL. The default -// network ACL is applied to any new subnets in the VPC which do not specify a network ACL. -func (vpc *VpcV1) GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) +// ListVPCDnsResolutionBindings : List DNS resolution bindings for a VPC +// This request lists DNS resolution bindings for a VPC. A DNS resolution binding represents an association with another +// VPC for centralizing DNS name resolution. +// +// If the VPC specified by the identifier in the URL is a DNS hub VPC (has `dns.enable_hub` set to `true`) then there is +// one binding for each VPC bound to the hub VPC. The endpoint gateways in the bound VPCs can allow (using +// `allow_dns_resolution_binding`) the hub VPC to centralize resolution of their DNS names. +// +// If the VPC specified by the identifier in the URL is not a DNS hub VPC, then there is at most one binding (to a hub +// VPC). The endpoint gateways in the VPC specified by the identifier in the URL can allow (using +// `allow_dns_resolution_binding`) its hub VPC to centralize resolution of their DNS names. +// +// To make use of centralized DNS resolution, a VPC bound to a DNS hub VPC must delegate DNS resolution to its hub VPC +// by setting `dns.resolver.type` to `delegate`. +// +// The bindings will be sorted by their `created_at` property values, with newest bindings first. Bindings with +// identical `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListVPCDnsResolutionBindings(listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCDefaultNetworkACLWithContext is an alternate form of the GetVPCDefaultNetworkACL method which supports a Context parameter -func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions cannot be nil") +// ListVPCDnsResolutionBindingsWithContext is an alternate form of the ListVPCDnsResolutionBindings method which supports a Context parameter +func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") + err = core.ValidateStruct(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPCDefaultNetworkACLOptions.ID, + "vpc_id": *listVPCDnsResolutionBindingsOptions.VPCID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_network_acl`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCDefaultNetworkACLOptions.Headers { + for headerName, headerValue := range listVPCDnsResolutionBindingsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCDnsResolutionBindings") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1394,6 +1265,27 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listVPCDnsResolutionBindingsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Sort)) + } + if listVPCDnsResolutionBindingsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Start)) + } + if listVPCDnsResolutionBindingsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Limit)) + } + if listVPCDnsResolutionBindingsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Name)) + } + if listVPCDnsResolutionBindingsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCCRN)) + } + if listVPCDnsResolutionBindingsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCName)) + } + if listVPCDnsResolutionBindingsOptions.AccountID != nil { + builder.AddQuery("account.id", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.AccountID)) + } request, err := builder.Build() if err != nil { @@ -1404,12 +1296,12 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpc_default_network_acl", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpc_dns_resolution_bindings", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultNetworkACL) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBindingCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1420,55 +1312,74 @@ func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPC return } -// GetVPCDefaultRoutingTable : Retrieve a VPC's default routing table -// This request retrieves the default routing table for the VPC specified by the identifier in the URL. The default -// routing table is associated with any subnets in the VPC which have not been explicitly associated with another -// routing table. -func (vpc *VpcV1) GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) +// CreateVPCDnsResolutionBinding : Create a DNS resolution binding +// This request creates a new DNS resolution binding from a DNS resolution binding prototype object. The prototype +// object is structured in the same way as a retrieved DNS resolution binding, and contains the information necessary to +// create the new DNS resolution binding. +// +// For this request to succeed, `dns.enable_hub` must be `false` for the VPC specified by the identifier in the URL, and +// the VPC must not already have a DNS resolution binding. +// +// See [About DNS sharing for VPE gateways](/docs/vpc?topic=vpc-vpe-dns-sharing) for more information. +func (vpc *VpcV1) CreateVPCDnsResolutionBinding(createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPCDnsResolutionBindingWithContext(context.Background(), createVPCDnsResolutionBindingOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCDefaultRoutingTableWithContext is an alternate form of the GetVPCDefaultRoutingTable method which supports a Context parameter -func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions cannot be nil") +// CreateVPCDnsResolutionBindingWithContext is an alternate form of the CreateVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) CreateVPCDnsResolutionBindingWithContext(ctx context.Context, createVPCDnsResolutionBindingOptions *CreateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") + err = core.ValidateStruct(createVPCDnsResolutionBindingOptions, "createVPCDnsResolutionBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPCDefaultRoutingTableOptions.ID, + "vpc_id": *createVPCDnsResolutionBindingOptions.VPCID, } - 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, `/vpcs/{id}/default_routing_table`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { + for headerName, headerValue := range createVPCDnsResolutionBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCDnsResolutionBinding") 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 createVPCDnsResolutionBindingOptions.VPC != nil { + body["vpc"] = createVPCDnsResolutionBindingOptions.VPC + } + if createVPCDnsResolutionBindingOptions.Name != nil { + body["name"] = createVPCDnsResolutionBindingOptions.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()) @@ -1478,12 +1389,12 @@ func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getV var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpc_default_routing_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpc_dns_resolution_binding", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1494,46 +1405,49 @@ func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getV return } -// GetVPCDefaultSecurityGroup : Retrieve a VPC's default security group -// This request retrieves the default security group for the VPC specified by the identifier in the URL. Resources -// created in this VPC that allow a security group to be optionally specified will use this security group by default. -func (vpc *VpcV1) GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) +// DeleteVPCDnsResolutionBinding : Delete a DNS resolution binding +// This request deletes a DNS resolution binding. This operation cannot be reversed. +// +// For this request to succeed, the VPC specified by the identifier in the URL must not have +// `dns.resolver.type` set to `delegated`. +func (vpc *VpcV1) DeleteVPCDnsResolutionBinding(deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteVPCDnsResolutionBindingWithContext(context.Background(), deleteVPCDnsResolutionBindingOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCDefaultSecurityGroupWithContext is an alternate form of the GetVPCDefaultSecurityGroup method which supports a Context parameter -func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions cannot be nil") +// DeleteVPCDnsResolutionBindingWithContext is an alternate form of the DeleteVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCDnsResolutionBindingWithContext(ctx context.Context, deleteVPCDnsResolutionBindingOptions *DeleteVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") + err = core.ValidateStruct(deleteVPCDnsResolutionBindingOptions, "deleteVPCDnsResolutionBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPCDefaultSecurityGroupOptions.ID, + "vpc_id": *deleteVPCDnsResolutionBindingOptions.VPCID, + "id": *deleteVPCDnsResolutionBindingOptions.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, `/vpcs/{id}/default_security_group`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCDefaultSecurityGroupOptions.Headers { + for headerName, headerValue := range deleteVPCDnsResolutionBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCDnsResolutionBinding") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1551,12 +1465,12 @@ func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, get var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpc_default_security_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpc_dns_resolution_binding", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultSecurityGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1640,57 +1554,63 @@ func (vpc *VpcV1) GetVPCDnsResolutionBindingWithContext(ctx context.Context, get return } -// GetVPCRoute : Retrieve a VPC route -// This request retrieves a single route specified by the identifier in the URL. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) +// UpdateVPCDnsResolutionBinding : Update a DNS resolution binding +// This request updates a DNS resolution binding with the information in a provided DNS resolution binding patch. The +// DNS resolution binding patch object is structured in the same way as a retrieved DNS resolution binding and contains +// only the information to be updated. +func (vpc *VpcV1) UpdateVPCDnsResolutionBinding(updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetVPCRoute") - err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") +// UpdateVPCDnsResolutionBindingWithContext is an alternate form of the UpdateVPCDnsResolutionBinding method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") + err = core.ValidateStruct(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *getVPCRouteOptions.VPCID, - "id": *getVPCRouteOptions.ID, + "vpc_id": *updateVPCDnsResolutionBindingOptions.VPCID, + "id": *updateVPCDnsResolutionBindingOptions.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, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCRouteOptions.Headers { + for headerName, headerValue := range updateVPCDnsResolutionBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCDnsResolutionBinding") 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(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) + 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()) @@ -1700,12 +1620,12 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpc_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_vpc_dns_resolution_binding", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1716,46 +1636,50 @@ func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions return } -// GetVPCRoutingTable : Retrieve a VPC routing table -// This request retrieves a single routing table specified by the identifier in the URL. -func (vpc *VpcV1) GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) +// ListVPCRoutes : List routes in a VPC's default routing table +// This request lists routes in the VPC's default routing table. Each route is zone-specific and directs any packets +// matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's +// destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCRoutingTableWithContext is an alternate form of the GetVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCRoutingTableOptions, "getVPCRoutingTableOptions cannot be nil") +// ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListVPCRoutes") + err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") + err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *getVPCRoutingTableOptions.VPCID, - "id": *getVPCRoutingTableOptions.ID, + "vpc_id": *listVPCRoutesOptions.VPCID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCRoutingTableOptions.Headers { + for headerName, headerValue := range listVPCRoutesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -1763,6 +1687,15 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listVPCRoutesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) + } + if listVPCRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutesOptions.Start)) + } + if listVPCRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -1773,12 +1706,12 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpc_routing_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpc_routes", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollectionVPCContext) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1789,55 +1722,87 @@ func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRouti return } -// GetVPCRoutingTableRoute : Retrieve a VPC routing table route -// This request retrieves a single VPC route specified by the identifier in the URL path. -func (vpc *VpcV1) GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) +// CreateVPCRoute : Create a route in a VPC's default routing table +// This request creates a new route in the VPC's default routing table. The route prototype object is structured in the +// same way as a retrieved route, and contains the information necessary to create the new route. The request will fail +// if the new route will cause a loop. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVPCRoutingTableRouteWithContext is an alternate form of the GetVPCRoutingTableRoute method which supports a Context parameter -func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions cannot be nil") +// CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: CreateVPCRoute") + err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") + err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *getVPCRoutingTableRouteOptions.VPCID, - "routing_table_id": *getVPCRoutingTableRouteOptions.RoutingTableID, - "id": *getVPCRoutingTableRouteOptions.ID, + "vpc_id": *createVPCRouteOptions.VPCID, } - 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, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVPCRoutingTableRouteOptions.Headers { + for headerName, headerValue := range createVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoute") 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 createVPCRouteOptions.Destination != nil { + body["destination"] = createVPCRouteOptions.Destination + } + if createVPCRouteOptions.Zone != nil { + body["zone"] = createVPCRouteOptions.Zone + } + if createVPCRouteOptions.Action != nil { + body["action"] = createVPCRouteOptions.Action + } + if createVPCRouteOptions.Advertise != nil { + body["advertise"] = createVPCRouteOptions.Advertise + } + if createVPCRouteOptions.Name != nil { + body["name"] = createVPCRouteOptions.Name + } + if createVPCRouteOptions.NextHop != nil { + body["next_hop"] = createVPCRouteOptions.NextHop + } + if createVPCRouteOptions.Priority != nil { + body["priority"] = createVPCRouteOptions.Priority + } + _, 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()) @@ -1847,7 +1812,7 @@ func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPC var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpc_routing_table_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpc_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -1863,58 +1828,55 @@ func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPC return } -// ListVPCAddressPrefixes : List address prefixes for a VPC -// This request lists address pool prefixes for a VPC. -func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} +// DeleteVPCRoute : Delete a VPC route +// This request deletes a route. This operation cannot be reversed. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return +} -// ListVPCAddressPrefixesWithContext is an alternate form of the ListVPCAddressPrefixes method which supports a Context parameter -func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions cannot be nil") +// DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: DeleteVPCRoute") + err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") + err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCAddressPrefixesOptions.VPCID, + "vpc_id": *deleteVPCRouteOptions.VPCID, + "id": *deleteVPCRouteOptions.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, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPCAddressPrefixesOptions.Headers { + for headerName, headerValue := range deleteVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") 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 listVPCAddressPrefixesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) - } - if listVPCAddressPrefixesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCAddressPrefixesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -1922,79 +1884,59 @@ func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPC 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_vpc_address_prefixes", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpc_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefixCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListVPCDnsResolutionBindings : List DNS resolution bindings for a VPC -// This request lists DNS resolution bindings for a VPC. A DNS resolution binding represents an association with another -// VPC for centralizing DNS name resolution. -// -// If the VPC specified by the identifier in the URL is a DNS hub VPC (has `dns.enable_hub` set to `true`) then there is -// one binding for each VPC bound to the hub VPC. The endpoint gateways in the bound VPCs can allow (using -// `allow_dns_resolution_binding`) the hub VPC to centralize resolution of their DNS names. -// -// If the VPC specified by the identifier in the URL is not a DNS hub VPC, then there is at most one binding (to a hub -// VPC). The endpoint gateways in the VPC specified by the identifier in the URL can allow (using -// `allow_dns_resolution_binding`) its hub VPC to centralize resolution of their DNS names. -// -// To make use of centralized DNS resolution, a VPC bound to a DNS hub VPC must delegate DNS resolution to its hub VPC -// by setting `dns.resolver.type` to `delegate`. -// -// The bindings will be sorted by their `created_at` property values, with newest bindings first. Bindings with -// identical `created_at` property values will in turn be sorted by ascending `name` property values. -func (vpc *VpcV1) ListVPCDnsResolutionBindings(listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCDnsResolutionBindingsWithContext(context.Background(), listVPCDnsResolutionBindingsOptions) +// GetVPCRoute : Retrieve a VPC route +// This request retrieves a single route specified by the identifier in the URL. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPCDnsResolutionBindingsWithContext is an alternate form of the ListVPCDnsResolutionBindings method which supports a Context parameter -func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, listVPCDnsResolutionBindingsOptions *ListVPCDnsResolutionBindingsOptions) (result *VpcdnsResolutionBindingCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions cannot be nil") +// GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetVPCRoute") + err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPCDnsResolutionBindingsOptions, "listVPCDnsResolutionBindingsOptions") + err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCDnsResolutionBindingsOptions.VPCID, + "vpc_id": *getVPCRouteOptions.VPCID, + "id": *getVPCRouteOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/dns_resolution_bindings`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPCDnsResolutionBindingsOptions.Headers { + for headerName, headerValue := range getVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCDnsResolutionBindings") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -2002,27 +1944,6 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVPCDnsResolutionBindingsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Sort)) - } - if listVPCDnsResolutionBindingsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Start)) - } - if listVPCDnsResolutionBindingsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Limit)) - } - if listVPCDnsResolutionBindingsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.Name)) - } - if listVPCDnsResolutionBindingsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCCRN)) - } - if listVPCDnsResolutionBindingsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.VPCName)) - } - if listVPCDnsResolutionBindingsOptions.AccountID != nil { - builder.AddQuery("account.id", fmt.Sprint(*listVPCDnsResolutionBindingsOptions.AccountID)) - } request, err := builder.Build() if err != nil { @@ -2033,12 +1954,12 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpc_dns_resolution_bindings", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBindingCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2049,65 +1970,63 @@ func (vpc *VpcV1) ListVPCDnsResolutionBindingsWithContext(ctx context.Context, l return } -// ListVPCRoutes : List routes in a VPC's default routing table -// This request lists routes in the VPC's default routing table. Each route is zone-specific and directs any packets -// matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's -// destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. +// UpdateVPCRoute : Update a VPC route +// This request updates a route with the information in a provided route patch. The route patch object is structured in +// the same way as a retrieved route and contains only the information to be updated. // Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) +func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter +// UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter // Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollectionVPCContext, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListVPCRoutes") - err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") +func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: UpdateVPCRoute") + err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") + err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutesOptions.VPCID, + "vpc_id": *updateVPCRouteOptions.VPCID, + "id": *updateVPCRouteOptions.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, `/vpcs/{vpc_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPCRoutesOptions.Headers { + for headerName, headerValue := range updateVPCRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoute") 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 listVPCRoutesOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) - } - if listVPCRoutesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutesOptions.Start)) - } - if listVPCRoutesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutesOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateVPCRouteOptions.RoutePatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -2119,12 +2038,12 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpc_routes", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_vpc_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollectionVPCContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2135,50 +2054,48 @@ func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOpt return } -// ListVPCRoutingTableRoutes : List routes in a VPC routing table -// This request lists routes in a VPC routing table. If subnets are associated with this routing table, delivery of -// packets sent on a subnet is performed according to the action of the most specific matching route in the table -// (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, the route with the -// highest priority will be used. If two matching routes have the same destination and priority, traffic will be -// distributed between them. If no routes match, delivery will be controlled by the system's built-in routes. -func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) +// ListVPCRoutingTables : List routing tables for a VPC +// This request lists routing tables for a VPC. Each subnet in a VPC is associated with a routing table, which controls +// delivery of packets sent on that subnet according to the action of the most specific matching route in the table. If +// multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, delivery will be +// controlled by the system's built-in routes. +func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPCRoutingTableRoutesWithContext is an alternate form of the ListVPCRoutingTableRoutes method which supports a Context parameter -func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions cannot be nil") +// ListVPCRoutingTablesWithContext is an alternate form of the ListVPCRoutingTables method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") + err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutingTableRoutesOptions.VPCID, - "routing_table_id": *listVPCRoutingTableRoutesOptions.RoutingTableID, + "vpc_id": *listVPCRoutingTablesOptions.VPCID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPCRoutingTableRoutesOptions.Headers { + for headerName, headerValue := range listVPCRoutingTablesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -2186,11 +2103,14 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVPCRoutingTableRoutesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) + if listVPCRoutingTablesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) } - if listVPCRoutingTableRoutesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Limit)) + if listVPCRoutingTablesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTablesOptions.Limit)) + } + if listVPCRoutingTablesOptions.IsDefault != nil { + builder.AddQuery("is_default", fmt.Sprint(*listVPCRoutingTablesOptions.IsDefault)) } request, err := builder.Build() @@ -2202,12 +2122,12 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpc_routing_table_routes", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpc_routing_tables", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTableCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2218,35 +2138,33 @@ func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, list return } -// ListVPCRoutingTables : List routing tables for a VPC -// This request lists routing tables for a VPC. Each subnet in a VPC is associated with a routing table, which controls -// delivery of packets sent on that subnet according to the action of the most specific matching route in the table. If -// multiple equally-specific routes exist, traffic will be distributed across them. If no routes match, delivery will be -// controlled by the system's built-in routes. -func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) +// CreateVPCRoutingTable : Create a routing table for a VPC +// This request creates a routing table from a routing table prototype object. The prototype object is structured in the +// same way as a retrieved routing table, and contains the information necessary to create the new routing table. +func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVPCRoutingTablesWithContext is an alternate form of the ListVPCRoutingTables method which supports a Context parameter -func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions cannot be nil") +// CreateVPCRoutingTableWithContext is an alternate form of the CreateVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRoutingTableOptions, "createVPCRoutingTableOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") + err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *listVPCRoutingTablesOptions.VPCID, + "vpc_id": *createVPCRoutingTableOptions.VPCID, } - 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, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) @@ -2255,26 +2173,49 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo return } - for headerName, headerValue := range listVPCRoutingTablesOptions.Headers { + for headerName, headerValue := range createVPCRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTable") 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)) - if listVPCRoutingTablesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) + + body := make(map[string]interface{}) + if createVPCRoutingTableOptions.AcceptRoutesFrom != nil { + body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom } - if listVPCRoutingTablesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTablesOptions.Limit)) + if createVPCRoutingTableOptions.AdvertiseRoutesTo != nil { + body["advertise_routes_to"] = createVPCRoutingTableOptions.AdvertiseRoutesTo } - if listVPCRoutingTablesOptions.IsDefault != nil { - builder.AddQuery("is_default", fmt.Sprint(*listVPCRoutingTablesOptions.IsDefault)) + if createVPCRoutingTableOptions.Name != nil { + body["name"] = createVPCRoutingTableOptions.Name + } + if createVPCRoutingTableOptions.RouteDirectLinkIngress != nil { + body["route_direct_link_ingress"] = createVPCRoutingTableOptions.RouteDirectLinkIngress + } + if createVPCRoutingTableOptions.RouteInternetIngress != nil { + body["route_internet_ingress"] = createVPCRoutingTableOptions.RouteInternetIngress + } + if createVPCRoutingTableOptions.RouteTransitGatewayIngress != nil { + body["route_transit_gateway_ingress"] = createVPCRoutingTableOptions.RouteTransitGatewayIngress + } + if createVPCRoutingTableOptions.RouteVPCZoneIngress != nil { + body["route_vpc_zone_ingress"] = createVPCRoutingTableOptions.RouteVPCZoneIngress + } + if createVPCRoutingTableOptions.Routes != nil { + body["routes"] = createVPCRoutingTableOptions.Routes + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -2286,12 +2227,12 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpc_routing_tables", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpc_routing_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTableCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2302,57 +2243,56 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo return } -// ListVpcs : List VPCs -// This request lists VPCs in the region. A VPC is a virtual network that belongs to an account and provides logical -// isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC -// can contain resources in multiple zones in a region. -func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) +// DeleteVPCRoutingTable : Delete a VPC routing table +// This request deletes a routing table. A routing table cannot be deleted if it is associated with any subnets in the +// VPC. Additionally, a VPC's default routing table cannot be deleted. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVpcsWithContext is an alternate form of the ListVpcs method which supports a Context parameter -func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVpcsOptions, "listVpcsOptions") +// DeleteVPCRoutingTableWithContext is an alternate form of the DeleteVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRoutingTableOptions.VPCID, + "id": *deleteVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVpcsOptions.Headers { + for headerName, headerValue := range deleteVPCRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") + if deleteVPCRoutingTableOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCRoutingTableOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVpcsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) - } - if listVpcsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVpcsOptions.Limit)) - } - if listVpcsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVpcsOptions.ResourceGroupID)) - } - if listVpcsOptions.ClassicAccess != nil { - builder.AddQuery("classic_access", fmt.Sprint(*listVpcsOptions.ClassicAccess)) - } request, err := builder.Build() if err != nil { @@ -2360,83 +2300,64 @@ func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *List 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_vpcs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpc_routing_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPCCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// UpdateVPC : Update a VPC -// This request updates a VPC with the information provided in a VPC patch object. The patch object is structured in the -// same way as a retrieved VPC and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) +// GetVPCRoutingTable : Retrieve a VPC routing table +// This request retrieves a single routing table specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVPCWithContext is an alternate form of the UpdateVPC method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCOptions, "updateVPCOptions cannot be nil") +// GetVPCRoutingTableWithContext is an alternate form of the GetVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRoutingTableOptions, "getVPCRoutingTableOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") + err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVPCOptions.ID, + "vpc_id": *getVPCRoutingTableOptions.VPCID, + "id": *getVPCRoutingTableOptions.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, `/vpcs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPCOptions.Headers { + for headerName, headerValue := range getVPCRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPC") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVPCOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVPCOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) - 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()) @@ -2446,12 +2367,12 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_vpc", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc_routing_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2462,57 +2383,60 @@ func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *Up return } -// UpdateVPCAddressPrefix : Update an address prefix -// This request updates a prefix with the information in a provided prefix patch. The prefix patch object is structured -// in the same way as a retrieved prefix and contains only the information to be updated. -func (vpc *VpcV1) UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) +// UpdateVPCRoutingTable : Update a VPC routing table +// This request updates a routing table with the information in a provided routing table patch. The patch object is +// structured in the same way as a retrieved table and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVPCAddressPrefixWithContext is an alternate form of the UpdateVPCAddressPrefix method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions cannot be nil") +// UpdateVPCRoutingTableWithContext is an alternate form of the UpdateVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") + err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCAddressPrefixOptions.VPCID, - "id": *updateVPCAddressPrefixOptions.ID, + "vpc_id": *updateVPCRoutingTableOptions.VPCID, + "id": *updateVPCRoutingTableOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPCAddressPrefixOptions.Headers { + for headerName, headerValue := range updateVPCRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCAddressPrefix") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVPCRoutingTableOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPCRoutingTableOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateVPCAddressPrefixOptions.AddressPrefixPatch) + _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -2527,12 +2451,12 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_vpc_address_prefix", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_vpc_routing_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2543,61 +2467,62 @@ func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateV return } -// UpdateVPCDnsResolutionBinding : Update a DNS resolution binding -// This request updates a DNS resolution binding with the information in a provided DNS resolution binding patch. The -// DNS resolution binding patch object is structured in the same way as a retrieved DNS resolution binding and contains -// only the information to be updated. -func (vpc *VpcV1) UpdateVPCDnsResolutionBinding(updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCDnsResolutionBindingWithContext(context.Background(), updateVPCDnsResolutionBindingOptions) +// ListVPCRoutingTableRoutes : List routes in a VPC routing table +// This request lists routes in a VPC routing table. If subnets are associated with this routing table, delivery of +// packets sent on a subnet is performed according to the action of the most specific matching route in the table +// (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, the route with the +// highest priority will be used. If two matching routes have the same destination and priority, traffic will be +// distributed between them. If no routes match, delivery will be controlled by the system's built-in routes. +func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVPCDnsResolutionBindingWithContext is an alternate form of the UpdateVPCDnsResolutionBinding method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, updateVPCDnsResolutionBindingOptions *UpdateVPCDnsResolutionBindingOptions) (result *VpcdnsResolutionBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions cannot be nil") +// ListVPCRoutingTableRoutesWithContext is an alternate form of the ListVPCRoutingTableRoutes method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPCDnsResolutionBindingOptions, "updateVPCDnsResolutionBindingOptions") + err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCDnsResolutionBindingOptions.VPCID, - "id": *updateVPCDnsResolutionBindingOptions.ID, + "vpc_id": *listVPCRoutingTableRoutesOptions.VPCID, + "routing_table_id": *listVPCRoutingTableRoutesOptions.RoutingTableID, } - 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, `/vpcs/{vpc_id}/dns_resolution_bindings/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPCDnsResolutionBindingOptions.Headers { + for headerName, headerValue := range listVPCRoutingTableRoutesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCDnsResolutionBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") 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(updateVPCDnsResolutionBindingOptions.VpcdnsResolutionBindingPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listVPCRoutingTableRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) + } + if listVPCRoutingTableRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Limit)) } request, err := builder.Build() @@ -2609,12 +2534,12 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_vpc_dns_resolution_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_vpc_routing_table_routes", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVpcdnsResolutionBinding) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2625,60 +2550,79 @@ func (vpc *VpcV1) UpdateVPCDnsResolutionBindingWithContext(ctx context.Context, return } -// UpdateVPCRoute : Update a VPC route -// This request updates a route with the information in a provided route patch. The route patch object is structured in -// the same way as a retrieved route and contains only the information to be updated. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) +// CreateVPCRoutingTableRoute : Create a route in a VPC routing table +// This request creates a new VPC route from a VPC route prototype object. The prototype object is structured in the +// same way as a retrieved VPC route and contains the information necessary to create the route. +func (vpc *VpcV1) CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: UpdateVPCRoute") - err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") +// CreateVPCRoutingTableRouteWithContext is an alternate form of the CreateVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") + err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCRouteOptions.VPCID, - "id": *updateVPCRouteOptions.ID, + "vpc_id": *createVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *createVPCRoutingTableRouteOptions.RoutingTableID, } - 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, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPCRouteOptions.Headers { + for headerName, headerValue := range createVPCRoutingTableRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTableRoute") 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(updateVPCRouteOptions.RoutePatch) + body := make(map[string]interface{}) + if createVPCRoutingTableRouteOptions.Destination != nil { + body["destination"] = createVPCRoutingTableRouteOptions.Destination + } + if createVPCRoutingTableRouteOptions.Zone != nil { + body["zone"] = createVPCRoutingTableRouteOptions.Zone + } + if createVPCRoutingTableRouteOptions.Action != nil { + body["action"] = createVPCRoutingTableRouteOptions.Action + } + if createVPCRoutingTableRouteOptions.Advertise != nil { + body["advertise"] = createVPCRoutingTableRouteOptions.Advertise + } + if createVPCRoutingTableRouteOptions.Name != nil { + body["name"] = createVPCRoutingTableRouteOptions.Name + } + if createVPCRoutingTableRouteOptions.NextHop != nil { + body["next_hop"] = createVPCRoutingTableRouteOptions.NextHop + } + if createVPCRoutingTableRouteOptions.Priority != nil { + body["priority"] = createVPCRoutingTableRouteOptions.Priority + } + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -2693,7 +2637,7 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_vpc_route", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_vpc_routing_table_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -2709,65 +2653,120 @@ func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteO return } -// UpdateVPCRoutingTable : Update a VPC routing table -// This request updates a routing table with the information in a provided routing table patch. The patch object is -// structured in the same way as a retrieved table and contains only the information to be updated. -func (vpc *VpcV1) UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) +// DeleteVPCRoutingTableRoute : Delete a VPC routing table route +// This request deletes a VPC route. This operation cannot be reversed. Only VPC routes with an `origin` of `user` are +// allowed to be deleted. +func (vpc *VpcV1) DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVPCRoutingTableWithContext is an alternate form of the UpdateVPCRoutingTable method which supports a Context parameter -func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions cannot be nil") +// DeleteVPCRoutingTableRouteWithContext is an alternate form of the DeleteVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") + err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpc_id": *updateVPCRoutingTableOptions.VPCID, - "id": *updateVPCRoutingTableOptions.ID, + "vpc_id": *deleteVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *deleteVPCRoutingTableRouteOptions.RoutingTableID, + "id": *deleteVPCRoutingTableRouteOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPCRoutingTableOptions.Headers { + for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVPCRoutingTableOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVPCRoutingTableOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) + request, err := builder.Build() if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_vpc_routing_table_route", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// GetVPCRoutingTableRoute : Retrieve a VPC routing table route +// This request retrieves a single VPC route specified by the identifier in the URL path. +func (vpc *VpcV1) GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetVPCRoutingTableRouteWithContext is an alternate form of the GetVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *getVPCRoutingTableRouteOptions.RoutingTableID, + "id": *getVPCRoutingTableRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } + for headerName, headerValue := range getVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") + 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()) @@ -2777,12 +2776,12 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_vpc_routing_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_vpc_routing_table_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2876,30 +2875,24 @@ func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, upd return } -// CreateSubnet : Create a subnet -// This request creates a new subnet from a subnet prototype object. The prototype object is structured in the same way -// as a retrieved subnet, and contains the information necessary to create the new subnet. For this request to succeed, -// the prototype's CIDR block must not overlap with an existing subnet in the VPC. -func (vpc *VpcV1) CreateSubnet(createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) +// ListSubnets : List subnets +// This request lists subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block +// notation. Each subnet is within a particular zone and cannot span multiple zones or regions. +func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSubnetWithContext is an alternate form of the CreateSubnet method which supports a Context parameter -func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSubnetOptions, "createSubnetOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") +// ListSubnetsWithContext is an alternate form of the ListSubnets method which supports a Context parameter +func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSubnetsOptions, "listSubnetsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/subnets`, nil) @@ -2908,24 +2901,44 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio return } - for headerName, headerValue := range createSubnetOptions.Headers { + for headerName, headerValue := range listSubnetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") 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(createSubnetOptions.SubnetPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listSubnetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) + } + if listSubnetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSubnetsOptions.Limit)) + } + if listSubnetsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSubnetsOptions.ResourceGroupID)) + } + if listSubnetsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listSubnetsOptions.ZoneName)) + } + if listSubnetsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listSubnetsOptions.VPCID)) + } + if listSubnetsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listSubnetsOptions.VPCCRN)) + } + if listSubnetsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listSubnetsOptions.VPCName)) + } + if listSubnetsOptions.RoutingTableID != nil { + builder.AddQuery("routing_table.id", fmt.Sprint(*listSubnetsOptions.RoutingTableID)) + } + if listSubnetsOptions.RoutingTableName != nil { + builder.AddQuery("routing_table.name", fmt.Sprint(*listSubnetsOptions.RoutingTableName)) } request, err := builder.Build() @@ -2937,12 +2950,12 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_subnet", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_subnets", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnetCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2953,46 +2966,43 @@ func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptio return } -// CreateSubnetReservedIP : Reserve an IP in a subnet -// This request reserves an IP address in a subnet. If the provided prototype object includes an `address`, the address -// must not already be reserved. -func (vpc *VpcV1) CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) +// CreateSubnet : Create a subnet +// This request creates a new subnet from a subnet prototype object. The prototype object is structured in the same way +// as a retrieved subnet, and contains the information necessary to create the new subnet. For this request to succeed, +// the prototype's CIDR block must not overlap with an existing subnet in the VPC. +func (vpc *VpcV1) CreateSubnet(createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSubnetReservedIPWithContext is an alternate form of the CreateSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSubnetReservedIPOptions, "createSubnetReservedIPOptions cannot be nil") +// CreateSubnetWithContext is an alternate form of the CreateSubnet method which supports a Context parameter +func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSubnetOptions, "createSubnetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") + err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "subnet_id": *createSubnetReservedIPOptions.SubnetID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSubnetReservedIPOptions.Headers { + for headerName, headerValue := range createSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3002,20 +3012,7 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if createSubnetReservedIPOptions.Address != nil { - body["address"] = createSubnetReservedIPOptions.Address - } - if createSubnetReservedIPOptions.AutoDelete != nil { - body["auto_delete"] = createSubnetReservedIPOptions.AutoDelete - } - if createSubnetReservedIPOptions.Name != nil { - body["name"] = createSubnetReservedIPOptions.Name - } - if createSubnetReservedIPOptions.Target != nil { - body["target"] = createSubnetReservedIPOptions.Target - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(createSubnetOptions.SubnetPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -3030,12 +3027,12 @@ func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createS var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_subnet_reserved_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_subnet", 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, UnmarshalSubnet) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3112,53 +3109,49 @@ func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptio return } -// DeleteSubnetReservedIP : Delete a reserved IP -// This request releases a reserved IP. This operation cannot be reversed. -// -// For this request to succeed, the reserved IP must not be required by another resource, such as a bare metal server -// network interface, instance network interface or virtual network interface for which it is the primary IP. A -// provider-owned reserved IP is not allowed to be deleted. -func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) +// GetSubnet : Retrieve a subnet +// This request retrieves a single subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnet(getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSubnetReservedIPWithContext is an alternate form of the DeleteSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions cannot be nil") +// GetSubnetWithContext is an alternate form of the GetSubnet method which supports a Context parameter +func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetOptions, "getSubnetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") + err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "subnet_id": *deleteSubnetReservedIPOptions.SubnetID, - "id": *deleteSubnetReservedIPOptions.ID, + "id": *getSubnetOptions.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, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { + for headerName, headerValue := range getSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") 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)) @@ -3169,42 +3162,52 @@ func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteS 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_subnet_reserved_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_subnet", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetSubnet : Retrieve a subnet -// This request retrieves a single subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnet(getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) +// UpdateSubnet : Update a subnet +// This request updates a subnet with the information in a provided subnet patch. The subnet patch object is structured +// in the same way as a retrieved subnet and contains only the information to be updated. +func (vpc *VpcV1) UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSubnetWithContext is an alternate form of the GetSubnet method which supports a Context parameter -func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetOptions, "getSubnetOptions cannot be nil") +// UpdateSubnetWithContext is an alternate form of the UpdateSubnet method which supports a Context parameter +func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSubnetOptions, "updateSubnetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") + err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSubnetOptions.ID, + "id": *updateSubnetOptions.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, `/subnets/{id}`, pathParamsMap) @@ -3213,19 +3216,26 @@ func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *Ge return } - for headerName, headerValue := range getSubnetOptions.Headers { + for headerName, headerValue := range updateSubnetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") 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(updateSubnetOptions.SubnetPatch) + 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()) @@ -3235,7 +3245,7 @@ func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *Ge var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_subnet", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_subnet", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -3323,53 +3333,60 @@ func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetN return } -// GetSubnetPublicGateway : Retrieve a subnet's attached public gateway -// This request retrieves the public gateway attached to the subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) +// ReplaceSubnetNetworkACL : Replace the network ACL for a subnet +// This request replaces the existing network ACL for a subnet with the network ACL specified in the request body. +func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + result, response, err = vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSubnetPublicGatewayWithContext is an alternate form of the GetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions cannot be nil") +// ReplaceSubnetNetworkACLWithContext is an alternate form of the ReplaceSubnetNetworkACL method which supports a Context parameter +func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") + err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSubnetPublicGatewayOptions.ID, + "id": *replaceSubnetNetworkACLOptions.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, `/subnets/{id}/public_gateway`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSubnetPublicGatewayOptions.Headers { + for headerName, headerValue := range replaceSubnetNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") 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(replaceSubnetNetworkACLOptions.NetworkACLIdentity) + 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()) @@ -3379,12 +3396,12 @@ func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubn var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_subnet_public_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "replace_subnet_network_acl", 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, UnmarshalNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3395,50 +3412,48 @@ func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubn return } -// GetSubnetReservedIP : Retrieve a reserved IP -// This request retrieves a single reserved IP specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) +// UnsetSubnetPublicGateway : Detach a public gateway from a subnet +// This request detaches the public gateway from the subnet specified by the subnet identifier in the URL. +func (vpc *VpcV1) UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSubnetReservedIPWithContext is an alternate form of the GetSubnetReservedIP method which supports a Context parameter -func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetReservedIPOptions, "getSubnetReservedIPOptions cannot be nil") +// UnsetSubnetPublicGatewayWithContext is an alternate form of the UnsetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") + err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "subnet_id": *getSubnetReservedIPOptions.SubnetID, - "id": *getSubnetReservedIPOptions.ID, + "id": *unsetSubnetPublicGatewayOptions.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, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSubnetReservedIPOptions.Headers { + for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") 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)) @@ -3449,64 +3464,55 @@ func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetR 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_subnet_reserved_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "unset_subnet_public_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetSubnetRoutingTable : Retrieve a subnet's attached routing table -// This request retrieves the routing table attached to the subnet specified by the identifier in the URL. -func (vpc *VpcV1) GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) +// GetSubnetPublicGateway : Retrieve a subnet's attached public gateway +// This request retrieves the public gateway attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSubnetRoutingTableWithContext is an alternate form of the GetSubnetRoutingTable method which supports a Context parameter -func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions cannot be nil") +// GetSubnetPublicGatewayWithContext is an alternate form of the GetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") + err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSubnetRoutingTableOptions.ID, + "id": *getSubnetPublicGatewayOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSubnetRoutingTableOptions.Headers { + for headerName, headerValue := range getSubnetPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3524,12 +3530,12 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_subnet_routing_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_subnet_public_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3540,73 +3546,59 @@ func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubne return } -// ListSubnetReservedIps : List reserved IPs in a subnet -// This request lists reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet which -// is not available for use. -func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) +// SetSubnetPublicGateway : Attach a public gateway to a subnet +// This request attaches the public gateway, specified in the request body, to the subnet specified by the subnet +// identifier in the URL. The public gateway must have the same VPC and zone as the subnet. +func (vpc *VpcV1) SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + result, response, err = vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSubnetReservedIpsWithContext is an alternate form of the ListSubnetReservedIps method which supports a Context parameter -func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions cannot be nil") +// SetSubnetPublicGatewayWithContext is an alternate form of the SetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") + err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "subnet_id": *listSubnetReservedIpsOptions.SubnetID, + "id": *setSubnetPublicGatewayOptions.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, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSubnetReservedIpsOptions.Headers { + for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") 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)) - if listSubnetReservedIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) - } - if listSubnetReservedIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSubnetReservedIpsOptions.Limit)) - } - if listSubnetReservedIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSubnetReservedIpsOptions.Sort)) - } - if listSubnetReservedIpsOptions.TargetID != nil { - builder.AddQuery("target.id", fmt.Sprint(*listSubnetReservedIpsOptions.TargetID)) - } - if listSubnetReservedIpsOptions.TargetCRN != nil { - builder.AddQuery("target.crn", fmt.Sprint(*listSubnetReservedIpsOptions.TargetCRN)) - } - if listSubnetReservedIpsOptions.TargetName != nil { - builder.AddQuery("target.name", fmt.Sprint(*listSubnetReservedIpsOptions.TargetName)) - } - if listSubnetReservedIpsOptions.TargetResourceType != nil { - builder.AddQuery("target.resource_type", fmt.Sprint(*listSubnetReservedIpsOptions.TargetResourceType)) + + _, err = builder.SetBodyContentJSON(setSubnetPublicGatewayOptions.PublicGatewayIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -3618,12 +3610,12 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_subnet_reserved_ips", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "set_subnet_public_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3634,37 +3626,45 @@ func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubn return } -// ListSubnets : List subnets -// This request lists subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block -// notation. Each subnet is within a particular zone and cannot span multiple zones or regions. -func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) +// GetSubnetRoutingTable : Retrieve a subnet's attached routing table +// This request retrieves the routing table attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSubnetsWithContext is an alternate form of the ListSubnets method which supports a Context parameter -func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSubnetsOptions, "listSubnetsOptions") +// GetSubnetRoutingTableWithContext is an alternate form of the GetSubnetRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *getSubnetRoutingTableOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSubnetsOptions.Headers { + for headerName, headerValue := range getSubnetRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3672,33 +3672,6 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listSubnetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) - } - if listSubnetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSubnetsOptions.Limit)) - } - if listSubnetsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSubnetsOptions.ResourceGroupID)) - } - if listSubnetsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listSubnetsOptions.ZoneName)) - } - if listSubnetsOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listSubnetsOptions.VPCID)) - } - if listSubnetsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listSubnetsOptions.VPCCRN)) - } - if listSubnetsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listSubnetsOptions.VPCName)) - } - if listSubnetsOptions.RoutingTableID != nil { - builder.AddQuery("routing_table.id", fmt.Sprint(*listSubnetsOptions.RoutingTableID)) - } - if listSubnetsOptions.RoutingTableName != nil { - builder.AddQuery("routing_table.name", fmt.Sprint(*listSubnetsOptions.RoutingTableName)) - } request, err := builder.Build() if err != nil { @@ -3709,12 +3682,12 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_subnets", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_subnet_routing_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnetCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3725,45 +3698,48 @@ func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions return } -// ReplaceSubnetNetworkACL : Replace the network ACL for a subnet -// This request replaces the existing network ACL for a subnet with the network ACL specified in the request body. -func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - result, response, err = vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) +// ReplaceSubnetRoutingTable : Replace the routing table for a subnet +// This request replaces the existing routing table for a subnet with the routing table specified in the request body. +// +// For this request to succeed, the routing table `route_direct_link_ingress`, +// `route_internet_ingress`, `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. +func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + result, response, err = vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// ReplaceSubnetNetworkACLWithContext is an alternate form of the ReplaceSubnetNetworkACL method which supports a Context parameter -func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions cannot be nil") +// ReplaceSubnetRoutingTableWithContext is an alternate form of the ReplaceSubnetRoutingTable method which supports a Context parameter +func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") + err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *replaceSubnetNetworkACLOptions.ID, + "id": *replaceSubnetRoutingTableOptions.ID, } builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range replaceSubnetNetworkACLOptions.Headers { + for headerName, headerValue := range replaceSubnetRoutingTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3773,7 +3749,7 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(replaceSubnetNetworkACLOptions.NetworkACLIdentity) + _, err = builder.SetBodyContentJSON(replaceSubnetRoutingTableOptions.RoutingTableIdentity) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -3788,12 +3764,12 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "replace_subnet_network_acl", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "replace_subnet_routing_table", 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, UnmarshalRoutingTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3804,61 +3780,73 @@ func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replac return } -// ReplaceSubnetRoutingTable : Replace the routing table for a subnet -// This request replaces the existing routing table for a subnet with the routing table specified in the request body. -// -// For this request to succeed, the routing table `route_direct_link_ingress`, -// `route_internet_ingress`, `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. -func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - result, response, err = vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) +// ListSubnetReservedIps : List reserved IPs in a subnet +// This request lists reserved IPs in a subnet. A reserved IP resource will exist for every address in the subnet which +// is not available for use. +func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ReplaceSubnetRoutingTableWithContext is an alternate form of the ReplaceSubnetRoutingTable method which supports a Context parameter -func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions cannot be nil") +// ListSubnetReservedIpsWithContext is an alternate form of the ListSubnetReservedIps method which supports a Context parameter +func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") + err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *replaceSubnetRoutingTableOptions.ID, + "subnet_id": *listSubnetReservedIpsOptions.SubnetID, } - 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, `/subnets/{id}/routing_table`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range replaceSubnetRoutingTableOptions.Headers { + for headerName, headerValue := range listSubnetReservedIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") 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(replaceSubnetRoutingTableOptions.RoutingTableIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listSubnetReservedIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) + } + if listSubnetReservedIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSubnetReservedIpsOptions.Limit)) + } + if listSubnetReservedIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSubnetReservedIpsOptions.Sort)) + } + if listSubnetReservedIpsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listSubnetReservedIpsOptions.TargetID)) + } + if listSubnetReservedIpsOptions.TargetCRN != nil { + builder.AddQuery("target.crn", fmt.Sprint(*listSubnetReservedIpsOptions.TargetCRN)) + } + if listSubnetReservedIpsOptions.TargetName != nil { + builder.AddQuery("target.name", fmt.Sprint(*listSubnetReservedIpsOptions.TargetName)) + } + if listSubnetReservedIpsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listSubnetReservedIpsOptions.TargetResourceType)) } request, err := builder.Build() @@ -3870,12 +3858,12 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "replace_subnet_routing_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_subnet_reserved_ips", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3886,46 +3874,46 @@ func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, repl return } -// SetSubnetPublicGateway : Attach a public gateway to a subnet -// This request attaches the public gateway, specified in the request body, to the subnet specified by the subnet -// identifier in the URL. The public gateway must have the same VPC and zone as the subnet. -func (vpc *VpcV1) SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - result, response, err = vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) +// CreateSubnetReservedIP : Reserve an IP in a subnet +// This request reserves an IP address in a subnet. If the provided prototype object includes an `address`, the address +// must not already be reserved. +func (vpc *VpcV1) CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// SetSubnetPublicGatewayWithContext is an alternate form of the SetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions cannot be nil") +// CreateSubnetReservedIPWithContext is an alternate form of the CreateSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSubnetReservedIPOptions, "createSubnetReservedIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") + err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *setSubnetPublicGatewayOptions.ID, + "subnet_id": *createSubnetReservedIPOptions.SubnetID, } - 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, `/subnets/{id}/public_gateway`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { + for headerName, headerValue := range createSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -3935,7 +3923,20 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(setSubnetPublicGatewayOptions.PublicGatewayIdentity) + body := make(map[string]interface{}) + if createSubnetReservedIPOptions.Address != nil { + body["address"] = createSubnetReservedIPOptions.Address + } + if createSubnetReservedIPOptions.AutoDelete != nil { + body["auto_delete"] = createSubnetReservedIPOptions.AutoDelete + } + if createSubnetReservedIPOptions.Name != nil { + body["name"] = createSubnetReservedIPOptions.Name + } + if createSubnetReservedIPOptions.Target != nil { + body["target"] = createSubnetReservedIPOptions.Target + } + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -3950,12 +3951,12 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "set_subnet_public_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_subnet_reserved_ip", 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, UnmarshalReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3966,45 +3967,50 @@ func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubn return } -// UnsetSubnetPublicGateway : Detach a public gateway from a subnet -// This request detaches the public gateway from the subnet specified by the subnet identifier in the URL. -func (vpc *VpcV1) UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) +// DeleteSubnetReservedIP : Delete a reserved IP +// This request releases a reserved IP. This operation cannot be reversed. +// +// For this request to succeed, the reserved IP must not be required by another resource, such as a bare metal server +// network interface, instance network interface or virtual network interface for which it is the primary IP. A +// provider-owned reserved IP is not allowed to be deleted. +func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// UnsetSubnetPublicGatewayWithContext is an alternate form of the UnsetSubnetPublicGateway method which supports a Context parameter -func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions cannot be nil") +// DeleteSubnetReservedIPWithContext is an alternate form of the DeleteSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") + err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *unsetSubnetPublicGatewayOptions.ID, + "subnet_id": *deleteSubnetReservedIPOptions.SubnetID, + "id": *deleteSubnetReservedIPOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { + for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -4020,7 +4026,7 @@ func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unset response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "unset_subnet_public_gateway", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_subnet_reserved_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -4028,61 +4034,54 @@ func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unset return } -// UpdateSubnet : Update a subnet -// This request updates a subnet with the information in a provided subnet patch. The subnet patch object is structured -// in the same way as a retrieved subnet and contains only the information to be updated. -func (vpc *VpcV1) UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) +// GetSubnetReservedIP : Retrieve a reserved IP +// This request retrieves a single reserved IP specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateSubnetWithContext is an alternate form of the UpdateSubnet method which supports a Context parameter -func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSubnetOptions, "updateSubnetOptions cannot be nil") +// GetSubnetReservedIPWithContext is an alternate form of the GetSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetReservedIPOptions, "getSubnetReservedIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") + err = core.ValidateStruct(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateSubnetOptions.ID, + "subnet_id": *getSubnetReservedIPOptions.SubnetID, + "id": *getSubnetReservedIPOptions.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, `/subnets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateSubnetOptions.Headers { + for headerName, headerValue := range getSubnetReservedIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") 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(updateSubnetOptions.SubnetPatch) - 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()) @@ -4092,12 +4091,12 @@ func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptio var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_subnet", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_subnet_reserved_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4191,31 +4190,24 @@ func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateS return } -// CreateImage : Create an image -// This request creates a new image from an image prototype object. The prototype object is structured in the same way -// as a retrieved image, and contains the information necessary to create the new image. If an image is being imported, -// a URL to the image file on object storage must be specified. If an image is being created from an existing volume, -// that volume must be specified. -func (vpc *VpcV1) CreateImage(createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateImageWithContext(context.Background(), createImageOptions) +// ListImages : List images +// This request lists images available in the region. An image provides source data for a volume. Images are either +// system-provided, or created from another source, such as importing from Cloud Object Storage. +func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListImagesWithContext(context.Background(), listImagesOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateImageWithContext is an alternate form of the CreateImage method which supports a Context parameter -func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createImageOptions, "createImageOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createImageOptions, "createImageOptions") +// ListImagesWithContext is an alternate form of the ListImages method which supports a Context parameter +func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listImagesOptions, "listImagesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/images`, nil) @@ -4224,24 +4216,38 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions return } - for headerName, headerValue := range createImageOptions.Headers { + for headerName, headerValue := range listImagesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") 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(createImageOptions.ImagePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listImagesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) + } + if listImagesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listImagesOptions.Limit)) + } + if listImagesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listImagesOptions.ResourceGroupID)) + } + if listImagesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) + } + if listImagesOptions.Status != nil { + builder.AddQuery("status", strings.Join(listImagesOptions.Status, ",")) + } + if listImagesOptions.Visibility != nil { + builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) + } + if listImagesOptions.UserDataFormat != nil { + builder.AddQuery("user_data_format", strings.Join(listImagesOptions.UserDataFormat, ",")) } request, err := builder.Build() @@ -4253,12 +4259,12 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_image", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_images", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4269,48 +4275,44 @@ func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions return } -// CreateImageExportJob : Create an export job for an image -// This request creates and queues a new export job for the image specified in the URL using the image export job -// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, `obsolete`, or -// `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains -// the information necessary to create and queue the new image export job. -func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) +// CreateImage : Create an image +// This request creates a new image from an image prototype object. The prototype object is structured in the same way +// as a retrieved image, and contains the information necessary to create the new image. If an image is being imported, +// a URL to the image file on object storage must be specified. If an image is being created from an existing volume, +// that volume must be specified. +func (vpc *VpcV1) CreateImage(createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateImageWithContext(context.Background(), createImageOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateImageExportJobWithContext is an alternate form of the CreateImageExportJob method which supports a Context parameter -func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createImageExportJobOptions, "createImageExportJobOptions cannot be nil") +// CreateImageWithContext is an alternate form of the CreateImage method which supports a Context parameter +func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createImageOptions, "createImageOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createImageExportJobOptions, "createImageExportJobOptions") + err = core.ValidateStruct(createImageOptions, "createImageOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "image_id": *createImageExportJobOptions.ImageID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createImageExportJobOptions.Headers { + for headerName, headerValue := range createImageOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImageExportJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -4320,17 +4322,7 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if createImageExportJobOptions.StorageBucket != nil { - body["storage_bucket"] = createImageExportJobOptions.StorageBucket - } - if createImageExportJobOptions.Format != nil { - body["format"] = createImageExportJobOptions.Format - } - if createImageExportJobOptions.Name != nil { - body["name"] = createImageExportJobOptions.Name - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(createImageOptions.ImagePrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -4345,12 +4337,12 @@ func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createIma var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_image_export_job", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_image", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4427,51 +4419,49 @@ func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions return } -// DeleteImageExportJob : Delete an image export job -// This request deletes an image export job. This operation cannot be reversed. If the job has not completed, the job -// will be canceled, and the incomplete exported image object deleted. If the job has completed, the exported image -// object will not be deleted. -func (vpc *VpcV1) DeleteImageExportJob(deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) +// GetImage : Retrieve an image +// This request retrieves a single image specified by the identifier in the URL. +func (vpc *VpcV1) GetImage(getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetImageWithContext(context.Background(), getImageOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteImageExportJobWithContext is an alternate form of the DeleteImageExportJob method which supports a Context parameter -func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteImageExportJobOptions, "deleteImageExportJobOptions cannot be nil") +// GetImageWithContext is an alternate form of the GetImage method which supports a Context parameter +func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getImageOptions, "getImageOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteImageExportJobOptions, "deleteImageExportJobOptions") + err = core.ValidateStruct(getImageOptions, "getImageOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "image_id": *deleteImageExportJobOptions.ImageID, - "id": *deleteImageExportJobOptions.ID, + "id": *getImageOptions.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, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteImageExportJobOptions.Headers { + for headerName, headerValue := range getImageOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImageExportJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") 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)) @@ -4482,12 +4472,102 @@ func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteIma 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_image_export_job", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_image", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// UpdateImage : Update an image +// This request updates an image with the information in a provided image patch. The image patch object is structured in +// the same way as a retrieved image and contains only the information to be updated. A system-provided image is not +// allowed to be updated. An image with a `status` of `deleting` cannot be updated. +func (vpc *VpcV1) UpdateImage(updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateImageWithContext(context.Background(), updateImageOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// UpdateImageWithContext is an alternate form of the UpdateImage method which supports a Context parameter +func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateImageOptions, "updateImageOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateImageOptions, "updateImageOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *updateImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range updateImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImage") + 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(updateImageOptions.ImagePatch) + 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_image", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } @@ -4565,49 +4645,57 @@ func (vpc *VpcV1) DeprecateImageWithContext(ctx context.Context, deprecateImageO return } -// GetImage : Retrieve an image -// This request retrieves a single image specified by the identifier in the URL. -func (vpc *VpcV1) GetImage(getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetImageWithContext(context.Background(), getImageOptions) +// ObsoleteImage : Obsolete an image +// This request obsoletes an image, resulting in its `status` becoming `obsolete` and +// `obsolescence_at` being set to the current date and time. +// +// The image must: +// - have a `status` of `available` or `deprecated` +// - have `catalog_offering.managed` set to `false` +// - not have `deprecation_at` set in the future +// - not have `obsolescence_at` set +// +// A system-provided image is not allowed to be obsoleted. +func (vpc *VpcV1) ObsoleteImage(obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetImageWithContext is an alternate form of the GetImage method which supports a Context parameter -func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getImageOptions, "getImageOptions cannot be nil") +// ObsoleteImageWithContext is an alternate form of the ObsoleteImage method which supports a Context parameter +func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(obsoleteImageOptions, "obsoleteImageOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getImageOptions, "getImageOptions") + err = core.ValidateStruct(obsoleteImageOptions, "obsoleteImageOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getImageOptions.ID, + "id": *obsoleteImageOptions.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, `/images/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}/obsolete`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getImageOptions.Headers { + for headerName, headerValue := range obsoleteImageOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ObsoleteImage") 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)) @@ -4618,65 +4706,60 @@ func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetI 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_image", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "obsolete_image", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetImageExportJob : Retrieve an image export job -// This request retrieves a single image export job specified by the identifier in the URL. -func (vpc *VpcV1) GetImageExportJob(getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) +// ListImageExportJobs : List export jobs for an image +// This request lists export jobs for an image. Each job tracks the exporting of the image to another location, such as +// a bucket within cloud object storage. +// +// The jobs will be sorted by their `created_at` property values, with newest jobs first. Jobs with identical +// `created_at` property values will in turn be sorted by ascending +// `name` property values. +func (vpc *VpcV1) ListImageExportJobs(listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListImageExportJobsWithContext(context.Background(), listImageExportJobsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetImageExportJobWithContext is an alternate form of the GetImageExportJob method which supports a Context parameter -func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getImageExportJobOptions, "getImageExportJobOptions cannot be nil") +// ListImageExportJobsWithContext is an alternate form of the ListImageExportJobs method which supports a Context parameter +func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listImageExportJobsOptions, "listImageExportJobsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getImageExportJobOptions, "getImageExportJobOptions") + err = core.ValidateStruct(listImageExportJobsOptions, "listImageExportJobsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "image_id": *getImageExportJobOptions.ImageID, - "id": *getImageExportJobOptions.ID, + "image_id": *listImageExportJobsOptions.ImageID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getImageExportJobOptions.Headers { + for headerName, headerValue := range listImageExportJobsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImageExportJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageExportJobs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -4684,6 +4767,9 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listImageExportJobsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listImageExportJobsOptions.Name)) + } request, err := builder.Build() if err != nil { @@ -4694,12 +4780,12 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_image_export_job", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_image_export_jobs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJobUnpaginatedCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4710,53 +4796,73 @@ func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExpo return } -// GetOperatingSystem : Retrieve an operating system -// This request retrieves a single operating system specified by the name in the URL. -func (vpc *VpcV1) GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) +// CreateImageExportJob : Create an export job for an image +// This request creates and queues a new export job for the image specified in the URL using the image export job +// prototype object. The image must be owned by the account and be in the `available`, `deprecated`, `obsolete`, or +// `unusable` state. The prototype object is structured in the same way as a retrieved image export job, and contains +// the information necessary to create and queue the new image export job. +func (vpc *VpcV1) CreateImageExportJob(createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateImageExportJobWithContext(context.Background(), createImageExportJobOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetOperatingSystemWithContext is an alternate form of the GetOperatingSystem method which supports a Context parameter -func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getOperatingSystemOptions, "getOperatingSystemOptions cannot be nil") +// CreateImageExportJobWithContext is an alternate form of the CreateImageExportJob method which supports a Context parameter +func (vpc *VpcV1) CreateImageExportJobWithContext(ctx context.Context, createImageExportJobOptions *CreateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createImageExportJobOptions, "createImageExportJobOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") + err = core.ValidateStruct(createImageExportJobOptions, "createImageExportJobOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getOperatingSystemOptions.Name, + "image_id": *createImageExportJobOptions.ImageID, } - 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, `/operating_systems/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getOperatingSystemOptions.Headers { + for headerName, headerValue := range createImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetOperatingSystem") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImageExportJob") 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 createImageExportJobOptions.StorageBucket != nil { + body["storage_bucket"] = createImageExportJobOptions.StorageBucket + } + if createImageExportJobOptions.Format != nil { + body["format"] = createImageExportJobOptions.Format + } + if createImageExportJobOptions.Name != nil { + body["name"] = createImageExportJobOptions.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()) @@ -4766,12 +4872,12 @@ func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatin var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_operating_system", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_image_export_job", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystem) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4782,60 +4888,54 @@ func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatin return } -// ListImageExportJobs : List export jobs for an image -// This request lists export jobs for an image. Each job tracks the exporting of the image to another location, such as -// a bucket within cloud object storage. -// -// The jobs will be sorted by their `created_at` property values, with newest jobs first. Jobs with identical -// `created_at` property values will in turn be sorted by ascending -// `name` property values. -func (vpc *VpcV1) ListImageExportJobs(listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListImageExportJobsWithContext(context.Background(), listImageExportJobsOptions) +// DeleteImageExportJob : Delete an image export job +// This request deletes an image export job. This operation cannot be reversed. If the job has not completed, the job +// will be canceled, and the incomplete exported image object deleted. If the job has completed, the exported image +// object will not be deleted. +func (vpc *VpcV1) DeleteImageExportJob(deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteImageExportJobWithContext(context.Background(), deleteImageExportJobOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListImageExportJobsWithContext is an alternate form of the ListImageExportJobs method which supports a Context parameter -func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageExportJobsOptions *ListImageExportJobsOptions) (result *ImageExportJobUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listImageExportJobsOptions, "listImageExportJobsOptions cannot be nil") +// DeleteImageExportJobWithContext is an alternate form of the DeleteImageExportJob method which supports a Context parameter +func (vpc *VpcV1) DeleteImageExportJobWithContext(ctx context.Context, deleteImageExportJobOptions *DeleteImageExportJobOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteImageExportJobOptions, "deleteImageExportJobOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listImageExportJobsOptions, "listImageExportJobsOptions") + err = core.ValidateStruct(deleteImageExportJobOptions, "deleteImageExportJobOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "image_id": *listImageExportJobsOptions.ImageID, + "image_id": *deleteImageExportJobOptions.ImageID, + "id": *deleteImageExportJobOptions.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, `/images/{image_id}/export_jobs`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listImageExportJobsOptions.Headers { + for headerName, headerValue := range deleteImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImageExportJobs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImageExportJob") 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 listImageExportJobsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listImageExportJobsOptions.Name)) - } request, err := builder.Build() if err != nil { @@ -4843,56 +4943,56 @@ func (vpc *VpcV1) ListImageExportJobsWithContext(ctx context.Context, listImageE 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_image_export_jobs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_image_export_job", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJobUnpaginatedCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListImages : List images -// This request lists images available in the region. An image provides source data for a volume. Images are either -// system-provided, or created from another source, such as importing from Cloud Object Storage. -func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListImagesWithContext(context.Background(), listImagesOptions) +// GetImageExportJob : Retrieve an image export job +// This request retrieves a single image export job specified by the identifier in the URL. +func (vpc *VpcV1) GetImageExportJob(getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetImageExportJobWithContext(context.Background(), getImageExportJobOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListImagesWithContext is an alternate form of the ListImages method which supports a Context parameter -func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listImagesOptions, "listImagesOptions") +// GetImageExportJobWithContext is an alternate form of the GetImageExportJob method which supports a Context parameter +func (vpc *VpcV1) GetImageExportJobWithContext(ctx context.Context, getImageExportJobOptions *GetImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getImageExportJobOptions, "getImageExportJobOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getImageExportJobOptions, "getImageExportJobOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "image_id": *getImageExportJobOptions.ImageID, + "id": *getImageExportJobOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listImagesOptions.Headers { + for headerName, headerValue := range getImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImageExportJob") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -4900,27 +5000,6 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listImagesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) - } - if listImagesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listImagesOptions.Limit)) - } - if listImagesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listImagesOptions.ResourceGroupID)) - } - if listImagesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) - } - if listImagesOptions.Status != nil { - builder.AddQuery("status", strings.Join(listImagesOptions.Status, ",")) - } - if listImagesOptions.Visibility != nil { - builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) - } - if listImagesOptions.UserDataFormat != nil { - builder.AddQuery("user_data_format", strings.Join(listImagesOptions.UserDataFormat, ",")) - } request, err := builder.Build() if err != nil { @@ -4931,12 +5010,12 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_images", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_image_export_job", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4947,48 +5026,61 @@ func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions * return } -// ListOperatingSystems : List operating systems -// This request lists operating systems in the region. -func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) +// UpdateImageExportJob : Update an image export job +// This request updates an image export job with the information in a provided image export job patch. The image export +// job patch object is structured in the same way as a retrieved image export job and contains only the information to +// be updated. +func (vpc *VpcV1) UpdateImageExportJob(updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateImageExportJobWithContext(context.Background(), updateImageExportJobOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListOperatingSystemsWithContext is an alternate form of the ListOperatingSystems method which supports a Context parameter -func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listOperatingSystemsOptions, "listOperatingSystemsOptions") +// UpdateImageExportJobWithContext is an alternate form of the UpdateImageExportJob method which supports a Context parameter +func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateImageExportJobOptions, "updateImageExportJobOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateImageExportJobOptions, "updateImageExportJobOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "image_id": *updateImageExportJobOptions.ImageID, + "id": *updateImageExportJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listOperatingSystemsOptions.Headers { + for headerName, headerValue := range updateImageExportJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImageExportJob") 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 listOperatingSystemsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) - } - if listOperatingSystemsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listOperatingSystemsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateImageExportJobOptions.ImageExportJobPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -5000,12 +5092,12 @@ func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOpera var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_operating_systems", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_image_export_job", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystemCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5016,60 +5108,49 @@ func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOpera return } -// ObsoleteImage : Obsolete an image -// This request obsoletes an image, resulting in its `status` becoming `obsolete` and -// `obsolescence_at` being set to the current date and time. -// -// The image must: -// - have a `status` of `available` or `deprecated` -// - have `catalog_offering.managed` set to `false` -// - not have `deprecation_at` set in the future -// - not have `obsolescence_at` set -// -// A system-provided image is not allowed to be obsoleted. -func (vpc *VpcV1) ObsoleteImage(obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.ObsoleteImageWithContext(context.Background(), obsoleteImageOptions) +// ListOperatingSystems : List operating systems +// This request lists operating systems in the region. +func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ObsoleteImageWithContext is an alternate form of the ObsoleteImage method which supports a Context parameter -func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOptions *ObsoleteImageOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(obsoleteImageOptions, "obsoleteImageOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(obsoleteImageOptions, "obsoleteImageOptions") +// ListOperatingSystemsWithContext is an alternate form of the ListOperatingSystems method which supports a Context parameter +func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listOperatingSystemsOptions, "listOperatingSystemsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *obsoleteImageOptions.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, `/images/{id}/obsolete`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range obsoleteImageOptions.Headers { + for headerName, headerValue := range listOperatingSystemsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ObsoleteImage") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") 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 listOperatingSystemsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) + } + if listOperatingSystemsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listOperatingSystemsOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -5077,72 +5158,72 @@ func (vpc *VpcV1) ObsoleteImageWithContext(ctx context.Context, obsoleteImageOpt 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, "obsolete_image", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_operating_systems", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystemCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UpdateImage : Update an image -// This request updates an image with the information in a provided image patch. The image patch object is structured in -// the same way as a retrieved image and contains only the information to be updated. A system-provided image is not -// allowed to be updated. An image with a `status` of `deleting` cannot be updated. -func (vpc *VpcV1) UpdateImage(updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateImageWithContext(context.Background(), updateImageOptions) +// GetOperatingSystem : Retrieve an operating system +// This request retrieves a single operating system specified by the name in the URL. +func (vpc *VpcV1) GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateImageWithContext is an alternate form of the UpdateImage method which supports a Context parameter -func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateImageOptions, "updateImageOptions cannot be nil") +// GetOperatingSystemWithContext is an alternate form of the GetOperatingSystem method which supports a Context parameter +func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOperatingSystemOptions, "getOperatingSystemOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateImageOptions, "updateImageOptions") + err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateImageOptions.ID, + "name": *getOperatingSystemOptions.Name, } - 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, `/images/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateImageOptions.Headers { + for headerName, headerValue := range getOperatingSystemOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImage") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetOperatingSystem") 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(updateImageOptions.ImagePatch) - 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()) @@ -5152,12 +5233,12 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_image", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_operating_system", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystem) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5168,61 +5249,49 @@ func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions return } -// UpdateImageExportJob : Update an image export job -// This request updates an image export job with the information in a provided image export job patch. The image export -// job patch object is structured in the same way as a retrieved image export job and contains only the information to -// be updated. -func (vpc *VpcV1) UpdateImageExportJob(updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateImageExportJobWithContext(context.Background(), updateImageExportJobOptions) +// ListKeys : List keys +// This request lists keys in the region. A key contains a public SSH key which may be installed on instances when they +// are created. Private keys are not stored. +func (vpc *VpcV1) ListKeys(listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListKeysWithContext(context.Background(), listKeysOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateImageExportJobWithContext is an alternate form of the UpdateImageExportJob method which supports a Context parameter -func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateImageExportJobOptions *UpdateImageExportJobOptions) (result *ImageExportJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateImageExportJobOptions, "updateImageExportJobOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateImageExportJobOptions, "updateImageExportJobOptions") +// ListKeysWithContext is an alternate form of the ListKeys method which supports a Context parameter +func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listKeysOptions, "listKeysOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "image_id": *updateImageExportJobOptions.ImageID, - "id": *updateImageExportJobOptions.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, `/images/{image_id}/export_jobs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateImageExportJobOptions.Headers { + for headerName, headerValue := range listKeysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImageExportJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListKeys") 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(updateImageExportJobOptions.ImageExportJobPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listKeysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listKeysOptions.Start)) + } + if listKeysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listKeysOptions.Limit)) } request, err := builder.Build() @@ -5234,12 +5303,12 @@ func (vpc *VpcV1) UpdateImageExportJobWithContext(ctx context.Context, updateIma var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_image_export_job", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_keys", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageExportJob) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKeyCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5474,76 +5543,6 @@ func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOp return } -// ListKeys : List keys -// This request lists keys in the region. A key contains a public SSH key which may be installed on instances when they -// are created. Private keys are not stored. -func (vpc *VpcV1) ListKeys(listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListKeysWithContext(context.Background(), listKeysOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListKeysWithContext is an alternate form of the ListKeys method which supports a Context parameter -func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listKeysOptions, "listKeysOptions") - 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, `/keys`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listKeysOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListKeys") - 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 listKeysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listKeysOptions.Start)) - } - if listKeysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listKeysOptions.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_keys", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKeyCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - // UpdateKey : Update a key // This request updates a key's name. func (vpc *VpcV1) UpdateKey(updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { @@ -5623,54 +5622,37 @@ func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *Up return } -// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with an instance network interface -// This request associates the specified floating IP with the specified instance network interface, replacing any -// existing association. -// -// The existing floating IP must: -// - not be required by another resource, such as a public gateway -// - be in the same `zone` as the instance -// -// A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) +// ListInstanceProfiles : List instance profiles +// This request lists provisionable [instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the +// region. An instance profile specifies the performance characteristics and pricing model for an instance. +func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) err = core.RepurposeSDKProblem(err, "") return } -// AddInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the AddInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") +// ListInstanceProfilesWithContext is an alternate form of the ListInstanceProfiles method which supports a Context parameter +func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceProfilesOptions, "listInstanceProfilesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "instance_id": *addInstanceNetworkInterfaceFloatingIPOptions.InstanceID, - "network_interface_id": *addInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *addInstanceNetworkInterfaceFloatingIPOptions.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, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range addInstanceNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listInstanceProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddInstanceNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -5688,12 +5670,12 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "add_instance_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_profiles", 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, UnmarshalInstanceProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5704,58 +5686,53 @@ func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } -// CreateInstance : Create an instance -// This request provisions a new instance from an instance prototype object. The prototype object is structured in the -// same way as a retrieved instance, and contains the information necessary to provision the new instance. The instance -// is automatically started. -func (vpc *VpcV1) CreateInstance(createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) +// GetInstanceProfile : Retrieve an instance profile +// This request retrieves a single instance profile specified by the name in the URL. +func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceWithContext is an alternate form of the CreateInstance method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceOptions, "createInstanceOptions cannot be nil") +// GetInstanceProfileWithContext is an alternate form of the GetInstanceProfile method which supports a Context parameter +func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceProfileOptions, "getInstanceProfileOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceOptions, "createInstanceOptions") + err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "name": *getInstanceProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceOptions.Headers { + for headerName, headerValue := range getInstanceProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstance") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") 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(createInstanceOptions.InstancePrototype) - 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()) @@ -5765,12 +5742,12 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_profile", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5781,68 +5758,44 @@ func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceO return } -// CreateInstanceAction : Create an instance action -// This request creates a new action which will be queued up to run as soon as any pending or running actions have -// completed. -func (vpc *VpcV1) CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) +// ListInstanceTemplates : List instance templates +// This request lists instance templates in the region. +func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceActionWithContext is an alternate form of the CreateInstanceAction method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceActionOptions, "createInstanceActionOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createInstanceActionOptions, "createInstanceActionOptions") +// ListInstanceTemplatesWithContext is an alternate form of the ListInstanceTemplates method which supports a Context parameter +func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceTemplatesOptions, "listInstanceTemplatesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "instance_id": *createInstanceActionOptions.InstanceID, - } - - 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, `/instances/{instance_id}/actions`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceActionOptions.Headers { + for headerName, headerValue := range listInstanceTemplatesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceAction") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") 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 createInstanceActionOptions.Type != nil { - body["type"] = createInstanceActionOptions.Type - } - if createInstanceActionOptions.Force != nil { - body["force"] = createInstanceActionOptions.Force - } - _, 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()) @@ -5852,12 +5805,12 @@ func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createIns var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_action", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_templates", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplateCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5868,48 +5821,45 @@ func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createIns 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 -// request. The access token is only valid for a short period of time, and a maximum of one token is valid for a given -// instance at a time. -func (vpc *VpcV1) CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) +// CreateInstanceTemplate : Create an instance template +// This request creates a new instance template. The prototype object is structured in the same way as a retrieved +// instance template, and contains the information necessary to provision a new instance from the template. +// +// If a `source_template` is specified in the prototype object, its contents are copied into the new template prior to +// copying any other properties provided in the prototype object. +func (vpc *VpcV1) CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceTemplateWithContext(context.Background(), createInstanceTemplateOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceConsoleAccessTokenWithContext is an alternate form of the CreateInstanceConsoleAccessToken method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Context, createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions cannot be nil") +// CreateInstanceTemplateWithContext is an alternate form of the CreateInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceTemplateOptions, "createInstanceTemplateOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") + err = core.ValidateStruct(createInstanceTemplateOptions, "createInstanceTemplateOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "instance_id": *createInstanceConsoleAccessTokenOptions.InstanceID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/console_access_token`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceConsoleAccessTokenOptions.Headers { + for headerName, headerValue := range createInstanceTemplateOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceConsoleAccessToken") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceTemplate") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -5919,14 +5869,7 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - body := make(map[string]interface{}) - if createInstanceConsoleAccessTokenOptions.ConsoleType != nil { - body["console_type"] = createInstanceConsoleAccessTokenOptions.ConsoleType - } - if createInstanceConsoleAccessTokenOptions.Force != nil { - body["force"] = createInstanceConsoleAccessTokenOptions.Force - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(createInstanceTemplateOptions.InstanceTemplatePrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -5941,12 +5884,12 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_console_access_token", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_template", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5957,171 +5900,115 @@ func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Contex return } -// CreateInstanceNetworkAttachment : Create a network attachment on an instance -// This request creates a new instance network attachment from an instance network attachment prototype object. The -// prototype object is structured in the same way as a retrieved instance network attachment, and contains the -// information necessary to create the new instance network attachment. -func (vpc *VpcV1) CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) +// DeleteInstanceTemplate : Delete an instance template +// This request deletes the instance template. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceNetworkAttachmentWithContext is an alternate form of the CreateInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context, createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions cannot be nil") +// DeleteInstanceTemplateWithContext is an alternate form of the DeleteInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *createInstanceNetworkAttachmentOptions.InstanceID, + "id": *deleteInstanceTemplateOptions.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, `/instances/{instance_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceNetworkAttachmentOptions.Headers { + for headerName, headerValue := range deleteInstanceTemplateOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceTemplate") 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 createInstanceNetworkAttachmentOptions.VirtualNetworkInterface != nil { - body["virtual_network_interface"] = createInstanceNetworkAttachmentOptions.VirtualNetworkInterface - } - if createInstanceNetworkAttachmentOptions.Name != nil { - body["name"] = createInstanceNetworkAttachmentOptions.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) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_template", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateInstanceNetworkInterface : Create a network interface on an instance -// This request creates a new instance network interface from an instance network interface prototype object. The -// prototype object is structured in the same way as a retrieved instance network interface, and contains the -// information necessary to create the new instance network interface. Any subnet in the instance's VPC may be -// specified. Addresses on the instance network interface must be within the specified subnet's CIDR blocks. -// -// If this instance 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, and new network interfaces are not allowed to be created. -func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) +// GetInstanceTemplate : Retrieve an instance template +// This request retrieves a single instance template specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceNetworkInterfaceWithContext is an alternate form of the CreateInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions cannot be nil") +// GetInstanceTemplateWithContext is an alternate form of the GetInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceTemplateOptions, "getInstanceTemplateOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") + err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *createInstanceNetworkInterfaceOptions.InstanceID, + "id": *getInstanceTemplateOptions.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, `/instances/{instance_id}/network_interfaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceNetworkInterfaceOptions.Headers { + for headerName, headerValue := range getInstanceTemplateOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") 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 createInstanceNetworkInterfaceOptions.Subnet != nil { - body["subnet"] = createInstanceNetworkInterfaceOptions.Subnet - } - if createInstanceNetworkInterfaceOptions.AllowIPSpoofing != nil { - body["allow_ip_spoofing"] = createInstanceNetworkInterfaceOptions.AllowIPSpoofing - } - if createInstanceNetworkInterfaceOptions.Name != nil { - body["name"] = createInstanceNetworkInterfaceOptions.Name - } - if createInstanceNetworkInterfaceOptions.PrimaryIP != nil { - body["primary_ip"] = createInstanceNetworkInterfaceOptions.PrimaryIP - } - if createInstanceNetworkInterfaceOptions.SecurityGroups != nil { - body["security_groups"] = createInstanceNetworkInterfaceOptions.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()) @@ -6131,12 +6018,12 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_template", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6147,55 +6034,57 @@ func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, return } -// CreateInstanceTemplate : Create an instance template -// This request creates a new instance template. The prototype object is structured in the same way as a retrieved -// instance template, and contains the information necessary to provision a new instance from the template. -// -// If a `source_template` is specified in the prototype object, its contents are copied into the new template prior to -// copying any other properties provided in the prototype object. -func (vpc *VpcV1) CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceTemplateWithContext(context.Background(), createInstanceTemplateOptions) +// UpdateInstanceTemplate : Update an instance template +// This request updates an instance template with the information provided in the instance template patch. The instance +// template patch object is structured in the same way as a retrieved instance template and contains only the +// information to be updated. +func (vpc *VpcV1) UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceTemplateWithContext is an alternate form of the CreateInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceTemplateOptions, "createInstanceTemplateOptions cannot be nil") +// UpdateInstanceTemplateWithContext is an alternate form of the UpdateInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceTemplateOptions, "updateInstanceTemplateOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceTemplateOptions, "createInstanceTemplateOptions") + err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *updateInstanceTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceTemplateOptions.Headers { + for headerName, headerValue := range updateInstanceTemplateOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceTemplate") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceTemplate") 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)) - _, err = builder.SetBodyContentJSON(createInstanceTemplateOptions.InstanceTemplatePrototype) + _, err = builder.SetBodyContentJSON(updateInstanceTemplateOptions.InstanceTemplatePatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -6210,7 +6099,7 @@ func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createI var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_template", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_template", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -6226,69 +6115,165 @@ func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createI return } -// CreateInstanceVolumeAttachment : Create a volume attachment on an instance -// This request creates a new volume attachment from a volume attachment prototype object, connecting a volume to an -// instance. For this request to succeed, the specified volume must not be busy. The prototype object is structured in -// the same way as a retrieved volume attachment, and contains the information necessary to create the new volume -// attachment. -func (vpc *VpcV1) CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) +// ListInstances : List instances +// This request lists instances in the region. +func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceVolumeAttachmentWithContext is an alternate form of the CreateInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") +// ListInstancesWithContext is an alternate form of the ListInstances method which supports a Context parameter +func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstancesOptions, "listInstancesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "instance_id": *createInstanceVolumeAttachmentOptions.InstanceID, - } - - 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, `/instances/{instance_id}/volume_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceVolumeAttachmentOptions.Headers { + for headerName, headerValue := range listInstancesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceVolumeAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") 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 createInstanceVolumeAttachmentOptions.Volume != nil { - body["volume"] = createInstanceVolumeAttachmentOptions.Volume + if listInstancesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) } - if createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete != nil { - body["delete_volume_on_instance_delete"] = createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete + if listInstancesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstancesOptions.Limit)) } - if createInstanceVolumeAttachmentOptions.Name != nil { - body["name"] = createInstanceVolumeAttachmentOptions.Name + if listInstancesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listInstancesOptions.ResourceGroupID)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { + if listInstancesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) + } + if listInstancesOptions.DedicatedHostID != nil { + builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) + } + if listInstancesOptions.DedicatedHostCRN != nil { + builder.AddQuery("dedicated_host.crn", fmt.Sprint(*listInstancesOptions.DedicatedHostCRN)) + } + if listInstancesOptions.DedicatedHostName != nil { + builder.AddQuery("dedicated_host.name", fmt.Sprint(*listInstancesOptions.DedicatedHostName)) + } + if listInstancesOptions.PlacementGroupID != nil { + builder.AddQuery("placement_group.id", fmt.Sprint(*listInstancesOptions.PlacementGroupID)) + } + if listInstancesOptions.PlacementGroupCRN != nil { + builder.AddQuery("placement_group.crn", fmt.Sprint(*listInstancesOptions.PlacementGroupCRN)) + } + if listInstancesOptions.PlacementGroupName != nil { + builder.AddQuery("placement_group.name", fmt.Sprint(*listInstancesOptions.PlacementGroupName)) + } + if listInstancesOptions.ReservationID != nil { + builder.AddQuery("reservation.id", fmt.Sprint(*listInstancesOptions.ReservationID)) + } + if listInstancesOptions.ReservationCRN != nil { + builder.AddQuery("reservation.crn", fmt.Sprint(*listInstancesOptions.ReservationCRN)) + } + if listInstancesOptions.ReservationName != nil { + builder.AddQuery("reservation.name", fmt.Sprint(*listInstancesOptions.ReservationName)) + } + if listInstancesOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) + } + if listInstancesOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) + } + if listInstancesOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) + } + + 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_instances", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// CreateInstance : Create an instance +// This request provisions a new instance from an instance prototype object. The prototype object is structured in the +// same way as a retrieved instance, and contains the information necessary to provision the new instance. The instance +// is automatically started. +func (vpc *VpcV1) CreateInstance(createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// CreateInstanceWithContext is an alternate form of the CreateInstance method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceOptions, "createInstanceOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createInstanceOptions, "createInstanceOptions") + 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, `/instances`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range createInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstance") + 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(createInstanceOptions.InstancePrototype) + if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } @@ -6302,12 +6287,12 @@ func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_volume_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6387,52 +6372,49 @@ func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceO return } -// DeleteInstanceNetworkAttachment : Delete an instance network attachment -// This request deletes an instance network attachment. This operation cannot be reversed. Any floating IPs associated -// with the instance network attachment are implicitly disassociated. All flow log collectors with `auto_delete` set to -// `true` targeting the instance network attachment are automatically deleted. The primary instance network attachment -// is not allowed to be deleted. -func (vpc *VpcV1) DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) +// GetInstance : Retrieve an instance +// This request retrieves a single instance specified by the identifier in the URL. +func (vpc *VpcV1) GetInstance(getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceWithContext(context.Background(), getInstanceOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceNetworkAttachmentWithContext is an alternate form of the DeleteInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context, deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions cannot be nil") +// GetInstanceWithContext is an alternate form of the GetInstance method which supports a Context parameter +func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceOptions, "getInstanceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(getInstanceOptions, "getInstanceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceNetworkAttachmentOptions.InstanceID, - "id": *deleteInstanceNetworkAttachmentOptions.ID, + "id": *getInstanceOptions.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, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { + for headerName, headerValue := range getInstanceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstance") 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)) @@ -6443,128 +6425,152 @@ func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context 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_instance_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteInstanceNetworkInterface : Delete an instance network interface -// This request deletes an instance network interface. This operation cannot be reversed. Any floating IPs associated -// with the instance network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to -// `true` targeting the instance network interface are automatically deleted. The primary instance network interface is -// not allowed to be deleted. -// -// If this instance 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 is not allowed to be deleted. -func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) +// UpdateInstance : Update an instance +// This request updates an instance with the information in a provided instance patch. The instance patch object is +// structured in the same way as a retrieved instance and contains only the information to be updated. +func (vpc *VpcV1) UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") +// UpdateInstanceWithContext is an alternate form of the UpdateInstance method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceOptions, "updateInstanceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") + err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceNetworkInterfaceOptions.InstanceID, - "id": *deleteInstanceNetworkInterfaceOptions.ID, + "id": *updateInstanceOptions.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, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { + for headerName, headerValue := range updateInstanceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateInstanceOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateInstanceOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) + 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_instance_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteInstanceTemplate : Delete an instance template -// This request deletes the instance template. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) +// GetInstanceInitialization : Retrieve initialization configuration for an instance +// This request retrieves configuration used to initialize the instance, such as SSH keys and the Windows administrator +// password. These can subsequently be changed on the instance and therefore may not be current. +func (vpc *VpcV1) GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceTemplateWithContext is an alternate form of the DeleteInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions cannot be nil") +// GetInstanceInitializationWithContext is an alternate form of the GetInstanceInitialization method which supports a Context parameter +func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceInitializationOptions, "getInstanceInitializationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") + err = core.ValidateStruct(getInstanceInitializationOptions, "getInstanceInitializationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteInstanceTemplateOptions.ID, + "id": *getInstanceInitializationOptions.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, `/instance/templates/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}/initialization`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceTemplateOptions.Headers { + for headerName, headerValue := range getInstanceInitializationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceTemplate") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceInitialization") 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)) @@ -6575,127 +6581,176 @@ func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteI 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_instance_template", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_initialization", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceInitialization) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteInstanceVolumeAttachment : Delete a volume attachment -// This request deletes a volume attachment. This operation cannot be reversed, but a new volume attachment may -// subsequently be created for the volume. For this request to succeed, the volume must not be busy. -func (vpc *VpcV1) DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) +// CreateInstanceAction : Create an instance action +// This request creates a new action which will be queued up to run as soon as any pending or running actions have +// completed. +func (vpc *VpcV1) CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceVolumeAttachmentWithContext is an alternate form of the DeleteInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions cannot be nil") +// CreateInstanceActionWithContext is an alternate form of the CreateInstanceAction method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceActionOptions, "createInstanceActionOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") + err = core.ValidateStruct(createInstanceActionOptions, "createInstanceActionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *deleteInstanceVolumeAttachmentOptions.InstanceID, - "id": *deleteInstanceVolumeAttachmentOptions.ID, + "instance_id": *createInstanceActionOptions.InstanceID, } - 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, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/actions`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { + for headerName, headerValue := range createInstanceActionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceAction") 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 createInstanceActionOptions.Type != nil { + body["type"] = createInstanceActionOptions.Type + } + if createInstanceActionOptions.Force != nil { + body["force"] = createInstanceActionOptions.Force + } + _, 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_instance_volume_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_action", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetInstance : Retrieve an instance -// This request retrieves a single instance specified by the identifier in the URL. -func (vpc *VpcV1) GetInstance(getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceWithContext(context.Background(), getInstanceOptions) +// 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 +// request. The access token is only valid for a short period of time, and a maximum of one token is valid for a given +// instance at a time. +func (vpc *VpcV1) CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceWithContext is an alternate form of the GetInstance method which supports a Context parameter -func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceOptions, "getInstanceOptions cannot be nil") +// CreateInstanceConsoleAccessTokenWithContext is an alternate form of the CreateInstanceConsoleAccessToken method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Context, createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceOptions, "getInstanceOptions") + err = core.ValidateStruct(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getInstanceOptions.ID, + "instance_id": *createInstanceConsoleAccessTokenOptions.InstanceID, } - 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, `/instances/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/console_access_token`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceOptions.Headers { + for headerName, headerValue := range createInstanceConsoleAccessTokenOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstance") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceConsoleAccessToken") 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 createInstanceConsoleAccessTokenOptions.ConsoleType != nil { + body["console_type"] = createInstanceConsoleAccessTokenOptions.ConsoleType + } + if createInstanceConsoleAccessTokenOptions.Force != nil { + body["force"] = createInstanceConsoleAccessTokenOptions.Force + } + _, 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()) @@ -6705,12 +6760,12 @@ func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_console_access_token", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6721,46 +6776,47 @@ func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions return } -// GetInstanceDisk : Retrieve an instance disk -// This request retrieves a single instance disk specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) +// ListInstanceDisks : List disks on an instance +// This request lists disks on an instance. A disk is a block device that is locally attached to the instance's +// physical host and is also referred to as instance storage. By default, the listed disks are sorted by their +// `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceDiskWithContext is an alternate form of the GetInstanceDisk method which supports a Context parameter -func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceDiskOptions, "getInstanceDiskOptions cannot be nil") +// ListInstanceDisksWithContext is an alternate form of the ListInstanceDisks method which supports a Context parameter +func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceDisksOptions, "listInstanceDisksOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") + err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceDiskOptions.InstanceID, - "id": *getInstanceDiskOptions.ID, + "instance_id": *listInstanceDisksOptions.InstanceID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceDiskOptions.Headers { + for headerName, headerValue := range listInstanceDisksOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceDisks") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -6778,12 +6834,12 @@ func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDis var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_disk", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_disks", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6794,46 +6850,46 @@ func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDis return } -// GetInstanceInitialization : Retrieve initialization configuration for an instance -// This request retrieves configuration used to initialize the instance, such as SSH keys and the Windows administrator -// password. These can subsequently be changed on the instance and therefore may not be current. -func (vpc *VpcV1) GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) +// GetInstanceDisk : Retrieve an instance disk +// This request retrieves a single instance disk specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceInitializationWithContext is an alternate form of the GetInstanceInitialization method which supports a Context parameter -func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceInitializationOptions, "getInstanceInitializationOptions cannot be nil") +// GetInstanceDiskWithContext is an alternate form of the GetInstanceDisk method which supports a Context parameter +func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceDiskOptions, "getInstanceDiskOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceInitializationOptions, "getInstanceInitializationOptions") + err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getInstanceInitializationOptions.ID, + "instance_id": *getInstanceDiskOptions.InstanceID, + "id": *getInstanceDiskOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}/initialization`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceInitializationOptions.Headers { + for headerName, headerValue := range getInstanceDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceInitialization") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -6851,12 +6907,12 @@ func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getI var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_initialization", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_disk", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceInitialization) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6867,54 +6923,61 @@ func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getI return } -// GetInstanceNetworkAttachment : Retrieve an instance network attachment -// This request retrieves a single instance network attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) +// UpdateInstanceDisk : Update an instance disk +// This request updates the instance disk with the information in a provided patch. +func (vpc *VpcV1) UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceNetworkAttachmentWithContext is an alternate form of the GetInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions cannot be nil") +// UpdateInstanceDiskWithContext is an alternate form of the UpdateInstanceDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceDiskOptions, "updateInstanceDiskOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkAttachmentOptions.InstanceID, - "id": *getInstanceNetworkAttachmentOptions.ID, + "instance_id": *updateInstanceDiskOptions.InstanceID, + "id": *updateInstanceDiskOptions.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, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceNetworkAttachmentOptions.Headers { + for headerName, headerValue := range updateInstanceDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceDisk") 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(updateInstanceDiskOptions.InstanceDiskPatch) + 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()) @@ -6924,12 +6987,12 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_disk", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6940,50 +7003,50 @@ func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, g return } -// GetInstanceNetworkInterface : Retrieve an instance network interface -// This request retrieves a single instance network interface specified by the identifier in the URL. +// ListInstanceNetworkAttachments : List network attachments on an instance +// This request lists network attachments on an instance. A network attachment represents a device on the instance to +// which a virtual network interface is attached. // -// If this instance has network attachments, the retrieved 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. -func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") +// ListInstanceNetworkAttachmentsWithContext is an alternate form of the ListInstanceNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") + err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceOptions.InstanceID, - "id": *getInstanceNetworkInterfaceOptions.ID, + "instance_id": *listInstanceNetworkAttachmentsOptions.InstanceID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceNetworkInterfaceOptions.Headers { + for headerName, headerValue := range listInstanceNetworkAttachmentsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -7001,12 +7064,12 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_network_attachments", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachmentCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7017,56 +7080,69 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, ge return } -// GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP address if it is associated with the instance network interface and -// instance specified in the URL. -func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) +// CreateInstanceNetworkAttachment : Create a network attachment on an instance +// This request creates a new instance network attachment from an instance network attachment prototype object. The +// prototype object is structured in the same way as a retrieved instance network attachment, and contains the +// information necessary to create the new instance network attachment. +func (vpc *VpcV1) CreateInstanceNetworkAttachment(createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceNetworkAttachmentWithContext(context.Background(), createInstanceNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the GetInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions cannot be nil") +// CreateInstanceNetworkAttachmentWithContext is an alternate form of the CreateInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceNetworkAttachmentWithContext(ctx context.Context, createInstanceNetworkAttachmentOptions *CreateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(createInstanceNetworkAttachmentOptions, "createInstanceNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceFloatingIPOptions.InstanceID, - "network_interface_id": *getInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *getInstanceNetworkInterfaceFloatingIPOptions.ID, + "instance_id": *createInstanceNetworkAttachmentOptions.InstanceID, } - 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, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range createInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkAttachment") 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 createInstanceNetworkAttachmentOptions.VirtualNetworkInterface != nil { + body["virtual_network_interface"] = createInstanceNetworkAttachmentOptions.VirtualNetworkInterface + } + if createInstanceNetworkAttachmentOptions.Name != nil { + body["name"] = createInstanceNetworkAttachmentOptions.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()) @@ -7076,12 +7152,12 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_network_attachment", 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, UnmarshalInstanceNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7092,54 +7168,52 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.C return } -// GetInstanceNetworkInterfaceIP : Retrieve the primary reserved IP -// This request retrieves the primary reserved IP for an instance network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) +// DeleteInstanceNetworkAttachment : Delete an instance network attachment +// This request deletes an instance network attachment. This operation cannot be reversed. Any floating IPs associated +// with the instance network attachment are implicitly disassociated. All flow log collectors with `auto_delete` set to +// `true` targeting the instance network attachment are automatically deleted. The primary instance network attachment +// is not allowed to be deleted. +func (vpc *VpcV1) DeleteInstanceNetworkAttachment(deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceNetworkAttachmentWithContext(context.Background(), deleteInstanceNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceIP") - err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") +// DeleteInstanceNetworkAttachmentWithContext is an alternate form of the DeleteInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceNetworkAttachmentWithContext(ctx context.Context, deleteInstanceNetworkAttachmentOptions *DeleteInstanceNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions") + err = core.ValidateStruct(deleteInstanceNetworkAttachmentOptions, "deleteInstanceNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceNetworkInterfaceIPOptions.InstanceID, - "network_interface_id": *getInstanceNetworkInterfaceIPOptions.NetworkInterfaceID, - "id": *getInstanceNetworkInterfaceIPOptions.ID, + "instance_id": *deleteInstanceNetworkAttachmentOptions.InstanceID, + "id": *deleteInstanceNetworkAttachmentOptions.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, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceNetworkInterfaceIPOptions.Headers { + for headerName, headerValue := range deleteInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkAttachment") 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)) @@ -7150,64 +7224,56 @@ func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, 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_instance_network_interface_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetInstanceProfile : Retrieve an instance profile -// This request retrieves a single instance profile specified by the name in the URL. -func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) +// GetInstanceNetworkAttachment : Retrieve an instance network attachment +// This request retrieves a single instance network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceNetworkAttachment(getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceNetworkAttachmentWithContext(context.Background(), getInstanceNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceProfileWithContext is an alternate form of the GetInstanceProfile method which supports a Context parameter -func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceProfileOptions, "getInstanceProfileOptions cannot be nil") +// GetInstanceNetworkAttachmentWithContext is an alternate form of the GetInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkAttachmentWithContext(ctx context.Context, getInstanceNetworkAttachmentOptions *GetInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") + err = core.ValidateStruct(getInstanceNetworkAttachmentOptions, "getInstanceNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getInstanceProfileOptions.Name, + "instance_id": *getInstanceNetworkAttachmentOptions.InstanceID, + "id": *getInstanceNetworkAttachmentOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceProfileOptions.Headers { + for headerName, headerValue := range getInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -7225,12 +7291,12 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_profile", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7241,53 +7307,63 @@ func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstance return } -// GetInstanceTemplate : Retrieve an instance template -// This request retrieves a single instance template specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) +// UpdateInstanceNetworkAttachment : Update an instance network attachment +// This request updates an instance network attachment with the information provided in an instance network interface +// patch object. The instance network attachment patch object is structured in the same way as a retrieved instance +// network attachment and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceTemplateWithContext is an alternate form of the GetInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceTemplateOptions, "getInstanceTemplateOptions cannot be nil") +// UpdateInstanceNetworkAttachmentWithContext is an alternate form of the UpdateInstanceNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context, updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") + err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getInstanceTemplateOptions.ID, + "instance_id": *updateInstanceNetworkAttachmentOptions.InstanceID, + "id": *updateInstanceNetworkAttachmentOptions.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, `/instance/templates/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceTemplateOptions.Headers { + for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkAttachment") 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(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) + 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()) @@ -7297,12 +7373,12 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_template", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7313,46 +7389,52 @@ func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanc return } -// GetInstanceVolumeAttachment : Retrieve a volume attachment -// This request retrieves a single volume attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) +// ListInstanceNetworkInterfaces : List network interfaces on an instance +// This request lists network interfaces on an instance. An instance network interface is an abstract representation of +// a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to any +// subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on the +// instance may also attach to the same subnet. +// +// If this instance has network attachments, each returned 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. +func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceVolumeAttachmentWithContext is an alternate form of the GetInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions cannot be nil") +// ListInstanceNetworkInterfacesWithContext is an alternate form of the ListInstanceNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") + err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *getInstanceVolumeAttachmentOptions.InstanceID, - "id": *getInstanceVolumeAttachmentOptions.ID, + "instance_id": *listInstanceNetworkInterfacesOptions.InstanceID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceVolumeAttachmentOptions.Headers { + for headerName, headerValue := range listInstanceNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -7370,12 +7452,12 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_volume_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_network_interfaces", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceUnpaginatedCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7386,55 +7468,83 @@ func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, ge return } -// ListInstanceDisks : List disks on an instance -// This request lists disks on an instance. A disk is a block device that is locally attached to the instance's -// physical host and is also referred to as instance storage. By default, the listed disks are sorted by their -// `created_at` property values, with the newest disk first. -func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) +// CreateInstanceNetworkInterface : Create a network interface on an instance +// This request creates a new instance network interface from an instance network interface prototype object. The +// prototype object is structured in the same way as a retrieved instance network interface, and contains the +// information necessary to create the new instance network interface. Any subnet in the instance's VPC may be +// specified. Addresses on the instance network interface must be within the specified subnet's CIDR blocks. +// +// If this instance 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, and new network interfaces are not allowed to be created. +func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceDisksWithContext is an alternate form of the ListInstanceDisks method which supports a Context parameter -func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceDisksOptions, "listInstanceDisksOptions cannot be nil") +// CreateInstanceNetworkInterfaceWithContext is an alternate form of the CreateInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") + err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceDisksOptions.InstanceID, + "instance_id": *createInstanceNetworkInterfaceOptions.InstanceID, } - 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, `/instances/{instance_id}/disks`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceDisksOptions.Headers { + for headerName, headerValue := range createInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceDisks") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkInterface") 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 createInstanceNetworkInterfaceOptions.Subnet != nil { + body["subnet"] = createInstanceNetworkInterfaceOptions.Subnet + } + if createInstanceNetworkInterfaceOptions.AllowIPSpoofing != nil { + body["allow_ip_spoofing"] = createInstanceNetworkInterfaceOptions.AllowIPSpoofing + } + if createInstanceNetworkInterfaceOptions.Name != nil { + body["name"] = createInstanceNetworkInterfaceOptions.Name + } + if createInstanceNetworkInterfaceOptions.PrimaryIP != nil { + body["primary_ip"] = createInstanceNetworkInterfaceOptions.PrimaryIP + } + if createInstanceNetworkInterfaceOptions.SecurityGroups != nil { + body["security_groups"] = createInstanceNetworkInterfaceOptions.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()) @@ -7444,12 +7554,12 @@ func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstance var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_disks", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7460,54 +7570,56 @@ func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstance return } -// ListInstanceNetworkAttachments : List network attachments on an instance -// This request lists network attachments on an instance. A network attachment represents a device on the instance to -// which a virtual network interface is attached. +// DeleteInstanceNetworkInterface : Delete an instance network interface +// This request deletes an instance network interface. This operation cannot be reversed. Any floating IPs associated +// with the instance network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to +// `true` targeting the instance network interface are automatically deleted. The primary instance network interface is +// not allowed to be deleted. // -// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. -// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property -// values. -func (vpc *VpcV1) ListInstanceNetworkAttachments(listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceNetworkAttachmentsWithContext(context.Background(), listInstanceNetworkAttachmentsOptions) +// If this instance 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 is not allowed to be deleted. +func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceNetworkAttachmentsWithContext is an alternate form of the ListInstanceNetworkAttachments method which supports a Context parameter -func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, listInstanceNetworkAttachmentsOptions *ListInstanceNetworkAttachmentsOptions) (result *InstanceNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions cannot be nil") +// DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceNetworkAttachmentsOptions, "listInstanceNetworkAttachmentsOptions") + err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkAttachmentsOptions.InstanceID, + "instance_id": *deleteInstanceNetworkInterfaceOptions.InstanceID, + "id": *deleteInstanceNetworkInterfaceOptions.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, `/instances/{instance_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceNetworkAttachmentsOptions.Headers { + for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkAttachments") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") 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)) @@ -7518,65 +7630,60 @@ func (vpc *VpcV1) ListInstanceNetworkAttachmentsWithContext(ctx context.Context, 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_instance_network_attachments", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachmentCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListInstanceNetworkInterfaceFloatingIps : List floating IPs associated with an instance network interface -// This request lists floating IPs associated with an instance network interface. -func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) +// GetInstanceNetworkInterface : Retrieve an instance network interface +// This request retrieves a single instance network interface specified by the identifier in the URL. +// +// If this instance has network attachments, the retrieved 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. +func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") +// GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") + err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfaceFloatingIpsOptions.InstanceID, - "network_interface_id": *listInstanceNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, + "instance_id": *getInstanceNetworkInterfaceOptions.InstanceID, + "id": *getInstanceNetworkInterfaceOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceNetworkInterfaceFloatingIpsOptions.Headers { + for headerName, headerValue := range getInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -7594,12 +7701,12 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_network_interface_floating_ips", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7610,61 +7717,65 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context return } -// ListInstanceNetworkInterfaceIps : List the primary reserved IP for an instance network interface -// This request lists the primary reserved IP for an instance network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) +// UpdateInstanceNetworkInterface : Update an instance network interface +// This request updates an instance network interface with the information provided in an instance network interface +// patch object. The instance network interface patch object is structured in the same way as a retrieved instance +// network interface and needs to contain only the information to be updated. +// +// If this instance 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 is not allowed to be updated. +func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceIps") - err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") +// UpdateInstanceNetworkInterfaceWithContext is an alternate form of the UpdateInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") + err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfaceIpsOptions.InstanceID, - "network_interface_id": *listInstanceNetworkInterfaceIpsOptions.NetworkInterfaceID, + "instance_id": *updateInstanceNetworkInterfaceOptions.InstanceID, + "id": *updateInstanceNetworkInterfaceOptions.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, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceNetworkInterfaceIpsOptions.Headers { + for headerName, headerValue := range updateInstanceNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkInterface") 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 listInstanceNetworkInterfaceIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Start)) - } - if listInstanceNetworkInterfaceIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -7676,12 +7787,12 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_network_interface_ips", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7692,52 +7803,46 @@ func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context return } -// ListInstanceNetworkInterfaces : List network interfaces on an instance -// This request lists network interfaces on an instance. An instance network interface is an abstract representation of -// a network device and attaches an instance to a single subnet. Each network interface on an instance can attach to any -// subnet in the zone, including subnets that are already attached to the instance. Multiple network interfaces on the -// instance may also attach to the same subnet. -// -// If this instance has network attachments, each returned 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. -func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) +// ListInstanceNetworkInterfaceFloatingIps : List floating IPs associated with an instance network interface +// This request lists floating IPs associated with an instance network interface. +func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceNetworkInterfacesWithContext is an alternate form of the ListInstanceNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions cannot be nil") +// ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") + err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceNetworkInterfacesOptions.InstanceID, + "instance_id": *listInstanceNetworkInterfaceFloatingIpsOptions.InstanceID, + "network_interface_id": *listInstanceNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceNetworkInterfacesOptions.Headers { + for headerName, headerValue := range listInstanceNetworkInterfaceFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -7755,12 +7860,12 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_network_interfaces", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_network_interface_floating_ips", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceUnpaginatedCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7771,41 +7876,50 @@ func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, return } -// ListInstanceProfiles : List instance profiles -// This request lists provisionable [instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) in the -// region. An instance profile specifies the performance characteristics and pricing model for an instance. -func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) +// RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from an instance network interface +// This request disassociates the specified floating IP from the specified instance network interface. +func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceProfilesWithContext is an alternate form of the ListInstanceProfiles method which supports a Context parameter -func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstanceProfilesOptions, "listInstanceProfilesOptions") +// RemoveInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "instance_id": *removeInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *removeInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *removeInstanceNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceProfilesOptions.Headers { + for headerName, headerValue := range removeInstanceNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveInstanceNetworkInterfaceFloatingIP") 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)) @@ -7816,55 +7930,58 @@ func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInsta 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_instance_profiles", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "remove_instance_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfileCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListInstanceTemplates : List instance templates -// This request lists instance templates in the region. -func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) +// GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP address if it is associated with the instance network interface and +// instance specified in the URL. +func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceTemplatesWithContext is an alternate form of the ListInstanceTemplates method which supports a Context parameter -func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstanceTemplatesOptions, "listInstanceTemplatesOptions") +// GetInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the GetInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *getInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getInstanceNetworkInterfaceFloatingIPOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceTemplatesOptions.Headers { + for headerName, headerValue := range getInstanceNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -7882,12 +7999,12 @@ func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInst var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_templates", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplateCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7898,47 +8015,54 @@ func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInst return } -// ListInstanceVolumeAttachments : List volumes attachments on an instance -// This request lists volume attachments on an instance. A volume attachment connects a volume to an instance. Each -// instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one -// volume. -func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) +// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with an instance network interface +// This request associates the specified floating IP with the specified instance network interface, replacing any +// existing association. +// +// The existing floating IP must: +// - not be required by another resource, such as a public gateway +// - be in the same `zone` as the instance +// +// A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceVolumeAttachmentsWithContext is an alternate form of the ListInstanceVolumeAttachments method which supports a Context parameter -func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions cannot be nil") +// AddInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the AddInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") + err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *listInstanceVolumeAttachmentsOptions.InstanceID, + "instance_id": *addInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *addInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addInstanceNetworkInterfaceFloatingIPOptions.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, `/instances/{instance_id}/volume_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { + for headerName, headerValue := range addInstanceNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddInstanceNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -7956,12 +8080,12 @@ func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_volume_attachments", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_instance_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachmentCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7972,36 +8096,49 @@ func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, return } -// ListInstances : List instances -// This request lists instances in the region. -func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) +// ListInstanceNetworkInterfaceIps : List the primary reserved IP for an instance network interface +// This request lists the primary reserved IP for an instance network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListInstanceNetworkInterfaceIps(listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceNetworkInterfaceIpsWithContext(context.Background(), listInstanceNetworkInterfaceIpsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstancesWithContext is an alternate form of the ListInstances method which supports a Context parameter -func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstancesOptions, "listInstancesOptions") +// ListInstanceNetworkInterfaceIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceIps method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) ListInstanceNetworkInterfaceIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceIpsOptions *ListInstanceNetworkInterfaceIpsOptions) (result *ReservedIPCollectionInstanceNetworkInterfaceContext, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: ListInstanceNetworkInterfaceIps") + err = core.ValidateNotNil(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listInstanceNetworkInterfaceIpsOptions, "listInstanceNetworkInterfaceIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkInterfaceIpsOptions.InstanceID, + "network_interface_id": *listInstanceNetworkInterfaceIpsOptions.NetworkInterfaceID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstancesOptions.Headers { + for headerName, headerValue := range listInstanceNetworkInterfaceIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -8009,53 +8146,11 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listInstancesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) - } - if listInstancesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstancesOptions.Limit)) - } - if listInstancesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listInstancesOptions.ResourceGroupID)) - } - if listInstancesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) - } - if listInstancesOptions.DedicatedHostID != nil { - builder.AddQuery("dedicated_host.id", fmt.Sprint(*listInstancesOptions.DedicatedHostID)) - } - if listInstancesOptions.DedicatedHostCRN != nil { - builder.AddQuery("dedicated_host.crn", fmt.Sprint(*listInstancesOptions.DedicatedHostCRN)) - } - if listInstancesOptions.DedicatedHostName != nil { - builder.AddQuery("dedicated_host.name", fmt.Sprint(*listInstancesOptions.DedicatedHostName)) - } - if listInstancesOptions.PlacementGroupID != nil { - builder.AddQuery("placement_group.id", fmt.Sprint(*listInstancesOptions.PlacementGroupID)) - } - if listInstancesOptions.PlacementGroupCRN != nil { - builder.AddQuery("placement_group.crn", fmt.Sprint(*listInstancesOptions.PlacementGroupCRN)) - } - if listInstancesOptions.PlacementGroupName != nil { - builder.AddQuery("placement_group.name", fmt.Sprint(*listInstancesOptions.PlacementGroupName)) - } - if listInstancesOptions.ReservationID != nil { - builder.AddQuery("reservation.id", fmt.Sprint(*listInstancesOptions.ReservationID)) - } - if listInstancesOptions.ReservationCRN != nil { - builder.AddQuery("reservation.crn", fmt.Sprint(*listInstancesOptions.ReservationCRN)) - } - if listInstancesOptions.ReservationName != nil { - builder.AddQuery("reservation.name", fmt.Sprint(*listInstancesOptions.ReservationName)) - } - if listInstancesOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) - } - if listInstancesOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) + if listInstanceNetworkInterfaceIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Start)) } - if listInstancesOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) + if listInstanceNetworkInterfaceIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceNetworkInterfaceIpsOptions.Limit)) } request, err := builder.Build() @@ -8067,12 +8162,12 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instances", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_network_interface_ips", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionInstanceNetworkInterfaceContext) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8083,50 +8178,54 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt return } -// RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from an instance network interface -// This request disassociates the specified floating IP from the specified instance network interface. -func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) +// GetInstanceNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for an instance network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetInstanceNetworkInterfaceIP(getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceNetworkInterfaceIPWithContext(context.Background(), getInstanceNetworkInterfaceIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// RemoveInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveInstanceNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions cannot be nil") +// GetInstanceNetworkInterfaceIPWithContext is an alternate form of the GetInstanceNetworkInterfaceIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetInstanceNetworkInterfaceIPWithContext(ctx context.Context, getInstanceNetworkInterfaceIPOptions *GetInstanceNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetInstanceNetworkInterfaceIP") + err = core.ValidateNotNil(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(getInstanceNetworkInterfaceIPOptions, "getInstanceNetworkInterfaceIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *removeInstanceNetworkInterfaceFloatingIPOptions.InstanceID, - "network_interface_id": *removeInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *removeInstanceNetworkInterfaceFloatingIPOptions.ID, + "instance_id": *getInstanceNetworkInterfaceIPOptions.InstanceID, + "network_interface_id": *getInstanceNetworkInterfaceIPOptions.NetworkInterfaceID, + "id": *getInstanceNetworkInterfaceIPOptions.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, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range removeInstanceNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range getInstanceNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveInstanceNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceIP") 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)) @@ -8137,74 +8236,74 @@ func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx contex 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_instance_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_network_interface_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UpdateInstance : Update an instance -// This request updates an instance with the information in a provided instance patch. The instance patch object is -// structured in the same way as a retrieved instance and contains only the information to be updated. -func (vpc *VpcV1) UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) +// ListInstanceVolumeAttachments : List volumes attachments on an instance +// This request lists volume attachments on an instance. A volume attachment connects a volume to an instance. Each +// instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one +// volume. +func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceWithContext is an alternate form of the UpdateInstance method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceOptions, "updateInstanceOptions cannot be nil") +// ListInstanceVolumeAttachmentsWithContext is an alternate form of the ListInstanceVolumeAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") + err = core.ValidateStruct(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateInstanceOptions.ID, + "instance_id": *listInstanceVolumeAttachmentsOptions.InstanceID, } - 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, `/instances/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceOptions.Headers { + for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateInstanceOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateInstanceOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) - 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()) @@ -8214,12 +8313,12 @@ func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_volume_attachments", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachmentCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8230,56 +8329,68 @@ func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceO return } -// UpdateInstanceDisk : Update an instance disk -// This request updates the instance disk with the information in a provided patch. -func (vpc *VpcV1) UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) +// CreateInstanceVolumeAttachment : Create a volume attachment on an instance +// This request creates a new volume attachment from a volume attachment prototype object, connecting a volume to an +// instance. For this request to succeed, the specified volume must not be busy. The prototype object is structured in +// the same way as a retrieved volume attachment, and contains the information necessary to create the new volume +// attachment. +func (vpc *VpcV1) CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceDiskWithContext is an alternate form of the UpdateInstanceDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceDiskOptions, "updateInstanceDiskOptions cannot be nil") +// CreateInstanceVolumeAttachmentWithContext is an alternate form of the CreateInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") + err = core.ValidateStruct(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *updateInstanceDiskOptions.InstanceID, - "id": *updateInstanceDiskOptions.ID, + "instance_id": *createInstanceVolumeAttachmentOptions.InstanceID, } - 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, `/instances/{instance_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceDiskOptions.Headers { + for headerName, headerValue := range createInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceVolumeAttachment") 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(updateInstanceDiskOptions.InstanceDiskPatch) + body := make(map[string]interface{}) + if createInstanceVolumeAttachmentOptions.Volume != nil { + body["volume"] = createInstanceVolumeAttachmentOptions.Volume + } + if createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete != nil { + body["delete_volume_on_instance_delete"] = createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete + } + if createInstanceVolumeAttachmentOptions.Name != nil { + body["name"] = createInstanceVolumeAttachmentOptions.Name + } + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -8294,12 +8405,12 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_disk", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_volume_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8310,149 +8421,118 @@ func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInsta return } -// UpdateInstanceNetworkAttachment : Update an instance network attachment -// This request updates an instance network attachment with the information provided in an instance network interface -// patch object. The instance network attachment patch object is structured in the same way as a retrieved instance -// network attachment and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateInstanceNetworkAttachment(updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceNetworkAttachmentWithContext(context.Background(), updateInstanceNetworkAttachmentOptions) +// DeleteInstanceVolumeAttachment : Delete a volume attachment +// This request deletes a volume attachment. This operation cannot be reversed, but a new volume attachment may +// subsequently be created for the volume. For this request to succeed, the volume must not be busy. +func (vpc *VpcV1) DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceNetworkAttachmentWithContext is an alternate form of the UpdateInstanceNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceNetworkAttachmentWithContext(ctx context.Context, updateInstanceNetworkAttachmentOptions *UpdateInstanceNetworkAttachmentOptions) (result *InstanceNetworkAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions cannot be nil") +// DeleteInstanceVolumeAttachmentWithContext is an alternate form of the DeleteInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceNetworkAttachmentOptions, "updateInstanceNetworkAttachmentOptions") + err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *updateInstanceNetworkAttachmentOptions.InstanceID, - "id": *updateInstanceNetworkAttachmentOptions.ID, + "instance_id": *deleteInstanceVolumeAttachmentOptions.InstanceID, + "id": *deleteInstanceVolumeAttachmentOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceNetworkAttachmentOptions.Headers { + for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") 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(updateInstanceNetworkAttachmentOptions.InstanceNetworkAttachmentPatch) - 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_instance_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_volume_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceNetworkAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// UpdateInstanceNetworkInterface : Update an instance network interface -// This request updates an instance network interface with the information provided in an instance network interface -// patch object. The instance network interface patch object is structured in the same way as a retrieved instance -// network interface and needs to contain only the information to be updated. -// -// If this instance 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 is not allowed to be updated. -func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) +// GetInstanceVolumeAttachment : Retrieve a volume attachment +// This request retrieves a single volume attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceNetworkInterfaceWithContext is an alternate form of the UpdateInstanceNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions cannot be nil") +// GetInstanceVolumeAttachmentWithContext is an alternate form of the GetInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") + err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_id": *updateInstanceNetworkInterfaceOptions.InstanceID, - "id": *updateInstanceNetworkInterfaceOptions.ID, + "instance_id": *getInstanceVolumeAttachmentOptions.InstanceID, + "id": *getInstanceVolumeAttachmentOptions.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, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceNetworkInterfaceOptions.Headers { + for headerName, headerValue := range getInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") 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(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) - 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()) @@ -8462,12 +8542,12 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_volume_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8478,47 +8558,48 @@ func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, return } -// UpdateInstanceTemplate : Update an instance template -// This request updates an instance template with the information provided in the instance template patch. The instance -// template patch object is structured in the same way as a retrieved instance template and contains only the -// information to be updated. -func (vpc *VpcV1) UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) +// UpdateInstanceVolumeAttachment : Update a volume attachment +// This request updates a volume attachment with the information provided in a volume attachment patch object. The +// volume attachment patch object is structured in the same way as a retrieved volume attachment and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceTemplateWithContext is an alternate form of the UpdateInstanceTemplate method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceTemplateOptions, "updateInstanceTemplateOptions cannot be nil") +// UpdateInstanceVolumeAttachmentWithContext is an alternate form of the UpdateInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") + err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateInstanceTemplateOptions.ID, + "instance_id": *updateInstanceVolumeAttachmentOptions.InstanceID, + "id": *updateInstanceVolumeAttachmentOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceTemplateOptions.Headers { + for headerName, headerValue := range updateInstanceVolumeAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceTemplate") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceVolumeAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -8528,7 +8609,7 @@ func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateI builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateInstanceTemplateOptions.InstanceTemplatePatch) + _, err = builder.SetBodyContentJSON(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -8543,12 +8624,12 @@ func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateI var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_template", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_volume_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8559,61 +8640,48 @@ func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateI return } -// UpdateInstanceVolumeAttachment : Update a volume attachment -// This request updates a volume attachment with the information provided in a volume attachment patch object. The -// volume attachment patch object is structured in the same way as a retrieved volume attachment and needs to contain -// only the information to be updated. -func (vpc *VpcV1) UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) +// ListInstanceGroups : List instance groups +// This request lists instance groups in the region. +func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceVolumeAttachmentWithContext is an alternate form of the UpdateInstanceVolumeAttachment method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") +// ListInstanceGroupsWithContext is an alternate form of the ListInstanceGroups method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceGroupsOptions, "listInstanceGroupsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "instance_id": *updateInstanceVolumeAttachmentOptions.InstanceID, - "id": *updateInstanceVolumeAttachmentOptions.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, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceVolumeAttachmentOptions.Headers { + for headerName, headerValue := range listInstanceGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceVolumeAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") 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(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listInstanceGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) + } + if listInstanceGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupsOptions.Limit)) } request, err := builder.Build() @@ -8625,12 +8693,12 @@ func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_volume_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_groups", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8741,140 +8809,116 @@ func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInst return } -// CreateInstanceGroupManager : Create a manager for an instance group -// This request creates a new instance group manager. -func (vpc *VpcV1) CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) +// DeleteInstanceGroup : Delete an instance group +// This request deletes an instance group. This operation cannot be reversed. Any instances associated with the group +// will be deleted. +func (vpc *VpcV1) DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceGroupWithContext(context.Background(), deleteInstanceGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceGroupManagerWithContext is an alternate form of the CreateInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions cannot be nil") +// DeleteInstanceGroupWithContext is an alternate form of the DeleteInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupOptions, "deleteInstanceGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") + err = core.ValidateStruct(deleteInstanceGroupOptions, "deleteInstanceGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerOptions.InstanceGroupID, + "id": *deleteInstanceGroupOptions.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, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceGroupManagerOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManager") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroup") 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(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) - 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_instance_group_manager", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateInstanceGroupManagerAction : Create an instance group manager action -// This request creates a new instance group manager action. -func (vpc *VpcV1) CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) +// GetInstanceGroup : Retrieve an instance group +// This request retrieves a single instance group specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceGroupManagerActionWithContext is an alternate form of the CreateInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Context, createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions cannot be nil") +// GetInstanceGroupWithContext is an alternate form of the GetInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupOptions, "getInstanceGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions") + err = core.ValidateStruct(getInstanceGroupOptions, "getInstanceGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *createInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *getInstanceGroupOptions.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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceGroupManagerActionOptions.Headers { + for headerName, headerValue := range getInstanceGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerAction") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") 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(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) - 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()) @@ -8884,12 +8928,12 @@ func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_group_manager_action", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8900,56 +8944,56 @@ func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Contex return } -// CreateInstanceGroupManagerPolicy : Create a policy for an instance group manager -// This request creates a new instance group manager policy. -func (vpc *VpcV1) CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) +// UpdateInstanceGroup : Update an instance group +// This request updates an instance group with the information provided instance group patch. The instance group patch +// object is structured in the same way as a retrieved instance group and contains only the information to be updated. +func (vpc *VpcV1) UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateInstanceGroupManagerPolicyWithContext is an alternate form of the CreateInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Context, createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions cannot be nil") +// UpdateInstanceGroupWithContext is an alternate form of the UpdateInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupOptions, "updateInstanceGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") + err = core.ValidateStruct(updateInstanceGroupOptions, "updateInstanceGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *updateInstanceGroupOptions.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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createInstanceGroupManagerPolicyOptions.Headers { + for headerName, headerValue := range updateInstanceGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") 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)) - _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) + _, err = builder.SetBodyContentJSON(updateInstanceGroupOptions.InstanceGroupPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -8964,12 +9008,12 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_instance_group_manager_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8980,46 +9024,45 @@ func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Contex return } -// DeleteInstanceGroup : Delete an instance group -// This request deletes an instance group. This operation cannot be reversed. Any instances associated with the group -// will be deleted. -func (vpc *VpcV1) DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupWithContext(context.Background(), deleteInstanceGroupOptions) +// DeleteInstanceGroupLoadBalancer : Delete an instance group load balancer +// This request unbinds the instance group from the load balancer pool, and deletes the load balancer pool members. +func (vpc *VpcV1) DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceGroupWithContext is an alternate form of the DeleteInstanceGroup method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupOptions, "deleteInstanceGroupOptions cannot be nil") +// DeleteInstanceGroupLoadBalancerWithContext is an alternate form of the DeleteInstanceGroupLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context, deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupOptions, "deleteInstanceGroupOptions") + err = core.ValidateStruct(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteInstanceGroupOptions.ID, + "instance_group_id": *deleteInstanceGroupLoadBalancerOptions.InstanceGroupID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/load_balancer`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -9035,7 +9078,7 @@ func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInst response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_instance_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group_load_balancer", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -9043,51 +9086,58 @@ func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInst return } -// DeleteInstanceGroupLoadBalancer : Delete an instance group load balancer -// This request unbinds the instance group from the load balancer pool, and deletes the load balancer pool members. -func (vpc *VpcV1) DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) +// ListInstanceGroupManagers : List managers for an instance group +// This request lists managers for an instance group. +func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceGroupLoadBalancerWithContext is an alternate form of the DeleteInstanceGroupLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context, deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions cannot be nil") +// ListInstanceGroupManagersWithContext is an alternate form of the ListInstanceGroupManagers method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") + err = core.ValidateStruct(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupLoadBalancerOptions.InstanceGroupID, + "instance_group_id": *listInstanceGroupManagersOptions.InstanceGroupID, } - 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, `/instance_groups/{instance_group_id}/load_balancer`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupLoadBalancerOptions.Headers { + for headerName, headerValue := range listInstanceGroupManagersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") 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 listInstanceGroupManagersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) + } + if listInstanceGroupManagersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagersOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -9095,120 +9145,144 @@ func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context 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_instance_group_load_balancer", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_group_managers", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteInstanceGroupManager : Delete an instance group manager -// This request deletes an instance group manager. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) +// CreateInstanceGroupManager : Create a manager for an instance group +// This request creates a new instance group manager. +func (vpc *VpcV1) CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceGroupManagerWithContext is an alternate form of the DeleteInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions cannot be nil") +// CreateInstanceGroupManagerWithContext is an alternate form of the CreateInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") + err = core.ValidateStruct(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerOptions.InstanceGroupID, - "id": *deleteInstanceGroupManagerOptions.ID, + "instance_group_id": *createInstanceGroupManagerOptions.InstanceGroupID, } - 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, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupManagerOptions.Headers { + for headerName, headerValue := range createInstanceGroupManagerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManager") 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(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) + 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_instance_group_manager", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_group_manager", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteInstanceGroupManagerAction : Delete specified instance group manager action -// This request deletes an instance group manager action. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) +// DeleteInstanceGroupManager : Delete an instance group manager +// This request deletes an instance group manager. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceGroupManagerActionWithContext is an alternate form of the DeleteInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Context, deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions cannot be nil") +// DeleteInstanceGroupManagerWithContext is an alternate form of the DeleteInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions") + err = core.ValidateStruct(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *deleteInstanceGroupManagerActionOptions.ID, + "instance_group_id": *deleteInstanceGroupManagerOptions.InstanceGroupID, + "id": *deleteInstanceGroupManagerOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupManagerActionOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupManagerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerAction") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -9224,7 +9298,7 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Contex response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_instance_group_manager_action", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group_manager", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -9232,50 +9306,50 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Contex return } -// DeleteInstanceGroupManagerPolicy : Delete an instance group manager policy -// This request deletes an instance group manager policy. This operation cannot be reversed. -func (vpc *VpcV1) DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) +// GetInstanceGroupManager : Retrieve an instance group manager +// This request retrieves a single instance group manager specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceGroupManagerPolicyWithContext is an alternate form of the DeleteInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Context, deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions cannot be nil") +// GetInstanceGroupManagerWithContext is an alternate form of the GetInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") + err = core.ValidateStruct(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *deleteInstanceGroupManagerPolicyOptions.ID, + "instance_group_id": *getInstanceGroupManagerOptions.InstanceGroupID, + "id": *getInstanceGroupManagerOptions.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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupManagerPolicyOptions.Headers { + for headerName, headerValue := range getInstanceGroupManagerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") 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)) @@ -9286,126 +9360,158 @@ func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Contex 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_instance_group_manager_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_group_manager", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteInstanceGroupMembership : Delete an instance group membership -// This request deletes a memberships of an instance group. This operation cannot be reversed. reversed. If the -// membership has `delete_instance_on_membership_delete` set to `true`, the instance will also be deleted. -func (vpc *VpcV1) DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) +// UpdateInstanceGroupManager : Update an instance group manager +// This request updates an instance group manager with the information provided instance group manager patch. +func (vpc *VpcV1) UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceGroupMembershipWithContext is an alternate form of the DeleteInstanceGroupMembership method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions cannot be nil") +// UpdateInstanceGroupManagerWithContext is an alternate form of the UpdateInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") + err = core.ValidateStruct(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupMembershipOptions.InstanceGroupID, - "id": *deleteInstanceGroupMembershipOptions.ID, + "instance_group_id": *updateInstanceGroupManagerOptions.InstanceGroupID, + "id": *updateInstanceGroupManagerOptions.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, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupMembershipOptions.Headers { + for headerName, headerValue := range updateInstanceGroupManagerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManager") 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(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) + 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_instance_group_membership", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_group_manager", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteInstanceGroupMemberships : Delete memberships from an instance group -// This request deletes memberships of an instance group. This operation cannot be reversed. Memberships that have -// `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. -func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) +// ListInstanceGroupManagerActions : List actions for an instance group manager +// This request lists instance group actions for an instance group manager. +func (vpc *VpcV1) ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteInstanceGroupMembershipsWithContext is an alternate form of the DeleteInstanceGroupMemberships method which supports a Context parameter -func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions cannot be nil") +// ListInstanceGroupManagerActionsWithContext is an alternate form of the ListInstanceGroupManagerActions method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context, listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") + err = core.ValidateStruct(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *deleteInstanceGroupMembershipsOptions.InstanceGroupID, + "instance_group_id": *listInstanceGroupManagerActionsOptions.InstanceGroupID, + "instance_group_manager_id": *listInstanceGroupManagerActionsOptions.InstanceGroupManagerID, } - 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, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteInstanceGroupMembershipsOptions.Headers { + for headerName, headerValue := range listInstanceGroupManagerActionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerActions") 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 listInstanceGroupManagerActionsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) + } + if listInstanceGroupManagerActionsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -9413,63 +9519,80 @@ func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, 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_instance_group_memberships", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_group_manager_actions", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerActionsCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetInstanceGroup : Retrieve an instance group -// This request retrieves a single instance group specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) +// CreateInstanceGroupManagerAction : Create an instance group manager action +// This request creates a new instance group manager action. +func (vpc *VpcV1) CreateInstanceGroupManagerAction(createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceGroupManagerActionWithContext(context.Background(), createInstanceGroupManagerActionOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceGroupWithContext is an alternate form of the GetInstanceGroup method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupOptions, "getInstanceGroupOptions cannot be nil") +// CreateInstanceGroupManagerActionWithContext is an alternate form of the CreateInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerActionWithContext(ctx context.Context, createInstanceGroupManagerActionOptions *CreateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceGroupOptions, "getInstanceGroupOptions") + err = core.ValidateStruct(createInstanceGroupManagerActionOptions, "createInstanceGroupManagerActionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getInstanceGroupOptions.ID, + "instance_group_id": *createInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *createInstanceGroupManagerActionOptions.InstanceGroupManagerID, } - 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, `/instance_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceGroupOptions.Headers { + for headerName, headerValue := range createInstanceGroupManagerActionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerAction") 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(createInstanceGroupManagerActionOptions.InstanceGroupManagerActionPrototype) + 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()) @@ -9479,12 +9602,12 @@ func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGr var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_group_manager_action", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9495,50 +9618,50 @@ func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGr return } -// GetInstanceGroupManager : Retrieve an instance group manager -// This request retrieves a single instance group manager specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) +// DeleteInstanceGroupManagerAction : Delete specified instance group manager action +// This request deletes an instance group manager action. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManagerAction(deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceGroupManagerActionWithContext(context.Background(), deleteInstanceGroupManagerActionOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceGroupManagerWithContext is an alternate form of the GetInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions cannot be nil") +// DeleteInstanceGroupManagerActionWithContext is an alternate form of the DeleteInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerActionWithContext(ctx context.Context, deleteInstanceGroupManagerActionOptions *DeleteInstanceGroupManagerActionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") + err = core.ValidateStruct(deleteInstanceGroupManagerActionOptions, "deleteInstanceGroupManagerActionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupManagerOptions.InstanceGroupID, - "id": *getInstanceGroupManagerOptions.ID, + "instance_group_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *deleteInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *deleteInstanceGroupManagerActionOptions.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, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceGroupManagerOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupManagerActionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerAction") 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)) @@ -9549,21 +9672,12 @@ func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getIns 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_instance_group_manager", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group_manager_action", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } @@ -9642,55 +9756,62 @@ func (vpc *VpcV1) GetInstanceGroupManagerActionWithContext(ctx context.Context, return } -// GetInstanceGroupManagerPolicy : Retrieve an instance group manager policy -// This request retrieves a single instance group manager policy specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) +// UpdateInstanceGroupManagerAction : Update specified instance group manager action +// This request updates an instance group manager action. +func (vpc *VpcV1) UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceGroupManagerPolicyWithContext is an alternate form of the GetInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions cannot be nil") +// UpdateInstanceGroupManagerActionWithContext is an alternate form of the UpdateInstanceGroupManagerAction method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Context, updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") + err = core.ValidateStruct(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *getInstanceGroupManagerPolicyOptions.ID, + "instance_group_id": *updateInstanceGroupManagerActionOptions.InstanceGroupID, + "instance_group_manager_id": *updateInstanceGroupManagerActionOptions.InstanceGroupManagerID, + "id": *updateInstanceGroupManagerActionOptions.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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceGroupManagerPolicyOptions.Headers { + for headerName, headerValue := range updateInstanceGroupManagerActionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerAction") 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(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) + 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()) @@ -9700,12 +9821,12 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_group_manager_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_group_manager_action", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9716,46 +9837,46 @@ func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, return } -// GetInstanceGroupMembership : Retrieve an instance group membership -// This request retrieves a single instance group membership specified by identifier in the URL. -func (vpc *VpcV1) GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) +// ListInstanceGroupManagerPolicies : List policies for an instance group manager +// This request lists policies for an instance group manager. +func (vpc *VpcV1) ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetInstanceGroupMembershipWithContext is an alternate form of the GetInstanceGroupMembership method which supports a Context parameter -func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions cannot be nil") +// ListInstanceGroupManagerPoliciesWithContext is an alternate form of the ListInstanceGroupManagerPolicies method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Context, listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") + err = core.ValidateStruct(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *getInstanceGroupMembershipOptions.InstanceGroupID, - "id": *getInstanceGroupMembershipOptions.ID, + "instance_group_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupID, + "instance_group_manager_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupManagerID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getInstanceGroupMembershipOptions.Headers { + for headerName, headerValue := range listInstanceGroupManagerPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerPolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -9763,6 +9884,12 @@ func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, get builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listInstanceGroupManagerPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Start)) + } + if listInstanceGroupManagerPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -9773,12 +9900,12 @@ func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, get var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_instance_group_membership", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_group_manager_policies", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicyCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9789,58 +9916,59 @@ func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, get return } -// ListInstanceGroupManagerActions : List actions for an instance group manager -// This request lists instance group actions for an instance group manager. -func (vpc *VpcV1) ListInstanceGroupManagerActions(listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupManagerActionsWithContext(context.Background(), listInstanceGroupManagerActionsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} +// CreateInstanceGroupManagerPolicy : Create a policy for an instance group manager +// This request creates a new instance group manager policy. +func (vpc *VpcV1) CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) + err = core.RepurposeSDKProblem(err, "") + return +} -// ListInstanceGroupManagerActionsWithContext is an alternate form of the ListInstanceGroupManagerActions method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context, listInstanceGroupManagerActionsOptions *ListInstanceGroupManagerActionsOptions) (result *InstanceGroupManagerActionsCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions cannot be nil") +// CreateInstanceGroupManagerPolicyWithContext is an alternate form of the CreateInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Context, createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceGroupManagerActionsOptions, "listInstanceGroupManagerActionsOptions") + err = core.ValidateStruct(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupManagerActionsOptions.InstanceGroupID, - "instance_group_manager_id": *listInstanceGroupManagerActionsOptions.InstanceGroupManagerID, + "instance_group_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, } - 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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceGroupManagerActionsOptions.Headers { + for headerName, headerValue := range createInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerActions") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") 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)) - if listInstanceGroupManagerActionsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Start)) - } - if listInstanceGroupManagerActionsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerActionsOptions.Limit)) + + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -9852,12 +9980,12 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_group_manager_actions", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_instance_group_manager_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerActionsCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9868,59 +9996,53 @@ func (vpc *VpcV1) ListInstanceGroupManagerActionsWithContext(ctx context.Context return } -// ListInstanceGroupManagerPolicies : List policies for an instance group manager -// This request lists policies for an instance group manager. -func (vpc *VpcV1) ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) +// DeleteInstanceGroupManagerPolicy : Delete an instance group manager policy +// This request deletes an instance group manager policy. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceGroupManagerPoliciesWithContext is an alternate form of the ListInstanceGroupManagerPolicies method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Context, listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions cannot be nil") +// DeleteInstanceGroupManagerPolicyWithContext is an alternate form of the DeleteInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Context, deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions") + err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupID, - "instance_group_manager_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupManagerID, + "instance_group_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *deleteInstanceGroupManagerPolicyOptions.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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceGroupManagerPoliciesOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerPolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") 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 listInstanceGroupManagerPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Start)) - } - if listInstanceGroupManagerPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -9928,64 +10050,57 @@ func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Contex 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_instance_group_manager_policies", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group_manager_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicyCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListInstanceGroupManagers : List managers for an instance group -// This request lists managers for an instance group. -func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) +// GetInstanceGroupManagerPolicy : Retrieve an instance group manager policy +// This request retrieves a single instance group manager policy specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceGroupManagersWithContext is an alternate form of the ListInstanceGroupManagers method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions cannot be nil") +// GetInstanceGroupManagerPolicyWithContext is an alternate form of the GetInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") + err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupManagersOptions.InstanceGroupID, + "instance_group_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *getInstanceGroupManagerPolicyOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceGroupManagersOptions.Headers { + for headerName, headerValue := range getInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -9993,12 +10108,6 @@ func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, list builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listInstanceGroupManagersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) - } - if listInstanceGroupManagersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagersOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -10009,12 +10118,12 @@ func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, list var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_group_managers", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_group_manager_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10025,128 +10134,62 @@ func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, list return } -// ListInstanceGroupMemberships : List memberships for an instance group -// This request lists instance group memberships for an instance group. -func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) +// UpdateInstanceGroupManagerPolicy : Update an instance group manager policy +// This request updates an instance group manager policy. +func (vpc *VpcV1) UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceGroupMembershipsWithContext is an alternate form of the ListInstanceGroupMemberships method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions cannot be nil") +// UpdateInstanceGroupManagerPolicyWithContext is an alternate form of the UpdateInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Context, updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") + err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *listInstanceGroupMembershipsOptions.InstanceGroupID, + "instance_group_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *updateInstanceGroupManagerPolicyOptions.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, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceGroupMembershipsOptions.Headers { + for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupMemberships") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerPolicy") 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 listInstanceGroupMembershipsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) - } - if listInstanceGroupMembershipsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupMembershipsOptions.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_group_memberships", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembershipCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListInstanceGroups : List instance groups -// This request lists instance groups in the region. -func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) - err = core.RepurposeSDKProblem(err, "") - return -} -// ListInstanceGroupsWithContext is an alternate form of the ListInstanceGroups method which supports a Context parameter -func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstanceGroupsOptions, "listInstanceGroupsOptions") - 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, `/instance_groups`, nil) + _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) 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 listInstanceGroupsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") - 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 listInstanceGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) - } - if listInstanceGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupsOptions.Limit)) - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -10156,12 +10199,12 @@ func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanc var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_groups", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_instance_group_manager_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10172,139 +10215,120 @@ func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanc return } -// UpdateInstanceGroup : Update an instance group -// This request updates an instance group with the information provided instance group patch. The instance group patch -// object is structured in the same way as a retrieved instance group and contains only the information to be updated. -func (vpc *VpcV1) UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) +// DeleteInstanceGroupMemberships : Delete memberships from an instance group +// This request deletes memberships of an instance group. This operation cannot be reversed. Memberships that have +// `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. +func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceGroupWithContext is an alternate form of the UpdateInstanceGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupOptions, "updateInstanceGroupOptions cannot be nil") +// DeleteInstanceGroupMembershipsWithContext is an alternate form of the DeleteInstanceGroupMemberships method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceGroupOptions, "updateInstanceGroupOptions") + err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateInstanceGroupOptions.ID, + "instance_group_id": *deleteInstanceGroupMembershipsOptions.InstanceGroupID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceGroupOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupMembershipsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") 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(updateInstanceGroupOptions.InstanceGroupPatch) - 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_instance_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group_memberships", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// UpdateInstanceGroupManager : Update an instance group manager -// This request updates an instance group manager with the information provided instance group manager patch. -func (vpc *VpcV1) UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) +// ListInstanceGroupMemberships : List memberships for an instance group +// This request lists instance group memberships for an instance group. +func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceGroupManagerWithContext is an alternate form of the UpdateInstanceGroupManager method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions cannot be nil") +// ListInstanceGroupMembershipsWithContext is an alternate form of the ListInstanceGroupMemberships method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") + err = core.ValidateStruct(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerOptions.InstanceGroupID, - "id": *updateInstanceGroupManagerOptions.ID, + "instance_group_id": *listInstanceGroupMembershipsOptions.InstanceGroupID, } - 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, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceGroupManagerOptions.Headers { + for headerName, headerValue := range listInstanceGroupMembershipsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManager") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupMemberships") 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(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listInstanceGroupMembershipsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) + } + if listInstanceGroupMembershipsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupMembershipsOptions.Limit)) } request, err := builder.Build() @@ -10316,12 +10340,12 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, upd var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_group_manager", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_instance_group_memberships", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembershipCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10332,143 +10356,118 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, upd return } -// UpdateInstanceGroupManagerAction : Update specified instance group manager action -// This request updates an instance group manager action. -func (vpc *VpcV1) UpdateInstanceGroupManagerAction(updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceGroupManagerActionWithContext(context.Background(), updateInstanceGroupManagerActionOptions) +// DeleteInstanceGroupMembership : Delete an instance group membership +// This request deletes a memberships of an instance group. This operation cannot be reversed. reversed. If the +// membership has `delete_instance_on_membership_delete` set to `true`, the instance will also be deleted. +func (vpc *VpcV1) DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceGroupManagerActionWithContext is an alternate form of the UpdateInstanceGroupManagerAction method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupManagerActionWithContext(ctx context.Context, updateInstanceGroupManagerActionOptions *UpdateInstanceGroupManagerActionOptions) (result InstanceGroupManagerActionIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions cannot be nil") +// DeleteInstanceGroupMembershipWithContext is an alternate form of the DeleteInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceGroupManagerActionOptions, "updateInstanceGroupManagerActionOptions") + err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerActionOptions.InstanceGroupID, - "instance_group_manager_id": *updateInstanceGroupManagerActionOptions.InstanceGroupManagerID, - "id": *updateInstanceGroupManagerActionOptions.ID, + "instance_group_id": *deleteInstanceGroupMembershipOptions.InstanceGroupID, + "id": *deleteInstanceGroupMembershipOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/actions/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceGroupManagerActionOptions.Headers { + for headerName, headerValue := range deleteInstanceGroupMembershipOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerAction") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") 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(updateInstanceGroupManagerActionOptions.InstanceGroupManagerActionPatch) - 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_instance_group_manager_action", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_instance_group_membership", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerAction) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// UpdateInstanceGroupManagerPolicy : Update an instance group manager policy -// This request updates an instance group manager policy. -func (vpc *VpcV1) UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) +// GetInstanceGroupMembership : Retrieve an instance group membership +// This request retrieves a single instance group membership specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateInstanceGroupManagerPolicyWithContext is an alternate form of the UpdateInstanceGroupManagerPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Context, updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions cannot be nil") +// GetInstanceGroupMembershipWithContext is an alternate form of the GetInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") + err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "instance_group_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupID, - "instance_group_manager_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, - "id": *updateInstanceGroupManagerPolicyOptions.ID, + "instance_group_id": *getInstanceGroupMembershipOptions.InstanceGroupID, + "id": *getInstanceGroupMembershipOptions.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, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { + for headerName, headerValue := range getInstanceGroupMembershipOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") 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(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) - 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()) @@ -10478,12 +10477,12 @@ func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_instance_group_manager_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_instance_group_membership", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10574,51 +10573,62 @@ func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, return } -// ActivateReservation : Activate a reservation -// This request activates a reservation. For this request to succeed, the reservation status must be `inactive`. -func (vpc *VpcV1) ActivateReservation(activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.ActivateReservationWithContext(context.Background(), activateReservationOptions) +// ListReservations : List reservations +// This request lists reservations in the region. A reservation provides reserved capacity for a specified profile in a +// specified zone. A reservation can also include a long-term committed use discount. +// +// The reservations will be sorted by their `created_at` property values, with newest reservations first. Reservations +// with identical `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListReservations(listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListReservationsWithContext(context.Background(), listReservationsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ActivateReservationWithContext is an alternate form of the ActivateReservation method which supports a Context parameter -func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(activateReservationOptions, "activateReservationOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(activateReservationOptions, "activateReservationOptions") +// ListReservationsWithContext is an alternate form of the ListReservations method which supports a Context parameter +func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listReservationsOptions, "listReservationsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *activateReservationOptions.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, `/reservations/{id}/activate`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range activateReservationOptions.Headers { + for headerName, headerValue := range listReservationsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ActivateReservation") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListReservations") 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 listReservationsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listReservationsOptions.Start)) + } + if listReservationsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listReservationsOptions.Limit)) + } + if listReservationsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listReservationsOptions.Name)) + } + if listReservationsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listReservationsOptions.ResourceGroupID)) + } + if listReservationsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listReservationsOptions.ZoneName)) + } request, err := builder.Build() if err != nil { @@ -10626,12 +10636,21 @@ func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateRe 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, "activate_reservation", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_reservations", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservationCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } @@ -10879,61 +10898,59 @@ func (vpc *VpcV1) GetReservationWithContext(ctx context.Context, getReservationO return } -// ListReservations : List reservations -// This request lists reservations in the region. A reservation provides reserved capacity for a specified profile in a -// specified zone. A reservation can also include a long-term committed use discount. -// -// The reservations will be sorted by their `created_at` property values, with newest reservations first. Reservations -// with identical `created_at` property values will in turn be sorted by ascending `name` property values. -func (vpc *VpcV1) ListReservations(listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListReservationsWithContext(context.Background(), listReservationsOptions) +// UpdateReservation : Update a reservation +// This request updates a reservation with the information provided in a reservation patch object. The patch object is +// structured in the same way as a retrieved reservation and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateReservation(updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateReservationWithContext(context.Background(), updateReservationOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListReservationsWithContext is an alternate form of the ListReservations method which supports a Context parameter -func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservationsOptions *ListReservationsOptions) (result *ReservationCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listReservationsOptions, "listReservationsOptions") +// UpdateReservationWithContext is an alternate form of the UpdateReservation method which supports a Context parameter +func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateReservationOptions, "updateReservationOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateReservationOptions, "updateReservationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *updateReservationOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listReservationsOptions.Headers { + for headerName, headerValue := range updateReservationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListReservations") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateReservation") 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 listReservationsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listReservationsOptions.Start)) - } - if listReservationsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listReservationsOptions.Limit)) - } - if listReservationsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listReservationsOptions.Name)) - } - if listReservationsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listReservationsOptions.ResourceGroupID)) - } - if listReservationsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listReservationsOptions.ZoneName)) + + _, err = builder.SetBodyContentJSON(updateReservationOptions.ReservationPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -10945,12 +10962,12 @@ func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservati var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_reservations", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_reservation", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservationCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10961,134 +10978,120 @@ func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservati return } -// UpdateReservation : Update a reservation -// This request updates a reservation with the information provided in a reservation patch object. The patch object is -// structured in the same way as a retrieved reservation and needs to contain only the information to be updated. -func (vpc *VpcV1) UpdateReservation(updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateReservationWithContext(context.Background(), updateReservationOptions) +// ActivateReservation : Activate a reservation +// This request activates a reservation. For this request to succeed, the reservation status must be `inactive`. +func (vpc *VpcV1) ActivateReservation(activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.ActivateReservationWithContext(context.Background(), activateReservationOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateReservationWithContext is an alternate form of the UpdateReservation method which supports a Context parameter -func (vpc *VpcV1) UpdateReservationWithContext(ctx context.Context, updateReservationOptions *UpdateReservationOptions) (result *Reservation, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateReservationOptions, "updateReservationOptions cannot be nil") +// ActivateReservationWithContext is an alternate form of the ActivateReservation method which supports a Context parameter +func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateReservationOptions *ActivateReservationOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(activateReservationOptions, "activateReservationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateReservationOptions, "updateReservationOptions") + err = core.ValidateStruct(activateReservationOptions, "activateReservationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateReservationOptions.ID, + "id": *activateReservationOptions.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, `/reservations/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/reservations/{id}/activate`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateReservationOptions.Headers { + for headerName, headerValue := range activateReservationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateReservation") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ActivateReservation") 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(updateReservationOptions.ReservationPatch) - 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_reservation", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "activate_reservation", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservation) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateDedicatedHost : Create a dedicated host -// This request creates a new dedicated host. -func (vpc *VpcV1) CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) +// ListDedicatedHostGroups : List dedicated host groups +// This request lists dedicated host groups in the region. Host groups are a collection of dedicated hosts for placement +// of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. +func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateDedicatedHostWithContext is an alternate form of the CreateDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createDedicatedHostOptions, "createDedicatedHostOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") +// ListDedicatedHostGroupsWithContext is an alternate form of the ListDedicatedHostGroups method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostGroupsOptions, "listDedicatedHostGroupsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/dedicated_hosts`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createDedicatedHostOptions.Headers { + for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") 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(createDedicatedHostOptions.DedicatedHostPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listDedicatedHostGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) + } + if listDedicatedHostGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostGroupsOptions.Limit)) + } + if listDedicatedHostGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostGroupsOptions.ResourceGroupID)) + } + if listDedicatedHostGroupsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostGroupsOptions.ZoneName)) + } + if listDedicatedHostGroupsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listDedicatedHostGroupsOptions.Name)) } request, err := builder.Build() @@ -11100,12 +11103,12 @@ func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedi var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_dedicated_host", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_dedicated_host_groups", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroupCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11207,68 +11210,6 @@ func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, creat return } -// DeleteDedicatedHost : Delete a dedicated host -// This request deletes a dedicated host. -func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// DeleteDedicatedHostWithContext is an alternate form of the DeleteDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteDedicatedHostOptions, "deleteDedicatedHostOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteDedicatedHostOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteDedicatedHostOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") - 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_dedicated_host", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - // DeleteDedicatedHostGroup : Delete a dedicated host group // This request deletes a dedicated host group. func (vpc *VpcV1) DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { @@ -11331,45 +11272,45 @@ func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, delet return } -// GetDedicatedHost : Retrieve a dedicated host -// This request retrieves a single dedicated host specified by the identifiers in the URL. -func (vpc *VpcV1) GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) +// GetDedicatedHostGroup : Retrieve a dedicated host group +// This request retrieves a single dedicated host group specified by the identifier in the URL. +func (vpc *VpcV1) GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetDedicatedHostWithContext is an alternate form of the GetDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostOptions, "getDedicatedHostOptions cannot be nil") +// GetDedicatedHostGroupWithContext is an alternate form of the GetDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") + err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getDedicatedHostOptions.ID, + "id": *getDedicatedHostGroupOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getDedicatedHostOptions.Headers { + for headerName, headerValue := range getDedicatedHostGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11387,12 +11328,12 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_dedicated_host", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_dedicated_host_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11403,54 +11344,62 @@ func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedH return } -// GetDedicatedHostDisk : Retrieve a dedicated host disk -// This request retrieves a single dedicated host disk specified by the identifier in the URL. -func (vpc *VpcV1) GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) +// UpdateDedicatedHostGroup : Update a dedicated host group +// This request updates a dedicated host group with the information in a provided dedicated host group patch. The +// dedicated host group patch object is structured in the same way as a retrieved dedicated host group and contains only +// the information to be updated. +func (vpc *VpcV1) UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetDedicatedHostDiskWithContext is an alternate form of the GetDedicatedHostDisk method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions cannot be nil") +// UpdateDedicatedHostGroupWithContext is an alternate form of the UpdateDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") + err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "dedicated_host_id": *getDedicatedHostDiskOptions.DedicatedHostID, - "id": *getDedicatedHostDiskOptions.ID, + "id": *updateDedicatedHostGroupOptions.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, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { + for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") 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(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) + 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()) @@ -11460,12 +11409,12 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_dedicated_host_disk", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_dedicated_host_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11476,45 +11425,37 @@ func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedica return } -// GetDedicatedHostGroup : Retrieve a dedicated host group -// This request retrieves a single dedicated host group specified by the identifier in the URL. -func (vpc *VpcV1) GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) +// ListDedicatedHostProfiles : List dedicated host profiles +// This request lists provisionable [dedicated host profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in +// the region. A dedicated host profile specifies the hardware characteristics for a dedicated host. +func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetDedicatedHostGroupWithContext is an alternate form of the GetDedicatedHostGroup method which supports a Context parameter -func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") +// ListDedicatedHostProfilesWithContext is an alternate form of the ListDedicatedHostProfiles method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostProfilesOptions, "listDedicatedHostProfilesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *getDedicatedHostGroupOptions.ID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getDedicatedHostGroupOptions.Headers { + for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11522,6 +11463,12 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listDedicatedHostProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) + } + if listDedicatedHostProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostProfilesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -11532,12 +11479,12 @@ func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedic var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_dedicated_host_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_dedicated_host_profiles", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11620,47 +11567,36 @@ func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDed return } -// ListDedicatedHostDisks : List disks on a dedicated host -// This request lists disks on a dedicated host. A disk is a physical device that is locally attached to the compute -// node. By default, the listed disks are sorted by their -// `created_at` property values, with the newest disk first. -func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) +// ListDedicatedHosts : List dedicated hosts +// This request lists dedicated hosts in the region. +func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListDedicatedHostDisksWithContext is an alternate form of the ListDedicatedHostDisks method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") +// ListDedicatedHostsWithContext is an alternate form of the ListDedicatedHosts method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostsOptions, "listDedicatedHostsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "dedicated_host_id": *listDedicatedHostDisksOptions.DedicatedHostID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { + for headerName, headerValue := range listDedicatedHostsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11668,6 +11604,24 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listDedicatedHostsOptions.DedicatedHostGroupID != nil { + builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) + } + if listDedicatedHostsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostsOptions.Start)) + } + if listDedicatedHostsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostsOptions.Limit)) + } + if listDedicatedHostsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostsOptions.ResourceGroupID)) + } + if listDedicatedHostsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostsOptions.ZoneName)) + } + if listDedicatedHostsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listDedicatedHostsOptions.Name)) + } request, err := builder.Build() if err != nil { @@ -11678,12 +11632,12 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_dedicated_host_disks", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_dedicated_hosts", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDiskCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11694,58 +11648,54 @@ func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDed return } -// ListDedicatedHostGroups : List dedicated host groups -// This request lists dedicated host groups in the region. Host groups are a collection of dedicated hosts for placement -// of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. -func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) +// CreateDedicatedHost : Create a dedicated host +// This request creates a new dedicated host. +func (vpc *VpcV1) CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListDedicatedHostGroupsWithContext is an alternate form of the ListDedicatedHostGroups method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostGroupsOptions, "listDedicatedHostGroupsOptions") +// CreateDedicatedHostWithContext is an alternate form of the CreateDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createDedicatedHostOptions, "createDedicatedHostOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/dedicated_host/groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { + for headerName, headerValue := range createDedicatedHostOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") 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)) - if listDedicatedHostGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) - } - if listDedicatedHostGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostGroupsOptions.Limit)) - } - if listDedicatedHostGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostGroupsOptions.ResourceGroupID)) - } - if listDedicatedHostGroupsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostGroupsOptions.ZoneName)) - } - if listDedicatedHostGroupsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listDedicatedHostGroupsOptions.Name)) + + _, err = builder.SetBodyContentJSON(createDedicatedHostOptions.DedicatedHostPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -11757,12 +11707,12 @@ func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDe var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_dedicated_host_groups", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_dedicated_host", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11773,37 +11723,47 @@ func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDe return } -// ListDedicatedHostProfiles : List dedicated host profiles -// This request lists provisionable [dedicated host profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-dh-profiles) in -// the region. A dedicated host profile specifies the hardware characteristics for a dedicated host. -func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) +// ListDedicatedHostDisks : List disks on a dedicated host +// This request lists disks on a dedicated host. A disk is a physical device that is locally attached to the compute +// node. By default, the listed disks are sorted by their +// `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListDedicatedHostProfilesWithContext is an alternate form of the ListDedicatedHostProfiles method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostProfilesOptions, "listDedicatedHostProfilesOptions") +// ListDedicatedHostDisksWithContext is an alternate form of the ListDedicatedHostDisks method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "dedicated_host_id": *listDedicatedHostDisksOptions.DedicatedHostID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { + for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11811,12 +11771,6 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listDedicatedHostProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) - } - if listDedicatedHostProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostProfilesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -11827,12 +11781,12 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_dedicated_host_profiles", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_dedicated_host_disks", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDiskCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11843,36 +11797,46 @@ func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, list return } -// ListDedicatedHosts : List dedicated hosts -// This request lists dedicated hosts in the region. -func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) +// GetDedicatedHostDisk : Retrieve a dedicated host disk +// This request retrieves a single dedicated host disk specified by the identifier in the URL. +func (vpc *VpcV1) GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListDedicatedHostsWithContext is an alternate form of the ListDedicatedHosts method which supports a Context parameter -func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDedicatedHostsOptions, "listDedicatedHostsOptions") +// GetDedicatedHostDiskWithContext is an alternate form of the GetDedicatedHostDisk method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "dedicated_host_id": *getDedicatedHostDiskOptions.DedicatedHostID, + "id": *getDedicatedHostDiskOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listDedicatedHostsOptions.Headers { + for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11880,24 +11844,6 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listDedicatedHostsOptions.DedicatedHostGroupID != nil { - builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) - } - if listDedicatedHostsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listDedicatedHostsOptions.Start)) - } - if listDedicatedHostsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostsOptions.Limit)) - } - if listDedicatedHostsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostsOptions.ResourceGroupID)) - } - if listDedicatedHostsOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostsOptions.ZoneName)) - } - if listDedicatedHostsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listDedicatedHostsOptions.Name)) - } request, err := builder.Build() if err != nil { @@ -11908,12 +11854,12 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_dedicated_hosts", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_dedicated_host_disk", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11924,47 +11870,46 @@ func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicat return } -// UpdateDedicatedHost : Update a dedicated host -// This request updates a dedicated host with the information in a provided dedicated host patch. The dedicated host -// patch object is structured in the same way as a retrieved dedicated host and contains only the information to be -// updated. -func (vpc *VpcV1) UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) +// UpdateDedicatedHostDisk : Update a dedicated host disk +// This request updates the dedicated host disk with the information in a provided patch. +func (vpc *VpcV1) UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateDedicatedHostWithContext is an alternate form of the UpdateDedicatedHost method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostOptions, "updateDedicatedHostOptions cannot be nil") +// UpdateDedicatedHostDiskWithContext is an alternate form of the UpdateDedicatedHostDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") + err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateDedicatedHostOptions.ID, + "dedicated_host_id": *updateDedicatedHostDiskOptions.DedicatedHostID, + "id": *updateDedicatedHostDiskOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateDedicatedHostOptions.Headers { + for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -11974,7 +11919,7 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateDedicatedHostOptions.DedicatedHostPatch) + _, err = builder.SetBodyContentJSON(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -11989,12 +11934,12 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_dedicated_host", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_dedicated_host_disk", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12005,61 +11950,115 @@ func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedi return } -// UpdateDedicatedHostDisk : Update a dedicated host disk -// This request updates the dedicated host disk with the information in a provided patch. -func (vpc *VpcV1) UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) +// DeleteDedicatedHost : Delete a dedicated host +// This request deletes a dedicated host. +func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateDedicatedHostDiskWithContext is an alternate form of the UpdateDedicatedHostDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions cannot be nil") +// DeleteDedicatedHostWithContext is an alternate form of the DeleteDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteDedicatedHostOptions, "deleteDedicatedHostOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") + err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "dedicated_host_id": *updateDedicatedHostDiskOptions.DedicatedHostID, - "id": *updateDedicatedHostDiskOptions.ID, + "id": *deleteDedicatedHostOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { + for headerName, headerValue := range deleteDedicatedHostOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") 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(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) + request, err := builder.Build() if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_dedicated_host", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// GetDedicatedHost : Retrieve a dedicated host +// This request retrieves a single dedicated host specified by the identifiers in the URL. +func (vpc *VpcV1) GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetDedicatedHostWithContext is an alternate form of the GetDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostOptions, "getDedicatedHostOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *getDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } + for headerName, headerValue := range getDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") + 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()) @@ -12069,12 +12068,12 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_dedicated_host_disk", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_dedicated_host", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12085,47 +12084,47 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update return } -// UpdateDedicatedHostGroup : Update a dedicated host group -// This request updates a dedicated host group with the information in a provided dedicated host group patch. The -// dedicated host group patch object is structured in the same way as a retrieved dedicated host group and contains only -// the information to be updated. -func (vpc *VpcV1) UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) +// UpdateDedicatedHost : Update a dedicated host +// This request updates a dedicated host with the information in a provided dedicated host patch. The dedicated host +// patch object is structured in the same way as a retrieved dedicated host and contains only the information to be +// updated. +func (vpc *VpcV1) UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateDedicatedHostGroupWithContext is an alternate form of the UpdateDedicatedHostGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions cannot be nil") +// UpdateDedicatedHostWithContext is an alternate form of the UpdateDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostOptions, "updateDedicatedHostOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") + err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateDedicatedHostGroupOptions.ID, + "id": *updateDedicatedHostOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { + for headerName, headerValue := range updateDedicatedHostOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12135,7 +12134,7 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) + _, err = builder.SetBodyContentJSON(updateDedicatedHostOptions.DedicatedHostPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -12150,12 +12149,81 @@ func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updat var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_dedicated_host_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_dedicated_host", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// ListPlacementGroups : List placement groups +// This request lists placement groups in the region. +func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter +func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") + 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, `/placement_groups`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listPlacementGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") + 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 listPlacementGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) + } + if listPlacementGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.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_placement_groups", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12386,17 +12454,99 @@ func (vpc *VpcV1) GetPlacementGroupWithContext(ctx context.Context, getPlacement return } -// ListPlacementGroups : List placement groups -// This request lists placement groups in the region. -func (vpc *VpcV1) ListPlacementGroups(listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListPlacementGroupsWithContext(context.Background(), listPlacementGroupsOptions) +// UpdatePlacementGroup : Update a placement group +// This request updates a placement group with the information provided placement group patch. The placement group patch +// object is structured in the same way as a retrieved placement group and contains only the information to be updated. +func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListPlacementGroupsWithContext is an alternate form of the ListPlacementGroups method which supports a Context parameter -func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacementGroupsOptions *ListPlacementGroupsOptions) (result *PlacementGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listPlacementGroupsOptions, "listPlacementGroupsOptions") +// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter +func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *updatePlacementGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range updatePlacementGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") + 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(updatePlacementGroupOptions.PlacementGroupPatch) + 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_placement_group", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// ListBareMetalServerProfiles : List bare metal server profiles +// This request lists [bare metal server profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) +// available in the region. A bare metal server profile specifies the performance characteristics and pricing model for +// a bare metal server. +func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -12405,17 +12555,17 @@ func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacem builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/placement_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listPlacementGroupsOptions.Headers { + for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPlacementGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12423,11 +12573,11 @@ func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacem builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listPlacementGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPlacementGroupsOptions.Start)) + if listBareMetalServerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) } - if listPlacementGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPlacementGroupsOptions.Limit)) + if listBareMetalServerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.Limit)) } request, err := builder.Build() @@ -12439,12 +12589,12 @@ func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacem var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_placement_groups", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_bare_metal_server_profiles", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12455,61 +12605,53 @@ func (vpc *VpcV1) ListPlacementGroupsWithContext(ctx context.Context, listPlacem return } -// UpdatePlacementGroup : Update a placement group -// This request updates a placement group with the information provided placement group patch. The placement group patch -// object is structured in the same way as a retrieved placement group and contains only the information to be updated. -func (vpc *VpcV1) UpdatePlacementGroup(updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdatePlacementGroupWithContext(context.Background(), updatePlacementGroupOptions) +// GetBareMetalServerProfile : Retrieve a bare metal server profile +// This request retrieves a single bare metal server profile specified by the name in the URL. +func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdatePlacementGroupWithContext is an alternate form of the UpdatePlacementGroup method which supports a Context parameter -func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePlacementGroupOptions *UpdatePlacementGroupOptions) (result *PlacementGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePlacementGroupOptions, "updatePlacementGroupOptions cannot be nil") +// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updatePlacementGroupOptions, "updatePlacementGroupOptions") + err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updatePlacementGroupOptions.ID, + "name": *getBareMetalServerProfileOptions.Name, } - 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, `/placement_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updatePlacementGroupOptions.Headers { + for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePlacementGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") 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(updatePlacementGroupOptions.PlacementGroupPatch) - 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()) @@ -12519,12 +12661,12 @@ func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePla var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_placement_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server_profile", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPlacementGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12535,55 +12677,36 @@ func (vpc *VpcV1) UpdatePlacementGroupWithContext(ctx context.Context, updatePla return } -// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface -// This request associates the specified floating IP with the specified bare metal server network interface. If -// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` -// is `true`, this replaces any existing association. -// -// The existing floating IP must: -// - not be required by another resource, such as a public gateway -// - be in the same `zone` as the bare metal server -// -// A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) +// ListBareMetalServers : List bare metal servers +// This request lists bare metal servers in the region. +func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) err = core.RepurposeSDKProblem(err, "") return } -// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") +// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listBareMetalServersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -12591,6 +12714,27 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listBareMetalServersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) + } + if listBareMetalServersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) + } + if listBareMetalServersOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) + } + if listBareMetalServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) + } + if listBareMetalServersOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) + } + if listBareMetalServersOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) + } + if listBareMetalServersOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) + } request, err := builder.Build() if err != nil { @@ -12601,12 +12745,12 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "add_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_bare_metal_servers", 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, UnmarshalBareMetalServerCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12784,62 +12928,54 @@ func (vpc *VpcV1) CreateBareMetalServerConsoleAccessTokenWithContext(ctx context return } -// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server -// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype -// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and -// contains the information necessary to create the new bare metal server network attachment. -func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) +// ListBareMetalServerDisks : List disks on a bare metal server +// This request lists disks on a bare metal server. A disk is a block device that is locally attached to the physical +// server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") +// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, } - 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, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") 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(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) - 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()) @@ -12849,12 +12985,12 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context. var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_bare_metal_server_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_bare_metal_server_disks", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12865,68 +13001,54 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context. return } -// CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server -// This request creates a new bare metal server network interface from a bare metal server network interface prototype -// object. The prototype object is structured in the same way as a retrieved bare metal server network interface, and -// contains the information necessary to create the new bare metal server network interface. Any subnet in the bare -// metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. -// Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. -// -// 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, and new network interfaces are not allowed to be created. -func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) +// GetBareMetalServerDisk : Retrieve a bare metal server disk +// This request retrieves a single disk specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") +// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, + "id": *getBareMetalServerDiskOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") 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(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) - 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()) @@ -12936,12 +13058,12 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_bare_metal_server_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server_disk", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -12952,118 +13074,145 @@ func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// DeleteBareMetalServer : Delete a bare metal server -// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the -// bare metal server network interfaces are implicitly disassociated. -func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) +// UpdateBareMetalServerDisk : Update a bare metal server disk +// This request updates the bare metal server disk with the information in a provided patch. +func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") +// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") + err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteBareMetalServerOptions.ID, + "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, + "id": *updateBareMetalServerDiskOptions.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, `/bare_metal_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBareMetalServerOptions.Headers { + for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") 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(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) + 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_bare_metal_server", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_bare_metal_server_disk", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment -// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs -// associated with the bare metal server network attachment are implicitly disassociated. +// ListBareMetalServerNetworkAttachments : List network attachments on a bare metal server +// This request lists network attachments on a bare metal server. A bare metal server network attachment is an abstract +// representation of a network device and attaches a bare metal server to a single subnet. Each network interface on a +// bare metal server can attach to any subnet in the zone, including subnets that are already attached to the bare metal +// server. // -// The bare metal server's primary network attachment cannot be deleted. -func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) +// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. +// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property +// values. +func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") +// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *deleteBareMetalServerNetworkAttachmentOptions.ID, + "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, } - 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, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") 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 listBareMetalServerNetworkAttachmentsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) + } + if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -13071,128 +13220,152 @@ func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context. 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_bare_metal_server_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_bare_metal_server_network_attachments", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface -// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs -// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server -// network interface is not allowed to be deleted. -// -// 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 is not allowed to be deleted. -func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) +// CreateBareMetalServerNetworkAttachment : Create a network attachment on a bare metal server +// This request creates a new bare metal server network attachment from a bare metal server network attachment prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network attachment, and +// contains the information necessary to create the new bare metal server network attachment. +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachment(createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateBareMetalServerNetworkAttachmentWithContext(context.Background(), createBareMetalServerNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") +// CreateBareMetalServerNetworkAttachmentWithContext is an alternate form of the CreateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, createBareMetalServerNetworkAttachmentOptions *CreateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(createBareMetalServerNetworkAttachmentOptions, "createBareMetalServerNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *deleteBareMetalServerNetworkInterfaceOptions.ID, + "bare_metal_server_id": *createBareMetalServerNetworkAttachmentOptions.BareMetalServerID, } - 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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range createBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkAttachment") 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(createBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPrototype) + 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_bare_metal_server_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_bare_metal_server_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetBareMetalServer : Retrieve a bare metal server -// This request retrieves a single bare metal server specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) +// DeleteBareMetalServerNetworkAttachment : Delete a bare metal server network attachment +// This request deletes a bare metal server network attachment. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network attachment are implicitly disassociated. +// +// The bare metal server's primary network attachment cannot be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachment(deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteBareMetalServerNetworkAttachmentWithContext(context.Background(), deleteBareMetalServerNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") +// DeleteBareMetalServerNetworkAttachmentWithContext is an alternate form of the DeleteBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkAttachmentWithContext(ctx context.Context, deleteBareMetalServerNetworkAttachmentOptions *DeleteBareMetalServerNetworkAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") + err = core.ValidateStruct(deleteBareMetalServerNetworkAttachmentOptions, "deleteBareMetalServerNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getBareMetalServerOptions.ID, + "bare_metal_server_id": *deleteBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkAttachmentOptions.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, `/bare_metal_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkAttachment") 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)) @@ -13203,65 +13376,56 @@ func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMeta 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_bare_metal_server", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_bare_metal_server_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetBareMetalServerDisk : Retrieve a bare metal server disk -// This request retrieves a single disk specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerDisk(getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerDiskWithContext(context.Background(), getBareMetalServerDiskOptions) +// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment +// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerDiskWithContext is an alternate form of the GetBareMetalServerDisk method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBareMetalServerDiskOptions *GetBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions cannot be nil") +// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerDiskOptions, "getBareMetalServerDiskOptions") + err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerDiskOptions.BareMetalServerID, - "id": *getBareMetalServerDiskOptions.ID, + "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkAttachmentOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerDiskOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13279,12 +13443,12 @@ func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBare var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bare_metal_server_disk", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13295,55 +13459,63 @@ func (vpc *VpcV1) GetBareMetalServerDiskWithContext(ctx context.Context, getBare return } -// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server -// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and -// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be -// current. -func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) +// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment +// This request updates a bare metal server network attachment with the information provided in a bare metal server +// network attachment patch object. The bare metal server network attachment patch object is structured in the same way +// as a retrieved bare metal server network attachment and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") +// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") + err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getBareMetalServerInitializationOptions.ID, + "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkAttachmentOptions.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, `/bare_metal_servers/{id}/initialization`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { + for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") 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(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) + 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()) @@ -13353,12 +13525,12 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bare_metal_server_initialization", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_bare_metal_server_network_attachment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13369,46 +13541,52 @@ func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Contex return } -// GetBareMetalServerNetworkAttachment : Retrieve a bare metal server network attachment -// This request retrieves a single bare metal server network attachment specified by the identifier in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkAttachment(getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerNetworkAttachmentWithContext(context.Background(), getBareMetalServerNetworkAttachmentOptions) +// ListBareMetalServerNetworkInterfaces : List network interfaces on a bare metal server +// This request lists network interfaces on a bare metal server. A bare metal server network interface is an abstract +// representation of a network device and attaches a bare metal server to a single subnet. Each network interface on a +// bare metal server can attach to any subnet in the zone, including subnets that are already attached to the bare metal +// server. +// +// If this bare metal server has network attachments, each returned 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. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerNetworkAttachmentWithContext is an alternate form of the GetBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Context, getBareMetalServerNetworkAttachmentOptions *GetBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions cannot be nil") +// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerNetworkAttachmentOptions, "getBareMetalServerNetworkAttachmentOptions") + err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *getBareMetalServerNetworkAttachmentOptions.ID, + "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13416,6 +13594,12 @@ func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Con builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listBareMetalServerNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) + } + if listBareMetalServerNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -13426,12 +13610,12 @@ func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bare_metal_server_network_attachment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_bare_metal_server_network_interfaces", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13442,58 +13626,68 @@ func (vpc *VpcV1) GetBareMetalServerNetworkAttachmentWithContext(ctx context.Con return } -// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface -// This request retrieves a single bare metal server network interface specified by the identifier in the URL. +// CreateBareMetalServerNetworkInterface : Create a network interface on a bare metal server +// This request creates a new bare metal server network interface from a bare metal server network interface prototype +// object. The prototype object is structured in the same way as a retrieved bare metal server network interface, and +// contains the information necessary to create the new bare metal server network interface. Any subnet in the bare +// metal server's VPC may be specified, even if it is already attached to another bare metal server network interface. +// Addresses on the bare metal server network interface must be within the specified subnet's CIDR blocks. // -// If this bare metal server has network attachments, the retrieved network interface is a [read-only +// 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. -func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) +// attachment and its attached virtual network interface, and new network interfaces are not allowed to be created. +func (vpc *VpcV1) CreateBareMetalServerNetworkInterface(createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateBareMetalServerNetworkInterfaceWithContext(context.Background(), createBareMetalServerNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") +// CreateBareMetalServerNetworkInterfaceWithContext is an alternate form of the CreateBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, createBareMetalServerNetworkInterfaceOptions *CreateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") + err = core.ValidateStruct(createBareMetalServerNetworkInterfaceOptions, "createBareMetalServerNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *getBareMetalServerNetworkInterfaceOptions.ID, + "bare_metal_server_id": *createBareMetalServerNetworkInterfaceOptions.BareMetalServerID, } - 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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { + for headerName, headerValue := range createBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBareMetalServerNetworkInterface") 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(createBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePrototype) + 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()) @@ -13503,7 +13697,7 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bare_metal_server_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_bare_metal_server_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -13519,52 +13713,55 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Cont return } -// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP if it is associated with the bare metal server network interface -// specified in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) +// DeleteBareMetalServerNetworkInterface : Delete a bare metal server network interface +// This request deletes a bare metal server network interface. This operation cannot be reversed. Any floating IPs +// associated with the bare metal server network interface are implicitly disassociated. The primary bare metal server +// network interface is not allowed to be deleted. +// +// 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 is not allowed to be deleted. +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterface(deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteBareMetalServerNetworkInterfaceWithContext(context.Background(), deleteBareMetalServerNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") +// DeleteBareMetalServerNetworkInterfaceWithContext is an alternate form of the DeleteBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerNetworkInterfaceWithContext(ctx context.Context, deleteBareMetalServerNetworkInterfaceOptions *DeleteBareMetalServerNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(deleteBareMetalServerNetworkInterfaceOptions, "deleteBareMetalServerNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + "bare_metal_server_id": *deleteBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *deleteBareMetalServerNetworkInterfaceOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServerNetworkInterface") 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)) @@ -13575,69 +13772,60 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co 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_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_bare_metal_server_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP -// This request retrieves the primary reserved IP for a bare metal server network interface. -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) +// GetBareMetalServerNetworkInterface : Retrieve a bare metal server network interface +// This request retrieves a single bare metal server network interface specified by the identifier in the URL. +// +// If this bare metal server has network attachments, the retrieved 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. +func (vpc *VpcV1) GetBareMetalServerNetworkInterface(getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerNetworkInterfaceWithContext(context.Background(), getBareMetalServerNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter -// Deprecated: this method is deprecated and may be removed in a future release. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP") - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") +// GetBareMetalServerNetworkInterfaceWithContext is an alternate form of the GetBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceOptions *GetBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceOptions, "getBareMetalServerNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceIPOptions.ID, + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *getBareMetalServerNetworkInterfaceOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterface") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13655,12 +13843,12 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bare_metal_server_network_interface_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server_network_interface", 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, UnmarshalBareMetalServerNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13671,53 +13859,67 @@ func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Co return } -// GetBareMetalServerProfile : Retrieve a bare metal server profile -// This request retrieves a single bare metal server profile specified by the name in the URL. -func (vpc *VpcV1) GetBareMetalServerProfile(getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBareMetalServerProfileWithContext(context.Background(), getBareMetalServerProfileOptions) +// UpdateBareMetalServerNetworkInterface : Update a bare metal server network interface +// This request updates a bare metal server network interface with the information provided in a bare metal server +// network interface patch object. The bare metal server network interface patch object is structured in the same way as +// a retrieved bare metal server network interface and needs to contain only the information to be updated. +// +// 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 is not allowed to be updated. +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBareMetalServerProfileWithContext is an alternate form of the GetBareMetalServerProfile method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getBareMetalServerProfileOptions *GetBareMetalServerProfileOptions) (result *BareMetalServerProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions cannot be nil") +// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBareMetalServerProfileOptions, "getBareMetalServerProfileOptions") + err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getBareMetalServerProfileOptions.Name, + "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, + "id": *updateBareMetalServerNetworkInterfaceOptions.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, `/bare_metal_server/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBareMetalServerProfileOptions.Headers { + for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") 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(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) + 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()) @@ -13727,12 +13929,12 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bare_metal_server_profile", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_bare_metal_server_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13743,46 +13945,46 @@ func (vpc *VpcV1) GetBareMetalServerProfileWithContext(ctx context.Context, getB return } -// ListBareMetalServerDisks : List disks on a bare metal server -// This request lists disks on a bare metal server. A disk is a block device that is locally attached to the physical -// server. By default, the listed disks are sorted by their `created_at` property values, with the newest disk first. -func (vpc *VpcV1) ListBareMetalServerDisks(listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerDisksWithContext(context.Background(), listBareMetalServerDisksOptions) +// ListBareMetalServerNetworkInterfaceFloatingIps : List floating IPs associated with a bare metal server network interface +// This request lists floating IPs associated with a bare metal server network interface. +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBareMetalServerDisksWithContext is an alternate form of the ListBareMetalServerDisks method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listBareMetalServerDisksOptions *ListBareMetalServerDisksOptions) (result *BareMetalServerDiskCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions cannot be nil") +// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBareMetalServerDisksOptions, "listBareMetalServerDisksOptions") + err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerDisksOptions.BareMetalServerID, + "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, + "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/disks`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerDisksOptions.Headers { + for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerDisks") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13800,12 +14002,12 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_bare_metal_server_disks", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_bare_metal_server_network_interface_floating_ips", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDiskCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13816,66 +14018,120 @@ func (vpc *VpcV1) ListBareMetalServerDisksWithContext(ctx context.Context, listB return } -// ListBareMetalServerNetworkAttachments : List network attachments on a bare metal server -// This request lists network attachments on a bare metal server. A bare metal server network attachment is an abstract -// representation of a network device and attaches a bare metal server to a single subnet. Each network interface on a -// bare metal server can attach to any subnet in the zone, including subnets that are already attached to the bare metal -// server. -// -// The network attachments will be sorted by their `created_at` property values, with newest network attachments first. -// Network attachments with identical `created_at` property values will in turn be sorted by ascending `name` property -// values. -func (vpc *VpcV1) ListBareMetalServerNetworkAttachments(listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerNetworkAttachmentsWithContext(context.Background(), listBareMetalServerNetworkAttachmentsOptions) +// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface +// This request disassociates the specified floating IP from the specified bare metal server network interface. +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBareMetalServerNetworkAttachmentsWithContext is an alternate form of the ListBareMetalServerNetworkAttachments method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.Context, listBareMetalServerNetworkAttachmentsOptions *ListBareMetalServerNetworkAttachmentsOptions) (result *BareMetalServerNetworkAttachmentCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions cannot be nil") +// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBareMetalServerNetworkAttachmentsOptions, "listBareMetalServerNetworkAttachmentsOptions") + err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkAttachmentsOptions.BareMetalServerID, + "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_attachments`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerNetworkAttachmentsOptions.Headers { + for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkAttachments") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") 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 listBareMetalServerNetworkAttachmentsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Start)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - if listBareMetalServerNetworkAttachmentsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkAttachmentsOptions.Limit)) + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "remove_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// GetBareMetalServerNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP if it is associated with the bare metal server network interface +// specified in the URL. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIP(getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceFloatingIPOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceFloatingIPOptions *GetBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceFloatingIPOptions, "getBareMetalServerNetworkInterfaceFloatingIPOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) } + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceFloatingIP") + 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()) @@ -13885,12 +14141,12 @@ func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.C var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_bare_metal_server_network_attachments", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachmentCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -13901,46 +14157,55 @@ func (vpc *VpcV1) ListBareMetalServerNetworkAttachmentsWithContext(ctx context.C return } -// ListBareMetalServerNetworkInterfaceFloatingIps : List floating IPs associated with a bare metal server network interface -// This request lists floating IPs associated with a bare metal server network interface. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIps(listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceFloatingIpsOptions) +// AddBareMetalServerNetworkInterfaceFloatingIP : Associate a floating IP with a bare metal server network interface +// This request associates the specified floating IP with the specified bare metal server network interface. If +// `enable_infrastructure_nat` is `false`, this adds the IP to any existing associations. If `enable_infrastructure_nat` +// is `true`, this replaces any existing association. +// +// The existing floating IP must: +// - not be required by another resource, such as a public gateway +// - be in the same `zone` as the bare metal server +// +// A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIP(addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.AddBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), addBareMetalServerNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBareMetalServerNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceFloatingIpsOptions *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions cannot be nil") +// AddBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the AddBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, addBareMetalServerNetworkInterfaceFloatingIPOptions *AddBareMetalServerNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBareMetalServerNetworkInterfaceFloatingIpsOptions, "listBareMetalServerNetworkInterfaceFloatingIpsOptions") + err = core.ValidateStruct(addBareMetalServerNetworkInterfaceFloatingIPOptions, "addBareMetalServerNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.BareMetalServerID, - "network_interface_id": *listBareMetalServerNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, + "bare_metal_server_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, + "network_interface_id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addBareMetalServerNetworkInterfaceFloatingIPOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerNetworkInterfaceFloatingIpsOptions.Headers { + for headerName, headerValue := range addBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceFloatingIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddBareMetalServerNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -13958,12 +14223,12 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceFloatingIpsWithContext(ctx var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_bare_metal_server_network_interface_floating_ips", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14050,52 +14315,50 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context. return } -// ListBareMetalServerNetworkInterfaces : List network interfaces on a bare metal server -// This request lists network interfaces on a bare metal server. A bare metal server network interface is an abstract -// representation of a network device and attaches a bare metal server to a single subnet. Each network interface on a -// bare metal server can attach to any subnet in the zone, including subnets that are already attached to the bare metal -// server. -// -// If this bare metal server has network attachments, each returned 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. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaces(listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerNetworkInterfacesWithContext(context.Background(), listBareMetalServerNetworkInterfacesOptions) +// GetBareMetalServerNetworkInterfaceIP : Retrieve the primary reserved IP +// This request retrieves the primary reserved IP for a bare metal server network interface. +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBareMetalServerNetworkInterfacesWithContext is an alternate form of the ListBareMetalServerNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Context, listBareMetalServerNetworkInterfacesOptions *ListBareMetalServerNetworkInterfacesOptions) (result *BareMetalServerNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions cannot be nil") +// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter +// Deprecated: this method is deprecated and may be removed in a future release. +func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + core.GetLogger().Warn("A deprecated operation has been invoked: GetBareMetalServerNetworkInterfaceIP") + err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBareMetalServerNetworkInterfacesOptions, "listBareMetalServerNetworkInterfacesOptions") + err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfacesOptions.BareMetalServerID, + "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, + "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, + "id": *getBareMetalServerNetworkInterfaceIPOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerNetworkInterfacesOptions.Headers { + for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaces") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -14103,12 +14366,6 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listBareMetalServerNetworkInterfacesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Start)) - } - if listBareMetalServerNetworkInterfacesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerNetworkInterfacesOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -14119,12 +14376,12 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_bare_metal_server_network_interfaces", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server_network_interface_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterfaceCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14135,51 +14392,115 @@ func (vpc *VpcV1) ListBareMetalServerNetworkInterfacesWithContext(ctx context.Co return } -// ListBareMetalServerProfiles : List bare metal server profiles -// This request lists [bare metal server profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) -// available in the region. A bare metal server profile specifies the performance characteristics and pricing model for -// a bare metal server. -func (vpc *VpcV1) ListBareMetalServerProfiles(listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServerProfilesWithContext(context.Background(), listBareMetalServerProfilesOptions) +// DeleteBareMetalServer : Delete a bare metal server +// This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the +// bare metal server network interfaces are implicitly disassociated. +func (vpc *VpcV1) DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteBareMetalServerWithContext(context.Background(), deleteBareMetalServerOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBareMetalServerProfilesWithContext is an alternate form of the ListBareMetalServerProfiles method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, listBareMetalServerProfilesOptions *ListBareMetalServerProfilesOptions) (result *BareMetalServerProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBareMetalServerProfilesOptions, "listBareMetalServerProfilesOptions") +// DeleteBareMetalServerWithContext is an alternate form of the DeleteBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) DeleteBareMetalServerWithContext(ctx context.Context, deleteBareMetalServerOptions *DeleteBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBareMetalServerOptions, "deleteBareMetalServerOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteBareMetalServerOptions, "deleteBareMetalServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *deleteBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_server/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServerProfilesOptions.Headers { + for headerName, headerValue := range deleteBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBareMetalServer") 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 listBareMetalServerProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServerProfilesOptions.Start)) + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - if listBareMetalServerProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServerProfilesOptions.Limit)) + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// GetBareMetalServer : Retrieve a bare metal server +// This request retrieves a single bare metal server specified by the identifier in the URL. +func (vpc *VpcV1) GetBareMetalServer(getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerWithContext(context.Background(), getBareMetalServerOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetBareMetalServerWithContext is an alternate form of the GetBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerWithContext(ctx context.Context, getBareMetalServerOptions *GetBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerOptions, "getBareMetalServerOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getBareMetalServerOptions, "getBareMetalServerOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *getBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getBareMetalServerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServer") + 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 { @@ -14190,12 +14511,12 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_bare_metal_server_profiles", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_bare_metal_server", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14206,63 +14527,59 @@ func (vpc *VpcV1) ListBareMetalServerProfilesWithContext(ctx context.Context, li return } -// ListBareMetalServers : List bare metal servers -// This request lists bare metal servers in the region. -func (vpc *VpcV1) ListBareMetalServers(listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBareMetalServersWithContext(context.Background(), listBareMetalServersOptions) +// UpdateBareMetalServer : Update a bare metal server +// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object +// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. +func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBareMetalServersWithContext is an alternate form of the ListBareMetalServers method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareMetalServersOptions *ListBareMetalServersOptions) (result *BareMetalServerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBareMetalServersOptions, "listBareMetalServersOptions") +// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *updateBareMetalServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBareMetalServersOptions.Headers { + for headerName, headerValue := range updateBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") 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 listBareMetalServersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBareMetalServersOptions.Start)) - } - if listBareMetalServersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBareMetalServersOptions.Limit)) - } - if listBareMetalServersOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBareMetalServersOptions.ResourceGroupID)) - } - if listBareMetalServersOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) - } - if listBareMetalServersOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) - } - if listBareMetalServersOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listBareMetalServersOptions.VPCCRN)) - } - if listBareMetalServersOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listBareMetalServersOptions.VPCName)) + + _, err = builder.SetBodyContentJSON(updateBareMetalServerOptions.BareMetalServerPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -14274,12 +14591,12 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_bare_metal_servers", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_bare_metal_server", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14290,54 +14607,63 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM return } -// RemoveBareMetalServerNetworkInterfaceFloatingIP : Disassociate a floating IP from a bare metal server network interface -// This request disassociates the specified floating IP from the specified bare metal server network interface. -func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIP(removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(context.Background(), removeBareMetalServerNetworkInterfaceFloatingIPOptions) +// UpdateFirmwareForBareMetalServer : Update firmware for a bare metal server +// This request updates a bare metal server to the latest available firmware. The server must be stopped. +func (vpc *VpcV1) UpdateFirmwareForBareMetalServer(updateFirmwareForBareMetalServerOptions *UpdateFirmwareForBareMetalServerOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.UpdateFirmwareForBareMetalServerWithContext(context.Background(), updateFirmwareForBareMetalServerOptions) err = core.RepurposeSDKProblem(err, "") return } -// RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveBareMetalServerNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeBareMetalServerNetworkInterfaceFloatingIPOptions *RemoveBareMetalServerNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions cannot be nil") +// UpdateFirmwareForBareMetalServerWithContext is an alternate form of the UpdateFirmwareForBareMetalServer method which supports a Context parameter +func (vpc *VpcV1) UpdateFirmwareForBareMetalServerWithContext(ctx context.Context, updateFirmwareForBareMetalServerOptions *UpdateFirmwareForBareMetalServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateFirmwareForBareMetalServerOptions, "updateFirmwareForBareMetalServerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(removeBareMetalServerNetworkInterfaceFloatingIPOptions, "removeBareMetalServerNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(updateFirmwareForBareMetalServerOptions, "updateFirmwareForBareMetalServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.BareMetalServerID, - "network_interface_id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, - "id": *removeBareMetalServerNetworkInterfaceFloatingIPOptions.ID, + "id": *updateFirmwareForBareMetalServerOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/firmware/update`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range removeBareMetalServerNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range updateFirmwareForBareMetalServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveBareMetalServerNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFirmwareForBareMetalServer") 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 updateFirmwareForBareMetalServerOptions.AutoStart != nil { + body["auto_start"] = updateFirmwareForBareMetalServerOptions.AutoStart + } + _, 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()) @@ -14346,10 +14672,84 @@ func (vpc *VpcV1) RemoveBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "remove_bare_metal_server_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_firmware_for_bare_metal_server", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// GetBareMetalServerInitialization : Retrieve initialization configuration for a bare metal server +// This request retrieves configuration used to initialize the bare metal server, such as the image used, SSH keys, and +// any configured usernames and passwords. These can subsequently be changed on the server and therefore may not be +// current. +func (vpc *VpcV1) GetBareMetalServerInitialization(getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBareMetalServerInitializationWithContext(context.Background(), getBareMetalServerInitializationOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetBareMetalServerInitializationWithContext is an alternate form of the GetBareMetalServerInitialization method which supports a Context parameter +func (vpc *VpcV1) GetBareMetalServerInitializationWithContext(ctx context.Context, getBareMetalServerInitializationOptions *GetBareMetalServerInitializationOptions) (result *BareMetalServerInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getBareMetalServerInitializationOptions, "getBareMetalServerInitializationOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *getBareMetalServerInitializationOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/initialization`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getBareMetalServerInitializationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerInitialization") + 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_bare_metal_server_initialization", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerInitialization) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } @@ -14643,59 +15043,49 @@ func (vpc *VpcV1) StopBareMetalServerWithContext(ctx context.Context, stopBareMe return } -// UpdateBareMetalServer : Update a bare metal server -// This request updates a bare metal server with the information in a provided patch. The bare metal server patch object -// is structured in the same way as a retrieved bare metal server and contains only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServer(updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBareMetalServerWithContext(context.Background(), updateBareMetalServerOptions) +// ListVolumeProfiles : List volume profiles +// This request lists [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available in +// the region. A volume profile specifies the performance characteristics and pricing model for a volume. +func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateBareMetalServerWithContext is an alternate form of the UpdateBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBareMetalServerOptions *UpdateBareMetalServerOptions) (result *BareMetalServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerOptions, "updateBareMetalServerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateBareMetalServerOptions, "updateBareMetalServerOptions") +// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter +func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *updateBareMetalServerOptions.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, `/bare_metal_servers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBareMetalServerOptions.Headers { + for headerName, headerValue := range listVolumeProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") 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(updateBareMetalServerOptions.BareMetalServerPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listVolumeProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) + } + if listVolumeProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) } request, err := builder.Build() @@ -14707,12 +15097,12 @@ func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBa var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_bare_metal_server", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_volume_profiles", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14723,61 +15113,53 @@ func (vpc *VpcV1) UpdateBareMetalServerWithContext(ctx context.Context, updateBa return } -// UpdateBareMetalServerDisk : Update a bare metal server disk -// This request updates the bare metal server disk with the information in a provided patch. -func (vpc *VpcV1) UpdateBareMetalServerDisk(updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBareMetalServerDiskWithContext(context.Background(), updateBareMetalServerDiskOptions) +// GetVolumeProfile : Retrieve a volume profile +// This request retrieves a single volume profile specified by the name in the URL. +func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateBareMetalServerDiskWithContext is an alternate form of the UpdateBareMetalServerDisk method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, updateBareMetalServerDiskOptions *UpdateBareMetalServerDiskOptions) (result *BareMetalServerDisk, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions cannot be nil") +// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter +func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateBareMetalServerDiskOptions, "updateBareMetalServerDiskOptions") + err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerDiskOptions.BareMetalServerID, - "id": *updateBareMetalServerDiskOptions.ID, + "name": *getVolumeProfileOptions.Name, } - 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, `/bare_metal_servers/{bare_metal_server_id}/disks/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBareMetalServerDiskOptions.Headers { + for headerName, headerValue := range getVolumeProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerDisk") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") 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(updateBareMetalServerDiskOptions.BareMetalServerDiskPatch) - 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()) @@ -14787,12 +15169,12 @@ func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, upda var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_bare_metal_server_disk", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_volume_profile", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerDisk) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14803,147 +15185,70 @@ func (vpc *VpcV1) UpdateBareMetalServerDiskWithContext(ctx context.Context, upda return } -// UpdateBareMetalServerNetworkAttachment : Update a bare metal server network attachment -// This request updates a bare metal server network attachment with the information provided in a bare metal server -// network attachment patch object. The bare metal server network attachment patch object is structured in the same way -// as a retrieved bare metal server network attachment and contains only the information to be updated. -func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachment(updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBareMetalServerNetworkAttachmentWithContext(context.Background(), updateBareMetalServerNetworkAttachmentOptions) +// ListVolumes : List volumes +// This request lists volumes in the region. Volumes are network-connected block storage devices that may be attached to +// one or more instances in the same region. +func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateBareMetalServerNetworkAttachmentWithContext is an alternate form of the UpdateBareMetalServerNetworkAttachment method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerNetworkAttachmentWithContext(ctx context.Context, updateBareMetalServerNetworkAttachmentOptions *UpdateBareMetalServerNetworkAttachmentOptions) (result BareMetalServerNetworkAttachmentIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateBareMetalServerNetworkAttachmentOptions, "updateBareMetalServerNetworkAttachmentOptions") +// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter +func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerNetworkAttachmentOptions.BareMetalServerID, - "id": *updateBareMetalServerNetworkAttachmentOptions.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, `/bare_metal_servers/{bare_metal_server_id}/network_attachments/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBareMetalServerNetworkAttachmentOptions.Headers { + for headerName, headerValue := range listVolumesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkAttachment") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") 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(updateBareMetalServerNetworkAttachmentOptions.BareMetalServerNetworkAttachmentPatch) - 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_bare_metal_server_network_attachment", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return + if listVolumesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkAttachment) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result + if listVolumesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) } - - return -} - -// UpdateBareMetalServerNetworkInterface : Update a bare metal server network interface -// This request updates a bare metal server network interface with the information provided in a bare metal server -// network interface patch object. The bare metal server network interface patch object is structured in the same way as -// a retrieved bare metal server network interface and needs to contain only the information to be updated. -// -// 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 is not allowed to be updated. -func (vpc *VpcV1) UpdateBareMetalServerNetworkInterface(updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBareMetalServerNetworkInterfaceWithContext(context.Background(), updateBareMetalServerNetworkInterfaceOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateBareMetalServerNetworkInterfaceWithContext is an alternate form of the UpdateBareMetalServerNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.Context, updateBareMetalServerNetworkInterfaceOptions *UpdateBareMetalServerNetworkInterfaceOptions) (result BareMetalServerNetworkInterfaceIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return + if listVolumesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) } - err = core.ValidateStruct(updateBareMetalServerNetworkInterfaceOptions, "updateBareMetalServerNetworkInterfaceOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return + if listVolumesOptions.AttachmentState != nil { + builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *updateBareMetalServerNetworkInterfaceOptions.BareMetalServerID, - "id": *updateBareMetalServerNetworkInterfaceOptions.ID, + if listVolumesOptions.Encryption != nil { + builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return + if listVolumesOptions.OperatingSystemFamily != nil { + builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) } - - for headerName, headerValue := range updateBareMetalServerNetworkInterfaceOptions.Headers { - builder.AddHeader(headerName, headerValue) + if listVolumesOptions.OperatingSystemArchitecture != nil { + builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBareMetalServerNetworkInterface") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) + if listVolumesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) } - 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(updateBareMetalServerNetworkInterfaceOptions.BareMetalServerNetworkInterfacePatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listVolumesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) } request, err := builder.Build() @@ -14955,12 +15260,12 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_bare_metal_server_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_volumes", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBareMetalServerNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -14971,79 +15276,6 @@ func (vpc *VpcV1) UpdateBareMetalServerNetworkInterfaceWithContext(ctx context.C return } -// UpdateFirmwareForBareMetalServer : Update firmware for a bare metal server -// This request updates a bare metal server to the latest available firmware. The server must be stopped. -func (vpc *VpcV1) UpdateFirmwareForBareMetalServer(updateFirmwareForBareMetalServerOptions *UpdateFirmwareForBareMetalServerOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.UpdateFirmwareForBareMetalServerWithContext(context.Background(), updateFirmwareForBareMetalServerOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateFirmwareForBareMetalServerWithContext is an alternate form of the UpdateFirmwareForBareMetalServer method which supports a Context parameter -func (vpc *VpcV1) UpdateFirmwareForBareMetalServerWithContext(ctx context.Context, updateFirmwareForBareMetalServerOptions *UpdateFirmwareForBareMetalServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateFirmwareForBareMetalServerOptions, "updateFirmwareForBareMetalServerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateFirmwareForBareMetalServerOptions, "updateFirmwareForBareMetalServerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateFirmwareForBareMetalServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{id}/firmware/update`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateFirmwareForBareMetalServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFirmwareForBareMetalServer") - 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 updateFirmwareForBareMetalServerOptions.AutoStart != nil { - body["auto_start"] = updateFirmwareForBareMetalServerOptions.AutoStart - } - _, 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, "update_firmware_for_bare_metal_server", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - return -} - // CreateVolume : Create a volume // This request creates a new volume from a volume prototype object. The prototype object is structured in the same way // as a retrieved volume, and contains the information necessary to create the new volume. @@ -15258,123 +15490,64 @@ func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *Ge return } -// GetVolumeProfile : Retrieve a volume profile -// This request retrieves a single volume profile specified by the name in the URL. -func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) +// UpdateVolume : Update a volume +// This request updates a volume with the information in a provided volume patch. The volume patch object is structured +// in the same way as a retrieved volume and contains only the information to be updated. +func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter -func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") +// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter +func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") + err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getVolumeProfileOptions.Name, + "id": *updateVolumeOptions.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, `/volume/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVolumeProfileOptions.Headers { + for headerName, headerValue := range updateVolumeOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVolumeOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) + } 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_volume_profile", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// ListVolumeProfiles : List volume profiles -// This request lists [volume profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-profiles) available in -// the region. A volume profile specifies the performance characteristics and pricing model for a volume. -func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter -func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") - 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, `/volume/profiles`, nil) + _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) 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 listVolumeProfilesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") - 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 listVolumeProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) - } - if listVolumeProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) - } - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -15384,12 +15557,12 @@ func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeP var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_volume_profiles", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_volume", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15400,18 +15573,18 @@ func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeP return } -// ListVolumes : List volumes -// This request lists volumes in the region. Volumes are network-connected block storage devices that may be attached to -// one or more instances in the same region. -func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) +// ListSnapshotConsistencyGroups : List snapshot consistency groups +// This request lists snapshot consistency groups in the region. A snapshot consistency group is a collection of +// individual snapshots taken at the same time. +func (vpc *VpcV1) ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter -func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") +// ListSnapshotConsistencyGroupsWithContext is an alternate form of the ListSnapshotConsistencyGroups method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSnapshotConsistencyGroupsOptions, "listSnapshotConsistencyGroupsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -15420,17 +15593,17 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVolumesOptions.Headers { + for headerName, headerValue := range listSnapshotConsistencyGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15438,32 +15611,23 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listVolumesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) - } - if listVolumesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) - } - if listVolumesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) - } - if listVolumesOptions.AttachmentState != nil { - builder.AddQuery("attachment_state", fmt.Sprint(*listVolumesOptions.AttachmentState)) + if listSnapshotConsistencyGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Start)) } - if listVolumesOptions.Encryption != nil { - builder.AddQuery("encryption", fmt.Sprint(*listVolumesOptions.Encryption)) + if listSnapshotConsistencyGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Limit)) } - if listVolumesOptions.OperatingSystemFamily != nil { - builder.AddQuery("operating_system.family", fmt.Sprint(*listVolumesOptions.OperatingSystemFamily)) + if listSnapshotConsistencyGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.ResourceGroupID)) } - if listVolumesOptions.OperatingSystemArchitecture != nil { - builder.AddQuery("operating_system.architecture", fmt.Sprint(*listVolumesOptions.OperatingSystemArchitecture)) + if listSnapshotConsistencyGroupsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Name)) } - if listVolumesOptions.ZoneName != nil { - builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) + if listSnapshotConsistencyGroupsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Sort)) } - if listVolumesOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listVolumesOptions.Tag)) + if listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID)) } request, err := builder.Build() @@ -15475,12 +15639,12 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_volumes", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_snapshot_consistency_groups", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroupCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15491,59 +15655,53 @@ func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions return } -// UpdateVolume : Update a volume -// This request updates a volume with the information in a provided volume patch. The volume patch object is structured -// in the same way as a retrieved volume and contains only the information to be updated. -func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) +// CreateSnapshotConsistencyGroup : Create a snapshot consistency group +// This request creates a new snapshot consistency group from a snapshot consistency group object. The prototype object +// is structured in the same way as a retrieved consistency group, and contains the information necessary to provision +// the new snapshot consistency group. +func (vpc *VpcV1) CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSnapshotConsistencyGroupWithContext(context.Background(), createSnapshotConsistencyGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter -func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") +// CreateSnapshotConsistencyGroupWithContext is an alternate form of the CreateSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") + err = core.ValidateStruct(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *updateVolumeOptions.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, `/volumes/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVolumeOptions.Headers { + for headerName, headerValue := range createSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateVolumeOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVolumeOptions.IfMatch)) - } + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) + _, err = builder.SetBodyContentJSON(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -15558,12 +15716,12 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_volume", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_snapshot_consistency_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15574,57 +15732,54 @@ func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptio return } -// CreateSnapshot : Create a snapshot -// This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same -// way as a retrieved snapshot, and contains the information necessary to provision the new snapshot. -func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) +// DeleteSnapshotConsistencyGroup : Delete a snapshot consistency group +// This request deletes snapshot consistency group. This operation cannot be reversed. If the +// `delete_snapshots_on_delete` property is `true`, all snapshots in the consistency group will also be deleted. +func (vpc *VpcV1) DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteSnapshotConsistencyGroupWithContext(context.Background(), deleteSnapshotConsistencyGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil") +// DeleteSnapshotConsistencyGroupWithContext is an alternate form of the DeleteSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") + err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *deleteSnapshotConsistencyGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSnapshotOptions.Headers { + for headerName, headerValue := range deleteSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotConsistencyGroup") 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(createSnapshotOptions.SnapshotPrototype) - 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()) @@ -15634,12 +15789,12 @@ func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_snapshot", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_snapshot_consistency_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15650,47 +15805,45 @@ func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotO return } -// CreateSnapshotClone : Create a clone for a snapshot -// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if -// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. -func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) +// GetSnapshotConsistencyGroup : Retrieve a snapshot consistency group +// This request retrieves a single snapshot consistency group specified by the identifier in the URL. +func (vpc *VpcV1) GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSnapshotConsistencyGroupWithContext(context.Background(), getSnapshotConsistencyGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") +// GetSnapshotConsistencyGroupWithContext is an alternate form of the GetSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") + err = core.ValidateStruct(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *createSnapshotCloneOptions.ID, - "zone_name": *createSnapshotCloneOptions.ZoneName, + "id": *getSnapshotConsistencyGroupOptions.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, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSnapshotCloneOptions.Headers { + for headerName, headerValue := range getSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -15708,12 +15861,12 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_snapshot_clone", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_snapshot_consistency_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -15724,53 +15877,60 @@ func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnap return } -// CreateSnapshotConsistencyGroup : Create a snapshot consistency group -// This request creates a new snapshot consistency group from a snapshot consistency group object. The prototype object -// is structured in the same way as a retrieved consistency group, and contains the information necessary to provision -// the new snapshot consistency group. -func (vpc *VpcV1) CreateSnapshotConsistencyGroup(createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateSnapshotConsistencyGroupWithContext(context.Background(), createSnapshotConsistencyGroupOptions) +// UpdateSnapshotConsistencyGroup : Update a snapshot consistency group +// This request updates a snapshot consistency group with the information in a provided snapshot consistency group +// patch. The snapshot consistency group patch object is structured in the same way as a retrieved snapshot consistency +// group and contains only the information to be updated. +func (vpc *VpcV1) UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateSnapshotConsistencyGroupWithContext(context.Background(), updateSnapshotConsistencyGroupOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSnapshotConsistencyGroupWithContext is an alternate form of the CreateSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, createSnapshotConsistencyGroupOptions *CreateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions cannot be nil") +// UpdateSnapshotConsistencyGroupWithContext is an alternate form of the UpdateSnapshotConsistencyGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSnapshotConsistencyGroupOptions, "createSnapshotConsistencyGroupOptions") + err = core.ValidateStruct(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *updateSnapshotConsistencyGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup") 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 updateSnapshotConsistencyGroupOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotConsistencyGroupOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPrototype) + _, err = builder.SetBodyContentJSON(updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -15785,7 +15945,7 @@ func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_snapshot_consistency_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_snapshot_consistency_group", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -15801,54 +15961,48 @@ func (vpc *VpcV1) CreateSnapshotConsistencyGroupWithContext(ctx context.Context, return } -// DeleteSnapshot : Delete a snapshot -// This request deletes a snapshot. This operation cannot be reversed. -func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) +// DeleteSnapshots : Delete a filtered collection of snapshots +// This request deletes snapshots that match the specified filter. This operation cannot be reversed. +func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSnapshotWithContext is an alternate form of the DeleteSnapshot method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotOptions, "deleteSnapshotOptions cannot be nil") +// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") + err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *deleteSnapshotOptions.ID, - } - builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSnapshotOptions.Headers { + for headerName, headerValue := range deleteSnapshotsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteSnapshotOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) request, err := builder.Build() if err != nil { @@ -15858,7 +16012,7 @@ func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotO response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_snapshot", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_snapshots", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -15866,53 +16020,110 @@ func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotO return } -// DeleteSnapshotClone : Delete a snapshot clone -// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated -// from the snapshot. -func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) +// ListSnapshots : List snapshots +// This request lists snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is +// created. +func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") +// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *deleteSnapshotCloneOptions.ID, - "zone_name": *deleteSnapshotCloneOptions.ZoneName, - } - - 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, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { + for headerName, headerValue := range listSnapshotsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") 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 listSnapshotsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) + } + if listSnapshotsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) + } + if listSnapshotsOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag)) + } + if listSnapshotsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID)) + } + if listSnapshotsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name)) + } + if listSnapshotsOptions.SourceVolumeID != nil { + builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID)) + } + if listSnapshotsOptions.SourceVolumeCRN != nil { + builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN)) + } + if listSnapshotsOptions.SourceImageID != nil { + builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID)) + } + if listSnapshotsOptions.SourceImageCRN != nil { + builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN)) + } + if listSnapshotsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort)) + } + if listSnapshotsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) + } + if listSnapshotsOptions.CopiesID != nil { + builder.AddQuery("copies[].id", fmt.Sprint(*listSnapshotsOptions.CopiesID)) + } + if listSnapshotsOptions.CopiesName != nil { + builder.AddQuery("copies[].name", fmt.Sprint(*listSnapshotsOptions.CopiesName)) + } + if listSnapshotsOptions.CopiesCRN != nil { + builder.AddQuery("copies[].crn", fmt.Sprint(*listSnapshotsOptions.CopiesCRN)) + } + if listSnapshotsOptions.CopiesRemoteRegionName != nil { + builder.AddQuery("copies[].remote.region.name", fmt.Sprint(*listSnapshotsOptions.CopiesRemoteRegionName)) + } + if listSnapshotsOptions.SourceSnapshotID != nil { + builder.AddQuery("source_snapshot.id", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotID)) + } + if listSnapshotsOptions.SourceSnapshotRemoteRegionName != nil { + builder.AddQuery("source_snapshot.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotRemoteRegionName)) + } + if listSnapshotsOptions.SourceVolumeRemoteRegionName != nil { + builder.AddQuery("source_volume.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceVolumeRemoteRegionName)) + } + if listSnapshotsOptions.SourceImageRemoteRegionName != nil { + builder.AddQuery("source_image.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceImageRemoteRegionName)) + } + if listSnapshotsOptions.ClonesZoneName != nil { + builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName)) + } + if listSnapshotsOptions.SnapshotConsistencyGroupID != nil { + builder.AddQuery("snapshot_consistency_group.id", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupID)) + } + if listSnapshotsOptions.SnapshotConsistencyGroupCRN != nil { + builder.AddQuery("snapshot_consistency_group.crn", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupCRN)) + } request, err := builder.Build() if err != nil { @@ -15920,64 +16131,76 @@ func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnap 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_snapshot_clone", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_snapshots", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteSnapshotConsistencyGroup : Delete a snapshot consistency group -// This request deletes snapshot consistency group. This operation cannot be reversed. If the -// `delete_snapshots_on_delete` property is `true`, all snapshots in the consistency group will also be deleted. -func (vpc *VpcV1) DeleteSnapshotConsistencyGroup(deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteSnapshotConsistencyGroupWithContext(context.Background(), deleteSnapshotConsistencyGroupOptions) +// CreateSnapshot : Create a snapshot +// This request creates a new snapshot from a snapshot prototype object. The prototype object is structured in the same +// way as a retrieved snapshot, and contains the information necessary to provision the new snapshot. +func (vpc *VpcV1) CreateSnapshot(createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSnapshotWithContext(context.Background(), createSnapshotOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSnapshotConsistencyGroupWithContext is an alternate form of the DeleteSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, deleteSnapshotConsistencyGroupOptions *DeleteSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions cannot be nil") +// CreateSnapshotWithContext is an alternate form of the CreateSnapshot method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotWithContext(ctx context.Context, createSnapshotOptions *CreateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotOptions, "createSnapshotOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSnapshotConsistencyGroupOptions, "deleteSnapshotConsistencyGroupOptions") + err = core.ValidateStruct(createSnapshotOptions, "createSnapshotOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *deleteSnapshotConsistencyGroupOptions.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, `/snapshot_consistency_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range createSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshot") 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(createSnapshotOptions.SnapshotPrototype) + 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()) @@ -15987,12 +16210,12 @@ func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_snapshot_consistency_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_snapshot", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16003,48 +16226,54 @@ func (vpc *VpcV1) DeleteSnapshotConsistencyGroupWithContext(ctx context.Context, return } -// DeleteSnapshots : Delete a filtered collection of snapshots -// This request deletes snapshots that match the specified filter. This operation cannot be reversed. -func (vpc *VpcV1) DeleteSnapshots(deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteSnapshotsWithContext(context.Background(), deleteSnapshotsOptions) +// DeleteSnapshot : Delete a snapshot +// This request deletes a snapshot. This operation cannot be reversed. +func (vpc *VpcV1) DeleteSnapshot(deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteSnapshotWithContext(context.Background(), deleteSnapshotOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSnapshotsWithContext is an alternate form of the DeleteSnapshots method which supports a Context parameter -func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshotsOptions *DeleteSnapshotsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSnapshotsOptions, "deleteSnapshotsOptions cannot be nil") +// DeleteSnapshotWithContext is an alternate form of the DeleteSnapshot method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotWithContext(ctx context.Context, deleteSnapshotOptions *DeleteSnapshotOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotOptions, "deleteSnapshotOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSnapshotsOptions, "deleteSnapshotsOptions") + err = core.ValidateStruct(deleteSnapshotOptions, "deleteSnapshotOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *deleteSnapshotOptions.ID, + } + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSnapshotsOptions.Headers { + for headerName, headerValue := range deleteSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshots") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshot") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + if deleteSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteSnapshotOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - builder.AddQuery("source_volume.id", fmt.Sprint(*deleteSnapshotsOptions.SourceVolumeID)) request, err := builder.Build() if err != nil { @@ -16054,7 +16283,7 @@ func (vpc *VpcV1) DeleteSnapshotsWithContext(ctx context.Context, deleteSnapshot response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_snapshots", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_snapshot", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -16134,54 +16363,64 @@ func (vpc *VpcV1) GetSnapshotWithContext(ctx context.Context, getSnapshotOptions return } -// GetSnapshotClone : Retrieve a snapshot clone -// This request retrieves a single clone specified by the snapshot identifier and zone name in the URL. -func (vpc *VpcV1) GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSnapshotCloneWithContext(context.Background(), getSnapshotCloneOptions) +// UpdateSnapshot : Update a snapshot +// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group +// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. +func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSnapshotCloneWithContext is an alternate form of the GetSnapshotClone method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotCloneOptions, "getSnapshotCloneOptions cannot be nil") +// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter +func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSnapshotCloneOptions, "getSnapshotCloneOptions") + err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSnapshotCloneOptions.ID, - "zone_name": *getSnapshotCloneOptions.ZoneName, + "id": *updateSnapshotOptions.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, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSnapshotCloneOptions.Headers { + for headerName, headerValue := range updateSnapshotOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) + 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()) @@ -16191,12 +16430,12 @@ func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCl var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_snapshot_clone", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_snapshot", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16207,45 +16446,45 @@ func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCl return } -// GetSnapshotConsistencyGroup : Retrieve a snapshot consistency group -// This request retrieves a single snapshot consistency group specified by the identifier in the URL. -func (vpc *VpcV1) GetSnapshotConsistencyGroup(getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetSnapshotConsistencyGroupWithContext(context.Background(), getSnapshotConsistencyGroupOptions) +// ListSnapshotClones : List clones for a snapshot +// This request lists clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. +func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSnapshotConsistencyGroupWithContext is an alternate form of the GetSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, getSnapshotConsistencyGroupOptions *GetSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions cannot be nil") +// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter +func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSnapshotConsistencyGroupOptions, "getSnapshotConsistencyGroupOptions") + err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSnapshotConsistencyGroupOptions.ID, + "id": *listSnapshotClonesOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range listSnapshotClonesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16263,12 +16502,12 @@ func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, ge var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_snapshot_consistency_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_snapshot_clones", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16279,49 +16518,50 @@ func (vpc *VpcV1) GetSnapshotConsistencyGroupWithContext(ctx context.Context, ge return } -// ListSnapshotClones : List clones for a snapshot -// This request lists clones for a snapshot. Use a clone to quickly restore a snapshot within the clone's zone. -func (vpc *VpcV1) ListSnapshotClones(listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSnapshotClonesWithContext(context.Background(), listSnapshotClonesOptions) +// DeleteSnapshotClone : Delete a snapshot clone +// This request deletes a snapshot clone. This operation cannot be reversed, but an equivalent clone may be recreated +// from the snapshot. +func (vpc *VpcV1) DeleteSnapshotClone(deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteSnapshotCloneWithContext(context.Background(), deleteSnapshotCloneOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSnapshotClonesWithContext is an alternate form of the ListSnapshotClones method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapshotClonesOptions *ListSnapshotClonesOptions) (result *SnapshotCloneCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSnapshotClonesOptions, "listSnapshotClonesOptions cannot be nil") +// DeleteSnapshotCloneWithContext is an alternate form of the DeleteSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) DeleteSnapshotCloneWithContext(ctx context.Context, deleteSnapshotCloneOptions *DeleteSnapshotCloneOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listSnapshotClonesOptions, "listSnapshotClonesOptions") + err = core.ValidateStruct(deleteSnapshotCloneOptions, "deleteSnapshotCloneOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *listSnapshotClonesOptions.ID, + "id": *deleteSnapshotCloneOptions.ID, + "zone_name": *deleteSnapshotCloneOptions.ZoneName, } - 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, `/snapshots/{id}/clones`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSnapshotClonesOptions.Headers { + for headerName, headerValue := range deleteSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotClones") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSnapshotClone") 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)) @@ -16332,56 +16572,56 @@ func (vpc *VpcV1) ListSnapshotClonesWithContext(ctx context.Context, listSnapsho 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_snapshot_clones", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_snapshot_clone", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCloneCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListSnapshotConsistencyGroups : List snapshot consistency groups -// This request lists snapshot consistency groups in the region. A snapshot consistency group is a collection of -// individual snapshots taken at the same time. -func (vpc *VpcV1) ListSnapshotConsistencyGroups(listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSnapshotConsistencyGroupsWithContext(context.Background(), listSnapshotConsistencyGroupsOptions) +// GetSnapshotClone : Retrieve a snapshot clone +// This request retrieves a single clone specified by the snapshot identifier and zone name in the URL. +func (vpc *VpcV1) GetSnapshotClone(getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetSnapshotCloneWithContext(context.Background(), getSnapshotCloneOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSnapshotConsistencyGroupsWithContext is an alternate form of the ListSnapshotConsistencyGroups method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, listSnapshotConsistencyGroupsOptions *ListSnapshotConsistencyGroupsOptions) (result *SnapshotConsistencyGroupCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSnapshotConsistencyGroupsOptions, "listSnapshotConsistencyGroupsOptions") +// GetSnapshotCloneWithContext is an alternate form of the GetSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) GetSnapshotCloneWithContext(ctx context.Context, getSnapshotCloneOptions *GetSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSnapshotCloneOptions, "getSnapshotCloneOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getSnapshotCloneOptions, "getSnapshotCloneOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *getSnapshotCloneOptions.ID, + "zone_name": *getSnapshotCloneOptions.ZoneName, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshot_consistency_groups`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSnapshotConsistencyGroupsOptions.Headers { + for headerName, headerValue := range getSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshotConsistencyGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSnapshotClone") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16389,24 +16629,6 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listSnapshotConsistencyGroupsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Start)) - } - if listSnapshotConsistencyGroupsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Limit)) - } - if listSnapshotConsistencyGroupsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.ResourceGroupID)) - } - if listSnapshotConsistencyGroupsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Name)) - } - if listSnapshotConsistencyGroupsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.Sort)) - } - if listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotConsistencyGroupsOptions.BackupPolicyPlanID)) - } request, err := builder.Build() if err != nil { @@ -16417,12 +16639,12 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_snapshot_consistency_groups", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_snapshot_clone", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroupCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16433,37 +16655,47 @@ func (vpc *VpcV1) ListSnapshotConsistencyGroupsWithContext(ctx context.Context, return } -// ListSnapshots : List snapshots -// This request lists snapshots in the region. A snapshot preserves the data of a volume at the time the snapshot is -// created. -func (vpc *VpcV1) ListSnapshots(listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSnapshotsWithContext(context.Background(), listSnapshotsOptions) +// CreateSnapshotClone : Create a clone for a snapshot +// This request creates a new clone for a snapshot in the specified zone. A request body is not required, and if +// provided, is ignored. If the snapshot already has a clone in the zone, it is returned. +func (vpc *VpcV1) CreateSnapshotClone(createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateSnapshotCloneWithContext(context.Background(), createSnapshotCloneOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSnapshotsWithContext is an alternate form of the ListSnapshots method which supports a Context parameter -func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOptions *ListSnapshotsOptions) (result *SnapshotCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSnapshotsOptions, "listSnapshotsOptions") +// CreateSnapshotCloneWithContext is an alternate form of the CreateSnapshotClone method which supports a Context parameter +func (vpc *VpcV1) CreateSnapshotCloneWithContext(ctx context.Context, createSnapshotCloneOptions *CreateSnapshotCloneOptions) (result *SnapshotClone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSnapshotCloneOptions, "createSnapshotCloneOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createSnapshotCloneOptions, "createSnapshotCloneOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *createSnapshotCloneOptions.ID, + "zone_name": *createSnapshotCloneOptions.ZoneName, + } + + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/snapshots/{id}/clones/{zone_name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSnapshotsOptions.Headers { + for headerName, headerValue := range createSnapshotCloneOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSnapshots") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSnapshotClone") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16471,72 +16703,6 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listSnapshotsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSnapshotsOptions.Start)) - } - if listSnapshotsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSnapshotsOptions.Limit)) - } - if listSnapshotsOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listSnapshotsOptions.Tag)) - } - if listSnapshotsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSnapshotsOptions.ResourceGroupID)) - } - if listSnapshotsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSnapshotsOptions.Name)) - } - if listSnapshotsOptions.SourceVolumeID != nil { - builder.AddQuery("source_volume.id", fmt.Sprint(*listSnapshotsOptions.SourceVolumeID)) - } - if listSnapshotsOptions.SourceVolumeCRN != nil { - builder.AddQuery("source_volume.crn", fmt.Sprint(*listSnapshotsOptions.SourceVolumeCRN)) - } - if listSnapshotsOptions.SourceImageID != nil { - builder.AddQuery("source_image.id", fmt.Sprint(*listSnapshotsOptions.SourceImageID)) - } - if listSnapshotsOptions.SourceImageCRN != nil { - builder.AddQuery("source_image.crn", fmt.Sprint(*listSnapshotsOptions.SourceImageCRN)) - } - if listSnapshotsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSnapshotsOptions.Sort)) - } - if listSnapshotsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listSnapshotsOptions.BackupPolicyPlanID)) - } - if listSnapshotsOptions.CopiesID != nil { - builder.AddQuery("copies[].id", fmt.Sprint(*listSnapshotsOptions.CopiesID)) - } - if listSnapshotsOptions.CopiesName != nil { - builder.AddQuery("copies[].name", fmt.Sprint(*listSnapshotsOptions.CopiesName)) - } - if listSnapshotsOptions.CopiesCRN != nil { - builder.AddQuery("copies[].crn", fmt.Sprint(*listSnapshotsOptions.CopiesCRN)) - } - if listSnapshotsOptions.CopiesRemoteRegionName != nil { - builder.AddQuery("copies[].remote.region.name", fmt.Sprint(*listSnapshotsOptions.CopiesRemoteRegionName)) - } - if listSnapshotsOptions.SourceSnapshotID != nil { - builder.AddQuery("source_snapshot.id", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotID)) - } - if listSnapshotsOptions.SourceSnapshotRemoteRegionName != nil { - builder.AddQuery("source_snapshot.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceSnapshotRemoteRegionName)) - } - if listSnapshotsOptions.SourceVolumeRemoteRegionName != nil { - builder.AddQuery("source_volume.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceVolumeRemoteRegionName)) - } - if listSnapshotsOptions.SourceImageRemoteRegionName != nil { - builder.AddQuery("source_image.remote.region.name", fmt.Sprint(*listSnapshotsOptions.SourceImageRemoteRegionName)) - } - if listSnapshotsOptions.ClonesZoneName != nil { - builder.AddQuery("clones[].zone.name", fmt.Sprint(*listSnapshotsOptions.ClonesZoneName)) - } - if listSnapshotsOptions.SnapshotConsistencyGroupID != nil { - builder.AddQuery("snapshot_consistency_group.id", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupID)) - } - if listSnapshotsOptions.SnapshotConsistencyGroupCRN != nil { - builder.AddQuery("snapshot_consistency_group.crn", fmt.Sprint(*listSnapshotsOptions.SnapshotConsistencyGroupCRN)) - } request, err := builder.Build() if err != nil { @@ -16547,12 +16713,12 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_snapshots", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_snapshot_clone", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotClone) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16563,62 +16729,52 @@ func (vpc *VpcV1) ListSnapshotsWithContext(ctx context.Context, listSnapshotsOpt return } -// UpdateSnapshot : Update a snapshot -// This request updates a snapshot with the information in a provided snapshot patch. The snapshot consistency group -// patch object is structured in the same way as a retrieved snapshot and contains only the information to be updated. -func (vpc *VpcV1) UpdateSnapshot(updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateSnapshotWithContext(context.Background(), updateSnapshotOptions) +// ListShareProfiles : List file share profiles +// This request lists [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) available in +// the region. A file share profile specifies the performance characteristics and pricing model for a file share. +func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateSnapshotWithContext is an alternate form of the UpdateSnapshot method which supports a Context parameter -func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotOptions *UpdateSnapshotOptions) (result *Snapshot, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSnapshotOptions, "updateSnapshotOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateSnapshotOptions, "updateSnapshotOptions") +// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter +func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *updateSnapshotOptions.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, `/snapshots/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateSnapshotOptions.Headers { + for headerName, headerValue := range listShareProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshot") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSnapshotOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - - _, err = builder.SetBodyContentJSON(updateSnapshotOptions.SnapshotPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listShareProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) + } + if listShareProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) + } + if listShareProfilesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) } request, err := builder.Build() @@ -16630,12 +16786,12 @@ func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_snapshot", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_share_profiles", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshot) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16646,65 +16802,53 @@ func (vpc *VpcV1) UpdateSnapshotWithContext(ctx context.Context, updateSnapshotO return } -// UpdateSnapshotConsistencyGroup : Update a snapshot consistency group -// This request updates a snapshot consistency group with the information in a provided snapshot consistency group -// patch. The snapshot consistency group patch object is structured in the same way as a retrieved snapshot consistency -// group and contains only the information to be updated. -func (vpc *VpcV1) UpdateSnapshotConsistencyGroup(updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateSnapshotConsistencyGroupWithContext(context.Background(), updateSnapshotConsistencyGroupOptions) +// GetShareProfile : Retrieve a file share profile +// This request retrieves a single file share profile specified by the name in the URL. +func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateSnapshotConsistencyGroupWithContext is an alternate form of the UpdateSnapshotConsistencyGroup method which supports a Context parameter -func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, updateSnapshotConsistencyGroupOptions *UpdateSnapshotConsistencyGroupOptions) (result *SnapshotConsistencyGroup, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions cannot be nil") +// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter +func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateSnapshotConsistencyGroupOptions, "updateSnapshotConsistencyGroupOptions") + err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateSnapshotConsistencyGroupOptions.ID, + "name": *getShareProfileOptions.Name, } - 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, `/snapshot_consistency_groups/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateSnapshotConsistencyGroupOptions.Headers { + for headerName, headerValue := range getShareProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSnapshotConsistencyGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSnapshotConsistencyGroupOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateSnapshotConsistencyGroupOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateSnapshotConsistencyGroupOptions.SnapshotConsistencyGroupPatch) - 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()) @@ -16714,12 +16858,12 @@ func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_snapshot_consistency_group", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_share_profile", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSnapshotConsistencyGroup) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16730,32 +16874,23 @@ func (vpc *VpcV1) UpdateSnapshotConsistencyGroupWithContext(ctx context.Context, return } -// CreateShare : Create a file share -// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, -// a replica share, or both a source and replica share. -// -// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to -// provision the new file shares. -func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateShareWithContext(context.Background(), createShareOptions) +// ListShares : List file shares +// This request lists file shares in the region. +func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListSharesWithContext(context.Background(), listSharesOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter -func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createShareOptions, "createShareOptions") +// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter +func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSharesOptions, "listSharesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/shares`, nil) @@ -16764,24 +16899,35 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions return } - for headerName, headerValue := range createShareOptions.Headers { + for headerName, headerValue := range listSharesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") 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(createShareOptions.SharePrototype) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listSharesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) + } + if listSharesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) + } + if listSharesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) + } + if listSharesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) + } + if listSharesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) + } + if listSharesOptions.ReplicationRole != nil { + builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) } request, err := builder.Build() @@ -16793,12 +16939,12 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_share", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_shares", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16809,48 +16955,45 @@ func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions return } -// CreateShareMountTarget : Create a mount target for a file share -// This request creates a new share mount target from a share mount target prototype object. +// CreateShare : Create a file share +// This request provisions new file shares from a share prototype object. The new file shares can be a standalone share, +// a replica share, or both a source and replica share. // -// The prototype object is structured in the same way as a retrieved share mount target, and contains the information -// necessary to provision the new file share mount target. -func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) +// The prototype object is structured in the same way as a retrieved share, and contains the information necessary to +// provision the new file shares. +func (vpc *VpcV1) CreateShare(createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateShareWithContext(context.Background(), createShareOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") +// CreateShareWithContext is an alternate form of the CreateShare method which supports a Context parameter +func (vpc *VpcV1) CreateShareWithContext(ctx context.Context, createShareOptions *CreateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareOptions, "createShareOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") + err = core.ValidateStruct(createShareOptions, "createShareOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "share_id": *createShareMountTargetOptions.ShareID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createShareMountTargetOptions.Headers { + for headerName, headerValue := range createShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShare") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16860,7 +17003,7 @@ func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createS builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createShareMountTargetOptions.ShareMountTargetPrototype) + _, err = builder.SetBodyContentJSON(createShareOptions.SharePrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -16875,12 +17018,12 @@ func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createS var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_share_mount_target", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_share", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -16972,49 +17115,49 @@ func (vpc *VpcV1) DeleteShareWithContext(ctx context.Context, deleteShareOptions return } -// DeleteShareAccessorBinding : Delete a file share accessor binding -// This request deletes a share accessor binding. This operation cannot be reversed. -func (vpc *VpcV1) DeleteShareAccessorBinding(deleteShareAccessorBindingOptions *DeleteShareAccessorBindingOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteShareAccessorBindingWithContext(context.Background(), deleteShareAccessorBindingOptions) +// GetShare : Retrieve a file share +// This request retrieves a single file share specified by the identifier in the URL. +func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareWithContext(context.Background(), getShareOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteShareAccessorBindingWithContext is an alternate form of the DeleteShareAccessorBinding method which supports a Context parameter -func (vpc *VpcV1) DeleteShareAccessorBindingWithContext(ctx context.Context, deleteShareAccessorBindingOptions *DeleteShareAccessorBindingOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareAccessorBindingOptions, "deleteShareAccessorBindingOptions cannot be nil") +// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter +func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteShareAccessorBindingOptions, "deleteShareAccessorBindingOptions") + err = core.ValidateStruct(getShareOptions, "getShareOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *deleteShareAccessorBindingOptions.ShareID, - "id": *deleteShareAccessorBindingOptions.ID, + "id": *getShareOptions.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, `/shares/{share_id}/accessor_bindings/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteShareAccessorBindingOptions.Headers { + for headerName, headerValue := range getShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareAccessorBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") 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)) @@ -17025,67 +17168,83 @@ func (vpc *VpcV1) DeleteShareAccessorBindingWithContext(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_share_accessor_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_share", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// DeleteShareMountTarget : Delete a file share mount target -// This request deletes a share mount target. This operation cannot be reversed. -// -// If the request is accepted, the share mount target `lifecycle_state` will be set to -// `deleting`. Once deletion processing completes, it will no longer be retrievable. -func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) +// UpdateShare : Update a file share +// This request updates a share with the information in a provided share patch. The share patch object is structured in +// the same way as a retrieved share and contains only the information to be updated. +func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateShareWithContext(context.Background(), updateShareOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") +// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter +func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") + err = core.ValidateStruct(updateShareOptions, "updateShareOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *deleteShareMountTargetOptions.ShareID, - "id": *deleteShareMountTargetOptions.ID, + "id": *updateShareOptions.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, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteShareMountTargetOptions.Headers { + for headerName, headerValue := range updateShareOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateShareOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateShareOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) + 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()) @@ -17095,12 +17254,12 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_share_mount_target", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_share", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17111,49 +17270,127 @@ func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteS return } -// DeleteShareSource : Split the source file share from a replica file share -// This request removes the replication relationship between a source share and the replica share specified by the -// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a -// `lifecycle_state` of `updating`, or has a replication operation in progress. +// ListShareAccessorBindings : List accessor bindings for a file share +// This request lists accessor bindings for a share. Each accessor binding identifies a resource (possibly in another +// account) with access to this file share's data. // -// This operation cannot be reversed. -func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) +// The share accessor bindings will be sorted by their `created_at` property values, with newest bindings first. +func (vpc *VpcV1) ListShareAccessorBindings(listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) (result *ShareAccessorBindingCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListShareAccessorBindingsWithContext(context.Background(), listShareAccessorBindingsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter -func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") +// ListShareAccessorBindingsWithContext is an alternate form of the ListShareAccessorBindings method which supports a Context parameter +func (vpc *VpcV1) ListShareAccessorBindingsWithContext(ctx context.Context, listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) (result *ShareAccessorBindingCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") + err = core.ValidateStruct(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *deleteShareSourceOptions.ShareID, + "id": *listShareAccessorBindingsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}/accessor_bindings`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listShareAccessorBindingsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareAccessorBindings") + 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 listShareAccessorBindingsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareAccessorBindingsOptions.Start)) + } + if listShareAccessorBindingsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareAccessorBindingsOptions.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_share_accessor_bindings", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareAccessorBindingCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// DeleteShareAccessorBinding : Delete a file share accessor binding +// This request deletes a share accessor binding. This operation cannot be reversed. +func (vpc *VpcV1) DeleteShareAccessorBinding(deleteShareAccessorBindingOptions *DeleteShareAccessorBindingOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteShareAccessorBindingWithContext(context.Background(), deleteShareAccessorBindingOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// DeleteShareAccessorBindingWithContext is an alternate form of the DeleteShareAccessorBinding method which supports a Context parameter +func (vpc *VpcV1) DeleteShareAccessorBindingWithContext(ctx context.Context, deleteShareAccessorBindingOptions *DeleteShareAccessorBindingOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareAccessorBindingOptions, "deleteShareAccessorBindingOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteShareAccessorBindingOptions, "deleteShareAccessorBindingOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "share_id": *deleteShareAccessorBindingOptions.ShareID, + "id": *deleteShareAccessorBindingOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/accessor_bindings/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteShareSourceOptions.Headers { + for headerName, headerValue := range deleteShareAccessorBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareAccessorBinding") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17169,10 +17406,83 @@ func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareS response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_share_source", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_share_accessor_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// GetShareAccessorBinding : Retrieve a file share accessor binding +// This request retrieves a single accessor binding specified by the identifier in the URL. +func (vpc *VpcV1) GetShareAccessorBinding(getShareAccessorBindingOptions *GetShareAccessorBindingOptions) (result *ShareAccessorBinding, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareAccessorBindingWithContext(context.Background(), getShareAccessorBindingOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetShareAccessorBindingWithContext is an alternate form of the GetShareAccessorBinding method which supports a Context parameter +func (vpc *VpcV1) GetShareAccessorBindingWithContext(ctx context.Context, getShareAccessorBindingOptions *GetShareAccessorBindingOptions) (result *ShareAccessorBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareAccessorBindingOptions, "getShareAccessorBindingOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getShareAccessorBindingOptions, "getShareAccessorBindingOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "share_id": *getShareAccessorBindingOptions.ShareID, + "id": *getShareAccessorBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/accessor_bindings/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getShareAccessorBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareAccessorBinding") + 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_share_accessor_binding", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareAccessorBinding) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } @@ -17258,45 +17568,48 @@ func (vpc *VpcV1) FailoverShareWithContext(ctx context.Context, failoverShareOpt return } -// GetShare : Retrieve a file share -// This request retrieves a single file share specified by the identifier in the URL. -func (vpc *VpcV1) GetShare(getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareWithContext(context.Background(), getShareOptions) +// ListShareMountTargets : List mount targets for a file share +// This request lists mount targets for a file share. A mount target is a network endpoint at which a file share may be +// mounted. The file share can be mounted by clients in the same VPC and zone after creating share mount targets. +// +// The share mount targets will be sorted by their `created_at` property values, with newest targets first. +func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetShareWithContext is an alternate form of the GetShare method which supports a Context parameter -func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareOptions, "getShareOptions cannot be nil") +// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter +func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareOptions, "getShareOptions") + err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getShareOptions.ID, + "share_id": *listShareMountTargetsOptions.ShareID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareOptions.Headers { + for headerName, headerValue := range listShareMountTargetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17304,6 +17617,15 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listShareMountTargetsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) + } + if listShareMountTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) + } + if listShareMountTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -17314,12 +17636,12 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_share", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_share_mount_targets", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17330,54 +17652,63 @@ func (vpc *VpcV1) GetShareWithContext(ctx context.Context, getShareOptions *GetS return } -// GetShareAccessorBinding : Retrieve a file share accessor binding -// This request retrieves a single accessor binding specified by the identifier in the URL. -func (vpc *VpcV1) GetShareAccessorBinding(getShareAccessorBindingOptions *GetShareAccessorBindingOptions) (result *ShareAccessorBinding, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareAccessorBindingWithContext(context.Background(), getShareAccessorBindingOptions) +// CreateShareMountTarget : Create a mount target for a file share +// This request creates a new share mount target from a share mount target prototype object. +// +// The prototype object is structured in the same way as a retrieved share mount target, and contains the information +// necessary to provision the new file share mount target. +func (vpc *VpcV1) CreateShareMountTarget(createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateShareMountTargetWithContext(context.Background(), createShareMountTargetOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetShareAccessorBindingWithContext is an alternate form of the GetShareAccessorBinding method which supports a Context parameter -func (vpc *VpcV1) GetShareAccessorBindingWithContext(ctx context.Context, getShareAccessorBindingOptions *GetShareAccessorBindingOptions) (result *ShareAccessorBinding, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareAccessorBindingOptions, "getShareAccessorBindingOptions cannot be nil") +// CreateShareMountTargetWithContext is an alternate form of the CreateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) CreateShareMountTargetWithContext(ctx context.Context, createShareMountTargetOptions *CreateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareMountTargetOptions, "createShareMountTargetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareAccessorBindingOptions, "getShareAccessorBindingOptions") + err = core.ValidateStruct(createShareMountTargetOptions, "createShareMountTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *getShareAccessorBindingOptions.ShareID, - "id": *getShareAccessorBindingOptions.ID, + "share_id": *createShareMountTargetOptions.ShareID, } - 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, `/shares/{share_id}/accessor_bindings/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareAccessorBindingOptions.Headers { + for headerName, headerValue := range createShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareAccessorBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareMountTarget") 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(createShareMountTargetOptions.ShareMountTargetPrototype) + 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()) @@ -17387,12 +17718,12 @@ func (vpc *VpcV1) GetShareAccessorBindingWithContext(ctx context.Context, getSha var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_share_accessor_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_share_mount_target", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareAccessorBinding) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17403,33 +17734,36 @@ func (vpc *VpcV1) GetShareAccessorBindingWithContext(ctx context.Context, getSha return } -// GetShareMountTarget : Retrieve a file share mount target -// This request retrieves a single share mount target specified by the identifier in the URL. -func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) +// DeleteShareMountTarget : Delete a file share mount target +// This request deletes a share mount target. This operation cannot be reversed. +// +// If the request is accepted, the share mount target `lifecycle_state` will be set to +// `deleting`. Once deletion processing completes, it will no longer be retrievable. +func (vpc *VpcV1) DeleteShareMountTarget(deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteShareMountTargetWithContext(context.Background(), deleteShareMountTargetOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") +// DeleteShareMountTargetWithContext is an alternate form of the DeleteShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) DeleteShareMountTargetWithContext(ctx context.Context, deleteShareMountTargetOptions *DeleteShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareMountTargetOptions, "deleteShareMountTargetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") + err = core.ValidateStruct(deleteShareMountTargetOptions, "deleteShareMountTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *getShareMountTargetOptions.ShareID, - "id": *getShareMountTargetOptions.ID, + "share_id": *deleteShareMountTargetOptions.ShareID, + "id": *deleteShareMountTargetOptions.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, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) @@ -17438,11 +17772,11 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo return } - for headerName, headerValue := range getShareMountTargetOptions.Headers { + for headerName, headerValue := range deleteShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17460,7 +17794,7 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_share_mount_target", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_share_mount_target", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -17476,45 +17810,46 @@ func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMo return } -// GetShareProfile : Retrieve a file share profile -// This request retrieves a single file share profile specified by the name in the URL. -func (vpc *VpcV1) GetShareProfile(getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareProfileWithContext(context.Background(), getShareProfileOptions) +// GetShareMountTarget : Retrieve a file share mount target +// This request retrieves a single share mount target specified by the identifier in the URL. +func (vpc *VpcV1) GetShareMountTarget(getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareMountTargetWithContext(context.Background(), getShareMountTargetOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetShareProfileWithContext is an alternate form of the GetShareProfile method which supports a Context parameter -func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfileOptions *GetShareProfileOptions) (result *ShareProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareProfileOptions, "getShareProfileOptions cannot be nil") +// GetShareMountTargetWithContext is an alternate form of the GetShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) GetShareMountTargetWithContext(ctx context.Context, getShareMountTargetOptions *GetShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareMountTargetOptions, "getShareMountTargetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareProfileOptions, "getShareProfileOptions") + err = core.ValidateStruct(getShareMountTargetOptions, "getShareMountTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getShareProfileOptions.Name, + "share_id": *getShareMountTargetOptions.ShareID, + "id": *getShareMountTargetOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareProfileOptions.Headers { + for headerName, headerValue := range getShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareMountTarget") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17532,12 +17867,12 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_share_profile", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_share_mount_target", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17548,54 +17883,63 @@ func (vpc *VpcV1) GetShareProfileWithContext(ctx context.Context, getShareProfil return } -// GetShareSource : Retrieve the source file share for a replica file share -// This request retrieves the source file share associated with the replica file share specified by the identifier in -// the URL. -func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) +// UpdateShareMountTarget : Update a file share mount target +// This request updates a share mount target with the information provided in a share mount target patch object. The +// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain +// only the information to be updated. +func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter -func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") +// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter +func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") + err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *getShareSourceOptions.ShareID, + "share_id": *updateShareMountTargetOptions.ShareID, + "id": *updateShareMountTargetOptions.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, `/shares/{share_id}/source`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getShareSourceOptions.Headers { + for headerName, headerValue := range updateShareMountTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") 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(updateShareMountTargetOptions.ShareMountTargetPatch) + 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()) @@ -17605,12 +17949,12 @@ func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceO var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_share_source", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_share_mount_target", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17621,61 +17965,55 @@ func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceO return } -// ListShareAccessorBindings : List accessor bindings for a file share -// This request lists accessor bindings for a share. Each accessor binding identifies a resource (possibly in another -// account) with access to this file share's data. +// DeleteShareSource : Split the source file share from a replica file share +// This request removes the replication relationship between a source share and the replica share specified by the +// identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a +// `lifecycle_state` of `updating`, or has a replication operation in progress. // -// The share accessor bindings will be sorted by their `created_at` property values, with newest bindings first. -func (vpc *VpcV1) ListShareAccessorBindings(listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) (result *ShareAccessorBindingCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListShareAccessorBindingsWithContext(context.Background(), listShareAccessorBindingsOptions) +// This operation cannot be reversed. +func (vpc *VpcV1) DeleteShareSource(deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.DeleteShareSourceWithContext(context.Background(), deleteShareSourceOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListShareAccessorBindingsWithContext is an alternate form of the ListShareAccessorBindings method which supports a Context parameter -func (vpc *VpcV1) ListShareAccessorBindingsWithContext(ctx context.Context, listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) (result *ShareAccessorBindingCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions cannot be nil") +// DeleteShareSourceWithContext is an alternate form of the DeleteShareSource method which supports a Context parameter +func (vpc *VpcV1) DeleteShareSourceWithContext(ctx context.Context, deleteShareSourceOptions *DeleteShareSourceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareSourceOptions, "deleteShareSourceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listShareAccessorBindingsOptions, "listShareAccessorBindingsOptions") + err = core.ValidateStruct(deleteShareSourceOptions, "deleteShareSourceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *listShareAccessorBindingsOptions.ID, + "share_id": *deleteShareSourceOptions.ShareID, } - 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, `/shares/{id}/accessor_bindings`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listShareAccessorBindingsOptions.Headers { + for headerName, headerValue := range deleteShareSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareAccessorBindings") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSource") 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 listShareAccessorBindingsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareAccessorBindingsOptions.Start)) - } - if listShareAccessorBindingsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareAccessorBindingsOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -17683,67 +18021,56 @@ func (vpc *VpcV1) ListShareAccessorBindingsWithContext(ctx context.Context, list 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_share_accessor_bindings", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_share_source", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareAccessorBindingCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListShareMountTargets : List mount targets for a file share -// This request lists mount targets for a file share. A mount target is a network endpoint at which a file share may be -// mounted. The file share can be mounted by clients in the same VPC and zone after creating share mount targets. -// -// The share mount targets will be sorted by their `created_at` property values, with newest targets first. -func (vpc *VpcV1) ListShareMountTargets(listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListShareMountTargetsWithContext(context.Background(), listShareMountTargetsOptions) +// GetShareSource : Retrieve the source file share for a replica file share +// This request retrieves the source file share associated with the replica file share specified by the identifier in +// the URL. +func (vpc *VpcV1) GetShareSource(getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareSourceWithContext(context.Background(), getShareSourceOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListShareMountTargetsWithContext is an alternate form of the ListShareMountTargets method which supports a Context parameter -func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShareMountTargetsOptions *ListShareMountTargetsOptions) (result *ShareMountTargetCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listShareMountTargetsOptions, "listShareMountTargetsOptions cannot be nil") +// GetShareSourceWithContext is an alternate form of the GetShareSource method which supports a Context parameter +func (vpc *VpcV1) GetShareSourceWithContext(ctx context.Context, getShareSourceOptions *GetShareSourceOptions) (result *ShareReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareSourceOptions, "getShareSourceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listShareMountTargetsOptions, "listShareMountTargetsOptions") + err = core.ValidateStruct(getShareSourceOptions, "getShareSourceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *listShareMountTargetsOptions.ShareID, + "share_id": *getShareSourceOptions.ShareID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/mount_targets`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/source`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listShareMountTargetsOptions.Headers { + for headerName, headerValue := range getShareSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareMountTargets") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSource") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17751,15 +18078,6 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listShareMountTargetsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listShareMountTargetsOptions.Name)) - } - if listShareMountTargetsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareMountTargetsOptions.Start)) - } - if listShareMountTargetsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareMountTargetsOptions.Limit)) - } request, err := builder.Build() if err != nil { @@ -17770,12 +18088,12 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_share_mount_targets", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_share_source", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTargetCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17786,18 +18104,18 @@ func (vpc *VpcV1) ListShareMountTargetsWithContext(ctx context.Context, listShar return } -// ListShareProfiles : List file share profiles -// This request lists [file share profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) available in -// the region. A file share profile specifies the performance characteristics and pricing model for a file share. -func (vpc *VpcV1) ListShareProfiles(listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListShareProfilesWithContext(context.Background(), listShareProfilesOptions) +// ListBackupPolicies : List backup policies +// This request lists backup policies in the region. Backup policies control which sources are selected for backup and +// include a set of backup policy plans that provide the backup schedules and deletion triggers. +func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListShareProfilesWithContext is an alternate form of the ListShareProfiles method which supports a Context parameter -func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listShareProfilesOptions *ListShareProfilesOptions) (result *ShareProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listShareProfilesOptions, "listShareProfilesOptions") +// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter +func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -17806,17 +18124,17 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/share/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listShareProfilesOptions.Headers { + for headerName, headerValue := range listBackupPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17824,14 +18142,20 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listShareProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listShareProfilesOptions.Start)) + if listBackupPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) } - if listShareProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listShareProfilesOptions.Limit)) + if listBackupPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) } - if listShareProfilesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listShareProfilesOptions.Sort)) + if listBackupPoliciesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) + } + if listBackupPoliciesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) + } + if listBackupPoliciesOptions.Tag != nil { + builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) } request, err := builder.Build() @@ -17843,12 +18167,12 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_share_profiles", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_backup_policies", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17859,60 +18183,55 @@ func (vpc *VpcV1) ListShareProfilesWithContext(ctx context.Context, listSharePro return } -// ListShares : List file shares -// This request lists file shares in the region. -func (vpc *VpcV1) ListShares(listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListSharesWithContext(context.Background(), listSharesOptions) +// CreateBackupPolicy : Create a backup policy +// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in +// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. +func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSharesWithContext is an alternate form of the ListShares method which supports a Context parameter -func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions *ListSharesOptions) (result *ShareCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSharesOptions, "listSharesOptions") +// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/shares`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSharesOptions.Headers { + for headerName, headerValue := range createBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShares") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") 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)) - if listSharesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listSharesOptions.Start)) - } - if listSharesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listSharesOptions.Limit)) - } - if listSharesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listSharesOptions.ResourceGroupID)) - } - if listSharesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listSharesOptions.Name)) - } - if listSharesOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listSharesOptions.Sort)) - } - if listSharesOptions.ReplicationRole != nil { - builder.AddQuery("replication_role", fmt.Sprint(*listSharesOptions.ReplicationRole)) + + _, err = builder.SetBodyContentJSON(createBackupPolicyOptions.BackupPolicyPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -17924,12 +18243,12 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_shares", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_backup_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -17940,62 +18259,76 @@ func (vpc *VpcV1) ListSharesWithContext(ctx context.Context, listSharesOptions * return } -// UpdateShare : Update a file share -// This request updates a share with the information in a provided share patch. The share patch object is structured in -// the same way as a retrieved share and contains only the information to be updated. -func (vpc *VpcV1) UpdateShare(updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateShareWithContext(context.Background(), updateShareOptions) +// ListBackupPolicyJobs : List jobs for a backup policy +// This request retrieves jobs for a backup policy. A backup job represents the execution of a backup policy plan for a +// resource matching the policy's criteria. +func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateShareWithContext is an alternate form of the UpdateShare method which supports a Context parameter -func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions *UpdateShareOptions) (result *Share, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateShareOptions, "updateShareOptions cannot be nil") +// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateShareOptions, "updateShareOptions") + err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateShareOptions.ID, + "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, } - 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, `/shares/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateShareOptions.Headers { + for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShare") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateShareOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateShareOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - - _, err = builder.SetBodyContentJSON(updateShareOptions.SharePatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listBackupPolicyJobsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) + } + if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) + } + if listBackupPolicyJobsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) + } + if listBackupPolicyJobsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) + } + if listBackupPolicyJobsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) + } + if listBackupPolicyJobsOptions.SourceID != nil { + builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { + builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) + } + if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { + builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) } request, err := builder.Build() @@ -18007,12 +18340,12 @@ func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_share", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_backup_policy_jobs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShare) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18023,63 +18356,54 @@ func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions return } -// UpdateShareMountTarget : Update a file share mount target -// This request updates a share mount target with the information provided in a share mount target patch object. The -// share mount target patch object is structured in the same way as a retrieved share mount target and needs to contain -// only the information to be updated. -func (vpc *VpcV1) UpdateShareMountTarget(updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateShareMountTargetWithContext(context.Background(), updateShareMountTargetOptions) +// GetBackupPolicyJob : Retrieve a backup policy job +// This request retrieves a single backup policy job specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateShareMountTargetWithContext is an alternate form of the UpdateShareMountTarget method which supports a Context parameter -func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateShareMountTargetOptions *UpdateShareMountTargetOptions) (result *ShareMountTarget, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateShareMountTargetOptions, "updateShareMountTargetOptions cannot be nil") +// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateShareMountTargetOptions, "updateShareMountTargetOptions") + err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "share_id": *updateShareMountTargetOptions.ShareID, - "id": *updateShareMountTargetOptions.ID, + "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, + "id": *getBackupPolicyJobOptions.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, `/shares/{share_id}/mount_targets/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateShareMountTargetOptions.Headers { + for headerName, headerValue := range getBackupPolicyJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareMountTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") 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(updateShareMountTargetOptions.ShareMountTargetPatch) - 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()) @@ -18089,12 +18413,12 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_share_mount_target", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_backup_policy_job", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareMountTarget) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18105,55 +18429,54 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS return } -// CreateBackupPolicy : Create a backup policy -// This request creates a new backup policy from a backup policy prototype object. The prototype object is structured in -// the same way as a retrieved backup policy, and contains the information necessary to create the new backup policy. -func (vpc *VpcV1) CreateBackupPolicy(createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateBackupPolicyWithContext(context.Background(), createBackupPolicyOptions) +// ListBackupPolicyPlans : List plans for a backup policy +// This request retrieves plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. +func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateBackupPolicyWithContext is an alternate form of the CreateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBackupPolicyOptions *CreateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBackupPolicyOptions, "createBackupPolicyOptions cannot be nil") +// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter +func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createBackupPolicyOptions, "createBackupPolicyOptions") + err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBackupPolicyOptions.Headers { + for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") 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(createBackupPolicyOptions.BackupPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listBackupPolicyPlansOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) } request, err := builder.Build() @@ -18165,12 +18488,12 @@ func (vpc *VpcV1) CreateBackupPolicyWithContext(ctx context.Context, createBacku var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_backup_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_backup_policy_plans", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18292,54 +18615,57 @@ func (vpc *VpcV1) CreateBackupPolicyPlanWithContext(ctx context.Context, createB return } -// DeleteBackupPolicy : Delete a backup policy -// This request deletes a backup policy. This operation cannot be reversed. +// DeleteBackupPolicyPlan : Delete a backup policy plan +// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by +// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with +// the plan will run to completion before the plan is deleted. // -// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, -// the backup policy will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) +// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing +// completes, the backup policy plan will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") +// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") + err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteBackupPolicyOptions.ID, + "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, + "id": *deleteBackupPolicyPlanOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBackupPolicyOptions.Headers { + for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) + if deleteBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) @@ -18354,12 +18680,12 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_backup_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_backup_policy_plan", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18370,38 +18696,33 @@ func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBacku return } -// DeleteBackupPolicyPlan : Delete a backup policy plan -// This request deletes a backup policy plan. This operation cannot be reversed. Any backups that have been created by -// the plan will remain but will no longer be subject to the plan's deletion trigger. Any running jobs associated with -// the plan will run to completion before the plan is deleted. -// -// If the request is accepted, the backup policy plan `status` will be set to `deleting`. Once deletion processing -// completes, the backup policy plan will no longer be retrievable. -func (vpc *VpcV1) DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteBackupPolicyPlanWithContext(context.Background(), deleteBackupPolicyPlanOptions) +// GetBackupPolicyPlan : Retrieve a backup policy plan +// This request retrieves a single backup policy plan specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteBackupPolicyPlanWithContext is an alternate form of the DeleteBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteBackupPolicyPlanOptions *DeleteBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions cannot be nil") +// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBackupPolicyPlanOptions, "deleteBackupPolicyPlanOptions") + err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *deleteBackupPolicyPlanOptions.BackupPolicyID, - "id": *deleteBackupPolicyPlanOptions.ID, + "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, + "id": *getBackupPolicyPlanOptions.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, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) @@ -18410,18 +18731,15 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB return } - for headerName, headerValue := range deleteBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if deleteBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyPlanOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -18435,7 +18753,7 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_backup_policy_plan", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_backup_policy_plan", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -18451,53 +18769,65 @@ func (vpc *VpcV1) DeleteBackupPolicyPlanWithContext(ctx context.Context, deleteB return } -// GetBackupPolicy : Retrieve a backup policy -// This request retrieves a single backup policy specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) +// UpdateBackupPolicyPlan : Update a backup policy plan +// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is +// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") +// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") + err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getBackupPolicyOptions.ID, + "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, + "id": *updateBackupPolicyPlanOptions.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, `/backup_policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBackupPolicyOptions.Headers { + for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateBackupPolicyPlanOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) + 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()) @@ -18507,12 +18837,12 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_backup_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_backup_policy_plan", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18523,50 +18853,55 @@ func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolic return } -// GetBackupPolicyJob : Retrieve a backup policy job -// This request retrieves a single backup policy job specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyJob(getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBackupPolicyJobWithContext(context.Background(), getBackupPolicyJobOptions) +// DeleteBackupPolicy : Delete a backup policy +// This request deletes a backup policy. This operation cannot be reversed. +// +// If the request is accepted, the backup policy `status` will be set to `deleting`. Once deletion processing completes, +// the backup policy will no longer be retrievable. +func (vpc *VpcV1) DeleteBackupPolicy(deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteBackupPolicyWithContext(context.Background(), deleteBackupPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBackupPolicyJobWithContext is an alternate form of the GetBackupPolicyJob method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPolicyJobOptions *GetBackupPolicyJobOptions) (result *BackupPolicyJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyJobOptions, "getBackupPolicyJobOptions cannot be nil") +// DeleteBackupPolicyWithContext is an alternate form of the DeleteBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteBackupPolicyWithContext(ctx context.Context, deleteBackupPolicyOptions *DeleteBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteBackupPolicyOptions, "deleteBackupPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBackupPolicyJobOptions, "getBackupPolicyJobOptions") + err = core.ValidateStruct(deleteBackupPolicyOptions, "deleteBackupPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyJobOptions.BackupPolicyID, - "id": *getBackupPolicyJobOptions.ID, + "id": *deleteBackupPolicyOptions.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, `/backup_policies/{backup_policy_id}/jobs/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBackupPolicyJobOptions.Headers { + for headerName, headerValue := range deleteBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyJob") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteBackupPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if deleteBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteBackupPolicyOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -18580,12 +18915,12 @@ func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPo var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_backup_policy_job", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_backup_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJob) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18596,46 +18931,45 @@ func (vpc *VpcV1) GetBackupPolicyJobWithContext(ctx context.Context, getBackupPo return } -// GetBackupPolicyPlan : Retrieve a backup policy plan -// This request retrieves a single backup policy plan specified by the identifier in the URL. -func (vpc *VpcV1) GetBackupPolicyPlan(getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetBackupPolicyPlanWithContext(context.Background(), getBackupPolicyPlanOptions) +// GetBackupPolicy : Retrieve a backup policy +// This request retrieves a single backup policy specified by the identifier in the URL. +func (vpc *VpcV1) GetBackupPolicy(getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetBackupPolicyWithContext(context.Background(), getBackupPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBackupPolicyPlanWithContext is an alternate form of the GetBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupPolicyPlanOptions *GetBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions cannot be nil") +// GetBackupPolicyWithContext is an alternate form of the GetBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) GetBackupPolicyWithContext(ctx context.Context, getBackupPolicyOptions *GetBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getBackupPolicyOptions, "getBackupPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBackupPolicyPlanOptions, "getBackupPolicyPlanOptions") + err = core.ValidateStruct(getBackupPolicyOptions, "getBackupPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *getBackupPolicyPlanOptions.BackupPolicyID, - "id": *getBackupPolicyPlanOptions.ID, + "id": *getBackupPolicyOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range getBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBackupPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -18653,12 +18987,12 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_backup_policy_plan", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_backup_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18669,58 +19003,62 @@ func (vpc *VpcV1) GetBackupPolicyPlanWithContext(ctx context.Context, getBackupP return } -// ListBackupPolicies : List backup policies -// This request lists backup policies in the region. Backup policies control which sources are selected for backup and -// include a set of backup policy plans that provide the backup schedules and deletion triggers. -func (vpc *VpcV1) ListBackupPolicies(listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBackupPoliciesWithContext(context.Background(), listBackupPoliciesOptions) +// UpdateBackupPolicy : Update a backup policy +// This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch +// object is structured in the same way as a retrieved backup policy and contains only the information to be updated. +func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBackupPoliciesWithContext is an alternate form of the ListBackupPolicies method which supports a Context parameter -func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupPoliciesOptions *ListBackupPoliciesOptions) (result *BackupPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBackupPoliciesOptions, "listBackupPoliciesOptions") +// UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *updateBackupPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBackupPoliciesOptions.Headers { + for headerName, headerValue := range updateBackupPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateBackupPolicyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listBackupPoliciesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPoliciesOptions.Start)) - } - if listBackupPoliciesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPoliciesOptions.Limit)) - } - if listBackupPoliciesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listBackupPoliciesOptions.ResourceGroupID)) - } - if listBackupPoliciesOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPoliciesOptions.Name)) - } - if listBackupPoliciesOptions.Tag != nil { - builder.AddQuery("tag", fmt.Sprint(*listBackupPoliciesOptions.Tag)) + + _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -18732,12 +19070,12 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_backup_policies", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_backup_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18748,46 +19086,40 @@ func (vpc *VpcV1) ListBackupPoliciesWithContext(ctx context.Context, listBackupP return } -// ListBackupPolicyJobs : List jobs for a backup policy -// This request retrieves jobs for a backup policy. A backup job represents the execution of a backup policy plan for a -// resource matching the policy's criteria. -func (vpc *VpcV1) ListBackupPolicyJobs(listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBackupPolicyJobsWithContext(context.Background(), listBackupPolicyJobsOptions) +// ListRegions : List regions +// This request lists regions. Each region is a separate geographic area that contains multiple isolated zones. +// Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones +// in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation +// available. Resources deployed within a single region also benefit from the low latency afforded by geographic +// proximity. +func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBackupPolicyJobsWithContext is an alternate form of the ListBackupPolicyJobs method which supports a Context parameter -func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBackupPolicyJobsOptions *ListBackupPolicyJobsOptions) (result *BackupPolicyJobCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listBackupPolicyJobsOptions, "listBackupPolicyJobsOptions") +// ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter +func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyJobsOptions.BackupPolicyID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/jobs`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBackupPolicyJobsOptions.Headers { + for headerName, headerValue := range listRegionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyJobs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -18795,30 +19127,6 @@ func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBacku builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listBackupPolicyJobsOptions.Status != nil { - builder.AddQuery("status", fmt.Sprint(*listBackupPolicyJobsOptions.Status)) - } - if listBackupPolicyJobsOptions.BackupPolicyPlanID != nil { - builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listBackupPolicyJobsOptions.BackupPolicyPlanID)) - } - if listBackupPolicyJobsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listBackupPolicyJobsOptions.Start)) - } - if listBackupPolicyJobsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listBackupPolicyJobsOptions.Limit)) - } - if listBackupPolicyJobsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listBackupPolicyJobsOptions.Sort)) - } - if listBackupPolicyJobsOptions.SourceID != nil { - builder.AddQuery("source.id", fmt.Sprint(*listBackupPolicyJobsOptions.SourceID)) - } - if listBackupPolicyJobsOptions.TargetSnapshotsID != nil { - builder.AddQuery("target_snapshots[].id", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsID)) - } - if listBackupPolicyJobsOptions.TargetSnapshotsCRN != nil { - builder.AddQuery("target_snapshots[].crn", fmt.Sprint(*listBackupPolicyJobsOptions.TargetSnapshotsCRN)) - } request, err := builder.Build() if err != nil { @@ -18829,12 +19137,12 @@ func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBacku var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_backup_policy_jobs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_regions", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyJobCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -18845,223 +19153,53 @@ func (vpc *VpcV1) ListBackupPolicyJobsWithContext(ctx context.Context, listBacku return } -// ListBackupPolicyPlans : List plans for a backup policy -// This request retrieves plans for a backup policy. Backup plans provide the backup schedule and deletion triggers. -func (vpc *VpcV1) ListBackupPolicyPlans(listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListBackupPolicyPlansWithContext(context.Background(), listBackupPolicyPlansOptions) +// GetRegion : Retrieve a region +// This request retrieves a single region specified by the name in the URL. +func (vpc *VpcV1) GetRegion(getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetRegionWithContext(context.Background(), getRegionOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBackupPolicyPlansWithContext is an alternate form of the ListBackupPolicyPlans method which supports a Context parameter -func (vpc *VpcV1) ListBackupPolicyPlansWithContext(ctx context.Context, listBackupPolicyPlansOptions *ListBackupPolicyPlansOptions) (result *BackupPolicyPlanCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions cannot be nil") +// GetRegionWithContext is an alternate form of the GetRegion method which supports a Context parameter +func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getRegionOptions, "getRegionOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listBackupPolicyPlansOptions, "listBackupPolicyPlansOptions") + err = core.ValidateStruct(getRegionOptions, "getRegionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "backup_policy_id": *listBackupPolicyPlansOptions.BackupPolicyID, + "name": *getRegionOptions.Name, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listBackupPolicyPlansOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBackupPolicyPlans") - 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 listBackupPolicyPlansOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listBackupPolicyPlansOptions.Name)) - } - - 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_backup_policy_plans", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlanCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateBackupPolicy : Update a backup policy -// This request updates a backup policy with the information in a provided backup policy patch. The backup policy patch -// object is structured in the same way as a retrieved backup policy and contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicy(updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBackupPolicyWithContext(context.Background(), updateBackupPolicyOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateBackupPolicyWithContext is an alternate form of the UpdateBackupPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyWithContext(ctx context.Context, updateBackupPolicyOptions *UpdateBackupPolicyOptions) (result BackupPolicyIntf, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBackupPolicyOptions, "updateBackupPolicyOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateBackupPolicyOptions, "updateBackupPolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *updateBackupPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range updateBackupPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateBackupPolicyOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyOptions.IfMatch)) - } - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - - _, err = builder.SetBodyContentJSON(updateBackupPolicyOptions.BackupPolicyPatch) - 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_backup_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicy) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// UpdateBackupPolicyPlan : Update a backup policy plan -// This request updates a backup policy plan with the information in a provided plan patch. The plan patch object is -// structured in the same way as a retrieved backup policy plan and can contains only the information to be updated. -func (vpc *VpcV1) UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateBackupPolicyPlanWithContext(context.Background(), updateBackupPolicyPlanOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// UpdateBackupPolicyPlanWithContext is an alternate form of the UpdateBackupPolicyPlan method which supports a Context parameter -func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateBackupPolicyPlanOptions *UpdateBackupPolicyPlanOptions) (result *BackupPolicyPlan, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateBackupPolicyPlanOptions, "updateBackupPolicyPlanOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "backup_policy_id": *updateBackupPolicyPlanOptions.BackupPolicyID, - "id": *updateBackupPolicyPlanOptions.ID, - } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/backup_policies/{backup_policy_id}/plans/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBackupPolicyPlanOptions.Headers { + for headerName, headerValue := range getRegionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateBackupPolicyPlan") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateBackupPolicyPlanOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateBackupPolicyPlanOptions.IfMatch)) - } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(updateBackupPolicyPlanOptions.BackupPolicyPlanPatch) - 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()) @@ -19071,12 +19209,12 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_backup_policy_plan", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_region", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBackupPolicyPlan) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegion) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19087,45 +19225,46 @@ func (vpc *VpcV1) UpdateBackupPolicyPlanWithContext(ctx context.Context, updateB return } -// GetRegion : Retrieve a region -// This request retrieves a single region specified by the name in the URL. -func (vpc *VpcV1) GetRegion(getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetRegionWithContext(context.Background(), getRegionOptions) +// ListRegionZones : List zones in a region +// This request lists zones in a region. Zones represent logically-isolated data centers with high-bandwidth and +// low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. +func (vpc *VpcV1) ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetRegionWithContext is an alternate form of the GetRegion method which supports a Context parameter -func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getRegionOptions, "getRegionOptions cannot be nil") +// ListRegionZonesWithContext is an alternate form of the ListRegionZones method which supports a Context parameter +func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listRegionZonesOptions, "listRegionZonesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getRegionOptions, "getRegionOptions") + err = core.ValidateStruct(listRegionZonesOptions, "listRegionZonesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getRegionOptions.Name, + "region_name": *listRegionZonesOptions.RegionName, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getRegionOptions.Headers { + for headerName, headerValue := range listRegionZonesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegion") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegionZones") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19143,12 +19282,12 @@ func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *Ge var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_region", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_region_zones", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegion) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19232,46 +19371,41 @@ func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOpt return } -// ListRegionZones : List zones in a region -// This request lists zones in a region. Zones represent logically-isolated data centers with high-bandwidth and -// low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. -func (vpc *VpcV1) ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) +// ListVirtualNetworkInterfaces : List virtual network interfaces +// This request lists virtual network interfaces in the region. A virtual network interface is a logical abstraction of +// a virtual network interface in a subnet, and may be attached to a target resource. +// +// The virtual network interfaces will be sorted by their `created_at` property values, with newest virtual network +// interfaces first. Virtual network interfaces with identical +// `created_at` property values will in turn be sorted by ascending `name` property values. +func (vpc *VpcV1) ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListRegionZonesWithContext is an alternate form of the ListRegionZones method which supports a Context parameter -func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listRegionZonesOptions, "listRegionZonesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listRegionZonesOptions, "listRegionZonesOptions") +// ListVirtualNetworkInterfacesWithContext is an alternate form of the ListVirtualNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVirtualNetworkInterfacesOptions, "listVirtualNetworkInterfacesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "region_name": *listRegionZonesOptions.RegionName, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listRegionZonesOptions.Headers { + for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegionZones") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19279,6 +19413,15 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listVirtualNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) + } + if listVirtualNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Limit)) + } + if listVirtualNetworkInterfacesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVirtualNetworkInterfacesOptions.ResourceGroupID)) + } request, err := builder.Build() if err != nil { @@ -19289,12 +19432,12 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_region_zones", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_virtual_network_interfaces", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterfaceCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19305,135 +19448,88 @@ func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZone return } -// ListRegions : List regions -// This request lists regions. Each region is a separate geographic area that contains multiple isolated zones. -// Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones -// in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation -// available. Resources deployed within a single region also benefit from the low latency afforded by geographic -// proximity. -func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) +// CreateVirtualNetworkInterface : Create a virtual network interface +// This request creates a new virtual network interface from a virtual network interface prototype object. The prototype +// object is structured in the same way as a retrieved virtual network interface, and contains the information necessary +// to create the new virtual network interface. +func (vpc *VpcV1) CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateVirtualNetworkInterfaceWithContext(context.Background(), createVirtualNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter -func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") +// CreateVirtualNetworkInterfaceWithContext is an alternate form of the CreateVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - 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, `/regions`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listRegionsOptions.Headers { + for headerName, headerValue := range createVirtualNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVirtualNetworkInterface") 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)) - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) - return + body := make(map[string]interface{}) + if createVirtualNetworkInterfaceOptions.AllowIPSpoofing != nil { + body["allow_ip_spoofing"] = createVirtualNetworkInterfaceOptions.AllowIPSpoofing } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - core.EnrichHTTPProblem(err, "list_regions", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return + if createVirtualNetworkInterfaceOptions.AutoDelete != nil { + body["auto_delete"] = createVirtualNetworkInterfaceOptions.AutoDelete } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result + if createVirtualNetworkInterfaceOptions.EnableInfrastructureNat != nil { + body["enable_infrastructure_nat"] = createVirtualNetworkInterfaceOptions.EnableInfrastructureNat } - - return -} - -// AddNetworkInterfaceFloatingIP : Add an association between a floating IP and a virtual network interface -// This request adds an association between the specified floating IP and the specified virtual network interface. -// -// If the virtual network interface has `enable_infrastructure_nat` set to `true`, no more than one floating IP can be -// associated, and network address translation is performed between the floating IP address and the virtual network -// interface's `primary_ip` address. -// -// If the virtual network interface has `enable_infrastructure_nat` set to `false`, packets are passed unchanged to/from -// the virtual network interface. -// -// The floating IP must: -// - be in the same `zone` as the virtual network interface -// - not currently be associated with another resource -// -// The virtual network interface's `target` must not currently be a file share mount target. -// -// A request body is not required, and if provided, is ignored. -func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return + if createVirtualNetworkInterfaceOptions.Ips != nil { + body["ips"] = createVirtualNetworkInterfaceOptions.Ips } - err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return + if createVirtualNetworkInterfaceOptions.Name != nil { + body["name"] = createVirtualNetworkInterfaceOptions.Name } - - pathParamsMap := map[string]string{ - "virtual_network_interface_id": *addNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *addNetworkInterfaceFloatingIPOptions.ID, + if createVirtualNetworkInterfaceOptions.PrimaryIP != nil { + body["primary_ip"] = createVirtualNetworkInterfaceOptions.PrimaryIP } - - builder := core.NewRequestBuilder(core.PUT) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return + if createVirtualNetworkInterfaceOptions.ProtocolStateFilteringMode != nil { + body["protocol_state_filtering_mode"] = createVirtualNetworkInterfaceOptions.ProtocolStateFilteringMode } - - for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers { - builder.AddHeader(headerName, headerValue) + if createVirtualNetworkInterfaceOptions.ResourceGroup != nil { + body["resource_group"] = createVirtualNetworkInterfaceOptions.ResourceGroup } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) + if createVirtualNetworkInterfaceOptions.SecurityGroups != nil { + body["security_groups"] = createVirtualNetworkInterfaceOptions.SecurityGroups + } + if createVirtualNetworkInterfaceOptions.Subnet != nil { + body["subnet"] = createVirtualNetworkInterfaceOptions.Subnet + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } - 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 { @@ -19444,12 +19540,12 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "add_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_virtual_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19460,49 +19556,47 @@ func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, return } -// AddVirtualNetworkInterfaceIP : Bind a reserved IP to a virtual network interface -// This request binds the specified reserved IP to the specified virtual network interface. -// -// The reserved IP must currently be unbound and in the primary IP's subnet. The virtual network interface's `target` -// must not currently be a file share mount target. -func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) +// DeleteVirtualNetworkInterfaces : Delete a virtual network interface +// This request deletes a virtual network interface. This operation cannot be reversed. For this request to succeed, the +// virtual network interface must not be required by another resource, such as the primary network attachment for an +// instance. +func (vpc *VpcV1) DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) err = core.RepurposeSDKProblem(err, "") return } -// AddVirtualNetworkInterfaceIPWithContext is an alternate form of the AddVirtualNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions cannot be nil") +// DeleteVirtualNetworkInterfacesWithContext is an alternate form of the DeleteVirtualNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") + err = core.ValidateStruct(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *addVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, - "id": *addVirtualNetworkInterfaceIPOptions.ID, + "id": *deleteVirtualNetworkInterfacesOptions.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, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range addVirtualNetworkInterfaceIPOptions.Headers { + for headerName, headerValue := range deleteVirtualNetworkInterfacesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVirtualNetworkInterfaces") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19520,12 +19614,12 @@ func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, a var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "add_virtual_network_interface_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_virtual_network_interfaces", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19536,89 +19630,53 @@ func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, a return } -// CreateVirtualNetworkInterface : Create a virtual network interface -// This request creates a new virtual network interface from a virtual network interface prototype object. The prototype -// object is structured in the same way as a retrieved virtual network interface, and contains the information necessary -// to create the new virtual network interface. -func (vpc *VpcV1) CreateVirtualNetworkInterface(createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVirtualNetworkInterfaceWithContext(context.Background(), createVirtualNetworkInterfaceOptions) +// GetVirtualNetworkInterface : Retrieve a virtual network interface +// This request retrieves a single virtual network interface specified by the identifier in the URL. +func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVirtualNetworkInterfaceWithContext(context.Background(), getVirtualNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateVirtualNetworkInterfaceWithContext is an alternate form of the CreateVirtualNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, createVirtualNetworkInterfaceOptions *CreateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions cannot be nil") +// GetVirtualNetworkInterfaceWithContext is an alternate form of the GetVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createVirtualNetworkInterfaceOptions, "createVirtualNetworkInterfaceOptions") + err = core.ValidateStruct(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *getVirtualNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVirtualNetworkInterfaceOptions.Headers { + for headerName, headerValue := range getVirtualNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVirtualNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterface") 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 createVirtualNetworkInterfaceOptions.AllowIPSpoofing != nil { - body["allow_ip_spoofing"] = createVirtualNetworkInterfaceOptions.AllowIPSpoofing - } - if createVirtualNetworkInterfaceOptions.AutoDelete != nil { - body["auto_delete"] = createVirtualNetworkInterfaceOptions.AutoDelete - } - if createVirtualNetworkInterfaceOptions.EnableInfrastructureNat != nil { - body["enable_infrastructure_nat"] = createVirtualNetworkInterfaceOptions.EnableInfrastructureNat - } - if createVirtualNetworkInterfaceOptions.Ips != nil { - body["ips"] = createVirtualNetworkInterfaceOptions.Ips - } - if createVirtualNetworkInterfaceOptions.Name != nil { - body["name"] = createVirtualNetworkInterfaceOptions.Name - } - if createVirtualNetworkInterfaceOptions.PrimaryIP != nil { - body["primary_ip"] = createVirtualNetworkInterfaceOptions.PrimaryIP - } - if createVirtualNetworkInterfaceOptions.ProtocolStateFilteringMode != nil { - body["protocol_state_filtering_mode"] = createVirtualNetworkInterfaceOptions.ProtocolStateFilteringMode - } - if createVirtualNetworkInterfaceOptions.ResourceGroup != nil { - body["resource_group"] = createVirtualNetworkInterfaceOptions.ResourceGroup - } - if createVirtualNetworkInterfaceOptions.SecurityGroups != nil { - body["security_groups"] = createVirtualNetworkInterfaceOptions.SecurityGroups - } - if createVirtualNetworkInterfaceOptions.Subnet != nil { - body["subnet"] = createVirtualNetworkInterfaceOptions.Subnet - } - _, 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()) @@ -19628,7 +19686,7 @@ func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_virtual_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_virtual_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -19644,34 +19702,34 @@ func (vpc *VpcV1) CreateVirtualNetworkInterfaceWithContext(ctx context.Context, return } -// DeleteVirtualNetworkInterfaces : Delete a virtual network interface -// This request deletes a virtual network interface. This operation cannot be reversed. For this request to succeed, the -// virtual network interface must not be required by another resource, such as the primary network attachment for an -// instance. -func (vpc *VpcV1) DeleteVirtualNetworkInterfaces(deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.DeleteVirtualNetworkInterfacesWithContext(context.Background(), deleteVirtualNetworkInterfacesOptions) +// UpdateVirtualNetworkInterface : Update a virtual network interface +// This request updates a virtual network interface with the information in a provided virtual network interface patch. +// The virtual network interface patch object is structured in the same way as a retrieved virtual network interface and +// contains only the information to be updated. +func (vpc *VpcV1) UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteVirtualNetworkInterfacesWithContext is an alternate form of the DeleteVirtualNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, deleteVirtualNetworkInterfacesOptions *DeleteVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions cannot be nil") +// UpdateVirtualNetworkInterfaceWithContext is an alternate form of the UpdateVirtualNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteVirtualNetworkInterfacesOptions, "deleteVirtualNetworkInterfacesOptions") + err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteVirtualNetworkInterfacesOptions.ID, + "id": *updateVirtualNetworkInterfaceOptions.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, `/virtual_network_interfaces/{id}`, pathParamsMap) @@ -19680,19 +19738,26 @@ func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, return } - for headerName, headerValue := range deleteVirtualNetworkInterfacesOptions.Headers { + for headerName, headerValue := range updateVirtualNetworkInterfaceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVirtualNetworkInterfaces") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVirtualNetworkInterface") 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(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) + 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()) @@ -19702,7 +19767,7 @@ func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_virtual_network_interfaces", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_virtual_network_interface", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -19718,47 +19783,45 @@ func (vpc *VpcV1) DeleteVirtualNetworkInterfacesWithContext(ctx context.Context, return } -// GetNetworkInterfaceFloatingIP : Retrieve associated floating IP -// This request retrieves a specified floating IP if it is associated with the virtual network interface specified in -// the URL. -func (vpc *VpcV1) GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) +// ListNetworkInterfaceFloatingIps : List floating IPs associated with a virtual network interface +// This request lists floating IPs associated with a virtual network interface. +func (vpc *VpcV1) ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil") +// ListNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *getNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *getNetworkInterfaceFloatingIPOptions.ID, + "virtual_network_interface_id": *listNetworkInterfaceFloatingIpsOptions.VirtualNetworkInterfaceID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range listNetworkInterfaceFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkInterfaceFloatingIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19766,6 +19829,15 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + if listNetworkInterfaceFloatingIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start)) + } + if listNetworkInterfaceFloatingIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Limit)) + } + if listNetworkInterfaceFloatingIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Sort)) + } request, err := builder.Build() if err != nil { @@ -19776,12 +19848,12 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_network_interface_floating_ips", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19792,49 +19864,49 @@ func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, return } -// GetVirtualNetworkInterface : Retrieve a virtual network interface -// This request retrieves a single virtual network interface specified by the identifier in the URL. -func (vpc *VpcV1) GetVirtualNetworkInterface(getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVirtualNetworkInterfaceWithContext(context.Background(), getVirtualNetworkInterfaceOptions) +// RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface +// This request disassociates the specified floating IP from the specified virtual network interface. +func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVirtualNetworkInterfaceWithContext is an alternate form of the GetVirtualNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, getVirtualNetworkInterfaceOptions *GetVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions cannot be nil") +// RemoveNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVirtualNetworkInterfaceOptions, "getVirtualNetworkInterfaceOptions") + err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVirtualNetworkInterfaceOptions.ID, + "virtual_network_interface_id": *removeNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *removeNetworkInterfaceFloatingIPOptions.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, `/virtual_network_interfaces/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVirtualNetworkInterfaceOptions.Headers { + for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") 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)) @@ -19845,66 +19917,57 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceWithContext(ctx context.Context, get 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_virtual_network_interface", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "remove_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterface) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetVirtualNetworkInterfaceIP : Retrieve bound reserved IP -// This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in +// GetNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request retrieves a specified floating IP if it is associated with the virtual network interface specified in // the URL. -func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) +func (vpc *VpcV1) GetNetworkInterfaceFloatingIP(getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetNetworkInterfaceFloatingIPWithContext(context.Background(), getNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil") +// GetNetworkInterfaceFloatingIPWithContext is an alternate form of the GetNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetNetworkInterfaceFloatingIPWithContext(ctx context.Context, getNetworkInterfaceFloatingIPOptions *GetNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") + err = core.ValidateStruct(getNetworkInterfaceFloatingIPOptions, "getNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *getVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, - "id": *getVirtualNetworkInterfaceIPOptions.ID, + "virtual_network_interface_id": *getNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *getNetworkInterfaceFloatingIPOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { + for headerName, headerValue := range getNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19922,12 +19985,12 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, g var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_virtual_network_interface_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -19938,45 +20001,61 @@ func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, g return } -// ListNetworkInterfaceFloatingIps : List floating IPs associated with a virtual network interface -// This request lists floating IPs associated with a virtual network interface. -func (vpc *VpcV1) ListNetworkInterfaceFloatingIps(listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListNetworkInterfaceFloatingIpsWithContext(context.Background(), listNetworkInterfaceFloatingIpsOptions) +// AddNetworkInterfaceFloatingIP : Add an association between a floating IP and a virtual network interface +// This request adds an association between the specified floating IP and the specified virtual network interface. +// +// If the virtual network interface has `enable_infrastructure_nat` set to `true`, no more than one floating IP can be +// associated, and network address translation is performed between the floating IP address and the virtual network +// interface's `primary_ip` address. +// +// If the virtual network interface has `enable_infrastructure_nat` set to `false`, packets are passed unchanged to/from +// the virtual network interface. +// +// The floating IP must: +// - be in the same `zone` as the virtual network interface +// - not currently be associated with another resource +// +// The virtual network interface's `target` must not currently be a file share mount target. +// +// A request body is not required, and if provided, is ignored. +func (vpc *VpcV1) AddNetworkInterfaceFloatingIP(addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + result, response, err = vpc.AddNetworkInterfaceFloatingIPWithContext(context.Background(), addNetworkInterfaceFloatingIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListNetworkInterfaceFloatingIps method which supports a Context parameter -func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listNetworkInterfaceFloatingIpsOptions *ListNetworkInterfaceFloatingIpsOptions) (result *FloatingIPCollectionVirtualNetworkInterfaceContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions cannot be nil") +// AddNetworkInterfaceFloatingIPWithContext is an alternate form of the AddNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddNetworkInterfaceFloatingIPWithContext(ctx context.Context, addNetworkInterfaceFloatingIPOptions *AddNetworkInterfaceFloatingIPOptions) (result *FloatingIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listNetworkInterfaceFloatingIpsOptions, "listNetworkInterfaceFloatingIpsOptions") + err = core.ValidateStruct(addNetworkInterfaceFloatingIPOptions, "addNetworkInterfaceFloatingIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *listNetworkInterfaceFloatingIpsOptions.VirtualNetworkInterfaceID, + "virtual_network_interface_id": *addNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, + "id": *addNetworkInterfaceFloatingIPOptions.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, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listNetworkInterfaceFloatingIpsOptions.Headers { + for headerName, headerValue := range addNetworkInterfaceFloatingIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkInterfaceFloatingIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddNetworkInterfaceFloatingIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19984,15 +20063,6 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - if listNetworkInterfaceFloatingIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Start)) - } - if listNetworkInterfaceFloatingIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Limit)) - } - if listNetworkInterfaceFloatingIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listNetworkInterfaceFloatingIpsOptions.Sort)) - } request, err := builder.Build() if err != nil { @@ -20003,12 +20073,12 @@ func (vpc *VpcV1) ListNetworkInterfaceFloatingIpsWithContext(ctx context.Context var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_network_interface_floating_ips", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_network_interface_floating_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollectionVirtualNetworkInterfaceContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20100,57 +20170,55 @@ func (vpc *VpcV1) ListVirtualNetworkInterfaceIpsWithContext(ctx context.Context, return } -// ListVirtualNetworkInterfaces : List virtual network interfaces -// This request lists virtual network interfaces in the region. A virtual network interface is a logical abstraction of -// a virtual network interface in a subnet, and may be attached to a target resource. +// RemoveVirtualNetworkInterfaceIP : Unbind a reserved IP from a virtual network interface +// This request unbinds the specified reserved IP from the specified virtual network interface. If the reserved IP has +// `auto_delete` set to `true`, the reserved IP will be deleted. // -// The virtual network interfaces will be sorted by their `created_at` property values, with newest virtual network -// interfaces first. Virtual network interfaces with identical -// `created_at` property values will in turn be sorted by ascending `name` property values. -func (vpc *VpcV1) ListVirtualNetworkInterfaces(listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVirtualNetworkInterfacesWithContext(context.Background(), listVirtualNetworkInterfacesOptions) +// The reserved IP for the `primary_ip` cannot be unbound. +func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { + response, err = vpc.RemoveVirtualNetworkInterfaceIPWithContext(context.Background(), removeVirtualNetworkInterfaceIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListVirtualNetworkInterfacesWithContext is an alternate form of the ListVirtualNetworkInterfaces method which supports a Context parameter -func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, listVirtualNetworkInterfacesOptions *ListVirtualNetworkInterfacesOptions) (result *VirtualNetworkInterfaceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listVirtualNetworkInterfacesOptions, "listVirtualNetworkInterfacesOptions") +// RemoveVirtualNetworkInterfaceIPWithContext is an alternate form of the RemoveVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context, removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "virtual_network_interface_id": *removeVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *removeVirtualNetworkInterfaceIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVirtualNetworkInterfacesOptions.Headers { + for headerName, headerValue := range removeVirtualNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVirtualNetworkInterfaces") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVirtualNetworkInterfaceIP") 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 listVirtualNetworkInterfacesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Start)) - } - if listVirtualNetworkInterfacesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVirtualNetworkInterfacesOptions.Limit)) - } - if listVirtualNetworkInterfacesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVirtualNetworkInterfacesOptions.ResourceGroupID)) - } request, err := builder.Build() if err != nil { @@ -20158,68 +20226,61 @@ func (vpc *VpcV1) ListVirtualNetworkInterfacesWithContext(ctx context.Context, l 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_virtual_network_interfaces", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "remove_virtual_network_interface_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVirtualNetworkInterfaceCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// RemoveNetworkInterfaceFloatingIP : Disassociate a floating IP from a virtual network interface -// This request disassociates the specified floating IP from the specified virtual network interface. -func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIP(removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveNetworkInterfaceFloatingIPWithContext(context.Background(), removeNetworkInterfaceFloatingIPOptions) +// GetVirtualNetworkInterfaceIP : Retrieve bound reserved IP +// This request retrieves the specified reserved IP address if it is bound to the virtual network interface specified in +// the URL. +func (vpc *VpcV1) GetVirtualNetworkInterfaceIP(getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetVirtualNetworkInterfaceIPWithContext(context.Background(), getVirtualNetworkInterfaceIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// RemoveNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveNetworkInterfaceFloatingIP method which supports a Context parameter -func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeNetworkInterfaceFloatingIPOptions *RemoveNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions cannot be nil") +// GetVirtualNetworkInterfaceIPWithContext is an alternate form of the GetVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) GetVirtualNetworkInterfaceIPWithContext(ctx context.Context, getVirtualNetworkInterfaceIPOptions *GetVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(removeNetworkInterfaceFloatingIPOptions, "removeNetworkInterfaceFloatingIPOptions") + err = core.ValidateStruct(getVirtualNetworkInterfaceIPOptions, "getVirtualNetworkInterfaceIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *removeNetworkInterfaceFloatingIPOptions.VirtualNetworkInterfaceID, - "id": *removeNetworkInterfaceFloatingIPOptions.ID, + "virtual_network_interface_id": *getVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *getVirtualNetworkInterfaceIPOptions.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, `/virtual_network_interfaces/{virtual_network_interface_id}/floating_ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range removeNetworkInterfaceFloatingIPOptions.Headers { + for headerName, headerValue := range getVirtualNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveNetworkInterfaceFloatingIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVirtualNetworkInterfaceIP") 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)) @@ -20230,46 +20291,55 @@ func (vpc *VpcV1) RemoveNetworkInterfaceFloatingIPWithContext(ctx context.Contex 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_network_interface_floating_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_virtual_network_interface_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// RemoveVirtualNetworkInterfaceIP : Unbind a reserved IP from a virtual network interface -// This request unbinds the specified reserved IP from the specified virtual network interface. If the reserved IP has -// `auto_delete` set to `true`, the reserved IP will be deleted. +// AddVirtualNetworkInterfaceIP : Bind a reserved IP to a virtual network interface +// This request binds the specified reserved IP to the specified virtual network interface. // -// The reserved IP for the `primary_ip` cannot be unbound. -func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIP(removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveVirtualNetworkInterfaceIPWithContext(context.Background(), removeVirtualNetworkInterfaceIPOptions) +// The reserved IP must currently be unbound and in the primary IP's subnet. The virtual network interface's `target` +// must not currently be a file share mount target. +func (vpc *VpcV1) AddVirtualNetworkInterfaceIP(addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + result, response, err = vpc.AddVirtualNetworkInterfaceIPWithContext(context.Background(), addVirtualNetworkInterfaceIPOptions) err = core.RepurposeSDKProblem(err, "") return } -// RemoveVirtualNetworkInterfaceIPWithContext is an alternate form of the RemoveVirtualNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context, removeVirtualNetworkInterfaceIPOptions *RemoveVirtualNetworkInterfaceIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions cannot be nil") +// AddVirtualNetworkInterfaceIPWithContext is an alternate form of the AddVirtualNetworkInterfaceIP method which supports a Context parameter +func (vpc *VpcV1) AddVirtualNetworkInterfaceIPWithContext(ctx context.Context, addVirtualNetworkInterfaceIPOptions *AddVirtualNetworkInterfaceIPOptions) (result *ReservedIPReference, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(removeVirtualNetworkInterfaceIPOptions, "removeVirtualNetworkInterfaceIPOptions") + err = core.ValidateStruct(addVirtualNetworkInterfaceIPOptions, "addVirtualNetworkInterfaceIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "virtual_network_interface_id": *removeVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, - "id": *removeVirtualNetworkInterfaceIPOptions.ID, + "virtual_network_interface_id": *addVirtualNetworkInterfaceIPOptions.VirtualNetworkInterfaceID, + "id": *addVirtualNetworkInterfaceIPOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/virtual_network_interfaces/{virtual_network_interface_id}/ips/{id}`, pathParamsMap) @@ -20278,14 +20348,15 @@ func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context return } - for headerName, headerValue := range removeVirtualNetworkInterfaceIPOptions.Headers { + for headerName, headerValue := range addVirtualNetworkInterfaceIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVirtualNetworkInterfaceIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVirtualNetworkInterfaceIP") 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)) @@ -20296,70 +20367,72 @@ func (vpc *VpcV1) RemoveVirtualNetworkInterfaceIPWithContext(ctx context.Context 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_virtual_network_interface_ip", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_virtual_network_interface_ip", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPReference) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UpdateVirtualNetworkInterface : Update a virtual network interface -// This request updates a virtual network interface with the information in a provided virtual network interface patch. -// The virtual network interface patch object is structured in the same way as a retrieved virtual network interface and -// contains only the information to be updated. -func (vpc *VpcV1) UpdateVirtualNetworkInterface(updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - result, response, err = vpc.UpdateVirtualNetworkInterfaceWithContext(context.Background(), updateVirtualNetworkInterfaceOptions) +// 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 } -// UpdateVirtualNetworkInterfaceWithContext is an alternate form of the UpdateVirtualNetworkInterface method which supports a Context parameter -func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, updateVirtualNetworkInterfaceOptions *UpdateVirtualNetworkInterfaceOptions) (result *VirtualNetworkInterface, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateVirtualNetworkInterfaceOptions, "updateVirtualNetworkInterfaceOptions") +// 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 } - pathParamsMap := map[string]string{ - "id": *updateVirtualNetworkInterfaceOptions.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, `/virtual_network_interfaces/{id}`, pathParamsMap) + _, 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 updateVirtualNetworkInterfaceOptions.Headers { + for headerName, headerValue := range listPublicGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVirtualNetworkInterface") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") 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(updateVirtualNetworkInterfaceOptions.VirtualNetworkInterfacePatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listPublicGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) + } + if listPublicGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) + } + if listPublicGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) } request, err := builder.Build() @@ -20371,12 +20444,12 @@ func (vpc *VpcV1) UpdateVirtualNetworkInterfaceWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_virtual_network_interface", 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, UnmarshalVirtualNetworkInterface) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20619,53 +20692,58 @@ func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGate 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) +// 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 } -// 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") +// 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(updatePublicGatewayOptions, "updatePublicGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *updatePublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) 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, `/public_gateways/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listPublicGatewaysOptions.Headers { + for headerName, headerValue := range updatePublicGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") 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 listPublicGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) - } - if listPublicGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) - } - if listPublicGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) + + _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -20677,12 +20755,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, "update_public_gateway", 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, UnmarshalPublicGateway) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20693,58 +20771,67 @@ func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicG 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) +// 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 } -// 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(updatePublicGatewayOptions, "updatePublicGatewayOptions") +// 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{ - "id": *updatePublicGatewayOptions.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, `/public_gateways/{id}`, 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 updatePublicGatewayOptions.Headers { + for headerName, headerValue := range listFloatingIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") 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(updatePublicGatewayOptions.PublicGatewayPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + 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() @@ -20756,12 +20843,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, "list_floating_ips", 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, UnmarshalFloatingIPCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -20982,94 +21069,6 @@ func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOpt 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) - 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") - 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, `/floating_ips`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range listFloatingIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") - 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 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 { - 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_floating_ips", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - 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) { @@ -21149,30 +21148,25 @@ func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatin 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) +// 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 } -// 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(createNetworkACLOptions, "createNetworkACLOptions") +// 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 } - 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, `/network_acls`, nil) @@ -21181,24 +21175,26 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork return } - for headerName, headerValue := range createNetworkACLOptions.Headers { + for headerName, headerValue := range listNetworkAclsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") 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 + if listNetworkAclsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) + } + 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() @@ -21210,12 +21206,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, "list_network_acls", 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, UnmarshalNetworkACLCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21226,46 +21222,43 @@ func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetwork 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) +// 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 } -// 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") +// 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(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") + err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, - } - builder := core.NewRequestBuilder(core.POST) 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, `/network_acls`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createNetworkACLRuleOptions.Headers { + for headerName, headerValue := range createNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -21275,7 +21268,7 @@ func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNet builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) + _, err = builder.SetBodyContentJSON(createNetworkACLOptions.NetworkACLPrototype) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -21290,12 +21283,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, "create_network_acl", 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, UnmarshalNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21369,69 +21362,6 @@ func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetwork 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") - 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_network_acl_rule", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) { @@ -21504,54 +21434,60 @@ func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOpt 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) +// 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 } -// 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") +// 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(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") + err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions") 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": *updateNetworkACLOptions.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, `/network_acls/{network_acl_id}/rules/{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 getNetworkACLRuleOptions.Headers { + for headerName, headerValue := range updateNetworkACLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") + 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)) + _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) + 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()) @@ -21561,12 +21497,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, "update_network_acl", 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, UnmarshalNetworkACL) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21659,53 +21595,59 @@ func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetwor 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) +// 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 } -// 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") +// 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(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, + } + + 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, `/network_acls/{network_acl_id}/rules`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listNetworkAclsOptions.Headers { + for headerName, headerValue := range createNetworkACLRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") + 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)) - if listNetworkAclsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) - } - if listNetworkAclsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listNetworkAclsOptions.Limit)) - } - if listNetworkAclsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listNetworkAclsOptions.ResourceGroupID)) + + _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -21717,12 +21659,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, "create_network_acl_rule", 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, UnmarshalNetworkACLRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21733,60 +21675,117 @@ func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAcl 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) +// 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 } -// 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") +// 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(updateNetworkACLOptions, "updateNetworkACLOptions") + err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateNetworkACLOptions.ID, + "network_acl_id": *deleteNetworkACLRuleOptions.NetworkACLID, + "id": *deleteNetworkACLRuleOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + 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, `/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 updateNetworkACLOptions.Headers { + for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") 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(updateNetworkACLOptions.NetworkACLPatch) + request, err := builder.Build() if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_network_acl_rule", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + 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) + 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") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") + 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, + } + + 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) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } + for headerName, headerValue := range getNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") + 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()) @@ -21796,12 +21795,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, "get_network_acl_rule", 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, UnmarshalNetworkACLRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21893,31 +21892,26 @@ func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNet 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) +// 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 } -// 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(createSecurityGroupOptions, "createSecurityGroupOptions") +// 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 } - 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, `/security_groups`, nil) @@ -21926,37 +21920,35 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu return } - for headerName, headerValue := range createSecurityGroupOptions.Headers { + for headerName, headerValue := range listSecurityGroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") 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 createSecurityGroupOptions.VPC != nil { - body["vpc"] = createSecurityGroupOptions.VPC + if listSecurityGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSecurityGroupsOptions.Start)) } - if createSecurityGroupOptions.Name != nil { - body["name"] = createSecurityGroupOptions.Name + if listSecurityGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupsOptions.Limit)) } - if createSecurityGroupOptions.ResourceGroup != nil { - body["resource_group"] = createSecurityGroupOptions.ResourceGroup + if listSecurityGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSecurityGroupsOptions.ResourceGroupID)) } - if createSecurityGroupOptions.Rules != nil { - body["rules"] = createSecurityGroupOptions.Rules + if listSecurityGroupsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listSecurityGroupsOptions.VPCID)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + 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() @@ -21968,12 +21960,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, "list_security_groups", 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, UnmarshalSecurityGroupCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -21984,50 +21976,44 @@ func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecu 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) +// 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 } -// 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") +// 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(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") + err = core.ValidateStruct(createSecurityGroupOptions, "createSecurityGroupOptions") 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, `/security_groups`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range createSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22037,7 +22023,20 @@ 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) + body := make(map[string]interface{}) + if createSecurityGroupOptions.VPC != nil { + body["vpc"] = createSecurityGroupOptions.VPC + } + if createSecurityGroupOptions.Name != nil { + body["name"] = createSecurityGroupOptions.Name + } + if createSecurityGroupOptions.ResourceGroup != nil { + body["resource_group"] = createSecurityGroupOptions.ResourceGroup + } + if createSecurityGroupOptions.Rules != nil { + body["rules"] = createSecurityGroupOptions.Rules + } + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -22052,12 +22051,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_security_group", 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, UnmarshalSecurityGroup) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22068,60 +22067,49 @@ func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, create 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) +// 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 } -// 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") +// 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(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") + err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") 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": *deleteSecurityGroupOptions.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, `/security_groups/{security_group_id}/targets/{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 createSecurityGroupTargetBindingOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") 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)) @@ -22132,52 +22120,42 @@ func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Contex 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_security_group_target_binding", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_security_group", 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 } -// 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) +// 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 } -// 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") +// 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(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") + err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteSecurityGroupOptions.ID, + "id": *getSecurityGroupOptions.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, `/security_groups/{id}`, pathParamsMap) @@ -22186,14 +22164,15 @@ func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecu return } - for headerName, headerValue := range deleteSecurityGroupOptions.Headers { + for headerName, headerValue := range getSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") 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)) @@ -22204,134 +22183,150 @@ func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecu 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", 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, UnmarshalSecurityGroup) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") + err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") 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": *updateSecurityGroupOptions.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, `/security_groups/{security_group_id}/rules/{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 deleteSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range updateSecurityGroupOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") 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(updateSecurityGroupOptions.SecurityGroupPatch) + 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_rule", 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, UnmarshalSecurityGroup) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") + err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") 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, + "security_group_id": *listSecurityGroupRulesOptions.SecurityGroupID, } - 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, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + _, 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 deleteSecurityGroupTargetBindingOptions.Headers { + for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") 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)) @@ -22342,63 +22337,84 @@ func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Contex 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, "list_security_group_rules", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(getSecurityGroupOptions, "getSecurityGroupOptions") + err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getSecurityGroupOptions.ID, + "security_group_id": *createSecurityGroupRuleOptions.SecurityGroupID, } - 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, `/security_groups/{id}`, pathParamsMap) + _, 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 getSecurityGroupOptions.Headers { + for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") 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(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) + 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()) @@ -22408,12 +22424,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, "create_security_group_rule", 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, UnmarshalSecurityGroupRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22424,33 +22440,34 @@ func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGr 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) +// 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 } -// 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") +// 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(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") + err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") 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, + "security_group_id": *deleteSecurityGroupRuleOptions.SecurityGroupID, + "id": *deleteSecurityGroupRuleOptions.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}/rules/{id}`, pathParamsMap) @@ -22459,15 +22476,14 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri return } - for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") 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)) @@ -22478,66 +22494,56 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri 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_rule", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_security_group_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) - 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) +// 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 } -// 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") +// 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(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") + err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") 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, + "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, `/security_groups/{security_group_id}/targets/{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 getSecurityGroupTargetOptions.Headers { + for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -22555,12 +22561,12 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_security_group_target", 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, UnmarshalSecurityGroupTargetReference) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22571,54 +22577,63 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu 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) +// 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 information is not applicable to 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 } -// 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") +// 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(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") + err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "security_group_id": *listSecurityGroupRulesOptions.SecurityGroupID, + "security_group_id": *updateSecurityGroupRuleOptions.SecurityGroupID, + "id": *updateSecurityGroupRuleOptions.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, `/security_groups/{security_group_id}/rules`, 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 listSecurityGroupRulesOptions.Headers { + for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") 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(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) + 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()) @@ -22628,12 +22643,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, "update_security_group_rule", 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, UnmarshalSecurityGroupRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22722,64 +22737,63 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS 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) +// 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 } -// 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") +// 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(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "security_group_id": *deleteSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *deleteSecurityGroupTargetBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) 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, `/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 listSecurityGroupsOptions.Headers { + for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") 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 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 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() if err != nil { @@ -22787,81 +22801,65 @@ func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurit 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_security_groups", 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, UnmarshalSecurityGroupCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(updateSecurityGroupOptions, "updateSecurityGroupOptions") + err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateSecurityGroupOptions.ID, + "security_group_id": *getSecurityGroupTargetOptions.SecurityGroupID, + "id": *getSecurityGroupTargetOptions.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, `/security_groups/{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 updateSecurityGroupOptions.Headers { + for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") 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(updateSecurityGroupOptions.SecurityGroupPatch) - 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()) @@ -22871,12 +22869,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, "get_security_group_target", 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, UnmarshalSecurityGroupTargetReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22887,63 +22885,64 @@ func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecu 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 information is not applicable to 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) +// 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 } -// 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") +// 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(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") + err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") 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, + "security_group_id": *createSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *createSecurityGroupTargetBindingOptions.ID, } - 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, `/security_groups/{security_group_id}/rules/{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 updateSecurityGroupRuleOptions.Headers { + for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") 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(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) - 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()) @@ -22953,12 +22952,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, "create_security_group_target_binding", 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, UnmarshalSecurityGroupTargetReference) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -22969,55 +22968,49 @@ func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, update return } -// AddVPNGatewayAdvertisedCIDR : Set an advertised CIDR on a VPN gateway -// This request adds the specified CIDR to the specified VPN gateway advertised CIDRs. 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 route mode VPN gateways. -func (vpc *VpcV1) AddVPNGatewayAdvertisedCIDR(addVPNGatewayAdvertisedCIDROptions *AddVPNGatewayAdvertisedCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.AddVPNGatewayAdvertisedCIDRWithContext(context.Background(), addVPNGatewayAdvertisedCIDROptions) +// 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 } -// AddVPNGatewayAdvertisedCIDRWithContext is an alternate form of the AddVPNGatewayAdvertisedCIDR method which supports a Context parameter -func (vpc *VpcV1) AddVPNGatewayAdvertisedCIDRWithContext(ctx context.Context, addVPNGatewayAdvertisedCIDROptions *AddVPNGatewayAdvertisedCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addVPNGatewayAdvertisedCIDROptions, "addVPNGatewayAdvertisedCIDROptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(addVPNGatewayAdvertisedCIDROptions, "addVPNGatewayAdvertisedCIDROptions") +// 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": *addVPNGatewayAdvertisedCIDROptions.VPNGatewayID, - "cidr": *addVPNGatewayAdvertisedCIDROptions.CIDR, - } - - 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, `/vpn_gateways/{vpn_gateway_id}/advertised_cidrs/{cidr}`, 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 addVPNGatewayAdvertisedCIDROptions.Headers { + for headerName, headerValue := range listIkePoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayAdvertisedCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") 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 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() if err != nil { @@ -23025,127 +23018,162 @@ func (vpc *VpcV1) AddVPNGatewayAdvertisedCIDRWithContext(ctx context.Context, ad 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_advertised_cidr", 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, UnmarshalIkePolicyCollection) + 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) +// 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 } -// 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") +// 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(addVPNGatewayConnectionsLocalCIDROptions, "addVPNGatewayConnectionsLocalCIDROptions") + 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": *addVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID, - "id": *addVPNGatewayConnectionsLocalCIDROptions.ID, - "cidr": *addVPNGatewayConnectionsLocalCIDROptions.CIDR, - } - - 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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs/{cidr}`, 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 addVPNGatewayConnectionsLocalCIDROptions.Headers { + for headerName, headerValue := range createIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsLocalCIDR") + 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()) 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, "create_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 } -// 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) +// 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 } -// 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") +// 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(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions") + 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": *addVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID, - "id": *addVPNGatewayConnectionsPeerCIDROptions.ID, - "cidr": *addVPNGatewayConnectionsPeerCIDROptions.CIDR, + "id": *deleteIkePolicyOptions.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, `/ike_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 deleteIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsPeerCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -23161,7 +23189,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_ike_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -23169,51 +23197,49 @@ func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Contex return } -// CheckVPNGatewayAdvertisedCIDR : Check if the specified advertised CIDR exists on a VPN gateway -// This request succeeds if an advertised CIDR exists on the specified VPN gateway, and fails otherwise. -// -// This request is only supported for route mode VPN gateways. -func (vpc *VpcV1) CheckVPNGatewayAdvertisedCIDR(checkVPNGatewayAdvertisedCIDROptions *CheckVPNGatewayAdvertisedCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.CheckVPNGatewayAdvertisedCIDRWithContext(context.Background(), checkVPNGatewayAdvertisedCIDROptions) +// 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 } -// CheckVPNGatewayAdvertisedCIDRWithContext is an alternate form of the CheckVPNGatewayAdvertisedCIDR method which supports a Context parameter -func (vpc *VpcV1) CheckVPNGatewayAdvertisedCIDRWithContext(ctx context.Context, checkVPNGatewayAdvertisedCIDROptions *CheckVPNGatewayAdvertisedCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(checkVPNGatewayAdvertisedCIDROptions, "checkVPNGatewayAdvertisedCIDROptions 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(checkVPNGatewayAdvertisedCIDROptions, "checkVPNGatewayAdvertisedCIDROptions") + 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": *checkVPNGatewayAdvertisedCIDROptions.VPNGatewayID, - "cidr": *checkVPNGatewayAdvertisedCIDROptions.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}/advertised_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 checkVPNGatewayAdvertisedCIDROptions.Headers { + for headerName, headerValue := range getIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayAdvertisedCIDR") + 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)) @@ -23224,131 +23250,156 @@ func (vpc *VpcV1) CheckVPNGatewayAdvertisedCIDRWithContext(ctx context.Context, 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_advertised_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 } -// 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) +// 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 } -// 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") +// 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(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions") + 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": *checkVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID, - "id": *checkVPNGatewayConnectionsLocalCIDROptions.ID, - "cidr": *checkVPNGatewayConnectionsLocalCIDROptions.CIDR, + "id": *updateIkePolicyOptions.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, `/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 updateIkePolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsLocalCIDR") + 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, "check_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 } -// 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) +// 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 } -// 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") +// 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(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions") + 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": *checkVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID, - "id": *checkVPNGatewayConnectionsPeerCIDROptions.ID, - "cidr": *checkVPNGatewayConnectionsPeerCIDROptions.CIDR, + "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/{cidr}`, 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 checkVPNGatewayConnectionsPeerCIDROptions.Headers { + for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionsPeerCIDR") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") 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 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 { @@ -23356,86 +23407,67 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionsPeerCIDRWithContext(ctx context.Cont 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, "list_ike_policy_connections", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyConnectionCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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(createIkePolicyOptions, "createIkePolicyOptions") +// 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 } - 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, `/ike_policies`, nil) + _, 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 createIkePolicyOptions.Headers { + for headerName, headerValue := range listIpsecPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies") 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 + if listIpsecPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listIpsecPoliciesOptions.Start)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listIpsecPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listIpsecPoliciesOptions.Limit)) } request, err := builder.Build() @@ -23447,12 +23479,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_ipsec_policies", 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, UnmarshalIPsecPolicyCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23557,56 +23589,116 @@ func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecP 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) +// 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 } -// 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") +// 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(createVPNGatewayOptions, "createVPNGatewayOptions") + err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *deleteIpsecPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) 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, `/ipsec_policies/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPNGatewayOptions.Headers { + for headerName, headerValue := range deleteIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") 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(createVPNGatewayOptions.VPNGatewayPrototype) + request, err := builder.Build() if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_ipsec_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + 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) + 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") + 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, `/ipsec_policies/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } + for headerName, headerValue := range getIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") + 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()) @@ -23616,12 +23708,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, "get_ipsec_policy", 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, UnmarshalIPsecPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23632,55 +23724,55 @@ func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGate 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) +// 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 } -// 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") +// 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(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") + err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *createVPNGatewayConnectionOptions.VPNGatewayID, + "id": *updateIpsecPolicyOptions.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, `/vpn_gateways/{vpn_gateway_id}/connections`, 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 createVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range updateIpsecPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGatewayConnection") + 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)) - _, err = builder.SetBodyContentJSON(createVPNGatewayConnectionOptions.VPNGatewayConnectionPrototype) + _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -23695,12 +23787,12 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_vpn_gateway_connection", 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, UnmarshalVPNGatewayConnection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23711,46 +23803,45 @@ func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, cre return } -// CreateVPNRouteReport : Generate a VPN route report -// Request route report generation. While report generation is in progress, additional requests to generate a report are -// ignored and return the current pending report. -func (vpc *VpcV1) CreateVPNRouteReport(createVPNRouteReportOptions *CreateVPNRouteReportOptions) (result *VPNRouteReport, response *core.DetailedResponse, err error) { - result, response, err = vpc.CreateVPNRouteReportWithContext(context.Background(), createVPNRouteReportOptions) +// 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 } -// CreateVPNRouteReportWithContext is an alternate form of the CreateVPNRouteReport method which supports a Context parameter -func (vpc *VpcV1) CreateVPNRouteReportWithContext(ctx context.Context, createVPNRouteReportOptions *CreateVPNRouteReportOptions) (result *VPNRouteReport, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createVPNRouteReportOptions, "createVPNRouteReportOptions 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(createVPNRouteReportOptions, "createVPNRouteReportOptions") + err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *createVPNRouteReportOptions.VPNGatewayID, + "id": *listIpsecPolicyConnectionsOptions.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_gateways/{vpn_gateway_id}/route_reports`, 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 createVPNRouteReportOptions.Headers { + for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNRouteReport") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -23758,6 +23849,12 @@ func (vpc *VpcV1) CreateVPNRouteReportWithContext(ctx context.Context, createVPN 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 { @@ -23768,12 +23865,12 @@ func (vpc *VpcV1) CreateVPNRouteReportWithContext(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_route_report", 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, UnmarshalVPNRouteReport) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyConnectionCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -23784,52 +23881,58 @@ func (vpc *VpcV1) CreateVPNRouteReportWithContext(ctx context.Context, createVPN 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) +// 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 } -// 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(deleteIkePolicyOptions, "deleteIkePolicyOptions") +// 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": *deleteIkePolicyOptions.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, `/ike_policies/{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 deleteIkePolicyOptions.Headers { + for headerName, headerValue := range listVPNGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") 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 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 { @@ -23837,75 +23940,96 @@ func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolic 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, "list_vpn_gateways", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") + err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "id": *deleteIpsecPolicyOptions.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, `/ipsec_policies/{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 deleteIpsecPolicyOptions.Headers { + for headerName, headerValue := range createVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") + 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/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) + 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_ipsec_policy", 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, UnmarshalVPNGateway) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } @@ -23974,53 +24098,49 @@ func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGate 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) +// 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 } -// 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") +// 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(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") + err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") 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, + "id": *getVPNGatewayOptions.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, `/vpn_gateways/{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 getVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteVPNGatewayConnectionOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*deleteVPNGatewayConnectionOptions.IfMatch)) - } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) @@ -24031,118 +24151,143 @@ 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_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 } -// DeleteVPNRouteReport : Delete a VPN route report -// This request deletes a VPN route report. This operation cannot be reversed. -func (vpc *VpcV1) DeleteVPNRouteReport(deleteVPNRouteReportOptions *DeleteVPNRouteReportOptions) (response *core.DetailedResponse, err error) { - response, err = vpc.DeleteVPNRouteReportWithContext(context.Background(), deleteVPNRouteReportOptions) +// 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 } -// DeleteVPNRouteReportWithContext is an alternate form of the DeleteVPNRouteReport method which supports a Context parameter -func (vpc *VpcV1) DeleteVPNRouteReportWithContext(ctx context.Context, deleteVPNRouteReportOptions *DeleteVPNRouteReportOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVPNRouteReportOptions, "deleteVPNRouteReportOptions 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(deleteVPNRouteReportOptions, "deleteVPNRouteReportOptions") + err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *deleteVPNRouteReportOptions.VPNGatewayID, - "id": *deleteVPNRouteReportOptions.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_gateways/{vpn_gateway_id}/route_reports/{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 deleteVPNRouteReportOptions.Headers { + for headerName, headerValue := range updateVPNGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNRouteReport") + 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_route_report", 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 } -// 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) +// 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 } -// 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") +// 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(getIkePolicyOptions, "getIkePolicyOptions") + err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getIkePolicyOptions.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, `/ike_policies/{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 getIkePolicyOptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24150,6 +24295,15 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio 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 { @@ -24160,12 +24314,12 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_ike_policy", 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, UnmarshalIkePolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24176,53 +24330,60 @@ func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptio 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) +// 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 } -// 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") +// 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(getIpsecPolicyOptions, "getIpsecPolicyOptions") + err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getIpsecPolicyOptions.ID, + "vpn_gateway_id": *createVPNGatewayConnectionOptions.VPNGatewayID, } - 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, `/ipsec_policies/{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 getIpsecPolicyOptions.Headers { + for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") + 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()) @@ -24232,12 +24393,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, "create_vpn_gateway_connection", 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, UnmarshalVPNGatewayConnection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24248,49 +24409,50 @@ func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyO 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) +// 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 } -// 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") +// 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(getVPNGatewayOptions, "getVPNGatewayOptions") + err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPNGatewayOptions.ID, + "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_gateways/{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 getVPNGatewayOptions.Headers { + for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") + 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)) @@ -24301,21 +24463,12 @@ func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOpt 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_vpn_gateway", 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, UnmarshalVPNGateway) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } @@ -24393,54 +24546,61 @@ func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPN return } -// GetVPNRouteReport : Retrieve a VPN route report -// Retrieve a route report. -func (vpc *VpcV1) GetVPNRouteReport(getVPNRouteReportOptions *GetVPNRouteReportOptions) (result *VPNRouteReport, response *core.DetailedResponse, err error) { - result, response, err = vpc.GetVPNRouteReportWithContext(context.Background(), getVPNRouteReportOptions) +// 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 } -// GetVPNRouteReportWithContext is an alternate form of the GetVPNRouteReport method which supports a Context parameter -func (vpc *VpcV1) GetVPNRouteReportWithContext(ctx context.Context, getVPNRouteReportOptions *GetVPNRouteReportOptions) (result *VPNRouteReport, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVPNRouteReportOptions, "getVPNRouteReportOptions 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(getVPNRouteReportOptions, "getVPNRouteReportOptions") + err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *getVPNRouteReportOptions.VPNGatewayID, - "id": *getVPNRouteReportOptions.ID, + "vpn_gateway_id": *updateVPNGatewayConnectionOptions.VPNGatewayID, + "id": *updateVPNGatewayConnectionOptions.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, `/vpn_gateways/{vpn_gateway_id}/route_reports/{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 getVPNRouteReportOptions.Headers { + for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNRouteReport") + 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)) + _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) + 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()) @@ -24450,12 +24610,12 @@ func (vpc *VpcV1) GetVPNRouteReportWithContext(ctx context.Context, getVPNRouteR var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_vpn_route_report", 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, UnmarshalVPNRouteReport) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24466,36 +24626,48 @@ func (vpc *VpcV1) GetVPNRouteReportWithContext(ctx context.Context, getVPNRouteR 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) +// 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 } -// 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") +// 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(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions") 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 = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) + _, 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 listIkePoliciesOptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionsLocalCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsLocalCIDRs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24503,12 +24675,6 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie 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)) - } request, err := builder.Build() if err != nil { @@ -24519,12 +24685,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, "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, UnmarshalIkePolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCIDRs) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24535,58 +24701,55 @@ func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePolicie 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) +// 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 } -// 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") +// 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(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") + err = core.ValidateStruct(removeVPNGatewayConnectionsLocalCIDROptions, "removeVPNGatewayConnectionsLocalCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *listIkePolicyConnectionsOptions.ID, + "vpn_gateway_id": *removeVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID, + "id": *removeVPNGatewayConnectionsLocalCIDROptions.ID, + "cidr": *removeVPNGatewayConnectionsLocalCIDROptions.CIDR, } - 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}/connections`, 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 listIkePolicyConnectionsOptions.Headers { + for headerName, headerValue := range removeVPNGatewayConnectionsLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") + 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 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 { @@ -24594,68 +24757,65 @@ func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listI 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_ike_policy_connections", 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, UnmarshalIkePolicyConnectionCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(checkVPNGatewayConnectionsLocalCIDROptions, "checkVPNGatewayConnectionsLocalCIDROptions") 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, + } + 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, `/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 listIpsecPoliciesOptions.Headers { + for headerName, headerValue := range checkVPNGatewayConnectionsLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies") + 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)) - 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 { @@ -24663,77 +24823,66 @@ func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPol 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_ipsec_policies", 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, UnmarshalIPsecPolicyCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") + err = core.ValidateStruct(addVPNGatewayConnectionsLocalCIDROptions, "addVPNGatewayConnectionsLocalCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *listIpsecPolicyConnectionsOptions.ID, + "vpn_gateway_id": *addVPNGatewayConnectionsLocalCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionsLocalCIDROptions.ID, + "cidr": *addVPNGatewayConnectionsLocalCIDROptions.CIDR, } - 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, `/ipsec_policies/{id}/connections`, 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 listIpsecPolicyConnectionsOptions.Headers { + for headerName, headerValue := range addVPNGatewayConnectionsLocalCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") + 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 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 { @@ -24741,66 +24890,58 @@ func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, lis 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_ipsec_policy_connections", 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, UnmarshalIPsecPolicyConnectionCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListVPNGatewayAdvertisedCIDRs : List advertised CIDRs for a VPN gateway -// This request lists advertised CIDRs for a VPN gateway. +// 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 route mode VPN gateways. -func (vpc *VpcV1) ListVPNGatewayAdvertisedCIDRs(listVPNGatewayAdvertisedCIDRsOptions *ListVPNGatewayAdvertisedCIDRsOptions) (result *VPNGatewayAdvertisedCIDRCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPNGatewayAdvertisedCIDRsWithContext(context.Background(), listVPNGatewayAdvertisedCIDRsOptions) +// 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 } -// ListVPNGatewayAdvertisedCIDRsWithContext is an alternate form of the ListVPNGatewayAdvertisedCIDRs method which supports a Context parameter -func (vpc *VpcV1) ListVPNGatewayAdvertisedCIDRsWithContext(ctx context.Context, listVPNGatewayAdvertisedCIDRsOptions *ListVPNGatewayAdvertisedCIDRsOptions) (result *VPNGatewayAdvertisedCIDRCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNGatewayAdvertisedCIDRsOptions, "listVPNGatewayAdvertisedCIDRsOptions 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(listVPNGatewayAdvertisedCIDRsOptions, "listVPNGatewayAdvertisedCIDRsOptions") + err = core.ValidateStruct(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayAdvertisedCIDRsOptions.VPNGatewayID, + "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, `/vpn_gateways/{vpn_gateway_id}/advertised_cidrs`, pathParamsMap) + _, 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 listVPNGatewayAdvertisedCIDRsOptions.Headers { + for headerName, headerValue := range listVPNGatewayConnectionsPeerCIDRsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayAdvertisedCIDRs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsPeerCIDRs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -24818,12 +24959,12 @@ func (vpc *VpcV1) ListVPNGatewayAdvertisedCIDRsWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpn_gateway_advertised_cidrs", 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, UnmarshalVPNGatewayAdvertisedCIDRCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCIDRs) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -24834,61 +24975,55 @@ func (vpc *VpcV1) ListVPNGatewayAdvertisedCIDRsWithContext(ctx context.Context, 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) +// 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 } -// 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") +// 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(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") + err = core.ValidateStruct(removeVPNGatewayConnectionsPeerCIDROptions, "removeVPNGatewayConnectionsPeerCIDROptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNGatewayConnectionsOptions.VPNGatewayID, + "vpn_gateway_id": *removeVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID, + "id": *removeVPNGatewayConnectionsPeerCIDROptions.ID, + "cidr": *removeVPNGatewayConnectionsPeerCIDROptions.CIDR, } - 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_gateways/{vpn_gateway_id}/connections`, 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 listVPNGatewayConnectionsOptions.Headers { + for headerName, headerValue := range removeVPNGatewayConnectionsPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsPeerCIDR") 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 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 { @@ -24896,71 +25031,62 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, list 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_gateway_connections", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "remove_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListVPNGatewayConnectionsLocalCIDRs : List local CIDRs for a VPN gateway connection -// This request lists local CIDRs for a VPN gateway connection. +// 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) ListVPNGatewayConnectionsLocalCIDRs(listVPNGatewayConnectionsLocalCIDRsOptions *ListVPNGatewayConnectionsLocalCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPNGatewayConnectionsLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionsLocalCIDRsOptions) +func (vpc *VpcV1) CheckVPNGatewayConnectionsPeerCIDR(checkVPNGatewayConnectionsPeerCIDROptions *CheckVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.CheckVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionsPeerCIDROptions) 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") +// 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(listVPNGatewayConnectionsLocalCIDRsOptions, "listVPNGatewayConnectionsLocalCIDRsOptions") + err = core.ValidateStruct(checkVPNGatewayConnectionsPeerCIDROptions, "checkVPNGatewayConnectionsPeerCIDROptions") 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, + "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, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local/cidrs`, 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 listVPNGatewayConnectionsLocalCIDRsOptions.Headers { + for headerName, headerValue := range checkVPNGatewayConnectionsPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsLocalCIDRs") + 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)) @@ -24971,71 +25097,63 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsLocalCIDRsWithContext(ctx context.Con 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_gateway_connections_local_cidrs", 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, UnmarshalVPNGatewayConnectionCIDRs) - 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. +// 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) ListVPNGatewayConnectionsPeerCIDRs(listVPNGatewayConnectionsPeerCIDRsOptions *ListVPNGatewayConnectionsPeerCIDRsOptions) (result *VPNGatewayConnectionCIDRs, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPNGatewayConnectionsPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionsPeerCIDRsOptions) +func (vpc *VpcV1) AddVPNGatewayConnectionsPeerCIDR(addVPNGatewayConnectionsPeerCIDROptions *AddVPNGatewayConnectionsPeerCIDROptions) (response *core.DetailedResponse, err error) { + response, err = vpc.AddVPNGatewayConnectionsPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionsPeerCIDROptions) 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") +// 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(listVPNGatewayConnectionsPeerCIDRsOptions, "listVPNGatewayConnectionsPeerCIDRsOptions") + err = core.ValidateStruct(addVPNGatewayConnectionsPeerCIDROptions, "addVPNGatewayConnectionsPeerCIDROptions") 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, + "vpn_gateway_id": *addVPNGatewayConnectionsPeerCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionsPeerCIDROptions.ID, + "cidr": *addVPNGatewayConnectionsPeerCIDROptions.CIDR, } - 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}/peer/cidrs`, 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 listVPNGatewayConnectionsPeerCIDRsOptions.Headers { + for headerName, headerValue := range addVPNGatewayConnectionsPeerCIDROptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionsPeerCIDRs") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionsPeerCIDR") 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)) @@ -25046,36 +25164,27 @@ func (vpc *VpcV1) ListVPNGatewayConnectionsPeerCIDRsWithContext(ctx context.Cont 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_gateway_connections_peer_cidrs", 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, UnmarshalVPNGatewayConnectionCIDRs) - 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) +// 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 } -// 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") +// 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 @@ -25084,17 +25193,17 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway 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, `/vpn_servers`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPNGatewaysOptions.Headers { + for headerName, headerValue := range listVPNServersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -25102,20 +25211,20 @@ 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 listVPNServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name)) } - if listVPNGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listVPNGatewaysOptions.Limit)) + if listVPNServersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServersOptions.Start)) } - if listVPNGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNGatewaysOptions.ResourceGroupID)) + if listVPNServersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServersOptions.Limit)) } - if listVPNGatewaysOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNGatewaysOptions.Sort)) + if listVPNServersOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNServersOptions.ResourceGroupID)) } - if listVPNGatewaysOptions.Mode != nil { - builder.AddQuery("mode", fmt.Sprint(*listVPNGatewaysOptions.Mode)) + if listVPNServersOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNServersOptions.Sort)) } request, err := builder.Build() @@ -25127,12 +25236,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_vpn_servers", 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, UnmarshalVPNServerCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25143,324 +25252,88 @@ func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGateway return } -// ListVPNRouteReport : List route reports of a VPN gateway -// This request lists route reports of a VPN gateway. -func (vpc *VpcV1) ListVPNRouteReport(listVPNRouteReportOptions *ListVPNRouteReportOptions) (result *VPNRouteReportCollection, response *core.DetailedResponse, err error) { - result, response, err = vpc.ListVPNRouteReportWithContext(context.Background(), listVPNRouteReportOptions) +// 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 } -// ListVPNRouteReportWithContext is an alternate form of the ListVPNRouteReport method which supports a Context parameter -func (vpc *VpcV1) ListVPNRouteReportWithContext(ctx context.Context, listVPNRouteReportOptions *ListVPNRouteReportOptions) (result *VPNRouteReportCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listVPNRouteReportOptions, "listVPNRouteReportOptions 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(listVPNRouteReportOptions, "listVPNRouteReportOptions") + err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "vpn_gateway_id": *listVPNRouteReportOptions.VPNGatewayID, - } - - 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}/route_reports`, 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 listVPNRouteReportOptions.Headers { + for headerName, headerValue := range createVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNRouteReport") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") 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)) - 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_vpn_route_report", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNRouteReportCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// RemoveVPNGatewayAdvertisedCIDR : Remove an advertised CIDR from a VPN gateway -// This request removes a CIDR from a VPN gateway advertised CIDRs. -// -// This request is only supported for route mode VPN gateways. -func (vpc *VpcV1) RemoveVPNGatewayAdvertisedCIDR(removeVPNGatewayAdvertisedCIDROptions *RemoveVPNGatewayAdvertisedCIDROptions) (response *core.DetailedResponse, err error) { - response, err = vpc.RemoveVPNGatewayAdvertisedCIDRWithContext(context.Background(), removeVPNGatewayAdvertisedCIDROptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// RemoveVPNGatewayAdvertisedCIDRWithContext is an alternate form of the RemoveVPNGatewayAdvertisedCIDR method which supports a Context parameter -func (vpc *VpcV1) RemoveVPNGatewayAdvertisedCIDRWithContext(ctx context.Context, removeVPNGatewayAdvertisedCIDROptions *RemoveVPNGatewayAdvertisedCIDROptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeVPNGatewayAdvertisedCIDROptions, "removeVPNGatewayAdvertisedCIDROptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(removeVPNGatewayAdvertisedCIDROptions, "removeVPNGatewayAdvertisedCIDROptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "vpn_gateway_id": *removeVPNGatewayAdvertisedCIDROptions.VPNGatewayID, - "cidr": *removeVPNGatewayAdvertisedCIDROptions.CIDR, - } - - 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}/advertised_cidrs/{cidr}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range removeVPNGatewayAdvertisedCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayAdvertisedCIDR") - 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, "remove_vpn_gateway_advertised_cidr", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - 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 - } - - 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, `/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 removeVPNGatewayConnectionsLocalCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsLocalCIDR") - 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, "remove_vpn_gateway_connections_local_cidr", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - 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, + body := make(map[string]interface{}) + if createVPNServerOptions.Certificate != nil { + body["certificate"] = createVPNServerOptions.Certificate } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return + if createVPNServerOptions.ClientAuthentication != nil { + body["client_authentication"] = createVPNServerOptions.ClientAuthentication } - - for headerName, headerValue := range removeVPNGatewayConnectionsPeerCIDROptions.Headers { - builder.AddHeader(headerName, headerValue) + if createVPNServerOptions.ClientIPPool != nil { + body["client_ip_pool"] = createVPNServerOptions.ClientIPPool } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionsPeerCIDR") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) + if createVPNServerOptions.Subnets != nil { + body["subnets"] = createVPNServerOptions.Subnets } - - 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 + if createVPNServerOptions.ClientDnsServerIps != nil { + body["client_dns_server_ips"] = createVPNServerOptions.ClientDnsServerIps } - - response, err = vpc.Service.Request(request, nil) - if err != nil { - core.EnrichHTTPProblem(err, "remove_vpn_gateway_connections_peer_cidr", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return + if createVPNServerOptions.ClientIdleTimeout != nil { + body["client_idle_timeout"] = createVPNServerOptions.ClientIdleTimeout } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return + if createVPNServerOptions.EnableSplitTunneling != nil { + body["enable_split_tunneling"] = createVPNServerOptions.EnableSplitTunneling } - err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return + if createVPNServerOptions.Name != nil { + body["name"] = createVPNServerOptions.Name } - - pathParamsMap := map[string]string{ - "id": *updateIkePolicyOptions.ID, + if createVPNServerOptions.Port != nil { + body["port"] = createVPNServerOptions.Port } - - builder := core.NewRequestBuilder(core.PATCH) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return + if createVPNServerOptions.Protocol != nil { + body["protocol"] = createVPNServerOptions.Protocol } - - for headerName, headerValue := range updateIkePolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) + if createVPNServerOptions.ResourceGroup != nil { + body["resource_group"] = createVPNServerOptions.ResourceGroup } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIkePolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) + if createVPNServerOptions.SecurityGroups != nil { + body["security_groups"] = createVPNServerOptions.SecurityGroups } - 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) + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -25475,12 +25348,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, "create_vpn_server", 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, UnmarshalVPNServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25491,139 +25364,118 @@ func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolic 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) +// 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 } -// 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") +// 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(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") + err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateIpsecPolicyOptions.ID, + "id": *deleteVPNServerOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + 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, `/vpn_servers/{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 deleteVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIpsecPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") + 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)) - _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) - 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_ipsec_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_vpn_server", 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 } -// 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) +// 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 } -// 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") +// 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(updateVPNGatewayOptions, "updateVPNGatewayOptions") + err = core.ValidateStruct(getVPNServerOptions, "getVPNServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVPNGatewayOptions.ID, + "id": *getVPNServerOptions.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/{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 updateVPNGatewayOptions.Headers { + for headerName, headerValue := range getVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") 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()) @@ -25633,12 +25485,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, "get_vpn_server", 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, UnmarshalVPNServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25649,59 +25501,59 @@ func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGate 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) +// 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 } -// 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") +// 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(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") + err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") 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, + "id": *updateVPNServerOptions.ID, } 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}`, 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 updateVPNGatewayConnectionOptions.Headers { + for headerName, headerValue := range updateVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGatewayConnection") + 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 updateVPNGatewayConnectionOptions.IfMatch != nil { - builder.AddHeader("If-Match", fmt.Sprint(*updateVPNGatewayConnectionOptions.IfMatch)) + 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(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) + _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -25716,12 +25568,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, "update_vpn_server", 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, UnmarshalVPNServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25732,182 +25584,125 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd 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) +// 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 } -// 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") +// 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(createVPNServerOptions, "createVPNServerOptions") + err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *getVPNServerClientConfigurationOptions.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, `/vpn_servers/{id}/client_configuration`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createVPNServerOptions.Headers { + for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") + builder.AddHeader("Accept", "text/plain") 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) - 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, &result) if err != nil { - core.EnrichHTTPProblem(err, "create_vpn_server", 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, UnmarshalVPNServer) - 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) +// 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 } -// 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") +// 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(createVPNServerRouteOptions, "createVPNServerRouteOptions") + err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_server_id": *createVPNServerRouteOptions.VPNServerID, + "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, `/vpn_servers/{vpn_server_id}/routes`, 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 createVPNServerRouteOptions.Headers { + for headerName, headerValue := range listVPNServerClientsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") + 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 createVPNServerRouteOptions.Destination != nil { - body["destination"] = createVPNServerRouteOptions.Destination - } - if createVPNServerRouteOptions.Action != nil { - body["action"] = createVPNServerRouteOptions.Action + if listVPNServerClientsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServerClientsOptions.Start)) } - if createVPNServerRouteOptions.Name != nil { - body["name"] = createVPNServerRouteOptions.Name + 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() @@ -25919,12 +25714,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, "list_vpn_server_clients", 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, UnmarshalVPNServerClientCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -25935,71 +25730,6 @@ func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPN 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "id": *deleteVPNServerOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, 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 deleteVPNServerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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)) - - 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", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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 @@ -26065,49 +25795,50 @@ func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVP 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) +// 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 } -// 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") +// 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(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") + err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") 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_server_id": *getVPNServerClientOptions.VPNServerID, + "id": *getVPNServerClientOptions.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/{vpn_server_id}/routes/{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 deleteVPNServerRouteOptions.Headers { + for headerName, headerValue := range getVPNServerClientOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") 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)) @@ -26118,12 +25849,21 @@ func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPN 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_route", 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, UnmarshalVPNServerClient) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } @@ -26193,45 +25933,47 @@ func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnect 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) +// 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 } -// 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") +// 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(getVPNServerOptions, "getVPNServerOptions") + err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPNServerOptions.ID, + "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, `/vpn_servers/{id}`, 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 getVPNServerOptions.Headers { + for headerName, headerValue := range listVPNServerRoutesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -26239,6 +25981,15 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio 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 { @@ -26249,12 +26000,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_server_routes", 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, UnmarshalVPNServerRouteCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26265,54 +26016,72 @@ func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptio 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) +// 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 } -// 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") +// 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(getVPNServerClientOptions, "getVPNServerClientOptions") + err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") 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_server_id": *createVPNServerRouteOptions.VPNServerID, } - 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_servers/{vpn_server_id}/clients/{id}`, 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 getVPNServerClientOptions.Headers { + for headerName, headerValue := range createVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") 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()) @@ -26322,12 +26091,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, "create_vpn_server_route", 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, UnmarshalVPNServerRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26338,50 +26107,49 @@ func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServe 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) +// 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 } -// 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") +// 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(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") + err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getVPNServerClientConfigurationOptions.ID, + "vpn_server_id": *deleteVPNServerRouteOptions.VPNServerID, + "id": *deleteVPNServerRouteOptions.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_servers/{vpn_server_id}/routes/{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 deleteVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") 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)) @@ -26392,9 +26160,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_server_route", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -26475,146 +26243,62 @@ func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServer 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) +// 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 } -// 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") +// 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(listVPNServerClientsOptions, "listVPNServerClientsOptions") + err = core.ValidateStruct(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "vpn_server_id": *listVPNServerClientsOptions.VPNServerID, + "vpn_server_id": *updateVPNServerRouteOptions.VPNServerID, + "id": *updateVPNServerRouteOptions.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, `/vpn_servers/{vpn_server_id}/clients`, 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 listVPNServerClientsOptions.Headers { + for headerName, headerValue := range updateVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") 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 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 { - 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_vpn_server_clients", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) + _, err = builder.SetBodyContentJSON(updateVPNServerRouteOptions.VPNServerRoutePatch) 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 listVPNServerRoutesOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") - 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 { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -26624,12 +26308,12 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_vpn_server_routes", 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, UnmarshalVPNServerRouteCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26640,17 +26324,18 @@ func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNSer 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) +// 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 } -// 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") +// 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 @@ -26659,17 +26344,17 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO 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, `/load_balancer/profiles`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listVPNServersOptions.Headers { + for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -26677,20 +26362,11 @@ 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 listLoadBalancerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) } - if listVPNServersOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listVPNServersOptions.Sort)) + if listLoadBalancerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerProfilesOptions.Limit)) } request, err := builder.Build() @@ -26702,12 +26378,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, "list_load_balancer_profiles", 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, UnmarshalLoadBalancerProfileCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26718,64 +26394,53 @@ func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersO 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) +// 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 } -// 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") +// 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(updateVPNServerOptions, "updateVPNServerOptions") + err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateVPNServerOptions.ID, + "name": *getLoadBalancerProfileOptions.Name, } - 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/{id}`, 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 updateVPNServerOptions.Headers { + for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") 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(updateVPNServerOptions.VPNServerPatch) - 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()) @@ -26785,12 +26450,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, "get_load_balancer_profile", 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, UnmarshalLoadBalancerProfile) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26801,60 +26466,48 @@ func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServe 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) +// 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 } -// 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(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") +// 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, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "vpn_server_id": *updateVPNServerRouteOptions.VPNServerID, - "id": *updateVPNServerRouteOptions.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, `/load_balancers`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateVPNServerRouteOptions.Headers { + for headerName, headerValue := range listLoadBalancersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") 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 + 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() @@ -26866,12 +26519,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_load_balancers", 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, UnmarshalLoadBalancerCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -26991,286 +26644,119 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB 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) +// 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 } -// 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") +// 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(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") + 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": *createLoadBalancerListenerOptions.LoadBalancerID, + "id": *deleteLoadBalancerOptions.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, `/load_balancers/{load_balancer_id}/listeners`, 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 createLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") 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 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 { - 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", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - 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, `/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 createLoadBalancerListenerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) + if deleteLoadBalancerOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteLoadBalancerOptions.IfMatch)) } - 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 createLoadBalancerListenerPolicyOptions.Target != nil { - body["target"] = createLoadBalancerListenerPolicyOptions.Target - } - _, 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) + response, err = vpc.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "create_load_balancer_listener_policy", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_load_balancer", 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 } -// 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) +// 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 } -// 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") +// 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(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") + 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": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *getLoadBalancerOptions.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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, 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 createLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range getLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") 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()) @@ -27280,12 +26766,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, "get_load_balancer", 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, UnmarshalLoadBalancer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27296,77 +26782,60 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co 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) +// 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 } -// 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") +// 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(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") + 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": *createLoadBalancerPoolOptions.LoadBalancerID, + "id": *updateLoadBalancerOptions.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, `/load_balancers/{load_balancer_id}/pools`, 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 createLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range updateLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") + 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/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)) - body := make(map[string]interface{}) - if createLoadBalancerPoolOptions.Algorithm != nil { - body["algorithm"] = createLoadBalancerPoolOptions.Algorithm - } - if createLoadBalancerPoolOptions.HealthMonitor != nil { - body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor - } - if createLoadBalancerPoolOptions.Protocol != nil { - body["protocol"] = createLoadBalancerPoolOptions.Protocol - } - if createLoadBalancerPoolOptions.Members != nil { - body["members"] = createLoadBalancerPoolOptions.Members - } - 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) + _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -27381,12 +26850,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, "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 @@ -27397,71 +26866,53 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL 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) +// 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 } -// 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") +// 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(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") + 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": *createLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, + "id": *getLoadBalancerStatisticsOptions.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, `/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 createLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") 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()) @@ -27471,12 +26922,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, "get_load_balancer_statistics", 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, UnmarshalLoadBalancerStatistics) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27487,245 +26938,49 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "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/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteLoadBalancerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - 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)) - - 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_load_balancer", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - 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": *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}/listeners/{id}`, pathParamsMap) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") - 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_load_balancer_listener", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) - 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") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") - 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, - } - - 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) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") - 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_load_balancer_listener_policy", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - - 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) +// 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 } -// 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") +// 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(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") + 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": *deleteLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *deleteLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *deleteLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *deleteLoadBalancerListenerPolicyRuleOptions.ID, + "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, } - 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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, 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 deleteLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") 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)) @@ -27736,121 +26991,179 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.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_load_balancer_listener_policy_rule", 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, UnmarshalLoadBalancerListenerCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) +// 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 } -// 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") +// 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(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") + 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": *deleteLoadBalancerPoolOptions.LoadBalancerID, - "id": *deleteLoadBalancerPoolOptions.ID, + "load_balancer_id": *createLoadBalancerListenerOptions.LoadBalancerID, } - 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, `/load_balancers/{load_balancer_id}/pools/{id}`, 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 deleteLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") 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 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 { + 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_load_balancer_pool", 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, UnmarshalLoadBalancerListener) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } 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) } @@ -27866,7 +27179,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 } @@ -27874,45 +27187,46 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, d 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) +// 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 } -// 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") +// 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(getLoadBalancerOptions, "getLoadBalancerOptions") + err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getLoadBalancerOptions.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/{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 getLoadBalancerOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -27930,12 +27244,12 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_load_balancer", 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, UnmarshalLoadBalancer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -27946,33 +27260,33 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance 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) +// 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 } -// 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") +// 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(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") + 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": *getLoadBalancerListenerOptions.LoadBalancerID, - "id": *getLoadBalancerListenerOptions.ID, + "load_balancer_id": *updateLoadBalancerListenerOptions.LoadBalancerID, + "id": *updateLoadBalancerListenerOptions.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, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) @@ -27981,19 +27295,26 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa return } - for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") 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(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) + 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()) @@ -28003,7 +27324,7 @@ 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, "update_load_balancer_listener", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -28019,47 +27340,47 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa 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) +// 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 } -// 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") +// 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(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") + 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": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, - "id": *getLoadBalancerListenerPolicyOptions.ID, + "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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + _, 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 getLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28077,12 +27398,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, "list_load_balancer_listener_policies", 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, UnmarshalLoadBalancerListenerPolicyCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28093,56 +27414,79 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, 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) +// 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 } -// 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") +// 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(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") + 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": *getLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *getLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *getLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *getLoadBalancerListenerPolicyRuleOptions.ID, + "load_balancer_id": *createLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyOptions.ListenerID, } - 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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + _, 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 getLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") 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 createLoadBalancerListenerPolicyOptions.Target != nil { + body["target"] = createLoadBalancerListenerPolicyOptions.Target + } + _, 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()) @@ -28152,12 +27496,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, "create_load_balancer_listener_policy", 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, UnmarshalLoadBalancerListenerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28168,50 +27512,50 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte 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) +// 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 } -// 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") +// 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(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") 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, + "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, `/load_balancers/{load_balancer_id}/pools/{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 getLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") + 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)) @@ -28222,66 +27566,57 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal 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_pool", 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, UnmarshalLoadBalancerPool) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } 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) +// 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 } -// 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") +// 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(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") 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": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, + "id": *getLoadBalancerListenerPolicyOptions.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/{listener_id}/policies/{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 getLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28299,12 +27634,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_policy", 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, UnmarshalLoadBalancerListenerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28315,53 +27650,63 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL 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) +// 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 } -// 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") +// 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(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") + err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "name": *getLoadBalancerProfileOptions.Name, + "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, `/load_balancer/profiles/{name}`, 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 getLoadBalancerProfileOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") + 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()) @@ -28371,12 +27716,12 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_load_balancer_profile", 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, UnmarshalLoadBalancerProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28387,45 +27732,47 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad 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) +// 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 } -// 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") +// 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(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") + err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getLoadBalancerStatisticsOptions.ID, + "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, + "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, } 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, `/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 getLoadBalancerStatisticsOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28443,12 +27790,12 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(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_statistics", 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, UnmarshalLoadBalancerStatistics) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28459,55 +27806,75 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL 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) +// 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 } -// 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") +// 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(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") + err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") 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, + "load_balancer_id": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, } - 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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, 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 listLoadBalancerListenerPoliciesOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") + 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()) @@ -28517,12 +27884,12 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_load_balancer_listener_policies", getServiceComponentInfo()) + 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, UnmarshalLoadBalancerListenerPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28533,51 +27900,51 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex 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) +// 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 } -// 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") +// 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(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") + 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": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, - "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, - "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, + "load_balancer_id": *deleteLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *deleteLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *deleteLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *deleteLoadBalancerListenerPolicyRuleOptions.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, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, 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 listLoadBalancerListenerPolicyRulesOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") 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)) @@ -28588,64 +27955,58 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con 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_listener_policy_rules", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_load_balancer_listener_policy_rule", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) - 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) +// 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 } -// 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") +// 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(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") + err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, + "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, `/load_balancers/{load_balancer_id}/listeners`, 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 listLoadBalancerListenersOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -28663,12 +28024,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, "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, UnmarshalLoadBalancerListenerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28679,54 +28040,63 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list 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) +// 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 } -// 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") +// 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(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") + err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") 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, + "load_balancer_id": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *updateLoadBalancerListenerPolicyRuleOptions.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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, 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 listLoadBalancerPoolMembersOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") 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(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) + 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()) @@ -28736,12 +28106,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, "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, UnmarshalLoadBalancerPoolMemberCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28824,49 +28194,80 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad 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) +// 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 } -// 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") +// 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(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + 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, `/load_balancer/profiles`, 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 listLoadBalancerProfilesOptions.Headers { + for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") 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)) - if listLoadBalancerProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) + + body := make(map[string]interface{}) + if createLoadBalancerPoolOptions.Algorithm != nil { + body["algorithm"] = createLoadBalancerPoolOptions.Algorithm } - if listLoadBalancerProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerProfilesOptions.Limit)) + if createLoadBalancerPoolOptions.HealthMonitor != nil { + body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor + } + if createLoadBalancerPoolOptions.Protocol != nil { + body["protocol"] = createLoadBalancerPoolOptions.Protocol + } + if createLoadBalancerPoolOptions.Members != nil { + body["members"] = createLoadBalancerPoolOptions.Members + } + 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 { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -28878,12 +28279,12 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_load_balancer_profiles", 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, UnmarshalLoadBalancerProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -28894,49 +28295,53 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL 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) +// 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 } -// 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") +// 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(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "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, `/load_balancers`, nil) + _, 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 listLoadBalancersOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") 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 { @@ -28944,85 +28349,64 @@ 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, "delete_load_balancer_pool", 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 } -// 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) +// 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 } -// 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") +// 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(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") + err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") 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": *getLoadBalancerPoolOptions.LoadBalancerID, + "id": *getLoadBalancerPoolOptions.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, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, 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 replaceLoadBalancerPoolMembersOptions.Headers { + for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") 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 { - 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()) @@ -29032,12 +28416,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, "get_load_balancer_pool", 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, UnmarshalLoadBalancerPool) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29048,60 +28432,56 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, 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) +// 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 } -// 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") +// 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(updateLoadBalancerOptions, "updateLoadBalancerOptions") + err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *updateLoadBalancerOptions.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, `/load_balancers/{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 updateLoadBalancerOptions.Headers { + for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") 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) + _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -29116,12 +28496,12 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_load_balancer", 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, UnmarshalLoadBalancer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29132,61 +28512,54 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB 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) +// 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 } -// 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") +// 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(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") + 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": *updateLoadBalancerListenerOptions.LoadBalancerID, - "id": *updateLoadBalancerListenerOptions.ID, + "load_balancer_id": *listLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *listLoadBalancerPoolMembersOptions.PoolID, } - 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, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + _, 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 updateLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") 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(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) - 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()) @@ -29196,12 +28569,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, "list_load_balancer_pool_members", 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, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29212,58 +28585,66 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd 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) +// 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 } -// 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") +// 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(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") + 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": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, - "id": *updateLoadBalancerListenerPolicyOptions.ID, + "load_balancer_id": *createLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, } - 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, `/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 updateLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") 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(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) + 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 @@ -29278,12 +28659,12 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_load_balancer_listener_policy", getServiceComponentInfo()) + 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, UnmarshalLoadBalancerListenerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29294,58 +28675,61 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Contex 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) +// 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 } -// 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") +// 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(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") + 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": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *updateLoadBalancerListenerPolicyRuleOptions.ID, + "load_balancer_id": *replaceLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *replaceLoadBalancerPoolMembersOptions.PoolID, } - 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/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + _, 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 updateLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") + 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/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(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) + body := make(map[string]interface{}) + if replaceLoadBalancerPoolMembersOptions.Members != nil { + body["members"] = replaceLoadBalancerPoolMembersOptions.Members + } + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -29360,12 +28744,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, "replace_load_balancer_pool_members", 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, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29376,61 +28760,119 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co 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) +// 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 } -// 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") +// 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(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") + err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") 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, + "load_balancer_id": *deleteLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *deleteLoadBalancerPoolMemberOptions.PoolID, + "id": *deleteLoadBalancerPoolMemberOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + 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/{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 updateLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") 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(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) + request, err := builder.Build() if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + response, err = vpc.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_load_balancer_pool_member", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + 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) + 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") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") + 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, + } + + 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) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") + 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()) @@ -29440,12 +28882,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, "get_load_balancer_pool_member", 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, UnmarshalLoadBalancerPoolMember) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29537,49 +28979,37 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u 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) +// 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 } -// 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(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") +// 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{ - "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, - "id": *addEndpointGatewayIPOptions.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, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, 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 addEndpointGatewayIPOptions.Headers { + for headerName, headerValue := range listEndpointGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -29587,6 +29017,30 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi 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.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 { @@ -29597,12 +29051,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_endpoint_gateways", 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, UnmarshalEndpointGatewayCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -29711,54 +29165,61 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn 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) +// 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 } -// 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") +// 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(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") + err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *deleteEndpointGatewayOptions.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, `/endpoint_gateways/{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 deleteEndpointGatewayOptions.Headers { + for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") + 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 { @@ -29766,59 +29227,69 @@ func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEn 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_endpoint_gateway", 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 } -// 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) +// 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 } -// 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") +// 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(getEndpointGatewayOptions, "getEndpointGatewayOptions") + err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "id": *getEndpointGatewayOptions.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, `/endpoint_gateways/{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 getEndpointGatewayOptions.Headers { + for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") + 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)) @@ -29829,21 +29300,12 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint 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_endpoint_gateway", 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, UnmarshalEndpointGateway) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } @@ -29921,45 +29383,49 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi 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) +// 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) 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") +// 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(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") + err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, + "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, `/endpoint_gateways/{endpoint_gateway_id}/ips`, 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 listEndpointGatewayIpsOptions.Headers { + for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -29967,15 +29433,6 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd 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 { @@ -29986,12 +29443,12 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd var rawResponse map[string]json.RawMessage response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_endpoint_gateway_ips", 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, UnmarshalReservedIPCollectionEndpointGatewayContext) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -30002,68 +29459,54 @@ func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEnd 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) +// 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 } -// 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") +// 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(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "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`, nil) + _, 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 listEndpointGatewaysOptions.Headers { + for headerName, headerValue := range deleteEndpointGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") 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 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.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 { @@ -30071,69 +29514,59 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo 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_gateways", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_endpoint_gateway", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) - 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) +// 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 } -// 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") +// 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(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") + err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") 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, + "id": *getEndpointGatewayOptions.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, `/endpoint_gateways/{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 getEndpointGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") 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)) @@ -30144,12 +29577,21 @@ 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_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 } @@ -30233,6 +29675,99 @@ 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) + 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") + 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, `/flow_log_collectors`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + 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 @@ -30462,99 +29997,6 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog 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) - 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") - 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, `/flow_log_collectors`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - 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 -} - // 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 @@ -30909,44 +30351,6 @@ func (options *AddVirtualNetworkInterfaceIPOptions) SetHeaders(param map[string] return options } -// AddVPNGatewayAdvertisedCIDROptions : The AddVPNGatewayAdvertisedCIDR options. -type AddVPNGatewayAdvertisedCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_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 -} - -// NewAddVPNGatewayAdvertisedCIDROptions : Instantiate AddVPNGatewayAdvertisedCIDROptions -func (*VpcV1) NewAddVPNGatewayAdvertisedCIDROptions(vpnGatewayID string, cidr string) *AddVPNGatewayAdvertisedCIDROptions { - return &AddVPNGatewayAdvertisedCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - CIDR: core.StringPtr(cidr), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *AddVPNGatewayAdvertisedCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayAdvertisedCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetCIDR : Allow user to set CIDR -func (_options *AddVPNGatewayAdvertisedCIDROptions) SetCIDR(cidr string) *AddVPNGatewayAdvertisedCIDROptions { - _options.CIDR = core.StringPtr(cidr) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *AddVPNGatewayAdvertisedCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayAdvertisedCIDROptions { - options.Headers = param - return options -} - // AddVPNGatewayConnectionsLocalCIDROptions : The AddVPNGatewayConnectionsLocalCIDR options. type AddVPNGatewayConnectionsLocalCIDROptions struct { // The VPN gateway identifier. @@ -31889,7 +31293,7 @@ type BackupPolicyJobSource struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this volume. Href *string `json:"href,omitempty"` @@ -31930,7 +31334,7 @@ func UnmarshalBackupPolicyJobSource(m map[string]json.RawMessage, result interfa err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -32651,7 +32055,7 @@ func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result int type BackupPolicyPlanReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *BackupPolicyPlanReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this backup policy plan. Href *string `json:"href" validate:"required"` @@ -32679,7 +32083,7 @@ const ( // 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, UnmarshalBackupPolicyPlanReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -32713,25 +32117,6 @@ func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result int return } -// BackupPolicyPlanReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BackupPolicyPlanReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBackupPolicyPlanReferenceDeleted unmarshals an instance of BackupPolicyPlanReferenceDeleted from the specified map of raw messages. -func UnmarshalBackupPolicyPlanReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanReferenceDeleted) - 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 -} - // 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 { @@ -33314,7 +32699,7 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) type BareMetalServerBootTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *BareMetalServerDiskReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this bare metal server disk. Href *string `json:"href,omitempty"` @@ -33346,7 +32731,7 @@ type BareMetalServerBootTargetIntf interface { // 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, UnmarshalBareMetalServerDiskReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -33726,25 +33111,6 @@ func (bareMetalServerDiskPatch *BareMetalServerDiskPatch) AsPatch() (_patch map[ return } -// BareMetalServerDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerDiskReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerDiskReferenceDeleted unmarshals an instance of BareMetalServerDiskReferenceDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDiskReferenceDeleted) - 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 -} - // BareMetalServerFirmware : Firmware information for the bare metal server. type BareMetalServerFirmware struct { // The type of update available. @@ -34627,7 +33993,7 @@ func UnmarshalBareMetalServerNetworkAttachmentPrototypeVirtualNetworkInterface(m type BareMetalServerNetworkAttachmentReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *BareMetalServerNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this bare metal server network attachment. Href *string `json:"href" validate:"required"` @@ -34663,7 +34029,7 @@ const ( // 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, UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -34707,25 +34073,6 @@ func UnmarshalBareMetalServerNetworkAttachmentReference(m map[string]json.RawMes return } -// BareMetalServerNetworkAttachmentReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerNetworkAttachmentReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted unmarshals an instance of BareMetalServerNetworkAttachmentReferenceDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkAttachmentReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkAttachmentReferenceDeleted) - 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 -} - // BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct // Models which "extend" this model: // - BareMetalServerNetworkInterfaceByHiperSocket @@ -35342,44 +34689,6 @@ func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMess return } -// BareMetalServerNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerNetworkInterfaceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceReferenceDeleted) - 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 -} - -// BareMetalServerNetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type BareMetalServerNetworkInterfaceReferenceTargetContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of BareMetalServerNetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceReferenceTargetContextDeleted) - 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 -} - // BareMetalServerPatch : BareMetalServerPatch struct type BareMetalServerPatch struct { // The total bandwidth (in megabits per second) shared across the bare metal server's network interfaces. The specified @@ -37319,7 +36628,7 @@ type CatalogOfferingVersionPlanReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *CatalogOfferingVersionPlanReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` } // UnmarshalCatalogOfferingVersionPlanReference unmarshals an instance of CatalogOfferingVersionPlanReference from the specified map of raw messages. @@ -37330,7 +36639,7 @@ func UnmarshalCatalogOfferingVersionPlanReference(m map[string]json.RawMessage, err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalCatalogOfferingVersionPlanReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -37339,25 +36648,6 @@ func UnmarshalCatalogOfferingVersionPlanReference(m map[string]json.RawMessage, return } -// CatalogOfferingVersionPlanReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type CatalogOfferingVersionPlanReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalCatalogOfferingVersionPlanReferenceDeleted unmarshals an instance of CatalogOfferingVersionPlanReferenceDeleted from the specified map of raw messages. -func UnmarshalCatalogOfferingVersionPlanReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogOfferingVersionPlanReferenceDeleted) - 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 -} - // CatalogOfferingVersionReference : CatalogOfferingVersionReference struct type CatalogOfferingVersionReference struct { // The CRN for this version of a @@ -37423,44 +36713,6 @@ func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result return } -// CheckVPNGatewayAdvertisedCIDROptions : The CheckVPNGatewayAdvertisedCIDR options. -type CheckVPNGatewayAdvertisedCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_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 -} - -// NewCheckVPNGatewayAdvertisedCIDROptions : Instantiate CheckVPNGatewayAdvertisedCIDROptions -func (*VpcV1) NewCheckVPNGatewayAdvertisedCIDROptions(vpnGatewayID string, cidr string) *CheckVPNGatewayAdvertisedCIDROptions { - return &CheckVPNGatewayAdvertisedCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - CIDR: core.StringPtr(cidr), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *CheckVPNGatewayAdvertisedCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayAdvertisedCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetCIDR : Allow user to set CIDR -func (_options *CheckVPNGatewayAdvertisedCIDROptions) SetCIDR(cidr string) *CheckVPNGatewayAdvertisedCIDROptions { - _options.CIDR = core.StringPtr(cidr) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CheckVPNGatewayAdvertisedCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayAdvertisedCIDROptions { - options.Headers = param - return options -} - // CheckVPNGatewayConnectionsLocalCIDROptions : The CheckVPNGatewayConnectionsLocalCIDR options. type CheckVPNGatewayConnectionsLocalCIDROptions struct { // The VPN gateway identifier. @@ -41170,7 +40422,7 @@ type CreateVPCRouteOptions struct { // // At most two routes per `zone` in a table can have the same `destination` and `priority`, // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. - NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + NextHop RouteNextHopPrototypeIntf `json:"next_hop,omitempty"` // The priority of this route. Smaller values have higher priority. // @@ -41242,7 +40494,7 @@ func (_options *CreateVPCRouteOptions) SetName(name string) *CreateVPCRouteOptio } // SetNextHop : Allow user to set NextHop -func (_options *CreateVPCRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopIntf) *CreateVPCRouteOptions { +func (_options *CreateVPCRouteOptions) SetNextHop(nextHop RouteNextHopPrototypeIntf) *CreateVPCRouteOptions { _options.NextHop = nextHop return _options } @@ -41452,7 +40704,7 @@ type CreateVPCRoutingTableRouteOptions struct { // // At most two routes per `zone` in a table can have the same `destination` and `priority`, // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. - NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + NextHop RouteNextHopPrototypeIntf `json:"next_hop,omitempty"` // The priority of this route. Smaller values have higher priority. // @@ -41531,7 +40783,7 @@ func (_options *CreateVPCRoutingTableRouteOptions) SetName(name string) *CreateV } // SetNextHop : Allow user to set NextHop -func (_options *CreateVPCRoutingTableRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopIntf) *CreateVPCRoutingTableRouteOptions { +func (_options *CreateVPCRoutingTableRouteOptions) SetNextHop(nextHop RouteNextHopPrototypeIntf) *CreateVPCRoutingTableRouteOptions { _options.NextHop = nextHop return _options } @@ -41614,34 +40866,6 @@ func (options *CreateVPNGatewayOptions) SetHeaders(param map[string]string) *Cre return options } -// CreateVPNRouteReportOptions : The CreateVPNRouteReport options. -type CreateVPNRouteReportOptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewCreateVPNRouteReportOptions : Instantiate CreateVPNRouteReportOptions -func (*VpcV1) NewCreateVPNRouteReportOptions(vpnGatewayID string) *CreateVPNRouteReportOptions { - return &CreateVPNRouteReportOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *CreateVPNRouteReportOptions) SetVPNGatewayID(vpnGatewayID string) *CreateVPNRouteReportOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateVPNRouteReportOptions) SetHeaders(param map[string]string) *CreateVPNRouteReportOptions { - options.Headers = param - return options -} - // CreateVPNServerOptions : The CreateVPNServer options. type CreateVPNServerOptions struct { // The certificate instance for this VPN server. @@ -42885,7 +42109,7 @@ type DedicatedHostGroupReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this dedicated host group. Href *string `json:"href" validate:"required"` @@ -42914,7 +42138,7 @@ func UnmarshalDedicatedHostGroupReference(m map[string]json.RawMessage, result i err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -42943,25 +42167,6 @@ func UnmarshalDedicatedHostGroupReference(m map[string]json.RawMessage, result i return } -// DedicatedHostGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type DedicatedHostGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalDedicatedHostGroupReferenceDeleted unmarshals an instance of DedicatedHostGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalDedicatedHostGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostGroupReferenceDeleted) - 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 -} - // DedicatedHostNuma : The dedicated host NUMA configuration. type DedicatedHostNuma struct { // The total number of NUMA nodes for this dedicated host. @@ -43948,7 +43153,7 @@ type DedicatedHostReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *DedicatedHostReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this dedicated host. Href *string `json:"href" validate:"required"` @@ -43977,7 +43182,7 @@ func UnmarshalDedicatedHostReference(m map[string]json.RawMessage, result interf err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -44006,25 +43211,6 @@ func UnmarshalDedicatedHostReference(m map[string]json.RawMessage, result interf return } -// DedicatedHostReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type DedicatedHostReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalDedicatedHostReferenceDeleted unmarshals an instance of DedicatedHostReferenceDeleted from the specified map of raw messages. -func UnmarshalDedicatedHostReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DedicatedHostReferenceDeleted) - 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 -} - // DefaultNetworkACL : DefaultNetworkACL struct type DefaultNetworkACL struct { // The date and time that the network ACL was created. @@ -44308,10 +43494,10 @@ type DefaultSecurityGroup struct { // The date and time that this security group was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The security group's CRN. + // The CRN for this security group. CRN *string `json:"crn" validate:"required"` - // The security group's canonical URL. + // The URL for this security group. Href *string `json:"href" validate:"required"` // The unique identifier for this security group. @@ -46479,9 +45665,6 @@ type DeleteVPNGatewayConnectionOptions struct { // The VPN gateway connection 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 } @@ -46506,12 +45689,6 @@ func (_options *DeleteVPNGatewayConnectionOptions) SetID(id string) *DeleteVPNGa return _options } -// SetIfMatch : Allow user to set IfMatch -func (_options *DeleteVPNGatewayConnectionOptions) SetIfMatch(ifMatch string) *DeleteVPNGatewayConnectionOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - // SetHeaders : Allow user to set Headers func (options *DeleteVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *DeleteVPNGatewayConnectionOptions { options.Headers = param @@ -46546,44 +45723,6 @@ func (options *DeleteVPNGatewayOptions) SetHeaders(param map[string]string) *Del return options } -// DeleteVPNRouteReportOptions : The DeleteVPNRouteReport options. -type DeleteVPNRouteReportOptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN route report identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVPNRouteReportOptions : Instantiate DeleteVPNRouteReportOptions -func (*VpcV1) NewDeleteVPNRouteReportOptions(vpnGatewayID string, id string) *DeleteVPNRouteReportOptions { - return &DeleteVPNRouteReportOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *DeleteVPNRouteReportOptions) SetVPNGatewayID(vpnGatewayID string) *DeleteVPNRouteReportOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *DeleteVPNRouteReportOptions) SetID(id string) *DeleteVPNRouteReportOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVPNRouteReportOptions) SetHeaders(param map[string]string) *DeleteVPNRouteReportOptions { - options.Headers = param - return options -} - // DeleteVPNServerClientOptions : The DeleteVPNServerClient options. type DeleteVPNServerClientOptions struct { // The VPN server identifier. @@ -46697,6 +45836,25 @@ func (options *DeleteVPNServerRouteOptions) SetHeaders(param map[string]string) return options } +// Deleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary +// information. +type Deleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalDeleted unmarshals an instance of Deleted from the specified map of raw messages. +func UnmarshalDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Deleted) + 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 +} + // DeprecateImageOptions : The DeprecateImage options. type DeprecateImageOptions struct { // The image identifier. @@ -47201,25 +46359,6 @@ func (endpointGatewayPatch *EndpointGatewayPatch) AsPatch() (_patch map[string]i return } -// EndpointGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type EndpointGatewayReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalEndpointGatewayReferenceDeleted unmarshals an instance of EndpointGatewayReferenceDeleted from the specified map of raw messages. -func UnmarshalEndpointGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayReferenceDeleted) - 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 -} - // EndpointGatewayReferenceRemote : EndpointGatewayReferenceRemote struct type EndpointGatewayReferenceRemote struct { // The CRN for this endpoint gateway. @@ -47993,7 +47132,7 @@ type FloatingIPReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this floating IP. Href *string `json:"href" validate:"required"` @@ -48018,7 +47157,7 @@ func UnmarshalFloatingIPReference(m map[string]json.RawMessage, result interface err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -48042,25 +47181,6 @@ func UnmarshalFloatingIPReference(m map[string]json.RawMessage, result interface return } -// FloatingIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type FloatingIPReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalFloatingIPReferenceDeleted unmarshals an instance of FloatingIPReferenceDeleted from the specified map of raw messages. -func UnmarshalFloatingIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FloatingIPReferenceDeleted) - 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 -} - // FloatingIPTarget : The target of this floating IP. // Models which "extend" this model: // - FloatingIPTargetNetworkInterfaceReference @@ -48070,7 +47190,7 @@ func UnmarshalFloatingIPReferenceDeleted(m map[string]json.RawMessage, result in type FloatingIPTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance network interface. // @@ -48119,7 +47239,7 @@ type FloatingIPTargetIntf interface { // UnmarshalFloatingIPTarget unmarshals an instance of FloatingIPTarget from the specified map of raw messages. func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(FloatingIPTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -48617,7 +47737,7 @@ func (flowLogCollectorPatch *FlowLogCollectorPatch) AsPatch() (_patch map[string type FlowLogCollectorTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance network interface. // @@ -48671,7 +47791,7 @@ type FlowLogCollectorTargetIntf interface { // UnmarshalFlowLogCollectorTarget unmarshals an instance of FlowLogCollectorTarget from the specified map of raw messages. func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(FlowLogCollectorTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -48785,25 +47905,6 @@ func UnmarshalFlowLogCollectorTargetPrototype(m map[string]json.RawMessage, resu return } -// GenericResourceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type GenericResourceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalGenericResourceReferenceDeleted unmarshals an instance of GenericResourceReferenceDeleted from the specified map of raw messages. -func UnmarshalGenericResourceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(GenericResourceReferenceDeleted) - 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 -} - // GetBackupPolicyJobOptions : The GetBackupPolicyJob options. type GetBackupPolicyJobOptions struct { // The backup policy identifier. @@ -51760,44 +50861,6 @@ func (options *GetVPNGatewayOptions) SetHeaders(param map[string]string) *GetVPN return options } -// GetVPNRouteReportOptions : The GetVPNRouteReport options. -type GetVPNRouteReportOptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // The VPN route report identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetVPNRouteReportOptions : Instantiate GetVPNRouteReportOptions -func (*VpcV1) NewGetVPNRouteReportOptions(vpnGatewayID string, id string) *GetVPNRouteReportOptions { - return &GetVPNRouteReportOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *GetVPNRouteReportOptions) SetVPNGatewayID(vpnGatewayID string) *GetVPNRouteReportOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetVPNRouteReportOptions) SetID(id string) *GetVPNRouteReportOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetVPNRouteReportOptions) SetHeaders(param map[string]string) *GetVPNRouteReportOptions { - options.Headers = param - return options -} - // GetVPNServerClientConfigurationOptions : The GetVPNServerClientConfiguration options. type GetVPNServerClientConfigurationOptions struct { // The VPN server identifier. @@ -51953,7 +51016,7 @@ type IkePolicy struct { // The `triple_des` algorithm has been deprecated. EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` - // The IKE policy's canonical URL. + // The URL for this IKE policy. Href *string `json:"href" validate:"required"` // The unique identifier for this IKE policy. @@ -52308,9 +51371,9 @@ func (ikePolicyPatch *IkePolicyPatch) AsPatch() (_patch map[string]interface{}, type IkePolicyReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *IkePolicyReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The IKE policy's canonical URL. + // The URL for this IKE policy. Href *string `json:"href" validate:"required"` // The unique identifier for this IKE policy. @@ -52332,7 +51395,7 @@ const ( // UnmarshalIkePolicyReference unmarshals an instance of IkePolicyReference from the specified map of raw messages. func UnmarshalIkePolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(IkePolicyReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIkePolicyReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -52422,7 +51485,7 @@ type IPsecPolicy struct { // `aes256gcm16`. EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` - // The IPsec policy's canonical URL. + // The URL for this IPsec policy. Href *string `json:"href" validate:"required"` // The unique identifier for this IPsec policy. @@ -52918,9 +51981,9 @@ func (iPsecPolicyPatch *IPsecPolicyPatch) AsPatch() (_patch map[string]interface type IPsecPolicyReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *IPsecPolicyReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The IPsec policy's canonical URL. + // The URL for this IPsec policy. Href *string `json:"href" validate:"required"` // The unique identifier for this IPsec policy. @@ -52942,7 +52005,7 @@ const ( // UnmarshalIPsecPolicyReference unmarshals an instance of IPsecPolicyReference from the specified map of raw messages. func UnmarshalIPsecPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(IPsecPolicyReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIPsecPolicyReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -52971,25 +52034,6 @@ func UnmarshalIPsecPolicyReference(m map[string]json.RawMessage, result interfac return } -// IPsecPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type IPsecPolicyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalIPsecPolicyReferenceDeleted unmarshals an instance of IPsecPolicyReferenceDeleted from the specified map of raw messages. -func UnmarshalIPsecPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IPsecPolicyReferenceDeleted) - 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 -} - // IkePolicyCollectionFirst : A link to the first page of resources. type IkePolicyCollectionFirst struct { // The URL for a page of resources. @@ -53062,25 +52106,6 @@ func UnmarshalIkePolicyConnectionCollectionNext(m map[string]json.RawMessage, re return } -// IkePolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type IkePolicyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalIkePolicyReferenceDeleted unmarshals an instance of IkePolicyReferenceDeleted from the specified map of raw messages. -func UnmarshalIkePolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IkePolicyReferenceDeleted) - 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 -} - // Image : Image struct type Image struct { CatalogOffering *ImageCatalogOffering `json:"catalog_offering" validate:"required"` @@ -53778,7 +52803,7 @@ func UnmarshalImageFile(m map[string]json.RawMessage, result interface{}) (err e // ImageFileChecksums : ImageFileChecksums struct type ImageFileChecksums struct { - // The SHA256 fingerprint of the image file. + // The SHA256 fingerprint of the image file, in hexadecimal. Sha256 *string `json:"sha256,omitempty"` } @@ -54086,7 +53111,7 @@ type ImageReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *ImageReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this image. Href *string `json:"href" validate:"required"` @@ -54119,7 +53144,7 @@ func UnmarshalImageReference(m map[string]json.RawMessage, result interface{}) ( err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalImageReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -54153,25 +53178,6 @@ func UnmarshalImageReference(m map[string]json.RawMessage, result interface{}) ( return } -// ImageReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ImageReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalImageReferenceDeleted unmarshals an instance of ImageReferenceDeleted from the specified map of raw messages. -func UnmarshalImageReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageReferenceDeleted) - 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 -} - // ImageRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not // be directly retrievable. type ImageRemote struct { @@ -54340,9 +53346,6 @@ type Instance struct { LifecycleState *string `json:"lifecycle_state" validate:"required"` // The amount of memory, truncated to whole gibibytes. - // - // The maximum limit for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Memory *int64 `json:"memory" validate:"required"` // The metadata service configuration. @@ -55322,7 +54325,7 @@ func (instanceDiskPatch *InstanceDiskPatch) AsPatch() (_patch map[string]interfa type InstanceDiskReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceDiskReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance disk. Href *string `json:"href" validate:"required"` @@ -55346,7 +54349,7 @@ const ( // UnmarshalInstanceDiskReference unmarshals an instance of InstanceDiskReference from the specified map of raw messages. func UnmarshalInstanceDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceDiskReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceDiskReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -55375,25 +54378,6 @@ func UnmarshalInstanceDiskReference(m map[string]json.RawMessage, result interfa return } -// InstanceDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceDiskReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceDiskReferenceDeleted unmarshals an instance of InstanceDiskReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceDiskReferenceDeleted) - 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 -} - // InstanceGpu : The virtual server instance GPU configuration. type InstanceGpu struct { // The number of GPUs assigned to the instance. @@ -56249,7 +55233,7 @@ func UnmarshalInstanceGroupManagerActionPrototype(m map[string]json.RawMessage, type InstanceGroupManagerActionReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceGroupManagerActionReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance group manager action. Href *string `json:"href" validate:"required"` @@ -56274,7 +55258,7 @@ const ( // UnmarshalInstanceGroupManagerActionReference unmarshals an instance of InstanceGroupManagerActionReference from the specified map of raw messages. func UnmarshalInstanceGroupManagerActionReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceGroupManagerActionReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerActionReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -56303,25 +55287,6 @@ func UnmarshalInstanceGroupManagerActionReference(m map[string]json.RawMessage, return } -// InstanceGroupManagerActionReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceGroupManagerActionReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceGroupManagerActionReferenceDeleted unmarshals an instance of InstanceGroupManagerActionReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceGroupManagerActionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerActionReferenceDeleted) - 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 -} - // InstanceGroupManagerActionsCollection : InstanceGroupManagerActionsCollection struct type InstanceGroupManagerActionsCollection struct { // Collection of instance group manager actions. @@ -56928,7 +55893,7 @@ func UnmarshalInstanceGroupManagerPolicyPrototype(m map[string]json.RawMessage, type InstanceGroupManagerPolicyReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceGroupManagerPolicyReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance group manager policy. Href *string `json:"href" validate:"required"` @@ -56944,7 +55909,7 @@ type InstanceGroupManagerPolicyReference struct { // UnmarshalInstanceGroupManagerPolicyReference unmarshals an instance of InstanceGroupManagerPolicyReference from the specified map of raw messages. func UnmarshalInstanceGroupManagerPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceGroupManagerPolicyReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerPolicyReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -56968,25 +55933,6 @@ func UnmarshalInstanceGroupManagerPolicyReference(m map[string]json.RawMessage, return } -// InstanceGroupManagerPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceGroupManagerPolicyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceGroupManagerPolicyReferenceDeleted unmarshals an instance of InstanceGroupManagerPolicyReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceGroupManagerPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerPolicyReferenceDeleted) - 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 -} - // InstanceGroupManagerPrototype : InstanceGroupManagerPrototype struct // Models which "extend" this model: // - InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype @@ -57075,7 +56021,7 @@ func UnmarshalInstanceGroupManagerPrototype(m map[string]json.RawMessage, result type InstanceGroupManagerReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance group manager. Href *string `json:"href" validate:"required"` @@ -57090,7 +56036,7 @@ type InstanceGroupManagerReference struct { // UnmarshalInstanceGroupManagerReference unmarshals an instance of InstanceGroupManagerReference from the specified map of raw messages. func UnmarshalInstanceGroupManagerReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceGroupManagerReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -57114,25 +56060,6 @@ func UnmarshalInstanceGroupManagerReference(m map[string]json.RawMessage, result return } -// InstanceGroupManagerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceGroupManagerReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceGroupManagerReferenceDeleted unmarshals an instance of InstanceGroupManagerReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceGroupManagerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupManagerReferenceDeleted) - 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 -} - // InstanceGroupManagerScheduledActionGroup : InstanceGroupManagerScheduledActionGroup struct type InstanceGroupManagerScheduledActionGroup struct { // The desired number of instance group members at the scheduled time. @@ -57187,7 +56114,7 @@ func UnmarshalInstanceGroupManagerScheduledActionGroupPrototype(m map[string]jso type InstanceGroupManagerScheduledActionManager struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance group manager. Href *string `json:"href,omitempty"` @@ -57216,7 +56143,7 @@ type InstanceGroupManagerScheduledActionManagerIntf interface { // UnmarshalInstanceGroupManagerScheduledActionManager unmarshals an instance of InstanceGroupManagerScheduledActionManager from the specified map of raw messages. func UnmarshalInstanceGroupManagerScheduledActionManager(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceGroupManagerScheduledActionManager) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -57641,7 +56568,7 @@ type InstanceGroupReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceGroupReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance group. Href *string `json:"href" validate:"required"` @@ -57661,7 +56588,7 @@ func UnmarshalInstanceGroupReference(m map[string]json.RawMessage, result interf err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -57685,25 +56612,6 @@ func UnmarshalInstanceGroupReference(m map[string]json.RawMessage, result interf return } -// InstanceGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceGroupReferenceDeleted unmarshals an instance of InstanceGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceGroupReferenceDeleted) - 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 -} - // InstanceHealthReason : InstanceHealthReason struct type InstanceHealthReason struct { // A reason code for this health state: @@ -58470,7 +57378,7 @@ func UnmarshalInstanceNetworkAttachmentPrototypeVirtualNetworkInterface(m map[st type InstanceNetworkAttachmentReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance network attachment. Href *string `json:"href" validate:"required"` @@ -58504,7 +57412,7 @@ const ( // UnmarshalInstanceNetworkAttachmentReference unmarshals an instance of InstanceNetworkAttachmentReference from the specified map of raw messages. func UnmarshalInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceNetworkAttachmentReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -58548,25 +57456,6 @@ func UnmarshalInstanceNetworkAttachmentReference(m map[string]json.RawMessage, r return } -// InstanceNetworkAttachmentReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceNetworkAttachmentReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceNetworkAttachmentReferenceDeleted unmarshals an instance of InstanceNetworkAttachmentReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceNetworkAttachmentReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceNetworkAttachmentReferenceDeleted) - 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 -} - // InstancePatch : InstancePatch struct type InstancePatch struct { // The availability policy for this virtual server instance. @@ -58753,7 +57642,7 @@ type InstancePlacementTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this dedicated host group. Href *string `json:"href,omitempty"` @@ -58790,7 +57679,7 @@ func UnmarshalInstancePlacementTarget(m map[string]json.RawMessage, result inter err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -60778,7 +59667,7 @@ type InstanceReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this virtual server instance. Href *string `json:"href" validate:"required"` @@ -60798,7 +59687,7 @@ func UnmarshalInstanceReference(m map[string]json.RawMessage, result interface{} err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -60822,25 +59711,6 @@ func UnmarshalInstanceReference(m map[string]json.RawMessage, result interface{} return } -// InstanceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceReferenceDeleted unmarshals an instance of InstanceReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceReferenceDeleted) - 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 -} - // InstanceReservationAffinity : InstanceReservationAffinity struct type InstanceReservationAffinity struct { // The reservation affinity policy to use for this virtual server instance: @@ -61749,7 +60619,7 @@ type InstanceTemplateReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceTemplateReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance template. Href *string `json:"href" validate:"required"` @@ -61769,7 +60639,7 @@ func UnmarshalInstanceTemplateReference(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceTemplateReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -61793,25 +60663,6 @@ func UnmarshalInstanceTemplateReference(m map[string]json.RawMessage, result int return } -// InstanceTemplateReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type InstanceTemplateReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalInstanceTemplateReferenceDeleted unmarshals an instance of InstanceTemplateReferenceDeleted from the specified map of raw messages. -func UnmarshalInstanceTemplateReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstanceTemplateReferenceDeleted) - 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 -} - // InstanceVcpu : The virtual server instance VCPU configuration. type InstanceVcpu struct { // The VCPU architecture. @@ -62141,7 +60992,7 @@ type KeyReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *KeyReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always // `SHA256`). @@ -62165,7 +61016,7 @@ func UnmarshalKeyReference(m map[string]json.RawMessage, result interface{}) (er err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalKeyReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -62194,25 +61045,6 @@ func UnmarshalKeyReference(m map[string]json.RawMessage, result interface{}) (er return } -// KeyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type KeyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalKeyReferenceDeleted unmarshals an instance of KeyReferenceDeleted from the specified map of raw messages. -func UnmarshalKeyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(KeyReferenceDeleted) - 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 -} - // LegacyCloudObjectStorageBucketIdentity : Identifies a Cloud Object Storage bucket by a unique property. // Models which "extend" this model: // - LegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIdentityByName @@ -66555,34 +65387,6 @@ func (options *ListVpcsOptions) SetHeaders(param map[string]string) *ListVpcsOpt return options } -// ListVPNGatewayAdvertisedCIDRsOptions : The ListVPNGatewayAdvertisedCIDRs options. -type ListVPNGatewayAdvertisedCIDRsOptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListVPNGatewayAdvertisedCIDRsOptions : Instantiate ListVPNGatewayAdvertisedCIDRsOptions -func (*VpcV1) NewListVPNGatewayAdvertisedCIDRsOptions(vpnGatewayID string) *ListVPNGatewayAdvertisedCIDRsOptions { - return &ListVPNGatewayAdvertisedCIDRsOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *ListVPNGatewayAdvertisedCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayAdvertisedCIDRsOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNGatewayAdvertisedCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayAdvertisedCIDRsOptions { - options.Headers = param - return options -} - // ListVPNGatewayConnectionsLocalCIDRsOptions : The ListVPNGatewayConnectionsLocalCIDRs options. type ListVPNGatewayConnectionsLocalCIDRsOptions struct { // The VPN gateway identifier. @@ -66801,34 +65605,6 @@ func (options *ListVPNGatewaysOptions) SetHeaders(param map[string]string) *List return options } -// ListVPNRouteReportOptions : The ListVPNRouteReport options. -type ListVPNRouteReportOptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListVPNRouteReportOptions : Instantiate ListVPNRouteReportOptions -func (*VpcV1) NewListVPNRouteReportOptions(vpnGatewayID string) *ListVPNRouteReportOptions { - return &ListVPNRouteReportOptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *ListVPNRouteReportOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNRouteReportOptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListVPNRouteReportOptions) SetHeaders(param map[string]string) *ListVPNRouteReportOptions { - options.Headers = param - return options -} - // ListVPNServerClientsOptions : The ListVPNServerClients options. type ListVPNServerClientsOptions struct { // The VPN server identifier. @@ -67038,7 +65814,7 @@ type LoadBalancer struct { // The date and time that this load balancer was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The load balancer's CRN. + // The CRN for this load balancer. CRN *string `json:"crn" validate:"required"` // The DNS configuration for this load balancer. @@ -67050,7 +65826,7 @@ type LoadBalancer struct { // Fully qualified domain name assigned to this load balancer. Hostname *string `json:"hostname" validate:"required"` - // The load balancer's canonical URL. + // The URL for this load balancer. Href *string `json:"href" validate:"required"` // The unique identifier for this load balancer. @@ -67078,7 +65854,7 @@ type LoadBalancer struct { Pools []LoadBalancerPoolReference `json:"pools" validate:"required"` // The private IP addresses assigned to this load balancer. - PrivateIps []LoadBalancerPrivateIpsItem `json:"private_ips" validate:"required"` + PrivateIps []ReservedIPReference `json:"private_ips" validate:"required"` // The profile for this load balancer. Profile *LoadBalancerProfileReference `json:"profile" validate:"required"` @@ -67239,7 +66015,7 @@ func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (er err = core.SDKErrorf(err, "", "pools-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalLoadBalancerPrivateIpsItem) + err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalReservedIPReference) if err != nil { err = core.SDKErrorf(err, "", "private_ips-error", common.GetComponentInfo()) return @@ -67519,10 +66295,10 @@ type LoadBalancerIdentity struct { // The unique identifier for this load balancer. ID *string `json:"id,omitempty"` - // The load balancer's CRN. + // The CRN for this load balancer. CRN *string `json:"crn,omitempty"` - // The load balancer's canonical URL. + // The URL for this load balancer. Href *string `json:"href,omitempty"` } @@ -67582,7 +66358,7 @@ type LoadBalancerListener struct { // If `https_redirect` is set, the default pool will not be used. DefaultPool *LoadBalancerPoolReference `json:"default_pool,omitempty"` - // The listener's canonical URL. + // The URL for this load balancer listener. Href *string `json:"href" validate:"required"` // If present, the target listener that requests are redirected to if none of the @@ -67766,7 +66542,7 @@ type LoadBalancerListenerDefaultPoolPatch struct { // The unique identifier for this load balancer pool. ID *string `json:"id,omitempty"` - // The pool's canonical URL. + // The URL for this load balancer pool. Href *string `json:"href,omitempty"` } @@ -67917,7 +66693,7 @@ type LoadBalancerListenerIdentity struct { // The unique identifier for this load balancer listener. ID *string `json:"id,omitempty"` - // The listener's canonical URL. + // The URL for this load balancer listener. Href *string `json:"href,omitempty"` } @@ -68133,10 +66909,10 @@ type LoadBalancerListenerPolicy struct { // The date and time that this policy was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The listener policy's canonical URL. + // The URL for this load balancer policy. Href *string `json:"href" validate:"required"` - // The policy's unique identifier. + // The unique identifier for this load balancer policy. ID *string `json:"id" validate:"required"` // The name for this load balancer listener policy. The name is unique across all policies for the load balancer @@ -68417,12 +67193,12 @@ func UnmarshalLoadBalancerListenerPolicyPrototype(m map[string]json.RawMessage, type LoadBalancerListenerPolicyReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *LoadBalancerListenerPolicyReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The listener policy's canonical URL. + // The URL for this load balancer policy. Href *string `json:"href" validate:"required"` - // The policy's unique identifier. + // The unique identifier for this load balancer policy. ID *string `json:"id" validate:"required"` // The name for this load balancer listener policy. The name is unique across all policies for the load balancer @@ -68433,7 +67209,7 @@ type LoadBalancerListenerPolicyReference struct { // UnmarshalLoadBalancerListenerPolicyReference unmarshals an instance of LoadBalancerListenerPolicyReference from the specified map of raw messages. func UnmarshalLoadBalancerListenerPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerListenerPolicyReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -68457,25 +67233,6 @@ func UnmarshalLoadBalancerListenerPolicyReference(m map[string]json.RawMessage, return } -// LoadBalancerListenerPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerListenerPolicyReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerListenerPolicyReferenceDeleted unmarshals an instance of LoadBalancerListenerPolicyReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyReferenceDeleted) - 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 -} - // LoadBalancerListenerPolicyRule : LoadBalancerListenerPolicyRule struct type LoadBalancerListenerPolicyRule struct { // The condition of the rule. @@ -68494,10 +67251,10 @@ type LoadBalancerListenerPolicyRule struct { // If the rule type is `body`, this is optional. Field *string `json:"field,omitempty"` - // The rule's canonical URL. + // The URL for this load balancer listener policy rule. Href *string `json:"href" validate:"required"` - // The rule's unique identifier. + // The unique identifier for this load balancer listener policy rule. ID *string `json:"id" validate:"required"` // The provisioning status of this rule @@ -68792,19 +67549,19 @@ func UnmarshalLoadBalancerListenerPolicyRulePrototype(m map[string]json.RawMessa type LoadBalancerListenerPolicyRuleReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *LoadBalancerListenerPolicyRuleReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The rule's canonical URL. + // The URL for this load balancer listener policy rule. Href *string `json:"href" validate:"required"` - // The rule's unique identifier. + // The unique identifier for this load balancer listener policy rule. ID *string `json:"id" validate:"required"` } // UnmarshalLoadBalancerListenerPolicyRuleReference unmarshals an instance of LoadBalancerListenerPolicyRuleReference from the specified map of raw messages. func UnmarshalLoadBalancerListenerPolicyRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerListenerPolicyRuleReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -68823,25 +67580,6 @@ func UnmarshalLoadBalancerListenerPolicyRuleReference(m map[string]json.RawMessa return } -// LoadBalancerListenerPolicyRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerListenerPolicyRuleReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted unmarshals an instance of LoadBalancerListenerPolicyRuleReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerPolicyRuleReferenceDeleted) - 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 -} - // LoadBalancerListenerPolicyTarget : - If `action` is `forward`, the response is a `LoadBalancerPoolReference` // - If `action` is `https_redirect`, the response is a // `LoadBalancerListenerPolicyHTTPSRedirect` @@ -68853,9 +67591,9 @@ func UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted(m map[string]json.R type LoadBalancerListenerPolicyTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The pool's canonical URL. + // The URL for this load balancer pool. Href *string `json:"href,omitempty"` // The unique identifier for this load balancer pool. @@ -68903,7 +67641,7 @@ type LoadBalancerListenerPolicyTargetIntf interface { // UnmarshalLoadBalancerListenerPolicyTarget unmarshals an instance of LoadBalancerListenerPolicyTarget from the specified map of raw messages. func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerListenerPolicyTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -68959,7 +67697,7 @@ type LoadBalancerListenerPolicyTargetPatch struct { // The unique identifier for this load balancer pool. ID *string `json:"id,omitempty"` - // The pool's canonical URL. + // The URL for this load balancer pool. Href *string `json:"href,omitempty"` // The HTTP status code for this redirect. @@ -69048,7 +67786,7 @@ type LoadBalancerListenerPolicyTargetPrototype struct { // The unique identifier for this load balancer pool. ID *string `json:"id,omitempty"` - // The pool's canonical URL. + // The URL for this load balancer pool. Href *string `json:"href,omitempty"` // The HTTP status code for this redirect. @@ -69296,9 +68034,9 @@ func UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext(m map[string]json type LoadBalancerListenerReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *LoadBalancerListenerReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The listener's canonical URL. + // The URL for this load balancer listener. Href *string `json:"href" validate:"required"` // The unique identifier for this load balancer listener. @@ -69308,7 +68046,7 @@ type LoadBalancerListenerReference struct { // UnmarshalLoadBalancerListenerReference unmarshals an instance of LoadBalancerListenerReference from the specified map of raw messages. func UnmarshalLoadBalancerListenerReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerListenerReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -69327,25 +68065,6 @@ func UnmarshalLoadBalancerListenerReference(m map[string]json.RawMessage, result return } -// LoadBalancerListenerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerListenerReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerListenerReferenceDeleted unmarshals an instance of LoadBalancerListenerReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerListenerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerListenerReferenceDeleted) - 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 -} - // LoadBalancerLogging : LoadBalancerLogging struct type LoadBalancerLogging struct { // The datapath logging configuration for this load balancer. @@ -69532,7 +68251,7 @@ type LoadBalancerPool struct { // The health monitor of this pool. HealthMonitor *LoadBalancerPoolHealthMonitor `json:"health_monitor" validate:"required"` - // The pool's canonical URL. + // The URL for this load balancer pool. Href *string `json:"href" validate:"required"` // The unique identifier for this load balancer pool. @@ -69961,7 +68680,7 @@ type LoadBalancerPoolIdentity struct { // The unique identifier for this load balancer pool. ID *string `json:"id,omitempty"` - // The pool's canonical URL. + // The URL for this load balancer pool. Href *string `json:"href,omitempty"` } @@ -70028,7 +68747,7 @@ type LoadBalancerPoolMember struct { // Health of the server member in the pool. Health *string `json:"health" validate:"required"` - // The member's canonical URL. + // The URL for this load balancer pool member. Href *string `json:"href" validate:"required"` // The unique identifier for this load balancer pool member. @@ -70265,9 +68984,9 @@ func UnmarshalLoadBalancerPoolMemberPrototype(m map[string]json.RawMessage, resu type LoadBalancerPoolMemberReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *LoadBalancerPoolMemberReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The member's canonical URL. + // The URL for this load balancer pool member. Href *string `json:"href" validate:"required"` // The unique identifier for this load balancer pool member. @@ -70277,7 +68996,7 @@ type LoadBalancerPoolMemberReference struct { // UnmarshalLoadBalancerPoolMemberReference unmarshals an instance of LoadBalancerPoolMemberReference from the specified map of raw messages. func UnmarshalLoadBalancerPoolMemberReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerPoolMemberReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolMemberReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -70296,25 +69015,6 @@ func UnmarshalLoadBalancerPoolMemberReference(m map[string]json.RawMessage, resu return } -// LoadBalancerPoolMemberReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerPoolMemberReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerPoolMemberReferenceDeleted unmarshals an instance of LoadBalancerPoolMemberReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerPoolMemberReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolMemberReferenceDeleted) - 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 -} - // LoadBalancerPoolMemberTarget : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in // the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a // zone the load balancer has a subnet in. @@ -70327,7 +69027,7 @@ type LoadBalancerPoolMemberTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this virtual server instance. Href *string `json:"href,omitempty"` @@ -70361,7 +69061,7 @@ func UnmarshalLoadBalancerPoolMemberTarget(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -70695,9 +69395,9 @@ func UnmarshalLoadBalancerPoolPrototype(m map[string]json.RawMessage, result int type LoadBalancerPoolReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The pool's canonical URL. + // The URL for this load balancer pool. Href *string `json:"href" validate:"required"` // The unique identifier for this load balancer pool. @@ -70710,7 +69410,7 @@ type LoadBalancerPoolReference struct { // UnmarshalLoadBalancerPoolReference unmarshals an instance of LoadBalancerPoolReference from the specified map of raw messages. func UnmarshalLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerPoolReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -70734,25 +69434,6 @@ func UnmarshalLoadBalancerPoolReference(m map[string]json.RawMessage, result int return } -// LoadBalancerPoolReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerPoolReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerPoolReferenceDeleted unmarshals an instance of LoadBalancerPoolReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerPoolReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPoolReferenceDeleted) - 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 -} - // LoadBalancerPoolSessionPersistence : LoadBalancerPoolSessionPersistence struct type LoadBalancerPoolSessionPersistence struct { // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not @@ -70882,76 +69563,6 @@ func UnmarshalLoadBalancerPoolSessionPersistencePrototype(m map[string]json.RawM return } -// LoadBalancerPrivateIpsItem : LoadBalancerPrivateIpsItem struct -type LoadBalancerPrivateIpsItem struct { - // The IP address. - // - // If the address has not yet been selected, 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"` - - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this reserved IP. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this reserved IP. - ID *string `json:"id" validate:"required"` - - // The name for this reserved IP. The name is unique across all reserved IPs in a subnet. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the LoadBalancerPrivateIpsItem.ResourceType property. -// The resource type. -const ( - LoadBalancerPrivateIpsItemResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" -) - -// UnmarshalLoadBalancerPrivateIpsItem unmarshals an instance of LoadBalancerPrivateIpsItem from the specified map of raw messages. -func UnmarshalLoadBalancerPrivateIpsItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerPrivateIpsItem) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) - 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 -} - // LoadBalancerProfile : LoadBalancerProfile struct type LoadBalancerProfile struct { // The product family this load balancer profile belongs to. @@ -71425,25 +70036,6 @@ func UnmarshalLoadBalancerProfileUDPSupported(m map[string]json.RawMessage, resu return } -// LoadBalancerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type LoadBalancerReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalLoadBalancerReferenceDeleted unmarshals an instance of LoadBalancerReferenceDeleted from the specified map of raw messages. -func UnmarshalLoadBalancerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadBalancerReferenceDeleted) - 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 -} - // LoadBalancerStatistics : LoadBalancerStatistics struct type LoadBalancerStatistics struct { // Number of active connections of this load balancer. @@ -71818,7 +70410,7 @@ type NetworkACLReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *NetworkACLReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this network ACL. Href *string `json:"href" validate:"required"` @@ -71838,7 +70430,7 @@ func UnmarshalNetworkACLReference(m map[string]json.RawMessage, result interface err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -71862,25 +70454,6 @@ func UnmarshalNetworkACLReference(m map[string]json.RawMessage, result interface return } -// NetworkACLReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkACLReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkACLReferenceDeleted unmarshals an instance of NetworkACLReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkACLReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLReferenceDeleted) - 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 -} - // NetworkACLRule : NetworkACLRule struct // Models which "extend" this model: // - NetworkACLRuleNetworkACLRuleProtocolTcpudp @@ -72765,7 +71338,7 @@ func UnmarshalNetworkACLRulePrototypeNetworkACLContext(m map[string]json.RawMess type NetworkACLRuleReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *NetworkACLRuleReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this network ACL rule. Href *string `json:"href" validate:"required"` @@ -72780,7 +71353,7 @@ type NetworkACLRuleReference struct { // UnmarshalNetworkACLRuleReference unmarshals an instance of NetworkACLRuleReference from the specified map of raw messages. func UnmarshalNetworkACLRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(NetworkACLRuleReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLRuleReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -72804,25 +71377,6 @@ func UnmarshalNetworkACLRuleReference(m map[string]json.RawMessage, result inter return } -// NetworkACLRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkACLRuleReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkACLRuleReferenceDeleted unmarshals an instance of NetworkACLRuleReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkACLRuleReferenceDeleted) - 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 -} - // NetworkInterface : NetworkInterface struct type NetworkInterface struct { // Indicates whether source IP spoofing is allowed on this instance network interface. @@ -73018,7 +71572,7 @@ func UnmarshalNetworkInterface(m map[string]json.RawMessage, result interface{}) type NetworkInterfaceBareMetalServerContextReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *NetworkInterfaceBareMetalServerContextReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this bare metal server network interface. // @@ -73056,7 +71610,7 @@ const ( // UnmarshalNetworkInterfaceBareMetalServerContextReference unmarshals an instance of NetworkInterfaceBareMetalServerContextReference from the specified map of raw messages. func UnmarshalNetworkInterfaceBareMetalServerContextReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(NetworkInterfaceBareMetalServerContextReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -73095,25 +71649,6 @@ func UnmarshalNetworkInterfaceBareMetalServerContextReference(m map[string]json. return } -// NetworkInterfaceBareMetalServerContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceBareMetalServerContextReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted unmarshals an instance of NetworkInterfaceBareMetalServerContextReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceBareMetalServerContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceBareMetalServerContextReferenceDeleted) - 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 -} - // NetworkInterfaceIPPrototype : NetworkInterfaceIPPrototype struct // Models which "extend" this model: // - NetworkInterfaceIPPrototypeReservedIPIdentity @@ -73184,7 +71719,7 @@ func UnmarshalNetworkInterfaceIPPrototype(m map[string]json.RawMessage, result i type NetworkInterfaceInstanceContextReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *NetworkInterfaceInstanceContextReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance network interface. // @@ -73222,7 +71757,7 @@ const ( // UnmarshalNetworkInterfaceInstanceContextReference unmarshals an instance of NetworkInterfaceInstanceContextReference from the specified map of raw messages. func UnmarshalNetworkInterfaceInstanceContextReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(NetworkInterfaceInstanceContextReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceInstanceContextReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -73261,25 +71796,6 @@ func UnmarshalNetworkInterfaceInstanceContextReference(m map[string]json.RawMess return } -// NetworkInterfaceInstanceContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceInstanceContextReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkInterfaceInstanceContextReferenceDeleted unmarshals an instance of NetworkInterfaceInstanceContextReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceInstanceContextReferenceDeleted) - 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 -} - // NetworkInterfacePatch : NetworkInterfacePatch struct type NetworkInterfacePatch struct { // Indicates whether source IP spoofing is allowed on this instance network interface. @@ -73399,44 +71915,6 @@ func UnmarshalNetworkInterfacePrototype(m map[string]json.RawMessage, result int return } -// NetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkInterfaceReferenceDeleted unmarshals an instance of NetworkInterfaceReferenceDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceReferenceDeleted) - 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 -} - -// NetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type NetworkInterfaceReferenceTargetContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of NetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. -func UnmarshalNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetworkInterfaceReferenceTargetContextDeleted) - 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 -} - // NetworkInterfaceUnpaginatedCollection : NetworkInterfaceUnpaginatedCollection struct type NetworkInterfaceUnpaginatedCollection struct { // Collection of instance network interfaces. @@ -73978,25 +72456,6 @@ func (placementGroupPatch *PlacementGroupPatch) AsPatch() (_patch map[string]int return } -// PlacementGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type PlacementGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalPlacementGroupReferenceDeleted unmarshals an instance of PlacementGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalPlacementGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PlacementGroupReferenceDeleted) - 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 -} - // PublicGateway : PublicGateway struct type PublicGateway struct { // The date and time that the public gateway was created. @@ -74222,7 +72681,7 @@ type PublicGatewayFloatingIP struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this floating IP. Href *string `json:"href" validate:"required"` @@ -74247,7 +72706,7 @@ func UnmarshalPublicGatewayFloatingIP(m map[string]json.RawMessage, result inter err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -74426,7 +72885,7 @@ type PublicGatewayReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this public gateway. Href *string `json:"href" validate:"required"` @@ -74455,7 +72914,7 @@ func UnmarshalPublicGatewayReference(m map[string]json.RawMessage, result interf err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPublicGatewayReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -74484,25 +72943,6 @@ func UnmarshalPublicGatewayReference(m map[string]json.RawMessage, result interf return } -// PublicGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type PublicGatewayReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalPublicGatewayReferenceDeleted unmarshals an instance of PublicGatewayReferenceDeleted from the specified map of raw messages. -func UnmarshalPublicGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublicGatewayReferenceDeleted) - 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 -} - // Region : Region struct type Region struct { // The API endpoint for this region. @@ -74843,44 +73283,6 @@ func (options *RemoveVirtualNetworkInterfaceIPOptions) SetHeaders(param map[stri return options } -// RemoveVPNGatewayAdvertisedCIDROptions : The RemoveVPNGatewayAdvertisedCIDR options. -type RemoveVPNGatewayAdvertisedCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_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 -} - -// NewRemoveVPNGatewayAdvertisedCIDROptions : Instantiate RemoveVPNGatewayAdvertisedCIDROptions -func (*VpcV1) NewRemoveVPNGatewayAdvertisedCIDROptions(vpnGatewayID string, cidr string) *RemoveVPNGatewayAdvertisedCIDROptions { - return &RemoveVPNGatewayAdvertisedCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - CIDR: core.StringPtr(cidr), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *RemoveVPNGatewayAdvertisedCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayAdvertisedCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetCIDR : Allow user to set CIDR -func (_options *RemoveVPNGatewayAdvertisedCIDROptions) SetCIDR(cidr string) *RemoveVPNGatewayAdvertisedCIDROptions { - _options.CIDR = core.StringPtr(cidr) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RemoveVPNGatewayAdvertisedCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayAdvertisedCIDROptions { - options.Headers = param - return options -} - // RemoveVPNGatewayConnectionsLocalCIDROptions : The RemoveVPNGatewayConnectionsLocalCIDR options. type RemoveVPNGatewayConnectionsLocalCIDROptions struct { // The VPN gateway identifier. @@ -75980,7 +74382,7 @@ type ReservationReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *ReservationReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this reservation. Href *string `json:"href" validate:"required"` @@ -76009,7 +74411,7 @@ func UnmarshalReservationReference(m map[string]json.RawMessage, result interfac err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservationReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -76038,25 +74440,6 @@ func UnmarshalReservationReference(m map[string]json.RawMessage, result interfac return } -// ReservationReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ReservationReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalReservationReferenceDeleted unmarshals an instance of ReservationReferenceDeleted from the specified map of raw messages. -func UnmarshalReservationReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservationReferenceDeleted) - 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 -} - // ReservationStatusReason : ReservationStatusReason struct type ReservationStatusReason struct { // A snake case string succinctly identifying the status reason. @@ -76775,7 +75158,7 @@ type ReservedIPReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this reserved IP. Href *string `json:"href" validate:"required"` @@ -76804,7 +75187,7 @@ func UnmarshalReservedIPReference(m map[string]json.RawMessage, result interface err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -76833,25 +75216,6 @@ func UnmarshalReservedIPReference(m map[string]json.RawMessage, result interface return } -// ReservedIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ReservedIPReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalReservedIPReferenceDeleted unmarshals an instance of ReservedIPReferenceDeleted from the specified map of raw messages. -func UnmarshalReservedIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPReferenceDeleted) - 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 -} - // ReservedIPTarget : The target this reserved IP is bound to. // // If absent, this reserved IP is provider-owned or unbound. @@ -76870,7 +75234,7 @@ type ReservedIPTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this endpoint gateway. Href *string `json:"href,omitempty"` @@ -76907,7 +75271,7 @@ func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -77655,14 +76019,14 @@ func UnmarshalRouteCollectionVPCContextRoutesItem(m map[string]json.RawMessage, // - RouteCreatorVPNGatewayReference // - RouteCreatorVPNServerReference type RouteCreator struct { - // The VPN gateway's CRN. + // The CRN for this VPN gateway. CRN *string `json:"crn,omitempty"` // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The VPN gateway's canonical URL. + // The URL for this VPN gateway. Href *string `json:"href,omitempty"` // The unique identifier for this VPN gateway. @@ -77697,7 +76061,7 @@ func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (er err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -77739,9 +76103,9 @@ type RouteNextHop struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The VPN connection's canonical URL. + // The URL for this VPN gateway connection. Href *string `json:"href,omitempty"` // The unique identifier for this VPN gateway connection. @@ -77776,7 +76140,7 @@ func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (er err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -77824,7 +76188,7 @@ type RouteNextHopPatch struct { // The unique identifier for this VPN gateway connection. ID *string `json:"id,omitempty"` - // The VPN connection's canonical URL. + // The URL for this VPN gateway connection. Href *string `json:"href,omitempty"` } @@ -77858,6 +76222,58 @@ func UnmarshalRouteNextHopPatch(m map[string]json.RawMessage, result interface{} 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`. +// +// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has +// an `action` of `deliver` and `next_hop` is an IP address. +// Models which "extend" this model: +// - RouteNextHopPrototypeRouteNextHopIP +// - RouteNextHopPrototypeVPNGatewayConnectionIdentity +type RouteNextHopPrototype struct { + // The sentinel IP address (`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,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The URL for this VPN gateway connection. + Href *string `json:"href,omitempty"` +} + +func (*RouteNextHopPrototype) isaRouteNextHopPrototype() bool { + return true +} + +type RouteNextHopPrototypeIntf interface { + isaRouteNextHopPrototype() bool +} + +// UnmarshalRouteNextHopPrototype unmarshals an instance of RouteNextHopPrototype from the specified map of raw messages. +func UnmarshalRouteNextHopPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPrototype) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-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()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // RoutePatch : RoutePatch struct type RoutePatch struct { // Indicates whether this route will be advertised to the ingress sources specified by the `advertise_routes_to` @@ -77961,7 +76377,7 @@ type RoutePrototype struct { // // At most two routes per `zone` in a table can have the same `destination` and `priority`, // and only when each route has an `action` of `deliver` and `next_hop` is an IP address. - NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` + NextHop RouteNextHopPrototypeIntf `json:"next_hop,omitempty"` // The priority of this route. Smaller values have higher priority. // @@ -78029,7 +76445,7 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRoutePrototypeNextHop) + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHopPrototype) if err != nil { err = core.SDKErrorf(err, "", "next_hop-error", common.GetComponentInfo()) return @@ -78048,63 +76464,11 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( return } -// RoutePrototypeNextHop : 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`. -// -// At most two routes per `zone` in a table can have the same `destination` and `priority`, and only when each route has -// an `action` of `deliver` and `next_hop` is an IP address. -// Models which "extend" this model: -// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP -// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity -type RoutePrototypeNextHop struct { - // The sentinel IP address (`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,omitempty"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*RoutePrototypeNextHop) isaRoutePrototypeNextHop() bool { - return true -} - -type RoutePrototypeNextHopIntf interface { - isaRoutePrototypeNextHop() bool -} - -// UnmarshalRoutePrototypeNextHop unmarshals an instance of RoutePrototypeNextHop from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHop(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHop) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // RouteReference : RouteReference struct type RouteReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *RouteReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this route. Href *string `json:"href" validate:"required"` @@ -78119,7 +76483,7 @@ type RouteReference struct { // UnmarshalRouteReference unmarshals an instance of RouteReference from the specified map of raw messages. func UnmarshalRouteReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(RouteReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRouteReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -78143,25 +76507,6 @@ func UnmarshalRouteReference(m map[string]json.RawMessage, result interface{}) ( return } -// RouteReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type RouteReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalRouteReferenceDeleted unmarshals an instance of RouteReferenceDeleted from the specified map of raw messages. -func UnmarshalRouteReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteReferenceDeleted) - 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 -} - // RoutingTable : RoutingTable struct type RoutingTable struct { // The filters specifying the resources that may create routes in this routing table. @@ -78630,7 +76975,7 @@ func (routingTablePatch *RoutingTablePatch) AsPatch() (_patch map[string]interfa type RoutingTableReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *RoutingTableReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this routing table. Href *string `json:"href" validate:"required"` @@ -78654,7 +76999,7 @@ const ( // UnmarshalRoutingTableReference unmarshals an instance of RoutingTableReference from the specified map of raw messages. func UnmarshalRoutingTableReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(RoutingTableReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRoutingTableReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -78683,34 +77028,15 @@ func UnmarshalRoutingTableReference(m map[string]json.RawMessage, result interfa return } -// RoutingTableReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type RoutingTableReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalRoutingTableReferenceDeleted unmarshals an instance of RoutingTableReferenceDeleted from the specified map of raw messages. -func UnmarshalRoutingTableReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutingTableReferenceDeleted) - 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 -} - // SecurityGroup : SecurityGroup struct type SecurityGroup struct { // The date and time that this security group was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The security group's CRN. + // The CRN for this security group. CRN *string `json:"crn" validate:"required"` - // The security group's canonical URL. + // The URL for this security group. Href *string `json:"href" validate:"required"` // The unique identifier for this security group. @@ -78895,10 +77221,10 @@ type SecurityGroupIdentity struct { // The unique identifier for this security group. ID *string `json:"id,omitempty"` - // The security group's CRN. + // The CRN for this security group. CRN *string `json:"crn,omitempty"` - // The security group's canonical URL. + // The URL for this security group. Href *string `json:"href,omitempty"` } @@ -78965,14 +77291,14 @@ func (securityGroupPatch *SecurityGroupPatch) AsPatch() (_patch map[string]inter // SecurityGroupReference : SecurityGroupReference struct type SecurityGroupReference struct { - // The security group's CRN. + // The CRN for this security group. CRN *string `json:"crn" validate:"required"` // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The security group's canonical URL. + // The URL for this security group. Href *string `json:"href" validate:"required"` // The unique identifier for this security group. @@ -78990,7 +77316,7 @@ func UnmarshalSecurityGroupReference(m map[string]json.RawMessage, result interf err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -79014,25 +77340,6 @@ func UnmarshalSecurityGroupReference(m map[string]json.RawMessage, result interf return } -// SecurityGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type SecurityGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalSecurityGroupReferenceDeleted unmarshals an instance of SecurityGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalSecurityGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupReferenceDeleted) - 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 -} - // SecurityGroupRule : SecurityGroupRule struct // Models which "extend" this model: // - SecurityGroupRuleSecurityGroupRuleProtocolAll @@ -79591,14 +77898,14 @@ type SecurityGroupRuleRemote struct { // blocks in the future. CIDRBlock *string `json:"cidr_block,omitempty"` - // The security group's CRN. + // The CRN for this security group. CRN *string `json:"crn,omitempty"` // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The security group's canonical URL. + // The URL for this security group. Href *string `json:"href,omitempty"` // The unique identifier for this security group. @@ -79634,7 +77941,7 @@ func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result inter err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -79681,10 +77988,10 @@ type SecurityGroupRuleRemotePatch struct { // The unique identifier for this security group. ID *string `json:"id,omitempty"` - // The security group's CRN. + // The CRN for this security group. CRN *string `json:"crn,omitempty"` - // The security group's canonical URL. + // The URL for this security group. Href *string `json:"href,omitempty"` } @@ -79753,10 +78060,10 @@ type SecurityGroupRuleRemotePrototype struct { // The unique identifier for this security group. ID *string `json:"id,omitempty"` - // The security group's CRN. + // The CRN for this security group. CRN *string `json:"crn,omitempty"` - // The security group's canonical URL. + // The URL for this security group. Href *string `json:"href,omitempty"` } @@ -79916,7 +78223,7 @@ func UnmarshalSecurityGroupTargetCollectionNext(m map[string]json.RawMessage, re type SecurityGroupTargetReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance network interface. // @@ -79939,7 +78246,7 @@ type SecurityGroupTargetReference struct { // The resource type. ResourceType *string `json:"resource_type,omitempty"` - // The load balancer's CRN. + // The CRN for this load balancer. CRN *string `json:"crn,omitempty"` // The primary IP for this virtual network interface. @@ -79966,7 +78273,7 @@ type SecurityGroupTargetReferenceIntf interface { // UnmarshalSecurityGroupTargetReference unmarshals an instance of SecurityGroupTargetReference from the specified map of raw messages. func UnmarshalSecurityGroupTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SecurityGroupTargetReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -80541,7 +78848,7 @@ type ShareAccessorBindingAccessor struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *ShareReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this file share. Href *string `json:"href,omitempty"` @@ -80582,7 +78889,7 @@ func UnmarshalShareAccessorBindingAccessor(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -81553,7 +79860,7 @@ func UnmarshalShareMountTargetPrototype(m map[string]json.RawMessage, result int type ShareMountTargetReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this share mount target. Href *string `json:"href" validate:"required"` @@ -81577,7 +79884,7 @@ const ( // UnmarshalShareMountTargetReference unmarshals an instance of ShareMountTargetReference from the specified map of raw messages. func UnmarshalShareMountTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ShareMountTargetReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -81606,25 +79913,6 @@ func UnmarshalShareMountTargetReference(m map[string]json.RawMessage, result int return } -// ShareMountTargetReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ShareMountTargetReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalShareMountTargetReferenceDeleted unmarshals an instance of ShareMountTargetReferenceDeleted from the specified map of raw messages. -func UnmarshalShareMountTargetReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareMountTargetReferenceDeleted) - 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 -} - // ShareMountTargetVirtualNetworkInterfacePrototype : ShareMountTargetVirtualNetworkInterfacePrototype struct // Models which "extend" this model: // - ShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInterfacePrototypeShareMountTargetContext @@ -82433,8 +80721,8 @@ type SharePrototype struct { // The maximum size for a share may increase in the future. Size *int64 `json:"size,omitempty"` - // The zone this file share will reside in. For a replica share, this must be a different - // zone in the same region as the source share. + // The zone this file share will reside in. For a replica share in the same region as + // the source share, this must be a different zone from the source share. Zone ZoneIdentityIntf `json:"zone,omitempty"` // The cron specification for the file share replication schedule. @@ -82608,6 +80896,8 @@ 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. + // + // For this property to be changed, the share `replication_role` must be `replica`. ReplicationCronSpec *string `json:"replication_cron_spec" validate:"required"` // The resource group to use. If unspecified, the resource group from @@ -82617,9 +80907,8 @@ type SharePrototypeShareContext struct { // Tags for this resource. UserTags []string `json:"user_tags,omitempty"` - // The zone this replica file share will reside in. - // - // Must be a different zone in the same region as the source share. + // The zone this replica file share will reside in. For a replica share in the same + // region as the source share, this must be a different zone from the source share. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } @@ -82708,7 +80997,7 @@ type ShareReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *ShareReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this file share. Href *string `json:"href" validate:"required"` @@ -82741,7 +81030,7 @@ func UnmarshalShareReference(m map[string]json.RawMessage, result interface{}) ( err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -82775,25 +81064,6 @@ func UnmarshalShareReference(m map[string]json.RawMessage, result interface{}) ( return } -// ShareReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type ShareReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalShareReferenceDeleted unmarshals an instance of ShareReferenceDeleted from the specified map of raw messages. -func UnmarshalShareReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareReferenceDeleted) - 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 -} - // ShareRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not // be directly retrievable. type ShareRemote struct { @@ -83679,7 +81949,7 @@ type SnapshotConsistencyGroupReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *SnapshotConsistencyGroupReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this snapshot consistency group. Href *string `json:"href" validate:"required"` @@ -83709,7 +81979,7 @@ func UnmarshalSnapshotConsistencyGroupReference(m map[string]json.RawMessage, re err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotConsistencyGroupReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -83738,25 +82008,6 @@ func UnmarshalSnapshotConsistencyGroupReference(m map[string]json.RawMessage, re return } -// SnapshotConsistencyGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type SnapshotConsistencyGroupReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalSnapshotConsistencyGroupReferenceDeleted unmarshals an instance of SnapshotConsistencyGroupReferenceDeleted from the specified map of raw messages. -func UnmarshalSnapshotConsistencyGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotConsistencyGroupReferenceDeleted) - 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 -} - // SnapshotCopiesItem : SnapshotCopiesItem struct type SnapshotCopiesItem struct { // The CRN for the copied snapshot. @@ -83764,7 +82015,7 @@ type SnapshotCopiesItem struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for the copied snapshot. Href *string `json:"href" validate:"required"` @@ -83797,7 +82048,7 @@ func UnmarshalSnapshotCopiesItem(m map[string]json.RawMessage, result interface{ err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -84058,7 +82309,7 @@ type SnapshotReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this snapshot. Href *string `json:"href" validate:"required"` @@ -84091,7 +82342,7 @@ func UnmarshalSnapshotReference(m map[string]json.RawMessage, result interface{} err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -84125,25 +82376,6 @@ func UnmarshalSnapshotReference(m map[string]json.RawMessage, result interface{} return } -// SnapshotReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type SnapshotReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalSnapshotReferenceDeleted unmarshals an instance of SnapshotReferenceDeleted from the specified map of raw messages. -func UnmarshalSnapshotReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SnapshotReferenceDeleted) - 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 -} - // SnapshotRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not // be directly retrievable. type SnapshotRemote struct { @@ -84171,7 +82403,7 @@ type SnapshotSourceSnapshot struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *SnapshotReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for the source snapshot. Href *string `json:"href" validate:"required"` @@ -84204,7 +82436,7 @@ func UnmarshalSnapshotSourceSnapshot(m map[string]json.RawMessage, result interf err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSnapshotReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -84862,7 +83094,7 @@ type SubnetReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *SubnetReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this subnet. Href *string `json:"href" validate:"required"` @@ -84891,7 +83123,7 @@ func UnmarshalSubnetReference(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSubnetReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -84920,25 +83152,6 @@ func UnmarshalSubnetReference(m map[string]json.RawMessage, result interface{}) return } -// SubnetReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type SubnetReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalSubnetReferenceDeleted unmarshals an instance of SubnetReferenceDeleted from the specified map of raw messages. -func UnmarshalSubnetReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SubnetReferenceDeleted) - 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 -} - // TrustedProfileIdentity : Identifies a trusted profile by a unique property. // Models which "extend" this model: // - TrustedProfileIdentityTrustedProfileByID @@ -87632,10 +85845,6 @@ type UpdateVPNGatewayConnectionOptions struct { // The VPN gateway connection patch. VPNGatewayConnectionPatch map[string]interface{} `json:"VPNGatewayConnection_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 } @@ -87667,12 +85876,6 @@ func (_options *UpdateVPNGatewayConnectionOptions) SetVPNGatewayConnectionPatch( return _options } -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateVPNGatewayConnectionOptions) SetIfMatch(ifMatch string) *UpdateVPNGatewayConnectionOptions { - _options.IfMatch = core.StringPtr(ifMatch) - return _options -} - // SetHeaders : Allow user to set Headers func (options *UpdateVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *UpdateVPNGatewayConnectionOptions { options.Headers = param @@ -89002,7 +87205,7 @@ type VPCReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this VPC. Href *string `json:"href" validate:"required"` @@ -89031,7 +87234,7 @@ func UnmarshalVPCReference(m map[string]json.RawMessage, result interface{}) (er err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -89069,7 +87272,7 @@ type VPCReferenceDnsResolverContext struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VPCReferenceDnsResolverContextDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this VPC. Href *string `json:"href" validate:"required"` @@ -89102,7 +87305,7 @@ func UnmarshalVPCReferenceDnsResolverContext(m map[string]json.RawMessage, resul err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDnsResolverContextDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -89136,44 +87339,6 @@ func UnmarshalVPCReferenceDnsResolverContext(m map[string]json.RawMessage, resul return } -// VPCReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPCReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPCReferenceDeleted unmarshals an instance of VPCReferenceDeleted from the specified map of raw messages. -func UnmarshalVPCReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCReferenceDeleted) - 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 -} - -// VPCReferenceDnsResolverContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPCReferenceDnsResolverContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPCReferenceDnsResolverContextDeleted unmarshals an instance of VPCReferenceDnsResolverContextDeleted from the specified map of raw messages. -func UnmarshalVPCReferenceDnsResolverContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCReferenceDnsResolverContextDeleted) - 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 -} - // VPCReferenceRemote : VPCReferenceRemote struct type VPCReferenceRemote struct { // The CRN for this VPC. @@ -89279,7 +87444,7 @@ type VPNGateway struct { // The date and time that this VPN gateway was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The VPN gateway's CRN. + // The CRN for this VPN gateway. CRN *string `json:"crn" validate:"required"` // The reasons for the current `health_state` (if any). @@ -89294,7 +87459,7 @@ type VPNGateway struct { // health state of `inapplicable`. A `pending` resource may also have this state. HealthState *string `json:"health_state" validate:"required"` - // The VPN gateway's canonical URL. + // The URL for this VPN gateway. Href *string `json:"href" validate:"required"` // The unique identifier for this VPN gateway. @@ -89323,13 +87488,6 @@ type VPNGateway struct { // The VPC this VPN gateway resides in. VPC *VPCReference `json:"vpc" validate:"required"` - // The additional CIDRs advertised through any enabled routing protocol (for example, BGP). The routing protocol will - // advertise routes with these CIDRs and VPC prefixes as route destinations. - AdvertisedCIDRs []string `json:"advertised_cidrs,omitempty"` - - // The local autonomous system number (ASN) for this VPN gateway and its connections. - LocalAsn *int64 `json:"local_asn,omitempty"` - // Route mode VPN gateway. Mode *string `json:"mode,omitempty"` } @@ -89459,16 +87617,6 @@ func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "advertised_cidrs", &obj.AdvertisedCIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "advertised_cidrs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "local_asn", &obj.LocalAsn) - if err != nil { - err = core.SDKErrorf(err, "", "local_asn-error", common.GetComponentInfo()) - return - } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) @@ -89478,94 +87626,6 @@ func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err return } -// VPNGatewayAdvertisedCIDRCollection : VPNGatewayAdvertisedCIDRCollection struct -type VPNGatewayAdvertisedCIDRCollection struct { - // The additional CIDRs advertised through any enabled routing protocol (for example, BGP). The routing protocol will - // advertise routes with these CIDRs and VPC prefixes as route destinations. - AdvertisedCIDRs []string `json:"advertised_cidrs" validate:"required"` - - // A link to the first page of resources. - First *VPNGatewayAdvertisedCIDRCollectionFirst `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 *VPNGatewayAdvertisedCIDRCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} - -// UnmarshalVPNGatewayAdvertisedCIDRCollection unmarshals an instance of VPNGatewayAdvertisedCIDRCollection from the specified map of raw messages. -func UnmarshalVPNGatewayAdvertisedCIDRCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayAdvertisedCIDRCollection) - err = core.UnmarshalPrimitive(m, "advertised_cidrs", &obj.AdvertisedCIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "advertised_cidrs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNGatewayAdvertisedCIDRCollectionFirst) - 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, UnmarshalVPNGatewayAdvertisedCIDRCollectionNext) - 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 -} - -// VPNGatewayAdvertisedCIDRCollectionFirst : A link to the first page of resources. -type VPNGatewayAdvertisedCIDRCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNGatewayAdvertisedCIDRCollectionFirst unmarshals an instance of VPNGatewayAdvertisedCIDRCollectionFirst from the specified map of raw messages. -func UnmarshalVPNGatewayAdvertisedCIDRCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayAdvertisedCIDRCollectionFirst) - 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 -} - -// VPNGatewayAdvertisedCIDRCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VPNGatewayAdvertisedCIDRCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPNGatewayAdvertisedCIDRCollectionNext unmarshals an instance of VPNGatewayAdvertisedCIDRCollectionNext from the specified map of raw messages. -func UnmarshalVPNGatewayAdvertisedCIDRCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayAdvertisedCIDRCollectionNext) - 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 -} - // VPNGatewayCollection : VPNGatewayCollection struct type VPNGatewayCollection struct { // A link to the first page of resources. @@ -89694,7 +87754,7 @@ type VPNGatewayConnection struct { // connection will be brought down after its lifetime expires. EstablishMode *string `json:"establish_mode" validate:"required"` - // The VPN connection's canonical URL. + // The URL for this VPN gateway connection. Href *string `json:"href" validate:"required"` // The unique identifier for this VPN gateway connection. @@ -90070,254 +88130,6 @@ func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, res return } -// VPNGatewayConnectionDynamicRouteModeLocal : VPNGatewayConnectionDynamicRouteModeLocal struct -type VPNGatewayConnectionDynamicRouteModeLocal struct { - // The local IKE identities. - // - // A VPN gateway in dynamic route mode consists of two members in active-active mode. The first identity applies to the - // first member, and the second identity applies to the second member. - IkeIdentities []VPNGatewayConnectionIkeIdentityIntf `json:"ike_identities" validate:"required"` -} - -// UnmarshalVPNGatewayConnectionDynamicRouteModeLocal unmarshals an instance of VPNGatewayConnectionDynamicRouteModeLocal from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDynamicRouteModeLocal(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDynamicRouteModeLocal) - err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionDynamicRouteModeLocalPrototype : VPNGatewayConnectionDynamicRouteModeLocalPrototype struct -type VPNGatewayConnectionDynamicRouteModeLocalPrototype struct { - // The local IKE identities to use. - // - // A VPN gateway in dynamic route mode consists of two members in active-active mode. The first specified identity will - // be applied to the first member, and the second specified identity will be applied to the second member. - // - // If unspecified, then `type` will be `ipv4_address` and `value` will be the public IP address of the member's VPN - // connection tunnel. - IkeIdentities []VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identities,omitempty"` -} - -// UnmarshalVPNGatewayConnectionDynamicRouteModeLocalPrototype unmarshals an instance of VPNGatewayConnectionDynamicRouteModeLocalPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDynamicRouteModeLocalPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDynamicRouteModeLocalPrototype) - err = core.UnmarshalModel(m, "ike_identities", &obj.IkeIdentities, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identities-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionDynamicRouteModePeer : VPNGatewayConnectionDynamicRouteModePeer struct -// Models which "extend" this model: -// - VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress -// - VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn -type VPNGatewayConnectionDynamicRouteModePeer struct { - // The peer autonomous system number (ASN) for this VPN gateway connection. - Asn *int64 `json:"asn" validate:"required"` - - // The peer IKE identity. - IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` - - // Indicates whether `peer.address` or `peer.fqdn` is used. - Type *string `json:"type" validate:"required"` - - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address,omitempty"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn,omitempty"` -} - -// Constants associated with the VPNGatewayConnectionDynamicRouteModePeer.Type property. -// Indicates whether `peer.address` or `peer.fqdn` is used. -const ( - VPNGatewayConnectionDynamicRouteModePeerTypeAddressConst = "address" - VPNGatewayConnectionDynamicRouteModePeerTypeFqdnConst = "fqdn" -) - -func (*VPNGatewayConnectionDynamicRouteModePeer) isaVPNGatewayConnectionDynamicRouteModePeer() bool { - return true -} - -type VPNGatewayConnectionDynamicRouteModePeerIntf interface { - isaVPNGatewayConnectionDynamicRouteModePeer() bool -} - -// UnmarshalVPNGatewayConnectionDynamicRouteModePeer unmarshals an instance of VPNGatewayConnectionDynamicRouteModePeer from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDynamicRouteModePeer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDynamicRouteModePeer) - err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) - if err != nil { - err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionDynamicRouteModePeerPrototype : VPNGatewayConnectionDynamicRouteModePeerPrototype struct -// Models which "extend" this model: -// - VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress -// - VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn -type VPNGatewayConnectionDynamicRouteModePeerPrototype struct { - // The peer autonomous system number (ASN) for this VPN gateway connection. - Asn *int64 `json:"asn" validate:"required"` - - // The peer IKE identity to use. - // - // If unspecified: - // - If `peer.address` is specified, the `type` will be `ipv4_address`, and - // the `value` will be `peer.address`. - // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` - // will be `peer.fqdn`. - IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` - - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address,omitempty"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn,omitempty"` -} - -func (*VPNGatewayConnectionDynamicRouteModePeerPrototype) isaVPNGatewayConnectionDynamicRouteModePeerPrototype() bool { - return true -} - -type VPNGatewayConnectionDynamicRouteModePeerPrototypeIntf interface { - isaVPNGatewayConnectionDynamicRouteModePeerPrototype() bool -} - -// UnmarshalVPNGatewayConnectionDynamicRouteModePeerPrototype unmarshals an instance of VPNGatewayConnectionDynamicRouteModePeerPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDynamicRouteModePeerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDynamicRouteModePeerPrototype) - err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) - if err != nil { - err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionDynamicRouteModeTunnel : VPNGatewayConnectionDynamicRouteModeTunnel struct -type VPNGatewayConnectionDynamicRouteModeTunnel struct { - // The IP address of the neighbor on the virtual tunnel interface. - NeighborIP *IP `json:"neighbor_ip" validate:"required"` - - // BGP routing protocol state. - ProtocolState *string `json:"protocol_state,omitempty"` - - // The IP address of the VPN gateway member in which the tunnel resides. - PublicIP *IP `json:"public_ip" validate:"required"` - - // The status of the VPN Tunnel. - Status *string `json:"status" validate:"required"` - - // The reasons for the current status (if any). - StatusReasons []VPNGatewayConnectionTunnelStatusReason `json:"status_reasons" validate:"required"` - - // The IP address of the virtual tunnel interface. - TunnelInterfaceIP *IP `json:"tunnel_interface_ip" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionDynamicRouteModeTunnel.ProtocolState property. -// BGP routing protocol state. -const ( - VPNGatewayConnectionDynamicRouteModeTunnelProtocolStateActiveConst = "active" - VPNGatewayConnectionDynamicRouteModeTunnelProtocolStateConnectConst = "connect" - VPNGatewayConnectionDynamicRouteModeTunnelProtocolStateEstablishedConst = "established" - VPNGatewayConnectionDynamicRouteModeTunnelProtocolStateIdleConst = "idle" - VPNGatewayConnectionDynamicRouteModeTunnelProtocolStateOpenConfirmConst = "open_confirm" - VPNGatewayConnectionDynamicRouteModeTunnelProtocolStateOpenSentConst = "open_sent" -) - -// Constants associated with the VPNGatewayConnectionDynamicRouteModeTunnel.Status property. -// The status of the VPN Tunnel. -const ( - VPNGatewayConnectionDynamicRouteModeTunnelStatusDownConst = "down" - VPNGatewayConnectionDynamicRouteModeTunnelStatusUpConst = "up" -) - -// UnmarshalVPNGatewayConnectionDynamicRouteModeTunnel unmarshals an instance of VPNGatewayConnectionDynamicRouteModeTunnel from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDynamicRouteModeTunnel(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDynamicRouteModeTunnel) - err = core.UnmarshalModel(m, "neighbor_ip", &obj.NeighborIP, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "neighbor_ip-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "protocol_state", &obj.ProtocolState) - if err != nil { - err = core.SDKErrorf(err, "", "protocol_state-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "public_ip-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, UnmarshalVPNGatewayConnectionTunnelStatusReason) - if err != nil { - err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "tunnel_interface_ip", &obj.TunnelInterfaceIP, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "tunnel_interface_ip-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VPNGatewayConnectionIkeIdentity : VPNGatewayConnectionIkeIdentity struct // Models which "extend" this model: // - VPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityFqdn @@ -90429,7 +88241,7 @@ type VPNGatewayConnectionIkePolicyPatch struct { // The unique identifier for this IKE policy. ID *string `json:"id,omitempty"` - // The IKE policy's canonical URL. + // The URL for this IKE policy. Href *string `json:"href,omitempty"` } @@ -90467,7 +88279,7 @@ type VPNGatewayConnectionIkePolicyPrototype struct { // The unique identifier for this IKE policy. ID *string `json:"id,omitempty"` - // The IKE policy's canonical URL. + // The URL for this IKE policy. Href *string `json:"href,omitempty"` } @@ -90505,7 +88317,7 @@ type VPNGatewayConnectionIPsecPolicyPatch struct { // The unique identifier for this IPsec policy. ID *string `json:"id,omitempty"` - // The IPsec policy's canonical URL. + // The URL for this IPsec policy. Href *string `json:"href,omitempty"` } @@ -90543,7 +88355,7 @@ type VPNGatewayConnectionIPsecPolicyPrototype struct { // The unique identifier for this IPsec policy. ID *string `json:"id,omitempty"` - // The IPsec policy's canonical URL. + // The URL for this IPsec policy. Href *string `json:"href,omitempty"` } @@ -90604,16 +88416,6 @@ type VPNGatewayConnectionPatch struct { // The pre-shared key. Psk *string `json:"psk,omitempty"` - - // The routing protocol for this VPN gateway connection. For this property to be specified, `mode` must be `route`. - // - // - `none`: No routing protocol will be used. - // - `bgp`: The BGP routing protocol will be used. - RoutingProtocol *string `json:"routing_protocol,omitempty"` - - // The VPN tunnel configuration to use for this VPN gateway connection - // (in dynamic route mode). - Tunnels []VPNGatewayConnectionTunnel `json:"tunnels,omitempty"` } // Constants associated with the VPNGatewayConnectionPatch.EstablishMode property. @@ -90629,16 +88431,6 @@ const ( VPNGatewayConnectionPatchEstablishModePeerOnlyConst = "peer_only" ) -// Constants associated with the VPNGatewayConnectionPatch.RoutingProtocol property. -// The routing protocol for this VPN gateway connection. For this property to be specified, `mode` must be `route`. -// -// - `none`: No routing protocol will be used. -// - `bgp`: The BGP routing protocol will be used. -const ( - VPNGatewayConnectionPatchRoutingProtocolBgpConst = "bgp" - VPNGatewayConnectionPatchRoutingProtocolNoneConst = "none" -) - // UnmarshalVPNGatewayConnectionPatch unmarshals an instance of VPNGatewayConnectionPatch from the specified map of raw messages. func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VPNGatewayConnectionPatch) @@ -90682,16 +88474,6 @@ func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionTunnel) - if err != nil { - err = core.SDKErrorf(err, "", "tunnels-error", common.GetComponentInfo()) - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -90713,16 +88495,12 @@ func (vpnGatewayConnectionPatch *VPNGatewayConnectionPatch) AsPatch() (_patch ma // Models which "extend" this model: // - VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch // - VPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePeerPatch -// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch type VPNGatewayConnectionPeerPatch struct { // The IP address of the peer VPN gateway for this connection. Address *string `json:"address,omitempty"` // The FQDN of the peer VPN gateway for this connection. Fqdn *string `json:"fqdn,omitempty"` - - // The peer autonomous system number (ASN) for this VPN gateway connection. - Asn *int64 `json:"asn,omitempty"` } func (*VPNGatewayConnectionPeerPatch) isaVPNGatewayConnectionPeerPatch() bool { @@ -90746,11 +88524,6 @@ func UnmarshalVPNGatewayConnectionPeerPatch(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) - if err != nil { - err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -90957,7 +88730,6 @@ func UnmarshalVPNGatewayConnectionPolicyModePeerPrototype(m map[string]json.RawM // VPNGatewayConnectionPrototype : VPNGatewayConnectionPrototype struct // Models which "extend" this model: // - VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype -// - VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype // - VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype type VPNGatewayConnectionPrototype struct { // If set to false, the VPN gateway connection is shut down. @@ -90996,10 +88768,6 @@ type VPNGatewayConnectionPrototype struct { // Routing protocols are disabled for this VPN gateway connection. RoutingProtocol *string `json:"routing_protocol,omitempty"` - - // The VPN tunnel configuration to use for this VPN gateway connection - // (in dynamic route mode). - Tunnels []VPNGatewayConnectionTunnelPrototype `json:"tunnels,omitempty"` } // Constants associated with the VPNGatewayConnectionPrototype.EstablishMode property. @@ -91082,11 +88850,6 @@ func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionTunnelPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "tunnels-error", common.GetComponentInfo()) - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -91095,9 +88858,9 @@ func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result type VPNGatewayConnectionReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The VPN connection's canonical URL. + // The URL for this VPN gateway connection. Href *string `json:"href" validate:"required"` // The unique identifier for this VPN gateway connection. @@ -91119,7 +88882,7 @@ const ( // UnmarshalVPNGatewayConnectionReference unmarshals an instance of VPNGatewayConnectionReference from the specified map of raw messages. func UnmarshalVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VPNGatewayConnectionReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -91148,25 +88911,6 @@ func UnmarshalVPNGatewayConnectionReference(m map[string]json.RawMessage, result return } -// VPNGatewayConnectionReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPNGatewayConnectionReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPNGatewayConnectionReferenceDeleted unmarshals an instance of VPNGatewayConnectionReferenceDeleted from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionReferenceDeleted) - 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 -} - // VPNGatewayConnectionStaticRouteModeLocal : VPNGatewayConnectionStaticRouteModeLocal struct type VPNGatewayConnectionStaticRouteModeLocal struct { // The local IKE identities. @@ -91416,71 +89160,6 @@ func UnmarshalVPNGatewayConnectionStatusReason(m map[string]json.RawMessage, res return } -// VPNGatewayConnectionTunnel : VPNGatewayConnectionTunnel struct -type VPNGatewayConnectionTunnel struct { - // The IP address of the neighbor on the virtual tunnel interface. - NeighborIP *IP `json:"neighbor_ip,omitempty"` - - // The IP address of the virtual tunnel interface. - TunnelInterfaceIP *IP `json:"tunnel_interface_ip,omitempty"` -} - -// UnmarshalVPNGatewayConnectionTunnel unmarshals an instance of VPNGatewayConnectionTunnel from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionTunnel(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionTunnel) - err = core.UnmarshalModel(m, "neighbor_ip", &obj.NeighborIP, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "neighbor_ip-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "tunnel_interface_ip", &obj.TunnelInterfaceIP, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "tunnel_interface_ip-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionTunnelPrototype : VPNGatewayConnectionTunnelPrototype struct -type VPNGatewayConnectionTunnelPrototype struct { - // The IP address of the neighbor on the virtual tunnel interface. - NeighborIP *IP `json:"neighbor_ip" validate:"required"` - - // The IP address of the virtual tunnel interface. - TunnelInterfaceIP *IP `json:"tunnel_interface_ip" validate:"required"` -} - -// NewVPNGatewayConnectionTunnelPrototype : Instantiate VPNGatewayConnectionTunnelPrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionTunnelPrototype(neighborIP *IP, tunnelInterfaceIP *IP) (_model *VPNGatewayConnectionTunnelPrototype, err error) { - _model = &VPNGatewayConnectionTunnelPrototype{ - NeighborIP: neighborIP, - TunnelInterfaceIP: tunnelInterfaceIP, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -// UnmarshalVPNGatewayConnectionTunnelPrototype unmarshals an instance of VPNGatewayConnectionTunnelPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionTunnelPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionTunnelPrototype) - err = core.UnmarshalModel(m, "neighbor_ip", &obj.NeighborIP, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "neighbor_ip-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "tunnel_interface_ip", &obj.TunnelInterfaceIP, UnmarshalIP) - if err != nil { - err = core.SDKErrorf(err, "", "tunnel_interface_ip-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VPNGatewayConnectionTunnelStatusReason : VPNGatewayConnectionTunnelStatusReason struct type VPNGatewayConnectionTunnelStatusReason struct { // A reason code for this status: @@ -91567,7 +89246,6 @@ type VPNGatewayHealthReason struct { // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's // subnet) - // - `transit_gateway_connection_down`: Connection to transit gateway is down // - `internal_error`: Internal error (contact IBM support) // // The enumerated values for this property may @@ -91586,16 +89264,14 @@ type VPNGatewayHealthReason struct { // - `cannot_create_vpc_route`: VPN cannot create route (check for conflict) // - `cannot_reserve_ip_address`: IP address exhaustion (release addresses on the VPN's // subnet) -// - `transit_gateway_connection_down`: Connection to transit gateway is down // - `internal_error`: Internal error (contact IBM support) // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - VPNGatewayHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route" - VPNGatewayHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" - VPNGatewayHealthReasonCodeInternalErrorConst = "internal_error" - VPNGatewayHealthReasonCodeTransitGatewayConnectionDownConst = "transit_gateway_connection_down" + VPNGatewayHealthReasonCodeCannotCreateVPCRouteConst = "cannot_create_vpc_route" + VPNGatewayHealthReasonCodeCannotReserveIPAddressConst = "cannot_reserve_ip_address" + VPNGatewayHealthReasonCodeInternalErrorConst = "internal_error" ) // UnmarshalVPNGatewayHealthReason unmarshals an instance of VPNGatewayHealthReason from the specified map of raw messages. @@ -91889,9 +89565,6 @@ func UnmarshalVPNGatewayMemberLifecycleReason(m map[string]json.RawMessage, resu // VPNGatewayPatch : VPNGatewayPatch struct type VPNGatewayPatch struct { - // The local autonomous system number (ASN) for this VPN gateway and its connections. - LocalAsn *int64 `json:"local_asn,omitempty"` - // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. Name *string `json:"name,omitempty"` } @@ -91899,11 +89572,6 @@ type VPNGatewayPatch struct { // UnmarshalVPNGatewayPatch unmarshals an instance of VPNGatewayPatch from the specified map of raw messages. func UnmarshalVPNGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VPNGatewayPatch) - err = core.UnmarshalPrimitive(m, "local_asn", &obj.LocalAsn) - if err != nil { - err = core.SDKErrorf(err, "", "local_asn-error", common.GetComponentInfo()) - return - } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) @@ -91942,13 +89610,6 @@ type VPNGatewayPrototype struct { // Identifies a subnet by a unique property. Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - // The additional CIDRs advertised through any enabled routing protocol (for example, BGP). The routing protocol will - // advertise routes with these CIDRs and VPC prefixes as route destinations. - AdvertisedCIDRs []string `json:"advertised_cidrs,omitempty"` - - // The local autonomous system number (ASN) for this VPN gateway and its connections. - LocalAsn *int64 `json:"local_asn,omitempty"` - // Route mode VPN gateway. Mode *string `json:"mode,omitempty"` } @@ -91985,16 +89646,6 @@ func UnmarshalVPNGatewayPrototype(m map[string]json.RawMessage, result interface err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "advertised_cidrs", &obj.AdvertisedCIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "advertised_cidrs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "local_asn", &obj.LocalAsn) - if err != nil { - err = core.SDKErrorf(err, "", "local_asn-error", common.GetComponentInfo()) - return - } err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) @@ -92004,205 +89655,6 @@ func UnmarshalVPNGatewayPrototype(m map[string]json.RawMessage, result interface return } -// VPNGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPNGatewayReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPNGatewayReferenceDeleted unmarshals an instance of VPNGatewayReferenceDeleted from the specified map of raw messages. -func UnmarshalVPNGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayReferenceDeleted) - 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 -} - -// VPNRouteReport : VPNRouteReport struct -type VPNRouteReport struct { - // The date and time that this route report was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The unique identifier for this route report. - ID *string `json:"id" validate:"required"` - - // The routes of this report. - Routes []VPNRouteReportRoute `json:"routes" validate:"required"` - - // Route report status. The list of enumerated values for this property may expand in the future. Code and processes - // using this field must tolerate unexpected values. - // - `pending`: generic routing encapsulation tunnel attached - // - `complete`: generic routing encapsulation tunnel detached. - Status *string `json:"status" validate:"required"` - - // The date and time that this route report was updated. - UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` -} - -// Constants associated with the VPNRouteReport.Status property. -// Route report status. The list of enumerated values for this property may expand in the future. Code and processes -// using this field must tolerate unexpected values. -// - `pending`: generic routing encapsulation tunnel attached -// - `complete`: generic routing encapsulation tunnel detached. -const ( - VPNRouteReportStatusCompleteConst = "complete" - VPNRouteReportStatusPendingConst = "pending" -) - -// UnmarshalVPNRouteReport unmarshals an instance of VPNRouteReport from the specified map of raw messages. -func UnmarshalVPNRouteReport(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNRouteReport) - 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, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalVPNRouteReportRoute) - if err != nil { - err = core.SDKErrorf(err, "", "routes-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.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) - if err != nil { - err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNRouteReportCollection : VPNRouteReportCollection struct -type VPNRouteReportCollection struct { - // Collection of VPN gateway route reports. - RouteReports []VPNRouteReport `json:"route_reports" validate:"required"` -} - -// UnmarshalVPNRouteReportCollection unmarshals an instance of VPNRouteReportCollection from the specified map of raw messages. -func UnmarshalVPNRouteReportCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNRouteReportCollection) - err = core.UnmarshalModel(m, "route_reports", &obj.RouteReports, UnmarshalVPNRouteReport) - if err != nil { - err = core.SDKErrorf(err, "", "route_reports-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNRouteReportRoute : VPNRouteReportRoute struct -type VPNRouteReportRoute struct { - // AS path numbers of this route. - AsPath []int64 `json:"as_path" validate:"required"` - - // Indicates whether this route is best path. - BestPath *bool `json:"best_path" validate:"required"` - - // Next hop list of this route. - NextHops []VPNRouteReportRouteNextHop `json:"next_hops" validate:"required"` - - // The peer of this route. - Peer *string `json:"peer" validate:"required"` - - // The destination of this route. - Prefix *string `json:"prefix" validate:"required"` - - // Indicates whether this route is valid. - Valid *bool `json:"valid" validate:"required"` - - // Weight of this route. - Weight *int64 `json:"weight" validate:"required"` -} - -// UnmarshalVPNRouteReportRoute unmarshals an instance of VPNRouteReportRoute from the specified map of raw messages. -func UnmarshalVPNRouteReportRoute(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNRouteReportRoute) - err = core.UnmarshalPrimitive(m, "as_path", &obj.AsPath) - if err != nil { - err = core.SDKErrorf(err, "", "as_path-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "best_path", &obj.BestPath) - if err != nil { - err = core.SDKErrorf(err, "", "best_path-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "next_hops", &obj.NextHops, UnmarshalVPNRouteReportRouteNextHop) - if err != nil { - err = core.SDKErrorf(err, "", "next_hops-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "peer", &obj.Peer) - if err != nil { - err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "prefix", &obj.Prefix) - if err != nil { - err = core.SDKErrorf(err, "", "prefix-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "valid", &obj.Valid) - if err != nil { - err = core.SDKErrorf(err, "", "valid-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) - if err != nil { - err = core.SDKErrorf(err, "", "weight-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNRouteReportRouteNextHop : VPNRouteReportRouteNextHop struct -type VPNRouteReportRouteNextHop struct { - // A unicast IP address, which must not be any of the following values: - // - // - `0.0.0.0` (the sentinel IP address) - // - `224.0.0.0` to `239.255.255.255` (multicast IP addresses) - // - `255.255.255.255` (the broadcast IP address) - // - // 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 next hop is used for traffic forward. - Used *bool `json:"used" validate:"required"` -} - -// UnmarshalVPNRouteReportRouteNextHop unmarshals an instance of VPNRouteReportRouteNextHop from the specified map of raw messages. -func UnmarshalVPNRouteReportRouteNextHop(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNRouteReportRouteNextHop) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "used", &obj.Used) - if err != nil { - err = core.SDKErrorf(err, "", "used-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VPNServer : VPNServer struct type VPNServer struct { // The certificate instance for this VPN server. @@ -93215,25 +90667,6 @@ func (vpnServerPatch *VPNServerPatch) AsPatch() (_patch map[string]interface{}, return } -// VPNServerReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VPNServerReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPNServerReferenceDeleted unmarshals an instance of VPNServerReferenceDeleted from the specified map of raw messages. -func UnmarshalVPNServerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNServerReferenceDeleted) - 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 -} - // VPNServerRoute : VPNServerRoute struct type VPNServerRoute struct { // The action to perform with a packet matching the VPN route: @@ -94249,25 +91682,6 @@ func UnmarshalVirtualNetworkInterfaceReferenceAttachmentContext(m map[string]jso return } -// VirtualNetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VirtualNetworkInterfaceReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVirtualNetworkInterfaceReferenceDeleted unmarshals an instance of VirtualNetworkInterfaceReferenceDeleted from the specified map of raw messages. -func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VirtualNetworkInterfaceReferenceDeleted) - 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 -} - // VirtualNetworkInterfaceTarget : A virtual network interface target. // // The resources supported by this property may @@ -94279,7 +91693,7 @@ func UnmarshalVirtualNetworkInterfaceReferenceDeleted(m map[string]json.RawMessa type VirtualNetworkInterfaceTarget struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this share mount target. Href *string `json:"href,omitempty"` @@ -94311,7 +91725,7 @@ type VirtualNetworkInterfaceTargetIntf interface { // UnmarshalVirtualNetworkInterfaceTarget unmarshals an instance of VirtualNetworkInterfaceTarget from the specified map of raw messages. func UnmarshalVirtualNetworkInterfaceTarget(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VirtualNetworkInterfaceTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -95143,7 +92557,7 @@ func UnmarshalVolumeAttachmentPrototypeVolume(m map[string]json.RawMessage, resu type VolumeAttachmentReferenceInstanceContext struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VolumeAttachmentReferenceInstanceContextDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // Information about how the volume is exposed to the instance operating system. // @@ -95168,7 +92582,7 @@ type VolumeAttachmentReferenceInstanceContext struct { // UnmarshalVolumeAttachmentReferenceInstanceContext unmarshals an instance of VolumeAttachmentReferenceInstanceContext from the specified map of raw messages. func UnmarshalVolumeAttachmentReferenceInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VolumeAttachmentReferenceInstanceContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceInstanceContextDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -95202,25 +92616,6 @@ func UnmarshalVolumeAttachmentReferenceInstanceContext(m map[string]json.RawMess return } -// VolumeAttachmentReferenceInstanceContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VolumeAttachmentReferenceInstanceContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVolumeAttachmentReferenceInstanceContextDeleted unmarshals an instance of VolumeAttachmentReferenceInstanceContextDeleted from the specified map of raw messages. -func UnmarshalVolumeAttachmentReferenceInstanceContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentReferenceInstanceContextDeleted) - 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 -} - // VolumeAttachmentReferenceVolumeContext : VolumeAttachmentReferenceVolumeContext struct type VolumeAttachmentReferenceVolumeContext struct { // Indicates whether deleting the instance will also delete the attached volume. @@ -95228,7 +92623,7 @@ type VolumeAttachmentReferenceVolumeContext struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VolumeAttachmentReferenceVolumeContextDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // Information about how the volume is exposed to the instance operating system. // @@ -95266,7 +92661,7 @@ func UnmarshalVolumeAttachmentReferenceVolumeContext(m map[string]json.RawMessag err = core.SDKErrorf(err, "", "delete_volume_on_instance_delete-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceVolumeContextDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -95305,25 +92700,6 @@ func UnmarshalVolumeAttachmentReferenceVolumeContext(m map[string]json.RawMessag return } -// VolumeAttachmentReferenceVolumeContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VolumeAttachmentReferenceVolumeContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVolumeAttachmentReferenceVolumeContextDeleted unmarshals an instance of VolumeAttachmentReferenceVolumeContextDeleted from the specified map of raw messages. -func UnmarshalVolumeAttachmentReferenceVolumeContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeAttachmentReferenceVolumeContextDeleted) - 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 -} - // VolumeCatalogOffering : VolumeCatalogOffering struct type VolumeCatalogOffering struct { // The billing plan associated with the catalog offering version. @@ -95560,9 +92936,8 @@ type VolumePatch struct { Name *string `json:"name,omitempty"` // The profile to use for this volume. The requested profile must be in the same - // `family` as the current profile. The volume must be attached as a data volume to - // a running virtual server instance, and must have a `capacity` within the range - // supported by the specified profile. + // `family` as the current profile. The volume must have a `capacity` within the + // range supported by the specified profile. Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -96118,7 +93493,7 @@ type VolumeReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this volume. Href *string `json:"href" validate:"required"` @@ -96151,7 +93526,7 @@ func UnmarshalVolumeReference(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -96185,25 +93560,6 @@ func UnmarshalVolumeReference(m map[string]json.RawMessage, result interface{}) return } -// VolumeReferenceDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VolumeReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVolumeReferenceDeleted unmarshals an instance of VolumeReferenceDeleted from the specified map of raw messages. -func UnmarshalVolumeReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeReferenceDeleted) - 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 -} - // VolumeReferenceVolumeAttachmentContext : VolumeReferenceVolumeAttachmentContext struct type VolumeReferenceVolumeAttachmentContext struct { // The CRN for this volume. @@ -96211,7 +93567,7 @@ type VolumeReferenceVolumeAttachmentContext struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VolumeReferenceVolumeAttachmentContextDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this volume. Href *string `json:"href" validate:"required"` @@ -96240,7 +93596,7 @@ func UnmarshalVolumeReferenceVolumeAttachmentContext(m map[string]json.RawMessag err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceVolumeAttachmentContextDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -96269,25 +93625,6 @@ func UnmarshalVolumeReferenceVolumeAttachmentContext(m map[string]json.RawMessag return } -// VolumeReferenceVolumeAttachmentContextDeleted : If present, this property indicates the referenced resource has been deleted, and provides some supplementary -// information. -type VolumeReferenceVolumeAttachmentContextDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVolumeReferenceVolumeAttachmentContextDeleted unmarshals an instance of VolumeReferenceVolumeAttachmentContextDeleted from the specified map of raw messages. -func UnmarshalVolumeReferenceVolumeAttachmentContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VolumeReferenceVolumeAttachmentContextDeleted) - 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 -} - // VolumeRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not // be directly retrievable. type VolumeRemote struct { @@ -96392,6 +93729,11 @@ func UnmarshalVpcdnsResolutionBindingCollectionNext(m map[string]json.RawMessage // Zone : Zone struct type Zone struct { + // The physical data center assigned to this logical zone. + // + // If absent, no physical data center has been assigned. + DataCenter *string `json:"data_center,omitempty"` + // The URL for this zone. Href *string `json:"href" validate:"required"` @@ -96401,21 +93743,49 @@ type Zone struct { // The region this zone resides in. Region *RegionReference `json:"region" validate:"required"` - // The availability status of this zone. + // The status of the zone. + // + // - `available`: The zone is available to create and manage resources. + // - `impaired`: The zone's availability and performance to create and manage resources + // may be impaired. + // - `unavailable`: The zone is unavailable to create and manage resources. + // - `unassigned`: The zone has not been assigned to a physical zone. + // + // 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 [universal name](https://cloud.ibm.com/docs/overview?topic=overview-locations#zone-mapping) for this zone. Will + // be absent if this zone has a `status` of `unassigned`. + UniversalName *string `json:"universal_name,omitempty"` } // Constants associated with the Zone.Status property. -// The availability status of this zone. +// The status of the zone. +// +// - `available`: The zone is available to create and manage resources. +// - `impaired`: The zone's availability and performance to create and manage resources +// may be impaired. +// - `unavailable`: The zone is unavailable to create and manage resources. +// - `unassigned`: The zone has not been assigned to a physical zone. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ZoneStatusAvailableConst = "available" ZoneStatusImpairedConst = "impaired" + ZoneStatusUnassignedConst = "unassigned" ZoneStatusUnavailableConst = "unavailable" ) // UnmarshalZone unmarshals an instance of Zone from the specified map of raw messages. func UnmarshalZone(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(Zone) + err = core.UnmarshalPrimitive(m, "data_center", &obj.DataCenter) + if err != nil { + err = core.SDKErrorf(err, "", "data_center-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -96436,6 +93806,11 @@ func UnmarshalZone(m map[string]json.RawMessage, result interface{}) (err error) err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "universal_name", &obj.UniversalName) + if err != nil { + err = core.SDKErrorf(err, "", "universal_name-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -96529,7 +93904,7 @@ type BackupPolicyJobSourceInstanceReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this virtual server instance. Href *string `json:"href" validate:"required"` @@ -96553,7 +93928,7 @@ func UnmarshalBackupPolicyJobSourceInstanceReference(m map[string]json.RawMessag err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -96585,7 +93960,7 @@ type BackupPolicyJobSourceVolumeReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this volume. Href *string `json:"href" validate:"required"` @@ -96622,7 +93997,7 @@ func UnmarshalBackupPolicyJobSourceVolumeReference(m map[string]json.RawMessage, err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -97362,7 +94737,7 @@ func UnmarshalBackupPolicyScopeEnterpriseReference(m map[string]json.RawMessage, type BareMetalServerBootTargetBareMetalServerDiskReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *BareMetalServerDiskReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this bare metal server disk. Href *string `json:"href" validate:"required"` @@ -97390,7 +94765,7 @@ func (*BareMetalServerBootTargetBareMetalServerDiskReference) isaBareMetalServer // UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference unmarshals an instance of BareMetalServerBootTargetBareMetalServerDiskReference from the specified map of raw messages. func UnmarshalBareMetalServerBootTargetBareMetalServerDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(BareMetalServerBootTargetBareMetalServerDiskReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -102834,7 +100209,7 @@ func UnmarshalFloatingIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[str type FloatingIPTargetBareMetalServerNetworkInterfaceReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *BareMetalServerNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this bare metal server network interface. // @@ -102873,7 +100248,7 @@ func (*FloatingIPTargetBareMetalServerNetworkInterfaceReference) isaFloatingIPTa // UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference unmarshals an instance of FloatingIPTargetBareMetalServerNetworkInterfaceReference from the specified map of raw messages. func UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(FloatingIPTargetBareMetalServerNetworkInterfaceReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -102912,7 +100287,7 @@ func UnmarshalFloatingIPTargetBareMetalServerNetworkInterfaceReference(m map[str type FloatingIPTargetNetworkInterfaceReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance network interface. // @@ -102951,7 +100326,7 @@ func (*FloatingIPTargetNetworkInterfaceReference) isaFloatingIPTarget() bool { // UnmarshalFloatingIPTargetNetworkInterfaceReference unmarshals an instance of FloatingIPTargetNetworkInterfaceReference from the specified map of raw messages. func UnmarshalFloatingIPTargetNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(FloatingIPTargetNetworkInterfaceReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -102993,7 +100368,7 @@ type FloatingIPTargetPublicGatewayReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this public gateway. Href *string `json:"href" validate:"required"` @@ -103026,7 +100401,7 @@ func UnmarshalFloatingIPTargetPublicGatewayReference(m map[string]json.RawMessag err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPublicGatewayReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -103063,7 +100438,7 @@ type FloatingIPTargetVirtualNetworkInterfaceReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VirtualNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this virtual network interface. Href *string `json:"href" validate:"required"` @@ -103102,7 +100477,7 @@ func UnmarshalFloatingIPTargetVirtualNetworkInterfaceReference(m map[string]json err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -103449,7 +100824,7 @@ func UnmarshalFlowLogCollectorTargetPrototypeVirtualNetworkInterfaceIdentity(m m type FlowLogCollectorTargetInstanceNetworkAttachmentReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceNetworkAttachmentReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance network attachment. Href *string `json:"href" validate:"required"` @@ -103487,7 +100862,7 @@ func (*FlowLogCollectorTargetInstanceNetworkAttachmentReference) isaFlowLogColle // UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference unmarshals an instance of FlowLogCollectorTargetInstanceNetworkAttachmentReference from the specified map of raw messages. func UnmarshalFlowLogCollectorTargetInstanceNetworkAttachmentReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(FlowLogCollectorTargetInstanceNetworkAttachmentReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceNetworkAttachmentReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -103539,7 +100914,7 @@ type FlowLogCollectorTargetInstanceReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this virtual server instance. Href *string `json:"href" validate:"required"` @@ -103563,7 +100938,7 @@ func UnmarshalFlowLogCollectorTargetInstanceReference(m map[string]json.RawMessa err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -103592,7 +100967,7 @@ func UnmarshalFlowLogCollectorTargetInstanceReference(m map[string]json.RawMessa type FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance network interface. // @@ -103629,7 +101004,7 @@ func (*FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) isaFlowLogC // UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. func UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -103666,7 +101041,7 @@ type FlowLogCollectorTargetSubnetReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *SubnetReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this subnet. Href *string `json:"href" validate:"required"` @@ -103699,7 +101074,7 @@ func UnmarshalFlowLogCollectorTargetSubnetReference(m map[string]json.RawMessage err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSubnetReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -103736,7 +101111,7 @@ type FlowLogCollectorTargetVPCReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this VPC. Href *string `json:"href" validate:"required"` @@ -103769,7 +101144,7 @@ func UnmarshalFlowLogCollectorTargetVPCReference(m map[string]json.RawMessage, r err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -105057,7 +102432,7 @@ func UnmarshalInstanceGroupManagerScheduled(m map[string]json.RawMessage, result type InstanceGroupManagerScheduledActionManagerAutoScale struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance group manager. Href *string `json:"href" validate:"required"` @@ -105082,7 +102457,7 @@ func (*InstanceGroupManagerScheduledActionManagerAutoScale) isaInstanceGroupMana // UnmarshalInstanceGroupManagerScheduledActionManagerAutoScale unmarshals an instance of InstanceGroupManagerScheduledActionManagerAutoScale from the specified map of raw messages. func UnmarshalInstanceGroupManagerScheduledActionManagerAutoScale(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceGroupManagerScheduledActionManagerAutoScale) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -105722,7 +103097,7 @@ type InstancePlacementTargetDedicatedHostGroupReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this dedicated host group. Href *string `json:"href" validate:"required"` @@ -105755,7 +103130,7 @@ func UnmarshalInstancePlacementTargetDedicatedHostGroupReference(m map[string]js err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -105792,7 +103167,7 @@ type InstancePlacementTargetDedicatedHostReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *DedicatedHostReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this dedicated host. Href *string `json:"href" validate:"required"` @@ -105825,7 +103200,7 @@ func UnmarshalInstancePlacementTargetDedicatedHostReference(m map[string]json.Ra err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -105862,7 +103237,7 @@ type InstancePlacementTargetPlacementGroupReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *PlacementGroupReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this placement group. Href *string `json:"href" validate:"required"` @@ -105895,7 +103270,7 @@ func UnmarshalInstancePlacementTargetPlacementGroupReference(m map[string]json.R err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPlacementGroupReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -110967,7 +108342,7 @@ func UnmarshalLegacyCloudObjectStorageBucketIdentityCloudObjectStorageBucketIden // LoadBalancerIdentityByCRN : LoadBalancerIdentityByCRN struct // This model "extends" LoadBalancerIdentity type LoadBalancerIdentityByCRN struct { - // The load balancer's CRN. + // The CRN for this load balancer. CRN *string `json:"crn" validate:"required"` } @@ -111002,7 +108377,7 @@ func UnmarshalLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result int // LoadBalancerIdentityByHref : LoadBalancerIdentityByHref struct // This model "extends" LoadBalancerIdentity type LoadBalancerIdentityByHref struct { - // The load balancer's canonical URL. + // The URL for this load balancer. Href *string `json:"href" validate:"required"` } @@ -111072,7 +108447,7 @@ func UnmarshalLoadBalancerIdentityByID(m map[string]json.RawMessage, result inte // LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref : LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref struct // This model "extends" LoadBalancerListenerDefaultPoolPatch type LoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByHref struct { - // The pool's canonical URL. + // The URL for this load balancer pool. Href *string `json:"href" validate:"required"` } @@ -111142,7 +108517,7 @@ func UnmarshalLoadBalancerListenerDefaultPoolPatchLoadBalancerPoolIdentityByID(m // LoadBalancerListenerIdentityByHref : LoadBalancerListenerIdentityByHref struct // This model "extends" LoadBalancerListenerIdentity type LoadBalancerListenerIdentityByHref struct { - // The listener's canonical URL. + // The URL for this load balancer listener. Href *string `json:"href" validate:"required"` } @@ -111304,7 +108679,7 @@ type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity struct { // The unique identifier for this load balancer pool. ID *string `json:"id,omitempty"` - // The pool's canonical URL. + // The URL for this load balancer pool. Href *string `json:"href,omitempty"` } @@ -111459,7 +108834,7 @@ type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity struct { // The unique identifier for this load balancer pool. ID *string `json:"id,omitempty"` - // The pool's canonical URL. + // The URL for this load balancer pool. Href *string `json:"href,omitempty"` } @@ -111583,9 +108958,9 @@ func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirect type LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The pool's canonical URL. + // The URL for this load balancer pool. Href *string `json:"href" validate:"required"` // The unique identifier for this load balancer pool. @@ -111602,7 +108977,7 @@ func (*LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) isaLoadBalance // UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerPoolReference from the specified map of raw messages. func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -111629,7 +109004,7 @@ func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference(m map[st // LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct // This model "extends" LoadBalancerPoolIdentity type LoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { - // The pool's canonical URL. + // The URL for this load balancer pool. Href *string `json:"href" validate:"required"` } @@ -111820,7 +109195,7 @@ type LoadBalancerPoolMemberTargetInstanceReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this virtual server instance. Href *string `json:"href" validate:"required"` @@ -111844,7 +109219,7 @@ func UnmarshalLoadBalancerPoolMemberTargetInstanceReference(m map[string]json.Ra err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -114901,7 +112276,7 @@ func UnmarshalReservedIPTargetPrototypeVirtualNetworkInterfaceIdentity(m map[str type ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this bare metal server network interface. // @@ -114938,7 +112313,7 @@ func (*ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) is // UnmarshalReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext from the specified map of raw messages. func UnmarshalReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ReservedIPTargetBareMetalServerNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -114975,7 +112350,7 @@ type ReservedIPTargetEndpointGatewayReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this endpoint gateway. Href *string `json:"href" validate:"required"` @@ -115008,7 +112383,7 @@ func UnmarshalReservedIPTargetEndpointGatewayReference(m map[string]json.RawMess err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -115045,7 +112420,7 @@ type ReservedIPTargetGenericResourceReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *GenericResourceReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` @@ -115069,7 +112444,7 @@ func UnmarshalReservedIPTargetGenericResourceReference(m map[string]json.RawMess err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalGenericResourceReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -115086,14 +112461,14 @@ func UnmarshalReservedIPTargetGenericResourceReference(m map[string]json.RawMess // ReservedIPTargetLoadBalancerReference : ReservedIPTargetLoadBalancerReference struct // This model "extends" ReservedIPTarget type ReservedIPTargetLoadBalancerReference struct { - // The load balancer's CRN. + // The CRN for this load balancer. CRN *string `json:"crn" validate:"required"` // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The load balancer's canonical URL. + // The URL for this load balancer. Href *string `json:"href" validate:"required"` // The unique identifier for this load balancer. @@ -115124,7 +112499,7 @@ func UnmarshalReservedIPTargetLoadBalancerReference(m map[string]json.RawMessage err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -115158,7 +112533,7 @@ func UnmarshalReservedIPTargetLoadBalancerReference(m map[string]json.RawMessage type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance network interface. // @@ -115195,7 +112570,7 @@ func (*ReservedIPTargetNetworkInterfaceReferenceTargetContext) isaReservedIPTarg // UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ReservedIPTargetNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -115227,14 +112602,14 @@ func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[strin // ReservedIPTargetVPNGatewayReference : ReservedIPTargetVPNGatewayReference struct // This model "extends" ReservedIPTarget type ReservedIPTargetVPNGatewayReference struct { - // The VPN gateway's CRN. + // The CRN for this VPN gateway. CRN *string `json:"crn" validate:"required"` // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The VPN gateway's canonical URL. + // The URL for this VPN gateway. Href *string `json:"href" validate:"required"` // The unique identifier for this VPN gateway. @@ -115265,7 +112640,7 @@ func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -115302,7 +112677,7 @@ type ReservedIPTargetVPNServerReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this VPN server. Href *string `json:"href" validate:"required"` @@ -115335,7 +112710,7 @@ func UnmarshalReservedIPTargetVPNServerReference(m map[string]json.RawMessage, r err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -115463,14 +112838,14 @@ func UnmarshalResourceGroupIdentityByID(m map[string]json.RawMessage, result int // RouteCreatorVPNGatewayReference : RouteCreatorVPNGatewayReference struct // This model "extends" RouteCreator type RouteCreatorVPNGatewayReference struct { - // The VPN gateway's CRN. + // The CRN for this VPN gateway. CRN *string `json:"crn" validate:"required"` // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The VPN gateway's canonical URL. + // The URL for this VPN gateway. Href *string `json:"href" validate:"required"` // The unique identifier for this VPN gateway. @@ -115501,7 +112876,7 @@ func UnmarshalRouteCreatorVPNGatewayReference(m map[string]json.RawMessage, resu err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -115538,7 +112913,7 @@ type RouteCreatorVPNServerReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this VPN server. Href *string `json:"href" validate:"required"` @@ -115571,7 +112946,7 @@ func UnmarshalRouteCreatorVPNServerReference(m map[string]json.RawMessage, resul err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -115673,7 +113048,7 @@ type RouteNextHopPatchVPNGatewayConnectionIdentity struct { // The unique identifier for this VPN gateway connection. ID *string `json:"id,omitempty"` - // The VPN connection's canonical URL. + // The URL for this VPN gateway connection. Href *string `json:"href,omitempty"` } @@ -115707,14 +113082,95 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentity(m map[string]json.Ra return } +// RouteNextHopPrototypeRouteNextHopIP : RouteNextHopPrototypeRouteNextHopIP struct +// Models which "extend" this model: +// - RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP +// - RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP +// This model "extends" RouteNextHopPrototype +type RouteNextHopPrototypeRouteNextHopIP struct { + // The sentinel IP address (`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,omitempty"` +} + +func (*RouteNextHopPrototypeRouteNextHopIP) isaRouteNextHopPrototypeRouteNextHopIP() bool { + return true +} + +type RouteNextHopPrototypeRouteNextHopIPIntf interface { + RouteNextHopPrototypeIntf + isaRouteNextHopPrototypeRouteNextHopIP() bool +} + +func (*RouteNextHopPrototypeRouteNextHopIP) isaRouteNextHopPrototype() bool { + return true +} + +// UnmarshalRouteNextHopPrototypeRouteNextHopIP unmarshals an instance of RouteNextHopPrototypeRouteNextHopIP from the specified map of raw messages. +func UnmarshalRouteNextHopPrototypeRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPrototypeRouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPrototypeVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. +// Models which "extend" this model: +// - RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID +// - RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref +// This model "extends" RouteNextHopPrototype +type RouteNextHopPrototypeVPNGatewayConnectionIdentity struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The URL for this VPN gateway connection. + Href *string `json:"href,omitempty"` +} + +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +type RouteNextHopPrototypeVPNGatewayConnectionIdentityIntf interface { + RouteNextHopPrototypeIntf + isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool +} + +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRouteNextHopPrototype() bool { + return true +} + +// UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentity unmarshals an instance of RouteNextHopPrototypeVPNGatewayConnectionIdentity from the specified map of raw messages. +func UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPrototypeVPNGatewayConnectionIdentity) + 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 +} + // RouteNextHopVPNGatewayConnectionReference : RouteNextHopVPNGatewayConnectionReference struct // This model "extends" RouteNextHop type RouteNextHopVPNGatewayConnectionReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The VPN connection's canonical URL. + // The URL for this VPN gateway connection. Href *string `json:"href" validate:"required"` // The unique identifier for this VPN gateway connection. @@ -115740,7 +113196,7 @@ func (*RouteNextHopVPNGatewayConnectionReference) isaRouteNextHop() bool { // UnmarshalRouteNextHopVPNGatewayConnectionReference unmarshals an instance of RouteNextHopVPNGatewayConnectionReference from the specified map of raw messages. func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(RouteNextHopVPNGatewayConnectionReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -115769,87 +113225,6 @@ func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMes return } -// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct -// Models which "extend" this model: -// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP -// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP -// This model "extends" RoutePrototypeNextHop -type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct { - // The sentinel IP address (`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,omitempty"` -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { - return true -} - -type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPIntf interface { - RoutePrototypeNextHopIntf - isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHop() bool { - return true -} - -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. -// Models which "extend" this model: -// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID -// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref -// This model "extends" RoutePrototypeNextHop -type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity struct { - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { - return true -} - -type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityIntf interface { - RoutePrototypeNextHopIntf - isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool -} - -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHop() bool { - return true -} - -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) - 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 -} - // RoutingTableIdentityByHref : RoutingTableIdentityByHref struct // This model "extends" RoutingTableIdentity type RoutingTableIdentityByHref struct { @@ -115923,7 +113298,7 @@ func UnmarshalRoutingTableIdentityByID(m map[string]json.RawMessage, result inte // SecurityGroupIdentityByCRN : SecurityGroupIdentityByCRN struct // This model "extends" SecurityGroupIdentity type SecurityGroupIdentityByCRN struct { - // The security group's CRN. + // The CRN for this security group. CRN *string `json:"crn" validate:"required"` } @@ -115958,7 +113333,7 @@ func UnmarshalSecurityGroupIdentityByCRN(m map[string]json.RawMessage, result in // SecurityGroupIdentityByHref : SecurityGroupIdentityByHref struct // This model "extends" SecurityGroupIdentity type SecurityGroupIdentityByHref struct { - // The security group's canonical URL. + // The URL for this security group. Href *string `json:"href" validate:"required"` } @@ -116673,10 +114048,10 @@ type SecurityGroupRuleRemotePatchSecurityGroupIdentity struct { // The unique identifier for this security group. ID *string `json:"id,omitempty"` - // The security group's CRN. + // The CRN for this security group. CRN *string `json:"crn,omitempty"` - // The security group's canonical URL. + // The URL for this security group. Href *string `json:"href,omitempty"` } @@ -116801,10 +114176,10 @@ type SecurityGroupRuleRemotePrototypeSecurityGroupIdentity struct { // The unique identifier for this security group. ID *string `json:"id,omitempty"` - // The security group's CRN. + // The CRN for this security group. CRN *string `json:"crn,omitempty"` - // The security group's canonical URL. + // The URL for this security group. Href *string `json:"href,omitempty"` } @@ -116898,14 +114273,14 @@ func UnmarshalSecurityGroupRuleRemoteIP(m map[string]json.RawMessage, result int // SecurityGroupRuleRemoteSecurityGroupReference : SecurityGroupRuleRemoteSecurityGroupReference struct // This model "extends" SecurityGroupRuleRemote type SecurityGroupRuleRemoteSecurityGroupReference struct { - // The security group's CRN. + // The CRN for this security group. CRN *string `json:"crn" validate:"required"` // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The security group's canonical URL. + // The URL for this security group. Href *string `json:"href" validate:"required"` // The unique identifier for this security group. @@ -116927,7 +114302,7 @@ func UnmarshalSecurityGroupRuleRemoteSecurityGroupReference(m map[string]json.Ra err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -117280,7 +114655,7 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json type SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *BareMetalServerNetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this bare metal server network interface. // @@ -117317,7 +114692,7 @@ func (*SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTarge // UnmarshalSecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext from the specified map of raw messages. func UnmarshalSecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SecurityGroupTargetReferenceBareMetalServerNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerNetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -117354,7 +114729,7 @@ type SecurityGroupTargetReferenceEndpointGatewayReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this endpoint gateway. Href *string `json:"href" validate:"required"` @@ -117387,7 +114762,7 @@ func UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference(m map[string] err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -117419,14 +114794,14 @@ func UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference(m map[string] // SecurityGroupTargetReferenceLoadBalancerReference : SecurityGroupTargetReferenceLoadBalancerReference struct // This model "extends" SecurityGroupTargetReference type SecurityGroupTargetReferenceLoadBalancerReference struct { - // The load balancer's CRN. + // The CRN for this load balancer. CRN *string `json:"crn" validate:"required"` // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` - // The load balancer's canonical URL. + // The URL for this load balancer. Href *string `json:"href" validate:"required"` // The unique identifier for this load balancer. @@ -117457,7 +114832,7 @@ func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]jso err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -117491,7 +114866,7 @@ func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]jso type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this instance network interface. // @@ -117528,7 +114903,7 @@ func (*SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) isaSe // UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext from the specified map of raw messages. func UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -117565,7 +114940,7 @@ type SecurityGroupTargetReferenceVPNServerReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this VPN server. Href *string `json:"href" validate:"required"` @@ -117598,7 +114973,7 @@ func UnmarshalSecurityGroupTargetReferenceVPNServerReference(m map[string]json.R err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -117635,7 +115010,7 @@ type SecurityGroupTargetReferenceVirtualNetworkInterfaceReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *VirtualNetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this virtual network interface. Href *string `json:"href" validate:"required"` @@ -117674,7 +115049,7 @@ func UnmarshalSecurityGroupTargetReferenceVirtualNetworkInterfaceReference(m map err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVirtualNetworkInterfaceReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -117721,7 +115096,7 @@ type ShareAccessorBindingAccessorShareReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *ShareReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this file share. Href *string `json:"href" validate:"required"` @@ -117758,7 +115133,7 @@ func UnmarshalShareAccessorBindingAccessorShareReference(m map[string]json.RawMe err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -118914,8 +116289,8 @@ type SharePrototypeShareBySize struct { // The maximum size for a share may increase in the future. Size *int64 `json:"size" validate:"required"` - // The zone this file share will reside in. For a replica share, this must be a different - // zone in the same region as the source share. + // The zone this file share will reside in. For a replica share in the same region as + // the source share, this must be a different zone from the source share. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } @@ -119088,8 +116463,8 @@ type SharePrototypeShareBySourceShare struct { // region](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-replication). SourceShare ShareIdentityIntf `json:"source_share" validate:"required"` - // The zone this file share will reside in. For a replica share, this must be a different - // zone in the same region as the source share. + // The zone this file share will reside in. For a replica share in the same region as + // the source share, this must be a different zone from the source share. Zone ZoneIdentityIntf `json:"zone" validate:"required"` } @@ -120527,226 +117902,6 @@ func UnmarshalVPCIdentityByID(m map[string]json.RawMessage, result interface{}) return } -// VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress struct -// This model "extends" VPNGatewayConnectionDynamicRouteModePeerPrototype -type VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress struct { - // The peer autonomous system number (ASN) for this VPN gateway connection. - Asn *int64 `json:"asn" validate:"required"` - - // The peer IKE identity to use. - // - // If unspecified: - // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. - // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. - IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` - - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address" validate:"required"` -} - -// NewVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress : Instantiate VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress(asn int64, address string) (_model *VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress, err error) { - _model = &VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress{ - Asn: core.Int64Ptr(asn), - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionDynamicRouteModePeerPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByAddress) - err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) - if err != nil { - err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct -// This model "extends" VPNGatewayConnectionDynamicRouteModePeerPrototype -type VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn struct { - // The peer autonomous system number (ASN) for this VPN gateway connection. - Asn *int64 `json:"asn" validate:"required"` - - // The peer IKE identity to use. - // - // If unspecified: - // - If `peer.address` is specified, the `type` will be `ipv4_address`, and the `value` will be `peer.address`. - // - If `peer.fqdn` is specified, the `type` will be `fqdn`, and the `value` will be `peer.fqdn`. - IkeIdentity VPNGatewayConnectionIkeIdentityPrototypeIntf `json:"ike_identity,omitempty"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn" validate:"required"` -} - -// NewVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn : Instantiate VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn(asn int64, fqdn string) (_model *VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn, err error) { - _model = &VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn{ - Asn: core.Int64Ptr(asn), - Fqdn: core.StringPtr(fqdn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionDynamicRouteModePeerPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDynamicRouteModePeerPrototypeVPNGatewayConnectionPeerByFqdn) - err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) - if err != nil { - err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentityPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress : VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress struct -// This model "extends" VPNGatewayConnectionDynamicRouteModePeer -type VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress struct { - // The peer autonomous system number (ASN) for this VPN gateway connection. - Asn *int64 `json:"asn" validate:"required"` - - // The peer IKE identity. - IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` - - // Indicates whether `peer.address` or `peer.fqdn` is used. - Type *string `json:"type" validate:"required"` - - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress.Type property. -// Indicates whether `peer.address` or `peer.fqdn` is used. -const ( - VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddressTypeAddressConst = "address" - VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddressTypeFqdnConst = "fqdn" -) - -func (*VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress) isaVPNGatewayConnectionDynamicRouteModePeer() bool { - return true -} - -// UnmarshalVPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress unmarshals an instance of VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByAddress) - err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) - if err != nil { - err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-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, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn : VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn struct -// This model "extends" VPNGatewayConnectionDynamicRouteModePeer -type VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn struct { - // The peer autonomous system number (ASN) for this VPN gateway connection. - Asn *int64 `json:"asn" validate:"required"` - - // The peer IKE identity. - IkeIdentity VPNGatewayConnectionIkeIdentityIntf `json:"ike_identity" validate:"required"` - - // Indicates whether `peer.address` or `peer.fqdn` is used. - Type *string `json:"type" validate:"required"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn.Type property. -// Indicates whether `peer.address` or `peer.fqdn` is used. -const ( - VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdnTypeAddressConst = "address" - VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdnTypeFqdnConst = "fqdn" -) - -func (*VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn) isaVPNGatewayConnectionDynamicRouteModePeer() bool { - return true -} - -// UnmarshalVPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn unmarshals an instance of VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDynamicRouteModePeerVPNGatewayConnectionPeerByFqdn) - err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) - if err != nil { - err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_identity", &obj.IkeIdentity, UnmarshalVPNGatewayConnectionIkeIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "ike_identity-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, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn : VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn struct // This model "extends" VPNGatewayConnectionIkeIdentityPrototype type VPNGatewayConnectionIkeIdentityPrototypeVPNGatewayConnectionIkeIdentityFqdn struct { @@ -121146,7 +118301,7 @@ func UnmarshalVPNGatewayConnectionIkeIdentityVPNGatewayConnectionIkeIdentityKeyI // VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref : VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref struct // This model "extends" VPNGatewayConnectionIkePolicyPatch type VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref struct { - // The IKE policy's canonical URL. + // The URL for this IKE policy. Href *string `json:"href" validate:"required"` } @@ -121216,7 +118371,7 @@ func UnmarshalVPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID(m map[stri // VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref : VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref struct // This model "extends" VPNGatewayConnectionIkePolicyPrototype type VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref struct { - // The IKE policy's canonical URL. + // The URL for this IKE policy. Href *string `json:"href" validate:"required"` } @@ -121286,7 +118441,7 @@ func UnmarshalVPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID(m map[ // VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref : VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref struct // This model "extends" VPNGatewayConnectionIPsecPolicyPatch type VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref struct { - // The IPsec policy's canonical URL. + // The URL for this IPsec policy. Href *string `json:"href" validate:"required"` } @@ -121356,7 +118511,7 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID(m map[ // VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref : VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref struct // This model "extends" VPNGatewayConnectionIPsecPolicyPrototype type VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref struct { - // The IPsec policy's canonical URL. + // The URL for this IPsec policy. Href *string `json:"href" validate:"required"` } @@ -121423,58 +118578,6 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID(m return } -// VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch : 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: -// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch -// - VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch -// This model "extends" VPNGatewayConnectionPeerPatch -type VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch struct { - // The peer autonomous system number (ASN) for this VPN gateway connection. - Asn *int64 `json:"asn,omitempty"` - - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address,omitempty"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn,omitempty"` -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch() bool { - return true -} - -type VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchIntf interface { - VPNGatewayConnectionPeerPatchIntf - isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch() bool -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch) isaVPNGatewayConnectionPeerPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch) - err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) - if err != nil { - err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch : 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: @@ -121586,7 +118689,7 @@ type VPNGatewayConnectionPolicyMode struct { // connection will be brought down after its lifetime expires. EstablishMode *string `json:"establish_mode" validate:"required"` - // The VPN connection's canonical URL. + // The URL for this VPN gateway connection. Href *string `json:"href" validate:"required"` // The unique identifier for this VPN gateway connection. @@ -121978,146 +119081,6 @@ func UnmarshalVPNGatewayConnectionPolicyModePeerVPNGatewayConnectionPeerByFqdn(m return } -// VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype struct -// This model "extends" VPNGatewayConnectionPrototype -type VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up,omitempty"` - - DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` - - // The establish mode of the VPN gateway connection: - // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol - // negotiations or rekeying processes. - // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway - // connection. Additionally, the peer is responsible for initiating the rekeying process - // after the connection is established. If rekeying does not occur, the VPN gateway - // connection will be brought down after its lifetime expires. - EstablishMode *string `json:"establish_mode,omitempty"` - - IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` - - IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` - - // The name for this VPN gateway connection. The name must not be used by another connection for the VPN gateway. If - // unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - Local *VPNGatewayConnectionDynamicRouteModeLocalPrototype `json:"local,omitempty"` - - Peer VPNGatewayConnectionDynamicRouteModePeerPrototypeIntf `json:"peer" validate:"required"` - - // The enabled routing protocol for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol" validate:"required"` - - // The VPN tunnel configuration to use for this VPN gateway connection - // (in dynamic route mode). - Tunnels []VPNGatewayConnectionTunnelPrototype `json:"tunnels" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype.EstablishMode property. -// The establish mode of the VPN gateway connection: -// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol -// negotiations or rekeying processes. -// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway -// connection. Additionally, the peer is responsible for initiating the rekeying process -// after the connection is established. If rekeying does not occur, the VPN gateway -// connection will be brought down after its lifetime expires. -const ( - VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototypeEstablishModeBidirectionalConst = "bidirectional" - VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototypeEstablishModePeerOnlyConst = "peer_only" -) - -// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype.RoutingProtocol property. -// The enabled routing protocol for this VPN gateway connection. -const ( - VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototypeRoutingProtocolBgpConst = "bgp" -) - -// NewVPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype(psk string, peer VPNGatewayConnectionDynamicRouteModePeerPrototypeIntf, routingProtocol string, tunnels []VPNGatewayConnectionTunnelPrototype) (_model *VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype, err error) { - _model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype{ - Psk: core.StringPtr(psk), - Peer: peer, - RoutingProtocol: core.StringPtr(routingProtocol), - Tunnels: tunnels, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype) isaVPNGatewayConnectionPrototype() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype unmarshals an instance of VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionDynamicRouteModePrototype) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) - if err != nil { - err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "ipsec_policy-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, "psk", &obj.Psk) - if err != nil { - err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionDynamicRouteModeLocalPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionDynamicRouteModePeerPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionTunnelPrototype) - if err != nil { - err = core.SDKErrorf(err, "", "tunnels-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct // This model "extends" VPNGatewayConnectionPrototype type VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct { @@ -122366,7 +119329,6 @@ func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePr // VPNGatewayConnectionRouteMode : VPNGatewayConnectionRouteMode struct // Models which "extend" this model: // - VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode -// - VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode // This model "extends" VPNGatewayConnection type VPNGatewayConnectionRouteMode struct { // If set to false, the VPN gateway connection is shut down. @@ -122389,7 +119351,7 @@ type VPNGatewayConnectionRouteMode struct { // connection will be brought down after its lifetime expires. EstablishMode *string `json:"establish_mode" validate:"required"` - // The VPN connection's canonical URL. + // The URL for this VPN gateway connection. Href *string `json:"href" validate:"required"` // The unique identifier for this VPN gateway connection. @@ -122504,12 +119466,7 @@ func UnmarshalVPNGatewayConnectionRouteMode(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "required discriminator property 'routing_protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } - if discValue == "bgp" { - err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode-error", common.GetComponentInfo()) - } - } else if discValue == "none" { + if discValue == "none" { err = core.UnmarshalModel(m, "", result, UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode-error", common.GetComponentInfo()) @@ -122716,7 +119673,7 @@ type VPNGatewayPolicyMode struct { // The date and time that this VPN gateway was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The VPN gateway's CRN. + // The CRN for this VPN gateway. CRN *string `json:"crn" validate:"required"` // The reasons for the current `health_state` (if any). @@ -122731,7 +119688,7 @@ type VPNGatewayPolicyMode struct { // health state of `inapplicable`. A `pending` resource may also have this state. HealthState *string `json:"health_state" validate:"required"` - // The VPN gateway's canonical URL. + // The URL for this VPN gateway. Href *string `json:"href" validate:"required"` // The unique identifier for this VPN gateway. @@ -122885,353 +119842,319 @@ func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interfac err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayPrototypeVPNGatewayPolicyModePrototype : VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct -// This model "extends" VPNGatewayPrototype -type VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct { - // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - - // Policy mode VPN gateway. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the VPNGatewayPrototypeVPNGatewayPolicyModePrototype.Mode property. -// Policy mode VPN gateway. -const ( - VPNGatewayPrototypeVPNGatewayPolicyModePrototypeModePolicyConst = "policy" -) - -// NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayPolicyModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayPolicyModePrototype, err error) { - _model = &VPNGatewayPrototypeVPNGatewayPolicyModePrototype{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayPrototypeVPNGatewayPolicyModePrototype) isaVPNGatewayPrototype() bool { - return true -} - -// UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayPolicyModePrototype from the specified map of raw messages. -func UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPrototypeVPNGatewayPolicyModePrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayPrototypeVPNGatewayRouteModePrototype : VPNGatewayPrototypeVPNGatewayRouteModePrototype struct -// This model "extends" VPNGatewayPrototype -type VPNGatewayPrototypeVPNGatewayRouteModePrototype struct { - // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name - // will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` - - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - - // The additional CIDRs advertised through any enabled routing protocol (for example, BGP). The routing protocol will - // advertise routes with these CIDRs and VPC prefixes as route destinations. - AdvertisedCIDRs []string `json:"advertised_cidrs,omitempty"` - - // The local autonomous system number (ASN) for this VPN gateway and its connections. - LocalAsn *int64 `json:"local_asn,omitempty"` - - // Route mode VPN gateway. - Mode *string `json:"mode,omitempty"` -} - -// Constants associated with the VPNGatewayPrototypeVPNGatewayRouteModePrototype.Mode property. -// Route mode VPN gateway. -const ( - VPNGatewayPrototypeVPNGatewayRouteModePrototypeModeRouteConst = "route" -) - -// NewVPNGatewayPrototypeVPNGatewayRouteModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayRouteModePrototype (Generic Model Constructor) -func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayRouteModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayRouteModePrototype, err error) { - _model = &VPNGatewayPrototypeVPNGatewayRouteModePrototype{ - Subnet: subnet, - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*VPNGatewayPrototypeVPNGatewayRouteModePrototype) isaVPNGatewayPrototype() bool { - return true -} - -// UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayRouteModePrototype from the specified map of raw messages. -func UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPrototypeVPNGatewayRouteModePrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "advertised_cidrs", &obj.AdvertisedCIDRs) - if err != nil { - err = core.SDKErrorf(err, "", "advertised_cidrs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "local_asn", &obj.LocalAsn) - if err != nil { - err = core.SDKErrorf(err, "", "local_asn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayRouteMode : VPNGatewayRouteMode struct -// This model "extends" VPNGateway -type VPNGatewayRouteMode struct { - // Connections for this VPN gateway. - Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` - - // The date and time that this VPN gateway was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` - - // The reasons for the current `health_state` (if any). - HealthReasons []VPNGatewayHealthReason `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 VPN gateway's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway. - ID *string `json:"id" validate:"required"` - - // The reasons for the current `lifecycle_state` (if any). - LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` - - // The lifecycle state of the VPN gateway. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - - // Collection of VPN gateway members. - Members []VPNGatewayMember `json:"members" validate:"required"` - - // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. - Name *string `json:"name" validate:"required"` - - // The resource group for this VPN gateway. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The VPC this VPN gateway resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // The additional CIDRs advertised through any enabled routing protocol (for example, BGP). The routing protocol will - // advertise routes with these CIDRs and VPC prefixes as route destinations. - AdvertisedCIDRs []string `json:"advertised_cidrs" validate:"required"` - - // The local autonomous system number (ASN) for this VPN gateway and its connections. - LocalAsn *int64 `json:"local_asn" validate:"required"` - - // Route mode VPN gateway. - Mode *string `json:"mode" validate:"required"` -} - -// Constants associated with the VPNGatewayRouteMode.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 ( - VPNGatewayRouteModeHealthStateDegradedConst = "degraded" - VPNGatewayRouteModeHealthStateFaultedConst = "faulted" - VPNGatewayRouteModeHealthStateInapplicableConst = "inapplicable" - VPNGatewayRouteModeHealthStateOkConst = "ok" -) - -// Constants associated with the VPNGatewayRouteMode.LifecycleState property. -// The lifecycle state of the VPN gateway. -const ( - VPNGatewayRouteModeLifecycleStateDeletingConst = "deleting" - VPNGatewayRouteModeLifecycleStateFailedConst = "failed" - VPNGatewayRouteModeLifecycleStatePendingConst = "pending" - VPNGatewayRouteModeLifecycleStateStableConst = "stable" - VPNGatewayRouteModeLifecycleStateSuspendedConst = "suspended" - VPNGatewayRouteModeLifecycleStateUpdatingConst = "updating" - VPNGatewayRouteModeLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the VPNGatewayRouteMode.ResourceType property. -// The resource type. -const ( - VPNGatewayRouteModeResourceTypeVPNGatewayConst = "vpn_gateway" -) - -// Constants associated with the VPNGatewayRouteMode.Mode property. -// Route mode VPN gateway. -const ( - VPNGatewayRouteModeModeRouteConst = "route" -) - -func (*VPNGatewayRouteMode) isaVPNGateway() bool { - return true -} - -// UnmarshalVPNGatewayRouteMode unmarshals an instance of VPNGatewayRouteMode from the specified map of raw messages. -func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayRouteMode) - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) - if err != nil { - err = core.SDKErrorf(err, "", "connections-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, "crn", &obj.CRN) - if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) - 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) - 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.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) - if err != nil { - err = core.SDKErrorf(err, "", "members-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, "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, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - err = core.SDKErrorf(err, "", "subnet-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.UnmarshalPrimitive(m, "advertised_cidrs", &obj.AdvertisedCIDRs) + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { - err = core.SDKErrorf(err, "", "advertised_cidrs-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "local_asn", &obj.LocalAsn) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPrototypeVPNGatewayPolicyModePrototype : VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct +// This model "extends" VPNGatewayPrototype +type VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct { + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Policy mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototypeVPNGatewayPolicyModePrototype.Mode property. +// Policy mode VPN gateway. +const ( + VPNGatewayPrototypeVPNGatewayPolicyModePrototypeModePolicyConst = "policy" +) + +// NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayPolicyModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayPolicyModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayPolicyModePrototype, err error) { + _model = &VPNGatewayPrototypeVPNGatewayPolicyModePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "local_asn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayPrototypeVPNGatewayPolicyModePrototype) isaVPNGatewayPrototype() bool { + return true +} + +// UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayPolicyModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototypeVPNGatewayPolicyModePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPrototypeVPNGatewayRouteModePrototype : VPNGatewayPrototypeVPNGatewayRouteModePrototype struct +// This model "extends" VPNGatewayPrototype +type VPNGatewayPrototypeVPNGatewayRouteModePrototype struct { + // The name for this VPN gateway. The name must not be used by another VPN gateway in the VPC. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototypeVPNGatewayRouteModePrototype.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayPrototypeVPNGatewayRouteModePrototypeModeRouteConst = "route" +) + +// NewVPNGatewayPrototypeVPNGatewayRouteModePrototype : Instantiate VPNGatewayPrototypeVPNGatewayRouteModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayPrototypeVPNGatewayRouteModePrototype(subnet SubnetIdentityIntf) (_model *VPNGatewayPrototypeVPNGatewayRouteModePrototype, err error) { + _model = &VPNGatewayPrototypeVPNGatewayRouteModePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*VPNGatewayPrototypeVPNGatewayRouteModePrototype) isaVPNGatewayPrototype() bool { + return true +} + +// UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayRouteModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototypeVPNGatewayRouteModePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-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, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayRouteMode : VPNGatewayRouteMode struct +// This model "extends" VPNGateway +type VPNGatewayRouteMode struct { + // Connections for this VPN gateway. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this VPN gateway. + CRN *string `json:"crn" validate:"required"` + + // The reasons for the current `health_state` (if any). + HealthReasons []VPNGatewayHealthReason `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 VPN gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []VPNGatewayLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of the VPN gateway. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPN gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The VPC this VPN gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode" validate:"required"` +} + +// Constants associated with the VPNGatewayRouteMode.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 ( + VPNGatewayRouteModeHealthStateDegradedConst = "degraded" + VPNGatewayRouteModeHealthStateFaultedConst = "faulted" + VPNGatewayRouteModeHealthStateInapplicableConst = "inapplicable" + VPNGatewayRouteModeHealthStateOkConst = "ok" +) + +// Constants associated with the VPNGatewayRouteMode.LifecycleState property. +// The lifecycle state of the VPN gateway. +const ( + VPNGatewayRouteModeLifecycleStateDeletingConst = "deleting" + VPNGatewayRouteModeLifecycleStateFailedConst = "failed" + VPNGatewayRouteModeLifecycleStatePendingConst = "pending" + VPNGatewayRouteModeLifecycleStateStableConst = "stable" + VPNGatewayRouteModeLifecycleStateSuspendedConst = "suspended" + VPNGatewayRouteModeLifecycleStateUpdatingConst = "updating" + VPNGatewayRouteModeLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNGatewayRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayRouteModeResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGatewayRouteMode.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayRouteModeModeRouteConst = "route" +) + +func (*VPNGatewayRouteMode) isaVPNGateway() bool { + return true +} + +// UnmarshalVPNGatewayRouteMode unmarshals an instance of VPNGatewayRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayRouteMode) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + err = core.SDKErrorf(err, "", "connections-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, "crn", &obj.CRN) + if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalVPNGatewayHealthReason) + 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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalVPNGatewayLifecycleReason) + 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.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + err = core.SDKErrorf(err, "", "members-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, "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, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + err = core.SDKErrorf(err, "", "subnet-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.UnmarshalPrimitive(m, "mode", &obj.Mode) @@ -123774,7 +120697,7 @@ func UnmarshalVirtualNetworkInterfaceTargetInstanceNetworkAttachmentReferenceVir type VirtualNetworkInterfaceTargetShareMountTargetReference struct { // If present, this property indicates the referenced resource has been deleted, and provides // some supplementary information. - Deleted *ShareMountTargetReferenceDeleted `json:"deleted,omitempty"` + Deleted *Deleted `json:"deleted,omitempty"` // The URL for this share mount target. Href *string `json:"href" validate:"required"` @@ -123802,7 +120725,7 @@ func (*VirtualNetworkInterfaceTargetShareMountTargetReference) isaVirtualNetwork // UnmarshalVirtualNetworkInterfaceTargetShareMountTargetReference unmarshals an instance of VirtualNetworkInterfaceTargetShareMountTargetReference from the specified map of raw messages. func UnmarshalVirtualNetworkInterfaceTargetShareMountTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VirtualNetworkInterfaceTargetShareMountTargetReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalShareMountTargetReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) return @@ -131930,7 +128853,7 @@ func UnmarshalInstanceTemplateInstanceBySourceSnapshotInstanceTemplateContextIns // LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct // This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { - // The pool's canonical URL. + // The URL for this load balancer pool. Href *string `json:"href" validate:"required"` } @@ -132008,7 +128931,7 @@ func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadB // LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct // This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { - // The pool's canonical URL. + // The URL for this load balancer pool. Href *string `json:"href" validate:"required"` } @@ -132759,7 +129682,7 @@ func UnmarshalRouteNextHopPatchRouteNextHopIPRouteNextHopIPUnicastIP(m map[strin // RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct // This model "extends" RouteNextHopPatchVPNGatewayConnectionIdentity type RouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { - // The VPN connection's canonical URL. + // The URL for this VPN gateway connection. Href *string `json:"href" validate:"required"` } @@ -132834,9 +129757,9 @@ func UnmarshalRouteNextHopPatchVPNGatewayConnectionIdentityVPNGatewayConnectionI return } -// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct -// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP -type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct { +// RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct +// This model "extends" RouteNextHopPrototypeRouteNextHopIP +type RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP struct { // The sentinel IP address (`0.0.0.0`). // // This property may [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) to support IPv6 addresses in @@ -132844,9 +129767,9 @@ type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototy Address *string `json:"address" validate:"required"` } -// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP (Generic Model Constructor) -func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP, err error) { - _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP{ +// NewRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP : Instantiate RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP(address string) (_model *RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP, err error) { + _model = &RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP{ Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") @@ -132856,17 +129779,17 @@ func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNe return } -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { +func (*RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPrototypeRouteNextHopIP() bool { return true } -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRoutePrototypeNextHop() bool { +func (*RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) isaRouteNextHopPrototype() bool { return true } -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) +// UnmarshalRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP unmarshals an instance of RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP from the specified map of raw messages. +func UnmarshalRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPSentinelIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) @@ -132876,9 +129799,9 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextH return } -// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP : RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP struct -// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP -type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP struct { +// RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP : RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP struct +// This model "extends" RouteNextHopPrototypeRouteNextHopIP +type RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP struct { // A unicast IP address, which must not be any of the following values: // // - `0.0.0.0` (the sentinel IP address) @@ -132890,9 +129813,9 @@ type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototy Address *string `json:"address" validate:"required"` } -// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP (Generic Model Constructor) -func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP, err error) { - _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP{ +// NewRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP : Instantiate RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP(address string) (_model *RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP, err error) { + _model = &RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP{ Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") @@ -132902,17 +129825,17 @@ func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNe return } -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP() bool { +func (*RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPrototypeRouteNextHopIP() bool { return true } -func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRoutePrototypeNextHop() bool { +func (*RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) isaRouteNextHopPrototype() bool { return true } -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) +// UnmarshalRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP unmarshals an instance of RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP from the specified map of raw messages. +func UnmarshalRouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPrototypeRouteNextHopIPRouteNextHopIPUnicastIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) @@ -132922,16 +129845,16 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIPRouteNextH return } -// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct -// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity -type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { - // The VPN connection's canonical URL. +// RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct +// This model "extends" RouteNextHopPrototypeVPNGatewayConnectionIdentity +type RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { + // The URL for this VPN gateway connection. Href *string `json:"href" validate:"required"` } -// NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { - _model = &RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ +// NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (_model *RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { + _model = &RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") @@ -132941,17 +129864,17 @@ func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionI return } -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { return true } -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRoutePrototypeNextHop() bool { +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPrototype() bool { return true } -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) +// UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. +func UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -132961,16 +129884,16 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIden return } -// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct -// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity -type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { +// RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct +// This model "extends" RouteNextHopPrototypeVPNGatewayConnectionIdentity +type RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { // The unique identifier for this VPN gateway connection. ID *string `json:"id" validate:"required"` } -// NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) -func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { - _model = &RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ +// NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (_model *RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { + _model = &RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") @@ -132980,17 +129903,17 @@ func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionI return } -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { return true } -func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRoutePrototypeNextHop() bool { +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPrototype() bool { return true } -// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. -func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) +// UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. +func UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) @@ -133003,7 +129926,7 @@ func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIden // SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct // This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct { - // The security group's CRN. + // The CRN for this security group. CRN *string `json:"crn" validate:"required"` } @@ -133042,7 +129965,7 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIden // SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct // This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct { - // The security group's canonical URL. + // The URL for this security group. Href *string `json:"href" validate:"required"` } @@ -133120,7 +130043,7 @@ func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIden // SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct // This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct { - // The security group's CRN. + // The CRN for this security group. CRN *string `json:"crn" validate:"required"` } @@ -133159,7 +130082,7 @@ func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroup // SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref struct // This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref struct { - // The security group's canonical URL. + // The URL for this security group. Href *string `json:"href" validate:"required"` } @@ -133351,76 +130274,6 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte return } -// VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch struct -// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch -type VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch struct { - // The peer autonomous system number (ASN) for this VPN gateway connection. - Asn *int64 `json:"asn,omitempty"` - - // The IP address of the peer VPN gateway for this connection. - Address *string `json:"address,omitempty"` -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch() bool { - return true -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) isaVPNGatewayConnectionPeerPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerAddressPatch) - err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) - if err != nil { - err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - err = core.SDKErrorf(err, "", "address-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct -// This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch -type VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch struct { - // The peer autonomous system number (ASN) for this VPN gateway connection. - Asn *int64 `json:"asn,omitempty"` - - // The FQDN of the peer VPN gateway for this connection. - Fqdn *string `json:"fqdn,omitempty"` -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatch() bool { - return true -} - -func (*VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) isaVPNGatewayConnectionPeerPatch() bool { - return true -} - -// UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch unmarshals an instance of VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionDynamicRouteModePeerPatchVPNGatewayConnectionPeerFqdnPatch) - err = core.UnmarshalPrimitive(m, "asn", &obj.Asn) - if err != nil { - err = core.SDKErrorf(err, "", "asn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "fqdn", &obj.Fqdn) - if err != nil { - err = core.SDKErrorf(err, "", "fqdn-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch struct // This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch struct { @@ -133529,227 +130382,6 @@ func UnmarshalVPNGatewayConnectionPeerPatchVPNGatewayConnectionStaticRouteModePe return } -// VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode : VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode struct -// This model "extends" VPNGatewayConnectionRouteMode -type VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up" validate:"required"` - - // The authentication mode. Only `psk` is currently supported. - AuthenticationMode *string `json:"authentication_mode" validate:"required"` - - // The date and time that this VPN gateway connection was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` - - // The establish mode of the VPN gateway connection: - // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol - // negotiations or rekeying processes. - // - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway - // connection. Additionally, the peer is responsible for initiating the rekeying process - // after the connection is established. If rekeying does not occur, the VPN gateway - // connection will be brought down after its lifetime expires. - EstablishMode *string `json:"establish_mode" validate:"required"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The IKE policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` - - // The IPsec policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` - - // The mode of the VPN gateway. - Mode *string `json:"mode" validate:"required"` - - // The name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. - Name *string `json:"name" validate:"required"` - - // The pre-shared key. - Psk *string `json:"psk" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The status of a VPN gateway connection. - Status *string `json:"status" validate:"required"` - - // The reasons for the current VPN gateway connection status (if any). - StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` - - Local *VPNGatewayConnectionDynamicRouteModeLocal `json:"local" validate:"required"` - - Peer VPNGatewayConnectionDynamicRouteModePeerIntf `json:"peer" validate:"required"` - - // The enabled routing protocol for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol" validate:"required"` - - // The VPN tunnel configuration for this VPN gateway connection (in dynamic route mode). - Tunnels []VPNGatewayConnectionDynamicRouteModeTunnel `json:"tunnels" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode.AuthenticationMode property. -// The authentication mode. Only `psk` is currently supported. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeAuthenticationModePskConst = "psk" -) - -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode.EstablishMode property. -// The establish mode of the VPN gateway connection: -// - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol -// negotiations or rekeying processes. -// - `peer_only`: Only the peer can initiate IKE protocol negotiations for this VPN gateway -// connection. Additionally, the peer is responsible for initiating the rekeying process -// after the connection is established. If rekeying does not occur, the VPN gateway -// connection will be brought down after its lifetime expires. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeEstablishModeBidirectionalConst = "bidirectional" - VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeEstablishModePeerOnlyConst = "peer_only" -) - -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode.Mode property. -// The mode of the VPN gateway. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeModePolicyConst = "policy" - VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeModeRouteConst = "route" -) - -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode.ResourceType property. -// The resource type. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode.Status property. -// The status of a VPN gateway connection. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeStatusDownConst = "down" - VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeStatusUpConst = "up" -) - -// Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode.RoutingProtocol property. -// The enabled routing protocol for this VPN gateway connection. -const ( - VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteModeRoutingProtocolBgpConst = "bgp" -) - -func (*VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode) isaVPNGatewayConnectionRouteMode() bool { - return true -} - -func (*VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode) isaVPNGatewayConnection() bool { - return true -} - -// UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode unmarshals an instance of VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionRouteModeVPNGatewayConnectionDynamicRouteMode) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) - if err != nil { - err = core.SDKErrorf(err, "", "admin_state_up-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) - if err != nil { - err = core.SDKErrorf(err, "", "authentication_mode-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, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) - if err != nil { - err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) - if err != nil { - err = core.SDKErrorf(err, "", "establish_mode-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, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) - if err != nil { - err = core.SDKErrorf(err, "", "ike_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) - if err != nil { - err = core.SDKErrorf(err, "", "ipsec_policy-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) - if err != nil { - err = core.SDKErrorf(err, "", "mode-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, "psk", &obj.Psk) - if err != nil { - err = core.SDKErrorf(err, "", "psk-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, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVPNGatewayConnectionStatusReason) - if err != nil { - err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionDynamicRouteModeLocal) - if err != nil { - err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "peer", &obj.Peer, UnmarshalVPNGatewayConnectionDynamicRouteModePeer) - if err != nil { - err = core.SDKErrorf(err, "", "peer-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) - if err != nil { - err = core.SDKErrorf(err, "", "routing_protocol-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionDynamicRouteModeTunnel) - if err != nil { - err = core.SDKErrorf(err, "", "tunnels-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct // This model "extends" VPNGatewayConnectionRouteMode type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { @@ -133773,7 +130405,7 @@ type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { // connection will be brought down after its lifetime expires. EstablishMode *string `json:"establish_mode" validate:"required"` - // The VPN connection's canonical URL. + // The URL for this VPN gateway connection. Href *string `json:"href" validate:"required"` // The unique identifier for this VPN gateway connection. @@ -134680,6 +131312,98 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt return } +// VpcsPager can be used to simplify the use of the "ListVpcs" method. +type VpcsPager struct { + hasNext bool + options *ListVpcsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewVpcsPager returns a new VpcsPager instance. +func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, 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 ListVpcsOptions = *options + pager = &VpcsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *VpcsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListVpcsWithContext(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.Vpcs + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, err error) { + for pager.HasNext() { + var nextPage []VPC + 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 *VpcsPager) GetNext() (page []VPC, 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 *VpcsPager) GetAll() (allItems []VPC, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + // VPCAddressPrefixesPager can be used to simplify the use of the "ListVPCAddressPrefixes" method. type VPCAddressPrefixesPager struct { hasNext bool @@ -134956,98 +131680,6 @@ func (pager *VPCRoutesPager) GetAll() (allItems []RouteCollectionVPCContextRoute return } -// VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. -type VPCRoutingTableRoutesPager struct { - hasNext bool - options *ListVPCRoutingTableRoutesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewVPCRoutingTableRoutesPager returns a new VPCRoutingTableRoutesPager instance. -func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRoutesOptions) (pager *VPCRoutingTableRoutesPager, 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 ListVPCRoutingTableRoutesOptions = *options - pager = &VPCRoutingTableRoutesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPCRoutingTableRoutesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) (page []Route, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListVPCRoutingTableRoutesWithContext(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.Routes - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) (allItems []Route, err error) { - for pager.HasNext() { - var nextPage []Route - 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 *VPCRoutingTableRoutesPager) 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 *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - // VPCRoutingTablesPager can be used to simplify the use of the "ListVPCRoutingTables" method. type VPCRoutingTablesPager struct { hasNext bool @@ -135140,25 +131772,25 @@ func (pager *VPCRoutingTablesPager) GetAll() (allItems []RoutingTable, err error return } -// VpcsPager can be used to simplify the use of the "ListVpcs" method. -type VpcsPager struct { +// VPCRoutingTableRoutesPager can be used to simplify the use of the "ListVPCRoutingTableRoutes" method. +type VPCRoutingTableRoutesPager struct { hasNext bool - options *ListVpcsOptions + options *ListVPCRoutingTableRoutesOptions client *VpcV1 pageContext struct { next *string } } -// NewVpcsPager returns a new VpcsPager instance. -func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, err error) { +// NewVPCRoutingTableRoutesPager returns a new VPCRoutingTableRoutesPager instance. +func (vpc *VpcV1) NewVPCRoutingTableRoutesPager(options *ListVPCRoutingTableRoutesOptions) (pager *VPCRoutingTableRoutesPager, 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 ListVpcsOptions = *options - pager = &VpcsPager{ + var optionsCopy ListVPCRoutingTableRoutesOptions = *options + pager = &VPCRoutingTableRoutesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -135167,19 +131799,19 @@ func (vpc *VpcV1) NewVpcsPager(options *ListVpcsOptions) (pager *VpcsPager, err } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VpcsPager) HasNext() bool { +func (pager *VPCRoutingTableRoutesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err error) { +func (pager *VPCRoutingTableRoutesPager) GetNextWithContext(ctx context.Context) (page []Route, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVpcsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPCRoutingTableRoutesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -135198,16 +131830,16 @@ func (pager *VpcsPager) GetNextWithContext(ctx context.Context) (page []VPC, err } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Vpcs + page = result.Routes return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, err error) { +func (pager *VPCRoutingTableRoutesPager) GetAllWithContext(ctx context.Context) (allItems []Route, err error) { for pager.HasNext() { - var nextPage []VPC + var nextPage []Route nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -135219,38 +131851,38 @@ func (pager *VpcsPager) GetAllWithContext(ctx context.Context) (allItems []VPC, } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VpcsPager) GetNext() (page []VPC, err error) { +func (pager *VPCRoutingTableRoutesPager) 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 *VpcsPager) GetAll() (allItems []VPC, err error) { +func (pager *VPCRoutingTableRoutesPager) GetAll() (allItems []Route, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. -type SubnetReservedIpsPager struct { +// SubnetsPager can be used to simplify the use of the "ListSubnets" method. +type SubnetsPager struct { hasNext bool - options *ListSubnetReservedIpsOptions + options *ListSubnetsOptions client *VpcV1 pageContext struct { next *string } } -// NewSubnetReservedIpsPager returns a new SubnetReservedIpsPager instance. -func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOptions) (pager *SubnetReservedIpsPager, err error) { +// NewSubnetsPager returns a new SubnetsPager instance. +func (vpc *VpcV1) NewSubnetsPager(options *ListSubnetsOptions) (pager *SubnetsPager, 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 ListSubnetReservedIpsOptions = *options - pager = &SubnetReservedIpsPager{ + var optionsCopy ListSubnetsOptions = *options + pager = &SubnetsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -135259,19 +131891,19 @@ func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOption } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *SubnetReservedIpsPager) HasNext() bool { +func (pager *SubnetsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { +func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subnet, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListSubnetReservedIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListSubnetsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -135290,16 +131922,16 @@ func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (pa } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.ReservedIps + page = result.Subnets return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { +func (pager *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Subnet, err error) { for pager.HasNext() { - var nextPage []ReservedIP + var nextPage []Subnet nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -135311,38 +131943,38 @@ func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (all } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SubnetReservedIpsPager) GetNext() (page []ReservedIP, err error) { +func (pager *SubnetsPager) GetNext() (page []Subnet, 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 *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) { +func (pager *SubnetsPager) GetAll() (allItems []Subnet, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// SubnetsPager can be used to simplify the use of the "ListSubnets" method. -type SubnetsPager struct { +// SubnetReservedIpsPager can be used to simplify the use of the "ListSubnetReservedIps" method. +type SubnetReservedIpsPager struct { hasNext bool - options *ListSubnetsOptions + options *ListSubnetReservedIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewSubnetsPager returns a new SubnetsPager instance. -func (vpc *VpcV1) NewSubnetsPager(options *ListSubnetsOptions) (pager *SubnetsPager, err error) { +// NewSubnetReservedIpsPager returns a new SubnetReservedIpsPager instance. +func (vpc *VpcV1) NewSubnetReservedIpsPager(options *ListSubnetReservedIpsOptions) (pager *SubnetReservedIpsPager, 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 ListSubnetsOptions = *options - pager = &SubnetsPager{ + var optionsCopy ListSubnetReservedIpsOptions = *options + pager = &SubnetReservedIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -135351,19 +131983,19 @@ func (vpc *VpcV1) NewSubnetsPager(options *ListSubnetsOptions) (pager *SubnetsPa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *SubnetsPager) HasNext() bool { +func (pager *SubnetReservedIpsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subnet, err error) { +func (pager *SubnetReservedIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListSubnetsWithContext(ctx, pager.options) + result, _, err := pager.client.ListSubnetReservedIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -135382,16 +132014,16 @@ func (pager *SubnetsPager) GetNextWithContext(ctx context.Context) (page []Subne } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Subnets + page = result.ReservedIps return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Subnet, err error) { +func (pager *SubnetReservedIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { for pager.HasNext() { - var nextPage []Subnet + var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -135403,14 +132035,14 @@ func (pager *SubnetsPager) GetAllWithContext(ctx context.Context) (allItems []Su } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SubnetsPager) GetNext() (page []Subnet, err error) { +func (pager *SubnetReservedIpsPager) GetNext() (page []ReservedIP, 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 *SubnetsPager) GetAll() (allItems []Subnet, err error) { +func (pager *SubnetReservedIpsPager) GetAll() (allItems []ReservedIP, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -135692,98 +132324,6 @@ func (pager *KeysPager) GetAll() (allItems []Key, err error) { return } -// InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "ListInstanceNetworkInterfaceIps" method. -type InstanceNetworkInterfaceIpsPager struct { - hasNext bool - options *ListInstanceNetworkInterfaceIpsOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewInstanceNetworkInterfaceIpsPager returns a new InstanceNetworkInterfaceIpsPager instance. -func (vpc *VpcV1) NewInstanceNetworkInterfaceIpsPager(options *ListInstanceNetworkInterfaceIpsOptions) (pager *InstanceNetworkInterfaceIpsPager, 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 ListInstanceNetworkInterfaceIpsOptions = *options - pager = &InstanceNetworkInterfaceIpsPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceNetworkInterfaceIpsPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListInstanceNetworkInterfaceIpsWithContext(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.Ips - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { - for pager.HasNext() { - var nextPage []ReservedIP - 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 *InstanceNetworkInterfaceIpsPager) GetNext() (page []ReservedIP, 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 *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - // InstancesPager can be used to simplify the use of the "ListInstances" method. type InstancesPager struct { hasNext bool @@ -135876,25 +132416,25 @@ func (pager *InstancesPager) GetAll() (allItems []Instance, err error) { return } -// InstanceGroupManagerActionsPager can be used to simplify the use of the "ListInstanceGroupManagerActions" method. -type InstanceGroupManagerActionsPager struct { +// InstanceNetworkInterfaceIpsPager can be used to simplify the use of the "ListInstanceNetworkInterfaceIps" method. +type InstanceNetworkInterfaceIpsPager struct { hasNext bool - options *ListInstanceGroupManagerActionsOptions + options *ListInstanceNetworkInterfaceIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupManagerActionsPager returns a new InstanceGroupManagerActionsPager instance. -func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroupManagerActionsOptions) (pager *InstanceGroupManagerActionsPager, err error) { +// NewInstanceNetworkInterfaceIpsPager returns a new InstanceNetworkInterfaceIpsPager instance. +func (vpc *VpcV1) NewInstanceNetworkInterfaceIpsPager(options *ListInstanceNetworkInterfaceIpsOptions) (pager *InstanceNetworkInterfaceIpsPager, 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 ListInstanceGroupManagerActionsOptions = *options - pager = &InstanceGroupManagerActionsPager{ + var optionsCopy ListInstanceNetworkInterfaceIpsOptions = *options + pager = &InstanceNetworkInterfaceIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -135903,19 +132443,19 @@ func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroup } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupManagerActionsPager) HasNext() bool { +func (pager *InstanceNetworkInterfaceIpsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerActionIntf, err error) { +func (pager *InstanceNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListInstanceGroupManagerActionsWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceNetworkInterfaceIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -135934,16 +132474,16 @@ func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Co } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Actions + page = result.Ips return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerActionIntf, err error) { +func (pager *InstanceNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { for pager.HasNext() { - var nextPage []InstanceGroupManagerActionIntf + var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -135955,38 +132495,38 @@ func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Con } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagerActionsPager) GetNext() (page []InstanceGroupManagerActionIntf, err error) { +func (pager *InstanceNetworkInterfaceIpsPager) GetNext() (page []ReservedIP, 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 *InstanceGroupManagerActionsPager) GetAll() (allItems []InstanceGroupManagerActionIntf, err error) { +func (pager *InstanceNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIP, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// InstanceGroupManagerPoliciesPager can be used to simplify the use of the "ListInstanceGroupManagerPolicies" method. -type InstanceGroupManagerPoliciesPager struct { +// InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. +type InstanceGroupsPager struct { hasNext bool - options *ListInstanceGroupManagerPoliciesOptions + options *ListInstanceGroupsOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupManagerPoliciesPager returns a new InstanceGroupManagerPoliciesPager instance. -func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGroupManagerPoliciesOptions) (pager *InstanceGroupManagerPoliciesPager, err error) { +// NewInstanceGroupsPager returns a new InstanceGroupsPager instance. +func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pager *InstanceGroupsPager, 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 ListInstanceGroupManagerPoliciesOptions = *options - pager = &InstanceGroupManagerPoliciesPager{ + var optionsCopy ListInstanceGroupsOptions = *options + pager = &InstanceGroupsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -135995,19 +132535,19 @@ func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGrou } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupManagerPoliciesPager) HasNext() bool { +func (pager *InstanceGroupsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerPolicyIntf, err error) { +func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroup, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListInstanceGroupManagerPoliciesWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceGroupsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -136026,16 +132566,16 @@ func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.C } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Policies + page = result.InstanceGroups return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerPolicyIntf, err error) { +func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroup, err error) { for pager.HasNext() { - var nextPage []InstanceGroupManagerPolicyIntf + var nextPage []InstanceGroup nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -136047,14 +132587,14 @@ func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Co } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupManagerPoliciesPager) GetNext() (page []InstanceGroupManagerPolicyIntf, err error) { +func (pager *InstanceGroupsPager) GetNext() (page []InstanceGroup, 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 *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGroupManagerPolicyIntf, err error) { +func (pager *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -136152,25 +132692,25 @@ func (pager *InstanceGroupManagersPager) GetAll() (allItems []InstanceGroupManag return } -// InstanceGroupMembershipsPager can be used to simplify the use of the "ListInstanceGroupMemberships" method. -type InstanceGroupMembershipsPager struct { +// InstanceGroupManagerActionsPager can be used to simplify the use of the "ListInstanceGroupManagerActions" method. +type InstanceGroupManagerActionsPager struct { hasNext bool - options *ListInstanceGroupMembershipsOptions + options *ListInstanceGroupManagerActionsOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupMembershipsPager returns a new InstanceGroupMembershipsPager instance. -func (vpc *VpcV1) NewInstanceGroupMembershipsPager(options *ListInstanceGroupMembershipsOptions) (pager *InstanceGroupMembershipsPager, err error) { +// NewInstanceGroupManagerActionsPager returns a new InstanceGroupManagerActionsPager instance. +func (vpc *VpcV1) NewInstanceGroupManagerActionsPager(options *ListInstanceGroupManagerActionsOptions) (pager *InstanceGroupManagerActionsPager, 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 ListInstanceGroupMembershipsOptions = *options - pager = &InstanceGroupMembershipsPager{ + var optionsCopy ListInstanceGroupManagerActionsOptions = *options + pager = &InstanceGroupManagerActionsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -136179,19 +132719,19 @@ func (vpc *VpcV1) NewInstanceGroupMembershipsPager(options *ListInstanceGroupMem } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupMembershipsPager) HasNext() bool { +func (pager *InstanceGroupManagerActionsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupMembership, err error) { +func (pager *InstanceGroupManagerActionsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerActionIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListInstanceGroupMembershipsWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceGroupManagerActionsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -136210,16 +132750,16 @@ func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Memberships + page = result.Actions return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupMembership, err error) { +func (pager *InstanceGroupManagerActionsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerActionIntf, err error) { for pager.HasNext() { - var nextPage []InstanceGroupMembership + var nextPage []InstanceGroupManagerActionIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -136231,38 +132771,38 @@ func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Contex } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupMembershipsPager) GetNext() (page []InstanceGroupMembership, err error) { +func (pager *InstanceGroupManagerActionsPager) GetNext() (page []InstanceGroupManagerActionIntf, 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 *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMembership, err error) { +func (pager *InstanceGroupManagerActionsPager) GetAll() (allItems []InstanceGroupManagerActionIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// InstanceGroupsPager can be used to simplify the use of the "ListInstanceGroups" method. -type InstanceGroupsPager struct { +// InstanceGroupManagerPoliciesPager can be used to simplify the use of the "ListInstanceGroupManagerPolicies" method. +type InstanceGroupManagerPoliciesPager struct { hasNext bool - options *ListInstanceGroupsOptions + options *ListInstanceGroupManagerPoliciesOptions client *VpcV1 pageContext struct { next *string } } -// NewInstanceGroupsPager returns a new InstanceGroupsPager instance. -func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pager *InstanceGroupsPager, err error) { +// NewInstanceGroupManagerPoliciesPager returns a new InstanceGroupManagerPoliciesPager instance. +func (vpc *VpcV1) NewInstanceGroupManagerPoliciesPager(options *ListInstanceGroupManagerPoliciesOptions) (pager *InstanceGroupManagerPoliciesPager, 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 ListInstanceGroupsOptions = *options - pager = &InstanceGroupsPager{ + var optionsCopy ListInstanceGroupManagerPoliciesOptions = *options + pager = &InstanceGroupManagerPoliciesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -136271,19 +132811,19 @@ func (vpc *VpcV1) NewInstanceGroupsPager(options *ListInstanceGroupsOptions) (pa } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *InstanceGroupsPager) HasNext() bool { +func (pager *InstanceGroupManagerPoliciesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroup, err error) { +func (pager *InstanceGroupManagerPoliciesPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupManagerPolicyIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListInstanceGroupsWithContext(ctx, pager.options) + result, _, err := pager.client.ListInstanceGroupManagerPoliciesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -136302,16 +132842,16 @@ func (pager *InstanceGroupsPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.InstanceGroups + page = result.Policies return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroup, err error) { +func (pager *InstanceGroupManagerPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupManagerPolicyIntf, err error) { for pager.HasNext() { - var nextPage []InstanceGroup + var nextPage []InstanceGroupManagerPolicyIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -136323,14 +132863,106 @@ func (pager *InstanceGroupsPager) GetAllWithContext(ctx context.Context) (allIte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *InstanceGroupsPager) GetNext() (page []InstanceGroup, err error) { +func (pager *InstanceGroupManagerPoliciesPager) GetNext() (page []InstanceGroupManagerPolicyIntf, 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 *InstanceGroupsPager) GetAll() (allItems []InstanceGroup, err error) { +func (pager *InstanceGroupManagerPoliciesPager) GetAll() (allItems []InstanceGroupManagerPolicyIntf, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// InstanceGroupMembershipsPager can be used to simplify the use of the "ListInstanceGroupMemberships" method. +type InstanceGroupMembershipsPager struct { + hasNext bool + options *ListInstanceGroupMembershipsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewInstanceGroupMembershipsPager returns a new InstanceGroupMembershipsPager instance. +func (vpc *VpcV1) NewInstanceGroupMembershipsPager(options *ListInstanceGroupMembershipsOptions) (pager *InstanceGroupMembershipsPager, 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 ListInstanceGroupMembershipsOptions = *options + pager = &InstanceGroupMembershipsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *InstanceGroupMembershipsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *InstanceGroupMembershipsPager) GetNextWithContext(ctx context.Context) (page []InstanceGroupMembership, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListInstanceGroupMembershipsWithContext(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.Memberships + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *InstanceGroupMembershipsPager) GetAllWithContext(ctx context.Context) (allItems []InstanceGroupMembership, err error) { + for pager.HasNext() { + var nextPage []InstanceGroupMembership + 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 *InstanceGroupMembershipsPager) GetNext() (page []InstanceGroupMembership, 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 *InstanceGroupMembershipsPager) GetAll() (allItems []InstanceGroupMembership, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -136796,25 +133428,25 @@ func (pager *PlacementGroupsPager) GetAll() (allItems []PlacementGroup, err erro return } -// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. -type BareMetalServerNetworkAttachmentsPager struct { +// BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. +type BareMetalServerProfilesPager struct { hasNext bool - options *ListBareMetalServerNetworkAttachmentsOptions + options *ListBareMetalServerProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. -func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, err error) { +// NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. +func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, 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 ListBareMetalServerNetworkAttachmentsOptions = *options - pager = &BareMetalServerNetworkAttachmentsPager{ + var optionsCopy ListBareMetalServerProfilesOptions = *options + pager = &BareMetalServerProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -136823,19 +133455,19 @@ func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMet } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerNetworkAttachmentsPager) HasNext() bool { +func (pager *BareMetalServerProfilesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfile, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerProfilesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -136854,16 +133486,16 @@ func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx cont } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.NetworkAttachments + page = result.Profiles return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfile, err error) { for pager.HasNext() { - var nextPage []BareMetalServerNetworkAttachmentIntf + var nextPage []BareMetalServerProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -136875,38 +133507,38 @@ func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx conte } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *BareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfile, 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 *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { +func (pager *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. -type BareMetalServerNetworkInterfacesPager struct { +// BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. +type BareMetalServersPager struct { hasNext bool - options *ListBareMetalServerNetworkInterfacesOptions + options *ListBareMetalServersOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. -func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, err error) { +// NewBareMetalServersPager returns a new BareMetalServersPager instance. +func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, 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 ListBareMetalServerNetworkInterfacesOptions = *options - pager = &BareMetalServerNetworkInterfacesPager{ + var optionsCopy ListBareMetalServersOptions = *options + pager = &BareMetalServersPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -136915,19 +133547,19 @@ func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMeta } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerNetworkInterfacesPager) HasNext() bool { +func (pager *BareMetalServersPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (page []BareMetalServer, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServersWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -136946,16 +133578,16 @@ func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.NetworkInterfaces + page = result.BareMetalServers return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServer, err error) { for pager.HasNext() { - var nextPage []BareMetalServerNetworkInterfaceIntf + var nextPage []BareMetalServer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -136967,38 +133599,38 @@ func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx contex } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerNetworkInterfacesPager) GetNext() (page []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *BareMetalServersPager) GetNext() (page []BareMetalServer, 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 *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { +func (pager *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// BareMetalServerProfilesPager can be used to simplify the use of the "ListBareMetalServerProfiles" method. -type BareMetalServerProfilesPager struct { +// BareMetalServerNetworkAttachmentsPager can be used to simplify the use of the "ListBareMetalServerNetworkAttachments" method. +type BareMetalServerNetworkAttachmentsPager struct { hasNext bool - options *ListBareMetalServerProfilesOptions + options *ListBareMetalServerNetworkAttachmentsOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServerProfilesPager returns a new BareMetalServerProfilesPager instance. -func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerProfilesOptions) (pager *BareMetalServerProfilesPager, err error) { +// NewBareMetalServerNetworkAttachmentsPager returns a new BareMetalServerNetworkAttachmentsPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkAttachmentsPager(options *ListBareMetalServerNetworkAttachmentsOptions) (pager *BareMetalServerNetworkAttachmentsPager, 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 ListBareMetalServerProfilesOptions = *options - pager = &BareMetalServerProfilesPager{ + var optionsCopy ListBareMetalServerNetworkAttachmentsOptions = *options + pager = &BareMetalServerNetworkAttachmentsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -137007,19 +133639,19 @@ func (vpc *VpcV1) NewBareMetalServerProfilesPager(options *ListBareMetalServerPr } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServerProfilesPager) HasNext() bool { +func (pager *BareMetalServerNetworkAttachmentsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerProfile, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkAttachmentIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServerProfilesWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerNetworkAttachmentsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -137038,16 +133670,16 @@ func (pager *BareMetalServerProfilesPager) GetNextWithContext(ctx context.Contex } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Profiles + page = result.NetworkAttachments return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerProfile, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkAttachmentIntf, err error) { for pager.HasNext() { - var nextPage []BareMetalServerProfile + var nextPage []BareMetalServerNetworkAttachmentIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -137059,38 +133691,38 @@ func (pager *BareMetalServerProfilesPager) GetAllWithContext(ctx context.Context } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServerProfilesPager) GetNext() (page []BareMetalServerProfile, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetNext() (page []BareMetalServerNetworkAttachmentIntf, 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 *BareMetalServerProfilesPager) GetAll() (allItems []BareMetalServerProfile, err error) { +func (pager *BareMetalServerNetworkAttachmentsPager) GetAll() (allItems []BareMetalServerNetworkAttachmentIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// BareMetalServersPager can be used to simplify the use of the "ListBareMetalServers" method. -type BareMetalServersPager struct { +// BareMetalServerNetworkInterfacesPager can be used to simplify the use of the "ListBareMetalServerNetworkInterfaces" method. +type BareMetalServerNetworkInterfacesPager struct { hasNext bool - options *ListBareMetalServersOptions + options *ListBareMetalServerNetworkInterfacesOptions client *VpcV1 pageContext struct { next *string } } -// NewBareMetalServersPager returns a new BareMetalServersPager instance. -func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) (pager *BareMetalServersPager, err error) { +// NewBareMetalServerNetworkInterfacesPager returns a new BareMetalServerNetworkInterfacesPager instance. +func (vpc *VpcV1) NewBareMetalServerNetworkInterfacesPager(options *ListBareMetalServerNetworkInterfacesOptions) (pager *BareMetalServerNetworkInterfacesPager, 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 ListBareMetalServersOptions = *options - pager = &BareMetalServersPager{ + var optionsCopy ListBareMetalServerNetworkInterfacesOptions = *options + pager = &BareMetalServerNetworkInterfacesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -137099,19 +133731,19 @@ func (vpc *VpcV1) NewBareMetalServersPager(options *ListBareMetalServersOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *BareMetalServersPager) HasNext() bool { +func (pager *BareMetalServerNetworkInterfacesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (page []BareMetalServer, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []BareMetalServerNetworkInterfaceIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListBareMetalServersWithContext(ctx, pager.options) + result, _, err := pager.client.ListBareMetalServerNetworkInterfacesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -137130,16 +133762,16 @@ func (pager *BareMetalServersPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.BareMetalServers + page = result.NetworkInterfaces return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServer, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []BareMetalServerNetworkInterfaceIntf, err error) { for pager.HasNext() { - var nextPage []BareMetalServer + var nextPage []BareMetalServerNetworkInterfaceIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -137151,14 +133783,14 @@ func (pager *BareMetalServersPager) GetAllWithContext(ctx context.Context) (allI } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *BareMetalServersPager) GetNext() (page []BareMetalServer, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetNext() (page []BareMetalServerNetworkInterfaceIntf, 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 *BareMetalServersPager) GetAll() (allItems []BareMetalServer, err error) { +func (pager *BareMetalServerNetworkInterfacesPager) GetAll() (allItems []BareMetalServerNetworkInterfaceIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -137532,25 +134164,25 @@ func (pager *SnapshotsPager) GetAll() (allItems []Snapshot, err error) { return } -// ShareAccessorBindingsPager can be used to simplify the use of the "ListShareAccessorBindings" method. -type ShareAccessorBindingsPager struct { +// ShareProfilesPager can be used to simplify the use of the "ListShareProfiles" method. +type ShareProfilesPager struct { hasNext bool - options *ListShareAccessorBindingsOptions + options *ListShareProfilesOptions client *VpcV1 pageContext struct { next *string } } -// NewShareAccessorBindingsPager returns a new ShareAccessorBindingsPager instance. -func (vpc *VpcV1) NewShareAccessorBindingsPager(options *ListShareAccessorBindingsOptions) (pager *ShareAccessorBindingsPager, err error) { +// NewShareProfilesPager returns a new ShareProfilesPager instance. +func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (pager *ShareProfilesPager, 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 ListShareAccessorBindingsOptions = *options - pager = &ShareAccessorBindingsPager{ + var optionsCopy ListShareProfilesOptions = *options + pager = &ShareProfilesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -137559,19 +134191,19 @@ func (vpc *VpcV1) NewShareAccessorBindingsPager(options *ListShareAccessorBindin } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *ShareAccessorBindingsPager) HasNext() bool { +func (pager *ShareProfilesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *ShareAccessorBindingsPager) GetNextWithContext(ctx context.Context) (page []ShareAccessorBinding, err error) { +func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page []ShareProfile, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListShareAccessorBindingsWithContext(ctx, pager.options) + result, _, err := pager.client.ListShareProfilesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -137590,16 +134222,16 @@ func (pager *ShareAccessorBindingsPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.AccessorBindings + page = result.Profiles return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *ShareAccessorBindingsPager) GetAllWithContext(ctx context.Context) (allItems []ShareAccessorBinding, err error) { +func (pager *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItems []ShareProfile, err error) { for pager.HasNext() { - var nextPage []ShareAccessorBinding + var nextPage []ShareProfile nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -137611,38 +134243,38 @@ func (pager *ShareAccessorBindingsPager) GetAllWithContext(ctx context.Context) } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ShareAccessorBindingsPager) GetNext() (page []ShareAccessorBinding, err error) { +func (pager *ShareProfilesPager) GetNext() (page []ShareProfile, 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 *ShareAccessorBindingsPager) GetAll() (allItems []ShareAccessorBinding, err error) { +func (pager *ShareProfilesPager) GetAll() (allItems []ShareProfile, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// ShareMountTargetsPager can be used to simplify the use of the "ListShareMountTargets" method. -type ShareMountTargetsPager struct { +// SharesPager can be used to simplify the use of the "ListShares" method. +type SharesPager struct { hasNext bool - options *ListShareMountTargetsOptions + options *ListSharesOptions client *VpcV1 pageContext struct { next *string } } -// NewShareMountTargetsPager returns a new ShareMountTargetsPager instance. -func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOptions) (pager *ShareMountTargetsPager, err error) { +// NewSharesPager returns a new SharesPager instance. +func (vpc *VpcV1) NewSharesPager(options *ListSharesOptions) (pager *SharesPager, 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 ListShareMountTargetsOptions = *options - pager = &ShareMountTargetsPager{ + var optionsCopy ListSharesOptions = *options + pager = &SharesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -137651,19 +134283,19 @@ func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOption } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *ShareMountTargetsPager) HasNext() bool { +func (pager *SharesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (page []ShareMountTarget, err error) { +func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListShareMountTargetsWithContext(ctx, pager.options) + result, _, err := pager.client.ListSharesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -137682,16 +134314,16 @@ func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (pa } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.MountTargets + page = result.Shares return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (allItems []ShareMountTarget, err error) { +func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Share, err error) { for pager.HasNext() { - var nextPage []ShareMountTarget + var nextPage []Share nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -137703,38 +134335,38 @@ func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (all } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ShareMountTargetsPager) GetNext() (page []ShareMountTarget, err error) { +func (pager *SharesPager) GetNext() (page []Share, 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 *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err error) { +func (pager *SharesPager) GetAll() (allItems []Share, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// ShareProfilesPager can be used to simplify the use of the "ListShareProfiles" method. -type ShareProfilesPager struct { +// ShareAccessorBindingsPager can be used to simplify the use of the "ListShareAccessorBindings" method. +type ShareAccessorBindingsPager struct { hasNext bool - options *ListShareProfilesOptions + options *ListShareAccessorBindingsOptions client *VpcV1 pageContext struct { next *string } } -// NewShareProfilesPager returns a new ShareProfilesPager instance. -func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (pager *ShareProfilesPager, err error) { +// NewShareAccessorBindingsPager returns a new ShareAccessorBindingsPager instance. +func (vpc *VpcV1) NewShareAccessorBindingsPager(options *ListShareAccessorBindingsOptions) (pager *ShareAccessorBindingsPager, 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 ListShareProfilesOptions = *options - pager = &ShareProfilesPager{ + var optionsCopy ListShareAccessorBindingsOptions = *options + pager = &ShareAccessorBindingsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -137743,19 +134375,19 @@ func (vpc *VpcV1) NewShareProfilesPager(options *ListShareProfilesOptions) (page } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *ShareProfilesPager) HasNext() bool { +func (pager *ShareAccessorBindingsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page []ShareProfile, err error) { +func (pager *ShareAccessorBindingsPager) GetNextWithContext(ctx context.Context) (page []ShareAccessorBinding, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListShareProfilesWithContext(ctx, pager.options) + result, _, err := pager.client.ListShareAccessorBindingsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -137774,16 +134406,16 @@ func (pager *ShareProfilesPager) GetNextWithContext(ctx context.Context) (page [ } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Profiles + page = result.AccessorBindings return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItems []ShareProfile, err error) { +func (pager *ShareAccessorBindingsPager) GetAllWithContext(ctx context.Context) (allItems []ShareAccessorBinding, err error) { for pager.HasNext() { - var nextPage []ShareProfile + var nextPage []ShareAccessorBinding nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -137795,38 +134427,38 @@ func (pager *ShareProfilesPager) GetAllWithContext(ctx context.Context) (allItem } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *ShareProfilesPager) GetNext() (page []ShareProfile, err error) { +func (pager *ShareAccessorBindingsPager) GetNext() (page []ShareAccessorBinding, 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 *ShareProfilesPager) GetAll() (allItems []ShareProfile, err error) { +func (pager *ShareAccessorBindingsPager) GetAll() (allItems []ShareAccessorBinding, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// SharesPager can be used to simplify the use of the "ListShares" method. -type SharesPager struct { +// ShareMountTargetsPager can be used to simplify the use of the "ListShareMountTargets" method. +type ShareMountTargetsPager struct { hasNext bool - options *ListSharesOptions + options *ListShareMountTargetsOptions client *VpcV1 pageContext struct { next *string } } -// NewSharesPager returns a new SharesPager instance. -func (vpc *VpcV1) NewSharesPager(options *ListSharesOptions) (pager *SharesPager, err error) { +// NewShareMountTargetsPager returns a new ShareMountTargetsPager instance. +func (vpc *VpcV1) NewShareMountTargetsPager(options *ListShareMountTargetsOptions) (pager *ShareMountTargetsPager, 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 ListSharesOptions = *options - pager = &SharesPager{ + var optionsCopy ListShareMountTargetsOptions = *options + pager = &ShareMountTargetsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -137835,19 +134467,19 @@ func (vpc *VpcV1) NewSharesPager(options *ListSharesOptions) (pager *SharesPager } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *SharesPager) HasNext() bool { +func (pager *ShareMountTargetsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, err error) { +func (pager *ShareMountTargetsPager) GetNextWithContext(ctx context.Context) (page []ShareMountTarget, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListSharesWithContext(ctx, pager.options) + result, _, err := pager.client.ListShareMountTargetsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -137866,16 +134498,16 @@ func (pager *SharesPager) GetNextWithContext(ctx context.Context) (page []Share, } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Shares + page = result.MountTargets return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Share, err error) { +func (pager *ShareMountTargetsPager) GetAllWithContext(ctx context.Context) (allItems []ShareMountTarget, err error) { for pager.HasNext() { - var nextPage []Share + var nextPage []ShareMountTarget nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -137887,14 +134519,14 @@ func (pager *SharesPager) GetAllWithContext(ctx context.Context) (allItems []Sha } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SharesPager) GetNext() (page []Share, err error) { +func (pager *ShareMountTargetsPager) GetNext() (page []ShareMountTarget, 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 *SharesPager) GetAll() (allItems []Share, err error) { +func (pager *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -138084,25 +134716,25 @@ func (pager *BackupPolicyJobsPager) GetAll() (allItems []BackupPolicyJob, err er return } -// NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "ListNetworkInterfaceFloatingIps" method. -type NetworkInterfaceFloatingIpsPager struct { +// VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. +type VirtualNetworkInterfacesPager struct { hasNext bool - options *ListNetworkInterfaceFloatingIpsOptions + options *ListVirtualNetworkInterfacesOptions client *VpcV1 pageContext struct { next *string } } -// NewNetworkInterfaceFloatingIpsPager returns a new NetworkInterfaceFloatingIpsPager instance. -func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterfaceFloatingIpsOptions) (pager *NetworkInterfaceFloatingIpsPager, err error) { +// NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. +func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, 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 ListNetworkInterfaceFloatingIpsOptions = *options - pager = &NetworkInterfaceFloatingIpsPager{ + var optionsCopy ListVirtualNetworkInterfacesOptions = *options + pager = &VirtualNetworkInterfacesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -138111,19 +134743,19 @@ func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterf } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *NetworkInterfaceFloatingIpsPager) HasNext() bool { +func (pager *VirtualNetworkInterfacesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIPReference, err error) { +func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []VirtualNetworkInterface, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListNetworkInterfaceFloatingIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVirtualNetworkInterfacesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -138142,16 +134774,16 @@ func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Co } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.FloatingIps + page = result.VirtualNetworkInterfaces return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIPReference, err error) { +func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []VirtualNetworkInterface, err error) { for pager.HasNext() { - var nextPage []FloatingIPReference + var nextPage []VirtualNetworkInterface nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -138163,38 +134795,38 @@ func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Con } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *NetworkInterfaceFloatingIpsPager) GetNext() (page []FloatingIPReference, err error) { +func (pager *VirtualNetworkInterfacesPager) GetNext() (page []VirtualNetworkInterface, 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 *NetworkInterfaceFloatingIpsPager) GetAll() (allItems []FloatingIPReference, err error) { +func (pager *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "ListVirtualNetworkInterfaceIps" method. -type VirtualNetworkInterfaceIpsPager struct { +// NetworkInterfaceFloatingIpsPager can be used to simplify the use of the "ListNetworkInterfaceFloatingIps" method. +type NetworkInterfaceFloatingIpsPager struct { hasNext bool - options *ListVirtualNetworkInterfaceIpsOptions + options *ListNetworkInterfaceFloatingIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewVirtualNetworkInterfaceIpsPager returns a new VirtualNetworkInterfaceIpsPager instance. -func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetworkInterfaceIpsOptions) (pager *VirtualNetworkInterfaceIpsPager, err error) { +// NewNetworkInterfaceFloatingIpsPager returns a new NetworkInterfaceFloatingIpsPager instance. +func (vpc *VpcV1) NewNetworkInterfaceFloatingIpsPager(options *ListNetworkInterfaceFloatingIpsOptions) (pager *NetworkInterfaceFloatingIpsPager, 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 ListVirtualNetworkInterfaceIpsOptions = *options - pager = &VirtualNetworkInterfaceIpsPager{ + var optionsCopy ListNetworkInterfaceFloatingIpsOptions = *options + pager = &NetworkInterfaceFloatingIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -138203,19 +134835,19 @@ func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetwork } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VirtualNetworkInterfaceIpsPager) HasNext() bool { +func (pager *NetworkInterfaceFloatingIpsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIPReference, err error) { +func (pager *NetworkInterfaceFloatingIpsPager) GetNextWithContext(ctx context.Context) (page []FloatingIPReference, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVirtualNetworkInterfaceIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListNetworkInterfaceFloatingIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -138234,16 +134866,16 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Con } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Ips + page = result.FloatingIps return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIPReference, err error) { +func (pager *NetworkInterfaceFloatingIpsPager) GetAllWithContext(ctx context.Context) (allItems []FloatingIPReference, err error) { for pager.HasNext() { - var nextPage []ReservedIPReference + var nextPage []FloatingIPReference nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -138255,38 +134887,38 @@ func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Cont } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VirtualNetworkInterfaceIpsPager) GetNext() (page []ReservedIPReference, err error) { +func (pager *NetworkInterfaceFloatingIpsPager) GetNext() (page []FloatingIPReference, 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 *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPReference, err error) { +func (pager *NetworkInterfaceFloatingIpsPager) GetAll() (allItems []FloatingIPReference, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VirtualNetworkInterfacesPager can be used to simplify the use of the "ListVirtualNetworkInterfaces" method. -type VirtualNetworkInterfacesPager struct { +// VirtualNetworkInterfaceIpsPager can be used to simplify the use of the "ListVirtualNetworkInterfaceIps" method. +type VirtualNetworkInterfaceIpsPager struct { hasNext bool - options *ListVirtualNetworkInterfacesOptions + options *ListVirtualNetworkInterfaceIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewVirtualNetworkInterfacesPager returns a new VirtualNetworkInterfacesPager instance. -func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkInterfacesOptions) (pager *VirtualNetworkInterfacesPager, err error) { +// NewVirtualNetworkInterfaceIpsPager returns a new VirtualNetworkInterfaceIpsPager instance. +func (vpc *VpcV1) NewVirtualNetworkInterfaceIpsPager(options *ListVirtualNetworkInterfaceIpsOptions) (pager *VirtualNetworkInterfaceIpsPager, 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 ListVirtualNetworkInterfacesOptions = *options - pager = &VirtualNetworkInterfacesPager{ + var optionsCopy ListVirtualNetworkInterfaceIpsOptions = *options + pager = &VirtualNetworkInterfaceIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -138295,19 +134927,19 @@ func (vpc *VpcV1) NewVirtualNetworkInterfacesPager(options *ListVirtualNetworkIn } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VirtualNetworkInterfacesPager) HasNext() bool { +func (pager *VirtualNetworkInterfaceIpsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Context) (page []VirtualNetworkInterface, err error) { +func (pager *VirtualNetworkInterfaceIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIPReference, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVirtualNetworkInterfacesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVirtualNetworkInterfaceIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -138326,16 +134958,16 @@ func (pager *VirtualNetworkInterfacesPager) GetNextWithContext(ctx context.Conte } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.VirtualNetworkInterfaces + page = result.Ips return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Context) (allItems []VirtualNetworkInterface, err error) { +func (pager *VirtualNetworkInterfaceIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIPReference, err error) { for pager.HasNext() { - var nextPage []VirtualNetworkInterface + var nextPage []ReservedIPReference nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -138347,14 +134979,14 @@ func (pager *VirtualNetworkInterfacesPager) GetAllWithContext(ctx context.Contex } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VirtualNetworkInterfacesPager) GetNext() (page []VirtualNetworkInterface, err error) { +func (pager *VirtualNetworkInterfaceIpsPager) GetNext() (page []ReservedIPReference, 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 *VirtualNetworkInterfacesPager) GetAll() (allItems []VirtualNetworkInterface, err error) { +func (pager *VirtualNetworkInterfaceIpsPager) GetAll() (allItems []ReservedIPReference, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -138544,98 +135176,6 @@ func (pager *FloatingIpsPager) GetAll() (allItems []FloatingIP, err error) { return } -// NetworkACLRulesPager can be used to simplify the use of the "ListNetworkACLRules" method. -type NetworkACLRulesPager struct { - hasNext bool - options *ListNetworkACLRulesOptions - client *VpcV1 - pageContext struct { - next *string - } -} - -// NewNetworkACLRulesPager returns a new NetworkACLRulesPager instance. -func (vpc *VpcV1) NewNetworkACLRulesPager(options *ListNetworkACLRulesOptions) (pager *NetworkACLRulesPager, 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 ListNetworkACLRulesOptions = *options - pager = &NetworkACLRulesPager{ - hasNext: true, - options: &optionsCopy, - client: vpc, - } - return -} - -// HasNext returns true if there are potentially more results to be retrieved. -func (pager *NetworkACLRulesPager) HasNext() bool { - return pager.hasNext -} - -// GetNextWithContext returns the next page of results using the specified Context. -func (pager *NetworkACLRulesPager) GetNextWithContext(ctx context.Context) (page []NetworkACLRuleItemIntf, err error) { - if !pager.HasNext() { - return nil, fmt.Errorf("no more results available") - } - - pager.options.Start = pager.pageContext.next - - result, _, err := pager.client.ListNetworkACLRulesWithContext(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.Rules - - return -} - -// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly -// until all pages of results have been retrieved. -func (pager *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACLRuleItemIntf, err error) { - for pager.HasNext() { - var nextPage []NetworkACLRuleItemIntf - 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 *NetworkACLRulesPager) GetNext() (page []NetworkACLRuleItemIntf, 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 *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, err error) { - allItems, err = pager.GetAllWithContext(context.Background()) - err = core.RepurposeSDKProblem(err, "") - return -} - // NetworkAclsPager can be used to simplify the use of the "ListNetworkAcls" method. type NetworkAclsPager struct { hasNext bool @@ -138728,25 +135268,25 @@ func (pager *NetworkAclsPager) GetAll() (allItems []NetworkACL, err error) { return } -// SecurityGroupTargetsPager can be used to simplify the use of the "ListSecurityGroupTargets" method. -type SecurityGroupTargetsPager struct { +// NetworkACLRulesPager can be used to simplify the use of the "ListNetworkACLRules" method. +type NetworkACLRulesPager struct { hasNext bool - options *ListSecurityGroupTargetsOptions + options *ListNetworkACLRulesOptions client *VpcV1 pageContext struct { next *string } } -// NewSecurityGroupTargetsPager returns a new SecurityGroupTargetsPager instance. -func (vpc *VpcV1) NewSecurityGroupTargetsPager(options *ListSecurityGroupTargetsOptions) (pager *SecurityGroupTargetsPager, err error) { +// NewNetworkACLRulesPager returns a new NetworkACLRulesPager instance. +func (vpc *VpcV1) NewNetworkACLRulesPager(options *ListNetworkACLRulesOptions) (pager *NetworkACLRulesPager, 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 ListSecurityGroupTargetsOptions = *options - pager = &SecurityGroupTargetsPager{ + var optionsCopy ListNetworkACLRulesOptions = *options + pager = &NetworkACLRulesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -138755,19 +135295,19 @@ func (vpc *VpcV1) NewSecurityGroupTargetsPager(options *ListSecurityGroupTargets } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *SecurityGroupTargetsPager) HasNext() bool { +func (pager *NetworkACLRulesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroupTargetReferenceIntf, err error) { +func (pager *NetworkACLRulesPager) GetNextWithContext(ctx context.Context) (page []NetworkACLRuleItemIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListSecurityGroupTargetsWithContext(ctx, pager.options) + result, _, err := pager.client.ListNetworkACLRulesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -138786,16 +135326,16 @@ func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Targets + page = result.Rules return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroupTargetReferenceIntf, err error) { +func (pager *NetworkACLRulesPager) GetAllWithContext(ctx context.Context) (allItems []NetworkACLRuleItemIntf, err error) { for pager.HasNext() { - var nextPage []SecurityGroupTargetReferenceIntf + var nextPage []NetworkACLRuleItemIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -138807,14 +135347,14 @@ func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) ( } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *SecurityGroupTargetsPager) GetNext() (page []SecurityGroupTargetReferenceIntf, err error) { +func (pager *NetworkACLRulesPager) GetNext() (page []NetworkACLRuleItemIntf, 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 *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTargetReferenceIntf, err error) { +func (pager *NetworkACLRulesPager) GetAll() (allItems []NetworkACLRuleItemIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -138912,6 +135452,98 @@ func (pager *SecurityGroupsPager) GetAll() (allItems []SecurityGroup, err error) return } +// SecurityGroupTargetsPager can be used to simplify the use of the "ListSecurityGroupTargets" method. +type SecurityGroupTargetsPager struct { + hasNext bool + options *ListSecurityGroupTargetsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewSecurityGroupTargetsPager returns a new SecurityGroupTargetsPager instance. +func (vpc *VpcV1) NewSecurityGroupTargetsPager(options *ListSecurityGroupTargetsOptions) (pager *SecurityGroupTargetsPager, 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 ListSecurityGroupTargetsOptions = *options + pager = &SecurityGroupTargetsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SecurityGroupTargetsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SecurityGroupTargetsPager) GetNextWithContext(ctx context.Context) (page []SecurityGroupTargetReferenceIntf, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSecurityGroupTargetsWithContext(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.Targets + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SecurityGroupTargetsPager) GetAllWithContext(ctx context.Context) (allItems []SecurityGroupTargetReferenceIntf, err error) { + for pager.HasNext() { + var nextPage []SecurityGroupTargetReferenceIntf + 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 *SecurityGroupTargetsPager) GetNext() (page []SecurityGroupTargetReferenceIntf, 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 *SecurityGroupTargetsPager) GetAll() (allItems []SecurityGroupTargetReferenceIntf, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + // IkePoliciesPager can be used to simplify the use of the "ListIkePolicies" method. type IkePoliciesPager struct { hasNext bool @@ -139280,25 +135912,25 @@ func (pager *IpsecPolicyConnectionsPager) GetAll() (allItems []VPNGatewayConnect return } -// VPNGatewayConnectionsPager can be used to simplify the use of the "ListVPNGatewayConnections" method. -type VPNGatewayConnectionsPager struct { +// VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. +type VPNGatewaysPager struct { hasNext bool - options *ListVPNGatewayConnectionsOptions + options *ListVPNGatewaysOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNGatewayConnectionsPager returns a new VPNGatewayConnectionsPager instance. -func (vpc *VpcV1) NewVPNGatewayConnectionsPager(options *ListVPNGatewayConnectionsOptions) (pager *VPNGatewayConnectionsPager, err error) { +// NewVPNGatewaysPager returns a new VPNGatewaysPager instance. +func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *VPNGatewaysPager, 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 ListVPNGatewayConnectionsOptions = *options - pager = &VPNGatewayConnectionsPager{ + var optionsCopy ListVPNGatewaysOptions = *options + pager = &VPNGatewaysPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -139307,19 +135939,19 @@ func (vpc *VpcV1) NewVPNGatewayConnectionsPager(options *ListVPNGatewayConnectio } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNGatewayConnectionsPager) HasNext() bool { +func (pager *VPNGatewaysPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNGatewayConnectionsPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayConnectionIntf, err error) { +func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPNGatewayConnectionsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNGatewaysWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -139338,16 +135970,16 @@ func (pager *VPNGatewayConnectionsPager) GetNextWithContext(ctx context.Context) } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Connections + page = result.VPNGateways return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPNGatewayConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { +func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayIntf, err error) { for pager.HasNext() { - var nextPage []VPNGatewayConnectionIntf + var nextPage []VPNGatewayIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -139359,38 +135991,38 @@ func (pager *VPNGatewayConnectionsPager) GetAllWithContext(ctx context.Context) } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNGatewayConnectionsPager) GetNext() (page []VPNGatewayConnectionIntf, err error) { +func (pager *VPNGatewaysPager) GetNext() (page []VPNGatewayIntf, 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 *VPNGatewayConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, err error) { +func (pager *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VPNGatewaysPager can be used to simplify the use of the "ListVPNGateways" method. -type VPNGatewaysPager struct { +// VPNGatewayConnectionsPager can be used to simplify the use of the "ListVPNGatewayConnections" method. +type VPNGatewayConnectionsPager struct { hasNext bool - options *ListVPNGatewaysOptions + options *ListVPNGatewayConnectionsOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNGatewaysPager returns a new VPNGatewaysPager instance. -func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *VPNGatewaysPager, err error) { +// NewVPNGatewayConnectionsPager returns a new VPNGatewayConnectionsPager instance. +func (vpc *VpcV1) NewVPNGatewayConnectionsPager(options *ListVPNGatewayConnectionsOptions) (pager *VPNGatewayConnectionsPager, 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 ListVPNGatewaysOptions = *options - pager = &VPNGatewaysPager{ + var optionsCopy ListVPNGatewayConnectionsOptions = *options + pager = &VPNGatewayConnectionsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -139399,19 +136031,19 @@ func (vpc *VpcV1) NewVPNGatewaysPager(options *ListVPNGatewaysOptions) (pager *V } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNGatewaysPager) HasNext() bool { +func (pager *VPNGatewayConnectionsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayIntf, err error) { +func (pager *VPNGatewayConnectionsPager) GetNextWithContext(ctx context.Context) (page []VPNGatewayConnectionIntf, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPNGatewaysWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNGatewayConnectionsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -139430,16 +136062,16 @@ func (pager *VPNGatewaysPager) GetNextWithContext(ctx context.Context) (page []V } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.VPNGateways + page = result.Connections return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayIntf, err error) { +func (pager *VPNGatewayConnectionsPager) GetAllWithContext(ctx context.Context) (allItems []VPNGatewayConnectionIntf, err error) { for pager.HasNext() { - var nextPage []VPNGatewayIntf + var nextPage []VPNGatewayConnectionIntf nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -139451,38 +136083,38 @@ func (pager *VPNGatewaysPager) GetAllWithContext(ctx context.Context) (allItems } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNGatewaysPager) GetNext() (page []VPNGatewayIntf, err error) { +func (pager *VPNGatewayConnectionsPager) GetNext() (page []VPNGatewayConnectionIntf, 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 *VPNGatewaysPager) GetAll() (allItems []VPNGatewayIntf, err error) { +func (pager *VPNGatewayConnectionsPager) GetAll() (allItems []VPNGatewayConnectionIntf, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. -type VPNServerClientsPager struct { +// VPNServersPager can be used to simplify the use of the "ListVPNServers" method. +type VPNServersPager struct { hasNext bool - options *ListVPNServerClientsOptions + options *ListVPNServersOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNServerClientsPager returns a new VPNServerClientsPager instance. -func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) (pager *VPNServerClientsPager, err error) { +// NewVPNServersPager returns a new VPNServersPager instance. +func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPNServersPager, 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 ListVPNServerClientsOptions = *options - pager = &VPNServerClientsPager{ + var optionsCopy ListVPNServersOptions = *options + pager = &VPNServersPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -139491,19 +136123,19 @@ func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServerClientsPager) HasNext() bool { +func (pager *VPNServersPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (page []VPNServerClient, err error) { +func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VPNServer, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPNServerClientsWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNServersWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -139522,16 +136154,16 @@ func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Clients + page = result.VPNServers return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerClient, err error) { +func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems []VPNServer, err error) { for pager.HasNext() { - var nextPage []VPNServerClient + var nextPage []VPNServer nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -139543,38 +136175,38 @@ func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allI } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNServerClientsPager) GetNext() (page []VPNServerClient, err error) { +func (pager *VPNServersPager) GetNext() (page []VPNServer, 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 *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { +func (pager *VPNServersPager) GetAll() (allItems []VPNServer, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. -type VPNServerRoutesPager struct { +// VPNServerClientsPager can be used to simplify the use of the "ListVPNServerClients" method. +type VPNServerClientsPager struct { hasNext bool - options *ListVPNServerRoutesOptions + options *ListVPNServerClientsOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNServerRoutesPager returns a new VPNServerRoutesPager instance. -func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) (pager *VPNServerRoutesPager, err error) { +// NewVPNServerClientsPager returns a new VPNServerClientsPager instance. +func (vpc *VpcV1) NewVPNServerClientsPager(options *ListVPNServerClientsOptions) (pager *VPNServerClientsPager, 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 ListVPNServerRoutesOptions = *options - pager = &VPNServerRoutesPager{ + var optionsCopy ListVPNServerClientsOptions = *options + pager = &VPNServerClientsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -139583,19 +136215,19 @@ func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) ( } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServerRoutesPager) HasNext() bool { +func (pager *VPNServerClientsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page []VPNServerRoute, err error) { +func (pager *VPNServerClientsPager) GetNextWithContext(ctx context.Context) (page []VPNServerClient, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPNServerRoutesWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNServerClientsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -139614,16 +136246,16 @@ func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Routes + page = result.Clients return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerRoute, err error) { +func (pager *VPNServerClientsPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerClient, err error) { for pager.HasNext() { - var nextPage []VPNServerRoute + var nextPage []VPNServerClient nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -139635,38 +136267,38 @@ func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allIt } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNServerRoutesPager) GetNext() (page []VPNServerRoute, err error) { +func (pager *VPNServerClientsPager) GetNext() (page []VPNServerClient, 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 *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { +func (pager *VPNServerClientsPager) GetAll() (allItems []VPNServerClient, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// VPNServersPager can be used to simplify the use of the "ListVPNServers" method. -type VPNServersPager struct { +// VPNServerRoutesPager can be used to simplify the use of the "ListVPNServerRoutes" method. +type VPNServerRoutesPager struct { hasNext bool - options *ListVPNServersOptions + options *ListVPNServerRoutesOptions client *VpcV1 pageContext struct { next *string } } -// NewVPNServersPager returns a new VPNServersPager instance. -func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPNServersPager, err error) { +// NewVPNServerRoutesPager returns a new VPNServerRoutesPager instance. +func (vpc *VpcV1) NewVPNServerRoutesPager(options *ListVPNServerRoutesOptions) (pager *VPNServerRoutesPager, 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 ListVPNServersOptions = *options - pager = &VPNServersPager{ + var optionsCopy ListVPNServerRoutesOptions = *options + pager = &VPNServerRoutesPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -139675,19 +136307,19 @@ func (vpc *VpcV1) NewVPNServersPager(options *ListVPNServersOptions) (pager *VPN } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *VPNServersPager) HasNext() bool { +func (pager *VPNServerRoutesPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VPNServer, err error) { +func (pager *VPNServerRoutesPager) GetNextWithContext(ctx context.Context) (page []VPNServerRoute, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListVPNServersWithContext(ctx, pager.options) + result, _, err := pager.client.ListVPNServerRoutesWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -139706,16 +136338,16 @@ func (pager *VPNServersPager) GetNextWithContext(ctx context.Context) (page []VP } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.VPNServers + page = result.Routes return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems []VPNServer, err error) { +func (pager *VPNServerRoutesPager) GetAllWithContext(ctx context.Context) (allItems []VPNServerRoute, err error) { for pager.HasNext() { - var nextPage []VPNServer + var nextPage []VPNServerRoute nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -139727,14 +136359,14 @@ func (pager *VPNServersPager) GetAllWithContext(ctx context.Context) (allItems [ } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *VPNServersPager) GetNext() (page []VPNServer, err error) { +func (pager *VPNServerRoutesPager) GetNext() (page []VPNServerRoute, 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 *VPNServersPager) GetAll() (allItems []VPNServer, err error) { +func (pager *VPNServerRoutesPager) GetAll() (allItems []VPNServerRoute, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return @@ -139924,25 +136556,25 @@ func (pager *LoadBalancersPager) GetAll() (allItems []LoadBalancer, err error) { return } -// EndpointGatewayIpsPager can be used to simplify the use of the "ListEndpointGatewayIps" method. -type EndpointGatewayIpsPager struct { +// EndpointGatewaysPager can be used to simplify the use of the "ListEndpointGateways" method. +type EndpointGatewaysPager struct { hasNext bool - options *ListEndpointGatewayIpsOptions + options *ListEndpointGatewaysOptions client *VpcV1 pageContext struct { next *string } } -// NewEndpointGatewayIpsPager returns a new EndpointGatewayIpsPager instance. -func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOptions) (pager *EndpointGatewayIpsPager, err error) { +// NewEndpointGatewaysPager returns a new EndpointGatewaysPager instance. +func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) (pager *EndpointGatewaysPager, 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 ListEndpointGatewayIpsOptions = *options - pager = &EndpointGatewayIpsPager{ + var optionsCopy ListEndpointGatewaysOptions = *options + pager = &EndpointGatewaysPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -139951,19 +136583,19 @@ func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOpti } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *EndpointGatewayIpsPager) HasNext() bool { +func (pager *EndpointGatewaysPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { +func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (page []EndpointGateway, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListEndpointGatewayIpsWithContext(ctx, pager.options) + result, _, err := pager.client.ListEndpointGatewaysWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -139982,16 +136614,16 @@ func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (p } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.Ips + page = result.EndpointGateways return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { +func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []EndpointGateway, err error) { for pager.HasNext() { - var nextPage []ReservedIP + var nextPage []EndpointGateway nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -140003,38 +136635,38 @@ func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (al } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *EndpointGatewayIpsPager) GetNext() (page []ReservedIP, err error) { +func (pager *EndpointGatewaysPager) GetNext() (page []EndpointGateway, 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 *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error) { +func (pager *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return } -// EndpointGatewaysPager can be used to simplify the use of the "ListEndpointGateways" method. -type EndpointGatewaysPager struct { +// EndpointGatewayIpsPager can be used to simplify the use of the "ListEndpointGatewayIps" method. +type EndpointGatewayIpsPager struct { hasNext bool - options *ListEndpointGatewaysOptions + options *ListEndpointGatewayIpsOptions client *VpcV1 pageContext struct { next *string } } -// NewEndpointGatewaysPager returns a new EndpointGatewaysPager instance. -func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) (pager *EndpointGatewaysPager, err error) { +// NewEndpointGatewayIpsPager returns a new EndpointGatewayIpsPager instance. +func (vpc *VpcV1) NewEndpointGatewayIpsPager(options *ListEndpointGatewayIpsOptions) (pager *EndpointGatewayIpsPager, 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 ListEndpointGatewaysOptions = *options - pager = &EndpointGatewaysPager{ + var optionsCopy ListEndpointGatewayIpsOptions = *options + pager = &EndpointGatewayIpsPager{ hasNext: true, options: &optionsCopy, client: vpc, @@ -140043,19 +136675,19 @@ func (vpc *VpcV1) NewEndpointGatewaysPager(options *ListEndpointGatewaysOptions) } // HasNext returns true if there are potentially more results to be retrieved. -func (pager *EndpointGatewaysPager) HasNext() bool { +func (pager *EndpointGatewayIpsPager) HasNext() bool { return pager.hasNext } // GetNextWithContext returns the next page of results using the specified Context. -func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (page []EndpointGateway, err error) { +func (pager *EndpointGatewayIpsPager) GetNextWithContext(ctx context.Context) (page []ReservedIP, err error) { if !pager.HasNext() { return nil, fmt.Errorf("no more results available") } pager.options.Start = pager.pageContext.next - result, _, err := pager.client.ListEndpointGatewaysWithContext(ctx, pager.options) + result, _, err := pager.client.ListEndpointGatewayIpsWithContext(ctx, pager.options) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") return @@ -140074,16 +136706,16 @@ func (pager *EndpointGatewaysPager) GetNextWithContext(ctx context.Context) (pag } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.EndpointGateways + page = result.Ips return } // GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly // until all pages of results have been retrieved. -func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []EndpointGateway, err error) { +func (pager *EndpointGatewayIpsPager) GetAllWithContext(ctx context.Context) (allItems []ReservedIP, err error) { for pager.HasNext() { - var nextPage []EndpointGateway + var nextPage []ReservedIP nextPage, err = pager.GetNextWithContext(ctx) if err != nil { err = core.RepurposeSDKProblem(err, "error-getting-next-page") @@ -140095,14 +136727,14 @@ func (pager *EndpointGatewaysPager) GetAllWithContext(ctx context.Context) (allI } // GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. -func (pager *EndpointGatewaysPager) GetNext() (page []EndpointGateway, err error) { +func (pager *EndpointGatewayIpsPager) GetNext() (page []ReservedIP, 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 *EndpointGatewaysPager) GetAll() (allItems []EndpointGateway, err error) { +func (pager *EndpointGatewayIpsPager) GetAll() (allItems []ReservedIP, err error) { allItems, err = pager.GetAllWithContext(context.Background()) err = core.RepurposeSDKProblem(err, "") return From 0a715aee5f1836ca518dc9df149a45bea806fd03 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Fri, 4 Oct 2024 18:24:42 +0530 Subject: [PATCH 095/103] updated the sdk --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 6025 +++++++++++++++-- go.mod | 2 +- 2 files changed, 5532 insertions(+), 495 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 0f7d12d101..f4530c945d 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -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-04-30 +// API Version: 2024-10-04 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-09-11`. + // and `2024-10-04`. Version *string } @@ -68,7 +68,7 @@ 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-09-11`. + // and `2024-10-04`. Version *string } @@ -133,7 +133,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2024-09-10") + options.Version = core.StringPtr("2024-10-01") } service = &VpcV1{ Service: baseService, @@ -371,9 +371,10 @@ func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *Cr // This request deletes a VPC. This operation cannot be reversed. // // For this request to succeed: -// - Instances, subnets, public gateways, and endpoint gateways must not reside in this VPC -// - The VPC must not be providing DNS resolution for any other VPCs -// - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero +// - Instances, subnets, public gateways, endpoint gateways, and private path service +// gateways must not reside in this VPC +// - The VPC must not be providing DNS resolution for any other VPCs +// - If `dns.enable_hub` is `true`, `dns.resolution_binding_count` must be zero // // All security groups and network ACLs associated with the VPC are automatically deleted. All flow log collectors with // `auto_delete` set to `true` targeting the VPC or any resource in the VPC are automatically deleted. @@ -2141,6 +2142,9 @@ func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRo // CreateVPCRoutingTable : Create a routing table for a VPC // This request creates a routing table from a routing table prototype object. The prototype object is structured in the // same way as a retrieved routing table, and contains the information necessary to create the new routing table. +// +// At present, the routing table's `resource_group` will be inherited from its VPC, but may be specifiable in the +// future. func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { result, response, err = vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) err = core.RepurposeSDKProblem(err, "") @@ -11041,8 +11045,8 @@ func (vpc *VpcV1) ActivateReservationWithContext(ctx context.Context, activateRe } // ListDedicatedHostGroups : List dedicated host groups -// This request lists dedicated host groups in the region. Host groups are a collection of dedicated hosts for placement -// of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. +// This request lists dedicated host groups in the region. Each dedicated host must belong to exactly one group, which +// controls placement of instances. Dedicated host groups do not span zones. func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { result, response, err = vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) err = core.RepurposeSDKProblem(err, "") @@ -21813,7 +21817,8 @@ func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkAC // 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 information is not applicable to the rule's protocol. +// 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, "") @@ -22579,8 +22584,8 @@ func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecuri // 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 information is not applicable to the -// rule's protocol. +// 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, "") @@ -26589,6 +26594,9 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB 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 } @@ -29029,6 +29037,9 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo 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)) } @@ -30077,8 +30088,1335 @@ 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) + 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") + 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, `/private_path_service_gateways`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listPrivatePathServiceGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGateways") + 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 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 { + 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_gateways", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + 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 +} + +// 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 +} + +// 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 + } + + 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 + } + + for headerName, headerValue := range createPrivatePathServiceGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + 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 + } + + 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", 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 + } + + 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) + 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") + 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 + } + + pathParamsMap := map[string]string{ + "id": *deletePrivatePathServiceGatewayOptions.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) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deletePrivatePathServiceGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePrivatePathServiceGateway") + 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", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + 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) + 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") + 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 + } + + pathParamsMap := map[string]string{ + "id": *getPrivatePathServiceGatewayOptions.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) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getPrivatePathServiceGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGateway") + 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", 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 + } + + 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) + 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") + 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 + } + + pathParamsMap := map[string]string{ + "id": *updatePrivatePathServiceGatewayOptions.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) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range updatePrivatePathServiceGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + _, err = builder.SetBodyContentJSON(updatePrivatePathServiceGatewayOptions.PrivatePathServiceGatewayPatch) + 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", 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 + } + + 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) + 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") + 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) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listPrivatePathServiceGatewayAccountPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + 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-04-30") + return core.NewProblemComponent(DefaultServiceName, "2024-10-01") +} + +// 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 @@ -30525,7 +31863,7 @@ func UnmarshalAddressPrefix(m map[string]json.RawMessage, result interface{}) (e // AddressPrefixCollection : AddressPrefixCollection struct type AddressPrefixCollection struct { - // Collection of address prefixes. + // A page of address prefixes for the VPC. AddressPrefixes []AddressPrefix `json:"address_prefixes" validate:"required"` // A link to the first page of resources. @@ -30886,7 +32224,7 @@ func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (er // BackupPolicyCollection : BackupPolicyCollection struct type BackupPolicyCollection struct { - // Collection of backup policies. + // A page of backup policies. BackupPolicies []BackupPolicyIntf `json:"backup_policies" validate:"required"` // A link to the first page of resources. @@ -31185,7 +32523,7 @@ type BackupPolicyJobCollection struct { // A link to the first page of resources. First *BackupPolicyJobCollectionFirst `json:"first" validate:"required"` - // Collection of backup policy jobs. + // 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. @@ -31372,9 +32710,13 @@ func UnmarshalBackupPolicyJobSource(m map[string]json.RawMessage, result interfa 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. @@ -31389,18 +32731,25 @@ type BackupPolicyJobStatusReason struct { // Constants associated with the BackupPolicyJobStatusReason.Code property. // A reason code for the status: -// - `internal_error`: Internal error (contact IBM support) -// - `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) +// - `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" - BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" - BackupPolicyJobStatusReasonCodeSnapshotVolumeLimitConst = "snapshot_volume_limit" - BackupPolicyJobStatusReasonCodeSourceVolumeBusyConst = "source_volume_busy" + 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. @@ -31719,7 +33068,7 @@ type BackupPolicyPlanCollection struct { // except the last page. Next *BackupPolicyPlanCollectionNext `json:"next,omitempty"` - // Collection of backup policy plans. + // A page of plans for the backup policy. Plans []BackupPolicyPlan `json:"plans" validate:"required"` // The total number of resources across all pages. @@ -32804,7 +34153,7 @@ func UnmarshalBareMetalServerCpu(m map[string]json.RawMessage, result interface{ // BareMetalServerCollection : BareMetalServerCollection struct type BareMetalServerCollection struct { - // Collection of bare metal servers. + // A page of bare metal servers. BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` // A link to the first page of resources. @@ -33064,7 +34413,7 @@ func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface // BareMetalServerDiskCollection : BareMetalServerDiskCollection struct type BareMetalServerDiskCollection struct { - // Collection of the bare metal server's disks. + // The disks for the bare metal server. Disks []BareMetalServerDisk `json:"disks" validate:"required"` } @@ -33554,7 +34903,7 @@ type BareMetalServerNetworkAttachmentCollection struct { // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` - // Collection of bare metal server network attachments. + // 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 @@ -34357,7 +35706,7 @@ type BareMetalServerNetworkInterfaceCollection struct { // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` - // Collection of bare metal server network interfaces. + // 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 @@ -34979,7 +36328,7 @@ type BareMetalServerProfile struct { CpuSocketCount BareMetalServerProfileCpuSocketCountIntf `json:"cpu_socket_count" validate:"required"` - // Collection of the bare metal server profile's disks. + // 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. @@ -35409,7 +36758,7 @@ type BareMetalServerProfileCollection struct { // except the last page. Next *BareMetalServerProfileCollectionNext `json:"next,omitempty"` - // Collection of bare metal server profiles. + // A page of bare metal server profiles. Profiles []BareMetalServerProfile `json:"profiles" validate:"required"` // The total number of resources across all pages. @@ -37291,8 +38640,10 @@ func (options *CreateDedicatedHostOptions) SetHeaders(param map[string]string) * // CreateEndpointGatewayOptions : The CreateEndpointGateway options. type CreateEndpointGatewayOptions struct { - // The target to use for this endpoint gateway. Must not already be the target of another - // endpoint gateway in the VPC. + // The target to use for this endpoint gateway. The target: + // - Must not already be the target of another endpoint gateway in the VPC + // - Must not have a service endpoint that duplicates or overlaps with any `service_endpoints` + // of another endpoint gateway in the VPC. Target EndpointGatewayTargetPrototypeIntf `json:"target" validate:"required"` // The VPC this endpoint gateway will reside in. @@ -38558,9 +39909,9 @@ type CreateLoadBalancerListenerOptions struct { // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `65535` must be specified. + // Only load balancers with route mode enabled, or network load balancers with + // `is_public` or `is_private_path` set to `true` support different values for `port_min` and `port_max`. When route + // mode is enabled, the value `65535` must be specified. // // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the // same protocol. @@ -38568,9 +39919,9 @@ type CreateLoadBalancerListenerOptions struct { // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `1` must be specified. + // Only load balancers with route mode enabled, or network load balancers with + // `is_public` or `is_private_path` set to `true` support different values for `port_min` and `port_max`. When route + // mode is enabled, the value `1` must be specified. // // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the // same protocol. @@ -38823,19 +40174,16 @@ type CreateLoadBalancerListenerPolicyRuleOptions struct { // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. Type *string `json:"type" validate:"required"` - // Value to be matched for rule condition. + // The value to be matched for the rule condition. // // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. Value *string `json:"value" validate:"required"` - // The field. This is applicable to `header`, `query`, and `body` rule types. - // - // If the rule type is `header`, this property is required. - // - // If the rule type is `query`, this is optional. If specified and the rule condition is not - // `matches_regex`, the value must be percent-encoded. + // The field to match for this rule. This property must be specified if the rule type is + // `header`, may be specified if the rule type is `body` or `query`, and must not be specified if the rule type is + // `hostname` or `path`. // - // If the rule type is `body`, this is optional. + // 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 @@ -38926,11 +40274,16 @@ func (options *CreateLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map type CreateLoadBalancerOptions struct { // Indicates whether this load balancer is public. // - // At present, if route mode is enabled, the load balancer must not be public. + // At present, + // - If route mode is enabled, the load balancer must be private. + // - If `is_private_path` is specified, it must be set to `false`. IsPublic *bool `json:"is_public" validate:"required"` - // The subnets to provision this load balancer in. The subnets must be in the same VPC. The load balancer's - // availability will depend on the availability of the zones that the subnets reside in. + // The subnets to provision this load balancer in. The subnets must be in the same VPC. + // - If 'availability' is specified as `subnet` in the profile, the load balancer's availability will depend on the + // availability of the zones that the subnets reside in. + // - If 'availability' is specified as `region` in the profile, the load balancer remains available as long as any zone + // in the region is available. Only members in healthy zones will be sent new connections. // // Load balancers in the `network` family allow only one subnet to be specified. Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` @@ -38940,8 +40293,13 @@ type CreateLoadBalancerOptions struct { // If unspecified, DNS `A` records for this load balancer's `hostname` property will be added // to the public DNS zone `lb.appdomain.cloud`. Otherwise, those DNS `A` records will be // added to the specified `zone`. + // + // Not supported by private path load balancers. Dns *LoadBalancerDnsPrototype `json:"dns,omitempty"` + // Indicates whether this is a private path load balancer. + IsPrivatePath *bool `json:"is_private_path,omitempty"` + // The listeners of this load balancer. Listeners []LoadBalancerListenerPrototypeLoadBalancerContext `json:"listeners,omitempty"` @@ -39008,6 +40366,12 @@ func (_options *CreateLoadBalancerOptions) SetDns(dns *LoadBalancerDnsPrototype) return _options } +// SetIsPrivatePath : Allow user to set IsPrivatePath +func (_options *CreateLoadBalancerOptions) SetIsPrivatePath(isPrivatePath bool) *CreateLoadBalancerOptions { + _options.IsPrivatePath = core.BoolPtr(isPrivatePath) + return _options +} + // SetListeners : Allow user to set Listeners func (_options *CreateLoadBalancerOptions) SetListeners(listeners []LoadBalancerListenerPrototypeLoadBalancerContext) *CreateLoadBalancerOptions { _options.Listeners = listeners @@ -39086,8 +40450,9 @@ type CreateLoadBalancerPoolMemberOptions struct { // subnet in. Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` - // Weight of the server member. Applicable only if the pool algorithm is - // `weighted_round_robin`. + // The weight of the server member. + // + // If specified, the pool algorithm must be `weighted_round_robin`. Weight *int64 `json:"weight,omitempty"` // Allows users to set headers on API requests @@ -39145,7 +40510,8 @@ type CreateLoadBalancerPoolOptions struct { // The load balancer identifier. LoadBalancerID *string `json:"load_balancer_id" validate:"required,ne="` - // 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" validate:"required"` // The health monitor of this pool. @@ -39172,9 +40538,10 @@ type CreateLoadBalancerPoolOptions struct { // Supported by load balancers in the `application` family (otherwise always `disabled`). ProxyProtocol *string `json:"proxy_protocol,omitempty"` - // The session persistence of this pool. If unspecified, session persistence will be - // disabled, and traffic will be distributed across backend server members of the - // pool. + // The session persistence of this pool. If specified, the load balancer must have + // `source_ip_session_persistence_supported` set to `true` in its profile. If + // unspecified, session persistence will be disabled, and traffic will be distributed + // across backend server members of the pool. SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` // Allows users to set headers on API requests @@ -39182,7 +40549,8 @@ type CreateLoadBalancerPoolOptions struct { } // Constants associated with the CreateLoadBalancerPoolOptions.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 ( CreateLoadBalancerPoolOptionsAlgorithmLeastConnectionsConst = "least_connections" CreateLoadBalancerPoolOptionsAlgorithmRoundRobinConst = "round_robin" @@ -39408,6 +40776,178 @@ func (options *CreatePlacementGroupOptions) SetHeaders(param map[string]string) return options } +// CreatePrivatePathServiceGatewayAccountPolicyOptions : The CreatePrivatePathServiceGatewayAccountPolicy options. +type CreatePrivatePathServiceGatewayAccountPolicyOptions struct { + // The private path service gateway identifier. + PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="` + + // The access policy for the account. Updating the access policy only affects pending and future endpoint gateway + // bindings. + // - permit: access will be permitted + // - deny: access will be denied + // - review: access will be manually reviewed + // + // - Updating to `review` sets the status of future endpoint gateway bindings from + // this account to `pending`. + // - Updating to `permit` updates both the status of any `pending` and future endpoint + // gateway bindings from this account to `permitted`. + // - Updating to `deny` updates both the status of any `pending` and future endpoint + // gateway bindings from this account to `denied`. + AccessPolicy *string `json:"access_policy" validate:"required"` + + // The account for this access policy. The account must be unique across all account + // policies for this private path service gateway. + Account AccountIdentityIntf `json:"account" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreatePrivatePathServiceGatewayAccountPolicyOptions.AccessPolicy property. +// The access policy for the account. Updating the access policy only affects pending and future endpoint gateway +// bindings. +// - permit: access will be permitted +// - deny: access will be denied +// - review: access will be manually reviewed +// +// - Updating to `review` sets the status of future endpoint gateway bindings from +// this account to `pending`. +// - Updating to `permit` updates both the status of any `pending` and future endpoint +// gateway bindings from this account to `permitted`. +// - Updating to `deny` updates both the status of any `pending` and future endpoint +// gateway bindings from this account to `denied`. +const ( + CreatePrivatePathServiceGatewayAccountPolicyOptionsAccessPolicyDenyConst = "deny" + CreatePrivatePathServiceGatewayAccountPolicyOptionsAccessPolicyPermitConst = "permit" + CreatePrivatePathServiceGatewayAccountPolicyOptionsAccessPolicyReviewConst = "review" +) + +// NewCreatePrivatePathServiceGatewayAccountPolicyOptions : Instantiate CreatePrivatePathServiceGatewayAccountPolicyOptions +func (*VpcV1) NewCreatePrivatePathServiceGatewayAccountPolicyOptions(privatePathServiceGatewayID string, accessPolicy string, account AccountIdentityIntf) *CreatePrivatePathServiceGatewayAccountPolicyOptions { + return &CreatePrivatePathServiceGatewayAccountPolicyOptions{ + PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID), + AccessPolicy: core.StringPtr(accessPolicy), + Account: account, + } +} + +// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID +func (_options *CreatePrivatePathServiceGatewayAccountPolicyOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *CreatePrivatePathServiceGatewayAccountPolicyOptions { + _options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID) + return _options +} + +// SetAccessPolicy : Allow user to set AccessPolicy +func (_options *CreatePrivatePathServiceGatewayAccountPolicyOptions) SetAccessPolicy(accessPolicy string) *CreatePrivatePathServiceGatewayAccountPolicyOptions { + _options.AccessPolicy = core.StringPtr(accessPolicy) + return _options +} + +// SetAccount : Allow user to set Account +func (_options *CreatePrivatePathServiceGatewayAccountPolicyOptions) SetAccount(account AccountIdentityIntf) *CreatePrivatePathServiceGatewayAccountPolicyOptions { + _options.Account = account + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreatePrivatePathServiceGatewayAccountPolicyOptions) SetHeaders(param map[string]string) *CreatePrivatePathServiceGatewayAccountPolicyOptions { + options.Headers = param + return options +} + +// CreatePrivatePathServiceGatewayOptions : The CreatePrivatePathServiceGateway options. +type CreatePrivatePathServiceGatewayOptions struct { + // The load balancer for this private path service gateway. The load balancer must + // have `is_private_path` set to `true`. + // + // The private path service gateway will reside in the same VPC as the specified load + // balancer. + LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer" validate:"required"` + + // The fully qualified domain names for this private path service gateway. Any uppercase letters will be converted to + // lowercase. + ServiceEndpoints []string `json:"service_endpoints" validate:"required"` + + // The policy to use for bindings from accounts without an explicit account policy. + DefaultAccessPolicy *string `json:"default_access_policy,omitempty"` + + // The name for this private path service gateway. The name must not be used by another private path service gateway in + // the VPC. 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"` + + // Indicates whether this private path service gateway has zonal affinity. + // - `true`: Traffic to the service from a zone the service resides in will remain in + // that zone. + // - `false`: Traffic to the service from a zone will be load balanced across all zones + // in the region the service resides in. + ZonalAffinity *bool `json:"zonal_affinity,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreatePrivatePathServiceGatewayOptions.DefaultAccessPolicy property. +// The policy to use for bindings from accounts without an explicit account policy. +const ( + CreatePrivatePathServiceGatewayOptionsDefaultAccessPolicyDenyConst = "deny" + CreatePrivatePathServiceGatewayOptionsDefaultAccessPolicyPermitConst = "permit" + CreatePrivatePathServiceGatewayOptionsDefaultAccessPolicyReviewConst = "review" +) + +// NewCreatePrivatePathServiceGatewayOptions : Instantiate CreatePrivatePathServiceGatewayOptions +func (*VpcV1) NewCreatePrivatePathServiceGatewayOptions(loadBalancer LoadBalancerIdentityIntf, serviceEndpoints []string) *CreatePrivatePathServiceGatewayOptions { + return &CreatePrivatePathServiceGatewayOptions{ + LoadBalancer: loadBalancer, + ServiceEndpoints: serviceEndpoints, + } +} + +// SetLoadBalancer : Allow user to set LoadBalancer +func (_options *CreatePrivatePathServiceGatewayOptions) SetLoadBalancer(loadBalancer LoadBalancerIdentityIntf) *CreatePrivatePathServiceGatewayOptions { + _options.LoadBalancer = loadBalancer + return _options +} + +// SetServiceEndpoints : Allow user to set ServiceEndpoints +func (_options *CreatePrivatePathServiceGatewayOptions) SetServiceEndpoints(serviceEndpoints []string) *CreatePrivatePathServiceGatewayOptions { + _options.ServiceEndpoints = serviceEndpoints + return _options +} + +// SetDefaultAccessPolicy : Allow user to set DefaultAccessPolicy +func (_options *CreatePrivatePathServiceGatewayOptions) SetDefaultAccessPolicy(defaultAccessPolicy string) *CreatePrivatePathServiceGatewayOptions { + _options.DefaultAccessPolicy = core.StringPtr(defaultAccessPolicy) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreatePrivatePathServiceGatewayOptions) SetName(name string) *CreatePrivatePathServiceGatewayOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreatePrivatePathServiceGatewayOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePrivatePathServiceGatewayOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetZonalAffinity : Allow user to set ZonalAffinity +func (_options *CreatePrivatePathServiceGatewayOptions) SetZonalAffinity(zonalAffinity bool) *CreatePrivatePathServiceGatewayOptions { + _options.ZonalAffinity = core.BoolPtr(zonalAffinity) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreatePrivatePathServiceGatewayOptions) SetHeaders(param map[string]string) *CreatePrivatePathServiceGatewayOptions { + options.Headers = param + return options +} + // CreatePublicGatewayOptions : The CreatePublicGateway options. type CreatePublicGatewayOptions struct { // The VPC this public gateway will reside in. @@ -41265,7 +42805,7 @@ type DedicatedHost struct { // The CRN for this dedicated host. CRN *string `json:"crn" validate:"required"` - // Collection of the dedicated host's disks. + // The disks for the dedicated host. Disks []DedicatedHostDisk `json:"disks" validate:"required"` // The dedicated host group this dedicated host is in. @@ -41481,7 +43021,7 @@ func UnmarshalDedicatedHost(m map[string]json.RawMessage, result interface{}) (e // DedicatedHostCollection : DedicatedHostCollection struct type DedicatedHostCollection struct { - // Collection of dedicated hosts. + // A page of dedicated hosts. DedicatedHosts []DedicatedHost `json:"dedicated_hosts" validate:"required"` // A link to the first page of resources. @@ -41729,7 +43269,7 @@ func UnmarshalDedicatedHostDisk(m map[string]json.RawMessage, result interface{} // DedicatedHostDiskCollection : DedicatedHostDiskCollection struct type DedicatedHostDiskCollection struct { - // Collection of the dedicated host's disks. + // The disks for the dedicated host. Disks []DedicatedHostDisk `json:"disks" validate:"required"` } @@ -41901,7 +43441,7 @@ type DedicatedHostGroupCollection struct { // A link to the first page of resources. First *DedicatedHostGroupCollectionFirst `json:"first" validate:"required"` - // Collection of dedicated host groups. + // A page of dedicated host groups. Groups []DedicatedHostGroup `json:"groups" validate:"required"` // The maximum number of resources that can be returned by the request. @@ -42263,7 +43803,7 @@ type DedicatedHostProfile struct { // The product class this dedicated host profile belongs to. Class *string `json:"class" validate:"required"` - // Collection of the dedicated host profile's disks. + // The disks for a dedicated host with this profile. Disks []DedicatedHostProfileDisk `json:"disks" validate:"required"` // The product family this dedicated host profile belongs to @@ -42412,7 +43952,7 @@ type DedicatedHostProfileCollection struct { // except the last page. Next *DedicatedHostProfileCollectionNext `json:"next,omitempty"` - // Collection of dedicated host profiles. + // A page of dedicated host profiles. Profiles []DedicatedHostProfile `json:"profiles" validate:"required"` // The total number of resources across all pages. @@ -43314,6 +44854,9 @@ type DefaultRoutingTable struct { // The date and time that this routing table was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + // The CRN for this VPC routing table. + CRN *string `json:"crn" validate:"required"` + // The URL for this routing table. Href *string `json:"href" validate:"required"` @@ -43330,6 +44873,9 @@ type DefaultRoutingTable struct { // words at creation, but may be changed. Name *string `json:"name" validate:"required"` + // The resource group for this routing table. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + // The resource type. ResourceType *string `json:"resource_type" validate:"required"` @@ -43425,6 +44971,11 @@ func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface 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) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -43450,6 +45001,11 @@ func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface err = core.SDKErrorf(err, "", "name-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()) @@ -44848,6 +46404,72 @@ func (options *DeletePlacementGroupOptions) SetHeaders(param map[string]string) return options } +// DeletePrivatePathServiceGatewayAccountPolicyOptions : The DeletePrivatePathServiceGatewayAccountPolicy options. +type DeletePrivatePathServiceGatewayAccountPolicyOptions struct { + // The private path service gateway identifier. + PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="` + + // The account policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeletePrivatePathServiceGatewayAccountPolicyOptions : Instantiate DeletePrivatePathServiceGatewayAccountPolicyOptions +func (*VpcV1) NewDeletePrivatePathServiceGatewayAccountPolicyOptions(privatePathServiceGatewayID string, id string) *DeletePrivatePathServiceGatewayAccountPolicyOptions { + return &DeletePrivatePathServiceGatewayAccountPolicyOptions{ + PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID), + ID: core.StringPtr(id), + } +} + +// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID +func (_options *DeletePrivatePathServiceGatewayAccountPolicyOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *DeletePrivatePathServiceGatewayAccountPolicyOptions { + _options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeletePrivatePathServiceGatewayAccountPolicyOptions) SetID(id string) *DeletePrivatePathServiceGatewayAccountPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeletePrivatePathServiceGatewayAccountPolicyOptions) SetHeaders(param map[string]string) *DeletePrivatePathServiceGatewayAccountPolicyOptions { + options.Headers = param + return options +} + +// DeletePrivatePathServiceGatewayOptions : The DeletePrivatePathServiceGateway options. +type DeletePrivatePathServiceGatewayOptions struct { + // The private path service gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeletePrivatePathServiceGatewayOptions : Instantiate DeletePrivatePathServiceGatewayOptions +func (*VpcV1) NewDeletePrivatePathServiceGatewayOptions(id string) *DeletePrivatePathServiceGatewayOptions { + return &DeletePrivatePathServiceGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeletePrivatePathServiceGatewayOptions) SetID(id string) *DeletePrivatePathServiceGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeletePrivatePathServiceGatewayOptions) SetHeaders(param map[string]string) *DeletePrivatePathServiceGatewayOptions { + options.Headers = param + return options +} + // DeletePublicGatewayOptions : The DeletePublicGateway options. type DeletePublicGatewayOptions struct { // The public gateway identifier. @@ -45855,6 +47477,63 @@ func UnmarshalDeleted(m map[string]json.RawMessage, result interface{}) (err err return } +// DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions : The DenyPrivatePathServiceGatewayEndpointGatewayBinding options. +type DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions struct { + // The private path service gateway identifier. + PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="` + + // The endpoint gateway binding identifier. + ID *string `json:"id" validate:"required,ne="` + + // Indicates whether this will become the access policy for any `pending` and future endpoint gateway bindings from the + // same account. + // + // If set to `true`: + // - If the account has an existing access policy, that policy will be updated to `deny`. + // Otherwise, a new `deny` access policy will be created for the account. + // - All `pending` endpoint gateway bindings for the account will be denied. + // + // If set to `false`: + // - No access policies will be created or updated + // - 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 + Headers map[string]string +} + +// NewDenyPrivatePathServiceGatewayEndpointGatewayBindingOptions : Instantiate DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions +func (*VpcV1) NewDenyPrivatePathServiceGatewayEndpointGatewayBindingOptions(privatePathServiceGatewayID string, id string) *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions { + return &DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions{ + PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID), + ID: core.StringPtr(id), + } +} + +// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID +func (_options *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions { + _options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetID(id string) *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSetAccountPolicy : Allow user to set SetAccountPolicy +func (_options *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetSetAccountPolicy(setAccountPolicy bool) *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions { + _options.SetAccountPolicy = core.BoolPtr(setAccountPolicy) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetHeaders(param map[string]string) *DenyPrivatePathServiceGatewayEndpointGatewayBindingOptions { + options.Headers = param + return options +} + // DeprecateImageOptions : The DeprecateImage options. type DeprecateImageOptions struct { // The image identifier. @@ -46160,7 +47839,7 @@ func UnmarshalEndpointGateway(m map[string]json.RawMessage, result interface{}) // EndpointGatewayCollection : EndpointGatewayCollection struct type EndpointGatewayCollection struct { - // Collection of endpoint gateways. + // A page of endpoint gateways. EndpointGateways []EndpointGateway `json:"endpoint_gateways" validate:"required"` // A link to the first page of resources. @@ -46263,6 +47942,9 @@ func UnmarshalEndpointGatewayCollectionNext(m map[string]json.RawMessage, result // EndpointGatewayLifecycleReason : EndpointGatewayLifecycleReason struct type EndpointGatewayLifecycleReason struct { // A reason code for this lifecycle state: + // - `access_denied`: endpoint gateway access was denied + // - `access_expired`: endpoint gateway access has expired + // - `access_pending`: endpoint gateway access is pending // - `dns_resolution_binding_pending`: the DNS resolution binding is being set up // - `internal_error`: internal error (contact IBM support) // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM @@ -46281,6 +47963,9 @@ type EndpointGatewayLifecycleReason struct { // Constants associated with the EndpointGatewayLifecycleReason.Code property. // A reason code for this lifecycle state: +// - `access_denied`: endpoint gateway access was denied +// - `access_expired`: endpoint gateway access has expired +// - `access_pending`: endpoint gateway access is pending // - `dns_resolution_binding_pending`: the DNS resolution binding is being set up // - `internal_error`: internal error (contact IBM support) // - `resource_suspended_by_provider`: The resource has been suspended (contact IBM @@ -46289,6 +47974,9 @@ type EndpointGatewayLifecycleReason struct { // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( + EndpointGatewayLifecycleReasonCodeAccessDeniedConst = "access_denied" + EndpointGatewayLifecycleReasonCodeAccessExpiredConst = "access_expired" + EndpointGatewayLifecycleReasonCodeAccessPendingConst = "access_pending" EndpointGatewayLifecycleReasonCodeDnsResolutionBindingPendingConst = "dns_resolution_binding_pending" EndpointGatewayLifecycleReasonCodeInternalErrorConst = "internal_error" EndpointGatewayLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" @@ -46531,24 +48219,39 @@ func UnmarshalEndpointGatewayReservedIP(m map[string]json.RawMessage, result int // EndpointGatewayTarget : The target for this endpoint gateway. // Models which "extend" this model: +// - EndpointGatewayTargetPrivatePathServiceGatewayReference // - EndpointGatewayTargetProviderCloudServiceReference // - EndpointGatewayTargetProviderInfrastructureServiceReference type EndpointGatewayTarget struct { - // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + // The CRN for this private path service gateway. CRN *string `json:"crn,omitempty"` - // The type of target. - ResourceType *string `json:"resource_type,omitempty"` + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` - // The name of a provider infrastructure service. Must be: - // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + // The URL for this private path service gateway. + Href *string `json:"href,omitempty"` + + // The unique identifier for this private path service gateway. + ID *string `json:"id,omitempty"` + + // The name for this private path service gateway. The name is unique across all private path service gateways in the + // VPC. 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 *PrivatePathServiceGatewayRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` } // Constants associated with the EndpointGatewayTarget.ResourceType property. -// The type of target. +// The resource type. const ( - EndpointGatewayTargetResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" ) func (*EndpointGatewayTarget) isaEndpointGatewayTarget() bool { @@ -46567,9 +48270,19 @@ func UnmarshalEndpointGatewayTarget(m map[string]json.RawMessage, result interfa err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + 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) @@ -46577,31 +48290,45 @@ func UnmarshalEndpointGatewayTarget(m map[string]json.RawMessage, result interfa err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalPrivatePathServiceGatewayRemote) + 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 } -// EndpointGatewayTargetPrototype : The target to use for this endpoint gateway. Must not already be the target of another endpoint gateway in the VPC. +// EndpointGatewayTargetPrototype : The target to use for this endpoint gateway. The target: +// - Must not already be the target of another endpoint gateway in the VPC +// - Must not have a service endpoint that duplicates or overlaps with any `service_endpoints` +// of another endpoint gateway in the VPC. +// // Models which "extend" this model: -// - EndpointGatewayTargetPrototypeProviderCloudServiceIdentity -// - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity +// - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype +// - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype +// - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype type EndpointGatewayTargetPrototype struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` - - // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + // The CRN for this private path service gateway. CRN *string `json:"crn,omitempty"` + // The target resource type for this endpoint gateway. + ResourceType *string `json:"resource_type,omitempty"` + // The name of a provider infrastructure service. Must be: // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. Name *string `json:"name,omitempty"` } // Constants associated with the EndpointGatewayTargetPrototype.ResourceType property. -// The type of target for this endpoint gateway. +// The target resource type for this endpoint gateway. const ( - EndpointGatewayTargetPrototypeResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" + EndpointGatewayTargetPrototypeResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" ) func (*EndpointGatewayTargetPrototype) isaEndpointGatewayTargetPrototype() bool { @@ -46614,32 +48341,23 @@ type EndpointGatewayTargetPrototypeIntf interface { // UnmarshalEndpointGatewayTargetPrototype unmarshals an instance of EndpointGatewayTargetPrototype from the specified map of raw messages. func UnmarshalEndpointGatewayTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "resource_type", &discValue) + obj := new(EndpointGatewayTargetPrototype) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - errMsg := fmt.Sprintf("error unmarshalling discriminator property 'resource_type': %s", err.Error()) - err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - if discValue == "" { - err = core.SDKErrorf(err, "required discriminator property 'resource_type' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - if discValue == "provider_cloud_service" { - err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-EndpointGatewayTargetPrototypeProviderCloudServiceIdentity-error", common.GetComponentInfo()) - } - } else if discValue == "provider_infrastructure_service" { - err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity-error", common.GetComponentInfo()) - } - } else { - errMsg := fmt.Sprintf("unrecognized value for discriminator property 'resource_type': %s", discValue) - err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) + 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 } @@ -46812,7 +48530,7 @@ type FloatingIPCollection struct { // A link to the first page of resources. First *FloatingIPCollectionFirst `json:"first" validate:"required"` - // Collection of floating IPs. + // A page of floating IPs. FloatingIps []FloatingIP `json:"floating_ips" validate:"required"` // The maximum number of resources that can be returned by the request. @@ -46914,7 +48632,7 @@ type FloatingIPCollectionVirtualNetworkInterfaceContext struct { // A link to the first page of resources. First *FloatingIPCollectionVirtualNetworkInterfaceContextFirst `json:"first" validate:"required"` - // Collection of floating IPs bound to the virtual network interface specified by the identifier in the URL. + // 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"` // The maximum number of resources that can be returned by the request. @@ -47410,7 +49128,7 @@ func UnmarshalFloatingIPTargetPrototype(m map[string]json.RawMessage, result int // FloatingIPUnpaginatedCollection : FloatingIPUnpaginatedCollection struct type FloatingIPUnpaginatedCollection struct { - // Collection of floating IPs. + // The floating IPs. FloatingIps []FloatingIP `json:"floating_ips" validate:"required"` } @@ -47571,7 +49289,7 @@ type FlowLogCollectorCollection struct { // A link to the first page of resources. First *FlowLogCollectorCollectionFirst `json:"first" validate:"required"` - // Collection of flow log collectors. + // A page of flow log collectors. FlowLogCollectors []FlowLogCollector `json:"flow_log_collectors" validate:"required"` // The maximum number of resources that can be returned by the request. @@ -49731,6 +51449,110 @@ func (options *GetPlacementGroupOptions) SetHeaders(param map[string]string) *Ge return options } +// GetPrivatePathServiceGatewayAccountPolicyOptions : The GetPrivatePathServiceGatewayAccountPolicy options. +type GetPrivatePathServiceGatewayAccountPolicyOptions struct { + // The private path service gateway identifier. + PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="` + + // The account policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetPrivatePathServiceGatewayAccountPolicyOptions : Instantiate GetPrivatePathServiceGatewayAccountPolicyOptions +func (*VpcV1) NewGetPrivatePathServiceGatewayAccountPolicyOptions(privatePathServiceGatewayID string, id string) *GetPrivatePathServiceGatewayAccountPolicyOptions { + return &GetPrivatePathServiceGatewayAccountPolicyOptions{ + PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID), + ID: core.StringPtr(id), + } +} + +// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID +func (_options *GetPrivatePathServiceGatewayAccountPolicyOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *GetPrivatePathServiceGatewayAccountPolicyOptions { + _options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetPrivatePathServiceGatewayAccountPolicyOptions) SetID(id string) *GetPrivatePathServiceGatewayAccountPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetPrivatePathServiceGatewayAccountPolicyOptions) SetHeaders(param map[string]string) *GetPrivatePathServiceGatewayAccountPolicyOptions { + options.Headers = param + return options +} + +// GetPrivatePathServiceGatewayEndpointGatewayBindingOptions : The GetPrivatePathServiceGatewayEndpointGatewayBinding options. +type GetPrivatePathServiceGatewayEndpointGatewayBindingOptions struct { + // The private path service gateway identifier. + PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="` + + // The endpoint gateway binding identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetPrivatePathServiceGatewayEndpointGatewayBindingOptions : Instantiate GetPrivatePathServiceGatewayEndpointGatewayBindingOptions +func (*VpcV1) NewGetPrivatePathServiceGatewayEndpointGatewayBindingOptions(privatePathServiceGatewayID string, id string) *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions { + return &GetPrivatePathServiceGatewayEndpointGatewayBindingOptions{ + PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID), + ID: core.StringPtr(id), + } +} + +// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID +func (_options *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions { + _options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetID(id string) *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetHeaders(param map[string]string) *GetPrivatePathServiceGatewayEndpointGatewayBindingOptions { + options.Headers = param + return options +} + +// GetPrivatePathServiceGatewayOptions : The GetPrivatePathServiceGateway options. +type GetPrivatePathServiceGatewayOptions struct { + // The private path service gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetPrivatePathServiceGatewayOptions : Instantiate GetPrivatePathServiceGatewayOptions +func (*VpcV1) NewGetPrivatePathServiceGatewayOptions(id string) *GetPrivatePathServiceGatewayOptions { + return &GetPrivatePathServiceGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetPrivatePathServiceGatewayOptions) SetID(id string) *GetPrivatePathServiceGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetPrivatePathServiceGatewayOptions) SetHeaders(param map[string]string) *GetPrivatePathServiceGatewayOptions { + options.Headers = param + return options +} + // GetPublicGatewayOptions : The GetPublicGateway options. type GetPublicGatewayOptions struct { // The public gateway identifier. @@ -51153,7 +52975,7 @@ type IkePolicyCollection struct { // A link to the first page of resources. First *IkePolicyCollectionFirst `json:"first" validate:"required"` - // Collection of IKE policies. + // A page of IKE policies. IkePolicies []IkePolicy `json:"ike_policies" validate:"required"` // The maximum number of resources that can be returned by the request. @@ -51216,7 +53038,7 @@ func (resp *IkePolicyCollection) GetNextStart() (*string, error) { // IkePolicyConnectionCollection : IkePolicyConnectionCollection struct type IkePolicyConnectionCollection struct { - // Collection of VPN gateway connections that use a specified IKE policy specified by the identifier in the URL. + // A page of VPN gateway connections that use the IKE policy specified by the identifier in the URL. Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` // A link to the first page of resources. @@ -51663,7 +53485,7 @@ type IPsecPolicyCollection struct { // A link to the first page of resources. First *IPsecPolicyCollectionFirst `json:"first" validate:"required"` - // Collection of IPsec policies. + // A page of IPsec policies. IpsecPolicies []IPsecPolicy `json:"ipsec_policies" validate:"required"` // The maximum number of resources that can be returned by the request. @@ -51762,7 +53584,7 @@ func UnmarshalIPsecPolicyCollectionNext(m map[string]json.RawMessage, result int // IPsecPolicyConnectionCollection : IPsecPolicyConnectionCollection struct type IPsecPolicyConnectionCollection struct { - // Collection of VPN gateway connections that use a specified IPsec policy specified by the identifier in the URL. + // 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. @@ -52400,7 +54222,7 @@ type ImageCollection struct { // A link to the first page of resources. First *ImageCollectionFirst `json:"first" validate:"required"` - // Collection of images. + // A page of images. Images []Image `json:"images" validate:"required"` // The maximum number of resources that can be returned by the request. @@ -52753,7 +54575,7 @@ func UnmarshalImageExportJobStatusReason(m map[string]json.RawMessage, result in // ImageExportJobUnpaginatedCollection : ImageExportJobUnpaginatedCollection struct type ImageExportJobUnpaginatedCollection struct { - // Collection of image export jobs. + // The export jobs for the image. ExportJobs []ImageExportJob `json:"export_jobs" validate:"required"` } @@ -53346,6 +55168,9 @@ type Instance struct { LifecycleState *string `json:"lifecycle_state" validate:"required"` // The amount of memory, truncated to whole gibibytes. + // + // The maximum limit for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Memory *int64 `json:"memory" validate:"required"` // The metadata service configuration. @@ -53984,7 +55809,7 @@ type InstanceCollection struct { // A link to the first page of resources. First *InstanceCollectionFirst `json:"first" validate:"required"` - // Collection of virtual server instances. + // A page of virtual server instances. Instances []Instance `json:"instances" validate:"required"` // The maximum number of resources that can be returned by the request. @@ -54274,7 +56099,7 @@ func UnmarshalInstanceDisk(m map[string]json.RawMessage, result interface{}) (er // InstanceDiskCollection : InstanceDiskCollection struct type InstanceDiskCollection struct { - // Collection of the instance's disks. + // The disks for the instance. Disks []InstanceDisk `json:"disks" validate:"required"` } @@ -54604,7 +56429,7 @@ type InstanceGroupCollection struct { // A link to the first page of resources. First *InstanceGroupCollectionFirst `json:"first" validate:"required"` - // Collection of instance groups. + // A page of instance groups. InstanceGroups []InstanceGroup `json:"instance_groups" validate:"required"` // The maximum number of resources that can be returned by the request. @@ -54890,13 +56715,11 @@ func UnmarshalInstanceGroupManager(m map[string]json.RawMessage, result interfac // - InstanceGroupManagerActionScheduledAction type InstanceGroupManagerAction struct { // Indicates whether this scheduled action will be automatically deleted after it has completed and - // `auto_delete_timeout` hours have passed. At present, this is always - // `true`, but may be modifiable in the future. + // `auto_delete_timeout` hours have passed. AutoDelete *bool `json:"auto_delete" validate:"required"` // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically - // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the - // future. + // deleted. If the value is `0`, the action will be deleted once it has finished. AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` // The date and time that the instance group manager action was created. @@ -55108,6 +56931,14 @@ func UnmarshalInstanceGroupManagerActionManagerPatch(m map[string]json.RawMessag // InstanceGroupManagerActionPatch : InstanceGroupManagerActionPatch struct type InstanceGroupManagerActionPatch struct { + // Indicates whether this scheduled action will be automatically deleted after it has completed and + // `auto_delete_timeout` hours have passed. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically + // deleted. If the value is `0`, the action will be deleted once it has finished. + AutoDeleteTimeout *int64 `json:"auto_delete_timeout,omitempty"` + // The cron specification for a recurring scheduled action. Actions can be applied a maximum of one time within a 5 min // period. CronSpec *string `json:"cron_spec,omitempty"` @@ -55127,6 +56958,16 @@ type InstanceGroupManagerActionPatch struct { // UnmarshalInstanceGroupManagerActionPatch unmarshals an instance of InstanceGroupManagerActionPatch from the specified map of raw messages. func UnmarshalInstanceGroupManagerActionPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceGroupManagerActionPatch) + 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_timeout", &obj.AutoDeleteTimeout) + if err != nil { + err = core.SDKErrorf(err, "", "auto_delete_timeout-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) if err != nil { err = core.SDKErrorf(err, "", "cron_spec-error", common.GetComponentInfo()) @@ -55289,7 +57130,7 @@ func UnmarshalInstanceGroupManagerActionReference(m map[string]json.RawMessage, // InstanceGroupManagerActionsCollection : InstanceGroupManagerActionsCollection struct type InstanceGroupManagerActionsCollection struct { - // Collection of instance group manager actions. + // A page of actions for the instance group manager. Actions []InstanceGroupManagerActionIntf `json:"actions" validate:"required"` // A link to the first page of resources. @@ -55397,7 +57238,7 @@ type InstanceGroupManagerCollection struct { // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` - // Collection of instance group managers. + // A page of managers for the instance group. Managers []InstanceGroupManagerIntf `json:"managers" validate:"required"` // A link to the next page of resources. This property is present for all pages @@ -55674,7 +57515,7 @@ type InstanceGroupManagerPolicyCollection struct { // except the last page. Next *InstanceGroupManagerPolicyCollectionNext `json:"next,omitempty"` - // Collection of instance group manager policies. + // A page of policies for the instance group manager. Policies []InstanceGroupManagerPolicyIntf `json:"policies" validate:"required"` // The total number of resources across all pages. @@ -56344,7 +58185,7 @@ type InstanceGroupMembershipCollection struct { // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` - // Collection of instance group memberships. + // A page of memberships for the instance group. Memberships []InstanceGroupMembership `json:"memberships" validate:"required"` // A link to the next page of resources. This property is present for all pages @@ -56440,6 +58281,9 @@ func UnmarshalInstanceGroupMembershipCollectionNext(m map[string]json.RawMessage // InstanceGroupMembershipPatch : InstanceGroupMembershipPatch struct type InstanceGroupMembershipPatch struct { + // If set to true, when deleting the membership the instance will also be deleted. + DeleteInstanceOnMembershipDelete *bool `json:"delete_instance_on_membership_delete,omitempty"` + // The name for this instance group membership. The name must not be used by another membership for the instance group // manager. Name *string `json:"name,omitempty"` @@ -56448,6 +58292,11 @@ type InstanceGroupMembershipPatch struct { // UnmarshalInstanceGroupMembershipPatch unmarshals an instance of InstanceGroupMembershipPatch from the specified map of raw messages. func UnmarshalInstanceGroupMembershipPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(InstanceGroupMembershipPatch) + err = core.UnmarshalPrimitive(m, "delete_instance_on_membership_delete", &obj.DeleteInstanceOnMembershipDelete) + if err != nil { + err = core.SDKErrorf(err, "", "delete_instance_on_membership_delete-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) @@ -57094,7 +58943,7 @@ func UnmarshalInstanceNetworkAttachment(m map[string]json.RawMessage, result int // InstanceNetworkAttachmentCollection : InstanceNetworkAttachmentCollection struct type InstanceNetworkAttachmentCollection struct { - // Collection of instance network attachments. + // The network attachments for the instance. NetworkAttachments []InstanceNetworkAttachment `json:"network_attachments" validate:"required"` } @@ -57805,7 +59654,7 @@ type InstanceProfile struct { ConfidentialComputeModes *InstanceProfileSupportedConfidentialComputeModes `json:"confidential_compute_modes" validate:"required"` - // Collection of the instance profile's disks. + // The disks for an instance with this profile. Disks []InstanceProfileDisk `json:"disks" validate:"required"` // The product family this virtual server instance profile belongs to. @@ -58103,7 +59952,7 @@ func UnmarshalInstanceProfileBandwidth(m map[string]json.RawMessage, result inte // InstanceProfileCollection : InstanceProfileCollection struct type InstanceProfileCollection struct { - // Collection of virtual server instance profiles. + // A page of virtual server instance profiles. Profiles []InstanceProfile `json:"profiles" validate:"required"` } @@ -60195,7 +62044,7 @@ type InstanceTemplateCollection struct { // except the last page. Next *InstanceTemplateCollectionNext `json:"next,omitempty"` - // Collection of instance templates. + // A page of instance templates. Templates []InstanceTemplateIntf `json:"templates" validate:"required"` // The total number of resources across all pages. @@ -60801,7 +62650,7 @@ type KeyCollection struct { // A link to the first page of resources. First *KeyCollectionFirst `json:"first" validate:"required"` - // Collection of keys. + // A page of keys. Keys []Key `json:"keys" validate:"required"` // The maximum number of resources that can be returned by the request. @@ -61900,6 +63749,10 @@ type ListEndpointGatewaysOptions struct { // 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 `lifecycle_state` property matching one of the specified comma-separated + // values. + LifecycleState []string `json:"lifecycle_state,omitempty"` + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. VPCID *string `json:"vpc.id,omitempty"` @@ -61917,6 +63770,17 @@ type ListEndpointGatewaysOptions struct { Headers map[string]string } +// Constants associated with the ListEndpointGatewaysOptions.LifecycleState property. +const ( + ListEndpointGatewaysOptionsLifecycleStateDeletingConst = "deleting" + ListEndpointGatewaysOptionsLifecycleStateFailedConst = "failed" + ListEndpointGatewaysOptionsLifecycleStatePendingConst = "pending" + ListEndpointGatewaysOptionsLifecycleStateStableConst = "stable" + ListEndpointGatewaysOptionsLifecycleStateSuspendedConst = "suspended" + ListEndpointGatewaysOptionsLifecycleStateUpdatingConst = "updating" + ListEndpointGatewaysOptionsLifecycleStateWaitingConst = "waiting" +) + // NewListEndpointGatewaysOptions : Instantiate ListEndpointGatewaysOptions func (*VpcV1) NewListEndpointGatewaysOptions() *ListEndpointGatewaysOptions { return &ListEndpointGatewaysOptions{} @@ -61946,6 +63810,12 @@ func (_options *ListEndpointGatewaysOptions) SetResourceGroupID(resourceGroupID return _options } +// SetLifecycleState : Allow user to set LifecycleState +func (_options *ListEndpointGatewaysOptions) SetLifecycleState(lifecycleState []string) *ListEndpointGatewaysOptions { + _options.LifecycleState = lifecycleState + return _options +} + // SetVPCID : Allow user to set VPCID func (_options *ListEndpointGatewaysOptions) SetVPCID(vpcID string) *ListEndpointGatewaysOptions { _options.VPCID = core.StringPtr(vpcID) @@ -63653,6 +65523,179 @@ func (options *ListPlacementGroupsOptions) SetHeaders(param map[string]string) * return options } +// ListPrivatePathServiceGatewayAccountPoliciesOptions : The ListPrivatePathServiceGatewayAccountPolicies options. +type ListPrivatePathServiceGatewayAccountPoliciesOptions struct { + // The private path service gateway identifier. + PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_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 an `account.id` property matching the specified identifier. + AccountID *string `json:"account.id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListPrivatePathServiceGatewayAccountPoliciesOptions : Instantiate ListPrivatePathServiceGatewayAccountPoliciesOptions +func (*VpcV1) NewListPrivatePathServiceGatewayAccountPoliciesOptions(privatePathServiceGatewayID string) *ListPrivatePathServiceGatewayAccountPoliciesOptions { + return &ListPrivatePathServiceGatewayAccountPoliciesOptions{ + PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID), + } +} + +// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID +func (_options *ListPrivatePathServiceGatewayAccountPoliciesOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *ListPrivatePathServiceGatewayAccountPoliciesOptions { + _options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListPrivatePathServiceGatewayAccountPoliciesOptions) SetStart(start string) *ListPrivatePathServiceGatewayAccountPoliciesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListPrivatePathServiceGatewayAccountPoliciesOptions) SetLimit(limit int64) *ListPrivatePathServiceGatewayAccountPoliciesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetAccountID : Allow user to set AccountID +func (_options *ListPrivatePathServiceGatewayAccountPoliciesOptions) SetAccountID(accountID string) *ListPrivatePathServiceGatewayAccountPoliciesOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListPrivatePathServiceGatewayAccountPoliciesOptions) SetHeaders(param map[string]string) *ListPrivatePathServiceGatewayAccountPoliciesOptions { + options.Headers = param + return options +} + +// ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions : The ListPrivatePathServiceGatewayEndpointGatewayBindings options. +type ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions struct { + // The private path service gateway identifier. + PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_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 endpoint gateway bindings with a `status` property matching the specified value. + Status *string `json:"status,omitempty"` + + // 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 + Headers map[string]string +} + +// Constants associated with the ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Status property. +// Filters the collection to endpoint gateway bindings with a `status` property matching the specified value. +const ( + ListPrivatePathServiceGatewayEndpointGatewayBindingsOptionsStatusAbandonedConst = "abandoned" + ListPrivatePathServiceGatewayEndpointGatewayBindingsOptionsStatusDeniedConst = "denied" + ListPrivatePathServiceGatewayEndpointGatewayBindingsOptionsStatusExpiredConst = "expired" + ListPrivatePathServiceGatewayEndpointGatewayBindingsOptionsStatusPendingConst = "pending" + ListPrivatePathServiceGatewayEndpointGatewayBindingsOptionsStatusPermittedConst = "permitted" +) + +// NewListPrivatePathServiceGatewayEndpointGatewayBindingsOptions : Instantiate ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions +func (*VpcV1) NewListPrivatePathServiceGatewayEndpointGatewayBindingsOptions(privatePathServiceGatewayID string) *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions { + return &ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions{ + PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID), + } +} + +// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID +func (_options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions { + _options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) SetStart(start string) *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) SetLimit(limit int64) *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetStatus : Allow user to set Status +func (_options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) SetStatus(status string) *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions { + _options.Status = core.StringPtr(status) + return _options +} + +// SetAccountID : Allow user to set AccountID +func (_options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) SetAccountID(accountID string) *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) SetHeaders(param map[string]string) *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions { + options.Headers = param + return options +} + +// ListPrivatePathServiceGatewaysOptions : The ListPrivatePathServiceGateways options. +type ListPrivatePathServiceGatewaysOptions 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"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListPrivatePathServiceGatewaysOptions : Instantiate ListPrivatePathServiceGatewaysOptions +func (*VpcV1) NewListPrivatePathServiceGatewaysOptions() *ListPrivatePathServiceGatewaysOptions { + return &ListPrivatePathServiceGatewaysOptions{} +} + +// SetStart : Allow user to set Start +func (_options *ListPrivatePathServiceGatewaysOptions) SetStart(start string) *ListPrivatePathServiceGatewaysOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListPrivatePathServiceGatewaysOptions) SetLimit(limit int64) *ListPrivatePathServiceGatewaysOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListPrivatePathServiceGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListPrivatePathServiceGatewaysOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListPrivatePathServiceGatewaysOptions) SetHeaders(param map[string]string) *ListPrivatePathServiceGatewaysOptions { + options.Headers = param + return options +} + // ListPublicGatewaysOptions : The ListPublicGateways options. type ListPublicGatewaysOptions struct { // A server-provided token determining what resource to start the page on. @@ -65811,6 +67854,24 @@ func (options *ListVPNServersOptions) SetHeaders(param map[string]string) *ListV // LoadBalancer : LoadBalancer struct type LoadBalancer struct { + // The access mode for this load balancer: + // - `private`: reachable from within its VPC, at IP addresses in `private_ips` + // - `private_path`: reachable through an endpoint gateway + // - `public`: reachable from the internet at the IP addresses in `public_ips`. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + AccessMode *string `json:"access_mode" validate:"required"` + + // The availability of this load balancer: + // - `subnet`: remains available if at least one zone that the load balancer's subnets reside + // in is available + // - `region`: remains available if at least one zone in the region is available. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Availability *string `json:"availability" validate:"required"` + // The date and time that this load balancer was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -65821,6 +67882,8 @@ type LoadBalancer struct { // // If absent, DNS `A` records for this load balancer's `hostname` property will be added to // the public DNS zone `lb.appdomain.cloud`. + // + // Not supported by private path load balancers. Dns *LoadBalancerDns `json:"dns,omitempty"` // Fully qualified domain name assigned to this load balancer. @@ -65835,6 +67898,9 @@ type LoadBalancer struct { // Indicates whether this load balancer supports instance groups. InstanceGroupsSupported *bool `json:"instance_groups_supported" validate:"required"` + // Indicates whether this is a private path load balancer. + IsPrivatePath *bool `json:"is_private_path" validate:"required"` + // The type of this load balancer, public or private. IsPublic *bool `json:"is_public" validate:"required"` @@ -65854,6 +67920,8 @@ type LoadBalancer struct { Pools []LoadBalancerPoolReference `json:"pools" validate:"required"` // The private IP addresses assigned to this load balancer. + // + // Will be empty if `is_private` is `false`. PrivateIps []ReservedIPReference `json:"private_ips" validate:"required"` // The profile for this load balancer. @@ -65876,7 +67944,7 @@ type LoadBalancer struct { // The public IP addresses assigned to this load balancer. // - // Applicable only for public load balancers. + // Will be empty if `is_public` is `false`. PublicIps []IP `json:"public_ips" validate:"required"` // The resource group for this load balancer. @@ -65893,15 +67961,15 @@ type LoadBalancer struct { // The security groups targeting this load balancer. // // If empty, all inbound and outbound traffic is allowed. - // - // Applicable only for load balancers that support security groups. SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` // Indicates whether this load balancer supports security groups. SecurityGroupsSupported *bool `json:"security_groups_supported" validate:"required"` - // The subnets this load balancer is provisioned in. The load balancer's availability depends on the availability of - // the zones that the subnets reside in. + // Indicates whether this load balancer supports source IP session persistence. + SourceIPSessionPersistenceSupported *bool `json:"source_ip_session_persistence_supported" validate:"required"` + + // The subnets this load balancer is provisioned in. // // All subnets will be in the same VPC. Subnets []SubnetReference `json:"subnets" validate:"required"` @@ -65910,6 +67978,33 @@ type LoadBalancer struct { UDPSupported *bool `json:"udp_supported" validate:"required"` } +// Constants associated with the LoadBalancer.AccessMode property. +// The access mode for this load balancer: +// - `private`: reachable from within its VPC, at IP addresses in `private_ips` +// - `private_path`: reachable through an endpoint gateway +// - `public`: reachable from the internet at the IP addresses in `public_ips`. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + LoadBalancerAccessModePrivateConst = "private" + LoadBalancerAccessModePrivatePathConst = "private_path" + LoadBalancerAccessModePublicConst = "public" +) + +// Constants associated with the LoadBalancer.Availability property. +// The availability of this load balancer: +// - `subnet`: remains available if at least one zone that the load balancer's subnets reside +// in is available +// - `region`: remains available if at least one zone in the region is available. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + LoadBalancerAvailabilityRegionConst = "region" + LoadBalancerAvailabilitySubnetConst = "subnet" +) + // Constants associated with the LoadBalancer.OperatingStatus property. // The operating status of this load balancer. const ( @@ -65950,6 +68045,16 @@ const ( // UnmarshalLoadBalancer unmarshals an instance of LoadBalancer from the specified map of raw messages. func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancer) + err = core.UnmarshalPrimitive(m, "access_mode", &obj.AccessMode) + if err != nil { + err = core.SDKErrorf(err, "", "access_mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "availability", &obj.Availability) + if err != nil { + err = core.SDKErrorf(err, "", "availability-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) @@ -65985,6 +68090,11 @@ func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (er err = core.SDKErrorf(err, "", "instance_groups_supported-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "is_private_path", &obj.IsPrivatePath) + if err != nil { + err = core.SDKErrorf(err, "", "is_private_path-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "is_public", &obj.IsPublic) if err != nil { err = core.SDKErrorf(err, "", "is_public-error", common.GetComponentInfo()) @@ -66060,6 +68170,11 @@ func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (er err = core.SDKErrorf(err, "", "security_groups_supported-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "source_ip_session_persistence_supported", &obj.SourceIPSessionPersistenceSupported) + if err != nil { + err = core.SDKErrorf(err, "", "source_ip_session_persistence_supported-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) if err != nil { err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) @@ -66082,7 +68197,7 @@ type LoadBalancerCollection struct { // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` - // Collection of load balancers. + // A page of load balancers. LoadBalancers []LoadBalancer `json:"load_balancers" validate:"required"` // A link to the next page of resources. This property is present for all pages @@ -66180,6 +68295,8 @@ func UnmarshalLoadBalancerCollectionNext(m map[string]json.RawMessage, result in // // If absent, DNS `A` records for this load balancer's `hostname` property will be added to the public DNS zone // `lb.appdomain.cloud`. +// +// Not supported by private path load balancers. type LoadBalancerDns struct { // The DNS instance associated with this load balancer. Instance *DnsInstanceReferenceLoadBalancerDnsContext `json:"instance" validate:"required"` @@ -66209,6 +68326,8 @@ func UnmarshalLoadBalancerDns(m map[string]json.RawMessage, result interface{}) // // Specify `null` to remove the existing DNS configuration, which will remove all DNS `A` records for this load balancer // that had been added to `zone`, and add equivalent `A` records to the public DNS zone `lb.appdomain.cloud`. +// +// Not supported by private path load balancers. type LoadBalancerDnsPatch struct { // The DNS instance to associate with this load balancer. // @@ -66243,6 +68362,8 @@ func UnmarshalLoadBalancerDnsPatch(m map[string]json.RawMessage, result interfac // // If unspecified, DNS `A` records for this load balancer's `hostname` property will be added to the public DNS zone // `lb.appdomain.cloud`. Otherwise, those DNS `A` records will be added to the specified `zone`. +// +// Not supported by private path load balancers. type LoadBalancerDnsPrototype struct { // The DNS instance to associate with this load balancer. // @@ -66510,7 +68631,7 @@ func UnmarshalLoadBalancerListener(m map[string]json.RawMessage, result interfac // LoadBalancerListenerCollection : LoadBalancerListenerCollection struct type LoadBalancerListenerCollection struct { - // Collection of listeners. + // The listeners for the load balancer. Listeners []LoadBalancerListener `json:"listeners" validate:"required"` } @@ -66770,9 +68891,9 @@ type LoadBalancerListenerPatch struct { // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `65535` must be specified. + // Only load balancers with route mode enabled, or network load balancers with + // `is_public` or `is_private_path` set to `true` support different values for `port_min` and `port_max`. When route + // mode is enabled, the value `65535` must be specified. // // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the // same protocol. @@ -66780,9 +68901,9 @@ type LoadBalancerListenerPatch struct { // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `1` must be specified. + // Only load balancers with route mode enabled, or network load balancers with + // `is_public` or `is_private_path` set to `true` support different values for `port_min` and `port_max`. When route + // mode is enabled, the value `1` must be specified. // // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the // same protocol. @@ -67025,7 +69146,7 @@ func UnmarshalLoadBalancerListenerPolicy(m map[string]json.RawMessage, result in // LoadBalancerListenerPolicyCollection : LoadBalancerListenerPolicyCollection struct type LoadBalancerListenerPolicyCollection struct { - // Collection of policies. + // The policies for the load balancer listener. Policies []LoadBalancerListenerPolicy `json:"policies" validate:"required"` } @@ -67241,14 +69362,7 @@ type LoadBalancerListenerPolicyRule struct { // The date and time that this rule was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The field. This is applicable to `header`, `query`, and `body` rule types. - // - // If the rule type is `header`, this property is required. - // - // If the rule type is `query`, this is optional. If specified and the rule condition is not - // `matches_regex`, the value must be percent-encoded. - // - // If the rule type is `body`, this is optional. + // The field to match for this rule. If `condition` is not `matches_regex`, the value is percent-encoded. Field *string `json:"field,omitempty"` // The URL for this load balancer listener policy rule. @@ -67268,7 +69382,7 @@ type LoadBalancerListenerPolicyRule struct { // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. Type *string `json:"type" validate:"required"` - // Value to be matched for rule condition. + // The value to be matched for the rule condition. // // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. Value *string `json:"value" validate:"required"` @@ -67356,7 +69470,7 @@ func UnmarshalLoadBalancerListenerPolicyRule(m map[string]json.RawMessage, resul // LoadBalancerListenerPolicyRuleCollection : LoadBalancerListenerPolicyRuleCollection struct type LoadBalancerListenerPolicyRuleCollection struct { - // Collection of rules. + // The rules for the load balancer listener policy. Rules []LoadBalancerListenerPolicyRule `json:"rules" validate:"required"` } @@ -67377,14 +69491,11 @@ type LoadBalancerListenerPolicyRulePatch struct { // The condition of the rule. Condition *string `json:"condition,omitempty"` - // The field. This is applicable to `header`, `query`, and `body` rule types. + // The field to match for this rule. This property must be specified if the rule type is + // `header`, may be specified if the rule type is `body` or `query`, and must not be specified if the rule type is + // `hostname` or `path`. // - // If the rule type is `header`, this property is required. - // - // If the rule type is `query`, this is optional. If specified and the rule condition is not - // `matches_regex`, the value must be percent-encoded. - // - // If the rule type is `body`, this is optional. + // If the rule condition is not `matches_regex`, the value must be percent-encoded. Field *string `json:"field,omitempty"` // The type of the rule. @@ -67392,7 +69503,7 @@ type LoadBalancerListenerPolicyRulePatch struct { // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. Type *string `json:"type,omitempty"` - // Value to be matched for rule condition. + // The value to be matched for the rule condition. // // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. Value *string `json:"value,omitempty"` @@ -67463,14 +69574,11 @@ type LoadBalancerListenerPolicyRulePrototype struct { // The condition of the rule. Condition *string `json:"condition" validate:"required"` - // The field. This is applicable to `header`, `query`, and `body` rule types. - // - // If the rule type is `header`, this property is required. + // The field to match for this rule. This property must be specified if the rule type is + // `header`, may be specified if the rule type is `body` or `query`, and must not be specified if the rule type is + // `hostname` or `path`. // - // If the rule type is `query`, this is optional. If specified and the rule condition is not - // `matches_regex`, the value must be percent-encoded. - // - // If the rule type is `body`, this is optional. + // If the rule condition is not `matches_regex`, the value must be percent-encoded. Field *string `json:"field,omitempty"` // The type of the rule. @@ -67478,7 +69586,7 @@ type LoadBalancerListenerPolicyRulePrototype struct { // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. Type *string `json:"type" validate:"required"` - // Value to be matched for rule condition. + // The value to be matched for the rule condition. // // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. Value *string `json:"value" validate:"required"` @@ -67910,9 +70018,9 @@ type LoadBalancerListenerPrototypeLoadBalancerContext struct { // The inclusive upper bound of the range of ports used by this listener. Must not be less than `port_min`. // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `65535` must be specified. + // Only load balancers with route mode enabled, or network load balancers with + // `is_public` or `is_private_path` set to `true` support different values for `port_min` and `port_max`. When route + // mode is enabled, the value `65535` must be specified. // // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the // same protocol. @@ -67920,9 +70028,9 @@ type LoadBalancerListenerPrototypeLoadBalancerContext struct { // The inclusive lower bound of the range of ports used by this listener. Must not be greater than `port_max`. // - // At present, only load balancers operating with route mode enabled, and public load balancers in the `network` family - // support different values for `port_min` and - // `port_max`. When route mode is enabled, the value `1` must be specified. + // Only load balancers with route mode enabled, or network load balancers with + // `is_public` or `is_private_path` set to `true` support different values for `port_min` and `port_max`. When route + // mode is enabled, the value `1` must be specified. // // The specified port range must not overlap with port ranges used by other listeners for this load balancer using the // same protocol. @@ -68180,6 +70288,8 @@ type LoadBalancerPatch struct { // Specify `null` to remove the existing DNS configuration, which will remove all DNS `A` // records for this load balancer that had been added to `zone`, and add equivalent `A` // records to the public DNS zone `lb.appdomain.cloud`. + // + // Not supported by private path load balancers. Dns *LoadBalancerDnsPatch `json:"dns,omitempty"` // The logging configuration to use for this load balancer. @@ -68408,7 +70518,7 @@ func UnmarshalLoadBalancerPool(m map[string]json.RawMessage, result interface{}) // LoadBalancerPoolCollection : LoadBalancerPoolCollection struct type LoadBalancerPoolCollection struct { - // Collection of pools. + // The pools for the load balancer. Pools []LoadBalancerPool `json:"pools" validate:"required"` } @@ -68446,7 +70556,13 @@ type LoadBalancerPoolHealthMonitor struct { // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Type *string `json:"type" validate:"required"` - // The health check URL path. Applicable when `type` is `http` or `https`. + // The health check URL path, in the format of an [origin-form request + // 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"` @@ -68491,6 +70607,11 @@ 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()) @@ -68521,7 +70642,7 @@ type LoadBalancerPoolHealthMonitorPatch struct { // The protocol type to use for health checks. Type *string `json:"type" validate:"required"` - // The health check URL path. Applicable when `type` is `http` or `https`. + // 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"` @@ -68606,7 +70727,7 @@ type LoadBalancerPoolHealthMonitorPrototype struct { // The protocol type to use for health checks. Type *string `json:"type" validate:"required"` - // The health check URL path. Applicable when `type` is `http` or `https`. + // 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"` @@ -68773,8 +70894,9 @@ type LoadBalancerPoolMember struct { // subnet in. Target LoadBalancerPoolMemberTargetIntf `json:"target" validate:"required"` - // Weight of the server member. Applicable only if the pool algorithm is - // `weighted_round_robin`. + // The weight of the server member. + // + // This property will be present if the pool algorithm is `weighted_round_robin`. Weight *int64 `json:"weight,omitempty"` } @@ -68848,7 +70970,7 @@ func UnmarshalLoadBalancerPoolMember(m map[string]json.RawMessage, result interf // LoadBalancerPoolMemberCollection : LoadBalancerPoolMemberCollection struct type LoadBalancerPoolMemberCollection struct { - // Collection of members. + // The members for the load balancer pool. Members []LoadBalancerPoolMember `json:"members" validate:"required"` } @@ -68882,8 +71004,9 @@ type LoadBalancerPoolMemberPatch struct { // subnet in. Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target,omitempty"` - // Weight of the server member. Applicable only if the pool algorithm is - // `weighted_round_robin`. + // The weight of the server member. + // + // If specified, the pool algorithm must be `weighted_round_robin`. Weight *int64 `json:"weight,omitempty"` } @@ -68940,8 +71063,9 @@ type LoadBalancerPoolMemberPrototype struct { // subnet in. Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` - // Weight of the server member. Applicable only if the pool algorithm is - // `weighted_round_robin`. + // The weight of the server member. + // + // If specified, the pool algorithm must be `weighted_round_robin`. Weight *int64 `json:"weight,omitempty"` } @@ -69270,7 +71394,8 @@ func (loadBalancerPoolPatch *LoadBalancerPoolPatch) AsPatch() (_patch map[string // LoadBalancerPoolPrototype : LoadBalancerPoolPrototype struct type LoadBalancerPoolPrototype 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" validate:"required"` // The health monitor of this pool. @@ -69297,14 +71422,16 @@ type LoadBalancerPoolPrototype struct { // Supported by load balancers in the `application` family (otherwise always `disabled`). ProxyProtocol *string `json:"proxy_protocol,omitempty"` - // The session persistence of this pool. If unspecified, session persistence will be - // disabled, and traffic will be distributed across backend server members of the - // pool. + // The session persistence of this pool. If specified, the load balancer must have + // `source_ip_session_persistence_supported` set to `true` in its profile. If + // unspecified, session persistence will be disabled, and traffic will be distributed + // across backend server members of the pool. SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` } // Constants associated with the LoadBalancerPoolPrototype.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 ( LoadBalancerPoolPrototypeAlgorithmLeastConnectionsConst = "least_connections" LoadBalancerPoolPrototypeAlgorithmRoundRobinConst = "round_robin" @@ -69436,12 +71563,10 @@ func UnmarshalLoadBalancerPoolReference(m map[string]json.RawMessage, result int // LoadBalancerPoolSessionPersistence : LoadBalancerPoolSessionPersistence struct type LoadBalancerPoolSessionPersistence struct { - // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not - // allowed. + // The session persistence cookie name. CookieName *string `json:"cookie_name,omitempty"` - // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` - // protocols. + // The session persistence type. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -69449,8 +71574,7 @@ type LoadBalancerPoolSessionPersistence struct { } // Constants associated with the LoadBalancerPoolSessionPersistence.Type property. -// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` -// protocols. +// The session persistence type. // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -69479,18 +71603,23 @@ func UnmarshalLoadBalancerPoolSessionPersistence(m map[string]json.RawMessage, r // LoadBalancerPoolSessionPersistencePatch : The session persistence configuration. Specify `null` to remove any existing session persistence configuration. type LoadBalancerPoolSessionPersistencePatch struct { - // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not - // allowed. + // The session persistence cookie name. Names starting with `IBM` are not allowed. + // + // If specified, the session persistence type must be `app_cookie`. CookieName *string `json:"cookie_name,omitempty"` - // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` - // protocols. + // The session persistence type. + // + // If `http_cookie` or `app_cookie` is specified, the pool protocol must be `http` or + // `https`. Type *string `json:"type,omitempty"` } // Constants associated with the LoadBalancerPoolSessionPersistencePatch.Type property. -// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` -// protocols. +// The session persistence type. +// +// If `http_cookie` or `app_cookie` is specified, the pool protocol must be `http` or +// `https`. const ( LoadBalancerPoolSessionPersistencePatchTypeAppCookieConst = "app_cookie" LoadBalancerPoolSessionPersistencePatchTypeHTTPCookieConst = "http_cookie" @@ -69516,18 +71645,23 @@ func UnmarshalLoadBalancerPoolSessionPersistencePatch(m map[string]json.RawMessa // LoadBalancerPoolSessionPersistencePrototype : LoadBalancerPoolSessionPersistencePrototype struct type LoadBalancerPoolSessionPersistencePrototype struct { - // The session persistence cookie name. Applicable only for type `app_cookie`. Names starting with `IBM` are not - // allowed. + // The session persistence cookie name. Names starting with `IBM` are not allowed. + // + // If specified, the session persistence type must be `app_cookie`. CookieName *string `json:"cookie_name,omitempty"` - // The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` - // protocols. + // The session persistence type. + // + // If `http_cookie` or `app_cookie` is specified, the pool protocol must be `http` or + // `https`. Type *string `json:"type" validate:"required"` } // Constants associated with the LoadBalancerPoolSessionPersistencePrototype.Type property. -// The session persistence type. The `http_cookie` and `app_cookie` types are applicable only to the `http` and `https` -// protocols. +// The session persistence type. +// +// If `http_cookie` or `app_cookie` is specified, the pool protocol must be `http` or +// `https`. const ( LoadBalancerPoolSessionPersistencePrototypeTypeAppCookieConst = "app_cookie" LoadBalancerPoolSessionPersistencePrototypeTypeHTTPCookieConst = "http_cookie" @@ -69565,6 +71699,10 @@ func UnmarshalLoadBalancerPoolSessionPersistencePrototype(m map[string]json.RawM // LoadBalancerProfile : LoadBalancerProfile struct type LoadBalancerProfile struct { + AccessModes *LoadBalancerProfileAccessModes `json:"access_modes" validate:"required"` + + Availability LoadBalancerProfileAvailabilityIntf `json:"availability" validate:"required"` + // The product family this load balancer profile belongs to. // // The enumerated values for this property may @@ -69586,6 +71724,8 @@ type LoadBalancerProfile struct { SecurityGroupsSupported LoadBalancerProfileSecurityGroupsSupportedIntf `json:"security_groups_supported" validate:"required"` + SourceIPSessionPersistenceSupported LoadBalancerProfileSourceIPSessionPersistenceSupportedIntf `json:"source_ip_session_persistence_supported" validate:"required"` + UDPSupported LoadBalancerProfileUDPSupportedIntf `json:"udp_supported" validate:"required"` } @@ -69602,6 +71742,16 @@ const ( // UnmarshalLoadBalancerProfile unmarshals an instance of LoadBalancerProfile from the specified map of raw messages. func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(LoadBalancerProfile) + err = core.UnmarshalModel(m, "access_modes", &obj.AccessModes, UnmarshalLoadBalancerProfileAccessModes) + if err != nil { + err = core.SDKErrorf(err, "", "access_modes-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "availability", &obj.Availability, UnmarshalLoadBalancerProfileAvailability) + if err != nil { + err = core.SDKErrorf(err, "", "availability-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo()) @@ -69637,6 +71787,11 @@ func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface err = core.SDKErrorf(err, "", "security_groups_supported-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "source_ip_session_persistence_supported", &obj.SourceIPSessionPersistenceSupported, UnmarshalLoadBalancerProfileSourceIPSessionPersistenceSupported) + if err != nil { + err = core.SDKErrorf(err, "", "source_ip_session_persistence_supported-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "udp_supported", &obj.UDPSupported, UnmarshalLoadBalancerProfileUDPSupported) if err != nil { err = core.SDKErrorf(err, "", "udp_supported-error", common.GetComponentInfo()) @@ -69646,6 +71801,114 @@ func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface return } +// LoadBalancerProfileAccessModes : LoadBalancerProfileAccessModes struct +type LoadBalancerProfileAccessModes struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The access modes supported by load balancers with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileAccessModes.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileAccessModesTypeEnumConst = "enum" +) + +// Constants associated with the LoadBalancerProfileAccessModes.Values property. +// The access mode for this load balancer: +// - `private`: reachable from within its VPC, at IP addresses in `private_ips` +// - `private_path`: reachable through an endpoint gateway +// - `public`: reachable from the internet at the IP addresses in `public_ips`. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + LoadBalancerProfileAccessModesValuesPrivateConst = "private" + LoadBalancerProfileAccessModesValuesPrivatePathConst = "private_path" + LoadBalancerProfileAccessModesValuesPublicConst = "public" +) + +// UnmarshalLoadBalancerProfileAccessModes unmarshals an instance of LoadBalancerProfileAccessModes from the specified map of raw messages. +func UnmarshalLoadBalancerProfileAccessModes(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileAccessModes) + 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 +} + +// LoadBalancerProfileAvailability : LoadBalancerProfileAvailability struct +// Models which "extend" this model: +// - LoadBalancerProfileAvailabilityFixed +// - LoadBalancerProfileAvailabilityDependent +type LoadBalancerProfileAvailability struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The availability of this load balancer: + // - `subnet`: remains available if at least one zone that the load balancer's subnets reside + // in is available + // - `region`: remains available if at least one zone in the region is available. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Value *string `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileAvailability.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileAvailabilityTypeFixedConst = "fixed" +) + +// Constants associated with the LoadBalancerProfileAvailability.Value property. +// The availability of this load balancer: +// - `subnet`: remains available if at least one zone that the load balancer's subnets reside +// in is available +// - `region`: remains available if at least one zone in the region is available. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + LoadBalancerProfileAvailabilityValueRegionConst = "region" + LoadBalancerProfileAvailabilityValueSubnetConst = "subnet" +) + +func (*LoadBalancerProfileAvailability) isaLoadBalancerProfileAvailability() bool { + return true +} + +type LoadBalancerProfileAvailabilityIntf interface { + isaLoadBalancerProfileAvailability() bool +} + +// UnmarshalLoadBalancerProfileAvailability unmarshals an instance of LoadBalancerProfileAvailability from the specified map of raw messages. +func UnmarshalLoadBalancerProfileAvailability(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileAvailability) + 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 +} + // LoadBalancerProfileCollection : LoadBalancerProfileCollection struct type LoadBalancerProfileCollection struct { // A link to the first page of resources. @@ -69658,7 +71921,7 @@ type LoadBalancerProfileCollection struct { // except the last page. Next *LoadBalancerProfileCollectionNext `json:"next,omitempty"` - // Collection of load balancer profiles. + // A page of load balancer profiles. Profiles []LoadBalancerProfile `json:"profiles" validate:"required"` // The total number of resources across all pages. @@ -69993,6 +72256,49 @@ func UnmarshalLoadBalancerProfileSecurityGroupsSupported(m map[string]json.RawMe return } +// LoadBalancerProfileSourceIPSessionPersistenceSupported : LoadBalancerProfileSourceIPSessionPersistenceSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileSourceIPSessionPersistenceSupportedFixed +// - LoadBalancerProfileSourceIPSessionPersistenceSupportedDependent +type LoadBalancerProfileSourceIPSessionPersistenceSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileSourceIPSessionPersistenceSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSourceIPSessionPersistenceSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileSourceIPSessionPersistenceSupported) isaLoadBalancerProfileSourceIPSessionPersistenceSupported() bool { + return true +} + +type LoadBalancerProfileSourceIPSessionPersistenceSupportedIntf interface { + isaLoadBalancerProfileSourceIPSessionPersistenceSupported() bool +} + +// UnmarshalLoadBalancerProfileSourceIPSessionPersistenceSupported unmarshals an instance of LoadBalancerProfileSourceIPSessionPersistenceSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSourceIPSessionPersistenceSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSourceIPSessionPersistenceSupported) + 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 +} + // LoadBalancerProfileUDPSupported : LoadBalancerProfileUDPSupported struct // Models which "extend" this model: // - LoadBalancerProfileUDPSupportedFixed @@ -70036,6 +72342,71 @@ func UnmarshalLoadBalancerProfileUDPSupported(m map[string]json.RawMessage, resu return } +// LoadBalancerReference : LoadBalancerReference struct +type LoadBalancerReference struct { + // The CRN for this load balancer. + 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"` + + // The URL for this load balancer. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` + + // The name for this load balancer. The name is unique across all load balancers in the VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the LoadBalancerReference.ResourceType property. +// The resource type. +const ( + LoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" +) + +// UnmarshalLoadBalancerReference unmarshals an instance of LoadBalancerReference from the specified map of raw messages. +func UnmarshalLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerReference) + 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.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 +} + // LoadBalancerStatistics : LoadBalancerStatistics struct type LoadBalancerStatistics struct { // Number of active connections of this load balancer. @@ -70168,7 +72539,7 @@ type NetworkACLCollection struct { // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` - // Collection of network ACLs. + // A page of network ACLs. NetworkAcls []NetworkACL `json:"network_acls" validate:"required"` // A link to the next page of resources. This property is present for all pages @@ -70684,7 +73055,7 @@ type NetworkACLRuleCollection struct { // except the last page. Next *NetworkACLRuleCollectionNext `json:"next,omitempty"` - // Ordered collection of network ACL rules. + // A page of ordered rules (sorted based on the `before` property) for the network ACL. Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` // The total number of resources across all pages. @@ -71917,7 +74288,7 @@ func UnmarshalNetworkInterfacePrototype(m map[string]json.RawMessage, result int // NetworkInterfaceUnpaginatedCollection : NetworkInterfaceUnpaginatedCollection struct type NetworkInterfaceUnpaginatedCollection struct { - // Collection of instance network interfaces. + // The network interfaces for the instance. NetworkInterfaces []NetworkInterface `json:"network_interfaces" validate:"required"` } @@ -72079,7 +74450,7 @@ type OperatingSystemCollection struct { // except the last page. Next *OperatingSystemCollectionNext `json:"next,omitempty"` - // Collection of operating systems. + // A page of operating systems. OperatingSystems []OperatingSystem `json:"operating_systems" validate:"required"` // The total number of resources across all pages. @@ -72206,6 +74577,65 @@ func UnmarshalOperatingSystemIdentity(m map[string]json.RawMessage, result inter return } +// PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions : The PermitPrivatePathServiceGatewayEndpointGatewayBinding options. +type PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions struct { + // The private path service gateway identifier. + PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="` + + // The endpoint gateway binding identifier. + ID *string `json:"id" validate:"required,ne="` + + // Indicates whether this will become the access policy for any `pending` and future endpoint gateway bindings from the + // same account. + // + // If set to `true`: + // + // - If the account has an existing access policy, that policy will be updated to + // `permit`. Otherwise, a new `permit` access policy will be created for the account. + // - All `pending` endpoint gateway bindings for the account will be permitted. + // + // If set to `false`: + // + // - No access policies will be created or updated + // - 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 + Headers map[string]string +} + +// NewPermitPrivatePathServiceGatewayEndpointGatewayBindingOptions : Instantiate PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions +func (*VpcV1) NewPermitPrivatePathServiceGatewayEndpointGatewayBindingOptions(privatePathServiceGatewayID string, id string) *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions { + return &PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions{ + PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID), + ID: core.StringPtr(id), + } +} + +// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID +func (_options *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions { + _options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetID(id string) *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetSetAccountPolicy : Allow user to set SetAccountPolicy +func (_options *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetSetAccountPolicy(setAccountPolicy bool) *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions { + _options.SetAccountPolicy = core.BoolPtr(setAccountPolicy) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions) SetHeaders(param map[string]string) *PermitPrivatePathServiceGatewayEndpointGatewayBindingOptions { + options.Headers = param + return options +} + // PlacementGroup : PlacementGroup struct type PlacementGroup struct { // The date and time that the placement group was created. @@ -72335,7 +74765,7 @@ type PlacementGroupCollection struct { // except the last page. Next *PlacementGroupCollectionNext `json:"next,omitempty"` - // Collection of placement groups. + // A page of placement groups. PlacementGroups []PlacementGroup `json:"placement_groups" validate:"required"` // The total number of resources across all pages. @@ -72456,6 +74886,867 @@ func (placementGroupPatch *PlacementGroupPatch) AsPatch() (_patch map[string]int return } +// PrivatePathServiceGateway : PrivatePathServiceGateway struct +type PrivatePathServiceGateway struct { + // The date and time that the private path service gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this private path service gateway. + CRN *string `json:"crn" validate:"required"` + + // The policy to use for bindings from accounts without an explicit account policy. + DefaultAccessPolicy *string `json:"default_access_policy" validate:"required"` + + // Indicates whether endpoint gateway bindings will be automatically deleted after + // `endpoint_gateway_binding_auto_delete_timeout` hours have passed. At present, this is always `true`, but may be + // modifiable in the future. + EndpointGatewayBindingAutoDelete *bool `json:"endpoint_gateway_binding_auto_delete" validate:"required"` + + // If `endpoint_gateway_binding_auto_delete` is `true`, the hours after which endpoint gateway bindings will be + // automatically deleted. If the value is `0`, `abandoned` endpoint gateway bindings will be deleted immediately. At + // present, this is always set to `0`. This value may be modifiable in the future. + EndpointGatewayBindingAutoDeleteTimeout *int64 `json:"endpoint_gateway_binding_auto_delete_timeout" validate:"required"` + + // The number of active endpoint gateways using this private path service gateway. + EndpointGatewayCount *int64 `json:"endpoint_gateway_count" validate:"required"` + + // The URL for this private path service gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this private path service gateway. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the private path service gateway. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The load balancer for this private path service gateway. + LoadBalancer *LoadBalancerReference `json:"load_balancer" validate:"required"` + + // The name for this private path service gateway. The name is unique across all private path service gateways in the + // VPC. + Name *string `json:"name" validate:"required"` + + // Indicates the availability of this private path service gateway + // - `true`: Any account can request access to this private path service gateway. + // - `false`: Access is restricted to the account that created this private path service gateway. + Published *bool `json:"published" validate:"required"` + + // The resource group for this private path service gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The fully qualified domain names for this private path service gateway. The domains are used for endpoint gateways + // to connect to the service and are configured in the VPC for each endpoint gateway. + ServiceEndpoints []string `json:"service_endpoints" validate:"required"` + + // The VPC this private path service gateway resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // Indicates whether this private path service gateway has zonal affinity. + // - `true`: Traffic to the service from a zone the service resides in will remain in + // that zone. + // - `false`: Traffic to the service from a zone will be load balanced across all zones + // in the region the service resides in. + ZonalAffinity *bool `json:"zonal_affinity" validate:"required"` +} + +// Constants associated with the PrivatePathServiceGateway.DefaultAccessPolicy property. +// The policy to use for bindings from accounts without an explicit account policy. +const ( + PrivatePathServiceGatewayDefaultAccessPolicyDenyConst = "deny" + PrivatePathServiceGatewayDefaultAccessPolicyPermitConst = "permit" + PrivatePathServiceGatewayDefaultAccessPolicyReviewConst = "review" +) + +// Constants associated with the PrivatePathServiceGateway.LifecycleState property. +// The lifecycle state of the private path service gateway. +const ( + PrivatePathServiceGatewayLifecycleStateDeletingConst = "deleting" + PrivatePathServiceGatewayLifecycleStateFailedConst = "failed" + PrivatePathServiceGatewayLifecycleStatePendingConst = "pending" + PrivatePathServiceGatewayLifecycleStateStableConst = "stable" + PrivatePathServiceGatewayLifecycleStateSuspendedConst = "suspended" + PrivatePathServiceGatewayLifecycleStateUpdatingConst = "updating" + PrivatePathServiceGatewayLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the PrivatePathServiceGateway.ResourceType property. +// The resource type. +const ( + PrivatePathServiceGatewayResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" +) + +// UnmarshalPrivatePathServiceGateway unmarshals an instance of PrivatePathServiceGateway from the specified map of raw messages. +func UnmarshalPrivatePathServiceGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrivatePathServiceGateway) + 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.UnmarshalPrimitive(m, "default_access_policy", &obj.DefaultAccessPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "default_access_policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "endpoint_gateway_binding_auto_delete", &obj.EndpointGatewayBindingAutoDelete) + if err != nil { + err = core.SDKErrorf(err, "", "endpoint_gateway_binding_auto_delete-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "endpoint_gateway_binding_auto_delete_timeout", &obj.EndpointGatewayBindingAutoDeleteTimeout) + if err != nil { + err = core.SDKErrorf(err, "", "endpoint_gateway_binding_auto_delete_timeout-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "endpoint_gateway_count", &obj.EndpointGatewayCount) + if err != nil { + err = core.SDKErrorf(err, "", "endpoint_gateway_count-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.UnmarshalModel(m, "load_balancer", &obj.LoadBalancer, UnmarshalLoadBalancerReference) + if err != nil { + err = core.SDKErrorf(err, "", "load_balancer-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, "published", &obj.Published) + if err != nil { + err = core.SDKErrorf(err, "", "published-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.UnmarshalPrimitive(m, "service_endpoints", &obj.ServiceEndpoints) + if err != nil { + err = core.SDKErrorf(err, "", "service_endpoints-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.UnmarshalPrimitive(m, "zonal_affinity", &obj.ZonalAffinity) + if err != nil { + err = core.SDKErrorf(err, "", "zonal_affinity-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PrivatePathServiceGatewayAccountPolicy : PrivatePathServiceGatewayAccountPolicy struct +type PrivatePathServiceGatewayAccountPolicy struct { + // The access policy for the account: + // - permit: access will be permitted + // - deny: access will be denied + // - review: access will be manually reviewed + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + AccessPolicy *string `json:"access_policy" validate:"required"` + + // The account for this access policy. + Account *AccountReference `json:"account" validate:"required"` + + // The date and time that the account policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this account policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this account policy. + ID *string `json:"id" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the PrivatePathServiceGatewayAccountPolicy.AccessPolicy property. +// The access policy for the account: +// - permit: access will be permitted +// - deny: access will be denied +// - review: access will be manually reviewed +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + PrivatePathServiceGatewayAccountPolicyAccessPolicyDenyConst = "deny" + PrivatePathServiceGatewayAccountPolicyAccessPolicyPermitConst = "permit" + PrivatePathServiceGatewayAccountPolicyAccessPolicyReviewConst = "review" +) + +// Constants associated with the PrivatePathServiceGatewayAccountPolicy.ResourceType property. +// The resource type. +const ( + PrivatePathServiceGatewayAccountPolicyResourceTypePrivatePathServiceGatewayAccountPolicyConst = "private_path_service_gateway_account_policy" +) + +// UnmarshalPrivatePathServiceGatewayAccountPolicy unmarshals an instance of PrivatePathServiceGatewayAccountPolicy from the specified map of raw messages. +func UnmarshalPrivatePathServiceGatewayAccountPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrivatePathServiceGatewayAccountPolicy) + err = core.UnmarshalPrimitive(m, "access_policy", &obj.AccessPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "access_policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) + if err != nil { + err = core.SDKErrorf(err, "", "account-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, "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 +} + +// PrivatePathServiceGatewayAccountPolicyCollection : PrivatePathServiceGatewayAccountPolicyCollection struct +type PrivatePathServiceGatewayAccountPolicyCollection struct { + // A page of account policies for the private path service gateway. + AccountPolicies []PrivatePathServiceGatewayAccountPolicy `json:"account_policies" validate:"required"` + + // A link to the first page of resources. + First *PrivatePathServiceGatewayAccountPolicyCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalPrivatePathServiceGatewayAccountPolicyCollection unmarshals an instance of PrivatePathServiceGatewayAccountPolicyCollection from the specified map of raw messages. +func UnmarshalPrivatePathServiceGatewayAccountPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrivatePathServiceGatewayAccountPolicyCollection) + err = core.UnmarshalModel(m, "account_policies", &obj.AccountPolicies, UnmarshalPrivatePathServiceGatewayAccountPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "account_policies-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPrivatePathServiceGatewayAccountPolicyCollectionFirst) + 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, UnmarshalPrivatePathServiceGatewayAccountPolicyCollectionNext) + 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 *PrivatePathServiceGatewayAccountPolicyCollection) 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 +} + +// 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 + // bindings. + // - permit: access will be permitted + // - deny: access will be denied + // - review: access will be manually reviewed + // + // - Updating to `review` sets the status of future endpoint gateway bindings from + // this account to `pending`. + // - Updating to `permit` updates both the status of any `pending` and future endpoint + // gateway bindings from this account to `permitted`. + // - Updating to `deny` updates both the status of any `pending` and future endpoint + // gateway bindings from this account to `denied`. + AccessPolicy *string `json:"access_policy,omitempty"` +} + +// Constants associated with the PrivatePathServiceGatewayAccountPolicyPatch.AccessPolicy property. +// The access policy for the account. Updating the access policy only affects pending and future endpoint gateway +// bindings. +// - permit: access will be permitted +// - deny: access will be denied +// - review: access will be manually reviewed +// +// - Updating to `review` sets the status of future endpoint gateway bindings from +// this account to `pending`. +// - Updating to `permit` updates both the status of any `pending` and future endpoint +// gateway bindings from this account to `permitted`. +// - Updating to `deny` updates both the status of any `pending` and future endpoint +// gateway bindings from this account to `denied`. +const ( + PrivatePathServiceGatewayAccountPolicyPatchAccessPolicyDenyConst = "deny" + PrivatePathServiceGatewayAccountPolicyPatchAccessPolicyPermitConst = "permit" + PrivatePathServiceGatewayAccountPolicyPatchAccessPolicyReviewConst = "review" +) + +// UnmarshalPrivatePathServiceGatewayAccountPolicyPatch unmarshals an instance of PrivatePathServiceGatewayAccountPolicyPatch from the specified map of raw messages. +func UnmarshalPrivatePathServiceGatewayAccountPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrivatePathServiceGatewayAccountPolicyPatch) + err = core.UnmarshalPrimitive(m, "access_policy", &obj.AccessPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "access_policy-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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()) + } + return +} + +// PrivatePathServiceGatewayCollection : PrivatePathServiceGatewayCollection struct +type PrivatePathServiceGatewayCollection struct { + // A link to the first page of resources. + First *PrivatePathServiceGatewayCollectionFirst `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"` + + // A page of private path service gateways. + PrivatePathServiceGateways []PrivatePathServiceGateway `json:"private_path_service_gateways" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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) + 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, UnmarshalPrivatePathServiceGatewayCollectionNext) + if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "private_path_service_gateways", &obj.PrivatePathServiceGateways, UnmarshalPrivatePathServiceGateway) + if err != nil { + err = core.SDKErrorf(err, "", "private_path_service_gateways-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 *PrivatePathServiceGatewayCollection) 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 +} + +// 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. + Account *AccountReference `json:"account" validate:"required"` + + // The date and time that the endpoint gateway binding was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The expiration date and time for the endpoint gateway binding. At binding creation, this property will be set to 14 + // days after the creation time, and will remain while the `status` of the binding is `pending`. If the date and time + // are reached while the binding is still `pending`, the binding will transition to `expired`. + // + // This property will be present if the `status` is `pending` or `expired`. + ExpirationAt *strfmt.DateTime `json:"expiration_at,omitempty"` + + // The URL for this endpoint gateway binding. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway binding. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the endpoint gateway binding. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the endpoint gateway binding: + // - `abandoned`: endpoint gateway binding is inactive, awaiting deletion. + // - `denied`: endpoint gateway binding was denied + // - `expired`: endpoint gateway binding has expired + // - `pending`: endpoint gateway binding is awaiting review + // - `permitted`: endpoint gateway binding was permitted + // + // An endpoint gateway binding will be automatically deleted when its associated endpoint gateway is deleted. + // + // 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"` +} + +// Constants associated with the PrivatePathServiceGatewayEndpointGatewayBinding.LifecycleState property. +// The lifecycle state of the endpoint gateway binding. +const ( + PrivatePathServiceGatewayEndpointGatewayBindingLifecycleStateDeletingConst = "deleting" + PrivatePathServiceGatewayEndpointGatewayBindingLifecycleStateFailedConst = "failed" + PrivatePathServiceGatewayEndpointGatewayBindingLifecycleStatePendingConst = "pending" + PrivatePathServiceGatewayEndpointGatewayBindingLifecycleStateStableConst = "stable" + PrivatePathServiceGatewayEndpointGatewayBindingLifecycleStateSuspendedConst = "suspended" + PrivatePathServiceGatewayEndpointGatewayBindingLifecycleStateUpdatingConst = "updating" + PrivatePathServiceGatewayEndpointGatewayBindingLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the PrivatePathServiceGatewayEndpointGatewayBinding.ResourceType property. +// The resource type. +const ( + PrivatePathServiceGatewayEndpointGatewayBindingResourceTypePrivatePathServiceGatewayEndpointGatewayBindingConst = "private_path_service_gateway_endpoint_gateway_binding" +) + +// Constants associated with the PrivatePathServiceGatewayEndpointGatewayBinding.Status property. +// The status of the endpoint gateway binding: +// - `abandoned`: endpoint gateway binding is inactive, awaiting deletion. +// - `denied`: endpoint gateway binding was denied +// - `expired`: endpoint gateway binding has expired +// - `pending`: endpoint gateway binding is awaiting review +// - `permitted`: endpoint gateway binding was permitted +// +// An endpoint gateway binding will be automatically deleted when its associated endpoint gateway is deleted. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + PrivatePathServiceGatewayEndpointGatewayBindingStatusAbandonedConst = "abandoned" + PrivatePathServiceGatewayEndpointGatewayBindingStatusDeniedConst = "denied" + PrivatePathServiceGatewayEndpointGatewayBindingStatusExpiredConst = "expired" + PrivatePathServiceGatewayEndpointGatewayBindingStatusPendingConst = "pending" + PrivatePathServiceGatewayEndpointGatewayBindingStatusPermittedConst = "permitted" +) + +// UnmarshalPrivatePathServiceGatewayEndpointGatewayBinding unmarshals an instance of PrivatePathServiceGatewayEndpointGatewayBinding from the specified map of raw messages. +func UnmarshalPrivatePathServiceGatewayEndpointGatewayBinding(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrivatePathServiceGatewayEndpointGatewayBinding) + err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) + if err != nil { + err = core.SDKErrorf(err, "", "account-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, "expiration_at", &obj.ExpirationAt) + if err != nil { + err = core.SDKErrorf(err, "", "expiration_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, "lifecycle_state", &obj.LifecycleState) + if err != nil { + err = core.SDKErrorf(err, "", "lifecycle_state-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, "status", &obj.Status) + if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PrivatePathServiceGatewayEndpointGatewayBindingCollection : PrivatePathServiceGatewayEndpointGatewayBindingCollection struct +type PrivatePathServiceGatewayEndpointGatewayBindingCollection struct { + // A page of endpoint gateway bindings for the private path service gateway. + EndpointGatewayBindings []PrivatePathServiceGatewayEndpointGatewayBinding `json:"endpoint_gateway_bindings" validate:"required"` + + // A link to the first page of resources. + First *PrivatePathServiceGatewayEndpointGatewayBindingCollectionFirst `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"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollection unmarshals an instance of PrivatePathServiceGatewayEndpointGatewayBindingCollection from the specified map of raw messages. +func UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrivatePathServiceGatewayEndpointGatewayBindingCollection) + err = core.UnmarshalModel(m, "endpoint_gateway_bindings", &obj.EndpointGatewayBindings, UnmarshalPrivatePathServiceGatewayEndpointGatewayBinding) + if err != nil { + err = core.SDKErrorf(err, "", "endpoint_gateway_bindings-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollectionFirst) + 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, UnmarshalPrivatePathServiceGatewayEndpointGatewayBindingCollectionNext) + 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 *PrivatePathServiceGatewayEndpointGatewayBindingCollection) 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 +} + +// 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. + DefaultAccessPolicy *string `json:"default_access_policy,omitempty"` + + // The load balancer for this private path service gateway. The load balancer must + // have `is_private_path` set to `true`, and must be in the same VPC as the private + // path service gateway. + LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` + + // The name for this private path service gateway. The name must not be used by another private path service gateway in + // the VPC. + Name *string `json:"name,omitempty"` + + // Updating the value of `zonal_affinity` changes how traffic for existing and future endpoint gateway bindings will be + // routed: + // - `true`: Traffic to the service from a zone the service resides in will remain in + // that zone. + // - `false`: Traffic to the service from a zone will be load balanced across all zones + // in the region the service resides in. + ZonalAffinity *bool `json:"zonal_affinity,omitempty"` +} + +// Constants associated with the PrivatePathServiceGatewayPatch.DefaultAccessPolicy property. +// The policy to use for bindings from accounts without an explicit account policy. +const ( + PrivatePathServiceGatewayPatchDefaultAccessPolicyDenyConst = "deny" + PrivatePathServiceGatewayPatchDefaultAccessPolicyPermitConst = "permit" + PrivatePathServiceGatewayPatchDefaultAccessPolicyReviewConst = "review" +) + +// UnmarshalPrivatePathServiceGatewayPatch unmarshals an instance of PrivatePathServiceGatewayPatch from the specified map of raw messages. +func UnmarshalPrivatePathServiceGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrivatePathServiceGatewayPatch) + err = core.UnmarshalPrimitive(m, "default_access_policy", &obj.DefaultAccessPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "default_access_policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "load_balancer", &obj.LoadBalancer, UnmarshalLoadBalancerIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "load_balancer-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, "zonal_affinity", &obj.ZonalAffinity) + if err != nil { + err = core.SDKErrorf(err, "", "zonal_affinity-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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) + } + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + } + return +} + +// PrivatePathServiceGatewayRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not +// be directly retrievable. +type PrivatePathServiceGatewayRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // account, and identifies the owning account. + Account *AccountReference `json:"account,omitempty"` + + // If present, this property indicates that the referenced resource is remote to this + // region, and identifies the native region. + Region *RegionReference `json:"region,omitempty"` +} + +// UnmarshalPrivatePathServiceGatewayRemote unmarshals an instance of PrivatePathServiceGatewayRemote from the specified map of raw messages. +func UnmarshalPrivatePathServiceGatewayRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrivatePathServiceGatewayRemote) + err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) + if err != nil { + err = core.SDKErrorf(err, "", "account-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 +} + // PublicGateway : PublicGateway struct type PublicGateway struct { // The date and time that the public gateway was created. @@ -72581,7 +75872,7 @@ type PublicGatewayCollection struct { // except the last page. Next *PublicGatewayCollectionNext `json:"next,omitempty"` - // Collection of public gateways. + // A page of public gateways. PublicGateways []PublicGateway `json:"public_gateways" validate:"required"` // The total number of resources across all pages. @@ -72943,6 +76234,34 @@ func UnmarshalPublicGatewayReference(m map[string]json.RawMessage, result interf return } +// PublishPrivatePathServiceGatewayOptions : The PublishPrivatePathServiceGateway options. +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 + Headers map[string]string +} + +// NewPublishPrivatePathServiceGatewayOptions : Instantiate PublishPrivatePathServiceGatewayOptions +func (*VpcV1) NewPublishPrivatePathServiceGatewayOptions(privatePathServiceGatewayID string) *PublishPrivatePathServiceGatewayOptions { + return &PublishPrivatePathServiceGatewayOptions{ + PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID), + } +} + +// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID +func (_options *PublishPrivatePathServiceGatewayOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *PublishPrivatePathServiceGatewayOptions { + _options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *PublishPrivatePathServiceGatewayOptions) SetHeaders(param map[string]string) *PublishPrivatePathServiceGatewayOptions { + options.Headers = param + return options +} + // Region : Region struct type Region struct { // The API endpoint for this region. @@ -72994,7 +76313,7 @@ func UnmarshalRegion(m map[string]json.RawMessage, result interface{}) (err erro // RegionCollection : RegionCollection struct type RegionCollection struct { - // Collection of regions. + // The regions for the account. Regions []Region `json:"regions" validate:"required"` } @@ -73892,7 +77211,7 @@ type ReservationCollection struct { // except the last page. Next *ReservationCollectionNext `json:"next,omitempty"` - // Collection of reservations. + // A page of reservations. Reservations []Reservation `json:"reservations" validate:"required"` // The total number of resources across all pages. @@ -74622,7 +77941,7 @@ type ReservedIPCollection struct { // except the last page. Next *ReservedIPCollectionNext `json:"next,omitempty"` - // Collection of reserved IPs in this subnet. + // A page of reserved IPs in the subnet. ReservedIps []ReservedIP `json:"reserved_ips" validate:"required"` // The total number of resources across all pages. @@ -74681,7 +78000,7 @@ type ReservedIPCollectionBareMetalServerNetworkInterfaceContext struct { // A link to the first page of resources. First *ReservedIPCollectionBareMetalServerNetworkInterfaceContextFirst `json:"first" validate:"required"` - // Collection of reserved IPs bound to a bare metal server network interface. + // A page of reserved IPs bound to the bare metal server network interface. Ips []ReservedIP `json:"ips" validate:"required"` // The maximum number of resources that can be returned by the request. @@ -74768,7 +78087,7 @@ type ReservedIPCollectionEndpointGatewayContext struct { // A link to the first page of resources. First *ReservedIPCollectionEndpointGatewayContextFirst `json:"first" validate:"required"` - // Collection of reserved IPs bound to an endpoint gateway. + // A page of reserved IPs bound to the endpoint gateway. Ips []ReservedIP `json:"ips" validate:"required"` // The maximum number of resources that can be returned by the request. @@ -74888,7 +78207,7 @@ type ReservedIPCollectionInstanceNetworkInterfaceContext struct { // A link to the first page of resources. First *ReservedIPCollectionInstanceNetworkInterfaceContextFirst `json:"first" validate:"required"` - // Collection of reserved IPs bound to an instance network interface. + // A page of reserved IPs bound to the instance network interface. Ips []ReservedIP `json:"ips" validate:"required"` // The maximum number of resources that can be returned by the request. @@ -75008,7 +78327,7 @@ type ReservedIPCollectionVirtualNetworkInterfaceContext struct { // A link to the first page of resources. First *ReservedIPCollectionVirtualNetworkInterfaceContextFirst `json:"first" validate:"required"` - // Collection of reserved IPs bound to the virtual network interface specified by the identifier in the URL. + // A page of reserved IPs bound to the virtual network interface specified by the identifier in the URL. Ips []ReservedIPReference `json:"ips" validate:"required"` // The maximum number of resources that can be returned by the request. @@ -75460,6 +78779,44 @@ func (options *RestartBareMetalServerOptions) SetHeaders(param map[string]string return options } +// RevokeAccountForPrivatePathServiceGatewayOptions : The RevokeAccountForPrivatePathServiceGateway options. +type RevokeAccountForPrivatePathServiceGatewayOptions struct { + // The private path service gateway identifier. + PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="` + + // 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 + Headers map[string]string +} + +// NewRevokeAccountForPrivatePathServiceGatewayOptions : Instantiate RevokeAccountForPrivatePathServiceGatewayOptions +func (*VpcV1) NewRevokeAccountForPrivatePathServiceGatewayOptions(privatePathServiceGatewayID string, account AccountIdentityIntf) *RevokeAccountForPrivatePathServiceGatewayOptions { + return &RevokeAccountForPrivatePathServiceGatewayOptions{ + PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID), + Account: account, + } +} + +// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID +func (_options *RevokeAccountForPrivatePathServiceGatewayOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *RevokeAccountForPrivatePathServiceGatewayOptions { + _options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID) + return _options +} + +// SetAccount : Allow user to set Account +func (_options *RevokeAccountForPrivatePathServiceGatewayOptions) SetAccount(account AccountIdentityIntf) *RevokeAccountForPrivatePathServiceGatewayOptions { + _options.Account = account + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RevokeAccountForPrivatePathServiceGatewayOptions) SetHeaders(param map[string]string) *RevokeAccountForPrivatePathServiceGatewayOptions { + options.Headers = param + return options +} + // Route : Route struct type Route struct { // The action to perform with a packet matching the route: @@ -75646,7 +79003,7 @@ type RouteCollection struct { // except the last page. Next *RouteCollectionNext `json:"next,omitempty"` - // Collection of routes. + // A page of routes in the routing table. Routes []Route `json:"routes" validate:"required"` // The total number of resources across all pages. @@ -75748,7 +79105,7 @@ type RouteCollectionVPCContext struct { // except the last page. Next *RouteCollectionVPCContextNext `json:"next,omitempty"` - // Collection of routes. + // A page of routes in the routing table. Routes []RouteCollectionVPCContextRoutesItem `json:"routes" validate:"required"` // The total number of resources across all pages. @@ -76525,6 +79882,9 @@ type RoutingTable struct { // The date and time that this routing table was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + // The CRN for this VPC routing table. + CRN *string `json:"crn" validate:"required"` + // The URL for this routing table. Href *string `json:"href" validate:"required"` @@ -76540,6 +79900,9 @@ type RoutingTable struct { // The name for this routing table. The name is unique across all routing tables for the VPC. Name *string `json:"name" validate:"required"` + // The resource group for this routing table. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + // The resource type. ResourceType *string `json:"resource_type" validate:"required"` @@ -76634,6 +79997,11 @@ func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (er 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) if err != nil { err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) @@ -76659,6 +80027,11 @@ func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (er err = core.SDKErrorf(err, "", "name-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()) @@ -76710,7 +80083,7 @@ type RoutingTableCollection struct { // except the last page. Next *RoutingTableCollectionNext `json:"next,omitempty"` - // Collection of routing tables. + // A page of routing tables. RoutingTables []RoutingTable `json:"routing_tables" validate:"required"` // The total number of resources across all pages. @@ -76802,9 +80175,13 @@ func UnmarshalRoutingTableCollectionNext(m map[string]json.RawMessage, result in // RoutingTableIdentity : Identifies a routing table by a unique property. // Models which "extend" this model: +// - RoutingTableIdentityByCRN // - RoutingTableIdentityByID // - RoutingTableIdentityByHref type RoutingTableIdentity struct { + // The CRN for this VPC routing table. + CRN *string `json:"crn,omitempty"` + // The unique identifier for this routing table. ID *string `json:"id,omitempty"` @@ -76823,6 +80200,11 @@ type RoutingTableIdentityIntf interface { // UnmarshalRoutingTableIdentity unmarshals an instance of RoutingTableIdentity from the specified map of raw messages. func UnmarshalRoutingTableIdentity(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(RoutingTableIdentity) + 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()) @@ -76973,6 +80355,9 @@ func (routingTablePatch *RoutingTablePatch) AsPatch() (_patch map[string]interfa // RoutingTableReference : RoutingTableReference struct type RoutingTableReference struct { + // The CRN for this VPC routing table. + 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"` @@ -76999,6 +80384,11 @@ const ( // UnmarshalRoutingTableReference unmarshals an instance of RoutingTableReference from the specified map of raw messages. func UnmarshalRoutingTableReference(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(RoutingTableReference) + 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()) @@ -77122,7 +80512,7 @@ type SecurityGroupCollection struct { // except the last page. Next *SecurityGroupCollectionNext `json:"next,omitempty"` - // Collection of security groups. + // A page of security groups. SecurityGroups []SecurityGroup `json:"security_groups" validate:"required"` // The total number of resources across all pages. @@ -77463,9 +80853,9 @@ func UnmarshalSecurityGroupRule(m map[string]json.RawMessage, result interface{} return } -// SecurityGroupRuleCollection : Collection of rules in a security group. +// SecurityGroupRuleCollection : SecurityGroupRuleCollection struct type SecurityGroupRuleCollection struct { - // Array of rules. + // The rules for the security group. Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` } @@ -78119,7 +81509,7 @@ type SecurityGroupTargetCollection struct { // except the last page. Next *SecurityGroupTargetCollectionNext `json:"next,omitempty"` - // Collection of targets for this security group. + // A page of targets for the security group. Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` // The total number of resources across all pages. @@ -78925,7 +82315,7 @@ func UnmarshalShareAccessorBindingAccessor(m map[string]json.RawMessage, result // ShareAccessorBindingCollection : ShareAccessorBindingCollection struct type ShareAccessorBindingCollection struct { - // Collection of share accessor bindings. + // A page of accessor bindings for the share. AccessorBindings []ShareAccessorBinding `json:"accessor_bindings" validate:"required"` // A link to the first page of resources. @@ -79077,7 +82467,7 @@ type ShareCollection struct { // except the last page. Next *ShareCollectionNext `json:"next,omitempty"` - // Collection of file shares. + // A page of file shares. Shares []Share `json:"shares" validate:"required"` // The total number of resources across all pages. @@ -79660,7 +83050,7 @@ type ShareMountTargetCollection struct { // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` - // Collection of share mount targets. + // A page of mount targets for the share. MountTargets []ShareMountTarget `json:"mount_targets" validate:"required"` // A link to the next page of resources. This property is present for all pages @@ -80403,7 +83793,7 @@ type ShareProfileCollection struct { // except the last page. Next *ShareProfileCollectionNext `json:"next,omitempty"` - // Collection of share profiles. + // A page of share profiles. Profiles []ShareProfile `json:"profiles" validate:"required"` // The total number of resources across all pages. @@ -81466,7 +84856,7 @@ func UnmarshalSnapshotClone(m map[string]json.RawMessage, result interface{}) (e // SnapshotCloneCollection : SnapshotCloneCollection struct type SnapshotCloneCollection struct { - // Collection of snapshot clones. + // The clones for the snapshot. Clones []SnapshotClone `json:"clones" validate:"required"` } @@ -81525,7 +84915,7 @@ type SnapshotCollection struct { // except the last page. Next *SnapshotCollectionNext `json:"next,omitempty"` - // Collection of snapshots. + // A page of snapshots. Snapshots []Snapshot `json:"snapshots" validate:"required"` // The total number of resources across all pages. @@ -81755,7 +85145,7 @@ type SnapshotConsistencyGroupCollection struct { // except the last page. Next *SnapshotConsistencyGroupCollectionNext `json:"next,omitempty"` - // Collection of snapshot consistency groups. + // A page of snapshot consistency groups. SnapshotConsistencyGroups []SnapshotConsistencyGroup `json:"snapshot_consistency_groups" validate:"required"` // The total number of resources across all pages. @@ -82379,6 +85769,10 @@ func UnmarshalSnapshotReference(m map[string]json.RawMessage, result interface{} // SnapshotRemote : If present, this property indicates that the resource associated with this reference is remote and therefore may not // be directly retrievable. type SnapshotRemote struct { + // If present, this property indicates that the referenced resource is remote to this + // account, and identifies the owning account. + Account *AccountReference `json:"account,omitempty"` + // If present, this property indicates that the referenced resource is remote to this // region, and identifies the native region. Region *RegionReference `json:"region,omitempty"` @@ -82387,6 +85781,11 @@ type SnapshotRemote struct { // UnmarshalSnapshotRemote unmarshals an instance of SnapshotRemote from the specified map of raw messages. func UnmarshalSnapshotRemote(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(SnapshotRemote) + err = core.UnmarshalModel(m, "account", &obj.Account, UnmarshalAccountReference) + if err != nil { + err = core.SDKErrorf(err, "", "account-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) if err != nil { err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) @@ -82730,7 +86129,7 @@ type SubnetCollection struct { // except the last page. Next *SubnetCollectionNext `json:"next,omitempty"` - // Collection of subnets. + // A page of subnets. Subnets []Subnet `json:"subnets" validate:"required"` // The total number of resources across all pages. @@ -83229,6 +86628,34 @@ func UnmarshalTrustedProfileReference(m map[string]json.RawMessage, result inter return } +// UnpublishPrivatePathServiceGatewayOptions : The UnpublishPrivatePathServiceGateway options. +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 + Headers map[string]string +} + +// NewUnpublishPrivatePathServiceGatewayOptions : Instantiate UnpublishPrivatePathServiceGatewayOptions +func (*VpcV1) NewUnpublishPrivatePathServiceGatewayOptions(privatePathServiceGatewayID string) *UnpublishPrivatePathServiceGatewayOptions { + return &UnpublishPrivatePathServiceGatewayOptions{ + PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID), + } +} + +// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID +func (_options *UnpublishPrivatePathServiceGatewayOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *UnpublishPrivatePathServiceGatewayOptions { + _options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UnpublishPrivatePathServiceGatewayOptions) SetHeaders(param map[string]string) *UnpublishPrivatePathServiceGatewayOptions { + options.Headers = param + return options +} + // UnsetSubnetPublicGatewayOptions : The UnsetSubnetPublicGateway options. type UnsetSubnetPublicGatewayOptions struct { // The subnet identifier. @@ -85000,6 +88427,92 @@ func (options *UpdatePlacementGroupOptions) SetHeaders(param map[string]string) return options } +// UpdatePrivatePathServiceGatewayAccountPolicyOptions : The UpdatePrivatePathServiceGatewayAccountPolicy options. +type UpdatePrivatePathServiceGatewayAccountPolicyOptions struct { + // The private path service gateway identifier. + PrivatePathServiceGatewayID *string `json:"private_path_service_gateway_id" validate:"required,ne="` + + // The account policy identifier. + ID *string `json:"id" validate:"required,ne="` + + // The account policy patch. + PrivatePathServiceGatewayAccountPolicyPatch map[string]interface{} `json:"PrivatePathServiceGatewayAccountPolicy_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdatePrivatePathServiceGatewayAccountPolicyOptions : Instantiate UpdatePrivatePathServiceGatewayAccountPolicyOptions +func (*VpcV1) NewUpdatePrivatePathServiceGatewayAccountPolicyOptions(privatePathServiceGatewayID string, id string, privatePathServiceGatewayAccountPolicyPatch map[string]interface{}) *UpdatePrivatePathServiceGatewayAccountPolicyOptions { + return &UpdatePrivatePathServiceGatewayAccountPolicyOptions{ + PrivatePathServiceGatewayID: core.StringPtr(privatePathServiceGatewayID), + ID: core.StringPtr(id), + PrivatePathServiceGatewayAccountPolicyPatch: privatePathServiceGatewayAccountPolicyPatch, + } +} + +// SetPrivatePathServiceGatewayID : Allow user to set PrivatePathServiceGatewayID +func (_options *UpdatePrivatePathServiceGatewayAccountPolicyOptions) SetPrivatePathServiceGatewayID(privatePathServiceGatewayID string) *UpdatePrivatePathServiceGatewayAccountPolicyOptions { + _options.PrivatePathServiceGatewayID = core.StringPtr(privatePathServiceGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdatePrivatePathServiceGatewayAccountPolicyOptions) SetID(id string) *UpdatePrivatePathServiceGatewayAccountPolicyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetPrivatePathServiceGatewayAccountPolicyPatch : Allow user to set PrivatePathServiceGatewayAccountPolicyPatch +func (_options *UpdatePrivatePathServiceGatewayAccountPolicyOptions) SetPrivatePathServiceGatewayAccountPolicyPatch(privatePathServiceGatewayAccountPolicyPatch map[string]interface{}) *UpdatePrivatePathServiceGatewayAccountPolicyOptions { + _options.PrivatePathServiceGatewayAccountPolicyPatch = privatePathServiceGatewayAccountPolicyPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdatePrivatePathServiceGatewayAccountPolicyOptions) SetHeaders(param map[string]string) *UpdatePrivatePathServiceGatewayAccountPolicyOptions { + options.Headers = param + return options +} + +// UpdatePrivatePathServiceGatewayOptions : The UpdatePrivatePathServiceGateway options. +type UpdatePrivatePathServiceGatewayOptions struct { + // The private path service gateway identifier. + ID *string `json:"id" validate:"required,ne="` + + // The private path service gateway patch. + PrivatePathServiceGatewayPatch map[string]interface{} `json:"PrivatePathServiceGateway_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdatePrivatePathServiceGatewayOptions : Instantiate UpdatePrivatePathServiceGatewayOptions +func (*VpcV1) NewUpdatePrivatePathServiceGatewayOptions(id string, privatePathServiceGatewayPatch map[string]interface{}) *UpdatePrivatePathServiceGatewayOptions { + return &UpdatePrivatePathServiceGatewayOptions{ + ID: core.StringPtr(id), + PrivatePathServiceGatewayPatch: privatePathServiceGatewayPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdatePrivatePathServiceGatewayOptions) SetID(id string) *UpdatePrivatePathServiceGatewayOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetPrivatePathServiceGatewayPatch : Allow user to set PrivatePathServiceGatewayPatch +func (_options *UpdatePrivatePathServiceGatewayOptions) SetPrivatePathServiceGatewayPatch(privatePathServiceGatewayPatch map[string]interface{}) *UpdatePrivatePathServiceGatewayOptions { + _options.PrivatePathServiceGatewayPatch = privatePathServiceGatewayPatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdatePrivatePathServiceGatewayOptions) SetHeaders(param map[string]string) *UpdatePrivatePathServiceGatewayOptions { + options.Headers = param + return options +} + // UpdatePublicGatewayOptions : The UpdatePublicGateway options. type UpdatePublicGatewayOptions struct { // The public gateway identifier. @@ -86270,7 +89783,7 @@ type VPCCollection struct { // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` - // Collection of VPCs. + // A page of VPCs. Vpcs []VPC `json:"vpcs" validate:"required"` } @@ -86585,7 +90098,7 @@ func UnmarshalVpcdnsResolutionBinding(m map[string]json.RawMessage, result inter // VpcdnsResolutionBindingCollection : VpcdnsResolutionBindingCollection struct type VpcdnsResolutionBindingCollection struct { - // Collection of DNS resolution bindings for this VPC. + // A page of DNS resolution bindings for the VPC. DnsResolutionBindings []VpcdnsResolutionBinding `json:"dns_resolution_bindings" validate:"required"` // A link to the first page of resources. @@ -86771,7 +90284,7 @@ type VpcdnsResolver struct { // // - `custom_resolver`: A custom DNS resolver is configured for this VPC. // - // - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when + // - `private_resolver`: A private DNS resolver is configured for this VPC. Applies when // the VPC has either or both of the following: // // - at least one endpoint gateway residing in it @@ -86808,7 +90321,7 @@ const ( // // - `custom_resolver`: A custom DNS resolver is configured for this VPC. // -// - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when +// - `private_resolver`: A private DNS resolver is configured for this VPC. Applies when // the VPC has either or both of the following: // // - at least one endpoint gateway residing in it @@ -87471,7 +90984,7 @@ type VPNGateway struct { // The lifecycle state of the VPN gateway. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // Collection of VPN gateway members. + // The members for the VPN gateway. Members []VPNGatewayMember `json:"members" validate:"required"` // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. @@ -87641,7 +91154,7 @@ type VPNGatewayCollection struct { // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` - // Collection of VPN gateways. + // A page of VPN gateways. VPNGateways []VPNGatewayIntf `json:"vpn_gateways" validate:"required"` } @@ -87901,7 +91414,7 @@ func UnmarshalVPNGatewayConnectionCIDRs(m map[string]json.RawMessage, result int // VPNGatewayConnectionCollection : VPNGatewayConnectionCollection struct type VPNGatewayConnectionCollection struct { - // Collection of VPN gateway connections in a VPN gateway. + // A page of connections for the VPN gateway. Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` // A link to the first page of resources. @@ -90219,7 +93732,7 @@ func UnmarshalVPNServerClient(m map[string]json.RawMessage, result interface{}) // VPNServerClientCollection : VPNServerClientCollection struct type VPNServerClientCollection struct { - // Collection of VPN clients. + // A page of clients of the VPN server. Clients []VPNServerClient `json:"clients" validate:"required"` // A link to the first page of resources. @@ -90334,7 +93847,7 @@ type VPNServerCollection struct { // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` - // Collection of VPN servers. + // A page of VPN servers. VPNServers []VPNServer `json:"vpn_servers" validate:"required"` } @@ -90839,7 +94352,7 @@ type VPNServerRouteCollection struct { // except the last page. Next *VPNServerRouteCollectionNext `json:"next,omitempty"` - // Collection of VPN routes. + // A page of routes for the VPN server. Routes []VPNServerRoute `json:"routes" validate:"required"` // The total number of resources across all pages. @@ -91305,7 +94818,7 @@ type VirtualNetworkInterfaceCollection struct { // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` - // Collection of virtual network interfaces. + // A page of virtual network interfaces. VirtualNetworkInterfaces []VirtualNetworkInterface `json:"virtual_network_interfaces" validate:"required"` } @@ -91759,6 +95272,12 @@ type Volume struct { // Indicates whether a running virtual server instance has an attachment to this volume. Active *bool `json:"active" validate:"required"` + // The attachment states that support adjustable capacity for this volume. + AdjustableCapacityStates []string `json:"adjustable_capacity_states" validate:"required"` + + // The attachment states that support adjustable IOPS for this volume. + AdjustableIopsStates []string `json:"adjustable_iops_states" validate:"required"` + // The attachment state of the volume // - `unattached`: Not attached to any virtual server instances // - `attached`: Attached to a virtual server instance (even if the instance is stopped) @@ -91866,6 +95385,28 @@ type Volume struct { Zone *ZoneReference `json:"zone" validate:"required"` } +// Constants associated with the Volume.AdjustableCapacityStates property. +// The attachment state of the volume +// - `unattached`: Not attached to any virtual server instances +// - `attached`: Attached to a virtual server instance (even if the instance is stopped) +// - `unusable`: Not able to be attached to any virtual server instances. +const ( + VolumeAdjustableCapacityStatesAttachedConst = "attached" + VolumeAdjustableCapacityStatesUnattachedConst = "unattached" + VolumeAdjustableCapacityStatesUnusableConst = "unusable" +) + +// Constants associated with the Volume.AdjustableIopsStates property. +// The attachment state of the volume +// - `unattached`: Not attached to any virtual server instances +// - `attached`: Attached to a virtual server instance (even if the instance is stopped) +// - `unusable`: Not able to be attached to any virtual server instances. +const ( + VolumeAdjustableIopsStatesAttachedConst = "attached" + VolumeAdjustableIopsStatesUnattachedConst = "unattached" + VolumeAdjustableIopsStatesUnusableConst = "unusable" +) + // Constants associated with the Volume.AttachmentState property. // The attachment state of the volume // - `unattached`: Not attached to any virtual server instances @@ -91927,6 +95468,16 @@ func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err erro err = core.SDKErrorf(err, "", "active-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "adjustable_capacity_states", &obj.AdjustableCapacityStates) + if err != nil { + err = core.SDKErrorf(err, "", "adjustable_capacity_states-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "adjustable_iops_states", &obj.AdjustableIopsStates) + if err != nil { + err = core.SDKErrorf(err, "", "adjustable_iops_states-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "attachment_state", &obj.AttachmentState) if err != nil { err = core.SDKErrorf(err, "", "attachment_state-error", common.GetComponentInfo()) @@ -92174,7 +95725,7 @@ func UnmarshalVolumeAttachment(m map[string]json.RawMessage, result interface{}) // VolumeAttachmentCollection : VolumeAttachmentCollection struct type VolumeAttachmentCollection struct { - // Collection of volume attachments. + // The volume attachments for the instance. VolumeAttachments []VolumeAttachment `json:"volume_attachments" validate:"required"` } @@ -92449,8 +96000,8 @@ type VolumeAttachmentPrototypeVolume struct { // The URL for this volume. Href *string `json:"href,omitempty"` - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. + // The maximum I/O operations per second (IOPS) to use for this volume. If specified, the `family` of the volume + // profile must be `custom` or `defined_performance`. Iops *int64 `json:"iops,omitempty"` // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will @@ -92468,10 +96019,8 @@ type VolumeAttachmentPrototypeVolume struct { // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` - // The capacity to use for the volume (in gigabytes). - // - // The minimum and maximum limits for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + // The capacity to use for the volume (in gigabytes). The specified value must be within the `capacity` range of the + // volume's profile. Capacity *int64 `json:"capacity,omitempty"` // The root key to use to wrap the data encryption key for the volume. @@ -92479,7 +96028,9 @@ type VolumeAttachmentPrototypeVolume struct { // If unspecified, the `encryption` type for the volume will be `provider_managed`. EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - // The snapshot from which to clone the volume. + // The snapshot to use as a source for the volume's data. + // + // The specified snapshot may be in a different account, subject to IAM policies. SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` } @@ -92745,7 +96296,7 @@ type VolumeCollection struct { // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` - // Collection of volumes. + // A page of volumes. Volumes []Volume `json:"volumes" validate:"required"` } @@ -92847,7 +96398,8 @@ type VolumeHealthReason struct { // Constants associated with the VolumeHealthReason.Code property. // A reason code for this health state. const ( - VolumeHealthReasonCodeInitializingFromSnapshotConst = "initializing_from_snapshot" + VolumeHealthReasonCodeInitializingFromSnapshotConst = "initializing_from_snapshot" + VolumeHealthReasonCodeThrottledByInsufficientInstanceBandwidthConst = "throttled_by_insufficient_instance_bandwidth" ) // UnmarshalVolumeHealthReason unmarshals an instance of VolumeHealthReason from the specified map of raw messages. @@ -92920,24 +96472,33 @@ func UnmarshalVolumeIdentity(m map[string]json.RawMessage, result interface{}) ( // VolumePatch : VolumePatch struct type VolumePatch struct { - // The capacity to use for the volume (in gigabytes). The volume must be attached to a running virtual server instance, - // and the specified value must not be less than the current capacity. Additionally, if the volume is attached as a - // boot volume, the maximum value is 250 gigabytes. - // - // The minimum and maximum limits for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + // The capacity to use for the volume (in gigabytes). For the capacity to be changed the volume's current + // `attachment_state` must be one of the values included in + // `adjustable_capacity_states`. If `adjustable_capacity_states` is empty, then the volume capacity cannot be changed. + // Additionally: + // - The specified value must not be less than the current capacity. + // - If the volume is attached as a boot volume, the specified value must not exceed + // the `boot_capacity.max` of the volume profile. + // - If the volume is attached as a data volume, the specified value must not exceed + // the `capacity.max` of the volume profile. Capacity *int64 `json:"capacity,omitempty"` - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. The volume must be attached as a data volume to a running virtual server instance. + // The maximum I/O operations per second (IOPS) to use for this volume. For the IOPS to be changed the volume's + // current `attachment_state` must be one of the values included in `adjustable_iops_states`. If + // `adjustable_iops_states` is empty, then the IOPS cannot be changed. Iops *int64 `json:"iops,omitempty"` // The name for this volume. The name must not be used by another volume in the region. Name *string `json:"name,omitempty"` // The profile to use for this volume. The requested profile must be in the same - // `family` as the current profile. The volume must have a `capacity` within the - // range supported by the specified profile. + // `family` as the current profile. Additionally: + // - If the volume is a boot volume then the value specified for `capacity` property + // must not be less than the `boot_capacity.min` and must not exceed the + // `boot_capacity.max` of the specified volume profile. + // - If the volume is a data volume then the value specified for `capacity` property + // must not be less than the `capacity.min` and must not exceed the `capacity.max` + // of the specified volume profile. Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -92991,6 +96552,14 @@ func (volumePatch *VolumePatch) AsPatch() (_patch map[string]interface{}, err er // VolumeProfile : VolumeProfile struct type VolumeProfile struct { + AdjustableCapacityStates *VolumeProfileAdjustableCapacityStates `json:"adjustable_capacity_states" validate:"required"` + + AdjustableIopsStates *VolumeProfileAdjustableIopsStates `json:"adjustable_iops_states" validate:"required"` + + BootCapacity VolumeProfileBootCapacityIntf `json:"boot_capacity" validate:"required"` + + Capacity VolumeProfileCapacityIntf `json:"capacity" validate:"required"` + // The product family this volume profile belongs to. // // The enumerated values for this property may @@ -93000,6 +96569,8 @@ type VolumeProfile struct { // The URL for this volume profile. Href *string `json:"href" validate:"required"` + Iops VolumeProfileIopsIntf `json:"iops" validate:"required"` + // The globally unique name for this volume profile. Name *string `json:"name" validate:"required"` } @@ -93010,13 +96581,34 @@ type VolumeProfile struct { // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( - VolumeProfileFamilyCustomConst = "custom" - VolumeProfileFamilyTieredConst = "tiered" + VolumeProfileFamilyCustomConst = "custom" + VolumeProfileFamilyDefinedPerformanceConst = "defined_performance" + VolumeProfileFamilyTieredConst = "tiered" ) // UnmarshalVolumeProfile unmarshals an instance of VolumeProfile from the specified map of raw messages. func UnmarshalVolumeProfile(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(VolumeProfile) + err = core.UnmarshalModel(m, "adjustable_capacity_states", &obj.AdjustableCapacityStates, UnmarshalVolumeProfileAdjustableCapacityStates) + if err != nil { + err = core.SDKErrorf(err, "", "adjustable_capacity_states-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "adjustable_iops_states", &obj.AdjustableIopsStates, UnmarshalVolumeProfileAdjustableIopsStates) + if err != nil { + err = core.SDKErrorf(err, "", "adjustable_iops_states-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "boot_capacity", &obj.BootCapacity, UnmarshalVolumeProfileBootCapacity) + if err != nil { + err = core.SDKErrorf(err, "", "boot_capacity-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalVolumeProfileCapacity) + if err != nil { + err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "family", &obj.Family) if err != nil { err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo()) @@ -93027,6 +96619,11 @@ func UnmarshalVolumeProfile(m map[string]json.RawMessage, result interface{}) (e err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "iops", &obj.Iops, UnmarshalVolumeProfileIops) + if err != nil { + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) @@ -93036,6 +96633,262 @@ func UnmarshalVolumeProfile(m map[string]json.RawMessage, result interface{}) (e return } +// VolumeProfileAdjustableCapacityStates : VolumeProfileAdjustableCapacityStates struct +type VolumeProfileAdjustableCapacityStates struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The attachment states that support adjustable capacity for a volume with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the VolumeProfileAdjustableCapacityStates.Type property. +// The type for this profile field. +const ( + VolumeProfileAdjustableCapacityStatesTypeEnumConst = "enum" +) + +// Constants associated with the VolumeProfileAdjustableCapacityStates.Values property. +// The attachment state of the volume +// - `unattached`: Not attached to any virtual server instances +// - `attached`: Attached to a virtual server instance (even if the instance is stopped) +// - `unusable`: Not able to be attached to any virtual server instances. +const ( + VolumeProfileAdjustableCapacityStatesValuesAttachedConst = "attached" + VolumeProfileAdjustableCapacityStatesValuesUnattachedConst = "unattached" + VolumeProfileAdjustableCapacityStatesValuesUnusableConst = "unusable" +) + +// UnmarshalVolumeProfileAdjustableCapacityStates unmarshals an instance of VolumeProfileAdjustableCapacityStates from the specified map of raw messages. +func UnmarshalVolumeProfileAdjustableCapacityStates(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileAdjustableCapacityStates) + 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 +} + +// VolumeProfileAdjustableIopsStates : VolumeProfileAdjustableIopsStates struct +type VolumeProfileAdjustableIopsStates struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The attachment states that support adjustable IOPS for a volume with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the VolumeProfileAdjustableIopsStates.Type property. +// The type for this profile field. +const ( + VolumeProfileAdjustableIopsStatesTypeEnumConst = "enum" +) + +// Constants associated with the VolumeProfileAdjustableIopsStates.Values property. +// The attachment state of the volume +// - `unattached`: Not attached to any virtual server instances +// - `attached`: Attached to a virtual server instance (even if the instance is stopped) +// - `unusable`: Not able to be attached to any virtual server instances. +const ( + VolumeProfileAdjustableIopsStatesValuesAttachedConst = "attached" + VolumeProfileAdjustableIopsStatesValuesUnattachedConst = "unattached" + VolumeProfileAdjustableIopsStatesValuesUnusableConst = "unusable" +) + +// UnmarshalVolumeProfileAdjustableIopsStates unmarshals an instance of VolumeProfileAdjustableIopsStates from the specified map of raw messages. +func UnmarshalVolumeProfileAdjustableIopsStates(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileAdjustableIopsStates) + 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 +} + +// VolumeProfileBootCapacity : VolumeProfileBootCapacity struct +// Models which "extend" this model: +// - VolumeProfileBootCapacityFixed +// - VolumeProfileBootCapacityRange +// - VolumeProfileBootCapacityEnum +// - VolumeProfileBootCapacityDependentRange +type VolumeProfileBootCapacity 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 VolumeProfileBootCapacity.Type property. +// The type for this profile field. +const ( + VolumeProfileBootCapacityTypeFixedConst = "fixed" +) + +func (*VolumeProfileBootCapacity) isaVolumeProfileBootCapacity() bool { + return true +} + +type VolumeProfileBootCapacityIntf interface { + isaVolumeProfileBootCapacity() bool +} + +// UnmarshalVolumeProfileBootCapacity unmarshals an instance of VolumeProfileBootCapacity from the specified map of raw messages. +func UnmarshalVolumeProfileBootCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileBootCapacity) + 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, "", "values-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileCapacity : VolumeProfileCapacity struct +// Models which "extend" this model: +// - VolumeProfileCapacityFixed +// - VolumeProfileCapacityRange +// - VolumeProfileCapacityEnum +// - VolumeProfileCapacityDependentRange +type VolumeProfileCapacity 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 VolumeProfileCapacity.Type property. +// The type for this profile field. +const ( + VolumeProfileCapacityTypeFixedConst = "fixed" +) + +func (*VolumeProfileCapacity) isaVolumeProfileCapacity() bool { + return true +} + +type VolumeProfileCapacityIntf interface { + isaVolumeProfileCapacity() bool +} + +// UnmarshalVolumeProfileCapacity unmarshals an instance of VolumeProfileCapacity from the specified map of raw messages. +func UnmarshalVolumeProfileCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileCapacity) + 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, "", "values-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VolumeProfileCollection : VolumeProfileCollection struct type VolumeProfileCollection struct { // A link to the first page of resources. @@ -93048,7 +96901,7 @@ type VolumeProfileCollection struct { // except the last page. Next *VolumeProfileCollectionNext `json:"next,omitempty"` - // Collection of volume profiles. + // A page of volume profiles. Profiles []VolumeProfile `json:"profiles" validate:"required"` // The total number of resources across all pages. @@ -93138,6 +96991,91 @@ func UnmarshalVolumeProfileCollectionNext(m map[string]json.RawMessage, result i return } +// VolumeProfileIops : VolumeProfileIops struct +// Models which "extend" this model: +// - VolumeProfileIopsFixed +// - VolumeProfileIopsRange +// - VolumeProfileIopsEnum +// - VolumeProfileIopsDependentRange +type VolumeProfileIops 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 VolumeProfileIops.Type property. +// The type for this profile field. +const ( + VolumeProfileIopsTypeFixedConst = "fixed" +) + +func (*VolumeProfileIops) isaVolumeProfileIops() bool { + return true +} + +type VolumeProfileIopsIntf interface { + isaVolumeProfileIops() bool +} + +// UnmarshalVolumeProfileIops unmarshals an instance of VolumeProfileIops from the specified map of raw messages. +func UnmarshalVolumeProfileIops(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIops) + 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, "", "values-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VolumeProfileIdentity : Identifies a volume profile by a unique property. // Models which "extend" this model: // - VolumeProfileIdentityByName @@ -93206,8 +97144,8 @@ func UnmarshalVolumeProfileReference(m map[string]json.RawMessage, result interf // - VolumePrototypeVolumeByCapacity // - VolumePrototypeVolumeBySourceSnapshot type VolumePrototype struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. + // The maximum I/O operations per second (IOPS) to use for this volume. If specified, the `family` of the volume + // profile must be `custom` or `defined_performance`. Iops *int64 `json:"iops,omitempty"` // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will @@ -93228,10 +97166,8 @@ type VolumePrototype struct { // The zone this volume will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The capacity to use for the volume (in gigabytes). - // - // The minimum and maximum limits for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + // The capacity to use for the volume (in gigabytes). The specified value must be within the `capacity` range of the + // volume's profile. Capacity *int64 `json:"capacity,omitempty"` // The root key to use to wrap the data encryption key for the volume. @@ -93239,7 +97175,9 @@ type VolumePrototype struct { // If unspecified, the `encryption` type for the volume will be `provider_managed`. EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - // The snapshot from which to clone the volume. + // The snapshot to use as a source for the volume's data. + // + // The specified snapshot may be in a different account, subject to IAM policies. SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` } @@ -93305,8 +97243,9 @@ func UnmarshalVolumePrototype(m map[string]json.RawMessage, result interface{}) // VolumePrototypeInstanceByImageContext : VolumePrototypeInstanceByImageContext struct type VolumePrototypeInstanceByImageContext struct { - // The capacity to use for the volume (in gigabytes). Must be at least the image's - // `minimum_provisioned_size`. The maximum value may increase in the future. + // The capacity to use for the volume (in gigabytes). The specified value must be at least the image's + // `minimum_provisioned_size`, at most 250 gigabytes, and within the + // `boot_capacity` range of the volume's profile. // // If unspecified, the capacity will be the image's `minimum_provisioned_size`. Capacity *int64 `json:"capacity,omitempty"` @@ -93316,8 +97255,8 @@ type VolumePrototypeInstanceByImageContext struct { // If unspecified, the `encryption` type for the volume will be `provider_managed`. EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. + // The maximum I/O operations per second (IOPS) to use for this volume. If specified, the `family` of the volume + // profile must be `custom` or `defined_performance`. Iops *int64 `json:"iops,omitempty"` // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will @@ -93392,10 +97331,8 @@ func UnmarshalVolumePrototypeInstanceByImageContext(m map[string]json.RawMessage // VolumePrototypeInstanceBySourceSnapshotContext : VolumePrototypeInstanceBySourceSnapshotContext struct type VolumePrototypeInstanceBySourceSnapshotContext struct { - // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's - // `minimum_capacity`. The maximum value may increase in the future. - // - // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. + // The capacity to use for the volume (in gigabytes). The specified value must be at least the snapshot's + // `minimum_capacity`, at most 250 gigabytes, and within the `boot_capacity` range of the volume's profile. Capacity *int64 `json:"capacity,omitempty"` // The root key to use to wrap the data encryption key for the volume. @@ -93403,8 +97340,8 @@ type VolumePrototypeInstanceBySourceSnapshotContext struct { // If unspecified, the `encryption` type for the volume will be `provider_managed`. EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. + // The maximum I/O operations per second (IOPS) to use for this volume. If specified, the `family` of the volume + // profile must be `custom` or `defined_performance`. Iops *int64 `json:"iops,omitempty"` // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will @@ -93419,7 +97356,9 @@ type VolumePrototypeInstanceBySourceSnapshotContext struct { // group will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The snapshot from which to clone the volume. + // The snapshot to use as a source for the volume's data. + // + // The specified snapshot may be in a different account, subject to IAM policies. SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. @@ -93817,7 +97756,7 @@ func UnmarshalZone(m map[string]json.RawMessage, result interface{}) (err error) // ZoneCollection : ZoneCollection struct type ZoneCollection struct { - // Collection of zones. + // The zones for the region. Zones []Zone `json:"zones" validate:"required"` } @@ -93896,6 +97835,41 @@ func UnmarshalZoneReference(m map[string]json.RawMessage, result interface{}) (e return } +// AccountIdentityByID : AccountIdentityByID struct +// This model "extends" AccountIdentity +type AccountIdentityByID struct { + // The unique identifier for this account. + ID *string `json:"id" validate:"required"` +} + +// NewAccountIdentityByID : Instantiate AccountIdentityByID (Generic Model Constructor) +func (*VpcV1) NewAccountIdentityByID(id string) (_model *AccountIdentityByID, err error) { + _model = &AccountIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*AccountIdentityByID) isaAccountIdentity() bool { + return true +} + +// UnmarshalAccountIdentityByID unmarshals an instance of AccountIdentityByID from the specified map of raw messages. +func UnmarshalAccountIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccountIdentityByID) + 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 +} + // BackupPolicyJobSourceInstanceReference : BackupPolicyJobSourceInstanceReference struct // This model "extends" BackupPolicyJobSource type BackupPolicyJobSourceInstanceReference struct { @@ -99609,94 +103583,216 @@ func UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext(m map[st return } -// EndpointGatewayTargetPrototypeProviderCloudServiceIdentity : EndpointGatewayTargetPrototypeProviderCloudServiceIdentity struct -// Models which "extend" this model: -// - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN +// EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype : EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype struct // This model "extends" EndpointGatewayTargetPrototype -type EndpointGatewayTargetPrototypeProviderCloudServiceIdentity struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` +type EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype struct { + // The CRN for this private path service gateway. + CRN *string `json:"crn" validate:"required"` - // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. - CRN *string `json:"crn,omitempty"` + // The target resource type for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the EndpointGatewayTargetPrototypeProviderCloudServiceIdentity.ResourceType property. -// The type of target for this endpoint gateway. +// Constants associated with the EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype.ResourceType property. +// The target resource type for this endpoint gateway. const ( - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" + EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototypeResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" ) -func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool { - return true -} - -type EndpointGatewayTargetPrototypeProviderCloudServiceIdentityIntf interface { - EndpointGatewayTargetPrototypeIntf - isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool +// NewEndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype : Instantiate EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype(crn string, resourceType string) (_model *EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype, err error) { + _model = &EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype{ + CRN: core.StringPtr(crn), + ResourceType: core.StringPtr(resourceType), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return } -func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) isaEndpointGatewayTargetPrototype() bool { +func (*EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype) isaEndpointGatewayTargetPrototype() bool { return true } -// UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity unmarshals an instance of EndpointGatewayTargetPrototypeProviderCloudServiceIdentity from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) +// UnmarshalEndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype unmarshals an instance of EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypePrivatePathServiceGatewayPrototype) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + err = core.SDKErrorf(err, "", "crn-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 +} + +// EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype : EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype struct +// This model "extends" EndpointGatewayTargetPrototype +type EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype struct { + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn" validate:"required"` + + // The target resource type for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype.ResourceType property. +// The target resource type for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototypeResourceTypeProviderCloudServiceConst = "provider_cloud_service" +) + +// NewEndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype : Instantiate EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype(crn string, resourceType string) (_model *EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype, err error) { + _model = &EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype{ + CRN: core.StringPtr(crn), + ResourceType: core.StringPtr(resourceType), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype unmarshals an instance of EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype) err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { err = core.SDKErrorf(err, "", "crn-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 } -// EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity : EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity struct -// Models which "extend" this model: -// - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName +// EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype : The name of this provider infrastructure service. // This model "extends" EndpointGatewayTargetPrototype -type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` - +type EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype struct { // The name of a provider infrastructure service. Must be: // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. - Name *string `json:"name,omitempty"` + Name *string `json:"name" validate:"required"` + + // The target resource type for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity.ResourceType property. -// The type of target for this endpoint gateway. +// Constants associated with the EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype.ResourceType property. +// The target resource type for this endpoint gateway. const ( - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" + EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototypeResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" ) -func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool { +// NewEndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype : Instantiate EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype(name string, resourceType string) (_model *EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype, err error) { + _model = &EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype{ + Name: core.StringPtr(name), + ResourceType: core.StringPtr(resourceType), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype) isaEndpointGatewayTargetPrototype() bool { return true } -type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityIntf interface { - EndpointGatewayTargetPrototypeIntf - isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool +// UnmarshalEndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype unmarshals an instance of EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype) + 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 +} + +// EndpointGatewayTargetPrivatePathServiceGatewayReference : EndpointGatewayTargetPrivatePathServiceGatewayReference struct +// This model "extends" EndpointGatewayTarget +type EndpointGatewayTargetPrivatePathServiceGatewayReference struct { + // The CRN for this private path service gateway. + 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"` + + // The URL for this private path service gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this private path service gateway. + ID *string `json:"id" validate:"required"` + + // The name for this private path service gateway. The name is unique across all private path service gateways in the + // VPC. + 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 *PrivatePathServiceGatewayRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) isaEndpointGatewayTargetPrototype() bool { +// Constants associated with the EndpointGatewayTargetPrivatePathServiceGatewayReference.ResourceType property. +// The resource type. +const ( + EndpointGatewayTargetPrivatePathServiceGatewayReferenceResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" +) + +func (*EndpointGatewayTargetPrivatePathServiceGatewayReference) isaEndpointGatewayTarget() bool { return true } -// UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity unmarshals an instance of EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) +// UnmarshalEndpointGatewayTargetPrivatePathServiceGatewayReference unmarshals an instance of EndpointGatewayTargetPrivatePathServiceGatewayReference from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrivatePathServiceGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrivatePathServiceGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + 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) @@ -99704,6 +103800,16 @@ func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentit err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalPrivatePathServiceGatewayRemote) + 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 } @@ -101727,13 +105833,11 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototype(m map[ // This model "extends" InstanceGroupManagerAction type InstanceGroupManagerActionScheduledAction struct { // Indicates whether this scheduled action will be automatically deleted after it has completed and - // `auto_delete_timeout` hours have passed. At present, this is always - // `true`, but may be modifiable in the future. + // `auto_delete_timeout` hours have passed. AutoDelete *bool `json:"auto_delete" validate:"required"` // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically - // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the - // future. + // deleted. If the value is `0`, the action will be deleted once it has finished. AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` // The date and time that the instance group manager action was created. @@ -109243,6 +113347,91 @@ func UnmarshalLoadBalancerPoolMemberTargetInstanceReference(m map[string]json.Ra return } +// LoadBalancerProfileAvailabilityDependent : The availability mode for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileAvailability +type LoadBalancerProfileAvailabilityDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileAvailabilityDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileAvailabilityDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileAvailabilityDependent) isaLoadBalancerProfileAvailability() bool { + return true +} + +// UnmarshalLoadBalancerProfileAvailabilityDependent unmarshals an instance of LoadBalancerProfileAvailabilityDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileAvailabilityDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileAvailabilityDependent) + 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 +} + +// LoadBalancerProfileAvailabilityFixed : The availability mode for a load balancer with this profile. +// This model "extends" LoadBalancerProfileAvailability +type LoadBalancerProfileAvailabilityFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The availability of this load balancer: + // - `subnet`: remains available if at least one zone that the load balancer's subnets reside + // in is available + // - `region`: remains available if at least one zone in the region is available. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileAvailabilityFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileAvailabilityFixedTypeFixedConst = "fixed" +) + +// Constants associated with the LoadBalancerProfileAvailabilityFixed.Value property. +// The availability of this load balancer: +// - `subnet`: remains available if at least one zone that the load balancer's subnets reside +// in is available +// - `region`: remains available if at least one zone in the region is available. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + LoadBalancerProfileAvailabilityFixedValueRegionConst = "region" + LoadBalancerProfileAvailabilityFixedValueSubnetConst = "subnet" +) + +func (*LoadBalancerProfileAvailabilityFixed) isaLoadBalancerProfileAvailability() bool { + return true +} + +// UnmarshalLoadBalancerProfileAvailabilityFixed unmarshals an instance of LoadBalancerProfileAvailabilityFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileAvailabilityFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileAvailabilityFixed) + 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 +} + // LoadBalancerProfileIdentityByHref : LoadBalancerProfileIdentityByHref struct // This model "extends" LoadBalancerProfileIdentity type LoadBalancerProfileIdentityByHref struct { @@ -109511,6 +113700,72 @@ func UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed(m map[string]json. return } +// LoadBalancerProfileSourceIPSessionPersistenceSupportedDependent : The source IP session persistence support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileSourceIPSessionPersistenceSupported +type LoadBalancerProfileSourceIPSessionPersistenceSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileSourceIPSessionPersistenceSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSourceIPSessionPersistenceSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileSourceIPSessionPersistenceSupportedDependent) isaLoadBalancerProfileSourceIPSessionPersistenceSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileSourceIPSessionPersistenceSupportedDependent unmarshals an instance of LoadBalancerProfileSourceIPSessionPersistenceSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSourceIPSessionPersistenceSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSourceIPSessionPersistenceSupportedDependent) + 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 +} + +// LoadBalancerProfileSourceIPSessionPersistenceSupportedFixed : The source IP session persistence support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileSourceIPSessionPersistenceSupported +type LoadBalancerProfileSourceIPSessionPersistenceSupportedFixed 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 LoadBalancerProfileSourceIPSessionPersistenceSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSourceIPSessionPersistenceSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileSourceIPSessionPersistenceSupportedFixed) isaLoadBalancerProfileSourceIPSessionPersistenceSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileSourceIPSessionPersistenceSupportedFixed unmarshals an instance of LoadBalancerProfileSourceIPSessionPersistenceSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSourceIPSessionPersistenceSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSourceIPSessionPersistenceSupportedFixed) + 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 +} + // LoadBalancerProfileUDPSupportedDependent : The UDP support for a load balancer with this profile depends on its configuration. // This model "extends" LoadBalancerProfileUDPSupported type LoadBalancerProfileUDPSupportedDependent struct { @@ -113225,6 +117480,41 @@ func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMes return } +// RoutingTableIdentityByCRN : RoutingTableIdentityByCRN struct +// This model "extends" RoutingTableIdentity +type RoutingTableIdentityByCRN struct { + // The CRN for this VPC routing table. + CRN *string `json:"crn" validate:"required"` +} + +// NewRoutingTableIdentityByCRN : Instantiate RoutingTableIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewRoutingTableIdentityByCRN(crn string) (_model *RoutingTableIdentityByCRN, err error) { + _model = &RoutingTableIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*RoutingTableIdentityByCRN) isaRoutingTableIdentity() bool { + return true +} + +// UnmarshalRoutingTableIdentityByCRN unmarshals an instance of RoutingTableIdentityByCRN from the specified map of raw messages. +func UnmarshalRoutingTableIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentityByCRN) + 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 +} + // RoutingTableIdentityByHref : RoutingTableIdentityByHref struct // This model "extends" RoutingTableIdentity type RoutingTableIdentityByHref struct { @@ -115689,7 +119979,6 @@ type ShareProfileCapacityDependentRange struct { // Constants associated with the ShareProfileCapacityDependentRange.Type property. // The type for this profile field. const ( - ShareProfileCapacityDependentRangeTypeDependentConst = "dependent" ShareProfileCapacityDependentRangeTypeDependentRangeConst = "dependent_range" ) @@ -115886,7 +120175,6 @@ type ShareProfileIopsDependentRange struct { // Constants associated with the ShareProfileIopsDependentRange.Type property. // The type for this profile field. const ( - ShareProfileIopsDependentRangeTypeDependentConst = "dependent" ShareProfileIopsDependentRangeTypeDependentRangeConst = "dependent_range" ) @@ -117616,7 +121904,7 @@ type VpcdnsResolverTypeSystem struct { // // - `custom_resolver`: A custom DNS resolver is configured for this VPC. // - // - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when + // - `private_resolver`: A private DNS resolver is configured for this VPC. Applies when // the VPC has either or both of the following: // // - at least one endpoint gateway residing in it @@ -117640,7 +121928,7 @@ type VpcdnsResolverTypeSystem struct { // // - `custom_resolver`: A custom DNS resolver is configured for this VPC. // -// - `private_resolver`: A private DNS resolver is configured for this VPC. Applicable when +// - `private_resolver`: A private DNS resolver is configured for this VPC. Applies when // the VPC has either or both of the following: // // - at least one endpoint gateway residing in it @@ -119700,7 +123988,7 @@ type VPNGatewayPolicyMode struct { // The lifecycle state of the VPN gateway. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // Collection of VPN gateway members. + // The members for the VPN gateway. Members []VPNGatewayMember `json:"members" validate:"required"` // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. @@ -120015,7 +124303,7 @@ type VPNGatewayRouteMode struct { // The lifecycle state of the VPN gateway. LifecycleState *string `json:"lifecycle_state" validate:"required"` - // Collection of VPN gateway members. + // The members for the VPN gateway. Members []VPNGatewayMember `json:"members" validate:"required"` // The name for this VPN gateway. The name is unique across all VPN gateways in the VPC. @@ -120812,8 +125100,8 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentity(m map[string]json.Ra // - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot // This model "extends" VolumeAttachmentPrototypeVolume type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. + // The maximum I/O operations per second (IOPS) to use for this volume. If specified, the `family` of the volume + // profile must be `custom` or `defined_performance`. Iops *int64 `json:"iops,omitempty"` // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will @@ -120831,10 +125119,8 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` - // The capacity to use for the volume (in gigabytes). - // - // The minimum and maximum limits for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + // The capacity to use for the volume (in gigabytes). The specified value must be within the `capacity` range of the + // volume's profile. Capacity *int64 `json:"capacity,omitempty"` // The root key to use to wrap the data encryption key for the volume. @@ -120842,7 +125128,9 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext struct { // If unspecified, the `encryption` type for the volume will be `provider_managed`. EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - // The snapshot from which to clone the volume. + // The snapshot to use as a source for the volume's data. + // + // The specified snapshot may be in a different account, subject to IAM policies. SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` } @@ -121011,6 +125299,594 @@ func UnmarshalVolumeIdentityByID(m map[string]json.RawMessage, result interface{ return } +// VolumeProfileBootCapacityDependentRange : The permitted total capacity (in gigabytes) of a boot volume with this profile depends on its configuration. +// This model "extends" VolumeProfileBootCapacity +type VolumeProfileBootCapacityDependentRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VolumeProfileBootCapacityDependentRange.Type property. +// The type for this profile field. +const ( + VolumeProfileBootCapacityDependentRangeTypeDependentRangeConst = "dependent_range" +) + +func (*VolumeProfileBootCapacityDependentRange) isaVolumeProfileBootCapacity() bool { + return true +} + +// UnmarshalVolumeProfileBootCapacityDependentRange unmarshals an instance of VolumeProfileBootCapacityDependentRange from the specified map of raw messages. +func UnmarshalVolumeProfileBootCapacityDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileBootCapacityDependentRange) + 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 +} + +// VolumeProfileBootCapacityEnum : The permitted total capacities (in gigabytes) of a boot volume with this profile. +// This model "extends" VolumeProfileBootCapacity +type VolumeProfileBootCapacityEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 VolumeProfileBootCapacityEnum.Type property. +// The type for this profile field. +const ( + VolumeProfileBootCapacityEnumTypeEnumConst = "enum" +) + +func (*VolumeProfileBootCapacityEnum) isaVolumeProfileBootCapacity() bool { + return true +} + +// UnmarshalVolumeProfileBootCapacityEnum unmarshals an instance of VolumeProfileBootCapacityEnum from the specified map of raw messages. +func UnmarshalVolumeProfileBootCapacityEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileBootCapacityEnum) + 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 +} + +// VolumeProfileBootCapacityFixed : The permitted total capacity (in gigabytes) of a boot volume with this profile is fixed. +// This model "extends" VolumeProfileBootCapacity +type VolumeProfileBootCapacityFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the VolumeProfileBootCapacityFixed.Type property. +// The type for this profile field. +const ( + VolumeProfileBootCapacityFixedTypeFixedConst = "fixed" +) + +func (*VolumeProfileBootCapacityFixed) isaVolumeProfileBootCapacity() bool { + return true +} + +// UnmarshalVolumeProfileBootCapacityFixed unmarshals an instance of VolumeProfileBootCapacityFixed from the specified map of raw messages. +func UnmarshalVolumeProfileBootCapacityFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileBootCapacityFixed) + 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 +} + +// VolumeProfileBootCapacityRange : The permitted total capacity range (in gigabytes) of a boot volume with this profile. +// This model "extends" VolumeProfileBootCapacity +type VolumeProfileBootCapacityRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VolumeProfileBootCapacityRange.Type property. +// The type for this profile field. +const ( + VolumeProfileBootCapacityRangeTypeRangeConst = "range" +) + +func (*VolumeProfileBootCapacityRange) isaVolumeProfileBootCapacity() bool { + return true +} + +// UnmarshalVolumeProfileBootCapacityRange unmarshals an instance of VolumeProfileBootCapacityRange from the specified map of raw messages. +func UnmarshalVolumeProfileBootCapacityRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileBootCapacityRange) + 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, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileCapacityDependentRange : The permitted total capacity (in gigabytes) of a data volume with this profile depends on its configuration. +// This model "extends" VolumeProfileCapacity +type VolumeProfileCapacityDependentRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VolumeProfileCapacityDependentRange.Type property. +// The type for this profile field. +const ( + VolumeProfileCapacityDependentRangeTypeDependentRangeConst = "dependent_range" +) + +func (*VolumeProfileCapacityDependentRange) isaVolumeProfileCapacity() bool { + return true +} + +// UnmarshalVolumeProfileCapacityDependentRange unmarshals an instance of VolumeProfileCapacityDependentRange from the specified map of raw messages. +func UnmarshalVolumeProfileCapacityDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileCapacityDependentRange) + 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 +} + +// VolumeProfileCapacityEnum : The permitted total capacities (in gigabytes) of a data volume with this profile. +// This model "extends" VolumeProfileCapacity +type VolumeProfileCapacityEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 VolumeProfileCapacityEnum.Type property. +// The type for this profile field. +const ( + VolumeProfileCapacityEnumTypeEnumConst = "enum" +) + +func (*VolumeProfileCapacityEnum) isaVolumeProfileCapacity() bool { + return true +} + +// UnmarshalVolumeProfileCapacityEnum unmarshals an instance of VolumeProfileCapacityEnum from the specified map of raw messages. +func UnmarshalVolumeProfileCapacityEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileCapacityEnum) + 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 +} + +// VolumeProfileCapacityFixed : The permitted total capacity (in gigabytes) of a data volume with this profile is fixed. +// This model "extends" VolumeProfileCapacity +type VolumeProfileCapacityFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the VolumeProfileCapacityFixed.Type property. +// The type for this profile field. +const ( + VolumeProfileCapacityFixedTypeFixedConst = "fixed" +) + +func (*VolumeProfileCapacityFixed) isaVolumeProfileCapacity() bool { + return true +} + +// UnmarshalVolumeProfileCapacityFixed unmarshals an instance of VolumeProfileCapacityFixed from the specified map of raw messages. +func UnmarshalVolumeProfileCapacityFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileCapacityFixed) + 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 +} + +// VolumeProfileCapacityRange : The permitted total capacity range (in gigabytes) of a data volume with this profile. +// This model "extends" VolumeProfileCapacity +type VolumeProfileCapacityRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VolumeProfileCapacityRange.Type property. +// The type for this profile field. +const ( + VolumeProfileCapacityRangeTypeRangeConst = "range" +) + +func (*VolumeProfileCapacityRange) isaVolumeProfileCapacity() bool { + return true +} + +// UnmarshalVolumeProfileCapacityRange unmarshals an instance of VolumeProfileCapacityRange from the specified map of raw messages. +func UnmarshalVolumeProfileCapacityRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileCapacityRange) + 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, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileIopsDependentRange : The permitted IOPS range of a volume with this profile depends on its configuration. +// This model "extends" VolumeProfileIops +type VolumeProfileIopsDependentRange struct { + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VolumeProfileIopsDependentRange.Type property. +// The type for this profile field. +const ( + VolumeProfileIopsDependentRangeTypeDependentRangeConst = "dependent_range" +) + +func (*VolumeProfileIopsDependentRange) isaVolumeProfileIops() bool { + return true +} + +// UnmarshalVolumeProfileIopsDependentRange unmarshals an instance of VolumeProfileIopsDependentRange from the specified map of raw messages. +func UnmarshalVolumeProfileIopsDependentRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIopsDependentRange) + 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 +} + +// VolumeProfileIopsEnum : The permitted IOPS values of a volume with this profile. +// This model "extends" VolumeProfileIops +type VolumeProfileIopsEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // 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 VolumeProfileIopsEnum.Type property. +// The type for this profile field. +const ( + VolumeProfileIopsEnumTypeEnumConst = "enum" +) + +func (*VolumeProfileIopsEnum) isaVolumeProfileIops() bool { + return true +} + +// UnmarshalVolumeProfileIopsEnum unmarshals an instance of VolumeProfileIopsEnum from the specified map of raw messages. +func UnmarshalVolumeProfileIopsEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIopsEnum) + 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 +} + +// VolumeProfileIopsFixed : The permitted IOPS of a volume with this profile is fixed. +// This model "extends" VolumeProfileIops +type VolumeProfileIopsFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the VolumeProfileIopsFixed.Type property. +// The type for this profile field. +const ( + VolumeProfileIopsFixedTypeFixedConst = "fixed" +) + +func (*VolumeProfileIopsFixed) isaVolumeProfileIops() bool { + return true +} + +// UnmarshalVolumeProfileIopsFixed unmarshals an instance of VolumeProfileIopsFixed from the specified map of raw messages. +func UnmarshalVolumeProfileIopsFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIopsFixed) + 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 +} + +// VolumeProfileIopsRange : The permitted IOPS range of a volume with this profile. +// This model "extends" VolumeProfileIops +type VolumeProfileIopsRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VolumeProfileIopsRange.Type property. +// The type for this profile field. +const ( + VolumeProfileIopsRangeTypeRangeConst = "range" +) + +func (*VolumeProfileIopsRange) isaVolumeProfileIops() bool { + return true +} + +// UnmarshalVolumeProfileIopsRange unmarshals an instance of VolumeProfileIopsRange from the specified map of raw messages. +func UnmarshalVolumeProfileIopsRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIopsRange) + 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, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VolumeProfileIdentityByHref : VolumeProfileIdentityByHref struct // This model "extends" VolumeProfileIdentity type VolumeProfileIdentityByHref struct { @@ -121084,8 +125960,8 @@ func UnmarshalVolumeProfileIdentityByName(m map[string]json.RawMessage, result i // VolumePrototypeVolumeByCapacity : VolumePrototypeVolumeByCapacity struct // This model "extends" VolumePrototype type VolumePrototypeVolumeByCapacity struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. + // The maximum I/O operations per second (IOPS) to use for this volume. If specified, the `family` of the volume + // profile must be `custom` or `defined_performance`. Iops *int64 `json:"iops,omitempty"` // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will @@ -121103,10 +125979,8 @@ type VolumePrototypeVolumeByCapacity struct { // The zone this volume will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The capacity to use for the volume (in gigabytes). - // - // The minimum and maximum limits for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + // The capacity to use for the volume (in gigabytes). The specified value must be within the `capacity` range of the + // volume's profile. Capacity *int64 `json:"capacity" validate:"required"` // The root key to use to wrap the data encryption key for the volume. @@ -121183,8 +126057,8 @@ func UnmarshalVolumePrototypeVolumeByCapacity(m map[string]json.RawMessage, resu // VolumePrototypeVolumeBySourceSnapshot : VolumePrototypeVolumeBySourceSnapshot struct // This model "extends" VolumePrototype type VolumePrototypeVolumeBySourceSnapshot struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. + // The maximum I/O operations per second (IOPS) to use for this volume. If specified, the `family` of the volume + // profile must be `custom` or `defined_performance`. Iops *int64 `json:"iops,omitempty"` // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will @@ -121202,8 +126076,8 @@ type VolumePrototypeVolumeBySourceSnapshot struct { // The zone this volume will reside in. Zone ZoneIdentityIntf `json:"zone" validate:"required"` - // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's - // `minimum_capacity`. The maximum value may increase in the future. + // The capacity to use for the volume (in gigabytes). The specified value must be at least the snapshot's + // `minimum_capacity`, and must be within the `capacity` range of the volume's profile. // // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. Capacity *int64 `json:"capacity,omitempty"` @@ -121213,7 +126087,9 @@ type VolumePrototypeVolumeBySourceSnapshot struct { // If unspecified, the `encryption` type for the volume will be `provider_managed`. EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - // The snapshot from which to clone the volume. + // The snapshot to use as a source for the volume's data. + // + // The specified snapshot may be in a different account, subject to IAM policies. SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` } @@ -121591,117 +126467,6 @@ func UnmarshalEndpointGatewayReservedIPReservedIPIdentityByID(m map[string]json. return } -// EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN : EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN struct -// This model "extends" EndpointGatewayTargetPrototypeProviderCloudServiceIdentity -type EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` - - // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. - CRN *string `json:"crn" validate:"required"` -} - -// Constants associated with the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN.ResourceType property. -// The type of target for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRNResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRNResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -// NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN : Instantiate EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(resourceType string, crn string) (_model *EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN, err error) { - _model = &EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN{ - ResourceType: core.StringPtr(resourceType), - CRN: core.StringPtr(crn), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool { - return true -} - -func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) isaEndpointGatewayTargetPrototype() bool { - return true -} - -// UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN unmarshals an instance of EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) - 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()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName : The name of this provider infrastructure service. -// This model "extends" EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity -type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName struct { - // The type of target for this endpoint gateway. - ResourceType *string `json:"resource_type" validate:"required"` - - // The name of a provider infrastructure service. Must be: - // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. - Name *string `json:"name" validate:"required"` -} - -// Constants associated with the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName.ResourceType property. -// The type of target for this endpoint gateway. -const ( - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByNameResourceTypeProviderCloudServiceConst = "provider_cloud_service" - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByNameResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" -) - -// NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName : Instantiate EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName (Generic Model Constructor) -func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(resourceType string, name string) (_model *EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName, err error) { - _model = &EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName{ - ResourceType: core.StringPtr(resourceType), - Name: core.StringPtr(name), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - -func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool { - return true -} - -func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) isaEndpointGatewayTargetPrototype() bool { - return true -} - -// UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName unmarshals an instance of EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName from the specified map of raw messages. -func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) - 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, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref : FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct // This model "extends" FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentity type FloatingIPTargetPatchBareMetalServerNetworkInterfaceIdentityBareMetalServerNetworkInterfaceIdentityByHref struct { @@ -123046,13 +127811,11 @@ func UnmarshalInstanceGroupManagerActionPrototypeScheduledActionPrototypeByRunAt // This model "extends" InstanceGroupManagerActionScheduledAction type InstanceGroupManagerActionScheduledActionGroupTarget struct { // Indicates whether this scheduled action will be automatically deleted after it has completed and - // `auto_delete_timeout` hours have passed. At present, this is always - // `true`, but may be modifiable in the future. + // `auto_delete_timeout` hours have passed. AutoDelete *bool `json:"auto_delete" validate:"required"` // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically - // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the - // future. + // deleted. If the value is `0`, the action will be deleted once it has finished. AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` // The date and time that the instance group manager action was created. @@ -123215,13 +127978,11 @@ func UnmarshalInstanceGroupManagerActionScheduledActionGroupTarget(m map[string] // This model "extends" InstanceGroupManagerActionScheduledAction type InstanceGroupManagerActionScheduledActionManagerTarget struct { // Indicates whether this scheduled action will be automatically deleted after it has completed and - // `auto_delete_timeout` hours have passed. At present, this is always - // `true`, but may be modifiable in the future. + // `auto_delete_timeout` hours have passed. AutoDelete *bool `json:"auto_delete" validate:"required"` // If `auto_delete` is `true`, and this scheduled action has finished, the hours after which it will be automatically - // deleted. If the value is `0`, the action will be deleted once it has finished. This value may be modifiable in the - // future. + // deleted. If the value is `0`, the action will be deleted once it has finished. AutoDeleteTimeout *int64 `json:"auto_delete_timeout" validate:"required"` // The date and time that the instance group manager action was created. @@ -130879,8 +135640,8 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID(m // VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct // This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. + // The maximum I/O operations per second (IOPS) to use for this volume. If specified, the `family` of the volume + // profile must be `custom` or `defined_performance`. Iops *int64 `json:"iops,omitempty"` // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will @@ -130896,10 +135657,8 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototyp // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` - // The capacity to use for the volume (in gigabytes). - // - // The minimum and maximum limits for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + // The capacity to use for the volume (in gigabytes). The specified value must be within the `capacity` range of the + // volume's profile. Capacity *int64 `json:"capacity" validate:"required"` // The root key to use to wrap the data encryption key for the volume. @@ -130974,8 +135733,8 @@ func UnmarshalVolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolum // VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot : VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct // This model "extends" VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeBySourceSnapshot struct { - // The maximum I/O operations per second (IOPS) to use for this volume. Applicable only to volumes using a profile - // `family` of `custom`. + // The maximum I/O operations per second (IOPS) to use for this volume. If specified, the `family` of the volume + // profile must be `custom` or `defined_performance`. Iops *int64 `json:"iops,omitempty"` // The name for this volume. The name must not be used by another volume in the region. If unspecified, the name will @@ -130991,8 +135750,8 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototyp // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. UserTags []string `json:"user_tags,omitempty"` - // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's - // `minimum_capacity`. The maximum value may increase in the future. + // The capacity to use for the volume (in gigabytes). The specified value must be at least the snapshot's + // `minimum_capacity`, and must be within the `capacity` range of the volume's profile. // // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. Capacity *int64 `json:"capacity,omitempty"` @@ -131002,7 +135761,9 @@ type VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContextVolumePrototyp // If unspecified, the `encryption` type for the volume will be `provider_managed`. EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` - // The snapshot from which to clone the volume. + // The snapshot to use as a source for the volume's data. + // + // The specified snapshot may be in a different account, subject to IAM policies. SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` } @@ -136831,3 +141592,279 @@ func (pager *FlowLogCollectorsPager) GetAll() (allItems []FlowLogCollector, err err = core.RepurposeSDKProblem(err, "") return } + +// PrivatePathServiceGatewaysPager can be used to simplify the use of the "ListPrivatePathServiceGateways" method. +type PrivatePathServiceGatewaysPager struct { + hasNext bool + options *ListPrivatePathServiceGatewaysOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewPrivatePathServiceGatewaysPager returns a new PrivatePathServiceGatewaysPager instance. +func (vpc *VpcV1) NewPrivatePathServiceGatewaysPager(options *ListPrivatePathServiceGatewaysOptions) (pager *PrivatePathServiceGatewaysPager, 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 ListPrivatePathServiceGatewaysOptions = *options + pager = &PrivatePathServiceGatewaysPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *PrivatePathServiceGatewaysPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *PrivatePathServiceGatewaysPager) GetNextWithContext(ctx context.Context) (page []PrivatePathServiceGateway, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListPrivatePathServiceGatewaysWithContext(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.PrivatePathServiceGateways + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *PrivatePathServiceGatewaysPager) GetAllWithContext(ctx context.Context) (allItems []PrivatePathServiceGateway, err error) { + for pager.HasNext() { + var nextPage []PrivatePathServiceGateway + 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 *PrivatePathServiceGatewaysPager) GetNext() (page []PrivatePathServiceGateway, 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 *PrivatePathServiceGatewaysPager) GetAll() (allItems []PrivatePathServiceGateway, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// PrivatePathServiceGatewayAccountPoliciesPager can be used to simplify the use of the "ListPrivatePathServiceGatewayAccountPolicies" method. +type PrivatePathServiceGatewayAccountPoliciesPager struct { + hasNext bool + options *ListPrivatePathServiceGatewayAccountPoliciesOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewPrivatePathServiceGatewayAccountPoliciesPager returns a new PrivatePathServiceGatewayAccountPoliciesPager instance. +func (vpc *VpcV1) NewPrivatePathServiceGatewayAccountPoliciesPager(options *ListPrivatePathServiceGatewayAccountPoliciesOptions) (pager *PrivatePathServiceGatewayAccountPoliciesPager, 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 ListPrivatePathServiceGatewayAccountPoliciesOptions = *options + pager = &PrivatePathServiceGatewayAccountPoliciesPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *PrivatePathServiceGatewayAccountPoliciesPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *PrivatePathServiceGatewayAccountPoliciesPager) GetNextWithContext(ctx context.Context) (page []PrivatePathServiceGatewayAccountPolicy, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListPrivatePathServiceGatewayAccountPoliciesWithContext(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.AccountPolicies + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *PrivatePathServiceGatewayAccountPoliciesPager) GetAllWithContext(ctx context.Context) (allItems []PrivatePathServiceGatewayAccountPolicy, err error) { + for pager.HasNext() { + var nextPage []PrivatePathServiceGatewayAccountPolicy + 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 *PrivatePathServiceGatewayAccountPoliciesPager) GetNext() (page []PrivatePathServiceGatewayAccountPolicy, 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 *PrivatePathServiceGatewayAccountPoliciesPager) GetAll() (allItems []PrivatePathServiceGatewayAccountPolicy, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// PrivatePathServiceGatewayEndpointGatewayBindingsPager can be used to simplify the use of the "ListPrivatePathServiceGatewayEndpointGatewayBindings" method. +type PrivatePathServiceGatewayEndpointGatewayBindingsPager struct { + hasNext bool + options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewPrivatePathServiceGatewayEndpointGatewayBindingsPager returns a new PrivatePathServiceGatewayEndpointGatewayBindingsPager instance. +func (vpc *VpcV1) NewPrivatePathServiceGatewayEndpointGatewayBindingsPager(options *ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions) (pager *PrivatePathServiceGatewayEndpointGatewayBindingsPager, 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 ListPrivatePathServiceGatewayEndpointGatewayBindingsOptions = *options + pager = &PrivatePathServiceGatewayEndpointGatewayBindingsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *PrivatePathServiceGatewayEndpointGatewayBindingsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *PrivatePathServiceGatewayEndpointGatewayBindingsPager) GetNextWithContext(ctx context.Context) (page []PrivatePathServiceGatewayEndpointGatewayBinding, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListPrivatePathServiceGatewayEndpointGatewayBindingsWithContext(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.EndpointGatewayBindings + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *PrivatePathServiceGatewayEndpointGatewayBindingsPager) GetAllWithContext(ctx context.Context) (allItems []PrivatePathServiceGatewayEndpointGatewayBinding, err error) { + for pager.HasNext() { + var nextPage []PrivatePathServiceGatewayEndpointGatewayBinding + 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 *PrivatePathServiceGatewayEndpointGatewayBindingsPager) GetNext() (page []PrivatePathServiceGatewayEndpointGatewayBinding, 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 *PrivatePathServiceGatewayEndpointGatewayBindingsPager) GetAll() (allItems []PrivatePathServiceGatewayEndpointGatewayBinding, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} diff --git a/go.mod b/go.mod index 9d9bc2f8ce..2bbb406695 100644 --- a/go.mod +++ b/go.mod @@ -239,7 +239,7 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt // add sdk changes. replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.57.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.58.0 => ./common/github.com/IBM/vpc-go-sdk exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 From 33c314f0bfab9af4075b4b63ce7ba580c08e3a70 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 13 Nov 2024 12:39:24 +0530 Subject: [PATCH 096/103] Update vpc_v1.go --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 26954 ++++++++++------ 1 file changed, 17592 insertions(+), 9362 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index f4530c945d..5580c19ad3 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/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.0-d6dec9d7-20241008-212902 */ // 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-04 +// 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-04`. + // and `2024-11-13`. Version *string } @@ -68,7 +68,7 @@ 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-04`. + // and `2024-11-13`. Version *string } @@ -133,7 +133,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2024-10-01") + 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,1134 +32143,2374 @@ 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-01") -} - -// 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") -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *AddVPNGatewayConnectionsLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionsLocalCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} + 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)) + } -// SetID : Allow user to set ID -func (_options *AddVPNGatewayConnectionsLocalCIDROptions) SetID(id string) *AddVPNGatewayConnectionsLocalCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } -// SetCIDR : Allow user to set CIDR -func (_options *AddVPNGatewayConnectionsLocalCIDROptions) SetCIDR(cidr string) *AddVPNGatewayConnectionsLocalCIDROptions { - _options.CIDR = core.StringPtr(cidr) - return _options -} + 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 + } -// SetHeaders : Allow user to set Headers -func (options *AddVPNGatewayConnectionsLocalCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionsLocalCIDROptions { - options.Headers = param - return options + return } -// 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 +// 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 } -// 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), +// 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 } -} - -// 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 -} + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *createPrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, + } -// SetHeaders : Allow user to set Headers -func (options *AddVPNGatewayConnectionsPeerCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionsPeerCIDROptions { - options.Headers = param - 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/{private_path_service_gateway_id}/account_policies`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } -// AddressPrefix : AddressPrefix struct -type AddressPrefix struct { - // The CIDR block for this prefix. - CIDR *string `json:"cidr" validate:"required"` + for headerName, headerValue := range createPrivatePathServiceGatewayAccountPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // The date and time that the prefix was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + 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") - // Indicates whether subnets exist with addresses from this prefix. - HasSubnets *bool `json:"has_subnets" validate:"required"` + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) - // The URL for this address prefix. - Href *string `json:"href" validate:"required"` + 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 + } - // The unique identifier for this address prefix. - ID *string `json:"id" validate:"required"` + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } - // 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"` + 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 + } - // 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"` + return +} - // The zone this address prefix resides in. - Zone *ZoneReference `json:"zone" validate:"required"` +// 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 } -// 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) +// 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, "", "cidr-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.ValidateStruct(deletePrivatePathServiceGatewayAccountPolicyOptions, "deletePrivatePathServiceGatewayAccountPolicyOptions") if err != nil { - err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "struct-validation-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 + + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *deletePrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, + "id": *deletePrivatePathServiceGatewayAccountPolicyOptions.ID, } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + + 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, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + + 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, "", "id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + + response, err = vpc.Service.Request(request, nil) if err != nil { - err = core.SDKErrorf(err, "", "is_default-error", common.GetComponentInfo()) + core.EnrichHTTPProblem(err, "delete_private_path_service_gateway_account_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + + 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, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + err = core.ValidateStruct(getPrivatePathServiceGatewayAccountPolicyOptions, "getPrivatePathServiceGatewayAccountPolicyOptions") if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "struct-validation-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"` + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *getPrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayID, + "id": *getPrivatePathServiceGatewayAccountPolicyOptions.ID, + } - // A link to the first page of resources. - First *AddressPrefixCollectionFirst `json:"first" validate:"required"` + 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 + } - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` + for headerName, headerValue := range getPrivatePathServiceGatewayAccountPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *AddressPrefixCollectionNext `json:"next,omitempty"` + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGatewayAccountPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` -} + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) -// 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) + request, err := builder.Build() if err != nil { - err = core.SDKErrorf(err, "", "address_prefixes-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalAddressPrefixCollectionFirst) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + core.EnrichHTTPProblem(err, "get_private_path_service_gateway_account_policy", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + 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, "", "limit-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalAddressPrefixCollectionNext) + err = core.ValidateStruct(updatePrivatePathServiceGatewayAccountPolicyOptions, "updatePrivatePathServiceGatewayAccountPolicyOptions") if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + + 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, "", "total_count-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "url-resolve-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 + for headerName, headerValue := range updatePrivatePathServiceGatewayAccountPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) } - 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 + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePrivatePathServiceGatewayAccountPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - return start, nil -} + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") -// 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"` -} + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) -// 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) + _, err = builder.SetBodyContentJSON(updatePrivatePathServiceGatewayAccountPolicyOptions.PrivatePathServiceGatewayAccountPolicyPatch) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "set-json-body-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"` -} + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } -// 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) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + core.EnrichHTTPProblem(err, "update_private_path_service_gateway_account_policy", 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, UnmarshalPrivatePathServiceGatewayAccountPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + 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"` - - // The name for this address prefix. The name must not be used by another address prefix for the VPC. - Name *string `json:"name,omitempty"` +// 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 } -// 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) +// 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, "", "is_default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.ValidateStruct(listPrivatePathServiceGatewayEndpointGatewayBindingsOptions, "listPrivatePathServiceGatewayEndpointGatewayBindingsOptions") if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "struct-validation-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) + 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, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return } - 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"` + for headerName, headerValue := range listPrivatePathServiceGatewayEndpointGatewayBindingsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // The lifecycle state of the backup policy. - LifecycleState *string `json:"lifecycle_state" validate:"required"` + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPrivatePathServiceGatewayEndpointGatewayBindings") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") - // 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"` + 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)) + } - // 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"` + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } - // The name for this backup policy. The name is unique across all backup policies in the region. - Name *string `json:"name" validate:"required"` + 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 + } - // The plans for the backup policy. - Plans []BackupPolicyPlanReference `json:"plans" validate:"required"` + return +} - // The resource group for this backup policy. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` +// 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 +} - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` +// 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 + } - // The scope for this backup policy. - Scope BackupPolicyScopeIntf `json:"scope" validate:"required"` + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *getPrivatePathServiceGatewayEndpointGatewayBindingOptions.PrivatePathServiceGatewayID, + "id": *getPrivatePathServiceGatewayEndpointGatewayBindingOptions.ID, + } - // 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"` -} + 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 + } -// 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" -) + for headerName, headerValue := range getPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } -// 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" -) + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPrivatePathServiceGatewayEndpointGatewayBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") -// 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" -) + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) -// Constants associated with the BackupPolicy.ResourceType property. -// The resource type. -const ( - BackupPolicyResourceTypeBackupPolicyConst = "backup_policy" -) + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } -// Constants associated with the BackupPolicy.IncludedContent property. -// An item to include. -const ( - BackupPolicyIncludedContentBootVolumeConst = "boot_volume" - BackupPolicyIncludedContentDataVolumesConst = "data_volumes" -) + 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 + } -func (*BackupPolicy) isaBackupPolicy() bool { - return true + return } -type BackupPolicyIntf interface { - isaBackupPolicy() bool +// 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 } -// 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) +// 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, "", "created_at-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.ValidateStruct(denyPrivatePathServiceGatewayEndpointGatewayBindingOptions, "denyPrivatePathServiceGatewayEndpointGatewayBindingOptions") if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "struct-validation-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 + + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.PrivatePathServiceGatewayID, + "id": *denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.ID, } - err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + + 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, "", "health_state-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return + + for headerName, headerValue := range denyPrivatePathServiceGatewayEndpointGatewayBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) - return + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DenyPrivatePathServiceGatewayEndpointGatewayBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - 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 + 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 = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + _, err = builder.SetBodyContentJSON(body) if err != nil { - err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "match_resource_type", &obj.MatchResourceType) + + request, err := builder.Build() if err != nil { - err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + + response, err = vpc.Service.Request(request, nil) if err != nil { - err = core.SDKErrorf(err, "", "match_user_tags-error", common.GetComponentInfo()) + core.EnrichHTTPProblem(err, "deny_private_path_service_gateway_endpoint_gateway_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + + 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, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) + err = core.ValidateStruct(permitPrivatePathServiceGatewayEndpointGatewayBindingOptions, "permitPrivatePathServiceGatewayEndpointGatewayBindingOptions") if err != nil { - err = core.SDKErrorf(err, "", "plans-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + + 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, "", "resource_group-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + + 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, "", "resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "scope", &obj.Scope, UnmarshalBackupPolicyScope) + + request, err := builder.Build() if err != nil { - err = core.SDKErrorf(err, "", "scope-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "included_content", &obj.IncludedContent) + + response, err = vpc.Service.Request(request, nil) if err != nil { - err = core.SDKErrorf(err, "", "included_content-error", common.GetComponentInfo()) + core.EnrichHTTPProblem(err, "permit_private_path_service_gateway_endpoint_gateway_binding", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", 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 *BackupPolicyCollectionFirst `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"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` +// 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 } -// 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) +// 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, "", "backup_policies-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyCollectionFirst) + err = core.ValidateStruct(publishPrivatePathServiceGatewayOptions, "publishPrivatePathServiceGatewayOptions") if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) - return + + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *publishPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID, } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyCollectionNext) + + 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, "", "next-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "url-resolve-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 + + for headerName, headerValue := range publishPrivatePathServiceGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) } - 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 + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "PublishPrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - start, err := core.GetQueryParam(resp.Next.Href, "start") + + 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, "", "read-query-param-error", common.GetComponentInfo()) - return nil, err - } else if start == nil { - return nil, nil + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - 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) + response, err = vpc.Service.Request(request, nil) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + core.EnrichHTTPProblem(err, "publish_private_path_service_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// 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"` +// 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 } -// 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) +// 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, "", "href-error", common.GetComponentInfo()) + 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 } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} -// BackupPolicyHealthReason : BackupPolicyHealthReason struct -type BackupPolicyHealthReason struct { - // A reason code for this health state. - Code *string `json:"code" validate:"required"` + pathParamsMap := map[string]string{ + "private_path_service_gateway_id": *revokeAccountForPrivatePathServiceGatewayOptions.PrivatePathServiceGatewayID, + } - // An explanation of the reason for this health state. - Message *string `json:"message" validate:"required"` + 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 + } - // Link to documentation about the reason for this health state. - MoreInfo *string `json:"more_info,omitempty"` -} + for headerName, headerValue := range revokeAccountForPrivatePathServiceGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } -// Constants associated with the BackupPolicyHealthReason.Code property. -// A reason code for this health state. -const ( - BackupPolicyHealthReasonCodeMissingServiceAuthorizationPoliciesConst = "missing_service_authorization_policies" -) + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RevokeAccountForPrivatePathServiceGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Content-Type", "application/json") -// 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) + 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, "", "code-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) + + request, err := builder.Build() if err != nil { - err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + + response, err = vpc.Service.Request(request, nil) if err != nil { - err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) + core.EnrichHTTPProblem(err, "revoke_account_for_private_path_service_gateway", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", 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)). +// 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 { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + 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 +} + +// 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"` +} + +// 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 +} + +// 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. @@ -32521,7 +34656,7 @@ func UnmarshalBackupPolicyJob(m map[string]json.RawMessage, result interface{}) // BackupPolicyJobCollection : BackupPolicyJobCollection struct type BackupPolicyJobCollection struct { // A link to the first page of resources. - First *BackupPolicyJobCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` // A page of jobs for the backup policy. Jobs []BackupPolicyJob `json:"jobs" validate:"required"` @@ -32531,7 +34666,7 @@ type BackupPolicyJobCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *BackupPolicyJobCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -32540,7 +34675,7 @@ type BackupPolicyJobCollection struct { // 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) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -32555,7 +34690,7 @@ func UnmarshalBackupPolicyJobCollection(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyJobCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -32584,42 +34719,6 @@ func (resp *BackupPolicyJobCollection) GetNextStart() (*string, error) { return start, nil } -// 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"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) - return - } - 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) - if err != nil { - err = core.SDKErrorf(err, "", "href-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)). // Models which "extend" this model: @@ -32820,14 +34919,17 @@ func UnmarshalBackupPolicyPatch(m map[string]json.RawMessage, result interface{} // 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) + _patch = map[string]interface{}{} + if !core.IsNil(backupPolicyPatch.IncludedContent) { + _patch["included_content"] = backupPolicyPatch.IncludedContent } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(backupPolicyPatch.MatchUserTags) { + _patch["match_user_tags"] = backupPolicyPatch.MatchUserTags + } + if !core.IsNil(backupPolicyPatch.Name) { + _patch["name"] = backupPolicyPatch.Name } + return } @@ -33018,6 +35120,23 @@ func UnmarshalBackupPolicyPlanClonePolicyPatch(m map[string]json.RawMessage, res 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. @@ -33059,14 +35178,14 @@ func UnmarshalBackupPolicyPlanClonePolicyPrototype(m map[string]json.RawMessage, // BackupPolicyPlanCollection : BackupPolicyPlanCollection struct type BackupPolicyPlanCollection 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"` // A link to the next page of resources. This property is present for all pages // except the last page. - Next *BackupPolicyPlanCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // A page of plans for the backup policy. Plans []BackupPolicyPlan `json:"plans" validate:"required"` @@ -33078,7 +35197,7 @@ type BackupPolicyPlanCollection struct { // 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) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -33088,7 +35207,7 @@ 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, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -33107,42 +35226,6 @@ 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 - } - 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) - if err != nil { - err = core.SDKErrorf(err, "", "href-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. @@ -33195,10 +35278,23 @@ func UnmarshalBackupPolicyPlanDeletionTriggerPatch(m map[string]json.RawMessage, return } -// BackupPolicyPlanDeletionTriggerPrototype : BackupPolicyPlanDeletionTriggerPrototype struct -type BackupPolicyPlanDeletionTriggerPrototype struct { - // The maximum number of days to keep each backup after creation. - DeleteAfter *int64 `json:"delete_after,omitempty"` +// 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"` @@ -33300,14 +35396,36 @@ func UnmarshalBackupPolicyPlanPatch(m map[string]json.RawMessage, result interfa // 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) + _patch = map[string]interface{}{} + if !core.IsNil(backupPolicyPlanPatch.Active) { + _patch["active"] = backupPolicyPlanPatch.Active } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + 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 } @@ -33569,6 +35687,22 @@ func UnmarshalBackupPolicyPlanRemoteRegionPolicyPrototype(m map[string]json.RawM return } +// 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() + } + + return +} + // BackupPolicyPrototype : BackupPolicyPrototype struct // Models which "extend" this model: // - BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype @@ -34157,14 +36291,14 @@ type BareMetalServerCollection struct { BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` // 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"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -34178,7 +36312,7 @@ func UnmarshalBareMetalServerCollection(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "bare_metal_servers-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerCollectionFirst) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -34188,7 +36322,7 @@ 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 @@ -34217,42 +36351,6 @@ 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"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "href-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"` -} - -// 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) - 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. @@ -34330,10 +36428,10 @@ type BareMetalServerDisk struct { // The unique identifier for this bare metal server disk. ID *string `json:"id" validate:"required"` - // The disk interface used for attaching the disk: - // - `fcp`: Attached using Fiber Channel Protocol - // - `sata`: Attached using Serial Advanced Technology Attachment - // - `nvme`: Attached using Non-Volatile Memory Express + // 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. @@ -34350,10 +36448,10 @@ type BareMetalServerDisk struct { } // Constants associated with the BareMetalServerDisk.InterfaceType property. -// The disk interface used for attaching the disk: -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using Non-Volatile Memory Express +// 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. @@ -34449,25 +36547,28 @@ func UnmarshalBareMetalServerDiskPatch(m map[string]json.RawMessage, result inte // 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) - } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + _patch = map[string]interface{}{} + if !core.IsNil(bareMetalServerDiskPatch.Name) { + _patch["name"] = bareMetalServerDiskPatch.Name } + 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"` } // 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" @@ -34737,6 +36838,9 @@ type BareMetalServerNetworkAttachment struct { Subnet *SubnetReference `json:"subnet" validate:"required"` // 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. Type *string `json:"type" validate:"required"` // The virtual network interface for this bare metal server network attachment. @@ -34800,6 +36904,9 @@ const ( // 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" @@ -34898,7 +37005,7 @@ func UnmarshalBareMetalServerNetworkAttachment(m map[string]json.RawMessage, res // BareMetalServerNetworkAttachmentCollection : BareMetalServerNetworkAttachmentCollection struct type BareMetalServerNetworkAttachmentCollection struct { // A link to the first page of resources. - First *BareMetalServerNetworkAttachmentCollectionFirst `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"` @@ -34908,7 +37015,7 @@ type BareMetalServerNetworkAttachmentCollection struct { // A link to the next page of resources. This property is present for all pages // except the last page. - Next *BareMetalServerNetworkAttachmentCollectionNext `json:"next,omitempty"` + Next *PageLink `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` @@ -34917,7 +37024,7 @@ type BareMetalServerNetworkAttachmentCollection struct { // 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) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -34932,7 +37039,7 @@ func UnmarshalBareMetalServerNetworkAttachmentCollection(m map[string]json.RawMe err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkAttachmentCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return @@ -34961,42 +37068,6 @@ func (resp *BareMetalServerNetworkAttachmentCollection) GetNextStart() (*string, return start, nil } -// 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"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "href-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"` -} - -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "href-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 @@ -35027,14 +37098,14 @@ func UnmarshalBareMetalServerNetworkAttachmentPatch(m map[string]json.RawMessage // 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) + _patch = map[string]interface{}{} + if !core.IsNil(bareMetalServerNetworkAttachmentPatch.AllowedVlans) { + _patch["allowed_vlans"] = bareMetalServerNetworkAttachmentPatch.AllowedVlans } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + if !core.IsNil(bareMetalServerNetworkAttachmentPatch.Name) { + _patch["name"] = bareMetalServerNetworkAttachmentPatch.Name } + return } @@ -35506,7 +37577,7 @@ type BareMetalServerNetworkInterface struct { 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 an empty string. + // 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 @@ -35701,7 +37772,7 @@ func UnmarshalBareMetalServerNetworkInterface(m map[string]json.RawMessage, resu // BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct type BareMetalServerNetworkInterfaceCollection struct { // 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"` @@ -35711,7 +37782,7 @@ type BareMetalServerNetworkInterfaceCollection struct { // 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"` @@ -35720,7 +37791,7 @@ type BareMetalServerNetworkInterfaceCollection struct { // 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) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return @@ -35735,7 +37806,7 @@ func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMes err = core.SDKErrorf(err, "", "network_interfaces-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 @@ -35764,42 +37835,6 @@ 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 -} - // BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct type BareMetalServerNetworkInterfacePatch struct { // Indicates whether source IP spoofing is allowed on this bare metal server network interface. @@ -35864,14 +37899,20 @@ func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, // 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) + _patch = map[string]interface{}{} + if !core.IsNil(bareMetalServerNetworkInterfacePatch.AllowIPSpoofing) { + _patch["allow_ip_spoofing"] = bareMetalServerNetworkInterfacePatch.AllowIPSpoofing } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + 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 } @@ -36087,14 +38128,20 @@ func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interfac // 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) + _patch = map[string]interface{}{} + if !core.IsNil(bareMetalServerPatch.Bandwidth) { + _patch["bandwidth"] = bareMetalServerPatch.Bandwidth } - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-patch-data-error", common.GetComponentInfo()) + 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 } @@ -36278,17 +38325,1911 @@ func UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype(m map[string]json. } err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) if err != nil { - err = core.SDKErrorf(err, "", "allowed_vlans-error", common.GetComponentInfo()) + 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 +} + +// 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"` + + // The URL for this bare metal server profile. + Href *string `json:"href" validate:"required"` + + Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` + + // The name for this bare metal server profile. + 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 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"` +} + +// Constants associated with the BareMetalServerProfile.ResourceType property. +// The resource type. +const ( + BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +// 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) + if err != nil { + err = core.SDKErrorf(err, "", "family-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.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) + if err != nil { + err = core.SDKErrorf(err, "", "memory-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, "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) + if err != nil { + err = core.SDKErrorf(err, "", "os_architecture-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, "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) + if err != nil { + err = core.SDKErrorf(err, "", "virtual_network_interfaces_supported-error", common.GetComponentInfo()) + return + } + 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, "", "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, "", "values-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"` + + // 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, "", "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, "value", &obj.Value) + if err != nil { + err = core.SDKErrorf(err, "", "value-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 +} + +// 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) + if err != nil { + err = core.SDKErrorf(err, "", "values-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"` + + // 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 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, "", "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, "", "values-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct +type BareMetalServerProfileCollection 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 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"` +} + +// 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 + } + 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, "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()) + 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 *BareMetalServerProfileCollection) 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 +} + +// 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"` +} + +// 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, "", "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 +} + +// 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"` +} + +// 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, "", "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 +} + +// 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"` + + // 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 BareMetalServerProfileDiskQuantity.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" +) + +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) + 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, "", "values-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"` + + // 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 BareMetalServerProfileDiskSize.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" +) + +func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { + return true +} + +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, "", "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, "", "values-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"` + + // The supported disk interfaces used for attaching the disk. + Values []string `json:"values" validate:"required"` +} + +// 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, "", "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 +} + +// 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"` +} + +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 +} + +// 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, "", "values-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"` + + // The type for this profile field. + Type *string `json:"type,omitempty"` +} + +// Constants associated with the BareMetalServerProfileNetworkAttachmentCount.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileNetworkAttachmentCountTypeRangeConst = "range" +) + +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, "", "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 +} + +// 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 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 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, "", "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 +} + +// 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) + 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 +} + +// BareMetalServerProfileReference : BareMetalServerProfileReference struct +type BareMetalServerProfileReference struct { + // The URL for this bare metal server profile. + Href *string `json:"href" 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"` +} + +// Constants associated with the BareMetalServerProfileReference.ResourceType property. +// The resource type. +const ( + BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +// 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, "", "href-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 +} + +// 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"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported trusted platform module modes. + Values []string `json:"values" 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" +) + +// 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 ( + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" + BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" +) + +// 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) + 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 +} + +// 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) + 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 +} + +// 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) + if err != nil { + err = core.SDKErrorf(err, "", "bandwidth-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "initialization-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, "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) + if err != nil { + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "network_interfaces-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) + if err != nil { + err = core.SDKErrorf(err, "", "primary_network_interface-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 + // + // 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 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, "", "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 +} + +// 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.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) + if err != nil { + err = core.SDKErrorf(err, "", "supported_modes-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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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 +} + +// 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 + } + 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"` +} + +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, "", "crn-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// 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"` +} + +func (*CatalogOfferingVersionPlanIdentity) isaCatalogOfferingVersionPlanIdentity() bool { + return true +} + +type CatalogOfferingVersionPlanIdentityIntf interface { + isaCatalogOfferingVersionPlanIdentity() bool +} + +// 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, "", "crn-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) + 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 + } + 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, "", "crn-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 + 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, "", "crn-error", common.GetComponentInfo()) + return + } + 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, "", "crn-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 +} + +// 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 of this Cloud Object Storage bucket. + CRN *string `json:"crn,omitempty"` +} + +func (*CloudObjectStorageBucketIdentity) isaCloudObjectStorageBucketIdentity() bool { + return true +} + +type CloudObjectStorageBucketIdentityIntf interface { + isaCloudObjectStorageBucketIdentity() 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) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + 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, "", "interface_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) @@ -36296,120 +40237,119 @@ 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) + 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, "", "subnet-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-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"` +// ClusterNetwork : ClusterNetwork struct +type ClusterNetwork struct { + // The date and time that the cluster network was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - CpuSocketCount BareMetalServerProfileCpuSocketCountIntf `json:"cpu_socket_count" validate:"required"` + // The CRN for this cluster network. + CRN *string `json:"crn" validate:"required"` - // The disks for a bare metal server with this profile. - Disks []BareMetalServerProfileDisk `json:"disks" validate:"required"` + // The URL for this cluster network. + Href *string `json:"href" validate:"required"` - // The product family this bare metal server profile belongs to. - Family *string `json:"family" validate:"required"` + // The unique identifier for this cluster network. + ID *string `json:"id" validate:"required"` - // The URL for this bare metal server profile. - Href *string `json:"href" validate:"required"` + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []ClusterNetworkLifecycleReason `json:"lifecycle_reasons" validate:"required"` - Memory BareMetalServerProfileMemoryIntf `json:"memory" validate:"required"` + // The lifecycle state of the cluster network. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The name for this bare metal server profile. + // 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"` - NetworkAttachmentCount BareMetalServerProfileNetworkAttachmentCountIntf `json:"network_attachment_count" validate:"required"` - - NetworkInterfaceCount BareMetalServerProfileNetworkInterfaceCountIntf `json:"network_interface_count" validate:"required"` + // The profile for this cluster network. + Profile *ClusterNetworkProfileReference `json:"profile" validate:"required"` - OsArchitecture *BareMetalServerProfileOsArchitecture `json:"os_architecture" 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 supported trusted platform module modes for this bare metal server profile. - SupportedTrustedPlatformModuleModes *BareMetalServerProfileSupportedTrustedPlatformModuleModes `json:"supported_trusted_platform_module_modes" validate:"required"` + // The IP address ranges available for subnets for this cluster network. + SubnetPrefixes []ClusterNetworkSubnetPrefix `json:"subnet_prefixes" validate:"required"` - // Indicates whether this profile supports virtual network interfaces. - VirtualNetworkInterfacesSupported *BareMetalServerProfileVirtualNetworkInterfacesSupported `json:"virtual_network_interfaces_supported" 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 BareMetalServerProfile.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 ( - BareMetalServerProfileResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" + ClusterNetworkResourceTypeClusterNetworkConst = "cluster_network" ) -// 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) +// 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, "", "cpu_core_count-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "cpu_socket_count", &obj.CpuSocketCount, UnmarshalBareMetalServerProfileCpuSocketCount) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - err = core.SDKErrorf(err, "", "cpu_socket_count-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerProfileDisk) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "disks-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "family", &obj.Family) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "family-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkLifecycleReason) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "lifecycle_reasons-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalBareMetalServerProfileMemory) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { - err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) @@ -36417,375 +40357,315 @@ 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) + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalClusterNetworkProfileReference) if err != nil { - err = core.SDKErrorf(err, "", "network_attachment_count-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "network_interface_count", &obj.NetworkInterfaceCount, UnmarshalBareMetalServerProfileNetworkInterfaceCount) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { - err = core.SDKErrorf(err, "", "network_interface_count-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalBareMetalServerProfileOsArchitecture) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "os_architecture-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalModel(m, "subnet_prefixes", &obj.SubnetPrefixes, UnmarshalClusterNetworkSubnetPrefix) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "subnet_prefixes-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "supported_trusted_platform_module_modes", &obj.SupportedTrustedPlatformModuleModes, UnmarshalBareMetalServerProfileSupportedTrustedPlatformModuleModes) + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { - err = core.SDKErrorf(err, "", "supported_trusted_platform_module_modes-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "virtual_network_interfaces_supported", &obj.VirtualNetworkInterfacesSupported, UnmarshalBareMetalServerProfileVirtualNetworkInterfacesSupported) + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) if err != nil { - err = core.SDKErrorf(err, "", "virtual_network_interfaces_supported-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) return } 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"` +// ClusterNetworkCollection : ClusterNetworkCollection struct +type ClusterNetworkCollection struct { + // A page of cluster networks. + ClusterNetworks []ClusterNetwork `json:"cluster_networks" validate:"required"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` -} + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` -// Constants associated with the BareMetalServerProfileBandwidth.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileBandwidthTypeFixedConst = "fixed" -) + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` -func (*BareMetalServerProfileBandwidth) isaBareMetalServerProfileBandwidth() bool { - return true -} + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` -type BareMetalServerProfileBandwidthIntf interface { - isaBareMetalServerProfileBandwidth() bool + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// 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) +// 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, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "cluster_networks-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { - err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "total_count-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 +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ClusterNetworkCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + start, err := core.GetQueryParam(resp.Next.Href, "start") if err != nil { - err = core.SDKErrorf(err, "", "values-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 } -// BareMetalServerProfileCpuArchitecture : BareMetalServerProfileCpuArchitecture struct -type BareMetalServerProfileCpuArchitecture struct { - // The default CPU architecture for a bare metal server with this profile. - Default *string `json:"default,omitempty"` +// 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"` - // The type for this profile field. - Type *string `json:"type" validate:"required"` + // Indicates whether this cluster network interface will be automatically deleted when `target` is deleted. + AutoDelete *bool `json:"auto_delete" validate:"required"` - // The CPU architecture for a bare metal server with this profile. - Value *string `json:"value" validate:"required"` -} + // The date and time that the cluster network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` -// Constants associated with the BareMetalServerProfileCpuArchitecture.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileCpuArchitectureTypeFixedConst = "fixed" -) + // 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. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` -// 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, "", "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, "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 URL for this cluster network interface. + Href *string `json:"href" validate:"required"` -// 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 unique identifier for this cluster network interface. + ID *string `json:"id" validate:"required"` - // The value for this profile field. - Value *int64 `json:"value,omitempty"` + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []ClusterNetworkInterfaceLifecycleReason `json:"lifecycle_reasons" validate:"required"` - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` + // The lifecycle state of the cluster network interface. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The maximum value for this profile field. - Max *int64 `json:"max,omitempty"` + // The MAC address of the cluster network interface. May be absent if + // `lifecycle_state` is `pending`. + MacAddress *string `json:"mac_address,omitempty"` - // The minimum value for this profile field. - Min *int64 `json:"min,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 increment step value for this profile field. - Step *int64 `json:"step,omitempty"` + // The cluster network subnet reserved IP for this cluster network interface. + PrimaryIP *ClusterNetworkSubnetReservedIPReference `json:"primary_ip" validate:"required"` - // The permitted values for this profile field. - Values []int64 `json:"values,omitempty"` + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + Subnet *ClusterNetworkSubnetReference `json:"subnet,omitempty"` + + // 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. + Target ClusterNetworkInterfaceTargetIntf `json:"target,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"` } -// Constants associated with the BareMetalServerProfileCpuCoreCount.Type property. -// The type for this profile field. +// Constants associated with the ClusterNetworkInterface.LifecycleState property. +// The lifecycle state of the cluster network interface. const ( - BareMetalServerProfileCpuCoreCountTypeFixedConst = "fixed" + ClusterNetworkInterfaceLifecycleStateDeletingConst = "deleting" + ClusterNetworkInterfaceLifecycleStateFailedConst = "failed" + ClusterNetworkInterfaceLifecycleStatePendingConst = "pending" + ClusterNetworkInterfaceLifecycleStateStableConst = "stable" + ClusterNetworkInterfaceLifecycleStateSuspendedConst = "suspended" + ClusterNetworkInterfaceLifecycleStateUpdatingConst = "updating" + ClusterNetworkInterfaceLifecycleStateWaitingConst = "waiting" ) -func (*BareMetalServerProfileCpuCoreCount) isaBareMetalServerProfileCpuCoreCount() bool { - return true -} - -type BareMetalServerProfileCpuCoreCountIntf interface { - isaBareMetalServerProfileCpuCoreCount() bool -} +// Constants associated with the ClusterNetworkInterface.ResourceType property. +// The resource type. +const ( + ClusterNetworkInterfaceResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface" +) -// 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) +// 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, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "allow_ip_spoofing-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "max", &obj.Max) + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) if err != nil { - err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "enable_infrastructure_nat-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkInterfaceLifecycleReason) if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "lifecycle_reasons-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"` - - // 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 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) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "lifecycle_state-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "mac_address", &obj.MacAddress) if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "mac_address-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + 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, "max", &obj.Max) + err = core.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalClusterNetworkSubnetReservedIPReference) if err != nil { - err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "primary_ip-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, "subnet", &obj.Subnet, UnmarshalClusterNetworkSubnetReference) if err != nil { - err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalClusterNetworkInterfaceTarget) if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "target-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 } -// BareMetalServerProfileCollection : BareMetalServerProfileCollection struct -type BareMetalServerProfileCollection struct { +// ClusterNetworkInterfaceCollection : ClusterNetworkInterfaceCollection struct +type ClusterNetworkInterfaceCollection struct { // A link to the first page of resources. - First *BareMetalServerProfileCollectionFirst `json:"first" validate:"required"` + First *PageLink `json:"first" validate:"required"` + + // A page of cluster network interfaces. + Interfaces []ClusterNetworkInterface `json:"interfaces" 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"` - - // A page of bare metal server profiles. - Profiles []BareMetalServerProfile `json:"profiles" validate:"required"` + Next *PageLink `json:"next,omitempty"` // 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) +// 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, "", "first-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.UnmarshalModel(m, "interfaces", &obj.Interfaces, UnmarshalClusterNetworkInterface) if err != nil { - err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "interfaces-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerProfileCollectionNext) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalBareMetalServerProfile) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) @@ -36798,7 +40678,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 *ClusterNetworkInterfaceCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -36812,641 +40692,584 @@ 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"` +// 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) + // + // 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"` } -// 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) +// 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 ( + ClusterNetworkInterfaceLifecycleReasonCodeInternalErrorConst = "internal_error" + ClusterNetworkInterfaceLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// 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, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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"` -} - -// 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) + err = core.UnmarshalPrimitive(m, "message", &obj.Message) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + 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 } -// 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"` +// 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 console types for a bare metal server with this profile. - Values []string `json:"values" validate:"required"` + // 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"` } -// 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) +// 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, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "auto_delete-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + 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 } -// BareMetalServerProfileDisk : Disks provided by this profile. -type BareMetalServerProfileDisk struct { - Quantity BareMetalServerProfileDiskQuantityIntf `json:"quantity" validate:"required"` +// 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 + } - Size BareMetalServerProfileDiskSizeIntf `json:"size" validate:"required"` + return +} - SupportedInterfaceTypes *BareMetalServerProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` +// 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 URL for this cluster network subnet reserved IP. + Href *string `json:"href,omitempty"` + + // 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"` } -// 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) +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, "", "quantity-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalBareMetalServerProfileDiskSize) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalBareMetalServerProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { - err = core.SDKErrorf(err, "", "supported_interface_types-error", common.GetComponentInfo()) + 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 } -// 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"` +// 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 value for this profile field. - Value *int64 `json:"value,omitempty"` + // The URL for this cluster network interface. + Href *string `json:"href" validate:"required"` - // The default value for this profile field. - Default *int64 `json:"default,omitempty"` + // The unique identifier for this cluster network interface. + ID *string `json:"id" validate:"required"` - // The maximum value for this profile field. - Max *int64 `json:"max,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 minimum value for this profile field. - Min *int64 `json:"min,omitempty"` + // The primary IP for this cluster network interface. + PrimaryIP *ClusterNetworkSubnetReservedIPReference `json:"primary_ip" 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"` + Subnet *ClusterNetworkSubnetReference `json:"subnet" validate:"required"` } -// Constants associated with the BareMetalServerProfileDiskQuantity.Type property. -// The type for this profile field. +// Constants associated with the ClusterNetworkInterfaceReference.ResourceType property. +// The resource type. const ( - BareMetalServerProfileDiskQuantityTypeFixedConst = "fixed" + ClusterNetworkInterfaceReferenceResourceTypeClusterNetworkInterfaceConst = "cluster_network_interface" ) -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) +// 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, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "deleted-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 } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-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.UnmarshalModel(m, "primary_ip", &obj.PrimaryIP, UnmarshalClusterNetworkSubnetReservedIPReference) if err != nil { - err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "primary_ip-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "step", &obj.Step) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "step-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "values", &obj.Values) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalClusterNetworkSubnetReference) if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "subnet-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerProfileDiskSize : BareMetalServerProfileDiskSize 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: -// - BareMetalServerProfileDiskSizeFixed -// - BareMetalServerProfileDiskSizeRange -// - BareMetalServerProfileDiskSizeEnum -// - BareMetalServerProfileDiskSizeDependent -type BareMetalServerProfileDiskSize 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 BareMetalServerProfileDiskSize.Type property. -// The type for this profile field. +// Constants associated with the ClusterNetworkInterfaceTarget.ResourceType property. +// The resource type. const ( - BareMetalServerProfileDiskSizeTypeFixedConst = "fixed" + ClusterNetworkInterfaceTargetResourceTypeInstanceClusterNetworkAttachmentConst = "instance_cluster_network_attachment" ) -func (*BareMetalServerProfileDiskSize) isaBareMetalServerProfileDiskSize() bool { +func (*ClusterNetworkInterfaceTarget) isaClusterNetworkInterfaceTarget() bool { return true } -type BareMetalServerProfileDiskSizeIntf interface { - isaBareMetalServerProfileDiskSize() bool +type ClusterNetworkInterfaceTargetIntf interface { + isaClusterNetworkInterfaceTarget() 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, "", "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 } -// BareMetalServerProfileDiskSupportedInterfaces : BareMetalServerProfileDiskSupportedInterfaces struct -type BareMetalServerProfileDiskSupportedInterfaces struct { - // The disk interface used for attaching the disk: - // - `fcp`: Attached using Fiber Channel Protocol - // - `sata`: Attached using Serial Advanced Technology Attachment - // - `nvme`: Attached using Non-Volatile Memory Express +// 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. - Default *string `json:"default" validate:"required"` + 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 supported disk interfaces used for attaching the disk. - Values []string `json:"values" validate:"required"` + // Link to documentation about the reason for this lifecycle state. + MoreInfo *string `json:"more_info,omitempty"` } -// Constants associated with the BareMetalServerProfileDiskSupportedInterfaces.Default property. -// The disk interface used for attaching the disk: -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using 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 ( - 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 interface used for attaching the disk: -// - `fcp`: Attached using Fiber Channel Protocol -// - `sata`: Attached using Serial Advanced Technology Attachment -// - `nvme`: Attached using Non-Volatile Memory Express +// 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 ( - BareMetalServerProfileDiskSupportedInterfacesValuesFcpConst = "fcp" - BareMetalServerProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" - BareMetalServerProfileDiskSupportedInterfacesValuesSataConst = "sata" + ClusterNetworkLifecycleReasonCodeInternalErrorConst = "internal_error" + ClusterNetworkLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" ) -// 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) +// 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, "values", &obj.Values) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { - err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "more_info-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// 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. +// 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"` - - // The URL for this bare metal server profile. - Href *string `json:"href,omitempty"` -} - -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) +// 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, "", "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 } -// 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"` +// 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 BareMetalServerProfileMemory.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 ( - BareMetalServerProfileMemoryTypeFixedConst = "fixed" + ClusterNetworkProfileFamilyVelaConst = "vela" ) -func (*BareMetalServerProfileMemory) isaBareMetalServerProfileMemory() bool { - return true -} - -type BareMetalServerProfileMemoryIntf interface { - isaBareMetalServerProfileMemory() bool -} +// Constants associated with the ClusterNetworkProfile.ResourceType property. +// The resource type. +const ( + ClusterNetworkProfileResourceTypeClusterNetworkProfileConst = "cluster_network_profile" +) -// 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) +// 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 } -// 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"` +// ClusterNetworkProfileCollection : ClusterNetworkProfileCollection struct +type ClusterNetworkProfileCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` - // The type for this profile field. - Type *string `json:"type,omitempty"` -} + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` -// Constants associated with the BareMetalServerProfileNetworkAttachmentCount.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileNetworkAttachmentCountTypeRangeConst = "range" -) + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PageLink `json:"next,omitempty"` -func (*BareMetalServerProfileNetworkAttachmentCount) isaBareMetalServerProfileNetworkAttachmentCount() bool { - return true -} + // A page of cluster network profiles. + Profiles []ClusterNetworkProfile `json:"profiles" validate:"required"` -type BareMetalServerProfileNetworkAttachmentCountIntf interface { - isaBareMetalServerProfileNetworkAttachmentCount() bool + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// 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, "", "max-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) +// 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, "", "min-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 } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// 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 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 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) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "min", &obj.Min) + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalClusterNetworkProfile) if err != nil { - err = core.SDKErrorf(err, "", "min-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "profiles-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "total_count-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"` +// Retrieve the value to be passed to a request to access the next page of results +func (resp *ClusterNetworkProfileCollection) 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 +} + +// 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"` - // The type for this profile field. - Type *string `json:"type" validate:"required"` + // The URL for this cluster network profile. + Href *string `json:"href,omitempty"` +} - // The supported OS architecture(s) for a bare metal server with this profile. - Values []string `json:"values" validate:"required"` +func (*ClusterNetworkProfileIdentity) isaClusterNetworkProfileIdentity() bool { + return true } -// Constants associated with the BareMetalServerProfileOsArchitecture.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileOsArchitectureTypeEnumConst = "enum" -) +type ClusterNetworkProfileIdentityIntf interface { + isaClusterNetworkProfileIdentity() bool +} -// 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, "", "default-error", common.GetComponentInfo()) - return - } - 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 } -// BareMetalServerProfileReference : BareMetalServerProfileReference struct -type BareMetalServerProfileReference struct { - // The URL for this bare metal server profile. +// ClusterNetworkProfileReference : ClusterNetworkProfileReference struct +type ClusterNetworkProfileReference struct { + // The URL for this cluster network profile. Href *string `json:"href" validate:"required"` - // The name for this bare metal server profile. + // The globally unique name for this cluster network profile. 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 ClusterNetworkProfileReference.ResourceType property. // The resource type. const ( - BareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" + ClusterNetworkProfileReferenceResourceTypeClusterNetworkProfileConst = "cluster_network_profile" ) -// 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) +// 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, "", "href-error", common.GetComponentInfo()) @@ -37466,175 +41289,183 @@ 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"` +// ClusterNetworkReference : ClusterNetworkReference struct +type ClusterNetworkReference struct { + // The CRN for this cluster network. + CRN *string `json:"crn" validate:"required"` - // The type for this profile field. - Type *string `json:"type" validate:"required"` + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` - // The supported trusted platform module modes. - Values []string `json:"values" validate:"required"` -} + // The URL for this cluster network. + Href *string `json:"href" 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 unique identifier for this cluster network. + ID *string `json:"id" validate:"required"` -// Constants associated with the BareMetalServerProfileSupportedTrustedPlatformModuleModes.Type property. -// The type for this profile field. -const ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesTypeEnumConst = "enum" -) + // 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"` -// 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. + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ClusterNetworkReference.ResourceType property. +// The resource type. const ( - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesDisabledConst = "disabled" - BareMetalServerProfileSupportedTrustedPlatformModuleModesValuesTpm2Const = "tpm_2" + ClusterNetworkReferenceResourceTypeClusterNetworkConst = "cluster_network" ) -// 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) +// 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, "", "default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "deleted-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 -} - -// 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, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + 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 } -// 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"` +// 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 [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 date and time that the cluster network subnet was created. + CreatedAt *strfmt.DateTime `json:"created_at" 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"` + // The URL for this cluster network subnet. + Href *string `json:"href" validate:"required"` - TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` + // The unique identifier for this cluster network subnet. + ID *string `json:"id" validate:"required"` - // The VPC this bare metal server will reside in. + // The IP version for this cluster network subnet. // - // 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 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 zone this bare metal server will reside in. - Zone ZoneIdentityIntf `json:"zone" validate:"required"` + // The IPv4 range of this cluster network subnet, expressed in CIDR format. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` - // The additional network attachments to create for the bare metal server. - NetworkAttachments []BareMetalServerNetworkAttachmentPrototypeIntf `json:"network_attachments,omitempty"` + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []ClusterNetworkSubnetLifecycleReason `json:"lifecycle_reasons" validate:"required"` - // The primary network attachment to create for the bare metal server. - PrimaryNetworkAttachment BareMetalServerPrimaryNetworkAttachmentPrototypeIntf `json:"primary_network_attachment,omitempty"` + // The lifecycle state of the cluster network subnet. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The additional bare metal server network interfaces to create. - NetworkInterfaces []BareMetalServerNetworkInterfacePrototypeIntf `json:"network_interfaces,omitempty"` + // 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 primary bare metal server network interface to create. - PrimaryNetworkInterface *BareMetalServerPrimaryNetworkInterfacePrototype `json:"primary_network_interface,omitempty"` -} + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` -func (*BareMetalServerPrototype) isaBareMetalServerPrototype() bool { - return true + // 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"` } -type BareMetalServerPrototypeIntf interface { - isaBareMetalServerPrototype() bool -} +// 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 ( + ClusterNetworkSubnetIPVersionIpv4Const = "ipv4" +) -// 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) +// 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" +) + +// Constants associated with the ClusterNetworkSubnet.ResourceType property. +// The resource type. +const ( + ClusterNetworkSubnetResourceTypeClusterNetworkSubnetConst = "cluster_network_subnet" +) + +// 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, "", "bandwidth-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "available_ipv4_address_count-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { - err = core.SDKErrorf(err, "", "enable_secure_boot-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "initialization", &obj.Initialization, UnmarshalBareMetalServerInitializationPrototype) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "initialization-error", common.GetComponentInfo()) + 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, "ip_version", &obj.IPVersion) + if err != nil { + err = core.SDKErrorf(err, "", "ip_version-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 + } + err = core.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkSubnetLifecycleReason) + 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) @@ -37642,100 +41473,157 @@ 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) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { - err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "total_ipv4_address_count-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePrototype) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ClusterNetworkSubnetCollection : ClusterNetworkSubnetCollection struct +type ClusterNetworkSubnetCollection 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 subnets for the cluster network. + Subnets []ClusterNetworkSubnet `json:"subnets" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// 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, "", "trusted_platform_module-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { - err = core.SDKErrorf(err, "", "vpc-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "network_attachments", &obj.NetworkAttachments, UnmarshalBareMetalServerNetworkAttachmentPrototype) + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalClusterNetworkSubnet) if err != nil { - err = core.SDKErrorf(err, "", "network_attachments-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "subnets-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "primary_network_attachment", &obj.PrimaryNetworkAttachment, UnmarshalBareMetalServerPrimaryNetworkAttachmentPrototype) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { - err = core.SDKErrorf(err, "", "primary_network_attachment-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterfacePrototype) + 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 *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, "", "network_interfaces-error", common.GetComponentInfo()) + 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: +// - ClusterNetworkSubnetIdentityByID +// - ClusterNetworkSubnetIdentityByHref +type ClusterNetworkSubnetIdentity struct { + // The unique identifier for this cluster network subnet. + ID *string `json:"id,omitempty"` + + // The URL for this cluster network subnet. + Href *string `json:"href,omitempty"` +} + +func (*ClusterNetworkSubnetIdentity) isaClusterNetworkSubnetIdentity() bool { + return true +} + +type ClusterNetworkSubnetIdentityIntf interface { + isaClusterNetworkSubnetIdentity() bool +} + +// 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, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalBareMetalServerPrimaryNetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { - err = core.SDKErrorf(err, "", "primary_network_interface-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "href-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 +// 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"` - // 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 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 ( - 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" + ClusterNetworkSubnetLifecycleReasonCodeInternalErrorConst = "internal_error" + ClusterNetworkSubnetLifecycleReasonCodeResourceSuspendedByProviderConst = "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) +// 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, "", "code-error", common.GetComponentInfo()) @@ -37755,461 +41643,648 @@ 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"` - - // The supported trusted platform module modes. - SupportedModes []string `json:"supported_modes" validate:"required"` +// 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"` } -// 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) - if err != nil { - err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "supported_modes", &obj.SupportedModes) +// 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, "", "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"` +// 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 + } + + return } -// 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`. +// 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"` + + // The CIDR block for this prefix. + CIDR *string `json:"cidr" validate:"required"` +} + +// 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 ( - BareMetalServerTrustedPlatformModulePatchModeDisabledConst = "disabled" - BareMetalServerTrustedPlatformModulePatchModeTpm2Const = "tpm_2" + ClusterNetworkSubnetPrefixAllocationPolicyAutoConst = "auto" ) -// 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) +// 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, "", "mode-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "allocation_policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR) + if err != nil { + err = core.SDKErrorf(err, "", "cidr-error", common.GetComponentInfo()) return } 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`. +// ClusterNetworkSubnetPrefixPrototype : ClusterNetworkSubnetPrefixPrototype struct +type ClusterNetworkSubnetPrefixPrototype struct { + // The IPv4 range of the cluster network's subnet prefix, expressed in CIDR format. // - // If unspecified, the default trusted platform module mode from the profile will be used. - Mode *string `json:"mode,omitempty"` + // 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"` } -// 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) +// 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, "", "mode-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "cidr-error", common.GetComponentInfo()) return } 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. +// ClusterNetworkSubnetPrototype : ClusterNetworkSubnetPrototype struct // 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"` +// - ClusterNetworkSubnetPrototypeClusterNetworkSubnetByTotalCountPrototype +// - ClusterNetworkSubnetPrototypeClusterNetworkSubnetByIPv4CIDRBlockPrototype +type ClusterNetworkSubnetPrototype 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,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"` } -func (*CatalogOfferingIdentity) isaCatalogOfferingIdentity() bool { +// Constants associated with the ClusterNetworkSubnetPrototype.IPVersion property. +// The IP version(s) to support for this cluster network subnet. +const ( + ClusterNetworkSubnetPrototypeIPVersionIpv4Const = "ipv4" +) + +func (*ClusterNetworkSubnetPrototype) isaClusterNetworkSubnetPrototype() bool { return true } -type CatalogOfferingIdentityIntf interface { - isaCatalogOfferingIdentity() bool +type ClusterNetworkSubnetPrototypeIntf interface { + isaClusterNetworkSubnetPrototype() 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) +// 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, "", "crn-error", common.GetComponentInfo()) + 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 + } + 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 } -// 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"` -} +// 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"` -func (*CatalogOfferingVersionIdentity) isaCatalogOfferingVersionIdentity() bool { - return true -} + // The URL for this cluster network subnet. + Href *string `json:"href" validate:"required"` -type CatalogOfferingVersionIdentityIntf interface { - isaCatalogOfferingVersionIdentity() bool + // 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"` } -// 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) +// Constants associated with the ClusterNetworkSubnetReference.ResourceType property. +// The resource type. +const ( + ClusterNetworkSubnetReferenceResourceTypeClusterNetworkSubnetConst = "cluster_network_subnet" +) + +// 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, "", "crn-error", common.GetComponentInfo()) + 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 } -// 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"` -} +// 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"` -func (*CatalogOfferingVersionPlanIdentity) isaCatalogOfferingVersionPlanIdentity() bool { - return true -} + // 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"` -type CatalogOfferingVersionPlanIdentityIntf interface { - isaCatalogOfferingVersionPlanIdentity() bool + // The date and time that the cluster network subnet reserved IP was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this cluster network subnet reserved IP. + Href *string `json:"href" validate:"required"` + + // 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"` } -// 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) +// Constants associated with the ClusterNetworkSubnetReservedIP.LifecycleState property. +// The lifecycle state of the cluster network subnet reserved IP. +const ( + ClusterNetworkSubnetReservedIPLifecycleStateDeletingConst = "deleting" + ClusterNetworkSubnetReservedIPLifecycleStateFailedConst = "failed" + ClusterNetworkSubnetReservedIPLifecycleStatePendingConst = "pending" + ClusterNetworkSubnetReservedIPLifecycleStateStableConst = "stable" + ClusterNetworkSubnetReservedIPLifecycleStateSuspendedConst = "suspended" + ClusterNetworkSubnetReservedIPLifecycleStateUpdatingConst = "updating" + ClusterNetworkSubnetReservedIPLifecycleStateWaitingConst = "waiting" +) + +// 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 ( + ClusterNetworkSubnetReservedIPOwnerProviderConst = "provider" + ClusterNetworkSubnetReservedIPOwnerUserConst = "user" +) + +// 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, "", "crn-error", common.GetComponentInfo()) + 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, "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.UnmarshalModel(m, "lifecycle_reasons", &obj.LifecycleReasons, UnmarshalClusterNetworkSubnetReservedIPLifecycleReason) + 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, "owner", &obj.Owner) + if err != nil { + err = core.SDKErrorf(err, "", "owner-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, "target", &obj.Target, UnmarshalClusterNetworkSubnetReservedIPTarget) + if err != nil { + err = core.SDKErrorf(err, "", "target-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"` +// ClusterNetworkSubnetReservedIPCollection : ClusterNetworkSubnetReservedIPCollection struct +type ClusterNetworkSubnetReservedIPCollection struct { + // A link to the first page of resources. + First *PageLink `json:"first" validate:"required"` - // If present, this property indicates the referenced resource has been deleted, and provides - // some supplementary information. - Deleted *Deleted `json:"deleted,omitempty"` + // 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"` } -// 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) +// 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, "", "crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDeleted) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { - err = core.SDKErrorf(err, "", "deleted-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "limit-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.UnmarshalModel(m, "next", &obj.Next, UnmarshalPageLink) if err != nil { - err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "reserved_ips", &obj.ReservedIps, UnmarshalClusterNetworkSubnetReservedIP) + if err != nil { + err = core.SDKErrorf(err, "", "reserved_ips-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 } -// 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"` +// 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 } -func (*CertificateInstanceIdentity) isaCertificateInstanceIdentity() bool { - return true -} +// 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"` -type CertificateInstanceIdentityIntf interface { - isaCertificateInstanceIdentity() bool + // 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"` } -// 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) +// 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 ( + ClusterNetworkSubnetReservedIPLifecycleReasonCodeInternalErrorConst = "internal_error" + ClusterNetworkSubnetReservedIPLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// 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, "", "crn-error", common.GetComponentInfo()) + 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 } -// CertificateInstanceReference : CertificateInstanceReference struct -type CertificateInstanceReference struct { - // The CRN for this certificate instance. - CRN *string `json:"crn" 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 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"` } -// 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) +// 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, "", "crn-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 } -// 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), +// 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 + } + if !core.IsNil(clusterNetworkSubnetReservedIPPatch.Name) { + _patch["name"] = clusterNetworkSubnetReservedIPPatch.Name } -} - -// 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 + return } -// SetCIDR : Allow user to set CIDR -func (_options *CheckVPNGatewayConnectionsLocalCIDROptions) SetCIDR(cidr string) *CheckVPNGatewayConnectionsLocalCIDROptions { - _options.CIDR = core.StringPtr(cidr) - return _options -} +// 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"` -// SetHeaders : Allow user to set Headers -func (options *CheckVPNGatewayConnectionsLocalCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionsLocalCIDROptions { - options.Headers = param - return options -} + // If present, this property indicates the referenced resource has been deleted, and provides + // some supplementary information. + Deleted *Deleted `json:"deleted,omitempty"` -// CheckVPNGatewayConnectionsPeerCIDROptions : The CheckVPNGatewayConnectionsPeerCIDR options. -type CheckVPNGatewayConnectionsPeerCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + // The URL for this cluster network subnet reserved IP. + Href *string `json:"href" validate:"required"` - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` + // The unique identifier for this cluster network subnet reserved IP. + ID *string `json:"id" validate:"required"` - // The IP address range in CIDR block notation. - CIDR *string `json:"cidr" validate:"required,ne="` + // 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"` - // Allows users to set headers on API requests - Headers map[string]string + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// 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), - } -} +// Constants associated with the ClusterNetworkSubnetReservedIPReference.ResourceType property. +// The resource type. +const ( + ClusterNetworkSubnetReservedIPReferenceResourceTypeClusterNetworkSubnetReservedIPConst = "cluster_network_subnet_reserved_ip" +) -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *CheckVPNGatewayConnectionsPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionsPeerCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options +// 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, "", "address-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.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 } -// 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 } @@ -39647,18 +44021,23 @@ func (options *CreateInstanceVolumeAttachmentOptions) SetHeaders(param map[strin type CreateIpsecPolicyOptions struct { // The authentication algorithm // - // Must be `disabled` if and only if the `encryption_algorithm` is - // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. + // Must be `disabled` if and only if the `encryption_algorithm` is `aes128gcm16`, + // `aes192gcm16`, or `aes256gcm16` + // + // The `md5` and `sha1` algorithms have been deprecated. AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` // The encryption algorithm // // The `authentication_algorithm` must be `disabled` if and only if - // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or - // `aes256gcm16`. + // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or `aes256gcm16` + // + // The `triple_des` algorithm has been deprecated. EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` - // Perfect Forward Secrecy. + // The Perfect Forward Secrecy group. + // + // Groups `group_2` and `group_5` have been deprecated. Pfs *string `json:"pfs" validate:"required"` // The key lifetime in seconds. @@ -39672,15 +44051,17 @@ 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 } // Constants associated with the CreateIpsecPolicyOptions.AuthenticationAlgorithm property. // The authentication algorithm // -// Must be `disabled` if and only if the `encryption_algorithm` is -// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. +// Must be `disabled` if and only if the `encryption_algorithm` is `aes128gcm16`, +// `aes192gcm16`, or `aes256gcm16` +// +// The `md5` and `sha1` algorithms have been deprecated. const ( CreateIpsecPolicyOptionsAuthenticationAlgorithmDisabledConst = "disabled" CreateIpsecPolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" @@ -39692,8 +44073,9 @@ const ( // The encryption algorithm // // The `authentication_algorithm` must be `disabled` if and only if -// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or -// `aes256gcm16`. +// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or `aes256gcm16` +// +// The `triple_des` algorithm has been deprecated. const ( CreateIpsecPolicyOptionsEncryptionAlgorithmAes128Const = "aes128" CreateIpsecPolicyOptionsEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" @@ -39704,7 +44086,9 @@ const ( ) // Constants associated with the CreateIpsecPolicyOptions.Pfs property. -// Perfect Forward Secrecy. +// The Perfect Forward Secrecy group. +// +// Groups `group_2` and `group_5` have been deprecated. const ( CreateIpsecPolicyOptionsPfsDisabledConst = "disabled" CreateIpsecPolicyOptionsPfsGroup14Const = "group_14" @@ -39790,15 +44174,15 @@ type CreateKeyOptions struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The crypto-system used by this key. + // 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 } // Constants associated with the CreateKeyOptions.Type property. -// The crypto-system used by this key. +// The crypto-system for this key. const ( CreateKeyOptionsTypeEd25519Const = "ed25519" CreateKeyOptionsTypeRsaConst = "rsa" @@ -39871,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 @@ -39894,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 @@ -39927,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 } @@ -40044,17 +44432,13 @@ type CreateLoadBalancerListenerPolicyOptions struct { // The listener identifier. ListenerID *string `json:"listener_id" validate:"required,ne="` - // The policy action. - // + // 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 - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + // - `reject`: Requests will be rejected with a `403` status code. Action *string `json:"action" validate:"required"` // Priority of the policy. The priority is unique across all policies for this load balancer listener. Lower value @@ -40068,28 +44452,27 @@ 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. -// +// 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 -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +// - `reject`: Requests will be rejected with a `403` status code. const ( CreateLoadBalancerListenerPolicyOptionsActionForwardConst = "forward" CreateLoadBalancerListenerPolicyOptionsActionHTTPSRedirectConst = "https_redirect" @@ -40166,12 +44549,11 @@ type CreateLoadBalancerListenerPolicyRuleOptions struct { // The policy identifier. PolicyID *string `json:"policy_id" validate:"required,ne="` - // The condition of the rule. + // The condition for the rule. Condition *string `json:"condition" validate:"required"` - // The type of the rule. - // - // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + // The type of the rule. Body rules are applied to form-encoded request bodies using the + // `UTF-8` character set. Type *string `json:"type" validate:"required"` // The value to be matched for the rule condition. @@ -40186,12 +44568,12 @@ 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 } // Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Condition property. -// The condition of the rule. +// The condition for the rule. const ( CreateLoadBalancerListenerPolicyRuleOptionsConditionContainsConst = "contains" CreateLoadBalancerListenerPolicyRuleOptionsConditionEqualsConst = "equals" @@ -40199,9 +44581,8 @@ const ( ) // Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Type property. -// The type of the rule. -// -// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +// The type of the rule. Body rules are applied to form-encoded request bodies using the +// `UTF-8` character set. const ( CreateLoadBalancerListenerPolicyRuleOptionsTypeBodyConst = "body" CreateLoadBalancerListenerPolicyRuleOptionsTypeHeaderConst = "header" @@ -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 } @@ -40535,7 +44916,7 @@ type CreateLoadBalancerPoolOptions struct { // - `v2`: Enabled with version 2 (binary header format) // - `disabled`: Disabled // - // Supported by load balancers in the `application` family (otherwise always `disabled`). + // For load balancers in the `network` family, this property must be `disabled`. ProxyProtocol *string `json:"proxy_protocol,omitempty"` // The session persistence of this pool. If specified, the load balancer must have @@ -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 } @@ -40574,7 +44955,7 @@ const ( // - `v2`: Enabled with version 2 (binary header format) // - `disabled`: Disabled // -// Supported by load balancers in the `application` family (otherwise always `disabled`). +// For load balancers in the `network` family, this property must be `disabled`. const ( CreateLoadBalancerPoolOptionsProxyProtocolDisabledConst = "disabled" CreateLoadBalancerPoolOptionsProxyProtocolV1Const = "v1" @@ -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 } @@ -40715,10 +45096,7 @@ func (options *CreateNetworkACLRuleOptions) SetHeaders(param map[string]string) type CreatePlacementGroupOptions struct { // The strategy for this placement group: // - `host_spread`: place on different compute hosts - // - `power_spread`: place on compute hosts that use different power sources - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + // - `power_spread`: place on compute hosts that use different power sources. Strategy *string `json:"strategy" validate:"required"` // The name for this placement group. The name must not be used by another placement group in the region. If @@ -40729,17 +45107,14 @@ 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 } // Constants associated with the CreatePlacementGroupOptions.Strategy property. // The strategy for this placement group: // - `host_spread`: place on different compute hosts -// - `power_spread`: place on compute hosts that use different power sources -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +// - `power_spread`: place on compute hosts that use different power sources. const ( CreatePlacementGroupOptionsStrategyHostSpreadConst = "host_spread" CreatePlacementGroupOptionsStrategyPowerSpreadConst = "power_spread" @@ -40799,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 } @@ -40886,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 } @@ -40966,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 } @@ -41041,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 } @@ -41127,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 } @@ -41176,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 } @@ -41214,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 } @@ -41252,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 } @@ -41287,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 } @@ -41318,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 } @@ -41353,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 } @@ -41381,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 } @@ -41409,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 } @@ -41460,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 } @@ -41581,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 } @@ -41679,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 } @@ -41730,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 } @@ -41796,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 } @@ -41845,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. @@ -41861,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 } @@ -41889,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 @@ -41971,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 } @@ -42057,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 @@ -42116,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 } @@ -42253,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 } @@ -42348,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 } @@ -42383,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 } @@ -42458,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 } @@ -42577,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 } @@ -42645,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. @@ -42659,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. @@ -42708,28 +47102,13 @@ func UnmarshalDnsServer(m map[string]json.RawMessage, result interface{}) (err e // DnsServerPrototype : DnsServerPrototype struct type DnsServerPrototype struct { - // The IP address. - // - // 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 DNS server IPv4 address. + Address *string `json:"address,omitempty"` // DHCP configuration for the specified zone will have this DNS server listed first. ZoneAffinity ZoneIdentityIntf `json:"zone_affinity,omitempty"` } -// NewDnsServerPrototype : Instantiate DnsServerPrototype (Generic Model Constructor) -func (*VpcV1) NewDnsServerPrototype(address string) (_model *DnsServerPrototype, err error) { - _model = &DnsServerPrototype{ - Address: core.StringPtr(address), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return -} - // UnmarshalDnsServerPrototype unmarshals an instance of DnsServerPrototype from the specified map of raw messages. func UnmarshalDnsServerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(DnsServerPrototype) @@ -42747,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 @@ -42760,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. @@ -42774,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"` @@ -43025,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"` @@ -43046,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 @@ -43056,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 @@ -43085,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). @@ -43138,10 +47505,7 @@ type DedicatedHostDisk struct { // Instance disks that are on this dedicated host disk. InstanceDisks []InstanceDiskReference `json:"instance_disks" validate:"required"` - // The disk interface used for attaching the disk - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + // The disk interface used for attaching the disk. InterfaceType *string `json:"interface_type" validate:"required"` // The lifecycle state of this dedicated host disk. @@ -43160,14 +47524,14 @@ type DedicatedHostDisk struct { Size *int64 `json:"size" validate:"required"` // The instance disk interfaces supported for this dedicated host disk. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. SupportedInstanceInterfaceTypes []string `json:"supported_instance_interface_types" validate:"required"` } // Constants associated with the DedicatedHostDisk.InterfaceType property. -// The disk interface used for attaching the disk -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +// The disk interface used for attaching the disk. const ( DedicatedHostDiskInterfaceTypeNvmeConst = "nvme" ) @@ -43305,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 } @@ -43439,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"` @@ -43449,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"` @@ -43458,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 @@ -43473,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 @@ -43502,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 @@ -43604,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 } @@ -43787,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 } @@ -43943,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"` @@ -43962,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 @@ -43972,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 @@ -44006,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"` @@ -44840,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 @@ -45138,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 } @@ -45178,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 } @@ -45222,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 } @@ -45260,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 } @@ -45295,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 } @@ -45318,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 } @@ -45351,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 } @@ -45379,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 } @@ -45407,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 } @@ -45435,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 } @@ -45463,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 } @@ -45494,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 } @@ -45529,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 } @@ -45552,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 } @@ -45591,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 } @@ -45636,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 } @@ -45677,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 } @@ -45722,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 } @@ -45757,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 } @@ -45785,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 } @@ -45816,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 } @@ -45854,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 } @@ -45892,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 } @@ -45926,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 } @@ -45957,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 } @@ -45992,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 } @@ -46020,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 } @@ -46051,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 } @@ -46092,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 } @@ -46143,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 } @@ -46195,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 } @@ -46235,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 } @@ -46280,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 } @@ -46315,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 } @@ -46346,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 } @@ -46381,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 } @@ -46412,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 } @@ -46447,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 } @@ -46475,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 } @@ -46503,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 } @@ -46531,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 } @@ -46562,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 } @@ -46600,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 } @@ -46638,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 } @@ -46676,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 } @@ -46714,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 } @@ -46748,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 } @@ -46779,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 } @@ -46814,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 } @@ -46845,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 } @@ -46879,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 } @@ -46907,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 } @@ -46938,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 } @@ -46973,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 } @@ -47004,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 } @@ -47041,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 } @@ -47079,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 } @@ -47117,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 } @@ -47154,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 } @@ -47195,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 } @@ -47242,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 } @@ -47287,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 } @@ -47322,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 } @@ -47353,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 } @@ -47391,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 } @@ -47428,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 } @@ -47498,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 } @@ -47539,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 } @@ -47570,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 } @@ -47616,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. @@ -47630,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 @@ -47843,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"` @@ -47864,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 @@ -47874,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 @@ -47903,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: @@ -48036,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 } @@ -48223,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"` @@ -48243,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 { @@ -48265,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()) @@ -48295,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 } @@ -48314,12 +52803,12 @@ func UnmarshalEndpointGatewayTarget(m map[string]json.RawMessage, result interfa // - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderInfrastructureServicePrototype // - EndpointGatewayTargetPrototypeEndpointGatewayTargetResourceTypeProviderCloudServicePrototype type EndpointGatewayTargetPrototype struct { - // The CRN for this private path service gateway. - CRN *string `json:"crn,omitempty"` - // 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"` + // The name of a provider infrastructure service. Must be: // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. Name *string `json:"name,omitempty"` @@ -48328,7 +52817,9 @@ type EndpointGatewayTargetPrototype struct { // Constants associated with the EndpointGatewayTargetPrototype.ResourceType property. // The target resource type for this endpoint gateway. const ( - EndpointGatewayTargetPrototypeResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" + EndpointGatewayTargetPrototypeResourceTypePrivatePathServiceGatewayConst = "private_path_service_gateway" + EndpointGatewayTargetPrototypeResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" ) func (*EndpointGatewayTargetPrototype) isaEndpointGatewayTargetPrototype() bool { @@ -48342,14 +52833,14 @@ type EndpointGatewayTargetPrototypeIntf interface { // UnmarshalEndpointGatewayTargetPrototype unmarshals an instance of EndpointGatewayTargetPrototype from the specified map of raw messages. func UnmarshalEndpointGatewayTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(EndpointGatewayTargetPrototype) - 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 } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { - err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "name", &obj.Name) @@ -48379,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 } @@ -48450,6 +52941,9 @@ type FloatingIP struct { ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The status of the floating IP. + // + // 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 target of this floating IP. @@ -48461,6 +52955,9 @@ type FloatingIP struct { // Constants associated with the FloatingIP.Status property. // The status of the floating IP. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( FloatingIPStatusAvailableConst = "available" FloatingIPStatusDeletingConst = "deleting" @@ -48528,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"` @@ -48538,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"` @@ -48547,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 @@ -48562,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 @@ -48591,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"` @@ -48640,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"` @@ -48649,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 @@ -48664,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 @@ -48693,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. @@ -48767,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 } @@ -49041,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. @@ -49065,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: @@ -49287,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"` @@ -49297,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"` @@ -49306,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 @@ -49321,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 @@ -49350,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 @@ -49415,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 } @@ -49631,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 } @@ -49666,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 } @@ -49697,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 } @@ -49735,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 } @@ -49770,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 } @@ -49801,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 } @@ -49842,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 } @@ -49890,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 } @@ -49935,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 } @@ -49970,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 } @@ -49998,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 } @@ -50021,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. @@ -50029,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 } @@ -50064,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 } @@ -50092,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 } @@ -50120,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 } @@ -50151,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 } @@ -50186,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 } @@ -50214,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 } @@ -50242,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 } @@ -50270,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 } @@ -50301,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 } @@ -50336,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 } @@ -50359,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. @@ -50367,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 } @@ -50408,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 } @@ -50453,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 } @@ -50494,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 } @@ -50539,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 } @@ -50574,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 } @@ -50602,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 } @@ -50633,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 } @@ -50674,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 } @@ -50722,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 } @@ -50767,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 } @@ -50802,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 } @@ -50830,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 } @@ -50858,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 } @@ -50889,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 } @@ -50924,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 } @@ -50952,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 } @@ -50983,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 } @@ -51024,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 } @@ -51075,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 } @@ -51124,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 } @@ -51158,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 } @@ -51203,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 } @@ -51238,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 } @@ -51266,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 } @@ -51294,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 } @@ -51325,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 } @@ -51363,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 } @@ -51398,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 } @@ -51426,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 } @@ -51457,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 } @@ -51495,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 } @@ -51530,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 } @@ -51558,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 } @@ -51586,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 } @@ -51617,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 } @@ -51652,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 } @@ -51680,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 } @@ -51711,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 } @@ -51749,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 } @@ -51787,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 } @@ -51825,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 } @@ -51860,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 } @@ -51888,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 } @@ -51916,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 } @@ -51947,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 } @@ -51982,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 } @@ -52010,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 } @@ -52038,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 } @@ -52066,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 } @@ -52094,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 } @@ -52125,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 } @@ -52160,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 } @@ -52191,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 } @@ -52226,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 } @@ -52254,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 } @@ -52282,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 } @@ -52313,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 } @@ -52348,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 } @@ -52376,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 } @@ -52404,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 } @@ -52435,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 } @@ -52470,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 } @@ -52501,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 } @@ -52539,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 } @@ -52580,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 } @@ -52625,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 } @@ -52660,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 } @@ -52688,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 } @@ -52719,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 } @@ -52754,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 } @@ -52785,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 } @@ -52817,9 +57441,12 @@ func (options *GetVPNServerRouteOptions) SetHeaders(param map[string]string) *Ge // IkePolicy : IkePolicy struct type IkePolicy struct { - // The authentication algorithm + // The authentication algorithm. // // The `md5` and `sha1` algorithms have been deprecated. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` // The VPN gateway connections that use this IKE policy. @@ -52833,9 +57460,12 @@ type IkePolicy struct { // Groups `2` and `5` have been deprecated. DhGroup *int64 `json:"dh_group" validate:"required"` - // The encryption algorithm + // The encryption algorithm. // // The `triple_des` algorithm has been deprecated. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` // The URL for this IKE policy. @@ -52853,7 +57483,10 @@ type IkePolicy struct { // The name for this IKE policy. The name is unique across all IKE policies in the region. Name *string `json:"name" validate:"required"` - // The IKE negotiation mode. Only `main` is supported. + // The IKE negotiation mode. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. NegotiationMode *string `json:"negotiation_mode" validate:"required"` // The resource group for this IKE policy. @@ -52864,9 +57497,12 @@ type IkePolicy struct { } // Constants associated with the IkePolicy.AuthenticationAlgorithm property. -// The authentication algorithm +// The authentication algorithm. // // The `md5` and `sha1` algorithms have been deprecated. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( IkePolicyAuthenticationAlgorithmMd5Const = "md5" IkePolicyAuthenticationAlgorithmSha1Const = "sha1" @@ -52876,9 +57512,12 @@ const ( ) // Constants associated with the IkePolicy.EncryptionAlgorithm property. -// The encryption algorithm +// The encryption algorithm. // // The `triple_des` algorithm has been deprecated. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( IkePolicyEncryptionAlgorithmAes128Const = "aes128" IkePolicyEncryptionAlgorithmAes192Const = "aes192" @@ -52887,7 +57526,10 @@ const ( ) // Constants associated with the IkePolicy.NegotiationMode property. -// The IKE negotiation mode. Only `main` is supported. +// The IKE negotiation mode. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( IkePolicyNegotiationModeMainConst = "main" ) @@ -52973,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"` @@ -52983,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"` @@ -52992,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 @@ -53007,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 @@ -53042,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"` @@ -53063,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 @@ -53073,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 @@ -53178,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 } @@ -53279,14 +57933,24 @@ 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 // // The `md5` and `sha1` algorithms have been deprecated // - // Must be `disabled` if and only if the `encryption_algorithm` is - // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` // The VPN gateway connections that use this IPsec policy. @@ -53295,16 +57959,18 @@ type IPsecPolicy struct { // The date and time that this IPsec policy was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The encapsulation mode used. Only `tunnel` is supported. + // The encapsulation mode used. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. EncapsulationMode *string `json:"encapsulation_mode" validate:"required"` // The encryption algorithm // // The `triple_des` algorithm has been deprecated // - // The `authentication_algorithm` must be `disabled` if and only if - // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or - // `aes256gcm16`. + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` // The URL for this IPsec policy. @@ -53319,9 +57985,12 @@ type IPsecPolicy struct { // The name for this IPsec policy. The name is unique across all IPsec policies in the region. Name *string `json:"name" validate:"required"` - // Perfect Forward Secrecy + // The Perfect Forward Secrecy group // - // Groups `group_2` and `group_5` have been deprecated. + // Groups `group_2` and `group_5` have been deprecated + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Pfs *string `json:"pfs" validate:"required"` // The resource group for this IPsec policy. @@ -53330,7 +57999,10 @@ type IPsecPolicy struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The transform protocol used. Only `esp` is supported. + // The transform protocol used. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. TransformProtocol *string `json:"transform_protocol" validate:"required"` } @@ -53339,8 +58011,8 @@ type IPsecPolicy struct { // // # The `md5` and `sha1` algorithms have been deprecated // -// Must be `disabled` if and only if the `encryption_algorithm` is -// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( IPsecPolicyAuthenticationAlgorithmDisabledConst = "disabled" IPsecPolicyAuthenticationAlgorithmMd5Const = "md5" @@ -53351,7 +58023,10 @@ const ( ) // Constants associated with the IPsecPolicy.EncapsulationMode property. -// The encapsulation mode used. Only `tunnel` is supported. +// The encapsulation mode used. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( IPsecPolicyEncapsulationModeTunnelConst = "tunnel" ) @@ -53361,9 +58036,8 @@ const ( // // The `triple_des` algorithm has been deprecated // -// The `authentication_algorithm` must be `disabled` if and only if -// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or -// `aes256gcm16`. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( IPsecPolicyEncryptionAlgorithmAes128Const = "aes128" IPsecPolicyEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" @@ -53375,9 +58049,12 @@ const ( ) // Constants associated with the IPsecPolicy.Pfs property. -// Perfect Forward Secrecy +// The Perfect Forward Secrecy group // -// Groups `group_2` and `group_5` have been deprecated. +// Groups `group_2` and `group_5` have been deprecated +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( IPsecPolicyPfsDisabledConst = "disabled" IPsecPolicyPfsGroup14Const = "group_14" @@ -53403,7 +58080,10 @@ const ( ) // Constants associated with the IPsecPolicy.TransformProtocol property. -// The transform protocol used. Only `esp` is supported. +// The transform protocol used. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( IPsecPolicyTransformProtocolEspConst = "esp" ) @@ -53483,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"` @@ -53493,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"` @@ -53502,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 @@ -53517,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 @@ -53546,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"` @@ -53609,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 @@ -53619,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 @@ -53648,55 +58292,22 @@ 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 // - // Must be `disabled` if and only if the `encryption_algorithm` is - // `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. + // Must be `disabled` if and only if the `encryption_algorithm` is `aes128gcm16`, + // `aes192gcm16`, or `aes256gcm16` + // + // The `md5` and `sha1` algorithms have been deprecated. AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` // The encryption algorithm // // The `authentication_algorithm` must be `disabled` if and only if - // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or - // `aes256gcm16`. + // `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or `aes256gcm16` + // + // The `triple_des` algorithm has been deprecated. EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` // The key lifetime in seconds. @@ -53705,15 +58316,19 @@ type IPsecPolicyPatch struct { // The name for this IPsec policy. The name must not be used by another IPsec policy in the region. Name *string `json:"name,omitempty"` - // Perfect Forward Secrecy. + // The Perfect Forward Secrecy group. + // + // Groups `group_2` and `group_5` have been deprecated. Pfs *string `json:"pfs,omitempty"` } // Constants associated with the IPsecPolicyPatch.AuthenticationAlgorithm property. // The authentication algorithm // -// Must be `disabled` if and only if the `encryption_algorithm` is -// `aes128gcm16`, `aes192gcm16`, or `aes256gcm16`. +// Must be `disabled` if and only if the `encryption_algorithm` is `aes128gcm16`, +// `aes192gcm16`, or `aes256gcm16` +// +// The `md5` and `sha1` algorithms have been deprecated. const ( IPsecPolicyPatchAuthenticationAlgorithmDisabledConst = "disabled" IPsecPolicyPatchAuthenticationAlgorithmSha256Const = "sha256" @@ -53725,8 +58340,9 @@ const ( // The encryption algorithm // // The `authentication_algorithm` must be `disabled` if and only if -// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or -// `aes256gcm16`. +// `encryption_algorithm` is `aes128gcm16`, `aes192gcm16`, or `aes256gcm16` +// +// The `triple_des` algorithm has been deprecated. const ( IPsecPolicyPatchEncryptionAlgorithmAes128Const = "aes128" IPsecPolicyPatchEncryptionAlgorithmAes128gcm16Const = "aes128gcm16" @@ -53737,7 +58353,9 @@ const ( ) // Constants associated with the IPsecPolicyPatch.Pfs property. -// Perfect Forward Secrecy. +// The Perfect Forward Secrecy group. +// +// Groups `group_2` and `group_5` have been deprecated. const ( IPsecPolicyPatchPfsDisabledConst = "disabled" IPsecPolicyPatchPfsGroup14Const = "group_14" @@ -53788,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 } @@ -53856,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"` @@ -54220,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"` @@ -54230,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"` @@ -54239,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 @@ -54254,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 @@ -54283,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. @@ -54350,7 +58869,7 @@ type ImageExportJob struct { // `storage_object.name`, or `storage_href` values. Name *string `json:"name" validate:"required"` - // The type of resource referenced. + // The resource type. ResourceType *string `json:"resource_type" validate:"required"` // The date and time that the image export job started running. @@ -54366,6 +58885,9 @@ type ImageExportJob struct { // - `succeeded`: Export job was completed successfully // // The exported image object is automatically deleted for `failed` jobs. + // + // 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). @@ -54394,7 +58916,7 @@ const ( ) // Constants associated with the ImageExportJob.ResourceType property. -// The type of resource referenced. +// The resource type. const ( ImageExportJobResourceTypeImageExportJobConst = "image_export_job" ) @@ -54408,6 +58930,9 @@ const ( // - `succeeded`: Export job was completed successfully // // The exported image object is automatically deleted for `failed` jobs. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ImageExportJobStatusDeletingConst = "deleting" ImageExportJobStatusFailedConst = "failed" @@ -54515,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 } @@ -54784,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 } @@ -55119,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"` @@ -55338,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()) @@ -55687,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. @@ -55804,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) @@ -55841,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 @@ -55856,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 } @@ -55870,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"` } -// 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) +// 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"` +} + +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()) @@ -55888,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. @@ -56135,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 } @@ -56293,7 +61323,10 @@ type InstanceGroup struct { // - `healthy`: Group has `membership_count` instances // - `scaling`: Instances in the group are being created or deleted to reach // `membership_count` - // - `unhealthy`: Group is unable to reach `membership_count` instances. + // - `unhealthy`: Group is unable to reach `membership_count` instances + // + // 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 subnets to use when creating new instances. @@ -56324,7 +61357,10 @@ const ( // - `healthy`: Group has `membership_count` instances // - `scaling`: Instances in the group are being created or deleted to reach // `membership_count` -// - `unhealthy`: Group is unable to reach `membership_count` instances. +// - `unhealthy`: Group is unable to reach `membership_count` instances +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceGroupStatusDeletingConst = "deleting" InstanceGroupStatusHealthyConst = "healthy" @@ -56427,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"` @@ -56437,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"` @@ -56446,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 @@ -56461,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 @@ -56490,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: @@ -56743,7 +61743,10 @@ type InstanceGroupManagerAction struct { // - `completed`: Action was completed successfully // - `failed`: Action could not be completed successfully // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. + // - `omitted`: Action was not applied because this action's manager was disabled + // + // 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 date and time that the instance group manager action was updated. @@ -56780,7 +61783,10 @@ const ( // - `completed`: Action was completed successfully // - `failed`: Action could not be completed successfully // - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. +// - `omitted`: Action was not applied because this action's manager was disabled +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceGroupManagerActionStatusActiveConst = "active" InstanceGroupManagerActionStatusCompletedConst = "completed" @@ -56903,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. @@ -56929,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 @@ -56999,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 } @@ -57134,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"` @@ -57155,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 @@ -57165,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 @@ -57194,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"` @@ -57243,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"` @@ -57252,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 @@ -57267,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 @@ -57296,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. @@ -57392,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 } @@ -57423,18 +62407,27 @@ type InstanceGroupManagerPolicy struct { // The date and time that the instance group manager policy was updated. UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - // The type of metric to be evaluated. + // The type of metric to be evaluated + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. MetricType *string `json:"metric_type,omitempty"` // The metric value to be evaluated. MetricValue *int64 `json:"metric_value,omitempty"` - // The type of policy for the instance group. + // The type of policy for the instance group + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. PolicyType *string `json:"policy_type,omitempty"` } // Constants associated with the InstanceGroupManagerPolicy.MetricType property. -// The type of metric to be evaluated. +// The type of metric to be evaluated +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceGroupManagerPolicyMetricTypeCpuConst = "cpu" InstanceGroupManagerPolicyMetricTypeMemoryConst = "memory" @@ -57443,7 +62436,10 @@ const ( ) // Constants associated with the InstanceGroupManagerPolicy.PolicyType property. -// The type of policy for the instance group. +// The type of policy for the instance group +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceGroupManagerPolicyPolicyTypeTargetConst = "target" ) @@ -57506,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"` @@ -57525,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 @@ -57535,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 @@ -57569,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. @@ -57651,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 } @@ -58098,7 +63061,10 @@ type InstanceGroupMembership struct { // - `failed`: Membership was unable to maintain dependent resources // - `healthy`: Membership is active and serving in the group // - `pending`: Membership is waiting for dependent resources - // - `unhealthy`: Membership has unhealthy dependent resources. + // - `unhealthy`: Membership has unhealthy dependent resources + // + // 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 date and time that the instance group membership was updated. @@ -58111,7 +63077,10 @@ type InstanceGroupMembership struct { // - `failed`: Membership was unable to maintain dependent resources // - `healthy`: Membership is active and serving in the group // - `pending`: Membership is waiting for dependent resources -// - `unhealthy`: Membership has unhealthy dependent resources. +// - `unhealthy`: Membership has unhealthy dependent resources +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceGroupMembershipStatusDeletingConst = "deleting" InstanceGroupMembershipStatusFailedConst = "failed" @@ -58180,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"` @@ -58190,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"` @@ -58199,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 @@ -58214,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 @@ -58243,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. @@ -58308,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 } @@ -58399,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 } @@ -58769,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. @@ -58979,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 } @@ -59329,18 +64294,17 @@ type InstancePatch struct { // region. Changing the name will not affect the system hostname. Name *string `json:"name,omitempty"` - // The placement restrictions to use for the virtual server instance. For the placement - // restrictions to be changed, the instance `status` must be `stopping` or `stopped`. - // + // The placement restrictions to use for the virtual server instance. For the placement restrictions to be changed, the + // instance `status` must be `stopping` or `stopped`. // 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`. @@ -59421,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`. @@ -59461,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. @@ -59480,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 @@ -59578,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. @@ -59602,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 @@ -59652,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. @@ -59706,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"` @@ -59746,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()) @@ -59841,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()) @@ -59950,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. @@ -61254,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. @@ -61390,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()) @@ -61644,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: @@ -61757,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. @@ -61898,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()) @@ -62035,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"` @@ -62054,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 @@ -62064,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 @@ -62083,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 @@ -62141,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. @@ -62165,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. @@ -62185,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 } @@ -62206,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. @@ -62342,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()) @@ -62577,12 +67707,18 @@ type Key struct { // The resource group for this key. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` - // The crypto-system used by this key. + // The crypto-system for this key. + // + // 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"` } // Constants associated with the Key.Type property. -// The crypto-system used by this key. +// The crypto-system for this key. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( KeyTypeEd25519Const = "ed25519" KeyTypeRsaConst = "rsa" @@ -62648,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"` @@ -62658,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"` @@ -62667,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 @@ -62682,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 @@ -62711,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 @@ -62823,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 } @@ -62957,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 } @@ -63036,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 } @@ -63132,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 } @@ -63166,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 } @@ -63200,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 } @@ -63243,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 } @@ -63281,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 } @@ -63322,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 } @@ -63365,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 } @@ -63415,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 } @@ -63472,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 } @@ -63517,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 } @@ -63570,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 } @@ -63617,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 } @@ -63684,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 } @@ -63766,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 } @@ -63874,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 } @@ -63975,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 } @@ -64052,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 } @@ -64090,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 } @@ -64133,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 } @@ -64186,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 } @@ -64268,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 } @@ -64310,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 } @@ -64366,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 } @@ -64419,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 } @@ -64465,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 } @@ -64508,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 } @@ -64540,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 } @@ -64571,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 } @@ -64615,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 } @@ -64662,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 } @@ -64688,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 } @@ -64706,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 } @@ -64726,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 } @@ -64763,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"` @@ -64802,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 } @@ -64835,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) @@ -64921,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 } @@ -64959,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 } @@ -65002,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 } @@ -65023,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 @@ -65037,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 } @@ -65078,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 } @@ -65120,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 } @@ -65151,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 } @@ -65186,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 } @@ -65217,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 } @@ -65252,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 } @@ -65293,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 } @@ -65352,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 } @@ -65402,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 } @@ -65461,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 } @@ -65496,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 } @@ -65537,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 } @@ -65595,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 } @@ -65663,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 } @@ -65707,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 } @@ -65745,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 } @@ -65771,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 } @@ -65803,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 } @@ -65853,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 } @@ -65887,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 } @@ -65942,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 } @@ -66004,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 } @@ -66053,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 } @@ -66107,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 } @@ -66171,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 } @@ -66244,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 } @@ -66290,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 } @@ -66437,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 } @@ -66621,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 } @@ -66725,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 } @@ -66811,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 } @@ -66873,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 } @@ -66914,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 } @@ -66978,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 } @@ -67073,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 } @@ -67137,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 } @@ -67225,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 } @@ -67280,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 } @@ -67336,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 } @@ -67391,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 } @@ -67438,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 } @@ -67482,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 } @@ -67538,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 } @@ -67587,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 } @@ -67664,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 } @@ -67729,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 } @@ -67798,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 } @@ -67914,6 +73464,9 @@ type LoadBalancer struct { Name *string `json:"name" validate:"required"` // The operating status of this load balancer. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. OperatingStatus *string `json:"operating_status" validate:"required"` // The pools of this load balancer. @@ -68007,6 +73560,9 @@ const ( // Constants associated with the LoadBalancer.OperatingStatus property. // The operating status of this load balancer. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerOperatingStatusOfflineConst = "offline" LoadBalancerOperatingStatusOnlineConst = "online" @@ -68192,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"` @@ -68202,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"` @@ -68211,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 @@ -68226,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 @@ -68255,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 @@ -68358,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 @@ -68429,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. @@ -68453,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 @@ -68468,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"` @@ -68489,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. @@ -68673,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. @@ -68692,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. @@ -68759,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. @@ -68824,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. @@ -68843,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 @@ -68857,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 @@ -68880,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 @@ -69001,21 +74602,44 @@ 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 } // LoadBalancerListenerPolicy : LoadBalancerListenerPolicy struct type LoadBalancerListenerPolicy struct { - // The policy action. - // + // 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 @@ -69061,8 +74685,7 @@ type LoadBalancerListenerPolicy struct { } // Constants associated with the LoadBalancerListenerPolicy.Action property. -// The policy action. -// +// 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 @@ -69202,30 +74825,29 @@ 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 } // LoadBalancerListenerPolicyPrototype : LoadBalancerListenerPolicyPrototype struct type LoadBalancerListenerPolicyPrototype struct { - // The policy action. - // + // 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 - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + // - `reject`: Requests will be rejected with a `403` status code. Action *string `json:"action" validate:"required"` // The name for this policy. The name must not be used by another policy for the load balancer listener. If @@ -69239,25 +74861,24 @@ 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. -// +// 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 -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +// - `reject`: Requests will be rejected with a `403` status code. const ( LoadBalancerListenerPolicyPrototypeActionForwardConst = "forward" LoadBalancerListenerPolicyPrototypeActionHTTPSRedirectConst = "https_redirect" @@ -69356,7 +74977,10 @@ func UnmarshalLoadBalancerListenerPolicyReference(m map[string]json.RawMessage, // LoadBalancerListenerPolicyRule : LoadBalancerListenerPolicyRule struct type LoadBalancerListenerPolicyRule struct { - // The condition of the rule. + // The condition for the rule. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Condition *string `json:"condition" validate:"required"` // The date and time that this rule was created. @@ -69377,9 +75001,11 @@ type LoadBalancerListenerPolicyRule struct { // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` - // The type of the rule. + // The type of the rule. Body rules are applied to form-encoded request bodies using the + // `UTF-8` character set. // - // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + // 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 value to be matched for the rule condition. @@ -69389,7 +75015,10 @@ type LoadBalancerListenerPolicyRule struct { } // Constants associated with the LoadBalancerListenerPolicyRule.Condition property. -// The condition of the rule. +// The condition for the rule. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerListenerPolicyRuleConditionContainsConst = "contains" LoadBalancerListenerPolicyRuleConditionEqualsConst = "equals" @@ -69410,9 +75039,11 @@ const ( ) // Constants associated with the LoadBalancerListenerPolicyRule.Type property. -// The type of the rule. +// The type of the rule. Body rules are applied to form-encoded request bodies using the +// `UTF-8` character set. // -// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerListenerPolicyRuleTypeBodyConst = "body" LoadBalancerListenerPolicyRuleTypeHeaderConst = "header" @@ -69488,7 +75119,7 @@ func UnmarshalLoadBalancerListenerPolicyRuleCollection(m map[string]json.RawMess // LoadBalancerListenerPolicyRulePatch : LoadBalancerListenerPolicyRulePatch struct type LoadBalancerListenerPolicyRulePatch struct { - // The condition of the rule. + // The condition for the rule. Condition *string `json:"condition,omitempty"` // The field to match for this rule. This property must be specified if the rule type is @@ -69498,9 +75129,8 @@ type LoadBalancerListenerPolicyRulePatch struct { // If the rule condition is not `matches_regex`, the value must be percent-encoded. Field *string `json:"field,omitempty"` - // The type of the rule. - // - // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + // The type of the rule. Body rules are applied to form-encoded request bodies using the + // `UTF-8` character set. Type *string `json:"type,omitempty"` // The value to be matched for the rule condition. @@ -69510,7 +75140,7 @@ type LoadBalancerListenerPolicyRulePatch struct { } // Constants associated with the LoadBalancerListenerPolicyRulePatch.Condition property. -// The condition of the rule. +// The condition for the rule. const ( LoadBalancerListenerPolicyRulePatchConditionContainsConst = "contains" LoadBalancerListenerPolicyRulePatchConditionEqualsConst = "equals" @@ -69518,9 +75148,8 @@ const ( ) // Constants associated with the LoadBalancerListenerPolicyRulePatch.Type property. -// The type of the rule. -// -// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +// The type of the rule. Body rules are applied to form-encoded request bodies using the +// `UTF-8` character set. const ( LoadBalancerListenerPolicyRulePatchTypeBodyConst = "body" LoadBalancerListenerPolicyRulePatchTypeHeaderConst = "header" @@ -69558,20 +75187,26 @@ 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 } // LoadBalancerListenerPolicyRulePrototype : LoadBalancerListenerPolicyRulePrototype struct type LoadBalancerListenerPolicyRulePrototype struct { - // The condition of the rule. + // The condition for the rule. Condition *string `json:"condition" validate:"required"` // The field to match for this rule. This property must be specified if the rule type is @@ -69581,9 +75216,8 @@ type LoadBalancerListenerPolicyRulePrototype struct { // If the rule condition is not `matches_regex`, the value must be percent-encoded. Field *string `json:"field,omitempty"` - // The type of the rule. - // - // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + // The type of the rule. Body rules are applied to form-encoded request bodies using the + // `UTF-8` character set. Type *string `json:"type" validate:"required"` // The value to be matched for the rule condition. @@ -69593,7 +75227,7 @@ type LoadBalancerListenerPolicyRulePrototype struct { } // Constants associated with the LoadBalancerListenerPolicyRulePrototype.Condition property. -// The condition of the rule. +// The condition for the rule. const ( LoadBalancerListenerPolicyRulePrototypeConditionContainsConst = "contains" LoadBalancerListenerPolicyRulePrototypeConditionEqualsConst = "equals" @@ -69601,9 +75235,8 @@ const ( ) // Constants associated with the LoadBalancerListenerPolicyRulePrototype.Type property. -// The type of the rule. -// -// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +// The type of the rule. Body rules are applied to form-encoded request bodies using the +// `UTF-8` character set. const ( LoadBalancerListenerPolicyRulePrototypeTypeBodyConst = "body" LoadBalancerListenerPolicyRulePrototypeTypeHeaderConst = "header" @@ -69843,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. @@ -69882,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 @@ -69985,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, @@ -70007,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 @@ -70227,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. @@ -70263,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. @@ -70339,20 +76027,33 @@ 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 } // LoadBalancerPool : LoadBalancerPool struct type LoadBalancerPool struct { // The load balancing algorithm. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Algorithm *string `json:"algorithm" validate:"required"` // The date and time that this pool was created. @@ -70393,7 +76094,8 @@ type LoadBalancerPool struct { // - `v2`: Enabled with version 2 (binary header format) // - `disabled`: Disabled // - // Supported by load balancers in the `application` family (otherwise always `disabled`). + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProxyProtocol *string `json:"proxy_protocol" validate:"required"` // The session persistence of this pool. @@ -70405,6 +76107,9 @@ type LoadBalancerPool struct { // Constants associated with the LoadBalancerPool.Algorithm property. // The load balancing algorithm. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerPoolAlgorithmLeastConnectionsConst = "least_connections" LoadBalancerPoolAlgorithmRoundRobinConst = "round_robin" @@ -70442,7 +76147,8 @@ const ( // - `v2`: Enabled with version 2 (binary header format) // - `disabled`: Disabled // -// Supported by load balancers in the `application` family (otherwise always `disabled`). +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerPoolProxyProtocolDisabledConst = "disabled" LoadBalancerPoolProxyProtocolV1Const = "v1" @@ -70560,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"` } @@ -70607,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()) @@ -70708,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`. @@ -70811,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. @@ -70830,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. @@ -70866,6 +76601,9 @@ type LoadBalancerPoolMember struct { CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // Health of the server member in the pool. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Health *string `json:"health" validate:"required"` // The URL for this load balancer pool member. @@ -70902,6 +76640,9 @@ type LoadBalancerPoolMember struct { // Constants associated with the LoadBalancerPoolMember.Health property. // Health of the server member in the pool. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( LoadBalancerPoolMemberHealthFaultedConst = "faulted" LoadBalancerPoolMemberHealthOkConst = "ok" @@ -71034,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 } @@ -71243,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. @@ -71272,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. @@ -71298,7 +77063,7 @@ type LoadBalancerPoolPatch struct { // - `v2`: Enabled with version 2 (binary header format) // - `disabled`: Disabled // - // Supported by load balancers in the `application` family (otherwise always `disabled`). + // For load balancers in the `network` family, this property must be `disabled`. ProxyProtocol *string `json:"proxy_protocol,omitempty"` // The session persistence of this pool. @@ -71306,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" @@ -71335,7 +77101,7 @@ const ( // - `v2`: Enabled with version 2 (binary header format) // - `disabled`: Disabled // -// Supported by load balancers in the `application` family (otherwise always `disabled`). +// For load balancers in the `network` family, this property must be `disabled`. const ( LoadBalancerPoolPatchProxyProtocolDisabledConst = "disabled" LoadBalancerPoolPatchProxyProtocolV1Const = "v1" @@ -71381,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 } @@ -71419,7 +77197,7 @@ type LoadBalancerPoolPrototype struct { // - `v2`: Enabled with version 2 (binary header format) // - `disabled`: Disabled // - // Supported by load balancers in the `application` family (otherwise always `disabled`). + // For load balancers in the `network` family, this property must be `disabled`. ProxyProtocol *string `json:"proxy_protocol,omitempty"` // The session persistence of this pool. If specified, the load balancer must have @@ -71455,7 +77233,7 @@ const ( // - `v2`: Enabled with version 2 (binary header format) // - `disabled`: Disabled // -// Supported by load balancers in the `application` family (otherwise always `disabled`). +// For load balancers in the `network` family, this property must be `disabled`. const ( LoadBalancerPoolPrototypeProxyProtocolDisabledConst = "disabled" LoadBalancerPoolPrototypeProxyProtocolV1Const = "v1" @@ -71643,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. @@ -71912,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"` @@ -71931,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 @@ -71941,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 @@ -71975,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 @@ -72534,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"` @@ -72544,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"` @@ -72553,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 @@ -72568,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 @@ -72597,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 @@ -72655,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. @@ -72679,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. @@ -72699,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 } @@ -72858,7 +78591,7 @@ type NetworkACLRule struct { // The name for this network ACL rule. The name is unique across all rules for the network ACL. Name *string `json:"name" validate:"required"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -72908,7 +78641,7 @@ const ( ) // Constants associated with the NetworkACLRule.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRuleProtocolAllConst = "all" NetworkACLRuleProtocolIcmpConst = "icmp" @@ -72985,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. @@ -73004,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. @@ -73046,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"` @@ -73065,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 @@ -73075,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 @@ -73109,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 @@ -73179,7 +78890,7 @@ type NetworkACLRuleItem struct { // The name for this network ACL rule. The name is unique across all rules for the network ACL. Name *string `json:"name" validate:"required"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -73229,7 +78940,7 @@ const ( ) // Constants associated with the NetworkACLRuleItem.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRuleItemProtocolAllConst = "all" NetworkACLRuleItemProtocolIcmpConst = "icmp" @@ -73316,7 +79027,7 @@ type NetworkACLRulePatch struct { // The name for this network ACL rule. The name must not be used by another rule for the network ACL. Name *string `json:"name,omitempty"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol,omitempty"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -73349,7 +79060,7 @@ const ( ) // Constants associated with the NetworkACLRulePatch.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRulePatchProtocolAllConst = "all" NetworkACLRulePatchProtocolIcmpConst = "icmp" @@ -73431,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 } @@ -73469,7 +79213,7 @@ type NetworkACLRulePrototype struct { // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -73519,7 +79263,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototype.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRulePrototypeProtocolAllConst = "all" NetworkACLRulePrototypeProtocolIcmpConst = "icmp" @@ -73598,7 +79342,7 @@ type NetworkACLRulePrototypeNetworkACLContext struct { // the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. @@ -73648,7 +79392,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRulePrototypeNetworkACLContextProtocolAllConst = "all" NetworkACLRulePrototypeNetworkACLContextProtocolIcmpConst = "icmp" @@ -74201,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 } @@ -74309,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 } @@ -74441,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"` @@ -74460,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 @@ -74470,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 @@ -74504,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 @@ -74577,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. @@ -74600,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 } @@ -74756,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"` @@ -74775,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 @@ -74785,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 @@ -74819,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. @@ -74875,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 } @@ -75160,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"` @@ -75181,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 @@ -75191,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 @@ -75220,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 @@ -75306,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"` @@ -75339,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 @@ -75349,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 @@ -75383,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. @@ -75551,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"` @@ -75572,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 @@ -75582,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 @@ -75611,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. @@ -75707,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 } @@ -75863,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"` @@ -75882,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 @@ -75892,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 @@ -75926,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. @@ -76158,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 } @@ -76239,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 } @@ -76274,11 +81817,17 @@ type Region struct { Name *string `json:"name" validate:"required"` // The availability status of this region. + // + // 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"` } // Constants associated with the Region.Status property. // The availability status of this region. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( RegionStatusAvailableConst = "available" RegionStatusUnavailableConst = "unavailable" @@ -76347,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. @@ -76366,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. @@ -76403,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 } @@ -76448,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 } @@ -76489,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 } @@ -76534,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 } @@ -76572,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 } @@ -76613,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 } @@ -76661,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 } @@ -76720,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 } @@ -76774,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 } @@ -76819,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 } @@ -76857,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 } @@ -77084,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 @@ -77104,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 @@ -77169,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. @@ -77202,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"` @@ -77221,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 @@ -77231,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 @@ -77265,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. @@ -77367,9 +82906,6 @@ type ReservationCommittedUsePatch struct { // - `release`: Release any available capacity and let the reservation expire. // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ExpirationPolicy *string `json:"expiration_policy,omitempty"` // The term for this committed use reservation: @@ -77387,9 +82923,6 @@ type ReservationCommittedUsePatch struct { // - `release`: Release any available capacity and let the reservation expire. // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationCommittedUsePatchExpirationPolicyReleaseConst = "release" ReservationCommittedUsePatchExpirationPolicyRenewConst = "renew" @@ -77412,15 +82945,25 @@ 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: // - `release`: Release any available capacity and let the reservation expire. // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. - // - // The enumerated values for this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ExpirationPolicy *string `json:"expiration_policy,omitempty"` // The term for this committed use reservation: @@ -77436,9 +82979,6 @@ type ReservationCommittedUsePrototype struct { // - `release`: Release any available capacity and let the reservation expire. // - `renew`: Renew for another term, provided the term remains listed in the // `reservation_terms` for the profile. Otherwise, let the reservation expire. -// -// The enumerated values for this property may -// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservationCommittedUsePrototypeExpirationPolicyReleaseConst = "release" ReservationCommittedUsePrototypeExpirationPolicyRenewConst = "renew" @@ -77495,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. @@ -77519,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. @@ -77566,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 } @@ -77649,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. @@ -77836,6 +83412,9 @@ type ReservedIP struct { Name *string `json:"name" validate:"required"` // The owner of the 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. @@ -77844,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"` } @@ -77861,6 +83443,9 @@ const ( // Constants associated with the ReservedIP.Owner property. // The owner of the reserved IP. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ReservedIPOwnerProviderConst = "provider" ReservedIPOwnerUserConst = "user" @@ -77932,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"` @@ -77951,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 @@ -77961,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 @@ -77998,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"` @@ -78008,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"` @@ -78017,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 @@ -78032,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 @@ -78046,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"` @@ -78095,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"` @@ -78104,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 @@ -78119,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 @@ -78148,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"` @@ -78215,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"` @@ -78224,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 @@ -78239,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 @@ -78268,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"` @@ -78335,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"` @@ -78344,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 @@ -78359,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 @@ -78388,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 @@ -78454,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 } @@ -78538,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 @@ -78688,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: @@ -78756,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 } @@ -78787,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 } @@ -78823,7 +84241,10 @@ type Route struct { // - `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. + // - `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` @@ -78863,7 +84284,7 @@ type Route struct { // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. - Origin *string `json:"origin,omitempty"` + Origin *string `json:"origin" validate:"required"` // The priority of this route. Smaller values have higher priority. // @@ -78887,7 +84308,10 @@ type Route struct { // - `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. +// - `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 ( RouteActionDelegateConst = "delegate" RouteActionDelegateVPCConst = "delegate_vpc" @@ -78991,384 +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. - 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,omitempty"` - - // 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. -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. @@ -79555,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. @@ -79579,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`. // @@ -79691,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 } @@ -79868,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 @@ -80074,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"` @@ -80093,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 @@ -80103,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 @@ -80137,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 @@ -80195,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. @@ -80219,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 @@ -80342,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 } @@ -80503,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"` @@ -80522,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 @@ -80532,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 @@ -80566,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 @@ -80668,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 } @@ -80736,7 +85900,7 @@ func UnmarshalSecurityGroupReference(m map[string]json.RawMessage, result interf // - SecurityGroupRuleSecurityGroupRuleProtocolIcmp // - SecurityGroupRuleSecurityGroupRuleProtocolTcpudp type SecurityGroupRule struct { - // The direction of traffic to enforce. + // The direction of traffic to allow. Direction *string `json:"direction" validate:"required"` // The URL for this security group rule. @@ -80745,11 +85909,11 @@ type SecurityGroupRule struct { // The unique identifier for this security group rule. ID *string `json:"id" validate:"required"` - // The IP version to enforce. The format of `local.address`, `remote.address`, + // The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. + // If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP + // version. IPVersion *string `json:"ip_version" validate:"required"` // The local IP address or range of local IP addresses to which this rule will allow inbound @@ -80757,7 +85921,10 @@ type SecurityGroupRule struct { // to all local IP addresses (or from all local IP addresses, for outbound rules). Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` - // The protocol to enforce. + // The protocol to allow. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Protocol *string `json:"protocol" validate:"required"` // The remote IP addresses or security groups from which this rule allows traffic (or to @@ -80779,24 +85946,27 @@ type SecurityGroupRule struct { } // Constants associated with the SecurityGroupRule.Direction property. -// The direction of traffic to enforce. +// The direction of traffic to allow. const ( SecurityGroupRuleDirectionInboundConst = "inbound" SecurityGroupRuleDirectionOutboundConst = "outbound" ) // Constants associated with the SecurityGroupRule.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, +// The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. +// If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP +// version. const ( SecurityGroupRuleIPVersionIpv4Const = "ipv4" ) // Constants associated with the SecurityGroupRule.Protocol property. -// The protocol to enforce. +// The protocol to allow. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( SecurityGroupRuleProtocolAllConst = "all" SecurityGroupRuleProtocolIcmpConst = "icmp" @@ -80814,42 +85984,63 @@ type SecurityGroupRuleIntf interface { // UnmarshalSecurityGroupRule unmarshals an instance of SecurityGroupRule from the specified map of raw messages. func UnmarshalSecurityGroupRule(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(SecurityGroupRule) + 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, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) return } - if discValue == "all" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolAll-error", common.GetComponentInfo()) - } - } else if discValue == "icmp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolIcmp-error", common.GetComponentInfo()) - } - } else if discValue == "tcp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolTcpudp-error", common.GetComponentInfo()) - } - } else if discValue == "udp" { - err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolTcpudp-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.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) + 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, UnmarshalSecurityGroupRuleRemote) + 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 } @@ -80944,6 +86135,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. @@ -80963,6 +86155,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) // @@ -81017,14 +86222,14 @@ type SecurityGroupRulePatch struct { // Specify `null` to remove an existing ICMP traffic code. Code *int64 `json:"code,omitempty"` - // The direction of traffic to enforce. + // The direction of traffic to allow. Direction *string `json:"direction,omitempty"` - // The IP version to enforce. The format of `local.address`, `remote.address`, + // The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. + // If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP + // version. IPVersion *string `json:"ip_version,omitempty"` // The local IP address or range of local IP addresses to which this rule will allow inbound @@ -81060,18 +86265,18 @@ type SecurityGroupRulePatch struct { } // Constants associated with the SecurityGroupRulePatch.Direction property. -// The direction of traffic to enforce. +// The direction of traffic to allow. const ( SecurityGroupRulePatchDirectionInboundConst = "inbound" SecurityGroupRulePatchDirectionOutboundConst = "outbound" ) // Constants associated with the SecurityGroupRulePatch.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, +// The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. +// If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP +// version. const ( SecurityGroupRulePatchIPVersionIpv4Const = "ipv4" ) @@ -81125,14 +86330,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 } @@ -81142,14 +86365,14 @@ func (securityGroupRulePatch *SecurityGroupRulePatch) AsPatch() (_patch map[stri // - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp // - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp type SecurityGroupRulePrototype struct { - // The direction of traffic to enforce. + // The direction of traffic to allow. Direction *string `json:"direction" validate:"required"` - // The IP version to enforce. The format of `local.address`, `remote.address`, + // The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. + // If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP + // version. IPVersion *string `json:"ip_version,omitempty"` // The local IP address or range of local IP addresses to which this rule will allow inbound @@ -81159,7 +86382,7 @@ type SecurityGroupRulePrototype struct { // addresses (or from all local IP addresses, for outbound rules). Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` - // The protocol to enforce. + // The protocol to allow. Protocol *string `json:"protocol" validate:"required"` // The remote IP addresses or security groups from which this rule will allow traffic (or to @@ -81194,24 +86417,24 @@ type SecurityGroupRulePrototype struct { } // Constants associated with the SecurityGroupRulePrototype.Direction property. -// The direction of traffic to enforce. +// The direction of traffic to allow. const ( SecurityGroupRulePrototypeDirectionInboundConst = "inbound" SecurityGroupRulePrototypeDirectionOutboundConst = "outbound" ) // Constants associated with the SecurityGroupRulePrototype.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, +// The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. +// If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP +// version. const ( SecurityGroupRulePrototypeIPVersionIpv4Const = "ipv4" ) // Constants associated with the SecurityGroupRulePrototype.Protocol property. -// The protocol to enforce. +// The protocol to allow. const ( SecurityGroupRulePrototypeProtocolAllConst = "all" SecurityGroupRulePrototypeProtocolIcmpConst = "icmp" @@ -81229,42 +86452,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 } @@ -81391,6 +86625,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. @@ -81425,6 +86660,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. // @@ -81500,14 +86757,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"` @@ -81519,7 +86776,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 @@ -81529,7 +86786,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 @@ -81563,42 +86820,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 @@ -81715,7 +86936,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 } @@ -82319,14 +87540,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"` @@ -82340,7 +87561,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 @@ -82350,7 +87571,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 @@ -82379,42 +87600,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. @@ -82458,14 +87643,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"` @@ -82477,7 +87662,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 @@ -82487,7 +87672,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 @@ -82521,42 +87706,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 @@ -83045,7 +88194,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"` @@ -83055,7 +88204,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"` @@ -83064,7 +88213,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 @@ -83079,7 +88228,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 @@ -83108,42 +88257,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. @@ -83164,14 +88277,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 } @@ -83403,9 +88513,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 { @@ -83522,7 +88631,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"` @@ -83615,14 +88724,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 } @@ -83632,6 +88759,9 @@ type ShareProfile struct { Capacity ShareProfileCapacityIntf `json:"capacity" validate:"required"` // The product family this share 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 URL for this share profile. @@ -83649,6 +88779,9 @@ type ShareProfile struct { // Constants associated with the ShareProfile.Family property. // The product family this share profile belongs to. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( ShareProfileFamilyDefinedPerformanceConst = "defined_performance" ) @@ -83699,7 +88832,6 @@ func UnmarshalShareProfile(m map[string]json.RawMessage, result interface{}) (er // ShareProfileCapacity : ShareProfileCapacity struct // Models which "extend" this model: // - ShareProfileCapacityFixed -// - ShareProfileCapacityRange // - ShareProfileCapacityEnum // - ShareProfileCapacityDependentRange type ShareProfileCapacity struct { @@ -83709,8 +88841,8 @@ type ShareProfileCapacity struct { // The value for this profile field. Value *int64 `json:"value,omitempty"` - // The default value for this profile field. - 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"` @@ -83720,9 +88852,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. @@ -83752,9 +88881,9 @@ func UnmarshalShareProfileCapacity(m map[string]json.RawMessage, result interfac err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "default", &obj.Default) + err = core.UnmarshalPrimitive(m, "values", &obj.Values) if err != nil { - err = core.SDKErrorf(err, "", "default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "values-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "max", &obj.Max) @@ -83772,11 +88901,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 } @@ -83784,14 +88908,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"` @@ -83803,7 +88927,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 @@ -83813,7 +88937,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 @@ -83847,42 +88971,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 @@ -83986,6 +89074,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. @@ -84005,6 +89094,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. @@ -84117,7 +89219,10 @@ 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. ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` // The source file share for this replica file share. The specified file share must not @@ -84285,9 +89390,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. - // - // For this property to be changed, the share `replication_role` must be `replica`. + // 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 @@ -84597,6 +89700,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"` @@ -84741,6 +89848,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()) @@ -84906,14 +90018,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"` @@ -84925,7 +90037,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 @@ -84935,7 +90047,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 @@ -84969,42 +90081,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. @@ -85136,14 +90212,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"` @@ -85155,7 +90231,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 @@ -85165,7 +90241,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 @@ -85199,42 +90275,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. @@ -85264,14 +90304,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 } @@ -85546,14 +90586,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 } @@ -85874,7 +90914,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 } @@ -85907,7 +90947,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 } @@ -85989,6 +91029,9 @@ type Subnet struct { RoutingTable *RoutingTableReference `json:"routing_table" validate:"required"` // The status of the subnet. + // + // 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 total number of IPv4 addresses in this subnet. @@ -86018,6 +91061,9 @@ const ( // Constants associated with the Subnet.Status property. // The status of the subnet. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( SubnetStatusAvailableConst = "available" SubnetStatusDeletingConst = "deleting" @@ -86120,14 +91166,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"` @@ -86139,7 +91185,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 @@ -86149,7 +91195,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 @@ -86183,42 +91229,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 @@ -86241,6 +91251,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. @@ -86265,6 +91276,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. @@ -86311,14 +91338,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 } @@ -86462,6 +91495,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. @@ -86486,6 +91520,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. @@ -86553,8 +91603,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"` @@ -86633,7 +91683,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 } @@ -86661,7 +91711,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 } @@ -86696,7 +91746,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 } @@ -86747,7 +91797,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 } @@ -86801,7 +91851,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 } @@ -86849,7 +91899,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 } @@ -86897,7 +91947,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 } @@ -86942,7 +91992,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 } @@ -86972,6 +92022,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. @@ -86983,7 +92265,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 } @@ -87028,7 +92310,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 } @@ -87066,7 +92348,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 } @@ -87104,7 +92386,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 } @@ -87142,7 +92424,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 } @@ -87179,7 +92461,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 } @@ -87217,7 +92499,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 } @@ -87255,7 +92537,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 } @@ -87296,7 +92578,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 } @@ -87341,7 +92623,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 } @@ -87371,6 +92653,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. @@ -87382,7 +92712,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 } @@ -87433,7 +92763,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 } @@ -87488,7 +92818,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 } @@ -87539,7 +92869,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 } @@ -87594,7 +92924,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 } @@ -87639,7 +92969,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 } @@ -87680,7 +93010,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 } @@ -87728,7 +93058,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 } @@ -87777,7 +93107,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 } @@ -87821,7 +93151,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 } @@ -87862,7 +93192,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 } @@ -87907,7 +93237,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 } @@ -87945,7 +93275,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 } @@ -87986,7 +93316,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 } @@ -88037,7 +93367,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 } @@ -88098,7 +93428,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 } @@ -88161,7 +93491,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 } @@ -88211,7 +93541,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 } @@ -88266,7 +93596,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 } @@ -88311,7 +93641,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 } @@ -88352,7 +93682,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 } @@ -88397,7 +93727,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 } @@ -88438,7 +93768,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 } @@ -88483,7 +93813,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 } @@ -88521,7 +93851,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 } @@ -88559,7 +93889,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 } @@ -88597,7 +93927,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 } @@ -88638,7 +93968,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 } @@ -88686,7 +94016,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 } @@ -88735,7 +94065,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 } @@ -88783,7 +94113,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 } @@ -88831,7 +94161,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 } @@ -88875,7 +94205,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 } @@ -88916,7 +94246,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 } @@ -88961,7 +94291,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 } @@ -89003,7 +94333,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 } @@ -89050,7 +94380,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 } @@ -89098,7 +94428,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 } @@ -89147,7 +94477,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 } @@ -89194,7 +94524,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 } @@ -89246,7 +94576,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 } @@ -89303,7 +94633,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 } @@ -89358,7 +94688,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 } @@ -89403,7 +94733,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 } @@ -89445,7 +94775,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 } @@ -89492,7 +94822,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 } @@ -89622,6 +94952,9 @@ type VPC struct { ResourceType *string `json:"resource_type" validate:"required"` // The status of this VPC. + // + // 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"` } @@ -89648,6 +94981,9 @@ const ( // Constants associated with the VPC.Status property. // The status of this VPC. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPCStatusAvailableConst = "available" VPCStatusDeletingConst = "deleting" @@ -89771,14 +95107,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"` @@ -89790,7 +95126,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 @@ -89800,7 +95136,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 @@ -89834,42 +95170,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. @@ -89934,6 +95234,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, @@ -90102,14 +95415,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"` @@ -90123,7 +95436,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 @@ -90133,7 +95446,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 @@ -90223,14 +95536,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 } @@ -90470,6 +95780,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 @@ -90561,6 +95891,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. @@ -90585,6 +95916,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. @@ -90700,14 +96047,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 } @@ -91142,14 +96489,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"` @@ -91161,7 +96508,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 @@ -91171,7 +96518,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 @@ -91205,42 +96552,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 @@ -91249,7 +96560,10 @@ type VPNGatewayConnection struct { // If set to false, the VPN gateway connection is shut down. AdminStateUp *bool `json:"admin_state_up" validate:"required"` - // The authentication mode. Only `psk` is currently supported. + // The authentication mode. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AuthenticationMode *string `json:"authentication_mode" validate:"required"` // The date and time that this VPN gateway connection was created. @@ -91282,6 +96596,9 @@ type VPNGatewayConnection struct { IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` // The mode of the VPN gateway. + // + // 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 name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. @@ -91299,6 +96616,11 @@ type VPNGatewayConnection struct { // The reasons for the current VPN gateway connection status (if any). StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + // Indicates whether the traffic is distributed between the `up` tunnels of the VPN gateway connection when the VPC + // route's next hop is a VPN connection. If `false`, the traffic is only routed through the `up` tunnel with the lower + // `public_ip` address. + DistributeTraffic *bool `json:"distribute_traffic,omitempty"` + Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local,omitempty"` Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer,omitempty"` @@ -91311,7 +96633,10 @@ type VPNGatewayConnection struct { } // Constants associated with the VPNGatewayConnection.AuthenticationMode property. -// The authentication mode. Only `psk` is currently supported. +// The authentication mode. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionAuthenticationModePskConst = "psk" ) @@ -91331,6 +96656,9 @@ const ( // Constants associated with the VPNGatewayConnection.Mode property. // The mode of the VPN gateway. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionModePolicyConst = "policy" VPNGatewayConnectionModeRouteConst = "route" @@ -91418,14 +96746,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"` @@ -91439,7 +96767,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 @@ -91449,7 +96777,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 @@ -91478,42 +96806,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. @@ -91600,6 +96892,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. @@ -91764,6 +97072,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. @@ -91783,6 +97092,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: @@ -91840,6 +97162,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. @@ -91859,6 +97182,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: @@ -91905,6 +97241,15 @@ type VPNGatewayConnectionPatch struct { // The Dead Peer Detection settings. DeadPeerDetection *VPNGatewayConnectionDpdPatch `json:"dead_peer_detection,omitempty"` + // Indicates whether the traffic is distributed between the `up` tunnels of the VPN gateway connection when the VPC + // route's next hop is a VPN connection. If `false`, the traffic is only routed through the `up` tunnel with the lower + // `public_ip` address. Before enabling it on VPN connections to on-prem private networks, review + // [distributing traffic + // restrictions](https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-limitations#distributing-traffic-restrictions). + // + // If specified, `mode` must be `route`. + DistributeTraffic *bool `json:"distribute_traffic,omitempty"` + // The establish mode of the VPN gateway connection: // - `bidirectional`: Either side of the VPN gateway can initiate IKE protocol // negotiations or rekeying processes. @@ -91957,6 +97302,11 @@ func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result int err = core.SDKErrorf(err, "", "dead_peer_detection-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "distribute_traffic", &obj.DistributeTraffic) + if err != nil { + err = core.SDKErrorf(err, "", "distribute_traffic-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "establish_mode", &obj.EstablishMode) if err != nil { err = core.SDKErrorf(err, "", "establish_mode-error", common.GetComponentInfo()) @@ -91993,14 +97343,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 } @@ -92022,6 +97393,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. @@ -92041,6 +97413,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. @@ -92275,6 +97660,13 @@ type VPNGatewayConnectionPrototype struct { // The pre-shared key. Psk *string `json:"psk" validate:"required"` + // Indicates whether the traffic is distributed between the `up` tunnels of the VPN gateway connection when the VPC + // route's next hop is a VPN connection. If `false`, the traffic is only routed through the `up` tunnel with the lower + // `public_ip` address. Before enabling it on VPN connections to on-prem private networks, review + // [distributing traffic + // restrictions](https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-limitations#distributing-traffic-restrictions). + DistributeTraffic *bool `json:"distribute_traffic,omitempty"` + Local *VPNGatewayConnectionStaticRouteModeLocalPrototype `json:"local,omitempty"` Peer VPNGatewayConnectionStaticRouteModePeerPrototypeIntf `json:"peer,omitempty"` @@ -92348,6 +97740,11 @@ func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "distribute_traffic", &obj.DistributeTraffic) + if err != nil { + err = core.SDKErrorf(err, "", "distribute_traffic-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype) if err != nil { err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) @@ -92586,6 +97983,9 @@ type VPNGatewayConnectionStaticRouteModeTunnel struct { PublicIP *IP `json:"public_ip" validate:"required"` // The status of the VPN Tunnel. + // + // 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). @@ -92594,6 +97994,9 @@ type VPNGatewayConnectionStaticRouteModeTunnel struct { // Constants associated with the VPNGatewayConnectionStaticRouteModeTunnel.Status property. // The status of the VPN Tunnel. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionStaticRouteModeTunnelStatusDownConst = "down" VPNGatewayConnectionStaticRouteModeTunnelStatusUpConst = "up" @@ -92891,6 +98294,9 @@ type VPNGatewayMember struct { PublicIP *IP `json:"public_ip" validate:"required"` // The high availability role assigned to the VPN gateway member. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Role *string `json:"role" validate:"required"` } @@ -92923,6 +98329,9 @@ const ( // Constants associated with the VPNGatewayMember.Role property. // The high availability role assigned to the VPN gateway member. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayMemberRoleActiveConst = "active" VPNGatewayMemberRoleStandbyConst = "standby" @@ -93096,14 +98505,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 } @@ -93241,7 +98647,10 @@ type VPNServer struct { // The reserved IPs bound to this VPN server. PrivateIps []ReservedIPReference `json:"private_ips" validate:"required"` - // The transport protocol used by this VPN server. + // The transport protocol to use for this VPN server. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Protocol *string `json:"protocol" validate:"required"` // The resource group for this VPN server. @@ -93288,7 +98697,10 @@ const ( ) // Constants associated with the VPNServer.Protocol property. -// The transport protocol used by this VPN server. +// The transport protocol to use for this VPN server. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerProtocolTCPConst = "tcp" VPNServerProtocolUDPConst = "udp" @@ -93443,6 +98855,9 @@ func UnmarshalVPNServer(m map[string]json.RawMessage, result interface{}) (err e // - VPNServerAuthenticationByCertificate type VPNServerAuthentication struct { // The type of authentication. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Method *string `json:"method" validate:"required"` // The type of identity provider to be used by VPN client. @@ -93457,6 +98872,9 @@ type VPNServerAuthentication struct { // Constants associated with the VPNServerAuthentication.Method property. // The type of authentication. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerAuthenticationMethodCertificateConst = "certificate" VPNServerAuthenticationMethodUsernameConst = "username" @@ -93525,6 +98943,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. @@ -93539,6 +98958,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 @@ -93570,6 +98999,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. @@ -93603,6 +99033,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`. @@ -93736,14 +99185,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"` @@ -93757,7 +99206,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 @@ -93767,7 +99216,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 @@ -93796,53 +99245,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"` @@ -93854,7 +99267,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 @@ -93864,7 +99277,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 @@ -93898,42 +99311,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: @@ -94096,7 +99473,7 @@ type VPNServerPatch struct { // The port number used by this VPN server. Port *int64 `json:"port,omitempty"` - // The transport protocol used by this VPN server. + // The transport protocol to use for this VPN server. Protocol *string `json:"protocol,omitempty"` // The subnets to provision this VPN server in (replacing the existing subnets). @@ -94104,7 +99481,7 @@ type VPNServerPatch struct { } // Constants associated with the VPNServerPatch.Protocol property. -// The transport protocol used by this VPN server. +// The transport protocol to use for this VPN server. const ( VPNServerPatchProtocolTCPConst = "tcp" VPNServerPatchProtocolUDPConst = "udp" @@ -94169,14 +99546,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 } @@ -94343,14 +99756,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"` @@ -94362,7 +99775,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 @@ -94372,7 +99785,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 @@ -94406,42 +99819,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: @@ -94563,14 +99940,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 } @@ -94806,14 +100180,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"` @@ -94825,7 +100199,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 @@ -94835,7 +100209,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 @@ -94869,42 +100243,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 @@ -94998,30 +100336,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" @@ -95062,14 +100408,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 } @@ -95639,9 +100994,15 @@ type VolumeAttachment struct { Name *string `json:"name" validate:"required"` // The status of this volume attachment. + // + // 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 type of volume attachment. + // + // 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 attached volume. @@ -95652,6 +101013,9 @@ type VolumeAttachment struct { // Constants associated with the VolumeAttachment.Status property. // The status of this volume attachment. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VolumeAttachmentStatusAttachedConst = "attached" VolumeAttachmentStatusAttachingConst = "attaching" @@ -95661,6 +101025,9 @@ const ( // Constants associated with the VolumeAttachment.Type property. // The type of volume attachment. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VolumeAttachmentTypeBootConst = "boot" VolumeAttachmentTypeDataConst = "data" @@ -95744,7 +101111,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. @@ -95787,14 +101154,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 } @@ -96194,11 +101561,17 @@ type VolumeAttachmentReferenceVolumeContext struct { Name *string `json:"name" validate:"required"` // The type of volume attachment. + // + // 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"` } // Constants associated with the VolumeAttachmentReferenceVolumeContext.Type property. // The type of volume attachment. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VolumeAttachmentReferenceVolumeContextTypeBootConst = "boot" VolumeAttachmentReferenceVolumeContextTypeDataConst = "data" @@ -96284,14 +101657,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"` @@ -96303,7 +101676,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 @@ -96313,7 +101686,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 @@ -96347,42 +101720,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. @@ -96539,14 +101876,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 } @@ -96892,14 +102238,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"` @@ -96911,7 +102257,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 @@ -96921,7 +102267,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 @@ -96955,42 +102301,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 @@ -97094,6 +102404,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. @@ -97113,6 +102424,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. @@ -97630,42 +102954,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. @@ -97790,6 +103078,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. @@ -97809,6 +103098,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. @@ -98853,6 +104155,9 @@ type BareMetalServerNetworkAttachmentByPci struct { Subnet *SubnetReference `json:"subnet" validate:"required"` // 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. Type *string `json:"type" validate:"required"` // The virtual network interface for this bare metal server network attachment. @@ -98889,6 +104194,9 @@ const ( // Constants associated with the BareMetalServerNetworkAttachmentByPci.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 ( BareMetalServerNetworkAttachmentByPciTypePrimaryConst = "primary" BareMetalServerNetworkAttachmentByPciTypeSecondaryConst = "secondary" @@ -99012,6 +104320,9 @@ type BareMetalServerNetworkAttachmentByVlan struct { Subnet *SubnetReference `json:"subnet" validate:"required"` // 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. Type *string `json:"type" validate:"required"` // The virtual network interface for this bare metal server network attachment. @@ -99059,6 +104370,9 @@ const ( // Constants associated with the BareMetalServerNetworkAttachmentByVlan.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 ( BareMetalServerNetworkAttachmentByVlanTypePrimaryConst = "primary" BareMetalServerNetworkAttachmentByVlanTypeSecondaryConst = "secondary" @@ -99583,7 +104897,7 @@ type BareMetalServerNetworkInterfaceByHiperSocket struct { ID *string `json:"id" 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 an empty string. + // 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 @@ -99830,7 +105144,7 @@ type BareMetalServerNetworkInterfaceByPci struct { ID *string `json:"id" 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 an empty string. + // 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 @@ -100096,7 +105410,7 @@ type BareMetalServerNetworkInterfaceByVlan struct { ID *string `json:"id" 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 an empty string. + // 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 @@ -102466,6 +107780,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 { @@ -102536,6 +107860,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 { @@ -102571,6 +108370,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 { @@ -102605,6 +108414,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 { @@ -103476,6 +109295,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 @@ -104050,6 +109879,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 @@ -104102,6 +109944,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 @@ -104154,6 +110009,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 @@ -105759,6 +111630,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 @@ -105861,7 +111905,10 @@ type InstanceGroupManagerActionScheduledAction struct { // - `completed`: Action was completed successfully // - `failed`: Action could not be completed successfully // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. + // - `omitted`: Action was not applied because this action's manager was disabled + // + // 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 date and time that the instance group manager action was updated. @@ -105898,7 +111945,10 @@ const ( // - `completed`: Action was completed successfully // - `failed`: Action could not be completed successfully // - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. +// - `omitted`: Action was not applied because this action's manager was disabled +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceGroupManagerActionScheduledActionStatusActiveConst = "active" InstanceGroupManagerActionScheduledActionStatusCompletedConst = "completed" @@ -106221,18 +112271,27 @@ type InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy struct { // The date and time that the instance group manager policy was updated. UpdatedAt *strfmt.DateTime `json:"updated_at" validate:"required"` - // The type of metric to be evaluated. + // The type of metric to be evaluated + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. MetricType *string `json:"metric_type" validate:"required"` // The metric value to be evaluated. MetricValue *int64 `json:"metric_value" validate:"required"` - // The type of policy for the instance group. + // The type of policy for the instance group + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. PolicyType *string `json:"policy_type" validate:"required"` } // Constants associated with the InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy.MetricType property. -// The type of metric to be evaluated. +// The type of metric to be evaluated +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeCpuConst = "cpu" InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeMemoryConst = "memory" @@ -106241,7 +112300,10 @@ const ( ) // Constants associated with the InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy.PolicyType property. -// The type of policy for the instance group. +// The type of policy for the instance group +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyPolicyTypeTargetConst = "target" ) @@ -106898,6 +112960,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 { @@ -106933,6 +113005,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 @@ -106985,6 +113067,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 @@ -107037,6 +113135,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 @@ -107579,6 +113693,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 { @@ -109147,6 +115387,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. @@ -109276,6 +115521,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()) @@ -109396,6 +115646,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. @@ -109519,6 +115774,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()) @@ -109637,6 +115897,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. @@ -109757,6 +116022,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()) @@ -109873,6 +116143,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. @@ -110013,6 +116288,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()) @@ -110141,6 +116421,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. @@ -110261,6 +116546,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()) @@ -110400,6 +116690,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 { @@ -110435,6 +116735,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 { @@ -110470,6 +116780,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 @@ -110479,6 +116799,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. @@ -110606,6 +116931,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()) @@ -110726,6 +117056,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. @@ -110847,6 +117182,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()) @@ -110965,6 +117305,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. @@ -111083,6 +117428,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()) @@ -111199,6 +117549,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. @@ -111337,6 +117692,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()) @@ -111465,6 +117825,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. @@ -111604,6 +117969,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()) @@ -111742,6 +118112,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. @@ -111875,6 +118250,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()) @@ -112013,6 +118393,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. @@ -112143,6 +118528,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()) @@ -112478,6 +118868,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 { @@ -112513,6 +118913,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 { @@ -112548,6 +118958,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 { @@ -112583,6 +119003,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 { @@ -112618,6 +119048,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 { @@ -112653,6 +119093,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 { @@ -112688,6 +119138,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 { @@ -112727,6 +119187,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 { @@ -112774,6 +119250,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 @@ -112817,6 +119306,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 { @@ -113140,6 +119642,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 { @@ -113175,6 +119687,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 { @@ -113213,6 +119735,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 @@ -113265,6 +119797,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 { @@ -113867,6 +120415,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 { @@ -113902,6 +120460,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 { @@ -113937,6 +120505,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 { @@ -114092,6 +120670,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 { @@ -114127,6 +120715,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 { @@ -114231,7 +120829,7 @@ type NetworkACLRuleItemNetworkACLRuleProtocolAll struct { // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. Source *string `json:"source" validate:"required"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` } @@ -114256,7 +120854,7 @@ const ( ) // Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRuleItemNetworkACLRuleProtocolAllProtocolAllConst = "all" ) @@ -114366,7 +120964,7 @@ type NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct { // If absent, all codes are matched. Code *int64 `json:"code,omitempty"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The ICMP traffic type to match. @@ -114396,7 +120994,7 @@ const ( ) // Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRuleItemNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" ) @@ -114517,7 +121115,7 @@ type NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct { // The inclusive lower bound of TCP/UDP destination port range. DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The inclusive upper bound of TCP/UDP source port range. @@ -114548,7 +121146,7 @@ const ( ) // Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" @@ -114662,7 +121260,7 @@ type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. Source *string `json:"source" validate:"required"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` } @@ -114687,7 +121285,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototype.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" ) @@ -114781,7 +121379,7 @@ type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype // If specified, `type` must also be specified. If unspecified, all codes are matched. Code *int64 `json:"code,omitempty"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The ICMP traffic type to match. @@ -114811,7 +121409,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototype.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" ) @@ -114916,7 +121514,7 @@ type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototy // The inclusive lower bound of TCP/UDP destination port range. DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The inclusive upper bound of TCP/UDP source port range. @@ -114947,7 +121545,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototype.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" @@ -115059,7 +121657,7 @@ type NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype struct { // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. Source *string `json:"source" validate:"required"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` } @@ -115084,7 +121682,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototype.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRulePrototypeNetworkACLRuleProtocolAllPrototypeProtocolAllConst = "all" ) @@ -115185,7 +121783,7 @@ type NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype struct { // If specified, `type` must also be specified. If unspecified, all codes are matched. Code *int64 `json:"code,omitempty"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The ICMP traffic type to match. @@ -115215,7 +121813,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototype.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpPrototypeProtocolIcmpConst = "icmp" ) @@ -115327,7 +121925,7 @@ type NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype struct { // The inclusive lower bound of TCP/UDP destination port range. DestinationPortMin *int64 `json:"destination_port_min,omitempty"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The inclusive upper bound of TCP/UDP source port range. @@ -115358,7 +121956,7 @@ const ( ) // Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototype.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolTCPConst = "tcp" NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpPrototypeProtocolUDPConst = "udp" @@ -115484,7 +122082,7 @@ type NetworkACLRuleNetworkACLRuleProtocolAll struct { // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. Source *string `json:"source" validate:"required"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` } @@ -115509,7 +122107,7 @@ const ( ) // Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRuleNetworkACLRuleProtocolAllProtocolAllConst = "all" ) @@ -115618,7 +122216,7 @@ type NetworkACLRuleNetworkACLRuleProtocolIcmp struct { // If absent, all codes are matched. Code *int64 `json:"code,omitempty"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The ICMP traffic type to match. @@ -115648,7 +122246,7 @@ const ( ) // Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRuleNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" ) @@ -115768,7 +122366,7 @@ type NetworkACLRuleNetworkACLRuleProtocolTcpudp struct { // The inclusive lower bound of TCP/UDP destination port range. DestinationPortMin *int64 `json:"destination_port_min" validate:"required"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The inclusive upper bound of TCP/UDP source port range. @@ -115799,7 +122397,7 @@ const ( ) // Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. +// The network protocol. const ( NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" @@ -116282,6 +122880,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 { @@ -116317,6 +122925,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 { @@ -116352,6 +122970,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 { @@ -116387,6 +123015,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 { @@ -116422,6 +123060,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 @@ -117294,6 +123942,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 @@ -117337,6 +123995,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 @@ -117515,6 +124186,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 { @@ -117550,6 +124231,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 { @@ -117585,6 +124276,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 { @@ -117728,6 +124429,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 { @@ -117766,6 +124477,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 { @@ -117897,14 +124618,14 @@ func UnmarshalSecurityGroupRuleLocalIP(m map[string]json.RawMessage, result inte // SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. // This model "extends" SecurityGroupRulePrototype type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { - // The direction of traffic to enforce. + // The direction of traffic to allow. Direction *string `json:"direction" validate:"required"` - // The IP version to enforce. The format of `local.address`, `remote.address`, + // The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. + // If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP + // version. IPVersion *string `json:"ip_version,omitempty"` // The local IP address or range of local IP addresses to which this rule will allow inbound @@ -117914,7 +124635,7 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { // addresses (or from all local IP addresses, for outbound rules). Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The remote IP addresses or security groups from which this rule will allow traffic (or to @@ -117927,24 +124648,24 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { } // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Direction property. -// The direction of traffic to enforce. +// The direction of traffic to allow. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, +// The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. +// If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP +// version. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Protocol property. -// The protocol to enforce. +// The network protocol. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllProtocolAllConst = "all" ) @@ -118006,14 +124727,14 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { // If specified, `type` must also be specified. If unspecified, all codes are allowed. Code *int64 `json:"code,omitempty"` - // The direction of traffic to enforce. + // The direction of traffic to allow. Direction *string `json:"direction" validate:"required"` - // The IP version to enforce. The format of `local.address`, `remote.address`, + // The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. + // If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP + // version. IPVersion *string `json:"ip_version,omitempty"` // The local IP address or range of local IP addresses to which this rule will allow inbound @@ -118023,7 +124744,7 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { // addresses (or from all local IP addresses, for outbound rules). Local SecurityGroupRuleLocalPrototypeIntf `json:"local,omitempty"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The remote IP addresses or security groups from which this rule will allow traffic (or to @@ -118041,24 +124762,24 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { } // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Direction property. -// The direction of traffic to enforce. +// The direction of traffic to allow. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, +// The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. +// If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP +// version. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Protocol property. -// The protocol to enforce. +// The network protocol. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" ) @@ -118128,14 +124849,14 @@ func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[stri // allowed for the protocol. When both have the same value, that single destination port is allowed. // This model "extends" SecurityGroupRulePrototype type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { - // The direction of traffic to enforce. + // The direction of traffic to allow. Direction *string `json:"direction" validate:"required"` - // The IP version to enforce. The format of `local.address`, `remote.address`, + // The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. + // If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP + // version. IPVersion *string `json:"ip_version,omitempty"` // The local IP address or range of local IP addresses to which this rule will allow inbound @@ -118157,7 +124878,7 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { // unspecified, allowing traffic on all destination ports. PortMin *int64 `json:"port_min,omitempty"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The remote IP addresses or security groups from which this rule will allow traffic (or to @@ -118170,24 +124891,24 @@ type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { } // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Direction property. -// The direction of traffic to enforce. +// The direction of traffic to allow. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, +// The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. +// If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP +// version. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" ) // Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. +// The network protocol. const ( SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" @@ -118290,6 +125011,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 { @@ -118328,6 +125059,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 @@ -118380,6 +125121,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 { @@ -118619,7 +125376,7 @@ func UnmarshalSecurityGroupRuleRemoteSecurityGroupReference(m map[string]json.Ra // SecurityGroupRuleSecurityGroupRuleProtocolAll : A rule allowing traffic for all supported protocols. // This model "extends" SecurityGroupRule type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { - // The direction of traffic to enforce. + // The direction of traffic to allow. Direction *string `json:"direction" validate:"required"` // The URL for this security group rule. @@ -118628,40 +125385,40 @@ type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { // The unique identifier for this security group rule. ID *string `json:"id" validate:"required"` - // The IP version to enforce. The format of `local.address`, `remote.address`, + // The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. + // If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP + // version. IPVersion *string `json:"ip_version" validate:"required"` Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` } // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Direction property. -// The direction of traffic to enforce. +// The direction of traffic to allow. const ( SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, +// The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. +// If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP +// version. const ( SecurityGroupRuleSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Protocol property. -// The protocol to enforce. +// The network protocol. const ( SecurityGroupRuleSecurityGroupRuleProtocolAllProtocolAllConst = "all" ) @@ -118715,7 +125472,7 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.Ra // SecurityGroupRuleSecurityGroupRuleProtocolIcmp : A rule specifying the ICMP traffic to allow. // This model "extends" SecurityGroupRule type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { - // The direction of traffic to enforce. + // The direction of traffic to allow. Direction *string `json:"direction" validate:"required"` // The URL for this security group rule. @@ -118724,11 +125481,11 @@ type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { // The unique identifier for this security group rule. ID *string `json:"id" validate:"required"` - // The IP version to enforce. The format of `local.address`, `remote.address`, + // The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. + // If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP + // version. IPVersion *string `json:"ip_version" validate:"required"` Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` @@ -118738,7 +125495,7 @@ type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { // The ICMP traffic code to allow. If absent, all codes are allowed. Code *int64 `json:"code,omitempty"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` // The ICMP traffic type to allow. If absent, all types are allowed. @@ -118746,24 +125503,24 @@ type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { } // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Direction property. -// The direction of traffic to enforce. +// The direction of traffic to allow. const ( SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, +// The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. +// If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP +// version. const ( SecurityGroupRuleSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Protocol property. -// The protocol to enforce. +// The network protocol. const ( SecurityGroupRuleSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" ) @@ -118830,7 +125587,7 @@ func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.R // allowed for the protocol. When both have the same value, that single destination port is allowed. // This model "extends" SecurityGroupRule type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { - // The direction of traffic to enforce. + // The direction of traffic to allow. Direction *string `json:"direction" validate:"required"` // The URL for this security group rule. @@ -118839,11 +125596,11 @@ type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { // The unique identifier for this security group rule. ID *string `json:"id" validate:"required"` - // The IP version to enforce. The format of `local.address`, `remote.address`, + // The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // - // If `remote` references a security group, then this rule only applies to IP addresses - // (network interfaces) in that group matching this IP version. + // If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP + // version. IPVersion *string `json:"ip_version" validate:"required"` Local SecurityGroupRuleLocalIntf `json:"local" validate:"required"` @@ -118856,29 +125613,29 @@ type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { // The inclusive lower bound of TCP/UDP destination port range. PortMin *int64 `json:"port_min,omitempty"` - // The protocol to enforce. + // The network protocol. Protocol *string `json:"protocol" validate:"required"` } // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Direction property. -// The direction of traffic to enforce. +// The direction of traffic to allow. const ( SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.IPVersion property. -// The IP version to enforce. The format of `local.address`, `remote.address`, +// The IP version to allow. The format of `local.address`, `remote.address`, // `local.cidr_block` or `remote.cidr_block` must match this property, if they are used. // -// If `remote` references a security group, then this rule only applies to IP addresses -// (network interfaces) in that group matching this IP version. +// If `remote` references a security group, then this rule only applies to IP addresses in that group matching this IP +// version. const ( SecurityGroupRuleSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" ) // Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Protocol property. -// The protocol to enforce. +// The network protocol. const ( SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" @@ -119894,9 +126651,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 { @@ -120016,9 +126772,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 *int64 `json:"default" validate:"required"` - // The type for this profile field. Type *string `json:"type" validate:"required"` @@ -120039,11 +126792,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()) @@ -120095,67 +126843,6 @@ func UnmarshalShareProfileCapacityFixed(m map[string]json.RawMessage, result int return } -// ShareProfileCapacityRange : The permitted total capacity range (in gigabytes) of a share with this profile. -// This model "extends" ShareProfileCapacity -type ShareProfileCapacityRange struct { - // The default value for this profile field. - Default *int64 `json:"default" validate:"required"` - - // The maximum value for this profile field. - Max *int64 `json:"max" validate:"required"` - - // The minimum value for this profile field. - Min *int64 `json:"min" validate:"required"` - - // The increment step value for this profile field. - Step *int64 `json:"step" validate:"required"` - - // The type for this profile field. - Type *string `json:"type" validate:"required"` -} - -// Constants associated with the ShareProfileCapacityRange.Type property. -// The type for this profile field. -const ( - ShareProfileCapacityRangeTypeRangeConst = "range" -) - -func (*ShareProfileCapacityRange) isaShareProfileCapacity() bool { - return true -} - -// UnmarshalShareProfileCapacityRange unmarshals an instance of ShareProfileCapacityRange from the specified map of raw messages. -func UnmarshalShareProfileCapacityRange(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ShareProfileCapacityRange) - 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, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // ShareProfileIopsDependentRange : The permitted IOPS range of a share with this profile depends on its configuration. // This model "extends" ShareProfileIops type ShareProfileIopsDependentRange struct { @@ -120387,6 +127074,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 { @@ -120422,6 +127119,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 @@ -120738,7 +127445,10 @@ 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. ReplicationCronSpec *string `json:"replication_cron_spec" validate:"required"` // The resource group to use. If unspecified, the resource group from @@ -121207,6 +127917,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 { @@ -121242,6 +127962,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 { @@ -121277,6 +128007,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 { @@ -121538,6 +128278,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 { @@ -121573,6 +128323,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 { @@ -121608,16 +128368,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") @@ -121627,13 +128397,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()) @@ -121643,16 +128413,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") @@ -121662,13 +128432,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()) @@ -122015,6 +128785,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 { @@ -122050,6 +128830,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 { @@ -122085,6 +128875,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 { @@ -122621,6 +129421,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 { @@ -122656,6 +129466,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 { @@ -122761,6 +129581,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 { @@ -122796,6 +129626,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 { @@ -122910,6 +129750,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: @@ -122954,13 +129807,29 @@ 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 { // If set to false, the VPN gateway connection is shut down. AdminStateUp *bool `json:"admin_state_up" validate:"required"` - // The authentication mode. Only `psk` is currently supported. + // The authentication mode. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AuthenticationMode *string `json:"authentication_mode" validate:"required"` // The date and time that this VPN gateway connection was created. @@ -122992,6 +129861,9 @@ type VPNGatewayConnectionPolicyMode struct { IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` // The mode of the VPN gateway. + // + // 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 name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. @@ -123015,7 +129887,10 @@ type VPNGatewayConnectionPolicyMode struct { } // Constants associated with the VPNGatewayConnectionPolicyMode.AuthenticationMode property. -// The authentication mode. Only `psk` is currently supported. +// The authentication mode. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionPolicyModeAuthenticationModePskConst = "psk" ) @@ -123035,6 +129910,9 @@ const ( // Constants associated with the VPNGatewayConnectionPolicyMode.Mode property. // The mode of the VPN gateway. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionPolicyModeModePolicyConst = "policy" VPNGatewayConnectionPolicyModeModeRouteConst = "route" @@ -123513,6 +130391,13 @@ type VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype s // The pre-shared key. Psk *string `json:"psk" validate:"required"` + // Indicates whether the traffic is distributed between the `up` tunnels of the VPN gateway connection when the VPC + // route's next hop is a VPN connection. If `false`, the traffic is only routed through the `up` tunnel with the lower + // `public_ip` address. Before enabling it on VPN connections to on-prem private networks, review + // [distributing traffic + // restrictions](https://cloud.ibm.com/docs/vpc?topic=vpc-vpn-limitations#distributing-traffic-restrictions). + DistributeTraffic *bool `json:"distribute_traffic,omitempty"` + Local *VPNGatewayConnectionStaticRouteModeLocalPrototype `json:"local,omitempty"` Peer VPNGatewayConnectionStaticRouteModePeerPrototypeIntf `json:"peer" validate:"required"` @@ -123595,6 +130480,11 @@ func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePr err = core.SDKErrorf(err, "", "psk-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "distribute_traffic", &obj.DistributeTraffic) + if err != nil { + err = core.SDKErrorf(err, "", "distribute_traffic-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocalPrototype) if err != nil { err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) @@ -123622,7 +130512,10 @@ type VPNGatewayConnectionRouteMode struct { // If set to false, the VPN gateway connection is shut down. AdminStateUp *bool `json:"admin_state_up" validate:"required"` - // The authentication mode. Only `psk` is currently supported. + // The authentication mode. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AuthenticationMode *string `json:"authentication_mode" validate:"required"` // The date and time that this VPN gateway connection was created. @@ -123654,6 +130547,9 @@ type VPNGatewayConnectionRouteMode struct { IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` // The mode of the VPN gateway. + // + // 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 name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. @@ -123671,6 +130567,11 @@ type VPNGatewayConnectionRouteMode struct { // The reasons for the current VPN gateway connection status (if any). StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + // Indicates whether the traffic is distributed between the `up` tunnels of the VPN gateway connection when the VPC + // route's next hop is a VPN connection. If `false`, the traffic is only routed through the `up` tunnel with the lower + // `public_ip` address. + DistributeTraffic *bool `json:"distribute_traffic,omitempty"` + Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local,omitempty"` Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer,omitempty"` @@ -123683,7 +130584,10 @@ type VPNGatewayConnectionRouteMode struct { } // Constants associated with the VPNGatewayConnectionRouteMode.AuthenticationMode property. -// The authentication mode. Only `psk` is currently supported. +// The authentication mode. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionRouteModeAuthenticationModePskConst = "psk" ) @@ -123703,6 +130607,9 @@ const ( // Constants associated with the VPNGatewayConnectionRouteMode.Mode property. // The mode of the VPN gateway. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionRouteModeModePolicyConst = "policy" VPNGatewayConnectionRouteModeModeRouteConst = "route" @@ -124458,6 +131365,9 @@ func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface // This model "extends" VPNServerAuthentication type VPNServerAuthenticationByCertificate struct { // The type of authentication. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Method *string `json:"method" validate:"required"` // The certificate instance used for the VPN client certificate authority (CA). @@ -124469,6 +131379,9 @@ type VPNServerAuthenticationByCertificate struct { // Constants associated with the VPNServerAuthenticationByCertificate.Method property. // The type of authentication. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerAuthenticationByCertificateMethodCertificateConst = "certificate" VPNServerAuthenticationByCertificateMethodUsernameConst = "username" @@ -124504,6 +131417,9 @@ func UnmarshalVPNServerAuthenticationByCertificate(m map[string]json.RawMessage, // This model "extends" VPNServerAuthentication type VPNServerAuthenticationByUsername struct { // The type of authentication. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Method *string `json:"method" validate:"required"` // The type of identity provider to be used by VPN client. @@ -124512,6 +131428,9 @@ type VPNServerAuthenticationByUsername struct { // Constants associated with the VPNServerAuthenticationByUsername.Method property. // The type of authentication. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNServerAuthenticationByUsernameMethodCertificateConst = "certificate" VPNServerAuthenticationByUsernameMethodUsernameConst = "username" @@ -124587,6 +131506,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 { @@ -124646,6 +131575,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 { @@ -124697,6 +131642,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: @@ -125922,6 +132880,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 { @@ -125957,6 +132925,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 { @@ -126198,6 +133176,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 { @@ -126233,6 +133221,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 { @@ -126389,6 +133387,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 { @@ -126510,6 +133586,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 { @@ -126554,6 +133640,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 { @@ -126597,6 +133693,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 { @@ -126641,6 +133747,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 { @@ -126680,6 +133796,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 { @@ -126719,6 +133845,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 { @@ -126758,6 +133894,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 { @@ -127682,6 +134828,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 @@ -127839,7 +135063,10 @@ type InstanceGroupManagerActionScheduledActionGroupTarget struct { // - `completed`: Action was completed successfully // - `failed`: Action could not be completed successfully // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. + // - `omitted`: Action was not applied because this action's manager was disabled + // + // 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 date and time that the instance group manager action was updated. @@ -127874,7 +135101,10 @@ const ( // - `completed`: Action was completed successfully // - `failed`: Action could not be completed successfully // - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. +// - `omitted`: Action was not applied because this action's manager was disabled +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceGroupManagerActionScheduledActionGroupTargetStatusActiveConst = "active" InstanceGroupManagerActionScheduledActionGroupTargetStatusCompletedConst = "completed" @@ -128006,7 +135236,10 @@ type InstanceGroupManagerActionScheduledActionManagerTarget struct { // - `completed`: Action was completed successfully // - `failed`: Action could not be completed successfully // - `incompatible`: Action parameters are not compatible with the group or manager - // - `omitted`: Action was not applied because this action's manager was disabled. + // - `omitted`: Action was not applied because this action's manager was disabled + // + // 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 date and time that the instance group manager action was updated. @@ -128041,7 +135274,10 @@ const ( // - `completed`: Action was completed successfully // - `failed`: Action could not be completed successfully // - `incompatible`: Action parameters are not compatible with the group or manager -// - `omitted`: Action was not applied because this action's manager was disabled. +// - `omitted`: Action was not applied because this action's manager was disabled +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceGroupManagerActionScheduledActionManagerTargetStatusActiveConst = "active" InstanceGroupManagerActionScheduledActionManagerTargetStatusCompletedConst = "completed" @@ -128407,6 +135643,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 { @@ -128446,6 +135692,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 { @@ -128485,6 +135741,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 { @@ -128524,6 +135790,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 { @@ -128563,6 +135839,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 { @@ -128602,6 +135888,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 { @@ -128959,6 +136255,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. @@ -129084,6 +136385,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()) @@ -129189,6 +136495,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. @@ -129314,6 +136625,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()) @@ -129419,6 +136735,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. @@ -129545,6 +136866,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()) @@ -129650,6 +136976,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. @@ -129776,6 +137107,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()) @@ -129881,6 +137217,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. @@ -130004,6 +137345,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()) @@ -130104,6 +137450,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. @@ -130227,6 +137578,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()) @@ -130327,6 +137683,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. @@ -130450,6 +137811,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()) @@ -130550,6 +137916,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. @@ -130673,6 +138044,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()) @@ -130773,6 +138149,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. @@ -130896,6 +138277,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()) @@ -131001,6 +138387,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. @@ -131124,6 +138515,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()) @@ -131229,6 +138625,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. @@ -131353,6 +138754,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()) @@ -131458,6 +138864,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. @@ -131582,6 +138993,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()) @@ -131687,6 +139103,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. @@ -131808,6 +139229,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()) @@ -131908,6 +139334,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. @@ -132029,6 +139460,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()) @@ -132129,6 +139565,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. @@ -132250,6 +139691,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()) @@ -132375,6 +139821,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. @@ -132496,6 +139947,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()) @@ -132621,6 +140077,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. @@ -132743,6 +140204,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()) @@ -132868,6 +140334,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. @@ -132990,6 +140461,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()) @@ -133115,6 +140591,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. @@ -133237,6 +140718,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()) @@ -133362,6 +140848,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. @@ -133487,6 +140978,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()) @@ -133650,6 +141146,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 { @@ -133689,6 +141195,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 { @@ -133806,6 +141322,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 { @@ -133845,6 +141371,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 { @@ -133884,6 +141420,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 { @@ -134394,6 +141940,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 { @@ -134440,6 +141996,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 { @@ -134479,6 +142045,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 { @@ -134518,6 +142094,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 { @@ -134723,6 +142309,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 { @@ -134762,6 +142358,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 { @@ -134801,6 +142407,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 { @@ -135062,6 +142678,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 { @@ -135089,6 +142715,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 { @@ -135116,6 +142752,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 { @@ -135143,13 +142789,26 @@ 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 { // If set to false, the VPN gateway connection is shut down. AdminStateUp *bool `json:"admin_state_up" validate:"required"` - // The authentication mode. Only `psk` is currently supported. + // The authentication mode. + // + // The enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. AuthenticationMode *string `json:"authentication_mode" validate:"required"` // The date and time that this VPN gateway connection was created. @@ -135181,6 +142840,9 @@ type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` // The mode of the VPN gateway. + // + // 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 name for this VPN gateway connection. The name is unique across all connections for the VPN gateway. @@ -135198,6 +142860,11 @@ type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { // The reasons for the current VPN gateway connection status (if any). StatusReasons []VPNGatewayConnectionStatusReason `json:"status_reasons" validate:"required"` + // Indicates whether the traffic is distributed between the `up` tunnels of the VPN gateway connection when the VPC + // route's next hop is a VPN connection. If `false`, the traffic is only routed through the `up` tunnel with the lower + // `public_ip` address. + DistributeTraffic *bool `json:"distribute_traffic" validate:"required"` + Local *VPNGatewayConnectionStaticRouteModeLocal `json:"local" validate:"required"` Peer VPNGatewayConnectionStaticRouteModePeerIntf `json:"peer" validate:"required"` @@ -135210,7 +142877,10 @@ type VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode struct { } // Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.AuthenticationMode property. -// The authentication mode. Only `psk` is currently supported. +// The authentication mode. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeAuthenticationModePskConst = "psk" ) @@ -135230,6 +142900,9 @@ const ( // Constants associated with the VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode.Mode property. // The mode of the VPN gateway. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeModePolicyConst = "policy" VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteModeModeRouteConst = "route" @@ -135340,6 +143013,11 @@ func UnmarshalVPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode(m err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "distribute_traffic", &obj.DistributeTraffic) + if err != nil { + err = core.SDKErrorf(err, "", "distribute_traffic-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalVPNGatewayConnectionStaticRouteModeLocal) if err != nil { err = core.SDKErrorf(err, "", "local-error", common.GetComponentInfo()) @@ -136381,7 +144059,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") } @@ -136414,9 +144092,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") @@ -136428,14 +144106,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 @@ -137177,6 +144855,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 @@ -139753,6 +147523,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 From 70b49975c8b96af319c68403c5150ddb978088bd Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 13 Nov 2024 14:07:31 +0530 Subject: [PATCH 097/103] SDK breaking changes --- go.mod | 2 +- go.sum | 4 ++-- ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go | 2 +- ...source_ibm_is_bare_metal_server_network_attachments.go | 4 ++-- .../vpc/data_source_ibm_is_dedicated_host_groups.go | 8 ++++---- .../vpc/data_source_ibm_is_dedicated_host_profiles.go | 8 ++++---- ibm/service/vpc/data_source_ibm_is_dedicated_hosts.go | 8 ++++---- ibm/service/vpc/data_source_ibm_is_floating_ips.go | 8 ++++---- ibm/service/vpc/data_source_ibm_is_instance_groups.go | 2 +- ibm/service/vpc/data_source_ibm_is_instance_template.go | 8 ++++---- ibm/service/vpc/data_source_ibm_is_instance_templates.go | 4 ++-- ...bm_is_private_path_service_gateway_account_policies.go | 4 ++-- ...vate_path_service_gateway_endpoint_gateway_bindings.go | 4 ++-- .../data_source_ibm_is_private_path_service_gateways.go | 4 ++-- ibm/service/vpc/data_source_ibm_is_share_profile.go | 3 --- .../data_source_ibm_is_virtual_network_interface_ips.go | 4 ++-- .../vpc/data_source_ibm_is_vpc_address_prefixes.go | 8 ++++---- ibm/service/vpc/data_source_ibm_is_vpn_server_clients.go | 8 ++++---- ibm/service/vpc/data_source_ibm_is_vpn_server_routes.go | 8 ++++---- ibm/service/vpc/data_source_ibm_is_vpn_servers.go | 8 ++++---- ibm/service/vpc/resource_ibm_is_instance_template.go | 4 ++-- 21 files changed, 55 insertions(+), 58 deletions(-) diff --git a/go.mod b/go.mod index 8f82a96e13..c1699a7c3c 100644 --- a/go.mod +++ b/go.mod @@ -240,7 +240,7 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt // add sdk changes. replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.58.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.61.0 => ./common/github.com/IBM/vpc-go-sdk exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 diff --git a/go.sum b/go.sum index 03867c5b84..fa07b51d02 100644 --- a/go.sum +++ b/go.sum @@ -154,6 +154,7 @@ github.com/IBM/go-sdk-core/v5 v5.6.3/go.mod h1:tt/B9rxLkRtglE7pvqLuYikgCXaZFL3bt github.com/IBM/go-sdk-core/v5 v5.7.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc0XQUqRO9Jc= github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= +github.com/IBM/go-sdk-core/v5 v5.17.3/go.mod h1:GatGZpxlo1KaxiRN6E10/rNgWtUtx1hN/GoHSCaSPKA= 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.0 h1:ZB3qaLEsN4fccQWzMblfXeqLx5VztiVi+HfyIqmqask= github.com/IBM/go-sdk-core/v5 v5.18.0/go.mod h1:3ywpylZ41WhWPusqtpJZWopYlt2brebcphV7mA2JncU= @@ -194,8 +195,6 @@ github.com/IBM/vmware-go-sdk v0.1.2 h1:5lKWFyInWz9e2hwGsoFTEoLa1jYkD30SReN0fQ10w github.com/IBM/vmware-go-sdk v0.1.2/go.mod h1:2UGPBJju3jiv5VKKBBm9a5L6bzF/aJdKOKAzJ7HaOjA= github.com/IBM/vpc-beta-go-sdk v0.8.0 h1:cEPpv4iw3Ba5W2d0AWg3TIbKeJ8y1nPuUuibR5Jt9eE= github.com/IBM/vpc-beta-go-sdk v0.8.0/go.mod h1:hORgIyTFRzXrZIK9IohaWmCRBBlYiDRagsufi7M6akE= -github.com/IBM/vpc-go-sdk v0.61.0 h1:VXT8ZwOQtl15/RSInj9+Z4OQC/vhE/Owoauu128BO4M= -github.com/IBM/vpc-go-sdk v0.61.0/go.mod h1:swmxiYLT+OfBsBYqJWGeRd6NPmBk4u/het2PZdtzIaw= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= @@ -914,6 +913,7 @@ github.com/hashicorp/go-retryablehttp v0.6.2/go.mod h1:gEx6HMUGxYYhJScX7W1Il64m6 github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= 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/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go b/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go index d90df6531e..e2eb690f34 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go @@ -712,7 +712,7 @@ func dataSourceBackupPolicyJobCollectionTargetSnapshotDeletedToMap(deletedItem v return deletedMap } -func dataSourceBackupPolicyJobCollectionNextToMap(nextItem vpcv1.BackupPolicyJobCollectionNext) (nextMap map[string]interface{}) { +func dataSourceBackupPolicyJobCollectionNextToMap(nextItem vpcv1.PageLink) (nextMap map[string]interface{}) { nextMap = map[string]interface{}{} if nextItem.Href != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_bare_metal_server_network_attachments.go b/ibm/service/vpc/data_source_ibm_is_bare_metal_server_network_attachments.go index ce3a6647a4..3d56ad0fd1 100644 --- a/ibm/service/vpc/data_source_ibm_is_bare_metal_server_network_attachments.go +++ b/ibm/service/vpc/data_source_ibm_is_bare_metal_server_network_attachments.go @@ -276,7 +276,7 @@ func dataSourceIBMIsBareMetalServerNetworkAttachmentsID(d *schema.ResourceData) return time.Now().UTC().String() } -func dataSourceIBMIsBareMetalServerNetworkAttachmentsBareMetalServerNetworkAttachmentCollectionFirstToMap(model *vpcv1.BareMetalServerNetworkAttachmentCollectionFirst) (map[string]interface{}, error) { +func dataSourceIBMIsBareMetalServerNetworkAttachmentsBareMetalServerNetworkAttachmentCollectionFirstToMap(model *vpcv1.PageLink) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["href"] = model.Href return modelMap, nil @@ -446,7 +446,7 @@ func dataSourceIBMIsBareMetalServerNetworkAttachmentsBareMetalServerNetworkAttac return modelMap, nil } -func dataSourceIBMIsBareMetalServerNetworkAttachmentsBareMetalServerNetworkAttachmentCollectionNextToMap(model *vpcv1.BareMetalServerNetworkAttachmentCollectionNext) (map[string]interface{}, error) { +func dataSourceIBMIsBareMetalServerNetworkAttachmentsBareMetalServerNetworkAttachmentCollectionNextToMap(model *vpcv1.PageLink) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["href"] = model.Href return modelMap, nil diff --git a/ibm/service/vpc/data_source_ibm_is_dedicated_host_groups.go b/ibm/service/vpc/data_source_ibm_is_dedicated_host_groups.go index 3d91ec5abf..fa78edc7a4 100644 --- a/ibm/service/vpc/data_source_ibm_is_dedicated_host_groups.go +++ b/ibm/service/vpc/data_source_ibm_is_dedicated_host_groups.go @@ -231,7 +231,7 @@ func dataSourceIbmIsDedicatedHostGroupsID(d *schema.ResourceData) string { return time.Now().UTC().String() } -func dataSourceDedicatedHostGroupCollectionFirstToMap(firstItem vpcv1.DedicatedHostGroupCollectionFirst) (firstMap map[string]interface{}) { +func dataSourceDedicatedHostGroupCollectionFirstToMap(firstItem vpcv1.PageLink) (firstMap map[string]interface{}) { firstMap = map[string]interface{}{} if firstItem.Href != nil { @@ -351,7 +351,7 @@ func dataSourceDedicatedHostGroupCollectionGroupsSupportedInstanceProfilesToMap( return supportedInstanceProfilesMap } -func dataSourceDedicatedHostGroupCollectionFlattenFirst(result vpcv1.DedicatedHostGroupCollectionFirst) (finalList []map[string]interface{}) { +func dataSourceDedicatedHostGroupCollectionFlattenFirst(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceDedicatedHostGroupCollectionFirstToMap(result) finalList = append(finalList, finalMap) @@ -359,7 +359,7 @@ func dataSourceDedicatedHostGroupCollectionFlattenFirst(result vpcv1.DedicatedHo return finalList } -func dataSourceDedicatedHostGroupCollectionFlattenNext(result vpcv1.DedicatedHostGroupCollectionNext) (finalList []map[string]interface{}) { +func dataSourceDedicatedHostGroupCollectionFlattenNext(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceDedicatedHostGroupCollectionNextToMap(result) finalList = append(finalList, finalMap) @@ -367,7 +367,7 @@ func dataSourceDedicatedHostGroupCollectionFlattenNext(result vpcv1.DedicatedHos return finalList } -func dataSourceDedicatedHostGroupCollectionNextToMap(nextItem vpcv1.DedicatedHostGroupCollectionNext) (nextMap map[string]interface{}) { +func dataSourceDedicatedHostGroupCollectionNextToMap(nextItem vpcv1.PageLink) (nextMap map[string]interface{}) { nextMap = map[string]interface{}{} if nextItem.Href != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_dedicated_host_profiles.go b/ibm/service/vpc/data_source_ibm_is_dedicated_host_profiles.go index fb7478fd73..259903460e 100644 --- a/ibm/service/vpc/data_source_ibm_is_dedicated_host_profiles.go +++ b/ibm/service/vpc/data_source_ibm_is_dedicated_host_profiles.go @@ -394,7 +394,7 @@ func dataSourceIbmIsDedicatedHostProfilesID(d *schema.ResourceData) string { return time.Now().UTC().String() } -func dataSourceDedicatedHostProfileCollectionFlattenFirst(result vpcv1.DedicatedHostProfileCollectionFirst) (finalList []map[string]interface{}) { +func dataSourceDedicatedHostProfileCollectionFlattenFirst(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceDedicatedHostProfileCollectionFirstToMap(result) finalList = append(finalList, finalMap) @@ -402,7 +402,7 @@ func dataSourceDedicatedHostProfileCollectionFlattenFirst(result vpcv1.Dedicated return finalList } -func dataSourceDedicatedHostProfileCollectionFirstToMap(firstItem vpcv1.DedicatedHostProfileCollectionFirst) (firstMap map[string]interface{}) { +func dataSourceDedicatedHostProfileCollectionFirstToMap(firstItem vpcv1.PageLink) (firstMap map[string]interface{}) { firstMap = map[string]interface{}{} if firstItem.Href != nil { @@ -412,7 +412,7 @@ func dataSourceDedicatedHostProfileCollectionFirstToMap(firstItem vpcv1.Dedicate return firstMap } -func dataSourceDedicatedHostProfileCollectionFlattenNext(result vpcv1.DedicatedHostProfileCollectionNext) (finalList []map[string]interface{}) { +func dataSourceDedicatedHostProfileCollectionFlattenNext(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceDedicatedHostProfileCollectionNextToMap(result) finalList = append(finalList, finalMap) @@ -420,7 +420,7 @@ func dataSourceDedicatedHostProfileCollectionFlattenNext(result vpcv1.DedicatedH return finalList } -func dataSourceDedicatedHostProfileCollectionNextToMap(nextItem vpcv1.DedicatedHostProfileCollectionNext) (nextMap map[string]interface{}) { +func dataSourceDedicatedHostProfileCollectionNextToMap(nextItem vpcv1.PageLink) (nextMap map[string]interface{}) { nextMap = map[string]interface{}{} if nextItem.Href != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_dedicated_hosts.go b/ibm/service/vpc/data_source_ibm_is_dedicated_hosts.go index 436ed7abb0..0cb33efbd6 100644 --- a/ibm/service/vpc/data_source_ibm_is_dedicated_hosts.go +++ b/ibm/service/vpc/data_source_ibm_is_dedicated_hosts.go @@ -725,7 +725,7 @@ func dataSourceDedicatedHostCollectionDedicatedHostsVcpuToMap(vcpuItem vpcv1.Vcp return vcpuMap } -func dataSourceDedicatedHostCollectionFlattenFirst(result vpcv1.DedicatedHostCollectionFirst) (finalList []map[string]interface{}) { +func dataSourceDedicatedHostCollectionFlattenFirst(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceDedicatedHostCollectionFirstToMap(result) finalList = append(finalList, finalMap) @@ -733,7 +733,7 @@ func dataSourceDedicatedHostCollectionFlattenFirst(result vpcv1.DedicatedHostCol return finalList } -func dataSourceDedicatedHostCollectionFirstToMap(firstItem vpcv1.DedicatedHostCollectionFirst) (firstMap map[string]interface{}) { +func dataSourceDedicatedHostCollectionFirstToMap(firstItem vpcv1.PageLink) (firstMap map[string]interface{}) { firstMap = map[string]interface{}{} if firstItem.Href != nil { @@ -743,7 +743,7 @@ func dataSourceDedicatedHostCollectionFirstToMap(firstItem vpcv1.DedicatedHostCo return firstMap } -func dataSourceDedicatedHostCollectionFlattenNext(result vpcv1.DedicatedHostCollectionNext) (finalList []map[string]interface{}) { +func dataSourceDedicatedHostCollectionFlattenNext(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceDedicatedHostCollectionNextToMap(result) finalList = append(finalList, finalMap) @@ -751,7 +751,7 @@ func dataSourceDedicatedHostCollectionFlattenNext(result vpcv1.DedicatedHostColl return finalList } -func dataSourceDedicatedHostCollectionNextToMap(nextItem vpcv1.DedicatedHostCollectionNext) (nextMap map[string]interface{}) { +func dataSourceDedicatedHostCollectionNextToMap(nextItem vpcv1.PageLink) (nextMap map[string]interface{}) { nextMap = map[string]interface{}{} if nextItem.Href != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_floating_ips.go b/ibm/service/vpc/data_source_ibm_is_floating_ips.go index f62b12ad16..d5d2133208 100644 --- a/ibm/service/vpc/data_source_ibm_is_floating_ips.go +++ b/ibm/service/vpc/data_source_ibm_is_floating_ips.go @@ -283,7 +283,7 @@ func dataSourceIBMIsFloatingIpsID(d *schema.ResourceData) string { return time.Now().UTC().String() } -func dataSourceFloatingIPCollectionFlattenFirst(result vpcv1.FloatingIPCollectionFirst) (finalList []map[string]interface{}) { +func dataSourceFloatingIPCollectionFlattenFirst(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceFloatingIPCollectionFirstToMap(result) finalList = append(finalList, finalMap) @@ -291,7 +291,7 @@ func dataSourceFloatingIPCollectionFlattenFirst(result vpcv1.FloatingIPCollectio return finalList } -func dataSourceFloatingIPCollectionFirstToMap(firstItem vpcv1.FloatingIPCollectionFirst) (firstMap map[string]interface{}) { +func dataSourceFloatingIPCollectionFirstToMap(firstItem vpcv1.PageLink) (firstMap map[string]interface{}) { firstMap = map[string]interface{}{} if firstItem.Href != nil { @@ -534,7 +534,7 @@ func dataSourceFloatingIPCollectionFloatingIpsZoneToMap(zoneItem vpcv1.ZoneRefer return zoneMap } -func dataSourceFloatingIPCollectionFlattenNext(result vpcv1.FloatingIPCollectionNext) (finalList []map[string]interface{}) { +func dataSourceFloatingIPCollectionFlattenNext(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceFloatingIPCollectionNextToMap(result) finalList = append(finalList, finalMap) @@ -542,7 +542,7 @@ func dataSourceFloatingIPCollectionFlattenNext(result vpcv1.FloatingIPCollection return finalList } -func dataSourceFloatingIPCollectionNextToMap(nextItem vpcv1.FloatingIPCollectionNext) (nextMap map[string]interface{}) { +func dataSourceFloatingIPCollectionNextToMap(nextItem vpcv1.PageLink) (nextMap map[string]interface{}) { nextMap = map[string]interface{}{} if nextItem.Href != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_instance_groups.go b/ibm/service/vpc/data_source_ibm_is_instance_groups.go index aa5c7106fd..89dbd36599 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance_groups.go +++ b/ibm/service/vpc/data_source_ibm_is_instance_groups.go @@ -376,7 +376,7 @@ func DataSourceIBMIsInstanceGroupsID(d *schema.ResourceData) string { return time.Now().UTC().String() } -func DataSourceIBMIsInstanceGroupsInstanceGroupCollectionFirstToMap(model *vpcv1.InstanceGroupCollectionFirst) (map[string]interface{}, error) { +func DataSourceIBMIsInstanceGroupsInstanceGroupCollectionFirstToMap(model *vpcv1.PageLink) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Href != nil { modelMap["href"] = *model.Href diff --git a/ibm/service/vpc/data_source_ibm_is_instance_template.go b/ibm/service/vpc/data_source_ibm_is_instance_template.go index b8db3afcac..ff34bfbc8d 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance_template.go +++ b/ibm/service/vpc/data_source_ibm_is_instance_template.go @@ -883,12 +883,12 @@ func dataSourceIBMISInstanceTemplateRead(context context.Context, d *schema.Reso switch reflect.TypeOf(instance.DefaultTrustedProfile.Target).String() { case "*vpcv1.TrustedProfileIdentityTrustedProfileByID": { - target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityTrustedProfileByID) + target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityByID) d.Set(isInstanceDefaultTrustedProfileTarget, target.ID) } case "*vpcv1.TrustedProfileIdentityTrustedProfileByCRN": { - target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityTrustedProfileByCRN) + target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityByCRN) d.Set(isInstanceDefaultTrustedProfileTarget, target.CRN) } } @@ -1265,12 +1265,12 @@ func dataSourceIBMISInstanceTemplateRead(context context.Context, d *schema.Reso switch reflect.TypeOf(instance.DefaultTrustedProfile.Target).String() { case "*vpcv1.TrustedProfileIdentityTrustedProfileByID": { - target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityTrustedProfileByID) + target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityByID) d.Set(isInstanceDefaultTrustedProfileTarget, target.ID) } case "*vpcv1.TrustedProfileIdentityTrustedProfileByCRN": { - target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityTrustedProfileByCRN) + target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityByCRN) d.Set(isInstanceDefaultTrustedProfileTarget, target.CRN) } } diff --git a/ibm/service/vpc/data_source_ibm_is_instance_templates.go b/ibm/service/vpc/data_source_ibm_is_instance_templates.go index b80b299c8a..e2cfe87374 100644 --- a/ibm/service/vpc/data_source_ibm_is_instance_templates.go +++ b/ibm/service/vpc/data_source_ibm_is_instance_templates.go @@ -883,12 +883,12 @@ func dataSourceIBMISInstanceTemplatesRead(d *schema.ResourceData, meta interface switch reflect.TypeOf(instance.DefaultTrustedProfile.Target).String() { case "*vpcv1.TrustedProfileIdentityTrustedProfileByID": { - target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityTrustedProfileByID) + target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityByID) template[isInstanceDefaultTrustedProfileTarget] = target.ID } case "*vpcv1.TrustedProfileIdentityTrustedProfileByCRN": { - target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityTrustedProfileByCRN) + target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityByCRN) template[isInstanceDefaultTrustedProfileTarget] = target.CRN } } diff --git a/ibm/service/vpc/data_source_ibm_is_private_path_service_gateway_account_policies.go b/ibm/service/vpc/data_source_ibm_is_private_path_service_gateway_account_policies.go index d7885dad48..1209047a57 100644 --- a/ibm/service/vpc/data_source_ibm_is_private_path_service_gateway_account_policies.go +++ b/ibm/service/vpc/data_source_ibm_is_private_path_service_gateway_account_policies.go @@ -177,7 +177,7 @@ func dataSourceIBMIsPrivatePathServiceGatewayAccountPoliciesAccountReferenceToMa return modelMap, nil } -func dataSourceIBMIsPrivatePathServiceGatewayAccountPoliciesPrivatePathServiceGatewayAccountPolicyCollectionFirstToMap(model *vpcv1.PrivatePathServiceGatewayAccountPolicyCollectionFirst) (map[string]interface{}, error) { +func dataSourceIBMIsPrivatePathServiceGatewayAccountPoliciesPrivatePathServiceGatewayAccountPolicyCollectionFirstToMap(model *vpcv1.PageLink) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Href != nil { modelMap["href"] = *model.Href @@ -185,7 +185,7 @@ func dataSourceIBMIsPrivatePathServiceGatewayAccountPoliciesPrivatePathServiceGa return modelMap, nil } -func dataSourceIBMIsPrivatePathServiceGatewayAccountPoliciesPrivatePathServiceGatewayAccountPolicyCollectionNextToMap(model *vpcv1.PrivatePathServiceGatewayAccountPolicyCollectionNext) (map[string]interface{}, error) { +func dataSourceIBMIsPrivatePathServiceGatewayAccountPoliciesPrivatePathServiceGatewayAccountPolicyCollectionNextToMap(model *vpcv1.PageLink) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Href != nil { modelMap["href"] = *model.Href diff --git a/ibm/service/vpc/data_source_ibm_is_private_path_service_gateway_endpoint_gateway_bindings.go b/ibm/service/vpc/data_source_ibm_is_private_path_service_gateway_endpoint_gateway_bindings.go index 0dfe70246b..a39440401e 100644 --- a/ibm/service/vpc/data_source_ibm_is_private_path_service_gateway_endpoint_gateway_bindings.go +++ b/ibm/service/vpc/data_source_ibm_is_private_path_service_gateway_endpoint_gateway_bindings.go @@ -203,7 +203,7 @@ func dataSourceIBMIsPrivatePathServiceGatewayEndpointGatewayBindingsAccountRefer return modelMap, nil } -func dataSourceIBMIsPrivatePathServiceGatewayEndpointGatewayBindingsPrivatePathServiceGatewayEndpointGatewayBindingCollectionFirstToMap(model *vpcv1.PrivatePathServiceGatewayEndpointGatewayBindingCollectionFirst) (map[string]interface{}, error) { +func dataSourceIBMIsPrivatePathServiceGatewayEndpointGatewayBindingsPrivatePathServiceGatewayEndpointGatewayBindingCollectionFirstToMap(model *vpcv1.PageLink) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Href != nil { modelMap["href"] = *model.Href @@ -211,7 +211,7 @@ func dataSourceIBMIsPrivatePathServiceGatewayEndpointGatewayBindingsPrivatePathS return modelMap, nil } -func dataSourceIBMIsPrivatePathServiceGatewayEndpointGatewayBindingsPrivatePathServiceGatewayEndpointGatewayBindingCollectionNextToMap(model *vpcv1.PrivatePathServiceGatewayEndpointGatewayBindingCollectionNext) (map[string]interface{}, error) { +func dataSourceIBMIsPrivatePathServiceGatewayEndpointGatewayBindingsPrivatePathServiceGatewayEndpointGatewayBindingCollectionNextToMap(model *vpcv1.PageLink) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Href != nil { modelMap["href"] = *model.Href diff --git a/ibm/service/vpc/data_source_ibm_is_private_path_service_gateways.go b/ibm/service/vpc/data_source_ibm_is_private_path_service_gateways.go index cb40543672..a6e4a851fd 100644 --- a/ibm/service/vpc/data_source_ibm_is_private_path_service_gateways.go +++ b/ibm/service/vpc/data_source_ibm_is_private_path_service_gateways.go @@ -285,7 +285,7 @@ func dataSourceIBMIsPrivatePathServiceGatewaysID(d *schema.ResourceData) string return time.Now().UTC().String() } -func dataSourceIBMIsPrivatePathServiceGatewaysPrivatePathServiceGatewayCollectionFirstToMap(model *vpcv1.PrivatePathServiceGatewayCollectionFirst) (map[string]interface{}, error) { +func dataSourceIBMIsPrivatePathServiceGatewaysPrivatePathServiceGatewayCollectionFirstToMap(model *vpcv1.PageLink) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Href != nil { modelMap["href"] = *model.Href @@ -293,7 +293,7 @@ func dataSourceIBMIsPrivatePathServiceGatewaysPrivatePathServiceGatewayCollectio return modelMap, nil } -func dataSourceIBMIsPrivatePathServiceGatewaysPrivatePathServiceGatewayCollectionNextToMap(model *vpcv1.PrivatePathServiceGatewayCollectionNext) (map[string]interface{}, error) { +func dataSourceIBMIsPrivatePathServiceGatewaysPrivatePathServiceGatewayCollectionNextToMap(model *vpcv1.PageLink) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Href != nil { modelMap["href"] = *model.Href diff --git a/ibm/service/vpc/data_source_ibm_is_share_profile.go b/ibm/service/vpc/data_source_ibm_is_share_profile.go index 99a51fa726..af303d054c 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_profile.go +++ b/ibm/service/vpc/data_source_ibm_is_share_profile.go @@ -203,9 +203,6 @@ func dataSourceShareProfileIopsToMap(iops vpcv1.ShareProfileIops) (iopsMap map[s } func dataSourceShareProfileCapacityToMap(capacity vpcv1.ShareProfileCapacity) (capacityMap map[string]interface{}) { capacityMap = map[string]interface{}{} - if capacity.Default != nil { - capacityMap["default"] = int(*capacity.Default) - } capacityMap["max"] = capacity.Max capacityMap["min"] = capacity.Min capacityMap["step"] = capacity.Step diff --git a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips.go b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips.go index 1a6c0395f7..f9b0f248a2 100644 --- a/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips.go +++ b/ibm/service/vpc/data_source_ibm_is_virtual_network_interface_ips.go @@ -112,13 +112,13 @@ func dataSourceVirtualNetworkInterfaceIPsID(d *schema.ResourceData) string { return time.Now().UTC().String() } -func dataSourceIBMIsReservedIpsReservedIPCollectionFirstToMap(model *vpcv1.ReservedIPCollectionFirst) (map[string]interface{}, error) { +func dataSourceIBMIsReservedIpsReservedIPCollectionFirstToMap(model *vpcv1.PageLink) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["href"] = model.Href return modelMap, nil } -func dataSourceIBMIsReservedIpsReservedIPCollectionNextToMap(model *vpcv1.ReservedIPCollectionNext) (map[string]interface{}, error) { +func dataSourceIBMIsReservedIpsReservedIPCollectionNextToMap(model *vpcv1.PageLink) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["href"] = model.Href return modelMap, nil diff --git a/ibm/service/vpc/data_source_ibm_is_vpc_address_prefixes.go b/ibm/service/vpc/data_source_ibm_is_vpc_address_prefixes.go index 172e4ae1cb..719f63bfc5 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpc_address_prefixes.go +++ b/ibm/service/vpc/data_source_ibm_is_vpc_address_prefixes.go @@ -225,7 +225,7 @@ func dataSourceAddressPrefixCollectionAddressPrefixesZoneToMap(zoneItem vpcv1.Zo return zoneMap } -func dataSourceAddressPrefixCollectionFlattenFirst(result vpcv1.AddressPrefixCollectionFirst) (finalList []map[string]interface{}) { +func dataSourceAddressPrefixCollectionFlattenFirst(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceAddressPrefixCollectionFirstToMap(result) finalList = append(finalList, finalMap) @@ -233,7 +233,7 @@ func dataSourceAddressPrefixCollectionFlattenFirst(result vpcv1.AddressPrefixCol return finalList } -func dataSourceAddressPrefixCollectionFirstToMap(firstItem vpcv1.AddressPrefixCollectionFirst) (firstMap map[string]interface{}) { +func dataSourceAddressPrefixCollectionFirstToMap(firstItem vpcv1.PageLink) (firstMap map[string]interface{}) { firstMap = map[string]interface{}{} if firstItem.Href != nil { @@ -243,7 +243,7 @@ func dataSourceAddressPrefixCollectionFirstToMap(firstItem vpcv1.AddressPrefixCo return firstMap } -func dataSourceAddressPrefixCollectionFlattenNext(result vpcv1.AddressPrefixCollectionNext) (finalList []map[string]interface{}) { +func dataSourceAddressPrefixCollectionFlattenNext(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceAddressPrefixCollectionNextToMap(result) finalList = append(finalList, finalMap) @@ -251,7 +251,7 @@ func dataSourceAddressPrefixCollectionFlattenNext(result vpcv1.AddressPrefixColl return finalList } -func dataSourceAddressPrefixCollectionNextToMap(nextItem vpcv1.AddressPrefixCollectionNext) (nextMap map[string]interface{}) { +func dataSourceAddressPrefixCollectionNextToMap(nextItem vpcv1.PageLink) (nextMap map[string]interface{}) { nextMap = map[string]interface{}{} if nextItem.Href != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_server_clients.go b/ibm/service/vpc/data_source_ibm_is_vpn_server_clients.go index 29a6b3f62c..3b0410e95f 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_server_clients.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_server_clients.go @@ -229,7 +229,7 @@ func dataSourceVPNServerClientCollectionClientsRemoteIPToMap(remoteIPItem vpcv1. return remoteIPMap } -func dataSourceVPNServerClientCollectionFlattenFirst(result vpcv1.VPNServerClientCollectionFirst) (finalList []map[string]interface{}) { +func dataSourceVPNServerClientCollectionFlattenFirst(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceVPNServerClientCollectionFirstToMap(result) finalList = append(finalList, finalMap) @@ -237,7 +237,7 @@ func dataSourceVPNServerClientCollectionFlattenFirst(result vpcv1.VPNServerClien return finalList } -func dataSourceVPNServerClientCollectionFirstToMap(firstItem vpcv1.VPNServerClientCollectionFirst) (firstMap map[string]interface{}) { +func dataSourceVPNServerClientCollectionFirstToMap(firstItem vpcv1.PageLink) (firstMap map[string]interface{}) { firstMap = map[string]interface{}{} if firstItem.Href != nil { @@ -247,7 +247,7 @@ func dataSourceVPNServerClientCollectionFirstToMap(firstItem vpcv1.VPNServerClie return firstMap } -func dataSourceVPNServerClientCollectionFlattenNext(result vpcv1.VPNServerClientCollectionNext) (finalList []map[string]interface{}) { +func dataSourceVPNServerClientCollectionFlattenNext(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceVPNServerClientCollectionNextToMap(result) finalList = append(finalList, finalMap) @@ -255,7 +255,7 @@ func dataSourceVPNServerClientCollectionFlattenNext(result vpcv1.VPNServerClient return finalList } -func dataSourceVPNServerClientCollectionNextToMap(nextItem vpcv1.VPNServerClientCollectionNext) (nextMap map[string]interface{}) { +func dataSourceVPNServerClientCollectionNextToMap(nextItem vpcv1.PageLink) (nextMap map[string]interface{}) { nextMap = map[string]interface{}{} if nextItem.Href != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_server_routes.go b/ibm/service/vpc/data_source_ibm_is_vpn_server_routes.go index 5142635924..286934f31b 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_server_routes.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_server_routes.go @@ -180,7 +180,7 @@ func dataSourceIBMIsVPNServerRoutesID(d *schema.ResourceData) string { return time.Now().UTC().String() } -func dataSourceVPNServerRouteCollectionFlattenFirst(result vpcv1.VPNServerRouteCollectionFirst) (finalList []map[string]interface{}) { +func dataSourceVPNServerRouteCollectionFlattenFirst(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceVPNServerRouteCollectionFirstToMap(result) finalList = append(finalList, finalMap) @@ -188,7 +188,7 @@ func dataSourceVPNServerRouteCollectionFlattenFirst(result vpcv1.VPNServerRouteC return finalList } -func dataSourceVPNServerRouteCollectionFirstToMap(firstItem vpcv1.VPNServerRouteCollectionFirst) (firstMap map[string]interface{}) { +func dataSourceVPNServerRouteCollectionFirstToMap(firstItem vpcv1.PageLink) (firstMap map[string]interface{}) { firstMap = map[string]interface{}{} if firstItem.Href != nil { @@ -198,7 +198,7 @@ func dataSourceVPNServerRouteCollectionFirstToMap(firstItem vpcv1.VPNServerRoute return firstMap } -func dataSourceVPNServerRouteCollectionFlattenNext(result vpcv1.VPNServerRouteCollectionNext) (finalList []map[string]interface{}) { +func dataSourceVPNServerRouteCollectionFlattenNext(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceVPNServerRouteCollectionNextToMap(result) finalList = append(finalList, finalMap) @@ -206,7 +206,7 @@ func dataSourceVPNServerRouteCollectionFlattenNext(result vpcv1.VPNServerRouteCo return finalList } -func dataSourceVPNServerRouteCollectionNextToMap(nextItem vpcv1.VPNServerRouteCollectionNext) (nextMap map[string]interface{}) { +func dataSourceVPNServerRouteCollectionNextToMap(nextItem vpcv1.PageLink) (nextMap map[string]interface{}) { nextMap = map[string]interface{}{} if nextItem.Href != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_vpn_servers.go b/ibm/service/vpc/data_source_ibm_is_vpn_servers.go index 0ba98e781f..229199ea26 100644 --- a/ibm/service/vpc/data_source_ibm_is_vpn_servers.go +++ b/ibm/service/vpc/data_source_ibm_is_vpn_servers.go @@ -485,7 +485,7 @@ func dataSourceIBMIsVPNServersID(d *schema.ResourceData) string { return time.Now().UTC().String() } -func dataSourceVPNServerCollectionFlattenFirst(result vpcv1.VPNServerCollectionFirst) (finalList []map[string]interface{}) { +func dataSourceVPNServerCollectionFlattenFirst(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceVPNServerCollectionFirstToMap(result) finalList = append(finalList, finalMap) @@ -493,7 +493,7 @@ func dataSourceVPNServerCollectionFlattenFirst(result vpcv1.VPNServerCollectionF return finalList } -func dataSourceVPNServerCollectionFirstToMap(firstItem vpcv1.VPNServerCollectionFirst) (firstMap map[string]interface{}) { +func dataSourceVPNServerCollectionFirstToMap(firstItem vpcv1.PageLink) (firstMap map[string]interface{}) { firstMap = map[string]interface{}{} if firstItem.Href != nil { @@ -503,7 +503,7 @@ func dataSourceVPNServerCollectionFirstToMap(firstItem vpcv1.VPNServerCollection return firstMap } -func dataSourceVPNServerCollectionFlattenNext(result vpcv1.VPNServerCollectionNext) (finalList []map[string]interface{}) { +func dataSourceVPNServerCollectionFlattenNext(result vpcv1.PageLink) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} finalMap := dataSourceVPNServerCollectionNextToMap(result) finalList = append(finalList, finalMap) @@ -511,7 +511,7 @@ func dataSourceVPNServerCollectionFlattenNext(result vpcv1.VPNServerCollectionNe return finalList } -func dataSourceVPNServerCollectionNextToMap(nextItem vpcv1.VPNServerCollectionNext) (nextMap map[string]interface{}) { +func dataSourceVPNServerCollectionNextToMap(nextItem vpcv1.PageLink) (nextMap map[string]interface{}) { nextMap = map[string]interface{}{} if nextItem.Href != nil { diff --git a/ibm/service/vpc/resource_ibm_is_instance_template.go b/ibm/service/vpc/resource_ibm_is_instance_template.go index 03ec4a8e51..7a0b0ac2de 100644 --- a/ibm/service/vpc/resource_ibm_is_instance_template.go +++ b/ibm/service/vpc/resource_ibm_is_instance_template.go @@ -2341,12 +2341,12 @@ func instanceTemplateGet(d *schema.ResourceData, meta interface{}, ID string) er switch reflect.TypeOf(instance.DefaultTrustedProfile.Target).String() { case "*vpcv1.TrustedProfileIdentityTrustedProfileByID": { - target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityTrustedProfileByID) + target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityByID) d.Set(isInstanceDefaultTrustedProfileTarget, target.ID) } case "*vpcv1.TrustedProfileIdentityTrustedProfileByCRN": { - target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityTrustedProfileByCRN) + target := instance.DefaultTrustedProfile.Target.(*vpcv1.TrustedProfileIdentityByCRN) d.Set(isInstanceDefaultTrustedProfileTarget, target.CRN) } } From 49bcbe1d094c9f0a7ec4c5e2db87271e853e8d87 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 14 Nov 2024 10:44:35 +0530 Subject: [PATCH 098/103] reverted share profile default changes --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 157 ++++++++++++------ .../vpc/data_source_ibm_is_share_profile.go | 3 + 2 files changed, 106 insertions(+), 54 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 5580c19ad3..76ddbcce07 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.96.0-d6dec9d7-20241008-212902 + * IBM OpenAPI SDK Code Generator Version: 3.96.1-5136e54a-20241108-203028 */ // Package vpcv1 : Operations and models for the VpcV1 service @@ -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-11-13`. + // 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-11-13`. Version *string + // and `2024-11-14`. } // NewVpcV1UsingExternalConfig : constructs an instance of VpcV1 with passed in options and external configuration. @@ -85984,63 +85984,42 @@ type SecurityGroupRuleIntf interface { // UnmarshalSecurityGroupRule unmarshals an instance of SecurityGroupRule from the specified map of raw messages. func UnmarshalSecurityGroupRule(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupRule) - err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) - if err != nil { - err = core.SDKErrorf(err, "", "direction-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, "ip_version", &obj.IPVersion) - if err != nil { - err = core.SDKErrorf(err, "", "ip_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "local", &obj.Local, UnmarshalSecurityGroupRuleLocal) - 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, UnmarshalSecurityGroupRuleRemote) - 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) + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "protocol", &discValue) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + errMsg := fmt.Sprintf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + err = core.SDKErrorf(err, errMsg, "discriminator-unmarshal-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) - if err != nil { - err = core.SDKErrorf(err, "", "port_max-error", common.GetComponentInfo()) + if discValue == "" { + err = core.SDKErrorf(err, "required discriminator property 'protocol' not found in JSON object", "missing-discriminator", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) - if err != nil { - err = core.SDKErrorf(err, "", "port_min-error", common.GetComponentInfo()) - return + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolAll-error", common.GetComponentInfo()) + } + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolIcmp-error", common.GetComponentInfo()) + } + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolTcpudp-error", common.GetComponentInfo()) + } + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-SecurityGroupRuleSecurityGroupRuleProtocolTcpudp-error", common.GetComponentInfo()) + } + } else { + errMsg := fmt.Sprintf("unrecognized value for discriminator property 'protocol': %s", discValue) + err = core.SDKErrorf(err, errMsg, "invalid-discriminator", common.GetComponentInfo()) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -88833,6 +88812,7 @@ func UnmarshalShareProfile(m map[string]json.RawMessage, result interface{}) (er // Models which "extend" this model: // - ShareProfileCapacityFixed // - ShareProfileCapacityEnum +// - ShareProfileCapacityRange // - ShareProfileCapacityDependentRange type ShareProfileCapacity struct { // The type for this profile field. @@ -88844,6 +88824,9 @@ type ShareProfileCapacity struct { // The permitted values for this profile field. Values []int64 `json:"values,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"` @@ -88886,6 +88869,11 @@ func UnmarshalShareProfileCapacity(m map[string]json.RawMessage, result interfac 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()) + return + } err = core.UnmarshalPrimitive(m, "max", &obj.Max) if err != nil { err = core.SDKErrorf(err, "", "max-error", common.GetComponentInfo()) @@ -126843,6 +126831,67 @@ func UnmarshalShareProfileCapacityFixed(m map[string]json.RawMessage, result int return } +// ShareProfileCapacityRange : The permitted total capacity range (in gigabytes) of a share with this profile. +// This model "extends" ShareProfileCapacity +type ShareProfileCapacityRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the ShareProfileCapacityRange.Type property. +// The type for this profile field. +const ( + ShareProfileCapacityRangeTypeRangeConst = "range" +) + +func (*ShareProfileCapacityRange) isaShareProfileCapacity() bool { + return true +} + +// UnmarshalShareProfileCapacityRange unmarshals an instance of ShareProfileCapacityRange from the specified map of raw messages. +func UnmarshalShareProfileCapacityRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareProfileCapacityRange) + 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, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ShareProfileIopsDependentRange : The permitted IOPS range of a share with this profile depends on its configuration. // This model "extends" ShareProfileIops type ShareProfileIopsDependentRange struct { diff --git a/ibm/service/vpc/data_source_ibm_is_share_profile.go b/ibm/service/vpc/data_source_ibm_is_share_profile.go index af303d054c..99a51fa726 100644 --- a/ibm/service/vpc/data_source_ibm_is_share_profile.go +++ b/ibm/service/vpc/data_source_ibm_is_share_profile.go @@ -203,6 +203,9 @@ func dataSourceShareProfileIopsToMap(iops vpcv1.ShareProfileIops) (iopsMap map[s } func dataSourceShareProfileCapacityToMap(capacity vpcv1.ShareProfileCapacity) (capacityMap map[string]interface{}) { capacityMap = map[string]interface{}{} + if capacity.Default != nil { + capacityMap["default"] = int(*capacity.Default) + } capacityMap["max"] = capacity.Max capacityMap["min"] = capacity.Min capacityMap["step"] = capacity.Step From 5cf79555bc8a1ecc32b03a812bd5defd5e2466d2 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 14 Nov 2024 12:44:47 +0530 Subject: [PATCH 099/103] migrated to 0.62.0 --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index c1699a7c3c..0be81f6e76 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/IBM/eventstreams-go-sdk v1.4.0 github.com/IBM/go-sdk-core v1.1.0 github.com/IBM/go-sdk-core/v3 v3.2.4 - github.com/IBM/go-sdk-core/v5 v5.18.0 + github.com/IBM/go-sdk-core/v5 v5.18.1 github.com/IBM/ibm-cos-sdk-go v1.10.3 github.com/IBM/ibm-cos-sdk-go-config/v2 v2.1.0 github.com/IBM/ibm-hpcs-tke-sdk v0.0.0-20211109141421-a4b61b05f7d1 @@ -40,7 +40,7 @@ require ( github.com/IBM/secrets-manager-go-sdk/v2 v2.0.7 github.com/IBM/vmware-go-sdk v0.1.2 github.com/IBM/vpc-beta-go-sdk v0.8.0 - github.com/IBM/vpc-go-sdk v0.61.0 + github.com/IBM/vpc-go-sdk v0.62.0 github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5 github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 github.com/akamai/AkamaiOPEN-edgegrid-golang/v5 v5.0.0 diff --git a/go.sum b/go.sum index fa07b51d02..1052dbf919 100644 --- a/go.sum +++ b/go.sum @@ -154,10 +154,9 @@ github.com/IBM/go-sdk-core/v5 v5.6.3/go.mod h1:tt/B9rxLkRtglE7pvqLuYikgCXaZFL3bt github.com/IBM/go-sdk-core/v5 v5.7.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc0XQUqRO9Jc= github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI= -github.com/IBM/go-sdk-core/v5 v5.17.3/go.mod h1:GatGZpxlo1KaxiRN6E10/rNgWtUtx1hN/GoHSCaSPKA= 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.0 h1:ZB3qaLEsN4fccQWzMblfXeqLx5VztiVi+HfyIqmqask= -github.com/IBM/go-sdk-core/v5 v5.18.0/go.mod h1:3ywpylZ41WhWPusqtpJZWopYlt2brebcphV7mA2JncU= +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/IBM/ibm-cos-sdk-go v1.10.3 h1:YfZSLqMiCrqDPbr3r+amY2sicIXlrd+3L5pok6QRXIQ= github.com/IBM/ibm-cos-sdk-go v1.10.3/go.mod h1:T9x7pC47DUd5jD/TMFzlvly39P6EdW5wOemA78XEo2g= github.com/IBM/ibm-cos-sdk-go-config/v2 v2.1.0 h1:U7EmXSfv7jtugRpTpOkPUmgS/xiNKtGfKVH3BGyC1hg= @@ -195,6 +194,8 @@ github.com/IBM/vmware-go-sdk v0.1.2 h1:5lKWFyInWz9e2hwGsoFTEoLa1jYkD30SReN0fQ10w github.com/IBM/vmware-go-sdk v0.1.2/go.mod h1:2UGPBJju3jiv5VKKBBm9a5L6bzF/aJdKOKAzJ7HaOjA= github.com/IBM/vpc-beta-go-sdk v0.8.0 h1:cEPpv4iw3Ba5W2d0AWg3TIbKeJ8y1nPuUuibR5Jt9eE= github.com/IBM/vpc-beta-go-sdk v0.8.0/go.mod h1:hORgIyTFRzXrZIK9IohaWmCRBBlYiDRagsufi7M6akE= +github.com/IBM/vpc-go-sdk v0.62.0 h1:Xga74D70ziD7nzm51ue3othHz1epMLVkGP/L6/Be+/0= +github.com/IBM/vpc-go-sdk v0.62.0/go.mod h1:VBR6bAznHsNCFA89Ue4JFQpqCcFp8F5neqbCFCyks4Q= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= @@ -913,7 +914,6 @@ github.com/hashicorp/go-retryablehttp v0.6.2/go.mod h1:gEx6HMUGxYYhJScX7W1Il64m6 github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= -github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= 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/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= From c6afc19e9af61733cd4036f0a8552eeb105f0bb2 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 20 Nov 2024 08:47:24 +0530 Subject: [PATCH 100/103] updated sdk --- common/github.com/IBM/vpc-go-sdk/go.mod | 29 +- common/github.com/IBM/vpc-go-sdk/go.sum | 223 +---- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 778 ++++++++++++++++-- go.mod | 2 +- go.sum | 2 - 5 files changed, 750 insertions(+), 284 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/go.mod b/common/github.com/IBM/vpc-go-sdk/go.mod index b0139bdc7d..1c1ab5e0a0 100644 --- a/common/github.com/IBM/vpc-go-sdk/go.mod +++ b/common/github.com/IBM/vpc-go-sdk/go.mod @@ -1,14 +1,39 @@ module github.com/IBM/vpc-go-sdk -go 1.16 +go 1.21 + +toolchain go1.22.2 require ( - github.com/IBM/go-sdk-core/v5 v5.17.3 + 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/stretchr/testify v1.8.4 ) +require ( + github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/go-openapi/errors v0.21.0 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.19.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-retryablehttp v0.7.7 // indirect + github.com/leodido/go-urn v1.4.0 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/oklog/ulid v1.3.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.mongodb.org/mongo-driver v1.14.0 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/net v0.23.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.14.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + retract ( v1.0.2 v1.0.1 diff --git a/common/github.com/IBM/vpc-go-sdk/go.sum b/common/github.com/IBM/vpc-go-sdk/go.sum index cf7eb71f63..049bc3b5c0 100644 --- a/common/github.com/IBM/vpc-go-sdk/go.sum +++ b/common/github.com/IBM/vpc-go-sdk/go.sum @@ -1,21 +1,15 @@ -github.com/IBM/go-sdk-core/v5 v5.17.3 h1:CZSVCKzhQc/hRQZOtuEmi9dlNtWMnxJvOsPtQKP7cZ4= -github.com/IBM/go-sdk-core/v5 v5.17.3/go.mod h1:GatGZpxlo1KaxiRN6E10/rNgWtUtx1hN/GoHSCaSPKA= +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/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -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/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/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= 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= @@ -28,245 +22,56 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4= github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= -github.com/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/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= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -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.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -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.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -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 v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= -github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= -github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +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/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/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= 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= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= 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.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -github.com/onsi/ginkgo/v2 v2.1.4/go.mod h1:um6tUpWM/cxCK3/FK8BXqEiUMUwRgSM4JXG47RKZmLU= -github.com/onsi/ginkgo/v2 v2.1.6/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= -github.com/onsi/ginkgo/v2 v2.3.0/go.mod h1:Eew0uilEqZmIEZr8JrvYlvOM7Rr6xzTmMV8AyFNU9d0= -github.com/onsi/ginkgo/v2 v2.4.0/go.mod h1:iHkDK1fKGcBoEHT5W7YBq4RFWaQulw+caOMkAt4OrFo= -github.com/onsi/ginkgo/v2 v2.5.0/go.mod h1:Luc4sArBICYCS8THh8v3i3i5CuSZO+RaQRaJoeNwomw= -github.com/onsi/ginkgo/v2 v2.7.0/go.mod h1:yjiuMwPokqY1XauOgju45q3sJt6VzQ/Fict1LFVcsAo= -github.com/onsi/ginkgo/v2 v2.8.1/go.mod h1:N1/NbDngAFcSLdyZ+/aYTYGSlq9qMCS/cNKGJjy+csc= -github.com/onsi/ginkgo/v2 v2.9.0/go.mod h1:4xkjoL/tZv4SMWeww56BU5kAt19mVB47gTWxmrTcxyk= -github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo= -github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= -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.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.20.1/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= -github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc= -github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= -github.com/onsi/gomega v1.24.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= -github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM= -github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= -github.com/onsi/gomega v1.27.1/go.mod h1:aHX5xOykVYzWOV4WqQy0sy8BQptgukenXpCXfadcIAw= -github.com/onsi/gomega v1.27.3/go.mod h1:5vG284IBtfDAmDyrK+eGyZmUgUlmi+Wngqo557cZ6Gw= -github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= -github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= -golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= -golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= -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= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -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.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -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= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 76ddbcce07..9e29877008 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -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-11-12 +// API Version: 2024-11-19 type VpcV1 struct { Service *core.BaseService @@ -46,8 +46,8 @@ type VpcV1 struct { // `2`. 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-11-14`. + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2024-11-19` + // and `2024-11-20`. Version *string } @@ -67,9 +67,9 @@ type VpcV1Options struct { // `2`. Generation *int64 - // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2024-04-30` + // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2024-11-19` + // and `2024-11-20`. 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-11-12") + options.Version = core.StringPtr("2024-11-19") } service = &VpcV1{ Service: baseService, @@ -6198,6 +6198,9 @@ func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOpt if listInstancesOptions.PlacementGroupName != nil { builder.AddQuery("placement_group.name", fmt.Sprint(*listInstancesOptions.PlacementGroupName)) } + if listInstancesOptions.ReservationAffinityPolicy != nil { + builder.AddQuery("reservation_affinity.policy", fmt.Sprint(*listInstancesOptions.ReservationAffinityPolicy)) + } if listInstancesOptions.ReservationID != nil { builder.AddQuery("reservation.id", fmt.Sprint(*listInstancesOptions.ReservationID)) } @@ -11042,6 +11045,12 @@ func (vpc *VpcV1) ListReservationsWithContext(ctx context.Context, listReservati if listReservationsOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listReservationsOptions.Name)) } + if listReservationsOptions.ProfileResourceType != nil { + builder.AddQuery("profile.resource_type", fmt.Sprint(*listReservationsOptions.ProfileResourceType)) + } + if listReservationsOptions.AffinityPolicy != nil { + builder.AddQuery("affinity_policy", fmt.Sprint(*listReservationsOptions.AffinityPolicy)) + } if listReservationsOptions.ResourceGroupID != nil { builder.AddQuery("resource_group.id", fmt.Sprint(*listReservationsOptions.ResourceGroupID)) } @@ -13145,6 +13154,15 @@ func (vpc *VpcV1) ListBareMetalServersWithContext(ctx context.Context, listBareM if listBareMetalServersOptions.Name != nil { builder.AddQuery("name", fmt.Sprint(*listBareMetalServersOptions.Name)) } + if listBareMetalServersOptions.ReservationID != nil { + builder.AddQuery("reservation.id", fmt.Sprint(*listBareMetalServersOptions.ReservationID)) + } + if listBareMetalServersOptions.ReservationCRN != nil { + builder.AddQuery("reservation.crn", fmt.Sprint(*listBareMetalServersOptions.ReservationCRN)) + } + if listBareMetalServersOptions.ReservationName != nil { + builder.AddQuery("reservation.name", fmt.Sprint(*listBareMetalServersOptions.ReservationName)) + } if listBareMetalServersOptions.VPCID != nil { builder.AddQuery("vpc.id", fmt.Sprint(*listBareMetalServersOptions.VPCID)) } @@ -33595,7 +33613,7 @@ func (vpc *VpcV1) UnpublishPrivatePathServiceGatewayWithContext(ctx context.Cont return } func getServiceComponentInfo() *core.ProblemComponent { - return core.NewProblemComponent(DefaultServiceName, "2024-11-12") + return core.NewProblemComponent(DefaultServiceName, "today") } // AccountIdentity : Identifies an account by a unique property. @@ -35916,6 +35934,27 @@ type BareMetalServer struct { // Firmware information for the bare metal server. Firmware *BareMetalServerFirmware `json:"firmware" validate:"required"` + // The reasons for the current server `health_state` (if any): + // - `reservation_capacity_unavailable`: The reservation affinity pool has no + // available capacity. + // - `reservation_deleted`: The reservation affinity pool has a deleted reservation. + // - `reservation_expired`: The reservation affinity pool has an expired reservation. + // - `reservation_failed`: The reservation affinity pool has a failed reservation. + // + // See [health status reasons](https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons) for details. The + // enumerated values for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. + HealthReasons []BareMetalServerHealthReason `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 bare metal server. Href *string `json:"href" validate:"required"` @@ -35959,6 +35998,12 @@ type BareMetalServer struct { // for this bare metal server. Profile *BareMetalServerProfileReference `json:"profile" validate:"required"` + // The reservation used by this bare metal server. + // If absent, no reservation is in use. + Reservation *ReservationReference `json:"reservation,omitempty"` + + ReservationAffinity *BareMetalServerReservationAffinity `json:"reservation_affinity" validate:"required"` + // The resource group for this bare metal server. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -35992,6 +36037,21 @@ type BareMetalServer struct { Zone *ZoneReference `json:"zone" validate:"required"` } +// Constants associated with the BareMetalServer.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 ( + BareMetalServerHealthStateDegradedConst = "degraded" + BareMetalServerHealthStateFaultedConst = "faulted" + BareMetalServerHealthStateInapplicableConst = "inapplicable" + BareMetalServerHealthStateOkConst = "ok" +) + // Constants associated with the BareMetalServer.LifecycleState property. // The lifecycle state of the bare metal server. const ( @@ -36079,6 +36139,16 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "firmware-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "health_reasons", &obj.HealthReasons, UnmarshalBareMetalServerHealthReason) + 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()) @@ -36134,6 +36204,16 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "reservation", &obj.Reservation, UnmarshalReservationReference) + if err != nil { + err = core.SDKErrorf(err, "", "reservation-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalBareMetalServerReservationAffinity) + if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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()) @@ -36587,6 +36667,49 @@ func UnmarshalBareMetalServerFirmware(m map[string]json.RawMessage, result inter return } +// BareMetalServerHealthReason : BareMetalServerHealthReason struct +type BareMetalServerHealthReason 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"` +} + +// Constants associated with the BareMetalServerHealthReason.Code property. +// A reason code for this health state. +const ( + BareMetalServerHealthReasonCodeReservationCapacityUnavailableConst = "reservation_capacity_unavailable" + BareMetalServerHealthReasonCodeReservationDeletedConst = "reservation_deleted" + BareMetalServerHealthReasonCodeReservationExpiredConst = "reservation_expired" + BareMetalServerHealthReasonCodeReservationFailedConst = "reservation_failed" +) + +// UnmarshalBareMetalServerHealthReason unmarshals an instance of BareMetalServerHealthReason from the specified map of raw messages. +func UnmarshalBareMetalServerHealthReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerHealthReason) + 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 +} + // BareMetalServerInitialization : BareMetalServerInitialization struct type BareMetalServerInitialization struct { // The image the bare metal server was provisioned from. @@ -38096,6 +38219,8 @@ type BareMetalServerPatch struct { // the name will not affect the system hostname. Name *string `json:"name,omitempty"` + ReservationAffinity *BareMetalServerReservationAffinityPatch `json:"reservation_affinity,omitempty"` + TrustedPlatformModule *BareMetalServerTrustedPlatformModulePatch `json:"trusted_platform_module,omitempty"` } @@ -38117,6 +38242,11 @@ func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interfac err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalBareMetalServerReservationAffinityPatch) + if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModulePatch) if err != nil { err = core.SDKErrorf(err, "", "trusted_platform_module-error", common.GetComponentInfo()) @@ -38138,6 +38268,9 @@ func (bareMetalServerPatch *BareMetalServerPatch) AsPatch() (_patch map[string]i if !core.IsNil(bareMetalServerPatch.Name) { _patch["name"] = bareMetalServerPatch.Name } + if !core.IsNil(bareMetalServerPatch.ReservationAffinity) { + _patch["reservation_affinity"] = bareMetalServerPatch.ReservationAffinity.asPatch() + } if !core.IsNil(bareMetalServerPatch.TrustedPlatformModule) { _patch["trusted_platform_module"] = bareMetalServerPatch.TrustedPlatformModule.asPatch() } @@ -38395,6 +38528,8 @@ type BareMetalServerProfile struct { OsArchitecture *BareMetalServerProfileOsArchitecture `json:"os_architecture" validate:"required"` + ReservationTerms *BareMetalServerProfileReservationTerms `json:"reservation_terms" validate:"required"` + // The resource type. ResourceType *string `json:"resource_type" validate:"required"` @@ -38479,6 +38614,11 @@ func UnmarshalBareMetalServerProfile(m map[string]json.RawMessage, result interf err = core.SDKErrorf(err, "", "os_architecture-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "reservation_terms", &obj.ReservationTerms, UnmarshalBareMetalServerProfileReservationTerms) + if err != nil { + err = core.SDKErrorf(err, "", "reservation_terms-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { err = core.SDKErrorf(err, "", "resource_type-error", common.GetComponentInfo()) @@ -39465,6 +39605,44 @@ func UnmarshalBareMetalServerProfileReference(m map[string]json.RawMessage, resu return } +// BareMetalServerProfileReservationTerms : BareMetalServerProfileReservationTerms struct +type BareMetalServerProfileReservationTerms struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported committed use terms for a reservation using this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the BareMetalServerProfileReservationTerms.Type property. +// The type for this profile field. +const ( + BareMetalServerProfileReservationTermsTypeEnumConst = "enum" +) + +// Constants associated with the BareMetalServerProfileReservationTerms.Values property. +const ( + BareMetalServerProfileReservationTermsValuesOneYearConst = "one_year" + BareMetalServerProfileReservationTermsValuesThreeYearConst = "three_year" +) + +// UnmarshalBareMetalServerProfileReservationTerms unmarshals an instance of BareMetalServerProfileReservationTerms from the specified map of raw messages. +func UnmarshalBareMetalServerProfileReservationTerms(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerProfileReservationTerms) + 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 +} + // 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. @@ -39582,6 +39760,8 @@ type BareMetalServerPrototype struct { // to use for this bare metal server. Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` + ReservationAffinity *BareMetalServerReservationAffinityPrototype `json:"reservation_affinity,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"` @@ -39646,6 +39826,11 @@ func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result inte err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalBareMetalServerReservationAffinityPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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()) @@ -39690,15 +39875,183 @@ func UnmarshalBareMetalServerPrototype(m map[string]json.RawMessage, result inte return } +// BareMetalServerReservationAffinity : BareMetalServerReservationAffinity struct +type BareMetalServerReservationAffinity struct { + // The reservation affinity policy to use for this bare metal server: + // - `disabled`: Reservations will not be used + // - `manual`: Reservations in `pool` are available for use + // - `automatic`: Any reservations with an `affinity_policy` of `automatic` + // that have the same `profile` and `zone` as this bare metal server + // are available for use. + Policy *string `json:"policy" validate:"required"` + + // The pool of reservations available for use by this bare metal server when the `policy` is `manual`. This must be + // empty if the `policy` is `automatic` or + // `disabled`. + Pool []ReservationReference `json:"pool" validate:"required"` +} + +// Constants associated with the BareMetalServerReservationAffinity.Policy property. +// The reservation affinity policy to use for this bare metal server: +// - `disabled`: Reservations will not be used +// - `manual`: Reservations in `pool` are available for use +// - `automatic`: Any reservations with an `affinity_policy` of `automatic` +// that have the same `profile` and `zone` as this bare metal server +// are available for use. +const ( + BareMetalServerReservationAffinityPolicyAutomaticConst = "automatic" + BareMetalServerReservationAffinityPolicyDisabledConst = "disabled" + BareMetalServerReservationAffinityPolicyManualConst = "manual" +) + +// UnmarshalBareMetalServerReservationAffinity unmarshals an instance of BareMetalServerReservationAffinity from the specified map of raw messages. +func UnmarshalBareMetalServerReservationAffinity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerReservationAffinity) + err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) + if err != nil { + err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationReference) + if err != nil { + err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerReservationAffinityPatch : BareMetalServerReservationAffinityPatch struct +type BareMetalServerReservationAffinityPatch struct { + // The reservation affinity policy to use for this bare metal server: + // - `disabled`: Reservations will not be used + // - `manual`: Reservations in `pool` will be available for use + // - `automatic`: Any reservations with an `affinity_policy` of `automatic` that have the + // same `profile` and `zone` as this bare metal server are available for use. + Policy *string `json:"policy,omitempty"` + + // The pool of reservations available for use by this bare metal server, replacing the existing pool of reservations. + // + // Specified reservations must have a `status` of `active`, and have the same + // `profile` and `zone` as this bare metal server. + // + // If `policy` is `manual`, `pool` must have one reservation. If `policy` is `disabled` or `automatic`, `pool` must be + // empty. If `policy` is `manual`, the `pool` must contain a reservation with available capacity. + Pool []ReservationIdentityIntf `json:"pool,omitempty"` +} + +// Constants associated with the BareMetalServerReservationAffinityPatch.Policy property. +// The reservation affinity policy to use for this bare metal server: +// - `disabled`: Reservations will not be used +// - `manual`: Reservations in `pool` will be available for use +// - `automatic`: Any reservations with an `affinity_policy` of `automatic` that have the +// same `profile` and `zone` as this bare metal server are available for use. +const ( + BareMetalServerReservationAffinityPatchPolicyAutomaticConst = "automatic" + BareMetalServerReservationAffinityPatchPolicyDisabledConst = "disabled" + BareMetalServerReservationAffinityPatchPolicyManualConst = "manual" +) + +// UnmarshalBareMetalServerReservationAffinityPatch unmarshals an instance of BareMetalServerReservationAffinityPatch from the specified map of raw messages. +func UnmarshalBareMetalServerReservationAffinityPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerReservationAffinityPatch) + err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) + if err != nil { + err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the BareMetalServerReservationAffinityPatch +func (bareMetalServerReservationAffinityPatch *BareMetalServerReservationAffinityPatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(bareMetalServerReservationAffinityPatch.Policy) { + _patch["policy"] = bareMetalServerReservationAffinityPatch.Policy + } + if !core.IsNil(bareMetalServerReservationAffinityPatch.Pool) { + var poolPatches []map[string]interface{} + for _, pool := range bareMetalServerReservationAffinityPatch.Pool { + poolPatches = append(poolPatches, pool.asPatch()) + } + _patch["pool"] = poolPatches + } + + return +} + +// BareMetalServerReservationAffinityPrototype : BareMetalServerReservationAffinityPrototype struct +type BareMetalServerReservationAffinityPrototype struct { + // The reservation affinity policy to use for this bare metal server: + // - `disabled`: Reservations will not be used + // - `manual`: Reservations in `pool` will be available for use + // - `automatic`: Any reservations with an `affinity_policy` of `automatic` that have the + // same `profile` and `zone` as this bare metal server are available for use. + // + // The policy will default to `manual` if `pool` is not empty. Otherwise the policy will default to `automatic`. + Policy *string `json:"policy,omitempty"` + + // The pool of reservations available for use by this bare metal server. + // + // Specified reservations must have a `status` of `active`, and have the same `profile` and `zone` as this bare metal + // server. + // + // If `policy` is `manual`, `pool` must have one reservation. If `policy` is `disabled` or `automatic`, `pool` must be + // empty. If `policy` is `manual`, the `pool` must contain a reservation with available capacity. + Pool []ReservationIdentityIntf `json:"pool,omitempty"` +} + +// Constants associated with the BareMetalServerReservationAffinityPrototype.Policy property. +// The reservation affinity policy to use for this bare metal server: +// - `disabled`: Reservations will not be used +// - `manual`: Reservations in `pool` will be available for use +// - `automatic`: Any reservations with an `affinity_policy` of `automatic` that have the +// same `profile` and `zone` as this bare metal server are available for use. +// +// The policy will default to `manual` if `pool` is not empty. Otherwise the policy will default to `automatic`. +const ( + BareMetalServerReservationAffinityPrototypePolicyAutomaticConst = "automatic" + BareMetalServerReservationAffinityPrototypePolicyDisabledConst = "disabled" + BareMetalServerReservationAffinityPrototypePolicyManualConst = "manual" +) + +// UnmarshalBareMetalServerReservationAffinityPrototype unmarshals an instance of BareMetalServerReservationAffinityPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerReservationAffinityPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerReservationAffinityPrototype) + err = core.UnmarshalPrimitive(m, "policy", &obj.Policy) + if err != nil { + err = core.SDKErrorf(err, "", "policy-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "pool", &obj.Pool, UnmarshalReservationIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "pool-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BareMetalServerStatusReason : BareMetalServerStatusReason struct type BareMetalServerStatusReason struct { // The status reason code: + // - `cannot_reinitialize`: An error occurred while reinitializing bare metal server // - `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 + // - `cannot_start_reservation_capacity`: Failed to start because the reservation has + // insufficient capacity + // - `cannot_start_reservation_expired`: Failed to start because the reservation has + // expired // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -39713,23 +40066,30 @@ type BareMetalServerStatusReason struct { // 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 +// - `cannot_reinitialize`: An error occurred while reinitializing bare metal server +// - `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 +// - `cannot_start_reservation_capacity`: Failed to start because the reservation has +// insufficient capacity +// - `cannot_start_reservation_expired`: Failed to start because the reservation has +// expired // // 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" + BareMetalServerStatusReasonCodeCannotReinitializeConst = "cannot_reinitialize" + BareMetalServerStatusReasonCodeCannotStartConst = "cannot_start" + BareMetalServerStatusReasonCodeCannotStartCapacityConst = "cannot_start_capacity" + BareMetalServerStatusReasonCodeCannotStartComputeConst = "cannot_start_compute" + BareMetalServerStatusReasonCodeCannotStartIPAddressConst = "cannot_start_ip_address" + BareMetalServerStatusReasonCodeCannotStartNetworkConst = "cannot_start_network" + BareMetalServerStatusReasonCodeCannotStartReservationCapacityConst = "cannot_start_reservation_capacity" + BareMetalServerStatusReasonCodeCannotStartReservationExpiredConst = "cannot_start_reservation_expired" + BareMetalServerStatusReasonCodeCannotUpdateFirmwareConst = "cannot_update_firmware" ) // UnmarshalBareMetalServerStatusReason unmarshals an instance of BareMetalServerStatusReason from the specified map of raw messages. @@ -43965,7 +44325,8 @@ type CreateInstanceVolumeAttachmentOptions struct { // The virtual server instance identifier. InstanceID *string `json:"instance_id" validate:"required,ne="` - // An existing volume to attach to the instance, or a prototype object for a new volume. + // The volume to use for this attachment. This can be specified as an existing unattached + // volume, or a prototype object for a new volume. Volume VolumeAttachmentPrototypeVolumeIntf `json:"volume" validate:"required"` // Indicates whether deleting the instance will also delete the attached volume. @@ -44158,11 +44519,13 @@ func (options *CreateIpsecPolicyOptions) SetHeaders(param map[string]string) *Cr // CreateKeyOptions : The CreateKey options. type CreateKeyOptions struct { - // A unique public SSH key to import, in OpenSSH format (consisting of three space-separated fields: the algorithm - // name, base64-encoded key, and a comment). The algorithm and comment fields may be omitted, as only the key field is - // imported. + // The public SSH key to use, in OpenSSH format (consisting of three space-separated fields: the algorithm name, + // base64-encoded key value, and a comment). The algorithm and comment fields may be omitted, as only the key field is + // used. + // + // The key field must not match another key in the region. // - // Keys of type `rsa` may be 2048 or 4096 bits in length, however 4096 is recommended. Keys of type `ed25519` are 256 + // Keys of type `rsa` must be 2048 or 4096 bits in length (4096 is recommended). Keys of type `ed25519` must be 256 // bits in length. PublicKey *string `json:"public_key" validate:"required"` @@ -44257,7 +44620,7 @@ type CreateLoadBalancerListenerOptions struct { // 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. + // Supported 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 @@ -45397,14 +45760,17 @@ type CreateReservationOptions struct { // The committed use configuration to use for this reservation. CommittedUse *ReservationCommittedUsePrototype `json:"committed_use" validate:"required"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this - // reservation. + // The [instance profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) or + // [bare metal server + // profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) + // to use for this reservation. Profile *ReservationProfilePrototype `json:"profile" validate:"required"` // The zone to use for this reservation. Zone ZoneIdentityIntf `json:"zone" validate:"required"` // The affinity policy to use for this reservation: + // - `automatic`: The reservation will be automatically selected // - `restricted`: The reservation must be manually requested. AffinityPolicy *string `json:"affinity_policy,omitempty"` @@ -45422,8 +45788,10 @@ type CreateReservationOptions struct { // Constants associated with the CreateReservationOptions.AffinityPolicy property. // The affinity policy to use for this reservation: +// - `automatic`: The reservation will be automatically selected // - `restricted`: The reservation must be manually requested. const ( + CreateReservationOptionsAffinityPolicyAutomaticConst = "automatic" CreateReservationOptionsAffinityPolicyRestrictedConst = "restricted" ) @@ -63422,7 +63790,8 @@ type InstanceHealthReason struct { // - `reservation_expired`: The reservation affinity pool has an expired reservation. // - `reservation_failed`: The reservation affinity pool has a failed reservation. // - // The enumerated values for this property may + // See [health status reasons](https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons) for details. 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"` @@ -63441,7 +63810,8 @@ type InstanceHealthReason struct { // - `reservation_expired`: The reservation affinity pool has an expired reservation. // - `reservation_failed`: The reservation affinity pool has a failed reservation. // -// The enumerated values for this property may +// See [health status reasons](https://cloud.ibm.com/docs/vpc?topic=vpc-server-health-status-reasons) for details. The +// enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( InstanceHealthReasonCodeReservationCapacityUnavailableConst = "reservation_capacity_unavailable" @@ -66678,21 +67048,30 @@ func UnmarshalInstanceReference(m map[string]json.RawMessage, result interface{} // InstanceReservationAffinity : InstanceReservationAffinity struct type InstanceReservationAffinity struct { // The reservation affinity policy to use for this virtual server instance: + // - `automatic`: Any reservations with an `affinity_policy` of `automatic` + // that have the same `profile` and `zone` as this virtual server instance + // are available for use. // - `disabled`: Reservations will not be used // - `manual`: Reservations in `pool` are available for use. Policy *string `json:"policy" validate:"required"` - // The pool of reservations available for use by this virtual server instance. + // The pool of reservations available for use by this virtual server instance when the `policy` is `manual`. This must + // be empty if the `policy` is `automatic` or + // `disabled`. Pool []ReservationReference `json:"pool" validate:"required"` } // Constants associated with the InstanceReservationAffinity.Policy property. // The reservation affinity policy to use for this virtual server instance: -// - `disabled`: Reservations will not be used -// - `manual`: Reservations in `pool` are available for use. +// - `automatic`: Any reservations with an `affinity_policy` of `automatic` +// that have the same `profile` and `zone` as this virtual server instance +// are available for use. +// - `disabled`: Reservations will not be used +// - `manual`: Reservations in `pool` are available for use. const ( - InstanceReservationAffinityPolicyDisabledConst = "disabled" - InstanceReservationAffinityPolicyManualConst = "manual" + InstanceReservationAffinityPolicyAutomaticConst = "automatic" + InstanceReservationAffinityPolicyDisabledConst = "disabled" + InstanceReservationAffinityPolicyManualConst = "manual" ) // UnmarshalInstanceReservationAffinity unmarshals an instance of InstanceReservationAffinity from the specified map of raw messages. @@ -66715,6 +67094,9 @@ func UnmarshalInstanceReservationAffinity(m map[string]json.RawMessage, result i // InstanceReservationAffinityPatch : InstanceReservationAffinityPatch struct type InstanceReservationAffinityPatch struct { // The reservation affinity policy to use for this virtual server instance: + // - `automatic`: Any reservations with an `affinity_policy` of `automatic` + // that have the same `profile` and `zone` as this virtual server instance + // are available for use. // - `disabled`: Reservations will not be used // - `manual`: Reservations in `pool` will be available for use // @@ -66724,22 +67106,27 @@ type InstanceReservationAffinityPatch struct { // The pool of reservations available for use by this virtual server instance, replacing the existing pool of // reservations. // - // Specified reservations must have a `status` of `active`, and have the same - // `profile` and `zone` as this virtual server instance. + // Specified reservations must have a `status` of `active`, and have the same `profile` and `zone` as this virtual + // server instance. // - // If `policy` is `manual`, `pool` must have one reservation. If `policy` is `disabled`, `pool` must be empty. + // If `policy` is `manual`, `pool` must have one reservation. If `policy` is `disabled` or `automatic`, `pool` must be + // empty. If `policy` is `manual`, the `pool` must contain a reservation with available capacity. Pool []ReservationIdentityIntf `json:"pool,omitempty"` } // Constants associated with the InstanceReservationAffinityPatch.Policy property. // The reservation affinity policy to use for this virtual server instance: -// - `disabled`: Reservations will not be used -// - `manual`: Reservations in `pool` will be available for use +// - `automatic`: Any reservations with an `affinity_policy` of `automatic` +// that have the same `profile` and `zone` as this virtual server instance +// are available for use. +// - `disabled`: Reservations will not be used +// - `manual`: Reservations in `pool` will be available for use // // The policy must be `disabled` if `placement_target` is set. const ( - InstanceReservationAffinityPatchPolicyDisabledConst = "disabled" - InstanceReservationAffinityPatchPolicyManualConst = "manual" + InstanceReservationAffinityPatchPolicyAutomaticConst = "automatic" + InstanceReservationAffinityPatchPolicyDisabledConst = "disabled" + InstanceReservationAffinityPatchPolicyManualConst = "manual" ) // UnmarshalInstanceReservationAffinityPatch unmarshals an instance of InstanceReservationAffinityPatch from the specified map of raw messages. @@ -66781,29 +67168,41 @@ type InstanceReservationAffinityPrototype struct { // The reservation affinity policy to use for this virtual server instance: // - `disabled`: Reservations will not be used // - `manual`: Reservations in `pool` will be available for use + // - `automatic`: Reservations with an `affinity_policy` of `automatic` that have the same + // `profile` and `zone` as this virtual server instance will be available for use. + // + // The policy will default to `manual` if `pool` is not empty. The policy will default to + // `disabled` if a `placement_target` is set. The policy will default to `automatic` in all other cases. // - // The policy will default to `manual` if `pool` is not empty, and `disabled` otherwise. + // The policy must be `disabled` if `placement_target` is specified. Policy *string `json:"policy,omitempty"` // The pool of reservations available for use by this virtual server instance. // - // Specified reservations must have a `status` of `active`, and have the same - // `profile` and `zone` as this virtual server instance. + // Specified reservations must have a `status` of `active`, and have the same `profile` and `zone` as this virtual + // server instance. // - // If `policy` is `manual`, a pool must be specified with at least one reservation. If - // `policy` is `disabled` and a pool is specified, it must be empty. + // If `policy` is `manual`, `pool` must be specified with one reservation. If `policy` is `disabled` or `automatic` and + // `pool` is specified, it must be empty. If `policy` is `manual`, the `pool` must contain a reservation with available + // capacity. Pool []ReservationIdentityIntf `json:"pool,omitempty"` } // Constants associated with the InstanceReservationAffinityPrototype.Policy property. // The reservation affinity policy to use for this virtual server instance: -// - `disabled`: Reservations will not be used -// - `manual`: Reservations in `pool` will be available for use +// - `disabled`: Reservations will not be used +// - `manual`: Reservations in `pool` will be available for use +// - `automatic`: Reservations with an `affinity_policy` of `automatic` that have the same +// `profile` and `zone` as this virtual server instance will be available for use. +// +// The policy will default to `manual` if `pool` is not empty. The policy will default to +// `disabled` if a `placement_target` is set. The policy will default to `automatic` in all other cases. // -// The policy will default to `manual` if `pool` is not empty, and `disabled` otherwise. +// The policy must be `disabled` if `placement_target` is specified. const ( - InstanceReservationAffinityPrototypePolicyDisabledConst = "disabled" - InstanceReservationAffinityPrototypePolicyManualConst = "manual" + InstanceReservationAffinityPrototypePolicyAutomaticConst = "automatic" + InstanceReservationAffinityPrototypePolicyDisabledConst = "disabled" + InstanceReservationAffinityPrototypePolicyManualConst = "manual" ) // UnmarshalInstanceReservationAffinityPrototype unmarshals an instance of InstanceReservationAffinityPrototype from the specified map of raw messages. @@ -68503,6 +68902,15 @@ type ListBareMetalServersOptions struct { // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` + // Filters the collection to resources with a `reservation.id` property matching the specified identifier. + ReservationID *string `json:"reservation.id,omitempty"` + + // Filters the collection to resources with a `reservation.crn` property matching the specified identifier. + ReservationCRN *string `json:"reservation.crn,omitempty"` + + // Filters the collection to resources with a `reservation.name` property matching the specified identifier. + ReservationName *string `json:"reservation.name,omitempty"` + // Filters the collection to resources with a `vpc.id` property matching the specified identifier. VPCID *string `json:"vpc.id,omitempty"` @@ -68545,6 +68953,24 @@ func (_options *ListBareMetalServersOptions) SetName(name string) *ListBareMetal return _options } +// SetReservationID : Allow user to set ReservationID +func (_options *ListBareMetalServersOptions) SetReservationID(reservationID string) *ListBareMetalServersOptions { + _options.ReservationID = core.StringPtr(reservationID) + return _options +} + +// SetReservationCRN : Allow user to set ReservationCRN +func (_options *ListBareMetalServersOptions) SetReservationCRN(reservationCRN string) *ListBareMetalServersOptions { + _options.ReservationCRN = core.StringPtr(reservationCRN) + return _options +} + +// SetReservationName : Allow user to set ReservationName +func (_options *ListBareMetalServersOptions) SetReservationName(reservationName string) *ListBareMetalServersOptions { + _options.ReservationName = core.StringPtr(reservationName) + return _options +} + // SetVPCID : Allow user to set VPCID func (_options *ListBareMetalServersOptions) SetVPCID(vpcID string) *ListBareMetalServersOptions { _options.VPCID = core.StringPtr(vpcID) @@ -70307,6 +70733,9 @@ type ListInstancesOptions struct { // group name. PlacementGroupName *string `json:"placement_group.name,omitempty"` + // Filters the collection to instances with a `reservation_affinity.policy` property matching the specified value. + ReservationAffinityPolicy *string `json:"reservation_affinity.policy,omitempty"` + // Filters the collection to resources with a `reservation.id` property matching the specified identifier. ReservationID *string `json:"reservation.id,omitempty"` @@ -70329,6 +70758,14 @@ type ListInstancesOptions struct { Headers map[string]string } +// Constants associated with the ListInstancesOptions.ReservationAffinityPolicy property. +// Filters the collection to instances with a `reservation_affinity.policy` property matching the specified value. +const ( + ListInstancesOptionsReservationAffinityPolicyAutomaticConst = "automatic" + ListInstancesOptionsReservationAffinityPolicyDisabledConst = "disabled" + ListInstancesOptionsReservationAffinityPolicyManualConst = "manual" +) + // NewListInstancesOptions : Instantiate ListInstancesOptions func (*VpcV1) NewListInstancesOptions() *ListInstancesOptions { return &ListInstancesOptions{} @@ -70412,6 +70849,12 @@ func (_options *ListInstancesOptions) SetPlacementGroupName(placementGroupName s return _options } +// SetReservationAffinityPolicy : Allow user to set ReservationAffinityPolicy +func (_options *ListInstancesOptions) SetReservationAffinityPolicy(reservationAffinityPolicy string) *ListInstancesOptions { + _options.ReservationAffinityPolicy = core.StringPtr(reservationAffinityPolicy) + return _options +} + // SetReservationID : Allow user to set ReservationID func (_options *ListInstancesOptions) SetReservationID(reservationID string) *ListInstancesOptions { _options.ReservationID = core.StringPtr(reservationID) @@ -71347,6 +71790,12 @@ type ListReservationsOptions struct { // Filters the collection to resources with a `name` property matching the exact specified name. Name *string `json:"name,omitempty"` + // Filters the collection of resources with a `profile.resource_type` property matching the specified value. + ProfileResourceType *string `json:"profile.resource_type,omitempty"` + + // Filters the collection to reservations with an `affinity_policy` property matching the specified value. + AffinityPolicy *string `json:"affinity_policy,omitempty"` + // Filters the collection to resources with a `resource_group.id` property matching the specified identifier. ResourceGroupID *string `json:"resource_group.id,omitempty"` @@ -71357,6 +71806,13 @@ type ListReservationsOptions struct { Headers map[string]string } +// Constants associated with the ListReservationsOptions.AffinityPolicy property. +// Filters the collection to reservations with an `affinity_policy` property matching the specified value. +const ( + ListReservationsOptionsAffinityPolicyAutomaticConst = "automatic" + ListReservationsOptionsAffinityPolicyRestrictedConst = "restricted" +) + // NewListReservationsOptions : Instantiate ListReservationsOptions func (*VpcV1) NewListReservationsOptions() *ListReservationsOptions { return &ListReservationsOptions{} @@ -71380,6 +71836,18 @@ func (_options *ListReservationsOptions) SetName(name string) *ListReservationsO return _options } +// SetProfileResourceType : Allow user to set ProfileResourceType +func (_options *ListReservationsOptions) SetProfileResourceType(profileResourceType string) *ListReservationsOptions { + _options.ProfileResourceType = core.StringPtr(profileResourceType) + return _options +} + +// SetAffinityPolicy : Allow user to set AffinityPolicy +func (_options *ListReservationsOptions) SetAffinityPolicy(affinityPolicy string) *ListReservationsOptions { + _options.AffinityPolicy = core.StringPtr(affinityPolicy) + return _options +} + // SetResourceGroupID : Allow user to set ResourceGroupID func (_options *ListReservationsOptions) SetResourceGroupID(resourceGroupID string) *ListReservationsOptions { _options.ResourceGroupID = core.StringPtr(resourceGroupID) @@ -75651,7 +76119,7 @@ type LoadBalancerListenerPrototypeLoadBalancerContext struct { // 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. + // Supported for load balancers in the `application` family. ConnectionLimit *int64 `json:"connection_limit,omitempty"` // The default pool for this listener. If `https_redirect` is specified, @@ -82453,6 +82921,7 @@ func (options *ReplaceSubnetRoutingTableOptions) SetHeaders(param map[string]str // Reservation : Reservation struct type Reservation struct { // The affinity policy to use for this reservation: + // - `automatic`: The reservation will be automatically selected // - `restricted`: The reservation must be manually requested // // The enumerated values for this property may @@ -82487,8 +82956,11 @@ type Reservation struct { // The name for this reservation. The name is unique across all reservations in the region. Name *string `json:"name" validate:"required"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this reservation. - Profile *ReservationProfile `json:"profile" validate:"required"` + // The [instance profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) or + // [bare metal server + // profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) + // for this reservation. + Profile ReservationProfileIntf `json:"profile" validate:"required"` // The resource group for this reservation. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` @@ -82511,11 +82983,13 @@ type Reservation struct { // Constants associated with the Reservation.AffinityPolicy property. // The affinity policy to use for this reservation: +// - `automatic`: The reservation will be automatically selected // - `restricted`: The reservation must be manually requested // // The enumerated values for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( + ReservationAffinityPolicyAutomaticConst = "automatic" ReservationAffinityPolicyRestrictedConst = "restricted" ) @@ -83078,6 +83552,13 @@ func (reservationIdentity *ReservationIdentity) asPatch() (_patch map[string]int // ReservationPatch : ReservationPatch struct type ReservationPatch struct { + // The affinity policy to use for this reservation: + // - `automatic`: The reservation will be automatically selected + // - `restricted`: The reservation must be manually requested + // + // The affinity policy can only be changed for a reservation with a `status` of `inactive`. + AffinityPolicy *string `json:"affinity_policy,omitempty"` + // The capacity reservation configuration to use. // // The configuration can only be changed for reservations with a `status` of `inactive`. @@ -83089,14 +83570,32 @@ type ReservationPatch struct { // The name for this reservation. The name must not be used by another reservation in the region. Name *string `json:"name,omitempty"` - // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this - // reservation. + // The [instance profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) or + // [bare metal server + // profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) + // to use for this reservation. Profile *ReservationProfilePatch `json:"profile,omitempty"` } +// Constants associated with the ReservationPatch.AffinityPolicy property. +// The affinity policy to use for this reservation: +// - `automatic`: The reservation will be automatically selected +// - `restricted`: The reservation must be manually requested +// +// The affinity policy can only be changed for a reservation with a `status` of `inactive`. +const ( + ReservationPatchAffinityPolicyAutomaticConst = "automatic" + ReservationPatchAffinityPolicyRestrictedConst = "restricted" +) + // UnmarshalReservationPatch unmarshals an instance of ReservationPatch from the specified map of raw messages. func UnmarshalReservationPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ReservationPatch) + err = core.UnmarshalPrimitive(m, "affinity_policy", &obj.AffinityPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "affinity_policy-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "capacity", &obj.Capacity, UnmarshalReservationCapacityPatch) if err != nil { err = core.SDKErrorf(err, "", "capacity-error", common.GetComponentInfo()) @@ -83124,6 +83623,9 @@ 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) { _patch = map[string]interface{}{} + if !core.IsNil(reservationPatch.AffinityPolicy) { + _patch["affinity_policy"] = reservationPatch.AffinityPolicy + } if !core.IsNil(reservationPatch.Capacity) { _patch["capacity"] = reservationPatch.Capacity.asPatch() } @@ -83140,16 +83642,21 @@ func (reservationPatch *ReservationPatch) AsPatch() (_patch map[string]interface return } -// ReservationProfile : The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) for this reservation. +// ReservationProfile : The [instance profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) or +// [bare metal server profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) for this +// reservation. +// Models which "extend" this model: +// - ReservationProfileInstanceProfileReference +// - ReservationProfileBareMetalServerProfileReference type ReservationProfile struct { // The URL for this virtual server instance profile. - Href *string `json:"href" validate:"required"` + Href *string `json:"href,omitempty"` // The globally unique name for this virtual server instance profile. - Name *string `json:"name" validate:"required"` + Name *string `json:"name,omitempty"` // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + ResourceType *string `json:"resource_type,omitempty"` } // Constants associated with the ReservationProfile.ResourceType property. @@ -83158,6 +83665,14 @@ const ( ReservationProfileResourceTypeInstanceProfileConst = "instance_profile" ) +func (*ReservationProfile) isaReservationProfile() bool { + return true +} + +type ReservationProfileIntf interface { + isaReservationProfile() bool +} + // UnmarshalReservationProfile unmarshals an instance of ReservationProfile from the specified map of raw messages. func UnmarshalReservationProfile(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(ReservationProfile) @@ -83180,7 +83695,9 @@ func UnmarshalReservationProfile(m map[string]json.RawMessage, result interface{ return } -// ReservationProfilePatch : The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this reservation. +// ReservationProfilePatch : The [instance profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) or +// [bare metal server profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) to use for this +// reservation. type ReservationProfilePatch struct { // The globally unique name of the profile. Name *string `json:"name,omitempty"` @@ -83192,7 +83709,8 @@ type ReservationProfilePatch struct { // Constants associated with the ReservationProfilePatch.ResourceType property. // The resource type of the profile. const ( - ReservationProfilePatchResourceTypeInstanceProfileConst = "instance_profile" + ReservationProfilePatchResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" + ReservationProfilePatchResourceTypeInstanceProfileConst = "instance_profile" ) // UnmarshalReservationProfilePatch unmarshals an instance of ReservationProfilePatch from the specified map of raw messages. @@ -83225,7 +83743,9 @@ func (reservationProfilePatch *ReservationProfilePatch) asPatch() (_patch map[st return } -// ReservationProfilePrototype : The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) to use for this reservation. +// ReservationProfilePrototype : The [instance profile](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles) or +// [bare metal server profile](https://cloud.ibm.com/docs/vpc?topic=vpc-bare-metal-servers-profile) to use for this +// reservation. type ReservationProfilePrototype struct { // The globally unique name of the profile. Name *string `json:"name" validate:"required"` @@ -83237,7 +83757,8 @@ type ReservationProfilePrototype struct { // Constants associated with the ReservationProfilePrototype.ResourceType property. // The resource type of the profile. const ( - ReservationProfilePrototypeResourceTypeInstanceProfileConst = "instance_profile" + ReservationProfilePrototypeResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" + ReservationProfilePrototypeResourceTypeInstanceProfileConst = "instance_profile" ) // NewReservationProfilePrototype : Instantiate ReservationProfilePrototype (Generic Model Constructor) @@ -94895,7 +95416,10 @@ type VPC struct { CRN *string `json:"crn" validate:"required"` // The CSE ([Cloud Service Endpoint](https://cloud.ibm.com/docs/resources?topic=resources-service-endpoints)) source IP - // addresses for the VPC. The VPC will have one CSE source IP address per zone. + // addresses for the VPC. The VPC will have at least one CSE source IP address per zone. + // + // The maximum number of items for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. CseSourceIps []VpccseSourceIP `json:"cse_source_ips,omitempty"` // The default network ACL to use for subnets created in this VPC. @@ -95068,7 +95592,7 @@ func UnmarshalVPC(m map[string]json.RawMessage, result interface{}) (err error) // VpccseSourceIP : VpccseSourceIP struct type VpccseSourceIP struct { - // The cloud service endpoint source IP address for this zone. + // A cloud service endpoint source IP address for this zone. IP *IP `json:"ip" validate:"required"` // The zone this cloud service endpoint source IP resides in. @@ -100628,6 +101152,14 @@ type Volume struct { AttachmentState *string `json:"attachment_state" validate:"required"` // The maximum bandwidth (in megabits per second) for the volume. + // + // For a volume with a `storage_generation` of `1`, the + // [bandwidth is calculated] + // (https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-bandwidth#attached-block-vol-bandwidth) from the `iops` + // value. + // + // The minimum and maximum limits for this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Bandwidth *int64 `json:"bandwidth" validate:"required"` // Indicates whether this volume is performing an operation that must be serialized. This must be `false` to perform an @@ -101162,7 +101694,8 @@ type VolumeAttachmentPrototype struct { // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // An existing volume to attach to the instance, or a prototype object for a new volume. + // The volume to use for this attachment. This can be specified as an existing unattached + // volume, or a prototype object for a new volume. Volume VolumeAttachmentPrototypeVolumeIntf `json:"volume" validate:"required"` } @@ -101303,7 +101836,7 @@ type VolumeAttachmentPrototypeInstanceByVolumeContext struct { // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` - // An existing volume to attach. + // An existing unattached volume. Volume VolumeIdentityIntf `json:"volume" validate:"required"` } @@ -101341,7 +101874,8 @@ func UnmarshalVolumeAttachmentPrototypeInstanceByVolumeContext(m map[string]json return } -// VolumeAttachmentPrototypeVolume : An existing volume to attach to the instance, or a prototype object for a new volume. +// VolumeAttachmentPrototypeVolume : The volume to use for this attachment. This can be specified as an existing unattached volume, or a prototype object +// for a new volume. // Models which "extend" this model: // - VolumeAttachmentPrototypeVolumeVolumeIdentity // - VolumeAttachmentPrototypeVolumeVolumePrototypeInstanceContext @@ -107399,6 +107933,8 @@ type BareMetalServerPrototypeBareMetalServerByNetworkAttachment struct { // server. Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` + ReservationAffinity *BareMetalServerReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` @@ -107466,6 +108002,11 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkAttachment(m map[s err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalBareMetalServerReservationAffinityPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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()) @@ -107524,6 +108065,8 @@ type BareMetalServerPrototypeBareMetalServerByNetworkInterface struct { // server. Profile BareMetalServerProfileIdentityIntf `json:"profile" validate:"required"` + ReservationAffinity *BareMetalServerReservationAffinityPrototype `json:"reservation_affinity,omitempty"` + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` TrustedPlatformModule *BareMetalServerTrustedPlatformModulePrototype `json:"trusted_platform_module,omitempty"` @@ -107591,6 +108134,11 @@ func UnmarshalBareMetalServerPrototypeBareMetalServerByNetworkInterface(m map[st err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "reservation_affinity", &obj.ReservationAffinity, UnmarshalBareMetalServerReservationAffinityPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "reservation_affinity-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()) @@ -123058,6 +123606,96 @@ func (reservationIdentityByID *ReservationIdentityByID) asPatch() (_patch map[st return } +// ReservationProfileBareMetalServerProfileReference : ReservationProfileBareMetalServerProfileReference struct +// This model "extends" ReservationProfile +type ReservationProfileBareMetalServerProfileReference struct { + // The URL for this bare metal server profile. + Href *string `json:"href" 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"` +} + +// Constants associated with the ReservationProfileBareMetalServerProfileReference.ResourceType property. +// The resource type. +const ( + ReservationProfileBareMetalServerProfileReferenceResourceTypeBareMetalServerProfileConst = "bare_metal_server_profile" +) + +func (*ReservationProfileBareMetalServerProfileReference) isaReservationProfile() bool { + return true +} + +// UnmarshalReservationProfileBareMetalServerProfileReference unmarshals an instance of ReservationProfileBareMetalServerProfileReference from the specified map of raw messages. +func UnmarshalReservationProfileBareMetalServerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationProfileBareMetalServerProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-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 +} + +// ReservationProfileInstanceProfileReference : ReservationProfileInstanceProfileReference struct +// This model "extends" ReservationProfile +type ReservationProfileInstanceProfileReference struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservationProfileInstanceProfileReference.ResourceType property. +// The resource type. +const ( + ReservationProfileInstanceProfileReferenceResourceTypeInstanceProfileConst = "instance_profile" +) + +func (*ReservationProfileInstanceProfileReference) isaReservationProfile() bool { + return true +} + +// UnmarshalReservationProfileInstanceProfileReference unmarshals an instance of ReservationProfileInstanceProfileReference from the specified map of raw messages. +func UnmarshalReservationProfileInstanceProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservationProfileInstanceProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-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 +} + // ReservedIPTargetPrototypeEndpointGatewayIdentity : ReservedIPTargetPrototypeEndpointGatewayIdentity struct // Models which "extend" this model: // - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID diff --git a/go.mod b/go.mod index 2f944d4cf9..eb431a8c5a 100644 --- a/go.mod +++ b/go.mod @@ -240,7 +240,7 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt // add sdk changes. replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.61.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.62.0 => ./common/github.com/IBM/vpc-go-sdk exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 diff --git a/go.sum b/go.sum index fa2621d224..ad7bf4bc0c 100644 --- a/go.sum +++ b/go.sum @@ -194,8 +194,6 @@ github.com/IBM/vmware-go-sdk v0.1.2 h1:5lKWFyInWz9e2hwGsoFTEoLa1jYkD30SReN0fQ10w github.com/IBM/vmware-go-sdk v0.1.2/go.mod h1:2UGPBJju3jiv5VKKBBm9a5L6bzF/aJdKOKAzJ7HaOjA= github.com/IBM/vpc-beta-go-sdk v0.8.0 h1:cEPpv4iw3Ba5W2d0AWg3TIbKeJ8y1nPuUuibR5Jt9eE= github.com/IBM/vpc-beta-go-sdk v0.8.0/go.mod h1:hORgIyTFRzXrZIK9IohaWmCRBBlYiDRagsufi7M6akE= -github.com/IBM/vpc-go-sdk v0.62.0 h1:Xga74D70ziD7nzm51ue3othHz1epMLVkGP/L6/Be+/0= -github.com/IBM/vpc-go-sdk v0.62.0/go.mod h1:VBR6bAznHsNCFA89Ue4JFQpqCcFp8F5neqbCFCyks4Q= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= From 141dff6cc2f82ae06078c1f6f789b82ad260db72 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 20 Nov 2024 08:50:48 +0530 Subject: [PATCH 101/103] breaking changes --- ibm/service/vpc/data_source_ibm_is_reservation.go | 6 +++--- ibm/service/vpc/data_source_ibm_is_reservations.go | 6 +++--- ibm/service/vpc/resource_ibm_is_reservation.go | 3 ++- ibm/service/vpc/resource_ibm_is_reservation_activate.go | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ibm/service/vpc/data_source_ibm_is_reservation.go b/ibm/service/vpc/data_source_ibm_is_reservation.go index 66b6d820bb..e7535b0421 100644 --- a/ibm/service/vpc/data_source_ibm_is_reservation.go +++ b/ibm/service/vpc/data_source_ibm_is_reservation.go @@ -310,7 +310,7 @@ func dataSourceIBMIsReservationRead(context context.Context, d *schema.ResourceD if reservation.Profile != nil { profileList := []map[string]interface{}{} profile := reservation.Profile - profileMap := dataSourceReservationProfileToMap(*profile) + profileMap := dataSourceReservationProfileToMap(profile) profileList = append(profileList, profileMap) if err = d.Set("profile", profileList); err != nil { return diag.FromErr(fmt.Errorf("[ERROR] Error setting profile: %s", err)) @@ -349,9 +349,9 @@ func dataSourceIBMIsReservationRead(context context.Context, d *schema.ResourceD return nil } -func dataSourceReservationProfileToMap(profileItem vpcv1.ReservationProfile) (profileMap map[string]interface{}) { +func dataSourceReservationProfileToMap(profileItemIntf vpcv1.ReservationProfileIntf) (profileMap map[string]interface{}) { profileMap = map[string]interface{}{} - + profileItem := profileItemIntf.(*vpcv1.ReservationProfile) if profileItem.Href != nil { profileMap["href"] = profileItem.Href } diff --git a/ibm/service/vpc/data_source_ibm_is_reservations.go b/ibm/service/vpc/data_source_ibm_is_reservations.go index 313d7625dd..bf8c75fb1b 100644 --- a/ibm/service/vpc/data_source_ibm_is_reservations.go +++ b/ibm/service/vpc/data_source_ibm_is_reservations.go @@ -341,7 +341,7 @@ func dataSourceReservationCollectionReservationsToMap(reservationsItem vpcv1.Res if reservationsItem.Profile != nil { profileList := []map[string]interface{}{} profile := reservationsItem.Profile - profileMap := dataSourceReservationCollectionReservationsProfileToMap(*profile) + profileMap := dataSourceReservationCollectionReservationsProfileToMap(profile) profileList = append(profileList, profileMap) reservationsMap["profile"] = profileList } @@ -370,9 +370,9 @@ func dataSourceReservationCollectionReservationsToMap(reservationsItem vpcv1.Res return reservationsMap } -func dataSourceReservationCollectionReservationsProfileToMap(profileItem vpcv1.ReservationProfile) (profileMap map[string]interface{}) { +func dataSourceReservationCollectionReservationsProfileToMap(profileItemIntf vpcv1.ReservationProfileIntf) (profileMap map[string]interface{}) { profileMap = map[string]interface{}{} - + profileItem := profileItemIntf.(*vpcv1.ReservationProfile) if profileItem.Href != nil { profileMap["href"] = profileItem.Href } diff --git a/ibm/service/vpc/resource_ibm_is_reservation.go b/ibm/service/vpc/resource_ibm_is_reservation.go index 0d98ac3520..a84f623c4b 100644 --- a/ibm/service/vpc/resource_ibm_is_reservation.go +++ b/ibm/service/vpc/resource_ibm_is_reservation.go @@ -504,7 +504,8 @@ func resourceIBMISReservationRead(d *schema.ResourceData, meta interface{}) erro profileMap := []map[string]interface{}{} finalList := map[string]interface{}{} - profileItem := reservation.Profile + profileItemIntf := reservation.Profile + profileItem := profileItemIntf.(*vpcv1.ReservationProfile) if profileItem.Href != nil { finalList[isReservationProfileHref] = profileItem.Href diff --git a/ibm/service/vpc/resource_ibm_is_reservation_activate.go b/ibm/service/vpc/resource_ibm_is_reservation_activate.go index 96ac3c4753..d3994e3cb3 100644 --- a/ibm/service/vpc/resource_ibm_is_reservation_activate.go +++ b/ibm/service/vpc/resource_ibm_is_reservation_activate.go @@ -350,7 +350,8 @@ func resourceIBMISReservationActivateRead(d *schema.ResourceData, meta interface profileMap := []map[string]interface{}{} finalList := map[string]interface{}{} - profileItem := reservation.Profile + profileItemIntf := reservation.Profile + profileItem := profileItemIntf.(*vpcv1.ReservationProfile) if profileItem.Href != nil { finalList[isReservationProfileHref] = profileItem.Href From fc014aff0212a26df5440bc3838ca2e3aac70df5 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 18 Dec 2024 20:15:20 +0530 Subject: [PATCH 102/103] breaking changes for 0.64.0 --- .../github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go | 2489 ++++++++++++++++- go.mod | 2 +- .../data_source_ibm_is_backup_policy_job.go | 9 +- .../data_source_ibm_is_backup_policy_jobs.go | 7 +- 4 files changed, 2419 insertions(+), 88 deletions(-) diff --git a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go index 9e29877008..8a03572190 100644 --- a/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go +++ b/common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -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-11-19 +// API Version: 2024-12-18 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-11-19` - // and `2024-11-20`. + // and `2024-12-18`. Version *string } @@ -68,7 +68,7 @@ type VpcV1Options struct { Generation *int64 // The API version, in format `YYYY-MM-DD`. For the API behavior documented here, specify any date between `2024-11-19` - // and `2024-11-20`. + // and `2024-12-18`. Version *string } @@ -133,7 +133,7 @@ func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { } if options.Version == nil { - options.Version = core.StringPtr("2024-11-19") + options.Version = core.StringPtr("2024-12-17") } service = &VpcV1{ Service: baseService, @@ -12379,7 +12379,8 @@ func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, update } // DeleteDedicatedHost : Delete a dedicated host -// This request deletes a dedicated host. +// This request deletes a dedicated host. This operation cannot be reversed. For this request to succeed, `instances` +// must be empty and `instance_placement_enabled` must be `false`. func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { response, err = vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) err = core.RepurposeSDKProblem(err, "") @@ -17709,7 +17710,7 @@ func (vpc *VpcV1) UpdateShareWithContext(ctx context.Context, updateShareOptions // ListShareAccessorBindings : List accessor bindings for a file share // This request lists accessor bindings for a share. Each accessor binding identifies a resource (possibly in another -// account) with access to this file share's data. +// account) with access to this file share including its snapshots. // // The share accessor bindings will be sorted by their `created_at` property values, with newest bindings first. func (vpc *VpcV1) ListShareAccessorBindings(listShareAccessorBindingsOptions *ListShareAccessorBindingsOptions) (result *ShareAccessorBindingCollection, response *core.DetailedResponse, err error) { @@ -18402,6 +18403,438 @@ func (vpc *VpcV1) UpdateShareMountTargetWithContext(ctx context.Context, updateS return } +// ListShareSnapshots : List file share snapshots +// This request lists snapshots for the specified file share, or across all accessible file shares. A snapshot preserves +// the data of a share at the time the snapshot was captured. +// +// If the file share is a replica, the list will contain snapshots corresponding to snapshots on the source. +func (vpc *VpcV1) ListShareSnapshots(listShareSnapshotsOptions *ListShareSnapshotsOptions) (result *ShareSnapshotCollection, response *core.DetailedResponse, err error) { + result, response, err = vpc.ListShareSnapshotsWithContext(context.Background(), listShareSnapshotsOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// ListShareSnapshotsWithContext is an alternate form of the ListShareSnapshots method which supports a Context parameter +func (vpc *VpcV1) ListShareSnapshotsWithContext(ctx context.Context, listShareSnapshotsOptions *ListShareSnapshotsOptions) (result *ShareSnapshotCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listShareSnapshotsOptions, "listShareSnapshotsOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listShareSnapshotsOptions, "listShareSnapshotsOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "share_id": *listShareSnapshotsOptions.ShareID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/snapshots`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range listShareSnapshotsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListShareSnapshots") + 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 listShareSnapshotsOptions.BackupPolicyPlanID != nil { + builder.AddQuery("backup_policy_plan.id", fmt.Sprint(*listShareSnapshotsOptions.BackupPolicyPlanID)) + } + if listShareSnapshotsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listShareSnapshotsOptions.Name)) + } + if listShareSnapshotsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listShareSnapshotsOptions.Start)) + } + if listShareSnapshotsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listShareSnapshotsOptions.Limit)) + } + if listShareSnapshotsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listShareSnapshotsOptions.Sort)) + } + + 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_share_snapshots", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareSnapshotCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// CreateShareSnapshot : Create a snapshot for a file share +// This request creates a new share snapshot from a share snapshot prototype object. The prototype object is structured +// in the same way as a retrieved share snapshot, and contains the information necessary to create the new share +// snapshot. +// +// The share must have the `access_control_mode` set to `security_group`. +// +// At present, the snapshot's `resource_group` will be inherited from its share, but may be specifiable in the future. +// +// The new snapshot will inherit the encryption settings from its share, , and must have a +// `replication_role` of `source` or `none`. +// +// If the share has a `replication_role` of `source`, a corresponding snapshot on the replica share will be created with +// a `status` of `pending`. It will remain in +// `pending` until the data is synchronized per the replication schedule determined by the replica share's +// `replication_cron_spec`. +func (vpc *VpcV1) CreateShareSnapshot(createShareSnapshotOptions *CreateShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) { + result, response, err = vpc.CreateShareSnapshotWithContext(context.Background(), createShareSnapshotOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// CreateShareSnapshotWithContext is an alternate form of the CreateShareSnapshot method which supports a Context parameter +func (vpc *VpcV1) CreateShareSnapshotWithContext(ctx context.Context, createShareSnapshotOptions *CreateShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createShareSnapshotOptions, "createShareSnapshotOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createShareSnapshotOptions, "createShareSnapshotOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "share_id": *createShareSnapshotOptions.ShareID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/snapshots`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range createShareSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateShareSnapshot") + 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 createShareSnapshotOptions.Name != nil { + body["name"] = createShareSnapshotOptions.Name + } + if createShareSnapshotOptions.UserTags != nil { + body["user_tags"] = createShareSnapshotOptions.UserTags + } + _, 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_share_snapshot", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareSnapshot) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// DeleteShareSnapshot : Delete a share snapshot +// This request deletes a share snapshot. This operation cannot be reversed. For this request to succeed, the share must +// have a `replication_role` of `source` or `none`. +// +// If the request is accepted, the share snapshot `lifecycle_state` will be set to +// `deleting`. Once deletion processing completes, the share snapshot will no longer be retrievable. +// +// Deleting a share snapshot will not affect any previously-accepted requests to create a share from it. +// +// If the share has a `replication_role` of `source`, the corresponding snapshot on the replica share will be +// subsequently moved to a `lifecycle_state` of `deleting`. If the data for the corresponding snapshot has already been +// synchronized via the replication schedule determined by `replication_cron_spec`, the snapshot will remain available +// in the replica share's `.snapshot` directory until the next replication sync. +func (vpc *VpcV1) DeleteShareSnapshot(deleteShareSnapshotOptions *DeleteShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) { + result, response, err = vpc.DeleteShareSnapshotWithContext(context.Background(), deleteShareSnapshotOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// DeleteShareSnapshotWithContext is an alternate form of the DeleteShareSnapshot method which supports a Context parameter +func (vpc *VpcV1) DeleteShareSnapshotWithContext(ctx context.Context, deleteShareSnapshotOptions *DeleteShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteShareSnapshotOptions, "deleteShareSnapshotOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteShareSnapshotOptions, "deleteShareSnapshotOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "share_id": *deleteShareSnapshotOptions.ShareID, + "id": *deleteShareSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/snapshots/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range deleteShareSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteShareSnapshot") + 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_share_snapshot", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareSnapshot) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// GetShareSnapshot : Retrieve a share snapshot +// This request retrieves a single share snapshot specified by the identifier in the URL. +func (vpc *VpcV1) GetShareSnapshot(getShareSnapshotOptions *GetShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) { + result, response, err = vpc.GetShareSnapshotWithContext(context.Background(), getShareSnapshotOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetShareSnapshotWithContext is an alternate form of the GetShareSnapshot method which supports a Context parameter +func (vpc *VpcV1) GetShareSnapshotWithContext(ctx context.Context, getShareSnapshotOptions *GetShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getShareSnapshotOptions, "getShareSnapshotOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getShareSnapshotOptions, "getShareSnapshotOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "share_id": *getShareSnapshotOptions.ShareID, + "id": *getShareSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/snapshots/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range getShareSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetShareSnapshot") + 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_share_snapshot", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareSnapshot) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// UpdateShareSnapshot : Update a share snapshot +// This request updates a share snapshot with the information provided in a share snapshot patch object. The share +// snapshot patch object is structured in the same way as a retrieved share snapshot and needs to contain only the +// information to be updated. +func (vpc *VpcV1) UpdateShareSnapshot(updateShareSnapshotOptions *UpdateShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) { + result, response, err = vpc.UpdateShareSnapshotWithContext(context.Background(), updateShareSnapshotOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// UpdateShareSnapshotWithContext is an alternate form of the UpdateShareSnapshot method which supports a Context parameter +func (vpc *VpcV1) UpdateShareSnapshotWithContext(ctx context.Context, updateShareSnapshotOptions *UpdateShareSnapshotOptions) (result *ShareSnapshot, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateShareSnapshotOptions, "updateShareSnapshotOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateShareSnapshotOptions, "updateShareSnapshotOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "share_id": *updateShareSnapshotOptions.ShareID, + "id": *updateShareSnapshotOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/shares/{share_id}/snapshots/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range updateShareSnapshotOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateShareSnapshot") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateShareSnapshotOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateShareSnapshotOptions.IfMatch)) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.Generation)) + + _, err = builder.SetBodyContentJSON(updateShareSnapshotOptions.ShareSnapshotPatch) + 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_share_snapshot", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareSnapshot) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + // DeleteShareSource : Split the source file share from a replica file share // This request removes the replication relationship between a source share and the replica share specified by the // identifier in the URL. The replication relationship cannot be removed if a source share or the replica share has a @@ -33613,7 +34046,7 @@ func (vpc *VpcV1) UnpublishPrivatePathServiceGatewayWithContext(ctx context.Cont return } func getServiceComponentInfo() *core.ProblemComponent { - return core.NewProblemComponent(DefaultServiceName, "today") + return core.NewProblemComponent(DefaultServiceName, "2024-12-17") } // AccountIdentity : Identifies an account by a unique property. @@ -34197,6 +34630,7 @@ func (addressPrefixPatch *AddressPrefixPatch) AsPatch() (_patch map[string]inter // Models which "extend" this model: // - BackupPolicyMatchResourceTypeInstance // - BackupPolicyMatchResourceTypeVolume +// - BackupPolicyMatchResourceTypeShare type BackupPolicy struct { // The date and time that the backup policy was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -34300,6 +34734,7 @@ const ( // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. const ( BackupPolicyMatchResourceTypeInstanceConst = "instance" + BackupPolicyMatchResourceTypeShareConst = "share" BackupPolicyMatchResourceTypeVolumeConst = "volume" ) @@ -34569,7 +35004,7 @@ type BackupPolicyJob struct { // 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"` + TargetSnapshots []BackupPolicyTargetSnapshotIntf `json:"target_snapshots" validate:"required"` } // Constants associated with the BackupPolicyJob.JobType property. @@ -34662,7 +35097,7 @@ func UnmarshalBackupPolicyJob(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "target_snapshots", &obj.TargetSnapshots, UnmarshalSnapshotReference) + err = core.UnmarshalModel(m, "target_snapshots", &obj.TargetSnapshots, UnmarshalBackupPolicyTargetSnapshot) if err != nil { err = core.SDKErrorf(err, "", "target_snapshots-error", common.GetComponentInfo()) return @@ -34742,6 +35177,7 @@ func (resp *BackupPolicyJobCollection) GetNextStart() (*string, error) { // Models which "extend" this model: // - BackupPolicyJobSourceVolumeReference // - BackupPolicyJobSourceInstanceReference +// - BackupPolicyJobSourceShareReference type BackupPolicyJobSource struct { // The CRN for this volume. CRN *string `json:"crn,omitempty"` @@ -34829,6 +35265,13 @@ type BackupPolicyJobStatusReason struct { // - `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_source_unsupported`: The source access control mode does not support + // backups + // - `snapshot_rate_too_high`: The rate of backups for the resource is too high + // - `snapshot_share_limit`: The maximum limit for snapshots on this resource has been + // reached + // - `snapshot_source_unavailable`: The source data is not available (for example, + // because the source is still being created). // - `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 @@ -34851,6 +35294,13 @@ type BackupPolicyJobStatusReason struct { // - `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_source_unsupported`: The source access control mode does not support +// backups +// - `snapshot_rate_too_high`: The rate of backups for the resource is too high +// - `snapshot_share_limit`: The maximum limit for snapshots on this resource has been +// reached +// - `snapshot_source_unavailable`: The source data is not available (for example, +// because the source is still being created). // - `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 @@ -34863,6 +35313,10 @@ const ( BackupPolicyJobStatusReasonCodeInternalErrorConst = "internal_error" BackupPolicyJobStatusReasonCodeSnapshotEncryptionKeyInvalidConst = "snapshot_encryption_key_invalid" BackupPolicyJobStatusReasonCodeSnapshotPendingConst = "snapshot_pending" + BackupPolicyJobStatusReasonCodeSnapshotRateTooHighConst = "snapshot_rate_too_high" + BackupPolicyJobStatusReasonCodeSnapshotShareLimitConst = "snapshot_share_limit" + BackupPolicyJobStatusReasonCodeSnapshotSourceUnavailableConst = "snapshot_source_unavailable" + BackupPolicyJobStatusReasonCodeSnapshotSourceUnsupportedConst = "snapshot_source_unsupported" BackupPolicyJobStatusReasonCodeSnapshotVolumeLimitConst = "snapshot_volume_limit" BackupPolicyJobStatusReasonCodeSourceVolumeBusyConst = "source_volume_busy" BackupPolicyJobStatusReasonCodeSourceVolumeTooLargeConst = "source_volume_too_large" @@ -35725,6 +36179,7 @@ func (backupPolicyPlanRemoteRegionPolicyPrototype *BackupPolicyPlanRemoteRegionP // Models which "extend" this model: // - BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype // - BackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototype +// - BackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype 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. @@ -35761,6 +36216,7 @@ type BackupPolicyPrototype struct { // will be subject to the backup policy. const ( BackupPolicyPrototypeMatchResourceTypeInstanceConst = "instance" + BackupPolicyPrototypeMatchResourceTypeShareConst = "share" BackupPolicyPrototypeMatchResourceTypeVolumeConst = "volume" ) @@ -35902,6 +36358,91 @@ func UnmarshalBackupPolicyScopePrototype(m map[string]json.RawMessage, result in return } +// BackupPolicyTargetSnapshot : BackupPolicyTargetSnapshot struct +// Models which "extend" this model: +// - BackupPolicyTargetSnapshotSnapshotReference +// - BackupPolicyTargetSnapshotShareSnapshotReference +type BackupPolicyTargetSnapshot struct { + // The CRN of this snapshot. + 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 snapshot. + Href *string `json:"href,omitempty"` + + // The unique identifier for this snapshot. + ID *string `json:"id,omitempty"` + + // The name for this snapshot. The name is unique across all snapshots 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 *SnapshotRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the BackupPolicyTargetSnapshot.ResourceType property. +// The resource type. +const ( + BackupPolicyTargetSnapshotResourceTypeSnapshotConst = "snapshot" +) + +func (*BackupPolicyTargetSnapshot) isaBackupPolicyTargetSnapshot() bool { + return true +} + +type BackupPolicyTargetSnapshotIntf interface { + isaBackupPolicyTargetSnapshot() bool +} + +// UnmarshalBackupPolicyTargetSnapshot unmarshals an instance of BackupPolicyTargetSnapshot from the specified map of raw messages. +func UnmarshalBackupPolicyTargetSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyTargetSnapshot) + 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, UnmarshalSnapshotRemote) + 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 +} + // BareMetalServer : BareMetalServer struct type BareMetalServer struct { // The total bandwidth (in megabits per second) shared across the bare metal server network attachments or bare metal @@ -45188,10 +45729,8 @@ type CreateLoadBalancerPoolMemberOptions struct { // The port must be unique across all members for all pools associated with this pool's listener. Port *int64 `json:"port" validate:"required"` - // The pool member target. Load balancers in the `network` family support virtual server - // instances. Load balancers in the `application` family support IP addresses. If the load - // balancer has route mode enabled, the member must be in a zone the load balancer has a - // subnet in. + // The pool member target. If the load balancer has route mode enabled, the member must be + // in a zone the load balancer has a subnet in. Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` // The weight of the server member. @@ -46053,6 +46592,53 @@ func (options *CreateShareOptions) SetHeaders(param map[string]string) *CreateSh return options } +// CreateShareSnapshotOptions : The CreateShareSnapshot options. +type CreateShareSnapshotOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The name for this share snapshot. The name must not be used by another snapshot for the file share. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this share snapshot. + UserTags []string `json:"user_tags,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewCreateShareSnapshotOptions : Instantiate CreateShareSnapshotOptions +func (*VpcV1) NewCreateShareSnapshotOptions(shareID string) *CreateShareSnapshotOptions { + return &CreateShareSnapshotOptions{ + ShareID: core.StringPtr(shareID), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *CreateShareSnapshotOptions) SetShareID(shareID string) *CreateShareSnapshotOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateShareSnapshotOptions) SetName(name string) *CreateShareSnapshotOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetUserTags : Allow user to set UserTags +func (_options *CreateShareSnapshotOptions) SetUserTags(userTags []string) *CreateShareSnapshotOptions { + _options.UserTags = userTags + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateShareSnapshotOptions) SetHeaders(param map[string]string) *CreateShareSnapshotOptions { + options.Headers = param + return options +} + // CreateSnapshotCloneOptions : The CreateSnapshotClone options. type CreateSnapshotCloneOptions struct { // The snapshot identifier. @@ -51623,6 +52209,44 @@ func (options *DeleteShareOptions) SetHeaders(param map[string]string) *DeleteSh return options } +// DeleteShareSnapshotOptions : The DeleteShareSnapshot options. +type DeleteShareSnapshotOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewDeleteShareSnapshotOptions : Instantiate DeleteShareSnapshotOptions +func (*VpcV1) NewDeleteShareSnapshotOptions(shareID string, id string) *DeleteShareSnapshotOptions { + return &DeleteShareSnapshotOptions{ + ShareID: core.StringPtr(shareID), + ID: core.StringPtr(id), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *DeleteShareSnapshotOptions) SetShareID(shareID string) *DeleteShareSnapshotOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteShareSnapshotOptions) SetID(id string) *DeleteShareSnapshotOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteShareSnapshotOptions) SetHeaders(param map[string]string) *DeleteShareSnapshotOptions { + options.Headers = param + return options +} + // DeleteShareSourceOptions : The DeleteShareSource options. type DeleteShareSourceOptions struct { // The file share identifier. @@ -52589,11 +53213,11 @@ type EndpointGateway struct { // The security groups targeting this endpoint gateway. SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - // The fully qualified domain name for the target service. + // The fully qualified domain name for the target service. The domain name may have a wildcard prefix. // Deprecated: this field is deprecated and may be removed in a future release. ServiceEndpoint *string `json:"service_endpoint,omitempty"` - // The fully qualified domain names for the target service. + // The fully qualified domain names for the target service. A domain name may have a wildcard prefix. ServiceEndpoints []string `json:"service_endpoints" validate:"required"` // The target for this endpoint gateway. @@ -56903,6 +57527,44 @@ func (options *GetShareProfileOptions) SetHeaders(param map[string]string) *GetS return options } +// GetShareSnapshotOptions : The GetShareSnapshot options. +type GetShareSnapshotOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetShareSnapshotOptions : Instantiate GetShareSnapshotOptions +func (*VpcV1) NewGetShareSnapshotOptions(shareID string, id string) *GetShareSnapshotOptions { + return &GetShareSnapshotOptions{ + ShareID: core.StringPtr(shareID), + ID: core.StringPtr(id), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *GetShareSnapshotOptions) SetShareID(shareID string) *GetShareSnapshotOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetShareSnapshotOptions) SetID(id string) *GetShareSnapshotOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetShareSnapshotOptions) SetHeaders(param map[string]string) *GetShareSnapshotOptions { + options.Headers = param + return options +} + // GetShareSourceOptions : The GetShareSource options. type GetShareSourceOptions struct { // The file share identifier. @@ -72167,6 +72829,91 @@ func (options *ListShareProfilesOptions) SetHeaders(param map[string]string) *Li return options } +// ListShareSnapshotsOptions : The ListShareSnapshots options. +type ListShareSnapshotsOptions struct { + // The file share identifier, or `-` to wildcard all accessible file shares. + ShareID *string `json:"share_id" validate:"required,ne="` + + // Filters the collection to backup policy jobs with a `backup_policy_plan.id` property matching the specified + // identifier. + BackupPolicyPlanID *string `json:"backup_policy_plan.id,omitempty"` + + // Filters the collection to resources with a `name` property matching the exact specified name. + Name *string `json:"name,omitempty"` + + // 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"` + + // 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 ListShareSnapshotsOptions.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 ( + ListShareSnapshotsOptionsSortCreatedAtConst = "created_at" + ListShareSnapshotsOptionsSortNameConst = "name" +) + +// NewListShareSnapshotsOptions : Instantiate ListShareSnapshotsOptions +func (*VpcV1) NewListShareSnapshotsOptions(shareID string) *ListShareSnapshotsOptions { + return &ListShareSnapshotsOptions{ + ShareID: core.StringPtr(shareID), + } +} + +// SetShareID : Allow user to set ShareID +func (_options *ListShareSnapshotsOptions) SetShareID(shareID string) *ListShareSnapshotsOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetBackupPolicyPlanID : Allow user to set BackupPolicyPlanID +func (_options *ListShareSnapshotsOptions) SetBackupPolicyPlanID(backupPolicyPlanID string) *ListShareSnapshotsOptions { + _options.BackupPolicyPlanID = core.StringPtr(backupPolicyPlanID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListShareSnapshotsOptions) SetName(name string) *ListShareSnapshotsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListShareSnapshotsOptions) SetStart(start string) *ListShareSnapshotsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListShareSnapshotsOptions) SetLimit(limit int64) *ListShareSnapshotsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListShareSnapshotsOptions) SetSort(sort string) *ListShareSnapshotsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListShareSnapshotsOptions) SetHeaders(param map[string]string) *ListShareSnapshotsOptions { + options.Headers = param + return options +} + // ListSharesOptions : The ListShares options. type ListSharesOptions struct { // A server-provided token determining what resource to start the page on. @@ -77094,10 +77841,8 @@ type LoadBalancerPoolMember struct { // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. ProvisioningStatus *string `json:"provisioning_status" validate:"required"` - // The pool member target. Load balancers in the `network` family support virtual server - // instances. Load balancers in the `application` family support IP addresses. If the load - // balancer has route mode enabled, the member must be in a zone the load balancer has a - // subnet in. + // The pool member target. If the load balancer has route mode enabled, the member must be + // in a zone the load balancer has a subnet in. Target LoadBalancerPoolMemberTargetIntf `json:"target" validate:"required"` // The weight of the server member. @@ -77207,10 +77952,8 @@ type LoadBalancerPoolMemberPatch struct { // The port must be unique across all members for all pools associated with this pool's listener. Port *int64 `json:"port,omitempty"` - // The pool member target. Load balancers in the `network` family support virtual server - // instances. Load balancers in the `application` family support IP addresses. If the load - // balancer has route mode enabled, the member must be in a zone the load balancer has a - // subnet in. + // The pool member target. If the load balancer has route mode enabled, the member must be + // in a zone the load balancer has a subnet in. Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target,omitempty"` // The weight of the server member. @@ -77269,10 +78012,8 @@ type LoadBalancerPoolMemberPrototype struct { // The port must be unique across all members for all pools associated with this pool's listener. Port *int64 `json:"port" validate:"required"` - // The pool member target. Load balancers in the `network` family support virtual server - // instances. Load balancers in the `application` family support IP addresses. If the load - // balancer has route mode enabled, the member must be in a zone the load balancer has a - // subnet in. + // The pool member target. If the load balancer has route mode enabled, the member must be + // in a zone the load balancer has a subnet in. Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` // The weight of the server member. @@ -77351,9 +78092,8 @@ func UnmarshalLoadBalancerPoolMemberReference(m map[string]json.RawMessage, resu return } -// LoadBalancerPoolMemberTarget : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in -// the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a -// zone the load balancer has a subnet in. +// LoadBalancerPoolMemberTarget : The pool member target. If the load balancer has route mode enabled, the member must be in a zone the load balancer +// has a subnet in. // Models which "extend" this model: // - LoadBalancerPoolMemberTargetInstanceReference // - LoadBalancerPoolMemberTargetIP @@ -77426,9 +78166,8 @@ func UnmarshalLoadBalancerPoolMemberTarget(m map[string]json.RawMessage, result return } -// LoadBalancerPoolMemberTargetPrototype : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in -// the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a -// zone the load balancer has a subnet in. +// LoadBalancerPoolMemberTargetPrototype : The pool member target. If the load balancer has route mode enabled, the member must be in a zone the load balancer +// has a subnet in. // Models which "extend" this model: // - LoadBalancerPoolMemberTargetPrototypeInstanceIdentity // - LoadBalancerPoolMemberTargetPrototypeIP @@ -79495,9 +80234,6 @@ type NetworkACLRulePatch struct { // The name for this network ACL rule. The name must not be used by another rule for the network ACL. Name *string `json:"name,omitempty"` - // The network protocol. - Protocol *string `json:"protocol,omitempty"` - // The source IP address or CIDR block to match. The CIDR block `0.0.0.0/0` matches all source addresses. Source *string `json:"source,omitempty"` @@ -79527,15 +80263,6 @@ const ( NetworkACLRulePatchDirectionOutboundConst = "outbound" ) -// Constants associated with the NetworkACLRulePatch.Protocol property. -// The network protocol. -const ( - NetworkACLRulePatchProtocolAllConst = "all" - NetworkACLRulePatchProtocolIcmpConst = "icmp" - NetworkACLRulePatchProtocolTCPConst = "tcp" - NetworkACLRulePatchProtocolUDPConst = "udp" -) - // UnmarshalNetworkACLRulePatch unmarshals an instance of NetworkACLRulePatch from the specified map of raw messages. func UnmarshalNetworkACLRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(NetworkACLRulePatch) @@ -79579,11 +80306,6 @@ func UnmarshalNetworkACLRulePatch(m map[string]json.RawMessage, result interface err = core.SDKErrorf(err, "", "name-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.UnmarshalPrimitive(m, "source", &obj.Source) if err != nil { err = core.SDKErrorf(err, "", "source-error", common.GetComponentInfo()) @@ -79635,9 +80357,6 @@ func (networkACLRulePatch *NetworkACLRulePatch) AsPatch() (_patch map[string]int 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 } @@ -87487,7 +88206,7 @@ type Share struct { AccessorBindingRole *string `json:"accessor_binding_role" validate:"required"` // The accessor bindings for this file share. Each accessor binding identifies a resource (possibly in another account) - // with access to this file share's data. + // with access to this file share's data and its snapshots. AccessorBindings []ShareAccessorBindingReference `json:"accessor_bindings" validate:"required"` // The transit encryption modes allowed for this share. @@ -87593,16 +88312,31 @@ type Share struct { // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The size of the file share rounded up to the next gigabyte. + // The size of the file share (in gigabytes), excluding share snapshots. // // The maximum size for a share may increase in the future. Size *int64 `json:"size" validate:"required"` + // The total number of snapshots for this share. + SnapshotCount *int64 `json:"snapshot_count" validate:"required"` + + // The total size (in gigabytes) of snapshots used for this file share. + SnapshotSize *int64 `json:"snapshot_size" validate:"required"` + // The source file share for this replica file share. // // This property will be present when the `replication_role` is `replica`. SourceShare *ShareReference `json:"source_share,omitempty"` + // The snapshot this share was created from. + // + // This property will be present when the share was created from a snapshot. + // + // The resources supported by this property may + // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the + // future. + SourceSnapshot ShareSourceSnapshotIntf `json:"source_snapshot,omitempty"` + // Tags for this resource. UserTags []string `json:"user_tags" validate:"required"` @@ -87848,11 +88582,26 @@ func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "snapshot_count", &obj.SnapshotCount) + if err != nil { + err = core.SDKErrorf(err, "", "snapshot_count-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "snapshot_size", &obj.SnapshotSize) + if err != nil { + err = core.SDKErrorf(err, "", "snapshot_size-error", common.GetComponentInfo()) + return + } err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareReference) if err != nil { err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalShareSourceSnapshot) + if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) if err != nil { err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) @@ -87870,9 +88619,6 @@ func UnmarshalShare(m map[string]json.RawMessage, result interface{}) (err error // ShareAccessorBinding : ShareAccessorBinding struct type ShareAccessorBinding struct { // The accessor for this share accessor binding. - // - // The resources supported by this property may - // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Accessor ShareAccessorBindingAccessorIntf `json:"accessor" validate:"required"` // The date and time that the share accessor binding was created. @@ -87947,9 +88693,6 @@ func UnmarshalShareAccessorBinding(m map[string]json.RawMessage, result interfac } // ShareAccessorBindingAccessor : The accessor for this share accessor binding. -// -// 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: // - ShareAccessorBindingAccessorShareReference // - ShareAccessorBindingAccessorWatsonxMachineLearningReference @@ -89136,8 +89879,8 @@ type SharePatch struct { // For this property to be changed, the share `replication_role` must be `replica`. ReplicationCronSpec *string `json:"replication_cron_spec,omitempty"` - // The size of the file share rounded up to the next gigabyte. The value must not be less than the share's current - // size, and must not exceed the maximum supported by the share's profile and IOPS. + // The size of the file share (in gigabytes), excluding share snapshots. The value must not be less than the share's + // current size, and must not exceed the maximum supported by the share's profile and IOPS. // // For this property to be changed: // - The share `lifecycle_state` must be `stable` @@ -89661,6 +90404,7 @@ func UnmarshalShareProfileReference(m map[string]json.RawMessage, result interfa // - SharePrototypeShareBySize // - SharePrototypeShareBySourceShare // - SharePrototypeShareByOriginShare +// - SharePrototypeShareBySourceSnapshot type SharePrototype struct { // The transit encryption modes to allow for this share. If unspecified: // - If share mount targets are specified, and those share mount targets all specify a @@ -89717,7 +90461,7 @@ type SharePrototype struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The size of the file share rounded up to the next gigabyte. + // The size of the file share (in gigabytes), excluding share snapshots. // // The maximum size for a share may increase in the future. Size *int64 `json:"size,omitempty"` @@ -89746,6 +90490,13 @@ type SharePrototype struct { // // The specified share may be in a different account, subject to IAM policies. OriginShare ShareIdentityIntf `json:"origin_share,omitempty"` + + // The source snapshot for this file share. + // + // This file share will reside in the same zone as the specified source snapshot. + // The snapshot must have the `lifecycle_state` as `stable` and `status` as `available` + // to be able to restore a share for it. + SourceSnapshot ShareSourceSnapshotPrototypeIntf `json:"source_snapshot,omitempty"` } // Constants associated with the SharePrototype.AllowedTransitEncryptionModes property. @@ -89864,6 +90615,11 @@ func UnmarshalSharePrototype(m map[string]json.RawMessage, result interface{}) ( err = core.SDKErrorf(err, "", "origin_share-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalShareSourceSnapshotPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -90143,6 +90899,536 @@ func UnmarshalShareReplicationStatusReason(m map[string]json.RawMessage, result return } +// ShareSnapshot : ShareSnapshot struct +type ShareSnapshot struct { + // If present, the backup policy plan which created this share snapshot. + BackupPolicyPlan *BackupPolicyPlanReference `json:"backup_policy_plan,omitempty"` + + // The date and time the data capture for this share snapshot was completed. + // + // If absent, this snapshot's data has not yet been captured. + CapturedAt *strfmt.DateTime `json:"captured_at,omitempty"` + + // The date and time that the share snapshot was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this share snapshot. + CRN *string `json:"crn" validate:"required"` + + // The fingerprint for this share snapshot. Only snapshots with identical data will have the same fingerprint. This + // snapshot will also be available as a subdirectory named identically to this fingerprint in the share's `.snapshot` + // directory. + Fingerprint *string `json:"fingerprint" validate:"required"` + + // The URL for this share snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this share snapshot. + ID *string `json:"id" validate:"required"` + + // The reasons for the current `lifecycle_state` (if any). + LifecycleReasons []ShareSnapshotLifecycleReason `json:"lifecycle_reasons" validate:"required"` + + // The lifecycle state of this share snapshot + // - `pending`: The share snapshot is being provisioned and is not yet usable. A + // snapshot on a replica share will remain `pending` until the next replication sync + // completes. + // - `deleting`: The share snapshot is being deleted. + // - `failed`: The share snapshot is irrecoverably unusable. + // - `stable`: The share snapshot is stable and ready for use. + // - `updating`: The share snapshot is being updated. + // - `suspended`: The share snapshot is not currently usable (see `lifecycle_reasons`). + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The minimum size of a share created from this snapshot. When a snapshot is created, this will be set to the size of + // the `source_share`. + MinimumSize *int64 `json:"minimum_size" validate:"required"` + + // The name for this share snapshot. The name is unique across all snapshots for the file share. + Name *string `json:"name" validate:"required"` + + // The resource group for this share snapshot. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the share snapshot: + // - `available`: The share snapshot is available for use. + // - `failed`: The share snapshot is irrecoverably unusable. + // - `pending`: The share snapshot is being provisioned and is not yet usable. A + // snapshot on a replica share will remain `pending` until the next replication sync + // completes. + // - `unusable`: The share snapshot is not currently usable (see `status_reasons`) + // + // 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 []ShareSnapshotStatusReason `json:"status_reasons" validate:"required"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this share snapshot. + UserTags []string `json:"user_tags" validate:"required"` + + // The zone this share snapshot resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the ShareSnapshot.LifecycleState property. +// The lifecycle state of this share snapshot +// - `pending`: The share snapshot is being provisioned and is not yet usable. A +// snapshot on a replica share will remain `pending` until the next replication sync +// completes. +// - `deleting`: The share snapshot is being deleted. +// - `failed`: The share snapshot is irrecoverably unusable. +// - `stable`: The share snapshot is stable and ready for use. +// - `updating`: The share snapshot is being updated. +// - `suspended`: The share snapshot is not currently usable (see `lifecycle_reasons`). +const ( + ShareSnapshotLifecycleStateDeletingConst = "deleting" + ShareSnapshotLifecycleStateFailedConst = "failed" + ShareSnapshotLifecycleStatePendingConst = "pending" + ShareSnapshotLifecycleStateStableConst = "stable" + ShareSnapshotLifecycleStateSuspendedConst = "suspended" + ShareSnapshotLifecycleStateUpdatingConst = "updating" + ShareSnapshotLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the ShareSnapshot.ResourceType property. +// The resource type. +const ( + ShareSnapshotResourceTypeShareSnapshotConst = "share_snapshot" +) + +// Constants associated with the ShareSnapshot.Status property. +// The status of the share snapshot: +// - `available`: The share snapshot is available for use. +// - `failed`: The share snapshot is irrecoverably unusable. +// - `pending`: The share snapshot is being provisioned and is not yet usable. A +// snapshot on a replica share will remain `pending` until the next replication sync +// completes. +// - `unusable`: The share snapshot is not currently usable (see `status_reasons`) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + ShareSnapshotStatusAvailableConst = "available" + ShareSnapshotStatusFailedConst = "failed" + ShareSnapshotStatusPendingConst = "pending" + ShareSnapshotStatusUnusableConst = "unusable" +) + +// UnmarshalShareSnapshot unmarshals an instance of ShareSnapshot from the specified map of raw messages. +func UnmarshalShareSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareSnapshot) + 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, "captured_at", &obj.CapturedAt) + if err != nil { + err = core.SDKErrorf(err, "", "captured_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, "crn", &obj.CRN) + if err != nil { + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + err = core.SDKErrorf(err, "", "fingerprint-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, UnmarshalShareSnapshotLifecycleReason) + 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, "minimum_size", &obj.MinimumSize) + if err != nil { + err = core.SDKErrorf(err, "", "minimum_size-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, "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.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, UnmarshalShareSnapshotStatusReason) + if err != nil { + err = core.SDKErrorf(err, "", "status_reasons-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + err = core.SDKErrorf(err, "", "user_tags-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 +} + +// ShareSnapshotCollection : ShareSnapshotCollection struct +type ShareSnapshotCollection 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 share snapshots. + Snapshots []ShareSnapshot `json:"snapshots,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalShareSnapshotCollection unmarshals an instance of ShareSnapshotCollection from the specified map of raw messages. +func UnmarshalShareSnapshotCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareSnapshotCollection) + 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, "snapshots", &obj.Snapshots, UnmarshalShareSnapshot) + if err != nil { + err = core.SDKErrorf(err, "", "snapshots-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 *ShareSnapshotCollection) 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 +} + +// ShareSnapshotLifecycleReason : ShareSnapshotLifecycleReason struct +type ShareSnapshotLifecycleReason 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 ShareSnapshotLifecycleReason.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 ( + ShareSnapshotLifecycleReasonCodeInternalErrorConst = "internal_error" + ShareSnapshotLifecycleReasonCodeResourceSuspendedByProviderConst = "resource_suspended_by_provider" +) + +// UnmarshalShareSnapshotLifecycleReason unmarshals an instance of ShareSnapshotLifecycleReason from the specified map of raw messages. +func UnmarshalShareSnapshotLifecycleReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareSnapshotLifecycleReason) + 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 +} + +// ShareSnapshotPatch : ShareSnapshotPatch struct +type ShareSnapshotPatch struct { + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this share snapshot. + UserTags []string `json:"user_tags,omitempty"` +} + +// UnmarshalShareSnapshotPatch unmarshals an instance of ShareSnapshotPatch from the specified map of raw messages. +func UnmarshalShareSnapshotPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareSnapshotPatch) + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + err = core.SDKErrorf(err, "", "user_tags-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the ShareSnapshotPatch +func (shareSnapshotPatch *ShareSnapshotPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(shareSnapshotPatch.UserTags) { + _patch["user_tags"] = shareSnapshotPatch.UserTags + } + + return +} + +// ShareSnapshotStatusReason : ShareSnapshotStatusReason struct +type ShareSnapshotStatusReason struct { + // A reason code for the status: + // - `encryption_key_deleted`: Share snapshot is unusable because its + // `encryption_key` was deleted + // - `internal_error`: Internal error (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. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the ShareSnapshotStatusReason.Code property. +// A reason code for the status: +// - `encryption_key_deleted`: Share snapshot is unusable because its +// `encryption_key` was deleted +// - `internal_error`: Internal error (contact IBM support) +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + ShareSnapshotStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" +) + +// UnmarshalShareSnapshotStatusReason unmarshals an instance of ShareSnapshotStatusReason from the specified map of raw messages. +func UnmarshalShareSnapshotStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareSnapshotStatusReason) + 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 +} + +// ShareSourceSnapshot : ShareSourceSnapshot struct +// Models which "extend" this model: +// - ShareSourceSnapshotShareSnapshotReference +type ShareSourceSnapshot struct { + // The CRN for this share snapshot. + 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 share snapshot. + Href *string `json:"href,omitempty"` + + // The unique identifier for this share snapshot. + ID *string `json:"id,omitempty"` + + // The name for this share snapshot. The name is unique across all snapshots for the file share. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the ShareSourceSnapshot.ResourceType property. +// The resource type. +const ( + ShareSourceSnapshotResourceTypeShareSnapshotConst = "share_snapshot" +) + +func (*ShareSourceSnapshot) isaShareSourceSnapshot() bool { + return true +} + +type ShareSourceSnapshotIntf interface { + isaShareSourceSnapshot() bool +} + +// UnmarshalShareSourceSnapshot unmarshals an instance of ShareSourceSnapshot from the specified map of raw messages. +func UnmarshalShareSourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareSourceSnapshot) + 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.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 +} + +// ShareSourceSnapshotPrototype : ShareSourceSnapshotPrototype struct +// Models which "extend" this model: +// - ShareSourceSnapshotPrototypeShareSnapshotIdentity +type ShareSourceSnapshotPrototype struct { + // The unique identifier for this share snapshot. + ID *string `json:"id,omitempty"` + + // The CRN for this share snapshot. + CRN *string `json:"crn,omitempty"` + + // The URL for this share snapshot. + Href *string `json:"href,omitempty"` +} + +func (*ShareSourceSnapshotPrototype) isaShareSourceSnapshotPrototype() bool { + return true +} + +type ShareSourceSnapshotPrototypeIntf interface { + isaShareSourceSnapshotPrototype() bool +} + +// UnmarshalShareSourceSnapshotPrototype unmarshals an instance of ShareSourceSnapshotPrototype from the specified map of raw messages. +func UnmarshalShareSourceSnapshotPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareSourceSnapshotPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-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) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // Snapshot : Snapshot struct type Snapshot struct { // If present, the backup policy plan which created this snapshot. @@ -94610,6 +95896,64 @@ func (options *UpdateShareOptions) SetHeaders(param map[string]string) *UpdateSh return options } +// UpdateShareSnapshotOptions : The UpdateShareSnapshot options. +type UpdateShareSnapshotOptions struct { + // The file share identifier. + ShareID *string `json:"share_id" validate:"required,ne="` + + // The share snapshot identifier. + ID *string `json:"id" validate:"required,ne="` + + // The share snapshot patch. + ShareSnapshotPatch map[string]interface{} `json:"ShareSnapshot_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 +} + +// NewUpdateShareSnapshotOptions : Instantiate UpdateShareSnapshotOptions +func (*VpcV1) NewUpdateShareSnapshotOptions(shareID string, id string, shareSnapshotPatch map[string]interface{}) *UpdateShareSnapshotOptions { + return &UpdateShareSnapshotOptions{ + ShareID: core.StringPtr(shareID), + ID: core.StringPtr(id), + ShareSnapshotPatch: shareSnapshotPatch, + } +} + +// SetShareID : Allow user to set ShareID +func (_options *UpdateShareSnapshotOptions) SetShareID(shareID string) *UpdateShareSnapshotOptions { + _options.ShareID = core.StringPtr(shareID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateShareSnapshotOptions) SetID(id string) *UpdateShareSnapshotOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetShareSnapshotPatch : Allow user to set ShareSnapshotPatch +func (_options *UpdateShareSnapshotOptions) SetShareSnapshotPatch(shareSnapshotPatch map[string]interface{}) *UpdateShareSnapshotOptions { + _options.ShareSnapshotPatch = shareSnapshotPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateShareSnapshotOptions) SetIfMatch(ifMatch string) *UpdateShareSnapshotOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateShareSnapshotOptions) SetHeaders(param map[string]string) *UpdateShareSnapshotOptions { + options.Headers = param + return options +} + // UpdateSnapshotConsistencyGroupOptions : The UpdateSnapshotConsistencyGroup options. type UpdateSnapshotConsistencyGroupOptions struct { // The snapshot consistency group identifier. @@ -95415,8 +96759,8 @@ type VPC struct { // The CRN for this VPC. CRN *string `json:"crn" validate:"required"` - // The CSE ([Cloud Service Endpoint](https://cloud.ibm.com/docs/resources?topic=resources-service-endpoints)) source IP - // addresses for the VPC. The VPC will have at least one CSE source IP address per zone. + // The CSE ([Cloud Service Endpoint](https://cloud.ibm.com/docs/account?topic=account-service-endpoints-overview)) + // source IP addresses for the VPC. The VPC will have at least one CSE source IP address per zone. // // The maximum number of items for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. @@ -101153,11 +102497,6 @@ type Volume struct { // The maximum bandwidth (in megabits per second) for the volume. // - // For a volume with a `storage_generation` of `1`, the - // [bandwidth is calculated] - // (https://cloud.ibm.com/docs/vpc?topic=vpc-block-storage-bandwidth#attached-block-vol-bandwidth) from the `iops` - // value. - // // The minimum and maximum limits for this property may // [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. Bandwidth *int64 `json:"bandwidth" validate:"required"` @@ -103750,6 +105089,85 @@ func UnmarshalBackupPolicyJobSourceInstanceReference(m map[string]json.RawMessag return } +// BackupPolicyJobSourceShareReference : BackupPolicyJobSourceShareReference struct +// This model "extends" BackupPolicyJobSource +type BackupPolicyJobSourceShareReference struct { + // The CRN for this file share. + 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"` + + // The URL for this file share. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this file share. + ID *string `json:"id" validate:"required"` + + // The name for this share. The name is unique across all shares in the region. + 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 *ShareRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyJobSourceShareReference.ResourceType property. +// The resource type. +const ( + BackupPolicyJobSourceShareReferenceResourceTypeShareConst = "share" +) + +func (*BackupPolicyJobSourceShareReference) isaBackupPolicyJobSource() bool { + return true +} + +// UnmarshalBackupPolicyJobSourceShareReference unmarshals an instance of BackupPolicyJobSourceShareReference from the specified map of raw messages. +func UnmarshalBackupPolicyJobSourceShareReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyJobSourceShareReference) + 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, UnmarshalShareRemote) + 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 +} + // BackupPolicyJobSourceVolumeReference : BackupPolicyJobSourceVolumeReference struct // This model "extends" BackupPolicyJobSource type BackupPolicyJobSourceVolumeReference struct { @@ -104039,6 +105457,196 @@ func UnmarshalBackupPolicyMatchResourceTypeInstance(m map[string]json.RawMessage return } +// BackupPolicyMatchResourceTypeShare : BackupPolicyMatchResourceTypeShare struct +// This model "extends" BackupPolicy +type BackupPolicyMatchResourceTypeShare 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 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"` + + Scope BackupPolicyScopeIntf `json:"scope" 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"` +} + +// Constants associated with the BackupPolicyMatchResourceTypeShare.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 ( + BackupPolicyMatchResourceTypeShareHealthStateDegradedConst = "degraded" + BackupPolicyMatchResourceTypeShareHealthStateFaultedConst = "faulted" + BackupPolicyMatchResourceTypeShareHealthStateInapplicableConst = "inapplicable" + BackupPolicyMatchResourceTypeShareHealthStateOkConst = "ok" +) + +// Constants associated with the BackupPolicyMatchResourceTypeShare.LifecycleState property. +// The lifecycle state of the backup policy. +const ( + BackupPolicyMatchResourceTypeShareLifecycleStateDeletingConst = "deleting" + BackupPolicyMatchResourceTypeShareLifecycleStateFailedConst = "failed" + BackupPolicyMatchResourceTypeShareLifecycleStatePendingConst = "pending" + BackupPolicyMatchResourceTypeShareLifecycleStateStableConst = "stable" + BackupPolicyMatchResourceTypeShareLifecycleStateSuspendedConst = "suspended" + BackupPolicyMatchResourceTypeShareLifecycleStateUpdatingConst = "updating" + BackupPolicyMatchResourceTypeShareLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BackupPolicyMatchResourceTypeShare.ResourceType property. +// The resource type. +const ( + BackupPolicyMatchResourceTypeShareResourceTypeBackupPolicyConst = "backup_policy" +) + +// Constants associated with the BackupPolicyMatchResourceTypeShare.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 ( + BackupPolicyMatchResourceTypeShareMatchResourceTypeShareConst = "share" +) + +func (*BackupPolicyMatchResourceTypeShare) isaBackupPolicy() bool { + return true +} + +// UnmarshalBackupPolicyMatchResourceTypeShare unmarshals an instance of BackupPolicyMatchResourceTypeShare from the specified map of raw messages. +func UnmarshalBackupPolicyMatchResourceTypeShare(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyMatchResourceTypeShare) + 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_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, "match_resource_type", &obj.MatchResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BackupPolicyMatchResourceTypeVolume : BackupPolicyMatchResourceTypeVolume struct // This model "extends" BackupPolicy type BackupPolicyMatchResourceTypeVolume struct { @@ -104330,6 +105938,90 @@ func UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeInstancePrototyp return } +// BackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype : BackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype struct +// This model "extends" BackupPolicyPrototype +type BackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype struct { + // 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"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Scope BackupPolicyScopePrototypeIntf `json:"scope,omitempty"` + + // 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"` +} + +// Constants associated with the BackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype.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 ( + BackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototypeMatchResourceTypeShareConst = "share" +) + +// NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype : Instantiate BackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype(matchUserTags []string, matchResourceType string) (_model *BackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype, err error) { + _model = &BackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype{ + MatchUserTags: matchUserTags, + MatchResourceType: core.StringPtr(matchResourceType), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*BackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype) isaBackupPolicyPrototype() bool { + return true +} + +// UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype unmarshals an instance of BackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPrototypeBackupPolicyMatchResourceTypeSharePrototype) + 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, 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, "match_resource_type", &obj.MatchResourceType) + if err != nil { + err = core.SDKErrorf(err, "", "match_resource_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype : BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype struct // This model "extends" BackupPolicyPrototype type BackupPolicyPrototypeBackupPolicyMatchResourceTypeVolumePrototype struct { @@ -104530,6 +106222,155 @@ func UnmarshalBackupPolicyScopeEnterpriseReference(m map[string]json.RawMessage, return } +// BackupPolicyTargetSnapshotShareSnapshotReference : BackupPolicyTargetSnapshotShareSnapshotReference struct +// This model "extends" BackupPolicyTargetSnapshot +type BackupPolicyTargetSnapshotShareSnapshotReference struct { + // The CRN for this share snapshot. + 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"` + + // The URL for this share snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this share snapshot. + ID *string `json:"id" validate:"required"` + + // The name for this share snapshot. The name is unique across all snapshots for the file share. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyTargetSnapshotShareSnapshotReference.ResourceType property. +// The resource type. +const ( + BackupPolicyTargetSnapshotShareSnapshotReferenceResourceTypeShareSnapshotConst = "share_snapshot" +) + +func (*BackupPolicyTargetSnapshotShareSnapshotReference) isaBackupPolicyTargetSnapshot() bool { + return true +} + +// UnmarshalBackupPolicyTargetSnapshotShareSnapshotReference unmarshals an instance of BackupPolicyTargetSnapshotShareSnapshotReference from the specified map of raw messages. +func UnmarshalBackupPolicyTargetSnapshotShareSnapshotReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyTargetSnapshotShareSnapshotReference) + 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.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 +} + +// BackupPolicyTargetSnapshotSnapshotReference : BackupPolicyTargetSnapshotSnapshotReference struct +// This model "extends" BackupPolicyTargetSnapshot +type BackupPolicyTargetSnapshotSnapshotReference struct { + // The CRN of this snapshot. + 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"` + + // The URL for this snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this snapshot. + ID *string `json:"id" validate:"required"` + + // The name for this snapshot. The name is unique across all snapshots in the region. + 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 *SnapshotRemote `json:"remote,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyTargetSnapshotSnapshotReference.ResourceType property. +// The resource type. +const ( + BackupPolicyTargetSnapshotSnapshotReferenceResourceTypeSnapshotConst = "snapshot" +) + +func (*BackupPolicyTargetSnapshotSnapshotReference) isaBackupPolicyTargetSnapshot() bool { + return true +} + +// UnmarshalBackupPolicyTargetSnapshotSnapshotReference unmarshals an instance of BackupPolicyTargetSnapshotSnapshotReference from the specified map of raw messages. +func UnmarshalBackupPolicyTargetSnapshotSnapshotReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyTargetSnapshotSnapshotReference) + 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, UnmarshalSnapshotRemote) + 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 +} + // BareMetalServerBootTargetBareMetalServerDiskReference : BareMetalServerBootTargetBareMetalServerDiskReference struct // This model "extends" BareMetalServerBootTarget type BareMetalServerBootTargetBareMetalServerDiskReference struct { @@ -127966,7 +129807,7 @@ type SharePrototypeShareBySize struct { // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) will be used. ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The size of the file share rounded up to the next gigabyte. + // The size of the file share (in gigabytes), excluding share snapshots. // // The maximum size for a share may increase in the future. Size *int64 `json:"size" validate:"required"` @@ -128227,24 +130068,303 @@ func UnmarshalSharePrototypeShareBySourceShare(m map[string]json.RawMessage, res err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) + err = core.UnmarshalPrimitive(m, "replication_cron_spec", &obj.ReplicationCronSpec) + if err != nil { + err = core.SDKErrorf(err, "", "replication_cron_spec-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, "source_share", &obj.SourceShare, UnmarshalShareIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SharePrototypeShareBySourceSnapshot : Create a file share from a source snapshot. The initial value for `access_control_mode`, and the zone the file share +// resides in will be inherited from `source_snapshot`. +// This model "extends" SharePrototype +type SharePrototypeShareBySourceSnapshot struct { + // The transit encryption modes to allow for this share. If unspecified: + // - If share mount targets are specified, and those share mount targets all specify a + // `transit_encryption` of `user_managed`, then only `user_managed` will be allowed. + // - Otherwise, all `transit_encryption` modes will be allowed. + AllowedTransitEncryptionModes []string `json:"allowed_transit_encryption_modes,omitempty"` + + // The mount targets for the file share. Each mount target must be in a unique VPC. + MountTargets []ShareMountTargetPrototypeIntf `json:"mount_targets,omitempty"` + + // The name for this share. The name must not be used by another share in the region. If unspecified, the name will be + // a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ReplicaShare *SharePrototypeShareContext `json:"replica_share,omitempty"` + + // Tags for this resource. + UserTags []string `json:"user_tags,omitempty"` + + // The root key to use to wrap the data encryption key for the share. + // + // The specified key may be in a different account, subject to IAM policies. + // + // If unspecified, the source snapshot's `encryption_key` will be used. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The owner assigned to the file share at creation. Subsequent changes to the owner + // must be performed by a client that has mounted the file share. + InitialOwner *ShareInitialOwner `json:"initial_owner,omitempty"` + + // The maximum input/output operations per second (IOPS) for the file share. The share must be in the + // `defined_performance` profile family, and the value must be in the range supported by the share's specified size. + // + // In addition, each client accessing the share will be restricted to 48,000 IOPS. + Iops *int64 `json:"iops,omitempty"` + + // The [profile](https://cloud.ibm.com/docs/vpc?topic=vpc-file-storage-profiles) to use + // for this file share. The profile must support the share's specified IOPS and size. + Profile ShareProfileIdentityIntf `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"` + + // The size to use for the file share (in gigabytes). The specified value must be at least the snapshot's + // `minimum_size`, and must be within the `size` range of the share's profile. + // + // If unspecified, the source snapshot's `minimum_size` will be used. + Size *int64 `json:"size,omitempty"` + + // The source snapshot for this file share. + // + // This file share will reside in the same zone as the specified source snapshot. + // The snapshot must have the `lifecycle_state` as `stable` and `status` as `available` + // to be able to restore a share for it. + SourceSnapshot ShareSourceSnapshotPrototypeIntf `json:"source_snapshot" validate:"required"` +} + +// Constants associated with the SharePrototypeShareBySourceSnapshot.AllowedTransitEncryptionModes property. +// An allowed transit encryption mode for this share. +// - `none`: Not encrypted in transit. +// - `user_managed`: Encrypted in transit using an instance identity certificate. +// +// The enumerated values for this property may +// [expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future. +const ( + SharePrototypeShareBySourceSnapshotAllowedTransitEncryptionModesNoneConst = "none" + SharePrototypeShareBySourceSnapshotAllowedTransitEncryptionModesUserManagedConst = "user_managed" +) + +// NewSharePrototypeShareBySourceSnapshot : Instantiate SharePrototypeShareBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewSharePrototypeShareBySourceSnapshot(profile ShareProfileIdentityIntf, sourceSnapshot ShareSourceSnapshotPrototypeIntf) (_model *SharePrototypeShareBySourceSnapshot, err error) { + _model = &SharePrototypeShareBySourceSnapshot{ + Profile: profile, + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*SharePrototypeShareBySourceSnapshot) isaSharePrototype() bool { + return true +} + +// UnmarshalSharePrototypeShareBySourceSnapshot unmarshals an instance of SharePrototypeShareBySourceSnapshot from the specified map of raw messages. +func UnmarshalSharePrototypeShareBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SharePrototypeShareBySourceSnapshot) + err = core.UnmarshalPrimitive(m, "allowed_transit_encryption_modes", &obj.AllowedTransitEncryptionModes) + if err != nil { + err = core.SDKErrorf(err, "", "allowed_transit_encryption_modes-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "mount_targets", &obj.MountTargets, UnmarshalShareMountTargetPrototype) + if err != nil { + err = core.SDKErrorf(err, "", "mount_targets-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, "replica_share", &obj.ReplicaShare, UnmarshalSharePrototypeShareContext) + if err != nil { + err = core.SDKErrorf(err, "", "replica_share-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + err = core.SDKErrorf(err, "", "user_tags-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, "initial_owner", &obj.InitialOwner, UnmarshalShareInitialOwner) + if err != nil { + err = core.SDKErrorf(err, "", "initial_owner-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + err = core.SDKErrorf(err, "", "iops-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalShareProfileIdentity) + if err != nil { + err = core.SDKErrorf(err, "", "profile-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { - err = core.SDKErrorf(err, "", "replication_cron_spec-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { - err = core.SDKErrorf(err, "", "resource_group-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "source_share", &obj.SourceShare, UnmarshalShareIdentity) + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalShareSourceSnapshotPrototype) if err != nil { - err = core.SDKErrorf(err, "", "source_share-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "source_snapshot-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareSourceSnapshotPrototypeShareSnapshotIdentity : Identifies a share snapshot by a unique property. +// Models which "extend" this model: +// - ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID +// - ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN +// - ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref +// This model "extends" ShareSourceSnapshotPrototype +type ShareSourceSnapshotPrototypeShareSnapshotIdentity struct { + // The unique identifier for this share snapshot. + ID *string `json:"id,omitempty"` + + // The CRN for this share snapshot. + CRN *string `json:"crn,omitempty"` + + // The URL for this share snapshot. + Href *string `json:"href,omitempty"` +} + +func (*ShareSourceSnapshotPrototypeShareSnapshotIdentity) isaShareSourceSnapshotPrototypeShareSnapshotIdentity() bool { + return true +} + +type ShareSourceSnapshotPrototypeShareSnapshotIdentityIntf interface { + ShareSourceSnapshotPrototypeIntf + isaShareSourceSnapshotPrototypeShareSnapshotIdentity() bool +} + +func (*ShareSourceSnapshotPrototypeShareSnapshotIdentity) isaShareSourceSnapshotPrototype() bool { + return true +} + +// UnmarshalShareSourceSnapshotPrototypeShareSnapshotIdentity unmarshals an instance of ShareSourceSnapshotPrototypeShareSnapshotIdentity from the specified map of raw messages. +func UnmarshalShareSourceSnapshotPrototypeShareSnapshotIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareSourceSnapshotPrototypeShareSnapshotIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "zone-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-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) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ShareSourceSnapshotShareSnapshotReference : ShareSourceSnapshotShareSnapshotReference struct +// This model "extends" ShareSourceSnapshot +type ShareSourceSnapshotShareSnapshotReference struct { + // The CRN for this share snapshot. + 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"` + + // The URL for this share snapshot. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this share snapshot. + ID *string `json:"id" validate:"required"` + + // The name for this share snapshot. The name is unique across all snapshots for the file share. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ShareSourceSnapshotShareSnapshotReference.ResourceType property. +// The resource type. +const ( + ShareSourceSnapshotShareSnapshotReferenceResourceTypeShareSnapshotConst = "share_snapshot" +) + +func (*ShareSourceSnapshotShareSnapshotReference) isaShareSourceSnapshot() bool { + return true +} + +// UnmarshalShareSourceSnapshotShareSnapshotReference unmarshals an instance of ShareSourceSnapshotShareSnapshotReference from the specified map of raw messages. +func UnmarshalShareSourceSnapshotShareSnapshotReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareSourceSnapshotShareSnapshotReference) + 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.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)) @@ -143338,6 +145458,123 @@ func UnmarshalShareMountTargetVirtualNetworkInterfacePrototypeVirtualNetworkInte return } +// ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN : ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN struct +// This model "extends" ShareSourceSnapshotPrototypeShareSnapshotIdentity +type ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN struct { + // The CRN for this share snapshot. + CRN *string `json:"crn" validate:"required"` +} + +// NewShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN : Instantiate ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN(crn string) (_model *ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN, err error) { + _model = &ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN) isaShareSourceSnapshotPrototypeShareSnapshotIdentity() bool { + return true +} + +func (*ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN) isaShareSourceSnapshotPrototype() bool { + return true +} + +// UnmarshalShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN unmarshals an instance of ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN from the specified map of raw messages. +func UnmarshalShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByCRN) + 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 +} + +// ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref : ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref struct +// This model "extends" ShareSourceSnapshotPrototypeShareSnapshotIdentity +type ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref struct { + // The URL for this share snapshot. + Href *string `json:"href" validate:"required"` +} + +// NewShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref : Instantiate ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref(href string) (_model *ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref, err error) { + _model = &ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref) isaShareSourceSnapshotPrototypeShareSnapshotIdentity() bool { + return true +} + +func (*ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref) isaShareSourceSnapshotPrototype() bool { + return true +} + +// UnmarshalShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref unmarshals an instance of ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref from the specified map of raw messages. +func UnmarshalShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByHref) + 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 +} + +// ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID : ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID struct +// This model "extends" ShareSourceSnapshotPrototypeShareSnapshotIdentity +type ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID struct { + // The unique identifier for this share snapshot. + ID *string `json:"id" validate:"required"` +} + +// NewShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID : Instantiate ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID (Generic Model Constructor) +func (*VpcV1) NewShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID(id string) (_model *ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID, err error) { + _model = &ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +func (*ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID) isaShareSourceSnapshotPrototypeShareSnapshotIdentity() bool { + return true +} + +func (*ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID) isaShareSourceSnapshotPrototype() bool { + return true +} + +// UnmarshalShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID unmarshals an instance of ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID from the specified map of raw messages. +func UnmarshalShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareSourceSnapshotPrototypeShareSnapshotIdentityShareSnapshotIdentityByID) + 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 +} + // VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch : VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch struct // This model "extends" VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatch type VPNGatewayConnectionPeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPolicyModePeerPatchVPNGatewayConnectionPeerAddressPatch struct { @@ -147750,6 +149987,98 @@ func (pager *ShareMountTargetsPager) GetAll() (allItems []ShareMountTarget, err return } +// ShareSnapshotsPager can be used to simplify the use of the "ListShareSnapshots" method. +type ShareSnapshotsPager struct { + hasNext bool + options *ListShareSnapshotsOptions + client *VpcV1 + pageContext struct { + next *string + } +} + +// NewShareSnapshotsPager returns a new ShareSnapshotsPager instance. +func (vpc *VpcV1) NewShareSnapshotsPager(options *ListShareSnapshotsOptions) (pager *ShareSnapshotsPager, 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 ListShareSnapshotsOptions = *options + pager = &ShareSnapshotsPager{ + hasNext: true, + options: &optionsCopy, + client: vpc, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ShareSnapshotsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ShareSnapshotsPager) GetNextWithContext(ctx context.Context) (page []ShareSnapshot, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListShareSnapshotsWithContext(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.Snapshots + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ShareSnapshotsPager) GetAllWithContext(ctx context.Context) (allItems []ShareSnapshot, err error) { + for pager.HasNext() { + var nextPage []ShareSnapshot + 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 *ShareSnapshotsPager) GetNext() (page []ShareSnapshot, 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 *ShareSnapshotsPager) GetAll() (allItems []ShareSnapshot, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + // BackupPoliciesPager can be used to simplify the use of the "ListBackupPolicies" method. type BackupPoliciesPager struct { hasNext bool diff --git a/go.mod b/go.mod index 4c8922a6c7..99679e09bb 100644 --- a/go.mod +++ b/go.mod @@ -241,7 +241,7 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt // add sdk changes. replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.62.0 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.63.1 => ./common/github.com/IBM/vpc-go-sdk exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policy_job.go b/ibm/service/vpc/data_source_ibm_is_backup_policy_job.go index 0a2defd776..2383044bab 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policy_job.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policy_job.go @@ -612,17 +612,18 @@ func dataSourceBackupPolicyJobStatusReasonsToMap(statusReasonsItem vpcv1.BackupP return statusReasonsMap } -func dataSourceBackupPolicyJobFlattenTargetSnapshot(result []vpcv1.SnapshotReference) (finalList []map[string]interface{}) { +func dataSourceBackupPolicyJobFlattenTargetSnapshot(result []vpcv1.BackupPolicyTargetSnapshotIntf) (finalList []map[string]interface{}) { finalList = []map[string]interface{}{} - for _, snapshotReferenceItem := range result { - finalMap := dataSourceBackupPolicyJobTargetSnapshotToMap(snapshotReferenceItem) + for _, snapshotReferenceIntfItem := range result { + snapshotReferenceItem := snapshotReferenceIntfItem.(*vpcv1.BackupPolicyTargetSnapshot) + finalMap := dataSourceBackupPolicyJobTargetSnapshotToMap(*snapshotReferenceItem) finalList = append(finalList, finalMap) } return finalList } -func dataSourceBackupPolicyJobTargetSnapshotToMap(targetSnapshotItem vpcv1.SnapshotReference) (targetSnapshotMap map[string]interface{}) { +func dataSourceBackupPolicyJobTargetSnapshotToMap(targetSnapshotItem vpcv1.BackupPolicyTargetSnapshot) (targetSnapshotMap map[string]interface{}) { targetSnapshotMap = map[string]interface{}{} if targetSnapshotItem.CRN != nil { diff --git a/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go b/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go index e2eb690f34..3d01d22d97 100644 --- a/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go +++ b/ibm/service/vpc/data_source_ibm_is_backup_policy_jobs.go @@ -528,8 +528,9 @@ func dataSourceBackupPolicyJobCollectionJobsToMap(jobsItem vpcv1.BackupPolicyJob log.Println(jobsItem.TargetSnapshots) if jobsItem.TargetSnapshots != nil { targetSnapshotList := []map[string]interface{}{} - for _, targetSnapshotsItem := range jobsItem.TargetSnapshots { - targetSnapshotMap := dataSourceBackupPolicyJobCollectionJobsTargetSnapshotToMap(targetSnapshotsItem) + for _, targetSnapshotsIntfItem := range jobsItem.TargetSnapshots { + targetSnapshotsItem := targetSnapshotsIntfItem.(*vpcv1.BackupPolicyTargetSnapshot) + targetSnapshotMap := dataSourceBackupPolicyJobCollectionJobsTargetSnapshotToMap(*targetSnapshotsItem) targetSnapshotList = append(targetSnapshotList, targetSnapshotMap) } jobsMap["target_snapshot"] = targetSnapshotList @@ -674,7 +675,7 @@ func dataSourceBackupPolicyJobCollectionJobsStatusReasonsToMap(statusReasonsItem return statusReasonsMap } -func dataSourceBackupPolicyJobCollectionJobsTargetSnapshotToMap(targetSnapshotItem vpcv1.SnapshotReference) (targetSnapshotMap map[string]interface{}) { +func dataSourceBackupPolicyJobCollectionJobsTargetSnapshotToMap(targetSnapshotItem vpcv1.BackupPolicyTargetSnapshot) (targetSnapshotMap map[string]interface{}) { targetSnapshotMap = map[string]interface{}{} if targetSnapshotItem.CRN != nil { From d6fa93dcb218ac75661f303ebb4a24e6cf11f02f Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Thu, 19 Dec 2024 10:27:31 +0530 Subject: [PATCH 103/103] updated go mod with the release --- go.mod | 4 ++-- go.sum | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 99679e09bb..cfcbb85980 100644 --- a/go.mod +++ b/go.mod @@ -41,7 +41,7 @@ require ( github.com/IBM/secrets-manager-go-sdk/v2 v2.0.7 github.com/IBM/vmware-go-sdk v0.1.2 github.com/IBM/vpc-beta-go-sdk v0.8.0 - github.com/IBM/vpc-go-sdk v0.63.1 + github.com/IBM/vpc-go-sdk v0.64.0 github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5 github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 github.com/akamai/AkamaiOPEN-edgegrid-golang/v5 v5.0.0 @@ -241,7 +241,7 @@ replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt // add sdk changes. replace github.com/portworx/sched-ops v0.0.0-20200831185134-3e8010dc7056 => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by rook v1.7 -replace github.com/IBM/vpc-go-sdk v0.63.1 => ./common/github.com/IBM/vpc-go-sdk +replace github.com/IBM/vpc-go-sdk v0.64.0 => ./common/github.com/IBM/vpc-go-sdk exclude ( github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2 diff --git a/go.sum b/go.sum index d705306645..f518b3b21a 100644 --- a/go.sum +++ b/go.sum @@ -198,6 +198,8 @@ github.com/IBM/vpc-beta-go-sdk v0.8.0 h1:cEPpv4iw3Ba5W2d0AWg3TIbKeJ8y1nPuUuibR5J github.com/IBM/vpc-beta-go-sdk v0.8.0/go.mod h1:hORgIyTFRzXrZIK9IohaWmCRBBlYiDRagsufi7M6akE= github.com/IBM/vpc-go-sdk v0.63.1 h1:HqQeq2wGI2pF4y0/m18EaPsOEEXFjyml+xwlLC9AiXE= github.com/IBM/vpc-go-sdk v0.63.1/go.mod h1:VBR6bAznHsNCFA89Ue4JFQpqCcFp8F5neqbCFCyks4Q= +github.com/IBM/vpc-go-sdk v0.64.0 h1:0x2jakapXxXYTTr0EdrwuXa6h0couSK+FTDGxd8jChA= +github.com/IBM/vpc-go-sdk v0.64.0/go.mod h1:VBR6bAznHsNCFA89Ue4JFQpqCcFp8F5neqbCFCyks4Q= github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E= github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0=